From: support Date: Thu, 2 Feb 2023 10:08:55 +0000 (+0000) Subject: Built motion from commit f25620e4.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=92b30a13875d7445ba1ff4454bebfa8160e1430c;p=motion2.git Built motion from commit f25620e4.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b744a27..00bcf4d 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-02-02T09:39:28.183Z", + "time": "2023-02-02T09:59:48.711Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ddf2410..820c2fc 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-02T09:39:28.183Z", + "time": "2023-02-02T09:59:48.711Z", "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 837a877..f29fc47 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 _0xf65a=['motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','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)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration'];(function(_0x4a48e5,_0x36daf4){var _0x1921b8=function(_0x205ac5){while(--_0x205ac5){_0x4a48e5['push'](_0x4a48e5['shift']());}};_0x1921b8(++_0x36daf4);}(_0xf65a,0x19b));var _0xaf65=function(_0x4a30f7,_0x1ff5f6){_0x4a30f7=_0x4a30f7-0x0;var _0x2b6a7b=_0xf65a[_0x4a30f7];return _0x2b6a7b;};'use strict';var Sequelize=require(_0xaf65('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf65('0x1')],'get':function(_0x5db5fb){return this[_0xaf65('0x2')](_0xaf65('0x3'));}},'action':{'type':Sequelize[_0xaf65('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xaf65('0x5'),_0xaf65('0x6'),_0xaf65('0x7'),'jscripty',_0xaf65('0x8'),_0xaf65('0x9'),_0xaf65('0xa'),_0xaf65('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xaf65('0xc')},'data1':{'type':Sequelize[_0xaf65('0x4')](0x1000),'comment':_0xaf65('0xd')},'data2':{'type':Sequelize[_0xaf65('0x4')](0x1000),'comment':_0xaf65('0xe')},'data3':{'type':Sequelize[_0xaf65('0x4')](0x1000),'comment':_0xaf65('0xf')},'data4':{'type':Sequelize[_0xaf65('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xaf65('0x4')](0x1000),'comments':_0xaf65('0x10')},'data6':{'type':Sequelize[_0xaf65('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xaf65('0x11')],'comments':_0xaf65('0x12')}}; \ No newline at end of file +var _0x6b27=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x572c0a,_0x55951b){var _0x12c7f7=function(_0x2582c6){while(--_0x2582c6){_0x572c0a['push'](_0x572c0a['shift']());}};_0x12c7f7(++_0x55951b);}(_0x6b27,0xc3));var _0x76b2=function(_0x89fd1e,_0x344785){_0x89fd1e=_0x89fd1e-0x0;var _0x464931=_0x6b27[_0x89fd1e];return _0x464931;};'use strict';var Sequelize=require(_0x76b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x76b2('0x1')],'get':function(_0xc4d1ca){return this[_0x76b2('0x2')](_0x76b2('0x3'));}},'action':{'type':Sequelize[_0x76b2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x76b2('0x5'),_0x76b2('0x6'),_0x76b2('0x7'),'urlForward','browser',_0x76b2('0x8'),_0x76b2('0x9')]],'msg':_0x76b2('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x76b2('0x4')](0x1000),'comment':_0x76b2('0xb')},'data2':{'type':Sequelize[_0x76b2('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x76b2('0x4')](0x1000),'comment':_0x76b2('0xc')},'data4':{'type':Sequelize[_0x76b2('0x4')](0x1000),'comments':_0x76b2('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x76b2('0xe')],'comments':_0x76b2('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 82ceeb0..efb9414 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 _0x0dc2=['catch','rimraf','zip-dir','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','body','Action','find','params'];(function(_0x1cc294,_0x5d677d){var _0x9af5f=function(_0x55a876){while(--_0x55a876){_0x1cc294['push'](_0x1cc294['shift']());}};_0x9af5f(++_0x5d677d);}(_0x0dc2,0x151));var _0x20dc=function(_0x3c3910,_0x478282){_0x3c3910=_0x3c3910-0x0;var _0x5d34de=_0x0dc2[_0x3c3910];return _0x5d34de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20dc('0x0'));var zipdir=require(_0x20dc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x20dc('0x2'));var BPromise=require(_0x20dc('0x3'));var Mustache=require('mustache');var util=require(_0x20dc('0x4'));var path=require(_0x20dc('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20dc('0x6'));var fs=require('fs');var fs_extra=require(_0x20dc('0x7'));var _=require(_0x20dc('0x8'));var squel=require('squel');var crypto=require(_0x20dc('0x9'));var jsforce=require(_0x20dc('0xa'));var deskjs=require(_0x20dc('0xb'));var toCsv=require(_0x20dc('0xc'));var querystring=require(_0x20dc('0xd'));var Papa=require(_0x20dc('0xe'));var Redis=require(_0x20dc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x20dc('0x10'));var as=require(_0x20dc('0x11'));var hardwareService=require(_0x20dc('0x12'));var logger=require(_0x20dc('0x13'))(_0x20dc('0x14'));var utils=require(_0x20dc('0x15'));var config=require(_0x20dc('0x16'));var licenseUtil=require(_0x20dc('0x17'));var db=require(_0x20dc('0x18'))['db'];function respondWithStatusCode(_0x31d909,_0x1b88fb){_0x1b88fb=_0x1b88fb||0xcc;return function(_0x273051){if(_0x273051){return _0x31d909[_0x20dc('0x19')](_0x1b88fb);}return _0x31d909['status'](_0x1b88fb)['end']();};}function respondWithResult(_0x5e9f1a,_0xc4054e){_0xc4054e=_0xc4054e||0xc8;return function(_0x5ccbc0){if(_0x5ccbc0){return _0x5e9f1a[_0x20dc('0x1a')](_0xc4054e)[_0x20dc('0x1b')](_0x5ccbc0);}};}function respondWithFilteredResult(_0xfba911,_0x38a6ee){return function(_0x6fb4ed){if(_0x6fb4ed){var _0x4624a2=typeof _0x38a6ee[_0x20dc('0x1c')]===_0x20dc('0x1d')&&typeof _0x38a6ee[_0x20dc('0x1e')]==='undefined';var _0x565f98=_0x6fb4ed['count'];var _0x3b2948=_0x4624a2?0x0:_0x38a6ee['offset'];var _0x28223b=_0x4624a2?_0x6fb4ed[_0x20dc('0x1f')]:_0x38a6ee[_0x20dc('0x1c')]+_0x38a6ee[_0x20dc('0x1e')];var _0x2493de;if(_0x28223b>=_0x565f98){_0x28223b=_0x565f98;_0x2493de=0xc8;}else{_0x2493de=0xce;}_0xfba911[_0x20dc('0x1a')](_0x2493de);return _0xfba911[_0x20dc('0x20')](_0x20dc('0x21'),_0x3b2948+'-'+_0x28223b+'/'+_0x565f98)[_0x20dc('0x1b')](_0x6fb4ed);}return null;};}function patchUpdates(_0x52a408){return function(_0x124e21){try{jsonpatch[_0x20dc('0x22')](_0x124e21,_0x52a408,!![]);}catch(_0x33839f){return BPromise['reject'](_0x33839f);}return _0x124e21['save']();};}function saveUpdates(_0x53d3b1,_0x3ce9f1){return function(_0x1479bf){if(_0x1479bf){return _0x1479bf[_0x20dc('0x23')](_0x53d3b1)[_0x20dc('0x24')](function(_0x5be23f){return _0x5be23f;});}return null;};}function removeEntity(_0x24c7c0,_0xb2efc6){return function(_0x373452){if(_0x373452){return _0x373452[_0x20dc('0x25')]()[_0x20dc('0x24')](function(){_0x24c7c0['status'](0xcc)[_0x20dc('0x26')]();});}};}function handleEntityNotFound(_0x224037,_0x44cdf4){return function(_0x56bbf2){if(!_0x56bbf2){_0x224037[_0x20dc('0x19')](0x194);}return _0x56bbf2;};}function handleError(_0x363262,_0x57b172){_0x57b172=_0x57b172||0x1f4;return function(_0x47bace){logger[_0x20dc('0x27')](_0x47bace[_0x20dc('0x28')]);if(_0x47bace[_0x20dc('0x29')]){delete _0x47bace[_0x20dc('0x29')];}_0x363262[_0x20dc('0x1a')](_0x57b172)[_0x20dc('0x2a')](_0x47bace);};}exports['update']=function(_0x268818,_0x43b703){if(_0x268818[_0x20dc('0x2b')]['id']){delete _0x268818[_0x20dc('0x2b')]['id'];}return db[_0x20dc('0x2c')][_0x20dc('0x2d')]({'where':{'id':_0x268818[_0x20dc('0x2e')]['id']}})[_0x20dc('0x24')](handleEntityNotFound(_0x43b703,null))[_0x20dc('0x24')](saveUpdates(_0x268818['body'],null))['then'](respondWithResult(_0x43b703,null))['catch'](handleError(_0x43b703,null));};exports[_0x20dc('0x25')]=function(_0x7e87c,_0x4f8756){return db[_0x20dc('0x2c')][_0x20dc('0x2d')]({'where':{'id':_0x7e87c[_0x20dc('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4f8756,null))[_0x20dc('0x24')](removeEntity(_0x4f8756,null))[_0x20dc('0x2f')](handleError(_0x4f8756,null));}; \ No newline at end of file +var _0xb600=['offset','reject','save','update','then','error','stack','name','send','body','find','params','catch','destroy','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count'];(function(_0x1401e1,_0xabb499){var _0x1aab56=function(_0x1071fd){while(--_0x1071fd){_0x1401e1['push'](_0x1401e1['shift']());}};_0x1aab56(++_0xabb499);}(_0xb600,0xa5));var _0x0b60=function(_0x360926,_0x15f49f){_0x360926=_0x360926-0x0;var _0x33a85a=_0xb600[_0x360926];return _0x33a85a;};'use strict';var emlformat=require(_0x0b60('0x0'));var rimraf=require(_0x0b60('0x1'));var zipdir=require(_0x0b60('0x2'));var jsonpatch=require(_0x0b60('0x3'));var rp=require(_0x0b60('0x4'));var moment=require('moment');var BPromise=require(_0x0b60('0x5'));var Mustache=require(_0x0b60('0x6'));var util=require(_0x0b60('0x7'));var path=require('path');var sox=require(_0x0b60('0x8'));var csv=require(_0x0b60('0x9'));var ejs=require(_0x0b60('0xa'));var fs=require('fs');var fs_extra=require(_0x0b60('0xb'));var _=require(_0x0b60('0xc'));var squel=require(_0x0b60('0xd'));var crypto=require(_0x0b60('0xe'));var jsforce=require(_0x0b60('0xf'));var deskjs=require(_0x0b60('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0b60('0x11'));var Papa=require(_0x0b60('0x12'));var Redis=require(_0x0b60('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0b60('0x14'));var as=require(_0x0b60('0x15'));var hardwareService=require(_0x0b60('0x16'));var logger=require(_0x0b60('0x17'))(_0x0b60('0x18'));var utils=require(_0x0b60('0x19'));var config=require(_0x0b60('0x1a'));var licenseUtil=require(_0x0b60('0x1b'));var db=require(_0x0b60('0x1c'))['db'];function respondWithStatusCode(_0x3d5408,_0x3e9008){_0x3e9008=_0x3e9008||0xcc;return function(_0x34bebe){if(_0x34bebe){return _0x3d5408[_0x0b60('0x1d')](_0x3e9008);}return _0x3d5408['status'](_0x3e9008)[_0x0b60('0x1e')]();};}function respondWithResult(_0x3ec774,_0x3c32c6){_0x3c32c6=_0x3c32c6||0xc8;return function(_0x26da59){if(_0x26da59){return _0x3ec774[_0x0b60('0x1f')](_0x3c32c6)['json'](_0x26da59);}};}function respondWithFilteredResult(_0x448473,_0x46bcdf){return function(_0x362e9c){if(_0x362e9c){var _0x4f232b=typeof _0x46bcdf['offset']===_0x0b60('0x20')&&typeof _0x46bcdf[_0x0b60('0x21')]===_0x0b60('0x20');var _0x1e5c3f=_0x362e9c[_0x0b60('0x22')];var _0x41100a=_0x4f232b?0x0:_0x46bcdf[_0x0b60('0x23')];var _0x51e3ec=_0x4f232b?_0x362e9c[_0x0b60('0x22')]:_0x46bcdf[_0x0b60('0x23')]+_0x46bcdf[_0x0b60('0x21')];var _0x10a65c;if(_0x51e3ec>=_0x1e5c3f){_0x51e3ec=_0x1e5c3f;_0x10a65c=0xc8;}else{_0x10a65c=0xce;}_0x448473[_0x0b60('0x1f')](_0x10a65c);return _0x448473['set']('Content-Range',_0x41100a+'-'+_0x51e3ec+'/'+_0x1e5c3f)['json'](_0x362e9c);}return null;};}function patchUpdates(_0x14f5cf){return function(_0x5dadca){try{jsonpatch['apply'](_0x5dadca,_0x14f5cf,!![]);}catch(_0x3efb79){return BPromise[_0x0b60('0x24')](_0x3efb79);}return _0x5dadca[_0x0b60('0x25')]();};}function saveUpdates(_0x455d5a,_0x29c6cc){return function(_0x38b12f){if(_0x38b12f){return _0x38b12f[_0x0b60('0x26')](_0x455d5a)[_0x0b60('0x27')](function(_0x187298){return _0x187298;});}return null;};}function removeEntity(_0x10242c,_0x32d4aa){return function(_0x2e0d46){if(_0x2e0d46){return _0x2e0d46['destroy']()[_0x0b60('0x27')](function(){_0x10242c[_0x0b60('0x1f')](0xcc)[_0x0b60('0x1e')]();});}};}function handleEntityNotFound(_0x4acdf8,_0x41793e){return function(_0x503613){if(!_0x503613){_0x4acdf8[_0x0b60('0x1d')](0x194);}return _0x503613;};}function handleError(_0x726330,_0x4c4215){_0x4c4215=_0x4c4215||0x1f4;return function(_0x6eb0f3){logger[_0x0b60('0x28')](_0x6eb0f3[_0x0b60('0x29')]);if(_0x6eb0f3[_0x0b60('0x2a')]){delete _0x6eb0f3[_0x0b60('0x2a')];}_0x726330['status'](_0x4c4215)[_0x0b60('0x2b')](_0x6eb0f3);};}exports['update']=function(_0x48ac4b,_0x5a9d14){if(_0x48ac4b[_0x0b60('0x2c')]['id']){delete _0x48ac4b[_0x0b60('0x2c')]['id'];}return db['Action'][_0x0b60('0x2d')]({'where':{'id':_0x48ac4b[_0x0b60('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5a9d14,null))['then'](saveUpdates(_0x48ac4b[_0x0b60('0x2c')],null))[_0x0b60('0x27')](respondWithResult(_0x5a9d14,null))[_0x0b60('0x2f')](handleError(_0x5a9d14,null));};exports[_0x0b60('0x30')]=function(_0xd4b69e,_0xc871d6){return db[_0x0b60('0x31')][_0x0b60('0x2d')]({'where':{'id':_0xd4b69e[_0x0b60('0x2e')]['id']}})[_0x0b60('0x27')](handleEntityNotFound(_0xc871d6,null))['then'](removeEntity(_0xc871d6,null))[_0x0b60('0x2f')](handleError(_0xc871d6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2f6901f..247dbee 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 _0x08e8=['./action.attributes','exports','Action','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x08e8,0xc9));var _0x808e=function(_0x5c82b9,_0x16999c){_0x5c82b9=_0x5c82b9-0x0;var _0x4a0829=_0x08e8[_0x5c82b9];return _0x4a0829;};'use strict';var _=require('lodash');var util=require(_0x808e('0x0'));var logger=require('../../config/logger')(_0x808e('0x1'));var moment=require(_0x808e('0x2'));var BPromise=require(_0x808e('0x3'));var rp=require(_0x808e('0x4'));var fs=require('fs');var path=require(_0x808e('0x5'));var rimraf=require(_0x808e('0x6'));var config=require(_0x808e('0x7'));var attributes=require(_0x808e('0x8'));module[_0x808e('0x9')]=function(_0xb4cdbe,_0x5c4278){return _0xb4cdbe['define'](_0x808e('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa723=['moment','bluebird','request-promise','path','../../config/environment','./action.attributes','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x2380b2,_0x4cf1cf){var _0x495c21=function(_0x4a70b8){while(--_0x4a70b8){_0x2380b2['push'](_0x2380b2['shift']());}};_0x495c21(++_0x4cf1cf);}(_0xa723,0x110));var _0x3a72=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0xa723[_0x1306f3];return _0xc1c7bf;};'use strict';var _=require(_0x3a72('0x0'));var util=require('util');var logger=require(_0x3a72('0x1'))(_0x3a72('0x2'));var moment=require(_0x3a72('0x3'));var BPromise=require(_0x3a72('0x4'));var rp=require(_0x3a72('0x5'));var fs=require('fs');var path=require(_0x3a72('0x6'));var rimraf=require('rimraf');var config=require(_0x3a72('0x7'));var attributes=require(_0x3a72('0x8'));module['exports']=function(_0x1bc9f6,_0x5a5536){return _0x1bc9f6['define'](_0x3a72('0x9'),attributes,{'tableName':_0x3a72('0xa'),'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 f0efddd..be1384d 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0xf494,0x1c6));var _0x4f49=function(_0x1843f1,_0x175a27){_0x1843f1=_0x1843f1-0x0;var _0x341bb3=_0xf494[_0x1843f1];return _0x341bb3;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x57fe81,_0x5ab32f){_0x57fe81=_0x57fe81-0x0;var _0x245330=_0x7a54[_0x57fe81];return _0x245330;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ee1c2ec..fe99cc6 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 _0x5cb5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','destroy','exports','multer','path','express'];(function(_0xef6c0d,_0x698c54){var _0x568b1c=function(_0x23b136){while(--_0x23b136){_0xef6c0d['push'](_0xef6c0d['shift']());}};_0x568b1c(++_0x698c54);}(_0x5cb5,0x1cb));var _0x55cb=function(_0x166c52,_0x208d0f){_0x166c52=_0x166c52-0x0;var _0x2c526d=_0x5cb5[_0x166c52];return _0x2c526d;};'use strict';var multer=require(_0x55cb('0x0'));var util=require('util');var path=require(_0x55cb('0x1'));var timeout=require('connect-timeout');var express=require(_0x55cb('0x2'));var router=express[_0x55cb('0x3')]();var fs_extra=require(_0x55cb('0x4'));var auth=require(_0x55cb('0x5'));var interaction=require(_0x55cb('0x6'));var config=require(_0x55cb('0x7'));var controller=require(_0x55cb('0x8'));router[_0x55cb('0x9')](_0x55cb('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x55cb('0xa'),auth[_0x55cb('0xb')](),controller[_0x55cb('0xc')]);module[_0x55cb('0xd')]=router; \ No newline at end of file +var _0x2a63=['../../components/auth/service','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2a3ee3,_0x45e68f){var _0x4a0b34=function(_0x368d7e){while(--_0x368d7e){_0x2a3ee3['push'](_0x2a3ee3['shift']());}};_0x4a0b34(++_0x45e68f);}(_0x2a63,0x79));var _0x32a6=function(_0x3bd4e5,_0x33854f){_0x3bd4e5=_0x3bd4e5-0x0;var _0x2d1522=_0x2a63[_0x3bd4e5];return _0x2d1522;};'use strict';var multer=require(_0x32a6('0x0'));var util=require(_0x32a6('0x1'));var path=require(_0x32a6('0x2'));var timeout=require(_0x32a6('0x3'));var express=require(_0x32a6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x32a6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32a6('0x6'));router[_0x32a6('0x7')]('/:id',auth[_0x32a6('0x8')](),controller[_0x32a6('0x9')]);router[_0x32a6('0xa')](_0x32a6('0xb'),auth[_0x32a6('0x8')](),controller[_0x32a6('0xc')]);module[_0x32a6('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 0a30b96..20f897d 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x6d1c65,_0x22df6e){var _0x1e96b4=function(_0xc1aac4){while(--_0xc1aac4){_0x6d1c65['push'](_0x6d1c65['shift']());}};_0x1e96b4(++_0x22df6e);}(_0x5fab,0x177));var _0xb5fa=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x5fab[_0x4f35f4];return _0x2e9a70;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x262d98,_0x1236e9){var _0x38c0fb=function(_0x2d9835){while(--_0x2d9835){_0x262d98['push'](_0x262d98['shift']());}};_0x38c0fb(++_0x1236e9);}(_0xda19,0xd5));var _0x9da1=function(_0x1dfc71,_0x52cbd3){_0x1dfc71=_0x1dfc71-0x0;var _0x449188=_0xda19[_0x1dfc71];return _0x449188;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2c674ab..10edd2d 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 _0xfb0e=['startDate','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','SEC_TO_TIME(%s)','rimraf','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','type','keys','filters','intersection','model','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','MetricId','function','replace','format','groupBy','orderBy','joins','parse','parentKey','foreignTable','foreignKey','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','AnalyticMetric','select','from','DESC','alias','output','web','fullPath','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','create','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfb0e,0x1e8));var _0xefb0=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xfb0e[_0x49a57c];return _0x4e0316;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefb0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefb0('0x1'));var rp=require(_0xefb0('0x2'));var moment=require(_0xefb0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xefb0('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xefb0('0x5'));var ejs=require(_0xefb0('0x6'));var fs=require('fs');var fs_extra=require(_0xefb0('0x7'));var _=require(_0xefb0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xefb0('0x5'));var querystring=require(_0xefb0('0x9'));var Papa=require(_0xefb0('0xa'));var Redis=require(_0xefb0('0xb'));var authService=require(_0xefb0('0xc'));var qs=require(_0xefb0('0xd'));var as=require(_0xefb0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefb0('0xf'))(_0xefb0('0x10'));var utils=require(_0xefb0('0x11'));var config=require(_0xefb0('0x12'));var licenseUtil=require(_0xefb0('0x13'));var db=require(_0xefb0('0x14'))['db'];var dbH=require('../../mysqldb')[_0xefb0('0x15')];function respondWithStatusCode(_0x672f33,_0xc8f08){_0xc8f08=_0xc8f08||0xcc;return function(_0x30a511){if(_0x30a511){return _0x672f33['sendStatus'](_0xc8f08);}return _0x672f33[_0xefb0('0x16')](_0xc8f08)[_0xefb0('0x17')]();};}function respondWithResult(_0x6e0ba1,_0x2ec684){_0x2ec684=_0x2ec684||0xc8;return function(_0x4d9f93){if(_0x4d9f93){return _0x6e0ba1[_0xefb0('0x16')](_0x2ec684)[_0xefb0('0x18')](_0x4d9f93);}};}function respondWithFilteredResult(_0x13d939,_0x440abb){return function(_0x14eba8){if(_0x14eba8){var _0x43cfc1=typeof _0x440abb[_0xefb0('0x19')]==='undefined'&&typeof _0x440abb['limit']===_0xefb0('0x1a');var _0x4d40a7=_0x14eba8[_0xefb0('0x1b')];var _0x8655d=_0x43cfc1?0x0:_0x440abb[_0xefb0('0x19')];var _0x270c80=_0x43cfc1?_0x14eba8[_0xefb0('0x1b')]:_0x440abb[_0xefb0('0x19')]+_0x440abb[_0xefb0('0x1c')];var _0x114910;if(_0x270c80>=_0x4d40a7){_0x270c80=_0x4d40a7;_0x114910=0xc8;}else{_0x114910=0xce;}_0x13d939['status'](_0x114910);return _0x13d939['set'](_0xefb0('0x1d'),_0x8655d+'-'+_0x270c80+'/'+_0x4d40a7)[_0xefb0('0x18')](_0x14eba8);}return null;};}function patchUpdates(_0x3f843c){return function(_0x49d5df){try{jsonpatch[_0xefb0('0x1e')](_0x49d5df,_0x3f843c,!![]);}catch(_0x1750d1){return BPromise[_0xefb0('0x1f')](_0x1750d1);}return _0x49d5df[_0xefb0('0x20')]();};}function saveUpdates(_0x258754,_0x5aaae7){return function(_0x2145a8){if(_0x2145a8){return _0x2145a8[_0xefb0('0x21')](_0x258754)[_0xefb0('0x22')](function(_0x3ab5e1){return _0x3ab5e1;});}return null;};}function removeEntity(_0xa4960d,_0x146e71){return function(_0x1ec043){if(_0x1ec043){return _0x1ec043[_0xefb0('0x23')]()['then'](function(){var _0x3c460c=_0x1ec043[_0xefb0('0x24')]({'plain':!![]});var _0x3f291a=_0xefb0('0x25');return db[_0xefb0('0x26')][_0xefb0('0x23')]({'where':{'type':_0x3f291a,'resourceId':_0x3c460c['id']}})[_0xefb0('0x22')](function(){return _0x1ec043;});})[_0xefb0('0x22')](function(){_0xa4960d['status'](0xcc)[_0xefb0('0x17')]();});}};}function handleEntityNotFound(_0x174723,_0xa68bda){return function(_0x56a601){if(!_0x56a601){_0x174723[_0xefb0('0x27')](0x194);}return _0x56a601;};}function handleError(_0x5187cc,_0x539d05){_0x539d05=_0x539d05||0x1f4;return function(_0x5435f6){logger[_0xefb0('0x28')](_0x5435f6[_0xefb0('0x29')]);if(_0x5435f6['name']){delete _0x5435f6[_0xefb0('0x2a')];}_0x5187cc[_0xefb0('0x16')](_0x539d05)['send'](_0x5435f6);};}exports[_0xefb0('0x2b')]=function(_0x3debda,_0x7e3e50){var _0x518afe={},_0x4e887c={},_0x34ab6b={'count':0x0,'rows':[]};var _0x4b1ea1=_[_0xefb0('0x2c')](db[_0xefb0('0x2d')][_0xefb0('0x2e')],function(_0x1a1b93){return{'name':_0x1a1b93['fieldName'],'type':_0x1a1b93[_0xefb0('0x2f')]['key']};});_0x4e887c['model']=_[_0xefb0('0x2c')](_0x4b1ea1,_0xefb0('0x2a'));_0x4e887c['query']=_[_0xefb0('0x30')](_0x3debda['query']);_0x4e887c[_0xefb0('0x31')]=_[_0xefb0('0x32')](_0x4e887c[_0xefb0('0x33')],_0x4e887c['query']);_0x518afe[_0xefb0('0x34')]=_[_0xefb0('0x32')](_0x4e887c[_0xefb0('0x33')],qs['fields'](_0x3debda[_0xefb0('0x35')][_0xefb0('0x36')]));_0x518afe['attributes']=_0x518afe['attributes'][_0xefb0('0x37')]?_0x518afe[_0xefb0('0x34')]:_0x4e887c[_0xefb0('0x33')];if(!_0x3debda[_0xefb0('0x35')][_0xefb0('0x38')](_0xefb0('0x39'))){_0x518afe['limit']=qs['limit'](_0x3debda[_0xefb0('0x35')]['limit']);_0x518afe[_0xefb0('0x19')]=qs[_0xefb0('0x19')](_0x3debda[_0xefb0('0x35')]['offset']);}_0x518afe[_0xefb0('0x3a')]=qs[_0xefb0('0x3b')](_0x3debda[_0xefb0('0x35')][_0xefb0('0x3b')]);_0x518afe[_0xefb0('0x3c')]=qs[_0xefb0('0x31')](_['pick'](_0x3debda['query'],_0x4e887c[_0xefb0('0x31')]),_0x4b1ea1);if(_0x3debda[_0xefb0('0x35')][_0xefb0('0x3d')]){_0x518afe[_0xefb0('0x3c')]=_[_0xefb0('0x3e')](_0x518afe[_0xefb0('0x3c')],{'$or':_[_0xefb0('0x2c')](_0x4b1ea1,function(_0x5159c4){if(_0x5159c4[_0xefb0('0x2f')]!==_0xefb0('0x3f')){var _0x45daff={};_0x45daff[_0x5159c4[_0xefb0('0x2a')]]={'$like':'%'+_0x3debda['query']['filter']+'%'};return _0x45daff;}})});}_0x518afe=_[_0xefb0('0x3e')]({},_0x518afe,_0x3debda['options']);var _0x2fec1b={'where':_0x518afe['where']};return db['AnalyticCustomReport']['count'](_0x2fec1b)[_0xefb0('0x22')](function(_0x33f45d){_0x34ab6b[_0xefb0('0x1b')]=_0x33f45d;if(_0x3debda['query']['includeAll']){_0x518afe['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xefb0('0x40')](_0x518afe);})[_0xefb0('0x22')](function(_0x1490ca){_0x34ab6b['rows']=_0x1490ca;return _0x34ab6b;})[_0xefb0('0x22')](respondWithFilteredResult(_0x7e3e50,_0x518afe))[_0xefb0('0x41')](handleError(_0x7e3e50,null));};exports[_0xefb0('0x42')]=function(_0x275d5a,_0xd1fa96){var _0x59cdcd={'raw':![],'where':{'id':_0x275d5a[_0xefb0('0x43')]['id']}},_0x4c0c53={};_0x4c0c53[_0xefb0('0x33')]=_[_0xefb0('0x30')](db['AnalyticCustomReport'][_0xefb0('0x2e')]);_0x4c0c53['query']=_[_0xefb0('0x30')](_0x275d5a[_0xefb0('0x35')]);_0x4c0c53[_0xefb0('0x31')]=_['intersection'](_0x4c0c53[_0xefb0('0x33')],_0x4c0c53[_0xefb0('0x35')]);_0x59cdcd[_0xefb0('0x34')]=_[_0xefb0('0x32')](_0x4c0c53[_0xefb0('0x33')],qs['fields'](_0x275d5a[_0xefb0('0x35')][_0xefb0('0x36')]));_0x59cdcd['attributes']=_0x59cdcd[_0xefb0('0x34')][_0xefb0('0x37')]?_0x59cdcd[_0xefb0('0x34')]:_0x4c0c53[_0xefb0('0x33')];if(_0x275d5a[_0xefb0('0x35')][_0xefb0('0x44')]){_0x59cdcd[_0xefb0('0x45')]=[{'all':!![]}];}_0x59cdcd=_[_0xefb0('0x3e')]({},_0x59cdcd,_0x275d5a[_0xefb0('0x46')]);return db['AnalyticCustomReport'][_0xefb0('0x47')](_0x59cdcd)['then'](handleEntityNotFound(_0xd1fa96,null))[_0xefb0('0x22')](respondWithResult(_0xd1fa96,null))[_0xefb0('0x41')](handleError(_0xd1fa96,null));};exports['create']=function(_0x495183,_0x80e43a){return db['AnalyticCustomReport']['create'](_0x495183[_0xefb0('0x48')],{})[_0xefb0('0x22')](function(_0x146607){var _0x15b5f7=_0x495183[_0xefb0('0x49')][_0xefb0('0x24')]({'plain':!![]});if(!_0x15b5f7)throw new Error(_0xefb0('0x4a'));if(_0x15b5f7[_0xefb0('0x4b')]==='user'){var _0x2e0df3=_0x146607['get']({'plain':!![]});var _0x3a0558=_0xefb0('0x4c');return db[_0xefb0('0x4d')][_0xefb0('0x47')]({'where':{'name':_0x3a0558,'userProfileId':_0x15b5f7[_0xefb0('0x4e')]},'raw':!![]})[_0xefb0('0x22')](function(_0x795892){if(_0x795892&&_0x795892['autoAssociation']===0x0){return db[_0xefb0('0x26')]['create']({'name':_0x2e0df3[_0xefb0('0x2a')],'resourceId':_0x2e0df3['id'],'type':_0xefb0('0x25'),'sectionId':_0x795892['id']},{})[_0xefb0('0x22')](function(){return _0x146607;});}else{return _0x146607;}})[_0xefb0('0x41')](function(_0x4e968f){logger[_0xefb0('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e968f);throw _0x4e968f;});}return _0x146607;})['then'](respondWithResult(_0x80e43a,0xc9))[_0xefb0('0x41')](handleError(_0x80e43a,null));};exports[_0xefb0('0x21')]=function(_0x23ec09,_0x4013dd){if(_0x23ec09[_0xefb0('0x48')]['id']){delete _0x23ec09[_0xefb0('0x48')]['id'];}return db[_0xefb0('0x2d')][_0xefb0('0x47')]({'where':{'id':_0x23ec09[_0xefb0('0x43')]['id']}})[_0xefb0('0x22')](handleEntityNotFound(_0x4013dd,null))[_0xefb0('0x22')](saveUpdates(_0x23ec09['body'],null))[_0xefb0('0x22')](respondWithResult(_0x4013dd,null))[_0xefb0('0x41')](handleError(_0x4013dd,null));};exports[_0xefb0('0x23')]=function(_0x299c73,_0x9f3019){return db[_0xefb0('0x2d')][_0xefb0('0x47')]({'where':{'id':_0x299c73['params']['id']}})[_0xefb0('0x22')](handleEntityNotFound(_0x9f3019,null))['then'](removeEntity(_0x9f3019,null))[_0xefb0('0x41')](handleError(_0x9f3019,null));};exports['preview']=function(_0xbea280,_0x59eb72){var _0x40f485=0xa;var _0x299195=[_0xefb0('0x4f'),_0xefb0('0x50'),_0xefb0('0x51'),_0xefb0('0x52')];var _0x5832a8={'SUM':_0xefb0('0x53'),'COUNT':_0xefb0('0x54'),'COUNT DISTINCT':_0xefb0('0x55'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xefb0('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xefb0('0x57')};var _0x4d1c66={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xefb0('0x58'),'ROUND':_0xefb0('0x59'),'UNIX_TIMESTAMP':_0xefb0('0x5a')};var _0x359a2d=function(_0x393a5e){return!_[_0xefb0('0x5b')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xefb0('0x5c')],_0x393a5e);};var _0x15188d=function(_0x431c73){if(!_0x431c73||!_0x431c73[_0xefb0('0x5d')][_0xefb0('0x37')]){return'';}for(var _0x56ab3c='(',_0x1e66f9=0x0;_0x1e66f9<_0x431c73[_0xefb0('0x5d')][_0xefb0('0x37')];_0x1e66f9+=0x1){_0x1e66f9>0x0&&(_0x56ab3c+='\x20'+_0x431c73[_0xefb0('0x5e')]+'\x20');_0x56ab3c+=_0x431c73[_0xefb0('0x5d')][_0x1e66f9][_0xefb0('0x5f')]?_0x15188d(_0x431c73['rules'][_0x1e66f9][_0xefb0('0x5f')]):_0x431c73['rules'][_0x1e66f9][_0xefb0('0x60')]+'\x20'+_0x431c73[_0xefb0('0x5d')][_0x1e66f9]['condition']+(_0x359a2d(_0x431c73[_0xefb0('0x5d')][_0x1e66f9][_0xefb0('0x61')])?'\x20'+_0x431c73[_0xefb0('0x5d')][_0x1e66f9][_0xefb0('0x62')]:'');}return _0x56ab3c+')';};var _0x10ec95={'where':{'id':_0xbea280[_0xefb0('0x43')]['id']}},_0x461a47,_0x255fb4,_0x3c7f92,_0x1d95a4,_0x459534;_0x10ec95=_[_0xefb0('0x3e')]({},_0x10ec95,_0xbea280[_0xefb0('0x46')]);return db[_0xefb0('0x2d')][_0xefb0('0x47')](_0x10ec95)['then'](function(_0x121970){if(_0x121970){_0x461a47=_0x121970;return _0x121970[_0xefb0('0x63')]();}return null;})[_0xefb0('0x22')](function(_0x190c5c){if(_0x190c5c){if(!_0x190c5c[_0xefb0('0x37')]){throw new db[(_0xefb0('0x64'))][(_0xefb0('0x65'))](_0xefb0('0x66'),0x193);}_0x255fb4=_0x190c5c;return db['AnalyticMetric'][_0xefb0('0x40')]({'raw':!![]});}return null;})['then'](function(_0xfac1b6){if(_0xfac1b6){_0x3c7f92=_[_0xefb0('0x67')](_0xfac1b6,'id');var _0x39b117;var _0x3b44f0=squel['select']();_0x3b44f0['from'](_0x461a47['table']);for(var _0x50000e=0x0;_0x50000e<_0x255fb4[_0xefb0('0x37')];_0x50000e+=0x1){_0x39b117=_0x255fb4[_0x50000e][_0xefb0('0x68')]?_0x3c7f92[_0x255fb4[_0x50000e]['MetricId']]['metric']:_0x255fb4[_0x50000e][_0xefb0('0x60')];_0x39b117=_0x255fb4[_0x50000e][_0xefb0('0x69')]?_[_0xefb0('0x6a')](_0x5832a8[_0x255fb4[_0x50000e][_0xefb0('0x69')]],'%s',_0x39b117):_0x39b117;_0x39b117=_0x255fb4[_0x50000e][_0xefb0('0x6b')]?_[_0xefb0('0x6a')](_0x4d1c66[_0x255fb4[_0x50000e]['format']],'%s',_0x39b117):_0x39b117;if(_0x255fb4[_0x50000e][_0xefb0('0x6c')]){_0x3b44f0[_0xefb0('0x5f')](_0x39b117);}_0x255fb4[_0x50000e][_0xefb0('0x6d')]&&_0x3b44f0[_0xefb0('0x3a')](_0x39b117,_0x255fb4[_0x50000e]['orderBy']==='DESC'?![]:!![]);_0x3b44f0[_0xefb0('0x60')](_0x39b117,_0x255fb4[_0x50000e]['alias']||_0x39b117);}if(_0x461a47[_0xefb0('0x6e')]){_0x461a47[_0xefb0('0x6e')]=JSON[_0xefb0('0x6f')](_0x461a47[_0xefb0('0x6e')]);for(var _0x583a25=0x0;_0x583a25<_0x461a47[_0xefb0('0x6e')][_0xefb0('0x37')];_0x583a25+=0x1){if(_0x461a47[_0xefb0('0x6e')][_0x583a25]['type']&&_[_0xefb0('0x5b')](_0x299195,_0x461a47['joins'][_0x583a25][_0xefb0('0x2f')])&&_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x70')]&&_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x71')]&&_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x72')]){_0x3b44f0[_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x2f')]](_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x71')],null,util[_0xefb0('0x6b')]('%s.%s\x20=\x20%s.%s',_0x461a47[_0xefb0('0x73')],_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x70')],_0x461a47[_0xefb0('0x6e')][_0x583a25][_0xefb0('0x71')],_0x461a47[_0xefb0('0x6e')][_0x583a25]['foreignKey']));}}}if(_0x461a47[_0xefb0('0x74')]){_0x461a47[_0xefb0('0x74')]=JSON[_0xefb0('0x6f')](_0x461a47[_0xefb0('0x74')]);_0x3b44f0[_0xefb0('0x3c')](_0x15188d(_0x461a47[_0xefb0('0x74')][_0xefb0('0x5f')]));}_0x459534=_0x3b44f0[_0xefb0('0x75')]();_0x3b44f0[_0xefb0('0x1c')](_0x40f485);_0x3b44f0[_0xefb0('0x19')](0x0);logger[_0xefb0('0x76')](_0xefb0('0x77'),_0x3b44f0[_0xefb0('0x78')]());return dbH[_0xefb0('0x79')][_0xefb0('0x35')](_0x3b44f0[_0xefb0('0x78')](),{'type':dbH['sequelize'][_0xefb0('0x7a')][_0xefb0('0x7b')]});}})[_0xefb0('0x22')](respondWithResult(_0x59eb72,null))[_0xefb0('0x41')](handleError(_0x59eb72,null));};function runReport(_0x5a4894,_0x202eda,_0x59b9ac){var _0x3b36a9=_0x202eda['name'];var _0xd04d61=0xa;var _0x4025b9=[_0xefb0('0x4f'),_0xefb0('0x50'),'right_join','cross_join'];var _0x1045d3={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xefb0('0x55'),'MAX':_0xefb0('0x7c'),'MIN':_0xefb0('0x7d'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xefb0('0x7e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5c9191={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xefb0('0x7f'),'HOUR':_0xefb0('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xefb0('0x5a')};var _0xd93750=function(_0x3c9441){return!_['includes']([_0xefb0('0x80'),_0xefb0('0x81'),_0xefb0('0x82'),_0xefb0('0x5c')],_0x3c9441);};var _0x20f385=function(_0x36c5fb){if(!_0x36c5fb||!_0x36c5fb[_0xefb0('0x5d')][_0xefb0('0x37')]){return'';}for(var _0x543d3f='(',_0xcd3911=0x0;_0xcd3911<_0x36c5fb['rules'][_0xefb0('0x37')];_0xcd3911+=0x1){_0xcd3911>0x0&&(_0x543d3f+='\x20'+_0x36c5fb[_0xefb0('0x5e')]+'\x20');_0x543d3f+=_0x36c5fb[_0xefb0('0x5d')][_0xcd3911][_0xefb0('0x5f')]?_0x20f385(_0x36c5fb[_0xefb0('0x5d')][_0xcd3911][_0xefb0('0x5f')]):_0x36c5fb['rules'][_0xcd3911][_0xefb0('0x60')]+'\x20'+_0x36c5fb[_0xefb0('0x5d')][_0xcd3911][_0xefb0('0x61')]+(_0xd93750(_0x36c5fb['rules'][_0xcd3911][_0xefb0('0x61')])?'\x20'+_0x36c5fb['rules'][_0xcd3911][_0xefb0('0x62')]:'');}return _0x543d3f+')';};var _0x4c9fca={'where':{'id':_0x5a4894['id']}},_0xef57a0,_0x3869be,_0x10c13c,_0x5b9334,_0x502f18;_0x4c9fca=_[_0xefb0('0x3e')]({},_0x4c9fca,_0x59b9ac);return db[_0xefb0('0x2d')]['find'](_0x4c9fca)['then'](function(_0x37c211){if(_0x37c211){_0xef57a0=_0x37c211;return _0x37c211['getFields']();}return null;})[_0xefb0('0x22')](function(_0x40de47){if(_0x40de47){if(!_0x40de47['length']){throw new db[(_0xefb0('0x64'))][(_0xefb0('0x65'))](_0xefb0('0x66'),0x193);}_0x3869be=_0x40de47;return db[_0xefb0('0x83')][_0xefb0('0x40')]({'raw':!![]});}return null;})[_0xefb0('0x22')](function(_0x30d973){if(_0x30d973){_0x10c13c=_['keyBy'](_0x30d973,'id');var _0x25a3d0;var _0xaf967a=squel[_0xefb0('0x84')]();_0xaf967a[_0xefb0('0x85')](_0xef57a0['table']);for(var _0x5375b0=0x0;_0x5375b0<_0x3869be[_0xefb0('0x37')];_0x5375b0+=0x1){_0x25a3d0=_0x3869be[_0x5375b0][_0xefb0('0x68')]?_0x10c13c[_0x3869be[_0x5375b0][_0xefb0('0x68')]]['metric']:_0x3869be[_0x5375b0][_0xefb0('0x60')];_0x25a3d0=_0x3869be[_0x5375b0][_0xefb0('0x69')]?_[_0xefb0('0x6a')](_0x1045d3[_0x3869be[_0x5375b0][_0xefb0('0x69')]],'%s',_0x25a3d0):_0x25a3d0;_0x25a3d0=_0x3869be[_0x5375b0][_0xefb0('0x6b')]?_['replace'](_0x5c9191[_0x3869be[_0x5375b0][_0xefb0('0x6b')]],'%s',_0x25a3d0):_0x25a3d0;if(_0x3869be[_0x5375b0][_0xefb0('0x6c')]){_0xaf967a[_0xefb0('0x5f')](_0x25a3d0);}_0x3869be[_0x5375b0][_0xefb0('0x6d')]&&_0xaf967a[_0xefb0('0x3a')](_0x25a3d0,_0x3869be[_0x5375b0]['orderBy']===_0xefb0('0x86')?![]:!![]);_0xaf967a[_0xefb0('0x60')](_0x25a3d0,_0x3869be[_0x5375b0][_0xefb0('0x87')]||_0x25a3d0);}if(_0xef57a0[_0xefb0('0x6e')]){_0xef57a0[_0xefb0('0x6e')]=JSON['parse'](_0xef57a0[_0xefb0('0x6e')]);for(var _0x576eb7=0x0;_0x576eb7<_0xef57a0['joins'][_0xefb0('0x37')];_0x576eb7+=0x1){if(_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x2f')]&&_[_0xefb0('0x5b')](_0x4025b9,_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x2f')])&&_0xef57a0['joins'][_0x576eb7][_0xefb0('0x70')]&&_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x71')]&&_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x72')]){_0xaf967a[_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x2f')]](_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x71')],null,util[_0xefb0('0x6b')]('%s.%s\x20=\x20%s.%s',_0xef57a0[_0xefb0('0x73')],_0xef57a0[_0xefb0('0x6e')][_0x576eb7]['parentKey'],_0xef57a0[_0xefb0('0x6e')][_0x576eb7]['foreignTable'],_0xef57a0[_0xefb0('0x6e')][_0x576eb7][_0xefb0('0x72')]));}}}if(_0xef57a0[_0xefb0('0x74')]){_0xef57a0[_0xefb0('0x74')]=JSON[_0xefb0('0x6f')](_0xef57a0['conditions']);_0xaf967a[_0xefb0('0x3c')](_0x20f385(_0xef57a0['conditions'][_0xefb0('0x5f')]));}_0x502f18=_0xaf967a[_0xefb0('0x75')]();_0xaf967a[_0xefb0('0x1c')](_0xd04d61);_0xaf967a[_0xefb0('0x19')](0x0);return;}})[_0xefb0('0x22')](function(){if(_0x202eda[_0xefb0('0x88')]===_0xefb0('0x89')){return null;}var _0x1c8166=_[_0xefb0('0x3e')](_0x202eda,{'name':_0x202eda[_0xefb0('0x8a')]||_0x202eda['name']||_0xef57a0[_0xefb0('0x2a')],'basename':_0x3b36a9,'savename':util[_0xefb0('0x6b')](_0xefb0('0x8b'),_0x202eda[_0xefb0('0x2a')]||_0xef57a0[_0xefb0('0x2a')],require(_0xefb0('0x8c'))[_0xefb0('0x8d')](0x4),_0x202eda['output']||'csv'),'reportId':_0xef57a0['id'],'reportType':'custom'});return db[_0xefb0('0x8e')][_0xefb0('0x8f')](_0x1c8166,{'raw':!![]});})[_0xefb0('0x22')](function(_0x59e730){if(_0xef57a0['table']===_0xefb0('0x90')){_0x502f18[_0xefb0('0x3c')](_0xef57a0[_0xefb0('0x73')]+_0xefb0('0x91'),_0x202eda['startDate'],_0x202eda[_0xefb0('0x92')]);}else{_0x502f18[_0xefb0('0x3c')](_0xef57a0[_0xefb0('0x73')]+_0xefb0('0x93'),_0x202eda[_0xefb0('0x94')],_0x202eda[_0xefb0('0x92')]);}if(_0x59e730){logger['info']('Run\x20Query:',_0x502f18[_0xefb0('0x78')]());require(_0xefb0('0x95'))[_0xefb0('0x96')](path['join'](__dirname,_0xefb0('0x97'),_0x59e730[_0xefb0('0x88')]),[_0x59e730['id'],_0x502f18[_0xefb0('0x78')](),path[_0xefb0('0x4f')](__dirname,_0xefb0('0x98'),_0x59e730[_0xefb0('0x99')]),_0x3b36a9]);return _0x59e730;}else{var _0x55ddc2=squel[_0xefb0('0x84')]();_0x55ddc2[_0xefb0('0x85')]('('+_0x502f18[_0xefb0('0x78')]()+')',_0xefb0('0x9a'));_0x55ddc2[_0xefb0('0x60')](_0xefb0('0x9b'),_0xefb0('0x1b'));_0x502f18[_0xefb0('0x1c')](_0x202eda[_0xefb0('0x1c')]||_0xd04d61);_0x502f18[_0xefb0('0x19')](_0x202eda['offset']||0x0);return dbH[_0xefb0('0x79')][_0xefb0('0x35')](_0x55ddc2[_0xefb0('0x78')](),{'type':dbH[_0xefb0('0x79')]['QueryTypes'][_0xefb0('0x7b')]})[_0xefb0('0x22')](function(_0x5a1092){if(!_0x5a1092['length']){_0x5b9334=0x0;}else{_0x5b9334=_0x5a1092[0x0][_0xefb0('0x1b')]||0x0;}return dbH[_0xefb0('0x79')][_0xefb0('0x35')](_0x502f18[_0xefb0('0x78')](),{'type':dbH[_0xefb0('0x79')][_0xefb0('0x7a')][_0xefb0('0x7b')]});})[_0xefb0('0x22')](function(_0x307842){return{'rows':_0x307842||[],'count':_0x5b9334};});}});}exports[_0xefb0('0x9c')]=function(_0x1b5a83,_0x2ae20d){return runReport(_0x1b5a83['params'],_0x1b5a83[_0xefb0('0x35')],_0x1b5a83[_0xefb0('0x46')])['then'](respondWithResult(_0x2ae20d,null))[_0xefb0('0x41')](handleError(_0x2ae20d,null));};exports[_0xefb0('0x9d')]=runReport;exports[_0xefb0('0x35')]=function(_0x312e8a,_0x29be49){var _0xdb6827=0xa;var _0x5cea4f=[_0xefb0('0x4f'),_0xefb0('0x50'),_0xefb0('0x51'),_0xefb0('0x52')];var _0x159654={'SUM':'SUM(%s)','COUNT':_0xefb0('0x54'),'COUNT DISTINCT':_0xefb0('0x55'),'MAX':_0xefb0('0x7c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xefb0('0x57')};var _0x542f86={'SEC_TO_TIME':_0xefb0('0x9e'),'DATE':'DATE(%s)','HOUR':_0xefb0('0x58'),'ROUND':_0xefb0('0x59'),'UNIX_TIMESTAMP':_0xefb0('0x5a')};var _0x577de8=function(_0xd8d5fd){return!_[_0xefb0('0x5b')]([_0xefb0('0x80'),_0xefb0('0x81'),'IS\x20EMPTY',_0xefb0('0x5c')],_0xd8d5fd);};var _0x1f4f0c=function(_0x555020){if(!_0x555020||!_0x555020[_0xefb0('0x5d')][_0xefb0('0x37')]){return'';}for(var _0x5243e7='(',_0x5001f7=0x0;_0x5001f7<_0x555020[_0xefb0('0x5d')][_0xefb0('0x37')];_0x5001f7+=0x1){_0x5001f7>0x0&&(_0x5243e7+='\x20'+_0x555020[_0xefb0('0x5e')]+'\x20');_0x5243e7+=_0x555020['rules'][_0x5001f7][_0xefb0('0x5f')]?_0x1f4f0c(_0x555020[_0xefb0('0x5d')][_0x5001f7]['group']):_0x555020[_0xefb0('0x5d')][_0x5001f7][_0xefb0('0x60')]+'\x20'+_0x555020[_0xefb0('0x5d')][_0x5001f7][_0xefb0('0x61')]+(_0x577de8(_0x555020[_0xefb0('0x5d')][_0x5001f7][_0xefb0('0x61')])?'\x20'+_0x555020[_0xefb0('0x5d')][_0x5001f7][_0xefb0('0x62')]:'');}return _0x5243e7+')';};var _0x229d1c={'where':{'id':_0x312e8a['params']['id']}},_0x390547,_0x2b4243,_0x50511f,_0x3c6f4f,_0x37e49c;_0x229d1c=_[_0xefb0('0x3e')]({},_0x229d1c,_0x312e8a[_0xefb0('0x46')]);return db[_0xefb0('0x2d')][_0xefb0('0x47')](_0x229d1c)['then'](function(_0x4488b1){if(_0x4488b1){_0x390547=_0x4488b1;return _0x4488b1[_0xefb0('0x63')]();}return null;})[_0xefb0('0x22')](function(_0x5176f4){if(_0x5176f4){if(!_0x5176f4[_0xefb0('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0xefb0('0x66'),0x193);}_0x2b4243=_0x5176f4;return db[_0xefb0('0x83')]['findAll']({'raw':!![]});}return null;})[_0xefb0('0x22')](function(_0x55f485){if(_0x55f485){_0x50511f=_[_0xefb0('0x67')](_0x55f485,'id');var _0x5365db;var _0x203582=squel[_0xefb0('0x84')]();_0x203582[_0xefb0('0x85')](_0x390547['table']);for(var _0x19403d=0x0;_0x19403d<_0x2b4243[_0xefb0('0x37')];_0x19403d+=0x1){_0x5365db=_0x2b4243[_0x19403d][_0xefb0('0x68')]?_0x50511f[_0x2b4243[_0x19403d]['MetricId']]['metric']:_0x2b4243[_0x19403d]['field'];_0x5365db=_0x2b4243[_0x19403d][_0xefb0('0x69')]?_['replace'](_0x159654[_0x2b4243[_0x19403d]['function']],'%s',_0x5365db):_0x5365db;_0x5365db=_0x2b4243[_0x19403d][_0xefb0('0x6b')]?_['replace'](_0x542f86[_0x2b4243[_0x19403d][_0xefb0('0x6b')]],'%s',_0x5365db):_0x5365db;if(_0x2b4243[_0x19403d][_0xefb0('0x6c')]){_0x203582[_0xefb0('0x5f')](_0x5365db);}_0x2b4243[_0x19403d]['orderBy']&&_0x203582['order'](_0x5365db,_0x2b4243[_0x19403d][_0xefb0('0x6d')]===_0xefb0('0x86')?![]:!![]);_0x203582[_0xefb0('0x60')](_0x5365db,_0x2b4243[_0x19403d][_0xefb0('0x87')]||_0x5365db);}if(_0x390547[_0xefb0('0x6e')]){_0x390547[_0xefb0('0x6e')]=JSON[_0xefb0('0x6f')](_0x390547[_0xefb0('0x6e')]);for(var _0x4582ab=0x0;_0x4582ab<_0x390547['joins'][_0xefb0('0x37')];_0x4582ab+=0x1){if(_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x2f')]&&_['includes'](_0x5cea4f,_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x2f')])&&_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x70')]&&_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x71')]&&_0x390547['joins'][_0x4582ab][_0xefb0('0x72')]){_0x203582[_0x390547['joins'][_0x4582ab]['type']](_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x71')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x390547['table'],_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x70')],_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x71')],_0x390547[_0xefb0('0x6e')][_0x4582ab][_0xefb0('0x72')]));}}}if(_0x390547[_0xefb0('0x74')]){_0x390547['conditions']=JSON[_0xefb0('0x6f')](_0x390547['conditions']);_0x203582[_0xefb0('0x3c')](_0x1f4f0c(_0x390547['conditions']['group']));}_0x37e49c=_0x203582[_0xefb0('0x75')]();_0x203582[_0xefb0('0x1c')](_0xdb6827);_0x203582['offset'](0x0);logger['debug'](_0xefb0('0x77'),_0x203582['toString']());return dbH['sequelize']['query'](_0x203582['toString'](),{'type':dbH[_0xefb0('0x79')][_0xefb0('0x7a')][_0xefb0('0x7b')]});}})[_0xefb0('0x22')](function(){return{'sql':_0x37e49c[_0xefb0('0x78')]()};})[_0xefb0('0x22')](respondWithResult(_0x29be49,null))['catch'](handleError(_0x29be49,null));}; \ No newline at end of file +var _0x1f80=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','params','length','options','find','catch','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','create','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','%s.%s\x20=\x20%s.%s','parse','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','runReport','IS\x20NULL','condition','getFields','AnalyticMetric','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js'];(function(_0x542a5d,_0x27e6c8){var _0x251378=function(_0x295247){while(--_0x295247){_0x542a5d['push'](_0x542a5d['shift']());}};_0x251378(++_0x27e6c8);}(_0x1f80,0x148));var _0x01f8=function(_0x2b92e2,_0x358e56){_0x2b92e2=_0x2b92e2-0x0;var _0x2b88a9=_0x1f80[_0x2b92e2];return _0x2b88a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01f8('0x0'));var zipdir=require(_0x01f8('0x1'));var jsonpatch=require(_0x01f8('0x2'));var rp=require(_0x01f8('0x3'));var moment=require(_0x01f8('0x4'));var BPromise=require(_0x01f8('0x5'));var Mustache=require(_0x01f8('0x6'));var util=require(_0x01f8('0x7'));var path=require(_0x01f8('0x8'));var sox=require(_0x01f8('0x9'));var csv=require(_0x01f8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01f8('0xb'));var squel=require('squel');var crypto=require(_0x01f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x01f8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x01f8('0xe'));var Redis=require(_0x01f8('0xf'));var authService=require(_0x01f8('0x10'));var qs=require(_0x01f8('0x11'));var as=require(_0x01f8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01f8('0x13'))(_0x01f8('0x14'));var utils=require(_0x01f8('0x15'));var config=require(_0x01f8('0x16'));var licenseUtil=require(_0x01f8('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x01f8('0x18'))[_0x01f8('0x19')];function respondWithStatusCode(_0x1d399f,_0x52cf79){_0x52cf79=_0x52cf79||0xcc;return function(_0x275efc){if(_0x275efc){return _0x1d399f['sendStatus'](_0x52cf79);}return _0x1d399f[_0x01f8('0x1a')](_0x52cf79)[_0x01f8('0x1b')]();};}function respondWithResult(_0x409cbd,_0x448d06){_0x448d06=_0x448d06||0xc8;return function(_0x115a73){if(_0x115a73){return _0x409cbd[_0x01f8('0x1a')](_0x448d06)[_0x01f8('0x1c')](_0x115a73);}};}function respondWithFilteredResult(_0x5a3ed5,_0x48166c){return function(_0x3f46da){if(_0x3f46da){var _0x19724d=typeof _0x48166c[_0x01f8('0x1d')]===_0x01f8('0x1e')&&typeof _0x48166c[_0x01f8('0x1f')]===_0x01f8('0x1e');var _0x352854=_0x3f46da[_0x01f8('0x20')];var _0x46380c=_0x19724d?0x0:_0x48166c[_0x01f8('0x1d')];var _0x4d3b0c=_0x19724d?_0x3f46da[_0x01f8('0x20')]:_0x48166c[_0x01f8('0x1d')]+_0x48166c[_0x01f8('0x1f')];var _0x5d8a77;if(_0x4d3b0c>=_0x352854){_0x4d3b0c=_0x352854;_0x5d8a77=0xc8;}else{_0x5d8a77=0xce;}_0x5a3ed5[_0x01f8('0x1a')](_0x5d8a77);return _0x5a3ed5[_0x01f8('0x21')](_0x01f8('0x22'),_0x46380c+'-'+_0x4d3b0c+'/'+_0x352854)[_0x01f8('0x1c')](_0x3f46da);}return null;};}function patchUpdates(_0x26f3bb){return function(_0x3428f9){try{jsonpatch[_0x01f8('0x23')](_0x3428f9,_0x26f3bb,!![]);}catch(_0x26e623){return BPromise[_0x01f8('0x24')](_0x26e623);}return _0x3428f9[_0x01f8('0x25')]();};}function saveUpdates(_0x5d511d,_0x2b0755){return function(_0x5183f6){if(_0x5183f6){return _0x5183f6[_0x01f8('0x26')](_0x5d511d)[_0x01f8('0x27')](function(_0x2d4d3f){return _0x2d4d3f;});}return null;};}function removeEntity(_0x376487,_0x274158){return function(_0x3b3b32){if(_0x3b3b32){return _0x3b3b32['destroy']()[_0x01f8('0x27')](function(){var _0x33552a=_0x3b3b32[_0x01f8('0x28')]({'plain':!![]});var _0x3cd8ed='CustomReports';return db[_0x01f8('0x29')][_0x01f8('0x2a')]({'where':{'type':_0x3cd8ed,'resourceId':_0x33552a['id']}})['then'](function(){return _0x3b3b32;});})['then'](function(){_0x376487[_0x01f8('0x1a')](0xcc)[_0x01f8('0x1b')]();});}};}function handleEntityNotFound(_0xf48611,_0x309714){return function(_0xbd5d79){if(!_0xbd5d79){_0xf48611[_0x01f8('0x2b')](0x194);}return _0xbd5d79;};}function handleError(_0xbc9495,_0x2a8dce){_0x2a8dce=_0x2a8dce||0x1f4;return function(_0x22d8a5){logger['error'](_0x22d8a5[_0x01f8('0x2c')]);if(_0x22d8a5[_0x01f8('0x2d')]){delete _0x22d8a5[_0x01f8('0x2d')];}_0xbc9495[_0x01f8('0x1a')](_0x2a8dce)[_0x01f8('0x2e')](_0x22d8a5);};}exports[_0x01f8('0x2f')]=function(_0x5e05e4,_0x59eea1){var _0x26056b={},_0x324a2c={},_0x531afa={'count':0x0,'rows':[]};var _0x48dcea=_[_0x01f8('0x30')](db[_0x01f8('0x31')][_0x01f8('0x32')],function(_0x118973){return{'name':_0x118973['fieldName'],'type':_0x118973['type'][_0x01f8('0x33')]};});_0x324a2c[_0x01f8('0x34')]=_[_0x01f8('0x30')](_0x48dcea,'name');_0x324a2c[_0x01f8('0x35')]=_[_0x01f8('0x36')](_0x5e05e4[_0x01f8('0x35')]);_0x324a2c['filters']=_[_0x01f8('0x37')](_0x324a2c['model'],_0x324a2c[_0x01f8('0x35')]);_0x26056b['attributes']=_[_0x01f8('0x37')](_0x324a2c[_0x01f8('0x34')],qs[_0x01f8('0x38')](_0x5e05e4[_0x01f8('0x35')]['fields']));_0x26056b['attributes']=_0x26056b[_0x01f8('0x39')]['length']?_0x26056b[_0x01f8('0x39')]:_0x324a2c['model'];if(!_0x5e05e4[_0x01f8('0x35')][_0x01f8('0x3a')]('nolimit')){_0x26056b[_0x01f8('0x1f')]=qs[_0x01f8('0x1f')](_0x5e05e4[_0x01f8('0x35')]['limit']);_0x26056b['offset']=qs[_0x01f8('0x1d')](_0x5e05e4[_0x01f8('0x35')][_0x01f8('0x1d')]);}_0x26056b[_0x01f8('0x3b')]=qs[_0x01f8('0x3c')](_0x5e05e4['query'][_0x01f8('0x3c')]);_0x26056b[_0x01f8('0x3d')]=qs[_0x01f8('0x3e')](_[_0x01f8('0x3f')](_0x5e05e4[_0x01f8('0x35')],_0x324a2c[_0x01f8('0x3e')]),_0x48dcea);if(_0x5e05e4[_0x01f8('0x35')][_0x01f8('0x40')]){_0x26056b[_0x01f8('0x3d')]=_['merge'](_0x26056b[_0x01f8('0x3d')],{'$or':_['map'](_0x48dcea,function(_0x550280){if(_0x550280[_0x01f8('0x41')]!==_0x01f8('0x42')){var _0x472027={};_0x472027[_0x550280[_0x01f8('0x2d')]]={'$like':'%'+_0x5e05e4[_0x01f8('0x35')]['filter']+'%'};return _0x472027;}})});}_0x26056b=_[_0x01f8('0x43')]({},_0x26056b,_0x5e05e4['options']);var _0x4e0681={'where':_0x26056b[_0x01f8('0x3d')]};return db[_0x01f8('0x31')]['count'](_0x4e0681)[_0x01f8('0x27')](function(_0x4efb32){_0x531afa[_0x01f8('0x20')]=_0x4efb32;if(_0x5e05e4['query'][_0x01f8('0x44')]){_0x26056b[_0x01f8('0x45')]=[{'all':!![]}];}return db[_0x01f8('0x31')][_0x01f8('0x46')](_0x26056b);})[_0x01f8('0x27')](function(_0xa01131){_0x531afa['rows']=_0xa01131;return _0x531afa;})[_0x01f8('0x27')](respondWithFilteredResult(_0x59eea1,_0x26056b))['catch'](handleError(_0x59eea1,null));};exports[_0x01f8('0x47')]=function(_0x145335,_0x4fefdc){var _0x1fdf51={'raw':![],'where':{'id':_0x145335[_0x01f8('0x48')]['id']}},_0xbb858d={};_0xbb858d[_0x01f8('0x34')]=_[_0x01f8('0x36')](db[_0x01f8('0x31')]['rawAttributes']);_0xbb858d[_0x01f8('0x35')]=_['keys'](_0x145335[_0x01f8('0x35')]);_0xbb858d[_0x01f8('0x3e')]=_[_0x01f8('0x37')](_0xbb858d[_0x01f8('0x34')],_0xbb858d[_0x01f8('0x35')]);_0x1fdf51[_0x01f8('0x39')]=_[_0x01f8('0x37')](_0xbb858d[_0x01f8('0x34')],qs[_0x01f8('0x38')](_0x145335[_0x01f8('0x35')][_0x01f8('0x38')]));_0x1fdf51[_0x01f8('0x39')]=_0x1fdf51[_0x01f8('0x39')][_0x01f8('0x49')]?_0x1fdf51[_0x01f8('0x39')]:_0xbb858d[_0x01f8('0x34')];if(_0x145335[_0x01f8('0x35')][_0x01f8('0x44')]){_0x1fdf51[_0x01f8('0x45')]=[{'all':!![]}];}_0x1fdf51=_[_0x01f8('0x43')]({},_0x1fdf51,_0x145335[_0x01f8('0x4a')]);return db[_0x01f8('0x31')][_0x01f8('0x4b')](_0x1fdf51)['then'](handleEntityNotFound(_0x4fefdc,null))['then'](respondWithResult(_0x4fefdc,null))[_0x01f8('0x4c')](handleError(_0x4fefdc,null));};exports['create']=function(_0x16e9c3,_0x3eefda){return db[_0x01f8('0x31')]['create'](_0x16e9c3[_0x01f8('0x4d')],{})[_0x01f8('0x27')](function(_0x3625ef){var _0x1683b7=_0x16e9c3[_0x01f8('0x4e')][_0x01f8('0x28')]({'plain':!![]});if(!_0x1683b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1683b7[_0x01f8('0x4f')]===_0x01f8('0x4e')){var _0x22224f=_0x3625ef[_0x01f8('0x28')]({'plain':!![]});var _0x45c431=_0x01f8('0x50');return db[_0x01f8('0x51')][_0x01f8('0x4b')]({'where':{'name':_0x45c431,'userProfileId':_0x1683b7[_0x01f8('0x52')]},'raw':!![]})['then'](function(_0xa15265){if(_0xa15265&&_0xa15265[_0x01f8('0x53')]===0x0){return db[_0x01f8('0x29')][_0x01f8('0x54')]({'name':_0x22224f[_0x01f8('0x2d')],'resourceId':_0x22224f['id'],'type':_0x01f8('0x55'),'sectionId':_0xa15265['id']},{})[_0x01f8('0x27')](function(){return _0x3625ef;});}else{return _0x3625ef;}})[_0x01f8('0x4c')](function(_0x4b1ce0){logger[_0x01f8('0x56')](_0x01f8('0x57'),_0x4b1ce0);throw _0x4b1ce0;});}return _0x3625ef;})[_0x01f8('0x27')](respondWithResult(_0x3eefda,0xc9))['catch'](handleError(_0x3eefda,null));};exports[_0x01f8('0x26')]=function(_0x5e328d,_0x5d8ad9){if(_0x5e328d[_0x01f8('0x4d')]['id']){delete _0x5e328d[_0x01f8('0x4d')]['id'];}return db['AnalyticCustomReport'][_0x01f8('0x4b')]({'where':{'id':_0x5e328d[_0x01f8('0x48')]['id']}})[_0x01f8('0x27')](handleEntityNotFound(_0x5d8ad9,null))[_0x01f8('0x27')](saveUpdates(_0x5e328d[_0x01f8('0x4d')],null))['then'](respondWithResult(_0x5d8ad9,null))['catch'](handleError(_0x5d8ad9,null));};exports['destroy']=function(_0x30d396,_0x548348){return db[_0x01f8('0x31')][_0x01f8('0x4b')]({'where':{'id':_0x30d396[_0x01f8('0x48')]['id']}})[_0x01f8('0x27')](handleEntityNotFound(_0x548348,null))[_0x01f8('0x27')](removeEntity(_0x548348,null))[_0x01f8('0x4c')](handleError(_0x548348,null));};exports[_0x01f8('0x58')]=function(_0x4124af,_0x8904c2){var _0x40a3b9=0xa;var _0x8d8f4f=['join','left_join','right_join','cross_join'];var _0x4cb98a={'SUM':'SUM(%s)','COUNT':_0x01f8('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x01f8('0x5a'),'MIN':_0x01f8('0x5b'),'AVG':_0x01f8('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x01f8('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33bc22={'SEC_TO_TIME':_0x01f8('0x5e'),'DATE':_0x01f8('0x5f'),'HOUR':_0x01f8('0x60'),'ROUND':_0x01f8('0x61'),'UNIX_TIMESTAMP':_0x01f8('0x62')};var _0xc67043=function(_0x3c075f){return!_[_0x01f8('0x63')](['IS\x20NULL',_0x01f8('0x64'),'IS\x20EMPTY',_0x01f8('0x65')],_0x3c075f);};var _0x23d2ec=function(_0x503a87){if(!_0x503a87||!_0x503a87[_0x01f8('0x66')][_0x01f8('0x49')]){return'';}for(var _0x5d943c='(',_0x5b5016=0x0;_0x5b5016<_0x503a87[_0x01f8('0x66')][_0x01f8('0x49')];_0x5b5016+=0x1){_0x5b5016>0x0&&(_0x5d943c+='\x20'+_0x503a87[_0x01f8('0x67')]+'\x20');_0x5d943c+=_0x503a87['rules'][_0x5b5016][_0x01f8('0x68')]?_0x23d2ec(_0x503a87[_0x01f8('0x66')][_0x5b5016][_0x01f8('0x68')]):_0x503a87[_0x01f8('0x66')][_0x5b5016][_0x01f8('0x69')]+'\x20'+_0x503a87[_0x01f8('0x66')][_0x5b5016]['condition']+(_0xc67043(_0x503a87[_0x01f8('0x66')][_0x5b5016]['condition'])?'\x20'+_0x503a87[_0x01f8('0x66')][_0x5b5016][_0x01f8('0x6a')]:'');}return _0x5d943c+')';};var _0xab3670={'where':{'id':_0x4124af[_0x01f8('0x48')]['id']}},_0x42a289,_0x44d255,_0x1f73f9,_0x468a09,_0x6ff0ea;_0xab3670=_[_0x01f8('0x43')]({},_0xab3670,_0x4124af[_0x01f8('0x4a')]);return db[_0x01f8('0x31')][_0x01f8('0x4b')](_0xab3670)[_0x01f8('0x27')](function(_0x206e14){if(_0x206e14){_0x42a289=_0x206e14;return _0x206e14['getFields']();}return null;})[_0x01f8('0x27')](function(_0x181273){if(_0x181273){if(!_0x181273['length']){throw new db[(_0x01f8('0x6b'))][(_0x01f8('0x6c'))](_0x01f8('0x6d'),0x193);}_0x44d255=_0x181273;return db['AnalyticMetric'][_0x01f8('0x46')]({'raw':!![]});}return null;})[_0x01f8('0x27')](function(_0x435058){if(_0x435058){_0x1f73f9=_[_0x01f8('0x6e')](_0x435058,'id');var _0x4201c7;var _0x5d04ed=squel[_0x01f8('0x6f')]();_0x5d04ed[_0x01f8('0x70')](_0x42a289[_0x01f8('0x71')]);for(var _0x27823e=0x0;_0x27823e<_0x44d255[_0x01f8('0x49')];_0x27823e+=0x1){_0x4201c7=_0x44d255[_0x27823e]['MetricId']?_0x1f73f9[_0x44d255[_0x27823e][_0x01f8('0x72')]][_0x01f8('0x73')]:_0x44d255[_0x27823e][_0x01f8('0x69')];_0x4201c7=_0x44d255[_0x27823e][_0x01f8('0x74')]?_[_0x01f8('0x75')](_0x4cb98a[_0x44d255[_0x27823e][_0x01f8('0x74')]],'%s',_0x4201c7):_0x4201c7;_0x4201c7=_0x44d255[_0x27823e]['format']?_['replace'](_0x33bc22[_0x44d255[_0x27823e][_0x01f8('0x76')]],'%s',_0x4201c7):_0x4201c7;if(_0x44d255[_0x27823e][_0x01f8('0x77')]){_0x5d04ed[_0x01f8('0x68')](_0x4201c7);}_0x44d255[_0x27823e]['orderBy']&&_0x5d04ed[_0x01f8('0x3b')](_0x4201c7,_0x44d255[_0x27823e][_0x01f8('0x78')]===_0x01f8('0x79')?![]:!![]);_0x5d04ed[_0x01f8('0x69')](_0x4201c7,_0x44d255[_0x27823e][_0x01f8('0x7a')]||_0x4201c7);}if(_0x42a289[_0x01f8('0x7b')]){_0x42a289['joins']=JSON['parse'](_0x42a289['joins']);for(var _0x39bf02=0x0;_0x39bf02<_0x42a289[_0x01f8('0x7b')][_0x01f8('0x49')];_0x39bf02+=0x1){if(_0x42a289[_0x01f8('0x7b')][_0x39bf02]['type']&&_[_0x01f8('0x63')](_0x8d8f4f,_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x41')])&&_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x7c')]&&_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x7d')]&&_0x42a289[_0x01f8('0x7b')][_0x39bf02]['foreignKey']){_0x5d04ed[_0x42a289[_0x01f8('0x7b')][_0x39bf02]['type']](_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x7d')],null,util[_0x01f8('0x76')]('%s.%s\x20=\x20%s.%s',_0x42a289['table'],_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x7c')],_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x7d')],_0x42a289[_0x01f8('0x7b')][_0x39bf02][_0x01f8('0x7e')]));}}}if(_0x42a289['conditions']){_0x42a289['conditions']=JSON['parse'](_0x42a289[_0x01f8('0x7f')]);_0x5d04ed[_0x01f8('0x3d')](_0x23d2ec(_0x42a289['conditions'][_0x01f8('0x68')]));}_0x6ff0ea=_0x5d04ed[_0x01f8('0x80')]();_0x5d04ed[_0x01f8('0x1f')](_0x40a3b9);_0x5d04ed[_0x01f8('0x1d')](0x0);logger[_0x01f8('0x81')](_0x01f8('0x82'),_0x5d04ed['toString']());return dbH[_0x01f8('0x83')][_0x01f8('0x35')](_0x5d04ed[_0x01f8('0x84')](),{'type':dbH['sequelize'][_0x01f8('0x85')][_0x01f8('0x86')]});}})[_0x01f8('0x27')](respondWithResult(_0x8904c2,null))['catch'](handleError(_0x8904c2,null));};function runReport(_0x13ac9a,_0x507866,_0x2ed107){var _0x15f817=_0x507866[_0x01f8('0x2d')];var _0x1d2de2=0xa;var _0x2a5ee4=[_0x01f8('0x87'),_0x01f8('0x88'),_0x01f8('0x89'),_0x01f8('0x8a')];var _0x5c37d8={'SUM':_0x01f8('0x8b'),'COUNT':_0x01f8('0x59'),'COUNT DISTINCT':_0x01f8('0x8c'),'MAX':'MAX(%s)','MIN':_0x01f8('0x5b'),'AVG':_0x01f8('0x5c'),'GROUP_CONCAT':_0x01f8('0x8d'),'GROUP_CONCAT ASC':_0x01f8('0x5d'),'GROUP_CONCAT DESC':_0x01f8('0x8e')};var _0x3fec1c={'SEC_TO_TIME':_0x01f8('0x5e'),'DATE':_0x01f8('0x5f'),'HOUR':_0x01f8('0x60'),'ROUND':_0x01f8('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x44be26=function(_0x3f7409){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x01f8('0x8f'),_0x01f8('0x65')],_0x3f7409);};var _0x352ab0=function(_0x123ebb){if(!_0x123ebb||!_0x123ebb[_0x01f8('0x66')][_0x01f8('0x49')]){return'';}for(var _0x46c4bf='(',_0x1c2c2d=0x0;_0x1c2c2d<_0x123ebb[_0x01f8('0x66')][_0x01f8('0x49')];_0x1c2c2d+=0x1){_0x1c2c2d>0x0&&(_0x46c4bf+='\x20'+_0x123ebb[_0x01f8('0x67')]+'\x20');_0x46c4bf+=_0x123ebb[_0x01f8('0x66')][_0x1c2c2d][_0x01f8('0x68')]?_0x352ab0(_0x123ebb['rules'][_0x1c2c2d]['group']):_0x123ebb[_0x01f8('0x66')][_0x1c2c2d]['field']+'\x20'+_0x123ebb['rules'][_0x1c2c2d]['condition']+(_0x44be26(_0x123ebb[_0x01f8('0x66')][_0x1c2c2d]['condition'])?'\x20'+_0x123ebb['rules'][_0x1c2c2d]['value']:'');}return _0x46c4bf+')';};var _0xa7f724={'where':{'id':_0x13ac9a['id']}},_0x123339,_0x20ae16,_0x242108,_0x57b0ce,_0x166cce;_0xa7f724=_['merge']({},_0xa7f724,_0x2ed107);return db['AnalyticCustomReport']['find'](_0xa7f724)[_0x01f8('0x27')](function(_0x138118){if(_0x138118){_0x123339=_0x138118;return _0x138118['getFields']();}return null;})['then'](function(_0x18a466){if(_0x18a466){if(!_0x18a466[_0x01f8('0x49')]){throw new db[(_0x01f8('0x6b'))][(_0x01f8('0x6c'))](_0x01f8('0x6d'),0x193);}_0x20ae16=_0x18a466;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x01f8('0x27')](function(_0x20b890){if(_0x20b890){_0x242108=_[_0x01f8('0x6e')](_0x20b890,'id');var _0x168bc5;var _0x414932=squel[_0x01f8('0x6f')]();_0x414932[_0x01f8('0x70')](_0x123339['table']);for(var _0x5be240=0x0;_0x5be240<_0x20ae16[_0x01f8('0x49')];_0x5be240+=0x1){_0x168bc5=_0x20ae16[_0x5be240][_0x01f8('0x72')]?_0x242108[_0x20ae16[_0x5be240][_0x01f8('0x72')]][_0x01f8('0x73')]:_0x20ae16[_0x5be240][_0x01f8('0x69')];_0x168bc5=_0x20ae16[_0x5be240][_0x01f8('0x74')]?_['replace'](_0x5c37d8[_0x20ae16[_0x5be240][_0x01f8('0x74')]],'%s',_0x168bc5):_0x168bc5;_0x168bc5=_0x20ae16[_0x5be240][_0x01f8('0x76')]?_[_0x01f8('0x75')](_0x3fec1c[_0x20ae16[_0x5be240][_0x01f8('0x76')]],'%s',_0x168bc5):_0x168bc5;if(_0x20ae16[_0x5be240]['groupBy']){_0x414932[_0x01f8('0x68')](_0x168bc5);}_0x20ae16[_0x5be240][_0x01f8('0x78')]&&_0x414932[_0x01f8('0x3b')](_0x168bc5,_0x20ae16[_0x5be240][_0x01f8('0x78')]===_0x01f8('0x79')?![]:!![]);_0x414932[_0x01f8('0x69')](_0x168bc5,_0x20ae16[_0x5be240]['alias']||_0x168bc5);}if(_0x123339[_0x01f8('0x7b')]){_0x123339['joins']=JSON['parse'](_0x123339[_0x01f8('0x7b')]);for(var _0x33c101=0x0;_0x33c101<_0x123339[_0x01f8('0x7b')]['length'];_0x33c101+=0x1){if(_0x123339[_0x01f8('0x7b')][_0x33c101]['type']&&_['includes'](_0x2a5ee4,_0x123339[_0x01f8('0x7b')][_0x33c101][_0x01f8('0x41')])&&_0x123339['joins'][_0x33c101][_0x01f8('0x7c')]&&_0x123339[_0x01f8('0x7b')][_0x33c101][_0x01f8('0x7d')]&&_0x123339[_0x01f8('0x7b')][_0x33c101][_0x01f8('0x7e')]){_0x414932[_0x123339['joins'][_0x33c101]['type']](_0x123339['joins'][_0x33c101][_0x01f8('0x7d')],null,util[_0x01f8('0x76')](_0x01f8('0x90'),_0x123339[_0x01f8('0x71')],_0x123339[_0x01f8('0x7b')][_0x33c101][_0x01f8('0x7c')],_0x123339['joins'][_0x33c101]['foreignTable'],_0x123339[_0x01f8('0x7b')][_0x33c101][_0x01f8('0x7e')]));}}}if(_0x123339['conditions']){_0x123339['conditions']=JSON[_0x01f8('0x91')](_0x123339[_0x01f8('0x7f')]);_0x414932[_0x01f8('0x3d')](_0x352ab0(_0x123339[_0x01f8('0x7f')][_0x01f8('0x68')]));}_0x166cce=_0x414932[_0x01f8('0x80')]();_0x414932[_0x01f8('0x1f')](_0x1d2de2);_0x414932[_0x01f8('0x1d')](0x0);return;}})[_0x01f8('0x27')](function(){if(_0x507866[_0x01f8('0x92')]===_0x01f8('0x93')){return null;}var _0x2d2530=_['merge'](_0x507866,{'name':_0x507866[_0x01f8('0x94')]||_0x507866[_0x01f8('0x2d')]||_0x123339[_0x01f8('0x2d')],'basename':_0x15f817,'savename':util[_0x01f8('0x76')](_0x01f8('0x95'),_0x507866['name']||_0x123339['name'],require('randomstring')[_0x01f8('0x96')](0x4),_0x507866[_0x01f8('0x92')]||_0x01f8('0x97')),'reportId':_0x123339['id'],'reportType':'custom'});return db[_0x01f8('0x98')]['create'](_0x2d2530,{'raw':!![]});})[_0x01f8('0x27')](function(_0x9f5f0a){if(_0x123339[_0x01f8('0x71')]===_0x01f8('0x99')){_0x166cce[_0x01f8('0x3d')](_0x123339[_0x01f8('0x71')]+_0x01f8('0x9a'),_0x507866['startDate'],_0x507866[_0x01f8('0x9b')]);}else{_0x166cce[_0x01f8('0x3d')](_0x123339[_0x01f8('0x71')]+_0x01f8('0x9c'),_0x507866[_0x01f8('0x9d')],_0x507866[_0x01f8('0x9b')]);}if(_0x9f5f0a){logger[_0x01f8('0x9e')](_0x01f8('0x9f'),_0x166cce[_0x01f8('0x84')]());require(_0x01f8('0xa0'))[_0x01f8('0xa1')](path['join'](__dirname,'../../components/export/',_0x9f5f0a[_0x01f8('0x92')]),[_0x9f5f0a['id'],_0x166cce[_0x01f8('0x84')](),path[_0x01f8('0x87')](__dirname,_0x01f8('0xa2'),_0x9f5f0a[_0x01f8('0xa3')]),_0x15f817]);return _0x9f5f0a;}else{var _0x1eeea0=squel[_0x01f8('0x6f')]();_0x1eeea0[_0x01f8('0x70')]('('+_0x166cce[_0x01f8('0x84')]()+')',_0x01f8('0xa4'));_0x1eeea0[_0x01f8('0x69')](_0x01f8('0xa5'),_0x01f8('0x20'));_0x166cce['limit'](_0x507866[_0x01f8('0x1f')]||_0x1d2de2);_0x166cce[_0x01f8('0x1d')](_0x507866['offset']||0x0);return dbH[_0x01f8('0x83')][_0x01f8('0x35')](_0x1eeea0['toString'](),{'type':dbH[_0x01f8('0x83')][_0x01f8('0x85')]['SELECT']})[_0x01f8('0x27')](function(_0x345417){if(!_0x345417[_0x01f8('0x49')]){_0x57b0ce=0x0;}else{_0x57b0ce=_0x345417[0x0][_0x01f8('0x20')]||0x0;}return dbH['sequelize'][_0x01f8('0x35')](_0x166cce[_0x01f8('0x84')](),{'type':dbH[_0x01f8('0x83')][_0x01f8('0x85')][_0x01f8('0x86')]});})[_0x01f8('0x27')](function(_0x43eb31){return{'rows':_0x43eb31||[],'count':_0x57b0ce};});}});}exports['run']=function(_0x14e0b7,_0x4a31a7){return runReport(_0x14e0b7[_0x01f8('0x48')],_0x14e0b7[_0x01f8('0x35')],_0x14e0b7[_0x01f8('0x4a')])['then'](respondWithResult(_0x4a31a7,null))[_0x01f8('0x4c')](handleError(_0x4a31a7,null));};exports[_0x01f8('0xa6')]=runReport;exports[_0x01f8('0x35')]=function(_0x2af8b8,_0x54004c){var _0x19033d=0xa;var _0x3f062e=[_0x01f8('0x87'),_0x01f8('0x88'),_0x01f8('0x89'),_0x01f8('0x8a')];var _0x48bf68={'SUM':_0x01f8('0x8b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x01f8('0x8c'),'MAX':_0x01f8('0x5a'),'MIN':_0x01f8('0x5b'),'AVG':_0x01f8('0x5c'),'GROUP_CONCAT':_0x01f8('0x8d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x01f8('0x8e')};var _0x4ddc14={'SEC_TO_TIME':_0x01f8('0x5e'),'DATE':_0x01f8('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x01f8('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x186cd0=function(_0x27fc5d){return!_[_0x01f8('0x63')]([_0x01f8('0xa7'),_0x01f8('0x64'),_0x01f8('0x8f'),_0x01f8('0x65')],_0x27fc5d);};var _0x5f4748=function(_0x4b5fa6){if(!_0x4b5fa6||!_0x4b5fa6[_0x01f8('0x66')][_0x01f8('0x49')]){return'';}for(var _0x1f79ce='(',_0x6e257=0x0;_0x6e257<_0x4b5fa6['rules']['length'];_0x6e257+=0x1){_0x6e257>0x0&&(_0x1f79ce+='\x20'+_0x4b5fa6[_0x01f8('0x67')]+'\x20');_0x1f79ce+=_0x4b5fa6[_0x01f8('0x66')][_0x6e257][_0x01f8('0x68')]?_0x5f4748(_0x4b5fa6[_0x01f8('0x66')][_0x6e257]['group']):_0x4b5fa6['rules'][_0x6e257][_0x01f8('0x69')]+'\x20'+_0x4b5fa6['rules'][_0x6e257]['condition']+(_0x186cd0(_0x4b5fa6[_0x01f8('0x66')][_0x6e257][_0x01f8('0xa8')])?'\x20'+_0x4b5fa6[_0x01f8('0x66')][_0x6e257][_0x01f8('0x6a')]:'');}return _0x1f79ce+')';};var _0x4be8b8={'where':{'id':_0x2af8b8[_0x01f8('0x48')]['id']}},_0xa5b068,_0x941b9f,_0x456eaa,_0x3668e8,_0x1f5319;_0x4be8b8=_[_0x01f8('0x43')]({},_0x4be8b8,_0x2af8b8[_0x01f8('0x4a')]);return db[_0x01f8('0x31')]['find'](_0x4be8b8)[_0x01f8('0x27')](function(_0x14d3d8){if(_0x14d3d8){_0xa5b068=_0x14d3d8;return _0x14d3d8[_0x01f8('0xa9')]();}return null;})[_0x01f8('0x27')](function(_0x4003b0){if(_0x4003b0){if(!_0x4003b0[_0x01f8('0x49')]){throw new db[(_0x01f8('0x6b'))][(_0x01f8('0x6c'))](_0x01f8('0x6d'),0x193);}_0x941b9f=_0x4003b0;return db[_0x01f8('0xaa')][_0x01f8('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3758ad){if(_0x3758ad){_0x456eaa=_['keyBy'](_0x3758ad,'id');var _0x3fa75c;var _0xbaa87e=squel['select']();_0xbaa87e[_0x01f8('0x70')](_0xa5b068[_0x01f8('0x71')]);for(var _0x38ce79=0x0;_0x38ce79<_0x941b9f['length'];_0x38ce79+=0x1){_0x3fa75c=_0x941b9f[_0x38ce79][_0x01f8('0x72')]?_0x456eaa[_0x941b9f[_0x38ce79][_0x01f8('0x72')]][_0x01f8('0x73')]:_0x941b9f[_0x38ce79][_0x01f8('0x69')];_0x3fa75c=_0x941b9f[_0x38ce79][_0x01f8('0x74')]?_[_0x01f8('0x75')](_0x48bf68[_0x941b9f[_0x38ce79][_0x01f8('0x74')]],'%s',_0x3fa75c):_0x3fa75c;_0x3fa75c=_0x941b9f[_0x38ce79][_0x01f8('0x76')]?_[_0x01f8('0x75')](_0x4ddc14[_0x941b9f[_0x38ce79]['format']],'%s',_0x3fa75c):_0x3fa75c;if(_0x941b9f[_0x38ce79][_0x01f8('0x77')]){_0xbaa87e[_0x01f8('0x68')](_0x3fa75c);}_0x941b9f[_0x38ce79][_0x01f8('0x78')]&&_0xbaa87e[_0x01f8('0x3b')](_0x3fa75c,_0x941b9f[_0x38ce79][_0x01f8('0x78')]===_0x01f8('0x79')?![]:!![]);_0xbaa87e[_0x01f8('0x69')](_0x3fa75c,_0x941b9f[_0x38ce79]['alias']||_0x3fa75c);}if(_0xa5b068[_0x01f8('0x7b')]){_0xa5b068[_0x01f8('0x7b')]=JSON[_0x01f8('0x91')](_0xa5b068[_0x01f8('0x7b')]);for(var _0x3cb003=0x0;_0x3cb003<_0xa5b068[_0x01f8('0x7b')][_0x01f8('0x49')];_0x3cb003+=0x1){if(_0xa5b068[_0x01f8('0x7b')][_0x3cb003][_0x01f8('0x41')]&&_[_0x01f8('0x63')](_0x3f062e,_0xa5b068[_0x01f8('0x7b')][_0x3cb003][_0x01f8('0x41')])&&_0xa5b068[_0x01f8('0x7b')][_0x3cb003][_0x01f8('0x7c')]&&_0xa5b068[_0x01f8('0x7b')][_0x3cb003]['foreignTable']&&_0xa5b068['joins'][_0x3cb003][_0x01f8('0x7e')]){_0xbaa87e[_0xa5b068['joins'][_0x3cb003][_0x01f8('0x41')]](_0xa5b068[_0x01f8('0x7b')][_0x3cb003][_0x01f8('0x7d')],null,util[_0x01f8('0x76')]('%s.%s\x20=\x20%s.%s',_0xa5b068[_0x01f8('0x71')],_0xa5b068['joins'][_0x3cb003]['parentKey'],_0xa5b068[_0x01f8('0x7b')][_0x3cb003][_0x01f8('0x7d')],_0xa5b068[_0x01f8('0x7b')][_0x3cb003][_0x01f8('0x7e')]));}}}if(_0xa5b068[_0x01f8('0x7f')]){_0xa5b068[_0x01f8('0x7f')]=JSON[_0x01f8('0x91')](_0xa5b068[_0x01f8('0x7f')]);_0xbaa87e['where'](_0x5f4748(_0xa5b068[_0x01f8('0x7f')]['group']));}_0x1f5319=_0xbaa87e[_0x01f8('0x80')]();_0xbaa87e[_0x01f8('0x1f')](_0x19033d);_0xbaa87e[_0x01f8('0x1d')](0x0);logger[_0x01f8('0x81')](_0x01f8('0x82'),_0xbaa87e[_0x01f8('0x84')]());return dbH[_0x01f8('0x83')][_0x01f8('0x35')](_0xbaa87e[_0x01f8('0x84')](),{'type':dbH[_0x01f8('0x83')]['QueryTypes']['SELECT']});}})[_0x01f8('0x27')](function(){return{'sql':_0x1f5319['toString']()};})[_0x01f8('0x27')](respondWithResult(_0x54004c,null))[_0x01f8('0x4c')](handleError(_0x54004c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fbe24cc..b6dac55 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 _0xa092=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x33e172,_0x2b4d45){var _0x31427f=function(_0x353e2a){while(--_0x353e2a){_0x33e172['push'](_0x33e172['shift']());}};_0x31427f(++_0x2b4d45);}(_0xa092,0x1cc));var _0x2a09=function(_0x3c5cc7,_0x447374){_0x3c5cc7=_0x3c5cc7-0x0;var _0x2aef2a=_0xa092[_0x3c5cc7];return _0x2aef2a;};'use strict';var _=require(_0x2a09('0x0'));var util=require(_0x2a09('0x1'));var logger=require(_0x2a09('0x2'))(_0x2a09('0x3'));var moment=require(_0x2a09('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a09('0x5'));var fs=require('fs');var path=require(_0x2a09('0x6'));var rimraf=require(_0x2a09('0x7'));var config=require(_0x2a09('0x8'));var attributes=require(_0x2a09('0x9'));module[_0x2a09('0xa')]=function(_0x352692,_0x562c35){return _0x352692[_0x2a09('0xb')](_0x2a09('0xc'),attributes,{'tableName':_0x2a09('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3930=['request-promise','path','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x28e973,_0x2a1364){var _0x178b9e=function(_0x11907d){while(--_0x11907d){_0x28e973['push'](_0x28e973['shift']());}};_0x178b9e(++_0x2a1364);}(_0x3930,0x19d));var _0x0393=function(_0x1ad901,_0x852d9e){_0x1ad901=_0x1ad901-0x0;var _0x3c0249=_0x3930[_0x1ad901];return _0x3c0249;};'use strict';var _=require(_0x0393('0x0'));var util=require('util');var logger=require(_0x0393('0x1'))(_0x0393('0x2'));var moment=require(_0x0393('0x3'));var BPromise=require(_0x0393('0x4'));var rp=require(_0x0393('0x5'));var fs=require('fs');var path=require(_0x0393('0x6'));var rimraf=require('rimraf');var config=require(_0x0393('0x7'));var attributes=require(_0x0393('0x8'));module['exports']=function(_0x47dee1,_0x479a0b){return _0x47dee1[_0x0393('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x0393('0xa'),'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 c97d613..00ddb07 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 _0x0047=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x10ddc5,_0x384456){var _0x3de8fa=function(_0x3be021){while(--_0x3be021){_0x10ddc5['push'](_0x10ddc5['shift']());}};_0x3de8fa(++_0x384456);}(_0x0047,0x111));var _0x7004=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x0047[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0x7004('0x0'));var util=require(_0x7004('0x1'));var moment=require('moment');var BPromise=require(_0x7004('0x2'));var rs=require(_0x7004('0x3'));var fs=require('fs');var Redis=require(_0x7004('0x4'));var db=require(_0x7004('0x5'))['db'];var utils=require(_0x7004('0x6'));var logger=require('../../config/logger')(_0x7004('0x7'));var config=require(_0x7004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7004('0x9')][_0x7004('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aa2d9,_0x14377a,_0x4a0731){return new BPromise(function(_0x227bc6,_0x5f41cd){return client['request'](_0x3aa2d9,_0x4a0731)[_0x7004('0xb')](function(_0x4b004a){logger['info'](_0x7004('0xc'),_0x14377a,_0x7004('0xd'));logger[_0x7004('0xe')](_0x7004('0xf'),_0x14377a,_0x7004('0xd'),JSON[_0x7004('0x10')](_0x4b004a));if(_0x4b004a[_0x7004('0x11')]){if(_0x4b004a[_0x7004('0x11')]['code']===0x1f4){logger[_0x7004('0x11')](_0x7004('0xc'),_0x14377a,_0x4b004a[_0x7004('0x11')][_0x7004('0x12')]);return _0x5f41cd(_0x4b004a[_0x7004('0x11')][_0x7004('0x12')]);}logger[_0x7004('0x11')](_0x7004('0xc'),_0x14377a,_0x4b004a[_0x7004('0x11')][_0x7004('0x12')]);return _0x227bc6(_0x4b004a[_0x7004('0x11')][_0x7004('0x12')]);}else{logger[_0x7004('0x13')](_0x7004('0xc'),_0x14377a,_0x7004('0xd'));_0x227bc6(_0x4b004a[_0x7004('0x14')][_0x7004('0x12')]);}})[_0x7004('0x15')](function(_0x2d55fd){logger[_0x7004('0x11')](_0x7004('0xc'),_0x14377a,_0x2d55fd);_0x5f41cd(_0x2d55fd);});});} \ No newline at end of file +var _0x727b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x727b,0xe3));var _0xb727=function(_0x106fd8,_0x19dbc1){_0x106fd8=_0x106fd8-0x0;var _0x2fec5c=_0x727b[_0x106fd8];return _0x2fec5c;};'use strict';var _=require(_0xb727('0x0'));var util=require(_0xb727('0x1'));var moment=require(_0xb727('0x2'));var BPromise=require(_0xb727('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb727('0x4'));var db=require(_0xb727('0x5'))['db'];var utils=require(_0xb727('0x6'));var logger=require('../../config/logger')(_0xb727('0x7'));var config=require('../../config/environment');var jayson=require(_0xb727('0x8'));var client=jayson[_0xb727('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac0a6,_0x21aa38,_0xf108d2){return new BPromise(function(_0x4c145d,_0x3a486b){return client[_0xb727('0xa')](_0x2ac0a6,_0xf108d2)['then'](function(_0x50bacb){logger[_0xb727('0xb')](_0xb727('0xc'),_0x21aa38,_0xb727('0xd'));logger['debug'](_0xb727('0xe'),_0x21aa38,_0xb727('0xd'),JSON[_0xb727('0xf')](_0x50bacb));if(_0x50bacb[_0xb727('0x10')]){if(_0x50bacb['error']['code']===0x1f4){logger[_0xb727('0x10')](_0xb727('0xc'),_0x21aa38,_0x50bacb['error']['message']);return _0x3a486b(_0x50bacb[_0xb727('0x10')][_0xb727('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x21aa38,_0x50bacb[_0xb727('0x10')][_0xb727('0x11')]);return _0x4c145d(_0x50bacb['error']['message']);}else{logger[_0xb727('0xb')](_0xb727('0xc'),_0x21aa38,'request\x20sent');_0x4c145d(_0x50bacb['result'][_0xb727('0x11')]);}})[_0xb727('0x12')](function(_0x56c6dc){logger['error'](_0xb727('0xc'),_0x21aa38,_0x56c6dc);_0x3a486b(_0x56c6dc);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 82f6394..66162d5 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 _0x5b52=['../../config/environment','isAuthenticated','index','get','/:id','/:id/preview','preview','/:id/run','/:id/query','query','post','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2c3e1c,_0x2130a5){var _0x4e34eb=function(_0x7274c1){while(--_0x7274c1){_0x2c3e1c['push'](_0x2c3e1c['shift']());}};_0x4e34eb(++_0x2130a5);}(_0x5b52,0xa2));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x25b5('0x0'));var path=require(_0x25b5('0x1'));var timeout=require('connect-timeout');var express=require(_0x25b5('0x2'));var router=express['Router']();var fs_extra=require(_0x25b5('0x3'));var auth=require(_0x25b5('0x4'));var interaction=require(_0x25b5('0x5'));var config=require(_0x25b5('0x6'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x25b5('0x7')](),controller[_0x25b5('0x8')]);router[_0x25b5('0x9')](_0x25b5('0xa'),auth[_0x25b5('0x7')](),controller['show']);router['get'](_0x25b5('0xb'),auth[_0x25b5('0x7')](),controller[_0x25b5('0xc')]);router[_0x25b5('0x9')](_0x25b5('0xd'),auth[_0x25b5('0x7')](),controller['run']);router[_0x25b5('0x9')](_0x25b5('0xe'),auth[_0x25b5('0x7')](),controller[_0x25b5('0xf')]);router[_0x25b5('0x10')]('/',auth[_0x25b5('0x7')](),controller['create']);router[_0x25b5('0x11')]('/:id',auth[_0x25b5('0x7')](),controller[_0x25b5('0x12')]);router['delete'](_0x25b5('0xa'),auth[_0x25b5('0x7')](),controller[_0x25b5('0x13')]);module[_0x25b5('0x14')]=router; \ No newline at end of file +var _0xc4aa=['exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','create','update','destroy'];(function(_0x5977ba,_0x15369e){var _0x32be1d=function(_0x20c222){while(--_0x20c222){_0x5977ba['push'](_0x5977ba['shift']());}};_0x32be1d(++_0x15369e);}(_0xc4aa,0x17d));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xac4a('0x0'));var path=require(_0xac4a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xac4a('0x3'));var interaction=require(_0xac4a('0x4'));var config=require(_0xac4a('0x5'));var controller=require('./analyticCustomReport.controller');router[_0xac4a('0x6')]('/',auth['isAuthenticated'](),controller[_0xac4a('0x7')]);router[_0xac4a('0x6')](_0xac4a('0x8'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router['get'](_0xac4a('0xb'),auth['isAuthenticated'](),controller['preview']);router['get'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xd')]);router[_0xac4a('0x6')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x10')]);router['put'](_0xac4a('0x8'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xac4a('0x12')]);module[_0xac4a('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c2af0be..6e1ff0b 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x170bba,_0x2be92f){var _0xa7c249=function(_0x2b6505){while(--_0x2b6505){_0x170bba['push'](_0x170bba['shift']());}};_0xa7c249(++_0x2be92f);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xf858e,_0x51b0f1){_0xf858e=_0xf858e-0x0;var _0x5344d8=_0xfdbd[_0xf858e];return _0x5344d8;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','TEXT'];(function(_0x197c26,_0x121ce8){var _0x5abb84=function(_0x377ef9){while(--_0x377ef9){_0x197c26['push'](_0x197c26['shift']());}};_0x5abb84(++_0x121ce8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4f86f3,_0x1258b5){_0x4f86f3=_0x4f86f3-0x0;var _0x1d58e7=_0xdbf5[_0x4f86f3];return _0x1d58e7;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e45108b..fd818d1 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 _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x43cba0,_0x5073a0){var _0x31fd30=function(_0x1fae64){while(--_0x1fae64){_0x43cba0['push'](_0x43cba0['shift']());}};_0x31fd30(++_0x5073a0);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x117581,_0x307e77){var _0x25cfa7=function(_0xcb89ee){while(--_0xcb89ee){_0x117581['push'](_0x117581['shift']());}};_0x25cfa7(++_0x307e77);}(_0x2675,0x75));var _0x5267=function(_0x4b6f0e,_0x59016d){_0x4b6f0e=_0x4b6f0e-0x0;var _0x33afa2=_0x2675[_0x4b6f0e];return _0x33afa2;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8b65c75..5f4bf5e 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 _0x83f0=['bluebird','request-promise','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x5ea242,_0x29cee7){var _0x5709ae=function(_0xc3df16){while(--_0xc3df16){_0x5ea242['push'](_0x5ea242['shift']());}};_0x5709ae(++_0x29cee7);}(_0x83f0,0xfa));var _0x083f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x83f0[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x083f('0x0'));var util=require(_0x083f('0x1'));var logger=require(_0x083f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x083f('0x3'));var rp=require(_0x083f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x083f('0x5'));var attributes=require(_0x083f('0x6'));module[_0x083f('0x7')]=function(_0x4a71c9,_0x1089ae){return _0x4a71c9[_0x083f('0x8')](_0x083f('0x9'),attributes,{'tableName':_0x083f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd336=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','lodash'];(function(_0x5da875,_0x475a8b){var _0x25d687=function(_0xb8a423){while(--_0xb8a423){_0x5da875['push'](_0x5da875['shift']());}};_0x25d687(++_0x475a8b);}(_0xd336,0x8b));var _0x6d33=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xd336[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0x6d33('0x0'));var util=require(_0x6d33('0x1'));var logger=require(_0x6d33('0x2'))('api');var moment=require(_0x6d33('0x3'));var BPromise=require(_0x6d33('0x4'));var rp=require(_0x6d33('0x5'));var fs=require('fs');var path=require(_0x6d33('0x6'));var rimraf=require('rimraf');var config=require(_0x6d33('0x7'));var attributes=require(_0x6d33('0x8'));module['exports']=function(_0x413eff,_0x4bd62a){return _0x413eff['define'](_0x6d33('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 0c63150..c3ca34f 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 _0x35cf=['util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash'];(function(_0x47317f,_0x24ec5a){var _0x8a8794=function(_0x1a48ad){while(--_0x1a48ad){_0x47317f['push'](_0x47317f['shift']());}};_0x8a8794(++_0x24ec5a);}(_0x35cf,0x155));var _0xf35c=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x35cf[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xf35c('0x0'));var util=require(_0xf35c('0x1'));var moment=require(_0xf35c('0x2'));var BPromise=require(_0xf35c('0x3'));var rs=require(_0xf35c('0x4'));var fs=require('fs');var Redis=require(_0xf35c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf35c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf35c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bd436,_0x5c9ec6,_0xcaf151){return new BPromise(function(_0x40d1e7,_0x31b590){return client[_0xf35c('0x8')](_0x4bd436,_0xcaf151)[_0xf35c('0x9')](function(_0xa17514){logger[_0xf35c('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5c9ec6,_0xf35c('0xb'));logger[_0xf35c('0xc')](_0xf35c('0xd'),_0x5c9ec6,_0xf35c('0xb'),JSON['stringify'](_0xa17514));if(_0xa17514[_0xf35c('0xe')]){if(_0xa17514[_0xf35c('0xe')]['code']===0x1f4){logger[_0xf35c('0xe')](_0xf35c('0xf'),_0x5c9ec6,_0xa17514[_0xf35c('0xe')][_0xf35c('0x10')]);return _0x31b590(_0xa17514[_0xf35c('0xe')][_0xf35c('0x10')]);}logger[_0xf35c('0xe')](_0xf35c('0xf'),_0x5c9ec6,_0xa17514[_0xf35c('0xe')][_0xf35c('0x10')]);return _0x40d1e7(_0xa17514[_0xf35c('0xe')]['message']);}else{logger['info'](_0xf35c('0xf'),_0x5c9ec6,_0xf35c('0xb'));_0x40d1e7(_0xa17514[_0xf35c('0x11')][_0xf35c('0x10')]);}})['catch'](function(_0x48785f){logger[_0xf35c('0xe')](_0xf35c('0xf'),_0x5c9ec6,_0x48785f);_0x31b590(_0x48785f);});});} \ No newline at end of file +var _0x66a4=['catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result'];(function(_0x4bda79,_0x23627a){var _0x36b69f=function(_0x217589){while(--_0x217589){_0x4bda79['push'](_0x4bda79['shift']());}};_0x36b69f(++_0x23627a);}(_0x66a4,0x85));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x466a('0x0'));var util=require(_0x466a('0x1'));var moment=require(_0x466a('0x2'));var BPromise=require(_0x466a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x466a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x466a('0x5'))(_0x466a('0x6'));var config=require(_0x466a('0x7'));var jayson=require(_0x466a('0x8'));var client=jayson[_0x466a('0x9')][_0x466a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fbff,_0x483c4a,_0x39bcfb){return new BPromise(function(_0x2cb9c3,_0x49f698){return client[_0x466a('0xb')](_0x44fbff,_0x39bcfb)['then'](function(_0x533a04){logger['info'](_0x466a('0xc'),_0x483c4a,_0x466a('0xd'));logger[_0x466a('0xe')](_0x466a('0xf'),_0x483c4a,'request\x20sent',JSON['stringify'](_0x533a04));if(_0x533a04['error']){if(_0x533a04['error'][_0x466a('0x10')]===0x1f4){logger[_0x466a('0x11')](_0x466a('0xc'),_0x483c4a,_0x533a04['error'][_0x466a('0x12')]);return _0x49f698(_0x533a04['error'][_0x466a('0x12')]);}logger[_0x466a('0x11')](_0x466a('0xc'),_0x483c4a,_0x533a04['error'][_0x466a('0x12')]);return _0x2cb9c3(_0x533a04['error'][_0x466a('0x12')]);}else{logger[_0x466a('0x13')](_0x466a('0xc'),_0x483c4a,'request\x20sent');_0x2cb9c3(_0x533a04[_0x466a('0x14')][_0x466a('0x12')]);}})[_0x466a('0x15')](function(_0x58404b){logger[_0x466a('0x11')](_0x466a('0xc'),_0x483c4a,_0x58404b);_0x49f698(_0x58404b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0f40650..bbb4196 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 _0x2678=['update','delete','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2678,0x1bb));var _0x8267=function(_0x3743c6,_0x27d62c){_0x3743c6=_0x3743c6-0x0;var _0xafb07b=_0x2678[_0x3743c6];return _0xafb07b;};'use strict';var multer=require('multer');var util=require(_0x8267('0x0'));var path=require(_0x8267('0x1'));var timeout=require(_0x8267('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8267('0x3'));var interaction=require(_0x8267('0x4'));var config=require(_0x8267('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0x8267('0x6')]('/',auth[_0x8267('0x7')](),controller[_0x8267('0x8')]);router[_0x8267('0x6')](_0x8267('0x9'),auth[_0x8267('0x7')](),controller[_0x8267('0xa')]);router[_0x8267('0x6')]('/:id/preview',auth[_0x8267('0x7')](),controller[_0x8267('0xb')]);router['get'](_0x8267('0xc'),auth[_0x8267('0x7')](),controller[_0x8267('0xd')]);router[_0x8267('0x6')](_0x8267('0xe'),auth['isAuthenticated'](),controller[_0x8267('0xf')]);router[_0x8267('0x10')]('/',auth[_0x8267('0x7')](),controller[_0x8267('0x11')]);router[_0x8267('0x12')](_0x8267('0x9'),auth[_0x8267('0x7')](),controller[_0x8267('0x13')]);router[_0x8267('0x14')](_0x8267('0x9'),auth[_0x8267('0x7')](),controller['destroy']);module[_0x8267('0x15')]=router; \ No newline at end of file +var _0x74f7=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','/:id','update','delete','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x42c576,_0x2b93de){var _0x4cb4e5=function(_0x4a2f71){while(--_0x4a2f71){_0x42c576['push'](_0x42c576['shift']());}};_0x4cb4e5(++_0x2b93de);}(_0x74f7,0xbd));var _0x774f=function(_0x5ee936,_0x5775c0){_0x5ee936=_0x5ee936-0x0;var _0x2cf998=_0x74f7[_0x5ee936];return _0x2cf998;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x774f('0x0'));var timeout=require(_0x774f('0x1'));var express=require(_0x774f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x774f('0x3'));var config=require(_0x774f('0x4'));var controller=require(_0x774f('0x5'));router[_0x774f('0x6')]('/',auth[_0x774f('0x7')](),controller[_0x774f('0x8')]);router[_0x774f('0x6')]('/:id',auth[_0x774f('0x7')](),controller[_0x774f('0x9')]);router[_0x774f('0x6')](_0x774f('0xa'),auth[_0x774f('0x7')](),controller[_0x774f('0xb')]);router[_0x774f('0x6')](_0x774f('0xc'),auth[_0x774f('0x7')](),controller[_0x774f('0xd')]);router[_0x774f('0x6')](_0x774f('0xe'),auth[_0x774f('0x7')](),controller[_0x774f('0xf')]);router[_0x774f('0x10')]('/',auth[_0x774f('0x7')](),controller['create']);router[_0x774f('0x11')](_0x774f('0x12'),auth['isAuthenticated'](),controller[_0x774f('0x13')]);router[_0x774f('0x14')]('/:id',auth[_0x774f('0x7')](),controller[_0x774f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index cb66c3f..8b59b97 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 _0xa012=['xlsx','DATE','STRING','Loading','manual','scheduled','INTEGER','UNSIGNED','moment','ENUM','csv','pdf'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xa012,0x164));var _0x2a01=function(_0x847809,_0x51e79e){_0x847809=_0x847809-0x0;var _0x598c3f=_0xa012[_0x847809];return _0x598c3f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a01('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2a01('0x1')](_0x2a01('0x2'),_0x2a01('0x3'),_0x2a01('0x4')),'allowNull':![],'defaultValue':_0x2a01('0x2')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2a01('0x5')]},'endDate':{'type':Sequelize[_0x2a01('0x5')]},'status':{'type':Sequelize[_0x2a01('0x6')],'defaultValue':_0x2a01('0x7')},'type':{'type':Sequelize[_0x2a01('0x1')](_0x2a01('0x8'),_0x2a01('0x9')),'allowNull':![],'defaultValue':_0x2a01('0x8')},'reportId':{'type':Sequelize[_0x2a01('0xa')](0xb)[_0x2a01('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d1a=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x4ef205,_0x1ea546){var _0x3c70ce=function(_0x5d2031){while(--_0x5d2031){_0x4ef205['push'](_0x4ef205['shift']());}};_0x3c70ce(++_0x1ea546);}(_0x4d1a,0x82));var _0xa4d1=function(_0x1cfa5f,_0x3e9f58){_0x1cfa5f=_0x1cfa5f-0x0;var _0x2ffbc8=_0x4d1a[_0x1cfa5f];return _0x2ffbc8;};'use strict';var Sequelize=require(_0xa4d1('0x0'));var moment=require(_0xa4d1('0x1'));module[_0xa4d1('0x2')]={'name':{'type':Sequelize[_0xa4d1('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xa4d1('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa4d1('0x4')](_0xa4d1('0x5'),_0xa4d1('0x6'),_0xa4d1('0x7')),'allowNull':![],'defaultValue':_0xa4d1('0x5')},'savename':{'type':Sequelize[_0xa4d1('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa4d1('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xa4d1('0x9')},'type':{'type':Sequelize[_0xa4d1('0x4')](_0xa4d1('0xa'),_0xa4d1('0xb')),'allowNull':![],'defaultValue':_0xa4d1('0xa')},'reportId':{'type':Sequelize[_0xa4d1('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index b1583d1..a1dd985 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 _0x7bcd=['sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','root','server/files/reports','savename','Sequelize','ValidationError','exists','join','format','%s.%s','toLowerCase','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','sendStatus','error','name','send','AnalyticExtractedReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit'];(function(_0x26307f,_0x28a0a4){var _0x50e950=function(_0x557639){while(--_0x557639){_0x26307f['push'](_0x26307f['shift']());}};_0x50e950(++_0x28a0a4);}(_0x7bcd,0xd8));var _0xd7bc=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x7bcd[_0x3b76f7];return _0x43984e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7bc('0x1'));var rp=require('request-promise');var moment=require(_0xd7bc('0x2'));var BPromise=require(_0xd7bc('0x3'));var Mustache=require('mustache');var util=require(_0xd7bc('0x4'));var path=require(_0xd7bc('0x5'));var sox=require(_0xd7bc('0x6'));var csv=require(_0xd7bc('0x7'));var ejs=require(_0xd7bc('0x8'));var fs=require('fs');var fs_extra=require(_0xd7bc('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd7bc('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd7bc('0xb'));var authService=require(_0xd7bc('0xc'));var qs=require(_0xd7bc('0xd'));var as=require(_0xd7bc('0xe'));var hardwareService=require(_0xd7bc('0xf'));var logger=require(_0xd7bc('0x10'))(_0xd7bc('0x11'));var utils=require(_0xd7bc('0x12'));var config=require(_0xd7bc('0x13'));var licenseUtil=require(_0xd7bc('0x14'));var db=require(_0xd7bc('0x15'))['db'];function respondWithStatusCode(_0x65209,_0x255b22){_0x255b22=_0x255b22||0xcc;return function(_0x361a71){if(_0x361a71){return _0x65209['sendStatus'](_0x255b22);}return _0x65209['status'](_0x255b22)['end']();};}function respondWithResult(_0x369653,_0x393ee6){_0x393ee6=_0x393ee6||0xc8;return function(_0x71434a){if(_0x71434a){return _0x369653[_0xd7bc('0x16')](_0x393ee6)[_0xd7bc('0x17')](_0x71434a);}};}function respondWithFilteredResult(_0x3503ee,_0x12438d){return function(_0x27fa86){if(_0x27fa86){var _0x430f70=typeof _0x12438d[_0xd7bc('0x18')]===_0xd7bc('0x19')&&typeof _0x12438d[_0xd7bc('0x1a')]==='undefined';var _0x8de1cc=_0x27fa86['count'];var _0x28f2ca=_0x430f70?0x0:_0x12438d[_0xd7bc('0x18')];var _0x239b72=_0x430f70?_0x27fa86[_0xd7bc('0x1b')]:_0x12438d[_0xd7bc('0x18')]+_0x12438d[_0xd7bc('0x1a')];var _0x4c7b7a;if(_0x239b72>=_0x8de1cc){_0x239b72=_0x8de1cc;_0x4c7b7a=0xc8;}else{_0x4c7b7a=0xce;}_0x3503ee[_0xd7bc('0x16')](_0x4c7b7a);return _0x3503ee[_0xd7bc('0x1c')]('Content-Range',_0x28f2ca+'-'+_0x239b72+'/'+_0x8de1cc)[_0xd7bc('0x17')](_0x27fa86);}return null;};}function patchUpdates(_0x3c624a){return function(_0x262278){try{jsonpatch[_0xd7bc('0x1d')](_0x262278,_0x3c624a,!![]);}catch(_0x436985){return BPromise[_0xd7bc('0x1e')](_0x436985);}return _0x262278[_0xd7bc('0x1f')]();};}function saveUpdates(_0x5cffed,_0x4f5942){return function(_0x3a0d2d){if(_0x3a0d2d){return _0x3a0d2d[_0xd7bc('0x20')](_0x5cffed)[_0xd7bc('0x21')](function(_0x3ff5e0){return _0x3ff5e0;});}return null;};}function removeEntity(_0x26858c,_0x4440eb){return function(_0x2bc508){if(_0x2bc508){return _0x2bc508[_0xd7bc('0x22')]()[_0xd7bc('0x21')](function(){var _0x5ae931=_0x2bc508[_0xd7bc('0x23')]({'plain':!![]});var _0x44fa03=_0xd7bc('0x24');return db[_0xd7bc('0x25')]['destroy']({'where':{'type':_0x44fa03,'resourceId':_0x5ae931['id']}})[_0xd7bc('0x21')](function(){return _0x2bc508;});})[_0xd7bc('0x21')](function(){_0x26858c[_0xd7bc('0x16')](0xcc)[_0xd7bc('0x26')]();});}};}function handleEntityNotFound(_0x1909d6,_0x2585f7){return function(_0x2394fb){if(!_0x2394fb){_0x1909d6[_0xd7bc('0x27')](0x194);}return _0x2394fb;};}function handleError(_0x3d5440,_0x421795){_0x421795=_0x421795||0x1f4;return function(_0x5db73a){logger[_0xd7bc('0x28')](_0x5db73a['stack']);if(_0x5db73a[_0xd7bc('0x29')]){delete _0x5db73a['name'];}_0x3d5440[_0xd7bc('0x16')](_0x421795)[_0xd7bc('0x2a')](_0x5db73a);};}exports['index']=function(_0x4ad6f1,_0x3bed7c){var _0xe85fd={},_0x50d50f={},_0x5702a6={'count':0x0,'rows':[]};var _0x28a07f=_['map'](db[_0xd7bc('0x2b')][_0xd7bc('0x2c')],function(_0x7eab7){return{'name':_0x7eab7[_0xd7bc('0x2d')],'type':_0x7eab7['type']['key']};});_0x50d50f[_0xd7bc('0x2e')]=_['map'](_0x28a07f,_0xd7bc('0x29'));_0x50d50f[_0xd7bc('0x2f')]=_[_0xd7bc('0x30')](_0x4ad6f1['query']);_0x50d50f['filters']=_[_0xd7bc('0x31')](_0x50d50f['model'],_0x50d50f[_0xd7bc('0x2f')]);_0xe85fd[_0xd7bc('0x32')]=_[_0xd7bc('0x31')](_0x50d50f[_0xd7bc('0x2e')],qs[_0xd7bc('0x33')](_0x4ad6f1['query']['fields']));_0xe85fd['attributes']=_0xe85fd[_0xd7bc('0x32')][_0xd7bc('0x34')]?_0xe85fd[_0xd7bc('0x32')]:_0x50d50f[_0xd7bc('0x2e')];if(!_0x4ad6f1[_0xd7bc('0x2f')]['hasOwnProperty'](_0xd7bc('0x35'))){_0xe85fd[_0xd7bc('0x1a')]=qs[_0xd7bc('0x1a')](_0x4ad6f1['query'][_0xd7bc('0x1a')]);_0xe85fd[_0xd7bc('0x18')]=qs[_0xd7bc('0x18')](_0x4ad6f1['query'][_0xd7bc('0x18')]);}_0xe85fd['order']=qs['sort'](_0x4ad6f1[_0xd7bc('0x2f')][_0xd7bc('0x36')]);_0xe85fd[_0xd7bc('0x37')]=qs['filters'](_[_0xd7bc('0x38')](_0x4ad6f1[_0xd7bc('0x2f')],_0x50d50f[_0xd7bc('0x39')]),_0x28a07f);if(_0x4ad6f1['query'][_0xd7bc('0x3a')]){_0xe85fd[_0xd7bc('0x37')]=_[_0xd7bc('0x3b')](_0xe85fd[_0xd7bc('0x37')],{'$or':_[_0xd7bc('0x3c')](_0x28a07f,function(_0x414a50){if(_0x414a50['type']!==_0xd7bc('0x3d')){var _0x5819c4={};_0x5819c4[_0x414a50['name']]={'$like':'%'+_0x4ad6f1[_0xd7bc('0x2f')][_0xd7bc('0x3a')]+'%'};return _0x5819c4;}})});}_0xe85fd=_[_0xd7bc('0x3b')]({},_0xe85fd,_0x4ad6f1['options']);var _0x2ea762={'where':_0xe85fd[_0xd7bc('0x37')]};return db[_0xd7bc('0x2b')][_0xd7bc('0x1b')](_0x2ea762)[_0xd7bc('0x21')](function(_0x3d5bfb){_0x5702a6['count']=_0x3d5bfb;if(_0x4ad6f1[_0xd7bc('0x2f')][_0xd7bc('0x3e')]){_0xe85fd[_0xd7bc('0x3f')]=[{'all':!![]}];}return db[_0xd7bc('0x2b')][_0xd7bc('0x40')](_0xe85fd);})['then'](function(_0x324873){_0x5702a6[_0xd7bc('0x41')]=_0x324873;return _0x5702a6;})[_0xd7bc('0x21')](respondWithFilteredResult(_0x3bed7c,_0xe85fd))[_0xd7bc('0x42')](handleError(_0x3bed7c,null));};exports[_0xd7bc('0x43')]=function(_0x47570b,_0x1914fb){var _0x1dce8c={'raw':!![],'where':{'id':_0x47570b[_0xd7bc('0x44')]['id']}},_0x462eb2={};_0x462eb2[_0xd7bc('0x2e')]=_[_0xd7bc('0x30')](db['AnalyticExtractedReport'][_0xd7bc('0x2c')]);_0x462eb2[_0xd7bc('0x2f')]=_[_0xd7bc('0x30')](_0x47570b['query']);_0x462eb2[_0xd7bc('0x39')]=_['intersection'](_0x462eb2['model'],_0x462eb2[_0xd7bc('0x2f')]);_0x1dce8c[_0xd7bc('0x32')]=_[_0xd7bc('0x31')](_0x462eb2[_0xd7bc('0x2e')],qs[_0xd7bc('0x33')](_0x47570b['query'][_0xd7bc('0x33')]));_0x1dce8c[_0xd7bc('0x32')]=_0x1dce8c[_0xd7bc('0x32')][_0xd7bc('0x34')]?_0x1dce8c[_0xd7bc('0x32')]:_0x462eb2[_0xd7bc('0x2e')];if(_0x47570b['query'][_0xd7bc('0x3e')]){_0x1dce8c[_0xd7bc('0x3f')]=[{'all':!![]}];}_0x1dce8c=_[_0xd7bc('0x3b')]({},_0x1dce8c,_0x47570b[_0xd7bc('0x45')]);return db[_0xd7bc('0x2b')][_0xd7bc('0x46')](_0x1dce8c)[_0xd7bc('0x21')](handleEntityNotFound(_0x1914fb,null))[_0xd7bc('0x21')](respondWithResult(_0x1914fb,null))[_0xd7bc('0x42')](handleError(_0x1914fb,null));};exports['create']=function(_0x4b44a6,_0x3d6160){return db[_0xd7bc('0x2b')][_0xd7bc('0x47')](_0x4b44a6[_0xd7bc('0x48')],{})[_0xd7bc('0x21')](function(_0x58167a){var _0x5e06a1=_0x4b44a6['user'][_0xd7bc('0x23')]({'plain':!![]});if(!_0x5e06a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e06a1['role']===_0xd7bc('0x49')){var _0x5c5c82=_0x58167a[_0xd7bc('0x23')]({'plain':!![]});var _0x204e3a=_0xd7bc('0x24');return db[_0xd7bc('0x4a')][_0xd7bc('0x46')]({'where':{'name':_0x204e3a,'userProfileId':_0x5e06a1['userProfileId']},'raw':!![]})['then'](function(_0x4145fd){if(_0x4145fd&&_0x4145fd[_0xd7bc('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c5c82['name'],'resourceId':_0x5c5c82['id'],'type':_0x4145fd[_0xd7bc('0x29')],'sectionId':_0x4145fd['id']},{})[_0xd7bc('0x21')](function(){return _0x58167a;});}else{return _0x58167a;}})['catch'](function(_0x48fd4a){logger[_0xd7bc('0x28')](_0xd7bc('0x4c'),_0x48fd4a);throw _0x48fd4a;});}return _0x58167a;})[_0xd7bc('0x21')](respondWithResult(_0x3d6160,0xc9))[_0xd7bc('0x42')](handleError(_0x3d6160,null));};exports[_0xd7bc('0x20')]=function(_0x1740e2,_0x4a1931){if(_0x1740e2['body']['id']){delete _0x1740e2[_0xd7bc('0x48')]['id'];}return db['AnalyticExtractedReport'][_0xd7bc('0x46')]({'where':{'id':_0x1740e2[_0xd7bc('0x44')]['id']}})[_0xd7bc('0x21')](handleEntityNotFound(_0x4a1931,null))[_0xd7bc('0x21')](saveUpdates(_0x1740e2[_0xd7bc('0x48')],null))[_0xd7bc('0x21')](respondWithResult(_0x4a1931,null))[_0xd7bc('0x42')](handleError(_0x4a1931,null));};exports[_0xd7bc('0x22')]=function(_0x5f07a4,_0x30b921){return db[_0xd7bc('0x2b')][_0xd7bc('0x46')]({'where':{'id':_0x5f07a4['params']['id']}})[_0xd7bc('0x21')](handleEntityNotFound(_0x30b921,null))[_0xd7bc('0x21')](removeEntity(_0x30b921,null))[_0xd7bc('0x42')](handleError(_0x30b921,null));};exports[_0xd7bc('0x4d')]=function(_0xb5c89e,_0x52afae,_0x373bb5){return db[_0xd7bc('0x2b')][_0xd7bc('0x46')]({'where':{'id':_0xb5c89e[_0xd7bc('0x44')]['id']},'attributes':[_0xd7bc('0x29'),_0xd7bc('0x4e'),'savename',_0xd7bc('0x4f')],'raw':!![]})[_0xd7bc('0x21')](handleEntityNotFound(_0x52afae,null))[_0xd7bc('0x21')](function(_0x59f4e4){if(_0x59f4e4){if(!fs['existsSync'](path['join'](config[_0xd7bc('0x50')],_0xd7bc('0x51'),_0x59f4e4[_0xd7bc('0x52')]))){throw new db[(_0xd7bc('0x53'))][(_0xd7bc('0x54'))]('Report\x20not\x20found\x20or\x20empty');}if(_0xb5c89e['query'][_0xd7bc('0x55')]){return _0x52afae[_0xd7bc('0x27')](0xc8);}return _0x52afae['download'](path[_0xd7bc('0x56')](config['root'],_0xd7bc('0x51'),_0x59f4e4[_0xd7bc('0x52')]),util[_0xd7bc('0x57')](_0xd7bc('0x58'),_0x59f4e4['basename']||_0x59f4e4[_0xd7bc('0x29')],_0x59f4e4['output'][_0xd7bc('0x59')]()));}})[_0xd7bc('0x42')](handleError(_0x52afae,null));}; \ No newline at end of file +var _0x81ab=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','download','savename','output','existsSync','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','basename','toLowerCase','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5b1b10,_0x127b8b){var _0x51eaf0=function(_0x56bcb7){while(--_0x56bcb7){_0x5b1b10['push'](_0x5b1b10['shift']());}};_0x51eaf0(++_0x127b8b);}(_0x81ab,0x174));var _0xb81a=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x81ab[_0xe8129c];return _0x709fc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb81a('0x0'));var zipdir=require(_0xb81a('0x1'));var jsonpatch=require(_0xb81a('0x2'));var rp=require('request-promise');var moment=require(_0xb81a('0x3'));var BPromise=require(_0xb81a('0x4'));var Mustache=require(_0xb81a('0x5'));var util=require(_0xb81a('0x6'));var path=require(_0xb81a('0x7'));var sox=require(_0xb81a('0x8'));var csv=require('to-csv');var ejs=require(_0xb81a('0x9'));var fs=require('fs');var fs_extra=require(_0xb81a('0xa'));var _=require(_0xb81a('0xb'));var squel=require(_0xb81a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb81a('0xd'));var toCsv=require(_0xb81a('0xe'));var querystring=require(_0xb81a('0xf'));var Papa=require(_0xb81a('0x10'));var Redis=require(_0xb81a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb81a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb81a('0x13'))(_0xb81a('0x14'));var utils=require(_0xb81a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb81a('0x16'));var db=require(_0xb81a('0x17'))['db'];function respondWithStatusCode(_0x349bd5,_0x1071e3){_0x1071e3=_0x1071e3||0xcc;return function(_0x1078c0){if(_0x1078c0){return _0x349bd5[_0xb81a('0x18')](_0x1071e3);}return _0x349bd5['status'](_0x1071e3)[_0xb81a('0x19')]();};}function respondWithResult(_0x1b6043,_0x1bed3b){_0x1bed3b=_0x1bed3b||0xc8;return function(_0xf27755){if(_0xf27755){return _0x1b6043[_0xb81a('0x1a')](_0x1bed3b)[_0xb81a('0x1b')](_0xf27755);}};}function respondWithFilteredResult(_0x280ef9,_0x27bdbe){return function(_0x534b6c){if(_0x534b6c){var _0x4ea148=typeof _0x27bdbe[_0xb81a('0x1c')]===_0xb81a('0x1d')&&typeof _0x27bdbe[_0xb81a('0x1e')]==='undefined';var _0x9843ab=_0x534b6c[_0xb81a('0x1f')];var _0x1f46ba=_0x4ea148?0x0:_0x27bdbe['offset'];var _0x4d34b4=_0x4ea148?_0x534b6c[_0xb81a('0x1f')]:_0x27bdbe[_0xb81a('0x1c')]+_0x27bdbe['limit'];var _0x547b58;if(_0x4d34b4>=_0x9843ab){_0x4d34b4=_0x9843ab;_0x547b58=0xc8;}else{_0x547b58=0xce;}_0x280ef9[_0xb81a('0x1a')](_0x547b58);return _0x280ef9[_0xb81a('0x20')](_0xb81a('0x21'),_0x1f46ba+'-'+_0x4d34b4+'/'+_0x9843ab)[_0xb81a('0x1b')](_0x534b6c);}return null;};}function patchUpdates(_0x134733){return function(_0x43d2e1){try{jsonpatch['apply'](_0x43d2e1,_0x134733,!![]);}catch(_0x5eec6e){return BPromise[_0xb81a('0x22')](_0x5eec6e);}return _0x43d2e1['save']();};}function saveUpdates(_0x44314c,_0x59f92d){return function(_0x5918b6){if(_0x5918b6){return _0x5918b6['update'](_0x44314c)[_0xb81a('0x23')](function(_0x550857){return _0x550857;});}return null;};}function removeEntity(_0x18b96a,_0x208342){return function(_0x3bf62e){if(_0x3bf62e){return _0x3bf62e['destroy']()[_0xb81a('0x23')](function(){var _0x31c3d=_0x3bf62e['get']({'plain':!![]});var _0x4e2690=_0xb81a('0x24');return db[_0xb81a('0x25')]['destroy']({'where':{'type':_0x4e2690,'resourceId':_0x31c3d['id']}})[_0xb81a('0x23')](function(){return _0x3bf62e;});})['then'](function(){_0x18b96a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ab819,_0x2139d5){return function(_0x4f0d57){if(!_0x4f0d57){_0x1ab819[_0xb81a('0x18')](0x194);}return _0x4f0d57;};}function handleError(_0x424d11,_0x24c236){_0x24c236=_0x24c236||0x1f4;return function(_0xff591){logger[_0xb81a('0x26')](_0xff591[_0xb81a('0x27')]);if(_0xff591[_0xb81a('0x28')]){delete _0xff591[_0xb81a('0x28')];}_0x424d11['status'](_0x24c236)[_0xb81a('0x29')](_0xff591);};}exports[_0xb81a('0x2a')]=function(_0xe15458,_0x5e0914){var _0xdd431f={},_0x5503c4={},_0x41984a={'count':0x0,'rows':[]};var _0x9aee22=_[_0xb81a('0x2b')](db[_0xb81a('0x2c')][_0xb81a('0x2d')],function(_0x1aa409){return{'name':_0x1aa409['fieldName'],'type':_0x1aa409[_0xb81a('0x2e')][_0xb81a('0x2f')]};});_0x5503c4[_0xb81a('0x30')]=_['map'](_0x9aee22,'name');_0x5503c4[_0xb81a('0x31')]=_[_0xb81a('0x32')](_0xe15458[_0xb81a('0x31')]);_0x5503c4['filters']=_[_0xb81a('0x33')](_0x5503c4[_0xb81a('0x30')],_0x5503c4[_0xb81a('0x31')]);_0xdd431f['attributes']=_['intersection'](_0x5503c4[_0xb81a('0x30')],qs[_0xb81a('0x34')](_0xe15458['query']['fields']));_0xdd431f[_0xb81a('0x35')]=_0xdd431f[_0xb81a('0x35')]['length']?_0xdd431f[_0xb81a('0x35')]:_0x5503c4[_0xb81a('0x30')];if(!_0xe15458['query'][_0xb81a('0x36')](_0xb81a('0x37'))){_0xdd431f[_0xb81a('0x1e')]=qs[_0xb81a('0x1e')](_0xe15458[_0xb81a('0x31')][_0xb81a('0x1e')]);_0xdd431f[_0xb81a('0x1c')]=qs[_0xb81a('0x1c')](_0xe15458[_0xb81a('0x31')][_0xb81a('0x1c')]);}_0xdd431f[_0xb81a('0x38')]=qs[_0xb81a('0x39')](_0xe15458[_0xb81a('0x31')][_0xb81a('0x39')]);_0xdd431f[_0xb81a('0x3a')]=qs[_0xb81a('0x3b')](_[_0xb81a('0x3c')](_0xe15458[_0xb81a('0x31')],_0x5503c4['filters']),_0x9aee22);if(_0xe15458[_0xb81a('0x31')][_0xb81a('0x3d')]){_0xdd431f[_0xb81a('0x3a')]=_[_0xb81a('0x3e')](_0xdd431f[_0xb81a('0x3a')],{'$or':_[_0xb81a('0x2b')](_0x9aee22,function(_0x1878c2){if(_0x1878c2[_0xb81a('0x2e')]!=='VIRTUAL'){var _0x3259e8={};_0x3259e8[_0x1878c2['name']]={'$like':'%'+_0xe15458[_0xb81a('0x31')]['filter']+'%'};return _0x3259e8;}})});}_0xdd431f=_[_0xb81a('0x3e')]({},_0xdd431f,_0xe15458['options']);var _0x859e17={'where':_0xdd431f[_0xb81a('0x3a')]};return db[_0xb81a('0x2c')][_0xb81a('0x1f')](_0x859e17)[_0xb81a('0x23')](function(_0x427457){_0x41984a[_0xb81a('0x1f')]=_0x427457;if(_0xe15458['query'][_0xb81a('0x3f')]){_0xdd431f[_0xb81a('0x40')]=[{'all':!![]}];}return db[_0xb81a('0x2c')]['findAll'](_0xdd431f);})['then'](function(_0x7263fa){_0x41984a['rows']=_0x7263fa;return _0x41984a;})['then'](respondWithFilteredResult(_0x5e0914,_0xdd431f))[_0xb81a('0x41')](handleError(_0x5e0914,null));};exports['show']=function(_0x339d54,_0x1ca587){var _0xb4ca37={'raw':!![],'where':{'id':_0x339d54[_0xb81a('0x42')]['id']}},_0x5f40cb={};_0x5f40cb['model']=_[_0xb81a('0x32')](db['AnalyticExtractedReport']['rawAttributes']);_0x5f40cb[_0xb81a('0x31')]=_[_0xb81a('0x32')](_0x339d54[_0xb81a('0x31')]);_0x5f40cb['filters']=_[_0xb81a('0x33')](_0x5f40cb[_0xb81a('0x30')],_0x5f40cb[_0xb81a('0x31')]);_0xb4ca37[_0xb81a('0x35')]=_[_0xb81a('0x33')](_0x5f40cb[_0xb81a('0x30')],qs[_0xb81a('0x34')](_0x339d54[_0xb81a('0x31')]['fields']));_0xb4ca37['attributes']=_0xb4ca37[_0xb81a('0x35')][_0xb81a('0x43')]?_0xb4ca37[_0xb81a('0x35')]:_0x5f40cb[_0xb81a('0x30')];if(_0x339d54[_0xb81a('0x31')][_0xb81a('0x3f')]){_0xb4ca37[_0xb81a('0x40')]=[{'all':!![]}];}_0xb4ca37=_[_0xb81a('0x3e')]({},_0xb4ca37,_0x339d54['options']);return db[_0xb81a('0x2c')][_0xb81a('0x44')](_0xb4ca37)[_0xb81a('0x23')](handleEntityNotFound(_0x1ca587,null))[_0xb81a('0x23')](respondWithResult(_0x1ca587,null))['catch'](handleError(_0x1ca587,null));};exports[_0xb81a('0x45')]=function(_0x29d1e8,_0x3bad21){return db[_0xb81a('0x2c')][_0xb81a('0x45')](_0x29d1e8['body'],{})['then'](function(_0x545509){var _0x5b27b0=_0x29d1e8['user']['get']({'plain':!![]});if(!_0x5b27b0)throw new Error(_0xb81a('0x46'));if(_0x5b27b0[_0xb81a('0x47')]===_0xb81a('0x48')){var _0x2f290f=_0x545509[_0xb81a('0x49')]({'plain':!![]});var _0x16dd83=_0xb81a('0x24');return db[_0xb81a('0x4a')][_0xb81a('0x44')]({'where':{'name':_0x16dd83,'userProfileId':_0x5b27b0[_0xb81a('0x4b')]},'raw':!![]})[_0xb81a('0x23')](function(_0x27852e){if(_0x27852e&&_0x27852e['autoAssociation']===0x0){return db[_0xb81a('0x25')][_0xb81a('0x45')]({'name':_0x2f290f['name'],'resourceId':_0x2f290f['id'],'type':_0x27852e[_0xb81a('0x28')],'sectionId':_0x27852e['id']},{})[_0xb81a('0x23')](function(){return _0x545509;});}else{return _0x545509;}})[_0xb81a('0x41')](function(_0xaad58e){logger['error'](_0xb81a('0x4c'),_0xaad58e);throw _0xaad58e;});}return _0x545509;})[_0xb81a('0x23')](respondWithResult(_0x3bad21,0xc9))[_0xb81a('0x41')](handleError(_0x3bad21,null));};exports[_0xb81a('0x4d')]=function(_0x1b16fe,_0x577e58){if(_0x1b16fe[_0xb81a('0x4e')]['id']){delete _0x1b16fe[_0xb81a('0x4e')]['id'];}return db[_0xb81a('0x2c')][_0xb81a('0x44')]({'where':{'id':_0x1b16fe[_0xb81a('0x42')]['id']}})[_0xb81a('0x23')](handleEntityNotFound(_0x577e58,null))['then'](saveUpdates(_0x1b16fe[_0xb81a('0x4e')],null))[_0xb81a('0x23')](respondWithResult(_0x577e58,null))[_0xb81a('0x41')](handleError(_0x577e58,null));};exports[_0xb81a('0x4f')]=function(_0x43a6d3,_0x9d176e){return db[_0xb81a('0x2c')][_0xb81a('0x44')]({'where':{'id':_0x43a6d3[_0xb81a('0x42')]['id']}})[_0xb81a('0x23')](handleEntityNotFound(_0x9d176e,null))['then'](removeEntity(_0x9d176e,null))[_0xb81a('0x41')](handleError(_0x9d176e,null));};exports[_0xb81a('0x50')]=function(_0x160eb1,_0x16d16c,_0x1617e1){return db[_0xb81a('0x2c')]['find']({'where':{'id':_0x160eb1['params']['id']},'attributes':['name','basename',_0xb81a('0x51'),_0xb81a('0x52')],'raw':!![]})[_0xb81a('0x23')](handleEntityNotFound(_0x16d16c,null))[_0xb81a('0x23')](function(_0x41c5ce){if(_0x41c5ce){if(!fs[_0xb81a('0x53')](path['join'](config[_0xb81a('0x54')],_0xb81a('0x55'),_0x41c5ce['savename']))){throw new db[(_0xb81a('0x56'))]['ValidationError'](_0xb81a('0x57'));}if(_0x160eb1[_0xb81a('0x31')][_0xb81a('0x58')]){return _0x16d16c[_0xb81a('0x18')](0xc8);}return _0x16d16c[_0xb81a('0x50')](path[_0xb81a('0x59')](config[_0xb81a('0x54')],_0xb81a('0x55'),_0x41c5ce['savename']),util[_0xb81a('0x5a')](_0xb81a('0x5b'),_0x41c5ce[_0xb81a('0x5c')]||_0x41c5ce[_0xb81a('0x28')],_0x41c5ce[_0xb81a('0x52')][_0xb81a('0x5d')]()));}})[_0xb81a('0x41')](handleError(_0x16d16c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 44a70e1..e11d2d1 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 _0x5e89=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x489646,_0x2fed71){var _0x45de80=function(_0x15b10e){while(--_0x15b10e){_0x489646['push'](_0x489646['shift']());}};_0x45de80(++_0x2fed71);}(_0x5e89,0xc8));var _0x95e8=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x5e89[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x95e8('0x0'));var util=require(_0x95e8('0x1'));var logger=require(_0x95e8('0x2'))(_0x95e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95e8('0x4'));var fs=require('fs');var path=require(_0x95e8('0x5'));var rimraf=require(_0x95e8('0x6'));var config=require('../../config/environment');var attributes=require(_0x95e8('0x7'));module['exports']=function(_0x577578,_0x1930a6){return _0x577578[_0x95e8('0x8')](_0x95e8('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8199=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x4ccc4b,_0x533a47){var _0x739005=function(_0x2515d3){while(--_0x2515d3){_0x4ccc4b['push'](_0x4ccc4b['shift']());}};_0x739005(++_0x533a47);}(_0x8199,0x1be));var _0x9819=function(_0x318e2a,_0x50e65d){_0x318e2a=_0x318e2a-0x0;var _0x111736=_0x8199[_0x318e2a];return _0x111736;};'use strict';var _=require(_0x9819('0x0'));var util=require(_0x9819('0x1'));var logger=require('../../config/logger')(_0x9819('0x2'));var moment=require(_0x9819('0x3'));var BPromise=require(_0x9819('0x4'));var rp=require(_0x9819('0x5'));var fs=require('fs');var path=require(_0x9819('0x6'));var rimraf=require(_0x9819('0x7'));var config=require(_0x9819('0x8'));var attributes=require(_0x9819('0x9'));module[_0x9819('0xa')]=function(_0x4e1624,_0x1593ca){return _0x4e1624[_0x9819('0xb')](_0x9819('0xc'),attributes,{'tableName':_0x9819('0xd'),'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 cda3074..061704f 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 _0xf969=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0xf969,0x1ca));var _0x9f96=function(_0x4defd4,_0x368412){_0x4defd4=_0x4defd4-0x0;var _0x1cbe41=_0xf969[_0x4defd4];return _0x1cbe41;};'use strict';var _=require(_0x9f96('0x0'));var util=require('util');var moment=require(_0x9f96('0x1'));var BPromise=require(_0x9f96('0x2'));var rs=require(_0x9f96('0x3'));var fs=require('fs');var Redis=require(_0x9f96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f96('0x5'));var logger=require(_0x9f96('0x6'))('rpc');var config=require(_0x9f96('0x7'));var jayson=require(_0x9f96('0x8'));var client=jayson['client'][_0x9f96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8b6f,_0x107a92,_0x4a410b){return new BPromise(function(_0x35ea7a,_0x377c6e){return client[_0x9f96('0xa')](_0x1d8b6f,_0x4a410b)[_0x9f96('0xb')](function(_0x5f5ce){logger[_0x9f96('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x107a92,_0x9f96('0xd'));logger[_0x9f96('0xe')](_0x9f96('0xf'),_0x107a92,_0x9f96('0xd'),JSON[_0x9f96('0x10')](_0x5f5ce));if(_0x5f5ce[_0x9f96('0x11')]){if(_0x5f5ce[_0x9f96('0x11')][_0x9f96('0x12')]===0x1f4){logger[_0x9f96('0x11')](_0x9f96('0x13'),_0x107a92,_0x5f5ce['error']['message']);return _0x377c6e(_0x5f5ce[_0x9f96('0x11')][_0x9f96('0x14')]);}logger[_0x9f96('0x11')](_0x9f96('0x13'),_0x107a92,_0x5f5ce[_0x9f96('0x11')]['message']);return _0x35ea7a(_0x5f5ce[_0x9f96('0x11')]['message']);}else{logger[_0x9f96('0xc')](_0x9f96('0x13'),_0x107a92,_0x9f96('0xd'));_0x35ea7a(_0x5f5ce[_0x9f96('0x15')]['message']);}})[_0x9f96('0x16')](function(_0x2b34f0){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x107a92,_0x2b34f0);_0x377c6e(_0x2b34f0);});});} \ No newline at end of file +var _0x21fd=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x33c2c7,_0x31de52){var _0x220e88=function(_0x3f4722){while(--_0x3f4722){_0x33c2c7['push'](_0x33c2c7['shift']());}};_0x220e88(++_0x31de52);}(_0x21fd,0x1e2));var _0xd21f=function(_0x59e57a,_0x38b6b7){_0x59e57a=_0x59e57a-0x0;var _0x1b8f29=_0x21fd[_0x59e57a];return _0x1b8f29;};'use strict';var _=require(_0xd21f('0x0'));var util=require(_0xd21f('0x1'));var moment=require(_0xd21f('0x2'));var BPromise=require(_0xd21f('0x3'));var rs=require(_0xd21f('0x4'));var fs=require('fs');var Redis=require(_0xd21f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd21f('0x6'));var logger=require(_0xd21f('0x7'))('rpc');var config=require(_0xd21f('0x8'));var jayson=require(_0xd21f('0x9'));var client=jayson[_0xd21f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aec4f,_0x1380c5,_0x3c74a2){return new BPromise(function(_0x245ab7,_0x3a2dfb){return client[_0xd21f('0xb')](_0x3aec4f,_0x3c74a2)[_0xd21f('0xc')](function(_0xcf4a59){logger[_0xd21f('0xd')](_0xd21f('0xe'),_0x1380c5,_0xd21f('0xf'));logger[_0xd21f('0x10')](_0xd21f('0x11'),_0x1380c5,_0xd21f('0xf'),JSON[_0xd21f('0x12')](_0xcf4a59));if(_0xcf4a59[_0xd21f('0x13')]){if(_0xcf4a59[_0xd21f('0x13')]['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1380c5,_0xcf4a59[_0xd21f('0x13')][_0xd21f('0x14')]);return _0x3a2dfb(_0xcf4a59[_0xd21f('0x13')]['message']);}logger[_0xd21f('0x13')](_0xd21f('0xe'),_0x1380c5,_0xcf4a59[_0xd21f('0x13')]['message']);return _0x245ab7(_0xcf4a59[_0xd21f('0x13')]['message']);}else{logger['info'](_0xd21f('0xe'),_0x1380c5,_0xd21f('0xf'));_0x245ab7(_0xcf4a59[_0xd21f('0x15')][_0xd21f('0x14')]);}})[_0xd21f('0x16')](function(_0x144673){logger['error'](_0xd21f('0xe'),_0x1380c5,_0x144673);_0x3a2dfb(_0x144673);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e2b4317..1b7666e 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 _0xbf06=['download','post','create','put','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','show','/:id/download','isAuthenticated'];(function(_0x4e0cc9,_0x1149ef){var _0x1925ee=function(_0x2173cb){while(--_0x2173cb){_0x4e0cc9['push'](_0x4e0cc9['shift']());}};_0x1925ee(++_0x1149ef);}(_0xbf06,0x9f));var _0x6bf0=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xbf06[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x6bf0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6bf0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6bf0('0x2'));var auth=require(_0x6bf0('0x3'));var interaction=require(_0x6bf0('0x4'));var config=require(_0x6bf0('0x5'));var controller=require(_0x6bf0('0x6'));router[_0x6bf0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6bf0('0x8'),auth['isAuthenticated'](),controller[_0x6bf0('0x9')]);router[_0x6bf0('0x7')](_0x6bf0('0xa'),auth[_0x6bf0('0xb')](),controller[_0x6bf0('0xc')]);router[_0x6bf0('0xd')]('/',auth[_0x6bf0('0xb')](),controller[_0x6bf0('0xe')]);router[_0x6bf0('0xf')](_0x6bf0('0x8'),auth['isAuthenticated'](),controller[_0x6bf0('0x10')]);router[_0x6bf0('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6bf0('0x12')]=router; \ No newline at end of file +var _0x2461=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','delete','destroy'];(function(_0x3722bd,_0x1e1603){var _0x22221e=function(_0x51d82a){while(--_0x51d82a){_0x3722bd['push'](_0x3722bd['shift']());}};_0x22221e(++_0x1e1603);}(_0x2461,0x176));var _0x1246=function(_0x108244,_0x281704){_0x108244=_0x108244-0x0;var _0x50603c=_0x2461[_0x108244];return _0x50603c;};'use strict';var multer=require(_0x1246('0x0'));var util=require('util');var path=require(_0x1246('0x1'));var timeout=require(_0x1246('0x2'));var express=require(_0x1246('0x3'));var router=express[_0x1246('0x4')]();var fs_extra=require(_0x1246('0x5'));var auth=require(_0x1246('0x6'));var interaction=require(_0x1246('0x7'));var config=require(_0x1246('0x8'));var controller=require(_0x1246('0x9'));router[_0x1246('0xa')]('/',auth[_0x1246('0xb')](),controller[_0x1246('0xc')]);router[_0x1246('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1246('0xd')]);router['get'](_0x1246('0xe'),auth[_0x1246('0xb')](),controller[_0x1246('0xf')]);router[_0x1246('0x10')]('/',auth[_0x1246('0xb')](),controller[_0x1246('0x11')]);router[_0x1246('0x12')](_0x1246('0x13'),auth[_0x1246('0xb')](),controller['update']);router[_0x1246('0x14')](_0x1246('0x13'),auth['isAuthenticated'](),controller[_0x1246('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 19d1458..4e6455e 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 _0xafbd=['STRING','BOOLEAN','exports'];(function(_0x589743,_0x604ac1){var _0x41ac38=function(_0x539303){while(--_0x539303){_0x589743['push'](_0x589743['shift']());}};_0x41ac38(++_0x604ac1);}(_0xafbd,0x9e));var _0xdafb=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xafbd[_0x476bf4];return _0x788ffe;};'use strict';var Sequelize=require('sequelize');module[_0xdafb('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xdafb('0x1')]},'function':{'type':Sequelize[_0xdafb('0x1')]},'format':{'type':Sequelize[_0xdafb('0x1')]},'groupBy':{'type':Sequelize[_0xdafb('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xdafb('0x1')]},'custom':{'type':Sequelize[_0xdafb('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x10f0=['STRING','BOOLEAN','exports','TEXT'];(function(_0x2796f5,_0x1e6841){var _0x17632d=function(_0x40f2ee){while(--_0x40f2ee){_0x2796f5['push'](_0x2796f5['shift']());}};_0x17632d(++_0x1e6841);}(_0x10f0,0x11a));var _0x010f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x10f0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x010f('0x0')]={'field':{'type':Sequelize[_0x010f('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x010f('0x2')]},'format':{'type':Sequelize[_0x010f('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x010f('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 8a44fc1..91e0bb9 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 _0xf2a1=['includeAll','body','bulkCreate','find','ids','AnalyticCustomReport','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes'];(function(_0x12a782,_0x3ce187){var _0x57b567=function(_0x5959e8){while(--_0x5959e8){_0x12a782['push'](_0x12a782['shift']());}};_0x57b567(++_0x3ce187);}(_0xf2a1,0x1dd));var _0x1f2a=function(_0x5c71bf,_0x501bfd){_0x5c71bf=_0x5c71bf-0x0;var _0x19b316=_0xf2a1[_0x5c71bf];return _0x19b316;};'use strict';var emlformat=require(_0x1f2a('0x0'));var rimraf=require(_0x1f2a('0x1'));var zipdir=require(_0x1f2a('0x2'));var jsonpatch=require(_0x1f2a('0x3'));var rp=require(_0x1f2a('0x4'));var moment=require(_0x1f2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1f2a('0x6'));var util=require(_0x1f2a('0x7'));var path=require('path');var sox=require(_0x1f2a('0x8'));var csv=require(_0x1f2a('0x9'));var ejs=require(_0x1f2a('0xa'));var fs=require('fs');var fs_extra=require(_0x1f2a('0xb'));var _=require(_0x1f2a('0xc'));var squel=require(_0x1f2a('0xd'));var crypto=require(_0x1f2a('0xe'));var jsforce=require(_0x1f2a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1f2a('0x10'));var Papa=require(_0x1f2a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f2a('0x12'));var as=require(_0x1f2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f2a('0x14'))(_0x1f2a('0x15'));var utils=require('../../config/utils');var config=require(_0x1f2a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f2a('0x17'))['db'];function respondWithStatusCode(_0x2f6055,_0xd39ef8){_0xd39ef8=_0xd39ef8||0xcc;return function(_0x3eb8ee){if(_0x3eb8ee){return _0x2f6055[_0x1f2a('0x18')](_0xd39ef8);}return _0x2f6055[_0x1f2a('0x19')](_0xd39ef8)[_0x1f2a('0x1a')]();};}function respondWithResult(_0x15d716,_0x233e21){_0x233e21=_0x233e21||0xc8;return function(_0x3f7956){if(_0x3f7956){return _0x15d716['status'](_0x233e21)['json'](_0x3f7956);}};}function respondWithFilteredResult(_0x1fab8a,_0x408fbf){return function(_0x18b7ff){if(_0x18b7ff){var _0x3dcbc9=typeof _0x408fbf[_0x1f2a('0x1b')]===_0x1f2a('0x1c')&&typeof _0x408fbf[_0x1f2a('0x1d')]===_0x1f2a('0x1c');var _0x44ada5=_0x18b7ff[_0x1f2a('0x1e')];var _0x4a548f=_0x3dcbc9?0x0:_0x408fbf[_0x1f2a('0x1b')];var _0x4d6953=_0x3dcbc9?_0x18b7ff[_0x1f2a('0x1e')]:_0x408fbf[_0x1f2a('0x1b')]+_0x408fbf[_0x1f2a('0x1d')];var _0x523398;if(_0x4d6953>=_0x44ada5){_0x4d6953=_0x44ada5;_0x523398=0xc8;}else{_0x523398=0xce;}_0x1fab8a[_0x1f2a('0x19')](_0x523398);return _0x1fab8a[_0x1f2a('0x1f')](_0x1f2a('0x20'),_0x4a548f+'-'+_0x4d6953+'/'+_0x44ada5)['json'](_0x18b7ff);}return null;};}function patchUpdates(_0x466107){return function(_0x387399){try{jsonpatch[_0x1f2a('0x21')](_0x387399,_0x466107,!![]);}catch(_0x5b88ce){return BPromise[_0x1f2a('0x22')](_0x5b88ce);}return _0x387399['save']();};}function saveUpdates(_0x9a02ab,_0x55288c){return function(_0x886a74){if(_0x886a74){return _0x886a74[_0x1f2a('0x23')](_0x9a02ab)[_0x1f2a('0x24')](function(_0x1aebce){return _0x1aebce;});}return null;};}function removeEntity(_0x3a63a3,_0x340c5b){return function(_0x6489f0){if(_0x6489f0){return _0x6489f0[_0x1f2a('0x25')]()[_0x1f2a('0x24')](function(){_0x3a63a3['status'](0xcc)[_0x1f2a('0x1a')]();});}};}function handleEntityNotFound(_0x562724,_0x4aad69){return function(_0x129778){if(!_0x129778){_0x562724[_0x1f2a('0x18')](0x194);}return _0x129778;};}function handleError(_0x42c038,_0x1ed45f){_0x1ed45f=_0x1ed45f||0x1f4;return function(_0x38f8fb){logger[_0x1f2a('0x26')](_0x38f8fb[_0x1f2a('0x27')]);if(_0x38f8fb[_0x1f2a('0x28')]){delete _0x38f8fb[_0x1f2a('0x28')];}_0x42c038[_0x1f2a('0x19')](_0x1ed45f)[_0x1f2a('0x29')](_0x38f8fb);};}exports['index']=function(_0x1511f1,_0x528bb7){var _0x1af31f={},_0xcf4d27={},_0x28948d={'count':0x0,'rows':[]};var _0xf5a696=_[_0x1f2a('0x2a')](db[_0x1f2a('0x2b')]['rawAttributes'],function(_0x2eba74){return{'name':_0x2eba74[_0x1f2a('0x2c')],'type':_0x2eba74['type'][_0x1f2a('0x2d')]};});_0xcf4d27[_0x1f2a('0x2e')]=_[_0x1f2a('0x2a')](_0xf5a696,'name');_0xcf4d27[_0x1f2a('0x2f')]=_[_0x1f2a('0x30')](_0x1511f1[_0x1f2a('0x2f')]);_0xcf4d27[_0x1f2a('0x31')]=_[_0x1f2a('0x32')](_0xcf4d27[_0x1f2a('0x2e')],_0xcf4d27[_0x1f2a('0x2f')]);_0x1af31f[_0x1f2a('0x33')]=_['intersection'](_0xcf4d27[_0x1f2a('0x2e')],qs[_0x1f2a('0x34')](_0x1511f1[_0x1f2a('0x2f')]['fields']));_0x1af31f[_0x1f2a('0x33')]=_0x1af31f[_0x1f2a('0x33')][_0x1f2a('0x35')]?_0x1af31f[_0x1f2a('0x33')]:_0xcf4d27['model'];if(!_0x1511f1['query'][_0x1f2a('0x36')](_0x1f2a('0x37'))){_0x1af31f[_0x1f2a('0x1d')]=qs[_0x1f2a('0x1d')](_0x1511f1[_0x1f2a('0x2f')][_0x1f2a('0x1d')]);_0x1af31f[_0x1f2a('0x1b')]=qs[_0x1f2a('0x1b')](_0x1511f1[_0x1f2a('0x2f')][_0x1f2a('0x1b')]);}_0x1af31f[_0x1f2a('0x38')]=qs[_0x1f2a('0x39')](_0x1511f1[_0x1f2a('0x2f')]['sort']);_0x1af31f[_0x1f2a('0x3a')]=qs[_0x1f2a('0x31')](_['pick'](_0x1511f1[_0x1f2a('0x2f')],_0xcf4d27['filters']),_0xf5a696);if(_0x1511f1[_0x1f2a('0x2f')][_0x1f2a('0x3b')]){_0x1af31f[_0x1f2a('0x3a')]=_[_0x1f2a('0x3c')](_0x1af31f[_0x1f2a('0x3a')],{'$or':_['map'](_0xf5a696,function(_0x97f9b2){if(_0x97f9b2['type']!==_0x1f2a('0x3d')){var _0x1e0c74={};_0x1e0c74[_0x97f9b2['name']]={'$like':'%'+_0x1511f1[_0x1f2a('0x2f')]['filter']+'%'};return _0x1e0c74;}})});}_0x1af31f=_[_0x1f2a('0x3c')]({},_0x1af31f,_0x1511f1[_0x1f2a('0x3e')]);var _0x51b0a7={'where':_0x1af31f['where']};return db[_0x1f2a('0x2b')][_0x1f2a('0x1e')](_0x51b0a7)[_0x1f2a('0x24')](function(_0x4ec1aa){_0x28948d[_0x1f2a('0x1e')]=_0x4ec1aa;if(_0x1511f1[_0x1f2a('0x2f')]['includeAll']){_0x1af31f[_0x1f2a('0x3f')]=[{'all':!![]}];}return db[_0x1f2a('0x2b')]['findAll'](_0x1af31f);})[_0x1f2a('0x24')](function(_0x37133b){_0x28948d[_0x1f2a('0x40')]=_0x37133b;return _0x28948d;})[_0x1f2a('0x24')](respondWithFilteredResult(_0x528bb7,_0x1af31f))[_0x1f2a('0x41')](handleError(_0x528bb7,null));};exports[_0x1f2a('0x42')]=function(_0x466fc2,_0x3b4234){var _0x481e1a={'raw':![],'where':{'id':_0x466fc2[_0x1f2a('0x43')]['id']}},_0x2d2704={};_0x2d2704['model']=_[_0x1f2a('0x30')](db[_0x1f2a('0x2b')][_0x1f2a('0x44')]);_0x2d2704['query']=_[_0x1f2a('0x30')](_0x466fc2[_0x1f2a('0x2f')]);_0x2d2704[_0x1f2a('0x31')]=_[_0x1f2a('0x32')](_0x2d2704[_0x1f2a('0x2e')],_0x2d2704['query']);_0x481e1a[_0x1f2a('0x33')]=_['intersection'](_0x2d2704[_0x1f2a('0x2e')],qs[_0x1f2a('0x34')](_0x466fc2[_0x1f2a('0x2f')][_0x1f2a('0x34')]));_0x481e1a[_0x1f2a('0x33')]=_0x481e1a[_0x1f2a('0x33')]['length']?_0x481e1a[_0x1f2a('0x33')]:_0x2d2704[_0x1f2a('0x2e')];if(_0x466fc2[_0x1f2a('0x2f')][_0x1f2a('0x45')]){_0x481e1a[_0x1f2a('0x3f')]=[{'all':!![]}];}_0x481e1a=_[_0x1f2a('0x3c')]({},_0x481e1a,_0x466fc2[_0x1f2a('0x3e')]);return db[_0x1f2a('0x2b')]['find'](_0x481e1a)[_0x1f2a('0x24')](handleEntityNotFound(_0x3b4234,null))[_0x1f2a('0x24')](respondWithResult(_0x3b4234,null))[_0x1f2a('0x41')](handleError(_0x3b4234,null));};exports['create']=function(_0x2e26bd,_0x2679e9){return db['AnalyticFieldReport']['create'](_0x2e26bd[_0x1f2a('0x46')],{})['then'](respondWithResult(_0x2679e9,0xc9))[_0x1f2a('0x41')](handleError(_0x2679e9,null));};exports[_0x1f2a('0x47')]=function(_0x2b5c42,_0x53bff5){return db['AnalyticFieldReport'][_0x1f2a('0x47')](_0x2b5c42[_0x1f2a('0x46')],{'raw':![],'individualHooks':!![]})[_0x1f2a('0x24')](respondWithResult(_0x53bff5,0xc9))[_0x1f2a('0x41')](handleError(_0x53bff5,null));};exports['update']=function(_0x17dfdb,_0x4c9ae9){if(_0x17dfdb['body']['id']){delete _0x17dfdb[_0x1f2a('0x46')]['id'];}return db[_0x1f2a('0x2b')][_0x1f2a('0x48')]({'where':{'id':_0x17dfdb['params']['id']}})['then'](handleEntityNotFound(_0x4c9ae9,null))[_0x1f2a('0x24')](saveUpdates(_0x17dfdb[_0x1f2a('0x46')],null))['then'](respondWithResult(_0x4c9ae9,null))[_0x1f2a('0x41')](handleError(_0x4c9ae9,null));};exports[_0x1f2a('0x25')]=function(_0x357664,_0x59508c){return db[_0x1f2a('0x2b')]['find']({'where':{'id':_0x357664[_0x1f2a('0x43')]['id']}})[_0x1f2a('0x24')](handleEntityNotFound(_0x59508c,null))['then'](removeEntity(_0x59508c,null))[_0x1f2a('0x41')](handleError(_0x59508c,null));};exports['bulkDestroy']=function(_0x125fb8,_0x3d8ea2){return db[_0x1f2a('0x2b')][_0x1f2a('0x25')]({'where':{'id':_0x125fb8[_0x1f2a('0x2f')][_0x1f2a('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x1f2a('0x24')](respondWithResult(_0x3d8ea2,0xcc))[_0x1f2a('0x41')](handleError(_0x3d8ea2,null));};exports['addFields']=function(_0x114806,_0x24cd2a,_0x5c0654){return db[_0x1f2a('0x4a')]['findOne']({'where':{'id':_0x114806[_0x1f2a('0x43')]['id']}})[_0x1f2a('0x24')](handleEntityNotFound(_0x24cd2a,null))[_0x1f2a('0x24')](function(_0x1178e1){if(_0x1178e1){return db['sequelize'][_0x1f2a('0x4b')](function(_0x58f84a){return db[_0x1f2a('0x2b')]['destroy']({'where':{'CustomReportId':_0x114806[_0x1f2a('0x43')]['id']},'transaction':_0x58f84a})[_0x1f2a('0x24')](function(_0x40c193){var _0x2258e7=_['map'](_0x114806['body'],function(_0x198226){delete _0x198226['id'];_0x198226[_0x1f2a('0x4c')]=_0x114806[_0x1f2a('0x43')]['id'];return _0x198226;});return db[_0x1f2a('0x2b')][_0x1f2a('0x47')](_0x2258e7,{'transaction':_0x58f84a});});})['then'](function(){return db['AnalyticFieldReport'][_0x1f2a('0x4d')]({'where':{'CustomReportId':_0x114806['params']['id']}});});}})['then'](respondWithResult(_0x24cd2a,null))['catch'](handleError(_0x24cd2a,null));}; \ No newline at end of file +var _0x2050=['Content-Range','apply','reject','update','destroy','then','error','name','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2050,0x15e));var _0x0205=function(_0x3f5229,_0x360dfa){_0x3f5229=_0x3f5229-0x0;var _0x2fcb29=_0x2050[_0x3f5229];return _0x2fcb29;};'use strict';var emlformat=require(_0x0205('0x0'));var rimraf=require(_0x0205('0x1'));var zipdir=require(_0x0205('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0205('0x3'));var moment=require(_0x0205('0x4'));var BPromise=require(_0x0205('0x5'));var Mustache=require('mustache');var util=require(_0x0205('0x6'));var path=require(_0x0205('0x7'));var sox=require('sox');var csv=require(_0x0205('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0205('0x9'));var _=require(_0x0205('0xa'));var squel=require(_0x0205('0xb'));var crypto=require(_0x0205('0xc'));var jsforce=require(_0x0205('0xd'));var deskjs=require(_0x0205('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0205('0xf'));var Papa=require(_0x0205('0x10'));var Redis=require(_0x0205('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0205('0x12'));var as=require(_0x0205('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0205('0x14'))(_0x0205('0x15'));var utils=require('../../config/utils');var config=require(_0x0205('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0205('0x17'))['db'];function respondWithStatusCode(_0x638030,_0x13e5e4){_0x13e5e4=_0x13e5e4||0xcc;return function(_0x23e38f){if(_0x23e38f){return _0x638030[_0x0205('0x18')](_0x13e5e4);}return _0x638030[_0x0205('0x19')](_0x13e5e4)[_0x0205('0x1a')]();};}function respondWithResult(_0xede146,_0x5c8d8a){_0x5c8d8a=_0x5c8d8a||0xc8;return function(_0x4c4816){if(_0x4c4816){return _0xede146[_0x0205('0x19')](_0x5c8d8a)['json'](_0x4c4816);}};}function respondWithFilteredResult(_0x17e454,_0x1f66c0){return function(_0x376611){if(_0x376611){var _0x412abe=typeof _0x1f66c0['offset']===_0x0205('0x1b')&&typeof _0x1f66c0['limit']===_0x0205('0x1b');var _0xddb3f6=_0x376611[_0x0205('0x1c')];var _0x16af40=_0x412abe?0x0:_0x1f66c0[_0x0205('0x1d')];var _0x40a380=_0x412abe?_0x376611[_0x0205('0x1c')]:_0x1f66c0[_0x0205('0x1d')]+_0x1f66c0['limit'];var _0x147cb3;if(_0x40a380>=_0xddb3f6){_0x40a380=_0xddb3f6;_0x147cb3=0xc8;}else{_0x147cb3=0xce;}_0x17e454[_0x0205('0x19')](_0x147cb3);return _0x17e454['set'](_0x0205('0x1e'),_0x16af40+'-'+_0x40a380+'/'+_0xddb3f6)['json'](_0x376611);}return null;};}function patchUpdates(_0x520f81){return function(_0x342063){try{jsonpatch[_0x0205('0x1f')](_0x342063,_0x520f81,!![]);}catch(_0x5d9ba7){return BPromise[_0x0205('0x20')](_0x5d9ba7);}return _0x342063['save']();};}function saveUpdates(_0x19f880,_0x445b4c){return function(_0x3639fc){if(_0x3639fc){return _0x3639fc[_0x0205('0x21')](_0x19f880)['then'](function(_0x591aed){return _0x591aed;});}return null;};}function removeEntity(_0x29a22f,_0x7bfa64){return function(_0x540c62){if(_0x540c62){return _0x540c62[_0x0205('0x22')]()[_0x0205('0x23')](function(){_0x29a22f[_0x0205('0x19')](0xcc)[_0x0205('0x1a')]();});}};}function handleEntityNotFound(_0x2edc4c,_0x34975d){return function(_0x142c9f){if(!_0x142c9f){_0x2edc4c[_0x0205('0x18')](0x194);}return _0x142c9f;};}function handleError(_0x163089,_0x3f040a){_0x3f040a=_0x3f040a||0x1f4;return function(_0x2417ca){logger[_0x0205('0x24')](_0x2417ca['stack']);if(_0x2417ca[_0x0205('0x25')]){delete _0x2417ca[_0x0205('0x25')];}_0x163089[_0x0205('0x19')](_0x3f040a)['send'](_0x2417ca);};}exports['index']=function(_0x4e0e3f,_0x1460bb){var _0x310ed5={},_0x575679={},_0xf532f2={'count':0x0,'rows':[]};var _0x7c4c02=_['map'](db[_0x0205('0x26')][_0x0205('0x27')],function(_0x34dd74){return{'name':_0x34dd74[_0x0205('0x28')],'type':_0x34dd74[_0x0205('0x29')][_0x0205('0x2a')]};});_0x575679[_0x0205('0x2b')]=_['map'](_0x7c4c02,'name');_0x575679['query']=_[_0x0205('0x2c')](_0x4e0e3f['query']);_0x575679[_0x0205('0x2d')]=_['intersection'](_0x575679[_0x0205('0x2b')],_0x575679[_0x0205('0x2e')]);_0x310ed5[_0x0205('0x2f')]=_['intersection'](_0x575679[_0x0205('0x2b')],qs[_0x0205('0x30')](_0x4e0e3f[_0x0205('0x2e')][_0x0205('0x30')]));_0x310ed5[_0x0205('0x2f')]=_0x310ed5[_0x0205('0x2f')][_0x0205('0x31')]?_0x310ed5[_0x0205('0x2f')]:_0x575679[_0x0205('0x2b')];if(!_0x4e0e3f[_0x0205('0x2e')][_0x0205('0x32')](_0x0205('0x33'))){_0x310ed5[_0x0205('0x34')]=qs[_0x0205('0x34')](_0x4e0e3f[_0x0205('0x2e')][_0x0205('0x34')]);_0x310ed5[_0x0205('0x1d')]=qs[_0x0205('0x1d')](_0x4e0e3f[_0x0205('0x2e')][_0x0205('0x1d')]);}_0x310ed5[_0x0205('0x35')]=qs['sort'](_0x4e0e3f['query']['sort']);_0x310ed5[_0x0205('0x36')]=qs[_0x0205('0x2d')](_[_0x0205('0x37')](_0x4e0e3f[_0x0205('0x2e')],_0x575679[_0x0205('0x2d')]),_0x7c4c02);if(_0x4e0e3f[_0x0205('0x2e')][_0x0205('0x38')]){_0x310ed5['where']=_[_0x0205('0x39')](_0x310ed5['where'],{'$or':_['map'](_0x7c4c02,function(_0x3444d3){if(_0x3444d3[_0x0205('0x29')]!=='VIRTUAL'){var _0x35a570={};_0x35a570[_0x3444d3[_0x0205('0x25')]]={'$like':'%'+_0x4e0e3f[_0x0205('0x2e')][_0x0205('0x38')]+'%'};return _0x35a570;}})});}_0x310ed5=_[_0x0205('0x39')]({},_0x310ed5,_0x4e0e3f[_0x0205('0x3a')]);var _0xcad153={'where':_0x310ed5[_0x0205('0x36')]};return db[_0x0205('0x26')][_0x0205('0x1c')](_0xcad153)[_0x0205('0x23')](function(_0x1bf461){_0xf532f2[_0x0205('0x1c')]=_0x1bf461;if(_0x4e0e3f[_0x0205('0x2e')]['includeAll']){_0x310ed5[_0x0205('0x3b')]=[{'all':!![]}];}return db[_0x0205('0x26')][_0x0205('0x3c')](_0x310ed5);})[_0x0205('0x23')](function(_0x741a15){_0xf532f2[_0x0205('0x3d')]=_0x741a15;return _0xf532f2;})[_0x0205('0x23')](respondWithFilteredResult(_0x1460bb,_0x310ed5))[_0x0205('0x3e')](handleError(_0x1460bb,null));};exports[_0x0205('0x3f')]=function(_0x2ca4e6,_0x2a4b88){var _0x112276={'raw':![],'where':{'id':_0x2ca4e6[_0x0205('0x40')]['id']}},_0x5d0e00={};_0x5d0e00['model']=_[_0x0205('0x2c')](db[_0x0205('0x26')]['rawAttributes']);_0x5d0e00['query']=_[_0x0205('0x2c')](_0x2ca4e6[_0x0205('0x2e')]);_0x5d0e00['filters']=_[_0x0205('0x41')](_0x5d0e00[_0x0205('0x2b')],_0x5d0e00['query']);_0x112276[_0x0205('0x2f')]=_[_0x0205('0x41')](_0x5d0e00[_0x0205('0x2b')],qs[_0x0205('0x30')](_0x2ca4e6[_0x0205('0x2e')][_0x0205('0x30')]));_0x112276[_0x0205('0x2f')]=_0x112276[_0x0205('0x2f')][_0x0205('0x31')]?_0x112276[_0x0205('0x2f')]:_0x5d0e00[_0x0205('0x2b')];if(_0x2ca4e6[_0x0205('0x2e')][_0x0205('0x42')]){_0x112276[_0x0205('0x3b')]=[{'all':!![]}];}_0x112276=_['merge']({},_0x112276,_0x2ca4e6['options']);return db[_0x0205('0x26')][_0x0205('0x43')](_0x112276)[_0x0205('0x23')](handleEntityNotFound(_0x2a4b88,null))[_0x0205('0x23')](respondWithResult(_0x2a4b88,null))[_0x0205('0x3e')](handleError(_0x2a4b88,null));};exports[_0x0205('0x44')]=function(_0x15abd7,_0x194581){return db[_0x0205('0x26')][_0x0205('0x44')](_0x15abd7[_0x0205('0x45')],{})[_0x0205('0x23')](respondWithResult(_0x194581,0xc9))[_0x0205('0x3e')](handleError(_0x194581,null));};exports[_0x0205('0x46')]=function(_0x182d18,_0x174b89){return db[_0x0205('0x26')][_0x0205('0x46')](_0x182d18[_0x0205('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x174b89,0xc9))[_0x0205('0x3e')](handleError(_0x174b89,null));};exports[_0x0205('0x21')]=function(_0x2fa193,_0x52462c){if(_0x2fa193[_0x0205('0x45')]['id']){delete _0x2fa193[_0x0205('0x45')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x2fa193[_0x0205('0x40')]['id']}})[_0x0205('0x23')](handleEntityNotFound(_0x52462c,null))[_0x0205('0x23')](saveUpdates(_0x2fa193[_0x0205('0x45')],null))[_0x0205('0x23')](respondWithResult(_0x52462c,null))[_0x0205('0x3e')](handleError(_0x52462c,null));};exports[_0x0205('0x22')]=function(_0x351a1d,_0x29e8d8){return db['AnalyticFieldReport'][_0x0205('0x43')]({'where':{'id':_0x351a1d[_0x0205('0x40')]['id']}})[_0x0205('0x23')](handleEntityNotFound(_0x29e8d8,null))[_0x0205('0x23')](removeEntity(_0x29e8d8,null))['catch'](handleError(_0x29e8d8,null));};exports[_0x0205('0x47')]=function(_0x63f6fb,_0x1db79c){return db[_0x0205('0x26')]['destroy']({'where':{'id':_0x63f6fb[_0x0205('0x2e')][_0x0205('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1db79c,0xcc))[_0x0205('0x3e')](handleError(_0x1db79c,null));};exports[_0x0205('0x49')]=function(_0x4fe0b2,_0x3a4ab3,_0xeddab5){return db[_0x0205('0x4a')]['findOne']({'where':{'id':_0x4fe0b2[_0x0205('0x40')]['id']}})[_0x0205('0x23')](handleEntityNotFound(_0x3a4ab3,null))[_0x0205('0x23')](function(_0x307b3d){if(_0x307b3d){return db[_0x0205('0x4b')]['transaction'](function(_0x43397e){return db['AnalyticFieldReport'][_0x0205('0x22')]({'where':{'CustomReportId':_0x4fe0b2[_0x0205('0x40')]['id']},'transaction':_0x43397e})[_0x0205('0x23')](function(_0x185b1e){var _0x4e0f76=_['map'](_0x4fe0b2['body'],function(_0x34ccc1){delete _0x34ccc1['id'];_0x34ccc1['CustomReportId']=_0x4fe0b2[_0x0205('0x40')]['id'];return _0x34ccc1;});return db[_0x0205('0x26')][_0x0205('0x46')](_0x4e0f76,{'transaction':_0x43397e});});})[_0x0205('0x23')](function(){return db[_0x0205('0x26')][_0x0205('0x3c')]({'where':{'CustomReportId':_0x4fe0b2[_0x0205('0x40')]['id']}});});}})[_0x0205('0x23')](respondWithResult(_0x3a4ab3,null))['catch'](handleError(_0x3a4ab3,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3a03305..4ca080b 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 _0x337b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x337b,0x1d2));var _0xb337=function(_0x5eee8b,_0x53af12){_0x5eee8b=_0x5eee8b-0x0;var _0x1cc3d1=_0x337b[_0x5eee8b];return _0x1cc3d1;};'use strict';var _=require(_0xb337('0x0'));var util=require(_0xb337('0x1'));var logger=require(_0xb337('0x2'))('api');var moment=require(_0xb337('0x3'));var BPromise=require(_0xb337('0x4'));var rp=require(_0xb337('0x5'));var fs=require('fs');var path=require(_0xb337('0x6'));var rimraf=require(_0xb337('0x7'));var config=require(_0xb337('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0xb337('0x9')]=function(_0xed119a,_0x29025d){return _0xed119a[_0xb337('0xa')](_0xb337('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f61=['util','api','bluebird','request-promise','path','../../config/environment','exports','define','analytics_report_fields','lodash'];(function(_0x423e39,_0x25445e){var _0x4eb87a=function(_0x198fec){while(--_0x198fec){_0x423e39['push'](_0x423e39['shift']());}};_0x4eb87a(++_0x25445e);}(_0x4f61,0xb3));var _0x14f6=function(_0x46142d,_0x4114f9){_0x46142d=_0x46142d-0x0;var _0x14cea9=_0x4f61[_0x46142d];return _0x14cea9;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var logger=require('../../config/logger')(_0x14f6('0x2'));var moment=require('moment');var BPromise=require(_0x14f6('0x3'));var rp=require(_0x14f6('0x4'));var fs=require('fs');var path=require(_0x14f6('0x5'));var rimraf=require('rimraf');var config=require(_0x14f6('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x14f6('0x7')]=function(_0x4aeca3,_0x88261c){return _0x4aeca3[_0x14f6('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x14f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 21c2d10..11ab91e 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 _0xc2e2=['code','message','info','result','catch','util','moment','ioredis','rpc','../../config/environment','client','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e6c5a,_0x5eabdf){var _0x1c5215=function(_0xfdb779){while(--_0xfdb779){_0x3e6c5a['push'](_0x3e6c5a['shift']());}};_0x1c5215(++_0x5eabdf);}(_0xc2e2,0x194));var _0x2c2e=function(_0x4922ea,_0x2b16c6){_0x4922ea=_0x4922ea-0x0;var _0x5785f9=_0xc2e2[_0x4922ea];return _0x5785f9;};'use strict';var _=require('lodash');var util=require(_0x2c2e('0x0'));var moment=require(_0x2c2e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c2e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c2e('0x3'));var config=require(_0x2c2e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2c2e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55e1f4,_0x140348,_0x15ec0f){return new BPromise(function(_0x1b7982,_0x17d7ef){return client[_0x2c2e('0x6')](_0x55e1f4,_0x15ec0f)[_0x2c2e('0x7')](function(_0x129ed6){logger['info'](_0x2c2e('0x8'),_0x140348,_0x2c2e('0x9'));logger[_0x2c2e('0xa')](_0x2c2e('0xb'),_0x140348,_0x2c2e('0x9'),JSON[_0x2c2e('0xc')](_0x129ed6));if(_0x129ed6[_0x2c2e('0xd')]){if(_0x129ed6[_0x2c2e('0xd')][_0x2c2e('0xe')]===0x1f4){logger['error'](_0x2c2e('0x8'),_0x140348,_0x129ed6[_0x2c2e('0xd')]['message']);return _0x17d7ef(_0x129ed6['error']['message']);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x140348,_0x129ed6[_0x2c2e('0xd')][_0x2c2e('0xf')]);return _0x1b7982(_0x129ed6[_0x2c2e('0xd')][_0x2c2e('0xf')]);}else{logger[_0x2c2e('0x10')](_0x2c2e('0x8'),_0x140348,_0x2c2e('0x9'));_0x1b7982(_0x129ed6[_0x2c2e('0x11')][_0x2c2e('0xf')]);}})[_0x2c2e('0x12')](function(_0x2f4ecf){logger[_0x2c2e('0xd')](_0x2c2e('0x8'),_0x140348,_0x2f4ecf);_0x17d7ef(_0x2f4ecf);});});} \ No newline at end of file +var _0x9177=['client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3df550,_0x5ecd0d){var _0x3e6ffd=function(_0x1c7adb){while(--_0x1c7adb){_0x3df550['push'](_0x3df550['shift']());}};_0x3e6ffd(++_0x5ecd0d);}(_0x9177,0xe7));var _0x7917=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x9177[_0x4ee9cd];return _0x328a5b;};'use strict';var _=require('lodash');var util=require(_0x7917('0x0'));var moment=require(_0x7917('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7917('0x2'));var db=require(_0x7917('0x3'))['db'];var utils=require(_0x7917('0x4'));var logger=require(_0x7917('0x5'))(_0x7917('0x6'));var config=require(_0x7917('0x7'));var jayson=require(_0x7917('0x8'));var client=jayson[_0x7917('0x9')][_0x7917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539afe,_0x5cb4d0,_0x344f95){return new BPromise(function(_0x3ac655,_0x541a61){return client['request'](_0x539afe,_0x344f95)[_0x7917('0xb')](function(_0x4f35b4){logger[_0x7917('0xc')](_0x7917('0xd'),_0x5cb4d0,_0x7917('0xe'));logger['debug'](_0x7917('0xf'),_0x5cb4d0,'request\x20sent',JSON['stringify'](_0x4f35b4));if(_0x4f35b4['error']){if(_0x4f35b4[_0x7917('0x10')]['code']===0x1f4){logger['error'](_0x7917('0xd'),_0x5cb4d0,_0x4f35b4[_0x7917('0x10')][_0x7917('0x11')]);return _0x541a61(_0x4f35b4['error']['message']);}logger[_0x7917('0x10')](_0x7917('0xd'),_0x5cb4d0,_0x4f35b4[_0x7917('0x10')][_0x7917('0x11')]);return _0x3ac655(_0x4f35b4[_0x7917('0x10')][_0x7917('0x11')]);}else{logger['info'](_0x7917('0xd'),_0x5cb4d0,_0x7917('0xe'));_0x3ac655(_0x4f35b4[_0x7917('0x12')][_0x7917('0x11')]);}})[_0x7917('0x13')](function(_0x113ba3){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5cb4d0,_0x113ba3);_0x541a61(_0x113ba3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9f89d2d..bbd521d 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(_0x33ae55,_0x14989b){var _0x182a50=function(_0x131e60){while(--_0x131e60){_0x33ae55['push'](_0x33ae55['shift']());}};_0x182a50(++_0x14989b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x51d0c8,_0x424307){var _0x9cc64c=function(_0x25af2e){while(--_0x25af2e){_0x51d0c8['push'](_0x51d0c8['shift']());}};_0x9cc64c(++_0x424307);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 cb12019..3969b83 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 _0x9e0d=['name','TEXT','sequelize','exports','STRING'];(function(_0x4c02dd,_0x4f427e){var _0x42a36d=function(_0x593bcc){while(--_0x593bcc){_0x4c02dd['push'](_0x4c02dd['shift']());}};_0x42a36d(++_0x4f427e);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x492b13,_0x4c39fa){_0x492b13=_0x492b13-0x0;var _0x3f6508=_0x9e0d[_0x492b13];return _0x3f6508;};'use strict';var Sequelize=require(_0xd9e0('0x0'));module[_0xd9e0('0x1')]={'name':{'type':Sequelize[_0xd9e0('0x2')],'allowNull':![],'unique':_0xd9e0('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd9e0('0x4')]},'description':{'type':Sequelize[_0xd9e0('0x2')]}}; \ No newline at end of file +var _0x594d=['STRING','TEXT','sequelize','name'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x594d,0x92));var _0xd594=function(_0x56f215,_0x391360){_0x56f215=_0x56f215-0x0;var _0x68e039=_0x594d[_0x56f215];return _0x68e039;};'use strict';var Sequelize=require(_0xd594('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd594('0x1')},'table':{'type':Sequelize[_0xd594('0x2')]},'metric':{'type':Sequelize[_0xd594('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fec7b02..80e99e8 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 _0xa41a=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','send','map','AnalyticMetric','type','key','model','query','keys','intersection','fields'];(function(_0x1132a5,_0x22a6a2){var _0x53b53e=function(_0x1a582f){while(--_0x1a582f){_0x1132a5['push'](_0x1132a5['shift']());}};_0x53b53e(++_0x22a6a2);}(_0xa41a,0x6b));var _0xaa41=function(_0x514879,_0x548f62){_0x514879=_0x514879-0x0;var _0x4e0e68=_0xa41a[_0x514879];return _0x4e0e68;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){var _0x5c3074=_0x21f596['get']({'plain':!![]});var _0x16aec5='Metrics';return db['UserProfileResource'][_0xaa41('0x24')]({'where':{'type':_0x16aec5,'resourceId':_0x5c3074['id']}})['then'](function(){return _0x21f596;});})['then'](function(){_0x43a85c[_0xaa41('0x1a')](0xcc)[_0xaa41('0x1b')]();});}};}function handleEntityNotFound(_0x392214,_0x632fd2){return function(_0x3f5272){if(!_0x3f5272){_0x392214[_0xaa41('0x19')](0x194);}return _0x3f5272;};}function handleError(_0x57ef96,_0x30a174){_0x30a174=_0x30a174||0x1f4;return function(_0x1f0275){logger[_0xaa41('0x26')](_0x1f0275[_0xaa41('0x27')]);if(_0x1f0275[_0xaa41('0x28')]){delete _0x1f0275[_0xaa41('0x28')];}_0x57ef96[_0xaa41('0x1a')](_0x30a174)[_0xaa41('0x29')](_0x1f0275);};}exports['index']=function(_0x377add,_0x48b48b){var _0x5dad80={},_0x714537={},_0x1176bd={'count':0x0,'rows':[]};var _0x534a85=_[_0xaa41('0x2a')](db[_0xaa41('0x2b')]['rawAttributes'],function(_0x5022fb){return{'name':_0x5022fb['fieldName'],'type':_0x5022fb[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x714537[_0xaa41('0x2e')]=_[_0xaa41('0x2a')](_0x534a85,'name');_0x714537[_0xaa41('0x2f')]=_[_0xaa41('0x30')](_0x377add[_0xaa41('0x2f')]);_0x714537['filters']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],_0x714537[_0xaa41('0x2f')]);_0x5dad80['attributes']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],qs['fields'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x5dad80[_0xaa41('0x33')]=_0x5dad80['attributes'][_0xaa41('0x34')]?_0x5dad80['attributes']:_0x714537[_0xaa41('0x2e')];if(!_0x377add[_0xaa41('0x2f')][_0xaa41('0x35')]('nolimit')){_0x5dad80['limit']=qs['limit'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x1e')]);_0x5dad80[_0xaa41('0x20')]=qs[_0xaa41('0x20')](_0x377add['query']['offset']);}_0x5dad80[_0xaa41('0x36')]=qs[_0xaa41('0x37')](_0x377add[_0xaa41('0x2f')][_0xaa41('0x37')]);_0x5dad80[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_[_0xaa41('0x3a')](_0x377add['query'],_0x714537[_0xaa41('0x39')]),_0x534a85);if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]){_0x5dad80[_0xaa41('0x38')]=_['merge'](_0x5dad80['where'],{'$or':_[_0xaa41('0x2a')](_0x534a85,function(_0x275fa3){if(_0x275fa3['type']!==_0xaa41('0x3c')){var _0x563687={};_0x563687[_0x275fa3[_0xaa41('0x28')]]={'$like':'%'+_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]+'%'};return _0x563687;}})});}_0x5dad80=_[_0xaa41('0x3d')]({},_0x5dad80,_0x377add[_0xaa41('0x3e')]);var _0x12ba1a={'where':_0x5dad80[_0xaa41('0x38')]};return db[_0xaa41('0x2b')]['count'](_0x12ba1a)[_0xaa41('0x25')](function(_0x2abf39){_0x1176bd[_0xaa41('0x1f')]=_0x2abf39;if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x5dad80[_0xaa41('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5dad80);})[_0xaa41('0x25')](function(_0x4f9086){_0x1176bd[_0xaa41('0x41')]=_0x4f9086;return _0x1176bd;})[_0xaa41('0x25')](respondWithFilteredResult(_0x48b48b,_0x5dad80))[_0xaa41('0x42')](handleError(_0x48b48b,null));};exports[_0xaa41('0x43')]=function(_0x2aac10,_0x10bf09){var _0x2db8d6={'raw':!![],'where':{'id':_0x2aac10[_0xaa41('0x44')]['id']}},_0x5ee74c={};_0x5ee74c['model']=_['keys'](db[_0xaa41('0x2b')]['rawAttributes']);_0x5ee74c['query']=_['keys'](_0x2aac10[_0xaa41('0x2f')]);_0x5ee74c['filters']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],_0x5ee74c['query']);_0x2db8d6['attributes']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],qs[_0xaa41('0x32')](_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x2db8d6[_0xaa41('0x33')]=_0x2db8d6[_0xaa41('0x33')][_0xaa41('0x34')]?_0x2db8d6[_0xaa41('0x33')]:_0x5ee74c['model'];if(_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x2db8d6[_0xaa41('0x40')]=[{'all':!![]}];}_0x2db8d6=_[_0xaa41('0x3d')]({},_0x2db8d6,_0x2aac10[_0xaa41('0x3e')]);return db[_0xaa41('0x2b')]['find'](_0x2db8d6)[_0xaa41('0x25')](handleEntityNotFound(_0x10bf09,null))[_0xaa41('0x25')](respondWithResult(_0x10bf09,null))[_0xaa41('0x42')](handleError(_0x10bf09,null));};exports[_0xaa41('0x45')]=function(_0x57d1f6,_0x23bc61){return db['AnalyticMetric']['create'](_0x57d1f6[_0xaa41('0x46')],{})[_0xaa41('0x25')](function(_0x3e16ef){var _0x4ca114=_0x57d1f6[_0xaa41('0x47')][_0xaa41('0x48')]({'plain':!![]});if(!_0x4ca114)throw new Error(_0xaa41('0x49'));if(_0x4ca114['role']===_0xaa41('0x47')){var _0x3c4f24=_0x3e16ef[_0xaa41('0x48')]({'plain':!![]});var _0x1378f9=_0xaa41('0x4a');return db[_0xaa41('0x4b')][_0xaa41('0x4c')]({'where':{'name':_0x1378f9,'userProfileId':_0x4ca114[_0xaa41('0x4d')]},'raw':!![]})['then'](function(_0x9f0a81){if(_0x9f0a81&&_0x9f0a81['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x45')]({'name':_0x3c4f24[_0xaa41('0x28')],'resourceId':_0x3c4f24['id'],'type':_0x9f0a81[_0xaa41('0x28')],'sectionId':_0x9f0a81['id']},{})[_0xaa41('0x25')](function(){return _0x3e16ef;});}else{return _0x3e16ef;}})[_0xaa41('0x42')](function(_0x288db3){logger[_0xaa41('0x26')](_0xaa41('0x4e'),_0x288db3);throw _0x288db3;});}return _0x3e16ef;})['then'](respondWithResult(_0x23bc61,0xc9))[_0xaa41('0x42')](handleError(_0x23bc61,null));};exports[_0xaa41('0x23')]=function(_0x1d518f,_0x4f9e92){if(_0x1d518f[_0xaa41('0x46')]['id']){delete _0x1d518f[_0xaa41('0x46')]['id'];}return db['AnalyticMetric'][_0xaa41('0x4c')]({'where':{'id':_0x1d518f[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x4f9e92,null))['then'](saveUpdates(_0x1d518f[_0xaa41('0x46')],null))[_0xaa41('0x25')](respondWithResult(_0x4f9e92,null))['catch'](handleError(_0x4f9e92,null));};exports['destroy']=function(_0x3745ed,_0x3cd14f){return db[_0xaa41('0x2b')]['find']({'where':{'id':_0x3745ed[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x3cd14f,null))[_0xaa41('0x25')](removeEntity(_0x3cd14f,null))[_0xaa41('0x42')](handleError(_0x3cd14f,null));}; \ No newline at end of file +var _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x31fb35,_0x1854f8){var _0x5cad7a=function(_0x3ce198){while(--_0x3ce198){_0x31fb35['push'](_0x31fb35['shift']());}};_0x5cad7a(++_0x1854f8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5e866a,_0x536f8a){_0x5e866a=_0x5e866a-0x0;var _0x3e10a1=_0xdbf5[_0x5e866a];return _0x3e10a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index bb01eac..5ee800d 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 _0xa1f6=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','exports'];(function(_0x4afd2c,_0x5d6800){var _0x33074e=function(_0x1045d0){while(--_0x1045d0){_0x4afd2c['push'](_0x4afd2c['shift']());}};_0x33074e(++_0x5d6800);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0xa1f6[_0x4c2f17];return _0x20919e;};'use strict';var _=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var logger=require(_0x6a1f('0x2'))(_0x6a1f('0x3'));var moment=require(_0x6a1f('0x4'));var BPromise=require(_0x6a1f('0x5'));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('./analyticMetric.attributes');module[_0x6a1f('0x6')]=function(_0x426ae1,_0xa1c928){return _0x426ae1[_0x6a1f('0x7')](_0x6a1f('0x8'),attributes,{'tableName':_0x6a1f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf483=['api','moment','bluebird','request-promise','path','rimraf','AnalyticMetric','analytics_metrics','util'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xf483,0xf2));var _0x3f48=function(_0x4263c6,_0x239009){_0x4263c6=_0x4263c6-0x0;var _0x47b675=_0xf483[_0x4263c6];return _0x47b675;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var logger=require('../../config/logger')(_0x3f48('0x1'));var moment=require(_0x3f48('0x2'));var BPromise=require(_0x3f48('0x3'));var rp=require(_0x3f48('0x4'));var fs=require('fs');var path=require(_0x3f48('0x5'));var rimraf=require(_0x3f48('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x1a3447,_0x16905e){return _0x1a3447['define'](_0x3f48('0x7'),attributes,{'tableName':_0x3f48('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index d0f32b0..132c088 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 _0xdbc9=['then','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x2ac368,_0x53a579){var _0x22e9f7=function(_0x517d19){while(--_0x517d19){_0x2ac368['push'](_0x2ac368['shift']());}};_0x22e9f7(++_0x53a579);}(_0xdbc9,0x1d6));var _0x9dbc=function(_0x33b1ff,_0x383ab4){_0x33b1ff=_0x33b1ff-0x0;var _0x5d6e19=_0xdbc9[_0x33b1ff];return _0x5d6e19;};'use strict';var _=require(_0x9dbc('0x0'));var util=require(_0x9dbc('0x1'));var moment=require(_0x9dbc('0x2'));var BPromise=require(_0x9dbc('0x3'));var rs=require(_0x9dbc('0x4'));var fs=require('fs');var Redis=require(_0x9dbc('0x5'));var db=require(_0x9dbc('0x6'))['db'];var utils=require(_0x9dbc('0x7'));var logger=require(_0x9dbc('0x8'))('rpc');var config=require(_0x9dbc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9dbc('0xa')][_0x9dbc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5a4b,_0x1463c2,_0xbbe283){return new BPromise(function(_0x5e27fe,_0x25aabb){return client[_0x9dbc('0xc')](_0x1d5a4b,_0xbbe283)[_0x9dbc('0xd')](function(_0x3c1dde){logger[_0x9dbc('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1463c2,_0x9dbc('0xf'));logger[_0x9dbc('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1463c2,_0x9dbc('0xf'),JSON[_0x9dbc('0x11')](_0x3c1dde));if(_0x3c1dde['error']){if(_0x3c1dde[_0x9dbc('0x12')][_0x9dbc('0x13')]===0x1f4){logger[_0x9dbc('0x12')](_0x9dbc('0x14'),_0x1463c2,_0x3c1dde[_0x9dbc('0x12')][_0x9dbc('0x15')]);return _0x25aabb(_0x3c1dde[_0x9dbc('0x12')][_0x9dbc('0x15')]);}logger[_0x9dbc('0x12')](_0x9dbc('0x14'),_0x1463c2,_0x3c1dde[_0x9dbc('0x12')][_0x9dbc('0x15')]);return _0x5e27fe(_0x3c1dde[_0x9dbc('0x12')][_0x9dbc('0x15')]);}else{logger[_0x9dbc('0xe')](_0x9dbc('0x14'),_0x1463c2,_0x9dbc('0xf'));_0x5e27fe(_0x3c1dde['result'][_0x9dbc('0x15')]);}})[_0x9dbc('0x16')](function(_0xd8851e){logger[_0x9dbc('0x12')](_0x9dbc('0x14'),_0x1463c2,_0xd8851e);_0x25aabb(_0xd8851e);});});} \ No newline at end of file +var _0xc8e4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment'];(function(_0x5b0207,_0x251750){var _0x9cdd39=function(_0x5f98b2){while(--_0x5f98b2){_0x5b0207['push'](_0x5b0207['shift']());}};_0x9cdd39(++_0x251750);}(_0xc8e4,0x1e0));var _0x4c8e=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xc8e4[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x4c8e('0x0'));var util=require(_0x4c8e('0x1'));var moment=require(_0x4c8e('0x2'));var BPromise=require(_0x4c8e('0x3'));var rs=require(_0x4c8e('0x4'));var fs=require('fs');var Redis=require(_0x4c8e('0x5'));var db=require(_0x4c8e('0x6'))['db'];var utils=require(_0x4c8e('0x7'));var logger=require('../../config/logger')(_0x4c8e('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c8e('0x9'));var client=jayson[_0x4c8e('0xa')][_0x4c8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x490228,_0x35eecc,_0x477b64){return new BPromise(function(_0x3cb1da,_0x248ca2){return client[_0x4c8e('0xc')](_0x490228,_0x477b64)[_0x4c8e('0xd')](function(_0x570f32){logger[_0x4c8e('0xe')](_0x4c8e('0xf'),_0x35eecc,_0x4c8e('0x10'));logger[_0x4c8e('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x35eecc,_0x4c8e('0x10'),JSON['stringify'](_0x570f32));if(_0x570f32[_0x4c8e('0x12')]){if(_0x570f32[_0x4c8e('0x12')][_0x4c8e('0x13')]===0x1f4){logger[_0x4c8e('0x12')](_0x4c8e('0xf'),_0x35eecc,_0x570f32['error'][_0x4c8e('0x14')]);return _0x248ca2(_0x570f32[_0x4c8e('0x12')][_0x4c8e('0x14')]);}logger['error'](_0x4c8e('0xf'),_0x35eecc,_0x570f32[_0x4c8e('0x12')][_0x4c8e('0x14')]);return _0x3cb1da(_0x570f32[_0x4c8e('0x12')][_0x4c8e('0x14')]);}else{logger['info'](_0x4c8e('0xf'),_0x35eecc,_0x4c8e('0x10'));_0x3cb1da(_0x570f32[_0x4c8e('0x15')]['message']);}})[_0x4c8e('0x16')](function(_0x794f11){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x35eecc,_0x794f11);_0x248ca2(_0x794f11);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d61a48a..7808c09 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 _0x2159=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x45158b,_0x27eae9){var _0x21cf31=function(_0x57798b){while(--_0x57798b){_0x45158b['push'](_0x45158b['shift']());}};_0x21cf31(++_0x27eae9);}(_0x2159,0x17f));var _0x9215=function(_0x51f67c,_0x1977ec){_0x51f67c=_0x51f67c-0x0;var _0x3888c5=_0x2159[_0x51f67c];return _0x3888c5;};'use strict';var multer=require(_0x9215('0x0'));var util=require(_0x9215('0x1'));var path=require(_0x9215('0x2'));var timeout=require(_0x9215('0x3'));var express=require('express');var router=express[_0x9215('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9215('0x5'));var interaction=require(_0x9215('0x6'));var config=require(_0x9215('0x7'));var controller=require(_0x9215('0x8'));router[_0x9215('0x9')]('/',auth[_0x9215('0xa')](),controller[_0x9215('0xb')]);router[_0x9215('0x9')]('/:id',auth[_0x9215('0xa')](),controller[_0x9215('0xc')]);router[_0x9215('0xd')]('/',auth[_0x9215('0xa')](),controller[_0x9215('0xe')]);router['put'](_0x9215('0xf'),auth[_0x9215('0xa')](),controller[_0x9215('0x10')]);router[_0x9215('0x11')]('/:id',auth[_0x9215('0xa')](),controller[_0x9215('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd3e3=['post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2365a0,_0x4c1e17){var _0x1a5ce9=function(_0x35841d){while(--_0x35841d){_0x2365a0['push'](_0x2365a0['shift']());}};_0x1a5ce9(++_0x4c1e17);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x27fdae,_0x45daa8){_0x27fdae=_0x27fdae-0x0;var _0x165d1e=_0xd3e3[_0x27fdae];return _0x165d1e;};'use strict';var multer=require(_0x3d3e('0x0'));var util=require(_0x3d3e('0x1'));var path=require(_0x3d3e('0x2'));var timeout=require(_0x3d3e('0x3'));var express=require('express');var router=express[_0x3d3e('0x4')]();var fs_extra=require(_0x3d3e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d3e('0x6'));var config=require(_0x3d3e('0x7'));var controller=require('./analyticMetric.controller');router[_0x3d3e('0x8')]('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xa')]);router[_0x3d3e('0x8')](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0xc')]);router[_0x3d3e('0xd')]('/',auth[_0x3d3e('0x9')](),controller['create']);router[_0x3d3e('0xe')](_0x3d3e('0xb'),auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xf')]);router['delete'](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0x10')]);module[_0x3d3e('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index d9e882c..cfcb2d8 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 _0x1fc5=['exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1fc5,0x98));var _0x51fc=function(_0x5585f9,_0x492ef7){_0x5585f9=_0x5585f9-0x0;var _0x25cd7b=_0x1fc5[_0x5585f9];return _0x25cd7b;};'use strict';var Sequelize=require('sequelize');module[_0x51fc('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xfbf9=['exports','TEXT'];(function(_0x1f3c2a,_0xb2ee90){var _0x2cbce9=function(_0x1ba35c){while(--_0x1ba35c){_0x1f3c2a['push'](_0x1f3c2a['shift']());}};_0x2cbce9(++_0xb2ee90);}(_0xfbf9,0x138));var _0x9fbf=function(_0x1b48cd,_0x4e1a55){_0x1b48cd=_0x1b48cd-0x0;var _0x11a3c8=_0xfbf9[_0x1b48cd];return _0x11a3c8;};'use strict';var Sequelize=require('sequelize');module[_0x9fbf('0x0')]={'tree':{'type':Sequelize[_0x9fbf('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 4f952fc..4b860db 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 _0xdc36=['length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','AnalyticTreeReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes'];(function(_0x31ef43,_0x401a87){var _0x3f9960=function(_0x12b57e){while(--_0x12b57e){_0x31ef43['push'](_0x31ef43['shift']());}};_0x3f9960(++_0x401a87);}(_0xdc36,0xee));var _0x6dc3=function(_0x434392,_0x548f1d){_0x434392=_0x434392-0x0;var _0x113261=_0xdc36[_0x434392];return _0x113261;};'use strict';var emlformat=require(_0x6dc3('0x0'));var rimraf=require(_0x6dc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dc3('0x2'));var rp=require(_0x6dc3('0x3'));var moment=require('moment');var BPromise=require(_0x6dc3('0x4'));var Mustache=require(_0x6dc3('0x5'));var util=require('util');var path=require(_0x6dc3('0x6'));var sox=require(_0x6dc3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dc3('0x8'));var squel=require(_0x6dc3('0x9'));var crypto=require(_0x6dc3('0xa'));var jsforce=require(_0x6dc3('0xb'));var deskjs=require(_0x6dc3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6dc3('0xd'));var Redis=require(_0x6dc3('0xe'));var authService=require(_0x6dc3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6dc3('0x10'));var hardwareService=require(_0x6dc3('0x11'));var logger=require(_0x6dc3('0x12'))(_0x6dc3('0x13'));var utils=require(_0x6dc3('0x14'));var config=require(_0x6dc3('0x15'));var licenseUtil=require(_0x6dc3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498ee5,_0x5d124e){_0x5d124e=_0x5d124e||0xcc;return function(_0xcfb607){if(_0xcfb607){return _0x498ee5['sendStatus'](_0x5d124e);}return _0x498ee5['status'](_0x5d124e)['end']();};}function respondWithResult(_0x5804ca,_0x364a1c){_0x364a1c=_0x364a1c||0xc8;return function(_0x52deca){if(_0x52deca){return _0x5804ca[_0x6dc3('0x17')](_0x364a1c)[_0x6dc3('0x18')](_0x52deca);}};}function respondWithFilteredResult(_0x16dafe,_0x3a63f6){return function(_0x457621){if(_0x457621){var _0x584654=typeof _0x3a63f6[_0x6dc3('0x19')]===_0x6dc3('0x1a')&&typeof _0x3a63f6['limit']===_0x6dc3('0x1a');var _0x8f7b1f=_0x457621[_0x6dc3('0x1b')];var _0x68a4de=_0x584654?0x0:_0x3a63f6[_0x6dc3('0x19')];var _0xca02ec=_0x584654?_0x457621[_0x6dc3('0x1b')]:_0x3a63f6[_0x6dc3('0x19')]+_0x3a63f6[_0x6dc3('0x1c')];var _0xe148f7;if(_0xca02ec>=_0x8f7b1f){_0xca02ec=_0x8f7b1f;_0xe148f7=0xc8;}else{_0xe148f7=0xce;}_0x16dafe[_0x6dc3('0x17')](_0xe148f7);return _0x16dafe[_0x6dc3('0x1d')](_0x6dc3('0x1e'),_0x68a4de+'-'+_0xca02ec+'/'+_0x8f7b1f)[_0x6dc3('0x18')](_0x457621);}return null;};}function patchUpdates(_0x5c628){return function(_0x213cdf){try{jsonpatch['apply'](_0x213cdf,_0x5c628,!![]);}catch(_0x55469b){return BPromise[_0x6dc3('0x1f')](_0x55469b);}return _0x213cdf[_0x6dc3('0x20')]();};}function saveUpdates(_0x1631ce,_0x3658a7){return function(_0x504d70){if(_0x504d70){return _0x504d70[_0x6dc3('0x21')](_0x1631ce)[_0x6dc3('0x22')](function(_0x4efc4a){return _0x4efc4a;});}return null;};}function removeEntity(_0x33f682,_0x8f2512){return function(_0x452e17){if(_0x452e17){return _0x452e17[_0x6dc3('0x23')]()['then'](function(){_0x33f682[_0x6dc3('0x17')](0xcc)[_0x6dc3('0x24')]();});}};}function handleEntityNotFound(_0x4a2a0a,_0x3a118a){return function(_0x28cedc){if(!_0x28cedc){_0x4a2a0a[_0x6dc3('0x25')](0x194);}return _0x28cedc;};}function handleError(_0x21eaed,_0x549407){_0x549407=_0x549407||0x1f4;return function(_0x235be2){logger[_0x6dc3('0x26')](_0x235be2[_0x6dc3('0x27')]);if(_0x235be2[_0x6dc3('0x28')]){delete _0x235be2[_0x6dc3('0x28')];}_0x21eaed['status'](_0x549407)['send'](_0x235be2);};}exports[_0x6dc3('0x29')]=function(_0x1409d7,_0x76dcc8){var _0x5a4b3e={},_0x10950f={},_0x3f54af={'count':0x0,'rows':[]};var _0x6c481f=_[_0x6dc3('0x2a')](db[_0x6dc3('0x2b')]['rawAttributes'],function(_0x39a42b){return{'name':_0x39a42b[_0x6dc3('0x2c')],'type':_0x39a42b[_0x6dc3('0x2d')][_0x6dc3('0x2e')]};});_0x10950f['model']=_[_0x6dc3('0x2a')](_0x6c481f,_0x6dc3('0x28'));_0x10950f[_0x6dc3('0x2f')]=_[_0x6dc3('0x30')](_0x1409d7['query']);_0x10950f[_0x6dc3('0x31')]=_[_0x6dc3('0x32')](_0x10950f[_0x6dc3('0x33')],_0x10950f[_0x6dc3('0x2f')]);_0x5a4b3e['attributes']=_[_0x6dc3('0x32')](_0x10950f[_0x6dc3('0x33')],qs['fields'](_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x34')]));_0x5a4b3e[_0x6dc3('0x35')]=_0x5a4b3e[_0x6dc3('0x35')][_0x6dc3('0x36')]?_0x5a4b3e[_0x6dc3('0x35')]:_0x10950f[_0x6dc3('0x33')];if(!_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x37')]('nolimit')){_0x5a4b3e['limit']=qs[_0x6dc3('0x1c')](_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x1c')]);_0x5a4b3e['offset']=qs['offset'](_0x1409d7[_0x6dc3('0x2f')]['offset']);}_0x5a4b3e[_0x6dc3('0x38')]=qs[_0x6dc3('0x39')](_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x39')]);_0x5a4b3e['where']=qs[_0x6dc3('0x31')](_[_0x6dc3('0x3a')](_0x1409d7[_0x6dc3('0x2f')],_0x10950f[_0x6dc3('0x31')]),_0x6c481f);if(_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x3b')]){_0x5a4b3e[_0x6dc3('0x3c')]=_[_0x6dc3('0x3d')](_0x5a4b3e[_0x6dc3('0x3c')],{'$or':_[_0x6dc3('0x2a')](_0x6c481f,function(_0x6b6d78){if(_0x6b6d78[_0x6dc3('0x2d')]!==_0x6dc3('0x3e')){var _0x2fb97f={};_0x2fb97f[_0x6b6d78['name']]={'$like':'%'+_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x3b')]+'%'};return _0x2fb97f;}})});}_0x5a4b3e=_[_0x6dc3('0x3d')]({},_0x5a4b3e,_0x1409d7[_0x6dc3('0x3f')]);var _0x463c4f={'where':_0x5a4b3e[_0x6dc3('0x3c')]};return db[_0x6dc3('0x2b')][_0x6dc3('0x1b')](_0x463c4f)[_0x6dc3('0x22')](function(_0x2ab6ec){_0x3f54af['count']=_0x2ab6ec;if(_0x1409d7[_0x6dc3('0x2f')][_0x6dc3('0x40')]){_0x5a4b3e[_0x6dc3('0x41')]=[{'all':!![]}];}return db[_0x6dc3('0x2b')]['findAll'](_0x5a4b3e);})[_0x6dc3('0x22')](function(_0x423ec4){_0x3f54af[_0x6dc3('0x42')]=_0x423ec4;return _0x3f54af;})[_0x6dc3('0x22')](respondWithFilteredResult(_0x76dcc8,_0x5a4b3e))[_0x6dc3('0x43')](handleError(_0x76dcc8,null));};exports[_0x6dc3('0x44')]=function(_0x2c159d,_0x52c0d8){var _0x5718ab={'raw':!![],'where':{'id':_0x2c159d['params']['id']}},_0x5b23a8={};_0x5b23a8[_0x6dc3('0x33')]=_['keys'](db[_0x6dc3('0x2b')][_0x6dc3('0x45')]);_0x5b23a8[_0x6dc3('0x2f')]=_[_0x6dc3('0x30')](_0x2c159d[_0x6dc3('0x2f')]);_0x5b23a8[_0x6dc3('0x31')]=_[_0x6dc3('0x32')](_0x5b23a8[_0x6dc3('0x33')],_0x5b23a8[_0x6dc3('0x2f')]);_0x5718ab[_0x6dc3('0x35')]=_['intersection'](_0x5b23a8[_0x6dc3('0x33')],qs[_0x6dc3('0x34')](_0x2c159d['query']['fields']));_0x5718ab[_0x6dc3('0x35')]=_0x5718ab[_0x6dc3('0x35')]['length']?_0x5718ab[_0x6dc3('0x35')]:_0x5b23a8[_0x6dc3('0x33')];if(_0x2c159d[_0x6dc3('0x2f')][_0x6dc3('0x40')]){_0x5718ab['include']=[{'all':!![]}];}_0x5718ab=_[_0x6dc3('0x3d')]({},_0x5718ab,_0x2c159d[_0x6dc3('0x3f')]);return db['AnalyticTreeReport'][_0x6dc3('0x46')](_0x5718ab)[_0x6dc3('0x22')](handleEntityNotFound(_0x52c0d8,null))[_0x6dc3('0x22')](respondWithResult(_0x52c0d8,null))['catch'](handleError(_0x52c0d8,null));};exports[_0x6dc3('0x47')]=function(_0x3f130d,_0x315644){return db[_0x6dc3('0x2b')][_0x6dc3('0x47')](_0x3f130d[_0x6dc3('0x48')],{})[_0x6dc3('0x22')](respondWithResult(_0x315644,0xc9))[_0x6dc3('0x43')](handleError(_0x315644,null));};exports['update']=function(_0x31ec0c,_0x366ba0){if(_0x31ec0c[_0x6dc3('0x48')]['id']){delete _0x31ec0c['body']['id'];}return db[_0x6dc3('0x2b')][_0x6dc3('0x46')]({'where':{'id':_0x31ec0c['params']['id']}})[_0x6dc3('0x22')](handleEntityNotFound(_0x366ba0,null))['then'](saveUpdates(_0x31ec0c[_0x6dc3('0x48')],null))['then'](respondWithResult(_0x366ba0,null))[_0x6dc3('0x43')](handleError(_0x366ba0,null));};exports['destroy']=function(_0x2f6ebc,_0x455ed9){return db[_0x6dc3('0x2b')]['find']({'where':{'id':_0x2f6ebc['params']['id']}})['then'](handleEntityNotFound(_0x455ed9,null))['then'](removeEntity(_0x455ed9,null))['catch'](handleError(_0x455ed9,null));}; \ No newline at end of file +var _0x5f39=['moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x34d7b1,_0x3a495b){var _0x2314f0=function(_0x3604e7){while(--_0x3604e7){_0x34d7b1['push'](_0x34d7b1['shift']());}};_0x2314f0(++_0x3a495b);}(_0x5f39,0x17c));var _0x95f3=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5f39[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x95f3('0x0'));var rimraf=require(_0x95f3('0x1'));var zipdir=require(_0x95f3('0x2'));var jsonpatch=require(_0x95f3('0x3'));var rp=require(_0x95f3('0x4'));var moment=require(_0x95f3('0x5'));var BPromise=require(_0x95f3('0x6'));var Mustache=require('mustache');var util=require(_0x95f3('0x7'));var path=require('path');var sox=require(_0x95f3('0x8'));var csv=require(_0x95f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95f3('0xa'));var _=require(_0x95f3('0xb'));var squel=require('squel');var crypto=require(_0x95f3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x95f3('0xd'));var toCsv=require(_0x95f3('0x9'));var querystring=require(_0x95f3('0xe'));var Papa=require(_0x95f3('0xf'));var Redis=require(_0x95f3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x95f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95f3('0x12'));var logger=require(_0x95f3('0x13'))(_0x95f3('0x14'));var utils=require(_0x95f3('0x15'));var config=require(_0x95f3('0x16'));var licenseUtil=require(_0x95f3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dd009,_0x1a73f9){_0x1a73f9=_0x1a73f9||0xcc;return function(_0x9c4fa0){if(_0x9c4fa0){return _0x1dd009[_0x95f3('0x18')](_0x1a73f9);}return _0x1dd009[_0x95f3('0x19')](_0x1a73f9)[_0x95f3('0x1a')]();};}function respondWithResult(_0x58935f,_0x25560f){_0x25560f=_0x25560f||0xc8;return function(_0x4a638b){if(_0x4a638b){return _0x58935f['status'](_0x25560f)[_0x95f3('0x1b')](_0x4a638b);}};}function respondWithFilteredResult(_0x105fd0,_0x1aa020){return function(_0x352567){if(_0x352567){var _0x1f5af0=typeof _0x1aa020[_0x95f3('0x1c')]===_0x95f3('0x1d')&&typeof _0x1aa020[_0x95f3('0x1e')]===_0x95f3('0x1d');var _0x3d79c5=_0x352567[_0x95f3('0x1f')];var _0x431369=_0x1f5af0?0x0:_0x1aa020['offset'];var _0x16f8d7=_0x1f5af0?_0x352567[_0x95f3('0x1f')]:_0x1aa020[_0x95f3('0x1c')]+_0x1aa020[_0x95f3('0x1e')];var _0x17884a;if(_0x16f8d7>=_0x3d79c5){_0x16f8d7=_0x3d79c5;_0x17884a=0xc8;}else{_0x17884a=0xce;}_0x105fd0[_0x95f3('0x19')](_0x17884a);return _0x105fd0[_0x95f3('0x20')](_0x95f3('0x21'),_0x431369+'-'+_0x16f8d7+'/'+_0x3d79c5)[_0x95f3('0x1b')](_0x352567);}return null;};}function patchUpdates(_0x2ba089){return function(_0xd48b33){try{jsonpatch['apply'](_0xd48b33,_0x2ba089,!![]);}catch(_0xa90021){return BPromise[_0x95f3('0x22')](_0xa90021);}return _0xd48b33[_0x95f3('0x23')]();};}function saveUpdates(_0x27e7a8,_0x332f47){return function(_0x3e8a57){if(_0x3e8a57){return _0x3e8a57[_0x95f3('0x24')](_0x27e7a8)[_0x95f3('0x25')](function(_0x43ad67){return _0x43ad67;});}return null;};}function removeEntity(_0x5c7ecc,_0x530f2f){return function(_0x5254f6){if(_0x5254f6){return _0x5254f6[_0x95f3('0x26')]()['then'](function(){_0x5c7ecc[_0x95f3('0x19')](0xcc)[_0x95f3('0x1a')]();});}};}function handleEntityNotFound(_0x2cf9b1,_0x5bbdd2){return function(_0x1fd524){if(!_0x1fd524){_0x2cf9b1[_0x95f3('0x18')](0x194);}return _0x1fd524;};}function handleError(_0x5cbb0e,_0x2ec5db){_0x2ec5db=_0x2ec5db||0x1f4;return function(_0x536500){logger[_0x95f3('0x27')](_0x536500[_0x95f3('0x28')]);if(_0x536500[_0x95f3('0x29')]){delete _0x536500[_0x95f3('0x29')];}_0x5cbb0e[_0x95f3('0x19')](_0x2ec5db)[_0x95f3('0x2a')](_0x536500);};}exports[_0x95f3('0x2b')]=function(_0x41589d,_0x57452e){var _0x18bc62={},_0x76cabd={},_0x3ea942={'count':0x0,'rows':[]};var _0x1a6bec=_[_0x95f3('0x2c')](db['AnalyticTreeReport']['rawAttributes'],function(_0x2e0fad){return{'name':_0x2e0fad[_0x95f3('0x2d')],'type':_0x2e0fad[_0x95f3('0x2e')][_0x95f3('0x2f')]};});_0x76cabd[_0x95f3('0x30')]=_[_0x95f3('0x2c')](_0x1a6bec,_0x95f3('0x29'));_0x76cabd[_0x95f3('0x31')]=_['keys'](_0x41589d[_0x95f3('0x31')]);_0x76cabd['filters']=_[_0x95f3('0x32')](_0x76cabd[_0x95f3('0x30')],_0x76cabd[_0x95f3('0x31')]);_0x18bc62['attributes']=_[_0x95f3('0x32')](_0x76cabd[_0x95f3('0x30')],qs[_0x95f3('0x33')](_0x41589d[_0x95f3('0x31')][_0x95f3('0x33')]));_0x18bc62[_0x95f3('0x34')]=_0x18bc62['attributes'][_0x95f3('0x35')]?_0x18bc62[_0x95f3('0x34')]:_0x76cabd[_0x95f3('0x30')];if(!_0x41589d[_0x95f3('0x31')][_0x95f3('0x36')](_0x95f3('0x37'))){_0x18bc62[_0x95f3('0x1e')]=qs[_0x95f3('0x1e')](_0x41589d['query'][_0x95f3('0x1e')]);_0x18bc62['offset']=qs[_0x95f3('0x1c')](_0x41589d[_0x95f3('0x31')][_0x95f3('0x1c')]);}_0x18bc62[_0x95f3('0x38')]=qs[_0x95f3('0x39')](_0x41589d[_0x95f3('0x31')][_0x95f3('0x39')]);_0x18bc62[_0x95f3('0x3a')]=qs[_0x95f3('0x3b')](_[_0x95f3('0x3c')](_0x41589d['query'],_0x76cabd[_0x95f3('0x3b')]),_0x1a6bec);if(_0x41589d['query'][_0x95f3('0x3d')]){_0x18bc62[_0x95f3('0x3a')]=_[_0x95f3('0x3e')](_0x18bc62['where'],{'$or':_[_0x95f3('0x2c')](_0x1a6bec,function(_0x12516b){if(_0x12516b[_0x95f3('0x2e')]!==_0x95f3('0x3f')){var _0x3ec6c5={};_0x3ec6c5[_0x12516b[_0x95f3('0x29')]]={'$like':'%'+_0x41589d[_0x95f3('0x31')]['filter']+'%'};return _0x3ec6c5;}})});}_0x18bc62=_['merge']({},_0x18bc62,_0x41589d[_0x95f3('0x40')]);var _0x4b0225={'where':_0x18bc62[_0x95f3('0x3a')]};return db[_0x95f3('0x41')][_0x95f3('0x1f')](_0x4b0225)[_0x95f3('0x25')](function(_0x5114a8){_0x3ea942[_0x95f3('0x1f')]=_0x5114a8;if(_0x41589d['query'][_0x95f3('0x42')]){_0x18bc62['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x95f3('0x43')](_0x18bc62);})[_0x95f3('0x25')](function(_0x2a33f5){_0x3ea942[_0x95f3('0x44')]=_0x2a33f5;return _0x3ea942;})[_0x95f3('0x25')](respondWithFilteredResult(_0x57452e,_0x18bc62))[_0x95f3('0x45')](handleError(_0x57452e,null));};exports[_0x95f3('0x46')]=function(_0x47c741,_0x4ccad3){var _0x1dad70={'raw':!![],'where':{'id':_0x47c741[_0x95f3('0x47')]['id']}},_0x1a8711={};_0x1a8711[_0x95f3('0x30')]=_['keys'](db[_0x95f3('0x41')][_0x95f3('0x48')]);_0x1a8711[_0x95f3('0x31')]=_['keys'](_0x47c741['query']);_0x1a8711[_0x95f3('0x3b')]=_[_0x95f3('0x32')](_0x1a8711[_0x95f3('0x30')],_0x1a8711[_0x95f3('0x31')]);_0x1dad70[_0x95f3('0x34')]=_[_0x95f3('0x32')](_0x1a8711[_0x95f3('0x30')],qs[_0x95f3('0x33')](_0x47c741[_0x95f3('0x31')][_0x95f3('0x33')]));_0x1dad70[_0x95f3('0x34')]=_0x1dad70['attributes'][_0x95f3('0x35')]?_0x1dad70[_0x95f3('0x34')]:_0x1a8711[_0x95f3('0x30')];if(_0x47c741[_0x95f3('0x31')][_0x95f3('0x42')]){_0x1dad70[_0x95f3('0x49')]=[{'all':!![]}];}_0x1dad70=_[_0x95f3('0x3e')]({},_0x1dad70,_0x47c741[_0x95f3('0x40')]);return db[_0x95f3('0x41')][_0x95f3('0x4a')](_0x1dad70)[_0x95f3('0x25')](handleEntityNotFound(_0x4ccad3,null))[_0x95f3('0x25')](respondWithResult(_0x4ccad3,null))[_0x95f3('0x45')](handleError(_0x4ccad3,null));};exports[_0x95f3('0x4b')]=function(_0x2db8f5,_0x57a928){return db['AnalyticTreeReport'][_0x95f3('0x4b')](_0x2db8f5[_0x95f3('0x4c')],{})[_0x95f3('0x25')](respondWithResult(_0x57a928,0xc9))['catch'](handleError(_0x57a928,null));};exports[_0x95f3('0x24')]=function(_0x55461d,_0x2a4036){if(_0x55461d[_0x95f3('0x4c')]['id']){delete _0x55461d['body']['id'];}return db['AnalyticTreeReport'][_0x95f3('0x4a')]({'where':{'id':_0x55461d['params']['id']}})[_0x95f3('0x25')](handleEntityNotFound(_0x2a4036,null))[_0x95f3('0x25')](saveUpdates(_0x55461d[_0x95f3('0x4c')],null))[_0x95f3('0x25')](respondWithResult(_0x2a4036,null))['catch'](handleError(_0x2a4036,null));};exports['destroy']=function(_0x5a2f05,_0x29a83f){return db['AnalyticTreeReport'][_0x95f3('0x4a')]({'where':{'id':_0x5a2f05[_0x95f3('0x47')]['id']}})['then'](handleEntityNotFound(_0x29a83f,null))['then'](removeEntity(_0x29a83f,null))[_0x95f3('0x45')](handleError(_0x29a83f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ada6103..84d6235 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 _0x8de8=['moment','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','lodash','util','../../config/logger','api'];(function(_0x396b94,_0x151de5){var _0xec6fa2=function(_0x454c26){while(--_0x454c26){_0x396b94['push'](_0x396b94['shift']());}};_0xec6fa2(++_0x151de5);}(_0x8de8,0xb0));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x88de('0x0'));var util=require(_0x88de('0x1'));var logger=require(_0x88de('0x2'))(_0x88de('0x3'));var moment=require(_0x88de('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x88de('0x5'));var config=require('../../config/environment');var attributes=require(_0x88de('0x6'));module['exports']=function(_0x317b9c,_0x344973){return _0x317b9c[_0x88de('0x7')](_0x88de('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x387f=['define','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x57b35b,_0x4b0493){var _0x34a20b=function(_0x3ee3e7){while(--_0x3ee3e7){_0x57b35b['push'](_0x57b35b['shift']());}};_0x34a20b(++_0x4b0493);}(_0x387f,0x169));var _0xf387=function(_0x4f784f,_0x33c48e){_0x4f784f=_0x4f784f-0x0;var _0x4921cc=_0x387f[_0x4f784f];return _0x4921cc;};'use strict';var _=require(_0xf387('0x0'));var util=require(_0xf387('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf387('0x2'));var BPromise=require(_0xf387('0x3'));var rp=require(_0xf387('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf387('0x5'));var config=require(_0xf387('0x6'));var attributes=require(_0xf387('0x7'));module['exports']=function(_0x46d710,_0xc7bc56){return _0x46d710[_0xf387('0x8')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 96f051d..1321bcc 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x87e0dc,_0x577dce){var _0x2cd2d1=function(_0x2d8173){while(--_0x2d8173){_0x87e0dc['push'](_0x87e0dc['shift']());}};_0x2cd2d1(++_0x577dce);}(_0xadb5,0xad));var _0x5adb=function(_0x2ca2bd,_0x53bb08){_0x2ca2bd=_0x2ca2bd-0x0;var _0x275f99=_0xadb5[_0x2ca2bd];return _0x275f99;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x21c56c,_0x24cccf){var _0x51d085=function(_0x1274c2){while(--_0x1274c2){_0x21c56c['push'](_0x21c56c['shift']());}};_0x51d085(++_0x24cccf);}(_0x1261,0x144));var _0x1126=function(_0x1249f4,_0x27226c){_0x1249f4=_0x1249f4-0x0;var _0x47c8a9=_0x1261[_0x1249f4];return _0x47c8a9;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c4802fe..af62fa6 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 _0x32e5=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','update'];(function(_0x3c40f4,_0x500b8a){var _0x1209d=function(_0x46b429){while(--_0x46b429){_0x3c40f4['push'](_0x3c40f4['shift']());}};_0x1209d(++_0x500b8a);}(_0x32e5,0x10c));var _0x532e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x32e5[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x532e('0x0'));var util=require(_0x532e('0x1'));var path=require(_0x532e('0x2'));var timeout=require(_0x532e('0x3'));var express=require(_0x532e('0x4'));var router=express[_0x532e('0x5')]();var fs_extra=require(_0x532e('0x6'));var auth=require(_0x532e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x532e('0x8'));var controller=require(_0x532e('0x9'));router[_0x532e('0xa')]('/',auth[_0x532e('0xb')](),controller[_0x532e('0xc')]);router[_0x532e('0xa')]('/:id',auth[_0x532e('0xb')](),controller[_0x532e('0xd')]);router[_0x532e('0xe')]('/',auth['isAuthenticated'](),controller[_0x532e('0xf')]);router[_0x532e('0x10')]('/:id',auth[_0x532e('0xb')](),controller[_0x532e('0x11')]);router[_0x532e('0x12')](_0x532e('0x13'),auth[_0x532e('0xb')](),controller[_0x532e('0x14')]);module[_0x532e('0x15')]=router; \ No newline at end of file +var _0xc672=['../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f716f,_0xbb9877){var _0x397db0=function(_0x59f7){while(--_0x59f7){_0x1f716f['push'](_0x1f716f['shift']());}};_0x397db0(++_0xbb9877);}(_0xc672,0xf1));var _0x2c67=function(_0x163571,_0xc890f8){_0x163571=_0x163571-0x0;var _0x31d66d=_0xc672[_0x163571];return _0x31d66d;};'use strict';var multer=require(_0x2c67('0x0'));var util=require('util');var path=require(_0x2c67('0x1'));var timeout=require(_0x2c67('0x2'));var express=require(_0x2c67('0x3'));var router=express[_0x2c67('0x4')]();var fs_extra=require(_0x2c67('0x5'));var auth=require(_0x2c67('0x6'));var interaction=require(_0x2c67('0x7'));var config=require('../../config/environment');var controller=require(_0x2c67('0x8'));router['get']('/',auth[_0x2c67('0x9')](),controller['index']);router['get'](_0x2c67('0xa'),auth['isAuthenticated'](),controller[_0x2c67('0xb')]);router[_0x2c67('0xc')]('/',auth[_0x2c67('0x9')](),controller[_0x2c67('0xd')]);router[_0x2c67('0xe')](_0x2c67('0xa'),auth[_0x2c67('0x9')](),controller[_0x2c67('0xf')]);router[_0x2c67('0x10')](_0x2c67('0xa'),auth[_0x2c67('0x9')](),controller[_0x2c67('0x11')]);module[_0x2c67('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index aa64926..c7ac6d4 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 _0x9f75=['sequelize','STRING'];(function(_0x227b09,_0x2ea7ae){var _0x5f3571=function(_0x5916ae){while(--_0x5916ae){_0x227b09['push'](_0x227b09['shift']());}};_0x5f3571(++_0x2ea7ae);}(_0x9f75,0x15a));var _0x59f7=function(_0x2047a0,_0x18bde3){_0x2047a0=_0x2047a0-0x0;var _0x3c4bc1=_0x9f75[_0x2047a0];return _0x3c4bc1;};'use strict';var Sequelize=require(_0x59f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x59f7('0x1')]},'basename':{'type':Sequelize[_0x59f7('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe700=['exports','STRING','sequelize'];(function(_0x86eb0c,_0x4e16de){var _0x463d7b=function(_0x51f56e){while(--_0x51f56e){_0x86eb0c['push'](_0x86eb0c['shift']());}};_0x463d7b(++_0x4e16de);}(_0xe700,0x16a));var _0x0e70=function(_0x3887ce,_0x327268){_0x3887ce=_0x3887ce-0x0;var _0x3bf1cb=_0xe700[_0x3887ce];return _0x3bf1cb;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'name':{'type':Sequelize[_0x0e70('0x2')]},'basename':{'type':Sequelize[_0x0e70('0x2')]},'type':{'type':Sequelize[_0x0e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 6903f5a..c72b9ce 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 _0xcd09=['server/files/attachments/','join','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','api','../../config/utils','../../config/environment','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','end','sendStatus','stack','name','index','Attachment','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','clone','get','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','findOne','root'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xcd09,0x146));var _0x9cd0=function(_0x4b9806,_0x1517c0){_0x4b9806=_0x4b9806-0x0;var _0x12f4d4=_0xcd09[_0x4b9806];return _0x12f4d4;};'use strict';var emlformat=require(_0x9cd0('0x0'));var rimraf=require(_0x9cd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9cd0('0x2'));var moment=require('moment');var BPromise=require(_0x9cd0('0x3'));var Mustache=require('mustache');var util=require(_0x9cd0('0x4'));var path=require(_0x9cd0('0x5'));var sox=require(_0x9cd0('0x6'));var csv=require(_0x9cd0('0x7'));var ejs=require(_0x9cd0('0x8'));var fs=require('fs');var fs_extra=require(_0x9cd0('0x9'));var _=require(_0x9cd0('0xa'));var squel=require(_0x9cd0('0xb'));var crypto=require(_0x9cd0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9cd0('0xd'));var Redis=require(_0x9cd0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9cd0('0xf'));var utils=require(_0x9cd0('0x10'));var config=require(_0x9cd0('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50125e,_0x5ba17e){_0x5ba17e=_0x5ba17e||0xcc;return function(_0x32f2a6){if(_0x32f2a6){return _0x50125e['sendStatus'](_0x5ba17e);}return _0x50125e[_0x9cd0('0x12')](_0x5ba17e)['end']();};}function respondWithResult(_0x4d3e52,_0x49af7f){_0x49af7f=_0x49af7f||0xc8;return function(_0x3f46f8){if(_0x3f46f8){return _0x4d3e52['status'](_0x49af7f)[_0x9cd0('0x13')](_0x3f46f8);}};}function respondWithFilteredResult(_0x3087bf,_0x10e357){return function(_0x1b9dba){if(_0x1b9dba){var _0x56eb29=typeof _0x10e357['offset']===_0x9cd0('0x14')&&typeof _0x10e357[_0x9cd0('0x15')]===_0x9cd0('0x14');var _0x1c27a0=_0x1b9dba[_0x9cd0('0x16')];var _0x46f1eb=_0x56eb29?0x0:_0x10e357[_0x9cd0('0x17')];var _0xcd9223=_0x56eb29?_0x1b9dba[_0x9cd0('0x16')]:_0x10e357[_0x9cd0('0x17')]+_0x10e357[_0x9cd0('0x15')];var _0x42bd72;if(_0xcd9223>=_0x1c27a0){_0xcd9223=_0x1c27a0;_0x42bd72=0xc8;}else{_0x42bd72=0xce;}_0x3087bf[_0x9cd0('0x12')](_0x42bd72);return _0x3087bf[_0x9cd0('0x18')](_0x9cd0('0x19'),_0x46f1eb+'-'+_0xcd9223+'/'+_0x1c27a0)[_0x9cd0('0x13')](_0x1b9dba);}return null;};}function patchUpdates(_0x102a21){return function(_0x5041bd){try{jsonpatch[_0x9cd0('0x1a')](_0x5041bd,_0x102a21,!![]);}catch(_0x1b3f36){return BPromise['reject'](_0x1b3f36);}return _0x5041bd[_0x9cd0('0x1b')]();};}function saveUpdates(_0x1ef0a2,_0x129660){return function(_0x418a3a){if(_0x418a3a){return _0x418a3a['update'](_0x1ef0a2)[_0x9cd0('0x1c')](function(_0x4c62a7){return _0x4c62a7;});}return null;};}function removeEntity(_0x5c39b7,_0x44b83c){return function(_0x52697a){if(_0x52697a){return _0x52697a[_0x9cd0('0x1d')]()[_0x9cd0('0x1c')](function(){_0x5c39b7[_0x9cd0('0x12')](0xcc)[_0x9cd0('0x1e')]();});}};}function handleEntityNotFound(_0x51dee5,_0x3e3cc9){return function(_0x4cb856){if(!_0x4cb856){_0x51dee5[_0x9cd0('0x1f')](0x194);}return _0x4cb856;};}function handleError(_0x5cfd36,_0x11b0fe){_0x11b0fe=_0x11b0fe||0x1f4;return function(_0x50e319){logger['error'](_0x50e319[_0x9cd0('0x20')]);if(_0x50e319[_0x9cd0('0x21')]){delete _0x50e319['name'];}_0x5cfd36[_0x9cd0('0x12')](_0x11b0fe)['send'](_0x50e319);};}exports[_0x9cd0('0x22')]=function(_0x2c7d17,_0x583597){var _0x3216de={},_0x1c4591={},_0x537b51={'count':0x0,'rows':[]};var _0x59dec4=_['map'](db[_0x9cd0('0x23')][_0x9cd0('0x24')],function(_0x499d03){return{'name':_0x499d03[_0x9cd0('0x25')],'type':_0x499d03[_0x9cd0('0x26')]['key']};});_0x1c4591[_0x9cd0('0x27')]=_[_0x9cd0('0x28')](_0x59dec4,_0x9cd0('0x21'));_0x1c4591[_0x9cd0('0x29')]=_[_0x9cd0('0x2a')](_0x2c7d17['query']);_0x1c4591[_0x9cd0('0x2b')]=_[_0x9cd0('0x2c')](_0x1c4591[_0x9cd0('0x27')],_0x1c4591[_0x9cd0('0x29')]);_0x3216de[_0x9cd0('0x2d')]=_[_0x9cd0('0x2c')](_0x1c4591[_0x9cd0('0x27')],qs[_0x9cd0('0x2e')](_0x2c7d17[_0x9cd0('0x29')]['fields']));_0x3216de['attributes']=_0x3216de['attributes'][_0x9cd0('0x2f')]?_0x3216de[_0x9cd0('0x2d')]:_0x1c4591['model'];if(!_0x2c7d17['query'][_0x9cd0('0x30')](_0x9cd0('0x31'))){_0x3216de[_0x9cd0('0x15')]=qs['limit'](_0x2c7d17[_0x9cd0('0x29')][_0x9cd0('0x15')]);_0x3216de[_0x9cd0('0x17')]=qs[_0x9cd0('0x17')](_0x2c7d17[_0x9cd0('0x29')][_0x9cd0('0x17')]);}_0x3216de[_0x9cd0('0x32')]=qs[_0x9cd0('0x33')](_0x2c7d17[_0x9cd0('0x29')][_0x9cd0('0x33')]);_0x3216de[_0x9cd0('0x34')]=qs['filters'](_[_0x9cd0('0x35')](_0x2c7d17[_0x9cd0('0x29')],_0x1c4591['filters']),_0x59dec4);if(_0x2c7d17[_0x9cd0('0x29')][_0x9cd0('0x36')]){_0x3216de[_0x9cd0('0x34')]=_['merge'](_0x3216de[_0x9cd0('0x34')],{'$or':_[_0x9cd0('0x28')](_0x59dec4,function(_0x3f1bf3){if(_0x3f1bf3[_0x9cd0('0x26')]!=='VIRTUAL'){var _0x4b6ec={};_0x4b6ec[_0x3f1bf3[_0x9cd0('0x21')]]={'$like':'%'+_0x2c7d17[_0x9cd0('0x29')]['filter']+'%'};return _0x4b6ec;}})});}_0x3216de=_[_0x9cd0('0x37')]({},_0x3216de,_0x2c7d17[_0x9cd0('0x38')]);var _0x41749f={'where':_0x3216de[_0x9cd0('0x34')]};return db['Attachment'][_0x9cd0('0x16')](_0x41749f)[_0x9cd0('0x1c')](function(_0x3ad458){_0x537b51['count']=_0x3ad458;if(_0x2c7d17[_0x9cd0('0x29')][_0x9cd0('0x39')]){_0x3216de[_0x9cd0('0x3a')]=[{'all':!![]}];}return db[_0x9cd0('0x23')][_0x9cd0('0x3b')](_0x3216de);})[_0x9cd0('0x1c')](function(_0x45b468){_0x537b51[_0x9cd0('0x3c')]=_0x45b468;return _0x537b51;})[_0x9cd0('0x1c')](respondWithFilteredResult(_0x583597,_0x3216de))[_0x9cd0('0x3d')](handleError(_0x583597,null));};exports['show']=function(_0x438cc7,_0x9a7855){var _0x4ab421={'raw':!![],'where':{'id':_0x438cc7[_0x9cd0('0x3e')]['id']}},_0x589c69={};_0x589c69[_0x9cd0('0x27')]=_[_0x9cd0('0x2a')](db[_0x9cd0('0x23')][_0x9cd0('0x24')]);_0x589c69['query']=_[_0x9cd0('0x2a')](_0x438cc7['query']);_0x589c69[_0x9cd0('0x2b')]=_[_0x9cd0('0x2c')](_0x589c69[_0x9cd0('0x27')],_0x589c69[_0x9cd0('0x29')]);_0x4ab421[_0x9cd0('0x2d')]=_[_0x9cd0('0x2c')](_0x589c69[_0x9cd0('0x27')],qs[_0x9cd0('0x2e')](_0x438cc7[_0x9cd0('0x29')]['fields']));_0x4ab421[_0x9cd0('0x2d')]=_0x4ab421['attributes'][_0x9cd0('0x2f')]?_0x4ab421[_0x9cd0('0x2d')]:_0x589c69[_0x9cd0('0x27')];if(_0x438cc7[_0x9cd0('0x29')][_0x9cd0('0x39')]){_0x4ab421[_0x9cd0('0x3a')]=[{'all':!![]}];}_0x4ab421=_[_0x9cd0('0x37')]({},_0x4ab421,_0x438cc7[_0x9cd0('0x38')]);return db['Attachment'][_0x9cd0('0x3f')](_0x4ab421)[_0x9cd0('0x1c')](handleEntityNotFound(_0x9a7855,null))[_0x9cd0('0x1c')](respondWithResult(_0x9a7855,null))[_0x9cd0('0x3d')](handleError(_0x9a7855,null));};exports[_0x9cd0('0x40')]=function(_0xf724c5,_0x3268d4){var _0x8531e6={'where':{'id':_0xf724c5['params']['id']}},_0x241b69={};_0x241b69[_0x9cd0('0x27')]=_[_0x9cd0('0x2a')](db['Attachment']['rawAttributes']);_0x8531e6[_0x9cd0('0x2d')]=_[_0x9cd0('0x2c')](_0x241b69[_0x9cd0('0x27')],qs[_0x9cd0('0x2e')](_0xf724c5[_0x9cd0('0x29')][_0x9cd0('0x2e')]));_0x8531e6[_0x9cd0('0x2d')]=_0x8531e6[_0x9cd0('0x2d')][_0x9cd0('0x2f')]?_0x8531e6[_0x9cd0('0x2d')]:_0x241b69[_0x9cd0('0x27')];if(_0xf724c5[_0x9cd0('0x29')]['includeAll']){_0x8531e6[_0x9cd0('0x3a')]=[{'all':!![]}];}_0x8531e6=_[_0x9cd0('0x37')]({},_0x8531e6,_0xf724c5['options']);return db[_0x9cd0('0x23')]['find'](_0x8531e6)[_0x9cd0('0x1c')](handleEntityNotFound(_0x3268d4,null))[_0x9cd0('0x1c')](function(_0x2e0cc4){if(_0x2e0cc4){var _0x246c85=_0x2e0cc4[_0x9cd0('0x41')]({'plain':!![]});_0x246c85=qs[_0x9cd0('0x42')](_0x246c85,['id',_0x9cd0('0x43'),_0x9cd0('0x44')]);_0xf724c5[_0x9cd0('0x45')]=_[_0x9cd0('0x42')](_0xf724c5[_0x9cd0('0x45')],['id',_0x9cd0('0x43'),_0x9cd0('0x44')]);return db['Attachment']['create'](_['merge'](_0x246c85,_0xf724c5[_0x9cd0('0x45')]),{'include':_0xf724c5[_0x9cd0('0x29')][_0x9cd0('0x39')]?[{'all':!![]}]:undefined});}})[_0x9cd0('0x1c')](respondWithResult(_0x3268d4,0xc9))['catch'](handleError(_0x3268d4,null));};exports[_0x9cd0('0x46')]=function(_0x965d9f,_0x4ff14f){if(_0x965d9f['body']['id']){delete _0x965d9f[_0x9cd0('0x45')]['id'];}return db[_0x9cd0('0x23')][_0x9cd0('0x3f')]({'where':{'id':_0x965d9f[_0x9cd0('0x3e')]['id']}})[_0x9cd0('0x1c')](handleEntityNotFound(_0x4ff14f,null))[_0x9cd0('0x1c')](saveUpdates(_0x965d9f[_0x9cd0('0x45')],null))[_0x9cd0('0x1c')](respondWithResult(_0x4ff14f,null))[_0x9cd0('0x3d')](handleError(_0x4ff14f,null));};exports['destroy']=function(_0x35fe31,_0x5c0a6f){return db[_0x9cd0('0x23')][_0x9cd0('0x3f')]({'where':{'id':_0x35fe31[_0x9cd0('0x3e')]['id']}})[_0x9cd0('0x1c')](handleEntityNotFound(_0x5c0a6f,null))['then'](removeEntity(_0x5c0a6f,null))[_0x9cd0('0x3d')](handleError(_0x5c0a6f,null));};exports[_0x9cd0('0x47')]=function(_0x414eb4,_0x5daa2f,_0x83af03){_0x414eb4[_0x9cd0('0x45')][_0x9cd0('0x21')]=_0x414eb4[_0x9cd0('0x48')][_0x9cd0('0x49')];_0x414eb4[_0x9cd0('0x45')][_0x9cd0('0x4a')]=_0x414eb4['file'][_0x9cd0('0x4b')];_0x414eb4['body'][_0x9cd0('0x26')]=_0x414eb4[_0x9cd0('0x48')][_0x9cd0('0x4c')];return db[_0x9cd0('0x23')][_0x9cd0('0x47')](_0x414eb4[_0x9cd0('0x45')])[_0x9cd0('0x1c')](respondWithResult(_0x5daa2f,0xc9))['catch'](handleError(_0x5daa2f,null));};exports['download']=function(_0x2f09d6,_0x10c9c2,_0x5d9832){return db['Attachment'][_0x9cd0('0x4d')]({'where':{'id':_0x2f09d6[_0x9cd0('0x3e')]['id']},'raw':!![]})[_0x9cd0('0x1c')](handleEntityNotFound(_0x10c9c2,null))[_0x9cd0('0x1c')](function(_0x3bd1d1){if(_0x3bd1d1){var _0x15a351=_0x3bd1d1['ChatOfflineMessageId']!==null;var _0x50e1dc=path['join'](config[_0x9cd0('0x4e')],_0x9cd0('0x4f'));if(_0x15a351){_0x50e1dc=path['join'](_0x50e1dc,'offline-chat/');}var _0xe33c6a=path[_0x9cd0('0x50')](_0x50e1dc,_0x3bd1d1[_0x9cd0('0x4a')]);return _0x10c9c2['download'](_0xe33c6a);}})[_0x9cd0('0x3d')](handleError(_0x10c9c2,null));}; \ No newline at end of file +var _0xb2f2=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','error','name','index','map','fieldName','type','key','query','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','options','Attachment','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','keys','get','omit','createdAt','body','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb2f2,0x159));var _0x2b2f=function(_0x70207a,_0x40dc8b){_0x70207a=_0x70207a-0x0;var _0x25c3d2=_0xb2f2[_0x70207a];return _0x25c3d2;};'use strict';var emlformat=require(_0x2b2f('0x0'));var rimraf=require(_0x2b2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b2f('0x2'));var rp=require(_0x2b2f('0x3'));var moment=require(_0x2b2f('0x4'));var BPromise=require(_0x2b2f('0x5'));var Mustache=require(_0x2b2f('0x6'));var util=require('util');var path=require(_0x2b2f('0x7'));var sox=require(_0x2b2f('0x8'));var csv=require(_0x2b2f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b2f('0xa'));var _=require(_0x2b2f('0xb'));var squel=require(_0x2b2f('0xc'));var crypto=require(_0x2b2f('0xd'));var jsforce=require(_0x2b2f('0xe'));var deskjs=require(_0x2b2f('0xf'));var toCsv=require(_0x2b2f('0x9'));var querystring=require(_0x2b2f('0x10'));var Papa=require(_0x2b2f('0x11'));var Redis=require(_0x2b2f('0x12'));var authService=require(_0x2b2f('0x13'));var qs=require(_0x2b2f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b2f('0x15'));var logger=require(_0x2b2f('0x16'))(_0x2b2f('0x17'));var utils=require(_0x2b2f('0x18'));var config=require(_0x2b2f('0x19'));var licenseUtil=require(_0x2b2f('0x1a'));var db=require(_0x2b2f('0x1b'))['db'];function respondWithStatusCode(_0x2d99db,_0x2fac77){_0x2fac77=_0x2fac77||0xcc;return function(_0x510416){if(_0x510416){return _0x2d99db['sendStatus'](_0x2fac77);}return _0x2d99db[_0x2b2f('0x1c')](_0x2fac77)[_0x2b2f('0x1d')]();};}function respondWithResult(_0x19cb59,_0x43758c){_0x43758c=_0x43758c||0xc8;return function(_0xa0fb5a){if(_0xa0fb5a){return _0x19cb59[_0x2b2f('0x1c')](_0x43758c)[_0x2b2f('0x1e')](_0xa0fb5a);}};}function respondWithFilteredResult(_0x1971fd,_0xa72617){return function(_0x3e049a){if(_0x3e049a){var _0x4eccad=typeof _0xa72617[_0x2b2f('0x1f')]===_0x2b2f('0x20')&&typeof _0xa72617[_0x2b2f('0x21')]===_0x2b2f('0x20');var _0xce8db8=_0x3e049a[_0x2b2f('0x22')];var _0x2027a9=_0x4eccad?0x0:_0xa72617[_0x2b2f('0x1f')];var _0xca2c89=_0x4eccad?_0x3e049a[_0x2b2f('0x22')]:_0xa72617[_0x2b2f('0x1f')]+_0xa72617[_0x2b2f('0x21')];var _0x5f5920;if(_0xca2c89>=_0xce8db8){_0xca2c89=_0xce8db8;_0x5f5920=0xc8;}else{_0x5f5920=0xce;}_0x1971fd[_0x2b2f('0x1c')](_0x5f5920);return _0x1971fd['set'](_0x2b2f('0x23'),_0x2027a9+'-'+_0xca2c89+'/'+_0xce8db8)['json'](_0x3e049a);}return null;};}function patchUpdates(_0x296fb9){return function(_0x4072a2){try{jsonpatch['apply'](_0x4072a2,_0x296fb9,!![]);}catch(_0x211c43){return BPromise[_0x2b2f('0x24')](_0x211c43);}return _0x4072a2['save']();};}function saveUpdates(_0x5477ee,_0x2d791a){return function(_0xbc5768){if(_0xbc5768){return _0xbc5768[_0x2b2f('0x25')](_0x5477ee)[_0x2b2f('0x26')](function(_0x40cb6f){return _0x40cb6f;});}return null;};}function removeEntity(_0x5fd92b,_0x276e34){return function(_0x4a8fe6){if(_0x4a8fe6){return _0x4a8fe6[_0x2b2f('0x27')]()[_0x2b2f('0x26')](function(){_0x5fd92b[_0x2b2f('0x1c')](0xcc)[_0x2b2f('0x1d')]();});}};}function handleEntityNotFound(_0x58ec66,_0x483594){return function(_0x36dea8){if(!_0x36dea8){_0x58ec66[_0x2b2f('0x28')](0x194);}return _0x36dea8;};}function handleError(_0x2ef433,_0x367679){_0x367679=_0x367679||0x1f4;return function(_0xf636d7){logger[_0x2b2f('0x29')](_0xf636d7['stack']);if(_0xf636d7[_0x2b2f('0x2a')]){delete _0xf636d7[_0x2b2f('0x2a')];}_0x2ef433['status'](_0x367679)['send'](_0xf636d7);};}exports[_0x2b2f('0x2b')]=function(_0x37cc9d,_0x4f452d){var _0x113cca={},_0x54f2f4={},_0x4b882b={'count':0x0,'rows':[]};var _0x2549ec=_[_0x2b2f('0x2c')](db['Attachment']['rawAttributes'],function(_0x8b8f65){return{'name':_0x8b8f65[_0x2b2f('0x2d')],'type':_0x8b8f65[_0x2b2f('0x2e')][_0x2b2f('0x2f')]};});_0x54f2f4['model']=_[_0x2b2f('0x2c')](_0x2549ec,_0x2b2f('0x2a'));_0x54f2f4[_0x2b2f('0x30')]=_['keys'](_0x37cc9d['query']);_0x54f2f4['filters']=_['intersection'](_0x54f2f4[_0x2b2f('0x31')],_0x54f2f4[_0x2b2f('0x30')]);_0x113cca[_0x2b2f('0x32')]=_['intersection'](_0x54f2f4['model'],qs[_0x2b2f('0x33')](_0x37cc9d[_0x2b2f('0x30')][_0x2b2f('0x33')]));_0x113cca['attributes']=_0x113cca[_0x2b2f('0x32')][_0x2b2f('0x34')]?_0x113cca[_0x2b2f('0x32')]:_0x54f2f4[_0x2b2f('0x31')];if(!_0x37cc9d[_0x2b2f('0x30')]['hasOwnProperty'](_0x2b2f('0x35'))){_0x113cca[_0x2b2f('0x21')]=qs[_0x2b2f('0x21')](_0x37cc9d[_0x2b2f('0x30')][_0x2b2f('0x21')]);_0x113cca[_0x2b2f('0x1f')]=qs['offset'](_0x37cc9d['query'][_0x2b2f('0x1f')]);}_0x113cca[_0x2b2f('0x36')]=qs[_0x2b2f('0x37')](_0x37cc9d['query']['sort']);_0x113cca[_0x2b2f('0x38')]=qs['filters'](_[_0x2b2f('0x39')](_0x37cc9d[_0x2b2f('0x30')],_0x54f2f4[_0x2b2f('0x3a')]),_0x2549ec);if(_0x37cc9d[_0x2b2f('0x30')][_0x2b2f('0x3b')]){_0x113cca[_0x2b2f('0x38')]=_[_0x2b2f('0x3c')](_0x113cca['where'],{'$or':_[_0x2b2f('0x2c')](_0x2549ec,function(_0x17d985){if(_0x17d985['type']!=='VIRTUAL'){var _0x2e9c32={};_0x2e9c32[_0x17d985['name']]={'$like':'%'+_0x37cc9d['query']['filter']+'%'};return _0x2e9c32;}})});}_0x113cca=_[_0x2b2f('0x3c')]({},_0x113cca,_0x37cc9d[_0x2b2f('0x3d')]);var _0x376f6d={'where':_0x113cca[_0x2b2f('0x38')]};return db[_0x2b2f('0x3e')][_0x2b2f('0x22')](_0x376f6d)[_0x2b2f('0x26')](function(_0x48cacd){_0x4b882b[_0x2b2f('0x22')]=_0x48cacd;if(_0x37cc9d[_0x2b2f('0x30')][_0x2b2f('0x3f')]){_0x113cca[_0x2b2f('0x40')]=[{'all':!![]}];}return db[_0x2b2f('0x3e')][_0x2b2f('0x41')](_0x113cca);})['then'](function(_0x4da539){_0x4b882b[_0x2b2f('0x42')]=_0x4da539;return _0x4b882b;})['then'](respondWithFilteredResult(_0x4f452d,_0x113cca))[_0x2b2f('0x43')](handleError(_0x4f452d,null));};exports['show']=function(_0x256a80,_0x43f2b4){var _0x516ecf={'raw':!![],'where':{'id':_0x256a80[_0x2b2f('0x44')]['id']}},_0x685d7a={};_0x685d7a['model']=_['keys'](db[_0x2b2f('0x3e')][_0x2b2f('0x45')]);_0x685d7a[_0x2b2f('0x30')]=_['keys'](_0x256a80[_0x2b2f('0x30')]);_0x685d7a['filters']=_[_0x2b2f('0x46')](_0x685d7a['model'],_0x685d7a[_0x2b2f('0x30')]);_0x516ecf[_0x2b2f('0x32')]=_[_0x2b2f('0x46')](_0x685d7a['model'],qs[_0x2b2f('0x33')](_0x256a80[_0x2b2f('0x30')]['fields']));_0x516ecf[_0x2b2f('0x32')]=_0x516ecf[_0x2b2f('0x32')]['length']?_0x516ecf[_0x2b2f('0x32')]:_0x685d7a[_0x2b2f('0x31')];if(_0x256a80['query'][_0x2b2f('0x3f')]){_0x516ecf[_0x2b2f('0x40')]=[{'all':!![]}];}_0x516ecf=_[_0x2b2f('0x3c')]({},_0x516ecf,_0x256a80['options']);return db['Attachment'][_0x2b2f('0x47')](_0x516ecf)[_0x2b2f('0x26')](handleEntityNotFound(_0x43f2b4,null))[_0x2b2f('0x26')](respondWithResult(_0x43f2b4,null))['catch'](handleError(_0x43f2b4,null));};exports['clone']=function(_0x5b3c19,_0x455c18){var _0x5f133a={'where':{'id':_0x5b3c19[_0x2b2f('0x44')]['id']}},_0x591e99={};_0x591e99[_0x2b2f('0x31')]=_[_0x2b2f('0x48')](db[_0x2b2f('0x3e')][_0x2b2f('0x45')]);_0x5f133a[_0x2b2f('0x32')]=_[_0x2b2f('0x46')](_0x591e99[_0x2b2f('0x31')],qs[_0x2b2f('0x33')](_0x5b3c19[_0x2b2f('0x30')][_0x2b2f('0x33')]));_0x5f133a[_0x2b2f('0x32')]=_0x5f133a['attributes'][_0x2b2f('0x34')]?_0x5f133a[_0x2b2f('0x32')]:_0x591e99[_0x2b2f('0x31')];if(_0x5b3c19['query']['includeAll']){_0x5f133a[_0x2b2f('0x40')]=[{'all':!![]}];}_0x5f133a=_['merge']({},_0x5f133a,_0x5b3c19[_0x2b2f('0x3d')]);return db[_0x2b2f('0x3e')]['find'](_0x5f133a)[_0x2b2f('0x26')](handleEntityNotFound(_0x455c18,null))[_0x2b2f('0x26')](function(_0xdf8f08){if(_0xdf8f08){var _0x1dbdf0=_0xdf8f08[_0x2b2f('0x49')]({'plain':!![]});_0x1dbdf0=qs[_0x2b2f('0x4a')](_0x1dbdf0,['id',_0x2b2f('0x4b'),'updatedAt']);_0x5b3c19['body']=_[_0x2b2f('0x4a')](_0x5b3c19[_0x2b2f('0x4c')],['id',_0x2b2f('0x4b'),'updatedAt']);return db['Attachment']['create'](_[_0x2b2f('0x3c')](_0x1dbdf0,_0x5b3c19[_0x2b2f('0x4c')]),{'include':_0x5b3c19[_0x2b2f('0x30')][_0x2b2f('0x3f')]?[{'all':!![]}]:undefined});}})[_0x2b2f('0x26')](respondWithResult(_0x455c18,0xc9))['catch'](handleError(_0x455c18,null));};exports['update']=function(_0x465479,_0x595fb9){if(_0x465479[_0x2b2f('0x4c')]['id']){delete _0x465479[_0x2b2f('0x4c')]['id'];}return db[_0x2b2f('0x3e')][_0x2b2f('0x47')]({'where':{'id':_0x465479[_0x2b2f('0x44')]['id']}})[_0x2b2f('0x26')](handleEntityNotFound(_0x595fb9,null))['then'](saveUpdates(_0x465479[_0x2b2f('0x4c')],null))[_0x2b2f('0x26')](respondWithResult(_0x595fb9,null))['catch'](handleError(_0x595fb9,null));};exports[_0x2b2f('0x27')]=function(_0x2ab265,_0x5c9fcd){return db[_0x2b2f('0x3e')][_0x2b2f('0x47')]({'where':{'id':_0x2ab265[_0x2b2f('0x44')]['id']}})[_0x2b2f('0x26')](handleEntityNotFound(_0x5c9fcd,null))[_0x2b2f('0x26')](removeEntity(_0x5c9fcd,null))['catch'](handleError(_0x5c9fcd,null));};exports[_0x2b2f('0x4d')]=function(_0x175a7d,_0xca4182,_0x7c9ea5){_0x175a7d[_0x2b2f('0x4c')][_0x2b2f('0x2a')]=_0x175a7d[_0x2b2f('0x4e')][_0x2b2f('0x4f')];_0x175a7d[_0x2b2f('0x4c')]['basename']=_0x175a7d['file'][_0x2b2f('0x50')];_0x175a7d[_0x2b2f('0x4c')][_0x2b2f('0x2e')]=_0x175a7d[_0x2b2f('0x4e')][_0x2b2f('0x51')];return db[_0x2b2f('0x3e')]['create'](_0x175a7d['body'])[_0x2b2f('0x26')](respondWithResult(_0xca4182,0xc9))[_0x2b2f('0x43')](handleError(_0xca4182,null));};exports[_0x2b2f('0x52')]=function(_0x353247,_0x27feb1,_0x199c9b){return db['Attachment'][_0x2b2f('0x53')]({'where':{'id':_0x353247[_0x2b2f('0x44')]['id']},'raw':!![]})[_0x2b2f('0x26')](handleEntityNotFound(_0x27feb1,null))[_0x2b2f('0x26')](function(_0x55d296){if(_0x55d296){var _0x478ae7=_0x55d296[_0x2b2f('0x54')]!==null;var _0x376758=path['join'](config['root'],_0x2b2f('0x55'));if(_0x478ae7){_0x376758=path[_0x2b2f('0x56')](_0x376758,_0x2b2f('0x57'));}var _0x22a9f0=path[_0x2b2f('0x56')](_0x376758,_0x55d296[_0x2b2f('0x58')]);return _0x27feb1[_0x2b2f('0x52')](_0x22a9f0);}})[_0x2b2f('0x43')](handleError(_0x27feb1,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8182b62..7789de8 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 _0xe2e2=['bluebird','path','rimraf','../../config/environment','exports','define','attachments','util','../../config/logger','api','moment'];(function(_0x4547d5,_0x91d898){var _0x81ad1f=function(_0x593655){while(--_0x593655){_0x4547d5['push'](_0x4547d5['shift']());}};_0x81ad1f(++_0x91d898);}(_0xe2e2,0x10f));var _0x2e2e=function(_0x3b6413,_0x46403a){_0x3b6413=_0x3b6413-0x0;var _0x3da71a=_0xe2e2[_0x3b6413];return _0x3da71a;};'use strict';var _=require('lodash');var util=require(_0x2e2e('0x0'));var logger=require(_0x2e2e('0x1'))(_0x2e2e('0x2'));var moment=require(_0x2e2e('0x3'));var BPromise=require(_0x2e2e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e2e('0x5'));var rimraf=require(_0x2e2e('0x6'));var config=require(_0x2e2e('0x7'));var attributes=require('./attachment.attributes');module[_0x2e2e('0x8')]=function(_0x2ada93,_0x5e25ed){return _0x2ada93[_0x2e2e('0x9')]('Attachment',attributes,{'tableName':_0x2e2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcdb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Attachment','attachments'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0xbcdb,0xe4));var _0xbbcd=function(_0x31362c,_0x46b97d){_0x31362c=_0x31362c-0x0;var _0x341918=_0xbcdb[_0x31362c];return _0x341918;};'use strict';var _=require('lodash');var util=require(_0xbbcd('0x0'));var logger=require(_0xbbcd('0x1'))(_0xbbcd('0x2'));var moment=require(_0xbbcd('0x3'));var BPromise=require(_0xbbcd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbcd('0x5'));var rimraf=require(_0xbbcd('0x6'));var config=require(_0xbbcd('0x7'));var attributes=require('./attachment.attributes');module[_0xbbcd('0x8')]=function(_0x1273af,_0x500596){return _0x1273af[_0xbbcd('0x9')](_0xbbcd('0xa'),attributes,{'tableName':_0xbbcd('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 fedac5c..a2d2838 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 _0x3a25=['jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c29bd,_0x3b2dd){var _0x451ecd=function(_0x2b6033){while(--_0x2b6033){_0x3c29bd['push'](_0x3c29bd['shift']());}};_0x451ecd(++_0x3b2dd);}(_0x3a25,0x15d));var _0x53a2=function(_0x23fc84,_0x2faf64){_0x23fc84=_0x23fc84-0x0;var _0x81fb8=_0x3a25[_0x23fc84];return _0x81fb8;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('Attachment,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});}exports[_0x53a2('0x1a')]=function(_0x446b71){var _0x443c6e=this;return new Promise(function(_0x104fb6,_0x1d23f2){return db[_0x53a2('0x1b')]['create'](_0x446b71['body'],{'raw':_0x446b71[_0x53a2('0x1c')]?_0x446b71[_0x53a2('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x53a2('0xf')](function(_0x3fb15b){logger[_0x53a2('0x10')](_0x53a2('0x1a'),_0x446b71);logger['debug'](_0x53a2('0x1a'),_0x446b71,JSON[_0x53a2('0x1d')](_0x3fb15b));_0x104fb6(_0x3fb15b);})[_0x53a2('0x19')](function(_0x2cda68){logger[_0x53a2('0x15')](_0x53a2('0x1a'),_0x2cda68[_0x53a2('0x17')],_0x446b71);_0x1d23f2(_0x443c6e[_0x53a2('0x15')](0x1f4,_0x2cda68['message']));});});}; \ No newline at end of file +var _0x22fb=['message','error','result','catch','Attachment','create','options','raw','CreateAttachment','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x22fb,0x192));var _0xb22f=function(_0x3fdabd,_0x4f21c3){_0x3fdabd=_0x3fdabd-0x0;var _0x323f9b=_0x22fb[_0x3fdabd];return _0x323f9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('Attachment,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});}exports['CreateAttachment']=function(_0x252742){var _0x35caec=this;return new Promise(function(_0x2aaec4,_0x1f515d){return db[_0xb22f('0x16')][_0xb22f('0x17')](_0x252742['body'],{'raw':_0x252742[_0xb22f('0x18')]?_0x252742['options'][_0xb22f('0x19')]===undefined?!![]:![]:!![]})[_0xb22f('0xb')](function(_0x316f11){logger[_0xb22f('0xc')](_0xb22f('0x1a'),_0x252742);logger['debug']('CreateAttachment',_0x252742,JSON[_0xb22f('0x1b')](_0x316f11));_0x2aaec4(_0x316f11);})[_0xb22f('0x15')](function(_0xf34e0d){logger[_0xb22f('0x13')](_0xb22f('0x1a'),_0xf34e0d[_0xb22f('0x12')],_0x252742);_0x1f515d(_0x35caec[_0xb22f('0x13')](0x1f4,_0xf34e0d[_0xb22f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b2ba38f..f65c468 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +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(_0x20daa8,_0x1022a4){var _0xdada56=function(_0x528750){while(--_0x528750){_0x20daa8['push'](_0x20daa8['shift']());}};_0xdada56(++_0x1022a4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30bea1,_0x468ea6){_0x30bea1=_0x30bea1-0x0;var _0xa2e99c=_0x5f2f[_0x30bea1];return _0xa2e99c;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index fc07271..fba8bc7 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 _0x229e=['activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','blockDuration','then','adSsoEnabled','password','role','blocked','blockedAt','admin','agent','name','disabled','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','moment'];(function(_0x2dc954,_0xd124a){var _0x4dd96a=function(_0x3084f2){while(--_0x3084f2){_0x2dc954['push'](_0x2dc954['shift']());}};_0x4dd96a(++_0xd124a);}(_0x229e,0x12f));var _0xe229=function(_0x46b96d,_0x261e67){_0x46b96d=_0x46b96d-0x0;var _0x1a60e2=_0x229e[_0x46b96d];return _0x1a60e2;};'use strict';var passport=require(_0xe229('0x0'));var LocalStrategy=require(_0xe229('0x1'))['Strategy'];var moment=require(_0xe229('0x2'));var ActiveDirectory=require(_0xe229('0x3'));var BPromise=require(_0xe229('0x4'));var util=require(_0xe229('0x5'));var db=require(_0xe229('0x6'))['db'];var authService=require(_0xe229('0x7'));var utils=require(_0xe229('0x8'));var config=require(_0xe229('0x9'));var logger=require(_0xe229('0xa'))(_0xe229('0xb'));function isActiveDirectoryConfigured(_0x1d55e0){var _0x109044=![];if(typeof _0x1d55e0[_0xe229('0xc')]!==_0xe229('0xd')){_0x109044=_0x1d55e0[_0xe229('0xc')][_0xe229('0xe')]&&_0x1d55e0['activedirectory'][_0xe229('0xf')]&&_0x1d55e0['activedirectory'][_0xe229('0x10')];}return _0x109044;}function adAuthenticate(_0x3efa43,_0xa8197c,_0x52980e){return new BPromise(function(_0xb577b9,_0x331a41){try{var _0x1b8ae5=new ActiveDirectory(_0x3efa43);_0x1b8ae5['authenticate'](_0xa8197c,_0x52980e,function(_0x69c952,_0x499a7d){if(_0x69c952){logger[_0xe229('0x11')](_0xe229('0x12'),_0xa8197c,util[_0xe229('0x13')](_0x69c952,{'showHidden':![],'depth':null}));_0x331a41('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x499a7d){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0xa8197c);_0x331a41('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xb577b9(_0x499a7d);}});}catch(_0xd0c4ef){_0x331a41(_0xd0c4ef);}});}function ActiveDirectoryAuthenticate(_0x462808,_0x54b4e4,_0x239a29,_0x2d2102){var _0x24eb1b,_0x3f8d1e;if(!isActiveDirectoryConfigured(config)){logger[_0xe229('0x11')](_0xe229('0x14'),_0x54b4e4);return _0x2d2102(null,![],{'message':_0xe229('0x15')});}return db[_0xe229('0x16')][_0xe229('0x17')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xe229('0x18')],'raw':!![]})[_0xe229('0x19')](function(_0x58f7c5){_0x24eb1b=_0x58f7c5;if(!_0x24eb1b[_0xe229('0x1a')]){logger[_0xe229('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x54b4e4);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x462808[_0xe229('0x17')]({'attributes':['id','name',_0xe229('0x1b'),'salt',_0xe229('0x1c'),'disabled',_0xe229('0x1d'),_0xe229('0x1e'),'online'],'where':{'name':_0x54b4e4,'role':{'$or':[_0xe229('0x1f'),'user',_0xe229('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x2bc8b3){if(!_0x2bc8b3||_0x2bc8b3&&_0x2bc8b3[_0xe229('0x21')]!==_0x54b4e4){throw new Error(_0xe229('0x15'));}_0x3f8d1e=_0x2bc8b3;var _0x14c927=_0x3f8d1e[_0xe229('0x21')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xe229('0xc')],_0x14c927,_0x239a29);})[_0xe229('0x19')](function(_0x466c05){if(_0x3f8d1e[_0xe229('0x22')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x24eb1b['blockDuration']>0x0){if(_0x3f8d1e[_0xe229('0x1d')]){if(moment(_0x3f8d1e[_0xe229('0x1e')])[_0xe229('0x23')](_0x24eb1b[_0xe229('0x18')],_0xe229('0x24'))>moment()){throw new Error(_0xe229('0x15'));}return utils[_0xe229('0x25')](_0x3f8d1e,0x0,![],null)['then'](function(){return utils[_0xe229('0x26')](_0x3f8d1e);})[_0xe229('0x19')](function(){return _0x2d2102(null,_0x3f8d1e);});}else{return utils['getLicense'](_0x3f8d1e)[_0xe229('0x19')](function(){return _0x2d2102(null,_0x3f8d1e);});}}else{return utils[_0xe229('0x26')](_0x3f8d1e)[_0xe229('0x19')](function(){return _0x2d2102(null,_0x3f8d1e);});}})[_0xe229('0x27')](function(_0x5a8d5b){return _0x2d2102(null,![],_0x5a8d5b);});}function handleError(_0x44be0e,_0x2aedef,_0x2a429a){return _0x44be0e[_0xe229('0x28')](_0x2aedef||0x1f4)[_0xe229('0x29')]({'message':_0x2a429a?_0x2a429a[_0xe229('0x2a')]||_0x2a429a:''});}exports[_0xe229('0x2b')]=function(_0x2a5977,_0x3d532c,_0xe2c571){passport[_0xe229('0x2c')](_0xe229('0x2d'),function(_0x315fd8,_0x4eeb5b,_0x516ec2){var _0x2734a0=_0x315fd8||_0x516ec2;if(_0x2734a0){return handleError(_0x3d532c,0x191,_0x2734a0);}if(!_0x4eeb5b){return handleError(_0x3d532c,0x194,{'message':_0xe229('0x2e')});}else{var _0x4a48eb={'payload':{'id':_0x4eeb5b['id'],'role':_0x4eeb5b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4a48eb)[_0xe229('0x19')](function(_0x582589){_0x3d532c[_0xe229('0x2f')]({'id':_0x4eeb5b['id'],'token':_0x582589,'statusCall':'','isAlreadyLogged':_0x4eeb5b[_0xe229('0x30')]});});}})(_0x2a5977,_0x3d532c,_0xe2c571);};passport[_0xe229('0x31')](_0xe229('0x2d'),new LocalStrategy({'usernameField':_0xe229('0x21'),'passwordField':_0xe229('0x1b')},function(_0x570b0c,_0x589078,_0x1465fc){return ActiveDirectoryAuthenticate(db[_0xe229('0x32')],_0x570b0c,_0x589078,_0x1465fc);})); \ No newline at end of file +var _0xcbba=['../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','then','blockDuration','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','password','User','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x23b349,_0xf34aaa){var _0x32ef80=function(_0x1d5660){while(--_0x1d5660){_0x23b349['push'](_0x23b349['shift']());}};_0x32ef80(++_0xf34aaa);}(_0xcbba,0x16a));var _0xacbb=function(_0x263b36,_0x988d3c){_0x263b36=_0x263b36-0x0;var _0x64387b=_0xcbba[_0x263b36];return _0x64387b;};'use strict';var passport=require(_0xacbb('0x0'));var LocalStrategy=require('passport-local')[_0xacbb('0x1')];var moment=require(_0xacbb('0x2'));var ActiveDirectory=require(_0xacbb('0x3'));var BPromise=require(_0xacbb('0x4'));var util=require(_0xacbb('0x5'));var db=require(_0xacbb('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xacbb('0x7'));var config=require(_0xacbb('0x8'));var logger=require(_0xacbb('0x9'))(_0xacbb('0xa'));function isActiveDirectoryConfigured(_0x30e358){var _0x452740=![];if(typeof _0x30e358[_0xacbb('0xb')]!==_0xacbb('0xc')){_0x452740=_0x30e358[_0xacbb('0xb')][_0xacbb('0xd')]&&_0x30e358[_0xacbb('0xb')][_0xacbb('0xe')]&&_0x30e358[_0xacbb('0xb')][_0xacbb('0xf')];}return _0x452740;}function adAuthenticate(_0x390018,_0x1a87db,_0x117374){return new BPromise(function(_0x494708,_0xb163e){try{var _0x74fb8c=new ActiveDirectory(_0x390018);_0x74fb8c[_0xacbb('0x10')](_0x1a87db,_0x117374,function(_0x3f05b8,_0x144efe){if(_0x3f05b8){logger[_0xacbb('0x11')](_0xacbb('0x12'),_0x1a87db,util[_0xacbb('0x13')](_0x3f05b8,{'showHidden':![],'depth':null}));_0xb163e(_0xacbb('0x14'));}else if(!_0x144efe){logger[_0xacbb('0x11')](_0xacbb('0x15'),_0x1a87db);_0xb163e(_0xacbb('0x14'));}else{_0x494708(_0x144efe);}});}catch(_0x55ada0){_0xb163e(_0x55ada0);}});}function ActiveDirectoryAuthenticate(_0x34b2ba,_0x22ef55,_0x23f8f4,_0x3b178b){var _0x5c438b,_0x2d9dd2;if(!isActiveDirectoryConfigured(config)){logger[_0xacbb('0x11')](_0xacbb('0x16'),_0x22ef55);return _0x3b178b(null,![],{'message':_0xacbb('0x14')});}return db['Setting'][_0xacbb('0x17')]({'where':{'id':0x1},'attributes':[_0xacbb('0x18'),'blockDuration'],'raw':!![]})['then'](function(_0x5c4c58){_0x5c438b=_0x5c4c58;if(!_0x5c438b[_0xacbb('0x18')]){logger[_0xacbb('0x11')](_0xacbb('0x19'),_0x22ef55);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x34b2ba['findOne']({'attributes':['id',_0xacbb('0x1a'),'password',_0xacbb('0x1b'),_0xacbb('0x1c'),_0xacbb('0x1d'),_0xacbb('0x1e'),_0xacbb('0x1f'),_0xacbb('0x20')],'where':{'name':_0x22ef55,'role':{'$or':[_0xacbb('0x21'),_0xacbb('0x22'),_0xacbb('0x23')]},'adSsoEnabled':!![]}});})[_0xacbb('0x24')](function(_0x28cba4){if(!_0x28cba4||_0x28cba4&&_0x28cba4['name']!==_0x22ef55){throw new Error(_0xacbb('0x14'));}_0x2d9dd2=_0x28cba4;var _0x1fe481=_0x2d9dd2[_0xacbb('0x1a')]+'@'+config[_0xacbb('0xb')][_0xacbb('0xf')];return adAuthenticate(config[_0xacbb('0xb')],_0x1fe481,_0x23f8f4);})['then'](function(_0x437217){if(_0x2d9dd2[_0xacbb('0x1d')]){throw new Error(_0xacbb('0x14'));}if(_0x5c438b[_0xacbb('0x25')]>0x0){if(_0x2d9dd2[_0xacbb('0x1e')]){if(moment(_0x2d9dd2[_0xacbb('0x1f')])[_0xacbb('0x26')](_0x5c438b[_0xacbb('0x25')],_0xacbb('0x27'))>moment()){throw new Error(_0xacbb('0x14'));}return utils[_0xacbb('0x28')](_0x2d9dd2,0x0,![],null)[_0xacbb('0x24')](function(){return utils[_0xacbb('0x29')](_0x2d9dd2);})[_0xacbb('0x24')](function(){return _0x3b178b(null,_0x2d9dd2);});}else{return utils[_0xacbb('0x29')](_0x2d9dd2)[_0xacbb('0x24')](function(){return _0x3b178b(null,_0x2d9dd2);});}}else{return utils[_0xacbb('0x29')](_0x2d9dd2)[_0xacbb('0x24')](function(){return _0x3b178b(null,_0x2d9dd2);});}})['catch'](function(_0x1fe214){return _0x3b178b(null,![],_0x1fe214);});}function handleError(_0x321110,_0x351502,_0x2c7de9){return _0x321110[_0xacbb('0x2a')](_0x351502||0x1f4)[_0xacbb('0x2b')]({'message':_0x2c7de9?_0x2c7de9[_0xacbb('0x2c')]||_0x2c7de9:''});}exports[_0xacbb('0x2d')]=function(_0x372dda,_0x3df636,_0x530416){passport[_0xacbb('0x10')](_0xacbb('0x2e'),function(_0x3b3f4e,_0x12533a,_0x274cc5){var _0x227006=_0x3b3f4e||_0x274cc5;if(_0x227006){return handleError(_0x3df636,0x191,_0x227006);}if(!_0x12533a){return handleError(_0x3df636,0x194,{'message':_0xacbb('0x2f')});}else{var _0x312ec5={'payload':{'id':_0x12533a['id'],'role':_0x12533a[_0xacbb('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0xacbb('0x30')](_0x312ec5)[_0xacbb('0x24')](function(_0x5a9d3a){_0x3df636[_0xacbb('0x31')]({'id':_0x12533a['id'],'token':_0x5a9d3a,'statusCall':'','isAlreadyLogged':_0x12533a[_0xacbb('0x20')]});});}})(_0x372dda,_0x3df636,_0x530416);};passport[_0xacbb('0x32')](_0xacbb('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0xacbb('0x33')},function(_0x1a1f7d,_0x2ed80a,_0x53789c){return ActiveDirectoryAuthenticate(db[_0xacbb('0x34')],_0x1a1f7d,_0x2ed80a,_0x53789c);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 11bd273..45e531c 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 _0x9b0a=['./authActiveDirectory.controller','post','exports'];(function(_0x4e59ea,_0x3a9ec7){var _0x59e499=function(_0x212203){while(--_0x212203){_0x4e59ea['push'](_0x4e59ea['shift']());}};_0x59e499(++_0x3a9ec7);}(_0x9b0a,0x19e));var _0xa9b0=function(_0x1a7fa7,_0x231925){_0x1a7fa7=_0x1a7fa7-0x0;var _0x4051de=_0x9b0a[_0x1a7fa7];return _0x4051de;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xa9b0('0x0'));router[_0xa9b0('0x1')]('/',controller['login']);module[_0xa9b0('0x2')]=router; \ No newline at end of file +var _0xb626=['./authActiveDirectory.controller','post','express','Router'];(function(_0x506477,_0x45b375){var _0x176218=function(_0x3d7d0c){while(--_0x3d7d0c){_0x506477['push'](_0x506477['shift']());}};_0x176218(++_0x45b375);}(_0xb626,0x17a));var _0x6b62=function(_0x43f1f4,_0x2207b6){_0x43f1f4=_0x43f1f4-0x0;var _0x3b5c46=_0xb626[_0x43f1f4];return _0x3b5c46;};'use strict';var express=require(_0x6b62('0x0'));var router=express[_0x6b62('0x1')]();var controller=require(_0x6b62('0x2'));router[_0x6b62('0x3')]('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 6526e5c..edc30e6 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(_0x58f8d3,_0x4cfe56){var _0x32c52b=function(_0x5203d8){while(--_0x5203d8){_0x58f8d3['push'](_0x58f8d3['shift']());}};_0x32c52b(++_0x4cfe56);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x114693,_0x21e8ba){var _0xc04995=function(_0x4fa7a9){while(--_0x4fa7a9){_0x114693['push'](_0x114693['shift']());}};_0xc04995(++_0x21e8ba);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9090024..5a58816 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 _0x786b=['passport','Router','../user/user.controller.js','../../components/auth/service','get','login','setTokenCookie','exports','express'];(function(_0x2608f2,_0x30abd2){var _0x478ee6=function(_0x570e28){while(--_0x570e28){_0x2608f2['push'](_0x2608f2['shift']());}};_0x478ee6(++_0x30abd2);}(_0x786b,0x74));var _0xb786=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x786b[_0x456fb1];return _0x4083d6;};'use strict';var express=require(_0xb786('0x0'));var passport=require(_0xb786('0x1'));var router=express[_0xb786('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xb786('0x3'));var authService=require(_0xb786('0x4'));router[_0xb786('0x5')]('/',controller[_0xb786('0x6')]);router[_0xb786('0x5')]('/callback',controller['callback'],authService['isMiddleware'],userController[_0xb786('0x6')],authService[_0xb786('0x7')]);module[_0xb786('0x8')]=router; \ No newline at end of file +var _0xe25e=['get','/callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x47dd48,_0x33c6e2){var _0x31e99e=function(_0xcde139){while(--_0xcde139){_0x47dd48['push'](_0x47dd48['shift']());}};_0x31e99e(++_0x33c6e2);}(_0xe25e,0x10c));var _0xee25=function(_0x5bd613,_0x151a02){_0x5bd613=_0x5bd613-0x0;var _0x62f674=_0xe25e[_0x5bd613];return _0x62f674;};'use strict';var express=require('express');var passport=require(_0xee25('0x0'));var router=express[_0xee25('0x1')]();var controller=require(_0xee25('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xee25('0x3'));router[_0xee25('0x4')]('/',controller['login']);router['get'](_0xee25('0x5'),controller['callback'],authService[_0xee25('0x6')],userController['login'],authService[_0xee25('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a7f65b7..20a043d 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 _0x6c6c=['login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','Smtp','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send'];(function(_0x430b69,_0xe239db){var _0x46cf15=function(_0x2baecd){while(--_0x2baecd){_0x430b69['push'](_0x430b69['shift']());}};_0x46cf15(++_0xe239db);}(_0x6c6c,0xd0));var _0xc6c6=function(_0x52e38c,_0x2f1f97){_0x52e38c=_0x52e38c-0x0;var _0xfd46c6=_0x6c6c[_0x52e38c];return _0xfd46c6;};'use strict';var util=require(_0xc6c6('0x0'));var passport=require(_0xc6c6('0x1'));var LocalStrategy=require(_0xc6c6('0x2'))['Strategy'];var jayson=require(_0xc6c6('0x3'));var _=require(_0xc6c6('0x4'));var rs=require('randomstring');var moment=require(_0xc6c6('0x5'));var db=require(_0xc6c6('0x6'))['db'];var authService=require(_0xc6c6('0x7'));var utils=require(_0xc6c6('0x8'));var client=jayson[_0xc6c6('0x9')][_0xc6c6('0xa')]({'port':0x232b});function localAuthenticate(_0x5e7be3,_0x4b8d54,_0x1b4dc8,_0x4dbe0a){var _0x2f7ba2,_0x44276e;return db[_0xc6c6('0xb')][_0xc6c6('0xc')]({'where':{'id':0x1},'attributes':[_0xc6c6('0xd'),_0xc6c6('0xe')],'raw':!![]})[_0xc6c6('0xf')](function(_0x20ad59){_0x2f7ba2=_0x20ad59;return _0x5e7be3[_0xc6c6('0xc')]({'attributes':['id',_0xc6c6('0x10'),_0xc6c6('0x11'),_0xc6c6('0x12'),_0xc6c6('0x13'),_0xc6c6('0x14'),'blocked','blockedAt','loginAttempts'],'where':{'name':_0x4b8d54,'role':{'$or':[_0xc6c6('0x15'),_0xc6c6('0x16'),_0xc6c6('0x17')]}}});})[_0xc6c6('0xf')](function(_0x2a4646){if(!_0x2a4646||_0x2a4646&&_0x2a4646[_0xc6c6('0x10')]!==_0x4b8d54){throw new Error(_0xc6c6('0x18'));}else{_0x44276e=_0x2a4646;return _0x44276e;}})[_0xc6c6('0xf')](function(){_0x44276e['authenticate'](_0x1b4dc8,function(_0x5601b5,_0x595d36){var _0x1e355f=_0x44276e[_0xc6c6('0x19')]+0x1;if(_0x5601b5){return _0x4dbe0a(_0x5601b5);}else if(!_0x595d36){if(_0x44276e[_0xc6c6('0x14')]){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});}else if(_0x2f7ba2[_0xc6c6('0xd')]>0x0){if(_0x44276e[_0xc6c6('0x1a')]){if(_0x2f7ba2[_0xc6c6('0xe')]>0x0){if(moment(_0x44276e[_0xc6c6('0x1b')])[_0xc6c6('0x1c')](_0x2f7ba2['blockDuration'],_0xc6c6('0x1d'))>moment()){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});}else{return utils[_0xc6c6('0x1e')](_0x44276e,_0x1e355f,![],null)['then'](function(){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});});}}else{return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});}}else{if(_0x1e355f>=_0x2f7ba2['allowedLoginAttempts']){return utils[_0xc6c6('0x1e')](_0x44276e,0x0,!![],moment())[_0xc6c6('0xf')](function(){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});});}else{return utils[_0xc6c6('0x1e')](_0x44276e,_0x1e355f,![],null)['then'](function(){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});});}}}else{return _0x4dbe0a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x44276e[_0xc6c6('0x14')]){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});}else if(_0x2f7ba2[_0xc6c6('0xd')]>0x0){if(_0x44276e[_0xc6c6('0x1a')]){if(_0x2f7ba2[_0xc6c6('0xe')]>0x0){if(moment(_0x44276e[_0xc6c6('0x1b')])[_0xc6c6('0x1c')](_0x2f7ba2['blockDuration'],'minutes')>moment()){return _0x4dbe0a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6c6('0x1e')](_0x44276e,0x0,![],null)[_0xc6c6('0xf')](function(){return utils['getLicense'](_0x44276e);})[_0xc6c6('0xf')](function(){return _0x4dbe0a(null,_0x44276e);});}}else{return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});}}else{return utils[_0xc6c6('0x1e')](_0x44276e,0x0,![],null)[_0xc6c6('0xf')](function(){return utils[_0xc6c6('0x1f')](_0x44276e);})[_0xc6c6('0xf')](function(){return _0x4dbe0a(null,_0x44276e);})[_0xc6c6('0x20')](function(_0x53b653){return _0x4dbe0a(null,![],_0x53b653);});}}else{if(_0x44276e[_0xc6c6('0x1a')]){return _0x4dbe0a(null,![],{'message':_0xc6c6('0x18')});}else{return utils['getLicense'](_0x44276e)[_0xc6c6('0xf')](function(){return _0x4dbe0a(null,_0x44276e);});}}}});})[_0xc6c6('0x20')](function(_0x4e8731){return _0x4dbe0a(null,![],_0x4e8731);});}function sendServiceMail(_0x47d904){return db[_0xc6c6('0x21')][_0xc6c6('0x22')]({'where':{'service':!![]},'attributes':['id',_0xc6c6('0x10'),'email'],'include':[{'model':db[_0xc6c6('0x23')],'as':'Smtp','include':[{'model':db[_0xc6c6('0x24')],'as':_0xc6c6('0x24')}]}]})['then'](function(_0x3b7d9b){if(!_0x3b7d9b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3bc4e2=_0x3b7d9b[_0xc6c6('0x25')]();var _0x110931={'account':_0x3bc4e2,'message':_[_0xc6c6('0x26')]({'from':util[_0xc6c6('0x27')](_0xc6c6('0x28'),_0x3b7d9b[_0xc6c6('0x10')],_0x3b7d9b[_0xc6c6('0x29')]||_0x3b7d9b[_0xc6c6('0x2a')][_0xc6c6('0x16')])},_0x47d904)};return client['request'](_0xc6c6('0x2b'),_0x110931);})[_0xc6c6('0xf')](function(_0x1ac9f6){if(_0x1ac9f6[_0xc6c6('0x2c')]){throw new Error(util[_0xc6c6('0x27')](_0xc6c6('0x2d'),_0x1ac9f6[_0xc6c6('0x2c')][_0xc6c6('0x2e')]||JSON[_0xc6c6('0x2f')](_0x1ac9f6[_0xc6c6('0x2c')])));}return!![];});}function handleError(_0x228970,_0x1f191e,_0x41a4ae){return _0x228970[_0xc6c6('0x30')](_0x1f191e||0x1f4)[_0xc6c6('0x31')]({'message':_0x41a4ae?_0x41a4ae['message']||_0x41a4ae:''});}exports[_0xc6c6('0x32')]=function(_0x3246b3,_0x303dff,_0x44c2f5){passport[_0xc6c6('0x33')](_0xc6c6('0x34'),function(_0x5830bd,_0x2d77db,_0x2c0ce5){var _0x35a752=_0x5830bd||_0x2c0ce5;if(_0x35a752){return handleError(_0x303dff,0x191,_0x35a752);}if(!_0x2d77db){return handleError(_0x303dff,0x194,{'message':_0xc6c6('0x35')});}else{var _0x2a29d3={'payload':{'id':_0x2d77db['id'],'role':_0x2d77db[_0xc6c6('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xc6c6('0x36')](_0x2a29d3)[_0xc6c6('0xf')](function(_0x524284){_0x303dff['json']({'id':_0x2d77db['id'],'token':_0x524284,'statusCall':'','isAlreadyLogged':_0x2d77db[_0xc6c6('0x37')]});});}})(_0x3246b3,_0x303dff,_0x44c2f5);};exports[_0xc6c6('0x38')]=function(_0x26e2fe,_0x39a191){if(!_0x26e2fe[_0xc6c6('0x39')][_0xc6c6('0x29')]){return handleError(_0x39a191,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x444f55=rs[_0xc6c6('0x3a')]();_0x26e2fe['body']['email']=_0x26e2fe[_0xc6c6('0x39')][_0xc6c6('0x29')][_0xc6c6('0x3b')]()['toLowerCase']();var _0x1d1af3;return db[_0xc6c6('0xb')][_0xc6c6('0xc')]({'where':{'id':0x1},'attributes':[_0xc6c6('0xd'),_0xc6c6('0xe')],'raw':!![]})['then'](function(_0x28fe5b){_0x1d1af3=_0x28fe5b;return db[_0xc6c6('0x3c')]['find']({'where':{'email':_0x26e2fe[_0xc6c6('0x39')][_0xc6c6('0x29')]}});})[_0xc6c6('0xf')](function(_0x183cdb){if(!_0x183cdb){throw new Error(_0xc6c6('0x3d'));}if(_0x183cdb[_0xc6c6('0x14')]){throw new Error(_0xc6c6('0x3e'));}if(_0x183cdb['blocked']){if(moment(_0x183cdb[_0xc6c6('0x1b')])['add'](_0x1d1af3[_0xc6c6('0xe')],_0xc6c6('0x1d'))>moment()){throw new Error(_0xc6c6('0x3f'));}else{_0x183cdb['blocked']=![];_0x183cdb[_0xc6c6('0x1b')]=null;}}_0x183cdb[_0xc6c6('0x40')]=_0x444f55;_0x183cdb[_0xc6c6('0x41')]=Date[_0xc6c6('0x42')]()+0x36ee80;return _0x183cdb['save']();})[_0xc6c6('0xf')](function(){return sendServiceMail({'to':_0x26e2fe[_0xc6c6('0x39')]['email'],'subject':_0xc6c6('0x43'),'text':_0xc6c6('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x26e2fe[_0xc6c6('0x45')][_0xc6c6('0x46')]+_0xc6c6('0x47')+_0x444f55+'\x0a\x0a'+_0xc6c6('0x48')});})[_0xc6c6('0xf')](function(){_0x39a191['status'](0xc8)[_0xc6c6('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0xc6c6('0x20')](function(_0x4402d2){return handleError(_0x39a191,0x1f4,_0x4402d2);});};exports[_0xc6c6('0x49')]=function(_0x990fb2,_0x4d03d7){return db[_0xc6c6('0x3c')][_0xc6c6('0x22')]({'where':{'resetPasswordToken':_0x990fb2[_0xc6c6('0x4a')][_0xc6c6('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xc6c6('0x42')]()}}})['then'](function(_0x3f370d){if(!_0x3f370d){throw new Error(_0xc6c6('0x4c'));}return db['Setting']['findOne']({'attributes':['id',_0xc6c6('0x4d'),_0xc6c6('0x4e'),_0xc6c6('0x4f')]})[_0xc6c6('0xf')](function(_0x3f3c39){if(_0x3f3c39[_0xc6c6('0x4d')])authService[_0xc6c6('0x50')](_0x990fb2[_0xc6c6('0x39')][_0xc6c6('0x11')]);if(!_0x3f3c39['enforcePasswordHistory']||!_0x3f370d[_0xc6c6('0x51')])return _0x3f370d;authService[_0xc6c6('0x52')](_0x990fb2['body'][_0xc6c6('0x11')],_0x3f370d[_0xc6c6('0x51')],_0x3f3c39[_0xc6c6('0x4f')]);return _0x3f370d;})[_0xc6c6('0xf')](function(){_0x3f370d['password']=_0x990fb2[_0xc6c6('0x39')]['password'];_0x3f370d[_0xc6c6('0x40')]=null;_0x3f370d[_0xc6c6('0x41')]=null;return _0x3f370d[_0xc6c6('0x53')]();});})[_0xc6c6('0xf')](function(){_0x4d03d7[_0xc6c6('0x30')](0xc8)[_0xc6c6('0x31')]({'message':_0xc6c6('0x54')});})[_0xc6c6('0x20')](function(_0x1e7659){return handleError(_0x4d03d7,0x1f4,_0x1e7659);});};passport[_0xc6c6('0x55')](_0xc6c6('0x34'),new LocalStrategy({'usernameField':_0xc6c6('0x10'),'passwordField':'password'},function(_0x1b1f98,_0x555d97,_0x34892e){return localAuthenticate(db[_0xc6c6('0x3c')],_0x1b1f98,_0x555d97,_0x34892e);})); \ No newline at end of file +var _0x7bd7=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','disabled','blocked','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset'];(function(_0x5c7158,_0x40146f){var _0x526bc4=function(_0x58260f){while(--_0x58260f){_0x5c7158['push'](_0x5c7158['shift']());}};_0x526bc4(++_0x40146f);}(_0x7bd7,0x173));var _0x77bd=function(_0x54a166,_0x259c8f){_0x54a166=_0x54a166-0x0;var _0x2c4472=_0x7bd7[_0x54a166];return _0x2c4472;};'use strict';var util=require(_0x77bd('0x0'));var passport=require(_0x77bd('0x1'));var LocalStrategy=require(_0x77bd('0x2'))[_0x77bd('0x3')];var jayson=require(_0x77bd('0x4'));var _=require('lodash');var rs=require(_0x77bd('0x5'));var moment=require(_0x77bd('0x6'));var db=require(_0x77bd('0x7'))['db'];var authService=require(_0x77bd('0x8'));var utils=require('../../config/utils');var client=jayson[_0x77bd('0x9')][_0x77bd('0xa')]({'port':0x232b});function localAuthenticate(_0x4ab0ba,_0x7d389c,_0x22ce4c,_0x974de0){var _0x6cee37,_0x1407e3;return db[_0x77bd('0xb')][_0x77bd('0xc')]({'where':{'id':0x1},'attributes':[_0x77bd('0xd'),_0x77bd('0xe')],'raw':!![]})[_0x77bd('0xf')](function(_0x280d93){_0x6cee37=_0x280d93;return _0x4ab0ba[_0x77bd('0xc')]({'attributes':['id',_0x77bd('0x10'),'password',_0x77bd('0x11'),_0x77bd('0x12'),_0x77bd('0x13'),_0x77bd('0x14'),'blockedAt',_0x77bd('0x15')],'where':{'name':_0x7d389c,'role':{'$or':[_0x77bd('0x16'),_0x77bd('0x17'),_0x77bd('0x18')]}}});})['then'](function(_0x4edd38){if(!_0x4edd38||_0x4edd38&&_0x4edd38[_0x77bd('0x10')]!==_0x7d389c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1407e3=_0x4edd38;return _0x1407e3;}})[_0x77bd('0xf')](function(){_0x1407e3[_0x77bd('0x19')](_0x22ce4c,function(_0x34082e,_0x113427){var _0x57c06d=_0x1407e3[_0x77bd('0x15')]+0x1;if(_0x34082e){return _0x974de0(_0x34082e);}else if(!_0x113427){if(_0x1407e3[_0x77bd('0x13')]){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}else if(_0x6cee37['allowedLoginAttempts']>0x0){if(_0x1407e3[_0x77bd('0x14')]){if(_0x6cee37[_0x77bd('0xe')]>0x0){if(moment(_0x1407e3['blockedAt'])[_0x77bd('0x1b')](_0x6cee37[_0x77bd('0xe')],_0x77bd('0x1c'))>moment()){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}else{return utils[_0x77bd('0x1d')](_0x1407e3,_0x57c06d,![],null)['then'](function(){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});});}}else{return _0x974de0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x57c06d>=_0x6cee37[_0x77bd('0xd')]){return utils[_0x77bd('0x1d')](_0x1407e3,0x0,!![],moment())['then'](function(){return _0x974de0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x77bd('0x1d')](_0x1407e3,_0x57c06d,![],null)['then'](function(){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});});}}}else{return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}}else{if(_0x1407e3['disabled']){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}else if(_0x6cee37[_0x77bd('0xd')]>0x0){if(_0x1407e3[_0x77bd('0x14')]){if(_0x6cee37[_0x77bd('0xe')]>0x0){if(moment(_0x1407e3[_0x77bd('0x1e')])[_0x77bd('0x1b')](_0x6cee37[_0x77bd('0xe')],_0x77bd('0x1c'))>moment()){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}else{return utils[_0x77bd('0x1d')](_0x1407e3,0x0,![],null)[_0x77bd('0xf')](function(){return utils[_0x77bd('0x1f')](_0x1407e3);})[_0x77bd('0xf')](function(){return _0x974de0(null,_0x1407e3);});}}else{return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}}else{return utils['clearBlockUser'](_0x1407e3,0x0,![],null)[_0x77bd('0xf')](function(){return utils['getLicense'](_0x1407e3);})[_0x77bd('0xf')](function(){return _0x974de0(null,_0x1407e3);})[_0x77bd('0x20')](function(_0x5c6800){return _0x974de0(null,![],_0x5c6800);});}}else{if(_0x1407e3[_0x77bd('0x14')]){return _0x974de0(null,![],{'message':_0x77bd('0x1a')});}else{return utils[_0x77bd('0x1f')](_0x1407e3)[_0x77bd('0xf')](function(){return _0x974de0(null,_0x1407e3);});}}}});})['catch'](function(_0x512a6b){return _0x974de0(null,![],_0x512a6b);});}function sendServiceMail(_0x49e460){return db[_0x77bd('0x21')][_0x77bd('0x22')]({'where':{'service':!![]},'attributes':['id',_0x77bd('0x10'),_0x77bd('0x23')],'include':[{'model':db[_0x77bd('0x24')],'as':_0x77bd('0x25'),'include':[{'model':db[_0x77bd('0x26')],'as':_0x77bd('0x26')}]}]})['then'](function(_0x4c8a11){if(!_0x4c8a11){throw new Error(_0x77bd('0x27'));}var _0x1e66c5=_0x4c8a11['getSmtpOptions']();var _0x34d5f2={'account':_0x1e66c5,'message':_['merge']({'from':util[_0x77bd('0x28')](_0x77bd('0x29'),_0x4c8a11[_0x77bd('0x10')],_0x4c8a11[_0x77bd('0x23')]||_0x4c8a11['Smtp'][_0x77bd('0x17')])},_0x49e460)};return client[_0x77bd('0x2a')](_0x77bd('0x2b'),_0x34d5f2);})['then'](function(_0x40a914){if(_0x40a914[_0x77bd('0x2c')]){throw new Error(util[_0x77bd('0x28')](_0x77bd('0x2d'),_0x40a914['error'][_0x77bd('0x2e')]||JSON['stringify'](_0x40a914[_0x77bd('0x2c')])));}return!![];});}function handleError(_0xaebef9,_0x215f5d,_0x59334a){return _0xaebef9[_0x77bd('0x2f')](_0x215f5d||0x1f4)[_0x77bd('0x30')]({'message':_0x59334a?_0x59334a[_0x77bd('0x2e')]||_0x59334a:''});}exports[_0x77bd('0x31')]=function(_0x85106d,_0x19d99f,_0x50a170){passport['authenticate'](_0x77bd('0x32'),function(_0xfd0764,_0x4e75ff,_0x4867c8){var _0x59dd78=_0xfd0764||_0x4867c8;if(_0x59dd78){return handleError(_0x19d99f,0x191,_0x59dd78);}if(!_0x4e75ff){return handleError(_0x19d99f,0x194,{'message':_0x77bd('0x33')});}else{var _0xe481b9={'payload':{'id':_0x4e75ff['id'],'role':_0x4e75ff[_0x77bd('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x77bd('0x34')](_0xe481b9)['then'](function(_0x2c40f0){_0x19d99f[_0x77bd('0x35')]({'id':_0x4e75ff['id'],'token':_0x2c40f0,'statusCall':'','isAlreadyLogged':_0x4e75ff[_0x77bd('0x36')]});});}})(_0x85106d,_0x19d99f,_0x50a170);};exports[_0x77bd('0x37')]=function(_0x969245,_0x5a7140){if(!_0x969245[_0x77bd('0x38')][_0x77bd('0x23')]){return handleError(_0x5a7140,0x1f4,{'message':_0x77bd('0x39')});}var _0x52c6bc=rs[_0x77bd('0x3a')]();_0x969245[_0x77bd('0x38')][_0x77bd('0x23')]=_0x969245[_0x77bd('0x38')]['email'][_0x77bd('0x3b')]()[_0x77bd('0x3c')]();var _0x3269de;return db[_0x77bd('0xb')][_0x77bd('0xc')]({'where':{'id':0x1},'attributes':[_0x77bd('0xd'),'blockDuration'],'raw':!![]})['then'](function(_0x503d37){_0x3269de=_0x503d37;return db[_0x77bd('0x3d')][_0x77bd('0x22')]({'where':{'email':_0x969245['body'][_0x77bd('0x23')]}});})[_0x77bd('0xf')](function(_0x320eee){if(!_0x320eee){throw new Error(_0x77bd('0x3e'));}if(_0x320eee[_0x77bd('0x13')]){throw new Error(_0x77bd('0x3f'));}if(_0x320eee[_0x77bd('0x14')]){if(moment(_0x320eee[_0x77bd('0x1e')])[_0x77bd('0x1b')](_0x3269de[_0x77bd('0xe')],_0x77bd('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x320eee[_0x77bd('0x14')]=![];_0x320eee[_0x77bd('0x1e')]=null;}}_0x320eee[_0x77bd('0x40')]=_0x52c6bc;_0x320eee[_0x77bd('0x41')]=Date[_0x77bd('0x42')]()+0x36ee80;return _0x320eee[_0x77bd('0x43')]();})[_0x77bd('0xf')](function(){return sendServiceMail({'to':_0x969245['body'][_0x77bd('0x23')],'subject':_0x77bd('0x44'),'text':_0x77bd('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x77bd('0x46')+_0x969245[_0x77bd('0x47')]['host']+_0x77bd('0x48')+_0x52c6bc+'\x0a\x0a'+_0x77bd('0x49')});})['then'](function(){_0x5a7140[_0x77bd('0x2f')](0xc8)[_0x77bd('0x30')]({'message':_0x77bd('0x4a')});})[_0x77bd('0x20')](function(_0x1518c4){return handleError(_0x5a7140,0x1f4,_0x1518c4);});};exports[_0x77bd('0x4b')]=function(_0x1131ac,_0x37a26f){return db[_0x77bd('0x3d')][_0x77bd('0x22')]({'where':{'resetPasswordToken':_0x1131ac[_0x77bd('0x4c')][_0x77bd('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x77bd('0x42')]()}}})[_0x77bd('0xf')](function(_0x349512){if(!_0x349512){throw new Error(_0x77bd('0x4e'));}return db['Setting'][_0x77bd('0xc')]({'attributes':['id',_0x77bd('0x4f'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x45ea47){if(_0x45ea47[_0x77bd('0x4f')])authService[_0x77bd('0x50')](_0x1131ac[_0x77bd('0x38')][_0x77bd('0x51')]);if(!_0x45ea47[_0x77bd('0x52')]||!_0x349512['previousPasswords'])return _0x349512;authService[_0x77bd('0x53')](_0x1131ac[_0x77bd('0x38')]['password'],_0x349512[_0x77bd('0x54')],_0x45ea47[_0x77bd('0x55')]);return _0x349512;})['then'](function(){_0x349512[_0x77bd('0x51')]=_0x1131ac['body']['password'];_0x349512['resetPasswordToken']=null;_0x349512[_0x77bd('0x41')]=null;return _0x349512[_0x77bd('0x43')]();});})[_0x77bd('0xf')](function(){_0x37a26f[_0x77bd('0x2f')](0xc8)['send']({'message':_0x77bd('0x56')});})['catch'](function(_0x109838){return handleError(_0x37a26f,0x1f4,_0x109838);});};passport[_0x77bd('0x57')](_0x77bd('0x32'),new LocalStrategy({'usernameField':_0x77bd('0x10'),'passwordField':'password'},function(_0x5e579a,_0x2ad754,_0x11fcce){return localAuthenticate(db['User'],_0x5e579a,_0x2ad754,_0x11fcce);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 043cda0..f3a36fe 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 _0x64dc=['login','/forgot','forgot','exports','express','post'];(function(_0x430838,_0x59b323){var _0x2434ca=function(_0x398f72){while(--_0x398f72){_0x430838['push'](_0x430838['shift']());}};_0x2434ca(++_0x59b323);}(_0x64dc,0x9a));var _0xc64d=function(_0xb7ec6c,_0x186d95){_0xb7ec6c=_0xb7ec6c-0x0;var _0x447f9b=_0x64dc[_0xb7ec6c];return _0x447f9b;};'use strict';var express=require(_0xc64d('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0xc64d('0x1')]('/',controller[_0xc64d('0x2')]);router[_0xc64d('0x1')](_0xc64d('0x3'),controller[_0xc64d('0x4')]);router['post']('/reset/:token',controller['reset']);module[_0xc64d('0x5')]=router; \ No newline at end of file +var _0xa830=['/forgot','forgot','/reset/:token','exports','express','Router','./authLocal.controller','post','login'];(function(_0x235210,_0x2f2967){var _0x48f600=function(_0x192c4a){while(--_0x192c4a){_0x235210['push'](_0x235210['shift']());}};_0x48f600(++_0x2f2967);}(_0xa830,0x151));var _0x0a83=function(_0x185ce6,_0x80b049){_0x185ce6=_0x185ce6-0x0;var _0xb2b554=_0xa830[_0x185ce6];return _0xb2b554;};'use strict';var express=require(_0x0a83('0x0'));var router=express[_0x0a83('0x1')]();var controller=require(_0x0a83('0x2'));router[_0x0a83('0x3')]('/',controller[_0x0a83('0x4')]);router[_0x0a83('0x3')](_0x0a83('0x5'),controller[_0x0a83('0x6')]);router[_0x0a83('0x3')](_0x0a83('0x7'),controller['reset']);module[_0x0a83('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5f5db35..33b4b17 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 _0xaf77=['exports','STRING','INTEGER','sequelize'];(function(_0x25d9a5,_0x261467){var _0x1fc72a=function(_0x4d6a63){while(--_0x4d6a63){_0x25d9a5['push'](_0x25d9a5['shift']());}};_0x1fc72a(++_0x261467);}(_0xaf77,0x10b));var _0x7af7=function(_0x220268,_0x4da70e){_0x220268=_0x220268-0x0;var _0x4f6e56=_0xaf77[_0x220268];return _0x4f6e56;};'use strict';var Sequelize=require(_0x7af7('0x0'));module[_0x7af7('0x1')]={'name':{'type':Sequelize[_0x7af7('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7af7('0x2')]},'description':{'type':Sequelize[_0x7af7('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7af7('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1423=['STRING','BOOLEAN','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1423,0x1d6));var _0x3142=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1423[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x3142('0x0')]={'name':{'type':Sequelize[_0x3142('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3142('0x1')]},'status':{'type':Sequelize[_0x3142('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 13d6d4b..02e8dee 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 _0x508d=['params','find','create','body','Condition','addConditions','omit','getConditions','findOne','sort','hasOwnProperty','Action','addActions','ids','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x56c9f2,_0x401da8){var _0x2e55f2=function(_0x50b620){while(--_0x50b620){_0x56c9f2['push'](_0x56c9f2['shift']());}};_0x2e55f2(++_0x401da8);}(_0x508d,0x1b3));var _0xd508=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x508d[_0x4fde08];return _0x12e725;};'use strict';var emlformat=require(_0xd508('0x0'));var rimraf=require(_0xd508('0x1'));var zipdir=require(_0xd508('0x2'));var jsonpatch=require(_0xd508('0x3'));var rp=require(_0xd508('0x4'));var moment=require('moment');var BPromise=require(_0xd508('0x5'));var Mustache=require(_0xd508('0x6'));var util=require(_0xd508('0x7'));var path=require(_0xd508('0x8'));var sox=require('sox');var csv=require(_0xd508('0x9'));var ejs=require(_0xd508('0xa'));var fs=require('fs');var fs_extra=require(_0xd508('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd508('0xc'));var jsforce=require(_0xd508('0xd'));var deskjs=require(_0xd508('0xe'));var toCsv=require(_0xd508('0x9'));var querystring=require(_0xd508('0xf'));var Papa=require(_0xd508('0x10'));var Redis=require(_0xd508('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd508('0x12'));var logger=require('../../config/logger')(_0xd508('0x13'));var utils=require(_0xd508('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd508('0x15'))['db'];function respondWithStatusCode(_0x4c84ec,_0x1db9e1){_0x1db9e1=_0x1db9e1||0xcc;return function(_0x4b3c31){if(_0x4b3c31){return _0x4c84ec[_0xd508('0x16')](_0x1db9e1);}return _0x4c84ec[_0xd508('0x17')](_0x1db9e1)[_0xd508('0x18')]();};}function respondWithResult(_0x167da3,_0x3d56b2){_0x3d56b2=_0x3d56b2||0xc8;return function(_0x1a6b93){if(_0x1a6b93){return _0x167da3[_0xd508('0x17')](_0x3d56b2)['json'](_0x1a6b93);}};}function respondWithFilteredResult(_0x3cf060,_0x1aee40){return function(_0x7be026){if(_0x7be026){var _0x48d709=typeof _0x1aee40[_0xd508('0x19')]===_0xd508('0x1a')&&typeof _0x1aee40[_0xd508('0x1b')]===_0xd508('0x1a');var _0x56c5d3=_0x7be026[_0xd508('0x1c')];var _0x1c3379=_0x48d709?0x0:_0x1aee40[_0xd508('0x19')];var _0xc5e43a=_0x48d709?_0x7be026['count']:_0x1aee40[_0xd508('0x19')]+_0x1aee40[_0xd508('0x1b')];var _0xf60509;if(_0xc5e43a>=_0x56c5d3){_0xc5e43a=_0x56c5d3;_0xf60509=0xc8;}else{_0xf60509=0xce;}_0x3cf060['status'](_0xf60509);return _0x3cf060['set'](_0xd508('0x1d'),_0x1c3379+'-'+_0xc5e43a+'/'+_0x56c5d3)['json'](_0x7be026);}return null;};}function patchUpdates(_0x1716a0){return function(_0x4a52be){try{jsonpatch[_0xd508('0x1e')](_0x4a52be,_0x1716a0,!![]);}catch(_0x1bebcf){return BPromise[_0xd508('0x1f')](_0x1bebcf);}return _0x4a52be[_0xd508('0x20')]();};}function saveUpdates(_0x11441e,_0x2510c6){return function(_0x41e722){if(_0x41e722){return _0x41e722[_0xd508('0x21')](_0x11441e)[_0xd508('0x22')](function(_0x484d5e){return _0x484d5e;});}return null;};}function removeEntity(_0x23ddeb,_0x32e68c){return function(_0x38ce84){if(_0x38ce84){return _0x38ce84[_0xd508('0x23')]()[_0xd508('0x22')](function(){_0x23ddeb[_0xd508('0x17')](0xcc)[_0xd508('0x18')]();});}};}function handleEntityNotFound(_0x5ac411,_0xa345eb){return function(_0x3982d3){if(!_0x3982d3){_0x5ac411['sendStatus'](0x194);}return _0x3982d3;};}function handleError(_0x562ccf,_0x2012a1){_0x2012a1=_0x2012a1||0x1f4;return function(_0x464f6b){logger[_0xd508('0x24')](_0x464f6b[_0xd508('0x25')]);if(_0x464f6b[_0xd508('0x26')]){delete _0x464f6b[_0xd508('0x26')];}_0x562ccf[_0xd508('0x17')](_0x2012a1)[_0xd508('0x27')](_0x464f6b);};}exports[_0xd508('0x28')]=function(_0x3eb9c5,_0x190b04){var _0x25b8ff={},_0x56322a={},_0x4f8359={'count':0x0,'rows':[]};var _0x66fda5=_['map'](db[_0xd508('0x29')][_0xd508('0x2a')],function(_0x3751e1){return{'name':_0x3751e1[_0xd508('0x2b')],'type':_0x3751e1[_0xd508('0x2c')][_0xd508('0x2d')]};});_0x56322a[_0xd508('0x2e')]=_[_0xd508('0x2f')](_0x66fda5,_0xd508('0x26'));_0x56322a[_0xd508('0x30')]=_[_0xd508('0x31')](_0x3eb9c5[_0xd508('0x30')]);_0x56322a[_0xd508('0x32')]=_['intersection'](_0x56322a[_0xd508('0x2e')],_0x56322a[_0xd508('0x30')]);_0x25b8ff[_0xd508('0x33')]=_[_0xd508('0x34')](_0x56322a[_0xd508('0x2e')],qs[_0xd508('0x35')](_0x3eb9c5[_0xd508('0x30')][_0xd508('0x35')]));_0x25b8ff[_0xd508('0x33')]=_0x25b8ff[_0xd508('0x33')][_0xd508('0x36')]?_0x25b8ff['attributes']:_0x56322a[_0xd508('0x2e')];if(!_0x3eb9c5[_0xd508('0x30')]['hasOwnProperty'](_0xd508('0x37'))){_0x25b8ff[_0xd508('0x1b')]=qs[_0xd508('0x1b')](_0x3eb9c5[_0xd508('0x30')]['limit']);_0x25b8ff[_0xd508('0x19')]=qs[_0xd508('0x19')](_0x3eb9c5[_0xd508('0x30')][_0xd508('0x19')]);}_0x25b8ff[_0xd508('0x38')]=qs['sort'](_0x3eb9c5['query']['sort']);_0x25b8ff[_0xd508('0x39')]=qs[_0xd508('0x32')](_[_0xd508('0x3a')](_0x3eb9c5[_0xd508('0x30')],_0x56322a[_0xd508('0x32')]),_0x66fda5);if(_0x3eb9c5[_0xd508('0x30')][_0xd508('0x3b')]){_0x25b8ff[_0xd508('0x39')]=_[_0xd508('0x3c')](_0x25b8ff[_0xd508('0x39')],{'$or':_[_0xd508('0x2f')](_0x66fda5,function(_0x5e0af9){if(_0x5e0af9[_0xd508('0x2c')]!==_0xd508('0x3d')){var _0x49cea7={};_0x49cea7[_0x5e0af9['name']]={'$like':'%'+_0x3eb9c5[_0xd508('0x30')]['filter']+'%'};return _0x49cea7;}})});}_0x25b8ff=_['merge']({},_0x25b8ff,_0x3eb9c5[_0xd508('0x3e')]);var _0x464abb={'where':_0x25b8ff[_0xd508('0x39')]};return db[_0xd508('0x29')][_0xd508('0x1c')](_0x464abb)['then'](function(_0x1345bd){_0x4f8359[_0xd508('0x1c')]=_0x1345bd;if(_0x3eb9c5[_0xd508('0x30')][_0xd508('0x3f')]){_0x25b8ff[_0xd508('0x40')]=[{'all':!![]}];}return db[_0xd508('0x29')][_0xd508('0x41')](_0x25b8ff);})[_0xd508('0x22')](function(_0x2e14da){_0x4f8359[_0xd508('0x42')]=_0x2e14da;return _0x4f8359;})['then'](respondWithFilteredResult(_0x190b04,_0x25b8ff))[_0xd508('0x43')](handleError(_0x190b04,null));};exports[_0xd508('0x44')]=function(_0x200e40,_0x2e2c67){var _0x20b88b={'raw':![],'where':{'id':_0x200e40[_0xd508('0x45')]['id']}},_0x3a4394={};_0x3a4394[_0xd508('0x2e')]=_[_0xd508('0x31')](db[_0xd508('0x29')]['rawAttributes']);_0x3a4394[_0xd508('0x30')]=_['keys'](_0x200e40[_0xd508('0x30')]);_0x3a4394[_0xd508('0x32')]=_['intersection'](_0x3a4394['model'],_0x3a4394[_0xd508('0x30')]);_0x20b88b[_0xd508('0x33')]=_[_0xd508('0x34')](_0x3a4394['model'],qs[_0xd508('0x35')](_0x200e40[_0xd508('0x30')][_0xd508('0x35')]));_0x20b88b[_0xd508('0x33')]=_0x20b88b[_0xd508('0x33')]['length']?_0x20b88b[_0xd508('0x33')]:_0x3a4394[_0xd508('0x2e')];if(_0x200e40[_0xd508('0x30')]['includeAll']){_0x20b88b[_0xd508('0x40')]=[{'all':!![]}];}_0x20b88b=_[_0xd508('0x3c')]({},_0x20b88b,_0x200e40['options']);return db[_0xd508('0x29')][_0xd508('0x46')](_0x20b88b)[_0xd508('0x22')](handleEntityNotFound(_0x2e2c67,null))[_0xd508('0x22')](respondWithResult(_0x2e2c67,null))['catch'](handleError(_0x2e2c67,null));};exports[_0xd508('0x47')]=function(_0x544868,_0x599c52){return db[_0xd508('0x29')]['create'](_0x544868[_0xd508('0x48')],{})['then'](respondWithResult(_0x599c52,0xc9))[_0xd508('0x43')](handleError(_0x599c52,null));};exports['update']=function(_0x45297d,_0x36d693){if(_0x45297d[_0xd508('0x48')]['id']){delete _0x45297d[_0xd508('0x48')]['id'];}return db[_0xd508('0x29')][_0xd508('0x46')]({'where':{'id':_0x45297d[_0xd508('0x45')]['id']}})[_0xd508('0x22')](handleEntityNotFound(_0x36d693,null))[_0xd508('0x22')](saveUpdates(_0x45297d[_0xd508('0x48')],null))[_0xd508('0x22')](respondWithResult(_0x36d693,null))['catch'](handleError(_0x36d693,null));};exports[_0xd508('0x23')]=function(_0x2dcd36,_0x5bea4d){return db[_0xd508('0x29')]['find']({'where':{'id':_0x2dcd36[_0xd508('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bea4d,null))[_0xd508('0x22')](removeEntity(_0x5bea4d,null))[_0xd508('0x43')](handleError(_0x5bea4d,null));};exports['addConditions']=function(_0x37951d,_0x784787,_0x31eb2d){return db[_0xd508('0x49')][_0xd508('0x46')]({'where':{'id':_0x37951d['params']['id']}})[_0xd508('0x22')](handleEntityNotFound(_0x784787,null))['then'](function(_0x79044b){if(_0x79044b){return _0x79044b[_0xd508('0x4a')](_0x37951d[_0xd508('0x48')]['ids'],_[_0xd508('0x4b')](_0x37951d[_0xd508('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x784787,null))[_0xd508('0x43')](handleError(_0x784787,null));};exports[_0xd508('0x4c')]=function(_0x55ab86,_0x5e7d14,_0x4c200a){var _0x3fc8d4={};var _0x39d836={};var _0x5a9c26;var _0x107c03;return db[_0xd508('0x29')][_0xd508('0x4d')]({'where':{'id':_0x55ab86['params']['id']}})['then'](handleEntityNotFound(_0x5e7d14,null))['then'](function(_0x1a0202){if(_0x1a0202){_0x5a9c26=_0x1a0202;_0x39d836['model']=_[_0xd508('0x31')](db['Condition'][_0xd508('0x2a')]);_0x39d836['query']=_[_0xd508('0x31')](_0x55ab86[_0xd508('0x30')]);_0x39d836['filters']=_[_0xd508('0x34')](_0x39d836[_0xd508('0x2e')],_0x39d836[_0xd508('0x30')]);_0x3fc8d4[_0xd508('0x33')]=_['intersection'](_0x39d836[_0xd508('0x2e')],qs[_0xd508('0x35')](_0x55ab86[_0xd508('0x30')][_0xd508('0x35')]));_0x3fc8d4[_0xd508('0x33')]=_0x3fc8d4[_0xd508('0x33')][_0xd508('0x36')]?_0x3fc8d4[_0xd508('0x33')]:_0x39d836[_0xd508('0x2e')];_0x3fc8d4[_0xd508('0x38')]=qs[_0xd508('0x4e')](_0x55ab86[_0xd508('0x30')][_0xd508('0x4e')]);_0x3fc8d4[_0xd508('0x39')]=qs[_0xd508('0x32')](_[_0xd508('0x3a')](_0x55ab86[_0xd508('0x30')],_0x39d836[_0xd508('0x32')]));if(_0x55ab86['query'][_0xd508('0x3b')]){_0x3fc8d4[_0xd508('0x39')]=_[_0xd508('0x3c')](_0x3fc8d4[_0xd508('0x39')],{'$or':_[_0xd508('0x2f')](_0x3fc8d4[_0xd508('0x33')],function(_0x43aa9c){var _0x2d0d0e={};_0x2d0d0e[_0x43aa9c]={'$like':'%'+_0x55ab86[_0xd508('0x30')][_0xd508('0x3b')]+'%'};return _0x2d0d0e;})});}_0x3fc8d4=_[_0xd508('0x3c')]({},_0x3fc8d4,_0x55ab86[_0xd508('0x3e')]);return _0x5a9c26[_0xd508('0x4c')](_0x3fc8d4);}})[_0xd508('0x22')](function(_0x5bc5ba){if(_0x5bc5ba){_0x107c03=_0x5bc5ba[_0xd508('0x36')];if(!_0x55ab86['query'][_0xd508('0x4f')]('nolimit')){_0x3fc8d4[_0xd508('0x1b')]=qs[_0xd508('0x1b')](_0x55ab86[_0xd508('0x30')][_0xd508('0x1b')]);_0x3fc8d4['offset']=qs['offset'](_0x55ab86[_0xd508('0x30')][_0xd508('0x19')]);}return _0x5a9c26[_0xd508('0x4c')](_0x3fc8d4);}})['then'](function(_0x5d1b06){if(_0x5d1b06){return _0x5d1b06?{'count':_0x107c03,'rows':_0x5d1b06}:null;}})[_0xd508('0x22')](respondWithResult(_0x5e7d14,null))[_0xd508('0x43')](handleError(_0x5e7d14,null));};exports['addActions']=function(_0x4b878d,_0x180bd1,_0x5377f3){return db[_0xd508('0x50')]['find']({'where':{'id':_0x4b878d[_0xd508('0x45')]['id']}})['then'](handleEntityNotFound(_0x180bd1,null))[_0xd508('0x22')](function(_0x529e59){if(_0x529e59){return _0x529e59[_0xd508('0x51')](_0x4b878d[_0xd508('0x48')][_0xd508('0x52')],_[_0xd508('0x4b')](_0x4b878d[_0xd508('0x48')],['ids','id'])||{});}})[_0xd508('0x22')](respondWithResult(_0x180bd1,null))[_0xd508('0x43')](handleError(_0x180bd1,null));};exports[_0xd508('0x53')]=function(_0x31f48e,_0x82ea2,_0x29c328){var _0x19cbcb={};var _0x29fbb6={};var _0x1e8ac4;var _0x5747c6;return db[_0xd508('0x29')][_0xd508('0x4d')]({'where':{'id':_0x31f48e[_0xd508('0x45')]['id']}})['then'](handleEntityNotFound(_0x82ea2,null))[_0xd508('0x22')](function(_0x5ab84b){if(_0x5ab84b){_0x1e8ac4=_0x5ab84b;_0x29fbb6[_0xd508('0x2e')]=_[_0xd508('0x31')](db['Action'][_0xd508('0x2a')]);_0x29fbb6[_0xd508('0x30')]=_[_0xd508('0x31')](_0x31f48e[_0xd508('0x30')]);_0x29fbb6[_0xd508('0x32')]=_[_0xd508('0x34')](_0x29fbb6['model'],_0x29fbb6[_0xd508('0x30')]);_0x19cbcb[_0xd508('0x33')]=_['intersection'](_0x29fbb6[_0xd508('0x2e')],qs['fields'](_0x31f48e['query'][_0xd508('0x35')]));_0x19cbcb[_0xd508('0x33')]=_0x19cbcb[_0xd508('0x33')][_0xd508('0x36')]?_0x19cbcb['attributes']:_0x29fbb6[_0xd508('0x2e')];_0x19cbcb['order']=qs[_0xd508('0x4e')](_0x31f48e['query'][_0xd508('0x4e')]);_0x19cbcb[_0xd508('0x39')]=qs['filters'](_['pick'](_0x31f48e[_0xd508('0x30')],_0x29fbb6['filters']));if(_0x31f48e['query'][_0xd508('0x3b')]){_0x19cbcb[_0xd508('0x39')]=_['merge'](_0x19cbcb[_0xd508('0x39')],{'$or':_['map'](_0x19cbcb[_0xd508('0x33')],function(_0xe08e6e){var _0x2b0221={};_0x2b0221[_0xe08e6e]={'$like':'%'+_0x31f48e[_0xd508('0x30')][_0xd508('0x3b')]+'%'};return _0x2b0221;})});}_0x19cbcb=_[_0xd508('0x3c')]({},_0x19cbcb,_0x31f48e[_0xd508('0x3e')]);return _0x1e8ac4[_0xd508('0x53')](_0x19cbcb);}})[_0xd508('0x22')](function(_0x979091){if(_0x979091){_0x5747c6=_0x979091[_0xd508('0x36')];if(!_0x31f48e[_0xd508('0x30')][_0xd508('0x4f')](_0xd508('0x37'))){_0x19cbcb['limit']=qs['limit'](_0x31f48e[_0xd508('0x30')][_0xd508('0x1b')]);_0x19cbcb[_0xd508('0x19')]=qs[_0xd508('0x19')](_0x31f48e['query'][_0xd508('0x19')]);}return _0x1e8ac4[_0xd508('0x53')](_0x19cbcb);}})[_0xd508('0x22')](function(_0x14f36c){if(_0x14f36c){return _0x14f36c?{'count':_0x5747c6,'rows':_0x14f36c}:null;}})[_0xd508('0x22')](respondWithResult(_0x82ea2,null))[_0xd508('0x43')](handleError(_0x82ea2,null));}; \ No newline at end of file +var _0x8ad1=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','keys','includeAll','options','create','body','find','params','addConditions','Condition','ids','omit','getConditions','findOne','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Automation','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x39e134,_0xd37a5d){var _0x3239a7=function(_0x597cc7){while(--_0x597cc7){_0x39e134['push'](_0x39e134['shift']());}};_0x3239a7(++_0xd37a5d);}(_0x8ad1,0x1d5));var _0x18ad=function(_0x583200,_0x42c9d1){_0x583200=_0x583200-0x0;var _0x31f4bb=_0x8ad1[_0x583200];return _0x31f4bb;};'use strict';var emlformat=require(_0x18ad('0x0'));var rimraf=require(_0x18ad('0x1'));var zipdir=require(_0x18ad('0x2'));var jsonpatch=require(_0x18ad('0x3'));var rp=require(_0x18ad('0x4'));var moment=require(_0x18ad('0x5'));var BPromise=require(_0x18ad('0x6'));var Mustache=require(_0x18ad('0x7'));var util=require(_0x18ad('0x8'));var path=require('path');var sox=require(_0x18ad('0x9'));var csv=require(_0x18ad('0xa'));var ejs=require(_0x18ad('0xb'));var fs=require('fs');var fs_extra=require(_0x18ad('0xc'));var _=require(_0x18ad('0xd'));var squel=require(_0x18ad('0xe'));var crypto=require(_0x18ad('0xf'));var jsforce=require(_0x18ad('0x10'));var deskjs=require(_0x18ad('0x11'));var toCsv=require(_0x18ad('0xa'));var querystring=require('querystring');var Papa=require(_0x18ad('0x12'));var Redis=require(_0x18ad('0x13'));var authService=require(_0x18ad('0x14'));var qs=require(_0x18ad('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18ad('0x16'));var logger=require(_0x18ad('0x17'))(_0x18ad('0x18'));var utils=require('../../config/utils');var config=require(_0x18ad('0x19'));var licenseUtil=require(_0x18ad('0x1a'));var db=require(_0x18ad('0x1b'))['db'];function respondWithStatusCode(_0x3db3de,_0x2d66c0){_0x2d66c0=_0x2d66c0||0xcc;return function(_0x266694){if(_0x266694){return _0x3db3de[_0x18ad('0x1c')](_0x2d66c0);}return _0x3db3de[_0x18ad('0x1d')](_0x2d66c0)['end']();};}function respondWithResult(_0x25bbc0,_0x32b023){_0x32b023=_0x32b023||0xc8;return function(_0x48cb4b){if(_0x48cb4b){return _0x25bbc0['status'](_0x32b023)[_0x18ad('0x1e')](_0x48cb4b);}};}function respondWithFilteredResult(_0x3da2d2,_0xe09514){return function(_0x4fcb31){if(_0x4fcb31){var _0xb6864=typeof _0xe09514[_0x18ad('0x1f')]==='undefined'&&typeof _0xe09514['limit']===_0x18ad('0x20');var _0x18710e=_0x4fcb31[_0x18ad('0x21')];var _0x3817e4=_0xb6864?0x0:_0xe09514[_0x18ad('0x1f')];var _0x1fe116=_0xb6864?_0x4fcb31['count']:_0xe09514[_0x18ad('0x1f')]+_0xe09514[_0x18ad('0x22')];var _0x30a2f5;if(_0x1fe116>=_0x18710e){_0x1fe116=_0x18710e;_0x30a2f5=0xc8;}else{_0x30a2f5=0xce;}_0x3da2d2[_0x18ad('0x1d')](_0x30a2f5);return _0x3da2d2[_0x18ad('0x23')](_0x18ad('0x24'),_0x3817e4+'-'+_0x1fe116+'/'+_0x18710e)[_0x18ad('0x1e')](_0x4fcb31);}return null;};}function patchUpdates(_0x264cbf){return function(_0x1feeb8){try{jsonpatch[_0x18ad('0x25')](_0x1feeb8,_0x264cbf,!![]);}catch(_0x5e70dd){return BPromise[_0x18ad('0x26')](_0x5e70dd);}return _0x1feeb8[_0x18ad('0x27')]();};}function saveUpdates(_0x485147,_0x28dd1f){return function(_0x21f0a5){if(_0x21f0a5){return _0x21f0a5[_0x18ad('0x28')](_0x485147)[_0x18ad('0x29')](function(_0x32aba8){return _0x32aba8;});}return null;};}function removeEntity(_0x565b93,_0xefe1fe){return function(_0x37229d){if(_0x37229d){return _0x37229d[_0x18ad('0x2a')]()[_0x18ad('0x29')](function(){_0x565b93[_0x18ad('0x1d')](0xcc)[_0x18ad('0x2b')]();});}};}function handleEntityNotFound(_0x5e78bb,_0x52ff4d){return function(_0x150fd2){if(!_0x150fd2){_0x5e78bb['sendStatus'](0x194);}return _0x150fd2;};}function handleError(_0x56125f,_0x430f45){_0x430f45=_0x430f45||0x1f4;return function(_0xcf7125){logger[_0x18ad('0x2c')](_0xcf7125['stack']);if(_0xcf7125[_0x18ad('0x2d')]){delete _0xcf7125[_0x18ad('0x2d')];}_0x56125f[_0x18ad('0x1d')](_0x430f45)[_0x18ad('0x2e')](_0xcf7125);};}exports['index']=function(_0xc759af,_0x3e2357){var _0xf70b31={},_0x6be5d7={},_0x567fff={'count':0x0,'rows':[]};var _0xdcd7e1=_[_0x18ad('0x2f')](db[_0x18ad('0x30')][_0x18ad('0x31')],function(_0x52f8b2){return{'name':_0x52f8b2[_0x18ad('0x32')],'type':_0x52f8b2['type'][_0x18ad('0x33')]};});_0x6be5d7[_0x18ad('0x34')]=_[_0x18ad('0x2f')](_0xdcd7e1,_0x18ad('0x2d'));_0x6be5d7[_0x18ad('0x35')]=_['keys'](_0xc759af[_0x18ad('0x35')]);_0x6be5d7[_0x18ad('0x36')]=_['intersection'](_0x6be5d7[_0x18ad('0x34')],_0x6be5d7[_0x18ad('0x35')]);_0xf70b31['attributes']=_[_0x18ad('0x37')](_0x6be5d7['model'],qs[_0x18ad('0x38')](_0xc759af[_0x18ad('0x35')][_0x18ad('0x38')]));_0xf70b31[_0x18ad('0x39')]=_0xf70b31[_0x18ad('0x39')][_0x18ad('0x3a')]?_0xf70b31[_0x18ad('0x39')]:_0x6be5d7[_0x18ad('0x34')];if(!_0xc759af[_0x18ad('0x35')][_0x18ad('0x3b')](_0x18ad('0x3c'))){_0xf70b31[_0x18ad('0x22')]=qs[_0x18ad('0x22')](_0xc759af[_0x18ad('0x35')]['limit']);_0xf70b31[_0x18ad('0x1f')]=qs[_0x18ad('0x1f')](_0xc759af[_0x18ad('0x35')][_0x18ad('0x1f')]);}_0xf70b31[_0x18ad('0x3d')]=qs['sort'](_0xc759af[_0x18ad('0x35')][_0x18ad('0x3e')]);_0xf70b31[_0x18ad('0x3f')]=qs[_0x18ad('0x36')](_[_0x18ad('0x40')](_0xc759af['query'],_0x6be5d7[_0x18ad('0x36')]),_0xdcd7e1);if(_0xc759af[_0x18ad('0x35')][_0x18ad('0x41')]){_0xf70b31[_0x18ad('0x3f')]=_[_0x18ad('0x42')](_0xf70b31[_0x18ad('0x3f')],{'$or':_[_0x18ad('0x2f')](_0xdcd7e1,function(_0x31c722){if(_0x31c722[_0x18ad('0x43')]!=='VIRTUAL'){var _0x5066da={};_0x5066da[_0x31c722[_0x18ad('0x2d')]]={'$like':'%'+_0xc759af[_0x18ad('0x35')][_0x18ad('0x41')]+'%'};return _0x5066da;}})});}_0xf70b31=_[_0x18ad('0x42')]({},_0xf70b31,_0xc759af['options']);var _0x34fcba={'where':_0xf70b31[_0x18ad('0x3f')]};return db['Automation'][_0x18ad('0x21')](_0x34fcba)[_0x18ad('0x29')](function(_0x14c58f){_0x567fff[_0x18ad('0x21')]=_0x14c58f;if(_0xc759af[_0x18ad('0x35')]['includeAll']){_0xf70b31[_0x18ad('0x44')]=[{'all':!![]}];}return db['Automation'][_0x18ad('0x45')](_0xf70b31);})[_0x18ad('0x29')](function(_0x31d866){_0x567fff[_0x18ad('0x46')]=_0x31d866;return _0x567fff;})[_0x18ad('0x29')](respondWithFilteredResult(_0x3e2357,_0xf70b31))[_0x18ad('0x47')](handleError(_0x3e2357,null));};exports[_0x18ad('0x48')]=function(_0x595c00,_0x51e327){var _0x37abc8={'raw':![],'where':{'id':_0x595c00['params']['id']}},_0x38f93c={};_0x38f93c['model']=_['keys'](db['Automation']['rawAttributes']);_0x38f93c[_0x18ad('0x35')]=_[_0x18ad('0x49')](_0x595c00['query']);_0x38f93c[_0x18ad('0x36')]=_['intersection'](_0x38f93c[_0x18ad('0x34')],_0x38f93c[_0x18ad('0x35')]);_0x37abc8[_0x18ad('0x39')]=_[_0x18ad('0x37')](_0x38f93c[_0x18ad('0x34')],qs[_0x18ad('0x38')](_0x595c00[_0x18ad('0x35')][_0x18ad('0x38')]));_0x37abc8[_0x18ad('0x39')]=_0x37abc8[_0x18ad('0x39')][_0x18ad('0x3a')]?_0x37abc8[_0x18ad('0x39')]:_0x38f93c[_0x18ad('0x34')];if(_0x595c00['query'][_0x18ad('0x4a')]){_0x37abc8[_0x18ad('0x44')]=[{'all':!![]}];}_0x37abc8=_['merge']({},_0x37abc8,_0x595c00[_0x18ad('0x4b')]);return db[_0x18ad('0x30')]['find'](_0x37abc8)[_0x18ad('0x29')](handleEntityNotFound(_0x51e327,null))['then'](respondWithResult(_0x51e327,null))[_0x18ad('0x47')](handleError(_0x51e327,null));};exports[_0x18ad('0x4c')]=function(_0x10f87c,_0x419812){return db['Automation'][_0x18ad('0x4c')](_0x10f87c[_0x18ad('0x4d')],{})[_0x18ad('0x29')](respondWithResult(_0x419812,0xc9))[_0x18ad('0x47')](handleError(_0x419812,null));};exports[_0x18ad('0x28')]=function(_0x261c90,_0xe7d085){if(_0x261c90[_0x18ad('0x4d')]['id']){delete _0x261c90[_0x18ad('0x4d')]['id'];}return db[_0x18ad('0x30')][_0x18ad('0x4e')]({'where':{'id':_0x261c90[_0x18ad('0x4f')]['id']}})[_0x18ad('0x29')](handleEntityNotFound(_0xe7d085,null))['then'](saveUpdates(_0x261c90[_0x18ad('0x4d')],null))[_0x18ad('0x29')](respondWithResult(_0xe7d085,null))[_0x18ad('0x47')](handleError(_0xe7d085,null));};exports[_0x18ad('0x2a')]=function(_0x379570,_0xa070d6){return db[_0x18ad('0x30')]['find']({'where':{'id':_0x379570[_0x18ad('0x4f')]['id']}})[_0x18ad('0x29')](handleEntityNotFound(_0xa070d6,null))['then'](removeEntity(_0xa070d6,null))[_0x18ad('0x47')](handleError(_0xa070d6,null));};exports[_0x18ad('0x50')]=function(_0x2332e8,_0x410f36,_0x164c8d){return db[_0x18ad('0x51')][_0x18ad('0x4e')]({'where':{'id':_0x2332e8[_0x18ad('0x4f')]['id']}})[_0x18ad('0x29')](handleEntityNotFound(_0x410f36,null))['then'](function(_0x397c5a){if(_0x397c5a){return _0x397c5a[_0x18ad('0x50')](_0x2332e8[_0x18ad('0x4d')][_0x18ad('0x52')],_[_0x18ad('0x53')](_0x2332e8[_0x18ad('0x4d')],[_0x18ad('0x52'),'id'])||{});}})[_0x18ad('0x29')](respondWithResult(_0x410f36,null))['catch'](handleError(_0x410f36,null));};exports[_0x18ad('0x54')]=function(_0x183e58,_0x3f1341,_0x3d53f6){var _0x1ac49c={};var _0x19590a={};var _0x3044fb;var _0x41eb56;return db[_0x18ad('0x30')][_0x18ad('0x55')]({'where':{'id':_0x183e58[_0x18ad('0x4f')]['id']}})[_0x18ad('0x29')](handleEntityNotFound(_0x3f1341,null))[_0x18ad('0x29')](function(_0x2c691a){if(_0x2c691a){_0x3044fb=_0x2c691a;_0x19590a['model']=_[_0x18ad('0x49')](db['Condition'][_0x18ad('0x31')]);_0x19590a[_0x18ad('0x35')]=_['keys'](_0x183e58[_0x18ad('0x35')]);_0x19590a['filters']=_[_0x18ad('0x37')](_0x19590a[_0x18ad('0x34')],_0x19590a['query']);_0x1ac49c[_0x18ad('0x39')]=_[_0x18ad('0x37')](_0x19590a[_0x18ad('0x34')],qs[_0x18ad('0x38')](_0x183e58['query'][_0x18ad('0x38')]));_0x1ac49c[_0x18ad('0x39')]=_0x1ac49c[_0x18ad('0x39')][_0x18ad('0x3a')]?_0x1ac49c[_0x18ad('0x39')]:_0x19590a[_0x18ad('0x34')];_0x1ac49c['order']=qs[_0x18ad('0x3e')](_0x183e58[_0x18ad('0x35')]['sort']);_0x1ac49c[_0x18ad('0x3f')]=qs[_0x18ad('0x36')](_['pick'](_0x183e58[_0x18ad('0x35')],_0x19590a[_0x18ad('0x36')]));if(_0x183e58['query'][_0x18ad('0x41')]){_0x1ac49c['where']=_[_0x18ad('0x42')](_0x1ac49c[_0x18ad('0x3f')],{'$or':_[_0x18ad('0x2f')](_0x1ac49c[_0x18ad('0x39')],function(_0x211117){var _0x2c4b5d={};_0x2c4b5d[_0x211117]={'$like':'%'+_0x183e58[_0x18ad('0x35')][_0x18ad('0x41')]+'%'};return _0x2c4b5d;})});}_0x1ac49c=_[_0x18ad('0x42')]({},_0x1ac49c,_0x183e58[_0x18ad('0x4b')]);return _0x3044fb[_0x18ad('0x54')](_0x1ac49c);}})['then'](function(_0x5e2411){if(_0x5e2411){_0x41eb56=_0x5e2411[_0x18ad('0x3a')];if(!_0x183e58[_0x18ad('0x35')][_0x18ad('0x3b')](_0x18ad('0x3c'))){_0x1ac49c[_0x18ad('0x22')]=qs[_0x18ad('0x22')](_0x183e58[_0x18ad('0x35')][_0x18ad('0x22')]);_0x1ac49c[_0x18ad('0x1f')]=qs[_0x18ad('0x1f')](_0x183e58[_0x18ad('0x35')][_0x18ad('0x1f')]);}return _0x3044fb[_0x18ad('0x54')](_0x1ac49c);}})[_0x18ad('0x29')](function(_0x59482e){if(_0x59482e){return _0x59482e?{'count':_0x41eb56,'rows':_0x59482e}:null;}})[_0x18ad('0x29')](respondWithResult(_0x3f1341,null))[_0x18ad('0x47')](handleError(_0x3f1341,null));};exports['addActions']=function(_0x13a7f8,_0x1ca3eb,_0x53576c){return db[_0x18ad('0x56')][_0x18ad('0x4e')]({'where':{'id':_0x13a7f8['params']['id']}})[_0x18ad('0x29')](handleEntityNotFound(_0x1ca3eb,null))[_0x18ad('0x29')](function(_0xd8f4d8){if(_0xd8f4d8){return _0xd8f4d8['addActions'](_0x13a7f8[_0x18ad('0x4d')][_0x18ad('0x52')],_[_0x18ad('0x53')](_0x13a7f8[_0x18ad('0x4d')],[_0x18ad('0x52'),'id'])||{});}})[_0x18ad('0x29')](respondWithResult(_0x1ca3eb,null))[_0x18ad('0x47')](handleError(_0x1ca3eb,null));};exports[_0x18ad('0x57')]=function(_0x21b354,_0x152731,_0x357efe){var _0x5e4194={};var _0x10bc5a={};var _0x31d49c;var _0x667bdf;return db[_0x18ad('0x30')][_0x18ad('0x55')]({'where':{'id':_0x21b354['params']['id']}})[_0x18ad('0x29')](handleEntityNotFound(_0x152731,null))[_0x18ad('0x29')](function(_0x126206){if(_0x126206){_0x31d49c=_0x126206;_0x10bc5a[_0x18ad('0x34')]=_[_0x18ad('0x49')](db['Action']['rawAttributes']);_0x10bc5a[_0x18ad('0x35')]=_[_0x18ad('0x49')](_0x21b354[_0x18ad('0x35')]);_0x10bc5a[_0x18ad('0x36')]=_['intersection'](_0x10bc5a[_0x18ad('0x34')],_0x10bc5a[_0x18ad('0x35')]);_0x5e4194[_0x18ad('0x39')]=_['intersection'](_0x10bc5a['model'],qs[_0x18ad('0x38')](_0x21b354[_0x18ad('0x35')][_0x18ad('0x38')]));_0x5e4194['attributes']=_0x5e4194[_0x18ad('0x39')][_0x18ad('0x3a')]?_0x5e4194[_0x18ad('0x39')]:_0x10bc5a[_0x18ad('0x34')];_0x5e4194[_0x18ad('0x3d')]=qs[_0x18ad('0x3e')](_0x21b354[_0x18ad('0x35')][_0x18ad('0x3e')]);_0x5e4194[_0x18ad('0x3f')]=qs[_0x18ad('0x36')](_[_0x18ad('0x40')](_0x21b354['query'],_0x10bc5a[_0x18ad('0x36')]));if(_0x21b354[_0x18ad('0x35')][_0x18ad('0x41')]){_0x5e4194[_0x18ad('0x3f')]=_[_0x18ad('0x42')](_0x5e4194['where'],{'$or':_[_0x18ad('0x2f')](_0x5e4194[_0x18ad('0x39')],function(_0x3c5b48){var _0x30bd6c={};_0x30bd6c[_0x3c5b48]={'$like':'%'+_0x21b354['query'][_0x18ad('0x41')]+'%'};return _0x30bd6c;})});}_0x5e4194=_[_0x18ad('0x42')]({},_0x5e4194,_0x21b354[_0x18ad('0x4b')]);return _0x31d49c[_0x18ad('0x57')](_0x5e4194);}})['then'](function(_0x58581f){if(_0x58581f){_0x667bdf=_0x58581f[_0x18ad('0x3a')];if(!_0x21b354[_0x18ad('0x35')][_0x18ad('0x3b')](_0x18ad('0x3c'))){_0x5e4194[_0x18ad('0x22')]=qs[_0x18ad('0x22')](_0x21b354['query'][_0x18ad('0x22')]);_0x5e4194[_0x18ad('0x1f')]=qs[_0x18ad('0x1f')](_0x21b354[_0x18ad('0x35')][_0x18ad('0x1f')]);}return _0x31d49c['getActions'](_0x5e4194);}})[_0x18ad('0x29')](function(_0x7b00d0){if(_0x7b00d0){return _0x7b00d0?{'count':_0x667bdf,'rows':_0x7b00d0}:null;}})['then'](respondWithResult(_0x152731,null))[_0x18ad('0x47')](handleError(_0x152731,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 7c8a85a..0a4c7f7 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 _0xc1b9=['bluebird','request-promise','../../config/environment','./automation.attributes','define','Automation','tools_automations','../../config/logger','api'];(function(_0x2e855c,_0x1812f2){var _0x1e0860=function(_0x586bec){while(--_0x586bec){_0x2e855c['push'](_0x2e855c['shift']());}};_0x1e0860(++_0x1812f2);}(_0xc1b9,0x178));var _0x9c1b=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xc1b9[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9c1b('0x0'))(_0x9c1b('0x1'));var moment=require('moment');var BPromise=require(_0x9c1b('0x2'));var rp=require(_0x9c1b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c1b('0x4'));var attributes=require(_0x9c1b('0x5'));module['exports']=function(_0x4935b4,_0x342117){return _0x4935b4[_0x9c1b('0x6')](_0x9c1b('0x7'),attributes,{'tableName':_0x9c1b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08a5=['tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0x08a5,0x1d5));var _0x508a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x508a('0x0'));var util=require(_0x508a('0x1'));var logger=require(_0x508a('0x2'))(_0x508a('0x3'));var moment=require(_0x508a('0x4'));var BPromise=require(_0x508a('0x5'));var rp=require(_0x508a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x508a('0x7'));var config=require('../../config/environment');var attributes=require(_0x508a('0x8'));module[_0x508a('0x9')]=function(_0x30bfea,_0x5c87b8){return _0x30bfea[_0x508a('0xa')](_0x508a('0xb'),attributes,{'tableName':_0x508a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 5ee4027..0e5814a 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 _0x1516=['../../config/environment','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1516,0xb0));var _0x6151=function(_0x2163f5,_0x4ec207){_0x2163f5=_0x2163f5-0x0;var _0x4bf4c2=_0x1516[_0x2163f5];return _0x4bf4c2;};'use strict';var _=require(_0x6151('0x0'));var util=require(_0x6151('0x1'));var moment=require(_0x6151('0x2'));var BPromise=require('bluebird');var rs=require(_0x6151('0x3'));var fs=require('fs');var Redis=require(_0x6151('0x4'));var db=require(_0x6151('0x5'))['db'];var utils=require(_0x6151('0x6'));var logger=require(_0x6151('0x7'))('rpc');var config=require(_0x6151('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6151('0x9')][_0x6151('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x319164,_0x3fa962,_0x46e22f){return new BPromise(function(_0x43513c,_0x44cc85){return client[_0x6151('0xb')](_0x319164,_0x46e22f)[_0x6151('0xc')](function(_0x5c5b55){logger['info'](_0x6151('0xd'),_0x3fa962,_0x6151('0xe'));logger[_0x6151('0xf')](_0x6151('0x10'),_0x3fa962,_0x6151('0xe'),JSON[_0x6151('0x11')](_0x5c5b55));if(_0x5c5b55[_0x6151('0x12')]){if(_0x5c5b55[_0x6151('0x12')][_0x6151('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x3fa962,_0x5c5b55[_0x6151('0x12')][_0x6151('0x14')]);return _0x44cc85(_0x5c5b55[_0x6151('0x12')]['message']);}logger[_0x6151('0x12')](_0x6151('0xd'),_0x3fa962,_0x5c5b55[_0x6151('0x12')][_0x6151('0x14')]);return _0x43513c(_0x5c5b55['error'][_0x6151('0x14')]);}else{logger['info'](_0x6151('0xd'),_0x3fa962,_0x6151('0xe'));_0x43513c(_0x5c5b55[_0x6151('0x15')][_0x6151('0x14')]);}})[_0x6151('0x16')](function(_0x12524a){logger[_0x6151('0x12')](_0x6151('0xd'),_0x3fa962,_0x12524a);_0x44cc85(_0x12524a);});});} \ No newline at end of file +var _0x87d9=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x314f8b,_0x28224e){var _0x6c3532=function(_0x4a6132){while(--_0x4a6132){_0x314f8b['push'](_0x314f8b['shift']());}};_0x6c3532(++_0x28224e);}(_0x87d9,0x143));var _0x987d=function(_0x4633ee,_0xc061fe){_0x4633ee=_0x4633ee-0x0;var _0x5c5ac0=_0x87d9[_0x4633ee];return _0x5c5ac0;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var moment=require(_0x987d('0x1'));var BPromise=require(_0x987d('0x2'));var rs=require(_0x987d('0x3'));var fs=require('fs');var Redis=require(_0x987d('0x4'));var db=require(_0x987d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x987d('0x6'))('rpc');var config=require(_0x987d('0x7'));var jayson=require(_0x987d('0x8'));var client=jayson['client'][_0x987d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee510,_0x5bf349,_0x11d89e){return new BPromise(function(_0x1f97b6,_0x444273){return client[_0x987d('0xa')](_0x3ee510,_0x11d89e)[_0x987d('0xb')](function(_0x325c8b){logger[_0x987d('0xc')]('Automation,\x20%s,\x20%s',_0x5bf349,_0x987d('0xd'));logger[_0x987d('0xe')](_0x987d('0xf'),_0x5bf349,_0x987d('0xd'),JSON['stringify'](_0x325c8b));if(_0x325c8b[_0x987d('0x10')]){if(_0x325c8b[_0x987d('0x10')][_0x987d('0x11')]===0x1f4){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x444273(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x1f97b6(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}else{logger[_0x987d('0xc')](_0x987d('0x12'),_0x5bf349,_0x987d('0xd'));_0x1f97b6(_0x325c8b[_0x987d('0x14')][_0x987d('0x13')]);}})[_0x987d('0x15')](function(_0x197e46){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x197e46);_0x444273(_0x197e46);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 915afd1..1205be1 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 _0xb734=['connect-timeout','express','Router','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','delete','destroy','exports','multer','util','path'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xb734,0xe3));var _0x4b73=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0xb734[_0x297c55];return _0x120389;};'use strict';var multer=require(_0x4b73('0x0'));var util=require(_0x4b73('0x1'));var path=require(_0x4b73('0x2'));var timeout=require(_0x4b73('0x3'));var express=require(_0x4b73('0x4'));var router=express[_0x4b73('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b73('0x6'));var controller=require(_0x4b73('0x7'));router[_0x4b73('0x8')]('/',auth[_0x4b73('0x9')](),controller[_0x4b73('0xa')]);router[_0x4b73('0x8')](_0x4b73('0xb'),auth['isAuthenticated'](),controller[_0x4b73('0xc')]);router[_0x4b73('0x8')]('/:id/conditions',auth[_0x4b73('0x9')](),controller['getConditions']);router[_0x4b73('0x8')](_0x4b73('0xd'),auth['isAuthenticated'](),controller[_0x4b73('0xe')]);router[_0x4b73('0xf')]('/',auth[_0x4b73('0x9')](),controller[_0x4b73('0x10')]);router[_0x4b73('0xf')](_0x4b73('0x11'),auth[_0x4b73('0x9')](),controller[_0x4b73('0x12')]);router[_0x4b73('0xf')](_0x4b73('0xd'),auth[_0x4b73('0x9')](),controller[_0x4b73('0x13')]);router['put'](_0x4b73('0xb'),auth[_0x4b73('0x9')](),controller['update']);router[_0x4b73('0x14')](_0x4b73('0xb'),auth['isAuthenticated'](),controller[_0x4b73('0x15')]);module[_0x4b73('0x16')]=router; \ No newline at end of file +var _0x9de3=['../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x9de3,0xea));var _0x39de=function(_0x100521,_0x351566){_0x100521=_0x100521-0x0;var _0x4c8267=_0x9de3[_0x100521];return _0x4c8267;};'use strict';var multer=require(_0x39de('0x0'));var util=require('util');var path=require(_0x39de('0x1'));var timeout=require(_0x39de('0x2'));var express=require(_0x39de('0x3'));var router=express['Router']();var fs_extra=require(_0x39de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x39de('0x5'));var config=require(_0x39de('0x6'));var controller=require(_0x39de('0x7'));router[_0x39de('0x8')]('/',auth['isAuthenticated'](),controller[_0x39de('0x9')]);router[_0x39de('0x8')](_0x39de('0xa'),auth[_0x39de('0xb')](),controller[_0x39de('0xc')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller[_0x39de('0xd')]);router[_0x39de('0x8')](_0x39de('0xe'),auth[_0x39de('0xb')](),controller[_0x39de('0xf')]);router[_0x39de('0x10')]('/',auth[_0x39de('0xb')](),controller[_0x39de('0x11')]);router['post'](_0x39de('0x12'),auth['isAuthenticated'](),controller['addConditions']);router[_0x39de('0x10')](_0x39de('0xe'),auth[_0x39de('0xb')](),controller['addActions']);router[_0x39de('0x13')](_0x39de('0xa'),auth[_0x39de('0xb')](),controller[_0x39de('0x14')]);router[_0x39de('0x15')](_0x39de('0xa'),auth[_0x39de('0xb')](),controller[_0x39de('0x16')]);module[_0x39de('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index df2a63c..8e11561 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 _0x787c=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\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','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x26559a,_0x3f9fe6){var _0x3c7d9e=function(_0x158106){while(--_0x158106){_0x26559a['push'](_0x26559a['shift']());}};_0x3c7d9e(++_0x3f9fe6);}(_0x787c,0x172));var _0xc787=function(_0x21045d,_0x2720a4){_0x21045d=_0x21045d-0x0;var _0x128bd9=_0x787c[_0x21045d];return _0x128bd9;};'use strict';var Sequelize=require(_0xc787('0x0'));module['exports']={'name':{'type':Sequelize[_0xc787('0x1')],'unique':_0xc787('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc787('0x3')](_0xc787('0x4')),'allowNull':![],'defaultValue':_0xc787('0x4')},'description':{'type':Sequelize[_0xc787('0x1')]},'active':{'type':Sequelize[_0xc787('0x5')],'defaultValue':0x0,'comment':_0xc787('0x6')},'limitCalls':{'type':Sequelize[_0xc787('0x7')](0x4)[_0xc787('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc787('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc787('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc787('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc787('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc787('0x7')](0x5)[_0xc787('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc787('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc787('0xe')},'dialTimezone':{'type':Sequelize[_0xc787('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc787('0x1')],'defaultValue':_0xc787('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc787('0x10'),_0xc787('0x11'),_0xc787('0x12')),'defaultValue':_0xc787('0x10')},'dialAMDActive':{'type':Sequelize[_0xc787('0x5')],'defaultValue':0x0,'comment':_0xc787('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xc787('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc787('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xc787('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc787('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc787('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc787('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc787('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc787('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xc787('0x7')](0x9)[_0xc787('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc787('0x7')](0x9)[_0xc787('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc787('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc787('0x7')](0x9)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc787('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc787('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc787('0x7')](0x9)[_0xc787('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc787('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc787('0x3')](_0xc787('0x1b'),_0xc787('0x1c')),'defaultValue':_0xc787('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc787('0x1d')},'dialCutDigit':{'type':Sequelize[_0xc787('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc787('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc787('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc787('0x7')](0x5)[_0xc787('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc787('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xc787('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc787('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc787('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc787('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc787('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc787('0x7')](0x5)[_0xc787('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc787('0x27')}}; \ No newline at end of file +var _0x2813=['BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr'];(function(_0x4233e2,_0x1ae078){var _0x5bad86=function(_0xffc34e){while(--_0xffc34e){_0x4233e2['push'](_0x4233e2['shift']());}};_0x5bad86(++_0x1ae078);}(_0x2813,0x6e));var _0x3281=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2813[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3281('0x0')]={'name':{'type':Sequelize[_0x3281('0x1')],'unique':_0x3281('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x3281('0x3')),'allowNull':![],'defaultValue':_0x3281('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3281('0x4')],'defaultValue':0x0,'comment':_0x3281('0x5')},'limitCalls':{'type':Sequelize[_0x3281('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3281('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3281('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3281('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3281('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3281('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3281('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3281('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x3281('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3281('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3281('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3281('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x3281('0xe')](_0x3281('0xf'),_0x3281('0x10'),_0x3281('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3281('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x3281('0x6')](0x9)[_0x3281('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3281('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x3281('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3281('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3281('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3281('0x6')](0x9)[_0x3281('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3281('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x3281('0x6')](0x9)[_0x3281('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3281('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3281('0x6')](0x9)[_0x3281('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3281('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3281('0x6')](0x9)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3281('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3281('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3281('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3281('0x6')](0x9)[_0x3281('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3281('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3281('0xe')](_0x3281('0x1b'),_0x3281('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x3281('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3281('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3281('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3281('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3281('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3281('0x6')](0x5)[_0x3281('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x3281('0x6')](0x5)[_0x3281('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3281('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3281('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3281('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3281('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3281('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3281('0x6')](0x3)[_0x3281('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3281('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3281('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3281('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 8f9254b..5e26efc 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 _0x21f8=['limit','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','IvrCampaigns','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','UserProfileSection','userProfileId','params','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','insert','NOW()','cm_contacts','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count'];(function(_0x5273c9,_0x4a8fe7){var _0x3e95bc=function(_0xa79839){while(--_0xa79839){_0x5273c9['push'](_0x5273c9['shift']());}};_0x3e95bc(++_0x4a8fe7);}(_0x21f8,0x71));var _0x821f=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x21f8[_0xd511d];return _0x3f148e;};'use strict';var emlformat=require(_0x821f('0x0'));var rimraf=require(_0x821f('0x1'));var zipdir=require(_0x821f('0x2'));var jsonpatch=require(_0x821f('0x3'));var rp=require(_0x821f('0x4'));var moment=require(_0x821f('0x5'));var BPromise=require(_0x821f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x821f('0x7'));var csv=require(_0x821f('0x8'));var ejs=require(_0x821f('0x9'));var fs=require('fs');var fs_extra=require(_0x821f('0xa'));var _=require(_0x821f('0xb'));var squel=require(_0x821f('0xc'));var crypto=require(_0x821f('0xd'));var jsforce=require(_0x821f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x821f('0xf'));var Papa=require(_0x821f('0x10'));var Redis=require(_0x821f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x821f('0x12'));var as=require(_0x821f('0x13'));var hardwareService=require(_0x821f('0x14'));var logger=require(_0x821f('0x15'))(_0x821f('0x16'));var utils=require(_0x821f('0x17'));var config=require(_0x821f('0x18'));var licenseUtil=require(_0x821f('0x19'));var db=require(_0x821f('0x1a'))['db'];function respondWithStatusCode(_0x2aeb4e,_0x4ba2e2){_0x4ba2e2=_0x4ba2e2||0xcc;return function(_0x4f9752){if(_0x4f9752){return _0x2aeb4e[_0x821f('0x1b')](_0x4ba2e2);}return _0x2aeb4e[_0x821f('0x1c')](_0x4ba2e2)[_0x821f('0x1d')]();};}function respondWithResult(_0x91f4a0,_0x16145e){_0x16145e=_0x16145e||0xc8;return function(_0x42b2fa){if(_0x42b2fa){return _0x91f4a0[_0x821f('0x1c')](_0x16145e)[_0x821f('0x1e')](_0x42b2fa);}};}function respondWithFilteredResult(_0x1aeda5,_0x19d587){return function(_0x4b746c){if(_0x4b746c){var _0x3419ab=typeof _0x19d587['offset']===_0x821f('0x1f')&&typeof _0x19d587['limit']===_0x821f('0x1f');var _0x2b3f5c=_0x4b746c[_0x821f('0x20')];var _0x27c41c=_0x3419ab?0x0:_0x19d587['offset'];var _0x1c015a=_0x3419ab?_0x4b746c[_0x821f('0x20')]:_0x19d587['offset']+_0x19d587[_0x821f('0x21')];var _0x47b0ae;if(_0x1c015a>=_0x2b3f5c){_0x1c015a=_0x2b3f5c;_0x47b0ae=0xc8;}else{_0x47b0ae=0xce;}_0x1aeda5[_0x821f('0x1c')](_0x47b0ae);return _0x1aeda5['set'](_0x821f('0x22'),_0x27c41c+'-'+_0x1c015a+'/'+_0x2b3f5c)[_0x821f('0x1e')](_0x4b746c);}return null;};}function patchUpdates(_0x4fbcf2){return function(_0x4f3283){try{jsonpatch[_0x821f('0x23')](_0x4f3283,_0x4fbcf2,!![]);}catch(_0x187f02){return BPromise[_0x821f('0x24')](_0x187f02);}return _0x4f3283['save']();};}function saveUpdates(_0x3092d8,_0xb5d07){return function(_0x3dda74){if(_0x3dda74){return _0x3dda74['update'](_0x3092d8)[_0x821f('0x25')](function(_0x1ee178){return _0x1ee178;});}return null;};}function removeEntity(_0x4b2e35,_0x4ef246){return function(_0x4ede29){if(_0x4ede29){return _0x4ede29['destroy']()[_0x821f('0x25')](function(){var _0x4af347=_0x4ede29['get']({'plain':!![]});var _0x21c1d9='IvrCampaigns';return db['UserProfileResource'][_0x821f('0x26')]({'where':{'type':_0x21c1d9,'resourceId':_0x4af347['id']}})[_0x821f('0x25')](function(){return _0x4ede29;});})[_0x821f('0x25')](function(){_0x4b2e35[_0x821f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf6d94a,_0x418b90){return function(_0x183535){if(!_0x183535){_0xf6d94a[_0x821f('0x1b')](0x194);}return _0x183535;};}function handleError(_0x47f0b6,_0xdd8873){_0xdd8873=_0xdd8873||0x1f4;return function(_0xac9ab1){logger[_0x821f('0x27')](_0xac9ab1[_0x821f('0x28')]);if(_0xac9ab1['name']){delete _0xac9ab1[_0x821f('0x29')];}_0x47f0b6['status'](_0xdd8873)['send'](_0xac9ab1);};}exports[_0x821f('0x2a')]=function(_0xba21fb,_0x962d81){var _0x41c12a={},_0x122e56={},_0x5b10f6={'count':0x0,'rows':[]};var _0x12b057=_[_0x821f('0x2b')](db[_0x821f('0x2c')][_0x821f('0x2d')],function(_0x5429c0){return{'name':_0x5429c0[_0x821f('0x2e')],'type':_0x5429c0[_0x821f('0x2f')][_0x821f('0x30')]};});_0x122e56[_0x821f('0x31')]=_[_0x821f('0x2b')](_0x12b057,_0x821f('0x29'));_0x122e56['query']=_[_0x821f('0x32')](_0xba21fb['query']);_0x122e56[_0x821f('0x33')]=_[_0x821f('0x34')](_0x122e56['model'],_0x122e56['query']);_0x41c12a[_0x821f('0x35')]=_[_0x821f('0x34')](_0x122e56[_0x821f('0x31')],qs[_0x821f('0x36')](_0xba21fb[_0x821f('0x37')]['fields']));_0x41c12a['attributes']=_0x41c12a[_0x821f('0x35')][_0x821f('0x38')]?_0x41c12a[_0x821f('0x35')]:_0x122e56['model'];if(!_0xba21fb[_0x821f('0x37')][_0x821f('0x39')](_0x821f('0x3a'))){_0x41c12a[_0x821f('0x21')]=qs[_0x821f('0x21')](_0xba21fb[_0x821f('0x37')][_0x821f('0x21')]);_0x41c12a['offset']=qs['offset'](_0xba21fb[_0x821f('0x37')][_0x821f('0x3b')]);}_0x41c12a[_0x821f('0x3c')]=qs[_0x821f('0x3d')](_0xba21fb[_0x821f('0x37')]['sort']);_0x41c12a['where']=qs[_0x821f('0x33')](_[_0x821f('0x3e')](_0xba21fb[_0x821f('0x37')],_0x122e56['filters']),_0x12b057);if(_0xba21fb[_0x821f('0x37')][_0x821f('0x3f')]){_0x41c12a[_0x821f('0x40')]=_['merge'](_0x41c12a[_0x821f('0x40')],{'$or':_[_0x821f('0x2b')](_0x12b057,function(_0x147639){if(_0x147639[_0x821f('0x2f')]!==_0x821f('0x41')){var _0x315e59={};_0x315e59[_0x147639['name']]={'$like':'%'+_0xba21fb[_0x821f('0x37')]['filter']+'%'};return _0x315e59;}})});}_0x41c12a=_[_0x821f('0x42')]({},_0x41c12a,_0xba21fb[_0x821f('0x43')]);var _0x404ec7={'where':_0x41c12a[_0x821f('0x40')]};return db[_0x821f('0x2c')][_0x821f('0x20')](_0x404ec7)[_0x821f('0x25')](function(_0x25c0f2){_0x5b10f6['count']=_0x25c0f2;if(_0xba21fb[_0x821f('0x37')][_0x821f('0x44')]){_0x41c12a[_0x821f('0x45')]=[{'all':!![]}];}return db[_0x821f('0x2c')][_0x821f('0x46')](_0x41c12a);})['then'](function(_0x220e0b){_0x5b10f6[_0x821f('0x47')]=_0x220e0b;return _0x5b10f6;})[_0x821f('0x25')](respondWithFilteredResult(_0x962d81,_0x41c12a))[_0x821f('0x48')](handleError(_0x962d81,null));};exports[_0x821f('0x49')]=function(_0xff3674,_0x26acbe){var _0x1cee9f={'raw':![],'where':{'id':_0xff3674['params']['id']}},_0x122ca0={};_0x122ca0[_0x821f('0x31')]=_['keys'](db[_0x821f('0x2c')]['rawAttributes']);_0x122ca0[_0x821f('0x37')]=_['keys'](_0xff3674[_0x821f('0x37')]);_0x122ca0[_0x821f('0x33')]=_['intersection'](_0x122ca0[_0x821f('0x31')],_0x122ca0['query']);_0x1cee9f[_0x821f('0x35')]=_[_0x821f('0x34')](_0x122ca0['model'],qs[_0x821f('0x36')](_0xff3674[_0x821f('0x37')]['fields']));_0x1cee9f[_0x821f('0x35')]=_0x1cee9f['attributes'][_0x821f('0x38')]?_0x1cee9f[_0x821f('0x35')]:_0x122ca0[_0x821f('0x31')];if(_0xff3674['query'][_0x821f('0x44')]){_0x1cee9f[_0x821f('0x45')]=[{'all':!![]}];}_0x1cee9f=_['merge']({},_0x1cee9f,_0xff3674[_0x821f('0x43')]);return db['Campaign'][_0x821f('0x4a')](_0x1cee9f)[_0x821f('0x25')](handleEntityNotFound(_0x26acbe,null))[_0x821f('0x25')](respondWithResult(_0x26acbe,null))[_0x821f('0x48')](handleError(_0x26acbe,null));};exports[_0x821f('0x4b')]=function(_0x541a2e,_0x314a47){return db[_0x821f('0x2c')][_0x821f('0x4b')](_0x541a2e[_0x821f('0x4c')],{})['then'](function(_0x5c13f6){var _0x16e2b0=_0x541a2e['user']['get']({'plain':!![]});if(!_0x16e2b0)throw new Error(_0x821f('0x4d'));if(_0x16e2b0[_0x821f('0x4e')]===_0x821f('0x4f')){var _0x37715d=_0x5c13f6[_0x821f('0x50')]({'plain':!![]});var _0x4e9470=_0x821f('0x51');return db['UserProfileSection'][_0x821f('0x4a')]({'where':{'name':_0x4e9470,'userProfileId':_0x16e2b0['userProfileId']},'raw':!![]})[_0x821f('0x25')](function(_0x4054a9){if(_0x4054a9&&_0x4054a9[_0x821f('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x37715d[_0x821f('0x29')],'resourceId':_0x37715d['id'],'type':_0x4054a9[_0x821f('0x29')],'sectionId':_0x4054a9['id']},{})[_0x821f('0x25')](function(){return _0x5c13f6;});}else{return _0x5c13f6;}})['catch'](function(_0x386093){logger[_0x821f('0x27')](_0x821f('0x53'),_0x386093);throw _0x386093;});}return _0x5c13f6;})[_0x821f('0x25')](respondWithResult(_0x314a47,0xc9))[_0x821f('0x48')](handleError(_0x314a47,null));};exports['clone']=function(_0x45fcbd,_0x86b32d){var _0x362946={'where':{'id':_0x45fcbd['params']['id']}},_0x35dbb5={};_0x35dbb5[_0x821f('0x31')]=_[_0x821f('0x32')](db[_0x821f('0x2c')][_0x821f('0x2d')]);_0x362946[_0x821f('0x35')]=_['intersection'](_0x35dbb5[_0x821f('0x31')],qs['fields'](_0x45fcbd['query']['fields']));_0x362946['attributes']=_0x362946['attributes'][_0x821f('0x38')]?_0x362946[_0x821f('0x35')]:_0x35dbb5[_0x821f('0x31')];if(_0x45fcbd[_0x821f('0x37')][_0x821f('0x44')]){_0x362946['include']=[{'all':!![]}];}_0x362946=_[_0x821f('0x42')]({},_0x362946,_0x45fcbd[_0x821f('0x43')]);return db['Campaign'][_0x821f('0x4a')](_0x362946)[_0x821f('0x25')](handleEntityNotFound(_0x86b32d,null))[_0x821f('0x25')](function(_0x2e6c20){if(_0x2e6c20){var _0x59e25e=_0x2e6c20[_0x821f('0x50')]({'plain':!![]});_0x59e25e=qs[_0x821f('0x54')](_0x59e25e,['id','createdAt',_0x821f('0x55')]);_0x45fcbd['body']=_[_0x821f('0x54')](_0x45fcbd[_0x821f('0x4c')],['id',_0x821f('0x56'),_0x821f('0x55')]);return db[_0x821f('0x2c')][_0x821f('0x4b')](_[_0x821f('0x42')](_0x59e25e,_0x45fcbd[_0x821f('0x4c')]),{'include':_0x45fcbd[_0x821f('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x821f('0x25')](function(_0x29e6ff){var _0x3e332c=_0x45fcbd['user'][_0x821f('0x50')]({'plain':!![]});if(!_0x3e332c)throw new Error(_0x821f('0x4d'));if(_0x3e332c[_0x821f('0x4e')]===_0x821f('0x4f')){var _0x5004d9=_0x29e6ff[_0x821f('0x50')]({'plain':!![]});var _0x5a87c5=_0x821f('0x51');return db[_0x821f('0x57')][_0x821f('0x4a')]({'where':{'name':_0x5a87c5,'userProfileId':_0x3e332c[_0x821f('0x58')]},'raw':!![]})[_0x821f('0x25')](function(_0x27df7c){if(_0x27df7c&&_0x27df7c[_0x821f('0x52')]===0x0){return db['UserProfileResource'][_0x821f('0x4b')]({'name':_0x5004d9[_0x821f('0x29')],'resourceId':_0x5004d9['id'],'type':_0x27df7c['name'],'sectionId':_0x27df7c['id']},{})[_0x821f('0x25')](function(){return _0x29e6ff;});}else{return _0x29e6ff;}})[_0x821f('0x48')](function(_0x5dafdc){logger[_0x821f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dafdc);throw _0x5dafdc;});}return _0x29e6ff;});}})['then'](respondWithResult(_0x86b32d,0xc9))[_0x821f('0x48')](handleError(_0x86b32d,null));};exports['update']=function(_0x1ccbc0,_0xb77858){if(_0x1ccbc0[_0x821f('0x4c')]['id']){delete _0x1ccbc0[_0x821f('0x4c')]['id'];}return db[_0x821f('0x2c')][_0x821f('0x4a')]({'where':{'id':_0x1ccbc0[_0x821f('0x59')]['id']}})[_0x821f('0x25')](handleEntityNotFound(_0xb77858,null))[_0x821f('0x25')](saveUpdates(_0x1ccbc0[_0x821f('0x4c')],null))[_0x821f('0x25')](respondWithResult(_0xb77858,null))[_0x821f('0x48')](handleError(_0xb77858,null));};exports[_0x821f('0x26')]=function(_0x3316cf,_0x399d06){return db[_0x821f('0x2c')][_0x821f('0x4a')]({'where':{'id':_0x3316cf[_0x821f('0x59')]['id']}})[_0x821f('0x25')](handleEntityNotFound(_0x399d06,null))[_0x821f('0x25')](removeEntity(_0x399d06,null))[_0x821f('0x48')](handleError(_0x399d06,null));};exports[_0x821f('0x5a')]=function(_0x1c8bb9,_0x169f8f,_0x13f19c){var _0x1b1212={'raw':!![],'where':{}};var _0xddd0a4={};var _0x29dc0c={'count':0x0,'rows':[]};return db[_0x821f('0x2c')][_0x821f('0x5b')]({'where':{'id':_0x1c8bb9[_0x821f('0x59')]['id']}})[_0x821f('0x25')](handleEntityNotFound(_0x169f8f,null))[_0x821f('0x25')](function(_0x83a2c5){if(_0x83a2c5){_0xddd0a4['model']=_[_0x821f('0x32')](db[_0x821f('0x5c')][_0x821f('0x2d')]);_0xddd0a4['query']=_[_0x821f('0x32')](_0x1c8bb9[_0x821f('0x37')]);_0xddd0a4['filters']=_[_0x821f('0x34')](_0xddd0a4[_0x821f('0x31')],_0xddd0a4[_0x821f('0x37')]);_0x1b1212[_0x821f('0x35')]=_[_0x821f('0x34')](_0xddd0a4[_0x821f('0x31')],qs[_0x821f('0x36')](_0x1c8bb9[_0x821f('0x37')][_0x821f('0x36')]));_0x1b1212[_0x821f('0x35')]=_0x1b1212[_0x821f('0x35')][_0x821f('0x38')]?_0x1b1212['attributes']:_0xddd0a4[_0x821f('0x31')];if(!_0x1c8bb9[_0x821f('0x37')]['hasOwnProperty'](_0x821f('0x3a'))){_0x1b1212[_0x821f('0x21')]=qs['limit'](_0x1c8bb9[_0x821f('0x37')][_0x821f('0x21')]);_0x1b1212[_0x821f('0x3b')]=qs['offset'](_0x1c8bb9[_0x821f('0x37')][_0x821f('0x3b')]);}_0x1b1212['order']=qs[_0x821f('0x3d')](_0x1c8bb9[_0x821f('0x37')][_0x821f('0x3d')]);_0x1b1212[_0x821f('0x40')]=qs[_0x821f('0x33')](_[_0x821f('0x3e')](_0x1c8bb9['query'],_0xddd0a4[_0x821f('0x33')]));_0x1b1212['where']['CampaignId']=_0x83a2c5['id'];if(_0x1c8bb9[_0x821f('0x37')][_0x821f('0x3f')]){_0x1b1212['where']=_['merge'](_0x1b1212[_0x821f('0x40')],{'$or':_[_0x821f('0x2b')](_0x1b1212[_0x821f('0x35')],function(_0x3a04c3){var _0x4aa0be={};_0x4aa0be[_0x3a04c3]={'$like':'%'+_0x1c8bb9[_0x821f('0x37')]['filter']+'%'};return _0x4aa0be;})});}_0x1b1212=_['merge']({},_0x1b1212,_0x1c8bb9[_0x821f('0x43')]);return db[_0x821f('0x5c')][_0x821f('0x20')]({'where':_0x1b1212[_0x821f('0x40')]})[_0x821f('0x25')](function(_0x406e9d){_0x29dc0c[_0x821f('0x20')]=_0x406e9d;if(_0x1c8bb9[_0x821f('0x37')][_0x821f('0x44')]){_0x1b1212[_0x821f('0x45')]=[{'all':!![]}];}return db[_0x821f('0x5c')][_0x821f('0x46')](_0x1b1212);})['then'](function(_0x3611c4){_0x29dc0c[_0x821f('0x47')]=_0x3611c4;return _0x29dc0c;});}})[_0x821f('0x25')](respondWithFilteredResult(_0x169f8f,_0x1b1212))[_0x821f('0x48')](handleError(_0x169f8f,null));};exports[_0x821f('0x5d')]=function(_0x2f735e,_0xa5293d,_0x43585b){var _0x4e820c={'raw':!![],'where':{}};var _0x531ffd={};var _0x5f0d0d={'count':0x0,'rows':[]};return db['Campaign'][_0x821f('0x5b')]({'where':{'id':_0x2f735e['params']['id']}})[_0x821f('0x25')](handleEntityNotFound(_0xa5293d,null))[_0x821f('0x25')](function(_0x195dae){if(_0x195dae){_0x531ffd[_0x821f('0x31')]=_[_0x821f('0x32')](db[_0x821f('0x5e')][_0x821f('0x2d')]);_0x531ffd[_0x821f('0x37')]=_[_0x821f('0x32')](_0x2f735e[_0x821f('0x37')]);_0x531ffd[_0x821f('0x33')]=_[_0x821f('0x34')](_0x531ffd[_0x821f('0x31')],_0x531ffd[_0x821f('0x37')]);_0x4e820c['attributes']=_['intersection'](_0x531ffd['model'],qs[_0x821f('0x36')](_0x2f735e['query'][_0x821f('0x36')]));_0x4e820c['attributes']=_0x4e820c[_0x821f('0x35')][_0x821f('0x38')]?_0x4e820c[_0x821f('0x35')]:_0x531ffd[_0x821f('0x31')];if(!_0x2f735e[_0x821f('0x37')][_0x821f('0x39')](_0x821f('0x3a'))){_0x4e820c['limit']=qs[_0x821f('0x21')](_0x2f735e['query'][_0x821f('0x21')]);_0x4e820c[_0x821f('0x3b')]=qs[_0x821f('0x3b')](_0x2f735e[_0x821f('0x37')][_0x821f('0x3b')]);}_0x4e820c[_0x821f('0x3c')]=qs[_0x821f('0x3d')](_0x2f735e[_0x821f('0x37')][_0x821f('0x3d')]);_0x4e820c['where']=qs[_0x821f('0x33')](_[_0x821f('0x3e')](_0x2f735e['query'],_0x531ffd[_0x821f('0x33')]));_0x4e820c[_0x821f('0x40')]['CampaignId']=_0x195dae['id'];if(_0x2f735e['query'][_0x821f('0x3f')]){_0x4e820c[_0x821f('0x40')]=_[_0x821f('0x42')](_0x4e820c[_0x821f('0x40')],{'$or':_[_0x821f('0x2b')](_0x4e820c[_0x821f('0x35')],function(_0x4d558b){var _0x55b21c={};_0x55b21c[_0x4d558b]={'$like':'%'+_0x2f735e[_0x821f('0x37')]['filter']+'%'};return _0x55b21c;})});}_0x4e820c=_[_0x821f('0x42')]({},_0x4e820c,_0x2f735e[_0x821f('0x43')]);return db[_0x821f('0x5e')][_0x821f('0x20')]({'where':_0x4e820c[_0x821f('0x40')]})['then'](function(_0x21ff7d){_0x5f0d0d[_0x821f('0x20')]=_0x21ff7d;if(_0x2f735e[_0x821f('0x37')]['includeAll']){_0x4e820c[_0x821f('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x821f('0x46')](_0x4e820c);})['then'](function(_0x454157){_0x5f0d0d['rows']=_0x454157;return _0x5f0d0d;});}})[_0x821f('0x25')](respondWithFilteredResult(_0xa5293d,_0x4e820c))[_0x821f('0x48')](handleError(_0xa5293d,null));};exports[_0x821f('0x5f')]=function(_0x260c5c,_0x165dcb,_0x5b4539){var _0x515791={'raw':!![],'where':{}};var _0x4e2f02={};var _0x1f52aa={'count':0x0,'rows':[]};return db['Campaign'][_0x821f('0x5b')]({'where':{'id':_0x260c5c[_0x821f('0x59')]['id']}})['then'](handleEntityNotFound(_0x165dcb,null))[_0x821f('0x25')](function(_0x52b202){if(_0x52b202){_0x4e2f02['model']=_[_0x821f('0x32')](db[_0x821f('0x60')][_0x821f('0x2d')]);_0x4e2f02[_0x821f('0x37')]=_[_0x821f('0x32')](_0x260c5c['query']);_0x4e2f02['filters']=_[_0x821f('0x34')](_0x4e2f02[_0x821f('0x31')],_0x4e2f02[_0x821f('0x37')]);_0x515791[_0x821f('0x35')]=_[_0x821f('0x34')](_0x4e2f02[_0x821f('0x31')],qs[_0x821f('0x36')](_0x260c5c[_0x821f('0x37')][_0x821f('0x36')]));_0x515791['attributes']=_0x515791[_0x821f('0x35')][_0x821f('0x38')]?_0x515791[_0x821f('0x35')]:_0x4e2f02[_0x821f('0x31')];if(!_0x260c5c[_0x821f('0x37')][_0x821f('0x39')]('nolimit')){_0x515791['limit']=qs[_0x821f('0x21')](_0x260c5c['query'][_0x821f('0x21')]);_0x515791[_0x821f('0x3b')]=qs[_0x821f('0x3b')](_0x260c5c['query'][_0x821f('0x3b')]);}_0x515791[_0x821f('0x3c')]=qs['sort'](_0x260c5c[_0x821f('0x37')][_0x821f('0x3d')]);_0x515791[_0x821f('0x40')]=qs[_0x821f('0x33')](_['pick'](_0x260c5c['query'],_0x4e2f02[_0x821f('0x33')]));_0x515791[_0x821f('0x40')][_0x821f('0x61')]=_0x52b202['id'];if(_0x260c5c[_0x821f('0x37')][_0x821f('0x3f')]){_0x515791[_0x821f('0x40')]=_[_0x821f('0x42')](_0x515791['where'],{'$or':_['map'](_0x515791[_0x821f('0x35')],function(_0x27b31f){var _0x45b65a={};_0x45b65a[_0x27b31f]={'$like':'%'+_0x260c5c[_0x821f('0x37')][_0x821f('0x3f')]+'%'};return _0x45b65a;})});}_0x515791=_[_0x821f('0x42')]({},_0x515791,_0x260c5c[_0x821f('0x43')]);return db[_0x821f('0x60')][_0x821f('0x20')]({'where':_0x515791[_0x821f('0x40')]})[_0x821f('0x25')](function(_0x21d120){_0x1f52aa[_0x821f('0x20')]=_0x21d120;if(_0x260c5c[_0x821f('0x37')]['includeAll']){_0x515791[_0x821f('0x45')]=[{'all':!![]}];}return db[_0x821f('0x60')][_0x821f('0x46')](_0x515791);})[_0x821f('0x25')](function(_0x51f9d7){_0x1f52aa[_0x821f('0x47')]=_0x51f9d7;return _0x1f52aa;});}})[_0x821f('0x25')](respondWithFilteredResult(_0x165dcb,_0x515791))[_0x821f('0x48')](handleError(_0x165dcb,null));};exports['getHopperBlacks']=function(_0x44bfdb,_0x2d95d9,_0x38f366){var _0x6cb426={'raw':!![],'where':{}};var _0x33a628={};var _0x5c0ce4={'count':0x0,'rows':[]};return db[_0x821f('0x2c')]['findOne']({'where':{'id':_0x44bfdb['params']['id']}})['then'](handleEntityNotFound(_0x2d95d9,null))['then'](function(_0x6bcd5b){if(_0x6bcd5b){_0x33a628[_0x821f('0x31')]=_[_0x821f('0x32')](db[_0x821f('0x62')]['rawAttributes']);_0x33a628[_0x821f('0x37')]=_[_0x821f('0x32')](_0x44bfdb['query']);_0x33a628[_0x821f('0x33')]=_[_0x821f('0x34')](_0x33a628[_0x821f('0x31')],_0x33a628[_0x821f('0x37')]);_0x6cb426['attributes']=_[_0x821f('0x34')](_0x33a628['model'],qs[_0x821f('0x36')](_0x44bfdb[_0x821f('0x37')][_0x821f('0x36')]));_0x6cb426['attributes']=_0x6cb426[_0x821f('0x35')][_0x821f('0x38')]?_0x6cb426[_0x821f('0x35')]:_0x33a628[_0x821f('0x31')];if(!_0x44bfdb[_0x821f('0x37')][_0x821f('0x39')](_0x821f('0x3a'))){_0x6cb426['limit']=qs[_0x821f('0x21')](_0x44bfdb[_0x821f('0x37')][_0x821f('0x21')]);_0x6cb426['offset']=qs['offset'](_0x44bfdb[_0x821f('0x37')][_0x821f('0x3b')]);}_0x6cb426[_0x821f('0x3c')]=qs[_0x821f('0x3d')](_0x44bfdb['query'][_0x821f('0x3d')]);_0x6cb426[_0x821f('0x40')]=qs[_0x821f('0x33')](_[_0x821f('0x3e')](_0x44bfdb[_0x821f('0x37')],_0x33a628[_0x821f('0x33')]));_0x6cb426[_0x821f('0x40')][_0x821f('0x61')]=_0x6bcd5b['id'];if(_0x44bfdb['query'][_0x821f('0x3f')]){_0x6cb426['where']=_[_0x821f('0x42')](_0x6cb426[_0x821f('0x40')],{'$or':_[_0x821f('0x2b')](_0x6cb426[_0x821f('0x35')],function(_0x3df0c7){var _0x1894a3={};_0x1894a3[_0x3df0c7]={'$like':'%'+_0x44bfdb['query'][_0x821f('0x3f')]+'%'};return _0x1894a3;})});}_0x6cb426=_['merge']({},_0x6cb426,_0x44bfdb[_0x821f('0x43')]);return db['CmHopperBlack'][_0x821f('0x20')]({'where':_0x6cb426[_0x821f('0x40')]})[_0x821f('0x25')](function(_0x3c3085){_0x5c0ce4[_0x821f('0x20')]=_0x3c3085;if(_0x44bfdb['query'][_0x821f('0x44')]){_0x6cb426[_0x821f('0x45')]=[{'all':!![]}];}return db[_0x821f('0x62')][_0x821f('0x46')](_0x6cb426);})[_0x821f('0x25')](function(_0x22c52a){_0x5c0ce4[_0x821f('0x47')]=_0x22c52a;return _0x5c0ce4;});}})[_0x821f('0x25')](respondWithFilteredResult(_0x2d95d9,_0x6cb426))[_0x821f('0x48')](handleError(_0x2d95d9,null));};exports['getLists']=function(_0x3c8a3e,_0x5186dd,_0x4f0f92){var _0x5eadc1={};var _0x39f66e={};var _0x36b360;var _0x3f6d27;return db[_0x821f('0x2c')][_0x821f('0x5b')]({'where':{'id':_0x3c8a3e[_0x821f('0x59')]['id']}})[_0x821f('0x25')](handleEntityNotFound(_0x5186dd,null))['then'](function(_0xc0a78c){if(_0xc0a78c){_0x36b360=_0xc0a78c;_0x39f66e[_0x821f('0x31')]=_[_0x821f('0x32')](db[_0x821f('0x63')]['rawAttributes']);_0x39f66e[_0x821f('0x37')]=_[_0x821f('0x32')](_0x3c8a3e[_0x821f('0x37')]);_0x39f66e[_0x821f('0x33')]=_[_0x821f('0x34')](_0x39f66e['model'],_0x39f66e[_0x821f('0x37')]);_0x5eadc1[_0x821f('0x35')]=_[_0x821f('0x34')](_0x39f66e[_0x821f('0x31')],qs['fields'](_0x3c8a3e['query'][_0x821f('0x36')]));_0x5eadc1['attributes']=_0x5eadc1[_0x821f('0x35')][_0x821f('0x38')]?_0x5eadc1[_0x821f('0x35')]:_0x39f66e[_0x821f('0x31')];_0x5eadc1['order']=qs[_0x821f('0x3d')](_0x3c8a3e[_0x821f('0x37')][_0x821f('0x3d')]);_0x5eadc1[_0x821f('0x40')]=qs[_0x821f('0x33')](_[_0x821f('0x3e')](_0x3c8a3e['query'],_0x39f66e[_0x821f('0x33')]));if(_0x3c8a3e[_0x821f('0x37')][_0x821f('0x3f')]){_0x5eadc1[_0x821f('0x40')]=_[_0x821f('0x42')](_0x5eadc1[_0x821f('0x40')],{'$or':_[_0x821f('0x2b')](_0x5eadc1[_0x821f('0x35')],function(_0x57ad8f){var _0x1b4de3={};_0x1b4de3[_0x57ad8f]={'$like':'%'+_0x3c8a3e[_0x821f('0x37')][_0x821f('0x3f')]+'%'};return _0x1b4de3;})});}_0x5eadc1=_[_0x821f('0x42')]({},_0x5eadc1,_0x3c8a3e[_0x821f('0x43')]);return _0x36b360[_0x821f('0x64')](_0x5eadc1);}})[_0x821f('0x25')](function(_0x53e224){if(_0x53e224){_0x3f6d27=_0x53e224[_0x821f('0x38')];if(!_0x3c8a3e[_0x821f('0x37')][_0x821f('0x39')](_0x821f('0x3a'))){_0x5eadc1['limit']=qs[_0x821f('0x21')](_0x3c8a3e[_0x821f('0x37')][_0x821f('0x21')]);_0x5eadc1[_0x821f('0x3b')]=qs[_0x821f('0x3b')](_0x3c8a3e['query'][_0x821f('0x3b')]);}return _0x36b360[_0x821f('0x64')](_0x5eadc1);}})['then'](function(_0x257428){if(_0x257428){return _0x257428?{'count':_0x3f6d27,'rows':_0x257428}:null;}})[_0x821f('0x25')](respondWithResult(_0x5186dd,null))[_0x821f('0x48')](handleError(_0x5186dd,null));};exports[_0x821f('0x65')]=function(_0x377c3d,_0x48fa4e,_0x482271){var _0x518616,_0x2e7e39;var _0x156316=[];var _0x452c2e=moment()[_0x821f('0x66')](_0x821f('0x67'));return db[_0x821f('0x2c')][_0x821f('0x4a')]({'where':{'id':_0x377c3d[_0x821f('0x59')]['id']}})[_0x821f('0x25')](handleEntityNotFound(_0x48fa4e,null))[_0x821f('0x25')](function(_0x52af51){if(_0x52af51){_0x2e7e39=_0x52af51;return _0x52af51[_0x821f('0x65')](_0x377c3d['body'][_0x821f('0x68')],_[_0x821f('0x54')](_0x377c3d[_0x821f('0x4c')],[_0x821f('0x68'),'id'])||{});}return null;})[_0x821f('0x69')](function(_0x2a79c7){var _0x724c60;var _0xf463c8;_0x518616=_0x2a79c7||[];var _0x5efe47=[];if(_0x2a79c7){for(var _0x5e8e2f=0x0;_0x5e8e2f<_0x2a79c7['length'];_0x5e8e2f+=0x1){var _0x2553fa=_0x2a79c7[_0x5e8e2f][_0x821f('0x50')]({'plain':!![]});_0x2e7e39['dialCheckDuplicateType']=_0x377c3d[_0x821f('0x4c')][_0x821f('0x6a')]?_0x377c3d[_0x821f('0x4c')][_0x821f('0x6a')]:_0x2e7e39[_0x821f('0x6a')];switch(_0x2e7e39['dialCheckDuplicateType']){case _0x821f('0x6b'):_0x724c60=squel['insert']()[_0x821f('0x6c')]('cm_hopper')[_0x821f('0x6d')]([_0x821f('0x6e'),_0x821f('0x6f'),_0x821f('0x70'),_0x821f('0x71'),_0x821f('0x61'),_0x821f('0x56'),_0x821f('0x55')],squel[_0x821f('0x72')]()[_0x821f('0x73')](_0x821f('0x6e'),_0x821f('0x6e'))[_0x821f('0x73')]('NOW()',_0x821f('0x6f'))[_0x821f('0x73')]('id',_0x821f('0x70'))['field'](_0x2553fa[_0x821f('0x74')]['toString'](),_0x821f('0x71'))[_0x821f('0x73')](_0x377c3d[_0x821f('0x59')]['id'][_0x821f('0x75')](),'CampaignId')[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27',_0x821f('0x56'))[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27',_0x821f('0x55'))[_0x821f('0x76')]('cm_contacts')[_0x821f('0x40')](_0x821f('0x77'))[_0x821f('0x40')]('ListId\x20=\x20?',_0x2553fa[_0x821f('0x74')][_0x821f('0x75')]())['where'](_0x821f('0x78'))[_0x821f('0x40')](_0x821f('0x79'),squel[_0x821f('0x72')]()[_0x821f('0x73')](_0x821f('0x7a'))[_0x821f('0x76')]('cm_hopper_final')[_0x821f('0x40')](_0x821f('0x7b'),_0x377c3d['params']['id'][_0x821f('0x75')]()))[_0x821f('0x40')](_0x821f('0x79'),squel['select']()['field'](_0x821f('0x7c'))[_0x821f('0x76')](_0x821f('0x7d'))['where'](_0x821f('0x7b'),_0x377c3d['params']['id'][_0x821f('0x75')]())))[_0x821f('0x75')]();break;case'onlyIfOpen':_0x724c60=squel[_0x821f('0x7e')]()[_0x821f('0x6c')](_0x821f('0x7d'))['fromQuery']([_0x821f('0x6e'),'scheduledAt',_0x821f('0x70'),_0x821f('0x71'),'CampaignId',_0x821f('0x56'),_0x821f('0x55')],squel[_0x821f('0x72')]()[_0x821f('0x73')](_0x821f('0x6e'),_0x821f('0x6e'))['field'](_0x821f('0x7f'),'scheduledAt')[_0x821f('0x73')]('id',_0x821f('0x70'))[_0x821f('0x73')](_0x2553fa['CmListId'][_0x821f('0x75')](),_0x821f('0x71'))['field'](_0x377c3d[_0x821f('0x59')]['id'][_0x821f('0x75')](),_0x821f('0x61'))['field']('\x27'+_0x452c2e+'\x27',_0x821f('0x56'))[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27',_0x821f('0x55'))['from'](_0x821f('0x80'))[_0x821f('0x40')](_0x821f('0x77'))['where'](_0x821f('0x81'),_0x2553fa[_0x821f('0x74')][_0x821f('0x75')]())[_0x821f('0x40')](_0x821f('0x78'))['where'](_0x821f('0x79'),squel[_0x821f('0x72')]()[_0x821f('0x73')](_0x821f('0x7c'))[_0x821f('0x76')](_0x821f('0x7d'))[_0x821f('0x40')](_0x821f('0x7b'),_0x377c3d['params']['id'][_0x821f('0x75')]())))[_0x821f('0x75')]();break;default:_0x724c60=squel[_0x821f('0x7e')]()['into'](_0x821f('0x7d'))[_0x821f('0x6d')]([_0x821f('0x6e'),_0x821f('0x6f'),_0x821f('0x70'),_0x821f('0x71'),_0x821f('0x61'),_0x821f('0x56'),_0x821f('0x55')],squel['select']()[_0x821f('0x73')](_0x821f('0x6e'),_0x821f('0x6e'))[_0x821f('0x73')]('NOW()',_0x821f('0x6f'))[_0x821f('0x73')]('id',_0x821f('0x70'))[_0x821f('0x73')](_0x2553fa[_0x821f('0x74')]['toString'](),_0x821f('0x71'))['field'](_0x377c3d[_0x821f('0x59')]['id'][_0x821f('0x75')](),'CampaignId')[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27','createdAt')[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27',_0x821f('0x55'))[_0x821f('0x76')](_0x821f('0x80'))['where'](_0x821f('0x77'))[_0x821f('0x40')](_0x821f('0x81'),_0x2553fa[_0x821f('0x74')][_0x821f('0x75')]())[_0x821f('0x40')](_0x821f('0x78')))[_0x821f('0x75')]();}_0xf463c8=squel['insert']()['into'](_0x821f('0x82'))[_0x821f('0x6d')]([_0x821f('0x83'),_0x821f('0x6f'),'phone',_0x821f('0x84'),'createdAt',_0x821f('0x55')],squel[_0x821f('0x72')]()[_0x821f('0x73')](_0x821f('0x85'),'id')[_0x821f('0x73')](_0x821f('0x7f'),_0x821f('0x6f'))[_0x821f('0x73')](_0x821f('0x86'),'phone')['field']('ci.OrderBY',_0x821f('0x84'))[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27','createdAt')[_0x821f('0x73')]('\x27'+_0x452c2e+'\x27',_0x821f('0x55'))[_0x821f('0x76')](_0x821f('0x87'),'ci')[_0x821f('0x88')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x821f('0x40')]('h.ListId\x20=\x20?',_0x2553fa['CmListId'][_0x821f('0x75')]())[_0x821f('0x40')]('h.CampaignId=?',_0x377c3d['params']['id'][_0x821f('0x75')]())[_0x821f('0x40')](_0x821f('0x89'),_0x452c2e))['toString']();_0x5efe47[_0x821f('0x8a')](db[_0x821f('0x8b')]['query'](_0x724c60));_0x156316[_0x821f('0x8a')](db[_0x821f('0x8b')]['query'](_0xf463c8));}return BPromise[_0x821f('0x8c')](_0x5efe47);}})[_0x821f('0x25')](function(){return BPromise['all'](_0x156316);})[_0x821f('0x25')](function(){return _0x518616;})['then'](respondWithResult(_0x48fa4e,null))[_0x821f('0x48')](handleError(_0x48fa4e,null));};exports[_0x821f('0x8d')]=function(_0xdf8080,_0x1e6dc1,_0x33830f){return db[_0x821f('0x2c')][_0x821f('0x4a')]({'where':{'id':_0xdf8080[_0x821f('0x59')]['id']}})['then'](handleEntityNotFound(_0x1e6dc1,null))[_0x821f('0x25')](function(_0x4b5f37){if(_0x4b5f37){return _0x4b5f37['removeLists'](_0xdf8080[_0x821f('0x37')]['ids']);}})[_0x821f('0x25')](function(_0x5086c0){if(_0x5086c0){return db[_0x821f('0x5c')][_0x821f('0x26')]({'where':{'ListId':_0xdf8080['query'][_0x821f('0x68')],'CampaignId':_0xdf8080['params']['id']}})[_0x821f('0x25')](function(){return _0x5086c0;});}})[_0x821f('0x25')](respondWithStatusCode(_0x1e6dc1,null))[_0x821f('0x48')](handleError(_0x1e6dc1,null));};exports['getBlackLists']=function(_0x2b736f,_0x54419c,_0x499632){var _0x515b3e={};var _0x322175={};var _0x3406d8;var _0x3c6074;return db[_0x821f('0x2c')][_0x821f('0x5b')]({'where':{'id':_0x2b736f[_0x821f('0x59')]['id']}})[_0x821f('0x25')](handleEntityNotFound(_0x54419c,null))[_0x821f('0x25')](function(_0x22bced){if(_0x22bced){_0x3406d8=_0x22bced;_0x322175[_0x821f('0x31')]=_[_0x821f('0x32')](db[_0x821f('0x63')]['rawAttributes']);_0x322175[_0x821f('0x37')]=_[_0x821f('0x32')](_0x2b736f['query']);_0x322175[_0x821f('0x33')]=_[_0x821f('0x34')](_0x322175['model'],_0x322175[_0x821f('0x37')]);_0x515b3e[_0x821f('0x35')]=_[_0x821f('0x34')](_0x322175[_0x821f('0x31')],qs[_0x821f('0x36')](_0x2b736f[_0x821f('0x37')]['fields']));_0x515b3e[_0x821f('0x35')]=_0x515b3e[_0x821f('0x35')]['length']?_0x515b3e[_0x821f('0x35')]:_0x322175[_0x821f('0x31')];_0x515b3e[_0x821f('0x3c')]=qs[_0x821f('0x3d')](_0x2b736f[_0x821f('0x37')]['sort']);_0x515b3e[_0x821f('0x40')]=qs[_0x821f('0x33')](_[_0x821f('0x3e')](_0x2b736f[_0x821f('0x37')],_0x322175[_0x821f('0x33')]));if(_0x2b736f[_0x821f('0x37')][_0x821f('0x3f')]){_0x515b3e[_0x821f('0x40')]=_[_0x821f('0x42')](_0x515b3e[_0x821f('0x40')],{'$or':_[_0x821f('0x2b')](_0x515b3e[_0x821f('0x35')],function(_0x45666a){var _0x54b949={};_0x54b949[_0x45666a]={'$like':'%'+_0x2b736f[_0x821f('0x37')][_0x821f('0x3f')]+'%'};return _0x54b949;})});}_0x515b3e=_[_0x821f('0x42')]({},_0x515b3e,_0x2b736f[_0x821f('0x43')]);return _0x3406d8[_0x821f('0x8e')](_0x515b3e);}})['then'](function(_0x3a8910){if(_0x3a8910){_0x3c6074=_0x3a8910[_0x821f('0x38')];if(!_0x2b736f['query'][_0x821f('0x39')]('nolimit')){_0x515b3e[_0x821f('0x21')]=qs[_0x821f('0x21')](_0x2b736f[_0x821f('0x37')][_0x821f('0x21')]);_0x515b3e[_0x821f('0x3b')]=qs[_0x821f('0x3b')](_0x2b736f['query']['offset']);}return _0x3406d8[_0x821f('0x8e')](_0x515b3e);}})[_0x821f('0x25')](function(_0x29a44f){if(_0x29a44f){return _0x29a44f?{'count':_0x3c6074,'rows':_0x29a44f}:null;}})[_0x821f('0x25')](respondWithResult(_0x54419c,null))['catch'](handleError(_0x54419c,null));};exports[_0x821f('0x8f')]=function(_0x273bdb,_0x365f32,_0x3a8e6d){var _0x1796f1,_0x303bbf;var _0x55f70f=[];var _0x3c0747=moment()[_0x821f('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x821f('0x2c')]['find']({'where':{'id':_0x273bdb['params']['id']}})[_0x821f('0x25')](handleEntityNotFound(_0x365f32,null))['then'](function(_0x9a5990){if(_0x9a5990){_0x303bbf=_0x9a5990;return _0x9a5990[_0x821f('0x8f')](_0x273bdb[_0x821f('0x4c')][_0x821f('0x68')],_['omit'](_0x273bdb[_0x821f('0x4c')],[_0x821f('0x68'),'id'])||{});}return null;})['spread'](function(_0x25bd07){var _0x1ede1f;var _0x2a137c;_0x1796f1=_0x25bd07||[];var _0x3aba1f=[];if(_0x25bd07){for(var _0x3abba1=0x0;_0x3abba1<_0x25bd07[_0x821f('0x38')];_0x3abba1+=0x1){var _0x340a5b=_0x25bd07[_0x3abba1]['get']({'plain':!![]});_0x1ede1f=squel[_0x821f('0x7e')]()[_0x821f('0x6c')](_0x821f('0x90'))['fromQuery']([_0x821f('0x6e'),_0x821f('0x70'),_0x821f('0x71'),_0x821f('0x61'),_0x821f('0x56'),_0x821f('0x55')],squel[_0x821f('0x72')]()['field']('phone',_0x821f('0x6e'))[_0x821f('0x73')]('id','ContactId')[_0x821f('0x73')](_0x340a5b[_0x821f('0x74')][_0x821f('0x75')](),_0x821f('0x71'))[_0x821f('0x73')](_0x273bdb[_0x821f('0x59')]['id']['toString'](),_0x821f('0x61'))[_0x821f('0x73')](_0x821f('0x7f'),_0x821f('0x56'))['field'](_0x821f('0x7f'),_0x821f('0x55'))['from'](_0x821f('0x80'))[_0x821f('0x40')](_0x821f('0x77'))[_0x821f('0x40')](_0x821f('0x81'),_0x340a5b[_0x821f('0x74')][_0x821f('0x75')]())[_0x821f('0x40')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3aba1f['push'](db[_0x821f('0x8b')][_0x821f('0x37')](_0x1ede1f));}return BPromise[_0x821f('0x8c')](_0x3aba1f);}})[_0x821f('0x25')](function(){return _0x1796f1;})[_0x821f('0x25')](respondWithResult(_0x365f32,null))[_0x821f('0x48')](handleError(_0x365f32,null));};exports[_0x821f('0x91')]=function(_0x35338,_0x30b311,_0x2782b5){return db[_0x821f('0x2c')][_0x821f('0x4a')]({'where':{'id':_0x35338[_0x821f('0x59')]['id']}})['then'](handleEntityNotFound(_0x30b311,null))[_0x821f('0x25')](function(_0x54652f){if(_0x54652f){return _0x54652f['removeBlackLists'](_0x35338['query'][_0x821f('0x68')]);}})[_0x821f('0x25')](function(_0x499553){if(_0x499553){return db['CmHopperBlack'][_0x821f('0x26')]({'where':{'ListId':_0x35338[_0x821f('0x37')][_0x821f('0x68')],'CampaignId':_0x35338[_0x821f('0x59')]['id']}})[_0x821f('0x25')](function(){return _0x499553;});}})['then'](respondWithStatusCode(_0x30b311,null))[_0x821f('0x48')](handleError(_0x30b311,null));}; \ No newline at end of file +var _0x30d6=['sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','catch','params','fields','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','role','findOne','CampaignId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','omit','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x2d1357,_0x40febc){var _0x44f553=function(_0x5257bb){while(--_0x5257bb){_0x2d1357['push'](_0x2d1357['shift']());}};_0x44f553(++_0x40febc);}(_0x30d6,0x1b0));var _0x630d=function(_0x23f58d,_0x22b11c){_0x23f58d=_0x23f58d-0x0;var _0x515d10=_0x30d6[_0x23f58d];return _0x515d10;};'use strict';var emlformat=require(_0x630d('0x0'));var rimraf=require(_0x630d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x630d('0x2'));var rp=require('request-promise');var moment=require(_0x630d('0x3'));var BPromise=require(_0x630d('0x4'));var Mustache=require(_0x630d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x630d('0x6'));var csv=require(_0x630d('0x7'));var ejs=require(_0x630d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x630d('0x9'));var squel=require(_0x630d('0xa'));var crypto=require(_0x630d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x630d('0x7'));var querystring=require(_0x630d('0xc'));var Papa=require(_0x630d('0xd'));var Redis=require(_0x630d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x630d('0xf'));var as=require(_0x630d('0x10'));var hardwareService=require(_0x630d('0x11'));var logger=require(_0x630d('0x12'))(_0x630d('0x13'));var utils=require(_0x630d('0x14'));var config=require(_0x630d('0x15'));var licenseUtil=require(_0x630d('0x16'));var db=require(_0x630d('0x17'))['db'];function respondWithStatusCode(_0x3c86ef,_0x4e67c4){_0x4e67c4=_0x4e67c4||0xcc;return function(_0x1f458a){if(_0x1f458a){return _0x3c86ef['sendStatus'](_0x4e67c4);}return _0x3c86ef[_0x630d('0x18')](_0x4e67c4)[_0x630d('0x19')]();};}function respondWithResult(_0x51808f,_0x23e4e4){_0x23e4e4=_0x23e4e4||0xc8;return function(_0x1cc36b){if(_0x1cc36b){return _0x51808f[_0x630d('0x18')](_0x23e4e4)[_0x630d('0x1a')](_0x1cc36b);}};}function respondWithFilteredResult(_0x1c3f36,_0x82d90){return function(_0x162263){if(_0x162263){var _0x156687=typeof _0x82d90['offset']===_0x630d('0x1b')&&typeof _0x82d90['limit']===_0x630d('0x1b');var _0x48d0af=_0x162263['count'];var _0x227d62=_0x156687?0x0:_0x82d90[_0x630d('0x1c')];var _0x57066b=_0x156687?_0x162263[_0x630d('0x1d')]:_0x82d90[_0x630d('0x1c')]+_0x82d90['limit'];var _0x3443b1;if(_0x57066b>=_0x48d0af){_0x57066b=_0x48d0af;_0x3443b1=0xc8;}else{_0x3443b1=0xce;}_0x1c3f36['status'](_0x3443b1);return _0x1c3f36['set'](_0x630d('0x1e'),_0x227d62+'-'+_0x57066b+'/'+_0x48d0af)['json'](_0x162263);}return null;};}function patchUpdates(_0x2d960f){return function(_0xa7c90e){try{jsonpatch['apply'](_0xa7c90e,_0x2d960f,!![]);}catch(_0x9d16e6){return BPromise[_0x630d('0x1f')](_0x9d16e6);}return _0xa7c90e[_0x630d('0x20')]();};}function saveUpdates(_0x52d152,_0x4f5334){return function(_0x4c27b2){if(_0x4c27b2){return _0x4c27b2[_0x630d('0x21')](_0x52d152)[_0x630d('0x22')](function(_0x324f51){return _0x324f51;});}return null;};}function removeEntity(_0x56743e,_0x1e178e){return function(_0x1bae23){if(_0x1bae23){return _0x1bae23[_0x630d('0x23')]()[_0x630d('0x22')](function(){var _0x5ae2a1=_0x1bae23[_0x630d('0x24')]({'plain':!![]});var _0x10fb6e=_0x630d('0x25');return db[_0x630d('0x26')][_0x630d('0x23')]({'where':{'type':_0x10fb6e,'resourceId':_0x5ae2a1['id']}})[_0x630d('0x22')](function(){return _0x1bae23;});})[_0x630d('0x22')](function(){_0x56743e['status'](0xcc)[_0x630d('0x19')]();});}};}function handleEntityNotFound(_0x5c5d36,_0xd198d5){return function(_0x5346da){if(!_0x5346da){_0x5c5d36['sendStatus'](0x194);}return _0x5346da;};}function handleError(_0x368a88,_0x274a40){_0x274a40=_0x274a40||0x1f4;return function(_0x3d62dd){logger['error'](_0x3d62dd[_0x630d('0x27')]);if(_0x3d62dd['name']){delete _0x3d62dd[_0x630d('0x28')];}_0x368a88[_0x630d('0x18')](_0x274a40)[_0x630d('0x29')](_0x3d62dd);};}exports[_0x630d('0x2a')]=function(_0x20fc93,_0x8db5c1){var _0x2a9269={},_0x2d6d26={},_0x357f46={'count':0x0,'rows':[]};var _0x33ad60=_['map'](db[_0x630d('0x2b')][_0x630d('0x2c')],function(_0x2120e8){return{'name':_0x2120e8[_0x630d('0x2d')],'type':_0x2120e8[_0x630d('0x2e')][_0x630d('0x2f')]};});_0x2d6d26['model']=_[_0x630d('0x30')](_0x33ad60,_0x630d('0x28'));_0x2d6d26[_0x630d('0x31')]=_[_0x630d('0x32')](_0x20fc93[_0x630d('0x31')]);_0x2d6d26['filters']=_[_0x630d('0x33')](_0x2d6d26['model'],_0x2d6d26[_0x630d('0x31')]);_0x2a9269[_0x630d('0x34')]=_[_0x630d('0x33')](_0x2d6d26[_0x630d('0x35')],qs['fields'](_0x20fc93[_0x630d('0x31')]['fields']));_0x2a9269[_0x630d('0x34')]=_0x2a9269[_0x630d('0x34')][_0x630d('0x36')]?_0x2a9269[_0x630d('0x34')]:_0x2d6d26['model'];if(!_0x20fc93[_0x630d('0x31')][_0x630d('0x37')]('nolimit')){_0x2a9269[_0x630d('0x38')]=qs[_0x630d('0x38')](_0x20fc93[_0x630d('0x31')]['limit']);_0x2a9269[_0x630d('0x1c')]=qs[_0x630d('0x1c')](_0x20fc93[_0x630d('0x31')]['offset']);}_0x2a9269[_0x630d('0x39')]=qs[_0x630d('0x3a')](_0x20fc93['query'][_0x630d('0x3a')]);_0x2a9269[_0x630d('0x3b')]=qs[_0x630d('0x3c')](_[_0x630d('0x3d')](_0x20fc93[_0x630d('0x31')],_0x2d6d26[_0x630d('0x3c')]),_0x33ad60);if(_0x20fc93[_0x630d('0x31')][_0x630d('0x3e')]){_0x2a9269[_0x630d('0x3b')]=_['merge'](_0x2a9269[_0x630d('0x3b')],{'$or':_['map'](_0x33ad60,function(_0x13ed13){if(_0x13ed13[_0x630d('0x2e')]!==_0x630d('0x3f')){var _0x4a4f31={};_0x4a4f31[_0x13ed13[_0x630d('0x28')]]={'$like':'%'+_0x20fc93[_0x630d('0x31')][_0x630d('0x3e')]+'%'};return _0x4a4f31;}})});}_0x2a9269=_[_0x630d('0x40')]({},_0x2a9269,_0x20fc93['options']);var _0x25711={'where':_0x2a9269[_0x630d('0x3b')]};return db[_0x630d('0x2b')][_0x630d('0x1d')](_0x25711)[_0x630d('0x22')](function(_0x4402de){_0x357f46['count']=_0x4402de;if(_0x20fc93[_0x630d('0x31')][_0x630d('0x41')]){_0x2a9269['include']=[{'all':!![]}];}return db[_0x630d('0x2b')]['findAll'](_0x2a9269);})[_0x630d('0x22')](function(_0x4e4223){_0x357f46['rows']=_0x4e4223;return _0x357f46;})[_0x630d('0x22')](respondWithFilteredResult(_0x8db5c1,_0x2a9269))[_0x630d('0x42')](handleError(_0x8db5c1,null));};exports['show']=function(_0x319650,_0x400cb5){var _0x5b35a0={'raw':![],'where':{'id':_0x319650[_0x630d('0x43')]['id']}},_0x2d5580={};_0x2d5580[_0x630d('0x35')]=_['keys'](db[_0x630d('0x2b')][_0x630d('0x2c')]);_0x2d5580[_0x630d('0x31')]=_[_0x630d('0x32')](_0x319650['query']);_0x2d5580[_0x630d('0x3c')]=_['intersection'](_0x2d5580['model'],_0x2d5580[_0x630d('0x31')]);_0x5b35a0[_0x630d('0x34')]=_[_0x630d('0x33')](_0x2d5580[_0x630d('0x35')],qs[_0x630d('0x44')](_0x319650[_0x630d('0x31')][_0x630d('0x44')]));_0x5b35a0[_0x630d('0x34')]=_0x5b35a0['attributes']['length']?_0x5b35a0[_0x630d('0x34')]:_0x2d5580[_0x630d('0x35')];if(_0x319650[_0x630d('0x31')][_0x630d('0x41')]){_0x5b35a0[_0x630d('0x45')]=[{'all':!![]}];}_0x5b35a0=_['merge']({},_0x5b35a0,_0x319650[_0x630d('0x46')]);return db['Campaign'][_0x630d('0x47')](_0x5b35a0)[_0x630d('0x22')](handleEntityNotFound(_0x400cb5,null))[_0x630d('0x22')](respondWithResult(_0x400cb5,null))[_0x630d('0x42')](handleError(_0x400cb5,null));};exports['create']=function(_0x2c81c6,_0x17d3fe){return db[_0x630d('0x2b')][_0x630d('0x48')](_0x2c81c6['body'],{})['then'](function(_0x522b8e){var _0x432716=_0x2c81c6[_0x630d('0x49')][_0x630d('0x24')]({'plain':!![]});if(!_0x432716)throw new Error(_0x630d('0x4a'));if(_0x432716['role']===_0x630d('0x49')){var _0x3a225a=_0x522b8e[_0x630d('0x24')]({'plain':!![]});var _0x4c84dc=_0x630d('0x25');return db[_0x630d('0x4b')]['find']({'where':{'name':_0x4c84dc,'userProfileId':_0x432716[_0x630d('0x4c')]},'raw':!![]})['then'](function(_0x1d25aa){if(_0x1d25aa&&_0x1d25aa[_0x630d('0x4d')]===0x0){return db[_0x630d('0x26')][_0x630d('0x48')]({'name':_0x3a225a[_0x630d('0x28')],'resourceId':_0x3a225a['id'],'type':_0x1d25aa[_0x630d('0x28')],'sectionId':_0x1d25aa['id']},{})['then'](function(){return _0x522b8e;});}else{return _0x522b8e;}})[_0x630d('0x42')](function(_0x4ce602){logger[_0x630d('0x4e')](_0x630d('0x4f'),_0x4ce602);throw _0x4ce602;});}return _0x522b8e;})[_0x630d('0x22')](respondWithResult(_0x17d3fe,0xc9))[_0x630d('0x42')](handleError(_0x17d3fe,null));};exports[_0x630d('0x50')]=function(_0x4bc6cb,_0x5cf1e9){var _0xab862b={'where':{'id':_0x4bc6cb[_0x630d('0x43')]['id']}},_0xacf4de={};_0xacf4de[_0x630d('0x35')]=_[_0x630d('0x32')](db[_0x630d('0x2b')][_0x630d('0x2c')]);_0xab862b[_0x630d('0x34')]=_['intersection'](_0xacf4de[_0x630d('0x35')],qs[_0x630d('0x44')](_0x4bc6cb[_0x630d('0x31')][_0x630d('0x44')]));_0xab862b[_0x630d('0x34')]=_0xab862b[_0x630d('0x34')]['length']?_0xab862b[_0x630d('0x34')]:_0xacf4de['model'];if(_0x4bc6cb[_0x630d('0x31')][_0x630d('0x41')]){_0xab862b[_0x630d('0x45')]=[{'all':!![]}];}_0xab862b=_[_0x630d('0x40')]({},_0xab862b,_0x4bc6cb[_0x630d('0x46')]);return db['Campaign'][_0x630d('0x47')](_0xab862b)[_0x630d('0x22')](handleEntityNotFound(_0x5cf1e9,null))[_0x630d('0x22')](function(_0x27307a){if(_0x27307a){var _0x234804=_0x27307a[_0x630d('0x24')]({'plain':!![]});_0x234804=qs['omit'](_0x234804,['id',_0x630d('0x51'),_0x630d('0x52')]);_0x4bc6cb[_0x630d('0x53')]=_['omit'](_0x4bc6cb[_0x630d('0x53')],['id','createdAt',_0x630d('0x52')]);return db[_0x630d('0x2b')][_0x630d('0x48')](_[_0x630d('0x40')](_0x234804,_0x4bc6cb[_0x630d('0x53')]),{'include':_0x4bc6cb[_0x630d('0x31')][_0x630d('0x41')]?[{'all':!![]}]:undefined})[_0x630d('0x22')](function(_0x518cbe){var _0x296851=_0x4bc6cb['user'][_0x630d('0x24')]({'plain':!![]});if(!_0x296851)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x296851[_0x630d('0x54')]==='user'){var _0x304a9a=_0x518cbe['get']({'plain':!![]});var _0x49c8d7=_0x630d('0x25');return db[_0x630d('0x4b')]['find']({'where':{'name':_0x49c8d7,'userProfileId':_0x296851['userProfileId']},'raw':!![]})['then'](function(_0x22c547){if(_0x22c547&&_0x22c547[_0x630d('0x4d')]===0x0){return db[_0x630d('0x26')]['create']({'name':_0x304a9a['name'],'resourceId':_0x304a9a['id'],'type':_0x22c547[_0x630d('0x28')],'sectionId':_0x22c547['id']},{})[_0x630d('0x22')](function(){return _0x518cbe;});}else{return _0x518cbe;}})[_0x630d('0x42')](function(_0x2cd222){logger[_0x630d('0x4e')](_0x630d('0x4f'),_0x2cd222);throw _0x2cd222;});}return _0x518cbe;});}})[_0x630d('0x22')](respondWithResult(_0x5cf1e9,0xc9))[_0x630d('0x42')](handleError(_0x5cf1e9,null));};exports['update']=function(_0x55f5cf,_0x4c6c25){if(_0x55f5cf[_0x630d('0x53')]['id']){delete _0x55f5cf[_0x630d('0x53')]['id'];}return db['Campaign'][_0x630d('0x47')]({'where':{'id':_0x55f5cf['params']['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x4c6c25,null))[_0x630d('0x22')](saveUpdates(_0x55f5cf[_0x630d('0x53')],null))[_0x630d('0x22')](respondWithResult(_0x4c6c25,null))[_0x630d('0x42')](handleError(_0x4c6c25,null));};exports[_0x630d('0x23')]=function(_0x114772,_0x3bad41){return db[_0x630d('0x2b')][_0x630d('0x47')]({'where':{'id':_0x114772[_0x630d('0x43')]['id']}})['then'](handleEntityNotFound(_0x3bad41,null))['then'](removeEntity(_0x3bad41,null))[_0x630d('0x42')](handleError(_0x3bad41,null));};exports['getHoppers']=function(_0x104c4f,_0x40688a,_0x417f33){var _0x23e4ba={'raw':!![],'where':{}};var _0x57a7e9={};var _0xdf5bde={'count':0x0,'rows':[]};return db[_0x630d('0x2b')][_0x630d('0x55')]({'where':{'id':_0x104c4f[_0x630d('0x43')]['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x40688a,null))[_0x630d('0x22')](function(_0x5588c1){if(_0x5588c1){_0x57a7e9['model']=_[_0x630d('0x32')](db['CmHopper'][_0x630d('0x2c')]);_0x57a7e9[_0x630d('0x31')]=_[_0x630d('0x32')](_0x104c4f[_0x630d('0x31')]);_0x57a7e9[_0x630d('0x3c')]=_[_0x630d('0x33')](_0x57a7e9[_0x630d('0x35')],_0x57a7e9[_0x630d('0x31')]);_0x23e4ba[_0x630d('0x34')]=_['intersection'](_0x57a7e9['model'],qs[_0x630d('0x44')](_0x104c4f['query']['fields']));_0x23e4ba[_0x630d('0x34')]=_0x23e4ba['attributes']['length']?_0x23e4ba['attributes']:_0x57a7e9[_0x630d('0x35')];if(!_0x104c4f[_0x630d('0x31')][_0x630d('0x37')]('nolimit')){_0x23e4ba['limit']=qs[_0x630d('0x38')](_0x104c4f['query'][_0x630d('0x38')]);_0x23e4ba[_0x630d('0x1c')]=qs[_0x630d('0x1c')](_0x104c4f[_0x630d('0x31')][_0x630d('0x1c')]);}_0x23e4ba['order']=qs[_0x630d('0x3a')](_0x104c4f[_0x630d('0x31')][_0x630d('0x3a')]);_0x23e4ba[_0x630d('0x3b')]=qs[_0x630d('0x3c')](_[_0x630d('0x3d')](_0x104c4f[_0x630d('0x31')],_0x57a7e9['filters']));_0x23e4ba['where'][_0x630d('0x56')]=_0x5588c1['id'];if(_0x104c4f[_0x630d('0x31')]['filter']){_0x23e4ba[_0x630d('0x3b')]=_['merge'](_0x23e4ba[_0x630d('0x3b')],{'$or':_[_0x630d('0x30')](_0x23e4ba[_0x630d('0x34')],function(_0x3aacfa){var _0x7dcfd2={};_0x7dcfd2[_0x3aacfa]={'$like':'%'+_0x104c4f[_0x630d('0x31')]['filter']+'%'};return _0x7dcfd2;})});}_0x23e4ba=_['merge']({},_0x23e4ba,_0x104c4f[_0x630d('0x46')]);return db[_0x630d('0x57')]['count']({'where':_0x23e4ba['where']})['then'](function(_0x58ef6f){_0xdf5bde[_0x630d('0x1d')]=_0x58ef6f;if(_0x104c4f[_0x630d('0x31')][_0x630d('0x41')]){_0x23e4ba['include']=[{'all':!![]}];}return db[_0x630d('0x57')][_0x630d('0x58')](_0x23e4ba);})[_0x630d('0x22')](function(_0x83e0fb){_0xdf5bde[_0x630d('0x59')]=_0x83e0fb;return _0xdf5bde;});}})['then'](respondWithFilteredResult(_0x40688a,_0x23e4ba))[_0x630d('0x42')](handleError(_0x40688a,null));};exports[_0x630d('0x5a')]=function(_0x1cfd6a,_0x7d9941,_0x31f39e){var _0x3f7aff={'raw':!![],'where':{}};var _0x5047a0={};var _0x30a9b4={'count':0x0,'rows':[]};return db[_0x630d('0x2b')][_0x630d('0x55')]({'where':{'id':_0x1cfd6a[_0x630d('0x43')]['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x7d9941,null))['then'](function(_0x327aba){if(_0x327aba){_0x5047a0['model']=_[_0x630d('0x32')](db[_0x630d('0x5b')][_0x630d('0x2c')]);_0x5047a0[_0x630d('0x31')]=_[_0x630d('0x32')](_0x1cfd6a[_0x630d('0x31')]);_0x5047a0[_0x630d('0x3c')]=_[_0x630d('0x33')](_0x5047a0[_0x630d('0x35')],_0x5047a0[_0x630d('0x31')]);_0x3f7aff[_0x630d('0x34')]=_[_0x630d('0x33')](_0x5047a0[_0x630d('0x35')],qs['fields'](_0x1cfd6a[_0x630d('0x31')][_0x630d('0x44')]));_0x3f7aff[_0x630d('0x34')]=_0x3f7aff[_0x630d('0x34')]['length']?_0x3f7aff[_0x630d('0x34')]:_0x5047a0[_0x630d('0x35')];if(!_0x1cfd6a['query'][_0x630d('0x37')](_0x630d('0x5c'))){_0x3f7aff[_0x630d('0x38')]=qs[_0x630d('0x38')](_0x1cfd6a[_0x630d('0x31')][_0x630d('0x38')]);_0x3f7aff[_0x630d('0x1c')]=qs[_0x630d('0x1c')](_0x1cfd6a[_0x630d('0x31')][_0x630d('0x1c')]);}_0x3f7aff[_0x630d('0x39')]=qs[_0x630d('0x3a')](_0x1cfd6a[_0x630d('0x31')][_0x630d('0x3a')]);_0x3f7aff[_0x630d('0x3b')]=qs[_0x630d('0x3c')](_[_0x630d('0x3d')](_0x1cfd6a[_0x630d('0x31')],_0x5047a0[_0x630d('0x3c')]));_0x3f7aff[_0x630d('0x3b')]['CampaignId']=_0x327aba['id'];if(_0x1cfd6a[_0x630d('0x31')][_0x630d('0x3e')]){_0x3f7aff[_0x630d('0x3b')]=_[_0x630d('0x40')](_0x3f7aff[_0x630d('0x3b')],{'$or':_[_0x630d('0x30')](_0x3f7aff[_0x630d('0x34')],function(_0xcf5dc4){var _0x32e12d={};_0x32e12d[_0xcf5dc4]={'$like':'%'+_0x1cfd6a[_0x630d('0x31')][_0x630d('0x3e')]+'%'};return _0x32e12d;})});}_0x3f7aff=_[_0x630d('0x40')]({},_0x3f7aff,_0x1cfd6a[_0x630d('0x46')]);return db['CmHopperHistory'][_0x630d('0x1d')]({'where':_0x3f7aff[_0x630d('0x3b')]})[_0x630d('0x22')](function(_0x2bb5f5){_0x30a9b4[_0x630d('0x1d')]=_0x2bb5f5;if(_0x1cfd6a['query']['includeAll']){_0x3f7aff[_0x630d('0x45')]=[{'all':!![]}];}return db[_0x630d('0x5b')][_0x630d('0x58')](_0x3f7aff);})[_0x630d('0x22')](function(_0x347fd1){_0x30a9b4[_0x630d('0x59')]=_0x347fd1;return _0x30a9b4;});}})['then'](respondWithFilteredResult(_0x7d9941,_0x3f7aff))[_0x630d('0x42')](handleError(_0x7d9941,null));};exports[_0x630d('0x5d')]=function(_0x555ee6,_0xce602e,_0x4fdcf4){var _0x36b585={'raw':!![],'where':{}};var _0x1d1d74={};var _0xc42603={'count':0x0,'rows':[]};return db[_0x630d('0x2b')][_0x630d('0x55')]({'where':{'id':_0x555ee6['params']['id']}})[_0x630d('0x22')](handleEntityNotFound(_0xce602e,null))[_0x630d('0x22')](function(_0x2da810){if(_0x2da810){_0x1d1d74[_0x630d('0x35')]=_[_0x630d('0x32')](db[_0x630d('0x5e')][_0x630d('0x2c')]);_0x1d1d74['query']=_[_0x630d('0x32')](_0x555ee6[_0x630d('0x31')]);_0x1d1d74[_0x630d('0x3c')]=_['intersection'](_0x1d1d74['model'],_0x1d1d74[_0x630d('0x31')]);_0x36b585['attributes']=_[_0x630d('0x33')](_0x1d1d74[_0x630d('0x35')],qs[_0x630d('0x44')](_0x555ee6[_0x630d('0x31')]['fields']));_0x36b585[_0x630d('0x34')]=_0x36b585[_0x630d('0x34')][_0x630d('0x36')]?_0x36b585['attributes']:_0x1d1d74[_0x630d('0x35')];if(!_0x555ee6[_0x630d('0x31')][_0x630d('0x37')]('nolimit')){_0x36b585['limit']=qs[_0x630d('0x38')](_0x555ee6[_0x630d('0x31')][_0x630d('0x38')]);_0x36b585[_0x630d('0x1c')]=qs[_0x630d('0x1c')](_0x555ee6[_0x630d('0x31')][_0x630d('0x1c')]);}_0x36b585[_0x630d('0x39')]=qs[_0x630d('0x3a')](_0x555ee6[_0x630d('0x31')][_0x630d('0x3a')]);_0x36b585[_0x630d('0x3b')]=qs[_0x630d('0x3c')](_['pick'](_0x555ee6[_0x630d('0x31')],_0x1d1d74[_0x630d('0x3c')]));_0x36b585[_0x630d('0x3b')][_0x630d('0x56')]=_0x2da810['id'];if(_0x555ee6['query'][_0x630d('0x3e')]){_0x36b585[_0x630d('0x3b')]=_[_0x630d('0x40')](_0x36b585[_0x630d('0x3b')],{'$or':_[_0x630d('0x30')](_0x36b585[_0x630d('0x34')],function(_0x17ca19){var _0x3ce33b={};_0x3ce33b[_0x17ca19]={'$like':'%'+_0x555ee6[_0x630d('0x31')]['filter']+'%'};return _0x3ce33b;})});}_0x36b585=_[_0x630d('0x40')]({},_0x36b585,_0x555ee6[_0x630d('0x46')]);return db[_0x630d('0x5e')][_0x630d('0x1d')]({'where':_0x36b585[_0x630d('0x3b')]})[_0x630d('0x22')](function(_0x4ba2e5){_0xc42603[_0x630d('0x1d')]=_0x4ba2e5;if(_0x555ee6[_0x630d('0x31')][_0x630d('0x41')]){_0x36b585[_0x630d('0x45')]=[{'all':!![]}];}return db[_0x630d('0x5e')]['findAll'](_0x36b585);})[_0x630d('0x22')](function(_0x29cfd6){_0xc42603[_0x630d('0x59')]=_0x29cfd6;return _0xc42603;});}})['then'](respondWithFilteredResult(_0xce602e,_0x36b585))[_0x630d('0x42')](handleError(_0xce602e,null));};exports[_0x630d('0x5f')]=function(_0x4a0086,_0x596b6f,_0x3b499a){var _0x4cdc7a={'raw':!![],'where':{}};var _0x113496={};var _0x5bccb0={'count':0x0,'rows':[]};return db[_0x630d('0x2b')][_0x630d('0x55')]({'where':{'id':_0x4a0086[_0x630d('0x43')]['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x596b6f,null))[_0x630d('0x22')](function(_0x5aefab){if(_0x5aefab){_0x113496['model']=_[_0x630d('0x32')](db[_0x630d('0x60')][_0x630d('0x2c')]);_0x113496[_0x630d('0x31')]=_['keys'](_0x4a0086[_0x630d('0x31')]);_0x113496[_0x630d('0x3c')]=_[_0x630d('0x33')](_0x113496['model'],_0x113496[_0x630d('0x31')]);_0x4cdc7a['attributes']=_[_0x630d('0x33')](_0x113496['model'],qs[_0x630d('0x44')](_0x4a0086[_0x630d('0x31')]['fields']));_0x4cdc7a[_0x630d('0x34')]=_0x4cdc7a[_0x630d('0x34')][_0x630d('0x36')]?_0x4cdc7a['attributes']:_0x113496['model'];if(!_0x4a0086[_0x630d('0x31')][_0x630d('0x37')](_0x630d('0x5c'))){_0x4cdc7a[_0x630d('0x38')]=qs[_0x630d('0x38')](_0x4a0086[_0x630d('0x31')]['limit']);_0x4cdc7a['offset']=qs[_0x630d('0x1c')](_0x4a0086[_0x630d('0x31')][_0x630d('0x1c')]);}_0x4cdc7a[_0x630d('0x39')]=qs[_0x630d('0x3a')](_0x4a0086[_0x630d('0x31')]['sort']);_0x4cdc7a['where']=qs[_0x630d('0x3c')](_[_0x630d('0x3d')](_0x4a0086[_0x630d('0x31')],_0x113496['filters']));_0x4cdc7a[_0x630d('0x3b')]['CampaignId']=_0x5aefab['id'];if(_0x4a0086['query'][_0x630d('0x3e')]){_0x4cdc7a[_0x630d('0x3b')]=_[_0x630d('0x40')](_0x4cdc7a['where'],{'$or':_['map'](_0x4cdc7a['attributes'],function(_0x14d9a6){var _0x4f551b={};_0x4f551b[_0x14d9a6]={'$like':'%'+_0x4a0086[_0x630d('0x31')]['filter']+'%'};return _0x4f551b;})});}_0x4cdc7a=_[_0x630d('0x40')]({},_0x4cdc7a,_0x4a0086['options']);return db[_0x630d('0x60')][_0x630d('0x1d')]({'where':_0x4cdc7a['where']})[_0x630d('0x22')](function(_0x2bbe36){_0x5bccb0[_0x630d('0x1d')]=_0x2bbe36;if(_0x4a0086['query'][_0x630d('0x41')]){_0x4cdc7a[_0x630d('0x45')]=[{'all':!![]}];}return db[_0x630d('0x60')][_0x630d('0x58')](_0x4cdc7a);})[_0x630d('0x22')](function(_0x5b7e2f){_0x5bccb0['rows']=_0x5b7e2f;return _0x5bccb0;});}})[_0x630d('0x22')](respondWithFilteredResult(_0x596b6f,_0x4cdc7a))['catch'](handleError(_0x596b6f,null));};exports[_0x630d('0x61')]=function(_0x628634,_0x260438,_0x3b72fa){var _0x4c89f4={};var _0x451a75={};var _0x2d1a1c;var _0x242649;return db[_0x630d('0x2b')][_0x630d('0x55')]({'where':{'id':_0x628634[_0x630d('0x43')]['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x260438,null))[_0x630d('0x22')](function(_0x214e14){if(_0x214e14){_0x2d1a1c=_0x214e14;_0x451a75[_0x630d('0x35')]=_[_0x630d('0x32')](db[_0x630d('0x62')][_0x630d('0x2c')]);_0x451a75[_0x630d('0x31')]=_[_0x630d('0x32')](_0x628634[_0x630d('0x31')]);_0x451a75['filters']=_[_0x630d('0x33')](_0x451a75[_0x630d('0x35')],_0x451a75['query']);_0x4c89f4[_0x630d('0x34')]=_['intersection'](_0x451a75[_0x630d('0x35')],qs[_0x630d('0x44')](_0x628634[_0x630d('0x31')][_0x630d('0x44')]));_0x4c89f4['attributes']=_0x4c89f4['attributes']['length']?_0x4c89f4[_0x630d('0x34')]:_0x451a75[_0x630d('0x35')];_0x4c89f4[_0x630d('0x39')]=qs[_0x630d('0x3a')](_0x628634['query'][_0x630d('0x3a')]);_0x4c89f4[_0x630d('0x3b')]=qs[_0x630d('0x3c')](_[_0x630d('0x3d')](_0x628634[_0x630d('0x31')],_0x451a75[_0x630d('0x3c')]));if(_0x628634[_0x630d('0x31')][_0x630d('0x3e')]){_0x4c89f4[_0x630d('0x3b')]=_['merge'](_0x4c89f4[_0x630d('0x3b')],{'$or':_[_0x630d('0x30')](_0x4c89f4[_0x630d('0x34')],function(_0x456de1){var _0x46ca50={};_0x46ca50[_0x456de1]={'$like':'%'+_0x628634[_0x630d('0x31')]['filter']+'%'};return _0x46ca50;})});}_0x4c89f4=_[_0x630d('0x40')]({},_0x4c89f4,_0x628634[_0x630d('0x46')]);return _0x2d1a1c[_0x630d('0x61')](_0x4c89f4);}})[_0x630d('0x22')](function(_0x3b21e8){if(_0x3b21e8){_0x242649=_0x3b21e8[_0x630d('0x36')];if(!_0x628634[_0x630d('0x31')][_0x630d('0x37')](_0x630d('0x5c'))){_0x4c89f4[_0x630d('0x38')]=qs[_0x630d('0x38')](_0x628634[_0x630d('0x31')]['limit']);_0x4c89f4[_0x630d('0x1c')]=qs[_0x630d('0x1c')](_0x628634[_0x630d('0x31')][_0x630d('0x1c')]);}return _0x2d1a1c[_0x630d('0x61')](_0x4c89f4);}})['then'](function(_0x2f649a){if(_0x2f649a){return _0x2f649a?{'count':_0x242649,'rows':_0x2f649a}:null;}})[_0x630d('0x22')](respondWithResult(_0x260438,null))[_0x630d('0x42')](handleError(_0x260438,null));};exports[_0x630d('0x63')]=function(_0xb4ac4e,_0x2728b0,_0x28a6e9){var _0x35ec4e,_0x17bb3f;var _0x15128d=[];var _0x436071=moment()[_0x630d('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x630d('0x2b')][_0x630d('0x47')]({'where':{'id':_0xb4ac4e['params']['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x2728b0,null))[_0x630d('0x22')](function(_0x1889cc){if(_0x1889cc){_0x17bb3f=_0x1889cc;return _0x1889cc['addLists'](_0xb4ac4e[_0x630d('0x53')][_0x630d('0x65')],_[_0x630d('0x66')](_0xb4ac4e['body'],[_0x630d('0x65'),'id'])||{});}return null;})[_0x630d('0x67')](function(_0x1da3d8){var _0x1e1802;var _0x4b0cdd;_0x35ec4e=_0x1da3d8||[];var _0xf69299=[];if(_0x1da3d8){for(var _0x59a2b8=0x0;_0x59a2b8<_0x1da3d8[_0x630d('0x36')];_0x59a2b8+=0x1){var _0x46571b=_0x1da3d8[_0x59a2b8]['get']({'plain':!![]});_0x17bb3f['dialCheckDuplicateType']=_0xb4ac4e[_0x630d('0x53')][_0x630d('0x68')]?_0xb4ac4e[_0x630d('0x53')][_0x630d('0x68')]:_0x17bb3f[_0x630d('0x68')];switch(_0x17bb3f[_0x630d('0x68')]){case _0x630d('0x69'):_0x1e1802=squel[_0x630d('0x6a')]()[_0x630d('0x6b')](_0x630d('0x6c'))['fromQuery']([_0x630d('0x6d'),_0x630d('0x6e'),_0x630d('0x6f'),_0x630d('0x70'),'CampaignId',_0x630d('0x51'),_0x630d('0x52')],squel[_0x630d('0x71')]()['field'](_0x630d('0x6d'),_0x630d('0x6d'))[_0x630d('0x72')]('NOW()',_0x630d('0x6e'))['field']('id',_0x630d('0x6f'))[_0x630d('0x72')](_0x46571b[_0x630d('0x73')][_0x630d('0x74')](),_0x630d('0x70'))[_0x630d('0x72')](_0xb4ac4e[_0x630d('0x43')]['id']['toString'](),_0x630d('0x56'))['field']('\x27'+_0x436071+'\x27','createdAt')['field']('\x27'+_0x436071+'\x27',_0x630d('0x52'))[_0x630d('0x75')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x630d('0x76'),_0x46571b[_0x630d('0x73')][_0x630d('0x74')]())[_0x630d('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x630d('0x3b')](_0x630d('0x77'),squel[_0x630d('0x71')]()[_0x630d('0x72')](_0x630d('0x78'))[_0x630d('0x75')](_0x630d('0x79'))[_0x630d('0x3b')](_0x630d('0x7a'),_0xb4ac4e[_0x630d('0x43')]['id']['toString']()))[_0x630d('0x3b')](_0x630d('0x77'),squel[_0x630d('0x71')]()['field'](_0x630d('0x7b'))[_0x630d('0x75')](_0x630d('0x6c'))[_0x630d('0x3b')]('CampaignId\x20=\x20?',_0xb4ac4e[_0x630d('0x43')]['id'][_0x630d('0x74')]())))[_0x630d('0x74')]();break;case'onlyIfOpen':_0x1e1802=squel[_0x630d('0x6a')]()['into'](_0x630d('0x6c'))[_0x630d('0x7c')]([_0x630d('0x6d'),_0x630d('0x6e'),_0x630d('0x6f'),_0x630d('0x70'),_0x630d('0x56'),_0x630d('0x51'),_0x630d('0x52')],squel[_0x630d('0x71')]()['field'](_0x630d('0x6d'),_0x630d('0x6d'))[_0x630d('0x72')](_0x630d('0x7d'),_0x630d('0x6e'))[_0x630d('0x72')]('id',_0x630d('0x6f'))[_0x630d('0x72')](_0x46571b[_0x630d('0x73')]['toString'](),_0x630d('0x70'))['field'](_0xb4ac4e[_0x630d('0x43')]['id']['toString'](),_0x630d('0x56'))[_0x630d('0x72')]('\x27'+_0x436071+'\x27',_0x630d('0x51'))['field']('\x27'+_0x436071+'\x27',_0x630d('0x52'))[_0x630d('0x75')](_0x630d('0x7e'))['where'](_0x630d('0x7f'))[_0x630d('0x3b')](_0x630d('0x76'),_0x46571b['CmListId'][_0x630d('0x74')]())[_0x630d('0x3b')](_0x630d('0x80'))[_0x630d('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x630d('0x71')]()[_0x630d('0x72')](_0x630d('0x7b'))[_0x630d('0x75')]('cm_hopper')[_0x630d('0x3b')](_0x630d('0x7a'),_0xb4ac4e[_0x630d('0x43')]['id']['toString']())))[_0x630d('0x74')]();break;default:_0x1e1802=squel[_0x630d('0x6a')]()['into'](_0x630d('0x6c'))[_0x630d('0x7c')]([_0x630d('0x6d'),_0x630d('0x6e'),'ContactId','ListId',_0x630d('0x56'),_0x630d('0x51'),'updatedAt'],squel[_0x630d('0x71')]()[_0x630d('0x72')](_0x630d('0x6d'),_0x630d('0x6d'))[_0x630d('0x72')](_0x630d('0x7d'),_0x630d('0x6e'))['field']('id',_0x630d('0x6f'))[_0x630d('0x72')](_0x46571b[_0x630d('0x73')]['toString'](),_0x630d('0x70'))[_0x630d('0x72')](_0xb4ac4e[_0x630d('0x43')]['id'][_0x630d('0x74')](),'CampaignId')['field']('\x27'+_0x436071+'\x27',_0x630d('0x51'))['field']('\x27'+_0x436071+'\x27','updatedAt')['from']('cm_contacts')[_0x630d('0x3b')]('deletedAt\x20IS\x20NULL')[_0x630d('0x3b')]('ListId\x20=\x20?',_0x46571b[_0x630d('0x73')][_0x630d('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x630d('0x74')]();}_0x4b0cdd=squel[_0x630d('0x6a')]()[_0x630d('0x6b')](_0x630d('0x81'))[_0x630d('0x7c')](['cmHopperId',_0x630d('0x6e'),'phone',_0x630d('0x82'),_0x630d('0x51'),_0x630d('0x52')],squel[_0x630d('0x71')]()[_0x630d('0x72')]('h.id','id')[_0x630d('0x72')](_0x630d('0x7d'),_0x630d('0x6e'))['field'](_0x630d('0x83'),'phone')[_0x630d('0x72')](_0x630d('0x84'),_0x630d('0x82'))[_0x630d('0x72')]('\x27'+_0x436071+'\x27',_0x630d('0x51'))[_0x630d('0x72')]('\x27'+_0x436071+'\x27',_0x630d('0x52'))['from'](_0x630d('0x85'),'ci')['join'](_0x630d('0x6c'),'h',_0x630d('0x86'))[_0x630d('0x3b')](_0x630d('0x87'),_0x46571b[_0x630d('0x73')][_0x630d('0x74')]())[_0x630d('0x3b')](_0x630d('0x88'),_0xb4ac4e['params']['id']['toString']())['where'](_0x630d('0x89'),_0x436071))[_0x630d('0x74')]();_0xf69299[_0x630d('0x8a')](db['sequelize'][_0x630d('0x31')](_0x1e1802));_0x15128d[_0x630d('0x8a')](db[_0x630d('0x8b')]['query'](_0x4b0cdd));}return BPromise[_0x630d('0x8c')](_0xf69299);}})[_0x630d('0x22')](function(){return BPromise['all'](_0x15128d);})[_0x630d('0x22')](function(){return _0x35ec4e;})[_0x630d('0x22')](respondWithResult(_0x2728b0,null))['catch'](handleError(_0x2728b0,null));};exports[_0x630d('0x8d')]=function(_0x5664a6,_0x40bff7,_0x1d4afb){return db[_0x630d('0x2b')][_0x630d('0x47')]({'where':{'id':_0x5664a6[_0x630d('0x43')]['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x40bff7,null))[_0x630d('0x22')](function(_0x5fb03a){if(_0x5fb03a){return _0x5fb03a[_0x630d('0x8d')](_0x5664a6[_0x630d('0x31')][_0x630d('0x65')]);}})[_0x630d('0x22')](function(_0x200714){if(_0x200714){return db[_0x630d('0x57')][_0x630d('0x23')]({'where':{'ListId':_0x5664a6[_0x630d('0x31')][_0x630d('0x65')],'CampaignId':_0x5664a6[_0x630d('0x43')]['id']}})['then'](function(){return _0x200714;});}})[_0x630d('0x22')](respondWithStatusCode(_0x40bff7,null))[_0x630d('0x42')](handleError(_0x40bff7,null));};exports[_0x630d('0x8e')]=function(_0x3395fe,_0x2aca64,_0xa24d6e){var _0x421241={};var _0x1efaa8={};var _0x333740;var _0x28dfa5;return db[_0x630d('0x2b')][_0x630d('0x55')]({'where':{'id':_0x3395fe['params']['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x2aca64,null))[_0x630d('0x22')](function(_0xcaadda){if(_0xcaadda){_0x333740=_0xcaadda;_0x1efaa8[_0x630d('0x35')]=_[_0x630d('0x32')](db[_0x630d('0x62')]['rawAttributes']);_0x1efaa8[_0x630d('0x31')]=_[_0x630d('0x32')](_0x3395fe['query']);_0x1efaa8[_0x630d('0x3c')]=_[_0x630d('0x33')](_0x1efaa8[_0x630d('0x35')],_0x1efaa8[_0x630d('0x31')]);_0x421241[_0x630d('0x34')]=_[_0x630d('0x33')](_0x1efaa8[_0x630d('0x35')],qs[_0x630d('0x44')](_0x3395fe['query'][_0x630d('0x44')]));_0x421241[_0x630d('0x34')]=_0x421241['attributes'][_0x630d('0x36')]?_0x421241[_0x630d('0x34')]:_0x1efaa8[_0x630d('0x35')];_0x421241[_0x630d('0x39')]=qs[_0x630d('0x3a')](_0x3395fe[_0x630d('0x31')]['sort']);_0x421241[_0x630d('0x3b')]=qs[_0x630d('0x3c')](_[_0x630d('0x3d')](_0x3395fe['query'],_0x1efaa8[_0x630d('0x3c')]));if(_0x3395fe['query'][_0x630d('0x3e')]){_0x421241[_0x630d('0x3b')]=_['merge'](_0x421241[_0x630d('0x3b')],{'$or':_[_0x630d('0x30')](_0x421241[_0x630d('0x34')],function(_0x456817){var _0x488f2d={};_0x488f2d[_0x456817]={'$like':'%'+_0x3395fe['query'][_0x630d('0x3e')]+'%'};return _0x488f2d;})});}_0x421241=_[_0x630d('0x40')]({},_0x421241,_0x3395fe[_0x630d('0x46')]);return _0x333740[_0x630d('0x8e')](_0x421241);}})[_0x630d('0x22')](function(_0x620517){if(_0x620517){_0x28dfa5=_0x620517['length'];if(!_0x3395fe[_0x630d('0x31')][_0x630d('0x37')](_0x630d('0x5c'))){_0x421241[_0x630d('0x38')]=qs[_0x630d('0x38')](_0x3395fe[_0x630d('0x31')]['limit']);_0x421241[_0x630d('0x1c')]=qs[_0x630d('0x1c')](_0x3395fe[_0x630d('0x31')]['offset']);}return _0x333740[_0x630d('0x8e')](_0x421241);}})[_0x630d('0x22')](function(_0x4c385a){if(_0x4c385a){return _0x4c385a?{'count':_0x28dfa5,'rows':_0x4c385a}:null;}})[_0x630d('0x22')](respondWithResult(_0x2aca64,null))[_0x630d('0x42')](handleError(_0x2aca64,null));};exports['addBlackLists']=function(_0xa31ad3,_0x109f7f,_0x59b217){var _0x3eedd5,_0x212575;var _0x5b89a1=[];var _0x3bfffe=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x630d('0x2b')][_0x630d('0x47')]({'where':{'id':_0xa31ad3[_0x630d('0x43')]['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x109f7f,null))[_0x630d('0x22')](function(_0x31e20a){if(_0x31e20a){_0x212575=_0x31e20a;return _0x31e20a[_0x630d('0x8f')](_0xa31ad3['body'][_0x630d('0x65')],_[_0x630d('0x66')](_0xa31ad3['body'],[_0x630d('0x65'),'id'])||{});}return null;})[_0x630d('0x67')](function(_0x1931a7){var _0xf25ef0;var _0x361d22;_0x3eedd5=_0x1931a7||[];var _0x1bb79c=[];if(_0x1931a7){for(var _0x189c8a=0x0;_0x189c8a<_0x1931a7['length'];_0x189c8a+=0x1){var _0x13b4e7=_0x1931a7[_0x189c8a][_0x630d('0x24')]({'plain':!![]});_0xf25ef0=squel[_0x630d('0x6a')]()[_0x630d('0x6b')](_0x630d('0x90'))[_0x630d('0x7c')]([_0x630d('0x6d'),_0x630d('0x6f'),'ListId',_0x630d('0x56'),_0x630d('0x51'),_0x630d('0x52')],squel[_0x630d('0x71')]()[_0x630d('0x72')]('phone','phone')[_0x630d('0x72')]('id','ContactId')['field'](_0x13b4e7['CmListId'][_0x630d('0x74')](),_0x630d('0x70'))[_0x630d('0x72')](_0xa31ad3['params']['id'][_0x630d('0x74')](),_0x630d('0x56'))[_0x630d('0x72')](_0x630d('0x7d'),'createdAt')[_0x630d('0x72')](_0x630d('0x7d'),'updatedAt')[_0x630d('0x75')](_0x630d('0x7e'))[_0x630d('0x3b')](_0x630d('0x7f'))[_0x630d('0x3b')](_0x630d('0x76'),_0x13b4e7[_0x630d('0x73')][_0x630d('0x74')]())[_0x630d('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x630d('0x74')]();_0x1bb79c[_0x630d('0x8a')](db[_0x630d('0x8b')][_0x630d('0x31')](_0xf25ef0));}return BPromise[_0x630d('0x8c')](_0x1bb79c);}})['then'](function(){return _0x3eedd5;})[_0x630d('0x22')](respondWithResult(_0x109f7f,null))[_0x630d('0x42')](handleError(_0x109f7f,null));};exports[_0x630d('0x91')]=function(_0x13dd25,_0x556169,_0xc138e7){return db[_0x630d('0x2b')][_0x630d('0x47')]({'where':{'id':_0x13dd25['params']['id']}})[_0x630d('0x22')](handleEntityNotFound(_0x556169,null))['then'](function(_0x26a1ed){if(_0x26a1ed){return _0x26a1ed[_0x630d('0x91')](_0x13dd25[_0x630d('0x31')][_0x630d('0x65')]);}})['then'](function(_0x37afdb){if(_0x37afdb){return db[_0x630d('0x60')][_0x630d('0x23')]({'where':{'ListId':_0x13dd25[_0x630d('0x31')]['ids'],'CampaignId':_0x13dd25[_0x630d('0x43')]['id']}})[_0x630d('0x22')](function(){return _0x37afdb;});}})[_0x630d('0x22')](respondWithStatusCode(_0x556169,null))[_0x630d('0x42')](handleError(_0x556169,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6f550fa..1fb6f4a 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0x7a54,0x106));var _0x47a5=function(_0xe0c1a7,_0x5f37cb){_0xe0c1a7=_0xe0c1a7-0x0;var _0x314d9b=_0x7a54[_0xe0c1a7];return _0x314d9b;};'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 024594e..5d43d5f 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 _0x847d=['request','then','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Campaign,\x20%s,\x20%s','message','info','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','debug','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3b36ec,_0x16d86d){var _0x453b5c=function(_0x3ff48a){while(--_0x3ff48a){_0x3b36ec['push'](_0x3b36ec['shift']());}};_0x453b5c(++_0x16d86d);}(_0x847d,0x14a));var _0xd847=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x847d[_0x817d9b];return _0x2752e1;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var BPromise=require(_0xd847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x4'));var logger=require(_0xd847('0x5'))('rpc');var config=require(_0xd847('0x6'));var jayson=require(_0xd847('0x7'));var client=jayson[_0xd847('0x8')][_0xd847('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3349,_0x20dbfd,_0x19fdb5){return new BPromise(function(_0x2bb22b,_0x235e82){return client[_0xd847('0xa')](_0x5f3349,_0x19fdb5)[_0xd847('0xb')](function(_0x17cb36){logger['info']('Campaign,\x20%s,\x20%s',_0x20dbfd,'request\x20sent');logger['debug'](_0xd847('0xc'),_0x20dbfd,_0xd847('0xd'),JSON[_0xd847('0xe')](_0x17cb36));if(_0x17cb36['error']){if(_0x17cb36['error'][_0xd847('0xf')]===0x1f4){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x235e82(_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);}logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x2bb22b(_0x17cb36['error'][_0xd847('0x12')]);}else{logger[_0xd847('0x13')](_0xd847('0x11'),_0x20dbfd,_0xd847('0xd'));_0x2bb22b(_0x17cb36[_0xd847('0x14')]['message']);}})[_0xd847('0x15')](function(_0x3e1e1c){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x3e1e1c);_0x235e82(_0x3e1e1c);});});}exports['GetCampaign']=function(_0x1ef765){var _0x5eb665=this;return new Promise(function(_0x4b6264,_0x44a57b){return db[_0xd847('0x16')][_0xd847('0x17')]({'raw':_0x1ef765[_0xd847('0x18')]?_0x1ef765['options'][_0xd847('0x19')]===undefined?!![]:![]:!![],'where':_0x1ef765['options']?_0x1ef765['options'][_0xd847('0x1a')]||null:null,'attributes':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1b')]||null:null,'limit':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1c')]||null:null,'include':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1d')]?_[_0xd847('0x1e')](_0x1ef765[_0xd847('0x18')]['include'],function(_0x560563){return{'model':db[_0x560563[_0xd847('0x1f')]],'as':_0x560563['as'],'attributes':_0x560563[_0xd847('0x1b')],'include':_0x560563[_0xd847('0x1d')]?_['map'](_0x560563[_0xd847('0x1d')],function(_0x246920){return{'model':db[_0x246920[_0xd847('0x1f')]],'as':_0x246920['as'],'attributes':_0x246920[_0xd847('0x1b')],'include':_0x246920[_0xd847('0x1d')]?_[_0xd847('0x1e')](_0x246920[_0xd847('0x1d')],function(_0x460eba){return{'model':db[_0x460eba[_0xd847('0x1f')]],'as':_0x460eba['as'],'attributes':_0x460eba['attributes']};}):[]};}):[]};}):[]:[]})[_0xd847('0xb')](function(_0x1d03e2){logger[_0xd847('0x13')](_0xd847('0x20'),_0x1ef765);logger[_0xd847('0x21')](_0xd847('0x20'),_0x1ef765,JSON['stringify'](_0x1d03e2));_0x4b6264(_0x1d03e2);})[_0xd847('0x15')](function(_0x5375fe){logger['error']('GetCampaign',_0x5375fe[_0xd847('0x12')],_0x1ef765);_0x44a57b(_0x5eb665[_0xd847('0x10')](0x1f4,_0x5375fe[_0xd847('0x12')]));});});}; \ No newline at end of file +var _0x50a6=['../../config/utils','../../config/logger','../../config/environment','http','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Campaign','options','raw','where','attributes','limit','map','include','model','info','GetCampaign','lodash','util','randomstring','../../mysqldb'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x50a6,0xa4));var _0x650a=function(_0xdd45,_0x2daf10){_0xdd45=_0xdd45-0x0;var _0x106736=_0x50a6[_0xdd45];return _0x106736;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x650a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x650a('0x3'))['db'];var utils=require(_0x650a('0x4'));var logger=require(_0x650a('0x5'))('rpc');var config=require(_0x650a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x650a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d1bb4,_0x2c22b9,_0x61618a){return new BPromise(function(_0x56d38f,_0x25366e){return client['request'](_0x2d1bb4,_0x61618a)[_0x650a('0x8')](function(_0x1e4796){logger['info'](_0x650a('0x9'),_0x2c22b9,_0x650a('0xa'));logger['debug'](_0x650a('0xb'),_0x2c22b9,'request\x20sent',JSON[_0x650a('0xc')](_0x1e4796));if(_0x1e4796['error']){if(_0x1e4796[_0x650a('0xd')]['code']===0x1f4){logger[_0x650a('0xd')]('Campaign,\x20%s,\x20%s',_0x2c22b9,_0x1e4796[_0x650a('0xd')][_0x650a('0xe')]);return _0x25366e(_0x1e4796[_0x650a('0xd')]['message']);}logger[_0x650a('0xd')](_0x650a('0x9'),_0x2c22b9,_0x1e4796[_0x650a('0xd')][_0x650a('0xe')]);return _0x56d38f(_0x1e4796[_0x650a('0xd')][_0x650a('0xe')]);}else{logger['info'](_0x650a('0x9'),_0x2c22b9,'request\x20sent');_0x56d38f(_0x1e4796[_0x650a('0xf')][_0x650a('0xe')]);}})[_0x650a('0x10')](function(_0x5d9c92){logger['error']('Campaign,\x20%s,\x20%s',_0x2c22b9,_0x5d9c92);_0x25366e(_0x5d9c92);});});}exports['GetCampaign']=function(_0x2ad2d7){var _0x359314=this;return new Promise(function(_0x41d2fa,_0xd0f717){return db[_0x650a('0x11')]['findAll']({'raw':_0x2ad2d7['options']?_0x2ad2d7[_0x650a('0x12')][_0x650a('0x13')]===undefined?!![]:![]:!![],'where':_0x2ad2d7['options']?_0x2ad2d7[_0x650a('0x12')][_0x650a('0x14')]||null:null,'attributes':_0x2ad2d7['options']?_0x2ad2d7[_0x650a('0x12')][_0x650a('0x15')]||null:null,'limit':_0x2ad2d7[_0x650a('0x12')]?_0x2ad2d7[_0x650a('0x12')][_0x650a('0x16')]||null:null,'include':_0x2ad2d7['options']?_0x2ad2d7[_0x650a('0x12')]['include']?_[_0x650a('0x17')](_0x2ad2d7[_0x650a('0x12')][_0x650a('0x18')],function(_0x469e53){return{'model':db[_0x469e53[_0x650a('0x19')]],'as':_0x469e53['as'],'attributes':_0x469e53[_0x650a('0x15')],'include':_0x469e53[_0x650a('0x18')]?_[_0x650a('0x17')](_0x469e53[_0x650a('0x18')],function(_0x2761a8){return{'model':db[_0x2761a8[_0x650a('0x19')]],'as':_0x2761a8['as'],'attributes':_0x2761a8[_0x650a('0x15')],'include':_0x2761a8[_0x650a('0x18')]?_[_0x650a('0x17')](_0x2761a8[_0x650a('0x18')],function(_0x39a155){return{'model':db[_0x39a155[_0x650a('0x19')]],'as':_0x39a155['as'],'attributes':_0x39a155[_0x650a('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2290a7){logger[_0x650a('0x1a')](_0x650a('0x1b'),_0x2ad2d7);logger['debug'](_0x650a('0x1b'),_0x2ad2d7,JSON[_0x650a('0xc')](_0x2290a7));_0x41d2fa(_0x2290a7);})[_0x650a('0x10')](function(_0x783509){logger[_0x650a('0xd')](_0x650a('0x1b'),_0x783509['message'],_0x2ad2d7);_0xd0f717(_0x359314[_0x650a('0xd')](0x1f4,_0x783509[_0x650a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9802e15..6757fe5 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 _0xfb3f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xfb3f,0xb2));var _0xffb3=function(_0x52b52b,_0x2d911b){_0x52b52b=_0x52b52b-0x0;var _0x32f894=_0xfb3f[_0x52b52b];return _0x32f894;};'use strict';var multer=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var path=require(_0xffb3('0x2'));var timeout=require(_0xffb3('0x3'));var express=require('express');var router=express[_0xffb3('0x4')]();var fs_extra=require(_0xffb3('0x5'));var auth=require(_0xffb3('0x6'));var interaction=require(_0xffb3('0x7'));var config=require('../../config/environment');var controller=require(_0xffb3('0x8'));router[_0xffb3('0x9')]('/',auth['isAuthenticated'](),controller[_0xffb3('0xa')]);router[_0xffb3('0x9')](_0xffb3('0xb'),auth['isAuthenticated'](),controller[_0xffb3('0xc')]);router[_0xffb3('0x9')](_0xffb3('0xd'),auth[_0xffb3('0xe')](),controller['getHoppers']);router[_0xffb3('0x9')](_0xffb3('0xf'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x10')]);router[_0xffb3('0x9')](_0xffb3('0x11'),auth[_0xffb3('0xe')](),controller['getHopperFinals']);router[_0xffb3('0x9')](_0xffb3('0x12'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x13')]);router[_0xffb3('0x9')](_0xffb3('0x14'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x15')]);router[_0xffb3('0x9')](_0xffb3('0x16'),auth['isAuthenticated'](),controller[_0xffb3('0x17')]);router[_0xffb3('0x18')]('/',auth[_0xffb3('0xe')](),controller['create']);router[_0xffb3('0x18')](_0xffb3('0x19'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x1a')]);router[_0xffb3('0x18')](_0xffb3('0x14'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x1b')]);router[_0xffb3('0x18')](_0xffb3('0x16'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x1c')]);router[_0xffb3('0x1d')](_0xffb3('0xb'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x1e')]);router['delete'](_0xffb3('0xb'),auth[_0xffb3('0xe')](),controller[_0xffb3('0x1f')]);router[_0xffb3('0x20')]('/:id/lists',auth['isAuthenticated'](),controller[_0xffb3('0x21')]);router['delete']('/:id/blacklists',auth[_0xffb3('0xe')](),controller[_0xffb3('0x22')]);module[_0xffb3('0x23')]=router; \ No newline at end of file +var _0xc38d=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc38d,0x110));var _0xdc38=function(_0xf8dfc8,_0x58486e){_0xf8dfc8=_0xf8dfc8-0x0;var _0x3a601d=_0xc38d[_0xf8dfc8];return _0x3a601d;};'use strict';var multer=require(_0xdc38('0x0'));var util=require(_0xdc38('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc38('0x2'));var router=express[_0xdc38('0x3')]();var fs_extra=require(_0xdc38('0x4'));var auth=require(_0xdc38('0x5'));var interaction=require(_0xdc38('0x6'));var config=require(_0xdc38('0x7'));var controller=require(_0xdc38('0x8'));router['get']('/',auth[_0xdc38('0x9')](),controller[_0xdc38('0xa')]);router['get'](_0xdc38('0xb'),auth['isAuthenticated'](),controller[_0xdc38('0xc')]);router[_0xdc38('0xd')](_0xdc38('0xe'),auth[_0xdc38('0x9')](),controller[_0xdc38('0xf')]);router[_0xdc38('0xd')]('/:id/hopper_histories',auth[_0xdc38('0x9')](),controller[_0xdc38('0x10')]);router[_0xdc38('0xd')](_0xdc38('0x11'),auth[_0xdc38('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xdc38('0x9')](),controller[_0xdc38('0x12')]);router['get'](_0xdc38('0x13'),auth[_0xdc38('0x9')](),controller[_0xdc38('0x14')]);router['get'](_0xdc38('0x15'),auth[_0xdc38('0x9')](),controller[_0xdc38('0x16')]);router['post']('/',auth[_0xdc38('0x9')](),controller[_0xdc38('0x17')]);router[_0xdc38('0x18')]('/:id/clone',auth[_0xdc38('0x9')](),controller['clone']);router[_0xdc38('0x18')](_0xdc38('0x13'),auth[_0xdc38('0x9')](),controller[_0xdc38('0x19')]);router[_0xdc38('0x18')](_0xdc38('0x15'),auth['isAuthenticated'](),controller[_0xdc38('0x1a')]);router[_0xdc38('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xdc38('0x1c')]);router[_0xdc38('0x1d')](_0xdc38('0xb'),auth[_0xdc38('0x9')](),controller[_0xdc38('0x1e')]);router[_0xdc38('0x1d')](_0xdc38('0x13'),auth['isAuthenticated'](),controller[_0xdc38('0x1f')]);router[_0xdc38('0x1d')]('/:id/blacklists',auth[_0xdc38('0x9')](),controller[_0xdc38('0x20')]);module[_0xdc38('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8e43245..6d3d2e6 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 _0x549e=['TEXT','medium','getDataValue','key','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x549e,0xe8));var _0xe549=function(_0x220a35,_0x215368){_0x220a35=_0x220a35-0x0;var _0x4808dd=_0x549e[_0x220a35];return _0x4808dd;};'use strict';var Sequelize=require('sequelize');module[_0xe549('0x0')]={'key':{'type':Sequelize[_0xe549('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xe549('0x2')],'length':_0xe549('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe549('0x4')](_0xe549('0x5'));}}}; \ No newline at end of file +var _0x5b4e=['STRING','TEXT','medium','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0xd25cef,_0x35c0e5){var _0x5d933d=function(_0x552767){while(--_0x552767){_0xd25cef['push'](_0xd25cef['shift']());}};_0x5d933d(++_0x35c0e5);}(_0x5b4e,0x196));var _0xe5b4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b4e[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xe5b4('0x0'));module[_0xe5b4('0x1')]={'key':{'type':Sequelize[_0xe5b4('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe5b4('0x3')],'length':_0xe5b4('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe5b4('0x2')]},'name':{'type':Sequelize[_0xe5b4('0x5')],'get':function(){return this[_0xe5b4('0x6')](_0xe5b4('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index bbab60f..28366da 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 _0x718e=['error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','catch','params','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','limit','undefined','count','offset','Content-Range','json','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x718e,0x143));var _0xe718=function(_0x12b859,_0x40804e){_0x12b859=_0x12b859-0x0;var _0x867976=_0x718e[_0x12b859];return _0x867976;};'use strict';var emlformat=require(_0xe718('0x0'));var rimraf=require(_0xe718('0x1'));var zipdir=require(_0xe718('0x2'));var jsonpatch=require(_0xe718('0x3'));var rp=require('request-promise');var moment=require(_0xe718('0x4'));var BPromise=require(_0xe718('0x5'));var Mustache=require(_0xe718('0x6'));var util=require(_0xe718('0x7'));var path=require(_0xe718('0x8'));var sox=require(_0xe718('0x9'));var csv=require(_0xe718('0xa'));var ejs=require(_0xe718('0xb'));var fs=require('fs');var fs_extra=require(_0xe718('0xc'));var _=require(_0xe718('0xd'));var squel=require(_0xe718('0xe'));var crypto=require('crypto');var jsforce=require(_0xe718('0xf'));var deskjs=require(_0xe718('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe718('0x11'));var Redis=require(_0xe718('0x12'));var authService=require(_0xe718('0x13'));var qs=require(_0xe718('0x14'));var as=require(_0xe718('0x15'));var hardwareService=require(_0xe718('0x16'));var logger=require('../../config/logger')(_0xe718('0x17'));var utils=require(_0xe718('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45afe7,_0x51443d){_0x51443d=_0x51443d||0xcc;return function(_0x22a3b2){if(_0x22a3b2){return _0x45afe7[_0xe718('0x19')](_0x51443d);}return _0x45afe7[_0xe718('0x1a')](_0x51443d)['end']();};}function respondWithResult(_0x57dc19,_0x5ae7fc){_0x5ae7fc=_0x5ae7fc||0xc8;return function(_0x1bb5de){if(_0x1bb5de){return _0x57dc19[_0xe718('0x1a')](_0x5ae7fc)['json'](_0x1bb5de);}};}function respondWithFilteredResult(_0x8a3fc1,_0x6e640b){return function(_0x212230){if(_0x212230){var _0x3f45ee=typeof _0x6e640b['offset']==='undefined'&&typeof _0x6e640b[_0xe718('0x1b')]===_0xe718('0x1c');var _0x15c810=_0x212230[_0xe718('0x1d')];var _0x1b21bc=_0x3f45ee?0x0:_0x6e640b[_0xe718('0x1e')];var _0x3529ee=_0x3f45ee?_0x212230[_0xe718('0x1d')]:_0x6e640b['offset']+_0x6e640b['limit'];var _0x3ccb3d;if(_0x3529ee>=_0x15c810){_0x3529ee=_0x15c810;_0x3ccb3d=0xc8;}else{_0x3ccb3d=0xce;}_0x8a3fc1['status'](_0x3ccb3d);return _0x8a3fc1['set'](_0xe718('0x1f'),_0x1b21bc+'-'+_0x3529ee+'/'+_0x15c810)[_0xe718('0x20')](_0x212230);}return null;};}function patchUpdates(_0x38ff8a){return function(_0x3bb95c){try{jsonpatch['apply'](_0x3bb95c,_0x38ff8a,!![]);}catch(_0x3940b7){return BPromise[_0xe718('0x21')](_0x3940b7);}return _0x3bb95c['save']();};}function saveUpdates(_0x45e0f8,_0x173b2a){return function(_0x26ed0b){if(_0x26ed0b){return _0x26ed0b[_0xe718('0x22')](_0x45e0f8)[_0xe718('0x23')](function(_0x335884){return _0x335884;});}return null;};}function removeEntity(_0x492610,_0x39b9b3){return function(_0x2cfac8){if(_0x2cfac8){return _0x2cfac8[_0xe718('0x24')]()[_0xe718('0x23')](function(){var _0x3f6ade=_0x2cfac8[_0xe718('0x25')]({'plain':!![]});var _0x18702e=_0xe718('0x26');return db[_0xe718('0x27')][_0xe718('0x24')]({'where':{'type':_0x18702e,'resourceId':_0x3f6ade['id']}})[_0xe718('0x23')](function(){return _0x2cfac8;});})[_0xe718('0x23')](function(){_0x492610[_0xe718('0x1a')](0xcc)[_0xe718('0x28')]();});}};}function handleEntityNotFound(_0x17ee64,_0x3994d7){return function(_0x1d3149){if(!_0x1d3149){_0x17ee64[_0xe718('0x19')](0x194);}return _0x1d3149;};}function handleError(_0x94c480,_0x426781){_0x426781=_0x426781||0x1f4;return function(_0x21ccb7){logger[_0xe718('0x29')](_0x21ccb7[_0xe718('0x2a')]);if(_0x21ccb7['name']){delete _0x21ccb7[_0xe718('0x2b')];}_0x94c480[_0xe718('0x1a')](_0x426781)[_0xe718('0x2c')](_0x21ccb7);};}exports[_0xe718('0x2d')]=function(_0x349f48,_0x2d334f){var _0x1f790a={},_0x66bfba={},_0x570e0b={'count':0x0,'rows':[]};var _0x277f02=_[_0xe718('0x2e')](db[_0xe718('0x2f')][_0xe718('0x30')],function(_0x513fa4){return{'name':_0x513fa4[_0xe718('0x31')],'type':_0x513fa4[_0xe718('0x32')][_0xe718('0x33')]};});_0x66bfba['model']=_[_0xe718('0x2e')](_0x277f02,_0xe718('0x2b'));_0x66bfba[_0xe718('0x34')]=_[_0xe718('0x35')](_0x349f48['query']);_0x66bfba[_0xe718('0x36')]=_[_0xe718('0x37')](_0x66bfba[_0xe718('0x38')],_0x66bfba[_0xe718('0x34')]);_0x1f790a[_0xe718('0x39')]=_['intersection'](_0x66bfba['model'],qs[_0xe718('0x3a')](_0x349f48[_0xe718('0x34')][_0xe718('0x3a')]));_0x1f790a['attributes']=_0x1f790a[_0xe718('0x39')]['length']?_0x1f790a[_0xe718('0x39')]:_0x66bfba[_0xe718('0x38')];if(!_0x349f48[_0xe718('0x34')][_0xe718('0x3b')](_0xe718('0x3c'))){_0x1f790a[_0xe718('0x1b')]=qs[_0xe718('0x1b')](_0x349f48[_0xe718('0x34')][_0xe718('0x1b')]);_0x1f790a[_0xe718('0x1e')]=qs[_0xe718('0x1e')](_0x349f48['query'][_0xe718('0x1e')]);}_0x1f790a[_0xe718('0x3d')]=qs[_0xe718('0x3e')](_0x349f48[_0xe718('0x34')][_0xe718('0x3e')]);_0x1f790a[_0xe718('0x3f')]=qs[_0xe718('0x36')](_[_0xe718('0x40')](_0x349f48[_0xe718('0x34')],_0x66bfba[_0xe718('0x36')]),_0x277f02);if(_0x349f48['query'][_0xe718('0x41')]){_0x1f790a['where']=_[_0xe718('0x42')](_0x1f790a['where'],{'$or':[{'key':{'$like':'%'+_0x349f48['query'][_0xe718('0x41')]+'%'}},{'value':{'$like':'%'+_0x349f48[_0xe718('0x34')][_0xe718('0x41')]+'%'}}]});}_0x1f790a=_[_0xe718('0x42')]({},_0x1f790a,_0x349f48[_0xe718('0x43')]);var _0x45eab5={'where':_0x1f790a[_0xe718('0x3f')]};return db[_0xe718('0x2f')][_0xe718('0x1d')](_0x45eab5)[_0xe718('0x23')](function(_0x463118){_0x570e0b[_0xe718('0x1d')]=_0x463118;if(_0x349f48[_0xe718('0x34')][_0xe718('0x44')]){_0x1f790a[_0xe718('0x45')]=[{'all':!![]}];}return db[_0xe718('0x2f')][_0xe718('0x46')](_0x1f790a);})[_0xe718('0x23')](function(_0x367172){_0x570e0b[_0xe718('0x47')]=_0x367172;return _0x570e0b;})[_0xe718('0x23')](respondWithFilteredResult(_0x2d334f,_0x1f790a))['catch'](handleError(_0x2d334f,null));};exports['show']=function(_0xd58b26,_0x1adfaa){var _0x3d5ce9={'raw':!![],'where':{'id':_0xd58b26['params']['id']}},_0x1273de={};_0x1273de[_0xe718('0x38')]=_[_0xe718('0x35')](db[_0xe718('0x2f')][_0xe718('0x30')]);_0x1273de[_0xe718('0x34')]=_[_0xe718('0x35')](_0xd58b26[_0xe718('0x34')]);_0x1273de['filters']=_[_0xe718('0x37')](_0x1273de[_0xe718('0x38')],_0x1273de[_0xe718('0x34')]);_0x3d5ce9[_0xe718('0x39')]=_[_0xe718('0x37')](_0x1273de[_0xe718('0x38')],qs[_0xe718('0x3a')](_0xd58b26[_0xe718('0x34')][_0xe718('0x3a')]));_0x3d5ce9[_0xe718('0x39')]=_0x3d5ce9[_0xe718('0x39')]['length']?_0x3d5ce9[_0xe718('0x39')]:_0x1273de[_0xe718('0x38')];if(_0xd58b26['query']['includeAll']){_0x3d5ce9[_0xe718('0x45')]=[{'all':!![]}];}_0x3d5ce9=_['merge']({},_0x3d5ce9,_0xd58b26[_0xe718('0x43')]);return db[_0xe718('0x2f')][_0xe718('0x48')](_0x3d5ce9)[_0xe718('0x23')](handleEntityNotFound(_0x1adfaa,null))[_0xe718('0x23')](respondWithResult(_0x1adfaa,null))[_0xe718('0x49')](handleError(_0x1adfaa,null));};exports['update']=function(_0x3e6f8f,_0x4352f7){if(_0x3e6f8f['body']['id']){delete _0x3e6f8f['body']['id'];}return db[_0xe718('0x2f')][_0xe718('0x48')]({'where':{'id':_0x3e6f8f[_0xe718('0x4a')]['id']}})[_0xe718('0x23')](handleEntityNotFound(_0x4352f7,null))[_0xe718('0x23')](saveUpdates(_0x3e6f8f[_0xe718('0x4b')],null))['then'](respondWithResult(_0x4352f7,null))[_0xe718('0x49')](handleError(_0x4352f7,null));};exports[_0xe718('0x24')]=function(_0x2a1584,_0x1837e5){return db['CannedAnswer'][_0xe718('0x48')]({'where':{'id':_0x2a1584[_0xe718('0x4a')]['id']}})[_0xe718('0x23')](handleEntityNotFound(_0x1837e5,null))[_0xe718('0x23')](removeEntity(_0x1837e5,null))[_0xe718('0x49')](handleError(_0x1837e5,null));};exports[_0xe718('0x4c')]=function(_0x51df69,_0x50ac7a){var _0x395052={'key':_0x51df69['body'][_0xe718('0x33')]};if(_0x51df69[_0xe718('0x4b')][_0xe718('0x4d')]){_0x395052['MailAccountId']=_0x51df69[_0xe718('0x4b')][_0xe718('0x4d')];}else if(_0x51df69[_0xe718('0x4b')]['SmsAccountId']){_0x395052[_0xe718('0x4e')]=_0x51df69['body'][_0xe718('0x4e')];}else if(_0x51df69[_0xe718('0x4b')][_0xe718('0x4f')]){_0x395052[_0xe718('0x4f')]=_0x51df69[_0xe718('0x4b')]['OpenchannelAccountId'];}else if(_0x51df69[_0xe718('0x4b')][_0xe718('0x50')]){_0x395052[_0xe718('0x50')]=_0x51df69['body'][_0xe718('0x50')];}return db['CannedAnswer'][_0xe718('0x48')]({'where':_0x395052})[_0xe718('0x23')](function(_0x4e0725){if(_0x4e0725){throw new db[(_0xe718('0x51'))][(_0xe718('0x52'))](_0xe718('0x53'));}return db['CannedAnswer']['create'](_0x51df69[_0xe718('0x4b')]);})[_0xe718('0x23')](function(_0x5b0153){var _0x386c17=_0x51df69['user'][_0xe718('0x25')]({'plain':!![]});if(!_0x386c17)throw new Error(_0xe718('0x54'));if(_0x386c17[_0xe718('0x55')]===_0xe718('0x56')){var _0x3d754b=_0x5b0153[_0xe718('0x25')]({'plain':!![]});return db[_0xe718('0x57')][_0xe718('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x386c17[_0xe718('0x58')]},'raw':!![]})[_0xe718('0x23')](function(_0x32d2e3){if(_0x32d2e3&&_0x32d2e3[_0xe718('0x59')]===0x0){return db[_0xe718('0x27')][_0xe718('0x4c')]({'name':_0x3d754b[_0xe718('0x2b')],'resourceId':_0x3d754b['id'],'type':_0x32d2e3[_0xe718('0x2b')],'sectionId':_0x32d2e3['id']},{})['then'](function(){return _0x5b0153;});}else{return _0x5b0153;}})[_0xe718('0x49')](function(_0x3a51de){logger[_0xe718('0x29')](_0xe718('0x5a'),_0x3a51de);throw _0x3a51de;});}return _0x5b0153;})[_0xe718('0x23')](respondWithResult(_0x50ac7a,0xc9))[_0xe718('0x49')](handleError(_0x50ac7a,null));}; \ No newline at end of file +var _0x21d9=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','catch','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x152b4d,_0x5e6b47){var _0x5abe5e=function(_0x13a033){while(--_0x13a033){_0x152b4d['push'](_0x152b4d['shift']());}};_0x5abe5e(++_0x5e6b47);}(_0x21d9,0x1ae));var _0x921d=function(_0x4a2707,_0x56a7aa){_0x4a2707=_0x4a2707-0x0;var _0x2eb468=_0x21d9[_0x4a2707];return _0x2eb468;};'use strict';var emlformat=require(_0x921d('0x0'));var rimraf=require(_0x921d('0x1'));var zipdir=require(_0x921d('0x2'));var jsonpatch=require(_0x921d('0x3'));var rp=require(_0x921d('0x4'));var moment=require(_0x921d('0x5'));var BPromise=require(_0x921d('0x6'));var Mustache=require('mustache');var util=require(_0x921d('0x7'));var path=require(_0x921d('0x8'));var sox=require(_0x921d('0x9'));var csv=require(_0x921d('0xa'));var ejs=require(_0x921d('0xb'));var fs=require('fs');var fs_extra=require(_0x921d('0xc'));var _=require(_0x921d('0xd'));var squel=require(_0x921d('0xe'));var crypto=require(_0x921d('0xf'));var jsforce=require(_0x921d('0x10'));var deskjs=require(_0x921d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x921d('0x12'));var Papa=require(_0x921d('0x13'));var Redis=require(_0x921d('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x921d('0x15'));var hardwareService=require(_0x921d('0x16'));var logger=require(_0x921d('0x17'))(_0x921d('0x18'));var utils=require(_0x921d('0x19'));var config=require(_0x921d('0x1a'));var licenseUtil=require(_0x921d('0x1b'));var db=require(_0x921d('0x1c'))['db'];function respondWithStatusCode(_0x44c951,_0x5a212f){_0x5a212f=_0x5a212f||0xcc;return function(_0x499f80){if(_0x499f80){return _0x44c951['sendStatus'](_0x5a212f);}return _0x44c951[_0x921d('0x1d')](_0x5a212f)[_0x921d('0x1e')]();};}function respondWithResult(_0x2aefac,_0x362bf4){_0x362bf4=_0x362bf4||0xc8;return function(_0x10285c){if(_0x10285c){return _0x2aefac[_0x921d('0x1d')](_0x362bf4)[_0x921d('0x1f')](_0x10285c);}};}function respondWithFilteredResult(_0x3e2baf,_0x5c64d9){return function(_0x141ab0){if(_0x141ab0){var _0x552053=typeof _0x5c64d9[_0x921d('0x20')]==='undefined'&&typeof _0x5c64d9[_0x921d('0x21')]===_0x921d('0x22');var _0x1e7e8d=_0x141ab0['count'];var _0x4ce8d5=_0x552053?0x0:_0x5c64d9['offset'];var _0x5bd96c=_0x552053?_0x141ab0[_0x921d('0x23')]:_0x5c64d9[_0x921d('0x20')]+_0x5c64d9[_0x921d('0x21')];var _0x126e94;if(_0x5bd96c>=_0x1e7e8d){_0x5bd96c=_0x1e7e8d;_0x126e94=0xc8;}else{_0x126e94=0xce;}_0x3e2baf[_0x921d('0x1d')](_0x126e94);return _0x3e2baf['set']('Content-Range',_0x4ce8d5+'-'+_0x5bd96c+'/'+_0x1e7e8d)[_0x921d('0x1f')](_0x141ab0);}return null;};}function patchUpdates(_0x48222b){return function(_0x3b84f8){try{jsonpatch[_0x921d('0x24')](_0x3b84f8,_0x48222b,!![]);}catch(_0x4b1e4a){return BPromise['reject'](_0x4b1e4a);}return _0x3b84f8[_0x921d('0x25')]();};}function saveUpdates(_0x51ee84,_0x1ec8fb){return function(_0x45833e){if(_0x45833e){return _0x45833e[_0x921d('0x26')](_0x51ee84)[_0x921d('0x27')](function(_0xfef3aa){return _0xfef3aa;});}return null;};}function removeEntity(_0xf63933,_0x3d8d01){return function(_0x1f2983){if(_0x1f2983){return _0x1f2983[_0x921d('0x28')]()[_0x921d('0x27')](function(){var _0x459208=_0x1f2983['get']({'plain':!![]});var _0x1facc5='CannedAnswers';return db[_0x921d('0x29')][_0x921d('0x28')]({'where':{'type':_0x1facc5,'resourceId':_0x459208['id']}})[_0x921d('0x27')](function(){return _0x1f2983;});})[_0x921d('0x27')](function(){_0xf63933[_0x921d('0x1d')](0xcc)[_0x921d('0x1e')]();});}};}function handleEntityNotFound(_0x471cf8,_0x2774ff){return function(_0x5b8f64){if(!_0x5b8f64){_0x471cf8['sendStatus'](0x194);}return _0x5b8f64;};}function handleError(_0x55fda7,_0x411894){_0x411894=_0x411894||0x1f4;return function(_0x3ff668){logger[_0x921d('0x2a')](_0x3ff668[_0x921d('0x2b')]);if(_0x3ff668[_0x921d('0x2c')]){delete _0x3ff668[_0x921d('0x2c')];}_0x55fda7[_0x921d('0x1d')](_0x411894)[_0x921d('0x2d')](_0x3ff668);};}exports[_0x921d('0x2e')]=function(_0xecaf05,_0x48ff95){var _0x492bc9={},_0xd718f9={},_0x501d00={'count':0x0,'rows':[]};var _0xfb1572=_[_0x921d('0x2f')](db[_0x921d('0x30')][_0x921d('0x31')],function(_0x5412f9){return{'name':_0x5412f9[_0x921d('0x32')],'type':_0x5412f9['type']['key']};});_0xd718f9['model']=_[_0x921d('0x2f')](_0xfb1572,_0x921d('0x2c'));_0xd718f9[_0x921d('0x33')]=_[_0x921d('0x34')](_0xecaf05['query']);_0xd718f9[_0x921d('0x35')]=_[_0x921d('0x36')](_0xd718f9[_0x921d('0x37')],_0xd718f9[_0x921d('0x33')]);_0x492bc9[_0x921d('0x38')]=_[_0x921d('0x36')](_0xd718f9[_0x921d('0x37')],qs[_0x921d('0x39')](_0xecaf05[_0x921d('0x33')]['fields']));_0x492bc9[_0x921d('0x38')]=_0x492bc9[_0x921d('0x38')][_0x921d('0x3a')]?_0x492bc9[_0x921d('0x38')]:_0xd718f9['model'];if(!_0xecaf05[_0x921d('0x33')][_0x921d('0x3b')]('nolimit')){_0x492bc9[_0x921d('0x21')]=qs[_0x921d('0x21')](_0xecaf05[_0x921d('0x33')][_0x921d('0x21')]);_0x492bc9[_0x921d('0x20')]=qs[_0x921d('0x20')](_0xecaf05[_0x921d('0x33')][_0x921d('0x20')]);}_0x492bc9[_0x921d('0x3c')]=qs['sort'](_0xecaf05[_0x921d('0x33')][_0x921d('0x3d')]);_0x492bc9[_0x921d('0x3e')]=qs['filters'](_[_0x921d('0x3f')](_0xecaf05[_0x921d('0x33')],_0xd718f9[_0x921d('0x35')]),_0xfb1572);if(_0xecaf05[_0x921d('0x33')][_0x921d('0x40')]){_0x492bc9[_0x921d('0x3e')]=_[_0x921d('0x41')](_0x492bc9[_0x921d('0x3e')],{'$or':[{'key':{'$like':'%'+_0xecaf05['query']['filter']+'%'}},{'value':{'$like':'%'+_0xecaf05['query'][_0x921d('0x40')]+'%'}}]});}_0x492bc9=_[_0x921d('0x41')]({},_0x492bc9,_0xecaf05[_0x921d('0x42')]);var _0x522651={'where':_0x492bc9[_0x921d('0x3e')]};return db['CannedAnswer'][_0x921d('0x23')](_0x522651)['then'](function(_0x483a60){_0x501d00[_0x921d('0x23')]=_0x483a60;if(_0xecaf05['query'][_0x921d('0x43')]){_0x492bc9[_0x921d('0x44')]=[{'all':!![]}];}return db[_0x921d('0x30')][_0x921d('0x45')](_0x492bc9);})[_0x921d('0x27')](function(_0xabb198){_0x501d00[_0x921d('0x46')]=_0xabb198;return _0x501d00;})['then'](respondWithFilteredResult(_0x48ff95,_0x492bc9))['catch'](handleError(_0x48ff95,null));};exports['show']=function(_0x55f1ad,_0xe7759c){var _0xf365c1={'raw':!![],'where':{'id':_0x55f1ad['params']['id']}},_0xd462b0={};_0xd462b0[_0x921d('0x37')]=_[_0x921d('0x34')](db[_0x921d('0x30')][_0x921d('0x31')]);_0xd462b0['query']=_[_0x921d('0x34')](_0x55f1ad['query']);_0xd462b0['filters']=_[_0x921d('0x36')](_0xd462b0[_0x921d('0x37')],_0xd462b0[_0x921d('0x33')]);_0xf365c1[_0x921d('0x38')]=_[_0x921d('0x36')](_0xd462b0['model'],qs['fields'](_0x55f1ad['query']['fields']));_0xf365c1['attributes']=_0xf365c1[_0x921d('0x38')][_0x921d('0x3a')]?_0xf365c1[_0x921d('0x38')]:_0xd462b0[_0x921d('0x37')];if(_0x55f1ad['query']['includeAll']){_0xf365c1[_0x921d('0x44')]=[{'all':!![]}];}_0xf365c1=_['merge']({},_0xf365c1,_0x55f1ad[_0x921d('0x42')]);return db[_0x921d('0x30')][_0x921d('0x47')](_0xf365c1)['then'](handleEntityNotFound(_0xe7759c,null))[_0x921d('0x27')](respondWithResult(_0xe7759c,null))[_0x921d('0x48')](handleError(_0xe7759c,null));};exports[_0x921d('0x26')]=function(_0x1e64f7,_0x4edd1c){if(_0x1e64f7[_0x921d('0x49')]['id']){delete _0x1e64f7[_0x921d('0x49')]['id'];}return db[_0x921d('0x30')][_0x921d('0x47')]({'where':{'id':_0x1e64f7[_0x921d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4edd1c,null))[_0x921d('0x27')](saveUpdates(_0x1e64f7[_0x921d('0x49')],null))['then'](respondWithResult(_0x4edd1c,null))[_0x921d('0x48')](handleError(_0x4edd1c,null));};exports[_0x921d('0x28')]=function(_0xf74c08,_0x12d796){return db[_0x921d('0x30')]['find']({'where':{'id':_0xf74c08[_0x921d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0x921d('0x27')](removeEntity(_0x12d796,null))[_0x921d('0x48')](handleError(_0x12d796,null));};exports[_0x921d('0x4b')]=function(_0x1d28b8,_0x4e32ff){var _0x139914={'key':_0x1d28b8['body'][_0x921d('0x4c')]};if(_0x1d28b8[_0x921d('0x49')][_0x921d('0x4d')]){_0x139914[_0x921d('0x4d')]=_0x1d28b8[_0x921d('0x49')]['MailAccountId'];}else if(_0x1d28b8[_0x921d('0x49')][_0x921d('0x4e')]){_0x139914['SmsAccountId']=_0x1d28b8[_0x921d('0x49')]['SmsAccountId'];}else if(_0x1d28b8[_0x921d('0x49')][_0x921d('0x4f')]){_0x139914[_0x921d('0x4f')]=_0x1d28b8['body'][_0x921d('0x4f')];}else if(_0x1d28b8[_0x921d('0x49')][_0x921d('0x50')]){_0x139914[_0x921d('0x50')]=_0x1d28b8[_0x921d('0x49')][_0x921d('0x50')];}return db[_0x921d('0x30')][_0x921d('0x47')]({'where':_0x139914})[_0x921d('0x27')](function(_0x31cf7f){if(_0x31cf7f){throw new db['Sequelize'][(_0x921d('0x51'))](_0x921d('0x52'));}return db[_0x921d('0x30')][_0x921d('0x4b')](_0x1d28b8[_0x921d('0x49')]);})['then'](function(_0x26438d){var _0x5a0dac=_0x1d28b8[_0x921d('0x53')][_0x921d('0x54')]({'plain':!![]});if(!_0x5a0dac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a0dac[_0x921d('0x55')]==='user'){var _0x249e41=_0x26438d[_0x921d('0x54')]({'plain':!![]});return db[_0x921d('0x56')][_0x921d('0x47')]({'where':{'name':'CannedAnswers','userProfileId':_0x5a0dac[_0x921d('0x57')]},'raw':!![]})[_0x921d('0x27')](function(_0x34d6a9){if(_0x34d6a9&&_0x34d6a9[_0x921d('0x58')]===0x0){return db[_0x921d('0x29')][_0x921d('0x4b')]({'name':_0x249e41['name'],'resourceId':_0x249e41['id'],'type':_0x34d6a9['name'],'sectionId':_0x34d6a9['id']},{})[_0x921d('0x27')](function(){return _0x26438d;});}else{return _0x26438d;}})[_0x921d('0x48')](function(_0x47e57b){logger[_0x921d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47e57b);throw _0x47e57b;});}return _0x26438d;})['then'](respondWithResult(_0x4e32ff,0xc9))[_0x921d('0x48')](handleError(_0x4e32ff,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 974a53f..d52eb41 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 _0x4281=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci'];(function(_0x11b53b,_0x188564){var _0x529666=function(_0x54ef3a){while(--_0x54ef3a){_0x11b53b['push'](_0x11b53b['shift']());}};_0x529666(++_0x188564);}(_0x4281,0x1a4));var _0x1428=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x4281[_0x102881];return _0x5c63d0;};'use strict';var _=require(_0x1428('0x0'));var util=require(_0x1428('0x1'));var logger=require(_0x1428('0x2'))(_0x1428('0x3'));var moment=require(_0x1428('0x4'));var BPromise=require(_0x1428('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1428('0x6'));var rimraf=require(_0x1428('0x7'));var config=require('../../config/environment');var attributes=require(_0x1428('0x8'));module[_0x1428('0x9')]=function(_0x2bac75,_0x33b855){return _0x2bac75[_0x1428('0xa')](_0x1428('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1428('0xc'),'collate':_0x1428('0xd')});}; \ No newline at end of file +var _0xc366=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc366,0x1c5));var _0x6c36=function(_0x4fe2dc,_0x2a4d5d){_0x4fe2dc=_0x4fe2dc-0x0;var _0xac84b6=_0xc366[_0x4fe2dc];return _0xac84b6;};'use strict';var _=require(_0x6c36('0x0'));var util=require(_0x6c36('0x1'));var logger=require(_0x6c36('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c36('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c36('0x4'));var config=require(_0x6c36('0x5'));var attributes=require(_0x6c36('0x6'));module['exports']=function(_0x24f233,_0x5d1d5e){return _0x24f233['define'](_0x6c36('0x7'),attributes,{'tableName':_0x6c36('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c36('0x9'),'collate':_0x6c36('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b5c487d..a2a491c 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(_0x28b37c,_0x57386c){var _0x276e9d=function(_0x56e6fc){while(--_0x56e6fc){_0x28b37c['push'](_0x28b37c['shift']());}};_0x276e9d(++_0x57386c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x20f1bc,_0x5d1517){var _0x15cef1=function(_0x926a9d){while(--_0x926a9d){_0x20f1bc['push'](_0x20f1bc['shift']());}};_0x15cef1(++_0x5d1517);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 22dc302..15bbaac 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 _0x3c2c=['index','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x58de77,_0x41e494){var _0xafe272=function(_0x352cbc){while(--_0x352cbc){_0x58de77['push'](_0x58de77['shift']());}};_0xafe272(++_0x41e494);}(_0x3c2c,0x121));var _0xc3c2=function(_0x45b77f,_0x326ff4){_0x45b77f=_0x45b77f-0x0;var _0x58a942=_0x3c2c[_0x45b77f];return _0x58a942;};'use strict';var multer=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var path=require(_0xc3c2('0x2'));var timeout=require(_0xc3c2('0x3'));var express=require(_0xc3c2('0x4'));var router=express[_0xc3c2('0x5')]();var fs_extra=require(_0xc3c2('0x6'));var auth=require(_0xc3c2('0x7'));var interaction=require(_0xc3c2('0x8'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0xc3c2('0x9')]('/',auth[_0xc3c2('0xa')](),controller[_0xc3c2('0xb')]);router[_0xc3c2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc3c2('0xc')]);router[_0xc3c2('0xd')]('/',auth['isAuthenticated'](),controller[_0xc3c2('0xe')]);router[_0xc3c2('0xf')](_0xc3c2('0x10'),auth[_0xc3c2('0xa')](),controller[_0xc3c2('0x11')]);router[_0xc3c2('0x12')](_0xc3c2('0x10'),auth[_0xc3c2('0xa')](),controller['destroy']);module[_0xc3c2('0x13')]=router; \ No newline at end of file +var _0xbc78=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x47d256,_0x384f2d){var _0x40c53f=function(_0xca0b6f){while(--_0xca0b6f){_0x47d256['push'](_0x47d256['shift']());}};_0x40c53f(++_0x384f2d);}(_0xbc78,0x1ed));var _0x8bc7=function(_0xfb5548,_0xc3760b){_0xfb5548=_0xfb5548-0x0;var _0x2cbe6a=_0xbc78[_0xfb5548];return _0x2cbe6a;};'use strict';var multer=require('multer');var util=require(_0x8bc7('0x0'));var path=require(_0x8bc7('0x1'));var timeout=require(_0x8bc7('0x2'));var express=require(_0x8bc7('0x3'));var router=express[_0x8bc7('0x4')]();var fs_extra=require(_0x8bc7('0x5'));var auth=require(_0x8bc7('0x6'));var interaction=require(_0x8bc7('0x7'));var config=require(_0x8bc7('0x8'));var controller=require(_0x8bc7('0x9'));router[_0x8bc7('0xa')]('/',auth[_0x8bc7('0xb')](),controller[_0x8bc7('0xc')]);router['get']('/:id',auth[_0x8bc7('0xb')](),controller[_0x8bc7('0xd')]);router[_0x8bc7('0xe')]('/',auth[_0x8bc7('0xb')](),controller['create']);router[_0x8bc7('0xf')](_0x8bc7('0x10'),auth[_0x8bc7('0xb')](),controller['update']);router[_0x8bc7('0x11')]('/:id',auth[_0x8bc7('0xb')](),controller[_0x8bc7('0x12')]);module[_0x8bc7('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 a9d0fc2..a2fd659 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 _0x418f=['DATE','1970-01-01\x2000:00:01','STRING','sequelize','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x418f,0xdf));var _0xf418=function(_0x2f5235,_0x4b2951){_0x2f5235=_0x2f5235-0x0;var _0x3420dd=_0x418f[_0x2f5235];return _0x3420dd;};'use strict';var Sequelize=require(_0xf418('0x0'));module[_0xf418('0x1')]={'calldate':{'type':Sequelize[_0xf418('0x2')],'allowNull':![],'defaultValue':_0xf418('0x3')},'clid':{'type':Sequelize[_0xf418('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf418('0x4')]},'dcontext':{'type':Sequelize[_0xf418('0x4')]},'channel':{'type':Sequelize[_0xf418('0x4')]},'dstchannel':{'type':Sequelize[_0xf418('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf418('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf418('0x4')]},'userfield':{'type':Sequelize[_0xf418('0x4')]},'uniqueid':{'type':Sequelize[_0xf418('0x4')]},'linkedid':{'type':Sequelize[_0xf418('0x4')]},'sequence':{'type':Sequelize[_0xf418('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf418('0x4')]},'tag':{'type':Sequelize[_0xf418('0x4')]}}; \ No newline at end of file +var _0x57f8=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x3b24f8,_0x3dc308){var _0x3e8327=function(_0xbadb7a){while(--_0xbadb7a){_0x3b24f8['push'](_0x3b24f8['shift']());}};_0x3e8327(++_0x3dc308);}(_0x57f8,0x198));var _0x857f=function(_0x304e0e,_0x2654a3){_0x304e0e=_0x304e0e-0x0;var _0x4449c8=_0x57f8[_0x304e0e];return _0x4449c8;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'calldate':{'type':Sequelize[_0x857f('0x1')],'allowNull':![],'defaultValue':_0x857f('0x2')},'clid':{'type':Sequelize[_0x857f('0x3')]},'src':{'type':Sequelize[_0x857f('0x3')]},'dst':{'type':Sequelize[_0x857f('0x3')]},'dcontext':{'type':Sequelize[_0x857f('0x3')]},'channel':{'type':Sequelize[_0x857f('0x3')]},'dstchannel':{'type':Sequelize[_0x857f('0x3')]},'lastapp':{'type':Sequelize[_0x857f('0x3')]},'lastdata':{'type':Sequelize[_0x857f('0x3')]},'duration':{'type':Sequelize[_0x857f('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x857f('0x3')]},'amaflags':{'type':Sequelize[_0x857f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x857f('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x857f('0x3')]},'linkedid':{'type':Sequelize[_0x857f('0x3')]},'sequence':{'type':Sequelize[_0x857f('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x857f('0x3')]},'tag':{'type':Sequelize[_0x857f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 193a2f5..ca1a40a 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 _0x106f=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','Cdr','findAll','params','create','body','catch','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x468481,_0x3d8b88){var _0x363252=function(_0x32e2a9){while(--_0x32e2a9){_0x468481['push'](_0x468481['shift']());}};_0x363252(++_0x3d8b88);}(_0x106f,0x162));var _0xf106=function(_0x2276fa,_0x5dc6c8){_0x2276fa=_0x2276fa-0x0;var _0x76562a=_0x106f[_0x2276fa];return _0x76562a;};'use strict';var emlformat=require(_0xf106('0x0'));var rimraf=require(_0xf106('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf106('0x2'));var rp=require(_0xf106('0x3'));var moment=require('moment');var BPromise=require(_0xf106('0x4'));var Mustache=require('mustache');var util=require(_0xf106('0x5'));var path=require(_0xf106('0x6'));var sox=require(_0xf106('0x7'));var csv=require(_0xf106('0x8'));var ejs=require(_0xf106('0x9'));var fs=require('fs');var fs_extra=require(_0xf106('0xa'));var _=require(_0xf106('0xb'));var squel=require('squel');var crypto=require(_0xf106('0xc'));var jsforce=require(_0xf106('0xd'));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(_0xf106('0xe'));var qs=require(_0xf106('0xf'));var as=require(_0xf106('0x10'));var hardwareService=require(_0xf106('0x11'));var logger=require(_0xf106('0x12'))(_0xf106('0x13'));var utils=require(_0xf106('0x14'));var config=require(_0xf106('0x15'));var licenseUtil=require(_0xf106('0x16'));var db=require(_0xf106('0x17'))['db'];function respondWithStatusCode(_0x31eebf,_0x5e9da8){_0x5e9da8=_0x5e9da8||0xcc;return function(_0x2bd234){if(_0x2bd234){return _0x31eebf[_0xf106('0x18')](_0x5e9da8);}return _0x31eebf['status'](_0x5e9da8)['end']();};}function respondWithResult(_0x322351,_0x2cdbf6){_0x2cdbf6=_0x2cdbf6||0xc8;return function(_0x292a0d){if(_0x292a0d){return _0x322351['status'](_0x2cdbf6)[_0xf106('0x19')](_0x292a0d);}};}function respondWithFilteredResult(_0x26186f,_0xf05683){return function(_0x48bfdd){if(_0x48bfdd){var _0x1e17e6=typeof _0xf05683[_0xf106('0x1a')]==='undefined'&&typeof _0xf05683[_0xf106('0x1b')]===_0xf106('0x1c');var _0x62352=_0x48bfdd['count'];var _0x5d02c0=_0x1e17e6?0x0:_0xf05683[_0xf106('0x1a')];var _0x726d7c=_0x1e17e6?_0x48bfdd[_0xf106('0x1d')]:_0xf05683['offset']+_0xf05683[_0xf106('0x1b')];var _0x1a6816;if(_0x726d7c>=_0x62352){_0x726d7c=_0x62352;_0x1a6816=0xc8;}else{_0x1a6816=0xce;}_0x26186f[_0xf106('0x1e')](_0x1a6816);return _0x26186f[_0xf106('0x1f')](_0xf106('0x20'),_0x5d02c0+'-'+_0x726d7c+'/'+_0x62352)[_0xf106('0x19')](_0x48bfdd);}return null;};}function patchUpdates(_0x29ae70){return function(_0x232a54){try{jsonpatch[_0xf106('0x21')](_0x232a54,_0x29ae70,!![]);}catch(_0x4a9564){return BPromise['reject'](_0x4a9564);}return _0x232a54[_0xf106('0x22')]();};}function saveUpdates(_0x59abbc,_0x32ab30){return function(_0x3c729e){if(_0x3c729e){return _0x3c729e[_0xf106('0x23')](_0x59abbc)[_0xf106('0x24')](function(_0x450451){return _0x450451;});}return null;};}function removeEntity(_0x4f673f,_0x58febd){return function(_0x178890){if(_0x178890){return _0x178890[_0xf106('0x25')]()[_0xf106('0x24')](function(){_0x4f673f[_0xf106('0x1e')](0xcc)[_0xf106('0x26')]();});}};}function handleEntityNotFound(_0xf7de89,_0x9f99bb){return function(_0x118726){if(!_0x118726){_0xf7de89[_0xf106('0x18')](0x194);}return _0x118726;};}function handleError(_0x14b15e,_0x468fce){_0x468fce=_0x468fce||0x1f4;return function(_0x225c15){logger['error'](_0x225c15['stack']);if(_0x225c15['name']){delete _0x225c15[_0xf106('0x27')];}_0x14b15e[_0xf106('0x1e')](_0x468fce)[_0xf106('0x28')](_0x225c15);};}exports[_0xf106('0x29')]=function(_0x4265b3,_0x13b5d7){var _0x4f90d1={},_0x1394e8={},_0x269bff={'count':0x0,'rows':[]};var _0x1f8323=_[_0xf106('0x2a')](db['Cdr'][_0xf106('0x2b')],function(_0x444bde){return{'name':_0x444bde[_0xf106('0x2c')],'type':_0x444bde[_0xf106('0x2d')][_0xf106('0x2e')]};});_0x1394e8[_0xf106('0x2f')]=_['map'](_0x1f8323,_0xf106('0x27'));_0x1394e8[_0xf106('0x30')]=_[_0xf106('0x31')](_0x4265b3[_0xf106('0x30')]);_0x1394e8['filters']=_[_0xf106('0x32')](_0x1394e8[_0xf106('0x2f')],_0x1394e8['query']);_0x4f90d1[_0xf106('0x33')]=_[_0xf106('0x32')](_0x1394e8[_0xf106('0x2f')],qs[_0xf106('0x34')](_0x4265b3[_0xf106('0x30')][_0xf106('0x34')]));_0x4f90d1[_0xf106('0x33')]=_0x4f90d1[_0xf106('0x33')][_0xf106('0x35')]?_0x4f90d1[_0xf106('0x33')]:_0x1394e8[_0xf106('0x2f')];if(!_0x4265b3['query']['hasOwnProperty'](_0xf106('0x36'))){_0x4f90d1[_0xf106('0x1b')]=qs[_0xf106('0x1b')](_0x4265b3['query'][_0xf106('0x1b')]);_0x4f90d1[_0xf106('0x1a')]=qs[_0xf106('0x1a')](_0x4265b3[_0xf106('0x30')][_0xf106('0x1a')]);}_0x4f90d1['order']=qs[_0xf106('0x37')](_0x4265b3['query'][_0xf106('0x37')]);_0x4f90d1[_0xf106('0x38')]=qs[_0xf106('0x39')](_[_0xf106('0x3a')](_0x4265b3['query'],_0x1394e8[_0xf106('0x39')]),_0x1f8323);if(_0x4265b3[_0xf106('0x30')][_0xf106('0x3b')]){_0x4f90d1['where']=_['merge'](_0x4f90d1['where'],{'$or':_['map'](_0x1f8323,function(_0x58dba7){if(_0x58dba7[_0xf106('0x2d')]!=='VIRTUAL'){var _0x4beb79={};_0x4beb79[_0x58dba7[_0xf106('0x27')]]={'$like':'%'+_0x4265b3['query']['filter']+'%'};return _0x4beb79;}})});}_0x4f90d1=_[_0xf106('0x3c')]({},_0x4f90d1,_0x4265b3[_0xf106('0x3d')]);var _0x2d4c90={'where':_0x4f90d1[_0xf106('0x38')]};return db['Cdr'][_0xf106('0x1d')](_0x2d4c90)[_0xf106('0x24')](function(_0x583a72){_0x269bff[_0xf106('0x1d')]=_0x583a72;if(_0x4265b3[_0xf106('0x30')][_0xf106('0x3e')]){_0x4f90d1[_0xf106('0x3f')]=[{'all':!![]}];}return db[_0xf106('0x40')][_0xf106('0x41')](_0x4f90d1);})[_0xf106('0x24')](function(_0x57d61e){_0x269bff['rows']=_0x57d61e;return _0x269bff;})[_0xf106('0x24')](respondWithFilteredResult(_0x13b5d7,_0x4f90d1))['catch'](handleError(_0x13b5d7,null));};exports['show']=function(_0x37bb28,_0x390eee){var _0x5e6cb8={'raw':!![],'where':{'id':_0x37bb28[_0xf106('0x42')]['id']}},_0x47f4d3={};_0x47f4d3['model']=_[_0xf106('0x31')](db[_0xf106('0x40')][_0xf106('0x2b')]);_0x47f4d3[_0xf106('0x30')]=_[_0xf106('0x31')](_0x37bb28[_0xf106('0x30')]);_0x47f4d3[_0xf106('0x39')]=_[_0xf106('0x32')](_0x47f4d3[_0xf106('0x2f')],_0x47f4d3[_0xf106('0x30')]);_0x5e6cb8[_0xf106('0x33')]=_[_0xf106('0x32')](_0x47f4d3[_0xf106('0x2f')],qs[_0xf106('0x34')](_0x37bb28[_0xf106('0x30')][_0xf106('0x34')]));_0x5e6cb8[_0xf106('0x33')]=_0x5e6cb8[_0xf106('0x33')]['length']?_0x5e6cb8[_0xf106('0x33')]:_0x47f4d3[_0xf106('0x2f')];if(_0x37bb28[_0xf106('0x30')][_0xf106('0x3e')]){_0x5e6cb8[_0xf106('0x3f')]=[{'all':!![]}];}_0x5e6cb8=_['merge']({},_0x5e6cb8,_0x37bb28['options']);return db['Cdr']['find'](_0x5e6cb8)[_0xf106('0x24')](handleEntityNotFound(_0x390eee,null))['then'](respondWithResult(_0x390eee,null))['catch'](handleError(_0x390eee,null));};exports[_0xf106('0x43')]=function(_0x1a686d,_0xd50443){return db[_0xf106('0x40')]['create'](_0x1a686d[_0xf106('0x44')],{})[_0xf106('0x24')](respondWithResult(_0xd50443,0xc9))[_0xf106('0x45')](handleError(_0xd50443,null));};exports[_0xf106('0x23')]=function(_0x1bf065,_0x519192){if(_0x1bf065['body']['id']){delete _0x1bf065[_0xf106('0x44')]['id'];}return db[_0xf106('0x40')][_0xf106('0x46')]({'where':{'id':_0x1bf065['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x519192,null))[_0xf106('0x24')](saveUpdates(_0x1bf065[_0xf106('0x44')],null))[_0xf106('0x24')](respondWithResult(_0x519192,null))['catch'](handleError(_0x519192,null));};exports[_0xf106('0x25')]=function(_0x5b80a8,_0x50798d){return db[_0xf106('0x40')][_0xf106('0x46')]({'where':{'id':_0x5b80a8['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x50798d,null))[_0xf106('0x24')](removeEntity(_0x50798d,null))[_0xf106('0x45')](handleError(_0x50798d,null));};exports[_0xf106('0x47')]=function(_0x14375d,_0x391e3d){return db['Cdr']['describe']()[_0xf106('0x24')](respondWithResult(_0x391e3d,null))['catch'](handleError(_0x391e3d,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','Cdr','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x55ca,0x126));var _0xa55c=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x55ca[_0x38080e];return _0x4e4c87;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['Cdr'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 45d26e5..a9ea052 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(_0x5f0f06,_0x35a7c5){var _0x26054f=function(_0x56ad15){while(--_0x56ad15){_0x5f0f06['push'](_0x5f0f06['shift']());}};_0x26054f(++_0x35a7c5);}(_0x7a54,0x106));var _0x47a5=function(_0x3ef601,_0xeffdc5){_0x3ef601=_0x3ef601-0x0;var _0x38cb26=_0x7a54[_0x3ef601];return _0x38cb26;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x41920b,_0x213cb6){var _0x5b3099=function(_0x3c2653){while(--_0x3c2653){_0x41920b['push'](_0x41920b['shift']());}};_0x5b3099(++_0x213cb6);}(_0x7a54,0x106));var _0x47a5=function(_0xd63678,_0x38f3c3){_0xd63678=_0xd63678-0x0;var _0x41c3cc=_0x7a54[_0xd63678];return _0x41c3cc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 96eea77..08d5cde 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 _0x2569=['request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','Cdr,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2569,0x139));var _0x9256=function(_0x24c970,_0x1199ef){_0x24c970=_0x24c970-0x0;var _0x48f700=_0x2569[_0x24c970];return _0x48f700;};'use strict';var _=require('lodash');var util=require(_0x9256('0x0'));var moment=require('moment');var BPromise=require(_0x9256('0x1'));var rs=require(_0x9256('0x2'));var fs=require('fs');var Redis=require(_0x9256('0x3'));var db=require(_0x9256('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9256('0x5'))(_0x9256('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9256('0x7')][_0x9256('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30f9ee,_0x1069e5,_0x9f93fc){return new BPromise(function(_0x340977,_0x51fde6){return client['request'](_0x30f9ee,_0x9f93fc)[_0x9256('0x9')](function(_0x1ae0b4){logger['info'](_0x9256('0xa'),_0x1069e5,_0x9256('0xb'));logger['debug'](_0x9256('0xc'),_0x1069e5,_0x9256('0xb'),JSON[_0x9256('0xd')](_0x1ae0b4));if(_0x1ae0b4[_0x9256('0xe')]){if(_0x1ae0b4[_0x9256('0xe')]['code']===0x1f4){logger[_0x9256('0xe')](_0x9256('0xa'),_0x1069e5,_0x1ae0b4['error']['message']);return _0x51fde6(_0x1ae0b4[_0x9256('0xe')][_0x9256('0xf')]);}logger[_0x9256('0xe')](_0x9256('0xa'),_0x1069e5,_0x1ae0b4[_0x9256('0xe')][_0x9256('0xf')]);return _0x340977(_0x1ae0b4['error']['message']);}else{logger['info'](_0x9256('0xa'),_0x1069e5,_0x9256('0xb'));_0x340977(_0x1ae0b4[_0x9256('0x10')]['message']);}})[_0x9256('0x11')](function(_0x1aa330){logger[_0x9256('0xe')](_0x9256('0xa'),_0x1069e5,_0x1aa330);_0x51fde6(_0x1aa330);});});} \ No newline at end of file +var _0x7745=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x144c0c,_0x113cfe){var _0x436221=function(_0x231dd7){while(--_0x231dd7){_0x144c0c['push'](_0x144c0c['shift']());}};_0x436221(++_0x113cfe);}(_0x7745,0x15a));var _0x5774=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x7745[_0x25248b];return _0x509939;};'use strict';var _=require(_0x5774('0x0'));var util=require(_0x5774('0x1'));var moment=require(_0x5774('0x2'));var BPromise=require(_0x5774('0x3'));var rs=require(_0x5774('0x4'));var fs=require('fs');var Redis=require(_0x5774('0x5'));var db=require(_0x5774('0x6'))['db'];var utils=require(_0x5774('0x7'));var logger=require(_0x5774('0x8'))(_0x5774('0x9'));var config=require(_0x5774('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5774('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5151a8,_0x333bad,_0x500341){return new BPromise(function(_0x4f759e,_0x12c5ff){return client['request'](_0x5151a8,_0x500341)[_0x5774('0xc')](function(_0x3726e1){logger[_0x5774('0xd')](_0x5774('0xe'),_0x333bad,_0x5774('0xf'));logger[_0x5774('0x10')](_0x5774('0x11'),_0x333bad,_0x5774('0xf'),JSON['stringify'](_0x3726e1));if(_0x3726e1[_0x5774('0x12')]){if(_0x3726e1['error'][_0x5774('0x13')]===0x1f4){logger[_0x5774('0x12')](_0x5774('0xe'),_0x333bad,_0x3726e1[_0x5774('0x12')][_0x5774('0x14')]);return _0x12c5ff(_0x3726e1['error'][_0x5774('0x14')]);}logger[_0x5774('0x12')](_0x5774('0xe'),_0x333bad,_0x3726e1[_0x5774('0x12')][_0x5774('0x14')]);return _0x4f759e(_0x3726e1[_0x5774('0x12')][_0x5774('0x14')]);}else{logger[_0x5774('0xd')](_0x5774('0xe'),_0x333bad,_0x5774('0xf'));_0x4f759e(_0x3726e1[_0x5774('0x15')]['message']);}})[_0x5774('0x16')](function(_0x4a0a32){logger[_0x5774('0x12')]('Cdr,\x20%s,\x20%s',_0x333bad,_0x4a0a32);_0x12c5ff(_0x4a0a32);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c336560..3f08cab 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(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x59c366,_0x153fb5){var _0x467fd4=function(_0x30f38b){while(--_0x30f38b){_0x59c366['push'](_0x59c366['shift']());}};_0x467fd4(++_0x153fb5);}(_0xb10b,0x12a));var _0xbb10=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xb10b[_0x39106e];return _0x892aec;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 f39f7d3..5cd460a 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 _0xf122=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xf122,0x17f));var _0x2f12=function(_0x3cd10f,_0x3191f6){_0x3cd10f=_0x3cd10f-0x0;var _0x19e274=_0xf122[_0x3cd10f];return _0x19e274;};'use strict';var Sequelize=require(_0x2f12('0x0'));module[_0x2f12('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2f12('0x2')],'allowNull':![],'defaultValue':_0x2f12('0x3')},'appdata':{'type':Sequelize[_0x2f12('0x4')]()},'description':{'type':Sequelize[_0x2f12('0x2')]},'interval':{'type':Sequelize[_0x2f12('0x2')],'defaultValue':_0x2f12('0x5')}}; \ No newline at end of file +var _0x7719=['exports','INTEGER','STRING','noop','TEXT'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7719,0x9b));var _0x9771=function(_0x4f1de8,_0x1452c2){_0x4f1de8=_0x4f1de8-0x0;var _0x306d47=_0x7719[_0x4f1de8];return _0x306d47;};'use strict';var Sequelize=require('sequelize');module[_0x9771('0x0')]={'priority':{'type':Sequelize[_0x9771('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9771('0x2')],'allowNull':![],'defaultValue':_0x9771('0x3')},'appdata':{'type':Sequelize[_0x9771('0x4')]()},'description':{'type':Sequelize[_0x9771('0x2')]},'interval':{'type':Sequelize[_0x9771('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ebe86c1..14f604d 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 _0x153f=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x490992,_0x64c65a){var _0x47d9fd=function(_0x3e70cb){while(--_0x3e70cb){_0x490992['push'](_0x490992['shift']());}};_0x47d9fd(++_0x64c65a);}(_0x153f,0x15b));var _0xf153=function(_0x331697,_0xe13353){_0x331697=_0x331697-0x0;var _0x30313b=_0x153f[_0x331697];return _0x30313b;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={'raw':!![],'where':{'id':_0x10295e[_0xf153('0x2d')]['id']}},_0x339e96={};_0x339e96[_0xf153('0x2e')]=_[_0xf153('0x2f')](db[_0xf153('0x30')][_0xf153('0x31')]);_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2f')](_0x10295e['query']);_0x339e96[_0xf153('0x33')]=_[_0xf153('0x34')](_0x339e96[_0xf153('0x2e')],_0x339e96[_0xf153('0x32')]);_0x2b9a9c['attributes']=_['intersection'](_0x339e96[_0xf153('0x2e')],qs['fields'](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c['attributes']=_0x2b9a9c[_0xf153('0x36')]['length']?_0x2b9a9c[_0xf153('0x36')]:_0x339e96[_0xf153('0x2e')];if(_0x10295e['query'][_0xf153('0x37')]){_0x2b9a9c[_0xf153('0x38')]=[{'all':!![]}];}_0x2b9a9c=_[_0xf153('0x39')]({},_0x2b9a9c,_0x10295e[_0xf153('0x3a')]);return db[_0xf153('0x30')][_0xf153('0x3b')](_0x2b9a9c)['then'](handleEntityNotFound(_0x261ac0,null))[_0xf153('0x27')](respondWithResult(_0x261ac0,null))['catch'](handleError(_0x261ac0,null));};exports[_0xf153('0x26')]=function(_0x2523c0,_0x9b3f4c){if(_0x2523c0[_0xf153('0x3c')]['id']){delete _0x2523c0[_0xf153('0x3c')]['id'];}return db[_0xf153('0x30')]['find']({'where':{'id':_0x2523c0[_0xf153('0x2d')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x9b3f4c,null))[_0xf153('0x27')](saveUpdates(_0x2523c0['body'],null))[_0xf153('0x27')](respondWithResult(_0x9b3f4c,null))[_0xf153('0x3d')](handleError(_0x9b3f4c,null));};exports[_0xf153('0x28')]=function(_0x254692,_0x36c5cd){return db[_0xf153('0x30')]['find']({'where':{'id':_0x254692[_0xf153('0x2d')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x36c5cd,null))['then'](removeEntity(_0x36c5cd,null))[_0xf153('0x3d')](handleError(_0x36c5cd,null));}; \ No newline at end of file +var _0x43b1=['fields','length','includeAll','include','merge','then','catch','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','show','params','model','keys','ChatApplication','filters','intersection','query','attributes'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x43b1,0x7d));var _0x143b=function(_0x279298,_0x4f589b){_0x279298=_0x279298-0x0;var _0x10f64e=_0x43b1[_0x279298];return _0x10f64e;};'use strict';var emlformat=require(_0x143b('0x0'));var rimraf=require(_0x143b('0x1'));var zipdir=require(_0x143b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x143b('0x3'));var moment=require('moment');var BPromise=require(_0x143b('0x4'));var Mustache=require(_0x143b('0x5'));var util=require(_0x143b('0x6'));var path=require(_0x143b('0x7'));var sox=require(_0x143b('0x8'));var csv=require(_0x143b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x143b('0xa'));var _=require(_0x143b('0xb'));var squel=require(_0x143b('0xc'));var crypto=require('crypto');var jsforce=require(_0x143b('0xd'));var deskjs=require(_0x143b('0xe'));var toCsv=require(_0x143b('0x9'));var querystring=require(_0x143b('0xf'));var Papa=require(_0x143b('0x10'));var Redis=require(_0x143b('0x11'));var authService=require(_0x143b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x143b('0x13'));var hardwareService=require(_0x143b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x143b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x143b('0x16'));var db=require(_0x143b('0x17'))['db'];function respondWithStatusCode(_0x52429f,_0x2d6c07){_0x2d6c07=_0x2d6c07||0xcc;return function(_0x1ef389){if(_0x1ef389){return _0x52429f[_0x143b('0x18')](_0x2d6c07);}return _0x52429f[_0x143b('0x19')](_0x2d6c07)[_0x143b('0x1a')]();};}function respondWithResult(_0x34cd9b,_0x1325c3){_0x1325c3=_0x1325c3||0xc8;return function(_0x40ce06){if(_0x40ce06){return _0x34cd9b[_0x143b('0x19')](_0x1325c3)[_0x143b('0x1b')](_0x40ce06);}};}function respondWithFilteredResult(_0x2bca2c,_0x3cc649){return function(_0x2d746a){if(_0x2d746a){var _0x133603=typeof _0x3cc649[_0x143b('0x1c')]===_0x143b('0x1d')&&typeof _0x3cc649[_0x143b('0x1e')]==='undefined';var _0x520197=_0x2d746a[_0x143b('0x1f')];var _0x244ba8=_0x133603?0x0:_0x3cc649[_0x143b('0x1c')];var _0x139aa9=_0x133603?_0x2d746a[_0x143b('0x1f')]:_0x3cc649[_0x143b('0x1c')]+_0x3cc649[_0x143b('0x1e')];var _0x1ca6d2;if(_0x139aa9>=_0x520197){_0x139aa9=_0x520197;_0x1ca6d2=0xc8;}else{_0x1ca6d2=0xce;}_0x2bca2c[_0x143b('0x19')](_0x1ca6d2);return _0x2bca2c[_0x143b('0x20')](_0x143b('0x21'),_0x244ba8+'-'+_0x139aa9+'/'+_0x520197)['json'](_0x2d746a);}return null;};}function patchUpdates(_0x1dd05b){return function(_0x35df37){try{jsonpatch[_0x143b('0x22')](_0x35df37,_0x1dd05b,!![]);}catch(_0xfd9194){return BPromise[_0x143b('0x23')](_0xfd9194);}return _0x35df37[_0x143b('0x24')]();};}function saveUpdates(_0x159ef6,_0x1d5b5b){return function(_0x5d0684){if(_0x5d0684){return _0x5d0684[_0x143b('0x25')](_0x159ef6)['then'](function(_0x2a55fe){return _0x2a55fe;});}return null;};}function removeEntity(_0x5bdebc,_0x549638){return function(_0x56717f){if(_0x56717f){return _0x56717f[_0x143b('0x26')]()['then'](function(){_0x5bdebc['status'](0xcc)[_0x143b('0x1a')]();});}};}function handleEntityNotFound(_0x53c102,_0x35e097){return function(_0x54eca6){if(!_0x54eca6){_0x53c102[_0x143b('0x18')](0x194);}return _0x54eca6;};}function handleError(_0xd30b1,_0x1adf50){_0x1adf50=_0x1adf50||0x1f4;return function(_0x4f5a17){logger['error'](_0x4f5a17['stack']);if(_0x4f5a17['name']){delete _0x4f5a17[_0x143b('0x27')];}_0xd30b1['status'](_0x1adf50)['send'](_0x4f5a17);};}exports[_0x143b('0x28')]=function(_0x37611b,_0x6174a3){var _0x5535b5={'raw':!![],'where':{'id':_0x37611b[_0x143b('0x29')]['id']}},_0xd1aa12={};_0xd1aa12[_0x143b('0x2a')]=_[_0x143b('0x2b')](db[_0x143b('0x2c')]['rawAttributes']);_0xd1aa12['query']=_['keys'](_0x37611b['query']);_0xd1aa12[_0x143b('0x2d')]=_[_0x143b('0x2e')](_0xd1aa12[_0x143b('0x2a')],_0xd1aa12[_0x143b('0x2f')]);_0x5535b5[_0x143b('0x30')]=_[_0x143b('0x2e')](_0xd1aa12[_0x143b('0x2a')],qs[_0x143b('0x31')](_0x37611b[_0x143b('0x2f')][_0x143b('0x31')]));_0x5535b5['attributes']=_0x5535b5[_0x143b('0x30')][_0x143b('0x32')]?_0x5535b5['attributes']:_0xd1aa12['model'];if(_0x37611b[_0x143b('0x2f')][_0x143b('0x33')]){_0x5535b5[_0x143b('0x34')]=[{'all':!![]}];}_0x5535b5=_[_0x143b('0x35')]({},_0x5535b5,_0x37611b['options']);return db['ChatApplication']['find'](_0x5535b5)['then'](handleEntityNotFound(_0x6174a3,null))[_0x143b('0x36')](respondWithResult(_0x6174a3,null))[_0x143b('0x37')](handleError(_0x6174a3,null));};exports[_0x143b('0x25')]=function(_0x54dcb9,_0x1f2eff){if(_0x54dcb9[_0x143b('0x38')]['id']){delete _0x54dcb9[_0x143b('0x38')]['id'];}return db['ChatApplication'][_0x143b('0x39')]({'where':{'id':_0x54dcb9[_0x143b('0x29')]['id']}})[_0x143b('0x36')](handleEntityNotFound(_0x1f2eff,null))['then'](saveUpdates(_0x54dcb9[_0x143b('0x38')],null))[_0x143b('0x36')](respondWithResult(_0x1f2eff,null))['catch'](handleError(_0x1f2eff,null));};exports['destroy']=function(_0x5a8bd8,_0x1388fc){return db[_0x143b('0x2c')]['find']({'where':{'id':_0x5a8bd8[_0x143b('0x29')]['id']}})[_0x143b('0x36')](handleEntityNotFound(_0x1388fc,null))[_0x143b('0x36')](removeEntity(_0x1388fc,null))[_0x143b('0x37')](handleError(_0x1388fc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 418fd8c..4574b5d 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 _0x0f13=['./chatApplication.attributes','exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d6ac0,_0x1c52e2){var _0x359130=function(_0x49e579){while(--_0x49e579){_0x3d6ac0['push'](_0x3d6ac0['shift']());}};_0x359130(++_0x1c52e2);}(_0x0f13,0x12b));var _0x30f1=function(_0x1cf4cb,_0x25525c){_0x1cf4cb=_0x1cf4cb-0x0;var _0x455c72=_0x0f13[_0x1cf4cb];return _0x455c72;};'use strict';var _=require(_0x30f1('0x0'));var util=require(_0x30f1('0x1'));var logger=require(_0x30f1('0x2'))(_0x30f1('0x3'));var moment=require('moment');var BPromise=require(_0x30f1('0x4'));var rp=require(_0x30f1('0x5'));var fs=require('fs');var path=require(_0x30f1('0x6'));var rimraf=require(_0x30f1('0x7'));var config=require(_0x30f1('0x8'));var attributes=require(_0x30f1('0x9'));module[_0x30f1('0xa')]=function(_0x23fa14,_0xa07d55){return _0x23fa14[_0x30f1('0xb')]('ChatApplication',attributes,{'tableName':_0x30f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x30f1('0xd')});}; \ No newline at end of file +var _0xec0e=['bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xec0e,0x1d1));var _0xeec0=function(_0x61bb05,_0x47421f){_0x61bb05=_0x61bb05-0x0;var _0x3ceb3e=_0xec0e[_0x61bb05];return _0x3ceb3e;};'use strict';var _=require(_0xeec0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeec0('0x1'));var moment=require(_0xeec0('0x2'));var BPromise=require(_0xeec0('0x3'));var rp=require(_0xeec0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeec0('0x5'));var config=require(_0xeec0('0x6'));var attributes=require(_0xeec0('0x7'));module[_0xeec0('0x8')]=function(_0x20c9a9,_0x830f66){return _0x20c9a9['define']('ChatApplication',attributes,{'tableName':_0xeec0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeec0('0xa'),'collate':_0xeec0('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b3341eb..00ad176 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 _0xde3b=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird'];(function(_0x1035f0,_0x5e72ed){var _0x14f92e=function(_0x432acf){while(--_0x432acf){_0x1035f0['push'](_0x1035f0['shift']());}};_0x14f92e(++_0x5e72ed);}(_0xde3b,0x150));var _0xbde3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xde3b[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xbde3('0x0'));var util=require(_0xbde3('0x1'));var moment=require(_0xbde3('0x2'));var BPromise=require(_0xbde3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbde3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbde3('0x5'))(_0xbde3('0x6'));var config=require(_0xbde3('0x7'));var jayson=require(_0xbde3('0x8'));var client=jayson[_0xbde3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f3f1,_0x4da709,_0x1a704e){return new BPromise(function(_0x1b24ad,_0x2e51c7){return client[_0xbde3('0xa')](_0x10f3f1,_0x1a704e)[_0xbde3('0xb')](function(_0x31ff81){logger[_0xbde3('0xc')](_0xbde3('0xd'),_0x4da709,_0xbde3('0xe'));logger[_0xbde3('0xf')](_0xbde3('0x10'),_0x4da709,_0xbde3('0xe'),JSON['stringify'](_0x31ff81));if(_0x31ff81[_0xbde3('0x11')]){if(_0x31ff81[_0xbde3('0x11')][_0xbde3('0x12')]===0x1f4){logger[_0xbde3('0x11')](_0xbde3('0xd'),_0x4da709,_0x31ff81[_0xbde3('0x11')][_0xbde3('0x13')]);return _0x2e51c7(_0x31ff81['error']['message']);}logger[_0xbde3('0x11')](_0xbde3('0xd'),_0x4da709,_0x31ff81['error']['message']);return _0x1b24ad(_0x31ff81[_0xbde3('0x11')][_0xbde3('0x13')]);}else{logger['info'](_0xbde3('0xd'),_0x4da709,_0xbde3('0xe'));_0x1b24ad(_0x31ff81['result'][_0xbde3('0x13')]);}})['catch'](function(_0x1e6b1a){logger[_0xbde3('0x11')](_0xbde3('0xd'),_0x4da709,_0x1e6b1a);_0x2e51c7(_0x1e6b1a);});});} \ No newline at end of file +var _0x3301=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x1e6955,_0x2f6273){var _0x21271e=function(_0xd75f7d){while(--_0xd75f7d){_0x1e6955['push'](_0x1e6955['shift']());}};_0x21271e(++_0x2f6273);}(_0x3301,0x182));var _0x1330=function(_0x5f1b74,_0x498562){_0x5f1b74=_0x5f1b74-0x0;var _0x1fb5a0=_0x3301[_0x5f1b74];return _0x1fb5a0;};'use strict';var _=require(_0x1330('0x0'));var util=require(_0x1330('0x1'));var moment=require(_0x1330('0x2'));var BPromise=require(_0x1330('0x3'));var rs=require(_0x1330('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1330('0x5'))['db'];var utils=require(_0x1330('0x6'));var logger=require(_0x1330('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1330('0x8')][_0x1330('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c8bbf,_0x474b44,_0xc85bdd){return new BPromise(function(_0x69d2e1,_0xc4bec){return client[_0x1330('0xa')](_0x5c8bbf,_0xc85bdd)[_0x1330('0xb')](function(_0x5ad070){logger[_0x1330('0xc')](_0x1330('0xd'),_0x474b44,_0x1330('0xe'));logger[_0x1330('0xf')](_0x1330('0x10'),_0x474b44,_0x1330('0xe'),JSON[_0x1330('0x11')](_0x5ad070));if(_0x5ad070[_0x1330('0x12')]){if(_0x5ad070['error'][_0x1330('0x13')]===0x1f4){logger[_0x1330('0x12')](_0x1330('0xd'),_0x474b44,_0x5ad070[_0x1330('0x12')]['message']);return _0xc4bec(_0x5ad070[_0x1330('0x12')][_0x1330('0x14')]);}logger[_0x1330('0x12')](_0x1330('0xd'),_0x474b44,_0x5ad070[_0x1330('0x12')][_0x1330('0x14')]);return _0x69d2e1(_0x5ad070[_0x1330('0x12')][_0x1330('0x14')]);}else{logger[_0x1330('0xc')](_0x1330('0xd'),_0x474b44,_0x1330('0xe'));_0x69d2e1(_0x5ad070[_0x1330('0x15')][_0x1330('0x14')]);}})['catch'](function(_0x2597f3){logger['error'](_0x1330('0xd'),_0x474b44,_0x2597f3);_0xc4bec(_0x2597f3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8ad3070..45adeb3 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 _0x3b97=['update','delete','isAuthenticated','destroy','util','path','Router','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','show','put'];(function(_0xf6709d,_0xae89ae){var _0x4c934b=function(_0x4f39a3){while(--_0x4f39a3){_0xf6709d['push'](_0xf6709d['shift']());}};_0x4c934b(++_0xae89ae);}(_0x3b97,0x1a8));var _0x73b9=function(_0x288467,_0x43c3fb){_0x288467=_0x288467-0x0;var _0x341e2a=_0x3b97[_0x288467];return _0x341e2a;};'use strict';var multer=require('multer');var util=require(_0x73b9('0x0'));var path=require(_0x73b9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x73b9('0x2')]();var fs_extra=require(_0x73b9('0x3'));var auth=require(_0x73b9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x73b9('0x5'));router[_0x73b9('0x6')](_0x73b9('0x7'),auth['isAuthenticated'](),controller[_0x73b9('0x8')]);router[_0x73b9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x73b9('0xa')]);router[_0x73b9('0xb')](_0x73b9('0x7'),auth[_0x73b9('0xc')](),controller[_0x73b9('0xd')]);module['exports']=router; \ No newline at end of file +var _0x373d=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','show','/:id','isAuthenticated'];(function(_0x492c02,_0x177429){var _0x403eda=function(_0x3dbb0f){while(--_0x3dbb0f){_0x492c02['push'](_0x492c02['shift']());}};_0x403eda(++_0x177429);}(_0x373d,0xb8));var _0xd373=function(_0x42f7cd,_0x1c47b7){_0x42f7cd=_0x42f7cd-0x0;var _0x514f16=_0x373d[_0x42f7cd];return _0x514f16;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require('express');var router=express[_0xd373('0x3')]();var fs_extra=require(_0xd373('0x4'));var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require(_0xd373('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0xd373('0x9')]);router['put'](_0xd373('0xa'),auth[_0xd373('0xb')](),controller['update']);router['delete'](_0xd373('0xa'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);module[_0xd373('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 32cb114..a822099 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 _0xfcf7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x55ff21,_0x1540f0){var _0x4baf37=function(_0x51128b){while(--_0x51128b){_0x55ff21['push'](_0x55ff21['shift']());}};_0x4baf37(++_0x1540f0);}(_0xfcf7,0x106));var _0x7fcf=function(_0x546ada,_0x274ba0){_0x546ada=_0x546ada-0x0;var _0x7d1e6c=_0xfcf7[_0x546ada];return _0x7d1e6c;};'use strict';var Sequelize=require(_0x7fcf('0x0'));module[_0x7fcf('0x1')]={'name':{'type':Sequelize[_0x7fcf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7fcf('0x2')]},'write':{'type':Sequelize[_0x7fcf('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4a9a=['exports','STRING','BOOLEAN'];(function(_0x1233d2,_0x5416f4){var _0x22759e=function(_0xb516aa){while(--_0xb516aa){_0x1233d2['push'](_0x1233d2['shift']());}};_0x22759e(++_0x5416f4);}(_0x4a9a,0x123));var _0xa4a9=function(_0x3f9951,_0x4bf5d0){_0x3f9951=_0x3f9951-0x0;var _0x11eae7=_0x4a9a[_0x3f9951];return _0x11eae7;};'use strict';var Sequelize=require('sequelize');module[_0xa4a9('0x0')]={'name':{'type':Sequelize[_0xa4a9('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa4a9('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index f6f0dca..21c6710 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 _0xcc46=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','map','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','show','params','keys','intersection','length','include','find','catch','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','findOne','User','getMembers','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js'];(function(_0x38b54a,_0x33037c){var _0x921192=function(_0x312c23){while(--_0x312c23){_0x38b54a['push'](_0x38b54a['shift']());}};_0x921192(++_0x33037c);}(_0xcc46,0x1e6));var _0x6cc4=function(_0x370ab9,_0x171dd7){_0x370ab9=_0x370ab9-0x0;var _0x2d124b=_0xcc46[_0x370ab9];return _0x2d124b;};'use strict';var emlformat=require(_0x6cc4('0x0'));var rimraf=require(_0x6cc4('0x1'));var zipdir=require(_0x6cc4('0x2'));var jsonpatch=require(_0x6cc4('0x3'));var rp=require('request-promise');var moment=require(_0x6cc4('0x4'));var BPromise=require(_0x6cc4('0x5'));var Mustache=require('mustache');var util=require(_0x6cc4('0x6'));var path=require(_0x6cc4('0x7'));var sox=require('sox');var csv=require(_0x6cc4('0x8'));var ejs=require(_0x6cc4('0x9'));var fs=require('fs');var fs_extra=require(_0x6cc4('0xa'));var _=require(_0x6cc4('0xb'));var squel=require(_0x6cc4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6cc4('0xd'));var toCsv=require(_0x6cc4('0x8'));var querystring=require(_0x6cc4('0xe'));var Papa=require(_0x6cc4('0xf'));var Redis=require(_0x6cc4('0x10'));var authService=require(_0x6cc4('0x11'));var qs=require(_0x6cc4('0x12'));var as=require(_0x6cc4('0x13'));var hardwareService=require(_0x6cc4('0x14'));var logger=require(_0x6cc4('0x15'))(_0x6cc4('0x16'));var utils=require('../../config/utils');var config=require(_0x6cc4('0x17'));var licenseUtil=require(_0x6cc4('0x18'));var db=require(_0x6cc4('0x19'))['db'];config['redis']=_[_0x6cc4('0x1a')](config[_0x6cc4('0x1b')],{'host':_0x6cc4('0x1c'),'port':0x18eb});var socket=require(_0x6cc4('0x1d'))(new Redis(config[_0x6cc4('0x1b')]));require(_0x6cc4('0x1e'))[_0x6cc4('0x1f')](socket);function respondWithStatusCode(_0x714f75,_0x37a278){_0x37a278=_0x37a278||0xcc;return function(_0x3d6dbe){if(_0x3d6dbe){return _0x714f75[_0x6cc4('0x20')](_0x37a278);}return _0x714f75[_0x6cc4('0x21')](_0x37a278)[_0x6cc4('0x22')]();};}function respondWithResult(_0xc6c0e4,_0x3f49f1){_0x3f49f1=_0x3f49f1||0xc8;return function(_0x5c9d8a){if(_0x5c9d8a){return _0xc6c0e4[_0x6cc4('0x21')](_0x3f49f1)[_0x6cc4('0x23')](_0x5c9d8a);}};}function respondWithFilteredResult(_0x55d8e0,_0x4c17b0){return function(_0x453864){if(_0x453864){var _0x9ce2e3=typeof _0x4c17b0[_0x6cc4('0x24')]===_0x6cc4('0x25')&&typeof _0x4c17b0[_0x6cc4('0x26')]===_0x6cc4('0x25');var _0x22ebf6=_0x453864[_0x6cc4('0x27')];var _0x2fcfc6=_0x9ce2e3?0x0:_0x4c17b0['offset'];var _0x31edd7=_0x9ce2e3?_0x453864[_0x6cc4('0x27')]:_0x4c17b0[_0x6cc4('0x24')]+_0x4c17b0[_0x6cc4('0x26')];var _0x4d5c6b;if(_0x31edd7>=_0x22ebf6){_0x31edd7=_0x22ebf6;_0x4d5c6b=0xc8;}else{_0x4d5c6b=0xce;}_0x55d8e0['status'](_0x4d5c6b);return _0x55d8e0[_0x6cc4('0x28')]('Content-Range',_0x2fcfc6+'-'+_0x31edd7+'/'+_0x22ebf6)[_0x6cc4('0x23')](_0x453864);}return null;};}function patchUpdates(_0x1785ec){return function(_0x1b6808){try{jsonpatch[_0x6cc4('0x29')](_0x1b6808,_0x1785ec,!![]);}catch(_0xa50e94){return BPromise[_0x6cc4('0x2a')](_0xa50e94);}return _0x1b6808[_0x6cc4('0x2b')]();};}function saveUpdates(_0x14ac5a,_0xe6cded){return function(_0x4574e7){if(_0x4574e7){return _0x4574e7['update'](_0x14ac5a)['then'](function(_0x44203d){return _0x44203d;});}return null;};}function removeEntity(_0x2dbfbd,_0x33494b){return function(_0x247097){if(_0x247097){return _0x247097['destroy']()[_0x6cc4('0x2c')](function(){_0x2dbfbd[_0x6cc4('0x21')](0xcc)[_0x6cc4('0x22')]();});}};}function handleEntityNotFound(_0x3a694b,_0x547d56){return function(_0x467551){if(!_0x467551){_0x3a694b[_0x6cc4('0x20')](0x194);}return _0x467551;};}function handleError(_0x1d806f,_0x50f24f){_0x50f24f=_0x50f24f||0x1f4;return function(_0x480dce){logger[_0x6cc4('0x2d')](_0x480dce[_0x6cc4('0x2e')]);if(_0x480dce[_0x6cc4('0x2f')]){delete _0x480dce['name'];}_0x1d806f[_0x6cc4('0x21')](_0x50f24f)[_0x6cc4('0x30')](_0x480dce);};}exports[_0x6cc4('0x31')]=function(_0xedc6a,_0xc170a8){var _0xd405f2={},_0x523921={},_0x12099d={'count':0x0,'rows':[]};var _0x500774=_['map'](db[_0x6cc4('0x32')][_0x6cc4('0x33')],function(_0x507bf6){return{'name':_0x507bf6[_0x6cc4('0x34')],'type':_0x507bf6[_0x6cc4('0x35')][_0x6cc4('0x36')]};});_0x523921['model']=_[_0x6cc4('0x37')](_0x500774,'name');_0x523921[_0x6cc4('0x38')]=_['keys'](_0xedc6a['query']);_0x523921[_0x6cc4('0x39')]=_['intersection'](_0x523921[_0x6cc4('0x3a')],_0x523921[_0x6cc4('0x38')]);_0xd405f2['attributes']=_['intersection'](_0x523921[_0x6cc4('0x3a')],qs[_0x6cc4('0x3b')](_0xedc6a[_0x6cc4('0x38')][_0x6cc4('0x3b')]));_0xd405f2['attributes']=_0xd405f2[_0x6cc4('0x3c')]['length']?_0xd405f2[_0x6cc4('0x3c')]:_0x523921[_0x6cc4('0x3a')];if(!_0xedc6a[_0x6cc4('0x38')][_0x6cc4('0x3d')](_0x6cc4('0x3e'))){_0xd405f2[_0x6cc4('0x26')]=qs[_0x6cc4('0x26')](_0xedc6a['query']['limit']);_0xd405f2[_0x6cc4('0x24')]=qs['offset'](_0xedc6a[_0x6cc4('0x38')][_0x6cc4('0x24')]);}_0xd405f2[_0x6cc4('0x3f')]=qs[_0x6cc4('0x40')](_0xedc6a[_0x6cc4('0x38')]['sort']);_0xd405f2['where']=qs['filters'](_[_0x6cc4('0x41')](_0xedc6a[_0x6cc4('0x38')],_0x523921[_0x6cc4('0x39')]),_0x500774);if(_0xedc6a['query'][_0x6cc4('0x42')]){_0xd405f2[_0x6cc4('0x43')]=_[_0x6cc4('0x44')](_0xd405f2[_0x6cc4('0x43')],{'$or':_[_0x6cc4('0x37')](_0x500774,function(_0x26411a){if(_0x26411a[_0x6cc4('0x35')]!=='VIRTUAL'){var _0x58638a={};_0x58638a[_0x26411a['name']]={'$like':'%'+_0xedc6a[_0x6cc4('0x38')]['filter']+'%'};return _0x58638a;}})});}_0xd405f2=_[_0x6cc4('0x44')]({},_0xd405f2,_0xedc6a['options']);var _0x4fa48d={'where':_0xd405f2[_0x6cc4('0x43')]};return db[_0x6cc4('0x32')][_0x6cc4('0x27')](_0x4fa48d)[_0x6cc4('0x2c')](function(_0x27681){_0x12099d[_0x6cc4('0x27')]=_0x27681;if(_0xedc6a[_0x6cc4('0x38')][_0x6cc4('0x45')]){_0xd405f2['include']=[{'all':!![]}];}return db[_0x6cc4('0x32')][_0x6cc4('0x46')](_0xd405f2);})[_0x6cc4('0x2c')](function(_0x1b6438){_0x12099d[_0x6cc4('0x47')]=_0x1b6438;return _0x12099d;})[_0x6cc4('0x2c')](respondWithFilteredResult(_0xc170a8,_0xd405f2))['catch'](handleError(_0xc170a8,null));};exports[_0x6cc4('0x48')]=function(_0x3eafa1,_0x4a1665){var _0x4bb5c0={'raw':!![],'where':{'id':_0x3eafa1[_0x6cc4('0x49')]['id']}},_0x2216a3={};_0x2216a3['model']=_[_0x6cc4('0x4a')](db[_0x6cc4('0x32')][_0x6cc4('0x33')]);_0x2216a3[_0x6cc4('0x38')]=_[_0x6cc4('0x4a')](_0x3eafa1[_0x6cc4('0x38')]);_0x2216a3[_0x6cc4('0x39')]=_[_0x6cc4('0x4b')](_0x2216a3['model'],_0x2216a3['query']);_0x4bb5c0[_0x6cc4('0x3c')]=_[_0x6cc4('0x4b')](_0x2216a3['model'],qs[_0x6cc4('0x3b')](_0x3eafa1[_0x6cc4('0x38')][_0x6cc4('0x3b')]));_0x4bb5c0[_0x6cc4('0x3c')]=_0x4bb5c0[_0x6cc4('0x3c')][_0x6cc4('0x4c')]?_0x4bb5c0['attributes']:_0x2216a3[_0x6cc4('0x3a')];if(_0x3eafa1[_0x6cc4('0x38')][_0x6cc4('0x45')]){_0x4bb5c0[_0x6cc4('0x4d')]=[{'all':!![]}];}_0x4bb5c0=_[_0x6cc4('0x44')]({},_0x4bb5c0,_0x3eafa1['options']);return db[_0x6cc4('0x32')][_0x6cc4('0x4e')](_0x4bb5c0)[_0x6cc4('0x2c')](handleEntityNotFound(_0x4a1665,null))['then'](respondWithResult(_0x4a1665,null))[_0x6cc4('0x4f')](handleError(_0x4a1665,null));};exports[_0x6cc4('0x50')]=function(_0x103088,_0x549f60){return db['ChatGroup'][_0x6cc4('0x50')](_0x103088[_0x6cc4('0x51')],{})[_0x6cc4('0x2c')](respondWithResult(_0x549f60,0xc9))[_0x6cc4('0x4f')](handleError(_0x549f60,null));};exports[_0x6cc4('0x52')]=function(_0x50abd2,_0x1921f2){if(_0x50abd2[_0x6cc4('0x51')]['id']){delete _0x50abd2[_0x6cc4('0x51')]['id'];}return db[_0x6cc4('0x32')]['find']({'where':{'id':_0x50abd2[_0x6cc4('0x49')]['id']}})[_0x6cc4('0x2c')](handleEntityNotFound(_0x1921f2,null))['then'](saveUpdates(_0x50abd2[_0x6cc4('0x51')],null))['then'](respondWithResult(_0x1921f2,null))['catch'](handleError(_0x1921f2,null));};exports['destroy']=function(_0x2a0749,_0x322ef4){return db[_0x6cc4('0x32')][_0x6cc4('0x4e')]({'where':{'id':_0x2a0749[_0x6cc4('0x49')]['id']}})[_0x6cc4('0x2c')](handleEntityNotFound(_0x322ef4,null))[_0x6cc4('0x2c')](removeEntity(_0x322ef4,null))['catch'](handleError(_0x322ef4,null));};exports['describe']=function(_0x4ecf39,_0x595bab){return db[_0x6cc4('0x32')][_0x6cc4('0x53')]()[_0x6cc4('0x2c')](respondWithResult(_0x595bab,null))['catch'](handleError(_0x595bab,null));};exports[_0x6cc4('0x54')]=function(_0x5cf4f9,_0x59241d,_0x4f7a81){return db[_0x6cc4('0x55')][_0x6cc4('0x27')]({'where':{'ChatGroupId':_0x5cf4f9[_0x6cc4('0x49')]['id'],'ToId':_0x5cf4f9[_0x6cc4('0x56')]['id'],'read':![]}})['then'](function(_0x4ce8c9){return{'id':_['toInteger'](_0x5cf4f9[_0x6cc4('0x49')]['id']),'count':_0x4ce8c9};})[_0x6cc4('0x2c')](respondWithResult(_0x59241d,null))['catch'](handleError(_0x59241d,null));};exports['addMembers']=function(_0x2a97bb,_0x1069ac,_0x845b06){return db[_0x6cc4('0x32')][_0x6cc4('0x4e')]({'where':{'id':_0x2a97bb['params']['id']}})[_0x6cc4('0x2c')](handleEntityNotFound(_0x1069ac,null))[_0x6cc4('0x2c')](function(_0x16faac){if(_0x16faac){return _0x16faac[_0x6cc4('0x57')](_0x2a97bb[_0x6cc4('0x51')]['ids'],_['omit'](_0x2a97bb[_0x6cc4('0x51')],['ids','id'])||{});}})[_0x6cc4('0x2c')](respondWithResult(_0x1069ac,null))[_0x6cc4('0x4f')](handleError(_0x1069ac,null));};exports['getMembers']=function(_0x179d9d,_0x86de83,_0x4af6e8){var _0x15fd49={};var _0x19aa82={};var _0x38db5c;var _0x36e824;return db[_0x6cc4('0x32')][_0x6cc4('0x58')]({'where':{'id':_0x179d9d[_0x6cc4('0x49')]['id']}})[_0x6cc4('0x2c')](handleEntityNotFound(_0x86de83,null))['then'](function(_0x523327){if(_0x523327){_0x38db5c=_0x523327;_0x19aa82[_0x6cc4('0x3a')]=_[_0x6cc4('0x4a')](db[_0x6cc4('0x59')]['rawAttributes']);_0x19aa82[_0x6cc4('0x38')]=_['keys'](_0x179d9d[_0x6cc4('0x38')]);_0x19aa82[_0x6cc4('0x39')]=_[_0x6cc4('0x4b')](_0x19aa82[_0x6cc4('0x3a')],_0x19aa82[_0x6cc4('0x38')]);_0x15fd49['attributes']=_[_0x6cc4('0x4b')](_0x19aa82['model'],qs['fields'](_0x179d9d[_0x6cc4('0x38')][_0x6cc4('0x3b')]));_0x15fd49[_0x6cc4('0x3c')]=_0x15fd49[_0x6cc4('0x3c')][_0x6cc4('0x4c')]?_0x15fd49[_0x6cc4('0x3c')]:_0x19aa82[_0x6cc4('0x3a')];_0x15fd49[_0x6cc4('0x3f')]=qs[_0x6cc4('0x40')](_0x179d9d[_0x6cc4('0x38')][_0x6cc4('0x40')]);_0x15fd49[_0x6cc4('0x43')]=qs['filters'](_[_0x6cc4('0x41')](_0x179d9d['query'],_0x19aa82['filters']));if(_0x179d9d[_0x6cc4('0x38')][_0x6cc4('0x42')]){_0x15fd49[_0x6cc4('0x43')]=_[_0x6cc4('0x44')](_0x15fd49[_0x6cc4('0x43')],{'$or':_[_0x6cc4('0x37')](_0x15fd49[_0x6cc4('0x3c')],function(_0x219ff1){var _0x4742bc={};_0x4742bc[_0x219ff1]={'$like':'%'+_0x179d9d['query'][_0x6cc4('0x42')]+'%'};return _0x4742bc;})});}_0x15fd49=_[_0x6cc4('0x44')]({},_0x15fd49,_0x179d9d['options']);return _0x38db5c['getMembers'](_0x15fd49);}})[_0x6cc4('0x2c')](function(_0x216061){if(_0x216061){_0x36e824=_0x216061[_0x6cc4('0x4c')];if(!_0x179d9d[_0x6cc4('0x38')][_0x6cc4('0x3d')]('nolimit')){_0x15fd49[_0x6cc4('0x26')]=qs[_0x6cc4('0x26')](_0x179d9d['query'][_0x6cc4('0x26')]);_0x15fd49[_0x6cc4('0x24')]=qs['offset'](_0x179d9d[_0x6cc4('0x38')][_0x6cc4('0x24')]);}return _0x38db5c[_0x6cc4('0x5a')](_0x15fd49);}})[_0x6cc4('0x2c')](function(_0x183b89){if(_0x183b89){return _0x183b89?{'count':_0x36e824,'rows':_0x183b89}:null;}})[_0x6cc4('0x2c')](respondWithResult(_0x86de83,null))[_0x6cc4('0x4f')](handleError(_0x86de83,null));};exports[_0x6cc4('0x5b')]=function(_0x37e462,_0x577990,_0x58e147){return db['ChatGroup'][_0x6cc4('0x4e')]({'where':{'id':_0x37e462[_0x6cc4('0x49')]['id']}})[_0x6cc4('0x2c')](handleEntityNotFound(_0x577990,null))[_0x6cc4('0x2c')](function(_0x174b1c){if(_0x174b1c){return _0x174b1c[_0x6cc4('0x5b')](_0x37e462[_0x6cc4('0x38')][_0x6cc4('0x5c')]);}})[_0x6cc4('0x2c')](respondWithStatusCode(_0x577990,null))[_0x6cc4('0x4f')](handleError(_0x577990,null));};exports[_0x6cc4('0x5d')]=function(_0x116484,_0x183013,_0x521806){if(_0x116484[_0x6cc4('0x51')]['id']){delete _0x116484[_0x6cc4('0x51')]['id'];}return db[_0x6cc4('0x32')][_0x6cc4('0x4e')]({'where':{'id':_0x116484[_0x6cc4('0x49')]['id']}})['then'](handleEntityNotFound(_0x183013,null))[_0x6cc4('0x2c')](function(_0x4581a8){if(_0x4581a8){_0x116484[_0x6cc4('0x51')][_0x6cc4('0x5e')]=_0x4581a8['id'];return db[_0x6cc4('0x55')][_0x6cc4('0x50')](_0x116484[_0x6cc4('0x51')]);}})[_0x6cc4('0x2c')](respondWithResult(_0x183013,null))[_0x6cc4('0x4f')](handleError(_0x183013,null));};exports[_0x6cc4('0x5f')]=function(_0x3dbd5a,_0xdc314c,_0x5f0763){var _0x4ef41b={};var _0x3fc57f={};var _0x4f8c52;var _0x5dc115;return db['ChatGroup'][_0x6cc4('0x58')]({'where':{'id':_0x3dbd5a[_0x6cc4('0x49')]['id']}})[_0x6cc4('0x2c')](handleEntityNotFound(_0xdc314c,null))[_0x6cc4('0x2c')](function(_0x1cf6d8){if(_0x1cf6d8){_0x4f8c52=_0x1cf6d8;_0x3fc57f[_0x6cc4('0x3a')]=_[_0x6cc4('0x4a')](db[_0x6cc4('0x55')]['rawAttributes']);_0x3fc57f[_0x6cc4('0x38')]=_[_0x6cc4('0x4a')](_0x3dbd5a[_0x6cc4('0x38')]);_0x3fc57f['filters']=_[_0x6cc4('0x4b')](_0x3fc57f['model'],_0x3fc57f[_0x6cc4('0x38')]);_0x4ef41b['attributes']=_[_0x6cc4('0x4b')](_0x3fc57f['model'],qs['fields'](_0x3dbd5a[_0x6cc4('0x38')]['fields']));_0x4ef41b[_0x6cc4('0x3c')]=_0x4ef41b[_0x6cc4('0x3c')][_0x6cc4('0x4c')]?_0x4ef41b[_0x6cc4('0x3c')]:_0x3fc57f[_0x6cc4('0x3a')];_0x4ef41b[_0x6cc4('0x3f')]=qs[_0x6cc4('0x40')](_0x3dbd5a[_0x6cc4('0x38')][_0x6cc4('0x40')]);_0x4ef41b[_0x6cc4('0x43')]=qs[_0x6cc4('0x39')](_[_0x6cc4('0x41')](_0x3dbd5a[_0x6cc4('0x38')],_0x3fc57f[_0x6cc4('0x39')]));if(_0x3dbd5a['query'][_0x6cc4('0x42')]){_0x4ef41b['where']=_[_0x6cc4('0x44')](_0x4ef41b[_0x6cc4('0x43')],{'$or':_[_0x6cc4('0x37')](_0x4ef41b[_0x6cc4('0x3c')],function(_0x11cee6){var _0x117bca={};_0x117bca[_0x11cee6]={'$like':'%'+_0x3dbd5a['query'][_0x6cc4('0x42')]+'%'};return _0x117bca;})});}if(_0x3dbd5a['query'][_0x6cc4('0x60')]){var _0x381c54=_0x3dbd5a[_0x6cc4('0x38')][_0x6cc4('0x60')]['split'](',');var _0x2e01b7={};_0x2e01b7[_0x381c54[0x0]]={'$gte':moment(_0x381c54[0x1])[_0x6cc4('0x61')](_0x6cc4('0x62'))};_0x4ef41b['where']=_[_0x6cc4('0x44')](_0x4ef41b[_0x6cc4('0x43')],_0x2e01b7);}_0x4ef41b=_['merge']({},_0x4ef41b,_0x3dbd5a[_0x6cc4('0x63')]);return _0x4f8c52[_0x6cc4('0x5f')](_0x4ef41b);}})[_0x6cc4('0x2c')](function(_0x3ade65){if(_0x3ade65){_0x5dc115=_0x3ade65[_0x6cc4('0x4c')];if(!_0x3dbd5a['query']['hasOwnProperty'](_0x6cc4('0x3e'))){_0x4ef41b[_0x6cc4('0x26')]=qs[_0x6cc4('0x26')](_0x3dbd5a[_0x6cc4('0x38')][_0x6cc4('0x26')]);_0x4ef41b[_0x6cc4('0x24')]=qs['offset'](_0x3dbd5a[_0x6cc4('0x38')][_0x6cc4('0x24')]);}return _0x4f8c52[_0x6cc4('0x5f')](_0x4ef41b);}})['then'](function(_0x265f60){if(_0x265f60){return _0x265f60?{'count':_0x5dc115,'rows':_0x265f60}:null;}})[_0x6cc4('0x2c')](respondWithResult(_0xdc314c,null))[_0x6cc4('0x4f')](handleError(_0xdc314c,null));}; \ No newline at end of file +var _0x49b6=['filters','pick','filter','merge','options','ChatGroup','catch','show','includeAll','include','create','body','find','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','ids','getMembers','User','removeMembers','addMessage','ChatGroupId','$gte','split','format','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1708e8,_0x11f822){var _0x5a305f=function(_0xa045d0){while(--_0xa045d0){_0x1708e8['push'](_0x1708e8['shift']());}};_0x5a305f(++_0x11f822);}(_0x49b6,0x1ea));var _0x649b=function(_0x15fe68,_0xddc145){_0x15fe68=_0x15fe68-0x0;var _0x1d144c=_0x49b6[_0x15fe68];return _0x1d144c;};'use strict';var emlformat=require(_0x649b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x649b('0x1'));var jsonpatch=require(_0x649b('0x2'));var rp=require(_0x649b('0x3'));var moment=require(_0x649b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x649b('0x5'));var path=require(_0x649b('0x6'));var sox=require(_0x649b('0x7'));var csv=require(_0x649b('0x8'));var ejs=require(_0x649b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x649b('0xa'));var squel=require(_0x649b('0xb'));var crypto=require(_0x649b('0xc'));var jsforce=require(_0x649b('0xd'));var deskjs=require(_0x649b('0xe'));var toCsv=require(_0x649b('0x8'));var querystring=require(_0x649b('0xf'));var Papa=require('papaparse');var Redis=require(_0x649b('0x10'));var authService=require(_0x649b('0x11'));var qs=require(_0x649b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x649b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x649b('0x14'));var config=require(_0x649b('0x15'));var licenseUtil=require(_0x649b('0x16'));var db=require(_0x649b('0x17'))['db'];config[_0x649b('0x18')]=_['defaults'](config[_0x649b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x649b('0x19'))(new Redis(config[_0x649b('0x18')]));require('./chatGroup.socket')[_0x649b('0x1a')](socket);function respondWithStatusCode(_0x41b3eb,_0x1c7a13){_0x1c7a13=_0x1c7a13||0xcc;return function(_0xd9d95e){if(_0xd9d95e){return _0x41b3eb[_0x649b('0x1b')](_0x1c7a13);}return _0x41b3eb[_0x649b('0x1c')](_0x1c7a13)[_0x649b('0x1d')]();};}function respondWithResult(_0x45bc63,_0x28b4f0){_0x28b4f0=_0x28b4f0||0xc8;return function(_0x40ba96){if(_0x40ba96){return _0x45bc63[_0x649b('0x1c')](_0x28b4f0)[_0x649b('0x1e')](_0x40ba96);}};}function respondWithFilteredResult(_0x5ec263,_0x7db0de){return function(_0xd36fe){if(_0xd36fe){var _0x44b458=typeof _0x7db0de[_0x649b('0x1f')]==='undefined'&&typeof _0x7db0de[_0x649b('0x20')]===_0x649b('0x21');var _0x342ce7=_0xd36fe[_0x649b('0x22')];var _0x2eda80=_0x44b458?0x0:_0x7db0de[_0x649b('0x1f')];var _0xecdc2b=_0x44b458?_0xd36fe[_0x649b('0x22')]:_0x7db0de[_0x649b('0x1f')]+_0x7db0de[_0x649b('0x20')];var _0x128190;if(_0xecdc2b>=_0x342ce7){_0xecdc2b=_0x342ce7;_0x128190=0xc8;}else{_0x128190=0xce;}_0x5ec263[_0x649b('0x1c')](_0x128190);return _0x5ec263[_0x649b('0x23')](_0x649b('0x24'),_0x2eda80+'-'+_0xecdc2b+'/'+_0x342ce7)[_0x649b('0x1e')](_0xd36fe);}return null;};}function patchUpdates(_0x3d6b31){return function(_0x2424d9){try{jsonpatch[_0x649b('0x25')](_0x2424d9,_0x3d6b31,!![]);}catch(_0x386c8b){return BPromise[_0x649b('0x26')](_0x386c8b);}return _0x2424d9[_0x649b('0x27')]();};}function saveUpdates(_0x120f61,_0xc51f0b){return function(_0x45ed78){if(_0x45ed78){return _0x45ed78[_0x649b('0x28')](_0x120f61)[_0x649b('0x29')](function(_0x224011){return _0x224011;});}return null;};}function removeEntity(_0x483057,_0x585190){return function(_0x57d85f){if(_0x57d85f){return _0x57d85f[_0x649b('0x2a')]()[_0x649b('0x29')](function(){_0x483057[_0x649b('0x1c')](0xcc)[_0x649b('0x1d')]();});}};}function handleEntityNotFound(_0x3207f1,_0x47aac7){return function(_0x315476){if(!_0x315476){_0x3207f1[_0x649b('0x1b')](0x194);}return _0x315476;};}function handleError(_0x1c6b36,_0x2aac47){_0x2aac47=_0x2aac47||0x1f4;return function(_0x2b90b4){logger[_0x649b('0x2b')](_0x2b90b4[_0x649b('0x2c')]);if(_0x2b90b4['name']){delete _0x2b90b4['name'];}_0x1c6b36[_0x649b('0x1c')](_0x2aac47)[_0x649b('0x2d')](_0x2b90b4);};}exports[_0x649b('0x2e')]=function(_0x3b57aa,_0x1a0f15){var _0x330ac3={},_0x5c9847={},_0x369be0={'count':0x0,'rows':[]};var _0x255f28=_[_0x649b('0x2f')](db['ChatGroup'][_0x649b('0x30')],function(_0x6341ea){return{'name':_0x6341ea['fieldName'],'type':_0x6341ea[_0x649b('0x31')]['key']};});_0x5c9847[_0x649b('0x32')]=_[_0x649b('0x2f')](_0x255f28,'name');_0x5c9847[_0x649b('0x33')]=_[_0x649b('0x34')](_0x3b57aa[_0x649b('0x33')]);_0x5c9847['filters']=_[_0x649b('0x35')](_0x5c9847['model'],_0x5c9847[_0x649b('0x33')]);_0x330ac3[_0x649b('0x36')]=_[_0x649b('0x35')](_0x5c9847[_0x649b('0x32')],qs[_0x649b('0x37')](_0x3b57aa[_0x649b('0x33')]['fields']));_0x330ac3[_0x649b('0x36')]=_0x330ac3[_0x649b('0x36')][_0x649b('0x38')]?_0x330ac3[_0x649b('0x36')]:_0x5c9847[_0x649b('0x32')];if(!_0x3b57aa['query'][_0x649b('0x39')](_0x649b('0x3a'))){_0x330ac3[_0x649b('0x20')]=qs[_0x649b('0x20')](_0x3b57aa[_0x649b('0x33')]['limit']);_0x330ac3[_0x649b('0x1f')]=qs[_0x649b('0x1f')](_0x3b57aa[_0x649b('0x33')]['offset']);}_0x330ac3[_0x649b('0x3b')]=qs[_0x649b('0x3c')](_0x3b57aa[_0x649b('0x33')][_0x649b('0x3c')]);_0x330ac3[_0x649b('0x3d')]=qs[_0x649b('0x3e')](_[_0x649b('0x3f')](_0x3b57aa['query'],_0x5c9847[_0x649b('0x3e')]),_0x255f28);if(_0x3b57aa['query'][_0x649b('0x40')]){_0x330ac3[_0x649b('0x3d')]=_[_0x649b('0x41')](_0x330ac3['where'],{'$or':_['map'](_0x255f28,function(_0x15a419){if(_0x15a419['type']!=='VIRTUAL'){var _0x38d087={};_0x38d087[_0x15a419['name']]={'$like':'%'+_0x3b57aa[_0x649b('0x33')][_0x649b('0x40')]+'%'};return _0x38d087;}})});}_0x330ac3=_[_0x649b('0x41')]({},_0x330ac3,_0x3b57aa[_0x649b('0x42')]);var _0x115f14={'where':_0x330ac3[_0x649b('0x3d')]};return db['ChatGroup'][_0x649b('0x22')](_0x115f14)[_0x649b('0x29')](function(_0x1700a7){_0x369be0[_0x649b('0x22')]=_0x1700a7;if(_0x3b57aa[_0x649b('0x33')]['includeAll']){_0x330ac3['include']=[{'all':!![]}];}return db[_0x649b('0x43')]['findAll'](_0x330ac3);})['then'](function(_0x3c3b6b){_0x369be0['rows']=_0x3c3b6b;return _0x369be0;})[_0x649b('0x29')](respondWithFilteredResult(_0x1a0f15,_0x330ac3))[_0x649b('0x44')](handleError(_0x1a0f15,null));};exports[_0x649b('0x45')]=function(_0x1e4ce7,_0x4ad8ad){var _0x3e4f65={'raw':!![],'where':{'id':_0x1e4ce7['params']['id']}},_0x449dc4={};_0x449dc4['model']=_['keys'](db[_0x649b('0x43')][_0x649b('0x30')]);_0x449dc4[_0x649b('0x33')]=_[_0x649b('0x34')](_0x1e4ce7[_0x649b('0x33')]);_0x449dc4['filters']=_['intersection'](_0x449dc4['model'],_0x449dc4[_0x649b('0x33')]);_0x3e4f65[_0x649b('0x36')]=_[_0x649b('0x35')](_0x449dc4[_0x649b('0x32')],qs['fields'](_0x1e4ce7[_0x649b('0x33')][_0x649b('0x37')]));_0x3e4f65[_0x649b('0x36')]=_0x3e4f65[_0x649b('0x36')][_0x649b('0x38')]?_0x3e4f65[_0x649b('0x36')]:_0x449dc4[_0x649b('0x32')];if(_0x1e4ce7[_0x649b('0x33')][_0x649b('0x46')]){_0x3e4f65[_0x649b('0x47')]=[{'all':!![]}];}_0x3e4f65=_['merge']({},_0x3e4f65,_0x1e4ce7['options']);return db[_0x649b('0x43')]['find'](_0x3e4f65)[_0x649b('0x29')](handleEntityNotFound(_0x4ad8ad,null))[_0x649b('0x29')](respondWithResult(_0x4ad8ad,null))[_0x649b('0x44')](handleError(_0x4ad8ad,null));};exports['create']=function(_0x8895ec,_0x525a96){return db[_0x649b('0x43')][_0x649b('0x48')](_0x8895ec[_0x649b('0x49')],{})[_0x649b('0x29')](respondWithResult(_0x525a96,0xc9))[_0x649b('0x44')](handleError(_0x525a96,null));};exports[_0x649b('0x28')]=function(_0x25ea88,_0xb8ae93){if(_0x25ea88[_0x649b('0x49')]['id']){delete _0x25ea88[_0x649b('0x49')]['id'];}return db[_0x649b('0x43')]['find']({'where':{'id':_0x25ea88['params']['id']}})[_0x649b('0x29')](handleEntityNotFound(_0xb8ae93,null))[_0x649b('0x29')](saveUpdates(_0x25ea88[_0x649b('0x49')],null))[_0x649b('0x29')](respondWithResult(_0xb8ae93,null))[_0x649b('0x44')](handleError(_0xb8ae93,null));};exports[_0x649b('0x2a')]=function(_0x3af923,_0x55f579){return db[_0x649b('0x43')][_0x649b('0x4a')]({'where':{'id':_0x3af923[_0x649b('0x4b')]['id']}})[_0x649b('0x29')](handleEntityNotFound(_0x55f579,null))[_0x649b('0x29')](removeEntity(_0x55f579,null))[_0x649b('0x44')](handleError(_0x55f579,null));};exports[_0x649b('0x4c')]=function(_0x251314,_0x51fd22){return db[_0x649b('0x43')][_0x649b('0x4c')]()[_0x649b('0x29')](respondWithResult(_0x51fd22,null))[_0x649b('0x44')](handleError(_0x51fd22,null));};exports[_0x649b('0x4d')]=function(_0x151f23,_0x125369,_0x308226){return db[_0x649b('0x4e')]['count']({'where':{'ChatGroupId':_0x151f23[_0x649b('0x4b')]['id'],'ToId':_0x151f23['user']['id'],'read':![]}})[_0x649b('0x29')](function(_0x2c686d){return{'id':_[_0x649b('0x4f')](_0x151f23[_0x649b('0x4b')]['id']),'count':_0x2c686d};})[_0x649b('0x29')](respondWithResult(_0x125369,null))[_0x649b('0x44')](handleError(_0x125369,null));};exports[_0x649b('0x50')]=function(_0x594dad,_0x418562,_0x405e14){return db[_0x649b('0x43')][_0x649b('0x4a')]({'where':{'id':_0x594dad[_0x649b('0x4b')]['id']}})[_0x649b('0x29')](handleEntityNotFound(_0x418562,null))[_0x649b('0x29')](function(_0x2d0dd2){if(_0x2d0dd2){return _0x2d0dd2[_0x649b('0x50')](_0x594dad[_0x649b('0x49')]['ids'],_[_0x649b('0x51')](_0x594dad['body'],[_0x649b('0x52'),'id'])||{});}})[_0x649b('0x29')](respondWithResult(_0x418562,null))[_0x649b('0x44')](handleError(_0x418562,null));};exports[_0x649b('0x53')]=function(_0x1c8ac0,_0x67f059,_0x4ce759){var _0x399d3a={};var _0x20f32f={};var _0x3b2801;var _0x46b195;return db[_0x649b('0x43')]['findOne']({'where':{'id':_0x1c8ac0[_0x649b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x67f059,null))[_0x649b('0x29')](function(_0x4d1a90){if(_0x4d1a90){_0x3b2801=_0x4d1a90;_0x20f32f[_0x649b('0x32')]=_[_0x649b('0x34')](db[_0x649b('0x54')][_0x649b('0x30')]);_0x20f32f[_0x649b('0x33')]=_[_0x649b('0x34')](_0x1c8ac0[_0x649b('0x33')]);_0x20f32f[_0x649b('0x3e')]=_['intersection'](_0x20f32f[_0x649b('0x32')],_0x20f32f[_0x649b('0x33')]);_0x399d3a['attributes']=_[_0x649b('0x35')](_0x20f32f[_0x649b('0x32')],qs[_0x649b('0x37')](_0x1c8ac0[_0x649b('0x33')][_0x649b('0x37')]));_0x399d3a['attributes']=_0x399d3a[_0x649b('0x36')][_0x649b('0x38')]?_0x399d3a[_0x649b('0x36')]:_0x20f32f[_0x649b('0x32')];_0x399d3a[_0x649b('0x3b')]=qs[_0x649b('0x3c')](_0x1c8ac0['query']['sort']);_0x399d3a['where']=qs[_0x649b('0x3e')](_['pick'](_0x1c8ac0[_0x649b('0x33')],_0x20f32f[_0x649b('0x3e')]));if(_0x1c8ac0[_0x649b('0x33')][_0x649b('0x40')]){_0x399d3a[_0x649b('0x3d')]=_['merge'](_0x399d3a[_0x649b('0x3d')],{'$or':_[_0x649b('0x2f')](_0x399d3a['attributes'],function(_0x24fa0d){var _0x5c9381={};_0x5c9381[_0x24fa0d]={'$like':'%'+_0x1c8ac0[_0x649b('0x33')][_0x649b('0x40')]+'%'};return _0x5c9381;})});}_0x399d3a=_[_0x649b('0x41')]({},_0x399d3a,_0x1c8ac0[_0x649b('0x42')]);return _0x3b2801[_0x649b('0x53')](_0x399d3a);}})[_0x649b('0x29')](function(_0x3b7006){if(_0x3b7006){_0x46b195=_0x3b7006['length'];if(!_0x1c8ac0['query'][_0x649b('0x39')](_0x649b('0x3a'))){_0x399d3a[_0x649b('0x20')]=qs[_0x649b('0x20')](_0x1c8ac0['query'][_0x649b('0x20')]);_0x399d3a[_0x649b('0x1f')]=qs[_0x649b('0x1f')](_0x1c8ac0[_0x649b('0x33')]['offset']);}return _0x3b2801['getMembers'](_0x399d3a);}})[_0x649b('0x29')](function(_0x18c5e8){if(_0x18c5e8){return _0x18c5e8?{'count':_0x46b195,'rows':_0x18c5e8}:null;}})[_0x649b('0x29')](respondWithResult(_0x67f059,null))['catch'](handleError(_0x67f059,null));};exports[_0x649b('0x55')]=function(_0x1f1f94,_0x471638,_0x1e1b76){return db[_0x649b('0x43')][_0x649b('0x4a')]({'where':{'id':_0x1f1f94[_0x649b('0x4b')]['id']}})[_0x649b('0x29')](handleEntityNotFound(_0x471638,null))['then'](function(_0x1d0ad9){if(_0x1d0ad9){return _0x1d0ad9['removeMembers'](_0x1f1f94['query'][_0x649b('0x52')]);}})[_0x649b('0x29')](respondWithStatusCode(_0x471638,null))[_0x649b('0x44')](handleError(_0x471638,null));};exports[_0x649b('0x56')]=function(_0x3f83e0,_0x14ca4c,_0x346f44){if(_0x3f83e0[_0x649b('0x49')]['id']){delete _0x3f83e0['body']['id'];}return db['ChatGroup'][_0x649b('0x4a')]({'where':{'id':_0x3f83e0[_0x649b('0x4b')]['id']}})[_0x649b('0x29')](handleEntityNotFound(_0x14ca4c,null))['then'](function(_0x491560){if(_0x491560){_0x3f83e0[_0x649b('0x49')][_0x649b('0x57')]=_0x491560['id'];return db[_0x649b('0x4e')][_0x649b('0x48')](_0x3f83e0[_0x649b('0x49')]);}})[_0x649b('0x29')](respondWithResult(_0x14ca4c,null))[_0x649b('0x44')](handleError(_0x14ca4c,null));};exports['getMessages']=function(_0x52a679,_0x1fcb4b,_0x51e003){var _0x21f758={};var _0x1a23fb={};var _0x4906e8;var _0x441a76;return db[_0x649b('0x43')]['findOne']({'where':{'id':_0x52a679['params']['id']}})[_0x649b('0x29')](handleEntityNotFound(_0x1fcb4b,null))['then'](function(_0x351758){if(_0x351758){_0x4906e8=_0x351758;_0x1a23fb[_0x649b('0x32')]=_[_0x649b('0x34')](db[_0x649b('0x4e')][_0x649b('0x30')]);_0x1a23fb[_0x649b('0x33')]=_[_0x649b('0x34')](_0x52a679[_0x649b('0x33')]);_0x1a23fb[_0x649b('0x3e')]=_[_0x649b('0x35')](_0x1a23fb[_0x649b('0x32')],_0x1a23fb[_0x649b('0x33')]);_0x21f758[_0x649b('0x36')]=_['intersection'](_0x1a23fb['model'],qs['fields'](_0x52a679[_0x649b('0x33')][_0x649b('0x37')]));_0x21f758[_0x649b('0x36')]=_0x21f758['attributes'][_0x649b('0x38')]?_0x21f758[_0x649b('0x36')]:_0x1a23fb[_0x649b('0x32')];_0x21f758[_0x649b('0x3b')]=qs[_0x649b('0x3c')](_0x52a679['query'][_0x649b('0x3c')]);_0x21f758['where']=qs['filters'](_[_0x649b('0x3f')](_0x52a679[_0x649b('0x33')],_0x1a23fb[_0x649b('0x3e')]));if(_0x52a679['query']['filter']){_0x21f758['where']=_[_0x649b('0x41')](_0x21f758[_0x649b('0x3d')],{'$or':_['map'](_0x21f758[_0x649b('0x36')],function(_0x146b49){var _0x318517={};_0x318517[_0x146b49]={'$like':'%'+_0x52a679[_0x649b('0x33')][_0x649b('0x40')]+'%'};return _0x318517;})});}if(_0x52a679[_0x649b('0x33')][_0x649b('0x58')]){var _0x473e78=_0x52a679[_0x649b('0x33')]['$gte'][_0x649b('0x59')](',');var _0x3f4bb3={};_0x3f4bb3[_0x473e78[0x0]]={'$gte':moment(_0x473e78[0x1])[_0x649b('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x21f758[_0x649b('0x3d')]=_[_0x649b('0x41')](_0x21f758['where'],_0x3f4bb3);}_0x21f758=_['merge']({},_0x21f758,_0x52a679[_0x649b('0x42')]);return _0x4906e8[_0x649b('0x5b')](_0x21f758);}})[_0x649b('0x29')](function(_0x50dc03){if(_0x50dc03){_0x441a76=_0x50dc03[_0x649b('0x38')];if(!_0x52a679['query'][_0x649b('0x39')](_0x649b('0x3a'))){_0x21f758['limit']=qs['limit'](_0x52a679[_0x649b('0x33')]['limit']);_0x21f758[_0x649b('0x1f')]=qs[_0x649b('0x1f')](_0x52a679[_0x649b('0x33')][_0x649b('0x1f')]);}return _0x4906e8[_0x649b('0x5b')](_0x21f758);}})[_0x649b('0x29')](function(_0x3ae3ba){if(_0x3ae3ba){return _0x3ae3ba?{'count':_0x441a76,'rows':_0x3ae3ba}:null;}})['then'](respondWithResult(_0x1fcb4b,null))['catch'](handleError(_0x1fcb4b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a416200..4d76b82 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 _0xc9de=['events','../../mysqldb','ChatGroup','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xc9de,0x140));var _0xec9d=function(_0x559e7b,_0x128e69){_0x559e7b=_0x559e7b-0x0;var _0x3d4aaa=_0xc9de[_0x559e7b];return _0x3d4aaa;};'use strict';var EventEmitter=require(_0xec9d('0x0'));var ChatGroup=require(_0xec9d('0x1'))['db'][_0xec9d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec9d('0x3'),'afterUpdate':_0xec9d('0x4'),'afterDestroy':_0xec9d('0x5')};function emitEvent(_0xc34261){return function(_0x3cc1cb,_0x14c4e5,_0x9a3338){ChatGroupEvents[_0xec9d('0x6')](_0xc34261+':'+_0x3cc1cb['id'],_0x3cc1cb);ChatGroupEvents['emit'](_0xc34261,_0x3cc1cb);_0x9a3338(null);};}for(var e in events){if(events[_0xec9d('0x7')](e)){var event=events[e];ChatGroup[_0xec9d('0x8')](e,emitEvent(event));}}module[_0xec9d('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xe2bb=['update','remove','emit','hasOwnProperty','hook','exports','save'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xe2bb,0x76));var _0xbe2b=function(_0xffc8d6,_0x5a4ef2){_0xffc8d6=_0xffc8d6-0x0;var _0x1c6060=_0xe2bb[_0xffc8d6];return _0x1c6060;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe2b('0x0'),'afterUpdate':_0xbe2b('0x1'),'afterDestroy':_0xbe2b('0x2')};function emitEvent(_0x1379c5){return function(_0x34a542,_0xd0d1ae,_0xc944a3){ChatGroupEvents[_0xbe2b('0x3')](_0x1379c5+':'+_0x34a542['id'],_0x34a542);ChatGroupEvents[_0xbe2b('0x3')](_0x1379c5,_0x34a542);_0xc944a3(null);};}for(var e in events){if(events[_0xbe2b('0x4')](e)){var event=events[e];ChatGroup[_0xbe2b('0x5')](e,emitEvent(event));}}module[_0xbe2b('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index eae3996..ee5da53 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 _0x0be7=['api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','lodash'];(function(_0x192b1a,_0x5b1a42){var _0x219986=function(_0x197aa7){while(--_0x197aa7){_0x192b1a['push'](_0x192b1a['shift']());}};_0x219986(++_0x5b1a42);}(_0x0be7,0xbd));var _0x70be=function(_0x5df60f,_0x138a33){_0x5df60f=_0x5df60f-0x0;var _0x359ee8=_0x0be7[_0x5df60f];return _0x359ee8;};'use strict';var _=require(_0x70be('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x70be('0x1'));var moment=require('moment');var BPromise=require(_0x70be('0x2'));var rp=require(_0x70be('0x3'));var fs=require('fs');var path=require(_0x70be('0x4'));var rimraf=require(_0x70be('0x5'));var config=require('../../config/environment');var attributes=require(_0x70be('0x6'));module[_0x70be('0x7')]=function(_0xb2516e,_0x28477a){return _0xb2516e[_0x70be('0x8')](_0x70be('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b0=['path','rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x98b0,0x1b3));var _0x098b=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0x98b0[_0x1e399a];return _0x539897;};'use strict';var _=require(_0x098b('0x0'));var util=require('util');var logger=require(_0x098b('0x1'))(_0x098b('0x2'));var moment=require(_0x098b('0x3'));var BPromise=require(_0x098b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x098b('0x5'));var rimraf=require(_0x098b('0x6'));var config=require('../../config/environment');var attributes=require(_0x098b('0x7'));module['exports']=function(_0x1ae882,_0x28c14d){return _0x1ae882[_0x098b('0x8')](_0x098b('0x9'),attributes,{'tableName':_0x098b('0xa'),'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 2e08a55..95d7b43 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 _0x7a2d=['socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x7a2d,0x142));var _0xd7a2=function(_0x20ea97,_0x3a404d){_0x20ea97=_0x20ea97-0x0;var _0x1f3e19=_0x7a2d[_0x20ea97];return _0x1f3e19;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var moment=require(_0xd7a2('0x2'));var BPromise=require(_0xd7a2('0x3'));var rs=require(_0xd7a2('0x4'));var fs=require('fs');var Redis=require(_0xd7a2('0x5'));var db=require(_0xd7a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7a2('0x7'));var config=require(_0xd7a2('0x8'));var jayson=require(_0xd7a2('0x9'));var client=jayson[_0xd7a2('0xa')]['http']({'port':0x232a});config[_0xd7a2('0xb')]=_[_0xd7a2('0xc')](config[_0xd7a2('0xb')],{'host':_0xd7a2('0xd'),'port':0x18eb});var socket=require(_0xd7a2('0xe'))(new Redis(config[_0xd7a2('0xb')]));require(_0xd7a2('0xf'))[_0xd7a2('0x10')](socket);function respondWithRpcPromise(_0x104013,_0x503b42,_0x2890bf){return new BPromise(function(_0x319795,_0xe6e4b9){return client[_0xd7a2('0x11')](_0x104013,_0x2890bf)[_0xd7a2('0x12')](function(_0x358c39){logger[_0xd7a2('0x13')]('ChatGroup,\x20%s,\x20%s',_0x503b42,'request\x20sent');logger[_0xd7a2('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x503b42,_0xd7a2('0x15'),JSON[_0xd7a2('0x16')](_0x358c39));if(_0x358c39[_0xd7a2('0x17')]){if(_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x18')]===0x1f4){logger[_0xd7a2('0x17')](_0xd7a2('0x19'),_0x503b42,_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x1a')]);return _0xe6e4b9(_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x1a')]);}logger['error'](_0xd7a2('0x19'),_0x503b42,_0x358c39['error']['message']);return _0x319795(_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x1a')]);}else{logger[_0xd7a2('0x13')](_0xd7a2('0x19'),_0x503b42,_0xd7a2('0x15'));_0x319795(_0x358c39[_0xd7a2('0x1b')]['message']);}})['catch'](function(_0x436fff){logger[_0xd7a2('0x17')](_0xd7a2('0x19'),_0x503b42,_0x436fff);_0xe6e4b9(_0x436fff);});});} \ No newline at end of file +var _0x6dac=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1ae141,_0x9b00e4){var _0x970bb1=function(_0x2252e6){while(--_0x2252e6){_0x1ae141['push'](_0x1ae141['shift']());}};_0x970bb1(++_0x9b00e4);}(_0x6dac,0x16e));var _0xc6da=function(_0x38b7e3,_0x4aa608){_0x38b7e3=_0x38b7e3-0x0;var _0x4e4b0d=_0x6dac[_0x38b7e3];return _0x4e4b0d;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var moment=require(_0xc6da('0x2'));var BPromise=require(_0xc6da('0x3'));var rs=require(_0xc6da('0x4'));var fs=require('fs');var Redis=require(_0xc6da('0x5'));var db=require(_0xc6da('0x6'))['db'];var utils=require(_0xc6da('0x7'));var logger=require(_0xc6da('0x8'))(_0xc6da('0x9'));var config=require(_0xc6da('0xa'));var jayson=require(_0xc6da('0xb'));var client=jayson[_0xc6da('0xc')]['http']({'port':0x232a});config[_0xc6da('0xd')]=_[_0xc6da('0xe')](config[_0xc6da('0xd')],{'host':_0xc6da('0xf'),'port':0x18eb});var socket=require(_0xc6da('0x10'))(new Redis(config[_0xc6da('0xd')]));require(_0xc6da('0x11'))[_0xc6da('0x12')](socket);function respondWithRpcPromise(_0x13fea1,_0x48455d,_0x34b9ea){return new BPromise(function(_0x2e4eb7,_0x414831){return client[_0xc6da('0x13')](_0x13fea1,_0x34b9ea)[_0xc6da('0x14')](function(_0x27411e){logger[_0xc6da('0x15')](_0xc6da('0x16'),_0x48455d,_0xc6da('0x17'));logger[_0xc6da('0x18')](_0xc6da('0x19'),_0x48455d,_0xc6da('0x17'),JSON[_0xc6da('0x1a')](_0x27411e));if(_0x27411e['error']){if(_0x27411e[_0xc6da('0x1b')][_0xc6da('0x1c')]===0x1f4){logger[_0xc6da('0x1b')](_0xc6da('0x16'),_0x48455d,_0x27411e[_0xc6da('0x1b')][_0xc6da('0x1d')]);return _0x414831(_0x27411e['error'][_0xc6da('0x1d')]);}logger[_0xc6da('0x1b')](_0xc6da('0x16'),_0x48455d,_0x27411e[_0xc6da('0x1b')][_0xc6da('0x1d')]);return _0x2e4eb7(_0x27411e['error'][_0xc6da('0x1d')]);}else{logger['info'](_0xc6da('0x16'),_0x48455d,_0xc6da('0x17'));_0x2e4eb7(_0x27411e[_0xc6da('0x1e')][_0xc6da('0x1d')]);}})['catch'](function(_0x232565){logger[_0xc6da('0x1b')](_0xc6da('0x16'),_0x48455d,_0x232565);_0x414831(_0x232565);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9ecec1b..10a6ff7 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 _0xbcc7=['removeListener','register','length','chatGroup:','./chatGroup.events','save','update','emit'];(function(_0x6fcb25,_0xcf4055){var _0x49d670=function(_0x5f0741){while(--_0x5f0741){_0x6fcb25['push'](_0x6fcb25['shift']());}};_0x49d670(++_0xcf4055);}(_0xbcc7,0x114));var _0x7bcc=function(_0x395628,_0x56f435){_0x395628=_0x395628-0x0;var _0x248908=_0xbcc7[_0x395628];return _0x248908;};'use strict';var ChatGroupEvents=require(_0x7bcc('0x0'));var events=[_0x7bcc('0x1'),'remove',_0x7bcc('0x2')];function createListener(_0x5dd84c,_0x8a98e1){return function(_0x3f8aa5){_0x8a98e1[_0x7bcc('0x3')](_0x5dd84c,_0x3f8aa5);};}function removeListener(_0x556f9c,_0x20d537){return function(){ChatGroupEvents[_0x7bcc('0x4')](_0x556f9c,_0x20d537);};}exports[_0x7bcc('0x5')]=function(_0x31ba37){for(var _0x1a6a4f=0x0,_0xadb8c6=events[_0x7bcc('0x6')];_0x1a6a4f<_0xadb8c6;_0x1a6a4f++){var _0x2e4678=events[_0x1a6a4f];var _0x1e88f7=createListener(_0x7bcc('0x7')+_0x2e4678,_0x31ba37);ChatGroupEvents['on'](_0x2e4678,_0x1e88f7);}}; \ No newline at end of file +var _0x4c47=['emit','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x4c47,0x10e));var _0x74c4=function(_0x3a5358,_0x18a34e){_0x3a5358=_0x3a5358-0x0;var _0x2dfe15=_0x4c47[_0x3a5358];return _0x2dfe15;};'use strict';var ChatGroupEvents=require(_0x74c4('0x0'));var events=[_0x74c4('0x1'),'remove',_0x74c4('0x2')];function createListener(_0x2e310c,_0x23b554){return function(_0x473f84){_0x23b554[_0x74c4('0x3')](_0x2e310c,_0x473f84);};}function removeListener(_0x49cc33,_0x447567){return function(){ChatGroupEvents['removeListener'](_0x49cc33,_0x447567);};}exports[_0x74c4('0x4')]=function(_0x226d73){for(var _0x2e2a94=0x0,_0xbb0154=events[_0x74c4('0x5')];_0x2e2a94<_0xbb0154;_0x2e2a94++){var _0x5ee6e2=events[_0x2e2a94];var _0x1c477f=createListener(_0x74c4('0x6')+_0x5ee6e2,_0x226d73);ChatGroupEvents['on'](_0x5ee6e2,_0x1c477f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index aee68cd..6f77fcf 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 _0xaf59=['delete','removeMembers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','create','post','addMembers','addMessage','destroy'];(function(_0x320004,_0xfd3b7b){var _0x3bc6c7=function(_0x28c75a){while(--_0x28c75a){_0x320004['push'](_0x320004['shift']());}};_0x3bc6c7(++_0xfd3b7b);}(_0xaf59,0x153));var _0x9af5=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xaf59[_0x263f4c];return _0x3a78d3;};'use strict';var multer=require(_0x9af5('0x0'));var util=require(_0x9af5('0x1'));var path=require('path');var timeout=require(_0x9af5('0x2'));var express=require(_0x9af5('0x3'));var router=express[_0x9af5('0x4')]();var fs_extra=require(_0x9af5('0x5'));var auth=require(_0x9af5('0x6'));var interaction=require(_0x9af5('0x7'));var config=require(_0x9af5('0x8'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0x9af5('0x9')](),controller[_0x9af5('0xa')]);router[_0x9af5('0xb')](_0x9af5('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9af5('0xb')](_0x9af5('0xd'),auth['isAuthenticated'](),controller[_0x9af5('0xe')]);router[_0x9af5('0xb')](_0x9af5('0xf'),auth[_0x9af5('0x9')](),controller[_0x9af5('0x10')]);router[_0x9af5('0xb')](_0x9af5('0x11'),auth['isAuthenticated'](),controller[_0x9af5('0x12')]);router[_0x9af5('0xb')](_0x9af5('0x13'),auth[_0x9af5('0x9')](),controller['getMessages']);router['post']('/',auth[_0x9af5('0x9')](),controller[_0x9af5('0x14')]);router[_0x9af5('0x15')]('/:id/members',auth[_0x9af5('0x9')](),controller[_0x9af5('0x16')]);router[_0x9af5('0x15')](_0x9af5('0x13'),auth[_0x9af5('0x9')](),controller[_0x9af5('0x17')]);router['put'](_0x9af5('0xd'),auth[_0x9af5('0x9')](),controller['update']);router['delete']('/:id',auth[_0x9af5('0x9')](),controller[_0x9af5('0x18')]);router[_0x9af5('0x19')]('/:id/members',auth['isAuthenticated'](),controller[_0x9af5('0x1a')]);module[_0x9af5('0x1b')]=router; \ No newline at end of file +var _0x8225=['removeMembers','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','show','/:id/unread','create','post','/:id/members','addMembers','addMessage','delete','/:id','destroy'];(function(_0x3c4682,_0x270dd2){var _0x102849=function(_0x27a6d2){while(--_0x27a6d2){_0x3c4682['push'](_0x3c4682['shift']());}};_0x102849(++_0x270dd2);}(_0x8225,0x152));var _0x5822=function(_0x3f19be,_0x5299ab){_0x3f19be=_0x3f19be-0x0;var _0x240471=_0x8225[_0x3f19be];return _0x240471;};'use strict';var multer=require('multer');var util=require(_0x5822('0x0'));var path=require(_0x5822('0x1'));var timeout=require('connect-timeout');var express=require(_0x5822('0x2'));var router=express['Router']();var fs_extra=require(_0x5822('0x3'));var auth=require(_0x5822('0x4'));var interaction=require(_0x5822('0x5'));var config=require(_0x5822('0x6'));var controller=require(_0x5822('0x7'));router[_0x5822('0x8')]('/',auth[_0x5822('0x9')](),controller['index']);router[_0x5822('0x8')](_0x5822('0xa'),auth[_0x5822('0x9')](),controller[_0x5822('0xb')]);router[_0x5822('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5822('0xc')]);router[_0x5822('0x8')](_0x5822('0xd'),auth['isAuthenticated'](),controller['getUnread']);router[_0x5822('0x8')]('/:id/members',auth[_0x5822('0x9')](),controller['getMembers']);router['get']('/:id/messages',auth[_0x5822('0x9')](),controller['getMessages']);router['post']('/',auth[_0x5822('0x9')](),controller[_0x5822('0xe')]);router[_0x5822('0xf')](_0x5822('0x10'),auth['isAuthenticated'](),controller[_0x5822('0x11')]);router[_0x5822('0xf')]('/:id/messages',auth[_0x5822('0x9')](),controller[_0x5822('0x12')]);router['put']('/:id',auth[_0x5822('0x9')](),controller['update']);router[_0x5822('0x13')](_0x5822('0x14'),auth['isAuthenticated'](),controller[_0x5822('0x15')]);router[_0x5822('0x13')](_0x5822('0x10'),auth[_0x5822('0x9')](),controller[_0x5822('0x16')]);module[_0x5822('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ce0f9a6..e23918f 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 _0x3a42=['BOOLEAN','INTEGER','thumb','star','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3a42,0x148));var _0x23a4=function(_0x261d18,_0x13490f){_0x261d18=_0x261d18-0x0;var _0x3e7208=_0x3a42[_0x261d18];return _0x3e7208;};'use strict';var Sequelize=require(_0x23a4('0x0'));module[_0x23a4('0x1')]={'closed':{'type':Sequelize[_0x23a4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x23a4('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x23a4('0x4')),'defaultValue':_0x23a4('0x5')},'ratingMessage':{'type':Sequelize[_0x23a4('0x6')]},'pathTranscript':{'type':Sequelize[_0x23a4('0x6')]},'mailTranscript':{'type':Sequelize[_0x23a4('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x23a4('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x23a4('0x7')]},'thirdDisposition':{'type':Sequelize[_0x23a4('0x7')]},'note':{'type':Sequelize[_0x23a4('0x7')]},'browserName':{'type':Sequelize[_0x23a4('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x23a4('0x7')]},'osVersion':{'type':Sequelize[_0x23a4('0x7')]},'deviceModel':{'type':Sequelize[_0x23a4('0x7')]},'deviceVendor':{'type':Sequelize[_0x23a4('0x7')]},'deviceType':{'type':Sequelize[_0x23a4('0x7')]},'referer':{'type':Sequelize[_0x23a4('0x6')]},'customerIp':{'type':Sequelize[_0x23a4('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x23a4('0x9'))},'read1stAt':{'type':Sequelize[_0x23a4('0x8')]},'lastMsgAt':{'type':Sequelize[_0x23a4('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x23a4('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x23a4('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x23a4('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x23a4('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x23a4('0x3')]}}; \ No newline at end of file +var _0xcf6f=['TEXT','STRING','long','DATE','out','INTEGER','sequelize','BOOLEAN','ENUM','thumb','star'];(function(_0x4464f3,_0x47ad4f){var _0x3f5311=function(_0x14980b){while(--_0x14980b){_0x4464f3['push'](_0x4464f3['shift']());}};_0x3f5311(++_0x47ad4f);}(_0xcf6f,0x12f));var _0xfcf6=function(_0xa53cd9,_0x2e2a8b){_0xa53cd9=_0xa53cd9-0x0;var _0x139dc7=_0xcf6f[_0xa53cd9];return _0x139dc7;};'use strict';var Sequelize=require(_0xfcf6('0x0'));module['exports']={'closed':{'type':Sequelize[_0xfcf6('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xfcf6('0x2')]('star',_0xfcf6('0x3')),'defaultValue':_0xfcf6('0x4')},'ratingMessage':{'type':Sequelize[_0xfcf6('0x5')]},'pathTranscript':{'type':Sequelize[_0xfcf6('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfcf6('0x6')]},'secondDisposition':{'type':Sequelize[_0xfcf6('0x6')]},'thirdDisposition':{'type':Sequelize[_0xfcf6('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xfcf6('0x6')]},'browserVersion':{'type':Sequelize[_0xfcf6('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xfcf6('0x6')]},'deviceVendor':{'type':Sequelize[_0xfcf6('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xfcf6('0x5')]},'customerIp':{'type':Sequelize[_0xfcf6('0x6')]},'formData':{'type':Sequelize[_0xfcf6('0x5')](_0xfcf6('0x7'))},'read1stAt':{'type':Sequelize[_0xfcf6('0x8')]},'lastMsgAt':{'type':Sequelize[_0xfcf6('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xfcf6('0x2')]('in',_0xfcf6('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xfcf6('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xfcf6('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfcf6('0xa')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7de5fc3..1a64232 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 _0xb7d7=['N.A.','existsSync','pipe','createWriteStream','out','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','sendStatus','stack','name','render','body','agent','map','ChatInteraction','type','key','findAll','user','show','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','update','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooMetadata','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Sequelize','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','server/files/attachments/','join','download','close','server/files/chat/upload/','format','transcript-%s.txt','User','ContactId','agentAlias','System','customer','%s%d','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','setTags','spread','color','emit','chatInteractionTags:save','unix','toString','root','server','files','attachments','push','fullname','lastName','Messages','secret','read','Account','Owner','get','Chat','closedAt','disposition','browserName','osName','referer','customerIp'];(function(_0x23677a,_0x5e98a1){var _0x3a8969=function(_0x2dc233){while(--_0x2dc233){_0x23677a['push'](_0x23677a['shift']());}};_0x3a8969(++_0x5e98a1);}(_0xb7d7,0xd4));var _0x7b7d=function(_0x45231c,_0x1610a8){_0x45231c=_0x45231c-0x0;var _0x5481b1=_0xb7d7[_0x45231c];return _0x5481b1;};'use strict';var rimraf=require(_0x7b7d('0x0'));var zipdir=require(_0x7b7d('0x1'));var rp=require('request-promise');var moment=require(_0x7b7d('0x2'));var BPromise=require(_0x7b7d('0x3'));var Mustache=require(_0x7b7d('0x4'));var util=require(_0x7b7d('0x5'));var path=require('path');var ejs=require(_0x7b7d('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x7b7d('0x7'));var qs=require(_0x7b7d('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x7b7d('0x9'))(_0x7b7d('0xa'));var config=require(_0x7b7d('0xb'));var db=require(_0x7b7d('0xc'))['db'];config[_0x7b7d('0xd')]=_[_0x7b7d('0xe')](config['redis'],{'host':_0x7b7d('0xf'),'port':0x18eb});var socket=require(_0x7b7d('0x10'))(new Redis(config[_0x7b7d('0xd')]));require(_0x7b7d('0x11'))['register'](socket);var jayson=require(_0x7b7d('0x12'));var client=jayson[_0x7b7d('0x13')][_0x7b7d('0x14')]({'port':0x232b});var client9004=jayson[_0x7b7d('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x189a53,_0x522be9,_0x11b27f,_0x453d03){return new BPromise(function(_0x3306d7,_0x30f541){var _0x3bdb33=_0x453d03||client;return _0x3bdb33[_0x7b7d('0x15')](_0x189a53,_0x11b27f)['then'](function(_0x253a6f){logger[_0x7b7d('0x16')](_0x7b7d('0x17'),_0x522be9,_0x7b7d('0x18'));logger[_0x7b7d('0x19')](_0x7b7d('0x1a'),_0x522be9,_0x7b7d('0x18'),JSON['stringify'](_0x253a6f));if(_0x253a6f[_0x7b7d('0x1b')]){if(_0x253a6f[_0x7b7d('0x1b')]['code']===0x1f4){logger['error'](_0x7b7d('0x17'),_0x522be9,_0x253a6f[_0x7b7d('0x1b')][_0x7b7d('0x1c')]);return _0x30f541(_0x253a6f[_0x7b7d('0x1b')][_0x7b7d('0x1c')]);}logger[_0x7b7d('0x1b')](_0x7b7d('0x17'),_0x522be9,_0x253a6f[_0x7b7d('0x1b')]['message']);return _0x3306d7(_0x253a6f[_0x7b7d('0x1b')][_0x7b7d('0x1c')]);}else{logger[_0x7b7d('0x16')](_0x7b7d('0x17'),_0x522be9,_0x7b7d('0x18'));_0x3306d7(_0x253a6f[_0x7b7d('0x1d')][_0x7b7d('0x1c')]);}})[_0x7b7d('0x1e')](function(_0x375f2c){logger[_0x7b7d('0x1b')](_0x7b7d('0x17'),_0x522be9,_0x375f2c);_0x30f541(_0x375f2c);});});}function respondWithStatusCode(_0x7e3df7,_0x3455fa){_0x3455fa=_0x3455fa||0xcc;return function(_0x108bf1){if(_0x108bf1){return _0x7e3df7['sendStatus'](_0x3455fa);}return _0x7e3df7[_0x7b7d('0x1f')](_0x3455fa)[_0x7b7d('0x20')]();};}function respondWithResult(_0x234f3c,_0x453dc9){_0x453dc9=_0x453dc9||0xc8;return function(_0x15494c){if(_0x15494c){return _0x234f3c[_0x7b7d('0x1f')](_0x453dc9)[_0x7b7d('0x21')](_0x15494c);}};}function respondWithFilteredResult(_0x59282a,_0x2d85d9){return function(_0xe91dd3){if(_0xe91dd3){var _0x435f73=typeof _0x2d85d9[_0x7b7d('0x22')]===_0x7b7d('0x23')&&typeof _0x2d85d9['limit']===_0x7b7d('0x23');var _0x17bc53=_0xe91dd3[_0x7b7d('0x24')];var _0x2c5457=_0x435f73?0x0:_0x2d85d9[_0x7b7d('0x22')];var _0x508c47=_0x435f73?_0xe91dd3[_0x7b7d('0x24')]:_0x2d85d9[_0x7b7d('0x22')]+_0x2d85d9[_0x7b7d('0x25')];var _0x368582;if(_0x508c47>=_0x17bc53){_0x508c47=_0x17bc53;_0x368582=0xc8;}else{_0x368582=0xce;}_0x59282a[_0x7b7d('0x1f')](_0x368582);return _0x59282a[_0x7b7d('0x26')](_0x7b7d('0x27'),_0x2c5457+'-'+_0x508c47+'/'+_0x17bc53)[_0x7b7d('0x21')](_0xe91dd3);}return null;};}function saveUpdates(_0x5f5482){return function(_0x3ca59c){if(_0x3ca59c){return _0x3ca59c['update'](_0x5f5482)[_0x7b7d('0x28')](function(_0x51d781){return _0x51d781;});}return null;};}function removeEntity(_0x163357){return function(_0x450c8b){if(_0x450c8b){return _0x450c8b[_0x7b7d('0x29')]()[_0x7b7d('0x28')](function(){_0x163357[_0x7b7d('0x1f')](0xcc)[_0x7b7d('0x20')]();});}};}function handleEntityNotFound(_0x17e6a7){return function(_0x80bd08){if(!_0x80bd08){_0x17e6a7[_0x7b7d('0x2a')](0x194);}return _0x80bd08;};}function handleError(_0x5a22c7,_0x106eaf){_0x106eaf=_0x106eaf||0x1f4;return function(_0x5209a6){logger[_0x7b7d('0x1b')](_0x5209a6[_0x7b7d('0x2b')]);if(_0x5209a6[_0x7b7d('0x2c')]){delete _0x5209a6['name'];}_0x5a22c7[_0x7b7d('0x1f')](_0x106eaf)['send'](_0x5209a6);};}function getMustacheRender(_0x407c95,_0x40f5dc){return Mustache[_0x7b7d('0x2d')](_0x407c95,_['merge'](_0x40f5dc[_0x7b7d('0x2e')],{'contact':_0x40f5dc['contact'],'message':_0x40f5dc[_0x7b7d('0x1c')],'agent':_0x40f5dc[_0x7b7d('0x2f')],'interaction':_0x40f5dc['interaction'],'account':_0x40f5dc['account']}))||'';}exports['index']=function(_0x45bddd,_0xa2d6ec){var _0x331fc5={};var _0x339e77=_[_0x7b7d('0x30')](db[_0x7b7d('0x31')]['rawAttributes'],function(_0x83dadd){return{'name':_0x83dadd['fieldName'],'type':_0x83dadd[_0x7b7d('0x32')][_0x7b7d('0x33')]};});_0x331fc5=qs['getOptions'](_0x339e77,_0x45bddd);return interaction[_0x7b7d('0x34')]('chat',_0x45bddd['query'],_0x45bddd[_0x7b7d('0x35')],_0x331fc5,_0x339e77)[_0x7b7d('0x28')](respondWithFilteredResult(_0xa2d6ec,_0x331fc5))[_0x7b7d('0x1e')](handleError(_0xa2d6ec,null));};exports[_0x7b7d('0x36')]=function(_0x4e4f9f,_0x24011e){var _0x4686b6={'raw':![],'where':{'id':_0x4e4f9f[_0x7b7d('0x37')]['id']}},_0x18bf5f={};_0x18bf5f[_0x7b7d('0x38')]=_[_0x7b7d('0x39')](db[_0x7b7d('0x31')][_0x7b7d('0x3a')]);_0x18bf5f[_0x7b7d('0x3b')]=_['keys'](_0x4e4f9f[_0x7b7d('0x3b')]);_0x18bf5f[_0x7b7d('0x3c')]=_['intersection'](_0x18bf5f['model'],_0x18bf5f['query']);_0x4686b6[_0x7b7d('0x3d')]=_[_0x7b7d('0x3e')](_0x18bf5f[_0x7b7d('0x38')],qs[_0x7b7d('0x3f')](_0x4e4f9f[_0x7b7d('0x3b')][_0x7b7d('0x3f')]));_0x4686b6[_0x7b7d('0x3d')]=_0x4686b6['attributes'][_0x7b7d('0x40')]?_0x4686b6[_0x7b7d('0x3d')]:_0x18bf5f[_0x7b7d('0x38')];if(_0x4e4f9f[_0x7b7d('0x3b')][_0x7b7d('0x41')]){_0x4686b6[_0x7b7d('0x42')]=[{'all':!![]}];}_0x4686b6=_[_0x7b7d('0x43')]({},_0x4686b6,_0x4e4f9f[_0x7b7d('0x44')]);return db[_0x7b7d('0x31')][_0x7b7d('0x45')](_0x4686b6)[_0x7b7d('0x28')](handleEntityNotFound(_0x24011e,null))[_0x7b7d('0x28')](respondWithResult(_0x24011e,null))[_0x7b7d('0x1e')](handleError(_0x24011e,null));};exports[_0x7b7d('0x46')]=function(_0x183143,_0x510d43){return db['ChatInteraction']['create'](_0x183143[_0x7b7d('0x2e')],{})[_0x7b7d('0x28')](respondWithResult(_0x510d43,0xc9))[_0x7b7d('0x1e')](handleError(_0x510d43,null));};exports[_0x7b7d('0x47')]=function(_0xd43aa1,_0x39ab2a){if(_0xd43aa1[_0x7b7d('0x2e')]['id']){delete _0xd43aa1['body']['id'];}return db[_0x7b7d('0x31')][_0x7b7d('0x45')]({'where':{'id':_0xd43aa1[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x39ab2a,null))['then'](saveUpdates(_0xd43aa1['body'],null))['then'](respondWithResult(_0x39ab2a,null))[_0x7b7d('0x1e')](handleError(_0x39ab2a,null));};exports[_0x7b7d('0x29')]=function(_0x3037f2,_0x5cab49){return db[_0x7b7d('0x31')][_0x7b7d('0x45')]({'where':{'id':_0x3037f2[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x5cab49,null))['then'](removeEntity(_0x5cab49,null))['catch'](handleError(_0x5cab49,null));};exports[_0x7b7d('0x48')]=function(_0x53974e,_0x526187){return db['ChatInteraction'][_0x7b7d('0x48')]()['then'](respondWithResult(_0x526187,null))[_0x7b7d('0x1e')](handleError(_0x526187,null));};exports['createVidaooSession']=function(_0x5e443e,_0x2569a1){var _0x5301af=_0x5e443e['params']['id'];var _0x23d2a3;var _0x5d0435;var _0x481e84;return db['ChatInteraction'][_0x7b7d('0x49')]({'where':{'id':_0x5301af}})[_0x7b7d('0x28')](function(_0x54b6df){_0x23d2a3=_0x54b6df;return db[_0x7b7d('0x4a')][_0x7b7d('0x49')]({'where':{'id':_0x54b6df[_0x7b7d('0x4b')]},'attributes':['id',_0x7b7d('0x4c'),_0x7b7d('0x4d'),_0x7b7d('0x4e'),_0x7b7d('0x4f'),'vidaooMetadata'],'raw':!![]});})[_0x7b7d('0x28')](function(_0x4ae9ac){if(_0x4ae9ac&&_0x4ae9ac[_0x7b7d('0x4c')]&&_0x4ae9ac[_0x7b7d('0x4d')]){_0x5d0435=_0x4ae9ac;var _0x205616={'interaction':{'id':_0x5301af},'agent':{'id':_0x5e443e[_0x7b7d('0x35')]['id'],'name':_0x5e443e[_0x7b7d('0x35')][_0x7b7d('0x2c')],'fullname':_0x5e443e[_0x7b7d('0x35')]['fullname'],'email':_0x5e443e[_0x7b7d('0x35')][_0x7b7d('0x50')]},'contact':_0x5e443e[_0x7b7d('0x2e')][_0x7b7d('0x51')],'account':_0x5e443e[_0x7b7d('0x2e')][_0x7b7d('0x52')]};var _0x31dd9c={'rejectUnauthorized':![],'method':_0x7b7d('0x53'),'url':_0x7b7d('0x54'),'headers':{'X-APIKEY':_0x4ae9ac['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5e443e[_0x7b7d('0x35')][_0x7b7d('0x50')]],'buttons':null,'topic':_0x5d0435[_0x7b7d('0x4e')],'note':_['isNull'](_0x5d0435['vidaooNote'])?null:getMustacheRender(_0x5d0435['vidaooNote'],_0x205616),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x7b7d('0x55')](_0x5d0435[_0x7b7d('0x56')])){var _0x4f7fec=getMustacheRender(_0x5d0435[_0x7b7d('0x56')],_0x205616);var _0xd48e06=JSON[_0x7b7d('0x57')](_0x4f7fec);_0x31dd9c[_0x7b7d('0x2e')][_0x7b7d('0x58')]=_0xd48e06;}}catch(_0x48b6c3){throw new db['Sequelize']['ValidationError'](_0x7b7d('0x59'));}return rp(_0x31dd9c);}else{throw new db['Sequelize'][(_0x7b7d('0x5a'))](_0x7b7d('0x5b'));}})[_0x7b7d('0x28')](function(_0x86b851){_0x481e84=_0x86b851;if(_0x481e84['id']){var _0x46c782={'body':_0x481e84['join_url'],'ChatWebsiteId':_0x5d0435['id'],'ChatInteractionId':_0x23d2a3['id'],'direction':'out','UserId':_0x5e443e[_0x7b7d('0x35')]['id']};return db[_0x7b7d('0x5c')][_0x7b7d('0x46')](_0x46c782,{});}else{throw new db['Sequelize'][(_0x7b7d('0x5a'))](_0x7b7d('0x5d'));}})[_0x7b7d('0x28')](function(){return _0x23d2a3[_0x7b7d('0x5e')]({'vidaooSessionId':_0x481e84['id']});})[_0x7b7d('0x28')](respondWithResult(_0x2569a1,null))['catch'](handleError(_0x2569a1,null));};exports[_0x7b7d('0x5f')]=function(_0x45a077,_0x5dd48f){if(_0x45a077[_0x7b7d('0x2e')]['id']){delete _0x45a077[_0x7b7d('0x2e')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x45a077[_0x7b7d('0x37')]['id']},'include':[{'model':db[_0x7b7d('0x60')],'as':_0x7b7d('0x61')}]})[_0x7b7d('0x28')](handleEntityNotFound(_0x5dd48f,null))['then'](saveUpdates(_0x45a077['body'],null))[_0x7b7d('0x28')](respondWithResult(_0x5dd48f,null))[_0x7b7d('0x1e')](handleError(_0x5dd48f,null));};exports[_0x7b7d('0x62')]=function(_0x34c969,_0x1da821){if(_0x34c969[_0x7b7d('0x2e')]['id']){delete _0x34c969[_0x7b7d('0x2e')]['id'];}return db[_0x7b7d('0x31')][_0x7b7d('0x45')]({'where':{'id':_0x34c969[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](function(_0x32d9f2){if(!_0x32d9f2){logger[_0x7b7d('0x1b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x7b7d('0x62'),0x194,_0x7b7d('0x63'));_0x1da821[_0x7b7d('0x2a')](0x194);}else{if(_0x32d9f2[_0x7b7d('0x64')]){throw new db[(_0x7b7d('0x65'))][(_0x7b7d('0x5a'))](_0x7b7d('0x66'));}}return _0x32d9f2;})[_0x7b7d('0x28')](function(_0x5efb4f){if(_0x5efb4f){return _0x5efb4f[_0x7b7d('0x47')]({'closed':_0x34c969[_0x7b7d('0x2e')][_0x7b7d('0x67')],'disposition':_0x34c969[_0x7b7d('0x2e')]['disposition']})[_0x7b7d('0x28')](function(_0xd4a500){return _0xd4a500;});}})['then'](function(){return respondWithRpcPromise(_0x7b7d('0x68'),_0x7b7d('0x62'),_0x34c969[_0x7b7d('0x2e')],client9004);})[_0x7b7d('0x28')](respondWithResult(_0x1da821,null))[_0x7b7d('0x1e')](handleError(_0x1da821,null));};exports[_0x7b7d('0x69')]=function(_0x20b9d4,_0x3f739e){_0x20b9d4[_0x7b7d('0x2e')][_0x7b7d('0x2c')]=_0x20b9d4['file'][_0x7b7d('0x6a')];_0x20b9d4[_0x7b7d('0x2e')][_0x7b7d('0x6b')]=_0x20b9d4[_0x7b7d('0x6c')][_0x7b7d('0x6d')];_0x20b9d4[_0x7b7d('0x2e')]['type']=_0x20b9d4[_0x7b7d('0x6c')]['mimetype'];return db[_0x7b7d('0x6e')][_0x7b7d('0x46')](_0x20b9d4['body'])[_0x7b7d('0x28')](respondWithResult(_0x3f739e,0xc9))['catch'](handleError(_0x3f739e,null));};exports[_0x7b7d('0x6f')]=function(_0xddea6,_0x5d92bb){return db['ChatInteraction'][_0x7b7d('0x49')]({'where':{'id':_0xddea6['params']['id']},'raw':!![]})[_0x7b7d('0x28')](handleEntityNotFound(_0x5d92bb,null))['then'](function(_0x4a9af9){if(_0x4a9af9){if(_0x4a9af9[_0x7b7d('0x67')]){return _0x5d92bb['status'](0x193)[_0x7b7d('0x21')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment']['findOne']({'where':{'id':_0xddea6['query'][_0x7b7d('0x70')]},'raw':!![]})['then'](handleEntityNotFound(_0x5d92bb,null));}})[_0x7b7d('0x28')](function(_0x2c06bb){if(_0x2c06bb){var _0x3f793c=_0x2c06bb[_0x7b7d('0x71')]!==null;var _0x327503=path['join'](config['root'],_0x7b7d('0x72'));if(_0x3f793c){_0x327503=path[_0x7b7d('0x73')](_0x327503,'offline-chat/');}var _0x383ea0=path[_0x7b7d('0x73')](_0x327503,_0x2c06bb[_0x7b7d('0x6b')]);return _0x5d92bb[_0x7b7d('0x74')](_0x383ea0);}})[_0x7b7d('0x1e')](handleError(_0x5d92bb,null));};exports[_0x7b7d('0x75')]=function(_0x434b73,_0x35887f){var _0x51fa77=null;var _0x4321ca=null;var _0x250ed4=null;if(_0x434b73[_0x7b7d('0x2e')]['id']){delete _0x434b73['body']['id'];}if(_0x434b73['body']['mailTranscript']){_0x250ed4=path[_0x7b7d('0x73')](config['root'],_0x7b7d('0x76'),util[_0x7b7d('0x77')](_0x7b7d('0x78'),Date['now']()));_0x434b73[_0x7b7d('0x2e')]['pathTranscript']=_0x250ed4;}return db[_0x7b7d('0x31')]['find']({'where':{'id':_0x434b73['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x7b7d('0x79')],'as':_0x7b7d('0x79')}]}]})['then'](handleEntityNotFound(_0x35887f,null))['then'](saveUpdates(_0x434b73[_0x7b7d('0x2e')],null))[_0x7b7d('0x28')](function(_0x2aaea9){if(_0x2aaea9){_0x51fa77=_0x2aaea9;return db[_0x7b7d('0x4a')][_0x7b7d('0x45')]({'where':{'id':_0x51fa77[_0x7b7d('0x4b')]}});}})[_0x7b7d('0x28')](function(_0x5c0a45){if(_0x5c0a45){_0x4321ca=_0x5c0a45;return db[_0x7b7d('0x60')]['find']({'where':{'id':_0x51fa77[_0x7b7d('0x7a')]}});}})[_0x7b7d('0x28')](function(_0x5c2e3e){if(_0x5c2e3e){if(_0x250ed4){var _0x1ca989=null;for(var _0x20f9c9=0x1;_0x20f9c9<_0x51fa77['Messages'][_0x7b7d('0x40')];++_0x20f9c9){_0x1ca989=_0x51fa77['Messages'][_0x20f9c9];var _0x5d5dec=_0x1ca989[_0x7b7d('0x64')]?util[_0x7b7d('0x77')]('%s%d',_0x4321ca[_0x7b7d('0x7b')],_0x1ca989['UserId']):_0x7b7d('0x7c');var _0x3e3110=_0x434b73['body'][_0x7b7d('0x7d')]||util[_0x7b7d('0x77')](_0x7b7d('0x7e'),_0x7b7d('0x7f'),_0x1ca989[_0x7b7d('0x7a')]);switch(_0x4321ca['agentIdentifier']){case _0x7b7d('0x80'):_0x5d5dec=_0x1ca989[_0x7b7d('0x64')]?util['format'](_0x7b7d('0x7e'),_0x4321ca[_0x7b7d('0x7b')],_0x1ca989[_0x7b7d('0x64')]):_0x7b7d('0x7c');break;case _0x7b7d('0x81'):_0x5d5dec=_0x1ca989[_0x7b7d('0x64')]?_0x1ca989['User'][_0x7b7d('0x82')]||_0x1ca989[_0x7b7d('0x79')]['fullname']:'System';break;case _0x7b7d('0x83'):_0x5d5dec=_0x1ca989['UserId']?_0x1ca989['User']['fullname']:'System';break;default:_0x5d5dec=_0x1ca989['UserId']?util[_0x7b7d('0x77')]('%s%d',_0x4321ca[_0x7b7d('0x7b')],_0x1ca989['UserId']):_0x7b7d('0x7c');}var _0x58826c=util[_0x7b7d('0x77')](_0x7b7d('0x84'),moment(_0x1ca989[_0x7b7d('0x85')])[_0x7b7d('0x77')](_0x7b7d('0x86')),_0x1ca989[_0x7b7d('0x87')]==='in'?_0x3e3110:_0x5d5dec,_0x1ca989[_0x7b7d('0x2e')]);if(!_0x1ca989['secret']){fs[_0x7b7d('0x88')](_0x250ed4,_0x58826c);}}return db[_0x7b7d('0x89')][_0x7b7d('0x49')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x7b7d('0x8a'),'raw':!![],'include':[{'model':db[_0x7b7d('0x8b')],'as':_0x7b7d('0x8b'),'raw':!![]}]}]});}}})[_0x7b7d('0x28')](function(_0x3a34ab){if(!_0x3a34ab||!_0x3a34ab['Smtp']||!_0x434b73[_0x7b7d('0x2e')])return _0x51fa77;var _0x45e386=_0x3a34ab[_0x7b7d('0x8c')]();return respondWithRpcPromise(_0x7b7d('0x8d'),'sendMail',{'account':_0x45e386,'message':{'from':util[_0x7b7d('0x77')](_0x7b7d('0x8e'),_0x3a34ab[_0x7b7d('0x2c')],_0x3a34ab[_0x7b7d('0x50')]||_0x3a34ab[_0x7b7d('0x8a')][_0x7b7d('0x35')]),'to':_0x434b73[_0x7b7d('0x2e')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x7b7d('0x77')](_0x7b7d('0x8f'),_0x434b73[_0x7b7d('0x2e')]['mailTranscript']),'attachments':[{'path':_0x250ed4}]}})[_0x7b7d('0x28')](function(){return _0x51fa77;})['catch'](function(_0x2f1c94){logger[_0x7b7d('0x1b')](_0x2f1c94);});})[_0x7b7d('0x28')](respondWithStatusCode(_0x35887f,0xc8))['catch'](handleError(_0x35887f,null));};exports[_0x7b7d('0x90')]=function(_0x287455,_0x300712){return db[_0x7b7d('0x5c')][_0x7b7d('0x45')]({'where':{'id':_0x287455[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x300712,null))[_0x7b7d('0x28')](function(_0x41c186){if(_0x41c186){return _0x41c186[_0x7b7d('0x90')](_0x287455[_0x7b7d('0x2e')][_0x7b7d('0x91')],_[_0x7b7d('0x92')](_0x287455['body'],['ids','id'])||{});}})[_0x7b7d('0x28')](respondWithResult(_0x300712,null))[_0x7b7d('0x1e')](handleError(_0x300712,null));};exports[_0x7b7d('0x93')]=function(_0x477e9e,_0x122891){var _0x11cf09={'raw':![],'where':{}};var _0x26642f={};var _0x148e26={'count':0x0,'rows':[]};return db[_0x7b7d('0x31')][_0x7b7d('0x49')]({'where':{'id':_0x477e9e[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x122891,null))[_0x7b7d('0x28')](function(_0xaa43c0){if(_0xaa43c0){_0x26642f['model']=_[_0x7b7d('0x39')](db[_0x7b7d('0x5c')]['rawAttributes']);_0x26642f[_0x7b7d('0x3b')]=_[_0x7b7d('0x39')](_0x477e9e['query']);_0x26642f[_0x7b7d('0x3c')]=_[_0x7b7d('0x3e')](_0x26642f[_0x7b7d('0x38')],_0x26642f[_0x7b7d('0x3b')]);_0x11cf09[_0x7b7d('0x3d')]=_['intersection'](_0x26642f[_0x7b7d('0x38')],qs[_0x7b7d('0x3f')](_0x477e9e[_0x7b7d('0x3b')][_0x7b7d('0x3f')]));_0x11cf09[_0x7b7d('0x3d')]=_0x11cf09[_0x7b7d('0x3d')][_0x7b7d('0x40')]?_0x11cf09[_0x7b7d('0x3d')]:_0x26642f[_0x7b7d('0x38')];if(!_0x477e9e[_0x7b7d('0x3b')][_0x7b7d('0x94')](_0x7b7d('0x95'))){_0x11cf09[_0x7b7d('0x25')]=qs[_0x7b7d('0x25')](_0x477e9e[_0x7b7d('0x3b')][_0x7b7d('0x25')]);_0x11cf09[_0x7b7d('0x22')]=qs[_0x7b7d('0x22')](_0x477e9e['query']['offset']);}_0x11cf09[_0x7b7d('0x96')]=qs[_0x7b7d('0x97')](_0x477e9e[_0x7b7d('0x3b')][_0x7b7d('0x97')]);_0x11cf09['where']=qs['filters'](_[_0x7b7d('0x98')](_0x477e9e['query'],_0x26642f[_0x7b7d('0x3c')]));_0x11cf09[_0x7b7d('0x99')][_0x7b7d('0x9a')]=_0xaa43c0['id'];if(_0x477e9e['query']['filter']){_0x11cf09[_0x7b7d('0x99')]=_[_0x7b7d('0x43')](_0x11cf09[_0x7b7d('0x99')],{'$or':_['map'](_0x11cf09[_0x7b7d('0x3d')],function(_0x810420){var _0x183554={};_0x183554[_0x810420]={'$like':'%'+_0x477e9e[_0x7b7d('0x3b')][_0x7b7d('0x9b')]+'%'};return _0x183554;})});}if(_0x477e9e[_0x7b7d('0x3b')]['$gte']){var _0x934eef=_0x477e9e[_0x7b7d('0x3b')][_0x7b7d('0x9c')][_0x7b7d('0x9d')](',');var _0x253d03={};_0x253d03[_0x934eef[0x0]]={'$gte':moment(_0x934eef[0x1])['format'](_0x7b7d('0x9e'))};_0x11cf09[_0x7b7d('0x99')]=_[_0x7b7d('0x43')](_0x11cf09[_0x7b7d('0x99')],_0x253d03);}_0x11cf09=_[_0x7b7d('0x43')]({},_0x11cf09,_0x477e9e[_0x7b7d('0x44')]);return db['ChatMessage'][_0x7b7d('0x24')]({'where':_0x11cf09['where']})[_0x7b7d('0x28')](function(_0x42adb7){_0x148e26[_0x7b7d('0x24')]=_0x42adb7;if(_0x477e9e['query'][_0x7b7d('0x41')]){_0x11cf09[_0x7b7d('0x42')]=[{'all':!![]}];}return db[_0x7b7d('0x5c')][_0x7b7d('0x34')](_0x11cf09);})['then'](function(_0x5b051){_0x148e26[_0x7b7d('0x9f')]=_0x5b051;return _0x148e26;});}})[_0x7b7d('0x28')](respondWithFilteredResult(_0x122891,_0x11cf09))[_0x7b7d('0x1e')](handleError(_0x122891,null));};exports[_0x7b7d('0xa0')]=function(_0x2f0660,_0x8bfc47){var _0x3812ec={'where':{}},_0x210745={},_0x52edd1={'count':0x0,'rows':[]};return db[_0x7b7d('0x31')][_0x7b7d('0x49')]({'where':{'id':_0x2f0660[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x8bfc47,null))[_0x7b7d('0x28')](function(_0x362332){if(_0x362332){_0x210745['model']=_['keys'](db['ChatMessage'][_0x7b7d('0x3a')]);_0x210745[_0x7b7d('0x3b')]=_[_0x7b7d('0x39')](_0x2f0660['query']);_0x210745['filters']=_['intersection'](_0x210745[_0x7b7d('0x38')],_0x210745[_0x7b7d('0x3b')]);_0x3812ec[_0x7b7d('0x3d')]=_[_0x7b7d('0x3e')](_0x210745[_0x7b7d('0x38')],qs[_0x7b7d('0x3f')](_0x2f0660[_0x7b7d('0x3b')][_0x7b7d('0x3f')]));_0x3812ec['attributes']=_0x3812ec[_0x7b7d('0x3d')][_0x7b7d('0x40')]?_0x3812ec[_0x7b7d('0x3d')]:_0x210745[_0x7b7d('0x38')];if(!_0x2f0660[_0x7b7d('0x3b')]['hasOwnProperty']('nolimit')){_0x3812ec[_0x7b7d('0x25')]=qs['limit'](_0x2f0660[_0x7b7d('0x3b')][_0x7b7d('0x25')]);_0x3812ec[_0x7b7d('0x22')]=qs['offset'](_0x2f0660['query']['offset']);}_0x3812ec[_0x7b7d('0x96')]=qs['sort'](_0x2f0660['query']['sort']);_0x3812ec[_0x7b7d('0x99')]=qs[_0x7b7d('0x3c')](_[_0x7b7d('0x98')](_0x2f0660[_0x7b7d('0x3b')],_0x210745[_0x7b7d('0x3c')]));_0x3812ec['where']['ChatInteractionId']=_0x362332['id'];if(_0x2f0660[_0x7b7d('0x3b')]['filter']){_0x3812ec[_0x7b7d('0x99')]=_[_0x7b7d('0x43')](_0x3812ec[_0x7b7d('0x99')],{'$or':_[_0x7b7d('0x30')](_0x3812ec[_0x7b7d('0x3d')],function(_0x499e8b){var _0xa4d7eb={};_0xa4d7eb[_0x499e8b]={'$like':'%'+_0x2f0660[_0x7b7d('0x3b')][_0x7b7d('0x9b')]+'%'};return _0xa4d7eb;})});}_0x3812ec['where']['secret']=![];if(_0x2f0660[_0x7b7d('0x3b')]['id']){_0x3812ec[_0x7b7d('0x99')]['id']={'$gt':_0x2f0660[_0x7b7d('0x3b')]['id']};}_0x3812ec=_['merge']({},_0x3812ec,_0x2f0660[_0x7b7d('0x44')]);return db[_0x7b7d('0x5c')][_0x7b7d('0x24')]({'where':_0x3812ec[_0x7b7d('0x99')]})['then'](function(_0x11092b){_0x52edd1[_0x7b7d('0x24')]=_0x11092b;_0x3812ec[_0x7b7d('0x42')]=[];if(_0x2f0660[_0x7b7d('0x3b')]['includeAgent']){_0x3812ec[_0x7b7d('0x42')]['push']({'model':db['User'],'as':_0x7b7d('0x79'),'attributes':['id','fullname',_0x7b7d('0x82')]});}if(_0x2f0660['query']['includeAll']){_0x3812ec[_0x7b7d('0x42')]=[{'all':!![]}];}return db[_0x7b7d('0x5c')]['findAll'](_0x3812ec);})['then'](function(_0x37c357){_0x52edd1[_0x7b7d('0x9f')]=_0x37c357;return _0x52edd1;});}})[_0x7b7d('0x28')](respondWithFilteredResult(_0x8bfc47,_0x3812ec))[_0x7b7d('0x1e')](handleError(_0x8bfc47,null));};exports['addTags']=function(_0x142f05,_0x4ee027){return db['ChatInteraction']['find']({'where':{'id':_0x142f05[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x4ee027,null))[_0x7b7d('0x28')](function(_0x6f82be){if(_0x6f82be){return _0x6f82be[_0x7b7d('0xa1')](_0x142f05[_0x7b7d('0x2e')][_0x7b7d('0x91')],_[_0x7b7d('0x92')](_0x142f05[_0x7b7d('0x2e')],[_0x7b7d('0x91'),'id'])||{})[_0x7b7d('0xa2')](function(){return db['Tag'][_0x7b7d('0x34')]({'attributes':['id',_0x7b7d('0x2c'),_0x7b7d('0xa3')],'where':{'id':_0x142f05[_0x7b7d('0x2e')][_0x7b7d('0x91')]}});})[_0x7b7d('0x28')](function(_0x23acbd){socket[_0x7b7d('0xa4')](_0x7b7d('0xa5'),{'id':Number(_0x142f05[_0x7b7d('0x37')]['id']),'tags':_0x23acbd||[]});return{'id':Number(_0x142f05[_0x7b7d('0x37')]['id']),'tags':_0x23acbd||[]};});}})[_0x7b7d('0x28')](respondWithResult(_0x4ee027,null))[_0x7b7d('0x1e')](handleError(_0x4ee027,null));};exports['removeTags']=function(_0x1af421,_0x3dd452){return db[_0x7b7d('0x31')][_0x7b7d('0x45')]({'where':{'id':_0x1af421[_0x7b7d('0x37')]['id']}})[_0x7b7d('0x28')](handleEntityNotFound(_0x3dd452,null))['then'](function(_0x427c3e){if(_0x427c3e){return _0x427c3e['removeTags'](_0x1af421['query']['ids']);}})['then'](respondWithStatusCode(_0x3dd452,null))[_0x7b7d('0x1e')](handleError(_0x3dd452,null));};exports[_0x7b7d('0x74')]=function(_0x4e36c9,_0x489e5a){var _0x4587f1=moment()[_0x7b7d('0xa6')]()[_0x7b7d('0xa7')]();var _0x4dbccf=path[_0x7b7d('0x73')](config[_0x7b7d('0xa8')],_0x7b7d('0xa9'),_0x7b7d('0xaa'),'tmp');var _0x53f279=path[_0x7b7d('0x73')](config[_0x7b7d('0xa8')],_0x7b7d('0xa9'),_0x7b7d('0xaa'),_0x7b7d('0xab'));var _0x488386=path[_0x7b7d('0x73')](_0x4dbccf,_0x4587f1);var _0x32bc47=util[_0x7b7d('0x77')]('transcript-%d-%s.zip',_0x4e36c9[_0x7b7d('0x37')]['id'],_0x4587f1);var _0x5791bc=path[_0x7b7d('0x73')](_0x4dbccf,_0x32bc47);var _0x2336a1=[];_0x2336a1[_0x7b7d('0xac')]({'model':db[_0x7b7d('0x79')],'as':'User','attributes':['id',_0x7b7d('0xad')],'raw':!![]});_0x2336a1[_0x7b7d('0xac')]({'model':db['CmContact'],'as':_0x7b7d('0x61'),'attributes':['id','firstName',_0x7b7d('0xae')],'raw':!![]});if(_0x4e36c9['query'][_0x7b7d('0xab')]){_0x2336a1[_0x7b7d('0xac')]({'model':db[_0x7b7d('0x6e')],'as':_0x7b7d('0x6e'),'raw':!![]});}var _0x1d61d2=[{'model':db[_0x7b7d('0x5c')],'as':_0x7b7d('0xaf'),'attributes':['id','body',_0x7b7d('0x85'),_0x7b7d('0x87'),_0x7b7d('0xb0'),_0x7b7d('0xb1')],'include':_0x2336a1}];_0x1d61d2[_0x7b7d('0xac')]({'model':db['ChatWebsite'],'as':_0x7b7d('0xb2'),'attributes':['id',_0x7b7d('0x2c')]});_0x1d61d2[_0x7b7d('0xac')]({'model':db[_0x7b7d('0x79')],'as':_0x7b7d('0xb3'),'attributes':['id',_0x7b7d('0xad')]});return db[_0x7b7d('0x31')][_0x7b7d('0x45')]({'where':{'id':_0x4e36c9[_0x7b7d('0x37')]['id']},'include':_0x1d61d2})['then'](handleEntityNotFound(_0x489e5a,null))['then'](function(_0x55c73c){if(_0x55c73c){var _0x3cac80=_0x55c73c[_0x7b7d('0xb4')]({'plain':!![]});fs['mkdirSync'](_0x488386);var _0x3e4211={'channel':_0x7b7d('0xb5'),'account':_0x3cac80[_0x7b7d('0xb2')]['name'],'agent':_0x3cac80[_0x7b7d('0xb3')]?_0x3cac80[_0x7b7d('0xb3')][_0x7b7d('0xad')]:'N.A.','createdAt':moment(_0x3cac80[_0x7b7d('0x85')])['format'](_0x7b7d('0x9e'))[_0x7b7d('0xa7')](),'closedAt':_0x3cac80['closed']?moment(_0x3cac80[_0x7b7d('0xb6')])[_0x7b7d('0x77')](_0x7b7d('0x9e'))[_0x7b7d('0xa7')]():'','disposition':_0x3cac80[_0x7b7d('0xb7')],'chatInfo':{'browser':_0x3cac80[_0x7b7d('0xb8')],'os':_0x3cac80[_0x7b7d('0xb9')],'referer':_0x3cac80[_0x7b7d('0xba')],'customerIp':_0x3cac80[_0x7b7d('0xbb')],'customerPort':_0x3cac80['customerPort']?_0x3cac80['customerPort']:_0x7b7d('0xbc')},'messages':_(_0x3cac80['Messages'])['tail']()[_0x7b7d('0x9b')]({'secret':![]})['map'](function(_0x564088){if(_0x564088[_0x7b7d('0x6e')]){var _0x56a72d=path['join'](_0x53f279,_0x564088[_0x7b7d('0x6e')][_0x7b7d('0x6b')]);if(fs[_0x7b7d('0xbd')](_0x56a72d)){fs['createReadStream'](_0x56a72d)[_0x7b7d('0xbe')](fs[_0x7b7d('0xbf')](path['join'](_0x488386,_0x564088[_0x7b7d('0x6e')]['basename'])));}}return{'date':moment(_0x564088['createdAt'])[_0x7b7d('0x77')](_0x7b7d('0x9e'))[_0x7b7d('0xa7')](),'sender':_0x564088['direction']===_0x7b7d('0xc0')?_0x564088[_0x7b7d('0x79')]?_0x564088[_0x7b7d('0x79')][_0x7b7d('0xad')]:'System':_0x564088[_0x7b7d('0x61')]['firstName']+(_0x564088[_0x7b7d('0x61')][_0x7b7d('0xae')]?'\x20'+_0x564088[_0x7b7d('0x61')]['lastName']:''),'body':_0x564088[_0x7b7d('0x6e')]?_0x564088[_0x7b7d('0x6e')][_0x7b7d('0x6b')]:_0x564088[_0x7b7d('0x2e')],'direction':_0x564088['direction']===_0x7b7d('0xc0')?'A':'C','secret':_0x564088[_0x7b7d('0xb0')],'read':_0x564088['read'],'attachment':_0x564088['Attachment']};})[_0x7b7d('0xc1')]()};return ejs['renderFile'](path[_0x7b7d('0x73')](config[_0x7b7d('0xa8')],'server',_0x7b7d('0xc2'),_0x7b7d('0xc3')),{'interaction':_0x3e4211})['then'](function(_0x6cb19e){var _0x2c58f2=path[_0x7b7d('0x73')](_0x488386,'transcript-'+_0x3cac80['id']+'-'+_0x4587f1+_0x7b7d('0xc4'));var _0x1de930={'path':_0x2c58f2,'channel':_0x7b7d('0xb5'),'interactionId':_0x3cac80['id']};return pdf[_0x7b7d('0xc5')](_0x6cb19e,_0x1de930);})['then'](function(){return new Promise(function(_0x56580c,_0x3052f7){zipdir(_0x488386,{'saveTo':_0x5791bc},function(_0x4b5721,_0x21190b){if(_0x4b5721)return _0x3052f7(_0x4b5721);return _0x56580c(_0x21190b);});})[_0x7b7d('0x28')](function(){return new BPromise(function(_0x3128d7,_0x56ebd9){rimraf(_0x488386,function(_0x1a9943){if(_0x1a9943)_0x56ebd9(_0x1a9943);return _0x3128d7();});});})[_0x7b7d('0x28')](function(){return _0x489e5a[_0x7b7d('0x74')](_0x5791bc,_0x32bc47,function(_0x3ce239){if(_0x3ce239){logger['error'](_0x7b7d('0xc6'),_0x3ce239);}else{fs[_0x7b7d('0xc7')](_0x5791bc);}});});});}else{return _0x489e5a[_0x7b7d('0x2a')](0xc8);}})['catch'](handleError(_0x489e5a,null));}; \ No newline at end of file +var _0x89e6=['client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','render','merge','body','agent','interaction','account','map','rawAttributes','fieldName','type','getOptions','query','user','show','params','model','ChatInteraction','filters','intersection','attributes','fields','includeAll','include','options','find','create','update','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','fullname','email','contact','POST','isNull','vidaooNote','follow','vidaooMetadata','parse','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Sequelize','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','length','System','customer','%s%d','Visitor','agentIdentifier','website_alias','alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','ChatMessage','keys','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','addTags','setTags','spread','Tag','findAll','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','transcript-%d-%s.zip','Contact','lastName','push','read','Owner','mkdirSync','Chat','Account','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','value','renderFile','transcript-','.pdf','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x89e6,0x18c));var _0x689e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e6[_0x14add3];return _0x4a174f;};'use strict';var rimraf=require(_0x689e('0x0'));var zipdir=require(_0x689e('0x1'));var rp=require(_0x689e('0x2'));var moment=require(_0x689e('0x3'));var BPromise=require(_0x689e('0x4'));var Mustache=require('mustache');var util=require(_0x689e('0x5'));var path=require(_0x689e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x689e('0x7'));var Redis=require(_0x689e('0x8'));var interaction=require(_0x689e('0x9'));var qs=require(_0x689e('0xa'));var pdf=require(_0x689e('0xb'));var logger=require(_0x689e('0xc'))(_0x689e('0xd'));var config=require(_0x689e('0xe'));var db=require(_0x689e('0xf'))['db'];config[_0x689e('0x10')]=_[_0x689e('0x11')](config[_0x689e('0x10')],{'host':_0x689e('0x12'),'port':0x18eb});var socket=require(_0x689e('0x13'))(new Redis(config['redis']));require(_0x689e('0x14'))['register'](socket);var jayson=require(_0x689e('0x15'));var client=jayson[_0x689e('0x16')]['http']({'port':0x232b});var client9004=jayson[_0x689e('0x16')][_0x689e('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x353c15,_0x39fe7d,_0x4c2624,_0x11a401){return new BPromise(function(_0x2aac49,_0x493606){var _0x5a8776=_0x11a401||client;return _0x5a8776['request'](_0x353c15,_0x4c2624)[_0x689e('0x18')](function(_0x3ecc30){logger[_0x689e('0x19')](_0x689e('0x1a'),_0x39fe7d,_0x689e('0x1b'));logger[_0x689e('0x1c')](_0x689e('0x1d'),_0x39fe7d,_0x689e('0x1b'),JSON[_0x689e('0x1e')](_0x3ecc30));if(_0x3ecc30[_0x689e('0x1f')]){if(_0x3ecc30[_0x689e('0x1f')][_0x689e('0x20')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x39fe7d,_0x3ecc30[_0x689e('0x1f')][_0x689e('0x21')]);return _0x493606(_0x3ecc30[_0x689e('0x1f')]['message']);}logger[_0x689e('0x1f')](_0x689e('0x1a'),_0x39fe7d,_0x3ecc30[_0x689e('0x1f')][_0x689e('0x21')]);return _0x2aac49(_0x3ecc30[_0x689e('0x1f')][_0x689e('0x21')]);}else{logger[_0x689e('0x19')](_0x689e('0x1a'),_0x39fe7d,_0x689e('0x1b'));_0x2aac49(_0x3ecc30[_0x689e('0x22')]['message']);}})[_0x689e('0x23')](function(_0x2f4028){logger[_0x689e('0x1f')](_0x689e('0x1a'),_0x39fe7d,_0x2f4028);_0x493606(_0x2f4028);});});}function respondWithStatusCode(_0xc16e80,_0x489b25){_0x489b25=_0x489b25||0xcc;return function(_0x136ad9){if(_0x136ad9){return _0xc16e80[_0x689e('0x24')](_0x489b25);}return _0xc16e80[_0x689e('0x25')](_0x489b25)[_0x689e('0x26')]();};}function respondWithResult(_0x59f58a,_0x533d4f){_0x533d4f=_0x533d4f||0xc8;return function(_0x33e202){if(_0x33e202){return _0x59f58a[_0x689e('0x25')](_0x533d4f)[_0x689e('0x27')](_0x33e202);}};}function respondWithFilteredResult(_0x2d1b59,_0x4fdc18){return function(_0x15d33f){if(_0x15d33f){var _0x4b5e9a=typeof _0x4fdc18[_0x689e('0x28')]===_0x689e('0x29')&&typeof _0x4fdc18[_0x689e('0x2a')]==='undefined';var _0x3650d7=_0x15d33f[_0x689e('0x2b')];var _0x1b7875=_0x4b5e9a?0x0:_0x4fdc18[_0x689e('0x28')];var _0x24ee82=_0x4b5e9a?_0x15d33f[_0x689e('0x2b')]:_0x4fdc18['offset']+_0x4fdc18['limit'];var _0x3a0248;if(_0x24ee82>=_0x3650d7){_0x24ee82=_0x3650d7;_0x3a0248=0xc8;}else{_0x3a0248=0xce;}_0x2d1b59[_0x689e('0x25')](_0x3a0248);return _0x2d1b59[_0x689e('0x2c')](_0x689e('0x2d'),_0x1b7875+'-'+_0x24ee82+'/'+_0x3650d7)['json'](_0x15d33f);}return null;};}function saveUpdates(_0x18046a){return function(_0x5278a4){if(_0x5278a4){return _0x5278a4['update'](_0x18046a)[_0x689e('0x18')](function(_0x3235d7){return _0x3235d7;});}return null;};}function removeEntity(_0x52f351){return function(_0x422f6b){if(_0x422f6b){return _0x422f6b[_0x689e('0x2e')]()[_0x689e('0x18')](function(){_0x52f351[_0x689e('0x25')](0xcc)[_0x689e('0x26')]();});}};}function handleEntityNotFound(_0x5573a9){return function(_0x3c2928){if(!_0x3c2928){_0x5573a9[_0x689e('0x24')](0x194);}return _0x3c2928;};}function handleError(_0x52c169,_0x241725){_0x241725=_0x241725||0x1f4;return function(_0x15c813){logger[_0x689e('0x1f')](_0x15c813[_0x689e('0x2f')]);if(_0x15c813[_0x689e('0x30')]){delete _0x15c813['name'];}_0x52c169[_0x689e('0x25')](_0x241725)['send'](_0x15c813);};}function getMustacheRender(_0x52b355,_0x17d5a1){return Mustache[_0x689e('0x31')](_0x52b355,_[_0x689e('0x32')](_0x17d5a1[_0x689e('0x33')],{'contact':_0x17d5a1['contact'],'message':_0x17d5a1['message'],'agent':_0x17d5a1[_0x689e('0x34')],'interaction':_0x17d5a1[_0x689e('0x35')],'account':_0x17d5a1[_0x689e('0x36')]}))||'';}exports['index']=function(_0x351d89,_0x3333b0){var _0x3d8c14={};var _0x370e9e=_[_0x689e('0x37')](db['ChatInteraction'][_0x689e('0x38')],function(_0x385cf1){return{'name':_0x385cf1[_0x689e('0x39')],'type':_0x385cf1[_0x689e('0x3a')]['key']};});_0x3d8c14=qs[_0x689e('0x3b')](_0x370e9e,_0x351d89);return interaction['findAll']('chat',_0x351d89[_0x689e('0x3c')],_0x351d89[_0x689e('0x3d')],_0x3d8c14,_0x370e9e)[_0x689e('0x18')](respondWithFilteredResult(_0x3333b0,_0x3d8c14))[_0x689e('0x23')](handleError(_0x3333b0,null));};exports[_0x689e('0x3e')]=function(_0x40e776,_0x7b66fb){var _0x3b7666={'raw':![],'where':{'id':_0x40e776[_0x689e('0x3f')]['id']}},_0x14e5fe={};_0x14e5fe[_0x689e('0x40')]=_['keys'](db[_0x689e('0x41')]['rawAttributes']);_0x14e5fe[_0x689e('0x3c')]=_['keys'](_0x40e776[_0x689e('0x3c')]);_0x14e5fe[_0x689e('0x42')]=_[_0x689e('0x43')](_0x14e5fe[_0x689e('0x40')],_0x14e5fe[_0x689e('0x3c')]);_0x3b7666[_0x689e('0x44')]=_['intersection'](_0x14e5fe[_0x689e('0x40')],qs[_0x689e('0x45')](_0x40e776[_0x689e('0x3c')]['fields']));_0x3b7666[_0x689e('0x44')]=_0x3b7666[_0x689e('0x44')]['length']?_0x3b7666[_0x689e('0x44')]:_0x14e5fe[_0x689e('0x40')];if(_0x40e776['query'][_0x689e('0x46')]){_0x3b7666[_0x689e('0x47')]=[{'all':!![]}];}_0x3b7666=_[_0x689e('0x32')]({},_0x3b7666,_0x40e776[_0x689e('0x48')]);return db[_0x689e('0x41')][_0x689e('0x49')](_0x3b7666)[_0x689e('0x18')](handleEntityNotFound(_0x7b66fb,null))['then'](respondWithResult(_0x7b66fb,null))['catch'](handleError(_0x7b66fb,null));};exports['create']=function(_0x25d6b8,_0x342f90){return db['ChatInteraction'][_0x689e('0x4a')](_0x25d6b8[_0x689e('0x33')],{})['then'](respondWithResult(_0x342f90,0xc9))['catch'](handleError(_0x342f90,null));};exports[_0x689e('0x4b')]=function(_0x47d35a,_0x5e2377){if(_0x47d35a[_0x689e('0x33')]['id']){delete _0x47d35a[_0x689e('0x33')]['id'];}return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x47d35a['params']['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x5e2377,null))[_0x689e('0x18')](saveUpdates(_0x47d35a[_0x689e('0x33')],null))[_0x689e('0x18')](respondWithResult(_0x5e2377,null))['catch'](handleError(_0x5e2377,null));};exports[_0x689e('0x2e')]=function(_0x433932,_0x38a488){return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x433932[_0x689e('0x3f')]['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x38a488,null))[_0x689e('0x18')](removeEntity(_0x38a488,null))[_0x689e('0x23')](handleError(_0x38a488,null));};exports[_0x689e('0x4c')]=function(_0x1d0273,_0xdbd1ce){return db[_0x689e('0x41')][_0x689e('0x4c')]()[_0x689e('0x18')](respondWithResult(_0xdbd1ce,null))['catch'](handleError(_0xdbd1ce,null));};exports['createVidaooSession']=function(_0x363cb9,_0x3f4513){var _0x748285=_0x363cb9[_0x689e('0x3f')]['id'];var _0xa33ab2;var _0x1dfe03;var _0x4bed94;return db[_0x689e('0x41')][_0x689e('0x4d')]({'where':{'id':_0x748285}})['then'](function(_0x3a3f20){_0xa33ab2=_0x3a3f20;return db[_0x689e('0x4e')][_0x689e('0x4d')]({'where':{'id':_0x3a3f20['ChatWebsiteId']},'attributes':['id',_0x689e('0x4f'),_0x689e('0x50'),_0x689e('0x51'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x689e('0x18')](function(_0x5b04b4){if(_0x5b04b4&&_0x5b04b4[_0x689e('0x4f')]&&_0x5b04b4['vidaooEscalation']){_0x1dfe03=_0x5b04b4;var _0x1ace3d={'interaction':{'id':_0x748285},'agent':{'id':_0x363cb9[_0x689e('0x3d')]['id'],'name':_0x363cb9[_0x689e('0x3d')]['name'],'fullname':_0x363cb9[_0x689e('0x3d')][_0x689e('0x52')],'email':_0x363cb9[_0x689e('0x3d')][_0x689e('0x53')]},'contact':_0x363cb9[_0x689e('0x33')][_0x689e('0x54')],'account':_0x363cb9[_0x689e('0x33')]['account']};var _0x2ec6ba={'rejectUnauthorized':![],'method':_0x689e('0x55'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x5b04b4[_0x689e('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x363cb9[_0x689e('0x3d')][_0x689e('0x53')]],'buttons':null,'topic':_0x1dfe03['vidaooTopic'],'note':_[_0x689e('0x56')](_0x1dfe03[_0x689e('0x57')])?null:getMustacheRender(_0x1dfe03[_0x689e('0x57')],_0x1ace3d),'metadata':null},'redirect':_0x689e('0x58'),'json':!![]};try{if(!_['isNull'](_0x1dfe03[_0x689e('0x59')])){var _0x43de72=getMustacheRender(_0x1dfe03[_0x689e('0x59')],_0x1ace3d);var _0x511f2e=JSON[_0x689e('0x5a')](_0x43de72);_0x2ec6ba['body'][_0x689e('0x5b')]=_0x511f2e;}}catch(_0x484f74){throw new db['Sequelize'][(_0x689e('0x5c'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2ec6ba);}else{throw new db['Sequelize'][(_0x689e('0x5c'))](_0x689e('0x5d'));}})[_0x689e('0x18')](function(_0x3185cf){_0x4bed94=_0x3185cf;if(_0x4bed94['id']){var _0x1f1ea7={'body':_0x4bed94[_0x689e('0x5e')],'ChatWebsiteId':_0x1dfe03['id'],'ChatInteractionId':_0xa33ab2['id'],'direction':_0x689e('0x5f'),'UserId':_0x363cb9[_0x689e('0x3d')]['id']};return db['ChatMessage'][_0x689e('0x4a')](_0x1f1ea7,{});}else{throw new db['Sequelize']['ValidationError'](_0x689e('0x60'));}})[_0x689e('0x18')](function(){return _0xa33ab2['updateAttributes']({'vidaooSessionId':_0x4bed94['id']});})[_0x689e('0x18')](respondWithResult(_0x3f4513,null))['catch'](handleError(_0x3f4513,null));};exports[_0x689e('0x61')]=function(_0x35ec05,_0x169378){if(_0x35ec05[_0x689e('0x33')]['id']){delete _0x35ec05[_0x689e('0x33')]['id'];}return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x35ec05[_0x689e('0x3f')]['id']},'include':[{'model':db[_0x689e('0x62')],'as':'Contact'}]})[_0x689e('0x18')](handleEntityNotFound(_0x169378,null))[_0x689e('0x18')](saveUpdates(_0x35ec05[_0x689e('0x33')],null))[_0x689e('0x18')](respondWithResult(_0x169378,null))['catch'](handleError(_0x169378,null));};exports['abandon']=function(_0x2ba647,_0x16f21a){if(_0x2ba647[_0x689e('0x33')]['id']){delete _0x2ba647['body']['id'];}return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x2ba647['params']['id']}})[_0x689e('0x18')](function(_0x5f1c9c){if(!_0x5f1c9c){logger[_0x689e('0x1f')](_0x689e('0x63'),_0x689e('0x64'),0x194,_0x689e('0x65'));_0x16f21a[_0x689e('0x24')](0x194);}else{if(_0x5f1c9c[_0x689e('0x66')]){throw new db[(_0x689e('0x67'))][(_0x689e('0x5c'))](_0x689e('0x68'));}}return _0x5f1c9c;})[_0x689e('0x18')](function(_0xe4ae1e){if(_0xe4ae1e){return _0xe4ae1e[_0x689e('0x4b')]({'closed':_0x2ba647[_0x689e('0x33')][_0x689e('0x69')],'disposition':_0x2ba647[_0x689e('0x33')][_0x689e('0x6a')]})[_0x689e('0x18')](function(_0x738c62){return _0x738c62;});}})[_0x689e('0x18')](function(){return respondWithRpcPromise(_0x689e('0x6b'),_0x689e('0x64'),_0x2ba647['body'],client9004);})[_0x689e('0x18')](respondWithResult(_0x16f21a,null))[_0x689e('0x23')](handleError(_0x16f21a,null));};exports['attachmentUpload']=function(_0x48a993,_0xb3ece){_0x48a993[_0x689e('0x33')][_0x689e('0x30')]=_0x48a993[_0x689e('0x6c')][_0x689e('0x6d')];_0x48a993[_0x689e('0x33')][_0x689e('0x6e')]=_0x48a993[_0x689e('0x6c')]['filename'];_0x48a993[_0x689e('0x33')][_0x689e('0x3a')]=_0x48a993['file'][_0x689e('0x6f')];return db[_0x689e('0x70')][_0x689e('0x4a')](_0x48a993[_0x689e('0x33')])['then'](respondWithResult(_0xb3ece,0xc9))[_0x689e('0x23')](handleError(_0xb3ece,null));};exports['attachmentDownload']=function(_0x435808,_0x1e2562){return db['ChatInteraction'][_0x689e('0x4d')]({'where':{'id':_0x435808[_0x689e('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1e2562,null))['then'](function(_0x4c769d){if(_0x4c769d){if(_0x4c769d[_0x689e('0x69')]){return _0x1e2562[_0x689e('0x25')](0x193)['json']({'status':0x193,'message':_0x689e('0x71')});}return db[_0x689e('0x70')]['findOne']({'where':{'id':_0x435808[_0x689e('0x3c')][_0x689e('0x72')]},'raw':!![]})[_0x689e('0x18')](handleEntityNotFound(_0x1e2562,null));}})['then'](function(_0x55e369){if(_0x55e369){var _0x553a2e=_0x55e369[_0x689e('0x73')]!==null;var _0x529086=path[_0x689e('0x74')](config[_0x689e('0x75')],_0x689e('0x76'));if(_0x553a2e){_0x529086=path[_0x689e('0x74')](_0x529086,_0x689e('0x77'));}var _0x4043d5=path[_0x689e('0x74')](_0x529086,_0x55e369['basename']);return _0x1e2562[_0x689e('0x78')](_0x4043d5);}})[_0x689e('0x23')](handleError(_0x1e2562,null));};exports[_0x689e('0x79')]=function(_0x31f998,_0x1f6106){var _0x4d765e=null;var _0x30f459=null;var _0x55e66b=null;if(_0x31f998[_0x689e('0x33')]['id']){delete _0x31f998[_0x689e('0x33')]['id'];}if(_0x31f998['body'][_0x689e('0x7a')]){_0x55e66b=path['join'](config['root'],_0x689e('0x7b'),util[_0x689e('0x7c')](_0x689e('0x7d'),Date[_0x689e('0x7e')]()));_0x31f998['body'][_0x689e('0x7f')]=_0x55e66b;}return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x31f998['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x689e('0x80'),'include':[{'model':db[_0x689e('0x81')],'as':'User'}]}]})[_0x689e('0x18')](handleEntityNotFound(_0x1f6106,null))[_0x689e('0x18')](saveUpdates(_0x31f998[_0x689e('0x33')],null))[_0x689e('0x18')](function(_0x6a63e){if(_0x6a63e){_0x4d765e=_0x6a63e;return db[_0x689e('0x4e')][_0x689e('0x49')]({'where':{'id':_0x4d765e[_0x689e('0x82')]}});}})[_0x689e('0x18')](function(_0xec6fe3){if(_0xec6fe3){_0x30f459=_0xec6fe3;return db['CmContact'][_0x689e('0x49')]({'where':{'id':_0x4d765e['ContactId']}});}})[_0x689e('0x18')](function(_0x6ccd06){if(_0x6ccd06){if(_0x55e66b){var _0x47a4b8=null;for(var _0x102e64=0x1;_0x102e64<_0x4d765e[_0x689e('0x80')][_0x689e('0x83')];++_0x102e64){_0x47a4b8=_0x4d765e['Messages'][_0x102e64];var _0x41ef16=_0x47a4b8[_0x689e('0x66')]?util[_0x689e('0x7c')]('%s%d',_0x30f459['agentAlias'],_0x47a4b8['UserId']):_0x689e('0x84');var _0x5b858f=_0x31f998[_0x689e('0x33')][_0x689e('0x85')]||util[_0x689e('0x7c')](_0x689e('0x86'),_0x689e('0x87'),_0x47a4b8['ContactId']);switch(_0x30f459[_0x689e('0x88')]){case _0x689e('0x89'):_0x41ef16=_0x47a4b8[_0x689e('0x66')]?util[_0x689e('0x7c')](_0x689e('0x86'),_0x30f459['agentAlias'],_0x47a4b8['UserId']):_0x689e('0x84');break;case'agent_alias':_0x41ef16=_0x47a4b8['UserId']?_0x47a4b8['User'][_0x689e('0x8a')]||_0x47a4b8['User'][_0x689e('0x52')]:_0x689e('0x84');break;case _0x689e('0x8b'):_0x41ef16=_0x47a4b8['UserId']?_0x47a4b8[_0x689e('0x81')]['fullname']:_0x689e('0x84');break;default:_0x41ef16=_0x47a4b8[_0x689e('0x66')]?util[_0x689e('0x7c')](_0x689e('0x86'),_0x30f459[_0x689e('0x8c')],_0x47a4b8[_0x689e('0x66')]):_0x689e('0x84');}var _0x4096dc=util[_0x689e('0x7c')](_0x689e('0x8d'),moment(_0x47a4b8[_0x689e('0x8e')])[_0x689e('0x7c')]('MM/DD/YYYY\x20HH:mm:ss'),_0x47a4b8[_0x689e('0x8f')]==='in'?_0x5b858f:_0x41ef16,_0x47a4b8['body']);if(!_0x47a4b8[_0x689e('0x90')]){fs[_0x689e('0x91')](_0x55e66b,_0x4096dc);}}return db[_0x689e('0x92')][_0x689e('0x4d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x689e('0x93'),'raw':!![],'include':[{'model':db[_0x689e('0x94')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x689e('0x18')](function(_0x243bf8){if(!_0x243bf8||!_0x243bf8[_0x689e('0x93')]||!_0x31f998[_0x689e('0x33')])return _0x4d765e;var _0x23f20e=_0x243bf8[_0x689e('0x95')]();return respondWithRpcPromise('SendMail',_0x689e('0x96'),{'account':_0x23f20e,'message':{'from':util[_0x689e('0x7c')](_0x689e('0x97'),_0x243bf8['name'],_0x243bf8['email']||_0x243bf8[_0x689e('0x93')][_0x689e('0x3d')]),'to':_0x31f998[_0x689e('0x33')][_0x689e('0x7a')],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x31f998['body']['mailTranscript']),'attachments':[{'path':_0x55e66b}]}})['then'](function(){return _0x4d765e;})[_0x689e('0x23')](function(_0x40d0a3){logger['error'](_0x40d0a3);});})['then'](respondWithStatusCode(_0x1f6106,0xc8))[_0x689e('0x23')](handleError(_0x1f6106,null));};exports[_0x689e('0x98')]=function(_0x79f5fb,_0x4957b9){return db['ChatMessage']['find']({'where':{'id':_0x79f5fb[_0x689e('0x3f')]['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x4957b9,null))[_0x689e('0x18')](function(_0x5d03be){if(_0x5d03be){return _0x5d03be[_0x689e('0x98')](_0x79f5fb[_0x689e('0x33')][_0x689e('0x99')],_[_0x689e('0x9a')](_0x79f5fb['body'],[_0x689e('0x99'),'id'])||{});}})['then'](respondWithResult(_0x4957b9,null))[_0x689e('0x23')](handleError(_0x4957b9,null));};exports['getMessages']=function(_0x260874,_0x508c12){var _0x380beb={'raw':![],'where':{}};var _0x4a3192={};var _0x573ebd={'count':0x0,'rows':[]};return db[_0x689e('0x41')]['findOne']({'where':{'id':_0x260874[_0x689e('0x3f')]['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x508c12,null))[_0x689e('0x18')](function(_0x4f071a){if(_0x4f071a){_0x4a3192['model']=_['keys'](db[_0x689e('0x9b')][_0x689e('0x38')]);_0x4a3192['query']=_[_0x689e('0x9c')](_0x260874[_0x689e('0x3c')]);_0x4a3192[_0x689e('0x42')]=_['intersection'](_0x4a3192[_0x689e('0x40')],_0x4a3192[_0x689e('0x3c')]);_0x380beb['attributes']=_['intersection'](_0x4a3192[_0x689e('0x40')],qs[_0x689e('0x45')](_0x260874[_0x689e('0x3c')][_0x689e('0x45')]));_0x380beb['attributes']=_0x380beb[_0x689e('0x44')]['length']?_0x380beb[_0x689e('0x44')]:_0x4a3192['model'];if(!_0x260874[_0x689e('0x3c')][_0x689e('0x9d')](_0x689e('0x9e'))){_0x380beb['limit']=qs[_0x689e('0x2a')](_0x260874[_0x689e('0x3c')]['limit']);_0x380beb[_0x689e('0x28')]=qs[_0x689e('0x28')](_0x260874[_0x689e('0x3c')][_0x689e('0x28')]);}_0x380beb[_0x689e('0x9f')]=qs[_0x689e('0xa0')](_0x260874[_0x689e('0x3c')]['sort']);_0x380beb[_0x689e('0xa1')]=qs['filters'](_[_0x689e('0xa2')](_0x260874[_0x689e('0x3c')],_0x4a3192['filters']));_0x380beb[_0x689e('0xa1')][_0x689e('0xa3')]=_0x4f071a['id'];if(_0x260874[_0x689e('0x3c')]['filter']){_0x380beb[_0x689e('0xa1')]=_['merge'](_0x380beb[_0x689e('0xa1')],{'$or':_[_0x689e('0x37')](_0x380beb[_0x689e('0x44')],function(_0x191ebb){var _0x491d45={};_0x491d45[_0x191ebb]={'$like':'%'+_0x260874[_0x689e('0x3c')][_0x689e('0xa4')]+'%'};return _0x491d45;})});}if(_0x260874[_0x689e('0x3c')][_0x689e('0xa5')]){var _0x3eaab3=_0x260874['query'][_0x689e('0xa5')][_0x689e('0xa6')](',');var _0x16e6ba={};_0x16e6ba[_0x3eaab3[0x0]]={'$gte':moment(_0x3eaab3[0x1])[_0x689e('0x7c')](_0x689e('0xa7'))};_0x380beb[_0x689e('0xa1')]=_['merge'](_0x380beb['where'],_0x16e6ba);}_0x380beb=_['merge']({},_0x380beb,_0x260874[_0x689e('0x48')]);return db[_0x689e('0x9b')][_0x689e('0x2b')]({'where':_0x380beb[_0x689e('0xa1')]})[_0x689e('0x18')](function(_0x486289){_0x573ebd[_0x689e('0x2b')]=_0x486289;if(_0x260874[_0x689e('0x3c')]['includeAll']){_0x380beb[_0x689e('0x47')]=[{'all':!![]}];}return db[_0x689e('0x9b')]['findAll'](_0x380beb);})[_0x689e('0x18')](function(_0x5c74b7){_0x573ebd[_0x689e('0xa8')]=_0x5c74b7;return _0x573ebd;});}})[_0x689e('0x18')](respondWithFilteredResult(_0x508c12,_0x380beb))['catch'](handleError(_0x508c12,null));};exports[_0x689e('0xa9')]=function(_0x431b2e,_0x1fc26d){var _0x5baf9d={'where':{}},_0x101ffc={},_0x522bb6={'count':0x0,'rows':[]};return db[_0x689e('0x41')][_0x689e('0x4d')]({'where':{'id':_0x431b2e[_0x689e('0x3f')]['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x1fc26d,null))[_0x689e('0x18')](function(_0x425296){if(_0x425296){_0x101ffc[_0x689e('0x40')]=_[_0x689e('0x9c')](db['ChatMessage']['rawAttributes']);_0x101ffc[_0x689e('0x3c')]=_[_0x689e('0x9c')](_0x431b2e[_0x689e('0x3c')]);_0x101ffc[_0x689e('0x42')]=_[_0x689e('0x43')](_0x101ffc[_0x689e('0x40')],_0x101ffc[_0x689e('0x3c')]);_0x5baf9d[_0x689e('0x44')]=_[_0x689e('0x43')](_0x101ffc[_0x689e('0x40')],qs[_0x689e('0x45')](_0x431b2e[_0x689e('0x3c')][_0x689e('0x45')]));_0x5baf9d[_0x689e('0x44')]=_0x5baf9d[_0x689e('0x44')][_0x689e('0x83')]?_0x5baf9d['attributes']:_0x101ffc[_0x689e('0x40')];if(!_0x431b2e['query'][_0x689e('0x9d')](_0x689e('0x9e'))){_0x5baf9d[_0x689e('0x2a')]=qs[_0x689e('0x2a')](_0x431b2e[_0x689e('0x3c')]['limit']);_0x5baf9d[_0x689e('0x28')]=qs[_0x689e('0x28')](_0x431b2e[_0x689e('0x3c')]['offset']);}_0x5baf9d[_0x689e('0x9f')]=qs['sort'](_0x431b2e[_0x689e('0x3c')]['sort']);_0x5baf9d[_0x689e('0xa1')]=qs[_0x689e('0x42')](_[_0x689e('0xa2')](_0x431b2e[_0x689e('0x3c')],_0x101ffc['filters']));_0x5baf9d[_0x689e('0xa1')][_0x689e('0xa3')]=_0x425296['id'];if(_0x431b2e['query'][_0x689e('0xa4')]){_0x5baf9d[_0x689e('0xa1')]=_[_0x689e('0x32')](_0x5baf9d['where'],{'$or':_[_0x689e('0x37')](_0x5baf9d[_0x689e('0x44')],function(_0x1d42f7){var _0x53f6e2={};_0x53f6e2[_0x1d42f7]={'$like':'%'+_0x431b2e[_0x689e('0x3c')][_0x689e('0xa4')]+'%'};return _0x53f6e2;})});}_0x5baf9d['where'][_0x689e('0x90')]=![];if(_0x431b2e['query']['id']){_0x5baf9d[_0x689e('0xa1')]['id']={'$gt':_0x431b2e[_0x689e('0x3c')]['id']};}_0x5baf9d=_[_0x689e('0x32')]({},_0x5baf9d,_0x431b2e['options']);return db[_0x689e('0x9b')][_0x689e('0x2b')]({'where':_0x5baf9d['where']})[_0x689e('0x18')](function(_0x1ee1ee){_0x522bb6[_0x689e('0x2b')]=_0x1ee1ee;_0x5baf9d[_0x689e('0x47')]=[];if(_0x431b2e[_0x689e('0x3c')][_0x689e('0xaa')]){_0x5baf9d['include']['push']({'model':db[_0x689e('0x81')],'as':_0x689e('0x81'),'attributes':['id',_0x689e('0x52'),'alias']});}if(_0x431b2e[_0x689e('0x3c')]['includeAll']){_0x5baf9d['include']=[{'all':!![]}];}return db[_0x689e('0x9b')]['findAll'](_0x5baf9d);})[_0x689e('0x18')](function(_0x4e7871){_0x522bb6[_0x689e('0xa8')]=_0x4e7871;return _0x522bb6;});}})[_0x689e('0x18')](respondWithFilteredResult(_0x1fc26d,_0x5baf9d))[_0x689e('0x23')](handleError(_0x1fc26d,null));};exports[_0x689e('0xab')]=function(_0x2c98f5,_0x577c82){return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x2c98f5['params']['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x577c82,null))[_0x689e('0x18')](function(_0x402109){if(_0x402109){return _0x402109[_0x689e('0xac')](_0x2c98f5[_0x689e('0x33')][_0x689e('0x99')],_[_0x689e('0x9a')](_0x2c98f5[_0x689e('0x33')],['ids','id'])||{})[_0x689e('0xad')](function(){return db[_0x689e('0xae')][_0x689e('0xaf')]({'attributes':['id',_0x689e('0x30'),'color'],'where':{'id':_0x2c98f5[_0x689e('0x33')][_0x689e('0x99')]}});})[_0x689e('0x18')](function(_0x47e7c9){socket[_0x689e('0xb0')](_0x689e('0xb1'),{'id':Number(_0x2c98f5[_0x689e('0x3f')]['id']),'tags':_0x47e7c9||[]});return{'id':Number(_0x2c98f5[_0x689e('0x3f')]['id']),'tags':_0x47e7c9||[]};});}})[_0x689e('0x18')](respondWithResult(_0x577c82,null))[_0x689e('0x23')](handleError(_0x577c82,null));};exports[_0x689e('0xb2')]=function(_0x2a52a2,_0x15e3d0){return db[_0x689e('0x41')]['find']({'where':{'id':_0x2a52a2[_0x689e('0x3f')]['id']}})[_0x689e('0x18')](handleEntityNotFound(_0x15e3d0,null))['then'](function(_0x3441c6){if(_0x3441c6){return _0x3441c6[_0x689e('0xb2')](_0x2a52a2[_0x689e('0x3c')][_0x689e('0x99')]);}})[_0x689e('0x18')](respondWithStatusCode(_0x15e3d0,null))[_0x689e('0x23')](handleError(_0x15e3d0,null));};exports[_0x689e('0x78')]=function(_0x2caf68,_0x2adf61){var _0x3a982c=moment()[_0x689e('0xb3')]()[_0x689e('0xb4')]();var _0x3babee=path['join'](config[_0x689e('0x75')],_0x689e('0xb5'),_0x689e('0xb6'),_0x689e('0xb7'));var _0x55941f=path['join'](config[_0x689e('0x75')],_0x689e('0xb5'),'files','attachments');var _0x364ca8=path[_0x689e('0x74')](_0x3babee,_0x3a982c);var _0xce3ba4=util[_0x689e('0x7c')](_0x689e('0xb8'),_0x2caf68['params']['id'],_0x3a982c);var _0x48ca6a=path['join'](_0x3babee,_0xce3ba4);var _0xa27384=[];_0xa27384['push']({'model':db[_0x689e('0x81')],'as':'User','attributes':['id',_0x689e('0x52')],'raw':!![]});_0xa27384['push']({'model':db['CmContact'],'as':_0x689e('0xb9'),'attributes':['id','firstName',_0x689e('0xba')],'raw':!![]});if(_0x2caf68[_0x689e('0x3c')]['attachments']){_0xa27384[_0x689e('0xbb')]({'model':db[_0x689e('0x70')],'as':_0x689e('0x70'),'raw':!![]});}var _0xb18ff5=[{'model':db[_0x689e('0x9b')],'as':'Messages','attributes':['id',_0x689e('0x33'),_0x689e('0x8e'),_0x689e('0x8f'),'secret',_0x689e('0xbc')],'include':_0xa27384}];_0xb18ff5[_0x689e('0xbb')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x689e('0x30')]});_0xb18ff5[_0x689e('0xbb')]({'model':db['User'],'as':_0x689e('0xbd'),'attributes':['id',_0x689e('0x52')]});return db[_0x689e('0x41')][_0x689e('0x49')]({'where':{'id':_0x2caf68['params']['id']},'include':_0xb18ff5})[_0x689e('0x18')](handleEntityNotFound(_0x2adf61,null))[_0x689e('0x18')](function(_0x28516d){if(_0x28516d){var _0x554039=_0x28516d['get']({'plain':!![]});fs[_0x689e('0xbe')](_0x364ca8);var _0x3742bf={'channel':_0x689e('0xbf'),'account':_0x554039[_0x689e('0xc0')][_0x689e('0x30')],'agent':_0x554039['Owner']?_0x554039[_0x689e('0xbd')][_0x689e('0x52')]:_0x689e('0xc1'),'createdAt':moment(_0x554039[_0x689e('0x8e')])['format'](_0x689e('0xa7'))[_0x689e('0xb4')](),'closedAt':_0x554039[_0x689e('0x69')]?moment(_0x554039[_0x689e('0xc2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x689e('0xb4')]():'','disposition':_0x554039['disposition'],'chatInfo':{'browser':_0x554039[_0x689e('0xc3')],'os':_0x554039[_0x689e('0xc4')],'referer':_0x554039['referer'],'customerIp':_0x554039[_0x689e('0xc5')],'customerPort':_0x554039[_0x689e('0xc6')]?_0x554039[_0x689e('0xc6')]:'N.A.'},'messages':_(_0x554039[_0x689e('0x80')])[_0x689e('0xc7')]()[_0x689e('0xa4')]({'secret':![]})['map'](function(_0x192160){if(_0x192160[_0x689e('0x70')]){var _0x11d71e=path['join'](_0x55941f,_0x192160[_0x689e('0x70')]['basename']);if(fs[_0x689e('0xc8')](_0x11d71e)){fs['createReadStream'](_0x11d71e)[_0x689e('0xc9')](fs[_0x689e('0xca')](path[_0x689e('0x74')](_0x364ca8,_0x192160[_0x689e('0x70')][_0x689e('0x6e')])));}}return{'date':moment(_0x192160[_0x689e('0x8e')])['format'](_0x689e('0xa7'))[_0x689e('0xb4')](),'sender':_0x192160[_0x689e('0x8f')]===_0x689e('0x5f')?_0x192160[_0x689e('0x81')]?_0x192160['User'][_0x689e('0x52')]:'System':_0x192160[_0x689e('0xb9')][_0x689e('0xcb')]+(_0x192160[_0x689e('0xb9')][_0x689e('0xba')]?'\x20'+_0x192160['Contact'][_0x689e('0xba')]:''),'body':_0x192160['Attachment']?_0x192160[_0x689e('0x70')]['basename']:_0x192160[_0x689e('0x33')],'direction':_0x192160[_0x689e('0x8f')]===_0x689e('0x5f')?'A':'C','secret':_0x192160[_0x689e('0x90')],'read':_0x192160[_0x689e('0xbc')],'attachment':_0x192160[_0x689e('0x70')]};})[_0x689e('0xcc')]()};return ejs[_0x689e('0xcd')](path['join'](config[_0x689e('0x75')],'server','views','downloadInteraction.ejs'),{'interaction':_0x3742bf})[_0x689e('0x18')](function(_0x41464a){var _0x32804c=path[_0x689e('0x74')](_0x364ca8,_0x689e('0xce')+_0x554039['id']+'-'+_0x3a982c+_0x689e('0xcf'));var _0x505e52={'path':_0x32804c,'channel':'Chat','interactionId':_0x554039['id']};return pdf['createPdfFromHTML'](_0x41464a,_0x505e52);})[_0x689e('0x18')](function(){return new Promise(function(_0x2ba195,_0x235d41){zipdir(_0x364ca8,{'saveTo':_0x48ca6a},function(_0x35780f,_0xcf7feb){if(_0x35780f)return _0x235d41(_0x35780f);return _0x2ba195(_0xcf7feb);});})[_0x689e('0x18')](function(){return new BPromise(function(_0x21b111,_0xca82b4){rimraf(_0x364ca8,function(_0x151e1f){if(_0x151e1f)_0xca82b4(_0x151e1f);return _0x21b111();});});})[_0x689e('0x18')](function(){return _0x2adf61[_0x689e('0x78')](_0x48ca6a,_0xce3ba4,function(_0x2edf95){if(_0x2edf95){logger[_0x689e('0x1f')]('err',_0x2edf95);}else{fs[_0x689e('0xd0')](_0x48ca6a);}});});});}else{return _0x2adf61[_0x689e('0x24')](0xc8);}})[_0x689e('0x23')](handleError(_0x2adf61,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 35a5c8f..5a4d9bd 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 _0x3df6=['exports','../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hook'];(function(_0x46e76c,_0x40dad9){var _0x47f72a=function(_0x3d1802){while(--_0x3d1802){_0x46e76c['push'](_0x46e76c['shift']());}};_0x47f72a(++_0x40dad9);}(_0x3df6,0x13c));var _0x63df=function(_0x3f911c,_0x1441cf){_0x3f911c=_0x3f911c-0x0;var _0x25c459=_0x3df6[_0x3f911c];return _0x25c459;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x63df('0x0'))['db'][_0x63df('0x1')];var ChatMessage=require(_0x63df('0x0'))['db'][_0x63df('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x63df('0x3'),'afterUpdate':'update','afterDestroy':_0x63df('0x4')};function emitEvent(_0x1970fd){return function(_0x3a5cab,_0x1bd3f8,_0x3defa0){_0x3a5cab[_0x63df('0x5')]({'attributes':['id'],'raw':!![]})[_0x63df('0x6')](function(_0x13c4e1){_0x3a5cab[_0x63df('0x7')](_0x63df('0x8'),_0x13c4e1[_0x63df('0x9')](function(_0x28fdb7){return{'id':_0x28fdb7['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3a5cab['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x110e84){_0x3a5cab[_0x63df('0x7')](_0x63df('0xa'),_0x110e84['length']);ChatInteractionEvents[_0x63df('0xb')](_0x1970fd+':'+_0x3a5cab['id'],_0x3a5cab);ChatInteractionEvents[_0x63df('0xb')](_0x1970fd,_0x3a5cab);_0x3defa0(null);})[_0x63df('0xc')](_0x3defa0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x63df('0xd')](e,emitEvent(event));}}module[_0x63df('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xacc9=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','remove','getUsers','then','map','emit','catch','hasOwnProperty','hook'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0xacc9,0x139));var _0x9acc=function(_0x5a29a7,_0x3e59a8){_0x5a29a7=_0x5a29a7-0x0;var _0x172198=_0xacc9[_0x5a29a7];return _0x172198;};'use strict';var EventEmitter=require(_0x9acc('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x9acc('0x1'))['db'][_0x9acc('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9acc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9acc('0x4')};function emitEvent(_0x1ffec4){return function(_0x2df10d,_0x57bbdd,_0xe56f18){_0x2df10d[_0x9acc('0x5')]({'attributes':['id'],'raw':!![]})[_0x9acc('0x6')](function(_0x36e69c){_0x2df10d['setDataValue']('Users',_0x36e69c[_0x9acc('0x7')](function(_0x5225c1){return{'id':_0x5225c1['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2df10d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9acc('0x6')](function(_0x3d70a3){_0x2df10d['setDataValue']('unreadMessages',_0x3d70a3['length']);ChatInteractionEvents[_0x9acc('0x8')](_0x1ffec4+':'+_0x2df10d['id'],_0x2df10d);ChatInteractionEvents[_0x9acc('0x8')](_0x1ffec4,_0x2df10d);_0xe56f18(null);})[_0x9acc('0x9')](_0xe56f18(null));};}for(var e in events){if(events[_0x9acc('0xa')](e)){var event=events[e];ChatInteraction[_0x9acc('0xb')](e,emitEvent(event));}}module[_0x9acc('0xc')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3bd2063..61a240c 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 _0xab8c=['request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xab8c,0x174));var _0xcab8=function(_0x4c1239,_0x57921a){_0x4c1239=_0x4c1239-0x0;var _0x5c843a=_0xab8c[_0x4c1239];return _0x5c843a;};'use strict';var _=require(_0xcab8('0x0'));var util=require(_0xcab8('0x1'));var logger=require(_0xcab8('0x2'))(_0xcab8('0x3'));var moment=require(_0xcab8('0x4'));var BPromise=require(_0xcab8('0x5'));var rp=require(_0xcab8('0x6'));var fs=require('fs');var path=require(_0xcab8('0x7'));var rimraf=require(_0xcab8('0x8'));var config=require(_0xcab8('0x9'));var attributes=require(_0xcab8('0xa'));module[_0xcab8('0xb')]=function(_0x196eab,_0x1366eb){return _0x196eab[_0xcab8('0xc')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fbf1f,_0x1d3744,_0x27276d){if(_0x3fbf1f[_0xcab8('0xd')]('closed')){_0x3fbf1f[_0xcab8('0xe')]=moment()['format'](_0xcab8('0xf'));}_0x27276d(null,_0x3fbf1f);}},'charset':_0xcab8('0x10'),'collate':_0xcab8('0x11')});}; \ No newline at end of file +var _0xb8c9=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci'];(function(_0x247ffb,_0x4f5bcd){var _0xafc7af=function(_0x1e4335){while(--_0x1e4335){_0x247ffb['push'](_0x247ffb['shift']());}};_0xafc7af(++_0x4f5bcd);}(_0xb8c9,0xb4));var _0x9b8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b8c('0x0'));var util=require(_0x9b8c('0x1'));var logger=require('../../config/logger')(_0x9b8c('0x2'));var moment=require(_0x9b8c('0x3'));var BPromise=require(_0x9b8c('0x4'));var rp=require(_0x9b8c('0x5'));var fs=require('fs');var path=require(_0x9b8c('0x6'));var rimraf=require(_0x9b8c('0x7'));var config=require(_0x9b8c('0x8'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x3609c4,_0x5a417c){return _0x3609c4[_0x9b8c('0x9')](_0x9b8c('0xa'),attributes,{'tableName':_0x9b8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x310aa4,_0x3c7c14,_0x130de1){if(_0x310aa4[_0x9b8c('0xc')](_0x9b8c('0xd'))){_0x310aa4['closedAt']=moment()[_0x9b8c('0xe')](_0x9b8c('0xf'));}_0x130de1(null,_0x310aa4);}},'charset':_0x9b8c('0x10'),'collate':_0x9b8c('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a1579aa..6a36509 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 _0x17b4=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','request','then','info','request\x20sent'];(function(_0x1649ea,_0x422343){var _0x42787d=function(_0x22f3fb){while(--_0x22f3fb){_0x1649ea['push'](_0x1649ea['shift']());}};_0x42787d(++_0x422343);}(_0x17b4,0x89));var _0x417b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x17b4[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x417b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x417b('0x1'));var rs=require(_0x417b('0x2'));var fs=require('fs');var Redis=require(_0x417b('0x3'));var db=require(_0x417b('0x4'))['db'];var utils=require(_0x417b('0x5'));var logger=require('../../config/logger')(_0x417b('0x6'));var config=require(_0x417b('0x7'));var jayson=require(_0x417b('0x8'));var client=jayson[_0x417b('0x9')]['http']({'port':0x232a});config[_0x417b('0xa')]=_['defaults'](config[_0x417b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2b3cc9,_0x51e32b,_0x2dd1b3){return new BPromise(function(_0x298769,_0x2d5ab9){return client[_0x417b('0xb')](_0x2b3cc9,_0x2dd1b3)[_0x417b('0xc')](function(_0xfd990f){logger[_0x417b('0xd')]('ChatInteraction,\x20%s,\x20%s',_0x51e32b,_0x417b('0xe'));logger['debug'](_0x417b('0xf'),_0x51e32b,_0x417b('0xe'),JSON[_0x417b('0x10')](_0xfd990f));if(_0xfd990f[_0x417b('0x11')]){if(_0xfd990f['error']['code']===0x1f4){logger[_0x417b('0x11')](_0x417b('0x12'),_0x51e32b,_0xfd990f[_0x417b('0x11')][_0x417b('0x13')]);return _0x2d5ab9(_0xfd990f[_0x417b('0x11')][_0x417b('0x13')]);}logger[_0x417b('0x11')](_0x417b('0x12'),_0x51e32b,_0xfd990f[_0x417b('0x11')][_0x417b('0x13')]);return _0x298769(_0xfd990f[_0x417b('0x11')][_0x417b('0x13')]);}else{logger['info'](_0x417b('0x12'),_0x51e32b,_0x417b('0xe'));_0x298769(_0xfd990f[_0x417b('0x14')][_0x417b('0x13')]);}})[_0x417b('0x15')](function(_0x4e60c4){logger[_0x417b('0x11')](_0x417b('0x12'),_0x51e32b,_0x4e60c4);_0x2d5ab9(_0x4e60c4);});});}exports[_0x417b('0x16')]=function(_0x4b4a0f){var _0x1ee16d=this;return new Promise(function(_0x2c73b7,_0x25979b){return db[_0x417b('0x17')][_0x417b('0x18')](_0x4b4a0f[_0x417b('0x19')],{'raw':_0x4b4a0f[_0x417b('0x1a')]?_0x4b4a0f[_0x417b('0x1a')][_0x417b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b4a0f[_0x417b('0x1a')]?_0x4b4a0f[_0x417b('0x1a')][_0x417b('0x1c')]||null:null,'attributes':_0x4b4a0f[_0x417b('0x1a')]?_0x4b4a0f[_0x417b('0x1a')][_0x417b('0x1d')]||null:null,'limit':_0x4b4a0f['options']?_0x4b4a0f[_0x417b('0x1a')][_0x417b('0x1e')]||null:null})['then'](function(_0x20c1ab){logger[_0x417b('0xd')](_0x417b('0x16'),_0x4b4a0f);logger['debug'](_0x417b('0x16'),_0x4b4a0f,JSON['stringify'](_0x20c1ab));_0x2c73b7(_0x20c1ab);})[_0x417b('0x15')](function(_0x18c455){logger[_0x417b('0x11')](_0x417b('0x16'),_0x18c455[_0x417b('0x13')],_0x4b4a0f);_0x25979b(_0x1ee16d[_0x417b('0x11')](0x1f4,_0x18c455['message']));});});};exports[_0x417b('0x1f')]=function(_0x52cc58){return new Promise(function(_0x4bf260,_0x15d5c5){return db[_0x417b('0x17')][_0x417b('0x20')]({'where':_0x52cc58[_0x417b('0x1a')]?_0x52cc58[_0x417b('0x1a')][_0x417b('0x1c')]||null:null})['then'](function(_0x32f791){if(_0x32f791){return _0x32f791[_0x417b('0x21')](_0x52cc58['body'][_0x417b('0x22')],_[_0x417b('0x23')](_0x52cc58[_0x417b('0x19')],[_0x417b('0x22'),'id'])||{});}})[_0x417b('0x24')](function(_0x505074){logger[_0x417b('0xd')](_0x417b('0x25'),_0x52cc58);logger['debug'](_0x417b('0x25'),_0x52cc58,JSON[_0x417b('0x10')](_0x505074));_0x4bf260(_0x505074);})[_0x417b('0x15')](function(_0x411483){logger[_0x417b('0x11')]('AddTags',_0x411483['message'],_0x52cc58);_0x15d5c5(_this[_0x417b('0x11')](0x1f4,_0x411483[_0x417b('0x13')]));});});}; \ No newline at end of file +var _0xd646=['jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','find','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1cf730,_0x42c362){var _0x35bfee=function(_0x26ca67){while(--_0x26ca67){_0x1cf730['push'](_0x1cf730['shift']());}};_0x35bfee(++_0x42c362);}(_0xd646,0x191));var _0x6d64=function(_0x447a9f,_0x48619b){_0x447a9f=_0x447a9f-0x0;var _0x1286fc=_0xd646[_0x447a9f];return _0x1286fc;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var moment=require(_0x6d64('0x2'));var BPromise=require(_0x6d64('0x3'));var rs=require(_0x6d64('0x4'));var fs=require('fs');var Redis=require(_0x6d64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d64('0x6'));var logger=require(_0x6d64('0x7'))('rpc');var config=require(_0x6d64('0x8'));var jayson=require(_0x6d64('0x9'));var client=jayson[_0x6d64('0xa')][_0x6d64('0xb')]({'port':0x232a});config['redis']=_[_0x6d64('0xc')](config['redis'],{'host':_0x6d64('0xd'),'port':0x18eb});var socket=require(_0x6d64('0xe'))(new Redis(config[_0x6d64('0xf')]));require(_0x6d64('0x10'))[_0x6d64('0x11')](socket);function respondWithRpcPromise(_0x27e20b,_0x3a03fb,_0x33e032){return new BPromise(function(_0x1fbec9,_0x68010e){return client[_0x6d64('0x12')](_0x27e20b,_0x33e032)[_0x6d64('0x13')](function(_0x10f756){logger[_0x6d64('0x14')](_0x6d64('0x15'),_0x3a03fb,'request\x20sent');logger[_0x6d64('0x16')](_0x6d64('0x17'),_0x3a03fb,'request\x20sent',JSON[_0x6d64('0x18')](_0x10f756));if(_0x10f756[_0x6d64('0x19')]){if(_0x10f756[_0x6d64('0x19')][_0x6d64('0x1a')]===0x1f4){logger['error'](_0x6d64('0x15'),_0x3a03fb,_0x10f756[_0x6d64('0x19')][_0x6d64('0x1b')]);return _0x68010e(_0x10f756[_0x6d64('0x19')][_0x6d64('0x1b')]);}logger['error'](_0x6d64('0x15'),_0x3a03fb,_0x10f756[_0x6d64('0x19')][_0x6d64('0x1b')]);return _0x1fbec9(_0x10f756['error'][_0x6d64('0x1b')]);}else{logger[_0x6d64('0x14')](_0x6d64('0x15'),_0x3a03fb,'request\x20sent');_0x1fbec9(_0x10f756[_0x6d64('0x1c')][_0x6d64('0x1b')]);}})[_0x6d64('0x1d')](function(_0x1340a8){logger['error'](_0x6d64('0x15'),_0x3a03fb,_0x1340a8);_0x68010e(_0x1340a8);});});}exports[_0x6d64('0x1e')]=function(_0x14e9aa){var _0x1996a5=this;return new Promise(function(_0x2b2324,_0x2fdd0d){return db[_0x6d64('0x1f')][_0x6d64('0x20')](_0x14e9aa[_0x6d64('0x21')],{'raw':_0x14e9aa[_0x6d64('0x22')]?_0x14e9aa['options'][_0x6d64('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14e9aa[_0x6d64('0x22')]?_0x14e9aa[_0x6d64('0x22')]['where']||null:null,'attributes':_0x14e9aa['options']?_0x14e9aa['options']['attributes']||null:null,'limit':_0x14e9aa[_0x6d64('0x22')]?_0x14e9aa[_0x6d64('0x22')][_0x6d64('0x24')]||null:null})[_0x6d64('0x13')](function(_0x45bf2c){logger[_0x6d64('0x14')](_0x6d64('0x1e'),_0x14e9aa);logger[_0x6d64('0x16')](_0x6d64('0x1e'),_0x14e9aa,JSON['stringify'](_0x45bf2c));_0x2b2324(_0x45bf2c);})[_0x6d64('0x1d')](function(_0xf56ad6){logger[_0x6d64('0x19')](_0x6d64('0x1e'),_0xf56ad6[_0x6d64('0x1b')],_0x14e9aa);_0x2fdd0d(_0x1996a5[_0x6d64('0x19')](0x1f4,_0xf56ad6[_0x6d64('0x1b')]));});});};exports['AddTagsToChatInteraction']=function(_0x492ce7){return new Promise(function(_0x7c8890,_0x3d0d7b){return db[_0x6d64('0x1f')][_0x6d64('0x25')]({'where':_0x492ce7[_0x6d64('0x22')]?_0x492ce7[_0x6d64('0x22')]['where']||null:null})['then'](function(_0x4f2448){if(_0x4f2448){return _0x4f2448['addTags'](_0x492ce7[_0x6d64('0x21')]['ids'],_[_0x6d64('0x26')](_0x492ce7[_0x6d64('0x21')],[_0x6d64('0x27'),'id'])||{});}})['spread'](function(_0x1a248b){logger[_0x6d64('0x14')](_0x6d64('0x28'),_0x492ce7);logger[_0x6d64('0x16')](_0x6d64('0x28'),_0x492ce7,JSON[_0x6d64('0x18')](_0x1a248b));_0x7c8890(_0x1a248b);})['catch'](function(_0x54dfb6){logger[_0x6d64('0x19')](_0x6d64('0x28'),_0x54dfb6['message'],_0x492ce7);_0x3d0d7b(_this[_0x6d64('0x19')](0x1f4,_0x54dfb6[_0x6d64('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b8cf917..d1950f1 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 _0xe801=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3aaac1,_0x4222b9){var _0x3e2469=function(_0x2734e3){while(--_0x2734e3){_0x3aaac1['push'](_0x3aaac1['shift']());}};_0x3e2469(++_0x4222b9);}(_0xe801,0x69));var _0x1e80=function(_0xce31d3,_0x271f26){_0xce31d3=_0xce31d3-0x0;var _0x3fb648=_0xe801[_0xce31d3];return _0x3fb648;};'use strict';var ChatInteractionEvents=require(_0x1e80('0x0'));var events=[_0x1e80('0x1'),_0x1e80('0x2'),_0x1e80('0x3')];function createListener(_0x4a0db2,_0x50359e){return function(_0x28049f){_0x50359e[_0x1e80('0x4')](_0x4a0db2,_0x28049f);};}function removeListener(_0x68e655,_0x41ee15){return function(){ChatInteractionEvents[_0x1e80('0x5')](_0x68e655,_0x41ee15);};}exports[_0x1e80('0x6')]=function(_0x5d93a7){for(var _0x27b027=0x0,_0x26d5f0=events['length'];_0x27b027<_0x26d5f0;_0x27b027++){var _0x566744=events[_0x27b027];var _0x4893d6=createListener(_0x1e80('0x7')+_0x566744,_0x5d93a7);ChatInteractionEvents['on'](_0x566744,_0x4893d6);}}; \ No newline at end of file +var _0x83f1=['emit','removeListener','register','length','./chatInteraction.events','save','remove','update'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x83f1,0x1cc));var _0x183f=function(_0x137264,_0x163896){_0x137264=_0x137264-0x0;var _0x26d615=_0x83f1[_0x137264];return _0x26d615;};'use strict';var ChatInteractionEvents=require(_0x183f('0x0'));var events=[_0x183f('0x1'),_0x183f('0x2'),_0x183f('0x3')];function createListener(_0x40525d,_0x50f14d){return function(_0x52688c){_0x50f14d[_0x183f('0x4')](_0x40525d,_0x52688c);};}function removeListener(_0x2668ca,_0x7f265){return function(){ChatInteractionEvents[_0x183f('0x5')](_0x2668ca,_0x7f265);};}exports[_0x183f('0x6')]=function(_0x5381b2){for(var _0x5c1cbd=0x0,_0xf702f5=events[_0x183f('0x7')];_0x5c1cbd<_0xf702f5;_0x5c1cbd++){var _0x5c75c3=events[_0x5c1cbd];var _0x434be2=createListener('chatInteraction:'+_0x5c75c3,_0x5381b2);ChatInteractionEvents['on'](_0x5c75c3,_0x434be2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 61d71ab..4f4e25d 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 _0x894f=['file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','root','%s-%s','now','originalname','/:id/attachment_upload','single'];(function(_0x107abb,_0x4d0688){var _0x4c746c=function(_0x1750b4){while(--_0x1750b4){_0x107abb['push'](_0x107abb['shift']());}};_0x4c746c(++_0x4d0688);}(_0x894f,0xd5));var _0xf894=function(_0x3ffaf7,_0x503a5a){_0x3ffaf7=_0x3ffaf7-0x0;var _0x172e99=_0x894f[_0x3ffaf7];return _0x172e99;};'use strict';var multer=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var path=require(_0xf894('0x2'));var timeout=require(_0xf894('0x3'));var express=require(_0xf894('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf894('0x5'));var interaction=require(_0xf894('0x6'));var config=require(_0xf894('0x7'));var controller=require(_0xf894('0x8'));router[_0xf894('0x9')]('/',auth[_0xf894('0xa')](),controller[_0xf894('0xb')]);router[_0xf894('0x9')](_0xf894('0xc'),auth[_0xf894('0xa')](),controller[_0xf894('0xd')]);router[_0xf894('0x9')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0xf894('0xe')]);router[_0xf894('0x9')](_0xf894('0xf'),auth[_0xf894('0x10')](),controller[_0xf894('0x11')]);router[_0xf894('0x9')](_0xf894('0x12'),auth[_0xf894('0xa')](),controller[_0xf894('0x13')]);router[_0xf894('0x9')](_0xf894('0x14'),auth[_0xf894('0x10')](),controller[_0xf894('0x15')]);router[_0xf894('0x9')](_0xf894('0x16'),auth[_0xf894('0xa')](),controller['download']);router[_0xf894('0x17')]('/',auth[_0xf894('0xa')](),controller['create']);router[_0xf894('0x17')](_0xf894('0x18'),auth[_0xf894('0xa')](),controller[_0xf894('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcc4a0c,_0x2a6475,_0x55187f){_0x55187f(null,path['join'](config[_0xf894('0x1a')],'server/files/attachments/'));},'filename':function(_0xa442db,_0x583951,_0x482aab){_0x482aab(null,util['format'](_0xf894('0x1b'),Date[_0xf894('0x1c')](),_0x583951[_0xf894('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xf894('0x1e'),upload[_0xf894('0x1f')](_0xf894('0x20')),controller[_0xf894('0x21')]);router[_0xf894('0x17')](_0xf894('0x12'),auth[_0xf894('0x10')](),controller[_0xf894('0x22')]);router[_0xf894('0x17')]('/:id/tags',auth[_0xf894('0xa')](),interaction[_0xf894('0x23')](_0xf894('0x24'),_0xf894('0x25')),controller['addTags']);router[_0xf894('0x26')](_0xf894('0x27'),auth[_0xf894('0xa')](),interaction['tracked']('chat',_0xf894('0x28')),controller[_0xf894('0x29')]);router[_0xf894('0x26')](_0xf894('0x2a'),controller[_0xf894('0x2b')]);router[_0xf894('0x26')]('/:id/abandon',auth[_0xf894('0x10')](),controller['abandon']);router[_0xf894('0x26')]('/:id/close',controller['close']);router[_0xf894('0x2c')](_0xf894('0x27'),auth[_0xf894('0xa')](),interaction[_0xf894('0x23')](_0xf894('0x24'),'chatinteraction:destroy'),controller[_0xf894('0x2d')]);router['delete'](_0xf894('0x2e'),auth[_0xf894('0xa')](),controller[_0xf894('0x2f')]);module[_0xf894('0x30')]=router; \ No newline at end of file +var _0xeb50=['post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','/:id/attachment_upload','file','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chat','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xeb50,0x167));var _0x0eb5=function(_0xfdec06,_0x9fa2f4){_0xfdec06=_0xfdec06-0x0;var _0x58a539=_0xeb50[_0xfdec06];return _0x58a539;};'use strict';var multer=require(_0x0eb5('0x0'));var util=require(_0x0eb5('0x1'));var path=require(_0x0eb5('0x2'));var timeout=require(_0x0eb5('0x3'));var express=require(_0x0eb5('0x4'));var router=express[_0x0eb5('0x5')]();var fs_extra=require(_0x0eb5('0x6'));var auth=require(_0x0eb5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0eb5('0x8'));var controller=require(_0x0eb5('0x9'));router[_0x0eb5('0xa')]('/',auth[_0x0eb5('0xb')](),controller[_0x0eb5('0xc')]);router[_0x0eb5('0xa')](_0x0eb5('0xd'),auth[_0x0eb5('0xb')](),controller[_0x0eb5('0xe')]);router[_0x0eb5('0xa')](_0x0eb5('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x0eb5('0x10')]);router[_0x0eb5('0xa')](_0x0eb5('0x11'),auth[_0x0eb5('0x12')](),controller[_0x0eb5('0x13')]);router[_0x0eb5('0xa')](_0x0eb5('0x14'),auth['isAuthenticated'](),controller[_0x0eb5('0x15')]);router[_0x0eb5('0xa')](_0x0eb5('0x16'),auth[_0x0eb5('0x12')](),controller[_0x0eb5('0x17')]);router[_0x0eb5('0xa')](_0x0eb5('0x18'),auth[_0x0eb5('0xb')](),controller[_0x0eb5('0x19')]);router[_0x0eb5('0x1a')]('/',auth[_0x0eb5('0xb')](),controller[_0x0eb5('0x1b')]);router[_0x0eb5('0x1a')](_0x0eb5('0x1c'),auth[_0x0eb5('0xb')](),controller[_0x0eb5('0x1d')]);var upload=multer({'storage':multer[_0x0eb5('0x1e')]({'destination':function(_0x238265,_0x120cc4,_0x4f51e8){_0x4f51e8(null,path[_0x0eb5('0x1f')](config[_0x0eb5('0x20')],'server/files/attachments/'));},'filename':function(_0x47e1f0,_0x23799f,_0x1136f5){_0x1136f5(null,util[_0x0eb5('0x21')](_0x0eb5('0x22'),Date['now'](),_0x23799f[_0x0eb5('0x23')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0eb5('0x1a')](_0x0eb5('0x24'),upload['single'](_0x0eb5('0x25')),controller['attachmentUpload']);router[_0x0eb5('0x1a')](_0x0eb5('0x14'),auth[_0x0eb5('0x12')](),controller['addMessage']);router[_0x0eb5('0x1a')](_0x0eb5('0x26'),auth[_0x0eb5('0xb')](),interaction['tracked']('chat',_0x0eb5('0x27')),controller[_0x0eb5('0x28')]);router[_0x0eb5('0x29')](_0x0eb5('0xf'),auth[_0x0eb5('0xb')](),interaction[_0x0eb5('0x2a')](_0x0eb5('0x2b'),'chatinteraction:update'),controller[_0x0eb5('0x2c')]);router[_0x0eb5('0x29')](_0x0eb5('0x2d'),controller[_0x0eb5('0x2e')]);router['put']('/:id/abandon',auth[_0x0eb5('0x12')](),controller[_0x0eb5('0x2f')]);router['put'](_0x0eb5('0x30'),controller[_0x0eb5('0x31')]);router['delete']('/:id',auth[_0x0eb5('0xb')](),interaction[_0x0eb5('0x2a')](_0x0eb5('0x2b'),_0x0eb5('0x32')),controller[_0x0eb5('0x33')]);router[_0x0eb5('0x34')](_0x0eb5('0x26'),auth['isAuthenticated'](),controller[_0x0eb5('0x35')]);module[_0x0eb5('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ac4a00e..5ff9032 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 _0xd95d=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd95d,0x16e));var _0xdd95=function(_0x3adb1e,_0x2145b0){_0x3adb1e=_0x3adb1e-0x0;var _0xe5dba9=_0xd95d[_0x3adb1e];return _0xe5dba9;};'use strict';var Sequelize=require(_0xdd95('0x0'));module[_0xdd95('0x1')]={'body':{'type':Sequelize[_0xdd95('0x2')](_0xdd95('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdd95('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdd95('0x5')]}}; \ No newline at end of file +var _0x6855=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x3a0512,_0x2f78ea){var _0x1a8fd7=function(_0x48cbaa){while(--_0x48cbaa){_0x3a0512['push'](_0x3a0512['shift']());}};_0x1a8fd7(++_0x2f78ea);}(_0x6855,0xe0));var _0x5685=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x6855[_0x5cbf0e];return _0x1c76f8;};'use strict';var Sequelize=require(_0x5685('0x0'));module['exports']={'body':{'type':Sequelize[_0x5685('0x1')](_0x5685('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5685('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5685('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fefc494..ba06d89 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 _0x5e4a=['params','rawAttributes','catch','create','body','find','describe','messages','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','online','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','createdAt','FromId','ToId','-createdAt','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','ChatInternalMessage','findAll','rows'];(function(_0xe503ff,_0xc9e5e4){var _0x345c46=function(_0x3f6bc7){while(--_0x3f6bc7){_0xe503ff['push'](_0xe503ff['shift']());}};_0x345c46(++_0xc9e5e4);}(_0x5e4a,0xf3));var _0xa5e4=function(_0x5a42b2,_0x49e23f){_0x5a42b2=_0x5a42b2-0x0;var _0x6fa38d=_0x5e4a[_0x5a42b2];return _0x6fa38d;};'use strict';var emlformat=require(_0xa5e4('0x0'));var rimraf=require(_0xa5e4('0x1'));var zipdir=require(_0xa5e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5e4('0x3'));var moment=require(_0xa5e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5e4('0x5'));var util=require(_0xa5e4('0x6'));var path=require('path');var sox=require(_0xa5e4('0x7'));var csv=require(_0xa5e4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5e4('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa5e4('0xa'));var jsforce=require(_0xa5e4('0xb'));var deskjs=require(_0xa5e4('0xc'));var toCsv=require(_0xa5e4('0x8'));var querystring=require(_0xa5e4('0xd'));var Papa=require('papaparse');var Redis=require(_0xa5e4('0xe'));var authService=require(_0xa5e4('0xf'));var qs=require(_0xa5e4('0x10'));var as=require(_0xa5e4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa5e4('0x12'));var utils=require(_0xa5e4('0x13'));var config=require(_0xa5e4('0x14'));var licenseUtil=require(_0xa5e4('0x15'));var db=require(_0xa5e4('0x16'))['db'];config['redis']=_[_0xa5e4('0x17')](config[_0xa5e4('0x18')],{'host':_0xa5e4('0x19'),'port':0x18eb});var socket=require(_0xa5e4('0x1a'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xa5e4('0x1b')](socket);function respondWithStatusCode(_0xe84edd,_0x2a6440){_0x2a6440=_0x2a6440||0xcc;return function(_0x4a79bc){if(_0x4a79bc){return _0xe84edd['sendStatus'](_0x2a6440);}return _0xe84edd[_0xa5e4('0x1c')](_0x2a6440)['end']();};}function respondWithResult(_0x533a52,_0x4a5416){_0x4a5416=_0x4a5416||0xc8;return function(_0x3bd692){if(_0x3bd692){return _0x533a52[_0xa5e4('0x1c')](_0x4a5416)[_0xa5e4('0x1d')](_0x3bd692);}};}function respondWithFilteredResult(_0x1901f6,_0x165fa3){return function(_0x164a21){if(_0x164a21){var _0x51ebee=typeof _0x165fa3['offset']===_0xa5e4('0x1e')&&typeof _0x165fa3[_0xa5e4('0x1f')]===_0xa5e4('0x1e');var _0x176b21=_0x164a21[_0xa5e4('0x20')];var _0x1d3622=_0x51ebee?0x0:_0x165fa3[_0xa5e4('0x21')];var _0x2c957a=_0x51ebee?_0x164a21[_0xa5e4('0x20')]:_0x165fa3[_0xa5e4('0x21')]+_0x165fa3['limit'];var _0x26185b;if(_0x2c957a>=_0x176b21){_0x2c957a=_0x176b21;_0x26185b=0xc8;}else{_0x26185b=0xce;}_0x1901f6[_0xa5e4('0x1c')](_0x26185b);return _0x1901f6['set'](_0xa5e4('0x22'),_0x1d3622+'-'+_0x2c957a+'/'+_0x176b21)[_0xa5e4('0x1d')](_0x164a21);}return null;};}function patchUpdates(_0x3fe2d8){return function(_0x297820){try{jsonpatch[_0xa5e4('0x23')](_0x297820,_0x3fe2d8,!![]);}catch(_0x21e677){return BPromise[_0xa5e4('0x24')](_0x21e677);}return _0x297820[_0xa5e4('0x25')]();};}function saveUpdates(_0x200ce1,_0x584631){return function(_0x3eb5ad){if(_0x3eb5ad){return _0x3eb5ad[_0xa5e4('0x26')](_0x200ce1)['then'](function(_0x51b027){return _0x51b027;});}return null;};}function removeEntity(_0x2ed137,_0x43311a){return function(_0x426967){if(_0x426967){return _0x426967[_0xa5e4('0x27')]()[_0xa5e4('0x28')](function(){_0x2ed137[_0xa5e4('0x1c')](0xcc)[_0xa5e4('0x29')]();});}};}function handleEntityNotFound(_0x3a5d08,_0xe4e21f){return function(_0xbc8455){if(!_0xbc8455){_0x3a5d08[_0xa5e4('0x2a')](0x194);}return _0xbc8455;};}function handleError(_0x59204b,_0x2290cc){_0x2290cc=_0x2290cc||0x1f4;return function(_0x4d0859){logger[_0xa5e4('0x2b')](_0x4d0859[_0xa5e4('0x2c')]);if(_0x4d0859[_0xa5e4('0x2d')]){delete _0x4d0859[_0xa5e4('0x2d')];}_0x59204b['status'](_0x2290cc)[_0xa5e4('0x2e')](_0x4d0859);};}exports[_0xa5e4('0x2f')]=function(_0x5a6ba8,_0xf2498a){var _0x2ca8d6={},_0x34d2d4={},_0x4e4df6={'count':0x0,'rows':[]};var _0x4fcb5c=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x52ee6b){return{'name':_0x52ee6b[_0xa5e4('0x30')],'type':_0x52ee6b[_0xa5e4('0x31')][_0xa5e4('0x32')]};});_0x34d2d4[_0xa5e4('0x33')]=_['map'](_0x4fcb5c,_0xa5e4('0x2d'));_0x34d2d4[_0xa5e4('0x34')]=_[_0xa5e4('0x35')](_0x5a6ba8['query']);_0x34d2d4[_0xa5e4('0x36')]=_[_0xa5e4('0x37')](_0x34d2d4['model'],_0x34d2d4[_0xa5e4('0x34')]);_0x2ca8d6['attributes']=_[_0xa5e4('0x37')](_0x34d2d4[_0xa5e4('0x33')],qs[_0xa5e4('0x38')](_0x5a6ba8[_0xa5e4('0x34')][_0xa5e4('0x38')]));_0x2ca8d6[_0xa5e4('0x39')]=_0x2ca8d6['attributes'][_0xa5e4('0x3a')]?_0x2ca8d6[_0xa5e4('0x39')]:_0x34d2d4['model'];if(!_0x5a6ba8['query'][_0xa5e4('0x3b')](_0xa5e4('0x3c'))){_0x2ca8d6[_0xa5e4('0x1f')]=qs[_0xa5e4('0x1f')](_0x5a6ba8[_0xa5e4('0x34')][_0xa5e4('0x1f')]);_0x2ca8d6['offset']=qs[_0xa5e4('0x21')](_0x5a6ba8[_0xa5e4('0x34')][_0xa5e4('0x21')]);}_0x2ca8d6['order']=qs['sort'](_0x5a6ba8[_0xa5e4('0x34')][_0xa5e4('0x3d')]);_0x2ca8d6[_0xa5e4('0x3e')]=qs['filters'](_[_0xa5e4('0x3f')](_0x5a6ba8['query'],_0x34d2d4[_0xa5e4('0x36')]),_0x4fcb5c);if(_0x5a6ba8['query'][_0xa5e4('0x40')]){_0x2ca8d6['where']=_[_0xa5e4('0x41')](_0x2ca8d6[_0xa5e4('0x3e')],{'$or':_['map'](_0x4fcb5c,function(_0x4a2881){if(_0x4a2881[_0xa5e4('0x31')]!=='VIRTUAL'){var _0x2cfc51={};_0x2cfc51[_0x4a2881[_0xa5e4('0x2d')]]={'$like':'%'+_0x5a6ba8[_0xa5e4('0x34')][_0xa5e4('0x40')]+'%'};return _0x2cfc51;}})});}_0x2ca8d6=_['merge']({},_0x2ca8d6,_0x5a6ba8[_0xa5e4('0x42')]);var _0x388b41={'where':_0x2ca8d6['where']};return db['ChatInternalMessage']['count'](_0x388b41)['then'](function(_0x40126b){_0x4e4df6[_0xa5e4('0x20')]=_0x40126b;if(_0x5a6ba8[_0xa5e4('0x34')][_0xa5e4('0x43')]){_0x2ca8d6[_0xa5e4('0x44')]=[{'all':!![]}];}return db[_0xa5e4('0x45')][_0xa5e4('0x46')](_0x2ca8d6);})[_0xa5e4('0x28')](function(_0x294939){_0x4e4df6[_0xa5e4('0x47')]=_0x294939;return _0x4e4df6;})['then'](respondWithFilteredResult(_0xf2498a,_0x2ca8d6))['catch'](handleError(_0xf2498a,null));};exports['show']=function(_0x4ffd64,_0x3689b5){var _0x52740c={'raw':!![],'where':{'id':_0x4ffd64[_0xa5e4('0x48')]['id']}},_0x5f16cd={};_0x5f16cd[_0xa5e4('0x33')]=_['keys'](db[_0xa5e4('0x45')][_0xa5e4('0x49')]);_0x5f16cd[_0xa5e4('0x34')]=_[_0xa5e4('0x35')](_0x4ffd64[_0xa5e4('0x34')]);_0x5f16cd['filters']=_['intersection'](_0x5f16cd[_0xa5e4('0x33')],_0x5f16cd[_0xa5e4('0x34')]);_0x52740c[_0xa5e4('0x39')]=_[_0xa5e4('0x37')](_0x5f16cd['model'],qs[_0xa5e4('0x38')](_0x4ffd64[_0xa5e4('0x34')][_0xa5e4('0x38')]));_0x52740c[_0xa5e4('0x39')]=_0x52740c[_0xa5e4('0x39')][_0xa5e4('0x3a')]?_0x52740c[_0xa5e4('0x39')]:_0x5f16cd['model'];if(_0x4ffd64[_0xa5e4('0x34')][_0xa5e4('0x43')]){_0x52740c[_0xa5e4('0x44')]=[{'all':!![]}];}_0x52740c=_['merge']({},_0x52740c,_0x4ffd64['options']);return db['ChatInternalMessage']['find'](_0x52740c)[_0xa5e4('0x28')](handleEntityNotFound(_0x3689b5,null))[_0xa5e4('0x28')](respondWithResult(_0x3689b5,null))[_0xa5e4('0x4a')](handleError(_0x3689b5,null));};exports[_0xa5e4('0x4b')]=function(_0x312695,_0x85e375){return db[_0xa5e4('0x45')][_0xa5e4('0x4b')](_0x312695[_0xa5e4('0x4c')],{})[_0xa5e4('0x28')](respondWithResult(_0x85e375,0xc9))[_0xa5e4('0x4a')](handleError(_0x85e375,null));};exports[_0xa5e4('0x26')]=function(_0x3ded6c,_0x217afd){if(_0x3ded6c[_0xa5e4('0x4c')]['id']){delete _0x3ded6c[_0xa5e4('0x4c')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x3ded6c['params']['id']}})['then'](handleEntityNotFound(_0x217afd,null))[_0xa5e4('0x28')](saveUpdates(_0x3ded6c[_0xa5e4('0x4c')],null))[_0xa5e4('0x28')](respondWithResult(_0x217afd,null))[_0xa5e4('0x4a')](handleError(_0x217afd,null));};exports[_0xa5e4('0x27')]=function(_0x2a1a58,_0x30bafe){return db['ChatInternalMessage'][_0xa5e4('0x4d')]({'where':{'id':_0x2a1a58[_0xa5e4('0x48')]['id']}})[_0xa5e4('0x28')](handleEntityNotFound(_0x30bafe,null))[_0xa5e4('0x28')](removeEntity(_0x30bafe,null))[_0xa5e4('0x4a')](handleError(_0x30bafe,null));};exports[_0xa5e4('0x4e')]=function(_0x35bd0c,_0x35e1f8){return db[_0xa5e4('0x45')][_0xa5e4('0x4e')]()[_0xa5e4('0x28')](respondWithResult(_0x35e1f8,null))[_0xa5e4('0x4a')](handleError(_0x35e1f8,null));};function wrapUser(_0x34794c){return function(_0x237413){var _0x4f8480=_0x34794c['get']({'plain':!![]});_0x4f8480[_0xa5e4('0x4f')]=[];if(_0x237413){_0x4f8480['lastMessageAt']=_0x237413['createdAt'];_0x4f8480[_0xa5e4('0x50')]=_0x237413;}else{_0x4f8480[_0xa5e4('0x51')]=moment(0x0)['format'](_0xa5e4('0x52'));_0x4f8480['lastMessage']={};}return _0x4f8480;};}exports[_0xa5e4('0x53')]=function(_0x3ec843,_0x4dbc21,_0x12d70a){var _0x1dc79a=[];return db['User'][_0xa5e4('0x46')]({'where':{'role':[_0xa5e4('0x54'),'admin',_0xa5e4('0x55')]},'attributes':['id',_0xa5e4('0x56'),_0xa5e4('0x2d'),_0xa5e4('0x57'),_0xa5e4('0x58'),'internal',_0xa5e4('0x59'),'lastLoginAt',_0xa5e4('0x5a'),_0xa5e4('0x5b')],'order':qs[_0xa5e4('0x3d')]('-online'),'include':[{'model':db[_0xa5e4('0x5c')],'as':'VoiceQueues','attributes':['id',_0xa5e4('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xa5e4('0x28')](function(_0x48fe88){if(_0x48fe88){var _0x1014df=_0x3ec843[_0xa5e4('0x55')]['get']({'plain':!![]});if(!_0x1014df)throw new Error(_0xa5e4('0x5d'));if(_0x1014df[_0xa5e4('0x57')]===_0xa5e4('0x55')){return db[_0xa5e4('0x5e')][_0xa5e4('0x4d')]({'where':{'name':_0xa5e4('0x5f'),'userProfileId':_0x1014df[_0xa5e4('0x60')]},'raw':!![]})[_0xa5e4('0x28')](function(_0x2282bf){if(_0x2282bf){if(_0x2282bf[_0xa5e4('0x61')]===0x0){return db[_0xa5e4('0x62')][_0xa5e4('0x46')]({'where':{'sectionId':_0x2282bf['id']},'raw':!![]})['then'](function(_0x2fe9be){var _0x1b9abc=[];if(_[_0xa5e4('0x63')](_0x2fe9be)){_0x1b9abc=_[_0xa5e4('0x40')](_0x48fe88,function(_0x18359b){if(_0x18359b[_0xa5e4('0x57')]!=='agent'){return _0x18359b;}});return _0x1b9abc;}else{for(var _0x400218=0x0;_0x400218<_0x48fe88['length'];_0x400218++){var _0x5418df=_0x48fe88[_0x400218];if(_0x5418df['role']===_0xa5e4('0x54')){var _0x46e582=_[_0xa5e4('0x4d')](_0x2fe9be,function(_0xfb472f){return _0xfb472f['resourceId']===_0x5418df['id'];});if(_0x46e582)_0x1b9abc['push'](_0x5418df);}else{_0x1b9abc['push'](_0x5418df);}}return _0x1b9abc;}});}else{return _0x48fe88;}}else{var _0x525212=_[_0xa5e4('0x40')](_0x48fe88,function(_0x21e68d){if(_0x21e68d[_0xa5e4('0x57')]!=='agent'){return _0x21e68d;}});return _0x525212;}});}else{return _0x48fe88;}}})[_0xa5e4('0x28')](function(_0x3b3bb8){var _0x56ee2a=[];if(_0x3b3bb8){_0x1dc79a=_0x3b3bb8;for(var _0x25ca2b=0x0;_0x25ca2b<_0x3b3bb8[_0xa5e4('0x3a')];_0x25ca2b+=0x1){_0x1dc79a[_0x25ca2b][_0xa5e4('0x4f')]=[];_0x56ee2a[_0xa5e4('0x64')](db[_0xa5e4('0x45')][_0xa5e4('0x4d')]({'where':{'FromId':[_0x3ec843[_0xa5e4('0x55')]['id'],_0x3b3bb8[_0x25ca2b]['id']],'ToId':[_0x3ec843[_0xa5e4('0x55')]['id'],_0x3b3bb8[_0x25ca2b]['id']],'ChatGroupId':null},'attributes':['id',_0xa5e4('0x65'),_0xa5e4('0x66'),_0xa5e4('0x67'),'read',_0xa5e4('0x4c')],'order':qs[_0xa5e4('0x3d')](_0xa5e4('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa5e4('0x28')](wrapUser(_0x3b3bb8[_0x25ca2b])));}return BPromise['all'](_0x56ee2a);}return[];})[_0xa5e4('0x28')](function(_0x9a5f3f){return{'rows':_0x9a5f3f,'count':_0x9a5f3f[_0xa5e4('0x3a')]};})[_0xa5e4('0x28')](respondWithResult(_0x4dbc21,null))['catch'](handleError(_0x4dbc21,null));}; \ No newline at end of file +var _0x6599=['VIRTUAL','options','ChatInternalMessage','count','includeAll','include','rows','catch','show','find','create','body','params','describe','get','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','messages','FromId','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type'];(function(_0x32ab63,_0x4d6d70){var _0x18af42=function(_0x25397a){while(--_0x25397a){_0x32ab63['push'](_0x32ab63['shift']());}};_0x18af42(++_0x4d6d70);}(_0x6599,0xa3));var _0x9659=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x6599[_0x590a38];return _0xf36626;};'use strict';var emlformat=require(_0x9659('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9659('0x1'));var jsonpatch=require(_0x9659('0x2'));var rp=require(_0x9659('0x3'));var moment=require(_0x9659('0x4'));var BPromise=require(_0x9659('0x5'));var Mustache=require(_0x9659('0x6'));var util=require(_0x9659('0x7'));var path=require('path');var sox=require(_0x9659('0x8'));var csv=require(_0x9659('0x9'));var ejs=require(_0x9659('0xa'));var fs=require('fs');var fs_extra=require(_0x9659('0xb'));var _=require(_0x9659('0xc'));var squel=require(_0x9659('0xd'));var crypto=require(_0x9659('0xe'));var jsforce=require(_0x9659('0xf'));var deskjs=require(_0x9659('0x10'));var toCsv=require(_0x9659('0x9'));var querystring=require(_0x9659('0x11'));var Papa=require(_0x9659('0x12'));var Redis=require(_0x9659('0x13'));var authService=require(_0x9659('0x14'));var qs=require(_0x9659('0x15'));var as=require(_0x9659('0x16'));var hardwareService=require(_0x9659('0x17'));var logger=require(_0x9659('0x18'))(_0x9659('0x19'));var utils=require('../../config/utils');var config=require(_0x9659('0x1a'));var licenseUtil=require(_0x9659('0x1b'));var db=require(_0x9659('0x1c'))['db'];config[_0x9659('0x1d')]=_[_0x9659('0x1e')](config[_0x9659('0x1d')],{'host':_0x9659('0x1f'),'port':0x18eb});var socket=require(_0x9659('0x20'))(new Redis(config[_0x9659('0x1d')]));require(_0x9659('0x21'))['register'](socket);function respondWithStatusCode(_0x2223ed,_0x4db09e){_0x4db09e=_0x4db09e||0xcc;return function(_0x528ea3){if(_0x528ea3){return _0x2223ed[_0x9659('0x22')](_0x4db09e);}return _0x2223ed[_0x9659('0x23')](_0x4db09e)['end']();};}function respondWithResult(_0x3b0407,_0x192bea){_0x192bea=_0x192bea||0xc8;return function(_0x1c2dfb){if(_0x1c2dfb){return _0x3b0407[_0x9659('0x23')](_0x192bea)[_0x9659('0x24')](_0x1c2dfb);}};}function respondWithFilteredResult(_0x4fe3ed,_0x247e37){return function(_0x15080a){if(_0x15080a){var _0xb23d4d=typeof _0x247e37['offset']==='undefined'&&typeof _0x247e37['limit']==='undefined';var _0x54a632=_0x15080a['count'];var _0x46766b=_0xb23d4d?0x0:_0x247e37[_0x9659('0x25')];var _0x2e8f1c=_0xb23d4d?_0x15080a['count']:_0x247e37[_0x9659('0x25')]+_0x247e37['limit'];var _0x473875;if(_0x2e8f1c>=_0x54a632){_0x2e8f1c=_0x54a632;_0x473875=0xc8;}else{_0x473875=0xce;}_0x4fe3ed[_0x9659('0x23')](_0x473875);return _0x4fe3ed[_0x9659('0x26')](_0x9659('0x27'),_0x46766b+'-'+_0x2e8f1c+'/'+_0x54a632)['json'](_0x15080a);}return null;};}function patchUpdates(_0x340ac6){return function(_0x359ba6){try{jsonpatch[_0x9659('0x28')](_0x359ba6,_0x340ac6,!![]);}catch(_0x7fff1c){return BPromise[_0x9659('0x29')](_0x7fff1c);}return _0x359ba6[_0x9659('0x2a')]();};}function saveUpdates(_0x5f4400,_0x341eec){return function(_0x459e4f){if(_0x459e4f){return _0x459e4f[_0x9659('0x2b')](_0x5f4400)[_0x9659('0x2c')](function(_0x423986){return _0x423986;});}return null;};}function removeEntity(_0x500ecd,_0x566674){return function(_0x24e83c){if(_0x24e83c){return _0x24e83c[_0x9659('0x2d')]()[_0x9659('0x2c')](function(){_0x500ecd[_0x9659('0x23')](0xcc)[_0x9659('0x2e')]();});}};}function handleEntityNotFound(_0x2f5f48,_0x47e2f7){return function(_0xc3eb55){if(!_0xc3eb55){_0x2f5f48[_0x9659('0x22')](0x194);}return _0xc3eb55;};}function handleError(_0x565063,_0x32b593){_0x32b593=_0x32b593||0x1f4;return function(_0x14506f){logger[_0x9659('0x2f')](_0x14506f[_0x9659('0x30')]);if(_0x14506f['name']){delete _0x14506f[_0x9659('0x31')];}_0x565063[_0x9659('0x23')](_0x32b593)[_0x9659('0x32')](_0x14506f);};}exports['index']=function(_0x603430,_0x222396){var _0x239930={},_0x2d28a7={},_0x20e2dc={'count':0x0,'rows':[]};var _0x39a1ca=_[_0x9659('0x33')](db['ChatInternalMessage'][_0x9659('0x34')],function(_0x9a7c7d){return{'name':_0x9a7c7d[_0x9659('0x35')],'type':_0x9a7c7d['type'][_0x9659('0x36')]};});_0x2d28a7[_0x9659('0x37')]=_[_0x9659('0x33')](_0x39a1ca,_0x9659('0x31'));_0x2d28a7[_0x9659('0x38')]=_[_0x9659('0x39')](_0x603430[_0x9659('0x38')]);_0x2d28a7[_0x9659('0x3a')]=_[_0x9659('0x3b')](_0x2d28a7[_0x9659('0x37')],_0x2d28a7[_0x9659('0x38')]);_0x239930['attributes']=_[_0x9659('0x3b')](_0x2d28a7[_0x9659('0x37')],qs[_0x9659('0x3c')](_0x603430['query'][_0x9659('0x3c')]));_0x239930[_0x9659('0x3d')]=_0x239930[_0x9659('0x3d')][_0x9659('0x3e')]?_0x239930[_0x9659('0x3d')]:_0x2d28a7[_0x9659('0x37')];if(!_0x603430[_0x9659('0x38')][_0x9659('0x3f')](_0x9659('0x40'))){_0x239930['limit']=qs[_0x9659('0x41')](_0x603430['query']['limit']);_0x239930[_0x9659('0x25')]=qs[_0x9659('0x25')](_0x603430['query']['offset']);}_0x239930[_0x9659('0x42')]=qs[_0x9659('0x43')](_0x603430[_0x9659('0x38')][_0x9659('0x43')]);_0x239930[_0x9659('0x44')]=qs['filters'](_[_0x9659('0x45')](_0x603430[_0x9659('0x38')],_0x2d28a7[_0x9659('0x3a')]),_0x39a1ca);if(_0x603430['query'][_0x9659('0x46')]){_0x239930[_0x9659('0x44')]=_[_0x9659('0x47')](_0x239930['where'],{'$or':_[_0x9659('0x33')](_0x39a1ca,function(_0x9f21d4){if(_0x9f21d4[_0x9659('0x48')]!==_0x9659('0x49')){var _0x298bed={};_0x298bed[_0x9f21d4['name']]={'$like':'%'+_0x603430[_0x9659('0x38')][_0x9659('0x46')]+'%'};return _0x298bed;}})});}_0x239930=_[_0x9659('0x47')]({},_0x239930,_0x603430[_0x9659('0x4a')]);var _0x10aaa8={'where':_0x239930[_0x9659('0x44')]};return db[_0x9659('0x4b')][_0x9659('0x4c')](_0x10aaa8)[_0x9659('0x2c')](function(_0x1ce4a6){_0x20e2dc[_0x9659('0x4c')]=_0x1ce4a6;if(_0x603430['query'][_0x9659('0x4d')]){_0x239930[_0x9659('0x4e')]=[{'all':!![]}];}return db[_0x9659('0x4b')]['findAll'](_0x239930);})['then'](function(_0x273aa0){_0x20e2dc[_0x9659('0x4f')]=_0x273aa0;return _0x20e2dc;})[_0x9659('0x2c')](respondWithFilteredResult(_0x222396,_0x239930))[_0x9659('0x50')](handleError(_0x222396,null));};exports[_0x9659('0x51')]=function(_0x18cda7,_0x56f2c7){var _0x33c23b={'raw':!![],'where':{'id':_0x18cda7['params']['id']}},_0x3e72a9={};_0x3e72a9[_0x9659('0x37')]=_[_0x9659('0x39')](db[_0x9659('0x4b')][_0x9659('0x34')]);_0x3e72a9[_0x9659('0x38')]=_[_0x9659('0x39')](_0x18cda7[_0x9659('0x38')]);_0x3e72a9['filters']=_[_0x9659('0x3b')](_0x3e72a9[_0x9659('0x37')],_0x3e72a9[_0x9659('0x38')]);_0x33c23b[_0x9659('0x3d')]=_[_0x9659('0x3b')](_0x3e72a9['model'],qs[_0x9659('0x3c')](_0x18cda7[_0x9659('0x38')][_0x9659('0x3c')]));_0x33c23b['attributes']=_0x33c23b[_0x9659('0x3d')][_0x9659('0x3e')]?_0x33c23b[_0x9659('0x3d')]:_0x3e72a9[_0x9659('0x37')];if(_0x18cda7['query'][_0x9659('0x4d')]){_0x33c23b['include']=[{'all':!![]}];}_0x33c23b=_[_0x9659('0x47')]({},_0x33c23b,_0x18cda7[_0x9659('0x4a')]);return db[_0x9659('0x4b')][_0x9659('0x52')](_0x33c23b)['then'](handleEntityNotFound(_0x56f2c7,null))[_0x9659('0x2c')](respondWithResult(_0x56f2c7,null))['catch'](handleError(_0x56f2c7,null));};exports['create']=function(_0x1faecd,_0x10c367){return db[_0x9659('0x4b')][_0x9659('0x53')](_0x1faecd[_0x9659('0x54')],{})[_0x9659('0x2c')](respondWithResult(_0x10c367,0xc9))[_0x9659('0x50')](handleError(_0x10c367,null));};exports[_0x9659('0x2b')]=function(_0x222842,_0x39a1e1){if(_0x222842[_0x9659('0x54')]['id']){delete _0x222842[_0x9659('0x54')]['id'];}return db[_0x9659('0x4b')][_0x9659('0x52')]({'where':{'id':_0x222842[_0x9659('0x55')]['id']}})['then'](handleEntityNotFound(_0x39a1e1,null))[_0x9659('0x2c')](saveUpdates(_0x222842['body'],null))[_0x9659('0x2c')](respondWithResult(_0x39a1e1,null))[_0x9659('0x50')](handleError(_0x39a1e1,null));};exports[_0x9659('0x2d')]=function(_0x1dcb46,_0x39e998){return db[_0x9659('0x4b')][_0x9659('0x52')]({'where':{'id':_0x1dcb46['params']['id']}})[_0x9659('0x2c')](handleEntityNotFound(_0x39e998,null))[_0x9659('0x2c')](removeEntity(_0x39e998,null))[_0x9659('0x50')](handleError(_0x39e998,null));};exports[_0x9659('0x56')]=function(_0x5cad7d,_0x469c35){return db[_0x9659('0x4b')][_0x9659('0x56')]()['then'](respondWithResult(_0x469c35,null))[_0x9659('0x50')](handleError(_0x469c35,null));};function wrapUser(_0xe06b74){return function(_0x237321){var _0x4acd2a=_0xe06b74[_0x9659('0x57')]({'plain':!![]});_0x4acd2a['messages']=[];if(_0x237321){_0x4acd2a['lastMessageAt']=_0x237321['createdAt'];_0x4acd2a['lastMessage']=_0x237321;}else{_0x4acd2a[_0x9659('0x58')]=moment(0x0)[_0x9659('0x59')](_0x9659('0x5a'));_0x4acd2a[_0x9659('0x5b')]={};}return _0x4acd2a;};}exports[_0x9659('0x5c')]=function(_0x2c2a54,_0x131094,_0x5ce62b){var _0x28fea9=[];return db[_0x9659('0x5d')][_0x9659('0x5e')]({'where':{'role':[_0x9659('0x5f'),_0x9659('0x60'),_0x9659('0x61')]},'attributes':['id','fullname',_0x9659('0x31'),_0x9659('0x62'),_0x9659('0x63'),_0x9659('0x64'),_0x9659('0x65'),_0x9659('0x66'),_0x9659('0x67'),_0x9659('0x68')],'order':qs[_0x9659('0x43')](_0x9659('0x69')),'include':[{'model':db[_0x9659('0x6a')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x9659('0x2c')](function(_0x5e80a0){if(_0x5e80a0){var _0x4caba1=_0x2c2a54['user'][_0x9659('0x57')]({'plain':!![]});if(!_0x4caba1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4caba1[_0x9659('0x62')]===_0x9659('0x61')){return db['UserProfileSection'][_0x9659('0x52')]({'where':{'name':_0x9659('0x6b'),'userProfileId':_0x4caba1[_0x9659('0x6c')]},'raw':!![]})[_0x9659('0x2c')](function(_0x51b656){if(_0x51b656){if(_0x51b656[_0x9659('0x6d')]===0x0){return db[_0x9659('0x6e')][_0x9659('0x5e')]({'where':{'sectionId':_0x51b656['id']},'raw':!![]})[_0x9659('0x2c')](function(_0x252e68){var _0x4a45b2=[];if(_[_0x9659('0x6f')](_0x252e68)){_0x4a45b2=_['filter'](_0x5e80a0,function(_0x33a432){if(_0x33a432[_0x9659('0x62')]!==_0x9659('0x5f')){return _0x33a432;}});return _0x4a45b2;}else{for(var _0x8357da=0x0;_0x8357da<_0x5e80a0[_0x9659('0x3e')];_0x8357da++){var _0x240e07=_0x5e80a0[_0x8357da];if(_0x240e07[_0x9659('0x62')]==='agent'){var _0x4aff2b=_[_0x9659('0x52')](_0x252e68,function(_0x17aee1){return _0x17aee1['resourceId']===_0x240e07['id'];});if(_0x4aff2b)_0x4a45b2[_0x9659('0x70')](_0x240e07);}else{_0x4a45b2[_0x9659('0x70')](_0x240e07);}}return _0x4a45b2;}});}else{return _0x5e80a0;}}else{var _0x5c6f78=_[_0x9659('0x46')](_0x5e80a0,function(_0x285a46){if(_0x285a46['role']!==_0x9659('0x5f')){return _0x285a46;}});return _0x5c6f78;}});}else{return _0x5e80a0;}}})['then'](function(_0x2fc04e){var _0x47228d=[];if(_0x2fc04e){_0x28fea9=_0x2fc04e;for(var _0x356f92=0x0;_0x356f92<_0x2fc04e[_0x9659('0x3e')];_0x356f92+=0x1){_0x28fea9[_0x356f92][_0x9659('0x71')]=[];_0x47228d[_0x9659('0x70')](db[_0x9659('0x4b')][_0x9659('0x52')]({'where':{'FromId':[_0x2c2a54['user']['id'],_0x2fc04e[_0x356f92]['id']],'ToId':[_0x2c2a54['user']['id'],_0x2fc04e[_0x356f92]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x9659('0x72'),_0x9659('0x73'),_0x9659('0x74'),'body'],'order':qs[_0x9659('0x43')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2fc04e[_0x356f92])));}return BPromise[_0x9659('0x75')](_0x47228d);}return[];})['then'](function(_0x5b9a7e){return{'rows':_0x5b9a7e,'count':_0x5b9a7e[_0x9659('0x3e')]};})['then'](respondWithResult(_0x131094,null))['catch'](handleError(_0x131094,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ad168bb..4126154 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 _0x197c=['remove','emit','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x197c,0xc1));var _0xc197=function(_0x58f65e,_0x467d61){_0x58f65e=_0x58f65e-0x0;var _0x35684b=_0x197c[_0x58f65e];return _0x35684b;};'use strict';var EventEmitter=require(_0xc197('0x0'));var ChatInternalMessage=require(_0xc197('0x1'))['db'][_0xc197('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc197('0x3'),'afterUpdate':_0xc197('0x4'),'afterDestroy':_0xc197('0x5')};function emitEvent(_0x288aa1){return function(_0x39a525,_0x5b8019,_0x1eaf99){ChatInternalMessageEvents[_0xc197('0x6')](_0x288aa1+':'+_0x39a525['id'],_0x39a525);ChatInternalMessageEvents[_0xc197('0x6')](_0x288aa1,_0x39a525);_0x1eaf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xc197('0x7')](e,emitEvent(event));}}module[_0xc197('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb184=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hook'];(function(_0x2f1e68,_0x38b8f5){var _0x79d7dd=function(_0x3ff36a){while(--_0x3ff36a){_0x2f1e68['push'](_0x2f1e68['shift']());}};_0x79d7dd(++_0x38b8f5);}(_0xb184,0x14e));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4b18('0x0'));var ChatInternalMessage=require(_0x4b18('0x1'))['db'][_0x4b18('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4b18('0x3')](0x0);var events={'afterCreate':_0x4b18('0x4'),'afterUpdate':'update','afterDestroy':_0x4b18('0x5')};function emitEvent(_0x60cb1a){return function(_0x15fadb,_0x19500d,_0x1af7b5){ChatInternalMessageEvents[_0x4b18('0x6')](_0x60cb1a+':'+_0x15fadb['id'],_0x15fadb);ChatInternalMessageEvents['emit'](_0x60cb1a,_0x15fadb);_0x1af7b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x4b18('0x7')](e,emitEvent(event));}}module[_0x4b18('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0abb8ff..1245c9c 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 _0xf311=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4_unicode_ci'];(function(_0x1c6817,_0x1c32ac){var _0x3bbb97=function(_0x156a6f){while(--_0x156a6f){_0x1c6817['push'](_0x1c6817['shift']());}};_0x3bbb97(++_0x1c32ac);}(_0xf311,0x1c3));var _0x1f31=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf311[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x1f31('0x0'));var logger=require(_0x1f31('0x1'))(_0x1f31('0x2'));var moment=require(_0x1f31('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f31('0x4'));var fs=require('fs');var path=require(_0x1f31('0x5'));var rimraf=require('rimraf');var config=require(_0x1f31('0x6'));var attributes=require(_0x1f31('0x7'));module[_0x1f31('0x8')]=function(_0x4b97f9,_0x2e0b5b){return _0x4b97f9['define'](_0x1f31('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1f31('0xa')});}; \ No newline at end of file +var _0xb9d6=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb9d6,0xc9));var _0x6b9d=function(_0x42b3aa,_0x223f53){_0x42b3aa=_0x42b3aa-0x0;var _0x319157=_0xb9d6[_0x42b3aa];return _0x319157;};'use strict';var _=require(_0x6b9d('0x0'));var util=require('util');var logger=require(_0x6b9d('0x1'))(_0x6b9d('0x2'));var moment=require(_0x6b9d('0x3'));var BPromise=require(_0x6b9d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b9d('0x5'));var rimraf=require(_0x6b9d('0x6'));var config=require(_0x6b9d('0x7'));var attributes=require(_0x6b9d('0x8'));module[_0x6b9d('0x9')]=function(_0x5c0235,_0x570b7e){return _0x5c0235[_0x6b9d('0xa')](_0x6b9d('0xb'),attributes,{'tableName':_0x6b9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b9d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 5758b13..aa76047 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 _0xd95b=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInternalMessage,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatInternalMessage.socket','request','info','request\x20sent','debug'];(function(_0x20b04f,_0xc07087){var _0x591839=function(_0x2570b4){while(--_0x2570b4){_0x20b04f['push'](_0x20b04f['shift']());}};_0x591839(++_0xc07087);}(_0xd95b,0x126));var _0xbd95=function(_0x2b8983,_0x54abb2){_0x2b8983=_0x2b8983-0x0;var _0x3ce526=_0xd95b[_0x2b8983];return _0x3ce526;};'use strict';var _=require('lodash');var util=require(_0xbd95('0x0'));var moment=require(_0xbd95('0x1'));var BPromise=require(_0xbd95('0x2'));var rs=require(_0xbd95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd95('0x4'))['db'];var utils=require(_0xbd95('0x5'));var logger=require(_0xbd95('0x6'))('rpc');var config=require(_0xbd95('0x7'));var jayson=require(_0xbd95('0x8'));var client=jayson['client'][_0xbd95('0x9')]({'port':0x232a});config[_0xbd95('0xa')]=_[_0xbd95('0xb')](config['redis'],{'host':_0xbd95('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd95('0xa')]));require(_0xbd95('0xd'))['register'](socket);function respondWithRpcPromise(_0x27ee03,_0x490825,_0x1c8ca0){return new BPromise(function(_0x893dcb,_0x4ed6e8){return client[_0xbd95('0xe')](_0x27ee03,_0x1c8ca0)['then'](function(_0xd8a13d){logger[_0xbd95('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x490825,_0xbd95('0x10'));logger[_0xbd95('0x11')](_0xbd95('0x12'),_0x490825,_0xbd95('0x10'),JSON[_0xbd95('0x13')](_0xd8a13d));if(_0xd8a13d[_0xbd95('0x14')]){if(_0xd8a13d[_0xbd95('0x14')]['code']===0x1f4){logger[_0xbd95('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x490825,_0xd8a13d[_0xbd95('0x14')][_0xbd95('0x15')]);return _0x4ed6e8(_0xd8a13d[_0xbd95('0x14')][_0xbd95('0x15')]);}logger[_0xbd95('0x14')](_0xbd95('0x16'),_0x490825,_0xd8a13d['error'][_0xbd95('0x15')]);return _0x893dcb(_0xd8a13d['error'][_0xbd95('0x15')]);}else{logger[_0xbd95('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x490825,_0xbd95('0x10'));_0x893dcb(_0xd8a13d[_0xbd95('0x17')][_0xbd95('0x15')]);}})['catch'](function(_0x172092){logger[_0xbd95('0x14')](_0xbd95('0x16'),_0x490825,_0x172092);_0x4ed6e8(_0x172092);});});} \ No newline at end of file +var _0x6d03=['./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x576ae7,_0x384abe){var _0x50b4c9=function(_0x199304){while(--_0x199304){_0x576ae7['push'](_0x576ae7['shift']());}};_0x50b4c9(++_0x384abe);}(_0x6d03,0x177));var _0x36d0=function(_0xaa7cc4,_0x46bdac){_0xaa7cc4=_0xaa7cc4-0x0;var _0x129f07=_0x6d03[_0xaa7cc4];return _0x129f07;};'use strict';var _=require(_0x36d0('0x0'));var util=require('util');var moment=require(_0x36d0('0x1'));var BPromise=require(_0x36d0('0x2'));var rs=require(_0x36d0('0x3'));var fs=require('fs');var Redis=require(_0x36d0('0x4'));var db=require(_0x36d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36d0('0x6'))(_0x36d0('0x7'));var config=require(_0x36d0('0x8'));var jayson=require(_0x36d0('0x9'));var client=jayson['client'][_0x36d0('0xa')]({'port':0x232a});config[_0x36d0('0xb')]=_[_0x36d0('0xc')](config[_0x36d0('0xb')],{'host':_0x36d0('0xd'),'port':0x18eb});var socket=require(_0x36d0('0xe'))(new Redis(config['redis']));require(_0x36d0('0xf'))[_0x36d0('0x10')](socket);function respondWithRpcPromise(_0x1cc21d,_0x285900,_0x3fa0fd){return new BPromise(function(_0x5e4666,_0x5b69ff){return client[_0x36d0('0x11')](_0x1cc21d,_0x3fa0fd)[_0x36d0('0x12')](function(_0x189792){logger[_0x36d0('0x13')](_0x36d0('0x14'),_0x285900,_0x36d0('0x15'));logger['debug'](_0x36d0('0x16'),_0x285900,'request\x20sent',JSON['stringify'](_0x189792));if(_0x189792['error']){if(_0x189792['error']['code']===0x1f4){logger[_0x36d0('0x17')](_0x36d0('0x14'),_0x285900,_0x189792[_0x36d0('0x17')][_0x36d0('0x18')]);return _0x5b69ff(_0x189792[_0x36d0('0x17')][_0x36d0('0x18')]);}logger[_0x36d0('0x17')](_0x36d0('0x14'),_0x285900,_0x189792[_0x36d0('0x17')][_0x36d0('0x18')]);return _0x5e4666(_0x189792[_0x36d0('0x17')]['message']);}else{logger['info'](_0x36d0('0x14'),_0x285900,_0x36d0('0x15'));_0x5e4666(_0x189792['result'][_0x36d0('0x18')]);}})[_0x36d0('0x19')](function(_0x20115c){logger[_0x36d0('0x17')](_0x36d0('0x14'),_0x285900,_0x20115c);_0x5b69ff(_0x20115c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d2eae21..7feb5da 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 _0xb0d4=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','register','length'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xb0d4,0xd1));var _0x4b0d=function(_0x66808a,_0x60f3bd){_0x66808a=_0x66808a-0x0;var _0x760006=_0xb0d4[_0x66808a];return _0x760006;};'use strict';var ChatInternalMessageEvents=require(_0x4b0d('0x0'));var events=[_0x4b0d('0x1'),_0x4b0d('0x2'),_0x4b0d('0x3')];function createListener(_0x1c2911,_0xeaad4a){return function(_0x43c6e8){_0xeaad4a[_0x4b0d('0x4')](_0x1c2911,_0x43c6e8);};}function removeListener(_0x2bf4a6,_0x287fa7){return function(){ChatInternalMessageEvents['removeListener'](_0x2bf4a6,_0x287fa7);};}exports[_0x4b0d('0x5')]=function(_0x5aa827){for(var _0x157f19=0x0,_0x307bab=events[_0x4b0d('0x6')];_0x157f19<_0x307bab;_0x157f19++){var _0x310df8=events[_0x157f19];var _0xe767fb=createListener(_0x4b0d('0x7')+_0x310df8,_0x5aa827);ChatInternalMessageEvents['on'](_0x310df8,_0xe767fb);}}; \ No newline at end of file +var _0x1ad9=['update','emit','removeListener','length','save','remove'];(function(_0x4f4f0f,_0x25c84f){var _0x2a0c8a=function(_0x2619c7){while(--_0x2619c7){_0x4f4f0f['push'](_0x4f4f0f['shift']());}};_0x2a0c8a(++_0x25c84f);}(_0x1ad9,0x94));var _0x91ad=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x1ad9[_0x387777];return _0x3f84c0;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x91ad('0x0'),_0x91ad('0x1'),_0x91ad('0x2')];function createListener(_0x147c7d,_0x111094){return function(_0x3b6b22){_0x111094[_0x91ad('0x3')](_0x147c7d,_0x3b6b22);};}function removeListener(_0x150718,_0x1604c5){return function(){ChatInternalMessageEvents[_0x91ad('0x4')](_0x150718,_0x1604c5);};}exports['register']=function(_0xe13125){for(var _0xb8028a=0x0,_0x2f7496=events[_0x91ad('0x5')];_0xb8028a<_0x2f7496;_0xb8028a++){var _0x554314=events[_0xb8028a];var _0x2e153c=createListener('chatInternalMessage:'+_0x554314,_0xe13125);ChatInternalMessageEvents['on'](_0x554314,_0x2e153c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3d5f169..f415a38 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 _0xdef5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','getUsers','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x1321d6,_0x4424c6){var _0x3aae91=function(_0x5b7fe1){while(--_0x5b7fe1){_0x1321d6['push'](_0x1321d6['shift']());}};_0x3aae91(++_0x4424c6);}(_0xdef5,0x1b1));var _0x5def=function(_0x360f9c,_0x208039){_0x360f9c=_0x360f9c-0x0;var _0x4f916c=_0xdef5[_0x360f9c];return _0x4f916c;};'use strict';var multer=require(_0x5def('0x0'));var util=require('util');var path=require(_0x5def('0x1'));var timeout=require(_0x5def('0x2'));var express=require(_0x5def('0x3'));var router=express[_0x5def('0x4')]();var fs_extra=require(_0x5def('0x5'));var auth=require(_0x5def('0x6'));var interaction=require(_0x5def('0x7'));var config=require(_0x5def('0x8'));var controller=require(_0x5def('0x9'));router['get']('/',auth[_0x5def('0xa')](),controller[_0x5def('0xb')]);router[_0x5def('0xc')](_0x5def('0xd'),auth[_0x5def('0xa')](),controller[_0x5def('0xe')]);router['get']('/users',auth[_0x5def('0xa')](),controller[_0x5def('0xf')]);router[_0x5def('0xc')](_0x5def('0x10'),auth['isAuthenticated'](),controller[_0x5def('0x11')]);router[_0x5def('0x12')]('/',auth[_0x5def('0xa')](),controller[_0x5def('0x13')]);router[_0x5def('0x14')](_0x5def('0x10'),controller['update']);router[_0x5def('0x15')]('/:id',auth[_0x5def('0xa')](),controller[_0x5def('0x16')]);module['exports']=router; \ No newline at end of file +var _0x29a5=['Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x29a5,0x1e0));var _0x529a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x29a5[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x529a('0x0'));var util=require(_0x529a('0x1'));var path=require(_0x529a('0x2'));var timeout=require('connect-timeout');var express=require(_0x529a('0x3'));var router=express[_0x529a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x529a('0x5'));var interaction=require(_0x529a('0x6'));var config=require('../../config/environment');var controller=require(_0x529a('0x7'));router[_0x529a('0x8')]('/',auth[_0x529a('0x9')](),controller[_0x529a('0xa')]);router[_0x529a('0x8')](_0x529a('0xb'),auth[_0x529a('0x9')](),controller['describe']);router[_0x529a('0x8')](_0x529a('0xc'),auth[_0x529a('0x9')](),controller['getUsers']);router[_0x529a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x529a('0xd')]);router[_0x529a('0xe')]('/',auth[_0x529a('0x9')](),controller[_0x529a('0xf')]);router[_0x529a('0x10')](_0x529a('0x11'),controller[_0x529a('0x12')]);router[_0x529a('0x13')](_0x529a('0x11'),auth[_0x529a('0x9')](),controller[_0x529a('0x14')]);module[_0x529a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7316709..86c9229 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 _0xabad=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x33ff91,_0x795acd){var _0x14d1bd=function(_0x32fc59){while(--_0x32fc59){_0x33ff91['push'](_0x33ff91['shift']());}};_0x14d1bd(++_0x795acd);}(_0xabad,0x150));var _0xdaba=function(_0x2724ab,_0x4890a8){_0x2724ab=_0x2724ab-0x0;var _0x3e05d8=_0xabad[_0x2724ab];return _0x3e05d8;};'use strict';var Sequelize=require(_0xdaba('0x0'));module['exports']={'body':{'type':Sequelize[_0xdaba('0x1')](_0xdaba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdaba('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdaba('0x4')]('in',_0xdaba('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdaba('0x6')]},'providerName':{'type':Sequelize[_0xdaba('0x7')]},'providerResponse':{'type':Sequelize[_0xdaba('0x1')]}}; \ No newline at end of file +var _0xa062=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x116f1f,_0x504f9c){var _0x15d7ab=function(_0x27af2d){while(--_0x27af2d){_0x116f1f['push'](_0x116f1f['shift']());}};_0x15d7ab(++_0x504f9c);}(_0xa062,0x101));var _0x2a06=function(_0x510bc7,_0x540f0d){_0x510bc7=_0x510bc7-0x0;var _0x49e2cd=_0xa062[_0x510bc7];return _0x49e2cd;};'use strict';var Sequelize=require(_0x2a06('0x0'));module[_0x2a06('0x1')]={'body':{'type':Sequelize[_0x2a06('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2a06('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2a06('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2a06('0x4')]('in',_0x2a06('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2a06('0x6')]},'providerName':{'type':Sequelize['STRING']},'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 bc94e5b..348849e 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 _0xc695=['chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','get','RejectMessage','rejectMessage','contact','email','internal','interface','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','update','destroy','stack','name','send','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','includeAll','find','body','params','catch','describe','../../config/logger'];(function(_0x56b477,_0x324907){var _0x4d4a52=function(_0xf5f913){while(--_0xf5f913){_0x56b477['push'](_0x56b477['shift']());}};_0x4d4a52(++_0x324907);}(_0xc695,0x1ae));var _0x5c69=function(_0x3fd50c,_0x1b41ed){_0x3fd50c=_0x3fd50c-0x0;var _0x4cebb2=_0xc695[_0x3fd50c];return _0x4cebb2;};'use strict';var emlformat=require(_0x5c69('0x0'));var rimraf=require(_0x5c69('0x1'));var zipdir=require(_0x5c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c69('0x3'));var moment=require('moment');var BPromise=require(_0x5c69('0x4'));var Mustache=require(_0x5c69('0x5'));var util=require(_0x5c69('0x6'));var path=require(_0x5c69('0x7'));var sox=require('sox');var csv=require(_0x5c69('0x8'));var ejs=require(_0x5c69('0x9'));var fs=require('fs');var fs_extra=require(_0x5c69('0xa'));var _=require(_0x5c69('0xb'));var squel=require(_0x5c69('0xc'));var crypto=require('crypto');var jsforce=require(_0x5c69('0xd'));var deskjs=require(_0x5c69('0xe'));var toCsv=require(_0x5c69('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5c69('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5c69('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c69('0x11'));var utils=require(_0x5c69('0x12'));var config=require(_0x5c69('0x13'));var licenseUtil=require(_0x5c69('0x14'));var db=require(_0x5c69('0x15'))['db'];config[_0x5c69('0x16')]=_[_0x5c69('0x17')](config[_0x5c69('0x16')],{'host':_0x5c69('0x18'),'port':0x18eb});var socket=require(_0x5c69('0x19'))(new Redis(config[_0x5c69('0x16')]));require('./chatMessage.socket')[_0x5c69('0x1a')](socket);var jayson=require(_0x5c69('0x1b'));var client=jayson['client'][_0x5c69('0x1c')]({'port':0x232c});var client9002=jayson[_0x5c69('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aa5db,_0xf5615f,_0x331d94,_0x1f70aa){return new BPromise(function(_0x17ec1f,_0x408dd1){var _0x4b90af=_0x1f70aa||client;return _0x4b90af[_0x5c69('0x1e')](_0x1aa5db,_0x331d94)[_0x5c69('0x1f')](function(_0x52e70b){logger[_0x5c69('0x20')](_0x5c69('0x21'),_0xf5615f,_0x5c69('0x22'));logger[_0x5c69('0x23')](_0x5c69('0x24'),_0xf5615f,_0x5c69('0x22'),JSON[_0x5c69('0x25')](_0x52e70b));if(_0x52e70b[_0x5c69('0x26')]){if(_0x52e70b[_0x5c69('0x26')]['code']===0x1f4){logger[_0x5c69('0x26')](_0x5c69('0x21'),_0xf5615f,_0x52e70b['error'][_0x5c69('0x27')]);return _0x408dd1(_0x52e70b[_0x5c69('0x26')][_0x5c69('0x27')]);}logger[_0x5c69('0x26')](_0x5c69('0x21'),_0xf5615f,_0x52e70b[_0x5c69('0x26')]['message']);return _0x17ec1f(_0x52e70b[_0x5c69('0x26')][_0x5c69('0x27')]);}else{logger['info'](_0x5c69('0x21'),_0xf5615f,_0x5c69('0x22'));_0x17ec1f(_0x52e70b[_0x5c69('0x28')]['message']);}})['catch'](function(_0x548d76){logger['error'](_0x5c69('0x21'),_0xf5615f,_0x548d76);_0x408dd1(_0x548d76);});});}function respondWithStatusCode(_0xeff031,_0x1bf201){_0x1bf201=_0x1bf201||0xcc;return function(_0x45fbf2){if(_0x45fbf2){return _0xeff031[_0x5c69('0x29')](_0x1bf201);}return _0xeff031[_0x5c69('0x2a')](_0x1bf201)[_0x5c69('0x2b')]();};}function respondWithResult(_0x33578e,_0x42b0e3){_0x42b0e3=_0x42b0e3||0xc8;return function(_0x4e55a0){if(_0x4e55a0){return _0x33578e['status'](_0x42b0e3)['json'](_0x4e55a0);}};}function respondWithFilteredResult(_0x2b1607,_0x3d1af5){return function(_0xc74a5e){if(_0xc74a5e){var _0x5b6146=typeof _0x3d1af5[_0x5c69('0x2c')]===_0x5c69('0x2d')&&typeof _0x3d1af5[_0x5c69('0x2e')]===_0x5c69('0x2d');var _0x32b458=_0xc74a5e[_0x5c69('0x2f')];var _0x398ec2=_0x5b6146?0x0:_0x3d1af5[_0x5c69('0x2c')];var _0x4e9dd3=_0x5b6146?_0xc74a5e[_0x5c69('0x2f')]:_0x3d1af5['offset']+_0x3d1af5[_0x5c69('0x2e')];var _0xa9be78;if(_0x4e9dd3>=_0x32b458){_0x4e9dd3=_0x32b458;_0xa9be78=0xc8;}else{_0xa9be78=0xce;}_0x2b1607[_0x5c69('0x2a')](_0xa9be78);return _0x2b1607['set']('Content-Range',_0x398ec2+'-'+_0x4e9dd3+'/'+_0x32b458)[_0x5c69('0x30')](_0xc74a5e);}return null;};}function patchUpdates(_0xc0dd2a){return function(_0x33d022){try{jsonpatch[_0x5c69('0x31')](_0x33d022,_0xc0dd2a,!![]);}catch(_0x5e4055){return BPromise[_0x5c69('0x32')](_0x5e4055);}return _0x33d022['save']();};}function saveUpdates(_0xcbf544,_0x28b70e){return function(_0x4d7e4b){if(_0x4d7e4b){return _0x4d7e4b[_0x5c69('0x33')](_0xcbf544)[_0x5c69('0x1f')](function(_0x385857){return _0x385857;});}return null;};}function removeEntity(_0xa3cf33,_0x41195f){return function(_0x57dd34){if(_0x57dd34){return _0x57dd34[_0x5c69('0x34')]()[_0x5c69('0x1f')](function(){_0xa3cf33[_0x5c69('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5f75,_0x25718a){return function(_0x22db34){if(!_0x22db34){_0x2d5f75[_0x5c69('0x29')](0x194);}return _0x22db34;};}function handleError(_0x3bf6c6,_0x35c255){_0x35c255=_0x35c255||0x1f4;return function(_0x1699af){logger[_0x5c69('0x26')](_0x1699af[_0x5c69('0x35')]);if(_0x1699af[_0x5c69('0x36')]){delete _0x1699af[_0x5c69('0x36')];}_0x3bf6c6[_0x5c69('0x2a')](_0x35c255)[_0x5c69('0x37')](_0x1699af);};}exports['index']=function(_0x185cbb,_0x495b27){var _0x5f4461={},_0x1966e7={},_0xf50860={'count':0x0,'rows':[]};var _0x143238=_['map'](db[_0x5c69('0x38')][_0x5c69('0x39')],function(_0x2415a4){return{'name':_0x2415a4[_0x5c69('0x3a')],'type':_0x2415a4[_0x5c69('0x3b')][_0x5c69('0x3c')]};});_0x1966e7[_0x5c69('0x3d')]=_[_0x5c69('0x3e')](_0x143238,_0x5c69('0x36'));_0x1966e7[_0x5c69('0x3f')]=_[_0x5c69('0x40')](_0x185cbb[_0x5c69('0x3f')]);_0x1966e7[_0x5c69('0x41')]=_['intersection'](_0x1966e7[_0x5c69('0x3d')],_0x1966e7[_0x5c69('0x3f')]);_0x5f4461[_0x5c69('0x42')]=_[_0x5c69('0x43')](_0x1966e7[_0x5c69('0x3d')],qs['fields'](_0x185cbb['query'][_0x5c69('0x44')]));_0x5f4461[_0x5c69('0x42')]=_0x5f4461[_0x5c69('0x42')][_0x5c69('0x45')]?_0x5f4461[_0x5c69('0x42')]:_0x1966e7['model'];if(!_0x185cbb['query'][_0x5c69('0x46')](_0x5c69('0x47'))){_0x5f4461['limit']=qs[_0x5c69('0x2e')](_0x185cbb[_0x5c69('0x3f')][_0x5c69('0x2e')]);_0x5f4461['offset']=qs[_0x5c69('0x2c')](_0x185cbb['query'][_0x5c69('0x2c')]);}_0x5f4461[_0x5c69('0x48')]=qs[_0x5c69('0x49')](_0x185cbb[_0x5c69('0x3f')]['sort']);_0x5f4461[_0x5c69('0x4a')]=qs[_0x5c69('0x41')](_['pick'](_0x185cbb[_0x5c69('0x3f')],_0x1966e7[_0x5c69('0x41')]),_0x143238);if(_0x185cbb[_0x5c69('0x3f')]['filter']){_0x5f4461[_0x5c69('0x4a')]=_[_0x5c69('0x4b')](_0x5f4461[_0x5c69('0x4a')],{'$or':_[_0x5c69('0x3e')](_0x143238,function(_0xfd3729){if(_0xfd3729[_0x5c69('0x3b')]!==_0x5c69('0x4c')){var _0x507f23={};_0x507f23[_0xfd3729[_0x5c69('0x36')]]={'$like':'%'+_0x185cbb['query'][_0x5c69('0x4d')]+'%'};return _0x507f23;}})});}_0x5f4461=_['merge']({},_0x5f4461,_0x185cbb[_0x5c69('0x4e')]);var _0x17ce96={'where':_0x5f4461[_0x5c69('0x4a')]};return db[_0x5c69('0x38')][_0x5c69('0x2f')](_0x17ce96)[_0x5c69('0x1f')](function(_0x4a4717){_0xf50860['count']=_0x4a4717;if(_0x185cbb[_0x5c69('0x3f')]['includeAll']){_0x5f4461[_0x5c69('0x4f')]=[{'all':!![]}];}return db[_0x5c69('0x38')][_0x5c69('0x50')](_0x5f4461);})[_0x5c69('0x1f')](function(_0x37c852){_0xf50860[_0x5c69('0x51')]=_0x37c852;return _0xf50860;})[_0x5c69('0x1f')](respondWithFilteredResult(_0x495b27,_0x5f4461))['catch'](handleError(_0x495b27,null));};exports[_0x5c69('0x52')]=function(_0x467692,_0x454aba){var _0x31efaf={'raw':!![],'where':{'id':_0x467692['params']['id']}},_0x135389={};_0x135389['model']=_[_0x5c69('0x40')](db[_0x5c69('0x38')][_0x5c69('0x39')]);_0x135389['query']=_[_0x5c69('0x40')](_0x467692[_0x5c69('0x3f')]);_0x135389[_0x5c69('0x41')]=_[_0x5c69('0x43')](_0x135389['model'],_0x135389[_0x5c69('0x3f')]);_0x31efaf[_0x5c69('0x42')]=_[_0x5c69('0x43')](_0x135389[_0x5c69('0x3d')],qs['fields'](_0x467692[_0x5c69('0x3f')][_0x5c69('0x44')]));_0x31efaf[_0x5c69('0x42')]=_0x31efaf[_0x5c69('0x42')]['length']?_0x31efaf[_0x5c69('0x42')]:_0x135389['model'];if(_0x467692[_0x5c69('0x3f')][_0x5c69('0x53')]){_0x31efaf[_0x5c69('0x4f')]=[{'all':!![]}];}_0x31efaf=_[_0x5c69('0x4b')]({},_0x31efaf,_0x467692['options']);return db[_0x5c69('0x38')][_0x5c69('0x54')](_0x31efaf)[_0x5c69('0x1f')](handleEntityNotFound(_0x454aba,null))[_0x5c69('0x1f')](respondWithResult(_0x454aba,null))['catch'](handleError(_0x454aba,null));};exports['create']=function(_0x4cc7cd,_0x1a9e2a){return db['ChatMessage']['create'](_0x4cc7cd['body'],{})[_0x5c69('0x1f')](respondWithResult(_0x1a9e2a,0xc9))['catch'](handleError(_0x1a9e2a,null));};exports[_0x5c69('0x33')]=function(_0x119c35,_0x41c889){if(_0x119c35[_0x5c69('0x55')]['id']){delete _0x119c35[_0x5c69('0x55')]['id'];}return db[_0x5c69('0x38')][_0x5c69('0x54')]({'where':{'id':_0x119c35[_0x5c69('0x56')]['id']}})['then'](handleEntityNotFound(_0x41c889,null))[_0x5c69('0x1f')](saveUpdates(_0x119c35[_0x5c69('0x55')],null))[_0x5c69('0x1f')](respondWithResult(_0x41c889,null))[_0x5c69('0x57')](handleError(_0x41c889,null));};exports['destroy']=function(_0x391edf,_0x484730){return db[_0x5c69('0x38')][_0x5c69('0x54')]({'where':{'id':_0x391edf[_0x5c69('0x56')]['id']}})[_0x5c69('0x1f')](handleEntityNotFound(_0x484730,null))['then'](removeEntity(_0x484730,null))[_0x5c69('0x57')](handleError(_0x484730,null));};exports[_0x5c69('0x58')]=function(_0x4337e4,_0x555007){return db[_0x5c69('0x38')][_0x5c69('0x58')]()['then'](respondWithResult(_0x555007,null))[_0x5c69('0x57')](handleError(_0x555007,null));};var interaction_log=require(_0x5c69('0x59'))(_0x5c69('0x5a'));exports[_0x5c69('0x5b')]=function(_0x50f335,_0xe27e7b,_0x2170de){var _0x48c1b1={'agent':{},'channel':'chat'};if(_0x50f335[_0x5c69('0x55')]['id']){delete _0x50f335['body']['id'];}_0x50f335[_0x5c69('0x55')][_0x5c69('0x5c')]=!![];_0x50f335[_0x5c69('0x55')][_0x5c69('0x5d')]=moment()[_0x5c69('0x5e')](_0x5c69('0x5f'));_0x50f335[_0x5c69('0x55')][_0x5c69('0x60')]=_0x50f335[_0x5c69('0x55')][_0x5c69('0x60')]||_0x50f335[_0x5c69('0x61')]['id'];_0x48c1b1[_0x5c69('0x62')]['id']=_0x50f335['body']['UserId'];return db[_0x5c69('0x38')][_0x5c69('0x54')]({'where':{'id':_0x50f335[_0x5c69('0x56')]['id'],'UserId':null}})[_0x5c69('0x1f')](handleEntityNotFound(_0xe27e7b,null))['then'](saveUpdates(_0x50f335[_0x5c69('0x55')],null))[_0x5c69('0x1f')](function(_0x4094ee){if(_0x4094ee){_0x48c1b1[_0x5c69('0x27')]=_0x4094ee['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x4094ee[_0x5c69('0x63')]}});}return null;})[_0x5c69('0x1f')](handleEntityNotFound(_0xe27e7b,null))[_0x5c69('0x1f')](function(_0x2e5a18){if(_0x2e5a18){return _0x2e5a18[_0x5c69('0x33')]({'UserId':_0x50f335[_0x5c69('0x55')][_0x5c69('0x60')],'read1stAt':_[_0x5c69('0x64')](_0x2e5a18[_0x5c69('0x65')])?moment()[_0x5c69('0x5e')](_0x5c69('0x5f')):undefined});}return null;})[_0x5c69('0x1f')](function(_0x28737a){if(_0x28737a){_0x48c1b1[_0x5c69('0x66')]=_0x28737a['get']({'plain':!![]});interaction_log[_0x5c69('0x20')](_0x5c69('0x67'),_0x50f335[_0x5c69('0x61')]['id'],_0x50f335[_0x5c69('0x61')]['name'],_0x50f335['user'][_0x5c69('0x68')],_0x48c1b1[_0x5c69('0x66')]['id'],_0x50f335[_0x5c69('0x55')]?JSON[_0x5c69('0x25')](_0x50f335['body']):_0x5c69('0x69'));return respondWithRpcPromise('AcceptMessage',_0x5c69('0x6a'),_0x48c1b1);}return null;})[_0x5c69('0x1f')](function(_0x5f25b7){var _0x59092d=_0x5c69('0x6b')+_0x5f25b7['message']['ContactId'];return db[_0x5c69('0x6c')][_0x5c69('0x3f')](_0x59092d,{'type':db[_0x5c69('0x6d')][_0x5c69('0x6e')][_0x5c69('0x6f')],'raw':!![]})[_0x5c69('0x1f')](function(_0x37ed5a){return _0x37ed5a;});})[_0x5c69('0x1f')](function(_0x4e612e){if(_0x4e612e){_0x48c1b1[_0x5c69('0x27')]['contact']=_0x4e612e[0x0];if(!_0x50f335[_0x5c69('0x55')][_0x5c69('0x60')])return;return db[_0x5c69('0x70')][_0x5c69('0x54')]({'where':{'id':_0x50f335[_0x5c69('0x55')][_0x5c69('0x60')],'role':_0x5c69('0x62')},'attributes':['id',_0x5c69('0x36'),_0x5c69('0x71'),'email','internal'],'raw':!![]});}return null;})[_0x5c69('0x1f')](function(_0x197bb6){if(!_0x197bb6)return null;_0x48c1b1[_0x5c69('0x27')]['agent']=_0x197bb6;return _0x48c1b1;})['then'](function(_0xbed95b){if(_0xbed95b){if(_0x50f335['body']['manual']){_0x48c1b1[_0x5c69('0x27')]['interface']=util[_0x5c69('0x5e')](_0x5c69('0x72'),_0x50f335[_0x5c69('0x61')][_0x5c69('0x36')]);_0x48c1b1[_0x5c69('0x27')][_0x5c69('0x73')]=_0x48c1b1[_0x5c69('0x73')];_0x48c1b1[_0x5c69('0x27')][_0x5c69('0x74')]=_0x48c1b1[_0x5c69('0x73')];_0x48c1b1[_0x5c69('0x27')][_0x5c69('0x75')]=_0x5c69('0x5b');return respondWithRpcPromise(_0x5c69('0x76'),_0x5c69('0x76'),{'event':_0x5c69('0x77'),'message':_[_0x5c69('0x4b')](_0x48c1b1[_0x5c69('0x27')],JSON[_0x5c69('0x78')](_0x48c1b1['interaction'][_0x5c69('0x79')]))},client9002)[_0x5c69('0x1f')](function(){return _0x48c1b1;});}return _0x48c1b1;}return null;})[_0x5c69('0x1f')](respondWithResult(_0xe27e7b,null))[_0x5c69('0x57')](handleError(_0xe27e7b,null));};var interaction_log=require(_0x5c69('0x59'))(_0x5c69('0x5a'));exports[_0x5c69('0x32')]=function(_0x2cfd92,_0x37d1f9,_0x18bacb){var _0x149770={'agent':{},'channel':'chat'};if(_0x2cfd92[_0x5c69('0x55')]['id']){delete _0x2cfd92[_0x5c69('0x55')]['id'];}_0x2cfd92[_0x5c69('0x55')][_0x5c69('0x60')]=_0x2cfd92[_0x5c69('0x55')][_0x5c69('0x60')]||_0x2cfd92[_0x5c69('0x61')]['id'];_0x149770[_0x5c69('0x62')]['id']=_0x2cfd92[_0x5c69('0x55')][_0x5c69('0x60')];return db[_0x5c69('0x38')][_0x5c69('0x54')]({'where':{'id':_0x2cfd92[_0x5c69('0x56')]['id'],'UserId':null}})[_0x5c69('0x1f')](handleEntityNotFound(_0x37d1f9,null))['then'](function(_0x3b9137){if(_0x3b9137){_0x149770['message']=_0x3b9137['get']({'plain':!![]});return db[_0x5c69('0x7a')][_0x5c69('0x54')]({'where':{'id':_0x3b9137[_0x5c69('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x37d1f9,null))[_0x5c69('0x1f')](function(_0x20a2fd){if(_0x20a2fd){_0x149770[_0x5c69('0x66')]=_0x20a2fd[_0x5c69('0x7b')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cfd92['user']['id'],_0x2cfd92[_0x5c69('0x61')][_0x5c69('0x36')],_0x2cfd92[_0x5c69('0x61')][_0x5c69('0x68')],_0x149770[_0x5c69('0x66')]['id'],_0x2cfd92[_0x5c69('0x55')]?JSON['stringify'](_0x2cfd92[_0x5c69('0x55')]):_0x5c69('0x69'));return respondWithRpcPromise(_0x5c69('0x7c'),_0x5c69('0x7d'),_0x149770);}return null;})[_0x5c69('0x1f')](function(_0x59f304){var _0x612c46='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x59f304['message']['ContactId'];return db[_0x5c69('0x6c')][_0x5c69('0x3f')](_0x612c46,{'type':db[_0x5c69('0x6d')]['QueryTypes'][_0x5c69('0x6f')],'raw':!![]})[_0x5c69('0x1f')](function(_0x32b8b2){return _0x32b8b2;});})['then'](function(_0xb23d0){if(_0xb23d0){_0x149770[_0x5c69('0x27')][_0x5c69('0x7e')]=_0xb23d0[0x0];if(!_0x2cfd92[_0x5c69('0x55')][_0x5c69('0x60')])return;return db[_0x5c69('0x70')][_0x5c69('0x54')]({'where':{'id':_0x2cfd92['body'][_0x5c69('0x60')],'role':_0x5c69('0x62')},'attributes':['id',_0x5c69('0x36'),_0x5c69('0x71'),_0x5c69('0x7f'),_0x5c69('0x80')],'raw':!![]});}return null;})[_0x5c69('0x1f')](function(_0x132faa){if(!_0x132faa)return null;_0x149770['message'][_0x5c69('0x62')]=_0x132faa;return _0x149770;})[_0x5c69('0x1f')](function(_0x54e1bb){if(_0x54e1bb){_0x54e1bb['message'][_0x5c69('0x81')]=util[_0x5c69('0x5e')]('SIP/%s',_0x2cfd92[_0x5c69('0x61')][_0x5c69('0x36')]);_0x54e1bb[_0x5c69('0x27')][_0x5c69('0x73')]=_0x149770[_0x5c69('0x73')];_0x54e1bb[_0x5c69('0x27')][_0x5c69('0x74')]=_0x149770[_0x5c69('0x73')];_0x54e1bb[_0x5c69('0x27')][_0x5c69('0x75')]='reject';respondWithRpcPromise(_0x5c69('0x76'),_0x5c69('0x76'),{'event':'rejectmessage','message':_['merge'](_0x149770[_0x5c69('0x27')],JSON[_0x5c69('0x78')](_0x149770['interaction'][_0x5c69('0x79')]))},client9002);return _0x149770;}return null;})['then'](respondWithResult(_0x37d1f9,null))[_0x5c69('0x57')](handleError(_0x37d1f9,null));}; \ No newline at end of file +var _0x6c98=['bluebird','mustache','util','path','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/utils','../../config/environment','redis','socket.io-emitter','./chatMessage.socket','register','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','ChatMessage','count','findAll','show','params','includeAll','include','find','create','body','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','update','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','motionChannel','channel','event','EventManager','acceptmessage','formData','chat-interactions','reject','ChatInteraction','ChatInteractionId','info','role','null','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x112661,_0x3404c8){var _0x29dc36=function(_0x564408){while(--_0x564408){_0x112661['push'](_0x112661['shift']());}};_0x29dc36(++_0x3404c8);}(_0x6c98,0x7c));var _0x86c9=function(_0x47d39e,_0x945d10){_0x47d39e=_0x47d39e-0x0;var _0x47e00a=_0x6c98[_0x47d39e];return _0x47e00a;};'use strict';var emlformat=require(_0x86c9('0x0'));var rimraf=require(_0x86c9('0x1'));var zipdir=require(_0x86c9('0x2'));var jsonpatch=require(_0x86c9('0x3'));var rp=require(_0x86c9('0x4'));var moment=require(_0x86c9('0x5'));var BPromise=require(_0x86c9('0x6'));var Mustache=require(_0x86c9('0x7'));var util=require(_0x86c9('0x8'));var path=require(_0x86c9('0x9'));var sox=require('sox');var csv=require(_0x86c9('0xa'));var ejs=require(_0x86c9('0xb'));var fs=require('fs');var fs_extra=require(_0x86c9('0xc'));var _=require(_0x86c9('0xd'));var squel=require(_0x86c9('0xe'));var crypto=require('crypto');var jsforce=require(_0x86c9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x86c9('0xa'));var querystring=require(_0x86c9('0x10'));var Papa=require(_0x86c9('0x11'));var Redis=require(_0x86c9('0x12'));var authService=require(_0x86c9('0x13'));var qs=require(_0x86c9('0x14'));var as=require(_0x86c9('0x15'));var hardwareService=require(_0x86c9('0x16'));var logger=require(_0x86c9('0x17'))('api');var utils=require(_0x86c9('0x18'));var config=require(_0x86c9('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x86c9('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86c9('0x1b'))(new Redis(config[_0x86c9('0x1a')]));require(_0x86c9('0x1c'))[_0x86c9('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x86c9('0x1e')][_0x86c9('0x1f')]({'port':0x232c});var client9002=jayson[_0x86c9('0x1e')][_0x86c9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2d8418,_0x3cf7b1,_0x21046e,_0x2c6e2c){return new BPromise(function(_0x5db56a,_0x3f1e87){var _0xe71fa3=_0x2c6e2c||client;return _0xe71fa3[_0x86c9('0x20')](_0x2d8418,_0x21046e)['then'](function(_0x25cc4a){logger['info'](_0x86c9('0x21'),_0x3cf7b1,_0x86c9('0x22'));logger['debug'](_0x86c9('0x23'),_0x3cf7b1,_0x86c9('0x22'),JSON[_0x86c9('0x24')](_0x25cc4a));if(_0x25cc4a[_0x86c9('0x25')]){if(_0x25cc4a[_0x86c9('0x25')][_0x86c9('0x26')]===0x1f4){logger[_0x86c9('0x25')]('ChatMessage,\x20%s,\x20%s',_0x3cf7b1,_0x25cc4a[_0x86c9('0x25')][_0x86c9('0x27')]);return _0x3f1e87(_0x25cc4a[_0x86c9('0x25')][_0x86c9('0x27')]);}logger[_0x86c9('0x25')](_0x86c9('0x21'),_0x3cf7b1,_0x25cc4a[_0x86c9('0x25')][_0x86c9('0x27')]);return _0x5db56a(_0x25cc4a[_0x86c9('0x25')]['message']);}else{logger['info'](_0x86c9('0x21'),_0x3cf7b1,'request\x20sent');_0x5db56a(_0x25cc4a[_0x86c9('0x28')]['message']);}})[_0x86c9('0x29')](function(_0x3c1b09){logger[_0x86c9('0x25')](_0x86c9('0x21'),_0x3cf7b1,_0x3c1b09);_0x3f1e87(_0x3c1b09);});});}function respondWithStatusCode(_0xa0c71a,_0x2e339e){_0x2e339e=_0x2e339e||0xcc;return function(_0x537884){if(_0x537884){return _0xa0c71a['sendStatus'](_0x2e339e);}return _0xa0c71a[_0x86c9('0x2a')](_0x2e339e)[_0x86c9('0x2b')]();};}function respondWithResult(_0x18519c,_0x487215){_0x487215=_0x487215||0xc8;return function(_0x3ed2ba){if(_0x3ed2ba){return _0x18519c[_0x86c9('0x2a')](_0x487215)[_0x86c9('0x2c')](_0x3ed2ba);}};}function respondWithFilteredResult(_0x5eead3,_0x553d8e){return function(_0x37ad40){if(_0x37ad40){var _0x41348b=typeof _0x553d8e[_0x86c9('0x2d')]===_0x86c9('0x2e')&&typeof _0x553d8e[_0x86c9('0x2f')]==='undefined';var _0x4aa290=_0x37ad40['count'];var _0x407b2c=_0x41348b?0x0:_0x553d8e[_0x86c9('0x2d')];var _0x27f017=_0x41348b?_0x37ad40['count']:_0x553d8e[_0x86c9('0x2d')]+_0x553d8e['limit'];var _0x3d09e8;if(_0x27f017>=_0x4aa290){_0x27f017=_0x4aa290;_0x3d09e8=0xc8;}else{_0x3d09e8=0xce;}_0x5eead3['status'](_0x3d09e8);return _0x5eead3[_0x86c9('0x30')](_0x86c9('0x31'),_0x407b2c+'-'+_0x27f017+'/'+_0x4aa290)[_0x86c9('0x2c')](_0x37ad40);}return null;};}function patchUpdates(_0x6c681d){return function(_0x27028b){try{jsonpatch[_0x86c9('0x32')](_0x27028b,_0x6c681d,!![]);}catch(_0x3a1bbd){return BPromise['reject'](_0x3a1bbd);}return _0x27028b['save']();};}function saveUpdates(_0x18d838,_0x5bbc39){return function(_0x170db9){if(_0x170db9){return _0x170db9['update'](_0x18d838)[_0x86c9('0x33')](function(_0x123fe3){return _0x123fe3;});}return null;};}function removeEntity(_0x3ec55f,_0x425f57){return function(_0x4509e9){if(_0x4509e9){return _0x4509e9[_0x86c9('0x34')]()[_0x86c9('0x33')](function(){_0x3ec55f[_0x86c9('0x2a')](0xcc)[_0x86c9('0x2b')]();});}};}function handleEntityNotFound(_0x16115b,_0x31b45f){return function(_0x357b82){if(!_0x357b82){_0x16115b[_0x86c9('0x35')](0x194);}return _0x357b82;};}function handleError(_0x8c778e,_0x39f28){_0x39f28=_0x39f28||0x1f4;return function(_0x322bb0){logger[_0x86c9('0x25')](_0x322bb0[_0x86c9('0x36')]);if(_0x322bb0[_0x86c9('0x37')]){delete _0x322bb0[_0x86c9('0x37')];}_0x8c778e[_0x86c9('0x2a')](_0x39f28)['send'](_0x322bb0);};}exports[_0x86c9('0x38')]=function(_0x322862,_0x30489a){var _0x264577={},_0x4cf751={},_0x1797b0={'count':0x0,'rows':[]};var _0x145aca=_[_0x86c9('0x39')](db['ChatMessage'][_0x86c9('0x3a')],function(_0x183b6e){return{'name':_0x183b6e[_0x86c9('0x3b')],'type':_0x183b6e[_0x86c9('0x3c')][_0x86c9('0x3d')]};});_0x4cf751['model']=_[_0x86c9('0x39')](_0x145aca,_0x86c9('0x37'));_0x4cf751[_0x86c9('0x3e')]=_[_0x86c9('0x3f')](_0x322862['query']);_0x4cf751['filters']=_[_0x86c9('0x40')](_0x4cf751[_0x86c9('0x41')],_0x4cf751[_0x86c9('0x3e')]);_0x264577[_0x86c9('0x42')]=_[_0x86c9('0x40')](_0x4cf751[_0x86c9('0x41')],qs[_0x86c9('0x43')](_0x322862['query'][_0x86c9('0x43')]));_0x264577['attributes']=_0x264577['attributes'][_0x86c9('0x44')]?_0x264577[_0x86c9('0x42')]:_0x4cf751['model'];if(!_0x322862[_0x86c9('0x3e')][_0x86c9('0x45')](_0x86c9('0x46'))){_0x264577[_0x86c9('0x2f')]=qs['limit'](_0x322862[_0x86c9('0x3e')][_0x86c9('0x2f')]);_0x264577[_0x86c9('0x2d')]=qs[_0x86c9('0x2d')](_0x322862[_0x86c9('0x3e')][_0x86c9('0x2d')]);}_0x264577[_0x86c9('0x47')]=qs[_0x86c9('0x48')](_0x322862[_0x86c9('0x3e')][_0x86c9('0x48')]);_0x264577[_0x86c9('0x49')]=qs[_0x86c9('0x4a')](_[_0x86c9('0x4b')](_0x322862[_0x86c9('0x3e')],_0x4cf751[_0x86c9('0x4a')]),_0x145aca);if(_0x322862['query']['filter']){_0x264577[_0x86c9('0x49')]=_[_0x86c9('0x4c')](_0x264577[_0x86c9('0x49')],{'$or':_[_0x86c9('0x39')](_0x145aca,function(_0x29c417){if(_0x29c417['type']!=='VIRTUAL'){var _0x47a5c6={};_0x47a5c6[_0x29c417[_0x86c9('0x37')]]={'$like':'%'+_0x322862[_0x86c9('0x3e')]['filter']+'%'};return _0x47a5c6;}})});}_0x264577=_[_0x86c9('0x4c')]({},_0x264577,_0x322862[_0x86c9('0x4d')]);var _0x27a14c={'where':_0x264577[_0x86c9('0x49')]};return db[_0x86c9('0x4e')][_0x86c9('0x4f')](_0x27a14c)[_0x86c9('0x33')](function(_0x1a7a23){_0x1797b0['count']=_0x1a7a23;if(_0x322862[_0x86c9('0x3e')]['includeAll']){_0x264577['include']=[{'all':!![]}];}return db[_0x86c9('0x4e')][_0x86c9('0x50')](_0x264577);})[_0x86c9('0x33')](function(_0x591802){_0x1797b0['rows']=_0x591802;return _0x1797b0;})[_0x86c9('0x33')](respondWithFilteredResult(_0x30489a,_0x264577))[_0x86c9('0x29')](handleError(_0x30489a,null));};exports[_0x86c9('0x51')]=function(_0x33dd94,_0x23fd6e){var _0x4b14a4={'raw':!![],'where':{'id':_0x33dd94[_0x86c9('0x52')]['id']}},_0x104141={};_0x104141['model']=_[_0x86c9('0x3f')](db[_0x86c9('0x4e')][_0x86c9('0x3a')]);_0x104141[_0x86c9('0x3e')]=_[_0x86c9('0x3f')](_0x33dd94['query']);_0x104141[_0x86c9('0x4a')]=_['intersection'](_0x104141['model'],_0x104141[_0x86c9('0x3e')]);_0x4b14a4[_0x86c9('0x42')]=_[_0x86c9('0x40')](_0x104141[_0x86c9('0x41')],qs[_0x86c9('0x43')](_0x33dd94['query']['fields']));_0x4b14a4[_0x86c9('0x42')]=_0x4b14a4['attributes'][_0x86c9('0x44')]?_0x4b14a4['attributes']:_0x104141[_0x86c9('0x41')];if(_0x33dd94[_0x86c9('0x3e')][_0x86c9('0x53')]){_0x4b14a4[_0x86c9('0x54')]=[{'all':!![]}];}_0x4b14a4=_[_0x86c9('0x4c')]({},_0x4b14a4,_0x33dd94[_0x86c9('0x4d')]);return db[_0x86c9('0x4e')][_0x86c9('0x55')](_0x4b14a4)[_0x86c9('0x33')](handleEntityNotFound(_0x23fd6e,null))['then'](respondWithResult(_0x23fd6e,null))[_0x86c9('0x29')](handleError(_0x23fd6e,null));};exports[_0x86c9('0x56')]=function(_0x50946b,_0x27d69f){return db[_0x86c9('0x4e')][_0x86c9('0x56')](_0x50946b[_0x86c9('0x57')],{})['then'](respondWithResult(_0x27d69f,0xc9))[_0x86c9('0x29')](handleError(_0x27d69f,null));};exports['update']=function(_0x44015f,_0x9f79b9){if(_0x44015f['body']['id']){delete _0x44015f['body']['id'];}return db[_0x86c9('0x4e')][_0x86c9('0x55')]({'where':{'id':_0x44015f[_0x86c9('0x52')]['id']}})[_0x86c9('0x33')](handleEntityNotFound(_0x9f79b9,null))[_0x86c9('0x33')](saveUpdates(_0x44015f['body'],null))[_0x86c9('0x33')](respondWithResult(_0x9f79b9,null))[_0x86c9('0x29')](handleError(_0x9f79b9,null));};exports['destroy']=function(_0x1e20bb,_0x38fabe){return db[_0x86c9('0x4e')][_0x86c9('0x55')]({'where':{'id':_0x1e20bb['params']['id']}})['then'](handleEntityNotFound(_0x38fabe,null))[_0x86c9('0x33')](removeEntity(_0x38fabe,null))[_0x86c9('0x29')](handleError(_0x38fabe,null));};exports['describe']=function(_0x4c0354,_0x7ac2ca){return db['ChatMessage'][_0x86c9('0x58')]()[_0x86c9('0x33')](respondWithResult(_0x7ac2ca,null))[_0x86c9('0x29')](handleError(_0x7ac2ca,null));};var interaction_log=require(_0x86c9('0x17'))('chat-interactions');exports[_0x86c9('0x59')]=function(_0x3ebb90,_0x1b3067,_0x5045a0){var _0x91685a={'agent':{},'channel':_0x86c9('0x5a')};if(_0x3ebb90[_0x86c9('0x57')]['id']){delete _0x3ebb90[_0x86c9('0x57')]['id'];}_0x3ebb90[_0x86c9('0x57')]['read']=!![];_0x3ebb90[_0x86c9('0x57')][_0x86c9('0x5b')]=moment()[_0x86c9('0x5c')](_0x86c9('0x5d'));_0x3ebb90[_0x86c9('0x57')][_0x86c9('0x5e')]=_0x3ebb90[_0x86c9('0x57')]['UserId']||_0x3ebb90['user']['id'];_0x91685a[_0x86c9('0x5f')]['id']=_0x3ebb90['body'][_0x86c9('0x5e')];return db[_0x86c9('0x4e')]['find']({'where':{'id':_0x3ebb90[_0x86c9('0x52')]['id'],'UserId':null}})[_0x86c9('0x33')](handleEntityNotFound(_0x1b3067,null))['then'](saveUpdates(_0x3ebb90[_0x86c9('0x57')],null))[_0x86c9('0x33')](function(_0x5e2c2e){if(_0x5e2c2e){_0x91685a[_0x86c9('0x27')]=_0x5e2c2e[_0x86c9('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x5e2c2e['ChatInteractionId']}});}return null;})[_0x86c9('0x33')](handleEntityNotFound(_0x1b3067,null))[_0x86c9('0x33')](function(_0x25fe42){if(_0x25fe42){return _0x25fe42[_0x86c9('0x61')]({'UserId':_0x3ebb90[_0x86c9('0x57')][_0x86c9('0x5e')],'read1stAt':_['isNil'](_0x25fe42['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x86c9('0x33')](function(_0x32ab1b){if(_0x32ab1b){_0x91685a[_0x86c9('0x62')]=_0x32ab1b['get']({'plain':!![]});interaction_log['info'](_0x86c9('0x63'),_0x3ebb90[_0x86c9('0x64')]['id'],_0x3ebb90[_0x86c9('0x64')][_0x86c9('0x37')],_0x3ebb90[_0x86c9('0x64')]['role'],_0x91685a[_0x86c9('0x62')]['id'],_0x3ebb90[_0x86c9('0x57')]?JSON[_0x86c9('0x24')](_0x3ebb90['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x86c9('0x65'),_0x91685a);}return null;})[_0x86c9('0x33')](function(_0x464437){var _0x1d8bd2=_0x86c9('0x66')+_0x464437[_0x86c9('0x27')][_0x86c9('0x67')];return db[_0x86c9('0x68')][_0x86c9('0x3e')](_0x1d8bd2,{'type':db[_0x86c9('0x69')][_0x86c9('0x6a')][_0x86c9('0x6b')],'raw':!![]})['then'](function(_0x20baaa){return _0x20baaa;});})[_0x86c9('0x33')](function(_0x3cb6bc){if(_0x3cb6bc){_0x91685a[_0x86c9('0x27')][_0x86c9('0x6c')]=_0x3cb6bc[0x0];if(!_0x3ebb90['body']['UserId'])return;return db[_0x86c9('0x6d')][_0x86c9('0x55')]({'where':{'id':_0x3ebb90[_0x86c9('0x57')]['UserId'],'role':_0x86c9('0x5f')},'attributes':['id',_0x86c9('0x37'),_0x86c9('0x6e'),_0x86c9('0x6f'),_0x86c9('0x70')],'raw':!![]});}return null;})[_0x86c9('0x33')](function(_0x11be9b){if(!_0x11be9b)return null;_0x91685a[_0x86c9('0x27')][_0x86c9('0x5f')]=_0x11be9b;return _0x91685a;})[_0x86c9('0x33')](function(_0x1c3d2b){if(_0x1c3d2b){if(_0x3ebb90[_0x86c9('0x57')][_0x86c9('0x71')]){_0x91685a[_0x86c9('0x27')][_0x86c9('0x72')]=util[_0x86c9('0x5c')]('SIP/%s',_0x3ebb90[_0x86c9('0x64')][_0x86c9('0x37')]);_0x91685a['message']['channel']=_0x91685a['channel'];_0x91685a[_0x86c9('0x27')][_0x86c9('0x73')]=_0x91685a[_0x86c9('0x74')];_0x91685a[_0x86c9('0x27')][_0x86c9('0x75')]=_0x86c9('0x59');return respondWithRpcPromise(_0x86c9('0x76'),_0x86c9('0x76'),{'event':_0x86c9('0x77'),'message':_['merge'](_0x91685a[_0x86c9('0x27')],JSON['parse'](_0x91685a[_0x86c9('0x62')][_0x86c9('0x78')]))},client9002)[_0x86c9('0x33')](function(){return _0x91685a;});}return _0x91685a;}return null;})[_0x86c9('0x33')](respondWithResult(_0x1b3067,null))[_0x86c9('0x29')](handleError(_0x1b3067,null));};var interaction_log=require(_0x86c9('0x17'))(_0x86c9('0x79'));exports[_0x86c9('0x7a')]=function(_0x457f04,_0x217eb3,_0x55cec7){var _0x2ae5de={'agent':{},'channel':_0x86c9('0x5a')};if(_0x457f04[_0x86c9('0x57')]['id']){delete _0x457f04['body']['id'];}_0x457f04[_0x86c9('0x57')]['UserId']=_0x457f04[_0x86c9('0x57')]['UserId']||_0x457f04['user']['id'];_0x2ae5de['agent']['id']=_0x457f04[_0x86c9('0x57')][_0x86c9('0x5e')];return db['ChatMessage']['find']({'where':{'id':_0x457f04['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x217eb3,null))[_0x86c9('0x33')](function(_0x3bbdc7){if(_0x3bbdc7){_0x2ae5de[_0x86c9('0x27')]=_0x3bbdc7[_0x86c9('0x60')]({'plain':!![]});return db[_0x86c9('0x7b')][_0x86c9('0x55')]({'where':{'id':_0x3bbdc7[_0x86c9('0x7c')]}});}return null;})[_0x86c9('0x33')](handleEntityNotFound(_0x217eb3,null))['then'](function(_0x26de3e){if(_0x26de3e){_0x2ae5de[_0x86c9('0x62')]=_0x26de3e[_0x86c9('0x60')]({'plain':!![]});interaction_log[_0x86c9('0x7d')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x457f04[_0x86c9('0x64')]['id'],_0x457f04[_0x86c9('0x64')]['name'],_0x457f04[_0x86c9('0x64')][_0x86c9('0x7e')],_0x2ae5de[_0x86c9('0x62')]['id'],_0x457f04[_0x86c9('0x57')]?JSON['stringify'](_0x457f04[_0x86c9('0x57')]):_0x86c9('0x7f'));return respondWithRpcPromise('RejectMessage',_0x86c9('0x80'),_0x2ae5de);}return null;})[_0x86c9('0x33')](function(_0x27b3aa){var _0x4bc3c4=_0x86c9('0x66')+_0x27b3aa[_0x86c9('0x27')][_0x86c9('0x67')];return db[_0x86c9('0x68')][_0x86c9('0x3e')](_0x4bc3c4,{'type':db['Sequelize']['QueryTypes'][_0x86c9('0x6b')],'raw':!![]})[_0x86c9('0x33')](function(_0x4bc4cc){return _0x4bc4cc;});})[_0x86c9('0x33')](function(_0xfb8b23){if(_0xfb8b23){_0x2ae5de[_0x86c9('0x27')][_0x86c9('0x6c')]=_0xfb8b23[0x0];if(!_0x457f04[_0x86c9('0x57')][_0x86c9('0x5e')])return;return db[_0x86c9('0x6d')][_0x86c9('0x55')]({'where':{'id':_0x457f04[_0x86c9('0x57')][_0x86c9('0x5e')],'role':'agent'},'attributes':['id',_0x86c9('0x37'),_0x86c9('0x6e'),'email',_0x86c9('0x70')],'raw':!![]});}return null;})[_0x86c9('0x33')](function(_0x4f084b){if(!_0x4f084b)return null;_0x2ae5de[_0x86c9('0x27')][_0x86c9('0x5f')]=_0x4f084b;return _0x2ae5de;})['then'](function(_0x4e91fe){if(_0x4e91fe){_0x4e91fe[_0x86c9('0x27')][_0x86c9('0x72')]=util['format']('SIP/%s',_0x457f04[_0x86c9('0x64')][_0x86c9('0x37')]);_0x4e91fe['message']['channel']=_0x2ae5de[_0x86c9('0x74')];_0x4e91fe['message'][_0x86c9('0x73')]=_0x2ae5de[_0x86c9('0x74')];_0x4e91fe[_0x86c9('0x27')][_0x86c9('0x75')]=_0x86c9('0x7a');respondWithRpcPromise(_0x86c9('0x76'),_0x86c9('0x76'),{'event':_0x86c9('0x81'),'message':_[_0x86c9('0x4c')](_0x2ae5de[_0x86c9('0x27')],JSON['parse'](_0x2ae5de[_0x86c9('0x62')]['formData']))},client9002);return _0x2ae5de;}return null;})[_0x86c9('0x33')](respondWithResult(_0x217eb3,null))['catch'](handleError(_0x217eb3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index dcda08b..4a250b3 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 _0xc55a=['update','remove','emit','hook','exports','events','ChatMessage','setMaxListeners','save'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xc55a,0x9e));var _0xac55=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc55a[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0xac55('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xac55('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xac55('0x2')](0x0);var events={'afterCreate':_0xac55('0x3'),'afterUpdate':_0xac55('0x4'),'afterDestroy':_0xac55('0x5')};function emitEvent(_0x4e8b6d){return function(_0x438d8,_0x144589,_0x27530d){ChatMessageEvents['emit'](_0x4e8b6d+':'+_0x438d8['id'],_0x438d8);ChatMessageEvents[_0xac55('0x6')](_0x4e8b6d,_0x438d8);_0x27530d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xac55('0x7')](e,emitEvent(event));}}module[_0xac55('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x896c=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x15a489,_0x5c0b85){var _0x281fa4=function(_0xb1ee7){while(--_0xb1ee7){_0x15a489['push'](_0x15a489['shift']());}};_0x281fa4(++_0x5c0b85);}(_0x896c,0xd2));var _0xc896=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x896c[_0x4b03c9];return _0x161ba2;};'use strict';var EventEmitter=require(_0xc896('0x0'));var ChatMessage=require(_0xc896('0x1'))['db'][_0xc896('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc896('0x3')](0x0);var events={'afterCreate':_0xc896('0x4'),'afterUpdate':_0xc896('0x5'),'afterDestroy':_0xc896('0x6')};function emitEvent(_0x86afbe){return function(_0x58b2b7,_0x261b68,_0x3b5421){ChatMessageEvents[_0xc896('0x7')](_0x86afbe+':'+_0x58b2b7['id'],_0x58b2b7);ChatMessageEvents[_0xc896('0x7')](_0x86afbe,_0x58b2b7);_0x3b5421(null);};}for(var e in events){if(events[_0xc896('0x8')](e)){var event=events[e];ChatMessage[_0xc896('0x9')](e,emitEvent(event));}}module[_0xc896('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1c52016..132dab7 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 _0x8b0d=['then','createdAt','catch','error','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x8b0d,0x1f2));var _0xd8b0=function(_0x3d0c6c,_0x56c36c){_0x3d0c6c=_0x3d0c6c-0x0;var _0x13f5b6=_0x8b0d[_0x3d0c6c];return _0x13f5b6;};'use strict';var _=require(_0xd8b0('0x0'));var util=require(_0xd8b0('0x1'));var logger=require(_0xd8b0('0x2'))('api');var moment=require(_0xd8b0('0x3'));var BPromise=require(_0xd8b0('0x4'));var rp=require(_0xd8b0('0x5'));var fs=require('fs');var path=require(_0xd8b0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8b0('0x7'));module[_0xd8b0('0x8')]=function(_0x34bae6,_0x1bd8cd){return _0x34bae6[_0xd8b0('0x9')]('ChatMessage',attributes,{'tableName':_0xd8b0('0xa'),'paranoid':![],'indexes':[{'name':_0xd8b0('0xb'),'fields':[_0xd8b0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51c1f2,_0x532c0c,_0x5bafb4){var _0x4e38bd=_0x34bae6[_0xd8b0('0xd')];var _0x6b2f28=_0x51c1f2['get']({'plain':!![]});if(_0x6b2f28[_0xd8b0('0xe')][_0xd8b0('0xf')]()==='in'||_0x6b2f28[_0xd8b0('0xe')][_0xd8b0('0xf')]()===_0xd8b0('0x10')&&!_0x6b2f28[_0xd8b0('0x11')]&&!_[_0xd8b0('0x12')](_0x6b2f28[_0xd8b0('0x13')])){_0x4e38bd['ChatInteraction'][_0xd8b0('0x14')]({'where':{'id':_0x6b2f28[_0xd8b0('0x15')]}})[_0xd8b0('0x16')](function(_0x564b7f){if(_0x564b7f){_0x564b7f['update']({'lastMsgAt':_0x6b2f28[_0xd8b0('0x17')],'lastMsgDirection':_0x6b2f28[_0xd8b0('0xe')][_0xd8b0('0xf')]()});}})[_0xd8b0('0x18')](function(_0x5f308c){console[_0xd8b0('0x19')](_0x5f308c);});}_0x5bafb4();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3dfa=['models','get','direction','toLowerCase','out','ChatInteraction','findOne','ChatInteractionId','then','update','catch','utf8mb4','lodash','util','moment','request-promise','path','rimraf','../../config/environment','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT'];(function(_0x472cfe,_0x161baf){var _0x22b3a2=function(_0x281466){while(--_0x281466){_0x472cfe['push'](_0x472cfe['shift']());}};_0x22b3a2(++_0x161baf);}(_0x3dfa,0x114));var _0xa3df=function(_0x17052c,_0x1c762d){_0x17052c=_0x17052c-0x0;var _0x3f436c=_0x3dfa[_0x17052c];return _0x3f436c;};'use strict';var _=require(_0xa3df('0x0'));var util=require(_0xa3df('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa3df('0x2'));var BPromise=require('bluebird');var rp=require(_0xa3df('0x3'));var fs=require('fs');var path=require(_0xa3df('0x4'));var rimraf=require(_0xa3df('0x5'));var config=require(_0xa3df('0x6'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x2af8b9,_0x39ed32){return _0x2af8b9[_0xa3df('0x7')](_0xa3df('0x8'),attributes,{'tableName':_0xa3df('0x9'),'paranoid':![],'indexes':[{'name':_0xa3df('0xa'),'fields':['body'],'type':_0xa3df('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b74ed,_0x2a02a2,_0xa25eab){var _0x4adbe0=_0x2af8b9[_0xa3df('0xc')];var _0x3ce422=_0x3b74ed[_0xa3df('0xd')]({'plain':!![]});if(_0x3ce422[_0xa3df('0xe')][_0xa3df('0xf')]()==='in'||_0x3ce422[_0xa3df('0xe')]['toLowerCase']()===_0xa3df('0x10')&&!_0x3ce422['secret']&&!_['isNil'](_0x3ce422['UserId'])){_0x4adbe0[_0xa3df('0x11')][_0xa3df('0x12')]({'where':{'id':_0x3ce422[_0xa3df('0x13')]}})[_0xa3df('0x14')](function(_0x5dcb75){if(_0x5dcb75){_0x5dcb75[_0xa3df('0x15')]({'lastMsgAt':_0x3ce422['createdAt'],'lastMsgDirection':_0x3ce422[_0xa3df('0xe')][_0xa3df('0xf')]()});}})[_0xa3df('0x16')](function(_0x5dcfa1){console['error'](_0x5dcfa1);});}_0xa25eab();}},'charset':_0xa3df('0x17'),'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 bdfd031..f1b474e 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 _0x3a94=['redis','defaults','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x11c93e,_0xd3235e){var _0x3d1726=function(_0x3dc228){while(--_0x3dc228){_0x11c93e['push'](_0x11c93e['shift']());}};_0x3d1726(++_0xd3235e);}(_0x3a94,0x105));var _0x43a9=function(_0x5866c7,_0x5f4a5c){_0x5866c7=_0x5866c7-0x0;var _0x14a350=_0x3a94[_0x5866c7];return _0x14a350;};'use strict';var _=require(_0x43a9('0x0'));var util=require(_0x43a9('0x1'));var moment=require('moment');var BPromise=require(_0x43a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43a9('0x3'));var db=require(_0x43a9('0x4'))['db'];var utils=require(_0x43a9('0x5'));var logger=require('../../config/logger')(_0x43a9('0x6'));var config=require(_0x43a9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x43a9('0x8')]['http']({'port':0x232a});config[_0x43a9('0x9')]=_[_0x43a9('0xa')](config[_0x43a9('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43a9('0x9')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4562f6,_0x95b0c2,_0x1b17f8){return new BPromise(function(_0x530d23,_0x31362d){return client[_0x43a9('0xb')](_0x4562f6,_0x1b17f8)[_0x43a9('0xc')](function(_0x1ba77b){logger['info'](_0x43a9('0xd'),_0x95b0c2,_0x43a9('0xe'));logger[_0x43a9('0xf')](_0x43a9('0x10'),_0x95b0c2,'request\x20sent',JSON[_0x43a9('0x11')](_0x1ba77b));if(_0x1ba77b['error']){if(_0x1ba77b['error'][_0x43a9('0x12')]===0x1f4){logger[_0x43a9('0x13')](_0x43a9('0xd'),_0x95b0c2,_0x1ba77b[_0x43a9('0x13')][_0x43a9('0x14')]);return _0x31362d(_0x1ba77b[_0x43a9('0x13')][_0x43a9('0x14')]);}logger[_0x43a9('0x13')](_0x43a9('0xd'),_0x95b0c2,_0x1ba77b[_0x43a9('0x13')]['message']);return _0x530d23(_0x1ba77b[_0x43a9('0x13')]['message']);}else{logger[_0x43a9('0x15')](_0x43a9('0xd'),_0x95b0c2,'request\x20sent');_0x530d23(_0x1ba77b[_0x43a9('0x16')]['message']);}})[_0x43a9('0x17')](function(_0x106898){logger[_0x43a9('0x13')](_0x43a9('0xd'),_0x95b0c2,_0x106898);_0x31362d(_0x106898);});});}exports[_0x43a9('0x18')]=function(_0x14b265){var _0x2bf949=this;return new Promise(function(_0x143e58,_0x4f69e8){return db[_0x43a9('0x19')][_0x43a9('0x1a')](_0x14b265[_0x43a9('0x1b')],{'raw':_0x14b265[_0x43a9('0x1c')]?_0x14b265['options'][_0x43a9('0x1d')]===undefined?!![]:![]:!![]})[_0x43a9('0xc')](function(_0x3de3ed){logger[_0x43a9('0x15')](_0x43a9('0x18'),_0x14b265);logger[_0x43a9('0xf')](_0x43a9('0x18'),_0x14b265,JSON['stringify'](_0x3de3ed));_0x143e58(_0x3de3ed);})[_0x43a9('0x17')](function(_0xbeb8ce){logger[_0x43a9('0x13')](_0x43a9('0x18'),_0xbeb8ce['message'],_0x14b265);_0x4f69e8(_0x2bf949[_0x43a9('0x13')](0x1f4,_0xbeb8ce['message']));});});}; \ No newline at end of file +var _0x961c=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring'];(function(_0x1534c3,_0x523f7a){var _0x3af905=function(_0x208c42){while(--_0x208c42){_0x1534c3['push'](_0x1534c3['shift']());}};_0x3af905(++_0x523f7a);}(_0x961c,0x15c));var _0xc961=function(_0x20255e,_0x2a615d){_0x20255e=_0x20255e-0x0;var _0x293046=_0x961c[_0x20255e];return _0x293046;};'use strict';var _=require(_0xc961('0x0'));var util=require('util');var moment=require(_0xc961('0x1'));var BPromise=require(_0xc961('0x2'));var rs=require(_0xc961('0x3'));var fs=require('fs');var Redis=require(_0xc961('0x4'));var db=require(_0xc961('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc961('0x6'))('rpc');var config=require(_0xc961('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc961('0x8')][_0xc961('0x9')]({'port':0x232a});config[_0xc961('0xa')]=_[_0xc961('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc961('0xc'))(new Redis(config[_0xc961('0xa')]));require('./chatMessage.socket')[_0xc961('0xd')](socket);function respondWithRpcPromise(_0x2890c9,_0x5d3789,_0x397033){return new BPromise(function(_0x34b028,_0x3315e1){return client[_0xc961('0xe')](_0x2890c9,_0x397033)[_0xc961('0xf')](function(_0x5c492e){logger[_0xc961('0x10')](_0xc961('0x11'),_0x5d3789,_0xc961('0x12'));logger[_0xc961('0x13')](_0xc961('0x14'),_0x5d3789,_0xc961('0x12'),JSON[_0xc961('0x15')](_0x5c492e));if(_0x5c492e[_0xc961('0x16')]){if(_0x5c492e[_0xc961('0x16')][_0xc961('0x17')]===0x1f4){logger[_0xc961('0x16')](_0xc961('0x11'),_0x5d3789,_0x5c492e[_0xc961('0x16')]['message']);return _0x3315e1(_0x5c492e[_0xc961('0x16')][_0xc961('0x18')]);}logger[_0xc961('0x16')](_0xc961('0x11'),_0x5d3789,_0x5c492e['error']['message']);return _0x34b028(_0x5c492e['error'][_0xc961('0x18')]);}else{logger[_0xc961('0x10')](_0xc961('0x11'),_0x5d3789,'request\x20sent');_0x34b028(_0x5c492e['result'][_0xc961('0x18')]);}})[_0xc961('0x19')](function(_0x799867){logger[_0xc961('0x16')](_0xc961('0x11'),_0x5d3789,_0x799867);_0x3315e1(_0x799867);});});}exports[_0xc961('0x1a')]=function(_0x259eff){var _0x422059=this;return new Promise(function(_0x39c74f,_0x100708){return db[_0xc961('0x1b')][_0xc961('0x1c')](_0x259eff[_0xc961('0x1d')],{'raw':_0x259eff['options']?_0x259eff[_0xc961('0x1e')][_0xc961('0x1f')]===undefined?!![]:![]:!![]})[_0xc961('0xf')](function(_0x14180e){logger['info']('CreateChatMessage',_0x259eff);logger[_0xc961('0x13')](_0xc961('0x1a'),_0x259eff,JSON[_0xc961('0x15')](_0x14180e));_0x39c74f(_0x14180e);})[_0xc961('0x19')](function(_0x75767e){logger[_0xc961('0x16')](_0xc961('0x1a'),_0x75767e[_0xc961('0x18')],_0x259eff);_0x100708(_0x422059[_0xc961('0x16')](0x1f4,_0x75767e[_0xc961('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 05d8854..9e9bb64 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 _0x1db9=['remove','update','emit','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x2f742b,_0x3ca4ad){var _0x4ffc39=function(_0x236f2f){while(--_0x236f2f){_0x2f742b['push'](_0x2f742b['shift']());}};_0x4ffc39(++_0x3ca4ad);}(_0x1db9,0x176));var _0x91db=function(_0x359e56,_0x4522f6){_0x359e56=_0x359e56-0x0;var _0x2b2662=_0x1db9[_0x359e56];return _0x2b2662;};'use strict';var ChatMessageEvents=require(_0x91db('0x0'));var events=[_0x91db('0x1'),_0x91db('0x2'),_0x91db('0x3')];function createListener(_0xcdfaed,_0xb6de0b){return function(_0x49b8c5){_0xb6de0b[_0x91db('0x4')](_0xcdfaed,_0x49b8c5);};}function removeListener(_0x42ae75,_0x59c944){return function(){ChatMessageEvents['removeListener'](_0x42ae75,_0x59c944);};}exports[_0x91db('0x5')]=function(_0x4b3f5c){for(var _0x5e69d9=0x0,_0x433c75=events[_0x91db('0x6')];_0x5e69d9<_0x433c75;_0x5e69d9++){var _0x45fea0=events[_0x5e69d9];var _0x2330c2=createListener(_0x91db('0x7')+_0x45fea0,_0x4b3f5c);ChatMessageEvents['on'](_0x45fea0,_0x2330c2);}}; \ No newline at end of file +var _0x0d4d=['remove','update','emit','removeListener','chatMessage:','./chatMessage.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0d4d,0x132));var _0xd0d4=function(_0x3c937a,_0x551cb8){_0x3c937a=_0x3c937a-0x0;var _0x2a74a6=_0x0d4d[_0x3c937a];return _0x2a74a6;};'use strict';var ChatMessageEvents=require(_0xd0d4('0x0'));var events=[_0xd0d4('0x1'),_0xd0d4('0x2'),_0xd0d4('0x3')];function createListener(_0x1f74ab,_0x1515e0){return function(_0x4d5c19){_0x1515e0[_0xd0d4('0x4')](_0x1f74ab,_0x4d5c19);};}function removeListener(_0x58909f,_0x2e99ee){return function(){ChatMessageEvents[_0xd0d4('0x5')](_0x58909f,_0x2e99ee);};}exports['register']=function(_0x34d93b){for(var _0x3db5ab=0x0,_0x1c5d01=events['length'];_0x3db5ab<_0x1c5d01;_0x3db5ab++){var _0x5bfae8=events[_0x3db5ab];var _0x5403c0=createListener(_0xd0d4('0x6')+_0x5bfae8,_0x34d93b);ChatMessageEvents['on'](_0x5bfae8,_0x5403c0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 008819d..a44fd07 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 _0x15bb=['chatmessage:create','create','put','update','accept','/:id/reject','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','post','tracked','chat'];(function(_0x2b435e,_0x427598){var _0x4cab98=function(_0x5d4981){while(--_0x5d4981){_0x2b435e['push'](_0x2b435e['shift']());}};_0x4cab98(++_0x427598);}(_0x15bb,0x140));var _0xb15b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x15bb[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xb15b('0x0'));var util=require(_0xb15b('0x1'));var path=require(_0xb15b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb15b('0x3'));var router=express[_0xb15b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb15b('0x5'));var interaction=require(_0xb15b('0x6'));var config=require(_0xb15b('0x7'));var controller=require(_0xb15b('0x8'));router[_0xb15b('0x9')]('/',auth[_0xb15b('0xa')](),controller[_0xb15b('0xb')]);router[_0xb15b('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb15b('0x9')](_0xb15b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb15b('0xd')]('/',auth[_0xb15b('0xa')](),interaction[_0xb15b('0xe')](_0xb15b('0xf'),_0xb15b('0x10')),controller[_0xb15b('0x11')]);router[_0xb15b('0x12')]('/:id',controller[_0xb15b('0x13')]);router[_0xb15b('0x12')]('/:id/accept',auth[_0xb15b('0xa')](),controller[_0xb15b('0x14')]);router['put'](_0xb15b('0x15'),auth[_0xb15b('0xa')](),controller['reject']);router[_0xb15b('0x16')]('/:id',auth[_0xb15b('0xa')](),controller['destroy']);module[_0xb15b('0x17')]=router; \ No newline at end of file +var _0x2b96=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x2b96,0x18d));var _0x62b9=function(_0x38b575,_0x1f33cf){_0x38b575=_0x38b575-0x0;var _0x53f0c8=_0x2b96[_0x38b575];return _0x53f0c8;};'use strict';var multer=require(_0x62b9('0x0'));var util=require(_0x62b9('0x1'));var path=require(_0x62b9('0x2'));var timeout=require(_0x62b9('0x3'));var express=require(_0x62b9('0x4'));var router=express[_0x62b9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x62b9('0x6'));var interaction=require(_0x62b9('0x7'));var config=require(_0x62b9('0x8'));var controller=require(_0x62b9('0x9'));router[_0x62b9('0xa')]('/',auth[_0x62b9('0xb')](),controller[_0x62b9('0xc')]);router['get'](_0x62b9('0xd'),auth[_0x62b9('0xb')](),controller[_0x62b9('0xe')]);router[_0x62b9('0xa')](_0x62b9('0xf'),auth['isAuthenticated'](),controller[_0x62b9('0x10')]);router[_0x62b9('0x11')]('/',auth[_0x62b9('0xb')](),interaction[_0x62b9('0x12')](_0x62b9('0x13'),_0x62b9('0x14')),controller[_0x62b9('0x15')]);router[_0x62b9('0x16')](_0x62b9('0xf'),controller['update']);router[_0x62b9('0x16')](_0x62b9('0x17'),auth[_0x62b9('0xb')](),controller[_0x62b9('0x18')]);router[_0x62b9('0x16')](_0x62b9('0x19'),auth[_0x62b9('0xb')](),controller[_0x62b9('0x1a')]);router[_0x62b9('0x1b')](_0x62b9('0xf'),auth[_0x62b9('0xb')](),controller[_0x62b9('0x1c')]);module[_0x62b9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 70132e0..2d6dfb1 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 _0x757a=['exports','TEXT'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x757a,0xde));var _0xa757=function(_0x43745e,_0x5db622){_0x43745e=_0x43745e-0x0;var _0x24b299=_0x757a[_0x43745e];return _0x24b299;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x20fb43,_0x2fff0b){var _0x3d31b8=function(_0x359930){while(--_0x359930){_0x20fb43['push'](_0x20fb43['shift']());}};_0x3d31b8(++_0x2fff0b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1d6f460..f24036a 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(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x7a54,0x106));var _0x47a5=function(_0x545264,_0x5930ed){_0x545264=_0x545264-0x0;var _0x5796fb=_0x7a54[_0x545264];return _0x5796fb;};'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(_0x58e8f9,_0x25faae){var _0x2b02a2=function(_0x200979){while(--_0x200979){_0x58e8f9['push'](_0x58e8f9['shift']());}};_0x2b02a2(++_0x25faae);}(_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['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 fb1160c..ba134d5 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 _0x7e4b=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x3bcdce,_0x1c46e6){var _0x4bf157=function(_0x481b75){while(--_0x481b75){_0x3bcdce['push'](_0x3bcdce['shift']());}};_0x4bf157(++_0x1c46e6);}(_0x7e4b,0x84));var _0xb7e4=function(_0x138edd,_0x2ff254){_0x138edd=_0x138edd-0x0;var _0x53c23d=_0x7e4b[_0x138edd];return _0x53c23d;};'use strict';var EventEmitter=require(_0xb7e4('0x0'));var ChatOfflineMessage=require(_0xb7e4('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb7e4('0x2')](0x0);var events={'afterCreate':_0xb7e4('0x3'),'afterUpdate':'update','afterDestroy':_0xb7e4('0x4')};function emitEvent(_0x1d32fd){return function(_0x2fca1d,_0x32f781,_0xb51013){ChatOfflineMessageEvents[_0xb7e4('0x5')](_0x1d32fd+':'+_0x2fca1d['id'],_0x2fca1d);ChatOfflineMessageEvents[_0xb7e4('0x5')](_0x1d32fd,_0x2fca1d);_0xb51013(null);};}for(var e in events){if(events[_0xb7e4('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xb7e4('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x1033=['update','remove','emit','hasOwnProperty','hook','exports','ChatOfflineMessage','setMaxListeners','save'];(function(_0x4f4669,_0x5af05d){var _0x48b29d=function(_0x3609e1){while(--_0x3609e1){_0x4f4669['push'](_0x4f4669['shift']());}};_0x48b29d(++_0x5af05d);}(_0x1033,0x11d));var _0x3103=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x1033[_0x1b2ff7];return _0x31656a;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x3103('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3103('0x1')](0x0);var events={'afterCreate':_0x3103('0x2'),'afterUpdate':_0x3103('0x3'),'afterDestroy':_0x3103('0x4')};function emitEvent(_0x4b7881){return function(_0x592134,_0x431007,_0x5b10c1){ChatOfflineMessageEvents['emit'](_0x4b7881+':'+_0x592134['id'],_0x592134);ChatOfflineMessageEvents[_0x3103('0x5')](_0x4b7881,_0x592134);_0x5b10c1(null);};}for(var e in events){if(events[_0x3103('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x3103('0x7')](e,emitEvent(event));}}module[_0x3103('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 51fe314..f3caa96 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 _0x72c2=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','ChatOfflineMessage'];(function(_0x383a3e,_0xc109a6){var _0x1cd2aa=function(_0x25205c){while(--_0x25205c){_0x383a3e['push'](_0x383a3e['shift']());}};_0x1cd2aa(++_0xc109a6);}(_0x72c2,0x132));var _0x272c=function(_0x3aad8b,_0x2384cb){_0x3aad8b=_0x3aad8b-0x0;var _0x227096=_0x72c2[_0x3aad8b];return _0x227096;};'use strict';var attributes=require(_0x272c('0x0'));module['exports']=function(_0x5de54e){return _0x5de54e['define'](_0x272c('0x1'),attributes,{'tableName':_0x272c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x272c('0x3')});}; \ No newline at end of file +var _0x6617=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x6617,0x1d2));var _0x7661=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x6617[_0x5e238b];return _0x389bea;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x7661('0x0')]=function(_0x11c9e9){return _0x11c9e9[_0x7661('0x1')](_0x7661('0x2'),attributes,{'tableName':_0x7661('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7661('0x4'),'collate':_0x7661('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 081ae63..230876a 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 _0xa3b4=['info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x476062,_0x5b30ee){var _0x1b6d6a=function(_0x11a808){while(--_0x11a808){_0x476062['push'](_0x476062['shift']());}};_0x1b6d6a(++_0x5b30ee);}(_0xa3b4,0x130));var _0x4a3b=function(_0x3c3b00,_0x2e7f24){_0x3c3b00=_0x3c3b00-0x0;var _0x5bba7c=_0xa3b4[_0x3c3b00];return _0x5bba7c;};'use strict';var _=require('lodash');var util=require(_0x4a3b('0x0'));var moment=require(_0x4a3b('0x1'));var BPromise=require(_0x4a3b('0x2'));var rs=require(_0x4a3b('0x3'));var fs=require('fs');var Redis=require(_0x4a3b('0x4'));var db=require(_0x4a3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a3b('0x6'));var config=require(_0x4a3b('0x7'));var jayson=require(_0x4a3b('0x8'));var client=jayson[_0x4a3b('0x9')][_0x4a3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x249afb,_0x453cf3,_0x3599b0){return new BPromise(function(_0x36e55a,_0x198912){return client['request'](_0x249afb,_0x3599b0)['then'](function(_0x2865e1){logger[_0x4a3b('0xb')](_0x4a3b('0xc'),_0x453cf3,_0x4a3b('0xd'));logger[_0x4a3b('0xe')](_0x4a3b('0xf'),_0x453cf3,_0x4a3b('0xd'),JSON[_0x4a3b('0x10')](_0x2865e1));if(_0x2865e1[_0x4a3b('0x11')]){if(_0x2865e1[_0x4a3b('0x11')]['code']===0x1f4){logger[_0x4a3b('0x11')](_0x4a3b('0xc'),_0x453cf3,_0x2865e1['error']['message']);return _0x198912(_0x2865e1[_0x4a3b('0x11')][_0x4a3b('0x12')]);}logger['error'](_0x4a3b('0xc'),_0x453cf3,_0x2865e1['error'][_0x4a3b('0x12')]);return _0x36e55a(_0x2865e1[_0x4a3b('0x11')][_0x4a3b('0x12')]);}else{logger[_0x4a3b('0xb')](_0x4a3b('0xc'),_0x453cf3,'request\x20sent');_0x36e55a(_0x2865e1[_0x4a3b('0x13')][_0x4a3b('0x12')]);}})[_0x4a3b('0x14')](function(_0x125402){logger[_0x4a3b('0x11')](_0x4a3b('0xc'),_0x453cf3,_0x125402);_0x198912(_0x125402);});});} \ No newline at end of file +var _0x5f79=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x108c1c,_0x5db8b3){var _0x3face4=function(_0x12da50){while(--_0x12da50){_0x108c1c['push'](_0x108c1c['shift']());}};_0x3face4(++_0x5db8b3);}(_0x5f79,0x92));var _0x95f7=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x5f79[_0x204eb7];return _0x37e444;};'use strict';var _=require('lodash');var util=require(_0x95f7('0x0'));var moment=require(_0x95f7('0x1'));var BPromise=require(_0x95f7('0x2'));var rs=require(_0x95f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95f7('0x4'));var logger=require(_0x95f7('0x5'))(_0x95f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x95f7('0x7'));var client=jayson['client'][_0x95f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe91a6d,_0x5819a6,_0x4bf8de){return new BPromise(function(_0x229ab2,_0x3693ea){return client[_0x95f7('0x9')](_0xe91a6d,_0x4bf8de)[_0x95f7('0xa')](function(_0xb08c28){logger[_0x95f7('0xb')](_0x95f7('0xc'),_0x5819a6,'request\x20sent');logger[_0x95f7('0xd')](_0x95f7('0xe'),_0x5819a6,_0x95f7('0xf'),JSON[_0x95f7('0x10')](_0xb08c28));if(_0xb08c28[_0x95f7('0x11')]){if(_0xb08c28[_0x95f7('0x11')][_0x95f7('0x12')]===0x1f4){logger[_0x95f7('0x11')](_0x95f7('0xc'),_0x5819a6,_0xb08c28[_0x95f7('0x11')]['message']);return _0x3693ea(_0xb08c28['error'][_0x95f7('0x13')]);}logger[_0x95f7('0x11')](_0x95f7('0xc'),_0x5819a6,_0xb08c28[_0x95f7('0x11')]['message']);return _0x229ab2(_0xb08c28['error']['message']);}else{logger[_0x95f7('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5819a6,_0x95f7('0xf'));_0x229ab2(_0xb08c28[_0x95f7('0x14')][_0x95f7('0x13')]);}})[_0x95f7('0x15')](function(_0x50998e){logger[_0x95f7('0x11')](_0x95f7('0xc'),_0x5819a6,_0x50998e);_0x3693ea(_0x50998e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a26f718..3f8039a 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 _0xcffa=['show','create','put','update','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','./chatOfflineMessage.controller','get','isAuthenticated','describe'];(function(_0x5c3429,_0x305dbc){var _0x3e8263=function(_0x4f8fc4){while(--_0x4f8fc4){_0x5c3429['push'](_0x5c3429['shift']());}};_0x3e8263(++_0x305dbc);}(_0xcffa,0x127));var _0xacff=function(_0x397e03,_0x3fb121){_0x397e03=_0x397e03-0x0;var _0x4a3202=_0xcffa[_0x397e03];return _0x4a3202;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacff('0x0'));var timeout=require(_0xacff('0x1'));var express=require(_0xacff('0x2'));var router=express[_0xacff('0x3')]();var fs_extra=require(_0xacff('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xacff('0x5'));router[_0xacff('0x6')]('/',auth[_0xacff('0x7')](),controller['index']);router[_0xacff('0x6')]('/describe',auth[_0xacff('0x7')](),controller[_0xacff('0x8')]);router[_0xacff('0x6')]('/:id',auth[_0xacff('0x7')](),controller[_0xacff('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xacff('0xa')]);router[_0xacff('0xb')]('/:id',auth[_0xacff('0x7')](),controller[_0xacff('0xc')]);router['delete'](_0xacff('0xd'),auth['isAuthenticated'](),controller[_0xacff('0xe')]);module[_0xacff('0xf')]=router; \ No newline at end of file +var _0x8863=['/:id','isAuthenticated','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe'];(function(_0x2d0f4a,_0x4c32f3){var _0x5b9256=function(_0x2d7116){while(--_0x2d7116){_0x2d0f4a['push'](_0x2d0f4a['shift']());}};_0x5b9256(++_0x4c32f3);}(_0x8863,0xc5));var _0x3886=function(_0x5ed695,_0x4bf6bb){_0x5ed695=_0x5ed695-0x0;var _0x18a87f=_0x8863[_0x5ed695];return _0x18a87f;};'use strict';var multer=require('multer');var util=require(_0x3886('0x0'));var path=require(_0x3886('0x1'));var timeout=require(_0x3886('0x2'));var express=require(_0x3886('0x3'));var router=express[_0x3886('0x4')]();var fs_extra=require(_0x3886('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3886('0x6'));var config=require(_0x3886('0x7'));var controller=require(_0x3886('0x8'));router[_0x3886('0x9')]('/',auth['isAuthenticated'](),controller[_0x3886('0xa')]);router[_0x3886('0x9')](_0x3886('0xb'),auth['isAuthenticated'](),controller[_0x3886('0xc')]);router[_0x3886('0x9')](_0x3886('0xd'),auth[_0x3886('0xe')](),controller['show']);router[_0x3886('0xf')]('/',auth[_0x3886('0xe')](),controller[_0x3886('0x10')]);router[_0x3886('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3886('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3886('0x13')]);module[_0x3886('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index fe22463..61cb203 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 _0x1d8d=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x202e32,_0x432fa5){var _0x3c6bde=function(_0x54d8f7){while(--_0x54d8f7){_0x202e32['push'](_0x202e32['shift']());}};_0x3c6bde(++_0x432fa5);}(_0x1d8d,0x1d0));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1d8('0x0'));module[_0xd1d8('0x1')]={'name':{'type':Sequelize[_0xd1d8('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd1d8('0x3'),_0xd1d8('0x4')),'defaultValue':_0xd1d8('0x3')},'selector':{'type':Sequelize[_0xd1d8('0x2')]},'timeout':{'type':Sequelize[_0xd1d8('0x5')]}}; \ No newline at end of file +var _0x8884=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x5503ef,_0x3587f1){var _0x1f5c6f=function(_0x210dbb){while(--_0x210dbb){_0x5503ef['push'](_0x5503ef['shift']());}};_0x1f5c6f(++_0x3587f1);}(_0x8884,0x9a));var _0x4888=function(_0x5edf38,_0x279ecf){_0x5edf38=_0x5edf38-0x0;var _0x13adc2=_0x8884[_0x5edf38];return _0x13adc2;};'use strict';var Sequelize=require(_0x4888('0x0'));module[_0x4888('0x1')]={'name':{'type':Sequelize[_0x4888('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4888('0x3'),_0x4888('0x4')),'defaultValue':_0x4888('0x3')},'selector':{'type':Sequelize[_0x4888('0x2')]},'timeout':{'type':Sequelize[_0x4888('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e4cf1d3..e92ed4b 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 _0x0e85=['length','include','options','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0e85,0x7c));var _0x50e8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x0e85[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['show']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={'raw':!![],'where':{'id':_0x30fedf[_0x50e8('0x28')]['id']}},_0x4f0b88={};_0x4f0b88[_0x50e8('0x29')]=_[_0x50e8('0x2a')](db[_0x50e8('0x2b')][_0x50e8('0x2c')]);_0x4f0b88[_0x50e8('0x2d')]=_[_0x50e8('0x2a')](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x4f0b88['model'],_0x4f0b88['query']);_0x42bbef[_0x50e8('0x30')]=_[_0x50e8('0x2f')](_0x4f0b88[_0x50e8('0x29')],qs['fields'](_0x30fedf['query'][_0x50e8('0x31')]));_0x42bbef[_0x50e8('0x30')]=_0x42bbef['attributes'][_0x50e8('0x32')]?_0x42bbef[_0x50e8('0x30')]:_0x4f0b88[_0x50e8('0x29')];if(_0x30fedf[_0x50e8('0x2d')]['includeAll']){_0x42bbef[_0x50e8('0x33')]=[{'all':!![]}];}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x34')]);return db[_0x50e8('0x2b')][_0x50e8('0x35')](_0x42bbef)['then'](handleEntityNotFound(_0x39c0c6,null))[_0x50e8('0x23')](respondWithResult(_0x39c0c6,null))[_0x50e8('0x36')](handleError(_0x39c0c6,null));};exports['create']=function(_0x245b45,_0x1c2fdb){return db[_0x50e8('0x2b')][_0x50e8('0x37')](_0x245b45['body'],{})[_0x50e8('0x23')](respondWithResult(_0x1c2fdb,0xc9))[_0x50e8('0x36')](handleError(_0x1c2fdb,null));};exports[_0x50e8('0x22')]=function(_0x4e2a37,_0x5e556c){if(_0x4e2a37[_0x50e8('0x38')]['id']){delete _0x4e2a37[_0x50e8('0x38')]['id'];}return db[_0x50e8('0x2b')]['find']({'where':{'id':_0x4e2a37['params']['id']}})['then'](handleEntityNotFound(_0x5e556c,null))[_0x50e8('0x23')](saveUpdates(_0x4e2a37[_0x50e8('0x38')],null))[_0x50e8('0x23')](respondWithResult(_0x5e556c,null))[_0x50e8('0x36')](handleError(_0x5e556c,null));};exports[_0x50e8('0x39')]=function(_0x18986f,_0xb566c2){return db[_0x50e8('0x2b')][_0x50e8('0x35')]({'where':{'id':_0x18986f[_0x50e8('0x28')]['id']}})['then'](handleEntityNotFound(_0xb566c2,null))[_0x50e8('0x23')](removeEntity(_0xb566c2,null))[_0x50e8('0x36')](handleError(_0xb566c2,null));}; \ No newline at end of file +var _0x28aa=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x2fc8a8,_0x71c3a2){var _0x3597b4=function(_0x41c345){while(--_0x41c345){_0x2fc8a8['push'](_0x2fc8a8['shift']());}};_0x3597b4(++_0x71c3a2);}(_0x28aa,0xf8));var _0xa28a=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x28aa[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa28a('0x0'));var zipdir=require(_0xa28a('0x1'));var jsonpatch=require(_0xa28a('0x2'));var rp=require(_0xa28a('0x3'));var moment=require(_0xa28a('0x4'));var BPromise=require(_0xa28a('0x5'));var Mustache=require('mustache');var util=require(_0xa28a('0x6'));var path=require(_0xa28a('0x7'));var sox=require(_0xa28a('0x8'));var csv=require(_0xa28a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa28a('0xa'));var _=require(_0xa28a('0xb'));var squel=require(_0xa28a('0xc'));var crypto=require(_0xa28a('0xd'));var jsforce=require(_0xa28a('0xe'));var deskjs=require(_0xa28a('0xf'));var toCsv=require(_0xa28a('0x9'));var querystring=require(_0xa28a('0x10'));var Papa=require(_0xa28a('0x11'));var Redis=require(_0xa28a('0x12'));var authService=require(_0xa28a('0x13'));var qs=require(_0xa28a('0x14'));var as=require(_0xa28a('0x15'));var hardwareService=require(_0xa28a('0x16'));var logger=require(_0xa28a('0x17'))('api');var utils=require(_0xa28a('0x18'));var config=require(_0xa28a('0x19'));var licenseUtil=require(_0xa28a('0x1a'));var db=require(_0xa28a('0x1b'))['db'];function respondWithStatusCode(_0x5c93d6,_0x94e91f){_0x94e91f=_0x94e91f||0xcc;return function(_0x3e254c){if(_0x3e254c){return _0x5c93d6['sendStatus'](_0x94e91f);}return _0x5c93d6[_0xa28a('0x1c')](_0x94e91f)[_0xa28a('0x1d')]();};}function respondWithResult(_0x69f85f,_0x412e0d){_0x412e0d=_0x412e0d||0xc8;return function(_0x52ee62){if(_0x52ee62){return _0x69f85f[_0xa28a('0x1c')](_0x412e0d)[_0xa28a('0x1e')](_0x52ee62);}};}function respondWithFilteredResult(_0x11ef7c,_0x1b4f6f){return function(_0x413d48){if(_0x413d48){var _0x56c1ae=typeof _0x1b4f6f[_0xa28a('0x1f')]===_0xa28a('0x20')&&typeof _0x1b4f6f[_0xa28a('0x21')]==='undefined';var _0x15d22f=_0x413d48[_0xa28a('0x22')];var _0x468672=_0x56c1ae?0x0:_0x1b4f6f[_0xa28a('0x1f')];var _0x1fc027=_0x56c1ae?_0x413d48['count']:_0x1b4f6f['offset']+_0x1b4f6f[_0xa28a('0x21')];var _0x516340;if(_0x1fc027>=_0x15d22f){_0x1fc027=_0x15d22f;_0x516340=0xc8;}else{_0x516340=0xce;}_0x11ef7c['status'](_0x516340);return _0x11ef7c[_0xa28a('0x23')](_0xa28a('0x24'),_0x468672+'-'+_0x1fc027+'/'+_0x15d22f)[_0xa28a('0x1e')](_0x413d48);}return null;};}function patchUpdates(_0x46173d){return function(_0x115d49){try{jsonpatch[_0xa28a('0x25')](_0x115d49,_0x46173d,!![]);}catch(_0x3b0c0f){return BPromise[_0xa28a('0x26')](_0x3b0c0f);}return _0x115d49[_0xa28a('0x27')]();};}function saveUpdates(_0x512e6c,_0x15b9cf){return function(_0x43bf00){if(_0x43bf00){return _0x43bf00['update'](_0x512e6c)[_0xa28a('0x28')](function(_0x187981){return _0x187981;});}return null;};}function removeEntity(_0x461ab4,_0x57cd58){return function(_0x3770e4){if(_0x3770e4){return _0x3770e4[_0xa28a('0x29')]()['then'](function(){_0x461ab4[_0xa28a('0x1c')](0xcc)[_0xa28a('0x1d')]();});}};}function handleEntityNotFound(_0xa3541b,_0x41c68b){return function(_0x3751b8){if(!_0x3751b8){_0xa3541b['sendStatus'](0x194);}return _0x3751b8;};}function handleError(_0x5df6e5,_0x2c93a1){_0x2c93a1=_0x2c93a1||0x1f4;return function(_0x5502bf){logger[_0xa28a('0x2a')](_0x5502bf['stack']);if(_0x5502bf['name']){delete _0x5502bf[_0xa28a('0x2b')];}_0x5df6e5[_0xa28a('0x1c')](_0x2c93a1)[_0xa28a('0x2c')](_0x5502bf);};}exports[_0xa28a('0x2d')]=function(_0x5514f5,_0x103b0b){var _0x54d26d={'raw':!![],'where':{'id':_0x5514f5[_0xa28a('0x2e')]['id']}},_0x26c998={};_0x26c998[_0xa28a('0x2f')]=_[_0xa28a('0x30')](db[_0xa28a('0x31')][_0xa28a('0x32')]);_0x26c998[_0xa28a('0x33')]=_[_0xa28a('0x30')](_0x5514f5[_0xa28a('0x33')]);_0x26c998[_0xa28a('0x34')]=_[_0xa28a('0x35')](_0x26c998['model'],_0x26c998[_0xa28a('0x33')]);_0x54d26d['attributes']=_[_0xa28a('0x35')](_0x26c998[_0xa28a('0x2f')],qs[_0xa28a('0x36')](_0x5514f5['query'][_0xa28a('0x36')]));_0x54d26d[_0xa28a('0x37')]=_0x54d26d[_0xa28a('0x37')][_0xa28a('0x38')]?_0x54d26d['attributes']:_0x26c998[_0xa28a('0x2f')];if(_0x5514f5[_0xa28a('0x33')]['includeAll']){_0x54d26d[_0xa28a('0x39')]=[{'all':!![]}];}_0x54d26d=_[_0xa28a('0x3a')]({},_0x54d26d,_0x5514f5[_0xa28a('0x3b')]);return db[_0xa28a('0x31')][_0xa28a('0x3c')](_0x54d26d)['then'](handleEntityNotFound(_0x103b0b,null))[_0xa28a('0x28')](respondWithResult(_0x103b0b,null))[_0xa28a('0x3d')](handleError(_0x103b0b,null));};exports[_0xa28a('0x3e')]=function(_0x501dbf,_0x451c05){return db[_0xa28a('0x31')]['create'](_0x501dbf[_0xa28a('0x3f')],{})[_0xa28a('0x28')](respondWithResult(_0x451c05,0xc9))[_0xa28a('0x3d')](handleError(_0x451c05,null));};exports[_0xa28a('0x40')]=function(_0x4f6968,_0x2d74d1){if(_0x4f6968[_0xa28a('0x3f')]['id']){delete _0x4f6968[_0xa28a('0x3f')]['id'];}return db[_0xa28a('0x31')][_0xa28a('0x3c')]({'where':{'id':_0x4f6968['params']['id']}})[_0xa28a('0x28')](handleEntityNotFound(_0x2d74d1,null))[_0xa28a('0x28')](saveUpdates(_0x4f6968[_0xa28a('0x3f')],null))['then'](respondWithResult(_0x2d74d1,null))[_0xa28a('0x3d')](handleError(_0x2d74d1,null));};exports['destroy']=function(_0x5cf3af,_0x119338){return db[_0xa28a('0x31')][_0xa28a('0x3c')]({'where':{'id':_0x5cf3af[_0xa28a('0x2e')]['id']}})['then'](handleEntityNotFound(_0x119338,null))[_0xa28a('0x28')](removeEntity(_0x119338,null))['catch'](handleError(_0x119338,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b870063..274ca0c 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 _0x2465=['api','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x28e96c,_0x2d75ed){var _0x1db3d5=function(_0x101ebd){while(--_0x101ebd){_0x28e96c['push'](_0x28e96c['shift']());}};_0x1db3d5(++_0x2d75ed);}(_0x2465,0x171));var _0x5246=function(_0x326dae,_0x17f35a){_0x326dae=_0x326dae-0x0;var _0x2e1cbd=_0x2465[_0x326dae];return _0x2e1cbd;};'use strict';var _=require(_0x5246('0x0'));var util=require(_0x5246('0x1'));var logger=require(_0x5246('0x2'))(_0x5246('0x3'));var moment=require('moment');var BPromise=require(_0x5246('0x4'));var rp=require(_0x5246('0x5'));var fs=require('fs');var path=require(_0x5246('0x6'));var rimraf=require(_0x5246('0x7'));var config=require('../../config/environment');var attributes=require(_0x5246('0x8'));module['exports']=function(_0x5d5f08,_0xa7c9e5){return _0x5d5f08[_0x5246('0x9')](_0x5246('0xa'),attributes,{'tableName':_0x5246('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4783=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction','util'];(function(_0x5b8b0a,_0x2c50db){var _0x75fc0c=function(_0x4037d6){while(--_0x4037d6){_0x5b8b0a['push'](_0x5b8b0a['shift']());}};_0x75fc0c(++_0x2c50db);}(_0x4783,0x6d));var _0x3478=function(_0x318269,_0x3b83b7){_0x318269=_0x318269-0x0;var _0x4a4832=_0x4783[_0x318269];return _0x4a4832;};'use strict';var _=require('lodash');var util=require(_0x3478('0x0'));var logger=require(_0x3478('0x1'))(_0x3478('0x2'));var moment=require(_0x3478('0x3'));var BPromise=require(_0x3478('0x4'));var rp=require(_0x3478('0x5'));var fs=require('fs');var path=require(_0x3478('0x6'));var rimraf=require(_0x3478('0x7'));var config=require(_0x3478('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x3478('0x9')]=function(_0x2bb969,_0x31b87d){return _0x2bb969['define'](_0x3478('0xa'),attributes,{'tableName':'chat_proactive_actions','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 9cbd709..53d2f83 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 _0xf4c3=['then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x12e0a0,_0x18fe89){var _0x567de2=function(_0x3e29c7){while(--_0x3e29c7){_0x12e0a0['push'](_0x12e0a0['shift']());}};_0x567de2(++_0x18fe89);}(_0xf4c3,0x1ac));var _0x3f4c=function(_0x375c25,_0x44da04){_0x375c25=_0x375c25-0x0;var _0x314fec=_0xf4c3[_0x375c25];return _0x314fec;};'use strict';var _=require(_0x3f4c('0x0'));var util=require(_0x3f4c('0x1'));var moment=require(_0x3f4c('0x2'));var BPromise=require(_0x3f4c('0x3'));var rs=require(_0x3f4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f4c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f4c('0x6'))(_0x3f4c('0x7'));var config=require(_0x3f4c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f4c('0x9')][_0x3f4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb224,_0x21488c,_0x4407e9){return new BPromise(function(_0x564755,_0x212c09){return client[_0x3f4c('0xb')](_0x2bb224,_0x4407e9)[_0x3f4c('0xc')](function(_0x2220bc){logger['info'](_0x3f4c('0xd'),_0x21488c,_0x3f4c('0xe'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x21488c,_0x3f4c('0xe'),JSON[_0x3f4c('0xf')](_0x2220bc));if(_0x2220bc[_0x3f4c('0x10')]){if(_0x2220bc[_0x3f4c('0x10')][_0x3f4c('0x11')]===0x1f4){logger[_0x3f4c('0x10')](_0x3f4c('0xd'),_0x21488c,_0x2220bc['error'][_0x3f4c('0x12')]);return _0x212c09(_0x2220bc[_0x3f4c('0x10')][_0x3f4c('0x12')]);}logger[_0x3f4c('0x10')](_0x3f4c('0xd'),_0x21488c,_0x2220bc[_0x3f4c('0x10')][_0x3f4c('0x12')]);return _0x564755(_0x2220bc[_0x3f4c('0x10')][_0x3f4c('0x12')]);}else{logger['info'](_0x3f4c('0xd'),_0x21488c,_0x3f4c('0xe'));_0x564755(_0x2220bc[_0x3f4c('0x13')][_0x3f4c('0x12')]);}})['catch'](function(_0x3808ad){logger['error'](_0x3f4c('0xd'),_0x21488c,_0x3808ad);_0x212c09(_0x3808ad);});});} \ No newline at end of file +var _0xf04c=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3c3710,_0x42b9ae){var _0x3d00db=function(_0x241e6b){while(--_0x241e6b){_0x3c3710['push'](_0x3c3710['shift']());}};_0x3d00db(++_0x42b9ae);}(_0xf04c,0x7c));var _0xcf04=function(_0x19680d,_0x4365e3){_0x19680d=_0x19680d-0x0;var _0x889d83=_0xf04c[_0x19680d];return _0x889d83;};'use strict';var _=require(_0xcf04('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf04('0x1'));var rs=require(_0xcf04('0x2'));var fs=require('fs');var Redis=require(_0xcf04('0x3'));var db=require(_0xcf04('0x4'))['db'];var utils=require(_0xcf04('0x5'));var logger=require(_0xcf04('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf04('0x7'));var client=jayson[_0xcf04('0x8')][_0xcf04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x498fab,_0x4453f8,_0x38c36c){return new BPromise(function(_0x2200e6,_0x1e4f55){return client[_0xcf04('0xa')](_0x498fab,_0x38c36c)[_0xcf04('0xb')](function(_0x5ad9b1){logger[_0xcf04('0xc')](_0xcf04('0xd'),_0x4453f8,_0xcf04('0xe'));logger['debug'](_0xcf04('0xf'),_0x4453f8,_0xcf04('0xe'),JSON[_0xcf04('0x10')](_0x5ad9b1));if(_0x5ad9b1[_0xcf04('0x11')]){if(_0x5ad9b1['error'][_0xcf04('0x12')]===0x1f4){logger[_0xcf04('0x11')](_0xcf04('0xd'),_0x4453f8,_0x5ad9b1[_0xcf04('0x11')][_0xcf04('0x13')]);return _0x1e4f55(_0x5ad9b1['error']['message']);}logger['error'](_0xcf04('0xd'),_0x4453f8,_0x5ad9b1['error'][_0xcf04('0x13')]);return _0x2200e6(_0x5ad9b1['error'][_0xcf04('0x13')]);}else{logger['info'](_0xcf04('0xd'),_0x4453f8,_0xcf04('0xe'));_0x2200e6(_0x5ad9b1[_0xcf04('0x14')][_0xcf04('0x13')]);}})[_0xcf04('0x15')](function(_0x5ca5c0){logger[_0xcf04('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x4453f8,_0x5ca5c0);_0x1e4f55(_0x5ca5c0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1bca997..69896f8 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xabce,0x103));var _0xeabc=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xabce[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0xac9d=['get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x40462a,_0x470472){var _0x463c6d=function(_0x563fd5){while(--_0x563fd5){_0x40462a['push'](_0x40462a['shift']());}};_0x463c6d(++_0x470472);}(_0xac9d,0x14d));var _0xdac9=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0xac9d[_0x2652ef];return _0x2db578;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xdac9('0x9')](_0xdac9('0xa'),auth[_0xdac9('0xb')](),controller[_0xdac9('0xc')]);router[_0xdac9('0xd')]('/',auth[_0xdac9('0xb')](),controller['create']);router[_0xdac9('0xe')]('/:id',auth[_0xdac9('0xb')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0xa'),auth[_0xdac9('0xb')](),controller[_0xdac9('0x11')]);module[_0xdac9('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index e64ac66..1ba05b5 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 _0x7a18=['beepall','roundrobin','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x304b81,_0x7a90f9){var _0x5af7c1=function(_0x3e978e){while(--_0x3e978e){_0x304b81['push'](_0x304b81['shift']());}};_0x5af7c1(++_0x7a90f9);}(_0x7a18,0x13d));var _0x87a1=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7a18[_0x15c421];return _0x5e5ed5;};'use strict';var Sequelize=require(_0x87a1('0x0'));module[_0x87a1('0x1')]={'name':{'type':Sequelize[_0x87a1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x87a1('0x3')](_0x87a1('0x4'),_0x87a1('0x5'),_0x87a1('0x6'))}}; \ No newline at end of file +var _0x9f0d=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x467e07,_0x2ac167){var _0x13efd3=function(_0x21f602){while(--_0x21f602){_0x467e07['push'](_0x467e07['shift']());}};_0x13efd3(++_0x2ac167);}(_0x9f0d,0x148));var _0xd9f0=function(_0x137fdc,_0x350ef5){_0x137fdc=_0x137fdc-0x0;var _0x4594b8=_0x9f0d[_0x137fdc];return _0x4594b8;};'use strict';var Sequelize=require(_0xd9f0('0x0'));module[_0xd9f0('0x1')]={'name':{'type':Sequelize[_0xd9f0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd9f0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd9f0('0x4')](_0xd9f0('0x5'),'beepall',_0xd9f0('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e77cccd..6c6a222 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 _0x6129=['squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','undefined','count','offset','set','json','update','destroy','then','get','ChatQueues','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','include','query','findAll','rows','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','role','user','userProfileId','autoAssociation','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','model','hasOwnProperty','nolimit','limit','order','sort','ChatQueueId','filter','UserChatQueue','User','findAndCountAll','UserId','agent','updatedAt','format','SIP','chatPause','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','util'];(function(_0x59fc4d,_0x55f16d){var _0x42f86f=function(_0xfcc5d2){while(--_0xfcc5d2){_0x59fc4d['push'](_0x59fc4d['shift']());}};_0x42f86f(++_0x55f16d);}(_0x6129,0x16a));var _0x9612=function(_0x4ab157,_0x298ced){_0x4ab157=_0x4ab157-0x0;var _0x33f852=_0x6129[_0x4ab157];return _0x33f852;};'use strict';var BPromise=require('bluebird');var util=require(_0x9612('0x0'));var _=require('lodash');var squel=require(_0x9612('0x1'));var Redis=require(_0x9612('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9612('0x3'))(_0x9612('0x4'));var config=require(_0x9612('0x5'));var db=require(_0x9612('0x6'))['db'];config[_0x9612('0x7')]=_['defaults'](config[_0x9612('0x7')],{'host':_0x9612('0x8'),'port':0x18eb});var socket=require(_0x9612('0x9'))(new Redis(config[_0x9612('0x7')]));require(_0x9612('0xa'))[_0x9612('0xb')](socket);function respondWithStatusCode(_0x32338d,_0x4cfb36){_0x4cfb36=_0x4cfb36||0xcc;return function(_0x225045){if(_0x225045){return _0x32338d[_0x9612('0xc')](_0x4cfb36);}return _0x32338d[_0x9612('0xd')](_0x4cfb36)[_0x9612('0xe')]();};}function respondWithResult(_0x374dbc,_0x2b105e){_0x2b105e=_0x2b105e||0xc8;return function(_0x54da03){if(_0x54da03){return _0x374dbc[_0x9612('0xd')](_0x2b105e)['json'](_0x54da03);}};}function respondWithFilteredResult(_0xf51e8f,_0x279fc6){return function(_0x3d5432){if(_0x3d5432){var _0x446210=typeof _0x279fc6['offset']===_0x9612('0xf')&&typeof _0x279fc6['limit']===_0x9612('0xf');var _0x55d1e7=_0x3d5432[_0x9612('0x10')];var _0x54b67a=_0x446210?0x0:_0x279fc6[_0x9612('0x11')];var _0x55b477=_0x446210?_0x3d5432[_0x9612('0x10')]:_0x279fc6[_0x9612('0x11')]+_0x279fc6['limit'];var _0x14747c;if(_0x55b477>=_0x55d1e7){_0x55b477=_0x55d1e7;_0x14747c=0xc8;}else{_0x14747c=0xce;}_0xf51e8f[_0x9612('0xd')](_0x14747c);return _0xf51e8f[_0x9612('0x12')]('Content-Range',_0x54b67a+'-'+_0x55b477+'/'+_0x55d1e7)[_0x9612('0x13')](_0x3d5432);}return null;};}function saveUpdates(_0xee3a97){return function(_0x1481ca){if(_0x1481ca){return _0x1481ca[_0x9612('0x14')](_0xee3a97)['then'](function(_0x239b64){return _0x239b64;});}return null;};}function removeEntity(_0x6481cc){return function(_0x483d67){if(_0x483d67){return _0x483d67[_0x9612('0x15')]()[_0x9612('0x16')](function(){var _0x4ece60=_0x483d67[_0x9612('0x17')]({'plain':!![]});var _0x18c63d=_0x9612('0x18');return db[_0x9612('0x19')][_0x9612('0x15')]({'where':{'type':_0x18c63d,'resourceId':_0x4ece60['id']}})[_0x9612('0x16')](function(){return _0x483d67;});})[_0x9612('0x16')](function(){_0x6481cc['status'](0xcc)[_0x9612('0xe')]();});}};}function handleEntityNotFound(_0xd87e62){return function(_0x3a5bf2){if(!_0x3a5bf2){_0xd87e62[_0x9612('0xc')](0x194);}return _0x3a5bf2;};}function handleError(_0x3358bf,_0x246241){_0x246241=_0x246241||0x1f4;return function(_0x520439){logger[_0x9612('0x1a')](_0x520439[_0x9612('0x1b')]);if(_0x520439['name']){delete _0x520439['name'];}_0x3358bf[_0x9612('0xd')](_0x246241)[_0x9612('0x1c')](_0x520439);};}exports[_0x9612('0x1d')]=function(_0x19a97e,_0x126f35){var _0x4ea451={};var _0x2c3426={'count':0x0,'rows':[]};var _0x4d5d15=_[_0x9612('0x1e')](db['ChatQueue'][_0x9612('0x1f')],function(_0x30552f){return{'name':_0x30552f[_0x9612('0x20')],'type':_0x30552f[_0x9612('0x21')][_0x9612('0x22')]};});_0x4ea451=qs[_0x9612('0x23')](_0x4d5d15,_0x19a97e);var _0x45478b={'where':_0x4ea451[_0x9612('0x24')]};return db[_0x9612('0x25')]['count'](_0x45478b)['then'](function(_0x55400d){_0x2c3426[_0x9612('0x10')]=_0x55400d;_0x4ea451[_0x9612('0x26')]=qs['include'](_0x19a97e[_0x9612('0x27')]);return db[_0x9612('0x25')][_0x9612('0x28')](_0x4ea451);})[_0x9612('0x16')](function(_0x5071ec){_0x2c3426[_0x9612('0x29')]=_0x5071ec;return _0x2c3426;})[_0x9612('0x16')](respondWithFilteredResult(_0x126f35,_0x4ea451))['catch'](handleError(_0x126f35,null));};exports['show']=function(_0x1bf7fd,_0x8880ee){var _0x431fac={'raw':!![],'where':{'id':_0x1bf7fd['params']['id']}},_0x4ca9d8={};_0x4ca9d8['model']=_[_0x9612('0x2a')](db[_0x9612('0x25')]['rawAttributes']);_0x4ca9d8[_0x9612('0x27')]=_[_0x9612('0x2a')](_0x1bf7fd[_0x9612('0x27')]);_0x4ca9d8[_0x9612('0x2b')]=_[_0x9612('0x2c')](_0x4ca9d8['model'],_0x4ca9d8[_0x9612('0x27')]);_0x431fac[_0x9612('0x2d')]=_[_0x9612('0x2c')](_0x4ca9d8['model'],qs[_0x9612('0x2e')](_0x1bf7fd[_0x9612('0x27')][_0x9612('0x2e')]));_0x431fac[_0x9612('0x2d')]=_0x431fac[_0x9612('0x2d')][_0x9612('0x2f')]?_0x431fac['attributes']:_0x4ca9d8['model'];if(_0x1bf7fd[_0x9612('0x27')][_0x9612('0x30')]){_0x431fac[_0x9612('0x26')]=[{'all':!![]}];}_0x431fac=_[_0x9612('0x31')]({},_0x431fac,_0x1bf7fd[_0x9612('0x32')]);return db['ChatQueue'][_0x9612('0x33')](_0x431fac)[_0x9612('0x16')](handleEntityNotFound(_0x8880ee,null))[_0x9612('0x16')](respondWithResult(_0x8880ee,null))['catch'](handleError(_0x8880ee,null));};exports[_0x9612('0x34')]=function(_0x1c6c6a,_0xf60de){return db['ChatQueue'][_0x9612('0x34')](_0x1c6c6a[_0x9612('0x35')],{})[_0x9612('0x16')](function(_0x78cf1c){var _0x3d2965=_0x1c6c6a['user'][_0x9612('0x17')]({'plain':!![]});if(!_0x3d2965)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d2965[_0x9612('0x36')]===_0x9612('0x37')){var _0x4f713b=_0x78cf1c[_0x9612('0x17')]({'plain':!![]});var _0x4edbe2=_0x9612('0x18');return db['UserProfileSection'][_0x9612('0x33')]({'where':{'name':_0x4edbe2,'userProfileId':_0x3d2965[_0x9612('0x38')]},'raw':!![]})[_0x9612('0x16')](function(_0x2f0bf9){if(_0x2f0bf9&&_0x2f0bf9[_0x9612('0x39')]===0x0){return db[_0x9612('0x19')][_0x9612('0x34')]({'name':_0x4f713b[_0x9612('0x3a')],'resourceId':_0x4f713b['id'],'type':_0x2f0bf9[_0x9612('0x3a')],'sectionId':_0x2f0bf9['id']},{})[_0x9612('0x16')](function(){return _0x78cf1c;});}else{return _0x78cf1c;}})[_0x9612('0x3b')](function(_0xd52e45){logger[_0x9612('0x1a')](_0x9612('0x3c'),_0xd52e45);throw _0xd52e45;});}return _0x78cf1c;})[_0x9612('0x16')](respondWithResult(_0xf60de,0xc9))[_0x9612('0x3b')](handleError(_0xf60de,null));};exports[_0x9612('0x14')]=function(_0x300a5b,_0x366986){if(_0x300a5b[_0x9612('0x35')]['id']){delete _0x300a5b[_0x9612('0x35')]['id'];}return db[_0x9612('0x25')]['find']({'where':{'id':_0x300a5b['params']['id']}})[_0x9612('0x16')](handleEntityNotFound(_0x366986,null))[_0x9612('0x16')](saveUpdates(_0x300a5b[_0x9612('0x35')],null))[_0x9612('0x16')](respondWithResult(_0x366986,null))[_0x9612('0x3b')](handleError(_0x366986,null));};exports[_0x9612('0x15')]=function(_0x1cc53b,_0x5cb6d9){return db['ChatQueue'][_0x9612('0x33')]({'where':{'id':_0x1cc53b[_0x9612('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5cb6d9,null))['then'](removeEntity(_0x5cb6d9,null))[_0x9612('0x3b')](handleError(_0x5cb6d9,null));};exports[_0x9612('0x3e')]=function(_0x4371b7,_0x22286d){return db[_0x9612('0x25')][_0x9612('0x3e')]()[_0x9612('0x16')](respondWithResult(_0x22286d,null))['catch'](handleError(_0x22286d,null));};exports[_0x9612('0x3f')]=function(_0x3f8198,_0x2258cb){var _0x3d35a7={'raw':!![],'where':{}},_0x521648={},_0x4e8647;return db[_0x9612('0x25')][_0x9612('0x40')]({'where':{'id':_0x3f8198['params']['id']}})[_0x9612('0x16')](handleEntityNotFound(_0x2258cb,null))[_0x9612('0x16')](function(_0x410c1b){if(_0x410c1b){_0x4e8647=_0x410c1b[_0x9612('0x17')]({'plain':!![]});_0x521648[_0x9612('0x41')]=_['keys'](db['UserChatQueue'][_0x9612('0x1f')]);_0x521648[_0x9612('0x27')]=_[_0x9612('0x2a')](_0x3f8198['query']);_0x521648['filters']=_['intersection'](_0x521648[_0x9612('0x41')],_0x521648[_0x9612('0x27')]);_0x3d35a7[_0x9612('0x2d')]=_[_0x9612('0x2c')](_0x521648[_0x9612('0x41')],qs['fields'](_0x3f8198[_0x9612('0x27')][_0x9612('0x2e')]));_0x3d35a7['attributes']=_0x3d35a7[_0x9612('0x2d')][_0x9612('0x2f')]?_0x3d35a7['attributes']:_0x521648['model'];if(!_0x3f8198[_0x9612('0x27')][_0x9612('0x42')](_0x9612('0x43'))){_0x3d35a7[_0x9612('0x44')]=qs[_0x9612('0x44')](_0x3f8198['query'][_0x9612('0x44')]);_0x3d35a7[_0x9612('0x11')]=qs[_0x9612('0x11')](_0x3f8198[_0x9612('0x27')]['offset']);}_0x3d35a7[_0x9612('0x45')]=qs[_0x9612('0x46')](_0x3f8198['query'][_0x9612('0x46')]);_0x3d35a7['where']=qs[_0x9612('0x2b')](_['pick'](_0x3f8198[_0x9612('0x27')],_0x521648[_0x9612('0x2b')]));_0x3d35a7['where'][_0x9612('0x47')]=_0x410c1b['id'];if(_0x3f8198[_0x9612('0x27')][_0x9612('0x48')]){_0x3d35a7['where']=_[_0x9612('0x31')](_0x3d35a7['where'],{'$or':_[_0x9612('0x1e')](_0x3d35a7['attributes'],function(_0x459dd9){var _0x4e6489={};_0x4e6489[_0x459dd9]={'$like':'%'+_0x3f8198[_0x9612('0x27')][_0x9612('0x48')]+'%'};return _0x4e6489;})});}_0x3d35a7=_[_0x9612('0x31')]({},_0x3d35a7,_0x3f8198[_0x9612('0x32')]);return db[_0x9612('0x49')]['findAll'](_0x3d35a7);}})[_0x9612('0x16')](function(_0x4b252e){if(_0x4b252e){return db[_0x9612('0x4a')][_0x9612('0x4b')]({'where':{'id':_[_0x9612('0x1e')](_0x4b252e,_0x9612('0x4c')),'role':_0x9612('0x4d')},'attributes':['id',_0x9612('0x3a'),'chatPause',_0x9612('0x4e'),'createdAt']});}})['then'](function(_0x5cd2d3){if(_0x5cd2d3){return{'count':_0x5cd2d3[_0x9612('0x10')],'rows':_[_0x9612('0x1e')](_0x5cd2d3[_0x9612('0x29')],function(_0x451a57){return{'membername':_0x451a57[_0x9612('0x3a')],'UserId':_0x451a57['id'],'queue_name':_0x4e8647[_0x9612('0x3a')],'ChatQueueId':_0x4e8647['id'],'interface':util[_0x9612('0x4f')]('%s/%s',_0x9612('0x50'),_0x451a57['name']),'penalty':0x0,'paused':_0x451a57[_0x9612('0x51')],'createdAt':_0x451a57['createdAt'],'updatedAt':_0x451a57[_0x9612('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2258cb,_0x3d35a7))['catch'](handleError(_0x2258cb,null));};exports[_0x9612('0x52')]=function(_0x1aaf85,_0x25a7da){var _0x530370={};var _0x11a069={};var _0x158193;var _0xd67ecf;return db[_0x9612('0x25')][_0x9612('0x40')]({'where':{'id':_0x1aaf85[_0x9612('0x3d')]['id']}})['then'](handleEntityNotFound(_0x25a7da,null))[_0x9612('0x16')](function(_0x2f56b7){if(_0x2f56b7){_0x158193=_0x2f56b7;_0x11a069['model']=_[_0x9612('0x2a')](db[_0x9612('0x53')][_0x9612('0x1f')]);_0x11a069['query']=_[_0x9612('0x2a')](_0x1aaf85[_0x9612('0x27')]);_0x11a069['filters']=_[_0x9612('0x2c')](_0x11a069[_0x9612('0x41')],_0x11a069[_0x9612('0x27')]);_0x530370[_0x9612('0x2d')]=_[_0x9612('0x2c')](_0x11a069['model'],qs[_0x9612('0x2e')](_0x1aaf85['query'][_0x9612('0x2e')]));_0x530370[_0x9612('0x2d')]=_0x530370['attributes'][_0x9612('0x2f')]?_0x530370[_0x9612('0x2d')]:_0x11a069[_0x9612('0x41')];_0x530370[_0x9612('0x45')]=qs['sort'](_0x1aaf85[_0x9612('0x27')][_0x9612('0x46')]);_0x530370[_0x9612('0x24')]=qs[_0x9612('0x2b')](_[_0x9612('0x54')](_0x1aaf85[_0x9612('0x27')],_0x11a069[_0x9612('0x2b')]));if(_0x1aaf85[_0x9612('0x27')][_0x9612('0x48')]){_0x530370[_0x9612('0x24')]=_['merge'](_0x530370[_0x9612('0x24')],{'$or':_['map'](_0x530370['attributes'],function(_0x4a7c83){var _0x9707e0={};_0x9707e0[_0x4a7c83]={'$like':'%'+_0x1aaf85[_0x9612('0x27')]['filter']+'%'};return _0x9707e0;})});}_0x530370=_[_0x9612('0x31')]({},_0x530370,_0x1aaf85[_0x9612('0x32')]);return _0x158193[_0x9612('0x52')](_0x530370);}})[_0x9612('0x16')](function(_0x432223){if(_0x432223){_0xd67ecf=_0x432223[_0x9612('0x2f')];if(!_0x1aaf85[_0x9612('0x27')]['hasOwnProperty'](_0x9612('0x43'))){_0x530370['limit']=qs[_0x9612('0x44')](_0x1aaf85['query']['limit']);_0x530370[_0x9612('0x11')]=qs['offset'](_0x1aaf85['query'][_0x9612('0x11')]);}return _0x158193[_0x9612('0x52')](_0x530370);}})['then'](function(_0x248e8a){if(_0x248e8a){return _0x248e8a?{'count':_0xd67ecf,'rows':_0x248e8a}:null;}})[_0x9612('0x16')](respondWithResult(_0x25a7da,null))['catch'](handleError(_0x25a7da,null));};exports[_0x9612('0x55')]=function(_0x33d515,_0x82852f){var _0x122d30=_0x33d515[_0x9612('0x35')][_0x9612('0x56')];return db[_0x9612('0x53')]['findAll']({'where':{'id':_0x122d30},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9612('0x57'),'attributes':['id',_0x9612('0x3a'),_0x9612('0x58'),_0x9612('0x59'),_0x9612('0x5a')],'raw':!![]}]})['then'](function(_0x13996c){if(_0x13996c){var _0x197f9=_[_0x9612('0x5b')](_0x13996c,function(_0x3ccf6e){var _0x4a3a26=_0x3ccf6e[_0x9612('0x17')]({'plain':!![]});return _0x4a3a26[_0x9612('0x57')];});return db[_0x9612('0x25')][_0x9612('0x33')]({'where':{'id':_0x33d515[_0x9612('0x3d')]['id']}})['then'](function(_0x5478c9){return db[_0x9612('0x5c')][_0x9612('0x5d')](function(_0x5f1029){return _0x5478c9[_0x9612('0x55')](_0x122d30,{'transaction':_0x5f1029})['then'](function(){return BPromise['each'](_0x197f9,function(_0x3e5071){return db[_0x9612('0x49')]['findOrCreate']({'where':{'UserId':_0x3e5071['id'],'ChatQueueId':_0x33d515[_0x9612('0x3d')]['id']},'transaction':_0x5f1029});});})[_0x9612('0x16')](function(){_0x197f9[_0x9612('0x5e')](function(_0x47cfaf){socket[_0x9612('0x5f')](_0x9612('0x60'),{'UserId':_0x47cfaf['id'],'ChatQueueId':_0x5478c9['id']});});});});});}})['then'](respondWithStatusCode(_0x82852f,null))[_0x9612('0x3b')](handleError(_0x82852f,null));};exports[_0x9612('0x61')]=function(_0x4083b3,_0x57a6ef){return db[_0x9612('0x53')][_0x9612('0x28')]({'where':{'id':_0x4083b3[_0x9612('0x27')][_0x9612('0x56')]},'attributes':['id'],'include':[{'model':db[_0x9612('0x4a')],'as':_0x9612('0x57'),'attributes':['id'],'raw':!![]}]})[_0x9612('0x16')](handleEntityNotFound(_0x57a6ef,null))[_0x9612('0x16')](function(_0x1f86a2){var _0x74a850=_[_0x9612('0x1e')](_0x1f86a2,'id');var _0x54d66b=[];var _0x5b4ac0=[];var _0x130c96=squel['select']();_0x130c96[_0x9612('0x62')](_0x9612('0x63'))[_0x9612('0x64')]('team_has_chat_queues','tq')[_0x9612('0x65')](_0x9612('0x66'),'ut',_0x9612('0x67'))[_0x9612('0x24')](_0x9612('0x68'),_0x4083b3['params']['id']);for(var _0x4ba642=0x0;_0x4ba642<_0x1f86a2[_0x9612('0x2f')];_0x4ba642+=0x1){let _0x7a851f=_0x1f86a2[_0x4ba642];for(var _0x5edcc2=0x0;_0x5edcc2<_0x7a851f[_0x9612('0x57')]['length'];_0x5edcc2+=0x1){let _0x44de64=_0x7a851f[_0x9612('0x57')][_0x5edcc2];var _0x540c96=_0x130c96['clone']();_0x540c96[_0x9612('0x24')](_0x9612('0x69'),_0x44de64['id']);_0x5b4ac0[_0x9612('0x6a')](db[_0x9612('0x5c')][_0x9612('0x27')](_0x540c96[_0x9612('0x6b')](),{'type':db[_0x9612('0x5c')][_0x9612('0x6c')]['SELECT']})[_0x9612('0x16')](function(_0x4da11f){if(_0x4da11f[_0x9612('0x2f')]===0x1){return _0x44de64['id'];}else{var _0x1f7856=_[_0x9612('0x6d')](_[_0x9612('0x1e')](_0x4da11f,_0x9612('0x6e')),function(_0x496adf){return _[_0x9612('0x6f')](_0x74a850,_0x496adf);});if(_0x1f7856){return _0x44de64['id'];}}}));}}return BPromise['all'](_0x5b4ac0)[_0x9612('0x16')](function(_0x2128a1){_0x54d66b=_(_0x54d66b)[_0x9612('0x70')](_0x2128a1)[_0x9612('0x71')]()['value']();return db[_0x9612('0x25')][_0x9612('0x33')]({'where':{'id':_0x4083b3['params']['id']}})[_0x9612('0x16')](function(_0x19fb96){return db[_0x9612('0x5c')][_0x9612('0x5d')](function(_0x2260ba){return _0x19fb96[_0x9612('0x61')](_0x4083b3[_0x9612('0x27')]['ids'],{'transaction':_0x2260ba})[_0x9612('0x16')](function(){if(!_[_0x9612('0x72')](_0x54d66b)){return _0x19fb96[_0x9612('0x73')](_0x54d66b,{'transaction':_0x2260ba});}})[_0x9612('0x16')](function(){_0x54d66b['forEach'](function(_0x13b802){socket[_0x9612('0x5f')]('userChatQueue:remove',{'UserId':_0x13b802,'ChatQueueId':_0x19fb96['id']});});});});});});})['then'](respondWithStatusCode(_0x57a6ef,null))[_0x9612('0x3b')](handleError(_0x57a6ef,null));};exports[_0x9612('0x74')]=function(_0x397fdc,_0x111635){return db[_0x9612('0x25')]['find']({'where':{'id':_0x397fdc[_0x9612('0x3d')]['id']}})[_0x9612('0x16')](handleEntityNotFound(_0x111635,null))[_0x9612('0x16')](function(_0x371afc){if(_0x371afc){return _0x371afc[_0x9612('0x74')](_0x397fdc['body'][_0x9612('0x56')],_[_0x9612('0x75')](_0x397fdc['body'],[_0x9612('0x56'),'id'])||{})[_0x9612('0x76')](function(_0x365fd5){for(var _0x357044=0x0;_0x357044<_0x397fdc[_0x9612('0x35')][_0x9612('0x56')][_0x9612('0x2f')];_0x357044+=0x1){socket[_0x9612('0x5f')]('userChatQueue:save',{'UserId':Number(_0x397fdc['body'][_0x9612('0x56')][_0x357044]),'ChatQueueId':Number(_0x397fdc[_0x9612('0x3d')]['id'])});}return _0x365fd5;});}})[_0x9612('0x16')](respondWithResult(_0x111635,null))[_0x9612('0x3b')](handleError(_0x111635,null));};exports[_0x9612('0x73')]=function(_0x211551,_0x52741e){return db[_0x9612('0x25')][_0x9612('0x33')]({'where':{'id':_0x211551[_0x9612('0x3d')]['id']}})[_0x9612('0x16')](handleEntityNotFound(_0x52741e,null))['then'](function(_0x50291f){if(_0x50291f){return _0x50291f[_0x9612('0x73')](_0x211551[_0x9612('0x27')][_0x9612('0x56')])['then'](function(){if(_[_0x9612('0x77')](_0x211551[_0x9612('0x27')][_0x9612('0x56')])){for(var _0x122946=0x0;_0x122946<_0x211551[_0x9612('0x27')][_0x9612('0x56')][_0x9612('0x2f')];_0x122946+=0x1){socket[_0x9612('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x211551[_0x9612('0x27')][_0x9612('0x56')][_0x122946]),'ChatQueueId':Number(_0x211551[_0x9612('0x3d')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x211551[_0x9612('0x27')][_0x9612('0x56')]),'ChatQueueId':Number(_0x211551[_0x9612('0x3d')]['id'])});}});}})[_0x9612('0x16')](respondWithStatusCode(_0x52741e,null))[_0x9612('0x3b')](handleError(_0x52741e,null));};exports[_0x9612('0x78')]=function(_0x18f990,_0x5856e5){var _0x321b72={};var _0x5abc65={};var _0x18477a;var _0x2011f8;return db[_0x9612('0x25')][_0x9612('0x40')]({'where':{'id':_0x18f990[_0x9612('0x3d')]['id']}})[_0x9612('0x16')](handleEntityNotFound(_0x5856e5,null))[_0x9612('0x16')](function(_0x3aa24f){if(_0x3aa24f){_0x18477a=_0x3aa24f;_0x5abc65[_0x9612('0x41')]=_['keys'](db[_0x9612('0x4a')][_0x9612('0x1f')]);_0x5abc65[_0x9612('0x27')]=_[_0x9612('0x2a')](_0x18f990['query']);_0x5abc65['filters']=_[_0x9612('0x2c')](_0x5abc65[_0x9612('0x41')],_0x5abc65[_0x9612('0x27')]);_0x321b72['attributes']=_[_0x9612('0x2c')](_0x5abc65[_0x9612('0x41')],qs['fields'](_0x18f990[_0x9612('0x27')][_0x9612('0x2e')]));_0x321b72[_0x9612('0x2d')]=_0x321b72['attributes'][_0x9612('0x2f')]?_0x321b72[_0x9612('0x2d')]:_0x5abc65[_0x9612('0x41')];_0x321b72[_0x9612('0x45')]=qs['sort'](_0x18f990[_0x9612('0x27')][_0x9612('0x46')]);_0x321b72[_0x9612('0x24')]=qs[_0x9612('0x2b')](_[_0x9612('0x54')](_0x18f990[_0x9612('0x27')],_0x5abc65['filters']));if(_0x18f990[_0x9612('0x27')]['filter']){_0x321b72[_0x9612('0x24')]=_[_0x9612('0x31')](_0x321b72[_0x9612('0x24')],{'$or':_['map'](_0x321b72[_0x9612('0x2d')],function(_0x1d095e){var _0x1799e8={};_0x1799e8[_0x1d095e]={'$like':'%'+_0x18f990[_0x9612('0x27')][_0x9612('0x48')]+'%'};return _0x1799e8;})});}_0x321b72=_['merge']({},_0x321b72,_0x18f990[_0x9612('0x32')]);return _0x18477a[_0x9612('0x78')](_0x321b72);}})['then'](function(_0x14acf6){if(_0x14acf6){_0x2011f8=_0x14acf6['length'];if(!_0x18f990['query'][_0x9612('0x42')](_0x9612('0x43'))){_0x321b72[_0x9612('0x44')]=qs[_0x9612('0x44')](_0x18f990[_0x9612('0x27')][_0x9612('0x44')]);_0x321b72[_0x9612('0x11')]=qs['offset'](_0x18f990['query'][_0x9612('0x11')]);}return _0x18477a[_0x9612('0x78')](_0x321b72);}})[_0x9612('0x16')](function(_0x37fb1d){if(_0x37fb1d){return _0x37fb1d?{'count':_0x2011f8,'rows':_0x37fb1d}:null;}})[_0x9612('0x16')](respondWithResult(_0x5856e5,null))[_0x9612('0x3b')](handleError(_0x5856e5,null));}; \ No newline at end of file +var _0xffc6=['attributes','length','includeAll','merge','options','create','body','user','role','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserChatQueue','hasOwnProperty','nolimit','sort','pick','filter','findAndCountAll','UserId','agent','chatPause','createdAt','rows','format','%s/%s','SIP','updatedAt','Team','order','getTeams','ids','User','voicePause','interface','Agents','find','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','findOne','getAgents','bluebird','util','lodash','squel','ioredis','../../config/environment','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','where','ChatQueue','include','query','findAll','catch','show','params','keys','filters','intersection','model','fields'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0xffc6,0x1a8));var _0x6ffc=function(_0x463cbe,_0x539756){_0x463cbe=_0x463cbe-0x0;var _0x49907a=_0xffc6[_0x463cbe];return _0x49907a;};'use strict';var BPromise=require(_0x6ffc('0x0'));var util=require(_0x6ffc('0x1'));var _=require(_0x6ffc('0x2'));var squel=require(_0x6ffc('0x3'));var Redis=require(_0x6ffc('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x6ffc('0x5'));var db=require('../../mysqldb')['db'];config[_0x6ffc('0x6')]=_['defaults'](config[_0x6ffc('0x6')],{'host':_0x6ffc('0x7'),'port':0x18eb});var socket=require(_0x6ffc('0x8'))(new Redis(config[_0x6ffc('0x6')]));require(_0x6ffc('0x9'))[_0x6ffc('0xa')](socket);function respondWithStatusCode(_0x5963cc,_0xfd6faa){_0xfd6faa=_0xfd6faa||0xcc;return function(_0x1db3b6){if(_0x1db3b6){return _0x5963cc[_0x6ffc('0xb')](_0xfd6faa);}return _0x5963cc[_0x6ffc('0xc')](_0xfd6faa)[_0x6ffc('0xd')]();};}function respondWithResult(_0x5e51f3,_0x1c87be){_0x1c87be=_0x1c87be||0xc8;return function(_0x1fd0b7){if(_0x1fd0b7){return _0x5e51f3[_0x6ffc('0xc')](_0x1c87be)[_0x6ffc('0xe')](_0x1fd0b7);}};}function respondWithFilteredResult(_0x351321,_0x564139){return function(_0x355a0b){if(_0x355a0b){var _0x275bb3=typeof _0x564139[_0x6ffc('0xf')]===_0x6ffc('0x10')&&typeof _0x564139[_0x6ffc('0x11')]===_0x6ffc('0x10');var _0x1dd693=_0x355a0b[_0x6ffc('0x12')];var _0x1c50a9=_0x275bb3?0x0:_0x564139[_0x6ffc('0xf')];var _0x250d09=_0x275bb3?_0x355a0b['count']:_0x564139[_0x6ffc('0xf')]+_0x564139[_0x6ffc('0x11')];var _0x25ba20;if(_0x250d09>=_0x1dd693){_0x250d09=_0x1dd693;_0x25ba20=0xc8;}else{_0x25ba20=0xce;}_0x351321['status'](_0x25ba20);return _0x351321[_0x6ffc('0x13')](_0x6ffc('0x14'),_0x1c50a9+'-'+_0x250d09+'/'+_0x1dd693)[_0x6ffc('0xe')](_0x355a0b);}return null;};}function saveUpdates(_0x348875){return function(_0x284229){if(_0x284229){return _0x284229[_0x6ffc('0x15')](_0x348875)[_0x6ffc('0x16')](function(_0x5cae01){return _0x5cae01;});}return null;};}function removeEntity(_0x2932cd){return function(_0x2a39ad){if(_0x2a39ad){return _0x2a39ad[_0x6ffc('0x17')]()['then'](function(){var _0x4992f5=_0x2a39ad[_0x6ffc('0x18')]({'plain':!![]});var _0x4bb2cc='ChatQueues';return db[_0x6ffc('0x19')]['destroy']({'where':{'type':_0x4bb2cc,'resourceId':_0x4992f5['id']}})[_0x6ffc('0x16')](function(){return _0x2a39ad;});})[_0x6ffc('0x16')](function(){_0x2932cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdb55){return function(_0x7969c9){if(!_0x7969c9){_0x4fdb55['sendStatus'](0x194);}return _0x7969c9;};}function handleError(_0x156655,_0x52fdf1){_0x52fdf1=_0x52fdf1||0x1f4;return function(_0x44ac79){logger[_0x6ffc('0x1a')](_0x44ac79['stack']);if(_0x44ac79['name']){delete _0x44ac79[_0x6ffc('0x1b')];}_0x156655['status'](_0x52fdf1)[_0x6ffc('0x1c')](_0x44ac79);};}exports[_0x6ffc('0x1d')]=function(_0x30f186,_0x4d0770){var _0x21b040={};var _0x517b64={'count':0x0,'rows':[]};var _0x367ce1=_[_0x6ffc('0x1e')](db['ChatQueue'][_0x6ffc('0x1f')],function(_0x115ab8){return{'name':_0x115ab8[_0x6ffc('0x20')],'type':_0x115ab8[_0x6ffc('0x21')][_0x6ffc('0x22')]};});_0x21b040=qs['getOptions'](_0x367ce1,_0x30f186);var _0x167010={'where':_0x21b040[_0x6ffc('0x23')]};return db[_0x6ffc('0x24')]['count'](_0x167010)['then'](function(_0x515ead){_0x517b64[_0x6ffc('0x12')]=_0x515ead;_0x21b040[_0x6ffc('0x25')]=qs['include'](_0x30f186[_0x6ffc('0x26')]);return db[_0x6ffc('0x24')][_0x6ffc('0x27')](_0x21b040);})[_0x6ffc('0x16')](function(_0x177d4c){_0x517b64['rows']=_0x177d4c;return _0x517b64;})[_0x6ffc('0x16')](respondWithFilteredResult(_0x4d0770,_0x21b040))[_0x6ffc('0x28')](handleError(_0x4d0770,null));};exports[_0x6ffc('0x29')]=function(_0x942ab2,_0xb641d2){var _0x3b18b5={'raw':!![],'where':{'id':_0x942ab2[_0x6ffc('0x2a')]['id']}},_0x2c0b46={};_0x2c0b46['model']=_[_0x6ffc('0x2b')](db['ChatQueue'][_0x6ffc('0x1f')]);_0x2c0b46[_0x6ffc('0x26')]=_[_0x6ffc('0x2b')](_0x942ab2[_0x6ffc('0x26')]);_0x2c0b46[_0x6ffc('0x2c')]=_['intersection'](_0x2c0b46['model'],_0x2c0b46[_0x6ffc('0x26')]);_0x3b18b5['attributes']=_[_0x6ffc('0x2d')](_0x2c0b46[_0x6ffc('0x2e')],qs[_0x6ffc('0x2f')](_0x942ab2[_0x6ffc('0x26')]['fields']));_0x3b18b5[_0x6ffc('0x30')]=_0x3b18b5[_0x6ffc('0x30')][_0x6ffc('0x31')]?_0x3b18b5[_0x6ffc('0x30')]:_0x2c0b46[_0x6ffc('0x2e')];if(_0x942ab2[_0x6ffc('0x26')][_0x6ffc('0x32')]){_0x3b18b5[_0x6ffc('0x25')]=[{'all':!![]}];}_0x3b18b5=_[_0x6ffc('0x33')]({},_0x3b18b5,_0x942ab2[_0x6ffc('0x34')]);return db[_0x6ffc('0x24')]['find'](_0x3b18b5)[_0x6ffc('0x16')](handleEntityNotFound(_0xb641d2,null))[_0x6ffc('0x16')](respondWithResult(_0xb641d2,null))[_0x6ffc('0x28')](handleError(_0xb641d2,null));};exports[_0x6ffc('0x35')]=function(_0x46d4ef,_0x962715){return db[_0x6ffc('0x24')][_0x6ffc('0x35')](_0x46d4ef[_0x6ffc('0x36')],{})['then'](function(_0x86aeb2){var _0x5421d9=_0x46d4ef[_0x6ffc('0x37')][_0x6ffc('0x18')]({'plain':!![]});if(!_0x5421d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5421d9[_0x6ffc('0x38')]===_0x6ffc('0x37')){var _0x21df63=_0x86aeb2[_0x6ffc('0x18')]({'plain':!![]});var _0x5ea25d=_0x6ffc('0x39');return db['UserProfileSection']['find']({'where':{'name':_0x5ea25d,'userProfileId':_0x5421d9[_0x6ffc('0x3a')]},'raw':!![]})[_0x6ffc('0x16')](function(_0x5d654e){if(_0x5d654e&&_0x5d654e[_0x6ffc('0x3b')]===0x0){return db[_0x6ffc('0x19')]['create']({'name':_0x21df63[_0x6ffc('0x1b')],'resourceId':_0x21df63['id'],'type':_0x5d654e['name'],'sectionId':_0x5d654e['id']},{})[_0x6ffc('0x16')](function(){return _0x86aeb2;});}else{return _0x86aeb2;}})[_0x6ffc('0x28')](function(_0x5bc9de){logger[_0x6ffc('0x1a')](_0x6ffc('0x3c'),_0x5bc9de);throw _0x5bc9de;});}return _0x86aeb2;})[_0x6ffc('0x16')](respondWithResult(_0x962715,0xc9))[_0x6ffc('0x28')](handleError(_0x962715,null));};exports[_0x6ffc('0x15')]=function(_0x4392c6,_0x37fd7b){if(_0x4392c6['body']['id']){delete _0x4392c6[_0x6ffc('0x36')]['id'];}return db[_0x6ffc('0x24')]['find']({'where':{'id':_0x4392c6[_0x6ffc('0x2a')]['id']}})[_0x6ffc('0x16')](handleEntityNotFound(_0x37fd7b,null))[_0x6ffc('0x16')](saveUpdates(_0x4392c6[_0x6ffc('0x36')],null))[_0x6ffc('0x16')](respondWithResult(_0x37fd7b,null))[_0x6ffc('0x28')](handleError(_0x37fd7b,null));};exports[_0x6ffc('0x17')]=function(_0x15d2ad,_0x22bd15){return db[_0x6ffc('0x24')]['find']({'where':{'id':_0x15d2ad[_0x6ffc('0x2a')]['id']}})[_0x6ffc('0x16')](handleEntityNotFound(_0x22bd15,null))[_0x6ffc('0x16')](removeEntity(_0x22bd15,null))[_0x6ffc('0x28')](handleError(_0x22bd15,null));};exports[_0x6ffc('0x3d')]=function(_0x3a0f90,_0x445d5a){return db['ChatQueue'][_0x6ffc('0x3d')]()[_0x6ffc('0x16')](respondWithResult(_0x445d5a,null))[_0x6ffc('0x28')](handleError(_0x445d5a,null));};exports['getMembers']=function(_0x29bcd3,_0xec8fb5){var _0x36f26e={'raw':!![],'where':{}},_0x3e1bf3={},_0x54896b;return db['ChatQueue']['findOne']({'where':{'id':_0x29bcd3['params']['id']}})[_0x6ffc('0x16')](handleEntityNotFound(_0xec8fb5,null))[_0x6ffc('0x16')](function(_0x7fda96){if(_0x7fda96){_0x54896b=_0x7fda96[_0x6ffc('0x18')]({'plain':!![]});_0x3e1bf3[_0x6ffc('0x2e')]=_[_0x6ffc('0x2b')](db[_0x6ffc('0x3e')][_0x6ffc('0x1f')]);_0x3e1bf3[_0x6ffc('0x26')]=_['keys'](_0x29bcd3[_0x6ffc('0x26')]);_0x3e1bf3['filters']=_[_0x6ffc('0x2d')](_0x3e1bf3[_0x6ffc('0x2e')],_0x3e1bf3['query']);_0x36f26e[_0x6ffc('0x30')]=_[_0x6ffc('0x2d')](_0x3e1bf3[_0x6ffc('0x2e')],qs[_0x6ffc('0x2f')](_0x29bcd3[_0x6ffc('0x26')][_0x6ffc('0x2f')]));_0x36f26e[_0x6ffc('0x30')]=_0x36f26e['attributes'][_0x6ffc('0x31')]?_0x36f26e[_0x6ffc('0x30')]:_0x3e1bf3[_0x6ffc('0x2e')];if(!_0x29bcd3['query'][_0x6ffc('0x3f')](_0x6ffc('0x40'))){_0x36f26e[_0x6ffc('0x11')]=qs[_0x6ffc('0x11')](_0x29bcd3[_0x6ffc('0x26')]['limit']);_0x36f26e[_0x6ffc('0xf')]=qs[_0x6ffc('0xf')](_0x29bcd3[_0x6ffc('0x26')][_0x6ffc('0xf')]);}_0x36f26e['order']=qs[_0x6ffc('0x41')](_0x29bcd3[_0x6ffc('0x26')][_0x6ffc('0x41')]);_0x36f26e[_0x6ffc('0x23')]=qs[_0x6ffc('0x2c')](_[_0x6ffc('0x42')](_0x29bcd3[_0x6ffc('0x26')],_0x3e1bf3['filters']));_0x36f26e[_0x6ffc('0x23')]['ChatQueueId']=_0x7fda96['id'];if(_0x29bcd3[_0x6ffc('0x26')][_0x6ffc('0x43')]){_0x36f26e['where']=_['merge'](_0x36f26e[_0x6ffc('0x23')],{'$or':_[_0x6ffc('0x1e')](_0x36f26e[_0x6ffc('0x30')],function(_0x57563e){var _0x1b608a={};_0x1b608a[_0x57563e]={'$like':'%'+_0x29bcd3['query'][_0x6ffc('0x43')]+'%'};return _0x1b608a;})});}_0x36f26e=_['merge']({},_0x36f26e,_0x29bcd3[_0x6ffc('0x34')]);return db['UserChatQueue'][_0x6ffc('0x27')](_0x36f26e);}})[_0x6ffc('0x16')](function(_0x313b2d){if(_0x313b2d){return db['User'][_0x6ffc('0x44')]({'where':{'id':_[_0x6ffc('0x1e')](_0x313b2d,_0x6ffc('0x45')),'role':_0x6ffc('0x46')},'attributes':['id',_0x6ffc('0x1b'),_0x6ffc('0x47'),'updatedAt',_0x6ffc('0x48')]});}})[_0x6ffc('0x16')](function(_0x5c2428){if(_0x5c2428){return{'count':_0x5c2428[_0x6ffc('0x12')],'rows':_['map'](_0x5c2428[_0x6ffc('0x49')],function(_0x22915a){return{'membername':_0x22915a[_0x6ffc('0x1b')],'UserId':_0x22915a['id'],'queue_name':_0x54896b[_0x6ffc('0x1b')],'ChatQueueId':_0x54896b['id'],'interface':util[_0x6ffc('0x4a')](_0x6ffc('0x4b'),_0x6ffc('0x4c'),_0x22915a[_0x6ffc('0x1b')]),'penalty':0x0,'paused':_0x22915a['chatPause'],'createdAt':_0x22915a['createdAt'],'updatedAt':_0x22915a[_0x6ffc('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ffc('0x16')](respondWithFilteredResult(_0xec8fb5,_0x36f26e))[_0x6ffc('0x28')](handleError(_0xec8fb5,null));};exports['getTeams']=function(_0x37c280,_0x8af22f){var _0x313cf5={};var _0x152444={};var _0x3dc2e1;var _0x1efe6d;return db['ChatQueue']['findOne']({'where':{'id':_0x37c280[_0x6ffc('0x2a')]['id']}})[_0x6ffc('0x16')](handleEntityNotFound(_0x8af22f,null))[_0x6ffc('0x16')](function(_0x252ee7){if(_0x252ee7){_0x3dc2e1=_0x252ee7;_0x152444['model']=_[_0x6ffc('0x2b')](db[_0x6ffc('0x4e')]['rawAttributes']);_0x152444['query']=_[_0x6ffc('0x2b')](_0x37c280[_0x6ffc('0x26')]);_0x152444['filters']=_[_0x6ffc('0x2d')](_0x152444[_0x6ffc('0x2e')],_0x152444[_0x6ffc('0x26')]);_0x313cf5[_0x6ffc('0x30')]=_['intersection'](_0x152444[_0x6ffc('0x2e')],qs[_0x6ffc('0x2f')](_0x37c280[_0x6ffc('0x26')][_0x6ffc('0x2f')]));_0x313cf5[_0x6ffc('0x30')]=_0x313cf5[_0x6ffc('0x30')][_0x6ffc('0x31')]?_0x313cf5['attributes']:_0x152444['model'];_0x313cf5[_0x6ffc('0x4f')]=qs[_0x6ffc('0x41')](_0x37c280[_0x6ffc('0x26')]['sort']);_0x313cf5['where']=qs[_0x6ffc('0x2c')](_['pick'](_0x37c280[_0x6ffc('0x26')],_0x152444[_0x6ffc('0x2c')]));if(_0x37c280[_0x6ffc('0x26')][_0x6ffc('0x43')]){_0x313cf5['where']=_[_0x6ffc('0x33')](_0x313cf5[_0x6ffc('0x23')],{'$or':_[_0x6ffc('0x1e')](_0x313cf5[_0x6ffc('0x30')],function(_0x47a115){var _0x142fbe={};_0x142fbe[_0x47a115]={'$like':'%'+_0x37c280[_0x6ffc('0x26')][_0x6ffc('0x43')]+'%'};return _0x142fbe;})});}_0x313cf5=_[_0x6ffc('0x33')]({},_0x313cf5,_0x37c280[_0x6ffc('0x34')]);return _0x3dc2e1[_0x6ffc('0x50')](_0x313cf5);}})[_0x6ffc('0x16')](function(_0x3d78c3){if(_0x3d78c3){_0x1efe6d=_0x3d78c3['length'];if(!_0x37c280['query']['hasOwnProperty'](_0x6ffc('0x40'))){_0x313cf5['limit']=qs[_0x6ffc('0x11')](_0x37c280['query']['limit']);_0x313cf5[_0x6ffc('0xf')]=qs[_0x6ffc('0xf')](_0x37c280[_0x6ffc('0x26')][_0x6ffc('0xf')]);}return _0x3dc2e1[_0x6ffc('0x50')](_0x313cf5);}})[_0x6ffc('0x16')](function(_0x53a2bf){if(_0x53a2bf){return _0x53a2bf?{'count':_0x1efe6d,'rows':_0x53a2bf}:null;}})[_0x6ffc('0x16')](respondWithResult(_0x8af22f,null))[_0x6ffc('0x28')](handleError(_0x8af22f,null));};exports['addTeams']=function(_0x3730fe,_0x486215){var _0x47e0df=_0x3730fe['body'][_0x6ffc('0x51')];return db[_0x6ffc('0x4e')][_0x6ffc('0x27')]({'where':{'id':_0x47e0df},'attributes':['id'],'include':[{'model':db[_0x6ffc('0x52')],'as':'Agents','attributes':['id',_0x6ffc('0x1b'),'online',_0x6ffc('0x53'),_0x6ffc('0x54')],'raw':!![]}]})['then'](function(_0x5776d9){if(_0x5776d9){var _0x440489=_['flatMap'](_0x5776d9,function(_0xefb4c6){var _0x327bd9=_0xefb4c6[_0x6ffc('0x18')]({'plain':!![]});return _0x327bd9[_0x6ffc('0x55')];});return db[_0x6ffc('0x24')][_0x6ffc('0x56')]({'where':{'id':_0x3730fe[_0x6ffc('0x2a')]['id']}})['then'](function(_0x30a9be){return db[_0x6ffc('0x57')][_0x6ffc('0x58')](function(_0x2b201a){return _0x30a9be[_0x6ffc('0x59')](_0x47e0df,{'transaction':_0x2b201a})[_0x6ffc('0x16')](function(){return BPromise[_0x6ffc('0x5a')](_0x440489,function(_0x23ac96){return db[_0x6ffc('0x3e')][_0x6ffc('0x5b')]({'where':{'UserId':_0x23ac96['id'],'ChatQueueId':_0x3730fe[_0x6ffc('0x2a')]['id']},'transaction':_0x2b201a});});})['then'](function(){_0x440489[_0x6ffc('0x5c')](function(_0xeb6b15){socket[_0x6ffc('0x5d')](_0x6ffc('0x5e'),{'UserId':_0xeb6b15['id'],'ChatQueueId':_0x30a9be['id']});});});});});}})[_0x6ffc('0x16')](respondWithStatusCode(_0x486215,null))[_0x6ffc('0x28')](handleError(_0x486215,null));};exports[_0x6ffc('0x5f')]=function(_0x29654a,_0x3c61df){return db[_0x6ffc('0x4e')][_0x6ffc('0x27')]({'where':{'id':_0x29654a[_0x6ffc('0x26')][_0x6ffc('0x51')]},'attributes':['id'],'include':[{'model':db[_0x6ffc('0x52')],'as':_0x6ffc('0x55'),'attributes':['id'],'raw':!![]}]})[_0x6ffc('0x16')](handleEntityNotFound(_0x3c61df,null))['then'](function(_0x27751f){var _0x4c01fc=_[_0x6ffc('0x1e')](_0x27751f,'id');var _0x3fdae9=[];var _0x4c2095=[];var _0x195463=squel['select']();_0x195463[_0x6ffc('0x60')](_0x6ffc('0x61'))['from'](_0x6ffc('0x62'),'tq')['join'](_0x6ffc('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6ffc('0x64'),_0x29654a['params']['id']);for(var _0x9f6a49=0x0;_0x9f6a49<_0x27751f[_0x6ffc('0x31')];_0x9f6a49+=0x1){let _0x3c680d=_0x27751f[_0x9f6a49];for(var _0x247458=0x0;_0x247458<_0x3c680d[_0x6ffc('0x55')][_0x6ffc('0x31')];_0x247458+=0x1){let _0x3c9de3=_0x3c680d['Agents'][_0x247458];var _0x45b91c=_0x195463['clone']();_0x45b91c[_0x6ffc('0x23')](_0x6ffc('0x65'),_0x3c9de3['id']);_0x4c2095[_0x6ffc('0x66')](db[_0x6ffc('0x57')][_0x6ffc('0x26')](_0x45b91c['toString'](),{'type':db[_0x6ffc('0x57')][_0x6ffc('0x67')][_0x6ffc('0x68')]})[_0x6ffc('0x16')](function(_0x4f0b9b){if(_0x4f0b9b[_0x6ffc('0x31')]===0x1){return _0x3c9de3['id'];}else{var _0x1ef497=_['every'](_['map'](_0x4f0b9b,_0x6ffc('0x69')),function(_0x12dc00){return _[_0x6ffc('0x6a')](_0x4c01fc,_0x12dc00);});if(_0x1ef497){return _0x3c9de3['id'];}}}));}}return BPromise[_0x6ffc('0x6b')](_0x4c2095)[_0x6ffc('0x16')](function(_0x335b03){_0x3fdae9=_(_0x3fdae9)['union'](_0x335b03)['compact']()[_0x6ffc('0x6c')]();return db[_0x6ffc('0x24')][_0x6ffc('0x56')]({'where':{'id':_0x29654a['params']['id']}})[_0x6ffc('0x16')](function(_0x1573d3){return db['sequelize']['transaction'](function(_0x355953){return _0x1573d3[_0x6ffc('0x5f')](_0x29654a[_0x6ffc('0x26')][_0x6ffc('0x51')],{'transaction':_0x355953})[_0x6ffc('0x16')](function(){if(!_[_0x6ffc('0x6d')](_0x3fdae9)){return _0x1573d3[_0x6ffc('0x6e')](_0x3fdae9,{'transaction':_0x355953});}})[_0x6ffc('0x16')](function(){_0x3fdae9[_0x6ffc('0x5c')](function(_0x3cb283){socket[_0x6ffc('0x5d')](_0x6ffc('0x6f'),{'UserId':_0x3cb283,'ChatQueueId':_0x1573d3['id']});});});});});});})[_0x6ffc('0x16')](respondWithStatusCode(_0x3c61df,null))[_0x6ffc('0x28')](handleError(_0x3c61df,null));};exports[_0x6ffc('0x70')]=function(_0x30ef9e,_0xa965e0){return db[_0x6ffc('0x24')][_0x6ffc('0x56')]({'where':{'id':_0x30ef9e['params']['id']}})['then'](handleEntityNotFound(_0xa965e0,null))[_0x6ffc('0x16')](function(_0x4e2d25){if(_0x4e2d25){return _0x4e2d25[_0x6ffc('0x70')](_0x30ef9e[_0x6ffc('0x36')][_0x6ffc('0x51')],_[_0x6ffc('0x71')](_0x30ef9e['body'],['ids','id'])||{})[_0x6ffc('0x72')](function(_0x49d5a7){for(var _0x14a24a=0x0;_0x14a24a<_0x30ef9e[_0x6ffc('0x36')][_0x6ffc('0x51')][_0x6ffc('0x31')];_0x14a24a+=0x1){socket[_0x6ffc('0x5d')](_0x6ffc('0x5e'),{'UserId':Number(_0x30ef9e['body'][_0x6ffc('0x51')][_0x14a24a]),'ChatQueueId':Number(_0x30ef9e[_0x6ffc('0x2a')]['id'])});}return _0x49d5a7;});}})[_0x6ffc('0x16')](respondWithResult(_0xa965e0,null))['catch'](handleError(_0xa965e0,null));};exports[_0x6ffc('0x6e')]=function(_0x59727e,_0x4cfabf){return db[_0x6ffc('0x24')][_0x6ffc('0x56')]({'where':{'id':_0x59727e[_0x6ffc('0x2a')]['id']}})[_0x6ffc('0x16')](handleEntityNotFound(_0x4cfabf,null))[_0x6ffc('0x16')](function(_0xc3b0fa){if(_0xc3b0fa){return _0xc3b0fa[_0x6ffc('0x6e')](_0x59727e['query'][_0x6ffc('0x51')])[_0x6ffc('0x16')](function(){if(_[_0x6ffc('0x73')](_0x59727e[_0x6ffc('0x26')]['ids'])){for(var _0x5634a0=0x0;_0x5634a0<_0x59727e[_0x6ffc('0x26')][_0x6ffc('0x51')][_0x6ffc('0x31')];_0x5634a0+=0x1){socket[_0x6ffc('0x5d')](_0x6ffc('0x6f'),{'UserId':Number(_0x59727e[_0x6ffc('0x26')][_0x6ffc('0x51')][_0x5634a0]),'ChatQueueId':Number(_0x59727e[_0x6ffc('0x2a')]['id'])});}}else{socket[_0x6ffc('0x5d')]('userChatQueue:remove',{'UserId':Number(_0x59727e[_0x6ffc('0x26')][_0x6ffc('0x51')]),'ChatQueueId':Number(_0x59727e[_0x6ffc('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4cfabf,null))[_0x6ffc('0x28')](handleError(_0x4cfabf,null));};exports['getAgents']=function(_0x2c7f5c,_0x389c39){var _0xeb4681={};var _0x31e9f3={};var _0x18373b;var _0xa9d16c;return db[_0x6ffc('0x24')][_0x6ffc('0x74')]({'where':{'id':_0x2c7f5c[_0x6ffc('0x2a')]['id']}})[_0x6ffc('0x16')](handleEntityNotFound(_0x389c39,null))['then'](function(_0x4bfe33){if(_0x4bfe33){_0x18373b=_0x4bfe33;_0x31e9f3['model']=_[_0x6ffc('0x2b')](db['User'][_0x6ffc('0x1f')]);_0x31e9f3[_0x6ffc('0x26')]=_[_0x6ffc('0x2b')](_0x2c7f5c[_0x6ffc('0x26')]);_0x31e9f3[_0x6ffc('0x2c')]=_[_0x6ffc('0x2d')](_0x31e9f3[_0x6ffc('0x2e')],_0x31e9f3[_0x6ffc('0x26')]);_0xeb4681[_0x6ffc('0x30')]=_['intersection'](_0x31e9f3['model'],qs[_0x6ffc('0x2f')](_0x2c7f5c[_0x6ffc('0x26')][_0x6ffc('0x2f')]));_0xeb4681[_0x6ffc('0x30')]=_0xeb4681[_0x6ffc('0x30')][_0x6ffc('0x31')]?_0xeb4681['attributes']:_0x31e9f3[_0x6ffc('0x2e')];_0xeb4681[_0x6ffc('0x4f')]=qs[_0x6ffc('0x41')](_0x2c7f5c[_0x6ffc('0x26')][_0x6ffc('0x41')]);_0xeb4681[_0x6ffc('0x23')]=qs[_0x6ffc('0x2c')](_[_0x6ffc('0x42')](_0x2c7f5c[_0x6ffc('0x26')],_0x31e9f3[_0x6ffc('0x2c')]));if(_0x2c7f5c['query']['filter']){_0xeb4681[_0x6ffc('0x23')]=_[_0x6ffc('0x33')](_0xeb4681['where'],{'$or':_['map'](_0xeb4681[_0x6ffc('0x30')],function(_0x48062b){var _0x44de17={};_0x44de17[_0x48062b]={'$like':'%'+_0x2c7f5c[_0x6ffc('0x26')][_0x6ffc('0x43')]+'%'};return _0x44de17;})});}_0xeb4681=_[_0x6ffc('0x33')]({},_0xeb4681,_0x2c7f5c['options']);return _0x18373b[_0x6ffc('0x75')](_0xeb4681);}})['then'](function(_0x1f677d){if(_0x1f677d){_0xa9d16c=_0x1f677d[_0x6ffc('0x31')];if(!_0x2c7f5c['query']['hasOwnProperty'](_0x6ffc('0x40'))){_0xeb4681[_0x6ffc('0x11')]=qs[_0x6ffc('0x11')](_0x2c7f5c[_0x6ffc('0x26')]['limit']);_0xeb4681[_0x6ffc('0xf')]=qs[_0x6ffc('0xf')](_0x2c7f5c['query'][_0x6ffc('0xf')]);}return _0x18373b['getAgents'](_0xeb4681);}})[_0x6ffc('0x16')](function(_0x17a0e9){if(_0x17a0e9){return _0x17a0e9?{'count':_0xa9d16c,'rows':_0x17a0e9}:null;}})[_0x6ffc('0x16')](respondWithResult(_0x389c39,null))[_0x6ffc('0x28')](handleError(_0x389c39,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ae7da73..e5cdd38 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 _0x09a4=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x20b844,_0x1fcefc){var _0x146bcc=function(_0x1abbe9){while(--_0x1abbe9){_0x20b844['push'](_0x20b844['shift']());}};_0x146bcc(++_0x1fcefc);}(_0x09a4,0x147));var _0x409a=function(_0xc28ad2,_0x5de7dd){_0xc28ad2=_0xc28ad2-0x0;var _0x3df1e2=_0x09a4[_0xc28ad2];return _0x3df1e2;};'use strict';var EventEmitter=require(_0x409a('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x409a('0x1')](0x0);var events={'afterCreate':_0x409a('0x2'),'afterUpdate':_0x409a('0x3'),'afterDestroy':_0x409a('0x4')};function emitEvent(_0x56b8c5){return function(_0x2db9e0,_0x630525,_0x32e3cf){ChatQueueEvents[_0x409a('0x5')](_0x56b8c5+':'+_0x2db9e0['id'],_0x2db9e0);ChatQueueEvents[_0x409a('0x5')](_0x56b8c5,_0x2db9e0);_0x32e3cf(null);};}for(var e in events){if(events[_0x409a('0x6')](e)){var event=events[e];ChatQueue[_0x409a('0x7')](e,emitEvent(event));}}module[_0x409a('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xff16=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x641ccb,_0x311d8c){var _0xeb5d0f=function(_0x3f9072){while(--_0x3f9072){_0x641ccb['push'](_0x641ccb['shift']());}};_0xeb5d0f(++_0x311d8c);}(_0xff16,0x7f));var _0x6ff1=function(_0x3b4f53,_0x57620c){_0x3b4f53=_0x3b4f53-0x0;var _0x258204=_0xff16[_0x3b4f53];return _0x258204;};'use strict';var EventEmitter=require(_0x6ff1('0x0'));var ChatQueue=require(_0x6ff1('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6ff1('0x2')](0x0);var events={'afterCreate':_0x6ff1('0x3'),'afterUpdate':_0x6ff1('0x4'),'afterDestroy':_0x6ff1('0x5')};function emitEvent(_0x3f3c60){return function(_0x3f53b2,_0x3e4c94,_0x18be1c){ChatQueueEvents['emit'](_0x3f3c60+':'+_0x3f53b2['id'],_0x3f53b2);ChatQueueEvents[_0x6ff1('0x6')](_0x3f3c60,_0x3f53b2);_0x18be1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x6ff1('0x7')](e,emitEvent(event));}}module[_0x6ff1('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 4c23bb4..d61fe99 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 _0xcae2=['bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment'];(function(_0x23f58d,_0x22b11c){var _0x515d10=function(_0x18fe4a){while(--_0x18fe4a){_0x23f58d['push'](_0x23f58d['shift']());}};_0x515d10(++_0x22b11c);}(_0xcae2,0x1a1));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x2cae('0x0'));var logger=require(_0x2cae('0x1'))('api');var moment=require(_0x2cae('0x2'));var BPromise=require(_0x2cae('0x3'));var rp=require(_0x2cae('0x4'));var fs=require('fs');var path=require(_0x2cae('0x5'));var rimraf=require(_0x2cae('0x6'));var config=require('../../config/environment');var attributes=require(_0x2cae('0x7'));module[_0x2cae('0x8')]=function(_0x3371f0,_0x312a86){return _0x3371f0[_0x2cae('0x9')](_0x2cae('0xa'),attributes,{'tableName':_0x2cae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1e1=['path','rimraf','../../config/environment','exports','define','ChatQueue','lodash','api','bluebird'];(function(_0x229105,_0x209fa6){var _0x28a88f=function(_0x40caf3){while(--_0x40caf3){_0x229105['push'](_0x229105['shift']());}};_0x28a88f(++_0x209fa6);}(_0xf1e1,0x192));var _0x1f1e=function(_0x3f994d,_0x249d72){_0x3f994d=_0x3f994d-0x0;var _0x5309b4=_0xf1e1[_0x3f994d];return _0x5309b4;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1f1e('0x1'));var moment=require('moment');var BPromise=require(_0x1f1e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f1e('0x3'));var rimraf=require(_0x1f1e('0x4'));var config=require(_0x1f1e('0x5'));var attributes=require('./chatQueue.attributes');module[_0x1f1e('0x6')]=function(_0x4a7db9,_0x255deb){return _0x4a7db9[_0x1f1e('0x7')](_0x1f1e('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 699b026..fb38eba 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 _0xde6f=['stringify','error','code','ChatQueue,\x20%s,\x20%s','message','GetChatQueue','ChatQueue','options','limit','include','model','attributes','map','ShowChatQueue','find','raw','where','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfde6('0x0'));var BPromise=require(_0xfde6('0x1'));var rs=require(_0xfde6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde6('0x3'))['db'];var utils=require(_0xfde6('0x4'));var logger=require(_0xfde6('0x5'))(_0xfde6('0x6'));var config=require(_0xfde6('0x7'));var jayson=require(_0xfde6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xfde6('0x9')]=_[_0xfde6('0xa')](config[_0xfde6('0x9')],{'host':_0xfde6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfde6('0x9')]));require(_0xfde6('0xc'))[_0xfde6('0xd')](socket);function respondWithRpcPromise(_0x5d890c,_0x27e896,_0x470b8a){return new BPromise(function(_0x48dd4c,_0x5167e2){return client[_0xfde6('0xe')](_0x5d890c,_0x470b8a)[_0xfde6('0xf')](function(_0x37df80){logger[_0xfde6('0x10')]('ChatQueue,\x20%s,\x20%s',_0x27e896,_0xfde6('0x11'));logger[_0xfde6('0x12')](_0xfde6('0x13'),_0x27e896,_0xfde6('0x11'),JSON[_0xfde6('0x14')](_0x37df80));if(_0x37df80['error']){if(_0x37df80[_0xfde6('0x15')][_0xfde6('0x16')]===0x1f4){logger['error'](_0xfde6('0x17'),_0x27e896,_0x37df80[_0xfde6('0x15')][_0xfde6('0x18')]);return _0x5167e2(_0x37df80['error'][_0xfde6('0x18')]);}logger[_0xfde6('0x15')](_0xfde6('0x17'),_0x27e896,_0x37df80[_0xfde6('0x15')]['message']);return _0x48dd4c(_0x37df80['error'][_0xfde6('0x18')]);}else{logger['info'](_0xfde6('0x17'),_0x27e896,_0xfde6('0x11'));_0x48dd4c(_0x37df80['result'][_0xfde6('0x18')]);}})['catch'](function(_0x122e45){logger[_0xfde6('0x15')](_0xfde6('0x17'),_0x27e896,_0x122e45);_0x5167e2(_0x122e45);});});}exports[_0xfde6('0x19')]=function(_0x1ec215){var _0x386622=this;return new Promise(function(_0x37b4dc,_0x1841d8){return db[_0xfde6('0x1a')]['findAll']({'raw':_0x1ec215[_0xfde6('0x1b')]?_0x1ec215[_0xfde6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1ec215[_0xfde6('0x1b')]?_0x1ec215[_0xfde6('0x1b')]['where']||null:null,'attributes':_0x1ec215[_0xfde6('0x1b')]?_0x1ec215[_0xfde6('0x1b')]['attributes']||null:null,'limit':_0x1ec215['options']?_0x1ec215[_0xfde6('0x1b')][_0xfde6('0x1c')]||null:null,'include':_0x1ec215['options']?_0x1ec215[_0xfde6('0x1b')]['include']?_['map'](_0x1ec215[_0xfde6('0x1b')][_0xfde6('0x1d')],function(_0x62e9b8){return{'model':db[_0x62e9b8[_0xfde6('0x1e')]],'as':_0x62e9b8['as'],'attributes':_0x62e9b8[_0xfde6('0x1f')],'include':_0x62e9b8[_0xfde6('0x1d')]?_['map'](_0x62e9b8[_0xfde6('0x1d')],function(_0x262373){return{'model':db[_0x262373['model']],'as':_0x262373['as'],'attributes':_0x262373[_0xfde6('0x1f')],'include':_0x262373['include']?_[_0xfde6('0x20')](_0x262373[_0xfde6('0x1d')],function(_0x59661f){return{'model':db[_0x59661f[_0xfde6('0x1e')]],'as':_0x59661f['as'],'attributes':_0x59661f[_0xfde6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c043){logger[_0xfde6('0x10')]('GetChatQueue',_0x1ec215);logger[_0xfde6('0x12')]('GetChatQueue',_0x1ec215,JSON[_0xfde6('0x14')](_0x43c043));_0x37b4dc(_0x43c043);})['catch'](function(_0x52c0db){logger['error'](_0xfde6('0x19'),_0x52c0db[_0xfde6('0x18')],_0x1ec215);_0x1841d8(_0x386622[_0xfde6('0x15')](0x1f4,_0x52c0db[_0xfde6('0x18')]));});});};exports[_0xfde6('0x21')]=function(_0x5a9f1a){var _0x488f7b=this;return new Promise(function(_0x5ae689,_0x183e89){return db[_0xfde6('0x1a')][_0xfde6('0x22')]({'raw':_0x5a9f1a[_0xfde6('0x1b')]?_0x5a9f1a[_0xfde6('0x1b')][_0xfde6('0x23')]===undefined?!![]:![]:!![],'where':_0x5a9f1a[_0xfde6('0x1b')]?_0x5a9f1a[_0xfde6('0x1b')][_0xfde6('0x24')]||null:null,'attributes':_0x5a9f1a['options']?_0x5a9f1a[_0xfde6('0x1b')][_0xfde6('0x1f')]||null:null,'include':_0x5a9f1a[_0xfde6('0x1b')]?_0x5a9f1a[_0xfde6('0x1b')]['include']?_[_0xfde6('0x20')](_0x5a9f1a['options'][_0xfde6('0x1d')],function(_0x359181){return{'model':db[_0x359181[_0xfde6('0x1e')]],'as':_0x359181['as'],'attributes':_0x359181[_0xfde6('0x1f')],'include':_0x359181['include']?_[_0xfde6('0x20')](_0x359181['include'],function(_0x337da2){return{'model':db[_0x337da2[_0xfde6('0x1e')]],'as':_0x337da2['as'],'attributes':_0x337da2['attributes'],'include':_0x337da2[_0xfde6('0x1d')]?_[_0xfde6('0x20')](_0x337da2[_0xfde6('0x1d')],function(_0xa1fc20){return{'model':db[_0xa1fc20['model']],'as':_0xa1fc20['as'],'attributes':_0xa1fc20[_0xfde6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfde6('0xf')](function(_0x3d8957){logger[_0xfde6('0x10')](_0xfde6('0x21'),_0x5a9f1a);logger[_0xfde6('0x12')](_0xfde6('0x21'),_0x5a9f1a,JSON[_0xfde6('0x14')](_0x3d8957));_0x5ae689(_0x3d8957);})[_0xfde6('0x25')](function(_0x312c9b){logger[_0xfde6('0x15')](_0xfde6('0x21'),_0x312c9b[_0xfde6('0x18')],_0x5a9f1a);_0x183e89(_0x488f7b[_0xfde6('0x15')](0x1f4,_0x312c9b[_0xfde6('0x18')]));});});}; \ No newline at end of file +var _0x47cb=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','include','map','model','attributes','then','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3bfdc0,_0x543c89){var _0x2b7446=function(_0x71cda5){while(--_0x71cda5){_0x3bfdc0['push'](_0x3bfdc0['shift']());}};_0x2b7446(++_0x543c89);}(_0x47cb,0x74));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var moment=require(_0xb47c('0x2'));var BPromise=require(_0xb47c('0x3'));var rs=require(_0xb47c('0x4'));var fs=require('fs');var Redis=require(_0xb47c('0x5'));var db=require(_0xb47c('0x6'))['db'];var utils=require(_0xb47c('0x7'));var logger=require('../../config/logger')(_0xb47c('0x8'));var config=require(_0xb47c('0x9'));var jayson=require(_0xb47c('0xa'));var client=jayson[_0xb47c('0xb')][_0xb47c('0xc')]({'port':0x232a});config[_0xb47c('0xd')]=_[_0xb47c('0xe')](config[_0xb47c('0xd')],{'host':_0xb47c('0xf'),'port':0x18eb});var socket=require(_0xb47c('0x10'))(new Redis(config[_0xb47c('0xd')]));require(_0xb47c('0x11'))[_0xb47c('0x12')](socket);function respondWithRpcPromise(_0x2e04d7,_0x336f67,_0x5a344c){return new BPromise(function(_0x76cc,_0x37a7d5){return client[_0xb47c('0x13')](_0x2e04d7,_0x5a344c)['then'](function(_0x22e56b){logger[_0xb47c('0x14')]('ChatQueue,\x20%s,\x20%s',_0x336f67,_0xb47c('0x15'));logger[_0xb47c('0x16')](_0xb47c('0x17'),_0x336f67,'request\x20sent',JSON[_0xb47c('0x18')](_0x22e56b));if(_0x22e56b[_0xb47c('0x19')]){if(_0x22e56b[_0xb47c('0x19')][_0xb47c('0x1a')]===0x1f4){logger[_0xb47c('0x19')](_0xb47c('0x1b'),_0x336f67,_0x22e56b[_0xb47c('0x19')][_0xb47c('0x1c')]);return _0x37a7d5(_0x22e56b[_0xb47c('0x19')][_0xb47c('0x1c')]);}logger[_0xb47c('0x19')]('ChatQueue,\x20%s,\x20%s',_0x336f67,_0x22e56b[_0xb47c('0x19')][_0xb47c('0x1c')]);return _0x76cc(_0x22e56b[_0xb47c('0x19')]['message']);}else{logger[_0xb47c('0x14')](_0xb47c('0x1b'),_0x336f67,_0xb47c('0x15'));_0x76cc(_0x22e56b[_0xb47c('0x1d')][_0xb47c('0x1c')]);}})[_0xb47c('0x1e')](function(_0x19867e){logger[_0xb47c('0x19')](_0xb47c('0x1b'),_0x336f67,_0x19867e);_0x37a7d5(_0x19867e);});});}exports[_0xb47c('0x1f')]=function(_0x21d6d8){var _0x292b4b=this;return new Promise(function(_0x51c30d,_0x3dfff2){return db[_0xb47c('0x20')][_0xb47c('0x21')]({'raw':_0x21d6d8['options']?_0x21d6d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x21d6d8[_0xb47c('0x22')]?_0x21d6d8[_0xb47c('0x22')][_0xb47c('0x23')]||null:null,'attributes':_0x21d6d8['options']?_0x21d6d8[_0xb47c('0x22')]['attributes']||null:null,'limit':_0x21d6d8[_0xb47c('0x22')]?_0x21d6d8[_0xb47c('0x22')]['limit']||null:null,'include':_0x21d6d8['options']?_0x21d6d8[_0xb47c('0x22')][_0xb47c('0x24')]?_[_0xb47c('0x25')](_0x21d6d8[_0xb47c('0x22')][_0xb47c('0x24')],function(_0x1e55f7){return{'model':db[_0x1e55f7[_0xb47c('0x26')]],'as':_0x1e55f7['as'],'attributes':_0x1e55f7[_0xb47c('0x27')],'include':_0x1e55f7[_0xb47c('0x24')]?_[_0xb47c('0x25')](_0x1e55f7[_0xb47c('0x24')],function(_0x4d0076){return{'model':db[_0x4d0076[_0xb47c('0x26')]],'as':_0x4d0076['as'],'attributes':_0x4d0076[_0xb47c('0x27')],'include':_0x4d0076['include']?_['map'](_0x4d0076[_0xb47c('0x24')],function(_0x3722d4){return{'model':db[_0x3722d4[_0xb47c('0x26')]],'as':_0x3722d4['as'],'attributes':_0x3722d4[_0xb47c('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf3633){logger[_0xb47c('0x14')]('GetChatQueue',_0x21d6d8);logger[_0xb47c('0x16')]('GetChatQueue',_0x21d6d8,JSON[_0xb47c('0x18')](_0xf3633));_0x51c30d(_0xf3633);})[_0xb47c('0x1e')](function(_0x3b2a6e){logger[_0xb47c('0x19')](_0xb47c('0x1f'),_0x3b2a6e['message'],_0x21d6d8);_0x3dfff2(_0x292b4b['error'](0x1f4,_0x3b2a6e[_0xb47c('0x1c')]));});});};exports['ShowChatQueue']=function(_0x44818e){var _0x1a23f3=this;return new Promise(function(_0x4ca379,_0x5333cf){return db['ChatQueue']['find']({'raw':_0x44818e[_0xb47c('0x22')]?_0x44818e[_0xb47c('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x44818e[_0xb47c('0x22')]?_0x44818e['options'][_0xb47c('0x23')]||null:null,'attributes':_0x44818e[_0xb47c('0x22')]?_0x44818e[_0xb47c('0x22')][_0xb47c('0x27')]||null:null,'include':_0x44818e[_0xb47c('0x22')]?_0x44818e[_0xb47c('0x22')]['include']?_[_0xb47c('0x25')](_0x44818e[_0xb47c('0x22')][_0xb47c('0x24')],function(_0x18e2da){return{'model':db[_0x18e2da[_0xb47c('0x26')]],'as':_0x18e2da['as'],'attributes':_0x18e2da[_0xb47c('0x27')],'include':_0x18e2da['include']?_[_0xb47c('0x25')](_0x18e2da[_0xb47c('0x24')],function(_0x4e30c6){return{'model':db[_0x4e30c6[_0xb47c('0x26')]],'as':_0x4e30c6['as'],'attributes':_0x4e30c6[_0xb47c('0x27')],'include':_0x4e30c6['include']?_[_0xb47c('0x25')](_0x4e30c6[_0xb47c('0x24')],function(_0x545b0d){return{'model':db[_0x545b0d[_0xb47c('0x26')]],'as':_0x545b0d['as'],'attributes':_0x545b0d['attributes']};}):[]};}):[]};}):[]:[]})[_0xb47c('0x28')](function(_0x26157e){logger[_0xb47c('0x14')](_0xb47c('0x29'),_0x44818e);logger[_0xb47c('0x16')](_0xb47c('0x29'),_0x44818e,JSON[_0xb47c('0x18')](_0x26157e));_0x4ca379(_0x26157e);})[_0xb47c('0x1e')](function(_0xd228d0){logger[_0xb47c('0x19')](_0xb47c('0x29'),_0xd228d0[_0xb47c('0x1c')],_0x44818e);_0x5333cf(_0x1a23f3[_0xb47c('0x19')](0x1f4,_0xd228d0[_0xb47c('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 553b4df..65f25e3 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 _0x2123=['./chatQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1a215b,_0x5749df){var _0x245257=function(_0x15ef3d){while(--_0x15ef3d){_0x1a215b['push'](_0x1a215b['shift']());}};_0x245257(++_0x5749df);}(_0x2123,0x190));var _0x3212=function(_0x10ee18,_0x16a291){_0x10ee18=_0x10ee18-0x0;var _0xd8c465=_0x2123[_0x10ee18];return _0xd8c465;};'use strict';var ChatQueueEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x7158b8,_0x2ff863){return function(_0x8c047){_0x2ff863[_0x3212('0x4')](_0x7158b8,_0x8c047);};}function removeListener(_0x304f80,_0x6ca653){return function(){ChatQueueEvents[_0x3212('0x5')](_0x304f80,_0x6ca653);};}exports[_0x3212('0x6')]=function(_0x5d9d36){for(var _0x3859e4=0x0,_0x2b1302=events[_0x3212('0x7')];_0x3859e4<_0x2b1302;_0x3859e4++){var _0x4b35e9=events[_0x3859e4];var _0x3e17a3=createListener('chatQueue:'+_0x4b35e9,_0x5d9d36);ChatQueueEvents['on'](_0x4b35e9,_0x3e17a3);}}; \ No newline at end of file +var _0x222f=['./chatQueue.events','save','remove','update','emit','register'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x222f,0x1a4));var _0xf222=function(_0x1d4e21,_0x4e8096){_0x1d4e21=_0x1d4e21-0x0;var _0x178fef=_0x222f[_0x1d4e21];return _0x178fef;};'use strict';var ChatQueueEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatQueueEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatQueue:'+_0xf5a105,_0x54a758);ChatQueueEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a5f94b0..1be3a11 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x4f1550,_0x34864a){var _0x2ea3ca=function(_0x272eb5){while(--_0x272eb5){_0x4f1550['push'](_0x4f1550['shift']());}};_0x2ea3ca(++_0x34864a);}(_0x55ca,0x126));var _0xa55c=function(_0x2ecd91,_0x1f21e8){_0x2ecd91=_0x2ecd91-0x0;var _0x3bf737=_0x55ca[_0x2ecd91];return _0x3bf737;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +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(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x5fc3[_0x4b7b69];return _0x173b4c;};'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 278b12f..afeaa78 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 _0xe747=['DATE','moment','sequelize','STRING'];(function(_0x47a844,_0x45be97){var _0x570f07=function(_0x1acea7){while(--_0x1acea7){_0x47a844['push'](_0x47a844['shift']());}};_0x570f07(++_0x45be97);}(_0xe747,0x13d));var _0x7e74=function(_0x3bc5a1,_0x530b19){_0x3bc5a1=_0x3bc5a1-0x0;var _0x5d23a3=_0xe747[_0x3bc5a1];return _0x5d23a3;};'use strict';var moment=require(_0x7e74('0x0'));var Sequelize=require(_0x7e74('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7e74('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7e74('0x3')]},'acceptAt':{'type':Sequelize[_0x7e74('0x3')]},'exitAt':{'type':Sequelize[_0x7e74('0x3')]},'reason':{'type':Sequelize[_0x7e74('0x2')]}}; \ No newline at end of file +var _0x1bdf=['STRING','DATE','moment','exports'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x1bdf,0x15e));var _0xf1bd=function(_0x480e20,_0x37df7f){_0x480e20=_0x480e20-0x0;var _0x1fe6e3=_0x1bdf[_0x480e20];return _0x1fe6e3;};'use strict';var moment=require(_0xf1bd('0x0'));var Sequelize=require('sequelize');module[_0xf1bd('0x1')]={'uniqueid':{'type':Sequelize[_0xf1bd('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf1bd('0x2')]},'joinAt':{'type':Sequelize[_0xf1bd('0x3')]},'leaveAt':{'type':Sequelize[_0xf1bd('0x3')]},'acceptAt':{'type':Sequelize[_0xf1bd('0x3')]},'exitAt':{'type':Sequelize[_0xf1bd('0x3')]},'reason':{'type':Sequelize[_0xf1bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f47e527..230d2b6 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 _0xaf11=['create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','fields','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf11,0x12f));var _0x1af1=function(_0x5825bf,_0x106229){_0x5825bf=_0x5825bf-0x0;var _0x5e842f=_0xaf11[_0x5825bf];return _0x5e842f;};'use strict';var emlformat=require(_0x1af1('0x0'));var rimraf=require(_0x1af1('0x1'));var zipdir=require(_0x1af1('0x2'));var jsonpatch=require(_0x1af1('0x3'));var rp=require('request-promise');var moment=require(_0x1af1('0x4'));var BPromise=require(_0x1af1('0x5'));var Mustache=require(_0x1af1('0x6'));var util=require('util');var path=require(_0x1af1('0x7'));var sox=require(_0x1af1('0x8'));var csv=require(_0x1af1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1af1('0xa'));var _=require('lodash');var squel=require(_0x1af1('0xb'));var crypto=require(_0x1af1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1af1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1af1('0xe'));var Redis=require(_0x1af1('0xf'));var authService=require(_0x1af1('0x10'));var qs=require(_0x1af1('0x11'));var as=require(_0x1af1('0x12'));var hardwareService=require(_0x1af1('0x13'));var logger=require('../../config/logger')(_0x1af1('0x14'));var utils=require(_0x1af1('0x15'));var config=require(_0x1af1('0x16'));var licenseUtil=require(_0x1af1('0x17'));var db=require(_0x1af1('0x18'))['db'];function respondWithStatusCode(_0x20141a,_0x339763){_0x339763=_0x339763||0xcc;return function(_0x5e4634){if(_0x5e4634){return _0x20141a[_0x1af1('0x19')](_0x339763);}return _0x20141a[_0x1af1('0x1a')](_0x339763)[_0x1af1('0x1b')]();};}function respondWithResult(_0x2fe8d4,_0x4e92d5){_0x4e92d5=_0x4e92d5||0xc8;return function(_0x19f4e3){if(_0x19f4e3){return _0x2fe8d4[_0x1af1('0x1a')](_0x4e92d5)[_0x1af1('0x1c')](_0x19f4e3);}};}function respondWithFilteredResult(_0x5d842d,_0x1e756b){return function(_0x41b905){if(_0x41b905){var _0x38df6f=typeof _0x1e756b[_0x1af1('0x1d')]===_0x1af1('0x1e')&&typeof _0x1e756b[_0x1af1('0x1f')]===_0x1af1('0x1e');var _0x45dd76=_0x41b905[_0x1af1('0x20')];var _0x20c17b=_0x38df6f?0x0:_0x1e756b['offset'];var _0x4da591=_0x38df6f?_0x41b905['count']:_0x1e756b[_0x1af1('0x1d')]+_0x1e756b['limit'];var _0xf1c8ae;if(_0x4da591>=_0x45dd76){_0x4da591=_0x45dd76;_0xf1c8ae=0xc8;}else{_0xf1c8ae=0xce;}_0x5d842d[_0x1af1('0x1a')](_0xf1c8ae);return _0x5d842d[_0x1af1('0x21')](_0x1af1('0x22'),_0x20c17b+'-'+_0x4da591+'/'+_0x45dd76)[_0x1af1('0x1c')](_0x41b905);}return null;};}function patchUpdates(_0x5d336){return function(_0x4af71a){try{jsonpatch[_0x1af1('0x23')](_0x4af71a,_0x5d336,!![]);}catch(_0x2ef81a){return BPromise[_0x1af1('0x24')](_0x2ef81a);}return _0x4af71a['save']();};}function saveUpdates(_0x3d1ed1,_0xca2e20){return function(_0x535a8e){if(_0x535a8e){return _0x535a8e[_0x1af1('0x25')](_0x3d1ed1)[_0x1af1('0x26')](function(_0x187dd4){return _0x187dd4;});}return null;};}function removeEntity(_0x51c213,_0x8952cf){return function(_0x4003db){if(_0x4003db){return _0x4003db['destroy']()['then'](function(){_0x51c213['status'](0xcc)[_0x1af1('0x1b')]();});}};}function handleEntityNotFound(_0x5df091,_0x50c0e0){return function(_0x21c60c){if(!_0x21c60c){_0x5df091[_0x1af1('0x19')](0x194);}return _0x21c60c;};}function handleError(_0x3d19e7,_0xbd139d){_0xbd139d=_0xbd139d||0x1f4;return function(_0x6222f1){logger['error'](_0x6222f1[_0x1af1('0x27')]);if(_0x6222f1[_0x1af1('0x28')]){delete _0x6222f1[_0x1af1('0x28')];}_0x3d19e7[_0x1af1('0x1a')](_0xbd139d)[_0x1af1('0x29')](_0x6222f1);};}exports[_0x1af1('0x2a')]=function(_0x4b655b,_0x40e32f){var _0x50438e={},_0x40630d={},_0x440da4={'count':0x0,'rows':[]};var _0x526aba=_['map'](db[_0x1af1('0x2b')][_0x1af1('0x2c')],function(_0x2c1494){return{'name':_0x2c1494[_0x1af1('0x2d')],'type':_0x2c1494['type'][_0x1af1('0x2e')]};});_0x40630d[_0x1af1('0x2f')]=_['map'](_0x526aba,_0x1af1('0x28'));_0x40630d['query']=_[_0x1af1('0x30')](_0x4b655b[_0x1af1('0x31')]);_0x40630d[_0x1af1('0x32')]=_[_0x1af1('0x33')](_0x40630d['model'],_0x40630d[_0x1af1('0x31')]);_0x50438e[_0x1af1('0x34')]=_[_0x1af1('0x33')](_0x40630d['model'],qs['fields'](_0x4b655b[_0x1af1('0x31')]['fields']));_0x50438e[_0x1af1('0x34')]=_0x50438e[_0x1af1('0x34')]['length']?_0x50438e['attributes']:_0x40630d[_0x1af1('0x2f')];if(!_0x4b655b['query'][_0x1af1('0x35')](_0x1af1('0x36'))){_0x50438e[_0x1af1('0x1f')]=qs[_0x1af1('0x1f')](_0x4b655b['query'][_0x1af1('0x1f')]);_0x50438e['offset']=qs[_0x1af1('0x1d')](_0x4b655b['query'][_0x1af1('0x1d')]);}_0x50438e[_0x1af1('0x37')]=qs[_0x1af1('0x38')](_0x4b655b[_0x1af1('0x31')]['sort']);_0x50438e[_0x1af1('0x39')]=qs[_0x1af1('0x32')](_[_0x1af1('0x3a')](_0x4b655b[_0x1af1('0x31')],_0x40630d[_0x1af1('0x32')]),_0x526aba);if(_0x4b655b[_0x1af1('0x31')]['filter']){_0x50438e[_0x1af1('0x39')]=_[_0x1af1('0x3b')](_0x50438e['where'],{'$or':_[_0x1af1('0x3c')](_0x526aba,function(_0x53ef03){if(_0x53ef03[_0x1af1('0x3d')]!==_0x1af1('0x3e')){var _0x4569f5={};_0x4569f5[_0x53ef03[_0x1af1('0x28')]]={'$like':'%'+_0x4b655b[_0x1af1('0x31')]['filter']+'%'};return _0x4569f5;}})});}_0x50438e=_['merge']({},_0x50438e,_0x4b655b[_0x1af1('0x3f')]);var _0x36ab51={'where':_0x50438e[_0x1af1('0x39')]};return db[_0x1af1('0x2b')][_0x1af1('0x20')](_0x36ab51)['then'](function(_0x4683d5){_0x440da4['count']=_0x4683d5;if(_0x4b655b[_0x1af1('0x31')][_0x1af1('0x40')]){_0x50438e[_0x1af1('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x1af1('0x42')](_0x50438e);})[_0x1af1('0x26')](function(_0x13331d){_0x440da4[_0x1af1('0x43')]=_0x13331d;return _0x440da4;})[_0x1af1('0x26')](respondWithFilteredResult(_0x40e32f,_0x50438e))['catch'](handleError(_0x40e32f,null));};exports[_0x1af1('0x44')]=function(_0x115e96,_0x501056){var _0x4ca014={'raw':!![],'where':{'id':_0x115e96['params']['id']}},_0x4c6d0b={};_0x4c6d0b[_0x1af1('0x2f')]=_[_0x1af1('0x30')](db[_0x1af1('0x2b')]['rawAttributes']);_0x4c6d0b[_0x1af1('0x31')]=_[_0x1af1('0x30')](_0x115e96[_0x1af1('0x31')]);_0x4c6d0b[_0x1af1('0x32')]=_[_0x1af1('0x33')](_0x4c6d0b[_0x1af1('0x2f')],_0x4c6d0b['query']);_0x4ca014[_0x1af1('0x34')]=_[_0x1af1('0x33')](_0x4c6d0b[_0x1af1('0x2f')],qs[_0x1af1('0x45')](_0x115e96['query'][_0x1af1('0x45')]));_0x4ca014[_0x1af1('0x34')]=_0x4ca014['attributes']['length']?_0x4ca014[_0x1af1('0x34')]:_0x4c6d0b[_0x1af1('0x2f')];if(_0x115e96['query'][_0x1af1('0x40')]){_0x4ca014[_0x1af1('0x41')]=[{'all':!![]}];}_0x4ca014=_['merge']({},_0x4ca014,_0x115e96[_0x1af1('0x3f')]);return db['ChatQueueReport'][_0x1af1('0x46')](_0x4ca014)['then'](handleEntityNotFound(_0x501056,null))[_0x1af1('0x26')](respondWithResult(_0x501056,null))[_0x1af1('0x47')](handleError(_0x501056,null));};exports['create']=function(_0xabb1c6,_0x1587da){return db[_0x1af1('0x2b')][_0x1af1('0x48')](_0xabb1c6[_0x1af1('0x49')],{})['then'](respondWithResult(_0x1587da,0xc9))[_0x1af1('0x47')](handleError(_0x1587da,null));};exports['update']=function(_0x46e41d,_0x3856be){if(_0x46e41d['body']['id']){delete _0x46e41d[_0x1af1('0x49')]['id'];}return db[_0x1af1('0x2b')][_0x1af1('0x46')]({'where':{'id':_0x46e41d['params']['id']}})[_0x1af1('0x26')](handleEntityNotFound(_0x3856be,null))[_0x1af1('0x26')](saveUpdates(_0x46e41d[_0x1af1('0x49')],null))['then'](respondWithResult(_0x3856be,null))[_0x1af1('0x47')](handleError(_0x3856be,null));};exports[_0x1af1('0x4a')]=function(_0x59b710,_0x27a5d8){return db[_0x1af1('0x2b')][_0x1af1('0x46')]({'where':{'id':_0x59b710['params']['id']}})[_0x1af1('0x26')](handleEntityNotFound(_0x27a5d8,null))[_0x1af1('0x26')](removeEntity(_0x27a5d8,null))[_0x1af1('0x47')](handleError(_0x27a5d8,null));};exports['describe']=function(_0x5b06a5,_0x452d44){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x452d44,null))[_0x1af1('0x47')](handleError(_0x452d44,null));}; \ No newline at end of file +var _0x6b1b=['create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../config/logger','api','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','keys','options','find'];(function(_0x5b2d27,_0x5632aa){var _0x21c166=function(_0x33b22a){while(--_0x33b22a){_0x5b2d27['push'](_0x5b2d27['shift']());}};_0x21c166(++_0x5632aa);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x6b1b[_0x433a86];return _0x23000c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6b1('0x0'));var zipdir=require(_0xb6b1('0x1'));var jsonpatch=require(_0xb6b1('0x2'));var rp=require('request-promise');var moment=require(_0xb6b1('0x3'));var BPromise=require(_0xb6b1('0x4'));var Mustache=require(_0xb6b1('0x5'));var util=require(_0xb6b1('0x6'));var path=require(_0xb6b1('0x7'));var sox=require(_0xb6b1('0x8'));var csv=require(_0xb6b1('0x9'));var ejs=require(_0xb6b1('0xa'));var fs=require('fs');var fs_extra=require(_0xb6b1('0xb'));var _=require(_0xb6b1('0xc'));var squel=require(_0xb6b1('0xd'));var crypto=require('crypto');var jsforce=require(_0xb6b1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb6b1('0xf'));var Papa=require('papaparse');var Redis=require(_0xb6b1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6b1('0x11'))(_0xb6b1('0x12'));var utils=require('../../config/utils');var config=require(_0xb6b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x406dce,_0x2e5256){_0x2e5256=_0x2e5256||0xcc;return function(_0x12f3ff){if(_0x12f3ff){return _0x406dce[_0xb6b1('0x14')](_0x2e5256);}return _0x406dce[_0xb6b1('0x15')](_0x2e5256)[_0xb6b1('0x16')]();};}function respondWithResult(_0x360fc7,_0x429d0d){_0x429d0d=_0x429d0d||0xc8;return function(_0x2a4d72){if(_0x2a4d72){return _0x360fc7[_0xb6b1('0x15')](_0x429d0d)[_0xb6b1('0x17')](_0x2a4d72);}};}function respondWithFilteredResult(_0x14fef6,_0x4f770a){return function(_0x57572a){if(_0x57572a){var _0x513207=typeof _0x4f770a['offset']===_0xb6b1('0x18')&&typeof _0x4f770a[_0xb6b1('0x19')]===_0xb6b1('0x18');var _0x2b72e5=_0x57572a[_0xb6b1('0x1a')];var _0x51fb33=_0x513207?0x0:_0x4f770a['offset'];var _0x581e28=_0x513207?_0x57572a[_0xb6b1('0x1a')]:_0x4f770a[_0xb6b1('0x1b')]+_0x4f770a[_0xb6b1('0x19')];var _0x11e8ae;if(_0x581e28>=_0x2b72e5){_0x581e28=_0x2b72e5;_0x11e8ae=0xc8;}else{_0x11e8ae=0xce;}_0x14fef6[_0xb6b1('0x15')](_0x11e8ae);return _0x14fef6[_0xb6b1('0x1c')]('Content-Range',_0x51fb33+'-'+_0x581e28+'/'+_0x2b72e5)['json'](_0x57572a);}return null;};}function patchUpdates(_0x43312e){return function(_0x1067ea){try{jsonpatch['apply'](_0x1067ea,_0x43312e,!![]);}catch(_0x5ced4c){return BPromise[_0xb6b1('0x1d')](_0x5ced4c);}return _0x1067ea['save']();};}function saveUpdates(_0x509c55,_0x232157){return function(_0x2086ea){if(_0x2086ea){return _0x2086ea[_0xb6b1('0x1e')](_0x509c55)[_0xb6b1('0x1f')](function(_0x164952){return _0x164952;});}return null;};}function removeEntity(_0x3d0864,_0x1eb1b2){return function(_0x3b1ff7){if(_0x3b1ff7){return _0x3b1ff7[_0xb6b1('0x20')]()[_0xb6b1('0x1f')](function(){_0x3d0864['status'](0xcc)[_0xb6b1('0x16')]();});}};}function handleEntityNotFound(_0x4f1e2e,_0xd8e094){return function(_0x5864d6){if(!_0x5864d6){_0x4f1e2e[_0xb6b1('0x14')](0x194);}return _0x5864d6;};}function handleError(_0x48c1d2,_0x35a567){_0x35a567=_0x35a567||0x1f4;return function(_0x387603){logger[_0xb6b1('0x21')](_0x387603[_0xb6b1('0x22')]);if(_0x387603[_0xb6b1('0x23')]){delete _0x387603[_0xb6b1('0x23')];}_0x48c1d2[_0xb6b1('0x15')](_0x35a567)[_0xb6b1('0x24')](_0x387603);};}exports[_0xb6b1('0x25')]=function(_0x5a523c,_0xf40426){var _0x548f3f={},_0x427efb={},_0x2737f1={'count':0x0,'rows':[]};var _0x367d66=_[_0xb6b1('0x26')](db[_0xb6b1('0x27')][_0xb6b1('0x28')],function(_0x206b7f){return{'name':_0x206b7f['fieldName'],'type':_0x206b7f[_0xb6b1('0x29')][_0xb6b1('0x2a')]};});_0x427efb[_0xb6b1('0x2b')]=_['map'](_0x367d66,_0xb6b1('0x23'));_0x427efb[_0xb6b1('0x2c')]=_['keys'](_0x5a523c[_0xb6b1('0x2c')]);_0x427efb[_0xb6b1('0x2d')]=_[_0xb6b1('0x2e')](_0x427efb[_0xb6b1('0x2b')],_0x427efb[_0xb6b1('0x2c')]);_0x548f3f[_0xb6b1('0x2f')]=_['intersection'](_0x427efb[_0xb6b1('0x2b')],qs[_0xb6b1('0x30')](_0x5a523c['query'][_0xb6b1('0x30')]));_0x548f3f['attributes']=_0x548f3f[_0xb6b1('0x2f')][_0xb6b1('0x31')]?_0x548f3f[_0xb6b1('0x2f')]:_0x427efb[_0xb6b1('0x2b')];if(!_0x5a523c[_0xb6b1('0x2c')][_0xb6b1('0x32')]('nolimit')){_0x548f3f[_0xb6b1('0x19')]=qs[_0xb6b1('0x19')](_0x5a523c[_0xb6b1('0x2c')][_0xb6b1('0x19')]);_0x548f3f['offset']=qs['offset'](_0x5a523c['query'][_0xb6b1('0x1b')]);}_0x548f3f[_0xb6b1('0x33')]=qs[_0xb6b1('0x34')](_0x5a523c[_0xb6b1('0x2c')][_0xb6b1('0x34')]);_0x548f3f[_0xb6b1('0x35')]=qs[_0xb6b1('0x2d')](_[_0xb6b1('0x36')](_0x5a523c[_0xb6b1('0x2c')],_0x427efb[_0xb6b1('0x2d')]),_0x367d66);if(_0x5a523c[_0xb6b1('0x2c')][_0xb6b1('0x37')]){_0x548f3f['where']=_[_0xb6b1('0x38')](_0x548f3f[_0xb6b1('0x35')],{'$or':_[_0xb6b1('0x26')](_0x367d66,function(_0x453484){if(_0x453484[_0xb6b1('0x29')]!==_0xb6b1('0x39')){var _0xfe126={};_0xfe126[_0x453484[_0xb6b1('0x23')]]={'$like':'%'+_0x5a523c[_0xb6b1('0x2c')][_0xb6b1('0x37')]+'%'};return _0xfe126;}})});}_0x548f3f=_[_0xb6b1('0x38')]({},_0x548f3f,_0x5a523c['options']);var _0x45cb84={'where':_0x548f3f[_0xb6b1('0x35')]};return db[_0xb6b1('0x27')][_0xb6b1('0x1a')](_0x45cb84)[_0xb6b1('0x1f')](function(_0x2c583f){_0x2737f1[_0xb6b1('0x1a')]=_0x2c583f;if(_0x5a523c[_0xb6b1('0x2c')]['includeAll']){_0x548f3f['include']=[{'all':!![]}];}return db[_0xb6b1('0x27')][_0xb6b1('0x3a')](_0x548f3f);})[_0xb6b1('0x1f')](function(_0x541eb5){_0x2737f1[_0xb6b1('0x3b')]=_0x541eb5;return _0x2737f1;})[_0xb6b1('0x1f')](respondWithFilteredResult(_0xf40426,_0x548f3f))[_0xb6b1('0x3c')](handleError(_0xf40426,null));};exports[_0xb6b1('0x3d')]=function(_0xb6e8f5,_0x3c2780){var _0xa03b13={'raw':!![],'where':{'id':_0xb6e8f5['params']['id']}},_0x339edf={};_0x339edf[_0xb6b1('0x2b')]=_['keys'](db[_0xb6b1('0x27')][_0xb6b1('0x28')]);_0x339edf[_0xb6b1('0x2c')]=_[_0xb6b1('0x3e')](_0xb6e8f5[_0xb6b1('0x2c')]);_0x339edf[_0xb6b1('0x2d')]=_['intersection'](_0x339edf[_0xb6b1('0x2b')],_0x339edf[_0xb6b1('0x2c')]);_0xa03b13['attributes']=_[_0xb6b1('0x2e')](_0x339edf['model'],qs[_0xb6b1('0x30')](_0xb6e8f5[_0xb6b1('0x2c')][_0xb6b1('0x30')]));_0xa03b13[_0xb6b1('0x2f')]=_0xa03b13[_0xb6b1('0x2f')][_0xb6b1('0x31')]?_0xa03b13[_0xb6b1('0x2f')]:_0x339edf[_0xb6b1('0x2b')];if(_0xb6e8f5[_0xb6b1('0x2c')]['includeAll']){_0xa03b13['include']=[{'all':!![]}];}_0xa03b13=_[_0xb6b1('0x38')]({},_0xa03b13,_0xb6e8f5[_0xb6b1('0x3f')]);return db['ChatQueueReport'][_0xb6b1('0x40')](_0xa03b13)[_0xb6b1('0x1f')](handleEntityNotFound(_0x3c2780,null))[_0xb6b1('0x1f')](respondWithResult(_0x3c2780,null))[_0xb6b1('0x3c')](handleError(_0x3c2780,null));};exports[_0xb6b1('0x41')]=function(_0x505a80,_0x28f353){return db[_0xb6b1('0x27')][_0xb6b1('0x41')](_0x505a80[_0xb6b1('0x42')],{})['then'](respondWithResult(_0x28f353,0xc9))['catch'](handleError(_0x28f353,null));};exports[_0xb6b1('0x1e')]=function(_0x5bd5e9,_0x2be9e7){if(_0x5bd5e9[_0xb6b1('0x42')]['id']){delete _0x5bd5e9['body']['id'];}return db[_0xb6b1('0x27')]['find']({'where':{'id':_0x5bd5e9[_0xb6b1('0x43')]['id']}})[_0xb6b1('0x1f')](handleEntityNotFound(_0x2be9e7,null))[_0xb6b1('0x1f')](saveUpdates(_0x5bd5e9[_0xb6b1('0x42')],null))[_0xb6b1('0x1f')](respondWithResult(_0x2be9e7,null))[_0xb6b1('0x3c')](handleError(_0x2be9e7,null));};exports[_0xb6b1('0x20')]=function(_0x1c513c,_0x37bbbe){return db[_0xb6b1('0x27')]['find']({'where':{'id':_0x1c513c[_0xb6b1('0x43')]['id']}})[_0xb6b1('0x1f')](handleEntityNotFound(_0x37bbbe,null))[_0xb6b1('0x1f')](removeEntity(_0x37bbbe,null))[_0xb6b1('0x3c')](handleError(_0x37bbbe,null));};exports[_0xb6b1('0x44')]=function(_0x118ec3,_0x3eca0){return db[_0xb6b1('0x27')][_0xb6b1('0x44')]()['then'](respondWithResult(_0x3eca0,null))[_0xb6b1('0x3c')](handleError(_0x3eca0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5d4d423..f8bbd81 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x237cec,_0x15476b){var _0x553476=function(_0x532733){while(--_0x532733){_0x237cec['push'](_0x237cec['shift']());}};_0x553476(++_0x15476b);}(_0x757a,0xde));var _0xa757=function(_0x4eaaaa,_0x28e660){_0x4eaaaa=_0x4eaaaa-0x0;var _0x46d9d9=_0x757a[_0x4eaaaa];return _0x46d9d9;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x56da28,_0x597cc0){var _0x4d5f1d=function(_0x554b94){while(--_0x554b94){_0x56da28['push'](_0x56da28['shift']());}};_0x4d5f1d(++_0x597cc0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index bf0a32d..e00d6ea 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 _0x315e=['info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0x315e,0x1dd));var _0xe315=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x315e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xe315('0x0'));var util=require(_0xe315('0x1'));var moment=require(_0xe315('0x2'));var BPromise=require('bluebird');var rs=require(_0xe315('0x3'));var fs=require('fs');var Redis=require(_0xe315('0x4'));var db=require(_0xe315('0x5'))['db'];var utils=require(_0xe315('0x6'));var logger=require(_0xe315('0x7'))(_0xe315('0x8'));var config=require(_0xe315('0x9'));var jayson=require(_0xe315('0xa'));var client=jayson['client'][_0xe315('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x137531,_0x3b920a,_0x19332e){return new BPromise(function(_0x3fd83b,_0x59b2bf){return client['request'](_0x137531,_0x19332e)[_0xe315('0xc')](function(_0xdcfc4f){logger[_0xe315('0xd')](_0xe315('0xe'),_0x3b920a,_0xe315('0xf'));logger['debug'](_0xe315('0x10'),_0x3b920a,_0xe315('0xf'),JSON[_0xe315('0x11')](_0xdcfc4f));if(_0xdcfc4f[_0xe315('0x12')]){if(_0xdcfc4f['error'][_0xe315('0x13')]===0x1f4){logger[_0xe315('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3b920a,_0xdcfc4f['error'][_0xe315('0x14')]);return _0x59b2bf(_0xdcfc4f[_0xe315('0x12')]['message']);}logger[_0xe315('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3b920a,_0xdcfc4f[_0xe315('0x12')][_0xe315('0x14')]);return _0x3fd83b(_0xdcfc4f[_0xe315('0x12')]['message']);}else{logger[_0xe315('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3b920a,_0xe315('0xf'));_0x3fd83b(_0xdcfc4f[_0xe315('0x15')]['message']);}})[_0xe315('0x16')](function(_0x22e06e){logger[_0xe315('0x12')](_0xe315('0xe'),_0x3b920a,_0x22e06e);_0x59b2bf(_0x22e06e);});});}exports[_0xe315('0x17')]=function(_0x112821){var _0x2e5e24=this;return new Promise(function(_0x10e106,_0x49f764){return db[_0xe315('0x18')][_0xe315('0x19')](_0x112821[_0xe315('0x1a')],{'raw':_0x112821[_0xe315('0x1b')]?_0x112821[_0xe315('0x1b')][_0xe315('0x1c')]===undefined?!![]:![]:!![]})[_0xe315('0xc')](function(_0x566672){logger[_0xe315('0xd')](_0xe315('0x17'),_0x112821);logger[_0xe315('0x1d')]('CreateChatQueueReport',_0x112821,JSON['stringify'](_0x566672));_0x10e106(_0x566672);})[_0xe315('0x16')](function(_0x249386){logger['error'](_0xe315('0x17'),_0x249386[_0xe315('0x14')],_0x112821);_0x49f764(_0x2e5e24[_0xe315('0x12')](0x1f4,_0x249386[_0xe315('0x14')]));});});};exports[_0xe315('0x1e')]=function(_0x151940){var _0x426296=this;return new Promise(function(_0x10ac47,_0x959f7d){return db[_0xe315('0x18')][_0xe315('0x1f')](_0x151940[_0xe315('0x1a')],{'raw':_0x151940['options']?_0x151940['options'][_0xe315('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151940[_0xe315('0x1b')]?_0x151940[_0xe315('0x1b')][_0xe315('0x20')]||null:null,'attributes':_0x151940[_0xe315('0x1b')]?_0x151940['options'][_0xe315('0x21')]||null:null,'limit':_0x151940[_0xe315('0x1b')]?_0x151940[_0xe315('0x1b')][_0xe315('0x22')]||null:null})[_0xe315('0xc')](function(_0x29571d){logger[_0xe315('0xd')](_0xe315('0x1e'),_0x151940);logger[_0xe315('0x1d')](_0xe315('0x1e'),_0x151940,JSON[_0xe315('0x11')](_0x29571d));_0x10ac47(_0x29571d);})['catch'](function(_0x5e4a9f){logger[_0xe315('0x12')]('UpdateChatQueueReport',_0x5e4a9f[_0xe315('0x14')],_0x151940);_0x959f7d(_0x426296[_0xe315('0x12')](0x1f4,_0x5e4a9f['message']));});});}; \ No newline at end of file +var _0xba44=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','attributes','limit','catch','util','moment','bluebird'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xba44,0x189));var _0x4ba4=function(_0x4ec334,_0x32e7c6){_0x4ec334=_0x4ec334-0x0;var _0xa0ed5f=_0xba44[_0x4ec334];return _0xa0ed5f;};'use strict';var _=require('lodash');var util=require(_0x4ba4('0x0'));var moment=require(_0x4ba4('0x1'));var BPromise=require(_0x4ba4('0x2'));var rs=require(_0x4ba4('0x3'));var fs=require('fs');var Redis=require(_0x4ba4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba4('0x5'))(_0x4ba4('0x6'));var config=require(_0x4ba4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ba4('0x8')][_0x4ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29e36b,_0xcabb3f,_0x12da47){return new BPromise(function(_0x33c00b,_0x2a54b7){return client[_0x4ba4('0xa')](_0x29e36b,_0x12da47)[_0x4ba4('0xb')](function(_0x47a2ed){logger[_0x4ba4('0xc')](_0x4ba4('0xd'),_0xcabb3f,_0x4ba4('0xe'));logger[_0x4ba4('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xcabb3f,_0x4ba4('0xe'),JSON[_0x4ba4('0x10')](_0x47a2ed));if(_0x47a2ed[_0x4ba4('0x11')]){if(_0x47a2ed[_0x4ba4('0x11')][_0x4ba4('0x12')]===0x1f4){logger['error'](_0x4ba4('0xd'),_0xcabb3f,_0x47a2ed[_0x4ba4('0x11')]['message']);return _0x2a54b7(_0x47a2ed[_0x4ba4('0x11')][_0x4ba4('0x13')]);}logger[_0x4ba4('0x11')](_0x4ba4('0xd'),_0xcabb3f,_0x47a2ed[_0x4ba4('0x11')][_0x4ba4('0x13')]);return _0x33c00b(_0x47a2ed['error']['message']);}else{logger[_0x4ba4('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0xcabb3f,'request\x20sent');_0x33c00b(_0x47a2ed[_0x4ba4('0x14')][_0x4ba4('0x13')]);}})['catch'](function(_0xc2e13){logger[_0x4ba4('0x11')](_0x4ba4('0xd'),_0xcabb3f,_0xc2e13);_0x2a54b7(_0xc2e13);});});}exports[_0x4ba4('0x15')]=function(_0x262e1e){var _0x360764=this;return new Promise(function(_0x449635,_0x2fc10e){return db[_0x4ba4('0x16')][_0x4ba4('0x17')](_0x262e1e[_0x4ba4('0x18')],{'raw':_0x262e1e[_0x4ba4('0x19')]?_0x262e1e[_0x4ba4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4ba4('0xb')](function(_0x5d960a){logger[_0x4ba4('0xc')](_0x4ba4('0x15'),_0x262e1e);logger[_0x4ba4('0xf')]('CreateChatQueueReport',_0x262e1e,JSON[_0x4ba4('0x10')](_0x5d960a));_0x449635(_0x5d960a);})['catch'](function(_0x28a89b){logger[_0x4ba4('0x11')](_0x4ba4('0x15'),_0x28a89b[_0x4ba4('0x13')],_0x262e1e);_0x2fc10e(_0x360764[_0x4ba4('0x11')](0x1f4,_0x28a89b[_0x4ba4('0x13')]));});});};exports[_0x4ba4('0x1a')]=function(_0x34eb84){var _0xe28cb0=this;return new Promise(function(_0x42e0fd,_0x53d1dd){return db['ChatQueueReport'][_0x4ba4('0x1b')](_0x34eb84[_0x4ba4('0x18')],{'raw':_0x34eb84['options']?_0x34eb84['options'][_0x4ba4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34eb84['options']?_0x34eb84[_0x4ba4('0x19')][_0x4ba4('0x1d')]||null:null,'attributes':_0x34eb84[_0x4ba4('0x19')]?_0x34eb84[_0x4ba4('0x19')][_0x4ba4('0x1e')]||null:null,'limit':_0x34eb84[_0x4ba4('0x19')]?_0x34eb84['options'][_0x4ba4('0x1f')]||null:null})[_0x4ba4('0xb')](function(_0x1babc1){logger[_0x4ba4('0xc')](_0x4ba4('0x1a'),_0x34eb84);logger[_0x4ba4('0xf')](_0x4ba4('0x1a'),_0x34eb84,JSON[_0x4ba4('0x10')](_0x1babc1));_0x42e0fd(_0x1babc1);})[_0x4ba4('0x20')](function(_0x305f08){logger[_0x4ba4('0x11')](_0x4ba4('0x1a'),_0x305f08[_0x4ba4('0x13')],_0x34eb84);_0x53d1dd(_0xe28cb0[_0x4ba4('0x11')](0x1f4,_0x305f08[_0x4ba4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5db3d93..4a2fed4 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 _0xb95e=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x306698,_0x20c637){var _0x4bcae4=function(_0x367a31){while(--_0x367a31){_0x306698['push'](_0x306698['shift']());}};_0x4bcae4(++_0x20c637);}(_0xb95e,0xf5));var _0xeb95=function(_0x39a70a,_0xb0a23c){_0x39a70a=_0x39a70a-0x0;var _0x356be6=_0xb95e[_0x39a70a];return _0x356be6;};'use strict';var multer=require(_0xeb95('0x0'));var util=require(_0xeb95('0x1'));var path=require(_0xeb95('0x2'));var timeout=require(_0xeb95('0x3'));var express=require('express');var router=express[_0xeb95('0x4')]();var fs_extra=require(_0xeb95('0x5'));var auth=require(_0xeb95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb95('0x7'));var controller=require(_0xeb95('0x8'));router['get']('/',auth[_0xeb95('0x9')](),controller[_0xeb95('0xa')]);router[_0xeb95('0xb')](_0xeb95('0xc'),auth[_0xeb95('0x9')](),controller[_0xeb95('0xd')]);router[_0xeb95('0xb')](_0xeb95('0xe'),auth[_0xeb95('0x9')](),controller[_0xeb95('0xf')]);router[_0xeb95('0x10')]('/',auth[_0xeb95('0x9')](),controller[_0xeb95('0x11')]);router[_0xeb95('0x12')]('/:id',auth[_0xeb95('0x9')](),controller[_0xeb95('0x13')]);router[_0xeb95('0x14')](_0xeb95('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb95('0x15')]=router; \ No newline at end of file +var _0xbb30=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','post','put','delete','exports','multer'];(function(_0x359e4f,_0x25efbe){var _0x3d0d31=function(_0x5b9420){while(--_0x5b9420){_0x359e4f['push'](_0x359e4f['shift']());}};_0x3d0d31(++_0x25efbe);}(_0xbb30,0x8f));var _0x0bb3=function(_0x3a03cf,_0xf70834){_0x3a03cf=_0x3a03cf-0x0;var _0x2e943c=_0xbb30[_0x3a03cf];return _0x2e943c;};'use strict';var multer=require(_0x0bb3('0x0'));var util=require('util');var path=require(_0x0bb3('0x1'));var timeout=require(_0x0bb3('0x2'));var express=require('express');var router=express[_0x0bb3('0x3')]();var fs_extra=require(_0x0bb3('0x4'));var auth=require(_0x0bb3('0x5'));var interaction=require(_0x0bb3('0x6'));var config=require(_0x0bb3('0x7'));var controller=require(_0x0bb3('0x8'));router[_0x0bb3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x0bb3('0xa')](),controller[_0x0bb3('0xb')]);router[_0x0bb3('0x9')]('/:id',auth[_0x0bb3('0xa')](),controller['show']);router[_0x0bb3('0xc')]('/',auth[_0x0bb3('0xa')](),controller['create']);router[_0x0bb3('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0bb3('0xe')]('/:id',auth[_0x0bb3('0xa')](),controller['destroy']);module[_0x0bb3('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8cd8b4b..97eba34 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x34e8,0x12c));var _0x834e=function(_0x55567c,_0x393abe){_0x55567c=_0x55567c-0x0;var _0x259f31=_0x34e8[_0x55567c];return _0x259f31;};'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 +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x376256,_0x3d2caa){var _0x39b953=function(_0x57008e){while(--_0x57008e){_0x376256['push'](_0x376256['shift']());}};_0x39b953(++_0x3d2caa);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2dc53b,_0x29b63f){_0x2dc53b=_0x2dc53b-0x0;var _0x1083f8=_0xf4eb[_0x2dc53b];return _0x1083f8;};'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 d5612e0..ba0d790 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 _0xe77e=['set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatTransferReport','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xe77e,0xc4));var _0xee77=function(_0x3bfb60,_0x176e88){_0x3bfb60=_0x3bfb60-0x0;var _0x2a4ef3=_0xe77e[_0x3bfb60];return _0x2a4ef3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee77('0x0'));var zipdir=require(_0xee77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee77('0x2'));var moment=require(_0xee77('0x3'));var BPromise=require(_0xee77('0x4'));var Mustache=require(_0xee77('0x5'));var util=require(_0xee77('0x6'));var path=require(_0xee77('0x7'));var sox=require(_0xee77('0x8'));var csv=require(_0xee77('0x9'));var ejs=require(_0xee77('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xee77('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xee77('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee77('0xd'));var Redis=require(_0xee77('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xee77('0xf'));var as=require(_0xee77('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee77('0x11'))(_0xee77('0x12'));var utils=require(_0xee77('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee77('0x14'));var db=require(_0xee77('0x15'))['db'];function respondWithStatusCode(_0x4cf31d,_0x375c30){_0x375c30=_0x375c30||0xcc;return function(_0x3bf2b9){if(_0x3bf2b9){return _0x4cf31d[_0xee77('0x16')](_0x375c30);}return _0x4cf31d[_0xee77('0x17')](_0x375c30)['end']();};}function respondWithResult(_0x2cc0cf,_0x240b9a){_0x240b9a=_0x240b9a||0xc8;return function(_0x2373b2){if(_0x2373b2){return _0x2cc0cf[_0xee77('0x17')](_0x240b9a)[_0xee77('0x18')](_0x2373b2);}};}function respondWithFilteredResult(_0x368741,_0x5c6a02){return function(_0x117e06){if(_0x117e06){var _0x384c00=typeof _0x5c6a02[_0xee77('0x19')]===_0xee77('0x1a')&&typeof _0x5c6a02[_0xee77('0x1b')]==='undefined';var _0x253ac3=_0x117e06[_0xee77('0x1c')];var _0x39bbd2=_0x384c00?0x0:_0x5c6a02[_0xee77('0x19')];var _0x10f837=_0x384c00?_0x117e06['count']:_0x5c6a02[_0xee77('0x19')]+_0x5c6a02[_0xee77('0x1b')];var _0x30edfe;if(_0x10f837>=_0x253ac3){_0x10f837=_0x253ac3;_0x30edfe=0xc8;}else{_0x30edfe=0xce;}_0x368741['status'](_0x30edfe);return _0x368741[_0xee77('0x1d')](_0xee77('0x1e'),_0x39bbd2+'-'+_0x10f837+'/'+_0x253ac3)[_0xee77('0x18')](_0x117e06);}return null;};}function patchUpdates(_0x1d4227){return function(_0x1e518f){try{jsonpatch[_0xee77('0x1f')](_0x1e518f,_0x1d4227,!![]);}catch(_0x1ab640){return BPromise[_0xee77('0x20')](_0x1ab640);}return _0x1e518f[_0xee77('0x21')]();};}function saveUpdates(_0x4c45fe,_0x315421){return function(_0xc0ea04){if(_0xc0ea04){return _0xc0ea04[_0xee77('0x22')](_0x4c45fe)[_0xee77('0x23')](function(_0x49f11b){return _0x49f11b;});}return null;};}function removeEntity(_0x5d1faf,_0xa40dad){return function(_0x1ba5f0){if(_0x1ba5f0){return _0x1ba5f0[_0xee77('0x24')]()[_0xee77('0x23')](function(){_0x5d1faf[_0xee77('0x17')](0xcc)[_0xee77('0x25')]();});}};}function handleEntityNotFound(_0x39248b,_0x589a1d){return function(_0x4bf852){if(!_0x4bf852){_0x39248b[_0xee77('0x16')](0x194);}return _0x4bf852;};}function handleError(_0x3a19bf,_0x3321fa){_0x3321fa=_0x3321fa||0x1f4;return function(_0x3e1138){logger[_0xee77('0x26')](_0x3e1138['stack']);if(_0x3e1138[_0xee77('0x27')]){delete _0x3e1138[_0xee77('0x27')];}_0x3a19bf[_0xee77('0x17')](_0x3321fa)['send'](_0x3e1138);};}exports[_0xee77('0x28')]=function(_0x1a8256,_0x737f40){var _0x2ec5d3={},_0x1d04fd={},_0xaa5b68={'count':0x0,'rows':[]};var _0x3974e7=_['map'](db['ChatTransferReport'][_0xee77('0x29')],function(_0x3c1207){return{'name':_0x3c1207[_0xee77('0x2a')],'type':_0x3c1207[_0xee77('0x2b')][_0xee77('0x2c')]};});_0x1d04fd[_0xee77('0x2d')]=_[_0xee77('0x2e')](_0x3974e7,_0xee77('0x27'));_0x1d04fd['query']=_[_0xee77('0x2f')](_0x1a8256['query']);_0x1d04fd[_0xee77('0x30')]=_['intersection'](_0x1d04fd[_0xee77('0x2d')],_0x1d04fd[_0xee77('0x31')]);_0x2ec5d3[_0xee77('0x32')]=_[_0xee77('0x33')](_0x1d04fd[_0xee77('0x2d')],qs[_0xee77('0x34')](_0x1a8256[_0xee77('0x31')]['fields']));_0x2ec5d3['attributes']=_0x2ec5d3['attributes'][_0xee77('0x35')]?_0x2ec5d3[_0xee77('0x32')]:_0x1d04fd[_0xee77('0x2d')];if(!_0x1a8256['query'][_0xee77('0x36')](_0xee77('0x37'))){_0x2ec5d3[_0xee77('0x1b')]=qs[_0xee77('0x1b')](_0x1a8256[_0xee77('0x31')]['limit']);_0x2ec5d3[_0xee77('0x19')]=qs[_0xee77('0x19')](_0x1a8256[_0xee77('0x31')][_0xee77('0x19')]);}_0x2ec5d3[_0xee77('0x38')]=qs[_0xee77('0x39')](_0x1a8256[_0xee77('0x31')][_0xee77('0x39')]);_0x2ec5d3[_0xee77('0x3a')]=qs[_0xee77('0x30')](_[_0xee77('0x3b')](_0x1a8256['query'],_0x1d04fd['filters']),_0x3974e7);if(_0x1a8256[_0xee77('0x31')][_0xee77('0x3c')]){_0x2ec5d3[_0xee77('0x3a')]=_[_0xee77('0x3d')](_0x2ec5d3[_0xee77('0x3a')],{'$or':_[_0xee77('0x2e')](_0x3974e7,function(_0x16bca7){if(_0x16bca7['type']!==_0xee77('0x3e')){var _0x4c280f={};_0x4c280f[_0x16bca7[_0xee77('0x27')]]={'$like':'%'+_0x1a8256['query'][_0xee77('0x3c')]+'%'};return _0x4c280f;}})});}_0x2ec5d3=_[_0xee77('0x3d')]({},_0x2ec5d3,_0x1a8256['options']);var _0x5a7524={'where':_0x2ec5d3[_0xee77('0x3a')]};return db[_0xee77('0x3f')][_0xee77('0x1c')](_0x5a7524)['then'](function(_0x5a80df){_0xaa5b68[_0xee77('0x1c')]=_0x5a80df;if(_0x1a8256[_0xee77('0x31')][_0xee77('0x40')]){_0x2ec5d3[_0xee77('0x41')]=[{'all':!![]}];}return db[_0xee77('0x3f')][_0xee77('0x42')](_0x2ec5d3);})[_0xee77('0x23')](function(_0x3663fd){_0xaa5b68[_0xee77('0x43')]=_0x3663fd;return _0xaa5b68;})[_0xee77('0x23')](respondWithFilteredResult(_0x737f40,_0x2ec5d3))[_0xee77('0x44')](handleError(_0x737f40,null));};exports['show']=function(_0xe989ab,_0x4d9569){var _0x42946d={'raw':!![],'where':{'id':_0xe989ab[_0xee77('0x45')]['id']}},_0x41b86f={};_0x41b86f[_0xee77('0x2d')]=_[_0xee77('0x2f')](db['ChatTransferReport'][_0xee77('0x29')]);_0x41b86f[_0xee77('0x31')]=_['keys'](_0xe989ab[_0xee77('0x31')]);_0x41b86f[_0xee77('0x30')]=_[_0xee77('0x33')](_0x41b86f[_0xee77('0x2d')],_0x41b86f[_0xee77('0x31')]);_0x42946d[_0xee77('0x32')]=_[_0xee77('0x33')](_0x41b86f[_0xee77('0x2d')],qs['fields'](_0xe989ab[_0xee77('0x31')][_0xee77('0x34')]));_0x42946d[_0xee77('0x32')]=_0x42946d[_0xee77('0x32')][_0xee77('0x35')]?_0x42946d[_0xee77('0x32')]:_0x41b86f[_0xee77('0x2d')];if(_0xe989ab[_0xee77('0x31')]['includeAll']){_0x42946d[_0xee77('0x41')]=[{'all':!![]}];}_0x42946d=_[_0xee77('0x3d')]({},_0x42946d,_0xe989ab[_0xee77('0x46')]);return db[_0xee77('0x3f')][_0xee77('0x47')](_0x42946d)[_0xee77('0x23')](handleEntityNotFound(_0x4d9569,null))[_0xee77('0x23')](respondWithResult(_0x4d9569,null))[_0xee77('0x44')](handleError(_0x4d9569,null));};exports[_0xee77('0x48')]=function(_0x39c4f5,_0x15a4cc){return db[_0xee77('0x3f')][_0xee77('0x48')](_0x39c4f5[_0xee77('0x49')],{})[_0xee77('0x23')](respondWithResult(_0x15a4cc,0xc9))[_0xee77('0x44')](handleError(_0x15a4cc,null));};exports[_0xee77('0x22')]=function(_0x505f3c,_0x22d15b){if(_0x505f3c[_0xee77('0x49')]['id']){delete _0x505f3c[_0xee77('0x49')]['id'];}return db[_0xee77('0x3f')][_0xee77('0x47')]({'where':{'id':_0x505f3c[_0xee77('0x45')]['id']}})['then'](handleEntityNotFound(_0x22d15b,null))[_0xee77('0x23')](saveUpdates(_0x505f3c[_0xee77('0x49')],null))[_0xee77('0x23')](respondWithResult(_0x22d15b,null))[_0xee77('0x44')](handleError(_0x22d15b,null));};exports[_0xee77('0x24')]=function(_0x5d32c3,_0x58fa51){return db['ChatTransferReport']['find']({'where':{'id':_0x5d32c3['params']['id']}})[_0xee77('0x23')](handleEntityNotFound(_0x58fa51,null))[_0xee77('0x23')](removeEntity(_0x58fa51,null))[_0xee77('0x44')](handleError(_0x58fa51,null));};exports[_0xee77('0x4a')]=function(_0x538418,_0x528050){return db[_0xee77('0x3f')][_0xee77('0x4a')]()['then'](respondWithResult(_0x528050,null))[_0xee77('0x44')](handleError(_0x528050,null));}; \ No newline at end of file +var _0x93ac=['mustache','util','path','sox','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','save','update','then','destroy','send','index','map','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x37baaf,_0xfe26d){var _0x2abbf0=function(_0x2a379b){while(--_0x2a379b){_0x37baaf['push'](_0x37baaf['shift']());}};_0x2abbf0(++_0xfe26d);}(_0x93ac,0x15d));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc93a('0x0'));var zipdir=require(_0xc93a('0x1'));var jsonpatch=require(_0xc93a('0x2'));var rp=require(_0xc93a('0x3'));var moment=require(_0xc93a('0x4'));var BPromise=require(_0xc93a('0x5'));var Mustache=require(_0xc93a('0x6'));var util=require(_0xc93a('0x7'));var path=require(_0xc93a('0x8'));var sox=require(_0xc93a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc93a('0xa'));var _=require('lodash');var squel=require(_0xc93a('0xb'));var crypto=require(_0xc93a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc93a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc93a('0xe'));var Papa=require(_0xc93a('0xf'));var Redis=require(_0xc93a('0x10'));var authService=require(_0xc93a('0x11'));var qs=require(_0xc93a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc93a('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc93a('0x14'));var licenseUtil=require(_0xc93a('0x15'));var db=require(_0xc93a('0x16'))['db'];function respondWithStatusCode(_0x1640d,_0x8f0bc1){_0x8f0bc1=_0x8f0bc1||0xcc;return function(_0x3c1f91){if(_0x3c1f91){return _0x1640d[_0xc93a('0x17')](_0x8f0bc1);}return _0x1640d[_0xc93a('0x18')](_0x8f0bc1)[_0xc93a('0x19')]();};}function respondWithResult(_0x326ed6,_0x16a7e2){_0x16a7e2=_0x16a7e2||0xc8;return function(_0x4f9d3b){if(_0x4f9d3b){return _0x326ed6[_0xc93a('0x18')](_0x16a7e2)['json'](_0x4f9d3b);}};}function respondWithFilteredResult(_0x1443bc,_0x3d512e){return function(_0x735098){if(_0x735098){var _0x55d927=typeof _0x3d512e['offset']==='undefined'&&typeof _0x3d512e[_0xc93a('0x1a')]===_0xc93a('0x1b');var _0x3ee21a=_0x735098['count'];var _0x43d092=_0x55d927?0x0:_0x3d512e[_0xc93a('0x1c')];var _0x297fce=_0x55d927?_0x735098[_0xc93a('0x1d')]:_0x3d512e[_0xc93a('0x1c')]+_0x3d512e[_0xc93a('0x1a')];var _0x4de28d;if(_0x297fce>=_0x3ee21a){_0x297fce=_0x3ee21a;_0x4de28d=0xc8;}else{_0x4de28d=0xce;}_0x1443bc[_0xc93a('0x18')](_0x4de28d);return _0x1443bc[_0xc93a('0x1e')](_0xc93a('0x1f'),_0x43d092+'-'+_0x297fce+'/'+_0x3ee21a)[_0xc93a('0x20')](_0x735098);}return null;};}function patchUpdates(_0xe135b6){return function(_0x20c4a8){try{jsonpatch['apply'](_0x20c4a8,_0xe135b6,!![]);}catch(_0x251712){return BPromise['reject'](_0x251712);}return _0x20c4a8[_0xc93a('0x21')]();};}function saveUpdates(_0x586e87,_0x5d3fb7){return function(_0xa98ec8){if(_0xa98ec8){return _0xa98ec8[_0xc93a('0x22')](_0x586e87)[_0xc93a('0x23')](function(_0x37b589){return _0x37b589;});}return null;};}function removeEntity(_0x548085,_0x4a3c41){return function(_0x14e578){if(_0x14e578){return _0x14e578[_0xc93a('0x24')]()[_0xc93a('0x23')](function(){_0x548085[_0xc93a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x330c45,_0x5d244a){return function(_0x40ccd7){if(!_0x40ccd7){_0x330c45['sendStatus'](0x194);}return _0x40ccd7;};}function handleError(_0x313e24,_0x7ff074){_0x7ff074=_0x7ff074||0x1f4;return function(_0x41a441){logger['error'](_0x41a441['stack']);if(_0x41a441['name']){delete _0x41a441['name'];}_0x313e24[_0xc93a('0x18')](_0x7ff074)[_0xc93a('0x25')](_0x41a441);};}exports[_0xc93a('0x26')]=function(_0x558265,_0x1b7346){var _0x2f6557={},_0x1e77d9={},_0x308c45={'count':0x0,'rows':[]};var _0xf0ccae=_[_0xc93a('0x27')](db['ChatTransferReport'][_0xc93a('0x28')],function(_0x428390){return{'name':_0x428390[_0xc93a('0x29')],'type':_0x428390[_0xc93a('0x2a')]['key']};});_0x1e77d9[_0xc93a('0x2b')]=_[_0xc93a('0x27')](_0xf0ccae,_0xc93a('0x2c'));_0x1e77d9[_0xc93a('0x2d')]=_['keys'](_0x558265[_0xc93a('0x2d')]);_0x1e77d9[_0xc93a('0x2e')]=_[_0xc93a('0x2f')](_0x1e77d9[_0xc93a('0x2b')],_0x1e77d9[_0xc93a('0x2d')]);_0x2f6557[_0xc93a('0x30')]=_[_0xc93a('0x2f')](_0x1e77d9[_0xc93a('0x2b')],qs['fields'](_0x558265[_0xc93a('0x2d')][_0xc93a('0x31')]));_0x2f6557['attributes']=_0x2f6557[_0xc93a('0x30')][_0xc93a('0x32')]?_0x2f6557[_0xc93a('0x30')]:_0x1e77d9[_0xc93a('0x2b')];if(!_0x558265[_0xc93a('0x2d')]['hasOwnProperty']('nolimit')){_0x2f6557[_0xc93a('0x1a')]=qs[_0xc93a('0x1a')](_0x558265[_0xc93a('0x2d')]['limit']);_0x2f6557[_0xc93a('0x1c')]=qs[_0xc93a('0x1c')](_0x558265[_0xc93a('0x2d')][_0xc93a('0x1c')]);}_0x2f6557[_0xc93a('0x33')]=qs['sort'](_0x558265['query'][_0xc93a('0x34')]);_0x2f6557[_0xc93a('0x35')]=qs[_0xc93a('0x2e')](_[_0xc93a('0x36')](_0x558265[_0xc93a('0x2d')],_0x1e77d9[_0xc93a('0x2e')]),_0xf0ccae);if(_0x558265['query'][_0xc93a('0x37')]){_0x2f6557[_0xc93a('0x35')]=_[_0xc93a('0x38')](_0x2f6557[_0xc93a('0x35')],{'$or':_[_0xc93a('0x27')](_0xf0ccae,function(_0x80a241){if(_0x80a241[_0xc93a('0x2a')]!==_0xc93a('0x39')){var _0x1609ca={};_0x1609ca[_0x80a241['name']]={'$like':'%'+_0x558265[_0xc93a('0x2d')][_0xc93a('0x37')]+'%'};return _0x1609ca;}})});}_0x2f6557=_[_0xc93a('0x38')]({},_0x2f6557,_0x558265[_0xc93a('0x3a')]);var _0x5e07ac={'where':_0x2f6557[_0xc93a('0x35')]};return db[_0xc93a('0x3b')][_0xc93a('0x1d')](_0x5e07ac)[_0xc93a('0x23')](function(_0x3b6aa9){_0x308c45[_0xc93a('0x1d')]=_0x3b6aa9;if(_0x558265[_0xc93a('0x2d')][_0xc93a('0x3c')]){_0x2f6557[_0xc93a('0x3d')]=[{'all':!![]}];}return db[_0xc93a('0x3b')][_0xc93a('0x3e')](_0x2f6557);})[_0xc93a('0x23')](function(_0x1ae442){_0x308c45['rows']=_0x1ae442;return _0x308c45;})[_0xc93a('0x23')](respondWithFilteredResult(_0x1b7346,_0x2f6557))[_0xc93a('0x3f')](handleError(_0x1b7346,null));};exports[_0xc93a('0x40')]=function(_0x21c32c,_0xccd9b0){var _0x1ea47e={'raw':!![],'where':{'id':_0x21c32c['params']['id']}},_0x176a55={};_0x176a55[_0xc93a('0x2b')]=_[_0xc93a('0x41')](db[_0xc93a('0x3b')][_0xc93a('0x28')]);_0x176a55['query']=_['keys'](_0x21c32c['query']);_0x176a55[_0xc93a('0x2e')]=_[_0xc93a('0x2f')](_0x176a55['model'],_0x176a55[_0xc93a('0x2d')]);_0x1ea47e[_0xc93a('0x30')]=_[_0xc93a('0x2f')](_0x176a55['model'],qs[_0xc93a('0x31')](_0x21c32c[_0xc93a('0x2d')][_0xc93a('0x31')]));_0x1ea47e[_0xc93a('0x30')]=_0x1ea47e[_0xc93a('0x30')]['length']?_0x1ea47e['attributes']:_0x176a55[_0xc93a('0x2b')];if(_0x21c32c[_0xc93a('0x2d')][_0xc93a('0x3c')]){_0x1ea47e[_0xc93a('0x3d')]=[{'all':!![]}];}_0x1ea47e=_['merge']({},_0x1ea47e,_0x21c32c[_0xc93a('0x3a')]);return db[_0xc93a('0x3b')]['find'](_0x1ea47e)[_0xc93a('0x23')](handleEntityNotFound(_0xccd9b0,null))[_0xc93a('0x23')](respondWithResult(_0xccd9b0,null))[_0xc93a('0x3f')](handleError(_0xccd9b0,null));};exports[_0xc93a('0x42')]=function(_0x5757b1,_0xa4e464){return db[_0xc93a('0x3b')][_0xc93a('0x42')](_0x5757b1[_0xc93a('0x43')],{})[_0xc93a('0x23')](respondWithResult(_0xa4e464,0xc9))[_0xc93a('0x3f')](handleError(_0xa4e464,null));};exports['update']=function(_0x2df92d,_0x23f833){if(_0x2df92d[_0xc93a('0x43')]['id']){delete _0x2df92d[_0xc93a('0x43')]['id'];}return db[_0xc93a('0x3b')][_0xc93a('0x44')]({'where':{'id':_0x2df92d[_0xc93a('0x45')]['id']}})[_0xc93a('0x23')](handleEntityNotFound(_0x23f833,null))[_0xc93a('0x23')](saveUpdates(_0x2df92d[_0xc93a('0x43')],null))[_0xc93a('0x23')](respondWithResult(_0x23f833,null))[_0xc93a('0x3f')](handleError(_0x23f833,null));};exports['destroy']=function(_0x17b2bd,_0x458c1a){return db[_0xc93a('0x3b')][_0xc93a('0x44')]({'where':{'id':_0x17b2bd[_0xc93a('0x45')]['id']}})[_0xc93a('0x23')](handleEntityNotFound(_0x458c1a,null))[_0xc93a('0x23')](removeEntity(_0x458c1a,null))['catch'](handleError(_0x458c1a,null));};exports[_0xc93a('0x46')]=function(_0x498fd8,_0xeb536c){return db[_0xc93a('0x3b')][_0xc93a('0x46')]()['then'](respondWithResult(_0xeb536c,null))[_0xc93a('0x3f')](handleError(_0xeb536c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6ddcae3..4af0b61 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 _0xd055=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x4c59c2,_0x4c5d26){var _0x4c3a33=function(_0x27bfc7){while(--_0x27bfc7){_0x4c59c2['push'](_0x4c59c2['shift']());}};_0x4c3a33(++_0x4c5d26);}(_0xd055,0x1af));var _0x5d05=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0xd055[_0x1c470d];return _0x12141b;};'use strict';var _=require(_0x5d05('0x0'));var util=require(_0x5d05('0x1'));var logger=require(_0x5d05('0x2'))(_0x5d05('0x3'));var moment=require(_0x5d05('0x4'));var BPromise=require(_0x5d05('0x5'));var rp=require(_0x5d05('0x6'));var fs=require('fs');var path=require(_0x5d05('0x7'));var rimraf=require(_0x5d05('0x8'));var config=require(_0x5d05('0x9'));var attributes=require(_0x5d05('0xa'));module[_0x5d05('0xb')]=function(_0x34366d,_0x2d4152){return _0x34366d[_0x5d05('0xc')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x5d05('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2b4=['ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','exports','define'];(function(_0x28198f,_0x4b1fb8){var _0x5eef0a=function(_0x26929a){while(--_0x26929a){_0x28198f['push'](_0x28198f['shift']());}};_0x5eef0a(++_0x4b1fb8);}(_0xa2b4,0xfc));var _0x4a2b=function(_0x10afad,_0x30da9d){_0x10afad=_0x10afad-0x0;var _0x588d7e=_0xa2b4[_0x10afad];return _0x588d7e;};'use strict';var _=require(_0x4a2b('0x0'));var util=require(_0x4a2b('0x1'));var logger=require(_0x4a2b('0x2'))(_0x4a2b('0x3'));var moment=require(_0x4a2b('0x4'));var BPromise=require('bluebird');var rp=require(_0x4a2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x4a2b('0x6')]=function(_0x856106,_0x3c14c2){return _0x856106[_0x4a2b('0x7')](_0x4a2b('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4a2b('0x9'),'fields':[_0x4a2b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 2b39303..b1fc381 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 _0x7b2d=['jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1397f1,_0x1498e2){var _0x1a47fb=function(_0x1c2265){while(--_0x1c2265){_0x1397f1['push'](_0x1397f1['shift']());}};_0x1a47fb(++_0x1498e2);}(_0x7b2d,0x81));var _0xd7b2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7b2d[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xd7b2('0x0'));var moment=require(_0xd7b2('0x1'));var BPromise=require(_0xd7b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7b2('0x3'));var db=require(_0xd7b2('0x4'))['db'];var utils=require(_0xd7b2('0x5'));var logger=require(_0xd7b2('0x6'))(_0xd7b2('0x7'));var config=require(_0xd7b2('0x8'));var jayson=require(_0xd7b2('0x9'));var client=jayson[_0xd7b2('0xa')][_0xd7b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d2beb,_0x4a2c1d,_0x583642){return new BPromise(function(_0x3ddc11,_0x5a9158){return client[_0xd7b2('0xc')](_0x2d2beb,_0x583642)[_0xd7b2('0xd')](function(_0x1acd73){logger[_0xd7b2('0xe')](_0xd7b2('0xf'),_0x4a2c1d,'request\x20sent');logger['debug'](_0xd7b2('0x10'),_0x4a2c1d,'request\x20sent',JSON[_0xd7b2('0x11')](_0x1acd73));if(_0x1acd73['error']){if(_0x1acd73[_0xd7b2('0x12')][_0xd7b2('0x13')]===0x1f4){logger['error'](_0xd7b2('0xf'),_0x4a2c1d,_0x1acd73[_0xd7b2('0x12')][_0xd7b2('0x14')]);return _0x5a9158(_0x1acd73['error']['message']);}logger[_0xd7b2('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x4a2c1d,_0x1acd73[_0xd7b2('0x12')][_0xd7b2('0x14')]);return _0x3ddc11(_0x1acd73['error']['message']);}else{logger[_0xd7b2('0xe')](_0xd7b2('0xf'),_0x4a2c1d,_0xd7b2('0x15'));_0x3ddc11(_0x1acd73['result'][_0xd7b2('0x14')]);}})[_0xd7b2('0x16')](function(_0x1443fb){logger[_0xd7b2('0x12')](_0xd7b2('0xf'),_0x4a2c1d,_0x1443fb);_0x5a9158(_0x1443fb);});});} \ No newline at end of file +var _0x85a3=['info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x85a3,0x13a));var _0x385a=function(_0x413b15,_0x5bb73f){_0x413b15=_0x413b15-0x0;var _0x1debc7=_0x85a3[_0x413b15];return _0x1debc7;};'use strict';var _=require(_0x385a('0x0'));var util=require(_0x385a('0x1'));var moment=require(_0x385a('0x2'));var BPromise=require(_0x385a('0x3'));var rs=require(_0x385a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x385a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x385a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x385a('0x7')][_0x385a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5911be,_0x23e436,_0x271dd1){return new BPromise(function(_0x6d1790,_0x533153){return client['request'](_0x5911be,_0x271dd1)['then'](function(_0x50bfdf){logger[_0x385a('0x9')](_0x385a('0xa'),_0x23e436,'request\x20sent');logger[_0x385a('0xb')](_0x385a('0xc'),_0x23e436,'request\x20sent',JSON[_0x385a('0xd')](_0x50bfdf));if(_0x50bfdf[_0x385a('0xe')]){if(_0x50bfdf[_0x385a('0xe')][_0x385a('0xf')]===0x1f4){logger[_0x385a('0xe')](_0x385a('0xa'),_0x23e436,_0x50bfdf['error'][_0x385a('0x10')]);return _0x533153(_0x50bfdf[_0x385a('0xe')][_0x385a('0x10')]);}logger[_0x385a('0xe')](_0x385a('0xa'),_0x23e436,_0x50bfdf['error']['message']);return _0x6d1790(_0x50bfdf[_0x385a('0xe')][_0x385a('0x10')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x23e436,_0x385a('0x11'));_0x6d1790(_0x50bfdf[_0x385a('0x12')][_0x385a('0x10')]);}})['catch'](function(_0x3b4bad){logger[_0x385a('0xe')](_0x385a('0xa'),_0x23e436,_0x3b4bad);_0x533153(_0x3b4bad);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 186462f..829abe3 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 _0x346d=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x346d,0x85));var _0xd346=function(_0x56fc4f,_0xd1f6a){_0x56fc4f=_0x56fc4f-0x0;var _0x5d0c0b=_0x346d[_0x56fc4f];return _0x5d0c0b;};'use strict';var multer=require(_0xd346('0x0'));var util=require(_0xd346('0x1'));var path=require(_0xd346('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd346('0x3')]();var fs_extra=require(_0xd346('0x4'));var auth=require(_0xd346('0x5'));var interaction=require(_0xd346('0x6'));var config=require(_0xd346('0x7'));var controller=require(_0xd346('0x8'));router[_0xd346('0x9')]('/',auth['isAuthenticated'](),controller[_0xd346('0xa')]);router[_0xd346('0x9')](_0xd346('0xb'),auth[_0xd346('0xc')](),controller[_0xd346('0xd')]);router[_0xd346('0x9')]('/:id',auth[_0xd346('0xc')](),controller[_0xd346('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd346('0xf')]);router[_0xd346('0x10')]('/:id',auth[_0xd346('0xc')](),controller[_0xd346('0x11')]);router[_0xd346('0x12')](_0xd346('0x13'),auth[_0xd346('0xc')](),controller[_0xd346('0x14')]);module[_0xd346('0x15')]=router; \ No newline at end of file +var _0xc43e=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x37d915,_0x4d8742){var _0x58e8b9=function(_0xdc5424){while(--_0xdc5424){_0x37d915['push'](_0x37d915['shift']());}};_0x58e8b9(++_0x4d8742);}(_0xc43e,0x1e8));var _0xec43=function(_0x23e100,_0x434387){_0x23e100=_0x23e100-0x0;var _0x58ed9a=_0xc43e[_0x23e100];return _0x58ed9a;};'use strict';var multer=require(_0xec43('0x0'));var util=require(_0xec43('0x1'));var path=require(_0xec43('0x2'));var timeout=require(_0xec43('0x3'));var express=require(_0xec43('0x4'));var router=express['Router']();var fs_extra=require(_0xec43('0x5'));var auth=require(_0xec43('0x6'));var interaction=require(_0xec43('0x7'));var config=require(_0xec43('0x8'));var controller=require(_0xec43('0x9'));router[_0xec43('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec43('0xa')](_0xec43('0xb'),auth['isAuthenticated'](),controller[_0xec43('0xc')]);router[_0xec43('0xa')](_0xec43('0xd'),auth[_0xec43('0xe')](),controller[_0xec43('0xf')]);router[_0xec43('0x10')]('/',auth[_0xec43('0xe')](),controller[_0xec43('0x11')]);router[_0xec43('0x12')](_0xec43('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xec43('0x13')](_0xec43('0xd'),auth[_0xec43('0xe')](),controller[_0xec43('0x14')]);module[_0xec43('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1a5604a..30019b0 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 _0xcd00=['input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','stringify'];(function(_0x1aaf85,_0x2eebaa){var _0x59ad1c=function(_0x338363){while(--_0x338363){_0x1aaf85['push'](_0x1aaf85['shift']());}};_0x59ad1c(++_0x2eebaa);}(_0xcd00,0x12f));var _0x0cd0=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xcd00[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x0cd0('0x0'));var rs=require(_0x0cd0('0x1'));module[_0x0cd0('0x2')]={'name':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x5')},'customerAlias':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0cd0('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0cd0('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0cd0('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0cd0('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0cd0('0xa')](_0x0cd0('0xb'),_0x0cd0('0xc')),'defaultValue':_0x0cd0('0xb')},'header_online':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0xd')},'start_chat_button':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0xe')},'offline_chat_button':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0x10')},'download_transcript':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0cd0('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0cd0('0x12')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0x15')},'placeholderMessage':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x16')},'closingMessage':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x17')},'closingMessageButton':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0xf')},'skipMessageButton':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x0cd0('0xa')](_0x0cd0('0x18'),_0x0cd0('0x19')),'defaultValue':_0x0cd0('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0cd0('0x12')],'defaultValue':function(){return JSON[_0x0cd0('0x1a')]({'items':[{'type':_0x0cd0('0x1b'),'variable':null,'config':{'placeholder':_0x0cd0('0x1c'),'type':_0x0cd0('0x1d'),'required':!![]},'props':{'title':_0x0cd0('0x1c'),'helpText':''}},{'type':_0x0cd0('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0cd0('0x4'),'type':_0x0cd0('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0cd0('0x1e')]('onlineForm')?JSON['parse'](this[_0x0cd0('0x1e')](_0x0cd0('0x1f'))):{};},'set':function(_0x5664cd){return this[_0x0cd0('0x20')](_0x0cd0('0x1f'),JSON['stringify'](_0x5664cd));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x0cd0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0cd0('0x4'),'type':'email'},'variable':null},{'type':_0x0cd0('0x21'),'config':{'placeholder':_0x0cd0('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0cd0('0x1e')](_0x0cd0('0x23'))?JSON[_0x0cd0('0x24')](this[_0x0cd0('0x1e')](_0x0cd0('0x23'))):{};},'set':function(_0x57f648){return this[_0x0cd0('0x20')](_0x0cd0('0x23'),JSON['stringify'](_0x57f648));}},'token':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':function(){return rs[_0x0cd0('0x25')]();}},'autoclose':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0cd0('0x3')]},'waitingTitle':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x26')},'waitingMessage':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0x29')},'skipUnmanaged':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x2a')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0cd0('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0cd0('0x2b');}},'notificationSound':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0cd0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0cd0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x0cd0('0x2e')},'messagesAlignment':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0cd0('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0cd0('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![],'defaultValue':_0x0cd0('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0cd0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0cd0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x30')},'systemAvatar':{'type':Sequelize[_0x0cd0('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0cd0('0x8')],'comment':_0x0cd0('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![],'comment':_0x0cd0('0x32'),'set':function(_0x46cdd3){if(!_0x46cdd3)this[_0x0cd0('0x20')](_0x0cd0('0x33'),null);this['setDataValue'](_0x0cd0('0x34'),_0x46cdd3);}},'vidaooEscalation':{'type':Sequelize[_0x0cd0('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0cd0('0x3')]},'vidaooTopic':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![],'defaultValue':_0x0cd0('0x35')},'vidaooNote':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':function(){return _0x0cd0('0x36');}},'vidaooMetadata':{'type':Sequelize[_0x0cd0('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0cd0('0x12')]}}; \ No newline at end of file +var _0xc06f=['#ffffff','INTEGER','rounded','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','stringify','input','name','text','onlineForm','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','TEXT','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','address','STRING','email','Agent','#011F6A'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc06f,0x13c));var _0xfc06=function(_0x443f0c,_0x2696a5){_0x443f0c=_0x443f0c-0x0;var _0x1090eb=_0xc06f[_0x443f0c];return _0x1090eb;};'use strict';var Sequelize=require(_0xfc06('0x0'));var rs=require(_0xfc06('0x1'));module[_0xfc06('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfc06('0x3')},'description':{'type':Sequelize[_0xfc06('0x4')]},'mapKey':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x5')},'mapKeyOffline':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x5')},'key':{'type':Sequelize[_0xfc06('0x4')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x6')},'customerAlias':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfc06('0x4')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfc06('0x4')],'allowNull':![],'defaultValue':_0xfc06('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xfc06('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xfc06('0x4')],'allowNull':![],'defaultValue':_0xfc06('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfc06('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xfc06('0xa'),'squared'),'defaultValue':_0xfc06('0xa')},'header_online':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0xb')},'start_chat_button':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0xc')},'header_offline':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0xd')},'download_transcript':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfc06('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xfc06('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xfc06('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x12')},'noteTitle':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x13')},'placeholderMessage':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x14')},'closingMessage':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xfc06('0xc')},'skipMessageButton':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x17')},'ratingType':{'type':Sequelize[_0xfc06('0x18')]('star','thumb'),'defaultValue':_0xfc06('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xfc06('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xfc06('0x1a')]({'items':[{'type':_0xfc06('0x1b'),'variable':null,'config':{'placeholder':_0xfc06('0x1c'),'type':_0xfc06('0x1d'),'required':!![]},'props':{'title':_0xfc06('0x1c'),'helpText':''}},{'type':_0xfc06('0x1b'),'props':{'title':_0xfc06('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xfc06('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xfc06('0x1e'))?JSON['parse'](this[_0xfc06('0x1f')](_0xfc06('0x1e'))):{};},'set':function(_0x19ea69){return this['setDataValue']('onlineForm',JSON[_0xfc06('0x1a')](_0x19ea69));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xfc06('0x1a')]({'items':[{'type':_0xfc06('0x1b'),'props':{'title':_0xfc06('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xfc06('0x5'),'type':_0xfc06('0x5')},'variable':null},{'type':_0xfc06('0x20'),'config':{'placeholder':_0xfc06('0x21')},'props':{'title':_0xfc06('0x21'),'helpText':_0xfc06('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xfc06('0x1f')](_0xfc06('0x23'))?JSON['parse'](this[_0xfc06('0x1f')](_0xfc06('0x23'))):{};},'set':function(_0x4d6b7b){return this[_0xfc06('0x24')](_0xfc06('0x23'),JSON[_0xfc06('0x1a')](_0x4d6b7b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfc06('0x4')]},'forwardOffline':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfc06('0x4')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xfc06('0x25')},'waitingMessage':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xfc06('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x29')},'skipUnmanaged':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x16')},'sendUnmanaged':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfc06('0x2a')]},'showAgentAvatar':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xfc06('0x4')]},'notificationTemplate':{'type':Sequelize[_0xfc06('0x2a')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfc06('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x2c')},'verticalAlignment':{'type':Sequelize[_0xfc06('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x2d')},'messagesAlignment':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':_0xfc06('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfc06('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfc06('0x4')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfc06('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfc06('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xfc06('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfc06('0x9')],'comment':_0xfc06('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xfc06('0xe')],'defaultValue':![],'comment':_0xfc06('0x31'),'set':function(_0x9c8728){if(!_0x9c8728)this[_0xfc06('0x24')](_0xfc06('0x32'),null);this['setDataValue'](_0xfc06('0x33'),_0x9c8728);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfc06('0x34')},'vidaooNote':{'type':Sequelize[_0xfc06('0x4')],'defaultValue':function(){return _0xfc06('0x35');}},'vidaooMetadata':{'type':Sequelize[_0xfc06('0x2a')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfc06('0xe')],'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 cdf0e74..c750ffa 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 _0xfa2b=['ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','defaults','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','toPairsIn','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag','getSnippet','Intervals','custom','License','increment','timezone','ifTime','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','virtual','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','json','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','spread','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','end','status','offset','undefined','limit','count','then','ChatWebsites','UserProfileResource','destroy','stack','name','setUA','user-agent','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','vendor','device','type','stringify','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','find','create','body','address','split','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','forEach','testWildcardValidity','Pause','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','nolimit','pick','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','addAvatar','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','notify','chat','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','DESC','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','Applications','priority','asc','List','ListId','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership'];(function(_0x1cb3bd,_0x26d60f){var _0xe19894=function(_0x5ee5a9){while(--_0x5ee5a9){_0x1cb3bd['push'](_0x1cb3bd['shift']());}};_0xe19894(++_0x26d60f);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0xd9bdf5,_0x40909f){_0xd9bdf5=_0xd9bdf5-0x0;var _0x3e0dc6=_0xfa2b[_0xd9bdf5];return _0x3e0dc6;};'use strict';var Mustache=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var path=require(_0xbfa2('0x2'));var ejs=require(_0xbfa2('0x3'));var fs=require('fs');var fs_extra=require(_0xbfa2('0x4'));var _=require(_0xbfa2('0x5'));var querystring=require(_0xbfa2('0x6'));var htmlToText=require(_0xbfa2('0x7'));var Redis=require(_0xbfa2('0x8'));var jayson=require(_0xbfa2('0x9'));var qs=require(_0xbfa2('0xa'));var logger=require(_0xbfa2('0xb'))(_0xbfa2('0xc'));var config=require(_0xbfa2('0xd'));var APIBadRequestError=require(_0xbfa2('0xe'))[_0xbfa2('0xf')];var APINotFoundError=require('../../errors/api')[_0xbfa2('0x10')];var APIOutOfIntervalError=require('../../errors/api')[_0xbfa2('0x11')];var APIHandleError=require(_0xbfa2('0xe'))[_0xbfa2('0x12')];var APIConflictError=require(_0xbfa2('0xe'))[_0xbfa2('0x13')];var wildcardUtils=require(_0xbfa2('0x14'));var URL=require(_0xbfa2('0x15'))[_0xbfa2('0x16')];var db=require(_0xbfa2('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xbfa2('0x18'),'port':0x18eb});var socket=require(_0xbfa2('0x19'))(new Redis(config[_0xbfa2('0x1a')]));require(_0xbfa2('0x1b'))[_0xbfa2('0x1c')](socket);var client=jayson[_0xbfa2('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xbfa2('0x1d')][_0xbfa2('0x1e')]({'port':0x232a});var client9003=jayson[_0xbfa2('0x1d')][_0xbfa2('0x1e')]({'port':0x232b});var client9001=jayson[_0xbfa2('0x1d')]['http']({'port':0x2329});function respondWithRpcPromise(_0xa988cc,_0x47db68,_0x5d3aa2,_0xee34b8){return new Promise(function(_0x55c9fe,_0x560190){var _0xab2c91=_0xee34b8||client;return _0xab2c91[_0xbfa2('0x1f')](_0xa988cc,_0x5d3aa2)['then'](function(_0xb9b6a3){logger[_0xbfa2('0x20')](_0xbfa2('0x21'),_0x47db68,_0xbfa2('0x22'));logger[_0xbfa2('0x23')](_0xbfa2('0x24'),_0x47db68,_0xbfa2('0x22'),JSON['stringify'](_0xb9b6a3));if(_0xb9b6a3[_0xbfa2('0x25')]){if(_0xb9b6a3[_0xbfa2('0x25')][_0xbfa2('0x26')]===0x1f4){logger['error'](_0xbfa2('0x21'),_0x47db68,_0xb9b6a3[_0xbfa2('0x25')]['message']);return _0x560190(_0xb9b6a3[_0xbfa2('0x25')]['message']);}logger['error'](_0xbfa2('0x21'),_0x47db68,_0xb9b6a3[_0xbfa2('0x25')][_0xbfa2('0x27')]);return _0x55c9fe(_0xb9b6a3[_0xbfa2('0x25')]['message']);}else{logger['info'](_0xbfa2('0x21'),_0x47db68,_0xbfa2('0x22'));_0x55c9fe(_0xb9b6a3['result'][_0xbfa2('0x27')]);}})['catch'](function(_0xeb88ab){logger['error'](_0xbfa2('0x21'),_0x47db68,_0xeb88ab);_0x560190(_0xeb88ab);});});}function respondWithStatusCode(_0xbe4d26,_0x8488e1){_0x8488e1=_0x8488e1||0xcc;return function(_0x38c5dc){if(_0x38c5dc){return _0xbe4d26[_0xbfa2('0x28')](_0x8488e1);}return _0xbe4d26['status'](_0x8488e1)[_0xbfa2('0x29')]();};}function respondWithResult(_0x2f9217,_0x4f782b){_0x4f782b=_0x4f782b||0xc8;return function(_0x37ec27){if(_0x37ec27){return _0x2f9217[_0xbfa2('0x2a')](_0x4f782b)['json'](_0x37ec27);}};}function respondWithFilteredResult(_0x2cbc51,_0x5ecd55){return function(_0x16bc84){if(_0x16bc84){var _0x56dd44=typeof _0x5ecd55[_0xbfa2('0x2b')]===_0xbfa2('0x2c')&&typeof _0x5ecd55[_0xbfa2('0x2d')]===_0xbfa2('0x2c');var _0x49d563=_0x16bc84[_0xbfa2('0x2e')];var _0x4aac4e=_0x56dd44?0x0:_0x5ecd55[_0xbfa2('0x2b')];var _0x36a30d=_0x56dd44?_0x16bc84[_0xbfa2('0x2e')]:_0x5ecd55['offset']+_0x5ecd55[_0xbfa2('0x2d')];var _0x17e471;if(_0x36a30d>=_0x49d563){_0x36a30d=_0x49d563;_0x17e471=0xc8;}else{_0x17e471=0xce;}_0x2cbc51[_0xbfa2('0x2a')](_0x17e471);return _0x2cbc51['set']('Content-Range',_0x4aac4e+'-'+_0x36a30d+'/'+_0x49d563)['json'](_0x16bc84);}return null;};}function saveUpdates(_0x2d5050){return function(_0x12069c){if(_0x12069c){return _0x12069c['update'](_0x2d5050)[_0xbfa2('0x2f')](function(_0x2ae697){return _0x2ae697;});}return null;};}function removeEntity(_0x39d1ce){return function(_0x206119){if(_0x206119){return _0x206119['destroy']()[_0xbfa2('0x2f')](function(){var _0x9523b7=_0x206119['get']({'plain':!![]});var _0x63ed08=_0xbfa2('0x30');return db[_0xbfa2('0x31')][_0xbfa2('0x32')]({'where':{'type':_0x63ed08,'resourceId':_0x9523b7['id']}})[_0xbfa2('0x2f')](function(){return _0x206119;});})[_0xbfa2('0x2f')](function(){_0x39d1ce[_0xbfa2('0x2a')](0xcc)[_0xbfa2('0x29')]();});}};}function handleEntityNotFound(_0x787887){return function(_0x5d6c57){if(!_0x5d6c57){_0x787887[_0xbfa2('0x28')](0x194);}return _0x5d6c57;};}function handleError(_0x5c910b,_0x2518dd){_0x2518dd=_0x2518dd||0x1f4;return function(_0x57c93c){logger[_0xbfa2('0x25')](_0x57c93c[_0xbfa2('0x33')]);if(_0x57c93c[_0xbfa2('0x34')]){delete _0x57c93c[_0xbfa2('0x34')];}_0x5c910b[_0xbfa2('0x2a')](_0x2518dd)['send'](_0x57c93c);};}function createInteractionObject(_0x3ed2f0,_0x31bb3f,_0xb264a6,_0xf53cdb){var _0xa6f846=require('user-agent-parser');var _0x4b9647=new _0xa6f846();var _0x2e2674=_0x4b9647[_0xbfa2('0x35')](_0xb264a6[_0xbfa2('0x36')])['getResult']();var _0x4f1362=_0x31bb3f[_0xbfa2('0x37')];if(_0xb264a6[_0xbfa2('0x38')]){_0x4f1362=_0xb264a6['cf-connecting-ip'];}else if(_0xb264a6['x-forwarded-for']){_0x4f1362=_[_0xbfa2('0x39')](_0xb264a6[_0xbfa2('0x3a')]['split'](','));}return{'ContactId':_0xf53cdb['id'],'ChatWebsiteId':_0x3ed2f0,'from':(_0xf53cdb[_0xbfa2('0x3b')]||'')+'\x20'+(_0xf53cdb[_0xbfa2('0x3c')]||''),'customerIp':_0x4f1362,'customerPort':_0xb264a6[_0xbfa2('0x3d')]?_0xb264a6[_0xbfa2('0x3d')]:null,'referer':_0x31bb3f[_0xbfa2('0x3e')],'browserName':_0x2e2674[_0xbfa2('0x3f')][_0xbfa2('0x34')]&&_0x2e2674[_0xbfa2('0x3f')][_0xbfa2('0x40')]?util[_0xbfa2('0x41')](_0xbfa2('0x42'),_0x2e2674[_0xbfa2('0x3f')][_0xbfa2('0x34')],_0x2e2674[_0xbfa2('0x3f')][_0xbfa2('0x40')]):_0xbfa2('0x43'),'browserVersion':_0x2e2674[_0xbfa2('0x3f')]['version']||_0xbfa2('0x43'),'osName':util[_0xbfa2('0x41')](_0xbfa2('0x42'),_0x2e2674['os'][_0xbfa2('0x34')],_0x2e2674['os'][_0xbfa2('0x40')]),'osVersion':_0x2e2674['os'][_0xbfa2('0x40')],'deviceModel':_0x2e2674['device'][_0xbfa2('0x44')]&&_0x2e2674['device'][_0xbfa2('0x45')]?util[_0xbfa2('0x41')]('%s\x20%s\x20%s',_0x2e2674[_0xbfa2('0x46')][_0xbfa2('0x44')],_0x2e2674[_0xbfa2('0x46')][_0xbfa2('0x45')],_0x2e2674[_0xbfa2('0x46')]['type']):null,'deviceVendor':_0x2e2674[_0xbfa2('0x46')][_0xbfa2('0x45')],'deviceType':_0x2e2674[_0xbfa2('0x46')][_0xbfa2('0x47')],'formData':JSON[_0xbfa2('0x48')](_0x31bb3f)};}exports[_0xbfa2('0x49')]=function(_0x1a353b,_0x25a54f){var _0x4a43f8={'include':[{'model':db['Pause'],'as':_0xbfa2('0x4a')}]},_0x20eb6e={},_0xba5a16={'count':0x0,'rows':[]};var _0x38c005=_[_0xbfa2('0x4b')](db[_0xbfa2('0x4c')][_0xbfa2('0x4d')],function(_0x31ef59){return{'name':_0x31ef59[_0xbfa2('0x4e')],'type':_0x31ef59[_0xbfa2('0x47')][_0xbfa2('0x4f')]};});_0x20eb6e['model']=_[_0xbfa2('0x4b')](_0x38c005,_0xbfa2('0x34'));_0x20eb6e[_0xbfa2('0x50')]=_['keys'](_0x1a353b['query']);_0x20eb6e[_0xbfa2('0x51')]=_['intersection'](_0x20eb6e[_0xbfa2('0x44')],_0x20eb6e[_0xbfa2('0x50')]);_0x4a43f8['attributes']=_[_0xbfa2('0x52')](_0x20eb6e[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x1a353b['query'][_0xbfa2('0x53')]));_0x4a43f8['attributes']=_0x4a43f8[_0xbfa2('0x54')][_0xbfa2('0x55')]?_0x4a43f8['attributes']:_0x20eb6e[_0xbfa2('0x44')];if(!_0x1a353b['query'][_0xbfa2('0x56')]('nolimit')){_0x4a43f8[_0xbfa2('0x2d')]=qs[_0xbfa2('0x2d')](_0x1a353b[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0x4a43f8[_0xbfa2('0x2b')]=qs['offset'](_0x1a353b['query']['offset']);}_0x4a43f8[_0xbfa2('0x57')]=qs[_0xbfa2('0x58')](_0x1a353b[_0xbfa2('0x50')]['sort']);_0x4a43f8[_0xbfa2('0x59')]=qs[_0xbfa2('0x51')](_['pick'](_0x1a353b[_0xbfa2('0x50')],_0x20eb6e[_0xbfa2('0x51')]),_0x38c005);if(_0x1a353b['query'][_0xbfa2('0x5a')]){_0x4a43f8[_0xbfa2('0x59')]=_['merge'](_0x4a43f8['where'],{'$or':_[_0xbfa2('0x4b')](_0x38c005,function(_0x4a705f){if(_0x4a705f[_0xbfa2('0x47')]!==_0xbfa2('0x5b')){var _0x55da83={};_0x55da83[_0x4a705f[_0xbfa2('0x34')]]={'$like':'%'+_0x1a353b[_0xbfa2('0x50')][_0xbfa2('0x5a')]+'%'};return _0x55da83;}})});}_0x4a43f8=_[_0xbfa2('0x5c')]({},_0x4a43f8,_0x1a353b[_0xbfa2('0x5d')]);var _0x28d7c5={'where':_0x4a43f8[_0xbfa2('0x59')]};return db[_0xbfa2('0x4c')][_0xbfa2('0x2e')](_0x28d7c5)[_0xbfa2('0x2f')](function(_0x33531){_0xba5a16[_0xbfa2('0x2e')]=_0x33531;if(_0x1a353b[_0xbfa2('0x50')][_0xbfa2('0x5e')]){_0x4a43f8['include']=[{'all':!![]}];}return db[_0xbfa2('0x4c')]['findAll'](_0x4a43f8);})[_0xbfa2('0x2f')](function(_0x401f2c){_0xba5a16[_0xbfa2('0x5f')]=_0x401f2c;return _0xba5a16;})[_0xbfa2('0x2f')](respondWithFilteredResult(_0x25a54f,_0x4a43f8))[_0xbfa2('0x60')](handleError(_0x25a54f,null));};exports[_0xbfa2('0x61')]=function(_0x36b0df,_0x1b8c24){var _0x41749d={'raw':![],'where':{'id':_0x36b0df[_0xbfa2('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xbfa2('0x4a')}]},_0x2ea55c={};_0x2ea55c[_0xbfa2('0x44')]=_[_0xbfa2('0x63')](db[_0xbfa2('0x4c')]['rawAttributes']);_0x2ea55c[_0xbfa2('0x50')]=_[_0xbfa2('0x63')](_0x36b0df[_0xbfa2('0x50')]);_0x2ea55c[_0xbfa2('0x51')]=_[_0xbfa2('0x52')](_0x2ea55c['model'],_0x2ea55c[_0xbfa2('0x50')]);_0x41749d[_0xbfa2('0x54')]=_[_0xbfa2('0x52')](_0x2ea55c[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x36b0df[_0xbfa2('0x50')]['fields']));_0x41749d[_0xbfa2('0x54')]=_0x41749d[_0xbfa2('0x54')][_0xbfa2('0x55')]?_0x41749d[_0xbfa2('0x54')]:_0x2ea55c[_0xbfa2('0x44')];if(_0x36b0df['query'][_0xbfa2('0x5e')]){_0x41749d['include']=[{'all':!![]}];}_0x41749d=_[_0xbfa2('0x5c')]({},_0x41749d,_0x36b0df[_0xbfa2('0x5d')]);return db[_0xbfa2('0x4c')][_0xbfa2('0x64')](_0x41749d)['then'](handleEntityNotFound(_0x1b8c24,null))['then'](respondWithResult(_0x1b8c24,null))[_0xbfa2('0x60')](handleError(_0x1b8c24,null));};exports[_0xbfa2('0x65')]=function(_0x15c172,_0x4ec9b0){var _0x1ab345=null;_0x15c172[_0xbfa2('0x66')][_0xbfa2('0x67')][_0xbfa2('0x68')](',')['forEach'](_0x433448=>{if(_0x433448[_0xbfa2('0x69')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x433448[_0xbfa2('0x69')]())){_0x1ab345=new APIBadRequestError('\x22'+_0x433448[_0xbfa2('0x69')]()+_0xbfa2('0x6a'));}});if(_0x1ab345){return handleError(_0x4ec9b0,null)(_0x1ab345);}return db[_0xbfa2('0x4c')]['create'](_0x15c172['body'],{})[_0xbfa2('0x2f')](function(_0x140627){var _0x8de0a6=_0x15c172[_0xbfa2('0x6b')][_0xbfa2('0x6c')]({'plain':!![]});if(!_0x8de0a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8de0a6[_0xbfa2('0x6d')]===_0xbfa2('0x6b')){var _0x3c5ff6=_0x140627['get']({'plain':!![]});var _0x288e11=_0xbfa2('0x30');return db[_0xbfa2('0x6e')][_0xbfa2('0x64')]({'where':{'name':_0x288e11,'userProfileId':_0x8de0a6['userProfileId']},'raw':!![]})['then'](function(_0x149ee3){if(_0x149ee3&&_0x149ee3['autoAssociation']===0x0){return db[_0xbfa2('0x31')][_0xbfa2('0x65')]({'name':_0x3c5ff6[_0xbfa2('0x34')],'resourceId':_0x3c5ff6['id'],'type':_0x149ee3[_0xbfa2('0x34')],'sectionId':_0x149ee3['id']},{})[_0xbfa2('0x2f')](function(){return _0x140627;});}else{return _0x140627;}})['catch'](function(_0x4611e2){logger[_0xbfa2('0x25')](_0xbfa2('0x6f'),_0x4611e2);throw _0x4611e2;});}return _0x140627;})['then'](respondWithResult(_0x4ec9b0,0xc9))['catch'](handleError(_0x4ec9b0,null));};exports[_0xbfa2('0x70')]=function(_0x48029a,_0x5b8407){var _0x5ea6fd=null;_0x48029a[_0xbfa2('0x66')]['address'][_0xbfa2('0x68')](',')[_0xbfa2('0x71')](_0xdde19=>{if(_0xdde19[_0xbfa2('0x69')]()!==''&&!wildcardUtils[_0xbfa2('0x72')](_0xdde19[_0xbfa2('0x69')]())){_0x5ea6fd=new APIBadRequestError('\x22'+_0xdde19[_0xbfa2('0x69')]()+_0xbfa2('0x6a'));}});if(_0x5ea6fd){return handleError(_0x5b8407,null)(_0x5ea6fd);}if(_0x48029a[_0xbfa2('0x66')]['id']){delete _0x48029a[_0xbfa2('0x66')]['id'];}return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x48029a[_0xbfa2('0x62')]['id']},'include':[{'model':db[_0xbfa2('0x73')],'as':_0xbfa2('0x4a')}]})[_0xbfa2('0x2f')](handleEntityNotFound(_0x5b8407,null))[_0xbfa2('0x2f')](saveUpdates(_0x48029a[_0xbfa2('0x66')],null))[_0xbfa2('0x2f')](respondWithResult(_0x5b8407,null))[_0xbfa2('0x60')](handleError(_0x5b8407,null));};exports[_0xbfa2('0x32')]=function(_0x31bab8,_0x4d94a4){return db['ChatWebsite'][_0xbfa2('0x64')]({'where':{'id':_0x31bab8[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x4d94a4,null))[_0xbfa2('0x2f')](removeEntity(_0x4d94a4,null))[_0xbfa2('0x60')](handleError(_0x4d94a4,null));};exports['describe']=function(_0x2dd954,_0x1f4482){return db['ChatWebsite'][_0xbfa2('0x74')]()['then'](respondWithResult(_0x1f4482,null))[_0xbfa2('0x60')](handleError(_0x1f4482,null));};exports[_0xbfa2('0x75')]=function(_0x128617,_0x196367){if(_0x128617[_0xbfa2('0x66')]['id']){delete _0x128617[_0xbfa2('0x66')]['id'];}return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x128617[_0xbfa2('0x62')]['id']}})['then'](handleEntityNotFound(_0x196367,null))[_0xbfa2('0x2f')](function(_0x405375){if(_0x405375){_0x128617['body'][_0xbfa2('0x76')]=_0x405375['id'];return db['Disposition']['create'](_0x128617[_0xbfa2('0x66')]);}})[_0xbfa2('0x2f')](respondWithResult(_0x196367,null))[_0xbfa2('0x60')](handleError(_0x196367,null));};exports[_0xbfa2('0x77')]=function(_0x584bf3,_0x417abc){var _0x4bd996={'raw':![],'where':{}};var _0x3a4027={};var _0x3f077a={'count':0x0,'rows':[]};return db[_0xbfa2('0x4c')][_0xbfa2('0x78')]({'where':{'id':_0x584bf3[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x417abc,null))[_0xbfa2('0x2f')](function(_0x186b09){if(_0x186b09){_0x3a4027[_0xbfa2('0x44')]=_[_0xbfa2('0x63')](db['Disposition'][_0xbfa2('0x4d')]);_0x3a4027[_0xbfa2('0x50')]=_[_0xbfa2('0x63')](_0x584bf3[_0xbfa2('0x50')]);_0x3a4027[_0xbfa2('0x51')]=_[_0xbfa2('0x52')](_0x3a4027['model'],_0x3a4027[_0xbfa2('0x50')]);_0x4bd996[_0xbfa2('0x54')]=_[_0xbfa2('0x52')](_0x3a4027[_0xbfa2('0x44')],qs['fields'](_0x584bf3['query'][_0xbfa2('0x53')]));_0x4bd996[_0xbfa2('0x54')]=_0x4bd996[_0xbfa2('0x54')][_0xbfa2('0x55')]?_0x4bd996[_0xbfa2('0x54')]:_0x3a4027[_0xbfa2('0x44')];if(!_0x584bf3[_0xbfa2('0x50')][_0xbfa2('0x56')](_0xbfa2('0x79'))){_0x4bd996['limit']=qs['limit'](_0x584bf3[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0x4bd996['offset']=qs[_0xbfa2('0x2b')](_0x584bf3['query'][_0xbfa2('0x2b')]);}_0x4bd996[_0xbfa2('0x57')]=qs[_0xbfa2('0x58')](_0x584bf3[_0xbfa2('0x50')][_0xbfa2('0x58')]);_0x4bd996['where']=qs['filters'](_[_0xbfa2('0x7a')](_0x584bf3['query'],_0x3a4027[_0xbfa2('0x51')]));_0x4bd996[_0xbfa2('0x59')]['ChatWebsiteId']=_0x186b09['id'];if(_0x584bf3[_0xbfa2('0x50')]['filter']){_0x4bd996['where']=_[_0xbfa2('0x5c')](_0x4bd996[_0xbfa2('0x59')],{'$or':_['map'](_0x4bd996[_0xbfa2('0x54')],function(_0x20ee10){var _0x3bd6d8={};_0x3bd6d8[_0x20ee10]={'$like':'%'+_0x584bf3[_0xbfa2('0x50')][_0xbfa2('0x5a')]+'%'};return _0x3bd6d8;})});}_0x4bd996=_[_0xbfa2('0x5c')]({},_0x4bd996,_0x584bf3[_0xbfa2('0x5d')]);return db[_0xbfa2('0x7b')][_0xbfa2('0x2e')]({'where':_0x4bd996[_0xbfa2('0x59')]})[_0xbfa2('0x2f')](function(_0x1e8bd8){_0x3f077a[_0xbfa2('0x2e')]=_0x1e8bd8;if(_0x584bf3[_0xbfa2('0x50')][_0xbfa2('0x5e')]){_0x4bd996[_0xbfa2('0x7c')]=[{'all':!![]}];}return db[_0xbfa2('0x7b')][_0xbfa2('0x7d')](_0x4bd996);})['then'](function(_0x595f1f){_0x3f077a[_0xbfa2('0x5f')]=_0x595f1f;return _0x3f077a;});}})[_0xbfa2('0x2f')](respondWithFilteredResult(_0x417abc,_0x4bd996))[_0xbfa2('0x60')](handleError(_0x417abc,null));};exports[_0xbfa2('0x7e')]=function(_0x46f369,_0x52c47c){return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x46f369[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x52c47c,null))[_0xbfa2('0x2f')](function(_0x71ac8e){if(_0x71ac8e){return _0x71ac8e[_0xbfa2('0x7e')](_0x46f369[_0xbfa2('0x50')][_0xbfa2('0x7f')]);}})[_0xbfa2('0x2f')](respondWithStatusCode(_0x52c47c,null))[_0xbfa2('0x60')](handleError(_0x52c47c,null));};exports[_0xbfa2('0x80')]=function(_0x352788,_0x3c398e){if(_0x352788['body']['id']){delete _0x352788[_0xbfa2('0x66')]['id'];}return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x352788['params']['id']}})['then'](handleEntityNotFound(_0x3c398e,null))[_0xbfa2('0x2f')](function(_0x24bb46){if(_0x24bb46){_0x352788[_0xbfa2('0x66')][_0xbfa2('0x76')]=_0x24bb46['id'];return db[_0xbfa2('0x81')][_0xbfa2('0x65')](_0x352788[_0xbfa2('0x66')]);}})['then'](respondWithResult(_0x3c398e,null))['catch'](handleError(_0x3c398e,null));};exports[_0xbfa2('0x82')]=function(_0x2e4715,_0x40dbef){var _0x1cab3f={'raw':![],'where':{}};var _0x5e5a3a={};var _0x1f93eb={'count':0x0,'rows':[]};return db[_0xbfa2('0x4c')][_0xbfa2('0x78')]({'where':{'id':_0x2e4715[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x40dbef,null))['then'](function(_0x515bad){if(_0x515bad){_0x5e5a3a[_0xbfa2('0x44')]=_['keys'](db[_0xbfa2('0x81')][_0xbfa2('0x4d')]);_0x5e5a3a[_0xbfa2('0x50')]=_[_0xbfa2('0x63')](_0x2e4715[_0xbfa2('0x50')]);_0x5e5a3a[_0xbfa2('0x51')]=_[_0xbfa2('0x52')](_0x5e5a3a['model'],_0x5e5a3a[_0xbfa2('0x50')]);_0x1cab3f[_0xbfa2('0x54')]=_[_0xbfa2('0x52')](_0x5e5a3a[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x2e4715['query']['fields']));_0x1cab3f[_0xbfa2('0x54')]=_0x1cab3f[_0xbfa2('0x54')][_0xbfa2('0x55')]?_0x1cab3f['attributes']:_0x5e5a3a[_0xbfa2('0x44')];if(!_0x2e4715[_0xbfa2('0x50')][_0xbfa2('0x56')](_0xbfa2('0x79'))){_0x1cab3f['limit']=qs['limit'](_0x2e4715[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0x1cab3f['offset']=qs[_0xbfa2('0x2b')](_0x2e4715['query'][_0xbfa2('0x2b')]);}_0x1cab3f[_0xbfa2('0x57')]=qs[_0xbfa2('0x58')](_0x2e4715['query'][_0xbfa2('0x58')]);_0x1cab3f['where']=qs[_0xbfa2('0x51')](_[_0xbfa2('0x7a')](_0x2e4715[_0xbfa2('0x50')],_0x5e5a3a[_0xbfa2('0x51')]));_0x1cab3f['where'][_0xbfa2('0x76')]=_0x515bad['id'];if(_0x2e4715['query'][_0xbfa2('0x5a')]){_0x1cab3f[_0xbfa2('0x59')]=_[_0xbfa2('0x5c')](_0x1cab3f[_0xbfa2('0x59')],{'$or':_[_0xbfa2('0x4b')](_0x1cab3f['attributes'],function(_0x1cc3a6){var _0x4e94d7={};_0x4e94d7[_0x1cc3a6]={'$like':'%'+_0x2e4715[_0xbfa2('0x50')][_0xbfa2('0x5a')]+'%'};return _0x4e94d7;})});}_0x1cab3f=_[_0xbfa2('0x5c')]({},_0x1cab3f,_0x2e4715[_0xbfa2('0x5d')]);return db[_0xbfa2('0x81')][_0xbfa2('0x2e')]({'where':_0x1cab3f[_0xbfa2('0x59')]})[_0xbfa2('0x2f')](function(_0x244b4f){_0x1f93eb[_0xbfa2('0x2e')]=_0x244b4f;if(_0x2e4715[_0xbfa2('0x50')][_0xbfa2('0x5e')]){_0x1cab3f['include']=[{'all':!![]}];}return db[_0xbfa2('0x81')][_0xbfa2('0x7d')](_0x1cab3f);})['then'](function(_0x5785aa){_0x1f93eb[_0xbfa2('0x5f')]=_0x5785aa;return _0x1f93eb;});}})[_0xbfa2('0x2f')](respondWithFilteredResult(_0x40dbef,_0x1cab3f))[_0xbfa2('0x60')](handleError(_0x40dbef,null));};exports[_0xbfa2('0x83')]=function(_0x9a0a20,_0xb2ba9f){return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x9a0a20['params']['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0xb2ba9f,null))[_0xbfa2('0x2f')](function(_0x267df7){if(_0x267df7){return _0x267df7[_0xbfa2('0x83')](_0x9a0a20[_0xbfa2('0x50')][_0xbfa2('0x7f')]);}})[_0xbfa2('0x2f')](respondWithStatusCode(_0xb2ba9f,null))[_0xbfa2('0x60')](handleError(_0xb2ba9f,null));};exports[_0xbfa2('0x84')]=function(_0x15de6a,_0x3de98d){_0x15de6a[_0xbfa2('0x66')]['sitepic']=_0x15de6a[_0xbfa2('0x85')]['filename'];return db['ChatWebsite'][_0xbfa2('0x64')]({'where':{'id':_0x15de6a[_0xbfa2('0x62')]['id']}})['then'](handleEntityNotFound(_0x3de98d,null))[_0xbfa2('0x2f')](saveUpdates(_0x15de6a[_0xbfa2('0x66')],null))[_0xbfa2('0x2f')](respondWithResult(_0x3de98d,null))[_0xbfa2('0x60')](handleError(_0x3de98d,null));};exports[_0xbfa2('0x86')]=function(_0x178f44,_0x304e23){_0x178f44['body'][_0xbfa2('0x87')]=_0x178f44['file'][_0xbfa2('0x88')];return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x178f44[_0xbfa2('0x62')]['id']}})['then'](handleEntityNotFound(_0x304e23,null))['then'](saveUpdates(_0x178f44[_0xbfa2('0x66')],null))['then'](respondWithResult(_0x304e23,null))[_0xbfa2('0x60')](handleError(_0x304e23,null));};exports[_0xbfa2('0x89')]=function(_0x21555a,_0x599631){_0x21555a[_0xbfa2('0x66')]['customerAvatar']=_0x21555a[_0xbfa2('0x85')][_0xbfa2('0x88')];return db['ChatWebsite'][_0xbfa2('0x64')]({'where':{'id':_0x21555a['params']['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x599631,null))[_0xbfa2('0x2f')](saveUpdates(_0x21555a['body'],null))['then'](respondWithResult(_0x599631,null))['catch'](handleError(_0x599631,null));};exports[_0xbfa2('0x8a')]=function(_0x2d05f6,_0x6713ce){_0x2d05f6[_0xbfa2('0x66')][_0xbfa2('0x8b')]=_0x2d05f6[_0xbfa2('0x85')][_0xbfa2('0x88')];return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x2d05f6['params']['id']}})['then'](handleEntityNotFound(_0x6713ce,null))[_0xbfa2('0x2f')](saveUpdates(_0x2d05f6[_0xbfa2('0x66')],null))[_0xbfa2('0x2f')](respondWithResult(_0x6713ce,null))[_0xbfa2('0x60')](handleError(_0x6713ce,null));};exports[_0xbfa2('0x8c')]=function(_0x24a52a,_0x36577e){var _0x4f7177=path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0x8f'));var _0x2286ae={'where':{'id':_0x24a52a[_0xbfa2('0x62')]['id']},'attributes':['id',_0xbfa2('0x90')],'raw':!![]};var _0x2f43d5=![];return require(_0xbfa2('0x91'))[_0xbfa2('0x92')]()[_0xbfa2('0x2f')](function(_0x4523a4){if(_0x4523a4){_0x2f43d5=_0x4523a4['custom'];}})[_0xbfa2('0x2f')](function(){return db[_0xbfa2('0x4c')][_0xbfa2('0x64')](_0x2286ae);})[_0xbfa2('0x2f')](handleEntityNotFound(_0x36577e,null))[_0xbfa2('0x2f')](function(_0x2a172e){if(_0x2a172e){if(!_[_0xbfa2('0x93')](_0x2a172e['sitepic'])){if(fs[_0xbfa2('0x94')](path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0x95'),_0x2a172e[_0xbfa2('0x90')]))&&_0x2f43d5){_0x4f7177=path['join'](config[_0xbfa2('0x8e')],_0xbfa2('0x95'),_0x2a172e[_0xbfa2('0x90')]);}}return _0x36577e[_0xbfa2('0x96')](_0x4f7177);}})['catch'](handleError(_0x36577e,null));};exports[_0xbfa2('0x97')]=function(_0x21f246,_0x3a2070){var _0x1461d4=path[_0xbfa2('0x8d')](config['root'],_0xbfa2('0x98'));var _0x529291={'where':{'id':_0x21f246[_0xbfa2('0x62')]['id']},'attributes':['id',_0xbfa2('0x87')],'raw':!![]};return db[_0xbfa2('0x4c')][_0xbfa2('0x64')](_0x529291)[_0xbfa2('0x2f')](handleEntityNotFound(_0x3a2070,null))[_0xbfa2('0x2f')](function(_0x418594){if(_0x418594){if(!_[_0xbfa2('0x93')](_0x418594['agentAvatar'])){if(fs[_0xbfa2('0x94')](path['join'](config[_0xbfa2('0x8e')],_0xbfa2('0x99'),_0x418594[_0xbfa2('0x87')]))){_0x1461d4=path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0x99'),_0x418594[_0xbfa2('0x87')]);}}return _0x3a2070[_0xbfa2('0x96')](_0x1461d4);}})[_0xbfa2('0x60')](handleError(_0x3a2070,null));};exports[_0xbfa2('0x9a')]=function(_0x373e78,_0x33828e){var _0x3495b2=path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],'server/files/images/avatars/customer_avatar.png');var _0xfcea05={'where':{'id':_0x373e78['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xbfa2('0x4c')][_0xbfa2('0x64')](_0xfcea05)[_0xbfa2('0x2f')](handleEntityNotFound(_0x33828e,null))[_0xbfa2('0x2f')](function(_0x321b23){if(_0x321b23){if(!_[_0xbfa2('0x93')](_0x321b23['customerAvatar'])){if(fs[_0xbfa2('0x94')](path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0x99'),_0x321b23[_0xbfa2('0x9b')]))&&_0x321b23[_0xbfa2('0x9c')]){_0x3495b2=path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0x99'),_0x321b23['customerAvatar']);}}return _0x33828e[_0xbfa2('0x96')](_0x3495b2);}})['catch'](handleError(_0x33828e,null));};exports[_0xbfa2('0x9d')]=function(_0x44ea29,_0xe51ea7){var _0x2170b8=path[_0xbfa2('0x8d')](config['root'],_0xbfa2('0x9e'));var _0x5e56ad={'where':{'id':_0x44ea29[_0xbfa2('0x62')]['id']},'attributes':['id',_0xbfa2('0x8b')],'raw':!![]};return db[_0xbfa2('0x4c')][_0xbfa2('0x64')](_0x5e56ad)[_0xbfa2('0x2f')](handleEntityNotFound(_0xe51ea7,null))[_0xbfa2('0x2f')](function(_0x2ec64e){if(_0x2ec64e){if(!_[_0xbfa2('0x93')](_0x2ec64e[_0xbfa2('0x8b')])){if(fs[_0xbfa2('0x94')](path['join'](config[_0xbfa2('0x8e')],'server/files/images/avatars/',_0x2ec64e[_0xbfa2('0x8b')]))){_0x2170b8=path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0x99'),_0x2ec64e[_0xbfa2('0x8b')]);}}return _0xe51ea7[_0xbfa2('0x96')](_0x2170b8);}})[_0xbfa2('0x60')](handleError(_0xe51ea7,null));};function checkWebsiteInterval(_0x68a1b6){var _0x1749ff=_0x68a1b6[_0xbfa2('0x9f')];if(!_0x1749ff){return Promise[_0xbfa2('0xa0')](_0x68a1b6);}var _0x17205f=_0x68a1b6['timezone']||undefined;return _0x1749ff['ifTime'](_0x17205f)['then'](function(_0x403c85){if(!_0x403c85){throw new APIOutOfIntervalError();}return _0x68a1b6;});}exports[_0xbfa2('0xa1')]=function(_0x112b9f,_0x5d4b42){var _0x3ddd75={'body':_0x112b9f[_0xbfa2('0x66')],'channel':_0xbfa2('0xa2')};var _0x5dd72f=[];var _0x1551c5=[];var _0xc559f4={};var _0x2d4041=![];if(_0x112b9f[_0xbfa2('0x66')]['id']){delete _0x112b9f[_0xbfa2('0x66')]['id'];}if(_[_0xbfa2('0x93')](_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xa3')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xbfa2('0x93')](_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xa4')])){throw new APIBadRequestError(_0xbfa2('0xa5'));}if(_[_0xbfa2('0xa6')](_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0x66')])){throw new APIBadRequestError(_0xbfa2('0xa7'));}var _0x22d06f=_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0x37')]&&_0x112b9f[_0xbfa2('0x66')]['referer'];return db[_0xbfa2('0xa8')][_0xbfa2('0x74')]()[_0xbfa2('0x2f')](function(_0x1fe7cb){if(!_0x1fe7cb){throw new Error(_0xbfa2('0xa9'));}_0x5dd72f=Object['keys'](_0x1fe7cb)[_0xbfa2('0x5a')](function(_0x89f72a){return![_0xbfa2('0xaa'),'updatedAt']['includes'](_0x89f72a);});_0x1551c5=Object[_0xbfa2('0x63')](_0x1fe7cb)[_0xbfa2('0x5a')](function(_0x24aeeb){return![_0xbfa2('0xaa'),_0xbfa2('0xab'),'CompanyId','ListId'][_0xbfa2('0xac')](_0x24aeeb);});if(!_[_0xbfa2('0xac')](_0x1551c5,_0x112b9f['body'][_0xbfa2('0xa4')])){throw new APIBadRequestError(_0xbfa2('0xad')+_0x1551c5[_0xbfa2('0x8d')](',\x20'));}_0xc559f4[_0x112b9f['body'][_0xbfa2('0xa4')]]=_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xa3')];})[_0xbfa2('0x2f')](function(){return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x112b9f['params']['id']},'include':[{'model':db[_0xbfa2('0xae')],'as':'List','include':[{'model':db[_0xbfa2('0xa8')],'as':_0xbfa2('0xaf'),'where':_0xc559f4,'limit':0x1,'order':[[_0xbfa2('0xab'),_0xbfa2('0xb0')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db['Interval'],'as':_0xbfa2('0x9f'),'include':[{'model':db[_0xbfa2('0x9f')],'as':'Intervals','attributes':['id',_0xbfa2('0xb1')],'raw':!![]}]}]});})[_0xbfa2('0x2f')](function(_0x29a04e){if(!_0x29a04e){throw new APINotFoundError(util[_0xbfa2('0x41')](_0xbfa2('0xb2'),_0x112b9f[_0xbfa2('0x62')]['id']));}if(_0x22d06f){return checkWebsiteInterval(_0x29a04e);}return _0x29a04e;})[_0xbfa2('0x2f')](function(_0x3937a4){_0x3ddd75[_0xbfa2('0xb3')]=_0x3937a4;_0x3ddd75[_0xbfa2('0xb4')]=_['orderBy'](_0x3937a4[_0xbfa2('0xb5')],[_0xbfa2('0xb6')],[_0xbfa2('0xb7')]);if(_0x3ddd75['account'][_0xbfa2('0xb5')]){delete _0x3ddd75['account']['Applications'];}_0x3ddd75['list']=_0x3937a4[_0xbfa2('0xb8')]||{'id':_0x3937a4[_0xbfa2('0xb9')]};if(_0x3ddd75[_0xbfa2('0xba')]&&_0x3ddd75[_0xbfa2('0xba')][_0xbfa2('0xaf')]['length']){return _0x3ddd75[_0xbfa2('0xba')]['Contacts'][0x0];}var _0x4a99e7=_['defaults'](_0x112b9f[_0xbfa2('0x66')],{'firstName':_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xa3')],'ListId':_0x3937a4['ListId']});_0x4a99e7[_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xa4')]]=_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xa3')];return db[_0xbfa2('0xa8')][_0xbfa2('0x65')](_0x4a99e7,{'fields':_0x5dd72f,'raw':!![]});})[_0xbfa2('0x2f')](function(_0x20086d){_0x3ddd75[_0xbfa2('0xbb')]=_0x20086d;var _0x40051f=createInteractionObject(_0x112b9f['params']['id'],_0x112b9f[_0xbfa2('0x66')],_0x112b9f[_0xbfa2('0xbc')],_0x20086d);var _0x2c83eb={'ChatWebsiteId':_0x112b9f[_0xbfa2('0x62')]['id']};if(_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xbd')]){_0x2c83eb[_0xbfa2('0xbd')]=_0x112b9f['body']['threadId'];_0x2c83eb[_0xbfa2('0xbe')]=![];return db[_0xbfa2('0xbf')][_0xbfa2('0x64')]({'where':_0x2c83eb})[_0xbfa2('0x2f')](function(_0x59abdc){var _0x17162a=_0x112b9f[_0xbfa2('0x66')]['customerIp']&&_0x112b9f[_0xbfa2('0x66')]['referer'];if(_0x59abdc){_0x2d4041=!![];return _0x59abdc;}else if(!_0x17162a&&_0x59abdc&&_0x59abdc[_0xbfa2('0xbe')]){throw new APIConflictError(_0xbfa2('0xc0'));}_0x40051f[_0xbfa2('0xbd')]=_0x112b9f[_0xbfa2('0x66')]['threadId'];_0x40051f['externalUrl']=_0x112b9f['body']['externalUrl'];return db['ChatInteraction'][_0xbfa2('0x65')](_0x40051f);});}_0x2c83eb[_0xbfa2('0xc1')]=_0x20086d['id'];if(_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xc2')]&&_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xc2')]['id']){_0x2c83eb['id']=_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xc2')]['id'];return db['ChatInteraction'][_0xbfa2('0x64')]({'where':_0x2c83eb})[_0xbfa2('0x2f')](function(_0x288f7e){var _0x2ae6eb=_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0x37')]&&_0x112b9f['body']['referer'];if(!_0x2ae6eb&&_0x288f7e&&_0x288f7e['closed']){throw new APIConflictError(_0xbfa2('0xc0'));}else if(_0x288f7e){_0x2d4041=!![];return _0x288f7e;}else{return db['ChatInteraction'][_0xbfa2('0x65')](_0x40051f);}});}return db[_0xbfa2('0xbf')][_0xbfa2('0x65')](_0x40051f);})[_0xbfa2('0x2f')](function(_0x5ac9d4){if(!_0x2d4041){return _0x5ac9d4;}var _0x44f395={'from':(_0x3ddd75[_0xbfa2('0xbb')]['firstName']||'')+'\x20'+(_0x3ddd75[_0xbfa2('0xbb')][_0xbfa2('0x3c')]||'')};if(_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xbd')]&&_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xc3')]&&_0x112b9f['body'][_0xbfa2('0xbd')]!=_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xc3')]){_0x44f395[_0xbfa2('0xbd')]=_0x112b9f['body']['messageId'];}return _0x5ac9d4[_0xbfa2('0x70')](_0x44f395);})[_0xbfa2('0x2f')](function(_0x10e794){_0x3ddd75[_0xbfa2('0xc2')]=_0x10e794[_0xbfa2('0x6c')]({'plain':!![]});_0x3ddd75['interaction'][_0xbfa2('0xc4')]=!_0x2d4041;if(_0x3ddd75['interaction'][_0xbfa2('0xc4')]){if(_0x3ddd75[_0xbfa2('0xb3')][_0xbfa2('0xc5')]){_0x3ddd75[_0xbfa2('0xb4')][_0xbfa2('0xc6')]({'id':0x0,'priority':_0x3ddd75[_0xbfa2('0xb4')][_0xbfa2('0x55')]+0x1,'app':_0xbfa2('0xc7'),'appdata':_0xbfa2('0xc8'),'interval':'*,*,*,*'});}}return db[_0xbfa2('0xc9')][_0xbfa2('0x65')]({'body':_0x112b9f[_0xbfa2('0x66')]['body'],'ChatWebsiteId':_0x112b9f[_0xbfa2('0x62')]['id'],'ChatInteractionId':_0x10e794['id'],'direction':'in','ContactId':_0x3ddd75[_0xbfa2('0xbb')]['id'],'AttachmentId':_0x112b9f[_0xbfa2('0x66')][_0xbfa2('0xca')]});})[_0xbfa2('0x2f')](function(_0x46b515){_0x3ddd75[_0xbfa2('0x27')]=_0x46b515;if(!_0x3ddd75[_0xbfa2('0xc2')][_0xbfa2('0xcb')]){return;}return db[_0xbfa2('0xcc')][_0xbfa2('0x64')]({'attributes':['id',_0xbfa2('0x34')],'where':{'id':_0x3ddd75[_0xbfa2('0xc2')][_0xbfa2('0xcb')]}});})[_0xbfa2('0x2f')](function(_0xf2681f){if(_0xf2681f){_0x3ddd75[_0xbfa2('0xb4')]['unshift']({'id':0x0,'priority':0x0,'app':_0xbfa2('0xcd'),'appdata':_0xf2681f[_0xbfa2('0x34')]+','+(_0x3ddd75[_0xbfa2('0xb3')][_0xbfa2('0xce')]||0xa),'interval':_0xbfa2('0xcf')});_0x3ddd75[_0xbfa2('0xd0')]=!![];}if(!_0x3ddd75[_0xbfa2('0xc2')]['queueId']){return;}return db[_0xbfa2('0xd1')][_0xbfa2('0x64')]({'attributes':['id',_0xbfa2('0x34')],'where':{'id':_0x3ddd75[_0xbfa2('0xc2')]['queueId']}});})['then'](function(_0x3b1ac8){if(_0x3b1ac8){_0x3ddd75[_0xbfa2('0xb4')]['unshift']({'id':0x0,'priority':0x1,'app':_0xbfa2('0xd2'),'appdata':_0x3b1ac8[_0xbfa2('0x34')]+','+(_0x3ddd75[_0xbfa2('0xb3')][_0xbfa2('0xd3')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xbfa2('0xd4'),_0x3ddd75);})[_0xbfa2('0x2f')](function(_0xcabfa5){respondWithRpcPromise(_0xbfa2('0xd5'),_0xbfa2('0xd5'),{'event':'notify','message':_0xcabfa5},client9002);return _0xcabfa5;})[_0xbfa2('0x2f')](respondWithResult(_0x5d4b42,null))[_0xbfa2('0x60')](APIHandleError(_0x5d4b42));};exports[_0xbfa2('0xd6')]=function(_0x3f4805,_0x776092){var _0x230cbc,_0x2a2f9a,_0xbe9477;var _0x4f6bd3=[];var _0x26b11c={};var _0x43b517=_0x3f4805[_0xbfa2('0xd7')]||[];var _0x38bb2b=[];var _0x24968b;return db['CmContact'][_0xbfa2('0x74')]()[_0xbfa2('0x2f')](function(_0x59ea3c){if(!_0x59ea3c){throw new db[(_0xbfa2('0xd8'))][(_0xbfa2('0xd9'))](_0xbfa2('0xda'));}_0x4f6bd3=_[_0xbfa2('0xdb')](_['keys'](_0x59ea3c),[_0xbfa2('0xaa'),'updatedAt',_0xbfa2('0xdc'),_0xbfa2('0xb9')]);if(_0x3f4805['body']['id']){delete _0x3f4805['body']['id'];}if(_[_0xbfa2('0x93')](_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0xa3')])){throw _0x776092[_0xbfa2('0x2a')](0x1f4)[_0xbfa2('0xdd')](new db[(_0xbfa2('0xd8'))][(_0xbfa2('0xd9'))](_0xbfa2('0xde')));}if(_['isNil'](_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0x66')])||_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0x66')]===''){throw _0x776092[_0xbfa2('0x2a')](0x1f4)[_0xbfa2('0xdd')](new db[(_0xbfa2('0xd8'))][(_0xbfa2('0xd9'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbfa2('0x93')](_0x3f4805['body'][_0xbfa2('0xdf')])){throw _0x776092[_0xbfa2('0x2a')](0x1f4)[_0xbfa2('0xdd')](new db['Sequelize'][(_0xbfa2('0xd9'))](_0xbfa2('0xe0')+_0x4f6bd3));}if(!_[_0xbfa2('0xac')](_0x4f6bd3,_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0xdf')])){throw _0x776092[_0xbfa2('0x2a')](0x1f4)[_0xbfa2('0xdd')](new db[(_0xbfa2('0xd8'))][(_0xbfa2('0xd9'))](_0xbfa2('0xe1')+_0x4f6bd3));}_0x26b11c[_0x3f4805['body'][_0xbfa2('0xdf')]]=_0x3f4805['body']['from'];})[_0xbfa2('0x2f')](function(){return db['ChatWebsite'][_0xbfa2('0x64')]({'where':{'id':_0x3f4805[_0xbfa2('0x62')]['id']},'include':[{'model':db[_0xbfa2('0xae')],'as':'List'},{'model':db[_0xbfa2('0xe2')],'as':_0xbfa2('0xe2')}]});})[_0xbfa2('0x2f')](handleEntityNotFound(_0x776092,null))['then'](function(_0x34eda4){if(_0x34eda4&&_0x34eda4[_0xbfa2('0xb8')]){_0x2a2f9a=_0x34eda4;var _0x2ef589=_[_0xbfa2('0xe3')](_0x3f4805[_0xbfa2('0x66')],{'firstName':_0x3f4805['body'][_0xbfa2('0xa3')],'phone':_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0xa3')],'ListId':_0x34eda4[_0xbfa2('0xb9')]});_0x2ef589[_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0xdf')]]=_0x3f4805['body']['from'];return db[_0xbfa2('0xa8')][_0xbfa2('0xe4')]({'where':_0x26b11c,'defaults':_0x2ef589});}})['spread'](function(_0x1f9ba3){if(_0x1f9ba3){_0xbe9477=_0x1f9ba3;var _0x36e465=fs[_0xbfa2('0xe5')](path[_0xbfa2('0x8d')](config['root'],_0xbfa2('0xe6')),_0xbfa2('0xe7'));var _0x2691cd=ejs[_0xbfa2('0xe8')](_0x36e465,{'body':_[_0xbfa2('0xe9')](_0x3f4805[_0xbfa2('0x66')][_0xbfa2('0x66')]),'bodyTitle':_0x2a2f9a[_0xbfa2('0xea')]});return db[_0xbfa2('0xeb')]['create']({'body':_0x2691cd,'plainBody':htmlToText[_0xbfa2('0xec')](_0x2691cd),'ContactId':_0x1f9ba3['id'],'ChatWebsiteId':_0x2a2f9a['id']});}})[_0xbfa2('0x2f')](function(_0x1eab9d){_0x24968b=_0x1eab9d;if(_0x43b517[_0xbfa2('0x55')]){var _0x1c1d16=_0x43b517['map'](function(_0x2b4733){return{'name':_0x2b4733[_0xbfa2('0xed')],'basename':_0x2b4733['filename'],'type':_0x2b4733[_0xbfa2('0xee')],'ChatOfflineMessageId':_0x1eab9d['id']};});_0x38bb2b=_0x1c1d16[_0xbfa2('0x4b')](_0x1c1df4=>{var _0x19d474={'filename':_0x1c1df4['name'],'path':path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0xef'),_0xbfa2('0xd7'),'attachments',_0xbfa2('0xf0'),_0x1c1df4[_0xbfa2('0xf1')])};return _0x19d474;});if(!_0x2a2f9a['openNewInteraction']){return db['sequelize'][_0xbfa2('0xf2')](function(_0x29340b){return db[_0xbfa2('0xf3')][_0xbfa2('0xf4')](_0x1c1d16,{'transaction':_0x29340b});});}}})[_0xbfa2('0x2f')](function(){if(_0x24968b){_0x230cbc=_0x24968b;return db[_0xbfa2('0xe2')][_0xbfa2('0x78')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xbfa2('0xf5'),'raw':!![],'include':[{'model':db[_0xbfa2('0xf6')],'as':_0xbfa2('0xf6'),'raw':!![]}]}]});}})[_0xbfa2('0x2f')](function(_0x596ceb){if(_0x596ceb&&_0x596ceb['Smtp']&&_0x2a2f9a[_0xbfa2('0xf7')]&&_0x2a2f9a[_0xbfa2('0xf8')]){var _0x32aa8b=_0x596ceb[_0xbfa2('0xf9')]();return respondWithRpcPromise(_0xbfa2('0xfa'),_0xbfa2('0xfb'),{'account':_0x32aa8b,'message':{'from':util[_0xbfa2('0x41')](_0xbfa2('0xfc'),_0x596ceb[_0xbfa2('0x34')],_0x596ceb['email']||_0x596ceb[_0xbfa2('0xf5')][_0xbfa2('0x6b')]),'to':_0x2a2f9a['forwardOfflineAddress'],'subject':_0x2a2f9a[_0xbfa2('0xfd')],'html':_0x230cbc[_0xbfa2('0x66')],'attachments':_0x38bb2b}},client9003)['then'](function(){return _0x230cbc;})[_0xbfa2('0x60')](function(_0x419133){logger[_0xbfa2('0x25')](_0x419133);});}})[_0xbfa2('0x2f')](function(){if(_0x2a2f9a&&_0x2a2f9a['openNewInteraction']&&_0x2a2f9a[_0xbfa2('0xfe')]){var _0x5aa1fd=[];if(_0x43b517[_0xbfa2('0x55')]){_0x5aa1fd=_0x43b517[_0xbfa2('0x4b')](function(_0x319f1b){return{'name':_0x319f1b['originalname'],'basename':_0x319f1b['filename'],'type':_0x319f1b[_0xbfa2('0xee')],'ChatOfflineMessageId':_0x24968b['id']};});}var _0x48de8d;if(!_[_0xbfa2('0x93')](_0x2a2f9a['subjectOffline'])){var _0x12f6a3=_[_0xbfa2('0x4b')](_0x3f4805[_0xbfa2('0x66')],function(_0x3c7311){return _0x3c7311;});var _0x106a6a=_[_0xbfa2('0xff')](_0x12f6a3)[0x0];var _0x54bc10=_['mapValues'](_0x106a6a,function(_0x46c45b){return _0x46c45b;});_0x48de8d=_0x54bc10[0x1][_0x2a2f9a['subjectOffline']];}var _0xd721e8={'from':_0xbe9477['email'],'firstName':_0xbe9477[_0xbfa2('0x3b')],'lastName':_0xbe9477[_0xbfa2('0x3c')],'mapKey':_0xbfa2('0x100'),'message':{'from':_0xbe9477[_0xbfa2('0x100')],'to':_0x2a2f9a['MailAccount'][_0xbfa2('0x100')],'cc':'','subject':_[_0xbfa2('0x93')](_0x48de8d)?_0x2a2f9a[_0xbfa2('0xfd')]:_0x48de8d,'messageId':'','sentAt':new Date(),'attach':_0x5aa1fd['length'],'attachments':_0x5aa1fd,'originChannel':_0xbfa2('0x101'),'ChatWebsiteId':_0x2a2f9a['id'],'ChatOfflineMessageId':_0x230cbc['id'],'originTo':_0x2a2f9a[_0xbfa2('0xe2')][_0xbfa2('0x100')]},'body':_0x230cbc[_0xbfa2('0x66')]};var _0x5b8ebf={'account':{'id':_0x2a2f9a[_0xbfa2('0xfe')]},'body':_0xd721e8,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xbfa2('0x102'),_0xbfa2('0x103'),_0x5b8ebf,client9001)['then'](function(){return _0x230cbc;})[_0xbfa2('0x60')](function(_0x4e7605){logger[_0xbfa2('0x25')](_0x4e7605);});}return;})[_0xbfa2('0x2f')](function(){if(_0x230cbc){return _0x230cbc;}})[_0xbfa2('0x2f')](respondWithResult(_0x776092,null))['catch'](function(){for(var _0x2cbdb1 of _0x43b517){var _0x28b56f=path[_0xbfa2('0x8d')](config[_0xbfa2('0x8e')],_0xbfa2('0xef'),'files','attachments',_0xbfa2('0xf0'),_0x2cbdb1[_0xbfa2('0x88')]);fs_extra[_0xbfa2('0x104')](_0x28b56f)['catch'](function(_0x560496){logger['error'](_0xbfa2('0x105'),_0x28b56f,_0x560496);});}});};exports[_0xbfa2('0x106')]=function(_0x9201cf,_0x55a754){return db[_0xbfa2('0xbf')][_0xbfa2('0x64')]({'where':{'id':_0x9201cf[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x55a754,null))[_0xbfa2('0x2f')](function(_0x1c1fb9){if(_0x1c1fb9){return _0x1c1fb9[_0xbfa2('0x106')](_0x9201cf['body'][_0xbfa2('0x7f')],_[_0xbfa2('0x107')](_0x9201cf['body'],[_0xbfa2('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x55a754,null))['catch'](handleError(_0x55a754,null));};exports[_0xbfa2('0x108')]=function(_0x5704ec,_0x351b76){var _0x23d4ea={'raw':![],'where':{}};var _0x5a62e6={};var _0x428800={'count':0x0,'rows':[]};return db[_0xbfa2('0x4c')][_0xbfa2('0x78')]({'where':{'id':_0x5704ec['params']['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x351b76,null))['then'](function(_0x522e82){if(_0x522e82){_0x5a62e6[_0xbfa2('0x44')]=_[_0xbfa2('0x63')](db[_0xbfa2('0xbf')]['rawAttributes']);_0x5a62e6[_0xbfa2('0x50')]=_['keys'](_0x5704ec[_0xbfa2('0x50')]);_0x5a62e6[_0xbfa2('0x51')]=_['intersection'](_0x5a62e6['model'],_0x5a62e6['query']);_0x23d4ea[_0xbfa2('0x54')]=_[_0xbfa2('0x52')](_0x5a62e6[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x53')]));_0x23d4ea[_0xbfa2('0x54')]=_0x23d4ea[_0xbfa2('0x54')][_0xbfa2('0x55')]?_0x23d4ea[_0xbfa2('0x54')]:_0x5a62e6[_0xbfa2('0x44')];if(!_0x5704ec[_0xbfa2('0x50')]['hasOwnProperty'](_0xbfa2('0x79'))){_0x23d4ea[_0xbfa2('0x2d')]=qs['limit'](_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0x23d4ea['offset']=qs[_0xbfa2('0x2b')](_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x2b')]);}_0x23d4ea[_0xbfa2('0x57')]=qs[_0xbfa2('0x58')](_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x58')]);_0x23d4ea[_0xbfa2('0x59')]=qs[_0xbfa2('0x51')](_[_0xbfa2('0x7a')](_0x5704ec[_0xbfa2('0x50')],_0x5a62e6[_0xbfa2('0x51')]));_0x23d4ea[_0xbfa2('0x59')][_0xbfa2('0x76')]=_0x522e82['id'];if(_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x5a')]){_0x23d4ea[_0xbfa2('0x59')]=_['merge'](_0x23d4ea[_0xbfa2('0x59')],{'$or':_[_0xbfa2('0x4b')](_0x23d4ea[_0xbfa2('0x54')],function(_0x54a76b){var _0x1f0e96={};_0x1f0e96[_0x54a76b]={'$like':'%'+_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x5a')]+'%'};return _0x1f0e96;})});}_0x23d4ea=_[_0xbfa2('0x5c')]({},_0x23d4ea,_0x5704ec[_0xbfa2('0x5d')]);return db[_0xbfa2('0xbf')][_0xbfa2('0x2e')]({'where':_0x23d4ea[_0xbfa2('0x59')]})[_0xbfa2('0x2f')](function(_0x2a080b){_0x428800[_0xbfa2('0x2e')]=_0x2a080b;if(_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x5e')]){_0x23d4ea['include']=[{'model':db[_0xbfa2('0xa8')],'as':_0xbfa2('0x109'),'required':![]},{'model':db[_0xbfa2('0xcc')],'as':_0xbfa2('0x10a'),'attributes':[_0xbfa2('0x34'),'fullname',_0xbfa2('0x10b')],'required':![]},{'model':db['Tag'],'as':_0xbfa2('0x10c'),'attributes':['id',_0xbfa2('0x34'),_0xbfa2('0x10d')],'where':_0x5704ec[_0xbfa2('0x50')][_0xbfa2('0x10e')]?{'id':_0x5704ec[_0xbfa2('0x50')]['tag']}:undefined,'required':_0x5704ec['query']['tag']?!![]:![]}];}return db[_0xbfa2('0xbf')][_0xbfa2('0x7d')](_0x23d4ea);})['then'](function(_0x5e4edc){_0x428800[_0xbfa2('0x5f')]=_0x5e4edc;return _0x428800;});}})[_0xbfa2('0x2f')](respondWithFilteredResult(_0x351b76,_0x23d4ea))[_0xbfa2('0x60')](handleError(_0x351b76,null));};exports[_0xbfa2('0x10f')]=function(_0x10c637,_0x3043ad){var _0x56532e=0x0;var _0x2e6220=0x0;var _0x2d97f5=![];var _0x391ee0;var _0x1a4931;return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0x10c637[_0xbfa2('0x62')]['id']},'include':[{'model':db[_0xbfa2('0x9f')],'as':_0xbfa2('0x9f'),'include':[{'model':db[_0xbfa2('0x9f')],'as':_0xbfa2('0x110'),'attributes':['id',_0xbfa2('0xb1')]}]}]})[_0xbfa2('0x2f')](handleEntityNotFound(_0x3043ad,null))[_0xbfa2('0x2f')](function(_0x1802ae){if(_0x1802ae){_0x391ee0=_0x1802ae;return _0x1802ae['getProactiveActions']({'raw':!![]});}})[_0xbfa2('0x2f')](function(_0x16bf90){if(_0x391ee0){if(_0x16bf90){_0x1a4931=_0x16bf90;}}return require('../../config/license/util')[_0xbfa2('0x92')]();})[_0xbfa2('0x2f')](function(_0x303d04){if(_0x303d04){_0x2e6220=_0x303d04['virtual'];_0x2d97f5=_0x303d04[_0xbfa2('0x111')];}})[_0xbfa2('0x2f')](function(){return db['ChatInteraction'][_0xbfa2('0x2e')]({'where':{'closed':![]}});})['then'](function(_0x39584d){_0x56532e=_0x39584d;if(_0x2e6220&&_0x39584d>_0x2e6220){return db[_0xbfa2('0x112')]['findOne']({'where':{'id':0x1}})[_0xbfa2('0x2f')](function(_0x3eadd8){if(_0x3eadd8){_0x3eadd8[_0xbfa2('0x113')]('chatLicenseExceeded');}});}})[_0xbfa2('0x2f')](function(){var _0x157ccf=_0x391ee0['Interval'];var _0x1da624=_0x391ee0[_0xbfa2('0x114')]||undefined;return _0x157ccf?_0x157ccf[_0xbfa2('0x115')](_0x1da624):!![];})[_0xbfa2('0x2f')](function(_0x2edfbf){var _0x2fbe1b=fs[_0xbfa2('0xe5')](path['join'](config[_0xbfa2('0x8e')],_0xbfa2('0x116')),_0xbfa2('0xe7'));var _0x4ecc5d=_0xbfa2('0x117');var _0x1db897=![];var _0x4caeb1,_0x34a958;if(_0x10c637[_0xbfa2('0xbc')][_0xbfa2('0x3e')]){_0x4caeb1=new URL(_0x10c637[_0xbfa2('0xbc')][_0xbfa2('0x3e')])[_0xbfa2('0x118')];}else if(_0x10c637['headers'][_0xbfa2('0x118')]){_0x4caeb1=new URL(_0x10c637[_0xbfa2('0xbc')][_0xbfa2('0x118')])['origin'];}else{_0x4caeb1=_0xbfa2('0x119');}_0x34a958=typeof _0x391ee0[_0xbfa2('0x67')]['split'](',')[_0xbfa2('0x64')](function(_0x535079){return wildcardUtils[_0xbfa2('0x11a')](_0x535079,_0x4caeb1);})!==_0xbfa2('0x2c');var _0x27cfe4={'chatVersion':_0x4ecc5d,'chatWebsiteAddressOrigin':_0x34a958?_0x4caeb1:_0x391ee0[_0xbfa2('0x67')],'remote':_0x391ee0[_0xbfa2('0x11b')],'query':querystring[_0xbfa2('0x48')](_['merge'](_0x391ee0[_0xbfa2('0x6c')]({'plain':!![]}),{'customerIp':_0x10c637[_0xbfa2('0xbc')]['x-forwarded-for']||_0x10c637[_0xbfa2('0xbc')][_0xbfa2('0x11c')]||_0x10c637['connection']['remoteAddress']||_0x10c637['ip'],'referer':_0x10c637[_0xbfa2('0xbc')][_0xbfa2('0x3e')],'openedInteractions':_0x56532e,'maxInteractions':_0x2e6220,'virtual':_0x2d97f5[_0xbfa2('0x11d')],'online':_0x2edfbf,'custom':_0x2d97f5,'address':_0x34a958?_0x4caeb1:null}))['replace'](/'/g,'\x5c\x27')};_0x3043ad['send'](ejs[_0xbfa2('0xe8')](Mustache[_0xbfa2('0xe8')](_0x2fbe1b,_0x27cfe4),{'proactiveActions':_0x1a4931,'alignment':_0x391ee0[_0xbfa2('0x11e')],'verticalAlignment':_0x391ee0[_0xbfa2('0x11f')],'div_color':_0x391ee0[_0xbfa2('0x10d')],'labelText':_0x391ee0[_0xbfa2('0x120')],'text_color':_0x391ee0[_0xbfa2('0x121')],'text_button_color':_0x391ee0[_0xbfa2('0x122')],'button_color':_0x391ee0['color_button'],'background_color':_0x391ee0[_0xbfa2('0x123')],'hideWhenOffline':_0x391ee0[_0xbfa2('0x124')],'intervalId':_0x391ee0[_0xbfa2('0x125')],'isDevelopment':_0x1db897,'chatVersion':_0x4ecc5d}));})['catch'](handleError(_0x3043ad,null));};exports[_0xbfa2('0x126')]=function(_0x20eef7,_0x23a94f){var _0x4e0d05=_0x20eef7['params']['id'];var _0x29aace=_0x20eef7[_0xbfa2('0x66')];var _0x3a7171=0xc8;var _0x24efd7=null;return db[_0xbfa2('0x127')][_0xbfa2('0xf2')]({'isolationLevel':db[_0xbfa2('0x127')][_0xbfa2('0x128')][_0xbfa2('0x129')][_0xbfa2('0x12a')]},function(_0x59a06b){return db['ChatWebsite'][_0xbfa2('0x78')]({'where':{'id':_0x4e0d05},'transaction':_0x59a06b})[_0xbfa2('0x2f')](function(_0x232e1a){if(_0x232e1a){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x4e0d05},'transaction':_0x59a06b})[_0xbfa2('0x2f')](function(){var _0x426936=_[_0xbfa2('0x4b')](_0x29aace,function(_0x16f24a){_0x16f24a[_0xbfa2('0x76')]=_0x4e0d05;return _0x16f24a;});return db[_0xbfa2('0x12b')]['bulkCreate'](_0x426936,{'transaction':_0x59a06b});});}else{_0x3a7171=0x194;_0x24efd7=[];}});})['then'](function(){if(_0x3a7171!==0x194){return db[_0xbfa2('0x12b')][_0xbfa2('0x12c')]({'where':{'ChatWebsiteId':_0x4e0d05},'order':_0xbfa2('0xb6')})[_0xbfa2('0x2f')](function(_0x251c7f){_0x24efd7=_0x251c7f;});}})[_0xbfa2('0x60')](function(_0x417090){_0x3a7171=0x1f4;logger[_0xbfa2('0x25')](_0x417090[_0xbfa2('0x33')]);if(_0x417090['name']){delete _0x417090[_0xbfa2('0x34')];}_0x24efd7=_0x417090;})[_0xbfa2('0x12d')](function(){if(_0x24efd7===null){_0x23a94f[_0xbfa2('0x28')](_0x3a7171);}else{if(_0x3a7171===0x1f4){_0x23a94f[_0xbfa2('0x2a')](_0x3a7171)[_0xbfa2('0xdd')](_0x24efd7);}else{_0x23a94f['status'](_0x3a7171)[_0xbfa2('0x12e')](_0x24efd7);}}});};exports[_0xbfa2('0x12f')]=function(_0x5418ad,_0x3c756f){var _0xa838b5={};var _0x4bd2dd={};var _0xfb3358;var _0x13d404;return db[_0xbfa2('0x4c')]['findOne']({'where':{'id':_0x5418ad[_0xbfa2('0x62')]['id']}})['then'](handleEntityNotFound(_0x3c756f,null))['then'](function(_0x42ce7d){if(_0x42ce7d){_0xfb3358=_0x42ce7d;_0x4bd2dd[_0xbfa2('0x44')]=_[_0xbfa2('0x63')](db[_0xbfa2('0x12b')][_0xbfa2('0x4d')]);_0x4bd2dd[_0xbfa2('0x50')]=_[_0xbfa2('0x63')](_0x5418ad[_0xbfa2('0x50')]);_0x4bd2dd['filters']=_[_0xbfa2('0x52')](_0x4bd2dd[_0xbfa2('0x44')],_0x4bd2dd[_0xbfa2('0x50')]);_0xa838b5[_0xbfa2('0x54')]=_['intersection'](_0x4bd2dd[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x5418ad[_0xbfa2('0x50')][_0xbfa2('0x53')]));_0xa838b5[_0xbfa2('0x54')]=_0xa838b5[_0xbfa2('0x54')][_0xbfa2('0x55')]?_0xa838b5[_0xbfa2('0x54')]:_0x4bd2dd['model'];_0xa838b5[_0xbfa2('0x57')]=qs[_0xbfa2('0x58')](_0x5418ad[_0xbfa2('0x50')][_0xbfa2('0x58')]);_0xa838b5[_0xbfa2('0x59')]=qs[_0xbfa2('0x51')](_[_0xbfa2('0x7a')](_0x5418ad[_0xbfa2('0x50')],_0x4bd2dd[_0xbfa2('0x51')]));if(_0x5418ad[_0xbfa2('0x50')]['filter']){_0xa838b5[_0xbfa2('0x59')]=_['merge'](_0xa838b5['where'],{'$or':_[_0xbfa2('0x4b')](_0xa838b5['attributes'],function(_0x4f0d33){var _0x1da0b9={};_0x1da0b9[_0x4f0d33]={'$like':'%'+_0x5418ad[_0xbfa2('0x50')][_0xbfa2('0x5a')]+'%'};return _0x1da0b9;})});}_0xa838b5=_[_0xbfa2('0x5c')]({},_0xa838b5,_0x5418ad[_0xbfa2('0x5d')]);return _0xfb3358['getApplications'](_0xa838b5);}})[_0xbfa2('0x2f')](function(_0x2326da){if(_0x2326da){_0x13d404=_0x2326da[_0xbfa2('0x55')];if(!_0x5418ad[_0xbfa2('0x50')][_0xbfa2('0x56')]('nolimit')){_0xa838b5[_0xbfa2('0x2d')]=qs[_0xbfa2('0x2d')](_0x5418ad[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0xa838b5[_0xbfa2('0x2b')]=qs[_0xbfa2('0x2b')](_0x5418ad[_0xbfa2('0x50')][_0xbfa2('0x2b')]);}return _0xfb3358[_0xbfa2('0x12f')](_0xa838b5);}})[_0xbfa2('0x2f')](function(_0x8a5e17){if(_0x8a5e17){return _0x8a5e17?{'count':_0x13d404,'rows':_0x8a5e17}:null;}})[_0xbfa2('0x2f')](respondWithResult(_0x3c756f,null))[_0xbfa2('0x60')](handleError(_0x3c756f,null));};exports[_0xbfa2('0x130')]=function(_0x14015b,_0x23ce1b){return db[_0xbfa2('0x131')][_0xbfa2('0x64')]({'where':{'id':_0x14015b['params']['id']}})['then'](handleEntityNotFound(_0x23ce1b,null))[_0xbfa2('0x2f')](function(_0x26ae79){if(_0x26ae79){return _0x26ae79[_0xbfa2('0x130')](_0x14015b[_0xbfa2('0x66')]['ids'],_['omit'](_0x14015b[_0xbfa2('0x66')],[_0xbfa2('0x7f'),'id'])||{});}})[_0xbfa2('0x2f')](respondWithResult(_0x23ce1b,null))[_0xbfa2('0x60')](handleError(_0x23ce1b,null));};exports[_0xbfa2('0x132')]=function(_0x587b0c,_0x3c1962){var _0x136fe9={};var _0x4b338b={};var _0x1bb2ea;var _0x21f97d;return db['ChatWebsite'][_0xbfa2('0x78')]({'where':{'id':_0x587b0c['params']['id']}})['then'](handleEntityNotFound(_0x3c1962,null))['then'](function(_0x4e240f){if(_0x4e240f){_0x1bb2ea=_0x4e240f;_0x4b338b['model']=_[_0xbfa2('0x63')](db[_0xbfa2('0x133')][_0xbfa2('0x4d')]);_0x4b338b['query']=_[_0xbfa2('0x63')](_0x587b0c[_0xbfa2('0x50')]);_0x4b338b[_0xbfa2('0x51')]=_[_0xbfa2('0x52')](_0x4b338b[_0xbfa2('0x44')],_0x4b338b['query']);_0x136fe9[_0xbfa2('0x54')]=_[_0xbfa2('0x52')](_0x4b338b[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x587b0c[_0xbfa2('0x50')][_0xbfa2('0x53')]));_0x136fe9[_0xbfa2('0x54')]=_0x136fe9['attributes'][_0xbfa2('0x55')]?_0x136fe9[_0xbfa2('0x54')]:_0x4b338b[_0xbfa2('0x44')];_0x136fe9['order']=qs[_0xbfa2('0x58')](_0x587b0c[_0xbfa2('0x50')][_0xbfa2('0x58')]);_0x136fe9[_0xbfa2('0x59')]=qs[_0xbfa2('0x51')](_['pick'](_0x587b0c[_0xbfa2('0x50')],_0x4b338b[_0xbfa2('0x51')]));if(_0x587b0c[_0xbfa2('0x50')][_0xbfa2('0x5a')]){_0x136fe9[_0xbfa2('0x59')]=_[_0xbfa2('0x5c')](_0x136fe9['where'],{'$or':_[_0xbfa2('0x4b')](_0x136fe9[_0xbfa2('0x54')],function(_0x357eea){var _0x4bebc9={};_0x4bebc9[_0x357eea]={'$like':'%'+_0x587b0c[_0xbfa2('0x50')][_0xbfa2('0x5a')]+'%'};return _0x4bebc9;})});}_0x136fe9=_[_0xbfa2('0x5c')]({},_0x136fe9,_0x587b0c['options']);return _0x1bb2ea[_0xbfa2('0x132')](_0x136fe9);}})['then'](function(_0x5297d4){if(_0x5297d4){_0x21f97d=_0x5297d4[_0xbfa2('0x55')];if(!_0x587b0c['query'][_0xbfa2('0x56')]('nolimit')){_0x136fe9[_0xbfa2('0x2d')]=qs[_0xbfa2('0x2d')](_0x587b0c[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0x136fe9[_0xbfa2('0x2b')]=qs[_0xbfa2('0x2b')](_0x587b0c[_0xbfa2('0x50')][_0xbfa2('0x2b')]);}return _0x1bb2ea[_0xbfa2('0x132')](_0x136fe9);}})[_0xbfa2('0x2f')](function(_0x25762e){if(_0x25762e){return _0x25762e?{'count':_0x21f97d,'rows':_0x25762e}:null;}})[_0xbfa2('0x2f')](respondWithResult(_0x3c1962,null))[_0xbfa2('0x60')](handleError(_0x3c1962,null));};exports[_0xbfa2('0x134')]=function(_0x20f848,_0x5b78d4){var _0x1e745e=_0x20f848['query'][_0xbfa2('0x135')]===_0xbfa2('0x136')?_0xbfa2('0x137'):_0xbfa2('0x138');return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'attributes':['id',_0x1e745e],'where':{'id':_0x20f848[_0xbfa2('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b78d4,null))[_0xbfa2('0x2f')](function(_0x46e94c){if(_0x46e94c){var _0x579c98=_0x46e94c[_0x1e745e];var _0x182f25=_0x579c98&&_0x579c98[_0xbfa2('0x139')]?_0x579c98[_0xbfa2('0x139')]:[];_0x5b78d4[_0xbfa2('0xdd')]({'fromKey':_[_0xbfa2('0x93')](_0x579c98[_0xbfa2('0x13a')])?undefined:_0x579c98[_0xbfa2('0x13a')],'count':_0x182f25[_0xbfa2('0x55')],'rows':_0x182f25});}})[_0xbfa2('0x60')](handleError(_0x5b78d4,null));};exports[_0xbfa2('0x13b')]=function(_0x5afa7d,_0x55e149){var _0x329122={'raw':![],'where':{}};var _0x40918b={};var _0x5ad658={'count':0x0,'rows':[]};return db[_0xbfa2('0x4c')][_0xbfa2('0x78')]({'where':{'id':_0x5afa7d[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x55e149,null))['then'](function(_0x2d9044){if(_0x2d9044){_0x40918b[_0xbfa2('0x44')]=_[_0xbfa2('0x63')](db[_0xbfa2('0xeb')][_0xbfa2('0x4d')]);_0x40918b[_0xbfa2('0x50')]=_[_0xbfa2('0x63')](_0x5afa7d[_0xbfa2('0x50')]);_0x40918b[_0xbfa2('0x51')]=_['intersection'](_0x40918b[_0xbfa2('0x44')],_0x40918b[_0xbfa2('0x50')]);_0x329122['attributes']=_[_0xbfa2('0x52')](_0x40918b[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x5afa7d[_0xbfa2('0x50')]['fields']));_0x329122[_0xbfa2('0x54')]=_0x329122[_0xbfa2('0x54')]['length']?_0x329122[_0xbfa2('0x54')]:_0x40918b[_0xbfa2('0x44')];if(!_0x5afa7d['query'][_0xbfa2('0x56')](_0xbfa2('0x79'))){_0x329122[_0xbfa2('0x2d')]=qs[_0xbfa2('0x2d')](_0x5afa7d[_0xbfa2('0x50')][_0xbfa2('0x2d')]);_0x329122[_0xbfa2('0x2b')]=qs[_0xbfa2('0x2b')](_0x5afa7d['query'][_0xbfa2('0x2b')]);}_0x329122[_0xbfa2('0x57')]=qs[_0xbfa2('0x58')](_0x5afa7d[_0xbfa2('0x50')][_0xbfa2('0x58')]);_0x329122[_0xbfa2('0x59')]=qs['filters'](_[_0xbfa2('0x7a')](_0x5afa7d[_0xbfa2('0x50')],_0x40918b[_0xbfa2('0x51')]));_0x329122['where'][_0xbfa2('0x76')]=_0x2d9044['id'];if(_0x5afa7d[_0xbfa2('0x50')]['filter']){_0x329122[_0xbfa2('0x59')]=_[_0xbfa2('0x5c')](_0x329122[_0xbfa2('0x59')],{'$or':_[_0xbfa2('0x4b')](_0x329122[_0xbfa2('0x54')],function(_0xaabda0){var _0x3bd993={};_0x3bd993[_0xaabda0]={'$like':'%'+_0x5afa7d['query'][_0xbfa2('0x5a')]+'%'};return _0x3bd993;})});}_0x329122=_['merge']({},_0x329122,_0x5afa7d['options']);return db[_0xbfa2('0xeb')][_0xbfa2('0x2e')]({'where':_0x329122[_0xbfa2('0x59')]})[_0xbfa2('0x2f')](function(_0x193c3e){_0x5ad658['count']=_0x193c3e;if(_0x5afa7d[_0xbfa2('0x50')][_0xbfa2('0x5e')]){_0x329122[_0xbfa2('0x7c')]=[{'all':!![]}];}else{_0x329122['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0xbfa2('0x7d')](_0x329122);})[_0xbfa2('0x2f')](function(_0x11cba6){_0x5ad658[_0xbfa2('0x5f')]=_0x11cba6;return _0x5ad658;});}})[_0xbfa2('0x2f')](respondWithFilteredResult(_0x55e149,_0x329122))[_0xbfa2('0x60')](handleError(_0x55e149,null));};exports[_0xbfa2('0x13c')]=function(_0x505dc0,_0x19e869){return db[_0xbfa2('0x4c')]['find']({'where':{'id':_0x505dc0[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x19e869,null))[_0xbfa2('0x2f')](function(_0x16cfc4){if(_0x16cfc4){return _0x16cfc4[_0xbfa2('0x13c')](_0x505dc0[_0xbfa2('0x66')]['ids'],_[_0xbfa2('0x107')](_0x505dc0[_0xbfa2('0x66')],[_0xbfa2('0x7f'),'id'])||{})[_0xbfa2('0x13d')](function(_0x281f44){for(var _0x28458d=0x0;_0x28458d<_0x505dc0[_0xbfa2('0x66')][_0xbfa2('0x7f')][_0xbfa2('0x55')];_0x28458d+=0x1){socket['emit'](_0xbfa2('0x13e'),{'UserId':Number(_0x505dc0[_0xbfa2('0x66')][_0xbfa2('0x7f')][_0x28458d]),'ChatWebsiteId':Number(_0x505dc0['params']['id'])});}return _0x281f44;});}})[_0xbfa2('0x2f')](respondWithResult(_0x19e869,null))[_0xbfa2('0x60')](handleError(_0x19e869,null));};exports[_0xbfa2('0x13f')]=function(_0xb9e403,_0x4b62d1){return db[_0xbfa2('0x4c')][_0xbfa2('0x64')]({'where':{'id':_0xb9e403[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x4b62d1,null))[_0xbfa2('0x2f')](function(_0x41fbc2){if(_0x41fbc2){return _0x41fbc2['removeAgents'](_0xb9e403[_0xbfa2('0x50')][_0xbfa2('0x7f')])[_0xbfa2('0x2f')](function(){if(_[_0xbfa2('0x140')](_0xb9e403['query']['ids'])){for(var _0x2e146c=0x0;_0x2e146c<_0xb9e403[_0xbfa2('0x50')][_0xbfa2('0x7f')]['length'];_0x2e146c+=0x1){socket['emit'](_0xbfa2('0x141'),{'UserId':Number(_0xb9e403[_0xbfa2('0x50')][_0xbfa2('0x7f')][_0x2e146c]),'ChatWebsiteId':Number(_0xb9e403['params']['id'])});}}else{socket[_0xbfa2('0x142')](_0xbfa2('0x141'),{'UserId':Number(_0xb9e403['query']['ids']),'ChatWebsiteId':Number(_0xb9e403[_0xbfa2('0x62')]['id'])});}});}})[_0xbfa2('0x2f')](respondWithStatusCode(_0x4b62d1,null))[_0xbfa2('0x60')](handleError(_0x4b62d1,null));};exports[_0xbfa2('0x143')]=function(_0x5111ec,_0x25ed66){var _0x234360={};var _0x7abbda={};var _0x54a6de;var _0x46d92e;return db[_0xbfa2('0x4c')][_0xbfa2('0x78')]({'where':{'id':_0x5111ec[_0xbfa2('0x62')]['id']}})[_0xbfa2('0x2f')](handleEntityNotFound(_0x25ed66,null))[_0xbfa2('0x2f')](function(_0x29f310){if(_0x29f310){_0x54a6de=_0x29f310;_0x7abbda[_0xbfa2('0x44')]=_['keys'](db[_0xbfa2('0xcc')][_0xbfa2('0x4d')]);_0x7abbda[_0xbfa2('0x50')]=_[_0xbfa2('0x63')](_0x5111ec[_0xbfa2('0x50')]);_0x7abbda[_0xbfa2('0x51')]=_[_0xbfa2('0x52')](_0x7abbda[_0xbfa2('0x44')],_0x7abbda[_0xbfa2('0x50')]);_0x234360[_0xbfa2('0x54')]=_[_0xbfa2('0x52')](_0x7abbda[_0xbfa2('0x44')],qs[_0xbfa2('0x53')](_0x5111ec['query'][_0xbfa2('0x53')]));_0x234360[_0xbfa2('0x54')]=_0x234360[_0xbfa2('0x54')]['length']?_0x234360[_0xbfa2('0x54')]:_0x7abbda[_0xbfa2('0x44')];_0x234360['order']=qs[_0xbfa2('0x58')](_0x5111ec[_0xbfa2('0x50')][_0xbfa2('0x58')]);_0x234360[_0xbfa2('0x59')]=qs['filters'](_['pick'](_0x5111ec[_0xbfa2('0x50')],_0x7abbda['filters']));if(_0x5111ec[_0xbfa2('0x50')][_0xbfa2('0x5a')]){_0x234360[_0xbfa2('0x59')]=_[_0xbfa2('0x5c')](_0x234360['where'],{'$or':_['map'](_0x234360[_0xbfa2('0x54')],function(_0xc75a24){var _0x202631={};_0x202631[_0xc75a24]={'$like':'%'+_0x5111ec['query'][_0xbfa2('0x5a')]+'%'};return _0x202631;})});}_0x234360=_['merge']({},_0x234360,_0x5111ec[_0xbfa2('0x5d')]);return _0x54a6de[_0xbfa2('0x143')](_0x234360);}})[_0xbfa2('0x2f')](function(_0x21b3d2){if(_0x21b3d2){_0x46d92e=_0x21b3d2['length'];if(!_0x5111ec[_0xbfa2('0x50')][_0xbfa2('0x56')]('nolimit')){_0x234360[_0xbfa2('0x2d')]=qs['limit'](_0x5111ec['query'][_0xbfa2('0x2d')]);_0x234360['offset']=qs['offset'](_0x5111ec[_0xbfa2('0x50')]['offset']);}return _0x54a6de[_0xbfa2('0x143')](_0x234360);}})[_0xbfa2('0x2f')](function(_0x4ca95c){if(_0x4ca95c){return _0x4ca95c?{'count':_0x46d92e,'rows':_0x4ca95c}:null;}})['then'](respondWithResult(_0x25ed66,null))[_0xbfa2('0x60')](handleError(_0x25ed66,null));}; \ No newline at end of file +var _0x7118=['headers','origin','http://localhost:9000','testWebsiteWithWildcard','connection','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','findAndCountAll','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','path','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','URL','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','fieldName','key','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','body','address','forEach','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','describe','ChatWebsiteId','Disposition','getDispositions','keys','includeAll','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','notify','chat','from','From\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','mapKey','DESC','ChatApplication','Applications','Intervals','interval','account','applications','orderBy','priority','asc','list','List','ListId','Contacts','defaults','contact','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','forcedOwnership','queueId','ChatQueue','unshift','waitForTheAssignedQueue','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','User','Owner','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','ifTime','server/files/chat/iframe.ejs'];(function(_0x1bc504,_0x50a8bf){var _0x17656e=function(_0x16ca1b){while(--_0x16ca1b){_0x1bc504['push'](_0x1bc504['shift']());}};_0x17656e(++_0x50a8bf);}(_0x7118,0x159));var _0x8711=function(_0x32843c,_0x205bbf){_0x32843c=_0x32843c-0x0;var _0x5e2059=_0x7118[_0x32843c];return _0x5e2059;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require(_0x8711('0x0'));var ejs=require(_0x8711('0x1'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8711('0x2'));var querystring=require(_0x8711('0x3'));var htmlToText=require(_0x8711('0x4'));var Redis=require(_0x8711('0x5'));var jayson=require(_0x8711('0x6'));var qs=require(_0x8711('0x7'));var logger=require(_0x8711('0x8'))('api');var config=require(_0x8711('0x9'));var APIBadRequestError=require(_0x8711('0xa'))[_0x8711('0xb')];var APINotFoundError=require(_0x8711('0xa'))[_0x8711('0xc')];var APIOutOfIntervalError=require(_0x8711('0xa'))[_0x8711('0xd')];var APIHandleError=require(_0x8711('0xa'))[_0x8711('0xe')];var APIConflictError=require(_0x8711('0xa'))[_0x8711('0xf')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0x8711('0x10')];var db=require(_0x8711('0x11'))['db'];config[_0x8711('0x12')]=_['defaults'](config['redis'],{'host':_0x8711('0x13'),'port':0x18eb});var socket=require(_0x8711('0x14'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x8711('0x15')](socket);var client=jayson[_0x8711('0x16')][_0x8711('0x17')]({'port':0x232c});var client9002=jayson[_0x8711('0x16')][_0x8711('0x17')]({'port':0x232a});var client9003=jayson[_0x8711('0x16')][_0x8711('0x17')]({'port':0x232b});var client9001=jayson['client'][_0x8711('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x363bcd,_0x13f394,_0x2e12ec,_0x3ab905){return new Promise(function(_0x4628e9,_0x57fedb){var _0x2f96a0=_0x3ab905||client;return _0x2f96a0[_0x8711('0x18')](_0x363bcd,_0x2e12ec)[_0x8711('0x19')](function(_0xe1e9b3){logger[_0x8711('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x13f394,'request\x20sent');logger['debug'](_0x8711('0x1b'),_0x13f394,_0x8711('0x1c'),JSON[_0x8711('0x1d')](_0xe1e9b3));if(_0xe1e9b3['error']){if(_0xe1e9b3['error'][_0x8711('0x1e')]===0x1f4){logger[_0x8711('0x1f')](_0x8711('0x20'),_0x13f394,_0xe1e9b3[_0x8711('0x1f')][_0x8711('0x21')]);return _0x57fedb(_0xe1e9b3[_0x8711('0x1f')][_0x8711('0x21')]);}logger[_0x8711('0x1f')](_0x8711('0x20'),_0x13f394,_0xe1e9b3[_0x8711('0x1f')]['message']);return _0x4628e9(_0xe1e9b3[_0x8711('0x1f')][_0x8711('0x21')]);}else{logger[_0x8711('0x1a')](_0x8711('0x20'),_0x13f394,'request\x20sent');_0x4628e9(_0xe1e9b3[_0x8711('0x22')][_0x8711('0x21')]);}})[_0x8711('0x23')](function(_0x5ab925){logger[_0x8711('0x1f')](_0x8711('0x20'),_0x13f394,_0x5ab925);_0x57fedb(_0x5ab925);});});}function respondWithStatusCode(_0x3e8281,_0x217197){_0x217197=_0x217197||0xcc;return function(_0x3f937b){if(_0x3f937b){return _0x3e8281['sendStatus'](_0x217197);}return _0x3e8281['status'](_0x217197)['end']();};}function respondWithResult(_0x2ad1fa,_0x16ea3b){_0x16ea3b=_0x16ea3b||0xc8;return function(_0x2d0901){if(_0x2d0901){return _0x2ad1fa[_0x8711('0x24')](_0x16ea3b)[_0x8711('0x25')](_0x2d0901);}};}function respondWithFilteredResult(_0x254b35,_0x359093){return function(_0x3ca2b5){if(_0x3ca2b5){var _0x398097=typeof _0x359093['offset']===_0x8711('0x26')&&typeof _0x359093['limit']===_0x8711('0x26');var _0xd0c671=_0x3ca2b5[_0x8711('0x27')];var _0x5a11dd=_0x398097?0x0:_0x359093[_0x8711('0x28')];var _0x5e6111=_0x398097?_0x3ca2b5[_0x8711('0x27')]:_0x359093[_0x8711('0x28')]+_0x359093[_0x8711('0x29')];var _0x5c4fcc;if(_0x5e6111>=_0xd0c671){_0x5e6111=_0xd0c671;_0x5c4fcc=0xc8;}else{_0x5c4fcc=0xce;}_0x254b35['status'](_0x5c4fcc);return _0x254b35[_0x8711('0x2a')](_0x8711('0x2b'),_0x5a11dd+'-'+_0x5e6111+'/'+_0xd0c671)[_0x8711('0x25')](_0x3ca2b5);}return null;};}function saveUpdates(_0x6ab2c7){return function(_0x1c2fae){if(_0x1c2fae){return _0x1c2fae[_0x8711('0x2c')](_0x6ab2c7)[_0x8711('0x19')](function(_0x64cf25){return _0x64cf25;});}return null;};}function removeEntity(_0x356303){return function(_0x36f3bd){if(_0x36f3bd){return _0x36f3bd['destroy']()[_0x8711('0x19')](function(){var _0x11c1e9=_0x36f3bd[_0x8711('0x2d')]({'plain':!![]});var _0x285390=_0x8711('0x2e');return db[_0x8711('0x2f')][_0x8711('0x30')]({'where':{'type':_0x285390,'resourceId':_0x11c1e9['id']}})[_0x8711('0x19')](function(){return _0x36f3bd;});})[_0x8711('0x19')](function(){_0x356303[_0x8711('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18643f){return function(_0x318e5d){if(!_0x318e5d){_0x18643f[_0x8711('0x31')](0x194);}return _0x318e5d;};}function handleError(_0x33b1e7,_0x2ddf9f){_0x2ddf9f=_0x2ddf9f||0x1f4;return function(_0x4cbf06){logger[_0x8711('0x1f')](_0x4cbf06[_0x8711('0x32')]);if(_0x4cbf06[_0x8711('0x33')]){delete _0x4cbf06['name'];}_0x33b1e7[_0x8711('0x24')](_0x2ddf9f)[_0x8711('0x34')](_0x4cbf06);};}function createInteractionObject(_0x612a46,_0x1f2b1f,_0x1953ef,_0x14922d){var _0x263be0=require('user-agent-parser');var _0xd805b9=new _0x263be0();var _0x1c1f1b=_0xd805b9[_0x8711('0x35')](_0x1953ef[_0x8711('0x36')])['getResult']();var _0x5de511=_0x1f2b1f[_0x8711('0x37')];if(_0x1953ef[_0x8711('0x38')]){_0x5de511=_0x1953ef[_0x8711('0x38')];}else if(_0x1953ef[_0x8711('0x39')]){_0x5de511=_[_0x8711('0x3a')](_0x1953ef[_0x8711('0x39')][_0x8711('0x3b')](','));}return{'ContactId':_0x14922d['id'],'ChatWebsiteId':_0x612a46,'from':(_0x14922d[_0x8711('0x3c')]||'')+'\x20'+(_0x14922d[_0x8711('0x3d')]||''),'customerIp':_0x5de511,'customerPort':_0x1953ef[_0x8711('0x3e')]?_0x1953ef[_0x8711('0x3e')]:null,'referer':_0x1f2b1f[_0x8711('0x3f')],'browserName':_0x1c1f1b[_0x8711('0x40')][_0x8711('0x33')]&&_0x1c1f1b[_0x8711('0x40')][_0x8711('0x41')]?util[_0x8711('0x42')](_0x8711('0x43'),_0x1c1f1b[_0x8711('0x40')][_0x8711('0x33')],_0x1c1f1b[_0x8711('0x40')]['version']):_0x8711('0x44'),'browserVersion':_0x1c1f1b['browser'][_0x8711('0x41')]||_0x8711('0x44'),'osName':util[_0x8711('0x42')](_0x8711('0x43'),_0x1c1f1b['os']['name'],_0x1c1f1b['os'][_0x8711('0x41')]),'osVersion':_0x1c1f1b['os'][_0x8711('0x41')],'deviceModel':_0x1c1f1b[_0x8711('0x45')][_0x8711('0x46')]&&_0x1c1f1b[_0x8711('0x45')][_0x8711('0x47')]?util['format'](_0x8711('0x48'),_0x1c1f1b[_0x8711('0x45')][_0x8711('0x46')],_0x1c1f1b[_0x8711('0x45')]['vendor'],_0x1c1f1b[_0x8711('0x45')][_0x8711('0x49')]):null,'deviceVendor':_0x1c1f1b[_0x8711('0x45')][_0x8711('0x47')],'deviceType':_0x1c1f1b[_0x8711('0x45')]['type'],'formData':JSON['stringify'](_0x1f2b1f)};}exports[_0x8711('0x4a')]=function(_0x291d0e,_0x5579a6){var _0x9fba5c={'include':[{'model':db[_0x8711('0x4b')],'as':'mandatoryDispositionPause'}]},_0x22a256={},_0x344548={'count':0x0,'rows':[]};var _0x34ef5a=_[_0x8711('0x4c')](db[_0x8711('0x4d')]['rawAttributes'],function(_0x3cb781){return{'name':_0x3cb781[_0x8711('0x4e')],'type':_0x3cb781['type'][_0x8711('0x4f')]};});_0x22a256[_0x8711('0x46')]=_['map'](_0x34ef5a,_0x8711('0x33'));_0x22a256[_0x8711('0x50')]=_['keys'](_0x291d0e[_0x8711('0x50')]);_0x22a256[_0x8711('0x51')]=_[_0x8711('0x52')](_0x22a256[_0x8711('0x46')],_0x22a256['query']);_0x9fba5c[_0x8711('0x53')]=_[_0x8711('0x52')](_0x22a256['model'],qs[_0x8711('0x54')](_0x291d0e[_0x8711('0x50')]['fields']));_0x9fba5c['attributes']=_0x9fba5c['attributes']['length']?_0x9fba5c[_0x8711('0x53')]:_0x22a256[_0x8711('0x46')];if(!_0x291d0e[_0x8711('0x50')][_0x8711('0x55')](_0x8711('0x56'))){_0x9fba5c[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x291d0e['query']['limit']);_0x9fba5c['offset']=qs[_0x8711('0x28')](_0x291d0e[_0x8711('0x50')][_0x8711('0x28')]);}_0x9fba5c[_0x8711('0x57')]=qs[_0x8711('0x58')](_0x291d0e[_0x8711('0x50')]['sort']);_0x9fba5c[_0x8711('0x59')]=qs[_0x8711('0x51')](_[_0x8711('0x5a')](_0x291d0e['query'],_0x22a256[_0x8711('0x51')]),_0x34ef5a);if(_0x291d0e[_0x8711('0x50')][_0x8711('0x5b')]){_0x9fba5c[_0x8711('0x59')]=_[_0x8711('0x5c')](_0x9fba5c[_0x8711('0x59')],{'$or':_[_0x8711('0x4c')](_0x34ef5a,function(_0x171f3f){if(_0x171f3f['type']!==_0x8711('0x5d')){var _0x55d8b7={};_0x55d8b7[_0x171f3f[_0x8711('0x33')]]={'$like':'%'+_0x291d0e['query']['filter']+'%'};return _0x55d8b7;}})});}_0x9fba5c=_['merge']({},_0x9fba5c,_0x291d0e[_0x8711('0x5e')]);var _0x1ee501={'where':_0x9fba5c['where']};return db[_0x8711('0x4d')]['count'](_0x1ee501)[_0x8711('0x19')](function(_0x152863){_0x344548['count']=_0x152863;if(_0x291d0e[_0x8711('0x50')]['includeAll']){_0x9fba5c[_0x8711('0x5f')]=[{'all':!![]}];}return db[_0x8711('0x4d')]['findAll'](_0x9fba5c);})['then'](function(_0x44e243){_0x344548['rows']=_0x44e243;return _0x344548;})[_0x8711('0x19')](respondWithFilteredResult(_0x5579a6,_0x9fba5c))[_0x8711('0x23')](handleError(_0x5579a6,null));};exports[_0x8711('0x60')]=function(_0x158d97,_0x3c03bf){var _0x5dfb08={'raw':![],'where':{'id':_0x158d97[_0x8711('0x61')]['id']},'include':[{'model':db[_0x8711('0x4b')],'as':_0x8711('0x62')}]},_0x20bceb={};_0x20bceb[_0x8711('0x46')]=_['keys'](db[_0x8711('0x4d')][_0x8711('0x63')]);_0x20bceb[_0x8711('0x50')]=_['keys'](_0x158d97['query']);_0x20bceb[_0x8711('0x51')]=_[_0x8711('0x52')](_0x20bceb['model'],_0x20bceb['query']);_0x5dfb08['attributes']=_[_0x8711('0x52')](_0x20bceb[_0x8711('0x46')],qs[_0x8711('0x54')](_0x158d97[_0x8711('0x50')][_0x8711('0x54')]));_0x5dfb08[_0x8711('0x53')]=_0x5dfb08[_0x8711('0x53')][_0x8711('0x64')]?_0x5dfb08[_0x8711('0x53')]:_0x20bceb[_0x8711('0x46')];if(_0x158d97[_0x8711('0x50')]['includeAll']){_0x5dfb08[_0x8711('0x5f')]=[{'all':!![]}];}_0x5dfb08=_[_0x8711('0x5c')]({},_0x5dfb08,_0x158d97[_0x8711('0x5e')]);return db[_0x8711('0x4d')][_0x8711('0x65')](_0x5dfb08)[_0x8711('0x19')](handleEntityNotFound(_0x3c03bf,null))[_0x8711('0x19')](respondWithResult(_0x3c03bf,null))[_0x8711('0x23')](handleError(_0x3c03bf,null));};exports[_0x8711('0x66')]=function(_0x397c02,_0x5706f5){var _0x2d4142=null;_0x397c02[_0x8711('0x67')][_0x8711('0x68')]['split'](',')[_0x8711('0x69')](_0x19f845=>{if(_0x19f845[_0x8711('0x6a')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x19f845['trim']())){_0x2d4142=new APIBadRequestError('\x22'+_0x19f845['trim']()+_0x8711('0x6b'));}});if(_0x2d4142){return handleError(_0x5706f5,null)(_0x2d4142);}return db[_0x8711('0x4d')]['create'](_0x397c02[_0x8711('0x67')],{})[_0x8711('0x19')](function(_0x4e6d39){var _0x1c4c70=_0x397c02[_0x8711('0x6c')][_0x8711('0x2d')]({'plain':!![]});if(!_0x1c4c70)throw new Error(_0x8711('0x6d'));if(_0x1c4c70['role']===_0x8711('0x6c')){var _0xf5326c=_0x4e6d39['get']({'plain':!![]});var _0x3ceb32=_0x8711('0x2e');return db['UserProfileSection'][_0x8711('0x65')]({'where':{'name':_0x3ceb32,'userProfileId':_0x1c4c70['userProfileId']},'raw':!![]})[_0x8711('0x19')](function(_0x3c86d3){if(_0x3c86d3&&_0x3c86d3[_0x8711('0x6e')]===0x0){return db[_0x8711('0x2f')][_0x8711('0x66')]({'name':_0xf5326c[_0x8711('0x33')],'resourceId':_0xf5326c['id'],'type':_0x3c86d3[_0x8711('0x33')],'sectionId':_0x3c86d3['id']},{})[_0x8711('0x19')](function(){return _0x4e6d39;});}else{return _0x4e6d39;}})[_0x8711('0x23')](function(_0x320dae){logger[_0x8711('0x1f')](_0x8711('0x6f'),_0x320dae);throw _0x320dae;});}return _0x4e6d39;})[_0x8711('0x19')](respondWithResult(_0x5706f5,0xc9))[_0x8711('0x23')](handleError(_0x5706f5,null));};exports[_0x8711('0x2c')]=function(_0x368323,_0x3f5371){var _0x58a7ed=null;_0x368323[_0x8711('0x67')][_0x8711('0x68')][_0x8711('0x3b')](',')['forEach'](_0x4e3d63=>{if(_0x4e3d63[_0x8711('0x6a')]()!==''&&!wildcardUtils[_0x8711('0x70')](_0x4e3d63[_0x8711('0x6a')]())){_0x58a7ed=new APIBadRequestError('\x22'+_0x4e3d63['trim']()+_0x8711('0x6b'));}});if(_0x58a7ed){return handleError(_0x3f5371,null)(_0x58a7ed);}if(_0x368323['body']['id']){delete _0x368323[_0x8711('0x67')]['id'];}return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x368323[_0x8711('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x8711('0x62')}]})[_0x8711('0x19')](handleEntityNotFound(_0x3f5371,null))[_0x8711('0x19')](saveUpdates(_0x368323['body'],null))[_0x8711('0x19')](respondWithResult(_0x3f5371,null))['catch'](handleError(_0x3f5371,null));};exports[_0x8711('0x30')]=function(_0x1491e5,_0x5f5d85){return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x1491e5[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x5f5d85,null))[_0x8711('0x19')](removeEntity(_0x5f5d85,null))[_0x8711('0x23')](handleError(_0x5f5d85,null));};exports[_0x8711('0x71')]=function(_0x1db6b8,_0x3bb1e1){return db[_0x8711('0x4d')]['describe']()[_0x8711('0x19')](respondWithResult(_0x3bb1e1,null))['catch'](handleError(_0x3bb1e1,null));};exports['addDisposition']=function(_0x98beca,_0x550bf1){if(_0x98beca[_0x8711('0x67')]['id']){delete _0x98beca[_0x8711('0x67')]['id'];}return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x98beca[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x550bf1,null))[_0x8711('0x19')](function(_0x176ce0){if(_0x176ce0){_0x98beca[_0x8711('0x67')][_0x8711('0x72')]=_0x176ce0['id'];return db[_0x8711('0x73')][_0x8711('0x66')](_0x98beca[_0x8711('0x67')]);}})[_0x8711('0x19')](respondWithResult(_0x550bf1,null))[_0x8711('0x23')](handleError(_0x550bf1,null));};exports[_0x8711('0x74')]=function(_0x3d9432,_0x490d0c){var _0x71037d={'raw':![],'where':{}};var _0x438c4b={};var _0x449713={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3d9432['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x490d0c,null))[_0x8711('0x19')](function(_0x510081){if(_0x510081){_0x438c4b[_0x8711('0x46')]=_[_0x8711('0x75')](db['Disposition']['rawAttributes']);_0x438c4b[_0x8711('0x50')]=_[_0x8711('0x75')](_0x3d9432[_0x8711('0x50')]);_0x438c4b[_0x8711('0x51')]=_[_0x8711('0x52')](_0x438c4b[_0x8711('0x46')],_0x438c4b[_0x8711('0x50')]);_0x71037d[_0x8711('0x53')]=_[_0x8711('0x52')](_0x438c4b[_0x8711('0x46')],qs[_0x8711('0x54')](_0x3d9432[_0x8711('0x50')][_0x8711('0x54')]));_0x71037d[_0x8711('0x53')]=_0x71037d['attributes'][_0x8711('0x64')]?_0x71037d[_0x8711('0x53')]:_0x438c4b[_0x8711('0x46')];if(!_0x3d9432['query'][_0x8711('0x55')]('nolimit')){_0x71037d[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x3d9432[_0x8711('0x50')][_0x8711('0x29')]);_0x71037d[_0x8711('0x28')]=qs[_0x8711('0x28')](_0x3d9432[_0x8711('0x50')][_0x8711('0x28')]);}_0x71037d[_0x8711('0x57')]=qs[_0x8711('0x58')](_0x3d9432[_0x8711('0x50')][_0x8711('0x58')]);_0x71037d[_0x8711('0x59')]=qs[_0x8711('0x51')](_[_0x8711('0x5a')](_0x3d9432['query'],_0x438c4b[_0x8711('0x51')]));_0x71037d[_0x8711('0x59')][_0x8711('0x72')]=_0x510081['id'];if(_0x3d9432['query'][_0x8711('0x5b')]){_0x71037d[_0x8711('0x59')]=_[_0x8711('0x5c')](_0x71037d['where'],{'$or':_[_0x8711('0x4c')](_0x71037d['attributes'],function(_0x189142){var _0x5e70ce={};_0x5e70ce[_0x189142]={'$like':'%'+_0x3d9432[_0x8711('0x50')][_0x8711('0x5b')]+'%'};return _0x5e70ce;})});}_0x71037d=_[_0x8711('0x5c')]({},_0x71037d,_0x3d9432[_0x8711('0x5e')]);return db[_0x8711('0x73')][_0x8711('0x27')]({'where':_0x71037d[_0x8711('0x59')]})[_0x8711('0x19')](function(_0x15eb24){_0x449713['count']=_0x15eb24;if(_0x3d9432['query'][_0x8711('0x76')]){_0x71037d['include']=[{'all':!![]}];}return db[_0x8711('0x73')][_0x8711('0x77')](_0x71037d);})[_0x8711('0x19')](function(_0x5151fb){_0x449713['rows']=_0x5151fb;return _0x449713;});}})['then'](respondWithFilteredResult(_0x490d0c,_0x71037d))[_0x8711('0x23')](handleError(_0x490d0c,null));};exports[_0x8711('0x78')]=function(_0x330ed1,_0x2fbe50){return db['ChatWebsite']['find']({'where':{'id':_0x330ed1[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x2fbe50,null))[_0x8711('0x19')](function(_0x5d77c8){if(_0x5d77c8){return _0x5d77c8[_0x8711('0x78')](_0x330ed1[_0x8711('0x50')][_0x8711('0x79')]);}})['then'](respondWithStatusCode(_0x2fbe50,null))[_0x8711('0x23')](handleError(_0x2fbe50,null));};exports[_0x8711('0x7a')]=function(_0x2d5491,_0x27e061){if(_0x2d5491[_0x8711('0x67')]['id']){delete _0x2d5491['body']['id'];}return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x2d5491[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x27e061,null))[_0x8711('0x19')](function(_0x4d1eaa){if(_0x4d1eaa){_0x2d5491[_0x8711('0x67')][_0x8711('0x72')]=_0x4d1eaa['id'];return db[_0x8711('0x7b')][_0x8711('0x66')](_0x2d5491[_0x8711('0x67')]);}})['then'](respondWithResult(_0x27e061,null))[_0x8711('0x23')](handleError(_0x27e061,null));};exports[_0x8711('0x7c')]=function(_0x1ee4db,_0xa49d38){var _0x42b60d={'raw':![],'where':{}};var _0x3547c1={};var _0x24e569={'count':0x0,'rows':[]};return db[_0x8711('0x4d')][_0x8711('0x7d')]({'where':{'id':_0x1ee4db[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0xa49d38,null))['then'](function(_0x4903b2){if(_0x4903b2){_0x3547c1[_0x8711('0x46')]=_[_0x8711('0x75')](db[_0x8711('0x7b')]['rawAttributes']);_0x3547c1['query']=_[_0x8711('0x75')](_0x1ee4db[_0x8711('0x50')]);_0x3547c1[_0x8711('0x51')]=_[_0x8711('0x52')](_0x3547c1[_0x8711('0x46')],_0x3547c1[_0x8711('0x50')]);_0x42b60d['attributes']=_[_0x8711('0x52')](_0x3547c1[_0x8711('0x46')],qs[_0x8711('0x54')](_0x1ee4db[_0x8711('0x50')][_0x8711('0x54')]));_0x42b60d[_0x8711('0x53')]=_0x42b60d[_0x8711('0x53')]['length']?_0x42b60d[_0x8711('0x53')]:_0x3547c1[_0x8711('0x46')];if(!_0x1ee4db[_0x8711('0x50')]['hasOwnProperty'](_0x8711('0x56'))){_0x42b60d[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x1ee4db[_0x8711('0x50')][_0x8711('0x29')]);_0x42b60d[_0x8711('0x28')]=qs['offset'](_0x1ee4db[_0x8711('0x50')][_0x8711('0x28')]);}_0x42b60d['order']=qs[_0x8711('0x58')](_0x1ee4db[_0x8711('0x50')][_0x8711('0x58')]);_0x42b60d['where']=qs['filters'](_[_0x8711('0x5a')](_0x1ee4db['query'],_0x3547c1[_0x8711('0x51')]));_0x42b60d[_0x8711('0x59')][_0x8711('0x72')]=_0x4903b2['id'];if(_0x1ee4db['query'][_0x8711('0x5b')]){_0x42b60d[_0x8711('0x59')]=_[_0x8711('0x5c')](_0x42b60d[_0x8711('0x59')],{'$or':_[_0x8711('0x4c')](_0x42b60d[_0x8711('0x53')],function(_0x437ebb){var _0x167437={};_0x167437[_0x437ebb]={'$like':'%'+_0x1ee4db[_0x8711('0x50')][_0x8711('0x5b')]+'%'};return _0x167437;})});}_0x42b60d=_[_0x8711('0x5c')]({},_0x42b60d,_0x1ee4db[_0x8711('0x5e')]);return db['CannedAnswer'][_0x8711('0x27')]({'where':_0x42b60d['where']})[_0x8711('0x19')](function(_0x4ee3f3){_0x24e569[_0x8711('0x27')]=_0x4ee3f3;if(_0x1ee4db[_0x8711('0x50')][_0x8711('0x76')]){_0x42b60d[_0x8711('0x5f')]=[{'all':!![]}];}return db[_0x8711('0x7b')][_0x8711('0x77')](_0x42b60d);})[_0x8711('0x19')](function(_0x19391b){_0x24e569[_0x8711('0x7e')]=_0x19391b;return _0x24e569;});}})[_0x8711('0x19')](respondWithFilteredResult(_0xa49d38,_0x42b60d))[_0x8711('0x23')](handleError(_0xa49d38,null));};exports[_0x8711('0x7f')]=function(_0x2f120a,_0x58f6a1){return db[_0x8711('0x4d')]['find']({'where':{'id':_0x2f120a['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x58f6a1,null))['then'](function(_0x42ac03){if(_0x42ac03){return _0x42ac03[_0x8711('0x7f')](_0x2f120a['query'][_0x8711('0x79')]);}})[_0x8711('0x19')](respondWithStatusCode(_0x58f6a1,null))[_0x8711('0x23')](handleError(_0x58f6a1,null));};exports[_0x8711('0x80')]=function(_0x2953fa,_0x32ddbc){_0x2953fa[_0x8711('0x67')][_0x8711('0x81')]=_0x2953fa[_0x8711('0x82')][_0x8711('0x83')];return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x2953fa['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x32ddbc,null))[_0x8711('0x19')](saveUpdates(_0x2953fa[_0x8711('0x67')],null))[_0x8711('0x19')](respondWithResult(_0x32ddbc,null))[_0x8711('0x23')](handleError(_0x32ddbc,null));};exports['addAvatar']=function(_0x34f15b,_0x117bce){_0x34f15b[_0x8711('0x67')][_0x8711('0x84')]=_0x34f15b[_0x8711('0x82')][_0x8711('0x83')];return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x34f15b[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x117bce,null))['then'](saveUpdates(_0x34f15b[_0x8711('0x67')],null))[_0x8711('0x19')](respondWithResult(_0x117bce,null))['catch'](handleError(_0x117bce,null));};exports['addCustomerAvatar']=function(_0x4bd230,_0x1744ca){_0x4bd230['body'][_0x8711('0x85')]=_0x4bd230[_0x8711('0x82')][_0x8711('0x83')];return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x4bd230[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x1744ca,null))[_0x8711('0x19')](saveUpdates(_0x4bd230[_0x8711('0x67')],null))[_0x8711('0x19')](respondWithResult(_0x1744ca,null))['catch'](handleError(_0x1744ca,null));};exports[_0x8711('0x86')]=function(_0x2e867c,_0x26662c){_0x2e867c['body']['systemAvatar']=_0x2e867c[_0x8711('0x82')][_0x8711('0x83')];return db['ChatWebsite'][_0x8711('0x65')]({'where':{'id':_0x2e867c['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x26662c,null))[_0x8711('0x19')](saveUpdates(_0x2e867c[_0x8711('0x67')],null))[_0x8711('0x19')](respondWithResult(_0x26662c,null))['catch'](handleError(_0x26662c,null));};exports[_0x8711('0x87')]=function(_0x9ed045,_0x2c379d){var _0x304c63=path['join'](config[_0x8711('0x88')],_0x8711('0x89'));var _0x34437={'where':{'id':_0x9ed045['params']['id']},'attributes':['id',_0x8711('0x81')],'raw':!![]};var _0x1ff6a3=![];return require(_0x8711('0x8a'))[_0x8711('0x8b')]()[_0x8711('0x19')](function(_0x304e15){if(_0x304e15){_0x1ff6a3=_0x304e15[_0x8711('0x8c')];}})[_0x8711('0x19')](function(){return db['ChatWebsite'][_0x8711('0x65')](_0x34437);})[_0x8711('0x19')](handleEntityNotFound(_0x2c379d,null))[_0x8711('0x19')](function(_0x47113a){if(_0x47113a){if(!_['isNil'](_0x47113a[_0x8711('0x81')])){if(fs[_0x8711('0x8d')](path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0x8f'),_0x47113a[_0x8711('0x81')]))&&_0x1ff6a3){_0x304c63=path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0x8f'),_0x47113a[_0x8711('0x81')]);}}return _0x2c379d[_0x8711('0x90')](_0x304c63);}})['catch'](handleError(_0x2c379d,null));};exports[_0x8711('0x91')]=function(_0x2c41c9,_0xb3b31e){var _0x2a5542=path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0x92'));var _0x2927b9={'where':{'id':_0x2c41c9[_0x8711('0x61')]['id']},'attributes':['id',_0x8711('0x84')],'raw':!![]};return db[_0x8711('0x4d')][_0x8711('0x65')](_0x2927b9)['then'](handleEntityNotFound(_0xb3b31e,null))[_0x8711('0x19')](function(_0x99e198){if(_0x99e198){if(!_[_0x8711('0x93')](_0x99e198[_0x8711('0x84')])){if(fs[_0x8711('0x8d')](path['join'](config[_0x8711('0x88')],_0x8711('0x94'),_0x99e198[_0x8711('0x84')]))){_0x2a5542=path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0x94'),_0x99e198[_0x8711('0x84')]);}}return _0xb3b31e[_0x8711('0x90')](_0x2a5542);}})[_0x8711('0x23')](handleError(_0xb3b31e,null));};exports[_0x8711('0x95')]=function(_0x1bfa18,_0x2c4cad){var _0xd59a3=path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0x96'));var _0x4fca3c={'where':{'id':_0x1bfa18[_0x8711('0x61')]['id']},'attributes':['id',_0x8711('0x85'),'showCustomerAvatar'],'raw':!![]};return db[_0x8711('0x4d')][_0x8711('0x65')](_0x4fca3c)[_0x8711('0x19')](handleEntityNotFound(_0x2c4cad,null))[_0x8711('0x19')](function(_0x3ae1a0){if(_0x3ae1a0){if(!_[_0x8711('0x93')](_0x3ae1a0['customerAvatar'])){if(fs['existsSync'](path[_0x8711('0x8e')](config['root'],'server/files/images/avatars/',_0x3ae1a0[_0x8711('0x85')]))&&_0x3ae1a0[_0x8711('0x97')]){_0xd59a3=path['join'](config['root'],'server/files/images/avatars/',_0x3ae1a0[_0x8711('0x85')]);}}return _0x2c4cad[_0x8711('0x90')](_0xd59a3);}})[_0x8711('0x23')](handleError(_0x2c4cad,null));};exports[_0x8711('0x98')]=function(_0x21426d,_0x400835){var _0x2e991=path[_0x8711('0x8e')](config['root'],_0x8711('0x99'));var _0x389dee={'where':{'id':_0x21426d[_0x8711('0x61')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x8711('0x4d')][_0x8711('0x65')](_0x389dee)[_0x8711('0x19')](handleEntityNotFound(_0x400835,null))[_0x8711('0x19')](function(_0xc2cb37){if(_0xc2cb37){if(!_['isNil'](_0xc2cb37[_0x8711('0x9a')])){if(fs['existsSync'](path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0x94'),_0xc2cb37['systemAvatar']))){_0x2e991=path[_0x8711('0x8e')](config['root'],_0x8711('0x94'),_0xc2cb37[_0x8711('0x9a')]);}}return _0x400835['download'](_0x2e991);}})['catch'](handleError(_0x400835,null));};function checkWebsiteInterval(_0x2b605e){var _0x1e9e0d=_0x2b605e[_0x8711('0x9b')];if(!_0x1e9e0d){return Promise[_0x8711('0x9c')](_0x2b605e);}var _0x437ed3=_0x2b605e[_0x8711('0x9d')]||undefined;return _0x1e9e0d['ifTime'](_0x437ed3)[_0x8711('0x19')](function(_0x10aee7){if(!_0x10aee7){throw new APIOutOfIntervalError();}return _0x2b605e;});}exports[_0x8711('0x9e')]=function(_0x39e55b,_0xc9bcb1){var _0x4a7c22={'body':_0x39e55b[_0x8711('0x67')],'channel':_0x8711('0x9f')};var _0x12b610=[];var _0x4fe28c=[];var _0x3c118c={};var _0x5aeaea=![];if(_0x39e55b['body']['id']){delete _0x39e55b['body']['id'];}if(_[_0x8711('0x93')](_0x39e55b[_0x8711('0x67')][_0x8711('0xa0')])){throw new APIBadRequestError(_0x8711('0xa1'));}if(_[_0x8711('0x93')](_0x39e55b[_0x8711('0x67')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0x39e55b[_0x8711('0x67')][_0x8711('0x67')])){throw new APIBadRequestError(_0x8711('0xa2'));}var _0x6452ab=_0x39e55b['body']['customerIp']&&_0x39e55b[_0x8711('0x67')][_0x8711('0x3f')];return db[_0x8711('0xa3')]['describe']()[_0x8711('0x19')](function(_0x435d5d){if(!_0x435d5d){throw new Error(_0x8711('0xa4'));}_0x12b610=Object[_0x8711('0x75')](_0x435d5d)['filter'](function(_0x11edd6){return![_0x8711('0xa5'),_0x8711('0xa6')]['includes'](_0x11edd6);});_0x4fe28c=Object[_0x8711('0x75')](_0x435d5d)[_0x8711('0x5b')](function(_0x1f308f){return!['createdAt',_0x8711('0xa6'),'CompanyId','ListId'][_0x8711('0xa7')](_0x1f308f);});if(!_[_0x8711('0xa7')](_0x4fe28c,_0x39e55b[_0x8711('0x67')]['mapKey'])){throw new APIBadRequestError(_0x8711('0xa8')+_0x4fe28c[_0x8711('0x8e')](',\x20'));}_0x3c118c[_0x39e55b[_0x8711('0x67')][_0x8711('0xa9')]]=_0x39e55b[_0x8711('0x67')]['from'];})[_0x8711('0x19')](function(){return db[_0x8711('0x4d')]['find']({'where':{'id':_0x39e55b[_0x8711('0x61')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8711('0xa3')],'as':'Contacts','where':_0x3c118c,'limit':0x1,'order':[['updatedAt',_0x8711('0xaa')]]}]},{'model':db[_0x8711('0xab')],'as':_0x8711('0xac')},{'model':db[_0x8711('0x9b')],'as':'Interval','include':[{'model':db[_0x8711('0x9b')],'as':_0x8711('0xad'),'attributes':['id',_0x8711('0xae')],'raw':!![]}]}]});})[_0x8711('0x19')](function(_0x50bd4b){if(!_0x50bd4b){throw new APINotFoundError(util[_0x8711('0x42')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x39e55b[_0x8711('0x61')]['id']));}if(_0x6452ab){return checkWebsiteInterval(_0x50bd4b);}return _0x50bd4b;})[_0x8711('0x19')](function(_0x4e4e28){_0x4a7c22[_0x8711('0xaf')]=_0x4e4e28;_0x4a7c22[_0x8711('0xb0')]=_[_0x8711('0xb1')](_0x4e4e28[_0x8711('0xac')],[_0x8711('0xb2')],[_0x8711('0xb3')]);if(_0x4a7c22[_0x8711('0xaf')][_0x8711('0xac')]){delete _0x4a7c22[_0x8711('0xaf')][_0x8711('0xac')];}_0x4a7c22[_0x8711('0xb4')]=_0x4e4e28[_0x8711('0xb5')]||{'id':_0x4e4e28[_0x8711('0xb6')]};if(_0x4a7c22['list']&&_0x4a7c22[_0x8711('0xb4')][_0x8711('0xb7')][_0x8711('0x64')]){return _0x4a7c22[_0x8711('0xb4')][_0x8711('0xb7')][0x0];}var _0x2b26b2=_[_0x8711('0xb8')](_0x39e55b['body'],{'firstName':_0x39e55b[_0x8711('0x67')][_0x8711('0xa0')],'ListId':_0x4e4e28[_0x8711('0xb6')]});_0x2b26b2[_0x39e55b[_0x8711('0x67')][_0x8711('0xa9')]]=_0x39e55b[_0x8711('0x67')][_0x8711('0xa0')];return db['CmContact'][_0x8711('0x66')](_0x2b26b2,{'fields':_0x12b610,'raw':!![]});})['then'](function(_0x43fe92){_0x4a7c22[_0x8711('0xb9')]=_0x43fe92;var _0x8ce7ae=createInteractionObject(_0x39e55b[_0x8711('0x61')]['id'],_0x39e55b['body'],_0x39e55b['headers'],_0x43fe92);var _0x45dae9={'ChatWebsiteId':_0x39e55b['params']['id']};if(_0x39e55b[_0x8711('0x67')][_0x8711('0xba')]){_0x45dae9[_0x8711('0xba')]=_0x39e55b[_0x8711('0x67')]['threadId'];_0x45dae9['closed']=![];return db[_0x8711('0xbb')][_0x8711('0x65')]({'where':_0x45dae9})[_0x8711('0x19')](function(_0x40574a){var _0x8e3893=_0x39e55b[_0x8711('0x67')][_0x8711('0x37')]&&_0x39e55b['body'][_0x8711('0x3f')];if(_0x40574a){_0x5aeaea=!![];return _0x40574a;}else if(!_0x8e3893&&_0x40574a&&_0x40574a[_0x8711('0xbc')]){throw new APIConflictError(_0x8711('0xbd'));}_0x8ce7ae[_0x8711('0xba')]=_0x39e55b['body'][_0x8711('0xba')];_0x8ce7ae[_0x8711('0xbe')]=_0x39e55b['body'][_0x8711('0xbe')];return db[_0x8711('0xbb')][_0x8711('0x66')](_0x8ce7ae);});}_0x45dae9[_0x8711('0xbf')]=_0x43fe92['id'];if(_0x39e55b[_0x8711('0x67')]['interaction']&&_0x39e55b[_0x8711('0x67')][_0x8711('0xc0')]['id']){_0x45dae9['id']=_0x39e55b['body'][_0x8711('0xc0')]['id'];return db[_0x8711('0xbb')][_0x8711('0x65')]({'where':_0x45dae9})[_0x8711('0x19')](function(_0x11daaa){var _0x165430=_0x39e55b[_0x8711('0x67')][_0x8711('0x37')]&&_0x39e55b[_0x8711('0x67')][_0x8711('0x3f')];if(!_0x165430&&_0x11daaa&&_0x11daaa[_0x8711('0xbc')]){throw new APIConflictError(_0x8711('0xbd'));}else if(_0x11daaa){_0x5aeaea=!![];return _0x11daaa;}else{return db['ChatInteraction'][_0x8711('0x66')](_0x8ce7ae);}});}return db[_0x8711('0xbb')][_0x8711('0x66')](_0x8ce7ae);})['then'](function(_0x3b1f25){if(!_0x5aeaea){return _0x3b1f25;}var _0xd28f60={'from':(_0x4a7c22[_0x8711('0xb9')][_0x8711('0x3c')]||'')+'\x20'+(_0x4a7c22[_0x8711('0xb9')][_0x8711('0x3d')]||'')};if(_0x39e55b['body'][_0x8711('0xba')]&&_0x39e55b[_0x8711('0x67')][_0x8711('0xc1')]&&_0x39e55b['body']['threadId']!=_0x39e55b[_0x8711('0x67')][_0x8711('0xc1')]){_0xd28f60[_0x8711('0xba')]=_0x39e55b['body'][_0x8711('0xc1')];}return _0x3b1f25[_0x8711('0x2c')](_0xd28f60);})[_0x8711('0x19')](function(_0x229a6a){_0x4a7c22[_0x8711('0xc0')]=_0x229a6a[_0x8711('0x2d')]({'plain':!![]});_0x4a7c22[_0x8711('0xc0')][_0x8711('0xc2')]=!_0x5aeaea;if(_0x4a7c22[_0x8711('0xc0')][_0x8711('0xc2')]){if(_0x4a7c22[_0x8711('0xaf')]['autoclose']){_0x4a7c22[_0x8711('0xb0')]['push']({'id':0x0,'priority':_0x4a7c22[_0x8711('0xb0')][_0x8711('0x64')]+0x1,'app':_0x8711('0xc3'),'appdata':_0x8711('0xc4'),'interval':_0x8711('0xc5')});}}return db[_0x8711('0xc6')][_0x8711('0x66')]({'body':_0x39e55b[_0x8711('0x67')][_0x8711('0x67')],'ChatWebsiteId':_0x39e55b[_0x8711('0x61')]['id'],'ChatInteractionId':_0x229a6a['id'],'direction':'in','ContactId':_0x4a7c22[_0x8711('0xb9')]['id'],'AttachmentId':_0x39e55b['body'][_0x8711('0xc7')]});})[_0x8711('0x19')](function(_0x3263d9){_0x4a7c22[_0x8711('0x21')]=_0x3263d9;if(!_0x4a7c22['interaction'][_0x8711('0xc8')]){return;}return db['User'][_0x8711('0x65')]({'attributes':['id',_0x8711('0x33')],'where':{'id':_0x4a7c22[_0x8711('0xc0')][_0x8711('0xc8')]}});})[_0x8711('0x19')](function(_0x3788f6){if(_0x3788f6){_0x4a7c22['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3788f6[_0x8711('0x33')]+','+(_0x4a7c22[_0x8711('0xaf')]['waitForTheAssignedAgent']||0xa),'interval':_0x8711('0xc5')});_0x4a7c22[_0x8711('0xc9')]=!![];}if(!_0x4a7c22[_0x8711('0xc0')][_0x8711('0xca')]){return;}return db[_0x8711('0xcb')][_0x8711('0x65')]({'attributes':['id',_0x8711('0x33')],'where':{'id':_0x4a7c22[_0x8711('0xc0')]['queueId']}});})['then'](function(_0x3f643c){if(_0x3f643c){_0x4a7c22['applications'][_0x8711('0xcc')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3f643c[_0x8711('0x33')]+','+(_0x4a7c22[_0x8711('0xaf')][_0x8711('0xcd')]||0x12c),'interval':_0x8711('0xc5')});}return respondWithRpcPromise('Start','startRouting',_0x4a7c22);})[_0x8711('0x19')](function(_0x480f73){respondWithRpcPromise('EventManager','EventManager',{'event':_0x8711('0x9e'),'message':_0x480f73},client9002);return _0x480f73;})[_0x8711('0x19')](respondWithResult(_0xc9bcb1,null))['catch'](APIHandleError(_0xc9bcb1));};exports[_0x8711('0xce')]=function(_0x2ee2ed,_0x4456f3){var _0x5a3bf4,_0x192b72,_0x45ac86;var _0xee0bdf=[];var _0x5f368a={};var _0x103139=_0x2ee2ed['files']||[];var _0x556546=[];var _0x3d0d45;return db[_0x8711('0xa3')][_0x8711('0x71')]()[_0x8711('0x19')](function(_0x5bad74){if(!_0x5bad74){throw new db[(_0x8711('0xcf'))][(_0x8711('0xd0'))](_0x8711('0xd1'));}_0xee0bdf=_[_0x8711('0xd2')](_[_0x8711('0x75')](_0x5bad74),[_0x8711('0xa5'),_0x8711('0xa6'),'CompanyId',_0x8711('0xb6')]);if(_0x2ee2ed['body']['id']){delete _0x2ee2ed[_0x8711('0x67')]['id'];}if(_[_0x8711('0x93')](_0x2ee2ed[_0x8711('0x67')][_0x8711('0xa0')])){throw _0x4456f3[_0x8711('0x24')](0x1f4)[_0x8711('0x34')](new db['Sequelize'][(_0x8711('0xd0'))](_0x8711('0xd3')));}if(_[_0x8711('0x93')](_0x2ee2ed[_0x8711('0x67')][_0x8711('0x67')])||_0x2ee2ed[_0x8711('0x67')]['body']===''){throw _0x4456f3[_0x8711('0x24')](0x1f4)[_0x8711('0x34')](new db[(_0x8711('0xcf'))][(_0x8711('0xd0'))](_0x8711('0xd4')));}if(_[_0x8711('0x93')](_0x2ee2ed['body']['mapKeyOffline'])){throw _0x4456f3['status'](0x1f4)[_0x8711('0x34')](new db['Sequelize']['ValidationError'](_0x8711('0xd5')+_0xee0bdf));}if(!_[_0x8711('0xa7')](_0xee0bdf,_0x2ee2ed['body']['mapKeyOffline'])){throw _0x4456f3[_0x8711('0x24')](0x1f4)[_0x8711('0x34')](new db[(_0x8711('0xcf'))][(_0x8711('0xd0'))](_0x8711('0xd6')+_0xee0bdf));}_0x5f368a[_0x2ee2ed[_0x8711('0x67')][_0x8711('0xd7')]]=_0x2ee2ed[_0x8711('0x67')][_0x8711('0xa0')];})[_0x8711('0x19')](function(){return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x2ee2ed[_0x8711('0x61')]['id']},'include':[{'model':db[_0x8711('0xd8')],'as':'List'},{'model':db[_0x8711('0xd9')],'as':_0x8711('0xd9')}]});})[_0x8711('0x19')](handleEntityNotFound(_0x4456f3,null))['then'](function(_0x508ae7){if(_0x508ae7&&_0x508ae7['List']){_0x192b72=_0x508ae7;var _0xb544de=_[_0x8711('0xb8')](_0x2ee2ed[_0x8711('0x67')],{'firstName':_0x2ee2ed[_0x8711('0x67')][_0x8711('0xa0')],'phone':_0x2ee2ed[_0x8711('0x67')][_0x8711('0xa0')],'ListId':_0x508ae7[_0x8711('0xb6')]});_0xb544de[_0x2ee2ed[_0x8711('0x67')][_0x8711('0xd7')]]=_0x2ee2ed['body'][_0x8711('0xa0')];return db[_0x8711('0xa3')][_0x8711('0xda')]({'where':_0x5f368a,'defaults':_0xb544de});}})[_0x8711('0xdb')](function(_0x4b764f){if(_0x4b764f){_0x45ac86=_0x4b764f;var _0x3f5efe=fs[_0x8711('0xdc')](path['join'](config[_0x8711('0x88')],_0x8711('0xdd')),_0x8711('0xde'));var _0x1dfdad=ejs[_0x8711('0xdf')](_0x3f5efe,{'body':_[_0x8711('0xe0')](_0x2ee2ed[_0x8711('0x67')][_0x8711('0x67')]),'bodyTitle':_0x192b72[_0x8711('0xe1')]});return db[_0x8711('0xe2')][_0x8711('0x66')]({'body':_0x1dfdad,'plainBody':htmlToText['fromString'](_0x1dfdad),'ContactId':_0x4b764f['id'],'ChatWebsiteId':_0x192b72['id']});}})[_0x8711('0x19')](function(_0x2ff225){_0x3d0d45=_0x2ff225;if(_0x103139['length']){var _0x567adb=_0x103139[_0x8711('0x4c')](function(_0x4c755f){return{'name':_0x4c755f[_0x8711('0xe3')],'basename':_0x4c755f['filename'],'type':_0x4c755f[_0x8711('0xe4')],'ChatOfflineMessageId':_0x2ff225['id']};});_0x556546=_0x567adb[_0x8711('0x4c')](_0x26f0e5=>{var _0x4ed2e3={'filename':_0x26f0e5[_0x8711('0x33')],'path':path[_0x8711('0x8e')](config[_0x8711('0x88')],_0x8711('0xe5'),'files',_0x8711('0xe6'),_0x8711('0xe7'),_0x26f0e5['basename'])};return _0x4ed2e3;});if(!_0x192b72[_0x8711('0xe8')]){return db[_0x8711('0xe9')][_0x8711('0xea')](function(_0x35cc7d){return db[_0x8711('0xeb')][_0x8711('0xec')](_0x567adb,{'transaction':_0x35cc7d});});}}})[_0x8711('0x19')](function(){if(_0x3d0d45){_0x5a3bf4=_0x3d0d45;return db['MailAccount'][_0x8711('0x7d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8711('0xed'),'raw':!![],'include':[{'model':db[_0x8711('0xee')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x8711('0x19')](function(_0x918e80){if(_0x918e80&&_0x918e80[_0x8711('0xed')]&&_0x192b72[_0x8711('0xef')]&&_0x192b72[_0x8711('0xf0')]){var _0x3c6f02=_0x918e80[_0x8711('0xf1')]();return respondWithRpcPromise(_0x8711('0xf2'),_0x8711('0xf3'),{'account':_0x3c6f02,'message':{'from':util[_0x8711('0x42')](_0x8711('0xf4'),_0x918e80[_0x8711('0x33')],_0x918e80[_0x8711('0xf5')]||_0x918e80[_0x8711('0xed')][_0x8711('0x6c')]),'to':_0x192b72[_0x8711('0xf0')],'subject':_0x192b72['offlineMessageSubject'],'html':_0x5a3bf4[_0x8711('0x67')],'attachments':_0x556546}},client9003)['then'](function(){return _0x5a3bf4;})[_0x8711('0x23')](function(_0x2c0ccb){logger[_0x8711('0x1f')](_0x2c0ccb);});}})[_0x8711('0x19')](function(){if(_0x192b72&&_0x192b72[_0x8711('0xe8')]&&_0x192b72[_0x8711('0xf6')]){var _0x5253ea=[];if(_0x103139['length']){_0x5253ea=_0x103139['map'](function(_0x43cc85){return{'name':_0x43cc85[_0x8711('0xe3')],'basename':_0x43cc85[_0x8711('0x83')],'type':_0x43cc85[_0x8711('0xe4')],'ChatOfflineMessageId':_0x3d0d45['id']};});}var _0x4476a2;if(!_['isNil'](_0x192b72['subjectOffline'])){var _0x5dd614=_[_0x8711('0x4c')](_0x2ee2ed[_0x8711('0x67')],function(_0x34d4e8){return _0x34d4e8;});var _0x16d6f0=_['toPairsIn'](_0x5dd614)[0x0];var _0x114a7c=_['mapValues'](_0x16d6f0,function(_0x392f22){return _0x392f22;});_0x4476a2=_0x114a7c[0x1][_0x192b72[_0x8711('0xf7')]];}var _0x3b4098={'from':_0x45ac86[_0x8711('0xf5')],'firstName':_0x45ac86[_0x8711('0x3c')],'lastName':_0x45ac86[_0x8711('0x3d')],'mapKey':_0x8711('0xf5'),'message':{'from':_0x45ac86[_0x8711('0xf5')],'to':_0x192b72['MailAccount'][_0x8711('0xf5')],'cc':'','subject':_[_0x8711('0x93')](_0x4476a2)?_0x192b72[_0x8711('0xf8')]:_0x4476a2,'messageId':'','sentAt':new Date(),'attach':_0x5253ea['length'],'attachments':_0x5253ea,'originChannel':_0x8711('0xf9'),'ChatWebsiteId':_0x192b72['id'],'ChatOfflineMessageId':_0x5a3bf4['id'],'originTo':_0x192b72[_0x8711('0xd9')][_0x8711('0xf5')]},'body':_0x5a3bf4[_0x8711('0x67')]};var _0x48e5ea={'account':{'id':_0x192b72[_0x8711('0xf6')]},'body':_0x3b4098,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x8711('0xfa'),'notifyMail',_0x48e5ea,client9001)['then'](function(){return _0x5a3bf4;})['catch'](function(_0x6826a0){logger[_0x8711('0x1f')](_0x6826a0);});}return;})[_0x8711('0x19')](function(){if(_0x5a3bf4){return _0x5a3bf4;}})['then'](respondWithResult(_0x4456f3,null))[_0x8711('0x23')](function(){for(var _0x2c7075 of _0x103139){var _0x3c1532=path['join'](config[_0x8711('0x88')],'server','files',_0x8711('0xe6'),_0x8711('0xe7'),_0x2c7075['filename']);fs_extra[_0x8711('0xfb')](_0x3c1532)[_0x8711('0x23')](function(_0x300256){logger[_0x8711('0x1f')](_0x8711('0xfc'),_0x3c1532,_0x300256);});}});};exports[_0x8711('0xfd')]=function(_0x50cd36,_0x23f318){return db['ChatInteraction']['find']({'where':{'id':_0x50cd36['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x23f318,null))[_0x8711('0x19')](function(_0x4c939b){if(_0x4c939b){return _0x4c939b[_0x8711('0xfd')](_0x50cd36[_0x8711('0x67')][_0x8711('0x79')],_['omit'](_0x50cd36['body'],[_0x8711('0x79'),'id'])||{});}})[_0x8711('0x19')](respondWithResult(_0x23f318,null))[_0x8711('0x23')](handleError(_0x23f318,null));};exports[_0x8711('0xfe')]=function(_0x26c84c,_0x44a135){var _0x5ac2ba={'raw':![],'where':{}};var _0x4f8b93={};var _0x117616={'count':0x0,'rows':[]};return db[_0x8711('0x4d')][_0x8711('0x7d')]({'where':{'id':_0x26c84c['params']['id']}})['then'](handleEntityNotFound(_0x44a135,null))[_0x8711('0x19')](function(_0x451a44){if(_0x451a44){_0x4f8b93[_0x8711('0x46')]=_[_0x8711('0x75')](db[_0x8711('0xbb')][_0x8711('0x63')]);_0x4f8b93[_0x8711('0x50')]=_[_0x8711('0x75')](_0x26c84c[_0x8711('0x50')]);_0x4f8b93[_0x8711('0x51')]=_['intersection'](_0x4f8b93[_0x8711('0x46')],_0x4f8b93[_0x8711('0x50')]);_0x5ac2ba[_0x8711('0x53')]=_[_0x8711('0x52')](_0x4f8b93[_0x8711('0x46')],qs[_0x8711('0x54')](_0x26c84c[_0x8711('0x50')][_0x8711('0x54')]));_0x5ac2ba[_0x8711('0x53')]=_0x5ac2ba[_0x8711('0x53')][_0x8711('0x64')]?_0x5ac2ba[_0x8711('0x53')]:_0x4f8b93[_0x8711('0x46')];if(!_0x26c84c['query'][_0x8711('0x55')](_0x8711('0x56'))){_0x5ac2ba[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x26c84c[_0x8711('0x50')][_0x8711('0x29')]);_0x5ac2ba['offset']=qs[_0x8711('0x28')](_0x26c84c[_0x8711('0x50')][_0x8711('0x28')]);}_0x5ac2ba['order']=qs[_0x8711('0x58')](_0x26c84c[_0x8711('0x50')][_0x8711('0x58')]);_0x5ac2ba['where']=qs[_0x8711('0x51')](_['pick'](_0x26c84c[_0x8711('0x50')],_0x4f8b93['filters']));_0x5ac2ba[_0x8711('0x59')][_0x8711('0x72')]=_0x451a44['id'];if(_0x26c84c[_0x8711('0x50')][_0x8711('0x5b')]){_0x5ac2ba[_0x8711('0x59')]=_[_0x8711('0x5c')](_0x5ac2ba[_0x8711('0x59')],{'$or':_[_0x8711('0x4c')](_0x5ac2ba[_0x8711('0x53')],function(_0x1ab1d9){var _0x4e0038={};_0x4e0038[_0x1ab1d9]={'$like':'%'+_0x26c84c[_0x8711('0x50')][_0x8711('0x5b')]+'%'};return _0x4e0038;})});}_0x5ac2ba=_[_0x8711('0x5c')]({},_0x5ac2ba,_0x26c84c['options']);return db[_0x8711('0xbb')][_0x8711('0x27')]({'where':_0x5ac2ba[_0x8711('0x59')]})[_0x8711('0x19')](function(_0x43c39c){_0x117616[_0x8711('0x27')]=_0x43c39c;if(_0x26c84c[_0x8711('0x50')][_0x8711('0x76')]){_0x5ac2ba[_0x8711('0x5f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8711('0xff')],'as':_0x8711('0x100'),'attributes':[_0x8711('0x33'),'fullname','internal'],'required':![]},{'model':db[_0x8711('0x101')],'as':_0x8711('0x102'),'attributes':['id',_0x8711('0x33'),_0x8711('0x103')],'where':_0x26c84c[_0x8711('0x50')][_0x8711('0x104')]?{'id':_0x26c84c[_0x8711('0x50')][_0x8711('0x104')]}:undefined,'required':_0x26c84c['query']['tag']?!![]:![]}];}return db[_0x8711('0xbb')][_0x8711('0x77')](_0x5ac2ba);})[_0x8711('0x19')](function(_0x1607f5){_0x117616[_0x8711('0x7e')]=_0x1607f5;return _0x117616;});}})[_0x8711('0x19')](respondWithFilteredResult(_0x44a135,_0x5ac2ba))[_0x8711('0x23')](handleError(_0x44a135,null));};exports[_0x8711('0x105')]=function(_0x4635bb,_0x69fe23){var _0x12c327=0x0;var _0x5656d4=0x0;var _0x498d54=![];var _0x496ef9;var _0x364c26;return db['ChatWebsite'][_0x8711('0x65')]({'where':{'id':_0x4635bb['params']['id']},'include':[{'model':db[_0x8711('0x9b')],'as':_0x8711('0x9b'),'include':[{'model':db[_0x8711('0x9b')],'as':_0x8711('0xad'),'attributes':['id',_0x8711('0xae')]}]}]})[_0x8711('0x19')](handleEntityNotFound(_0x69fe23,null))[_0x8711('0x19')](function(_0x453270){if(_0x453270){_0x496ef9=_0x453270;return _0x453270[_0x8711('0x106')]({'raw':!![]});}})['then'](function(_0x12a8fa){if(_0x496ef9){if(_0x12a8fa){_0x364c26=_0x12a8fa;}}return require(_0x8711('0x8a'))['getLicense']();})[_0x8711('0x19')](function(_0x5d83ab){if(_0x5d83ab){_0x5656d4=_0x5d83ab[_0x8711('0x107')];_0x498d54=_0x5d83ab['custom'];}})[_0x8711('0x19')](function(){return db[_0x8711('0xbb')]['count']({'where':{'closed':![]}});})['then'](function(_0x3d7a1c){_0x12c327=_0x3d7a1c;if(_0x5656d4&&_0x3d7a1c>_0x5656d4){return db[_0x8711('0x108')]['findOne']({'where':{'id':0x1}})[_0x8711('0x19')](function(_0x599431){if(_0x599431){_0x599431[_0x8711('0x109')](_0x8711('0x10a'));}});}})[_0x8711('0x19')](function(){var _0x4db598=_0x496ef9[_0x8711('0x9b')];var _0x6756e3=_0x496ef9[_0x8711('0x9d')]||undefined;return _0x4db598?_0x4db598[_0x8711('0x10b')](_0x6756e3):!![];})['then'](function(_0x4e828a){var _0x581b97=fs['readFileSync'](path['join'](config['root'],_0x8711('0x10c')),_0x8711('0xde'));var _0x34a20d='3.10.1';var _0x5f29c5=![];var _0x10757e,_0x45676b;if(_0x4635bb[_0x8711('0x10d')]['referer']){_0x10757e=new URL(_0x4635bb[_0x8711('0x10d')][_0x8711('0x3f')])[_0x8711('0x10e')];}else if(_0x4635bb[_0x8711('0x10d')]['origin']){_0x10757e=new URL(_0x4635bb[_0x8711('0x10d')]['origin'])[_0x8711('0x10e')];}else{_0x10757e=_0x8711('0x10f');}_0x45676b=typeof _0x496ef9[_0x8711('0x68')][_0x8711('0x3b')](',')[_0x8711('0x65')](function(_0x2cecbc){return wildcardUtils[_0x8711('0x110')](_0x2cecbc,_0x10757e);})!=='undefined';var _0x1e32f8={'chatVersion':_0x34a20d,'chatWebsiteAddressOrigin':_0x45676b?_0x10757e:_0x496ef9[_0x8711('0x68')],'remote':_0x496ef9['remote'],'query':querystring[_0x8711('0x1d')](_[_0x8711('0x5c')](_0x496ef9['get']({'plain':!![]}),{'customerIp':_0x4635bb[_0x8711('0x10d')]['x-forwarded-for']||_0x4635bb[_0x8711('0x10d')]['x-real-ip']||_0x4635bb[_0x8711('0x111')]['remoteAddress']||_0x4635bb['ip'],'referer':_0x4635bb['headers'][_0x8711('0x3f')],'openedInteractions':_0x12c327,'maxInteractions':_0x5656d4,'virtual':_0x498d54[_0x8711('0x107')],'online':_0x4e828a,'custom':_0x498d54,'address':_0x45676b?_0x10757e:null}))[_0x8711('0x112')](/'/g,'\x5c\x27')};_0x69fe23[_0x8711('0x34')](ejs[_0x8711('0xdf')](Mustache['render'](_0x581b97,_0x1e32f8),{'proactiveActions':_0x364c26,'alignment':_0x496ef9[_0x8711('0x113')],'verticalAlignment':_0x496ef9[_0x8711('0x114')],'div_color':_0x496ef9[_0x8711('0x103')],'labelText':_0x496ef9[_0x8711('0x115')],'text_color':_0x496ef9[_0x8711('0x116')],'text_button_color':_0x496ef9[_0x8711('0x117')],'button_color':_0x496ef9[_0x8711('0x118')],'background_color':_0x496ef9[_0x8711('0x119')],'hideWhenOffline':_0x496ef9[_0x8711('0x11a')],'intervalId':_0x496ef9[_0x8711('0x11b')],'isDevelopment':_0x5f29c5,'chatVersion':_0x34a20d}));})['catch'](handleError(_0x69fe23,null));};exports[_0x8711('0x11c')]=function(_0x44b35c,_0x865cec){var _0xa525a6=_0x44b35c[_0x8711('0x61')]['id'];var _0x168ff0=_0x44b35c[_0x8711('0x67')];var _0x3a347a=0xc8;var _0x152af9=null;return db['sequelize'][_0x8711('0xea')]({'isolationLevel':db[_0x8711('0xe9')][_0x8711('0x11d')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x23a174){return db[_0x8711('0x4d')][_0x8711('0x7d')]({'where':{'id':_0xa525a6},'transaction':_0x23a174})[_0x8711('0x19')](function(_0x30654f){if(_0x30654f){return db[_0x8711('0xab')][_0x8711('0x30')]({'where':{'ChatWebsiteId':_0xa525a6},'transaction':_0x23a174})[_0x8711('0x19')](function(){var _0x2819d1=_['map'](_0x168ff0,function(_0x1d9d6c){_0x1d9d6c[_0x8711('0x72')]=_0xa525a6;return _0x1d9d6c;});return db[_0x8711('0xab')][_0x8711('0xec')](_0x2819d1,{'transaction':_0x23a174});});}else{_0x3a347a=0x194;_0x152af9=[];}});})['then'](function(){if(_0x3a347a!==0x194){return db[_0x8711('0xab')][_0x8711('0x11e')]({'where':{'ChatWebsiteId':_0xa525a6},'order':_0x8711('0xb2')})['then'](function(_0x3d3d38){_0x152af9=_0x3d3d38;});}})[_0x8711('0x23')](function(_0x262ad5){_0x3a347a=0x1f4;logger[_0x8711('0x1f')](_0x262ad5[_0x8711('0x32')]);if(_0x262ad5[_0x8711('0x33')]){delete _0x262ad5[_0x8711('0x33')];}_0x152af9=_0x262ad5;})[_0x8711('0x11f')](function(){if(_0x152af9===null){_0x865cec[_0x8711('0x31')](_0x3a347a);}else{if(_0x3a347a===0x1f4){_0x865cec['status'](_0x3a347a)['send'](_0x152af9);}else{_0x865cec[_0x8711('0x24')](_0x3a347a)[_0x8711('0x25')](_0x152af9);}}});};exports[_0x8711('0x120')]=function(_0x355abe,_0x40923b){var _0x1f38e4={};var _0x3b8182={};var _0x522b07;var _0x4737a3;return db[_0x8711('0x4d')][_0x8711('0x7d')]({'where':{'id':_0x355abe['params']['id']}})['then'](handleEntityNotFound(_0x40923b,null))[_0x8711('0x19')](function(_0x11bc79){if(_0x11bc79){_0x522b07=_0x11bc79;_0x3b8182[_0x8711('0x46')]=_[_0x8711('0x75')](db['ChatApplication'][_0x8711('0x63')]);_0x3b8182[_0x8711('0x50')]=_[_0x8711('0x75')](_0x355abe[_0x8711('0x50')]);_0x3b8182[_0x8711('0x51')]=_[_0x8711('0x52')](_0x3b8182[_0x8711('0x46')],_0x3b8182[_0x8711('0x50')]);_0x1f38e4[_0x8711('0x53')]=_[_0x8711('0x52')](_0x3b8182[_0x8711('0x46')],qs[_0x8711('0x54')](_0x355abe[_0x8711('0x50')][_0x8711('0x54')]));_0x1f38e4['attributes']=_0x1f38e4[_0x8711('0x53')][_0x8711('0x64')]?_0x1f38e4[_0x8711('0x53')]:_0x3b8182['model'];_0x1f38e4[_0x8711('0x57')]=qs[_0x8711('0x58')](_0x355abe[_0x8711('0x50')][_0x8711('0x58')]);_0x1f38e4[_0x8711('0x59')]=qs[_0x8711('0x51')](_[_0x8711('0x5a')](_0x355abe[_0x8711('0x50')],_0x3b8182[_0x8711('0x51')]));if(_0x355abe[_0x8711('0x50')][_0x8711('0x5b')]){_0x1f38e4[_0x8711('0x59')]=_['merge'](_0x1f38e4[_0x8711('0x59')],{'$or':_[_0x8711('0x4c')](_0x1f38e4[_0x8711('0x53')],function(_0x15fb7d){var _0x42f6d6={};_0x42f6d6[_0x15fb7d]={'$like':'%'+_0x355abe[_0x8711('0x50')][_0x8711('0x5b')]+'%'};return _0x42f6d6;})});}_0x1f38e4=_['merge']({},_0x1f38e4,_0x355abe[_0x8711('0x5e')]);return _0x522b07[_0x8711('0x120')](_0x1f38e4);}})['then'](function(_0x490dfc){if(_0x490dfc){_0x4737a3=_0x490dfc[_0x8711('0x64')];if(!_0x355abe[_0x8711('0x50')][_0x8711('0x55')](_0x8711('0x56'))){_0x1f38e4[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x355abe['query'][_0x8711('0x29')]);_0x1f38e4[_0x8711('0x28')]=qs[_0x8711('0x28')](_0x355abe[_0x8711('0x50')][_0x8711('0x28')]);}return _0x522b07[_0x8711('0x120')](_0x1f38e4);}})[_0x8711('0x19')](function(_0x4602ae){if(_0x4602ae){return _0x4602ae?{'count':_0x4737a3,'rows':_0x4602ae}:null;}})[_0x8711('0x19')](respondWithResult(_0x40923b,null))[_0x8711('0x23')](handleError(_0x40923b,null));};exports[_0x8711('0x121')]=function(_0x46abe9,_0x316d74){return db['chatProactiveAction'][_0x8711('0x65')]({'where':{'id':_0x46abe9['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x316d74,null))[_0x8711('0x19')](function(_0x2b05cb){if(_0x2b05cb){return _0x2b05cb['addProactiveActions'](_0x46abe9['body'][_0x8711('0x79')],_[_0x8711('0x122')](_0x46abe9['body'],[_0x8711('0x79'),'id'])||{});}})['then'](respondWithResult(_0x316d74,null))[_0x8711('0x23')](handleError(_0x316d74,null));};exports[_0x8711('0x106')]=function(_0x4fd365,_0x41d14b){var _0x523515={};var _0x16e604={};var _0x423e17;var _0x3b4b04;return db['ChatWebsite'][_0x8711('0x7d')]({'where':{'id':_0x4fd365['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x41d14b,null))[_0x8711('0x19')](function(_0x1bfc1a){if(_0x1bfc1a){_0x423e17=_0x1bfc1a;_0x16e604[_0x8711('0x46')]=_[_0x8711('0x75')](db[_0x8711('0x123')][_0x8711('0x63')]);_0x16e604[_0x8711('0x50')]=_['keys'](_0x4fd365[_0x8711('0x50')]);_0x16e604[_0x8711('0x51')]=_[_0x8711('0x52')](_0x16e604['model'],_0x16e604[_0x8711('0x50')]);_0x523515[_0x8711('0x53')]=_[_0x8711('0x52')](_0x16e604[_0x8711('0x46')],qs[_0x8711('0x54')](_0x4fd365[_0x8711('0x50')]['fields']));_0x523515['attributes']=_0x523515[_0x8711('0x53')][_0x8711('0x64')]?_0x523515[_0x8711('0x53')]:_0x16e604[_0x8711('0x46')];_0x523515[_0x8711('0x57')]=qs[_0x8711('0x58')](_0x4fd365[_0x8711('0x50')]['sort']);_0x523515[_0x8711('0x59')]=qs[_0x8711('0x51')](_[_0x8711('0x5a')](_0x4fd365[_0x8711('0x50')],_0x16e604[_0x8711('0x51')]));if(_0x4fd365[_0x8711('0x50')][_0x8711('0x5b')]){_0x523515[_0x8711('0x59')]=_[_0x8711('0x5c')](_0x523515[_0x8711('0x59')],{'$or':_[_0x8711('0x4c')](_0x523515[_0x8711('0x53')],function(_0x1dd734){var _0x2f9a08={};_0x2f9a08[_0x1dd734]={'$like':'%'+_0x4fd365[_0x8711('0x50')][_0x8711('0x5b')]+'%'};return _0x2f9a08;})});}_0x523515=_[_0x8711('0x5c')]({},_0x523515,_0x4fd365[_0x8711('0x5e')]);return _0x423e17[_0x8711('0x106')](_0x523515);}})[_0x8711('0x19')](function(_0x41ee87){if(_0x41ee87){_0x3b4b04=_0x41ee87['length'];if(!_0x4fd365[_0x8711('0x50')][_0x8711('0x55')](_0x8711('0x56'))){_0x523515[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x4fd365[_0x8711('0x50')][_0x8711('0x29')]);_0x523515['offset']=qs[_0x8711('0x28')](_0x4fd365['query'][_0x8711('0x28')]);}return _0x423e17[_0x8711('0x106')](_0x523515);}})[_0x8711('0x19')](function(_0x218304){if(_0x218304){return _0x218304?{'count':_0x3b4b04,'rows':_0x218304}:null;}})[_0x8711('0x19')](respondWithResult(_0x41d14b,null))['catch'](handleError(_0x41d14b,null));};exports[_0x8711('0x124')]=function(_0x31f9f3,_0x416f56){var _0x374e46=_0x31f9f3['query'][_0x8711('0x125')]===_0x8711('0x126')?'offlineForm':_0x8711('0x127');return db['ChatWebsite'][_0x8711('0x65')]({'attributes':['id',_0x374e46],'where':{'id':_0x31f9f3[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x416f56,null))[_0x8711('0x19')](function(_0x2a94c1){if(_0x2a94c1){var _0x315c0f=_0x2a94c1[_0x374e46];var _0xfce89=_0x315c0f&&_0x315c0f[_0x8711('0x128')]?_0x315c0f[_0x8711('0x128')]:[];_0x416f56[_0x8711('0x34')]({'fromKey':_[_0x8711('0x93')](_0x315c0f[_0x8711('0x129')])?undefined:_0x315c0f[_0x8711('0x129')],'count':_0xfce89[_0x8711('0x64')],'rows':_0xfce89});}})[_0x8711('0x23')](handleError(_0x416f56,null));};exports[_0x8711('0x12a')]=function(_0xb22041,_0xa65247){var _0x27e5eb={'raw':![],'where':{}};var _0x7e4f82={};var _0x16c254={'count':0x0,'rows':[]};return db[_0x8711('0x4d')]['findOne']({'where':{'id':_0xb22041['params']['id']}})[_0x8711('0x19')](handleEntityNotFound(_0xa65247,null))[_0x8711('0x19')](function(_0x387cc9){if(_0x387cc9){_0x7e4f82[_0x8711('0x46')]=_['keys'](db[_0x8711('0xe2')]['rawAttributes']);_0x7e4f82[_0x8711('0x50')]=_[_0x8711('0x75')](_0xb22041[_0x8711('0x50')]);_0x7e4f82['filters']=_[_0x8711('0x52')](_0x7e4f82[_0x8711('0x46')],_0x7e4f82['query']);_0x27e5eb['attributes']=_[_0x8711('0x52')](_0x7e4f82[_0x8711('0x46')],qs[_0x8711('0x54')](_0xb22041['query']['fields']));_0x27e5eb[_0x8711('0x53')]=_0x27e5eb['attributes'][_0x8711('0x64')]?_0x27e5eb[_0x8711('0x53')]:_0x7e4f82[_0x8711('0x46')];if(!_0xb22041[_0x8711('0x50')][_0x8711('0x55')](_0x8711('0x56'))){_0x27e5eb['limit']=qs[_0x8711('0x29')](_0xb22041[_0x8711('0x50')][_0x8711('0x29')]);_0x27e5eb[_0x8711('0x28')]=qs['offset'](_0xb22041[_0x8711('0x50')]['offset']);}_0x27e5eb[_0x8711('0x57')]=qs[_0x8711('0x58')](_0xb22041[_0x8711('0x50')][_0x8711('0x58')]);_0x27e5eb[_0x8711('0x59')]=qs['filters'](_['pick'](_0xb22041[_0x8711('0x50')],_0x7e4f82[_0x8711('0x51')]));_0x27e5eb[_0x8711('0x59')]['ChatWebsiteId']=_0x387cc9['id'];if(_0xb22041['query']['filter']){_0x27e5eb[_0x8711('0x59')]=_[_0x8711('0x5c')](_0x27e5eb[_0x8711('0x59')],{'$or':_[_0x8711('0x4c')](_0x27e5eb[_0x8711('0x53')],function(_0x297c87){var _0x38f69f={};_0x38f69f[_0x297c87]={'$like':'%'+_0xb22041['query'][_0x8711('0x5b')]+'%'};return _0x38f69f;})});}_0x27e5eb=_[_0x8711('0x5c')]({},_0x27e5eb,_0xb22041[_0x8711('0x5e')]);return db[_0x8711('0xe2')]['count']({'where':_0x27e5eb['where']})[_0x8711('0x19')](function(_0x1f59be){_0x16c254['count']=_0x1f59be;if(_0xb22041[_0x8711('0x50')][_0x8711('0x76')]){_0x27e5eb['include']=[{'all':!![]}];}else{_0x27e5eb[_0x8711('0x5f')]=[{'model':db[_0x8711('0xa3')],'as':_0x8711('0x12b'),'required':![]},{'model':db[_0x8711('0xeb')],'as':_0x8711('0x12c'),'required':![]}];}return db[_0x8711('0xe2')][_0x8711('0x77')](_0x27e5eb);})[_0x8711('0x19')](function(_0x1814aa){_0x16c254[_0x8711('0x7e')]=_0x1814aa;return _0x16c254;});}})[_0x8711('0x19')](respondWithFilteredResult(_0xa65247,_0x27e5eb))[_0x8711('0x23')](handleError(_0xa65247,null));};exports[_0x8711('0x12d')]=function(_0x324484,_0x337c9f){return db[_0x8711('0x4d')][_0x8711('0x65')]({'where':{'id':_0x324484[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x337c9f,null))[_0x8711('0x19')](function(_0x34aab4){if(_0x34aab4){return _0x34aab4[_0x8711('0x12d')](_0x324484[_0x8711('0x67')][_0x8711('0x79')],_[_0x8711('0x122')](_0x324484[_0x8711('0x67')],[_0x8711('0x79'),'id'])||{})[_0x8711('0xdb')](function(_0x1b253c){for(var _0x4cc632=0x0;_0x4cc632<_0x324484[_0x8711('0x67')][_0x8711('0x79')]['length'];_0x4cc632+=0x1){socket[_0x8711('0x12e')](_0x8711('0x12f'),{'UserId':Number(_0x324484['body']['ids'][_0x4cc632]),'ChatWebsiteId':Number(_0x324484['params']['id'])});}return _0x1b253c;});}})[_0x8711('0x19')](respondWithResult(_0x337c9f,null))[_0x8711('0x23')](handleError(_0x337c9f,null));};exports[_0x8711('0x130')]=function(_0x26e74f,_0x3eb389){return db['ChatWebsite']['find']({'where':{'id':_0x26e74f[_0x8711('0x61')]['id']}})[_0x8711('0x19')](handleEntityNotFound(_0x3eb389,null))['then'](function(_0x49dab7){if(_0x49dab7){return _0x49dab7[_0x8711('0x130')](_0x26e74f[_0x8711('0x50')][_0x8711('0x79')])[_0x8711('0x19')](function(){if(_['isArray'](_0x26e74f[_0x8711('0x50')]['ids'])){for(var _0x284556=0x0;_0x284556<_0x26e74f[_0x8711('0x50')][_0x8711('0x79')]['length'];_0x284556+=0x1){socket[_0x8711('0x12e')](_0x8711('0x131'),{'UserId':Number(_0x26e74f[_0x8711('0x50')][_0x8711('0x79')][_0x284556]),'ChatWebsiteId':Number(_0x26e74f[_0x8711('0x61')]['id'])});}}else{socket['emit'](_0x8711('0x131'),{'UserId':Number(_0x26e74f[_0x8711('0x50')][_0x8711('0x79')]),'ChatWebsiteId':Number(_0x26e74f[_0x8711('0x61')]['id'])});}});}})[_0x8711('0x19')](respondWithStatusCode(_0x3eb389,null))[_0x8711('0x23')](handleError(_0x3eb389,null));};exports[_0x8711('0x132')]=function(_0x33fcac,_0x13ddd0){var _0x2e7cb5={};var _0x455c1f={};var _0x1a0191;var _0xc335ea;return db[_0x8711('0x4d')][_0x8711('0x7d')]({'where':{'id':_0x33fcac['params']['id']}})['then'](handleEntityNotFound(_0x13ddd0,null))[_0x8711('0x19')](function(_0x32b985){if(_0x32b985){_0x1a0191=_0x32b985;_0x455c1f[_0x8711('0x46')]=_[_0x8711('0x75')](db[_0x8711('0xff')][_0x8711('0x63')]);_0x455c1f[_0x8711('0x50')]=_[_0x8711('0x75')](_0x33fcac[_0x8711('0x50')]);_0x455c1f[_0x8711('0x51')]=_[_0x8711('0x52')](_0x455c1f['model'],_0x455c1f[_0x8711('0x50')]);_0x2e7cb5['attributes']=_['intersection'](_0x455c1f[_0x8711('0x46')],qs[_0x8711('0x54')](_0x33fcac['query']['fields']));_0x2e7cb5[_0x8711('0x53')]=_0x2e7cb5[_0x8711('0x53')][_0x8711('0x64')]?_0x2e7cb5[_0x8711('0x53')]:_0x455c1f['model'];_0x2e7cb5[_0x8711('0x57')]=qs[_0x8711('0x58')](_0x33fcac[_0x8711('0x50')]['sort']);_0x2e7cb5[_0x8711('0x59')]=qs[_0x8711('0x51')](_[_0x8711('0x5a')](_0x33fcac['query'],_0x455c1f[_0x8711('0x51')]));if(_0x33fcac[_0x8711('0x50')]['filter']){_0x2e7cb5[_0x8711('0x59')]=_['merge'](_0x2e7cb5[_0x8711('0x59')],{'$or':_['map'](_0x2e7cb5[_0x8711('0x53')],function(_0x363e16){var _0x12d40d={};_0x12d40d[_0x363e16]={'$like':'%'+_0x33fcac[_0x8711('0x50')][_0x8711('0x5b')]+'%'};return _0x12d40d;})});}_0x2e7cb5=_[_0x8711('0x5c')]({},_0x2e7cb5,_0x33fcac[_0x8711('0x5e')]);return _0x1a0191[_0x8711('0x132')](_0x2e7cb5);}})[_0x8711('0x19')](function(_0x6d4ce3){if(_0x6d4ce3){_0xc335ea=_0x6d4ce3[_0x8711('0x64')];if(!_0x33fcac['query'][_0x8711('0x55')](_0x8711('0x56'))){_0x2e7cb5[_0x8711('0x29')]=qs[_0x8711('0x29')](_0x33fcac[_0x8711('0x50')][_0x8711('0x29')]);_0x2e7cb5[_0x8711('0x28')]=qs[_0x8711('0x28')](_0x33fcac[_0x8711('0x50')][_0x8711('0x28')]);}return _0x1a0191[_0x8711('0x132')](_0x2e7cb5);}})[_0x8711('0x19')](function(_0x243a0e){if(_0x243a0e){return _0x243a0e?{'count':_0xc335ea,'rows':_0x243a0e}:null;}})['then'](respondWithResult(_0x13ddd0,null))[_0x8711('0x23')](handleError(_0x13ddd0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 767276d..92322ae 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 _0xca9e=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x275a19,_0x310d3a){var _0x37b693=function(_0x3048df){while(--_0x3048df){_0x275a19['push'](_0x275a19['shift']());}};_0x37b693(++_0x310d3a);}(_0xca9e,0x136));var _0xeca9=function(_0x5f6980,_0x144ad4){_0x5f6980=_0x5f6980-0x0;var _0xcb091a=_0xca9e[_0x5f6980];return _0xcb091a;};'use strict';var EventEmitter=require(_0xeca9('0x0'));var ChatWebsite=require(_0xeca9('0x1'))['db'][_0xeca9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xeca9('0x3')](0x0);var events={'afterCreate':_0xeca9('0x4'),'afterUpdate':_0xeca9('0x5'),'afterDestroy':_0xeca9('0x6')};function emitEvent(_0x2c6185){return function(_0x1b2864,_0x1e0a18,_0x3aba81){ChatWebsiteEvents[_0xeca9('0x7')](_0x2c6185+':'+_0x1b2864['id'],_0x1b2864);ChatWebsiteEvents[_0xeca9('0x7')](_0x2c6185,_0x1b2864);_0x3aba81(null);};}for(var e in events){if(events[_0xeca9('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xeca9('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x99c9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x3c569d,_0x13f97d){var _0x5f3326=function(_0xf005f3){while(--_0xf005f3){_0x3c569d['push'](_0x3c569d['shift']());}};_0x5f3326(++_0x13f97d);}(_0x99c9,0x13c));var _0x999c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x99c9[_0x36ed48];return _0x51c63a;};'use strict';var EventEmitter=require(_0x999c('0x0'));var ChatWebsite=require(_0x999c('0x1'))['db'][_0x999c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x999c('0x3')](0x0);var events={'afterCreate':_0x999c('0x4'),'afterUpdate':_0x999c('0x5'),'afterDestroy':_0x999c('0x6')};function emitEvent(_0x52dc75){return function(_0x2a4e06,_0x140cd5,_0x2d4f2d){ChatWebsiteEvents[_0x999c('0x7')](_0x52dc75+':'+_0x2a4e06['id'],_0x2a4e06);ChatWebsiteEvents[_0x999c('0x7')](_0x52dc75,_0x2a4e06);_0x2d4f2d(null);};}for(var e in events){if(events[_0x999c('0x8')](e)){var event=events[e];ChatWebsite[_0x999c('0x9')](e,emitEvent(event));}}module[_0x999c('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 0878079..32652b3 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 _0x7bf2=['lodash','util','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x3d30d5,_0x4f767c){var _0x2ff33f=function(_0x10c7da){while(--_0x10c7da){_0x3d30d5['push'](_0x3d30d5['shift']());}};_0x2ff33f(++_0x4f767c);}(_0x7bf2,0x197));var _0x27bf=function(_0x1d997d,_0x35df68){_0x1d997d=_0x1d997d-0x0;var _0x4d0d9a=_0x7bf2[_0x1d997d];return _0x4d0d9a;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x27bf('0x2'));var BPromise=require(_0x27bf('0x3'));var rp=require(_0x27bf('0x4'));var fs=require('fs');var path=require(_0x27bf('0x5'));var rimraf=require(_0x27bf('0x6'));var config=require('../../config/environment');var attributes=require(_0x27bf('0x7'));module['exports']=function(_0x499b06,_0x3311fb){return _0x499b06[_0x27bf('0x8')](_0x27bf('0x9'),attributes,{'tableName':_0x27bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x993d=['../../config/environment','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x22c5df,_0x445b1a){var _0x193166=function(_0x43ef54){while(--_0x43ef54){_0x22c5df['push'](_0x22c5df['shift']());}};_0x193166(++_0x445b1a);}(_0x993d,0x7c));var _0xd993=function(_0x42203c,_0x448a8a){_0x42203c=_0x42203c-0x0;var _0x267a6d=_0x993d[_0x42203c];return _0x267a6d;};'use strict';var _=require(_0xd993('0x0'));var util=require(_0xd993('0x1'));var logger=require(_0xd993('0x2'))(_0xd993('0x3'));var moment=require(_0xd993('0x4'));var BPromise=require('bluebird');var rp=require(_0xd993('0x5'));var fs=require('fs');var path=require(_0xd993('0x6'));var rimraf=require(_0xd993('0x7'));var config=require(_0xd993('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0xa4c7da,_0x2bcf5a){return _0xa4c7da[_0xd993('0x9')](_0xd993('0xa'),attributes,{'tableName':_0xd993('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index f5b387b..58e5568 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 _0x8823=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x10cf03,_0x5e1bdd){var _0x2b8be8=function(_0x1bb1a7){while(--_0x1bb1a7){_0x10cf03['push'](_0x10cf03['shift']());}};_0x2b8be8(++_0x5e1bdd);}(_0x8823,0x194));var _0x3882=function(_0x308a1b,_0x457867){_0x308a1b=_0x308a1b-0x0;var _0x50fd46=_0x8823[_0x308a1b];return _0x50fd46;};'use strict';var _=require(_0x3882('0x0'));var util=require(_0x3882('0x1'));var moment=require(_0x3882('0x2'));var BPromise=require(_0x3882('0x3'));var rs=require(_0x3882('0x4'));var fs=require('fs');var Redis=require(_0x3882('0x5'));var db=require(_0x3882('0x6'))['db'];var utils=require(_0x3882('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3882('0x8'));var jayson=require(_0x3882('0x9'));var client=jayson[_0x3882('0xa')][_0x3882('0xb')]({'port':0x232a});config[_0x3882('0xc')]=_[_0x3882('0xd')](config['redis'],{'host':_0x3882('0xe'),'port':0x18eb});var socket=require(_0x3882('0xf'))(new Redis(config['redis']));require(_0x3882('0x10'))['register'](socket);function respondWithRpcPromise(_0x4caac8,_0x330abf,_0xc607eb){return new BPromise(function(_0xfc04e3,_0x39a3cb){return client[_0x3882('0x11')](_0x4caac8,_0xc607eb)[_0x3882('0x12')](function(_0x2b363a){logger[_0x3882('0x13')](_0x3882('0x14'),_0x330abf,'request\x20sent');logger[_0x3882('0x15')](_0x3882('0x16'),_0x330abf,_0x3882('0x17'),JSON[_0x3882('0x18')](_0x2b363a));if(_0x2b363a[_0x3882('0x19')]){if(_0x2b363a[_0x3882('0x19')][_0x3882('0x1a')]===0x1f4){logger['error'](_0x3882('0x14'),_0x330abf,_0x2b363a[_0x3882('0x19')][_0x3882('0x1b')]);return _0x39a3cb(_0x2b363a[_0x3882('0x19')]['message']);}logger[_0x3882('0x19')](_0x3882('0x14'),_0x330abf,_0x2b363a[_0x3882('0x19')]['message']);return _0xfc04e3(_0x2b363a[_0x3882('0x19')][_0x3882('0x1b')]);}else{logger[_0x3882('0x13')](_0x3882('0x14'),_0x330abf,'request\x20sent');_0xfc04e3(_0x2b363a['result'][_0x3882('0x1b')]);}})[_0x3882('0x1c')](function(_0x4ea910){logger[_0x3882('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x330abf,_0x4ea910);_0x39a3cb(_0x4ea910);});});} \ No newline at end of file +var _0xbe31=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x18a5b3,_0x4f4784){var _0x54b51c=function(_0x42773a){while(--_0x42773a){_0x18a5b3['push'](_0x18a5b3['shift']());}};_0x54b51c(++_0x4f4784);}(_0xbe31,0x103));var _0x1be3=function(_0x11e2f0,_0x150828){_0x11e2f0=_0x11e2f0-0x0;var _0x1d9680=_0xbe31[_0x11e2f0];return _0x1d9680;};'use strict';var _=require(_0x1be3('0x0'));var util=require(_0x1be3('0x1'));var moment=require(_0x1be3('0x2'));var BPromise=require(_0x1be3('0x3'));var rs=require(_0x1be3('0x4'));var fs=require('fs');var Redis=require(_0x1be3('0x5'));var db=require(_0x1be3('0x6'))['db'];var utils=require(_0x1be3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1be3('0x8'));var jayson=require(_0x1be3('0x9'));var client=jayson['client'][_0x1be3('0xa')]({'port':0x232a});config[_0x1be3('0xb')]=_[_0x1be3('0xc')](config[_0x1be3('0xb')],{'host':_0x1be3('0xd'),'port':0x18eb});var socket=require(_0x1be3('0xe'))(new Redis(config[_0x1be3('0xb')]));require('./chatWebsite.socket')[_0x1be3('0xf')](socket);function respondWithRpcPromise(_0x480651,_0x5362e4,_0x2ee1f0){return new BPromise(function(_0x4440bc,_0x370bce){return client[_0x1be3('0x10')](_0x480651,_0x2ee1f0)[_0x1be3('0x11')](function(_0x1f9c7b){logger['info'](_0x1be3('0x12'),_0x5362e4,'request\x20sent');logger['debug'](_0x1be3('0x13'),_0x5362e4,_0x1be3('0x14'),JSON[_0x1be3('0x15')](_0x1f9c7b));if(_0x1f9c7b['error']){if(_0x1f9c7b[_0x1be3('0x16')][_0x1be3('0x17')]===0x1f4){logger[_0x1be3('0x16')](_0x1be3('0x12'),_0x5362e4,_0x1f9c7b[_0x1be3('0x16')][_0x1be3('0x18')]);return _0x370bce(_0x1f9c7b[_0x1be3('0x16')]['message']);}logger[_0x1be3('0x16')](_0x1be3('0x12'),_0x5362e4,_0x1f9c7b[_0x1be3('0x16')][_0x1be3('0x18')]);return _0x4440bc(_0x1f9c7b[_0x1be3('0x16')]['message']);}else{logger[_0x1be3('0x19')](_0x1be3('0x12'),_0x5362e4,_0x1be3('0x14'));_0x4440bc(_0x1f9c7b[_0x1be3('0x1a')][_0x1be3('0x18')]);}})[_0x1be3('0x1b')](function(_0x466ab5){logger[_0x1be3('0x16')](_0x1be3('0x12'),_0x5362e4,_0x466ab5);_0x370bce(_0x466ab5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 40a7d09..e6bfc05 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 _0xd4b4=['register','length','save','remove','update'];(function(_0x3f9455,_0x44a884){var _0xbef00=function(_0x158c09){while(--_0x158c09){_0x3f9455['push'](_0x3f9455['shift']());}};_0xbef00(++_0x44a884);}(_0xd4b4,0x1b5));var _0x4d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b4[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x4d4b('0x0'),_0x4d4b('0x1'),_0x4d4b('0x2')];function createListener(_0x51e872,_0x2cebe5){return function(_0x58e288){_0x2cebe5['emit'](_0x51e872,_0x58e288);};}function removeListener(_0x302546,_0x33ca05){return function(){ChatWebsiteEvents['removeListener'](_0x302546,_0x33ca05);};}exports[_0x4d4b('0x3')]=function(_0x3c62d6){for(var _0x10c694=0x0,_0x316a0d=events[_0x4d4b('0x4')];_0x10c694<_0x316a0d;_0x10c694++){var _0x1b984f=events[_0x10c694];var _0x363bbb=createListener('chatWebsite:'+_0x1b984f,_0x3c62d6);ChatWebsiteEvents['on'](_0x1b984f,_0x363bbb);}}; \ No newline at end of file +var _0x21ef=['remove','update','removeListener','register','length','chatWebsite:'];(function(_0x40e074,_0x391ad8){var _0x33014d=function(_0x3e1983){while(--_0x3e1983){_0x40e074['push'](_0x40e074['shift']());}};_0x33014d(++_0x391ad8);}(_0x21ef,0x108));var _0xf21e=function(_0x48d0d2,_0xa6a3ee){_0x48d0d2=_0x48d0d2-0x0;var _0x176c2b=_0x21ef[_0x48d0d2];return _0x176c2b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xf21e('0x0'),_0xf21e('0x1')];function createListener(_0x2032b8,_0x208231){return function(_0x2aa165){_0x208231['emit'](_0x2032b8,_0x2aa165);};}function removeListener(_0x352bd7,_0x7c82ef){return function(){ChatWebsiteEvents[_0xf21e('0x2')](_0x352bd7,_0x7c82ef);};}exports[_0xf21e('0x3')]=function(_0x2ff04a){for(var _0x2b4fdc=0x0,_0x4384fe=events[_0xf21e('0x4')];_0x2b4fdc<_0x4384fe;_0x2b4fdc++){var _0x294e38=events[_0x2b4fdc];var _0x2dc2f2=createListener(_0xf21e('0x5')+_0x294e38,_0x2ff04a);ChatWebsiteEvents['on'](_0x294e38,_0x2dc2f2);}}; \ 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 63df001..96e14de 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 _0xb91a=['test','escapeRegExp','url','URL','replace','localhost'];(function(_0x54efc0,_0x5aeea2){var _0x2df0eb=function(_0x2ec005){while(--_0x2ec005){_0x54efc0['push'](_0x54efc0['shift']());}};_0x2df0eb(++_0x5aeea2);}(_0xb91a,0xe5));var _0xab91=function(_0x13ab0a,_0x1c71ae){_0x13ab0a=_0x13ab0a-0x0;var _0xd3cd5f=_0xb91a[_0x13ab0a];return _0xd3cd5f;};var escapeRegExp=require('../../../utils/misc')[_0xab91('0x0')];var URL=require(_0xab91('0x1'))[_0xab91('0x2')];function testWildcardValidity(_0x182972){var _0x485c32=!![];try{new URL(_0x182972[_0xab91('0x3')]('*',_0xab91('0x4')));}catch(_0x53c757){_0x485c32=![];}return _0x485c32&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xab91('0x5')](_0x182972);}function testWebsiteWithWildcard(_0x4ec84d,_0x54c9f4){var _0x1f99d4;var _0x1cce1e=escapeRegExp(_0x4ec84d['trim']()[_0xab91('0x3')](/\/$/,''))[_0xab91('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x4ec84d[_0xab91('0x3')]('\x5c*',_0xab91('0x4')));_0x1f99d4=new RegExp(_0x1cce1e)['test'](_0x54c9f4);}catch(_0x5765fc){_0x1f99d4=![];}return _0x1f99d4;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xd991=['URL','replace','localhost','test','trim','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp','url'];(function(_0x24a8f1,_0xafbff1){var _0x1bb3b2=function(_0x4d65c1){while(--_0x4d65c1){_0x24a8f1['push'](_0x24a8f1['shift']());}};_0x1bb3b2(++_0xafbff1);}(_0xd991,0x115));var _0x1d99=function(_0x45f2d6,_0x5df5ec){_0x45f2d6=_0x45f2d6-0x0;var _0x341361=_0xd991[_0x45f2d6];return _0x341361;};var escapeRegExp=require(_0x1d99('0x0'))[_0x1d99('0x1')];var URL=require(_0x1d99('0x2'))[_0x1d99('0x3')];function testWildcardValidity(_0x163bfb){var _0x5e7e82=!![];try{new URL(_0x163bfb[_0x1d99('0x4')]('*',_0x1d99('0x5')));}catch(_0xf03459){_0x5e7e82=![];}return _0x5e7e82&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x1d99('0x6')](_0x163bfb);}function testWebsiteWithWildcard(_0x300c32,_0x1474ff){var _0x5f3a37;var _0x1adbca=escapeRegExp(_0x300c32[_0x1d99('0x7')]()['replace'](/\/$/,''))[_0x1d99('0x4')]('\x5c*',_0x1d99('0x8'));try{new URL(_0x300c32[_0x1d99('0x4')]('\x5c*',_0x1d99('0x5')));_0x5f3a37=new RegExp(_0x1adbca)[_0x1d99('0x6')](_0x1474ff);}catch(_0x3d55b1){_0x5f3a37=![];}return _0x5f3a37;}module[_0x1d99('0x9')]={'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 a830be3..5c61717 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 _0x00fb=['get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','server/files/images/avatars/','single','file','addCustomerAvatar','/:id/notify','notify','server/files','attachments','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./chatWebsite.controller'];(function(_0x371d15,_0xd98587){var _0x32afdf=function(_0x587ba3){while(--_0x587ba3){_0x371d15['push'](_0x371d15['shift']());}};_0x32afdf(++_0xd98587);}(_0x00fb,0xc3));var _0xb00f=function(_0x69b0bf,_0x248a70){_0x69b0bf=_0x69b0bf-0x0;var _0x53a201=_0x00fb[_0x69b0bf];return _0x53a201;};'use strict';var multer=require(_0xb00f('0x0'));var util=require(_0xb00f('0x1'));var path=require('path');var timeout=require(_0xb00f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb00f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb00f('0x4'));var config=require('../../config/environment');var controller=require(_0xb00f('0x5'));router[_0xb00f('0x6')]('/',auth[_0xb00f('0x7')](),controller['index']);router[_0xb00f('0x6')]('/describe',auth[_0xb00f('0x7')](),controller[_0xb00f('0x8')]);router[_0xb00f('0x6')](_0xb00f('0x9'),auth[_0xb00f('0x7')](),controller[_0xb00f('0xa')]);router[_0xb00f('0x6')](_0xb00f('0xb'),auth[_0xb00f('0x7')](),controller[_0xb00f('0xc')]);router[_0xb00f('0x6')](_0xb00f('0xd'),auth['isAuthenticated'](),controller[_0xb00f('0xe')]);router['get'](_0xb00f('0xf'),controller['getLogo']);router[_0xb00f('0x6')](_0xb00f('0x10'),controller[_0xb00f('0x11')]);router[_0xb00f('0x6')](_0xb00f('0x12'),controller[_0xb00f('0x13')]);router['get'](_0xb00f('0x14'),controller[_0xb00f('0x15')]);router['get'](_0xb00f('0x16'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x17')]);router[_0xb00f('0x6')](_0xb00f('0x18'),controller['getSnippet']);router[_0xb00f('0x6')](_0xb00f('0x19'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x1a')]);router['get'](_0xb00f('0x1b'),auth[_0xb00f('0x7')](),controller['getProactiveActions']);router[_0xb00f('0x6')]('/:id/fields',controller[_0xb00f('0x1c')]);router['get'](_0xb00f('0x1d'),auth['isAuthenticated'](),controller[_0xb00f('0x1e')]);router[_0xb00f('0x6')](_0xb00f('0x1f'),auth['isAuthenticated'](),controller[_0xb00f('0x20')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb00f('0x21')]('/:id/dispositions',auth[_0xb00f('0x7')](),controller['addDisposition']);router[_0xb00f('0x21')](_0xb00f('0xd'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x22')]);var upload=multer({'storage':multer[_0xb00f('0x23')]({'destination':function(_0x1ddb74,_0x4869e4,_0x1079ef){_0x1079ef(null,path[_0xb00f('0x24')](config[_0xb00f('0x25')],_0xb00f('0x26')));},'filename':function(_0x2f4d20,_0x4cc239,_0x5a7a7f){_0x5a7a7f(null,util[_0xb00f('0x27')](_0xb00f('0x28'),Date[_0xb00f('0x29')](),_0x4cc239[_0xb00f('0x2a')]));}})});router[_0xb00f('0x21')](_0xb00f('0xf'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42ea66,_0x37cb83,_0x17f08b){_0x17f08b(null,path[_0xb00f('0x24')](config[_0xb00f('0x25')],_0xb00f('0x2b')));},'filename':function(_0xcfcd83,_0x13b73a,_0x410e5b){_0x410e5b(null,util[_0xb00f('0x27')](_0xb00f('0x28'),Date[_0xb00f('0x29')](),_0x13b73a[_0xb00f('0x2a')]));}})});router[_0xb00f('0x21')](_0xb00f('0x10'),upload[_0xb00f('0x2c')](_0xb00f('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0xb00f('0x23')]({'destination':function(_0x508372,_0x549856,_0x59ac1c){_0x59ac1c(null,path['join'](config['root'],_0xb00f('0x2b')));},'filename':function(_0x4a72a8,_0x3c0fcc,_0x429557){_0x429557(null,util[_0xb00f('0x27')](_0xb00f('0x28'),Date[_0xb00f('0x29')](),_0x3c0fcc[_0xb00f('0x2a')]));}})});router[_0xb00f('0x21')]('/:id/customer_avatar',upload[_0xb00f('0x2c')](_0xb00f('0x2d')),controller[_0xb00f('0x2e')]);var upload=multer({'storage':multer[_0xb00f('0x23')]({'destination':function(_0x467b12,_0x59433c,_0x738a31){_0x738a31(null,path[_0xb00f('0x24')](config['root'],_0xb00f('0x2b')));},'filename':function(_0x5a7fe1,_0x28444f,_0x1dc7c7){_0x1dc7c7(null,util[_0xb00f('0x27')](_0xb00f('0x28'),Date[_0xb00f('0x29')](),_0x28444f['originalname']));}})});router['post'](_0xb00f('0x14'),upload[_0xb00f('0x2c')]('file'),controller['addSystemAvatar']);router[_0xb00f('0x21')](_0xb00f('0x2f'),controller[_0xb00f('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x310da2,_0x27d5a5,_0x4be295){const _0x499693=path[_0xb00f('0x24')](config['root'],_0xb00f('0x31'),_0xb00f('0x32'),'offline-chat');fs_extra['ensureDir'](_0x499693,function(){_0x4be295(null,_0x499693);});},'filename':function(_0x50e325,_0x801f6b,_0x37f9fc){const _0x227491=_0x801f6b[_0xb00f('0x2a')][_0xb00f('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1135a9=path[_0xb00f('0x34')](_0x227491);const _0x4c0780=Date[_0xb00f('0x29')]()+'-'+_0x227491[_0xb00f('0x33')](_0x1135a9,'')+_0x1135a9;_0x37f9fc(null,_0x4c0780);}})});router[_0xb00f('0x21')](_0xb00f('0x35'),offlineUploadMulter[_0xb00f('0x36')](),controller[_0xb00f('0x37')]);router[_0xb00f('0x21')](_0xb00f('0x16'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x38')]);router[_0xb00f('0x21')](_0xb00f('0x19'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x39')]);router[_0xb00f('0x21')](_0xb00f('0x1b'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x3a')]);router['post']('/:id/users',auth[_0xb00f('0x7')](),controller[_0xb00f('0x3b')]);router[_0xb00f('0x3c')]('/:id',auth['isAuthenticated'](),controller[_0xb00f('0x3d')]);router[_0xb00f('0x3e')](_0xb00f('0x9'),auth['isAuthenticated'](),controller[_0xb00f('0x3f')]);router[_0xb00f('0x3e')](_0xb00f('0xb'),auth[_0xb00f('0x7')](),controller[_0xb00f('0x40')]);router[_0xb00f('0x3e')](_0xb00f('0xd'),auth[_0xb00f('0x7')](),controller['removeAnswers']);router[_0xb00f('0x3e')]('/:id/users',auth[_0xb00f('0x7')](),controller[_0xb00f('0x41')]);module[_0xb00f('0x42')]=router; \ No newline at end of file +var _0x3c00=['attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','diskStorage','join','server/files/images/logos/','format','%s-%s','file','addLogo','server/files/images/avatars/','originalname','/:id/avatar','single','addAvatar','now','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files'];(function(_0x483463,_0x3e8519){var _0x740611=function(_0x5b6971){while(--_0x5b6971){_0x483463['push'](_0x483463['shift']());}};_0x740611(++_0x3e8519);}(_0x3c00,0x18b));var _0x03c0=function(_0x3d4677,_0x1e3dd8){_0x3d4677=_0x3d4677-0x0;var _0x2ea5a5=_0x3c00[_0x3d4677];return _0x2ea5a5;};'use strict';var multer=require('multer');var util=require(_0x03c0('0x0'));var path=require(_0x03c0('0x1'));var timeout=require(_0x03c0('0x2'));var express=require(_0x03c0('0x3'));var router=express[_0x03c0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x03c0('0x5'));var interaction=require(_0x03c0('0x6'));var config=require(_0x03c0('0x7'));var controller=require(_0x03c0('0x8'));router['get']('/',auth[_0x03c0('0x9')](),controller[_0x03c0('0xa')]);router[_0x03c0('0xb')](_0x03c0('0xc'),auth['isAuthenticated'](),controller[_0x03c0('0xd')]);router[_0x03c0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x03c0('0xe')]);router['get'](_0x03c0('0xf'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x10')]);router[_0x03c0('0xb')](_0x03c0('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x03c0('0x12'),controller[_0x03c0('0x13')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0x03c0('0xb')](_0x03c0('0x14'),controller[_0x03c0('0x15')]);router[_0x03c0('0xb')](_0x03c0('0x16'),controller[_0x03c0('0x17')]);router[_0x03c0('0xb')]('/:id/interactions',auth[_0x03c0('0x9')](),controller[_0x03c0('0x18')]);router[_0x03c0('0xb')](_0x03c0('0x19'),controller[_0x03c0('0x1a')]);router[_0x03c0('0xb')]('/:id/applications',auth[_0x03c0('0x9')](),controller['getApplications']);router[_0x03c0('0xb')](_0x03c0('0x1b'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x1c')]);router[_0x03c0('0xb')](_0x03c0('0x1d'),controller[_0x03c0('0x1e')]);router['get'](_0x03c0('0x1f'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x20')]);router[_0x03c0('0xb')](_0x03c0('0x21'),auth['isAuthenticated'](),controller['getAgents']);router[_0x03c0('0x22')]('/',auth[_0x03c0('0x9')](),controller[_0x03c0('0x23')]);router['post'](_0x03c0('0xf'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x24')]);router[_0x03c0('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0x03c0('0x25')]({'destination':function(_0x5eec2c,_0x4617ee,_0x52be23){_0x52be23(null,path[_0x03c0('0x26')](config['root'],_0x03c0('0x27')));},'filename':function(_0xd3b7f,_0x13d55e,_0x374f61){_0x374f61(null,util[_0x03c0('0x28')](_0x03c0('0x29'),Date['now'](),_0x13d55e['originalname']));}})});router['post'](_0x03c0('0x12'),upload['single'](_0x03c0('0x2a')),controller[_0x03c0('0x2b')]);var upload=multer({'storage':multer[_0x03c0('0x25')]({'destination':function(_0x1adf32,_0x1e7c25,_0x3db049){_0x3db049(null,path[_0x03c0('0x26')](config['root'],_0x03c0('0x2c')));},'filename':function(_0x438c09,_0x37a6c4,_0x5cb558){_0x5cb558(null,util[_0x03c0('0x28')](_0x03c0('0x29'),Date['now'](),_0x37a6c4[_0x03c0('0x2d')]));}})});router[_0x03c0('0x22')](_0x03c0('0x2e'),upload[_0x03c0('0x2f')](_0x03c0('0x2a')),controller[_0x03c0('0x30')]);var upload=multer({'storage':multer[_0x03c0('0x25')]({'destination':function(_0x439200,_0x12f400,_0x1a288a){_0x1a288a(null,path[_0x03c0('0x26')](config['root'],_0x03c0('0x2c')));},'filename':function(_0x21eda3,_0x56ddb7,_0x16c2fc){_0x16c2fc(null,util[_0x03c0('0x28')]('%s-%s',Date[_0x03c0('0x31')](),_0x56ddb7['originalname']));}})});router[_0x03c0('0x22')](_0x03c0('0x14'),upload[_0x03c0('0x2f')](_0x03c0('0x2a')),controller[_0x03c0('0x32')]);var upload=multer({'storage':multer[_0x03c0('0x25')]({'destination':function(_0x1ad494,_0x25ebf7,_0x207423){_0x207423(null,path['join'](config['root'],_0x03c0('0x2c')));},'filename':function(_0x484e4b,_0x489dd8,_0x54db79){_0x54db79(null,util[_0x03c0('0x28')](_0x03c0('0x29'),Date['now'](),_0x489dd8[_0x03c0('0x2d')]));}})});router['post'](_0x03c0('0x16'),upload[_0x03c0('0x2f')](_0x03c0('0x2a')),controller[_0x03c0('0x33')]);router[_0x03c0('0x22')](_0x03c0('0x34'),controller[_0x03c0('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x03c0('0x25')]({'destination':function(_0x396b7f,_0x5dfef4,_0x4630c1){const _0x470486=path[_0x03c0('0x26')](config['root'],_0x03c0('0x36'),_0x03c0('0x37'),_0x03c0('0x38'));fs_extra[_0x03c0('0x39')](_0x470486,function(){_0x4630c1(null,_0x470486);});},'filename':function(_0x43ef9b,_0xc63acd,_0x578f30){const _0x4a8131=_0xc63acd[_0x03c0('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x19cb5e=path[_0x03c0('0x3a')](_0x4a8131);const _0x14a213=Date[_0x03c0('0x31')]()+'-'+_0x4a8131[_0x03c0('0x3b')](_0x19cb5e,'')+_0x19cb5e;_0x578f30(null,_0x14a213);}})});router[_0x03c0('0x22')](_0x03c0('0x3c'),offlineUploadMulter[_0x03c0('0x3d')](),controller['offline']);router[_0x03c0('0x22')](_0x03c0('0x3e'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x3f')]);router[_0x03c0('0x22')](_0x03c0('0x40'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x41')]);router[_0x03c0('0x22')]('/:id/proactive_actions',auth[_0x03c0('0x9')](),controller[_0x03c0('0x42')]);router[_0x03c0('0x22')](_0x03c0('0x21'),auth['isAuthenticated'](),controller[_0x03c0('0x43')]);router['put'](_0x03c0('0x44'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x45')]);router[_0x03c0('0x46')]('/:id',auth[_0x03c0('0x9')](),controller[_0x03c0('0x47')]);router['delete'](_0x03c0('0xf'),auth[_0x03c0('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x03c0('0x48')]);router['delete'](_0x03c0('0x21'),auth[_0x03c0('0x9')](),controller[_0x03c0('0x49')]);module[_0x03c0('0x4a')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c6b45e3..71bdc61 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 _0xde0b=['client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports','express','../config/environment','Router','env','app','get'];(function(_0x1fc845,_0x106c5b){var _0x1118ff=function(_0x1328df){while(--_0x1328df){_0x1fc845['push'](_0x1fc845['shift']());}};_0x1118ff(++_0x106c5b);}(_0xde0b,0xd2));var _0xbde0=function(_0x4af779,_0x3b967d){_0x4af779=_0x4af779-0x0;var _0x41d726=_0xde0b[_0x4af779];return _0x41d726;};var beaverLogger=require('beaver-logger/server');var express=require(_0xbde0('0x0'));var auth=require('../components/auth/service');var config=require(_0xbde0('0x1'));var router=express[_0xbde0('0x2')]();var isProduction=config[_0xbde0('0x3')]==='production'||![];function clientSideLogs(_0x4ee419,_0x3f99cc,_0x348d87){var _0x7a9b80=_0x4ee419[_0xbde0('0x4')][_0xbde0('0x5')](_0xbde0('0x6'));if(!_0x7a9b80){throw new Error(_0xbde0('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0xbde0('0x8'),'logger':_0x7a9b80,'enableCors':!isProduction})(_0x4ee419,_0x3f99cc,_0x348d87);}router[_0xbde0('0x9')](auth[_0xbde0('0xa')](),clientSideLogs);module[_0xbde0('0xb')]=router; \ No newline at end of file +var _0x7035=['app','get','client-side-logger','use','isAuthenticated','exports','beaver-logger/server','Router','production'];(function(_0x3e817f,_0x3d51df){var _0x2e90b3=function(_0x17c237){while(--_0x17c237){_0x3e817f['push'](_0x3e817f['shift']());}};_0x2e90b3(++_0x3d51df);}(_0x7035,0x69));var _0x5703=function(_0x2b25be,_0x599e51){_0x2b25be=_0x2b25be-0x0;var _0x37bbd4=_0x7035[_0x2b25be];return _0x37bbd4;};var beaverLogger=require(_0x5703('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x5703('0x1')]();var isProduction=config['env']===_0x5703('0x2')||![];function clientSideLogs(_0x14b444,_0x55d7e6,_0x63ad31){var _0x24ccf7=_0x14b444[_0x5703('0x3')][_0x5703('0x4')](_0x5703('0x5'));if(!_0x24ccf7){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x24ccf7,'enableCors':!isProduction})(_0x14b444,_0x55d7e6,_0x63ad31);}router[_0x5703('0x6')](auth[_0x5703('0x7')](),clientSideLogs);module[_0x5703('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index fb03e5f..98fcfc8 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 _0x0058=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x0058,0x171));var _0x8005=function(_0x420f60,_0x170446){_0x420f60=_0x420f60-0x0;var _0x365664=_0x0058[_0x420f60];return _0x365664;};'use strict';var Sequelize=require(_0x8005('0x0'));module[_0x8005('0x1')]={'name':{'type':Sequelize[_0x8005('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8005('0x3')](_0x8005('0x4'),_0x8005('0x5'),_0x8005('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8005('0x3')](_0x8005('0x7'),_0x8005('0x8'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x8005('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x8005('0x9')},'data5':{'type':Sequelize[_0x8005('0xa')],'comment':_0x8005('0xb')},'data6':{'type':Sequelize[_0x8005('0xa')],'comment':_0x8005('0xc')},'data7':{'type':Sequelize[_0x8005('0xa')],'comment':_0x8005('0xd')}}; \ No newline at end of file +var _0xde4d=['ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0x5b1c5c,_0x2f4f0a){var _0x26fba2=function(_0x4ffa7c){while(--_0x4ffa7c){_0x5b1c5c['push'](_0x5b1c5c['shift']());}};_0x26fba2(++_0x2f4f0a);}(_0xde4d,0x10f));var _0xdde4=function(_0xc47cc3,_0xace73c){_0xc47cc3=_0xc47cc3-0x0;var _0x55953b=_0xde4d[_0xc47cc3];return _0x55953b;};'use strict';var Sequelize=require(_0xdde4('0x0'));module[_0xdde4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdde4('0x2')](_0xdde4('0x3'),_0xdde4('0x4'),_0xdde4('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdde4('0x2')](_0xdde4('0x6'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0xdde4('0x7')},'data2':{'type':Sequelize[_0xdde4('0x8')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xdde4('0x8')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xdde4('0x8')],'comment':_0xdde4('0x9')},'data5':{'type':Sequelize[_0xdde4('0xa')],'comment':_0xdde4('0xb')},'data6':{'type':Sequelize[_0xdde4('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xdde4('0xa')],'comment':_0xdde4('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 169c9c1..edebe1e 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 _0x87e3=['data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','error','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../mysqldb','./cloudProvider.oauth','defaults','redis','status','end','json','offset','undefined','limit','count','set','update','destroy','stack','name','send','padEnd','slice','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','CloudProvider','then','includeAll','findAll','service','MicrosoftAzure','decryptString','catch','show','params','keys','include','merge','find','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','sendStatus','generateMicrosoftAuthorizationUrl','get','Invalid\x20state\x20parameter','parse','state','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5'];(function(_0x126743,_0x531a54){var _0x4c5c3e=function(_0x2f96ca){while(--_0x2f96ca){_0x126743['push'](_0x126743['shift']());}};_0x4c5c3e(++_0x531a54);}(_0x87e3,0xc5));var _0x387e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x87e3[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x387e('0x0'));var Redis=require(_0x387e('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x387e('0x2'));var config=require(_0x387e('0x3'));var logger=require('../../config/logger')('api');var db=require(_0x387e('0x4'))['db'];var oauth=require(_0x387e('0x5'));config['redis']=_[_0x387e('0x6')](config[_0x387e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x387e('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x38976e,_0x8a3d8f){_0x8a3d8f=_0x8a3d8f||0xcc;return function(_0x165dd4){if(_0x165dd4){return _0x38976e['sendStatus'](_0x8a3d8f);}return _0x38976e[_0x387e('0x8')](_0x8a3d8f)[_0x387e('0x9')]();};}function respondWithResult(_0x2edf22,_0x3aa180){_0x3aa180=_0x3aa180||0xc8;return function(_0x14b025){if(_0x14b025){return _0x2edf22[_0x387e('0x8')](_0x3aa180)[_0x387e('0xa')](_0x14b025);}};}function respondWithFilteredResult(_0x1465a8,_0x4bff45){return function(_0x294e00){if(_0x294e00){var _0x2997c4=typeof _0x4bff45[_0x387e('0xb')]===_0x387e('0xc')&&typeof _0x4bff45[_0x387e('0xd')]===_0x387e('0xc');var _0x127243=_0x294e00[_0x387e('0xe')];var _0x1bac31=_0x2997c4?0x0:_0x4bff45[_0x387e('0xb')];var _0x3fcc90=_0x2997c4?_0x294e00[_0x387e('0xe')]:_0x4bff45['offset']+_0x4bff45[_0x387e('0xd')];var _0x127bdf;if(_0x3fcc90>=_0x127243){_0x3fcc90=_0x127243;_0x127bdf=0xc8;}else{_0x127bdf=0xce;}_0x1465a8[_0x387e('0x8')](_0x127bdf);return _0x1465a8[_0x387e('0xf')]('Content-Range',_0x1bac31+'-'+_0x3fcc90+'/'+_0x127243)['json'](_0x294e00);}return null;};}function saveUpdates(_0x3bee76){return function(_0x5be448){if(_0x5be448){return _0x5be448[_0x387e('0x10')](_0x3bee76)['then'](function(_0x1dad77){return _0x1dad77;});}return null;};}function removeEntity(_0x17ead2){return function(_0x1797a9){if(_0x1797a9){return _0x1797a9[_0x387e('0x11')]()['then'](function(){_0x17ead2[_0x387e('0x8')](0xcc)[_0x387e('0x9')]();});}};}function handleEntityNotFound(_0x518449){return function(_0x246567){if(!_0x246567){_0x518449['sendStatus'](0x194);}return _0x246567;};}function handleError(_0x4c8fdd,_0x4c7853){_0x4c7853=_0x4c7853||0x1f4;return function(_0x42a994){logger['error'](_0x42a994[_0x387e('0x12')]);if(_0x42a994[_0x387e('0x13')]){delete _0x42a994[_0x387e('0x13')];}_0x4c8fdd['status'](_0x4c7853)[_0x387e('0x14')](_0x42a994);};}function maskClientSecret(_0x1cefc8){return _[_0x387e('0x15')](_0x1cefc8[_0x387e('0x16')](0x0,0x3),0x14,'*');}exports[_0x387e('0x17')]=function(_0x3c3f6e,_0x525639){var _0x15d182={},_0x277f81={},_0x845fa0={'count':0x0,'rows':[]};var _0x4f7950=_[_0x387e('0x18')](db['CloudProvider'][_0x387e('0x19')],function(_0x39113e){return{'name':_0x39113e[_0x387e('0x1a')],'type':_0x39113e[_0x387e('0x1b')][_0x387e('0x1c')]};});_0x277f81[_0x387e('0x1d')]=_[_0x387e('0x18')](_0x4f7950,_0x387e('0x13'));_0x277f81[_0x387e('0x1e')]=_['keys'](_0x3c3f6e[_0x387e('0x1e')]);_0x277f81['filters']=_['intersection'](_0x277f81[_0x387e('0x1d')],_0x277f81[_0x387e('0x1e')]);_0x15d182[_0x387e('0x1f')]=_[_0x387e('0x20')](_0x277f81['model'],qs['fields'](_0x3c3f6e[_0x387e('0x1e')][_0x387e('0x21')]));_0x15d182[_0x387e('0x1f')]=_0x15d182['attributes'][_0x387e('0x22')]?_0x15d182['attributes']:_0x277f81[_0x387e('0x1d')];if(!_0x3c3f6e[_0x387e('0x1e')][_0x387e('0x23')](_0x387e('0x24'))){_0x15d182['limit']=qs[_0x387e('0xd')](_0x3c3f6e[_0x387e('0x1e')][_0x387e('0xd')]);_0x15d182[_0x387e('0xb')]=qs[_0x387e('0xb')](_0x3c3f6e[_0x387e('0x1e')][_0x387e('0xb')]);}_0x15d182[_0x387e('0x25')]=qs[_0x387e('0x26')](_0x3c3f6e[_0x387e('0x1e')][_0x387e('0x26')]);_0x15d182[_0x387e('0x27')]=qs[_0x387e('0x28')](_[_0x387e('0x29')](_0x3c3f6e[_0x387e('0x1e')],_0x277f81[_0x387e('0x28')]),_0x4f7950);if(_0x3c3f6e[_0x387e('0x1e')][_0x387e('0x2a')]){_0x15d182[_0x387e('0x27')]=_['merge'](_0x15d182[_0x387e('0x27')],{'$or':_[_0x387e('0x18')](_0x4f7950,function(_0x202136){if(_0x202136[_0x387e('0x1b')]!==_0x387e('0x2b')){var _0x5afa5a={};_0x5afa5a[_0x202136[_0x387e('0x13')]]={'$like':'%'+_0x3c3f6e[_0x387e('0x1e')][_0x387e('0x2a')]+'%'};return _0x5afa5a;}})});}_0x15d182=_['merge']({},_0x15d182,_0x3c3f6e[_0x387e('0x2c')]);var _0x235501={'where':_0x15d182[_0x387e('0x27')]};return db[_0x387e('0x2d')][_0x387e('0xe')](_0x235501)[_0x387e('0x2e')](function(_0x2c01db){_0x845fa0[_0x387e('0xe')]=_0x2c01db;if(_0x3c3f6e[_0x387e('0x1e')][_0x387e('0x2f')]){_0x15d182['include']=[{'all':!![]}];}return db['CloudProvider'][_0x387e('0x30')](_0x15d182);})[_0x387e('0x2e')](function(_0x317431){_0x845fa0['rows']=_['map'](_0x317431,function(_0x3a8f8f){if(_0x3a8f8f[_0x387e('0x31')]===_0x387e('0x32')){var _0x31c8f8=encryptor[_0x387e('0x33')](_0x3a8f8f['data3']);_0x3a8f8f['data3']=maskClientSecret(_0x31c8f8);}return _0x3a8f8f;});return _0x845fa0;})[_0x387e('0x2e')](respondWithFilteredResult(_0x525639,_0x15d182))[_0x387e('0x34')](handleError(_0x525639,null));};exports[_0x387e('0x35')]=function(_0x1faf90,_0x2a4328){var _0x6a6e3a={'raw':!![],'where':{'id':_0x1faf90[_0x387e('0x36')]['id']}},_0x4e493d={};_0x4e493d[_0x387e('0x1d')]=_[_0x387e('0x37')](db[_0x387e('0x2d')][_0x387e('0x19')]);_0x4e493d['query']=_[_0x387e('0x37')](_0x1faf90[_0x387e('0x1e')]);_0x4e493d[_0x387e('0x28')]=_[_0x387e('0x20')](_0x4e493d[_0x387e('0x1d')],_0x4e493d[_0x387e('0x1e')]);_0x6a6e3a[_0x387e('0x1f')]=_['intersection'](_0x4e493d[_0x387e('0x1d')],qs[_0x387e('0x21')](_0x1faf90[_0x387e('0x1e')][_0x387e('0x21')]));_0x6a6e3a[_0x387e('0x1f')]=_0x6a6e3a[_0x387e('0x1f')][_0x387e('0x22')]?_0x6a6e3a[_0x387e('0x1f')]:_0x4e493d['model'];if(_0x1faf90[_0x387e('0x1e')][_0x387e('0x2f')]){_0x6a6e3a[_0x387e('0x38')]=[{'all':!![]}];}_0x6a6e3a=_[_0x387e('0x39')]({},_0x6a6e3a,_0x1faf90[_0x387e('0x2c')]);return db[_0x387e('0x2d')][_0x387e('0x3a')](_0x6a6e3a)[_0x387e('0x2e')](handleEntityNotFound(_0x2a4328,null))['then'](function(_0x351e1c){if(_0x351e1c[_0x387e('0x31')]===_0x387e('0x32')){var _0x434332=encryptor['decryptString'](_0x351e1c[_0x387e('0x3b')]);_0x351e1c[_0x387e('0x3b')]=maskClientSecret(_0x434332);}return _0x351e1c;})[_0x387e('0x2e')](respondWithResult(_0x2a4328,null))[_0x387e('0x34')](handleError(_0x2a4328,null));};exports[_0x387e('0x3c')]=function(_0x53155e,_0x7b051c){if(!_0x53155e[_0x387e('0x3d')][_0x387e('0x13')])throw new Error(_0x387e('0x3e'));if(!_0x53155e[_0x387e('0x3d')][_0x387e('0x31')])throw new Error(_0x387e('0x3f'));var _0x5db50b=db[_0x387e('0x2d')][_0x387e('0x19')][_0x387e('0x31')][_0x387e('0x40')];if(!_0x5db50b[_0x387e('0x41')](_0x53155e[_0x387e('0x3d')][_0x387e('0x31')]))throw new Error(_0x387e('0x42')+_0x5db50b['join'](',\x20'));if(_0x53155e[_0x387e('0x3d')]['service']==='MicrosoftAzure'&&_0x53155e['body'][_0x387e('0x3b')]){_0x53155e[_0x387e('0x3d')]['data3']=encryptor[_0x387e('0x43')](_0x53155e['body'][_0x387e('0x3b')]);}return db[_0x387e('0x2d')][_0x387e('0x3c')](_0x53155e['body'],{})[_0x387e('0x2e')](respondWithResult(_0x7b051c,0xc9))['catch'](handleError(_0x7b051c,null));};exports[_0x387e('0x10')]=function(_0xb9087d,_0x2e9b64){if(_0xb9087d['body']['id']){delete _0xb9087d[_0x387e('0x3d')]['id'];}return db[_0x387e('0x2d')][_0x387e('0x3a')]({'where':{'id':_0xb9087d[_0x387e('0x36')]['id']}})[_0x387e('0x2e')](handleEntityNotFound(_0x2e9b64,null))['then'](function(_0x1f624e){if(_0x1f624e[_0x387e('0x31')]===_0x387e('0x32')&&_0xb9087d['body'][_0x387e('0x3b')]){_0xb9087d[_0x387e('0x3d')][_0x387e('0x3b')]=encryptor[_0x387e('0x43')](_0xb9087d[_0x387e('0x3d')]['data3']);}return _0x1f624e;})[_0x387e('0x2e')](saveUpdates(_0xb9087d[_0x387e('0x3d')],null))['then'](respondWithResult(_0x2e9b64,null))[_0x387e('0x34')](handleError(_0x2e9b64,null));};exports[_0x387e('0x11')]=function(_0x373757,_0x12c275){return db[_0x387e('0x2d')]['find']({'where':{'id':_0x373757[_0x387e('0x36')]['id']}})['then'](handleEntityNotFound(_0x12c275,null))[_0x387e('0x2e')](removeEntity(_0x12c275,null))[_0x387e('0x34')](handleError(_0x12c275,null));};exports[_0x387e('0x44')]=function(_0x9e261e,_0x503d99){return db['CloudProvider'][_0x387e('0x45')]({'where':{'id':_0x9e261e['params']['id']},'raw':!![]})[_0x387e('0x2e')](function(_0x461765){if(!_0x461765)return _0x503d99[_0x387e('0x46')](0x194);return{'url':oauth[_0x387e('0x47')](_0x461765,_0x9e261e['user']['id'])};})[_0x387e('0x2e')](respondWithResult(_0x503d99,null))[_0x387e('0x34')](handleError(_0x503d99,null));};exports['oauth2MicrosoftCallback']=function(_0x41de28,_0x78553c){var _0x49c6ab=_0x41de28[_0x387e('0x3d')];var _0x1c8e22;var _0x1d59e2;if(_0x49c6ab['error'])throw _0x49c6ab;redis[_0x387e('0x48')](_0x49c6ab['state'])[_0x387e('0x2e')](function(_0xb973db){if(!_0xb973db)throw new Error(_0x387e('0x49'));_0x1c8e22=JSON[_0x387e('0x4a')](_0xb973db);var _0x2485ce=Buffer['from'](_0x49c6ab[_0x387e('0x4b')],'base64')[_0x387e('0x4c')](_0x387e('0x4d'));_0x1d59e2=JSON[_0x387e('0x4a')](_0x2485ce);if(!oauth[_0x387e('0x4e')](_0x49c6ab[_0x387e('0x4f')],_0x1c8e22['oauth2Claims']))throw new Error(_0x387e('0x50'));redis[_0x387e('0x51')](_0x49c6ab[_0x387e('0x4b')]);return oauth[_0x387e('0x52')](_0x49c6ab[_0x387e('0x53')],_0x1c8e22);})[_0x387e('0x2e')](function(_0x165d5a){_0x1c8e22[_0x387e('0x54')]=_0x165d5a['access_token'];_0x1c8e22[_0x387e('0x55')]=_0x165d5a[_0x387e('0x56')];return db['CloudProvider'][_0x387e('0x10')]({'data5':_0x1c8e22[_0x387e('0x54')],'data6':_0x1c8e22[_0x387e('0x55')]},{'where':{'id':_0x1c8e22['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x1c8e22);socket[_0x387e('0x57')](_0x387e('0x58'),{'id':_0x1d59e2['id']});return;})[_0x387e('0x2e')](respondWithStatusCode(_0x78553c,null))[_0x387e('0x34')](function(_0x475e21){if(_0x1d59e2){socket['emit'](_0x387e('0x59'),{'id':_0x1d59e2['id']});}if(!_0x1c8e22){logger['error'](_0x387e('0x5a'),_0x475e21);return _0x78553c[_0x387e('0x8')](0x1f4)['send'](_0x475e21[_0x387e('0x5b')]);}logger[_0x387e('0x5c')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1c8e22['id'],JSON[_0x387e('0x5d')](_0x475e21));});}; \ No newline at end of file +var _0x046f=['Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','stack','name','send','padEnd','slice','index','CloudProvider','fieldName','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','service','data3','catch','show','keys','rawAttributes','length','find','MicrosoftAzure','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','params','findOne','generateMicrosoftAuthorizationUrl','user','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x046f,0x79));var _0xf046=function(_0xd2dc21,_0x4740b1){_0xd2dc21=_0xd2dc21-0x0;var _0x5ea404=_0x046f[_0xd2dc21];return _0x5ea404;};'use strict';var _=require(_0xf046('0x0'));var Redis=require(_0xf046('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xf046('0x2'));var config=require(_0xf046('0x3'));var logger=require(_0xf046('0x4'))(_0xf046('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0xf046('0x6'));config[_0xf046('0x7')]=_[_0xf046('0x8')](config[_0xf046('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf046('0x7')]));var redis=new Redis(config[_0xf046('0x7')]);function respondWithStatusCode(_0x1b6a6b,_0x2d5b21){_0x2d5b21=_0x2d5b21||0xcc;return function(_0x5d45dd){if(_0x5d45dd){return _0x1b6a6b['sendStatus'](_0x2d5b21);}return _0x1b6a6b[_0xf046('0x9')](_0x2d5b21)['end']();};}function respondWithResult(_0x258398,_0x1e995a){_0x1e995a=_0x1e995a||0xc8;return function(_0x185ed1){if(_0x185ed1){return _0x258398[_0xf046('0x9')](_0x1e995a)['json'](_0x185ed1);}};}function respondWithFilteredResult(_0x26842a,_0x776307){return function(_0x460276){if(_0x460276){var _0x17cbe6=typeof _0x776307[_0xf046('0xa')]===_0xf046('0xb')&&typeof _0x776307[_0xf046('0xc')]==='undefined';var _0x47ccd0=_0x460276[_0xf046('0xd')];var _0x3ccc00=_0x17cbe6?0x0:_0x776307[_0xf046('0xa')];var _0x3330fa=_0x17cbe6?_0x460276[_0xf046('0xd')]:_0x776307['offset']+_0x776307['limit'];var _0xae3ed6;if(_0x3330fa>=_0x47ccd0){_0x3330fa=_0x47ccd0;_0xae3ed6=0xc8;}else{_0xae3ed6=0xce;}_0x26842a[_0xf046('0x9')](_0xae3ed6);return _0x26842a[_0xf046('0xe')](_0xf046('0xf'),_0x3ccc00+'-'+_0x3330fa+'/'+_0x47ccd0)[_0xf046('0x10')](_0x460276);}return null;};}function saveUpdates(_0x52ea2f){return function(_0x3281c3){if(_0x3281c3){return _0x3281c3[_0xf046('0x11')](_0x52ea2f)[_0xf046('0x12')](function(_0x5c44b8){return _0x5c44b8;});}return null;};}function removeEntity(_0x117319){return function(_0x4885b6){if(_0x4885b6){return _0x4885b6[_0xf046('0x13')]()[_0xf046('0x12')](function(){_0x117319['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aef7){return function(_0x27a938){if(!_0x27a938){_0x16aef7[_0xf046('0x14')](0x194);}return _0x27a938;};}function handleError(_0x291243,_0x1ee9d5){_0x1ee9d5=_0x1ee9d5||0x1f4;return function(_0x4a68bd){logger['error'](_0x4a68bd[_0xf046('0x15')]);if(_0x4a68bd[_0xf046('0x16')]){delete _0x4a68bd[_0xf046('0x16')];}_0x291243[_0xf046('0x9')](_0x1ee9d5)[_0xf046('0x17')](_0x4a68bd);};}function maskClientSecret(_0x525b79){return _[_0xf046('0x18')](_0x525b79[_0xf046('0x19')](0x0,0x3),0x14,'*');}exports[_0xf046('0x1a')]=function(_0x2abe12,_0x5c3599){var _0x481de2={},_0x1fc4a3={},_0x4dd992={'count':0x0,'rows':[]};var _0x7167c3=_['map'](db[_0xf046('0x1b')]['rawAttributes'],function(_0x5400c1){return{'name':_0x5400c1[_0xf046('0x1c')],'type':_0x5400c1['type'][_0xf046('0x1d')]};});_0x1fc4a3[_0xf046('0x1e')]=_[_0xf046('0x1f')](_0x7167c3,'name');_0x1fc4a3[_0xf046('0x20')]=_['keys'](_0x2abe12['query']);_0x1fc4a3[_0xf046('0x21')]=_[_0xf046('0x22')](_0x1fc4a3[_0xf046('0x1e')],_0x1fc4a3[_0xf046('0x20')]);_0x481de2[_0xf046('0x23')]=_[_0xf046('0x22')](_0x1fc4a3[_0xf046('0x1e')],qs['fields'](_0x2abe12[_0xf046('0x20')]['fields']));_0x481de2[_0xf046('0x23')]=_0x481de2[_0xf046('0x23')]['length']?_0x481de2[_0xf046('0x23')]:_0x1fc4a3[_0xf046('0x1e')];if(!_0x2abe12[_0xf046('0x20')][_0xf046('0x24')](_0xf046('0x25'))){_0x481de2[_0xf046('0xc')]=qs[_0xf046('0xc')](_0x2abe12[_0xf046('0x20')][_0xf046('0xc')]);_0x481de2[_0xf046('0xa')]=qs['offset'](_0x2abe12[_0xf046('0x20')][_0xf046('0xa')]);}_0x481de2[_0xf046('0x26')]=qs[_0xf046('0x27')](_0x2abe12['query'][_0xf046('0x27')]);_0x481de2[_0xf046('0x28')]=qs[_0xf046('0x21')](_['pick'](_0x2abe12[_0xf046('0x20')],_0x1fc4a3['filters']),_0x7167c3);if(_0x2abe12[_0xf046('0x20')][_0xf046('0x29')]){_0x481de2['where']=_['merge'](_0x481de2[_0xf046('0x28')],{'$or':_[_0xf046('0x1f')](_0x7167c3,function(_0xf1ab6d){if(_0xf1ab6d[_0xf046('0x2a')]!==_0xf046('0x2b')){var _0x352f8a={};_0x352f8a[_0xf1ab6d[_0xf046('0x16')]]={'$like':'%'+_0x2abe12['query'][_0xf046('0x29')]+'%'};return _0x352f8a;}})});}_0x481de2=_[_0xf046('0x2c')]({},_0x481de2,_0x2abe12[_0xf046('0x2d')]);var _0xc9fc47={'where':_0x481de2[_0xf046('0x28')]};return db['CloudProvider'][_0xf046('0xd')](_0xc9fc47)['then'](function(_0xcd4d57){_0x4dd992['count']=_0xcd4d57;if(_0x2abe12[_0xf046('0x20')][_0xf046('0x2e')]){_0x481de2[_0xf046('0x2f')]=[{'all':!![]}];}return db[_0xf046('0x1b')]['findAll'](_0x481de2);})[_0xf046('0x12')](function(_0x162d27){_0x4dd992[_0xf046('0x30')]=_['map'](_0x162d27,function(_0x5642a9){if(_0x5642a9[_0xf046('0x31')]==='MicrosoftAzure'){var _0x4186d4=encryptor['decryptString'](_0x5642a9[_0xf046('0x32')]);_0x5642a9[_0xf046('0x32')]=maskClientSecret(_0x4186d4);}return _0x5642a9;});return _0x4dd992;})['then'](respondWithFilteredResult(_0x5c3599,_0x481de2))[_0xf046('0x33')](handleError(_0x5c3599,null));};exports[_0xf046('0x34')]=function(_0x241f77,_0xb83d9f){var _0x12338e={'raw':!![],'where':{'id':_0x241f77['params']['id']}},_0x5df1fd={};_0x5df1fd[_0xf046('0x1e')]=_[_0xf046('0x35')](db[_0xf046('0x1b')][_0xf046('0x36')]);_0x5df1fd[_0xf046('0x20')]=_['keys'](_0x241f77[_0xf046('0x20')]);_0x5df1fd[_0xf046('0x21')]=_[_0xf046('0x22')](_0x5df1fd['model'],_0x5df1fd[_0xf046('0x20')]);_0x12338e['attributes']=_[_0xf046('0x22')](_0x5df1fd[_0xf046('0x1e')],qs['fields'](_0x241f77[_0xf046('0x20')]['fields']));_0x12338e[_0xf046('0x23')]=_0x12338e[_0xf046('0x23')][_0xf046('0x37')]?_0x12338e['attributes']:_0x5df1fd[_0xf046('0x1e')];if(_0x241f77[_0xf046('0x20')][_0xf046('0x2e')]){_0x12338e[_0xf046('0x2f')]=[{'all':!![]}];}_0x12338e=_[_0xf046('0x2c')]({},_0x12338e,_0x241f77[_0xf046('0x2d')]);return db[_0xf046('0x1b')][_0xf046('0x38')](_0x12338e)[_0xf046('0x12')](handleEntityNotFound(_0xb83d9f,null))[_0xf046('0x12')](function(_0x10f180){if(_0x10f180[_0xf046('0x31')]===_0xf046('0x39')){var _0x684fb1=encryptor['decryptString'](_0x10f180['data3']);_0x10f180[_0xf046('0x32')]=maskClientSecret(_0x684fb1);}return _0x10f180;})['then'](respondWithResult(_0xb83d9f,null))[_0xf046('0x33')](handleError(_0xb83d9f,null));};exports['create']=function(_0x4eaa1b,_0x14d324){if(!_0x4eaa1b['body'][_0xf046('0x16')])throw new Error(_0xf046('0x3a'));if(!_0x4eaa1b[_0xf046('0x3b')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x594b35=db['CloudProvider'][_0xf046('0x36')][_0xf046('0x31')][_0xf046('0x3c')];if(!_0x594b35[_0xf046('0x3d')](_0x4eaa1b[_0xf046('0x3b')][_0xf046('0x31')]))throw new Error(_0xf046('0x3e')+_0x594b35[_0xf046('0x3f')](',\x20'));if(_0x4eaa1b['body'][_0xf046('0x31')]===_0xf046('0x39')&&_0x4eaa1b['body'][_0xf046('0x32')]){_0x4eaa1b[_0xf046('0x3b')]['data3']=encryptor[_0xf046('0x40')](_0x4eaa1b['body'][_0xf046('0x32')]);}return db[_0xf046('0x1b')][_0xf046('0x41')](_0x4eaa1b[_0xf046('0x3b')],{})[_0xf046('0x12')](respondWithResult(_0x14d324,0xc9))['catch'](handleError(_0x14d324,null));};exports[_0xf046('0x11')]=function(_0x9488c0,_0x1c72eb){if(_0x9488c0[_0xf046('0x3b')]['id']){delete _0x9488c0[_0xf046('0x3b')]['id'];}return db[_0xf046('0x1b')][_0xf046('0x38')]({'where':{'id':_0x9488c0[_0xf046('0x42')]['id']}})[_0xf046('0x12')](handleEntityNotFound(_0x1c72eb,null))[_0xf046('0x12')](function(_0x2ac3e0){if(_0x2ac3e0[_0xf046('0x31')]===_0xf046('0x39')&&_0x9488c0[_0xf046('0x3b')][_0xf046('0x32')]){_0x9488c0[_0xf046('0x3b')][_0xf046('0x32')]=encryptor[_0xf046('0x40')](_0x9488c0[_0xf046('0x3b')][_0xf046('0x32')]);}return _0x2ac3e0;})[_0xf046('0x12')](saveUpdates(_0x9488c0[_0xf046('0x3b')],null))[_0xf046('0x12')](respondWithResult(_0x1c72eb,null))['catch'](handleError(_0x1c72eb,null));};exports[_0xf046('0x13')]=function(_0x3a32ab,_0x59223b){return db[_0xf046('0x1b')][_0xf046('0x38')]({'where':{'id':_0x3a32ab[_0xf046('0x42')]['id']}})['then'](handleEntityNotFound(_0x59223b,null))[_0xf046('0x12')](removeEntity(_0x59223b,null))[_0xf046('0x33')](handleError(_0x59223b,null));};exports['oauth2MicrosoftAuthorize']=function(_0x50fc69,_0xc12404){return db[_0xf046('0x1b')][_0xf046('0x43')]({'where':{'id':_0x50fc69['params']['id']},'raw':!![]})[_0xf046('0x12')](function(_0xe004a4){if(!_0xe004a4)return _0xc12404['sendStatus'](0x194);return{'url':oauth[_0xf046('0x44')](_0xe004a4,_0x50fc69[_0xf046('0x45')]['id'])};})[_0xf046('0x12')](respondWithResult(_0xc12404,null))[_0xf046('0x33')](handleError(_0xc12404,null));};exports['oauth2MicrosoftCallback']=function(_0x35abd4,_0x156f93){var _0x1e7ed0=_0x35abd4[_0xf046('0x3b')];var _0x4766ed;var _0x308b21;if(_0x1e7ed0['error'])throw _0x1e7ed0;redis[_0xf046('0x46')](_0x1e7ed0['state'])[_0xf046('0x12')](function(_0x87e579){if(!_0x87e579)throw new Error(_0xf046('0x47'));_0x4766ed=JSON[_0xf046('0x48')](_0x87e579);var _0x2591cd=Buffer[_0xf046('0x49')](_0x1e7ed0[_0xf046('0x4a')],_0xf046('0x4b'))[_0xf046('0x4c')](_0xf046('0x4d'));_0x308b21=JSON['parse'](_0x2591cd);if(!oauth[_0xf046('0x4e')](_0x1e7ed0[_0xf046('0x4f')],_0x4766ed[_0xf046('0x50')]))throw new Error(_0xf046('0x51'));redis[_0xf046('0x52')](_0x1e7ed0[_0xf046('0x4a')]);return oauth[_0xf046('0x53')](_0x1e7ed0[_0xf046('0x54')],_0x4766ed);})['then'](function(_0x571357){_0x4766ed['data5']=_0x571357[_0xf046('0x55')];_0x4766ed[_0xf046('0x56')]=_0x571357[_0xf046('0x57')];return db[_0xf046('0x1b')][_0xf046('0x11')]({'data5':_0x4766ed[_0xf046('0x58')],'data6':_0x4766ed[_0xf046('0x56')]},{'where':{'id':_0x4766ed['id']}});})[_0xf046('0x12')](function(){oauth[_0xf046('0x59')](_0x4766ed);socket['emit']('microsoftAuthorization:success',{'id':_0x308b21['id']});return;})[_0xf046('0x12')](respondWithStatusCode(_0x156f93,null))[_0xf046('0x33')](function(_0x22d648){if(_0x308b21){socket['emit'](_0xf046('0x5a'),{'id':_0x308b21['id']});}if(!_0x4766ed){logger[_0xf046('0x5b')](_0xf046('0x5c'),_0x22d648);return _0x156f93[_0xf046('0x9')](0x1f4)[_0xf046('0x17')](_0x22d648[_0xf046('0x5d')]);}logger['error'](_0xf046('0x5e'),_0x4766ed['id'],JSON[_0xf046('0x5f')](_0x22d648));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 68df5aa..0a34fe6 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 _0xcc51=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','cloud_providers','lodash'];(function(_0x1d04fc,_0x57ff67){var _0x41b7e8=function(_0x2b412f){while(--_0x2b412f){_0x1d04fc['push'](_0x1d04fc['shift']());}};_0x41b7e8(++_0x57ff67);}(_0xcc51,0xcb));var _0x1cc5=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xcc51[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x1cc5('0x0'));var util=require(_0x1cc5('0x1'));var logger=require(_0x1cc5('0x2'))(_0x1cc5('0x3'));var moment=require(_0x1cc5('0x4'));var BPromise=require('bluebird');var rp=require(_0x1cc5('0x5'));var fs=require('fs');var path=require(_0x1cc5('0x6'));var rimraf=require(_0x1cc5('0x7'));var config=require('../../config/environment');var attributes=require(_0x1cc5('0x8'));module[_0x1cc5('0x9')]=function(_0x448c6f,_0x4fa5c4){return _0x448c6f[_0x1cc5('0xa')]('CloudProvider',attributes,{'tableName':_0x1cc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65a8=['moment','request-promise','path','./cloudProvider.attributes','define','cloud_providers','../../config/logger'];(function(_0x55d7c2,_0x4ce6fb){var _0x1755ef=function(_0xddc25c){while(--_0xddc25c){_0x55d7c2['push'](_0x55d7c2['shift']());}};_0x1755ef(++_0x4ce6fb);}(_0x65a8,0x1d4));var _0x865a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x65a8[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x865a('0x0'))('api');var moment=require(_0x865a('0x1'));var BPromise=require('bluebird');var rp=require(_0x865a('0x2'));var fs=require('fs');var path=require(_0x865a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x865a('0x4'));module['exports']=function(_0x433ac3,_0x1e888e){return _0x433ac3[_0x865a('0x5')]('CloudProvider',attributes,{'tableName':_0x865a('0x6'),'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 24f3268..a19dd8f 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 _0x71b2=['Outlook365','replace','{TENANT_ID}','code','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','data4','response_mode','form_post','scope','nonce','prompt','oauth2Claims','oauth2/','set','decode','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','POST','data2','data5','data6','update','catch','authorization_code','bind','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','map','type','push','data7','/.default','join'];(function(_0x4c809c,_0x38cece){var _0x423955=function(_0x1ed9a7){while(--_0x1ed9a7){_0x4c809c['push'](_0x4c809c['shift']());}};_0x423955(++_0x38cece);}(_0x71b2,0x154));var _0x271b=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x71b2[_0x1fa759];return _0x2da9f4;};'use strict';var _=require(_0x271b('0x0'));var crypto=require('crypto');var jwt=require(_0x271b('0x1'));var moment=require(_0x271b('0x2'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require(_0x271b('0x3'));var config=require(_0x271b('0x4'));var logger=require(_0x271b('0x5'))(_0x271b('0x6'));var schedule=require(_0x271b('0x7'));var db=require(_0x271b('0x8'))['db'];config[_0x271b('0x9')]=_[_0x271b('0xa')](config['redis'],{'host':_0x271b('0xb'),'port':0x18eb});var redis=new Redis(config[_0x271b('0x9')]);var MICROSOFT_AUTH_URL=_0x271b('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile','email',_0x271b('0xd'),_0x271b('0xe'),_0x271b('0xf'),_0x271b('0x10')],'Dynamics365':[_0x271b('0x11'),_0x271b('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x271b('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5806f9){var _0x11bca7=_[_0x271b('0x13')](AZURE_AUTH_SCOPES[_0x5806f9[_0x271b('0x14')]]);if(_0x5806f9[_0x271b('0x14')]==='Dynamics365')_0x11bca7[_0x271b('0x15')](_0x5806f9[_0x271b('0x16')]+_0x271b('0x17'));return _0x11bca7[_0x271b('0x18')]('\x20');}function getAccessTokenScope(_0x104700){if(_0x104700[_0x271b('0x14')]===_0x271b('0x19'))return _0x271b('0xe');if(_0x104700[_0x271b('0x14')]==='Dynamics365')return _0x104700[_0x271b('0x16')]+_0x271b('0x17');}function generateMicrosoftAuthorizationUrl(_0x583286,_0x271b8a){var _0x39fabb=MICROSOFT_AUTH_URL[_0x271b('0x1a')](_0x271b('0x1b'),_0x583286['data2']);var _0x773eb4=[_0x271b('0x1c'),'id_token'];var _0xfa6c08=Buffer['from'](JSON[_0x271b('0x1d')]({'id':_0x271b8a}))[_0x271b('0x1e')](_0x271b('0x1f'));var _0x59c0f7=crypto[_0x271b('0x20')](0x10)['toString'](_0x271b('0x21'));var _0x453b72=getAuthorizationScopes(_0x583286);var _0xd39d94=[{'key':_0x271b('0x22'),'value':_0x583286[_0x271b('0x23')]},{'key':_0x271b('0x24'),'value':encodeURIComponent(_0x773eb4[_0x271b('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x583286[_0x271b('0x25')]},{'key':_0x271b('0x26'),'value':_0x271b('0x27')},{'key':_0x271b('0x28'),'value':encodeURIComponent(_0x453b72)},{'key':'state','value':_0xfa6c08},{'key':_0x271b('0x29'),'value':_0x59c0f7},{'key':_0x271b('0x2a'),'value':'login'}];var _0x1d2516=_0x39fabb+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x271b('0x13')](_0xd39d94,function(_0x5d2ca7){return _0x5d2ca7['key']+'='+_0x5d2ca7['value'];})[_0x271b('0x18')]('&');_0x583286[_0x271b('0x2b')]={'issuer':_0x39fabb[_0x271b('0x1a')](_0x271b('0x2c'),''),'audience':_0x583286[_0x271b('0x23')],'state':_0xfa6c08,'nonce':_0x59c0f7};redis[_0x271b('0x2d')](_0xfa6c08,JSON['stringify'](_0x583286));return _0x1d2516;}function isValidIdToken(_0x3c538f,_0x1545e4){try{var _0x843335=jwt[_0x271b('0x2e')](_0x3c538f,{'complete':!![]});var _0x3acf71=_0x843335['payload'];if(_0x3acf71[_0x271b('0x2f')]!==_0x1545e4[_0x271b('0x30')])return![];if(_0x3acf71[_0x271b('0x31')]!==_0x1545e4[_0x271b('0x32')])return![];if(_0x3acf71[_0x271b('0x29')]!==_0x1545e4[_0x271b('0x29')])return![];if(moment()[_0x271b('0x33')](moment[_0x271b('0x34')](_0x3acf71[_0x271b('0x35')])))return![];return!![];}catch(_0x229e68){throw _0x229e68;}}function refreshOauth2MicrosoftAccessToken(_0x41d788){return Promise[_0x271b('0x36')]()[_0x271b('0x37')](function(){if(_0x41d788[_0x271b('0x38')])return _0x41d788;return db[_0x271b('0x39')][_0x271b('0x3a')]({'where':{'id':_0x41d788['id']},'raw':!![]});})[_0x271b('0x37')](function(_0x59ebeb){var _0x355c58={'grant_type':_0x271b('0x3b'),'refresh_token':_0x59ebeb['data6'],'scope':getAccessTokenScope(_0x59ebeb),'redirect_uri':_0x59ebeb[_0x271b('0x25')],'client_id':_0x59ebeb[_0x271b('0x23')],'client_secret':encryptor[_0x271b('0x3c')](_0x59ebeb[_0x271b('0x38')])};var _0x4f6797={'method':_0x271b('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x271b('0x1a')](_0x271b('0x1b'),_0x59ebeb[_0x271b('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x355c58,'json':!![]};return rp(_0x4f6797);})['then'](function(_0x2700b6){_0x41d788[_0x271b('0x3f')]=_0x2700b6['access_token'];_0x41d788[_0x271b('0x40')]=_0x2700b6[_0x271b('0x3b')];return db[_0x271b('0x39')][_0x271b('0x41')]({'data5':_0x41d788[_0x271b('0x3f')],'data6':_0x41d788[_0x271b('0x40')]},{'where':{'id':_0x41d788['id']}});})[_0x271b('0x37')](function(){return _0x41d788;})[_0x271b('0x42')](function(_0x4b1344){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x41d788['id'],_0x4b1344);});}function getOauth2MicrosoftAccessToken(_0x25b013,_0x5b690a){var _0x234824={'grant_type':_0x271b('0x43'),'code':_0x25b013,'scope':getAccessTokenScope(_0x5b690a),'redirect_uri':_0x5b690a[_0x271b('0x25')],'client_id':_0x5b690a[_0x271b('0x23')],'client_secret':encryptor['decryptString'](_0x5b690a[_0x271b('0x38')])};var _0x10aa39={'method':_0x271b('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x271b('0x1a')]('{TENANT_ID}',_0x5b690a[_0x271b('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x234824,'json':!![]};return rp(_0x10aa39);}function startRefreshInterval(_0x56a31e){var _0x2e3340=schedule['intervals'];if(_0x2e3340[_0x56a31e['id']])clearInterval(_0x2e3340[_0x56a31e['id']]);_0x2e3340[_0x56a31e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x271b('0x44')](this,{'id':_0x56a31e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x2e3340;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x38b7cc){var _0x2525cc=_0x38b7cc[_0x271b('0x13')](function(_0x23f2b3){return refreshOauth2MicrosoftAccessToken(_0x23f2b3)['then'](function(_0x3692f9){startRefreshInterval(_0x3692f9);});});return Promise['all'](_0x2525cc);})[_0x271b('0x42')](function(_0x1ec035){var _0x5ef841=_0x1ec035?util[_0x271b('0x45')](_0x1ec035,{'showHidden':![],'depth':null}):'';logger[_0x271b('0x46')](_0x271b('0x47'),_0x5ef841);});}module[_0x271b('0x48')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa06c=['type','Dynamics365','push','data7','/.default','Outlook365','replace','{TENANT_ID}','code','toString','base64','randomBytes','hex','client_id','redirect_uri','data4','response_mode','form_post','scope','state','prompt','login','oauth2Claims','oauth2/','data1','set','stringify','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','POST','access_token','data6','CloudProvider','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','data2','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','moment','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0xa06c,0xdb));var _0xca06=function(_0x2cd85a,_0x47d1ff){_0x2cd85a=_0x2cd85a-0x0;var _0x48e048=_0xa06c[_0x2cd85a];return _0x48e048;};'use strict';var _=require(_0xca06('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xca06('0x1'));var Redis=require('ioredis');var rp=require(_0xca06('0x2'));var util=require('util');var encryptor=require(_0xca06('0x3'));var config=require('../../config/environment');var logger=require(_0xca06('0x4'))(_0xca06('0x5'));var schedule=require(_0xca06('0x6'));var db=require(_0xca06('0x7'))['db'];config[_0xca06('0x8')]=_[_0xca06('0x9')](config['redis'],{'host':_0xca06('0xa'),'port':0x18eb});var redis=new Redis(config[_0xca06('0x8')]);var MICROSOFT_AUTH_URL=_0xca06('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xca06('0xc'),_0xca06('0xd'),_0xca06('0xe'),_0xca06('0xf'),_0xca06('0x10'),_0xca06('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid',_0xca06('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0xca06('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xca06('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x645655){var _0x2c7031=_[_0xca06('0x14')](AZURE_AUTH_SCOPES[_0x645655[_0xca06('0x15')]]);if(_0x645655[_0xca06('0x15')]===_0xca06('0x16'))_0x2c7031[_0xca06('0x17')](_0x645655[_0xca06('0x18')]+_0xca06('0x19'));return _0x2c7031['join']('\x20');}function getAccessTokenScope(_0x4357d2){if(_0x4357d2['type']===_0xca06('0x1a'))return _0xca06('0x10');if(_0x4357d2[_0xca06('0x15')]===_0xca06('0x16'))return _0x4357d2[_0xca06('0x18')]+_0xca06('0x19');}function generateMicrosoftAuthorizationUrl(_0x4ce842,_0x31381b){var _0x5cc750=MICROSOFT_AUTH_URL[_0xca06('0x1b')](_0xca06('0x1c'),_0x4ce842['data2']);var _0x2bc8f5=[_0xca06('0x1d'),'id_token'];var _0xc41d6b=Buffer['from'](JSON['stringify']({'id':_0x31381b}))[_0xca06('0x1e')](_0xca06('0x1f'));var _0x1f0b94=crypto[_0xca06('0x20')](0x10)[_0xca06('0x1e')](_0xca06('0x21'));var _0x2affa0=getAuthorizationScopes(_0x4ce842);var _0xd62267=[{'key':_0xca06('0x22'),'value':_0x4ce842['data1']},{'key':'response_type','value':encodeURIComponent(_0x2bc8f5['join']('\x20'))},{'key':_0xca06('0x23'),'value':_0x4ce842[_0xca06('0x24')]},{'key':_0xca06('0x25'),'value':_0xca06('0x26')},{'key':_0xca06('0x27'),'value':encodeURIComponent(_0x2affa0)},{'key':_0xca06('0x28'),'value':_0xc41d6b},{'key':'nonce','value':_0x1f0b94},{'key':_0xca06('0x29'),'value':_0xca06('0x2a')}];var _0x287151=_0x5cc750+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xd62267,function(_0x13099b){return _0x13099b['key']+'='+_0x13099b['value'];})['join']('&');_0x4ce842[_0xca06('0x2b')]={'issuer':_0x5cc750[_0xca06('0x1b')](_0xca06('0x2c'),''),'audience':_0x4ce842[_0xca06('0x2d')],'state':_0xc41d6b,'nonce':_0x1f0b94};redis[_0xca06('0x2e')](_0xc41d6b,JSON[_0xca06('0x2f')](_0x4ce842));return _0x287151;}function isValidIdToken(_0x10ab4f,_0x201a65){try{var _0x5466fd=jwt[_0xca06('0x30')](_0x10ab4f,{'complete':!![]});var _0x6e1d01=_0x5466fd[_0xca06('0x31')];if(_0x6e1d01[_0xca06('0x32')]!==_0x201a65[_0xca06('0x33')])return![];if(_0x6e1d01[_0xca06('0x34')]!==_0x201a65[_0xca06('0x35')])return![];if(_0x6e1d01[_0xca06('0x36')]!==_0x201a65[_0xca06('0x36')])return![];if(moment()[_0xca06('0x37')](moment[_0xca06('0x38')](_0x6e1d01[_0xca06('0x39')])))return![];return!![];}catch(_0x7622dd){throw _0x7622dd;}}function refreshOauth2MicrosoftAccessToken(_0x2c84d9){return Promise[_0xca06('0x3a')]()[_0xca06('0x3b')](function(){if(_0x2c84d9[_0xca06('0x3c')])return _0x2c84d9;return db['CloudProvider'][_0xca06('0x3d')]({'where':{'id':_0x2c84d9['id']},'raw':!![]});})[_0xca06('0x3b')](function(_0x2c47f9){var _0x12af0f={'grant_type':_0xca06('0x3e'),'refresh_token':_0x2c47f9['data6'],'scope':getAccessTokenScope(_0x2c47f9),'redirect_uri':_0x2c47f9[_0xca06('0x24')],'client_id':_0x2c47f9[_0xca06('0x2d')],'client_secret':encryptor['decryptString'](_0x2c47f9[_0xca06('0x3c')])};var _0x125e1f={'method':_0xca06('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xca06('0x1b')]('{TENANT_ID}',_0x2c47f9['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12af0f,'json':!![]};return rp(_0x125e1f);})[_0xca06('0x3b')](function(_0x1c0095){_0x2c84d9['data5']=_0x1c0095[_0xca06('0x40')];_0x2c84d9[_0xca06('0x41')]=_0x1c0095['refresh_token'];return db[_0xca06('0x42')]['update']({'data5':_0x2c84d9[_0xca06('0x43')],'data6':_0x2c84d9[_0xca06('0x41')]},{'where':{'id':_0x2c84d9['id']}});})['then'](function(){return _0x2c84d9;})[_0xca06('0x44')](function(_0x34ed8a){logger[_0xca06('0x45')](_0xca06('0x46'),_0x2c84d9['id'],_0x34ed8a);});}function getOauth2MicrosoftAccessToken(_0xc0a62a,_0x14a017){var _0x498e15={'grant_type':'authorization_code','code':_0xc0a62a,'scope':getAccessTokenScope(_0x14a017),'redirect_uri':_0x14a017[_0xca06('0x24')],'client_id':_0x14a017[_0xca06('0x2d')],'client_secret':encryptor[_0xca06('0x47')](_0x14a017[_0xca06('0x3c')])};var _0x13c8ec={'method':_0xca06('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xca06('0x1b')](_0xca06('0x1c'),_0x14a017[_0xca06('0x48')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x498e15,'json':!![]};return rp(_0x13c8ec);}function startRefreshInterval(_0xf659e9){var _0x42cb49=schedule[_0xca06('0x49')];if(_0x42cb49[_0xf659e9['id']])clearInterval(_0x42cb49[_0xf659e9['id']]);_0x42cb49[_0xf659e9['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xca06('0x4a')](this,{'id':_0xf659e9['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xca06('0x49')]=_0x42cb49;}function startAllRefreshIntervals(){return db[_0xca06('0x42')][_0xca06('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xca06('0x3b')](function(_0x53bb9a){var _0x86232a=_0x53bb9a[_0xca06('0x14')](function(_0x5b053a){return refreshOauth2MicrosoftAccessToken(_0x5b053a)[_0xca06('0x3b')](function(_0x1cb17d){startRefreshInterval(_0x1cb17d);});});return Promise[_0xca06('0x4c')](_0x86232a);})[_0xca06('0x44')](function(_0x3adf5b){var _0x560ba1=_0x3adf5b?util[_0xca06('0x4d')](_0x3adf5b,{'showHidden':![],'depth':null}):'';logger[_0xca06('0x45')](_0xca06('0x4e'),_0x560ba1);});}module[_0xca06('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 e05b1c4..6fd4c39 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 _0xaa64=['rpc','../../config/environment','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5235b6,_0x13aab0){var _0x302d39=function(_0x63977c){while(--_0x63977c){_0x5235b6['push'](_0x5235b6['shift']());}};_0x302d39(++_0x13aab0);}(_0xaa64,0xf7));var _0x4aa6=function(_0x2818a7,_0xb38d51){_0x2818a7=_0x2818a7-0x0;var _0x3d7a89=_0xaa64[_0x2818a7];return _0x3d7a89;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var moment=require('moment');var BPromise=require(_0x4aa6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aa6('0x3'));var db=require(_0x4aa6('0x4'))['db'];var utils=require(_0x4aa6('0x5'));var logger=require('../../config/logger')(_0x4aa6('0x6'));var config=require(_0x4aa6('0x7'));var jayson=require(_0x4aa6('0x8'));var client=jayson[_0x4aa6('0x9')][_0x4aa6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dd83d,_0x39c4b5,_0x49e174){return new BPromise(function(_0x529c89,_0xee21ba){return client[_0x4aa6('0xb')](_0x7dd83d,_0x49e174)['then'](function(_0x26619c){logger['info'](_0x4aa6('0xc'),_0x39c4b5,_0x4aa6('0xd'));logger[_0x4aa6('0xe')](_0x4aa6('0xf'),_0x39c4b5,'request\x20sent',JSON[_0x4aa6('0x10')](_0x26619c));if(_0x26619c[_0x4aa6('0x11')]){if(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x12')]===0x1f4){logger[_0x4aa6('0x11')](_0x4aa6('0xc'),_0x39c4b5,_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);return _0xee21ba(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);}logger['error'](_0x4aa6('0xc'),_0x39c4b5,_0x26619c['error']['message']);return _0x529c89(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);}else{logger[_0x4aa6('0x14')](_0x4aa6('0xc'),_0x39c4b5,_0x4aa6('0xd'));_0x529c89(_0x26619c[_0x4aa6('0x15')][_0x4aa6('0x13')]);}})[_0x4aa6('0x16')](function(_0x530ed0){logger[_0x4aa6('0x11')]('CloudProvider,\x20%s,\x20%s',_0x39c4b5,_0x530ed0);_0xee21ba(_0x530ed0);});});} \ No newline at end of file +var _0x7096=['code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x7096,0x10c));var _0x6709=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7096[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('CloudProvider,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('CloudProvider,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6cb0be8..c9306bb 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x5f2f,0x73));var _0xf5f2=function(_0x26ef11,_0x5be4e1){_0x26ef11=_0x26ef11-0x0;var _0x61ca13=_0x5f2f[_0x26ef11];return _0x61ca13;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5528ce,_0x2a8c7b){_0x5528ce=_0x5528ce-0x0;var _0x30846b=_0x5f2f[_0x5528ce];return _0x30846b;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 69381b5..9c11441 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 _0xd6a1=['STRING','name','sequelize','exports'];(function(_0x4ebbc4,_0x4bd3ab){var _0x17c498=function(_0xa45a50){while(--_0xa45a50){_0x4ebbc4['push'](_0x4ebbc4['shift']());}};_0x17c498(++_0x4bd3ab);}(_0xd6a1,0x82));var _0x1d6a=function(_0x495203,_0x536f9d){_0x495203=_0x495203-0x0;var _0x1da659=_0xd6a1[_0x495203];return _0x1da659;};'use strict';var Sequelize=require(_0x1d6a('0x0'));module[_0x1d6a('0x1')]={'name':{'type':Sequelize[_0x1d6a('0x2')],'unique':_0x1d6a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1d6a('0x2')]},'companyId':{'type':Sequelize[_0x1d6a('0x2')]},'website':{'type':Sequelize[_0x1d6a('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1d6a('0x2')]},'type':{'type':Sequelize[_0x1d6a('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1d6a('0x2')]},'country':{'type':Sequelize[_0x1d6a('0x2')]},'email':{'type':Sequelize[_0x1d6a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1d6a('0x2')]},'sStreet':{'type':Sequelize[_0x1d6a('0x2')]},'sPostalCode':{'type':Sequelize[_0x1d6a('0x2')]},'sCity':{'type':Sequelize[_0x1d6a('0x2')]},'sCountry':{'type':Sequelize[_0x1d6a('0x2')]},'description':{'type':Sequelize[_0x1d6a('0x2')]}}; \ No newline at end of file +var _0x2ff8=['sequelize','exports','name','STRING'];(function(_0x58ecb7,_0x3ce107){var _0xf8856=function(_0x5c0138){while(--_0x5c0138){_0x58ecb7['push'](_0x58ecb7['shift']());}};_0xf8856(++_0x3ce107);}(_0x2ff8,0x1b0));var _0x82ff=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2ff8[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x82ff('0x0'));module[_0x82ff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x82ff('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x82ff('0x3')]},'companyId':{'type':Sequelize[_0x82ff('0x3')]},'website':{'type':Sequelize[_0x82ff('0x3')]},'phone':{'type':Sequelize[_0x82ff('0x3')]},'fax':{'type':Sequelize[_0x82ff('0x3')]},'type':{'type':Sequelize[_0x82ff('0x3')]},'street':{'type':Sequelize[_0x82ff('0x3')]},'postalCode':{'type':Sequelize[_0x82ff('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x82ff('0x3')]},'sStreet':{'type':Sequelize[_0x82ff('0x3')]},'sPostalCode':{'type':Sequelize[_0x82ff('0x3')]},'sCity':{'type':Sequelize[_0x82ff('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x82ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 313ae2a..0023fa9 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 _0x9397=['../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','then','get','Companies','UserProfileResource','sendStatus','error','stack','name','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','map','options','where','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x42b45b,_0x217c8a){var _0x13b752=function(_0xd550a5){while(--_0xd550a5){_0x42b45b['push'](_0x42b45b['shift']());}};_0x13b752(++_0x217c8a);}(_0x9397,0x99));var _0x7939=function(_0x26b367,_0x158299){_0x26b367=_0x26b367-0x0;var _0x5a7c9f=_0x9397[_0x26b367];return _0x5a7c9f;};'use strict';var emlformat=require(_0x7939('0x0'));var rimraf=require(_0x7939('0x1'));var zipdir=require(_0x7939('0x2'));var jsonpatch=require(_0x7939('0x3'));var rp=require(_0x7939('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7939('0x5'));var path=require('path');var sox=require(_0x7939('0x6'));var csv=require('to-csv');var ejs=require(_0x7939('0x7'));var fs=require('fs');var fs_extra=require(_0x7939('0x8'));var _=require(_0x7939('0x9'));var squel=require(_0x7939('0xa'));var crypto=require(_0x7939('0xb'));var jsforce=require(_0x7939('0xc'));var deskjs=require(_0x7939('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7939('0xe'));var Papa=require(_0x7939('0xf'));var Redis=require(_0x7939('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7939('0x11'));var hardwareService=require(_0x7939('0x12'));var logger=require(_0x7939('0x13'))(_0x7939('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7939('0x15'));var db=require(_0x7939('0x16'))['db'];function respondWithStatusCode(_0x37a40c,_0x170d11){_0x170d11=_0x170d11||0xcc;return function(_0x15f6f9){if(_0x15f6f9){return _0x37a40c['sendStatus'](_0x170d11);}return _0x37a40c['status'](_0x170d11)[_0x7939('0x17')]();};}function respondWithResult(_0x10e41f,_0x4ecfb4){_0x4ecfb4=_0x4ecfb4||0xc8;return function(_0x516947){if(_0x516947){return _0x10e41f[_0x7939('0x18')](_0x4ecfb4)['json'](_0x516947);}};}function respondWithFilteredResult(_0x266271,_0x355b6f){return function(_0x26a815){if(_0x26a815){var _0x3ce616=typeof _0x355b6f['offset']===_0x7939('0x19')&&typeof _0x355b6f[_0x7939('0x1a')]==='undefined';var _0x56c0a8=_0x26a815[_0x7939('0x1b')];var _0x4812fd=_0x3ce616?0x0:_0x355b6f[_0x7939('0x1c')];var _0x32a61c=_0x3ce616?_0x26a815[_0x7939('0x1b')]:_0x355b6f['offset']+_0x355b6f['limit'];var _0x7f876b;if(_0x32a61c>=_0x56c0a8){_0x32a61c=_0x56c0a8;_0x7f876b=0xc8;}else{_0x7f876b=0xce;}_0x266271[_0x7939('0x18')](_0x7f876b);return _0x266271['set'](_0x7939('0x1d'),_0x4812fd+'-'+_0x32a61c+'/'+_0x56c0a8)[_0x7939('0x1e')](_0x26a815);}return null;};}function patchUpdates(_0x597ca6){return function(_0x85ac5b){try{jsonpatch[_0x7939('0x1f')](_0x85ac5b,_0x597ca6,!![]);}catch(_0x9dce2c){return BPromise[_0x7939('0x20')](_0x9dce2c);}return _0x85ac5b[_0x7939('0x21')]();};}function saveUpdates(_0x1b3613,_0x244a64){return function(_0x26c3d9){if(_0x26c3d9){return _0x26c3d9['update'](_0x1b3613)['then'](function(_0x214739){return _0x214739;});}return null;};}function removeEntity(_0x46be45,_0x255e1d){return function(_0x275d32){if(_0x275d32){return _0x275d32[_0x7939('0x22')]()[_0x7939('0x23')](function(){var _0xd1687a=_0x275d32[_0x7939('0x24')]({'plain':!![]});var _0x277579=_0x7939('0x25');return db[_0x7939('0x26')]['destroy']({'where':{'type':_0x277579,'resourceId':_0xd1687a['id']}})['then'](function(){return _0x275d32;});})[_0x7939('0x23')](function(){_0x46be45['status'](0xcc)[_0x7939('0x17')]();});}};}function handleEntityNotFound(_0x22839a,_0x486a97){return function(_0x4c77ae){if(!_0x4c77ae){_0x22839a[_0x7939('0x27')](0x194);}return _0x4c77ae;};}function handleError(_0x358d05,_0x313dcb){_0x313dcb=_0x313dcb||0x1f4;return function(_0x1f581d){logger[_0x7939('0x28')](_0x1f581d[_0x7939('0x29')]);if(_0x1f581d[_0x7939('0x2a')]){delete _0x1f581d['name'];}_0x358d05[_0x7939('0x18')](_0x313dcb)['send'](_0x1f581d);};}exports['index']=function(_0x22bfef,_0x2f359e){var _0xdec873={},_0x2d73fb={},_0x3cfdc0={'count':0x0,'rows':[]};return db[_0x7939('0x2b')][_0x7939('0x2c')]()[_0x7939('0x23')](function(_0x51df1a){_0x2d73fb[_0x7939('0x2d')]=_[_0x7939('0x2e')](_0x51df1a);_0x2d73fb[_0x7939('0x2f')]=_['keys'](_0x22bfef['query']);_0x2d73fb['filters']=_[_0x7939('0x30')](_0x2d73fb[_0x7939('0x2d')],_0x2d73fb[_0x7939('0x2f')]);_0xdec873[_0x7939('0x31')]=_[_0x7939('0x30')](_0x2d73fb[_0x7939('0x2d')],qs[_0x7939('0x32')](_0x22bfef['query'][_0x7939('0x32')]));_0xdec873['attributes']=_0xdec873[_0x7939('0x31')][_0x7939('0x33')]?_0xdec873[_0x7939('0x31')]:_0x2d73fb['model'];if(!_0x22bfef[_0x7939('0x2f')][_0x7939('0x34')](_0x7939('0x35'))){_0xdec873[_0x7939('0x1a')]=qs[_0x7939('0x1a')](_0x22bfef[_0x7939('0x2f')][_0x7939('0x1a')]);_0xdec873[_0x7939('0x1c')]=qs[_0x7939('0x1c')](_0x22bfef['query'][_0x7939('0x1c')]);}_0xdec873[_0x7939('0x36')]=qs[_0x7939('0x37')](_0x22bfef[_0x7939('0x2f')]['sort']);_0xdec873['where']=qs[_0x7939('0x38')](_[_0x7939('0x39')](_0x22bfef[_0x7939('0x2f')],_0x2d73fb[_0x7939('0x38')]),_0x51df1a);if(_0x22bfef[_0x7939('0x2f')][_0x7939('0x3a')]){_0xdec873['where']=_[_0x7939('0x3b')](_0xdec873['where'],{'$or':_[_0x7939('0x3c')](_0xdec873[_0x7939('0x31')],function(_0x3b6686){var _0xfd6110={};_0xfd6110[_0x3b6686]={'$like':'%'+_0x22bfef[_0x7939('0x2f')]['filter']+'%'};return _0xfd6110;})});}_0xdec873=_[_0x7939('0x3b')]({},_0xdec873,_0x22bfef[_0x7939('0x3d')]);var _0x198756={'where':_0xdec873[_0x7939('0x3e')]};return db['CmCompany'][_0x7939('0x1b')](_0x198756)[_0x7939('0x23')](function(_0x21b90b){_0x3cfdc0['count']=_0x21b90b;if(_0x22bfef[_0x7939('0x2f')][_0x7939('0x3f')]){_0xdec873['include']=[{'all':!![]}];}return db[_0x7939('0x2b')][_0x7939('0x40')](_0xdec873);})[_0x7939('0x23')](function(_0x250338){_0x3cfdc0[_0x7939('0x41')]=_0x250338;return _0x3cfdc0;})[_0x7939('0x23')](respondWithFilteredResult(_0x2f359e,_0xdec873))[_0x7939('0x42')](handleError(_0x2f359e,null));})[_0x7939('0x42')](handleError(_0x2f359e,null));};exports[_0x7939('0x43')]=function(_0x40e523,_0x3a18dd){var _0xdf7d4={'raw':![],'where':{'id':_0x40e523['params']['id']}},_0x242619={};_0x242619[_0x7939('0x2d')]=_[_0x7939('0x2e')](db[_0x7939('0x2b')][_0x7939('0x44')]);_0x242619[_0x7939('0x2f')]=_[_0x7939('0x2e')](_0x40e523[_0x7939('0x2f')]);_0x242619[_0x7939('0x38')]=_[_0x7939('0x30')](_0x242619[_0x7939('0x2d')],_0x242619['query']);_0xdf7d4[_0x7939('0x31')]=_[_0x7939('0x30')](_0x242619['model'],qs[_0x7939('0x32')](_0x40e523['query'][_0x7939('0x32')]));_0xdf7d4[_0x7939('0x31')]=_0xdf7d4[_0x7939('0x31')][_0x7939('0x33')]?_0xdf7d4[_0x7939('0x31')]:_0x242619[_0x7939('0x2d')];if(_0x40e523[_0x7939('0x2f')]['includeAll']){_0xdf7d4[_0x7939('0x45')]=[{'all':!![]}];}_0xdf7d4=_[_0x7939('0x3b')]({},_0xdf7d4,_0x40e523['options']);return db[_0x7939('0x2b')][_0x7939('0x46')](_0xdf7d4)[_0x7939('0x23')](handleEntityNotFound(_0x3a18dd,null))[_0x7939('0x23')](respondWithResult(_0x3a18dd,null))[_0x7939('0x42')](handleError(_0x3a18dd,null));};exports[_0x7939('0x47')]=function(_0x2a18ba,_0x2ad43f){return db[_0x7939('0x2b')][_0x7939('0x47')](_0x2a18ba[_0x7939('0x48')],{})[_0x7939('0x23')](function(_0x3ae0d0){var _0x186825=_0x2a18ba[_0x7939('0x49')][_0x7939('0x24')]({'plain':!![]});if(!_0x186825)throw new Error(_0x7939('0x4a'));if(_0x186825[_0x7939('0x4b')]===_0x7939('0x49')){var _0x7d037e=_0x3ae0d0['get']({'plain':!![]});var _0x14f06a='Companies';return db[_0x7939('0x4c')][_0x7939('0x46')]({'where':{'name':_0x14f06a,'userProfileId':_0x186825[_0x7939('0x4d')]},'raw':!![]})[_0x7939('0x23')](function(_0x288c4c){if(_0x288c4c&&_0x288c4c[_0x7939('0x4e')]===0x0){return db['UserProfileResource'][_0x7939('0x47')]({'name':_0x7d037e[_0x7939('0x2a')],'resourceId':_0x7d037e['id'],'type':_0x288c4c[_0x7939('0x2a')],'sectionId':_0x288c4c['id']},{})[_0x7939('0x23')](function(){return _0x3ae0d0;});}else{return _0x3ae0d0;}})[_0x7939('0x42')](function(_0x3d1430){logger[_0x7939('0x28')](_0x7939('0x4f'),_0x3d1430);throw _0x3d1430;});}return _0x3ae0d0;})[_0x7939('0x23')](respondWithResult(_0x2ad43f,0xc9))[_0x7939('0x42')](handleError(_0x2ad43f,null));};exports['update']=function(_0x4c62f3,_0x4a0121){if(_0x4c62f3[_0x7939('0x48')]['id']){delete _0x4c62f3[_0x7939('0x48')]['id'];}return db[_0x7939('0x2b')][_0x7939('0x46')]({'where':{'id':_0x4c62f3[_0x7939('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a0121,null))[_0x7939('0x23')](saveUpdates(_0x4c62f3['body'],null))['then'](respondWithResult(_0x4a0121,null))[_0x7939('0x42')](handleError(_0x4a0121,null));};exports['destroy']=function(_0x28d784,_0x227515){return db[_0x7939('0x2b')][_0x7939('0x46')]({'where':{'id':_0x28d784[_0x7939('0x50')]['id']}})[_0x7939('0x23')](handleEntityNotFound(_0x227515,null))[_0x7939('0x23')](removeEntity(_0x227515,null))[_0x7939('0x42')](handleError(_0x227515,null));};exports['describe']=function(_0x40404b,_0x48814d){return db[_0x7939('0x2b')][_0x7939('0x2c')]()[_0x7939('0x23')](respondWithResult(_0x48814d,null))[_0x7939('0x42')](handleError(_0x48814d,null));};exports[_0x7939('0x51')]=function(_0x200e62,_0x123137,_0x5f08cb){return db[_0x7939('0x52')]['find']({'where':{'id':_0x200e62[_0x7939('0x50')]['id']}})[_0x7939('0x23')](handleEntityNotFound(_0x123137,null))['then'](function(_0x4090c0){if(_0x4090c0){return _0x4090c0[_0x7939('0x51')](_0x200e62[_0x7939('0x48')][_0x7939('0x53')],_[_0x7939('0x54')](_0x200e62[_0x7939('0x48')],[_0x7939('0x53'),'id'])||{});}})[_0x7939('0x23')](respondWithResult(_0x123137,null))[_0x7939('0x42')](handleError(_0x123137,null));};exports[_0x7939('0x55')]=function(_0x4c9730,_0x577dd9,_0x1116ea){var _0x31524b={};var _0x1d0d19={};var _0x31ab7d;var _0x111cd9;return db[_0x7939('0x2b')][_0x7939('0x56')]({'where':{'id':_0x4c9730[_0x7939('0x50')]['id']}})[_0x7939('0x23')](handleEntityNotFound(_0x577dd9,null))[_0x7939('0x23')](function(_0x3042f1){if(_0x3042f1){_0x31ab7d=_0x3042f1;_0x1d0d19[_0x7939('0x2d')]=_[_0x7939('0x2e')](db[_0x7939('0x52')][_0x7939('0x44')]);_0x1d0d19[_0x7939('0x2f')]=_[_0x7939('0x2e')](_0x4c9730['query']);_0x1d0d19[_0x7939('0x38')]=_[_0x7939('0x30')](_0x1d0d19['model'],_0x1d0d19['query']);_0x31524b[_0x7939('0x31')]=_[_0x7939('0x30')](_0x1d0d19[_0x7939('0x2d')],qs[_0x7939('0x32')](_0x4c9730[_0x7939('0x2f')]['fields']));_0x31524b['attributes']=_0x31524b[_0x7939('0x31')][_0x7939('0x33')]?_0x31524b['attributes']:_0x1d0d19['model'];_0x31524b[_0x7939('0x36')]=qs[_0x7939('0x37')](_0x4c9730[_0x7939('0x2f')][_0x7939('0x37')]);_0x31524b[_0x7939('0x3e')]=qs[_0x7939('0x38')](_[_0x7939('0x39')](_0x4c9730[_0x7939('0x2f')],_0x1d0d19[_0x7939('0x38')]));if(_0x4c9730[_0x7939('0x2f')][_0x7939('0x3a')]){_0x31524b[_0x7939('0x3e')]=_['merge'](_0x31524b[_0x7939('0x3e')],{'$or':_['map'](_0x31524b[_0x7939('0x31')],function(_0x1b09fd){var _0x19670c={};_0x19670c[_0x1b09fd]={'$like':'%'+_0x4c9730[_0x7939('0x2f')]['filter']+'%'};return _0x19670c;})});}_0x31524b=_['merge']({},_0x31524b,_0x4c9730[_0x7939('0x3d')]);return _0x31ab7d['getContacts'](_0x31524b);}})['then'](function(_0x143513){if(_0x143513){_0x111cd9=_0x143513[_0x7939('0x33')];if(!_0x4c9730[_0x7939('0x2f')]['hasOwnProperty'](_0x7939('0x35'))){_0x31524b['limit']=qs[_0x7939('0x1a')](_0x4c9730[_0x7939('0x2f')][_0x7939('0x1a')]);_0x31524b[_0x7939('0x1c')]=qs[_0x7939('0x1c')](_0x4c9730[_0x7939('0x2f')][_0x7939('0x1c')]);}return _0x31ab7d[_0x7939('0x55')](_0x31524b);}})['then'](function(_0x1eba29){if(_0x1eba29){return _0x1eba29?{'count':_0x111cd9,'rows':_0x1eba29}:null;}})[_0x7939('0x23')](respondWithResult(_0x577dd9,null))[_0x7939('0x42')](handleError(_0x577dd9,null));}; \ No newline at end of file +var _0xb162=['nolimit','order','sort','pick','filter','where','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x392485,_0x36a200){var _0xa34d31=function(_0x4a4dd6){while(--_0x4a4dd6){_0x392485['push'](_0x392485['shift']());}};_0xa34d31(++_0x36a200);}(_0xb162,0x7e));var _0x2b16=function(_0x5c273c,_0xe3517){_0x5c273c=_0x5c273c-0x0;var _0xfa1d67=_0xb162[_0x5c273c];return _0xfa1d67;};'use strict';var emlformat=require(_0x2b16('0x0'));var rimraf=require(_0x2b16('0x1'));var zipdir=require(_0x2b16('0x2'));var jsonpatch=require(_0x2b16('0x3'));var rp=require(_0x2b16('0x4'));var moment=require(_0x2b16('0x5'));var BPromise=require(_0x2b16('0x6'));var Mustache=require(_0x2b16('0x7'));var util=require(_0x2b16('0x8'));var path=require(_0x2b16('0x9'));var sox=require('sox');var csv=require(_0x2b16('0xa'));var ejs=require(_0x2b16('0xb'));var fs=require('fs');var fs_extra=require(_0x2b16('0xc'));var _=require(_0x2b16('0xd'));var squel=require(_0x2b16('0xe'));var crypto=require(_0x2b16('0xf'));var jsforce=require(_0x2b16('0x10'));var deskjs=require(_0x2b16('0x11'));var toCsv=require(_0x2b16('0xa'));var querystring=require('querystring');var Papa=require(_0x2b16('0x12'));var Redis=require(_0x2b16('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b16('0x14'));var hardwareService=require(_0x2b16('0x15'));var logger=require(_0x2b16('0x16'))(_0x2b16('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b16('0x18'))['db'];function respondWithStatusCode(_0x13dba2,_0x503442){_0x503442=_0x503442||0xcc;return function(_0x52e2a9){if(_0x52e2a9){return _0x13dba2[_0x2b16('0x19')](_0x503442);}return _0x13dba2['status'](_0x503442)['end']();};}function respondWithResult(_0x5921e5,_0x4a2be9){_0x4a2be9=_0x4a2be9||0xc8;return function(_0x112da9){if(_0x112da9){return _0x5921e5[_0x2b16('0x1a')](_0x4a2be9)['json'](_0x112da9);}};}function respondWithFilteredResult(_0x2e6120,_0x5beb86){return function(_0x44e526){if(_0x44e526){var _0x191b07=typeof _0x5beb86['offset']===_0x2b16('0x1b')&&typeof _0x5beb86[_0x2b16('0x1c')]===_0x2b16('0x1b');var _0x1406d5=_0x44e526[_0x2b16('0x1d')];var _0x49d59f=_0x191b07?0x0:_0x5beb86[_0x2b16('0x1e')];var _0x5a6e8a=_0x191b07?_0x44e526[_0x2b16('0x1d')]:_0x5beb86[_0x2b16('0x1e')]+_0x5beb86['limit'];var _0x5d9db5;if(_0x5a6e8a>=_0x1406d5){_0x5a6e8a=_0x1406d5;_0x5d9db5=0xc8;}else{_0x5d9db5=0xce;}_0x2e6120[_0x2b16('0x1a')](_0x5d9db5);return _0x2e6120[_0x2b16('0x1f')](_0x2b16('0x20'),_0x49d59f+'-'+_0x5a6e8a+'/'+_0x1406d5)[_0x2b16('0x21')](_0x44e526);}return null;};}function patchUpdates(_0x99c1e){return function(_0x154c2e){try{jsonpatch['apply'](_0x154c2e,_0x99c1e,!![]);}catch(_0x4b78ea){return BPromise[_0x2b16('0x22')](_0x4b78ea);}return _0x154c2e[_0x2b16('0x23')]();};}function saveUpdates(_0x3bc000,_0x43cd6e){return function(_0x54cb42){if(_0x54cb42){return _0x54cb42[_0x2b16('0x24')](_0x3bc000)[_0x2b16('0x25')](function(_0x1260ee){return _0x1260ee;});}return null;};}function removeEntity(_0x3df610,_0x4fd05d){return function(_0x44aeda){if(_0x44aeda){return _0x44aeda[_0x2b16('0x26')]()[_0x2b16('0x25')](function(){var _0x479627=_0x44aeda['get']({'plain':!![]});var _0x36ce19='Companies';return db[_0x2b16('0x27')][_0x2b16('0x26')]({'where':{'type':_0x36ce19,'resourceId':_0x479627['id']}})[_0x2b16('0x25')](function(){return _0x44aeda;});})[_0x2b16('0x25')](function(){_0x3df610[_0x2b16('0x1a')](0xcc)[_0x2b16('0x28')]();});}};}function handleEntityNotFound(_0xc3386d,_0x30345e){return function(_0x2411d7){if(!_0x2411d7){_0xc3386d[_0x2b16('0x19')](0x194);}return _0x2411d7;};}function handleError(_0x29c830,_0x422c63){_0x422c63=_0x422c63||0x1f4;return function(_0x430f86){logger[_0x2b16('0x29')](_0x430f86[_0x2b16('0x2a')]);if(_0x430f86['name']){delete _0x430f86[_0x2b16('0x2b')];}_0x29c830[_0x2b16('0x1a')](_0x422c63)[_0x2b16('0x2c')](_0x430f86);};}exports[_0x2b16('0x2d')]=function(_0x302443,_0x279ef3){var _0x5afd80={},_0x2830c0={},_0x50c74e={'count':0x0,'rows':[]};return db[_0x2b16('0x2e')][_0x2b16('0x2f')]()[_0x2b16('0x25')](function(_0x32e275){_0x2830c0[_0x2b16('0x30')]=_['keys'](_0x32e275);_0x2830c0[_0x2b16('0x31')]=_[_0x2b16('0x32')](_0x302443[_0x2b16('0x31')]);_0x2830c0[_0x2b16('0x33')]=_[_0x2b16('0x34')](_0x2830c0[_0x2b16('0x30')],_0x2830c0[_0x2b16('0x31')]);_0x5afd80['attributes']=_[_0x2b16('0x34')](_0x2830c0[_0x2b16('0x30')],qs[_0x2b16('0x35')](_0x302443[_0x2b16('0x31')][_0x2b16('0x35')]));_0x5afd80['attributes']=_0x5afd80[_0x2b16('0x36')]['length']?_0x5afd80[_0x2b16('0x36')]:_0x2830c0[_0x2b16('0x30')];if(!_0x302443[_0x2b16('0x31')][_0x2b16('0x37')](_0x2b16('0x38'))){_0x5afd80[_0x2b16('0x1c')]=qs['limit'](_0x302443[_0x2b16('0x31')][_0x2b16('0x1c')]);_0x5afd80[_0x2b16('0x1e')]=qs[_0x2b16('0x1e')](_0x302443[_0x2b16('0x31')][_0x2b16('0x1e')]);}_0x5afd80[_0x2b16('0x39')]=qs['sort'](_0x302443[_0x2b16('0x31')][_0x2b16('0x3a')]);_0x5afd80['where']=qs['filters'](_[_0x2b16('0x3b')](_0x302443[_0x2b16('0x31')],_0x2830c0[_0x2b16('0x33')]),_0x32e275);if(_0x302443[_0x2b16('0x31')][_0x2b16('0x3c')]){_0x5afd80[_0x2b16('0x3d')]=_[_0x2b16('0x3e')](_0x5afd80[_0x2b16('0x3d')],{'$or':_[_0x2b16('0x3f')](_0x5afd80['attributes'],function(_0x2ed1a0){var _0x449452={};_0x449452[_0x2ed1a0]={'$like':'%'+_0x302443[_0x2b16('0x31')]['filter']+'%'};return _0x449452;})});}_0x5afd80=_[_0x2b16('0x3e')]({},_0x5afd80,_0x302443['options']);var _0x5ce0e7={'where':_0x5afd80[_0x2b16('0x3d')]};return db[_0x2b16('0x2e')][_0x2b16('0x1d')](_0x5ce0e7)['then'](function(_0x44eb90){_0x50c74e[_0x2b16('0x1d')]=_0x44eb90;if(_0x302443[_0x2b16('0x31')][_0x2b16('0x40')]){_0x5afd80[_0x2b16('0x41')]=[{'all':!![]}];}return db[_0x2b16('0x2e')][_0x2b16('0x42')](_0x5afd80);})[_0x2b16('0x25')](function(_0x44511c){_0x50c74e[_0x2b16('0x43')]=_0x44511c;return _0x50c74e;})['then'](respondWithFilteredResult(_0x279ef3,_0x5afd80))[_0x2b16('0x44')](handleError(_0x279ef3,null));})[_0x2b16('0x44')](handleError(_0x279ef3,null));};exports[_0x2b16('0x45')]=function(_0x4ab1d5,_0x53ddf5){var _0x2573dc={'raw':![],'where':{'id':_0x4ab1d5[_0x2b16('0x46')]['id']}},_0x1caa44={};_0x1caa44['model']=_[_0x2b16('0x32')](db[_0x2b16('0x2e')][_0x2b16('0x47')]);_0x1caa44[_0x2b16('0x31')]=_[_0x2b16('0x32')](_0x4ab1d5[_0x2b16('0x31')]);_0x1caa44[_0x2b16('0x33')]=_[_0x2b16('0x34')](_0x1caa44[_0x2b16('0x30')],_0x1caa44[_0x2b16('0x31')]);_0x2573dc[_0x2b16('0x36')]=_['intersection'](_0x1caa44[_0x2b16('0x30')],qs[_0x2b16('0x35')](_0x4ab1d5['query']['fields']));_0x2573dc['attributes']=_0x2573dc[_0x2b16('0x36')][_0x2b16('0x48')]?_0x2573dc[_0x2b16('0x36')]:_0x1caa44['model'];if(_0x4ab1d5[_0x2b16('0x31')]['includeAll']){_0x2573dc[_0x2b16('0x41')]=[{'all':!![]}];}_0x2573dc=_[_0x2b16('0x3e')]({},_0x2573dc,_0x4ab1d5[_0x2b16('0x49')]);return db[_0x2b16('0x2e')][_0x2b16('0x4a')](_0x2573dc)[_0x2b16('0x25')](handleEntityNotFound(_0x53ddf5,null))[_0x2b16('0x25')](respondWithResult(_0x53ddf5,null))[_0x2b16('0x44')](handleError(_0x53ddf5,null));};exports[_0x2b16('0x4b')]=function(_0x53d8c4,_0x244317){return db['CmCompany'][_0x2b16('0x4b')](_0x53d8c4[_0x2b16('0x4c')],{})[_0x2b16('0x25')](function(_0x53055c){var _0x18dea3=_0x53d8c4[_0x2b16('0x4d')][_0x2b16('0x4e')]({'plain':!![]});if(!_0x18dea3)throw new Error(_0x2b16('0x4f'));if(_0x18dea3[_0x2b16('0x50')]===_0x2b16('0x4d')){var _0x512984=_0x53055c[_0x2b16('0x4e')]({'plain':!![]});var _0x3352bc=_0x2b16('0x51');return db[_0x2b16('0x52')][_0x2b16('0x4a')]({'where':{'name':_0x3352bc,'userProfileId':_0x18dea3[_0x2b16('0x53')]},'raw':!![]})['then'](function(_0x22b863){if(_0x22b863&&_0x22b863[_0x2b16('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x512984[_0x2b16('0x2b')],'resourceId':_0x512984['id'],'type':_0x22b863[_0x2b16('0x2b')],'sectionId':_0x22b863['id']},{})[_0x2b16('0x25')](function(){return _0x53055c;});}else{return _0x53055c;}})[_0x2b16('0x44')](function(_0x2d0e3e){logger[_0x2b16('0x29')](_0x2b16('0x55'),_0x2d0e3e);throw _0x2d0e3e;});}return _0x53055c;})[_0x2b16('0x25')](respondWithResult(_0x244317,0xc9))[_0x2b16('0x44')](handleError(_0x244317,null));};exports[_0x2b16('0x24')]=function(_0x153bfc,_0x477765){if(_0x153bfc[_0x2b16('0x4c')]['id']){delete _0x153bfc[_0x2b16('0x4c')]['id'];}return db[_0x2b16('0x2e')]['find']({'where':{'id':_0x153bfc[_0x2b16('0x46')]['id']}})[_0x2b16('0x25')](handleEntityNotFound(_0x477765,null))[_0x2b16('0x25')](saveUpdates(_0x153bfc[_0x2b16('0x4c')],null))[_0x2b16('0x25')](respondWithResult(_0x477765,null))[_0x2b16('0x44')](handleError(_0x477765,null));};exports[_0x2b16('0x26')]=function(_0x55f558,_0x10a89e){return db[_0x2b16('0x2e')][_0x2b16('0x4a')]({'where':{'id':_0x55f558[_0x2b16('0x46')]['id']}})[_0x2b16('0x25')](handleEntityNotFound(_0x10a89e,null))['then'](removeEntity(_0x10a89e,null))[_0x2b16('0x44')](handleError(_0x10a89e,null));};exports[_0x2b16('0x2f')]=function(_0x1909ad,_0x40c94b){return db[_0x2b16('0x2e')][_0x2b16('0x2f')]()[_0x2b16('0x25')](respondWithResult(_0x40c94b,null))[_0x2b16('0x44')](handleError(_0x40c94b,null));};exports[_0x2b16('0x56')]=function(_0x1a5c0d,_0x397554,_0x5dd571){return db[_0x2b16('0x57')][_0x2b16('0x4a')]({'where':{'id':_0x1a5c0d[_0x2b16('0x46')]['id']}})[_0x2b16('0x25')](handleEntityNotFound(_0x397554,null))[_0x2b16('0x25')](function(_0x3925bd){if(_0x3925bd){return _0x3925bd[_0x2b16('0x56')](_0x1a5c0d[_0x2b16('0x4c')][_0x2b16('0x58')],_['omit'](_0x1a5c0d[_0x2b16('0x4c')],[_0x2b16('0x58'),'id'])||{});}})[_0x2b16('0x25')](respondWithResult(_0x397554,null))[_0x2b16('0x44')](handleError(_0x397554,null));};exports[_0x2b16('0x59')]=function(_0x4e7b6e,_0xe57d82,_0x2dc6ae){var _0x56a188={};var _0xc64734={};var _0x5c7314;var _0x314fa9;return db['CmCompany'][_0x2b16('0x5a')]({'where':{'id':_0x4e7b6e[_0x2b16('0x46')]['id']}})[_0x2b16('0x25')](handleEntityNotFound(_0xe57d82,null))[_0x2b16('0x25')](function(_0x50a10c){if(_0x50a10c){_0x5c7314=_0x50a10c;_0xc64734['model']=_['keys'](db[_0x2b16('0x57')][_0x2b16('0x47')]);_0xc64734[_0x2b16('0x31')]=_[_0x2b16('0x32')](_0x4e7b6e[_0x2b16('0x31')]);_0xc64734['filters']=_[_0x2b16('0x34')](_0xc64734[_0x2b16('0x30')],_0xc64734[_0x2b16('0x31')]);_0x56a188['attributes']=_[_0x2b16('0x34')](_0xc64734[_0x2b16('0x30')],qs['fields'](_0x4e7b6e['query'][_0x2b16('0x35')]));_0x56a188['attributes']=_0x56a188[_0x2b16('0x36')]['length']?_0x56a188[_0x2b16('0x36')]:_0xc64734[_0x2b16('0x30')];_0x56a188[_0x2b16('0x39')]=qs['sort'](_0x4e7b6e[_0x2b16('0x31')][_0x2b16('0x3a')]);_0x56a188[_0x2b16('0x3d')]=qs['filters'](_[_0x2b16('0x3b')](_0x4e7b6e['query'],_0xc64734[_0x2b16('0x33')]));if(_0x4e7b6e[_0x2b16('0x31')][_0x2b16('0x3c')]){_0x56a188[_0x2b16('0x3d')]=_[_0x2b16('0x3e')](_0x56a188['where'],{'$or':_['map'](_0x56a188['attributes'],function(_0x898c4c){var _0x2981b3={};_0x2981b3[_0x898c4c]={'$like':'%'+_0x4e7b6e[_0x2b16('0x31')][_0x2b16('0x3c')]+'%'};return _0x2981b3;})});}_0x56a188=_[_0x2b16('0x3e')]({},_0x56a188,_0x4e7b6e['options']);return _0x5c7314['getContacts'](_0x56a188);}})[_0x2b16('0x25')](function(_0x389475){if(_0x389475){_0x314fa9=_0x389475[_0x2b16('0x48')];if(!_0x4e7b6e['query']['hasOwnProperty'](_0x2b16('0x38'))){_0x56a188[_0x2b16('0x1c')]=qs[_0x2b16('0x1c')](_0x4e7b6e[_0x2b16('0x31')][_0x2b16('0x1c')]);_0x56a188[_0x2b16('0x1e')]=qs[_0x2b16('0x1e')](_0x4e7b6e[_0x2b16('0x31')]['offset']);}return _0x5c7314['getContacts'](_0x56a188);}})['then'](function(_0x5af2a5){if(_0x5af2a5){return _0x5af2a5?{'count':_0x314fa9,'rows':_0x5af2a5}:null;}})[_0x2b16('0x25')](respondWithResult(_0xe57d82,null))[_0x2b16('0x44')](handleError(_0xe57d82,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index e4d0b2e..45a4d5d 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 _0xebfa=['rimraf','../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','moment','bluebird','request-promise'];(function(_0x163d8f,_0x168394){var _0x3f3c38=function(_0x17318e){while(--_0x17318e){_0x163d8f['push'](_0x163d8f['shift']());}};_0x3f3c38(++_0x168394);}(_0xebfa,0xdd));var _0xaebf=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xebfa[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xaebf('0x0'));var BPromise=require(_0xaebf('0x1'));var rp=require(_0xaebf('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaebf('0x3'));var config=require(_0xaebf('0x4'));var attributes=require(_0xaebf('0x5'));module['exports']=function(_0xe6f54e,_0x2f4286){return _0xe6f54e['define'](_0xaebf('0x6'),attributes,{'tableName':_0xaebf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac1e=['path','rimraf','define','CmCompany','cm_companies','util','../../config/logger','api','moment','bluebird'];(function(_0x860e29,_0x2b30b8){var _0xc9f706=function(_0x5aa8f7){while(--_0x5aa8f7){_0x860e29['push'](_0x860e29['shift']());}};_0xc9f706(++_0x2b30b8);}(_0xac1e,0xf5));var _0xeac1=function(_0x330133,_0x5dfcab){_0x330133=_0x330133-0x0;var _0x16c2b1=_0xac1e[_0x330133];return _0x16c2b1;};'use strict';var _=require('lodash');var util=require(_0xeac1('0x0'));var logger=require(_0xeac1('0x1'))(_0xeac1('0x2'));var moment=require(_0xeac1('0x3'));var BPromise=require(_0xeac1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeac1('0x5'));var rimraf=require(_0xeac1('0x6'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module['exports']=function(_0x5c19fc,_0x53dc29){return _0x5c19fc[_0xeac1('0x7')](_0xeac1('0x8'),attributes,{'tableName':_0xeac1('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 4a4b704..14d9fca 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 _0x29d1=['moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x29d1,0x12f));var _0x129d=function(_0x9dc8be,_0x1bab69){_0x9dc8be=_0x9dc8be-0x0;var _0x115701=_0x29d1[_0x9dc8be];return _0x115701;};'use strict';var _=require(_0x129d('0x0'));var util=require('util');var moment=require(_0x129d('0x1'));var BPromise=require(_0x129d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x129d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x129d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x129d('0x5'));var jayson=require(_0x129d('0x6'));var client=jayson[_0x129d('0x7')][_0x129d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c51e5,_0x180663,_0x291770){return new BPromise(function(_0x5c8a6e,_0x4df997){return client[_0x129d('0x9')](_0x3c51e5,_0x291770)['then'](function(_0x2b5abb){logger[_0x129d('0xa')](_0x129d('0xb'),_0x180663,_0x129d('0xc'));logger[_0x129d('0xd')](_0x129d('0xe'),_0x180663,_0x129d('0xc'),JSON['stringify'](_0x2b5abb));if(_0x2b5abb[_0x129d('0xf')]){if(_0x2b5abb['error'][_0x129d('0x10')]===0x1f4){logger[_0x129d('0xf')]('CmCompany,\x20%s,\x20%s',_0x180663,_0x2b5abb['error']['message']);return _0x4df997(_0x2b5abb[_0x129d('0xf')][_0x129d('0x11')]);}logger[_0x129d('0xf')](_0x129d('0xb'),_0x180663,_0x2b5abb[_0x129d('0xf')]['message']);return _0x5c8a6e(_0x2b5abb[_0x129d('0xf')][_0x129d('0x11')]);}else{logger[_0x129d('0xa')](_0x129d('0xb'),_0x180663,_0x129d('0xc'));_0x5c8a6e(_0x2b5abb['result'][_0x129d('0x11')]);}})[_0x129d('0x12')](function(_0x4afde4){logger[_0x129d('0xf')]('CmCompany,\x20%s,\x20%s',_0x180663,_0x4afde4);_0x4df997(_0x4afde4);});});} \ No newline at end of file +var _0x5e36=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','request\x20sent','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5e36,0xc8));var _0x65e3=function(_0x5a3876,_0x397364){_0x5a3876=_0x5a3876-0x0;var _0x59af7a=_0x5e36[_0x5a3876];return _0x59af7a;};'use strict';var _=require(_0x65e3('0x0'));var util=require(_0x65e3('0x1'));var moment=require('moment');var BPromise=require(_0x65e3('0x2'));var rs=require(_0x65e3('0x3'));var fs=require('fs');var Redis=require(_0x65e3('0x4'));var db=require(_0x65e3('0x5'))['db'];var utils=require(_0x65e3('0x6'));var logger=require(_0x65e3('0x7'))(_0x65e3('0x8'));var config=require(_0x65e3('0x9'));var jayson=require(_0x65e3('0xa'));var client=jayson['client'][_0x65e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a3b49,_0x3852cb,_0x32032d){return new BPromise(function(_0x46fb4e,_0x58f48b){return client[_0x65e3('0xc')](_0x1a3b49,_0x32032d)[_0x65e3('0xd')](function(_0x5aa062){logger['info']('CmCompany,\x20%s,\x20%s',_0x3852cb,'request\x20sent');logger[_0x65e3('0xe')](_0x65e3('0xf'),_0x3852cb,'request\x20sent',JSON[_0x65e3('0x10')](_0x5aa062));if(_0x5aa062['error']){if(_0x5aa062[_0x65e3('0x11')][_0x65e3('0x12')]===0x1f4){logger[_0x65e3('0x11')](_0x65e3('0x13'),_0x3852cb,_0x5aa062[_0x65e3('0x11')][_0x65e3('0x14')]);return _0x58f48b(_0x5aa062[_0x65e3('0x11')]['message']);}logger[_0x65e3('0x11')](_0x65e3('0x13'),_0x3852cb,_0x5aa062[_0x65e3('0x11')]['message']);return _0x46fb4e(_0x5aa062['error']['message']);}else{logger[_0x65e3('0x15')]('CmCompany,\x20%s,\x20%s',_0x3852cb,_0x65e3('0x16'));_0x46fb4e(_0x5aa062[_0x65e3('0x17')][_0x65e3('0x14')]);}})[_0x65e3('0x18')](function(_0x22728a){logger[_0x65e3('0x11')]('CmCompany,\x20%s,\x20%s',_0x3852cb,_0x22728a);_0x58f48b(_0x22728a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8d987cc..f3730d0 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 _0xa6f4=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x44f37d,_0x1dc5f5){var _0x36de2f=function(_0x5a899d){while(--_0x5a899d){_0x44f37d['push'](_0x44f37d['shift']());}};_0x36de2f(++_0x1dc5f5);}(_0xa6f4,0x1f2));var _0x4a6f=function(_0x4288fd,_0x147149){_0x4288fd=_0x4288fd-0x0;var _0x5502f0=_0xa6f4[_0x4288fd];return _0x5502f0;};'use strict';var multer=require(_0x4a6f('0x0'));var util=require(_0x4a6f('0x1'));var path=require(_0x4a6f('0x2'));var timeout=require(_0x4a6f('0x3'));var express=require(_0x4a6f('0x4'));var router=express[_0x4a6f('0x5')]();var fs_extra=require(_0x4a6f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4a6f('0x7'));var config=require(_0x4a6f('0x8'));var controller=require('./cmCompany.controller');router[_0x4a6f('0x9')]('/',auth[_0x4a6f('0xa')](),controller['index']);router['get']('/describe',auth[_0x4a6f('0xa')](),controller[_0x4a6f('0xb')]);router[_0x4a6f('0x9')](_0x4a6f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4a6f('0x9')](_0x4a6f('0xd'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0xe')]);router[_0x4a6f('0xf')]('/',auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x10')]);router[_0x4a6f('0xf')]('/:id/contacts',auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x11')]);router[_0x4a6f('0x12')](_0x4a6f('0xc'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x13')]);router[_0x4a6f('0x14')](_0x4a6f('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3610=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','post','addContacts','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x529ead,_0x523759){var _0x10c7fb=function(_0x3aa1c3){while(--_0x3aa1c3){_0x529ead['push'](_0x529ead['shift']());}};_0x10c7fb(++_0x523759);}(_0x3610,0x156));var _0x0361=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x3610[_0x3740fe];return _0x55492b;};'use strict';var multer=require('multer');var util=require(_0x0361('0x0'));var path=require(_0x0361('0x1'));var timeout=require(_0x0361('0x2'));var express=require(_0x0361('0x3'));var router=express[_0x0361('0x4')]();var fs_extra=require(_0x0361('0x5'));var auth=require(_0x0361('0x6'));var interaction=require(_0x0361('0x7'));var config=require(_0x0361('0x8'));var controller=require(_0x0361('0x9'));router[_0x0361('0xa')]('/',auth[_0x0361('0xb')](),controller['index']);router[_0x0361('0xa')](_0x0361('0xc'),auth['isAuthenticated'](),controller[_0x0361('0xd')]);router[_0x0361('0xa')](_0x0361('0xe'),auth[_0x0361('0xb')](),controller[_0x0361('0xf')]);router[_0x0361('0xa')](_0x0361('0x10'),auth[_0x0361('0xb')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0361('0x11')](_0x0361('0x10'),auth[_0x0361('0xb')](),controller[_0x0361('0x12')]);router[_0x0361('0x13')](_0x0361('0xe'),auth[_0x0361('0xb')](),controller['update']);router[_0x0361('0x14')]('/:id',auth[_0x0361('0xb')](),controller[_0x0361('0x15')]);module[_0x0361('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7e2b7a9..8cf61b0 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 _0x99bb=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x158339,_0x121062){var _0x5f3c50=function(_0x59b0fd){while(--_0x59b0fd){_0x158339['push'](_0x158339['shift']());}};_0x5f3c50(++_0x121062);}(_0x99bb,0x6c));var _0xb99b=function(_0xc35e79,_0x37df8f){_0xc35e79=_0xc35e79-0x0;var _0x2f2750=_0x99bb[_0xc35e79];return _0x2f2750;};'use strict';var _=require(_0xb99b('0x0'));var Sequelize=require(_0xb99b('0x1'));module[_0xb99b('0x2')]={'firstName':{'type':Sequelize[_0xb99b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb99b('0x3')]},'street':{'type':Sequelize[_0xb99b('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb99b('0x3')]},'country':{'type':Sequelize[_0xb99b('0x3')]},'dateOfBirth':{'type':Sequelize[_0xb99b('0x3')]},'description':{'type':Sequelize[_0xb99b('0x4')]},'phone':{'type':Sequelize[_0xb99b('0x3')]},'mobile':{'type':Sequelize[_0xb99b('0x3')]},'fax':{'type':Sequelize[_0xb99b('0x3')]},'email':{'type':Sequelize[_0xb99b('0x3')]},'url':{'type':Sequelize[_0xb99b('0x3')]},'facebook':{'type':Sequelize[_0xb99b('0x3')]},'fb_data':{'type':Sequelize[_0xb99b('0x3')]},'twitter':{'type':Sequelize[_0xb99b('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xb99b('0x3')]},'viber':{'type':Sequelize[_0xb99b('0x3')]},'line':{'type':Sequelize[_0xb99b('0x3')]},'wechat':{'type':Sequelize[_0xb99b('0x3')]},'telegram':{'type':Sequelize[_0xb99b('0x3')]},'UserId':{'type':Sequelize[_0xb99b('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xb99b('0x3')]},'priority':{'type':Sequelize[_0xb99b('0x5')](0x2)[_0xb99b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb99b('0x7')],'defaultValue':Sequelize[_0xb99b('0x8')]},'dialTimezone':{'type':Sequelize[_0xb99b('0x3')]},'utcOffset':{'type':Sequelize[_0xb99b('0x5')]}}; \ No newline at end of file +var _0x663d=['INTEGER','UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x2764c9,_0x3d5b79){var _0x158aee=function(_0x2b21ef){while(--_0x2b21ef){_0x2764c9['push'](_0x2764c9['shift']());}};_0x158aee(++_0x3d5b79);}(_0x663d,0xdb));var _0xd663=function(_0x3f1f08,_0x5e8f9f){_0x3f1f08=_0x3f1f08-0x0;var _0x51fa34=_0x663d[_0x3f1f08];return _0x51fa34;};'use strict';var _=require(_0xd663('0x0'));var Sequelize=require(_0xd663('0x1'));module[_0xd663('0x2')]={'firstName':{'type':Sequelize[_0xd663('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd663('0x3')]},'street':{'type':Sequelize[_0xd663('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xd663('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd663('0x3')]},'description':{'type':Sequelize[_0xd663('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd663('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd663('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xd663('0x3')]},'skype':{'type':Sequelize[_0xd663('0x3')]},'teams':{'type':Sequelize[_0xd663('0x3')]},'viber':{'type':Sequelize[_0xd663('0x3')]},'line':{'type':Sequelize[_0xd663('0x3')]},'wechat':{'type':Sequelize[_0xd663('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xd663('0x3')]},'priority':{'type':Sequelize[_0xd663('0x5')](0x2)[_0xd663('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xd663('0x7')]},'dialTimezone':{'type':Sequelize[_0xd663('0x3')]},'utcOffset':{'type':Sequelize[_0xd663('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f793e76..7c65b9e 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 _0x163c=['color','tag','Phones','ContactItemType','ItemType','sequelize','literal','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','setFields','toParam','text','values','phone','findOne','model','rawAttributes','intersection','attributes','fields','order','filters','pick','filter','merge','getTags','nolimit','setTags','ids','setAdditionalPhones','all','OrderBy','item_types','items','description','find','ItemTypeId','contact\x20phone\x20exists','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','bulkCreate','getHoppers','sort','ContactId','options','includeAll','include','getHopperHistories','rows','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','fork','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','mail','chat','sms','fax','voice','-createdAt','resolve','channel','includes','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','Tag','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingValue','subject','substatus','openchannel','externalUrl','threadId','flatten','sortBy','value','slice','bluebird','path','lodash','squel','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment/shared','../../mysqldb','redis','localhost','register','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','end','error','stack','name','index','query','user','catch','CmContact','params','describe','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatInteraction','ChatMessage','update','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','$or','push','where','ListId','findOrCreate','spread','contact','show','Tags'];(function(_0x5b6f67,_0x401bf8){var _0x152edd=function(_0x42dc2a){while(--_0x42dc2a){_0x5b6f67['push'](_0x5b6f67['shift']());}};_0x152edd(++_0x401bf8);}(_0x163c,0x198));var _0xc163=function(_0x41fa7c,_0x3d711b){_0x41fa7c=_0x41fa7c-0x0;var _0x2fdc36=_0x163c[_0x41fa7c];return _0x2fdc36;};'use strict';var moment=require('moment');var BPromise=require(_0xc163('0x0'));var util=require('util');var path=require(_0xc163('0x1'));var fs=require('fs');var _=require(_0xc163('0x2'));var squel=require(_0xc163('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var contacts=require(_0xc163('0x4'));var qs=require(_0xc163('0x5'));var logger=require(_0xc163('0x6'))('api');var config=require('../../config/environment');var shared=require(_0xc163('0x7'));var db=require(_0xc163('0x8'))['db'];config[_0xc163('0x9')]=_['defaults'](config[_0xc163('0x9')],{'host':_0xc163('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc163('0x9')]));require('./cmContact.socket')[_0xc163('0xb')](socket);function respondWithResult(_0x1bf69f,_0x77f2cb){_0x77f2cb=_0x77f2cb||0xc8;return function(_0x165d04){if(_0x165d04){return _0x1bf69f[_0xc163('0xc')](_0x77f2cb)['json'](_0x165d04);}};}function respondWithFilteredResult(_0x25e340,_0x49adca){return function(_0x3b57f2){if(_0x3b57f2){var _0x4733cd=typeof _0x49adca[_0xc163('0xd')]===_0xc163('0xe')&&typeof _0x49adca[_0xc163('0xf')]===_0xc163('0xe');var _0x501fac=_0x3b57f2[_0xc163('0x10')];var _0x816a19=_0x4733cd?0x0:_0x49adca[_0xc163('0xd')];var _0x20602f=_0x4733cd?_0x3b57f2[_0xc163('0x10')]:_0x49adca[_0xc163('0xd')]+_0x49adca[_0xc163('0xf')];var _0x246b2b;if(_0x20602f>=_0x501fac){_0x20602f=_0x501fac;_0x246b2b=0xc8;}else{_0x246b2b=0xce;}_0x25e340[_0xc163('0xc')](_0x246b2b);return _0x25e340[_0xc163('0x11')](_0xc163('0x12'),_0x816a19+'-'+_0x20602f+'/'+_0x501fac)[_0xc163('0x13')](_0x3b57f2);}return null;};}function saveUpdates(_0x1e9eee){return function(_0x4830f4){if(_0x4830f4){return _0x4830f4['update'](_0x1e9eee)[_0xc163('0x14')](function(_0x2dcafb){return _0x2dcafb;});}return null;};}function removeEntity(_0x2adf61){return function(_0x33e4a7){if(_0x33e4a7){return _0x33e4a7[_0xc163('0x15')]()['then'](function(){_0x2adf61['status'](0xcc)[_0xc163('0x16')]();});}};}function handleEntityNotFound(_0x36b5a2){return function(_0x26238e){if(!_0x26238e){_0x36b5a2['sendStatus'](0x194);}return _0x26238e;};}function handleError(_0x3077db,_0x5daab8){_0x5daab8=_0x5daab8||0x1f4;return function(_0xdb1a28){logger[_0xc163('0x17')](_0xdb1a28[_0xc163('0x18')]);if(_0xdb1a28[_0xc163('0x19')]){delete _0xdb1a28['name'];}_0x3077db[_0xc163('0xc')](_0x5daab8)['send'](_0xdb1a28);};}exports[_0xc163('0x1a')]=function(_0xe2602d,_0x161dc4){var _0x202448={};return contacts['describe']()[_0xc163('0x14')](function(_0x543ab9){_0x202448=qs['getOptions'](_0x543ab9,_0xe2602d);return contacts['findAll'](_0xe2602d[_0xc163('0x1b')],_0xe2602d[_0xc163('0x1c')],_0x202448,_0x543ab9);})[_0xc163('0x14')](respondWithFilteredResult(_0x161dc4,_0x202448))[_0xc163('0x1d')](handleError(_0x161dc4,null));};exports[_0xc163('0x15')]=function(_0x27312b,_0x2b9e84){return db[_0xc163('0x1e')]['find']({'where':{'id':_0x27312b[_0xc163('0x1f')]['id']}})[_0xc163('0x14')](handleEntityNotFound(_0x2b9e84,null))['then'](removeEntity(_0x2b9e84,null))['catch'](handleError(_0x2b9e84,null));};exports[_0xc163('0x20')]=function(_0x21fe8b,_0x2b877b){return db[_0xc163('0x1e')][_0xc163('0x20')]()['then'](function(_0x229031){delete _0x229031[_0xc163('0x21')];for(var _0x1ed49f=0x0;_0x1ed49f0x0){return new Promise(function(_0x479011){var _0x3dc992=[];for(var _0x12f16e=0x0;_0x12f16e<_0x39a198[_0xc163('0x23')];_0x12f16e++){_0x3dc992[_0xc163('0x56')](insertAdditionalPhones(_0x39a198[_0x12f16e][_0xc163('0x5b')],_0x39a198[_0x12f16e][_0xc163('0x53')]));}Promise['all'](_0x3dc992)[_0xc163('0x14')](function(){_0x479011(0x1);});})[_0xc163('0x14')](function(){return{'success':_0x36717a,'failure':_0x4d5948,'duplicates':_0xf990c8};});}else{return{'success':_0x36717a,'failure':_0x4d5948,'duplicates':_0xf990c8};}}})[_0xc163('0x14')](respondWithResult(_0x4a1ba5,0xc9))[_0xc163('0x1d')](handleError(_0x4a1ba5,null));};exports[_0xc163('0x5c')]=function(_0x1501f9,_0x7d4ccc){var _0x3d396c;return db['CmContact'][_0xc163('0x20')]()[_0xc163('0x14')](function(_0x1646fb){return db[_0xc163('0x1e')]['find']({'where':{'id':_0x1501f9[_0xc163('0x1f')]['id']},'include':[{'model':db['Tag'],'as':_0xc163('0x5d'),'attributes':['id',_0xc163('0x19'),_0xc163('0x5e')],'required':_0x1501f9[_0xc163('0x1b')][_0xc163('0x5f')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xc163('0x60'),'where':{'CmContactId':_0x1501f9['params']['id']},'required':![],'include':[{'model':db[_0xc163('0x61')],'as':_0xc163('0x62')}]}],'order':[db[_0xc163('0x63')][_0xc163('0x64')]('Phones.OrderBy')],'attributes':_[_0xc163('0x22')](_0x1646fb)});})[_0xc163('0x14')](function(_0x4f9354){if(!_[_0xc163('0x4f')](_0x4f9354)){_0x3d396c=_0x4f9354[_0xc163('0x33')]({'plain':!![]});var _0x17df0c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4f9354&&_0x4f9354['ListId']){if(_0x4f9354['ListId']){_0x17df0c['where'][_0xc163('0x65')][_0xc163('0x56')]({'ListId':{'$ne':_0x4f9354[_0xc163('0x58')]}});}}return db[_0xc163('0x29')][_0xc163('0x2a')](_0x17df0c);}})[_0xc163('0x14')](function(_0x56b4ae){if(!_['isNil'](_0x56b4ae)){return _[_0xc163('0x66')](_0x3d396c,_[_0xc163('0x67')](_0x56b4ae,function(_0x1306fd){return util[_0xc163('0x68')](_0xc163('0x69'),_0x1306fd['id']);}));}})['then'](handleEntityNotFound(_0x7d4ccc,null))[_0xc163('0x14')](respondWithResult(_0x7d4ccc,null))[_0xc163('0x1d')](handleError(_0x7d4ccc,null));};exports[_0xc163('0x3c')]=function(_0x1cbe71,_0x446014){var _0x1f8aea;if(_0x1cbe71['body']['id']){delete _0x1cbe71['body']['id'];}if(!_[_0xc163('0x4f')](_0x1cbe71[_0xc163('0x31')]['dialTimezone'])){var _0x32cdb7=_0x1cbe71[_0xc163('0x31')][_0xc163('0x50')];if(!_['isNil'](shared[_0xc163('0x51')][_0x32cdb7]))_0x1cbe71['body'][_0xc163('0x52')]=shared[_0xc163('0x51')][_0x32cdb7][_0xc163('0x52')];}return db[_0xc163('0x1e')]['find']({'where':{'id':_0x1cbe71[_0xc163('0x1f')]['id']}})[_0xc163('0x14')](handleEntityNotFound(_0x446014,null))['then'](saveUpdates(_0x1cbe71[_0xc163('0x31')],null))[_0xc163('0x14')](function(_0x5cb231){_0x1f8aea=_0x5cb231;var _0x5bbbab={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5cb231&&_0x5cb231[_0xc163('0x58')]){if(_0x5cb231[_0xc163('0x58')]){_0x5bbbab['where'][_0xc163('0x65')][_0xc163('0x56')]({'ListId':{'$ne':_0x5cb231[_0xc163('0x58')]}});}}return db['CmCustomField'][_0xc163('0x2a')](_0x5bbbab);})[_0xc163('0x14')](function(_0x331fed){if(_0x331fed){return _[_0xc163('0x66')](_[_0xc163('0x6a')](_0x1cbe71[_0xc163('0x31')],function(_0x4b1972,_0x5392d9){return _[_0xc163('0x24')](_0x5392d9,_0xc163('0x25'));}),_[_0xc163('0x67')](_0x331fed,function(_0x4bfb42){return util['format']('cf_%d',_0x4bfb42['id']);}));}})[_0xc163('0x14')](function(_0x15caa3){if(_0x15caa3&&!_[_0xc163('0x6b')](_0x15caa3)){var _0x8c67e8=squel[_0xc163('0x3c')]()[_0xc163('0x6c')]('cm_contacts')[_0xc163('0x6d')](_0x15caa3)[_0xc163('0x57')]('id\x20=\x20?',_0x1cbe71[_0xc163('0x1f')]['id'])[_0xc163('0x6e')]();return db['sequelize']['query'](_0x8c67e8[_0xc163('0x6f')],{'replacements':_0x8c67e8[_0xc163('0x70')]});}})[_0xc163('0x14')](function(){if(_0x1cbe71[_0xc163('0x31')][_0xc163('0x71')]&&_0x1f8aea){return db[_0xc163('0x37')]['update']({'phone':_0x1cbe71[_0xc163('0x31')][_0xc163('0x71')],'OrderBy':0x0},{'where':{'ContactId':_0x1f8aea['id']}});}})[_0xc163('0x14')](function(){return _0x1f8aea;})['then'](respondWithResult(_0x446014,null))[_0xc163('0x1d')](handleError(_0x446014,null));};exports['getTags']=function(_0x1a7495,_0x18dd23){var _0x571ba2={};var _0x15b057={};var _0x280b40;var _0x501994;return db[_0xc163('0x1e')][_0xc163('0x72')]({'where':{'id':_0x1a7495[_0xc163('0x1f')]['id']}})[_0xc163('0x14')](handleEntityNotFound(_0x18dd23,null))[_0xc163('0x14')](function(_0x5f0869){if(_0x5f0869){_0x280b40=_0x5f0869;_0x15b057[_0xc163('0x73')]=_[_0xc163('0x22')](db['Tag'][_0xc163('0x74')]);_0x15b057[_0xc163('0x1b')]=_['keys'](_0x1a7495['query']);_0x15b057['filters']=_[_0xc163('0x75')](_0x15b057[_0xc163('0x73')],_0x15b057[_0xc163('0x1b')]);_0x571ba2[_0xc163('0x76')]=_[_0xc163('0x75')](_0x15b057['model'],qs[_0xc163('0x77')](_0x1a7495['query'][_0xc163('0x77')]));_0x571ba2[_0xc163('0x76')]=_0x571ba2['attributes'][_0xc163('0x23')]?_0x571ba2['attributes']:_0x15b057[_0xc163('0x73')];_0x571ba2[_0xc163('0x78')]=qs['sort'](_0x1a7495[_0xc163('0x1b')]['sort']);_0x571ba2[_0xc163('0x57')]=qs[_0xc163('0x79')](_[_0xc163('0x7a')](_0x1a7495[_0xc163('0x1b')],_0x15b057['filters']));if(_0x1a7495[_0xc163('0x1b')][_0xc163('0x7b')]){_0x571ba2[_0xc163('0x57')]=_[_0xc163('0x7c')](_0x571ba2['where'],{'$or':_[_0xc163('0x67')](_0x571ba2[_0xc163('0x76')],function(_0x54f4b1){var _0x2fb7fb={};_0x2fb7fb[_0x54f4b1]={'$like':'%'+_0x1a7495[_0xc163('0x1b')]['filter']+'%'};return _0x2fb7fb;})});}_0x571ba2=_[_0xc163('0x7c')]({},_0x571ba2,_0x1a7495['options']);return _0x280b40[_0xc163('0x7d')](_0x571ba2);}})[_0xc163('0x14')](function(_0x458d41){if(_0x458d41){_0x501994=_0x458d41['length'];if(!_0x1a7495['query'][_0xc163('0x30')](_0xc163('0x7e'))){_0x571ba2[_0xc163('0xf')]=qs[_0xc163('0xf')](_0x1a7495[_0xc163('0x1b')][_0xc163('0xf')]);_0x571ba2['offset']=qs[_0xc163('0xd')](_0x1a7495['query'][_0xc163('0xd')]);}return _0x280b40[_0xc163('0x7d')](_0x571ba2);}})[_0xc163('0x14')](function(_0x4848bd){if(_0x4848bd){return _0x4848bd?{'count':_0x501994,'rows':_0x4848bd}:null;}})[_0xc163('0x14')](respondWithResult(_0x18dd23,null))[_0xc163('0x1d')](handleError(_0x18dd23,null));};exports[_0xc163('0x7f')]=function(_0x1e26ed,_0x3be110){if(_0x1e26ed[_0xc163('0x31')]['id']){delete _0x1e26ed[_0xc163('0x31')]['id'];}return db[_0xc163('0x1e')][_0xc163('0x72')]({'where':{'id':_0x1e26ed[_0xc163('0x1f')]['id']}})[_0xc163('0x14')](handleEntityNotFound(_0x3be110,null))[_0xc163('0x14')](function(_0x15e846){if(_0x15e846){return _0x15e846[_0xc163('0x7f')](_0x1e26ed[_0xc163('0x31')][_0xc163('0x80')]||[]);}return null;})[_0xc163('0x14')](respondWithResult(_0x3be110,null))[_0xc163('0x1d')](handleError(_0x3be110,null));};exports[_0xc163('0x81')]=function(_0x334cce,_0x550d4a){var _0x30af6d=[];_0x30af6d[_0xc163('0x56')](addAdditionalPhones(_0x334cce['body']));Promise['all'](_0x30af6d)[_0xc163('0x14')](function(){_0x30af6d=[];_0x30af6d['push'](deleteCmHopperPhones(_0x334cce[_0xc163('0x31')]['id']));_0x30af6d[_0xc163('0x56')](addCmHopperPhones(_0x334cce[_0xc163('0x31')]['id']));Promise[_0xc163('0x82')](_0x30af6d)[_0xc163('0x14')](function(){return[0x1];})['then'](respondWithResult(_0x550d4a,null));});};function addAdditionalPhones(_0x44c2fa){var _0x420760;return new Promise(function(_0x5e989d){return db[_0xc163('0x44')][_0xc163('0x15')]({'where':{'CmContactId':_0x44c2fa['id']}})['then'](function(){db[_0xc163('0x61')][_0xc163('0x2a')]({'raw':!![],'attributes':['id',_0xc163('0x83')]})[_0xc163('0x14')](function(_0xb71380){var _0x10e504=[];for(var _0x3907af=0x0;_0x3907af<_0x44c2fa['items'][_0xc163('0x23')];_0x3907af++){var _0xe2c8a2=_0x44c2fa[_0xc163('0x84')]?_[_0xc163('0x4f')](_0x44c2fa[_0xc163('0x84')][_0x3907af])?'':_0x44c2fa[_0xc163('0x84')][_0x3907af]:_0x44c2fa['items'][_0x3907af]['ItemTypeId']?_0x44c2fa['items'][_0x3907af]['ItemTypeId']:'';var _0x5c6378=_[_0xc163('0x4f')](_0x44c2fa[_0xc163('0x85')][_0x3907af][_0xc163('0x86')])?'':_0x44c2fa['items'][_0x3907af]['description'];var _0x5f0d62=_0xe2c8a2+':'+_0x44c2fa[_0xc163('0x85')][_0x3907af][_0xc163('0x71')]+'§'+_0x5c6378;if(_['isNil'](_0x420760))_0x420760=_0x5f0d62;else _0x420760+=';'+_0x5f0d62;var _0x2f6b24=null;var _0xf64c1f=null;if(_0x44c2fa[_0xc163('0x84')]){if(!_[_0xc163('0x4f')](_0x44c2fa[_0xc163('0x84')][_0x3907af])){_0xf64c1f=_['find'](_0xb71380,function(_0x4ee3ae){return _0x4ee3ae['id']===_0x44c2fa[_0xc163('0x84')][_0x3907af];});if(!_['isNil'](_0xf64c1f)){_0x2f6b24=_0xf64c1f[_0xc163('0x83')];}}}else{if(!_[_0xc163('0x4f')](_0x44c2fa['items'][_0x3907af])){_0xf64c1f=_[_0xc163('0x87')](_0xb71380,function(_0x45ec98){return _0x45ec98['id']===_0x44c2fa[_0xc163('0x85')][_0x3907af][_0xc163('0x88')];});if(!_[_0xc163('0x4f')](_0xf64c1f)){_0x2f6b24=_0x3907af;}}}if(_[_0xc163('0x4f')](_0x2f6b24)){_0x2f6b24=0x64;}_0x10e504[_0xc163('0x56')](addAdditionalPhone(_0x44c2fa['id'],_0x44c2fa[_0xc163('0x85')][_0x3907af][_0xc163('0x71')],_0x44c2fa[_0xc163('0x84')]?_[_0xc163('0x4f')](_0x44c2fa['item_types'][_0x3907af])?null:_0x44c2fa['item_types'][_0x3907af]:_0x44c2fa[_0xc163('0x85')][_0x3907af][_0xc163('0x88')]?_0x44c2fa[_0xc163('0x85')][_0x3907af][_0xc163('0x88')]:null,_0x2f6b24,_0x5c6378));}Promise[_0xc163('0x82')](_0x10e504)['then'](function(){db[_0xc163('0x1e')][_0xc163('0x3c')]({'AdditionalPhones':_0x420760},{'where':{'id':_0x44c2fa['id']}})[_0xc163('0x14')](function(){_0x5e989d(0x1);});});});});});}function addAdditionalPhone(_0x22e2e0,_0x24dba5,_0x465458,_0x50f4fc,_0x46f1e7){return db[_0xc163('0x44')][_0xc163('0x87')]({'where':{'CmContactId':_0x22e2e0,'item':_0x24dba5}})[_0xc163('0x14')](function(_0x4fa732){if(_0x4fa732)logger[_0xc163('0x2e')](_0xc163('0x89'),_0x4fa732);else{db[_0xc163('0x44')][_0xc163('0x39')]({'CmContactId':_0x22e2e0,'item':_0x24dba5,'ItemTypeId':_0x465458,'OrderBy':_0x50f4fc,'ItemClass':_0xc163('0x8a'),'description':_0x46f1e7});}});}function deleteCmHopperPhones(_0x432b87){return new Promise(function(_0x52f37f){return db[_0xc163('0x37')][_0xc163('0x2a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x432b87}})['then'](function(_0x147030){db['CmHopperAdditionalPhone'][_0xc163('0x15')]({'where':{'CmHopperId':{'$in':_[_0xc163('0x67')](_0x147030,'id')}}});})[_0xc163('0x14')](function(){_0x52f37f(0x1);});});}function addCmHopperPhones(_0x54d6a2){return new Promise(function(_0x49f99f){return db[_0xc163('0x37')][_0xc163('0x2a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x54d6a2}})[_0xc163('0x14')](function(_0x50ebe2){var _0x565564=[];_[_0xc163('0x67')](_0x50ebe2,function(_0x54233f){_0x565564['push'](createCmHopperPhone(_0x54d6a2,_0x54233f['id']));});Promise[_0xc163('0x82')](_0x565564)[_0xc163('0x14')](function(){_0x49f99f(0x1);});});});}function createCmHopperPhone(_0x25afea,_0x3b104d){return new Promise(function(_0x122f25){db[_0xc163('0x44')]['findAll']({'raw':!![],'attributes':[_0xc163('0x8b'),'OrderBy'],'where':{'CmContactId':_0x25afea,'ItemClass':_0xc163('0x8a')},'include':[{'model':db[_0xc163('0x61')],'attributes':[_0xc163('0x83')],'as':_0xc163('0x62')}],'order':[_0xc163('0x83'),db['sequelize'][_0xc163('0x64')](_0xc163('0x8c'))]})[_0xc163('0x14')](function(_0x40dfb0){var _0x27db4c=0x1;var _0x5313f9=_['map'](_0x40dfb0,function(_0x19d60f){_0x19d60f[_0xc163('0x8d')]=_0x3b104d;_0x19d60f['phone']=_0x19d60f['item'];_0x19d60f[_0xc163('0x83')]=_0x27db4c;delete _0x19d60f[_0xc163('0x8e')];_0x27db4c=_0x27db4c+0x1;return _0x19d60f;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x5313f9,{});})[_0xc163('0x14')](function(){_0x122f25(0x1);});});}function insertAdditionalPhones(_0x5c89a1,_0x5d2e6f){return new Promise(function(_0x497138){var _0x285473=[];for(var _0x143a3b=0x0;_0x143a3b<_0x5d2e6f['length'];_0x143a3b++){var _0xcf0ee1=_0x5d2e6f[_0x143a3b];_0x285473[_0xc163('0x56')](parseContactItemType(_0xcf0ee1));}Promise[_0xc163('0x82')](_0x285473)[_0xc163('0x14')](function(){var _0x5538fd={'id':_0x5c89a1['id'],'items':_0x5d2e6f};return addAdditionalPhones(_0x5538fd)[_0xc163('0x14')](function(){return addCmHopperPhones(_0x5c89a1['id']);});})[_0xc163('0x14')](function(){_0x497138(_0x5c89a1);});});}function parseContactItemType(_0x371b5f){return new Promise(function(_0x4d2eca){if(_0x371b5f[_0xc163('0x30')]('ItemTypeId')){_0x4d2eca(_0x371b5f);}else{return db[_0xc163('0x61')]['find']({'where':{'name':_0x371b5f[_0xc163('0x62')]}})['then'](function(_0x2db37){if(_['isNil'](_0x2db37))_0x371b5f['ItemTypeId']=null;else _0x371b5f['ItemTypeId']=_0x2db37['id'];_0x4d2eca(_0x371b5f);});}});}exports[_0xc163('0x8f')]=function(_0x78b741,_0x38297f){return db['CmContactHasItem'][_0xc163('0x2a')]({'raw':!![],'where':{'CmContactId':_0x78b741[_0xc163('0x1f')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xc163('0x61')],'as':'ItemType'}],'order':[[_0xc163('0x83')],[db[_0xc163('0x63')]['literal'](_0xc163('0x8c'))]]})['then'](function(_0x47e5e7){return _0x47e5e7;})[_0xc163('0x14')](respondWithResult(_0x38297f,null))[_0xc163('0x1d')](handleError(_0x38297f,null));};exports[_0xc163('0x90')]=function(_0x51e0ea,_0x483ae7){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x51e0ea[_0xc163('0x31')][_0xc163('0x91')]}})['then'](function(_0x4751a0){var _0x2cf8da=_[_0xc163('0x67')](_0x4751a0,function(_0x2746d2){_0x2746d2[_0xc163('0x92')]=_0x51e0ea[_0xc163('0x31')][_0xc163('0x93')];return _0x2746d2;});return db[_0xc163('0x44')][_0xc163('0x94')](_0x2cf8da,{});})['then'](function(){return addCmHopperPhones(_0x51e0ea[_0xc163('0x31')][_0xc163('0x93')]);})[_0xc163('0x14')](function(){return['ok'];})[_0xc163('0x14')](respondWithResult(_0x483ae7,null))['catch'](handleError(_0x483ae7,null));};exports['rescheduleAdditionalPhones']=function(_0x244302,_0x2e7cf4){var _0xcdc61b=[];_0xcdc61b[_0xc163('0x56')](createCmHopperPhone(_0x244302['body']['id'],_0x244302['body']['hopperId']));Promise[_0xc163('0x82')](_0xcdc61b)[_0xc163('0x14')](function(){return[0x1];})[_0xc163('0x14')](respondWithResult(_0x2e7cf4,null));};exports[_0xc163('0x95')]=function(_0xc10eb7,_0x5e3dd1){var _0xcaad23={'raw':![],'where':{}};var _0x5cd58a={};var _0x5cef43={'count':0x0,'rows':[]};return db['CmContact'][_0xc163('0x72')]({'where':{'id':_0xc10eb7[_0xc163('0x1f')]['id']}})['then'](handleEntityNotFound(_0x5e3dd1,null))['then'](function(_0x6d12cb){if(_0x6d12cb){_0x5cd58a['model']=_[_0xc163('0x22')](db[_0xc163('0x37')][_0xc163('0x74')]);_0x5cd58a[_0xc163('0x1b')]=_['keys'](_0xc10eb7[_0xc163('0x1b')]);_0x5cd58a['filters']=_[_0xc163('0x75')](_0x5cd58a[_0xc163('0x73')],_0x5cd58a[_0xc163('0x1b')]);_0xcaad23['attributes']=_[_0xc163('0x75')](_0x5cd58a[_0xc163('0x73')],qs[_0xc163('0x77')](_0xc10eb7[_0xc163('0x1b')][_0xc163('0x77')]));_0xcaad23[_0xc163('0x76')]=_0xcaad23[_0xc163('0x76')][_0xc163('0x23')]?_0xcaad23[_0xc163('0x76')]:_0x5cd58a[_0xc163('0x73')];if(!_0xc10eb7[_0xc163('0x1b')][_0xc163('0x30')](_0xc163('0x7e'))){_0xcaad23[_0xc163('0xf')]=qs['limit'](_0xc10eb7[_0xc163('0x1b')][_0xc163('0xf')]);_0xcaad23['offset']=qs[_0xc163('0xd')](_0xc10eb7[_0xc163('0x1b')][_0xc163('0xd')]);}_0xcaad23['order']=qs[_0xc163('0x96')](_0xc10eb7[_0xc163('0x1b')]['sort']);_0xcaad23[_0xc163('0x57')]=qs['filters'](_['pick'](_0xc10eb7[_0xc163('0x1b')],_0x5cd58a['filters']));_0xcaad23[_0xc163('0x57')][_0xc163('0x97')]=_0x6d12cb['id'];if(_0xc10eb7[_0xc163('0x1b')][_0xc163('0x7b')]){_0xcaad23[_0xc163('0x57')]=_[_0xc163('0x7c')](_0xcaad23[_0xc163('0x57')],{'$or':_[_0xc163('0x67')](_0xcaad23[_0xc163('0x76')],function(_0x2361ac){var _0x1e35fb={};_0x1e35fb[_0x2361ac]={'$like':'%'+_0xc10eb7[_0xc163('0x1b')][_0xc163('0x7b')]+'%'};return _0x1e35fb;})});}_0xcaad23=_['merge']({},_0xcaad23,_0xc10eb7[_0xc163('0x98')]);return db[_0xc163('0x37')][_0xc163('0x10')]({'where':_0xcaad23[_0xc163('0x57')]})['then'](function(_0xfc6a53){_0x5cef43[_0xc163('0x10')]=_0xfc6a53;if(_0xc10eb7[_0xc163('0x1b')][_0xc163('0x99')]){_0xcaad23[_0xc163('0x9a')]=[{'all':!![]}];}return db[_0xc163('0x37')][_0xc163('0x2a')](_0xcaad23);})[_0xc163('0x14')](function(_0x46916b){_0x5cef43['rows']=_0x46916b;return _0x5cef43;});}})[_0xc163('0x14')](respondWithFilteredResult(_0x5e3dd1,_0xcaad23))[_0xc163('0x1d')](handleError(_0x5e3dd1,null));};exports[_0xc163('0x9b')]=function(_0x403fa3,_0x566e7f){var _0xa63df0={'raw':!![],'where':{}};var _0x20ec61={};var _0x7e28f4={'count':0x0,'rows':[]};return db[_0xc163('0x1e')][_0xc163('0x72')]({'where':{'id':_0x403fa3[_0xc163('0x1f')]['id']}})[_0xc163('0x14')](handleEntityNotFound(_0x566e7f,null))[_0xc163('0x14')](function(_0x1d56d7){if(_0x1d56d7){_0x20ec61[_0xc163('0x73')]=_['keys'](db[_0xc163('0x46')][_0xc163('0x74')]);_0x20ec61[_0xc163('0x1b')]=_[_0xc163('0x22')](_0x403fa3[_0xc163('0x1b')]);_0x20ec61[_0xc163('0x79')]=_[_0xc163('0x75')](_0x20ec61[_0xc163('0x73')],_0x20ec61[_0xc163('0x1b')]);_0xa63df0['attributes']=_[_0xc163('0x75')](_0x20ec61[_0xc163('0x73')],qs[_0xc163('0x77')](_0x403fa3['query'][_0xc163('0x77')]));_0xa63df0[_0xc163('0x76')]=_0xa63df0[_0xc163('0x76')][_0xc163('0x23')]?_0xa63df0['attributes']:_0x20ec61[_0xc163('0x73')];if(!_0x403fa3['query'][_0xc163('0x30')](_0xc163('0x7e'))){_0xa63df0[_0xc163('0xf')]=qs[_0xc163('0xf')](_0x403fa3[_0xc163('0x1b')][_0xc163('0xf')]);_0xa63df0['offset']=qs[_0xc163('0xd')](_0x403fa3[_0xc163('0x1b')][_0xc163('0xd')]);}_0xa63df0[_0xc163('0x78')]=qs['sort'](_0x403fa3[_0xc163('0x1b')][_0xc163('0x96')]);_0xa63df0[_0xc163('0x57')]=qs[_0xc163('0x79')](_[_0xc163('0x7a')](_0x403fa3[_0xc163('0x1b')],_0x20ec61[_0xc163('0x79')]));_0xa63df0[_0xc163('0x57')][_0xc163('0x97')]=_0x1d56d7['id'];if(_0x403fa3['query'][_0xc163('0x7b')]){_0xa63df0['where']=_[_0xc163('0x7c')](_0xa63df0[_0xc163('0x57')],{'$or':_[_0xc163('0x67')](_0xa63df0[_0xc163('0x76')],function(_0x4881f9){var _0x779e9c={};_0x779e9c[_0x4881f9]={'$like':'%'+_0x403fa3[_0xc163('0x1b')][_0xc163('0x7b')]+'%'};return _0x779e9c;})});}_0xa63df0=_[_0xc163('0x7c')]({},_0xa63df0,_0x403fa3[_0xc163('0x98')]);return db[_0xc163('0x46')]['count']({'where':_0xa63df0[_0xc163('0x57')]})['then'](function(_0x4446ee){_0x7e28f4[_0xc163('0x10')]=_0x4446ee;if(_0x403fa3[_0xc163('0x1b')][_0xc163('0x99')]){_0xa63df0[_0xc163('0x9a')]=[{'all':!![]}];}return db[_0xc163('0x46')][_0xc163('0x2a')](_0xa63df0);})['then'](function(_0x7dfd8c){_0x7e28f4[_0xc163('0x9c')]=_0x7dfd8c;return _0x7e28f4;});}})['then'](respondWithFilteredResult(_0x566e7f,_0xa63df0))['catch'](handleError(_0x566e7f,null));};exports[_0xc163('0x9d')]=function(_0x522851,_0x9f1aec){var _0x4351ca={'raw':!![],'where':{}};var _0x57f128={};var _0x308d76={'count':0x0,'rows':[]};return db[_0xc163('0x1e')]['findOne']({'where':{'id':_0x522851[_0xc163('0x1f')]['id']}})['then'](handleEntityNotFound(_0x9f1aec,null))[_0xc163('0x14')](function(_0xa912fa){if(_0xa912fa){_0x57f128['model']=_['keys'](db[_0xc163('0x45')][_0xc163('0x74')]);_0x57f128[_0xc163('0x1b')]=_[_0xc163('0x22')](_0x522851[_0xc163('0x1b')]);_0x57f128[_0xc163('0x79')]=_['intersection'](_0x57f128[_0xc163('0x73')],_0x57f128[_0xc163('0x1b')]);_0x4351ca[_0xc163('0x76')]=_[_0xc163('0x75')](_0x57f128[_0xc163('0x73')],qs[_0xc163('0x77')](_0x522851[_0xc163('0x1b')][_0xc163('0x77')]));_0x4351ca[_0xc163('0x76')]=_0x4351ca[_0xc163('0x76')][_0xc163('0x23')]?_0x4351ca[_0xc163('0x76')]:_0x57f128[_0xc163('0x73')];if(!_0x522851[_0xc163('0x1b')][_0xc163('0x30')](_0xc163('0x7e'))){_0x4351ca['limit']=qs[_0xc163('0xf')](_0x522851[_0xc163('0x1b')][_0xc163('0xf')]);_0x4351ca[_0xc163('0xd')]=qs[_0xc163('0xd')](_0x522851[_0xc163('0x1b')][_0xc163('0xd')]);}_0x4351ca[_0xc163('0x78')]=qs[_0xc163('0x96')](_0x522851['query'][_0xc163('0x96')]);_0x4351ca[_0xc163('0x57')]=qs[_0xc163('0x79')](_[_0xc163('0x7a')](_0x522851[_0xc163('0x1b')],_0x57f128['filters']));_0x4351ca[_0xc163('0x57')][_0xc163('0x97')]=_0xa912fa['id'];if(_0x522851[_0xc163('0x1b')][_0xc163('0x7b')]){_0x4351ca[_0xc163('0x57')]=_[_0xc163('0x7c')](_0x4351ca[_0xc163('0x57')],{'$or':_[_0xc163('0x67')](_0x4351ca[_0xc163('0x76')],function(_0x529aa3){var _0x331cc9={};_0x331cc9[_0x529aa3]={'$like':'%'+_0x522851['query'][_0xc163('0x7b')]+'%'};return _0x331cc9;})});}_0x4351ca=_['merge']({},_0x4351ca,_0x522851['options']);return db['CmHopperFinal'][_0xc163('0x10')]({'where':_0x4351ca[_0xc163('0x57')]})[_0xc163('0x14')](function(_0x4f311a){_0x308d76[_0xc163('0x10')]=_0x4f311a;if(_0x522851['query']['includeAll']){_0x4351ca[_0xc163('0x9a')]=[{'all':!![]}];}return db[_0xc163('0x45')][_0xc163('0x2a')](_0x4351ca);})[_0xc163('0x14')](function(_0x1637c1){_0x308d76[_0xc163('0x9c')]=_0x1637c1;return _0x308d76;});}})[_0xc163('0x14')](respondWithFilteredResult(_0x9f1aec,_0x4351ca))['catch'](handleError(_0x9f1aec,null));};exports['getJscriptySessions']=function(_0x145d4c,_0x4359cb){var _0x50729f={'raw':!![],'where':{}};var _0x5eb76a={};var _0x52d006={'count':0x0,'rows':[]};return db[_0xc163('0x1e')]['findOne']({'where':{'id':_0x145d4c[_0xc163('0x1f')]['id']}})[_0xc163('0x14')](handleEntityNotFound(_0x4359cb,null))[_0xc163('0x14')](function(_0xd6d07b){if(_0xd6d07b){_0x5eb76a['model']=_['keys'](db[_0xc163('0x9e')][_0xc163('0x74')]);_0x5eb76a['query']=_[_0xc163('0x22')](_0x145d4c[_0xc163('0x1b')]);_0x5eb76a[_0xc163('0x79')]=_[_0xc163('0x75')](_0x5eb76a[_0xc163('0x73')],_0x5eb76a['query']);_0x50729f['attributes']=_['intersection'](_0x5eb76a[_0xc163('0x73')],qs[_0xc163('0x77')](_0x145d4c[_0xc163('0x1b')][_0xc163('0x77')]));_0x50729f[_0xc163('0x76')]=_0x50729f[_0xc163('0x76')][_0xc163('0x23')]?_0x50729f[_0xc163('0x76')]:_0x5eb76a[_0xc163('0x73')];if(!_0x145d4c[_0xc163('0x1b')][_0xc163('0x30')]('nolimit')){_0x50729f[_0xc163('0xf')]=qs[_0xc163('0xf')](_0x145d4c['query']['limit']);_0x50729f['offset']=qs['offset'](_0x145d4c[_0xc163('0x1b')][_0xc163('0xd')]);}_0x50729f['order']=qs[_0xc163('0x96')](_0x145d4c[_0xc163('0x1b')][_0xc163('0x96')]);_0x50729f[_0xc163('0x57')]=qs[_0xc163('0x79')](_['pick'](_0x145d4c[_0xc163('0x1b')],_0x5eb76a[_0xc163('0x79')]));_0x50729f[_0xc163('0x57')][_0xc163('0x97')]=_0xd6d07b['id'];if(_0x145d4c[_0xc163('0x1b')][_0xc163('0x7b')]){_0x50729f[_0xc163('0x57')]=_[_0xc163('0x7c')](_0x50729f[_0xc163('0x57')],{'$or':_[_0xc163('0x67')](_0x50729f['attributes'],function(_0x41e846){var _0xac1767={};_0xac1767[_0x41e846]={'$like':'%'+_0x145d4c[_0xc163('0x1b')]['filter']+'%'};return _0xac1767;})});}_0x50729f=_[_0xc163('0x7c')]({},_0x50729f,_0x145d4c[_0xc163('0x98')]);return db[_0xc163('0x9e')][_0xc163('0x10')]({'where':_0x50729f['where']})[_0xc163('0x14')](function(_0xae70ae){_0x52d006['count']=_0xae70ae;if(_0x145d4c[_0xc163('0x1b')][_0xc163('0x99')]){_0x50729f[_0xc163('0x9a')]=[{'all':!![]}];}return db[_0xc163('0x9e')][_0xc163('0x2a')](_0x50729f);})[_0xc163('0x14')](function(_0x3484a0){_0x52d006[_0xc163('0x9c')]=_0x3484a0;return _0x52d006;});}})[_0xc163('0x14')](respondWithFilteredResult(_0x4359cb,_0x50729f))[_0xc163('0x1d')](handleError(_0x4359cb,null));};exports[_0xc163('0x9f')]=function(_0x33b716,_0x1fe864){try{if(!_0x33b716['body'][_0xc163('0x58')]){throw new Error(_0xc163('0xa0'));}if(!_0x33b716[_0xc163('0x31')][_0xc163('0xa1')]){throw new Error(_0xc163('0xa2'));}if(!_0x33b716['body']['binding_values']){throw new Error(_0xc163('0xa3'));}if(!_0x33b716['body']['socket_timestamp']){throw new Error(_0xc163('0xa4'));}var _0x2f3733=_0x33b716['body'][_0xc163('0xa1')][_0xc163('0xa5')](',');var _0x498beb=_0x33b716['body'][_0xc163('0xa6')][_0xc163('0xa5')](',');if(!_0x2f3733[_0xc163('0x23')]||!_0x498beb[_0xc163('0x23')]||_0x2f3733[_0xc163('0x23')]!==_0x498beb[_0xc163('0x23')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x33b716[_0xc163('0x31')][_0xc163('0x77')]=_[_0xc163('0xa7')](_0x2f3733,_0x498beb);if(!_0x33b716['body'][_0xc163('0x77')][_0xc163('0x71')]){throw new Error(_0xc163('0xa8'));}if(!_0x33b716[_0xc163('0x31')][_0xc163('0x77')][_0xc163('0xa9')]){throw new Error(_0xc163('0xaa'));}var _0x3ed649=path[_0xc163('0x35')](config['root'],'server/files/tmp',_0x33b716[_0xc163('0xab')][_0xc163('0xac')]);fs['chmodSync'](_0x3ed649,parseInt(_0xc163('0xad'),0x8));var _0x6a2698=require(_0xc163('0xae'))['fork'](path[_0xc163('0x35')](__dirname,_0xc163('0xaf')),[_0x3ed649,_0x33b716[_0xc163('0x31')]['binding_keys'],_0x33b716[_0xc163('0x31')][_0xc163('0xa6')],_0x33b716['body'][_0xc163('0x58')],_0x33b716[_0xc163('0x31')][_0xc163('0xb0')],_0x33b716[_0xc163('0x31')][_0xc163('0x54')],_0x33b716[_0xc163('0x31')][_0xc163('0xb1')]]);return _0x1fe864['status'](0xc8)['json']({'message':_0xc163('0xb2'),'pid':_0x6a2698[_0xc163('0xb3')]});}catch(_0x410f53){return _0x1fe864[_0xc163('0xc')](0x1f4)[_0xc163('0xb4')](_0x410f53);}};exports[_0xc163('0xb5')]=function(_0x4d7b4c,_0x44b59c){var _0x1e2b71=fs[_0xc163('0xb6')](_0x4d7b4c[_0xc163('0xab')][_0xc163('0x1')]);Papa['parse'](_0x1e2b71,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5ee195){return _0x44b59c['status'](0xc8)[_0xc163('0x13')]({'file':_0x4d7b4c['file'],'fields':_0x5ee195['meta'][_0xc163('0x77')]});}});};exports[_0xc163('0xb7')]=function(_0x1da90a,_0x1ed726){return db[_0xc163('0xb8')][_0xc163('0x2a')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc163('0xb9')}})[_0xc163('0x14')](function(_0x38e94d){var _0x8d4b43=![];if(!_0x1da90a[_0xc163('0x31')][_0xc163('0x58')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1da90a['body'][_0xc163('0xba')][_0xc163('0x71')]){throw new Error(_0xc163('0xa8'));}if(!_0x1da90a[_0xc163('0x31')]['binding'][_0xc163('0xa9')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1da90a[_0xc163('0x31')][_0xc163('0xb1')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5cd291=require(_0xc163('0xae'))['fork'](path['join'](__dirname,_0xc163('0xbb')),[_0x1da90a['params']['id'],JSON[_0xc163('0xbc')](_0x1da90a[_0xc163('0x31')]),JSON['stringify'](_0x38e94d)]);_0x5cd291['on'](_0xc163('0xbd'),function(){_0x8d4b43=!![];return _0x1ed726[_0xc163('0xc')](0xc8)['json']({'message':_0xc163('0xbe'),'pid':_0x5cd291[_0xc163('0xb3')]});});_0x5cd291['on'](_0xc163('0xbf'),function(_0x22a7b6){if(_0x22a7b6&&!_0x8d4b43){return _0x1ed726['status'](0x1f4)[_0xc163('0x13')]({'message':'error\x20child\x20process','pid':_0x5cd291['pid']});}});})[_0xc163('0x1d')](handleError(_0x1ed726,null));};exports[_0xc163('0xc0')]=function(_0x188f47,_0x31bd67){return db[_0xc163('0xb8')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xc163('0xb9')}})[_0xc163('0x14')](function(_0xed7795){var _0x4ecaf8=![];if(!_0x188f47[_0xc163('0x31')][_0xc163('0x58')]){throw new Error('No\x20ListId\x20specified');}if(!_0x188f47[_0xc163('0x31')][_0xc163('0xba')][_0xc163('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x188f47[_0xc163('0x31')][_0xc163('0xba')][_0xc163('0xa9')]){throw new Error(_0xc163('0xaa'));}if(!_0x188f47[_0xc163('0x31')][_0xc163('0xb1')]){throw new Error(_0xc163('0xa4'));}var _0x407e32=require(_0xc163('0xae'))[_0xc163('0xc1')](path[_0xc163('0x35')](__dirname,_0xc163('0xc2')),[_0x188f47[_0xc163('0x1f')]['id'],JSON[_0xc163('0xbc')](_0x188f47[_0xc163('0x31')]),JSON[_0xc163('0xbc')](_0xed7795)]);_0x407e32['on']('message',function(){_0x4ecaf8=!![];return _0x31bd67[_0xc163('0xc')](0xc8)[_0xc163('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x407e32[_0xc163('0xb3')]});});_0x407e32['on'](_0xc163('0xbf'),function(_0x5b0f09){if(_0x5b0f09&&!_0x4ecaf8){return _0x31bd67[_0xc163('0xc')](0x1f4)[_0xc163('0x13')]({'message':_0xc163('0xc3'),'pid':_0x407e32['pid']});}});})['catch'](handleError(_0x31bd67,null));};exports[_0xc163('0xc4')]=function(_0x3bf3e0,_0x4825fb){var _0x3f8bab=[_0xc163('0xc5'),_0xc163('0xc6'),_0xc163('0xc7'),'openchannel',_0xc163('0xc8'),'whatsapp',_0xc163('0xc9')];var _0x5a39cd={'offset':0x0,'order':qs['sort'](_0xc163('0xca'))},_0x356846={'count':0x0,'rows':[]};Promise[_0xc163('0xcb')]()['then'](function(){if(_0x3bf3e0[_0xc163('0x1b')][_0xc163('0xcc')]){if(!_[_0xc163('0xcd')](_0x3f8bab,_0x3bf3e0[_0xc163('0x1b')][_0xc163('0xcc')]['toLowerCase']())){throw new Error(_0xc163('0xce'));}_0x3f8bab=[_0x3bf3e0[_0xc163('0x1b')][_0xc163('0xcc')]['toLowerCase']()];}if(_0x3bf3e0[_0xc163('0x1b')]['range']){try{var _0x9c896b=JSON[_0xc163('0xcf')](_0x3bf3e0[_0xc163('0x1b')][_0xc163('0xd0')]);if(!moment(_0x9c896b['from'])[_0xc163('0xd1')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x9c896b['to'])[_0xc163('0xd1')]()){throw new Error(_0xc163('0xd2'));}}catch(_0x2c0d95){throw new Error(_0xc163('0xd3'));}}if(!_0x3bf3e0[_0xc163('0x1b')][_0xc163('0x30')](_0xc163('0x7e'))){_0x5a39cd[_0xc163('0xf')]=qs['limit'](_0x3bf3e0['query'][_0xc163('0xf')]||0xa);_0x5a39cd['offset']=qs[_0xc163('0xd')](_0x3bf3e0['query'][_0xc163('0xd')]);}var _0xfd7e7b=_0x3f8bab[_0xc163('0x67')](function(_0x8c01e8){if(_0x8c01e8==='voice'){var _0x4c402c={'attributes':['id',_0xc163('0xd4'),_0xc163('0x2d'),_0xc163('0xd5'),_0xc163('0xd6'),_0xc163('0xd7'),_0xc163('0xd8'),_0xc163('0xd9'),_0xc163('0xda'),_0xc163('0xdb'),'createdAt',_0xc163('0xdc'),'userSecondDisposition',_0xc163('0xdd'),_0xc163('0xde')],'where':{'ContactId':_0x3bf3e0[_0xc163('0x1f')]['id']},'include':[{'model':db[_0xc163('0xb8')],'as':_0xc163('0xb8'),'attributes':['id','name',_0xc163('0xdf'),'alias']}],'order':[[_0xc163('0xe0'),_0xc163('0xe1')]]};if(_0x3bf3e0['query'][_0xc163('0xd0')]){_0x4c402c[_0xc163('0x57')][_0xc163('0xe0')]={'$gte':_0x9c896b['from'],'$lte':_0x9c896b['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4c402c)[_0xc163('0x14')](function(_0x2bbf15){_0x356846[_0xc163('0x10')]+=_0x2bbf15[_0xc163('0x10')];return _[_0xc163('0x67')](_0x2bbf15[_0xc163('0x9c')],function(_0x2a0305){var _0x24c197=_0x2a0305[_0xc163('0x33')]({'plain':!![]});_0x24c197[_0xc163('0xcc')]=_0x8c01e8;if(_0x24c197[_0xc163('0xb8')]){_0x24c197[_0xc163('0xb8')]={'id':_0x24c197[_0xc163('0xb8')]['id'],'name':_0x24c197['User'][_0xc163('0x19')],'fullname':_0x24c197[_0xc163('0xb8')]['fullname'],'alias':_0x24c197[_0xc163('0xb8')][_0xc163('0x2b')]};}return _0x24c197;});});}else{var _0x44db8a=_[_0xc163('0xe2')](_0x8c01e8)+(_0x8c01e8==='chat'?_0xc163('0xe3'):_0xc163('0xe4'));var _0x3f002f={'attributes':['id','closed',_0xc163('0xe5'),_0xc163('0xe0'),_0xc163('0xdb'),_0xc163('0xe6'),_0xc163('0xe7'),_0xc163('0xe8'),_0xc163('0xde'),_0x44db8a+'Id'],'where':{'ContactId':_0x3bf3e0['params']['id']},'include':[{'model':db[_0x44db8a],'as':'Account','attributes':['id',_0xc163('0x19'),_0xc163('0xe9')]},{'model':db[_0xc163('0xb8')],'as':_0xc163('0xea'),'attributes':['id',_0xc163('0x19'),'fullname']},{'model':db[_0xc163('0xeb')],'as':_0xc163('0x5d'),'attributes':['id',_0xc163('0x19'),_0xc163('0x5e')],'through':{'attributes':[]}}],'order':[[_0xc163('0xe0'),'DESC']]};if(_0x3bf3e0[_0xc163('0x1b')][_0xc163('0xd0')]){_0x3f002f['where']['createdAt']={'$gte':_0x9c896b[_0xc163('0x32')],'$lte':_0x9c896b['to']};}switch(_0x8c01e8){case'chat':_0x3f002f['attributes'][_0xc163('0x56')](_0xc163('0xec'),_0xc163('0xed'),_0xc163('0xee'),_0xc163('0xef'),'osName',_0xc163('0xf0'),'ratingType',_0xc163('0xf1'),'referer');break;case'mail':_0x3f002f[_0xc163('0x76')]['push'](_0xc163('0xf2'),_0xc163('0xf3'));break;case _0xc163('0xf4'):_0x3f002f[_0xc163('0x76')][_0xc163('0x56')](_0xc163('0xf5'),_0xc163('0xf6'));break;}return db[_[_0xc163('0xe2')](_0x8c01e8)+'Interaction']['findAndCountAll'](_0x3f002f)['then'](function(_0x345992){_0x356846[_0xc163('0x10')]+=_0x345992[_0xc163('0x10')];return _[_0xc163('0x67')](_0x345992[_0xc163('0x9c')],function(_0x257914){var _0x38acdf=_0x257914[_0xc163('0x33')]({'plain':!![]});_0x38acdf[_0xc163('0xcc')]=_0x8c01e8;if(_0x38acdf[_0xc163('0xea')]){_0x38acdf[_0xc163('0xea')]={'id':_0x38acdf[_0xc163('0xea')]['id'],'name':_0x38acdf[_0xc163('0xea')]['name'],'fullname':_0x38acdf[_0xc163('0xea')][_0xc163('0xdf')]};}return _0x38acdf;});});}});return Promise[_0xc163('0x82')](_0xfd7e7b);})[_0xc163('0x14')](function(_0x266f58){return _(_0x266f58)[_0xc163('0xf7')]()[_0xc163('0xf8')](_0xc163('0xe0'))['reverse']()[_0xc163('0xf9')]();})['then'](function(_0xa8b90a){_0x356846[_0xc163('0x9c')]=_0x5a39cd[_0xc163('0xf')]?_0xa8b90a[_0xc163('0xfa')](_0x5a39cd[_0xc163('0xd')],_0x5a39cd['offset']+_0x5a39cd[_0xc163('0xf')]):_0xa8b90a;return _0x356846;})[_0xc163('0x14')](respondWithFilteredResult(_0x4825fb,_0x5a39cd))['catch'](handleError(_0x4825fb,null));}; \ No newline at end of file +var _0x779f=['stack','name','describe','findAll','query','destroy','CmContact','find','catch','tags','keys','startsWith','cf_','columnName','displayName','analytics','CmCustomField','length','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','show','params','Tag','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','format','cf_%d','map','table','cm_contacts','setFields','toParam','text','CmHopper','phone','findOne','model','rawAttributes','intersection','attributes','fields','sort','filters','pick','filter','options','getTags','nolimit','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','CmHopperAdditionalPhone','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','getHoppers','order','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals','getJscriptySessions','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','root','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','agent','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','getJourney','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','voice','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','secondDisposition','key','Owner','Tags','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','threadId','Interaction','flatten','value','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/contacts','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','limit','undefined','count','status','set','then','end','sendStatus','error'];(function(_0x4ede04,_0x58132b){var _0x49ccfc=function(_0x51a704){while(--_0x51a704){_0x4ede04['push'](_0x4ede04['shift']());}};_0x49ccfc(++_0x58132b);}(_0x779f,0xe1));var _0xf779=function(_0x3e8fd7,_0x5628f4){_0x3e8fd7=_0x3e8fd7-0x0;var _0x452529=_0x779f[_0x3e8fd7];return _0x452529;};'use strict';var moment=require(_0xf779('0x0'));var BPromise=require(_0xf779('0x1'));var util=require(_0xf779('0x2'));var path=require(_0xf779('0x3'));var fs=require('fs');var _=require(_0xf779('0x4'));var squel=require('squel');var Papa=require(_0xf779('0x5'));var Redis=require(_0xf779('0x6'));var contacts=require(_0xf779('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xf779('0x8'))('api');var config=require(_0xf779('0x9'));var shared=require(_0xf779('0xa'));var db=require(_0xf779('0xb'))['db'];config['redis']=_['defaults'](config[_0xf779('0xc')],{'host':_0xf779('0xd'),'port':0x18eb});var socket=require(_0xf779('0xe'))(new Redis(config['redis']));require(_0xf779('0xf'))[_0xf779('0x10')](socket);function respondWithResult(_0x2f55fb,_0x42e343){_0x42e343=_0x42e343||0xc8;return function(_0x57f411){if(_0x57f411){return _0x2f55fb['status'](_0x42e343)[_0xf779('0x11')](_0x57f411);}};}function respondWithFilteredResult(_0x847786,_0x5bf8e1){return function(_0x51cc89){if(_0x51cc89){var _0x403954=typeof _0x5bf8e1[_0xf779('0x12')]==='undefined'&&typeof _0x5bf8e1[_0xf779('0x13')]===_0xf779('0x14');var _0x435f1f=_0x51cc89['count'];var _0xbcf67b=_0x403954?0x0:_0x5bf8e1[_0xf779('0x12')];var _0x4e3962=_0x403954?_0x51cc89[_0xf779('0x15')]:_0x5bf8e1[_0xf779('0x12')]+_0x5bf8e1['limit'];var _0x2fddd3;if(_0x4e3962>=_0x435f1f){_0x4e3962=_0x435f1f;_0x2fddd3=0xc8;}else{_0x2fddd3=0xce;}_0x847786[_0xf779('0x16')](_0x2fddd3);return _0x847786[_0xf779('0x17')]('Content-Range',_0xbcf67b+'-'+_0x4e3962+'/'+_0x435f1f)[_0xf779('0x11')](_0x51cc89);}return null;};}function saveUpdates(_0x3579af){return function(_0x3eefce){if(_0x3eefce){return _0x3eefce['update'](_0x3579af)['then'](function(_0x1fc00a){return _0x1fc00a;});}return null;};}function removeEntity(_0x3ece54){return function(_0x4348da){if(_0x4348da){return _0x4348da['destroy']()[_0xf779('0x18')](function(){_0x3ece54[_0xf779('0x16')](0xcc)[_0xf779('0x19')]();});}};}function handleEntityNotFound(_0x1e0064){return function(_0xb41d50){if(!_0xb41d50){_0x1e0064[_0xf779('0x1a')](0x194);}return _0xb41d50;};}function handleError(_0x478913,_0x7e0927){_0x7e0927=_0x7e0927||0x1f4;return function(_0x3990e0){logger[_0xf779('0x1b')](_0x3990e0[_0xf779('0x1c')]);if(_0x3990e0[_0xf779('0x1d')]){delete _0x3990e0[_0xf779('0x1d')];}_0x478913[_0xf779('0x16')](_0x7e0927)['send'](_0x3990e0);};}exports['index']=function(_0x1ce74a,_0x5c9ec3){var _0x190bf5={};return contacts[_0xf779('0x1e')]()[_0xf779('0x18')](function(_0x2022f9){_0x190bf5=qs['getOptions'](_0x2022f9,_0x1ce74a);return contacts[_0xf779('0x1f')](_0x1ce74a[_0xf779('0x20')],_0x1ce74a['user'],_0x190bf5,_0x2022f9);})[_0xf779('0x18')](respondWithFilteredResult(_0x5c9ec3,_0x190bf5))['catch'](handleError(_0x5c9ec3,null));};exports[_0xf779('0x21')]=function(_0x53016d,_0x3aca3c){return db[_0xf779('0x22')][_0xf779('0x23')]({'where':{'id':_0x53016d['params']['id']}})['then'](handleEntityNotFound(_0x3aca3c,null))[_0xf779('0x18')](removeEntity(_0x3aca3c,null))[_0xf779('0x24')](handleError(_0x3aca3c,null));};exports[_0xf779('0x1e')]=function(_0x2417ed,_0xfce05){return db[_0xf779('0x22')][_0xf779('0x1e')]()['then'](function(_0x2a4fc9){delete _0x2a4fc9[_0xf779('0x25')];for(var _0xa97f12=0x0;_0xa97f120x0){return new Promise(function(_0x581be7){var _0x308d92=[];for(var _0x4d53a0=0x0;_0x4d53a0<_0x46fdb6[_0xf779('0x2d')];_0x4d53a0++){_0x308d92[_0xf779('0x5e')](insertAdditionalPhones(_0x46fdb6[_0x4d53a0][_0xf779('0x62')],_0x46fdb6[_0x4d53a0][_0xf779('0x59')]));}Promise['all'](_0x308d92)[_0xf779('0x18')](function(){_0x581be7(0x1);});})[_0xf779('0x18')](function(){return{'success':_0x2d9142,'failure':_0x168059,'duplicates':_0x26cc1f};});}else{return{'success':_0x2d9142,'failure':_0x168059,'duplicates':_0x26cc1f};}}})[_0xf779('0x18')](respondWithResult(_0x270c88,0xc9))[_0xf779('0x24')](handleError(_0x270c88,null));};exports[_0xf779('0x63')]=function(_0x451b29,_0x2562df){var _0x4ebad4;return db[_0xf779('0x22')][_0xf779('0x1e')]()[_0xf779('0x18')](function(_0x1e3e9e){return db[_0xf779('0x22')][_0xf779('0x23')]({'where':{'id':_0x451b29[_0xf779('0x64')]['id']},'include':[{'model':db[_0xf779('0x65')],'as':'Tags','attributes':['id','name',_0xf779('0x66')],'required':_0x451b29[_0xf779('0x20')][_0xf779('0x67')]?!![]:![]},{'model':db[_0xf779('0x4a')],'as':_0xf779('0x68'),'where':{'CmContactId':_0x451b29[_0xf779('0x64')]['id']},'required':![],'include':[{'model':db[_0xf779('0x69')],'as':_0xf779('0x6a')}]}],'order':[db[_0xf779('0x6b')][_0xf779('0x6c')](_0xf779('0x6d'))],'attributes':_[_0xf779('0x26')](_0x1e3e9e)});})[_0xf779('0x18')](function(_0x428653){if(!_[_0xf779('0x55')](_0x428653)){_0x4ebad4=_0x428653[_0xf779('0x38')]({'plain':!![]});var _0x32dc69={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x428653&&_0x428653[_0xf779('0x5f')]){if(_0x428653[_0xf779('0x5f')]){_0x32dc69['where'][_0xf779('0x6e')][_0xf779('0x5e')]({'ListId':{'$ne':_0x428653[_0xf779('0x5f')]}});}}return db[_0xf779('0x2c')][_0xf779('0x1f')](_0x32dc69);}})['then'](function(_0x30ed2b){if(!_['isNil'](_0x30ed2b)){return _[_0xf779('0x6f')](_0x4ebad4,_['map'](_0x30ed2b,function(_0x587595){return util[_0xf779('0x70')](_0xf779('0x71'),_0x587595['id']);}));}})['then'](handleEntityNotFound(_0x2562df,null))[_0xf779('0x18')](respondWithResult(_0x2562df,null))[_0xf779('0x24')](handleError(_0x2562df,null));};exports[_0xf779('0x40')]=function(_0x36616e,_0x33090d){var _0x2f0001;if(_0x36616e['body']['id']){delete _0x36616e[_0xf779('0x36')]['id'];}if(!_[_0xf779('0x55')](_0x36616e[_0xf779('0x36')][_0xf779('0x56')])){var _0x194aa0=_0x36616e[_0xf779('0x36')][_0xf779('0x56')];if(!_[_0xf779('0x55')](shared[_0xf779('0x57')][_0x194aa0]))_0x36616e[_0xf779('0x36')][_0xf779('0x58')]=shared[_0xf779('0x57')][_0x194aa0]['utcOffset'];}return db[_0xf779('0x22')]['find']({'where':{'id':_0x36616e[_0xf779('0x64')]['id']}})['then'](handleEntityNotFound(_0x33090d,null))[_0xf779('0x18')](saveUpdates(_0x36616e[_0xf779('0x36')],null))[_0xf779('0x18')](function(_0x594991){_0x2f0001=_0x594991;var _0x4ff2e5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x594991&&_0x594991[_0xf779('0x5f')]){if(_0x594991[_0xf779('0x5f')]){_0x4ff2e5[_0xf779('0x5c')][_0xf779('0x6e')][_0xf779('0x5e')]({'ListId':{'$ne':_0x594991[_0xf779('0x5f')]}});}}return db[_0xf779('0x2c')][_0xf779('0x1f')](_0x4ff2e5);})[_0xf779('0x18')](function(_0x365df7){if(_0x365df7){return _[_0xf779('0x6f')](_['pickBy'](_0x36616e[_0xf779('0x36')],function(_0xe496c,_0x305d48){return _[_0xf779('0x27')](_0x305d48,_0xf779('0x28'));}),_[_0xf779('0x72')](_0x365df7,function(_0x23c760){return util[_0xf779('0x70')](_0xf779('0x71'),_0x23c760['id']);}));}})[_0xf779('0x18')](function(_0x2e9e5b){if(_0x2e9e5b&&!_['isEmpty'](_0x2e9e5b)){var _0x17eecf=squel[_0xf779('0x40')]()[_0xf779('0x73')](_0xf779('0x74'))[_0xf779('0x75')](_0x2e9e5b)[_0xf779('0x5c')]('id\x20=\x20?',_0x36616e[_0xf779('0x64')]['id'])[_0xf779('0x76')]();return db['sequelize'][_0xf779('0x20')](_0x17eecf[_0xf779('0x77')],{'replacements':_0x17eecf[_0xf779('0x31')]});}})['then'](function(){if(_0x36616e['body']['phone']&&_0x2f0001){return db[_0xf779('0x78')][_0xf779('0x40')]({'phone':_0x36616e[_0xf779('0x36')][_0xf779('0x79')],'OrderBy':0x0},{'where':{'ContactId':_0x2f0001['id']}});}})[_0xf779('0x18')](function(){return _0x2f0001;})['then'](respondWithResult(_0x33090d,null))[_0xf779('0x24')](handleError(_0x33090d,null));};exports['getTags']=function(_0x18b16d,_0x5e7530){var _0x276573={};var _0x302cb4={};var _0x4056c4;var _0x2982eb;return db[_0xf779('0x22')][_0xf779('0x7a')]({'where':{'id':_0x18b16d[_0xf779('0x64')]['id']}})['then'](handleEntityNotFound(_0x5e7530,null))[_0xf779('0x18')](function(_0x176bde){if(_0x176bde){_0x4056c4=_0x176bde;_0x302cb4[_0xf779('0x7b')]=_['keys'](db[_0xf779('0x65')][_0xf779('0x7c')]);_0x302cb4[_0xf779('0x20')]=_[_0xf779('0x26')](_0x18b16d['query']);_0x302cb4['filters']=_[_0xf779('0x7d')](_0x302cb4[_0xf779('0x7b')],_0x302cb4['query']);_0x276573[_0xf779('0x7e')]=_[_0xf779('0x7d')](_0x302cb4[_0xf779('0x7b')],qs[_0xf779('0x7f')](_0x18b16d[_0xf779('0x20')][_0xf779('0x7f')]));_0x276573['attributes']=_0x276573['attributes'][_0xf779('0x2d')]?_0x276573[_0xf779('0x7e')]:_0x302cb4['model'];_0x276573['order']=qs[_0xf779('0x80')](_0x18b16d[_0xf779('0x20')][_0xf779('0x80')]);_0x276573['where']=qs[_0xf779('0x81')](_[_0xf779('0x82')](_0x18b16d['query'],_0x302cb4['filters']));if(_0x18b16d[_0xf779('0x20')][_0xf779('0x83')]){_0x276573[_0xf779('0x5c')]=_['merge'](_0x276573[_0xf779('0x5c')],{'$or':_['map'](_0x276573[_0xf779('0x7e')],function(_0x2dedbd){var _0x21baba={};_0x21baba[_0x2dedbd]={'$like':'%'+_0x18b16d[_0xf779('0x20')][_0xf779('0x83')]+'%'};return _0x21baba;})});}_0x276573=_[_0xf779('0x35')]({},_0x276573,_0x18b16d[_0xf779('0x84')]);return _0x4056c4[_0xf779('0x85')](_0x276573);}})[_0xf779('0x18')](function(_0x510fa4){if(_0x510fa4){_0x2982eb=_0x510fa4['length'];if(!_0x18b16d[_0xf779('0x20')]['hasOwnProperty'](_0xf779('0x86'))){_0x276573['limit']=qs[_0xf779('0x13')](_0x18b16d[_0xf779('0x20')][_0xf779('0x13')]);_0x276573[_0xf779('0x12')]=qs['offset'](_0x18b16d[_0xf779('0x20')][_0xf779('0x12')]);}return _0x4056c4[_0xf779('0x85')](_0x276573);}})[_0xf779('0x18')](function(_0xa941e4){if(_0xa941e4){return _0xa941e4?{'count':_0x2982eb,'rows':_0xa941e4}:null;}})[_0xf779('0x18')](respondWithResult(_0x5e7530,null))[_0xf779('0x24')](handleError(_0x5e7530,null));};exports['setTags']=function(_0x40711,_0x2c182c){if(_0x40711[_0xf779('0x36')]['id']){delete _0x40711[_0xf779('0x36')]['id'];}return db[_0xf779('0x22')]['findOne']({'where':{'id':_0x40711['params']['id']}})[_0xf779('0x18')](handleEntityNotFound(_0x2c182c,null))[_0xf779('0x18')](function(_0x1bb72f){if(_0x1bb72f){return _0x1bb72f[_0xf779('0x87')](_0x40711[_0xf779('0x36')][_0xf779('0x88')]||[]);}return null;})['then'](respondWithResult(_0x2c182c,null))[_0xf779('0x24')](handleError(_0x2c182c,null));};exports[_0xf779('0x89')]=function(_0x254497,_0x4a1f31){var _0xd397c5=[];_0xd397c5[_0xf779('0x5e')](addAdditionalPhones(_0x254497[_0xf779('0x36')]));Promise[_0xf779('0x8a')](_0xd397c5)['then'](function(){_0xd397c5=[];_0xd397c5[_0xf779('0x5e')](deleteCmHopperPhones(_0x254497[_0xf779('0x36')]['id']));_0xd397c5[_0xf779('0x5e')](addCmHopperPhones(_0x254497[_0xf779('0x36')]['id']));Promise[_0xf779('0x8a')](_0xd397c5)['then'](function(){return[0x1];})[_0xf779('0x18')](respondWithResult(_0x4a1f31,null));});};function addAdditionalPhones(_0x3b1699){var _0x580985;return new Promise(function(_0x2d659d){return db[_0xf779('0x4a')][_0xf779('0x21')]({'where':{'CmContactId':_0x3b1699['id']}})['then'](function(){db[_0xf779('0x69')][_0xf779('0x1f')]({'raw':!![],'attributes':['id',_0xf779('0x8b')]})['then'](function(_0x548a8f){var _0x36301b=[];for(var _0x4a7fc2=0x0;_0x4a7fc2<_0x3b1699[_0xf779('0x8c')][_0xf779('0x2d')];_0x4a7fc2++){var _0x19c298=_0x3b1699[_0xf779('0x8d')]?_[_0xf779('0x55')](_0x3b1699[_0xf779('0x8d')][_0x4a7fc2])?'':_0x3b1699[_0xf779('0x8d')][_0x4a7fc2]:_0x3b1699['items'][_0x4a7fc2][_0xf779('0x8e')]?_0x3b1699[_0xf779('0x8c')][_0x4a7fc2][_0xf779('0x8e')]:'';var _0x12513b=_[_0xf779('0x55')](_0x3b1699[_0xf779('0x8c')][_0x4a7fc2]['description'])?'':_0x3b1699['items'][_0x4a7fc2]['description'];var _0x2703d7=_0x19c298+':'+_0x3b1699['items'][_0x4a7fc2][_0xf779('0x79')]+'§'+_0x12513b;if(_[_0xf779('0x55')](_0x580985))_0x580985=_0x2703d7;else _0x580985+=';'+_0x2703d7;var _0x18e0aa=null;var _0x2397c2=null;if(_0x3b1699['item_types']){if(!_['isNil'](_0x3b1699['item_types'][_0x4a7fc2])){_0x2397c2=_[_0xf779('0x23')](_0x548a8f,function(_0x11c3f5){return _0x11c3f5['id']===_0x3b1699[_0xf779('0x8d')][_0x4a7fc2];});if(!_[_0xf779('0x55')](_0x2397c2)){_0x18e0aa=_0x2397c2[_0xf779('0x8b')];}}}else{if(!_[_0xf779('0x55')](_0x3b1699[_0xf779('0x8c')][_0x4a7fc2])){_0x2397c2=_[_0xf779('0x23')](_0x548a8f,function(_0x2382da){return _0x2382da['id']===_0x3b1699[_0xf779('0x8c')][_0x4a7fc2][_0xf779('0x8e')];});if(!_['isNil'](_0x2397c2)){_0x18e0aa=_0x4a7fc2;}}}if(_[_0xf779('0x55')](_0x18e0aa)){_0x18e0aa=0x64;}_0x36301b['push'](addAdditionalPhone(_0x3b1699['id'],_0x3b1699['items'][_0x4a7fc2][_0xf779('0x79')],_0x3b1699[_0xf779('0x8d')]?_[_0xf779('0x55')](_0x3b1699['item_types'][_0x4a7fc2])?null:_0x3b1699[_0xf779('0x8d')][_0x4a7fc2]:_0x3b1699['items'][_0x4a7fc2][_0xf779('0x8e')]?_0x3b1699['items'][_0x4a7fc2][_0xf779('0x8e')]:null,_0x18e0aa,_0x12513b));}Promise['all'](_0x36301b)[_0xf779('0x18')](function(){db['CmContact'][_0xf779('0x40')]({'AdditionalPhones':_0x580985},{'where':{'id':_0x3b1699['id']}})[_0xf779('0x18')](function(){_0x2d659d(0x1);});});});});});}function addAdditionalPhone(_0x20adaf,_0x26c8d3,_0x5df404,_0x427472,_0xb49703){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x20adaf,'item':_0x26c8d3}})[_0xf779('0x18')](function(_0x53dd73){if(_0x53dd73)logger['info']('contact\x20phone\x20exists',_0x53dd73);else{db[_0xf779('0x4a')][_0xf779('0x3f')]({'CmContactId':_0x20adaf,'item':_0x26c8d3,'ItemTypeId':_0x5df404,'OrderBy':_0x427472,'ItemClass':'PHONE','description':_0xb49703});}});}function deleteCmHopperPhones(_0x50fb71){return new Promise(function(_0x34e069){return db[_0xf779('0x78')][_0xf779('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x50fb71}})[_0xf779('0x18')](function(_0x4c13a4){db[_0xf779('0x8f')][_0xf779('0x21')]({'where':{'CmHopperId':{'$in':_[_0xf779('0x72')](_0x4c13a4,'id')}}});})[_0xf779('0x18')](function(){_0x34e069(0x1);});});}function addCmHopperPhones(_0x5a8819){return new Promise(function(_0x1b75e0){return db[_0xf779('0x78')][_0xf779('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5a8819}})[_0xf779('0x18')](function(_0x4a7667){var _0x6c50c3=[];_[_0xf779('0x72')](_0x4a7667,function(_0x29fea8){_0x6c50c3[_0xf779('0x5e')](createCmHopperPhone(_0x5a8819,_0x29fea8['id']));});Promise['all'](_0x6c50c3)[_0xf779('0x18')](function(){_0x1b75e0(0x1);});});});}function createCmHopperPhone(_0x1a2e8b,_0x5197bc){return new Promise(function(_0x5e23b1){db[_0xf779('0x4a')]['findAll']({'raw':!![],'attributes':[_0xf779('0x90'),_0xf779('0x8b')],'where':{'CmContactId':_0x1a2e8b,'ItemClass':_0xf779('0x91')},'include':[{'model':db[_0xf779('0x69')],'attributes':['OrderBy'],'as':_0xf779('0x6a')}],'order':['OrderBy',db[_0xf779('0x6b')][_0xf779('0x6c')](_0xf779('0x92'))]})[_0xf779('0x18')](function(_0x1dba46){var _0x51b99f=0x1;var _0x53173b=_['map'](_0x1dba46,function(_0x1edbf6){_0x1edbf6[_0xf779('0x93')]=_0x5197bc;_0x1edbf6['phone']=_0x1edbf6[_0xf779('0x90')];_0x1edbf6[_0xf779('0x8b')]=_0x51b99f;delete _0x1edbf6[_0xf779('0x94')];_0x51b99f=_0x51b99f+0x1;return _0x1edbf6;});return db[_0xf779('0x8f')][_0xf779('0x5a')](_0x53173b,{});})[_0xf779('0x18')](function(){_0x5e23b1(0x1);});});}function insertAdditionalPhones(_0x8fde33,_0x1f4b8a){return new Promise(function(_0x580001){var _0x4e5608=[];for(var _0x5c2721=0x0;_0x5c2721<_0x1f4b8a[_0xf779('0x2d')];_0x5c2721++){var _0x4b37e9=_0x1f4b8a[_0x5c2721];_0x4e5608['push'](parseContactItemType(_0x4b37e9));}Promise[_0xf779('0x8a')](_0x4e5608)[_0xf779('0x18')](function(){var _0x410bef={'id':_0x8fde33['id'],'items':_0x1f4b8a};return addAdditionalPhones(_0x410bef)[_0xf779('0x18')](function(){return addCmHopperPhones(_0x8fde33['id']);});})[_0xf779('0x18')](function(){_0x580001(_0x8fde33);});});}function parseContactItemType(_0x25cb9a){return new Promise(function(_0x1106b6){if(_0x25cb9a[_0xf779('0x34')](_0xf779('0x8e'))){_0x1106b6(_0x25cb9a);}else{return db[_0xf779('0x69')][_0xf779('0x23')]({'where':{'name':_0x25cb9a[_0xf779('0x6a')]}})[_0xf779('0x18')](function(_0xc9eeca){if(_[_0xf779('0x55')](_0xc9eeca))_0x25cb9a[_0xf779('0x8e')]=null;else _0x25cb9a[_0xf779('0x8e')]=_0xc9eeca['id'];_0x1106b6(_0x25cb9a);});}});}exports[_0xf779('0x95')]=function(_0x50e3e5,_0x127de0){return db[_0xf779('0x4a')][_0xf779('0x1f')]({'raw':!![],'where':{'CmContactId':_0x50e3e5[_0xf779('0x64')]['id'],'ItemClass':_0xf779('0x91')},'include':[{'model':db[_0xf779('0x69')],'as':_0xf779('0x6a')}],'order':[['OrderBy'],[db[_0xf779('0x6b')][_0xf779('0x6c')]('`ItemType`.OrderBy')]]})[_0xf779('0x18')](function(_0x1ef077){return _0x1ef077;})[_0xf779('0x18')](respondWithResult(_0x127de0,null))[_0xf779('0x24')](handleError(_0x127de0,null));};exports[_0xf779('0x96')]=function(_0x50e078,_0x404d7d){return db[_0xf779('0x4a')][_0xf779('0x1f')]({'raw':!![],'where':{'CmContactId':_0x50e078[_0xf779('0x36')][_0xf779('0x97')]}})[_0xf779('0x18')](function(_0x3f1584){var _0x1c10d9=_['map'](_0x3f1584,function(_0x3c8fbd){_0x3c8fbd[_0xf779('0x98')]=_0x50e078[_0xf779('0x36')][_0xf779('0x99')];return _0x3c8fbd;});return db[_0xf779('0x4a')]['bulkCreate'](_0x1c10d9,{});})['then'](function(){return addCmHopperPhones(_0x50e078[_0xf779('0x36')][_0xf779('0x99')]);})[_0xf779('0x18')](function(){return['ok'];})[_0xf779('0x18')](respondWithResult(_0x404d7d,null))[_0xf779('0x24')](handleError(_0x404d7d,null));};exports['rescheduleAdditionalPhones']=function(_0x56ccc9,_0x3e085e){var _0x5c8277=[];_0x5c8277['push'](createCmHopperPhone(_0x56ccc9[_0xf779('0x36')]['id'],_0x56ccc9[_0xf779('0x36')]['hopperId']));Promise[_0xf779('0x8a')](_0x5c8277)[_0xf779('0x18')](function(){return[0x1];})[_0xf779('0x18')](respondWithResult(_0x3e085e,null));};exports[_0xf779('0x9a')]=function(_0x1b00ad,_0x2c53cd){var _0x8b5996={'raw':![],'where':{}};var _0x1a74b3={};var _0x5cdff={'count':0x0,'rows':[]};return db[_0xf779('0x22')]['findOne']({'where':{'id':_0x1b00ad[_0xf779('0x64')]['id']}})[_0xf779('0x18')](handleEntityNotFound(_0x2c53cd,null))[_0xf779('0x18')](function(_0xb48d89){if(_0xb48d89){_0x1a74b3['model']=_[_0xf779('0x26')](db['CmHopper'][_0xf779('0x7c')]);_0x1a74b3[_0xf779('0x20')]=_[_0xf779('0x26')](_0x1b00ad[_0xf779('0x20')]);_0x1a74b3[_0xf779('0x81')]=_[_0xf779('0x7d')](_0x1a74b3[_0xf779('0x7b')],_0x1a74b3[_0xf779('0x20')]);_0x8b5996[_0xf779('0x7e')]=_[_0xf779('0x7d')](_0x1a74b3['model'],qs[_0xf779('0x7f')](_0x1b00ad[_0xf779('0x20')][_0xf779('0x7f')]));_0x8b5996[_0xf779('0x7e')]=_0x8b5996[_0xf779('0x7e')][_0xf779('0x2d')]?_0x8b5996[_0xf779('0x7e')]:_0x1a74b3[_0xf779('0x7b')];if(!_0x1b00ad[_0xf779('0x20')][_0xf779('0x34')](_0xf779('0x86'))){_0x8b5996['limit']=qs[_0xf779('0x13')](_0x1b00ad['query']['limit']);_0x8b5996[_0xf779('0x12')]=qs[_0xf779('0x12')](_0x1b00ad[_0xf779('0x20')][_0xf779('0x12')]);}_0x8b5996[_0xf779('0x9b')]=qs[_0xf779('0x80')](_0x1b00ad['query']['sort']);_0x8b5996[_0xf779('0x5c')]=qs[_0xf779('0x81')](_[_0xf779('0x82')](_0x1b00ad['query'],_0x1a74b3[_0xf779('0x81')]));_0x8b5996[_0xf779('0x5c')][_0xf779('0x9c')]=_0xb48d89['id'];if(_0x1b00ad[_0xf779('0x20')]['filter']){_0x8b5996[_0xf779('0x5c')]=_[_0xf779('0x35')](_0x8b5996[_0xf779('0x5c')],{'$or':_[_0xf779('0x72')](_0x8b5996[_0xf779('0x7e')],function(_0x47a666){var _0x2ae7ea={};_0x2ae7ea[_0x47a666]={'$like':'%'+_0x1b00ad[_0xf779('0x20')][_0xf779('0x83')]+'%'};return _0x2ae7ea;})});}_0x8b5996=_['merge']({},_0x8b5996,_0x1b00ad[_0xf779('0x84')]);return db[_0xf779('0x78')][_0xf779('0x15')]({'where':_0x8b5996[_0xf779('0x5c')]})[_0xf779('0x18')](function(_0x1d0412){_0x5cdff[_0xf779('0x15')]=_0x1d0412;if(_0x1b00ad[_0xf779('0x20')][_0xf779('0x9d')]){_0x8b5996['include']=[{'all':!![]}];}return db[_0xf779('0x78')][_0xf779('0x1f')](_0x8b5996);})[_0xf779('0x18')](function(_0x1f8d6a){_0x5cdff[_0xf779('0x9e')]=_0x1f8d6a;return _0x5cdff;});}})[_0xf779('0x18')](respondWithFilteredResult(_0x2c53cd,_0x8b5996))[_0xf779('0x24')](handleError(_0x2c53cd,null));};exports[_0xf779('0x9f')]=function(_0x365c44,_0x497aee){var _0x29b3fc={'raw':!![],'where':{}};var _0x4f101c={};var _0x47948c={'count':0x0,'rows':[]};return db[_0xf779('0x22')]['findOne']({'where':{'id':_0x365c44[_0xf779('0x64')]['id']}})[_0xf779('0x18')](handleEntityNotFound(_0x497aee,null))[_0xf779('0x18')](function(_0x8bc9e0){if(_0x8bc9e0){_0x4f101c[_0xf779('0x7b')]=_[_0xf779('0x26')](db[_0xf779('0x4c')][_0xf779('0x7c')]);_0x4f101c[_0xf779('0x20')]=_[_0xf779('0x26')](_0x365c44[_0xf779('0x20')]);_0x4f101c['filters']=_[_0xf779('0x7d')](_0x4f101c[_0xf779('0x7b')],_0x4f101c[_0xf779('0x20')]);_0x29b3fc[_0xf779('0x7e')]=_[_0xf779('0x7d')](_0x4f101c[_0xf779('0x7b')],qs[_0xf779('0x7f')](_0x365c44[_0xf779('0x20')][_0xf779('0x7f')]));_0x29b3fc[_0xf779('0x7e')]=_0x29b3fc[_0xf779('0x7e')][_0xf779('0x2d')]?_0x29b3fc[_0xf779('0x7e')]:_0x4f101c[_0xf779('0x7b')];if(!_0x365c44['query']['hasOwnProperty'](_0xf779('0x86'))){_0x29b3fc['limit']=qs[_0xf779('0x13')](_0x365c44[_0xf779('0x20')][_0xf779('0x13')]);_0x29b3fc['offset']=qs[_0xf779('0x12')](_0x365c44[_0xf779('0x20')][_0xf779('0x12')]);}_0x29b3fc[_0xf779('0x9b')]=qs[_0xf779('0x80')](_0x365c44[_0xf779('0x20')][_0xf779('0x80')]);_0x29b3fc[_0xf779('0x5c')]=qs[_0xf779('0x81')](_[_0xf779('0x82')](_0x365c44[_0xf779('0x20')],_0x4f101c[_0xf779('0x81')]));_0x29b3fc[_0xf779('0x5c')][_0xf779('0x9c')]=_0x8bc9e0['id'];if(_0x365c44[_0xf779('0x20')][_0xf779('0x83')]){_0x29b3fc[_0xf779('0x5c')]=_[_0xf779('0x35')](_0x29b3fc['where'],{'$or':_[_0xf779('0x72')](_0x29b3fc[_0xf779('0x7e')],function(_0x5af600){var _0x1145e8={};_0x1145e8[_0x5af600]={'$like':'%'+_0x365c44[_0xf779('0x20')][_0xf779('0x83')]+'%'};return _0x1145e8;})});}_0x29b3fc=_[_0xf779('0x35')]({},_0x29b3fc,_0x365c44[_0xf779('0x84')]);return db[_0xf779('0x4c')]['count']({'where':_0x29b3fc['where']})[_0xf779('0x18')](function(_0x2fafe7){_0x47948c[_0xf779('0x15')]=_0x2fafe7;if(_0x365c44[_0xf779('0x20')][_0xf779('0x9d')]){_0x29b3fc[_0xf779('0xa0')]=[{'all':!![]}];}return db[_0xf779('0x4c')][_0xf779('0x1f')](_0x29b3fc);})[_0xf779('0x18')](function(_0x54e18e){_0x47948c[_0xf779('0x9e')]=_0x54e18e;return _0x47948c;});}})[_0xf779('0x18')](respondWithFilteredResult(_0x497aee,_0x29b3fc))[_0xf779('0x24')](handleError(_0x497aee,null));};exports[_0xf779('0xa1')]=function(_0x395683,_0x3c9b4b){var _0x6fdeeb={'raw':!![],'where':{}};var _0x1448fa={};var _0x36d439={'count':0x0,'rows':[]};return db[_0xf779('0x22')][_0xf779('0x7a')]({'where':{'id':_0x395683[_0xf779('0x64')]['id']}})[_0xf779('0x18')](handleEntityNotFound(_0x3c9b4b,null))[_0xf779('0x18')](function(_0x5f2c91){if(_0x5f2c91){_0x1448fa[_0xf779('0x7b')]=_['keys'](db[_0xf779('0x4b')]['rawAttributes']);_0x1448fa[_0xf779('0x20')]=_['keys'](_0x395683[_0xf779('0x20')]);_0x1448fa[_0xf779('0x81')]=_[_0xf779('0x7d')](_0x1448fa[_0xf779('0x7b')],_0x1448fa[_0xf779('0x20')]);_0x6fdeeb[_0xf779('0x7e')]=_[_0xf779('0x7d')](_0x1448fa['model'],qs[_0xf779('0x7f')](_0x395683[_0xf779('0x20')][_0xf779('0x7f')]));_0x6fdeeb[_0xf779('0x7e')]=_0x6fdeeb['attributes'][_0xf779('0x2d')]?_0x6fdeeb[_0xf779('0x7e')]:_0x1448fa['model'];if(!_0x395683[_0xf779('0x20')]['hasOwnProperty'](_0xf779('0x86'))){_0x6fdeeb[_0xf779('0x13')]=qs[_0xf779('0x13')](_0x395683['query'][_0xf779('0x13')]);_0x6fdeeb[_0xf779('0x12')]=qs[_0xf779('0x12')](_0x395683[_0xf779('0x20')]['offset']);}_0x6fdeeb[_0xf779('0x9b')]=qs[_0xf779('0x80')](_0x395683['query'][_0xf779('0x80')]);_0x6fdeeb['where']=qs[_0xf779('0x81')](_[_0xf779('0x82')](_0x395683[_0xf779('0x20')],_0x1448fa[_0xf779('0x81')]));_0x6fdeeb[_0xf779('0x5c')][_0xf779('0x9c')]=_0x5f2c91['id'];if(_0x395683[_0xf779('0x20')]['filter']){_0x6fdeeb[_0xf779('0x5c')]=_[_0xf779('0x35')](_0x6fdeeb[_0xf779('0x5c')],{'$or':_['map'](_0x6fdeeb[_0xf779('0x7e')],function(_0x230fee){var _0x1eac67={};_0x1eac67[_0x230fee]={'$like':'%'+_0x395683[_0xf779('0x20')]['filter']+'%'};return _0x1eac67;})});}_0x6fdeeb=_['merge']({},_0x6fdeeb,_0x395683['options']);return db[_0xf779('0x4b')][_0xf779('0x15')]({'where':_0x6fdeeb['where']})[_0xf779('0x18')](function(_0x32dc1d){_0x36d439[_0xf779('0x15')]=_0x32dc1d;if(_0x395683[_0xf779('0x20')][_0xf779('0x9d')]){_0x6fdeeb[_0xf779('0xa0')]=[{'all':!![]}];}return db[_0xf779('0x4b')][_0xf779('0x1f')](_0x6fdeeb);})[_0xf779('0x18')](function(_0x6c78f3){_0x36d439[_0xf779('0x9e')]=_0x6c78f3;return _0x36d439;});}})[_0xf779('0x18')](respondWithFilteredResult(_0x3c9b4b,_0x6fdeeb))['catch'](handleError(_0x3c9b4b,null));};exports[_0xf779('0xa2')]=function(_0x36c83f,_0x2d9fc0){var _0x1ab75a={'raw':!![],'where':{}};var _0x3ab382={};var _0x2c064c={'count':0x0,'rows':[]};return db['CmContact'][_0xf779('0x7a')]({'where':{'id':_0x36c83f['params']['id']}})['then'](handleEntityNotFound(_0x2d9fc0,null))[_0xf779('0x18')](function(_0x713d17){if(_0x713d17){_0x3ab382['model']=_[_0xf779('0x26')](db[_0xf779('0x52')][_0xf779('0x7c')]);_0x3ab382['query']=_[_0xf779('0x26')](_0x36c83f[_0xf779('0x20')]);_0x3ab382[_0xf779('0x81')]=_[_0xf779('0x7d')](_0x3ab382[_0xf779('0x7b')],_0x3ab382[_0xf779('0x20')]);_0x1ab75a[_0xf779('0x7e')]=_[_0xf779('0x7d')](_0x3ab382['model'],qs['fields'](_0x36c83f[_0xf779('0x20')][_0xf779('0x7f')]));_0x1ab75a[_0xf779('0x7e')]=_0x1ab75a[_0xf779('0x7e')][_0xf779('0x2d')]?_0x1ab75a[_0xf779('0x7e')]:_0x3ab382[_0xf779('0x7b')];if(!_0x36c83f[_0xf779('0x20')][_0xf779('0x34')]('nolimit')){_0x1ab75a['limit']=qs['limit'](_0x36c83f[_0xf779('0x20')][_0xf779('0x13')]);_0x1ab75a['offset']=qs['offset'](_0x36c83f[_0xf779('0x20')][_0xf779('0x12')]);}_0x1ab75a['order']=qs[_0xf779('0x80')](_0x36c83f[_0xf779('0x20')][_0xf779('0x80')]);_0x1ab75a[_0xf779('0x5c')]=qs[_0xf779('0x81')](_['pick'](_0x36c83f[_0xf779('0x20')],_0x3ab382[_0xf779('0x81')]));_0x1ab75a[_0xf779('0x5c')][_0xf779('0x9c')]=_0x713d17['id'];if(_0x36c83f[_0xf779('0x20')][_0xf779('0x83')]){_0x1ab75a['where']=_[_0xf779('0x35')](_0x1ab75a['where'],{'$or':_[_0xf779('0x72')](_0x1ab75a[_0xf779('0x7e')],function(_0x4a5591){var _0x2f70ee={};_0x2f70ee[_0x4a5591]={'$like':'%'+_0x36c83f[_0xf779('0x20')]['filter']+'%'};return _0x2f70ee;})});}_0x1ab75a=_['merge']({},_0x1ab75a,_0x36c83f[_0xf779('0x84')]);return db[_0xf779('0x52')][_0xf779('0x15')]({'where':_0x1ab75a[_0xf779('0x5c')]})[_0xf779('0x18')](function(_0x108fae){_0x2c064c[_0xf779('0x15')]=_0x108fae;if(_0x36c83f[_0xf779('0x20')][_0xf779('0x9d')]){_0x1ab75a[_0xf779('0xa0')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1ab75a);})[_0xf779('0x18')](function(_0x482185){_0x2c064c[_0xf779('0x9e')]=_0x482185;return _0x2c064c;});}})[_0xf779('0x18')](respondWithFilteredResult(_0x2d9fc0,_0x1ab75a))[_0xf779('0x24')](handleError(_0x2d9fc0,null));};exports['uploadCsv']=function(_0x4e9ff6,_0x50f1cf){try{if(!_0x4e9ff6[_0xf779('0x36')][_0xf779('0x5f')]){throw new Error(_0xf779('0xa3'));}if(!_0x4e9ff6[_0xf779('0x36')][_0xf779('0xa4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4e9ff6[_0xf779('0x36')][_0xf779('0xa5')]){throw new Error(_0xf779('0xa6'));}if(!_0x4e9ff6[_0xf779('0x36')][_0xf779('0xa7')]){throw new Error(_0xf779('0xa8'));}var _0x1fc46d=_0x4e9ff6['body'][_0xf779('0xa4')]['split'](',');var _0x1d593d=_0x4e9ff6[_0xf779('0x36')]['binding_values'][_0xf779('0xa9')](',');if(!_0x1fc46d[_0xf779('0x2d')]||!_0x1d593d[_0xf779('0x2d')]||_0x1fc46d[_0xf779('0x2d')]!==_0x1d593d['length']){throw new Error(_0xf779('0xaa'));}_0x4e9ff6[_0xf779('0x36')][_0xf779('0x7f')]=_['zipObject'](_0x1fc46d,_0x1d593d);if(!_0x4e9ff6[_0xf779('0x36')][_0xf779('0x7f')]['phone']){throw new Error(_0xf779('0xab'));}if(!_0x4e9ff6['body'][_0xf779('0x7f')][_0xf779('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x116dda=path[_0xf779('0x3b')](config[_0xf779('0xad')],'server/files/tmp',_0x4e9ff6[_0xf779('0xae')][_0xf779('0xaf')]);fs['chmodSync'](_0x116dda,parseInt(_0xf779('0xb0'),0x8));var _0x5e8bfa=require(_0xf779('0xb1'))[_0xf779('0xb2')](path[_0xf779('0x3b')](__dirname,_0xf779('0xb3')),[_0x116dda,_0x4e9ff6['body'][_0xf779('0xa4')],_0x4e9ff6[_0xf779('0x36')][_0xf779('0xa5')],_0x4e9ff6[_0xf779('0x36')]['ListId'],_0x4e9ff6['body'][_0xf779('0xb4')],_0x4e9ff6['body'][_0xf779('0x5b')],_0x4e9ff6[_0xf779('0x36')]['socket_timestamp']]);return _0x50f1cf['status'](0xc8)['json']({'message':_0xf779('0xb5'),'pid':_0x5e8bfa[_0xf779('0xb6')]});}catch(_0x558c4e){return _0x50f1cf[_0xf779('0x16')](0x1f4)['send'](_0x558c4e);}};exports[_0xf779('0xb7')]=function(_0x18dd34,_0x260fc4){var _0x3f1254=fs[_0xf779('0xb8')](_0x18dd34[_0xf779('0xae')][_0xf779('0x3')]);Papa[_0xf779('0xb9')](_0x3f1254,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x254396){return _0x260fc4[_0xf779('0x16')](0xc8)[_0xf779('0x11')]({'file':_0x18dd34[_0xf779('0xae')],'fields':_0x254396[_0xf779('0xba')][_0xf779('0x7f')]});}});};exports['import']=function(_0x579e3c,_0x18b68e){return db['User'][_0xf779('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xf779('0x18')](function(_0x4d4f22){var _0x36b2df=![];if(!_0x579e3c[_0xf779('0x36')][_0xf779('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x579e3c[_0xf779('0x36')]['binding'][_0xf779('0x79')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x579e3c['body'][_0xf779('0xbb')][_0xf779('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x579e3c['body'][_0xf779('0xa7')]){throw new Error(_0xf779('0xa8'));}var _0x329a0f=require(_0xf779('0xb1'))[_0xf779('0xb2')](path[_0xf779('0x3b')](__dirname,_0xf779('0xbc')),[_0x579e3c[_0xf779('0x64')]['id'],JSON[_0xf779('0xbd')](_0x579e3c[_0xf779('0x36')]),JSON[_0xf779('0xbd')](_0x4d4f22)]);_0x329a0f['on'](_0xf779('0xbe'),function(){_0x36b2df=!![];return _0x18b68e['status'](0xc8)[_0xf779('0x11')]({'message':_0xf779('0xbf'),'pid':_0x329a0f['pid']});});_0x329a0f['on'](_0xf779('0xc0'),function(_0x11c07d){if(_0x11c07d&&!_0x36b2df){return _0x18b68e[_0xf779('0x16')](0x1f4)['json']({'message':_0xf779('0xc1'),'pid':_0x329a0f[_0xf779('0xb6')]});}});})[_0xf779('0x24')](handleError(_0x18b68e,null));};exports[_0xf779('0xc2')]=function(_0x45901e,_0x4ac493){return db[_0xf779('0xc3')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xf779('0xc4')}})[_0xf779('0x18')](function(_0x4043c8){var _0x304d9d=![];if(!_0x45901e[_0xf779('0x36')][_0xf779('0x5f')]){throw new Error(_0xf779('0xa3'));}if(!_0x45901e['body'][_0xf779('0xbb')][_0xf779('0x79')]){throw new Error(_0xf779('0xab'));}if(!_0x45901e[_0xf779('0x36')]['binding'][_0xf779('0xac')]){throw new Error(_0xf779('0xc5'));}if(!_0x45901e[_0xf779('0x36')][_0xf779('0xa7')]){throw new Error(_0xf779('0xa8'));}var _0x527c98=require(_0xf779('0xb1'))[_0xf779('0xb2')](path[_0xf779('0x3b')](__dirname,_0xf779('0xc6')),[_0x45901e[_0xf779('0x64')]['id'],JSON[_0xf779('0xbd')](_0x45901e['body']),JSON['stringify'](_0x4043c8)]);_0x527c98['on']('message',function(){_0x304d9d=!![];return _0x4ac493['status'](0xc8)['json']({'message':_0xf779('0xbf'),'pid':_0x527c98[_0xf779('0xb6')]});});_0x527c98['on'](_0xf779('0xc0'),function(_0x2bee4b){if(_0x2bee4b&&!_0x304d9d){return _0x4ac493['status'](0x1f4)[_0xf779('0x11')]({'message':_0xf779('0xc1'),'pid':_0x527c98[_0xf779('0xb6')]});}});})[_0xf779('0x24')](handleError(_0x4ac493,null));};exports[_0xf779('0xc7')]=function(_0x582415,_0x3e7e31){var _0x544978=['mail','chat','sms',_0xf779('0xc8'),_0xf779('0xc9'),_0xf779('0xca'),'voice'];var _0x2cb522={'offset':0x0,'order':qs[_0xf779('0x80')](_0xf779('0xcb'))},_0x21b926={'count':0x0,'rows':[]};Promise[_0xf779('0xcc')]()['then'](function(){if(_0x582415[_0xf779('0x20')][_0xf779('0xcd')]){if(!_['includes'](_0x544978,_0x582415[_0xf779('0x20')][_0xf779('0xcd')][_0xf779('0xce')]())){throw new Error('Invalid\x20channel');}_0x544978=[_0x582415[_0xf779('0x20')]['channel'][_0xf779('0xce')]()];}if(_0x582415[_0xf779('0x20')][_0xf779('0xcf')]){try{var _0x50336a=JSON[_0xf779('0xb9')](_0x582415[_0xf779('0x20')][_0xf779('0xcf')]);if(!moment(_0x50336a[_0xf779('0x37')])[_0xf779('0xd0')]()){throw new Error(_0xf779('0xd1'));}if(!moment(_0x50336a['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x445ab9){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x582415['query'][_0xf779('0x34')](_0xf779('0x86'))){_0x2cb522['limit']=qs[_0xf779('0x13')](_0x582415[_0xf779('0x20')][_0xf779('0x13')]||0xa);_0x2cb522[_0xf779('0x12')]=qs[_0xf779('0x12')](_0x582415[_0xf779('0x20')][_0xf779('0x12')]);}var _0x4b0ee8=_0x544978['map'](function(_0x2db64c){if(_0x2db64c===_0xf779('0xd2')){var _0x25f38d={'attributes':['id',_0xf779('0xd3'),'type',_0xf779('0xd4'),_0xf779('0xd5'),_0xf779('0xd6'),_0xf779('0xd7'),_0xf779('0xd8'),_0xf779('0xd9'),_0xf779('0xda'),_0xf779('0xdb'),_0xf779('0xdc'),_0xf779('0xdd'),_0xf779('0xde'),_0xf779('0xdf')],'where':{'ContactId':_0x582415[_0xf779('0x64')]['id']},'include':[{'model':db[_0xf779('0xc3')],'as':'User','attributes':['id',_0xf779('0x1d'),_0xf779('0xe0'),_0xf779('0x2e')]}],'order':[[_0xf779('0xdb'),'DESC']]};if(_0x582415['query'][_0xf779('0xcf')]){_0x25f38d['where']['createdAt']={'$gte':_0x50336a[_0xf779('0x37')],'$lte':_0x50336a['to']};}return db[_0xf779('0xe1')][_0xf779('0xe2')](_0x25f38d)[_0xf779('0x18')](function(_0x5f0d5a){_0x21b926[_0xf779('0x15')]+=_0x5f0d5a[_0xf779('0x15')];return _['map'](_0x5f0d5a[_0xf779('0x9e')],function(_0x3c2a17){var _0xbe92f4=_0x3c2a17[_0xf779('0x38')]({'plain':!![]});_0xbe92f4['channel']=_0x2db64c;if(_0xbe92f4['User']){_0xbe92f4['User']={'id':_0xbe92f4[_0xf779('0xc3')]['id'],'name':_0xbe92f4[_0xf779('0xc3')][_0xf779('0x1d')],'fullname':_0xbe92f4[_0xf779('0xc3')]['fullname'],'alias':_0xbe92f4['User'][_0xf779('0x2e')]};}return _0xbe92f4;});});}else{var _0x1bc439=_[_0xf779('0xe3')](_0x2db64c)+(_0x2db64c===_0xf779('0xe4')?_0xf779('0xe5'):_0xf779('0xe6'));var _0x2686a={'attributes':['id',_0xf779('0xe7'),_0xf779('0xe8'),'createdAt',_0xf779('0xda'),'disposition',_0xf779('0xe9'),'thirdDisposition',_0xf779('0xdf'),_0x1bc439+'Id'],'where':{'ContactId':_0x582415[_0xf779('0x64')]['id']},'include':[{'model':db[_0x1bc439],'as':_0xf779('0xe6'),'attributes':['id','name',_0xf779('0xea')]},{'model':db['User'],'as':_0xf779('0xeb'),'attributes':['id','name',_0xf779('0xe0')]},{'model':db[_0xf779('0x65')],'as':_0xf779('0xec'),'attributes':['id',_0xf779('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0xf779('0xdb'),_0xf779('0xed')]]};if(_0x582415[_0xf779('0x20')][_0xf779('0xcf')]){_0x2686a[_0xf779('0x5c')][_0xf779('0xdb')]={'$gte':_0x50336a[_0xf779('0x37')],'$lte':_0x50336a['to']};}switch(_0x2db64c){case _0xf779('0xe4'):_0x2686a['attributes'][_0xf779('0x5e')](_0xf779('0xee'),_0xf779('0xef'),_0xf779('0xf0'),_0xf779('0xf1'),_0xf779('0xf2'),_0xf779('0xf3'),_0xf779('0xf4'),_0xf779('0xf5'),_0xf779('0xf6'));break;case _0xf779('0xf7'):_0x2686a[_0xf779('0x7e')][_0xf779('0x5e')](_0xf779('0xf8'),'substatus');break;case _0xf779('0xc8'):_0x2686a[_0xf779('0x7e')][_0xf779('0x5e')]('externalUrl',_0xf779('0xf9'));break;}return db[_[_0xf779('0xe3')](_0x2db64c)+_0xf779('0xfa')][_0xf779('0xe2')](_0x2686a)[_0xf779('0x18')](function(_0x565296){_0x21b926[_0xf779('0x15')]+=_0x565296['count'];return _['map'](_0x565296[_0xf779('0x9e')],function(_0x429e39){var _0x2671a9=_0x429e39[_0xf779('0x38')]({'plain':!![]});_0x2671a9['channel']=_0x2db64c;if(_0x2671a9['Owner']){_0x2671a9[_0xf779('0xeb')]={'id':_0x2671a9['Owner']['id'],'name':_0x2671a9[_0xf779('0xeb')][_0xf779('0x1d')],'fullname':_0x2671a9[_0xf779('0xeb')][_0xf779('0xe0')]};}return _0x2671a9;});});}});return Promise['all'](_0x4b0ee8);})[_0xf779('0x18')](function(_0x583737){return _(_0x583737)[_0xf779('0xfb')]()['sortBy'](_0xf779('0xdb'))['reverse']()[_0xf779('0xfc')]();})[_0xf779('0x18')](function(_0x2ad5d7){_0x21b926[_0xf779('0x9e')]=_0x2cb522[_0xf779('0x13')]?_0x2ad5d7['slice'](_0x2cb522[_0xf779('0x12')],_0x2cb522[_0xf779('0x12')]+_0x2cb522['limit']):_0x2ad5d7;return _0x21b926;})[_0xf779('0x18')](respondWithFilteredResult(_0x3e7e31,_0x2cb522))[_0xf779('0x24')](handleError(_0x3e7e31,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 9f1ba51..bf917b2 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 _0x0f6a=['../../mysqldb','CmContact','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x435ff3,_0x285a1e){var _0x41b152=function(_0x2d8d1d){while(--_0x2d8d1d){_0x435ff3['push'](_0x435ff3['shift']());}};_0x41b152(++_0x285a1e);}(_0x0f6a,0x15d));var _0xa0f6=function(_0x208c12,_0x4676a7){_0x208c12=_0x208c12-0x0;var _0x3bdf88=_0x0f6a[_0x208c12];return _0x3bdf88;};'use strict';var EventEmitter=require(_0xa0f6('0x0'));var CmContact=require(_0xa0f6('0x1'))['db'][_0xa0f6('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa0f6('0x3')](0x0);var events={'afterCreate':_0xa0f6('0x4'),'afterUpdate':_0xa0f6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57c97a){return function(_0x5ebe10,_0x4cb957,_0x4bd1a6){CmContactEvents[_0xa0f6('0x6')](_0x57c97a+':'+_0x5ebe10['id'],_0x5ebe10);CmContactEvents[_0xa0f6('0x6')](_0x57c97a,_0x5ebe10);_0x4bd1a6(null);};}for(var e in events){if(events[_0xa0f6('0x7')](e)){var event=events[e];CmContact[_0xa0f6('0x8')](e,emitEvent(event));}}module[_0xa0f6('0x9')]=CmContactEvents; \ No newline at end of file +var _0x3b7b=['update','remove','emit','hasOwnProperty','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x31d92e,_0x30bdbc){var _0x4e348d=function(_0x3fe24c){while(--_0x3fe24c){_0x31d92e['push'](_0x31d92e['shift']());}};_0x4e348d(++_0x30bdbc);}(_0x3b7b,0x187));var _0xb3b7=function(_0x41376a,_0x849432){_0x41376a=_0x41376a-0x0;var _0x5bd0b6=_0x3b7b[_0x41376a];return _0x5bd0b6;};'use strict';var EventEmitter=require(_0xb3b7('0x0'));var CmContact=require(_0xb3b7('0x1'))['db'][_0xb3b7('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb3b7('0x3')](0x0);var events={'afterCreate':_0xb3b7('0x4'),'afterUpdate':_0xb3b7('0x5'),'afterDestroy':_0xb3b7('0x6')};function emitEvent(_0x37fe9e){return function(_0x19d5b1,_0x31fcd3,_0x531dac){CmContactEvents[_0xb3b7('0x7')](_0x37fe9e+':'+_0x19d5b1['id'],_0x19d5b1);CmContactEvents[_0xb3b7('0x7')](_0x37fe9e,_0x19d5b1);_0x531dac(null);};}for(var e in events){if(events[_0xb3b7('0x8')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c43af5e..c02dfee 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 _0xfd94=['isEmpty','length','destroy','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','format','ListId','priority','callbackUniqueid','phone','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','CmHopper','create','dialCheckDuplicateType','onlyIfOpen','VoiceQueue','outbound','CmList','map','findAll','Lists','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message'];(function(_0x4c7fe9,_0x27a4e8){var _0x3ee959=function(_0x559441){while(--_0x559441){_0x4c7fe9['push'](_0x4c7fe9['shift']());}};_0x3ee959(++_0x27a4e8);}(_0xfd94,0xce));var _0x4fd9=function(_0x1ae975,_0x70b40e){_0x1ae975=_0x1ae975-0x0;var _0x2576ca=_0xfd94[_0x1ae975];return _0x2576ca;};'use strict';var _=require(_0x4fd9('0x0'));var util=require(_0x4fd9('0x1'));var logger=require(_0x4fd9('0x2'))(_0x4fd9('0x3'));var moment=require(_0x4fd9('0x4'));var shared=require(_0x4fd9('0x5'));var attributes=require(_0x4fd9('0x6'));function getTimezoneCallbackAt(_0x255f63,_0x43fa93,_0x125de9,_0xc79566){var _0x3275cc=_0xc79566?_0x4fd9('0x7'):'VoiceQueue';var _0x3de6f8=_0x125de9[_0x4fd9('0x8')]?_0x125de9[_0x4fd9('0x8')]:moment()['format'](_0x4fd9('0x9'));if(_[_0x4fd9('0xa')](_0x125de9[_0x4fd9('0xb')])){return Promise[_0x4fd9('0xc')](_0x3de6f8);}return _0x255f63[_0x3275cc][_0x4fd9('0xd')]({'where':{'id':_0x43fa93}})[_0x4fd9('0xe')](function(_0x1a8329){if(_[_0x4fd9('0xa')](_0x1a8329)||_[_0x4fd9('0xa')](_0x1a8329[_0x4fd9('0xb')])){return Promise[_0x4fd9('0xc')](_0x3de6f8);}var _0x334475=shared[_0x4fd9('0xf')];var _0x1d48f9=_0x334475[_0x1a8329[_0x4fd9('0xb')]];var _0x3bda87=_0x334475[_0x125de9[_0x4fd9('0xb')]];if(_[_0x4fd9('0xa')](_0x1d48f9)&&_[_0x4fd9('0xa')](_0x3bda87)){return Promise[_0x4fd9('0xc')](_0x3de6f8);}var _0x546129=_0x1d48f9['utcOffset']-_0x3bda87[_0x4fd9('0x10')];var _0xb2d1cd=_0x125de9[_0x4fd9('0x8')]?_0x125de9[_0x4fd9('0x8')]:moment();_0x3de6f8=moment(_0xb2d1cd)[_0x4fd9('0x11')](_0x546129,_0x4fd9('0x12'))[_0x4fd9('0x13')](_0x4fd9('0x9'));return Promise[_0x4fd9('0xc')](_0x3de6f8);});}function getNewHopperPayload(_0x58a5a2){return{'phone':_0x58a5a2['phone'],'ContactId':_0x58a5a2['id'],'ListId':_0x58a5a2[_0x4fd9('0x14')],'scheduledat':_0x58a5a2['scheduledat']?_0x58a5a2[_0x4fd9('0x8')]:moment()[_0x4fd9('0x13')](_0x4fd9('0x9')),'priority':_0x58a5a2['priority']?_0x58a5a2[_0x4fd9('0x15')]:0x2,'callback':_0x58a5a2[_0x4fd9('0x16')]?!![]:![],'callbackuniqueid':_0x58a5a2[_0x4fd9('0x16')]?_0x58a5a2[_0x4fd9('0x16')]:undefined,'callbackat':_0x58a5a2[_0x4fd9('0x16')]?moment()['format'](_0x4fd9('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x797583,_0x35b193,_0x111979,_0x289486){var _0x2f72ad={'phone':_0x111979[_0x4fd9('0x17')]};var _0x2b4086={'calleridnum':_0x111979['phone']};if(_0x289486){Object[_0x4fd9('0x18')](_0x2f72ad,{'CampaignId':_0x35b193['id']});Object[_0x4fd9('0x18')](_0x2b4086,{'CampaignId':_0x35b193['id']});}else{Object[_0x4fd9('0x18')](_0x2f72ad,{'VoiceQueueId':_0x35b193['id']});Object[_0x4fd9('0x18')](_0x2b4086,{'VoiceQueueId':_0x35b193['id']});}return _0x797583['CmHopper']['findOne']({'where':_0x2f72ad})[_0x4fd9('0xe')](function(_0x3d2bd1){if(_0x3d2bd1){throw new Error(_0x4fd9('0x19')+_0x111979[_0x4fd9('0x17')]+_0x4fd9('0x1a')+_0x35b193['id']);}return _0x797583['CmHopperFinal']['findOne']({'where':_0x2b4086});})['then'](function(_0x3d6491){if(_0x3d6491){throw new Error(_0x4fd9('0x1b')+_0x111979['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x35b193['id']);}var _0x50a7de=getNewHopperPayload(_0x111979);if(_0x289486){_0x50a7de[_0x4fd9('0x1c')]=_0x35b193['id'];}else{_0x50a7de[_0x4fd9('0x1d')]=_0x35b193['id'];}return _0x797583[_0x4fd9('0x1e')][_0x4fd9('0x1f')](_0x50a7de);});}function handleOnlyIfOpenCheckDuplicate(_0x2d9f63,_0x59e67b,_0x64499a,_0x377eda){var _0x568392={'phone':_0x64499a[_0x4fd9('0x17')]};if(_0x377eda){Object['assign'](_0x568392,{'CampaignId':_0x59e67b['id']});}else{Object['assign'](_0x568392,{'VoiceQueueId':_0x59e67b['id']});}return _0x2d9f63[_0x4fd9('0x1e')]['findOne']({'where':_0x568392})[_0x4fd9('0xe')](function(_0x2436ee){if(_0x2436ee){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x64499a[_0x4fd9('0x17')]+_0x4fd9('0x1a')+_0x59e67b['id']);}var _0x22ac46=getNewHopperPayload(_0x64499a);if(_0x377eda){_0x22ac46['CampaignId']=_0x59e67b['id'];}else{_0x22ac46[_0x4fd9('0x1d')]=_0x59e67b['id'];}return _0x2d9f63[_0x4fd9('0x1e')][_0x4fd9('0x1f')](_0x22ac46);});}function handleNeverCheckDuplicate(_0x41251c,_0x22e5b7,_0x3d05dc){var _0x52fb39=getNewHopperPayload(_0x3d05dc);_0x52fb39[_0x4fd9('0x1d')]=_0x22e5b7['id'];return _0x41251c[_0x4fd9('0x1e')]['create'](_0x52fb39);}function handleCheckDuplicate(_0x299de5,_0x4ccc87,_0x5e354e,_0x354b46){return getTimezoneCallbackAt(_0x299de5,_0x4ccc87,_0x5e354e,_0x354b46)[_0x4fd9('0xe')](function(_0x50f3cb){_0x5e354e['scheduledat']=_0x50f3cb;switch(_0x4ccc87[_0x4fd9('0x20')]){case'always':return handleAlwaysCheckDuplicate(_0x299de5,_0x4ccc87,_0x5e354e,_0x354b46);case _0x4fd9('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x299de5,_0x4ccc87,_0x5e354e,_0x354b46);default:return handleNeverCheckDuplicate(_0x299de5,_0x4ccc87,_0x5e354e);}});}function createHopperForVoiceQueues(_0x112dbe,_0x2e44bf){return _0x112dbe[_0x4fd9('0x22')]['findAll']({'where':{'type':_0x4fd9('0x23')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x112dbe[_0x4fd9('0x24')],'as':'Lists','where':{'id':_0x2e44bf[_0x4fd9('0x14')]}}],'raw':!![]})[_0x4fd9('0xe')](function(_0x3bb37a){var _0x1573a1=_0x3bb37a[_0x4fd9('0x25')](function(_0x48574e){return handleCheckDuplicate(_0x112dbe,_0x48574e,_0x2e44bf,![]);});return Promise['all'](_0x1573a1);});}function createHopperForCampaigns(_0x7d5b6f,_0x4ccadc){return _0x7d5b6f['Campaign'][_0x4fd9('0x26')]({'attributes':['id','dialCheckDuplicateType',_0x4fd9('0xb')],'include':[{'model':_0x7d5b6f[_0x4fd9('0x24')],'as':_0x4fd9('0x27'),'where':{'id':_0x4ccadc['ListId']}}],'raw':!![]})['then'](function(_0x2f89a4){var _0x5b1661=_0x2f89a4[_0x4fd9('0x25')](function(_0xc08aea){return handleCheckDuplicate(_0x7d5b6f,_0xc08aea,_0x4ccadc,!![]);});return Promise[_0x4fd9('0x28')](_0x5b1661);});}function createHopperBlackForVoiceQueues(_0x5aa6cc,_0x2ed68a){return _0x5aa6cc[_0x4fd9('0x22')][_0x4fd9('0x26')]({'where':{'type':_0x4fd9('0x23')},'attributes':['id'],'include':[{'model':_0x5aa6cc[_0x4fd9('0x24')],'as':_0x4fd9('0x29'),'where':{'id':_0x2ed68a[_0x4fd9('0x14')]}}],'raw':!![]})[_0x4fd9('0xe')](function(_0x348c4){var _0x1c41ac=_0x348c4[_0x4fd9('0x25')](function(_0x6e9235){return _0x5aa6cc[_0x4fd9('0x2a')][_0x4fd9('0x1f')]({'phone':_0x2ed68a['phone'],'ContactId':_0x2ed68a['id'],'ListId':_0x2ed68a[_0x4fd9('0x14')],'VoiceQueueId':_0x6e9235['id']});});return Promise[_0x4fd9('0x28')](_0x1c41ac);});}function createHopperBlackForCampaigns(_0x578702,_0x1af059){return _0x578702[_0x4fd9('0x7')][_0x4fd9('0x26')]({'attributes':['id'],'include':[{'model':_0x578702[_0x4fd9('0x24')],'as':_0x4fd9('0x29'),'where':{'id':_0x1af059[_0x4fd9('0x14')]}}],'raw':!![]})['then'](function(_0x5ce733){var _0x15dd7c=_0x5ce733[_0x4fd9('0x25')](function(_0x1b27c0){return _0x578702['CmHopperBlack']['create']({'phone':_0x1af059[_0x4fd9('0x17')],'ContactId':_0x1af059['id'],'ListId':_0x1af059[_0x4fd9('0x14')],'CampaignId':_0x1b27c0['id']});});return Promise[_0x4fd9('0x28')](_0x15dd7c);});}module[_0x4fd9('0x2b')]=function(_0x89050b){return _0x89050b[_0x4fd9('0x2c')](_0x4fd9('0x2d'),attributes,{'tableName':_0x4fd9('0x2e'),'paranoid':!![],'indexes':[{'name':_0x4fd9('0x17'),'fields':[_0x4fd9('0x17')]},{'name':_0x4fd9('0x2f'),'fields':[_0x4fd9('0x30'),'lastName','phone',_0x4fd9('0x31'),'fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x4fd9('0x32'),'collate':_0x4fd9('0x33'),'hooks':{'afterCreate':function(_0xc47b54,_0x3728ed,_0x464f26){var _0x53ceb5=_0x89050b[_0x4fd9('0x34')];var _0x4e3037=_0xc47b54[_0x4fd9('0x35')]({'plain':!![]});if(!_0x4e3037[_0x4fd9('0x14')]){logger[_0x4fd9('0x36')](_0x4fd9('0x37')+_0x4e3037['id']);return _0x464f26();}if(!_0x4e3037[_0x4fd9('0x17')]){return _0x464f26();}return createHopperForVoiceQueues(_0x53ceb5,_0x4e3037)[_0x4fd9('0xe')](function(){return createHopperBlackForVoiceQueues(_0x53ceb5,_0x4e3037);})[_0x4fd9('0xe')](function(){return createHopperForCampaigns(_0x53ceb5,_0x4e3037);})[_0x4fd9('0xe')](function(){return createHopperBlackForCampaigns(_0x53ceb5,_0x4e3037);})[_0x4fd9('0xe')](function(){return _0x464f26();})[_0x4fd9('0x38')](function(_0x4776da){logger['error']('[cmContact][afterCreate]',_0x4776da[_0x4fd9('0x39')]);_0x464f26();});},'afterDestroy':function(_0x1569f2,_0x4554cc,_0x57b3aa){var _0x2520ad=_0x89050b[_0x4fd9('0x34')];var _0x2c9714=_0x1569f2[_0x4fd9('0x35')]({'plain':!![]});return _0x2520ad['CmHopper'][_0x4fd9('0x26')]({'raw':!![],'where':{'ListId':_0x2c9714['ListId'],'ContactId':_0x2c9714['id']}})[_0x4fd9('0xe')](function(_0x433529){if(!_[_0x4fd9('0x3a')](_0x433529)){var _0x16a9a8=[];for(var _0x5471db=0x0;_0x5471db<_0x433529[_0x4fd9('0x3b')];_0x5471db+=0x1){var _0x41ef47=_0x2520ad[_0x4fd9('0x1e')][_0x4fd9('0x3c')]({'where':{'ListId':_0x433529[_0x5471db][_0x4fd9('0x14')],'ContactId':_0x433529[_0x5471db][_0x4fd9('0x3d')],'VoiceQueueId':_0x433529[_0x5471db][_0x4fd9('0x1d')],'CampaignId':_0x433529[_0x5471db][_0x4fd9('0x1c')]}});_0x16a9a8['push'](_0x41ef47);}return Promise[_0x4fd9('0x28')](_0x16a9a8);}})[_0x4fd9('0xe')](function(_0x4d7a5a){logger[_0x4fd9('0x3e')](_0x4fd9('0x3f'),util[_0x4fd9('0x40')](_0x4d7a5a,{'showHidden':![],'depth':null}));_0x57b3aa();})[_0x4fd9('0x38')](function(_0x1d6915){logger[_0x4fd9('0x36')](_0x4fd9('0x41'),util[_0x4fd9('0x40')](_0x1d6915,{'showHidden':![],'depth':null}));_0x57b3aa(_0x1d6915);});}}});}; \ No newline at end of file +var _0xfb21=['callbackUniqueid','phone','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','findAll','outbound','CmList','Lists','map','dialCheckDuplicateType','all','CmHopperBlack','exports','CmContact','cm_contacts','lastName','mobile','email','utf8mb4','utf8mb4_unicode_ci','models','get','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','error','message','isEmpty','length','destroy','ContactId','push','info','inspect','[CmContact][afterDestroy][Error]','lodash','util','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','then','isNil','utcOffset','add','minutes','ListId','priority'];(function(_0x2bbe19,_0x2aeb07){var _0x51357e=function(_0x4c28f2){while(--_0x4c28f2){_0x2bbe19['push'](_0x2bbe19['shift']());}};_0x51357e(++_0x2aeb07);}(_0xfb21,0xe4));var _0x1fb2=function(_0x4fd996,_0xfd9dd5){_0x4fd996=_0x4fd996-0x0;var _0x336139=_0xfb21[_0x4fd996];return _0x336139;};'use strict';var _=require(_0x1fb2('0x0'));var util=require(_0x1fb2('0x1'));var logger=require('../../config/logger')(_0x1fb2('0x2'));var moment=require(_0x1fb2('0x3'));var shared=require(_0x1fb2('0x4'));var attributes=require(_0x1fb2('0x5'));function getTimezoneCallbackAt(_0x122542,_0x189056,_0x463caa,_0x3dde32){var _0x331155=_0x3dde32?_0x1fb2('0x6'):_0x1fb2('0x7');var _0x1b2bec=_0x463caa[_0x1fb2('0x8')]?_0x463caa[_0x1fb2('0x8')]:moment()[_0x1fb2('0x9')](_0x1fb2('0xa'));if(_['isNil'](_0x463caa[_0x1fb2('0xb')])){return Promise[_0x1fb2('0xc')](_0x1b2bec);}return _0x122542[_0x331155]['findOne']({'where':{'id':_0x189056}})[_0x1fb2('0xd')](function(_0x1aee1f){if(_[_0x1fb2('0xe')](_0x1aee1f)||_[_0x1fb2('0xe')](_0x1aee1f[_0x1fb2('0xb')])){return Promise[_0x1fb2('0xc')](_0x1b2bec);}var _0xbd20b1=shared['timezones'];var _0x1cb44a=_0xbd20b1[_0x1aee1f[_0x1fb2('0xb')]];var _0x5075e3=_0xbd20b1[_0x463caa[_0x1fb2('0xb')]];if(_['isNil'](_0x1cb44a)&&_[_0x1fb2('0xe')](_0x5075e3)){return Promise[_0x1fb2('0xc')](_0x1b2bec);}var _0x64bc=_0x1cb44a[_0x1fb2('0xf')]-_0x5075e3[_0x1fb2('0xf')];var _0x4fcd43=_0x463caa[_0x1fb2('0x8')]?_0x463caa[_0x1fb2('0x8')]:moment();_0x1b2bec=moment(_0x4fcd43)[_0x1fb2('0x10')](_0x64bc,_0x1fb2('0x11'))[_0x1fb2('0x9')](_0x1fb2('0xa'));return Promise[_0x1fb2('0xc')](_0x1b2bec);});}function getNewHopperPayload(_0xc4c4b7){return{'phone':_0xc4c4b7['phone'],'ContactId':_0xc4c4b7['id'],'ListId':_0xc4c4b7[_0x1fb2('0x12')],'scheduledat':_0xc4c4b7[_0x1fb2('0x8')]?_0xc4c4b7[_0x1fb2('0x8')]:moment()[_0x1fb2('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xc4c4b7['priority']?_0xc4c4b7[_0x1fb2('0x13')]:0x2,'callback':_0xc4c4b7['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xc4c4b7[_0x1fb2('0x14')]?_0xc4c4b7[_0x1fb2('0x14')]:undefined,'callbackat':_0xc4c4b7[_0x1fb2('0x14')]?moment()[_0x1fb2('0x9')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x869ab3,_0x2852aa,_0x54ed89,_0x5aaa90){var _0x2252fb={'phone':_0x54ed89[_0x1fb2('0x15')]};var _0x5f20c3={'calleridnum':_0x54ed89[_0x1fb2('0x15')]};if(_0x5aaa90){Object[_0x1fb2('0x16')](_0x2252fb,{'CampaignId':_0x2852aa['id']});Object[_0x1fb2('0x16')](_0x5f20c3,{'CampaignId':_0x2852aa['id']});}else{Object[_0x1fb2('0x16')](_0x2252fb,{'VoiceQueueId':_0x2852aa['id']});Object['assign'](_0x5f20c3,{'VoiceQueueId':_0x2852aa['id']});}return _0x869ab3['CmHopper']['findOne']({'where':_0x2252fb})['then'](function(_0x174b63){if(_0x174b63){throw new Error(_0x1fb2('0x17')+_0x54ed89[_0x1fb2('0x15')]+_0x1fb2('0x18')+_0x2852aa['id']);}return _0x869ab3[_0x1fb2('0x19')]['findOne']({'where':_0x5f20c3});})[_0x1fb2('0xd')](function(_0x3deb3d){if(_0x3deb3d){throw new Error(_0x1fb2('0x1a')+_0x54ed89[_0x1fb2('0x15')]+_0x1fb2('0x18')+_0x2852aa['id']);}var _0x4e0fd5=getNewHopperPayload(_0x54ed89);if(_0x5aaa90){_0x4e0fd5[_0x1fb2('0x1b')]=_0x2852aa['id'];}else{_0x4e0fd5[_0x1fb2('0x1c')]=_0x2852aa['id'];}return _0x869ab3['CmHopper'][_0x1fb2('0x1d')](_0x4e0fd5);});}function handleOnlyIfOpenCheckDuplicate(_0x1b5b4d,_0x49f638,_0xae7ed9,_0x26a060){var _0x5b560c={'phone':_0xae7ed9[_0x1fb2('0x15')]};if(_0x26a060){Object[_0x1fb2('0x16')](_0x5b560c,{'CampaignId':_0x49f638['id']});}else{Object['assign'](_0x5b560c,{'VoiceQueueId':_0x49f638['id']});}return _0x1b5b4d[_0x1fb2('0x1e')]['findOne']({'where':_0x5b560c})[_0x1fb2('0xd')](function(_0xb34c55){if(_0xb34c55){throw new Error(_0x1fb2('0x1f')+_0xae7ed9['phone']+_0x1fb2('0x18')+_0x49f638['id']);}var _0x4591d4=getNewHopperPayload(_0xae7ed9);if(_0x26a060){_0x4591d4['CampaignId']=_0x49f638['id'];}else{_0x4591d4[_0x1fb2('0x1c')]=_0x49f638['id'];}return _0x1b5b4d[_0x1fb2('0x1e')][_0x1fb2('0x1d')](_0x4591d4);});}function handleNeverCheckDuplicate(_0x4abaf8,_0x274c88,_0xc4597d){var _0x3e6d5e=getNewHopperPayload(_0xc4597d);_0x3e6d5e['VoiceQueueId']=_0x274c88['id'];return _0x4abaf8[_0x1fb2('0x1e')][_0x1fb2('0x1d')](_0x3e6d5e);}function handleCheckDuplicate(_0x31deed,_0xec2ca0,_0x353706,_0x1d4685){return getTimezoneCallbackAt(_0x31deed,_0xec2ca0,_0x353706,_0x1d4685)['then'](function(_0x3d453c){_0x353706[_0x1fb2('0x8')]=_0x3d453c;switch(_0xec2ca0['dialCheckDuplicateType']){case'always':return handleAlwaysCheckDuplicate(_0x31deed,_0xec2ca0,_0x353706,_0x1d4685);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x31deed,_0xec2ca0,_0x353706,_0x1d4685);default:return handleNeverCheckDuplicate(_0x31deed,_0xec2ca0,_0x353706);}});}function createHopperForVoiceQueues(_0x3e2fbd,_0x44b584){return _0x3e2fbd[_0x1fb2('0x7')][_0x1fb2('0x20')]({'where':{'type':_0x1fb2('0x21')},'attributes':['id','dialCheckDuplicateType',_0x1fb2('0xb')],'include':[{'model':_0x3e2fbd[_0x1fb2('0x22')],'as':_0x1fb2('0x23'),'where':{'id':_0x44b584['ListId']}}],'raw':!![]})['then'](function(_0x10a5f5){var _0x488e8a=_0x10a5f5[_0x1fb2('0x24')](function(_0x18cf88){return handleCheckDuplicate(_0x3e2fbd,_0x18cf88,_0x44b584,![]);});return Promise['all'](_0x488e8a);});}function createHopperForCampaigns(_0x30bc32,_0xbd1a98){return _0x30bc32['Campaign']['findAll']({'attributes':['id',_0x1fb2('0x25'),_0x1fb2('0xb')],'include':[{'model':_0x30bc32[_0x1fb2('0x22')],'as':_0x1fb2('0x23'),'where':{'id':_0xbd1a98['ListId']}}],'raw':!![]})[_0x1fb2('0xd')](function(_0x49d5ec){var _0x13ed80=_0x49d5ec[_0x1fb2('0x24')](function(_0x501f73){return handleCheckDuplicate(_0x30bc32,_0x501f73,_0xbd1a98,!![]);});return Promise[_0x1fb2('0x26')](_0x13ed80);});}function createHopperBlackForVoiceQueues(_0xc545ee,_0x1f09e6){return _0xc545ee['VoiceQueue'][_0x1fb2('0x20')]({'where':{'type':_0x1fb2('0x21')},'attributes':['id'],'include':[{'model':_0xc545ee['CmList'],'as':'BlackLists','where':{'id':_0x1f09e6[_0x1fb2('0x12')]}}],'raw':!![]})[_0x1fb2('0xd')](function(_0x415fe2){var _0x341c92=_0x415fe2[_0x1fb2('0x24')](function(_0x27062d){return _0xc545ee[_0x1fb2('0x27')][_0x1fb2('0x1d')]({'phone':_0x1f09e6[_0x1fb2('0x15')],'ContactId':_0x1f09e6['id'],'ListId':_0x1f09e6[_0x1fb2('0x12')],'VoiceQueueId':_0x27062d['id']});});return Promise[_0x1fb2('0x26')](_0x341c92);});}function createHopperBlackForCampaigns(_0x32c923,_0x456db2){return _0x32c923[_0x1fb2('0x6')][_0x1fb2('0x20')]({'attributes':['id'],'include':[{'model':_0x32c923[_0x1fb2('0x22')],'as':'BlackLists','where':{'id':_0x456db2[_0x1fb2('0x12')]}}],'raw':!![]})['then'](function(_0xec7fd0){var _0x5f36a6=_0xec7fd0[_0x1fb2('0x24')](function(_0x1c8c10){return _0x32c923[_0x1fb2('0x27')][_0x1fb2('0x1d')]({'phone':_0x456db2[_0x1fb2('0x15')],'ContactId':_0x456db2['id'],'ListId':_0x456db2[_0x1fb2('0x12')],'CampaignId':_0x1c8c10['id']});});return Promise[_0x1fb2('0x26')](_0x5f36a6);});}module[_0x1fb2('0x28')]=function(_0x5996b9){return _0x5996b9['define'](_0x1fb2('0x29'),attributes,{'tableName':_0x1fb2('0x2a'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':'fti_cm_contacts','fields':['firstName',_0x1fb2('0x2b'),_0x1fb2('0x15'),_0x1fb2('0x2c'),'fax',_0x1fb2('0x2d')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x1fb2('0x2e'),'collate':_0x1fb2('0x2f'),'hooks':{'afterCreate':function(_0x5e1fa1,_0x39b5c0,_0x448afd){var _0x208726=_0x5996b9[_0x1fb2('0x30')];var _0x23daf9=_0x5e1fa1[_0x1fb2('0x31')]({'plain':!![]});if(!_0x23daf9[_0x1fb2('0x12')]){logger['error'](_0x1fb2('0x32')+_0x23daf9['id']);return _0x448afd();}if(!_0x23daf9[_0x1fb2('0x15')]){return _0x448afd();}return createHopperForVoiceQueues(_0x208726,_0x23daf9)['then'](function(){return createHopperBlackForVoiceQueues(_0x208726,_0x23daf9);})[_0x1fb2('0xd')](function(){return createHopperForCampaigns(_0x208726,_0x23daf9);})[_0x1fb2('0xd')](function(){return createHopperBlackForCampaigns(_0x208726,_0x23daf9);})['then'](function(){return _0x448afd();})[_0x1fb2('0x33')](function(_0x43682b){logger[_0x1fb2('0x34')]('[cmContact][afterCreate]',_0x43682b[_0x1fb2('0x35')]);_0x448afd();});},'afterDestroy':function(_0x390602,_0x4e00ca,_0x20cc7a){var _0x49478f=_0x5996b9[_0x1fb2('0x30')];var _0x562654=_0x390602[_0x1fb2('0x31')]({'plain':!![]});return _0x49478f[_0x1fb2('0x1e')]['findAll']({'raw':!![],'where':{'ListId':_0x562654['ListId'],'ContactId':_0x562654['id']}})[_0x1fb2('0xd')](function(_0x110537){if(!_[_0x1fb2('0x36')](_0x110537)){var _0x5e6888=[];for(var _0x461678=0x0;_0x461678<_0x110537[_0x1fb2('0x37')];_0x461678+=0x1){var _0x3d0854=_0x49478f['CmHopper'][_0x1fb2('0x38')]({'where':{'ListId':_0x110537[_0x461678]['ListId'],'ContactId':_0x110537[_0x461678][_0x1fb2('0x39')],'VoiceQueueId':_0x110537[_0x461678][_0x1fb2('0x1c')],'CampaignId':_0x110537[_0x461678][_0x1fb2('0x1b')]}});_0x5e6888[_0x1fb2('0x3a')](_0x3d0854);}return Promise[_0x1fb2('0x26')](_0x5e6888);}})[_0x1fb2('0xd')](function(_0x3d068d){logger[_0x1fb2('0x3b')]('[CmContact][afterDestroy][Succesfull]',util[_0x1fb2('0x3c')](_0x3d068d,{'showHidden':![],'depth':null}));_0x20cc7a();})['catch'](function(_0x238d9a){logger[_0x1fb2('0x34')](_0x1fb2('0x3d'),util[_0x1fb2('0x3c')](_0x238d9a,{'showHidden':![],'depth':null}));_0x20cc7a(_0x238d9a);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 6909556..f3b9de4 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x39eecd,_0x4dccf4){var _0x15af88=function(_0x4a7e87){while(--_0x4a7e87){_0x39eecd['push'](_0x39eecd['shift']());}};_0x15af88(++_0x4dccf4);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x53662d,_0xc4ccc2){var _0x5d821b=function(_0x12aba0){while(--_0x12aba0){_0x53662d['push'](_0x53662d['shift']());}};_0x5d821b(++_0xc4ccc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 3fee399..5a573b2 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 _0x7b6b=['sequelize','INTEGER','STRING','PHONE'];(function(_0x3b6a4c,_0x121df3){var _0x7137c4=function(_0xcdf1a3){while(--_0xcdf1a3){_0x3b6a4c['push'](_0x3b6a4c['shift']());}};_0x7137c4(++_0x121df3);}(_0x7b6b,0xac));var _0xb7b6=function(_0x142956,_0x4e83c5){_0x142956=_0x142956-0x0;var _0x5d6d65=_0x7b6b[_0x142956];return _0x5d6d65;};'use strict';var Sequelize=require(_0xb7b6('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xb7b6('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb7b6('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb7b6('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xb7b6('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xb7b6('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xe920=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x1e7ec4,_0x34c4a1){var _0xbe679f=function(_0x5bb6f1){while(--_0x5bb6f1){_0x1e7ec4['push'](_0x1e7ec4['shift']());}};_0xbe679f(++_0x34c4a1);}(_0xe920,0xbe));var _0x0e92=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xe920[_0x3c487b];return _0x1d65f6;};'use strict';var Sequelize=require(_0x0e92('0x0'));module[_0x0e92('0x1')]={'CmContactId':{'type':Sequelize[_0x0e92('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0e92('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0e92('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0e92('0x3')],'defaultValue':_0x0e92('0x4')},'OrderBy':{'type':Sequelize[_0x0e92('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x0e92('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 4888507..1534a5f 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 _0x7f58=['key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','get','CmContactHasItems','UserProfileResource','stack','send','index','map','CmContactHasItem','fieldName','type'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x7f58,0x125));var _0x87f5=function(_0x508911,_0x231622){_0x508911=_0x508911-0x0;var _0x3ce3c0=_0x7f58[_0x508911];return _0x3ce3c0;};'use strict';var emlformat=require(_0x87f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87f5('0x1'));var rp=require('request-promise');var moment=require(_0x87f5('0x2'));var BPromise=require(_0x87f5('0x3'));var Mustache=require(_0x87f5('0x4'));var util=require(_0x87f5('0x5'));var path=require(_0x87f5('0x6'));var sox=require(_0x87f5('0x7'));var csv=require(_0x87f5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87f5('0x9'));var _=require('lodash');var squel=require(_0x87f5('0xa'));var crypto=require(_0x87f5('0xb'));var jsforce=require(_0x87f5('0xc'));var deskjs=require(_0x87f5('0xd'));var toCsv=require(_0x87f5('0x8'));var querystring=require('querystring');var Papa=require(_0x87f5('0xe'));var Redis=require(_0x87f5('0xf'));var authService=require(_0x87f5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x87f5('0x11'));var hardwareService=require(_0x87f5('0x12'));var logger=require(_0x87f5('0x13'))(_0x87f5('0x14'));var utils=require(_0x87f5('0x15'));var config=require(_0x87f5('0x16'));var licenseUtil=require(_0x87f5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a10e,_0x2f352d){_0x2f352d=_0x2f352d||0xcc;return function(_0x5623d8){if(_0x5623d8){return _0x42a10e[_0x87f5('0x18')](_0x2f352d);}return _0x42a10e[_0x87f5('0x19')](_0x2f352d)[_0x87f5('0x1a')]();};}function respondWithResult(_0x217620,_0x5367d1){_0x5367d1=_0x5367d1||0xc8;return function(_0x9289b){if(_0x9289b){return _0x217620['status'](_0x5367d1)[_0x87f5('0x1b')](_0x9289b);}};}function respondWithFilteredResult(_0x59329d,_0x157ab9){return function(_0xfa34d1){if(_0xfa34d1){var _0x3c33ee=typeof _0x157ab9[_0x87f5('0x1c')]===_0x87f5('0x1d')&&typeof _0x157ab9['limit']===_0x87f5('0x1d');var _0x3a5356=_0xfa34d1['count'];var _0x17eca6=_0x3c33ee?0x0:_0x157ab9[_0x87f5('0x1c')];var _0x22bbd4=_0x3c33ee?_0xfa34d1['count']:_0x157ab9[_0x87f5('0x1c')]+_0x157ab9[_0x87f5('0x1e')];var _0x4fd796;if(_0x22bbd4>=_0x3a5356){_0x22bbd4=_0x3a5356;_0x4fd796=0xc8;}else{_0x4fd796=0xce;}_0x59329d[_0x87f5('0x19')](_0x4fd796);return _0x59329d[_0x87f5('0x1f')](_0x87f5('0x20'),_0x17eca6+'-'+_0x22bbd4+'/'+_0x3a5356)[_0x87f5('0x1b')](_0xfa34d1);}return null;};}function patchUpdates(_0x3158b9){return function(_0x33c6a6){try{jsonpatch[_0x87f5('0x21')](_0x33c6a6,_0x3158b9,!![]);}catch(_0x4663bf){return BPromise[_0x87f5('0x22')](_0x4663bf);}return _0x33c6a6['save']();};}function saveUpdates(_0x911e26,_0x32b13d){return function(_0x339adf){if(_0x339adf){return _0x339adf['update'](_0x911e26)[_0x87f5('0x23')](function(_0x3fe766){return _0x3fe766;});}return null;};}function removeEntity(_0x242a7d,_0x4d7571){return function(_0x4c34c6){if(_0x4c34c6){return _0x4c34c6[_0x87f5('0x24')]()[_0x87f5('0x23')](function(){var _0x1337b3=_0x4c34c6[_0x87f5('0x25')]({'plain':!![]});var _0x431953=_0x87f5('0x26');return db[_0x87f5('0x27')]['destroy']({'where':{'type':_0x431953,'resourceId':_0x1337b3['id']}})[_0x87f5('0x23')](function(){return _0x4c34c6;});})['then'](function(){_0x242a7d[_0x87f5('0x19')](0xcc)[_0x87f5('0x1a')]();});}};}function handleEntityNotFound(_0x39120c,_0x3f6093){return function(_0x52b262){if(!_0x52b262){_0x39120c['sendStatus'](0x194);}return _0x52b262;};}function handleError(_0x18f841,_0x3dc0fd){_0x3dc0fd=_0x3dc0fd||0x1f4;return function(_0x4d716a){logger['error'](_0x4d716a[_0x87f5('0x28')]);if(_0x4d716a['name']){delete _0x4d716a['name'];}_0x18f841[_0x87f5('0x19')](_0x3dc0fd)[_0x87f5('0x29')](_0x4d716a);};}exports[_0x87f5('0x2a')]=function(_0x246e06,_0x2ffb95){var _0x1b6daa={},_0x210ca3={},_0x40d2c7={'count':0x0,'rows':[]};var _0x16fafc=_[_0x87f5('0x2b')](db[_0x87f5('0x2c')]['rawAttributes'],function(_0x2195c4){return{'name':_0x2195c4[_0x87f5('0x2d')],'type':_0x2195c4[_0x87f5('0x2e')][_0x87f5('0x2f')]};});_0x210ca3[_0x87f5('0x30')]=_[_0x87f5('0x2b')](_0x16fafc,_0x87f5('0x31'));_0x210ca3[_0x87f5('0x32')]=_[_0x87f5('0x33')](_0x246e06['query']);_0x210ca3[_0x87f5('0x34')]=_[_0x87f5('0x35')](_0x210ca3['model'],_0x210ca3[_0x87f5('0x32')]);_0x1b6daa[_0x87f5('0x36')]=_[_0x87f5('0x35')](_0x210ca3[_0x87f5('0x30')],qs[_0x87f5('0x37')](_0x246e06['query'][_0x87f5('0x37')]));_0x1b6daa[_0x87f5('0x36')]=_0x1b6daa[_0x87f5('0x36')]['length']?_0x1b6daa['attributes']:_0x210ca3['model'];if(!_0x246e06['query'][_0x87f5('0x38')]('nolimit')){_0x1b6daa['limit']=qs['limit'](_0x246e06['query'][_0x87f5('0x1e')]);_0x1b6daa[_0x87f5('0x1c')]=qs[_0x87f5('0x1c')](_0x246e06[_0x87f5('0x32')][_0x87f5('0x1c')]);}_0x1b6daa[_0x87f5('0x39')]=qs[_0x87f5('0x3a')](_0x246e06[_0x87f5('0x32')]['sort']);_0x1b6daa[_0x87f5('0x3b')]=qs['filters'](_['pick'](_0x246e06[_0x87f5('0x32')],_0x210ca3['filters']),_0x16fafc);if(_0x246e06[_0x87f5('0x32')][_0x87f5('0x3c')]){_0x1b6daa[_0x87f5('0x3b')]=_['merge'](_0x1b6daa[_0x87f5('0x3b')],{'$or':_[_0x87f5('0x2b')](_0x16fafc,function(_0x4a32f6){if(_0x4a32f6[_0x87f5('0x2e')]!==_0x87f5('0x3d')){var _0xb653dc={};_0xb653dc[_0x4a32f6[_0x87f5('0x31')]]={'$like':'%'+_0x246e06[_0x87f5('0x32')]['filter']+'%'};return _0xb653dc;}})});}_0x1b6daa=_[_0x87f5('0x3e')]({},_0x1b6daa,_0x246e06[_0x87f5('0x3f')]);var _0x3fd8da={'where':_0x1b6daa[_0x87f5('0x3b')]};return db[_0x87f5('0x2c')][_0x87f5('0x40')](_0x3fd8da)[_0x87f5('0x23')](function(_0x40a482){_0x40d2c7[_0x87f5('0x40')]=_0x40a482;if(_0x246e06[_0x87f5('0x32')][_0x87f5('0x41')]){_0x1b6daa[_0x87f5('0x42')]=[{'all':!![]}];}return db[_0x87f5('0x2c')][_0x87f5('0x43')](_0x1b6daa);})[_0x87f5('0x23')](function(_0x2021be){_0x40d2c7[_0x87f5('0x44')]=_0x2021be;return _0x40d2c7;})[_0x87f5('0x23')](respondWithFilteredResult(_0x2ffb95,_0x1b6daa))['catch'](handleError(_0x2ffb95,null));};exports[_0x87f5('0x45')]=function(_0x590756,_0x21dfd4){var _0x39e7ab={'raw':!![],'where':{'id':_0x590756[_0x87f5('0x46')]['id']}},_0x83dfa={};_0x83dfa[_0x87f5('0x30')]=_['keys'](db[_0x87f5('0x2c')][_0x87f5('0x47')]);_0x83dfa[_0x87f5('0x32')]=_[_0x87f5('0x33')](_0x590756[_0x87f5('0x32')]);_0x83dfa[_0x87f5('0x34')]=_['intersection'](_0x83dfa[_0x87f5('0x30')],_0x83dfa['query']);_0x39e7ab['attributes']=_[_0x87f5('0x35')](_0x83dfa[_0x87f5('0x30')],qs[_0x87f5('0x37')](_0x590756[_0x87f5('0x32')][_0x87f5('0x37')]));_0x39e7ab[_0x87f5('0x36')]=_0x39e7ab[_0x87f5('0x36')][_0x87f5('0x48')]?_0x39e7ab[_0x87f5('0x36')]:_0x83dfa['model'];if(_0x590756[_0x87f5('0x32')][_0x87f5('0x41')]){_0x39e7ab[_0x87f5('0x42')]=[{'all':!![]}];}_0x39e7ab=_['merge']({},_0x39e7ab,_0x590756[_0x87f5('0x3f')]);return db[_0x87f5('0x2c')][_0x87f5('0x49')](_0x39e7ab)[_0x87f5('0x23')](handleEntityNotFound(_0x21dfd4,null))[_0x87f5('0x23')](respondWithResult(_0x21dfd4,null))['catch'](handleError(_0x21dfd4,null));};exports[_0x87f5('0x4a')]=function(_0x4929da,_0x2056e8){return db[_0x87f5('0x2c')][_0x87f5('0x4a')](_0x4929da[_0x87f5('0x4b')],{})[_0x87f5('0x23')](function(_0x334765){var _0x17c578=_0x4929da['user'][_0x87f5('0x25')]({'plain':!![]});if(!_0x17c578)throw new Error(_0x87f5('0x4c'));if(_0x17c578[_0x87f5('0x4d')]===_0x87f5('0x4e')){var _0x42a844=_0x334765[_0x87f5('0x25')]({'plain':!![]});var _0x32b70f=_0x87f5('0x26');return db['UserProfileSection'][_0x87f5('0x49')]({'where':{'name':_0x32b70f,'userProfileId':_0x17c578[_0x87f5('0x4f')]},'raw':!![]})[_0x87f5('0x23')](function(_0xadd3e2){if(_0xadd3e2&&_0xadd3e2[_0x87f5('0x50')]===0x0){return db[_0x87f5('0x27')][_0x87f5('0x4a')]({'name':_0x42a844[_0x87f5('0x31')],'resourceId':_0x42a844['id'],'type':_0xadd3e2[_0x87f5('0x31')],'sectionId':_0xadd3e2['id']},{})['then'](function(){return _0x334765;});}else{return _0x334765;}})[_0x87f5('0x51')](function(_0x27a809){logger[_0x87f5('0x52')](_0x87f5('0x53'),_0x27a809);throw _0x27a809;});}return _0x334765;})[_0x87f5('0x23')](respondWithResult(_0x2056e8,0xc9))['catch'](handleError(_0x2056e8,null));};exports[_0x87f5('0x54')]=function(_0xeaf032,_0x1bd57c){if(_0xeaf032[_0x87f5('0x4b')]['id']){delete _0xeaf032[_0x87f5('0x4b')]['id'];}return db[_0x87f5('0x2c')]['find']({'where':{'id':_0xeaf032[_0x87f5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bd57c,null))['then'](saveUpdates(_0xeaf032[_0x87f5('0x4b')],null))[_0x87f5('0x23')](respondWithResult(_0x1bd57c,null))[_0x87f5('0x51')](handleError(_0x1bd57c,null));};exports['destroy']=function(_0x3a69cc,_0x24f071){return db[_0x87f5('0x2c')][_0x87f5('0x49')]({'where':{'id':_0x3a69cc[_0x87f5('0x46')]['id']}})[_0x87f5('0x23')](handleEntityNotFound(_0x24f071,null))[_0x87f5('0x23')](removeEntity(_0x24f071,null))[_0x87f5('0x51')](handleError(_0x24f071,null));}; \ No newline at end of file +var _0x6bac=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','map','CmContactHasItem','fieldName','type','key','model'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6bac,0x72));var _0xc6ba=function(_0x1d0da9,_0x4ced7c){_0x1d0da9=_0x1d0da9-0x0;var _0x1ec980=_0x6bac[_0x1d0da9];return _0x1ec980;};'use strict';var emlformat=require(_0xc6ba('0x0'));var rimraf=require(_0xc6ba('0x1'));var zipdir=require(_0xc6ba('0x2'));var jsonpatch=require(_0xc6ba('0x3'));var rp=require('request-promise');var moment=require(_0xc6ba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc6ba('0x5'));var sox=require(_0xc6ba('0x6'));var csv=require(_0xc6ba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6ba('0x8'));var _=require(_0xc6ba('0x9'));var squel=require(_0xc6ba('0xa'));var crypto=require(_0xc6ba('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6ba('0x7'));var querystring=require(_0xc6ba('0xc'));var Papa=require(_0xc6ba('0xd'));var Redis=require(_0xc6ba('0xe'));var authService=require(_0xc6ba('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc6ba('0x10'));var hardwareService=require(_0xc6ba('0x11'));var logger=require(_0xc6ba('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc6ba('0x13'));var licenseUtil=require(_0xc6ba('0x14'));var db=require(_0xc6ba('0x15'))['db'];function respondWithStatusCode(_0x546ad9,_0x1a95f1){_0x1a95f1=_0x1a95f1||0xcc;return function(_0x271a78){if(_0x271a78){return _0x546ad9['sendStatus'](_0x1a95f1);}return _0x546ad9[_0xc6ba('0x16')](_0x1a95f1)[_0xc6ba('0x17')]();};}function respondWithResult(_0x204217,_0x4b4308){_0x4b4308=_0x4b4308||0xc8;return function(_0x515e5f){if(_0x515e5f){return _0x204217[_0xc6ba('0x16')](_0x4b4308)[_0xc6ba('0x18')](_0x515e5f);}};}function respondWithFilteredResult(_0x2531ca,_0x28dd38){return function(_0x3e679a){if(_0x3e679a){var _0x71f9f0=typeof _0x28dd38[_0xc6ba('0x19')]===_0xc6ba('0x1a')&&typeof _0x28dd38['limit']===_0xc6ba('0x1a');var _0x3bb0d2=_0x3e679a[_0xc6ba('0x1b')];var _0x4bda7e=_0x71f9f0?0x0:_0x28dd38[_0xc6ba('0x19')];var _0x43426c=_0x71f9f0?_0x3e679a['count']:_0x28dd38[_0xc6ba('0x19')]+_0x28dd38[_0xc6ba('0x1c')];var _0x153f28;if(_0x43426c>=_0x3bb0d2){_0x43426c=_0x3bb0d2;_0x153f28=0xc8;}else{_0x153f28=0xce;}_0x2531ca['status'](_0x153f28);return _0x2531ca[_0xc6ba('0x1d')](_0xc6ba('0x1e'),_0x4bda7e+'-'+_0x43426c+'/'+_0x3bb0d2)[_0xc6ba('0x18')](_0x3e679a);}return null;};}function patchUpdates(_0x494f63){return function(_0xa9af61){try{jsonpatch[_0xc6ba('0x1f')](_0xa9af61,_0x494f63,!![]);}catch(_0x513893){return BPromise[_0xc6ba('0x20')](_0x513893);}return _0xa9af61[_0xc6ba('0x21')]();};}function saveUpdates(_0x49f869,_0x1f7ce2){return function(_0x14b0c1){if(_0x14b0c1){return _0x14b0c1['update'](_0x49f869)[_0xc6ba('0x22')](function(_0x21968f){return _0x21968f;});}return null;};}function removeEntity(_0x1c5952,_0xeb3123){return function(_0x474da8){if(_0x474da8){return _0x474da8[_0xc6ba('0x23')]()[_0xc6ba('0x22')](function(){var _0x2ec946=_0x474da8['get']({'plain':!![]});var _0x3acbfd='CmContactHasItems';return db[_0xc6ba('0x24')][_0xc6ba('0x23')]({'where':{'type':_0x3acbfd,'resourceId':_0x2ec946['id']}})[_0xc6ba('0x22')](function(){return _0x474da8;});})[_0xc6ba('0x22')](function(){_0x1c5952[_0xc6ba('0x16')](0xcc)[_0xc6ba('0x17')]();});}};}function handleEntityNotFound(_0x259f11,_0x191575){return function(_0x5a8241){if(!_0x5a8241){_0x259f11[_0xc6ba('0x25')](0x194);}return _0x5a8241;};}function handleError(_0x149542,_0x4417ff){_0x4417ff=_0x4417ff||0x1f4;return function(_0x4ee457){logger[_0xc6ba('0x26')](_0x4ee457[_0xc6ba('0x27')]);if(_0x4ee457['name']){delete _0x4ee457[_0xc6ba('0x28')];}_0x149542[_0xc6ba('0x16')](_0x4417ff)[_0xc6ba('0x29')](_0x4ee457);};}exports['index']=function(_0x3cc7e2,_0x98c080){var _0x4408a5={},_0x5f0228={},_0x562c85={'count':0x0,'rows':[]};var _0x301f7d=_[_0xc6ba('0x2a')](db[_0xc6ba('0x2b')]['rawAttributes'],function(_0x3d0bde){return{'name':_0x3d0bde[_0xc6ba('0x2c')],'type':_0x3d0bde[_0xc6ba('0x2d')][_0xc6ba('0x2e')]};});_0x5f0228[_0xc6ba('0x2f')]=_[_0xc6ba('0x2a')](_0x301f7d,'name');_0x5f0228[_0xc6ba('0x30')]=_[_0xc6ba('0x31')](_0x3cc7e2[_0xc6ba('0x30')]);_0x5f0228[_0xc6ba('0x32')]=_[_0xc6ba('0x33')](_0x5f0228[_0xc6ba('0x2f')],_0x5f0228[_0xc6ba('0x30')]);_0x4408a5[_0xc6ba('0x34')]=_[_0xc6ba('0x33')](_0x5f0228['model'],qs[_0xc6ba('0x35')](_0x3cc7e2[_0xc6ba('0x30')]['fields']));_0x4408a5[_0xc6ba('0x34')]=_0x4408a5[_0xc6ba('0x34')][_0xc6ba('0x36')]?_0x4408a5[_0xc6ba('0x34')]:_0x5f0228[_0xc6ba('0x2f')];if(!_0x3cc7e2[_0xc6ba('0x30')][_0xc6ba('0x37')](_0xc6ba('0x38'))){_0x4408a5[_0xc6ba('0x1c')]=qs[_0xc6ba('0x1c')](_0x3cc7e2[_0xc6ba('0x30')][_0xc6ba('0x1c')]);_0x4408a5['offset']=qs[_0xc6ba('0x19')](_0x3cc7e2[_0xc6ba('0x30')][_0xc6ba('0x19')]);}_0x4408a5['order']=qs[_0xc6ba('0x39')](_0x3cc7e2['query'][_0xc6ba('0x39')]);_0x4408a5['where']=qs[_0xc6ba('0x32')](_[_0xc6ba('0x3a')](_0x3cc7e2[_0xc6ba('0x30')],_0x5f0228[_0xc6ba('0x32')]),_0x301f7d);if(_0x3cc7e2['query'][_0xc6ba('0x3b')]){_0x4408a5[_0xc6ba('0x3c')]=_[_0xc6ba('0x3d')](_0x4408a5['where'],{'$or':_['map'](_0x301f7d,function(_0xea2bc3){if(_0xea2bc3[_0xc6ba('0x2d')]!==_0xc6ba('0x3e')){var _0x29041e={};_0x29041e[_0xea2bc3[_0xc6ba('0x28')]]={'$like':'%'+_0x3cc7e2[_0xc6ba('0x30')][_0xc6ba('0x3b')]+'%'};return _0x29041e;}})});}_0x4408a5=_[_0xc6ba('0x3d')]({},_0x4408a5,_0x3cc7e2[_0xc6ba('0x3f')]);var _0x5b4003={'where':_0x4408a5[_0xc6ba('0x3c')]};return db[_0xc6ba('0x2b')]['count'](_0x5b4003)[_0xc6ba('0x22')](function(_0x692b51){_0x562c85[_0xc6ba('0x1b')]=_0x692b51;if(_0x3cc7e2['query'][_0xc6ba('0x40')]){_0x4408a5['include']=[{'all':!![]}];}return db[_0xc6ba('0x2b')]['findAll'](_0x4408a5);})[_0xc6ba('0x22')](function(_0x4aaac9){_0x562c85[_0xc6ba('0x41')]=_0x4aaac9;return _0x562c85;})[_0xc6ba('0x22')](respondWithFilteredResult(_0x98c080,_0x4408a5))['catch'](handleError(_0x98c080,null));};exports[_0xc6ba('0x42')]=function(_0x89b09b,_0x6444c7){var _0x44bb66={'raw':!![],'where':{'id':_0x89b09b[_0xc6ba('0x43')]['id']}},_0x2cce3d={};_0x2cce3d['model']=_[_0xc6ba('0x31')](db[_0xc6ba('0x2b')][_0xc6ba('0x44')]);_0x2cce3d[_0xc6ba('0x30')]=_[_0xc6ba('0x31')](_0x89b09b[_0xc6ba('0x30')]);_0x2cce3d[_0xc6ba('0x32')]=_[_0xc6ba('0x33')](_0x2cce3d[_0xc6ba('0x2f')],_0x2cce3d[_0xc6ba('0x30')]);_0x44bb66[_0xc6ba('0x34')]=_[_0xc6ba('0x33')](_0x2cce3d[_0xc6ba('0x2f')],qs[_0xc6ba('0x35')](_0x89b09b[_0xc6ba('0x30')][_0xc6ba('0x35')]));_0x44bb66[_0xc6ba('0x34')]=_0x44bb66[_0xc6ba('0x34')]['length']?_0x44bb66['attributes']:_0x2cce3d['model'];if(_0x89b09b[_0xc6ba('0x30')][_0xc6ba('0x40')]){_0x44bb66[_0xc6ba('0x45')]=[{'all':!![]}];}_0x44bb66=_[_0xc6ba('0x3d')]({},_0x44bb66,_0x89b09b[_0xc6ba('0x3f')]);return db[_0xc6ba('0x2b')][_0xc6ba('0x46')](_0x44bb66)['then'](handleEntityNotFound(_0x6444c7,null))[_0xc6ba('0x22')](respondWithResult(_0x6444c7,null))[_0xc6ba('0x47')](handleError(_0x6444c7,null));};exports[_0xc6ba('0x48')]=function(_0x252f06,_0x5574c6){return db['CmContactHasItem'][_0xc6ba('0x48')](_0x252f06[_0xc6ba('0x49')],{})[_0xc6ba('0x22')](function(_0x458600){var _0x5de6d1=_0x252f06[_0xc6ba('0x4a')][_0xc6ba('0x4b')]({'plain':!![]});if(!_0x5de6d1)throw new Error(_0xc6ba('0x4c'));if(_0x5de6d1['role']==='user'){var _0x456de6=_0x458600[_0xc6ba('0x4b')]({'plain':!![]});var _0x4c8c8d=_0xc6ba('0x4d');return db[_0xc6ba('0x4e')][_0xc6ba('0x46')]({'where':{'name':_0x4c8c8d,'userProfileId':_0x5de6d1['userProfileId']},'raw':!![]})[_0xc6ba('0x22')](function(_0x2cb17d){if(_0x2cb17d&&_0x2cb17d[_0xc6ba('0x4f')]===0x0){return db[_0xc6ba('0x24')][_0xc6ba('0x48')]({'name':_0x456de6['name'],'resourceId':_0x456de6['id'],'type':_0x2cb17d[_0xc6ba('0x28')],'sectionId':_0x2cb17d['id']},{})[_0xc6ba('0x22')](function(){return _0x458600;});}else{return _0x458600;}})[_0xc6ba('0x47')](function(_0x23aa40){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23aa40);throw _0x23aa40;});}return _0x458600;})[_0xc6ba('0x22')](respondWithResult(_0x5574c6,0xc9))['catch'](handleError(_0x5574c6,null));};exports[_0xc6ba('0x50')]=function(_0x44a043,_0x57edb0){if(_0x44a043['body']['id']){delete _0x44a043[_0xc6ba('0x49')]['id'];}return db[_0xc6ba('0x2b')][_0xc6ba('0x46')]({'where':{'id':_0x44a043[_0xc6ba('0x43')]['id']}})[_0xc6ba('0x22')](handleEntityNotFound(_0x57edb0,null))[_0xc6ba('0x22')](saveUpdates(_0x44a043[_0xc6ba('0x49')],null))[_0xc6ba('0x22')](respondWithResult(_0x57edb0,null))[_0xc6ba('0x47')](handleError(_0x57edb0,null));};exports[_0xc6ba('0x23')]=function(_0x4e1ff9,_0x1a2251){return db[_0xc6ba('0x2b')][_0xc6ba('0x46')]({'where':{'id':_0x4e1ff9[_0xc6ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a2251,null))[_0xc6ba('0x22')](removeEntity(_0x1a2251,null))['catch'](handleError(_0x1a2251,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 7bc6c0a..368e3af 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 _0xbd84=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmContactHasItem.attributes','exports'];(function(_0x257579,_0x627180){var _0x1a329d=function(_0x27e1f8){while(--_0x27e1f8){_0x257579['push'](_0x257579['shift']());}};_0x1a329d(++_0x627180);}(_0xbd84,0xd3));var _0x4bd8=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xbd84[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x4bd8('0x0'));var util=require(_0x4bd8('0x1'));var logger=require(_0x4bd8('0x2'))(_0x4bd8('0x3'));var moment=require(_0x4bd8('0x4'));var BPromise=require('bluebird');var rp=require(_0x4bd8('0x5'));var fs=require('fs');var path=require(_0x4bd8('0x6'));var rimraf=require(_0x4bd8('0x7'));var config=require('../../config/environment');var attributes=require(_0x4bd8('0x8'));module[_0x4bd8('0x9')]=function(_0x55ca55,_0x190620){return _0x55ca55[_0x4bd8('0xa')](_0x4bd8('0xb'),attributes,{'tableName':_0x4bd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e72=['define','CmContactHasItem','cm_contact_has_items','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x291711,_0x32bd2b){var _0x4e9fc7=function(_0x420453){while(--_0x420453){_0x291711['push'](_0x291711['shift']());}};_0x4e9fc7(++_0x32bd2b);}(_0x3e72,0x6b));var _0x23e7=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x3e72[_0x46428c];return _0x16a677;};'use strict';var _=require(_0x23e7('0x0'));var util=require(_0x23e7('0x1'));var logger=require('../../config/logger')(_0x23e7('0x2'));var moment=require(_0x23e7('0x3'));var BPromise=require(_0x23e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23e7('0x5'));var rimraf=require(_0x23e7('0x6'));var config=require(_0x23e7('0x7'));var attributes=require(_0x23e7('0x8'));module[_0x23e7('0x9')]=function(_0x48927a,_0x4d53db){return _0x48927a[_0x23e7('0xa')](_0x23e7('0xb'),attributes,{'tableName':_0x23e7('0xc'),'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 9e952be..da26405 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 _0x3e26=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result'];(function(_0xfa4a79,_0x3fc1f2){var _0x6350eb=function(_0x55dc84){while(--_0x55dc84){_0xfa4a79['push'](_0xfa4a79['shift']());}};_0x6350eb(++_0x3fc1f2);}(_0x3e26,0x65));var _0x63e2=function(_0x14208e,_0x4f015b){_0x14208e=_0x14208e-0x0;var _0x55b4c8=_0x3e26[_0x14208e];return _0x55b4c8;};'use strict';var _=require(_0x63e2('0x0'));var util=require(_0x63e2('0x1'));var moment=require('moment');var BPromise=require(_0x63e2('0x2'));var rs=require(_0x63e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63e2('0x4'))['db'];var utils=require(_0x63e2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x63e2('0x6'));var jayson=require(_0x63e2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48907c,_0x3fec9a,_0x5f2261){return new BPromise(function(_0x1c1cc9,_0x39856e){return client[_0x63e2('0x8')](_0x48907c,_0x5f2261)['then'](function(_0x1cf223){logger[_0x63e2('0x9')]('CmContactHasItem,\x20%s,\x20%s',_0x3fec9a,'request\x20sent');logger[_0x63e2('0xa')](_0x63e2('0xb'),_0x3fec9a,_0x63e2('0xc'),JSON[_0x63e2('0xd')](_0x1cf223));if(_0x1cf223[_0x63e2('0xe')]){if(_0x1cf223['error'][_0x63e2('0xf')]===0x1f4){logger[_0x63e2('0xe')](_0x63e2('0x10'),_0x3fec9a,_0x1cf223['error'][_0x63e2('0x11')]);return _0x39856e(_0x1cf223['error'][_0x63e2('0x11')]);}logger[_0x63e2('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x3fec9a,_0x1cf223['error'][_0x63e2('0x11')]);return _0x1c1cc9(_0x1cf223[_0x63e2('0xe')]['message']);}else{logger[_0x63e2('0x9')](_0x63e2('0x10'),_0x3fec9a,_0x63e2('0xc'));_0x1c1cc9(_0x1cf223[_0x63e2('0x12')][_0x63e2('0x11')]);}})[_0x63e2('0x13')](function(_0x5bc7f4){logger[_0x63e2('0xe')](_0x63e2('0x10'),_0x3fec9a,_0x5bc7f4);_0x39856e(_0x5bc7f4);});});} \ No newline at end of file +var _0x1451=['catch','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0xf2fbb0,_0x3fb728){var _0x52d46f=function(_0xed341b){while(--_0xed341b){_0xf2fbb0['push'](_0xf2fbb0['shift']());}};_0x52d46f(++_0x3fb728);}(_0x1451,0xa1));var _0x1145=function(_0xbefd3c,_0xbc56f0){_0xbefd3c=_0xbefd3c-0x0;var _0x253ad5=_0x1451[_0xbefd3c];return _0x253ad5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1145('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1145('0x1'))['db'];var utils=require(_0x1145('0x2'));var logger=require(_0x1145('0x3'))(_0x1145('0x4'));var config=require('../../config/environment');var jayson=require(_0x1145('0x5'));var client=jayson[_0x1145('0x6')][_0x1145('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xfae597,_0x4508f5,_0x1dde88){return new BPromise(function(_0x40e4a7,_0x2efbfe){return client[_0x1145('0x8')](_0xfae597,_0x1dde88)[_0x1145('0x9')](function(_0xab9a75){logger[_0x1145('0xa')](_0x1145('0xb'),_0x4508f5,_0x1145('0xc'));logger[_0x1145('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4508f5,_0x1145('0xc'),JSON[_0x1145('0xe')](_0xab9a75));if(_0xab9a75[_0x1145('0xf')]){if(_0xab9a75[_0x1145('0xf')][_0x1145('0x10')]===0x1f4){logger[_0x1145('0xf')](_0x1145('0xb'),_0x4508f5,_0xab9a75[_0x1145('0xf')][_0x1145('0x11')]);return _0x2efbfe(_0xab9a75['error'][_0x1145('0x11')]);}logger['error'](_0x1145('0xb'),_0x4508f5,_0xab9a75['error'][_0x1145('0x11')]);return _0x40e4a7(_0xab9a75[_0x1145('0xf')][_0x1145('0x11')]);}else{logger[_0x1145('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x4508f5,_0x1145('0xc'));_0x40e4a7(_0xab9a75[_0x1145('0x12')][_0x1145('0x11')]);}})[_0x1145('0x13')](function(_0x54f87d){logger[_0x1145('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x4508f5,_0x54f87d);_0x2efbfe(_0x54f87d);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 71e45e0..e8c195f 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 _0xb4aa=['./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2e1af3,_0x2a077b){var _0x4150cd=function(_0x1e08f3){while(--_0x1e08f3){_0x2e1af3['push'](_0x2e1af3['shift']());}};_0x4150cd(++_0x2a077b);}(_0xb4aa,0x1db));var _0xab4a=function(_0x24433c,_0x39f91a){_0x24433c=_0x24433c-0x0;var _0x4f43c7=_0xb4aa[_0x24433c];return _0x4f43c7;};'use strict';var multer=require(_0xab4a('0x0'));var util=require(_0xab4a('0x1'));var path=require(_0xab4a('0x2'));var timeout=require(_0xab4a('0x3'));var express=require(_0xab4a('0x4'));var router=express[_0xab4a('0x5')]();var fs_extra=require(_0xab4a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab4a('0x7'));var controller=require(_0xab4a('0x8'));router[_0xab4a('0x9')]('/',auth[_0xab4a('0xa')](),controller[_0xab4a('0xb')]);router[_0xab4a('0x9')](_0xab4a('0xc'),auth[_0xab4a('0xa')](),controller[_0xab4a('0xd')]);router[_0xab4a('0xe')]('/',auth[_0xab4a('0xa')](),controller[_0xab4a('0xf')]);router[_0xab4a('0x10')](_0xab4a('0xc'),auth[_0xab4a('0xa')](),controller[_0xab4a('0x11')]);router[_0xab4a('0x12')]('/:id',auth[_0xab4a('0xa')](),controller[_0xab4a('0x13')]);module[_0xab4a('0x14')]=router; \ No newline at end of file +var _0xb4a0=['index','show','post','create','put','/:id','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x5d60d1,_0x325ad0){var _0x5e94a7=function(_0x40fb9c){while(--_0x40fb9c){_0x5d60d1['push'](_0x5d60d1['shift']());}};_0x5e94a7(++_0x325ad0);}(_0xb4a0,0x128));var _0x0b4a=function(_0x125fdd,_0x5d5949){_0x125fdd=_0x125fdd-0x0;var _0x3173c4=_0xb4a0[_0x125fdd];return _0x3173c4;};'use strict';var multer=require('multer');var util=require(_0x0b4a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0b4a('0x1'));var router=express[_0x0b4a('0x2')]();var fs_extra=require(_0x0b4a('0x3'));var auth=require(_0x0b4a('0x4'));var interaction=require(_0x0b4a('0x5'));var config=require(_0x0b4a('0x6'));var controller=require(_0x0b4a('0x7'));router[_0x0b4a('0x8')]('/',auth[_0x0b4a('0x9')](),controller[_0x0b4a('0xa')]);router['get']('/:id',auth[_0x0b4a('0x9')](),controller[_0x0b4a('0xb')]);router[_0x0b4a('0xc')]('/',auth[_0x0b4a('0x9')](),controller[_0x0b4a('0xd')]);router[_0x0b4a('0xe')](_0x0b4a('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0b4a('0xf'),auth['isAuthenticated'](),controller[_0x0b4a('0x10')]);module[_0x0b4a('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9e1d2f3..124841c 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 _0x9210=['alias','STRING','setDataValue','getDataValue','name','select','parse','values','isArray','stringify','BOOLEAN','lodash','exports','VIRTUAL'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x9210,0x123));var _0x0921=function(_0x5e2302,_0x82c61b){_0x5e2302=_0x5e2302-0x0;var _0x595cc1=_0x9210[_0x5e2302];return _0x595cc1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0921('0x0'));module[_0x0921('0x1')]={'name':{'type':Sequelize[_0x0921('0x2')],'get':function(_0x365319){return this['getDataValue'](_0x0921('0x3'));}},'alias':{'type':Sequelize[_0x0921('0x4')],'allowNull':![],'set':function(_0x4192c0){this[_0x0921('0x5')](_0x0921('0x3'),_0x4192c0?_0x4192c0:this[_0x0921('0x6')](_0x0921('0x7')));}},'type':{'type':Sequelize[_0x0921('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x0921('0x6')]('type')===_0x0921('0x8')){return JSON[_0x0921('0x9')](this[_0x0921('0x6')](_0x0921('0xa')));}else{return this[_0x0921('0x6')](_0x0921('0xa'));}},'set':function(_0x460bb1){if(Array[_0x0921('0xb')](_0x460bb1)){this[_0x0921('0x5')]('values',JSON[_0x0921('0xc')](_0x460bb1));}else{this[_0x0921('0x5')](_0x0921('0xa'),_0x460bb1);}}},'required':{'type':Sequelize[_0x0921('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0921('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x75d0=['select','getDataValue','values','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','TEXT'];(function(_0x1ed2c0,_0x25f838){var _0x454831=function(_0x1eddbd){while(--_0x1eddbd){_0x1ed2c0['push'](_0x1ed2c0['shift']());}};_0x454831(++_0x25f838);}(_0x75d0,0x1e2));var _0x075d=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x75d0[_0x54ccd7];return _0x4e667b;};'use strict';var Sequelize=require(_0x075d('0x0'));var _=require(_0x075d('0x1'));module[_0x075d('0x2')]={'name':{'type':Sequelize[_0x075d('0x3')],'get':function(_0x18dbd8){return this['getDataValue'](_0x075d('0x4'));}},'alias':{'type':Sequelize[_0x075d('0x5')],'allowNull':![],'set':function(_0x4713dc){this[_0x075d('0x6')](_0x075d('0x4'),_0x4713dc?_0x4713dc:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x075d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x075d('0x7')]('long'),'get':function(){if(this['getDataValue']('type')===_0x075d('0x8')){return JSON['parse'](this[_0x075d('0x9')]('values'));}else{return this['getDataValue'](_0x075d('0xa'));}},'set':function(_0x159978){if(Array['isArray'](_0x159978)){this[_0x075d('0x6')](_0x075d('0xa'),JSON[_0x075d('0xb')](_0x159978));}else{this[_0x075d('0x6')](_0x075d('0xa'),_0x159978);}}},'required':{'type':Sequelize[_0x075d('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x075d('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ab45867..4667750 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 _0xb4c4=['BOOLEAN','defaultValue','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','then','end','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER'];(function(_0x42cf6b,_0x18de6e){var _0x18aacf=function(_0x1d6193){while(--_0x1d6193){_0x42cf6b['push'](_0x42cf6b['shift']());}};_0x18aacf(++_0x18de6e);}(_0xb4c4,0x147));var _0x4b4c=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xb4c4[_0x3bd52b];return _0x1e5b89;};'use strict';var emlformat=require(_0x4b4c('0x0'));var rimraf=require(_0x4b4c('0x1'));var zipdir=require(_0x4b4c('0x2'));var jsonpatch=require(_0x4b4c('0x3'));var rp=require(_0x4b4c('0x4'));var moment=require('moment');var BPromise=require(_0x4b4c('0x5'));var Mustache=require(_0x4b4c('0x6'));var util=require(_0x4b4c('0x7'));var path=require('path');var sox=require(_0x4b4c('0x8'));var csv=require(_0x4b4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b4c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b4c('0xb'));var jsforce=require(_0x4b4c('0xc'));var deskjs=require(_0x4b4c('0xd'));var toCsv=require(_0x4b4c('0x9'));var querystring=require('querystring');var Papa=require(_0x4b4c('0xe'));var Redis=require(_0x4b4c('0xf'));var authService=require(_0x4b4c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4b4c('0x11'));var hardwareService=require(_0x4b4c('0x12'));var logger=require(_0x4b4c('0x13'))(_0x4b4c('0x14'));var utils=require(_0x4b4c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b4c('0x16'))['db'];function respondWithStatusCode(_0x86f4ee,_0x3787ed){_0x3787ed=_0x3787ed||0xcc;return function(_0x2d1db4){if(_0x2d1db4){return _0x86f4ee[_0x4b4c('0x17')](_0x3787ed);}return _0x86f4ee['status'](_0x3787ed)['end']();};}function respondWithResult(_0x2692c9,_0x109052){_0x109052=_0x109052||0xc8;return function(_0x8837cc){if(_0x8837cc){return _0x2692c9[_0x4b4c('0x18')](_0x109052)[_0x4b4c('0x19')](_0x8837cc);}};}function respondWithFilteredResult(_0xcd160a,_0x4c05aa){return function(_0x45a1e0){if(_0x45a1e0){var _0x422b4f=typeof _0x4c05aa[_0x4b4c('0x1a')]===_0x4b4c('0x1b')&&typeof _0x4c05aa[_0x4b4c('0x1c')]===_0x4b4c('0x1b');var _0x51421d=_0x45a1e0['count'];var _0x2c0c1d=_0x422b4f?0x0:_0x4c05aa[_0x4b4c('0x1a')];var _0xaf1b19=_0x422b4f?_0x45a1e0[_0x4b4c('0x1d')]:_0x4c05aa[_0x4b4c('0x1a')]+_0x4c05aa[_0x4b4c('0x1c')];var _0x399d8c;if(_0xaf1b19>=_0x51421d){_0xaf1b19=_0x51421d;_0x399d8c=0xc8;}else{_0x399d8c=0xce;}_0xcd160a[_0x4b4c('0x18')](_0x399d8c);return _0xcd160a['set']('Content-Range',_0x2c0c1d+'-'+_0xaf1b19+'/'+_0x51421d)[_0x4b4c('0x19')](_0x45a1e0);}return null;};}function patchUpdates(_0x25140e){return function(_0x22ce3e){try{jsonpatch[_0x4b4c('0x1e')](_0x22ce3e,_0x25140e,!![]);}catch(_0x2e457a){return BPromise[_0x4b4c('0x1f')](_0x2e457a);}return _0x22ce3e['save']();};}function saveUpdates(_0x34b0ab,_0xbd397){return function(_0xedc99a){if(_0xedc99a){return _0xedc99a['update'](_0x34b0ab)[_0x4b4c('0x20')](function(_0x2a71cf){return _0x2a71cf;});}return null;};}function removeEntity(_0x2762ac,_0x5f5736){return function(_0x23d0d3){if(_0x23d0d3){return _0x23d0d3['destroy']()['then'](function(){_0x2762ac[_0x4b4c('0x18')](0xcc)[_0x4b4c('0x21')]();});}};}function handleEntityNotFound(_0x5cbe9d,_0x3245c2){return function(_0x19aa3a){if(!_0x19aa3a){_0x5cbe9d['sendStatus'](0x194);}return _0x19aa3a;};}function handleError(_0x21a9b0,_0x4c39db){_0x4c39db=_0x4c39db||0x1f4;return function(_0x9b417){logger[_0x4b4c('0x22')](_0x9b417[_0x4b4c('0x23')]);if(_0x9b417[_0x4b4c('0x24')]){delete _0x9b417[_0x4b4c('0x24')];}_0x21a9b0[_0x4b4c('0x18')](_0x4c39db)['send'](_0x9b417);};}exports[_0x4b4c('0x25')]=function(_0x23acef,_0x50075f){var _0x234c7d={},_0x3fb291={},_0x333b6b={'count':0x0,'rows':[]};var _0x4dfac9=_[_0x4b4c('0x26')](db[_0x4b4c('0x27')][_0x4b4c('0x28')],function(_0x1dc19d){return{'name':_0x1dc19d[_0x4b4c('0x29')],'type':_0x1dc19d['type'][_0x4b4c('0x2a')]};});_0x3fb291[_0x4b4c('0x2b')]=_['differenceBy'](_[_0x4b4c('0x26')](_0x4dfac9,'name'),[_0x4b4c('0x24')]);_0x3fb291[_0x4b4c('0x2c')]=_[_0x4b4c('0x2d')](_0x23acef[_0x4b4c('0x2c')]);_0x3fb291[_0x4b4c('0x2e')]=_['intersection'](_0x3fb291[_0x4b4c('0x2b')],_0x3fb291[_0x4b4c('0x2c')]);_0x234c7d['attributes']=_[_0x4b4c('0x2f')](_0x3fb291['model'],qs['fields'](_0x23acef['query'][_0x4b4c('0x30')]));_0x234c7d[_0x4b4c('0x31')]=_0x234c7d[_0x4b4c('0x31')][_0x4b4c('0x32')]?_0x234c7d[_0x4b4c('0x31')]:_0x3fb291[_0x4b4c('0x2b')];if(!_0x23acef[_0x4b4c('0x2c')][_0x4b4c('0x33')](_0x4b4c('0x34'))){_0x234c7d['limit']=qs[_0x4b4c('0x1c')](_0x23acef[_0x4b4c('0x2c')][_0x4b4c('0x1c')]);_0x234c7d[_0x4b4c('0x1a')]=qs[_0x4b4c('0x1a')](_0x23acef[_0x4b4c('0x2c')][_0x4b4c('0x1a')]);}_0x234c7d['order']=qs['sort'](_0x23acef[_0x4b4c('0x2c')]['sort']);_0x234c7d[_0x4b4c('0x35')]=qs[_0x4b4c('0x2e')](_[_0x4b4c('0x36')](_0x23acef['query'],_0x3fb291[_0x4b4c('0x2e')]),_0x4dfac9);if(_0x23acef['query'][_0x4b4c('0x37')]){_0x234c7d[_0x4b4c('0x35')]=_[_0x4b4c('0x38')](_0x234c7d['where'],{'$or':_[_0x4b4c('0x26')](_0x4dfac9,function(_0x3e9bdf){if(_0x3e9bdf[_0x4b4c('0x39')]!=='VIRTUAL'){var _0xc42aff={};_0xc42aff[_0x3e9bdf[_0x4b4c('0x24')]]={'$like':'%'+_0x23acef['query'][_0x4b4c('0x37')]+'%'};return _0xc42aff;}})});}_0x234c7d=_[_0x4b4c('0x38')]({},_0x234c7d,_0x23acef[_0x4b4c('0x3a')]);var _0x58b070={'where':_0x234c7d[_0x4b4c('0x35')]};return db[_0x4b4c('0x27')][_0x4b4c('0x1d')](_0x58b070)[_0x4b4c('0x20')](function(_0x27062d){_0x333b6b[_0x4b4c('0x1d')]=_0x27062d;if(_0x23acef[_0x4b4c('0x2c')][_0x4b4c('0x3b')]){_0x234c7d[_0x4b4c('0x3c')]=[{'all':!![]}];}return db[_0x4b4c('0x27')][_0x4b4c('0x3d')](_0x234c7d);})['then'](function(_0x54811e){_0x333b6b[_0x4b4c('0x3e')]=_0x54811e;return _0x333b6b;})['then'](respondWithFilteredResult(_0x50075f,_0x234c7d))[_0x4b4c('0x3f')](handleError(_0x50075f,null));};exports[_0x4b4c('0x40')]=function(_0x121c76,_0x2748a7){var _0x3cd229={'raw':!![],'where':{'id':_0x121c76[_0x4b4c('0x41')]['id']}},_0x229415={};_0x229415[_0x4b4c('0x2b')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x229415[_0x4b4c('0x2c')]=_[_0x4b4c('0x2d')](_0x121c76[_0x4b4c('0x2c')]);_0x229415[_0x4b4c('0x2e')]=_['intersection'](_0x229415['model'],_0x229415[_0x4b4c('0x2c')]);_0x3cd229[_0x4b4c('0x31')]=_[_0x4b4c('0x2f')](_0x229415[_0x4b4c('0x2b')],qs[_0x4b4c('0x30')](_0x121c76[_0x4b4c('0x2c')]['fields']));_0x3cd229[_0x4b4c('0x31')]=_0x3cd229[_0x4b4c('0x31')]['length']?_0x3cd229['attributes']:_0x229415[_0x4b4c('0x2b')];if(_0x121c76['query'][_0x4b4c('0x3b')]){_0x3cd229['include']=[{'all':!![]}];}_0x3cd229=_[_0x4b4c('0x38')]({},_0x3cd229,_0x121c76[_0x4b4c('0x3a')]);return db[_0x4b4c('0x27')][_0x4b4c('0x42')](_0x3cd229)[_0x4b4c('0x20')](handleEntityNotFound(_0x2748a7,null))[_0x4b4c('0x20')](respondWithResult(_0x2748a7,null))[_0x4b4c('0x3f')](handleError(_0x2748a7,null));};exports[_0x4b4c('0x43')]=function(_0x20abb1,_0x189af4){if(_0x20abb1['body']['id']){delete _0x20abb1[_0x4b4c('0x44')]['id'];}return db[_0x4b4c('0x27')][_0x4b4c('0x42')]({'where':{'id':_0x20abb1[_0x4b4c('0x41')]['id']}})[_0x4b4c('0x20')](handleEntityNotFound(_0x189af4,null))[_0x4b4c('0x20')](saveUpdates(_0x20abb1[_0x4b4c('0x44')],null))[_0x4b4c('0x20')](respondWithResult(_0x189af4,null))['catch'](handleError(_0x189af4,null));};exports[_0x4b4c('0x45')]=function(_0x40e25f,_0x4585bc){return db[_0x4b4c('0x27')]['find']({'where':{'id':_0x40e25f[_0x4b4c('0x41')]['id']}})[_0x4b4c('0x20')](handleEntityNotFound(_0x4585bc,null))[_0x4b4c('0x20')](removeEntity(_0x4585bc,null))[_0x4b4c('0x3f')](handleError(_0x4585bc,null));};exports[_0x4b4c('0x46')]=function(_0x4c7632,_0x5447b6){var _0x4e9f30;return db[_0x4b4c('0x47')][_0x4b4c('0x48')](function(_0x1869a2){return db[_0x4b4c('0x27')][_0x4b4c('0x46')](_0x4c7632['body'],{'transaction':_0x1869a2})[_0x4b4c('0x20')](function(_0x276386){_0x4e9f30=_0x276386;var _0x46bc1f={'type':db[_0x4b4c('0x49')][_0x4b4c('0x4a')],'transaction':_0x1869a2};switch(_0x4c7632[_0x4b4c('0x44')]['type']){case _0x4b4c('0x4b'):_0x46bc1f[_0x4b4c('0x39')]=db[_0x4b4c('0x49')]['TEXT'];break;case _0x4b4c('0x4c'):_0x46bc1f[_0x4b4c('0x39')]=db[_0x4b4c('0x49')][_0x4b4c('0x4d')];break;case'switch':_0x46bc1f[_0x4b4c('0x39')]=db['Sequelize'][_0x4b4c('0x4e')];_0x46bc1f[_0x4b4c('0x4f')]=![];break;default:}return db[_0x4b4c('0x47')]['queryInterface']['addColumn'](_0x4b4c('0x50'),util['format']('cf_%d',_0x4e9f30['id']),_0x46bc1f);})['then'](function(){return _0x4e9f30;});})[_0x4b4c('0x20')](respondWithResult(_0x5447b6,0xc9))['catch'](handleError(_0x5447b6,null));}; \ No newline at end of file +var _0xa17d=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','include','findAll','rows','catch','show','params','includeAll','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','model','keys'];(function(_0x5d7a4b,_0x1fb438){var _0x154f4d=function(_0x29c95a){while(--_0x29c95a){_0x5d7a4b['push'](_0x5d7a4b['shift']());}};_0x154f4d(++_0x1fb438);}(_0xa17d,0x79));var _0xda17=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xa17d[_0x1f7413];return _0x2d2775;};'use strict';var emlformat=require(_0xda17('0x0'));var rimraf=require(_0xda17('0x1'));var zipdir=require(_0xda17('0x2'));var jsonpatch=require(_0xda17('0x3'));var rp=require('request-promise');var moment=require(_0xda17('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xda17('0x5'));var sox=require('sox');var csv=require(_0xda17('0x6'));var ejs=require(_0xda17('0x7'));var fs=require('fs');var fs_extra=require(_0xda17('0x8'));var _=require(_0xda17('0x9'));var squel=require(_0xda17('0xa'));var crypto=require(_0xda17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xda17('0xc'));var toCsv=require(_0xda17('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xda17('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xda17('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda17('0xf'))(_0xda17('0x10'));var utils=require(_0xda17('0x11'));var config=require(_0xda17('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xda17('0x13'))['db'];function respondWithStatusCode(_0x55ef69,_0x4e8b29){_0x4e8b29=_0x4e8b29||0xcc;return function(_0x5bf959){if(_0x5bf959){return _0x55ef69[_0xda17('0x14')](_0x4e8b29);}return _0x55ef69['status'](_0x4e8b29)[_0xda17('0x15')]();};}function respondWithResult(_0x43403b,_0x516617){_0x516617=_0x516617||0xc8;return function(_0x16869c){if(_0x16869c){return _0x43403b['status'](_0x516617)[_0xda17('0x16')](_0x16869c);}};}function respondWithFilteredResult(_0x37850d,_0x552996){return function(_0xa6808e){if(_0xa6808e){var _0x1d5b74=typeof _0x552996[_0xda17('0x17')]===_0xda17('0x18')&&typeof _0x552996['limit']==='undefined';var _0x29d2d9=_0xa6808e[_0xda17('0x19')];var _0x2af800=_0x1d5b74?0x0:_0x552996[_0xda17('0x17')];var _0x2726b0=_0x1d5b74?_0xa6808e[_0xda17('0x19')]:_0x552996['offset']+_0x552996[_0xda17('0x1a')];var _0x4d8e24;if(_0x2726b0>=_0x29d2d9){_0x2726b0=_0x29d2d9;_0x4d8e24=0xc8;}else{_0x4d8e24=0xce;}_0x37850d['status'](_0x4d8e24);return _0x37850d[_0xda17('0x1b')](_0xda17('0x1c'),_0x2af800+'-'+_0x2726b0+'/'+_0x29d2d9)[_0xda17('0x16')](_0xa6808e);}return null;};}function patchUpdates(_0x579c1e){return function(_0x368c10){try{jsonpatch['apply'](_0x368c10,_0x579c1e,!![]);}catch(_0x1677d9){return BPromise[_0xda17('0x1d')](_0x1677d9);}return _0x368c10[_0xda17('0x1e')]();};}function saveUpdates(_0x3a5f33,_0x1ed362){return function(_0x19d80c){if(_0x19d80c){return _0x19d80c[_0xda17('0x1f')](_0x3a5f33)[_0xda17('0x20')](function(_0x2f599b){return _0x2f599b;});}return null;};}function removeEntity(_0x23f007,_0x4ac3d3){return function(_0x2020e7){if(_0x2020e7){return _0x2020e7[_0xda17('0x21')]()['then'](function(){_0x23f007['status'](0xcc)[_0xda17('0x15')]();});}};}function handleEntityNotFound(_0xb4f9e3,_0xa34ecf){return function(_0x45f41c){if(!_0x45f41c){_0xb4f9e3[_0xda17('0x14')](0x194);}return _0x45f41c;};}function handleError(_0x4725ec,_0x374622){_0x374622=_0x374622||0x1f4;return function(_0x43405e){logger[_0xda17('0x22')](_0x43405e[_0xda17('0x23')]);if(_0x43405e[_0xda17('0x24')]){delete _0x43405e['name'];}_0x4725ec['status'](_0x374622)[_0xda17('0x25')](_0x43405e);};}exports[_0xda17('0x26')]=function(_0x3d2d9d,_0xc2ff9c){var _0xa14807={},_0x1aabe6={},_0x458d5f={'count':0x0,'rows':[]};var _0x15daba=_[_0xda17('0x27')](db[_0xda17('0x28')][_0xda17('0x29')],function(_0x2626d0){return{'name':_0x2626d0[_0xda17('0x2a')],'type':_0x2626d0['type']['key']};});_0x1aabe6[_0xda17('0x2b')]=_['differenceBy'](_[_0xda17('0x27')](_0x15daba,'name'),[_0xda17('0x24')]);_0x1aabe6['query']=_[_0xda17('0x2c')](_0x3d2d9d[_0xda17('0x2d')]);_0x1aabe6[_0xda17('0x2e')]=_[_0xda17('0x2f')](_0x1aabe6[_0xda17('0x2b')],_0x1aabe6['query']);_0xa14807[_0xda17('0x30')]=_[_0xda17('0x2f')](_0x1aabe6['model'],qs[_0xda17('0x31')](_0x3d2d9d[_0xda17('0x2d')][_0xda17('0x31')]));_0xa14807[_0xda17('0x30')]=_0xa14807[_0xda17('0x30')][_0xda17('0x32')]?_0xa14807['attributes']:_0x1aabe6[_0xda17('0x2b')];if(!_0x3d2d9d[_0xda17('0x2d')][_0xda17('0x33')](_0xda17('0x34'))){_0xa14807[_0xda17('0x1a')]=qs[_0xda17('0x1a')](_0x3d2d9d['query'][_0xda17('0x1a')]);_0xa14807[_0xda17('0x17')]=qs[_0xda17('0x17')](_0x3d2d9d[_0xda17('0x2d')][_0xda17('0x17')]);}_0xa14807[_0xda17('0x35')]=qs[_0xda17('0x36')](_0x3d2d9d[_0xda17('0x2d')][_0xda17('0x36')]);_0xa14807[_0xda17('0x37')]=qs['filters'](_['pick'](_0x3d2d9d[_0xda17('0x2d')],_0x1aabe6[_0xda17('0x2e')]),_0x15daba);if(_0x3d2d9d[_0xda17('0x2d')][_0xda17('0x38')]){_0xa14807[_0xda17('0x37')]=_[_0xda17('0x39')](_0xa14807[_0xda17('0x37')],{'$or':_[_0xda17('0x27')](_0x15daba,function(_0x37bad7){if(_0x37bad7[_0xda17('0x3a')]!=='VIRTUAL'){var _0x3b51a7={};_0x3b51a7[_0x37bad7[_0xda17('0x24')]]={'$like':'%'+_0x3d2d9d[_0xda17('0x2d')]['filter']+'%'};return _0x3b51a7;}})});}_0xa14807=_['merge']({},_0xa14807,_0x3d2d9d[_0xda17('0x3b')]);var _0x5de19c={'where':_0xa14807[_0xda17('0x37')]};return db[_0xda17('0x28')][_0xda17('0x19')](_0x5de19c)[_0xda17('0x20')](function(_0x529080){_0x458d5f[_0xda17('0x19')]=_0x529080;if(_0x3d2d9d[_0xda17('0x2d')]['includeAll']){_0xa14807[_0xda17('0x3c')]=[{'all':!![]}];}return db['CmCustomField'][_0xda17('0x3d')](_0xa14807);})['then'](function(_0x58dd3e){_0x458d5f[_0xda17('0x3e')]=_0x58dd3e;return _0x458d5f;})['then'](respondWithFilteredResult(_0xc2ff9c,_0xa14807))[_0xda17('0x3f')](handleError(_0xc2ff9c,null));};exports[_0xda17('0x40')]=function(_0x1ec7f4,_0x3d26e8){var _0x36da01={'raw':!![],'where':{'id':_0x1ec7f4[_0xda17('0x41')]['id']}},_0x1f87ba={};_0x1f87ba[_0xda17('0x2b')]=_['keys'](db[_0xda17('0x28')][_0xda17('0x29')]);_0x1f87ba[_0xda17('0x2d')]=_['keys'](_0x1ec7f4[_0xda17('0x2d')]);_0x1f87ba[_0xda17('0x2e')]=_['intersection'](_0x1f87ba[_0xda17('0x2b')],_0x1f87ba[_0xda17('0x2d')]);_0x36da01[_0xda17('0x30')]=_[_0xda17('0x2f')](_0x1f87ba['model'],qs[_0xda17('0x31')](_0x1ec7f4[_0xda17('0x2d')][_0xda17('0x31')]));_0x36da01[_0xda17('0x30')]=_0x36da01[_0xda17('0x30')][_0xda17('0x32')]?_0x36da01[_0xda17('0x30')]:_0x1f87ba[_0xda17('0x2b')];if(_0x1ec7f4[_0xda17('0x2d')][_0xda17('0x42')]){_0x36da01[_0xda17('0x3c')]=[{'all':!![]}];}_0x36da01=_[_0xda17('0x39')]({},_0x36da01,_0x1ec7f4[_0xda17('0x3b')]);return db[_0xda17('0x28')][_0xda17('0x43')](_0x36da01)[_0xda17('0x20')](handleEntityNotFound(_0x3d26e8,null))[_0xda17('0x20')](respondWithResult(_0x3d26e8,null))['catch'](handleError(_0x3d26e8,null));};exports[_0xda17('0x1f')]=function(_0x15e527,_0x58695b){if(_0x15e527['body']['id']){delete _0x15e527[_0xda17('0x44')]['id'];}return db[_0xda17('0x28')][_0xda17('0x43')]({'where':{'id':_0x15e527[_0xda17('0x41')]['id']}})['then'](handleEntityNotFound(_0x58695b,null))[_0xda17('0x20')](saveUpdates(_0x15e527[_0xda17('0x44')],null))[_0xda17('0x20')](respondWithResult(_0x58695b,null))[_0xda17('0x3f')](handleError(_0x58695b,null));};exports[_0xda17('0x21')]=function(_0x2e6cea,_0xca2e61){return db['CmCustomField'][_0xda17('0x43')]({'where':{'id':_0x2e6cea[_0xda17('0x41')]['id']}})[_0xda17('0x20')](handleEntityNotFound(_0xca2e61,null))[_0xda17('0x20')](removeEntity(_0xca2e61,null))[_0xda17('0x3f')](handleError(_0xca2e61,null));};exports[_0xda17('0x45')]=function(_0x5a6379,_0x6b7116){var _0xe059d3;return db[_0xda17('0x46')][_0xda17('0x47')](function(_0x730683){return db[_0xda17('0x28')][_0xda17('0x45')](_0x5a6379[_0xda17('0x44')],{'transaction':_0x730683})[_0xda17('0x20')](function(_0x52f06a){_0xe059d3=_0x52f06a;var _0x451bf6={'type':db[_0xda17('0x48')][_0xda17('0x49')],'transaction':_0x730683};switch(_0x5a6379['body'][_0xda17('0x3a')]){case _0xda17('0x4a'):_0x451bf6[_0xda17('0x3a')]=db[_0xda17('0x48')][_0xda17('0x49')];break;case _0xda17('0x4b'):_0x451bf6['type']=db[_0xda17('0x48')][_0xda17('0x4c')];break;case'switch':_0x451bf6[_0xda17('0x3a')]=db[_0xda17('0x48')][_0xda17('0x4d')];_0x451bf6[_0xda17('0x4e')]=![];break;default:}return db['sequelize']['queryInterface'][_0xda17('0x4f')](_0xda17('0x50'),util[_0xda17('0x51')](_0xda17('0x52'),_0xe059d3['id']),_0x451bf6);})[_0xda17('0x20')](function(){return _0xe059d3;});})[_0xda17('0x20')](respondWithResult(_0x6b7116,0xc9))['catch'](handleError(_0x6b7116,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8f9a73c..3b9bf6c 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 _0xb977=['api','moment','request-promise','rimraf','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x1c0b7c,_0x29c88b){var _0x113efd=function(_0x38efba){while(--_0x38efba){_0x1c0b7c['push'](_0x1c0b7c['shift']());}};_0x113efd(++_0x29c88b);}(_0xb977,0x11b));var _0x7b97=function(_0x5c414d,_0xba6280){_0x5c414d=_0x5c414d-0x0;var _0xf7095a=_0xb977[_0x5c414d];return _0xf7095a;};'use strict';var _=require(_0x7b97('0x0'));var util=require(_0x7b97('0x1'));var logger=require(_0x7b97('0x2'))(_0x7b97('0x3'));var moment=require(_0x7b97('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b97('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b97('0x6'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x7b97('0x7')]=function(_0x46c8c9,_0x29133a){return _0x46c8c9[_0x7b97('0x8')](_0x7b97('0x9'),attributes,{'tableName':_0x7b97('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65cd=['request-promise','path','rimraf','../../config/environment','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3164a6,_0x1fa6a4){var _0x4589ca=function(_0x3c99f9){while(--_0x3c99f9){_0x3164a6['push'](_0x3164a6['shift']());}};_0x4589ca(++_0x1fa6a4);}(_0x65cd,0x11d));var _0xd65c=function(_0x4008de,_0x15f2e9){_0x4008de=_0x4008de-0x0;var _0x596738=_0x65cd[_0x4008de];return _0x596738;};'use strict';var _=require(_0xd65c('0x0'));var util=require('util');var logger=require(_0xd65c('0x1'))(_0xd65c('0x2'));var moment=require(_0xd65c('0x3'));var BPromise=require(_0xd65c('0x4'));var rp=require(_0xd65c('0x5'));var fs=require('fs');var path=require(_0xd65c('0x6'));var rimraf=require(_0xd65c('0x7'));var config=require(_0xd65c('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x706ab1,_0x3cbf19){return _0x706ab1[_0xd65c('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 3a1db56..dbfb288 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 _0x77de=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x526d66,_0x2b2036){var _0x2527ea=function(_0x37bbad){while(--_0x37bbad){_0x526d66['push'](_0x526d66['shift']());}};_0x2527ea(++_0x2b2036);}(_0x77de,0x1d0));var _0xe77d=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x77de[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0xe77d('0x0'));var util=require(_0xe77d('0x1'));var moment=require(_0xe77d('0x2'));var BPromise=require(_0xe77d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe77d('0x4'));var db=require(_0xe77d('0x5'))['db'];var utils=require(_0xe77d('0x6'));var logger=require(_0xe77d('0x7'))(_0xe77d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe77d('0x9')][_0xe77d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528337,_0x9d4d28,_0x252918){return new BPromise(function(_0xcc5d1f,_0x42be92){return client[_0xe77d('0xb')](_0x528337,_0x252918)[_0xe77d('0xc')](function(_0x52e21d){logger[_0xe77d('0xd')](_0xe77d('0xe'),_0x9d4d28,_0xe77d('0xf'));logger[_0xe77d('0x10')](_0xe77d('0x11'),_0x9d4d28,_0xe77d('0xf'),JSON[_0xe77d('0x12')](_0x52e21d));if(_0x52e21d['error']){if(_0x52e21d['error']['code']===0x1f4){logger['error'](_0xe77d('0xe'),_0x9d4d28,_0x52e21d[_0xe77d('0x13')][_0xe77d('0x14')]);return _0x42be92(_0x52e21d[_0xe77d('0x13')][_0xe77d('0x14')]);}logger[_0xe77d('0x13')](_0xe77d('0xe'),_0x9d4d28,_0x52e21d[_0xe77d('0x13')][_0xe77d('0x14')]);return _0xcc5d1f(_0x52e21d['error']['message']);}else{logger[_0xe77d('0xd')]('CmCustomField,\x20%s,\x20%s',_0x9d4d28,_0xe77d('0xf'));_0xcc5d1f(_0x52e21d[_0xe77d('0x15')]['message']);}})[_0xe77d('0x16')](function(_0x4665e6){logger[_0xe77d('0x13')](_0xe77d('0xe'),_0x9d4d28,_0x4665e6);_0x42be92(_0x4665e6);});});} \ No newline at end of file +var _0xc0b3=['../../config/utils','rpc','../../config/environment','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x392274,_0x512cc1){var _0x12bdad=function(_0x5edd50){while(--_0x5edd50){_0x392274['push'](_0x392274['shift']());}};_0x12bdad(++_0x512cc1);}(_0xc0b3,0xea));var _0x3c0b=function(_0x39beb0,_0x542c24){_0x39beb0=_0x39beb0-0x0;var _0x58d92e=_0xc0b3[_0x39beb0];return _0x58d92e;};'use strict';var _=require('lodash');var util=require(_0x3c0b('0x0'));var moment=require(_0x3c0b('0x1'));var BPromise=require(_0x3c0b('0x2'));var rs=require(_0x3c0b('0x3'));var fs=require('fs');var Redis=require(_0x3c0b('0x4'));var db=require(_0x3c0b('0x5'))['db'];var utils=require(_0x3c0b('0x6'));var logger=require('../../config/logger')(_0x3c0b('0x7'));var config=require(_0x3c0b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3c0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8f35de,_0x65d115,_0x3b1ae9){return new BPromise(function(_0x310075,_0x4c0cef){return client['request'](_0x8f35de,_0x3b1ae9)[_0x3c0b('0xa')](function(_0x39fd76){logger[_0x3c0b('0xb')](_0x3c0b('0xc'),_0x65d115,_0x3c0b('0xd'));logger[_0x3c0b('0xe')](_0x3c0b('0xf'),_0x65d115,_0x3c0b('0xd'),JSON[_0x3c0b('0x10')](_0x39fd76));if(_0x39fd76[_0x3c0b('0x11')]){if(_0x39fd76[_0x3c0b('0x11')]['code']===0x1f4){logger[_0x3c0b('0x11')](_0x3c0b('0xc'),_0x65d115,_0x39fd76[_0x3c0b('0x11')]['message']);return _0x4c0cef(_0x39fd76[_0x3c0b('0x11')][_0x3c0b('0x12')]);}logger['error'](_0x3c0b('0xc'),_0x65d115,_0x39fd76[_0x3c0b('0x11')][_0x3c0b('0x12')]);return _0x310075(_0x39fd76[_0x3c0b('0x11')][_0x3c0b('0x12')]);}else{logger[_0x3c0b('0xb')](_0x3c0b('0xc'),_0x65d115,_0x3c0b('0xd'));_0x310075(_0x39fd76['result'][_0x3c0b('0x12')]);}})[_0x3c0b('0x13')](function(_0x58856b){logger[_0x3c0b('0x11')](_0x3c0b('0xc'),_0x65d115,_0x58856b);_0x4c0cef(_0x58856b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2720743..c86cc5a 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 _0x1782=['../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service'];(function(_0x44cce7,_0x542e50){var _0x5f1a56=function(_0x584ac2){while(--_0x584ac2){_0x44cce7['push'](_0x44cce7['shift']());}};_0x5f1a56(++_0x542e50);}(_0x1782,0x188));var _0x2178=function(_0x23e36d,_0x502fe1){_0x23e36d=_0x23e36d-0x0;var _0x639868=_0x1782[_0x23e36d];return _0x639868;};'use strict';var multer=require('multer');var util=require(_0x2178('0x0'));var path=require(_0x2178('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2178('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2178('0x3'));var interaction=require(_0x2178('0x4'));var config=require('../../config/environment');var controller=require(_0x2178('0x5'));router['get']('/',auth[_0x2178('0x6')](),controller[_0x2178('0x7')]);router[_0x2178('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2178('0x9')]);router[_0x2178('0xa')]('/',auth[_0x2178('0x6')](),controller[_0x2178('0xb')]);router[_0x2178('0xc')](_0x2178('0xd'),auth['isAuthenticated'](),controller[_0x2178('0xe')]);router[_0x2178('0xf')](_0x2178('0xd'),auth['isAuthenticated'](),controller[_0x2178('0x10')]);module[_0x2178('0x11')]=router; \ No newline at end of file +var _0x5735=['update','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x489876,_0x27f8cb){var _0x45de84=function(_0x1d3e0c){while(--_0x1d3e0c){_0x489876['push'](_0x489876['shift']());}};_0x45de84(++_0x27f8cb);}(_0x5735,0x16a));var _0x5573=function(_0x1cc325,_0x537298){_0x1cc325=_0x1cc325-0x0;var _0x33d644=_0x5735[_0x1cc325];return _0x33d644;};'use strict';var multer=require(_0x5573('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5573('0x1'));var express=require(_0x5573('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5573('0x3'));var config=require(_0x5573('0x4'));var controller=require(_0x5573('0x5'));router[_0x5573('0x6')]('/',auth['isAuthenticated'](),controller[_0x5573('0x7')]);router[_0x5573('0x6')](_0x5573('0x8'),auth[_0x5573('0x9')](),controller[_0x5573('0xa')]);router[_0x5573('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5573('0xc')](_0x5573('0x8'),auth[_0x5573('0x9')](),controller[_0x5573('0xd')]);router['delete']('/:id',auth[_0x5573('0x9')](),controller['destroy']);module[_0x5573('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c6fc87b..a2b49eb 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 _0x963a=['INTEGER','DATE','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','format'];(function(_0x73ac3a,_0x443ce2){var _0xc1cc02=function(_0x2e2ce1){while(--_0x2e2ce1){_0x73ac3a['push'](_0x73ac3a['shift']());}};_0xc1cc02(++_0x443ce2);}(_0x963a,0xf7));var _0xa963=function(_0x490f48,_0x1bf549){_0x490f48=_0x490f48-0x0;var _0x3deda7=_0x963a[_0x490f48];return _0x3deda7;};'use strict';var moment=require('moment');var Sequelize=require(_0xa963('0x0'));module[_0xa963('0x1')]={'phone':{'type':Sequelize[_0xa963('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa963('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xa963('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa963('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa963('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa963('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa963('0x6')]},'priority':{'type':Sequelize[_0xa963('0x5')](0x2)[_0xa963('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa963('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa963('0x5')],'unique':_0xa963('0x8')},'ListId':{'type':Sequelize[_0xa963('0x5')],'unique':_0xa963('0x8')},'UserId':{'type':Sequelize[_0xa963('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa963('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa963('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa963('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa963('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa963('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa963('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xa963('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xe133=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x36fba5,_0x434e11){var _0x3a348d=function(_0x3334ce){while(--_0x3334ce){_0x36fba5['push'](_0x36fba5['shift']());}};_0x3a348d(++_0x434e11);}(_0xe133,0x127));var _0x3e13=function(_0x302017,_0x146c48){_0x302017=_0x302017-0x0;var _0x239385=_0xe133[_0x302017];return _0x239385;};'use strict';var moment=require(_0x3e13('0x0'));var Sequelize=require(_0x3e13('0x1'));module[_0x3e13('0x2')]={'phone':{'type':Sequelize[_0x3e13('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x3e13('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3e13('0x5')](_0x3e13('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3e13('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3e13('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3e13('0x8')]},'priority':{'type':Sequelize[_0x3e13('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3e13('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3e13('0x7')],'unique':_0x3e13('0x9')},'ListId':{'type':Sequelize[_0x3e13('0x7')],'unique':_0x3e13('0x9')},'UserId':{'type':Sequelize[_0x3e13('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x3e13('0x7')],'unique':_0x3e13('0x9')},'CampaignId':{'type':Sequelize[_0x3e13('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3e13('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3e13('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3e13('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3e13('0x8')],'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 651a9eb..c14c457 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 _0xc949=['$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','Contact','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','index','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat'];(function(_0x3a1ff5,_0x4c7476){var _0x50345d=function(_0xa95e6e){while(--_0xa95e6e){_0x3a1ff5['push'](_0x3a1ff5['shift']());}};_0x50345d(++_0x4c7476);}(_0xc949,0x181));var _0x9c94=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc949[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0x9c94('0x0'));var _=require('lodash');var qs=require(_0x9c94('0x1'));var logger=require(_0x9c94('0x2'))(_0x9c94('0x3'));var shared=require(_0x9c94('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x11a56c,_0x231762){_0x231762=_0x231762||0xc8;return function(_0x528a17){if(_0x528a17){return _0x11a56c[_0x9c94('0x5')](_0x231762)[_0x9c94('0x6')](_0x528a17);}};}function respondWithFilteredResult(_0x46d560,_0x1357ac){return function(_0x57fcd7){if(_0x57fcd7){var _0xf373e=typeof _0x1357ac[_0x9c94('0x7')]===_0x9c94('0x8')&&typeof _0x1357ac[_0x9c94('0x9')]===_0x9c94('0x8');var _0x423e62=_0x57fcd7[_0x9c94('0xa')];var _0x454b16=_0xf373e?0x0:_0x1357ac[_0x9c94('0x7')];var _0x3287f8=_0xf373e?_0x57fcd7['count']:_0x1357ac[_0x9c94('0x7')]+_0x1357ac[_0x9c94('0x9')];var _0x14c4ae;if(_0x3287f8>=_0x423e62){_0x3287f8=_0x423e62;_0x14c4ae=0xc8;}else{_0x14c4ae=0xce;}_0x46d560[_0x9c94('0x5')](_0x14c4ae);return _0x46d560[_0x9c94('0xb')](_0x9c94('0xc'),_0x454b16+'-'+_0x3287f8+'/'+_0x423e62)[_0x9c94('0x6')](_0x57fcd7);}return null;};}function saveUpdates(_0x423adb,_0x30f64e){return function(_0x1e326f){if(_0x1e326f){return _0x1e326f[_0x9c94('0xd')](_0x423adb)[_0x9c94('0xe')](function(_0x369d70){return _0x369d70;});}return null;};}function handleEntityNotFound(_0x15c51c,_0x54d956){return function(_0x9789bc){if(!_0x9789bc){_0x15c51c['sendStatus'](0x194);}return _0x9789bc;};}function handleError(_0x3d3de5,_0x26e629){_0x26e629=_0x26e629||0x1f4;return function(_0x4f0013){logger[_0x9c94('0xf')](_0x4f0013['stack']);if(_0x4f0013['name']){delete _0x4f0013[_0x9c94('0x10')];}_0x3d3de5['status'](_0x26e629)[_0x9c94('0x11')](_0x4f0013);};}exports[_0x9c94('0x12')]=function(_0x4d9266,_0x201e04){var _0x367eed={},_0x412804={},_0x3b825e={'count':0x0,'rows':[]};var _0x16ef2c=_[_0x9c94('0x13')](db[_0x9c94('0x14')]['rawAttributes'],function(_0x2c9736){return{'name':_0x2c9736[_0x9c94('0x15')],'type':_0x2c9736['type'][_0x9c94('0x16')]};});_0x412804[_0x9c94('0x17')]=_[_0x9c94('0x13')](_0x16ef2c,_0x9c94('0x10'));_0x412804[_0x9c94('0x18')]=_[_0x9c94('0x19')](_0x4d9266[_0x9c94('0x18')]);_0x412804[_0x9c94('0x1a')]=_[_0x9c94('0x1b')](_0x412804[_0x9c94('0x17')],_0x412804[_0x9c94('0x18')]);_0x412804[_0x9c94('0x1a')]=_[_0x9c94('0x1c')](_0x412804[_0x9c94('0x1a')],['$and',_0x9c94('0x1d'),_0x9c94('0x1e'),'$gte',_0x9c94('0x1f'),_0x9c94('0x20'),_0x9c94('0x21'),_0x9c94('0x22'),_0x9c94('0x23'),'$between',_0x9c94('0x24'),_0x9c94('0x25'),'$notIn',_0x9c94('0x26'),'$notLike',_0x9c94('0x27'),_0x9c94('0x28'),_0x9c94('0x26'),_0x9c94('0x29'),_0x9c94('0x2a'),_0x9c94('0x2b'),_0x9c94('0x2c')]);_0x367eed['attributes']=_['intersection'](_0x412804[_0x9c94('0x17')],qs[_0x9c94('0x2d')](_0x4d9266[_0x9c94('0x18')]['fields']));_0x367eed[_0x9c94('0x2e')]=_0x367eed['attributes'][_0x9c94('0x2f')]?_0x367eed[_0x9c94('0x2e')]:_0x412804[_0x9c94('0x17')];if(!_0x4d9266['query']['hasOwnProperty'](_0x9c94('0x30'))){_0x367eed[_0x9c94('0x9')]=qs[_0x9c94('0x9')](_0x4d9266['query']['limit']);_0x367eed['offset']=qs['offset'](_0x4d9266[_0x9c94('0x18')]['offset']);}_0x367eed[_0x9c94('0x31')]=qs[_0x9c94('0x32')](_0x4d9266['query']['sort']);_0x367eed[_0x9c94('0x33')]=qs[_0x9c94('0x1a')](_[_0x9c94('0x34')](_0x4d9266[_0x9c94('0x18')],_0x412804[_0x9c94('0x1a')]),_0x16ef2c);if(_0x4d9266[_0x9c94('0x18')][_0x9c94('0x35')]){_0x367eed[_0x9c94('0x33')]=_[_0x9c94('0x36')](_0x367eed[_0x9c94('0x33')],{'$or':_[_0x9c94('0x13')](_0x16ef2c,function(_0x44392f){if(_0x44392f[_0x9c94('0x37')]!==_0x9c94('0x38')){var _0x3060e8={};_0x3060e8[_0x44392f[_0x9c94('0x10')]]={'$like':'%'+_0x4d9266[_0x9c94('0x18')][_0x9c94('0x35')]+'%'};return _0x3060e8;}})});}_0x367eed=_['merge']({},_0x367eed,_0x4d9266[_0x9c94('0x39')]);var _0x230685={'where':_0x367eed[_0x9c94('0x33')]};return db[_0x9c94('0x14')][_0x9c94('0xa')](_0x230685)[_0x9c94('0xe')](function(_0x13f94c){_0x3b825e['count']=_0x13f94c;if(_0x4d9266[_0x9c94('0x18')]['includeAll']){_0x367eed[_0x9c94('0x3a')]=[{'all':!![]}];}return db[_0x9c94('0x14')][_0x9c94('0x3b')](_0x367eed);})[_0x9c94('0xe')](function(_0x4b2c4e){_0x3b825e[_0x9c94('0x3c')]=_0x4b2c4e;return _0x3b825e;})['then'](respondWithFilteredResult(_0x201e04,_0x367eed))[_0x9c94('0x3d')](handleError(_0x201e04,null));};exports[_0x9c94('0x3e')]=function(_0x3912f0,_0x5e3119){var _0x21e9f7={'raw':!![],'where':{'id':_0x3912f0[_0x9c94('0x3f')]['id']}},_0x4d4dc0={};_0x4d4dc0['model']=_['keys'](db[_0x9c94('0x14')][_0x9c94('0x40')]);_0x4d4dc0[_0x9c94('0x18')]=_[_0x9c94('0x19')](_0x3912f0['query']);_0x4d4dc0[_0x9c94('0x1a')]=_[_0x9c94('0x1b')](_0x4d4dc0[_0x9c94('0x17')],_0x4d4dc0[_0x9c94('0x18')]);_0x21e9f7['attributes']=_[_0x9c94('0x1b')](_0x4d4dc0[_0x9c94('0x17')],qs['fields'](_0x3912f0[_0x9c94('0x18')][_0x9c94('0x2d')]));_0x21e9f7[_0x9c94('0x2e')]=_0x21e9f7['attributes']['length']?_0x21e9f7[_0x9c94('0x2e')]:_0x4d4dc0[_0x9c94('0x17')];if(_0x3912f0[_0x9c94('0x18')][_0x9c94('0x41')]){_0x21e9f7[_0x9c94('0x3a')]=[{'all':!![]}];}_0x21e9f7=_[_0x9c94('0x36')]({},_0x21e9f7,_0x3912f0[_0x9c94('0x39')]);return db[_0x9c94('0x14')][_0x9c94('0x42')](_0x21e9f7)[_0x9c94('0xe')](handleEntityNotFound(_0x5e3119,null))[_0x9c94('0xe')](respondWithResult(_0x5e3119,null))['catch'](handleError(_0x5e3119,null));};exports[_0x9c94('0x43')]=function(_0x5647f9,_0x4ae326){return db[_0x9c94('0x14')][_0x9c94('0x43')](_0x5647f9[_0x9c94('0x44')],{})[_0x9c94('0xe')](respondWithResult(_0x4ae326,0xc9))[_0x9c94('0x3d')](handleError(_0x4ae326,null));};exports[_0x9c94('0xd')]=function(_0x4aeabc,_0x5665d2){if(_0x4aeabc[_0x9c94('0x44')]['id']){delete _0x4aeabc[_0x9c94('0x44')]['id'];}return db[_0x9c94('0x14')]['find']({'where':{'id':_0x4aeabc[_0x9c94('0x3f')]['id']}})[_0x9c94('0xe')](handleEntityNotFound(_0x5665d2,null))['then'](saveUpdates(_0x4aeabc['body'],null))['then'](respondWithResult(_0x5665d2,null))['catch'](handleError(_0x5665d2,null));};exports[_0x9c94('0x45')]=function(_0x5362f4,_0x5ccc46){return db[_0x9c94('0x14')]['describe']()[_0x9c94('0xe')](respondWithResult(_0x5ccc46,null))[_0x9c94('0x3d')](handleError(_0x5ccc46,null));};exports[_0x9c94('0x46')]=function(_0x205f51,_0x22eaa4){var _0x5ae40c;var _0x33ccef=_0x205f51[_0x9c94('0x3f')]['id'];return db[_0x9c94('0x14')][_0x9c94('0x42')]({'where':{'id':_0x205f51[_0x9c94('0x3f')]['id']}})[_0x9c94('0xe')](handleEntityNotFound(_0x22eaa4,null))['then'](function(_0x44311e){if(_0x44311e){return _0x44311e['destroy']()[_0x9c94('0xe')](function(_0x38bb48){return _0x38bb48;});}})[_0x9c94('0xe')](function(_0x48d368){_0x5ae40c=_0x48d368;if(_0x48d368){if(_0x48d368[_0x9c94('0x47')]||_0x48d368[_0x9c94('0x48')]){return db[_0x48d368['VoiceQueueId']?_0x9c94('0x49'):'Campaign'][_0x9c94('0x42')]({'where':{'id':_0x48d368[_0x9c94('0x47')]?_0x48d368['VoiceQueueId']:_0x48d368['CampaignId']},'attributes':['id',_0x9c94('0x10')],'raw':!![]});}}})['then'](function(_0x472107){var _0x3f8448={};if(_0x472107){_[_0x9c94('0x36')](_0x3f8448,_[_0x9c94('0x4a')](_0x5ae40c['dataValues'],[_0x9c94('0x4b'),_0x9c94('0x4c'),'id']));_0x3f8448['state']=0x15;_0x3f8448['statedesc']=_0x9c94('0x4d');_0x3f8448[_0x9c94('0x4e')]=_0x472107[_0x9c94('0x10')];_0x3f8448[_0x9c94('0x4f')]=_0x205f51[_0x9c94('0x50')][_0x9c94('0x10')];_0x3f8448['UserId']=_0x205f51[_0x9c94('0x50')]['id'];_0x3f8448[_0x9c94('0x4d')]=!![];_0x3f8448[_0x9c94('0x51')]=moment()[_0x9c94('0x52')](_0x9c94('0x53'));_0x3f8448[_0x9c94('0x54')]=_0x5ae40c['phone'];_0x3f8448[_0x9c94('0x55')]=_0x5ae40c['VoiceQueueId']?_0x9c94('0x56'):_0x9c94('0x57');return db[_0x9c94('0x58')]['find']({'where':{'id':_0x3f8448[_0x9c94('0x59')]},'attributes':['firstName','lastName']})[_0x9c94('0xe')](function(_0x3b88be){if(!_['isNil'](_0x22eaa4)&&!_[_0x9c94('0x5a')](_0x3b88be[_0x9c94('0x5b')])){_0x3f8448[_0x9c94('0x5c')]=_0x3b88be[_0x9c94('0x5b')];if(!_[_0x9c94('0x5a')](_0x3b88be[_0x9c94('0x5d')])){_0x3f8448[_0x9c94('0x5c')]+='\x20'+_0x3b88be[_0x9c94('0x5d')];}}})[_0x9c94('0x5e')](function(){return db[_0x9c94('0x5f')][_0x9c94('0x43')](_0x3f8448);});}})['then'](function(_0x481a11){return db[_0x9c94('0x60')][_0x9c94('0x46')]({'where':{'CmHopperId':_0x33ccef}});})['then'](function(){return _0x22eaa4[_0x9c94('0x5')](0xcc)[_0x9c94('0x61')]();})[_0x9c94('0x3d')](handleError(_0x22eaa4,null));};exports[_0x9c94('0x62')]=function(_0x249759,_0xd5674b){var _0x4f3f89=[];return db['CmContact']['describe']()[_0x9c94('0xe')](function(_0x5c2ea2){_0x4f3f89=_['keys'](_0x5c2ea2);return _0x249759[_0x9c94('0x50')][_0x9c94('0x63')]({'where':{'type':_0x9c94('0x64'),'dialActive':!![],'dialMethod':_0x9c94('0x65')},'attributes':['id',_0x9c94('0x66'),_0x9c94('0x67')],'raw':!![]});})['then'](function(_0x2a8a97){if(_0x2a8a97&&_0x2a8a97['length']){return db[_0x9c94('0x68')][_0x9c94('0x69')](function(_0x5b4e1a){var _0x1e3e42={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9c94('0x52')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9c94('0x13')](_0x2a8a97,'id')},'$or':[{'UserId':null},{'UserId':_0x249759[_0x9c94('0x50')]['id']}]};var _0x364450={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a8a97)[_0x9c94('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x9c94('0x13')]('id')[_0x9c94('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x249759['user']['id']}]};var _0x5b68ac={'$or':[_0x1e3e42,_0x364450]};var _0xf8b2ec=[];if(_0x249759[_0x9c94('0x44')][_0x9c94('0x6b')]&&_0x249759['body']['direction']===_0x9c94('0x6c')){if(!_[_0x9c94('0x6d')](_0x249759[_0x9c94('0x44')]['hopperIds'])){_0x5b68ac['id']={'$in':_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')]};}_0xf8b2ec=[[_0x9c94('0x6f'),_0x9c94('0x70')],[_0x9c94('0x71'),_0x2a8a97[0x0][_0x9c94('0x66')]==='ASC'?_0x9c94('0x72'):_0x9c94('0x70')],db[_0x9c94('0x68')][_0x9c94('0x73')](_0x9c94('0x74')),['id',_0x9c94('0x72')]];}else{if(!_[_0x9c94('0x6d')](_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')])){_0x5b68ac['id']={'$notIn':_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')]};}_0xf8b2ec=[['priority','DESC'],[_0x9c94('0x71'),_0x2a8a97[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal'](_0x9c94('0x75')),['id',_0x9c94('0x70')]];}return db['CmHopper'][_0x9c94('0x76')]({'attributes':['id',_0x9c94('0x77'),_0x9c94('0x78'),_0x9c94('0x79')],'where':_0x5b68ac,'order':_0xf8b2ec,'transaction':_0x5b4e1a,'lock':_0x5b4e1a[_0x9c94('0x7a')]['UPDATE'],'include':[{'model':db[_0x9c94('0x58')],'as':'Contact','attributes':_0x4f3f89,'include':[{'model':db[_0x9c94('0x7b')],'as':_0x9c94('0x7c'),'attributes':['id',_0x9c94('0x10')]}]},{'model':db[_0x9c94('0x7d')],'as':_0x9c94('0x7e'),'attributes':['id',_0x9c94('0x10')]},{'model':db[_0x9c94('0x49')],'as':_0x9c94('0x7f'),'attributes':['id',_0x9c94('0x10'),_0x9c94('0x80')]}]})[_0x9c94('0xe')](function(_0x540996){if(_0x540996){return _0x540996[_0x9c94('0xd')]({'UserId':_0x249759[_0x9c94('0x50')]['id']},{'transaction':_0x5b4e1a});}});});}})[_0x9c94('0xe')](handleEntityNotFound(_0xd5674b,null))['then'](respondWithResult(_0xd5674b,null))[_0x9c94('0x3d')](handleError(_0xd5674b,null));};exports[_0x9c94('0x81')]=function(_0x324b1f,_0x18dd23,_0xc6d42c){var _0x66483b=[];var _0x13988a=_0x324b1f['params']['id'];var _0x1dcfaa=_0x324b1f[_0x9c94('0x50')]['id'];return db[_0x9c94('0x58')]['describe']()[_0x9c94('0xe')](function(_0x59ef88){_0x66483b=_[_0x9c94('0x19')](_0x59ef88);return db[_0x9c94('0x68')]['transaction'](function(_0x3fa6be){const _0x1b0eac={'id':_0x13988a};return db[_0x9c94('0x14')][_0x9c94('0x76')]({'attributes':['id',_0x9c94('0x77'),_0x9c94('0x79')],'where':_0x1b0eac,'transaction':_0x3fa6be,'lock':_0x3fa6be['LOCK']['UPDATE'],'include':[{'model':db[_0x9c94('0x58')],'as':_0x9c94('0x82'),'attributes':_0x66483b,'include':[{'model':db[_0x9c94('0x7b')],'as':'Company','attributes':['id',_0x9c94('0x10')]}]},{'model':db[_0x9c94('0x7d')],'as':_0x9c94('0x7e'),'attributes':['id','name']},{'model':db[_0x9c94('0x49')],'as':'Queue','attributes':['id','name',_0x9c94('0x80')]}]})[_0x9c94('0xe')](function(_0x48d0ea){if(_0x48d0ea){return _0x48d0ea[_0x9c94('0xd')]({'UserId':_0x1dcfaa},{'transaction':_0x3fa6be});}});});})[_0x9c94('0xe')](handleEntityNotFound(_0x18dd23,null))['then'](respondWithResult(_0x18dd23,null))[_0x9c94('0x3d')](handleError(_0x18dd23,null));};exports[_0x9c94('0x83')]=function(_0xe7fc99,_0x1bacd9){return _0xe7fc99[_0x9c94('0x50')][_0x9c94('0x63')]({'where':{'type':_0x9c94('0x64'),'dialActive':!![],'dialMethod':_0x9c94('0x65')},'attributes':['id'],'raw':!![]})[_0x9c94('0xe')](function(_0x540373){if(_0x540373&&_0x540373[_0x9c94('0x2f')]){return db[_0x9c94('0x14')][_0x9c94('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9c94('0x52')](_0x9c94('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x540373,'id')},'$or':[{'UserId':null},{'UserId':_0xe7fc99[_0x9c94('0x50')]['id']}]}});}return 0x0;})['then'](function(_0x2ca6a4){if(!_[_0x9c94('0x5a')](_0x2ca6a4)&&_['isNumber'](_0x2ca6a4)){return _0x1bacd9['status'](0xc8)[_0x9c94('0x6')]({'contacts':_0x2ca6a4});}else{logger[_0x9c94('0xf')](_0x9c94('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x1bacd9[_0x9c94('0x85')](0x194);}})[_0x9c94('0x3d')](handleError(_0x1bacd9,null));};exports[_0x9c94('0x86')]=function(_0x27cdde,_0x34edf2){var _0x3b7c65=shared[_0x9c94('0x87')];var _0x117e0f=[];_[_0x9c94('0x13')](_0x3b7c65,function(_0x4c9022){_0x117e0f['push']({'id':_0x4c9022['name'],'name':_0x4c9022['name'],'utcOffset':_0x4c9022[_0x9c94('0x88')]});});return _0x34edf2['status'](0xc8)[_0x9c94('0x6')]({'tz':_0x117e0f});};exports[_0x9c94('0x89')]=function(_0x22d5bc,_0x4e23c1){var _0xf55837=shared[_0x9c94('0x87')];var _0x3edf16={};if(!_['isNil'](_0xf55837[_0x22d5bc[_0x9c94('0x44')]['id']]))_0x3edf16=_0xf55837[_0x22d5bc[_0x9c94('0x44')]['id']];return _0x4e23c1[_0x9c94('0x5')](0xc8)[_0x9c94('0x6')](_0x3edf16);}; \ No newline at end of file +var _0xaa7c=['$lte','$ne','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','literal','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmList','List','dialActive','CmCompany','Company','isNumber','getOpenContacts','entity\x20not\x20found','sendStatus','timezones','getTimezone','moment','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','update','then','error','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x3ea5e1,_0x17c486){_0x3ea5e1=_0x3ea5e1-0x0;var _0x1b81d7=_0xaa7c[_0x3ea5e1];return _0x1b81d7;};'use strict';var moment=require(_0xcaa7('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var shared=require(_0xcaa7('0x1'));var db=require(_0xcaa7('0x2'))['db'];function respondWithResult(_0x4f837e,_0xd4ca36){_0xd4ca36=_0xd4ca36||0xc8;return function(_0xc85ba0){if(_0xc85ba0){return _0x4f837e[_0xcaa7('0x3')](_0xd4ca36)[_0xcaa7('0x4')](_0xc85ba0);}};}function respondWithFilteredResult(_0x27e610,_0x5a3674){return function(_0x4b9df0){if(_0x4b9df0){var _0x5bd940=typeof _0x5a3674['offset']===_0xcaa7('0x5')&&typeof _0x5a3674[_0xcaa7('0x6')]===_0xcaa7('0x5');var _0x5d2ca8=_0x4b9df0[_0xcaa7('0x7')];var _0x1de70a=_0x5bd940?0x0:_0x5a3674[_0xcaa7('0x8')];var _0x38a42d=_0x5bd940?_0x4b9df0[_0xcaa7('0x7')]:_0x5a3674['offset']+_0x5a3674[_0xcaa7('0x6')];var _0x39d53a;if(_0x38a42d>=_0x5d2ca8){_0x38a42d=_0x5d2ca8;_0x39d53a=0xc8;}else{_0x39d53a=0xce;}_0x27e610[_0xcaa7('0x3')](_0x39d53a);return _0x27e610[_0xcaa7('0x9')](_0xcaa7('0xa'),_0x1de70a+'-'+_0x38a42d+'/'+_0x5d2ca8)[_0xcaa7('0x4')](_0x4b9df0);}return null;};}function saveUpdates(_0x563f57,_0x24d3b0){return function(_0x128cfb){if(_0x128cfb){return _0x128cfb[_0xcaa7('0xb')](_0x563f57)[_0xcaa7('0xc')](function(_0x2bbc71){return _0x2bbc71;});}return null;};}function handleEntityNotFound(_0x2eb4ff,_0x299490){return function(_0x4a1d5a){if(!_0x4a1d5a){_0x2eb4ff['sendStatus'](0x194);}return _0x4a1d5a;};}function handleError(_0x314b7c,_0x1c1286){_0x1c1286=_0x1c1286||0x1f4;return function(_0x1155fb){logger[_0xcaa7('0xd')](_0x1155fb['stack']);if(_0x1155fb[_0xcaa7('0xe')]){delete _0x1155fb[_0xcaa7('0xe')];}_0x314b7c[_0xcaa7('0x3')](_0x1c1286)[_0xcaa7('0xf')](_0x1155fb);};}exports[_0xcaa7('0x10')]=function(_0xc46e37,_0x20ede0){var _0x5c2a74={},_0x53e1cb={},_0x4309e0={'count':0x0,'rows':[]};var _0x4491d1=_[_0xcaa7('0x11')](db[_0xcaa7('0x12')][_0xcaa7('0x13')],function(_0x2a0416){return{'name':_0x2a0416[_0xcaa7('0x14')],'type':_0x2a0416['type'][_0xcaa7('0x15')]};});_0x53e1cb[_0xcaa7('0x16')]=_[_0xcaa7('0x11')](_0x4491d1,_0xcaa7('0xe'));_0x53e1cb[_0xcaa7('0x17')]=_[_0xcaa7('0x18')](_0xc46e37[_0xcaa7('0x17')]);_0x53e1cb[_0xcaa7('0x19')]=_[_0xcaa7('0x1a')](_0x53e1cb[_0xcaa7('0x16')],_0x53e1cb[_0xcaa7('0x17')]);_0x53e1cb[_0xcaa7('0x19')]=_[_0xcaa7('0x1b')](_0x53e1cb['filters'],[_0xcaa7('0x1c'),_0xcaa7('0x1d'),'$gt',_0xcaa7('0x1e'),_0xcaa7('0x1f'),_0xcaa7('0x20'),_0xcaa7('0x21'),'$eq','$not',_0xcaa7('0x22'),_0xcaa7('0x23'),_0xcaa7('0x24'),_0xcaa7('0x25'),_0xcaa7('0x26'),'$notLike',_0xcaa7('0x27'),'$notILike','$like',_0xcaa7('0x28'),'$contains',_0xcaa7('0x29'),_0xcaa7('0x2a')]);_0x5c2a74[_0xcaa7('0x2b')]=_[_0xcaa7('0x1a')](_0x53e1cb[_0xcaa7('0x16')],qs[_0xcaa7('0x2c')](_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x2c')]));_0x5c2a74['attributes']=_0x5c2a74[_0xcaa7('0x2b')][_0xcaa7('0x2d')]?_0x5c2a74[_0xcaa7('0x2b')]:_0x53e1cb[_0xcaa7('0x16')];if(!_0xc46e37[_0xcaa7('0x17')]['hasOwnProperty'](_0xcaa7('0x2e'))){_0x5c2a74[_0xcaa7('0x6')]=qs[_0xcaa7('0x6')](_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x6')]);_0x5c2a74['offset']=qs[_0xcaa7('0x8')](_0xc46e37['query'][_0xcaa7('0x8')]);}_0x5c2a74[_0xcaa7('0x2f')]=qs[_0xcaa7('0x30')](_0xc46e37['query'][_0xcaa7('0x30')]);_0x5c2a74[_0xcaa7('0x31')]=qs[_0xcaa7('0x19')](_[_0xcaa7('0x32')](_0xc46e37[_0xcaa7('0x17')],_0x53e1cb[_0xcaa7('0x19')]),_0x4491d1);if(_0xc46e37['query'][_0xcaa7('0x33')]){_0x5c2a74[_0xcaa7('0x31')]=_['merge'](_0x5c2a74[_0xcaa7('0x31')],{'$or':_[_0xcaa7('0x11')](_0x4491d1,function(_0x444add){if(_0x444add[_0xcaa7('0x34')]!=='VIRTUAL'){var _0x16af20={};_0x16af20[_0x444add[_0xcaa7('0xe')]]={'$like':'%'+_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x33')]+'%'};return _0x16af20;}})});}_0x5c2a74=_[_0xcaa7('0x35')]({},_0x5c2a74,_0xc46e37[_0xcaa7('0x36')]);var _0xcb5439={'where':_0x5c2a74[_0xcaa7('0x31')]};return db[_0xcaa7('0x12')][_0xcaa7('0x7')](_0xcb5439)[_0xcaa7('0xc')](function(_0x266d5f){_0x4309e0['count']=_0x266d5f;if(_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x37')]){_0x5c2a74[_0xcaa7('0x38')]=[{'all':!![]}];}return db[_0xcaa7('0x12')][_0xcaa7('0x39')](_0x5c2a74);})['then'](function(_0x3d3c13){_0x4309e0[_0xcaa7('0x3a')]=_0x3d3c13;return _0x4309e0;})[_0xcaa7('0xc')](respondWithFilteredResult(_0x20ede0,_0x5c2a74))['catch'](handleError(_0x20ede0,null));};exports[_0xcaa7('0x3b')]=function(_0x3016f1,_0x320b46){var _0x1138a6={'raw':!![],'where':{'id':_0x3016f1[_0xcaa7('0x3c')]['id']}},_0x569c5f={};_0x569c5f['model']=_[_0xcaa7('0x18')](db['CmHopper'][_0xcaa7('0x13')]);_0x569c5f['query']=_['keys'](_0x3016f1[_0xcaa7('0x17')]);_0x569c5f[_0xcaa7('0x19')]=_['intersection'](_0x569c5f[_0xcaa7('0x16')],_0x569c5f[_0xcaa7('0x17')]);_0x1138a6[_0xcaa7('0x2b')]=_[_0xcaa7('0x1a')](_0x569c5f[_0xcaa7('0x16')],qs[_0xcaa7('0x2c')](_0x3016f1[_0xcaa7('0x17')][_0xcaa7('0x2c')]));_0x1138a6['attributes']=_0x1138a6[_0xcaa7('0x2b')][_0xcaa7('0x2d')]?_0x1138a6[_0xcaa7('0x2b')]:_0x569c5f[_0xcaa7('0x16')];if(_0x3016f1[_0xcaa7('0x17')][_0xcaa7('0x37')]){_0x1138a6['include']=[{'all':!![]}];}_0x1138a6=_[_0xcaa7('0x35')]({},_0x1138a6,_0x3016f1[_0xcaa7('0x36')]);return db[_0xcaa7('0x12')][_0xcaa7('0x3d')](_0x1138a6)[_0xcaa7('0xc')](handleEntityNotFound(_0x320b46,null))['then'](respondWithResult(_0x320b46,null))[_0xcaa7('0x3e')](handleError(_0x320b46,null));};exports[_0xcaa7('0x3f')]=function(_0x33c748,_0x490b0d){return db[_0xcaa7('0x12')]['create'](_0x33c748[_0xcaa7('0x40')],{})[_0xcaa7('0xc')](respondWithResult(_0x490b0d,0xc9))[_0xcaa7('0x3e')](handleError(_0x490b0d,null));};exports[_0xcaa7('0xb')]=function(_0x94e72d,_0x208495){if(_0x94e72d[_0xcaa7('0x40')]['id']){delete _0x94e72d['body']['id'];}return db['CmHopper'][_0xcaa7('0x3d')]({'where':{'id':_0x94e72d['params']['id']}})[_0xcaa7('0xc')](handleEntityNotFound(_0x208495,null))['then'](saveUpdates(_0x94e72d[_0xcaa7('0x40')],null))['then'](respondWithResult(_0x208495,null))[_0xcaa7('0x3e')](handleError(_0x208495,null));};exports[_0xcaa7('0x41')]=function(_0x1304a1,_0x32ec2d){return db[_0xcaa7('0x12')][_0xcaa7('0x41')]()['then'](respondWithResult(_0x32ec2d,null))['catch'](handleError(_0x32ec2d,null));};exports[_0xcaa7('0x42')]=function(_0x3a5f1f,_0x4f162c){var _0x417aaa;var _0x8a94a8=_0x3a5f1f[_0xcaa7('0x3c')]['id'];return db[_0xcaa7('0x12')][_0xcaa7('0x3d')]({'where':{'id':_0x3a5f1f[_0xcaa7('0x3c')]['id']}})[_0xcaa7('0xc')](handleEntityNotFound(_0x4f162c,null))[_0xcaa7('0xc')](function(_0x30d75c){if(_0x30d75c){return _0x30d75c[_0xcaa7('0x42')]()[_0xcaa7('0xc')](function(_0x3cc7ae){return _0x3cc7ae;});}})[_0xcaa7('0xc')](function(_0x3e77a9){_0x417aaa=_0x3e77a9;if(_0x3e77a9){if(_0x3e77a9[_0xcaa7('0x43')]||_0x3e77a9[_0xcaa7('0x44')]){return db[_0x3e77a9['VoiceQueueId']?_0xcaa7('0x45'):'Campaign'][_0xcaa7('0x3d')]({'where':{'id':_0x3e77a9[_0xcaa7('0x43')]?_0x3e77a9[_0xcaa7('0x43')]:_0x3e77a9[_0xcaa7('0x44')]},'attributes':['id',_0xcaa7('0xe')],'raw':!![]});}}})[_0xcaa7('0xc')](function(_0x1a2e55){var _0x2a263e={};if(_0x1a2e55){_[_0xcaa7('0x35')](_0x2a263e,_[_0xcaa7('0x46')](_0x417aaa[_0xcaa7('0x47')],['createdAt',_0xcaa7('0x48'),'id']));_0x2a263e[_0xcaa7('0x49')]=0x15;_0x2a263e[_0xcaa7('0x4a')]='deleted';_0x2a263e[_0xcaa7('0x4b')]=_0x1a2e55['name'];_0x2a263e[_0xcaa7('0x4c')]=_0x3a5f1f[_0xcaa7('0x4d')][_0xcaa7('0xe')];_0x2a263e[_0xcaa7('0x4e')]=_0x3a5f1f['user']['id'];_0x2a263e[_0xcaa7('0x4f')]=!![];_0x2a263e[_0xcaa7('0x50')]=moment()[_0xcaa7('0x51')](_0xcaa7('0x52'));_0x2a263e[_0xcaa7('0x53')]=_0x417aaa[_0xcaa7('0x54')];_0x2a263e[_0xcaa7('0x55')]=_0x417aaa[_0xcaa7('0x43')]?'queue':_0xcaa7('0x56');return db[_0xcaa7('0x57')][_0xcaa7('0x3d')]({'where':{'id':_0x2a263e[_0xcaa7('0x58')]},'attributes':[_0xcaa7('0x59'),_0xcaa7('0x5a')]})['then'](function(_0xcf623b){if(!_[_0xcaa7('0x5b')](_0x4f162c)&&!_['isNil'](_0xcf623b[_0xcaa7('0x59')])){_0x2a263e[_0xcaa7('0x5c')]=_0xcf623b[_0xcaa7('0x59')];if(!_['isNil'](_0xcf623b[_0xcaa7('0x5a')])){_0x2a263e[_0xcaa7('0x5c')]+='\x20'+_0xcf623b['lastName'];}}})[_0xcaa7('0x5d')](function(){return db[_0xcaa7('0x5e')][_0xcaa7('0x3f')](_0x2a263e);});}})[_0xcaa7('0xc')](function(_0xa6be83){return db[_0xcaa7('0x5f')][_0xcaa7('0x42')]({'where':{'CmHopperId':_0x8a94a8}});})[_0xcaa7('0xc')](function(){return _0x4f162c[_0xcaa7('0x3')](0xcc)[_0xcaa7('0x60')]();})[_0xcaa7('0x3e')](handleError(_0x4f162c,null));};exports[_0xcaa7('0x61')]=function(_0x3a6793,_0x1b494a){var _0x2c2df3=[];return db[_0xcaa7('0x57')][_0xcaa7('0x41')]()[_0xcaa7('0xc')](function(_0x596c65){_0x2c2df3=_[_0xcaa7('0x18')](_0x596c65);return _0x3a6793['user'][_0xcaa7('0x62')]({'where':{'type':_0xcaa7('0x63'),'dialActive':!![],'dialMethod':_0xcaa7('0x64')},'attributes':['id','dialOrderByScheduledAt',_0xcaa7('0x65')],'raw':!![]});})[_0xcaa7('0xc')](function(_0x1cf62d){if(_0x1cf62d&&_0x1cf62d[_0xcaa7('0x2d')]){return db[_0xcaa7('0x66')][_0xcaa7('0x67')](function(_0x322423){var _0x188480={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcaa7('0x51')](_0xcaa7('0x52'))},'VoiceQueueId':{'$in':_['map'](_0x1cf62d,'id')},'$or':[{'UserId':null},{'UserId':_0x3a6793[_0xcaa7('0x4d')]['id']}]};var _0x22a605={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1cf62d)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xcaa7('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3a6793[_0xcaa7('0x4d')]['id']}]};var _0x53c13c={'$or':[_0x188480,_0x22a605]};var _0x3dfb2d=[];if(_0x3a6793['body'][_0xcaa7('0x68')]&&_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x68')]===_0xcaa7('0x69')){if(!_[_0xcaa7('0x6a')](_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x6b')])){_0x53c13c['id']={'$in':_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x6b')]};}_0x3dfb2d=[[_0xcaa7('0x6c'),'ASC'],[_0xcaa7('0x6d'),_0x1cf62d[0x0][_0xcaa7('0x6e')]===_0xcaa7('0x6f')?_0xcaa7('0x70'):_0xcaa7('0x6f')],db[_0xcaa7('0x66')][_0xcaa7('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xcaa7('0x70')]];}else{if(!_[_0xcaa7('0x6a')](_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x6b')])){_0x53c13c['id']={'$notIn':_0x3a6793[_0xcaa7('0x40')]['hopperIds']};}_0x3dfb2d=[[_0xcaa7('0x6c'),'DESC'],['scheduledAt',_0x1cf62d[0x0][_0xcaa7('0x6e')]],db[_0xcaa7('0x66')][_0xcaa7('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xcaa7('0x6f')]];}return db['CmHopper'][_0xcaa7('0x72')]({'attributes':['id',_0xcaa7('0x73'),'phone',_0xcaa7('0x74')],'where':_0x53c13c,'order':_0x3dfb2d,'transaction':_0x322423,'lock':_0x322423[_0xcaa7('0x75')][_0xcaa7('0x76')],'include':[{'model':db[_0xcaa7('0x57')],'as':_0xcaa7('0x77'),'attributes':_0x2c2df3,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xcaa7('0xe')]}]},{'model':db[_0xcaa7('0x78')],'as':_0xcaa7('0x79'),'attributes':['id',_0xcaa7('0xe')]},{'model':db[_0xcaa7('0x45')],'as':'Queue','attributes':['id',_0xcaa7('0xe'),_0xcaa7('0x7a')]}]})['then'](function(_0x22841e){if(_0x22841e){return _0x22841e[_0xcaa7('0xb')]({'UserId':_0x3a6793[_0xcaa7('0x4d')]['id']},{'transaction':_0x322423});}});});}})[_0xcaa7('0xc')](handleEntityNotFound(_0x1b494a,null))[_0xcaa7('0xc')](respondWithResult(_0x1b494a,null))[_0xcaa7('0x3e')](handleError(_0x1b494a,null));};exports['getPreviewRecall']=function(_0x4af581,_0x3cbe09,_0x3ea57c){var _0x2b1e92=[];var _0x2381ce=_0x4af581['params']['id'];var _0x5c0380=_0x4af581[_0xcaa7('0x4d')]['id'];return db[_0xcaa7('0x57')][_0xcaa7('0x41')]()[_0xcaa7('0xc')](function(_0x30517b){_0x2b1e92=_['keys'](_0x30517b);return db[_0xcaa7('0x66')][_0xcaa7('0x67')](function(_0x273efe){const _0x2b4c26={'id':_0x2381ce};return db['CmHopper'][_0xcaa7('0x72')]({'attributes':['id',_0xcaa7('0x73'),_0xcaa7('0x74')],'where':_0x2b4c26,'transaction':_0x273efe,'lock':_0x273efe['LOCK'][_0xcaa7('0x76')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x2b1e92,'include':[{'model':db[_0xcaa7('0x7b')],'as':_0xcaa7('0x7c'),'attributes':['id',_0xcaa7('0xe')]}]},{'model':db[_0xcaa7('0x78')],'as':'List','attributes':['id',_0xcaa7('0xe')]},{'model':db[_0xcaa7('0x45')],'as':'Queue','attributes':['id',_0xcaa7('0xe'),_0xcaa7('0x7a')]}]})[_0xcaa7('0xc')](function(_0x5399d3){if(_0x5399d3){return _0x5399d3[_0xcaa7('0xb')]({'UserId':_0x5c0380},{'transaction':_0x273efe});}});});})[_0xcaa7('0xc')](handleEntityNotFound(_0x3cbe09,null))['then'](respondWithResult(_0x3cbe09,null))[_0xcaa7('0x3e')](handleError(_0x3cbe09,null));};exports['getOpenContacts']=function(_0xdc48b8,_0xa3fcb3){return _0xdc48b8['user'][_0xcaa7('0x62')]({'where':{'type':_0xcaa7('0x63'),'dialActive':!![],'dialMethod':_0xcaa7('0x64')},'attributes':['id'],'raw':!![]})['then'](function(_0x1499e9){if(_0x1499e9&&_0x1499e9[_0xcaa7('0x2d')]){return db[_0xcaa7('0x12')][_0xcaa7('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xcaa7('0x52'))},'VoiceQueueId':{'$in':_[_0xcaa7('0x11')](_0x1499e9,'id')},'$or':[{'UserId':null},{'UserId':_0xdc48b8[_0xcaa7('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x505d43){if(!_[_0xcaa7('0x5b')](_0x505d43)&&_[_0xcaa7('0x7d')](_0x505d43)){return _0xa3fcb3[_0xcaa7('0x3')](0xc8)[_0xcaa7('0x4')]({'contacts':_0x505d43});}else{logger[_0xcaa7('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xcaa7('0x7e'),0x194,_0xcaa7('0x7f'));_0xa3fcb3[_0xcaa7('0x80')](0x194);}})[_0xcaa7('0x3e')](handleError(_0xa3fcb3,null));};exports['getTimezones']=function(_0x3e74be,_0x358643){var _0x332433=shared[_0xcaa7('0x81')];var _0x32c6bc=[];_[_0xcaa7('0x11')](_0x332433,function(_0x16559e){_0x32c6bc['push']({'id':_0x16559e[_0xcaa7('0xe')],'name':_0x16559e[_0xcaa7('0xe')],'utcOffset':_0x16559e['utcOffset']});});return _0x358643['status'](0xc8)[_0xcaa7('0x4')]({'tz':_0x32c6bc});};exports[_0xcaa7('0x82')]=function(_0x3797fc,_0x4dfb92){var _0x1a7f2a=shared[_0xcaa7('0x81')];var _0x28cfa4={};if(!_[_0xcaa7('0x5b')](_0x1a7f2a[_0x3797fc[_0xcaa7('0x40')]['id']]))_0x28cfa4=_0x1a7f2a[_0x3797fc[_0xcaa7('0x40')]['id']];return _0x4dfb92[_0xcaa7('0x3')](0xc8)[_0xcaa7('0x4')](_0x28cfa4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 099ca25..f9ecb19 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 _0x2675=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','moment','bluebird'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x2675,0x75));var _0x5267=function(_0x1faa70,_0x10eeb1){_0x1faa70=_0x1faa70-0x0;var _0x3860aa=_0x2675[_0x1faa70];return _0x3860aa;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]},{'name':'phone','fields':[_0x5267('0xa')]},{'name':'priority','fields':[_0x5267('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x2a07,0x74));var _0x72a0=function(_0x32659d,_0x58ece9){_0x32659d=_0x32659d-0x0;var _0x10d610=_0x2a07[_0x32659d];return _0x10d610;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 461c012..72f9b91 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 _0x636c=['map','then','GetCmHopper','stringify','error','message','ShowCmHopper','CmHopper','find','info','debug','catch','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','CmContact','describe','transaction','findAll','limit','order','LOCK','UPDATE','Contact','keys','User','Agent','name','length','UserId','push','update','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','active','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','voicePause','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','options','raw','where','attributes','include','model'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0x636c,0x198));var _0xc636=function(_0x797be7,_0x5c1293){_0x797be7=_0x797be7-0x0;var _0x27d2fa=_0x636c[_0x797be7];return _0x27d2fa;};'use strict';var _=require(_0xc636('0x0'));var util=require('util');var moment=require(_0xc636('0x1'));var BPromise=require(_0xc636('0x2'));var db=require(_0xc636('0x3'))['db'];var logger=require(_0xc636('0x4'))(_0xc636('0x5'));exports['GetCmHopper']=function(_0x7f9ea5){var _0x3f6dad=this;return new Promise(function(_0x58c212,_0x1a65ee){return db['CmHopper']['findAll']({'raw':_0x7f9ea5[_0xc636('0x6')]?_0x7f9ea5[_0xc636('0x6')][_0xc636('0x7')]===undefined?!![]:![]:!![],'where':_0x7f9ea5[_0xc636('0x6')]?_0x7f9ea5[_0xc636('0x6')][_0xc636('0x8')]||null:null,'attributes':_0x7f9ea5[_0xc636('0x6')]?_0x7f9ea5[_0xc636('0x6')][_0xc636('0x9')]||null:null,'limit':_0x7f9ea5[_0xc636('0x6')]?_0x7f9ea5[_0xc636('0x6')]['limit']||null:null,'include':_0x7f9ea5['options']?_0x7f9ea5[_0xc636('0x6')][_0xc636('0xa')]?_['map'](_0x7f9ea5[_0xc636('0x6')][_0xc636('0xa')],function(_0x3eac2a){return{'model':db[_0x3eac2a[_0xc636('0xb')]],'as':_0x3eac2a['as'],'attributes':_0x3eac2a[_0xc636('0x9')],'include':_0x3eac2a[_0xc636('0xa')]?_[_0xc636('0xc')](_0x3eac2a[_0xc636('0xa')],function(_0x337fd9){return{'model':db[_0x337fd9[_0xc636('0xb')]],'as':_0x337fd9['as'],'attributes':_0x337fd9[_0xc636('0x9')],'include':_0x337fd9[_0xc636('0xa')]?_['map'](_0x337fd9[_0xc636('0xa')],function(_0xec5166){return{'model':db[_0xec5166[_0xc636('0xb')]],'as':_0xec5166['as'],'attributes':_0xec5166[_0xc636('0x9')]};}):[]};}):[]};}):[]:[]})[_0xc636('0xd')](function(_0x121634){logger['info']('GetCmHopper',_0x7f9ea5);logger['debug'](_0xc636('0xe'),_0x7f9ea5,JSON[_0xc636('0xf')](_0x121634));_0x58c212(_0x121634);})['catch'](function(_0x2f516a){logger[_0xc636('0x10')](_0xc636('0xe'),_0x2f516a[_0xc636('0x11')],_0x7f9ea5);_0x1a65ee(_0x3f6dad[_0xc636('0x10')](0x1f4,_0x2f516a[_0xc636('0x11')]));});});};exports[_0xc636('0x12')]=function(_0x30440b){var _0x24880a=this;return new Promise(function(_0x3bde69,_0x4b4221){return db[_0xc636('0x13')][_0xc636('0x14')]({'raw':_0x30440b[_0xc636('0x6')]?_0x30440b[_0xc636('0x6')][_0xc636('0x7')]===undefined?!![]:![]:!![],'where':_0x30440b[_0xc636('0x6')]?_0x30440b['options'][_0xc636('0x8')]||null:null,'attributes':_0x30440b['options']?_0x30440b['options'][_0xc636('0x9')]||null:null,'include':_0x30440b[_0xc636('0x6')]?_0x30440b['options'][_0xc636('0xa')]?_[_0xc636('0xc')](_0x30440b[_0xc636('0x6')][_0xc636('0xa')],function(_0xdbc6e7){return{'model':db[_0xdbc6e7['model']],'as':_0xdbc6e7['as'],'attributes':_0xdbc6e7[_0xc636('0x9')],'include':_0xdbc6e7[_0xc636('0xa')]?_['map'](_0xdbc6e7[_0xc636('0xa')],function(_0x838954){return{'model':db[_0x838954['model']],'as':_0x838954['as'],'attributes':_0x838954[_0xc636('0x9')],'include':_0x838954[_0xc636('0xa')]?_[_0xc636('0xc')](_0x838954[_0xc636('0xa')],function(_0x89f71e){return{'model':db[_0x89f71e[_0xc636('0xb')]],'as':_0x89f71e['as'],'attributes':_0x89f71e[_0xc636('0x9')]};}):[]};}):[]};}):[]:[]})[_0xc636('0xd')](function(_0x327fae){logger[_0xc636('0x15')](_0xc636('0x12'),_0x30440b);logger[_0xc636('0x16')](_0xc636('0x12'),_0x30440b,JSON['stringify'](_0x327fae));_0x3bde69(_0x327fae);})[_0xc636('0x17')](function(_0x13be53){logger['error'](_0xc636('0x12'),_0x13be53[_0xc636('0x11')],_0x30440b);_0x4b4221(_0x24880a[_0xc636('0x10')](0x1f4,_0x13be53[_0xc636('0x11')]));});});};exports[_0xc636('0x18')]=function(_0x4733c6){var _0x53c083=this;return new Promise(function(_0x5b464d,_0x3dd950){return db[_0xc636('0x13')][_0xc636('0x19')](_0x4733c6[_0xc636('0x1a')],{'raw':_0x4733c6[_0xc636('0x6')]?_0x4733c6[_0xc636('0x6')][_0xc636('0x7')]===undefined?!![]:![]:!![]})[_0xc636('0xd')](function(_0x3c6aa8){logger[_0xc636('0x15')](_0xc636('0x18'),_0x4733c6);logger[_0xc636('0x16')](_0xc636('0x18'),_0x4733c6,JSON[_0xc636('0xf')](_0x3c6aa8));_0x5b464d(_0x3c6aa8);})['catch'](function(_0x149501){logger[_0xc636('0x10')](_0xc636('0x18'),_0x149501[_0xc636('0x11')],_0x4733c6);_0x3dd950(_0x53c083[_0xc636('0x10')](0x1f4,_0x149501['message']));});});};exports['UpdateCmHopper']=function(_0x5d854b){var _0x434a58=this;return new Promise(function(_0xe40352,_0x5232f2){return db[_0xc636('0x13')]['update'](_0x5d854b[_0xc636('0x1a')],{'raw':_0x5d854b[_0xc636('0x6')]?_0x5d854b['options'][_0xc636('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d854b[_0xc636('0x6')]?_0x5d854b[_0xc636('0x6')][_0xc636('0x8')]||null:null,'attributes':_0x5d854b[_0xc636('0x6')]?_0x5d854b[_0xc636('0x6')]['attributes']||null:null,'limit':_0x5d854b['options']?_0x5d854b[_0xc636('0x6')]['limit']||null:null})[_0xc636('0xd')](function(_0x211d91){logger[_0xc636('0x15')](_0xc636('0x1b'),_0x5d854b);logger[_0xc636('0x15')](_0xc636('0x1c'),JSON['stringify'](_0x5d854b['options'][_0xc636('0x8')]),_0x5d854b[_0xc636('0x1a')]['active']);logger[_0xc636('0x16')]('UpdateCmHopper',_0x5d854b,JSON['stringify'](_0x211d91));_0xe40352(_0x211d91);})[_0xc636('0x17')](function(_0x235423){logger['error'](_0xc636('0x1b'),_0x235423[_0xc636('0x11')],_0x5d854b);_0x5232f2(_0x434a58['error'](0x1f4,_0x235423[_0xc636('0x11')]));});});};exports['DestroyCmHopper']=function(_0x2a6563){var _0x189209=this;return new Promise(function(_0x4a93c0,_0x213159){return db['CmHopper']['destroy']({'where':_0x2a6563[_0xc636('0x6')]?_0x2a6563[_0xc636('0x6')][_0xc636('0x8')]||null:null})[_0xc636('0xd')](function(_0x21d29d){logger[_0xc636('0x15')](_0xc636('0x1d'),_0x2a6563);logger['debug'](_0xc636('0x1d'),_0x2a6563,JSON[_0xc636('0xf')](_0x21d29d));_0x4a93c0(_0x21d29d);})['catch'](function(_0x184faa){logger[_0xc636('0x10')](_0xc636('0x1d'),_0x184faa['message'],_0x2a6563);_0x213159(_0x189209[_0xc636('0x10')](0x1f4,_0x184faa[_0xc636('0x11')]));});});};exports['GetContactDialer']=function(_0x30c330){var _0x460e25=this;return new Promise(function(_0x203023,_0x2c3150){return db[_0xc636('0x1e')][_0xc636('0x1f')]()[_0xc636('0xd')](function(_0xac97cd){return db['sequelize'][_0xc636('0x20')](function(_0x3fdf90){return db['CmHopper'][_0xc636('0x21')]({'where':_0x30c330[_0xc636('0x6')]?_0x30c330[_0xc636('0x6')]['where']||null:null,'attributes':_0x30c330['options']?_0x30c330['options'][_0xc636('0x9')]||null:null,'limit':_0x30c330[_0xc636('0x6')]?_0x30c330[_0xc636('0x6')][_0xc636('0x22')]||null:null,'order':_0x30c330[_0xc636('0x6')]?_0x30c330[_0xc636('0x6')][_0xc636('0x23')]||null:null,'transaction':_0x3fdf90,'lock':_0x3fdf90[_0xc636('0x24')][_0xc636('0x25')],'include':[{'model':db[_0xc636('0x1e')],'as':_0xc636('0x26'),'attributes':_[_0xc636('0x27')](_0xac97cd)},{'model':db[_0xc636('0x28')],'as':_0xc636('0x29'),'attributes':['id',_0xc636('0x2a'),'voicePause']}]})[_0xc636('0xd')](function(_0x205551){var _0x4e066e=[];var _0x28b514=[];for(var _0x290e0a=0x0;_0x290e0a<_0x205551[_0xc636('0x2b')];_0x290e0a+=0x1){var _0x2aa7a9=_0x205551[_0x290e0a][_0xc636('0x2c')];if(_0x2aa7a9===null){_0x4e066e[_0xc636('0x2d')](_0x205551[_0x290e0a][_0xc636('0x2e')](_0x30c330[_0xc636('0x1a')],{'transaction':_0x3fdf90}));}else if(!_0x28b514[_0xc636('0x2f')](_0x2aa7a9)){_0x28b514[_0xc636('0x2d')](_0x2aa7a9);_0x4e066e['push'](_0x205551[_0x290e0a][_0xc636('0x2e')](_0x30c330[_0xc636('0x1a')],{'transaction':_0x3fdf90}));}}return BPromise[_0xc636('0x30')](_0x4e066e);});})['then'](function(_0x2fa41f){logger['info'](_0xc636('0x31'),_0x30c330);if(_0x2fa41f[_0xc636('0x2b')]>0x0){logger[_0xc636('0x15')](_0xc636('0x32'),_0x2fa41f[0x0][_0xc636('0x33')]['id'],_0x2fa41f[0x0]['dataValues'][_0xc636('0x34')],_0x2fa41f[0x0][_0xc636('0x33')]['active']);}logger[_0xc636('0x16')]('GetContactDialer',_0x30c330,JSON[_0xc636('0xf')](_0x2fa41f));_0x203023(_0x2fa41f);})[_0xc636('0x17')](function(_0x9553c2){logger['error'](_0xc636('0x31'),_0x9553c2[_0xc636('0x11')],_0x30c330);_0x2c3150(_0x460e25[_0xc636('0x10')](0x1f4,_0x9553c2[_0xc636('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x5a2e7c){var _0xd09851=this;return new Promise(function(_0x26f9db,_0x223364){return db[_0xc636('0x35')][_0xc636('0x20')](function(_0x3ec136){return db[_0xc636('0x36')][_0xc636('0x19')](_0x5a2e7c[_0xc636('0x1a')],{'raw':_0x5a2e7c['options']?_0x5a2e7c['options'][_0xc636('0x7')]===undefined?!![]:![]:!![],'transaction':_0x3ec136})['then'](function(){logger[_0xc636('0x15')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc636('0xf')](_0x5a2e7c[_0xc636('0x6')][_0xc636('0x8')]),_0x5a2e7c[_0xc636('0x6')][_0xc636('0x8')][_0xc636('0x37')]);return db[_0xc636('0x13')][_0xc636('0x38')]({'where':_0x5a2e7c[_0xc636('0x6')]?_0x5a2e7c[_0xc636('0x6')][_0xc636('0x8')]||null:null,'transaction':_0x3ec136});});})[_0xc636('0xd')](function(_0x2dc62e){logger[_0xc636('0x15')](_0xc636('0x39'),_0x5a2e7c);logger['debug'](_0xc636('0x39'),_0x5a2e7c,JSON[_0xc636('0xf')](_0x2dc62e));_0x26f9db(_0x2dc62e);})[_0xc636('0x17')](function(_0x3179f3){logger['error'](_0xc636('0x39'),_0x3179f3[_0xc636('0x11')],_0x5a2e7c);_0x223364(_0xd09851['error'](0x1f4,_0x3179f3['message']));});});};exports[_0xc636('0x3a')]=function(_0xd89ca4){var _0x146dbf=this;return new Promise(function(_0x168688,_0x19f03e){return db['CmHopper'][_0xc636('0x21')]({'raw':_0xd89ca4[_0xc636('0x6')]?_0xd89ca4[_0xc636('0x6')][_0xc636('0x7')]===undefined?!![]:![]:!![],'where':_0xd89ca4['options']?_0xd89ca4[_0xc636('0x6')][_0xc636('0x8')]||null:null,'attributes':[[db[_0xc636('0x35')]['fn'](_0xc636('0x3b'),db[_0xc636('0x35')]['fn']('IF',db[_0xc636('0x35')][_0xc636('0x3c')](_0xc636('0x3d')+util[_0xc636('0x3e')](_0xc636('0x3f'),moment()['format'](_0xc636('0x40')))+_0xc636('0x41')))),_0xc636('0x42')]]})[_0xc636('0xd')](function(_0x1f2a05){logger['info'](_0xc636('0x3a'),_0xd89ca4);logger['debug'](_0xc636('0x3a'),_0xd89ca4,JSON[_0xc636('0xf')](_0x1f2a05));_0x168688(_0x1f2a05);})['catch'](function(_0x1d1e3f){logger['error'](_0xc636('0x3a'),_0x1d1e3f[_0xc636('0x11')],_0xd89ca4);_0x19f03e(_0x146dbf[_0xc636('0x10')](0x1f4,_0x1d1e3f[_0xc636('0x11')]));});});};exports['GetContactRecallMe']=function(_0x77af2a){var _0x6468f4=this;return new Promise(function(_0x422a4b,_0x2a6cce){return db[_0xc636('0x1e')]['describe']()[_0xc636('0xd')](function(){return db[_0xc636('0x35')][_0xc636('0x20')](function(_0x57603b){return db[_0xc636('0x13')][_0xc636('0x21')]({'where':_0x77af2a['options']?_0x77af2a[_0xc636('0x6')][_0xc636('0x8')]||null:null,'attributes':_0x77af2a[_0xc636('0x6')]?_0x77af2a['options']['attributes']||null:null,'limit':0x1,'order':_0x77af2a[_0xc636('0x6')]?_0x77af2a[_0xc636('0x6')]['order']||null:null,'group':db['CmHopper'][_0xc636('0x2c')],'transaction':_0x57603b,'lock':_0x57603b['LOCK'][_0xc636('0x25')],'include':_0x77af2a[_0xc636('0x6')]?_0x77af2a[_0xc636('0x6')]['include']?_['map'](_0x77af2a[_0xc636('0x6')]['include'],function(_0x4b2f58){return{'model':db[_0x4b2f58[_0xc636('0xb')]],'as':_0x4b2f58['as'],'attributes':_0x4b2f58[_0xc636('0x9')],'include':_0x4b2f58[_0xc636('0xa')]?_[_0xc636('0xc')](_0x4b2f58[_0xc636('0xa')],function(_0x147406){return{'model':db[_0x147406[_0xc636('0xb')]],'as':_0x147406['as'],'attributes':_0x147406[_0xc636('0x9')],'include':_0x147406['include']?_[_0xc636('0xc')](_0x147406[_0xc636('0xa')],function(_0x410327){return{'model':db[_0x410327[_0xc636('0xb')]],'as':_0x410327['as'],'attributes':_0x410327[_0xc636('0x9')]};}):[]};}):[]};}):[]:[]})[_0xc636('0xd')](function(_0x27fe6f){var _0x320126=[];for(var _0x39e000=0x0;_0x39e000<_0x27fe6f[_0xc636('0x2b')];_0x39e000+=0x1){_0x320126['push'](_0x27fe6f[_0x39e000][_0xc636('0x2e')](_0x77af2a[_0xc636('0x1a')],{'transaction':_0x57603b}));}return BPromise['all'](_0x320126);});})[_0xc636('0xd')](function(_0x5f226d){logger[_0xc636('0x15')]('GetContactRecallMe',_0x77af2a);logger[_0xc636('0x16')]('GetContactRecallMe',_0x77af2a,JSON['stringify'](_0x5f226d));_0x422a4b(_0x5f226d);})['catch'](function(_0x559ce3){logger['error']('GetContactRecallMe',_0x559ce3[_0xc636('0x11')],_0x77af2a);_0x2a6cce(_0x6468f4[_0xc636('0x10')](0x1f4,_0x559ce3['message']));});});});};exports[_0xc636('0x43')]=function(_0x2dc3b9){var _0x3f8df2=this;return new Promise(function(_0x7183be,_0xedc36f){db[_0xc636('0x1e')][_0xc636('0x1f')]()[_0xc636('0xd')](function(_0x5e69d0){return db[_0xc636('0x13')]['findAll']({'raw':_0x2dc3b9[_0xc636('0x6')]?_0x2dc3b9[_0xc636('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc3b9[_0xc636('0x6')]?_0x2dc3b9['options']['where']||null:null,'attributes':_0x2dc3b9['options']?_0x2dc3b9[_0xc636('0x6')][_0xc636('0x9')]||null:null,'limit':_0x2dc3b9[_0xc636('0x6')]?_0x2dc3b9[_0xc636('0x6')]['limit']||null:null,'include':_0x2dc3b9[_0xc636('0x6')]?_0x2dc3b9[_0xc636('0x6')][_0xc636('0xa')]?_[_0xc636('0xc')](_0x2dc3b9[_0xc636('0x6')]['include'],function(_0xd8ffc1){return{'model':db[_0xd8ffc1['model']],'as':_0xd8ffc1['as'],'attributes':_0xd8ffc1['as']==='Contact'?_['keys'](_0x5e69d0):_0xd8ffc1[_0xc636('0x9')],'include':_0xd8ffc1['include']?_[_0xc636('0xc')](_0xd8ffc1[_0xc636('0xa')],function(_0x35e2de){return{'model':db[_0x35e2de[_0xc636('0xb')]],'as':_0x35e2de['as'],'attributes':_0x35e2de[_0xc636('0x9')],'include':_0x35e2de[_0xc636('0xa')]?_[_0xc636('0xc')](_0x35e2de[_0xc636('0xa')],function(_0x5c2143){return{'model':db[_0x5c2143['model']],'as':_0x5c2143['as'],'attributes':_0x5c2143['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39306d){logger['info'](_0xc636('0xe'),_0x2dc3b9);logger[_0xc636('0x16')](_0xc636('0xe'),_0x2dc3b9,JSON['stringify'](_0x39306d));_0x7183be(_0x39306d);})['catch'](function(_0xaed83f){logger[_0xc636('0x10')](_0xc636('0xe'),_0xaed83f[_0xc636('0x11')],_0x2dc3b9);_0xedc36f(_0x3f8df2[_0xc636('0x10')](0x1f4,_0xaed83f[_0xc636('0x11')]));});});});};exports[_0xc636('0x44')]=function(_0x4617d0){var _0x5f3e34=this;return new Promise(function(_0x2e1a40,_0x7b0b90){return db['CmContact'][_0xc636('0x45')]({'raw':!![],'where':{'phone':_0x4617d0[_0xc636('0x6')][_0xc636('0x8')][_0xc636('0x46')]},'attributes':['id',_0xc636('0x47')],'order':[['id',_0xc636('0x48')]]})[_0xc636('0xd')](function(_0x1c1c0a){logger[_0xc636('0x15')]('getContactByPhone',_0x4617d0);logger[_0xc636('0x16')]('getContactByPhone',_0x4617d0,JSON['stringify'](_0x1c1c0a));_0x2e1a40(_0x1c1c0a);})[_0xc636('0x17')](function(_0x14433b){logger[_0xc636('0x10')](_0xc636('0x49'),_0x14433b[_0xc636('0x11')],_0x4617d0);_0x7b0b90(_0x5f3e34[_0xc636('0x10')](0x1f4,_0x14433b['message']));});});};exports[_0xc636('0x4a')]=function(_0x4911b8){var _0x338b99=this;return new Promise(function(_0x22d742,_0x1932cf){return db[_0xc636('0x35')][_0xc636('0x20')](function(_0x42c8da){var _0x2d6a10=_0x4911b8['options']&&_0x4911b8[_0xc636('0x6')][_0xc636('0x8')]?_0x4911b8[_0xc636('0x6')][_0xc636('0x8')]:{};return db['CmHopper'][_0xc636('0x2e')](_0x4911b8[_0xc636('0x1a')],{'where':_0x2d6a10,'transaction':_0x42c8da})[_0xc636('0xd')](function(_0x45400c){logger['info']('ResetActiveCalls',_0x4911b8);logger[_0xc636('0x16')]('ResetActiveCalls',_0x4911b8,JSON[_0xc636('0xf')](_0x45400c));_0x22d742(_0x45400c);})[_0xc636('0x17')](function(_0x286f52){logger[_0xc636('0x10')](_0xc636('0x4a'),_0x286f52[_0xc636('0x11')],_0x4911b8);_0x1932cf(_0x338b99[_0xc636('0x10')](0x1f4,_0x286f52[_0xc636('0x11')]));});});});};exports[_0xc636('0x4b')]=function(_0x1cc54c){var _0x3c7819=this;var _0x2b2af9=_0x1cc54c[_0xc636('0x1a')]['where'][_0xc636('0x4c')];var _0x2d7eee=_0x1cc54c['body'][_0xc636('0x8')][_0xc636('0x4d')];var _0x481f95=_0x1cc54c[_0xc636('0x1a')][_0xc636('0x8')][_0xc636('0x4e')];return new Promise(function(_0x6282a0,_0x606476){return db[_0xc636('0x13')][_0xc636('0x21')]({'where':{'voiceQueueId':{'$in':_0x2b2af9},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc636('0x35')][_0xc636('0x3c')]('NOW()\x20+\x20INTERVAL\x20'+_0x2d7eee+_0xc636('0x4f')),'$gt':db[_0xc636('0x35')]['literal'](_0xc636('0x50'))}},'UserId':{'$in':_0x481f95}},'include':[{'model':db[_0xc636('0x1e')],'as':'Contact'},{'model':db['User'],'as':_0xc636('0x29'),'attributes':['id',_0xc636('0x2a'),_0xc636('0x51')]},{'model':db[_0xc636('0x52')],'as':_0xc636('0x53')}]})[_0xc636('0xd')](function(_0x1e74ad){if(_0x1e74ad[_0xc636('0x2b')]>0x0){return db[_0xc636('0x35')]['transaction'](function(_0x3a177f){return db[_0xc636('0x13')][_0xc636('0x2e')]({'recallmeNotifiedDate':db[_0xc636('0x35')][_0xc636('0x3c')]('NOW()')},{'where':{'id':{'$in':_[_0xc636('0xc')](_0x1e74ad,'id')}},'transaction':_0x3a177f})['then'](function(){_0x6282a0(_0x1e74ad);})[_0xc636('0x17')](function(_0x529003){logger[_0xc636('0x10')](_0xc636('0x4b'),_0x529003[_0xc636('0x11')],_0x1cc54c);_0x606476(_0x3c7819['error'](0x1f4,_0x529003[_0xc636('0x11')]));});})[_0xc636('0x17')](function(_0x3956cb){logger[_0xc636('0x10')](_0xc636('0x4b'),_0x3956cb['message'],_0x1cc54c);_0x606476(_0x3c7819[_0xc636('0x10')](0x1f4,_0x3956cb[_0xc636('0x11')]));});}else{_0x6282a0(_0x1e74ad);}});});}; \ No newline at end of file +var _0xf4b4=['stringify','catch','error','message','ShowCmHopper','find','debug','CreateCmHopper','create','UpdateCmHopper','update','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','Agent','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','info'];(function(_0x223792,_0x140f1c){var _0x97cb8f=function(_0x5536d6){while(--_0x5536d6){_0x223792['push'](_0x223792['shift']());}};_0x97cb8f(++_0x140f1c);}(_0xf4b4,0x92));var _0x4f4b=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0xf4b4[_0x4d0d85];return _0x290a74;};'use strict';var _=require('lodash');var util=require(_0x4f4b('0x0'));var moment=require(_0x4f4b('0x1'));var BPromise=require(_0x4f4b('0x2'));var db=require(_0x4f4b('0x3'))['db'];var logger=require(_0x4f4b('0x4'))(_0x4f4b('0x5'));exports[_0x4f4b('0x6')]=function(_0x55c374){var _0x323c11=this;return new Promise(function(_0x5f00eb,_0xd1db7b){return db[_0x4f4b('0x7')][_0x4f4b('0x8')]({'raw':_0x55c374[_0x4f4b('0x9')]?_0x55c374[_0x4f4b('0x9')][_0x4f4b('0xa')]===undefined?!![]:![]:!![],'where':_0x55c374['options']?_0x55c374[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null,'attributes':_0x55c374[_0x4f4b('0x9')]?_0x55c374[_0x4f4b('0x9')][_0x4f4b('0xc')]||null:null,'limit':_0x55c374[_0x4f4b('0x9')]?_0x55c374[_0x4f4b('0x9')]['limit']||null:null,'include':_0x55c374[_0x4f4b('0x9')]?_0x55c374['options']['include']?_['map'](_0x55c374[_0x4f4b('0x9')][_0x4f4b('0xd')],function(_0x58e77e){return{'model':db[_0x58e77e['model']],'as':_0x58e77e['as'],'attributes':_0x58e77e[_0x4f4b('0xc')],'include':_0x58e77e['include']?_[_0x4f4b('0xe')](_0x58e77e['include'],function(_0x94a5d5){return{'model':db[_0x94a5d5[_0x4f4b('0xf')]],'as':_0x94a5d5['as'],'attributes':_0x94a5d5[_0x4f4b('0xc')],'include':_0x94a5d5[_0x4f4b('0xd')]?_['map'](_0x94a5d5[_0x4f4b('0xd')],function(_0x29a823){return{'model':db[_0x29a823[_0x4f4b('0xf')]],'as':_0x29a823['as'],'attributes':_0x29a823[_0x4f4b('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x10')](function(_0x584e78){logger[_0x4f4b('0x11')](_0x4f4b('0x6'),_0x55c374);logger['debug'](_0x4f4b('0x6'),_0x55c374,JSON[_0x4f4b('0x12')](_0x584e78));_0x5f00eb(_0x584e78);})[_0x4f4b('0x13')](function(_0x5ee0d2){logger[_0x4f4b('0x14')](_0x4f4b('0x6'),_0x5ee0d2[_0x4f4b('0x15')],_0x55c374);_0xd1db7b(_0x323c11['error'](0x1f4,_0x5ee0d2[_0x4f4b('0x15')]));});});};exports[_0x4f4b('0x16')]=function(_0x6b6dcd){var _0x45ed1a=this;return new Promise(function(_0x3fbf8f,_0x8293f0){return db['CmHopper'][_0x4f4b('0x17')]({'raw':_0x6b6dcd[_0x4f4b('0x9')]?_0x6b6dcd[_0x4f4b('0x9')][_0x4f4b('0xa')]===undefined?!![]:![]:!![],'where':_0x6b6dcd[_0x4f4b('0x9')]?_0x6b6dcd['options'][_0x4f4b('0xb')]||null:null,'attributes':_0x6b6dcd[_0x4f4b('0x9')]?_0x6b6dcd[_0x4f4b('0x9')][_0x4f4b('0xc')]||null:null,'include':_0x6b6dcd[_0x4f4b('0x9')]?_0x6b6dcd[_0x4f4b('0x9')]['include']?_[_0x4f4b('0xe')](_0x6b6dcd[_0x4f4b('0x9')][_0x4f4b('0xd')],function(_0x293f5e){return{'model':db[_0x293f5e[_0x4f4b('0xf')]],'as':_0x293f5e['as'],'attributes':_0x293f5e[_0x4f4b('0xc')],'include':_0x293f5e[_0x4f4b('0xd')]?_['map'](_0x293f5e['include'],function(_0x2247a3){return{'model':db[_0x2247a3[_0x4f4b('0xf')]],'as':_0x2247a3['as'],'attributes':_0x2247a3[_0x4f4b('0xc')],'include':_0x2247a3[_0x4f4b('0xd')]?_[_0x4f4b('0xe')](_0x2247a3[_0x4f4b('0xd')],function(_0xd8416f){return{'model':db[_0xd8416f[_0x4f4b('0xf')]],'as':_0xd8416f['as'],'attributes':_0xd8416f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23865a){logger[_0x4f4b('0x11')]('ShowCmHopper',_0x6b6dcd);logger[_0x4f4b('0x18')](_0x4f4b('0x16'),_0x6b6dcd,JSON[_0x4f4b('0x12')](_0x23865a));_0x3fbf8f(_0x23865a);})['catch'](function(_0x24b211){logger[_0x4f4b('0x14')](_0x4f4b('0x16'),_0x24b211['message'],_0x6b6dcd);_0x8293f0(_0x45ed1a[_0x4f4b('0x14')](0x1f4,_0x24b211[_0x4f4b('0x15')]));});});};exports[_0x4f4b('0x19')]=function(_0x1eff7a){var _0x2b2031=this;return new Promise(function(_0x4fefa6,_0x4072c4){return db['CmHopper'][_0x4f4b('0x1a')](_0x1eff7a['body'],{'raw':_0x1eff7a[_0x4f4b('0x9')]?_0x1eff7a['options'][_0x4f4b('0xa')]===undefined?!![]:![]:!![]})[_0x4f4b('0x10')](function(_0x35955a){logger[_0x4f4b('0x11')]('CreateCmHopper',_0x1eff7a);logger[_0x4f4b('0x18')](_0x4f4b('0x19'),_0x1eff7a,JSON[_0x4f4b('0x12')](_0x35955a));_0x4fefa6(_0x35955a);})['catch'](function(_0x19ca3f){logger['error'](_0x4f4b('0x19'),_0x19ca3f[_0x4f4b('0x15')],_0x1eff7a);_0x4072c4(_0x2b2031['error'](0x1f4,_0x19ca3f['message']));});});};exports[_0x4f4b('0x1b')]=function(_0x5e6448){var _0x1eacb0=this;return new Promise(function(_0x36d30e,_0x56d61c){return db['CmHopper'][_0x4f4b('0x1c')](_0x5e6448[_0x4f4b('0x1d')],{'raw':_0x5e6448['options']?_0x5e6448['options'][_0x4f4b('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6448[_0x4f4b('0x9')]?_0x5e6448[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null,'attributes':_0x5e6448[_0x4f4b('0x9')]?_0x5e6448['options'][_0x4f4b('0xc')]||null:null,'limit':_0x5e6448[_0x4f4b('0x9')]?_0x5e6448[_0x4f4b('0x9')][_0x4f4b('0x1e')]||null:null})[_0x4f4b('0x10')](function(_0x8496c8){logger[_0x4f4b('0x11')](_0x4f4b('0x1b'),_0x5e6448);logger[_0x4f4b('0x11')](_0x4f4b('0x1f'),JSON['stringify'](_0x5e6448['options'][_0x4f4b('0xb')]),_0x5e6448['body'][_0x4f4b('0x20')]);logger[_0x4f4b('0x18')]('UpdateCmHopper',_0x5e6448,JSON[_0x4f4b('0x12')](_0x8496c8));_0x36d30e(_0x8496c8);})[_0x4f4b('0x13')](function(_0x47a2ab){logger[_0x4f4b('0x14')](_0x4f4b('0x1b'),_0x47a2ab[_0x4f4b('0x15')],_0x5e6448);_0x56d61c(_0x1eacb0['error'](0x1f4,_0x47a2ab['message']));});});};exports[_0x4f4b('0x21')]=function(_0x13a70c){var _0x29e180=this;return new Promise(function(_0x2c1a03,_0x2aff54){return db['CmHopper']['destroy']({'where':_0x13a70c[_0x4f4b('0x9')]?_0x13a70c[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null})[_0x4f4b('0x10')](function(_0x434f56){logger['info']('DestroyCmHopper',_0x13a70c);logger[_0x4f4b('0x18')](_0x4f4b('0x21'),_0x13a70c,JSON['stringify'](_0x434f56));_0x2c1a03(_0x434f56);})[_0x4f4b('0x13')](function(_0x510baa){logger['error'](_0x4f4b('0x21'),_0x510baa[_0x4f4b('0x15')],_0x13a70c);_0x2aff54(_0x29e180[_0x4f4b('0x14')](0x1f4,_0x510baa['message']));});});};exports[_0x4f4b('0x22')]=function(_0x311c83){var _0x4e144c=this;return new Promise(function(_0x5c85da,_0x8b7d83){return db[_0x4f4b('0x23')][_0x4f4b('0x24')]()[_0x4f4b('0x10')](function(_0x4b6c8b){return db['sequelize'][_0x4f4b('0x25')](function(_0x3b317e){return db[_0x4f4b('0x7')][_0x4f4b('0x8')]({'where':_0x311c83[_0x4f4b('0x9')]?_0x311c83[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null,'attributes':_0x311c83[_0x4f4b('0x9')]?_0x311c83['options'][_0x4f4b('0xc')]||null:null,'limit':_0x311c83['options']?_0x311c83[_0x4f4b('0x9')][_0x4f4b('0x1e')]||null:null,'order':_0x311c83['options']?_0x311c83[_0x4f4b('0x9')][_0x4f4b('0x26')]||null:null,'transaction':_0x3b317e,'lock':_0x3b317e[_0x4f4b('0x27')][_0x4f4b('0x28')],'include':[{'model':db['CmContact'],'as':_0x4f4b('0x29'),'attributes':_[_0x4f4b('0x2a')](_0x4b6c8b)},{'model':db['User'],'as':_0x4f4b('0x2b'),'attributes':['id','name','voicePause']}]})[_0x4f4b('0x10')](function(_0x373142){var _0x669dea=[];var _0x4acd32=[];for(var _0x470a06=0x0;_0x470a06<_0x373142['length'];_0x470a06+=0x1){var _0x4d898a=_0x373142[_0x470a06]['UserId'];if(_0x4d898a===null){_0x669dea[_0x4f4b('0x2c')](_0x373142[_0x470a06][_0x4f4b('0x1c')](_0x311c83['body'],{'transaction':_0x3b317e}));}else if(!_0x4acd32[_0x4f4b('0x2d')](_0x4d898a)){_0x4acd32[_0x4f4b('0x2c')](_0x4d898a);_0x669dea['push'](_0x373142[_0x470a06][_0x4f4b('0x1c')](_0x311c83[_0x4f4b('0x1d')],{'transaction':_0x3b317e}));}}return BPromise[_0x4f4b('0x2e')](_0x669dea);});})[_0x4f4b('0x10')](function(_0x5dd48c){logger[_0x4f4b('0x11')](_0x4f4b('0x22'),_0x311c83);if(_0x5dd48c[_0x4f4b('0x2f')]>0x0){logger[_0x4f4b('0x11')](_0x4f4b('0x30'),_0x5dd48c[0x0]['dataValues']['id'],_0x5dd48c[0x0][_0x4f4b('0x31')]['ContactId'],_0x5dd48c[0x0][_0x4f4b('0x31')][_0x4f4b('0x20')]);}logger[_0x4f4b('0x18')](_0x4f4b('0x22'),_0x311c83,JSON['stringify'](_0x5dd48c));_0x5c85da(_0x5dd48c);})[_0x4f4b('0x13')](function(_0x3e6883){logger[_0x4f4b('0x14')]('GetContactDialer',_0x3e6883['message'],_0x311c83);_0x8b7d83(_0x4e144c['error'](0x1f4,_0x3e6883[_0x4f4b('0x15')]));});});});};exports[_0x4f4b('0x32')]=function(_0x273de7){var _0x2b203f=this;return new Promise(function(_0x55ef5a,_0x3dd2f6){return db[_0x4f4b('0x33')][_0x4f4b('0x25')](function(_0x1677f4){return db[_0x4f4b('0x34')][_0x4f4b('0x1a')](_0x273de7[_0x4f4b('0x1d')],{'raw':_0x273de7[_0x4f4b('0x9')]?_0x273de7[_0x4f4b('0x9')][_0x4f4b('0xa')]===undefined?!![]:![]:!![],'transaction':_0x1677f4})[_0x4f4b('0x10')](function(){logger[_0x4f4b('0x11')](_0x4f4b('0x35'),JSON[_0x4f4b('0x12')](_0x273de7[_0x4f4b('0x9')][_0x4f4b('0xb')]),_0x273de7[_0x4f4b('0x9')]['where']['active']);return db[_0x4f4b('0x7')][_0x4f4b('0x36')]({'where':_0x273de7[_0x4f4b('0x9')]?_0x273de7[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null,'transaction':_0x1677f4});});})[_0x4f4b('0x10')](function(_0xbd29a6){logger[_0x4f4b('0x11')](_0x4f4b('0x32'),_0x273de7);logger['debug'](_0x4f4b('0x32'),_0x273de7,JSON[_0x4f4b('0x12')](_0xbd29a6));_0x55ef5a(_0xbd29a6);})[_0x4f4b('0x13')](function(_0x59fddc){logger['error'](_0x4f4b('0x32'),_0x59fddc['message'],_0x273de7);_0x3dd2f6(_0x2b203f[_0x4f4b('0x14')](0x1f4,_0x59fddc[_0x4f4b('0x15')]));});});};exports['CountReScheduled']=function(_0x34d610){var _0x155a44=this;return new Promise(function(_0x547001,_0x43c5ab){return db[_0x4f4b('0x7')][_0x4f4b('0x8')]({'raw':_0x34d610[_0x4f4b('0x9')]?_0x34d610[_0x4f4b('0x9')][_0x4f4b('0xa')]===undefined?!![]:![]:!![],'where':_0x34d610[_0x4f4b('0x9')]?_0x34d610[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null,'attributes':[[db[_0x4f4b('0x33')]['fn'](_0x4f4b('0x37'),db[_0x4f4b('0x33')]['fn']('IF',db[_0x4f4b('0x33')][_0x4f4b('0x38')](_0x4f4b('0x39')+util[_0x4f4b('0x3a')]('\x22%s\x22',moment()[_0x4f4b('0x3a')](_0x4f4b('0x3b')))+'\x20,\x201,\x20null'))),_0x4f4b('0x3c')]]})[_0x4f4b('0x10')](function(_0x44694b){logger['info'](_0x4f4b('0x3d'),_0x34d610);logger[_0x4f4b('0x18')](_0x4f4b('0x3d'),_0x34d610,JSON[_0x4f4b('0x12')](_0x44694b));_0x547001(_0x44694b);})['catch'](function(_0x35e762){logger[_0x4f4b('0x14')](_0x4f4b('0x3d'),_0x35e762[_0x4f4b('0x15')],_0x34d610);_0x43c5ab(_0x155a44[_0x4f4b('0x14')](0x1f4,_0x35e762[_0x4f4b('0x15')]));});});};exports[_0x4f4b('0x3e')]=function(_0x122789){var _0x391fbe=this;return new Promise(function(_0x24709f,_0x136584){return db[_0x4f4b('0x23')][_0x4f4b('0x24')]()[_0x4f4b('0x10')](function(){return db['sequelize'][_0x4f4b('0x25')](function(_0x3755da){return db[_0x4f4b('0x7')][_0x4f4b('0x8')]({'where':_0x122789[_0x4f4b('0x9')]?_0x122789[_0x4f4b('0x9')][_0x4f4b('0xb')]||null:null,'attributes':_0x122789['options']?_0x122789[_0x4f4b('0x9')][_0x4f4b('0xc')]||null:null,'limit':0x1,'order':_0x122789[_0x4f4b('0x9')]?_0x122789[_0x4f4b('0x9')][_0x4f4b('0x26')]||null:null,'group':db[_0x4f4b('0x7')][_0x4f4b('0x3f')],'transaction':_0x3755da,'lock':_0x3755da['LOCK'][_0x4f4b('0x28')],'include':_0x122789[_0x4f4b('0x9')]?_0x122789[_0x4f4b('0x9')][_0x4f4b('0xd')]?_[_0x4f4b('0xe')](_0x122789[_0x4f4b('0x9')][_0x4f4b('0xd')],function(_0x5b3c35){return{'model':db[_0x5b3c35[_0x4f4b('0xf')]],'as':_0x5b3c35['as'],'attributes':_0x5b3c35[_0x4f4b('0xc')],'include':_0x5b3c35[_0x4f4b('0xd')]?_[_0x4f4b('0xe')](_0x5b3c35[_0x4f4b('0xd')],function(_0x5b2389){return{'model':db[_0x5b2389[_0x4f4b('0xf')]],'as':_0x5b2389['as'],'attributes':_0x5b2389[_0x4f4b('0xc')],'include':_0x5b2389[_0x4f4b('0xd')]?_[_0x4f4b('0xe')](_0x5b2389[_0x4f4b('0xd')],function(_0x3c84b7){return{'model':db[_0x3c84b7[_0x4f4b('0xf')]],'as':_0x3c84b7['as'],'attributes':_0x3c84b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x10')](function(_0x471776){var _0x17baf0=[];for(var _0x102879=0x0;_0x102879<_0x471776[_0x4f4b('0x2f')];_0x102879+=0x1){_0x17baf0[_0x4f4b('0x2c')](_0x471776[_0x102879]['update'](_0x122789[_0x4f4b('0x1d')],{'transaction':_0x3755da}));}return BPromise['all'](_0x17baf0);});})['then'](function(_0x102feb){logger[_0x4f4b('0x11')]('GetContactRecallMe',_0x122789);logger['debug'](_0x4f4b('0x3e'),_0x122789,JSON[_0x4f4b('0x12')](_0x102feb));_0x24709f(_0x102feb);})[_0x4f4b('0x13')](function(_0x2a4b69){logger['error'](_0x4f4b('0x3e'),_0x2a4b69['message'],_0x122789);_0x136584(_0x391fbe['error'](0x1f4,_0x2a4b69['message']));});});});};exports[_0x4f4b('0x40')]=function(_0x316787){var _0x37e3e6=this;return new Promise(function(_0x2bb8e6,_0x3ba547){db[_0x4f4b('0x23')]['describe']()[_0x4f4b('0x10')](function(_0x12404e){return db[_0x4f4b('0x7')]['findAll']({'raw':_0x316787['options']?_0x316787[_0x4f4b('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x316787[_0x4f4b('0x9')]?_0x316787['options'][_0x4f4b('0xb')]||null:null,'attributes':_0x316787['options']?_0x316787[_0x4f4b('0x9')][_0x4f4b('0xc')]||null:null,'limit':_0x316787[_0x4f4b('0x9')]?_0x316787[_0x4f4b('0x9')][_0x4f4b('0x1e')]||null:null,'include':_0x316787['options']?_0x316787['options'][_0x4f4b('0xd')]?_['map'](_0x316787[_0x4f4b('0x9')][_0x4f4b('0xd')],function(_0x2526d8){return{'model':db[_0x2526d8[_0x4f4b('0xf')]],'as':_0x2526d8['as'],'attributes':_0x2526d8['as']===_0x4f4b('0x29')?_['keys'](_0x12404e):_0x2526d8[_0x4f4b('0xc')],'include':_0x2526d8['include']?_[_0x4f4b('0xe')](_0x2526d8['include'],function(_0xeca1c2){return{'model':db[_0xeca1c2[_0x4f4b('0xf')]],'as':_0xeca1c2['as'],'attributes':_0xeca1c2[_0x4f4b('0xc')],'include':_0xeca1c2[_0x4f4b('0xd')]?_[_0x4f4b('0xe')](_0xeca1c2[_0x4f4b('0xd')],function(_0x3cfd66){return{'model':db[_0x3cfd66[_0x4f4b('0xf')]],'as':_0x3cfd66['as'],'attributes':_0x3cfd66[_0x4f4b('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x10')](function(_0x3d36c1){logger[_0x4f4b('0x11')](_0x4f4b('0x6'),_0x316787);logger[_0x4f4b('0x18')](_0x4f4b('0x6'),_0x316787,JSON[_0x4f4b('0x12')](_0x3d36c1));_0x2bb8e6(_0x3d36c1);})[_0x4f4b('0x13')](function(_0xdd56ce){logger[_0x4f4b('0x14')](_0x4f4b('0x6'),_0xdd56ce[_0x4f4b('0x15')],_0x316787);_0x3ba547(_0x37e3e6[_0x4f4b('0x14')](0x1f4,_0xdd56ce[_0x4f4b('0x15')]));});});});};exports[_0x4f4b('0x41')]=function(_0x2be889){var _0x1c6908=this;return new Promise(function(_0x3560be,_0x45d71c){return db[_0x4f4b('0x23')][_0x4f4b('0x42')]({'raw':!![],'where':{'phone':_0x2be889[_0x4f4b('0x9')]['where'][_0x4f4b('0x43')]},'attributes':['id',_0x4f4b('0x44')],'order':[['id',_0x4f4b('0x45')]]})[_0x4f4b('0x10')](function(_0xfeea38){logger[_0x4f4b('0x11')](_0x4f4b('0x46'),_0x2be889);logger[_0x4f4b('0x18')](_0x4f4b('0x46'),_0x2be889,JSON[_0x4f4b('0x12')](_0xfeea38));_0x3560be(_0xfeea38);})[_0x4f4b('0x13')](function(_0x35a2f2){logger[_0x4f4b('0x14')](_0x4f4b('0x46'),_0x35a2f2[_0x4f4b('0x15')],_0x2be889);_0x45d71c(_0x1c6908[_0x4f4b('0x14')](0x1f4,_0x35a2f2[_0x4f4b('0x15')]));});});};exports[_0x4f4b('0x47')]=function(_0x767f41){var _0x33875f=this;return new Promise(function(_0x1e48ba,_0x1b7c7d){return db[_0x4f4b('0x33')][_0x4f4b('0x25')](function(_0x12652b){var _0x3d83b8=_0x767f41['options']&&_0x767f41[_0x4f4b('0x9')][_0x4f4b('0xb')]?_0x767f41[_0x4f4b('0x9')][_0x4f4b('0xb')]:{};return db[_0x4f4b('0x7')]['update'](_0x767f41[_0x4f4b('0x1d')],{'where':_0x3d83b8,'transaction':_0x12652b})['then'](function(_0xf74542){logger[_0x4f4b('0x11')]('ResetActiveCalls',_0x767f41);logger[_0x4f4b('0x18')](_0x4f4b('0x47'),_0x767f41,JSON[_0x4f4b('0x12')](_0xf74542));_0x1e48ba(_0xf74542);})[_0x4f4b('0x13')](function(_0x3bb51b){logger['error'](_0x4f4b('0x47'),_0x3bb51b[_0x4f4b('0x15')],_0x767f41);_0x1b7c7d(_0x33875f[_0x4f4b('0x14')](0x1f4,_0x3bb51b[_0x4f4b('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x2a6295){var _0x44ed9e=this;var _0x58638c=_0x2a6295[_0x4f4b('0x1d')][_0x4f4b('0xb')]['voiceQueueIds'];var _0x261987=_0x2a6295['body']['where'][_0x4f4b('0x48')];var _0x1dc463=_0x2a6295['body'][_0x4f4b('0xb')][_0x4f4b('0x49')];return new Promise(function(_0x1ba94a,_0x45daa9){return db[_0x4f4b('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x58638c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4f4b('0x33')][_0x4f4b('0x38')](_0x4f4b('0x4a')+_0x261987+_0x4f4b('0x4b')),'$gt':db['sequelize'][_0x4f4b('0x38')](_0x4f4b('0x4c'))}},'UserId':{'$in':_0x1dc463}},'include':[{'model':db['CmContact'],'as':_0x4f4b('0x29')},{'model':db['User'],'as':_0x4f4b('0x2b'),'attributes':['id',_0x4f4b('0x4d'),_0x4f4b('0x4e')]},{'model':db[_0x4f4b('0x4f')],'as':_0x4f4b('0x50')}]})['then'](function(_0x1c1e6b){if(_0x1c1e6b[_0x4f4b('0x2f')]>0x0){return db['sequelize']['transaction'](function(_0x439fa0){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x4f4b('0x33')][_0x4f4b('0x38')](_0x4f4b('0x4c'))},{'where':{'id':{'$in':_[_0x4f4b('0xe')](_0x1c1e6b,'id')}},'transaction':_0x439fa0})[_0x4f4b('0x10')](function(){_0x1ba94a(_0x1c1e6b);})[_0x4f4b('0x13')](function(_0x2c1775){logger[_0x4f4b('0x14')](_0x4f4b('0x51'),_0x2c1775[_0x4f4b('0x15')],_0x2a6295);_0x45daa9(_0x44ed9e[_0x4f4b('0x14')](0x1f4,_0x2c1775[_0x4f4b('0x15')]));});})[_0x4f4b('0x13')](function(_0x440804){logger[_0x4f4b('0x14')](_0x4f4b('0x51'),_0x440804[_0x4f4b('0x15')],_0x2a6295);_0x45daa9(_0x44ed9e['error'](0x1f4,_0x440804[_0x4f4b('0x15')]));});}else{_0x1ba94a(_0x1c1e6b);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index fb0999e..a1d27dd 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 _0x0852=['../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router'];(function(_0xf8c8f5,_0x21c735){var _0x2691c4=function(_0x201865){while(--_0x201865){_0xf8c8f5['push'](_0xf8c8f5['shift']());}};_0x2691c4(++_0x21c735);}(_0x0852,0x16a));var _0x2085=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0852[_0x500419];return _0x241c1a;};'use strict';var express=require(_0x2085('0x0'));var router=express[_0x2085('0x1')]();var auth=require(_0x2085('0x2'));var controller=require(_0x2085('0x3'));router[_0x2085('0x4')]('/',auth[_0x2085('0x5')](),controller[_0x2085('0x6')]);router[_0x2085('0x4')](_0x2085('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x2085('0x4')](_0x2085('0x8'),auth[_0x2085('0x5')](),controller[_0x2085('0x9')]);router[_0x2085('0x4')](_0x2085('0xa'),auth[_0x2085('0x5')](),controller[_0x2085('0xb')]);router[_0x2085('0x4')](_0x2085('0xc'),auth['isAuthenticated'](),controller[_0x2085('0xd')]);router[_0x2085('0x4')](_0x2085('0xe'),auth['isAuthenticated'](),controller[_0x2085('0xf')]);router[_0x2085('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2085('0x10')](_0x2085('0x11'),auth['isAuthenticated'](),controller[_0x2085('0x12')]);router[_0x2085('0x10')](_0x2085('0x13'),auth['isAuthenticated'](),controller[_0x2085('0x14')]);router[_0x2085('0x15')](_0x2085('0xc'),auth[_0x2085('0x5')](),controller[_0x2085('0x16')]);router[_0x2085('0x17')]('/:id',auth[_0x2085('0x5')](),controller[_0x2085('0x18')]);module[_0x2085('0x19')]=router; \ No newline at end of file +var _0x9653=['index','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','/preview','getPreview','/timezone','put','update','delete','destroy','exports','express','Router','get'];(function(_0x3ebe57,_0x140457){var _0x91e8b0=function(_0x1d4f9e){while(--_0x1d4f9e){_0x3ebe57['push'](_0x3ebe57['shift']());}};_0x91e8b0(++_0x140457);}(_0x9653,0x1cb));var _0x3965=function(_0x152f4c,_0x3b66cf){_0x152f4c=_0x152f4c-0x0;var _0x42960e=_0x9653[_0x152f4c];return _0x42960e;};'use strict';var express=require(_0x3965('0x0'));var router=express[_0x3965('0x1')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0x3965('0x2')]('/',auth['isAuthenticated'](),controller[_0x3965('0x3')]);router['get'](_0x3965('0x4'),auth[_0x3965('0x5')](),controller[_0x3965('0x6')]);router[_0x3965('0x2')](_0x3965('0x7'),auth[_0x3965('0x5')](),controller['getOpenContacts']);router[_0x3965('0x2')](_0x3965('0x8'),auth[_0x3965('0x5')](),controller[_0x3965('0x9')]);router[_0x3965('0x2')](_0x3965('0xa'),auth[_0x3965('0x5')](),controller[_0x3965('0xb')]);router[_0x3965('0x2')]('/:id/previewrecall',auth[_0x3965('0x5')](),controller[_0x3965('0xc')]);router['post']('/',auth[_0x3965('0x5')](),controller['create']);router[_0x3965('0xd')](_0x3965('0xe'),auth['isAuthenticated'](),controller[_0x3965('0xf')]);router[_0x3965('0xd')](_0x3965('0x10'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x3965('0x11')]('/:id',auth[_0x3965('0x5')](),controller[_0x3965('0x12')]);router[_0x3965('0x13')](_0x3965('0xa'),auth[_0x3965('0x5')](),controller[_0x3965('0x14')]);module[_0x3965('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index b4fd6a6..e03d9d6 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 _0x8504=['moment','sequelize','exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8504,0x118));var _0x4850=function(_0x1aebfe,_0xb00c5b){_0x1aebfe=_0x1aebfe-0x0;var _0x3f0f9b=_0x8504[_0x1aebfe];return _0x3f0f9b;};'use strict';var moment=require(_0x4850('0x0'));var Sequelize=require(_0x4850('0x1'));module[_0x4850('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x4850('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4850('0x5')],'defaultValue':moment()[_0x4850('0x6')](_0x4850('0x7'))},'countbusyretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4850('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0fe9=['format','INTEGER','STRING','DATE'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x0fe9,0x1c9));var _0x90fe=function(_0x646368,_0x393682){_0x646368=_0x646368-0x0;var _0x1fe0c9=_0x0fe9[_0x646368];return _0x1fe0c9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x90fe('0x0')]},'phone':{'type':Sequelize[_0x90fe('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x90fe('0x2')],'defaultValue':moment()[_0x90fe('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x90fe('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index b1acf90..c707d38 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 _0xe614=['reject','save','update','then','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','where','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xe614,0x1bf));var _0x4e61=function(_0x1dd577,_0x3f8604){_0x1dd577=_0x1dd577-0x0;var _0x4df4c4=_0xe614[_0x1dd577];return _0x4df4c4;};'use strict';var emlformat=require(_0x4e61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e61('0x1'));var jsonpatch=require(_0x4e61('0x2'));var rp=require(_0x4e61('0x3'));var moment=require('moment');var BPromise=require(_0x4e61('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e61('0x5'));var sox=require(_0x4e61('0x6'));var csv=require(_0x4e61('0x7'));var ejs=require(_0x4e61('0x8'));var fs=require('fs');var fs_extra=require(_0x4e61('0x9'));var _=require(_0x4e61('0xa'));var squel=require('squel');var crypto=require(_0x4e61('0xb'));var jsforce=require(_0x4e61('0xc'));var deskjs=require(_0x4e61('0xd'));var toCsv=require(_0x4e61('0x7'));var querystring=require(_0x4e61('0xe'));var Papa=require(_0x4e61('0xf'));var Redis=require(_0x4e61('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e61('0x11'));var as=require(_0x4e61('0x12'));var hardwareService=require(_0x4e61('0x13'));var logger=require(_0x4e61('0x14'))(_0x4e61('0x15'));var utils=require(_0x4e61('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1152a9,_0x2553f6){_0x2553f6=_0x2553f6||0xcc;return function(_0x552ff0){if(_0x552ff0){return _0x1152a9[_0x4e61('0x17')](_0x2553f6);}return _0x1152a9[_0x4e61('0x18')](_0x2553f6)[_0x4e61('0x19')]();};}function respondWithResult(_0x513f22,_0xdc28fc){_0xdc28fc=_0xdc28fc||0xc8;return function(_0x4fda92){if(_0x4fda92){return _0x513f22[_0x4e61('0x18')](_0xdc28fc)[_0x4e61('0x1a')](_0x4fda92);}};}function respondWithFilteredResult(_0x5ec97c,_0x4faa4e){return function(_0x4d6595){if(_0x4d6595){var _0x20279e=typeof _0x4faa4e['offset']===_0x4e61('0x1b')&&typeof _0x4faa4e[_0x4e61('0x1c')]===_0x4e61('0x1b');var _0x5e831c=_0x4d6595['count'];var _0x416f72=_0x20279e?0x0:_0x4faa4e[_0x4e61('0x1d')];var _0x7659cb=_0x20279e?_0x4d6595[_0x4e61('0x1e')]:_0x4faa4e['offset']+_0x4faa4e[_0x4e61('0x1c')];var _0x3d0e1f;if(_0x7659cb>=_0x5e831c){_0x7659cb=_0x5e831c;_0x3d0e1f=0xc8;}else{_0x3d0e1f=0xce;}_0x5ec97c[_0x4e61('0x18')](_0x3d0e1f);return _0x5ec97c['set'](_0x4e61('0x1f'),_0x416f72+'-'+_0x7659cb+'/'+_0x5e831c)[_0x4e61('0x1a')](_0x4d6595);}return null;};}function patchUpdates(_0x4ceddd){return function(_0x5f1149){try{jsonpatch[_0x4e61('0x20')](_0x5f1149,_0x4ceddd,!![]);}catch(_0x564365){return BPromise[_0x4e61('0x21')](_0x564365);}return _0x5f1149[_0x4e61('0x22')]();};}function saveUpdates(_0x51ae00,_0x3096f6){return function(_0x1af784){if(_0x1af784){return _0x1af784[_0x4e61('0x23')](_0x51ae00)['then'](function(_0x56d1ef){return _0x56d1ef;});}return null;};}function removeEntity(_0x29b3c7,_0x325b84){return function(_0x123b7f){if(_0x123b7f){return _0x123b7f['destroy']()[_0x4e61('0x24')](function(){var _0x4fc0dd=_0x123b7f['get']({'plain':!![]});var _0x3e99d0=_0x4e61('0x25');return db[_0x4e61('0x26')][_0x4e61('0x27')]({'where':{'type':_0x3e99d0,'resourceId':_0x4fc0dd['id']}})[_0x4e61('0x24')](function(){return _0x123b7f;});})[_0x4e61('0x24')](function(){_0x29b3c7[_0x4e61('0x18')](0xcc)[_0x4e61('0x19')]();});}};}function handleEntityNotFound(_0x282db8,_0x1f1fa9){return function(_0x389a92){if(!_0x389a92){_0x282db8[_0x4e61('0x17')](0x194);}return _0x389a92;};}function handleError(_0x45929b,_0x58f25b){_0x58f25b=_0x58f25b||0x1f4;return function(_0xcadf81){logger[_0x4e61('0x28')](_0xcadf81[_0x4e61('0x29')]);if(_0xcadf81[_0x4e61('0x2a')]){delete _0xcadf81['name'];}_0x45929b[_0x4e61('0x18')](_0x58f25b)['send'](_0xcadf81);};}exports['index']=function(_0x190446,_0x5d789a){var _0x472c02={},_0x56fa51={},_0x3377c6={'count':0x0,'rows':[]};var _0x3c869b=_[_0x4e61('0x2b')](db[_0x4e61('0x2c')][_0x4e61('0x2d')],function(_0x486189){return{'name':_0x486189['fieldName'],'type':_0x486189[_0x4e61('0x2e')][_0x4e61('0x2f')]};});_0x56fa51[_0x4e61('0x30')]=_[_0x4e61('0x2b')](_0x3c869b,_0x4e61('0x2a'));_0x56fa51[_0x4e61('0x31')]=_[_0x4e61('0x32')](_0x190446[_0x4e61('0x31')]);_0x56fa51['filters']=_[_0x4e61('0x33')](_0x56fa51['model'],_0x56fa51[_0x4e61('0x31')]);_0x472c02['attributes']=_[_0x4e61('0x33')](_0x56fa51[_0x4e61('0x30')],qs[_0x4e61('0x34')](_0x190446[_0x4e61('0x31')][_0x4e61('0x34')]));_0x472c02[_0x4e61('0x35')]=_0x472c02[_0x4e61('0x35')][_0x4e61('0x36')]?_0x472c02[_0x4e61('0x35')]:_0x56fa51[_0x4e61('0x30')];if(!_0x190446[_0x4e61('0x31')]['hasOwnProperty'](_0x4e61('0x37'))){_0x472c02['limit']=qs[_0x4e61('0x1c')](_0x190446['query'][_0x4e61('0x1c')]);_0x472c02[_0x4e61('0x1d')]=qs[_0x4e61('0x1d')](_0x190446[_0x4e61('0x31')][_0x4e61('0x1d')]);}_0x472c02[_0x4e61('0x38')]=qs[_0x4e61('0x39')](_0x190446[_0x4e61('0x31')][_0x4e61('0x39')]);_0x472c02['where']=qs[_0x4e61('0x3a')](_[_0x4e61('0x3b')](_0x190446[_0x4e61('0x31')],_0x56fa51[_0x4e61('0x3a')]),_0x3c869b);if(_0x190446[_0x4e61('0x31')]['filter']){_0x472c02[_0x4e61('0x3c')]=_['merge'](_0x472c02['where'],{'$or':_[_0x4e61('0x2b')](_0x3c869b,function(_0xa09569){if(_0xa09569[_0x4e61('0x2e')]!=='VIRTUAL'){var _0x362825={};_0x362825[_0xa09569['name']]={'$like':'%'+_0x190446[_0x4e61('0x31')][_0x4e61('0x3d')]+'%'};return _0x362825;}})});}_0x472c02=_[_0x4e61('0x3e')]({},_0x472c02,_0x190446[_0x4e61('0x3f')]);var _0x46ba42={'where':_0x472c02[_0x4e61('0x3c')]};return db['CmHopperAdditionalPhone'][_0x4e61('0x1e')](_0x46ba42)[_0x4e61('0x24')](function(_0x88ffc2){_0x3377c6[_0x4e61('0x1e')]=_0x88ffc2;if(_0x190446[_0x4e61('0x31')]['includeAll']){_0x472c02['include']=[{'all':!![]}];}return db[_0x4e61('0x2c')][_0x4e61('0x40')](_0x472c02);})[_0x4e61('0x24')](function(_0x5798d7){_0x3377c6[_0x4e61('0x41')]=_0x5798d7;return _0x3377c6;})[_0x4e61('0x24')](respondWithFilteredResult(_0x5d789a,_0x472c02))[_0x4e61('0x42')](handleError(_0x5d789a,null));};exports[_0x4e61('0x43')]=function(_0x4e3af4,_0x3fe7e4){var _0x37f3ae={'raw':!![],'where':{'id':_0x4e3af4[_0x4e61('0x44')]['id']}},_0x1272bc={};_0x1272bc['model']=_[_0x4e61('0x32')](db[_0x4e61('0x2c')][_0x4e61('0x2d')]);_0x1272bc['query']=_['keys'](_0x4e3af4[_0x4e61('0x31')]);_0x1272bc['filters']=_['intersection'](_0x1272bc[_0x4e61('0x30')],_0x1272bc[_0x4e61('0x31')]);_0x37f3ae[_0x4e61('0x35')]=_['intersection'](_0x1272bc[_0x4e61('0x30')],qs[_0x4e61('0x34')](_0x4e3af4[_0x4e61('0x31')][_0x4e61('0x34')]));_0x37f3ae['attributes']=_0x37f3ae[_0x4e61('0x35')][_0x4e61('0x36')]?_0x37f3ae[_0x4e61('0x35')]:_0x1272bc[_0x4e61('0x30')];if(_0x4e3af4[_0x4e61('0x31')][_0x4e61('0x45')]){_0x37f3ae[_0x4e61('0x46')]=[{'all':!![]}];}_0x37f3ae=_[_0x4e61('0x3e')]({},_0x37f3ae,_0x4e3af4[_0x4e61('0x3f')]);return db['CmHopperAdditionalPhone'][_0x4e61('0x47')](_0x37f3ae)[_0x4e61('0x24')](handleEntityNotFound(_0x3fe7e4,null))['then'](respondWithResult(_0x3fe7e4,null))[_0x4e61('0x42')](handleError(_0x3fe7e4,null));};exports['create']=function(_0x328daa,_0xa19a58){return db[_0x4e61('0x2c')][_0x4e61('0x48')](_0x328daa[_0x4e61('0x49')],{})[_0x4e61('0x24')](function(_0xd938c9){var _0x5c3ad5=_0x328daa[_0x4e61('0x4a')]['get']({'plain':!![]});if(!_0x5c3ad5)throw new Error(_0x4e61('0x4b'));if(_0x5c3ad5['role']===_0x4e61('0x4a')){var _0x5eefa3=_0xd938c9[_0x4e61('0x4c')]({'plain':!![]});var _0x1fe99f=_0x4e61('0x25');return db[_0x4e61('0x4d')]['find']({'where':{'name':_0x1fe99f,'userProfileId':_0x5c3ad5[_0x4e61('0x4e')]},'raw':!![]})[_0x4e61('0x24')](function(_0x3253bc){if(_0x3253bc&&_0x3253bc[_0x4e61('0x4f')]===0x0){return db[_0x4e61('0x26')][_0x4e61('0x48')]({'name':_0x5eefa3['name'],'resourceId':_0x5eefa3['id'],'type':_0x3253bc[_0x4e61('0x2a')],'sectionId':_0x3253bc['id']},{})[_0x4e61('0x24')](function(){return _0xd938c9;});}else{return _0xd938c9;}})[_0x4e61('0x42')](function(_0x5da83d){logger[_0x4e61('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5da83d);throw _0x5da83d;});}return _0xd938c9;})[_0x4e61('0x24')](respondWithResult(_0xa19a58,0xc9))[_0x4e61('0x42')](handleError(_0xa19a58,null));};exports[_0x4e61('0x23')]=function(_0x57a768,_0x51cda4){if(_0x57a768[_0x4e61('0x49')]['id']){delete _0x57a768[_0x4e61('0x49')]['id'];}return db[_0x4e61('0x2c')][_0x4e61('0x47')]({'where':{'id':_0x57a768[_0x4e61('0x44')]['id']}})[_0x4e61('0x24')](handleEntityNotFound(_0x51cda4,null))['then'](saveUpdates(_0x57a768[_0x4e61('0x49')],null))[_0x4e61('0x24')](respondWithResult(_0x51cda4,null))['catch'](handleError(_0x51cda4,null));};exports[_0x4e61('0x27')]=function(_0x3f6936,_0x50c895){return db[_0x4e61('0x2c')][_0x4e61('0x47')]({'where':{'id':_0x3f6936[_0x4e61('0x44')]['id']}})[_0x4e61('0x24')](handleEntityNotFound(_0x50c895,null))['then'](removeEntity(_0x50c895,null))[_0x4e61('0x42')](handleError(_0x50c895,null));}; \ No newline at end of file +var _0x4ce5=['end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','rimraf','zip-dir','fast-json-patch','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','status'];(function(_0x2b2a4c,_0x19eed6){var _0x3394e9=function(_0x26f8c9){while(--_0x26f8c9){_0x2b2a4c['push'](_0x2b2a4c['shift']());}};_0x3394e9(++_0x19eed6);}(_0x4ce5,0x17a));var _0x54ce=function(_0x20bad7,_0x412692){_0x20bad7=_0x20bad7-0x0;var _0x23504e=_0x4ce5[_0x20bad7];return _0x23504e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54ce('0x0'));var zipdir=require(_0x54ce('0x1'));var jsonpatch=require(_0x54ce('0x2'));var rp=require(_0x54ce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x54ce('0x4'));var util=require('util');var path=require(_0x54ce('0x5'));var sox=require(_0x54ce('0x6'));var csv=require(_0x54ce('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54ce('0x8'));var _=require(_0x54ce('0x9'));var squel=require(_0x54ce('0xa'));var crypto=require('crypto');var jsforce=require(_0x54ce('0xb'));var deskjs=require(_0x54ce('0xc'));var toCsv=require(_0x54ce('0x7'));var querystring=require(_0x54ce('0xd'));var Papa=require(_0x54ce('0xe'));var Redis=require(_0x54ce('0xf'));var authService=require(_0x54ce('0x10'));var qs=require(_0x54ce('0x11'));var as=require(_0x54ce('0x12'));var hardwareService=require(_0x54ce('0x13'));var logger=require(_0x54ce('0x14'))(_0x54ce('0x15'));var utils=require('../../config/utils');var config=require(_0x54ce('0x16'));var licenseUtil=require(_0x54ce('0x17'));var db=require(_0x54ce('0x18'))['db'];function respondWithStatusCode(_0x12a70,_0x554d89){_0x554d89=_0x554d89||0xcc;return function(_0x10abac){if(_0x10abac){return _0x12a70[_0x54ce('0x19')](_0x554d89);}return _0x12a70[_0x54ce('0x1a')](_0x554d89)[_0x54ce('0x1b')]();};}function respondWithResult(_0x350fbe,_0x315b0a){_0x315b0a=_0x315b0a||0xc8;return function(_0x1cddee){if(_0x1cddee){return _0x350fbe[_0x54ce('0x1a')](_0x315b0a)[_0x54ce('0x1c')](_0x1cddee);}};}function respondWithFilteredResult(_0x355883,_0x13ffec){return function(_0x4c52d4){if(_0x4c52d4){var _0x51d721=typeof _0x13ffec[_0x54ce('0x1d')]==='undefined'&&typeof _0x13ffec[_0x54ce('0x1e')]==='undefined';var _0x1340b7=_0x4c52d4[_0x54ce('0x1f')];var _0x407eaa=_0x51d721?0x0:_0x13ffec[_0x54ce('0x1d')];var _0x29f504=_0x51d721?_0x4c52d4[_0x54ce('0x1f')]:_0x13ffec[_0x54ce('0x1d')]+_0x13ffec[_0x54ce('0x1e')];var _0x5e03c6;if(_0x29f504>=_0x1340b7){_0x29f504=_0x1340b7;_0x5e03c6=0xc8;}else{_0x5e03c6=0xce;}_0x355883[_0x54ce('0x1a')](_0x5e03c6);return _0x355883[_0x54ce('0x20')]('Content-Range',_0x407eaa+'-'+_0x29f504+'/'+_0x1340b7)[_0x54ce('0x1c')](_0x4c52d4);}return null;};}function patchUpdates(_0x356d7a){return function(_0x141341){try{jsonpatch[_0x54ce('0x21')](_0x141341,_0x356d7a,!![]);}catch(_0x260124){return BPromise[_0x54ce('0x22')](_0x260124);}return _0x141341[_0x54ce('0x23')]();};}function saveUpdates(_0x35bafd,_0x194449){return function(_0x1e24fa){if(_0x1e24fa){return _0x1e24fa[_0x54ce('0x24')](_0x35bafd)[_0x54ce('0x25')](function(_0x933cad){return _0x933cad;});}return null;};}function removeEntity(_0x47ed8d,_0xe31ebf){return function(_0x59357b){if(_0x59357b){return _0x59357b[_0x54ce('0x26')]()[_0x54ce('0x25')](function(){var _0x220cbf=_0x59357b[_0x54ce('0x27')]({'plain':!![]});var _0x52e76a=_0x54ce('0x28');return db['UserProfileResource'][_0x54ce('0x26')]({'where':{'type':_0x52e76a,'resourceId':_0x220cbf['id']}})['then'](function(){return _0x59357b;});})[_0x54ce('0x25')](function(){_0x47ed8d[_0x54ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d5021,_0x4ad6e0){return function(_0x666fe3){if(!_0x666fe3){_0x4d5021[_0x54ce('0x19')](0x194);}return _0x666fe3;};}function handleError(_0x3181f2,_0x976831){_0x976831=_0x976831||0x1f4;return function(_0x3d645e){logger[_0x54ce('0x29')](_0x3d645e[_0x54ce('0x2a')]);if(_0x3d645e[_0x54ce('0x2b')]){delete _0x3d645e['name'];}_0x3181f2[_0x54ce('0x1a')](_0x976831)['send'](_0x3d645e);};}exports[_0x54ce('0x2c')]=function(_0x44fc5a,_0x39593e){var _0x307ea6={},_0x2f8175={},_0x260c10={'count':0x0,'rows':[]};var _0x4d8efb=_[_0x54ce('0x2d')](db[_0x54ce('0x2e')][_0x54ce('0x2f')],function(_0x5e290f){return{'name':_0x5e290f[_0x54ce('0x30')],'type':_0x5e290f['type']['key']};});_0x2f8175[_0x54ce('0x31')]=_[_0x54ce('0x2d')](_0x4d8efb,_0x54ce('0x2b'));_0x2f8175[_0x54ce('0x32')]=_[_0x54ce('0x33')](_0x44fc5a[_0x54ce('0x32')]);_0x2f8175['filters']=_[_0x54ce('0x34')](_0x2f8175[_0x54ce('0x31')],_0x2f8175[_0x54ce('0x32')]);_0x307ea6[_0x54ce('0x35')]=_['intersection'](_0x2f8175[_0x54ce('0x31')],qs['fields'](_0x44fc5a['query'][_0x54ce('0x36')]));_0x307ea6[_0x54ce('0x35')]=_0x307ea6['attributes'][_0x54ce('0x37')]?_0x307ea6['attributes']:_0x2f8175[_0x54ce('0x31')];if(!_0x44fc5a[_0x54ce('0x32')][_0x54ce('0x38')](_0x54ce('0x39'))){_0x307ea6[_0x54ce('0x1e')]=qs['limit'](_0x44fc5a['query'][_0x54ce('0x1e')]);_0x307ea6[_0x54ce('0x1d')]=qs['offset'](_0x44fc5a[_0x54ce('0x32')][_0x54ce('0x1d')]);}_0x307ea6['order']=qs['sort'](_0x44fc5a[_0x54ce('0x32')][_0x54ce('0x3a')]);_0x307ea6[_0x54ce('0x3b')]=qs[_0x54ce('0x3c')](_[_0x54ce('0x3d')](_0x44fc5a[_0x54ce('0x32')],_0x2f8175['filters']),_0x4d8efb);if(_0x44fc5a[_0x54ce('0x32')][_0x54ce('0x3e')]){_0x307ea6[_0x54ce('0x3b')]=_[_0x54ce('0x3f')](_0x307ea6['where'],{'$or':_[_0x54ce('0x2d')](_0x4d8efb,function(_0x30c376){if(_0x30c376[_0x54ce('0x40')]!==_0x54ce('0x41')){var _0x58ac83={};_0x58ac83[_0x30c376[_0x54ce('0x2b')]]={'$like':'%'+_0x44fc5a[_0x54ce('0x32')]['filter']+'%'};return _0x58ac83;}})});}_0x307ea6=_[_0x54ce('0x3f')]({},_0x307ea6,_0x44fc5a[_0x54ce('0x42')]);var _0x19b2d9={'where':_0x307ea6['where']};return db['CmHopperAdditionalPhone']['count'](_0x19b2d9)[_0x54ce('0x25')](function(_0x2a5b3c){_0x260c10[_0x54ce('0x1f')]=_0x2a5b3c;if(_0x44fc5a['query'][_0x54ce('0x43')]){_0x307ea6['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x54ce('0x44')](_0x307ea6);})[_0x54ce('0x25')](function(_0x4e9569){_0x260c10['rows']=_0x4e9569;return _0x260c10;})['then'](respondWithFilteredResult(_0x39593e,_0x307ea6))[_0x54ce('0x45')](handleError(_0x39593e,null));};exports[_0x54ce('0x46')]=function(_0x172922,_0x4aaa4a){var _0x271528={'raw':!![],'where':{'id':_0x172922[_0x54ce('0x47')]['id']}},_0x289915={};_0x289915[_0x54ce('0x31')]=_[_0x54ce('0x33')](db[_0x54ce('0x2e')][_0x54ce('0x2f')]);_0x289915[_0x54ce('0x32')]=_['keys'](_0x172922['query']);_0x289915['filters']=_[_0x54ce('0x34')](_0x289915['model'],_0x289915[_0x54ce('0x32')]);_0x271528[_0x54ce('0x35')]=_[_0x54ce('0x34')](_0x289915[_0x54ce('0x31')],qs['fields'](_0x172922['query'][_0x54ce('0x36')]));_0x271528[_0x54ce('0x35')]=_0x271528[_0x54ce('0x35')]['length']?_0x271528['attributes']:_0x289915[_0x54ce('0x31')];if(_0x172922[_0x54ce('0x32')][_0x54ce('0x43')]){_0x271528['include']=[{'all':!![]}];}_0x271528=_[_0x54ce('0x3f')]({},_0x271528,_0x172922[_0x54ce('0x42')]);return db[_0x54ce('0x2e')]['find'](_0x271528)[_0x54ce('0x25')](handleEntityNotFound(_0x4aaa4a,null))[_0x54ce('0x25')](respondWithResult(_0x4aaa4a,null))[_0x54ce('0x45')](handleError(_0x4aaa4a,null));};exports[_0x54ce('0x48')]=function(_0x357984,_0x4a404f){return db[_0x54ce('0x2e')]['create'](_0x357984['body'],{})[_0x54ce('0x25')](function(_0xb32884){var _0x132f67=_0x357984[_0x54ce('0x49')][_0x54ce('0x27')]({'plain':!![]});if(!_0x132f67)throw new Error(_0x54ce('0x4a'));if(_0x132f67[_0x54ce('0x4b')]===_0x54ce('0x49')){var _0x1be162=_0xb32884[_0x54ce('0x27')]({'plain':!![]});var _0xf38741=_0x54ce('0x28');return db[_0x54ce('0x4c')]['find']({'where':{'name':_0xf38741,'userProfileId':_0x132f67['userProfileId']},'raw':!![]})[_0x54ce('0x25')](function(_0xaf8a23){if(_0xaf8a23&&_0xaf8a23['autoAssociation']===0x0){return db[_0x54ce('0x4d')]['create']({'name':_0x1be162['name'],'resourceId':_0x1be162['id'],'type':_0xaf8a23['name'],'sectionId':_0xaf8a23['id']},{})[_0x54ce('0x25')](function(){return _0xb32884;});}else{return _0xb32884;}})[_0x54ce('0x45')](function(_0xf418f){logger[_0x54ce('0x29')](_0x54ce('0x4e'),_0xf418f);throw _0xf418f;});}return _0xb32884;})[_0x54ce('0x25')](respondWithResult(_0x4a404f,0xc9))[_0x54ce('0x45')](handleError(_0x4a404f,null));};exports[_0x54ce('0x24')]=function(_0x5445fa,_0x513198){if(_0x5445fa[_0x54ce('0x4f')]['id']){delete _0x5445fa[_0x54ce('0x4f')]['id'];}return db[_0x54ce('0x2e')][_0x54ce('0x50')]({'where':{'id':_0x5445fa[_0x54ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x513198,null))[_0x54ce('0x25')](saveUpdates(_0x5445fa[_0x54ce('0x4f')],null))[_0x54ce('0x25')](respondWithResult(_0x513198,null))[_0x54ce('0x45')](handleError(_0x513198,null));};exports[_0x54ce('0x26')]=function(_0x364bcf,_0x444f0b){return db[_0x54ce('0x2e')][_0x54ce('0x50')]({'where':{'id':_0x364bcf['params']['id']}})['then'](handleEntityNotFound(_0x444f0b,null))['then'](removeEntity(_0x444f0b,null))[_0x54ce('0x45')](handleError(_0x444f0b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 1901425..062c43c 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 _0xdbcd=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xdbcd,0x1bc));var _0xddbc=function(_0x2496cb,_0xcf9d27){_0x2496cb=_0x2496cb-0x0;var _0x5f5c0d=_0xdbcd[_0x2496cb];return _0x5f5c0d;};'use strict';var _=require('lodash');var util=require(_0xddbc('0x0'));var logger=require('../../config/logger')(_0xddbc('0x1'));var moment=require(_0xddbc('0x2'));var BPromise=require(_0xddbc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddbc('0x4'));var rimraf=require(_0xddbc('0x5'));var config=require(_0xddbc('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xddbc('0x7')]=function(_0x44136e,_0x284670){return _0x44136e[_0xddbc('0x8')](_0xddbc('0x9'),attributes,{'tableName':_0xddbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7543=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','util','../../config/logger'];(function(_0x5da14d,_0x1ef57f){var _0x1e79ec=function(_0x53a7cf){while(--_0x53a7cf){_0x5da14d['push'](_0x5da14d['shift']());}};_0x1e79ec(++_0x1ef57f);}(_0x7543,0x148));var _0x3754=function(_0x1aadba,_0x1b407){_0x1aadba=_0x1aadba-0x0;var _0x4e78da=_0x7543[_0x1aadba];return _0x4e78da;};'use strict';var _=require('lodash');var util=require(_0x3754('0x0'));var logger=require(_0x3754('0x1'))(_0x3754('0x2'));var moment=require(_0x3754('0x3'));var BPromise=require(_0x3754('0x4'));var rp=require(_0x3754('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3754('0x6'));var config=require(_0x3754('0x7'));var attributes=require(_0x3754('0x8'));module['exports']=function(_0x553787,_0x403ca2){return _0x553787[_0x3754('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x3754('0xa'),'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 f4707d4..4d50ce3 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 _0x89be=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countcongestionretry','dialGlobalMaxRetry','catch','SwapAdditionalPhones','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util'];(function(_0x27eaad,_0x53919f){var _0x56cbe3=function(_0x4bc8dd){while(--_0x4bc8dd){_0x27eaad['push'](_0x27eaad['shift']());}};_0x56cbe3(++_0x53919f);}(_0x89be,0x160));var _0xe89b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe89b('0x0'));var util=require(_0xe89b('0x1'));var moment=require(_0xe89b('0x2'));var BPromise=require(_0xe89b('0x3'));var rs=require(_0xe89b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe89b('0x5'))['db'];var utils=require(_0xe89b('0x6'));var logger=require(_0xe89b('0x7'))(_0xe89b('0x8'));var config=require(_0xe89b('0x9'));var jayson=require(_0xe89b('0xa'));var client=jayson['client'][_0xe89b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ada1e,_0x523da6,_0x2c3ced){return new BPromise(function(_0x1c482d,_0x51c09a){return client[_0xe89b('0xc')](_0x1ada1e,_0x2c3ced)['then'](function(_0x52dd37){logger[_0xe89b('0xd')](_0xe89b('0xe'),_0x523da6,_0xe89b('0xf'));logger[_0xe89b('0x10')](_0xe89b('0x11'),_0x523da6,_0xe89b('0xf'),JSON[_0xe89b('0x12')](_0x52dd37));if(_0x52dd37[_0xe89b('0x13')]){if(_0x52dd37[_0xe89b('0x13')][_0xe89b('0x14')]===0x1f4){logger[_0xe89b('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x523da6,_0x52dd37[_0xe89b('0x13')]['message']);return _0x51c09a(_0x52dd37[_0xe89b('0x13')][_0xe89b('0x15')]);}logger[_0xe89b('0x13')](_0xe89b('0xe'),_0x523da6,_0x52dd37[_0xe89b('0x13')][_0xe89b('0x15')]);return _0x1c482d(_0x52dd37[_0xe89b('0x13')][_0xe89b('0x15')]);}else{logger[_0xe89b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x523da6,_0xe89b('0xf'));_0x1c482d(_0x52dd37['result'][_0xe89b('0x15')]);}})['catch'](function(_0x59243c){logger[_0xe89b('0x13')](_0xe89b('0xe'),_0x523da6,_0x59243c);_0x51c09a(_0x59243c);});});}exports[_0xe89b('0x16')]=function(_0x6d5f54){var _0x4185a7=this;return new Promise(function(_0x226995,_0x5b986c){return db[_0xe89b('0x17')][_0xe89b('0x18')]({'raw':!![],'where':{'ContactId':_0x6d5f54['body'][_0xe89b('0x19')],'ListId':_0x6d5f54[_0xe89b('0x1a')][_0xe89b('0x1b')],'VoiceQueueId':_0x6d5f54[_0xe89b('0x1a')][_0xe89b('0x1c')]===undefined?null:_0x6d5f54[_0xe89b('0x1a')]['VoiceQueueId'],'CampaignId':_0x6d5f54[_0xe89b('0x1a')][_0xe89b('0x1d')]===undefined?null:_0x6d5f54['body'][_0xe89b('0x1d')]}})[_0xe89b('0x1e')](function(_0x4e16c5){if(_0x4e16c5!=null){return db[_0xe89b('0x1f')][_0xe89b('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4e16c5['id'],'OrderBy':{'$gt':_0x4e16c5[_0xe89b('0x20')]}},'order':[[_0xe89b('0x20'),_0xe89b('0x21')]]})[_0xe89b('0x1e')](function(_0x37c9e5){var _0x1d4310=0x0;if(_0x37c9e5){if(_0x37c9e5[_0xe89b('0x22')]+_0x37c9e5['countcongestionretry']+_0x37c9e5[_0xe89b('0x23')]+_0x37c9e5[_0xe89b('0x24')]+_0x37c9e5[_0xe89b('0x25')]+_0x37c9e5[_0xe89b('0x26')]+_0x37c9e5[_0xe89b('0x27')]+_0x37c9e5[_0xe89b('0x28')]<_0x6d5f54[_0xe89b('0x29')]['dialGlobalMaxRetry'])_0x1d4310=0x1;_0x226995({'additional':_0x1d4310});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4e16c5['id']},'order':[['OrderBy',_0xe89b('0x21')]]})[_0xe89b('0x1e')](function(_0x485c7d){var _0x12918d=0x0;if(_0x485c7d){if(_0x485c7d[_0xe89b('0x22')]+_0x485c7d[_0xe89b('0x2a')]+_0x485c7d[_0xe89b('0x23')]+_0x485c7d[_0xe89b('0x24')]+_0x485c7d['countdropretry']+_0x485c7d[_0xe89b('0x26')]+_0x485c7d[_0xe89b('0x27')]+_0x485c7d[_0xe89b('0x28')]<_0x6d5f54['entity'][_0xe89b('0x2b')])_0x12918d=0x1;_0x226995({'additional':_0x12918d});}else{_0x226995({'additional':0x0});}})[_0xe89b('0x2c')](function(_0x1739b9){logger[_0xe89b('0x13')](_0xe89b('0x16'),_0x1739b9[_0xe89b('0x15')]);_0x5b986c(_0x4185a7['error'](0x1f4,_0x1739b9['message']));});}})[_0xe89b('0x2c')](function(_0x572f5c){logger[_0xe89b('0x13')](_0xe89b('0x16'),_0x572f5c[_0xe89b('0x15')]);_0x5b986c(_0x4185a7[_0xe89b('0x13')](0x1f4,_0x572f5c[_0xe89b('0x15')]));});}else _0x226995({'additional':0x0});});});};exports[_0xe89b('0x2d')]=function(_0x379493){var _0x17e7c4=this;return new Promise(function(_0x3f54ee,_0x28569c){return db[_0xe89b('0x17')][_0xe89b('0x18')]({'raw':!![],'where':{'ContactId':_0x379493[_0xe89b('0x1a')][_0xe89b('0x19')],'ListId':_0x379493[_0xe89b('0x1a')][_0xe89b('0x1b')],'VoiceQueueId':_0x379493[_0xe89b('0x1a')][_0xe89b('0x1c')]===undefined?null:_0x379493[_0xe89b('0x1a')][_0xe89b('0x1c')],'CampaignId':_0x379493[_0xe89b('0x1a')][_0xe89b('0x1d')]===undefined?null:_0x379493[_0xe89b('0x1a')][_0xe89b('0x1d')]}})[_0xe89b('0x1e')](function(_0xfc4bf4){if(_0xfc4bf4!=null){return db[_0xe89b('0x1f')][_0xe89b('0x18')]({'raw':!![],'where':{'CmHopperId':_0xfc4bf4['id'],'OrderBy':{'$gte':_0xfc4bf4['OrderBy']}},'order':[[_0xe89b('0x20'),_0xe89b('0x21')]]})[_0xe89b('0x1e')](function(_0x1b1090){if(_0x1b1090)return activateAdditionalPhone(_0xfc4bf4,_0x379493[_0xe89b('0x1a')],_0x1b1090,_0x379493['duration'],_0x379493[_0xe89b('0x2e')])['then'](function(_0x5cfbe4){_0x3f54ee(_0x5cfbe4);});else{return db['CmHopperAdditionalPhone'][_0xe89b('0x18')]({'raw':!![],'where':{'CmHopperId':_0xfc4bf4['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x187886){if(_0x187886)return activateAdditionalPhone(_0xfc4bf4,_0x379493[_0xe89b('0x1a')],_0x187886,_0x379493[_0xe89b('0x2f')],_0x379493[_0xe89b('0x2e')])[_0xe89b('0x1e')](function(_0xb6b51){_0x3f54ee(_0xb6b51);});else{_0x3f54ee({'id':_0xfc4bf4['id'],'phone':''});}})['catch'](function(_0x525c8a){logger[_0xe89b('0x13')](_0xe89b('0x16'),_0x525c8a['message']);_0x28569c(_0x17e7c4['error'](0x1f4,_0x525c8a[_0xe89b('0x15')]));});}})[_0xe89b('0x2c')](function(_0x5eb134){logger[_0xe89b('0x13')](_0xe89b('0x16'),_0x5eb134['message']);_0x28569c(_0x17e7c4[_0xe89b('0x13')](0x1f4,_0x5eb134['message']));});}else _0x3f54ee(0x1);});});};function activateAdditionalPhone(_0x38d304,_0x84cb5e,_0x511345,_0x1578db,_0x46e8c1){return new Promise(function(_0x2b16ef,_0x2c1f7c){var _0x17be3c;if(_[_0xe89b('0x30')](_0x511345['scheduledat'])){_0x511345['scheduledat']=moment();}if(moment()>moment(_0x511345[_0xe89b('0x31')])){_0x17be3c=moment()[_0xe89b('0x32')](_0x46e8c1||0x3,_0xe89b('0x33'));}else{if(_0x511345[_0xe89b('0x20')]==0x0){_0x17be3c=moment(_0x511345[_0xe89b('0x31')]);}else{_0x17be3c=moment()[_0xe89b('0x32')](_0x46e8c1||0x3,'minutes');}}if(_[_0xe89b('0x30')](_0x17be3c)){_0x17be3c=moment()[_0xe89b('0x32')](_0x46e8c1||0x3,'minutes');}var _0x3add9c={'phone':_0x38d304[_0xe89b('0x34')],'active':0x0,'OrderBy':_[_0xe89b('0x30')](_0x38d304[_0xe89b('0x20')])?0x0:_0x38d304[_0xe89b('0x20')],'scheduledat':moment()[_0xe89b('0x32')](_0x1578db||0x1,_0xe89b('0x33')),'countbusyretry':_0x84cb5e['countbusyretry'],'countcongestionretry':_0x84cb5e[_0xe89b('0x2a')],'countnoanswerretry':_0x84cb5e[_0xe89b('0x23')],'countnosuchnumberretry':_0x84cb5e[_0xe89b('0x24')],'countdropretry':_0x84cb5e[_0xe89b('0x25')],'countabandonedretry':_0x84cb5e['countabandonedretry'],'countmachineretry':_0x84cb5e[_0xe89b('0x27')],'countagentrejectretry':_0x84cb5e[_0xe89b('0x28')],'createdAt':_0x84cb5e[_0xe89b('0x35')],'updatedAt':_0x84cb5e[_0xe89b('0x36')]};var _0x2dfcc3={'CmHopperId':_0x38d304['id'],'phone':_0x511345[_0xe89b('0x34')],'active':0x0,'OrderBy':_[_0xe89b('0x30')](_0x511345[_0xe89b('0x20')])?0x0:_0x511345[_0xe89b('0x20')],'scheduledat':_0x17be3c,'countbusyretry':_0x511345[_0xe89b('0x22')],'countcongestionretry':_0x511345['countcongestionretry'],'countnoanswerretry':_0x511345['countnoanswerretry'],'countnosuchnumberretry':_0x511345[_0xe89b('0x24')],'countdropretry':_0x511345[_0xe89b('0x25')],'countabandonedretry':_0x511345[_0xe89b('0x26')],'countmachineretry':_0x511345[_0xe89b('0x27')],'countagentrejectretry':_0x511345[_0xe89b('0x28')],'createdAt':_0x511345['createdAt'],'updatedAt':_0x511345[_0xe89b('0x36')]};return db['sequelize'][_0xe89b('0x37')](function(_0x29e1c7){return db[_0xe89b('0x1f')]['update'](_0x3add9c,{'where':{'id':_0x511345['id']}},{'transaction':_0x29e1c7})[_0xe89b('0x1e')](function(){return db[_0xe89b('0x17')][_0xe89b('0x38')](_0x2dfcc3,{'where':{'id':_0x38d304['id']}},{'transaction':_0x29e1c7});});})[_0xe89b('0x1e')](function(_0x283c73){_0x2b16ef({'id':_0x38d304['id'],'phone':_0x511345[_0xe89b('0x34')]});})['catch'](function(_0x16158c){logger[_0xe89b('0x13')](_0xe89b('0x39'),_0x16158c[_0xe89b('0x15')]);_0x2c1f7c({'error':_0x16158c['message']});});});}exports[_0xe89b('0x3a')]=function(_0xcb180e){var _0x20b0fe=this;return new Promise(function(_0x4fe316,_0x4c6067){return db[_0xe89b('0x17')][_0xe89b('0x38')](_0xcb180e['body']['field'],{'where':{'id':_0xcb180e[_0xe89b('0x1a')]['id']}})[_0xe89b('0x1e')](function(_0x5ddb51){_0x4fe316(_0x5ddb51);})[_0xe89b('0x2c')](function(_0xc9ddfb){logger[_0xe89b('0x13')](_0xe89b('0x3a'),_0xc9ddfb['message']);_0x4c6067(_0x20b0fe[_0xe89b('0x13')](0x1f4,_0xc9ddfb[_0xe89b('0x15')]));});});}; \ No newline at end of file +var _0xd754=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','ASC','duration','waitTime','scheduledat','add','minutes','isNil','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xd754,0x1f1));var _0x4d75=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xd754[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x4d75('0x0'));var util=require(_0x4d75('0x1'));var moment=require(_0x4d75('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d75('0x3'));var fs=require('fs');var Redis=require(_0x4d75('0x4'));var db=require(_0x4d75('0x5'))['db'];var utils=require(_0x4d75('0x6'));var logger=require(_0x4d75('0x7'))(_0x4d75('0x8'));var config=require('../../config/environment');var jayson=require(_0x4d75('0x9'));var client=jayson[_0x4d75('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7556,_0x462f33,_0x522b0d){return new BPromise(function(_0x41be88,_0x4bd012){return client['request'](_0x3d7556,_0x522b0d)['then'](function(_0x32012b){logger[_0x4d75('0xb')](_0x4d75('0xc'),_0x462f33,'request\x20sent');logger[_0x4d75('0xd')](_0x4d75('0xe'),_0x462f33,_0x4d75('0xf'),JSON[_0x4d75('0x10')](_0x32012b));if(_0x32012b[_0x4d75('0x11')]){if(_0x32012b[_0x4d75('0x11')][_0x4d75('0x12')]===0x1f4){logger[_0x4d75('0x11')](_0x4d75('0xc'),_0x462f33,_0x32012b[_0x4d75('0x11')][_0x4d75('0x13')]);return _0x4bd012(_0x32012b[_0x4d75('0x11')]['message']);}logger[_0x4d75('0x11')](_0x4d75('0xc'),_0x462f33,_0x32012b[_0x4d75('0x11')][_0x4d75('0x13')]);return _0x41be88(_0x32012b[_0x4d75('0x11')][_0x4d75('0x13')]);}else{logger['info'](_0x4d75('0xc'),_0x462f33,_0x4d75('0xf'));_0x41be88(_0x32012b[_0x4d75('0x14')][_0x4d75('0x13')]);}})[_0x4d75('0x15')](function(_0x5c9086){logger[_0x4d75('0x11')](_0x4d75('0xc'),_0x462f33,_0x5c9086);_0x4bd012(_0x5c9086);});});}exports['VerifyAdditionalPhones']=function(_0x3bdc03){var _0x11f852=this;return new Promise(function(_0x405fec,_0x11ec85){return db[_0x4d75('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x3bdc03[_0x4d75('0x17')][_0x4d75('0x18')],'ListId':_0x3bdc03[_0x4d75('0x17')][_0x4d75('0x19')],'VoiceQueueId':_0x3bdc03['body'][_0x4d75('0x1a')]===undefined?null:_0x3bdc03[_0x4d75('0x17')][_0x4d75('0x1a')],'CampaignId':_0x3bdc03['body'][_0x4d75('0x1b')]===undefined?null:_0x3bdc03['body'][_0x4d75('0x1b')]}})[_0x4d75('0x1c')](function(_0x49fe23){if(_0x49fe23!=null){return db[_0x4d75('0x1d')][_0x4d75('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x49fe23['id'],'OrderBy':{'$gt':_0x49fe23[_0x4d75('0x1f')]}},'order':[[_0x4d75('0x1f'),'ASC']]})[_0x4d75('0x1c')](function(_0x4832bb){var _0x5ece23=0x0;if(_0x4832bb){if(_0x4832bb[_0x4d75('0x20')]+_0x4832bb[_0x4d75('0x21')]+_0x4832bb['countnoanswerretry']+_0x4832bb['countnosuchnumberretry']+_0x4832bb[_0x4d75('0x22')]+_0x4832bb[_0x4d75('0x23')]+_0x4832bb[_0x4d75('0x24')]+_0x4832bb[_0x4d75('0x25')]<_0x3bdc03[_0x4d75('0x26')]['dialGlobalMaxRetry'])_0x5ece23=0x1;_0x405fec({'additional':_0x5ece23});}else{return db['CmHopperAdditionalPhone'][_0x4d75('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x49fe23['id']},'order':[[_0x4d75('0x1f'),'ASC']]})[_0x4d75('0x1c')](function(_0x51adb0){var _0x37d046=0x0;if(_0x51adb0){if(_0x51adb0[_0x4d75('0x20')]+_0x51adb0[_0x4d75('0x21')]+_0x51adb0[_0x4d75('0x27')]+_0x51adb0[_0x4d75('0x28')]+_0x51adb0[_0x4d75('0x22')]+_0x51adb0[_0x4d75('0x23')]+_0x51adb0[_0x4d75('0x24')]+_0x51adb0[_0x4d75('0x25')]<_0x3bdc03[_0x4d75('0x26')][_0x4d75('0x29')])_0x37d046=0x1;_0x405fec({'additional':_0x37d046});}else{_0x405fec({'additional':0x0});}})[_0x4d75('0x15')](function(_0x1e83de){logger[_0x4d75('0x11')](_0x4d75('0x2a'),_0x1e83de[_0x4d75('0x13')]);_0x11ec85(_0x11f852[_0x4d75('0x11')](0x1f4,_0x1e83de[_0x4d75('0x13')]));});}})[_0x4d75('0x15')](function(_0x1c0241){logger[_0x4d75('0x11')]('VerifyAdditionalPhones',_0x1c0241['message']);_0x11ec85(_0x11f852[_0x4d75('0x11')](0x1f4,_0x1c0241[_0x4d75('0x13')]));});}else _0x405fec({'additional':0x0});});});};exports[_0x4d75('0x2b')]=function(_0x5f20f7){var _0x23f8b7=this;return new Promise(function(_0x1941ef,_0x49d9e3){return db[_0x4d75('0x16')][_0x4d75('0x1e')]({'raw':!![],'where':{'ContactId':_0x5f20f7['body']['ContactId'],'ListId':_0x5f20f7['body'][_0x4d75('0x19')],'VoiceQueueId':_0x5f20f7[_0x4d75('0x17')][_0x4d75('0x1a')]===undefined?null:_0x5f20f7[_0x4d75('0x17')][_0x4d75('0x1a')],'CampaignId':_0x5f20f7[_0x4d75('0x17')][_0x4d75('0x1b')]===undefined?null:_0x5f20f7[_0x4d75('0x17')][_0x4d75('0x1b')]}})[_0x4d75('0x1c')](function(_0x1e51a1){if(_0x1e51a1!=null){return db[_0x4d75('0x1d')][_0x4d75('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x1e51a1['id'],'OrderBy':{'$gte':_0x1e51a1[_0x4d75('0x1f')]}},'order':[['OrderBy',_0x4d75('0x2c')]]})[_0x4d75('0x1c')](function(_0x5e58b2){if(_0x5e58b2)return activateAdditionalPhone(_0x1e51a1,_0x5f20f7['body'],_0x5e58b2,_0x5f20f7[_0x4d75('0x2d')],_0x5f20f7[_0x4d75('0x2e')])[_0x4d75('0x1c')](function(_0x4cd33a){_0x1941ef(_0x4cd33a);});else{return db['CmHopperAdditionalPhone'][_0x4d75('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x1e51a1['id']},'order':[[_0x4d75('0x1f'),'ASC']]})['then'](function(_0x48b3ab){if(_0x48b3ab)return activateAdditionalPhone(_0x1e51a1,_0x5f20f7[_0x4d75('0x17')],_0x48b3ab,_0x5f20f7['duration'],_0x5f20f7[_0x4d75('0x2e')])['then'](function(_0x553f9d){_0x1941ef(_0x553f9d);});else{_0x1941ef({'id':_0x1e51a1['id'],'phone':''});}})['catch'](function(_0x54de6d){logger[_0x4d75('0x11')](_0x4d75('0x2a'),_0x54de6d['message']);_0x49d9e3(_0x23f8b7[_0x4d75('0x11')](0x1f4,_0x54de6d[_0x4d75('0x13')]));});}})[_0x4d75('0x15')](function(_0x3c0d7e){logger[_0x4d75('0x11')](_0x4d75('0x2a'),_0x3c0d7e[_0x4d75('0x13')]);_0x49d9e3(_0x23f8b7[_0x4d75('0x11')](0x1f4,_0x3c0d7e[_0x4d75('0x13')]));});}else _0x1941ef(0x1);});});};function activateAdditionalPhone(_0x48559c,_0x4683a8,_0x4da5ea,_0x308605,_0x5f2fc5){return new Promise(function(_0x2f87d6,_0x4e9e30){var _0xa4d047;if(_['isNil'](_0x4da5ea[_0x4d75('0x2f')])){_0x4da5ea[_0x4d75('0x2f')]=moment();}if(moment()>moment(_0x4da5ea[_0x4d75('0x2f')])){_0xa4d047=moment()[_0x4d75('0x30')](_0x5f2fc5||0x3,_0x4d75('0x31'));}else{if(_0x4da5ea[_0x4d75('0x1f')]==0x0){_0xa4d047=moment(_0x4da5ea[_0x4d75('0x2f')]);}else{_0xa4d047=moment()[_0x4d75('0x30')](_0x5f2fc5||0x3,_0x4d75('0x31'));}}if(_[_0x4d75('0x32')](_0xa4d047)){_0xa4d047=moment()[_0x4d75('0x30')](_0x5f2fc5||0x3,'minutes');}var _0x271032={'phone':_0x48559c[_0x4d75('0x33')],'active':0x0,'OrderBy':_[_0x4d75('0x32')](_0x48559c[_0x4d75('0x1f')])?0x0:_0x48559c[_0x4d75('0x1f')],'scheduledat':moment()[_0x4d75('0x30')](_0x308605||0x1,_0x4d75('0x31')),'countbusyretry':_0x4683a8[_0x4d75('0x20')],'countcongestionretry':_0x4683a8[_0x4d75('0x21')],'countnoanswerretry':_0x4683a8[_0x4d75('0x27')],'countnosuchnumberretry':_0x4683a8['countnosuchnumberretry'],'countdropretry':_0x4683a8['countdropretry'],'countabandonedretry':_0x4683a8[_0x4d75('0x23')],'countmachineretry':_0x4683a8[_0x4d75('0x24')],'countagentrejectretry':_0x4683a8[_0x4d75('0x25')],'createdAt':_0x4683a8['createdAt'],'updatedAt':_0x4683a8[_0x4d75('0x34')]};var _0x3cd3ba={'CmHopperId':_0x48559c['id'],'phone':_0x4da5ea[_0x4d75('0x33')],'active':0x0,'OrderBy':_[_0x4d75('0x32')](_0x4da5ea[_0x4d75('0x1f')])?0x0:_0x4da5ea[_0x4d75('0x1f')],'scheduledat':_0xa4d047,'countbusyretry':_0x4da5ea[_0x4d75('0x20')],'countcongestionretry':_0x4da5ea['countcongestionretry'],'countnoanswerretry':_0x4da5ea[_0x4d75('0x27')],'countnosuchnumberretry':_0x4da5ea[_0x4d75('0x28')],'countdropretry':_0x4da5ea[_0x4d75('0x22')],'countabandonedretry':_0x4da5ea[_0x4d75('0x23')],'countmachineretry':_0x4da5ea['countmachineretry'],'countagentrejectretry':_0x4da5ea[_0x4d75('0x25')],'createdAt':_0x4da5ea['createdAt'],'updatedAt':_0x4da5ea['updatedAt']};return db[_0x4d75('0x35')][_0x4d75('0x36')](function(_0x241d6c){return db[_0x4d75('0x1d')][_0x4d75('0x37')](_0x271032,{'where':{'id':_0x4da5ea['id']}},{'transaction':_0x241d6c})['then'](function(){return db[_0x4d75('0x16')][_0x4d75('0x37')](_0x3cd3ba,{'where':{'id':_0x48559c['id']}},{'transaction':_0x241d6c});});})[_0x4d75('0x1c')](function(_0x28f782){_0x2f87d6({'id':_0x48559c['id'],'phone':_0x4da5ea[_0x4d75('0x33')]});})[_0x4d75('0x15')](function(_0x566562){logger['error'](_0x4d75('0x38'),_0x566562['message']);_0x4e9e30({'error':_0x566562[_0x4d75('0x13')]});});});}exports[_0x4d75('0x39')]=function(_0x4ddfb3){var _0x2f0bd5=this;return new Promise(function(_0x1f8266,_0x53ddcc){return db[_0x4d75('0x16')][_0x4d75('0x37')](_0x4ddfb3['body'][_0x4d75('0x3a')],{'where':{'id':_0x4ddfb3[_0x4d75('0x17')]['id']}})[_0x4d75('0x1c')](function(_0x41ed4b){_0x1f8266(_0x41ed4b);})[_0x4d75('0x15')](function(_0xead7b9){logger['error']('IncrementPreviewCounters',_0xead7b9[_0x4d75('0x13')]);_0x53ddcc(_0x2f0bd5['error'](0x1f4,_0xead7b9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ccd36fa..bc54729 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 _0x1903=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x2ce66f,_0x48bcd0){var _0x8ed528=function(_0x24b54c){while(--_0x24b54c){_0x2ce66f['push'](_0x2ce66f['shift']());}};_0x8ed528(++_0x48bcd0);}(_0x1903,0x7a));var _0x3190=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1903[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x3190('0x0'));var path=require(_0x3190('0x1'));var timeout=require(_0x3190('0x2'));var express=require(_0x3190('0x3'));var router=express[_0x3190('0x4')]();var fs_extra=require(_0x3190('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3190('0x6'));var controller=require(_0x3190('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3190('0x8')]);router[_0x3190('0x9')](_0x3190('0xa'),auth['isAuthenticated'](),controller[_0x3190('0xb')]);router[_0x3190('0xc')]('/',auth[_0x3190('0xd')](),controller[_0x3190('0xe')]);router[_0x3190('0xf')](_0x3190('0xa'),auth[_0x3190('0xd')](),controller[_0x3190('0x10')]);router[_0x3190('0x11')]('/:id',auth[_0x3190('0xd')](),controller[_0x3190('0x12')]);module[_0x3190('0x13')]=router; \ No newline at end of file +var _0x2412=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x2d204d,_0x121ae3){var _0x458951=function(_0x295b09){while(--_0x295b09){_0x2d204d['push'](_0x2d204d['shift']());}};_0x458951(++_0x121ae3);}(_0x2412,0xa6));var _0x2241=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2412[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2241('0x0'));var timeout=require(_0x2241('0x1'));var express=require(_0x2241('0x2'));var router=express[_0x2241('0x3')]();var fs_extra=require(_0x2241('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2241('0x5'));var config=require('../../config/environment');var controller=require(_0x2241('0x6'));router[_0x2241('0x7')]('/',auth[_0x2241('0x8')](),controller[_0x2241('0x9')]);router[_0x2241('0x7')](_0x2241('0xa'),auth[_0x2241('0x8')](),controller[_0x2241('0xb')]);router[_0x2241('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2241('0xd')](_0x2241('0xa'),auth[_0x2241('0x8')](),controller[_0x2241('0xe')]);router[_0x2241('0xf')](_0x2241('0xa'),auth[_0x2241('0x8')](),controller[_0x2241('0x10')]);module[_0x2241('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f1eedfb..1d22cc9 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 _0x7fbe=['exports','STRING','INTEGER','contactListQueue'];(function(_0x3047c1,_0x3c42f6){var _0x318d43=function(_0x55adc4){while(--_0x55adc4){_0x3047c1['push'](_0x3047c1['shift']());}};_0x318d43(++_0x3c42f6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x76517f,_0x325017){_0x76517f=_0x76517f-0x0;var _0x43cc3a=_0x7fbe[_0x76517f];return _0x43cc3a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe7fb('0x0')]={'phone':{'type':Sequelize[_0xe7fb('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe7fb('0x2')],'unique':_0xe7fb('0x3')},'ListId':{'type':Sequelize[_0xe7fb('0x2')],'unique':_0xe7fb('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe7fb('0x2')],'unique':_0xe7fb('0x3')}}; \ No newline at end of file +var _0x82f8=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x289212,_0x390ce4){var _0xe16322=function(_0x12b805){while(--_0x12b805){_0x289212['push'](_0x289212['shift']());}};_0xe16322(++_0x390ce4);}(_0x82f8,0x157));var _0x882f=function(_0x3f9094,_0x30e9f9){_0x3f9094=_0x3f9094-0x0;var _0x355639=_0x82f8[_0x3f9094];return _0x355639;};'use strict';var moment=require('moment');var Sequelize=require(_0x882f('0x0'));module[_0x882f('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x882f('0x2')],'unique':_0x882f('0x3')},'ListId':{'type':Sequelize[_0x882f('0x2')],'unique':_0x882f('0x3')},'VoiceQueueId':{'type':Sequelize[_0x882f('0x2')],'unique':_0x882f('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 05ead88..dc60bbf 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 _0x4191=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2797af,_0x33c311){var _0x3a6a29=function(_0x5bd7e1){while(--_0x5bd7e1){_0x2797af['push'](_0x2797af['shift']());}};_0x3a6a29(++_0x33c311);}(_0x4191,0x1a8));var _0x1419=function(_0x1e5dd7,_0x1aff9a){_0x1e5dd7=_0x1e5dd7-0x0;var _0x48f942=_0x4191[_0x1e5dd7];return _0x48f942;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1419('0x0'));var jsonpatch=require(_0x1419('0x1'));var rp=require(_0x1419('0x2'));var moment=require(_0x1419('0x3'));var BPromise=require(_0x1419('0x4'));var Mustache=require(_0x1419('0x5'));var util=require(_0x1419('0x6'));var path=require(_0x1419('0x7'));var sox=require('sox');var csv=require(_0x1419('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1419('0x9'));var _=require('lodash');var squel=require(_0x1419('0xa'));var crypto=require('crypto');var jsforce=require(_0x1419('0xb'));var deskjs=require(_0x1419('0xc'));var toCsv=require(_0x1419('0x8'));var querystring=require(_0x1419('0xd'));var Papa=require(_0x1419('0xe'));var Redis=require(_0x1419('0xf'));var authService=require(_0x1419('0x10'));var qs=require(_0x1419('0x11'));var as=require(_0x1419('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1419('0x13'))(_0x1419('0x14'));var utils=require(_0x1419('0x15'));var config=require(_0x1419('0x16'));var licenseUtil=require(_0x1419('0x17'));var db=require(_0x1419('0x18'))['db'];function respondWithStatusCode(_0x324d24,_0x46a1eb){_0x46a1eb=_0x46a1eb||0xcc;return function(_0x50b521){if(_0x50b521){return _0x324d24[_0x1419('0x19')](_0x46a1eb);}return _0x324d24[_0x1419('0x1a')](_0x46a1eb)[_0x1419('0x1b')]();};}function respondWithResult(_0x36717e,_0x4117b4){_0x4117b4=_0x4117b4||0xc8;return function(_0x451e0e){if(_0x451e0e){return _0x36717e[_0x1419('0x1a')](_0x4117b4)[_0x1419('0x1c')](_0x451e0e);}};}function respondWithFilteredResult(_0x225c1c,_0xf7b6aa){return function(_0x49240b){if(_0x49240b){var _0x4f6b50=typeof _0xf7b6aa['offset']===_0x1419('0x1d')&&typeof _0xf7b6aa['limit']===_0x1419('0x1d');var _0x4966d0=_0x49240b[_0x1419('0x1e')];var _0xaa2ef0=_0x4f6b50?0x0:_0xf7b6aa[_0x1419('0x1f')];var _0x49556a=_0x4f6b50?_0x49240b[_0x1419('0x1e')]:_0xf7b6aa[_0x1419('0x1f')]+_0xf7b6aa['limit'];var _0x43053b;if(_0x49556a>=_0x4966d0){_0x49556a=_0x4966d0;_0x43053b=0xc8;}else{_0x43053b=0xce;}_0x225c1c[_0x1419('0x1a')](_0x43053b);return _0x225c1c['set'](_0x1419('0x20'),_0xaa2ef0+'-'+_0x49556a+'/'+_0x4966d0)[_0x1419('0x1c')](_0x49240b);}return null;};}function patchUpdates(_0x3ef806){return function(_0x36f7b7){try{jsonpatch[_0x1419('0x21')](_0x36f7b7,_0x3ef806,!![]);}catch(_0x135088){return BPromise[_0x1419('0x22')](_0x135088);}return _0x36f7b7[_0x1419('0x23')]();};}function saveUpdates(_0xd51685,_0x115266){return function(_0xbe7d0d){if(_0xbe7d0d){return _0xbe7d0d[_0x1419('0x24')](_0xd51685)[_0x1419('0x25')](function(_0x449f83){return _0x449f83;});}return null;};}function removeEntity(_0x59e012,_0x2603de){return function(_0x10424c){if(_0x10424c){return _0x10424c[_0x1419('0x26')]()[_0x1419('0x25')](function(){_0x59e012[_0x1419('0x1a')](0xcc)[_0x1419('0x1b')]();});}};}function handleEntityNotFound(_0x56bcdc,_0x4c882c){return function(_0x41901f){if(!_0x41901f){_0x56bcdc[_0x1419('0x19')](0x194);}return _0x41901f;};}function handleError(_0x45541e,_0x122e95){_0x122e95=_0x122e95||0x1f4;return function(_0x1c437d){logger[_0x1419('0x27')](_0x1c437d[_0x1419('0x28')]);if(_0x1c437d[_0x1419('0x29')]){delete _0x1c437d[_0x1419('0x29')];}_0x45541e['status'](_0x122e95)['send'](_0x1c437d);};}exports[_0x1419('0x2a')]=function(_0x2c6ef7,_0x29aafb){var _0x2ba0fa={},_0x30b7d9={},_0x37fbb3={'count':0x0,'rows':[]};var _0x147384=_[_0x1419('0x2b')](db[_0x1419('0x2c')]['rawAttributes'],function(_0x25c55a){return{'name':_0x25c55a[_0x1419('0x2d')],'type':_0x25c55a['type']['key']};});_0x30b7d9[_0x1419('0x2e')]=_[_0x1419('0x2b')](_0x147384,'name');_0x30b7d9[_0x1419('0x2f')]=_[_0x1419('0x30')](_0x2c6ef7[_0x1419('0x2f')]);_0x30b7d9[_0x1419('0x31')]=_[_0x1419('0x32')](_0x30b7d9['model'],_0x30b7d9[_0x1419('0x2f')]);_0x2ba0fa[_0x1419('0x33')]=_['intersection'](_0x30b7d9[_0x1419('0x2e')],qs[_0x1419('0x34')](_0x2c6ef7['query'][_0x1419('0x34')]));_0x2ba0fa[_0x1419('0x33')]=_0x2ba0fa['attributes'][_0x1419('0x35')]?_0x2ba0fa['attributes']:_0x30b7d9[_0x1419('0x2e')];if(!_0x2c6ef7[_0x1419('0x2f')][_0x1419('0x36')](_0x1419('0x37'))){_0x2ba0fa[_0x1419('0x38')]=qs[_0x1419('0x38')](_0x2c6ef7[_0x1419('0x2f')][_0x1419('0x38')]);_0x2ba0fa[_0x1419('0x1f')]=qs[_0x1419('0x1f')](_0x2c6ef7[_0x1419('0x2f')][_0x1419('0x1f')]);}_0x2ba0fa[_0x1419('0x39')]=qs['sort'](_0x2c6ef7[_0x1419('0x2f')]['sort']);_0x2ba0fa[_0x1419('0x3a')]=qs['filters'](_[_0x1419('0x3b')](_0x2c6ef7[_0x1419('0x2f')],_0x30b7d9[_0x1419('0x31')]),_0x147384);if(_0x2c6ef7['query']['filter']){_0x2ba0fa[_0x1419('0x3a')]=_['merge'](_0x2ba0fa['where'],{'$or':_[_0x1419('0x2b')](_0x147384,function(_0x115f78){if(_0x115f78[_0x1419('0x3c')]!==_0x1419('0x3d')){var _0x178381={};_0x178381[_0x115f78[_0x1419('0x29')]]={'$like':'%'+_0x2c6ef7[_0x1419('0x2f')]['filter']+'%'};return _0x178381;}})});}_0x2ba0fa=_[_0x1419('0x3e')]({},_0x2ba0fa,_0x2c6ef7[_0x1419('0x3f')]);var _0x42ddc7={'where':_0x2ba0fa[_0x1419('0x3a')]};return db['CmHopperBlack'][_0x1419('0x1e')](_0x42ddc7)[_0x1419('0x25')](function(_0xce97d9){_0x37fbb3[_0x1419('0x1e')]=_0xce97d9;if(_0x2c6ef7['query'][_0x1419('0x40')]){_0x2ba0fa[_0x1419('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1419('0x42')](_0x2ba0fa);})['then'](function(_0x544542){_0x37fbb3['rows']=_0x544542;return _0x37fbb3;})['then'](respondWithFilteredResult(_0x29aafb,_0x2ba0fa))['catch'](handleError(_0x29aafb,null));};exports[_0x1419('0x43')]=function(_0x1f7d1a,_0xe6d9c){var _0x36e4f8={'raw':!![],'where':{'id':_0x1f7d1a[_0x1419('0x44')]['id']}},_0x400666={};_0x400666['model']=_['keys'](db['CmHopperBlack'][_0x1419('0x45')]);_0x400666[_0x1419('0x2f')]=_['keys'](_0x1f7d1a[_0x1419('0x2f')]);_0x400666[_0x1419('0x31')]=_['intersection'](_0x400666[_0x1419('0x2e')],_0x400666['query']);_0x36e4f8[_0x1419('0x33')]=_[_0x1419('0x32')](_0x400666[_0x1419('0x2e')],qs[_0x1419('0x34')](_0x1f7d1a[_0x1419('0x2f')]['fields']));_0x36e4f8[_0x1419('0x33')]=_0x36e4f8[_0x1419('0x33')][_0x1419('0x35')]?_0x36e4f8['attributes']:_0x400666[_0x1419('0x2e')];if(_0x1f7d1a[_0x1419('0x2f')][_0x1419('0x40')]){_0x36e4f8[_0x1419('0x41')]=[{'all':!![]}];}_0x36e4f8=_[_0x1419('0x3e')]({},_0x36e4f8,_0x1f7d1a[_0x1419('0x3f')]);return db[_0x1419('0x2c')][_0x1419('0x46')](_0x36e4f8)[_0x1419('0x25')](handleEntityNotFound(_0xe6d9c,null))[_0x1419('0x25')](respondWithResult(_0xe6d9c,null))[_0x1419('0x47')](handleError(_0xe6d9c,null));};exports['update']=function(_0x30e1c,_0x4d9324){if(_0x30e1c[_0x1419('0x48')]['id']){delete _0x30e1c[_0x1419('0x48')]['id'];}return db[_0x1419('0x2c')][_0x1419('0x46')]({'where':{'id':_0x30e1c[_0x1419('0x44')]['id']}})[_0x1419('0x25')](handleEntityNotFound(_0x4d9324,null))[_0x1419('0x25')](saveUpdates(_0x30e1c[_0x1419('0x48')],null))[_0x1419('0x25')](respondWithResult(_0x4d9324,null))['catch'](handleError(_0x4d9324,null));};exports[_0x1419('0x26')]=function(_0x3ad277,_0x340219){return db[_0x1419('0x2c')]['find']({'where':{'id':_0x3ad277[_0x1419('0x44')]['id']}})[_0x1419('0x25')](handleEntityNotFound(_0x340219,null))[_0x1419('0x25')](removeEntity(_0x340219,null))[_0x1419('0x47')](handleError(_0x340219,null));};exports[_0x1419('0x49')]=function(_0x10b475,_0x269942){return db[_0x1419('0x2c')]['describe']()[_0x1419('0x25')](respondWithResult(_0x269942,null))['catch'](handleError(_0x269942,null));}; \ No newline at end of file +var _0xfb19=['send','index','model','map','query','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','show','params','keys','intersection','length','find','catch','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','reject','save','update','then','destroy','sendStatus','error','name'];(function(_0x5019af,_0x2daaef){var _0x51c0b1=function(_0x2ea3c1){while(--_0x2ea3c1){_0x5019af['push'](_0x5019af['shift']());}};_0x51c0b1(++_0x2daaef);}(_0xfb19,0x1b7));var _0x9fb1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfb19[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9fb1('0x0'));var rimraf=require(_0x9fb1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fb1('0x2'));var rp=require('request-promise');var moment=require(_0x9fb1('0x3'));var BPromise=require(_0x9fb1('0x4'));var Mustache=require(_0x9fb1('0x5'));var util=require(_0x9fb1('0x6'));var path=require(_0x9fb1('0x7'));var sox=require(_0x9fb1('0x8'));var csv=require(_0x9fb1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fb1('0xa'));var squel=require(_0x9fb1('0xb'));var crypto=require(_0x9fb1('0xc'));var jsforce=require(_0x9fb1('0xd'));var deskjs=require(_0x9fb1('0xe'));var toCsv=require(_0x9fb1('0x9'));var querystring=require('querystring');var Papa=require(_0x9fb1('0xf'));var Redis=require(_0x9fb1('0x10'));var authService=require(_0x9fb1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fb1('0x12'));var logger=require(_0x9fb1('0x13'))(_0x9fb1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9fb1('0x15'));var db=require(_0x9fb1('0x16'))['db'];function respondWithStatusCode(_0x5216d1,_0x52edc1){_0x52edc1=_0x52edc1||0xcc;return function(_0x4e841e){if(_0x4e841e){return _0x5216d1['sendStatus'](_0x52edc1);}return _0x5216d1[_0x9fb1('0x17')](_0x52edc1)['end']();};}function respondWithResult(_0x5d5c84,_0x3d5e1a){_0x3d5e1a=_0x3d5e1a||0xc8;return function(_0x5b8d50){if(_0x5b8d50){return _0x5d5c84[_0x9fb1('0x17')](_0x3d5e1a)[_0x9fb1('0x18')](_0x5b8d50);}};}function respondWithFilteredResult(_0x180107,_0x412d84){return function(_0x3a5cad){if(_0x3a5cad){var _0x20e9fd=typeof _0x412d84[_0x9fb1('0x19')]==='undefined'&&typeof _0x412d84[_0x9fb1('0x1a')]==='undefined';var _0x54c28e=_0x3a5cad[_0x9fb1('0x1b')];var _0x41fea2=_0x20e9fd?0x0:_0x412d84['offset'];var _0x209cd7=_0x20e9fd?_0x3a5cad[_0x9fb1('0x1b')]:_0x412d84[_0x9fb1('0x19')]+_0x412d84[_0x9fb1('0x1a')];var _0x5abb02;if(_0x209cd7>=_0x54c28e){_0x209cd7=_0x54c28e;_0x5abb02=0xc8;}else{_0x5abb02=0xce;}_0x180107[_0x9fb1('0x17')](_0x5abb02);return _0x180107[_0x9fb1('0x1c')]('Content-Range',_0x41fea2+'-'+_0x209cd7+'/'+_0x54c28e)[_0x9fb1('0x18')](_0x3a5cad);}return null;};}function patchUpdates(_0xd9df65){return function(_0x597baa){try{jsonpatch['apply'](_0x597baa,_0xd9df65,!![]);}catch(_0x25982a){return BPromise[_0x9fb1('0x1d')](_0x25982a);}return _0x597baa[_0x9fb1('0x1e')]();};}function saveUpdates(_0x4410c0,_0x35c78b){return function(_0x4c694f){if(_0x4c694f){return _0x4c694f[_0x9fb1('0x1f')](_0x4410c0)[_0x9fb1('0x20')](function(_0x3d5443){return _0x3d5443;});}return null;};}function removeEntity(_0x2df213,_0x57e2da){return function(_0x3a90e9){if(_0x3a90e9){return _0x3a90e9[_0x9fb1('0x21')]()[_0x9fb1('0x20')](function(){_0x2df213['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1c4e,_0x2eef8a){return function(_0x3faf9c){if(!_0x3faf9c){_0x4a1c4e[_0x9fb1('0x22')](0x194);}return _0x3faf9c;};}function handleError(_0x17127e,_0x27ad89){_0x27ad89=_0x27ad89||0x1f4;return function(_0x1b36d9){logger[_0x9fb1('0x23')](_0x1b36d9['stack']);if(_0x1b36d9[_0x9fb1('0x24')]){delete _0x1b36d9[_0x9fb1('0x24')];}_0x17127e[_0x9fb1('0x17')](_0x27ad89)[_0x9fb1('0x25')](_0x1b36d9);};}exports[_0x9fb1('0x26')]=function(_0x1706bc,_0x84eb2c){var _0x4c010e={},_0x327b2b={},_0x5822ad={'count':0x0,'rows':[]};var _0xe2f1bf=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0xa444d5){return{'name':_0xa444d5['fieldName'],'type':_0xa444d5['type']['key']};});_0x327b2b[_0x9fb1('0x27')]=_[_0x9fb1('0x28')](_0xe2f1bf,_0x9fb1('0x24'));_0x327b2b[_0x9fb1('0x29')]=_['keys'](_0x1706bc[_0x9fb1('0x29')]);_0x327b2b['filters']=_['intersection'](_0x327b2b[_0x9fb1('0x27')],_0x327b2b[_0x9fb1('0x29')]);_0x4c010e['attributes']=_['intersection'](_0x327b2b[_0x9fb1('0x27')],qs[_0x9fb1('0x2a')](_0x1706bc[_0x9fb1('0x29')][_0x9fb1('0x2a')]));_0x4c010e[_0x9fb1('0x2b')]=_0x4c010e[_0x9fb1('0x2b')]['length']?_0x4c010e[_0x9fb1('0x2b')]:_0x327b2b[_0x9fb1('0x27')];if(!_0x1706bc[_0x9fb1('0x29')]['hasOwnProperty'](_0x9fb1('0x2c'))){_0x4c010e[_0x9fb1('0x1a')]=qs[_0x9fb1('0x1a')](_0x1706bc[_0x9fb1('0x29')][_0x9fb1('0x1a')]);_0x4c010e[_0x9fb1('0x19')]=qs[_0x9fb1('0x19')](_0x1706bc[_0x9fb1('0x29')][_0x9fb1('0x19')]);}_0x4c010e[_0x9fb1('0x2d')]=qs[_0x9fb1('0x2e')](_0x1706bc['query'][_0x9fb1('0x2e')]);_0x4c010e[_0x9fb1('0x2f')]=qs[_0x9fb1('0x30')](_[_0x9fb1('0x31')](_0x1706bc['query'],_0x327b2b[_0x9fb1('0x30')]),_0xe2f1bf);if(_0x1706bc['query'][_0x9fb1('0x32')]){_0x4c010e['where']=_[_0x9fb1('0x33')](_0x4c010e[_0x9fb1('0x2f')],{'$or':_['map'](_0xe2f1bf,function(_0x49832d){if(_0x49832d['type']!==_0x9fb1('0x34')){var _0x1071ce={};_0x1071ce[_0x49832d[_0x9fb1('0x24')]]={'$like':'%'+_0x1706bc[_0x9fb1('0x29')][_0x9fb1('0x32')]+'%'};return _0x1071ce;}})});}_0x4c010e=_[_0x9fb1('0x33')]({},_0x4c010e,_0x1706bc[_0x9fb1('0x35')]);var _0x212638={'where':_0x4c010e[_0x9fb1('0x2f')]};return db[_0x9fb1('0x36')]['count'](_0x212638)['then'](function(_0x364160){_0x5822ad[_0x9fb1('0x1b')]=_0x364160;if(_0x1706bc[_0x9fb1('0x29')][_0x9fb1('0x37')]){_0x4c010e[_0x9fb1('0x38')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9fb1('0x39')](_0x4c010e);})[_0x9fb1('0x20')](function(_0x45b456){_0x5822ad[_0x9fb1('0x3a')]=_0x45b456;return _0x5822ad;})[_0x9fb1('0x20')](respondWithFilteredResult(_0x84eb2c,_0x4c010e))['catch'](handleError(_0x84eb2c,null));};exports[_0x9fb1('0x3b')]=function(_0x1998ea,_0x461131){var _0x121466={'raw':!![],'where':{'id':_0x1998ea[_0x9fb1('0x3c')]['id']}},_0x15c46e={};_0x15c46e[_0x9fb1('0x27')]=_[_0x9fb1('0x3d')](db[_0x9fb1('0x36')]['rawAttributes']);_0x15c46e['query']=_[_0x9fb1('0x3d')](_0x1998ea[_0x9fb1('0x29')]);_0x15c46e[_0x9fb1('0x30')]=_[_0x9fb1('0x3e')](_0x15c46e[_0x9fb1('0x27')],_0x15c46e[_0x9fb1('0x29')]);_0x121466[_0x9fb1('0x2b')]=_[_0x9fb1('0x3e')](_0x15c46e[_0x9fb1('0x27')],qs[_0x9fb1('0x2a')](_0x1998ea[_0x9fb1('0x29')]['fields']));_0x121466[_0x9fb1('0x2b')]=_0x121466[_0x9fb1('0x2b')][_0x9fb1('0x3f')]?_0x121466[_0x9fb1('0x2b')]:_0x15c46e['model'];if(_0x1998ea[_0x9fb1('0x29')][_0x9fb1('0x37')]){_0x121466['include']=[{'all':!![]}];}_0x121466=_[_0x9fb1('0x33')]({},_0x121466,_0x1998ea['options']);return db[_0x9fb1('0x36')][_0x9fb1('0x40')](_0x121466)[_0x9fb1('0x20')](handleEntityNotFound(_0x461131,null))[_0x9fb1('0x20')](respondWithResult(_0x461131,null))[_0x9fb1('0x41')](handleError(_0x461131,null));};exports[_0x9fb1('0x1f')]=function(_0x5b52fa,_0x39352d){if(_0x5b52fa[_0x9fb1('0x42')]['id']){delete _0x5b52fa['body']['id'];}return db[_0x9fb1('0x36')]['find']({'where':{'id':_0x5b52fa[_0x9fb1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x39352d,null))[_0x9fb1('0x20')](saveUpdates(_0x5b52fa[_0x9fb1('0x42')],null))[_0x9fb1('0x20')](respondWithResult(_0x39352d,null))['catch'](handleError(_0x39352d,null));};exports[_0x9fb1('0x21')]=function(_0x293708,_0x2fb043){return db[_0x9fb1('0x36')][_0x9fb1('0x40')]({'where':{'id':_0x293708[_0x9fb1('0x3c')]['id']}})[_0x9fb1('0x20')](handleEntityNotFound(_0x2fb043,null))[_0x9fb1('0x20')](removeEntity(_0x2fb043,null))[_0x9fb1('0x41')](handleError(_0x2fb043,null));};exports[_0x9fb1('0x43')]=function(_0x58e19d,_0x1bc7b6){return db[_0x9fb1('0x36')]['describe']()[_0x9fb1('0x20')](respondWithResult(_0x1bc7b6,null))[_0x9fb1('0x41')](handleError(_0x1bc7b6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d510d83..0dafa21 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 _0xe759=['request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','bluebird'];(function(_0x430ea6,_0x58db3b){var _0x8c837=function(_0x1123ef){while(--_0x1123ef){_0x430ea6['push'](_0x430ea6['shift']());}};_0x8c837(++_0x58db3b);}(_0xe759,0x1dc));var _0x9e75=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe759[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9e75('0x0'));var util=require(_0x9e75('0x1'));var logger=require('../../config/logger')(_0x9e75('0x2'));var moment=require('moment');var BPromise=require(_0x9e75('0x3'));var rp=require(_0x9e75('0x4'));var fs=require('fs');var path=require(_0x9e75('0x5'));var rimraf=require('rimraf');var config=require(_0x9e75('0x6'));var attributes=require(_0x9e75('0x7'));module[_0x9e75('0x8')]=function(_0x50b25e,_0x11ca2e){return _0x50b25e[_0x9e75('0x9')](_0x9e75('0xa'),attributes,{'tableName':_0x9e75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47a8=['define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x1eaaf6,_0x24255e){var _0x5f4ce4=function(_0x497b73){while(--_0x497b73){_0x1eaaf6['push'](_0x1eaaf6['shift']());}};_0x5f4ce4(++_0x24255e);}(_0x47a8,0x1a7));var _0x847a=function(_0xa5e28e,_0x343827){_0xa5e28e=_0xa5e28e-0x0;var _0x49f20d=_0x47a8[_0xa5e28e];return _0x49f20d;};'use strict';var _=require(_0x847a('0x0'));var util=require(_0x847a('0x1'));var logger=require(_0x847a('0x2'))(_0x847a('0x3'));var moment=require(_0x847a('0x4'));var BPromise=require(_0x847a('0x5'));var rp=require(_0x847a('0x6'));var fs=require('fs');var path=require(_0x847a('0x7'));var rimraf=require(_0x847a('0x8'));var config=require(_0x847a('0x9'));var attributes=require(_0x847a('0xa'));module[_0x847a('0xb')]=function(_0x1ad579,_0x2b577b){return _0x1ad579[_0x847a('0xc')](_0x847a('0xd'),attributes,{'tableName':_0x847a('0xe'),'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 c89b2c9..432da70 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 _0xe598=['message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','limit','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x236e76,_0x3731e0){var _0x4736b3=function(_0x1bad02){while(--_0x1bad02){_0x236e76['push'](_0x236e76['shift']());}};_0x4736b3(++_0x3731e0);}(_0xe598,0x15e));var _0x8e59=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xe598[_0x1f5887];return _0x21774b;};'use strict';var _=require(_0x8e59('0x0'));var util=require(_0x8e59('0x1'));var moment=require(_0x8e59('0x2'));var BPromise=require(_0x8e59('0x3'));var rs=require(_0x8e59('0x4'));var fs=require('fs');var Redis=require(_0x8e59('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e59('0x6'));var logger=require(_0x8e59('0x7'))(_0x8e59('0x8'));var config=require(_0x8e59('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e59('0xa')][_0x8e59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9484b,_0x5c98f7,_0x2c4997){return new BPromise(function(_0xa2b2a1,_0xbba243){return client[_0x8e59('0xc')](_0x9484b,_0x2c4997)[_0x8e59('0xd')](function(_0x58616a){logger[_0x8e59('0xe')](_0x8e59('0xf'),_0x5c98f7,_0x8e59('0x10'));logger[_0x8e59('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5c98f7,_0x8e59('0x10'),JSON[_0x8e59('0x12')](_0x58616a));if(_0x58616a[_0x8e59('0x13')]){if(_0x58616a[_0x8e59('0x13')]['code']===0x1f4){logger[_0x8e59('0x13')](_0x8e59('0xf'),_0x5c98f7,_0x58616a[_0x8e59('0x13')][_0x8e59('0x14')]);return _0xbba243(_0x58616a[_0x8e59('0x13')][_0x8e59('0x14')]);}logger[_0x8e59('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x5c98f7,_0x58616a[_0x8e59('0x13')][_0x8e59('0x14')]);return _0xa2b2a1(_0x58616a[_0x8e59('0x13')][_0x8e59('0x14')]);}else{logger[_0x8e59('0xe')](_0x8e59('0xf'),_0x5c98f7,_0x8e59('0x10'));_0xa2b2a1(_0x58616a[_0x8e59('0x15')][_0x8e59('0x14')]);}})[_0x8e59('0x16')](function(_0x11933e){logger['error'](_0x8e59('0xf'),_0x5c98f7,_0x11933e);_0xbba243(_0x11933e);});});}exports['GetCmHopperBlack']=function(_0x40220f){var _0x31bfd3=this;return new Promise(function(_0xf30dd2,_0x1fbe5e){return db[_0x8e59('0x17')][_0x8e59('0x18')]({'raw':_0x40220f['options']?_0x40220f[_0x8e59('0x19')][_0x8e59('0x1a')]===undefined?!![]:![]:!![],'where':_0x40220f[_0x8e59('0x19')]?_0x40220f[_0x8e59('0x19')][_0x8e59('0x1b')]||null:null,'attributes':_0x40220f['options']?_0x40220f[_0x8e59('0x19')][_0x8e59('0x1c')]||null:null,'limit':_0x40220f[_0x8e59('0x19')]?_0x40220f[_0x8e59('0x19')]['limit']||null:null,'include':_0x40220f[_0x8e59('0x19')]?_0x40220f['options'][_0x8e59('0x1d')]?_['map'](_0x40220f[_0x8e59('0x19')][_0x8e59('0x1d')],function(_0x172320){return{'model':db[_0x172320['model']],'as':_0x172320['as'],'attributes':_0x172320[_0x8e59('0x1c')],'include':_0x172320[_0x8e59('0x1d')]?_[_0x8e59('0x1e')](_0x172320[_0x8e59('0x1d')],function(_0x34fb3c){return{'model':db[_0x34fb3c[_0x8e59('0x1f')]],'as':_0x34fb3c['as'],'attributes':_0x34fb3c[_0x8e59('0x1c')],'include':_0x34fb3c[_0x8e59('0x1d')]?_['map'](_0x34fb3c[_0x8e59('0x1d')],function(_0x2040e5){return{'model':db[_0x2040e5['model']],'as':_0x2040e5['as'],'attributes':_0x2040e5[_0x8e59('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8e59('0xd')](function(_0x41ff48){logger[_0x8e59('0xe')](_0x8e59('0x20'),_0x40220f);logger[_0x8e59('0x11')](_0x8e59('0x20'),_0x40220f,JSON[_0x8e59('0x12')](_0x41ff48));_0xf30dd2(_0x41ff48);})['catch'](function(_0x6f3f62){logger[_0x8e59('0x13')]('GetCmHopperBlack',_0x6f3f62[_0x8e59('0x14')],_0x40220f);_0x1fbe5e(_0x31bfd3[_0x8e59('0x13')](0x1f4,_0x6f3f62[_0x8e59('0x14')]));});});};exports[_0x8e59('0x21')]=function(_0x12f64f){var _0x4e0476=this;return new Promise(function(_0x3ebf54,_0x3287e0){return db[_0x8e59('0x17')][_0x8e59('0x22')](_0x12f64f['body'],{'raw':_0x12f64f['options']?_0x12f64f[_0x8e59('0x19')][_0x8e59('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12f64f[_0x8e59('0x19')]?_0x12f64f[_0x8e59('0x19')][_0x8e59('0x1b')]||null:null,'attributes':_0x12f64f[_0x8e59('0x19')]?_0x12f64f[_0x8e59('0x19')][_0x8e59('0x1c')]||null:null,'limit':_0x12f64f[_0x8e59('0x19')]?_0x12f64f['options'][_0x8e59('0x23')]||null:null})[_0x8e59('0xd')](function(_0x538d1b){logger['info'](_0x8e59('0x21'),_0x12f64f);logger['debug'](_0x8e59('0x21'),_0x12f64f,JSON[_0x8e59('0x12')](_0x538d1b));_0x3ebf54(_0x538d1b);})['catch'](function(_0x52cf83){logger[_0x8e59('0x13')](_0x8e59('0x21'),_0x52cf83[_0x8e59('0x14')],_0x12f64f);_0x3287e0(_0x4e0476[_0x8e59('0x13')](0x1f4,_0x52cf83[_0x8e59('0x14')]));});});};exports[_0x8e59('0x24')]=function(_0x2d1ffd){var _0x5457ea=this;return new Promise(function(_0x333d5c,_0x4d029a){return db[_0x8e59('0x17')]['destroy']({'where':_0x2d1ffd[_0x8e59('0x19')]?_0x2d1ffd[_0x8e59('0x19')][_0x8e59('0x1b')]||null:null})['then'](function(_0x2fbf43){logger[_0x8e59('0xe')]('DestroyCmHopperBlack',_0x2d1ffd);logger[_0x8e59('0x11')](_0x8e59('0x24'),_0x2d1ffd,JSON[_0x8e59('0x12')](_0x2fbf43));_0x333d5c(_0x2fbf43);})[_0x8e59('0x16')](function(_0x44d06b){logger['error']('DestroyCmHopperBlack',_0x44d06b[_0x8e59('0x14')],_0x2d1ffd);_0x4d029a(_0x5457ea[_0x8e59('0x13')](0x1f4,_0x44d06b[_0x8e59('0x14')]));});});}; \ No newline at end of file +var _0xd313=['request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','raw','options','where','attributes','include','map','model','then','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s'];(function(_0x5bdfb2,_0x5eeb10){var _0x5f5240=function(_0x2cb9c6){while(--_0x2cb9c6){_0x5bdfb2['push'](_0x5bdfb2['shift']());}};_0x5f5240(++_0x5eeb10);}(_0xd313,0xd0));var _0x3d31=function(_0x10478d,_0x222fa){_0x10478d=_0x10478d-0x0;var _0x4a8484=_0xd313[_0x10478d];return _0x4a8484;};'use strict';var _=require(_0x3d31('0x0'));var util=require(_0x3d31('0x1'));var moment=require('moment');var BPromise=require(_0x3d31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d31('0x3'));var db=require(_0x3d31('0x4'))['db'];var utils=require(_0x3d31('0x5'));var logger=require(_0x3d31('0x6'))(_0x3d31('0x7'));var config=require(_0x3d31('0x8'));var jayson=require(_0x3d31('0x9'));var client=jayson['client'][_0x3d31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf526c5,_0x28c77a,_0x997447){return new BPromise(function(_0x3c1b13,_0x305a77){return client[_0x3d31('0xb')](_0xf526c5,_0x997447)['then'](function(_0x54973b){logger[_0x3d31('0xc')](_0x3d31('0xd'),_0x28c77a,_0x3d31('0xe'));logger[_0x3d31('0xf')](_0x3d31('0x10'),_0x28c77a,'request\x20sent',JSON['stringify'](_0x54973b));if(_0x54973b[_0x3d31('0x11')]){if(_0x54973b[_0x3d31('0x11')][_0x3d31('0x12')]===0x1f4){logger['error'](_0x3d31('0xd'),_0x28c77a,_0x54973b['error'][_0x3d31('0x13')]);return _0x305a77(_0x54973b[_0x3d31('0x11')][_0x3d31('0x13')]);}logger[_0x3d31('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x28c77a,_0x54973b['error'][_0x3d31('0x13')]);return _0x3c1b13(_0x54973b['error'][_0x3d31('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x28c77a,'request\x20sent');_0x3c1b13(_0x54973b['result']['message']);}})[_0x3d31('0x14')](function(_0x2e564a){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x28c77a,_0x2e564a);_0x305a77(_0x2e564a);});});}exports[_0x3d31('0x15')]=function(_0x54986c){var _0x3de0bf=this;return new Promise(function(_0x45081e,_0xb5ed32){return db[_0x3d31('0x16')]['findAll']({'raw':_0x54986c['options']?_0x54986c['options'][_0x3d31('0x17')]===undefined?!![]:![]:!![],'where':_0x54986c[_0x3d31('0x18')]?_0x54986c[_0x3d31('0x18')][_0x3d31('0x19')]||null:null,'attributes':_0x54986c['options']?_0x54986c[_0x3d31('0x18')][_0x3d31('0x1a')]||null:null,'limit':_0x54986c[_0x3d31('0x18')]?_0x54986c['options']['limit']||null:null,'include':_0x54986c[_0x3d31('0x18')]?_0x54986c[_0x3d31('0x18')][_0x3d31('0x1b')]?_[_0x3d31('0x1c')](_0x54986c['options']['include'],function(_0x1cab9d){return{'model':db[_0x1cab9d[_0x3d31('0x1d')]],'as':_0x1cab9d['as'],'attributes':_0x1cab9d[_0x3d31('0x1a')],'include':_0x1cab9d[_0x3d31('0x1b')]?_[_0x3d31('0x1c')](_0x1cab9d[_0x3d31('0x1b')],function(_0x61d9e0){return{'model':db[_0x61d9e0['model']],'as':_0x61d9e0['as'],'attributes':_0x61d9e0[_0x3d31('0x1a')],'include':_0x61d9e0['include']?_[_0x3d31('0x1c')](_0x61d9e0[_0x3d31('0x1b')],function(_0x5dadb9){return{'model':db[_0x5dadb9[_0x3d31('0x1d')]],'as':_0x5dadb9['as'],'attributes':_0x5dadb9['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d31('0x1e')](function(_0x11d68e){logger['info']('GetCmHopperBlack',_0x54986c);logger[_0x3d31('0xf')]('GetCmHopperBlack',_0x54986c,JSON[_0x3d31('0x1f')](_0x11d68e));_0x45081e(_0x11d68e);})[_0x3d31('0x14')](function(_0x3fde73){logger[_0x3d31('0x11')]('GetCmHopperBlack',_0x3fde73['message'],_0x54986c);_0xb5ed32(_0x3de0bf[_0x3d31('0x11')](0x1f4,_0x3fde73[_0x3d31('0x13')]));});});};exports[_0x3d31('0x20')]=function(_0x1977ef){var _0x5e2a7f=this;return new Promise(function(_0x337fe3,_0x5da289){return db[_0x3d31('0x16')][_0x3d31('0x21')](_0x1977ef[_0x3d31('0x22')],{'raw':_0x1977ef[_0x3d31('0x18')]?_0x1977ef['options'][_0x3d31('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1977ef[_0x3d31('0x18')]?_0x1977ef['options'][_0x3d31('0x19')]||null:null,'attributes':_0x1977ef['options']?_0x1977ef[_0x3d31('0x18')]['attributes']||null:null,'limit':_0x1977ef[_0x3d31('0x18')]?_0x1977ef['options']['limit']||null:null})[_0x3d31('0x1e')](function(_0xf962d4){logger[_0x3d31('0xc')](_0x3d31('0x20'),_0x1977ef);logger[_0x3d31('0xf')](_0x3d31('0x20'),_0x1977ef,JSON[_0x3d31('0x1f')](_0xf962d4));_0x337fe3(_0xf962d4);})['catch'](function(_0x2ebdba){logger[_0x3d31('0x11')]('UpdateCmHopperBlack',_0x2ebdba[_0x3d31('0x13')],_0x1977ef);_0x5da289(_0x5e2a7f[_0x3d31('0x11')](0x1f4,_0x2ebdba[_0x3d31('0x13')]));});});};exports[_0x3d31('0x23')]=function(_0x3ac65c){var _0x2e2bd9=this;return new Promise(function(_0x356e5b,_0x1d19a9){return db['CmHopperBlack'][_0x3d31('0x24')]({'where':_0x3ac65c['options']?_0x3ac65c[_0x3d31('0x18')]['where']||null:null})[_0x3d31('0x1e')](function(_0x152a73){logger[_0x3d31('0xc')](_0x3d31('0x23'),_0x3ac65c);logger[_0x3d31('0xf')]('DestroyCmHopperBlack',_0x3ac65c,JSON[_0x3d31('0x1f')](_0x152a73));_0x356e5b(_0x152a73);})[_0x3d31('0x14')](function(_0x13db21){logger[_0x3d31('0x11')](_0x3d31('0x23'),_0x13db21[_0x3d31('0x13')],_0x3ac65c);_0x1d19a9(_0x2e2bd9[_0x3d31('0x11')](0x1f4,_0x13db21[_0x3d31('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b1da6ec..cd65c75 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 _0xa456=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','put','/:id','update','delete','destroy','exports','multer'];(function(_0x18addd,_0x50858a){var _0x905536=function(_0x8ede9d){while(--_0x8ede9d){_0x18addd['push'](_0x18addd['shift']());}};_0x905536(++_0x50858a);}(_0xa456,0x142));var _0x6a45=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xa456[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0xd')](_0x6a45('0xe'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xf')]);router[_0x6a45('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6a45('0x11')]);module[_0x6a45('0x12')]=router; \ No newline at end of file +var _0x2675=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','exports','multer','express','Router'];(function(_0x1d2467,_0x41dfa8){var _0x23010b=function(_0x2dc9dc){while(--_0x2dc9dc){_0x1d2467['push'](_0x1d2467['shift']());}};_0x23010b(++_0x41dfa8);}(_0x2675,0x75));var _0x5267=function(_0x159f5d,_0x18c79c){_0x159f5d=_0x159f5d-0x0;var _0x5b0ae7=_0x2675[_0x159f5d];return _0x5b0ae7;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id',auth[_0x5267('0x7')](),controller['show']);router[_0x5267('0xb')](_0x5267('0xc'),auth[_0x5267('0x7')](),controller['update']);router[_0x5267('0xd')]('/:id',auth[_0x5267('0x7')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f06c9c0..28f2e21 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 _0xaa4c=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','setDataValue','followuptime','diff'];(function(_0x19c0cf,_0x4d51a2){var _0x4b4fe5=function(_0x20e501){while(--_0x20e501){_0x19c0cf['push'](_0x19c0cf['shift']());}};_0x4b4fe5(++_0x4d51a2);}(_0xaa4c,0x10a));var _0xcaa4=function(_0x1c6738,_0x346582){_0x1c6738=_0x1c6738-0x0;var _0x1263b1=_0xaa4c[_0x1c6738];return _0x1263b1;};'use strict';var Sequelize=require(_0xcaa4('0x0'));var moment=require(_0xcaa4('0x1'));module[_0xcaa4('0x2')]={'state':{'type':Sequelize[_0xcaa4('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xcaa4('0x4')]},'countbusyretry':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcaa4('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xcaa4('0x5')]},'originatecalleridname':{'type':Sequelize[_0xcaa4('0x5')]},'calleridnum':{'type':Sequelize[_0xcaa4('0x5')]},'calleridname':{'type':Sequelize[_0xcaa4('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcaa4('0x4')]},'answertime':{'type':Sequelize[_0xcaa4('0x4')]},'droptime':{'type':Sequelize[_0xcaa4('0x4')]},'endtime':{'type':Sequelize[_0xcaa4('0x4')]},'ringtime':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcaa4('0x5')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcaa4('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xcaa4('0x5')]},'disposition':{'type':Sequelize[_0xcaa4('0x5')]},'secondDisposition':{'type':Sequelize[_0xcaa4('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xcaa4('0x4')],'set':function(_0x4e928a){var _0x855bc6=this[_0xcaa4('0x6')]('endtime');if(_0x855bc6&&_0x4e928a){this[_0xcaa4('0x7')](_0xcaa4('0x8'),moment(_0x4e928a)[_0xcaa4('0x9')](moment(_0x855bc6),_0xcaa4('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xcaa4('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcaa4('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xcaa4('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcaa4('0x4')]},'callback':{'type':Sequelize[_0xcaa4('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcaa4('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcaa4('0x4')]},'recallme':{'type':Sequelize[_0xcaa4('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xcaa4('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcaa4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4c08=['INTEGER','STRING','DATE','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports'];(function(_0x3d6599,_0x36c8a0){var _0x408f1a=function(_0x1644f3){while(--_0x1644f3){_0x3d6599['push'](_0x3d6599['shift']());}};_0x408f1a(++_0x36c8a0);}(_0x4c08,0x9d));var _0x84c0=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x4c08[_0x10b48a];return _0x2c4533;};'use strict';var Sequelize=require(_0x84c0('0x0'));var moment=require(_0x84c0('0x1'));module[_0x84c0('0x2')]={'state':{'type':Sequelize[_0x84c0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x84c0('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x84c0('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x84c0('0x4')]},'calleridnum':{'type':Sequelize[_0x84c0('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x84c0('0x5')]},'responsetime':{'type':Sequelize[_0x84c0('0x5')]},'answertime':{'type':Sequelize[_0x84c0('0x5')]},'droptime':{'type':Sequelize[_0x84c0('0x5')]},'endtime':{'type':Sequelize[_0x84c0('0x5')]},'ringtime':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x84c0('0x4')]},'campaigntype':{'type':Sequelize[_0x84c0('0x4')]},'membername':{'type':Sequelize[_0x84c0('0x4')]},'reason':{'type':Sequelize[_0x84c0('0x4')]},'disposition':{'type':Sequelize[_0x84c0('0x4')]},'secondDisposition':{'type':Sequelize[_0x84c0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5e0d08){var _0x15d105=this['getDataValue']('endtime');if(_0x15d105&&_0x5e0d08){this[_0x84c0('0x6')](_0x84c0('0x7'),moment(_0x5e0d08)[_0x84c0('0x8')](moment(_0x15d105),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x84c0('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x84c0('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x84c0('0x5')]},'callback':{'type':Sequelize[_0x84c0('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x84c0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x84c0('0x5')]},'deleted':{'type':Sequelize[_0x84c0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x84c0('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x84c0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x84c0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x84c0('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 36adde2..cc121ec 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 _0x01d9=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5bd072,_0x3f02d6){var _0x17c868=function(_0x1bcfe4){while(--_0x1bcfe4){_0x5bd072['push'](_0x5bd072['shift']());}};_0x17c868(++_0x3f02d6);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['CmHopperFinal'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')]()[_0x901d('0x28')](respondWithResult(_0x27459b,null))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x2cd965,_0x23f2a9){if(_0x2cd965['body']['uniqueid']){delete _0x2cd965[_0x901d('0x4c')][_0x901d('0x4d')];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'uniqueid':_0x2cd965[_0x901d('0x48')]['id']}})['then'](handleEntityNotFound(_0x23f2a9,null))['then'](saveUpdates(_0x2cd965[_0x901d('0x4c')],null))[_0x901d('0x28')](respondWithResult(_0x23f2a9,null))['catch'](handleError(_0x23f2a9,null));};exports[_0x901d('0x4e')]=function(_0x165207,_0x4d2b2d,_0x4512e5){return db['CmHopperFinal'][_0x901d('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x165207[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),'noAnswerContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x56')))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db['sequelize']['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),'dropContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x4d2b2d,null))['then'](respondWithResult(_0x4d2b2d,null))[_0x901d('0x46')](handleError(_0x4d2b2d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xabab57,_0x219c23,_0xecc8f9){return db[_0x901d('0x2f')][_0x901d('0x4f')]({'raw':![],'where':{'CampaignId':_0xabab57[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),_0x901d('0x5f')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),_0x901d('0x60')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')]['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x219c23,null))[_0x901d('0x28')](respondWithResult(_0x219c23,null))[_0x901d('0x46')](handleError(_0x219c23,null));};exports[_0x901d('0x61')]=function(_0x5cff96,_0x130dfb,_0x302049){return db[_0x901d('0x62')]['find']({'where':{'id':_0x5cff96[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x130dfb,null))[_0x901d('0x28')](function(_0x4b5e3b){var _0x576d50;if(_0x4b5e3b){_0x576d50=squel['insert']()[_0x901d('0x63')](_0x901d('0x64'))['fromQuery'](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x68'),_0x901d('0x69'),'updatedAt'],squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))['field'](_0x901d('0x6e'),'scheduledAt')[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))[_0x901d('0x6b')](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x70'),_0x901d('0x68'))['field'](_0x901d('0x6e'),_0x901d('0x69'))['field'](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')['where'](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id']['toString']())[_0x901d('0x3e')](_0x901d('0x72'),_0x5cff96[_0x901d('0x4c')][_0x901d('0x73')][_0x901d('0x74')]())['where'](_0x901d('0x75'))[_0x901d('0x3e')](_0x901d('0x76'),squel['select']()[_0x901d('0x6b')](_0x901d('0x6d'))[_0x901d('0x77')](_0x901d('0x64'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')](_0x901d('0x7a')))[_0x901d('0x7b')]('ContactId'))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x576d50);}return[];})['then'](respondWithResult(_0x130dfb,null))[_0x901d('0x46')](handleError(_0x130dfb,null));};exports[_0x901d('0x7c')]=function(_0xa14cbd,_0x34f33f,_0x785f77){return db[_0x901d('0x7d')][_0x901d('0x4a')]({'where':{'id':_0xa14cbd[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x34f33f,null))[_0x901d('0x28')](function(_0x28b640){var _0x45601a;if(_0x28b640){_0x45601a=squel[_0x901d('0x7e')]()[_0x901d('0x63')](_0x901d('0x64'))[_0x901d('0x7f')](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x80'),_0x901d('0x69'),_0x901d('0x81')],squel['select']()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))[_0x901d('0x6b')](_0x901d('0x6e'),_0x901d('0x65'))[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))['field'](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x82'),'CampaignId')['field']('NOW()','createdAt')[_0x901d('0x6b')](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')[_0x901d('0x3e')]('CampaignId\x20=\x20?',_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x20?',_0xa14cbd['body'][_0x901d('0x73')][_0x901d('0x74')]())[_0x901d('0x3e')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x901d('0x6a')]()[_0x901d('0x6b')]('phone')[_0x901d('0x77')]('cm_hopper')['where'](_0x901d('0x83'),_0xa14cbd['params']['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x83'),_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x204'))['group'](_0x901d('0x66')))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x45601a);}return[];})[_0x901d('0x28')](respondWithResult(_0x34f33f,null))[_0x901d('0x46')](handleError(_0x34f33f,null));};exports[_0x901d('0x84')]=function(_0x306491,_0x3cb399,_0x101067){return db['CmHopper'][_0x901d('0x85')]({'where':{'VoiceQueueId':_0x306491[_0x901d('0x4c')][_0x901d('0x68')],'CampaignId':_0x306491[_0x901d('0x4c')][_0x901d('0x80')],'ContactId':_0x306491[_0x901d('0x4c')][_0x901d('0x66')]}})[_0x901d('0x28')](handleEntityNotFound(_0x3cb399,null))[_0x901d('0x28')](function(_0x17b7ef){if(_0x17b7ef){return _0x17b7ef;}return null;})[_0x901d('0x28')](respondWithResult(_0x3cb399,null))[_0x901d('0x46')](handleError(_0x3cb399,null));}; \ No newline at end of file +var _0x326f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','rows','catch','show','params','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','toString','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','fromQuery','phone','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x326f,0xd1));var _0xf326=function(_0x295508,_0x20eb17){_0x295508=_0x295508-0x0;var _0xf4b75e=_0x326f[_0x295508];return _0xf4b75e;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}exports['index']=function(_0x4a9abf,_0x6a8e89){var _0x1ae23a={},_0x2fa28e={},_0x5dbe63={'count':0x0,'rows':[]};var _0xc115d9=_[_0xf326('0x28')](db['CmHopperFinal'][_0xf326('0x29')],function(_0x119ab8){return{'name':_0x119ab8[_0xf326('0x2a')],'type':_0x119ab8[_0xf326('0x2b')][_0xf326('0x2c')]};});_0x2fa28e[_0xf326('0x2d')]=_[_0xf326('0x28')](_0xc115d9,_0xf326('0x26'));_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x4a9abf['query']);_0x2fa28e[_0xf326('0x30')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],_0x2fa28e['query']);_0x1ae23a[_0xf326('0x32')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],qs['fields'](_0x4a9abf['query'][_0xf326('0x33')]));_0x1ae23a[_0xf326('0x32')]=_0x1ae23a[_0xf326('0x32')][_0xf326('0x34')]?_0x1ae23a[_0xf326('0x32')]:_0x2fa28e[_0xf326('0x2d')];if(!_0x4a9abf[_0xf326('0x2e')][_0xf326('0x35')]('nolimit')){_0x1ae23a[_0xf326('0x1c')]=qs[_0xf326('0x1c')](_0x4a9abf['query'][_0xf326('0x1c')]);_0x1ae23a['offset']=qs[_0xf326('0x1a')](_0x4a9abf['query']['offset']);}_0x1ae23a[_0xf326('0x36')]=qs['sort'](_0x4a9abf[_0xf326('0x2e')]['sort']);_0x1ae23a[_0xf326('0x37')]=qs[_0xf326('0x30')](_[_0xf326('0x38')](_0x4a9abf['query'],_0x2fa28e[_0xf326('0x30')]),_0xc115d9);if(_0x4a9abf[_0xf326('0x2e')]['filter']){_0x1ae23a[_0xf326('0x37')]=_[_0xf326('0x39')](_0x1ae23a[_0xf326('0x37')],{'$or':_[_0xf326('0x28')](_0xc115d9,function(_0x51076c){if(_0x51076c[_0xf326('0x2b')]!==_0xf326('0x3a')){var _0x1e69b1={};_0x1e69b1[_0x51076c[_0xf326('0x26')]]={'$like':'%'+_0x4a9abf[_0xf326('0x2e')]['filter']+'%'};return _0x1e69b1;}})});}_0x1ae23a=_[_0xf326('0x39')]({},_0x1ae23a,_0x4a9abf[_0xf326('0x3b')]);var _0x5cfb97={'where':_0x1ae23a['where']};return db[_0xf326('0x3c')]['count'](_0x5cfb97)['then'](function(_0x22d462){_0x5dbe63['count']=_0x22d462;if(_0x4a9abf[_0xf326('0x2e')][_0xf326('0x3d')]){_0x1ae23a[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x3c')]['findAll'](_0x1ae23a);})[_0xf326('0x24')](function(_0x45d344){_0x5dbe63[_0xf326('0x3f')]=_0x45d344;return _0x5dbe63;})[_0xf326('0x24')](respondWithFilteredResult(_0x6a8e89,_0x1ae23a))[_0xf326('0x40')](handleError(_0x6a8e89,null));};exports[_0xf326('0x41')]=function(_0x2ad841,_0x224a32){var _0x31283b={'raw':!![],'where':{'id':_0x2ad841[_0xf326('0x42')]['id']}},_0x1227d3={};_0x1227d3[_0xf326('0x2d')]=_['keys'](db[_0xf326('0x3c')][_0xf326('0x29')]);_0x1227d3[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x2ad841[_0xf326('0x2e')]);_0x1227d3[_0xf326('0x30')]=_['intersection'](_0x1227d3[_0xf326('0x2d')],_0x1227d3[_0xf326('0x2e')]);_0x31283b['attributes']=_[_0xf326('0x31')](_0x1227d3[_0xf326('0x2d')],qs[_0xf326('0x33')](_0x2ad841[_0xf326('0x2e')][_0xf326('0x33')]));_0x31283b['attributes']=_0x31283b['attributes'][_0xf326('0x34')]?_0x31283b[_0xf326('0x32')]:_0x1227d3['model'];if(_0x2ad841['query'][_0xf326('0x3d')]){_0x31283b[_0xf326('0x3e')]=[{'all':!![]}];}_0x31283b=_[_0xf326('0x39')]({},_0x31283b,_0x2ad841['options']);return db[_0xf326('0x3c')][_0xf326('0x43')](_0x31283b)[_0xf326('0x24')](handleEntityNotFound(_0x224a32,null))[_0xf326('0x24')](respondWithResult(_0x224a32,null))[_0xf326('0x40')](handleError(_0x224a32,null));};exports[_0xf326('0x44')]=function(_0x12792c,_0x3b90dc){return db[_0xf326('0x3c')][_0xf326('0x44')]()[_0xf326('0x24')](respondWithResult(_0x3b90dc,null))[_0xf326('0x40')](handleError(_0x3b90dc,null));};exports[_0xf326('0x22')]=function(_0x395b1e,_0xeac1a1){if(_0x395b1e['body'][_0xf326('0x45')]){delete _0x395b1e[_0xf326('0x46')][_0xf326('0x45')];}return db[_0xf326('0x3c')]['find']({'where':{'uniqueid':_0x395b1e[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0xeac1a1,null))[_0xf326('0x24')](saveUpdates(_0x395b1e[_0xf326('0x46')],null))['then'](respondWithResult(_0xeac1a1,null))[_0xf326('0x40')](handleError(_0xeac1a1,null));};exports[_0xf326('0x47')]=function(_0x145a77,_0x451ac7,_0x39ba25){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x145a77[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),'noSuchContacts'],[db['sequelize']['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x4c')))),_0xf326('0x4d')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4f')))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x51')))),'dropContacts'],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x53')))),'reCallContacts'],[db[_0xf326('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x54')))),_0xf326('0x55')]]})[_0xf326('0x24')](handleEntityNotFound(_0x451ac7,null))['then'](respondWithResult(_0x451ac7,null))['catch'](handleError(_0x451ac7,null));};exports[_0xf326('0x56')]=function(_0xa85a42,_0x33b259,_0x5d0177){return db[_0xf326('0x3c')]['findAll']({'raw':![],'where':{'CampaignId':_0xa85a42[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),_0xf326('0x57')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xf326('0x4d')],[db['sequelize']['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x51')))),_0xf326('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x59')))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')](_0xf326('0x53')))),_0xf326('0x5a')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db['sequelize']['literal'](_0xf326('0x54')))),'answeringMachine']]})[_0xf326('0x24')](handleEntityNotFound(_0x33b259,null))[_0xf326('0x24')](respondWithResult(_0x33b259,null))[_0xf326('0x40')](handleError(_0x33b259,null));};exports[_0xf326('0x5b')]=function(_0x17cd36,_0x541491,_0x4a053c){return db['VoiceQueue'][_0xf326('0x43')]({'where':{'id':_0x17cd36[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x541491,null))[_0xf326('0x24')](function(_0xec5857){var _0x5e874b;if(_0xec5857){_0x5e874b=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))['fromQuery'](['phone',_0xf326('0x5f'),_0xf326('0x60'),'ListId','VoiceQueueId',_0xf326('0x61'),'updatedAt'],squel[_0xf326('0x62')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x5f'))['field'](_0xf326('0x65'),_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x68'),_0xf326('0x69'))[_0xf326('0x63')]('NOW()',_0xf326('0x61'))['field'](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')]('cm_hopper_final')[_0xf326('0x37')](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id']['toString']())[_0xf326('0x37')](_0xf326('0x6d'),_0x17cd36[_0xf326('0x46')][_0xf326('0x6e')]['toString']())[_0xf326('0x37')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field']('phone')['from'](_0xf326('0x5e'))['where'](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id'][_0xf326('0x70')]()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field'](_0xf326('0x71'))[_0xf326('0x6b')]('cm_hopper_final')['where'](_0xf326('0x6c'),_0x17cd36['params']['id'][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x72')))[_0xf326('0x73')](_0xf326('0x60')))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x5e874b);}return[];})[_0xf326('0x24')](respondWithResult(_0x541491,null))['catch'](handleError(_0x541491,null));};exports[_0xf326('0x74')]=function(_0x26bbb1,_0x4ac90e,_0x3c82cf){return db['Campaign'][_0xf326('0x43')]({'where':{'id':_0x26bbb1[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x4ac90e,null))['then'](function(_0x2b4414){var _0x1c86c8;if(_0x2b4414){_0x1c86c8=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))[_0xf326('0x75')]([_0xf326('0x76'),_0xf326('0x5f'),_0xf326('0x60'),_0xf326('0x67'),_0xf326('0x77'),_0xf326('0x61'),_0xf326('0x6a')],squel[_0xf326('0x62')]()[_0xf326('0x63')]('ANY_VALUE(calleridnum)',_0xf326('0x76'))[_0xf326('0x63')]('NOW()',_0xf326('0x5f'))[_0xf326('0x63')]('ANY_VALUE(ContactId)',_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x78'),_0xf326('0x77'))['field'](_0xf326('0x64'),_0xf326('0x61'))[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')](_0xf326('0x79'))[_0xf326('0x37')]('CampaignId\x20=\x20?',_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where'](_0xf326('0x6d'),_0x26bbb1['body'][_0xf326('0x6e')][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x7a'))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x76'))[_0xf326('0x6b')](_0xf326('0x5e'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id']['toString']()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x71'))['from'](_0xf326('0x79'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where']('state\x20=\x204'))[_0xf326('0x73')]('ContactId'))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x1c86c8);}return[];})['then'](respondWithResult(_0x4ac90e,null))['catch'](handleError(_0x4ac90e,null));};exports[_0xf326('0x7c')]=function(_0x2d92e4,_0x167ac9,_0x34870c){return db[_0xf326('0x7d')]['findOne']({'where':{'VoiceQueueId':_0x2d92e4[_0xf326('0x46')][_0xf326('0x69')],'CampaignId':_0x2d92e4[_0xf326('0x46')]['CampaignId'],'ContactId':_0x2d92e4['body']['ContactId']}})[_0xf326('0x24')](handleEntityNotFound(_0x167ac9,null))[_0xf326('0x24')](function(_0x2d275d){if(_0x2d275d){return _0x2d275d;}return null;})[_0xf326('0x24')](respondWithResult(_0x167ac9,null))[_0xf326('0x40')](handleError(_0x167ac9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 29590f9..779fc30 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 _0x493f=['uniqueid','util','../../config/logger','api','request-promise','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x493f,0x1c3));var _0xf493=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x493f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xf493('0x0'));var logger=require(_0xf493('0x1'))(_0xf493('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf493('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf493('0x4'));var attributes=require(_0xf493('0x5'));module['exports']=function(_0x81e9a7,_0x25f826){return _0x81e9a7[_0xf493('0x6')](_0xf493('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xf493('0x8'),'fields':[_0xf493('0x8')]},{'name':'uniqueid','fields':[_0xf493('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb1a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x2acdd5,_0x23d2e7){var _0x212407=function(_0x18efb0){while(--_0x18efb0){_0x2acdd5['push'](_0x2acdd5['shift']());}};_0x212407(++_0x23d2e7);}(_0xdb1a,0x78));var _0xadb1=function(_0xffbc46,_0x406d99){_0xffbc46=_0xffbc46-0x0;var _0x4bebe4=_0xdb1a[_0xffbc46];return _0x4bebe4;};'use strict';var _=require(_0xadb1('0x0'));var util=require(_0xadb1('0x1'));var logger=require(_0xadb1('0x2'))(_0xadb1('0x3'));var moment=require(_0xadb1('0x4'));var BPromise=require(_0xadb1('0x5'));var rp=require(_0xadb1('0x6'));var fs=require('fs');var path=require(_0xadb1('0x7'));var rimraf=require(_0xadb1('0x8'));var config=require(_0xadb1('0x9'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x3004a7,_0x32273d){return _0x3004a7[_0xadb1('0xa')](_0xadb1('0xb'),attributes,{'tableName':_0xadb1('0xc'),'paranoid':![],'indexes':[{'name':_0xadb1('0xd'),'fields':[_0xadb1('0xd')]},{'name':'uniqueid','fields':[_0xadb1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8f66a89..1be321a 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(_0x6ddc48,_0x73fe3d){var _0x6d60c6=function(_0x336e41){while(--_0x336e41){_0x6ddc48['push'](_0x6ddc48['shift']());}};_0x6d60c6(++_0x73fe3d);}(_0xb10b,0x12a));var _0xbb10=function(_0xafb8e6,_0x4b3a6b){_0xafb8e6=_0xafb8e6-0x0;var _0x36eec3=_0xb10b[_0xafb8e6];return _0x36eec3;};'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(_0x9b19f,_0x249fb9){var _0x580272=function(_0x2b3196){while(--_0x2b3196){_0x9b19f['push'](_0x9b19f['shift']());}};_0x580272(++_0x249fb9);}(_0xb10b,0x12a));var _0xbb10=function(_0x903e7f,_0x3a8c45){_0x903e7f=_0x903e7f-0x0;var _0x2411f3=_0xb10b[_0x903e7f];return _0x2411f3;};'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 9884409..b2d052e 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 _0xbd4e=['/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','get','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xbd4e,0x1cb));var _0xebd4=function(_0x1ed22a,_0x4ff3cf){_0x1ed22a=_0x1ed22a-0x0;var _0x6d1abc=_0xbd4e[_0x1ed22a];return _0x6d1abc;};'use strict';var multer=require(_0xebd4('0x0'));var util=require(_0xebd4('0x1'));var path=require('path');var timeout=require(_0xebd4('0x2'));var express=require(_0xebd4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xebd4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xebd4('0x5'));var controller=require(_0xebd4('0x6'));router['get']('/',auth[_0xebd4('0x7')](),controller[_0xebd4('0x8')]);router['get'](_0xebd4('0x9'),auth[_0xebd4('0x7')](),controller[_0xebd4('0xa')]);router['get']('/:id',auth[_0xebd4('0x7')](),controller[_0xebd4('0xb')]);router['get'](_0xebd4('0xc'),auth[_0xebd4('0x7')](),controller[_0xebd4('0xd')]);router[_0xebd4('0xe')](_0xebd4('0xf'),auth[_0xebd4('0x7')](),controller[_0xebd4('0x10')]);router['post'](_0xebd4('0x11'),auth['isAuthenticated'](),controller[_0xebd4('0x12')]);router[_0xebd4('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xebd4('0x7')](),controller[_0xebd4('0x14')]);router[_0xebd4('0x13')]('/checkContactHopper',auth[_0xebd4('0x7')](),controller[_0xebd4('0x15')]);router[_0xebd4('0x16')](_0xebd4('0x17'),auth[_0xebd4('0x7')](),controller[_0xebd4('0x18')]);module[_0xebd4('0x19')]=router; \ No newline at end of file +var _0xde7a=['countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','moveContactsIvrCampaignHopperFinal','checkContactHopper','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xde7a,0xa6));var _0xade7=function(_0x88f9f7,_0x1753ff){_0x88f9f7=_0x88f9f7-0x0;var _0x5f3769=_0xde7a[_0x88f9f7];return _0x5f3769;};'use strict';var multer=require(_0xade7('0x0'));var util=require('util');var path=require(_0xade7('0x1'));var timeout=require(_0xade7('0x2'));var express=require(_0xade7('0x3'));var router=express[_0xade7('0x4')]();var fs_extra=require(_0xade7('0x5'));var auth=require(_0xade7('0x6'));var interaction=require(_0xade7('0x7'));var config=require(_0xade7('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xade7('0x9')]('/',auth[_0xade7('0xa')](),controller[_0xade7('0xb')]);router[_0xade7('0x9')]('/describe',auth[_0xade7('0xa')](),controller[_0xade7('0xc')]);router[_0xade7('0x9')](_0xade7('0xd'),auth[_0xade7('0xa')](),controller[_0xade7('0xe')]);router[_0xade7('0x9')](_0xade7('0xf'),auth[_0xade7('0xa')](),controller[_0xade7('0x10')]);router['get'](_0xade7('0x11'),auth['isAuthenticated'](),controller[_0xade7('0x12')]);router['post'](_0xade7('0x13'),auth[_0xade7('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xade7('0x14')]('/voice/campaign/moveContacts/:id',auth[_0xade7('0xa')](),controller[_0xade7('0x15')]);router[_0xade7('0x14')]('/checkContactHopper',auth[_0xade7('0xa')](),controller[_0xade7('0x16')]);router['put'](_0xade7('0xd'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5896a6b..251ba0d 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 _0x8e5f=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x8e5f,0xd8));var _0xf8e5=function(_0x5eb0b2,_0x15a498){_0x5eb0b2=_0x5eb0b2-0x0;var _0x3b87f5=_0x8e5f[_0x5eb0b2];return _0x3b87f5;};'use strict';var Sequelize=require('sequelize');module[_0xf8e5('0x0')]={'state':{'type':Sequelize[_0xf8e5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf8e5('0x2')]},'scheduledat':{'type':Sequelize[_0xf8e5('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf8e5('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf8e5('0x2')]},'calleridnum':{'type':Sequelize[_0xf8e5('0x2')]},'calleridname':{'type':Sequelize[_0xf8e5('0x2')]},'starttime':{'type':Sequelize[_0xf8e5('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf8e5('0x3')]},'droptime':{'type':Sequelize[_0xf8e5('0x3')]},'endtime':{'type':Sequelize[_0xf8e5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf8e5('0x2')]},'campaign':{'type':Sequelize[_0xf8e5('0x2')]},'campaigntype':{'type':Sequelize[_0xf8e5('0x2')]},'membername':{'type':Sequelize[_0xf8e5('0x2')]},'reason':{'type':Sequelize[_0xf8e5('0x2')]},'amd':{'type':Sequelize[_0xf8e5('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf8e5('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf8e5('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf8e5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf8e5('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf8e5('0x3')]},'edited':{'type':Sequelize[_0xf8e5('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8e5('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf8e5('0x2')]}}; \ No newline at end of file +var _0xca83=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0xca83,0x99));var _0x3ca8=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xca83[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require(_0x3ca8('0x0'));module['exports']={'state':{'type':Sequelize[_0x3ca8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3ca8('0x2')]},'scheduledat':{'type':Sequelize[_0x3ca8('0x3')]},'countbusyretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3ca8('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x3ca8('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3ca8('0x2')]},'calleridname':{'type':Sequelize[_0x3ca8('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3ca8('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3ca8('0x3')]},'endtime':{'type':Sequelize[_0x3ca8('0x3')]},'ringtime':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3ca8('0x2')]},'campaigntype':{'type':Sequelize[_0x3ca8('0x2')]},'membername':{'type':Sequelize[_0x3ca8('0x2')]},'reason':{'type':Sequelize[_0x3ca8('0x2')]},'amd':{'type':Sequelize[_0x3ca8('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3ca8('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3ca8('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3ca8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x3ca8('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3ca8('0x3')]},'edited':{'type':Sequelize[_0x3ca8('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3ca8('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3ca8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 309f3ac..988aabf 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 _0x0ea5=['../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','CmHopperHistory','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','find','catch','create','describe','uniqueid','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x350e63,_0x61a9eb){var _0x36cd35=function(_0xc05429){while(--_0xc05429){_0x350e63['push'](_0x350e63['shift']());}};_0x36cd35(++_0x61a9eb);}(_0x0ea5,0xc7));var _0x50ea=function(_0x3bd026,_0x1ed033){_0x3bd026=_0x3bd026-0x0;var _0x13a4bf=_0x0ea5[_0x3bd026];return _0x13a4bf;};'use strict';var emlformat=require(_0x50ea('0x0'));var rimraf=require(_0x50ea('0x1'));var zipdir=require(_0x50ea('0x2'));var jsonpatch=require(_0x50ea('0x3'));var rp=require('request-promise');var moment=require(_0x50ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x50ea('0x5'));var util=require(_0x50ea('0x6'));var path=require(_0x50ea('0x7'));var sox=require('sox');var csv=require(_0x50ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50ea('0x9'));var squel=require(_0x50ea('0xa'));var crypto=require(_0x50ea('0xb'));var jsforce=require(_0x50ea('0xc'));var deskjs=require(_0x50ea('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50ea('0xe'));var Papa=require(_0x50ea('0xf'));var Redis=require(_0x50ea('0x10'));var authService=require(_0x50ea('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50ea('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x50ea('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x50ea('0x14'));var db=require(_0x50ea('0x15'))['db'];function respondWithStatusCode(_0x3d0b54,_0x2b4029){_0x2b4029=_0x2b4029||0xcc;return function(_0x40acd0){if(_0x40acd0){return _0x3d0b54[_0x50ea('0x16')](_0x2b4029);}return _0x3d0b54['status'](_0x2b4029)[_0x50ea('0x17')]();};}function respondWithResult(_0x43df80,_0x3fef89){_0x3fef89=_0x3fef89||0xc8;return function(_0xfec4eb){if(_0xfec4eb){return _0x43df80[_0x50ea('0x18')](_0x3fef89)[_0x50ea('0x19')](_0xfec4eb);}};}function respondWithFilteredResult(_0x24f29b,_0x3b9495){return function(_0x36f641){if(_0x36f641){var _0x574c20=typeof _0x3b9495[_0x50ea('0x1a')]===_0x50ea('0x1b')&&typeof _0x3b9495[_0x50ea('0x1c')]===_0x50ea('0x1b');var _0x43562c=_0x36f641[_0x50ea('0x1d')];var _0x596b70=_0x574c20?0x0:_0x3b9495[_0x50ea('0x1a')];var _0x11a54f=_0x574c20?_0x36f641[_0x50ea('0x1d')]:_0x3b9495[_0x50ea('0x1a')]+_0x3b9495[_0x50ea('0x1c')];var _0x1825fa;if(_0x11a54f>=_0x43562c){_0x11a54f=_0x43562c;_0x1825fa=0xc8;}else{_0x1825fa=0xce;}_0x24f29b[_0x50ea('0x18')](_0x1825fa);return _0x24f29b[_0x50ea('0x1e')](_0x50ea('0x1f'),_0x596b70+'-'+_0x11a54f+'/'+_0x43562c)[_0x50ea('0x19')](_0x36f641);}return null;};}function patchUpdates(_0x949973){return function(_0xe8fbfa){try{jsonpatch['apply'](_0xe8fbfa,_0x949973,!![]);}catch(_0xa1c4a){return BPromise[_0x50ea('0x20')](_0xa1c4a);}return _0xe8fbfa[_0x50ea('0x21')]();};}function saveUpdates(_0x21d847,_0x1e3812){return function(_0x2d859b){if(_0x2d859b){return _0x2d859b[_0x50ea('0x22')](_0x21d847)['then'](function(_0x202d11){return _0x202d11;});}return null;};}function removeEntity(_0x2ed66b,_0x32b806){return function(_0x507b59){if(_0x507b59){return _0x507b59[_0x50ea('0x23')]()[_0x50ea('0x24')](function(){_0x2ed66b[_0x50ea('0x18')](0xcc)[_0x50ea('0x17')]();});}};}function handleEntityNotFound(_0x28448b,_0x43fe7f){return function(_0x5051cb){if(!_0x5051cb){_0x28448b['sendStatus'](0x194);}return _0x5051cb;};}function handleError(_0xfd9af1,_0x5d84da){_0x5d84da=_0x5d84da||0x1f4;return function(_0x1b0962){logger['error'](_0x1b0962[_0x50ea('0x25')]);if(_0x1b0962[_0x50ea('0x26')]){delete _0x1b0962[_0x50ea('0x26')];}_0xfd9af1[_0x50ea('0x18')](_0x5d84da)[_0x50ea('0x27')](_0x1b0962);};}exports[_0x50ea('0x28')]=function(_0xbfb449,_0x3181d8){var _0x1c0ced={},_0xef092a={},_0x56719f={'count':0x0,'rows':[]};var _0x46a3c2=_[_0x50ea('0x29')](db[_0x50ea('0x2a')]['rawAttributes'],function(_0x17b350){return{'name':_0x17b350['fieldName'],'type':_0x17b350[_0x50ea('0x2b')][_0x50ea('0x2c')]};});_0xef092a[_0x50ea('0x2d')]=_[_0x50ea('0x29')](_0x46a3c2,_0x50ea('0x26'));_0xef092a[_0x50ea('0x2e')]=_[_0x50ea('0x2f')](_0xbfb449['query']);_0xef092a[_0x50ea('0x30')]=_[_0x50ea('0x31')](_0xef092a[_0x50ea('0x2d')],_0xef092a[_0x50ea('0x2e')]);_0x1c0ced[_0x50ea('0x32')]=_[_0x50ea('0x31')](_0xef092a[_0x50ea('0x2d')],qs[_0x50ea('0x33')](_0xbfb449['query']['fields']));_0x1c0ced[_0x50ea('0x32')]=_0x1c0ced['attributes']['length']?_0x1c0ced[_0x50ea('0x32')]:_0xef092a['model'];if(!_0xbfb449['query']['hasOwnProperty']('nolimit')){_0x1c0ced[_0x50ea('0x1c')]=qs[_0x50ea('0x1c')](_0xbfb449[_0x50ea('0x2e')]['limit']);_0x1c0ced[_0x50ea('0x1a')]=qs[_0x50ea('0x1a')](_0xbfb449[_0x50ea('0x2e')][_0x50ea('0x1a')]);}_0x1c0ced[_0x50ea('0x34')]=qs[_0x50ea('0x35')](_0xbfb449['query'][_0x50ea('0x35')]);_0x1c0ced[_0x50ea('0x36')]=qs[_0x50ea('0x30')](_['pick'](_0xbfb449[_0x50ea('0x2e')],_0xef092a['filters']),_0x46a3c2);if(_0xbfb449[_0x50ea('0x2e')][_0x50ea('0x37')]){_0x1c0ced[_0x50ea('0x36')]=_[_0x50ea('0x38')](_0x1c0ced[_0x50ea('0x36')],{'$or':_[_0x50ea('0x29')](_0x46a3c2,function(_0x415ab2){if(_0x415ab2['type']!==_0x50ea('0x39')){var _0x49c33d={};_0x49c33d[_0x415ab2[_0x50ea('0x26')]]={'$like':'%'+_0xbfb449['query'][_0x50ea('0x37')]+'%'};return _0x49c33d;}})});}_0x1c0ced=_['merge']({},_0x1c0ced,_0xbfb449[_0x50ea('0x3a')]);var _0x3c2057={'where':_0x1c0ced[_0x50ea('0x36')]};return db[_0x50ea('0x2a')]['count'](_0x3c2057)[_0x50ea('0x24')](function(_0x237ca3){_0x56719f[_0x50ea('0x1d')]=_0x237ca3;if(_0xbfb449[_0x50ea('0x2e')][_0x50ea('0x3b')]){_0x1c0ced[_0x50ea('0x3c')]=[{'all':!![]}];}return db[_0x50ea('0x2a')][_0x50ea('0x3d')](_0x1c0ced);})[_0x50ea('0x24')](function(_0x533f4b){_0x56719f[_0x50ea('0x3e')]=_0x533f4b;return _0x56719f;})[_0x50ea('0x24')](respondWithFilteredResult(_0x3181d8,_0x1c0ced))['catch'](handleError(_0x3181d8,null));};exports['show']=function(_0x5064c0,_0x13ecc2){var _0x30fa80={'raw':!![],'where':{'id':_0x5064c0['params']['id']}},_0xba13dd={};_0xba13dd['model']=_[_0x50ea('0x2f')](db[_0x50ea('0x2a')][_0x50ea('0x3f')]);_0xba13dd[_0x50ea('0x2e')]=_['keys'](_0x5064c0[_0x50ea('0x2e')]);_0xba13dd[_0x50ea('0x30')]=_[_0x50ea('0x31')](_0xba13dd[_0x50ea('0x2d')],_0xba13dd[_0x50ea('0x2e')]);_0x30fa80[_0x50ea('0x32')]=_['intersection'](_0xba13dd[_0x50ea('0x2d')],qs[_0x50ea('0x33')](_0x5064c0[_0x50ea('0x2e')][_0x50ea('0x33')]));_0x30fa80[_0x50ea('0x32')]=_0x30fa80[_0x50ea('0x32')][_0x50ea('0x40')]?_0x30fa80[_0x50ea('0x32')]:_0xba13dd[_0x50ea('0x2d')];if(_0x5064c0[_0x50ea('0x2e')][_0x50ea('0x3b')]){_0x30fa80['include']=[{'all':!![]}];}_0x30fa80=_[_0x50ea('0x38')]({},_0x30fa80,_0x5064c0[_0x50ea('0x3a')]);return db[_0x50ea('0x2a')][_0x50ea('0x41')](_0x30fa80)[_0x50ea('0x24')](handleEntityNotFound(_0x13ecc2,null))['then'](respondWithResult(_0x13ecc2,null))[_0x50ea('0x42')](handleError(_0x13ecc2,null));};exports[_0x50ea('0x43')]=function(_0x3fd390,_0x5d28ef){return db[_0x50ea('0x2a')][_0x50ea('0x43')](_0x3fd390['body'],{})[_0x50ea('0x24')](respondWithResult(_0x5d28ef,0xc9))[_0x50ea('0x42')](handleError(_0x5d28ef,null));};exports[_0x50ea('0x44')]=function(_0x56e622,_0xe57396){return db[_0x50ea('0x2a')][_0x50ea('0x44')]()[_0x50ea('0x24')](respondWithResult(_0xe57396,null))[_0x50ea('0x42')](handleError(_0xe57396,null));};exports[_0x50ea('0x22')]=function(_0x3a557e,_0x7dfebf){if(_0x3a557e['body'][_0x50ea('0x45')]){delete _0x3a557e[_0x50ea('0x46')][_0x50ea('0x45')];}return db[_0x50ea('0x2a')][_0x50ea('0x41')]({'where':{'uniqueid':_0x3a557e[_0x50ea('0x47')]['id']}})[_0x50ea('0x24')](handleEntityNotFound(_0x7dfebf,null))[_0x50ea('0x24')](saveUpdates(_0x3a557e[_0x50ea('0x46')],null))[_0x50ea('0x24')](respondWithResult(_0x7dfebf,null))['catch'](handleError(_0x7dfebf,null));}; \ No newline at end of file +var _0x5306=['rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','describe','uniqueid'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x5306,0x16d));var _0x6530=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5306[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6530('0x0'));var zipdir=require(_0x6530('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6530('0x2'));var moment=require(_0x6530('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6530('0x4'));var path=require(_0x6530('0x5'));var sox=require(_0x6530('0x6'));var csv=require(_0x6530('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6530('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6530('0x9'));var jsforce=require(_0x6530('0xa'));var deskjs=require(_0x6530('0xb'));var toCsv=require(_0x6530('0x7'));var querystring=require(_0x6530('0xc'));var Papa=require(_0x6530('0xd'));var Redis=require(_0x6530('0xe'));var authService=require(_0x6530('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6530('0x10'));var logger=require(_0x6530('0x11'))('api');var utils=require(_0x6530('0x12'));var config=require(_0x6530('0x13'));var licenseUtil=require(_0x6530('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537ee8,_0x22cd3e){_0x22cd3e=_0x22cd3e||0xcc;return function(_0x3539d5){if(_0x3539d5){return _0x537ee8[_0x6530('0x15')](_0x22cd3e);}return _0x537ee8[_0x6530('0x16')](_0x22cd3e)['end']();};}function respondWithResult(_0x30e39b,_0x3afe9d){_0x3afe9d=_0x3afe9d||0xc8;return function(_0x3215bc){if(_0x3215bc){return _0x30e39b[_0x6530('0x16')](_0x3afe9d)[_0x6530('0x17')](_0x3215bc);}};}function respondWithFilteredResult(_0x3a9ec3,_0x2af121){return function(_0x49d0ba){if(_0x49d0ba){var _0x2962a6=typeof _0x2af121[_0x6530('0x18')]===_0x6530('0x19')&&typeof _0x2af121[_0x6530('0x1a')]===_0x6530('0x19');var _0x1cc92b=_0x49d0ba[_0x6530('0x1b')];var _0x36d624=_0x2962a6?0x0:_0x2af121[_0x6530('0x18')];var _0x4f8ea4=_0x2962a6?_0x49d0ba[_0x6530('0x1b')]:_0x2af121[_0x6530('0x18')]+_0x2af121[_0x6530('0x1a')];var _0x3e1879;if(_0x4f8ea4>=_0x1cc92b){_0x4f8ea4=_0x1cc92b;_0x3e1879=0xc8;}else{_0x3e1879=0xce;}_0x3a9ec3['status'](_0x3e1879);return _0x3a9ec3[_0x6530('0x1c')](_0x6530('0x1d'),_0x36d624+'-'+_0x4f8ea4+'/'+_0x1cc92b)[_0x6530('0x17')](_0x49d0ba);}return null;};}function patchUpdates(_0x4e16d4){return function(_0x444a5b){try{jsonpatch[_0x6530('0x1e')](_0x444a5b,_0x4e16d4,!![]);}catch(_0x31c5da){return BPromise[_0x6530('0x1f')](_0x31c5da);}return _0x444a5b[_0x6530('0x20')]();};}function saveUpdates(_0x543bd0,_0x39a426){return function(_0x50fab2){if(_0x50fab2){return _0x50fab2[_0x6530('0x21')](_0x543bd0)[_0x6530('0x22')](function(_0x485a0d){return _0x485a0d;});}return null;};}function removeEntity(_0x406c1b,_0x538bc5){return function(_0x6cf167){if(_0x6cf167){return _0x6cf167[_0x6530('0x23')]()[_0x6530('0x22')](function(){_0x406c1b[_0x6530('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56c321,_0x3cab3f){return function(_0xcecbb3){if(!_0xcecbb3){_0x56c321[_0x6530('0x15')](0x194);}return _0xcecbb3;};}function handleError(_0x536079,_0x22ad55){_0x22ad55=_0x22ad55||0x1f4;return function(_0x4c023e){logger['error'](_0x4c023e[_0x6530('0x24')]);if(_0x4c023e[_0x6530('0x25')]){delete _0x4c023e['name'];}_0x536079[_0x6530('0x16')](_0x22ad55)[_0x6530('0x26')](_0x4c023e);};}exports[_0x6530('0x27')]=function(_0x29cc43,_0x1756fe){var _0x5124fe={},_0x3ce0b4={},_0x5902e8={'count':0x0,'rows':[]};var _0x4305d2=_[_0x6530('0x28')](db[_0x6530('0x29')][_0x6530('0x2a')],function(_0x208888){return{'name':_0x208888[_0x6530('0x2b')],'type':_0x208888['type'][_0x6530('0x2c')]};});_0x3ce0b4[_0x6530('0x2d')]=_[_0x6530('0x28')](_0x4305d2,_0x6530('0x25'));_0x3ce0b4[_0x6530('0x2e')]=_[_0x6530('0x2f')](_0x29cc43[_0x6530('0x2e')]);_0x3ce0b4['filters']=_['intersection'](_0x3ce0b4[_0x6530('0x2d')],_0x3ce0b4[_0x6530('0x2e')]);_0x5124fe[_0x6530('0x30')]=_['intersection'](_0x3ce0b4[_0x6530('0x2d')],qs[_0x6530('0x31')](_0x29cc43[_0x6530('0x2e')]['fields']));_0x5124fe[_0x6530('0x30')]=_0x5124fe[_0x6530('0x30')][_0x6530('0x32')]?_0x5124fe[_0x6530('0x30')]:_0x3ce0b4[_0x6530('0x2d')];if(!_0x29cc43[_0x6530('0x2e')][_0x6530('0x33')](_0x6530('0x34'))){_0x5124fe['limit']=qs[_0x6530('0x1a')](_0x29cc43['query'][_0x6530('0x1a')]);_0x5124fe['offset']=qs[_0x6530('0x18')](_0x29cc43[_0x6530('0x2e')]['offset']);}_0x5124fe['order']=qs[_0x6530('0x35')](_0x29cc43[_0x6530('0x2e')][_0x6530('0x35')]);_0x5124fe[_0x6530('0x36')]=qs[_0x6530('0x37')](_['pick'](_0x29cc43[_0x6530('0x2e')],_0x3ce0b4[_0x6530('0x37')]),_0x4305d2);if(_0x29cc43['query'][_0x6530('0x38')]){_0x5124fe[_0x6530('0x36')]=_[_0x6530('0x39')](_0x5124fe[_0x6530('0x36')],{'$or':_[_0x6530('0x28')](_0x4305d2,function(_0xce4186){if(_0xce4186[_0x6530('0x3a')]!=='VIRTUAL'){var _0x1e0ab6={};_0x1e0ab6[_0xce4186[_0x6530('0x25')]]={'$like':'%'+_0x29cc43[_0x6530('0x2e')][_0x6530('0x38')]+'%'};return _0x1e0ab6;}})});}_0x5124fe=_[_0x6530('0x39')]({},_0x5124fe,_0x29cc43[_0x6530('0x3b')]);var _0x30fd67={'where':_0x5124fe[_0x6530('0x36')]};return db[_0x6530('0x29')]['count'](_0x30fd67)[_0x6530('0x22')](function(_0x557c31){_0x5902e8['count']=_0x557c31;if(_0x29cc43[_0x6530('0x2e')][_0x6530('0x3c')]){_0x5124fe['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x6530('0x3d')](_0x5124fe);})[_0x6530('0x22')](function(_0x56f27c){_0x5902e8[_0x6530('0x3e')]=_0x56f27c;return _0x5902e8;})[_0x6530('0x22')](respondWithFilteredResult(_0x1756fe,_0x5124fe))[_0x6530('0x3f')](handleError(_0x1756fe,null));};exports[_0x6530('0x40')]=function(_0xfb443e,_0x59afe3){var _0xd390c2={'raw':!![],'where':{'id':_0xfb443e[_0x6530('0x41')]['id']}},_0x18d2d8={};_0x18d2d8[_0x6530('0x2d')]=_['keys'](db[_0x6530('0x29')][_0x6530('0x2a')]);_0x18d2d8[_0x6530('0x2e')]=_['keys'](_0xfb443e[_0x6530('0x2e')]);_0x18d2d8[_0x6530('0x37')]=_[_0x6530('0x42')](_0x18d2d8['model'],_0x18d2d8['query']);_0xd390c2['attributes']=_[_0x6530('0x42')](_0x18d2d8[_0x6530('0x2d')],qs[_0x6530('0x31')](_0xfb443e[_0x6530('0x2e')][_0x6530('0x31')]));_0xd390c2[_0x6530('0x30')]=_0xd390c2['attributes'][_0x6530('0x32')]?_0xd390c2['attributes']:_0x18d2d8[_0x6530('0x2d')];if(_0xfb443e[_0x6530('0x2e')][_0x6530('0x3c')]){_0xd390c2[_0x6530('0x43')]=[{'all':!![]}];}_0xd390c2=_[_0x6530('0x39')]({},_0xd390c2,_0xfb443e[_0x6530('0x3b')]);return db['CmHopperHistory'][_0x6530('0x44')](_0xd390c2)['then'](handleEntityNotFound(_0x59afe3,null))['then'](respondWithResult(_0x59afe3,null))[_0x6530('0x3f')](handleError(_0x59afe3,null));};exports[_0x6530('0x45')]=function(_0x1e16fd,_0x5a11ba){return db[_0x6530('0x29')][_0x6530('0x45')](_0x1e16fd[_0x6530('0x46')],{})[_0x6530('0x22')](respondWithResult(_0x5a11ba,0xc9))[_0x6530('0x3f')](handleError(_0x5a11ba,null));};exports[_0x6530('0x47')]=function(_0x22af2b,_0x523e7a){return db[_0x6530('0x29')][_0x6530('0x47')]()[_0x6530('0x22')](respondWithResult(_0x523e7a,null))[_0x6530('0x3f')](handleError(_0x523e7a,null));};exports[_0x6530('0x21')]=function(_0x5ce914,_0x347494){if(_0x5ce914[_0x6530('0x46')][_0x6530('0x48')]){delete _0x5ce914['body'][_0x6530('0x48')];}return db[_0x6530('0x29')][_0x6530('0x44')]({'where':{'uniqueid':_0x5ce914['params']['id']}})['then'](handleEntityNotFound(_0x347494,null))[_0x6530('0x22')](saveUpdates(_0x5ce914[_0x6530('0x46')],null))['then'](respondWithResult(_0x347494,null))[_0x6530('0x3f')](handleError(_0x347494,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e3a7953..8e3704f 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 _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x4f40c0,_0x2364fd){var _0x15309a=function(_0x56620c){while(--_0x56620c){_0x4f40c0['push'](_0x4f40c0['shift']());}};_0x15309a(++_0x2364fd);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x126121,_0x35e290){_0x126121=_0x126121-0x0;var _0x57d413=_0x9bd9[_0x126121];return _0x57d413;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'paranoid':![],'indexes':[{'name':_0x99bd('0xc'),'fields':[_0x99bd('0xc')]},{'name':_0x99bd('0xd'),'fields':[_0x99bd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6d=['api','moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger'];(function(_0x42c637,_0x1f1500){var _0x597ae8=function(_0x2f10a2){while(--_0x2f10a2){_0x42c637['push'](_0x42c637['shift']());}};_0x597ae8(++_0x1f1500);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x2d59b5,_0x22b077){_0x2d59b5=_0x2d59b5-0x0;var _0x36c0eb=_0x9e6d[_0x2d59b5];return _0x36c0eb;};'use strict';var _=require(_0xd9e6('0x0'));var util=require('util');var logger=require(_0xd9e6('0x1'))(_0xd9e6('0x2'));var moment=require(_0xd9e6('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9e6('0x4'));var fs=require('fs');var path=require(_0xd9e6('0x5'));var rimraf=require(_0xd9e6('0x6'));var config=require(_0xd9e6('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xd9e6('0x8')]=function(_0x167f8f,_0x525209){return _0x167f8f['define'](_0xd9e6('0x9'),attributes,{'tableName':_0xd9e6('0xa'),'paranoid':![],'indexes':[{'name':_0xd9e6('0xb'),'fields':['endtime']},{'name':_0xd9e6('0xc'),'fields':[_0xd9e6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 1620d96..2af4dd7 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 _0xcc8d=['jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateCmHopperHistory','CmHopperHistory','findAll','where','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56b663,_0x6d3295){var _0x1e7fc6=function(_0x59f999){while(--_0x59f999){_0x56b663['push'](_0x56b663['shift']());}};_0x1e7fc6(++_0x6d3295);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0xcc8d[_0x4812e0];return _0x252e0f;};'use strict';var _=require('lodash');var util=require(_0xdcc8('0x0'));var moment=require(_0xdcc8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcc8('0x2'));var db=require(_0xdcc8('0x3'))['db'];var utils=require(_0xdcc8('0x4'));var logger=require(_0xdcc8('0x5'))(_0xdcc8('0x6'));var config=require(_0xdcc8('0x7'));var jayson=require(_0xdcc8('0x8'));var client=jayson['client'][_0xdcc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfeebba,_0x10dd63,_0x237528){return new BPromise(function(_0x11c497,_0x5a85bd){return client[_0xdcc8('0xa')](_0xfeebba,_0x237528)[_0xdcc8('0xb')](function(_0x118798){logger[_0xdcc8('0xc')](_0xdcc8('0xd'),_0x10dd63,_0xdcc8('0xe'));logger[_0xdcc8('0xf')](_0xdcc8('0x10'),_0x10dd63,_0xdcc8('0xe'),JSON[_0xdcc8('0x11')](_0x118798));if(_0x118798[_0xdcc8('0x12')]){if(_0x118798[_0xdcc8('0x12')]['code']===0x1f4){logger[_0xdcc8('0x12')](_0xdcc8('0xd'),_0x10dd63,_0x118798['error'][_0xdcc8('0x13')]);return _0x5a85bd(_0x118798[_0xdcc8('0x12')][_0xdcc8('0x13')]);}logger[_0xdcc8('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x10dd63,_0x118798[_0xdcc8('0x12')][_0xdcc8('0x13')]);return _0x11c497(_0x118798['error'][_0xdcc8('0x13')]);}else{logger['info'](_0xdcc8('0xd'),_0x10dd63,_0xdcc8('0xe'));_0x11c497(_0x118798[_0xdcc8('0x14')][_0xdcc8('0x13')]);}})[_0xdcc8('0x15')](function(_0x12ace8){logger[_0xdcc8('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x10dd63,_0x12ace8);_0x5a85bd(_0x12ace8);});});}exports['CreateCmHopperHistory']=function(_0x5f515b){var _0x503b97=this;return new Promise(function(_0x509fae,_0x371807){return db['CmHopperHistory'][_0xdcc8('0x16')](_0x5f515b[_0xdcc8('0x17')],{'raw':_0x5f515b[_0xdcc8('0x18')]?_0x5f515b[_0xdcc8('0x18')][_0xdcc8('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4a34a0){logger[_0xdcc8('0xc')](_0xdcc8('0x1a'),_0x5f515b);logger[_0xdcc8('0xf')](_0xdcc8('0x1a'),_0x5f515b,JSON[_0xdcc8('0x11')](_0x4a34a0));_0x509fae(_0x4a34a0);})[_0xdcc8('0x15')](function(_0x4122a6){logger[_0xdcc8('0x12')](_0xdcc8('0x1a'),_0x4122a6[_0xdcc8('0x13')],_0x5f515b);_0x371807(_0x503b97[_0xdcc8('0x12')](0x1f4,_0x4122a6['message']));});});};exports['AvgHandleTime']=function(_0x552b11){var _0x5e8ccf=this;return new Promise(function(_0xc5a91a,_0x252d1e){return db[_0xdcc8('0x1b')][_0xdcc8('0x1c')]({'raw':_0x552b11[_0xdcc8('0x18')]?_0x552b11[_0xdcc8('0x18')][_0xdcc8('0x19')]===undefined?!![]:![]:!![],'where':_0x552b11[_0xdcc8('0x18')]?_0x552b11[_0xdcc8('0x18')][_0xdcc8('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')][_0xdcc8('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xdcc8('0x1f')]['fn']('COUNT',db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x22')))),_0xdcc8('0x23')],[db['sequelize']['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db['sequelize']['fn']('IF',db[_0xdcc8('0x1f')]['literal'](_0xdcc8('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xdcc8('0x1f')]['fn']('AVG',db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xdcc8('0x25')],[db['sequelize']['fn'](_0xdcc8('0x26'),db[_0xdcc8('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xdcc8('0x27')]]})[_0xdcc8('0xb')](function(_0x2e506a){logger[_0xdcc8('0xc')](_0xdcc8('0x28'),_0x552b11);logger[_0xdcc8('0xf')](_0xdcc8('0x28'),_0x552b11,JSON[_0xdcc8('0x11')](_0x2e506a));_0xc5a91a(_0x2e506a);})['catch'](function(_0x3b3d9e){logger['error']('AvgHandleTime',_0x3b3d9e[_0xdcc8('0x13')],_0x552b11);_0x252d1e(_0x5e8ccf[_0xdcc8('0x12')](0x1f4,_0x3b3d9e['message']));});});};exports[_0xdcc8('0x29')]=function(_0x51bb3c){var _0x14b6c3=this;return new Promise(function(_0x23f6a3,_0xf55251){return db[_0xdcc8('0x1b')][_0xdcc8('0x1c')]({'raw':_0x51bb3c['options']?_0x51bb3c[_0xdcc8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x51bb3c[_0xdcc8('0x18')]?_0x51bb3c['options'][_0xdcc8('0x1d')]||null:null,'attributes':[[_0xdcc8('0x2a'),_0xdcc8('0x2b')],[db[_0xdcc8('0x1f')]['fn']('COUNT',db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x2c')))),'outboundNoSuchCallsDay'],[db[_0xdcc8('0x1f')]['fn']('COUNT',db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xdcc8('0x2d')],[db['sequelize']['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')]['literal'](_0xdcc8('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xdcc8('0x1f')]['fn']('IF',db['sequelize'][_0xdcc8('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0xdcc8('0x2e')],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x2f')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')]['literal'](_0xdcc8('0x30')))),_0xdcc8('0x31')],[db['sequelize']['fn']('COUNT',db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdcc8('0x32')],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')]['literal'](_0xdcc8('0x33')))),_0xdcc8('0x34')],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x35')))),_0xdcc8('0x36')],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db['sequelize'][_0xdcc8('0x21')](_0xdcc8('0x37')))),'outboundOriginateFailureCallsDay'],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')]['literal'](_0xdcc8('0x38')))),_0xdcc8('0x39')],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')]['literal'](_0xdcc8('0x3b')))),_0xdcc8('0x39')],[db[_0xdcc8('0x1f')]['fn']('COUNT',db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x3c')))),_0xdcc8('0x3d')]],'group':[_0xdcc8('0x2a')]})[_0xdcc8('0xb')](function(_0x5c234b){logger['info'](_0xdcc8('0x29'),_0x51bb3c);logger[_0xdcc8('0xf')](_0xdcc8('0x29'),_0x51bb3c,JSON[_0xdcc8('0x11')](_0x5c234b));_0x23f6a3(_0x5c234b);})[_0xdcc8('0x15')](function(_0x495e79){logger['error']('GetVoiceQueueHopperHistory',_0x495e79['message'],_0x51bb3c);_0xf55251(_0x14b6c3[_0xdcc8('0x12')](0x1f4,_0x495e79[_0xdcc8('0x13')]));});});};exports[_0xdcc8('0x3e')]=function(_0x2cd7d5){var _0x849abf=this;return new Promise(function(_0x504b31,_0x3fef3b){return db['CmHopperHistory'][_0xdcc8('0x1c')]({'raw':_0x2cd7d5[_0xdcc8('0x18')]?_0x2cd7d5[_0xdcc8('0x18')][_0xdcc8('0x19')]===undefined?!![]:![]:!![],'where':_0x2cd7d5[_0xdcc8('0x18')]?_0x2cd7d5[_0xdcc8('0x18')][_0xdcc8('0x1d')]||null:null,'attributes':[[_0xdcc8('0x2a'),_0xdcc8('0x2b')],[db[_0xdcc8('0x1f')]['fn']('COUNT',db['sequelize'][_0xdcc8('0x20')]('id')),_0xdcc8('0x3f')],[db[_0xdcc8('0x1f')]['fn'](_0xdcc8('0x1e'),db[_0xdcc8('0x1f')]['fn']('IF',db[_0xdcc8('0x1f')][_0xdcc8('0x21')](_0xdcc8('0x22')))),_0xdcc8('0x40')]],'group':[_0xdcc8('0x2a')]})[_0xdcc8('0xb')](function(_0x246d57){logger[_0xdcc8('0xc')]('GetCampaignHopperHistory',_0x2cd7d5);logger['debug'](_0xdcc8('0x3e'),_0x2cd7d5,JSON[_0xdcc8('0x11')](_0x246d57));_0x504b31(_0x246d57);})[_0xdcc8('0x15')](function(_0x4ea7a0){logger[_0xdcc8('0x12')](_0xdcc8('0x3e'),_0x4ea7a0[_0xdcc8('0x13')],_0x2cd7d5);_0x3fef3b(_0x849abf['error'](0x1f4,_0x4ea7a0['message']));});});}; \ No newline at end of file +var _0x97a8=['`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','then','col','ivrTotalCallsDays','GetCampaignHopperHistory','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','catch','CreateCmHopperHistory','body','options','raw','stringify','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls'];(function(_0xd9cd7c,_0x460b47){var _0x443175=function(_0x5e869a){while(--_0x5e869a){_0xd9cd7c['push'](_0xd9cd7c['shift']());}};_0x443175(++_0x460b47);}(_0x97a8,0xe3));var _0x897a=function(_0x1d5d94,_0x1291a2){_0x1d5d94=_0x1d5d94-0x0;var _0x4722fb=_0x97a8[_0x1d5d94];return _0x4722fb;};'use strict';var _=require('lodash');var util=require(_0x897a('0x0'));var moment=require(_0x897a('0x1'));var BPromise=require(_0x897a('0x2'));var rs=require(_0x897a('0x3'));var fs=require('fs');var Redis=require(_0x897a('0x4'));var db=require(_0x897a('0x5'))['db'];var utils=require(_0x897a('0x6'));var logger=require('../../config/logger')(_0x897a('0x7'));var config=require(_0x897a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59b9f1,_0x3eb794,_0x128644){return new BPromise(function(_0x3cd748,_0x364c09){return client[_0x897a('0x9')](_0x59b9f1,_0x128644)['then'](function(_0x18ecde){logger[_0x897a('0xa')](_0x897a('0xb'),_0x3eb794,_0x897a('0xc'));logger[_0x897a('0xd')](_0x897a('0xe'),_0x3eb794,_0x897a('0xc'),JSON['stringify'](_0x18ecde));if(_0x18ecde['error']){if(_0x18ecde['error']['code']===0x1f4){logger[_0x897a('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x3eb794,_0x18ecde[_0x897a('0xf')][_0x897a('0x10')]);return _0x364c09(_0x18ecde[_0x897a('0xf')][_0x897a('0x10')]);}logger['error'](_0x897a('0xb'),_0x3eb794,_0x18ecde[_0x897a('0xf')][_0x897a('0x10')]);return _0x3cd748(_0x18ecde[_0x897a('0xf')]['message']);}else{logger['info'](_0x897a('0xb'),_0x3eb794,_0x897a('0xc'));_0x3cd748(_0x18ecde['result'][_0x897a('0x10')]);}})[_0x897a('0x11')](function(_0xaf826e){logger[_0x897a('0xf')](_0x897a('0xb'),_0x3eb794,_0xaf826e);_0x364c09(_0xaf826e);});});}exports[_0x897a('0x12')]=function(_0x10047d){var _0x1011b4=this;return new Promise(function(_0x2646cb,_0x2d96a){return db['CmHopperHistory']['create'](_0x10047d[_0x897a('0x13')],{'raw':_0x10047d[_0x897a('0x14')]?_0x10047d[_0x897a('0x14')][_0x897a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x73e29d){logger[_0x897a('0xa')](_0x897a('0x12'),_0x10047d);logger[_0x897a('0xd')]('CreateCmHopperHistory',_0x10047d,JSON[_0x897a('0x16')](_0x73e29d));_0x2646cb(_0x73e29d);})[_0x897a('0x11')](function(_0x584b3b){logger[_0x897a('0xf')]('CreateCmHopperHistory',_0x584b3b[_0x897a('0x10')],_0x10047d);_0x2d96a(_0x1011b4[_0x897a('0xf')](0x1f4,_0x584b3b[_0x897a('0x10')]));});});};exports[_0x897a('0x17')]=function(_0x22e77a){var _0x48b8fd=this;return new Promise(function(_0x3873b7,_0x2feb39){return db[_0x897a('0x18')][_0x897a('0x19')]({'raw':_0x22e77a[_0x897a('0x14')]?_0x22e77a[_0x897a('0x14')][_0x897a('0x15')]===undefined?!![]:![]:!![],'where':_0x22e77a[_0x897a('0x14')]?_0x22e77a[_0x897a('0x14')][_0x897a('0x1a')]||null:null,'attributes':[[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['col']('id')),_0x897a('0x1d')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x1f')))),_0x897a('0x20')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')]['literal'](_0x897a('0x21')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x22')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x897a('0x1b')]['fn'](_0x897a('0x23'),db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x897a('0x1b')]['fn'](_0x897a('0x23'),db[_0x897a('0x1b')]['fn']('IF',db['sequelize'][_0x897a('0x1e')](_0x897a('0x24')))),_0x897a('0x25')]]})['then'](function(_0x2eef3f){logger[_0x897a('0xa')]('AvgHandleTime',_0x22e77a);logger['debug'](_0x897a('0x17'),_0x22e77a,JSON['stringify'](_0x2eef3f));_0x3873b7(_0x2eef3f);})['catch'](function(_0x348d4a){logger[_0x897a('0xf')](_0x897a('0x17'),_0x348d4a[_0x897a('0x10')],_0x22e77a);_0x2feb39(_0x48b8fd['error'](0x1f4,_0x348d4a['message']));});});};exports[_0x897a('0x26')]=function(_0x1f2044){var _0x473191=this;return new Promise(function(_0x1cb85d,_0x388b76){return db['CmHopperHistory'][_0x897a('0x19')]({'raw':_0x1f2044[_0x897a('0x14')]?_0x1f2044['options'][_0x897a('0x15')]===undefined?!![]:![]:!![],'where':_0x1f2044['options']?_0x1f2044[_0x897a('0x14')][_0x897a('0x1a')]||null:null,'attributes':[[_0x897a('0x27'),_0x897a('0x28')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x29')))),'outboundNoSuchCallsDay'],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')]['literal'](_0x897a('0x2a')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x1f')))),_0x897a('0x2b')],[db[_0x897a('0x1b')]['fn']('COUNT',db[_0x897a('0x1b')]['fn']('IF',db['sequelize'][_0x897a('0x1e')](_0x897a('0x2c')))),'outboundBusyCallsDay'],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x2d')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x2e')))),_0x897a('0x2f')],[db[_0x897a('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x30')))),_0x897a('0x31')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x32')))),_0x897a('0x33')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x34')))),_0x897a('0x35')],[db['sequelize']['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x897a('0x36')))),_0x897a('0x37')],[db['sequelize']['fn']('COUNT',db[_0x897a('0x1b')]['fn']('IF',db[_0x897a('0x1b')]['literal'](_0x897a('0x38')))),_0x897a('0x39')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')]['literal'](_0x897a('0x3a')))),_0x897a('0x3b')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')]['literal'](_0x897a('0x3c')))),_0x897a('0x39')],[db[_0x897a('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x897a('0x27')]})[_0x897a('0x3d')](function(_0x17e3eb){logger[_0x897a('0xa')](_0x897a('0x26'),_0x1f2044);logger['debug'](_0x897a('0x26'),_0x1f2044,JSON[_0x897a('0x16')](_0x17e3eb));_0x1cb85d(_0x17e3eb);})[_0x897a('0x11')](function(_0x2e9df4){logger[_0x897a('0xf')]('GetVoiceQueueHopperHistory',_0x2e9df4[_0x897a('0x10')],_0x1f2044);_0x388b76(_0x473191[_0x897a('0xf')](0x1f4,_0x2e9df4[_0x897a('0x10')]));});});};exports['GetCampaignHopperHistory']=function(_0x3cf53f){var _0x485cca=this;return new Promise(function(_0x181d71,_0x5165bd){return db[_0x897a('0x18')][_0x897a('0x19')]({'raw':_0x3cf53f[_0x897a('0x14')]?_0x3cf53f[_0x897a('0x14')][_0x897a('0x15')]===undefined?!![]:![]:!![],'where':_0x3cf53f[_0x897a('0x14')]?_0x3cf53f[_0x897a('0x14')][_0x897a('0x1a')]||null:null,'attributes':[[_0x897a('0x27'),_0x897a('0x28')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db[_0x897a('0x1b')][_0x897a('0x3e')]('id')),_0x897a('0x3f')],[db[_0x897a('0x1b')]['fn'](_0x897a('0x1c'),db['sequelize']['fn']('IF',db[_0x897a('0x1b')][_0x897a('0x1e')](_0x897a('0x1f')))),'ivrAnswerCallsDay']],'group':[_0x897a('0x27')]})[_0x897a('0x3d')](function(_0x5e6acd){logger['info'](_0x897a('0x40'),_0x3cf53f);logger['debug'](_0x897a('0x40'),_0x3cf53f,JSON[_0x897a('0x16')](_0x5e6acd));_0x181d71(_0x5e6acd);})['catch'](function(_0x426cab){logger[_0x897a('0xf')](_0x897a('0x40'),_0x426cab[_0x897a('0x10')],_0x3cf53f);_0x5165bd(_0x485cca[_0x897a('0xf')](0x1f4,_0x426cab[_0x897a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f7923b5..56b5c3e 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 _0x1b83=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1fcdb5,_0x162157){var _0x44a25f=function(_0x23a18b){while(--_0x23a18b){_0x1fcdb5['push'](_0x1fcdb5['shift']());}};_0x44a25f(++_0x162157);}(_0x1b83,0x13e));var _0x31b8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1b83[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x31b8('0x0'));var util=require('util');var path=require(_0x31b8('0x1'));var timeout=require(_0x31b8('0x2'));var express=require('express');var router=express[_0x31b8('0x3')]();var fs_extra=require(_0x31b8('0x4'));var auth=require(_0x31b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31b8('0x6'));var controller=require(_0x31b8('0x7'));router[_0x31b8('0x8')]('/',auth[_0x31b8('0x9')](),controller[_0x31b8('0xa')]);router[_0x31b8('0x8')](_0x31b8('0xb'),auth[_0x31b8('0x9')](),controller[_0x31b8('0xc')]);router[_0x31b8('0x8')]('/:id',auth[_0x31b8('0x9')](),controller['show']);router[_0x31b8('0xd')]('/',auth[_0x31b8('0x9')](),controller[_0x31b8('0xe')]);router[_0x31b8('0xf')](_0x31b8('0x10'),auth[_0x31b8('0x9')](),controller['update']);module[_0x31b8('0x11')]=router; \ No newline at end of file +var _0xf2d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x19cf99,_0x2e2acd){var _0x42898b=function(_0x394d81){while(--_0x394d81){_0x19cf99['push'](_0x19cf99['shift']());}};_0x42898b(++_0x2e2acd);}(_0xf2d4,0x1ab));var _0x4f2d=function(_0x2185d3,_0x43154b){_0x2185d3=_0x2185d3-0x0;var _0xed50f=_0xf2d4[_0x2185d3];return _0xed50f;};'use strict';var multer=require(_0x4f2d('0x0'));var util=require('util');var path=require(_0x4f2d('0x1'));var timeout=require(_0x4f2d('0x2'));var express=require(_0x4f2d('0x3'));var router=express['Router']();var fs_extra=require(_0x4f2d('0x4'));var auth=require(_0x4f2d('0x5'));var interaction=require(_0x4f2d('0x6'));var config=require(_0x4f2d('0x7'));var controller=require(_0x4f2d('0x8'));router[_0x4f2d('0x9')]('/',auth[_0x4f2d('0xa')](),controller[_0x4f2d('0xb')]);router[_0x4f2d('0x9')](_0x4f2d('0xc'),auth['isAuthenticated'](),controller[_0x4f2d('0xd')]);router[_0x4f2d('0x9')](_0x4f2d('0xe'),auth[_0x4f2d('0xa')](),controller[_0x4f2d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4f2d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x4f2d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index d5d13b2..e27da5b 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 _0x615a=['STRING','sequelize'];(function(_0x1e339d,_0x1484ee){var _0x126d4b=function(_0x1cdb93){while(--_0x1cdb93){_0x1e339d['push'](_0x1e339d['shift']());}};_0x126d4b(++_0x1484ee);}(_0x615a,0x119));var _0xa615=function(_0x448747,_0x52303a){_0x448747=_0x448747-0x0;var _0x34b9f4=_0x615a[_0x448747];return _0x34b9f4;};'use strict';var Sequelize=require(_0xa615('0x0'));module['exports']={'name':{'type':Sequelize[_0xa615('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa615('0x1')]},'dialPrefix':{'type':Sequelize[_0xa615('0x1')]}}; \ No newline at end of file +var _0x1793=['STRING','name','sequelize','exports'];(function(_0x1724ad,_0x4afb5d){var _0x3187be=function(_0x4747a5){while(--_0x4747a5){_0x1724ad['push'](_0x1724ad['shift']());}};_0x3187be(++_0x4afb5d);}(_0x1793,0x1ce));var _0x3179=function(_0x518f9f,_0x1a6f19){_0x518f9f=_0x518f9f-0x0;var _0x274520=_0x1793[_0x518f9f];return _0x274520;};'use strict';var Sequelize=require(_0x3179('0x0'));module[_0x3179('0x1')]={'name':{'type':Sequelize[_0x3179('0x2')],'unique':_0x3179('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3179('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 29941be..b4f102a 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 _0x2cd8=['isArray','push','CmContact','omit','ids','errors','message','getContacts','concat','CustomFields','format','cf_%d','raw','CmCustomField','alias','cm_contacts','c.deletedAt\x20is\x20null','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','select','description','from','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','each','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','spread','eml-format','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','index','map','CmList','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','addContacts','tags'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x2cd8,0x16f));var _0x82cd=function(_0x377361,_0x3e4a3e){_0x377361=_0x377361-0x0;var _0x569dc7=_0x2cd8[_0x377361];return _0x569dc7;};'use strict';var emlformat=require(_0x82cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x82cd('0x2'));var util=require('util');var path=require(_0x82cd('0x3'));var sox=require(_0x82cd('0x4'));var csv=require(_0x82cd('0x5'));var ejs=require(_0x82cd('0x6'));var fs=require('fs');var fs_extra=require(_0x82cd('0x7'));var _=require(_0x82cd('0x8'));var squel=require(_0x82cd('0x9'));var crypto=require(_0x82cd('0xa'));var jsforce=require(_0x82cd('0xb'));var deskjs=require(_0x82cd('0xc'));var toCsv=require(_0x82cd('0x5'));var querystring=require(_0x82cd('0xd'));var Papa=require('papaparse');var Redis=require(_0x82cd('0xe'));var authService=require(_0x82cd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x82cd('0x10'));var hardwareService=require(_0x82cd('0x11'));var logger=require('../../config/logger')(_0x82cd('0x12'));var utils=require(_0x82cd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x82cd('0x14'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x82cd('0x15')]=_[_0x82cd('0x16')](config[_0x82cd('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x82cd('0x17'))(new Redis(config[_0x82cd('0x15')]));require(_0x82cd('0x18'))['register'](socket);function respondWithStatusCode(_0x2f7cae,_0x1914ac){_0x1914ac=_0x1914ac||0xcc;return function(_0x127775){if(_0x127775){return _0x2f7cae[_0x82cd('0x19')](_0x1914ac);}return _0x2f7cae[_0x82cd('0x1a')](_0x1914ac)[_0x82cd('0x1b')]();};}function respondWithResult(_0x384b6c,_0x409036){_0x409036=_0x409036||0xc8;return function(_0x2ccf83){if(_0x2ccf83){return _0x384b6c[_0x82cd('0x1a')](_0x409036)[_0x82cd('0x1c')](_0x2ccf83);}};}function respondWithFilteredResult(_0x34a141,_0x5c4d31){return function(_0x693944){if(_0x693944){var _0x2d3d89=typeof _0x5c4d31[_0x82cd('0x1d')]==='undefined'&&typeof _0x5c4d31[_0x82cd('0x1e')]===_0x82cd('0x1f');var _0x3f7dbd=_0x693944['count'];var _0x1de074=_0x2d3d89?0x0:_0x5c4d31[_0x82cd('0x1d')];var _0x2248bd=_0x2d3d89?_0x693944[_0x82cd('0x20')]:_0x5c4d31[_0x82cd('0x1d')]+_0x5c4d31[_0x82cd('0x1e')];var _0xa0fb5d;if(_0x2248bd>=_0x3f7dbd){_0x2248bd=_0x3f7dbd;_0xa0fb5d=0xc8;}else{_0xa0fb5d=0xce;}_0x34a141['status'](_0xa0fb5d);return _0x34a141[_0x82cd('0x21')](_0x82cd('0x22'),_0x1de074+'-'+_0x2248bd+'/'+_0x3f7dbd)[_0x82cd('0x1c')](_0x693944);}return null;};}function patchUpdates(_0x27cae8){return function(_0xb77eb5){try{jsonpatch[_0x82cd('0x23')](_0xb77eb5,_0x27cae8,!![]);}catch(_0x154133){return BPromise[_0x82cd('0x24')](_0x154133);}return _0xb77eb5[_0x82cd('0x25')]();};}function saveUpdates(_0x3027b8,_0x578b5a){return function(_0xda892f){if(_0xda892f){return _0xda892f['update'](_0x3027b8)['then'](function(_0xf25e6a){return _0xf25e6a;});}return null;};}function removeEntity(_0x17b17d,_0x1b7d4d){return function(_0xb43678){if(_0xb43678){return _0xb43678[_0x82cd('0x26')]()[_0x82cd('0x27')](function(){var _0x1a9e80=_0xb43678[_0x82cd('0x28')]({'plain':!![]});var _0x88dd0c='Lists';return db[_0x82cd('0x29')][_0x82cd('0x26')]({'where':{'type':_0x88dd0c,'resourceId':_0x1a9e80['id']}})[_0x82cd('0x27')](function(){return _0xb43678;});})[_0x82cd('0x27')](function(){_0x17b17d[_0x82cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe86425,_0x260834){return function(_0x3b127f){if(!_0x3b127f){_0xe86425['sendStatus'](0x194);}return _0x3b127f;};}function handleError(_0x1e5c93,_0x2a9bf6){_0x2a9bf6=_0x2a9bf6||0x1f4;return function(_0x180d27){logger[_0x82cd('0x2a')](_0x180d27[_0x82cd('0x2b')]);if(_0x180d27[_0x82cd('0x2c')]){delete _0x180d27[_0x82cd('0x2c')];}_0x1e5c93[_0x82cd('0x1a')](_0x2a9bf6)['send'](_0x180d27);};}exports[_0x82cd('0x2d')]=function(_0x3e0526,_0x2868e5){var _0x1dcf57={},_0x10a963={},_0xbcaa62={'count':0x0,'rows':[]};var _0x22364b=_[_0x82cd('0x2e')](db[_0x82cd('0x2f')]['rawAttributes'],function(_0x29d369){return{'name':_0x29d369[_0x82cd('0x30')],'type':_0x29d369['type'][_0x82cd('0x31')]};});_0x10a963['model']=_[_0x82cd('0x2e')](_0x22364b,'name');_0x10a963[_0x82cd('0x32')]=_[_0x82cd('0x33')](_0x3e0526['query']);_0x10a963[_0x82cd('0x34')]=_[_0x82cd('0x35')](_0x10a963[_0x82cd('0x36')],_0x10a963[_0x82cd('0x32')]);_0x1dcf57['attributes']=_[_0x82cd('0x35')](_0x10a963[_0x82cd('0x36')],qs[_0x82cd('0x37')](_0x3e0526['query'][_0x82cd('0x37')]));_0x1dcf57[_0x82cd('0x38')]=_0x1dcf57[_0x82cd('0x38')][_0x82cd('0x39')]?_0x1dcf57[_0x82cd('0x38')]:_0x10a963[_0x82cd('0x36')];if(!_0x3e0526[_0x82cd('0x32')][_0x82cd('0x3a')](_0x82cd('0x3b'))){_0x1dcf57['limit']=qs['limit'](_0x3e0526[_0x82cd('0x32')][_0x82cd('0x1e')]);_0x1dcf57[_0x82cd('0x1d')]=qs[_0x82cd('0x1d')](_0x3e0526[_0x82cd('0x32')][_0x82cd('0x1d')]);}_0x1dcf57[_0x82cd('0x3c')]=qs[_0x82cd('0x3d')](_0x3e0526['query']['sort']);_0x1dcf57['where']=qs[_0x82cd('0x34')](_[_0x82cd('0x3e')](_0x3e0526[_0x82cd('0x32')],_0x10a963[_0x82cd('0x34')]),_0x22364b);if(_0x3e0526['query'][_0x82cd('0x3f')]){_0x1dcf57[_0x82cd('0x40')]=_[_0x82cd('0x41')](_0x1dcf57[_0x82cd('0x40')],{'$or':_[_0x82cd('0x2e')](_0x22364b,function(_0x5dc32c){if(_0x5dc32c[_0x82cd('0x42')]!==_0x82cd('0x43')){var _0x4a7f58={};_0x4a7f58[_0x5dc32c[_0x82cd('0x2c')]]={'$like':'%'+_0x3e0526['query'][_0x82cd('0x3f')]+'%'};return _0x4a7f58;}})});}_0x1dcf57=_[_0x82cd('0x41')]({},_0x1dcf57,_0x3e0526[_0x82cd('0x44')]);var _0x45dc7c={'where':_0x1dcf57[_0x82cd('0x40')]};return db[_0x82cd('0x2f')]['count'](_0x45dc7c)[_0x82cd('0x27')](function(_0x3def87){_0xbcaa62[_0x82cd('0x20')]=_0x3def87;if(_0x3e0526[_0x82cd('0x32')][_0x82cd('0x45')]){_0x1dcf57[_0x82cd('0x46')]=[{'all':!![]}];}return db['CmList'][_0x82cd('0x47')](_0x1dcf57);})['then'](function(_0x3892f6){_0xbcaa62[_0x82cd('0x48')]=_0x3892f6;return _0xbcaa62;})['then'](respondWithFilteredResult(_0x2868e5,_0x1dcf57))[_0x82cd('0x49')](handleError(_0x2868e5,null));};exports['show']=function(_0x331fdc,_0x5943e6){var _0x212cc4={'raw':![],'where':{'id':_0x331fdc[_0x82cd('0x4a')]['id']}},_0x2d4a95={};_0x2d4a95[_0x82cd('0x36')]=_[_0x82cd('0x33')](db[_0x82cd('0x2f')][_0x82cd('0x4b')]);_0x2d4a95[_0x82cd('0x32')]=_['keys'](_0x331fdc[_0x82cd('0x32')]);_0x2d4a95['filters']=_['intersection'](_0x2d4a95['model'],_0x2d4a95[_0x82cd('0x32')]);_0x212cc4[_0x82cd('0x38')]=_[_0x82cd('0x35')](_0x2d4a95[_0x82cd('0x36')],qs[_0x82cd('0x37')](_0x331fdc[_0x82cd('0x32')][_0x82cd('0x37')]));_0x212cc4[_0x82cd('0x38')]=_0x212cc4[_0x82cd('0x38')][_0x82cd('0x39')]?_0x212cc4[_0x82cd('0x38')]:_0x2d4a95[_0x82cd('0x36')];if(_0x331fdc[_0x82cd('0x32')][_0x82cd('0x45')]){_0x212cc4[_0x82cd('0x46')]=[{'all':!![]}];}_0x212cc4=_[_0x82cd('0x41')]({},_0x212cc4,_0x331fdc[_0x82cd('0x44')]);return db[_0x82cd('0x2f')][_0x82cd('0x4c')](_0x212cc4)[_0x82cd('0x27')](handleEntityNotFound(_0x5943e6,null))[_0x82cd('0x27')](respondWithResult(_0x5943e6,null))[_0x82cd('0x49')](handleError(_0x5943e6,null));};exports[_0x82cd('0x4d')]=function(_0x51ae78,_0x5e656e){return db[_0x82cd('0x2f')]['create'](_0x51ae78[_0x82cd('0x4e')],{})[_0x82cd('0x27')](function(_0x191e9f){var _0x51d325=_0x51ae78['user'][_0x82cd('0x28')]({'plain':!![]});if(!_0x51d325)throw new Error(_0x82cd('0x4f'));if(_0x51d325[_0x82cd('0x50')]===_0x82cd('0x51')){var _0x6e3ee2=_0x191e9f[_0x82cd('0x28')]({'plain':!![]});var _0x14c3e5='Lists';return db[_0x82cd('0x52')]['find']({'where':{'name':_0x14c3e5,'userProfileId':_0x51d325['userProfileId']},'raw':!![]})[_0x82cd('0x27')](function(_0x3cf120){if(_0x3cf120&&_0x3cf120[_0x82cd('0x53')]===0x0){return db[_0x82cd('0x29')]['create']({'name':_0x6e3ee2[_0x82cd('0x2c')],'resourceId':_0x6e3ee2['id'],'type':_0x3cf120['name'],'sectionId':_0x3cf120['id']},{})[_0x82cd('0x27')](function(){return _0x191e9f;});}else{return _0x191e9f;}})[_0x82cd('0x49')](function(_0x91841d){logger[_0x82cd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x91841d);throw _0x91841d;});}return _0x191e9f;})[_0x82cd('0x27')](respondWithResult(_0x5e656e,0xc9))[_0x82cd('0x49')](handleError(_0x5e656e,null));};exports['update']=function(_0x37cace,_0x46142c){if(_0x37cace['body']['id']){delete _0x37cace[_0x82cd('0x4e')]['id'];}return db[_0x82cd('0x2f')][_0x82cd('0x4c')]({'where':{'id':_0x37cace[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x46142c,null))[_0x82cd('0x27')](saveUpdates(_0x37cace[_0x82cd('0x4e')],null))['then'](respondWithResult(_0x46142c,null))[_0x82cd('0x49')](handleError(_0x46142c,null));};exports[_0x82cd('0x26')]=function(_0x3c9448,_0x290eea){return db[_0x82cd('0x2f')][_0x82cd('0x4c')]({'where':{'id':_0x3c9448[_0x82cd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x290eea,null))[_0x82cd('0x27')](removeEntity(_0x290eea,null))['catch'](handleError(_0x290eea,null));};exports[_0x82cd('0x54')]=function(_0x1e9e01,_0x40f9cd){return db[_0x82cd('0x2f')]['describe']()[_0x82cd('0x27')](respondWithResult(_0x40f9cd,null))[_0x82cd('0x49')](handleError(_0x40f9cd,null));};exports[_0x82cd('0x55')]=function(_0x561319,_0x2daefb,_0x382f44){if(_0x561319[_0x82cd('0x4e')]['id']){delete _0x561319[_0x82cd('0x4e')]['id'];}return db[_0x82cd('0x2f')]['find']({'where':{'id':_0x561319[_0x82cd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2daefb,null))[_0x82cd('0x27')](function(_0x15d284){if(_0x15d284){_0x561319['body'][_0x82cd('0x56')]=_0x15d284['id'];return db['Disposition'][_0x82cd('0x4d')](_0x561319[_0x82cd('0x4e')]);}})[_0x82cd('0x27')](respondWithResult(_0x2daefb,null))[_0x82cd('0x49')](handleError(_0x2daefb,null));};exports['getDispositions']=function(_0x33e47a,_0x1216f0,_0x55a8dd){var _0x2a7ad5={'raw':![],'where':{}};var _0x391ce1={};var _0x45c8b2={'count':0x0,'rows':[]};return db[_0x82cd('0x2f')][_0x82cd('0x57')]({'where':{'id':_0x33e47a[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x1216f0,null))[_0x82cd('0x27')](function(_0x3df9fa){if(_0x3df9fa){_0x391ce1[_0x82cd('0x36')]=_['keys'](db[_0x82cd('0x58')]['rawAttributes']);_0x391ce1[_0x82cd('0x32')]=_[_0x82cd('0x33')](_0x33e47a['query']);_0x391ce1[_0x82cd('0x34')]=_[_0x82cd('0x35')](_0x391ce1[_0x82cd('0x36')],_0x391ce1[_0x82cd('0x32')]);_0x2a7ad5[_0x82cd('0x38')]=_['intersection'](_0x391ce1['model'],qs['fields'](_0x33e47a[_0x82cd('0x32')]['fields']));_0x2a7ad5['attributes']=_0x2a7ad5[_0x82cd('0x38')][_0x82cd('0x39')]?_0x2a7ad5[_0x82cd('0x38')]:_0x391ce1[_0x82cd('0x36')];if(!_0x33e47a[_0x82cd('0x32')][_0x82cd('0x3a')](_0x82cd('0x3b'))){_0x2a7ad5[_0x82cd('0x1e')]=qs[_0x82cd('0x1e')](_0x33e47a[_0x82cd('0x32')][_0x82cd('0x1e')]);_0x2a7ad5[_0x82cd('0x1d')]=qs[_0x82cd('0x1d')](_0x33e47a[_0x82cd('0x32')][_0x82cd('0x1d')]);}_0x2a7ad5['order']=qs['sort'](_0x33e47a['query']['sort']);_0x2a7ad5[_0x82cd('0x40')]=qs['filters'](_[_0x82cd('0x3e')](_0x33e47a['query'],_0x391ce1[_0x82cd('0x34')]));_0x2a7ad5['where'][_0x82cd('0x56')]=_0x3df9fa['id'];if(_0x33e47a[_0x82cd('0x32')][_0x82cd('0x3f')]){_0x2a7ad5[_0x82cd('0x40')]=_[_0x82cd('0x41')](_0x2a7ad5[_0x82cd('0x40')],{'$or':_[_0x82cd('0x2e')](_0x2a7ad5[_0x82cd('0x38')],function(_0x48c92e){var _0x1e5e1b={};_0x1e5e1b[_0x48c92e]={'$like':'%'+_0x33e47a[_0x82cd('0x32')][_0x82cd('0x3f')]+'%'};return _0x1e5e1b;})});}_0x2a7ad5=_[_0x82cd('0x41')]({},_0x2a7ad5,_0x33e47a[_0x82cd('0x44')]);return db['Disposition'][_0x82cd('0x20')]({'where':_0x2a7ad5[_0x82cd('0x40')]})[_0x82cd('0x27')](function(_0x2cae3b){_0x45c8b2[_0x82cd('0x20')]=_0x2cae3b;if(_0x33e47a[_0x82cd('0x32')][_0x82cd('0x45')]){_0x2a7ad5[_0x82cd('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x82cd('0x47')](_0x2a7ad5);})[_0x82cd('0x27')](function(_0x3e5394){_0x45c8b2[_0x82cd('0x48')]=_0x3e5394;return _0x45c8b2;});}})[_0x82cd('0x27')](respondWithFilteredResult(_0x1216f0,_0x2a7ad5))['catch'](handleError(_0x1216f0,null));};exports[_0x82cd('0x59')]=function(_0x4e93a8,_0x32b222,_0x435c67){return db[_0x82cd('0x2f')]['find']({'where':{'id':_0x4e93a8['params']['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x32b222,null))[_0x82cd('0x27')](function(_0x4b840e){if(_0x4b840e){return _0x4b840e[_0x82cd('0x59')](_0x4e93a8['query']['ids']);}})[_0x82cd('0x27')](respondWithStatusCode(_0x32b222,null))[_0x82cd('0x49')](handleError(_0x32b222,null));};exports[_0x82cd('0x5a')]=function(_0x43e1e1,_0x296416,_0xad3153){return db[_0x82cd('0x2f')][_0x82cd('0x4c')]({'where':{'id':_0x43e1e1[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x296416,null))[_0x82cd('0x27')](function(_0xe1df1c){if(_0xe1df1c){var _0x59a8e0=[];var _0x2c3cc2={'success':[],'errors':[]};return db['CmContact'][_0x82cd('0x54')]()[_0x82cd('0x27')](function(_0x2a129f){if(_0x43e1e1[_0x82cd('0x4e')][_0x82cd('0x5b')]&&_[_0x82cd('0x5c')](_0x43e1e1[_0x82cd('0x4e')][_0x82cd('0x5b')])){if(_0x43e1e1[_0x82cd('0x4e')]['tags'][_0x82cd('0x39')]){_0x43e1e1[_0x82cd('0x4e')][_0x82cd('0x5b')]=_0x43e1e1['body'][_0x82cd('0x5b')]['join'](';')+';';}else{_0x43e1e1[_0x82cd('0x4e')][_0x82cd('0x5b')]=null;}}else{_0x43e1e1[_0x82cd('0x4e')]['tags']=null;}if(_0x43e1e1[_0x82cd('0x4e')]&&_['isArray'](_0x43e1e1[_0x82cd('0x4e')])){for(var _0x24fb2d=0x0;_0x24fb2d<_0x43e1e1[_0x82cd('0x4e')][_0x82cd('0x39')];_0x24fb2d+=0x1){_0x43e1e1[_0x82cd('0x4e')][_0x24fb2d][_0x82cd('0x56')]=_0x43e1e1[_0x82cd('0x4a')]['id'];_0x59a8e0[_0x82cd('0x5d')](_0x43e1e1[_0x82cd('0x4e')][_0x24fb2d]);}return BPromise['each'](_0x59a8e0,function(_0x32d2f2){return db[_0x82cd('0x5e')][_0x82cd('0x4d')](_[_0x82cd('0x5f')](_0x32d2f2,[_0x82cd('0x60'),'id'])||{},{'fields':_[_0x82cd('0x33')](_0x2a129f),'raw':!![]})[_0x82cd('0x27')](function(_0x3d3b21){_0x2c3cc2['success']['push'](_0x3d3b21['dataValues']);})[_0x82cd('0x49')](function(_0x424669){_0x2c3cc2[_0x82cd('0x61')][_0x82cd('0x5d')]({'data':_0x32d2f2,'error':_0x424669[_0x82cd('0x62')]});});})['then'](function(_0x246ad5){return _0x2c3cc2;})[_0x82cd('0x49')](function(_0x41829d){return _0x41829d;});}else{_0x296416[_0x82cd('0x1a')](0x190)[_0x82cd('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x82cd('0x27')](respondWithResult(_0x296416,null))['catch'](handleError(_0x296416,null));};exports[_0x82cd('0x63')]=function(_0x3394fd,_0x4afeb6,_0x3d2e0a){var _0x463478;return db[_0x82cd('0x2f')]['find']({'where':{'id':_0x3394fd['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x82cd('0x27')](handleEntityNotFound(_0x4afeb6,null))[_0x82cd('0x27')](function(_0x402295){if(_0x402295){_0x463478=_0x402295;return db[_0x82cd('0x5e')][_0x82cd('0x4b')];}})['then'](function(_0xb95a7f){if(_0xb95a7f){var _0x476bcf={};var _0x590d15={};_0x590d15[_0x82cd('0x36')]=_[_0x82cd('0x64')](_[_0x82cd('0x33')](_0xb95a7f),_[_0x82cd('0x2e')](_0x463478[_0x82cd('0x65')],function(_0x4d3b89){return util[_0x82cd('0x66')](_0x82cd('0x67'),_0x4d3b89['id']);}));_0x590d15['query']=_['keys'](_0x3394fd[_0x82cd('0x32')]);_0x590d15['filters']=_['intersection'](_0x590d15[_0x82cd('0x36')],_0x590d15[_0x82cd('0x32')]);_0x476bcf[_0x82cd('0x38')]=_[_0x82cd('0x35')](_0x590d15[_0x82cd('0x36')],qs[_0x82cd('0x37')](_0x3394fd['query']['fields']));_0x476bcf[_0x82cd('0x38')]=_0x476bcf[_0x82cd('0x38')][_0x82cd('0x39')]?_0x476bcf[_0x82cd('0x38')]:_0x590d15[_0x82cd('0x36')];if(!_0x3394fd[_0x82cd('0x32')][_0x82cd('0x3a')](_0x82cd('0x3b'))){_0x476bcf[_0x82cd('0x1e')]=qs[_0x82cd('0x1e')](_0x3394fd[_0x82cd('0x32')][_0x82cd('0x1e')]);_0x476bcf[_0x82cd('0x1d')]=qs[_0x82cd('0x1d')](_0x3394fd[_0x82cd('0x32')][_0x82cd('0x1d')]);}_0x476bcf[_0x82cd('0x3c')]=qs[_0x82cd('0x3d')](_0x3394fd[_0x82cd('0x32')][_0x82cd('0x3d')]);_0x476bcf[_0x82cd('0x40')]=qs[_0x82cd('0x34')](_[_0x82cd('0x3e')](_0x3394fd['query'],_0x590d15['filters']));_0x476bcf[_0x82cd('0x68')]=!![];if(_0x3394fd[_0x82cd('0x32')]['filter']){_0x476bcf[_0x82cd('0x40')]=_['merge'](_0x476bcf[_0x82cd('0x40')],{'$or':_[_0x82cd('0x2e')](_0x476bcf['attributes'],function(_0x2ddece){var _0x281bcf={};_0x281bcf[_0x2ddece]={'$like':'%'+_0x3394fd['query'][_0x82cd('0x3f')]+'%'};return _0x281bcf;})});}_0x476bcf=_['merge']({},_0x476bcf,_0x3394fd[_0x82cd('0x44')]);return _0x463478[_0x82cd('0x63')](_0x476bcf);}})['then'](respondWithResult(_0x4afeb6,null))[_0x82cd('0x49')](handleError(_0x4afeb6,null));};exports['getContactsCsv']=function(_0xebc648,_0x5f47fc,_0x453223){var _0x503ddd;var _0x106720;var _0x295e4c;var _0x30b188=_0xebc648['params']['id'];csv_results=[];return db['ContactItemType'][_0x82cd('0x47')]({'attributes':['id',_0x82cd('0x2c')],'raw':!![],'order':['OrderBy']})[_0x82cd('0x27')](function(_0x2c46de){_0x503ddd=_0x2c46de;var _0x45005a=_[_0x82cd('0x33')](db['CmContact'][_0x82cd('0x4b')]);return db[_0x82cd('0x69')]['findAll']({'raw':!![],'attributes':['id',_0x82cd('0x6a')]})[_0x82cd('0x27')](function(_0x511b3e){_0x106720=_0x511b3e;var _0x4c1da8=squel['select']()[_0x82cd('0x37')](_0x45005a)['from'](_0x82cd('0x6b'),'c')[_0x82cd('0x40')]('c.ListId\x20=\x20?',_0x30b188)['where'](_0x82cd('0x6c'))['distinct']();for(var _0x50be9a=0x0;_0x50be9a<_0x106720[_0x82cd('0x39')];_0x50be9a++){_0x4c1da8['field'](_0x82cd('0x6d')+_0x106720[_0x50be9a]['id'],_0x82cd('0x6e')+_0x106720[_0x50be9a][_0x82cd('0x6a')]);}for(var _0x50be9a=0x0;_0x50be9a<_0x503ddd[_0x82cd('0x39')];_0x50be9a++){_0x4c1da8[_0x82cd('0x6f')](squel['select']()[_0x82cd('0x6f')](_0x82cd('0x70'))['from'](_0x82cd('0x71'))[_0x82cd('0x40')](_0x82cd('0x72'),_0x503ddd[_0x50be9a]['id'])[_0x82cd('0x40')]('CmContactId\x20=\x20c.id'),_0x82cd('0x73')+_0x503ddd[_0x50be9a]['name']);_0x4c1da8[_0x82cd('0x6f')](squel[_0x82cd('0x74')]()[_0x82cd('0x6f')](_0x82cd('0x75'))[_0x82cd('0x76')](_0x82cd('0x71'))[_0x82cd('0x40')](_0x82cd('0x72'),_0x503ddd[_0x50be9a]['id'])[_0x82cd('0x40')](_0x82cd('0x77')),_0x82cd('0x78')+_0x503ddd[_0x50be9a][_0x82cd('0x2c')]);}var _0xaf16e5=[];_0xaf16e5[_0x82cd('0x5d')](_0x4c1da8[_0x82cd('0x79')]());BPromise[_0x82cd('0x7a')](_0xaf16e5,handleQuery)[_0x82cd('0x27')](function(_0x5eb149){handleQuery(_0x4c1da8[_0x82cd('0x79')]());var _0x21ffe8=csv_results[0x0];if(!_[_0x82cd('0x7b')](_0x21ffe8)){var _0x240cde=toCsv(_0x21ffe8);var _0x8ef649=Date['now']();fs[_0x82cd('0x7c')](util[_0x82cd('0x66')](_0x82cd('0x7d'),_0x30b188,_0x8ef649),_0x240cde);_0x5f47fc[_0x82cd('0x7e')]('Content-disposition',_0x82cd('0x7f')+util[_0x82cd('0x66')]('list_%d_%s.csv',_0x30b188,_0x8ef649));_0x5f47fc[_0x82cd('0x7e')](_0x82cd('0x80'),_0x82cd('0x81'));return _0x5f47fc[_0x82cd('0x82')](util['format'](_0x82cd('0x7d'),_0x30b188,_0x8ef649));}else{return _0x5f47fc[_0x82cd('0x19')](0xcc);}});});});};exports[_0x82cd('0x83')]=function(_0xebb211,_0x37c44c,_0xf06f6c){var _0x3ea678;delete _0xebb211[_0x82cd('0x4e')]['id'];return db[_0x82cd('0x2f')][_0x82cd('0x57')]({'where':{'id':_0xebb211['params']['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x37c44c,null))['then'](function(_0x444a26){if(_0x444a26){return db['sequelize'][_0x82cd('0x84')](function(_0x47cd80){return db[_0x82cd('0x69')]['create'](_0xebb211[_0x82cd('0x4e')],{'transaction':_0x47cd80})[_0x82cd('0x27')](function(_0x429e0c){_0x3ea678=_0x429e0c;return _0x444a26[_0x82cd('0x85')](_0x429e0c,{'transaction':_0x47cd80});})['then'](function(){var _0x50c61b={'type':db[_0x82cd('0x86')][_0x82cd('0x87')],'transaction':_0x47cd80};switch(_0xebb211[_0x82cd('0x4e')][_0x82cd('0x42')]){case _0x82cd('0x88'):_0x50c61b['type']=db[_0x82cd('0x86')][_0x82cd('0x87')];break;case _0x82cd('0x89'):_0x50c61b[_0x82cd('0x42')]=db[_0x82cd('0x86')][_0x82cd('0x8a')];break;case _0x82cd('0x8b'):_0x50c61b['type']=db[_0x82cd('0x86')][_0x82cd('0x8c')];_0x50c61b['defaultValue']=![];break;default:}return db[_0x82cd('0x8d')][_0x82cd('0x8e')][_0x82cd('0x8f')]('cm_contacts',util[_0x82cd('0x66')]('cf_%s',_0x3ea678['id']),_0x50c61b);})['then'](function(){return _0x3ea678;});});}})[_0x82cd('0x27')](respondWithResult(_0x37c44c,null))['catch'](handleError(_0x37c44c,null));};exports[_0x82cd('0x90')]=function(_0x48ef4b,_0x549e17,_0x2e8a58){var _0x2ea5f0={};var _0x5d8aeb={};var _0x2c2b5c;var _0x442229;return db[_0x82cd('0x2f')][_0x82cd('0x57')]({'where':{'id':_0x48ef4b[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x549e17,null))[_0x82cd('0x27')](function(_0x115fcf){if(_0x115fcf){_0x2c2b5c=_0x115fcf;_0x5d8aeb['model']=_['keys'](db[_0x82cd('0x69')][_0x82cd('0x4b')]);_0x5d8aeb[_0x82cd('0x32')]=_[_0x82cd('0x33')](_0x48ef4b[_0x82cd('0x32')]);_0x5d8aeb[_0x82cd('0x34')]=_['intersection'](_0x5d8aeb[_0x82cd('0x36')],_0x5d8aeb[_0x82cd('0x32')]);_0x2ea5f0[_0x82cd('0x38')]=_[_0x82cd('0x35')](_0x5d8aeb[_0x82cd('0x36')],qs[_0x82cd('0x37')](_0x48ef4b[_0x82cd('0x32')][_0x82cd('0x37')]));_0x2ea5f0[_0x82cd('0x38')]=_0x2ea5f0['attributes']['length']?_0x2ea5f0[_0x82cd('0x38')]:_0x5d8aeb[_0x82cd('0x36')];_0x2ea5f0['order']=qs[_0x82cd('0x3d')](_0x48ef4b[_0x82cd('0x32')][_0x82cd('0x3d')]);_0x2ea5f0['where']=qs[_0x82cd('0x34')](_[_0x82cd('0x3e')](_0x48ef4b[_0x82cd('0x32')],_0x5d8aeb[_0x82cd('0x34')]));_0x2ea5f0['where']=_[_0x82cd('0x41')](_0x2ea5f0[_0x82cd('0x40')],{'$or':[{'ListId':_0x115fcf['id']},{'ListId':null}]});if(_0x48ef4b[_0x82cd('0x32')][_0x82cd('0x3f')]){_0x2ea5f0[_0x82cd('0x40')]=_[_0x82cd('0x41')](_0x2ea5f0[_0x82cd('0x40')],{'$or':_[_0x82cd('0x2e')](_0x2ea5f0[_0x82cd('0x38')],function(_0x55897b){var _0x22c918={};_0x22c918[_0x55897b]={'$like':'%'+_0x48ef4b[_0x82cd('0x32')][_0x82cd('0x3f')]+'%'};return _0x22c918;})});}_0x2ea5f0=_['merge']({},_0x2ea5f0,_0x48ef4b[_0x82cd('0x44')]);return db[_0x82cd('0x69')][_0x82cd('0x91')](_0x2ea5f0);}})[_0x82cd('0x27')](respondWithResult(_0x549e17,null))[_0x82cd('0x49')](handleError(_0x549e17,null));};exports['getGlobalCustomFields']=function(_0x181420,_0x56c8ce){return db['CmCustomField'][_0x82cd('0x91')]({'where':{'ListId':null}})[_0x82cd('0x27')](handleEntityNotFound(_0x56c8ce,null))[_0x82cd('0x27')](function(_0x4d08a8){return _0x4d08a8;})[_0x82cd('0x27')](respondWithResult(_0x56c8ce,null))['catch'](handleError(_0x56c8ce,null));};exports[_0x82cd('0x92')]=function(_0x283540,_0x389873,_0x430182){return db[_0x82cd('0x2f')][_0x82cd('0x4c')]({'where':{'id':_0x283540[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x389873,null))[_0x82cd('0x27')](function(_0x4820ef){if(_0x4820ef){return _0x4820ef[_0x82cd('0x92')](_0x283540[_0x82cd('0x4e')][_0x82cd('0x60')],_[_0x82cd('0x5f')](_0x283540['body'],[_0x82cd('0x60'),'id'])||{})['spread'](function(_0x82c1db){for(var _0x594d9a=0x0;_0x594d9a<_0x283540[_0x82cd('0x4e')]['ids']['length'];_0x594d9a+=0x1){socket[_0x82cd('0x93')](_0x82cd('0x94'),{'UserId':Number(_0x283540['body'][_0x82cd('0x60')][_0x594d9a]),'CmListId':Number(_0x283540['params']['id'])});}return _0x82c1db;});}})[_0x82cd('0x27')](respondWithResult(_0x389873,null))[_0x82cd('0x49')](handleError(_0x389873,null));};exports[_0x82cd('0x95')]=function(_0x1935d3,_0x38725c,_0x2c90fc){return db[_0x82cd('0x2f')][_0x82cd('0x4c')]({'where':{'id':_0x1935d3[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x38725c,null))[_0x82cd('0x27')](function(_0x249b17){if(_0x249b17){return _0x249b17['removeAgents'](_0x1935d3[_0x82cd('0x32')][_0x82cd('0x60')])[_0x82cd('0x27')](function(){if(_[_0x82cd('0x5c')](_0x1935d3[_0x82cd('0x32')]['ids'])){for(var _0x2c9747=0x0;_0x2c9747<_0x1935d3[_0x82cd('0x32')][_0x82cd('0x60')][_0x82cd('0x39')];_0x2c9747+=0x1){socket[_0x82cd('0x93')]('userCmList:remove',{'UserId':Number(_0x1935d3[_0x82cd('0x32')]['ids'][_0x2c9747]),'CmListId':Number(_0x1935d3[_0x82cd('0x4a')]['id'])});}}else{socket[_0x82cd('0x93')](_0x82cd('0x96'),{'UserId':Number(_0x1935d3['query'][_0x82cd('0x60')]),'CmListId':Number(_0x1935d3[_0x82cd('0x4a')]['id'])});}});}})[_0x82cd('0x27')](respondWithStatusCode(_0x38725c,null))[_0x82cd('0x49')](handleError(_0x38725c,null));};exports['getAgents']=function(_0x3d6fd7,_0x5952b8,_0x213712){var _0x3484ee={};var _0x2ea268={};var _0x491919;var _0x240d2b;return db[_0x82cd('0x2f')][_0x82cd('0x57')]({'where':{'id':_0x3d6fd7[_0x82cd('0x4a')]['id']}})[_0x82cd('0x27')](handleEntityNotFound(_0x5952b8,null))[_0x82cd('0x27')](function(_0x25ed0b){if(_0x25ed0b){_0x491919=_0x25ed0b;_0x2ea268[_0x82cd('0x36')]=_[_0x82cd('0x33')](db['User'][_0x82cd('0x4b')]);_0x2ea268[_0x82cd('0x32')]=_[_0x82cd('0x33')](_0x3d6fd7[_0x82cd('0x32')]);_0x2ea268['filters']=_['intersection'](_0x2ea268[_0x82cd('0x36')],_0x2ea268['query']);_0x3484ee[_0x82cd('0x38')]=_[_0x82cd('0x35')](_0x2ea268[_0x82cd('0x36')],qs[_0x82cd('0x37')](_0x3d6fd7[_0x82cd('0x32')][_0x82cd('0x37')]));_0x3484ee[_0x82cd('0x38')]=_0x3484ee[_0x82cd('0x38')][_0x82cd('0x39')]?_0x3484ee['attributes']:_0x2ea268[_0x82cd('0x36')];_0x3484ee[_0x82cd('0x3c')]=qs['sort'](_0x3d6fd7[_0x82cd('0x32')][_0x82cd('0x3d')]);_0x3484ee[_0x82cd('0x40')]=qs['filters'](_[_0x82cd('0x3e')](_0x3d6fd7['query'],_0x2ea268[_0x82cd('0x34')]));if(_0x3d6fd7['query'][_0x82cd('0x3f')]){_0x3484ee['where']=_[_0x82cd('0x41')](_0x3484ee[_0x82cd('0x40')],{'$or':_[_0x82cd('0x2e')](_0x3484ee[_0x82cd('0x38')],function(_0x337828){var _0x5ee005={};_0x5ee005[_0x337828]={'$like':'%'+_0x3d6fd7['query'][_0x82cd('0x3f')]+'%'};return _0x5ee005;})});}_0x3484ee=_[_0x82cd('0x41')]({},_0x3484ee,_0x3d6fd7[_0x82cd('0x44')]);return _0x491919[_0x82cd('0x97')](_0x3484ee);}})[_0x82cd('0x27')](function(_0x38d4d0){if(_0x38d4d0){_0x240d2b=_0x38d4d0[_0x82cd('0x39')];if(!_0x3d6fd7[_0x82cd('0x32')][_0x82cd('0x3a')](_0x82cd('0x3b'))){_0x3484ee[_0x82cd('0x1e')]=qs[_0x82cd('0x1e')](_0x3d6fd7[_0x82cd('0x32')][_0x82cd('0x1e')]);_0x3484ee['offset']=qs[_0x82cd('0x1d')](_0x3d6fd7[_0x82cd('0x32')][_0x82cd('0x1d')]);}return _0x491919[_0x82cd('0x97')](_0x3484ee);}})[_0x82cd('0x27')](function(_0x71fbcb){if(_0x71fbcb){return _0x71fbcb?{'count':_0x240d2b,'rows':_0x71fbcb}:null;}})[_0x82cd('0x27')](respondWithResult(_0x5952b8,null))[_0x82cd('0x49')](handleError(_0x5952b8,null));};function handleQuery(_0x40e9b0){logger['info'](_0x40e9b0);return db[_0x82cd('0x8d')][_0x82cd('0x32')](_0x40e9b0)[_0x82cd('0x98')](function(_0x2505d7){csv_results[_0x82cd('0x5d')](_0x2505d7);})[_0x82cd('0x49')](function(_0x2da7f8){logger['error'](_0x2da7f8[_0x82cd('0x62')]);});} \ No newline at end of file +var _0x58e4=['./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Lists','end','error','stack','name','send','index','CmList','rawAttributes','key','map','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','CmContact','tags','isArray','join','push','omit','ids','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','getContactsCsv','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','each','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x405c4a,_0x15fd70){var _0x45b9ff=function(_0x45d823){while(--_0x45d823){_0x405c4a['push'](_0x405c4a['shift']());}};_0x45b9ff(++_0x15fd70);}(_0x58e4,0x128));var _0x458e=function(_0x4b0eaf,_0x95c934){_0x4b0eaf=_0x4b0eaf-0x0;var _0x13e96a=_0x58e4[_0x4b0eaf];return _0x13e96a;};'use strict';var emlformat=require(_0x458e('0x0'));var rimraf=require(_0x458e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x458e('0x2'));var rp=require(_0x458e('0x3'));var moment=require('moment');var BPromise=require(_0x458e('0x4'));var Mustache=require('mustache');var util=require(_0x458e('0x5'));var path=require(_0x458e('0x6'));var sox=require('sox');var csv=require(_0x458e('0x7'));var ejs=require(_0x458e('0x8'));var fs=require('fs');var fs_extra=require(_0x458e('0x9'));var _=require(_0x458e('0xa'));var squel=require(_0x458e('0xb'));var crypto=require('crypto');var jsforce=require(_0x458e('0xc'));var deskjs=require(_0x458e('0xd'));var toCsv=require(_0x458e('0x7'));var querystring=require(_0x458e('0xe'));var Papa=require('papaparse');var Redis=require(_0x458e('0xf'));var authService=require(_0x458e('0x10'));var qs=require(_0x458e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x458e('0x12'));var logger=require('../../config/logger')(_0x458e('0x13'));var utils=require('../../config/utils');var config=require(_0x458e('0x14'));var licenseUtil=require(_0x458e('0x15'));var db=require(_0x458e('0x16'))['db'];var csv_results;config[_0x458e('0x17')]=_[_0x458e('0x18')](config[_0x458e('0x17')],{'host':_0x458e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458e('0x17')]));require(_0x458e('0x1a'))[_0x458e('0x1b')](socket);function respondWithStatusCode(_0x4f1b06,_0x53da91){_0x53da91=_0x53da91||0xcc;return function(_0x4eecef){if(_0x4eecef){return _0x4f1b06[_0x458e('0x1c')](_0x53da91);}return _0x4f1b06['status'](_0x53da91)['end']();};}function respondWithResult(_0x571357,_0x4e2d98){_0x4e2d98=_0x4e2d98||0xc8;return function(_0x354bfa){if(_0x354bfa){return _0x571357[_0x458e('0x1d')](_0x4e2d98)[_0x458e('0x1e')](_0x354bfa);}};}function respondWithFilteredResult(_0x13ba00,_0x650c19){return function(_0x444593){if(_0x444593){var _0x49eb09=typeof _0x650c19[_0x458e('0x1f')]===_0x458e('0x20')&&typeof _0x650c19[_0x458e('0x21')]===_0x458e('0x20');var _0x2447c7=_0x444593[_0x458e('0x22')];var _0xc447ee=_0x49eb09?0x0:_0x650c19['offset'];var _0xdab85d=_0x49eb09?_0x444593[_0x458e('0x22')]:_0x650c19[_0x458e('0x1f')]+_0x650c19[_0x458e('0x21')];var _0x43893e;if(_0xdab85d>=_0x2447c7){_0xdab85d=_0x2447c7;_0x43893e=0xc8;}else{_0x43893e=0xce;}_0x13ba00[_0x458e('0x1d')](_0x43893e);return _0x13ba00[_0x458e('0x23')](_0x458e('0x24'),_0xc447ee+'-'+_0xdab85d+'/'+_0x2447c7)[_0x458e('0x1e')](_0x444593);}return null;};}function patchUpdates(_0x5b062c){return function(_0x335135){try{jsonpatch[_0x458e('0x25')](_0x335135,_0x5b062c,!![]);}catch(_0x22bbed){return BPromise[_0x458e('0x26')](_0x22bbed);}return _0x335135[_0x458e('0x27')]();};}function saveUpdates(_0x16b996,_0x3668dd){return function(_0x47730c){if(_0x47730c){return _0x47730c['update'](_0x16b996)['then'](function(_0xbaf4df){return _0xbaf4df;});}return null;};}function removeEntity(_0x451ec5,_0x245416){return function(_0x738723){if(_0x738723){return _0x738723[_0x458e('0x28')]()[_0x458e('0x29')](function(){var _0x30923c=_0x738723[_0x458e('0x2a')]({'plain':!![]});var _0x2967e6=_0x458e('0x2b');return db['UserProfileResource'][_0x458e('0x28')]({'where':{'type':_0x2967e6,'resourceId':_0x30923c['id']}})[_0x458e('0x29')](function(){return _0x738723;});})[_0x458e('0x29')](function(){_0x451ec5[_0x458e('0x1d')](0xcc)[_0x458e('0x2c')]();});}};}function handleEntityNotFound(_0x3afb3a,_0x3cea37){return function(_0x548403){if(!_0x548403){_0x3afb3a['sendStatus'](0x194);}return _0x548403;};}function handleError(_0x7cfec2,_0x4cf6bd){_0x4cf6bd=_0x4cf6bd||0x1f4;return function(_0x4ad449){logger[_0x458e('0x2d')](_0x4ad449[_0x458e('0x2e')]);if(_0x4ad449[_0x458e('0x2f')]){delete _0x4ad449[_0x458e('0x2f')];}_0x7cfec2['status'](_0x4cf6bd)[_0x458e('0x30')](_0x4ad449);};}exports[_0x458e('0x31')]=function(_0x52de31,_0x327b7c){var _0x5f1701={},_0x157f0f={},_0x1e2fa6={'count':0x0,'rows':[]};var _0x15758a=_['map'](db[_0x458e('0x32')][_0x458e('0x33')],function(_0xf13bc8){return{'name':_0xf13bc8['fieldName'],'type':_0xf13bc8['type'][_0x458e('0x34')]};});_0x157f0f['model']=_[_0x458e('0x35')](_0x15758a,_0x458e('0x2f'));_0x157f0f[_0x458e('0x36')]=_[_0x458e('0x37')](_0x52de31[_0x458e('0x36')]);_0x157f0f[_0x458e('0x38')]=_['intersection'](_0x157f0f[_0x458e('0x39')],_0x157f0f[_0x458e('0x36')]);_0x5f1701['attributes']=_['intersection'](_0x157f0f[_0x458e('0x39')],qs[_0x458e('0x3a')](_0x52de31[_0x458e('0x36')][_0x458e('0x3a')]));_0x5f1701[_0x458e('0x3b')]=_0x5f1701[_0x458e('0x3b')][_0x458e('0x3c')]?_0x5f1701['attributes']:_0x157f0f[_0x458e('0x39')];if(!_0x52de31['query'][_0x458e('0x3d')](_0x458e('0x3e'))){_0x5f1701[_0x458e('0x21')]=qs[_0x458e('0x21')](_0x52de31[_0x458e('0x36')]['limit']);_0x5f1701[_0x458e('0x1f')]=qs[_0x458e('0x1f')](_0x52de31[_0x458e('0x36')][_0x458e('0x1f')]);}_0x5f1701[_0x458e('0x3f')]=qs[_0x458e('0x40')](_0x52de31[_0x458e('0x36')][_0x458e('0x40')]);_0x5f1701[_0x458e('0x41')]=qs[_0x458e('0x38')](_[_0x458e('0x42')](_0x52de31[_0x458e('0x36')],_0x157f0f[_0x458e('0x38')]),_0x15758a);if(_0x52de31[_0x458e('0x36')][_0x458e('0x43')]){_0x5f1701[_0x458e('0x41')]=_[_0x458e('0x44')](_0x5f1701['where'],{'$or':_[_0x458e('0x35')](_0x15758a,function(_0x5ce094){if(_0x5ce094[_0x458e('0x45')]!==_0x458e('0x46')){var _0x90255={};_0x90255[_0x5ce094['name']]={'$like':'%'+_0x52de31[_0x458e('0x36')][_0x458e('0x43')]+'%'};return _0x90255;}})});}_0x5f1701=_[_0x458e('0x44')]({},_0x5f1701,_0x52de31[_0x458e('0x47')]);var _0xf09778={'where':_0x5f1701['where']};return db[_0x458e('0x32')][_0x458e('0x22')](_0xf09778)[_0x458e('0x29')](function(_0x364e28){_0x1e2fa6[_0x458e('0x22')]=_0x364e28;if(_0x52de31['query'][_0x458e('0x48')]){_0x5f1701[_0x458e('0x49')]=[{'all':!![]}];}return db['CmList'][_0x458e('0x4a')](_0x5f1701);})['then'](function(_0x599a5a){_0x1e2fa6[_0x458e('0x4b')]=_0x599a5a;return _0x1e2fa6;})[_0x458e('0x29')](respondWithFilteredResult(_0x327b7c,_0x5f1701))[_0x458e('0x4c')](handleError(_0x327b7c,null));};exports[_0x458e('0x4d')]=function(_0x52458e,_0x3c62b0){var _0x3a85d3={'raw':![],'where':{'id':_0x52458e[_0x458e('0x4e')]['id']}},_0x36e8f3={};_0x36e8f3[_0x458e('0x39')]=_[_0x458e('0x37')](db[_0x458e('0x32')][_0x458e('0x33')]);_0x36e8f3[_0x458e('0x36')]=_[_0x458e('0x37')](_0x52458e[_0x458e('0x36')]);_0x36e8f3['filters']=_['intersection'](_0x36e8f3[_0x458e('0x39')],_0x36e8f3[_0x458e('0x36')]);_0x3a85d3['attributes']=_[_0x458e('0x4f')](_0x36e8f3[_0x458e('0x39')],qs[_0x458e('0x3a')](_0x52458e['query'][_0x458e('0x3a')]));_0x3a85d3[_0x458e('0x3b')]=_0x3a85d3[_0x458e('0x3b')][_0x458e('0x3c')]?_0x3a85d3[_0x458e('0x3b')]:_0x36e8f3[_0x458e('0x39')];if(_0x52458e[_0x458e('0x36')][_0x458e('0x48')]){_0x3a85d3[_0x458e('0x49')]=[{'all':!![]}];}_0x3a85d3=_['merge']({},_0x3a85d3,_0x52458e[_0x458e('0x47')]);return db[_0x458e('0x32')][_0x458e('0x50')](_0x3a85d3)['then'](handleEntityNotFound(_0x3c62b0,null))[_0x458e('0x29')](respondWithResult(_0x3c62b0,null))['catch'](handleError(_0x3c62b0,null));};exports[_0x458e('0x51')]=function(_0x4fe338,_0x382dc0){return db[_0x458e('0x32')][_0x458e('0x51')](_0x4fe338[_0x458e('0x52')],{})['then'](function(_0x2b3092){var _0x4e3344=_0x4fe338[_0x458e('0x53')][_0x458e('0x2a')]({'plain':!![]});if(!_0x4e3344)throw new Error(_0x458e('0x54'));if(_0x4e3344[_0x458e('0x55')]===_0x458e('0x53')){var _0x230654=_0x2b3092['get']({'plain':!![]});var _0x474cd9=_0x458e('0x2b');return db[_0x458e('0x56')][_0x458e('0x50')]({'where':{'name':_0x474cd9,'userProfileId':_0x4e3344[_0x458e('0x57')]},'raw':!![]})[_0x458e('0x29')](function(_0x10a614){if(_0x10a614&&_0x10a614[_0x458e('0x58')]===0x0){return db[_0x458e('0x59')]['create']({'name':_0x230654['name'],'resourceId':_0x230654['id'],'type':_0x10a614[_0x458e('0x2f')],'sectionId':_0x10a614['id']},{})['then'](function(){return _0x2b3092;});}else{return _0x2b3092;}})[_0x458e('0x4c')](function(_0xbfb5e9){logger[_0x458e('0x2d')](_0x458e('0x5a'),_0xbfb5e9);throw _0xbfb5e9;});}return _0x2b3092;})[_0x458e('0x29')](respondWithResult(_0x382dc0,0xc9))['catch'](handleError(_0x382dc0,null));};exports['update']=function(_0x12f35b,_0x86d798){if(_0x12f35b['body']['id']){delete _0x12f35b[_0x458e('0x52')]['id'];}return db['CmList']['find']({'where':{'id':_0x12f35b[_0x458e('0x4e')]['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x86d798,null))['then'](saveUpdates(_0x12f35b['body'],null))[_0x458e('0x29')](respondWithResult(_0x86d798,null))[_0x458e('0x4c')](handleError(_0x86d798,null));};exports['destroy']=function(_0x2ff002,_0x947ea3){return db[_0x458e('0x32')][_0x458e('0x50')]({'where':{'id':_0x2ff002[_0x458e('0x4e')]['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x947ea3,null))[_0x458e('0x29')](removeEntity(_0x947ea3,null))['catch'](handleError(_0x947ea3,null));};exports['describe']=function(_0x1df2ba,_0x153c90){return db[_0x458e('0x32')][_0x458e('0x5b')]()[_0x458e('0x29')](respondWithResult(_0x153c90,null))[_0x458e('0x4c')](handleError(_0x153c90,null));};exports['addDisposition']=function(_0x38fdb8,_0x4f3802,_0xdf152a){if(_0x38fdb8[_0x458e('0x52')]['id']){delete _0x38fdb8['body']['id'];}return db[_0x458e('0x32')][_0x458e('0x50')]({'where':{'id':_0x38fdb8[_0x458e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f3802,null))[_0x458e('0x29')](function(_0x37b47e){if(_0x37b47e){_0x38fdb8['body'][_0x458e('0x5c')]=_0x37b47e['id'];return db[_0x458e('0x5d')][_0x458e('0x51')](_0x38fdb8[_0x458e('0x52')]);}})[_0x458e('0x29')](respondWithResult(_0x4f3802,null))[_0x458e('0x4c')](handleError(_0x4f3802,null));};exports[_0x458e('0x5e')]=function(_0x3b91ad,_0x3efe77,_0xe6df89){var _0xea2c48={'raw':![],'where':{}};var _0x105ffd={};var _0x11509a={'count':0x0,'rows':[]};return db[_0x458e('0x32')][_0x458e('0x5f')]({'where':{'id':_0x3b91ad[_0x458e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3efe77,null))['then'](function(_0x21c325){if(_0x21c325){_0x105ffd[_0x458e('0x39')]=_[_0x458e('0x37')](db[_0x458e('0x5d')][_0x458e('0x33')]);_0x105ffd['query']=_['keys'](_0x3b91ad[_0x458e('0x36')]);_0x105ffd[_0x458e('0x38')]=_[_0x458e('0x4f')](_0x105ffd['model'],_0x105ffd[_0x458e('0x36')]);_0xea2c48[_0x458e('0x3b')]=_[_0x458e('0x4f')](_0x105ffd[_0x458e('0x39')],qs[_0x458e('0x3a')](_0x3b91ad['query'][_0x458e('0x3a')]));_0xea2c48[_0x458e('0x3b')]=_0xea2c48[_0x458e('0x3b')][_0x458e('0x3c')]?_0xea2c48[_0x458e('0x3b')]:_0x105ffd[_0x458e('0x39')];if(!_0x3b91ad[_0x458e('0x36')][_0x458e('0x3d')](_0x458e('0x3e'))){_0xea2c48[_0x458e('0x21')]=qs['limit'](_0x3b91ad['query'][_0x458e('0x21')]);_0xea2c48[_0x458e('0x1f')]=qs[_0x458e('0x1f')](_0x3b91ad[_0x458e('0x36')][_0x458e('0x1f')]);}_0xea2c48['order']=qs[_0x458e('0x40')](_0x3b91ad[_0x458e('0x36')]['sort']);_0xea2c48[_0x458e('0x41')]=qs[_0x458e('0x38')](_['pick'](_0x3b91ad['query'],_0x105ffd[_0x458e('0x38')]));_0xea2c48['where'][_0x458e('0x5c')]=_0x21c325['id'];if(_0x3b91ad[_0x458e('0x36')][_0x458e('0x43')]){_0xea2c48['where']=_[_0x458e('0x44')](_0xea2c48[_0x458e('0x41')],{'$or':_[_0x458e('0x35')](_0xea2c48[_0x458e('0x3b')],function(_0x53c0ce){var _0x2122d5={};_0x2122d5[_0x53c0ce]={'$like':'%'+_0x3b91ad[_0x458e('0x36')][_0x458e('0x43')]+'%'};return _0x2122d5;})});}_0xea2c48=_[_0x458e('0x44')]({},_0xea2c48,_0x3b91ad['options']);return db['Disposition'][_0x458e('0x22')]({'where':_0xea2c48[_0x458e('0x41')]})[_0x458e('0x29')](function(_0x37bff9){_0x11509a[_0x458e('0x22')]=_0x37bff9;if(_0x3b91ad[_0x458e('0x36')]['includeAll']){_0xea2c48[_0x458e('0x49')]=[{'all':!![]}];}return db[_0x458e('0x5d')][_0x458e('0x4a')](_0xea2c48);})[_0x458e('0x29')](function(_0x181b7a){_0x11509a[_0x458e('0x4b')]=_0x181b7a;return _0x11509a;});}})[_0x458e('0x29')](respondWithFilteredResult(_0x3efe77,_0xea2c48))['catch'](handleError(_0x3efe77,null));};exports['removeDispositions']=function(_0x2b33b4,_0x59e550,_0x440dbe){return db[_0x458e('0x32')][_0x458e('0x50')]({'where':{'id':_0x2b33b4[_0x458e('0x4e')]['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x59e550,null))[_0x458e('0x29')](function(_0x247209){if(_0x247209){return _0x247209['removeDispositions'](_0x2b33b4[_0x458e('0x36')]['ids']);}})[_0x458e('0x29')](respondWithStatusCode(_0x59e550,null))[_0x458e('0x4c')](handleError(_0x59e550,null));};exports['addContacts']=function(_0x12c306,_0x416644,_0x3606e1){return db[_0x458e('0x32')][_0x458e('0x50')]({'where':{'id':_0x12c306['params']['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x416644,null))['then'](function(_0x571910){if(_0x571910){var _0x5d9eb2=[];var _0x24bc96={'success':[],'errors':[]};return db[_0x458e('0x60')]['describe']()[_0x458e('0x29')](function(_0x4be57e){if(_0x12c306[_0x458e('0x52')][_0x458e('0x61')]&&_[_0x458e('0x62')](_0x12c306[_0x458e('0x52')][_0x458e('0x61')])){if(_0x12c306[_0x458e('0x52')][_0x458e('0x61')][_0x458e('0x3c')]){_0x12c306[_0x458e('0x52')][_0x458e('0x61')]=_0x12c306['body']['tags'][_0x458e('0x63')](';')+';';}else{_0x12c306[_0x458e('0x52')]['tags']=null;}}else{_0x12c306['body']['tags']=null;}if(_0x12c306[_0x458e('0x52')]&&_[_0x458e('0x62')](_0x12c306[_0x458e('0x52')])){for(var _0x232135=0x0;_0x232135<_0x12c306['body'][_0x458e('0x3c')];_0x232135+=0x1){_0x12c306['body'][_0x232135]['ListId']=_0x12c306['params']['id'];_0x5d9eb2[_0x458e('0x64')](_0x12c306['body'][_0x232135]);}return BPromise['each'](_0x5d9eb2,function(_0xf081a4){return db[_0x458e('0x60')][_0x458e('0x51')](_[_0x458e('0x65')](_0xf081a4,[_0x458e('0x66'),'id'])||{},{'fields':_[_0x458e('0x37')](_0x4be57e),'raw':!![]})[_0x458e('0x29')](function(_0x5032a7){_0x24bc96['success']['push'](_0x5032a7[_0x458e('0x67')]);})[_0x458e('0x4c')](function(_0x4e1bea){_0x24bc96['errors']['push']({'data':_0xf081a4,'error':_0x4e1bea[_0x458e('0x68')]});});})[_0x458e('0x29')](function(_0x4f404a){return _0x24bc96;})[_0x458e('0x4c')](function(_0x230b99){return _0x230b99;});}else{_0x416644[_0x458e('0x1d')](0x190)[_0x458e('0x1e')]({'message':_0x458e('0x69')});}});}})[_0x458e('0x29')](respondWithResult(_0x416644,null))['catch'](handleError(_0x416644,null));};exports[_0x458e('0x6a')]=function(_0x106a1c,_0x2aeed9,_0x486407){var _0x1a1fca;return db['CmList'][_0x458e('0x50')]({'where':{'id':_0x106a1c[_0x458e('0x4e')]['id']},'include':[{'model':db[_0x458e('0x6b')],'as':_0x458e('0x6c')}]})[_0x458e('0x29')](handleEntityNotFound(_0x2aeed9,null))[_0x458e('0x29')](function(_0x5b8e4c){if(_0x5b8e4c){_0x1a1fca=_0x5b8e4c;return db['CmContact'][_0x458e('0x33')];}})[_0x458e('0x29')](function(_0x17e8e4){if(_0x17e8e4){var _0x364691={};var _0xddf92a={};_0xddf92a[_0x458e('0x39')]=_['concat'](_['keys'](_0x17e8e4),_[_0x458e('0x35')](_0x1a1fca[_0x458e('0x6c')],function(_0x4daefc){return util[_0x458e('0x6d')](_0x458e('0x6e'),_0x4daefc['id']);}));_0xddf92a[_0x458e('0x36')]=_[_0x458e('0x37')](_0x106a1c[_0x458e('0x36')]);_0xddf92a[_0x458e('0x38')]=_[_0x458e('0x4f')](_0xddf92a[_0x458e('0x39')],_0xddf92a[_0x458e('0x36')]);_0x364691[_0x458e('0x3b')]=_[_0x458e('0x4f')](_0xddf92a[_0x458e('0x39')],qs['fields'](_0x106a1c[_0x458e('0x36')][_0x458e('0x3a')]));_0x364691['attributes']=_0x364691['attributes'][_0x458e('0x3c')]?_0x364691['attributes']:_0xddf92a[_0x458e('0x39')];if(!_0x106a1c['query'][_0x458e('0x3d')](_0x458e('0x3e'))){_0x364691['limit']=qs[_0x458e('0x21')](_0x106a1c[_0x458e('0x36')]['limit']);_0x364691['offset']=qs[_0x458e('0x1f')](_0x106a1c[_0x458e('0x36')][_0x458e('0x1f')]);}_0x364691[_0x458e('0x3f')]=qs['sort'](_0x106a1c[_0x458e('0x36')][_0x458e('0x40')]);_0x364691[_0x458e('0x41')]=qs[_0x458e('0x38')](_['pick'](_0x106a1c['query'],_0xddf92a[_0x458e('0x38')]));_0x364691['raw']=!![];if(_0x106a1c[_0x458e('0x36')][_0x458e('0x43')]){_0x364691['where']=_['merge'](_0x364691[_0x458e('0x41')],{'$or':_[_0x458e('0x35')](_0x364691[_0x458e('0x3b')],function(_0x283451){var _0x3c0eaa={};_0x3c0eaa[_0x283451]={'$like':'%'+_0x106a1c[_0x458e('0x36')][_0x458e('0x43')]+'%'};return _0x3c0eaa;})});}_0x364691=_[_0x458e('0x44')]({},_0x364691,_0x106a1c[_0x458e('0x47')]);return _0x1a1fca[_0x458e('0x6a')](_0x364691);}})[_0x458e('0x29')](respondWithResult(_0x2aeed9,null))[_0x458e('0x4c')](handleError(_0x2aeed9,null));};exports[_0x458e('0x6f')]=function(_0x56e98d,_0x1e1746,_0x49755a){var _0x36aab0;var _0x3db0d1;var _0x58b4b8;var _0x17d85d=_0x56e98d['params']['id'];csv_results=[];return db['ContactItemType'][_0x458e('0x4a')]({'attributes':['id',_0x458e('0x2f')],'raw':!![],'order':['OrderBy']})[_0x458e('0x29')](function(_0x19fe81){_0x36aab0=_0x19fe81;var _0x223166=_['keys'](db[_0x458e('0x60')][_0x458e('0x33')]);return db[_0x458e('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x458e('0x70')]})['then'](function(_0x1bb653){_0x3db0d1=_0x1bb653;var _0x5bf2a1=squel[_0x458e('0x71')]()[_0x458e('0x3a')](_0x223166)[_0x458e('0x72')](_0x458e('0x73'),'c')[_0x458e('0x41')]('c.ListId\x20=\x20?',_0x17d85d)['where'](_0x458e('0x74'))['distinct']();for(var _0x51bfa5=0x0;_0x51bfa5<_0x3db0d1[_0x458e('0x3c')];_0x51bfa5++){_0x5bf2a1[_0x458e('0x75')](_0x458e('0x76')+_0x3db0d1[_0x51bfa5]['id'],_0x458e('0x77')+_0x3db0d1[_0x51bfa5]['alias']);}for(var _0x51bfa5=0x0;_0x51bfa5<_0x36aab0[_0x458e('0x3c')];_0x51bfa5++){_0x5bf2a1['field'](squel[_0x458e('0x71')]()[_0x458e('0x75')]('item')[_0x458e('0x72')](_0x458e('0x78'))[_0x458e('0x41')](_0x458e('0x79'),_0x36aab0[_0x51bfa5]['id'])['where'](_0x458e('0x7a')),_0x458e('0x7b')+_0x36aab0[_0x51bfa5]['name']);_0x5bf2a1[_0x458e('0x75')](squel[_0x458e('0x71')]()[_0x458e('0x75')](_0x458e('0x7c'))[_0x458e('0x72')](_0x458e('0x78'))['where'](_0x458e('0x79'),_0x36aab0[_0x51bfa5]['id'])[_0x458e('0x41')](_0x458e('0x7a')),'description_additionalPhone_'+_0x36aab0[_0x51bfa5][_0x458e('0x2f')]);}var _0x560b46=[];_0x560b46[_0x458e('0x64')](_0x5bf2a1[_0x458e('0x7d')]());BPromise[_0x458e('0x7e')](_0x560b46,handleQuery)[_0x458e('0x29')](function(_0x4e7d0f){handleQuery(_0x5bf2a1[_0x458e('0x7d')]());var _0x3955e0=csv_results[0x0];if(!_[_0x458e('0x7f')](_0x3955e0)){var _0x180985=toCsv(_0x3955e0);var _0x47424f=Date[_0x458e('0x80')]();fs[_0x458e('0x81')](util[_0x458e('0x6d')](_0x458e('0x82'),_0x17d85d,_0x47424f),_0x180985);_0x1e1746[_0x458e('0x83')](_0x458e('0x84'),_0x458e('0x85')+util[_0x458e('0x6d')](_0x458e('0x86'),_0x17d85d,_0x47424f));_0x1e1746[_0x458e('0x83')](_0x458e('0x87'),_0x458e('0x88'));return _0x1e1746[_0x458e('0x89')](util[_0x458e('0x6d')](_0x458e('0x82'),_0x17d85d,_0x47424f));}else{return _0x1e1746['sendStatus'](0xcc);}});});});};exports[_0x458e('0x8a')]=function(_0x1b239c,_0x479dc9,_0x46e2e5){var _0x1a4447;delete _0x1b239c[_0x458e('0x52')]['id'];return db[_0x458e('0x32')][_0x458e('0x5f')]({'where':{'id':_0x1b239c['params']['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x479dc9,null))[_0x458e('0x29')](function(_0x26739e){if(_0x26739e){return db['sequelize'][_0x458e('0x8b')](function(_0x609ffb){return db[_0x458e('0x6b')][_0x458e('0x51')](_0x1b239c[_0x458e('0x52')],{'transaction':_0x609ffb})[_0x458e('0x29')](function(_0x1ccc64){_0x1a4447=_0x1ccc64;return _0x26739e[_0x458e('0x8c')](_0x1ccc64,{'transaction':_0x609ffb});})[_0x458e('0x29')](function(){var _0x5a78fa={'type':db[_0x458e('0x8d')][_0x458e('0x8e')],'transaction':_0x609ffb};switch(_0x1b239c[_0x458e('0x52')]['type']){case _0x458e('0x8f'):_0x5a78fa[_0x458e('0x45')]=db[_0x458e('0x8d')]['TEXT'];break;case _0x458e('0x90'):_0x5a78fa[_0x458e('0x45')]=db[_0x458e('0x8d')]['INTEGER'];break;case _0x458e('0x91'):_0x5a78fa['type']=db['Sequelize'][_0x458e('0x92')];_0x5a78fa[_0x458e('0x93')]=![];break;default:}return db[_0x458e('0x94')][_0x458e('0x95')][_0x458e('0x96')]('cm_contacts',util['format']('cf_%s',_0x1a4447['id']),_0x5a78fa);})['then'](function(){return _0x1a4447;});});}})['then'](respondWithResult(_0x479dc9,null))[_0x458e('0x4c')](handleError(_0x479dc9,null));};exports[_0x458e('0x97')]=function(_0x58bd94,_0x3be015,_0x3a43e4){var _0x23f20f={};var _0x33e7db={};var _0xf5e166;var _0x100669;return db['CmList']['findOne']({'where':{'id':_0x58bd94[_0x458e('0x4e')]['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x3be015,null))['then'](function(_0x587d70){if(_0x587d70){_0xf5e166=_0x587d70;_0x33e7db[_0x458e('0x39')]=_[_0x458e('0x37')](db[_0x458e('0x6b')][_0x458e('0x33')]);_0x33e7db[_0x458e('0x36')]=_[_0x458e('0x37')](_0x58bd94[_0x458e('0x36')]);_0x33e7db[_0x458e('0x38')]=_[_0x458e('0x4f')](_0x33e7db[_0x458e('0x39')],_0x33e7db['query']);_0x23f20f[_0x458e('0x3b')]=_[_0x458e('0x4f')](_0x33e7db[_0x458e('0x39')],qs[_0x458e('0x3a')](_0x58bd94['query']['fields']));_0x23f20f[_0x458e('0x3b')]=_0x23f20f[_0x458e('0x3b')]['length']?_0x23f20f[_0x458e('0x3b')]:_0x33e7db[_0x458e('0x39')];_0x23f20f[_0x458e('0x3f')]=qs[_0x458e('0x40')](_0x58bd94[_0x458e('0x36')][_0x458e('0x40')]);_0x23f20f['where']=qs[_0x458e('0x38')](_[_0x458e('0x42')](_0x58bd94[_0x458e('0x36')],_0x33e7db[_0x458e('0x38')]));_0x23f20f['where']=_['merge'](_0x23f20f[_0x458e('0x41')],{'$or':[{'ListId':_0x587d70['id']},{'ListId':null}]});if(_0x58bd94[_0x458e('0x36')][_0x458e('0x43')]){_0x23f20f[_0x458e('0x41')]=_['merge'](_0x23f20f['where'],{'$or':_[_0x458e('0x35')](_0x23f20f[_0x458e('0x3b')],function(_0x5b5f14){var _0x5842a6={};_0x5842a6[_0x5b5f14]={'$like':'%'+_0x58bd94[_0x458e('0x36')]['filter']+'%'};return _0x5842a6;})});}_0x23f20f=_['merge']({},_0x23f20f,_0x58bd94['options']);return db[_0x458e('0x6b')]['findAndCountAll'](_0x23f20f);}})[_0x458e('0x29')](respondWithResult(_0x3be015,null))['catch'](handleError(_0x3be015,null));};exports['getGlobalCustomFields']=function(_0x8d5428,_0x46457b){return db[_0x458e('0x6b')][_0x458e('0x98')]({'where':{'ListId':null}})[_0x458e('0x29')](handleEntityNotFound(_0x46457b,null))[_0x458e('0x29')](function(_0x420490){return _0x420490;})[_0x458e('0x29')](respondWithResult(_0x46457b,null))[_0x458e('0x4c')](handleError(_0x46457b,null));};exports[_0x458e('0x99')]=function(_0x2bb25e,_0x4c5360,_0x1fe774){return db['CmList'][_0x458e('0x50')]({'where':{'id':_0x2bb25e[_0x458e('0x4e')]['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x4c5360,null))['then'](function(_0x213c37){if(_0x213c37){return _0x213c37[_0x458e('0x99')](_0x2bb25e[_0x458e('0x52')][_0x458e('0x66')],_['omit'](_0x2bb25e[_0x458e('0x52')],[_0x458e('0x66'),'id'])||{})[_0x458e('0x9a')](function(_0x2bca30){for(var _0x35ada8=0x0;_0x35ada8<_0x2bb25e[_0x458e('0x52')][_0x458e('0x66')][_0x458e('0x3c')];_0x35ada8+=0x1){socket['emit'](_0x458e('0x9b'),{'UserId':Number(_0x2bb25e['body'][_0x458e('0x66')][_0x35ada8]),'CmListId':Number(_0x2bb25e[_0x458e('0x4e')]['id'])});}return _0x2bca30;});}})['then'](respondWithResult(_0x4c5360,null))[_0x458e('0x4c')](handleError(_0x4c5360,null));};exports[_0x458e('0x9c')]=function(_0x44edcd,_0x2f55a3,_0x659f6b){return db['CmList'][_0x458e('0x50')]({'where':{'id':_0x44edcd[_0x458e('0x4e')]['id']}})[_0x458e('0x29')](handleEntityNotFound(_0x2f55a3,null))[_0x458e('0x29')](function(_0x150fd5){if(_0x150fd5){return _0x150fd5[_0x458e('0x9c')](_0x44edcd[_0x458e('0x36')][_0x458e('0x66')])['then'](function(){if(_[_0x458e('0x62')](_0x44edcd[_0x458e('0x36')]['ids'])){for(var _0x50374b=0x0;_0x50374b<_0x44edcd[_0x458e('0x36')][_0x458e('0x66')][_0x458e('0x3c')];_0x50374b+=0x1){socket[_0x458e('0x9d')](_0x458e('0x9e'),{'UserId':Number(_0x44edcd['query'][_0x458e('0x66')][_0x50374b]),'CmListId':Number(_0x44edcd['params']['id'])});}}else{socket[_0x458e('0x9d')]('userCmList:remove',{'UserId':Number(_0x44edcd[_0x458e('0x36')][_0x458e('0x66')]),'CmListId':Number(_0x44edcd[_0x458e('0x4e')]['id'])});}});}})[_0x458e('0x29')](respondWithStatusCode(_0x2f55a3,null))[_0x458e('0x4c')](handleError(_0x2f55a3,null));};exports[_0x458e('0x9f')]=function(_0x44c5a1,_0x232003,_0x3a9f38){var _0x4ca3ad={};var _0x58b02a={};var _0x14f65a;var _0x35c374;return db[_0x458e('0x32')][_0x458e('0x5f')]({'where':{'id':_0x44c5a1[_0x458e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x232003,null))['then'](function(_0xbdb1f2){if(_0xbdb1f2){_0x14f65a=_0xbdb1f2;_0x58b02a['model']=_[_0x458e('0x37')](db[_0x458e('0xa0')][_0x458e('0x33')]);_0x58b02a['query']=_[_0x458e('0x37')](_0x44c5a1[_0x458e('0x36')]);_0x58b02a[_0x458e('0x38')]=_[_0x458e('0x4f')](_0x58b02a[_0x458e('0x39')],_0x58b02a[_0x458e('0x36')]);_0x4ca3ad[_0x458e('0x3b')]=_['intersection'](_0x58b02a[_0x458e('0x39')],qs[_0x458e('0x3a')](_0x44c5a1[_0x458e('0x36')]['fields']));_0x4ca3ad[_0x458e('0x3b')]=_0x4ca3ad[_0x458e('0x3b')][_0x458e('0x3c')]?_0x4ca3ad[_0x458e('0x3b')]:_0x58b02a[_0x458e('0x39')];_0x4ca3ad[_0x458e('0x3f')]=qs['sort'](_0x44c5a1[_0x458e('0x36')]['sort']);_0x4ca3ad['where']=qs['filters'](_['pick'](_0x44c5a1[_0x458e('0x36')],_0x58b02a[_0x458e('0x38')]));if(_0x44c5a1[_0x458e('0x36')][_0x458e('0x43')]){_0x4ca3ad[_0x458e('0x41')]=_[_0x458e('0x44')](_0x4ca3ad[_0x458e('0x41')],{'$or':_[_0x458e('0x35')](_0x4ca3ad[_0x458e('0x3b')],function(_0x3c3c38){var _0x45ab87={};_0x45ab87[_0x3c3c38]={'$like':'%'+_0x44c5a1[_0x458e('0x36')]['filter']+'%'};return _0x45ab87;})});}_0x4ca3ad=_[_0x458e('0x44')]({},_0x4ca3ad,_0x44c5a1[_0x458e('0x47')]);return _0x14f65a[_0x458e('0x9f')](_0x4ca3ad);}})[_0x458e('0x29')](function(_0x2cf1d0){if(_0x2cf1d0){_0x35c374=_0x2cf1d0[_0x458e('0x3c')];if(!_0x44c5a1[_0x458e('0x36')][_0x458e('0x3d')]('nolimit')){_0x4ca3ad[_0x458e('0x21')]=qs[_0x458e('0x21')](_0x44c5a1[_0x458e('0x36')]['limit']);_0x4ca3ad[_0x458e('0x1f')]=qs[_0x458e('0x1f')](_0x44c5a1[_0x458e('0x36')]['offset']);}return _0x14f65a[_0x458e('0x9f')](_0x4ca3ad);}})[_0x458e('0x29')](function(_0x22fa82){if(_0x22fa82){return _0x22fa82?{'count':_0x35c374,'rows':_0x22fa82}:null;}})['then'](respondWithResult(_0x232003,null))[_0x458e('0x4c')](handleError(_0x232003,null));};function handleQuery(_0x24457d){logger['info'](_0x24457d);return db[_0x458e('0x94')][_0x458e('0x36')](_0x24457d)[_0x458e('0x9a')](function(_0x335394){csv_results[_0x458e('0x64')](_0x335394);})['catch'](function(_0x343a4e){logger[_0x458e('0x2d')](_0x343a4e[_0x458e('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b667c88..a68b00b 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(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x55ca,0x126));var _0xa55c=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0x55ca[_0x5a2db8];return _0x28b4f8;};'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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x4fcf10,_0x2db1c9){var _0x474d90=function(_0x2997b7){while(--_0x2997b7){_0x4fcf10['push'](_0x4fcf10['shift']());}};_0x474d90(++_0x2db1c9);}(_0x814b,0x1a2));var _0xb814=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x814b[_0x1f7839];return _0x36b42e;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 8465bdb..6af2226 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x22eca0,_0x5888f5){var _0x39555c=function(_0x345574){while(--_0x345574){_0x22eca0['push'](_0x22eca0['shift']());}};_0x39555c(++_0x5888f5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1d49c9,_0x2315ff){_0x1d49c9=_0x1d49c9-0x0;var _0x145c6c=_0xa8a8[_0x1d49c9];return _0x145c6c;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x5002a5,_0x3712fa){var _0x45a102=function(_0x1ec1aa){while(--_0x1ec1aa){_0x5002a5['push'](_0x5002a5['shift']());}};_0x45a102(++_0x3712fa);}(_0x5ff3,0x17d));var _0x35ff=function(_0x618459,_0x10e276){_0x618459=_0x618459-0x0;var _0x3ef948=_0x5ff3[_0x618459];return _0x3ef948;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 27786fb..591611a 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 _0x7c9a=['request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','register'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x7c9a,0x1d8));var _0xa7c9=function(_0x2226bd,_0x146ba3){_0x2226bd=_0x2226bd-0x0;var _0x569c58=_0x7c9a[_0x2226bd];return _0x569c58;};'use strict';var _=require('lodash');var util=require(_0xa7c9('0x0'));var moment=require('moment');var BPromise=require(_0xa7c9('0x1'));var rs=require(_0xa7c9('0x2'));var fs=require('fs');var Redis=require(_0xa7c9('0x3'));var db=require(_0xa7c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa7c9('0x5'));var config=require(_0xa7c9('0x6'));var jayson=require(_0xa7c9('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa7c9('0x8')]=_[_0xa7c9('0x9')](config[_0xa7c9('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7c9('0x8')]));require('./cmList.socket')[_0xa7c9('0xa')](socket);function respondWithRpcPromise(_0x1d6298,_0x39c0ff,_0x20111b){return new BPromise(function(_0x3b59cf,_0x28f024){return client[_0xa7c9('0xb')](_0x1d6298,_0x20111b)['then'](function(_0x447a3f){logger[_0xa7c9('0xc')](_0xa7c9('0xd'),_0x39c0ff,'request\x20sent');logger[_0xa7c9('0xe')](_0xa7c9('0xf'),_0x39c0ff,_0xa7c9('0x10'),JSON[_0xa7c9('0x11')](_0x447a3f));if(_0x447a3f[_0xa7c9('0x12')]){if(_0x447a3f['error'][_0xa7c9('0x13')]===0x1f4){logger[_0xa7c9('0x12')](_0xa7c9('0xd'),_0x39c0ff,_0x447a3f[_0xa7c9('0x12')][_0xa7c9('0x14')]);return _0x28f024(_0x447a3f[_0xa7c9('0x12')][_0xa7c9('0x14')]);}logger['error'](_0xa7c9('0xd'),_0x39c0ff,_0x447a3f['error'][_0xa7c9('0x14')]);return _0x3b59cf(_0x447a3f[_0xa7c9('0x12')][_0xa7c9('0x14')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x39c0ff,_0xa7c9('0x10'));_0x3b59cf(_0x447a3f[_0xa7c9('0x15')]['message']);}})[_0xa7c9('0x16')](function(_0x3f1a22){logger[_0xa7c9('0x12')](_0xa7c9('0xd'),_0x39c0ff,_0x3f1a22);_0x28f024(_0x3f1a22);});});} \ No newline at end of file +var _0x8401=['request','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./cmList.socket','register'];(function(_0x1e70b4,_0x523e58){var _0x5a039b=function(_0x169661){while(--_0x169661){_0x1e70b4['push'](_0x1e70b4['shift']());}};_0x5a039b(++_0x523e58);}(_0x8401,0x14f));var _0x1840=function(_0x395257,_0x5a4e1a){_0x395257=_0x395257-0x0;var _0x318bb3=_0x8401[_0x395257];return _0x318bb3;};'use strict';var _=require(_0x1840('0x0'));var util=require('util');var moment=require(_0x1840('0x1'));var BPromise=require(_0x1840('0x2'));var rs=require(_0x1840('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1840('0x4'))['db'];var utils=require(_0x1840('0x5'));var logger=require('../../config/logger')(_0x1840('0x6'));var config=require(_0x1840('0x7'));var jayson=require(_0x1840('0x8'));var client=jayson['client'][_0x1840('0x9')]({'port':0x232a});config[_0x1840('0xa')]=_[_0x1840('0xb')](config['redis'],{'host':_0x1840('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1840('0xa')]));require(_0x1840('0xd'))[_0x1840('0xe')](socket);function respondWithRpcPromise(_0x4b9a74,_0xc64ca3,_0x54e56f){return new BPromise(function(_0x447429,_0x1aa5c9){return client[_0x1840('0xf')](_0x4b9a74,_0x54e56f)['then'](function(_0x198428){logger[_0x1840('0x10')]('CmList,\x20%s,\x20%s',_0xc64ca3,_0x1840('0x11'));logger['debug'](_0x1840('0x12'),_0xc64ca3,'request\x20sent',JSON[_0x1840('0x13')](_0x198428));if(_0x198428['error']){if(_0x198428[_0x1840('0x14')]['code']===0x1f4){logger['error'](_0x1840('0x15'),_0xc64ca3,_0x198428[_0x1840('0x14')][_0x1840('0x16')]);return _0x1aa5c9(_0x198428[_0x1840('0x14')][_0x1840('0x16')]);}logger['error'](_0x1840('0x15'),_0xc64ca3,_0x198428[_0x1840('0x14')][_0x1840('0x16')]);return _0x447429(_0x198428[_0x1840('0x14')][_0x1840('0x16')]);}else{logger[_0x1840('0x10')]('CmList,\x20%s,\x20%s',_0xc64ca3,_0x1840('0x11'));_0x447429(_0x198428[_0x1840('0x17')]['message']);}})[_0x1840('0x18')](function(_0x4b5fff){logger[_0x1840('0x14')]('CmList,\x20%s,\x20%s',_0xc64ca3,_0x4b5fff);_0x1aa5c9(_0x4b5fff);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 3f23e76..dfcc863 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 _0xef72=['length','cmList:','./cmList.events','save','remove','removeListener'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xef72,0xf8));var _0x2ef7=function(_0x429928,_0x2ed0eb){_0x429928=_0x429928-0x0;var _0x15a946=_0xef72[_0x429928];return _0x15a946;};'use strict';var CmListEvents=require(_0x2ef7('0x0'));var events=[_0x2ef7('0x1'),_0x2ef7('0x2'),'update'];function createListener(_0x4cbda5,_0x52afb2){return function(_0x3cd266){_0x52afb2['emit'](_0x4cbda5,_0x3cd266);};}function removeListener(_0x1ceba3,_0x473662){return function(){CmListEvents[_0x2ef7('0x3')](_0x1ceba3,_0x473662);};}exports['register']=function(_0x12ce1b){for(var _0x4ff788=0x0,_0x2186f4=events[_0x2ef7('0x4')];_0x4ff788<_0x2186f4;_0x4ff788++){var _0x113d5f=events[_0x4ff788];var _0x46c61c=createListener(_0x2ef7('0x5')+_0x113d5f,_0x12ce1b);CmListEvents['on'](_0x113d5f,_0x46c61c);}}; \ No newline at end of file +var _0x3d9a=['update','register','./cmList.events','save'];(function(_0x2a0496,_0x2dc51d){var _0x47c721=function(_0x29c514){while(--_0x29c514){_0x2a0496['push'](_0x2a0496['shift']());}};_0x47c721(++_0x2dc51d);}(_0x3d9a,0x11a));var _0xa3d9=function(_0x559616,_0x12d004){_0x559616=_0x559616-0x0;var _0x23de49=_0x3d9a[_0x559616];return _0x23de49;};'use strict';var CmListEvents=require(_0xa3d9('0x0'));var events=[_0xa3d9('0x1'),'remove',_0xa3d9('0x2')];function createListener(_0xa3c7be,_0x4ffa52){return function(_0xf8cf74){_0x4ffa52['emit'](_0xa3c7be,_0xf8cf74);};}function removeListener(_0x279c74,_0x6abe2d){return function(){CmListEvents['removeListener'](_0x279c74,_0x6abe2d);};}exports[_0xa3d9('0x3')]=function(_0x20c6de){for(var _0x1238e2=0x0,_0x182d90=events['length'];_0x1238e2<_0x182d90;_0x1238e2++){var _0x1b0534=events[_0x1238e2];var _0x471ccd=createListener('cmList:'+_0x1b0534,_0x20c6de);CmListEvents['on'](_0x1b0534,_0x471ccd);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3898044..d8fa486 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 _0xddee=['index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x585e74,_0xf268ee){var _0x13bba4=function(_0x456793){while(--_0x456793){_0x585e74['push'](_0x585e74['shift']());}};_0x13bba4(++_0xf268ee);}(_0xddee,0x1d2));var _0xedde=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xddee[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xedde('0x0'));var timeout=require(_0xedde('0x1'));var express=require(_0xedde('0x2'));var router=express['Router']();var fs_extra=require(_0xedde('0x3'));var auth=require(_0xedde('0x4'));var interaction=require(_0xedde('0x5'));var config=require(_0xedde('0x6'));var controller=require(_0xedde('0x7'));router[_0xedde('0x8')]('/',auth[_0xedde('0x9')](),controller[_0xedde('0xa')]);router[_0xedde('0x8')](_0xedde('0xb'),auth['isAuthenticated'](),controller[_0xedde('0xc')]);router[_0xedde('0x8')](_0xedde('0xd'),auth[_0xedde('0x9')](),controller[_0xedde('0xe')]);router[_0xedde('0x8')](_0xedde('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xedde('0x8')](_0xedde('0x10'),auth[_0xedde('0x9')](),controller[_0xedde('0x11')]);router['get'](_0xedde('0x12'),auth[_0xedde('0x9')](),controller[_0xedde('0x13')]);router[_0xedde('0x8')](_0xedde('0x14'),auth[_0xedde('0x9')](),controller['getContactsCsv']);router['get'](_0xedde('0x15'),auth['isAuthenticated'](),controller[_0xedde('0x16')]);router[_0xedde('0x8')](_0xedde('0x17'),auth[_0xedde('0x9')](),controller['getAgents']);router[_0xedde('0x18')]('/',auth[_0xedde('0x9')](),controller[_0xedde('0x19')]);router[_0xedde('0x18')](_0xedde('0x10'),auth[_0xedde('0x9')](),controller[_0xedde('0x1a')]);router[_0xedde('0x18')](_0xedde('0x12'),auth['isAuthenticated'](),controller[_0xedde('0x1b')]);router[_0xedde('0x18')](_0xedde('0x15'),auth[_0xedde('0x9')](),controller[_0xedde('0x1c')]);router[_0xedde('0x18')]('/:id/users',auth[_0xedde('0x9')](),controller[_0xedde('0x1d')]);router[_0xedde('0x1e')]('/:id',auth[_0xedde('0x9')](),controller[_0xedde('0x1f')]);router[_0xedde('0x20')]('/:id',auth[_0xedde('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xedde('0x9')](),controller[_0xedde('0x21')]);router[_0xedde('0x20')](_0xedde('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf9f9=['update','destroy','delete','removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','/:id/users','addAgents','put'];(function(_0x3b76dd,_0x2f36fb){var _0x3d06d2=function(_0x253769){while(--_0x253769){_0x3b76dd['push'](_0x3b76dd['shift']());}};_0x3d06d2(++_0x2f36fb);}(_0xf9f9,0x15b));var _0x9f9f=function(_0x28706e,_0x1872a4){_0x28706e=_0x28706e-0x0;var _0x2b6b1f=_0xf9f9[_0x28706e];return _0x2b6b1f;};'use strict';var multer=require(_0x9f9f('0x0'));var util=require('util');var path=require(_0x9f9f('0x1'));var timeout=require(_0x9f9f('0x2'));var express=require(_0x9f9f('0x3'));var router=express['Router']();var fs_extra=require(_0x9f9f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f9f('0x5'));var config=require(_0x9f9f('0x6'));var controller=require(_0x9f9f('0x7'));router[_0x9f9f('0x8')]('/',auth[_0x9f9f('0x9')](),controller[_0x9f9f('0xa')]);router['get'](_0x9f9f('0xb'),auth['isAuthenticated'](),controller[_0x9f9f('0xc')]);router[_0x9f9f('0x8')](_0x9f9f('0xd'),auth['isAuthenticated'](),controller[_0x9f9f('0xe')]);router[_0x9f9f('0x8')](_0x9f9f('0xf'),auth['isAuthenticated'](),controller[_0x9f9f('0x10')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9f9f('0x11')]);router[_0x9f9f('0x8')](_0x9f9f('0x12'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x13')]);router[_0x9f9f('0x8')](_0x9f9f('0x14'),auth['isAuthenticated'](),controller[_0x9f9f('0x15')]);router['get']('/:id/fields',auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x16')]);router[_0x9f9f('0x8')]('/:id/users',auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x17')]);router[_0x9f9f('0x18')]('/',auth[_0x9f9f('0x9')](),controller['create']);router['post'](_0x9f9f('0x19'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x1a')]);router[_0x9f9f('0x18')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9f9f('0x1b')]);router[_0x9f9f('0x18')](_0x9f9f('0x1c'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x1d')]);router['post'](_0x9f9f('0x1e'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x1f')]);router[_0x9f9f('0x20')](_0x9f9f('0xf'),auth['isAuthenticated'](),controller[_0x9f9f('0x21')]);router['delete'](_0x9f9f('0xf'),auth['isAuthenticated'](),controller[_0x9f9f('0x22')]);router[_0x9f9f('0x23')](_0x9f9f('0x19'),auth['isAuthenticated'](),controller[_0x9f9f('0x24')]);router[_0x9f9f('0x23')]('/:id/users',auth[_0x9f9f('0x9')](),controller['removeAgents']);module[_0x9f9f('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c400ea5..5edd397 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 _0xe29d=['sequelize','exports','getDataValue','field','STRING'];(function(_0x39af5e,_0x6333cb){var _0x3d1607=function(_0x3adf20){while(--_0x3adf20){_0x39af5e['push'](_0x39af5e['shift']());}};_0x3d1607(++_0x6333cb);}(_0xe29d,0x109));var _0xde29=function(_0x19a4f1,_0x542729){_0x19a4f1=_0x19a4f1-0x0;var _0x260213=_0xe29d[_0x19a4f1];return _0x260213;};'use strict';var Sequelize=require(_0xde29('0x0'));module[_0xde29('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x306600){return this[_0xde29('0x2')](_0xde29('0x3'));}},'field':{'type':Sequelize[_0xde29('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xde29('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xde29('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x88e6=['field','STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x32b0c5,_0x4d752a){var _0x337bbf=function(_0x2c3960){while(--_0x2c3960){_0x32b0c5['push'](_0x32b0c5['shift']());}};_0x337bbf(++_0x4d752a);}(_0x88e6,0xe8));var _0x688e=function(_0x662cc7,_0xd76915){_0x662cc7=_0x662cc7-0x0;var _0x19351a=_0x88e6[_0x662cc7];return _0x19351a;};'use strict';var Sequelize=require(_0x688e('0x0'));module['exports']={'name':{'type':Sequelize[_0x688e('0x1')],'get':function(_0x5bb8e4){return this[_0x688e('0x2')](_0x688e('0x3'));}},'field':{'type':Sequelize[_0x688e('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x688e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 60de60e..68470b2 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x48d0c4,_0x3fe712){var _0x17a7a8=function(_0x17095e){while(--_0x17095e){_0x48d0c4['push'](_0x48d0c4['shift']());}};_0x17a7a8(++_0x3fe712);}(_0x7a54,0x106));var _0x47a5=function(_0x3aa8ee,_0x13df6d){_0x3aa8ee=_0x3aa8ee-0x0;var _0x59998d=_0x7a54[_0x3aa8ee];return _0x59998d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4c914b,_0x5d3cf4){var _0x57bea3=function(_0x2dd618){while(--_0x2dd618){_0x4c914b['push'](_0x4c914b['shift']());}};_0x57bea3(++_0x5d3cf4);}(_0x7a54,0x106));var _0x47a5=function(_0x37a15e,_0x4f65c2){_0x37a15e=_0x37a15e-0x0;var _0x26dbd8=_0x7a54[_0x37a15e];return _0x26dbd8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 349b258..b427b4b 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 _0x593c=['tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x593c,0xeb));var _0xc593=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x593c[_0x3ad7ad];return _0x225a60;};'use strict';var _=require(_0xc593('0x0'));var util=require(_0xc593('0x1'));var logger=require(_0xc593('0x2'))('api');var moment=require(_0xc593('0x3'));var BPromise=require(_0xc593('0x4'));var rp=require(_0xc593('0x5'));var fs=require('fs');var path=require(_0xc593('0x6'));var rimraf=require(_0xc593('0x7'));var config=require('../../config/environment');var attributes=require(_0xc593('0x8'));module[_0xc593('0x9')]=function(_0x5a7d21,_0x4cad48){return _0x5a7d21[_0xc593('0xa')](_0xc593('0xb'),attributes,{'tableName':_0xc593('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb51f=['bluebird','path','../../config/environment','./condition.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0xb51f,0xff));var _0xfb51=function(_0x26bc36,_0x95e54){_0x26bc36=_0x26bc36-0x0;var _0x173490=_0xb51f[_0x26bc36];return _0x173490;};'use strict';var _=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var logger=require(_0xfb51('0x2'))(_0xfb51('0x3'));var moment=require(_0xfb51('0x4'));var BPromise=require(_0xfb51('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb51('0x6'));var rimraf=require('rimraf');var config=require(_0xfb51('0x7'));var attributes=require(_0xfb51('0x8'));module['exports']=function(_0x135cc6,_0x1cd676){return _0x135cc6[_0xfb51('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 672e064..cd1fb16 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 _0x54ec=['rpc','../../config/environment','client','http','request','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2f40d5,_0x40bf8a){var _0x2057e3=function(_0x4661cc){while(--_0x4661cc){_0x2f40d5['push'](_0x2f40d5['shift']());}};_0x2057e3(++_0x40bf8a);}(_0x54ec,0x1f3));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc54e('0x0'));var util=require('util');var moment=require(_0xc54e('0x1'));var BPromise=require(_0xc54e('0x2'));var rs=require(_0xc54e('0x3'));var fs=require('fs');var Redis=require(_0xc54e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc54e('0x5'));var logger=require(_0xc54e('0x6'))(_0xc54e('0x7'));var config=require(_0xc54e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc54e('0x9')][_0xc54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1cf5,_0x569198,_0x2f7ded){return new BPromise(function(_0x2ae7d3,_0x1c1c33){return client[_0xc54e('0xb')](_0x4e1cf5,_0x2f7ded)['then'](function(_0x5ab0df){logger['info']('Condition,\x20%s,\x20%s',_0x569198,'request\x20sent');logger[_0xc54e('0xc')](_0xc54e('0xd'),_0x569198,_0xc54e('0xe'),JSON[_0xc54e('0xf')](_0x5ab0df));if(_0x5ab0df['error']){if(_0x5ab0df[_0xc54e('0x10')][_0xc54e('0x11')]===0x1f4){logger['error'](_0xc54e('0x12'),_0x569198,_0x5ab0df['error'][_0xc54e('0x13')]);return _0x1c1c33(_0x5ab0df[_0xc54e('0x10')]['message']);}logger[_0xc54e('0x10')](_0xc54e('0x12'),_0x569198,_0x5ab0df['error'][_0xc54e('0x13')]);return _0x2ae7d3(_0x5ab0df[_0xc54e('0x10')][_0xc54e('0x13')]);}else{logger['info'](_0xc54e('0x12'),_0x569198,_0xc54e('0xe'));_0x2ae7d3(_0x5ab0df[_0xc54e('0x14')][_0xc54e('0x13')]);}})[_0xc54e('0x15')](function(_0x32fdcc){logger[_0xc54e('0x10')](_0xc54e('0x12'),_0x569198,_0x32fdcc);_0x1c1c33(_0x32fdcc);});});} \ No newline at end of file +var _0x30e4=['lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4b826e,_0x33b6b){var _0x10e06c=function(_0x842a7b){while(--_0x842a7b){_0x4b826e['push'](_0x4b826e['shift']());}};_0x10e06c(++_0x33b6b);}(_0x30e4,0x8c));var _0x430e=function(_0x33f5ca,_0x494131){_0x33f5ca=_0x33f5ca-0x0;var _0x288835=_0x30e4[_0x33f5ca];return _0x288835;};'use strict';var _=require(_0x430e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x430e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x430e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x430e('0x3'))(_0x430e('0x4'));var config=require(_0x430e('0x5'));var jayson=require(_0x430e('0x6'));var client=jayson[_0x430e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdba3b6,_0x24f335,_0x1fefe8){return new BPromise(function(_0x4d79f7,_0x75e55e){return client[_0x430e('0x8')](_0xdba3b6,_0x1fefe8)[_0x430e('0x9')](function(_0x552c8a){logger[_0x430e('0xa')](_0x430e('0xb'),_0x24f335,_0x430e('0xc'));logger[_0x430e('0xd')](_0x430e('0xe'),_0x24f335,'request\x20sent',JSON[_0x430e('0xf')](_0x552c8a));if(_0x552c8a[_0x430e('0x10')]){if(_0x552c8a[_0x430e('0x10')][_0x430e('0x11')]===0x1f4){logger[_0x430e('0x10')](_0x430e('0xb'),_0x24f335,_0x552c8a[_0x430e('0x10')][_0x430e('0x12')]);return _0x75e55e(_0x552c8a[_0x430e('0x10')][_0x430e('0x12')]);}logger[_0x430e('0x10')](_0x430e('0xb'),_0x24f335,_0x552c8a[_0x430e('0x10')][_0x430e('0x12')]);return _0x4d79f7(_0x552c8a[_0x430e('0x10')][_0x430e('0x12')]);}else{logger[_0x430e('0xa')](_0x430e('0xb'),_0x24f335,_0x430e('0xc'));_0x4d79f7(_0x552c8a['result'][_0x430e('0x12')]);}})[_0x430e('0x13')](function(_0x4584bb){logger[_0x430e('0x10')](_0x430e('0xb'),_0x24f335,_0x4584bb);_0x75e55e(_0x4584bb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index f46dc20..5f6c843 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 _0x7028=['./condition.controller','/:id','update','delete','isAuthenticated','util','connect-timeout','Router','../../components/auth/service'];(function(_0x2656b3,_0x220e83){var _0x565702=function(_0x68ebd3){while(--_0x68ebd3){_0x2656b3['push'](_0x2656b3['shift']());}};_0x565702(++_0x220e83);}(_0x7028,0x11c));var _0x8702=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7028[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require('multer');var util=require(_0x8702('0x0'));var path=require('path');var timeout=require(_0x8702('0x1'));var express=require('express');var router=express[_0x8702('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8702('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8702('0x4'));router['put'](_0x8702('0x5'),auth['isAuthenticated'](),controller[_0x8702('0x6')]);router[_0x8702('0x7')](_0x8702('0x5'),auth[_0x8702('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaab4=['multer','express','Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0xb9a306,_0x48ebcd){var _0x55c163=function(_0x26a8ee){while(--_0x26a8ee){_0xb9a306['push'](_0xb9a306['shift']());}};_0x55c163(++_0x48ebcd);}(_0xaab4,0x75));var _0x4aab=function(_0x27c65a,_0x21f698){_0x27c65a=_0x27c65a-0x0;var _0x466c67=_0xaab4[_0x27c65a];return _0x466c67;};'use strict';var multer=require(_0x4aab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4aab('0x1'));var router=express[_0x4aab('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4aab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4aab('0x4'));var controller=require(_0x4aab('0x5'));router[_0x4aab('0x6')](_0x4aab('0x7'),auth[_0x4aab('0x8')](),controller[_0x4aab('0x9')]);router[_0x4aab('0xa')](_0x4aab('0x7'),auth[_0x4aab('0x8')](),controller[_0x4aab('0xb')]);module[_0x4aab('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 25d7c80..066ec61 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 _0x3b54=['exports','STRING','name','INTEGER','sequelize'];(function(_0x1c453b,_0x34ed85){var _0x40adde=function(_0x425201){while(--_0x425201){_0x1c453b['push'](_0x1c453b['shift']());}};_0x40adde(++_0x34ed85);}(_0x3b54,0x12b));var _0x43b5=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x3b54[_0x3fd275];return _0xe4f14f;};'use strict';var Sequelize=require(_0x43b5('0x0'));module[_0x43b5('0x1')]={'name':{'type':Sequelize[_0x43b5('0x2')],'allowNull':![],'unique':_0x43b5('0x3')},'OrderBy':{'type':Sequelize[_0x43b5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x43b5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc1d8=['STRING','sequelize','exports','name','INTEGER'];(function(_0x164367,_0x2f212e){var _0x3e3e7e=function(_0x42d233){while(--_0x42d233){_0x164367['push'](_0x164367['shift']());}};_0x3e3e7e(++_0x2f212e);}(_0xc1d8,0xec));var _0x8c1d=function(_0x39b604,_0x44fde7){_0x39b604=_0x39b604-0x0;var _0x3fc4bc=_0xc1d8[_0x39b604];return _0x3fc4bc;};'use strict';var Sequelize=require(_0x8c1d('0x0'));module[_0x8c1d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8c1d('0x2')},'OrderBy':{'type':Sequelize[_0x8c1d('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8c1d('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 6708995..2e66bce 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 _0x1a37=['includeAll','include','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x1a37,0xb4));var _0x71a3=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1a37[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){var _0xb9c195=_0x5f33c5[_0x71a3('0x26')]({'plain':!![]});var _0xb0f3aa='ContactItemTypes';return db[_0x71a3('0x27')][_0x71a3('0x25')]({'where':{'type':_0xb0f3aa,'resourceId':_0xb9c195['id']}})['then'](function(){return _0x5f33c5;});})[_0x71a3('0x24')](function(){_0x452bc4['status'](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3b6,_0x211ea8){return function(_0x35b5c7){if(!_0x35b5c7){_0x2fd3b6[_0x71a3('0x18')](0x194);}return _0x35b5c7;};}function handleError(_0x314439,_0x2317ec){_0x2317ec=_0x2317ec||0x1f4;return function(_0x242b85){logger[_0x71a3('0x28')](_0x242b85[_0x71a3('0x29')]);if(_0x242b85[_0x71a3('0x2a')]){delete _0x242b85[_0x71a3('0x2a')];}_0x314439['status'](_0x2317ec)[_0x71a3('0x2b')](_0x242b85);};}exports[_0x71a3('0x2c')]=function(_0x334db0,_0x23ae85){var _0x4a750c={},_0x18a8fe={},_0x216d84={'count':0x0,'rows':[]};var _0x45d13d=_[_0x71a3('0x2d')](db[_0x71a3('0x2e')][_0x71a3('0x2f')],function(_0x1d09bd){return{'name':_0x1d09bd['fieldName'],'type':_0x1d09bd[_0x71a3('0x30')][_0x71a3('0x31')]};});_0x18a8fe[_0x71a3('0x32')]=_[_0x71a3('0x2d')](_0x45d13d,_0x71a3('0x2a'));_0x18a8fe[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x334db0[_0x71a3('0x33')]);_0x18a8fe[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x18a8fe[_0x71a3('0x32')],_0x18a8fe[_0x71a3('0x33')]);_0x4a750c[_0x71a3('0x37')]=_['intersection'](_0x18a8fe['model'],qs[_0x71a3('0x38')](_0x334db0[_0x71a3('0x33')]['fields']));_0x4a750c[_0x71a3('0x37')]=_0x4a750c[_0x71a3('0x37')]['length']?_0x4a750c[_0x71a3('0x37')]:_0x18a8fe[_0x71a3('0x32')];if(!_0x334db0[_0x71a3('0x33')][_0x71a3('0x39')](_0x71a3('0x3a'))){_0x4a750c[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x334db0['query'][_0x71a3('0x1d')]);_0x4a750c[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x334db0['query'][_0x71a3('0x1b')]);}_0x4a750c[_0x71a3('0x3b')]=qs[_0x71a3('0x3c')](_0x334db0[_0x71a3('0x33')][_0x71a3('0x3c')]);_0x4a750c['where']=qs['filters'](_[_0x71a3('0x3d')](_0x334db0[_0x71a3('0x33')],_0x18a8fe[_0x71a3('0x35')]),_0x45d13d);if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]){_0x4a750c['where']=_[_0x71a3('0x3f')](_0x4a750c[_0x71a3('0x40')],{'$or':_[_0x71a3('0x2d')](_0x45d13d,function(_0x58b833){if(_0x58b833[_0x71a3('0x30')]!=='VIRTUAL'){var _0x3edeff={};_0x3edeff[_0x58b833[_0x71a3('0x2a')]]={'$like':'%'+_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]+'%'};return _0x3edeff;}})});}_0x4a750c=_[_0x71a3('0x3f')]({},_0x4a750c,_0x334db0[_0x71a3('0x41')]);var _0x468ca4={'where':_0x4a750c[_0x71a3('0x40')]};return db[_0x71a3('0x2e')][_0x71a3('0x1e')](_0x468ca4)['then'](function(_0xa49846){_0x216d84['count']=_0xa49846;if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x42')]){_0x4a750c[_0x71a3('0x43')]=[{'all':!![]}];}return db[_0x71a3('0x2e')]['findAll'](_0x4a750c);})[_0x71a3('0x24')](function(_0x4b4fde){_0x216d84['rows']=_0x4b4fde;return _0x216d84;})[_0x71a3('0x24')](respondWithFilteredResult(_0x23ae85,_0x4a750c))[_0x71a3('0x44')](handleError(_0x23ae85,null));};exports[_0x71a3('0x45')]=function(_0x1dc34b,_0x519242){var _0x248a04={'raw':!![],'where':{'id':_0x1dc34b[_0x71a3('0x46')]['id']}},_0x615c6f={};_0x615c6f[_0x71a3('0x32')]=_[_0x71a3('0x34')](db[_0x71a3('0x2e')][_0x71a3('0x2f')]);_0x615c6f[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x1dc34b[_0x71a3('0x33')]);_0x615c6f[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x615c6f[_0x71a3('0x32')],_0x615c6f[_0x71a3('0x33')]);_0x248a04[_0x71a3('0x37')]=_[_0x71a3('0x36')](_0x615c6f['model'],qs[_0x71a3('0x38')](_0x1dc34b[_0x71a3('0x33')]['fields']));_0x248a04[_0x71a3('0x37')]=_0x248a04[_0x71a3('0x37')][_0x71a3('0x47')]?_0x248a04[_0x71a3('0x37')]:_0x615c6f[_0x71a3('0x32')];if(_0x1dc34b['query']['includeAll']){_0x248a04[_0x71a3('0x43')]=[{'all':!![]}];}_0x248a04=_[_0x71a3('0x3f')]({},_0x248a04,_0x1dc34b['options']);return db[_0x71a3('0x2e')][_0x71a3('0x48')](_0x248a04)[_0x71a3('0x24')](handleEntityNotFound(_0x519242,null))[_0x71a3('0x24')](respondWithResult(_0x519242,null))[_0x71a3('0x44')](handleError(_0x519242,null));};exports[_0x71a3('0x49')]=function(_0x501a62,_0x1c9ba6){return db['ContactItemType'][_0x71a3('0x49')](_0x501a62[_0x71a3('0x4a')],{})[_0x71a3('0x24')](function(_0x2f3f19){var _0x32e313=_0x501a62['user'][_0x71a3('0x26')]({'plain':!![]});if(!_0x32e313)throw new Error(_0x71a3('0x4b'));if(_0x32e313[_0x71a3('0x4c')]==='user'){var _0x6c34=_0x2f3f19['get']({'plain':!![]});var _0x278e11=_0x71a3('0x4d');return db['UserProfileSection'][_0x71a3('0x48')]({'where':{'name':_0x278e11,'userProfileId':_0x32e313[_0x71a3('0x4e')]},'raw':!![]})[_0x71a3('0x24')](function(_0x384f38){if(_0x384f38&&_0x384f38[_0x71a3('0x4f')]===0x0){return db[_0x71a3('0x27')][_0x71a3('0x49')]({'name':_0x6c34['name'],'resourceId':_0x6c34['id'],'type':_0x384f38[_0x71a3('0x2a')],'sectionId':_0x384f38['id']},{})['then'](function(){return _0x2f3f19;});}else{return _0x2f3f19;}})[_0x71a3('0x44')](function(_0x480e90){logger[_0x71a3('0x28')](_0x71a3('0x50'),_0x480e90);throw _0x480e90;});}return _0x2f3f19;})[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,0xc9))[_0x71a3('0x44')](handleError(_0x1c9ba6,null));};exports['update']=function(_0x54b80f,_0x1e13ae){if(_0x54b80f[_0x71a3('0x4a')]['id']){delete _0x54b80f[_0x71a3('0x4a')]['id'];}return db[_0x71a3('0x2e')]['find']({'where':{'id':_0x54b80f['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1e13ae,null))[_0x71a3('0x24')](saveUpdates(_0x54b80f[_0x71a3('0x4a')],null))[_0x71a3('0x24')](respondWithResult(_0x1e13ae,null))[_0x71a3('0x44')](handleError(_0x1e13ae,null));};exports['destroy']=function(_0x421b6a,_0x3379cb){return db[_0x71a3('0x2e')][_0x71a3('0x48')]({'where':{'id':_0x421b6a[_0x71a3('0x46')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x3379cb,null))[_0x71a3('0x24')](db[_0x71a3('0x51')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x421b6a[_0x71a3('0x46')]['id']}}))[_0x71a3('0x24')](removeEntity(_0x3379cb,null))[_0x71a3('0x44')](handleError(_0x3379cb,null));}; \ No newline at end of file +var _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','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','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x314b41,_0x59661c){var _0x508fbb=function(_0xf6ab0a){while(--_0xf6ab0a){_0x314b41['push'](_0x314b41['shift']());}};_0x508fbb(++_0x59661c);}(_0x6d11,0xbf));var _0x16d1=function(_0x1e5083,_0x7284b0){_0x1e5083=_0x1e5083-0x0;var _0x3312ab=_0x6d11[_0x1e5083];return _0x3312ab;};'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(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0953868..e841ca7 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 _0xae29=['define','ContactItemType','tools_contact_item_types','lodash','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xae29,0xe4));var _0x9ae2=function(_0x22230b,_0x4652e3){_0x22230b=_0x22230b-0x0;var _0x22d304=_0xae29[_0x22230b];return _0x22d304;};'use strict';var _=require(_0x9ae2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ae2('0x1'));var moment=require('moment');var BPromise=require(_0x9ae2('0x2'));var rp=require(_0x9ae2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ae2('0x4'));var attributes=require('./contactItemType.attributes');module[_0x9ae2('0x5')]=function(_0x52f818,_0x56f9a9){return _0x52f818[_0x9ae2('0x6')](_0x9ae2('0x7'),attributes,{'tableName':_0x9ae2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4849=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','moment','path'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x4849,0x1eb));var _0x9484=function(_0x57ef07,_0x190b9a){_0x57ef07=_0x57ef07-0x0;var _0x5d9478=_0x4849[_0x57ef07];return _0x5d9478;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9484('0x3'));var rimraf=require(_0x9484('0x4'));var config=require(_0x9484('0x5'));var attributes=require(_0x9484('0x6'));module[_0x9484('0x7')]=function(_0x1e0e31,_0x45a6d6){return _0x1e0e31[_0x9484('0x8')](_0x9484('0x9'),attributes,{'tableName':_0x9484('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 9133696..23c28bf 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 _0xe07b=['stringify','error','code','message','request\x20sent','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x30ce3f,_0x34ad52){var _0x26bbfd=function(_0x31d2f1){while(--_0x31d2f1){_0x30ce3f['push'](_0x30ce3f['shift']());}};_0x26bbfd(++_0x34ad52);}(_0xe07b,0x181));var _0xbe07=function(_0x383615,_0x58b2a2){_0x383615=_0x383615-0x0;var _0x3de719=_0xe07b[_0x383615];return _0x3de719;};'use strict';var _=require(_0xbe07('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe07('0x1'));var fs=require('fs');var Redis=require(_0xbe07('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe07('0x3'));var logger=require(_0xbe07('0x4'))(_0xbe07('0x5'));var config=require('../../config/environment');var jayson=require(_0xbe07('0x6'));var client=jayson[_0xbe07('0x7')][_0xbe07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dfcfd,_0x4d36cb,_0x4a0969){return new BPromise(function(_0xe2710,_0x35584b){return client[_0xbe07('0x9')](_0x2dfcfd,_0x4a0969)[_0xbe07('0xa')](function(_0x761c75){logger[_0xbe07('0xb')](_0xbe07('0xc'),_0x4d36cb,'request\x20sent');logger['debug'](_0xbe07('0xd'),_0x4d36cb,'request\x20sent',JSON[_0xbe07('0xe')](_0x761c75));if(_0x761c75[_0xbe07('0xf')]){if(_0x761c75[_0xbe07('0xf')][_0xbe07('0x10')]===0x1f4){logger[_0xbe07('0xf')](_0xbe07('0xc'),_0x4d36cb,_0x761c75[_0xbe07('0xf')][_0xbe07('0x11')]);return _0x35584b(_0x761c75[_0xbe07('0xf')]['message']);}logger['error'](_0xbe07('0xc'),_0x4d36cb,_0x761c75[_0xbe07('0xf')]['message']);return _0xe2710(_0x761c75[_0xbe07('0xf')]['message']);}else{logger[_0xbe07('0xb')](_0xbe07('0xc'),_0x4d36cb,_0xbe07('0x12'));_0xe2710(_0x761c75[_0xbe07('0x13')][_0xbe07('0x11')]);}})[_0xbe07('0x14')](function(_0x2d56d2){logger['error'](_0xbe07('0xc'),_0x4d36cb,_0x2d56d2);_0x35584b(_0x2d56d2);});});} \ No newline at end of file +var _0x8c5c=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x91ec40,_0xa1ec3b){var _0x428c7a=function(_0x196f25){while(--_0x196f25){_0x91ec40['push'](_0x91ec40['shift']());}};_0x428c7a(++_0xa1ec3b);}(_0x8c5c,0x7f));var _0xc8c5=function(_0x47e615,_0x571378){_0x47e615=_0x47e615-0x0;var _0x1ba6cd=_0x8c5c[_0x47e615];return _0x1ba6cd;};'use strict';var _=require('lodash');var util=require(_0xc8c5('0x0'));var moment=require('moment');var BPromise=require(_0xc8c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8c5('0x2'));var db=require(_0xc8c5('0x3'))['db'];var utils=require(_0xc8c5('0x4'));var logger=require('../../config/logger')(_0xc8c5('0x5'));var config=require(_0xc8c5('0x6'));var jayson=require(_0xc8c5('0x7'));var client=jayson[_0xc8c5('0x8')][_0xc8c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25daf8,_0x177997,_0x4bb69f){return new BPromise(function(_0x811e50,_0x202481){return client[_0xc8c5('0xa')](_0x25daf8,_0x4bb69f)[_0xc8c5('0xb')](function(_0x53e806){logger[_0xc8c5('0xc')](_0xc8c5('0xd'),_0x177997,_0xc8c5('0xe'));logger[_0xc8c5('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x177997,_0xc8c5('0xe'),JSON['stringify'](_0x53e806));if(_0x53e806[_0xc8c5('0x10')]){if(_0x53e806[_0xc8c5('0x10')][_0xc8c5('0x11')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x177997,_0x53e806[_0xc8c5('0x10')][_0xc8c5('0x12')]);return _0x202481(_0x53e806[_0xc8c5('0x10')][_0xc8c5('0x12')]);}logger[_0xc8c5('0x10')](_0xc8c5('0xd'),_0x177997,_0x53e806[_0xc8c5('0x10')][_0xc8c5('0x12')]);return _0x811e50(_0x53e806['error'][_0xc8c5('0x12')]);}else{logger['info'](_0xc8c5('0xd'),_0x177997,_0xc8c5('0xe'));_0x811e50(_0x53e806[_0xc8c5('0x13')][_0xc8c5('0x12')]);}})['catch'](function(_0x2aab9b){logger[_0xc8c5('0x10')](_0xc8c5('0xd'),_0x177997,_0x2aab9b);_0x202481(_0x2aab9b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 1e0410a..7e819e0 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 _0x9fe7=['delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','post','create','put','/:id','update'];(function(_0x2cd57,_0x14549f){var _0x39d8a6=function(_0x269346){while(--_0x269346){_0x2cd57['push'](_0x2cd57['shift']());}};_0x39d8a6(++_0x14549f);}(_0x9fe7,0xd4));var _0x79fe=function(_0x131c46,_0x152662){_0x131c46=_0x131c46-0x0;var _0x1664bc=_0x9fe7[_0x131c46];return _0x1664bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79fe('0x0'));var timeout=require('connect-timeout');var express=require(_0x79fe('0x1'));var router=express[_0x79fe('0x2')]();var fs_extra=require(_0x79fe('0x3'));var auth=require(_0x79fe('0x4'));var interaction=require(_0x79fe('0x5'));var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')]('/:id',auth[_0x79fe('0xa')](),controller['show']);router[_0x79fe('0xb')]('/',auth[_0x79fe('0xa')](),controller[_0x79fe('0xc')]);router[_0x79fe('0xd')](_0x79fe('0xe'),auth[_0x79fe('0xa')](),controller[_0x79fe('0xf')]);router[_0x79fe('0x10')]('/:id',auth[_0x79fe('0xa')](),controller[_0x79fe('0x11')]);module[_0x79fe('0x12')]=router; \ No newline at end of file +var _0xfd3d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0xfd3d,0x107));var _0xdfd3=function(_0x5dfbfd,_0x1acb7e){_0x5dfbfd=_0x5dfbfd-0x0;var _0x4e8712=_0xfd3d[_0x5dfbfd];return _0x4e8712;};'use strict';var multer=require(_0xdfd3('0x0'));var util=require(_0xdfd3('0x1'));var path=require(_0xdfd3('0x2'));var timeout=require(_0xdfd3('0x3'));var express=require(_0xdfd3('0x4'));var router=express[_0xdfd3('0x5')]();var fs_extra=require(_0xdfd3('0x6'));var auth=require(_0xdfd3('0x7'));var interaction=require(_0xdfd3('0x8'));var config=require(_0xdfd3('0x9'));var controller=require(_0xdfd3('0xa'));router[_0xdfd3('0xb')]('/',auth[_0xdfd3('0xc')](),controller['index']);router['get']('/:id',auth[_0xdfd3('0xc')](),controller[_0xdfd3('0xd')]);router[_0xdfd3('0xe')]('/',auth[_0xdfd3('0xc')](),controller[_0xdfd3('0xf')]);router[_0xdfd3('0x10')](_0xdfd3('0x11'),auth[_0xdfd3('0xc')](),controller[_0xdfd3('0x12')]);router[_0xdfd3('0x13')](_0xdfd3('0x11'),auth['isAuthenticated'](),controller[_0xdfd3('0x14')]);module[_0xdfd3('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d72f7af..0990714 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 _0x0713=['STRING','name'];(function(_0x2a7a2b,_0x4790d9){var _0x3565ff=function(_0x36e6ae){while(--_0x36e6ae){_0x2a7a2b['push'](_0x2a7a2b['shift']());}};_0x3565ff(++_0x4790d9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x520f3e,_0x20c207){var _0x121914=function(_0x190a90){while(--_0x190a90){_0x520f3e['push'](_0x520f3e['shift']());}};_0x121914(++_0x20c207);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c4e2f90..9338df8 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 _0x20b8=['attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','get','CustomDashboards','destroy','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','findAll','rows','catch','show','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone'];(function(_0x488995,_0x17e672){var _0x5c07fd=function(_0x32bf4b){while(--_0x32bf4b){_0x488995['push'](_0x488995['shift']());}};_0x5c07fd(++_0x17e672);}(_0x20b8,0x9b));var _0x820b=function(_0x350dc7,_0x100ced){_0x350dc7=_0x350dc7-0x0;var _0x1f753e=_0x20b8[_0x350dc7];return _0x1f753e;};'use strict';var emlformat=require(_0x820b('0x0'));var rimraf=require(_0x820b('0x1'));var zipdir=require(_0x820b('0x2'));var jsonpatch=require(_0x820b('0x3'));var rp=require(_0x820b('0x4'));var moment=require(_0x820b('0x5'));var BPromise=require(_0x820b('0x6'));var Mustache=require(_0x820b('0x7'));var util=require(_0x820b('0x8'));var path=require(_0x820b('0x9'));var sox=require(_0x820b('0xa'));var csv=require(_0x820b('0xb'));var ejs=require(_0x820b('0xc'));var fs=require('fs');var fs_extra=require(_0x820b('0xd'));var _=require(_0x820b('0xe'));var squel=require('squel');var crypto=require(_0x820b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x820b('0x10'));var toCsv=require(_0x820b('0xb'));var querystring=require('querystring');var Papa=require(_0x820b('0x11'));var Redis=require(_0x820b('0x12'));var authService=require(_0x820b('0x13'));var qs=require(_0x820b('0x14'));var as=require(_0x820b('0x15'));var hardwareService=require(_0x820b('0x16'));var logger=require(_0x820b('0x17'))(_0x820b('0x18'));var utils=require(_0x820b('0x19'));var config=require(_0x820b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x820b('0x1b'))['db'];config[_0x820b('0x1c')]=_[_0x820b('0x1d')](config[_0x820b('0x1c')],{'host':_0x820b('0x1e'),'port':0x18eb});var socket=require(_0x820b('0x1f'))(new Redis(config[_0x820b('0x1c')]));require('./dashboard.socket')[_0x820b('0x20')](socket);function respondWithStatusCode(_0x542263,_0x3603b0){_0x3603b0=_0x3603b0||0xcc;return function(_0x3dc3ff){if(_0x3dc3ff){return _0x542263[_0x820b('0x21')](_0x3603b0);}return _0x542263[_0x820b('0x22')](_0x3603b0)[_0x820b('0x23')]();};}function respondWithResult(_0x1d0ed7,_0x2773f0){_0x2773f0=_0x2773f0||0xc8;return function(_0x1e6781){if(_0x1e6781){return _0x1d0ed7[_0x820b('0x22')](_0x2773f0)[_0x820b('0x24')](_0x1e6781);}};}function respondWithFilteredResult(_0x30427d,_0x16504c){return function(_0x8c2efc){if(_0x8c2efc){var _0x1319b6=typeof _0x16504c['offset']==='undefined'&&typeof _0x16504c['limit']===_0x820b('0x25');var _0x51b543=_0x8c2efc[_0x820b('0x26')];var _0x194953=_0x1319b6?0x0:_0x16504c[_0x820b('0x27')];var _0x59d815=_0x1319b6?_0x8c2efc[_0x820b('0x26')]:_0x16504c['offset']+_0x16504c[_0x820b('0x28')];var _0x54362f;if(_0x59d815>=_0x51b543){_0x59d815=_0x51b543;_0x54362f=0xc8;}else{_0x54362f=0xce;}_0x30427d[_0x820b('0x22')](_0x54362f);return _0x30427d[_0x820b('0x29')](_0x820b('0x2a'),_0x194953+'-'+_0x59d815+'/'+_0x51b543)[_0x820b('0x24')](_0x8c2efc);}return null;};}function patchUpdates(_0x3b3d3b){return function(_0x457fd5){try{jsonpatch['apply'](_0x457fd5,_0x3b3d3b,!![]);}catch(_0x52a203){return BPromise[_0x820b('0x2b')](_0x52a203);}return _0x457fd5['save']();};}function saveUpdates(_0x342542,_0x3ac2a7){return function(_0x1a8a2f){if(_0x1a8a2f){return _0x1a8a2f[_0x820b('0x2c')](_0x342542)[_0x820b('0x2d')](function(_0x549b29){return _0x549b29;});}return null;};}function removeEntity(_0x1696cf,_0x1fe953){return function(_0x419eeb){if(_0x419eeb){return _0x419eeb['destroy']()[_0x820b('0x2d')](function(){var _0x1ffec7=_0x419eeb[_0x820b('0x2e')]({'plain':!![]});var _0x1bed5d=_0x820b('0x2f');return db['UserProfileResource'][_0x820b('0x30')]({'where':{'type':_0x1bed5d,'resourceId':_0x1ffec7['id']}})[_0x820b('0x2d')](function(){return _0x419eeb;});})[_0x820b('0x2d')](function(){_0x1696cf[_0x820b('0x22')](0xcc)[_0x820b('0x23')]();});}};}function handleEntityNotFound(_0x46f948,_0x26a5b3){return function(_0x5265a7){if(!_0x5265a7){_0x46f948[_0x820b('0x21')](0x194);}return _0x5265a7;};}function handleError(_0x3dfce9,_0x579996){_0x579996=_0x579996||0x1f4;return function(_0xf29200){logger['error'](_0xf29200[_0x820b('0x31')]);if(_0xf29200[_0x820b('0x32')]){delete _0xf29200[_0x820b('0x32')];}_0x3dfce9[_0x820b('0x22')](_0x579996)['send'](_0xf29200);};}exports['index']=function(_0x5ebc9d,_0x3b56ec){var _0x559a98={},_0x10cae3={},_0x39b150={'count':0x0,'rows':[]};var _0x339471=_[_0x820b('0x33')](db[_0x820b('0x34')][_0x820b('0x35')],function(_0x457f91){return{'name':_0x457f91[_0x820b('0x36')],'type':_0x457f91[_0x820b('0x37')][_0x820b('0x38')]};});_0x10cae3[_0x820b('0x39')]=_[_0x820b('0x33')](_0x339471,_0x820b('0x32'));_0x10cae3[_0x820b('0x3a')]=_[_0x820b('0x3b')](_0x5ebc9d[_0x820b('0x3a')]);_0x10cae3[_0x820b('0x3c')]=_['intersection'](_0x10cae3['model'],_0x10cae3[_0x820b('0x3a')]);_0x559a98[_0x820b('0x3d')]=_[_0x820b('0x3e')](_0x10cae3[_0x820b('0x39')],qs[_0x820b('0x3f')](_0x5ebc9d[_0x820b('0x3a')][_0x820b('0x3f')]));_0x559a98[_0x820b('0x3d')]=_0x559a98[_0x820b('0x3d')][_0x820b('0x40')]?_0x559a98[_0x820b('0x3d')]:_0x10cae3['model'];if(!_0x5ebc9d[_0x820b('0x3a')][_0x820b('0x41')](_0x820b('0x42'))){_0x559a98[_0x820b('0x28')]=qs[_0x820b('0x28')](_0x5ebc9d[_0x820b('0x3a')][_0x820b('0x28')]);_0x559a98[_0x820b('0x27')]=qs[_0x820b('0x27')](_0x5ebc9d['query']['offset']);}_0x559a98[_0x820b('0x43')]=qs[_0x820b('0x44')](_0x5ebc9d[_0x820b('0x3a')]['sort']);_0x559a98['where']=qs[_0x820b('0x3c')](_[_0x820b('0x45')](_0x5ebc9d[_0x820b('0x3a')],_0x10cae3['filters']),_0x339471);if(_0x5ebc9d['query']['filter']){_0x559a98['where']=_['merge'](_0x559a98[_0x820b('0x46')],{'$or':_[_0x820b('0x33')](_0x339471,function(_0x424367){if(_0x424367[_0x820b('0x37')]!=='VIRTUAL'){var _0x18e190={};_0x18e190[_0x424367[_0x820b('0x32')]]={'$like':'%'+_0x5ebc9d['query'][_0x820b('0x47')]+'%'};return _0x18e190;}})});}_0x559a98=_[_0x820b('0x48')]({},_0x559a98,_0x5ebc9d[_0x820b('0x49')]);var _0x11a6d8={'where':_0x559a98[_0x820b('0x46')]};return db['Dashboard']['count'](_0x11a6d8)['then'](function(_0x1ecc71){_0x39b150[_0x820b('0x26')]=_0x1ecc71;if(_0x5ebc9d[_0x820b('0x3a')]['includeAll']){_0x559a98['include']=[{'all':!![]}];}return db[_0x820b('0x34')][_0x820b('0x4a')](_0x559a98);})[_0x820b('0x2d')](function(_0x58f7c8){_0x39b150[_0x820b('0x4b')]=_0x58f7c8;return _0x39b150;})['then'](respondWithFilteredResult(_0x3b56ec,_0x559a98))[_0x820b('0x4c')](handleError(_0x3b56ec,null));};exports[_0x820b('0x4d')]=function(_0x5128ce,_0x278031){var _0xe5c611={'raw':![],'where':{'id':_0x5128ce['params']['id']}},_0x5a5460={};_0x5a5460[_0x820b('0x39')]=_[_0x820b('0x3b')](db[_0x820b('0x34')]['rawAttributes']);_0x5a5460[_0x820b('0x3a')]=_['keys'](_0x5128ce[_0x820b('0x3a')]);_0x5a5460[_0x820b('0x3c')]=_[_0x820b('0x3e')](_0x5a5460['model'],_0x5a5460[_0x820b('0x3a')]);_0xe5c611[_0x820b('0x3d')]=_[_0x820b('0x3e')](_0x5a5460['model'],qs['fields'](_0x5128ce[_0x820b('0x3a')][_0x820b('0x3f')]));_0xe5c611[_0x820b('0x3d')]=_0xe5c611[_0x820b('0x3d')][_0x820b('0x40')]?_0xe5c611[_0x820b('0x3d')]:_0x5a5460['model'];if(_0x5128ce[_0x820b('0x3a')][_0x820b('0x4e')]){_0xe5c611[_0x820b('0x4f')]=[{'all':!![]}];}_0xe5c611=_[_0x820b('0x48')]({},_0xe5c611,_0x5128ce['options']);return db[_0x820b('0x34')]['find'](_0xe5c611)[_0x820b('0x2d')](handleEntityNotFound(_0x278031,null))[_0x820b('0x2d')](respondWithResult(_0x278031,null))[_0x820b('0x4c')](handleError(_0x278031,null));};exports['create']=function(_0x310cfc,_0x1a14b3){return db[_0x820b('0x34')][_0x820b('0x50')](_0x310cfc[_0x820b('0x51')],{})['then'](function(_0x22605f){var _0x50de38=_0x310cfc[_0x820b('0x52')][_0x820b('0x2e')]({'plain':!![]});if(!_0x50de38)throw new Error(_0x820b('0x53'));if(_0x50de38[_0x820b('0x54')]===_0x820b('0x52')){var _0x33391b=_0x22605f['get']({'plain':!![]});var _0x2aae74=_0x820b('0x2f');return db[_0x820b('0x55')][_0x820b('0x56')]({'where':{'name':_0x2aae74,'userProfileId':_0x50de38[_0x820b('0x57')]},'raw':!![]})[_0x820b('0x2d')](function(_0x40b9af){if(_0x40b9af&&_0x40b9af[_0x820b('0x58')]===0x0){return db[_0x820b('0x59')][_0x820b('0x50')]({'name':_0x33391b[_0x820b('0x32')],'resourceId':_0x33391b['id'],'type':_0x40b9af[_0x820b('0x32')],'sectionId':_0x40b9af['id']},{})[_0x820b('0x2d')](function(){return _0x22605f;});}else{return _0x22605f;}})[_0x820b('0x4c')](function(_0xedd7b2){logger[_0x820b('0x5a')](_0x820b('0x5b'),_0xedd7b2);throw _0xedd7b2;});}return _0x22605f;})[_0x820b('0x2d')](respondWithResult(_0x1a14b3,0xc9))[_0x820b('0x4c')](handleError(_0x1a14b3,null));};exports[_0x820b('0x5c')]=function(_0x5f7008,_0x546d10){var _0x4c9697={'where':{'id':_0x5f7008[_0x820b('0x5d')]['id']}},_0x4bc922={};_0x4bc922[_0x820b('0x39')]=_[_0x820b('0x3b')](db[_0x820b('0x34')][_0x820b('0x35')]);_0x4c9697[_0x820b('0x3d')]=_[_0x820b('0x3e')](_0x4bc922[_0x820b('0x39')],qs[_0x820b('0x3f')](_0x5f7008['query'][_0x820b('0x3f')]));_0x4c9697[_0x820b('0x3d')]=_0x4c9697[_0x820b('0x3d')][_0x820b('0x40')]?_0x4c9697[_0x820b('0x3d')]:_0x4bc922[_0x820b('0x39')];if(_0x5f7008[_0x820b('0x3a')][_0x820b('0x4e')]){_0x4c9697['include']=[{'all':!![]}];}_0x4c9697=_[_0x820b('0x48')]({},_0x4c9697,_0x5f7008[_0x820b('0x49')]);return db[_0x820b('0x34')][_0x820b('0x56')](_0x4c9697)[_0x820b('0x2d')](handleEntityNotFound(_0x546d10,null))[_0x820b('0x2d')](function(_0x3818ec){if(_0x3818ec){var _0x45893a=_0x3818ec[_0x820b('0x2e')]({'plain':!![]});_0x45893a=qs['omit'](_0x45893a,['id',_0x820b('0x5e'),'updatedAt']);_0x5f7008[_0x820b('0x51')]=_['omit'](_0x5f7008[_0x820b('0x51')],['id','createdAt',_0x820b('0x5f')]);return db[_0x820b('0x34')]['create'](_[_0x820b('0x48')](_0x45893a,_0x5f7008[_0x820b('0x51')]),{'include':_0x5f7008[_0x820b('0x3a')][_0x820b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x292c90){var _0x47f647=_0x5f7008[_0x820b('0x52')]['get']({'plain':!![]});if(!_0x47f647)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47f647[_0x820b('0x54')]===_0x820b('0x52')){var _0x31f5fa=_0x292c90[_0x820b('0x2e')]({'plain':!![]});var _0x200072=_0x820b('0x2f');return db[_0x820b('0x55')][_0x820b('0x56')]({'where':{'name':_0x200072,'userProfileId':_0x47f647[_0x820b('0x57')]},'raw':!![]})['then'](function(_0x135126){if(_0x135126&&_0x135126['autoAssociation']===0x0){return db[_0x820b('0x59')][_0x820b('0x50')]({'name':_0x31f5fa[_0x820b('0x32')],'resourceId':_0x31f5fa['id'],'type':_0x135126[_0x820b('0x32')],'sectionId':_0x135126['id']},{})[_0x820b('0x2d')](function(){return _0x292c90;});}else{return _0x292c90;}})['catch'](function(_0x456246){logger[_0x820b('0x5a')](_0x820b('0x5b'),_0x456246);throw _0x456246;});}return _0x292c90;});}})[_0x820b('0x2d')](respondWithResult(_0x546d10,0xc9))[_0x820b('0x4c')](handleError(_0x546d10,null));};exports['update']=function(_0x358c28,_0x7adf55){if(_0x358c28[_0x820b('0x51')]['id']){delete _0x358c28[_0x820b('0x51')]['id'];}return db[_0x820b('0x34')][_0x820b('0x56')]({'where':{'id':_0x358c28[_0x820b('0x5d')]['id']}})[_0x820b('0x2d')](handleEntityNotFound(_0x7adf55,null))[_0x820b('0x2d')](saveUpdates(_0x358c28[_0x820b('0x51')],null))[_0x820b('0x2d')](respondWithResult(_0x7adf55,null))[_0x820b('0x4c')](handleError(_0x7adf55,null));};exports['destroy']=function(_0x3b3050,_0x57b06b){return db[_0x820b('0x34')][_0x820b('0x56')]({'where':{'id':_0x3b3050['params']['id']}})[_0x820b('0x2d')](handleEntityNotFound(_0x57b06b,null))[_0x820b('0x2d')](removeEntity(_0x57b06b,null))[_0x820b('0x4c')](handleError(_0x57b06b,null));};function widgetAttributes(_0x1f22ce){try{switch(_0x1f22ce[_0x820b('0x37')]){case'iframe':return[{'name':_0x820b('0x60'),'value':_0x1f22ce[_0x820b('0x60')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x0]?_0x1f22ce[_0x820b('0x61')][0x0][_0x820b('0x62')]:undefined)||_0x820b('0x63')}];case'custom':return[{'name':_0x820b('0x64'),'value':_0x1f22ce['attrPath']||(_0x1f22ce['attrs']&&_0x1f22ce['attrs'][0x0]?_0x1f22ce[_0x820b('0x61')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x820b('0x65'),'value':_0x1f22ce[_0x820b('0x65')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x0]?_0x1f22ce['attrs'][0x0][_0x820b('0x62')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1f22ce[_0x820b('0x66')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x1]?_0x1f22ce[_0x820b('0x61')][0x1]['value']:undefined)||'0.00'},{'name':_0x820b('0x67'),'value':_0x1f22ce['attrFontSize']||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x2]?_0x1f22ce[_0x820b('0x61')][0x2][_0x820b('0x62')]:undefined)||0xc}];case _0x820b('0x68'):return[{'name':_0x820b('0x69'),'value':_0x1f22ce[_0x820b('0x69')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x0]?_0x1f22ce['attrs'][0x0][_0x820b('0x62')]:undefined)||_0x820b('0x6a')},{'name':_0x820b('0x6b'),'value':_0x1f22ce[_0x820b('0x6b')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce['attrs'][0x1]?_0x1f22ce['attrs'][0x1][_0x820b('0x62')]:undefined)||[]},{'name':_0x820b('0x67'),'value':_0x1f22ce[_0x820b('0x67')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x2]?_0x1f22ce[_0x820b('0x61')][0x2][_0x820b('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0x1f22ce['attrChannel']||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x3]?_0x1f22ce['attrs'][0x3][_0x820b('0x62')]:undefined)||_0x820b('0x6c')},{'name':_0x820b('0x6d'),'value':_0x1f22ce[_0x820b('0x6d')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x4]?_0x1f22ce['attrs'][0x4][_0x820b('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1f22ce[_0x820b('0x6e')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x5]?_0x1f22ce[_0x820b('0x61')][0x5][_0x820b('0x62')]:undefined)||''},{'name':_0x820b('0x6f'),'value':_0x1f22ce['attrSmsAccounts']||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x6]?_0x1f22ce[_0x820b('0x61')][0x6][_0x820b('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1f22ce['attrOpenchannelAccounts']||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x7]?_0x1f22ce[_0x820b('0x61')][0x7][_0x820b('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1f22ce[_0x820b('0x70')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce['attrs'][0x8]?_0x1f22ce['attrs'][0x8]['value']:undefined)||''},{'name':_0x820b('0x71'),'value':_0x1f22ce[_0x820b('0x71')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x9]?_0x1f22ce[_0x820b('0x61')][0x9][_0x820b('0x62')]:undefined)||''}];case _0x820b('0x72'):case'pie-chart':return[{'name':_0x820b('0x73'),'value':_0x1f22ce[_0x820b('0x73')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce['attrs'][0x0]?_0x1f22ce[_0x820b('0x61')][0x0][_0x820b('0x62')]:undefined)||_0x820b('0x6a')},{'name':'attrSerie2','value':_0x1f22ce[_0x820b('0x74')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x1]?_0x1f22ce['attrs'][0x1]['value']:undefined)||null},{'name':_0x820b('0x75'),'value':_0x1f22ce[_0x820b('0x75')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce['attrs'][0x2]?_0x1f22ce[_0x820b('0x61')][0x2][_0x820b('0x62')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1f22ce['attrVoiceQueues']||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x3]?_0x1f22ce[_0x820b('0x61')][0x3]['value']:undefined)||[]},{'name':_0x820b('0x76'),'value':_0x1f22ce[_0x820b('0x76')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x4]?_0x1f22ce[_0x820b('0x61')][0x4][_0x820b('0x62')]:undefined)||'voice'},{'name':_0x820b('0x6d'),'value':_0x1f22ce[_0x820b('0x6d')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x5]?_0x1f22ce['attrs'][0x5][_0x820b('0x62')]:undefined)||''},{'name':_0x820b('0x6e'),'value':_0x1f22ce[_0x820b('0x6e')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x6]?_0x1f22ce[_0x820b('0x61')][0x6][_0x820b('0x62')]:undefined)||''},{'name':_0x820b('0x6f'),'value':_0x1f22ce[_0x820b('0x6f')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x7]?_0x1f22ce['attrs'][0x7][_0x820b('0x62')]:undefined)||''},{'name':_0x820b('0x77'),'value':_0x1f22ce[_0x820b('0x77')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x8]?_0x1f22ce[_0x820b('0x61')][0x8]['value']:undefined)||''},{'name':_0x820b('0x70'),'value':_0x1f22ce[_0x820b('0x70')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x9]?_0x1f22ce['attrs'][0x9][_0x820b('0x62')]:undefined)||''},{'name':_0x820b('0x71'),'value':_0x1f22ce[_0x820b('0x71')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0xa]?_0x1f22ce['attrs'][0xa][_0x820b('0x62')]:undefined)||''}];case _0x820b('0x78'):return[{'name':_0x820b('0x79'),'type':_0x1f22ce[_0x820b('0x7a')]||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x0]?_0x1f22ce['attrs'][0x0][_0x820b('0x37')]:undefined)||null,'value':_0x1f22ce[_0x820b('0x79')]||(_0x1f22ce['attrs']&&_0x1f22ce[_0x820b('0x61')][0x0]?_0x1f22ce[_0x820b('0x61')][0x0][_0x820b('0x62')]:undefined)||null},{'name':_0x820b('0x7b'),'value':_0x1f22ce['attrRefresh']||(_0x1f22ce[_0x820b('0x61')]&&_0x1f22ce[_0x820b('0x61')][0x1]?_0x1f22ce[_0x820b('0x61')][0x1][_0x820b('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x120b07){logger[_0x820b('0x5a')](_0x820b('0x7c'),JSON[_0x820b('0x7d')](_0x120b07));return[];}}exports[_0x820b('0x7e')]=function(_0x1ff972,_0x1892aa,_0x5161af){if(_0x1ff972['body']['id']){delete _0x1ff972[_0x820b('0x51')]['id'];}return db[_0x820b('0x34')][_0x820b('0x56')]({'where':{'id':_0x1ff972[_0x820b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1892aa,null))['then'](function(_0x52d12a){if(_0x52d12a){_0x1ff972[_0x820b('0x51')][_0x820b('0x7f')]=_0x52d12a['id'];_0x1ff972[_0x820b('0x51')]['attrs']=widgetAttributes(_0x1ff972[_0x820b('0x51')]);return db['DashboardItem'][_0x820b('0x50')](_0x1ff972[_0x820b('0x51')]);}})[_0x820b('0x2d')](respondWithResult(_0x1892aa,null))[_0x820b('0x4c')](handleError(_0x1892aa,null));};exports[_0x820b('0x80')]=function(_0x5da0e2,_0x22a520,_0x4d9832){var _0x501ac1={};var _0xa5ea75={};var _0x22f3eb;var _0x2fc96e;return db[_0x820b('0x34')]['findOne']({'where':{'id':_0x5da0e2[_0x820b('0x5d')]['id']}})[_0x820b('0x2d')](handleEntityNotFound(_0x22a520,null))[_0x820b('0x2d')](function(_0x21078b){if(_0x21078b){_0x22f3eb=_0x21078b;_0xa5ea75[_0x820b('0x39')]=_[_0x820b('0x3b')](db['DashboardItem'][_0x820b('0x35')]);_0xa5ea75[_0x820b('0x3a')]=_[_0x820b('0x3b')](_0x5da0e2[_0x820b('0x3a')]);_0xa5ea75['filters']=_[_0x820b('0x3e')](_0xa5ea75[_0x820b('0x39')],_0xa5ea75[_0x820b('0x3a')]);_0x501ac1[_0x820b('0x3d')]=_['intersection'](_0xa5ea75[_0x820b('0x39')],qs[_0x820b('0x3f')](_0x5da0e2[_0x820b('0x3a')][_0x820b('0x3f')]));_0x501ac1['attributes']=_0x501ac1[_0x820b('0x3d')][_0x820b('0x40')]?_0x501ac1['attributes']:_0xa5ea75[_0x820b('0x39')];_0x501ac1[_0x820b('0x43')]=qs[_0x820b('0x44')](_0x5da0e2['query'][_0x820b('0x44')]);_0x501ac1[_0x820b('0x46')]=qs[_0x820b('0x3c')](_[_0x820b('0x45')](_0x5da0e2[_0x820b('0x3a')],_0xa5ea75[_0x820b('0x3c')]));if(_0x5da0e2[_0x820b('0x3a')][_0x820b('0x47')]){_0x501ac1[_0x820b('0x46')]=_[_0x820b('0x48')](_0x501ac1[_0x820b('0x46')],{'$or':_[_0x820b('0x33')](_0x501ac1[_0x820b('0x3d')],function(_0x157a26){var _0x3316d1={};_0x3316d1[_0x157a26]={'$like':'%'+_0x5da0e2['query'][_0x820b('0x47')]+'%'};return _0x3316d1;})});}_0x501ac1=_[_0x820b('0x48')]({},_0x501ac1,_0x5da0e2[_0x820b('0x49')]);return _0x22f3eb['getItems'](_0x501ac1);}})[_0x820b('0x2d')](function(_0x2fbeb6){if(_0x2fbeb6){_0x2fc96e=_0x2fbeb6[_0x820b('0x40')];if(!_0x5da0e2[_0x820b('0x3a')][_0x820b('0x41')](_0x820b('0x42'))){_0x501ac1[_0x820b('0x28')]=qs[_0x820b('0x28')](_0x5da0e2[_0x820b('0x3a')][_0x820b('0x28')]);_0x501ac1[_0x820b('0x27')]=qs[_0x820b('0x27')](_0x5da0e2['query'][_0x820b('0x27')]);}return _0x22f3eb[_0x820b('0x80')](_0x501ac1);}})[_0x820b('0x2d')](function(_0xaad760){if(_0xaad760){return _0xaad760?{'count':_0x2fc96e,'rows':_0xaad760}:null;}})[_0x820b('0x2d')](respondWithResult(_0x22a520,null))['catch'](handleError(_0x22a520,null));}; \ No newline at end of file +var _0x3f83=['count','set','Content-Range','apply','reject','save','then','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','rows','catch','show','params','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','CustomDashboards','iframe','attrUrl','attrs','value','https://','custom','attrPath','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0x3f83,0xde));var _0x33f8=function(_0x5b940a,_0x3ae98c){_0x5b940a=_0x5b940a-0x0;var _0x113c20=_0x3f83[_0x5b940a];return _0x113c20;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x33f8('0x0'));var jsonpatch=require(_0x33f8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x33f8('0x2'));var Mustache=require(_0x33f8('0x3'));var util=require('util');var path=require(_0x33f8('0x4'));var sox=require(_0x33f8('0x5'));var csv=require(_0x33f8('0x6'));var ejs=require(_0x33f8('0x7'));var fs=require('fs');var fs_extra=require(_0x33f8('0x8'));var _=require(_0x33f8('0x9'));var squel=require(_0x33f8('0xa'));var crypto=require(_0x33f8('0xb'));var jsforce=require(_0x33f8('0xc'));var deskjs=require(_0x33f8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x33f8('0xe'));var Papa=require('papaparse');var Redis=require(_0x33f8('0xf'));var authService=require(_0x33f8('0x10'));var qs=require(_0x33f8('0x11'));var as=require(_0x33f8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33f8('0x13'))(_0x33f8('0x14'));var utils=require(_0x33f8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x33f8('0x16'));var db=require(_0x33f8('0x17'))['db'];config[_0x33f8('0x18')]=_[_0x33f8('0x19')](config[_0x33f8('0x18')],{'host':_0x33f8('0x1a'),'port':0x18eb});var socket=require(_0x33f8('0x1b'))(new Redis(config['redis']));require(_0x33f8('0x1c'))[_0x33f8('0x1d')](socket);function respondWithStatusCode(_0x49e5ab,_0x12a583){_0x12a583=_0x12a583||0xcc;return function(_0x2a7ea5){if(_0x2a7ea5){return _0x49e5ab['sendStatus'](_0x12a583);}return _0x49e5ab[_0x33f8('0x1e')](_0x12a583)[_0x33f8('0x1f')]();};}function respondWithResult(_0x263c13,_0x104664){_0x104664=_0x104664||0xc8;return function(_0x15e5b2){if(_0x15e5b2){return _0x263c13[_0x33f8('0x1e')](_0x104664)[_0x33f8('0x20')](_0x15e5b2);}};}function respondWithFilteredResult(_0x185c27,_0x40beba){return function(_0x44ab7f){if(_0x44ab7f){var _0x34f689=typeof _0x40beba[_0x33f8('0x21')]===_0x33f8('0x22')&&typeof _0x40beba[_0x33f8('0x23')]===_0x33f8('0x22');var _0x52d866=_0x44ab7f['count'];var _0x23e551=_0x34f689?0x0:_0x40beba['offset'];var _0x176a0a=_0x34f689?_0x44ab7f[_0x33f8('0x24')]:_0x40beba[_0x33f8('0x21')]+_0x40beba[_0x33f8('0x23')];var _0x27cb8e;if(_0x176a0a>=_0x52d866){_0x176a0a=_0x52d866;_0x27cb8e=0xc8;}else{_0x27cb8e=0xce;}_0x185c27['status'](_0x27cb8e);return _0x185c27[_0x33f8('0x25')](_0x33f8('0x26'),_0x23e551+'-'+_0x176a0a+'/'+_0x52d866)[_0x33f8('0x20')](_0x44ab7f);}return null;};}function patchUpdates(_0x1ba33b){return function(_0x35eacb){try{jsonpatch[_0x33f8('0x27')](_0x35eacb,_0x1ba33b,!![]);}catch(_0x5b2d70){return BPromise[_0x33f8('0x28')](_0x5b2d70);}return _0x35eacb[_0x33f8('0x29')]();};}function saveUpdates(_0x228389,_0x471a5f){return function(_0x202b8a){if(_0x202b8a){return _0x202b8a['update'](_0x228389)[_0x33f8('0x2a')](function(_0x1c9438){return _0x1c9438;});}return null;};}function removeEntity(_0x271f28,_0x5084e4){return function(_0x247db8){if(_0x247db8){return _0x247db8['destroy']()['then'](function(){var _0x4454f0=_0x247db8['get']({'plain':!![]});var _0x1b13c4='CustomDashboards';return db[_0x33f8('0x2b')][_0x33f8('0x2c')]({'where':{'type':_0x1b13c4,'resourceId':_0x4454f0['id']}})[_0x33f8('0x2a')](function(){return _0x247db8;});})[_0x33f8('0x2a')](function(){_0x271f28['status'](0xcc)[_0x33f8('0x1f')]();});}};}function handleEntityNotFound(_0x1eaa53,_0x51cd10){return function(_0x18ba6e){if(!_0x18ba6e){_0x1eaa53['sendStatus'](0x194);}return _0x18ba6e;};}function handleError(_0x38a1ea,_0x36b1c7){_0x36b1c7=_0x36b1c7||0x1f4;return function(_0x27ce4e){logger[_0x33f8('0x2d')](_0x27ce4e[_0x33f8('0x2e')]);if(_0x27ce4e[_0x33f8('0x2f')]){delete _0x27ce4e[_0x33f8('0x2f')];}_0x38a1ea[_0x33f8('0x1e')](_0x36b1c7)[_0x33f8('0x30')](_0x27ce4e);};}exports[_0x33f8('0x31')]=function(_0x4bf70b,_0x5013cc){var _0x19e323={},_0x1d9fca={},_0x9b6b3b={'count':0x0,'rows':[]};var _0x2e3601=_[_0x33f8('0x32')](db['Dashboard'][_0x33f8('0x33')],function(_0x21bb26){return{'name':_0x21bb26['fieldName'],'type':_0x21bb26[_0x33f8('0x34')][_0x33f8('0x35')]};});_0x1d9fca[_0x33f8('0x36')]=_[_0x33f8('0x32')](_0x2e3601,_0x33f8('0x2f'));_0x1d9fca[_0x33f8('0x37')]=_[_0x33f8('0x38')](_0x4bf70b[_0x33f8('0x37')]);_0x1d9fca['filters']=_[_0x33f8('0x39')](_0x1d9fca[_0x33f8('0x36')],_0x1d9fca[_0x33f8('0x37')]);_0x19e323[_0x33f8('0x3a')]=_['intersection'](_0x1d9fca[_0x33f8('0x36')],qs['fields'](_0x4bf70b[_0x33f8('0x37')]['fields']));_0x19e323[_0x33f8('0x3a')]=_0x19e323[_0x33f8('0x3a')][_0x33f8('0x3b')]?_0x19e323[_0x33f8('0x3a')]:_0x1d9fca[_0x33f8('0x36')];if(!_0x4bf70b[_0x33f8('0x37')]['hasOwnProperty'](_0x33f8('0x3c'))){_0x19e323['limit']=qs[_0x33f8('0x23')](_0x4bf70b[_0x33f8('0x37')][_0x33f8('0x23')]);_0x19e323['offset']=qs[_0x33f8('0x21')](_0x4bf70b[_0x33f8('0x37')][_0x33f8('0x21')]);}_0x19e323[_0x33f8('0x3d')]=qs[_0x33f8('0x3e')](_0x4bf70b[_0x33f8('0x37')][_0x33f8('0x3e')]);_0x19e323[_0x33f8('0x3f')]=qs[_0x33f8('0x40')](_[_0x33f8('0x41')](_0x4bf70b[_0x33f8('0x37')],_0x1d9fca[_0x33f8('0x40')]),_0x2e3601);if(_0x4bf70b[_0x33f8('0x37')][_0x33f8('0x42')]){_0x19e323[_0x33f8('0x3f')]=_[_0x33f8('0x43')](_0x19e323[_0x33f8('0x3f')],{'$or':_['map'](_0x2e3601,function(_0xdba9f9){if(_0xdba9f9[_0x33f8('0x34')]!==_0x33f8('0x44')){var _0x36f856={};_0x36f856[_0xdba9f9[_0x33f8('0x2f')]]={'$like':'%'+_0x4bf70b['query'][_0x33f8('0x42')]+'%'};return _0x36f856;}})});}_0x19e323=_[_0x33f8('0x43')]({},_0x19e323,_0x4bf70b[_0x33f8('0x45')]);var _0x491fc0={'where':_0x19e323[_0x33f8('0x3f')]};return db[_0x33f8('0x46')][_0x33f8('0x24')](_0x491fc0)[_0x33f8('0x2a')](function(_0x325332){_0x9b6b3b[_0x33f8('0x24')]=_0x325332;if(_0x4bf70b['query'][_0x33f8('0x47')]){_0x19e323[_0x33f8('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x19e323);})['then'](function(_0x3d3dde){_0x9b6b3b[_0x33f8('0x49')]=_0x3d3dde;return _0x9b6b3b;})['then'](respondWithFilteredResult(_0x5013cc,_0x19e323))[_0x33f8('0x4a')](handleError(_0x5013cc,null));};exports[_0x33f8('0x4b')]=function(_0x216db1,_0x467e6d){var _0x36cfa4={'raw':![],'where':{'id':_0x216db1[_0x33f8('0x4c')]['id']}},_0x31961c={};_0x31961c[_0x33f8('0x36')]=_[_0x33f8('0x38')](db[_0x33f8('0x46')][_0x33f8('0x33')]);_0x31961c[_0x33f8('0x37')]=_[_0x33f8('0x38')](_0x216db1[_0x33f8('0x37')]);_0x31961c[_0x33f8('0x40')]=_[_0x33f8('0x39')](_0x31961c[_0x33f8('0x36')],_0x31961c[_0x33f8('0x37')]);_0x36cfa4[_0x33f8('0x3a')]=_[_0x33f8('0x39')](_0x31961c[_0x33f8('0x36')],qs[_0x33f8('0x4d')](_0x216db1[_0x33f8('0x37')][_0x33f8('0x4d')]));_0x36cfa4['attributes']=_0x36cfa4['attributes'][_0x33f8('0x3b')]?_0x36cfa4[_0x33f8('0x3a')]:_0x31961c[_0x33f8('0x36')];if(_0x216db1['query'][_0x33f8('0x47')]){_0x36cfa4[_0x33f8('0x48')]=[{'all':!![]}];}_0x36cfa4=_['merge']({},_0x36cfa4,_0x216db1[_0x33f8('0x45')]);return db[_0x33f8('0x46')][_0x33f8('0x4e')](_0x36cfa4)[_0x33f8('0x2a')](handleEntityNotFound(_0x467e6d,null))[_0x33f8('0x2a')](respondWithResult(_0x467e6d,null))[_0x33f8('0x4a')](handleError(_0x467e6d,null));};exports[_0x33f8('0x4f')]=function(_0x13d374,_0x1d357e){return db[_0x33f8('0x46')][_0x33f8('0x4f')](_0x13d374[_0x33f8('0x50')],{})['then'](function(_0x5934cf){var _0x456774=_0x13d374['user'][_0x33f8('0x51')]({'plain':!![]});if(!_0x456774)throw new Error(_0x33f8('0x52'));if(_0x456774[_0x33f8('0x53')]==='user'){var _0xe38911=_0x5934cf[_0x33f8('0x51')]({'plain':!![]});var _0x19d589='CustomDashboards';return db[_0x33f8('0x54')][_0x33f8('0x4e')]({'where':{'name':_0x19d589,'userProfileId':_0x456774[_0x33f8('0x55')]},'raw':!![]})[_0x33f8('0x2a')](function(_0x19790f){if(_0x19790f&&_0x19790f[_0x33f8('0x56')]===0x0){return db[_0x33f8('0x2b')][_0x33f8('0x4f')]({'name':_0xe38911[_0x33f8('0x2f')],'resourceId':_0xe38911['id'],'type':_0x19790f['name'],'sectionId':_0x19790f['id']},{})[_0x33f8('0x2a')](function(){return _0x5934cf;});}else{return _0x5934cf;}})[_0x33f8('0x4a')](function(_0x3e8cbf){logger[_0x33f8('0x2d')](_0x33f8('0x57'),_0x3e8cbf);throw _0x3e8cbf;});}return _0x5934cf;})['then'](respondWithResult(_0x1d357e,0xc9))['catch'](handleError(_0x1d357e,null));};exports[_0x33f8('0x58')]=function(_0x596027,_0x401ac7){var _0x599eb1={'where':{'id':_0x596027[_0x33f8('0x4c')]['id']}},_0x59db70={};_0x59db70[_0x33f8('0x36')]=_[_0x33f8('0x38')](db['Dashboard'][_0x33f8('0x33')]);_0x599eb1[_0x33f8('0x3a')]=_[_0x33f8('0x39')](_0x59db70[_0x33f8('0x36')],qs['fields'](_0x596027[_0x33f8('0x37')]['fields']));_0x599eb1[_0x33f8('0x3a')]=_0x599eb1[_0x33f8('0x3a')][_0x33f8('0x3b')]?_0x599eb1[_0x33f8('0x3a')]:_0x59db70['model'];if(_0x596027[_0x33f8('0x37')][_0x33f8('0x47')]){_0x599eb1[_0x33f8('0x48')]=[{'all':!![]}];}_0x599eb1=_[_0x33f8('0x43')]({},_0x599eb1,_0x596027[_0x33f8('0x45')]);return db[_0x33f8('0x46')][_0x33f8('0x4e')](_0x599eb1)[_0x33f8('0x2a')](handleEntityNotFound(_0x401ac7,null))[_0x33f8('0x2a')](function(_0x3d464d){if(_0x3d464d){var _0x15d971=_0x3d464d['get']({'plain':!![]});_0x15d971=qs[_0x33f8('0x59')](_0x15d971,['id',_0x33f8('0x5a'),'updatedAt']);_0x596027['body']=_[_0x33f8('0x59')](_0x596027[_0x33f8('0x50')],['id',_0x33f8('0x5a'),_0x33f8('0x5b')]);return db['Dashboard']['create'](_[_0x33f8('0x43')](_0x15d971,_0x596027['body']),{'include':_0x596027['query']['includeAll']?[{'all':!![]}]:undefined})[_0x33f8('0x2a')](function(_0x2eeb39){var _0x3938db=_0x596027[_0x33f8('0x5c')][_0x33f8('0x51')]({'plain':!![]});if(!_0x3938db)throw new Error(_0x33f8('0x52'));if(_0x3938db[_0x33f8('0x53')]===_0x33f8('0x5c')){var _0x23e568=_0x2eeb39[_0x33f8('0x51')]({'plain':!![]});var _0x356fd9=_0x33f8('0x5d');return db[_0x33f8('0x54')][_0x33f8('0x4e')]({'where':{'name':_0x356fd9,'userProfileId':_0x3938db['userProfileId']},'raw':!![]})[_0x33f8('0x2a')](function(_0x11b2ae){if(_0x11b2ae&&_0x11b2ae[_0x33f8('0x56')]===0x0){return db[_0x33f8('0x2b')]['create']({'name':_0x23e568[_0x33f8('0x2f')],'resourceId':_0x23e568['id'],'type':_0x11b2ae[_0x33f8('0x2f')],'sectionId':_0x11b2ae['id']},{})[_0x33f8('0x2a')](function(){return _0x2eeb39;});}else{return _0x2eeb39;}})['catch'](function(_0x5a44e7){logger[_0x33f8('0x2d')](_0x33f8('0x57'),_0x5a44e7);throw _0x5a44e7;});}return _0x2eeb39;});}})[_0x33f8('0x2a')](respondWithResult(_0x401ac7,0xc9))[_0x33f8('0x4a')](handleError(_0x401ac7,null));};exports['update']=function(_0x77bbc0,_0x3ab1cf){if(_0x77bbc0['body']['id']){delete _0x77bbc0['body']['id'];}return db['Dashboard'][_0x33f8('0x4e')]({'where':{'id':_0x77bbc0[_0x33f8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ab1cf,null))[_0x33f8('0x2a')](saveUpdates(_0x77bbc0['body'],null))[_0x33f8('0x2a')](respondWithResult(_0x3ab1cf,null))['catch'](handleError(_0x3ab1cf,null));};exports[_0x33f8('0x2c')]=function(_0x10eb31,_0x1c661e){return db['Dashboard'][_0x33f8('0x4e')]({'where':{'id':_0x10eb31['params']['id']}})[_0x33f8('0x2a')](handleEntityNotFound(_0x1c661e,null))['then'](removeEntity(_0x1c661e,null))['catch'](handleError(_0x1c661e,null));};function widgetAttributes(_0x3e0eb2){try{switch(_0x3e0eb2[_0x33f8('0x34')]){case _0x33f8('0x5e'):return[{'name':_0x33f8('0x5f'),'value':_0x3e0eb2[_0x33f8('0x5f')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x0]?_0x3e0eb2[_0x33f8('0x60')][0x0][_0x33f8('0x61')]:undefined)||_0x33f8('0x62')}];case _0x33f8('0x63'):return[{'name':_0x33f8('0x64'),'value':_0x3e0eb2['attrPath']||(_0x3e0eb2['attrs']&&_0x3e0eb2['attrs'][0x0]?_0x3e0eb2[_0x33f8('0x60')][0x0][_0x33f8('0x61')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x3e0eb2['attrHourFormat']||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x0]?_0x3e0eb2[_0x33f8('0x60')][0x0][_0x33f8('0x61')]:undefined)||_0x33f8('0x65')},{'name':_0x33f8('0x66'),'value':_0x3e0eb2[_0x33f8('0x66')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x1]?_0x3e0eb2[_0x33f8('0x60')][0x1][_0x33f8('0x61')]:undefined)||'0.00'},{'name':_0x33f8('0x67'),'value':_0x3e0eb2['attrFontSize']||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x2]?_0x3e0eb2[_0x33f8('0x60')][0x2]['value']:undefined)||0xc}];case _0x33f8('0x68'):return[{'name':'attrMetric','value':_0x3e0eb2[_0x33f8('0x69')]||(_0x3e0eb2['attrs']&&_0x3e0eb2['attrs'][0x0]?_0x3e0eb2[_0x33f8('0x60')][0x0]['value']:undefined)||_0x33f8('0x6a')},{'name':_0x33f8('0x6b'),'value':_0x3e0eb2[_0x33f8('0x6b')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x1]?_0x3e0eb2['attrs'][0x1][_0x33f8('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x3e0eb2[_0x33f8('0x67')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x2]?_0x3e0eb2[_0x33f8('0x60')][0x2][_0x33f8('0x61')]:undefined)||0x14},{'name':_0x33f8('0x6c'),'value':_0x3e0eb2['attrChannel']||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x3]?_0x3e0eb2[_0x33f8('0x60')][0x3][_0x33f8('0x61')]:undefined)||_0x33f8('0x6d')},{'name':_0x33f8('0x6e'),'value':_0x3e0eb2[_0x33f8('0x6e')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x4]?_0x3e0eb2[_0x33f8('0x60')][0x4][_0x33f8('0x61')]:undefined)||''},{'name':_0x33f8('0x6f'),'value':_0x3e0eb2[_0x33f8('0x6f')]||(_0x3e0eb2['attrs']&&_0x3e0eb2[_0x33f8('0x60')][0x5]?_0x3e0eb2[_0x33f8('0x60')][0x5]['value']:undefined)||''},{'name':_0x33f8('0x70'),'value':_0x3e0eb2[_0x33f8('0x70')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x6]?_0x3e0eb2[_0x33f8('0x60')][0x6]['value']:undefined)||''},{'name':_0x33f8('0x71'),'value':_0x3e0eb2[_0x33f8('0x71')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x7]?_0x3e0eb2[_0x33f8('0x60')][0x7][_0x33f8('0x61')]:undefined)||''},{'name':_0x33f8('0x72'),'value':_0x3e0eb2['attrWhatsappAccounts']||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x8]?_0x3e0eb2[_0x33f8('0x60')][0x8][_0x33f8('0x61')]:undefined)||''},{'name':_0x33f8('0x73'),'value':_0x3e0eb2[_0x33f8('0x73')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x9]?_0x3e0eb2[_0x33f8('0x60')][0x9][_0x33f8('0x61')]:undefined)||''}];case _0x33f8('0x74'):case'pie-chart':return[{'name':_0x33f8('0x75'),'value':_0x3e0eb2[_0x33f8('0x75')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x0]?_0x3e0eb2[_0x33f8('0x60')][0x0][_0x33f8('0x61')]:undefined)||_0x33f8('0x6a')},{'name':_0x33f8('0x76'),'value':_0x3e0eb2[_0x33f8('0x76')]||(_0x3e0eb2['attrs']&&_0x3e0eb2['attrs'][0x1]?_0x3e0eb2[_0x33f8('0x60')][0x1][_0x33f8('0x61')]:undefined)||null},{'name':_0x33f8('0x77'),'value':_0x3e0eb2[_0x33f8('0x77')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x2]?_0x3e0eb2[_0x33f8('0x60')][0x2][_0x33f8('0x61')]:undefined)||null},{'name':_0x33f8('0x6b'),'value':_0x3e0eb2[_0x33f8('0x6b')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x3]?_0x3e0eb2['attrs'][0x3]['value']:undefined)||[]},{'name':_0x33f8('0x6c'),'value':_0x3e0eb2[_0x33f8('0x6c')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x4]?_0x3e0eb2['attrs'][0x4][_0x33f8('0x61')]:undefined)||'voice'},{'name':_0x33f8('0x6e'),'value':_0x3e0eb2[_0x33f8('0x6e')]||(_0x3e0eb2['attrs']&&_0x3e0eb2[_0x33f8('0x60')][0x5]?_0x3e0eb2[_0x33f8('0x60')][0x5][_0x33f8('0x61')]:undefined)||''},{'name':_0x33f8('0x6f'),'value':_0x3e0eb2[_0x33f8('0x6f')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x6]?_0x3e0eb2[_0x33f8('0x60')][0x6][_0x33f8('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3e0eb2[_0x33f8('0x70')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x7]?_0x3e0eb2[_0x33f8('0x60')][0x7][_0x33f8('0x61')]:undefined)||''},{'name':_0x33f8('0x71'),'value':_0x3e0eb2[_0x33f8('0x71')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0x8]?_0x3e0eb2[_0x33f8('0x60')][0x8][_0x33f8('0x61')]:undefined)||''},{'name':_0x33f8('0x72'),'value':_0x3e0eb2['attrWhatsappAccounts']||(_0x3e0eb2['attrs']&&_0x3e0eb2[_0x33f8('0x60')][0x9]?_0x3e0eb2[_0x33f8('0x60')][0x9]['value']:undefined)||''},{'name':_0x33f8('0x73'),'value':_0x3e0eb2['attrChatWebsites']||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2[_0x33f8('0x60')][0xa]?_0x3e0eb2[_0x33f8('0x60')][0xa][_0x33f8('0x61')]:undefined)||''}];case _0x33f8('0x78'):return[{'name':_0x33f8('0x79'),'type':_0x3e0eb2['reportType']||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x0]?_0x3e0eb2['attrs'][0x0][_0x33f8('0x34')]:undefined)||null,'value':_0x3e0eb2[_0x33f8('0x79')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x0]?_0x3e0eb2[_0x33f8('0x60')][0x0]['value']:undefined)||null},{'name':_0x33f8('0x7a'),'value':_0x3e0eb2[_0x33f8('0x7a')]||(_0x3e0eb2[_0x33f8('0x60')]&&_0x3e0eb2['attrs'][0x1]?_0x3e0eb2[_0x33f8('0x60')][0x1][_0x33f8('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x34e78c){logger[_0x33f8('0x2d')](_0x33f8('0x7b'),JSON[_0x33f8('0x7c')](_0x34e78c));return[];}}exports[_0x33f8('0x7d')]=function(_0x31643b,_0xbd7e9f,_0x4cc09f){if(_0x31643b['body']['id']){delete _0x31643b['body']['id'];}return db[_0x33f8('0x46')][_0x33f8('0x4e')]({'where':{'id':_0x31643b[_0x33f8('0x4c')]['id']}})[_0x33f8('0x2a')](handleEntityNotFound(_0xbd7e9f,null))[_0x33f8('0x2a')](function(_0x1106ea){if(_0x1106ea){_0x31643b[_0x33f8('0x50')][_0x33f8('0x7e')]=_0x1106ea['id'];_0x31643b[_0x33f8('0x50')][_0x33f8('0x60')]=widgetAttributes(_0x31643b[_0x33f8('0x50')]);return db[_0x33f8('0x7f')][_0x33f8('0x4f')](_0x31643b[_0x33f8('0x50')]);}})[_0x33f8('0x2a')](respondWithResult(_0xbd7e9f,null))['catch'](handleError(_0xbd7e9f,null));};exports['getItems']=function(_0x2a449f,_0x290ab8,_0x220331){var _0x2f7d4f={};var _0x51847a={};var _0x239f26;var _0x57c53b;return db[_0x33f8('0x46')]['findOne']({'where':{'id':_0x2a449f[_0x33f8('0x4c')]['id']}})[_0x33f8('0x2a')](handleEntityNotFound(_0x290ab8,null))['then'](function(_0x43d4ba){if(_0x43d4ba){_0x239f26=_0x43d4ba;_0x51847a[_0x33f8('0x36')]=_['keys'](db[_0x33f8('0x7f')][_0x33f8('0x33')]);_0x51847a['query']=_['keys'](_0x2a449f[_0x33f8('0x37')]);_0x51847a[_0x33f8('0x40')]=_[_0x33f8('0x39')](_0x51847a['model'],_0x51847a[_0x33f8('0x37')]);_0x2f7d4f[_0x33f8('0x3a')]=_['intersection'](_0x51847a[_0x33f8('0x36')],qs[_0x33f8('0x4d')](_0x2a449f['query'][_0x33f8('0x4d')]));_0x2f7d4f['attributes']=_0x2f7d4f[_0x33f8('0x3a')][_0x33f8('0x3b')]?_0x2f7d4f[_0x33f8('0x3a')]:_0x51847a[_0x33f8('0x36')];_0x2f7d4f[_0x33f8('0x3d')]=qs['sort'](_0x2a449f[_0x33f8('0x37')]['sort']);_0x2f7d4f['where']=qs[_0x33f8('0x40')](_[_0x33f8('0x41')](_0x2a449f[_0x33f8('0x37')],_0x51847a[_0x33f8('0x40')]));if(_0x2a449f[_0x33f8('0x37')]['filter']){_0x2f7d4f['where']=_[_0x33f8('0x43')](_0x2f7d4f[_0x33f8('0x3f')],{'$or':_[_0x33f8('0x32')](_0x2f7d4f[_0x33f8('0x3a')],function(_0x195bde){var _0x20b8de={};_0x20b8de[_0x195bde]={'$like':'%'+_0x2a449f[_0x33f8('0x37')][_0x33f8('0x42')]+'%'};return _0x20b8de;})});}_0x2f7d4f=_[_0x33f8('0x43')]({},_0x2f7d4f,_0x2a449f[_0x33f8('0x45')]);return _0x239f26[_0x33f8('0x80')](_0x2f7d4f);}})[_0x33f8('0x2a')](function(_0x20449c){if(_0x20449c){_0x57c53b=_0x20449c[_0x33f8('0x3b')];if(!_0x2a449f['query']['hasOwnProperty'](_0x33f8('0x3c'))){_0x2f7d4f[_0x33f8('0x23')]=qs[_0x33f8('0x23')](_0x2a449f['query'][_0x33f8('0x23')]);_0x2f7d4f[_0x33f8('0x21')]=qs[_0x33f8('0x21')](_0x2a449f['query'][_0x33f8('0x21')]);}return _0x239f26[_0x33f8('0x80')](_0x2f7d4f);}})['then'](function(_0x5c79ae){if(_0x5c79ae){return _0x5c79ae?{'count':_0x57c53b,'rows':_0x5c79ae}:null;}})[_0x33f8('0x2a')](respondWithResult(_0x290ab8,null))['catch'](handleError(_0x290ab8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 0abcd0a..4618f02 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 _0x8549=['setMaxListeners','update','emit','hook','exports'];(function(_0x22476f,_0x101f9b){var _0xeb95a0=function(_0x4bdeda){while(--_0x4bdeda){_0x22476f['push'](_0x22476f['shift']());}};_0xeb95a0(++_0x101f9b);}(_0x8549,0x113));var _0x9854=function(_0xc453f2,_0xd88260){_0xc453f2=_0xc453f2-0x0;var _0x387840=_0x8549[_0xc453f2];return _0x387840;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9854('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9854('0x1'),'afterDestroy':'remove'};function emitEvent(_0x145aeb){return function(_0x1ea948,_0x191f8c,_0x23fe5d){DashboardEvents[_0x9854('0x2')](_0x145aeb+':'+_0x1ea948['id'],_0x1ea948);DashboardEvents['emit'](_0x145aeb,_0x1ea948);_0x23fe5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9854('0x3')](e,emitEvent(event));}}module[_0x9854('0x4')]=DashboardEvents; \ No newline at end of file +var _0x2517=['remove','emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x2517,0xfe));var _0x7251=function(_0x128a80,_0xf6c598){_0x128a80=_0x128a80-0x0;var _0x5a25eb=_0x2517[_0x128a80];return _0x5a25eb;};'use strict';var EventEmitter=require(_0x7251('0x0'));var Dashboard=require(_0x7251('0x1'))['db'][_0x7251('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7251('0x3')](0x0);var events={'afterCreate':_0x7251('0x4'),'afterUpdate':_0x7251('0x5'),'afterDestroy':_0x7251('0x6')};function emitEvent(_0x16c580){return function(_0xbe40fe,_0x48d137,_0x3412dd){DashboardEvents[_0x7251('0x7')](_0x16c580+':'+_0xbe40fe['id'],_0xbe40fe);DashboardEvents[_0x7251('0x7')](_0x16c580,_0xbe40fe);_0x3412dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x7251('0x8')](e,emitEvent(event));}}module[_0x7251('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f64d9eb..4adb979 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 _0x52ed=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','dashboards','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x52ed,0x132));var _0xd52e=function(_0x31e00f,_0x1a4e77){_0x31e00f=_0x31e00f-0x0;var _0x260194=_0x52ed[_0x31e00f];return _0x260194;};'use strict';var _=require(_0xd52e('0x0'));var util=require(_0xd52e('0x1'));var logger=require(_0xd52e('0x2'))(_0xd52e('0x3'));var moment=require(_0xd52e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd52e('0x5'));var fs=require('fs');var path=require(_0xd52e('0x6'));var rimraf=require(_0xd52e('0x7'));var config=require(_0xd52e('0x8'));var attributes=require(_0xd52e('0x9'));module['exports']=function(_0x27a637,_0xb6a24a){return _0x27a637['define']('Dashboard',attributes,{'tableName':_0xd52e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa22b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','api'];(function(_0x5bae64,_0x5062bd){var _0x45e8af=function(_0x227821){while(--_0x227821){_0x5bae64['push'](_0x5bae64['shift']());}};_0x45e8af(++_0x5062bd);}(_0xa22b,0x128));var _0xba22=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0xa22b[_0x177cc9];return _0x2fe577;};'use strict';var _=require(_0xba22('0x0'));var util=require(_0xba22('0x1'));var logger=require('../../config/logger')(_0xba22('0x2'));var moment=require(_0xba22('0x3'));var BPromise=require(_0xba22('0x4'));var rp=require(_0xba22('0x5'));var fs=require('fs');var path=require(_0xba22('0x6'));var rimraf=require(_0xba22('0x7'));var config=require(_0xba22('0x8'));var attributes=require(_0xba22('0x9'));module['exports']=function(_0x43e0ae,_0xd0d921){return _0x43e0ae[_0xba22('0xa')](_0xba22('0xb'),attributes,{'tableName':_0xba22('0xc'),'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 b2c6183..910f015 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 _0x6318=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x8bf9b9,_0x135e79){var _0x13bd99=function(_0x5b3ccc){while(--_0x5b3ccc){_0x8bf9b9['push'](_0x8bf9b9['shift']());}};_0x13bd99(++_0x135e79);}(_0x6318,0x89));var _0x8631=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6318[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x8631('0x0'));var util=require(_0x8631('0x1'));var moment=require(_0x8631('0x2'));var BPromise=require(_0x8631('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8631('0x4'))['db'];var utils=require(_0x8631('0x5'));var logger=require(_0x8631('0x6'))(_0x8631('0x7'));var config=require(_0x8631('0x8'));var jayson=require(_0x8631('0x9'));var client=jayson[_0x8631('0xa')][_0x8631('0xb')]({'port':0x232a});config[_0x8631('0xc')]=_[_0x8631('0xd')](config[_0x8631('0xc')],{'host':_0x8631('0xe'),'port':0x18eb});var socket=require(_0x8631('0xf'))(new Redis(config[_0x8631('0xc')]));require(_0x8631('0x10'))['register'](socket);function respondWithRpcPromise(_0x4a6403,_0x273bf3,_0x4238f4){return new BPromise(function(_0x3ef065,_0x3d341d){return client['request'](_0x4a6403,_0x4238f4)[_0x8631('0x11')](function(_0x21c99d){logger[_0x8631('0x12')](_0x8631('0x13'),_0x273bf3,_0x8631('0x14'));logger['debug'](_0x8631('0x15'),_0x273bf3,_0x8631('0x14'),JSON[_0x8631('0x16')](_0x21c99d));if(_0x21c99d[_0x8631('0x17')]){if(_0x21c99d[_0x8631('0x17')][_0x8631('0x18')]===0x1f4){logger[_0x8631('0x17')](_0x8631('0x13'),_0x273bf3,_0x21c99d[_0x8631('0x17')]['message']);return _0x3d341d(_0x21c99d[_0x8631('0x17')]['message']);}logger[_0x8631('0x17')](_0x8631('0x13'),_0x273bf3,_0x21c99d[_0x8631('0x17')][_0x8631('0x19')]);return _0x3ef065(_0x21c99d[_0x8631('0x17')]['message']);}else{logger[_0x8631('0x12')]('Dashboard,\x20%s,\x20%s',_0x273bf3,_0x8631('0x14'));_0x3ef065(_0x21c99d[_0x8631('0x1a')][_0x8631('0x19')]);}})[_0x8631('0x1b')](function(_0x570975){logger[_0x8631('0x17')](_0x8631('0x13'),_0x273bf3,_0x570975);_0x3d341d(_0x570975);});});} \ No newline at end of file +var _0x8c73=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x8c73,0xbf));var _0x38c7=function(_0x5eb4cc,_0x15af2d){_0x5eb4cc=_0x5eb4cc-0x0;var _0x5e9e44=_0x8c73[_0x5eb4cc];return _0x5e9e44;};'use strict';var _=require(_0x38c7('0x0'));var util=require('util');var moment=require(_0x38c7('0x1'));var BPromise=require('bluebird');var rs=require(_0x38c7('0x2'));var fs=require('fs');var Redis=require(_0x38c7('0x3'));var db=require(_0x38c7('0x4'))['db'];var utils=require(_0x38c7('0x5'));var logger=require('../../config/logger')(_0x38c7('0x6'));var config=require(_0x38c7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x38c7('0x8')]=_[_0x38c7('0x9')](config['redis'],{'host':_0x38c7('0xa'),'port':0x18eb});var socket=require(_0x38c7('0xb'))(new Redis(config[_0x38c7('0x8')]));require(_0x38c7('0xc'))[_0x38c7('0xd')](socket);function respondWithRpcPromise(_0x27898b,_0x31473a,_0x4a8745){return new BPromise(function(_0x264b60,_0x102cd8){return client['request'](_0x27898b,_0x4a8745)[_0x38c7('0xe')](function(_0xfd3523){logger[_0x38c7('0xf')]('Dashboard,\x20%s,\x20%s',_0x31473a,_0x38c7('0x10'));logger[_0x38c7('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x31473a,'request\x20sent',JSON[_0x38c7('0x12')](_0xfd3523));if(_0xfd3523[_0x38c7('0x13')]){if(_0xfd3523[_0x38c7('0x13')][_0x38c7('0x14')]===0x1f4){logger['error'](_0x38c7('0x15'),_0x31473a,_0xfd3523[_0x38c7('0x13')][_0x38c7('0x16')]);return _0x102cd8(_0xfd3523[_0x38c7('0x13')][_0x38c7('0x16')]);}logger[_0x38c7('0x13')](_0x38c7('0x15'),_0x31473a,_0xfd3523[_0x38c7('0x13')]['message']);return _0x264b60(_0xfd3523['error'][_0x38c7('0x16')]);}else{logger[_0x38c7('0xf')](_0x38c7('0x15'),_0x31473a,'request\x20sent');_0x264b60(_0xfd3523[_0x38c7('0x17')][_0x38c7('0x16')]);}})['catch'](function(_0xf50f4f){logger[_0x38c7('0x13')](_0x38c7('0x15'),_0x31473a,_0xf50f4f);_0x102cd8(_0xf50f4f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3f55256..ce4308d 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 _0x6256=['length','dashboard:','./dashboard.events','emit','removeListener'];(function(_0x4e01f3,_0x5a1422){var _0x1a1662=function(_0x1b072d){while(--_0x1b072d){_0x4e01f3['push'](_0x4e01f3['shift']());}};_0x1a1662(++_0x5a1422);}(_0x6256,0xde));var _0x6625=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x6256[_0x36c5b0];return _0xf19333;};'use strict';var DashboardEvents=require(_0x6625('0x0'));var events=['save','remove','update'];function createListener(_0x4d675d,_0x1d8d13){return function(_0x1e25bc){_0x1d8d13[_0x6625('0x1')](_0x4d675d,_0x1e25bc);};}function removeListener(_0x15bf98,_0xe2af7d){return function(){DashboardEvents[_0x6625('0x2')](_0x15bf98,_0xe2af7d);};}exports['register']=function(_0x3891fe){for(var _0x2e6cb1=0x0,_0x53ce28=events[_0x6625('0x3')];_0x2e6cb1<_0x53ce28;_0x2e6cb1++){var _0x1ff961=events[_0x2e6cb1];var _0x4d7e1a=createListener(_0x6625('0x4')+_0x1ff961,_0x3891fe);DashboardEvents['on'](_0x1ff961,_0x4d7e1a);}}; \ No newline at end of file +var _0x729a=['remove','emit','register','length','./dashboard.events','save'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x729a,0x112));var _0xa729=function(_0x15b3c1,_0x231df4){_0x15b3c1=_0x15b3c1-0x0;var _0x586273=_0x729a[_0x15b3c1];return _0x586273;};'use strict';var DashboardEvents=require(_0xa729('0x0'));var events=[_0xa729('0x1'),_0xa729('0x2'),'update'];function createListener(_0x2531ad,_0x381bbf){return function(_0x2d9a1a){_0x381bbf[_0xa729('0x3')](_0x2531ad,_0x2d9a1a);};}function removeListener(_0x19b30d,_0x1102b9){return function(){DashboardEvents['removeListener'](_0x19b30d,_0x1102b9);};}exports[_0xa729('0x4')]=function(_0xa880dc){for(var _0x4f177b=0x0,_0xd31f06=events[_0xa729('0x5')];_0x4f177b<_0xd31f06;_0x4f177b++){var _0x294243=events[_0x4f177b];var _0x6ed82=createListener('dashboard:'+_0x294243,_0xa880dc);DashboardEvents['on'](_0x294243,_0x6ed82);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 80622ff..1620ccd 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 _0xbaac=['util','connect-timeout','express','Router','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','delete','destroy','multer'];(function(_0x6575c,_0x343af6){var _0x46f13b=function(_0x58371f){while(--_0x58371f){_0x6575c['push'](_0x6575c['shift']());}};_0x46f13b(++_0x343af6);}(_0xbaac,0xdb));var _0xcbaa=function(_0x787d44,_0x36fea9){_0x787d44=_0x787d44-0x0;var _0x1c1430=_0xbaac[_0x787d44];return _0x1c1430;};'use strict';var multer=require(_0xcbaa('0x0'));var util=require(_0xcbaa('0x1'));var path=require('path');var timeout=require(_0xcbaa('0x2'));var express=require(_0xcbaa('0x3'));var router=express[_0xcbaa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcbaa('0x5'));var config=require('../../config/environment');var controller=require(_0xcbaa('0x6'));router[_0xcbaa('0x7')]('/',auth[_0xcbaa('0x8')](),controller[_0xcbaa('0x9')]);router[_0xcbaa('0x7')](_0xcbaa('0xa'),auth[_0xcbaa('0x8')](),controller[_0xcbaa('0xb')]);router[_0xcbaa('0x7')](_0xcbaa('0xc'),auth[_0xcbaa('0x8')](),controller[_0xcbaa('0xd')]);router['post']('/',auth[_0xcbaa('0x8')](),controller[_0xcbaa('0xe')]);router[_0xcbaa('0xf')](_0xcbaa('0x10'),auth[_0xcbaa('0x8')](),controller[_0xcbaa('0x11')]);router[_0xcbaa('0xf')](_0xcbaa('0xc'),auth['isAuthenticated'](),controller[_0xcbaa('0x12')]);router[_0xcbaa('0x13')](_0xcbaa('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xcbaa('0x14')](_0xcbaa('0xa'),auth[_0xcbaa('0x8')](),controller[_0xcbaa('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8d23=['get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0xbabda3,_0x51e341){var _0x5bba7a=function(_0x388388){while(--_0x388388){_0xbabda3['push'](_0xbabda3['shift']());}};_0x5bba7a(++_0x51e341);}(_0x8d23,0x113));var _0x38d2=function(_0x4cc7f5,_0x3fa085){_0x4cc7f5=_0x4cc7f5-0x0;var _0x2c5f50=_0x8d23[_0x4cc7f5];return _0x2c5f50;};'use strict';var multer=require(_0x38d2('0x0'));var util=require(_0x38d2('0x1'));var path=require(_0x38d2('0x2'));var timeout=require(_0x38d2('0x3'));var express=require(_0x38d2('0x4'));var router=express[_0x38d2('0x5')]();var fs_extra=require(_0x38d2('0x6'));var auth=require(_0x38d2('0x7'));var interaction=require(_0x38d2('0x8'));var config=require(_0x38d2('0x9'));var controller=require(_0x38d2('0xa'));router[_0x38d2('0xb')]('/',auth[_0x38d2('0xc')](),controller[_0x38d2('0xd')]);router['get'](_0x38d2('0xe'),auth[_0x38d2('0xc')](),controller[_0x38d2('0xf')]);router[_0x38d2('0xb')](_0x38d2('0x10'),auth['isAuthenticated'](),controller[_0x38d2('0x11')]);router['post']('/',auth[_0x38d2('0xc')](),controller[_0x38d2('0x12')]);router[_0x38d2('0x13')](_0x38d2('0x14'),auth['isAuthenticated'](),controller[_0x38d2('0x15')]);router[_0x38d2('0x13')](_0x38d2('0x10'),auth['isAuthenticated'](),controller[_0x38d2('0x16')]);router['put'](_0x38d2('0xe'),auth['isAuthenticated'](),controller[_0x38d2('0x17')]);router[_0x38d2('0x18')](_0x38d2('0xe'),auth[_0x38d2('0xc')](),controller['destroy']);module[_0x38d2('0x19')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2542bc3..93808ca 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 _0x53ec=['getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','long'];(function(_0x22c169,_0x3298a6){var _0x30cc6f=function(_0x2cd339){while(--_0x2cd339){_0x22c169['push'](_0x22c169['shift']());}};_0x30cc6f(++_0x3298a6);}(_0x53ec,0x192));var _0xc53e=function(_0x2f8177,_0x1bb2a9){_0x2f8177=_0x2f8177-0x0;var _0x249cb4=_0x53ec[_0x2f8177];return _0x249cb4;};'use strict';var Sequelize=require(_0xc53e('0x0'));var squel=require(_0xc53e('0x1'));var _=require(_0xc53e('0x2'));module[_0xc53e('0x3')]={'title':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xc53e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xc53e('0x5')),'get':function(){try{return JSON['parse'](this[_0xc53e('0x6')](_0xc53e('0x7')));}catch(_0x4a9c59){return[];}},'set':function(_0x2f1414){try{this['setDataValue'](_0xc53e('0x7'),JSON[_0xc53e('0x8')](_0x2f1414));}catch(_0x5d3b28){this[_0xc53e('0x9')](_0xc53e('0x7'),JSON[_0xc53e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc53e('0xa')]},'col':{'type':Sequelize[_0xc53e('0xa')]},'background':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![],'defaultValue':_0xc53e('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xc53e('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x4819=['long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x6a734c,_0x1b2d9f){var _0x494d0d=function(_0x36fd39){while(--_0x36fd39){_0x6a734c['push'](_0x6a734c['shift']());}};_0x494d0d(++_0x1b2d9f);}(_0x4819,0xcd));var _0x9481=function(_0x28678d,_0x54324f){_0x28678d=_0x28678d-0x0;var _0x1643e9=_0x4819[_0x28678d];return _0x1643e9;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9481('0x0'));var _=require(_0x9481('0x1'));module[_0x9481('0x2')]={'title':{'type':Sequelize[_0x9481('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x5')),'get':function(){try{return JSON[_0x9481('0x6')](this[_0x9481('0x7')](_0x9481('0x8')));}catch(_0x5ac51c){return[];}},'set':function(_0x4d9e3a){try{this['setDataValue']('attrs',JSON[_0x9481('0x9')](_0x4d9e3a));}catch(_0x6c6a08){this[_0x9481('0xa')](_0x9481('0x8'),JSON[_0x9481('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9481('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9481('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9481('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9481('0x3')],'allowNull':![],'defaultValue':_0x9481('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9481('0x3')]},'titleFontSize':{'type':Sequelize[_0x9481('0xb')],'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 fa3be80..e68213e 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 _0xb470=['attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','show','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','merge','find','catch','params','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues'];(function(_0xe5d575,_0x8a16d3){var _0x56cd9c=function(_0x5e4662){while(--_0x5e4662){_0xe5d575['push'](_0xe5d575['shift']());}};_0x56cd9c(++_0x8a16d3);}(_0xb470,0x75));var _0x0b47=function(_0x5584b4,_0x586825){_0x5584b4=_0x5584b4-0x0;var _0x4f2c79=_0xb470[_0x5584b4];return _0x4f2c79;};'use strict';var emlformat=require(_0x0b47('0x0'));var rimraf=require(_0x0b47('0x1'));var zipdir=require(_0x0b47('0x2'));var jsonpatch=require(_0x0b47('0x3'));var rp=require('request-promise');var moment=require(_0x0b47('0x4'));var BPromise=require(_0x0b47('0x5'));var Mustache=require(_0x0b47('0x6'));var util=require('util');var path=require(_0x0b47('0x7'));var sox=require(_0x0b47('0x8'));var csv=require(_0x0b47('0x9'));var ejs=require(_0x0b47('0xa'));var fs=require('fs');var fs_extra=require(_0x0b47('0xb'));var _=require(_0x0b47('0xc'));var squel=require(_0x0b47('0xd'));var crypto=require(_0x0b47('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b47('0xf'));var Redis=require(_0x0b47('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b47('0x11'));var as=require(_0x0b47('0x12'));var hardwareService=require(_0x0b47('0x13'));var logger=require(_0x0b47('0x14'))(_0x0b47('0x15'));var utils=require(_0x0b47('0x16'));var config=require(_0x0b47('0x17'));var licenseUtil=require(_0x0b47('0x18'));var db=require(_0x0b47('0x19'))['db'];config[_0x0b47('0x1a')]=_['defaults'](config['redis'],{'host':_0x0b47('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b47('0x1a')]));require(_0x0b47('0x1c'))['register'](socket);function respondWithStatusCode(_0x36fe0a,_0x4089d0){_0x4089d0=_0x4089d0||0xcc;return function(_0x2bb088){if(_0x2bb088){return _0x36fe0a[_0x0b47('0x1d')](_0x4089d0);}return _0x36fe0a[_0x0b47('0x1e')](_0x4089d0)[_0x0b47('0x1f')]();};}function respondWithResult(_0x1e9588,_0x1dc752){_0x1dc752=_0x1dc752||0xc8;return function(_0x130a13){if(_0x130a13){return _0x1e9588[_0x0b47('0x1e')](_0x1dc752)['json'](_0x130a13);}};}function respondWithFilteredResult(_0x151eb6,_0x4e5f56){return function(_0x11f305){if(_0x11f305){var _0x1620fc=typeof _0x4e5f56[_0x0b47('0x20')]==='undefined'&&typeof _0x4e5f56[_0x0b47('0x21')]==='undefined';var _0x4b5bac=_0x11f305[_0x0b47('0x22')];var _0x395591=_0x1620fc?0x0:_0x4e5f56['offset'];var _0x3f1c9c=_0x1620fc?_0x11f305['count']:_0x4e5f56[_0x0b47('0x20')]+_0x4e5f56[_0x0b47('0x21')];var _0x34b129;if(_0x3f1c9c>=_0x4b5bac){_0x3f1c9c=_0x4b5bac;_0x34b129=0xc8;}else{_0x34b129=0xce;}_0x151eb6[_0x0b47('0x1e')](_0x34b129);return _0x151eb6[_0x0b47('0x23')](_0x0b47('0x24'),_0x395591+'-'+_0x3f1c9c+'/'+_0x4b5bac)[_0x0b47('0x25')](_0x11f305);}return null;};}function patchUpdates(_0x2dfdb4){return function(_0x3bff28){try{jsonpatch[_0x0b47('0x26')](_0x3bff28,_0x2dfdb4,!![]);}catch(_0x3e37e8){return BPromise['reject'](_0x3e37e8);}return _0x3bff28[_0x0b47('0x27')]();};}function saveUpdates(_0x11935a,_0x4e481c){return function(_0x32559d){if(_0x32559d){return _0x32559d[_0x0b47('0x28')](_0x11935a)[_0x0b47('0x29')](function(_0xd9c35c){return _0xd9c35c;});}return null;};}function removeEntity(_0x59af8e,_0x47d1b2){return function(_0x375983){if(_0x375983){return _0x375983[_0x0b47('0x2a')]()['then'](function(){_0x59af8e[_0x0b47('0x1e')](0xcc)[_0x0b47('0x1f')]();});}};}function handleEntityNotFound(_0x3f0ab4,_0x195d5a){return function(_0x15db7d){if(!_0x15db7d){_0x3f0ab4[_0x0b47('0x1d')](0x194);}return _0x15db7d;};}function handleError(_0x33a81a,_0xd1ead){_0xd1ead=_0xd1ead||0x1f4;return function(_0x3550cc){logger[_0x0b47('0x2b')](_0x3550cc[_0x0b47('0x2c')]);if(_0x3550cc['name']){delete _0x3550cc['name'];}_0x33a81a[_0x0b47('0x1e')](_0xd1ead)['send'](_0x3550cc);};}exports[_0x0b47('0x2d')]=function(_0x9a2cc1,_0x1842ec){var _0xccf571={'raw':![],'where':{'id':_0x9a2cc1['params']['id']}},_0x1014cd={};_0x1014cd[_0x0b47('0x2e')]=_[_0x0b47('0x2f')](db[_0x0b47('0x30')]['rawAttributes']);_0x1014cd[_0x0b47('0x31')]=_[_0x0b47('0x2f')](_0x9a2cc1[_0x0b47('0x31')]);_0x1014cd[_0x0b47('0x32')]=_[_0x0b47('0x33')](_0x1014cd[_0x0b47('0x2e')],_0x1014cd['query']);_0xccf571['attributes']=_[_0x0b47('0x33')](_0x1014cd[_0x0b47('0x2e')],qs[_0x0b47('0x34')](_0x9a2cc1[_0x0b47('0x31')][_0x0b47('0x34')]));_0xccf571[_0x0b47('0x35')]=_0xccf571[_0x0b47('0x35')][_0x0b47('0x36')]?_0xccf571[_0x0b47('0x35')]:_0x1014cd[_0x0b47('0x2e')];if(_0x9a2cc1[_0x0b47('0x31')]['includeAll']){_0xccf571['include']=[{'all':!![]}];}_0xccf571=_[_0x0b47('0x37')]({},_0xccf571,_0x9a2cc1['options']);return db[_0x0b47('0x30')][_0x0b47('0x38')](_0xccf571)[_0x0b47('0x29')](handleEntityNotFound(_0x1842ec,null))[_0x0b47('0x29')](respondWithResult(_0x1842ec,null))[_0x0b47('0x39')](handleError(_0x1842ec,null));};exports[_0x0b47('0x2a')]=function(_0x56a45e,_0x4948d5){return db['DashboardItem'][_0x0b47('0x38')]({'where':{'id':_0x56a45e[_0x0b47('0x3a')]['id']}})[_0x0b47('0x29')](handleEntityNotFound(_0x4948d5,null))[_0x0b47('0x29')](removeEntity(_0x4948d5,null))[_0x0b47('0x39')](handleError(_0x4948d5,null));};function widgetAttributes(_0x22227f){try{switch(_0x22227f['type']){case _0x0b47('0x3b'):return[{'name':_0x0b47('0x3c'),'value':_0x22227f[_0x0b47('0x3c')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x0]?_0x22227f['attrs'][0x0][_0x0b47('0x3e')]:undefined)||_0x0b47('0x3f')}];case'custom':return[{'name':_0x0b47('0x40'),'value':_0x22227f[_0x0b47('0x40')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x0]?_0x22227f['attrs'][0x0][_0x0b47('0x3e')]:undefined)||''}];case _0x0b47('0x41'):return[{'name':_0x0b47('0x42'),'value':_0x22227f[_0x0b47('0x42')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x0]?_0x22227f[_0x0b47('0x3d')][0x0][_0x0b47('0x3e')]:undefined)||_0x0b47('0x43')},{'name':_0x0b47('0x44'),'value':_0x22227f[_0x0b47('0x44')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x1]?_0x22227f['attrs'][0x1]['value']:undefined)||_0x0b47('0x45')},{'name':'attrFontSize','value':_0x22227f[_0x0b47('0x46')]||(_0x22227f['attrs']&&_0x22227f[_0x0b47('0x3d')][0x2]?_0x22227f[_0x0b47('0x3d')][0x2][_0x0b47('0x3e')]:undefined)||0xc}];case _0x0b47('0x47'):return[{'name':'attrMetric','value':_0x22227f[_0x0b47('0x48')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x0]?_0x22227f[_0x0b47('0x3d')][0x0]['value']:undefined)||_0x0b47('0x49')},{'name':_0x0b47('0x4a'),'value':_0x22227f[_0x0b47('0x4a')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x1]?_0x22227f[_0x0b47('0x3d')][0x1][_0x0b47('0x3e')]:undefined)||[]},{'name':_0x0b47('0x46'),'value':_0x22227f[_0x0b47('0x46')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x2]?_0x22227f['attrs'][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x22227f[_0x0b47('0x4b')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x3]?_0x22227f[_0x0b47('0x3d')][0x3]['value']:undefined)||_0x0b47('0x4c')},{'name':_0x0b47('0x4d'),'value':_0x22227f['attrEmailAccounts']||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x4]?_0x22227f[_0x0b47('0x3d')][0x4][_0x0b47('0x3e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x22227f[_0x0b47('0x4e')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x5]?_0x22227f['attrs'][0x5][_0x0b47('0x3e')]:undefined)||''},{'name':_0x0b47('0x4f'),'value':_0x22227f['attrSmsAccounts']||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x6]?_0x22227f['attrs'][0x6][_0x0b47('0x3e')]:undefined)||''},{'name':_0x0b47('0x50'),'value':_0x22227f['attrOpenchannelAccounts']||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x7]?_0x22227f[_0x0b47('0x3d')][0x7][_0x0b47('0x3e')]:undefined)||''},{'name':_0x0b47('0x51'),'value':_0x22227f['attrWhatsappAccounts']||(_0x22227f['attrs']&&_0x22227f[_0x0b47('0x3d')][0x8]?_0x22227f[_0x0b47('0x3d')][0x8][_0x0b47('0x3e')]:undefined)||''},{'name':_0x0b47('0x52'),'value':_0x22227f[_0x0b47('0x52')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x9]?_0x22227f[_0x0b47('0x3d')][0x9][_0x0b47('0x3e')]:undefined)||''}];case _0x0b47('0x53'):case _0x0b47('0x54'):return[{'name':'attrSerie1','value':_0x22227f[_0x0b47('0x55')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x0]?_0x22227f['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x22227f[_0x0b47('0x56')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x1]?_0x22227f[_0x0b47('0x3d')][0x1][_0x0b47('0x3e')]:undefined)||null},{'name':_0x0b47('0x57'),'value':_0x22227f['attrSerie3']||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x2]?_0x22227f[_0x0b47('0x3d')][0x2]['value']:undefined)||null},{'name':_0x0b47('0x4a'),'value':_0x22227f[_0x0b47('0x4a')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x3]?_0x22227f[_0x0b47('0x3d')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x22227f[_0x0b47('0x4b')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0x4]?_0x22227f[_0x0b47('0x3d')][0x4][_0x0b47('0x3e')]:undefined)||_0x0b47('0x4c')},{'name':_0x0b47('0x4d'),'value':_0x22227f[_0x0b47('0x4d')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x5]?_0x22227f[_0x0b47('0x3d')][0x5]['value']:undefined)||''},{'name':_0x0b47('0x4e'),'value':_0x22227f['attrFaxAccounts']||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x6]?_0x22227f[_0x0b47('0x3d')][0x6]['value']:undefined)||''},{'name':_0x0b47('0x4f'),'value':_0x22227f[_0x0b47('0x4f')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x7]?_0x22227f['attrs'][0x7][_0x0b47('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x22227f[_0x0b47('0x50')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x8]?_0x22227f[_0x0b47('0x3d')][0x8][_0x0b47('0x3e')]:undefined)||''},{'name':_0x0b47('0x51'),'value':_0x22227f[_0x0b47('0x51')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x9]?_0x22227f[_0x0b47('0x3d')][0x9][_0x0b47('0x3e')]:undefined)||''},{'name':_0x0b47('0x52'),'value':_0x22227f[_0x0b47('0x52')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f['attrs'][0xa]?_0x22227f[_0x0b47('0x3d')][0xa][_0x0b47('0x3e')]:undefined)||''}];case'web-report':return[{'name':_0x0b47('0x58'),'type':_0x22227f[_0x0b47('0x59')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x0]?_0x22227f[_0x0b47('0x3d')][0x0][_0x0b47('0x5a')]:undefined)||null,'value':_0x22227f['attrReport']||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x0]?_0x22227f[_0x0b47('0x3d')][0x0][_0x0b47('0x3e')]:undefined)||null},{'name':'attrRefresh','value':_0x22227f[_0x0b47('0x5b')]||(_0x22227f[_0x0b47('0x3d')]&&_0x22227f[_0x0b47('0x3d')][0x1]?_0x22227f['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x104410){logger['error'](_0x0b47('0x5c'),JSON[_0x0b47('0x5d')](_0x104410));return[];}}exports[_0x0b47('0x5e')]=function(_0x40c054,_0x51f551){if(_0x40c054[_0x0b47('0x5f')]){_0x40c054[_0x0b47('0x5f')][_0x0b47('0x3d')]=widgetAttributes(_0x40c054[_0x0b47('0x5f')]);}return db[_0x0b47('0x30')]['create'](_0x40c054['body'],{})[_0x0b47('0x29')](respondWithResult(_0x51f551,0xc9))[_0x0b47('0x39')](handleError(_0x51f551,null));};exports[_0x0b47('0x28')]=function(_0x5e34d0,_0x1bd576){if(_0x5e34d0['body']['id']){delete _0x5e34d0[_0x0b47('0x5f')]['id'];}_0x5e34d0[_0x0b47('0x5f')][_0x0b47('0x3d')]=widgetAttributes(_0x5e34d0[_0x0b47('0x5f')]);return db[_0x0b47('0x30')][_0x0b47('0x38')]({'where':{'id':_0x5e34d0[_0x0b47('0x3a')]['id']}})[_0x0b47('0x29')](handleEntityNotFound(_0x1bd576,null))[_0x0b47('0x29')](saveUpdates(_0x5e34d0[_0x0b47('0x5f')],null))[_0x0b47('0x29')](respondWithResult(_0x1bd576,null))[_0x0b47('0x39')](handleError(_0x1bd576,null));}; \ No newline at end of file +var _0x6ec2=['attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrOpenchannelAccounts','web-report','attrReport','reportType','type','attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','show','params','keys','rawAttributes','query','intersection','model','attributes','length','includeAll','merge','options','DashboardItem','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts'];(function(_0x7ad065,_0x3b9005){var _0x591984=function(_0x4a4e6a){while(--_0x4a4e6a){_0x7ad065['push'](_0x7ad065['shift']());}};_0x591984(++_0x3b9005);}(_0x6ec2,0x78));var _0x26ec=function(_0x421872,_0x3eff1b){_0x421872=_0x421872-0x0;var _0x1e5ab0=_0x6ec2[_0x421872];return _0x1e5ab0;};'use strict';var emlformat=require(_0x26ec('0x0'));var rimraf=require(_0x26ec('0x1'));var zipdir=require(_0x26ec('0x2'));var jsonpatch=require(_0x26ec('0x3'));var rp=require(_0x26ec('0x4'));var moment=require(_0x26ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ec('0x6'));var util=require(_0x26ec('0x7'));var path=require(_0x26ec('0x8'));var sox=require(_0x26ec('0x9'));var csv=require(_0x26ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ec('0xc'));var jsforce=require(_0x26ec('0xd'));var deskjs=require(_0x26ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x26ec('0x10'));var authService=require(_0x26ec('0x11'));var qs=require(_0x26ec('0x12'));var as=require(_0x26ec('0x13'));var hardwareService=require(_0x26ec('0x14'));var logger=require(_0x26ec('0x15'))(_0x26ec('0x16'));var utils=require(_0x26ec('0x17'));var config=require(_0x26ec('0x18'));var licenseUtil=require(_0x26ec('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x26ec('0x1a')](config[_0x26ec('0x1b')],{'host':_0x26ec('0x1c'),'port':0x18eb});var socket=require(_0x26ec('0x1d'))(new Redis(config[_0x26ec('0x1b')]));require(_0x26ec('0x1e'))[_0x26ec('0x1f')](socket);function respondWithStatusCode(_0x49467a,_0xfe9aa9){_0xfe9aa9=_0xfe9aa9||0xcc;return function(_0x21a743){if(_0x21a743){return _0x49467a[_0x26ec('0x20')](_0xfe9aa9);}return _0x49467a[_0x26ec('0x21')](_0xfe9aa9)['end']();};}function respondWithResult(_0x4d366c,_0x438985){_0x438985=_0x438985||0xc8;return function(_0x127385){if(_0x127385){return _0x4d366c[_0x26ec('0x21')](_0x438985)[_0x26ec('0x22')](_0x127385);}};}function respondWithFilteredResult(_0x49dc68,_0x17282d){return function(_0x176613){if(_0x176613){var _0x50c9de=typeof _0x17282d['offset']==='undefined'&&typeof _0x17282d[_0x26ec('0x23')]===_0x26ec('0x24');var _0x60511e=_0x176613['count'];var _0x4ad50c=_0x50c9de?0x0:_0x17282d[_0x26ec('0x25')];var _0x125fca=_0x50c9de?_0x176613[_0x26ec('0x26')]:_0x17282d[_0x26ec('0x25')]+_0x17282d[_0x26ec('0x23')];var _0xe199f2;if(_0x125fca>=_0x60511e){_0x125fca=_0x60511e;_0xe199f2=0xc8;}else{_0xe199f2=0xce;}_0x49dc68['status'](_0xe199f2);return _0x49dc68[_0x26ec('0x27')](_0x26ec('0x28'),_0x4ad50c+'-'+_0x125fca+'/'+_0x60511e)[_0x26ec('0x22')](_0x176613);}return null;};}function patchUpdates(_0x46f766){return function(_0x2bcf3c){try{jsonpatch['apply'](_0x2bcf3c,_0x46f766,!![]);}catch(_0x5202e6){return BPromise[_0x26ec('0x29')](_0x5202e6);}return _0x2bcf3c[_0x26ec('0x2a')]();};}function saveUpdates(_0x65aea3,_0x50e4e8){return function(_0x480e5d){if(_0x480e5d){return _0x480e5d[_0x26ec('0x2b')](_0x65aea3)[_0x26ec('0x2c')](function(_0x16aba4){return _0x16aba4;});}return null;};}function removeEntity(_0x365fac,_0x4030ea){return function(_0x89bd5f){if(_0x89bd5f){return _0x89bd5f[_0x26ec('0x2d')]()['then'](function(){_0x365fac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45509f,_0xddd5fc){return function(_0x352bef){if(!_0x352bef){_0x45509f[_0x26ec('0x20')](0x194);}return _0x352bef;};}function handleError(_0x19e0fc,_0x2fb176){_0x2fb176=_0x2fb176||0x1f4;return function(_0x3268e9){logger['error'](_0x3268e9[_0x26ec('0x2e')]);if(_0x3268e9['name']){delete _0x3268e9[_0x26ec('0x2f')];}_0x19e0fc[_0x26ec('0x21')](_0x2fb176)['send'](_0x3268e9);};}exports[_0x26ec('0x30')]=function(_0x2d30e6,_0x139d24){var _0x18999a={'raw':![],'where':{'id':_0x2d30e6[_0x26ec('0x31')]['id']}},_0x272c40={};_0x272c40['model']=_[_0x26ec('0x32')](db['DashboardItem'][_0x26ec('0x33')]);_0x272c40['query']=_[_0x26ec('0x32')](_0x2d30e6[_0x26ec('0x34')]);_0x272c40['filters']=_[_0x26ec('0x35')](_0x272c40[_0x26ec('0x36')],_0x272c40[_0x26ec('0x34')]);_0x18999a[_0x26ec('0x37')]=_[_0x26ec('0x35')](_0x272c40[_0x26ec('0x36')],qs['fields'](_0x2d30e6['query']['fields']));_0x18999a['attributes']=_0x18999a['attributes'][_0x26ec('0x38')]?_0x18999a[_0x26ec('0x37')]:_0x272c40[_0x26ec('0x36')];if(_0x2d30e6[_0x26ec('0x34')][_0x26ec('0x39')]){_0x18999a['include']=[{'all':!![]}];}_0x18999a=_[_0x26ec('0x3a')]({},_0x18999a,_0x2d30e6[_0x26ec('0x3b')]);return db[_0x26ec('0x3c')][_0x26ec('0x3d')](_0x18999a)[_0x26ec('0x2c')](handleEntityNotFound(_0x139d24,null))['then'](respondWithResult(_0x139d24,null))[_0x26ec('0x3e')](handleError(_0x139d24,null));};exports[_0x26ec('0x2d')]=function(_0x15391c,_0x18a226){return db[_0x26ec('0x3c')][_0x26ec('0x3d')]({'where':{'id':_0x15391c[_0x26ec('0x31')]['id']}})[_0x26ec('0x2c')](handleEntityNotFound(_0x18a226,null))[_0x26ec('0x2c')](removeEntity(_0x18a226,null))[_0x26ec('0x3e')](handleError(_0x18a226,null));};function widgetAttributes(_0x48d7cf){try{switch(_0x48d7cf['type']){case _0x26ec('0x3f'):return[{'name':_0x26ec('0x40'),'value':_0x48d7cf['attrUrl']||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf['attrs'][0x0]?_0x48d7cf[_0x26ec('0x41')][0x0][_0x26ec('0x42')]:undefined)||_0x26ec('0x43')}];case _0x26ec('0x44'):return[{'name':_0x26ec('0x45'),'value':_0x48d7cf[_0x26ec('0x45')]||(_0x48d7cf['attrs']&&_0x48d7cf[_0x26ec('0x41')][0x0]?_0x48d7cf[_0x26ec('0x41')][0x0][_0x26ec('0x42')]:undefined)||''}];case _0x26ec('0x46'):return[{'name':_0x26ec('0x47'),'value':_0x48d7cf[_0x26ec('0x47')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x0]?_0x48d7cf[_0x26ec('0x41')][0x0][_0x26ec('0x42')]:undefined)||_0x26ec('0x48')},{'name':_0x26ec('0x49'),'value':_0x48d7cf[_0x26ec('0x49')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x1]?_0x48d7cf['attrs'][0x1][_0x26ec('0x42')]:undefined)||_0x26ec('0x4a')},{'name':_0x26ec('0x4b'),'value':_0x48d7cf[_0x26ec('0x4b')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x2]?_0x48d7cf['attrs'][0x2]['value']:undefined)||0xc}];case _0x26ec('0x4c'):return[{'name':'attrMetric','value':_0x48d7cf[_0x26ec('0x4d')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x0]?_0x48d7cf[_0x26ec('0x41')][0x0][_0x26ec('0x42')]:undefined)||_0x26ec('0x4e')},{'name':_0x26ec('0x4f'),'value':_0x48d7cf[_0x26ec('0x4f')]||(_0x48d7cf['attrs']&&_0x48d7cf[_0x26ec('0x41')][0x1]?_0x48d7cf[_0x26ec('0x41')][0x1][_0x26ec('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x48d7cf[_0x26ec('0x4b')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x2]?_0x48d7cf[_0x26ec('0x41')][0x2][_0x26ec('0x42')]:undefined)||0x14},{'name':_0x26ec('0x50'),'value':_0x48d7cf[_0x26ec('0x50')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x3]?_0x48d7cf[_0x26ec('0x41')][0x3][_0x26ec('0x42')]:undefined)||_0x26ec('0x51')},{'name':_0x26ec('0x52'),'value':_0x48d7cf[_0x26ec('0x52')]||(_0x48d7cf['attrs']&&_0x48d7cf['attrs'][0x4]?_0x48d7cf[_0x26ec('0x41')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x48d7cf[_0x26ec('0x53')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x5]?_0x48d7cf['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x48d7cf['attrSmsAccounts']||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf['attrs'][0x6]?_0x48d7cf[_0x26ec('0x41')][0x6][_0x26ec('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x48d7cf['attrOpenchannelAccounts']||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x7]?_0x48d7cf['attrs'][0x7][_0x26ec('0x42')]:undefined)||''},{'name':_0x26ec('0x54'),'value':_0x48d7cf['attrWhatsappAccounts']||(_0x48d7cf['attrs']&&_0x48d7cf[_0x26ec('0x41')][0x8]?_0x48d7cf[_0x26ec('0x41')][0x8][_0x26ec('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x48d7cf[_0x26ec('0x55')]||(_0x48d7cf['attrs']&&_0x48d7cf[_0x26ec('0x41')][0x9]?_0x48d7cf[_0x26ec('0x41')][0x9][_0x26ec('0x42')]:undefined)||''}];case _0x26ec('0x56'):case _0x26ec('0x57'):return[{'name':_0x26ec('0x58'),'value':_0x48d7cf['attrSerie1']||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x0]?_0x48d7cf['attrs'][0x0][_0x26ec('0x42')]:undefined)||_0x26ec('0x4e')},{'name':'attrSerie2','value':_0x48d7cf[_0x26ec('0x59')]||(_0x48d7cf['attrs']&&_0x48d7cf['attrs'][0x1]?_0x48d7cf[_0x26ec('0x41')][0x1][_0x26ec('0x42')]:undefined)||null},{'name':_0x26ec('0x5a'),'value':_0x48d7cf['attrSerie3']||(_0x48d7cf['attrs']&&_0x48d7cf[_0x26ec('0x41')][0x2]?_0x48d7cf[_0x26ec('0x41')][0x2][_0x26ec('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x48d7cf[_0x26ec('0x4f')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf['attrs'][0x3]?_0x48d7cf['attrs'][0x3][_0x26ec('0x42')]:undefined)||[]},{'name':'attrChannel','value':_0x48d7cf[_0x26ec('0x50')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x4]?_0x48d7cf[_0x26ec('0x41')][0x4]['value']:undefined)||'voice'},{'name':_0x26ec('0x52'),'value':_0x48d7cf[_0x26ec('0x52')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x5]?_0x48d7cf[_0x26ec('0x41')][0x5][_0x26ec('0x42')]:undefined)||''},{'name':_0x26ec('0x53'),'value':_0x48d7cf['attrFaxAccounts']||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x6]?_0x48d7cf[_0x26ec('0x41')][0x6][_0x26ec('0x42')]:undefined)||''},{'name':_0x26ec('0x5b'),'value':_0x48d7cf[_0x26ec('0x5b')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf['attrs'][0x7]?_0x48d7cf[_0x26ec('0x41')][0x7][_0x26ec('0x42')]:undefined)||''},{'name':_0x26ec('0x5c'),'value':_0x48d7cf[_0x26ec('0x5c')]||(_0x48d7cf['attrs']&&_0x48d7cf[_0x26ec('0x41')][0x8]?_0x48d7cf[_0x26ec('0x41')][0x8]['value']:undefined)||''},{'name':_0x26ec('0x54'),'value':_0x48d7cf[_0x26ec('0x54')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x9]?_0x48d7cf[_0x26ec('0x41')][0x9][_0x26ec('0x42')]:undefined)||''},{'name':_0x26ec('0x55'),'value':_0x48d7cf['attrChatWebsites']||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0xa]?_0x48d7cf['attrs'][0xa][_0x26ec('0x42')]:undefined)||''}];case _0x26ec('0x5d'):return[{'name':_0x26ec('0x5e'),'type':_0x48d7cf[_0x26ec('0x5f')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x0]?_0x48d7cf[_0x26ec('0x41')][0x0][_0x26ec('0x60')]:undefined)||null,'value':_0x48d7cf[_0x26ec('0x5e')]||(_0x48d7cf[_0x26ec('0x41')]&&_0x48d7cf[_0x26ec('0x41')][0x0]?_0x48d7cf[_0x26ec('0x41')][0x0][_0x26ec('0x42')]:undefined)||null},{'name':_0x26ec('0x61'),'value':_0x48d7cf[_0x26ec('0x61')]||(_0x48d7cf['attrs']&&_0x48d7cf['attrs'][0x1]?_0x48d7cf['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x263bce){logger[_0x26ec('0x62')](_0x26ec('0x63'),JSON['stringify'](_0x263bce));return[];}}exports[_0x26ec('0x64')]=function(_0x57960c,_0x414be5){if(_0x57960c[_0x26ec('0x65')]){_0x57960c[_0x26ec('0x65')]['attrs']=widgetAttributes(_0x57960c[_0x26ec('0x65')]);}return db[_0x26ec('0x3c')][_0x26ec('0x64')](_0x57960c[_0x26ec('0x65')],{})[_0x26ec('0x2c')](respondWithResult(_0x414be5,0xc9))['catch'](handleError(_0x414be5,null));};exports[_0x26ec('0x2b')]=function(_0x311b55,_0x50e74b){if(_0x311b55[_0x26ec('0x65')]['id']){delete _0x311b55[_0x26ec('0x65')]['id'];}_0x311b55[_0x26ec('0x65')]['attrs']=widgetAttributes(_0x311b55[_0x26ec('0x65')]);return db[_0x26ec('0x3c')][_0x26ec('0x3d')]({'where':{'id':_0x311b55[_0x26ec('0x31')]['id']}})[_0x26ec('0x2c')](handleEntityNotFound(_0x50e74b,null))[_0x26ec('0x2c')](saveUpdates(_0x311b55[_0x26ec('0x65')],null))[_0x26ec('0x2c')](respondWithResult(_0x50e74b,null))[_0x26ec('0x3e')](handleError(_0x50e74b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 91d75e4..e56c8f1 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 _0x5885=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x51317c,_0x11b709){var _0x1700ae=function(_0x3e64bf){while(--_0x3e64bf){_0x51317c['push'](_0x51317c['shift']());}};_0x1700ae(++_0x11b709);}(_0x5885,0x7f));var _0x5588=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5885[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5588('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5588('0x1')](0x0);var events={'afterCreate':_0x5588('0x2'),'afterUpdate':_0x5588('0x3'),'afterDestroy':_0x5588('0x4')};function emitEvent(_0x24e7ec){return function(_0xd608f8,_0xf673b,_0x99a5ae){DashboardItemEvents[_0x5588('0x5')](_0x24e7ec+':'+_0xd608f8['id'],_0xd608f8);DashboardItemEvents['emit'](_0x24e7ec,_0xd608f8);_0x99a5ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x5588('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xfcf9=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x554611,_0x11ced4){var _0x4fbc11=function(_0x5e34d5){while(--_0x5e34d5){_0x554611['push'](_0x554611['shift']());}};_0x4fbc11(++_0x11ced4);}(_0xfcf9,0xc8));var _0x9fcf=function(_0x42496b,_0x336459){_0x42496b=_0x42496b-0x0;var _0x41f015=_0xfcf9[_0x42496b];return _0x41f015;};'use strict';var EventEmitter=require(_0x9fcf('0x0'));var DashboardItem=require(_0x9fcf('0x1'))['db'][_0x9fcf('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9fcf('0x3')](0x0);var events={'afterCreate':_0x9fcf('0x4'),'afterUpdate':_0x9fcf('0x5'),'afterDestroy':_0x9fcf('0x6')};function emitEvent(_0x4e747b){return function(_0x475d4b,_0x2eb5f2,_0x5e4f68){DashboardItemEvents[_0x9fcf('0x7')](_0x4e747b+':'+_0x475d4b['id'],_0x475d4b);DashboardItemEvents[_0x9fcf('0x7')](_0x4e747b,_0x475d4b);_0x5e4f68(null);};}for(var e in events){if(events[_0x9fcf('0x8')](e)){var event=events[e];DashboardItem[_0x9fcf('0x9')](e,emitEvent(event));}}module[_0x9fcf('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 649d78e..914c01b 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 _0xf352=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x561192,_0x1b1235){var _0xb44625=function(_0x4c0f18){while(--_0x4c0f18){_0x561192['push'](_0x561192['shift']());}};_0xb44625(++_0x1b1235);}(_0xf352,0x1ac));var _0x2f35=function(_0x4ec24b,_0x1738a8){_0x4ec24b=_0x4ec24b-0x0;var _0x1a5b51=_0xf352[_0x4ec24b];return _0x1a5b51;};'use strict';var _=require(_0x2f35('0x0'));var util=require(_0x2f35('0x1'));var logger=require(_0x2f35('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2f35('0x3'));var rp=require(_0x2f35('0x4'));var fs=require('fs');var path=require(_0x2f35('0x5'));var rimraf=require(_0x2f35('0x6'));var config=require(_0x2f35('0x7'));var attributes=require(_0x2f35('0x8'));module[_0x2f35('0x9')]=function(_0x25308e,_0x3bea5a){return _0x25308e[_0x2f35('0xa')](_0x2f35('0xb'),attributes,{'tableName':_0x2f35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb31a=['define','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x4c7192,_0x526e25){var _0x113a26=function(_0x5ee384){while(--_0x5ee384){_0x4c7192['push'](_0x4c7192['shift']());}};_0x113a26(++_0x526e25);}(_0xb31a,0xd4));var _0xab31=function(_0x467a76,_0x1c1058){_0x467a76=_0x467a76-0x0;var _0x5773b7=_0xb31a[_0x467a76];return _0x5773b7;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var logger=require(_0xab31('0x2'))(_0xab31('0x3'));var moment=require(_0xab31('0x4'));var BPromise=require(_0xab31('0x5'));var rp=require(_0xab31('0x6'));var fs=require('fs');var path=require(_0xab31('0x7'));var rimraf=require(_0xab31('0x8'));var config=require(_0xab31('0x9'));var attributes=require(_0xab31('0xa'));module[_0xab31('0xb')]=function(_0x9c6740,_0x2c336b){return _0x9c6740[_0xab31('0xc')]('DashboardItem',attributes,{'tableName':_0xab31('0xd'),'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 49777a9..7f2cfa5 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 _0xa8dd=['socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost'];(function(_0x3599fc,_0x5455e8){var _0x5991c7=function(_0x82374f){while(--_0x82374f){_0x3599fc['push'](_0x3599fc['shift']());}};_0x5991c7(++_0x5455e8);}(_0xa8dd,0x15f));var _0xda8d=function(_0x317b2e,_0x165181){_0x317b2e=_0x317b2e-0x0;var _0x1a30d6=_0xa8dd[_0x317b2e];return _0x1a30d6;};'use strict';var _=require(_0xda8d('0x0'));var util=require(_0xda8d('0x1'));var moment=require(_0xda8d('0x2'));var BPromise=require(_0xda8d('0x3'));var rs=require(_0xda8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda8d('0x5'))['db'];var utils=require(_0xda8d('0x6'));var logger=require('../../config/logger')(_0xda8d('0x7'));var config=require(_0xda8d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xda8d('0x9')]['http']({'port':0x232a});config[_0xda8d('0xa')]=_[_0xda8d('0xb')](config[_0xda8d('0xa')],{'host':_0xda8d('0xc'),'port':0x18eb});var socket=require(_0xda8d('0xd'))(new Redis(config[_0xda8d('0xa')]));require(_0xda8d('0xe'))[_0xda8d('0xf')](socket);function respondWithRpcPromise(_0x1314f6,_0x1533f8,_0x258c7d){return new BPromise(function(_0x15d51b,_0x194a6e){return client[_0xda8d('0x10')](_0x1314f6,_0x258c7d)[_0xda8d('0x11')](function(_0x2ce6f8){logger['info']('DashboardItem,\x20%s,\x20%s',_0x1533f8,_0xda8d('0x12'));logger[_0xda8d('0x13')](_0xda8d('0x14'),_0x1533f8,_0xda8d('0x12'),JSON[_0xda8d('0x15')](_0x2ce6f8));if(_0x2ce6f8[_0xda8d('0x16')]){if(_0x2ce6f8[_0xda8d('0x16')][_0xda8d('0x17')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x1533f8,_0x2ce6f8[_0xda8d('0x16')][_0xda8d('0x18')]);return _0x194a6e(_0x2ce6f8['error'][_0xda8d('0x18')]);}logger[_0xda8d('0x16')](_0xda8d('0x19'),_0x1533f8,_0x2ce6f8[_0xda8d('0x16')][_0xda8d('0x18')]);return _0x15d51b(_0x2ce6f8[_0xda8d('0x16')][_0xda8d('0x18')]);}else{logger[_0xda8d('0x1a')](_0xda8d('0x19'),_0x1533f8,_0xda8d('0x12'));_0x15d51b(_0x2ce6f8[_0xda8d('0x1b')]['message']);}})['catch'](function(_0x6ee67f){logger[_0xda8d('0x16')](_0xda8d('0x19'),_0x1533f8,_0x6ee67f);_0x194a6e(_0x6ee67f);});});} \ No newline at end of file +var _0x39fb=['info','DashboardItem,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','./dashboardItem.socket','register','request','then'];(function(_0x94bc1f,_0x1a3927){var _0x28f8e2=function(_0x511435){while(--_0x511435){_0x94bc1f['push'](_0x94bc1f['shift']());}};_0x28f8e2(++_0x1a3927);}(_0x39fb,0x1d0));var _0xb39f=function(_0x1e9827,_0x4c26e6){_0x1e9827=_0x1e9827-0x0;var _0x84e342=_0x39fb[_0x1e9827];return _0x84e342;};'use strict';var _=require(_0xb39f('0x0'));var util=require(_0xb39f('0x1'));var moment=require(_0xb39f('0x2'));var BPromise=require(_0xb39f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb39f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb39f('0x6'));var jayson=require(_0xb39f('0x7'));var client=jayson[_0xb39f('0x8')][_0xb39f('0x9')]({'port':0x232a});config[_0xb39f('0xa')]=_['defaults'](config[_0xb39f('0xa')],{'host':_0xb39f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb39f('0xa')]));require(_0xb39f('0xc'))[_0xb39f('0xd')](socket);function respondWithRpcPromise(_0x5497a1,_0xa62f7,_0x497da3){return new BPromise(function(_0x212f21,_0x11a348){return client[_0xb39f('0xe')](_0x5497a1,_0x497da3)[_0xb39f('0xf')](function(_0x15e93c){logger[_0xb39f('0x10')](_0xb39f('0x11'),_0xa62f7,'request\x20sent');logger[_0xb39f('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xa62f7,'request\x20sent',JSON[_0xb39f('0x13')](_0x15e93c));if(_0x15e93c[_0xb39f('0x14')]){if(_0x15e93c[_0xb39f('0x14')]['code']===0x1f4){logger[_0xb39f('0x14')]('DashboardItem,\x20%s,\x20%s',_0xa62f7,_0x15e93c[_0xb39f('0x14')][_0xb39f('0x15')]);return _0x11a348(_0x15e93c[_0xb39f('0x14')][_0xb39f('0x15')]);}logger[_0xb39f('0x14')]('DashboardItem,\x20%s,\x20%s',_0xa62f7,_0x15e93c['error']['message']);return _0x212f21(_0x15e93c['error'][_0xb39f('0x15')]);}else{logger[_0xb39f('0x10')](_0xb39f('0x11'),_0xa62f7,_0xb39f('0x16'));_0x212f21(_0x15e93c[_0xb39f('0x17')][_0xb39f('0x15')]);}})['catch'](function(_0x1fd6ff){logger[_0xb39f('0x14')](_0xb39f('0x11'),_0xa62f7,_0x1fd6ff);_0x11a348(_0x1fd6ff);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8a6f468..0a1c69b 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 _0x926d=['emit','removeListener','register','./dashboardItem.events','save','remove','update'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x926d,0xa4));var _0xd926=function(_0xe6f4dc,_0x4bd94a){_0xe6f4dc=_0xe6f4dc-0x0;var _0x1e9ede=_0x926d[_0xe6f4dc];return _0x1e9ede;};'use strict';var DashboardItemEvents=require(_0xd926('0x0'));var events=[_0xd926('0x1'),_0xd926('0x2'),_0xd926('0x3')];function createListener(_0xce95f5,_0x4c7a5c){return function(_0x5a02cb){_0x4c7a5c[_0xd926('0x4')](_0xce95f5,_0x5a02cb);};}function removeListener(_0x45740e,_0x297ad9){return function(){DashboardItemEvents[_0xd926('0x5')](_0x45740e,_0x297ad9);};}exports[_0xd926('0x6')]=function(_0x33736c){for(var _0x22e59e=0x0,_0x1ef3c9=events['length'];_0x22e59e<_0x1ef3c9;_0x22e59e++){var _0x46bf0b=events[_0x22e59e];var _0x155c29=createListener('dashboardItem:'+_0x46bf0b,_0x33736c);DashboardItemEvents['on'](_0x46bf0b,_0x155c29);}}; \ No newline at end of file +var _0x9d65=['register','length','dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener'];(function(_0xefd875,_0x373a64){var _0x4b1fd8=function(_0x4bb557){while(--_0x4bb557){_0xefd875['push'](_0xefd875['shift']());}};_0x4b1fd8(++_0x373a64);}(_0x9d65,0x153));var _0x59d6=function(_0x46b2e6,_0xc7bc10){_0x46b2e6=_0x46b2e6-0x0;var _0xf6aad2=_0x9d65[_0x46b2e6];return _0xf6aad2;};'use strict';var DashboardItemEvents=require(_0x59d6('0x0'));var events=[_0x59d6('0x1'),_0x59d6('0x2'),'update'];function createListener(_0x2514a7,_0x16a8f9){return function(_0x4a7ad7){_0x16a8f9[_0x59d6('0x3')](_0x2514a7,_0x4a7ad7);};}function removeListener(_0x514c54,_0x2b2e19){return function(){DashboardItemEvents[_0x59d6('0x4')](_0x514c54,_0x2b2e19);};}exports[_0x59d6('0x5')]=function(_0x3f3c42){for(var _0x4bfdf0=0x0,_0xe861cd=events[_0x59d6('0x6')];_0x4bfdf0<_0xe861cd;_0x4bfdf0++){var _0x518aa1=events[_0x4bfdf0];var _0x536c9e=createListener(_0x59d6('0x7')+_0x518aa1,_0x3f3c42);DashboardItemEvents['on'](_0x518aa1,_0x536c9e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index cb79add..90231e8 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 _0x778c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','exports','path','Router'];(function(_0x27b3df,_0x34a01a){var _0x275390=function(_0x46e282){while(--_0x46e282){_0x27b3df['push'](_0x27b3df['shift']());}};_0x275390(++_0x34a01a);}(_0x778c,0xfd));var _0xc778=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0x778c[_0x38c652];return _0x218a37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc778('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc778('0x1')]();var fs_extra=require(_0xc778('0x2'));var auth=require(_0xc778('0x3'));var interaction=require(_0xc778('0x4'));var config=require(_0xc778('0x5'));var controller=require(_0xc778('0x6'));router[_0xc778('0x7')](_0xc778('0x8'),auth['isAuthenticated'](),controller[_0xc778('0x9')]);router[_0xc778('0xa')]('/',auth[_0xc778('0xb')](),controller[_0xc778('0xc')]);router[_0xc778('0xd')](_0xc778('0x8'),auth[_0xc778('0xb')](),controller['update']);router['delete'](_0xc778('0x8'),auth[_0xc778('0xb')](),controller['destroy']);module[_0xc778('0xe')]=router; \ No newline at end of file +var _0x643a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x643a,0x95));var _0xa643=function(_0xeeb156,_0x5392f4){_0xeeb156=_0xeeb156-0x0;var _0x4b7c74=_0x643a[_0xeeb156];return _0x4b7c74;};'use strict';var multer=require(_0xa643('0x0'));var util=require('util');var path=require(_0xa643('0x1'));var timeout=require(_0xa643('0x2'));var express=require('express');var router=express[_0xa643('0x3')]();var fs_extra=require(_0xa643('0x4'));var auth=require(_0xa643('0x5'));var interaction=require(_0xa643('0x6'));var config=require(_0xa643('0x7'));var controller=require(_0xa643('0x8'));router[_0xa643('0x9')](_0xa643('0xa'),auth[_0xa643('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa643('0xc')]);router[_0xa643('0xd')](_0xa643('0xa'),auth[_0xa643('0xb')](),controller[_0xa643('0xe')]);router[_0xa643('0xf')](_0xa643('0xa'),auth[_0xa643('0xb')](),controller[_0xa643('0x10')]);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 ab048c3..5f083c3 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 _0x8e1b=['sequelize','exports','first','second','third','STRING'];(function(_0x24adc2,_0x175b5a){var _0x24cf9b=function(_0x65738d){while(--_0x65738d){_0x24adc2['push'](_0x24adc2['shift']());}};_0x24cf9b(++_0x175b5a);}(_0x8e1b,0x132));var _0xb8e1=function(_0x2fbe1a,_0x5412d9){_0x2fbe1a=_0x2fbe1a-0x0;var _0x30a0a1=_0x8e1b[_0x2fbe1a];return _0x30a0a1;};'use strict';var Sequelize=require(_0xb8e1('0x0'));module[_0xb8e1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xb8e1('0x2'),_0xb8e1('0x3'),_0xb8e1('0x4')),'allowNull':![],'defaultValue':_0xb8e1('0x2')},'description':{'type':Sequelize[_0xb8e1('0x5')]}}; \ No newline at end of file +var _0x2c92=['ENUM','second','first','STRING','sequelize','exports'];(function(_0x5f5b7e,_0x2303a7){var _0x110118=function(_0x15105d){while(--_0x15105d){_0x5f5b7e['push'](_0x5f5b7e['shift']());}};_0x110118(++_0x2303a7);}(_0x2c92,0x1ba));var _0x22c9=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x2c92[_0x52f1e6];return _0x21f104;};'use strict';var Sequelize=require(_0x22c9('0x0'));module[_0x22c9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x22c9('0x2')]('first',_0x22c9('0x3'),'third'),'allowNull':![],'defaultValue':_0x22c9('0x4')},'description':{'type':Sequelize[_0x22c9('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6bc59d8..c2bf268 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 _0x83c8=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','get','UserProfileResource','then','stack','send','map','Disposition','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','merge','name','options','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x83c8,0x8a));var _0x883c=function(_0x552e94,_0x110f92){_0x552e94=_0x552e94-0x0;var _0x12587b=_0x83c8[_0x552e94];return _0x12587b;};'use strict';var emlformat=require(_0x883c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x883c('0x1'));var rp=require('request-promise');var moment=require(_0x883c('0x2'));var BPromise=require(_0x883c('0x3'));var Mustache=require(_0x883c('0x4'));var util=require(_0x883c('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x883c('0x6'));var fs=require('fs');var fs_extra=require(_0x883c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x883c('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x883c('0x9'));var querystring=require(_0x883c('0xa'));var Papa=require(_0x883c('0xb'));var Redis=require('ioredis');var authService=require(_0x883c('0xc'));var qs=require(_0x883c('0xd'));var as=require(_0x883c('0xe'));var hardwareService=require(_0x883c('0xf'));var logger=require('../../config/logger')(_0x883c('0x10'));var utils=require(_0x883c('0x11'));var config=require(_0x883c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x883c('0x13'))['db'];function respondWithStatusCode(_0x56b57c,_0x13924f){_0x13924f=_0x13924f||0xcc;return function(_0x53472c){if(_0x53472c){return _0x56b57c[_0x883c('0x14')](_0x13924f);}return _0x56b57c[_0x883c('0x15')](_0x13924f)[_0x883c('0x16')]();};}function respondWithResult(_0x557747,_0xb86cdc){_0xb86cdc=_0xb86cdc||0xc8;return function(_0x2ac17f){if(_0x2ac17f){return _0x557747[_0x883c('0x15')](_0xb86cdc)[_0x883c('0x17')](_0x2ac17f);}};}function respondWithFilteredResult(_0x485b1e,_0xfbc8e5){return function(_0x49ebcd){if(_0x49ebcd){var _0x2fdf89=typeof _0xfbc8e5['offset']==='undefined'&&typeof _0xfbc8e5[_0x883c('0x18')]===_0x883c('0x19');var _0x4eaffb=_0x49ebcd[_0x883c('0x1a')];var _0x2620cc=_0x2fdf89?0x0:_0xfbc8e5['offset'];var _0x43bdaf=_0x2fdf89?_0x49ebcd[_0x883c('0x1a')]:_0xfbc8e5[_0x883c('0x1b')]+_0xfbc8e5['limit'];var _0x162fd6;if(_0x43bdaf>=_0x4eaffb){_0x43bdaf=_0x4eaffb;_0x162fd6=0xc8;}else{_0x162fd6=0xce;}_0x485b1e[_0x883c('0x15')](_0x162fd6);return _0x485b1e['set'](_0x883c('0x1c'),_0x2620cc+'-'+_0x43bdaf+'/'+_0x4eaffb)[_0x883c('0x17')](_0x49ebcd);}return null;};}function patchUpdates(_0x5c5c9b){return function(_0x4f170f){try{jsonpatch[_0x883c('0x1d')](_0x4f170f,_0x5c5c9b,!![]);}catch(_0x3cb479){return BPromise[_0x883c('0x1e')](_0x3cb479);}return _0x4f170f[_0x883c('0x1f')]();};}function saveUpdates(_0x29af50,_0x500318){return function(_0x466343){if(_0x466343){return _0x466343['update'](_0x29af50)['then'](function(_0x1ee27d){return _0x1ee27d;});}return null;};}function removeEntity(_0x55b913,_0x13ead7){return function(_0x57bb5e){if(_0x57bb5e){return _0x57bb5e['destroy']()['then'](function(){var _0x55f230=_0x57bb5e[_0x883c('0x20')]({'plain':!![]});var _0x464ffb='Dispositions';return db[_0x883c('0x21')]['destroy']({'where':{'type':_0x464ffb,'resourceId':_0x55f230['id']}})['then'](function(){return _0x57bb5e;});})[_0x883c('0x22')](function(){_0x55b913[_0x883c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db028,_0x2b81cf){return function(_0x42ed9f){if(!_0x42ed9f){_0x2db028[_0x883c('0x14')](0x194);}return _0x42ed9f;};}function handleError(_0x140676,_0x262252){_0x262252=_0x262252||0x1f4;return function(_0x5eb919){logger['error'](_0x5eb919[_0x883c('0x23')]);if(_0x5eb919['name']){delete _0x5eb919['name'];}_0x140676['status'](_0x262252)[_0x883c('0x24')](_0x5eb919);};}exports['index']=function(_0x6560e,_0x14a1c3){var _0x5f3445={},_0xcb97b7={},_0x20af59={'count':0x0,'rows':[]};var _0x1940bd=_[_0x883c('0x25')](db[_0x883c('0x26')][_0x883c('0x27')],function(_0x55d479){return{'name':_0x55d479['fieldName'],'type':_0x55d479[_0x883c('0x28')][_0x883c('0x29')]};});_0xcb97b7['model']=_['map'](_0x1940bd,'name');_0xcb97b7[_0x883c('0x2a')]=_[_0x883c('0x2b')](_0x6560e['query']);_0xcb97b7['filters']=_[_0x883c('0x2c')](_0xcb97b7[_0x883c('0x2d')],_0xcb97b7[_0x883c('0x2a')]);_0x5f3445['attributes']=_[_0x883c('0x2c')](_0xcb97b7[_0x883c('0x2d')],qs[_0x883c('0x2e')](_0x6560e[_0x883c('0x2a')][_0x883c('0x2e')]));_0x5f3445[_0x883c('0x2f')]=_0x5f3445[_0x883c('0x2f')][_0x883c('0x30')]?_0x5f3445[_0x883c('0x2f')]:_0xcb97b7[_0x883c('0x2d')];if(!_0x6560e[_0x883c('0x2a')]['hasOwnProperty']('nolimit')){_0x5f3445[_0x883c('0x18')]=qs[_0x883c('0x18')](_0x6560e['query'][_0x883c('0x18')]);_0x5f3445[_0x883c('0x1b')]=qs['offset'](_0x6560e[_0x883c('0x2a')][_0x883c('0x1b')]);}_0x5f3445[_0x883c('0x31')]=qs['sort'](_0x6560e[_0x883c('0x2a')][_0x883c('0x32')]);_0x5f3445[_0x883c('0x33')]=qs[_0x883c('0x34')](_[_0x883c('0x35')](_0x6560e[_0x883c('0x2a')],_0xcb97b7[_0x883c('0x34')]),_0x1940bd);if(_0x6560e[_0x883c('0x2a')][_0x883c('0x36')]){_0x5f3445[_0x883c('0x33')]=_[_0x883c('0x37')](_0x5f3445['where'],{'$or':_[_0x883c('0x25')](_0x1940bd,function(_0x2c2f8c){if(_0x2c2f8c[_0x883c('0x28')]!=='VIRTUAL'){var _0x5edfc7={};_0x5edfc7[_0x2c2f8c[_0x883c('0x38')]]={'$like':'%'+_0x6560e['query'][_0x883c('0x36')]+'%'};return _0x5edfc7;}})});}_0x5f3445=_[_0x883c('0x37')]({},_0x5f3445,_0x6560e[_0x883c('0x39')]);var _0x197379={'where':_0x5f3445[_0x883c('0x33')]};return db['Disposition']['count'](_0x197379)[_0x883c('0x22')](function(_0x49e546){_0x20af59[_0x883c('0x1a')]=_0x49e546;if(_0x6560e[_0x883c('0x2a')][_0x883c('0x3a')]){_0x5f3445[_0x883c('0x3b')]=[{'all':!![]}];}return db[_0x883c('0x26')][_0x883c('0x3c')](_0x5f3445);})['then'](function(_0x993d51){_0x20af59[_0x883c('0x3d')]=_0x993d51;return _0x20af59;})[_0x883c('0x22')](respondWithFilteredResult(_0x14a1c3,_0x5f3445))[_0x883c('0x3e')](handleError(_0x14a1c3,null));};exports['show']=function(_0x4847a4,_0x44b000){var _0x12404f={'raw':!![],'where':{'id':_0x4847a4[_0x883c('0x3f')]['id']}},_0x308fc5={};_0x308fc5[_0x883c('0x2d')]=_[_0x883c('0x2b')](db['Disposition'][_0x883c('0x27')]);_0x308fc5[_0x883c('0x2a')]=_['keys'](_0x4847a4[_0x883c('0x2a')]);_0x308fc5[_0x883c('0x34')]=_[_0x883c('0x2c')](_0x308fc5[_0x883c('0x2d')],_0x308fc5[_0x883c('0x2a')]);_0x12404f[_0x883c('0x2f')]=_[_0x883c('0x2c')](_0x308fc5[_0x883c('0x2d')],qs[_0x883c('0x2e')](_0x4847a4[_0x883c('0x2a')][_0x883c('0x2e')]));_0x12404f[_0x883c('0x2f')]=_0x12404f['attributes'][_0x883c('0x30')]?_0x12404f[_0x883c('0x2f')]:_0x308fc5[_0x883c('0x2d')];if(_0x4847a4['query'][_0x883c('0x3a')]){_0x12404f[_0x883c('0x3b')]=[{'all':!![]}];}_0x12404f=_['merge']({},_0x12404f,_0x4847a4[_0x883c('0x39')]);return db[_0x883c('0x26')]['find'](_0x12404f)[_0x883c('0x22')](handleEntityNotFound(_0x44b000,null))[_0x883c('0x22')](respondWithResult(_0x44b000,null))[_0x883c('0x3e')](handleError(_0x44b000,null));};exports[_0x883c('0x40')]=function(_0x14b4a7,_0x22971a){return db[_0x883c('0x26')][_0x883c('0x40')](_0x14b4a7[_0x883c('0x41')],{})['then'](function(_0x28b99a){var _0x5388c5=_0x14b4a7[_0x883c('0x42')]['get']({'plain':!![]});if(!_0x5388c5)throw new Error(_0x883c('0x43'));if(_0x5388c5[_0x883c('0x44')]==='user'){var _0x4efec3=_0x28b99a[_0x883c('0x20')]({'plain':!![]});var _0x25e2b5=_0x883c('0x45');return db['UserProfileSection'][_0x883c('0x46')]({'where':{'name':_0x25e2b5,'userProfileId':_0x5388c5[_0x883c('0x47')]},'raw':!![]})['then'](function(_0x33285d){if(_0x33285d&&_0x33285d['autoAssociation']===0x0){return db[_0x883c('0x21')][_0x883c('0x40')]({'name':_0x4efec3[_0x883c('0x38')],'resourceId':_0x4efec3['id'],'type':_0x33285d[_0x883c('0x38')],'sectionId':_0x33285d['id']},{})['then'](function(){return _0x28b99a;});}else{return _0x28b99a;}})['catch'](function(_0x129731){logger[_0x883c('0x48')](_0x883c('0x49'),_0x129731);throw _0x129731;});}return _0x28b99a;})[_0x883c('0x22')](respondWithResult(_0x22971a,0xc9))[_0x883c('0x3e')](handleError(_0x22971a,null));};exports[_0x883c('0x4a')]=function(_0x2f547a,_0x255572){if(_0x2f547a[_0x883c('0x41')]['id']){delete _0x2f547a[_0x883c('0x41')]['id'];}return db['Disposition']['find']({'where':{'id':_0x2f547a[_0x883c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x255572,null))[_0x883c('0x22')](saveUpdates(_0x2f547a[_0x883c('0x41')],null))[_0x883c('0x22')](respondWithResult(_0x255572,null))['catch'](handleError(_0x255572,null));};exports[_0x883c('0x4b')]=function(_0x3bf2a7,_0x52fb85){return db[_0x883c('0x26')][_0x883c('0x46')]({'where':{'id':_0x3bf2a7[_0x883c('0x3f')]['id']}})[_0x883c('0x22')](handleEntityNotFound(_0x52fb85,null))[_0x883c('0x22')](removeEntity(_0x52fb85,null))['catch'](handleError(_0x52fb85,null));}; \ No newline at end of file +var _0x9fe7=['sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','get','Dispositions','UserProfileResource','error','name','map','Disposition','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','then','catch','show','params','keys','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x5de40e,_0x53df81){var _0x4d8ab7=function(_0x182054){while(--_0x182054){_0x5de40e['push'](_0x5de40e['shift']());}};_0x4d8ab7(++_0x53df81);}(_0x9fe7,0x1df));var _0x79fe=function(_0x5d4070,_0x2f0d87){_0x5d4070=_0x5d4070-0x0;var _0xfadfa8=_0x9fe7[_0x5d4070];return _0xfadfa8;};'use strict';var emlformat=require(_0x79fe('0x0'));var rimraf=require(_0x79fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79fe('0x2'));var rp=require('request-promise');var moment=require(_0x79fe('0x3'));var BPromise=require(_0x79fe('0x4'));var Mustache=require(_0x79fe('0x5'));var util=require('util');var path=require(_0x79fe('0x6'));var sox=require(_0x79fe('0x7'));var csv=require(_0x79fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79fe('0x9'));var _=require(_0x79fe('0xa'));var squel=require(_0x79fe('0xb'));var crypto=require('crypto');var jsforce=require(_0x79fe('0xc'));var deskjs=require(_0x79fe('0xd'));var toCsv=require(_0x79fe('0x8'));var querystring=require(_0x79fe('0xe'));var Papa=require(_0x79fe('0xf'));var Redis=require('ioredis');var authService=require(_0x79fe('0x10'));var qs=require(_0x79fe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79fe('0x12'));var logger=require(_0x79fe('0x13'))(_0x79fe('0x14'));var utils=require(_0x79fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x79fe('0x16'));var db=require(_0x79fe('0x17'))['db'];function respondWithStatusCode(_0x3e0ad8,_0x93c1a7){_0x93c1a7=_0x93c1a7||0xcc;return function(_0x1a83f2){if(_0x1a83f2){return _0x3e0ad8[_0x79fe('0x18')](_0x93c1a7);}return _0x3e0ad8[_0x79fe('0x19')](_0x93c1a7)[_0x79fe('0x1a')]();};}function respondWithResult(_0x4be1c4,_0x3bd14a){_0x3bd14a=_0x3bd14a||0xc8;return function(_0x238e60){if(_0x238e60){return _0x4be1c4[_0x79fe('0x19')](_0x3bd14a)[_0x79fe('0x1b')](_0x238e60);}};}function respondWithFilteredResult(_0x35fb79,_0x25e91b){return function(_0x58124b){if(_0x58124b){var _0x127ec4=typeof _0x25e91b[_0x79fe('0x1c')]===_0x79fe('0x1d')&&typeof _0x25e91b[_0x79fe('0x1e')]==='undefined';var _0x416b5b=_0x58124b[_0x79fe('0x1f')];var _0x39be95=_0x127ec4?0x0:_0x25e91b[_0x79fe('0x1c')];var _0x536641=_0x127ec4?_0x58124b['count']:_0x25e91b[_0x79fe('0x1c')]+_0x25e91b[_0x79fe('0x1e')];var _0x25e51f;if(_0x536641>=_0x416b5b){_0x536641=_0x416b5b;_0x25e51f=0xc8;}else{_0x25e51f=0xce;}_0x35fb79['status'](_0x25e51f);return _0x35fb79[_0x79fe('0x20')](_0x79fe('0x21'),_0x39be95+'-'+_0x536641+'/'+_0x416b5b)[_0x79fe('0x1b')](_0x58124b);}return null;};}function patchUpdates(_0x4c7062){return function(_0x203405){try{jsonpatch['apply'](_0x203405,_0x4c7062,!![]);}catch(_0x15f019){return BPromise[_0x79fe('0x22')](_0x15f019);}return _0x203405[_0x79fe('0x23')]();};}function saveUpdates(_0x191bd8,_0x1ac8d7){return function(_0x23bff8){if(_0x23bff8){return _0x23bff8['update'](_0x191bd8)['then'](function(_0x107641){return _0x107641;});}return null;};}function removeEntity(_0x4e9888,_0x16aa35){return function(_0x3721bc){if(_0x3721bc){return _0x3721bc['destroy']()['then'](function(){var _0x454e93=_0x3721bc[_0x79fe('0x24')]({'plain':!![]});var _0x59339b=_0x79fe('0x25');return db[_0x79fe('0x26')]['destroy']({'where':{'type':_0x59339b,'resourceId':_0x454e93['id']}})['then'](function(){return _0x3721bc;});})['then'](function(){_0x4e9888[_0x79fe('0x19')](0xcc)[_0x79fe('0x1a')]();});}};}function handleEntityNotFound(_0x36ead5,_0x4ac913){return function(_0x47786f){if(!_0x47786f){_0x36ead5[_0x79fe('0x18')](0x194);}return _0x47786f;};}function handleError(_0x3bc5bc,_0x4de5cc){_0x4de5cc=_0x4de5cc||0x1f4;return function(_0x4e2740){logger[_0x79fe('0x27')](_0x4e2740['stack']);if(_0x4e2740[_0x79fe('0x28')]){delete _0x4e2740['name'];}_0x3bc5bc['status'](_0x4de5cc)['send'](_0x4e2740);};}exports['index']=function(_0x13f8da,_0xd2ec88){var _0x4dff5f={},_0x2b6975={},_0x5745a8={'count':0x0,'rows':[]};var _0x42558d=_[_0x79fe('0x29')](db[_0x79fe('0x2a')][_0x79fe('0x2b')],function(_0x128ca3){return{'name':_0x128ca3['fieldName'],'type':_0x128ca3[_0x79fe('0x2c')][_0x79fe('0x2d')]};});_0x2b6975[_0x79fe('0x2e')]=_[_0x79fe('0x29')](_0x42558d,_0x79fe('0x28'));_0x2b6975[_0x79fe('0x2f')]=_['keys'](_0x13f8da[_0x79fe('0x2f')]);_0x2b6975[_0x79fe('0x30')]=_[_0x79fe('0x31')](_0x2b6975[_0x79fe('0x2e')],_0x2b6975[_0x79fe('0x2f')]);_0x4dff5f[_0x79fe('0x32')]=_['intersection'](_0x2b6975[_0x79fe('0x2e')],qs['fields'](_0x13f8da[_0x79fe('0x2f')]['fields']));_0x4dff5f[_0x79fe('0x32')]=_0x4dff5f['attributes'][_0x79fe('0x33')]?_0x4dff5f[_0x79fe('0x32')]:_0x2b6975[_0x79fe('0x2e')];if(!_0x13f8da['query'][_0x79fe('0x34')](_0x79fe('0x35'))){_0x4dff5f[_0x79fe('0x1e')]=qs[_0x79fe('0x1e')](_0x13f8da[_0x79fe('0x2f')]['limit']);_0x4dff5f['offset']=qs[_0x79fe('0x1c')](_0x13f8da['query'][_0x79fe('0x1c')]);}_0x4dff5f[_0x79fe('0x36')]=qs['sort'](_0x13f8da[_0x79fe('0x2f')][_0x79fe('0x37')]);_0x4dff5f[_0x79fe('0x38')]=qs[_0x79fe('0x30')](_[_0x79fe('0x39')](_0x13f8da[_0x79fe('0x2f')],_0x2b6975['filters']),_0x42558d);if(_0x13f8da[_0x79fe('0x2f')][_0x79fe('0x3a')]){_0x4dff5f[_0x79fe('0x38')]=_[_0x79fe('0x3b')](_0x4dff5f['where'],{'$or':_[_0x79fe('0x29')](_0x42558d,function(_0x49d107){if(_0x49d107[_0x79fe('0x2c')]!=='VIRTUAL'){var _0x400a36={};_0x400a36[_0x49d107['name']]={'$like':'%'+_0x13f8da[_0x79fe('0x2f')][_0x79fe('0x3a')]+'%'};return _0x400a36;}})});}_0x4dff5f=_['merge']({},_0x4dff5f,_0x13f8da['options']);var _0x4137a3={'where':_0x4dff5f[_0x79fe('0x38')]};return db[_0x79fe('0x2a')][_0x79fe('0x1f')](_0x4137a3)['then'](function(_0x5698a2){_0x5745a8[_0x79fe('0x1f')]=_0x5698a2;if(_0x13f8da[_0x79fe('0x2f')][_0x79fe('0x3c')]){_0x4dff5f[_0x79fe('0x3d')]=[{'all':!![]}];}return db[_0x79fe('0x2a')][_0x79fe('0x3e')](_0x4dff5f);})[_0x79fe('0x3f')](function(_0x43c316){_0x5745a8['rows']=_0x43c316;return _0x5745a8;})[_0x79fe('0x3f')](respondWithFilteredResult(_0xd2ec88,_0x4dff5f))[_0x79fe('0x40')](handleError(_0xd2ec88,null));};exports[_0x79fe('0x41')]=function(_0x18e8f9,_0x461f38){var _0xcf6deb={'raw':!![],'where':{'id':_0x18e8f9[_0x79fe('0x42')]['id']}},_0x5b0d66={};_0x5b0d66[_0x79fe('0x2e')]=_[_0x79fe('0x43')](db[_0x79fe('0x2a')][_0x79fe('0x2b')]);_0x5b0d66[_0x79fe('0x2f')]=_['keys'](_0x18e8f9[_0x79fe('0x2f')]);_0x5b0d66[_0x79fe('0x30')]=_[_0x79fe('0x31')](_0x5b0d66['model'],_0x5b0d66[_0x79fe('0x2f')]);_0xcf6deb['attributes']=_['intersection'](_0x5b0d66[_0x79fe('0x2e')],qs[_0x79fe('0x44')](_0x18e8f9[_0x79fe('0x2f')]['fields']));_0xcf6deb[_0x79fe('0x32')]=_0xcf6deb[_0x79fe('0x32')][_0x79fe('0x33')]?_0xcf6deb['attributes']:_0x5b0d66['model'];if(_0x18e8f9[_0x79fe('0x2f')][_0x79fe('0x3c')]){_0xcf6deb[_0x79fe('0x3d')]=[{'all':!![]}];}_0xcf6deb=_[_0x79fe('0x3b')]({},_0xcf6deb,_0x18e8f9[_0x79fe('0x45')]);return db[_0x79fe('0x2a')][_0x79fe('0x46')](_0xcf6deb)[_0x79fe('0x3f')](handleEntityNotFound(_0x461f38,null))[_0x79fe('0x3f')](respondWithResult(_0x461f38,null))['catch'](handleError(_0x461f38,null));};exports[_0x79fe('0x47')]=function(_0x3009a8,_0x496486){return db[_0x79fe('0x2a')]['create'](_0x3009a8[_0x79fe('0x48')],{})[_0x79fe('0x3f')](function(_0x1d2845){var _0x1761d7=_0x3009a8['user'][_0x79fe('0x24')]({'plain':!![]});if(!_0x1761d7)throw new Error(_0x79fe('0x49'));if(_0x1761d7[_0x79fe('0x4a')]==='user'){var _0x5cfd05=_0x1d2845[_0x79fe('0x24')]({'plain':!![]});var _0x1ce058='Dispositions';return db[_0x79fe('0x4b')][_0x79fe('0x46')]({'where':{'name':_0x1ce058,'userProfileId':_0x1761d7[_0x79fe('0x4c')]},'raw':!![]})[_0x79fe('0x3f')](function(_0x58c900){if(_0x58c900&&_0x58c900[_0x79fe('0x4d')]===0x0){return db[_0x79fe('0x26')][_0x79fe('0x47')]({'name':_0x5cfd05['name'],'resourceId':_0x5cfd05['id'],'type':_0x58c900['name'],'sectionId':_0x58c900['id']},{})['then'](function(){return _0x1d2845;});}else{return _0x1d2845;}})['catch'](function(_0x4946d3){logger[_0x79fe('0x27')](_0x79fe('0x4e'),_0x4946d3);throw _0x4946d3;});}return _0x1d2845;})['then'](respondWithResult(_0x496486,0xc9))[_0x79fe('0x40')](handleError(_0x496486,null));};exports[_0x79fe('0x4f')]=function(_0x167ab6,_0x4a2a42){if(_0x167ab6['body']['id']){delete _0x167ab6['body']['id'];}return db[_0x79fe('0x2a')]['find']({'where':{'id':_0x167ab6[_0x79fe('0x42')]['id']}})[_0x79fe('0x3f')](handleEntityNotFound(_0x4a2a42,null))[_0x79fe('0x3f')](saveUpdates(_0x167ab6[_0x79fe('0x48')],null))[_0x79fe('0x3f')](respondWithResult(_0x4a2a42,null))[_0x79fe('0x40')](handleError(_0x4a2a42,null));};exports[_0x79fe('0x50')]=function(_0x2578da,_0x230ed9){return db[_0x79fe('0x2a')][_0x79fe('0x46')]({'where':{'id':_0x2578da['params']['id']}})[_0x79fe('0x3f')](handleEntityNotFound(_0x230ed9,null))[_0x79fe('0x3f')](removeEntity(_0x230ed9,null))['catch'](handleError(_0x230ed9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e53f35d..cf98ec7 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 _0xcecd=['OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel'];(function(_0x2bdf2b,_0x4c7785){var _0xf47d2f=function(_0x3c8f7a){while(--_0x3c8f7a){_0x2bdf2b['push'](_0x2bdf2b['shift']());}};_0xf47d2f(++_0x4c7785);}(_0xcecd,0x162));var _0xdcec=function(_0x22597f,_0x42e568){_0x22597f=_0x22597f-0x0;var _0x28c2e3=_0xcecd[_0x22597f];return _0x28c2e3;};'use strict';var _=require(_0xdcec('0x0'));var util=require(_0xdcec('0x1'));var logger=require(_0xdcec('0x2'))(_0xdcec('0x3'));var moment=require(_0xdcec('0x4'));var BPromise=require(_0xdcec('0x5'));var rp=require(_0xdcec('0x6'));var fs=require('fs');var path=require(_0xdcec('0x7'));var rimraf=require(_0xdcec('0x8'));var config=require('../../config/environment');var attributes=require(_0xdcec('0x9'));module[_0xdcec('0xa')]=function(_0x388dcf,_0x5d4370){return _0x388dcf[_0xdcec('0xb')](_0xdcec('0xc'),attributes,{'tableName':_0xdcec('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xdcec('0xe'),'fields':[_0xdcec('0xf'),_0xdcec('0x10')]},{'unique':!![],'name':_0xdcec('0x11'),'fields':[_0xdcec('0xf'),_0xdcec('0x12')]},{'unique':!![],'name':'name_mail','fields':[_0xdcec('0xf'),_0xdcec('0x13')]},{'unique':!![],'name':_0xdcec('0x14'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xdcec('0x15'),'fields':[_0xdcec('0xf'),_0xdcec('0x16')]},{'unique':!![],'name':_0xdcec('0x17'),'fields':['name',_0xdcec('0x18')]},{'unique':!![],'name':_0xdcec('0x19'),'fields':['name',_0xdcec('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f11=['Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','name_whatsapp','lodash','util','../../config/logger','api','rimraf','../../config/environment','./disposition.attributes','define'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x2f11,0x1ec));var _0x12f1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2f11[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x12f1('0x0'));var util=require(_0x12f1('0x1'));var logger=require(_0x12f1('0x2'))(_0x12f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x12f1('0x4'));var config=require(_0x12f1('0x5'));var attributes=require(_0x12f1('0x6'));module['exports']=function(_0x228a47,_0x3fbb70){return _0x228a47[_0x12f1('0x7')](_0x12f1('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x12f1('0x9'),'fields':[_0x12f1('0xa'),_0x12f1('0xb')]},{'unique':!![],'name':_0x12f1('0xc'),'fields':[_0x12f1('0xa'),_0x12f1('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x12f1('0xa'),_0x12f1('0xe')]},{'unique':!![],'name':_0x12f1('0xf'),'fields':[_0x12f1('0xa'),_0x12f1('0x10')]},{'unique':!![],'name':_0x12f1('0x11'),'fields':[_0x12f1('0xa'),'FaxAccountId']},{'unique':!![],'name':_0x12f1('0x12'),'fields':[_0x12f1('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0x12f1('0x13'),'fields':[_0x12f1('0xa'),'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 4ee1f93..449e110 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(_0x11d9c3,_0x43fd80){var _0x316e07=function(_0x20db6a){while(--_0x20db6a){_0x11d9c3['push'](_0x11d9c3['shift']());}};_0x316e07(++_0x43fd80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x256dd3,_0x4670e3){var _0x11a292=function(_0x177d4a){while(--_0x177d4a){_0x256dd3['push'](_0x256dd3['shift']());}};_0x11a292(++_0x4670e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 c98c568..32ed345 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 _0x90c7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','index','/:id','isAuthenticated','post','create','update','delete','util','path','connect-timeout','express'];(function(_0x1a486d,_0x4a98e9){var _0x4e5ade=function(_0x5a7005){while(--_0x5a7005){_0x1a486d['push'](_0x1a486d['shift']());}};_0x4e5ade(++_0x4a98e9);}(_0x90c7,0x10c));var _0x790c=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x90c7[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0x790c('0x0'));var path=require(_0x790c('0x1'));var timeout=require(_0x790c('0x2'));var express=require(_0x790c('0x3'));var router=express[_0x790c('0x4')]();var fs_extra=require(_0x790c('0x5'));var auth=require(_0x790c('0x6'));var interaction=require(_0x790c('0x7'));var config=require('../../config/environment');var controller=require(_0x790c('0x8'));router[_0x790c('0x9')]('/',auth['isAuthenticated'](),controller[_0x790c('0xa')]);router[_0x790c('0x9')](_0x790c('0xb'),auth[_0x790c('0xc')](),controller['show']);router[_0x790c('0xd')]('/',auth[_0x790c('0xc')](),controller[_0x790c('0xe')]);router['put'](_0x790c('0xb'),auth[_0x790c('0xc')](),controller[_0x790c('0xf')]);router[_0x790c('0x10')](_0x790c('0xb'),auth[_0x790c('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x788c=['show','post','create','update','delete','destroy','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./disposition.controller','index','get','/:id','isAuthenticated'];(function(_0x575818,_0xa55f3f){var _0x13bd05=function(_0x5eaabc){while(--_0x5eaabc){_0x575818['push'](_0x575818['shift']());}};_0x13bd05(++_0xa55f3f);}(_0x788c,0xf6));var _0xc788=function(_0x265b0,_0x435969){_0x265b0=_0x265b0-0x0;var _0x5dd68f=_0x788c[_0x265b0];return _0x5dd68f;};'use strict';var multer=require('multer');var util=require(_0xc788('0x0'));var path=require('path');var timeout=require(_0xc788('0x1'));var express=require('express');var router=express[_0xc788('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc788('0x3'));var config=require(_0xc788('0x4'));var controller=require(_0xc788('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc788('0x6')]);router[_0xc788('0x7')](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xa')]);router[_0xc788('0xb')]('/',auth['isAuthenticated'](),controller[_0xc788('0xc')]);router['put'](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xd')]);router[_0xc788('0xe')](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 635ba28..0db1c19 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 _0x7278=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4fb4fa,_0x566c3b){var _0x3549ce=function(_0x2edf35){while(--_0x2edf35){_0x4fb4fa['push'](_0x4fb4fa['shift']());}};_0x3549ce(++_0x566c3b);}(_0x7278,0x161));var _0x8727=function(_0x2edc8b,_0x441753){_0x2edc8b=_0x2edc8b-0x0;var _0x439bc1=_0x7278[_0x2edc8b];return _0x439bc1;};'use strict';var Sequelize=require(_0x8727('0x0'));module[_0x8727('0x1')]={'name':{'type':Sequelize[_0x8727('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8727('0x2')]},'ecm':{'type':Sequelize[_0x8727('0x3')]('yes','no'),'defaultValue':_0x8727('0x4')},'headerinfo':{'type':Sequelize[_0x8727('0x2')],'defaultValue':_0x8727('0x5')},'localstationid':{'type':Sequelize[_0x8727('0x2')],'unique':_0x8727('0x6')},'minrate':{'type':Sequelize[_0x8727('0x3')](_0x8727('0x7'),'4800',_0x8727('0x8'),_0x8727('0x9'),_0x8727('0xa'),_0x8727('0xb')),'defaultValue':_0x8727('0xc')},'maxrate':{'type':Sequelize['ENUM']('2400','4800',_0x8727('0x8'),_0x8727('0x9'),_0x8727('0xa'),_0x8727('0xb')),'defaultValue':_0x8727('0xb')},'modem':{'type':Sequelize[_0x8727('0x2')],'defaultValue':_0x8727('0xd')},'gateway':{'type':Sequelize[_0x8727('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8727('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8727('0x3')](_0x8727('0xf'),'IAX',_0x8727('0x10'),_0x8727('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x8727('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8727('0x12')],'defaultValue':function(){return _0x8727('0x13');}},'notificationSound':{'type':Sequelize[_0x8727('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8727('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8727('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8727('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8727('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8727('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8727('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8727('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x8727('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x8727('0x14')],'defaultValue':![],'comment':_0x8727('0x16'),'set':function(_0x112f04){if(!_0x112f04)this[_0x8727('0x17')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x8727('0x18'),_0x112f04);}}}; \ No newline at end of file +var _0x199c=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','9600','12000','14400','4800','7200','v17,v27,v29','INTEGER'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0x199c,0x1d8));var _0xc199=function(_0x2a1233,_0x523c88){_0x2a1233=_0x2a1233-0x0;var _0x30cdd9=_0x199c[_0x2a1233];return _0x30cdd9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc199('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc199('0x0')]},'ecm':{'type':Sequelize[_0xc199('0x1')](_0xc199('0x2'),'no'),'defaultValue':_0xc199('0x2')},'headerinfo':{'type':Sequelize[_0xc199('0x0')],'defaultValue':_0xc199('0x3')},'localstationid':{'type':Sequelize[_0xc199('0x0')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xc199('0x1')](_0xc199('0x4'),'4800','7200',_0xc199('0x5'),_0xc199('0x6'),_0xc199('0x7')),'defaultValue':_0xc199('0x8')},'maxrate':{'type':Sequelize[_0xc199('0x1')](_0xc199('0x4'),_0xc199('0x8'),_0xc199('0x9'),'9600',_0xc199('0x6'),_0xc199('0x7')),'defaultValue':_0xc199('0x7')},'modem':{'type':Sequelize[_0xc199('0x0')],'defaultValue':_0xc199('0xa')},'gateway':{'type':Sequelize[_0xc199('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc199('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc199('0x1')](_0xc199('0xc'),_0xc199('0xd'),_0xc199('0xe'),'KHOMP'),'defaultValue':_0xc199('0xc')},'key':{'type':Sequelize[_0xc199('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc199('0xf')],'defaultValue':function(){return _0xc199('0x10');}},'notificationSound':{'type':Sequelize[_0xc199('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc199('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc199('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc199('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc199('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc199('0x11')],'defaultValue':![],'comment':_0xc199('0x12'),'set':function(_0x5ee3f8){if(!_0x5ee3f8)this[_0xc199('0x13')](_0xc199('0x14'),null);this[_0xc199('0x13')](_0xc199('0x15'),_0x5ee3f8);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index df80d7e..e451c58 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 _0x570e=['CmList','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','findAll','rows','show','params','keys','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','getDispositions','findOne','include','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','fullname','internal','Tags','color','tag','transaction','sequelize','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','appdata','Answer','push','CDR(type)=inbound-fax','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','key','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','format','FaxMessage'];(function(_0x168a8b,_0x58be26){var _0x33f6a6=function(_0x5dc1df){while(--_0x5dc1df){_0x168a8b['push'](_0x168a8b['shift']());}};_0x33f6a6(++_0x58be26);}(_0x570e,0x1af));var _0xe570=function(_0x20ebf7,_0x6dc038){_0x20ebf7=_0x20ebf7-0x0;var _0x15ca11=_0x570e[_0x20ebf7];return _0x15ca11;};'use strict';var emlformat=require(_0xe570('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe570('0x1'));var jsonpatch=require(_0xe570('0x2'));var rp=require(_0xe570('0x3'));var moment=require(_0xe570('0x4'));var BPromise=require(_0xe570('0x5'));var Mustache=require(_0xe570('0x6'));var util=require(_0xe570('0x7'));var path=require('path');var sox=require(_0xe570('0x8'));var csv=require(_0xe570('0x9'));var ejs=require(_0xe570('0xa'));var fs=require('fs');var fs_extra=require(_0xe570('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe570('0xc'));var jsforce=require(_0xe570('0xd'));var deskjs=require(_0xe570('0xe'));var toCsv=require(_0xe570('0x9'));var querystring=require(_0xe570('0xf'));var Papa=require('papaparse');var Redis=require(_0xe570('0x10'));var authService=require(_0xe570('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe570('0x12'));var hardwareService=require(_0xe570('0x13'));var logger=require(_0xe570('0x14'))('api');var utils=require(_0xe570('0x15'));var config=require(_0xe570('0x16'));var licenseUtil=require(_0xe570('0x17'));var db=require(_0xe570('0x18'))['db'];config[_0xe570('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe570('0x1a'))(new Redis(config[_0xe570('0x19')]));require(_0xe570('0x1b'))[_0xe570('0x1c')](socket);var jayson=require(_0xe570('0x1d'));var client=jayson['client'][_0xe570('0x1e')]({'port':0x232c});var client9002=jayson[_0xe570('0x1f')][_0xe570('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1045de,_0x2e9759,_0x315f0e,_0x29b3c6){return new BPromise(function(_0x108c69,_0x24b8eb){var _0x261551=_0x29b3c6||client;return _0x261551['request'](_0x1045de,_0x315f0e)[_0xe570('0x20')](function(_0x27bab2){logger[_0xe570('0x21')]('FaxAccount,\x20%s,\x20%s',_0x2e9759,_0xe570('0x22'));logger[_0xe570('0x23')](_0xe570('0x24'),_0x2e9759,_0xe570('0x22'),JSON[_0xe570('0x25')](_0x27bab2));if(_0x27bab2['error']){if(_0x27bab2[_0xe570('0x26')][_0xe570('0x27')]===0x1f4){logger[_0xe570('0x26')](_0xe570('0x28'),_0x2e9759,_0x27bab2[_0xe570('0x26')][_0xe570('0x29')]);return _0x24b8eb(_0x27bab2[_0xe570('0x26')][_0xe570('0x29')]);}logger[_0xe570('0x26')](_0xe570('0x28'),_0x2e9759,_0x27bab2[_0xe570('0x26')][_0xe570('0x29')]);return _0x108c69(_0x27bab2[_0xe570('0x26')][_0xe570('0x29')]);}else{logger[_0xe570('0x21')](_0xe570('0x28'),_0x2e9759,_0xe570('0x22'));_0x108c69(_0x27bab2[_0xe570('0x2a')][_0xe570('0x29')]);}})[_0xe570('0x2b')](function(_0x6ad5f9){logger[_0xe570('0x26')](_0xe570('0x28'),_0x2e9759,_0x6ad5f9);_0x24b8eb(_0x6ad5f9);});});}function respondWithStatusCode(_0x4f985b,_0x5db1e7){_0x5db1e7=_0x5db1e7||0xcc;return function(_0x5e010f){if(_0x5e010f){return _0x4f985b['sendStatus'](_0x5db1e7);}return _0x4f985b[_0xe570('0x2c')](_0x5db1e7)[_0xe570('0x2d')]();};}function respondWithResult(_0xde9f67,_0x5c7574){_0x5c7574=_0x5c7574||0xc8;return function(_0x23e774){if(_0x23e774){return _0xde9f67[_0xe570('0x2c')](_0x5c7574)[_0xe570('0x2e')](_0x23e774);}};}function respondWithFilteredResult(_0x160b5f,_0x3260ea){return function(_0x49a683){if(_0x49a683){var _0x411d2a=typeof _0x3260ea['offset']===_0xe570('0x2f')&&typeof _0x3260ea[_0xe570('0x30')]===_0xe570('0x2f');var _0x4e98d8=_0x49a683[_0xe570('0x31')];var _0x4cedbd=_0x411d2a?0x0:_0x3260ea[_0xe570('0x32')];var _0x8a402f=_0x411d2a?_0x49a683['count']:_0x3260ea[_0xe570('0x32')]+_0x3260ea[_0xe570('0x30')];var _0x29a199;if(_0x8a402f>=_0x4e98d8){_0x8a402f=_0x4e98d8;_0x29a199=0xc8;}else{_0x29a199=0xce;}_0x160b5f[_0xe570('0x2c')](_0x29a199);return _0x160b5f[_0xe570('0x33')](_0xe570('0x34'),_0x4cedbd+'-'+_0x8a402f+'/'+_0x4e98d8)[_0xe570('0x2e')](_0x49a683);}return null;};}function patchUpdates(_0x243ddb){return function(_0x477c7a){try{jsonpatch[_0xe570('0x35')](_0x477c7a,_0x243ddb,!![]);}catch(_0x233a4a){return BPromise[_0xe570('0x36')](_0x233a4a);}return _0x477c7a[_0xe570('0x37')]();};}function saveUpdates(_0x1314d4,_0x1a7650){return function(_0x5e3c3a){if(_0x5e3c3a){return _0x5e3c3a[_0xe570('0x38')](_0x1314d4)[_0xe570('0x20')](function(_0x46f7df){return _0x46f7df;});}return null;};}function removeEntity(_0x222fb4,_0x55e49f){return function(_0x275102){if(_0x275102){return _0x275102[_0xe570('0x39')]()[_0xe570('0x20')](function(){var _0x49347c=_0x275102[_0xe570('0x3a')]({'plain':!![]});var _0x38fb02=_0xe570('0x3b');return db[_0xe570('0x3c')][_0xe570('0x39')]({'where':{'type':_0x38fb02,'resourceId':_0x49347c['id']}})[_0xe570('0x20')](function(){return _0x275102;});})[_0xe570('0x20')](function(){_0x222fb4[_0xe570('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358e84,_0x2f0043){return function(_0x5be274){if(!_0x5be274){_0x358e84[_0xe570('0x3d')](0x194);}return _0x5be274;};}function handleError(_0x2b6f47,_0x310b8c){_0x310b8c=_0x310b8c||0x1f4;return function(_0xf3ab2e){logger[_0xe570('0x26')](_0xf3ab2e['stack']);if(_0xf3ab2e[_0xe570('0x3e')]){delete _0xf3ab2e[_0xe570('0x3e')];}_0x2b6f47[_0xe570('0x2c')](_0x310b8c)[_0xe570('0x3f')](_0xf3ab2e);};}exports[_0xe570('0x40')]=function(_0x5346d6,_0x388439){var _0x55e28a={'include':[{'model':db[_0xe570('0x41')],'as':_0xe570('0x42')}]},_0x2f8190={},_0x88af7b={'count':0x0,'rows':[]};var _0x28bf19=_[_0xe570('0x43')](db['FaxAccount'][_0xe570('0x44')],function(_0x19c088){return{'name':_0x19c088[_0xe570('0x45')],'type':_0x19c088[_0xe570('0x46')]['key']};});_0x2f8190[_0xe570('0x47')]=_[_0xe570('0x43')](_0x28bf19,'name');_0x2f8190[_0xe570('0x48')]=_['keys'](_0x5346d6[_0xe570('0x48')]);_0x2f8190[_0xe570('0x49')]=_[_0xe570('0x4a')](_0x2f8190[_0xe570('0x47')],_0x2f8190['query']);_0x55e28a['attributes']=_['intersection'](_0x2f8190['model'],qs['fields'](_0x5346d6[_0xe570('0x48')]['fields']));_0x55e28a[_0xe570('0x4b')]=_0x55e28a[_0xe570('0x4b')][_0xe570('0x4c')]?_0x55e28a[_0xe570('0x4b')]:_0x2f8190[_0xe570('0x47')];if(!_0x5346d6[_0xe570('0x48')][_0xe570('0x4d')](_0xe570('0x4e'))){_0x55e28a['limit']=qs[_0xe570('0x30')](_0x5346d6['query'][_0xe570('0x30')]);_0x55e28a[_0xe570('0x32')]=qs['offset'](_0x5346d6[_0xe570('0x48')]['offset']);}_0x55e28a[_0xe570('0x4f')]=qs[_0xe570('0x50')](_0x5346d6[_0xe570('0x48')]['sort']);_0x55e28a[_0xe570('0x51')]=qs[_0xe570('0x49')](_[_0xe570('0x52')](_0x5346d6[_0xe570('0x48')],_0x2f8190['filters']),_0x28bf19);if(_0x5346d6[_0xe570('0x48')][_0xe570('0x53')]){_0x55e28a['where']=_[_0xe570('0x54')](_0x55e28a[_0xe570('0x51')],{'$or':_[_0xe570('0x43')](_0x28bf19,function(_0x2299e2){if(_0x2299e2[_0xe570('0x46')]!==_0xe570('0x55')){var _0x33cd30={};_0x33cd30[_0x2299e2['name']]={'$like':'%'+_0x5346d6['query'][_0xe570('0x53')]+'%'};return _0x33cd30;}})});}_0x55e28a=_[_0xe570('0x54')]({},_0x55e28a,_0x5346d6['options']);var _0xee4ab2={'where':_0x55e28a[_0xe570('0x51')]};return db[_0xe570('0x56')][_0xe570('0x31')](_0xee4ab2)[_0xe570('0x20')](function(_0x58d910){_0x88af7b['count']=_0x58d910;if(_0x5346d6['query'][_0xe570('0x57')]){_0x55e28a['include']=[{'all':!![]}];}return db[_0xe570('0x56')][_0xe570('0x58')](_0x55e28a);})[_0xe570('0x20')](function(_0x4a465d){_0x88af7b[_0xe570('0x59')]=_0x4a465d;return _0x88af7b;})[_0xe570('0x20')](respondWithFilteredResult(_0x388439,_0x55e28a))[_0xe570('0x2b')](handleError(_0x388439,null));};exports[_0xe570('0x5a')]=function(_0xd7852c,_0xdbeae1){var _0x2a2cb5={'raw':![],'where':{'id':_0xd7852c[_0xe570('0x5b')]['id']},'include':[{'model':db[_0xe570('0x41')],'as':_0xe570('0x42')}]},_0x2e35d3={};_0x2e35d3[_0xe570('0x47')]=_[_0xe570('0x5c')](db['FaxAccount'][_0xe570('0x44')]);_0x2e35d3[_0xe570('0x48')]=_[_0xe570('0x5c')](_0xd7852c[_0xe570('0x48')]);_0x2e35d3[_0xe570('0x49')]=_[_0xe570('0x4a')](_0x2e35d3['model'],_0x2e35d3[_0xe570('0x48')]);_0x2a2cb5[_0xe570('0x4b')]=_[_0xe570('0x4a')](_0x2e35d3[_0xe570('0x47')],qs[_0xe570('0x5d')](_0xd7852c[_0xe570('0x48')][_0xe570('0x5d')]));_0x2a2cb5[_0xe570('0x4b')]=_0x2a2cb5['attributes']['length']?_0x2a2cb5[_0xe570('0x4b')]:_0x2e35d3[_0xe570('0x47')];if(_0xd7852c[_0xe570('0x48')][_0xe570('0x57')]){_0x2a2cb5['include']=[{'all':!![]}];}_0x2a2cb5=_['merge']({},_0x2a2cb5,_0xd7852c[_0xe570('0x5e')]);return db[_0xe570('0x56')][_0xe570('0x5f')](_0x2a2cb5)['then'](handleEntityNotFound(_0xdbeae1,null))[_0xe570('0x20')](respondWithResult(_0xdbeae1,null))['catch'](handleError(_0xdbeae1,null));};exports['create']=function(_0x1c7121,_0x4c9ae9){return db[_0xe570('0x56')][_0xe570('0x60')](_0x1c7121[_0xe570('0x61')],{})[_0xe570('0x20')](function(_0x2b6aa0){var _0x34790b=_0x1c7121[_0xe570('0x62')][_0xe570('0x3a')]({'plain':!![]});if(!_0x34790b)throw new Error(_0xe570('0x63'));if(_0x34790b['role']===_0xe570('0x62')){var _0xe58351=_0x2b6aa0['get']({'plain':!![]});var _0x5c14db=_0xe570('0x3b');return db[_0xe570('0x64')][_0xe570('0x5f')]({'where':{'name':_0x5c14db,'userProfileId':_0x34790b[_0xe570('0x65')]},'raw':!![]})[_0xe570('0x20')](function(_0x51d6b2){if(_0x51d6b2&&_0x51d6b2[_0xe570('0x66')]===0x0){return db[_0xe570('0x3c')]['create']({'name':_0xe58351[_0xe570('0x3e')],'resourceId':_0xe58351['id'],'type':_0x51d6b2['name'],'sectionId':_0x51d6b2['id']},{})[_0xe570('0x20')](function(){return _0x2b6aa0;});}else{return _0x2b6aa0;}})['catch'](function(_0xadc267){logger[_0xe570('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xadc267);throw _0xadc267;});}return _0x2b6aa0;})[_0xe570('0x20')](respondWithResult(_0x4c9ae9,0xc9))[_0xe570('0x2b')](handleError(_0x4c9ae9,null));};exports[_0xe570('0x38')]=function(_0xe89d5c,_0x2819ae){if(_0xe89d5c['body']['id']){delete _0xe89d5c[_0xe570('0x61')]['id'];}return db['FaxAccount'][_0xe570('0x5f')]({'where':{'id':_0xe89d5c[_0xe570('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xe570('0x42')}]})[_0xe570('0x20')](handleEntityNotFound(_0x2819ae,null))['then'](saveUpdates(_0xe89d5c[_0xe570('0x61')],null))[_0xe570('0x20')](respondWithResult(_0x2819ae,null))[_0xe570('0x2b')](handleError(_0x2819ae,null));};exports[_0xe570('0x39')]=function(_0x3202eb,_0x20f8dc){return db['FaxAccount'][_0xe570('0x5f')]({'where':{'id':_0x3202eb[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x20f8dc,null))[_0xe570('0x20')](removeEntity(_0x20f8dc,null))[_0xe570('0x2b')](handleError(_0x20f8dc,null));};exports['describe']=function(_0x47340f,_0xd16bf){return db[_0xe570('0x56')][_0xe570('0x67')]()[_0xe570('0x20')](respondWithResult(_0xd16bf,null))[_0xe570('0x2b')](handleError(_0xd16bf,null));};exports[_0xe570('0x68')]=function(_0x30929a,_0x296891,_0x47b5f7){if(_0x30929a['body']['id']){delete _0x30929a['body']['id'];}return db['FaxAccount'][_0xe570('0x5f')]({'where':{'id':_0x30929a[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x296891,null))['then'](function(_0x4a4752){if(_0x4a4752){_0x30929a[_0xe570('0x61')][_0xe570('0x69')]=_0x4a4752['id'];return db['Disposition']['create'](_0x30929a[_0xe570('0x61')]);}})['then'](respondWithResult(_0x296891,null))[_0xe570('0x2b')](handleError(_0x296891,null));};exports[_0xe570('0x6a')]=function(_0x3468f3,_0xe8938b,_0x6cdeb6){var _0x5bdc71={'raw':![],'where':{}};var _0x56a98f={};var _0x4984f1={'count':0x0,'rows':[]};return db[_0xe570('0x56')][_0xe570('0x6b')]({'where':{'id':_0x3468f3[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0xe8938b,null))[_0xe570('0x20')](function(_0x2c1a06){if(_0x2c1a06){_0x56a98f['model']=_[_0xe570('0x5c')](db['Disposition']['rawAttributes']);_0x56a98f[_0xe570('0x48')]=_[_0xe570('0x5c')](_0x3468f3[_0xe570('0x48')]);_0x56a98f[_0xe570('0x49')]=_['intersection'](_0x56a98f[_0xe570('0x47')],_0x56a98f['query']);_0x5bdc71[_0xe570('0x4b')]=_[_0xe570('0x4a')](_0x56a98f['model'],qs[_0xe570('0x5d')](_0x3468f3['query'][_0xe570('0x5d')]));_0x5bdc71[_0xe570('0x4b')]=_0x5bdc71[_0xe570('0x4b')]['length']?_0x5bdc71[_0xe570('0x4b')]:_0x56a98f[_0xe570('0x47')];if(!_0x3468f3[_0xe570('0x48')][_0xe570('0x4d')](_0xe570('0x4e'))){_0x5bdc71['limit']=qs[_0xe570('0x30')](_0x3468f3[_0xe570('0x48')][_0xe570('0x30')]);_0x5bdc71[_0xe570('0x32')]=qs[_0xe570('0x32')](_0x3468f3[_0xe570('0x48')][_0xe570('0x32')]);}_0x5bdc71[_0xe570('0x4f')]=qs['sort'](_0x3468f3[_0xe570('0x48')][_0xe570('0x50')]);_0x5bdc71[_0xe570('0x51')]=qs[_0xe570('0x49')](_[_0xe570('0x52')](_0x3468f3[_0xe570('0x48')],_0x56a98f[_0xe570('0x49')]));_0x5bdc71[_0xe570('0x51')][_0xe570('0x69')]=_0x2c1a06['id'];if(_0x3468f3[_0xe570('0x48')][_0xe570('0x53')]){_0x5bdc71[_0xe570('0x51')]=_[_0xe570('0x54')](_0x5bdc71[_0xe570('0x51')],{'$or':_[_0xe570('0x43')](_0x5bdc71[_0xe570('0x4b')],function(_0x1c7377){var _0x2b2ff6={};_0x2b2ff6[_0x1c7377]={'$like':'%'+_0x3468f3['query'][_0xe570('0x53')]+'%'};return _0x2b2ff6;})});}_0x5bdc71=_[_0xe570('0x54')]({},_0x5bdc71,_0x3468f3['options']);return db['Disposition']['count']({'where':_0x5bdc71[_0xe570('0x51')]})[_0xe570('0x20')](function(_0x541ac4){_0x4984f1[_0xe570('0x31')]=_0x541ac4;if(_0x3468f3['query'][_0xe570('0x57')]){_0x5bdc71[_0xe570('0x6c')]=[{'all':!![]}];}return db[_0xe570('0x6d')][_0xe570('0x58')](_0x5bdc71);})['then'](function(_0x134bc0){_0x4984f1[_0xe570('0x59')]=_0x134bc0;return _0x4984f1;});}})[_0xe570('0x20')](respondWithFilteredResult(_0xe8938b,_0x5bdc71))[_0xe570('0x2b')](handleError(_0xe8938b,null));};exports[_0xe570('0x6e')]=function(_0x395755,_0x41b7b1,_0x13b9db){return db[_0xe570('0x56')][_0xe570('0x5f')]({'where':{'id':_0x395755[_0xe570('0x5b')]['id']}})['then'](handleEntityNotFound(_0x41b7b1,null))[_0xe570('0x20')](function(_0x2c1c79){if(_0x2c1c79){return _0x2c1c79['removeDispositions'](_0x395755[_0xe570('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x41b7b1,null))[_0xe570('0x2b')](handleError(_0x41b7b1,null));};exports[_0xe570('0x6f')]=function(_0x487589,_0x45ceae,_0x1a8001){if(_0x487589[_0xe570('0x61')]['id']){delete _0x487589[_0xe570('0x61')]['id'];}return db[_0xe570('0x56')][_0xe570('0x5f')]({'where':{'id':_0x487589[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x45ceae,null))['then'](function(_0x31998e){if(_0x31998e){_0x487589['body']['FaxAccountId']=_0x31998e['id'];return db[_0xe570('0x70')][_0xe570('0x60')](_0x487589[_0xe570('0x61')]);}})[_0xe570('0x20')](respondWithResult(_0x45ceae,null))[_0xe570('0x2b')](handleError(_0x45ceae,null));};exports[_0xe570('0x71')]=function(_0x2bd908,_0x120a43,_0x1f69fa){var _0x3b9c34={'raw':![],'where':{}};var _0x29f18d={};var _0x4e36f1={'count':0x0,'rows':[]};return db[_0xe570('0x56')][_0xe570('0x6b')]({'where':{'id':_0x2bd908[_0xe570('0x5b')]['id']}})['then'](handleEntityNotFound(_0x120a43,null))['then'](function(_0x59583d){if(_0x59583d){_0x29f18d[_0xe570('0x47')]=_['keys'](db[_0xe570('0x70')][_0xe570('0x44')]);_0x29f18d['query']=_[_0xe570('0x5c')](_0x2bd908[_0xe570('0x48')]);_0x29f18d[_0xe570('0x49')]=_['intersection'](_0x29f18d['model'],_0x29f18d['query']);_0x3b9c34[_0xe570('0x4b')]=_['intersection'](_0x29f18d[_0xe570('0x47')],qs[_0xe570('0x5d')](_0x2bd908[_0xe570('0x48')]['fields']));_0x3b9c34[_0xe570('0x4b')]=_0x3b9c34['attributes']['length']?_0x3b9c34[_0xe570('0x4b')]:_0x29f18d[_0xe570('0x47')];if(!_0x2bd908[_0xe570('0x48')][_0xe570('0x4d')](_0xe570('0x4e'))){_0x3b9c34['limit']=qs[_0xe570('0x30')](_0x2bd908[_0xe570('0x48')][_0xe570('0x30')]);_0x3b9c34[_0xe570('0x32')]=qs[_0xe570('0x32')](_0x2bd908[_0xe570('0x48')][_0xe570('0x32')]);}_0x3b9c34['order']=qs[_0xe570('0x50')](_0x2bd908[_0xe570('0x48')][_0xe570('0x50')]);_0x3b9c34['where']=qs[_0xe570('0x49')](_['pick'](_0x2bd908[_0xe570('0x48')],_0x29f18d[_0xe570('0x49')]));_0x3b9c34[_0xe570('0x51')][_0xe570('0x69')]=_0x59583d['id'];if(_0x2bd908[_0xe570('0x48')][_0xe570('0x53')]){_0x3b9c34['where']=_[_0xe570('0x54')](_0x3b9c34['where'],{'$or':_[_0xe570('0x43')](_0x3b9c34['attributes'],function(_0x5f10f9){var _0x45888e={};_0x45888e[_0x5f10f9]={'$like':'%'+_0x2bd908[_0xe570('0x48')][_0xe570('0x53')]+'%'};return _0x45888e;})});}_0x3b9c34=_[_0xe570('0x54')]({},_0x3b9c34,_0x2bd908[_0xe570('0x5e')]);return db[_0xe570('0x70')][_0xe570('0x31')]({'where':_0x3b9c34[_0xe570('0x51')]})['then'](function(_0x407b48){_0x4e36f1['count']=_0x407b48;if(_0x2bd908['query']['includeAll']){_0x3b9c34['include']=[{'all':!![]}];}return db[_0xe570('0x70')][_0xe570('0x58')](_0x3b9c34);})['then'](function(_0x55434a){_0x4e36f1['rows']=_0x55434a;return _0x4e36f1;});}})[_0xe570('0x20')](respondWithFilteredResult(_0x120a43,_0x3b9c34))['catch'](handleError(_0x120a43,null));};exports[_0xe570('0x72')]=function(_0x174f55,_0x11ad1c,_0x24d8d0){return db[_0xe570('0x56')][_0xe570('0x5f')]({'where':{'id':_0x174f55[_0xe570('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11ad1c,null))[_0xe570('0x20')](function(_0x7a14f9){if(_0x7a14f9){return _0x7a14f9[_0xe570('0x72')](_0x174f55[_0xe570('0x48')][_0xe570('0x73')]);}})[_0xe570('0x20')](respondWithStatusCode(_0x11ad1c,null))['catch'](handleError(_0x11ad1c,null));};exports[_0xe570('0x74')]=function(_0x4a80bc,_0x45c973,_0x24d2e0){return db['FaxInteraction']['find']({'where':{'id':_0x4a80bc[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x45c973,null))[_0xe570('0x20')](function(_0x522a2f){if(_0x522a2f){return _0x522a2f[_0xe570('0x74')](_0x4a80bc[_0xe570('0x61')][_0xe570('0x73')],_[_0xe570('0x75')](_0x4a80bc[_0xe570('0x61')],[_0xe570('0x73'),'id'])||{});}})[_0xe570('0x20')](respondWithResult(_0x45c973,null))[_0xe570('0x2b')](handleError(_0x45c973,null));};exports[_0xe570('0x76')]=function(_0x2eb307,_0x2ddf6d,_0x525b58){var _0xf9b658={'raw':![],'where':{}};var _0x432fb1={};var _0x2966a0={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2eb307[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x2ddf6d,null))[_0xe570('0x20')](function(_0x6ac46){if(_0x6ac46){_0x432fb1[_0xe570('0x47')]=_[_0xe570('0x5c')](db[_0xe570('0x77')]['rawAttributes']);_0x432fb1['query']=_[_0xe570('0x5c')](_0x2eb307[_0xe570('0x48')]);_0x432fb1[_0xe570('0x49')]=_[_0xe570('0x4a')](_0x432fb1[_0xe570('0x47')],_0x432fb1[_0xe570('0x48')]);_0xf9b658['attributes']=_[_0xe570('0x4a')](_0x432fb1[_0xe570('0x47')],qs[_0xe570('0x5d')](_0x2eb307[_0xe570('0x48')][_0xe570('0x5d')]));_0xf9b658['attributes']=_0xf9b658[_0xe570('0x4b')]['length']?_0xf9b658[_0xe570('0x4b')]:_0x432fb1['model'];if(!_0x2eb307[_0xe570('0x48')][_0xe570('0x4d')](_0xe570('0x4e'))){_0xf9b658[_0xe570('0x30')]=qs[_0xe570('0x30')](_0x2eb307[_0xe570('0x48')][_0xe570('0x30')]);_0xf9b658[_0xe570('0x32')]=qs[_0xe570('0x32')](_0x2eb307[_0xe570('0x48')][_0xe570('0x32')]);}_0xf9b658['order']=qs[_0xe570('0x50')](_0x2eb307[_0xe570('0x48')][_0xe570('0x50')]);_0xf9b658[_0xe570('0x51')]=qs['filters'](_['pick'](_0x2eb307['query'],_0x432fb1[_0xe570('0x49')]));_0xf9b658[_0xe570('0x51')][_0xe570('0x69')]=_0x6ac46['id'];if(_0x2eb307['query'][_0xe570('0x53')]){_0xf9b658[_0xe570('0x51')]=_['merge'](_0xf9b658[_0xe570('0x51')],{'$or':_[_0xe570('0x43')](_0xf9b658[_0xe570('0x4b')],function(_0x4de100){var _0x5801bb={};_0x5801bb[_0x4de100]={'$like':'%'+_0x2eb307[_0xe570('0x48')][_0xe570('0x53')]+'%'};return _0x5801bb;})});}_0xf9b658=_[_0xe570('0x54')]({},_0xf9b658,_0x2eb307[_0xe570('0x5e')]);return db[_0xe570('0x77')][_0xe570('0x31')]({'where':_0xf9b658[_0xe570('0x51')]})['then'](function(_0x124a8a){_0x2966a0[_0xe570('0x31')]=_0x124a8a;if(_0x2eb307[_0xe570('0x48')][_0xe570('0x57')]){_0xf9b658[_0xe570('0x6c')]=[{'model':db[_0xe570('0x78')],'as':_0xe570('0x79'),'required':![]},{'model':db[_0xe570('0x7a')],'as':'Owner','attributes':[_0xe570('0x3e'),_0xe570('0x7b'),_0xe570('0x7c')],'required':![]},{'model':db['Tag'],'as':_0xe570('0x7d'),'attributes':['id','name',_0xe570('0x7e')],'where':_0x2eb307[_0xe570('0x48')][_0xe570('0x7f')]?{'id':_0x2eb307[_0xe570('0x48')][_0xe570('0x7f')]}:undefined,'required':_0x2eb307[_0xe570('0x48')]['tag']?!![]:![]}];}return db[_0xe570('0x77')][_0xe570('0x58')](_0xf9b658);})[_0xe570('0x20')](function(_0x538818){_0x2966a0[_0xe570('0x59')]=_0x538818;return _0x2966a0;});}})[_0xe570('0x20')](respondWithFilteredResult(_0x2ddf6d,_0xf9b658))['catch'](handleError(_0x2ddf6d,null));};exports['addApplications']=function(_0x548c61,_0x359c45){var _0x22c2b6=_0x548c61[_0xe570('0x5b')]['id'];var _0x3c6dc5=_0x548c61[_0xe570('0x61')];var _0x317e5b=0xc8;var _0x217bd7=null;return db['sequelize'][_0xe570('0x80')]({'isolationLevel':db[_0xe570('0x81')]['Transaction'][_0xe570('0x82')]['READ_COMMITTED']},function(_0x28166b){return db['FaxAccount']['findOne']({'where':{'id':_0x22c2b6},'transaction':_0x28166b})[_0xe570('0x20')](function(_0x597998){if(_0x597998){return db[_0xe570('0x83')]['destroy']({'where':{'FaxAccountId':_0x22c2b6},'transaction':_0x28166b})[_0xe570('0x20')](function(){var _0x191296=_[_0xe570('0x43')](_0x3c6dc5,function(_0x46c562){_0x46c562['FaxAccountId']=_0x22c2b6;return _0x46c562;});return db[_0xe570('0x83')][_0xe570('0x84')](_0x191296,{'transaction':_0x28166b});});}else{_0x317e5b=0x194;_0x217bd7=[];}});})['then'](function(){if(_0x317e5b!==0x194){return db[_0xe570('0x83')][_0xe570('0x85')]({'where':{'FaxAccountId':_0x22c2b6},'order':_0xe570('0x86')})[_0xe570('0x20')](function(_0x105d10){_0x217bd7=_0x105d10;});}})[_0xe570('0x2b')](function(_0x340dca){_0x317e5b=0x1f4;logger[_0xe570('0x26')](_0x340dca[_0xe570('0x87')]);if(_0x340dca['name']){delete _0x340dca[_0xe570('0x3e')];}_0x217bd7=_0x340dca;})[_0xe570('0x88')](function(){if(_0x217bd7===null){_0x359c45[_0xe570('0x3d')](_0x317e5b);}else{if(_0x317e5b===0x1f4){_0x359c45[_0xe570('0x2c')](_0x317e5b)[_0xe570('0x3f')](_0x217bd7);}else{_0x359c45['status'](_0x317e5b)[_0xe570('0x2e')](_0x217bd7);}}});};exports[_0xe570('0x89')]=function(_0x500c24,_0x5c8e93,_0x381b5f){var _0x37e657={};var _0x4c90c5={};var _0x24c662;var _0x151c1d;return db[_0xe570('0x56')][_0xe570('0x6b')]({'where':{'id':_0x500c24[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x5c8e93,null))[_0xe570('0x20')](function(_0x183b19){if(_0x183b19){_0x24c662=_0x183b19;_0x4c90c5[_0xe570('0x47')]=_['keys'](db['FaxApplication'][_0xe570('0x44')]);_0x4c90c5[_0xe570('0x48')]=_['keys'](_0x500c24['query']);_0x4c90c5[_0xe570('0x49')]=_[_0xe570('0x4a')](_0x4c90c5[_0xe570('0x47')],_0x4c90c5[_0xe570('0x48')]);_0x37e657[_0xe570('0x4b')]=_[_0xe570('0x4a')](_0x4c90c5[_0xe570('0x47')],qs[_0xe570('0x5d')](_0x500c24['query'][_0xe570('0x5d')]));_0x37e657[_0xe570('0x4b')]=_0x37e657[_0xe570('0x4b')][_0xe570('0x4c')]?_0x37e657[_0xe570('0x4b')]:_0x4c90c5[_0xe570('0x47')];_0x37e657[_0xe570('0x4f')]=qs[_0xe570('0x50')](_0x500c24[_0xe570('0x48')][_0xe570('0x50')]);_0x37e657[_0xe570('0x51')]=qs[_0xe570('0x49')](_[_0xe570('0x52')](_0x500c24[_0xe570('0x48')],_0x4c90c5[_0xe570('0x49')]));if(_0x500c24[_0xe570('0x48')][_0xe570('0x53')]){_0x37e657[_0xe570('0x51')]=_['merge'](_0x37e657['where'],{'$or':_[_0xe570('0x43')](_0x37e657['attributes'],function(_0x7d5bec){var _0x59cfad={};_0x59cfad[_0x7d5bec]={'$like':'%'+_0x500c24['query'][_0xe570('0x53')]+'%'};return _0x59cfad;})});}_0x37e657=_['merge']({},_0x37e657,_0x500c24[_0xe570('0x5e')]);return _0x24c662[_0xe570('0x89')](_0x37e657);}})[_0xe570('0x20')](function(_0x1806c3){if(_0x1806c3){_0x151c1d=_0x1806c3[_0xe570('0x4c')];if(!_0x500c24['query'][_0xe570('0x4d')](_0xe570('0x4e'))){_0x37e657[_0xe570('0x30')]=qs[_0xe570('0x30')](_0x500c24[_0xe570('0x48')][_0xe570('0x30')]);_0x37e657[_0xe570('0x32')]=qs[_0xe570('0x32')](_0x500c24['query'][_0xe570('0x32')]);}return _0x24c662[_0xe570('0x89')](_0x37e657);}})[_0xe570('0x20')](function(_0x296ebc){if(_0x296ebc){return _0x296ebc?{'count':_0x151c1d,'rows':_0x296ebc}:null;}})[_0xe570('0x20')](respondWithResult(_0x5c8e93,null))[_0xe570('0x2b')](handleError(_0x5c8e93,null));};function Extension(_0x44c642,_0x86dcb7,_0x3b766e,_0x503e8d){this[_0xe570('0x8a')]=_0xe570('0x8b');this[_0xe570('0x8c')]=_0x44c642[_0xe570('0x8d')];this[_0xe570('0x8e')]=_0x503e8d;this[_0xe570('0x46')]=_0xe570('0x8f');this['description']='Fax\x20Extension';this[_0xe570('0x69')]=_0x44c642['id'];this['priority']=_0x86dcb7;this[_0xe570('0x90')]=_0x3b766e;}function createExtensionsReciveFax(_0x37a47e){var _0x11a1ed=0x1;var _0xf87810=[];_0xf87810['push'](new Extension(_0x37a47e,_0x11a1ed,'',_0xe570('0x91')));_0x11a1ed+=0x1;_0xf87810[_0xe570('0x92')](new Extension(_0x37a47e,_0x11a1ed,_0xe570('0x93'),'Set'));_0x11a1ed+=0x1;for(var _0x2787e5 in _0x37a47e){if(_0x37a47e[_0xe570('0x4d')](_0x2787e5)&&(_0x2787e5===_0xe570('0x94')||_0x2787e5===_0xe570('0x8d')||_0x2787e5==='gateway'||_0x2787e5===_0xe570('0x95')||_0x2787e5===_0xe570('0x96')||_0x2787e5===_0xe570('0x97')||_0x2787e5===_0xe570('0x98')||_0x2787e5===_0xe570('0x99')||_0x2787e5===_0xe570('0x9a'))){_0xf87810[_0xe570('0x92')](new Extension(_0x37a47e,_0x11a1ed,'FAXOPT('+_0x2787e5+')='+_0x37a47e[_0x2787e5],_0xe570('0x9b')));_0x11a1ed+=0x1;}}_0xf87810['push'](new Extension(_0x37a47e,_0x11a1ed,'6',_0xe570('0x9c')));_0x11a1ed+=0x1;_0xf87810[_0xe570('0x92')](new Extension(_0x37a47e,_0x11a1ed,_0xe570('0x9d'),_0xe570('0x9e')));_0x11a1ed=0x0;return _0xf87810;}exports[_0xe570('0x9f')]=function(_0x2221ea,_0x483241,_0x245342){var _0x200f44;return db[_0xe570('0x81')]['transaction'](function(_0x24ca78){return db['FaxAccount']['create'](_0x2221ea[_0xe570('0x61')],{'transaction':_0x24ca78})['then'](function(_0x45fcab){_0x200f44=_0x45fcab[_0xe570('0x3a')]({'plain':!![]});return db['VoiceExtension'][_0xe570('0x84')](createExtensionsReciveFax(_0x200f44),{'transaction':_0x24ca78});});})[_0xe570('0x20')](function(){return _0x200f44;})['then'](respondWithResult(_0x483241,null))['catch'](handleError(_0x483241,null));};exports[_0xe570('0xa0')]=function(_0x2dad1b,_0x4b3c62,_0xe4602c){var _0x5c1d82;return db[_0xe570('0x81')][_0xe570('0x80')](function(_0x5f2ab3){return db[_0xe570('0x56')][_0xe570('0x38')](_0x2dad1b[_0xe570('0x61')],{'where':{'id':_0x2dad1b[_0xe570('0x61')]['id']},'transaction':_0x5f2ab3})['then'](function(_0x267c0d){return db[_0xe570('0xa1')][_0xe570('0x39')]({'where':{'FaxAccountId':_0x2dad1b[_0xe570('0x61')]['id']},'transaction':_0x5f2ab3})['then'](function(_0x5b8c5c){return db[_0xe570('0xa1')][_0xe570('0x84')](createExtensionsReciveFax(_[_0xe570('0x75')](_0x2dad1b['body'],['tech',_0xe570('0xa2'),_0xe570('0xa3'),_0xe570('0xa4'),_0xe570('0xa5'),'ListId'])),{'transaction':_0x5f2ab3});});});})[_0xe570('0x20')](function(){return db[_0xe570('0x56')][_0xe570('0xa6')](_0x2dad1b['body']['id']);})['then'](respondWithResult(_0x4b3c62,null))[_0xe570('0x2b')](handleError(_0x4b3c62,null));};exports[_0xe570('0xa7')]=function(_0x57613e,_0x57cb31,_0x5c8a6e){var _0x580e15={'raw':!![],'where':{}};var _0x503c12={};var _0x100f56={'count':0x0,'rows':[]};return db[_0xe570('0x56')]['findOne']({'where':{'id':_0x57613e[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x57cb31,null))[_0xe570('0x20')](function(_0x2e6fcc){if(_0x2e6fcc){_0x503c12[_0xe570('0x47')]=_[_0xe570('0x5c')](db['FaxMessage'][_0xe570('0x44')]);_0x503c12[_0xe570('0x48')]=_[_0xe570('0x5c')](_0x57613e[_0xe570('0x48')]);_0x503c12[_0xe570('0x49')]=_['intersection'](_0x503c12['model'],_0x503c12[_0xe570('0x48')]);_0x580e15['attributes']=_['intersection'](_0x503c12[_0xe570('0x47')],qs[_0xe570('0x5d')](_0x57613e[_0xe570('0x48')][_0xe570('0x5d')]));_0x580e15[_0xe570('0x4b')]=_0x580e15['attributes'][_0xe570('0x4c')]?_0x580e15[_0xe570('0x4b')]:_0x503c12['model'];if(!_0x57613e[_0xe570('0x48')][_0xe570('0x4d')](_0xe570('0x4e'))){_0x580e15[_0xe570('0x30')]=qs['limit'](_0x57613e[_0xe570('0x48')]['limit']);_0x580e15[_0xe570('0x32')]=qs[_0xe570('0x32')](_0x57613e[_0xe570('0x48')]['offset']);}_0x580e15[_0xe570('0x4f')]=qs[_0xe570('0x50')](_0x57613e['query'][_0xe570('0x50')]);_0x580e15[_0xe570('0x51')]=qs[_0xe570('0x49')](_[_0xe570('0x52')](_0x57613e[_0xe570('0x48')],_0x503c12[_0xe570('0x49')]));_0x580e15[_0xe570('0x51')]['FaxAccountId']=_0x2e6fcc['id'];if(_0x57613e['query'][_0xe570('0x53')]){_0x580e15[_0xe570('0x51')]=_[_0xe570('0x54')](_0x580e15['where'],{'$or':_[_0xe570('0x43')](_0x580e15[_0xe570('0x4b')],function(_0x435a15){var _0x369334={};_0x369334[_0x435a15]={'$like':'%'+_0x57613e[_0xe570('0x48')][_0xe570('0x53')]+'%'};return _0x369334;})});}if(_0x57613e[_0xe570('0x48')][_0xe570('0xa8')]){var _0x410d3b=_0x57613e[_0xe570('0x48')][_0xe570('0xa8')][_0xe570('0xa9')](',');var _0x5a16e3={};_0x5a16e3[_0x410d3b[0x0]]={'$gte':moment(_0x410d3b[0x1])[_0xe570('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x580e15[_0xe570('0x51')]=_[_0xe570('0x54')](_0x580e15[_0xe570('0x51')],_0x5a16e3);}_0x580e15=_[_0xe570('0x54')]({},_0x580e15,_0x57613e[_0xe570('0x5e')]);return db[_0xe570('0xab')]['count']({'where':_0x580e15['where']})['then'](function(_0x1a6442){_0x100f56[_0xe570('0x31')]=_0x1a6442;if(_0x57613e[_0xe570('0x48')][_0xe570('0x57')]){_0x580e15[_0xe570('0x6c')]=[{'all':!![]}];}return db[_0xe570('0xab')]['findAll'](_0x580e15);})['then'](function(_0x5f19ae){_0x100f56[_0xe570('0x59')]=_0x5f19ae;return _0x100f56;});}})[_0xe570('0x20')](respondWithFilteredResult(_0x57cb31,_0x580e15))['catch'](handleError(_0x57cb31,null));};exports[_0xe570('0x3f')]=function(_0x3c6fa3,_0x589732,_0x202c8e){var _0x1b47ad,_0x1492bf={},_0x11d566;if(_0x3c6fa3['body']['to']){_0x11d566=_0x3c6fa3[_0xe570('0x61')]['to'][0x0];}return db[_0xe570('0x56')][_0xe570('0x5f')]({'where':{'id':_0x3c6fa3[_0xe570('0x5b')]['id']},'include':[{'model':db[_0xe570('0xac')],'as':'List','include':[{'model':db['CmContact'],'as':_0xe570('0xad'),'where':{'fax':_0x11d566},'limit':0x1,'order':[[_0xe570('0xa4'),_0xe570('0xae')]]}]}]})[_0xe570('0x20')](handleEntityNotFound(_0x589732,null))['then'](function(_0x418917){_0x1b47ad=_0x418917;if(_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')]&&_0x3c6fa3['body'][_0xe570('0xaf')]['length']){for(var _0x1dcc66=0x0;_0x1dcc66<_0x3c6fa3[_0xe570('0x61')]['attachments']['length'];_0x1dcc66+=0x1){_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][_0x1dcc66]={'filename':_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][_0x1dcc66][_0xe570('0x3e')],'id':_0x3c6fa3['body'][_0xe570('0xaf')][_0x1dcc66]['id'],'path':path[_0xe570('0xb0')](config['root'],_0xe570('0xb1'),_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][_0x1dcc66][_0xe570('0xb2')])};}}return respondWithRpcPromise(_0xe570('0xb3'),'CheckAfterSend',{'FaxAccountId':_[_0xe570('0xb4')](_0x3c6fa3['params']['id'])?undefined:_0x3c6fa3['params']['id'],'path':_['isNil'](_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][0x0]['path'])?undefined:_0x3c6fa3['body'][_0xe570('0xaf')][0x0][_0xe570('0xb5')],'fax':_[_0xe570('0xb4')](_0x3c6fa3[_0xe570('0x61')]['to'][0x0])?undefined:_0x3c6fa3[_0xe570('0x61')]['to'][0x0]},client9002);})[_0xe570('0x20')](function(){if(_0x1b47ad){if(_[_0xe570('0xb4')](_0x3c6fa3[_0xe570('0x61')][_0xe570('0xb6')])){_0x3c6fa3[_0xe570('0x61')][_0xe570('0xb6')]=util[_0xe570('0xaa')](_0xe570('0xb7'),_0x1b47ad[_0xe570('0x3e')],_0x1b47ad[_0xe570('0xb8')]);}if(_0x1b47ad[_0xe570('0xb9')]){if(_0x1b47ad['List'][_0xe570('0xad')][_0xe570('0x4c')]){return _0x1b47ad['List'][_0xe570('0xad')][0x0];}else{return db[_0xe570('0x78')][_0xe570('0x60')](_[_0xe570('0xba')](_0x3c6fa3[_0xe570('0x61')],{'firstName':_0x3c6fa3[_0xe570('0x61')]['to'][0x0],'phone':_0x3c6fa3[_0xe570('0x61')]['to'][0x0],'fax':_0x3c6fa3[_0xe570('0x61')]['to'][0x0],'ListId':_0x1b47ad[_0xe570('0xbb')]}));}}else{throw new Error(_0xe570('0xbc'));}}else{throw new Error(_0xe570('0xbd'));}})[_0xe570('0x20')](function(_0xc5ce1b){if(_0xc5ce1b){return db['FaxInteraction']['find']({'where':{'ContactId':_0xc5ce1b['id'],'closed':![],'FaxAccountId':_0x1b47ad['id']}})[_0xe570('0x20')](function(_0xc6167b){if(_0xc6167b){return[_0xc6167b,![]];}return db[_0xe570('0x77')][_0xe570('0x60')]({'UserId':_0x3c6fa3[_0xe570('0x62')]['id'],'ContactId':_0xc5ce1b['id'],'FaxAccountId':_0x1b47ad['id'],'fax':_0x3c6fa3['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xe570('0x54')](_0x3c6fa3['body'],{'read':![],'body':_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][0x0]['filename'],'FaxAccountId':_0x1b47ad['id'],'UserId':_0x3c6fa3[_0xe570('0x62')]['id'],'ContactId':_0xc5ce1b['id'],'AttachmentId':_0x3c6fa3[_0xe570('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xe570('0xab')],'as':_0xe570('0xbe')}]})[_0xe570('0x20')](function(_0x100c3d){return[_0x100c3d,!![]];});});}else{throw new Error(_0xe570('0xbf'));}})['spread'](function(_0x4fe0d7,_0x5d2c7a){if(_0x5d2c7a){return _0x4fe0d7;}return db[_0xe570('0xab')][_0xe570('0x60')]({'direction':'out','read':![],'body':_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][0x0]['filename'],'FaxAccountId':_0x1b47ad['id'],'FaxInteractionId':_0x4fe0d7['id'],'UserId':_0x3c6fa3[_0xe570('0x62')]['id'],'ContactId':_0x4fe0d7['ContactId'],'AttachmentId':_0x3c6fa3['body'][_0xe570('0xaf')][0x0]['id']})[_0xe570('0x20')](function(_0x5c4c09){_0x4fe0d7['dataValues'][_0xe570('0xbe')]=[];_0x4fe0d7[_0xe570('0xc0')][_0xe570('0xbe')][_0xe570('0x92')](_0x5c4c09[_0xe570('0xc0')]);return _0x4fe0d7;});})[_0xe570('0x20')](function(_0x3b7d97){respondWithRpcPromise(_0xe570('0xc1'),_0xe570('0xc1'),{'FaxAccountId':_['isNil'](_0x3c6fa3[_0xe570('0x5b')]['id'])?undefined:_0x3c6fa3[_0xe570('0x5b')]['id'],'path':_[_0xe570('0xb4')](_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][0x0][_0xe570('0xb5')])?undefined:_0x3c6fa3['body']['attachments'][0x0][_0xe570('0xb5')],'fax':_[_0xe570('0xb4')](_0x3c6fa3[_0xe570('0x61')]['to'][0x0])?undefined:_0x3c6fa3[_0xe570('0x61')]['to'][0x0],'AttachmentId':_0x3c6fa3[_0xe570('0x61')][_0xe570('0xaf')][0x0]['id']},client9002)[_0xe570('0x20')](function(_0x1a64d4){logger[_0xe570('0x21')](_0xe570('0xc2'),_0x1a64d4);})[_0xe570('0x2b')](function(_0x3cec2a){logger[_0xe570('0x21')](_0xe570('0xc2'),_0x3cec2a);});return _0x3b7d97;})[_0xe570('0x20')](respondWithResult(_0x589732,null))['catch'](handleError(_0x589732,null));};exports[_0xe570('0xc3')]=function(_0x11dd82,_0x1886be,_0x567157){return db[_0xe570('0x56')][_0xe570('0x5f')]({'where':{'id':_0x11dd82[_0xe570('0x5b')]['id']}})[_0xe570('0x20')](handleEntityNotFound(_0x1886be,null))[_0xe570('0x20')](function(_0x458e0e){if(_0x458e0e){return _0x458e0e[_0xe570('0xc3')](_0x11dd82['body'][_0xe570('0x73')],_[_0xe570('0x75')](_0x11dd82[_0xe570('0x61')],[_0xe570('0x73'),'id'])||{})[_0xe570('0xc4')](function(_0x16baa3){for(var _0x49f87d=0x0;_0x49f87d<_0x11dd82['body'][_0xe570('0x73')][_0xe570('0x4c')];_0x49f87d+=0x1){socket[_0xe570('0xc5')](_0xe570('0xc6'),{'UserId':Number(_0x11dd82[_0xe570('0x61')][_0xe570('0x73')][_0x49f87d]),'FaxAccountId':Number(_0x11dd82[_0xe570('0x5b')]['id'])});}return _0x16baa3;});}})[_0xe570('0x20')](respondWithResult(_0x1886be,null))[_0xe570('0x2b')](handleError(_0x1886be,null));};exports['removeAgents']=function(_0x1b454a,_0x388574,_0x2358d3){return db[_0xe570('0x56')]['find']({'where':{'id':_0x1b454a[_0xe570('0x5b')]['id']}})['then'](handleEntityNotFound(_0x388574,null))[_0xe570('0x20')](function(_0x28e4ad){if(_0x28e4ad){return _0x28e4ad[_0xe570('0xc7')](_0x1b454a['query']['ids'])['then'](function(){if(_['isArray'](_0x1b454a['query'][_0xe570('0x73')])){for(var _0x93856=0x0;_0x93856<_0x1b454a[_0xe570('0x48')][_0xe570('0x73')][_0xe570('0x4c')];_0x93856+=0x1){socket[_0xe570('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x1b454a[_0xe570('0x48')][_0xe570('0x73')][_0x93856]),'FaxAccountId':Number(_0x1b454a[_0xe570('0x5b')]['id'])});}}else{socket[_0xe570('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x1b454a[_0xe570('0x48')]['ids']),'FaxAccountId':Number(_0x1b454a[_0xe570('0x5b')]['id'])});}});}})[_0xe570('0x20')](respondWithStatusCode(_0x388574,null))['catch'](handleError(_0x388574,null));};exports['getAgents']=function(_0xaddbe7,_0x5cf130,_0x5e0793){var _0x50a48a={};var _0x392010={};var _0x47743b;var _0x148165;return db[_0xe570('0x56')][_0xe570('0x6b')]({'where':{'id':_0xaddbe7[_0xe570('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5cf130,null))[_0xe570('0x20')](function(_0x4203f0){if(_0x4203f0){_0x47743b=_0x4203f0;_0x392010[_0xe570('0x47')]=_[_0xe570('0x5c')](db[_0xe570('0x7a')][_0xe570('0x44')]);_0x392010[_0xe570('0x48')]=_[_0xe570('0x5c')](_0xaddbe7[_0xe570('0x48')]);_0x392010[_0xe570('0x49')]=_[_0xe570('0x4a')](_0x392010[_0xe570('0x47')],_0x392010[_0xe570('0x48')]);_0x50a48a['attributes']=_[_0xe570('0x4a')](_0x392010[_0xe570('0x47')],qs[_0xe570('0x5d')](_0xaddbe7['query']['fields']));_0x50a48a[_0xe570('0x4b')]=_0x50a48a[_0xe570('0x4b')][_0xe570('0x4c')]?_0x50a48a['attributes']:_0x392010['model'];_0x50a48a['order']=qs[_0xe570('0x50')](_0xaddbe7[_0xe570('0x48')]['sort']);_0x50a48a[_0xe570('0x51')]=qs[_0xe570('0x49')](_[_0xe570('0x52')](_0xaddbe7['query'],_0x392010['filters']));if(_0xaddbe7['query']['filter']){_0x50a48a[_0xe570('0x51')]=_['merge'](_0x50a48a[_0xe570('0x51')],{'$or':_[_0xe570('0x43')](_0x50a48a[_0xe570('0x4b')],function(_0x44dbba){var _0x347c14={};_0x347c14[_0x44dbba]={'$like':'%'+_0xaddbe7[_0xe570('0x48')]['filter']+'%'};return _0x347c14;})});}_0x50a48a=_[_0xe570('0x54')]({},_0x50a48a,_0xaddbe7[_0xe570('0x5e')]);return _0x47743b['getAgents'](_0x50a48a);}})[_0xe570('0x20')](function(_0x57da33){if(_0x57da33){_0x148165=_0x57da33[_0xe570('0x4c')];if(!_0xaddbe7['query'][_0xe570('0x4d')]('nolimit')){_0x50a48a['limit']=qs[_0xe570('0x30')](_0xaddbe7['query'][_0xe570('0x30')]);_0x50a48a[_0xe570('0x32')]=qs[_0xe570('0x32')](_0xaddbe7[_0xe570('0x48')][_0xe570('0x32')]);}return _0x47743b[_0xe570('0xc8')](_0x50a48a);}})[_0xe570('0x20')](function(_0x9dd35d){if(_0x9dd35d){return _0x9dd35d?{'count':_0x148165,'rows':_0x9dd35d}:null;}})[_0xe570('0x20')](respondWithResult(_0x5cf130,null))[_0xe570('0x2b')](handleError(_0x5cf130,null));}; \ No newline at end of file +var _0x4302=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','reject','save','update','then','get','FaxAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','map','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','FaxAccount','includeAll','findAll','rows','show','params','Pause','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','FaxApplication','findAndCountAll','priority','finally','send','getApplications','context','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','addAccountApplications','VoiceExtension','bulkCreate','createdAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','ListId','List\x20not\x20found','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2c984d,_0x5a6f2f){var _0x31df62=function(_0x180acd){while(--_0x180acd){_0x2c984d['push'](_0x2c984d['shift']());}};_0x31df62(++_0x5a6f2f);}(_0x4302,0x17a));var _0x2430=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4302[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x2430('0x0'));var rimraf=require(_0x2430('0x1'));var zipdir=require(_0x2430('0x2'));var jsonpatch=require(_0x2430('0x3'));var rp=require(_0x2430('0x4'));var moment=require('moment');var BPromise=require(_0x2430('0x5'));var Mustache=require(_0x2430('0x6'));var util=require(_0x2430('0x7'));var path=require(_0x2430('0x8'));var sox=require(_0x2430('0x9'));var csv=require(_0x2430('0xa'));var ejs=require(_0x2430('0xb'));var fs=require('fs');var fs_extra=require(_0x2430('0xc'));var _=require(_0x2430('0xd'));var squel=require(_0x2430('0xe'));var crypto=require(_0x2430('0xf'));var jsforce=require(_0x2430('0x10'));var deskjs=require(_0x2430('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2430('0x12'));var Papa=require('papaparse');var Redis=require(_0x2430('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2430('0x14'));var as=require(_0x2430('0x15'));var hardwareService=require(_0x2430('0x16'));var logger=require(_0x2430('0x17'))('api');var utils=require(_0x2430('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2430('0x19'));var db=require(_0x2430('0x1a'))['db'];config[_0x2430('0x1b')]=_[_0x2430('0x1c')](config['redis'],{'host':_0x2430('0x1d'),'port':0x18eb});var socket=require(_0x2430('0x1e'))(new Redis(config[_0x2430('0x1b')]));require(_0x2430('0x1f'))[_0x2430('0x20')](socket);var jayson=require(_0x2430('0x21'));var client=jayson[_0x2430('0x22')][_0x2430('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x2430('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x23cd5a,_0x1294e2,_0x4a02c6,_0x1feac7){return new BPromise(function(_0x1982cc,_0x4069de){var _0xf50ce6=_0x1feac7||client;return _0xf50ce6['request'](_0x23cd5a,_0x4a02c6)['then'](function(_0x4bdade){logger[_0x2430('0x24')]('FaxAccount,\x20%s,\x20%s',_0x1294e2,_0x2430('0x25'));logger[_0x2430('0x26')](_0x2430('0x27'),_0x1294e2,_0x2430('0x25'),JSON[_0x2430('0x28')](_0x4bdade));if(_0x4bdade[_0x2430('0x29')]){if(_0x4bdade[_0x2430('0x29')][_0x2430('0x2a')]===0x1f4){logger[_0x2430('0x29')](_0x2430('0x2b'),_0x1294e2,_0x4bdade[_0x2430('0x29')][_0x2430('0x2c')]);return _0x4069de(_0x4bdade[_0x2430('0x29')][_0x2430('0x2c')]);}logger[_0x2430('0x29')](_0x2430('0x2b'),_0x1294e2,_0x4bdade[_0x2430('0x29')][_0x2430('0x2c')]);return _0x1982cc(_0x4bdade[_0x2430('0x29')][_0x2430('0x2c')]);}else{logger[_0x2430('0x24')](_0x2430('0x2b'),_0x1294e2,'request\x20sent');_0x1982cc(_0x4bdade[_0x2430('0x2d')][_0x2430('0x2c')]);}})[_0x2430('0x2e')](function(_0x3b0ba6){logger[_0x2430('0x29')]('FaxAccount,\x20%s,\x20%s',_0x1294e2,_0x3b0ba6);_0x4069de(_0x3b0ba6);});});}function respondWithStatusCode(_0x3f9178,_0x2188e0){_0x2188e0=_0x2188e0||0xcc;return function(_0x593dec){if(_0x593dec){return _0x3f9178['sendStatus'](_0x2188e0);}return _0x3f9178[_0x2430('0x2f')](_0x2188e0)['end']();};}function respondWithResult(_0x5f0233,_0x193df9){_0x193df9=_0x193df9||0xc8;return function(_0x5f2995){if(_0x5f2995){return _0x5f0233[_0x2430('0x2f')](_0x193df9)[_0x2430('0x30')](_0x5f2995);}};}function respondWithFilteredResult(_0x57c97c,_0x156dbe){return function(_0x863a21){if(_0x863a21){var _0x4e958f=typeof _0x156dbe[_0x2430('0x31')]==='undefined'&&typeof _0x156dbe[_0x2430('0x32')]===_0x2430('0x33');var _0x33dd94=_0x863a21[_0x2430('0x34')];var _0x3390ce=_0x4e958f?0x0:_0x156dbe[_0x2430('0x31')];var _0x1e0395=_0x4e958f?_0x863a21['count']:_0x156dbe[_0x2430('0x31')]+_0x156dbe['limit'];var _0x35229a;if(_0x1e0395>=_0x33dd94){_0x1e0395=_0x33dd94;_0x35229a=0xc8;}else{_0x35229a=0xce;}_0x57c97c[_0x2430('0x2f')](_0x35229a);return _0x57c97c[_0x2430('0x35')]('Content-Range',_0x3390ce+'-'+_0x1e0395+'/'+_0x33dd94)['json'](_0x863a21);}return null;};}function patchUpdates(_0x1ab36c){return function(_0x2ce903){try{jsonpatch['apply'](_0x2ce903,_0x1ab36c,!![]);}catch(_0x1b74ac){return BPromise[_0x2430('0x36')](_0x1b74ac);}return _0x2ce903[_0x2430('0x37')]();};}function saveUpdates(_0x3ea004,_0x3d2d05){return function(_0x3e548e){if(_0x3e548e){return _0x3e548e[_0x2430('0x38')](_0x3ea004)[_0x2430('0x39')](function(_0x4aa6c2){return _0x4aa6c2;});}return null;};}function removeEntity(_0x245fbb,_0xe0cd16){return function(_0x32e3ea){if(_0x32e3ea){return _0x32e3ea['destroy']()[_0x2430('0x39')](function(){var _0x3c855b=_0x32e3ea[_0x2430('0x3a')]({'plain':!![]});var _0x219adf=_0x2430('0x3b');return db[_0x2430('0x3c')]['destroy']({'where':{'type':_0x219adf,'resourceId':_0x3c855b['id']}})['then'](function(){return _0x32e3ea;});})[_0x2430('0x39')](function(){_0x245fbb[_0x2430('0x2f')](0xcc)[_0x2430('0x3d')]();});}};}function handleEntityNotFound(_0xf997ef,_0x42ae21){return function(_0x5e1697){if(!_0x5e1697){_0xf997ef['sendStatus'](0x194);}return _0x5e1697;};}function handleError(_0xb59b5f,_0x5905e9){_0x5905e9=_0x5905e9||0x1f4;return function(_0x2a4c91){logger[_0x2430('0x29')](_0x2a4c91[_0x2430('0x3e')]);if(_0x2a4c91[_0x2430('0x3f')]){delete _0x2a4c91['name'];}_0xb59b5f[_0x2430('0x2f')](_0x5905e9)['send'](_0x2a4c91);};}exports[_0x2430('0x40')]=function(_0x14c6a4,_0x2389de){var _0x10800f={'include':[{'model':db['Pause'],'as':_0x2430('0x41')}]},_0x4d2a2d={},_0xa54753={'count':0x0,'rows':[]};var _0x5f2c23=_[_0x2430('0x42')](db['FaxAccount']['rawAttributes'],function(_0x49688d){return{'name':_0x49688d['fieldName'],'type':_0x49688d['type'][_0x2430('0x43')]};});_0x4d2a2d[_0x2430('0x44')]=_[_0x2430('0x42')](_0x5f2c23,'name');_0x4d2a2d[_0x2430('0x45')]=_[_0x2430('0x46')](_0x14c6a4[_0x2430('0x45')]);_0x4d2a2d[_0x2430('0x47')]=_[_0x2430('0x48')](_0x4d2a2d[_0x2430('0x44')],_0x4d2a2d[_0x2430('0x45')]);_0x10800f['attributes']=_[_0x2430('0x48')](_0x4d2a2d[_0x2430('0x44')],qs['fields'](_0x14c6a4[_0x2430('0x45')][_0x2430('0x49')]));_0x10800f[_0x2430('0x4a')]=_0x10800f[_0x2430('0x4a')][_0x2430('0x4b')]?_0x10800f[_0x2430('0x4a')]:_0x4d2a2d['model'];if(!_0x14c6a4[_0x2430('0x45')][_0x2430('0x4c')](_0x2430('0x4d'))){_0x10800f[_0x2430('0x32')]=qs['limit'](_0x14c6a4[_0x2430('0x45')][_0x2430('0x32')]);_0x10800f[_0x2430('0x31')]=qs['offset'](_0x14c6a4[_0x2430('0x45')]['offset']);}_0x10800f[_0x2430('0x4e')]=qs[_0x2430('0x4f')](_0x14c6a4[_0x2430('0x45')][_0x2430('0x4f')]);_0x10800f['where']=qs[_0x2430('0x47')](_[_0x2430('0x50')](_0x14c6a4['query'],_0x4d2a2d['filters']),_0x5f2c23);if(_0x14c6a4['query'][_0x2430('0x51')]){_0x10800f['where']=_[_0x2430('0x52')](_0x10800f['where'],{'$or':_[_0x2430('0x42')](_0x5f2c23,function(_0x521594){if(_0x521594[_0x2430('0x53')]!==_0x2430('0x54')){var _0x22a75d={};_0x22a75d[_0x521594['name']]={'$like':'%'+_0x14c6a4[_0x2430('0x45')][_0x2430('0x51')]+'%'};return _0x22a75d;}})});}_0x10800f=_[_0x2430('0x52')]({},_0x10800f,_0x14c6a4[_0x2430('0x55')]);var _0x5be751={'where':_0x10800f[_0x2430('0x56')]};return db[_0x2430('0x57')][_0x2430('0x34')](_0x5be751)[_0x2430('0x39')](function(_0x51abb6){_0xa54753[_0x2430('0x34')]=_0x51abb6;if(_0x14c6a4[_0x2430('0x45')][_0x2430('0x58')]){_0x10800f['include']=[{'all':!![]}];}return db['FaxAccount'][_0x2430('0x59')](_0x10800f);})[_0x2430('0x39')](function(_0x5b1fb5){_0xa54753[_0x2430('0x5a')]=_0x5b1fb5;return _0xa54753;})[_0x2430('0x39')](respondWithFilteredResult(_0x2389de,_0x10800f))[_0x2430('0x2e')](handleError(_0x2389de,null));};exports[_0x2430('0x5b')]=function(_0xc35aa7,_0x3e1474){var _0x279bbd={'raw':![],'where':{'id':_0xc35aa7[_0x2430('0x5c')]['id']},'include':[{'model':db[_0x2430('0x5d')],'as':'mandatoryDispositionPause'}]},_0x6dba5f={};_0x6dba5f['model']=_[_0x2430('0x46')](db[_0x2430('0x57')][_0x2430('0x5e')]);_0x6dba5f[_0x2430('0x45')]=_[_0x2430('0x46')](_0xc35aa7[_0x2430('0x45')]);_0x6dba5f[_0x2430('0x47')]=_[_0x2430('0x48')](_0x6dba5f[_0x2430('0x44')],_0x6dba5f[_0x2430('0x45')]);_0x279bbd[_0x2430('0x4a')]=_[_0x2430('0x48')](_0x6dba5f['model'],qs['fields'](_0xc35aa7[_0x2430('0x45')][_0x2430('0x49')]));_0x279bbd[_0x2430('0x4a')]=_0x279bbd['attributes'][_0x2430('0x4b')]?_0x279bbd[_0x2430('0x4a')]:_0x6dba5f['model'];if(_0xc35aa7[_0x2430('0x45')][_0x2430('0x58')]){_0x279bbd[_0x2430('0x5f')]=[{'all':!![]}];}_0x279bbd=_[_0x2430('0x52')]({},_0x279bbd,_0xc35aa7[_0x2430('0x55')]);return db['FaxAccount'][_0x2430('0x60')](_0x279bbd)[_0x2430('0x39')](handleEntityNotFound(_0x3e1474,null))[_0x2430('0x39')](respondWithResult(_0x3e1474,null))[_0x2430('0x2e')](handleError(_0x3e1474,null));};exports[_0x2430('0x61')]=function(_0x4934d5,_0x54f080){return db['FaxAccount'][_0x2430('0x61')](_0x4934d5[_0x2430('0x62')],{})[_0x2430('0x39')](function(_0xd7f19c){var _0x48964e=_0x4934d5['user'][_0x2430('0x3a')]({'plain':!![]});if(!_0x48964e)throw new Error(_0x2430('0x63'));if(_0x48964e['role']===_0x2430('0x64')){var _0x5786cd=_0xd7f19c[_0x2430('0x3a')]({'plain':!![]});var _0x28928f=_0x2430('0x3b');return db[_0x2430('0x65')][_0x2430('0x60')]({'where':{'name':_0x28928f,'userProfileId':_0x48964e[_0x2430('0x66')]},'raw':!![]})[_0x2430('0x39')](function(_0x299c10){if(_0x299c10&&_0x299c10[_0x2430('0x67')]===0x0){return db['UserProfileResource'][_0x2430('0x61')]({'name':_0x5786cd[_0x2430('0x3f')],'resourceId':_0x5786cd['id'],'type':_0x299c10['name'],'sectionId':_0x299c10['id']},{})[_0x2430('0x39')](function(){return _0xd7f19c;});}else{return _0xd7f19c;}})[_0x2430('0x2e')](function(_0x29a1a4){logger[_0x2430('0x29')](_0x2430('0x68'),_0x29a1a4);throw _0x29a1a4;});}return _0xd7f19c;})['then'](respondWithResult(_0x54f080,0xc9))[_0x2430('0x2e')](handleError(_0x54f080,null));};exports[_0x2430('0x38')]=function(_0x322819,_0x1ff142){if(_0x322819['body']['id']){delete _0x322819[_0x2430('0x62')]['id'];}return db[_0x2430('0x57')][_0x2430('0x60')]({'where':{'id':_0x322819[_0x2430('0x5c')]['id']},'include':[{'model':db[_0x2430('0x5d')],'as':_0x2430('0x41')}]})['then'](handleEntityNotFound(_0x1ff142,null))[_0x2430('0x39')](saveUpdates(_0x322819['body'],null))['then'](respondWithResult(_0x1ff142,null))[_0x2430('0x2e')](handleError(_0x1ff142,null));};exports[_0x2430('0x69')]=function(_0x54be30,_0xa1d2cd){return db['FaxAccount'][_0x2430('0x60')]({'where':{'id':_0x54be30[_0x2430('0x5c')]['id']}})[_0x2430('0x39')](handleEntityNotFound(_0xa1d2cd,null))[_0x2430('0x39')](removeEntity(_0xa1d2cd,null))['catch'](handleError(_0xa1d2cd,null));};exports[_0x2430('0x6a')]=function(_0x5c8312,_0x2cf3fb){return db[_0x2430('0x57')][_0x2430('0x6a')]()[_0x2430('0x39')](respondWithResult(_0x2cf3fb,null))[_0x2430('0x2e')](handleError(_0x2cf3fb,null));};exports[_0x2430('0x6b')]=function(_0x2babf6,_0xe9a777,_0x408fae){if(_0x2babf6['body']['id']){delete _0x2babf6[_0x2430('0x62')]['id'];}return db[_0x2430('0x57')]['find']({'where':{'id':_0x2babf6[_0x2430('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe9a777,null))[_0x2430('0x39')](function(_0x3693a7){if(_0x3693a7){_0x2babf6[_0x2430('0x62')]['FaxAccountId']=_0x3693a7['id'];return db[_0x2430('0x6c')][_0x2430('0x61')](_0x2babf6['body']);}})[_0x2430('0x39')](respondWithResult(_0xe9a777,null))[_0x2430('0x2e')](handleError(_0xe9a777,null));};exports[_0x2430('0x6d')]=function(_0x3bcb48,_0x25b0ce,_0x262398){var _0x7a9af4={'raw':![],'where':{}};var _0x58c0c0={};var _0xe994af={'count':0x0,'rows':[]};return db[_0x2430('0x57')][_0x2430('0x6e')]({'where':{'id':_0x3bcb48[_0x2430('0x5c')]['id']}})['then'](handleEntityNotFound(_0x25b0ce,null))['then'](function(_0x1d43c1){if(_0x1d43c1){_0x58c0c0['model']=_[_0x2430('0x46')](db['Disposition']['rawAttributes']);_0x58c0c0[_0x2430('0x45')]=_[_0x2430('0x46')](_0x3bcb48[_0x2430('0x45')]);_0x58c0c0[_0x2430('0x47')]=_[_0x2430('0x48')](_0x58c0c0['model'],_0x58c0c0[_0x2430('0x45')]);_0x7a9af4[_0x2430('0x4a')]=_['intersection'](_0x58c0c0[_0x2430('0x44')],qs[_0x2430('0x49')](_0x3bcb48['query']['fields']));_0x7a9af4[_0x2430('0x4a')]=_0x7a9af4[_0x2430('0x4a')]['length']?_0x7a9af4[_0x2430('0x4a')]:_0x58c0c0[_0x2430('0x44')];if(!_0x3bcb48[_0x2430('0x45')]['hasOwnProperty'](_0x2430('0x4d'))){_0x7a9af4[_0x2430('0x32')]=qs[_0x2430('0x32')](_0x3bcb48[_0x2430('0x45')]['limit']);_0x7a9af4['offset']=qs['offset'](_0x3bcb48['query'][_0x2430('0x31')]);}_0x7a9af4['order']=qs[_0x2430('0x4f')](_0x3bcb48[_0x2430('0x45')][_0x2430('0x4f')]);_0x7a9af4[_0x2430('0x56')]=qs[_0x2430('0x47')](_['pick'](_0x3bcb48[_0x2430('0x45')],_0x58c0c0['filters']));_0x7a9af4['where'][_0x2430('0x6f')]=_0x1d43c1['id'];if(_0x3bcb48[_0x2430('0x45')][_0x2430('0x51')]){_0x7a9af4[_0x2430('0x56')]=_[_0x2430('0x52')](_0x7a9af4[_0x2430('0x56')],{'$or':_['map'](_0x7a9af4[_0x2430('0x4a')],function(_0x24a989){var _0x2bf185={};_0x2bf185[_0x24a989]={'$like':'%'+_0x3bcb48[_0x2430('0x45')][_0x2430('0x51')]+'%'};return _0x2bf185;})});}_0x7a9af4=_['merge']({},_0x7a9af4,_0x3bcb48['options']);return db[_0x2430('0x6c')][_0x2430('0x34')]({'where':_0x7a9af4[_0x2430('0x56')]})[_0x2430('0x39')](function(_0x42ed92){_0xe994af['count']=_0x42ed92;if(_0x3bcb48[_0x2430('0x45')][_0x2430('0x58')]){_0x7a9af4[_0x2430('0x5f')]=[{'all':!![]}];}return db[_0x2430('0x6c')][_0x2430('0x59')](_0x7a9af4);})['then'](function(_0x124b27){_0xe994af[_0x2430('0x5a')]=_0x124b27;return _0xe994af;});}})['then'](respondWithFilteredResult(_0x25b0ce,_0x7a9af4))[_0x2430('0x2e')](handleError(_0x25b0ce,null));};exports['removeDispositions']=function(_0x5e4316,_0x59d2ae,_0x44e1a1){return db['FaxAccount'][_0x2430('0x60')]({'where':{'id':_0x5e4316[_0x2430('0x5c')]['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x59d2ae,null))[_0x2430('0x39')](function(_0x5063c9){if(_0x5063c9){return _0x5063c9[_0x2430('0x70')](_0x5e4316[_0x2430('0x45')][_0x2430('0x71')]);}})[_0x2430('0x39')](respondWithStatusCode(_0x59d2ae,null))[_0x2430('0x2e')](handleError(_0x59d2ae,null));};exports['addAnswer']=function(_0x2cb459,_0x67652,_0x5cf0eb){if(_0x2cb459[_0x2430('0x62')]['id']){delete _0x2cb459[_0x2430('0x62')]['id'];}return db['FaxAccount'][_0x2430('0x60')]({'where':{'id':_0x2cb459[_0x2430('0x5c')]['id']}})['then'](handleEntityNotFound(_0x67652,null))[_0x2430('0x39')](function(_0x4a7967){if(_0x4a7967){_0x2cb459['body'][_0x2430('0x6f')]=_0x4a7967['id'];return db[_0x2430('0x72')][_0x2430('0x61')](_0x2cb459[_0x2430('0x62')]);}})['then'](respondWithResult(_0x67652,null))['catch'](handleError(_0x67652,null));};exports[_0x2430('0x73')]=function(_0x454f2b,_0x2dd1d5,_0x3473e8){var _0x5258d6={'raw':![],'where':{}};var _0x14bf1a={};var _0x584aae={'count':0x0,'rows':[]};return db[_0x2430('0x57')]['findOne']({'where':{'id':_0x454f2b[_0x2430('0x5c')]['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x2dd1d5,null))[_0x2430('0x39')](function(_0xf5d45){if(_0xf5d45){_0x14bf1a[_0x2430('0x44')]=_['keys'](db[_0x2430('0x72')][_0x2430('0x5e')]);_0x14bf1a[_0x2430('0x45')]=_['keys'](_0x454f2b[_0x2430('0x45')]);_0x14bf1a[_0x2430('0x47')]=_[_0x2430('0x48')](_0x14bf1a['model'],_0x14bf1a['query']);_0x5258d6[_0x2430('0x4a')]=_[_0x2430('0x48')](_0x14bf1a['model'],qs[_0x2430('0x49')](_0x454f2b[_0x2430('0x45')][_0x2430('0x49')]));_0x5258d6['attributes']=_0x5258d6[_0x2430('0x4a')][_0x2430('0x4b')]?_0x5258d6[_0x2430('0x4a')]:_0x14bf1a[_0x2430('0x44')];if(!_0x454f2b[_0x2430('0x45')][_0x2430('0x4c')](_0x2430('0x4d'))){_0x5258d6[_0x2430('0x32')]=qs[_0x2430('0x32')](_0x454f2b[_0x2430('0x45')][_0x2430('0x32')]);_0x5258d6[_0x2430('0x31')]=qs['offset'](_0x454f2b['query'][_0x2430('0x31')]);}_0x5258d6['order']=qs['sort'](_0x454f2b[_0x2430('0x45')][_0x2430('0x4f')]);_0x5258d6['where']=qs[_0x2430('0x47')](_[_0x2430('0x50')](_0x454f2b[_0x2430('0x45')],_0x14bf1a[_0x2430('0x47')]));_0x5258d6[_0x2430('0x56')]['FaxAccountId']=_0xf5d45['id'];if(_0x454f2b[_0x2430('0x45')]['filter']){_0x5258d6[_0x2430('0x56')]=_[_0x2430('0x52')](_0x5258d6[_0x2430('0x56')],{'$or':_[_0x2430('0x42')](_0x5258d6['attributes'],function(_0x1680d5){var _0x5c0055={};_0x5c0055[_0x1680d5]={'$like':'%'+_0x454f2b['query'][_0x2430('0x51')]+'%'};return _0x5c0055;})});}_0x5258d6=_['merge']({},_0x5258d6,_0x454f2b[_0x2430('0x55')]);return db[_0x2430('0x72')][_0x2430('0x34')]({'where':_0x5258d6[_0x2430('0x56')]})['then'](function(_0x261860){_0x584aae['count']=_0x261860;if(_0x454f2b[_0x2430('0x45')]['includeAll']){_0x5258d6[_0x2430('0x5f')]=[{'all':!![]}];}return db[_0x2430('0x72')]['findAll'](_0x5258d6);})['then'](function(_0x54c063){_0x584aae[_0x2430('0x5a')]=_0x54c063;return _0x584aae;});}})[_0x2430('0x39')](respondWithFilteredResult(_0x2dd1d5,_0x5258d6))[_0x2430('0x2e')](handleError(_0x2dd1d5,null));};exports[_0x2430('0x74')]=function(_0x1d5c8e,_0x59cf93,_0x457ce2){return db[_0x2430('0x57')]['find']({'where':{'id':_0x1d5c8e[_0x2430('0x5c')]['id']}})['then'](handleEntityNotFound(_0x59cf93,null))[_0x2430('0x39')](function(_0x5110d6){if(_0x5110d6){return _0x5110d6[_0x2430('0x74')](_0x1d5c8e[_0x2430('0x45')][_0x2430('0x71')]);}})[_0x2430('0x39')](respondWithStatusCode(_0x59cf93,null))[_0x2430('0x2e')](handleError(_0x59cf93,null));};exports[_0x2430('0x75')]=function(_0x178278,_0x5b22a5,_0x3a8739){return db[_0x2430('0x76')][_0x2430('0x60')]({'where':{'id':_0x178278[_0x2430('0x5c')]['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x5b22a5,null))[_0x2430('0x39')](function(_0x515c3b){if(_0x515c3b){return _0x515c3b[_0x2430('0x75')](_0x178278[_0x2430('0x62')][_0x2430('0x71')],_[_0x2430('0x77')](_0x178278[_0x2430('0x62')],[_0x2430('0x71'),'id'])||{});}})['then'](respondWithResult(_0x5b22a5,null))['catch'](handleError(_0x5b22a5,null));};exports[_0x2430('0x78')]=function(_0x4a2fcd,_0x2e3aba,_0x128879){var _0x3b748b={'raw':![],'where':{}};var _0x85e3e7={};var _0x38f307={'count':0x0,'rows':[]};return db[_0x2430('0x57')][_0x2430('0x6e')]({'where':{'id':_0x4a2fcd['params']['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x2e3aba,null))[_0x2430('0x39')](function(_0x374e20){if(_0x374e20){_0x85e3e7['model']=_[_0x2430('0x46')](db[_0x2430('0x76')][_0x2430('0x5e')]);_0x85e3e7[_0x2430('0x45')]=_[_0x2430('0x46')](_0x4a2fcd[_0x2430('0x45')]);_0x85e3e7[_0x2430('0x47')]=_[_0x2430('0x48')](_0x85e3e7[_0x2430('0x44')],_0x85e3e7['query']);_0x3b748b['attributes']=_[_0x2430('0x48')](_0x85e3e7[_0x2430('0x44')],qs[_0x2430('0x49')](_0x4a2fcd[_0x2430('0x45')][_0x2430('0x49')]));_0x3b748b[_0x2430('0x4a')]=_0x3b748b[_0x2430('0x4a')][_0x2430('0x4b')]?_0x3b748b[_0x2430('0x4a')]:_0x85e3e7[_0x2430('0x44')];if(!_0x4a2fcd[_0x2430('0x45')][_0x2430('0x4c')]('nolimit')){_0x3b748b['limit']=qs[_0x2430('0x32')](_0x4a2fcd[_0x2430('0x45')][_0x2430('0x32')]);_0x3b748b[_0x2430('0x31')]=qs[_0x2430('0x31')](_0x4a2fcd[_0x2430('0x45')][_0x2430('0x31')]);}_0x3b748b[_0x2430('0x4e')]=qs[_0x2430('0x4f')](_0x4a2fcd[_0x2430('0x45')][_0x2430('0x4f')]);_0x3b748b[_0x2430('0x56')]=qs[_0x2430('0x47')](_['pick'](_0x4a2fcd[_0x2430('0x45')],_0x85e3e7[_0x2430('0x47')]));_0x3b748b[_0x2430('0x56')][_0x2430('0x6f')]=_0x374e20['id'];if(_0x4a2fcd['query'][_0x2430('0x51')]){_0x3b748b[_0x2430('0x56')]=_[_0x2430('0x52')](_0x3b748b[_0x2430('0x56')],{'$or':_[_0x2430('0x42')](_0x3b748b['attributes'],function(_0x4d9fc7){var _0x27c99b={};_0x27c99b[_0x4d9fc7]={'$like':'%'+_0x4a2fcd[_0x2430('0x45')][_0x2430('0x51')]+'%'};return _0x27c99b;})});}_0x3b748b=_['merge']({},_0x3b748b,_0x4a2fcd[_0x2430('0x55')]);return db[_0x2430('0x76')]['count']({'where':_0x3b748b[_0x2430('0x56')]})[_0x2430('0x39')](function(_0x4f7a15){_0x38f307[_0x2430('0x34')]=_0x4f7a15;if(_0x4a2fcd[_0x2430('0x45')][_0x2430('0x58')]){_0x3b748b[_0x2430('0x5f')]=[{'model':db[_0x2430('0x79')],'as':_0x2430('0x7a'),'required':![]},{'model':db['User'],'as':_0x2430('0x7b'),'attributes':[_0x2430('0x3f'),'fullname',_0x2430('0x7c')],'required':![]},{'model':db[_0x2430('0x7d')],'as':_0x2430('0x7e'),'attributes':['id','name','color'],'where':_0x4a2fcd[_0x2430('0x45')][_0x2430('0x7f')]?{'id':_0x4a2fcd['query'][_0x2430('0x7f')]}:undefined,'required':_0x4a2fcd[_0x2430('0x45')]['tag']?!![]:![]}];}return db[_0x2430('0x76')][_0x2430('0x59')](_0x3b748b);})[_0x2430('0x39')](function(_0x4d2a3a){_0x38f307['rows']=_0x4d2a3a;return _0x38f307;});}})[_0x2430('0x39')](respondWithFilteredResult(_0x2e3aba,_0x3b748b))[_0x2430('0x2e')](handleError(_0x2e3aba,null));};exports[_0x2430('0x80')]=function(_0x1d6e29,_0x2e4853){var _0x17be37=_0x1d6e29[_0x2430('0x5c')]['id'];var _0x8df89a=_0x1d6e29['body'];var _0x14ae6d=0xc8;var _0x524633=null;return db[_0x2430('0x81')][_0x2430('0x82')]({'isolationLevel':db[_0x2430('0x81')][_0x2430('0x83')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x401ac8){return db[_0x2430('0x57')][_0x2430('0x6e')]({'where':{'id':_0x17be37},'transaction':_0x401ac8})[_0x2430('0x39')](function(_0x36a6aa){if(_0x36a6aa){return db[_0x2430('0x84')][_0x2430('0x69')]({'where':{'FaxAccountId':_0x17be37},'transaction':_0x401ac8})[_0x2430('0x39')](function(){var _0x3efdb9=_[_0x2430('0x42')](_0x8df89a,function(_0x37d352){_0x37d352[_0x2430('0x6f')]=_0x17be37;return _0x37d352;});return db[_0x2430('0x84')]['bulkCreate'](_0x3efdb9,{'transaction':_0x401ac8});});}else{_0x14ae6d=0x194;_0x524633=[];}});})[_0x2430('0x39')](function(){if(_0x14ae6d!==0x194){return db[_0x2430('0x84')][_0x2430('0x85')]({'where':{'FaxAccountId':_0x17be37},'order':_0x2430('0x86')})['then'](function(_0x5207d7){_0x524633=_0x5207d7;});}})[_0x2430('0x2e')](function(_0x323eb7){_0x14ae6d=0x1f4;logger[_0x2430('0x29')](_0x323eb7[_0x2430('0x3e')]);if(_0x323eb7[_0x2430('0x3f')]){delete _0x323eb7[_0x2430('0x3f')];}_0x524633=_0x323eb7;})[_0x2430('0x87')](function(){if(_0x524633===null){_0x2e4853['sendStatus'](_0x14ae6d);}else{if(_0x14ae6d===0x1f4){_0x2e4853[_0x2430('0x2f')](_0x14ae6d)[_0x2430('0x88')](_0x524633);}else{_0x2e4853[_0x2430('0x2f')](_0x14ae6d)[_0x2430('0x30')](_0x524633);}}});};exports[_0x2430('0x89')]=function(_0x4192ff,_0x5ea8f0,_0x32b57f){var _0x3eddbc={};var _0x2f4107={};var _0x1f04a0;var _0x53c82d;return db['FaxAccount'][_0x2430('0x6e')]({'where':{'id':_0x4192ff['params']['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x5ea8f0,null))[_0x2430('0x39')](function(_0x2dc7f9){if(_0x2dc7f9){_0x1f04a0=_0x2dc7f9;_0x2f4107['model']=_['keys'](db[_0x2430('0x84')][_0x2430('0x5e')]);_0x2f4107[_0x2430('0x45')]=_[_0x2430('0x46')](_0x4192ff['query']);_0x2f4107[_0x2430('0x47')]=_['intersection'](_0x2f4107[_0x2430('0x44')],_0x2f4107[_0x2430('0x45')]);_0x3eddbc['attributes']=_[_0x2430('0x48')](_0x2f4107[_0x2430('0x44')],qs[_0x2430('0x49')](_0x4192ff[_0x2430('0x45')][_0x2430('0x49')]));_0x3eddbc['attributes']=_0x3eddbc[_0x2430('0x4a')][_0x2430('0x4b')]?_0x3eddbc[_0x2430('0x4a')]:_0x2f4107[_0x2430('0x44')];_0x3eddbc[_0x2430('0x4e')]=qs[_0x2430('0x4f')](_0x4192ff[_0x2430('0x45')]['sort']);_0x3eddbc[_0x2430('0x56')]=qs[_0x2430('0x47')](_[_0x2430('0x50')](_0x4192ff[_0x2430('0x45')],_0x2f4107[_0x2430('0x47')]));if(_0x4192ff[_0x2430('0x45')][_0x2430('0x51')]){_0x3eddbc[_0x2430('0x56')]=_['merge'](_0x3eddbc['where'],{'$or':_['map'](_0x3eddbc[_0x2430('0x4a')],function(_0x4e4931){var _0x538d54={};_0x538d54[_0x4e4931]={'$like':'%'+_0x4192ff['query'][_0x2430('0x51')]+'%'};return _0x538d54;})});}_0x3eddbc=_[_0x2430('0x52')]({},_0x3eddbc,_0x4192ff[_0x2430('0x55')]);return _0x1f04a0[_0x2430('0x89')](_0x3eddbc);}})['then'](function(_0x28bf50){if(_0x28bf50){_0x53c82d=_0x28bf50[_0x2430('0x4b')];if(!_0x4192ff[_0x2430('0x45')][_0x2430('0x4c')](_0x2430('0x4d'))){_0x3eddbc[_0x2430('0x32')]=qs[_0x2430('0x32')](_0x4192ff[_0x2430('0x45')]['limit']);_0x3eddbc[_0x2430('0x31')]=qs['offset'](_0x4192ff['query'][_0x2430('0x31')]);}return _0x1f04a0[_0x2430('0x89')](_0x3eddbc);}})[_0x2430('0x39')](function(_0x5eb5bd){if(_0x5eb5bd){return _0x5eb5bd?{'count':_0x53c82d,'rows':_0x5eb5bd}:null;}})['then'](respondWithResult(_0x5ea8f0,null))[_0x2430('0x2e')](handleError(_0x5ea8f0,null));};function Extension(_0x5d153a,_0x5cb700,_0x36f371,_0x1e6d3b){this[_0x2430('0x8a')]='from-voip-provider';this['exten']=_0x5d153a[_0x2430('0x8b')];this[_0x2430('0x8c')]=_0x1e6d3b;this[_0x2430('0x53')]=_0x2430('0x8d');this[_0x2430('0x8e')]='Fax\x20Extension';this[_0x2430('0x6f')]=_0x5d153a['id'];this[_0x2430('0x86')]=_0x5cb700;this[_0x2430('0x8f')]=_0x36f371;}function createExtensionsReciveFax(_0x45252d){var _0x5c0631=0x1;var _0x67eddd=[];_0x67eddd[_0x2430('0x90')](new Extension(_0x45252d,_0x5c0631,'',_0x2430('0x91')));_0x5c0631+=0x1;_0x67eddd[_0x2430('0x90')](new Extension(_0x45252d,_0x5c0631,_0x2430('0x92'),_0x2430('0x93')));_0x5c0631+=0x1;for(var _0x4512fd in _0x45252d){if(_0x45252d[_0x2430('0x4c')](_0x4512fd)&&(_0x4512fd===_0x2430('0x94')||_0x4512fd===_0x2430('0x8b')||_0x4512fd===_0x2430('0x95')||_0x4512fd===_0x2430('0x96')||_0x4512fd===_0x2430('0x97')||_0x4512fd===_0x2430('0x98')||_0x4512fd===_0x2430('0x99')||_0x4512fd===_0x2430('0x9a')||_0x4512fd==='t38timeout')){_0x67eddd[_0x2430('0x90')](new Extension(_0x45252d,_0x5c0631,_0x2430('0x9b')+_0x4512fd+')='+_0x45252d[_0x4512fd],'Set'));_0x5c0631+=0x1;}}_0x67eddd['push'](new Extension(_0x45252d,_0x5c0631,'6',_0x2430('0x9c')));_0x5c0631+=0x1;_0x67eddd[_0x2430('0x90')](new Extension(_0x45252d,_0x5c0631,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x5c0631=0x0;return _0x67eddd;}exports[_0x2430('0x9d')]=function(_0x52ee5a,_0x330c94,_0x5d9c20){var _0x3dbd1b;return db[_0x2430('0x81')][_0x2430('0x82')](function(_0x39b302){return db[_0x2430('0x57')]['create'](_0x52ee5a[_0x2430('0x62')],{'transaction':_0x39b302})[_0x2430('0x39')](function(_0x5a10c0){_0x3dbd1b=_0x5a10c0[_0x2430('0x3a')]({'plain':!![]});return db[_0x2430('0x9e')][_0x2430('0x9f')](createExtensionsReciveFax(_0x3dbd1b),{'transaction':_0x39b302});});})[_0x2430('0x39')](function(){return _0x3dbd1b;})[_0x2430('0x39')](respondWithResult(_0x330c94,null))[_0x2430('0x2e')](handleError(_0x330c94,null));};exports['updateAccountApplications']=function(_0x36581e,_0x544a6c,_0x2f71f2){var _0x540ecf;return db[_0x2430('0x81')]['transaction'](function(_0x551f3d){return db['FaxAccount'][_0x2430('0x38')](_0x36581e['body'],{'where':{'id':_0x36581e[_0x2430('0x62')]['id']},'transaction':_0x551f3d})['then'](function(_0x4c48ed){return db[_0x2430('0x9e')]['destroy']({'where':{'FaxAccountId':_0x36581e[_0x2430('0x62')]['id']},'transaction':_0x551f3d})['then'](function(_0x398b62){return db[_0x2430('0x9e')][_0x2430('0x9f')](createExtensionsReciveFax(_['omit'](_0x36581e[_0x2430('0x62')],['tech',_0x2430('0x43'),_0x2430('0xa0'),'updatedAt',_0x2430('0xa1'),'ListId'])),{'transaction':_0x551f3d});});});})[_0x2430('0x39')](function(){return db[_0x2430('0x57')][_0x2430('0xa2')](_0x36581e[_0x2430('0x62')]['id']);})['then'](respondWithResult(_0x544a6c,null))[_0x2430('0x2e')](handleError(_0x544a6c,null));};exports[_0x2430('0xa3')]=function(_0x4e7cec,_0x145477,_0x223136){var _0x1ab946={'raw':!![],'where':{}};var _0x31010b={};var _0x3d8610={'count':0x0,'rows':[]};return db[_0x2430('0x57')]['findOne']({'where':{'id':_0x4e7cec[_0x2430('0x5c')]['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x145477,null))[_0x2430('0x39')](function(_0x26ba6e){if(_0x26ba6e){_0x31010b['model']=_[_0x2430('0x46')](db[_0x2430('0xa4')][_0x2430('0x5e')]);_0x31010b[_0x2430('0x45')]=_['keys'](_0x4e7cec[_0x2430('0x45')]);_0x31010b['filters']=_[_0x2430('0x48')](_0x31010b[_0x2430('0x44')],_0x31010b[_0x2430('0x45')]);_0x1ab946[_0x2430('0x4a')]=_['intersection'](_0x31010b[_0x2430('0x44')],qs['fields'](_0x4e7cec[_0x2430('0x45')][_0x2430('0x49')]));_0x1ab946['attributes']=_0x1ab946[_0x2430('0x4a')]['length']?_0x1ab946[_0x2430('0x4a')]:_0x31010b[_0x2430('0x44')];if(!_0x4e7cec['query']['hasOwnProperty']('nolimit')){_0x1ab946[_0x2430('0x32')]=qs['limit'](_0x4e7cec[_0x2430('0x45')]['limit']);_0x1ab946['offset']=qs[_0x2430('0x31')](_0x4e7cec[_0x2430('0x45')]['offset']);}_0x1ab946[_0x2430('0x4e')]=qs[_0x2430('0x4f')](_0x4e7cec[_0x2430('0x45')]['sort']);_0x1ab946[_0x2430('0x56')]=qs[_0x2430('0x47')](_['pick'](_0x4e7cec[_0x2430('0x45')],_0x31010b[_0x2430('0x47')]));_0x1ab946[_0x2430('0x56')][_0x2430('0x6f')]=_0x26ba6e['id'];if(_0x4e7cec['query'][_0x2430('0x51')]){_0x1ab946[_0x2430('0x56')]=_[_0x2430('0x52')](_0x1ab946['where'],{'$or':_[_0x2430('0x42')](_0x1ab946[_0x2430('0x4a')],function(_0x239a1c){var _0x2f34bc={};_0x2f34bc[_0x239a1c]={'$like':'%'+_0x4e7cec[_0x2430('0x45')][_0x2430('0x51')]+'%'};return _0x2f34bc;})});}if(_0x4e7cec[_0x2430('0x45')]['$gte']){var _0x5cabd3=_0x4e7cec[_0x2430('0x45')][_0x2430('0xa5')][_0x2430('0xa6')](',');var _0x54218c={};_0x54218c[_0x5cabd3[0x0]]={'$gte':moment(_0x5cabd3[0x1])[_0x2430('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ab946[_0x2430('0x56')]=_[_0x2430('0x52')](_0x1ab946['where'],_0x54218c);}_0x1ab946=_[_0x2430('0x52')]({},_0x1ab946,_0x4e7cec['options']);return db[_0x2430('0xa4')]['count']({'where':_0x1ab946[_0x2430('0x56')]})[_0x2430('0x39')](function(_0x57eaf8){_0x3d8610[_0x2430('0x34')]=_0x57eaf8;if(_0x4e7cec[_0x2430('0x45')]['includeAll']){_0x1ab946[_0x2430('0x5f')]=[{'all':!![]}];}return db[_0x2430('0xa4')][_0x2430('0x59')](_0x1ab946);})[_0x2430('0x39')](function(_0x22305d){_0x3d8610[_0x2430('0x5a')]=_0x22305d;return _0x3d8610;});}})[_0x2430('0x39')](respondWithFilteredResult(_0x145477,_0x1ab946))[_0x2430('0x2e')](handleError(_0x145477,null));};exports[_0x2430('0x88')]=function(_0x75a28b,_0x65690,_0x262f15){var _0x20a40f,_0x93cde8={},_0x4573c3;if(_0x75a28b[_0x2430('0x62')]['to']){_0x4573c3=_0x75a28b[_0x2430('0x62')]['to'][0x0];}return db[_0x2430('0x57')][_0x2430('0x60')]({'where':{'id':_0x75a28b['params']['id']},'include':[{'model':db[_0x2430('0xa8')],'as':_0x2430('0xa9'),'include':[{'model':db[_0x2430('0x79')],'as':_0x2430('0xaa'),'where':{'fax':_0x4573c3},'limit':0x1,'order':[[_0x2430('0xab'),_0x2430('0xac')]]}]}]})[_0x2430('0x39')](handleEntityNotFound(_0x65690,null))[_0x2430('0x39')](function(_0x38bdc4){_0x20a40f=_0x38bdc4;if(_0x75a28b['body'][_0x2430('0xad')]&&_0x75a28b['body'][_0x2430('0xad')][_0x2430('0x4b')]){for(var _0x3a3dca=0x0;_0x3a3dca<_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][_0x2430('0x4b')];_0x3a3dca+=0x1){_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][_0x3a3dca]={'filename':_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][_0x3a3dca][_0x2430('0x3f')],'id':_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][_0x3a3dca]['id'],'path':path[_0x2430('0xae')](config[_0x2430('0xaf')],_0x2430('0xb0'),_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][_0x3a3dca]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x2430('0xb1'),{'FaxAccountId':_[_0x2430('0xb2')](_0x75a28b[_0x2430('0x5c')]['id'])?undefined:_0x75a28b[_0x2430('0x5c')]['id'],'path':_[_0x2430('0xb2')](_0x75a28b['body'][_0x2430('0xad')][0x0][_0x2430('0x8')])?undefined:_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][0x0][_0x2430('0x8')],'fax':_[_0x2430('0xb2')](_0x75a28b[_0x2430('0x62')]['to'][0x0])?undefined:_0x75a28b['body']['to'][0x0]},client9002);})[_0x2430('0x39')](function(){if(_0x20a40f){if(_[_0x2430('0xb2')](_0x75a28b[_0x2430('0x62')][_0x2430('0xb3')])){_0x75a28b[_0x2430('0x62')][_0x2430('0xb3')]=util[_0x2430('0xa7')]('\x22%s\x22\x20<%s>',_0x20a40f['name'],_0x20a40f[_0x2430('0xb4')]);}if(_0x20a40f[_0x2430('0xa9')]){if(_0x20a40f[_0x2430('0xa9')][_0x2430('0xaa')][_0x2430('0x4b')]){return _0x20a40f['List'][_0x2430('0xaa')][0x0];}else{return db[_0x2430('0x79')]['create'](_[_0x2430('0x1c')](_0x75a28b[_0x2430('0x62')],{'firstName':_0x75a28b[_0x2430('0x62')]['to'][0x0],'phone':_0x75a28b['body']['to'][0x0],'fax':_0x75a28b[_0x2430('0x62')]['to'][0x0],'ListId':_0x20a40f[_0x2430('0xb5')]}));}}else{throw new Error(_0x2430('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x49d204){if(_0x49d204){return db['FaxInteraction'][_0x2430('0x60')]({'where':{'ContactId':_0x49d204['id'],'closed':![],'FaxAccountId':_0x20a40f['id']}})[_0x2430('0x39')](function(_0x14b555){if(_0x14b555){return[_0x14b555,![]];}return db[_0x2430('0x76')][_0x2430('0x61')]({'UserId':_0x75a28b[_0x2430('0x64')]['id'],'ContactId':_0x49d204['id'],'FaxAccountId':_0x20a40f['id'],'fax':_0x75a28b[_0x2430('0x62')]['to'][0x0],'firstMsgDirection':_0x2430('0xb7'),'Messages':[_[_0x2430('0x52')](_0x75a28b[_0x2430('0x62')],{'read':![],'body':_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][0x0][_0x2430('0xb8')],'FaxAccountId':_0x20a40f['id'],'UserId':_0x75a28b[_0x2430('0x64')]['id'],'ContactId':_0x49d204['id'],'AttachmentId':_0x75a28b['body'][_0x2430('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x2430('0xa4')],'as':_0x2430('0xb9')}]})[_0x2430('0x39')](function(_0x2e6a14){return[_0x2e6a14,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2430('0xba')](function(_0x11e59e,_0x17f904){if(_0x17f904){return _0x11e59e;}return db['FaxMessage'][_0x2430('0x61')]({'direction':'out','read':![],'body':_0x75a28b[_0x2430('0x62')]['attachments'][0x0][_0x2430('0xb8')],'FaxAccountId':_0x20a40f['id'],'FaxInteractionId':_0x11e59e['id'],'UserId':_0x75a28b[_0x2430('0x64')]['id'],'ContactId':_0x11e59e[_0x2430('0xbb')],'AttachmentId':_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][0x0]['id']})[_0x2430('0x39')](function(_0xe84874){_0x11e59e[_0x2430('0xbc')][_0x2430('0xb9')]=[];_0x11e59e['dataValues'][_0x2430('0xb9')]['push'](_0xe84874[_0x2430('0xbc')]);return _0x11e59e;});})[_0x2430('0x39')](function(_0x44dca4){respondWithRpcPromise('SendFax',_0x2430('0xbd'),{'FaxAccountId':_[_0x2430('0xb2')](_0x75a28b[_0x2430('0x5c')]['id'])?undefined:_0x75a28b['params']['id'],'path':_[_0x2430('0xb2')](_0x75a28b['body']['attachments'][0x0][_0x2430('0x8')])?undefined:_0x75a28b[_0x2430('0x62')][_0x2430('0xad')][0x0][_0x2430('0x8')],'fax':_[_0x2430('0xb2')](_0x75a28b[_0x2430('0x62')]['to'][0x0])?undefined:_0x75a28b[_0x2430('0x62')]['to'][0x0],'AttachmentId':_0x75a28b[_0x2430('0x62')]['attachments'][0x0]['id']},client9002)['then'](function(_0x2a879f){logger[_0x2430('0x24')](_0x2430('0xbe'),_0x2a879f);})[_0x2430('0x2e')](function(_0x5c0c74){logger[_0x2430('0x24')](_0x2430('0xbe'),_0x5c0c74);});return _0x44dca4;})[_0x2430('0x39')](respondWithResult(_0x65690,null))['catch'](handleError(_0x65690,null));};exports['addAgents']=function(_0xbde8e9,_0x509057,_0x5023ca){return db[_0x2430('0x57')][_0x2430('0x60')]({'where':{'id':_0xbde8e9['params']['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x509057,null))[_0x2430('0x39')](function(_0x15773f){if(_0x15773f){return _0x15773f[_0x2430('0xbf')](_0xbde8e9[_0x2430('0x62')]['ids'],_[_0x2430('0x77')](_0xbde8e9[_0x2430('0x62')],['ids','id'])||{})[_0x2430('0xba')](function(_0x982a6a){for(var _0x265426=0x0;_0x265426<_0xbde8e9[_0x2430('0x62')]['ids'][_0x2430('0x4b')];_0x265426+=0x1){socket[_0x2430('0xc0')]('userFaxAccount:save',{'UserId':Number(_0xbde8e9[_0x2430('0x62')][_0x2430('0x71')][_0x265426]),'FaxAccountId':Number(_0xbde8e9[_0x2430('0x5c')]['id'])});}return _0x982a6a;});}})[_0x2430('0x39')](respondWithResult(_0x509057,null))[_0x2430('0x2e')](handleError(_0x509057,null));};exports[_0x2430('0xc1')]=function(_0x313463,_0x45173d,_0x1bb24d){return db[_0x2430('0x57')][_0x2430('0x60')]({'where':{'id':_0x313463[_0x2430('0x5c')]['id']}})[_0x2430('0x39')](handleEntityNotFound(_0x45173d,null))[_0x2430('0x39')](function(_0x50d385){if(_0x50d385){return _0x50d385[_0x2430('0xc1')](_0x313463[_0x2430('0x45')][_0x2430('0x71')])['then'](function(){if(_[_0x2430('0xc2')](_0x313463[_0x2430('0x45')][_0x2430('0x71')])){for(var _0xb53e6c=0x0;_0xb53e6c<_0x313463[_0x2430('0x45')][_0x2430('0x71')][_0x2430('0x4b')];_0xb53e6c+=0x1){socket[_0x2430('0xc0')](_0x2430('0xc3'),{'UserId':Number(_0x313463['query']['ids'][_0xb53e6c]),'FaxAccountId':Number(_0x313463['params']['id'])});}}else{socket[_0x2430('0xc0')](_0x2430('0xc3'),{'UserId':Number(_0x313463[_0x2430('0x45')][_0x2430('0x71')]),'FaxAccountId':Number(_0x313463['params']['id'])});}});}})[_0x2430('0x39')](respondWithStatusCode(_0x45173d,null))['catch'](handleError(_0x45173d,null));};exports[_0x2430('0xc4')]=function(_0x36c551,_0x35f3a2,_0x4f5653){var _0x29786e={};var _0x253707={};var _0x16e764;var _0xbdd5e6;return db[_0x2430('0x57')][_0x2430('0x6e')]({'where':{'id':_0x36c551[_0x2430('0x5c')]['id']}})['then'](handleEntityNotFound(_0x35f3a2,null))[_0x2430('0x39')](function(_0x323208){if(_0x323208){_0x16e764=_0x323208;_0x253707[_0x2430('0x44')]=_[_0x2430('0x46')](db[_0x2430('0xc5')][_0x2430('0x5e')]);_0x253707[_0x2430('0x45')]=_[_0x2430('0x46')](_0x36c551['query']);_0x253707[_0x2430('0x47')]=_[_0x2430('0x48')](_0x253707[_0x2430('0x44')],_0x253707['query']);_0x29786e[_0x2430('0x4a')]=_[_0x2430('0x48')](_0x253707[_0x2430('0x44')],qs[_0x2430('0x49')](_0x36c551['query'][_0x2430('0x49')]));_0x29786e[_0x2430('0x4a')]=_0x29786e[_0x2430('0x4a')]['length']?_0x29786e['attributes']:_0x253707[_0x2430('0x44')];_0x29786e[_0x2430('0x4e')]=qs[_0x2430('0x4f')](_0x36c551['query'][_0x2430('0x4f')]);_0x29786e['where']=qs[_0x2430('0x47')](_[_0x2430('0x50')](_0x36c551[_0x2430('0x45')],_0x253707[_0x2430('0x47')]));if(_0x36c551[_0x2430('0x45')][_0x2430('0x51')]){_0x29786e[_0x2430('0x56')]=_[_0x2430('0x52')](_0x29786e[_0x2430('0x56')],{'$or':_['map'](_0x29786e[_0x2430('0x4a')],function(_0x4b1815){var _0x345352={};_0x345352[_0x4b1815]={'$like':'%'+_0x36c551[_0x2430('0x45')][_0x2430('0x51')]+'%'};return _0x345352;})});}_0x29786e=_['merge']({},_0x29786e,_0x36c551[_0x2430('0x55')]);return _0x16e764[_0x2430('0xc4')](_0x29786e);}})[_0x2430('0x39')](function(_0x366844){if(_0x366844){_0xbdd5e6=_0x366844[_0x2430('0x4b')];if(!_0x36c551['query']['hasOwnProperty'](_0x2430('0x4d'))){_0x29786e[_0x2430('0x32')]=qs[_0x2430('0x32')](_0x36c551[_0x2430('0x45')]['limit']);_0x29786e[_0x2430('0x31')]=qs[_0x2430('0x31')](_0x36c551[_0x2430('0x45')][_0x2430('0x31')]);}return _0x16e764[_0x2430('0xc4')](_0x29786e);}})[_0x2430('0x39')](function(_0x3db691){if(_0x3db691){return _0x3db691?{'count':_0xbdd5e6,'rows':_0x3db691}:null;}})[_0x2430('0x39')](respondWithResult(_0x35f3a2,null))[_0x2430('0x2e')](handleError(_0x35f3a2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c02b4f6..da11204 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 _0xf926=['FaxAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf926,0xd0));var _0x6f92=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf926[_0x55f8b4];return _0x2475f9;};'use strict';var EventEmitter=require(_0x6f92('0x0'));var FaxAccount=require(_0x6f92('0x1'))['db'][_0x6f92('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f92('0x3'),'afterUpdate':_0x6f92('0x4'),'afterDestroy':_0x6f92('0x5')};function emitEvent(_0x5baa25){return function(_0x3408e9,_0x1dcab6,_0x1aac5a){FaxAccountEvents[_0x6f92('0x6')](_0x5baa25+':'+_0x3408e9['id'],_0x3408e9);FaxAccountEvents['emit'](_0x5baa25,_0x3408e9);_0x1aac5a(null);};}for(var e in events){if(events[_0x6f92('0x7')](e)){var event=events[e];FaxAccount[_0x6f92('0x8')](e,emitEvent(event));}}module[_0x6f92('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xae7c=['FaxAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x54dcc2,_0x2a265c){var _0x3cc135=function(_0x546a1f){while(--_0x546a1f){_0x54dcc2['push'](_0x54dcc2['shift']());}};_0x3cc135(++_0x2a265c);}(_0xae7c,0x167));var _0xcae7=function(_0x11d25c,_0x5a0fe5){_0x11d25c=_0x11d25c-0x0;var _0x2143e0=_0xae7c[_0x11d25c];return _0x2143e0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xcae7('0x0'))['db'][_0xcae7('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcae7('0x2')](0x0);var events={'afterCreate':_0xcae7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2eff60){return function(_0x3c0478,_0x272111,_0x345a57){FaxAccountEvents[_0xcae7('0x4')](_0x2eff60+':'+_0x3c0478['id'],_0x3c0478);FaxAccountEvents[_0xcae7('0x4')](_0x2eff60,_0x3c0478);_0x345a57(null);};}for(var e in events){if(events[_0xcae7('0x5')](e)){var event=events[e];FaxAccount[_0xcae7('0x6')](e,emitEvent(event));}}module[_0xcae7('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e2a5592..c5400b8 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 _0x5061=['./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x5061,0xe6));var _0x1506=function(_0x4c9f76,_0x5e0403){_0x4c9f76=_0x4c9f76-0x0;var _0x551afe=_0x5061[_0x4c9f76];return _0x551afe;};'use strict';var _=require(_0x1506('0x0'));var util=require(_0x1506('0x1'));var logger=require(_0x1506('0x2'))(_0x1506('0x3'));var moment=require(_0x1506('0x4'));var BPromise=require(_0x1506('0x5'));var rp=require(_0x1506('0x6'));var fs=require('fs');var path=require(_0x1506('0x7'));var rimraf=require(_0x1506('0x8'));var config=require(_0x1506('0x9'));var attributes=require(_0x1506('0xa'));module[_0x1506('0xb')]=function(_0x176828,_0xc75d14){return _0x176828[_0x1506('0xc')](_0x1506('0xd'),attributes,{'tableName':_0x1506('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2e=['../../config/logger','api','moment','bluebird','request-promise','path','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3f2e,0x11d));var _0xe3f2=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x3f2e[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var logger=require(_0xe3f2('0x1'))(_0xe3f2('0x2'));var moment=require(_0xe3f2('0x3'));var BPromise=require(_0xe3f2('0x4'));var rp=require(_0xe3f2('0x5'));var fs=require('fs');var path=require(_0xe3f2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3f2('0x7'));module[_0xe3f2('0x8')]=function(_0x11c7c0,_0x2a501d){return _0x11c7c0['define'](_0xe3f2('0x9'),attributes,{'tableName':_0xe3f2('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 bbd92a7..169499f 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 _0xdf58=['model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','Applications','get','list','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','interaction','ContactId','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4b3d03,_0x298eb8){var _0x29038d=function(_0x148704){while(--_0x148704){_0x4b3d03['push'](_0x4b3d03['shift']());}};_0x29038d(++_0x298eb8);}(_0xdf58,0x151));var _0x8df5=function(_0x21bb11,_0x25c8c8){_0x21bb11=_0x21bb11-0x0;var _0x797526=_0xdf58[_0x21bb11];return _0x797526;};'use strict';var _=require('lodash');var util=require(_0x8df5('0x0'));var moment=require(_0x8df5('0x1'));var BPromise=require(_0x8df5('0x2'));var rs=require(_0x8df5('0x3'));var fs=require('fs');var Redis=require(_0x8df5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8df5('0x5'));var config=require(_0x8df5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8df5('0x7')][_0x8df5('0x8')]({'port':0x232c});config[_0x8df5('0x9')]=_[_0x8df5('0xa')](config[_0x8df5('0x9')],{'host':_0x8df5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df5('0x9')]));require(_0x8df5('0xc'))['register'](socket);function respondWithRpcPromise(_0x3503b6,_0x44e1d9,_0x4ab214){return new BPromise(function(_0x389b58,_0x5a25ca){return client['request'](_0x3503b6,_0x4ab214)[_0x8df5('0xd')](function(_0x441847){logger[_0x8df5('0xe')](_0x8df5('0xf'),_0x44e1d9,'request\x20sent');logger[_0x8df5('0x10')](_0x8df5('0x11'),_0x44e1d9,_0x8df5('0x12'),JSON[_0x8df5('0x13')](_0x441847));if(_0x441847[_0x8df5('0x14')]){if(_0x441847[_0x8df5('0x14')][_0x8df5('0x15')]===0x1f4){logger[_0x8df5('0x14')](_0x8df5('0xf'),_0x44e1d9,_0x441847['error'][_0x8df5('0x16')]);return _0x5a25ca(_0x441847['error'][_0x8df5('0x16')]);}logger[_0x8df5('0x14')]('FaxAccount,\x20%s,\x20%s',_0x44e1d9,_0x441847[_0x8df5('0x14')][_0x8df5('0x16')]);return _0x389b58(_0x441847[_0x8df5('0x14')]['message']);}else{logger[_0x8df5('0xe')](_0x8df5('0xf'),_0x44e1d9,_0x8df5('0x12'));_0x389b58(_0x441847[_0x8df5('0x17')][_0x8df5('0x16')]);}})[_0x8df5('0x18')](function(_0x571e5a){logger[_0x8df5('0x14')](_0x8df5('0xf'),_0x44e1d9,_0x571e5a);_0x5a25ca(_0x571e5a);});});}exports[_0x8df5('0x19')]=function(_0x468fd4){var _0x347d0a=this;return new Promise(function(_0x21728c,_0x5a0374){return db[_0x8df5('0x1a')][_0x8df5('0x1b')]({'raw':_0x468fd4[_0x8df5('0x1c')]?_0x468fd4[_0x8df5('0x1c')][_0x8df5('0x1d')]===undefined?!![]:![]:!![],'where':_0x468fd4[_0x8df5('0x1c')]?_0x468fd4[_0x8df5('0x1c')][_0x8df5('0x1e')]||null:null,'attributes':_0x468fd4[_0x8df5('0x1c')]?_0x468fd4[_0x8df5('0x1c')][_0x8df5('0x1f')]||null:null,'limit':_0x468fd4['options']?_0x468fd4[_0x8df5('0x1c')][_0x8df5('0x20')]||null:null,'include':_0x468fd4[_0x8df5('0x1c')]?_0x468fd4[_0x8df5('0x1c')][_0x8df5('0x21')]?_[_0x8df5('0x22')](_0x468fd4[_0x8df5('0x1c')][_0x8df5('0x21')],function(_0xefd3d6){return{'model':db[_0xefd3d6[_0x8df5('0x23')]],'as':_0xefd3d6['as'],'attributes':_0xefd3d6[_0x8df5('0x1f')],'include':_0xefd3d6[_0x8df5('0x21')]?_[_0x8df5('0x22')](_0xefd3d6['include'],function(_0x1369fd){return{'model':db[_0x1369fd['model']],'as':_0x1369fd['as'],'attributes':_0x1369fd['attributes'],'include':_0x1369fd[_0x8df5('0x21')]?_[_0x8df5('0x22')](_0x1369fd[_0x8df5('0x21')],function(_0x27e1cb){return{'model':db[_0x27e1cb[_0x8df5('0x23')]],'as':_0x27e1cb['as'],'attributes':_0x27e1cb['attributes']};}):[]};}):[]};}):[]:[]})[_0x8df5('0xd')](function(_0x2e312c){logger[_0x8df5('0xe')](_0x8df5('0x19'),_0x468fd4);logger[_0x8df5('0x10')](_0x8df5('0x19'),_0x468fd4,JSON[_0x8df5('0x13')](_0x2e312c));_0x21728c(_0x2e312c);})['catch'](function(_0x26c6d6){logger[_0x8df5('0x14')](_0x8df5('0x19'),_0x26c6d6[_0x8df5('0x16')],_0x468fd4);_0x5a0374(_0x347d0a[_0x8df5('0x14')](0x1f4,_0x26c6d6[_0x8df5('0x16')]));});});};exports[_0x8df5('0x24')]=function(_0x52837c,_0x10178b,_0x3b81dc){var _0x142ded=this;return new Promise(function(_0x14a2f6,_0x12211f){var _0x44011a={'body':_0x52837c[_0x8df5('0x25')],'channel':_0x8df5('0x26')};var _0x4a90f3=[];var _0x26b054=[];var _0x17d8d6={};return db[_0x8df5('0x27')][_0x8df5('0x28')]()[_0x8df5('0xd')](function(_0x5cb55b){if(!_0x5cb55b){throw new db[(_0x8df5('0x29'))][(_0x8df5('0x2a'))](_0x8df5('0x2b'));}_0x4a90f3=_['difference'](_[_0x8df5('0x2c')](_0x5cb55b),[_0x8df5('0x2d'),_0x8df5('0x2e')]);_0x26b054=_['difference'](_[_0x8df5('0x2c')](_0x5cb55b),[_0x8df5('0x2d'),_0x8df5('0x2e'),_0x8df5('0x2f'),_0x8df5('0x30')]);if(_0x52837c[_0x8df5('0x25')]['id']){delete _0x52837c['body']['id'];}if(_[_0x8df5('0x31')](_0x52837c[_0x8df5('0x25')][_0x8df5('0x32')])){throw new db[(_0x8df5('0x29'))][(_0x8df5('0x2a'))](_0x8df5('0x33'));}if(_[_0x8df5('0x31')](_0x52837c[_0x8df5('0x25')][_0x8df5('0x25')])||_0x52837c['body']['body']===''){throw new db[(_0x8df5('0x29'))]['ValidationError'](_0x8df5('0x34'));}if(_[_0x8df5('0x31')](_0x52837c[_0x8df5('0x25')][_0x8df5('0x35')])){throw new db[(_0x8df5('0x29'))][(_0x8df5('0x2a'))](_0x8df5('0x36')+_0x26b054);}if(!_['includes'](_0x26b054,_0x52837c[_0x8df5('0x25')]['mapKey'])){throw new db['Sequelize'][(_0x8df5('0x2a'))](_0x8df5('0x37')+_0x26b054);}_0x17d8d6[_0x52837c[_0x8df5('0x25')][_0x8df5('0x35')]]=_0x52837c[_0x8df5('0x25')][_0x8df5('0x32')];})[_0x8df5('0xd')](function(){return db['FaxAccount'][_0x8df5('0x38')]({'where':{'id':_0x52837c[_0x8df5('0x39')]['id']},'include':[{'model':db[_0x8df5('0x3a')],'as':_0x8df5('0x3b'),'include':[{'model':db[_0x8df5('0x27')],'as':_0x8df5('0x3c'),'where':_0x17d8d6,'limit':0x1,'order':[[_0x8df5('0x2e'),_0x8df5('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0x8df5('0x3e')}]});})[_0x8df5('0xd')](function(_0x1c3848){if(_0x1c3848&&_0x1c3848[_0x8df5('0x3b')]){var _0x1addad=_0x1c3848[_0x8df5('0x3f')]({'plain':!![]});_0x44011a[_0x8df5('0x39')]=_0x1addad;_0x44011a['applications']=_0x1addad[_0x8df5('0x3e')];_0x44011a[_0x8df5('0x40')]=_0x1addad[_0x8df5('0x3b')];_0x44011a[_0x8df5('0x41')]=_[_0x8df5('0x42')](_0x44011a[_0x8df5('0x41')],[_0x8df5('0x43')],[_0x8df5('0x44')]);if(_0x44011a['account'][_0x8df5('0x3e')]){delete _0x44011a['account'][_0x8df5('0x3e')];}if(_0x44011a['account'][_0x8df5('0x3b')]&&_0x44011a[_0x8df5('0x39')][_0x8df5('0x3b')][_0x8df5('0x3c')][_0x8df5('0x45')]){return _0x44011a[_0x8df5('0x39')][_0x8df5('0x3b')][_0x8df5('0x3c')][0x0];}var _0x183d92=_[_0x8df5('0xa')](_0x52837c[_0x8df5('0x25')],{'firstName':_0x52837c['body']['from'],'ListId':_0x1addad['ListId']});_0x183d92[_0x52837c['body'][_0x8df5('0x35')]]=_0x52837c[_0x8df5('0x25')]['from'];return db[_0x8df5('0x27')][_0x8df5('0x46')](_0x183d92,{'fields':_0x4a90f3,'raw':!![]});}})[_0x8df5('0xd')](function(_0x5ae88b){_0x44011a[_0x8df5('0x47')]=_0x5ae88b;if(_0x5ae88b){var _0xfc0bb4={'ContactId':_0x5ae88b['id'],'FaxAccountId':_0x52837c['account']['id'],'fax':_0x5ae88b['fax']};return db[_0x8df5('0x48')][_0x8df5('0x38')]({'where':{'ContactId':_0x5ae88b['id'],'closed':![],'FaxAccountId':_0x52837c['account']['id']}})[_0x8df5('0xd')](function(_0x58e261){if(_0x58e261){return[_0x58e261,![]];}return db[_0x8df5('0x48')][_0x8df5('0x46')](_0xfc0bb4)[_0x8df5('0xd')](function(_0x501bfa){return[_0x501bfa,!![]];});});}else{throw new Error(_0x8df5('0x49'));}})[_0x8df5('0x4a')](function(_0x5f246e,_0x360611){var _0x13a745=_0x5f246e['get']({'plain':!![]});if(_0x360611){if(_0x44011a[_0x8df5('0x39')][_0x8df5('0x4b')]){_0x44011a[_0x8df5('0x41')][_0x8df5('0x4c')]({'id':0x0,'priority':_0x44011a[_0x8df5('0x41')][_0x8df5('0x45')]+0x1,'app':'close','appdata':_0x8df5('0x4d'),'interval':'*,*,*,*'});}_0x13a745[_0x8df5('0x4e')]=!![];}else{_0x13a745[_0x8df5('0x4e')]=![];}_0x44011a[_0x8df5('0x4f')]=_0x13a745;return db['FaxMessage']['create']({'body':_0x52837c[_0x8df5('0x25')][_0x8df5('0x25')],'FaxAccountId':_0x52837c['account']['id'],'FaxInteractionId':_0x5f246e['id'],'direction':'in','ContactId':_0x5f246e[_0x8df5('0x50')],'AttachmentId':_0x52837c[_0x8df5('0x25')]['AttachmentId']});})[_0x8df5('0xd')](function(_0x346645){_0x44011a[_0x8df5('0x16')]=_0x346645;if(!_0x44011a[_0x8df5('0x4f')][_0x8df5('0x51')])return;return db[_0x8df5('0x52')][_0x8df5('0x38')]({'attributes':['id','name'],'where':{'id':_0x44011a[_0x8df5('0x4f')][_0x8df5('0x51')]}});})['then'](function(_0x958680){if(_0x958680){_0x44011a['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x8df5('0x53'),'appdata':_0x958680[_0x8df5('0x54')]+','+(_0x44011a[_0x8df5('0x39')][_0x8df5('0x55')]||0xa),'interval':_0x8df5('0x56')});}if(!_0x44011a[_0x8df5('0x4f')][_0x8df5('0x57')])return;return db['FaxQueue'][_0x8df5('0x38')]({'attributes':['id',_0x8df5('0x54')],'where':{'id':_0x44011a[_0x8df5('0x4f')][_0x8df5('0x57')]}});})['then'](function(_0x59114d){if(_0x59114d){_0x44011a[_0x8df5('0x41')][_0x8df5('0x58')]({'id':0x0,'priority':0x1,'app':_0x8df5('0x59'),'appdata':_0x59114d[_0x8df5('0x54')]+','+(_0x44011a[_0x8df5('0x39')][_0x8df5('0x5a')]||0x12c),'interval':_0x8df5('0x56')});}return respondWithRpcPromise(_0x8df5('0x5b'),_0x8df5('0x5c'),_0x44011a);})[_0x8df5('0xd')](function(_0x5dfca9){_0x14a2f6(_0x5dfca9);})[_0x8df5('0x18')](function(_0x441c67){_0x12211f(_0x142ded['error'](0x1f4,_0x441c67[_0x8df5('0x16')]));});});}; \ No newline at end of file +var _0x17bc=['created','interaction','FaxMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','name','waitForTheAssignedQueue','*,*,*,*','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','Contacts','FaxApplication','Applications','List','applications','orderBy','priority','create','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','length','close','unmanaged'];(function(_0x1a0269,_0x5692f2){var _0x34887d=function(_0x40ab8b){while(--_0x40ab8b){_0x1a0269['push'](_0x1a0269['shift']());}};_0x34887d(++_0x5692f2);}(_0x17bc,0x1d0));var _0xc17b=function(_0x590d1a,_0x1b076){_0x590d1a=_0x590d1a-0x0;var _0x215ed7=_0x17bc[_0x590d1a];return _0x215ed7;};'use strict';var _=require(_0xc17b('0x0'));var util=require(_0xc17b('0x1'));var moment=require(_0xc17b('0x2'));var BPromise=require(_0xc17b('0x3'));var rs=require(_0xc17b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc17b('0x5'));var logger=require(_0xc17b('0x6'))(_0xc17b('0x7'));var config=require('../../config/environment');var jayson=require(_0xc17b('0x8'));var client=jayson[_0xc17b('0x9')][_0xc17b('0xa')]({'port':0x232c});config[_0xc17b('0xb')]=_[_0xc17b('0xc')](config[_0xc17b('0xb')],{'host':_0xc17b('0xd'),'port':0x18eb});var socket=require(_0xc17b('0xe'))(new Redis(config[_0xc17b('0xb')]));require(_0xc17b('0xf'))[_0xc17b('0x10')](socket);function respondWithRpcPromise(_0x5cd2e0,_0x3a7752,_0x4176aa){return new BPromise(function(_0x15a986,_0x1cf4af){return client['request'](_0x5cd2e0,_0x4176aa)[_0xc17b('0x11')](function(_0x8e996){logger[_0xc17b('0x12')](_0xc17b('0x13'),_0x3a7752,_0xc17b('0x14'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3a7752,_0xc17b('0x14'),JSON[_0xc17b('0x15')](_0x8e996));if(_0x8e996[_0xc17b('0x16')]){if(_0x8e996[_0xc17b('0x16')]['code']===0x1f4){logger[_0xc17b('0x16')](_0xc17b('0x13'),_0x3a7752,_0x8e996[_0xc17b('0x16')][_0xc17b('0x17')]);return _0x1cf4af(_0x8e996[_0xc17b('0x16')]['message']);}logger['error'](_0xc17b('0x13'),_0x3a7752,_0x8e996['error']['message']);return _0x15a986(_0x8e996[_0xc17b('0x16')][_0xc17b('0x17')]);}else{logger[_0xc17b('0x12')](_0xc17b('0x13'),_0x3a7752,_0xc17b('0x14'));_0x15a986(_0x8e996[_0xc17b('0x18')][_0xc17b('0x17')]);}})[_0xc17b('0x19')](function(_0x12eae5){logger['error'](_0xc17b('0x13'),_0x3a7752,_0x12eae5);_0x1cf4af(_0x12eae5);});});}exports[_0xc17b('0x1a')]=function(_0x6168ff){var _0x275c76=this;return new Promise(function(_0x2ab23e,_0xa5ddf3){return db[_0xc17b('0x1b')][_0xc17b('0x1c')]({'raw':_0x6168ff['options']?_0x6168ff[_0xc17b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x6168ff[_0xc17b('0x1d')]?_0x6168ff[_0xc17b('0x1d')][_0xc17b('0x1e')]||null:null,'attributes':_0x6168ff[_0xc17b('0x1d')]?_0x6168ff[_0xc17b('0x1d')][_0xc17b('0x1f')]||null:null,'limit':_0x6168ff['options']?_0x6168ff[_0xc17b('0x1d')][_0xc17b('0x20')]||null:null,'include':_0x6168ff[_0xc17b('0x1d')]?_0x6168ff['options'][_0xc17b('0x21')]?_['map'](_0x6168ff['options']['include'],function(_0xff2342){return{'model':db[_0xff2342[_0xc17b('0x22')]],'as':_0xff2342['as'],'attributes':_0xff2342['attributes'],'include':_0xff2342['include']?_[_0xc17b('0x23')](_0xff2342[_0xc17b('0x21')],function(_0x535819){return{'model':db[_0x535819[_0xc17b('0x22')]],'as':_0x535819['as'],'attributes':_0x535819['attributes'],'include':_0x535819[_0xc17b('0x21')]?_[_0xc17b('0x23')](_0x535819[_0xc17b('0x21')],function(_0x583ead){return{'model':db[_0x583ead['model']],'as':_0x583ead['as'],'attributes':_0x583ead[_0xc17b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43cbd6){logger[_0xc17b('0x12')](_0xc17b('0x1a'),_0x6168ff);logger['debug'](_0xc17b('0x1a'),_0x6168ff,JSON[_0xc17b('0x15')](_0x43cbd6));_0x2ab23e(_0x43cbd6);})[_0xc17b('0x19')](function(_0x533f3f){logger[_0xc17b('0x16')](_0xc17b('0x1a'),_0x533f3f[_0xc17b('0x17')],_0x6168ff);_0xa5ddf3(_0x275c76[_0xc17b('0x16')](0x1f4,_0x533f3f[_0xc17b('0x17')]));});});};exports[_0xc17b('0x24')]=function(_0x415d9a,_0x5a4c8d,_0x1ccfcf){var _0x48a072=this;return new Promise(function(_0x3753ae,_0x5748a2){var _0x160dab={'body':_0x415d9a[_0xc17b('0x25')],'channel':_0xc17b('0x26')};var _0x110f26=[];var _0x19ada4=[];var _0x44b6ea={};return db['CmContact'][_0xc17b('0x27')]()[_0xc17b('0x11')](function(_0x388b84){if(!_0x388b84){throw new db[(_0xc17b('0x28'))]['ValidationError'](_0xc17b('0x29'));}_0x110f26=_[_0xc17b('0x2a')](_[_0xc17b('0x2b')](_0x388b84),['createdAt','updatedAt']);_0x19ada4=_[_0xc17b('0x2a')](_[_0xc17b('0x2b')](_0x388b84),[_0xc17b('0x2c'),_0xc17b('0x2d'),_0xc17b('0x2e'),_0xc17b('0x2f')]);if(_0x415d9a['body']['id']){delete _0x415d9a[_0xc17b('0x25')]['id'];}if(_[_0xc17b('0x30')](_0x415d9a[_0xc17b('0x25')][_0xc17b('0x31')])){throw new db[(_0xc17b('0x28'))][(_0xc17b('0x32'))](_0xc17b('0x33'));}if(_['isNil'](_0x415d9a['body'][_0xc17b('0x25')])||_0x415d9a[_0xc17b('0x25')]['body']===''){throw new db[(_0xc17b('0x28'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc17b('0x30')](_0x415d9a[_0xc17b('0x25')][_0xc17b('0x34')])){throw new db[(_0xc17b('0x28'))][(_0xc17b('0x32'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19ada4);}if(!_[_0xc17b('0x35')](_0x19ada4,_0x415d9a[_0xc17b('0x25')][_0xc17b('0x34')])){throw new db[(_0xc17b('0x28'))]['ValidationError'](_0xc17b('0x36')+_0x19ada4);}_0x44b6ea[_0x415d9a[_0xc17b('0x25')][_0xc17b('0x34')]]=_0x415d9a['body'][_0xc17b('0x31')];})[_0xc17b('0x11')](function(){return db[_0xc17b('0x1b')][_0xc17b('0x37')]({'where':{'id':_0x415d9a[_0xc17b('0x38')]['id']},'include':[{'model':db[_0xc17b('0x39')],'as':'List','include':[{'model':db[_0xc17b('0x3a')],'as':_0xc17b('0x3b'),'where':_0x44b6ea,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc17b('0x3c')],'as':_0xc17b('0x3d')}]});})[_0xc17b('0x11')](function(_0x57bc41){if(_0x57bc41&&_0x57bc41[_0xc17b('0x3e')]){var _0x45f979=_0x57bc41['get']({'plain':!![]});_0x160dab[_0xc17b('0x38')]=_0x45f979;_0x160dab[_0xc17b('0x3f')]=_0x45f979[_0xc17b('0x3d')];_0x160dab['list']=_0x45f979['List'];_0x160dab[_0xc17b('0x3f')]=_[_0xc17b('0x40')](_0x160dab['applications'],[_0xc17b('0x41')],['asc']);if(_0x160dab[_0xc17b('0x38')][_0xc17b('0x3d')]){delete _0x160dab[_0xc17b('0x38')][_0xc17b('0x3d')];}if(_0x160dab[_0xc17b('0x38')]['List']&&_0x160dab['account'][_0xc17b('0x3e')][_0xc17b('0x3b')]['length']){return _0x160dab[_0xc17b('0x38')][_0xc17b('0x3e')][_0xc17b('0x3b')][0x0];}var _0x105610=_[_0xc17b('0xc')](_0x415d9a[_0xc17b('0x25')],{'firstName':_0x415d9a['body'][_0xc17b('0x31')],'ListId':_0x45f979[_0xc17b('0x2f')]});_0x105610[_0x415d9a[_0xc17b('0x25')]['mapKey']]=_0x415d9a[_0xc17b('0x25')][_0xc17b('0x31')];return db['CmContact'][_0xc17b('0x42')](_0x105610,{'fields':_0x110f26,'raw':!![]});}})[_0xc17b('0x11')](function(_0x229ec6){_0x160dab[_0xc17b('0x43')]=_0x229ec6;if(_0x229ec6){var _0x3061af={'ContactId':_0x229ec6['id'],'FaxAccountId':_0x415d9a[_0xc17b('0x38')]['id'],'fax':_0x229ec6[_0xc17b('0x26')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x229ec6['id'],'closed':![],'FaxAccountId':_0x415d9a[_0xc17b('0x38')]['id']}})[_0xc17b('0x11')](function(_0x43f00){if(_0x43f00){return[_0x43f00,![]];}return db[_0xc17b('0x44')][_0xc17b('0x42')](_0x3061af)[_0xc17b('0x11')](function(_0x186e31){return[_0x186e31,!![]];});});}else{throw new Error(_0xc17b('0x45'));}})['spread'](function(_0x11c70b,_0xe2d8b9){var _0x50666f=_0x11c70b[_0xc17b('0x46')]({'plain':!![]});if(_0xe2d8b9){if(_0x160dab[_0xc17b('0x38')][_0xc17b('0x47')]){_0x160dab[_0xc17b('0x3f')][_0xc17b('0x48')]({'id':0x0,'priority':_0x160dab[_0xc17b('0x3f')][_0xc17b('0x49')]+0x1,'app':_0xc17b('0x4a'),'appdata':_0xc17b('0x4b'),'interval':'*,*,*,*'});}_0x50666f['created']=!![];}else{_0x50666f[_0xc17b('0x4c')]=![];}_0x160dab[_0xc17b('0x4d')]=_0x50666f;return db[_0xc17b('0x4e')]['create']({'body':_0x415d9a[_0xc17b('0x25')][_0xc17b('0x25')],'FaxAccountId':_0x415d9a['account']['id'],'FaxInteractionId':_0x11c70b['id'],'direction':'in','ContactId':_0x11c70b['ContactId'],'AttachmentId':_0x415d9a['body'][_0xc17b('0x4f')]});})[_0xc17b('0x11')](function(_0x10f50e){_0x160dab[_0xc17b('0x17')]=_0x10f50e;if(!_0x160dab[_0xc17b('0x4d')]['UserId'])return;return db['User'][_0xc17b('0x37')]({'attributes':['id','name'],'where':{'id':_0x160dab['interaction'][_0xc17b('0x50')]}});})[_0xc17b('0x11')](function(_0x54d4d3){if(_0x54d4d3){_0x160dab[_0xc17b('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc17b('0x51'),'appdata':_0x54d4d3['name']+','+(_0x160dab[_0xc17b('0x38')][_0xc17b('0x52')]||0xa),'interval':'*,*,*,*'});}if(!_0x160dab[_0xc17b('0x4d')][_0xc17b('0x53')])return;return db[_0xc17b('0x54')][_0xc17b('0x37')]({'attributes':['id','name'],'where':{'id':_0x160dab[_0xc17b('0x4d')][_0xc17b('0x53')]}});})[_0xc17b('0x11')](function(_0x578bc1){if(_0x578bc1){_0x160dab[_0xc17b('0x3f')][_0xc17b('0x55')]({'id':0x0,'priority':0x1,'app':_0xc17b('0x56'),'appdata':_0x578bc1[_0xc17b('0x57')]+','+(_0x160dab['account'][_0xc17b('0x58')]||0x12c),'interval':_0xc17b('0x59')});}return respondWithRpcPromise('Start','startRouting',_0x160dab);})['then'](function(_0x465ade){_0x3753ae(_0x465ade);})[_0xc17b('0x19')](function(_0x5f5269){_0x5748a2(_0x48a072[_0xc17b('0x16')](0x1f4,_0x5f5269['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e297823..ffece96 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 _0x54f5=['length','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x459575,_0x5799ea){var _0x18a348=function(_0x4acaef){while(--_0x4acaef){_0x459575['push'](_0x459575['shift']());}};_0x18a348(++_0x5799ea);}(_0x54f5,0xb9));var _0x554f=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0x54f5[_0x36909d];return _0x1fd29d;};'use strict';var FaxAccountEvents=require(_0x554f('0x0'));var events=[_0x554f('0x1'),_0x554f('0x2'),_0x554f('0x3')];function createListener(_0x5caf35,_0x2d092e){return function(_0x2d20a3){_0x2d092e[_0x554f('0x4')](_0x5caf35,_0x2d20a3);};}function removeListener(_0x9fa84d,_0x2217a2){return function(){FaxAccountEvents[_0x554f('0x5')](_0x9fa84d,_0x2217a2);};}exports[_0x554f('0x6')]=function(_0x376aa8){for(var _0x1e4f08=0x0,_0x3d0343=events[_0x554f('0x7')];_0x1e4f08<_0x3d0343;_0x1e4f08++){var _0x184d97=events[_0x1e4f08];var _0x253c86=createListener('faxAccount:'+_0x184d97,_0x376aa8);FaxAccountEvents['on'](_0x184d97,_0x253c86);}}; \ No newline at end of file +var _0x5f03=['./faxAccount.events','save','remove','update','emit','removeListener','faxAccount:'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x5f03,0x1a4));var _0x35f0=function(_0x2907ae,_0x3fef0b){_0x2907ae=_0x2907ae-0x0;var _0x3f3849=_0x5f03[_0x2907ae];return _0x3f3849;};'use strict';var FaxAccountEvents=require(_0x35f0('0x0'));var events=[_0x35f0('0x1'),_0x35f0('0x2'),_0x35f0('0x3')];function createListener(_0x2514bb,_0xef522e){return function(_0x574b5f){_0xef522e[_0x35f0('0x4')](_0x2514bb,_0x574b5f);};}function removeListener(_0x307349,_0x27b725){return function(){FaxAccountEvents[_0x35f0('0x5')](_0x307349,_0x27b725);};}exports['register']=function(_0x5e41f2){for(var _0x38c3fd=0x0,_0x23e5a5=events['length'];_0x38c3fd<_0x23e5a5;_0x38c3fd++){var _0x2097a0=events[_0x38c3fd];var _0x1d9033=createListener(_0x35f0('0x6')+_0x2097a0,_0x5e41f2);FaxAccountEvents['on'](_0x2097a0,_0x1d9033);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index de2b634..e6a2d11 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 _0xe4fa=['fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/:id','show','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','addAgents','delete','destroy','removeDispositions','removeAgents','exports','util','connect-timeout'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe4fa,0x130));var _0xae4f=function(_0x5b7529,_0x2c8073){_0x5b7529=_0x5b7529-0x0;var _0x26df0a=_0xe4fa[_0x5b7529];return _0x26df0a;};'use strict';var multer=require('multer');var util=require(_0xae4f('0x0'));var path=require('path');var timeout=require(_0xae4f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xae4f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xae4f('0x3'));var config=require(_0xae4f('0x4'));var controller=require(_0xae4f('0x5'));router['get']('/',auth[_0xae4f('0x6')](),controller[_0xae4f('0x7')]);router[_0xae4f('0x8')]('/describe',auth[_0xae4f('0x6')](),controller['describe']);router[_0xae4f('0x8')](_0xae4f('0x9'),auth['isAuthenticated'](),controller[_0xae4f('0xa')]);router[_0xae4f('0x8')]('/:id/dispositions',auth[_0xae4f('0x6')](),controller['getDispositions']);router[_0xae4f('0x8')](_0xae4f('0xb'),auth[_0xae4f('0x6')](),controller[_0xae4f('0xc')]);router['get'](_0xae4f('0xd'),auth[_0xae4f('0x6')](),controller['getInteractions']);router[_0xae4f('0x8')](_0xae4f('0xe'),auth['isAuthenticated'](),controller[_0xae4f('0xf')]);router[_0xae4f('0x8')]('/:id/messages',auth[_0xae4f('0x6')](),controller['getMessages']);router[_0xae4f('0x8')](_0xae4f('0x10'),auth[_0xae4f('0x6')](),controller[_0xae4f('0x11')]);router[_0xae4f('0x12')]('/',auth['isAuthenticated'](),controller[_0xae4f('0x13')]);router[_0xae4f('0x12')](_0xae4f('0x14'),auth[_0xae4f('0x6')](),controller[_0xae4f('0x15')]);router['post'](_0xae4f('0xb'),auth['isAuthenticated'](),controller[_0xae4f('0x16')]);router[_0xae4f('0x12')](_0xae4f('0xd'),auth[_0xae4f('0x6')](),controller[_0xae4f('0x17')]);router[_0xae4f('0x12')]('/:id/applications',auth[_0xae4f('0x6')](),controller['addApplications']);router[_0xae4f('0x12')](_0xae4f('0x18'),auth[_0xae4f('0x6')](),controller[_0xae4f('0x19')]);router[_0xae4f('0x12')](_0xae4f('0x1a'),auth[_0xae4f('0x6')](),controller['updateAccountApplications']);router[_0xae4f('0x12')]('/:id/send',auth['isAuthenticated'](),controller[_0xae4f('0x1b')]);router[_0xae4f('0x12')](_0xae4f('0x10'),auth[_0xae4f('0x6')](),controller[_0xae4f('0x1c')]);router['put'](_0xae4f('0x9'),auth[_0xae4f('0x6')](),controller['update']);router[_0xae4f('0x1d')](_0xae4f('0x9'),auth[_0xae4f('0x6')](),controller[_0xae4f('0x1e')]);router[_0xae4f('0x1d')](_0xae4f('0x14'),auth['isAuthenticated'](),controller[_0xae4f('0x1f')]);router[_0xae4f('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xae4f('0x1d')]('/:id/users',auth[_0xae4f('0x6')](),controller[_0xae4f('0x20')]);module[_0xae4f('0x21')]=router; \ No newline at end of file +var _0xf838=['getInteractions','/:id/messages','getAgents','create','post','addAnswer','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/users','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf838,0x159));var _0x8f83=function(_0x162ebc,_0x55c0c6){_0x162ebc=_0x162ebc-0x0;var _0x133d96=_0xf838[_0x162ebc];return _0x133d96;};'use strict';var multer=require(_0x8f83('0x0'));var util=require('util');var path=require(_0x8f83('0x1'));var timeout=require(_0x8f83('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8f83('0x3'));var config=require(_0x8f83('0x4'));var controller=require(_0x8f83('0x5'));router[_0x8f83('0x6')]('/',auth[_0x8f83('0x7')](),controller[_0x8f83('0x8')]);router[_0x8f83('0x6')](_0x8f83('0x9'),auth[_0x8f83('0x7')](),controller[_0x8f83('0xa')]);router[_0x8f83('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8f83('0x6')](_0x8f83('0xb'),auth[_0x8f83('0x7')](),controller[_0x8f83('0xc')]);router['get'](_0x8f83('0xd'),auth[_0x8f83('0x7')](),controller['getAnswers']);router[_0x8f83('0x6')](_0x8f83('0xe'),auth[_0x8f83('0x7')](),controller[_0x8f83('0xf')]);router[_0x8f83('0x6')]('/:id/applications',auth[_0x8f83('0x7')](),controller['getApplications']);router['get'](_0x8f83('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x8f83('0x6')]('/:id/users',auth[_0x8f83('0x7')](),controller[_0x8f83('0x11')]);router['post']('/',auth[_0x8f83('0x7')](),controller[_0x8f83('0x12')]);router[_0x8f83('0x13')]('/:id/dispositions',auth[_0x8f83('0x7')](),controller['addDisposition']);router[_0x8f83('0x13')]('/:id/canned_answers',auth[_0x8f83('0x7')](),controller[_0x8f83('0x14')]);router[_0x8f83('0x13')](_0x8f83('0xe'),auth[_0x8f83('0x7')](),controller['addInteraction']);router['post'](_0x8f83('0x15'),auth[_0x8f83('0x7')](),controller[_0x8f83('0x16')]);router[_0x8f83('0x13')](_0x8f83('0x17'),auth['isAuthenticated'](),controller[_0x8f83('0x18')]);router[_0x8f83('0x13')]('/updateaccountapplications',auth[_0x8f83('0x7')](),controller[_0x8f83('0x19')]);router[_0x8f83('0x13')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x8f83('0x13')](_0x8f83('0x1a'),auth[_0x8f83('0x7')](),controller[_0x8f83('0x1b')]);router[_0x8f83('0x1c')]('/:id',auth[_0x8f83('0x7')](),controller[_0x8f83('0x1d')]);router[_0x8f83('0x1e')](_0x8f83('0x1f'),auth[_0x8f83('0x7')](),controller[_0x8f83('0x20')]);router[_0x8f83('0x1e')](_0x8f83('0xb'),auth['isAuthenticated'](),controller[_0x8f83('0x21')]);router[_0x8f83('0x1e')](_0x8f83('0xd'),auth['isAuthenticated'](),controller[_0x8f83('0x22')]);router[_0x8f83('0x1e')](_0x8f83('0x1a'),auth['isAuthenticated'](),controller[_0x8f83('0x23')]);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 480fe50..00df2f5 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 _0x42c5=['sequelize','exports','noop','TEXT','STRING'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0x42c5,0x172));var _0x542c=function(_0x13c382,_0x3215af){_0x13c382=_0x13c382-0x0;var _0x51b131=_0x42c5[_0x13c382];return _0x51b131;};'use strict';var Sequelize=require(_0x542c('0x0'));module[_0x542c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x542c('0x2')},'appdata':{'type':Sequelize[_0x542c('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x542c('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf9e5=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9e5,0x164));var _0x5f9e=function(_0x2285b3,_0x1953a0){_0x2285b3=_0x2285b3-0x0;var _0x4a6da0=_0xf9e5[_0x2285b3];return _0x4a6da0;};'use strict';var Sequelize=require(_0x5f9e('0x0'));module[_0x5f9e('0x1')]={'priority':{'type':Sequelize[_0x5f9e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5f9e('0x3')],'allowNull':![],'defaultValue':_0x5f9e('0x4')},'appdata':{'type':Sequelize[_0x5f9e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5f9e('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e67c0dc..ee5268e 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 _0xb552=['attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','FaxApplication','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','keys','query','filters','intersection','model','fields'];(function(_0x57b3ab,_0x524afb){var _0x49eac4=function(_0xbbb054){while(--_0xbbb054){_0x57b3ab['push'](_0x57b3ab['shift']());}};_0x49eac4(++_0x524afb);}(_0xb552,0x65));var _0x2b55=function(_0x1779ca,_0x458323){_0x1779ca=_0x1779ca-0x0;var _0x1c2e9c=_0xb552[_0x1779ca];return _0x1c2e9c;};'use strict';var emlformat=require(_0x2b55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b55('0x1'));var jsonpatch=require(_0x2b55('0x2'));var rp=require(_0x2b55('0x3'));var moment=require(_0x2b55('0x4'));var BPromise=require(_0x2b55('0x5'));var Mustache=require(_0x2b55('0x6'));var util=require('util');var path=require(_0x2b55('0x7'));var sox=require(_0x2b55('0x8'));var csv=require(_0x2b55('0x9'));var ejs=require(_0x2b55('0xa'));var fs=require('fs');var fs_extra=require(_0x2b55('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b55('0xc'));var jsforce=require(_0x2b55('0xd'));var deskjs=require(_0x2b55('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b55('0xf'));var Papa=require(_0x2b55('0x10'));var Redis=require(_0x2b55('0x11'));var authService=require(_0x2b55('0x12'));var qs=require(_0x2b55('0x13'));var as=require(_0x2b55('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b55('0x15'))(_0x2b55('0x16'));var utils=require(_0x2b55('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b55('0x18'));var db=require(_0x2b55('0x19'))['db'];function respondWithStatusCode(_0x5d2110,_0x57c697){_0x57c697=_0x57c697||0xcc;return function(_0x5e708c){if(_0x5e708c){return _0x5d2110[_0x2b55('0x1a')](_0x57c697);}return _0x5d2110[_0x2b55('0x1b')](_0x57c697)[_0x2b55('0x1c')]();};}function respondWithResult(_0x14f811,_0x42061e){_0x42061e=_0x42061e||0xc8;return function(_0x2a32c0){if(_0x2a32c0){return _0x14f811[_0x2b55('0x1b')](_0x42061e)[_0x2b55('0x1d')](_0x2a32c0);}};}function respondWithFilteredResult(_0xf4d8a6,_0x3f0661){return function(_0x9b8486){if(_0x9b8486){var _0x549677=typeof _0x3f0661[_0x2b55('0x1e')]==='undefined'&&typeof _0x3f0661['limit']===_0x2b55('0x1f');var _0x2e952d=_0x9b8486[_0x2b55('0x20')];var _0x22edd8=_0x549677?0x0:_0x3f0661[_0x2b55('0x1e')];var _0x44c687=_0x549677?_0x9b8486['count']:_0x3f0661[_0x2b55('0x1e')]+_0x3f0661['limit'];var _0x2d1ac9;if(_0x44c687>=_0x2e952d){_0x44c687=_0x2e952d;_0x2d1ac9=0xc8;}else{_0x2d1ac9=0xce;}_0xf4d8a6[_0x2b55('0x1b')](_0x2d1ac9);return _0xf4d8a6[_0x2b55('0x21')](_0x2b55('0x22'),_0x22edd8+'-'+_0x44c687+'/'+_0x2e952d)[_0x2b55('0x1d')](_0x9b8486);}return null;};}function patchUpdates(_0x4c3fb1){return function(_0x3a4fb8){try{jsonpatch[_0x2b55('0x23')](_0x3a4fb8,_0x4c3fb1,!![]);}catch(_0x270f81){return BPromise['reject'](_0x270f81);}return _0x3a4fb8[_0x2b55('0x24')]();};}function saveUpdates(_0x55c2b7,_0x459e86){return function(_0x3f8791){if(_0x3f8791){return _0x3f8791[_0x2b55('0x25')](_0x55c2b7)[_0x2b55('0x26')](function(_0x282a3b){return _0x282a3b;});}return null;};}function removeEntity(_0x47d0ba,_0xf37ef7){return function(_0x491530){if(_0x491530){return _0x491530[_0x2b55('0x27')]()[_0x2b55('0x26')](function(){_0x47d0ba[_0x2b55('0x1b')](0xcc)[_0x2b55('0x1c')]();});}};}function handleEntityNotFound(_0x3fd358,_0x9d485a){return function(_0x501cbc){if(!_0x501cbc){_0x3fd358[_0x2b55('0x1a')](0x194);}return _0x501cbc;};}function handleError(_0xf6cfc9,_0x21f203){_0x21f203=_0x21f203||0x1f4;return function(_0x2d9dcb){logger[_0x2b55('0x28')](_0x2d9dcb[_0x2b55('0x29')]);if(_0x2d9dcb[_0x2b55('0x2a')]){delete _0x2d9dcb['name'];}_0xf6cfc9['status'](_0x21f203)[_0x2b55('0x2b')](_0x2d9dcb);};}exports[_0x2b55('0x2c')]=function(_0x1d2132,_0x434c41){var _0x25d7f7={},_0x214f06={},_0x6c21ac={'count':0x0,'rows':[]};var _0x2e2eb8=_['map'](db['FaxApplication'][_0x2b55('0x2d')],function(_0xc6223){return{'name':_0xc6223['fieldName'],'type':_0xc6223[_0x2b55('0x2e')]['key']};});_0x214f06['model']=_['map'](_0x2e2eb8,'name');_0x214f06['query']=_[_0x2b55('0x2f')](_0x1d2132[_0x2b55('0x30')]);_0x214f06[_0x2b55('0x31')]=_[_0x2b55('0x32')](_0x214f06[_0x2b55('0x33')],_0x214f06['query']);_0x25d7f7['attributes']=_[_0x2b55('0x32')](_0x214f06[_0x2b55('0x33')],qs['fields'](_0x1d2132[_0x2b55('0x30')][_0x2b55('0x34')]));_0x25d7f7[_0x2b55('0x35')]=_0x25d7f7[_0x2b55('0x35')][_0x2b55('0x36')]?_0x25d7f7['attributes']:_0x214f06['model'];if(!_0x1d2132[_0x2b55('0x30')][_0x2b55('0x37')](_0x2b55('0x38'))){_0x25d7f7['limit']=qs[_0x2b55('0x39')](_0x1d2132[_0x2b55('0x30')][_0x2b55('0x39')]);_0x25d7f7[_0x2b55('0x1e')]=qs[_0x2b55('0x1e')](_0x1d2132[_0x2b55('0x30')]['offset']);}_0x25d7f7['order']=qs['sort'](_0x1d2132['query'][_0x2b55('0x3a')]);_0x25d7f7['where']=qs['filters'](_[_0x2b55('0x3b')](_0x1d2132[_0x2b55('0x30')],_0x214f06['filters']),_0x2e2eb8);if(_0x1d2132[_0x2b55('0x30')][_0x2b55('0x3c')]){_0x25d7f7[_0x2b55('0x3d')]=_[_0x2b55('0x3e')](_0x25d7f7[_0x2b55('0x3d')],{'$or':_[_0x2b55('0x3f')](_0x2e2eb8,function(_0x1d7dc3){if(_0x1d7dc3[_0x2b55('0x2e')]!==_0x2b55('0x40')){var _0x1f398c={};_0x1f398c[_0x1d7dc3[_0x2b55('0x2a')]]={'$like':'%'+_0x1d2132[_0x2b55('0x30')][_0x2b55('0x3c')]+'%'};return _0x1f398c;}})});}_0x25d7f7=_[_0x2b55('0x3e')]({},_0x25d7f7,_0x1d2132['options']);var _0x57d509={'where':_0x25d7f7[_0x2b55('0x3d')]};return db['FaxApplication']['count'](_0x57d509)[_0x2b55('0x26')](function(_0x32dd3d){_0x6c21ac[_0x2b55('0x20')]=_0x32dd3d;if(_0x1d2132['query'][_0x2b55('0x41')]){_0x25d7f7[_0x2b55('0x42')]=[{'all':!![]}];}return db[_0x2b55('0x43')][_0x2b55('0x44')](_0x25d7f7);})[_0x2b55('0x26')](function(_0x33043b){_0x6c21ac[_0x2b55('0x45')]=_0x33043b;return _0x6c21ac;})[_0x2b55('0x26')](respondWithFilteredResult(_0x434c41,_0x25d7f7))[_0x2b55('0x46')](handleError(_0x434c41,null));};exports[_0x2b55('0x47')]=function(_0x2853d2,_0x5a5e65){var _0x5eedd6={'raw':!![],'where':{'id':_0x2853d2[_0x2b55('0x48')]['id']}},_0x4dbb37={};_0x4dbb37[_0x2b55('0x33')]=_[_0x2b55('0x2f')](db[_0x2b55('0x43')]['rawAttributes']);_0x4dbb37['query']=_[_0x2b55('0x2f')](_0x2853d2[_0x2b55('0x30')]);_0x4dbb37[_0x2b55('0x31')]=_[_0x2b55('0x32')](_0x4dbb37[_0x2b55('0x33')],_0x4dbb37[_0x2b55('0x30')]);_0x5eedd6['attributes']=_[_0x2b55('0x32')](_0x4dbb37['model'],qs['fields'](_0x2853d2[_0x2b55('0x30')][_0x2b55('0x34')]));_0x5eedd6[_0x2b55('0x35')]=_0x5eedd6[_0x2b55('0x35')][_0x2b55('0x36')]?_0x5eedd6[_0x2b55('0x35')]:_0x4dbb37[_0x2b55('0x33')];if(_0x2853d2[_0x2b55('0x30')][_0x2b55('0x41')]){_0x5eedd6['include']=[{'all':!![]}];}_0x5eedd6=_['merge']({},_0x5eedd6,_0x2853d2[_0x2b55('0x49')]);return db['FaxApplication'][_0x2b55('0x4a')](_0x5eedd6)['then'](handleEntityNotFound(_0x5a5e65,null))[_0x2b55('0x26')](respondWithResult(_0x5a5e65,null))[_0x2b55('0x46')](handleError(_0x5a5e65,null));};exports[_0x2b55('0x4b')]=function(_0x262506,_0x33a6e2){return db[_0x2b55('0x43')][_0x2b55('0x4b')](_0x262506[_0x2b55('0x4c')],{})['then'](respondWithResult(_0x33a6e2,0xc9))[_0x2b55('0x46')](handleError(_0x33a6e2,null));};exports[_0x2b55('0x25')]=function(_0x531911,_0x44a6f0){if(_0x531911[_0x2b55('0x4c')]['id']){delete _0x531911[_0x2b55('0x4c')]['id'];}return db['FaxApplication'][_0x2b55('0x4a')]({'where':{'id':_0x531911[_0x2b55('0x48')]['id']}})[_0x2b55('0x26')](handleEntityNotFound(_0x44a6f0,null))[_0x2b55('0x26')](saveUpdates(_0x531911['body'],null))[_0x2b55('0x26')](respondWithResult(_0x44a6f0,null))[_0x2b55('0x46')](handleError(_0x44a6f0,null));};exports[_0x2b55('0x27')]=function(_0x6f8c1d,_0x4d814c){return db[_0x2b55('0x43')][_0x2b55('0x4a')]({'where':{'id':_0x6f8c1d[_0x2b55('0x48')]['id']}})[_0x2b55('0x26')](handleEntityNotFound(_0x4d814c,null))[_0x2b55('0x26')](removeEntity(_0x4d814c,null))[_0x2b55('0x46')](handleError(_0x4d814c,null));}; \ No newline at end of file +var _0x4362=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','rows','show','params','includeAll','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2cb0b7,_0x263a9f){var _0x5366ea=function(_0x43c850){while(--_0x43c850){_0x2cb0b7['push'](_0x2cb0b7['shift']());}};_0x5366ea(++_0x263a9f);}(_0x4362,0x11d));var _0x2436=function(_0xb94e45,_0x519a7c){_0xb94e45=_0xb94e45-0x0;var _0x219d7b=_0x4362[_0xb94e45];return _0x219d7b;};'use strict';var emlformat=require(_0x2436('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2436('0x1'));var jsonpatch=require(_0x2436('0x2'));var rp=require(_0x2436('0x3'));var moment=require(_0x2436('0x4'));var BPromise=require(_0x2436('0x5'));var Mustache=require(_0x2436('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2436('0x7'));var fs=require('fs');var fs_extra=require(_0x2436('0x8'));var _=require(_0x2436('0x9'));var squel=require(_0x2436('0xa'));var crypto=require(_0x2436('0xb'));var jsforce=require(_0x2436('0xc'));var deskjs=require(_0x2436('0xd'));var toCsv=require(_0x2436('0xe'));var querystring=require(_0x2436('0xf'));var Papa=require(_0x2436('0x10'));var Redis=require(_0x2436('0x11'));var authService=require(_0x2436('0x12'));var qs=require(_0x2436('0x13'));var as=require(_0x2436('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2436('0x15'))(_0x2436('0x16'));var utils=require('../../config/utils');var config=require(_0x2436('0x17'));var licenseUtil=require(_0x2436('0x18'));var db=require(_0x2436('0x19'))['db'];function respondWithStatusCode(_0x4500f6,_0x233d77){_0x233d77=_0x233d77||0xcc;return function(_0x34f8f1){if(_0x34f8f1){return _0x4500f6[_0x2436('0x1a')](_0x233d77);}return _0x4500f6['status'](_0x233d77)[_0x2436('0x1b')]();};}function respondWithResult(_0xd96a36,_0x43c757){_0x43c757=_0x43c757||0xc8;return function(_0xa77cef){if(_0xa77cef){return _0xd96a36[_0x2436('0x1c')](_0x43c757)[_0x2436('0x1d')](_0xa77cef);}};}function respondWithFilteredResult(_0x337a7a,_0x220756){return function(_0x280636){if(_0x280636){var _0x3c6169=typeof _0x220756[_0x2436('0x1e')]===_0x2436('0x1f')&&typeof _0x220756[_0x2436('0x20')]===_0x2436('0x1f');var _0x346ef5=_0x280636[_0x2436('0x21')];var _0x1bb63a=_0x3c6169?0x0:_0x220756[_0x2436('0x1e')];var _0x4701f0=_0x3c6169?_0x280636[_0x2436('0x21')]:_0x220756[_0x2436('0x1e')]+_0x220756['limit'];var _0x323ceb;if(_0x4701f0>=_0x346ef5){_0x4701f0=_0x346ef5;_0x323ceb=0xc8;}else{_0x323ceb=0xce;}_0x337a7a[_0x2436('0x1c')](_0x323ceb);return _0x337a7a[_0x2436('0x22')]('Content-Range',_0x1bb63a+'-'+_0x4701f0+'/'+_0x346ef5)['json'](_0x280636);}return null;};}function patchUpdates(_0x196eb7){return function(_0x17437a){try{jsonpatch['apply'](_0x17437a,_0x196eb7,!![]);}catch(_0x31c85f){return BPromise[_0x2436('0x23')](_0x31c85f);}return _0x17437a['save']();};}function saveUpdates(_0x6556d3,_0x33a470){return function(_0x21a9f8){if(_0x21a9f8){return _0x21a9f8[_0x2436('0x24')](_0x6556d3)[_0x2436('0x25')](function(_0xa08b53){return _0xa08b53;});}return null;};}function removeEntity(_0x7879d9,_0x49e5e2){return function(_0x3957e6){if(_0x3957e6){return _0x3957e6[_0x2436('0x26')]()[_0x2436('0x25')](function(){_0x7879d9[_0x2436('0x1c')](0xcc)[_0x2436('0x1b')]();});}};}function handleEntityNotFound(_0x226fc9,_0x5e7bb9){return function(_0x6521ca){if(!_0x6521ca){_0x226fc9[_0x2436('0x1a')](0x194);}return _0x6521ca;};}function handleError(_0x45fc48,_0x553589){_0x553589=_0x553589||0x1f4;return function(_0x37cca8){logger['error'](_0x37cca8['stack']);if(_0x37cca8['name']){delete _0x37cca8['name'];}_0x45fc48['status'](_0x553589)[_0x2436('0x27')](_0x37cca8);};}exports[_0x2436('0x28')]=function(_0x4717f4,_0x1a2962){var _0x236c92={},_0x4ba0e8={},_0x59b89c={'count':0x0,'rows':[]};var _0x59b0a5=_['map'](db[_0x2436('0x29')][_0x2436('0x2a')],function(_0x482c69){return{'name':_0x482c69[_0x2436('0x2b')],'type':_0x482c69[_0x2436('0x2c')][_0x2436('0x2d')]};});_0x4ba0e8[_0x2436('0x2e')]=_['map'](_0x59b0a5,_0x2436('0x2f'));_0x4ba0e8['query']=_[_0x2436('0x30')](_0x4717f4[_0x2436('0x31')]);_0x4ba0e8[_0x2436('0x32')]=_[_0x2436('0x33')](_0x4ba0e8[_0x2436('0x2e')],_0x4ba0e8['query']);_0x236c92['attributes']=_[_0x2436('0x33')](_0x4ba0e8[_0x2436('0x2e')],qs[_0x2436('0x34')](_0x4717f4[_0x2436('0x31')][_0x2436('0x34')]));_0x236c92[_0x2436('0x35')]=_0x236c92[_0x2436('0x35')][_0x2436('0x36')]?_0x236c92[_0x2436('0x35')]:_0x4ba0e8[_0x2436('0x2e')];if(!_0x4717f4[_0x2436('0x31')]['hasOwnProperty'](_0x2436('0x37'))){_0x236c92[_0x2436('0x20')]=qs[_0x2436('0x20')](_0x4717f4[_0x2436('0x31')]['limit']);_0x236c92[_0x2436('0x1e')]=qs[_0x2436('0x1e')](_0x4717f4[_0x2436('0x31')][_0x2436('0x1e')]);}_0x236c92[_0x2436('0x38')]=qs[_0x2436('0x39')](_0x4717f4['query'][_0x2436('0x39')]);_0x236c92['where']=qs['filters'](_[_0x2436('0x3a')](_0x4717f4[_0x2436('0x31')],_0x4ba0e8[_0x2436('0x32')]),_0x59b0a5);if(_0x4717f4[_0x2436('0x31')][_0x2436('0x3b')]){_0x236c92[_0x2436('0x3c')]=_[_0x2436('0x3d')](_0x236c92['where'],{'$or':_[_0x2436('0x3e')](_0x59b0a5,function(_0x236d00){if(_0x236d00[_0x2436('0x2c')]!==_0x2436('0x3f')){var _0x453dd8={};_0x453dd8[_0x236d00[_0x2436('0x2f')]]={'$like':'%'+_0x4717f4[_0x2436('0x31')][_0x2436('0x3b')]+'%'};return _0x453dd8;}})});}_0x236c92=_[_0x2436('0x3d')]({},_0x236c92,_0x4717f4[_0x2436('0x40')]);var _0x150ad5={'where':_0x236c92[_0x2436('0x3c')]};return db[_0x2436('0x29')][_0x2436('0x21')](_0x150ad5)[_0x2436('0x25')](function(_0x9b412c){_0x59b89c['count']=_0x9b412c;if(_0x4717f4[_0x2436('0x31')]['includeAll']){_0x236c92['include']=[{'all':!![]}];}return db[_0x2436('0x29')]['findAll'](_0x236c92);})[_0x2436('0x25')](function(_0x4e13d2){_0x59b89c[_0x2436('0x41')]=_0x4e13d2;return _0x59b89c;})['then'](respondWithFilteredResult(_0x1a2962,_0x236c92))['catch'](handleError(_0x1a2962,null));};exports[_0x2436('0x42')]=function(_0x337fb3,_0x32e81b){var _0x57ee3a={'raw':!![],'where':{'id':_0x337fb3[_0x2436('0x43')]['id']}},_0x256a4e={};_0x256a4e[_0x2436('0x2e')]=_[_0x2436('0x30')](db['FaxApplication']['rawAttributes']);_0x256a4e['query']=_[_0x2436('0x30')](_0x337fb3['query']);_0x256a4e[_0x2436('0x32')]=_[_0x2436('0x33')](_0x256a4e[_0x2436('0x2e')],_0x256a4e[_0x2436('0x31')]);_0x57ee3a['attributes']=_[_0x2436('0x33')](_0x256a4e['model'],qs[_0x2436('0x34')](_0x337fb3[_0x2436('0x31')][_0x2436('0x34')]));_0x57ee3a['attributes']=_0x57ee3a[_0x2436('0x35')][_0x2436('0x36')]?_0x57ee3a[_0x2436('0x35')]:_0x256a4e[_0x2436('0x2e')];if(_0x337fb3[_0x2436('0x31')][_0x2436('0x44')]){_0x57ee3a['include']=[{'all':!![]}];}_0x57ee3a=_[_0x2436('0x3d')]({},_0x57ee3a,_0x337fb3[_0x2436('0x40')]);return db[_0x2436('0x29')][_0x2436('0x45')](_0x57ee3a)[_0x2436('0x25')](handleEntityNotFound(_0x32e81b,null))[_0x2436('0x25')](respondWithResult(_0x32e81b,null))[_0x2436('0x46')](handleError(_0x32e81b,null));};exports[_0x2436('0x47')]=function(_0x5b72ab,_0xcf13b9){return db['FaxApplication']['create'](_0x5b72ab[_0x2436('0x48')],{})[_0x2436('0x25')](respondWithResult(_0xcf13b9,0xc9))[_0x2436('0x46')](handleError(_0xcf13b9,null));};exports[_0x2436('0x24')]=function(_0x38309c,_0x12b5e0){if(_0x38309c[_0x2436('0x48')]['id']){delete _0x38309c[_0x2436('0x48')]['id'];}return db['FaxApplication'][_0x2436('0x45')]({'where':{'id':_0x38309c['params']['id']}})['then'](handleEntityNotFound(_0x12b5e0,null))[_0x2436('0x25')](saveUpdates(_0x38309c[_0x2436('0x48')],null))[_0x2436('0x25')](respondWithResult(_0x12b5e0,null))[_0x2436('0x46')](handleError(_0x12b5e0,null));};exports['destroy']=function(_0x30ef69,_0x204d89){return db[_0x2436('0x29')][_0x2436('0x45')]({'where':{'id':_0x30ef69['params']['id']}})[_0x2436('0x25')](handleEntityNotFound(_0x204d89,null))[_0x2436('0x25')](removeEntity(_0x204d89,null))['catch'](handleError(_0x204d89,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0e4d389..f027768 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 _0xf671=['bluebird','request-promise','rimraf','../../config/environment','exports','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0xf671,0xa4));var _0x1f67=function(_0x22e811,_0x3d83c8){_0x22e811=_0x22e811-0x0;var _0x170a4c=_0xf671[_0x22e811];return _0x170a4c;};'use strict';var _=require(_0x1f67('0x0'));var util=require(_0x1f67('0x1'));var logger=require(_0x1f67('0x2'))(_0x1f67('0x3'));var moment=require('moment');var BPromise=require(_0x1f67('0x4'));var rp=require(_0x1f67('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f67('0x6'));var config=require(_0x1f67('0x7'));var attributes=require('./faxApplication.attributes');module[_0x1f67('0x8')]=function(_0x15a087,_0x1c7342){return _0x15a087['define'](_0x1f67('0x9'),attributes,{'tableName':_0x1f67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f67('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2148=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x2148,0x68));var _0x8214=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x2148[_0x5517c0];return _0x33803b;};'use strict';var _=require(_0x8214('0x0'));var util=require(_0x8214('0x1'));var logger=require(_0x8214('0x2'))(_0x8214('0x3'));var moment=require(_0x8214('0x4'));var BPromise=require(_0x8214('0x5'));var rp=require(_0x8214('0x6'));var fs=require('fs');var path=require(_0x8214('0x7'));var rimraf=require('rimraf');var config=require(_0x8214('0x8'));var attributes=require('./faxApplication.attributes');module[_0x8214('0x9')]=function(_0x2d6dfa,_0x14463a){return _0x2d6dfa[_0x8214('0xa')](_0x8214('0xb'),attributes,{'tableName':_0x8214('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8214('0xd'),'collate':_0x8214('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4e0ef6c..6908ac1 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 _0x2dd1=['jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','where','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2dd1,0x1a9));var _0x12dd=function(_0x40ded2,_0x59ea0e){_0x40ded2=_0x40ded2-0x0;var _0x59a9f6=_0x2dd1[_0x40ded2];return _0x59a9f6;};'use strict';var _=require(_0x12dd('0x0'));var util=require(_0x12dd('0x1'));var moment=require('moment');var BPromise=require(_0x12dd('0x2'));var rs=require(_0x12dd('0x3'));var fs=require('fs');var Redis=require(_0x12dd('0x4'));var db=require(_0x12dd('0x5'))['db'];var utils=require(_0x12dd('0x6'));var logger=require(_0x12dd('0x7'))(_0x12dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x12dd('0x9'));var client=jayson[_0x12dd('0xa')][_0x12dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f4b23,_0x34f0ca,_0x50d040){return new BPromise(function(_0x188710,_0x107e58){return client[_0x12dd('0xc')](_0x1f4b23,_0x50d040)[_0x12dd('0xd')](function(_0x38dd5b){logger[_0x12dd('0xe')](_0x12dd('0xf'),_0x34f0ca,_0x12dd('0x10'));logger[_0x12dd('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x34f0ca,_0x12dd('0x10'),JSON[_0x12dd('0x12')](_0x38dd5b));if(_0x38dd5b[_0x12dd('0x13')]){if(_0x38dd5b[_0x12dd('0x13')][_0x12dd('0x14')]===0x1f4){logger[_0x12dd('0x13')](_0x12dd('0xf'),_0x34f0ca,_0x38dd5b[_0x12dd('0x13')][_0x12dd('0x15')]);return _0x107e58(_0x38dd5b[_0x12dd('0x13')][_0x12dd('0x15')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x34f0ca,_0x38dd5b[_0x12dd('0x13')][_0x12dd('0x15')]);return _0x188710(_0x38dd5b[_0x12dd('0x13')][_0x12dd('0x15')]);}else{logger[_0x12dd('0xe')](_0x12dd('0xf'),_0x34f0ca,_0x12dd('0x10'));_0x188710(_0x38dd5b[_0x12dd('0x16')][_0x12dd('0x15')]);}})['catch'](function(_0x46c348){logger[_0x12dd('0x13')]('FaxApplication,\x20%s,\x20%s',_0x34f0ca,_0x46c348);_0x107e58(_0x46c348);});});}exports[_0x12dd('0x17')]=function(_0x177804){var _0x2c5e0f=this;return new Promise(function(_0x107a2d,_0x12c373){return db[_0x12dd('0x18')]['update'](_0x177804[_0x12dd('0x19')],{'raw':_0x177804[_0x12dd('0x1a')]?_0x177804[_0x12dd('0x1a')][_0x12dd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177804[_0x12dd('0x1a')]?_0x177804[_0x12dd('0x1a')][_0x12dd('0x1c')]||null:null,'attributes':_0x177804[_0x12dd('0x1a')]?_0x177804['options']['attributes']||null:null,'limit':_0x177804[_0x12dd('0x1a')]?_0x177804[_0x12dd('0x1a')][_0x12dd('0x1d')]||null:null})[_0x12dd('0xd')](function(_0x41bf3e){logger[_0x12dd('0xe')](_0x12dd('0x17'),_0x177804);logger[_0x12dd('0x11')](_0x12dd('0x17'),_0x177804,JSON[_0x12dd('0x12')](_0x41bf3e));_0x107a2d(_0x41bf3e);})[_0x12dd('0x1e')](function(_0x48804f){logger[_0x12dd('0x13')](_0x12dd('0x17'),_0x48804f[_0x12dd('0x15')],_0x177804);_0x12c373(_0x2c5e0f['error'](0x1f4,_0x48804f[_0x12dd('0x15')]));});});}; \ No newline at end of file +var _0x41a1=['code','FaxApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','body','options','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x438927,_0x18ec8b){var _0x41f65b=function(_0x2c779d){while(--_0x2c779d){_0x438927['push'](_0x438927['shift']());}};_0x41f65b(++_0x18ec8b);}(_0x41a1,0x107));var _0x141a=function(_0x45dc6b,_0x25321f){_0x45dc6b=_0x45dc6b-0x0;var _0x4535db=_0x41a1[_0x45dc6b];return _0x4535db;};'use strict';var _=require('lodash');var util=require(_0x141a('0x0'));var moment=require(_0x141a('0x1'));var BPromise=require(_0x141a('0x2'));var rs=require(_0x141a('0x3'));var fs=require('fs');var Redis=require(_0x141a('0x4'));var db=require(_0x141a('0x5'))['db'];var utils=require(_0x141a('0x6'));var logger=require(_0x141a('0x7'))(_0x141a('0x8'));var config=require(_0x141a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x141a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x277bbb,_0x23efad,_0x2f26d3){return new BPromise(function(_0x43e3e8,_0x277c4a){return client[_0x141a('0xb')](_0x277bbb,_0x2f26d3)[_0x141a('0xc')](function(_0x2a4bb7){logger[_0x141a('0xd')]('FaxApplication,\x20%s,\x20%s',_0x23efad,'request\x20sent');logger[_0x141a('0xe')](_0x141a('0xf'),_0x23efad,'request\x20sent',JSON['stringify'](_0x2a4bb7));if(_0x2a4bb7[_0x141a('0x10')]){if(_0x2a4bb7['error'][_0x141a('0x11')]===0x1f4){logger['error'](_0x141a('0x12'),_0x23efad,_0x2a4bb7['error'][_0x141a('0x13')]);return _0x277c4a(_0x2a4bb7[_0x141a('0x10')][_0x141a('0x13')]);}logger[_0x141a('0x10')](_0x141a('0x12'),_0x23efad,_0x2a4bb7['error'][_0x141a('0x13')]);return _0x43e3e8(_0x2a4bb7['error']['message']);}else{logger[_0x141a('0xd')](_0x141a('0x12'),_0x23efad,_0x141a('0x14'));_0x43e3e8(_0x2a4bb7[_0x141a('0x15')][_0x141a('0x13')]);}})[_0x141a('0x16')](function(_0x83f3bf){logger[_0x141a('0x10')](_0x141a('0x12'),_0x23efad,_0x83f3bf);_0x277c4a(_0x83f3bf);});});}exports[_0x141a('0x17')]=function(_0x128434){var _0x36591d=this;return new Promise(function(_0x3e76e0,_0x9d2d8a){return db[_0x141a('0x18')]['update'](_0x128434[_0x141a('0x19')],{'raw':_0x128434[_0x141a('0x1a')]?_0x128434[_0x141a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x128434[_0x141a('0x1a')]?_0x128434['options']['where']||null:null,'attributes':_0x128434[_0x141a('0x1a')]?_0x128434[_0x141a('0x1a')]['attributes']||null:null,'limit':_0x128434[_0x141a('0x1a')]?_0x128434['options']['limit']||null:null})['then'](function(_0x3dc042){logger[_0x141a('0xd')](_0x141a('0x17'),_0x128434);logger[_0x141a('0xe')]('UpdateFaxApplication',_0x128434,JSON[_0x141a('0x1b')](_0x3dc042));_0x3e76e0(_0x3dc042);})[_0x141a('0x16')](function(_0x11225d){logger[_0x141a('0x10')](_0x141a('0x17'),_0x11225d['message'],_0x128434);_0x9d2d8a(_0x36591d[_0x141a('0x10')](0x1f4,_0x11225d[_0x141a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 90531d2..1ff32ca 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x284664,_0x455bfa){var _0x2e5d22=function(_0x40f40b){while(--_0x40f40b){_0x284664['push'](_0x284664['shift']());}};_0x2e5d22(++_0x455bfa);}(_0xda2d,0x102));var _0xdda2=function(_0x44f22b,_0x27b6f6){_0x44f22b=_0x44f22b-0x0;var _0x3602fd=_0xda2d[_0x44f22b];return _0x3602fd;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0xf4f4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1867e3,_0x589b2d){_0x1867e3=_0x1867e3-0x0;var _0x4b22aa=_0xf4f4[_0x1867e3];return _0x4b22aa;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./faxApplication.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e541d0b..390a6a5 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 _0x8f4c=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3ab248,_0x1efdbd){var _0x2b7032=function(_0x2b827c){while(--_0x2b827c){_0x3ab248['push'](_0x3ab248['shift']());}};_0x2b7032(++_0x1efdbd);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2acd24,_0xf315ac){_0x2acd24=_0x2acd24-0x0;var _0x546099=_0x8f4c[_0x2acd24];return _0x546099;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'closed':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8f4('0x3')]},'disposition':{'type':Sequelize[_0xc8f4('0x4')]},'secondDisposition':{'type':Sequelize[_0xc8f4('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc8f4('0x4')]},'read1stAt':{'type':Sequelize[_0xc8f4('0x3')]},'fax':{'type':Sequelize[_0xc8f4('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc8f4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc8f4('0x6')]}}; \ No newline at end of file +var _0x4bd3=['sequelize','BOOLEAN','DATE','STRING','out','INTEGER'];(function(_0x3ee251,_0xa53a01){var _0x5bb8f3=function(_0xd54c2d){while(--_0xd54c2d){_0x3ee251['push'](_0x3ee251['shift']());}};_0x5bb8f3(++_0xa53a01);}(_0x4bd3,0x174));var _0x34bd=function(_0x1ee2f7,_0x5012f7){_0x1ee2f7=_0x1ee2f7-0x0;var _0x1360f0=_0x4bd3[_0x1ee2f7];return _0x1360f0;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'closed':{'type':Sequelize[_0x34bd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x34bd('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x34bd('0x3')]},'read1stAt':{'type':Sequelize[_0x34bd('0x2')]},'fax':{'type':Sequelize[_0x34bd('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x34bd('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x34bd('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x34bd('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x34bd('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index de5833e..bc05375 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 _0xe22e=['YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','Tag','color','emit','removeTags','download','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','createReadStream','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','moment','bluebird','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','undefined','count','offset','limit','json','update','then','destroy','end','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','format'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xe22e,0x143));var _0xee22=function(_0x3494e8,_0x4111ea){_0x3494e8=_0x3494e8-0x0;var _0x20bd8c=_0xe22e[_0x3494e8];return _0x20bd8c;};'use strict';var rimraf=require(_0xee22('0x0'));var zipdir=require('zip-dir');var moment=require(_0xee22('0x1'));var BPromise=require(_0xee22('0x2'));var util=require('util');var path=require(_0xee22('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xee22('0x4'));var qs=require(_0xee22('0x5'));var logger=require(_0xee22('0x6'))('api');var config=require('../../config/environment');var db=require(_0xee22('0x7'))['db'];config['redis']=_[_0xee22('0x8')](config[_0xee22('0x9')],{'host':_0xee22('0xa'),'port':0x18eb});var socket=require(_0xee22('0xb'))(new Redis(config['redis']));require(_0xee22('0xc'))[_0xee22('0xd')](socket);function respondWithStatusCode(_0x3a5bd2,_0x20c9fa){_0x20c9fa=_0x20c9fa||0xcc;return function(_0x57ca1f){if(_0x57ca1f){return _0x3a5bd2[_0xee22('0xe')](_0x20c9fa);}return _0x3a5bd2[_0xee22('0xf')](_0x20c9fa)['end']();};}function respondWithResult(_0x3291dd,_0x20cf87){_0x20cf87=_0x20cf87||0xc8;return function(_0x5bda11){if(_0x5bda11){return _0x3291dd[_0xee22('0xf')](_0x20cf87)['json'](_0x5bda11);}};}function respondWithFilteredResult(_0x36c010,_0x4a6224){return function(_0x29cc57){if(_0x29cc57){var _0x4177be=typeof _0x4a6224['offset']==='undefined'&&typeof _0x4a6224['limit']===_0xee22('0x10');var _0x4e410b=_0x29cc57[_0xee22('0x11')];var _0x498f78=_0x4177be?0x0:_0x4a6224[_0xee22('0x12')];var _0x226c41=_0x4177be?_0x29cc57[_0xee22('0x11')]:_0x4a6224[_0xee22('0x12')]+_0x4a6224[_0xee22('0x13')];var _0x578ed3;if(_0x226c41>=_0x4e410b){_0x226c41=_0x4e410b;_0x578ed3=0xc8;}else{_0x578ed3=0xce;}_0x36c010[_0xee22('0xf')](_0x578ed3);return _0x36c010['set']('Content-Range',_0x498f78+'-'+_0x226c41+'/'+_0x4e410b)[_0xee22('0x14')](_0x29cc57);}return null;};}function saveUpdates(_0x1080a3){return function(_0x1aa8b5){if(_0x1aa8b5){return _0x1aa8b5[_0xee22('0x15')](_0x1080a3)[_0xee22('0x16')](function(_0x511265){return _0x511265;});}return null;};}function removeEntity(_0x31904b){return function(_0x49fb2b){if(_0x49fb2b){return _0x49fb2b[_0xee22('0x17')]()[_0xee22('0x16')](function(){_0x31904b['status'](0xcc)[_0xee22('0x18')]();});}};}function handleEntityNotFound(_0x4c676b){return function(_0x54428e){if(!_0x54428e){_0x4c676b['sendStatus'](0x194);}return _0x54428e;};}function handleError(_0x5a6931,_0x4a032b){_0x4a032b=_0x4a032b||0x1f4;return function(_0x3acb48){logger[_0xee22('0x19')](_0x3acb48['stack']);if(_0x3acb48[_0xee22('0x1a')]){delete _0x3acb48['name'];}_0x5a6931['status'](_0x4a032b)[_0xee22('0x1b')](_0x3acb48);};}exports[_0xee22('0x1c')]=function(_0x2d5b34,_0x59acee){var _0xe98a65={};var _0x195a64=_[_0xee22('0x1d')](db[_0xee22('0x1e')][_0xee22('0x1f')],function(_0x436167){return{'name':_0x436167[_0xee22('0x20')],'type':_0x436167['type'][_0xee22('0x21')]};});_0xe98a65=qs[_0xee22('0x22')](_0x195a64,_0x2d5b34);return interaction['findAll']('fax',_0x2d5b34[_0xee22('0x23')],_0x2d5b34[_0xee22('0x24')],_0xe98a65,_0x195a64)[_0xee22('0x16')](respondWithFilteredResult(_0x59acee,_0xe98a65))[_0xee22('0x25')](handleError(_0x59acee,null));};exports[_0xee22('0x26')]=function(_0x2ef339,_0x2ff3fe){var _0x462256={'raw':![],'where':{'id':_0x2ef339['params']['id']}},_0x4c8098={};_0x4c8098[_0xee22('0x27')]=_[_0xee22('0x28')](db['FaxInteraction'][_0xee22('0x1f')]);_0x4c8098[_0xee22('0x23')]=_[_0xee22('0x28')](_0x2ef339['query']);_0x4c8098[_0xee22('0x29')]=_[_0xee22('0x2a')](_0x4c8098[_0xee22('0x27')],_0x4c8098['query']);_0x462256[_0xee22('0x2b')]=_[_0xee22('0x2a')](_0x4c8098[_0xee22('0x27')],qs[_0xee22('0x2c')](_0x2ef339[_0xee22('0x23')]['fields']));_0x462256[_0xee22('0x2b')]=_0x462256['attributes'][_0xee22('0x2d')]?_0x462256[_0xee22('0x2b')]:_0x4c8098[_0xee22('0x27')];if(_0x2ef339[_0xee22('0x23')][_0xee22('0x2e')]){_0x462256[_0xee22('0x2f')]=[{'all':!![]}];}_0x462256=_[_0xee22('0x30')]({},_0x462256,_0x2ef339[_0xee22('0x31')]);return db[_0xee22('0x1e')][_0xee22('0x32')](_0x462256)[_0xee22('0x16')](handleEntityNotFound(_0x2ff3fe,null))[_0xee22('0x16')](respondWithResult(_0x2ff3fe,null))[_0xee22('0x25')](handleError(_0x2ff3fe,null));};exports[_0xee22('0x33')]=function(_0x2e08eb,_0x2ad096){return db[_0xee22('0x1e')][_0xee22('0x33')](_0x2e08eb[_0xee22('0x34')],{})[_0xee22('0x16')](respondWithResult(_0x2ad096,0xc9))[_0xee22('0x25')](handleError(_0x2ad096,null));};exports[_0xee22('0x15')]=function(_0x166c1e,_0x24013d){if(_0x166c1e['body']['id']){delete _0x166c1e[_0xee22('0x34')]['id'];}return db['FaxInteraction'][_0xee22('0x32')]({'where':{'id':_0x166c1e[_0xee22('0x35')]['id']}})[_0xee22('0x16')](handleEntityNotFound(_0x24013d,null))['then'](saveUpdates(_0x166c1e[_0xee22('0x34')],null))[_0xee22('0x16')](respondWithResult(_0x24013d,null))['catch'](handleError(_0x24013d,null));};exports[_0xee22('0x17')]=function(_0x1051c1,_0x53a9db){return db['FaxInteraction']['find']({'where':{'id':_0x1051c1[_0xee22('0x35')]['id']}})[_0xee22('0x16')](handleEntityNotFound(_0x53a9db,null))[_0xee22('0x16')](removeEntity(_0x53a9db,null))[_0xee22('0x25')](handleError(_0x53a9db,null));};exports[_0xee22('0x36')]=function(_0x24fa93,_0x1ea76b){return db['FaxInteraction'][_0xee22('0x36')]()[_0xee22('0x16')](respondWithResult(_0x1ea76b,null))['catch'](handleError(_0x1ea76b,null));};exports[_0xee22('0x37')]=function(_0x106597,_0x2135b7){return db[_0xee22('0x38')][_0xee22('0x32')]({'where':{'id':_0x106597[_0xee22('0x35')]['id']}})[_0xee22('0x16')](handleEntityNotFound(_0x2135b7,null))[_0xee22('0x16')](function(_0x3639d1){if(_0x3639d1){return _0x3639d1[_0xee22('0x37')](_0x106597[_0xee22('0x34')][_0xee22('0x39')],_[_0xee22('0x3a')](_0x106597['body'],[_0xee22('0x39'),'id'])||{});}})[_0xee22('0x16')](respondWithResult(_0x2135b7,null))[_0xee22('0x25')](handleError(_0x2135b7,null));};exports[_0xee22('0x3b')]=function(_0x32fc44,_0x1ac456){var _0x5231f2={'raw':![],'where':{}};var _0x26758a={};var _0x5c9f6c={'count':0x0,'rows':[]};return db[_0xee22('0x1e')]['findOne']({'where':{'id':_0x32fc44['params']['id']}})['then'](handleEntityNotFound(_0x1ac456,null))[_0xee22('0x16')](function(_0x2fd242){if(_0x2fd242){_0x26758a[_0xee22('0x27')]=_[_0xee22('0x28')](db[_0xee22('0x38')][_0xee22('0x1f')]);_0x26758a[_0xee22('0x23')]=_[_0xee22('0x28')](_0x32fc44[_0xee22('0x23')]);_0x26758a[_0xee22('0x29')]=_[_0xee22('0x2a')](_0x26758a['model'],_0x26758a[_0xee22('0x23')]);_0x5231f2[_0xee22('0x2b')]=_['intersection'](_0x26758a['model'],qs[_0xee22('0x2c')](_0x32fc44[_0xee22('0x23')][_0xee22('0x2c')]));_0x5231f2[_0xee22('0x2b')]=_0x5231f2[_0xee22('0x2b')]['length']?_0x5231f2[_0xee22('0x2b')]:_0x26758a[_0xee22('0x27')];if(!_0x32fc44['query'][_0xee22('0x3c')](_0xee22('0x3d'))){_0x5231f2[_0xee22('0x13')]=qs[_0xee22('0x13')](_0x32fc44[_0xee22('0x23')][_0xee22('0x13')]);_0x5231f2['offset']=qs[_0xee22('0x12')](_0x32fc44[_0xee22('0x23')]['offset']);}_0x5231f2['order']=qs[_0xee22('0x3e')](_0x32fc44[_0xee22('0x23')][_0xee22('0x3e')]);_0x5231f2[_0xee22('0x3f')]=qs[_0xee22('0x29')](_[_0xee22('0x40')](_0x32fc44['query'],_0x26758a[_0xee22('0x29')]));_0x5231f2[_0xee22('0x3f')]['FaxInteractionId']=_0x2fd242['id'];if(_0x32fc44[_0xee22('0x23')][_0xee22('0x41')]){_0x5231f2[_0xee22('0x3f')]=_[_0xee22('0x30')](_0x5231f2[_0xee22('0x3f')],{'$or':_[_0xee22('0x1d')](_0x5231f2['attributes'],function(_0x747735){var _0x1a827d={};_0x1a827d[_0x747735]={'$like':'%'+_0x32fc44[_0xee22('0x23')][_0xee22('0x41')]+'%'};return _0x1a827d;})});}if(_0x32fc44[_0xee22('0x23')][_0xee22('0x42')]){var _0x28b6d6=_0x32fc44[_0xee22('0x23')][_0xee22('0x42')][_0xee22('0x43')](',');var _0x5aac33={};_0x5aac33[_0x28b6d6[0x0]]={'$gte':moment(_0x28b6d6[0x1])[_0xee22('0x44')](_0xee22('0x45'))};_0x5231f2['where']=_[_0xee22('0x30')](_0x5231f2[_0xee22('0x3f')],_0x5aac33);}_0x5231f2=_[_0xee22('0x30')]({},_0x5231f2,_0x32fc44[_0xee22('0x31')]);return db[_0xee22('0x38')]['count']({'where':_0x5231f2['where']})[_0xee22('0x16')](function(_0x2abfa3){_0x5c9f6c[_0xee22('0x11')]=_0x2abfa3;if(_0x32fc44[_0xee22('0x23')][_0xee22('0x2e')]){_0x5231f2[_0xee22('0x2f')]=[{'all':!![]}];}return db[_0xee22('0x38')][_0xee22('0x46')](_0x5231f2);})['then'](function(_0x402781){_0x5c9f6c[_0xee22('0x47')]=_0x402781;return _0x5c9f6c;});}})['then'](respondWithFilteredResult(_0x1ac456,_0x5231f2))['catch'](handleError(_0x1ac456,null));};exports[_0xee22('0x48')]=function(_0x5e187c,_0x54ecdc){return db['FaxInteraction']['find']({'where':{'id':_0x5e187c[_0xee22('0x35')]['id']}})[_0xee22('0x16')](handleEntityNotFound(_0x54ecdc,null))['then'](function(_0x524c5b){if(_0x524c5b){return _0x524c5b[_0xee22('0x49')](_0x5e187c['body'][_0xee22('0x39')],_['omit'](_0x5e187c[_0xee22('0x34')],[_0xee22('0x39'),'id'])||{})['spread'](function(){return db[_0xee22('0x4a')]['findAll']({'attributes':['id','name',_0xee22('0x4b')],'where':{'id':_0x5e187c['body'][_0xee22('0x39')]}});})['then'](function(_0x1c2961){socket[_0xee22('0x4c')]('faxInteractionTags:save',{'id':Number(_0x5e187c['params']['id']),'tags':_0x1c2961||[]});return{'id':Number(_0x5e187c[_0xee22('0x35')]['id']),'tags':_0x1c2961||[]};});}})['then'](respondWithResult(_0x54ecdc,null))['catch'](handleError(_0x54ecdc,null));};exports[_0xee22('0x4d')]=function(_0x1d7da2,_0x4df959){return db[_0xee22('0x1e')][_0xee22('0x32')]({'where':{'id':_0x1d7da2['params']['id']}})[_0xee22('0x16')](handleEntityNotFound(_0x4df959,null))[_0xee22('0x16')](function(_0x5e0dff){if(_0x5e0dff){return _0x5e0dff[_0xee22('0x4d')](_0x1d7da2['query'][_0xee22('0x39')]);}})[_0xee22('0x16')](respondWithStatusCode(_0x4df959,null))[_0xee22('0x25')](handleError(_0x4df959,null));};exports[_0xee22('0x4e')]=function(_0x26b138,_0x114e8d){var _0x3fe30d=moment()['unix']()[_0xee22('0x4f')]();var _0x3b30d7=path['join'](config[_0xee22('0x50')],_0xee22('0x51'),_0xee22('0x52'),_0xee22('0x53'));var _0x5c0b44=path[_0xee22('0x54')](config[_0xee22('0x50')],'server',_0xee22('0x52'),_0xee22('0x55'));var _0x48e442=path[_0xee22('0x54')](_0x3b30d7,_0x3fe30d);var _0x4c57f1=util[_0xee22('0x44')](_0xee22('0x56'),_0x26b138[_0xee22('0x35')]['id'],_0x3fe30d);var _0x457172=path[_0xee22('0x54')](_0x3b30d7,_0x4c57f1);var _0x357465=[];_0x357465[_0xee22('0x57')]({'model':db[_0xee22('0x58')],'as':_0xee22('0x58'),'raw':!![]});var _0x14baf7=[{'model':db[_0xee22('0x38')],'as':_0xee22('0x59'),'attributes':['id','body',_0xee22('0x5a')],'include':_0x357465}];return db['FaxInteraction']['find']({'where':{'id':_0x26b138[_0xee22('0x35')]['id']},'include':_0x14baf7})[_0xee22('0x16')](handleEntityNotFound(_0x114e8d,null))[_0xee22('0x16')](function(_0x32e755){if(_0x32e755&&_0x32e755[_0xee22('0x59')]){var _0x5eb90a=_0x32e755['get']({'plain':!![]});fs[_0xee22('0x5b')](_0x48e442);for(var _0x70406f=0x0;_0x70406f<_0x5eb90a[_0xee22('0x59')][_0xee22('0x2d')];_0x70406f++){var _0x3b0c61=_0x5eb90a['Messages'][_0x70406f][_0xee22('0x58')];if(_0x3b0c61){var _0x355b43=path['join'](_0x5c0b44,_0x3b0c61['basename']);if(fs['existsSync'](_0x355b43)){fs[_0xee22('0x5c')](_0x355b43)[_0xee22('0x5d')](fs[_0xee22('0x5e')](path['join'](_0x48e442,_0x3b0c61['basename'])));}}}return BPromise[_0xee22('0x5f')]()[_0xee22('0x16')](function(){return new BPromise(function(_0x1ff5d5,_0x40b25a){zipdir(_0x48e442,{'saveTo':_0x457172},function(_0x12a6c5,_0x4628d5){if(_0x12a6c5)return _0x40b25a(_0x12a6c5);return _0x1ff5d5(_0x4628d5);});})[_0xee22('0x16')](function(){return new BPromise(function(_0x16caae,_0x324063){rimraf(_0x48e442,function(_0x23f16d){if(_0x23f16d)_0x324063(_0x23f16d);return _0x16caae();});});})['then'](function(){return _0x114e8d[_0xee22('0x4e')](_0x457172,_0x4c57f1,function(_0x24a511){if(_0x24a511){console['log'](_0xee22('0x60'),_0x24a511);}else{fs[_0xee22('0x61')](_0x457172);}});});});}else{return _0x114e8d[_0xee22('0xe')](0xc8);}})['catch'](handleError(_0x114e8d,null));}; \ No newline at end of file +var _0x350b=['addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','tmp','files','attachments','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','log','err','unlinkSync','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','show','params','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','describe','addMessage','ids','omit','findOne','FaxMessage','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','include'];(function(_0xf11327,_0x692278){var _0x331cf4=function(_0x336a4e){while(--_0x336a4e){_0xf11327['push'](_0xf11327['shift']());}};_0x331cf4(++_0x692278);}(_0x350b,0x15a));var _0xb350=function(_0x24dded,_0x519e23){_0x24dded=_0x24dded-0x0;var _0x5ea47a=_0x350b[_0x24dded];return _0x5ea47a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb350('0x0'));var moment=require(_0xb350('0x1'));var BPromise=require(_0xb350('0x2'));var util=require('util');var path=require(_0xb350('0x3'));var fs=require('fs');var _=require(_0xb350('0x4'));var Redis=require(_0xb350('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xb350('0x6'));var logger=require('../../config/logger')(_0xb350('0x7'));var config=require(_0xb350('0x8'));var db=require(_0xb350('0x9'))['db'];config[_0xb350('0xa')]=_[_0xb350('0xb')](config[_0xb350('0xa')],{'host':_0xb350('0xc'),'port':0x18eb});var socket=require(_0xb350('0xd'))(new Redis(config[_0xb350('0xa')]));require(_0xb350('0xe'))[_0xb350('0xf')](socket);function respondWithStatusCode(_0x3e900c,_0x53e7ad){_0x53e7ad=_0x53e7ad||0xcc;return function(_0x92110){if(_0x92110){return _0x3e900c[_0xb350('0x10')](_0x53e7ad);}return _0x3e900c[_0xb350('0x11')](_0x53e7ad)[_0xb350('0x12')]();};}function respondWithResult(_0x256ceb,_0xc6552){_0xc6552=_0xc6552||0xc8;return function(_0x24522a){if(_0x24522a){return _0x256ceb[_0xb350('0x11')](_0xc6552)[_0xb350('0x13')](_0x24522a);}};}function respondWithFilteredResult(_0x466248,_0x49bc58){return function(_0xa49dcb){if(_0xa49dcb){var _0x3006d5=typeof _0x49bc58[_0xb350('0x14')]===_0xb350('0x15')&&typeof _0x49bc58[_0xb350('0x16')]===_0xb350('0x15');var _0x1b3825=_0xa49dcb['count'];var _0x2506ed=_0x3006d5?0x0:_0x49bc58[_0xb350('0x14')];var _0x4d50f7=_0x3006d5?_0xa49dcb['count']:_0x49bc58[_0xb350('0x14')]+_0x49bc58['limit'];var _0x5aba86;if(_0x4d50f7>=_0x1b3825){_0x4d50f7=_0x1b3825;_0x5aba86=0xc8;}else{_0x5aba86=0xce;}_0x466248[_0xb350('0x11')](_0x5aba86);return _0x466248[_0xb350('0x17')](_0xb350('0x18'),_0x2506ed+'-'+_0x4d50f7+'/'+_0x1b3825)[_0xb350('0x13')](_0xa49dcb);}return null;};}function saveUpdates(_0x50fd6d){return function(_0x54df0f){if(_0x54df0f){return _0x54df0f[_0xb350('0x19')](_0x50fd6d)[_0xb350('0x1a')](function(_0x3d64f3){return _0x3d64f3;});}return null;};}function removeEntity(_0x366d5a){return function(_0x438a23){if(_0x438a23){return _0x438a23[_0xb350('0x1b')]()[_0xb350('0x1a')](function(){_0x366d5a[_0xb350('0x11')](0xcc)[_0xb350('0x12')]();});}};}function handleEntityNotFound(_0x2da2cb){return function(_0x4d4039){if(!_0x4d4039){_0x2da2cb[_0xb350('0x10')](0x194);}return _0x4d4039;};}function handleError(_0x5954e5,_0x513f59){_0x513f59=_0x513f59||0x1f4;return function(_0x5b8aef){logger[_0xb350('0x1c')](_0x5b8aef[_0xb350('0x1d')]);if(_0x5b8aef['name']){delete _0x5b8aef[_0xb350('0x1e')];}_0x5954e5[_0xb350('0x11')](_0x513f59)[_0xb350('0x1f')](_0x5b8aef);};}exports[_0xb350('0x20')]=function(_0x18bc26,_0x3f9e4a){var _0x1a4873={};var _0x4302b9=_[_0xb350('0x21')](db['FaxInteraction'][_0xb350('0x22')],function(_0x4b60fb){return{'name':_0x4b60fb[_0xb350('0x23')],'type':_0x4b60fb[_0xb350('0x24')][_0xb350('0x25')]};});_0x1a4873=qs[_0xb350('0x26')](_0x4302b9,_0x18bc26);return interaction[_0xb350('0x27')](_0xb350('0x28'),_0x18bc26[_0xb350('0x29')],_0x18bc26[_0xb350('0x2a')],_0x1a4873,_0x4302b9)['then'](respondWithFilteredResult(_0x3f9e4a,_0x1a4873))['catch'](handleError(_0x3f9e4a,null));};exports[_0xb350('0x2b')]=function(_0xe21aaf,_0x1cd876){var _0x5ebecd={'raw':![],'where':{'id':_0xe21aaf[_0xb350('0x2c')]['id']}},_0x286cbe={};_0x286cbe[_0xb350('0x2d')]=_[_0xb350('0x2e')](db[_0xb350('0x2f')][_0xb350('0x22')]);_0x286cbe[_0xb350('0x29')]=_[_0xb350('0x2e')](_0xe21aaf[_0xb350('0x29')]);_0x286cbe[_0xb350('0x30')]=_[_0xb350('0x31')](_0x286cbe[_0xb350('0x2d')],_0x286cbe[_0xb350('0x29')]);_0x5ebecd[_0xb350('0x32')]=_[_0xb350('0x31')](_0x286cbe[_0xb350('0x2d')],qs[_0xb350('0x33')](_0xe21aaf[_0xb350('0x29')][_0xb350('0x33')]));_0x5ebecd[_0xb350('0x32')]=_0x5ebecd[_0xb350('0x32')][_0xb350('0x34')]?_0x5ebecd[_0xb350('0x32')]:_0x286cbe[_0xb350('0x2d')];if(_0xe21aaf[_0xb350('0x29')][_0xb350('0x35')]){_0x5ebecd['include']=[{'all':!![]}];}_0x5ebecd=_[_0xb350('0x36')]({},_0x5ebecd,_0xe21aaf[_0xb350('0x37')]);return db[_0xb350('0x2f')][_0xb350('0x38')](_0x5ebecd)[_0xb350('0x1a')](handleEntityNotFound(_0x1cd876,null))[_0xb350('0x1a')](respondWithResult(_0x1cd876,null))[_0xb350('0x39')](handleError(_0x1cd876,null));};exports[_0xb350('0x3a')]=function(_0x2a24ec,_0x58bacc){return db[_0xb350('0x2f')][_0xb350('0x3a')](_0x2a24ec['body'],{})[_0xb350('0x1a')](respondWithResult(_0x58bacc,0xc9))[_0xb350('0x39')](handleError(_0x58bacc,null));};exports[_0xb350('0x19')]=function(_0x4a9c87,_0x225860){if(_0x4a9c87[_0xb350('0x3b')]['id']){delete _0x4a9c87['body']['id'];}return db['FaxInteraction'][_0xb350('0x38')]({'where':{'id':_0x4a9c87['params']['id']}})[_0xb350('0x1a')](handleEntityNotFound(_0x225860,null))[_0xb350('0x1a')](saveUpdates(_0x4a9c87[_0xb350('0x3b')],null))[_0xb350('0x1a')](respondWithResult(_0x225860,null))['catch'](handleError(_0x225860,null));};exports[_0xb350('0x1b')]=function(_0x4291ca,_0x4e2a5a){return db[_0xb350('0x2f')][_0xb350('0x38')]({'where':{'id':_0x4291ca[_0xb350('0x2c')]['id']}})[_0xb350('0x1a')](handleEntityNotFound(_0x4e2a5a,null))['then'](removeEntity(_0x4e2a5a,null))['catch'](handleError(_0x4e2a5a,null));};exports[_0xb350('0x3c')]=function(_0x3499de,_0x423b0f){return db[_0xb350('0x2f')][_0xb350('0x3c')]()[_0xb350('0x1a')](respondWithResult(_0x423b0f,null))[_0xb350('0x39')](handleError(_0x423b0f,null));};exports[_0xb350('0x3d')]=function(_0x11f3ab,_0x32fe54){return db['FaxMessage']['find']({'where':{'id':_0x11f3ab[_0xb350('0x2c')]['id']}})[_0xb350('0x1a')](handleEntityNotFound(_0x32fe54,null))[_0xb350('0x1a')](function(_0x233778){if(_0x233778){return _0x233778[_0xb350('0x3d')](_0x11f3ab['body'][_0xb350('0x3e')],_[_0xb350('0x3f')](_0x11f3ab[_0xb350('0x3b')],[_0xb350('0x3e'),'id'])||{});}})[_0xb350('0x1a')](respondWithResult(_0x32fe54,null))[_0xb350('0x39')](handleError(_0x32fe54,null));};exports['getMessages']=function(_0x32473c,_0x385739){var _0x28b38d={'raw':![],'where':{}};var _0xfbcb57={};var _0xf148c5={'count':0x0,'rows':[]};return db[_0xb350('0x2f')][_0xb350('0x40')]({'where':{'id':_0x32473c[_0xb350('0x2c')]['id']}})[_0xb350('0x1a')](handleEntityNotFound(_0x385739,null))[_0xb350('0x1a')](function(_0xf5f654){if(_0xf5f654){_0xfbcb57[_0xb350('0x2d')]=_[_0xb350('0x2e')](db[_0xb350('0x41')][_0xb350('0x22')]);_0xfbcb57[_0xb350('0x29')]=_[_0xb350('0x2e')](_0x32473c['query']);_0xfbcb57[_0xb350('0x30')]=_[_0xb350('0x31')](_0xfbcb57['model'],_0xfbcb57['query']);_0x28b38d[_0xb350('0x32')]=_[_0xb350('0x31')](_0xfbcb57[_0xb350('0x2d')],qs[_0xb350('0x33')](_0x32473c[_0xb350('0x29')]['fields']));_0x28b38d[_0xb350('0x32')]=_0x28b38d['attributes'][_0xb350('0x34')]?_0x28b38d[_0xb350('0x32')]:_0xfbcb57[_0xb350('0x2d')];if(!_0x32473c[_0xb350('0x29')][_0xb350('0x42')](_0xb350('0x43'))){_0x28b38d['limit']=qs[_0xb350('0x16')](_0x32473c[_0xb350('0x29')][_0xb350('0x16')]);_0x28b38d['offset']=qs[_0xb350('0x14')](_0x32473c[_0xb350('0x29')][_0xb350('0x14')]);}_0x28b38d[_0xb350('0x44')]=qs[_0xb350('0x45')](_0x32473c[_0xb350('0x29')]['sort']);_0x28b38d[_0xb350('0x46')]=qs['filters'](_['pick'](_0x32473c['query'],_0xfbcb57['filters']));_0x28b38d[_0xb350('0x46')][_0xb350('0x47')]=_0xf5f654['id'];if(_0x32473c[_0xb350('0x29')][_0xb350('0x48')]){_0x28b38d[_0xb350('0x46')]=_[_0xb350('0x36')](_0x28b38d['where'],{'$or':_[_0xb350('0x21')](_0x28b38d[_0xb350('0x32')],function(_0x4487d6){var _0x139957={};_0x139957[_0x4487d6]={'$like':'%'+_0x32473c['query'][_0xb350('0x48')]+'%'};return _0x139957;})});}if(_0x32473c[_0xb350('0x29')][_0xb350('0x49')]){var _0x12f37e=_0x32473c[_0xb350('0x29')][_0xb350('0x49')]['split'](',');var _0x2632cd={};_0x2632cd[_0x12f37e[0x0]]={'$gte':moment(_0x12f37e[0x1])[_0xb350('0x4a')](_0xb350('0x4b'))};_0x28b38d[_0xb350('0x46')]=_[_0xb350('0x36')](_0x28b38d[_0xb350('0x46')],_0x2632cd);}_0x28b38d=_[_0xb350('0x36')]({},_0x28b38d,_0x32473c['options']);return db['FaxMessage'][_0xb350('0x4c')]({'where':_0x28b38d[_0xb350('0x46')]})[_0xb350('0x1a')](function(_0x223dce){_0xf148c5[_0xb350('0x4c')]=_0x223dce;if(_0x32473c[_0xb350('0x29')][_0xb350('0x35')]){_0x28b38d[_0xb350('0x4d')]=[{'all':!![]}];}return db[_0xb350('0x41')]['findAll'](_0x28b38d);})[_0xb350('0x1a')](function(_0x4cce11){_0xf148c5['rows']=_0x4cce11;return _0xf148c5;});}})[_0xb350('0x1a')](respondWithFilteredResult(_0x385739,_0x28b38d))[_0xb350('0x39')](handleError(_0x385739,null));};exports[_0xb350('0x4e')]=function(_0x1f189c,_0x5c4e65){return db[_0xb350('0x2f')]['find']({'where':{'id':_0x1f189c[_0xb350('0x2c')]['id']}})[_0xb350('0x1a')](handleEntityNotFound(_0x5c4e65,null))['then'](function(_0x4ea213){if(_0x4ea213){return _0x4ea213[_0xb350('0x4f')](_0x1f189c[_0xb350('0x3b')][_0xb350('0x3e')],_[_0xb350('0x3f')](_0x1f189c[_0xb350('0x3b')],[_0xb350('0x3e'),'id'])||{})[_0xb350('0x50')](function(){return db[_0xb350('0x51')][_0xb350('0x27')]({'attributes':['id','name',_0xb350('0x52')],'where':{'id':_0x1f189c['body'][_0xb350('0x3e')]}});})[_0xb350('0x1a')](function(_0x502d4e){socket[_0xb350('0x53')]('faxInteractionTags:save',{'id':Number(_0x1f189c[_0xb350('0x2c')]['id']),'tags':_0x502d4e||[]});return{'id':Number(_0x1f189c[_0xb350('0x2c')]['id']),'tags':_0x502d4e||[]};});}})['then'](respondWithResult(_0x5c4e65,null))['catch'](handleError(_0x5c4e65,null));};exports[_0xb350('0x54')]=function(_0x3620bd,_0x159f15){return db[_0xb350('0x2f')][_0xb350('0x38')]({'where':{'id':_0x3620bd[_0xb350('0x2c')]['id']}})[_0xb350('0x1a')](handleEntityNotFound(_0x159f15,null))[_0xb350('0x1a')](function(_0x5e7c36){if(_0x5e7c36){return _0x5e7c36[_0xb350('0x54')](_0x3620bd[_0xb350('0x29')][_0xb350('0x3e')]);}})['then'](respondWithStatusCode(_0x159f15,null))['catch'](handleError(_0x159f15,null));};exports[_0xb350('0x55')]=function(_0x2b7064,_0x430dd5){var _0x214902=moment()[_0xb350('0x56')]()['toString']();var _0x4f790b=path[_0xb350('0x57')](config[_0xb350('0x58')],_0xb350('0x59'),'files',_0xb350('0x5a'));var _0x2a67cd=path[_0xb350('0x57')](config[_0xb350('0x58')],_0xb350('0x59'),_0xb350('0x5b'),_0xb350('0x5c'));var _0xc8b774=path['join'](_0x4f790b,_0x214902);var _0x479b82=util[_0xb350('0x4a')]('transcript-%d-%s.zip',_0x2b7064[_0xb350('0x2c')]['id'],_0x214902);var _0x5b2a8d=path[_0xb350('0x57')](_0x4f790b,_0x479b82);var _0x23bf1d=[];_0x23bf1d[_0xb350('0x5d')]({'model':db[_0xb350('0x5e')],'as':_0xb350('0x5e'),'raw':!![]});var _0x5e1d6b=[{'model':db[_0xb350('0x41')],'as':_0xb350('0x5f'),'attributes':['id','body',_0xb350('0x60')],'include':_0x23bf1d}];return db[_0xb350('0x2f')]['find']({'where':{'id':_0x2b7064[_0xb350('0x2c')]['id']},'include':_0x5e1d6b})[_0xb350('0x1a')](handleEntityNotFound(_0x430dd5,null))['then'](function(_0x1e4c41){if(_0x1e4c41&&_0x1e4c41[_0xb350('0x5f')]){var _0x49f2b1=_0x1e4c41['get']({'plain':!![]});fs[_0xb350('0x61')](_0xc8b774);for(var _0x58c22f=0x0;_0x58c22f<_0x49f2b1['Messages'][_0xb350('0x34')];_0x58c22f++){var _0x265062=_0x49f2b1[_0xb350('0x5f')][_0x58c22f][_0xb350('0x5e')];if(_0x265062){var _0x51fa97=path['join'](_0x2a67cd,_0x265062[_0xb350('0x62')]);if(fs[_0xb350('0x63')](_0x51fa97)){fs[_0xb350('0x64')](_0x51fa97)[_0xb350('0x65')](fs['createWriteStream'](path[_0xb350('0x57')](_0xc8b774,_0x265062[_0xb350('0x62')])));}}}return BPromise[_0xb350('0x66')]()[_0xb350('0x1a')](function(){return new BPromise(function(_0x341bbf,_0x5d385c){zipdir(_0xc8b774,{'saveTo':_0x5b2a8d},function(_0x107758,_0x38e4e0){if(_0x107758)return _0x5d385c(_0x107758);return _0x341bbf(_0x38e4e0);});})[_0xb350('0x1a')](function(){return new BPromise(function(_0x5676fe,_0x25a6d5){rimraf(_0xc8b774,function(_0x276e10){if(_0x276e10)_0x25a6d5(_0x276e10);return _0x5676fe();});});})[_0xb350('0x1a')](function(){return _0x430dd5[_0xb350('0x55')](_0x5b2a8d,_0x479b82,function(_0x485410){if(_0x485410){console[_0xb350('0x67')](_0xb350('0x68'),_0x485410);}else{fs[_0xb350('0x69')](_0x5b2a8d);}});});});}else{return _0x430dd5['sendStatus'](0xc8);}})[_0xb350('0x39')](handleError(_0x430dd5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0e82a91..9f36d29 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 _0x7435=['setDataValue','map','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x2b709b,_0x3395f8){var _0x4528fb=function(_0x10fa8c){while(--_0x10fa8c){_0x2b709b['push'](_0x2b709b['shift']());}};_0x4528fb(++_0x3395f8);}(_0x7435,0x1e9));var _0x5743=function(_0x469708,_0x3dabdd){_0x469708=_0x469708-0x0;var _0x12e7e9=_0x7435[_0x469708];return _0x12e7e9;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x5743('0x0')];var FaxMessage=require(_0x5743('0x1'))['db'][_0x5743('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5743('0x3')](0x0);var events={'afterCreate':_0x5743('0x4'),'afterUpdate':_0x5743('0x5'),'afterDestroy':_0x5743('0x6')};function emitEvent(_0x21d90d){return function(_0x1bc750,_0x3ee6c8,_0x56cfb8){_0x1bc750['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3a910a){_0x1bc750[_0x5743('0x7')]('Users',_0x3a910a[_0x5743('0x8')](function(_0x5eaad5){return{'id':_0x5eaad5['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1bc750['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5743('0x9')](function(_0xf8c3ad){_0x1bc750['setDataValue'](_0x5743('0xa'),_0xf8c3ad[_0x5743('0xb')]);FaxInteractionEvents[_0x5743('0xc')](_0x21d90d+':'+_0x1bc750['id'],_0x1bc750);FaxInteractionEvents[_0x5743('0xc')](_0x21d90d,_0x1bc750);_0x56cfb8(null);})[_0x5743('0xd')](_0x56cfb8(null));};}for(var e in events){if(events[_0x5743('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5743('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x264b=['FaxMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x264b,0x179));var _0xb264=function(_0x545ce6,_0x3bd8af){_0x545ce6=_0x545ce6-0x0;var _0x252f5d=_0x264b[_0x545ce6];return _0x252f5d;};'use strict';var EventEmitter=require(_0xb264('0x0'));var FaxInteraction=require(_0xb264('0x1'))['db'][_0xb264('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xb264('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb264('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb264('0x5'),'afterDestroy':_0xb264('0x6')};function emitEvent(_0x41a4d3){return function(_0x4c0f44,_0xcdde8c,_0x4307d0){_0x4c0f44[_0xb264('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1c6d79){_0x4c0f44[_0xb264('0x8')](_0xb264('0x9'),_0x1c6d79[_0xb264('0xa')](function(_0x5eb2ad){return{'id':_0x5eb2ad['id']};}));return FaxMessage[_0xb264('0xb')]({'where':{'FaxInteractionId':_0x4c0f44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb264('0xc')](function(_0x5e84e3){_0x4c0f44[_0xb264('0x8')](_0xb264('0xd'),_0x5e84e3[_0xb264('0xe')]);FaxInteractionEvents[_0xb264('0xf')](_0x41a4d3+':'+_0x4c0f44['id'],_0x4c0f44);FaxInteractionEvents[_0xb264('0xf')](_0x41a4d3,_0x4c0f44);_0x4307d0(null);})['catch'](_0x4307d0(null));};}for(var e in events){if(events[_0xb264('0x10')](e)){var event=events[e];FaxInteraction[_0xb264('0x11')](e,emitEvent(event));}}module[_0xb264('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index d6892ff..66a6144 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 _0xf3f0=['bluebird','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0xf3f0,0x1bc));var _0x0f3f=function(_0x284246,_0x2a1917){_0x284246=_0x284246-0x0;var _0x211060=_0xf3f0[_0x284246];return _0x211060;};'use strict';var _=require(_0x0f3f('0x0'));var util=require(_0x0f3f('0x1'));var logger=require('../../config/logger')(_0x0f3f('0x2'));var moment=require(_0x0f3f('0x3'));var BPromise=require(_0x0f3f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f3f('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f3f('0x6'));module[_0x0f3f('0x7')]=function(_0x432e71,_0x3c7e16){return _0x432e71[_0x0f3f('0x8')](_0x0f3f('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x354d03,_0x4060f1,_0x3112f5){if(_0x354d03[_0x0f3f('0xa')](_0x0f3f('0xb'))){_0x354d03['closedAt']=moment()[_0x0f3f('0xc')](_0x0f3f('0xd'));}_0x3112f5(null,_0x354d03);}}});}; \ No newline at end of file +var _0xfd33=['bluebird','request-promise','path','../../config/environment','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x52ff60,_0x3eccef){var _0x2f5846=function(_0xc6fccc){while(--_0xc6fccc){_0x52ff60['push'](_0x52ff60['shift']());}};_0x2f5846(++_0x3eccef);}(_0xfd33,0x154));var _0x3fd3=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xfd33[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x3fd3('0x0'));var util=require(_0x3fd3('0x1'));var logger=require(_0x3fd3('0x2'))(_0x3fd3('0x3'));var moment=require(_0x3fd3('0x4'));var BPromise=require(_0x3fd3('0x5'));var rp=require(_0x3fd3('0x6'));var fs=require('fs');var path=require(_0x3fd3('0x7'));var rimraf=require('rimraf');var config=require(_0x3fd3('0x8'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x34f657,_0x50e459){return _0x34f657[_0x3fd3('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4580c6,_0x9c5e43,_0x4e7f04){if(_0x4580c6[_0x3fd3('0xa')](_0x3fd3('0xb'))){_0x4580c6[_0x3fd3('0xc')]=moment()[_0x3fd3('0xd')](_0x3fd3('0xe'));}_0x4e7f04(null,_0x4580c6);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 33f4c0d..8af1a04 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 _0x3faf=['info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','catch','FaxInteraction','update','options','raw','limit','UpdateFaxInteraction','stringify','find','where','addTags','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0x3faf,0x144));var _0xf3fa=function(_0x584469,_0x287bf4){_0x584469=_0x584469-0x0;var _0x1ceeec=_0x3faf[_0x584469];return _0x1ceeec;};'use strict';var _=require(_0xf3fa('0x0'));var util=require(_0xf3fa('0x1'));var moment=require(_0xf3fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3fa('0x3'));var fs=require('fs');var Redis=require(_0xf3fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3fa('0x5'));var logger=require(_0xf3fa('0x6'))(_0xf3fa('0x7'));var config=require(_0xf3fa('0x8'));var jayson=require(_0xf3fa('0x9'));var client=jayson[_0xf3fa('0xa')][_0xf3fa('0xb')]({'port':0x232a});config[_0xf3fa('0xc')]=_[_0xf3fa('0xd')](config[_0xf3fa('0xc')],{'host':_0xf3fa('0xe'),'port':0x18eb});var socket=require(_0xf3fa('0xf'))(new Redis(config[_0xf3fa('0xc')]));require(_0xf3fa('0x10'))[_0xf3fa('0x11')](socket);function respondWithRpcPromise(_0x53d8f0,_0x2e2c40,_0x4706ae){return new BPromise(function(_0xd0b9a7,_0x2c345b){return client[_0xf3fa('0x12')](_0x53d8f0,_0x4706ae)[_0xf3fa('0x13')](function(_0x37965f){logger[_0xf3fa('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x2e2c40,_0xf3fa('0x15'));logger[_0xf3fa('0x16')](_0xf3fa('0x17'),_0x2e2c40,_0xf3fa('0x15'),JSON['stringify'](_0x37965f));if(_0x37965f[_0xf3fa('0x18')]){if(_0x37965f[_0xf3fa('0x18')][_0xf3fa('0x19')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2e2c40,_0x37965f[_0xf3fa('0x18')][_0xf3fa('0x1a')]);return _0x2c345b(_0x37965f[_0xf3fa('0x18')][_0xf3fa('0x1a')]);}logger['error'](_0xf3fa('0x1b'),_0x2e2c40,_0x37965f[_0xf3fa('0x18')][_0xf3fa('0x1a')]);return _0xd0b9a7(_0x37965f[_0xf3fa('0x18')][_0xf3fa('0x1a')]);}else{logger[_0xf3fa('0x14')](_0xf3fa('0x1b'),_0x2e2c40,_0xf3fa('0x15'));_0xd0b9a7(_0x37965f['result'][_0xf3fa('0x1a')]);}})[_0xf3fa('0x1c')](function(_0x3f7011){logger[_0xf3fa('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x2e2c40,_0x3f7011);_0x2c345b(_0x3f7011);});});}exports['UpdateFaxInteraction']=function(_0x75dfb1){var _0xb2ab43=this;return new Promise(function(_0x5d1e8f,_0x4a2272){return db[_0xf3fa('0x1d')][_0xf3fa('0x1e')](_0x75dfb1['body'],{'raw':_0x75dfb1[_0xf3fa('0x1f')]?_0x75dfb1[_0xf3fa('0x1f')][_0xf3fa('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x75dfb1[_0xf3fa('0x1f')]?_0x75dfb1[_0xf3fa('0x1f')]['where']||null:null,'attributes':_0x75dfb1[_0xf3fa('0x1f')]?_0x75dfb1[_0xf3fa('0x1f')]['attributes']||null:null,'limit':_0x75dfb1['options']?_0x75dfb1[_0xf3fa('0x1f')][_0xf3fa('0x21')]||null:null})[_0xf3fa('0x13')](function(_0x900652){logger[_0xf3fa('0x14')](_0xf3fa('0x22'),_0x75dfb1);logger[_0xf3fa('0x16')]('UpdateFaxInteraction',_0x75dfb1,JSON[_0xf3fa('0x23')](_0x900652));_0x5d1e8f(_0x900652);})[_0xf3fa('0x1c')](function(_0x3c3681){logger['error'](_0xf3fa('0x22'),_0x3c3681[_0xf3fa('0x1a')],_0x75dfb1);_0x4a2272(_0xb2ab43[_0xf3fa('0x18')](0x1f4,_0x3c3681[_0xf3fa('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x8e6a99){return new Promise(function(_0x219267,_0x3a00fd){return db[_0xf3fa('0x1d')][_0xf3fa('0x24')]({'where':_0x8e6a99[_0xf3fa('0x1f')]?_0x8e6a99[_0xf3fa('0x1f')][_0xf3fa('0x25')]||null:null})[_0xf3fa('0x13')](function(_0x4351f1){if(_0x4351f1){return _0x4351f1[_0xf3fa('0x26')](_0x8e6a99[_0xf3fa('0x27')][_0xf3fa('0x28')],_['omit'](_0x8e6a99['body'],['ids','id'])||{});}})[_0xf3fa('0x29')](function(_0x477fcf){logger[_0xf3fa('0x14')](_0xf3fa('0x2a'),_0x8e6a99);logger[_0xf3fa('0x16')]('AddTags',_0x8e6a99,JSON[_0xf3fa('0x23')](_0x477fcf));_0x219267(_0x477fcf);})[_0xf3fa('0x1c')](function(_0x542469){logger[_0xf3fa('0x18')]('AddTags',_0x542469[_0xf3fa('0x1a')],_0x8e6a99);_0x3a00fd(_this[_0xf3fa('0x18')](0x1f4,_0x542469[_0xf3fa('0x1a')]));});});}; \ No newline at end of file +var _0x25fd=['where','attributes','limit','then','info','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./faxInteraction.socket','request','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options'];(function(_0x342a03,_0x494f8d){var _0x3219c2=function(_0x3900a1){while(--_0x3900a1){_0x342a03['push'](_0x342a03['shift']());}};_0x3219c2(++_0x494f8d);}(_0x25fd,0x1f1));var _0xd25f=function(_0x7d3e40,_0x2e6e6){_0x7d3e40=_0x7d3e40-0x0;var _0x5b011a=_0x25fd[_0x7d3e40];return _0x5b011a;};'use strict';var _=require(_0xd25f('0x0'));var util=require(_0xd25f('0x1'));var moment=require(_0xd25f('0x2'));var BPromise=require(_0xd25f('0x3'));var rs=require(_0xd25f('0x4'));var fs=require('fs');var Redis=require(_0xd25f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd25f('0x6'));var logger=require(_0xd25f('0x7'))(_0xd25f('0x8'));var config=require(_0xd25f('0x9'));var jayson=require(_0xd25f('0xa'));var client=jayson[_0xd25f('0xb')][_0xd25f('0xc')]({'port':0x232a});config['redis']=_[_0xd25f('0xd')](config[_0xd25f('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd25f('0xe')]));require(_0xd25f('0xf'))['register'](socket);function respondWithRpcPromise(_0xc4aa60,_0x529a1b,_0x40648d){return new BPromise(function(_0x5086ab,_0x703657){return client[_0xd25f('0x10')](_0xc4aa60,_0x40648d)['then'](function(_0x4705a8){logger['info'](_0xd25f('0x11'),_0x529a1b,'request\x20sent');logger['debug'](_0xd25f('0x12'),_0x529a1b,_0xd25f('0x13'),JSON[_0xd25f('0x14')](_0x4705a8));if(_0x4705a8[_0xd25f('0x15')]){if(_0x4705a8[_0xd25f('0x15')][_0xd25f('0x16')]===0x1f4){logger['error'](_0xd25f('0x11'),_0x529a1b,_0x4705a8[_0xd25f('0x15')][_0xd25f('0x17')]);return _0x703657(_0x4705a8['error'][_0xd25f('0x17')]);}logger['error'](_0xd25f('0x11'),_0x529a1b,_0x4705a8['error']['message']);return _0x5086ab(_0x4705a8[_0xd25f('0x15')][_0xd25f('0x17')]);}else{logger['info'](_0xd25f('0x11'),_0x529a1b,_0xd25f('0x13'));_0x5086ab(_0x4705a8['result'][_0xd25f('0x17')]);}})[_0xd25f('0x18')](function(_0x1df3c4){logger[_0xd25f('0x15')](_0xd25f('0x11'),_0x529a1b,_0x1df3c4);_0x703657(_0x1df3c4);});});}exports[_0xd25f('0x19')]=function(_0x1ddda9){var _0x2667a8=this;return new Promise(function(_0x51699f,_0x5225d8){return db[_0xd25f('0x1a')][_0xd25f('0x1b')](_0x1ddda9[_0xd25f('0x1c')],{'raw':_0x1ddda9['options']?_0x1ddda9['options'][_0xd25f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ddda9[_0xd25f('0x1e')]?_0x1ddda9[_0xd25f('0x1e')][_0xd25f('0x1f')]||null:null,'attributes':_0x1ddda9[_0xd25f('0x1e')]?_0x1ddda9[_0xd25f('0x1e')][_0xd25f('0x20')]||null:null,'limit':_0x1ddda9[_0xd25f('0x1e')]?_0x1ddda9[_0xd25f('0x1e')][_0xd25f('0x21')]||null:null})[_0xd25f('0x22')](function(_0x14e31e){logger[_0xd25f('0x23')](_0xd25f('0x19'),_0x1ddda9);logger['debug'](_0xd25f('0x19'),_0x1ddda9,JSON['stringify'](_0x14e31e));_0x51699f(_0x14e31e);})[_0xd25f('0x18')](function(_0x417045){logger[_0xd25f('0x15')](_0xd25f('0x19'),_0x417045[_0xd25f('0x17')],_0x1ddda9);_0x5225d8(_0x2667a8['error'](0x1f4,_0x417045[_0xd25f('0x17')]));});});};exports[_0xd25f('0x24')]=function(_0x267673){return new Promise(function(_0x3eae36,_0x280eec){return db[_0xd25f('0x1a')][_0xd25f('0x25')]({'where':_0x267673[_0xd25f('0x1e')]?_0x267673[_0xd25f('0x1e')][_0xd25f('0x1f')]||null:null})['then'](function(_0x3fd10f){if(_0x3fd10f){return _0x3fd10f[_0xd25f('0x26')](_0x267673[_0xd25f('0x1c')][_0xd25f('0x27')],_[_0xd25f('0x28')](_0x267673['body'],[_0xd25f('0x27'),'id'])||{});}})[_0xd25f('0x29')](function(_0x515c55){logger[_0xd25f('0x23')](_0xd25f('0x2a'),_0x267673);logger[_0xd25f('0x2b')](_0xd25f('0x2a'),_0x267673,JSON[_0xd25f('0x14')](_0x515c55));_0x3eae36(_0x515c55);})['catch'](function(_0x2e4c9b){logger[_0xd25f('0x15')](_0xd25f('0x2a'),_0x2e4c9b[_0xd25f('0x17')],_0x267673);_0x280eec(_this[_0xd25f('0x15')](0x1f4,_0x2e4c9b[_0xd25f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 19a572f..125dcd7 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 _0x8896=['length','faxInteraction:','remove','update','removeListener','register'];(function(_0x461420,_0x58ec23){var _0x2e9c40=function(_0x39050f){while(--_0x39050f){_0x461420['push'](_0x461420['shift']());}};_0x2e9c40(++_0x58ec23);}(_0x8896,0x1d0));var _0x6889=function(_0x4f890c,_0x5f0d98){_0x4f890c=_0x4f890c-0x0;var _0x53cc03=_0x8896[_0x4f890c];return _0x53cc03;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x6889('0x0'),_0x6889('0x1')];function createListener(_0x63b8ce,_0x564a5e){return function(_0x41b320){_0x564a5e['emit'](_0x63b8ce,_0x41b320);};}function removeListener(_0x2216ce,_0x1e23a2){return function(){FaxInteractionEvents[_0x6889('0x2')](_0x2216ce,_0x1e23a2);};}exports[_0x6889('0x3')]=function(_0x259da9){for(var _0x2b508a=0x0,_0x330182=events[_0x6889('0x4')];_0x2b508a<_0x330182;_0x2b508a++){var _0x12065a=events[_0x2b508a];var _0x5b39de=createListener(_0x6889('0x5')+_0x12065a,_0x259da9);FaxInteractionEvents['on'](_0x12065a,_0x5b39de);}}; \ No newline at end of file +var _0x4a45=['faxInteraction:','./faxInteraction.events','save','remove','emit','register','length'];(function(_0x239ad4,_0x2ad596){var _0x29317b=function(_0x1fa511){while(--_0x1fa511){_0x239ad4['push'](_0x239ad4['shift']());}};_0x29317b(++_0x2ad596);}(_0x4a45,0xe1));var _0x54a4=function(_0x5ad51c,_0x3f3648){_0x5ad51c=_0x5ad51c-0x0;var _0x47fddf=_0x4a45[_0x5ad51c];return _0x47fddf;};'use strict';var FaxInteractionEvents=require(_0x54a4('0x0'));var events=[_0x54a4('0x1'),_0x54a4('0x2'),'update'];function createListener(_0x2b74d9,_0x4d3fe4){return function(_0x4f2289){_0x4d3fe4[_0x54a4('0x3')](_0x2b74d9,_0x4f2289);};}function removeListener(_0x52444c,_0x166001){return function(){FaxInteractionEvents['removeListener'](_0x52444c,_0x166001);};}exports[_0x54a4('0x4')]=function(_0x444e88){for(var _0x4cc5bf=0x0,_0x5d95aa=events[_0x54a4('0x5')];_0x4cc5bf<_0x5d95aa;_0x4cc5bf++){var _0x47646f=events[_0x4cc5bf];var _0x4d3bd2=createListener(_0x54a4('0x6')+_0x47646f,_0x444e88);FaxInteractionEvents['on'](_0x47646f,_0x4d3bd2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9b090b8..d74d263 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 _0x33b4=['tracked','faxinteraction:addtags','addTags','put','fax','delete','faxinteraction:destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x1e9255,_0x5d37c4){var _0x358076=function(_0x5a1a6c){while(--_0x5a1a6c){_0x1e9255['push'](_0x1e9255['shift']());}};_0x358076(++_0x5d37c4);}(_0x33b4,0x81));var _0x433b=function(_0x2c48d3,_0x4ca500){_0x2c48d3=_0x2c48d3-0x0;var _0x1f12aa=_0x33b4[_0x2c48d3];return _0x1f12aa;};'use strict';var multer=require(_0x433b('0x0'));var util=require(_0x433b('0x1'));var path=require(_0x433b('0x2'));var timeout=require(_0x433b('0x3'));var express=require(_0x433b('0x4'));var router=express[_0x433b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x433b('0x6'));var interaction=require(_0x433b('0x7'));var config=require(_0x433b('0x8'));var controller=require(_0x433b('0x9'));router[_0x433b('0xa')]('/',auth[_0x433b('0xb')](),controller['index']);router[_0x433b('0xa')](_0x433b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x433b('0xa')](_0x433b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x433b('0xa')](_0x433b('0xe'),auth[_0x433b('0xb')](),controller[_0x433b('0xf')]);router[_0x433b('0xa')](_0x433b('0x10'),auth[_0x433b('0xb')](),controller[_0x433b('0x11')]);router[_0x433b('0x12')]('/',auth[_0x433b('0xb')](),controller[_0x433b('0x13')]);router[_0x433b('0x12')](_0x433b('0xe'),auth['isAuthenticated'](),controller[_0x433b('0x14')]);router[_0x433b('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x433b('0x15')]('fax',_0x433b('0x16')),controller[_0x433b('0x17')]);router[_0x433b('0x18')](_0x433b('0xd'),auth['isAuthenticated'](),interaction[_0x433b('0x15')](_0x433b('0x19'),'faxinteraction:update'),controller['update']);router[_0x433b('0x1a')](_0x433b('0xd'),auth[_0x433b('0xb')](),interaction[_0x433b('0x15')]('fax',_0x433b('0x1b')),controller['destroy']);router[_0x433b('0x1a')](_0x433b('0x1c'),auth[_0x433b('0xb')](),controller[_0x433b('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x1cc7=['/:id/tags','tracked','fax','addTags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','show','/:id/download','download','post'];(function(_0x49ffda,_0x45ae69){var _0x3960ea=function(_0x238fd5){while(--_0x238fd5){_0x49ffda['push'](_0x49ffda['shift']());}};_0x3960ea(++_0x45ae69);}(_0x1cc7,0x15a));var _0x71cc=function(_0x3bff9a,_0xe7e88f){_0x3bff9a=_0x3bff9a-0x0;var _0x126265=_0x1cc7[_0x3bff9a];return _0x126265;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x71cc('0x3'));var auth=require(_0x71cc('0x4'));var interaction=require(_0x71cc('0x5'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x71cc('0x6')](),controller['index']);router[_0x71cc('0x7')](_0x71cc('0x8'),auth[_0x71cc('0x6')](),controller[_0x71cc('0x9')]);router[_0x71cc('0x7')]('/:id',auth[_0x71cc('0x6')](),controller[_0x71cc('0xa')]);router[_0x71cc('0x7')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x71cc('0xb'),auth[_0x71cc('0x6')](),controller[_0x71cc('0xc')]);router['post']('/',auth[_0x71cc('0x6')](),controller['create']);router[_0x71cc('0xd')]('/:id/messages',auth[_0x71cc('0x6')](),controller['addMessage']);router[_0x71cc('0xd')](_0x71cc('0xe'),auth[_0x71cc('0x6')](),interaction[_0x71cc('0xf')](_0x71cc('0x10'),'faxinteraction:addtags'),controller[_0x71cc('0x11')]);router[_0x71cc('0x12')](_0x71cc('0x13'),auth[_0x71cc('0x6')](),interaction[_0x71cc('0xf')](_0x71cc('0x10'),_0x71cc('0x14')),controller['update']);router[_0x71cc('0x15')](_0x71cc('0x13'),auth[_0x71cc('0x6')](),interaction[_0x71cc('0xf')](_0x71cc('0x10'),_0x71cc('0x16')),controller['destroy']);router[_0x71cc('0x15')](_0x71cc('0xe'),auth['isAuthenticated'](),controller['removeTags']);module[_0x71cc('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5917a75..6cc5095 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 _0x54ef=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x45887e,_0x11e424){var _0x318854=function(_0x79ce20){while(--_0x79ce20){_0x45887e['push'](_0x45887e['shift']());}};_0x318854(++_0x11e424);}(_0x54ef,0x112));var _0xf54e=function(_0x2871be,_0x3b2fd5){_0x2871be=_0x2871be-0x0;var _0x5a1dde=_0x54ef[_0x2871be];return _0x5a1dde;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'body':{'type':Sequelize[_0xf54e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf54e('0x4')]('in',_0xf54e('0x5')),'defaultValue':_0xf54e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf54e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf54e('0x6')]}}; \ No newline at end of file +var _0x21d1=['ENUM','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2e2ce8,_0x436b78){var _0x1d92a7=function(_0x51e8d8){while(--_0x51e8d8){_0x2e2ce8['push'](_0x2e2ce8['shift']());}};_0x1d92a7(++_0x436b78);}(_0x21d1,0x1c9));var _0x121d=function(_0x4421c0,_0x27786c){_0x4421c0=_0x4421c0-0x0;var _0x2e1642=_0x21d1[_0x4421c0];return _0x2e1642;};'use strict';var Sequelize=require(_0x121d('0x0'));module[_0x121d('0x1')]={'body':{'type':Sequelize[_0x121d('0x2')](_0x121d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x121d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x121d('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x121d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x121d('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 07303e9..fa5a6d2 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 _0x1e81=['acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','SELECT','rejectmessage','create','CmContact','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','download','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','intersection','find','body','destroy','params','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager'];(function(_0x51786e,_0x5ee24e){var _0x25b5e2=function(_0x3ce85f){while(--_0x3ce85f){_0x51786e['push'](_0x51786e['shift']());}};_0x25b5e2(++_0x5ee24e);}(_0x1e81,0x138));var _0x11e8=function(_0x593338,_0x2cd36a){_0x593338=_0x593338-0x0;var _0x12e53c=_0x1e81[_0x593338];return _0x12e53c;};'use strict';var emlformat=require(_0x11e8('0x0'));var rimraf=require(_0x11e8('0x1'));var zipdir=require(_0x11e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11e8('0x3'));var moment=require(_0x11e8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x11e8('0x5'));var path=require(_0x11e8('0x6'));var sox=require(_0x11e8('0x7'));var csv=require(_0x11e8('0x8'));var ejs=require(_0x11e8('0x9'));var fs=require('fs');var fs_extra=require(_0x11e8('0xa'));var _=require(_0x11e8('0xb'));var squel=require(_0x11e8('0xc'));var crypto=require(_0x11e8('0xd'));var jsforce=require(_0x11e8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x11e8('0x8'));var querystring=require(_0x11e8('0xf'));var Papa=require(_0x11e8('0x10'));var Redis=require(_0x11e8('0x11'));var authService=require(_0x11e8('0x12'));var qs=require(_0x11e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11e8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x11e8('0x15'));var config=require(_0x11e8('0x16'));var licenseUtil=require(_0x11e8('0x17'));var db=require(_0x11e8('0x18'))['db'];config[_0x11e8('0x19')]=_[_0x11e8('0x1a')](config[_0x11e8('0x19')],{'host':_0x11e8('0x1b'),'port':0x18eb});var socket=require(_0x11e8('0x1c'))(new Redis(config[_0x11e8('0x19')]));require(_0x11e8('0x1d'))[_0x11e8('0x1e')](socket);var jayson=require(_0x11e8('0x1f'));var client=jayson['client'][_0x11e8('0x20')]({'port':0x232c});var client9002=jayson[_0x11e8('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x854ebc,_0x28592d,_0x777dbf,_0x41b878){return new BPromise(function(_0x488610,_0x382f24){var _0x50e57f=_0x41b878||client;return _0x50e57f['request'](_0x854ebc,_0x777dbf)[_0x11e8('0x22')](function(_0x378a99){logger[_0x11e8('0x23')](_0x11e8('0x24'),_0x28592d,_0x11e8('0x25'));logger[_0x11e8('0x26')](_0x11e8('0x27'),_0x28592d,'request\x20sent',JSON[_0x11e8('0x28')](_0x378a99));if(_0x378a99['error']){if(_0x378a99[_0x11e8('0x29')]['code']===0x1f4){logger[_0x11e8('0x29')]('FaxMessage,\x20%s,\x20%s',_0x28592d,_0x378a99[_0x11e8('0x29')]['message']);return _0x382f24(_0x378a99[_0x11e8('0x29')]['message']);}logger['error'](_0x11e8('0x24'),_0x28592d,_0x378a99[_0x11e8('0x29')][_0x11e8('0x2a')]);return _0x488610(_0x378a99[_0x11e8('0x29')][_0x11e8('0x2a')]);}else{logger[_0x11e8('0x23')]('FaxMessage,\x20%s,\x20%s',_0x28592d,_0x11e8('0x25'));_0x488610(_0x378a99[_0x11e8('0x2b')][_0x11e8('0x2a')]);}})[_0x11e8('0x2c')](function(_0x1fed3b){logger[_0x11e8('0x29')](_0x11e8('0x24'),_0x28592d,_0x1fed3b);_0x382f24(_0x1fed3b);});});}function respondWithStatusCode(_0x165c74,_0x1bb8f1){_0x1bb8f1=_0x1bb8f1||0xcc;return function(_0x18bc15){if(_0x18bc15){return _0x165c74['sendStatus'](_0x1bb8f1);}return _0x165c74['status'](_0x1bb8f1)[_0x11e8('0x2d')]();};}function respondWithResult(_0x20033a,_0x18d926){_0x18d926=_0x18d926||0xc8;return function(_0x37946f){if(_0x37946f){return _0x20033a[_0x11e8('0x2e')](_0x18d926)[_0x11e8('0x2f')](_0x37946f);}};}function respondWithFilteredResult(_0xe1fb33,_0xba538e){return function(_0x4c7caf){if(_0x4c7caf){var _0xc6d6f2=typeof _0xba538e[_0x11e8('0x30')]==='undefined'&&typeof _0xba538e[_0x11e8('0x31')]===_0x11e8('0x32');var _0x26ff5d=_0x4c7caf[_0x11e8('0x33')];var _0x5dcfcc=_0xc6d6f2?0x0:_0xba538e[_0x11e8('0x30')];var _0xa82213=_0xc6d6f2?_0x4c7caf['count']:_0xba538e[_0x11e8('0x30')]+_0xba538e['limit'];var _0x554faa;if(_0xa82213>=_0x26ff5d){_0xa82213=_0x26ff5d;_0x554faa=0xc8;}else{_0x554faa=0xce;}_0xe1fb33['status'](_0x554faa);return _0xe1fb33[_0x11e8('0x34')](_0x11e8('0x35'),_0x5dcfcc+'-'+_0xa82213+'/'+_0x26ff5d)['json'](_0x4c7caf);}return null;};}function patchUpdates(_0x446975){return function(_0x1382e9){try{jsonpatch[_0x11e8('0x36')](_0x1382e9,_0x446975,!![]);}catch(_0x2364a9){return BPromise[_0x11e8('0x37')](_0x2364a9);}return _0x1382e9[_0x11e8('0x38')]();};}function saveUpdates(_0x125402,_0x45e31c){return function(_0xdfdcfd){if(_0xdfdcfd){return _0xdfdcfd[_0x11e8('0x39')](_0x125402)[_0x11e8('0x22')](function(_0x39e2fb){return _0x39e2fb;});}return null;};}function removeEntity(_0x471183,_0x2fa28b){return function(_0x47571d){if(_0x47571d){return _0x47571d['destroy']()[_0x11e8('0x22')](function(){_0x471183['status'](0xcc)[_0x11e8('0x2d')]();});}};}function handleEntityNotFound(_0x5300a5,_0x1c37e8){return function(_0x2e7887){if(!_0x2e7887){_0x5300a5[_0x11e8('0x3a')](0x194);}return _0x2e7887;};}function handleError(_0x5a12b7,_0x137996){_0x137996=_0x137996||0x1f4;return function(_0xc7f8d7){logger[_0x11e8('0x29')](_0xc7f8d7[_0x11e8('0x3b')]);if(_0xc7f8d7[_0x11e8('0x3c')]){delete _0xc7f8d7[_0x11e8('0x3c')];}_0x5a12b7[_0x11e8('0x2e')](_0x137996)[_0x11e8('0x3d')](_0xc7f8d7);};}exports[_0x11e8('0x3e')]=function(_0x17ef17,_0x3eb01f){var _0x1b0a5e={},_0xc52ca7={},_0x21126c={'count':0x0,'rows':[]};var _0x21d64d=_[_0x11e8('0x3f')](db[_0x11e8('0x40')][_0x11e8('0x41')],function(_0x146cc0){return{'name':_0x146cc0[_0x11e8('0x42')],'type':_0x146cc0[_0x11e8('0x43')][_0x11e8('0x44')]};});_0xc52ca7[_0x11e8('0x45')]=_[_0x11e8('0x3f')](_0x21d64d,_0x11e8('0x3c'));_0xc52ca7['query']=_[_0x11e8('0x46')](_0x17ef17[_0x11e8('0x47')]);_0xc52ca7[_0x11e8('0x48')]=_['intersection'](_0xc52ca7[_0x11e8('0x45')],_0xc52ca7[_0x11e8('0x47')]);_0x1b0a5e[_0x11e8('0x49')]=_['intersection'](_0xc52ca7[_0x11e8('0x45')],qs['fields'](_0x17ef17[_0x11e8('0x47')][_0x11e8('0x4a')]));_0x1b0a5e['attributes']=_0x1b0a5e[_0x11e8('0x49')][_0x11e8('0x4b')]?_0x1b0a5e[_0x11e8('0x49')]:_0xc52ca7[_0x11e8('0x45')];if(!_0x17ef17['query'][_0x11e8('0x4c')]('nolimit')){_0x1b0a5e[_0x11e8('0x31')]=qs[_0x11e8('0x31')](_0x17ef17[_0x11e8('0x47')][_0x11e8('0x31')]);_0x1b0a5e[_0x11e8('0x30')]=qs[_0x11e8('0x30')](_0x17ef17[_0x11e8('0x47')][_0x11e8('0x30')]);}_0x1b0a5e[_0x11e8('0x4d')]=qs['sort'](_0x17ef17[_0x11e8('0x47')][_0x11e8('0x4e')]);_0x1b0a5e[_0x11e8('0x4f')]=qs[_0x11e8('0x48')](_['pick'](_0x17ef17[_0x11e8('0x47')],_0xc52ca7['filters']),_0x21d64d);if(_0x17ef17['query'][_0x11e8('0x50')]){_0x1b0a5e[_0x11e8('0x4f')]=_[_0x11e8('0x51')](_0x1b0a5e[_0x11e8('0x4f')],{'$or':_['map'](_0x21d64d,function(_0x1fce6c){if(_0x1fce6c[_0x11e8('0x43')]!==_0x11e8('0x52')){var _0x5ab437={};_0x5ab437[_0x1fce6c['name']]={'$like':'%'+_0x17ef17['query']['filter']+'%'};return _0x5ab437;}})});}_0x1b0a5e=_['merge']({},_0x1b0a5e,_0x17ef17[_0x11e8('0x53')]);var _0x3d62ce={'where':_0x1b0a5e['where']};return db['FaxMessage'][_0x11e8('0x33')](_0x3d62ce)[_0x11e8('0x22')](function(_0x49f80b){_0x21126c['count']=_0x49f80b;if(_0x17ef17[_0x11e8('0x47')][_0x11e8('0x54')]){_0x1b0a5e[_0x11e8('0x55')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1b0a5e);})[_0x11e8('0x22')](function(_0x24258b){_0x21126c[_0x11e8('0x56')]=_0x24258b;return _0x21126c;})[_0x11e8('0x22')](respondWithFilteredResult(_0x3eb01f,_0x1b0a5e))[_0x11e8('0x2c')](handleError(_0x3eb01f,null));};exports['show']=function(_0x33c890,_0x45a4c2){var _0x125f5a={'raw':!![],'where':{'id':_0x33c890['params']['id']}},_0x17dfce={};_0x17dfce[_0x11e8('0x45')]=_[_0x11e8('0x46')](db['FaxMessage'][_0x11e8('0x41')]);_0x17dfce[_0x11e8('0x47')]=_[_0x11e8('0x46')](_0x33c890[_0x11e8('0x47')]);_0x17dfce[_0x11e8('0x48')]=_[_0x11e8('0x57')](_0x17dfce[_0x11e8('0x45')],_0x17dfce[_0x11e8('0x47')]);_0x125f5a[_0x11e8('0x49')]=_[_0x11e8('0x57')](_0x17dfce['model'],qs[_0x11e8('0x4a')](_0x33c890[_0x11e8('0x47')][_0x11e8('0x4a')]));_0x125f5a[_0x11e8('0x49')]=_0x125f5a[_0x11e8('0x49')]['length']?_0x125f5a['attributes']:_0x17dfce[_0x11e8('0x45')];if(_0x33c890[_0x11e8('0x47')][_0x11e8('0x54')]){_0x125f5a[_0x11e8('0x55')]=[{'all':!![]}];}_0x125f5a=_[_0x11e8('0x51')]({},_0x125f5a,_0x33c890[_0x11e8('0x53')]);return db[_0x11e8('0x40')][_0x11e8('0x58')](_0x125f5a)[_0x11e8('0x22')](handleEntityNotFound(_0x45a4c2,null))[_0x11e8('0x22')](respondWithResult(_0x45a4c2,null))[_0x11e8('0x2c')](handleError(_0x45a4c2,null));};exports[_0x11e8('0x39')]=function(_0x42b949,_0xd5164d){if(_0x42b949['body']['id']){delete _0x42b949[_0x11e8('0x59')]['id'];}return db[_0x11e8('0x40')][_0x11e8('0x58')]({'where':{'id':_0x42b949['params']['id']}})[_0x11e8('0x22')](handleEntityNotFound(_0xd5164d,null))[_0x11e8('0x22')](saveUpdates(_0x42b949[_0x11e8('0x59')],null))['then'](respondWithResult(_0xd5164d,null))['catch'](handleError(_0xd5164d,null));};exports[_0x11e8('0x5a')]=function(_0x1fce59,_0x30c515){return db[_0x11e8('0x40')][_0x11e8('0x58')]({'where':{'id':_0x1fce59[_0x11e8('0x5b')]['id']}})[_0x11e8('0x22')](handleEntityNotFound(_0x30c515,null))[_0x11e8('0x22')](removeEntity(_0x30c515,null))[_0x11e8('0x2c')](handleError(_0x30c515,null));};exports['describe']=function(_0x4ca003,_0x281668){return db[_0x11e8('0x40')][_0x11e8('0x5c')]()[_0x11e8('0x22')](respondWithResult(_0x281668,null))[_0x11e8('0x2c')](handleError(_0x281668,null));};var interaction_log=require('../../config/logger')(_0x11e8('0x5d'));exports[_0x11e8('0x5e')]=function(_0x5baed5,_0x1e3ccd,_0x15e500){var _0x204933={'agent':{},'channel':_0x11e8('0x5f')};if(_0x5baed5['body']['id']){delete _0x5baed5[_0x11e8('0x59')]['id'];}_0x5baed5[_0x11e8('0x59')]['read']=!![];_0x5baed5[_0x11e8('0x59')][_0x11e8('0x60')]=moment()[_0x11e8('0x61')](_0x11e8('0x62'));_0x5baed5[_0x11e8('0x59')][_0x11e8('0x63')]=_0x5baed5[_0x11e8('0x59')][_0x11e8('0x63')]||_0x5baed5['user']['id'];_0x204933[_0x11e8('0x64')]['id']=_0x5baed5[_0x11e8('0x59')][_0x11e8('0x63')];return db[_0x11e8('0x40')][_0x11e8('0x58')]({'where':{'id':_0x5baed5[_0x11e8('0x5b')]['id'],'UserId':null}})[_0x11e8('0x22')](handleEntityNotFound(_0x1e3ccd,null))[_0x11e8('0x22')](saveUpdates(_0x5baed5['body'],null))[_0x11e8('0x22')](function(_0x2ef76b){if(_0x2ef76b){_0x204933[_0x11e8('0x2a')]=_0x2ef76b[_0x11e8('0x65')]({'plain':!![]});return db['FaxInteraction'][_0x11e8('0x58')]({'where':{'id':_0x2ef76b['FaxInteractionId']}});}return null;})[_0x11e8('0x22')](handleEntityNotFound(_0x1e3ccd,null))[_0x11e8('0x22')](function(_0x3d64ad){if(_0x3d64ad){return _0x3d64ad[_0x11e8('0x39')]({'UserId':_0x5baed5[_0x11e8('0x59')][_0x11e8('0x63')],'read1stAt':_[_0x11e8('0x66')](_0x3d64ad[_0x11e8('0x67')])?moment()['format'](_0x11e8('0x62')):undefined});}return null;})[_0x11e8('0x22')](function(_0x59f319){if(_0x59f319){_0x204933[_0x11e8('0x68')]=_0x59f319[_0x11e8('0x65')]({'plain':!![]});interaction_log['info'](_0x11e8('0x69'),_0x5baed5[_0x11e8('0x6a')]['id'],_0x5baed5[_0x11e8('0x6a')][_0x11e8('0x3c')],_0x5baed5['user'][_0x11e8('0x6b')],_0x204933[_0x11e8('0x68')]['id'],_0x5baed5['body']?JSON[_0x11e8('0x28')](_0x5baed5[_0x11e8('0x59')]):_0x11e8('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x204933);}return null;})[_0x11e8('0x22')](function(_0x39501e){var _0x356f53=_0x11e8('0x6d')+_0x39501e[_0x11e8('0x2a')]['ContactId'];return db[_0x11e8('0x6e')][_0x11e8('0x47')](_0x356f53,{'type':db['Sequelize'][_0x11e8('0x6f')]['SELECT'],'raw':!![]})[_0x11e8('0x22')](function(_0x4a2a3b){return _0x4a2a3b;});})[_0x11e8('0x22')](function(_0x54829f){if(_0x54829f){_0x204933[_0x11e8('0x2a')][_0x11e8('0x70')]=_0x54829f[0x0];if(!_0x5baed5[_0x11e8('0x59')][_0x11e8('0x63')])return;return db[_0x11e8('0x71')]['find']({'where':{'id':_0x5baed5[_0x11e8('0x59')][_0x11e8('0x63')],'role':_0x11e8('0x64')},'attributes':['id',_0x11e8('0x3c'),_0x11e8('0x72'),_0x11e8('0x73'),_0x11e8('0x74')],'raw':!![]});}return null;})[_0x11e8('0x22')](function(_0xc9631f){if(!_0xc9631f)return null;_0x204933['message'][_0x11e8('0x64')]=_0xc9631f;return _0x204933;})[_0x11e8('0x22')](function(_0x22023d){if(_0x22023d){if(_0x5baed5[_0x11e8('0x59')][_0x11e8('0x75')]){_0x204933['message']['interface']=util[_0x11e8('0x61')](_0x11e8('0x76'),_0x5baed5['user'][_0x11e8('0x3c')]);_0x204933[_0x11e8('0x2a')][_0x11e8('0x77')]=_0x204933[_0x11e8('0x77')];_0x204933[_0x11e8('0x2a')][_0x11e8('0x78')]=_0x204933[_0x11e8('0x77')];_0x204933['message'][_0x11e8('0x79')]=_0x11e8('0x5e');return respondWithRpcPromise(_0x11e8('0x7a'),_0x11e8('0x7a'),{'event':_0x11e8('0x7b'),'message':_0x204933[_0x11e8('0x2a')]},client9002)[_0x11e8('0x22')](function(){return _0x204933;});}return _0x204933;}return null;})[_0x11e8('0x22')](respondWithResult(_0x1e3ccd,null))['catch'](handleError(_0x1e3ccd,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['reject']=function(_0x4bf089,_0x1a4c41,_0x2caa07){var _0x302a33={'agent':{},'channel':'fax'};if(_0x4bf089[_0x11e8('0x59')]['id']){delete _0x4bf089['body']['id'];}_0x4bf089['body'][_0x11e8('0x63')]=_0x4bf089[_0x11e8('0x59')][_0x11e8('0x63')]||_0x4bf089[_0x11e8('0x6a')]['id'];_0x302a33[_0x11e8('0x64')]['id']=_0x4bf089['body'][_0x11e8('0x63')];return db['FaxMessage'][_0x11e8('0x58')]({'where':{'id':_0x4bf089[_0x11e8('0x5b')]['id'],'UserId':null}})[_0x11e8('0x22')](handleEntityNotFound(_0x1a4c41,null))[_0x11e8('0x22')](function(_0x46ab4d){if(_0x46ab4d){_0x302a33[_0x11e8('0x2a')]=_0x46ab4d[_0x11e8('0x65')]({'plain':!![]});return db[_0x11e8('0x7c')]['find']({'where':{'id':_0x46ab4d['FaxInteractionId']}});}return null;})[_0x11e8('0x22')](handleEntityNotFound(_0x1a4c41,null))[_0x11e8('0x22')](function(_0x2469b3){if(_0x2469b3){_0x302a33[_0x11e8('0x68')]=_0x2469b3[_0x11e8('0x65')]({'plain':!![]});interaction_log[_0x11e8('0x23')](_0x11e8('0x7d'),_0x4bf089[_0x11e8('0x6a')]['id'],_0x4bf089['user'][_0x11e8('0x3c')],_0x4bf089[_0x11e8('0x6a')][_0x11e8('0x6b')],_0x302a33[_0x11e8('0x68')]['id'],_0x4bf089[_0x11e8('0x59')]?JSON['stringify'](_0x4bf089[_0x11e8('0x59')]):_0x11e8('0x6c'));return respondWithRpcPromise(_0x11e8('0x7e'),'rejectMessage',_0x302a33);}return null;})[_0x11e8('0x22')](function(_0x7214fe){var _0x2e3835=_0x11e8('0x6d')+_0x7214fe[_0x11e8('0x2a')]['ContactId'];return db['sequelize'][_0x11e8('0x47')](_0x2e3835,{'type':db[_0x11e8('0x7f')][_0x11e8('0x6f')][_0x11e8('0x80')],'raw':!![]})[_0x11e8('0x22')](function(_0x73707){return _0x73707;});})['then'](function(_0x4c3d53){if(_0x4c3d53){_0x302a33[_0x11e8('0x2a')][_0x11e8('0x70')]=_0x4c3d53[0x0];if(!_0x4bf089[_0x11e8('0x59')][_0x11e8('0x63')])return;return db[_0x11e8('0x71')][_0x11e8('0x58')]({'where':{'id':_0x4bf089[_0x11e8('0x59')][_0x11e8('0x63')],'role':_0x11e8('0x64')},'attributes':['id',_0x11e8('0x3c'),_0x11e8('0x72'),'email','internal'],'raw':!![]});}return null;})[_0x11e8('0x22')](function(_0x25b93b){if(!_0x25b93b)return null;_0x302a33[_0x11e8('0x2a')][_0x11e8('0x64')]=_0x25b93b;return _0x302a33;})[_0x11e8('0x22')](function(_0x5d16a3){if(_0x5d16a3){_0x5d16a3['message']['interface']=util['format'](_0x11e8('0x76'),_0x4bf089[_0x11e8('0x6a')]['name']);_0x5d16a3[_0x11e8('0x2a')][_0x11e8('0x77')]=_0x302a33[_0x11e8('0x77')];_0x5d16a3[_0x11e8('0x2a')][_0x11e8('0x78')]=_0x302a33[_0x11e8('0x77')];_0x5d16a3['message'][_0x11e8('0x79')]=_0x11e8('0x37');respondWithRpcPromise(_0x11e8('0x7a'),_0x11e8('0x7a'),{'event':_0x11e8('0x81'),'message':_0x5d16a3[_0x11e8('0x2a')]},client9002);return _0x302a33;}return null;})[_0x11e8('0x22')](respondWithResult(_0x1a4c41,null))[_0x11e8('0x2c')](handleError(_0x1a4c41,null));};exports['create']=function(_0xa2ba34,_0x5340fc){var _0x54b925;return db[_0x11e8('0x40')][_0x11e8('0x82')](_0xa2ba34[_0x11e8('0x59')],{})[_0x11e8('0x22')](function(_0x1be903){_0x54b925=_0x1be903;return db[_0x11e8('0x83')]['findOne']({'where':{'id':_0x54b925[_0x11e8('0x84')]}});})[_0x11e8('0x22')](function(_0x1c91ea){if(_[_0x11e8('0x66')](_0x1c91ea)){return;}else{_0x54b925[_0x11e8('0x5f')]=_0x1c91ea['fax'];return db[_0x11e8('0x85')][_0x11e8('0x86')]({'where':{'id':_0x54b925[_0x11e8('0x87')]}});}})[_0x11e8('0x22')](function(_0x491b22){return respondWithRpcPromise(_0x11e8('0x88'),_0x11e8('0x88'),{'FaxAccountId':_['isNil'](_0xa2ba34[_0x11e8('0x59')])?undefined:_0xa2ba34[_0x11e8('0x59')][_0x11e8('0x89')],'path':_[_0x11e8('0x66')](_0x491b22)?undefined:util[_0x11e8('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x491b22['basename']),'fax':_[_0x11e8('0x66')](_0x54b925['fax'])?undefined:_0x54b925[_0x11e8('0x5f')],'AttachmentId':_0x54b925[_0x11e8('0x87')]},client9002);})[_0x11e8('0x22')](respondWithResult(_0x5340fc,0xc9))[_0x11e8('0x2c')](handleError(_0x5340fc,null));};exports[_0x11e8('0x8a')]=function(_0x2d1381,_0x111d53){var _0x282f94=path[_0x11e8('0x8b')](config[_0x11e8('0x8c')],_0x11e8('0x8d'),_0x11e8('0x8e'),_0x11e8('0x8f'));return db[_0x11e8('0x40')]['find']({'where':{'id':_0x2d1381['params']['id']},'include':[{'model':db[_0x11e8('0x85')],'as':_0x11e8('0x85')}]})[_0x11e8('0x22')](handleEntityNotFound(_0x111d53,null))[_0x11e8('0x22')](function(_0x2e9809){if(_0x2e9809){return _0x111d53[_0x11e8('0x8a')](path['join'](_0x282f94,_0x2e9809[_0x11e8('0x85')][_0x11e8('0x90')]));}})['catch'](handleError(_0x111d53,null));}; \ No newline at end of file +var _0x5042=['../../config/license/util','../../mysqldb','redis','localhost','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','end','stack','name','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','EventManager','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','contact','motionChannel','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','files','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','lodash','squel','crypto','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(_0xae9ab6,_0xb47077){var _0x1ae534=function(_0x5bfc41){while(--_0x5bfc41){_0xae9ab6['push'](_0xae9ab6['shift']());}};_0x1ae534(++_0xb47077);}(_0x5042,0x76));var _0x2504=function(_0xf14908,_0x43e1a8){_0xf14908=_0xf14908-0x0;var _0x217c53=_0x5042[_0xf14908];return _0x217c53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2504('0x0'));var zipdir=require(_0x2504('0x1'));var jsonpatch=require(_0x2504('0x2'));var rp=require(_0x2504('0x3'));var moment=require(_0x2504('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2504('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2504('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2504('0x7'));var squel=require(_0x2504('0x8'));var crypto=require(_0x2504('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2504('0xa'));var toCsv=require(_0x2504('0xb'));var querystring=require(_0x2504('0xc'));var Papa=require(_0x2504('0xd'));var Redis=require(_0x2504('0xe'));var authService=require(_0x2504('0xf'));var qs=require(_0x2504('0x10'));var as=require(_0x2504('0x11'));var hardwareService=require(_0x2504('0x12'));var logger=require(_0x2504('0x13'))(_0x2504('0x14'));var utils=require(_0x2504('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2504('0x16'));var db=require(_0x2504('0x17'))['db'];config[_0x2504('0x18')]=_['defaults'](config[_0x2504('0x18')],{'host':_0x2504('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2504('0x1a'))['register'](socket);var jayson=require(_0x2504('0x1b'));var client=jayson[_0x2504('0x1c')][_0x2504('0x1d')]({'port':0x232c});var client9002=jayson[_0x2504('0x1c')][_0x2504('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x535dc2,_0x374850,_0x15d734,_0x53771f){return new BPromise(function(_0x15c3fb,_0x3c0ff3){var _0x41faf5=_0x53771f||client;return _0x41faf5[_0x2504('0x1e')](_0x535dc2,_0x15d734)[_0x2504('0x1f')](function(_0x416d3d){logger[_0x2504('0x20')](_0x2504('0x21'),_0x374850,_0x2504('0x22'));logger['debug'](_0x2504('0x23'),_0x374850,_0x2504('0x22'),JSON['stringify'](_0x416d3d));if(_0x416d3d['error']){if(_0x416d3d[_0x2504('0x24')]['code']===0x1f4){logger[_0x2504('0x24')]('FaxMessage,\x20%s,\x20%s',_0x374850,_0x416d3d[_0x2504('0x24')][_0x2504('0x25')]);return _0x3c0ff3(_0x416d3d['error'][_0x2504('0x25')]);}logger[_0x2504('0x24')](_0x2504('0x21'),_0x374850,_0x416d3d[_0x2504('0x24')][_0x2504('0x25')]);return _0x15c3fb(_0x416d3d['error'][_0x2504('0x25')]);}else{logger[_0x2504('0x20')](_0x2504('0x21'),_0x374850,_0x2504('0x22'));_0x15c3fb(_0x416d3d[_0x2504('0x26')][_0x2504('0x25')]);}})[_0x2504('0x27')](function(_0x2bbe42){logger[_0x2504('0x24')](_0x2504('0x21'),_0x374850,_0x2bbe42);_0x3c0ff3(_0x2bbe42);});});}function respondWithStatusCode(_0x31c46a,_0x64238c){_0x64238c=_0x64238c||0xcc;return function(_0x30c316){if(_0x30c316){return _0x31c46a[_0x2504('0x28')](_0x64238c);}return _0x31c46a[_0x2504('0x29')](_0x64238c)['end']();};}function respondWithResult(_0x47d4bf,_0x36f0d6){_0x36f0d6=_0x36f0d6||0xc8;return function(_0x398805){if(_0x398805){return _0x47d4bf['status'](_0x36f0d6)[_0x2504('0x2a')](_0x398805);}};}function respondWithFilteredResult(_0x43ddd8,_0x1533c5){return function(_0x4f29bd){if(_0x4f29bd){var _0x23aa63=typeof _0x1533c5[_0x2504('0x2b')]===_0x2504('0x2c')&&typeof _0x1533c5[_0x2504('0x2d')]==='undefined';var _0x1b3640=_0x4f29bd[_0x2504('0x2e')];var _0x1631bb=_0x23aa63?0x0:_0x1533c5['offset'];var _0x308da9=_0x23aa63?_0x4f29bd['count']:_0x1533c5[_0x2504('0x2b')]+_0x1533c5['limit'];var _0x2802f3;if(_0x308da9>=_0x1b3640){_0x308da9=_0x1b3640;_0x2802f3=0xc8;}else{_0x2802f3=0xce;}_0x43ddd8[_0x2504('0x29')](_0x2802f3);return _0x43ddd8['set'](_0x2504('0x2f'),_0x1631bb+'-'+_0x308da9+'/'+_0x1b3640)[_0x2504('0x2a')](_0x4f29bd);}return null;};}function patchUpdates(_0x224a11){return function(_0x1640c5){try{jsonpatch[_0x2504('0x30')](_0x1640c5,_0x224a11,!![]);}catch(_0x185d71){return BPromise['reject'](_0x185d71);}return _0x1640c5[_0x2504('0x31')]();};}function saveUpdates(_0xd1e907,_0x207105){return function(_0x1d624c){if(_0x1d624c){return _0x1d624c[_0x2504('0x32')](_0xd1e907)['then'](function(_0x176b17){return _0x176b17;});}return null;};}function removeEntity(_0x32fd8c,_0x338cf5){return function(_0x5c64e9){if(_0x5c64e9){return _0x5c64e9[_0x2504('0x33')]()[_0x2504('0x1f')](function(){_0x32fd8c['status'](0xcc)[_0x2504('0x34')]();});}};}function handleEntityNotFound(_0x585c06,_0x261a7e){return function(_0x33d886){if(!_0x33d886){_0x585c06['sendStatus'](0x194);}return _0x33d886;};}function handleError(_0x45a47a,_0x4f5bf8){_0x4f5bf8=_0x4f5bf8||0x1f4;return function(_0x4080dd){logger[_0x2504('0x24')](_0x4080dd[_0x2504('0x35')]);if(_0x4080dd[_0x2504('0x36')]){delete _0x4080dd['name'];}_0x45a47a[_0x2504('0x29')](_0x4f5bf8)['send'](_0x4080dd);};}exports[_0x2504('0x37')]=function(_0x30cba4,_0x4bb405){var _0x4763de={},_0x472a37={},_0x39ffda={'count':0x0,'rows':[]};var _0xe83ce3=_[_0x2504('0x38')](db[_0x2504('0x39')][_0x2504('0x3a')],function(_0x32cf25){return{'name':_0x32cf25[_0x2504('0x3b')],'type':_0x32cf25['type'][_0x2504('0x3c')]};});_0x472a37[_0x2504('0x3d')]=_[_0x2504('0x38')](_0xe83ce3,'name');_0x472a37[_0x2504('0x3e')]=_[_0x2504('0x3f')](_0x30cba4[_0x2504('0x3e')]);_0x472a37[_0x2504('0x40')]=_[_0x2504('0x41')](_0x472a37[_0x2504('0x3d')],_0x472a37[_0x2504('0x3e')]);_0x4763de[_0x2504('0x42')]=_[_0x2504('0x41')](_0x472a37[_0x2504('0x3d')],qs[_0x2504('0x43')](_0x30cba4[_0x2504('0x3e')][_0x2504('0x43')]));_0x4763de[_0x2504('0x42')]=_0x4763de[_0x2504('0x42')]['length']?_0x4763de[_0x2504('0x42')]:_0x472a37[_0x2504('0x3d')];if(!_0x30cba4[_0x2504('0x3e')][_0x2504('0x44')](_0x2504('0x45'))){_0x4763de[_0x2504('0x2d')]=qs[_0x2504('0x2d')](_0x30cba4['query'][_0x2504('0x2d')]);_0x4763de['offset']=qs[_0x2504('0x2b')](_0x30cba4[_0x2504('0x3e')][_0x2504('0x2b')]);}_0x4763de[_0x2504('0x46')]=qs[_0x2504('0x47')](_0x30cba4[_0x2504('0x3e')][_0x2504('0x47')]);_0x4763de[_0x2504('0x48')]=qs['filters'](_[_0x2504('0x49')](_0x30cba4[_0x2504('0x3e')],_0x472a37[_0x2504('0x40')]),_0xe83ce3);if(_0x30cba4[_0x2504('0x3e')][_0x2504('0x4a')]){_0x4763de[_0x2504('0x48')]=_[_0x2504('0x4b')](_0x4763de[_0x2504('0x48')],{'$or':_['map'](_0xe83ce3,function(_0x1e60e2){if(_0x1e60e2[_0x2504('0x4c')]!==_0x2504('0x4d')){var _0x339690={};_0x339690[_0x1e60e2[_0x2504('0x36')]]={'$like':'%'+_0x30cba4['query'][_0x2504('0x4a')]+'%'};return _0x339690;}})});}_0x4763de=_[_0x2504('0x4b')]({},_0x4763de,_0x30cba4[_0x2504('0x4e')]);var _0x2ceaa2={'where':_0x4763de[_0x2504('0x48')]};return db[_0x2504('0x39')]['count'](_0x2ceaa2)[_0x2504('0x1f')](function(_0x16baa6){_0x39ffda[_0x2504('0x2e')]=_0x16baa6;if(_0x30cba4[_0x2504('0x3e')]['includeAll']){_0x4763de['include']=[{'all':!![]}];}return db['FaxMessage'][_0x2504('0x4f')](_0x4763de);})['then'](function(_0x256bc3){_0x39ffda['rows']=_0x256bc3;return _0x39ffda;})[_0x2504('0x1f')](respondWithFilteredResult(_0x4bb405,_0x4763de))[_0x2504('0x27')](handleError(_0x4bb405,null));};exports[_0x2504('0x50')]=function(_0x278ad8,_0xe8935e){var _0x353a9f={'raw':!![],'where':{'id':_0x278ad8[_0x2504('0x51')]['id']}},_0x49c6dd={};_0x49c6dd['model']=_[_0x2504('0x3f')](db['FaxMessage'][_0x2504('0x3a')]);_0x49c6dd['query']=_[_0x2504('0x3f')](_0x278ad8[_0x2504('0x3e')]);_0x49c6dd[_0x2504('0x40')]=_[_0x2504('0x41')](_0x49c6dd['model'],_0x49c6dd['query']);_0x353a9f[_0x2504('0x42')]=_['intersection'](_0x49c6dd[_0x2504('0x3d')],qs[_0x2504('0x43')](_0x278ad8[_0x2504('0x3e')][_0x2504('0x43')]));_0x353a9f[_0x2504('0x42')]=_0x353a9f[_0x2504('0x42')]['length']?_0x353a9f['attributes']:_0x49c6dd['model'];if(_0x278ad8[_0x2504('0x3e')][_0x2504('0x52')]){_0x353a9f['include']=[{'all':!![]}];}_0x353a9f=_[_0x2504('0x4b')]({},_0x353a9f,_0x278ad8[_0x2504('0x4e')]);return db[_0x2504('0x39')][_0x2504('0x53')](_0x353a9f)[_0x2504('0x1f')](handleEntityNotFound(_0xe8935e,null))[_0x2504('0x1f')](respondWithResult(_0xe8935e,null))[_0x2504('0x27')](handleError(_0xe8935e,null));};exports[_0x2504('0x32')]=function(_0x1c6c9e,_0x511024){if(_0x1c6c9e['body']['id']){delete _0x1c6c9e[_0x2504('0x54')]['id'];}return db[_0x2504('0x39')]['find']({'where':{'id':_0x1c6c9e[_0x2504('0x51')]['id']}})[_0x2504('0x1f')](handleEntityNotFound(_0x511024,null))[_0x2504('0x1f')](saveUpdates(_0x1c6c9e['body'],null))[_0x2504('0x1f')](respondWithResult(_0x511024,null))['catch'](handleError(_0x511024,null));};exports['destroy']=function(_0x2500e9,_0x5124f3){return db[_0x2504('0x39')]['find']({'where':{'id':_0x2500e9['params']['id']}})[_0x2504('0x1f')](handleEntityNotFound(_0x5124f3,null))[_0x2504('0x1f')](removeEntity(_0x5124f3,null))[_0x2504('0x27')](handleError(_0x5124f3,null));};exports[_0x2504('0x55')]=function(_0x43ffe8,_0x3c0703){return db['FaxMessage'][_0x2504('0x55')]()[_0x2504('0x1f')](respondWithResult(_0x3c0703,null))[_0x2504('0x27')](handleError(_0x3c0703,null));};var interaction_log=require(_0x2504('0x13'))(_0x2504('0x56'));exports[_0x2504('0x57')]=function(_0x369f68,_0x482300,_0x3720d5){var _0x1393b2={'agent':{},'channel':_0x2504('0x58')};if(_0x369f68[_0x2504('0x54')]['id']){delete _0x369f68[_0x2504('0x54')]['id'];}_0x369f68[_0x2504('0x54')][_0x2504('0x59')]=!![];_0x369f68[_0x2504('0x54')][_0x2504('0x5a')]=moment()[_0x2504('0x5b')](_0x2504('0x5c'));_0x369f68['body'][_0x2504('0x5d')]=_0x369f68[_0x2504('0x54')]['UserId']||_0x369f68[_0x2504('0x5e')]['id'];_0x1393b2[_0x2504('0x5f')]['id']=_0x369f68[_0x2504('0x54')][_0x2504('0x5d')];return db[_0x2504('0x39')][_0x2504('0x53')]({'where':{'id':_0x369f68[_0x2504('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x482300,null))[_0x2504('0x1f')](saveUpdates(_0x369f68['body'],null))[_0x2504('0x1f')](function(_0x3f242e){if(_0x3f242e){_0x1393b2[_0x2504('0x25')]=_0x3f242e[_0x2504('0x60')]({'plain':!![]});return db[_0x2504('0x61')][_0x2504('0x53')]({'where':{'id':_0x3f242e[_0x2504('0x62')]}});}return null;})[_0x2504('0x1f')](handleEntityNotFound(_0x482300,null))[_0x2504('0x1f')](function(_0x12a842){if(_0x12a842){return _0x12a842[_0x2504('0x32')]({'UserId':_0x369f68[_0x2504('0x54')][_0x2504('0x5d')],'read1stAt':_[_0x2504('0x63')](_0x12a842[_0x2504('0x64')])?moment()[_0x2504('0x5b')](_0x2504('0x5c')):undefined});}return null;})[_0x2504('0x1f')](function(_0x1dbb6e){if(_0x1dbb6e){_0x1393b2[_0x2504('0x65')]=_0x1dbb6e[_0x2504('0x60')]({'plain':!![]});interaction_log['info'](_0x2504('0x66'),_0x369f68['user']['id'],_0x369f68[_0x2504('0x5e')][_0x2504('0x36')],_0x369f68[_0x2504('0x5e')][_0x2504('0x67')],_0x1393b2['interaction']['id'],_0x369f68['body']?JSON['stringify'](_0x369f68[_0x2504('0x54')]):'null');return respondWithRpcPromise(_0x2504('0x68'),_0x2504('0x69'),_0x1393b2);}return null;})['then'](function(_0x4f023b){var _0x107520=_0x2504('0x6a')+_0x4f023b[_0x2504('0x25')]['ContactId'];return db['sequelize'][_0x2504('0x3e')](_0x107520,{'type':db[_0x2504('0x6b')][_0x2504('0x6c')][_0x2504('0x6d')],'raw':!![]})['then'](function(_0x19c789){return _0x19c789;});})[_0x2504('0x1f')](function(_0x277863){if(_0x277863){_0x1393b2[_0x2504('0x25')]['contact']=_0x277863[0x0];if(!_0x369f68[_0x2504('0x54')]['UserId'])return;return db[_0x2504('0x6e')][_0x2504('0x53')]({'where':{'id':_0x369f68[_0x2504('0x54')][_0x2504('0x5d')],'role':_0x2504('0x5f')},'attributes':['id',_0x2504('0x36'),_0x2504('0x6f'),_0x2504('0x70'),_0x2504('0x71')],'raw':!![]});}return null;})[_0x2504('0x1f')](function(_0x2dfd28){if(!_0x2dfd28)return null;_0x1393b2[_0x2504('0x25')][_0x2504('0x5f')]=_0x2dfd28;return _0x1393b2;})[_0x2504('0x1f')](function(_0x230d15){if(_0x230d15){if(_0x369f68['body']['manual']){_0x1393b2[_0x2504('0x25')][_0x2504('0x72')]=util[_0x2504('0x5b')](_0x2504('0x73'),_0x369f68[_0x2504('0x5e')][_0x2504('0x36')]);_0x1393b2[_0x2504('0x25')]['channel']=_0x1393b2[_0x2504('0x74')];_0x1393b2[_0x2504('0x25')]['motionChannel']=_0x1393b2[_0x2504('0x74')];_0x1393b2[_0x2504('0x25')]['event']=_0x2504('0x57');return respondWithRpcPromise(_0x2504('0x75'),_0x2504('0x75'),{'event':'acceptmessage','message':_0x1393b2[_0x2504('0x25')]},client9002)['then'](function(){return _0x1393b2;});}return _0x1393b2;}return null;})[_0x2504('0x1f')](respondWithResult(_0x482300,null))['catch'](handleError(_0x482300,null));};var interaction_log=require(_0x2504('0x13'))('fax-interactions');exports[_0x2504('0x76')]=function(_0x35c263,_0x194c92,_0x6ee4ee){var _0x46ccae={'agent':{},'channel':_0x2504('0x58')};if(_0x35c263['body']['id']){delete _0x35c263['body']['id'];}_0x35c263[_0x2504('0x54')][_0x2504('0x5d')]=_0x35c263[_0x2504('0x54')]['UserId']||_0x35c263[_0x2504('0x5e')]['id'];_0x46ccae[_0x2504('0x5f')]['id']=_0x35c263['body'][_0x2504('0x5d')];return db[_0x2504('0x39')][_0x2504('0x53')]({'where':{'id':_0x35c263['params']['id'],'UserId':null}})[_0x2504('0x1f')](handleEntityNotFound(_0x194c92,null))[_0x2504('0x1f')](function(_0x5dfab4){if(_0x5dfab4){_0x46ccae[_0x2504('0x25')]=_0x5dfab4['get']({'plain':!![]});return db[_0x2504('0x61')][_0x2504('0x53')]({'where':{'id':_0x5dfab4[_0x2504('0x62')]}});}return null;})[_0x2504('0x1f')](handleEntityNotFound(_0x194c92,null))['then'](function(_0x4632ce){if(_0x4632ce){_0x46ccae[_0x2504('0x65')]=_0x4632ce[_0x2504('0x60')]({'plain':!![]});interaction_log[_0x2504('0x20')](_0x2504('0x77'),_0x35c263['user']['id'],_0x35c263[_0x2504('0x5e')][_0x2504('0x36')],_0x35c263['user'][_0x2504('0x67')],_0x46ccae[_0x2504('0x65')]['id'],_0x35c263[_0x2504('0x54')]?JSON['stringify'](_0x35c263[_0x2504('0x54')]):_0x2504('0x78'));return respondWithRpcPromise(_0x2504('0x79'),'rejectMessage',_0x46ccae);}return null;})[_0x2504('0x1f')](function(_0x2fa7fc){var _0x2bdbb7=_0x2504('0x6a')+_0x2fa7fc[_0x2504('0x25')][_0x2504('0x7a')];return db['sequelize'][_0x2504('0x3e')](_0x2bdbb7,{'type':db['Sequelize'][_0x2504('0x6c')][_0x2504('0x6d')],'raw':!![]})[_0x2504('0x1f')](function(_0x5e10f6){return _0x5e10f6;});})[_0x2504('0x1f')](function(_0x45c2cc){if(_0x45c2cc){_0x46ccae['message'][_0x2504('0x7b')]=_0x45c2cc[0x0];if(!_0x35c263[_0x2504('0x54')]['UserId'])return;return db['User'][_0x2504('0x53')]({'where':{'id':_0x35c263[_0x2504('0x54')]['UserId'],'role':_0x2504('0x5f')},'attributes':['id',_0x2504('0x36'),_0x2504('0x6f'),_0x2504('0x70'),_0x2504('0x71')],'raw':!![]});}return null;})[_0x2504('0x1f')](function(_0x29ab16){if(!_0x29ab16)return null;_0x46ccae['message'][_0x2504('0x5f')]=_0x29ab16;return _0x46ccae;})[_0x2504('0x1f')](function(_0x17e1dd){if(_0x17e1dd){_0x17e1dd[_0x2504('0x25')][_0x2504('0x72')]=util[_0x2504('0x5b')](_0x2504('0x73'),_0x35c263[_0x2504('0x5e')][_0x2504('0x36')]);_0x17e1dd[_0x2504('0x25')][_0x2504('0x74')]=_0x46ccae[_0x2504('0x74')];_0x17e1dd[_0x2504('0x25')][_0x2504('0x7c')]=_0x46ccae[_0x2504('0x74')];_0x17e1dd[_0x2504('0x25')][_0x2504('0x7d')]='reject';respondWithRpcPromise(_0x2504('0x75'),_0x2504('0x75'),{'event':_0x2504('0x7e'),'message':_0x17e1dd['message']},client9002);return _0x46ccae;}return null;})[_0x2504('0x1f')](respondWithResult(_0x194c92,null))[_0x2504('0x27')](handleError(_0x194c92,null));};exports[_0x2504('0x7f')]=function(_0x58b24e,_0x262840){var _0x2a65f3;return db[_0x2504('0x39')][_0x2504('0x7f')](_0x58b24e[_0x2504('0x54')],{})[_0x2504('0x1f')](function(_0x4843bc){_0x2a65f3=_0x4843bc;return db[_0x2504('0x80')][_0x2504('0x81')]({'where':{'id':_0x2a65f3[_0x2504('0x7a')]}});})[_0x2504('0x1f')](function(_0x55b3e1){if(_[_0x2504('0x63')](_0x55b3e1)){return;}else{_0x2a65f3[_0x2504('0x58')]=_0x55b3e1[_0x2504('0x58')];return db[_0x2504('0x82')][_0x2504('0x81')]({'where':{'id':_0x2a65f3[_0x2504('0x83')]}});}})[_0x2504('0x1f')](function(_0x4153ef){return respondWithRpcPromise('SendFax',_0x2504('0x84'),{'FaxAccountId':_[_0x2504('0x63')](_0x58b24e[_0x2504('0x54')])?undefined:_0x58b24e[_0x2504('0x54')][_0x2504('0x85')],'path':_[_0x2504('0x63')](_0x4153ef)?undefined:util[_0x2504('0x5b')](_0x2504('0x86'),_0x4153ef['basename']),'fax':_[_0x2504('0x63')](_0x2a65f3[_0x2504('0x58')])?undefined:_0x2a65f3['fax'],'AttachmentId':_0x2a65f3[_0x2504('0x83')]},client9002);})[_0x2504('0x1f')](respondWithResult(_0x262840,0xc9))[_0x2504('0x27')](handleError(_0x262840,null));};exports[_0x2504('0x87')]=function(_0x91aa9d,_0x52543b){var _0x1dfc5a=path[_0x2504('0x88')](config[_0x2504('0x89')],'server',_0x2504('0x8a'),'attachments');return db[_0x2504('0x39')][_0x2504('0x53')]({'where':{'id':_0x91aa9d[_0x2504('0x51')]['id']},'include':[{'model':db[_0x2504('0x82')],'as':_0x2504('0x82')}]})[_0x2504('0x1f')](handleEntityNotFound(_0x52543b,null))[_0x2504('0x1f')](function(_0x4c5c75){if(_0x4c5c75){return _0x52543b[_0x2504('0x87')](path['join'](_0x1dfc5a,_0x4c5c75[_0x2504('0x82')][_0x2504('0x8b')]));}})[_0x2504('0x27')](handleError(_0x52543b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3248033..bd19b35 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 _0xd386=['FaxMessage','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x466024,_0x549202){var _0x1ebcf5=function(_0x4e6064){while(--_0x4e6064){_0x466024['push'](_0x466024['shift']());}};_0x1ebcf5(++_0x549202);}(_0xd386,0x10c));var _0x6d38=function(_0x7d2272,_0x41f365){_0x7d2272=_0x7d2272-0x0;var _0x5bc56e=_0xd386[_0x7d2272];return _0x5bc56e;};'use strict';var EventEmitter=require(_0x6d38('0x0'));var FaxMessage=require(_0x6d38('0x1'))['db'][_0x6d38('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6d38('0x3'),'afterUpdate':_0x6d38('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ce7c5){return function(_0x21b7ee,_0x97f669,_0xa6b2b3){FaxMessageEvents['emit'](_0x1ce7c5+':'+_0x21b7ee['id'],_0x21b7ee);FaxMessageEvents[_0x6d38('0x5')](_0x1ce7c5,_0x21b7ee);_0xa6b2b3(null);};}for(var e in events){if(events[_0x6d38('0x6')](e)){var event=events[e];FaxMessage[_0x6d38('0x7')](e,emitEvent(event));}}module[_0x6d38('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x15ef=['../../mysqldb','FaxMessage','save','update','remove','emit','hook','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x15ef,0x80));var _0xf15e=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x15ef[_0x42bb6d];return _0x1db89b;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xf15e('0x0'))['db'][_0xf15e('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf15e('0x2'),'afterUpdate':_0xf15e('0x3'),'afterDestroy':_0xf15e('0x4')};function emitEvent(_0x347c12){return function(_0x4e7241,_0x5d456b,_0x1b9a24){FaxMessageEvents[_0xf15e('0x5')](_0x347c12+':'+_0x4e7241['id'],_0x4e7241);FaxMessageEvents['emit'](_0x347c12,_0x4e7241);_0x1b9a24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xf15e('0x6')](e,emitEvent(event));}}module[_0xf15e('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 262fc4f..e7b466d 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 _0xe4a1=['fti_fax_messages','models','get','direction','toLowerCase','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages'];(function(_0x3bb10f,_0x4e90df){var _0x4877e5=function(_0x4be32d){while(--_0x4be32d){_0x3bb10f['push'](_0x3bb10f['shift']());}};_0x4877e5(++_0x4e90df);}(_0xe4a1,0xee));var _0x1e4a=function(_0x2bcf98,_0x133745){_0x2bcf98=_0x2bcf98-0x0;var _0x30dc04=_0xe4a1[_0x2bcf98];return _0x30dc04;};'use strict';var _=require(_0x1e4a('0x0'));var util=require(_0x1e4a('0x1'));var logger=require(_0x1e4a('0x2'))(_0x1e4a('0x3'));var moment=require(_0x1e4a('0x4'));var BPromise=require(_0x1e4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e4a('0x6'));var config=require(_0x1e4a('0x7'));var attributes=require(_0x1e4a('0x8'));module[_0x1e4a('0x9')]=function(_0x598180,_0x3e5eac){return _0x598180[_0x1e4a('0xa')]('FaxMessage',attributes,{'tableName':_0x1e4a('0xb'),'paranoid':![],'indexes':[{'name':_0x1e4a('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c2290,_0x3dfbc1,_0x48bd1a){var _0x476de9=_0x598180[_0x1e4a('0xd')];var _0x1ef911=_0x4c2290[_0x1e4a('0xe')]({'plain':!![]});if(_0x1ef911[_0x1e4a('0xf')][_0x1e4a('0x10')]()==='in'||_0x1ef911[_0x1e4a('0xf')][_0x1e4a('0x10')]()==='out'&&!_0x1ef911['secret']&&!_['isNil'](_0x1ef911['UserId'])){_0x476de9[_0x1e4a('0x11')][_0x1e4a('0x12')]({'where':{'id':_0x1ef911[_0x1e4a('0x13')]}})[_0x1e4a('0x14')](function(_0x1015e8){if(_0x1015e8){_0x1015e8[_0x1e4a('0x15')]({'lastMsgAt':_0x1ef911[_0x1e4a('0x16')],'lastMsgDirection':_0x1ef911['direction']['toLowerCase']()});}})[_0x1e4a('0x17')](function(_0x2f3b8e){console['error'](_0x2f3b8e);});}_0x48bd1a();}},'charset':_0x1e4a('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcaa8=['request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','utf8mb4','util','../../config/logger','api','moment','bluebird'];(function(_0x21fec0,_0x2f9a99){var _0xcf272e=function(_0x18e35d){while(--_0x18e35d){_0x21fec0['push'](_0x21fec0['shift']());}};_0xcf272e(++_0x2f9a99);}(_0xcaa8,0x91));var _0x8caa=function(_0x431b58,_0x55b217){_0x431b58=_0x431b58-0x0;var _0x354f15=_0xcaa8[_0x431b58];return _0x354f15;};'use strict';var _=require('lodash');var util=require(_0x8caa('0x0'));var logger=require(_0x8caa('0x1'))(_0x8caa('0x2'));var moment=require(_0x8caa('0x3'));var BPromise=require(_0x8caa('0x4'));var rp=require(_0x8caa('0x5'));var fs=require('fs');var path=require(_0x8caa('0x6'));var rimraf=require(_0x8caa('0x7'));var config=require(_0x8caa('0x8'));var attributes=require(_0x8caa('0x9'));module[_0x8caa('0xa')]=function(_0x1ce8b7,_0x4aeab2){return _0x1ce8b7[_0x8caa('0xb')](_0x8caa('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x8caa('0xd')],'type':_0x8caa('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25f28c,_0x4db35d,_0x584f3c){var _0x29aa3b=_0x1ce8b7[_0x8caa('0xf')];var _0x23e385=_0x25f28c[_0x8caa('0x10')]({'plain':!![]});if(_0x23e385[_0x8caa('0x11')]['toLowerCase']()==='in'||_0x23e385['direction'][_0x8caa('0x12')]()===_0x8caa('0x13')&&!_0x23e385[_0x8caa('0x14')]&&!_[_0x8caa('0x15')](_0x23e385[_0x8caa('0x16')])){_0x29aa3b[_0x8caa('0x17')]['findOne']({'where':{'id':_0x23e385[_0x8caa('0x18')]}})[_0x8caa('0x19')](function(_0x36f518){if(_0x36f518){_0x36f518[_0x8caa('0x1a')]({'lastMsgAt':_0x23e385[_0x8caa('0x1b')],'lastMsgDirection':_0x23e385['direction'][_0x8caa('0x12')]()});}})[_0x8caa('0x1c')](function(_0x2db086){console['error'](_0x2db086);});}_0x584f3c();}},'charset':_0x8caa('0x1d'),'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 8fa5729..b476112 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 _0xfd28=['message','info','catch','create','body','options','then','CreateFaxMessage','UpdateFaxMessage','FaxMessage','raw','where','attributes','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b7092,_0x508668){var _0x2941da=function(_0x23f816){while(--_0x23f816){_0x3b7092['push'](_0x3b7092['shift']());}};_0x2941da(++_0x508668);}(_0xfd28,0x148));var _0x8fd2=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xfd28[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});config[_0x8fd2('0xa')]=_['defaults'](config['redis'],{'host':_0x8fd2('0xb'),'port':0x18eb});var socket=require(_0x8fd2('0xc'))(new Redis(config[_0x8fd2('0xa')]));require('./faxMessage.socket')[_0x8fd2('0xd')](socket);function respondWithRpcPromise(_0x49ca87,_0x2842f3,_0x5aabf0){return new BPromise(function(_0x34ae5c,_0x4fdf0b){return client[_0x8fd2('0xe')](_0x49ca87,_0x5aabf0)['then'](function(_0x1b6558){logger['info'](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));logger[_0x8fd2('0x11')](_0x8fd2('0x12'),_0x2842f3,_0x8fd2('0x10'),JSON[_0x8fd2('0x13')](_0x1b6558));if(_0x1b6558[_0x8fd2('0x14')]){if(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x15')]===0x1f4){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);return _0x4fdf0b(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);}logger['error'](_0x8fd2('0xf'),_0x2842f3,_0x1b6558['error']['message']);return _0x34ae5c(_0x1b6558['error'][_0x8fd2('0x16')]);}else{logger[_0x8fd2('0x17')](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));_0x34ae5c(_0x1b6558['result'][_0x8fd2('0x16')]);}})[_0x8fd2('0x18')](function(_0x411943){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x411943);_0x4fdf0b(_0x411943);});});}exports['CreateFaxMessage']=function(_0x48ad51){var _0x3a0939=this;return new Promise(function(_0x4a2002,_0x3c03de){return db['FaxMessage'][_0x8fd2('0x19')](_0x48ad51[_0x8fd2('0x1a')],{'raw':_0x48ad51['options']?_0x48ad51[_0x8fd2('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8fd2('0x1c')](function(_0x44ee7a){logger['info'](_0x8fd2('0x1d'),_0x48ad51);logger[_0x8fd2('0x11')](_0x8fd2('0x1d'),_0x48ad51,JSON['stringify'](_0x44ee7a));_0x4a2002(_0x44ee7a);})[_0x8fd2('0x18')](function(_0x3b9e2f){logger[_0x8fd2('0x14')](_0x8fd2('0x1d'),_0x3b9e2f[_0x8fd2('0x16')],_0x48ad51);_0x3c03de(_0x3a0939[_0x8fd2('0x14')](0x1f4,_0x3b9e2f[_0x8fd2('0x16')]));});});};exports[_0x8fd2('0x1e')]=function(_0x1456b4){var _0xbc5945=this;return new Promise(function(_0x3392fb,_0x1f3237){return db[_0x8fd2('0x1f')]['update'](_0x1456b4['body'],{'raw':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1456b4['options']?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x21')]||null:null,'attributes':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x22')]||null:null,'limit':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')]['limit']||null:null})[_0x8fd2('0x1c')](function(_0x13c9b9){logger[_0x8fd2('0x17')](_0x8fd2('0x1e'),_0x1456b4);logger[_0x8fd2('0x11')](_0x8fd2('0x1e'),_0x1456b4,JSON[_0x8fd2('0x13')](_0x13c9b9));_0x3392fb(_0x13c9b9);})['catch'](function(_0x5b992a){logger['error'](_0x8fd2('0x1e'),_0x5b992a[_0x8fd2('0x16')],_0x1456b4);_0x1f3237(_0xbc5945[_0x8fd2('0x14')](0x1f4,_0x5b992a[_0x8fd2('0x16')]));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x2cbb30,_0x74f546){var _0x534561=function(_0x33bc3b){while(--_0x33bc3b){_0x2cbb30['push'](_0x2cbb30['shift']());}};_0x534561(++_0x74f546);}(_0x81bd,0x7c));var _0xd81b=function(_0xd1cf76,_0x1e667d){_0xd1cf76=_0xd1cf76-0x0;var _0x580cbf=_0x81bd[_0xd1cf76];return _0x580cbf;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 494662e..d04beb3 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 _0xcb3e=['removeListener','register','./faxMessage.events','remove','update','emit'];(function(_0x57832d,_0xaf1c8){var _0x4c2a8c=function(_0x13df83){while(--_0x13df83){_0x57832d['push'](_0x57832d['shift']());}};_0x4c2a8c(++_0xaf1c8);}(_0xcb3e,0x1c4));var _0xecb3=function(_0x4528cf,_0x3b1892){_0x4528cf=_0x4528cf-0x0;var _0x4bca53=_0xcb3e[_0x4528cf];return _0x4bca53;};'use strict';var FaxMessageEvents=require(_0xecb3('0x0'));var events=['save',_0xecb3('0x1'),_0xecb3('0x2')];function createListener(_0x1d8689,_0x2e686f){return function(_0x587dae){_0x2e686f[_0xecb3('0x3')](_0x1d8689,_0x587dae);};}function removeListener(_0x1c4ad5,_0x476f99){return function(){FaxMessageEvents[_0xecb3('0x4')](_0x1c4ad5,_0x476f99);};}exports[_0xecb3('0x5')]=function(_0x2a7840){for(var _0x55bb33=0x0,_0x1e8f9c=events['length'];_0x55bb33<_0x1e8f9c;_0x55bb33++){var _0xe5b244=events[_0x55bb33];var _0x246b74=createListener('faxMessage:'+_0xe5b244,_0x2a7840);FaxMessageEvents['on'](_0xe5b244,_0x246b74);}}; \ No newline at end of file +var _0x690e=['emit','removeListener','length','faxMessage:','save'];(function(_0x420be7,_0x2c1b41){var _0x5ba75d=function(_0x5bbe1b){while(--_0x5bbe1b){_0x420be7['push'](_0x420be7['shift']());}};_0x5ba75d(++_0x2c1b41);}(_0x690e,0x13f));var _0xe690=function(_0x2754bb,_0x4b1cd5){_0x2754bb=_0x2754bb-0x0;var _0x5e0fea=_0x690e[_0x2754bb];return _0x5e0fea;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xe690('0x0'),'remove','update'];function createListener(_0x363d2f,_0x351e6f){return function(_0x51f10f){_0x351e6f[_0xe690('0x1')](_0x363d2f,_0x51f10f);};}function removeListener(_0x38437e,_0x46de2e){return function(){FaxMessageEvents[_0xe690('0x2')](_0x38437e,_0x46de2e);};}exports['register']=function(_0x504fcd){for(var _0x38db4a=0x0,_0x352717=events[_0xe690('0x3')];_0x38db4a<_0x352717;_0x38db4a++){var _0x25dfdf=events[_0x38db4a];var _0x528eff=createListener(_0xe690('0x4')+_0x25dfdf,_0x504fcd);FaxMessageEvents['on'](_0x25dfdf,_0x528eff);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f4f53c8..f6db995 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 _0x22fb=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','update','put','/:id/accept','accept','delete'];(function(_0xefb33e,_0x11bbb5){var _0x529db6=function(_0x4439ea){while(--_0x4439ea){_0xefb33e['push'](_0xefb33e['shift']());}};_0x529db6(++_0x11bbb5);}(_0x22fb,0x192));var _0xb22f=function(_0x2a6b92,_0x3119d0){_0x2a6b92=_0x2a6b92-0x0;var _0x162d02=_0x22fb[_0x2a6b92];return _0x162d02;};'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('0x7')](_0xb22f('0xe'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')]('/',auth[_0xb22f('0x8')](),interaction['tracked']('fax','faxmessage:create'),controller[_0xb22f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb22f('0x12')]);router[_0xb22f('0x13')](_0xb22f('0x14'),auth[_0xb22f('0x8')](),controller[_0xb22f('0x15')]);router[_0xb22f('0x13')]('/:id/reject',auth[_0xb22f('0x8')](),controller['reject']);router[_0xb22f('0x16')]('/:id',auth[_0xb22f('0x8')](),controller[_0xb22f('0x17')]);module[_0xb22f('0x18')]=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','download','post','tracked','fax','faxmessage:create','create','/:id','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x409fcd,_0x25aef2){var _0x14dda3=function(_0x2557e6){while(--_0x2557e6){_0x409fcd['push'](_0x409fcd['shift']());}};_0x14dda3(++_0x25aef2);}(_0x6324,0x142));var _0x4632=function(_0x5be652,_0x129d44){_0x5be652=_0x5be652-0x0;var _0x3c89da=_0x6324[_0x5be652];return _0x3c89da;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxMessage.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/download',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/',auth[_0x4632('0x8')](),interaction[_0x4632('0xe')](_0x4632('0xf'),_0x4632('0x10')),controller[_0x4632('0x11')]);router['put'](_0x4632('0x12'),auth['isAuthenticated'](),controller[_0x4632('0x13')]);router[_0x4632('0x14')](_0x4632('0x15'),auth[_0x4632('0x8')](),controller['accept']);router[_0x4632('0x14')](_0x4632('0x16'),auth[_0x4632('0x8')](),controller[_0x4632('0x17')]);router[_0x4632('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0x19')]);module[_0x4632('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6ec18bf..b398d7d 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 _0x4d21=['exports','STRING','name','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x47137a,_0x5322a7){var _0x573b0a=function(_0x59b375){while(--_0x59b375){_0x47137a['push'](_0x47137a['shift']());}};_0x573b0a(++_0x5322a7);}(_0x4d21,0xc3));var _0x14d2=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x4d21[_0x3b711c];return _0x2685f0;};'use strict';var Sequelize=require(_0x14d2('0x0'));module[_0x14d2('0x1')]={'name':{'type':Sequelize[_0x14d2('0x2')],'unique':_0x14d2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x14d2('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14d2('0x5')]('rrmemory','beepall',_0x14d2('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x14d2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5eca=['name','ENUM','roundrobin','INTEGER','sequelize','exports','STRING'];(function(_0x35027d,_0x3d97c1){var _0x537880=function(_0xd691f5){while(--_0xd691f5){_0x35027d['push'](_0x35027d['shift']());}};_0x537880(++_0x3d97c1);}(_0x5eca,0x10e));var _0xa5ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5eca[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xa5ec('0x0'));module[_0xa5ec('0x1')]={'name':{'type':Sequelize[_0xa5ec('0x2')],'unique':_0xa5ec('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa5ec('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa5ec('0x4')]('rrmemory','beepall',_0xa5ec('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa5ec('0x6')],'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 c65acfc..da0b303 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 _0xeda8=['push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','json','offset','undefined','limit','set','then','destroy','get','FaxQueues','UserProfileResource','status','sendStatus','name','index','map','FaxQueue','type','key','getOptions','where','count','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','filter','User','UserId','rows','format','%s/%s','SIP','faxPause','updatedAt','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeda8,0x104));var _0x8eda=function(_0x31e870,_0x165958){_0x31e870=_0x31e870-0x0;var _0x545c17=_0xeda8[_0x31e870];return _0x545c17;};'use strict';var BPromise=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var _=require('lodash');var squel=require(_0x8eda('0x2'));var Redis=require(_0x8eda('0x3'));var qs=require(_0x8eda('0x4'));var logger=require(_0x8eda('0x5'))(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var db=require(_0x8eda('0x8'))['db'];config[_0x8eda('0x9')]=_[_0x8eda('0xa')](config[_0x8eda('0x9')],{'host':_0x8eda('0xb'),'port':0x18eb});var socket=require(_0x8eda('0xc'))(new Redis(config['redis']));require(_0x8eda('0xd'))[_0x8eda('0xe')](socket);function respondWithStatusCode(_0x5aa93d,_0x6b544f){_0x6b544f=_0x6b544f||0xcc;return function(_0x4be9df){if(_0x4be9df){return _0x5aa93d['sendStatus'](_0x6b544f);}return _0x5aa93d['status'](_0x6b544f)['end']();};}function respondWithResult(_0xe69181,_0x2d3739){_0x2d3739=_0x2d3739||0xc8;return function(_0x41442d){if(_0x41442d){return _0xe69181['status'](_0x2d3739)[_0x8eda('0xf')](_0x41442d);}};}function respondWithFilteredResult(_0x5a80ca,_0x3f34c){return function(_0x36689a){if(_0x36689a){var _0x2fdec0=typeof _0x3f34c[_0x8eda('0x10')]===_0x8eda('0x11')&&typeof _0x3f34c[_0x8eda('0x12')]===_0x8eda('0x11');var _0x24ea76=_0x36689a['count'];var _0x500bd4=_0x2fdec0?0x0:_0x3f34c[_0x8eda('0x10')];var _0x223dcf=_0x2fdec0?_0x36689a['count']:_0x3f34c[_0x8eda('0x10')]+_0x3f34c[_0x8eda('0x12')];var _0x123905;if(_0x223dcf>=_0x24ea76){_0x223dcf=_0x24ea76;_0x123905=0xc8;}else{_0x123905=0xce;}_0x5a80ca['status'](_0x123905);return _0x5a80ca[_0x8eda('0x13')]('Content-Range',_0x500bd4+'-'+_0x223dcf+'/'+_0x24ea76)[_0x8eda('0xf')](_0x36689a);}return null;};}function saveUpdates(_0x553382){return function(_0x24aed4){if(_0x24aed4){return _0x24aed4['update'](_0x553382)[_0x8eda('0x14')](function(_0x2a4d2b){return _0x2a4d2b;});}return null;};}function removeEntity(_0x496c77){return function(_0x5e44b7){if(_0x5e44b7){return _0x5e44b7[_0x8eda('0x15')]()[_0x8eda('0x14')](function(){var _0x1b089d=_0x5e44b7[_0x8eda('0x16')]({'plain':!![]});var _0x110f36=_0x8eda('0x17');return db[_0x8eda('0x18')][_0x8eda('0x15')]({'where':{'type':_0x110f36,'resourceId':_0x1b089d['id']}})[_0x8eda('0x14')](function(){return _0x5e44b7;});})[_0x8eda('0x14')](function(){_0x496c77[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33143e){return function(_0x4f8483){if(!_0x4f8483){_0x33143e[_0x8eda('0x1a')](0x194);}return _0x4f8483;};}function handleError(_0x5183bc,_0x1033d6){_0x1033d6=_0x1033d6||0x1f4;return function(_0x2dab25){logger['error'](_0x2dab25['stack']);if(_0x2dab25['name']){delete _0x2dab25[_0x8eda('0x1b')];}_0x5183bc[_0x8eda('0x19')](_0x1033d6)['send'](_0x2dab25);};}exports[_0x8eda('0x1c')]=function(_0x37a8ab,_0x54aa7f){var _0x25e955={};var _0xfa57ca={'count':0x0,'rows':[]};var _0x24b1e1=_[_0x8eda('0x1d')](db[_0x8eda('0x1e')]['rawAttributes'],function(_0x41b5a9){return{'name':_0x41b5a9['fieldName'],'type':_0x41b5a9[_0x8eda('0x1f')][_0x8eda('0x20')]};});_0x25e955=qs[_0x8eda('0x21')](_0x24b1e1,_0x37a8ab);var _0x567f69={'where':_0x25e955[_0x8eda('0x22')]};return db[_0x8eda('0x1e')][_0x8eda('0x23')](_0x567f69)['then'](function(_0x1616ea){_0xfa57ca[_0x8eda('0x23')]=_0x1616ea;_0x25e955['include']=qs[_0x8eda('0x24')](_0x37a8ab[_0x8eda('0x25')]);return db[_0x8eda('0x1e')][_0x8eda('0x26')](_0x25e955);})['then'](function(_0x58dd55){_0xfa57ca['rows']=_0x58dd55;return _0xfa57ca;})[_0x8eda('0x14')](respondWithFilteredResult(_0x54aa7f,_0x25e955))[_0x8eda('0x27')](handleError(_0x54aa7f,null));};exports[_0x8eda('0x28')]=function(_0x540690,_0x4a9ee2){var _0x5b45c1={'raw':!![],'where':{'id':_0x540690[_0x8eda('0x29')]['id']}},_0x244da0={};_0x244da0[_0x8eda('0x2a')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x244da0[_0x8eda('0x25')]=_[_0x8eda('0x2b')](_0x540690[_0x8eda('0x25')]);_0x244da0[_0x8eda('0x2c')]=_[_0x8eda('0x2d')](_0x244da0[_0x8eda('0x2a')],_0x244da0[_0x8eda('0x25')]);_0x5b45c1[_0x8eda('0x2e')]=_[_0x8eda('0x2d')](_0x244da0[_0x8eda('0x2a')],qs[_0x8eda('0x2f')](_0x540690[_0x8eda('0x25')][_0x8eda('0x2f')]));_0x5b45c1[_0x8eda('0x2e')]=_0x5b45c1['attributes'][_0x8eda('0x30')]?_0x5b45c1[_0x8eda('0x2e')]:_0x244da0[_0x8eda('0x2a')];if(_0x540690['query']['includeAll']){_0x5b45c1[_0x8eda('0x24')]=[{'all':!![]}];}_0x5b45c1=_[_0x8eda('0x31')]({},_0x5b45c1,_0x540690[_0x8eda('0x32')]);return db[_0x8eda('0x1e')]['find'](_0x5b45c1)[_0x8eda('0x14')](handleEntityNotFound(_0x4a9ee2,null))[_0x8eda('0x14')](respondWithResult(_0x4a9ee2,null))[_0x8eda('0x27')](handleError(_0x4a9ee2,null));};exports[_0x8eda('0x33')]=function(_0x567aa6,_0x29a706){return db['FaxQueue'][_0x8eda('0x33')](_0x567aa6[_0x8eda('0x34')],{})[_0x8eda('0x14')](function(_0x3b6585){var _0x261e12=_0x567aa6[_0x8eda('0x35')]['get']({'plain':!![]});if(!_0x261e12)throw new Error(_0x8eda('0x36'));if(_0x261e12[_0x8eda('0x37')]===_0x8eda('0x35')){var _0x3b8527=_0x3b6585[_0x8eda('0x16')]({'plain':!![]});var _0x5cf565=_0x8eda('0x17');return db[_0x8eda('0x38')][_0x8eda('0x39')]({'where':{'name':_0x5cf565,'userProfileId':_0x261e12['userProfileId']},'raw':!![]})[_0x8eda('0x14')](function(_0x5d361e){if(_0x5d361e&&_0x5d361e[_0x8eda('0x3a')]===0x0){return db[_0x8eda('0x18')][_0x8eda('0x33')]({'name':_0x3b8527[_0x8eda('0x1b')],'resourceId':_0x3b8527['id'],'type':_0x5d361e[_0x8eda('0x1b')],'sectionId':_0x5d361e['id']},{})['then'](function(){return _0x3b6585;});}else{return _0x3b6585;}})['catch'](function(_0xbf14a1){logger[_0x8eda('0x3b')](_0x8eda('0x3c'),_0xbf14a1);throw _0xbf14a1;});}return _0x3b6585;})[_0x8eda('0x14')](respondWithResult(_0x29a706,0xc9))[_0x8eda('0x27')](handleError(_0x29a706,null));};exports[_0x8eda('0x3d')]=function(_0x18b043,_0xcb6164){if(_0x18b043[_0x8eda('0x34')]['id']){delete _0x18b043[_0x8eda('0x34')]['id'];}return db[_0x8eda('0x1e')][_0x8eda('0x39')]({'where':{'id':_0x18b043[_0x8eda('0x29')]['id']}})[_0x8eda('0x14')](handleEntityNotFound(_0xcb6164,null))[_0x8eda('0x14')](saveUpdates(_0x18b043[_0x8eda('0x34')],null))[_0x8eda('0x14')](respondWithResult(_0xcb6164,null))[_0x8eda('0x27')](handleError(_0xcb6164,null));};exports[_0x8eda('0x15')]=function(_0x55eb65,_0x3711f8){return db[_0x8eda('0x1e')]['find']({'where':{'id':_0x55eb65[_0x8eda('0x29')]['id']}})[_0x8eda('0x14')](handleEntityNotFound(_0x3711f8,null))['then'](removeEntity(_0x3711f8,null))[_0x8eda('0x27')](handleError(_0x3711f8,null));};exports[_0x8eda('0x3e')]=function(_0x51f2a3,_0x307aae){return db[_0x8eda('0x1e')][_0x8eda('0x3e')]()['then'](respondWithResult(_0x307aae,null))[_0x8eda('0x27')](handleError(_0x307aae,null));};exports[_0x8eda('0x3f')]=function(_0x3996b7,_0xd8b8f4){var _0x1fb1a8={'raw':!![],'where':{}},_0x36770a={},_0x2ce641;return db['FaxQueue'][_0x8eda('0x40')]({'where':{'id':_0x3996b7['params']['id']}})[_0x8eda('0x14')](handleEntityNotFound(_0xd8b8f4,null))['then'](function(_0x1a64e8){if(_0x1a64e8){_0x2ce641=_0x1a64e8['get']({'plain':!![]});_0x36770a[_0x8eda('0x2a')]=_['keys'](db[_0x8eda('0x41')][_0x8eda('0x42')]);_0x36770a[_0x8eda('0x25')]=_[_0x8eda('0x2b')](_0x3996b7[_0x8eda('0x25')]);_0x36770a[_0x8eda('0x2c')]=_[_0x8eda('0x2d')](_0x36770a[_0x8eda('0x2a')],_0x36770a[_0x8eda('0x25')]);_0x1fb1a8[_0x8eda('0x2e')]=_[_0x8eda('0x2d')](_0x36770a[_0x8eda('0x2a')],qs['fields'](_0x3996b7[_0x8eda('0x25')][_0x8eda('0x2f')]));_0x1fb1a8[_0x8eda('0x2e')]=_0x1fb1a8[_0x8eda('0x2e')][_0x8eda('0x30')]?_0x1fb1a8[_0x8eda('0x2e')]:_0x36770a[_0x8eda('0x2a')];if(!_0x3996b7[_0x8eda('0x25')][_0x8eda('0x43')](_0x8eda('0x44'))){_0x1fb1a8[_0x8eda('0x12')]=qs[_0x8eda('0x12')](_0x3996b7[_0x8eda('0x25')][_0x8eda('0x12')]);_0x1fb1a8[_0x8eda('0x10')]=qs['offset'](_0x3996b7[_0x8eda('0x25')][_0x8eda('0x10')]);}_0x1fb1a8[_0x8eda('0x45')]=qs[_0x8eda('0x46')](_0x3996b7[_0x8eda('0x25')][_0x8eda('0x46')]);_0x1fb1a8['where']=qs[_0x8eda('0x2c')](_[_0x8eda('0x47')](_0x3996b7[_0x8eda('0x25')],_0x36770a['filters']));_0x1fb1a8[_0x8eda('0x22')]['FaxQueueId']=_0x1a64e8['id'];if(_0x3996b7[_0x8eda('0x25')][_0x8eda('0x48')]){_0x1fb1a8[_0x8eda('0x22')]=_['merge'](_0x1fb1a8[_0x8eda('0x22')],{'$or':_[_0x8eda('0x1d')](_0x1fb1a8[_0x8eda('0x2e')],function(_0x4ce70c){var _0x3d6378={};_0x3d6378[_0x4ce70c]={'$like':'%'+_0x3996b7[_0x8eda('0x25')][_0x8eda('0x48')]+'%'};return _0x3d6378;})});}_0x1fb1a8=_[_0x8eda('0x31')]({},_0x1fb1a8,_0x3996b7[_0x8eda('0x32')]);return db[_0x8eda('0x41')][_0x8eda('0x26')](_0x1fb1a8);}})[_0x8eda('0x14')](function(_0x3f1ca6){if(_0x3f1ca6){return db[_0x8eda('0x49')]['findAndCountAll']({'where':{'id':_[_0x8eda('0x1d')](_0x3f1ca6,_0x8eda('0x4a')),'role':'agent'},'attributes':['id',_0x8eda('0x1b'),'faxPause','updatedAt','createdAt']});}})['then'](function(_0x4b24e1){if(_0x4b24e1){return{'count':_0x4b24e1[_0x8eda('0x23')],'rows':_['map'](_0x4b24e1[_0x8eda('0x4b')],function(_0x1d2b58){return{'membername':_0x1d2b58[_0x8eda('0x1b')],'UserId':_0x1d2b58['id'],'queue_name':_0x2ce641[_0x8eda('0x1b')],'FaxQueueId':_0x2ce641['id'],'interface':util[_0x8eda('0x4c')](_0x8eda('0x4d'),_0x8eda('0x4e'),_0x1d2b58['name']),'penalty':0x0,'paused':_0x1d2b58[_0x8eda('0x4f')],'createdAt':_0x1d2b58['createdAt'],'updatedAt':_0x1d2b58[_0x8eda('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xd8b8f4,_0x1fb1a8))[_0x8eda('0x27')](handleError(_0xd8b8f4,null));};exports['getTeams']=function(_0x31b5ba,_0x147942){var _0x2699f5={};var _0x48a66d={};var _0x589fbe;var _0x55d642;return db[_0x8eda('0x1e')][_0x8eda('0x40')]({'where':{'id':_0x31b5ba['params']['id']}})[_0x8eda('0x14')](handleEntityNotFound(_0x147942,null))['then'](function(_0x52bb01){if(_0x52bb01){_0x589fbe=_0x52bb01;_0x48a66d[_0x8eda('0x2a')]=_[_0x8eda('0x2b')](db[_0x8eda('0x51')][_0x8eda('0x42')]);_0x48a66d['query']=_['keys'](_0x31b5ba[_0x8eda('0x25')]);_0x48a66d[_0x8eda('0x2c')]=_[_0x8eda('0x2d')](_0x48a66d[_0x8eda('0x2a')],_0x48a66d['query']);_0x2699f5[_0x8eda('0x2e')]=_['intersection'](_0x48a66d[_0x8eda('0x2a')],qs['fields'](_0x31b5ba[_0x8eda('0x25')]['fields']));_0x2699f5[_0x8eda('0x2e')]=_0x2699f5[_0x8eda('0x2e')][_0x8eda('0x30')]?_0x2699f5[_0x8eda('0x2e')]:_0x48a66d[_0x8eda('0x2a')];_0x2699f5[_0x8eda('0x45')]=qs[_0x8eda('0x46')](_0x31b5ba[_0x8eda('0x25')][_0x8eda('0x46')]);_0x2699f5['where']=qs['filters'](_[_0x8eda('0x47')](_0x31b5ba['query'],_0x48a66d[_0x8eda('0x2c')]));if(_0x31b5ba[_0x8eda('0x25')][_0x8eda('0x48')]){_0x2699f5[_0x8eda('0x22')]=_[_0x8eda('0x31')](_0x2699f5['where'],{'$or':_['map'](_0x2699f5[_0x8eda('0x2e')],function(_0x1ad3e1){var _0x423df5={};_0x423df5[_0x1ad3e1]={'$like':'%'+_0x31b5ba[_0x8eda('0x25')][_0x8eda('0x48')]+'%'};return _0x423df5;})});}_0x2699f5=_[_0x8eda('0x31')]({},_0x2699f5,_0x31b5ba[_0x8eda('0x32')]);return _0x589fbe['getTeams'](_0x2699f5);}})[_0x8eda('0x14')](function(_0x4dabf6){if(_0x4dabf6){_0x55d642=_0x4dabf6['length'];if(!_0x31b5ba[_0x8eda('0x25')]['hasOwnProperty']('nolimit')){_0x2699f5['limit']=qs['limit'](_0x31b5ba[_0x8eda('0x25')][_0x8eda('0x12')]);_0x2699f5[_0x8eda('0x10')]=qs[_0x8eda('0x10')](_0x31b5ba[_0x8eda('0x25')][_0x8eda('0x10')]);}return _0x589fbe['getTeams'](_0x2699f5);}})[_0x8eda('0x14')](function(_0x2ec7c1){if(_0x2ec7c1){return _0x2ec7c1?{'count':_0x55d642,'rows':_0x2ec7c1}:null;}})[_0x8eda('0x14')](respondWithResult(_0x147942,null))[_0x8eda('0x27')](handleError(_0x147942,null));};exports['addTeams']=function(_0x3d7746,_0x16e3fd){var _0x235246=_0x3d7746[_0x8eda('0x34')][_0x8eda('0x52')];return db[_0x8eda('0x51')]['findAll']({'where':{'id':_0x235246},'attributes':['id'],'include':[{'model':db[_0x8eda('0x49')],'as':_0x8eda('0x53'),'attributes':['id',_0x8eda('0x1b'),_0x8eda('0x54'),_0x8eda('0x55'),_0x8eda('0x56')],'raw':!![]}]})[_0x8eda('0x14')](function(_0x3f3ec5){if(_0x3f3ec5){var _0x3119bc=_[_0x8eda('0x57')](_0x3f3ec5,function(_0x2bdceb){var _0xd84c42=_0x2bdceb[_0x8eda('0x16')]({'plain':!![]});return _0xd84c42[_0x8eda('0x53')];});return db['FaxQueue']['find']({'where':{'id':_0x3d7746[_0x8eda('0x29')]['id']}})[_0x8eda('0x14')](function(_0x1b43c0){return db[_0x8eda('0x58')]['transaction'](function(_0x23d64f){return _0x1b43c0[_0x8eda('0x59')](_0x235246,{'transaction':_0x23d64f})['then'](function(){return BPromise[_0x8eda('0x5a')](_0x3119bc,function(_0x5f0d26){return db[_0x8eda('0x41')][_0x8eda('0x5b')]({'where':{'UserId':_0x5f0d26['id'],'FaxQueueId':_0x3d7746[_0x8eda('0x29')]['id']},'transaction':_0x23d64f});});})['then'](function(){_0x3119bc[_0x8eda('0x5c')](function(_0x3f289c){socket[_0x8eda('0x5d')]('userFaxQueue:save',{'UserId':_0x3f289c['id'],'FaxQueueId':_0x1b43c0['id']});});});});});}})[_0x8eda('0x14')](respondWithStatusCode(_0x16e3fd,null))[_0x8eda('0x27')](handleError(_0x16e3fd,null));};exports[_0x8eda('0x5e')]=function(_0x2f30af,_0x4d7bca){return db['Team'][_0x8eda('0x26')]({'where':{'id':_0x2f30af[_0x8eda('0x25')][_0x8eda('0x52')]},'attributes':['id'],'include':[{'model':db[_0x8eda('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8eda('0x14')](handleEntityNotFound(_0x4d7bca,null))[_0x8eda('0x14')](function(_0x1aca01){var _0x42e6aa=_[_0x8eda('0x1d')](_0x1aca01,'id');var _0x4fb714=[];var _0x2cec88=[];var _0x1a32dd=squel[_0x8eda('0x5f')]();_0x1a32dd['field']('tq.TeamId')['from'](_0x8eda('0x60'),'tq')[_0x8eda('0x61')](_0x8eda('0x62'),'ut',_0x8eda('0x63'))[_0x8eda('0x22')](_0x8eda('0x64'),_0x2f30af[_0x8eda('0x29')]['id']);for(var _0x3f700a=0x0;_0x3f700a<_0x1aca01['length'];_0x3f700a+=0x1){let _0x1bbe8b=_0x1aca01[_0x3f700a];for(var _0x437c6f=0x0;_0x437c6f<_0x1bbe8b[_0x8eda('0x53')]['length'];_0x437c6f+=0x1){let _0x327c83=_0x1bbe8b[_0x8eda('0x53')][_0x437c6f];var _0x3095bd=_0x1a32dd[_0x8eda('0x65')]();_0x3095bd[_0x8eda('0x22')](_0x8eda('0x66'),_0x327c83['id']);_0x2cec88[_0x8eda('0x67')](db[_0x8eda('0x58')][_0x8eda('0x25')](_0x3095bd[_0x8eda('0x68')](),{'type':db[_0x8eda('0x58')]['QueryTypes'][_0x8eda('0x69')]})[_0x8eda('0x14')](function(_0xaf5c4a){if(_0xaf5c4a[_0x8eda('0x30')]===0x1){return _0x327c83['id'];}else{var _0x258c51=_[_0x8eda('0x6a')](_[_0x8eda('0x1d')](_0xaf5c4a,_0x8eda('0x6b')),function(_0x177e66){return _[_0x8eda('0x6c')](_0x42e6aa,_0x177e66);});if(_0x258c51){return _0x327c83['id'];}}}));}}return BPromise[_0x8eda('0x6d')](_0x2cec88)['then'](function(_0x513b25){_0x4fb714=_(_0x4fb714)['union'](_0x513b25)[_0x8eda('0x6e')]()[_0x8eda('0x6f')]();return db['FaxQueue'][_0x8eda('0x39')]({'where':{'id':_0x2f30af[_0x8eda('0x29')]['id']}})[_0x8eda('0x14')](function(_0x4d6bb4){return db[_0x8eda('0x58')]['transaction'](function(_0x4434c6){return _0x4d6bb4['removeTeams'](_0x2f30af[_0x8eda('0x25')][_0x8eda('0x52')],{'transaction':_0x4434c6})['then'](function(){if(!_[_0x8eda('0x70')](_0x4fb714)){return _0x4d6bb4[_0x8eda('0x71')](_0x4fb714,{'transaction':_0x4434c6});}})[_0x8eda('0x14')](function(){_0x4fb714[_0x8eda('0x5c')](function(_0x128cbd){socket[_0x8eda('0x5d')](_0x8eda('0x72'),{'UserId':_0x128cbd,'FaxQueueId':_0x4d6bb4['id']});});});});});});})[_0x8eda('0x14')](respondWithStatusCode(_0x4d7bca,null))[_0x8eda('0x27')](handleError(_0x4d7bca,null));};exports[_0x8eda('0x73')]=function(_0x5566f2,_0x5e7f48){return db['FaxQueue']['find']({'where':{'id':_0x5566f2[_0x8eda('0x29')]['id']}})[_0x8eda('0x14')](handleEntityNotFound(_0x5e7f48,null))[_0x8eda('0x14')](function(_0x599757){if(_0x599757){return _0x599757[_0x8eda('0x73')](_0x5566f2[_0x8eda('0x34')][_0x8eda('0x52')],_[_0x8eda('0x74')](_0x5566f2[_0x8eda('0x34')],[_0x8eda('0x52'),'id'])||{})[_0x8eda('0x75')](function(_0x2402ac){for(var _0x48ff62=0x0;_0x48ff62<_0x5566f2['body'][_0x8eda('0x52')][_0x8eda('0x30')];_0x48ff62+=0x1){socket['emit'](_0x8eda('0x76'),{'UserId':Number(_0x5566f2[_0x8eda('0x34')][_0x8eda('0x52')][_0x48ff62]),'FaxQueueId':Number(_0x5566f2['params']['id'])});}return _0x2402ac;});}})[_0x8eda('0x14')](respondWithResult(_0x5e7f48,null))[_0x8eda('0x27')](handleError(_0x5e7f48,null));};exports[_0x8eda('0x71')]=function(_0x1838b1,_0x1edd9f){return db[_0x8eda('0x1e')][_0x8eda('0x39')]({'where':{'id':_0x1838b1['params']['id']}})[_0x8eda('0x14')](handleEntityNotFound(_0x1edd9f,null))[_0x8eda('0x14')](function(_0x4cb4e6){if(_0x4cb4e6){return _0x4cb4e6['removeAgents'](_0x1838b1['query'][_0x8eda('0x52')])[_0x8eda('0x14')](function(){if(_[_0x8eda('0x77')](_0x1838b1[_0x8eda('0x25')][_0x8eda('0x52')])){for(var _0x1ebc2b=0x0;_0x1ebc2b<_0x1838b1[_0x8eda('0x25')][_0x8eda('0x52')][_0x8eda('0x30')];_0x1ebc2b+=0x1){socket[_0x8eda('0x5d')](_0x8eda('0x72'),{'UserId':Number(_0x1838b1[_0x8eda('0x25')][_0x8eda('0x52')][_0x1ebc2b]),'FaxQueueId':Number(_0x1838b1[_0x8eda('0x29')]['id'])});}}else{socket['emit'](_0x8eda('0x72'),{'UserId':Number(_0x1838b1[_0x8eda('0x25')][_0x8eda('0x52')]),'FaxQueueId':Number(_0x1838b1[_0x8eda('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x1edd9f,null))[_0x8eda('0x27')](handleError(_0x1edd9f,null));};exports[_0x8eda('0x78')]=function(_0x232df2,_0x2596eb){var _0x4732be={};var _0x59690b={};var _0x447936;var _0x2222bb;return db[_0x8eda('0x1e')][_0x8eda('0x40')]({'where':{'id':_0x232df2['params']['id']}})['then'](handleEntityNotFound(_0x2596eb,null))[_0x8eda('0x14')](function(_0x22a4cd){if(_0x22a4cd){_0x447936=_0x22a4cd;_0x59690b[_0x8eda('0x2a')]=_[_0x8eda('0x2b')](db['User'][_0x8eda('0x42')]);_0x59690b[_0x8eda('0x25')]=_[_0x8eda('0x2b')](_0x232df2[_0x8eda('0x25')]);_0x59690b[_0x8eda('0x2c')]=_[_0x8eda('0x2d')](_0x59690b[_0x8eda('0x2a')],_0x59690b[_0x8eda('0x25')]);_0x4732be['attributes']=_[_0x8eda('0x2d')](_0x59690b[_0x8eda('0x2a')],qs[_0x8eda('0x2f')](_0x232df2[_0x8eda('0x25')][_0x8eda('0x2f')]));_0x4732be[_0x8eda('0x2e')]=_0x4732be[_0x8eda('0x2e')][_0x8eda('0x30')]?_0x4732be[_0x8eda('0x2e')]:_0x59690b[_0x8eda('0x2a')];_0x4732be['order']=qs[_0x8eda('0x46')](_0x232df2[_0x8eda('0x25')][_0x8eda('0x46')]);_0x4732be['where']=qs[_0x8eda('0x2c')](_['pick'](_0x232df2['query'],_0x59690b['filters']));if(_0x232df2[_0x8eda('0x25')][_0x8eda('0x48')]){_0x4732be['where']=_[_0x8eda('0x31')](_0x4732be[_0x8eda('0x22')],{'$or':_['map'](_0x4732be[_0x8eda('0x2e')],function(_0x16860f){var _0x5c6183={};_0x5c6183[_0x16860f]={'$like':'%'+_0x232df2['query'][_0x8eda('0x48')]+'%'};return _0x5c6183;})});}_0x4732be=_['merge']({},_0x4732be,_0x232df2['options']);return _0x447936[_0x8eda('0x78')](_0x4732be);}})[_0x8eda('0x14')](function(_0x53bda5){if(_0x53bda5){_0x2222bb=_0x53bda5[_0x8eda('0x30')];if(!_0x232df2[_0x8eda('0x25')][_0x8eda('0x43')]('nolimit')){_0x4732be['limit']=qs[_0x8eda('0x12')](_0x232df2['query']['limit']);_0x4732be['offset']=qs[_0x8eda('0x10')](_0x232df2['query'][_0x8eda('0x10')]);}return _0x447936[_0x8eda('0x78')](_0x4732be);}})[_0x8eda('0x14')](function(_0x14ad01){if(_0x14ad01){return _0x14ad01?{'count':_0x2222bb,'rows':_0x14ad01}:null;}})[_0x8eda('0x14')](respondWithResult(_0x2596eb,null))[_0x8eda('0x27')](handleError(_0x2596eb,null));}; \ No newline at end of file +var _0x2d2c=['undefined','count','limit','set','Content-Range','json','update','destroy','get','FaxQueues','UserProfileResource','then','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','findOne','nolimit','sort','where','pick','FaxQueueId','filter','findAll','User','agent','createdAt','%s/%s','SIP','faxPause','updatedAt','Team','order','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','UserFaxQueue','findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','compact','value','removeAgents','addAgents','omit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','offset'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x2d2c[_0x2d994d];return _0xd54be4;};'use strict';var BPromise=require(_0xc2d2('0x0'));var util=require(_0xc2d2('0x1'));var _=require(_0xc2d2('0x2'));var squel=require(_0xc2d2('0x3'));var Redis=require(_0xc2d2('0x4'));var qs=require(_0xc2d2('0x5'));var logger=require('../../config/logger')(_0xc2d2('0x6'));var config=require('../../config/environment');var db=require(_0xc2d2('0x7'))['db'];config[_0xc2d2('0x8')]=_[_0xc2d2('0x9')](config[_0xc2d2('0x8')],{'host':_0xc2d2('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc2d2('0xb'))[_0xc2d2('0xc')](socket);function respondWithStatusCode(_0x2ebe63,_0x40ce0d){_0x40ce0d=_0x40ce0d||0xcc;return function(_0x1819af){if(_0x1819af){return _0x2ebe63[_0xc2d2('0xd')](_0x40ce0d);}return _0x2ebe63[_0xc2d2('0xe')](_0x40ce0d)[_0xc2d2('0xf')]();};}function respondWithResult(_0x43ecff,_0x1c1d9a){_0x1c1d9a=_0x1c1d9a||0xc8;return function(_0x2f247a){if(_0x2f247a){return _0x43ecff[_0xc2d2('0xe')](_0x1c1d9a)['json'](_0x2f247a);}};}function respondWithFilteredResult(_0x27eb6b,_0x13a247){return function(_0x1e0cbc){if(_0x1e0cbc){var _0x57e318=typeof _0x13a247[_0xc2d2('0x10')]===_0xc2d2('0x11')&&typeof _0x13a247['limit']===_0xc2d2('0x11');var _0x1db3d2=_0x1e0cbc['count'];var _0xa6f836=_0x57e318?0x0:_0x13a247['offset'];var _0x5a1d24=_0x57e318?_0x1e0cbc[_0xc2d2('0x12')]:_0x13a247[_0xc2d2('0x10')]+_0x13a247[_0xc2d2('0x13')];var _0x4006f3;if(_0x5a1d24>=_0x1db3d2){_0x5a1d24=_0x1db3d2;_0x4006f3=0xc8;}else{_0x4006f3=0xce;}_0x27eb6b[_0xc2d2('0xe')](_0x4006f3);return _0x27eb6b[_0xc2d2('0x14')](_0xc2d2('0x15'),_0xa6f836+'-'+_0x5a1d24+'/'+_0x1db3d2)[_0xc2d2('0x16')](_0x1e0cbc);}return null;};}function saveUpdates(_0x34f5a9){return function(_0x19fd0d){if(_0x19fd0d){return _0x19fd0d[_0xc2d2('0x17')](_0x34f5a9)['then'](function(_0x2d4ec4){return _0x2d4ec4;});}return null;};}function removeEntity(_0x296ca3){return function(_0x34f750){if(_0x34f750){return _0x34f750[_0xc2d2('0x18')]()['then'](function(){var _0x31c213=_0x34f750[_0xc2d2('0x19')]({'plain':!![]});var _0x5c8e79=_0xc2d2('0x1a');return db[_0xc2d2('0x1b')][_0xc2d2('0x18')]({'where':{'type':_0x5c8e79,'resourceId':_0x31c213['id']}})[_0xc2d2('0x1c')](function(){return _0x34f750;});})[_0xc2d2('0x1c')](function(){_0x296ca3['status'](0xcc)[_0xc2d2('0xf')]();});}};}function handleEntityNotFound(_0x2af5b0){return function(_0x4c84e0){if(!_0x4c84e0){_0x2af5b0[_0xc2d2('0xd')](0x194);}return _0x4c84e0;};}function handleError(_0x4e3cb5,_0x5ecf78){_0x5ecf78=_0x5ecf78||0x1f4;return function(_0x588342){logger[_0xc2d2('0x1d')](_0x588342[_0xc2d2('0x1e')]);if(_0x588342[_0xc2d2('0x1f')]){delete _0x588342['name'];}_0x4e3cb5[_0xc2d2('0xe')](_0x5ecf78)[_0xc2d2('0x20')](_0x588342);};}exports[_0xc2d2('0x21')]=function(_0xbb46df,_0x5532cd){var _0x25b201={};var _0x25e6af={'count':0x0,'rows':[]};var _0xf2ba15=_[_0xc2d2('0x22')](db[_0xc2d2('0x23')][_0xc2d2('0x24')],function(_0x49e955){return{'name':_0x49e955[_0xc2d2('0x25')],'type':_0x49e955[_0xc2d2('0x26')][_0xc2d2('0x27')]};});_0x25b201=qs[_0xc2d2('0x28')](_0xf2ba15,_0xbb46df);var _0x5bdeee={'where':_0x25b201['where']};return db[_0xc2d2('0x23')][_0xc2d2('0x12')](_0x5bdeee)[_0xc2d2('0x1c')](function(_0x21ca37){_0x25e6af[_0xc2d2('0x12')]=_0x21ca37;_0x25b201[_0xc2d2('0x29')]=qs['include'](_0xbb46df[_0xc2d2('0x2a')]);return db[_0xc2d2('0x23')]['findAll'](_0x25b201);})[_0xc2d2('0x1c')](function(_0x4344c7){_0x25e6af[_0xc2d2('0x2b')]=_0x4344c7;return _0x25e6af;})[_0xc2d2('0x1c')](respondWithFilteredResult(_0x5532cd,_0x25b201))[_0xc2d2('0x2c')](handleError(_0x5532cd,null));};exports['show']=function(_0x481afa,_0xcfe3dc){var _0x57cdec={'raw':!![],'where':{'id':_0x481afa[_0xc2d2('0x2d')]['id']}},_0x207f25={};_0x207f25[_0xc2d2('0x2e')]=_[_0xc2d2('0x2f')](db[_0xc2d2('0x23')]['rawAttributes']);_0x207f25[_0xc2d2('0x2a')]=_[_0xc2d2('0x2f')](_0x481afa[_0xc2d2('0x2a')]);_0x207f25[_0xc2d2('0x30')]=_[_0xc2d2('0x31')](_0x207f25[_0xc2d2('0x2e')],_0x207f25['query']);_0x57cdec[_0xc2d2('0x32')]=_[_0xc2d2('0x31')](_0x207f25['model'],qs[_0xc2d2('0x33')](_0x481afa['query'][_0xc2d2('0x33')]));_0x57cdec[_0xc2d2('0x32')]=_0x57cdec[_0xc2d2('0x32')][_0xc2d2('0x34')]?_0x57cdec[_0xc2d2('0x32')]:_0x207f25[_0xc2d2('0x2e')];if(_0x481afa[_0xc2d2('0x2a')][_0xc2d2('0x35')]){_0x57cdec['include']=[{'all':!![]}];}_0x57cdec=_[_0xc2d2('0x36')]({},_0x57cdec,_0x481afa[_0xc2d2('0x37')]);return db[_0xc2d2('0x23')][_0xc2d2('0x38')](_0x57cdec)['then'](handleEntityNotFound(_0xcfe3dc,null))[_0xc2d2('0x1c')](respondWithResult(_0xcfe3dc,null))[_0xc2d2('0x2c')](handleError(_0xcfe3dc,null));};exports[_0xc2d2('0x39')]=function(_0xf08b85,_0x4d1f25){return db[_0xc2d2('0x23')]['create'](_0xf08b85[_0xc2d2('0x3a')],{})[_0xc2d2('0x1c')](function(_0x5797d8){var _0xdbdce0=_0xf08b85[_0xc2d2('0x3b')][_0xc2d2('0x19')]({'plain':!![]});if(!_0xdbdce0)throw new Error(_0xc2d2('0x3c'));if(_0xdbdce0[_0xc2d2('0x3d')]===_0xc2d2('0x3b')){var _0x16bf47=_0x5797d8[_0xc2d2('0x19')]({'plain':!![]});var _0x450b5=_0xc2d2('0x1a');return db['UserProfileSection'][_0xc2d2('0x38')]({'where':{'name':_0x450b5,'userProfileId':_0xdbdce0[_0xc2d2('0x3e')]},'raw':!![]})['then'](function(_0xfd3ad4){if(_0xfd3ad4&&_0xfd3ad4[_0xc2d2('0x3f')]===0x0){return db[_0xc2d2('0x1b')]['create']({'name':_0x16bf47['name'],'resourceId':_0x16bf47['id'],'type':_0xfd3ad4['name'],'sectionId':_0xfd3ad4['id']},{})[_0xc2d2('0x1c')](function(){return _0x5797d8;});}else{return _0x5797d8;}})[_0xc2d2('0x2c')](function(_0x4031d0){logger[_0xc2d2('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4031d0);throw _0x4031d0;});}return _0x5797d8;})[_0xc2d2('0x1c')](respondWithResult(_0x4d1f25,0xc9))['catch'](handleError(_0x4d1f25,null));};exports['update']=function(_0x24544e,_0x2a987a){if(_0x24544e[_0xc2d2('0x3a')]['id']){delete _0x24544e['body']['id'];}return db[_0xc2d2('0x23')][_0xc2d2('0x38')]({'where':{'id':_0x24544e[_0xc2d2('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2a987a,null))[_0xc2d2('0x1c')](saveUpdates(_0x24544e['body'],null))[_0xc2d2('0x1c')](respondWithResult(_0x2a987a,null))[_0xc2d2('0x2c')](handleError(_0x2a987a,null));};exports[_0xc2d2('0x18')]=function(_0x14e98d,_0x32d82f){return db[_0xc2d2('0x23')]['find']({'where':{'id':_0x14e98d[_0xc2d2('0x2d')]['id']}})['then'](handleEntityNotFound(_0x32d82f,null))[_0xc2d2('0x1c')](removeEntity(_0x32d82f,null))[_0xc2d2('0x2c')](handleError(_0x32d82f,null));};exports[_0xc2d2('0x40')]=function(_0x236113,_0x28bdf0){return db['FaxQueue'][_0xc2d2('0x40')]()[_0xc2d2('0x1c')](respondWithResult(_0x28bdf0,null))['catch'](handleError(_0x28bdf0,null));};exports['getMembers']=function(_0x4b8e36,_0x484e69){var _0x24d542={'raw':!![],'where':{}},_0xdf685c={},_0x1d568d;return db[_0xc2d2('0x23')][_0xc2d2('0x41')]({'where':{'id':_0x4b8e36[_0xc2d2('0x2d')]['id']}})[_0xc2d2('0x1c')](handleEntityNotFound(_0x484e69,null))[_0xc2d2('0x1c')](function(_0x3aa6cb){if(_0x3aa6cb){_0x1d568d=_0x3aa6cb[_0xc2d2('0x19')]({'plain':!![]});_0xdf685c[_0xc2d2('0x2e')]=_[_0xc2d2('0x2f')](db['UserFaxQueue'][_0xc2d2('0x24')]);_0xdf685c[_0xc2d2('0x2a')]=_['keys'](_0x4b8e36[_0xc2d2('0x2a')]);_0xdf685c['filters']=_[_0xc2d2('0x31')](_0xdf685c[_0xc2d2('0x2e')],_0xdf685c[_0xc2d2('0x2a')]);_0x24d542[_0xc2d2('0x32')]=_['intersection'](_0xdf685c[_0xc2d2('0x2e')],qs[_0xc2d2('0x33')](_0x4b8e36[_0xc2d2('0x2a')][_0xc2d2('0x33')]));_0x24d542[_0xc2d2('0x32')]=_0x24d542[_0xc2d2('0x32')][_0xc2d2('0x34')]?_0x24d542[_0xc2d2('0x32')]:_0xdf685c[_0xc2d2('0x2e')];if(!_0x4b8e36['query']['hasOwnProperty'](_0xc2d2('0x42'))){_0x24d542[_0xc2d2('0x13')]=qs[_0xc2d2('0x13')](_0x4b8e36[_0xc2d2('0x2a')][_0xc2d2('0x13')]);_0x24d542['offset']=qs[_0xc2d2('0x10')](_0x4b8e36[_0xc2d2('0x2a')][_0xc2d2('0x10')]);}_0x24d542['order']=qs[_0xc2d2('0x43')](_0x4b8e36['query'][_0xc2d2('0x43')]);_0x24d542[_0xc2d2('0x44')]=qs[_0xc2d2('0x30')](_[_0xc2d2('0x45')](_0x4b8e36[_0xc2d2('0x2a')],_0xdf685c[_0xc2d2('0x30')]));_0x24d542[_0xc2d2('0x44')][_0xc2d2('0x46')]=_0x3aa6cb['id'];if(_0x4b8e36[_0xc2d2('0x2a')][_0xc2d2('0x47')]){_0x24d542[_0xc2d2('0x44')]=_[_0xc2d2('0x36')](_0x24d542[_0xc2d2('0x44')],{'$or':_[_0xc2d2('0x22')](_0x24d542[_0xc2d2('0x32')],function(_0x1619d7){var _0x367df7={};_0x367df7[_0x1619d7]={'$like':'%'+_0x4b8e36[_0xc2d2('0x2a')][_0xc2d2('0x47')]+'%'};return _0x367df7;})});}_0x24d542=_['merge']({},_0x24d542,_0x4b8e36['options']);return db['UserFaxQueue'][_0xc2d2('0x48')](_0x24d542);}})[_0xc2d2('0x1c')](function(_0x220a3a){if(_0x220a3a){return db[_0xc2d2('0x49')]['findAndCountAll']({'where':{'id':_['map'](_0x220a3a,'UserId'),'role':_0xc2d2('0x4a')},'attributes':['id',_0xc2d2('0x1f'),'faxPause','updatedAt',_0xc2d2('0x4b')]});}})[_0xc2d2('0x1c')](function(_0x263150){if(_0x263150){return{'count':_0x263150['count'],'rows':_[_0xc2d2('0x22')](_0x263150[_0xc2d2('0x2b')],function(_0x2978bd){return{'membername':_0x2978bd[_0xc2d2('0x1f')],'UserId':_0x2978bd['id'],'queue_name':_0x1d568d['name'],'FaxQueueId':_0x1d568d['id'],'interface':util['format'](_0xc2d2('0x4c'),_0xc2d2('0x4d'),_0x2978bd[_0xc2d2('0x1f')]),'penalty':0x0,'paused':_0x2978bd[_0xc2d2('0x4e')],'createdAt':_0x2978bd[_0xc2d2('0x4b')],'updatedAt':_0x2978bd[_0xc2d2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc2d2('0x1c')](respondWithFilteredResult(_0x484e69,_0x24d542))['catch'](handleError(_0x484e69,null));};exports['getTeams']=function(_0x2a5672,_0x5a6da8){var _0x5e3587={};var _0x3cc143={};var _0x272867;var _0x597cfc;return db[_0xc2d2('0x23')]['findOne']({'where':{'id':_0x2a5672['params']['id']}})[_0xc2d2('0x1c')](handleEntityNotFound(_0x5a6da8,null))[_0xc2d2('0x1c')](function(_0x3121e1){if(_0x3121e1){_0x272867=_0x3121e1;_0x3cc143['model']=_[_0xc2d2('0x2f')](db[_0xc2d2('0x50')]['rawAttributes']);_0x3cc143[_0xc2d2('0x2a')]=_['keys'](_0x2a5672[_0xc2d2('0x2a')]);_0x3cc143[_0xc2d2('0x30')]=_[_0xc2d2('0x31')](_0x3cc143['model'],_0x3cc143['query']);_0x5e3587[_0xc2d2('0x32')]=_['intersection'](_0x3cc143[_0xc2d2('0x2e')],qs['fields'](_0x2a5672['query']['fields']));_0x5e3587[_0xc2d2('0x32')]=_0x5e3587['attributes'][_0xc2d2('0x34')]?_0x5e3587['attributes']:_0x3cc143[_0xc2d2('0x2e')];_0x5e3587[_0xc2d2('0x51')]=qs[_0xc2d2('0x43')](_0x2a5672[_0xc2d2('0x2a')][_0xc2d2('0x43')]);_0x5e3587[_0xc2d2('0x44')]=qs['filters'](_[_0xc2d2('0x45')](_0x2a5672[_0xc2d2('0x2a')],_0x3cc143['filters']));if(_0x2a5672[_0xc2d2('0x2a')][_0xc2d2('0x47')]){_0x5e3587[_0xc2d2('0x44')]=_['merge'](_0x5e3587[_0xc2d2('0x44')],{'$or':_[_0xc2d2('0x22')](_0x5e3587['attributes'],function(_0x473bcd){var _0x4f6801={};_0x4f6801[_0x473bcd]={'$like':'%'+_0x2a5672[_0xc2d2('0x2a')][_0xc2d2('0x47')]+'%'};return _0x4f6801;})});}_0x5e3587=_[_0xc2d2('0x36')]({},_0x5e3587,_0x2a5672[_0xc2d2('0x37')]);return _0x272867['getTeams'](_0x5e3587);}})['then'](function(_0x367d18){if(_0x367d18){_0x597cfc=_0x367d18[_0xc2d2('0x34')];if(!_0x2a5672[_0xc2d2('0x2a')]['hasOwnProperty']('nolimit')){_0x5e3587['limit']=qs[_0xc2d2('0x13')](_0x2a5672[_0xc2d2('0x2a')]['limit']);_0x5e3587[_0xc2d2('0x10')]=qs[_0xc2d2('0x10')](_0x2a5672[_0xc2d2('0x2a')][_0xc2d2('0x10')]);}return _0x272867[_0xc2d2('0x52')](_0x5e3587);}})[_0xc2d2('0x1c')](function(_0x8643f7){if(_0x8643f7){return _0x8643f7?{'count':_0x597cfc,'rows':_0x8643f7}:null;}})[_0xc2d2('0x1c')](respondWithResult(_0x5a6da8,null))['catch'](handleError(_0x5a6da8,null));};exports['addTeams']=function(_0x1f7758,_0x6158cc){var _0x92eca6=_0x1f7758['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x92eca6},'attributes':['id'],'include':[{'model':db[_0xc2d2('0x49')],'as':_0xc2d2('0x53'),'attributes':['id',_0xc2d2('0x1f'),_0xc2d2('0x54'),_0xc2d2('0x55'),_0xc2d2('0x56')],'raw':!![]}]})[_0xc2d2('0x1c')](function(_0x19263c){if(_0x19263c){var _0x3584d4=_[_0xc2d2('0x57')](_0x19263c,function(_0xcdc0ad){var _0x72cfb2=_0xcdc0ad[_0xc2d2('0x19')]({'plain':!![]});return _0x72cfb2[_0xc2d2('0x53')];});return db[_0xc2d2('0x23')][_0xc2d2('0x38')]({'where':{'id':_0x1f7758['params']['id']}})[_0xc2d2('0x1c')](function(_0x5bd72b){return db[_0xc2d2('0x58')][_0xc2d2('0x59')](function(_0x31313e){return _0x5bd72b[_0xc2d2('0x5a')](_0x92eca6,{'transaction':_0x31313e})[_0xc2d2('0x1c')](function(){return BPromise[_0xc2d2('0x5b')](_0x3584d4,function(_0x35bb3c){return db[_0xc2d2('0x5c')][_0xc2d2('0x5d')]({'where':{'UserId':_0x35bb3c['id'],'FaxQueueId':_0x1f7758[_0xc2d2('0x2d')]['id']},'transaction':_0x31313e});});})['then'](function(){_0x3584d4['forEach'](function(_0x2d8f7d){socket[_0xc2d2('0x5e')]('userFaxQueue:save',{'UserId':_0x2d8f7d['id'],'FaxQueueId':_0x5bd72b['id']});});});});});}})[_0xc2d2('0x1c')](respondWithStatusCode(_0x6158cc,null))[_0xc2d2('0x2c')](handleError(_0x6158cc,null));};exports[_0xc2d2('0x5f')]=function(_0x5cb049,_0x269138){return db['Team'][_0xc2d2('0x48')]({'where':{'id':_0x5cb049['query'][_0xc2d2('0x60')]},'attributes':['id'],'include':[{'model':db[_0xc2d2('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc2d2('0x1c')](handleEntityNotFound(_0x269138,null))[_0xc2d2('0x1c')](function(_0x417837){var _0x35b34d=_[_0xc2d2('0x22')](_0x417837,'id');var _0x3ce167=[];var _0x4b27be=[];var _0x15cc48=squel[_0xc2d2('0x61')]();_0x15cc48[_0xc2d2('0x62')](_0xc2d2('0x63'))[_0xc2d2('0x64')](_0xc2d2('0x65'),'tq')['join']('user_has_teams','ut',_0xc2d2('0x66'))['where'](_0xc2d2('0x67'),_0x5cb049['params']['id']);for(var _0x3b63a0=0x0;_0x3b63a0<_0x417837['length'];_0x3b63a0+=0x1){let _0x20338b=_0x417837[_0x3b63a0];for(var _0x42fc6b=0x0;_0x42fc6b<_0x20338b['Agents'][_0xc2d2('0x34')];_0x42fc6b+=0x1){let _0x2e8674=_0x20338b[_0xc2d2('0x53')][_0x42fc6b];var _0x139b7f=_0x15cc48[_0xc2d2('0x68')]();_0x139b7f['where'](_0xc2d2('0x69'),_0x2e8674['id']);_0x4b27be['push'](db[_0xc2d2('0x58')]['query'](_0x139b7f[_0xc2d2('0x6a')](),{'type':db[_0xc2d2('0x58')][_0xc2d2('0x6b')][_0xc2d2('0x6c')]})[_0xc2d2('0x1c')](function(_0x38b1cf){if(_0x38b1cf[_0xc2d2('0x34')]===0x1){return _0x2e8674['id'];}else{var _0x168e52=_[_0xc2d2('0x6d')](_[_0xc2d2('0x22')](_0x38b1cf,'TeamId'),function(_0x1571c1){return _['includes'](_0x35b34d,_0x1571c1);});if(_0x168e52){return _0x2e8674['id'];}}}));}}return BPromise[_0xc2d2('0x6e')](_0x4b27be)[_0xc2d2('0x1c')](function(_0x335df3){_0x3ce167=_(_0x3ce167)[_0xc2d2('0x6f')](_0x335df3)[_0xc2d2('0x70')]()[_0xc2d2('0x71')]();return db[_0xc2d2('0x23')][_0xc2d2('0x38')]({'where':{'id':_0x5cb049[_0xc2d2('0x2d')]['id']}})[_0xc2d2('0x1c')](function(_0xbe6769){return db['sequelize'][_0xc2d2('0x59')](function(_0x20ed5b){return _0xbe6769['removeTeams'](_0x5cb049[_0xc2d2('0x2a')][_0xc2d2('0x60')],{'transaction':_0x20ed5b})[_0xc2d2('0x1c')](function(){if(!_['isEmpty'](_0x3ce167)){return _0xbe6769[_0xc2d2('0x72')](_0x3ce167,{'transaction':_0x20ed5b});}})[_0xc2d2('0x1c')](function(){_0x3ce167['forEach'](function(_0x12a86e){socket[_0xc2d2('0x5e')]('userFaxQueue:remove',{'UserId':_0x12a86e,'FaxQueueId':_0xbe6769['id']});});});});});});})[_0xc2d2('0x1c')](respondWithStatusCode(_0x269138,null))['catch'](handleError(_0x269138,null));};exports[_0xc2d2('0x73')]=function(_0x597f86,_0x555a4c){return db[_0xc2d2('0x23')][_0xc2d2('0x38')]({'where':{'id':_0x597f86['params']['id']}})[_0xc2d2('0x1c')](handleEntityNotFound(_0x555a4c,null))[_0xc2d2('0x1c')](function(_0x53cf68){if(_0x53cf68){return _0x53cf68['addAgents'](_0x597f86[_0xc2d2('0x3a')][_0xc2d2('0x60')],_[_0xc2d2('0x74')](_0x597f86['body'],[_0xc2d2('0x60'),'id'])||{})['spread'](function(_0x5ef458){for(var _0x28a163=0x0;_0x28a163<_0x597f86[_0xc2d2('0x3a')]['ids'][_0xc2d2('0x34')];_0x28a163+=0x1){socket['emit'](_0xc2d2('0x75'),{'UserId':Number(_0x597f86['body'][_0xc2d2('0x60')][_0x28a163]),'FaxQueueId':Number(_0x597f86['params']['id'])});}return _0x5ef458;});}})[_0xc2d2('0x1c')](respondWithResult(_0x555a4c,null))[_0xc2d2('0x2c')](handleError(_0x555a4c,null));};exports[_0xc2d2('0x72')]=function(_0x13c4f9,_0x39e789){return db[_0xc2d2('0x23')][_0xc2d2('0x38')]({'where':{'id':_0x13c4f9['params']['id']}})[_0xc2d2('0x1c')](handleEntityNotFound(_0x39e789,null))[_0xc2d2('0x1c')](function(_0xe1387f){if(_0xe1387f){return _0xe1387f[_0xc2d2('0x72')](_0x13c4f9[_0xc2d2('0x2a')][_0xc2d2('0x60')])[_0xc2d2('0x1c')](function(){if(_[_0xc2d2('0x76')](_0x13c4f9[_0xc2d2('0x2a')][_0xc2d2('0x60')])){for(var _0x4a6380=0x0;_0x4a6380<_0x13c4f9['query'][_0xc2d2('0x60')][_0xc2d2('0x34')];_0x4a6380+=0x1){socket[_0xc2d2('0x5e')](_0xc2d2('0x77'),{'UserId':Number(_0x13c4f9['query'][_0xc2d2('0x60')][_0x4a6380]),'FaxQueueId':Number(_0x13c4f9[_0xc2d2('0x2d')]['id'])});}}else{socket[_0xc2d2('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x13c4f9[_0xc2d2('0x2a')][_0xc2d2('0x60')]),'FaxQueueId':Number(_0x13c4f9[_0xc2d2('0x2d')]['id'])});}});}})[_0xc2d2('0x1c')](respondWithStatusCode(_0x39e789,null))[_0xc2d2('0x2c')](handleError(_0x39e789,null));};exports[_0xc2d2('0x78')]=function(_0x38d865,_0xd69f91){var _0x196715={};var _0x2048ac={};var _0x3b917e;var _0x2cd708;return db[_0xc2d2('0x23')]['findOne']({'where':{'id':_0x38d865[_0xc2d2('0x2d')]['id']}})['then'](handleEntityNotFound(_0xd69f91,null))['then'](function(_0x2decd8){if(_0x2decd8){_0x3b917e=_0x2decd8;_0x2048ac[_0xc2d2('0x2e')]=_['keys'](db['User'][_0xc2d2('0x24')]);_0x2048ac[_0xc2d2('0x2a')]=_[_0xc2d2('0x2f')](_0x38d865[_0xc2d2('0x2a')]);_0x2048ac[_0xc2d2('0x30')]=_[_0xc2d2('0x31')](_0x2048ac[_0xc2d2('0x2e')],_0x2048ac[_0xc2d2('0x2a')]);_0x196715[_0xc2d2('0x32')]=_[_0xc2d2('0x31')](_0x2048ac['model'],qs[_0xc2d2('0x33')](_0x38d865[_0xc2d2('0x2a')][_0xc2d2('0x33')]));_0x196715['attributes']=_0x196715[_0xc2d2('0x32')][_0xc2d2('0x34')]?_0x196715['attributes']:_0x2048ac[_0xc2d2('0x2e')];_0x196715['order']=qs[_0xc2d2('0x43')](_0x38d865[_0xc2d2('0x2a')][_0xc2d2('0x43')]);_0x196715[_0xc2d2('0x44')]=qs['filters'](_[_0xc2d2('0x45')](_0x38d865['query'],_0x2048ac['filters']));if(_0x38d865[_0xc2d2('0x2a')][_0xc2d2('0x47')]){_0x196715[_0xc2d2('0x44')]=_['merge'](_0x196715[_0xc2d2('0x44')],{'$or':_['map'](_0x196715[_0xc2d2('0x32')],function(_0x3a05b8){var _0x120b76={};_0x120b76[_0x3a05b8]={'$like':'%'+_0x38d865[_0xc2d2('0x2a')][_0xc2d2('0x47')]+'%'};return _0x120b76;})});}_0x196715=_[_0xc2d2('0x36')]({},_0x196715,_0x38d865['options']);return _0x3b917e['getAgents'](_0x196715);}})[_0xc2d2('0x1c')](function(_0x414019){if(_0x414019){_0x2cd708=_0x414019['length'];if(!_0x38d865[_0xc2d2('0x2a')][_0xc2d2('0x79')](_0xc2d2('0x42'))){_0x196715['limit']=qs[_0xc2d2('0x13')](_0x38d865[_0xc2d2('0x2a')]['limit']);_0x196715[_0xc2d2('0x10')]=qs[_0xc2d2('0x10')](_0x38d865[_0xc2d2('0x2a')][_0xc2d2('0x10')]);}return _0x3b917e[_0xc2d2('0x78')](_0x196715);}})['then'](function(_0x5270f7){if(_0x5270f7){return _0x5270f7?{'count':_0x2cd708,'rows':_0x5270f7}:null;}})[_0xc2d2('0x1c')](respondWithResult(_0xd69f91,null))[_0xc2d2('0x2c')](handleError(_0xd69f91,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2dcc41e..2322a10 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 _0xf558=['remove','emit','hasOwnProperty','hook','exports','events','FaxQueue','save','update'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xf558,0x7a));var _0x8f55=function(_0x2d1c7c,_0x2c6379){_0x2d1c7c=_0x2d1c7c-0x0;var _0x53fcae=_0xf558[_0x2d1c7c];return _0x53fcae;};'use strict';var EventEmitter=require(_0x8f55('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x8f55('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8f55('0x2'),'afterUpdate':_0x8f55('0x3'),'afterDestroy':_0x8f55('0x4')};function emitEvent(_0x4bf9cb){return function(_0x4adc11,_0x26e2bf,_0x17bd83){FaxQueueEvents[_0x8f55('0x5')](_0x4bf9cb+':'+_0x4adc11['id'],_0x4adc11);FaxQueueEvents[_0x8f55('0x5')](_0x4bf9cb,_0x4adc11);_0x17bd83(null);};}for(var e in events){if(events[_0x8f55('0x6')](e)){var event=events[e];FaxQueue[_0x8f55('0x7')](e,emitEvent(event));}}module[_0x8f55('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x1093=['../../mysqldb','save','update','remove','emit','events'];(function(_0x416d60,_0x56dde9){var _0x286bd7=function(_0x38ba01){while(--_0x38ba01){_0x416d60['push'](_0x416d60['shift']());}};_0x286bd7(++_0x56dde9);}(_0x1093,0xc5));var _0x3109=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x1093[_0x1b828b];return _0x98da1a;};'use strict';var EventEmitter=require(_0x3109('0x0'));var FaxQueue=require(_0x3109('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3109('0x2'),'afterUpdate':_0x3109('0x3'),'afterDestroy':_0x3109('0x4')};function emitEvent(_0x32f558){return function(_0x2a497b,_0x23baa1,_0x14b672){FaxQueueEvents[_0x3109('0x5')](_0x32f558+':'+_0x2a497b['id'],_0x2a497b);FaxQueueEvents[_0x3109('0x5')](_0x32f558,_0x2a497b);_0x14b672(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0f37f56..ef985a9 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 _0x0bca=['../../config/logger','api','moment','bluebird','path','rimraf','lodash'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x0bca,0x19c));var _0xa0bc=function(_0x1d8f95,_0xcd1d0e){_0x1d8f95=_0x1d8f95-0x0;var _0x4cb618=_0x0bca[_0x1d8f95];return _0x4cb618;};'use strict';var _=require(_0xa0bc('0x0'));var util=require('util');var logger=require(_0xa0bc('0x1'))(_0xa0bc('0x2'));var moment=require(_0xa0bc('0x3'));var BPromise=require(_0xa0bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0bc('0x5'));var rimraf=require(_0xa0bc('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module['exports']=function(_0x4e68d8,_0x3f196b){return _0x4e68d8['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5256=['moment','../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','api'];(function(_0x1e1310,_0x3ec252){var _0x16c586=function(_0x24ba03){while(--_0x24ba03){_0x1e1310['push'](_0x1e1310['shift']());}};_0x16c586(++_0x3ec252);}(_0x5256,0x1ad));var _0x6525=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x5256[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x6525('0x0'));var util=require('util');var logger=require(_0x6525('0x1'))(_0x6525('0x2'));var moment=require(_0x6525('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6525('0x4'));var attributes=require('./faxQueue.attributes');module[_0x6525('0x5')]=function(_0x267895,_0x4b8de9){return _0x267895['define'](_0x6525('0x6'),attributes,{'tableName':_0x6525('0x7'),'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 97c24da..07c5f39 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 _0x51ae=['map','model','ShowFaxQueue','find','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include'];(function(_0x366195,_0x50da84){var _0xf37646=function(_0x53a253){while(--_0x53a253){_0x366195['push'](_0x366195['shift']());}};_0xf37646(++_0x50da84);}(_0x51ae,0x1cc));var _0xe51a=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x51ae[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0xe51a('0x0'));var util=require('util');var moment=require(_0xe51a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe51a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe51a('0x3'));var logger=require(_0xe51a('0x4'))(_0xe51a('0x5'));var config=require(_0xe51a('0x6'));var jayson=require(_0xe51a('0x7'));var client=jayson['client'][_0xe51a('0x8')]({'port':0x232a});config['redis']=_[_0xe51a('0x9')](config[_0xe51a('0xa')],{'host':_0xe51a('0xb'),'port':0x18eb});var socket=require(_0xe51a('0xc'))(new Redis(config['redis']));require(_0xe51a('0xd'))['register'](socket);function respondWithRpcPromise(_0xf1903e,_0x32a11e,_0x59d446){return new BPromise(function(_0xa9e8e0,_0x33c40e){return client[_0xe51a('0xe')](_0xf1903e,_0x59d446)[_0xe51a('0xf')](function(_0x411211){logger[_0xe51a('0x10')]('FaxQueue,\x20%s,\x20%s',_0x32a11e,'request\x20sent');logger[_0xe51a('0x11')](_0xe51a('0x12'),_0x32a11e,'request\x20sent',JSON[_0xe51a('0x13')](_0x411211));if(_0x411211[_0xe51a('0x14')]){if(_0x411211['error'][_0xe51a('0x15')]===0x1f4){logger[_0xe51a('0x14')](_0xe51a('0x16'),_0x32a11e,_0x411211[_0xe51a('0x14')][_0xe51a('0x17')]);return _0x33c40e(_0x411211[_0xe51a('0x14')][_0xe51a('0x17')]);}logger[_0xe51a('0x14')](_0xe51a('0x16'),_0x32a11e,_0x411211[_0xe51a('0x14')][_0xe51a('0x17')]);return _0xa9e8e0(_0x411211[_0xe51a('0x14')][_0xe51a('0x17')]);}else{logger[_0xe51a('0x10')](_0xe51a('0x16'),_0x32a11e,_0xe51a('0x18'));_0xa9e8e0(_0x411211[_0xe51a('0x19')]['message']);}})[_0xe51a('0x1a')](function(_0x3ef1a6){logger[_0xe51a('0x14')](_0xe51a('0x16'),_0x32a11e,_0x3ef1a6);_0x33c40e(_0x3ef1a6);});});}exports[_0xe51a('0x1b')]=function(_0x1c6f59){var _0x5d0806=this;return new Promise(function(_0x2e0e9b,_0xadc259){return db[_0xe51a('0x1c')]['findAll']({'raw':_0x1c6f59[_0xe51a('0x1d')]?_0x1c6f59[_0xe51a('0x1d')][_0xe51a('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c6f59[_0xe51a('0x1d')]?_0x1c6f59[_0xe51a('0x1d')][_0xe51a('0x1f')]||null:null,'attributes':_0x1c6f59[_0xe51a('0x1d')]?_0x1c6f59['options'][_0xe51a('0x20')]||null:null,'limit':_0x1c6f59[_0xe51a('0x1d')]?_0x1c6f59['options']['limit']||null:null,'include':_0x1c6f59['options']?_0x1c6f59['options'][_0xe51a('0x21')]?_['map'](_0x1c6f59[_0xe51a('0x1d')]['include'],function(_0x2240e2){return{'model':db[_0x2240e2['model']],'as':_0x2240e2['as'],'attributes':_0x2240e2[_0xe51a('0x20')],'include':_0x2240e2[_0xe51a('0x21')]?_[_0xe51a('0x22')](_0x2240e2[_0xe51a('0x21')],function(_0xe9d01b){return{'model':db[_0xe9d01b[_0xe51a('0x23')]],'as':_0xe9d01b['as'],'attributes':_0xe9d01b[_0xe51a('0x20')],'include':_0xe9d01b['include']?_['map'](_0xe9d01b[_0xe51a('0x21')],function(_0x3bff1b){return{'model':db[_0x3bff1b['model']],'as':_0x3bff1b['as'],'attributes':_0x3bff1b[_0xe51a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe51a('0xf')](function(_0x47ddbe){logger[_0xe51a('0x10')](_0xe51a('0x1b'),_0x1c6f59);logger['debug'](_0xe51a('0x1b'),_0x1c6f59,JSON['stringify'](_0x47ddbe));_0x2e0e9b(_0x47ddbe);})[_0xe51a('0x1a')](function(_0x2789e3){logger[_0xe51a('0x14')](_0xe51a('0x1b'),_0x2789e3[_0xe51a('0x17')],_0x1c6f59);_0xadc259(_0x5d0806[_0xe51a('0x14')](0x1f4,_0x2789e3['message']));});});};exports[_0xe51a('0x24')]=function(_0x5c9ce7){var _0x53a3d6=this;return new Promise(function(_0x13921b,_0x375aca){return db[_0xe51a('0x1c')][_0xe51a('0x25')]({'raw':_0x5c9ce7[_0xe51a('0x1d')]?_0x5c9ce7[_0xe51a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c9ce7[_0xe51a('0x1d')]?_0x5c9ce7[_0xe51a('0x1d')][_0xe51a('0x1f')]||null:null,'attributes':_0x5c9ce7[_0xe51a('0x1d')]?_0x5c9ce7[_0xe51a('0x1d')][_0xe51a('0x20')]||null:null,'include':_0x5c9ce7[_0xe51a('0x1d')]?_0x5c9ce7['options']['include']?_['map'](_0x5c9ce7[_0xe51a('0x1d')][_0xe51a('0x21')],function(_0x4e8192){return{'model':db[_0x4e8192[_0xe51a('0x23')]],'as':_0x4e8192['as'],'attributes':_0x4e8192[_0xe51a('0x20')],'include':_0x4e8192[_0xe51a('0x21')]?_['map'](_0x4e8192['include'],function(_0x51ba10){return{'model':db[_0x51ba10[_0xe51a('0x23')]],'as':_0x51ba10['as'],'attributes':_0x51ba10['attributes'],'include':_0x51ba10[_0xe51a('0x21')]?_[_0xe51a('0x22')](_0x51ba10[_0xe51a('0x21')],function(_0x229eb4){return{'model':db[_0x229eb4['model']],'as':_0x229eb4['as'],'attributes':_0x229eb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe51a('0xf')](function(_0x2d2637){logger[_0xe51a('0x10')]('ShowFaxQueue',_0x5c9ce7);logger[_0xe51a('0x11')](_0xe51a('0x24'),_0x5c9ce7,JSON[_0xe51a('0x13')](_0x2d2637));_0x13921b(_0x2d2637);})[_0xe51a('0x1a')](function(_0x115eca){logger[_0xe51a('0x14')](_0xe51a('0x24'),_0x115eca[_0xe51a('0x17')],_0x5c9ce7);_0x375aca(_0x53a3d6['error'](0x1f4,_0x115eca['message']));});});}; \ No newline at end of file +var _0x4b24=['FaxQueue','findAll','options','raw','where','include','map','model','attributes','ShowFaxQueue','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFaxQueue'];(function(_0x2e641b,_0x1b03ae){var _0x3f15a9=function(_0x2ba7db){while(--_0x2ba7db){_0x2e641b['push'](_0x2e641b['shift']());}};_0x3f15a9(++_0x1b03ae);}(_0x4b24,0x197));var _0x44b2=function(_0x20c474,_0x4b9323){_0x20c474=_0x20c474-0x0;var _0x284af2=_0x4b24[_0x20c474];return _0x284af2;};'use strict';var _=require(_0x44b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44b2('0x1'));var db=require(_0x44b2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x44b2('0x3'))(_0x44b2('0x4'));var config=require(_0x44b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x44b2('0x6')][_0x44b2('0x7')]({'port':0x232a});config[_0x44b2('0x8')]=_[_0x44b2('0x9')](config[_0x44b2('0x8')],{'host':_0x44b2('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44b2('0x8')]));require(_0x44b2('0xb'))[_0x44b2('0xc')](socket);function respondWithRpcPromise(_0x56404d,_0xe06a2c,_0x412f79){return new BPromise(function(_0x2116dd,_0x4bb339){return client['request'](_0x56404d,_0x412f79)[_0x44b2('0xd')](function(_0x1323f8){logger['info'](_0x44b2('0xe'),_0xe06a2c,_0x44b2('0xf'));logger[_0x44b2('0x10')](_0x44b2('0x11'),_0xe06a2c,_0x44b2('0xf'),JSON[_0x44b2('0x12')](_0x1323f8));if(_0x1323f8[_0x44b2('0x13')]){if(_0x1323f8[_0x44b2('0x13')]['code']===0x1f4){logger[_0x44b2('0x13')](_0x44b2('0xe'),_0xe06a2c,_0x1323f8['error'][_0x44b2('0x14')]);return _0x4bb339(_0x1323f8[_0x44b2('0x13')][_0x44b2('0x14')]);}logger[_0x44b2('0x13')](_0x44b2('0xe'),_0xe06a2c,_0x1323f8['error'][_0x44b2('0x14')]);return _0x2116dd(_0x1323f8[_0x44b2('0x13')][_0x44b2('0x14')]);}else{logger[_0x44b2('0x15')]('FaxQueue,\x20%s,\x20%s',_0xe06a2c,_0x44b2('0xf'));_0x2116dd(_0x1323f8[_0x44b2('0x16')][_0x44b2('0x14')]);}})[_0x44b2('0x17')](function(_0x346ee4){logger[_0x44b2('0x13')](_0x44b2('0xe'),_0xe06a2c,_0x346ee4);_0x4bb339(_0x346ee4);});});}exports[_0x44b2('0x18')]=function(_0x9934ef){var _0x2b4bb3=this;return new Promise(function(_0x86298a,_0x4fddf5){return db[_0x44b2('0x19')][_0x44b2('0x1a')]({'raw':_0x9934ef[_0x44b2('0x1b')]?_0x9934ef[_0x44b2('0x1b')][_0x44b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x9934ef[_0x44b2('0x1b')]?_0x9934ef['options'][_0x44b2('0x1d')]||null:null,'attributes':_0x9934ef['options']?_0x9934ef['options']['attributes']||null:null,'limit':_0x9934ef['options']?_0x9934ef[_0x44b2('0x1b')]['limit']||null:null,'include':_0x9934ef[_0x44b2('0x1b')]?_0x9934ef['options'][_0x44b2('0x1e')]?_[_0x44b2('0x1f')](_0x9934ef[_0x44b2('0x1b')][_0x44b2('0x1e')],function(_0x35e66b){return{'model':db[_0x35e66b[_0x44b2('0x20')]],'as':_0x35e66b['as'],'attributes':_0x35e66b['attributes'],'include':_0x35e66b[_0x44b2('0x1e')]?_['map'](_0x35e66b['include'],function(_0x63ce2d){return{'model':db[_0x63ce2d[_0x44b2('0x20')]],'as':_0x63ce2d['as'],'attributes':_0x63ce2d[_0x44b2('0x21')],'include':_0x63ce2d['include']?_[_0x44b2('0x1f')](_0x63ce2d['include'],function(_0xed752a){return{'model':db[_0xed752a['model']],'as':_0xed752a['as'],'attributes':_0xed752a[_0x44b2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x44b2('0xd')](function(_0x2c6adb){logger['info']('GetFaxQueue',_0x9934ef);logger[_0x44b2('0x10')](_0x44b2('0x18'),_0x9934ef,JSON[_0x44b2('0x12')](_0x2c6adb));_0x86298a(_0x2c6adb);})[_0x44b2('0x17')](function(_0x143b49){logger[_0x44b2('0x13')](_0x44b2('0x18'),_0x143b49[_0x44b2('0x14')],_0x9934ef);_0x4fddf5(_0x2b4bb3[_0x44b2('0x13')](0x1f4,_0x143b49[_0x44b2('0x14')]));});});};exports[_0x44b2('0x22')]=function(_0x53d872){var _0x134f0a=this;return new Promise(function(_0x361f03,_0x51ca6c){return db[_0x44b2('0x19')][_0x44b2('0x23')]({'raw':_0x53d872[_0x44b2('0x1b')]?_0x53d872['options'][_0x44b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x53d872[_0x44b2('0x1b')]?_0x53d872['options'][_0x44b2('0x1d')]||null:null,'attributes':_0x53d872['options']?_0x53d872[_0x44b2('0x1b')][_0x44b2('0x21')]||null:null,'include':_0x53d872[_0x44b2('0x1b')]?_0x53d872['options'][_0x44b2('0x1e')]?_[_0x44b2('0x1f')](_0x53d872[_0x44b2('0x1b')][_0x44b2('0x1e')],function(_0x10e730){return{'model':db[_0x10e730['model']],'as':_0x10e730['as'],'attributes':_0x10e730['attributes'],'include':_0x10e730[_0x44b2('0x1e')]?_[_0x44b2('0x1f')](_0x10e730[_0x44b2('0x1e')],function(_0x599fb6){return{'model':db[_0x599fb6[_0x44b2('0x20')]],'as':_0x599fb6['as'],'attributes':_0x599fb6[_0x44b2('0x21')],'include':_0x599fb6[_0x44b2('0x1e')]?_[_0x44b2('0x1f')](_0x599fb6['include'],function(_0x567929){return{'model':db[_0x567929[_0x44b2('0x20')]],'as':_0x567929['as'],'attributes':_0x567929[_0x44b2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x44b2('0xd')](function(_0x116db8){logger[_0x44b2('0x15')](_0x44b2('0x22'),_0x53d872);logger['debug'](_0x44b2('0x22'),_0x53d872,JSON[_0x44b2('0x12')](_0x116db8));_0x361f03(_0x116db8);})[_0x44b2('0x17')](function(_0x181eec){logger[_0x44b2('0x13')](_0x44b2('0x22'),_0x181eec[_0x44b2('0x14')],_0x53d872);_0x51ca6c(_0x134f0a[_0x44b2('0x13')](0x1f4,_0x181eec[_0x44b2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b0a4cb6..f7d6546 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 _0x81c9=['remove','update','emit','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x21f972,_0xafaf3b){var _0x5e65fe=function(_0xb2cf7f){while(--_0xb2cf7f){_0x21f972['push'](_0x21f972['shift']());}};_0x5e65fe(++_0xafaf3b);}(_0x81c9,0x1de));var _0x981c=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x81c9[_0x187ee1];return _0x388160;};'use strict';var FaxQueueEvents=require(_0x981c('0x0'));var events=[_0x981c('0x1'),_0x981c('0x2'),_0x981c('0x3')];function createListener(_0x55ff41,_0x450631){return function(_0x1b15cf){_0x450631[_0x981c('0x4')](_0x55ff41,_0x1b15cf);};}function removeListener(_0x4f8c37,_0xef890a){return function(){FaxQueueEvents[_0x981c('0x5')](_0x4f8c37,_0xef890a);};}exports[_0x981c('0x6')]=function(_0x19aa19){for(var _0x5976c6=0x0,_0x89b46b=events['length'];_0x5976c6<_0x89b46b;_0x5976c6++){var _0x2c34fb=events[_0x5976c6];var _0x2133f9=createListener(_0x981c('0x7')+_0x2c34fb,_0x19aa19);FaxQueueEvents['on'](_0x2c34fb,_0x2133f9);}}; \ No newline at end of file +var _0x7756=['update','emit','removeListener','register','length','remove'];(function(_0x42e7fc,_0x11cd53){var _0x4bddf1=function(_0x290e53){while(--_0x290e53){_0x42e7fc['push'](_0x42e7fc['shift']());}};_0x4bddf1(++_0x11cd53);}(_0x7756,0x131));var _0x6775=function(_0x5b9b71,_0x323100){_0x5b9b71=_0x5b9b71-0x0;var _0x1655a5=_0x7756[_0x5b9b71];return _0x1655a5;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x6775('0x0'),_0x6775('0x1')];function createListener(_0x460c0a,_0x3dff65){return function(_0x1e018b){_0x3dff65[_0x6775('0x2')](_0x460c0a,_0x1e018b);};}function removeListener(_0x1a8369,_0xc65cb4){return function(){FaxQueueEvents[_0x6775('0x3')](_0x1a8369,_0xc65cb4);};}exports[_0x6775('0x4')]=function(_0x13edd3){for(var _0x188e1f=0x0,_0x17a5d2=events[_0x6775('0x5')];_0x188e1f<_0x17a5d2;_0x188e1f++){var _0x22cc26=events[_0x188e1f];var _0x426515=createListener('faxQueue:'+_0x22cc26,_0x13edd3);FaxQueueEvents['on'](_0x22cc26,_0x426515);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e354b56..002f0ba 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 _0xbff5=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/users','getAgents','create','/:id/teams','addAgents','update','destroy','removeTeams'];(function(_0x179cce,_0x239422){var _0x54ac6d=function(_0x21a7f0){while(--_0x21a7f0){_0x179cce['push'](_0x179cce['shift']());}};_0x54ac6d(++_0x239422);}(_0xbff5,0x1bc));var _0x5bff=function(_0x3c0ee9,_0x156f1d){_0x3c0ee9=_0x3c0ee9-0x0;var _0x51f129=_0xbff5[_0x3c0ee9];return _0x51f129;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getMembers']);router[_0x5bff('0x8')]('/:id/teams',auth[_0x5bff('0x9')](),controller['getTeams']);router[_0x5bff('0x8')](_0x5bff('0x10'),auth['isAuthenticated'](),controller[_0x5bff('0x11')]);router['post']('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0x12')]);router['post'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller['addTeams']);router['post'](_0x5bff('0x10'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x14')]);router['put'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x15')]);router['delete'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x16')]);router['delete'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x17')]);router[_0x5bff('0x18')]('/:id/users',auth[_0x5bff('0x9')](),controller['removeAgents']);module[_0x5bff('0x19')]=router; \ No newline at end of file +var _0xdb28=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb28,0x106));var _0x8db2=function(_0x4f6bd3,_0x3b002c){_0x4f6bd3=_0x4f6bd3-0x0;var _0xedae5a=_0xdb28[_0x4f6bd3];return _0xedae5a;};'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('./faxQueue.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getTeams']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8db2('0x14')](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x15')]);router[_0x8db2('0x14')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x17')](_0x8db2('0xd'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x19')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1a')]);router[_0x8db2('0x19')](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['delete']('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1c')]);module[_0x8db2('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 29fd17c..12a13d5 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 _0xce29=['moment','sequelize','exports','STRING','DATE'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xce29,0x159));var _0x9ce2=function(_0x492199,_0x51f647){_0x492199=_0x492199-0x0;var _0x3b626d=_0xce29[_0x492199];return _0x3b626d;};'use strict';var moment=require(_0x9ce2('0x0'));var Sequelize=require(_0x9ce2('0x1'));module[_0x9ce2('0x2')]={'uniqueid':{'type':Sequelize[_0x9ce2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9ce2('0x3')]},'joinAt':{'type':Sequelize[_0x9ce2('0x4')]},'leaveAt':{'type':Sequelize[_0x9ce2('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9ce2('0x3')]}}; \ No newline at end of file +var _0xe48a=['DATE','moment','exports','STRING'];(function(_0x4641d9,_0x3362db){var _0x58b071=function(_0x20b9ab){while(--_0x20b9ab){_0x4641d9['push'](_0x4641d9['shift']());}};_0x58b071(++_0x3362db);}(_0xe48a,0xad));var _0xae48=function(_0x1c1820,_0x18bb79){_0x1c1820=_0x1c1820-0x0;var _0x6690e6=_0xe48a[_0x1c1820];return _0x6690e6;};'use strict';var moment=require(_0xae48('0x0'));var Sequelize=require('sequelize');module[_0xae48('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xae48('0x2')]},'joinAt':{'type':Sequelize[_0xae48('0x3')]},'leaveAt':{'type':Sequelize[_0xae48('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xae48('0x3')]},'reason':{'type':Sequelize[_0xae48('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b9ca901..72c3793 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 _0x028d=['nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x3f32ec,_0x7e8f4){var _0x35ec52=function(_0x490291){while(--_0x490291){_0x3f32ec['push'](_0x3f32ec['shift']());}};_0x35ec52(++_0x7e8f4);}(_0x028d,0xff));var _0xd028=function(_0xd5edd0,_0x1216d3){_0xd5edd0=_0xd5edd0-0x0;var _0x25ae02=_0x028d[_0xd5edd0];return _0x25ae02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd028('0x0'));var zipdir=require(_0xd028('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd028('0x2'));var moment=require(_0xd028('0x3'));var BPromise=require(_0xd028('0x4'));var Mustache=require(_0xd028('0x5'));var util=require(_0xd028('0x6'));var path=require(_0xd028('0x7'));var sox=require('sox');var csv=require(_0xd028('0x8'));var ejs=require(_0xd028('0x9'));var fs=require('fs');var fs_extra=require(_0xd028('0xa'));var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x8'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var licenseUtil=require(_0xd028('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5fa,_0x144696){_0x144696=_0x144696||0xcc;return function(_0x4817a4){if(_0x4817a4){return _0x34b5fa[_0xd028('0x1b')](_0x144696);}return _0x34b5fa[_0xd028('0x1c')](_0x144696)[_0xd028('0x1d')]();};}function respondWithResult(_0x17b112,_0x1667bf){_0x1667bf=_0x1667bf||0xc8;return function(_0x5ec067){if(_0x5ec067){return _0x17b112[_0xd028('0x1c')](_0x1667bf)[_0xd028('0x1e')](_0x5ec067);}};}function respondWithFilteredResult(_0x3937b4,_0x3bac54){return function(_0x12450d){if(_0x12450d){var _0x463d38=typeof _0x3bac54['offset']===_0xd028('0x1f')&&typeof _0x3bac54['limit']===_0xd028('0x1f');var _0x2f4af6=_0x12450d[_0xd028('0x20')];var _0x4df54f=_0x463d38?0x0:_0x3bac54[_0xd028('0x21')];var _0x5a47a6=_0x463d38?_0x12450d[_0xd028('0x20')]:_0x3bac54['offset']+_0x3bac54[_0xd028('0x22')];var _0x415d6c;if(_0x5a47a6>=_0x2f4af6){_0x5a47a6=_0x2f4af6;_0x415d6c=0xc8;}else{_0x415d6c=0xce;}_0x3937b4[_0xd028('0x1c')](_0x415d6c);return _0x3937b4['set'](_0xd028('0x23'),_0x4df54f+'-'+_0x5a47a6+'/'+_0x2f4af6)[_0xd028('0x1e')](_0x12450d);}return null;};}function patchUpdates(_0x1a2767){return function(_0x1648a7){try{jsonpatch[_0xd028('0x24')](_0x1648a7,_0x1a2767,!![]);}catch(_0x4830a4){return BPromise[_0xd028('0x25')](_0x4830a4);}return _0x1648a7[_0xd028('0x26')]();};}function saveUpdates(_0x8a964d,_0x75657f){return function(_0x3203f9){if(_0x3203f9){return _0x3203f9[_0xd028('0x27')](_0x8a964d)[_0xd028('0x28')](function(_0x54beee){return _0x54beee;});}return null;};}function removeEntity(_0x115fef,_0x10d629){return function(_0x13e5f4){if(_0x13e5f4){return _0x13e5f4[_0xd028('0x29')]()['then'](function(){_0x115fef[_0xd028('0x1c')](0xcc)[_0xd028('0x1d')]();});}};}function handleEntityNotFound(_0x26eb4e,_0x3249ea){return function(_0x5b9f3d){if(!_0x5b9f3d){_0x26eb4e[_0xd028('0x1b')](0x194);}return _0x5b9f3d;};}function handleError(_0x128c63,_0x115004){_0x115004=_0x115004||0x1f4;return function(_0x3481be){logger[_0xd028('0x2a')](_0x3481be[_0xd028('0x2b')]);if(_0x3481be[_0xd028('0x2c')]){delete _0x3481be[_0xd028('0x2c')];}_0x128c63[_0xd028('0x1c')](_0x115004)[_0xd028('0x2d')](_0x3481be);};}exports[_0xd028('0x2e')]=function(_0x3112e8,_0x112578){var _0x17594f={},_0x23d9dd={},_0x3b46bb={'count':0x0,'rows':[]};var _0x5d6f95=_['map'](db[_0xd028('0x2f')][_0xd028('0x30')],function(_0x2caf5d){return{'name':_0x2caf5d[_0xd028('0x31')],'type':_0x2caf5d[_0xd028('0x32')][_0xd028('0x33')]};});_0x23d9dd['model']=_['map'](_0x5d6f95,_0xd028('0x2c'));_0x23d9dd[_0xd028('0x34')]=_[_0xd028('0x35')](_0x3112e8[_0xd028('0x34')]);_0x23d9dd[_0xd028('0x36')]=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],_0x23d9dd['query']);_0x17594f['attributes']=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],qs['fields'](_0x3112e8['query'][_0xd028('0x39')]));_0x17594f[_0xd028('0x3a')]=_0x17594f[_0xd028('0x3a')][_0xd028('0x3b')]?_0x17594f[_0xd028('0x3a')]:_0x23d9dd[_0xd028('0x38')];if(!_0x3112e8[_0xd028('0x34')][_0xd028('0x3c')](_0xd028('0x3d'))){_0x17594f[_0xd028('0x22')]=qs[_0xd028('0x22')](_0x3112e8['query']['limit']);_0x17594f['offset']=qs['offset'](_0x3112e8['query'][_0xd028('0x21')]);}_0x17594f['order']=qs['sort'](_0x3112e8['query'][_0xd028('0x3e')]);_0x17594f['where']=qs[_0xd028('0x36')](_['pick'](_0x3112e8['query'],_0x23d9dd[_0xd028('0x36')]),_0x5d6f95);if(_0x3112e8[_0xd028('0x34')]['filter']){_0x17594f[_0xd028('0x3f')]=_['merge'](_0x17594f['where'],{'$or':_['map'](_0x5d6f95,function(_0x5941ed){if(_0x5941ed['type']!==_0xd028('0x40')){var _0x24ba63={};_0x24ba63[_0x5941ed['name']]={'$like':'%'+_0x3112e8[_0xd028('0x34')][_0xd028('0x41')]+'%'};return _0x24ba63;}})});}_0x17594f=_[_0xd028('0x42')]({},_0x17594f,_0x3112e8[_0xd028('0x43')]);var _0xc79c76={'where':_0x17594f[_0xd028('0x3f')]};return db['FaxQueueReport'][_0xd028('0x20')](_0xc79c76)[_0xd028('0x28')](function(_0x2d5fab){_0x3b46bb['count']=_0x2d5fab;if(_0x3112e8[_0xd028('0x34')][_0xd028('0x44')]){_0x17594f[_0xd028('0x45')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd028('0x46')](_0x17594f);})['then'](function(_0x26e51c){_0x3b46bb[_0xd028('0x47')]=_0x26e51c;return _0x3b46bb;})[_0xd028('0x28')](respondWithFilteredResult(_0x112578,_0x17594f))[_0xd028('0x48')](handleError(_0x112578,null));};exports[_0xd028('0x49')]=function(_0x3f86ed,_0x1de847){var _0x42a3fc={'raw':!![],'where':{'id':_0x3f86ed['params']['id']}},_0x3065f2={};_0x3065f2[_0xd028('0x38')]=_[_0xd028('0x35')](db[_0xd028('0x2f')][_0xd028('0x30')]);_0x3065f2['query']=_[_0xd028('0x35')](_0x3f86ed[_0xd028('0x34')]);_0x3065f2[_0xd028('0x36')]=_['intersection'](_0x3065f2[_0xd028('0x38')],_0x3065f2[_0xd028('0x34')]);_0x42a3fc['attributes']=_[_0xd028('0x37')](_0x3065f2[_0xd028('0x38')],qs[_0xd028('0x39')](_0x3f86ed[_0xd028('0x34')][_0xd028('0x39')]));_0x42a3fc[_0xd028('0x3a')]=_0x42a3fc[_0xd028('0x3a')][_0xd028('0x3b')]?_0x42a3fc[_0xd028('0x3a')]:_0x3065f2[_0xd028('0x38')];if(_0x3f86ed['query'][_0xd028('0x44')]){_0x42a3fc[_0xd028('0x45')]=[{'all':!![]}];}_0x42a3fc=_[_0xd028('0x42')]({},_0x42a3fc,_0x3f86ed[_0xd028('0x43')]);return db[_0xd028('0x2f')][_0xd028('0x4a')](_0x42a3fc)['then'](handleEntityNotFound(_0x1de847,null))[_0xd028('0x28')](respondWithResult(_0x1de847,null))[_0xd028('0x48')](handleError(_0x1de847,null));};exports[_0xd028('0x4b')]=function(_0xf0bd53,_0x30d7b6){return db['FaxQueueReport']['create'](_0xf0bd53['body'],{})['then'](respondWithResult(_0x30d7b6,0xc9))[_0xd028('0x48')](handleError(_0x30d7b6,null));};exports[_0xd028('0x27')]=function(_0x2ca45d,_0x3db4b8){if(_0x2ca45d[_0xd028('0x4c')]['id']){delete _0x2ca45d[_0xd028('0x4c')]['id'];}return db[_0xd028('0x2f')][_0xd028('0x4a')]({'where':{'id':_0x2ca45d[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db4b8,null))[_0xd028('0x28')](saveUpdates(_0x2ca45d[_0xd028('0x4c')],null))[_0xd028('0x28')](respondWithResult(_0x3db4b8,null))[_0xd028('0x48')](handleError(_0x3db4b8,null));};exports[_0xd028('0x29')]=function(_0x13b619,_0x4a2c39){return db['FaxQueueReport'][_0xd028('0x4a')]({'where':{'id':_0x13b619[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2c39,null))[_0xd028('0x28')](removeEntity(_0x4a2c39,null))[_0xd028('0x48')](handleError(_0x4a2c39,null));};exports[_0xd028('0x4e')]=function(_0x1d337d,_0x29d5d2){return db[_0xd028('0x2f')][_0xd028('0x4e')]()[_0xd028('0x28')](respondWithResult(_0x29d5d2,null))[_0xd028('0x48')](handleError(_0x29d5d2,null));}; \ No newline at end of file +var _0x6658=['includeAll','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','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','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','end','sendStatus','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0x6658,0x198));var _0x8665=function(_0x10d19d,_0x1bc975){_0x10d19d=_0x10d19d-0x0;var _0x6ec46b=_0x6658[_0x10d19d];return _0x6ec46b;};'use strict';var emlformat=require(_0x8665('0x0'));var rimraf=require(_0x8665('0x1'));var zipdir=require(_0x8665('0x2'));var jsonpatch=require(_0x8665('0x3'));var rp=require(_0x8665('0x4'));var moment=require(_0x8665('0x5'));var BPromise=require(_0x8665('0x6'));var Mustache=require(_0x8665('0x7'));var util=require('util');var path=require(_0x8665('0x8'));var sox=require(_0x8665('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8665('0xa'));var _=require(_0x8665('0xb'));var squel=require(_0x8665('0xc'));var crypto=require(_0x8665('0xd'));var jsforce=require(_0x8665('0xe'));var deskjs=require(_0x8665('0xf'));var toCsv=require(_0x8665('0x10'));var querystring=require(_0x8665('0x11'));var Papa=require('papaparse');var Redis=require(_0x8665('0x12'));var authService=require(_0x8665('0x13'));var qs=require(_0x8665('0x14'));var as=require(_0x8665('0x15'));var hardwareService=require(_0x8665('0x16'));var logger=require(_0x8665('0x17'))(_0x8665('0x18'));var utils=require(_0x8665('0x19'));var config=require(_0x8665('0x1a'));var licenseUtil=require(_0x8665('0x1b'));var db=require(_0x8665('0x1c'))['db'];function respondWithStatusCode(_0x30d476,_0x26ffc9){_0x26ffc9=_0x26ffc9||0xcc;return function(_0x689905){if(_0x689905){return _0x30d476['sendStatus'](_0x26ffc9);}return _0x30d476[_0x8665('0x1d')](_0x26ffc9)['end']();};}function respondWithResult(_0x3d8f0b,_0x16452c){_0x16452c=_0x16452c||0xc8;return function(_0xfef706){if(_0xfef706){return _0x3d8f0b[_0x8665('0x1d')](_0x16452c)[_0x8665('0x1e')](_0xfef706);}};}function respondWithFilteredResult(_0x2a0507,_0x5186e4){return function(_0x222e87){if(_0x222e87){var _0xa2545a=typeof _0x5186e4['offset']===_0x8665('0x1f')&&typeof _0x5186e4['limit']===_0x8665('0x1f');var _0x383b79=_0x222e87[_0x8665('0x20')];var _0x50ba7d=_0xa2545a?0x0:_0x5186e4[_0x8665('0x21')];var _0x235617=_0xa2545a?_0x222e87['count']:_0x5186e4[_0x8665('0x21')]+_0x5186e4[_0x8665('0x22')];var _0x16f1f1;if(_0x235617>=_0x383b79){_0x235617=_0x383b79;_0x16f1f1=0xc8;}else{_0x16f1f1=0xce;}_0x2a0507['status'](_0x16f1f1);return _0x2a0507[_0x8665('0x23')](_0x8665('0x24'),_0x50ba7d+'-'+_0x235617+'/'+_0x383b79)[_0x8665('0x1e')](_0x222e87);}return null;};}function patchUpdates(_0x549a0a){return function(_0x519d5c){try{jsonpatch['apply'](_0x519d5c,_0x549a0a,!![]);}catch(_0x29154d){return BPromise['reject'](_0x29154d);}return _0x519d5c[_0x8665('0x25')]();};}function saveUpdates(_0x53d764,_0x34b622){return function(_0x4dc4f7){if(_0x4dc4f7){return _0x4dc4f7['update'](_0x53d764)[_0x8665('0x26')](function(_0x406e8a){return _0x406e8a;});}return null;};}function removeEntity(_0x512d8e,_0x38e3f5){return function(_0x1d7f74){if(_0x1d7f74){return _0x1d7f74[_0x8665('0x27')]()[_0x8665('0x26')](function(){_0x512d8e['status'](0xcc)[_0x8665('0x28')]();});}};}function handleEntityNotFound(_0x41394e,_0x4583f2){return function(_0x3eee64){if(!_0x3eee64){_0x41394e[_0x8665('0x29')](0x194);}return _0x3eee64;};}function handleError(_0x3c9fe3,_0x2f143f){_0x2f143f=_0x2f143f||0x1f4;return function(_0x172f47){logger['error'](_0x172f47[_0x8665('0x2a')]);if(_0x172f47[_0x8665('0x2b')]){delete _0x172f47[_0x8665('0x2b')];}_0x3c9fe3['status'](_0x2f143f)[_0x8665('0x2c')](_0x172f47);};}exports[_0x8665('0x2d')]=function(_0x149c8f,_0x1f4ebd){var _0xe34d5f={},_0x3b0302={},_0x313fca={'count':0x0,'rows':[]};var _0x183b4c=_['map'](db[_0x8665('0x2e')][_0x8665('0x2f')],function(_0x4ff80a){return{'name':_0x4ff80a[_0x8665('0x30')],'type':_0x4ff80a[_0x8665('0x31')][_0x8665('0x32')]};});_0x3b0302['model']=_[_0x8665('0x33')](_0x183b4c,'name');_0x3b0302['query']=_[_0x8665('0x34')](_0x149c8f[_0x8665('0x35')]);_0x3b0302[_0x8665('0x36')]=_[_0x8665('0x37')](_0x3b0302[_0x8665('0x38')],_0x3b0302[_0x8665('0x35')]);_0xe34d5f[_0x8665('0x39')]=_[_0x8665('0x37')](_0x3b0302['model'],qs[_0x8665('0x3a')](_0x149c8f[_0x8665('0x35')][_0x8665('0x3a')]));_0xe34d5f[_0x8665('0x39')]=_0xe34d5f[_0x8665('0x39')][_0x8665('0x3b')]?_0xe34d5f[_0x8665('0x39')]:_0x3b0302[_0x8665('0x38')];if(!_0x149c8f[_0x8665('0x35')][_0x8665('0x3c')](_0x8665('0x3d'))){_0xe34d5f[_0x8665('0x22')]=qs[_0x8665('0x22')](_0x149c8f[_0x8665('0x35')][_0x8665('0x22')]);_0xe34d5f[_0x8665('0x21')]=qs[_0x8665('0x21')](_0x149c8f[_0x8665('0x35')][_0x8665('0x21')]);}_0xe34d5f[_0x8665('0x3e')]=qs['sort'](_0x149c8f[_0x8665('0x35')][_0x8665('0x3f')]);_0xe34d5f[_0x8665('0x40')]=qs['filters'](_[_0x8665('0x41')](_0x149c8f[_0x8665('0x35')],_0x3b0302['filters']),_0x183b4c);if(_0x149c8f[_0x8665('0x35')][_0x8665('0x42')]){_0xe34d5f[_0x8665('0x40')]=_['merge'](_0xe34d5f['where'],{'$or':_[_0x8665('0x33')](_0x183b4c,function(_0xdbe67d){if(_0xdbe67d['type']!=='VIRTUAL'){var _0x8716c0={};_0x8716c0[_0xdbe67d[_0x8665('0x2b')]]={'$like':'%'+_0x149c8f[_0x8665('0x35')][_0x8665('0x42')]+'%'};return _0x8716c0;}})});}_0xe34d5f=_[_0x8665('0x43')]({},_0xe34d5f,_0x149c8f[_0x8665('0x44')]);var _0x315d3b={'where':_0xe34d5f[_0x8665('0x40')]};return db[_0x8665('0x2e')][_0x8665('0x20')](_0x315d3b)['then'](function(_0x4e3beb){_0x313fca[_0x8665('0x20')]=_0x4e3beb;if(_0x149c8f[_0x8665('0x35')]['includeAll']){_0xe34d5f[_0x8665('0x45')]=[{'all':!![]}];}return db[_0x8665('0x2e')][_0x8665('0x46')](_0xe34d5f);})[_0x8665('0x26')](function(_0xfeffde){_0x313fca['rows']=_0xfeffde;return _0x313fca;})[_0x8665('0x26')](respondWithFilteredResult(_0x1f4ebd,_0xe34d5f))['catch'](handleError(_0x1f4ebd,null));};exports[_0x8665('0x47')]=function(_0x584884,_0x524659){var _0x11fcc8={'raw':!![],'where':{'id':_0x584884['params']['id']}},_0x64c10f={};_0x64c10f['model']=_[_0x8665('0x34')](db[_0x8665('0x2e')][_0x8665('0x2f')]);_0x64c10f['query']=_['keys'](_0x584884[_0x8665('0x35')]);_0x64c10f[_0x8665('0x36')]=_[_0x8665('0x37')](_0x64c10f[_0x8665('0x38')],_0x64c10f[_0x8665('0x35')]);_0x11fcc8['attributes']=_[_0x8665('0x37')](_0x64c10f[_0x8665('0x38')],qs['fields'](_0x584884['query'][_0x8665('0x3a')]));_0x11fcc8[_0x8665('0x39')]=_0x11fcc8['attributes'][_0x8665('0x3b')]?_0x11fcc8[_0x8665('0x39')]:_0x64c10f[_0x8665('0x38')];if(_0x584884[_0x8665('0x35')][_0x8665('0x48')]){_0x11fcc8[_0x8665('0x45')]=[{'all':!![]}];}_0x11fcc8=_[_0x8665('0x43')]({},_0x11fcc8,_0x584884[_0x8665('0x44')]);return db[_0x8665('0x2e')][_0x8665('0x49')](_0x11fcc8)[_0x8665('0x26')](handleEntityNotFound(_0x524659,null))[_0x8665('0x26')](respondWithResult(_0x524659,null))[_0x8665('0x4a')](handleError(_0x524659,null));};exports['create']=function(_0x501de6,_0x3fa95f){return db['FaxQueueReport'][_0x8665('0x4b')](_0x501de6[_0x8665('0x4c')],{})['then'](respondWithResult(_0x3fa95f,0xc9))[_0x8665('0x4a')](handleError(_0x3fa95f,null));};exports[_0x8665('0x4d')]=function(_0x6ec1ff,_0x26240a){if(_0x6ec1ff[_0x8665('0x4c')]['id']){delete _0x6ec1ff[_0x8665('0x4c')]['id'];}return db['FaxQueueReport'][_0x8665('0x49')]({'where':{'id':_0x6ec1ff[_0x8665('0x4e')]['id']}})['then'](handleEntityNotFound(_0x26240a,null))['then'](saveUpdates(_0x6ec1ff[_0x8665('0x4c')],null))[_0x8665('0x26')](respondWithResult(_0x26240a,null))[_0x8665('0x4a')](handleError(_0x26240a,null));};exports[_0x8665('0x27')]=function(_0x46e6bd,_0x4f848a){return db['FaxQueueReport'][_0x8665('0x49')]({'where':{'id':_0x46e6bd[_0x8665('0x4e')]['id']}})[_0x8665('0x26')](handleEntityNotFound(_0x4f848a,null))[_0x8665('0x26')](removeEntity(_0x4f848a,null))['catch'](handleError(_0x4f848a,null));};exports[_0x8665('0x4f')]=function(_0x10ac24,_0x4c4c36){return db[_0x8665('0x2e')][_0x8665('0x4f')]()[_0x8665('0x26')](respondWithResult(_0x4c4c36,null))[_0x8665('0x4a')](handleError(_0x4c4c36,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e3705d4..a763ae0 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x52b7f5,_0x2e2834){var _0x41fd6c=function(_0x31f79c){while(--_0x31f79c){_0x52b7f5['push'](_0x52b7f5['shift']());}};_0x41fd6c(++_0x2e2834);}(_0x53ec,0x192));var _0xc53e=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x53ec[_0x568f96];return _0x5a053a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x7d824e,_0x1c17d8){var _0x44b2ac=function(_0x588c34){while(--_0x588c34){_0x7d824e['push'](_0x7d824e['shift']());}};_0x44b2ac(++_0x1c17d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8a8ff22..56b6c95 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 _0x9150=['attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','then','debug','UpdateFaxQueueReport','update','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9150,0x16d));var _0x0915=function(_0x832a7d,_0x2fdc59){_0x832a7d=_0x832a7d-0x0;var _0xed007=_0x9150[_0x832a7d];return _0xed007;};'use strict';var _=require('lodash');var util=require(_0x0915('0x0'));var moment=require(_0x0915('0x1'));var BPromise=require(_0x0915('0x2'));var rs=require(_0x0915('0x3'));var fs=require('fs');var Redis=require(_0x0915('0x4'));var db=require(_0x0915('0x5'))['db'];var utils=require(_0x0915('0x6'));var logger=require(_0x0915('0x7'))(_0x0915('0x8'));var config=require('../../config/environment');var jayson=require(_0x0915('0x9'));var client=jayson[_0x0915('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e836f,_0x531002,_0x14dd39){return new BPromise(function(_0x2c293c,_0x1df9ff){return client[_0x0915('0xb')](_0x4e836f,_0x14dd39)['then'](function(_0x5de772){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x531002,_0x0915('0xc'));logger['debug'](_0x0915('0xd'),_0x531002,_0x0915('0xc'),JSON[_0x0915('0xe')](_0x5de772));if(_0x5de772[_0x0915('0xf')]){if(_0x5de772[_0x0915('0xf')][_0x0915('0x10')]===0x1f4){logger[_0x0915('0xf')](_0x0915('0x11'),_0x531002,_0x5de772[_0x0915('0xf')][_0x0915('0x12')]);return _0x1df9ff(_0x5de772[_0x0915('0xf')][_0x0915('0x12')]);}logger[_0x0915('0xf')](_0x0915('0x11'),_0x531002,_0x5de772[_0x0915('0xf')]['message']);return _0x2c293c(_0x5de772[_0x0915('0xf')][_0x0915('0x12')]);}else{logger[_0x0915('0x13')](_0x0915('0x11'),_0x531002,_0x0915('0xc'));_0x2c293c(_0x5de772[_0x0915('0x14')]['message']);}})[_0x0915('0x15')](function(_0x57fae5){logger['error'](_0x0915('0x11'),_0x531002,_0x57fae5);_0x1df9ff(_0x57fae5);});});}exports[_0x0915('0x16')]=function(_0x102bce){var _0x23cdba=this;return new Promise(function(_0x169929,_0x1184a0){return db[_0x0915('0x17')]['create'](_0x102bce[_0x0915('0x18')],{'raw':_0x102bce['options']?_0x102bce[_0x0915('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0915('0x1a')](function(_0x112452){logger[_0x0915('0x13')](_0x0915('0x16'),_0x102bce);logger[_0x0915('0x1b')](_0x0915('0x16'),_0x102bce,JSON['stringify'](_0x112452));_0x169929(_0x112452);})['catch'](function(_0x205393){logger['error'](_0x0915('0x16'),_0x205393[_0x0915('0x12')],_0x102bce);_0x1184a0(_0x23cdba[_0x0915('0xf')](0x1f4,_0x205393[_0x0915('0x12')]));});});};exports[_0x0915('0x1c')]=function(_0x103bb9){var _0x4f91b4=this;return new Promise(function(_0x149838,_0x4586ef){return db[_0x0915('0x17')][_0x0915('0x1d')](_0x103bb9[_0x0915('0x18')],{'raw':_0x103bb9['options']?_0x103bb9[_0x0915('0x19')][_0x0915('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x103bb9[_0x0915('0x19')]?_0x103bb9[_0x0915('0x19')]['where']||null:null,'attributes':_0x103bb9[_0x0915('0x19')]?_0x103bb9[_0x0915('0x19')][_0x0915('0x1f')]||null:null,'limit':_0x103bb9[_0x0915('0x19')]?_0x103bb9[_0x0915('0x19')][_0x0915('0x20')]||null:null})[_0x0915('0x1a')](function(_0x5e3603){logger[_0x0915('0x13')](_0x0915('0x1c'),_0x103bb9);logger[_0x0915('0x1b')]('UpdateFaxQueueReport',_0x103bb9,JSON['stringify'](_0x5e3603));_0x149838(_0x5e3603);})[_0x0915('0x15')](function(_0x130f35){logger[_0x0915('0xf')](_0x0915('0x1c'),_0x130f35['message'],_0x103bb9);_0x4586ef(_0x4f91b4[_0x0915('0xf')](0x1f4,_0x130f35[_0x0915('0x12')]));});});}; \ No newline at end of file +var _0x61ee=['options','raw','UpdateFaxQueueReport','update','where','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body'];(function(_0x53f851,_0x26a116){var _0x202366=function(_0x3e6f8a){while(--_0x3e6f8a){_0x53f851['push'](_0x53f851['shift']());}};_0x202366(++_0x26a116);}(_0x61ee,0x113));var _0xe61e=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x61ee[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0xe61e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe61e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe61e('0x2'))['db'];var utils=require(_0xe61e('0x3'));var logger=require(_0xe61e('0x4'))(_0xe61e('0x5'));var config=require(_0xe61e('0x6'));var jayson=require(_0xe61e('0x7'));var client=jayson[_0xe61e('0x8')][_0xe61e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34cea0,_0x2204be,_0x10901a){return new BPromise(function(_0x23f959,_0x5ea019){return client['request'](_0x34cea0,_0x10901a)[_0xe61e('0xa')](function(_0x3bc47a){logger[_0xe61e('0xb')](_0xe61e('0xc'),_0x2204be,'request\x20sent');logger[_0xe61e('0xd')](_0xe61e('0xe'),_0x2204be,_0xe61e('0xf'),JSON[_0xe61e('0x10')](_0x3bc47a));if(_0x3bc47a[_0xe61e('0x11')]){if(_0x3bc47a[_0xe61e('0x11')][_0xe61e('0x12')]===0x1f4){logger[_0xe61e('0x11')](_0xe61e('0xc'),_0x2204be,_0x3bc47a[_0xe61e('0x11')][_0xe61e('0x13')]);return _0x5ea019(_0x3bc47a[_0xe61e('0x11')][_0xe61e('0x13')]);}logger[_0xe61e('0x11')](_0xe61e('0xc'),_0x2204be,_0x3bc47a[_0xe61e('0x11')]['message']);return _0x23f959(_0x3bc47a[_0xe61e('0x11')][_0xe61e('0x13')]);}else{logger[_0xe61e('0xb')](_0xe61e('0xc'),_0x2204be,_0xe61e('0xf'));_0x23f959(_0x3bc47a[_0xe61e('0x14')][_0xe61e('0x13')]);}})[_0xe61e('0x15')](function(_0x5ad1d8){logger[_0xe61e('0x11')](_0xe61e('0xc'),_0x2204be,_0x5ad1d8);_0x5ea019(_0x5ad1d8);});});}exports[_0xe61e('0x16')]=function(_0x46709e){var _0x1c31ce=this;return new Promise(function(_0x3a67b1,_0x391f20){return db[_0xe61e('0x17')]['create'](_0x46709e[_0xe61e('0x18')],{'raw':_0x46709e[_0xe61e('0x19')]?_0x46709e['options'][_0xe61e('0x1a')]===undefined?!![]:![]:!![]})[_0xe61e('0xa')](function(_0x42a39d){logger['info'](_0xe61e('0x16'),_0x46709e);logger[_0xe61e('0xd')](_0xe61e('0x16'),_0x46709e,JSON[_0xe61e('0x10')](_0x42a39d));_0x3a67b1(_0x42a39d);})[_0xe61e('0x15')](function(_0x3ff69e){logger[_0xe61e('0x11')](_0xe61e('0x16'),_0x3ff69e[_0xe61e('0x13')],_0x46709e);_0x391f20(_0x1c31ce[_0xe61e('0x11')](0x1f4,_0x3ff69e[_0xe61e('0x13')]));});});};exports[_0xe61e('0x1b')]=function(_0x385870){var _0x3b237d=this;return new Promise(function(_0x3eec12,_0x27531c){return db[_0xe61e('0x17')][_0xe61e('0x1c')](_0x385870[_0xe61e('0x18')],{'raw':_0x385870[_0xe61e('0x19')]?_0x385870['options'][_0xe61e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385870[_0xe61e('0x19')]?_0x385870[_0xe61e('0x19')][_0xe61e('0x1d')]||null:null,'attributes':_0x385870['options']?_0x385870[_0xe61e('0x19')]['attributes']||null:null,'limit':_0x385870[_0xe61e('0x19')]?_0x385870[_0xe61e('0x19')]['limit']||null:null})[_0xe61e('0xa')](function(_0x136cc2){logger[_0xe61e('0xb')](_0xe61e('0x1b'),_0x385870);logger[_0xe61e('0xd')](_0xe61e('0x1b'),_0x385870,JSON[_0xe61e('0x10')](_0x136cc2));_0x3eec12(_0x136cc2);})['catch'](function(_0x21d326){logger[_0xe61e('0x11')]('UpdateFaxQueueReport',_0x21d326[_0xe61e('0x13')],_0x385870);_0x27531c(_0x3b237d[_0xe61e('0x11')](0x1f4,_0x21d326['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1be5605..b028138 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 _0x75fe=['show','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4f882a,_0xf88f2e){var _0x896723=function(_0x1f9274){while(--_0x1f9274){_0x4f882a['push'](_0x4f882a['shift']());}};_0x896723(++_0xf88f2e);}(_0x75fe,0x109));var _0xe75f=function(_0xe56997,_0x58e51f){_0xe56997=_0xe56997-0x0;var _0x39de07=_0x75fe[_0xe56997];return _0x39de07;};'use strict';var multer=require('multer');var util=require(_0xe75f('0x0'));var path=require(_0xe75f('0x1'));var timeout=require(_0xe75f('0x2'));var express=require(_0xe75f('0x3'));var router=express[_0xe75f('0x4')]();var fs_extra=require(_0xe75f('0x5'));var auth=require(_0xe75f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe75f('0x7'));var controller=require(_0xe75f('0x8'));router[_0xe75f('0x9')]('/',auth['isAuthenticated'](),controller[_0xe75f('0xa')]);router[_0xe75f('0x9')](_0xe75f('0xb'),auth[_0xe75f('0xc')](),controller[_0xe75f('0xd')]);router[_0xe75f('0x9')](_0xe75f('0xe'),auth[_0xe75f('0xc')](),controller[_0xe75f('0xf')]);router[_0xe75f('0x10')]('/',auth[_0xe75f('0xc')](),controller[_0xe75f('0x11')]);router['put'](_0xe75f('0xe'),auth[_0xe75f('0xc')](),controller[_0xe75f('0x12')]);router['delete'](_0xe75f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xe75f('0x13')]=router; \ No newline at end of file +var _0x19bb=['/describe','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x5e3a57,_0x2d084c){var _0x127431=function(_0x3fd9fe){while(--_0x3fd9fe){_0x5e3a57['push'](_0x5e3a57['shift']());}};_0x127431(++_0x2d084c);}(_0x19bb,0xf8));var _0xb19b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x19bb[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xb19b('0x0'));var util=require(_0xb19b('0x1'));var path=require('path');var timeout=require(_0xb19b('0x2'));var express=require(_0xb19b('0x3'));var router=express[_0xb19b('0x4')]();var fs_extra=require(_0xb19b('0x5'));var auth=require(_0xb19b('0x6'));var interaction=require(_0xb19b('0x7'));var config=require(_0xb19b('0x8'));var controller=require(_0xb19b('0x9'));router[_0xb19b('0xa')]('/',auth[_0xb19b('0xb')](),controller['index']);router[_0xb19b('0xa')](_0xb19b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xb19b('0xa')](_0xb19b('0xd'),auth[_0xb19b('0xb')](),controller[_0xb19b('0xe')]);router[_0xb19b('0xf')]('/',auth['isAuthenticated'](),controller[_0xb19b('0x10')]);router[_0xb19b('0x11')](_0xb19b('0xd'),auth[_0xb19b('0xb')](),controller['update']);router['delete'](_0xb19b('0xd'),auth[_0xb19b('0xb')](),controller[_0xb19b('0x12')]);module[_0xb19b('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 7f853fb..0d01a8d 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2aa788,_0x498eb8){var _0x5be967=function(_0x546ba9){while(--_0x546ba9){_0x2aa788['push'](_0x2aa788['shift']());}};_0x5be967(++_0x498eb8);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x361ad7,_0xf58507){var _0x5a6c95=function(_0x5f429f){while(--_0x5f429f){_0x361ad7['push'](_0x361ad7['shift']());}};_0x5a6c95(++_0xf58507);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xf3cd[_0x2fff83];return _0xa2a722;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7a21927..63fba44 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 _0xb922=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','catch','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','model'];(function(_0x5b2250,_0x445f9d){var _0x10964d=function(_0x77d924){while(--_0x77d924){_0x5b2250['push'](_0x5b2250['shift']());}};_0x10964d(++_0x445f9d);}(_0xb922,0x152));var _0x2b92=function(_0xe2bb9e,_0x2629a9){_0xe2bb9e=_0xe2bb9e-0x0;var _0x43ba10=_0xb922[_0xe2bb9e];return _0x43ba10;};'use strict';var emlformat=require(_0x2b92('0x0'));var rimraf=require(_0x2b92('0x1'));var zipdir=require(_0x2b92('0x2'));var jsonpatch=require(_0x2b92('0x3'));var rp=require(_0x2b92('0x4'));var moment=require(_0x2b92('0x5'));var BPromise=require(_0x2b92('0x6'));var Mustache=require(_0x2b92('0x7'));var util=require(_0x2b92('0x8'));var path=require(_0x2b92('0x9'));var sox=require(_0x2b92('0xa'));var csv=require(_0x2b92('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b92('0xc'));var jsforce=require(_0x2b92('0xd'));var deskjs=require(_0x2b92('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b92('0xf'));var Papa=require(_0x2b92('0x10'));var Redis=require(_0x2b92('0x11'));var authService=require(_0x2b92('0x12'));var qs=require(_0x2b92('0x13'));var as=require(_0x2b92('0x14'));var hardwareService=require(_0x2b92('0x15'));var logger=require(_0x2b92('0x16'))(_0x2b92('0x17'));var utils=require(_0x2b92('0x18'));var config=require(_0x2b92('0x19'));var licenseUtil=require(_0x2b92('0x1a'));var db=require(_0x2b92('0x1b'))['db'];function respondWithStatusCode(_0x25eeca,_0x561445){_0x561445=_0x561445||0xcc;return function(_0xf99cb3){if(_0xf99cb3){return _0x25eeca['sendStatus'](_0x561445);}return _0x25eeca['status'](_0x561445)[_0x2b92('0x1c')]();};}function respondWithResult(_0x4d1539,_0x5ab7a8){_0x5ab7a8=_0x5ab7a8||0xc8;return function(_0x5ee3eb){if(_0x5ee3eb){return _0x4d1539['status'](_0x5ab7a8)[_0x2b92('0x1d')](_0x5ee3eb);}};}function respondWithFilteredResult(_0x39d029,_0x12a192){return function(_0x347f5e){if(_0x347f5e){var _0x72d9c2=typeof _0x12a192[_0x2b92('0x1e')]===_0x2b92('0x1f')&&typeof _0x12a192['limit']===_0x2b92('0x1f');var _0x13d335=_0x347f5e[_0x2b92('0x20')];var _0x19a649=_0x72d9c2?0x0:_0x12a192[_0x2b92('0x1e')];var _0x2bad96=_0x72d9c2?_0x347f5e[_0x2b92('0x20')]:_0x12a192['offset']+_0x12a192[_0x2b92('0x21')];var _0x1ee3d6;if(_0x2bad96>=_0x13d335){_0x2bad96=_0x13d335;_0x1ee3d6=0xc8;}else{_0x1ee3d6=0xce;}_0x39d029['status'](_0x1ee3d6);return _0x39d029[_0x2b92('0x22')](_0x2b92('0x23'),_0x19a649+'-'+_0x2bad96+'/'+_0x13d335)['json'](_0x347f5e);}return null;};}function patchUpdates(_0x1f76ee){return function(_0x38cb74){try{jsonpatch[_0x2b92('0x24')](_0x38cb74,_0x1f76ee,!![]);}catch(_0x49c181){return BPromise[_0x2b92('0x25')](_0x49c181);}return _0x38cb74[_0x2b92('0x26')]();};}function saveUpdates(_0x4308e1,_0xd9223c){return function(_0x12562c){if(_0x12562c){return _0x12562c['update'](_0x4308e1)[_0x2b92('0x27')](function(_0x26d390){return _0x26d390;});}return null;};}function removeEntity(_0x352969,_0x30ba1a){return function(_0x28de1a){if(_0x28de1a){return _0x28de1a[_0x2b92('0x28')]()[_0x2b92('0x27')](function(){_0x352969[_0x2b92('0x29')](0xcc)[_0x2b92('0x1c')]();});}};}function handleEntityNotFound(_0x778087,_0x236e16){return function(_0xc920ec){if(!_0xc920ec){_0x778087['sendStatus'](0x194);}return _0xc920ec;};}function handleError(_0x18ed04,_0x1e3c29){_0x1e3c29=_0x1e3c29||0x1f4;return function(_0x533472){logger[_0x2b92('0x2a')](_0x533472[_0x2b92('0x2b')]);if(_0x533472[_0x2b92('0x2c')]){delete _0x533472[_0x2b92('0x2c')];}_0x18ed04[_0x2b92('0x29')](_0x1e3c29)[_0x2b92('0x2d')](_0x533472);};}exports[_0x2b92('0x2e')]=function(_0x13743e,_0x49490b){var _0x1249b6={},_0x25bcb8={},_0x48b78e={'count':0x0,'rows':[]};var _0x31e5eb=_[_0x2b92('0x2f')](db['FaxTransferReport'][_0x2b92('0x30')],function(_0x2ceb41){return{'name':_0x2ceb41[_0x2b92('0x31')],'type':_0x2ceb41[_0x2b92('0x32')]['key']};});_0x25bcb8[_0x2b92('0x33')]=_[_0x2b92('0x2f')](_0x31e5eb,_0x2b92('0x2c'));_0x25bcb8[_0x2b92('0x34')]=_[_0x2b92('0x35')](_0x13743e['query']);_0x25bcb8['filters']=_[_0x2b92('0x36')](_0x25bcb8['model'],_0x25bcb8[_0x2b92('0x34')]);_0x1249b6[_0x2b92('0x37')]=_[_0x2b92('0x36')](_0x25bcb8['model'],qs[_0x2b92('0x38')](_0x13743e[_0x2b92('0x34')]['fields']));_0x1249b6[_0x2b92('0x37')]=_0x1249b6[_0x2b92('0x37')][_0x2b92('0x39')]?_0x1249b6[_0x2b92('0x37')]:_0x25bcb8[_0x2b92('0x33')];if(!_0x13743e['query'][_0x2b92('0x3a')](_0x2b92('0x3b'))){_0x1249b6['limit']=qs['limit'](_0x13743e[_0x2b92('0x34')][_0x2b92('0x21')]);_0x1249b6['offset']=qs[_0x2b92('0x1e')](_0x13743e[_0x2b92('0x34')][_0x2b92('0x1e')]);}_0x1249b6['order']=qs['sort'](_0x13743e[_0x2b92('0x34')]['sort']);_0x1249b6[_0x2b92('0x3c')]=qs[_0x2b92('0x3d')](_[_0x2b92('0x3e')](_0x13743e['query'],_0x25bcb8[_0x2b92('0x3d')]),_0x31e5eb);if(_0x13743e[_0x2b92('0x34')]['filter']){_0x1249b6[_0x2b92('0x3c')]=_[_0x2b92('0x3f')](_0x1249b6[_0x2b92('0x3c')],{'$or':_[_0x2b92('0x2f')](_0x31e5eb,function(_0x556396){if(_0x556396['type']!==_0x2b92('0x40')){var _0x1ef2a9={};_0x1ef2a9[_0x556396['name']]={'$like':'%'+_0x13743e[_0x2b92('0x34')]['filter']+'%'};return _0x1ef2a9;}})});}_0x1249b6=_[_0x2b92('0x3f')]({},_0x1249b6,_0x13743e[_0x2b92('0x41')]);var _0x3b1450={'where':_0x1249b6[_0x2b92('0x3c')]};return db[_0x2b92('0x42')]['count'](_0x3b1450)[_0x2b92('0x27')](function(_0x2652f7){_0x48b78e['count']=_0x2652f7;if(_0x13743e[_0x2b92('0x34')][_0x2b92('0x43')]){_0x1249b6[_0x2b92('0x44')]=[{'all':!![]}];}return db[_0x2b92('0x42')][_0x2b92('0x45')](_0x1249b6);})['then'](function(_0x9168f4){_0x48b78e[_0x2b92('0x46')]=_0x9168f4;return _0x48b78e;})[_0x2b92('0x27')](respondWithFilteredResult(_0x49490b,_0x1249b6))[_0x2b92('0x47')](handleError(_0x49490b,null));};exports['show']=function(_0x48d5a4,_0x4a96b6){var _0x290afa={'raw':!![],'where':{'id':_0x48d5a4['params']['id']}},_0x438da3={};_0x438da3[_0x2b92('0x33')]=_[_0x2b92('0x35')](db['FaxTransferReport'][_0x2b92('0x30')]);_0x438da3['query']=_['keys'](_0x48d5a4['query']);_0x438da3[_0x2b92('0x3d')]=_[_0x2b92('0x36')](_0x438da3[_0x2b92('0x33')],_0x438da3[_0x2b92('0x34')]);_0x290afa[_0x2b92('0x37')]=_[_0x2b92('0x36')](_0x438da3[_0x2b92('0x33')],qs['fields'](_0x48d5a4[_0x2b92('0x34')][_0x2b92('0x38')]));_0x290afa[_0x2b92('0x37')]=_0x290afa[_0x2b92('0x37')][_0x2b92('0x39')]?_0x290afa['attributes']:_0x438da3['model'];if(_0x48d5a4['query']['includeAll']){_0x290afa[_0x2b92('0x44')]=[{'all':!![]}];}_0x290afa=_[_0x2b92('0x3f')]({},_0x290afa,_0x48d5a4[_0x2b92('0x41')]);return db[_0x2b92('0x42')][_0x2b92('0x48')](_0x290afa)[_0x2b92('0x27')](handleEntityNotFound(_0x4a96b6,null))[_0x2b92('0x27')](respondWithResult(_0x4a96b6,null))['catch'](handleError(_0x4a96b6,null));};exports[_0x2b92('0x49')]=function(_0x370563,_0x464dcb){return db[_0x2b92('0x42')][_0x2b92('0x49')](_0x370563['body'],{})[_0x2b92('0x27')](respondWithResult(_0x464dcb,0xc9))[_0x2b92('0x47')](handleError(_0x464dcb,null));};exports[_0x2b92('0x4a')]=function(_0x504e96,_0x203a6e){if(_0x504e96[_0x2b92('0x4b')]['id']){delete _0x504e96[_0x2b92('0x4b')]['id'];}return db[_0x2b92('0x42')]['find']({'where':{'id':_0x504e96[_0x2b92('0x4c')]['id']}})[_0x2b92('0x27')](handleEntityNotFound(_0x203a6e,null))[_0x2b92('0x27')](saveUpdates(_0x504e96['body'],null))[_0x2b92('0x27')](respondWithResult(_0x203a6e,null))[_0x2b92('0x47')](handleError(_0x203a6e,null));};exports[_0x2b92('0x28')]=function(_0x26c8ad,_0x42d848){return db[_0x2b92('0x42')][_0x2b92('0x48')]({'where':{'id':_0x26c8ad[_0x2b92('0x4c')]['id']}})[_0x2b92('0x27')](handleEntityNotFound(_0x42d848,null))[_0x2b92('0x27')](removeEntity(_0x42d848,null))[_0x2b92('0x47')](handleError(_0x42d848,null));};exports[_0x2b92('0x4d')]=function(_0x41593e,_0x1191c1){return db[_0x2b92('0x42')]['describe']()[_0x2b92('0x27')](respondWithResult(_0x1191c1,null))[_0x2b92('0x47')](handleError(_0x1191c1,null));}; \ No newline at end of file +var _0x6ba6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x16d57e,_0x3e98c7){var _0x25e004=function(_0x11b8aa){while(--_0x11b8aa){_0x16d57e['push'](_0x16d57e['shift']());}};_0x25e004(++_0x3e98c7);}(_0x6ba6,0xd2));var _0x66ba=function(_0x1e1b83,_0x50d288){_0x1e1b83=_0x1e1b83-0x0;var _0x13a9fb=_0x6ba6[_0x1e1b83];return _0x13a9fb;};'use strict';var emlformat=require(_0x66ba('0x0'));var rimraf=require(_0x66ba('0x1'));var zipdir=require(_0x66ba('0x2'));var jsonpatch=require(_0x66ba('0x3'));var rp=require(_0x66ba('0x4'));var moment=require(_0x66ba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x66ba('0x6'));var util=require(_0x66ba('0x7'));var path=require(_0x66ba('0x8'));var sox=require(_0x66ba('0x9'));var csv=require(_0x66ba('0xa'));var ejs=require(_0x66ba('0xb'));var fs=require('fs');var fs_extra=require(_0x66ba('0xc'));var _=require(_0x66ba('0xd'));var squel=require(_0x66ba('0xe'));var crypto=require(_0x66ba('0xf'));var jsforce=require(_0x66ba('0x10'));var deskjs=require(_0x66ba('0x11'));var toCsv=require(_0x66ba('0xa'));var querystring=require(_0x66ba('0x12'));var Papa=require(_0x66ba('0x13'));var Redis=require('ioredis');var authService=require(_0x66ba('0x14'));var qs=require(_0x66ba('0x15'));var as=require(_0x66ba('0x16'));var hardwareService=require(_0x66ba('0x17'));var logger=require(_0x66ba('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x66ba('0x19'))['db'];function respondWithStatusCode(_0x3ac57e,_0x164153){_0x164153=_0x164153||0xcc;return function(_0x10a1ea){if(_0x10a1ea){return _0x3ac57e[_0x66ba('0x1a')](_0x164153);}return _0x3ac57e[_0x66ba('0x1b')](_0x164153)[_0x66ba('0x1c')]();};}function respondWithResult(_0x468d4d,_0x5f5d39){_0x5f5d39=_0x5f5d39||0xc8;return function(_0x40ee4c){if(_0x40ee4c){return _0x468d4d['status'](_0x5f5d39)[_0x66ba('0x1d')](_0x40ee4c);}};}function respondWithFilteredResult(_0x54854d,_0x6e92d6){return function(_0x5c7083){if(_0x5c7083){var _0x5b96bb=typeof _0x6e92d6[_0x66ba('0x1e')]===_0x66ba('0x1f')&&typeof _0x6e92d6[_0x66ba('0x20')]===_0x66ba('0x1f');var _0xd23349=_0x5c7083[_0x66ba('0x21')];var _0xc5215e=_0x5b96bb?0x0:_0x6e92d6[_0x66ba('0x1e')];var _0x43fbe9=_0x5b96bb?_0x5c7083[_0x66ba('0x21')]:_0x6e92d6[_0x66ba('0x1e')]+_0x6e92d6[_0x66ba('0x20')];var _0x3ae091;if(_0x43fbe9>=_0xd23349){_0x43fbe9=_0xd23349;_0x3ae091=0xc8;}else{_0x3ae091=0xce;}_0x54854d[_0x66ba('0x1b')](_0x3ae091);return _0x54854d['set'](_0x66ba('0x22'),_0xc5215e+'-'+_0x43fbe9+'/'+_0xd23349)[_0x66ba('0x1d')](_0x5c7083);}return null;};}function patchUpdates(_0xd5b22e){return function(_0x252f9b){try{jsonpatch[_0x66ba('0x23')](_0x252f9b,_0xd5b22e,!![]);}catch(_0x1be60e){return BPromise[_0x66ba('0x24')](_0x1be60e);}return _0x252f9b[_0x66ba('0x25')]();};}function saveUpdates(_0x44a748,_0x3d26bb){return function(_0x1a7950){if(_0x1a7950){return _0x1a7950[_0x66ba('0x26')](_0x44a748)['then'](function(_0x269ea2){return _0x269ea2;});}return null;};}function removeEntity(_0x325a8f,_0xd1e97f){return function(_0x808fec){if(_0x808fec){return _0x808fec[_0x66ba('0x27')]()[_0x66ba('0x28')](function(){_0x325a8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1baf23,_0x33f1bf){return function(_0x7e16bf){if(!_0x7e16bf){_0x1baf23[_0x66ba('0x1a')](0x194);}return _0x7e16bf;};}function handleError(_0x15b7d7,_0x446e5e){_0x446e5e=_0x446e5e||0x1f4;return function(_0x590c14){logger[_0x66ba('0x29')](_0x590c14[_0x66ba('0x2a')]);if(_0x590c14['name']){delete _0x590c14[_0x66ba('0x2b')];}_0x15b7d7[_0x66ba('0x1b')](_0x446e5e)[_0x66ba('0x2c')](_0x590c14);};}exports[_0x66ba('0x2d')]=function(_0x511201,_0x2d27af){var _0x39fa8d={},_0x2b33f9={},_0x5347e6={'count':0x0,'rows':[]};var _0x32b096=_[_0x66ba('0x2e')](db[_0x66ba('0x2f')][_0x66ba('0x30')],function(_0x2ac048){return{'name':_0x2ac048[_0x66ba('0x31')],'type':_0x2ac048[_0x66ba('0x32')]['key']};});_0x2b33f9['model']=_['map'](_0x32b096,_0x66ba('0x2b'));_0x2b33f9['query']=_['keys'](_0x511201[_0x66ba('0x33')]);_0x2b33f9[_0x66ba('0x34')]=_[_0x66ba('0x35')](_0x2b33f9[_0x66ba('0x36')],_0x2b33f9[_0x66ba('0x33')]);_0x39fa8d['attributes']=_[_0x66ba('0x35')](_0x2b33f9[_0x66ba('0x36')],qs[_0x66ba('0x37')](_0x511201[_0x66ba('0x33')][_0x66ba('0x37')]));_0x39fa8d[_0x66ba('0x38')]=_0x39fa8d[_0x66ba('0x38')][_0x66ba('0x39')]?_0x39fa8d['attributes']:_0x2b33f9['model'];if(!_0x511201[_0x66ba('0x33')][_0x66ba('0x3a')](_0x66ba('0x3b'))){_0x39fa8d[_0x66ba('0x20')]=qs['limit'](_0x511201[_0x66ba('0x33')][_0x66ba('0x20')]);_0x39fa8d[_0x66ba('0x1e')]=qs['offset'](_0x511201[_0x66ba('0x33')]['offset']);}_0x39fa8d['order']=qs['sort'](_0x511201['query']['sort']);_0x39fa8d[_0x66ba('0x3c')]=qs[_0x66ba('0x34')](_[_0x66ba('0x3d')](_0x511201[_0x66ba('0x33')],_0x2b33f9['filters']),_0x32b096);if(_0x511201[_0x66ba('0x33')][_0x66ba('0x3e')]){_0x39fa8d[_0x66ba('0x3c')]=_[_0x66ba('0x3f')](_0x39fa8d[_0x66ba('0x3c')],{'$or':_[_0x66ba('0x2e')](_0x32b096,function(_0x1e7fd4){if(_0x1e7fd4[_0x66ba('0x32')]!==_0x66ba('0x40')){var _0x42f971={};_0x42f971[_0x1e7fd4['name']]={'$like':'%'+_0x511201[_0x66ba('0x33')][_0x66ba('0x3e')]+'%'};return _0x42f971;}})});}_0x39fa8d=_[_0x66ba('0x3f')]({},_0x39fa8d,_0x511201['options']);var _0x3f33bf={'where':_0x39fa8d[_0x66ba('0x3c')]};return db[_0x66ba('0x2f')][_0x66ba('0x21')](_0x3f33bf)[_0x66ba('0x28')](function(_0x1a4086){_0x5347e6[_0x66ba('0x21')]=_0x1a4086;if(_0x511201[_0x66ba('0x33')]['includeAll']){_0x39fa8d[_0x66ba('0x41')]=[{'all':!![]}];}return db[_0x66ba('0x2f')][_0x66ba('0x42')](_0x39fa8d);})[_0x66ba('0x28')](function(_0x2051b5){_0x5347e6[_0x66ba('0x43')]=_0x2051b5;return _0x5347e6;})[_0x66ba('0x28')](respondWithFilteredResult(_0x2d27af,_0x39fa8d))[_0x66ba('0x44')](handleError(_0x2d27af,null));};exports['show']=function(_0x4ad15c,_0x4a5490){var _0x9f438b={'raw':!![],'where':{'id':_0x4ad15c[_0x66ba('0x45')]['id']}},_0x27c477={};_0x27c477['model']=_[_0x66ba('0x46')](db[_0x66ba('0x2f')]['rawAttributes']);_0x27c477[_0x66ba('0x33')]=_[_0x66ba('0x46')](_0x4ad15c[_0x66ba('0x33')]);_0x27c477[_0x66ba('0x34')]=_['intersection'](_0x27c477[_0x66ba('0x36')],_0x27c477[_0x66ba('0x33')]);_0x9f438b[_0x66ba('0x38')]=_[_0x66ba('0x35')](_0x27c477[_0x66ba('0x36')],qs[_0x66ba('0x37')](_0x4ad15c[_0x66ba('0x33')][_0x66ba('0x37')]));_0x9f438b[_0x66ba('0x38')]=_0x9f438b[_0x66ba('0x38')][_0x66ba('0x39')]?_0x9f438b[_0x66ba('0x38')]:_0x27c477[_0x66ba('0x36')];if(_0x4ad15c['query'][_0x66ba('0x47')]){_0x9f438b[_0x66ba('0x41')]=[{'all':!![]}];}_0x9f438b=_['merge']({},_0x9f438b,_0x4ad15c[_0x66ba('0x48')]);return db[_0x66ba('0x2f')][_0x66ba('0x49')](_0x9f438b)['then'](handleEntityNotFound(_0x4a5490,null))['then'](respondWithResult(_0x4a5490,null))[_0x66ba('0x44')](handleError(_0x4a5490,null));};exports['create']=function(_0x29bc3c,_0x1bff68){return db[_0x66ba('0x2f')][_0x66ba('0x4a')](_0x29bc3c[_0x66ba('0x4b')],{})[_0x66ba('0x28')](respondWithResult(_0x1bff68,0xc9))[_0x66ba('0x44')](handleError(_0x1bff68,null));};exports['update']=function(_0x532f92,_0x5b4d2b){if(_0x532f92[_0x66ba('0x4b')]['id']){delete _0x532f92[_0x66ba('0x4b')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x532f92['params']['id']}})['then'](handleEntityNotFound(_0x5b4d2b,null))[_0x66ba('0x28')](saveUpdates(_0x532f92[_0x66ba('0x4b')],null))[_0x66ba('0x28')](respondWithResult(_0x5b4d2b,null))['catch'](handleError(_0x5b4d2b,null));};exports[_0x66ba('0x27')]=function(_0x587e51,_0x1cbd22){return db[_0x66ba('0x2f')][_0x66ba('0x49')]({'where':{'id':_0x587e51['params']['id']}})[_0x66ba('0x28')](handleEntityNotFound(_0x1cbd22,null))[_0x66ba('0x28')](removeEntity(_0x1cbd22,null))['catch'](handleError(_0x1cbd22,null));};exports[_0x66ba('0x4c')]=function(_0x474cc0,_0x46d2b8){return db[_0x66ba('0x2f')][_0x66ba('0x4c')]()['then'](respondWithResult(_0x46d2b8,null))[_0x66ba('0x44')](handleError(_0x46d2b8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index bfa0e56..f031d68 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 _0x5a03=['bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x3dfa44,_0x46f060){var _0x18acc1=function(_0xa43aae){while(--_0xa43aae){_0x3dfa44['push'](_0x3dfa44['shift']());}};_0x18acc1(++_0x46f060);}(_0x5a03,0x1a8));var _0x35a0=function(_0x2cfd2e,_0x3ed803){_0x2cfd2e=_0x2cfd2e-0x0;var _0x371885=_0x5a03[_0x2cfd2e];return _0x371885;};'use strict';var _=require(_0x35a0('0x0'));var util=require(_0x35a0('0x1'));var logger=require(_0x35a0('0x2'))(_0x35a0('0x3'));var moment=require(_0x35a0('0x4'));var BPromise=require(_0x35a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a0('0x6'));var rimraf=require(_0x35a0('0x7'));var config=require(_0x35a0('0x8'));var attributes=require(_0x35a0('0x9'));module[_0x35a0('0xa')]=function(_0x1d38ea,_0x16af78){return _0x1d38ea['define'](_0x35a0('0xb'),attributes,{'tableName':_0x35a0('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5217=['bluebird','request-promise','path','../../config/environment','define','report_fax_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5217,0xbb));var _0x7521=function(_0x369ffd,_0x5a35e3){_0x369ffd=_0x369ffd-0x0;var _0x1cbdf2=_0x5217[_0x369ffd];return _0x1cbdf2;};'use strict';var _=require(_0x7521('0x0'));var util=require('util');var logger=require(_0x7521('0x1'))('api');var moment=require(_0x7521('0x2'));var BPromise=require(_0x7521('0x3'));var rp=require(_0x7521('0x4'));var fs=require('fs');var path=require(_0x7521('0x5'));var rimraf=require('rimraf');var config=require(_0x7521('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x4a8ecf,_0x1616b7){return _0x4a8ecf[_0x7521('0x7')]('FaxTransferReport',attributes,{'tableName':_0x7521('0x8'),'paranoid':![],'indexes':[{'name':_0x7521('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index fa93353..730be22 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 _0x1736=['randomstring','ioredis','../../config/utils','rpc','client','http','request','then','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','bluebird'];(function(_0x5ea3f7,_0x397469){var _0x453b59=function(_0x163fa1){while(--_0x163fa1){_0x5ea3f7['push'](_0x5ea3f7['shift']());}};_0x453b59(++_0x397469);}(_0x1736,0x1dd));var _0x6173=function(_0x28f18d,_0x36cb5a){_0x28f18d=_0x28f18d-0x0;var _0x444890=_0x1736[_0x28f18d];return _0x444890;};'use strict';var _=require(_0x6173('0x0'));var util=require(_0x6173('0x1'));var moment=require('moment');var BPromise=require(_0x6173('0x2'));var rs=require(_0x6173('0x3'));var fs=require('fs');var Redis=require(_0x6173('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6173('0x5'));var logger=require('../../config/logger')(_0x6173('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6173('0x7')][_0x6173('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c9ff4,_0x112808,_0x56d868){return new BPromise(function(_0x15dfd1,_0x2c1ec7){return client[_0x6173('0x9')](_0x1c9ff4,_0x56d868)[_0x6173('0xa')](function(_0x1bc5ce){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x112808,_0x6173('0xb'));logger['debug'](_0x6173('0xc'),_0x112808,_0x6173('0xb'),JSON[_0x6173('0xd')](_0x1bc5ce));if(_0x1bc5ce[_0x6173('0xe')]){if(_0x1bc5ce[_0x6173('0xe')][_0x6173('0xf')]===0x1f4){logger['error'](_0x6173('0x10'),_0x112808,_0x1bc5ce[_0x6173('0xe')][_0x6173('0x11')]);return _0x2c1ec7(_0x1bc5ce[_0x6173('0xe')][_0x6173('0x11')]);}logger[_0x6173('0xe')](_0x6173('0x10'),_0x112808,_0x1bc5ce[_0x6173('0xe')]['message']);return _0x15dfd1(_0x1bc5ce['error'][_0x6173('0x11')]);}else{logger[_0x6173('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x112808,_0x6173('0xb'));_0x15dfd1(_0x1bc5ce[_0x6173('0x13')]['message']);}})['catch'](function(_0xb3fa2e){logger['error'](_0x6173('0x10'),_0x112808,_0xb3fa2e);_0x2c1ec7(_0xb3fa2e);});});} \ No newline at end of file +var _0x4710=['code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4710,0x16c));var _0x0471=function(_0x3fee43,_0x51b186){_0x3fee43=_0x3fee43-0x0;var _0x21db79=_0x4710[_0x3fee43];return _0x21db79;};'use strict';var _=require('lodash');var util=require(_0x0471('0x0'));var moment=require('moment');var BPromise=require(_0x0471('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0471('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0471('0x3'));var logger=require(_0x0471('0x4'))('rpc');var config=require(_0x0471('0x5'));var jayson=require(_0x0471('0x6'));var client=jayson[_0x0471('0x7')][_0x0471('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7005a3,_0x2c5642,_0xabc647){return new BPromise(function(_0x44fb95,_0x81eb48){return client['request'](_0x7005a3,_0xabc647)[_0x0471('0x9')](function(_0x4679e6){logger[_0x0471('0xa')](_0x0471('0xb'),_0x2c5642,_0x0471('0xc'));logger[_0x0471('0xd')](_0x0471('0xe'),_0x2c5642,_0x0471('0xc'),JSON['stringify'](_0x4679e6));if(_0x4679e6[_0x0471('0xf')]){if(_0x4679e6['error'][_0x0471('0x10')]===0x1f4){logger[_0x0471('0xf')](_0x0471('0xb'),_0x2c5642,_0x4679e6[_0x0471('0xf')][_0x0471('0x11')]);return _0x81eb48(_0x4679e6[_0x0471('0xf')][_0x0471('0x11')]);}logger[_0x0471('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2c5642,_0x4679e6[_0x0471('0xf')][_0x0471('0x11')]);return _0x44fb95(_0x4679e6['error']['message']);}else{logger[_0x0471('0xa')](_0x0471('0xb'),_0x2c5642,_0x0471('0xc'));_0x44fb95(_0x4679e6[_0x0471('0x12')][_0x0471('0x11')]);}})[_0x0471('0x13')](function(_0x2624c7){logger[_0x0471('0xf')](_0x0471('0xb'),_0x2c5642,_0x2624c7);_0x81eb48(_0x2624c7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 5ddc6c7..6778518 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 _0xf1ff=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','delete','exports','multer','path','express','fs-extra'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0xf1ff,0x84));var _0xff1f=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xf1ff[_0x540133];return _0x26b6e9;};'use strict';var multer=require(_0xff1f('0x0'));var util=require('util');var path=require(_0xff1f('0x1'));var timeout=require('connect-timeout');var express=require(_0xff1f('0x2'));var router=express['Router']();var fs_extra=require(_0xff1f('0x3'));var auth=require(_0xff1f('0x4'));var interaction=require(_0xff1f('0x5'));var config=require(_0xff1f('0x6'));var controller=require(_0xff1f('0x7'));router['get']('/',auth[_0xff1f('0x8')](),controller[_0xff1f('0x9')]);router[_0xff1f('0xa')](_0xff1f('0xb'),auth[_0xff1f('0x8')](),controller['describe']);router[_0xff1f('0xa')](_0xff1f('0xc'),auth[_0xff1f('0x8')](),controller[_0xff1f('0xd')]);router[_0xff1f('0xe')]('/',auth[_0xff1f('0x8')](),controller['create']);router['put'](_0xff1f('0xc'),auth[_0xff1f('0x8')](),controller['update']);router[_0xff1f('0xf')](_0xff1f('0xc'),auth[_0xff1f('0x8')](),controller['destroy']);module[_0xff1f('0x10')]=router; \ No newline at end of file +var _0x42ae=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3a99b1,_0x506570){var _0x178dac=function(_0x32c1b1){while(--_0x32c1b1){_0x3a99b1['push'](_0x3a99b1['shift']());}};_0x178dac(++_0x506570);}(_0x42ae,0x89));var _0xe42a=function(_0x5650b0,_0x1d1dff){_0x5650b0=_0x5650b0-0x0;var _0x311f58=_0x42ae[_0x5650b0];return _0x311f58;};'use strict';var multer=require(_0xe42a('0x0'));var util=require(_0xe42a('0x1'));var path=require(_0xe42a('0x2'));var timeout=require(_0xe42a('0x3'));var express=require(_0xe42a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe42a('0x5'));var interaction=require(_0xe42a('0x6'));var config=require(_0xe42a('0x7'));var controller=require(_0xe42a('0x8'));router[_0xe42a('0x9')]('/',auth[_0xe42a('0xa')](),controller[_0xe42a('0xb')]);router[_0xe42a('0x9')](_0xe42a('0xc'),auth['isAuthenticated'](),controller[_0xe42a('0xd')]);router[_0xe42a('0x9')](_0xe42a('0xe'),auth['isAuthenticated'](),controller[_0xe42a('0xf')]);router[_0xe42a('0x10')]('/',auth[_0xe42a('0xa')](),controller[_0xe42a('0x11')]);router[_0xe42a('0x12')](_0xe42a('0xe'),auth[_0xe42a('0xa')](),controller[_0xe42a('0x13')]);router[_0xe42a('0x14')](_0xe42a('0xe'),auth[_0xe42a('0xa')](),controller[_0xe42a('0x15')]);module[_0xe42a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0ec22a0..61faf1a 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 _0x4011=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','put'];(function(_0x24df34,_0x50aa1a){var _0x3980e8=function(_0x24c43f){while(--_0x24c43f){_0x24df34['push'](_0x24df34['shift']());}};_0x3980e8(++_0x50aa1a);}(_0x4011,0x1a5));var _0x1401=function(_0x51b19b,_0x5015d2){_0x51b19b=_0x51b19b-0x0;var _0x1a3cd6=_0x4011[_0x51b19b];return _0x1a3cd6;};'use strict';var multer=require(_0x1401('0x0'));var util=require(_0x1401('0x1'));var path=require(_0x1401('0x2'));var timeout=require(_0x1401('0x3'));var express=require(_0x1401('0x4'));var router=express['Router']();var fs_extra=require(_0x1401('0x5'));var auth=require(_0x1401('0x6'));var interaction=require(_0x1401('0x7'));var config=require('../../config/environment');var controller=require(_0x1401('0x8'));router['get']('/',auth[_0x1401('0x9')](),controller[_0x1401('0xa')]);router[_0x1401('0xb')](_0x1401('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1401('0xb')](_0x1401('0xd'),auth[_0x1401('0x9')](),controller[_0x1401('0xe')]);router[_0x1401('0xb')]('/:id/fields',auth[_0x1401('0x9')](),controller['getFields']);router[_0x1401('0xf')]('/',auth[_0x1401('0x9')](),controller[_0x1401('0x10')]);router[_0x1401('0xf')](_0x1401('0xd'),auth[_0x1401('0x9')](),controller[_0x1401('0x11')]);router[_0x1401('0x12')](_0x1401('0xc'),auth[_0x1401('0x9')](),controller[_0x1401('0x13')]);router[_0x1401('0x14')](_0x1401('0xc'),auth[_0x1401('0x9')](),controller[_0x1401('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd488=['exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy'];(function(_0x40f30e,_0x4729dc){var _0x2ea85a=function(_0x5e43e6){while(--_0x5e43e6){_0x40f30e['push'](_0x40f30e['shift']());}};_0x2ea85a(++_0x4729dc);}(_0xd488,0x166));var _0x8d48=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0xd488[_0x3d7de8];return _0x5e9a0c;};'use strict';var multer=require('multer');var util=require(_0x8d48('0x0'));var path=require('path');var timeout=require(_0x8d48('0x1'));var express=require(_0x8d48('0x2'));var router=express[_0x8d48('0x3')]();var fs_extra=require(_0x8d48('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8d48('0x5'));var config=require('../../config/environment');var controller=require(_0x8d48('0x6'));router[_0x8d48('0x7')]('/',auth[_0x8d48('0x8')](),controller[_0x8d48('0x9')]);router[_0x8d48('0x7')](_0x8d48('0xa'),auth[_0x8d48('0x8')](),controller[_0x8d48('0xb')]);router[_0x8d48('0x7')]('/:id/configurations',auth[_0x8d48('0x8')](),controller['getConfigurations']);router[_0x8d48('0x7')](_0x8d48('0xc'),auth['isAuthenticated'](),controller[_0x8d48('0xd')]);router[_0x8d48('0xe')]('/',auth[_0x8d48('0x8')](),controller[_0x8d48('0xf')]);router['post'](_0x8d48('0x10'),auth[_0x8d48('0x8')](),controller[_0x8d48('0x11')]);router[_0x8d48('0x12')]('/:id',auth[_0x8d48('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8d48('0x13')]);module[_0x8d48('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d73761d..c2bd50f 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 _0xcd1b=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x588bda,_0x825cdb){var _0x476748=function(_0x4d40af){while(--_0x4d40af){_0x588bda['push'](_0x588bda['shift']());}};_0x476748(++_0x825cdb);}(_0xcd1b,0xa3));var _0xbcd1=function(_0x20b117,_0x45f3b6){_0x20b117=_0x20b117-0x0;var _0x321e68=_0xcd1b[_0x20b117];return _0x321e68;};'use strict';var Sequelize=require(_0xbcd1('0x0'));module[_0xbcd1('0x1')]={'name':{'type':Sequelize[_0xbcd1('0x2')]},'description':{'type':Sequelize[_0xbcd1('0x2')]},'username':{'type':Sequelize[_0xbcd1('0x2')]},'remoteUri':{'type':Sequelize[_0xbcd1('0x2')]},'authType':{'type':Sequelize[_0xbcd1('0x3')](_0xbcd1('0x4')),'defaultValue':_0xbcd1('0x4')},'password':{'type':Sequelize[_0xbcd1('0x2')]},'consumerKey':{'type':Sequelize[_0xbcd1('0x2')]},'consumerSecret':{'type':Sequelize[_0xbcd1('0x2')]},'token':{'type':Sequelize[_0xbcd1('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbcd1('0x5'),_0xbcd1('0x6')),'defaultValue':_0xbcd1('0x5')}}; \ No newline at end of file +var _0x4cc7=['exports','STRING','basic','integrationTab','newTab'];(function(_0x506734,_0x52bb68){var _0x3d84fa=function(_0x3d0258){while(--_0x3d0258){_0x506734['push'](_0x506734['shift']());}};_0x3d84fa(++_0x52bb68);}(_0x4cc7,0xe6));var _0x74cc=function(_0xc92b81,_0x1ba725){_0xc92b81=_0xc92b81-0x0;var _0x38d666=_0x4cc7[_0xc92b81];return _0x38d666;};'use strict';var Sequelize=require('sequelize');module[_0x74cc('0x0')]={'name':{'type':Sequelize[_0x74cc('0x1')]},'description':{'type':Sequelize[_0x74cc('0x1')]},'username':{'type':Sequelize[_0x74cc('0x1')]},'remoteUri':{'type':Sequelize[_0x74cc('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x74cc('0x2')},'password':{'type':Sequelize[_0x74cc('0x1')]},'consumerKey':{'type':Sequelize[_0x74cc('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x74cc('0x1')]},'tokenSecret':{'type':Sequelize[_0x74cc('0x1')]},'serverUrl':{'type':Sequelize[_0x74cc('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x74cc('0x3'),_0x74cc('0x4')),'defaultValue':_0x74cc('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index ae16083..1fe9302 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 _0x00e7=['_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','username','password','toString','base64','concat'];(function(_0x453861,_0x174b2d){var _0x26e608=function(_0x24b92b){while(--_0x24b92b){_0x453861['push'](_0x453861['shift']());}};_0x26e608(++_0x174b2d);}(_0x00e7,0x1d8));var _0x700e=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x00e7[_0x269c42];return _0x4dad76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x700e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x700e('0x1'));var rp=require(_0x700e('0x2'));var moment=require(_0x700e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x700e('0x4'));var util=require(_0x700e('0x5'));var path=require(_0x700e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x700e('0x7'));var fs=require('fs');var fs_extra=require(_0x700e('0x8'));var _=require(_0x700e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x700e('0xa'));var deskjs=require(_0x700e('0xb'));var toCsv=require(_0x700e('0xc'));var querystring=require('querystring');var Papa=require(_0x700e('0xd'));var Redis=require(_0x700e('0xe'));var authService=require(_0x700e('0xf'));var qs=require(_0x700e('0x10'));var as=require(_0x700e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x700e('0x12'));var utils=require(_0x700e('0x13'));var config=require(_0x700e('0x14'));var licenseUtil=require(_0x700e('0x15'));var db=require(_0x700e('0x16'))['db'];var integrations=require(_0x700e('0x17'));function respondWithStatusCode(_0x5c35fd,_0xb5ade7){_0xb5ade7=_0xb5ade7||0xcc;return function(_0x47255e){if(_0x47255e){return _0x5c35fd['sendStatus'](_0xb5ade7);}return _0x5c35fd[_0x700e('0x18')](_0xb5ade7)[_0x700e('0x19')]();};}function respondWithResult(_0x57dcc2,_0x238948){_0x238948=_0x238948||0xc8;return function(_0x28b660){if(_0x28b660){return _0x57dcc2[_0x700e('0x18')](_0x238948)[_0x700e('0x1a')](_0x28b660);}};}function respondWithFilteredResult(_0x39451b,_0x24437d){return function(_0x285706){if(_0x285706){var _0x54094b=typeof _0x24437d[_0x700e('0x1b')]==='undefined'&&typeof _0x24437d[_0x700e('0x1c')]==='undefined';var _0xee1766=_0x285706[_0x700e('0x1d')];var _0x3fc01e=_0x54094b?0x0:_0x24437d[_0x700e('0x1b')];var _0x3526ec=_0x54094b?_0x285706[_0x700e('0x1d')]:_0x24437d[_0x700e('0x1b')]+_0x24437d[_0x700e('0x1c')];var _0x28ff46;if(_0x3526ec>=_0xee1766){_0x3526ec=_0xee1766;_0x28ff46=0xc8;}else{_0x28ff46=0xce;}_0x39451b[_0x700e('0x18')](_0x28ff46);return _0x39451b[_0x700e('0x1e')]('Content-Range',_0x3fc01e+'-'+_0x3526ec+'/'+_0xee1766)[_0x700e('0x1a')](_0x285706);}return null;};}function patchUpdates(_0x1605b8){return function(_0x22ef56){try{jsonpatch[_0x700e('0x1f')](_0x22ef56,_0x1605b8,!![]);}catch(_0x1619a6){return BPromise[_0x700e('0x20')](_0x1619a6);}return _0x22ef56['save']();};}function saveUpdates(_0x13f70b,_0x4b9e49){return function(_0x3b0bc7){if(_0x3b0bc7){return _0x3b0bc7[_0x700e('0x21')](_0x13f70b)[_0x700e('0x22')](function(_0x40a0e4){return _0x40a0e4;});}return null;};}function removeEntity(_0x1ec605,_0x1b0d21){return function(_0x54a3d4){if(_0x54a3d4){return _0x54a3d4[_0x700e('0x23')]()[_0x700e('0x22')](function(){_0x1ec605['status'](0xcc)[_0x700e('0x19')]();});}};}function handleEntityNotFound(_0x2bdb5f,_0x311c2f){return function(_0x4a5e36){if(!_0x4a5e36){_0x2bdb5f[_0x700e('0x24')](0x194);}return _0x4a5e36;};}function handleError(_0x3484a6,_0x2bef65){_0x2bef65=_0x2bef65||0x1f4;return function(_0x40208a){logger[_0x700e('0x25')](_0x40208a[_0x700e('0x26')]);if(_0x40208a[_0x700e('0x27')]){delete _0x40208a[_0x700e('0x27')];}_0x3484a6['status'](_0x2bef65)[_0x700e('0x28')](_0x40208a);};}exports[_0x700e('0x29')]=function(_0x540ddb,_0x499e01){var _0x121171={},_0xf23f5c={},_0x209261={'count':0x0,'rows':[]};var _0x575436=_[_0x700e('0x2a')](db[_0x700e('0x2b')][_0x700e('0x2c')],function(_0x55e7e5){return{'name':_0x55e7e5[_0x700e('0x2d')],'type':_0x55e7e5[_0x700e('0x2e')][_0x700e('0x2f')]};});_0xf23f5c[_0x700e('0x30')]=_[_0x700e('0x2a')](_0x575436,_0x700e('0x27'));_0xf23f5c[_0x700e('0x31')]=_[_0x700e('0x32')](_0x540ddb[_0x700e('0x31')]);_0xf23f5c[_0x700e('0x33')]=_[_0x700e('0x34')](_0xf23f5c['model'],_0xf23f5c[_0x700e('0x31')]);_0x121171[_0x700e('0x35')]=_['intersection'](_0xf23f5c[_0x700e('0x30')],qs[_0x700e('0x36')](_0x540ddb['query'][_0x700e('0x36')]));_0x121171[_0x700e('0x35')]=_0x121171['attributes'][_0x700e('0x37')]?_0x121171['attributes']:_0xf23f5c[_0x700e('0x30')];if(!_0x540ddb['query'][_0x700e('0x38')](_0x700e('0x39'))){_0x121171[_0x700e('0x1c')]=qs[_0x700e('0x1c')](_0x540ddb[_0x700e('0x31')][_0x700e('0x1c')]);_0x121171[_0x700e('0x1b')]=qs[_0x700e('0x1b')](_0x540ddb[_0x700e('0x31')][_0x700e('0x1b')]);}_0x121171[_0x700e('0x3a')]=qs[_0x700e('0x3b')](_0x540ddb[_0x700e('0x31')]['sort']);_0x121171['where']=qs[_0x700e('0x33')](_[_0x700e('0x3c')](_0x540ddb[_0x700e('0x31')],_0xf23f5c[_0x700e('0x33')]),_0x575436);if(_0x540ddb[_0x700e('0x31')][_0x700e('0x3d')]){_0x121171[_0x700e('0x3e')]=_[_0x700e('0x3f')](_0x121171['where'],{'$or':_[_0x700e('0x2a')](_0x575436,function(_0x1e77c5){if(_0x1e77c5['type']!==_0x700e('0x40')){var _0x3d3a60={};_0x3d3a60[_0x1e77c5[_0x700e('0x27')]]={'$like':'%'+_0x540ddb['query']['filter']+'%'};return _0x3d3a60;}})});}_0x121171=_[_0x700e('0x3f')]({},_0x121171,_0x540ddb['options']);var _0x58c9b0={'where':_0x121171['where']};return db[_0x700e('0x2b')][_0x700e('0x1d')](_0x58c9b0)[_0x700e('0x22')](function(_0x28beff){_0x209261[_0x700e('0x1d')]=_0x28beff;if(_0x540ddb[_0x700e('0x31')][_0x700e('0x41')]){_0x121171['include']=[{'all':!![]}];}return db[_0x700e('0x2b')][_0x700e('0x42')](_0x121171);})[_0x700e('0x22')](function(_0x1db655){_0x209261[_0x700e('0x43')]=_0x1db655;return _0x209261;})[_0x700e('0x22')](respondWithFilteredResult(_0x499e01,_0x121171))['catch'](handleError(_0x499e01,null));};exports[_0x700e('0x44')]=function(_0x541b60,_0x384f33){var _0x680668={'raw':![],'where':{'id':_0x541b60[_0x700e('0x45')]['id']}},_0x442de7={};_0x442de7[_0x700e('0x30')]=_[_0x700e('0x32')](db[_0x700e('0x2b')][_0x700e('0x2c')]);_0x442de7[_0x700e('0x31')]=_[_0x700e('0x32')](_0x541b60[_0x700e('0x31')]);_0x442de7[_0x700e('0x33')]=_[_0x700e('0x34')](_0x442de7[_0x700e('0x30')],_0x442de7[_0x700e('0x31')]);_0x680668[_0x700e('0x35')]=_[_0x700e('0x34')](_0x442de7[_0x700e('0x30')],qs[_0x700e('0x36')](_0x541b60['query']['fields']));_0x680668['attributes']=_0x680668[_0x700e('0x35')]['length']?_0x680668[_0x700e('0x35')]:_0x442de7[_0x700e('0x30')];if(_0x541b60['query']['includeAll']){_0x680668[_0x700e('0x46')]=[{'all':!![]}];}_0x680668=_['merge']({},_0x680668,_0x541b60[_0x700e('0x47')]);return db['DeskAccount'][_0x700e('0x48')](_0x680668)[_0x700e('0x22')](handleEntityNotFound(_0x384f33,null))[_0x700e('0x22')](respondWithResult(_0x384f33,null))[_0x700e('0x49')](handleError(_0x384f33,null));};exports[_0x700e('0x4a')]=function(_0x4f956d,_0x3a6ab9){return db[_0x700e('0x2b')][_0x700e('0x4a')](_0x4f956d[_0x700e('0x4b')],{})[_0x700e('0x22')](respondWithResult(_0x3a6ab9,0xc9))[_0x700e('0x49')](handleError(_0x3a6ab9,null));};exports[_0x700e('0x21')]=function(_0x2271dd,_0x49d6ae){if(_0x2271dd[_0x700e('0x4b')]['id']){delete _0x2271dd[_0x700e('0x4b')]['id'];}return db[_0x700e('0x2b')][_0x700e('0x48')]({'where':{'id':_0x2271dd[_0x700e('0x45')]['id']}})['then'](handleEntityNotFound(_0x49d6ae,null))[_0x700e('0x22')](saveUpdates(_0x2271dd['body'],null))[_0x700e('0x22')](respondWithResult(_0x49d6ae,null))[_0x700e('0x49')](handleError(_0x49d6ae,null));};exports[_0x700e('0x23')]=function(_0x3007c2,_0x1493b2){return db[_0x700e('0x2b')][_0x700e('0x48')]({'where':{'id':_0x3007c2['params']['id']}})[_0x700e('0x22')](handleEntityNotFound(_0x1493b2,null))['then'](removeEntity(_0x1493b2,null))[_0x700e('0x49')](handleError(_0x1493b2,null));};exports[_0x700e('0x4c')]=function(_0x468bff,_0x52803b,_0x75d400){var _0x36ee70={};var _0x38e4a5={};var _0x54a445;var _0x56443e;return db[_0x700e('0x2b')][_0x700e('0x4d')]({'where':{'id':_0x468bff[_0x700e('0x45')]['id']}})['then'](handleEntityNotFound(_0x52803b,null))['then'](function(_0x30a369){if(_0x30a369){_0x54a445=_0x30a369;_0x38e4a5[_0x700e('0x30')]=_[_0x700e('0x32')](db['DeskConfiguration']['rawAttributes']);_0x38e4a5[_0x700e('0x31')]=_['keys'](_0x468bff[_0x700e('0x31')]);_0x38e4a5['filters']=_['intersection'](_0x38e4a5[_0x700e('0x30')],_0x38e4a5[_0x700e('0x31')]);_0x36ee70[_0x700e('0x35')]=_[_0x700e('0x34')](_0x38e4a5['model'],qs[_0x700e('0x36')](_0x468bff[_0x700e('0x31')][_0x700e('0x36')]));_0x36ee70[_0x700e('0x35')]=_0x36ee70['attributes'][_0x700e('0x37')]?_0x36ee70[_0x700e('0x35')]:_0x38e4a5[_0x700e('0x30')];_0x36ee70[_0x700e('0x3a')]=qs[_0x700e('0x3b')](_0x468bff[_0x700e('0x31')]['sort']);_0x36ee70[_0x700e('0x3e')]=qs['filters'](_[_0x700e('0x3c')](_0x468bff[_0x700e('0x31')],_0x38e4a5['filters']));if(_0x468bff[_0x700e('0x31')][_0x700e('0x3d')]){_0x36ee70['where']=_[_0x700e('0x3f')](_0x36ee70['where'],{'$or':_[_0x700e('0x2a')](_0x36ee70[_0x700e('0x35')],function(_0x24a6ba){var _0x1a3a93={};_0x1a3a93[_0x24a6ba]={'$like':'%'+_0x468bff[_0x700e('0x31')][_0x700e('0x3d')]+'%'};return _0x1a3a93;})});}_0x36ee70=_[_0x700e('0x3f')]({},_0x36ee70,_0x468bff[_0x700e('0x47')]);return _0x54a445['getConfigurations'](_0x36ee70);}})[_0x700e('0x22')](function(_0x378e1c){if(_0x378e1c){_0x56443e=_0x378e1c[_0x700e('0x37')];if(!_0x468bff[_0x700e('0x31')][_0x700e('0x38')](_0x700e('0x39'))){_0x36ee70['limit']=qs[_0x700e('0x1c')](_0x468bff[_0x700e('0x31')][_0x700e('0x1c')]);_0x36ee70[_0x700e('0x1b')]=qs['offset'](_0x468bff[_0x700e('0x31')][_0x700e('0x1b')]);}return _0x54a445[_0x700e('0x4c')](_0x36ee70);}})[_0x700e('0x22')](function(_0x4c543c){if(_0x4c543c){return _0x4c543c?{'count':_0x56443e,'rows':_0x4c543c}:null;}})['then'](respondWithResult(_0x52803b,null))[_0x700e('0x49')](handleError(_0x52803b,null));};exports[_0x700e('0x4e')]=function(_0x573027,_0x89031e,_0x36e998){if(_0x573027['body']['id']){delete _0x573027[_0x700e('0x4b')]['id'];}return db['DeskAccount'][_0x700e('0x4d')]({'where':{'id':_0x573027[_0x700e('0x45')]['id']}})['then'](handleEntityNotFound(_0x89031e,null))[_0x700e('0x22')](function(_0x4f18d9){if(_0x4f18d9){_0x573027[_0x700e('0x4b')][_0x700e('0x4f')]=_0x4f18d9['id'];_0x573027['body'][_0x700e('0x50')]=integrations[_0x700e('0x51')](_0x573027['body']['channel'],_0x573027['body'][_0x700e('0x2e')]);_0x573027['body'][_0x700e('0x52')]=integrations['getDescriptions'](_0x573027['body']['channel'],_0x573027[_0x700e('0x4b')]['type']);return db[_0x700e('0x53')][_0x700e('0x4a')](_0x573027[_0x700e('0x4b')],{'include':[{'model':db[_0x700e('0x54')],'as':_0x700e('0x50')},{'model':db[_0x700e('0x54')],'as':_0x700e('0x52')}]});}return null;})[_0x700e('0x22')](respondWithResult(_0x89031e,null))[_0x700e('0x49')](handleError(_0x89031e,null));};exports[_0x700e('0x55')]=function(_0x5e98de,_0x162775,_0x37f581){var _0x217d48=[{'name':'priority','label':_0x700e('0x56'),'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 _0x4c270e='';return db['DeskAccount'][_0x700e('0x4d')]({'where':{'id':_0x5e98de[_0x700e('0x45')]['id']},'attributes':['id',_0x700e('0x57'),_0x700e('0x58'),'username','password',_0x700e('0x59'),_0x700e('0x5a'),_0x700e('0x5b'),_0x700e('0x5c')]})[_0x700e('0x22')](handleEntityNotFound(_0x162775,null))[_0x700e('0x22')](function(_0x50f4e7){if(_0x50f4e7){_0x4c270e=_0x50f4e7[_0x700e('0x57')];var _0x1a1303=_0x4c270e[_0x700e('0x5d')](-0x1);if(_0x1a1303==='/'){_0x4c270e=_0x4c270e[_0x700e('0x5e')](0x0,_0x4c270e[_0x700e('0x5f')](_0x1a1303));}var _0x2592fc={'method':_0x700e('0x60'),'uri':util['format'](_0x700e('0x61'),_0x4c270e),'headers':{'Content-Type':_0x700e('0x62'),'Accept':_0x700e('0x62')},'json':!![]};if(_0x50f4e7[_0x700e('0x58')]===_0x700e('0x63')){_0x2592fc['headers'][_0x700e('0x64')]=util['format'](_0x700e('0x65'),new Buffer(util['format'](_0x700e('0x66'),_0x50f4e7[_0x700e('0x67')],_0x50f4e7[_0x700e('0x68')]))[_0x700e('0x69')](_0x700e('0x6a')));}return rp(_0x2592fc)[_0x700e('0x22')](function(_0x3bce14){return _0x217d48[_0x700e('0x6b')](_[_0x700e('0x2a')](_0x3bce14[_0x700e('0x6c')][_0x700e('0x6d')],function(_0x5db81b){return{'id':_0x5db81b[_0x700e('0x27')],'name':_0x5db81b[_0x700e('0x27')],'type':_0x5db81b[_0x700e('0x2e')],'active':_0x5db81b['active'],'label':_0x5db81b[_0x700e('0x6e')],'custom':!![]};}));});}})['then'](function(_0x34077a){return{'count':_0x34077a['length'],'rows':_0x34077a};})[_0x700e('0x22')](respondWithResult(_0x162775,null))['catch'](function(_0x43d91a){var _0x437767=_0x5e98de[_0x700e('0x31')]['test']?0x1f4:_0x43d91a[_0x700e('0x6f')]||0x1f4;logger[_0x700e('0x25')](_0x700e('0x70'),_0x700e('0x55'),_0x437767,JSON[_0x700e('0x71')](_0x43d91a));delete _0x43d91a['name'];if(_0x437767===0x191){_0x437767=0x190;}_0x162775['status'](_0x437767)['send'](_0x5e98de['query'][_0x700e('0x72')]?{'message':_0x700e('0x73'),'statusCode':_0x43d91a[_0x700e('0x6f')]}:_0x43d91a);});}; \ No newline at end of file +var _0xfa1e=['merge','type','includeAll','findAll','rows','show','include','find','catch','create','body','destroy','params','getConfigurations','findOne','pick','options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskConfiguration','DeskField','Descriptions','getFields','priority','remoteUri','authType','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where'];(function(_0x549565,_0x54bdb0){var _0x23c3cd=function(_0x3a81e7){while(--_0x3a81e7){_0x549565['push'](_0x549565['shift']());}};_0x23c3cd(++_0x54bdb0);}(_0xfa1e,0xae));var _0xefa1=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xfa1e[_0x4a5494];return _0x57cbb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefa1('0x0'));var zipdir=require(_0xefa1('0x1'));var jsonpatch=require(_0xefa1('0x2'));var rp=require(_0xefa1('0x3'));var moment=require(_0xefa1('0x4'));var BPromise=require(_0xefa1('0x5'));var Mustache=require(_0xefa1('0x6'));var util=require(_0xefa1('0x7'));var path=require(_0xefa1('0x8'));var sox=require(_0xefa1('0x9'));var csv=require(_0xefa1('0xa'));var ejs=require(_0xefa1('0xb'));var fs=require('fs');var fs_extra=require(_0xefa1('0xc'));var _=require(_0xefa1('0xd'));var squel=require(_0xefa1('0xe'));var crypto=require('crypto');var jsforce=require(_0xefa1('0xf'));var deskjs=require(_0xefa1('0x10'));var toCsv=require('to-csv');var querystring=require(_0xefa1('0x11'));var Papa=require('papaparse');var Redis=require(_0xefa1('0x12'));var authService=require(_0xefa1('0x13'));var qs=require(_0xefa1('0x14'));var as=require(_0xefa1('0x15'));var hardwareService=require(_0xefa1('0x16'));var logger=require(_0xefa1('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xefa1('0x18'));var licenseUtil=require(_0xefa1('0x19'));var db=require(_0xefa1('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x15bed2,_0x286a24){_0x286a24=_0x286a24||0xcc;return function(_0x105ce3){if(_0x105ce3){return _0x15bed2['sendStatus'](_0x286a24);}return _0x15bed2[_0xefa1('0x1b')](_0x286a24)[_0xefa1('0x1c')]();};}function respondWithResult(_0x52d3c0,_0x1f3d72){_0x1f3d72=_0x1f3d72||0xc8;return function(_0x10acbb){if(_0x10acbb){return _0x52d3c0[_0xefa1('0x1b')](_0x1f3d72)['json'](_0x10acbb);}};}function respondWithFilteredResult(_0x21b846,_0x11bdda){return function(_0x1c08c4){if(_0x1c08c4){var _0x283500=typeof _0x11bdda[_0xefa1('0x1d')]===_0xefa1('0x1e')&&typeof _0x11bdda[_0xefa1('0x1f')]==='undefined';var _0xb81f6a=_0x1c08c4[_0xefa1('0x20')];var _0xb05097=_0x283500?0x0:_0x11bdda[_0xefa1('0x1d')];var _0x236149=_0x283500?_0x1c08c4[_0xefa1('0x20')]:_0x11bdda[_0xefa1('0x1d')]+_0x11bdda['limit'];var _0x4cfc72;if(_0x236149>=_0xb81f6a){_0x236149=_0xb81f6a;_0x4cfc72=0xc8;}else{_0x4cfc72=0xce;}_0x21b846[_0xefa1('0x1b')](_0x4cfc72);return _0x21b846[_0xefa1('0x21')]('Content-Range',_0xb05097+'-'+_0x236149+'/'+_0xb81f6a)[_0xefa1('0x22')](_0x1c08c4);}return null;};}function patchUpdates(_0x32d906){return function(_0x40b21f){try{jsonpatch[_0xefa1('0x23')](_0x40b21f,_0x32d906,!![]);}catch(_0x58742c){return BPromise[_0xefa1('0x24')](_0x58742c);}return _0x40b21f[_0xefa1('0x25')]();};}function saveUpdates(_0xca3371,_0x3a631a){return function(_0x27bb84){if(_0x27bb84){return _0x27bb84[_0xefa1('0x26')](_0xca3371)[_0xefa1('0x27')](function(_0x2dd7b9){return _0x2dd7b9;});}return null;};}function removeEntity(_0x51611d,_0x1a457a){return function(_0x1f4ac7){if(_0x1f4ac7){return _0x1f4ac7['destroy']()[_0xefa1('0x27')](function(){_0x51611d['status'](0xcc)[_0xefa1('0x1c')]();});}};}function handleEntityNotFound(_0x29142f,_0x4886ac){return function(_0x883b3d){if(!_0x883b3d){_0x29142f[_0xefa1('0x28')](0x194);}return _0x883b3d;};}function handleError(_0x496c43,_0x530dae){_0x530dae=_0x530dae||0x1f4;return function(_0x720044){logger[_0xefa1('0x29')](_0x720044[_0xefa1('0x2a')]);if(_0x720044[_0xefa1('0x2b')]){delete _0x720044[_0xefa1('0x2b')];}_0x496c43[_0xefa1('0x1b')](_0x530dae)[_0xefa1('0x2c')](_0x720044);};}exports['index']=function(_0x5551dc,_0xeb2bc8){var _0x3f8ecc={},_0x3adefe={},_0x24546c={'count':0x0,'rows':[]};var _0x316ee2=_[_0xefa1('0x2d')](db[_0xefa1('0x2e')][_0xefa1('0x2f')],function(_0x481545){return{'name':_0x481545['fieldName'],'type':_0x481545['type']['key']};});_0x3adefe[_0xefa1('0x30')]=_[_0xefa1('0x2d')](_0x316ee2,_0xefa1('0x2b'));_0x3adefe[_0xefa1('0x31')]=_[_0xefa1('0x32')](_0x5551dc[_0xefa1('0x31')]);_0x3adefe['filters']=_[_0xefa1('0x33')](_0x3adefe[_0xefa1('0x30')],_0x3adefe[_0xefa1('0x31')]);_0x3f8ecc[_0xefa1('0x34')]=_[_0xefa1('0x33')](_0x3adefe[_0xefa1('0x30')],qs[_0xefa1('0x35')](_0x5551dc[_0xefa1('0x31')]['fields']));_0x3f8ecc[_0xefa1('0x34')]=_0x3f8ecc[_0xefa1('0x34')][_0xefa1('0x36')]?_0x3f8ecc['attributes']:_0x3adefe[_0xefa1('0x30')];if(!_0x5551dc[_0xefa1('0x31')][_0xefa1('0x37')](_0xefa1('0x38'))){_0x3f8ecc[_0xefa1('0x1f')]=qs[_0xefa1('0x1f')](_0x5551dc['query'][_0xefa1('0x1f')]);_0x3f8ecc[_0xefa1('0x1d')]=qs['offset'](_0x5551dc[_0xefa1('0x31')][_0xefa1('0x1d')]);}_0x3f8ecc[_0xefa1('0x39')]=qs[_0xefa1('0x3a')](_0x5551dc['query'][_0xefa1('0x3a')]);_0x3f8ecc['where']=qs[_0xefa1('0x3b')](_['pick'](_0x5551dc[_0xefa1('0x31')],_0x3adefe['filters']),_0x316ee2);if(_0x5551dc[_0xefa1('0x31')][_0xefa1('0x3c')]){_0x3f8ecc[_0xefa1('0x3d')]=_[_0xefa1('0x3e')](_0x3f8ecc[_0xefa1('0x3d')],{'$or':_[_0xefa1('0x2d')](_0x316ee2,function(_0x45f34e){if(_0x45f34e[_0xefa1('0x3f')]!=='VIRTUAL'){var _0x1a3174={};_0x1a3174[_0x45f34e['name']]={'$like':'%'+_0x5551dc[_0xefa1('0x31')][_0xefa1('0x3c')]+'%'};return _0x1a3174;}})});}_0x3f8ecc=_[_0xefa1('0x3e')]({},_0x3f8ecc,_0x5551dc['options']);var _0x45f5c6={'where':_0x3f8ecc[_0xefa1('0x3d')]};return db['DeskAccount']['count'](_0x45f5c6)[_0xefa1('0x27')](function(_0x1b0d58){_0x24546c[_0xefa1('0x20')]=_0x1b0d58;if(_0x5551dc[_0xefa1('0x31')][_0xefa1('0x40')]){_0x3f8ecc['include']=[{'all':!![]}];}return db[_0xefa1('0x2e')][_0xefa1('0x41')](_0x3f8ecc);})[_0xefa1('0x27')](function(_0x2b4d15){_0x24546c[_0xefa1('0x42')]=_0x2b4d15;return _0x24546c;})[_0xefa1('0x27')](respondWithFilteredResult(_0xeb2bc8,_0x3f8ecc))['catch'](handleError(_0xeb2bc8,null));};exports[_0xefa1('0x43')]=function(_0x2fe270,_0x51bfc6){var _0x5d9e8d={'raw':![],'where':{'id':_0x2fe270['params']['id']}},_0x429a65={};_0x429a65['model']=_[_0xefa1('0x32')](db[_0xefa1('0x2e')][_0xefa1('0x2f')]);_0x429a65[_0xefa1('0x31')]=_[_0xefa1('0x32')](_0x2fe270[_0xefa1('0x31')]);_0x429a65[_0xefa1('0x3b')]=_[_0xefa1('0x33')](_0x429a65[_0xefa1('0x30')],_0x429a65[_0xefa1('0x31')]);_0x5d9e8d[_0xefa1('0x34')]=_[_0xefa1('0x33')](_0x429a65[_0xefa1('0x30')],qs[_0xefa1('0x35')](_0x2fe270[_0xefa1('0x31')][_0xefa1('0x35')]));_0x5d9e8d['attributes']=_0x5d9e8d[_0xefa1('0x34')][_0xefa1('0x36')]?_0x5d9e8d[_0xefa1('0x34')]:_0x429a65[_0xefa1('0x30')];if(_0x2fe270[_0xefa1('0x31')][_0xefa1('0x40')]){_0x5d9e8d[_0xefa1('0x44')]=[{'all':!![]}];}_0x5d9e8d=_[_0xefa1('0x3e')]({},_0x5d9e8d,_0x2fe270['options']);return db[_0xefa1('0x2e')][_0xefa1('0x45')](_0x5d9e8d)['then'](handleEntityNotFound(_0x51bfc6,null))[_0xefa1('0x27')](respondWithResult(_0x51bfc6,null))[_0xefa1('0x46')](handleError(_0x51bfc6,null));};exports[_0xefa1('0x47')]=function(_0xbe987f,_0x57357e){return db['DeskAccount'][_0xefa1('0x47')](_0xbe987f['body'],{})[_0xefa1('0x27')](respondWithResult(_0x57357e,0xc9))[_0xefa1('0x46')](handleError(_0x57357e,null));};exports[_0xefa1('0x26')]=function(_0x35313a,_0x5b6fab){if(_0x35313a[_0xefa1('0x48')]['id']){delete _0x35313a[_0xefa1('0x48')]['id'];}return db[_0xefa1('0x2e')][_0xefa1('0x45')]({'where':{'id':_0x35313a['params']['id']}})[_0xefa1('0x27')](handleEntityNotFound(_0x5b6fab,null))[_0xefa1('0x27')](saveUpdates(_0x35313a['body'],null))[_0xefa1('0x27')](respondWithResult(_0x5b6fab,null))[_0xefa1('0x46')](handleError(_0x5b6fab,null));};exports[_0xefa1('0x49')]=function(_0x3f18c3,_0x48054e){return db[_0xefa1('0x2e')][_0xefa1('0x45')]({'where':{'id':_0x3f18c3[_0xefa1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48054e,null))[_0xefa1('0x27')](removeEntity(_0x48054e,null))[_0xefa1('0x46')](handleError(_0x48054e,null));};exports[_0xefa1('0x4b')]=function(_0x299e89,_0x422f8b,_0x85d48e){var _0xb37035={};var _0x14dca5={};var _0x4af3b6;var _0x5e0766;return db[_0xefa1('0x2e')][_0xefa1('0x4c')]({'where':{'id':_0x299e89[_0xefa1('0x4a')]['id']}})[_0xefa1('0x27')](handleEntityNotFound(_0x422f8b,null))[_0xefa1('0x27')](function(_0x5ceefb){if(_0x5ceefb){_0x4af3b6=_0x5ceefb;_0x14dca5[_0xefa1('0x30')]=_[_0xefa1('0x32')](db['DeskConfiguration'][_0xefa1('0x2f')]);_0x14dca5['query']=_[_0xefa1('0x32')](_0x299e89[_0xefa1('0x31')]);_0x14dca5[_0xefa1('0x3b')]=_[_0xefa1('0x33')](_0x14dca5['model'],_0x14dca5[_0xefa1('0x31')]);_0xb37035['attributes']=_[_0xefa1('0x33')](_0x14dca5[_0xefa1('0x30')],qs[_0xefa1('0x35')](_0x299e89[_0xefa1('0x31')][_0xefa1('0x35')]));_0xb37035[_0xefa1('0x34')]=_0xb37035[_0xefa1('0x34')]['length']?_0xb37035['attributes']:_0x14dca5[_0xefa1('0x30')];_0xb37035['order']=qs[_0xefa1('0x3a')](_0x299e89[_0xefa1('0x31')]['sort']);_0xb37035[_0xefa1('0x3d')]=qs['filters'](_[_0xefa1('0x4d')](_0x299e89['query'],_0x14dca5['filters']));if(_0x299e89[_0xefa1('0x31')]['filter']){_0xb37035[_0xefa1('0x3d')]=_['merge'](_0xb37035[_0xefa1('0x3d')],{'$or':_['map'](_0xb37035[_0xefa1('0x34')],function(_0x26988a){var _0x104c39={};_0x104c39[_0x26988a]={'$like':'%'+_0x299e89[_0xefa1('0x31')]['filter']+'%'};return _0x104c39;})});}_0xb37035=_[_0xefa1('0x3e')]({},_0xb37035,_0x299e89[_0xefa1('0x4e')]);return _0x4af3b6[_0xefa1('0x4b')](_0xb37035);}})['then'](function(_0x2d780d){if(_0x2d780d){_0x5e0766=_0x2d780d[_0xefa1('0x36')];if(!_0x299e89[_0xefa1('0x31')]['hasOwnProperty'](_0xefa1('0x38'))){_0xb37035['limit']=qs[_0xefa1('0x1f')](_0x299e89['query'][_0xefa1('0x1f')]);_0xb37035[_0xefa1('0x1d')]=qs['offset'](_0x299e89[_0xefa1('0x31')][_0xefa1('0x1d')]);}return _0x4af3b6['getConfigurations'](_0xb37035);}})['then'](function(_0x53725f){if(_0x53725f){return _0x53725f?{'count':_0x5e0766,'rows':_0x53725f}:null;}})['then'](respondWithResult(_0x422f8b,null))[_0xefa1('0x46')](handleError(_0x422f8b,null));};exports[_0xefa1('0x4f')]=function(_0x4899ef,_0x98b83b,_0x275c7e){if(_0x4899ef['body']['id']){delete _0x4899ef[_0xefa1('0x48')]['id'];}return db[_0xefa1('0x2e')][_0xefa1('0x4c')]({'where':{'id':_0x4899ef[_0xefa1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x98b83b,null))[_0xefa1('0x27')](function(_0xd991c5){if(_0xd991c5){_0x4899ef[_0xefa1('0x48')][_0xefa1('0x50')]=_0xd991c5['id'];_0x4899ef[_0xefa1('0x48')][_0xefa1('0x51')]=integrations[_0xefa1('0x52')](_0x4899ef[_0xefa1('0x48')][_0xefa1('0x53')],_0x4899ef['body']['type']);_0x4899ef[_0xefa1('0x48')]['Descriptions']=integrations[_0xefa1('0x54')](_0x4899ef[_0xefa1('0x48')][_0xefa1('0x53')],_0x4899ef[_0xefa1('0x48')][_0xefa1('0x3f')]);return db[_0xefa1('0x55')]['create'](_0x4899ef['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xefa1('0x56')],'as':_0xefa1('0x57')}]});}return null;})[_0xefa1('0x27')](respondWithResult(_0x98b83b,null))[_0xefa1('0x46')](handleError(_0x98b83b,null));};exports[_0xefa1('0x58')]=function(_0x3eb081,_0x1d1fd3,_0x2b1048){var _0x3e9d06=[{'name':_0xefa1('0x59'),'label':_0xefa1('0x59'),'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 _0xa75a96='';return db['DeskAccount'][_0xefa1('0x4c')]({'where':{'id':_0x3eb081['params']['id']},'attributes':['id',_0xefa1('0x5a'),_0xefa1('0x5b'),'username',_0xefa1('0x5c'),'consumerKey',_0xefa1('0x5d'),_0xefa1('0x5e'),_0xefa1('0x5f')]})[_0xefa1('0x27')](handleEntityNotFound(_0x1d1fd3,null))[_0xefa1('0x27')](function(_0x5a6f4e){if(_0x5a6f4e){_0xa75a96=_0x5a6f4e[_0xefa1('0x5a')];var _0x361095=_0xa75a96[_0xefa1('0x60')](-0x1);if(_0x361095==='/'){_0xa75a96=_0xa75a96[_0xefa1('0x61')](0x0,_0xa75a96[_0xefa1('0x62')](_0x361095));}var _0x5754d8={'method':_0xefa1('0x63'),'uri':util[_0xefa1('0x64')](_0xefa1('0x65'),_0xa75a96),'headers':{'Content-Type':_0xefa1('0x66'),'Accept':_0xefa1('0x66')},'json':!![]};if(_0x5a6f4e[_0xefa1('0x5b')]==='basic'){_0x5754d8['headers'][_0xefa1('0x67')]=util[_0xefa1('0x64')](_0xefa1('0x68'),new Buffer(util[_0xefa1('0x64')](_0xefa1('0x69'),_0x5a6f4e[_0xefa1('0x6a')],_0x5a6f4e['password']))[_0xefa1('0x6b')](_0xefa1('0x6c')));}return rp(_0x5754d8)[_0xefa1('0x27')](function(_0x52f067){return _0x3e9d06[_0xefa1('0x6d')](_['map'](_0x52f067[_0xefa1('0x6e')][_0xefa1('0x6f')],function(_0x33963a){return{'id':_0x33963a[_0xefa1('0x2b')],'name':_0x33963a['name'],'type':_0x33963a['type'],'active':_0x33963a[_0xefa1('0x70')],'label':_0x33963a[_0xefa1('0x71')],'custom':!![]};}));});}})['then'](function(_0x160737){return{'count':_0x160737[_0xefa1('0x36')],'rows':_0x160737};})[_0xefa1('0x27')](respondWithResult(_0x1d1fd3,null))['catch'](function(_0x49caab){var _0x43b8f9=_0x3eb081[_0xefa1('0x31')][_0xefa1('0x72')]?0x1f4:_0x49caab[_0xefa1('0x73')]||0x1f4;logger[_0xefa1('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xefa1('0x58'),_0x43b8f9,JSON[_0xefa1('0x74')](_0x49caab));delete _0x49caab[_0xefa1('0x2b')];if(_0x43b8f9===0x191){_0x43b8f9=0x190;}_0x1d1fd3[_0xefa1('0x1b')](_0x43b8f9)[_0xefa1('0x2c')](_0x3eb081[_0xefa1('0x31')][_0xefa1('0x72')]?{'message':_0xefa1('0x75'),'statusCode':_0x49caab['statusCode']}:_0x49caab);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4461f91..c189d80 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 _0xbe45=['moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','exports','define','DeskAccount','../../config/logger','api'];(function(_0xbe048b,_0x2f8970){var _0x1d9099=function(_0x4920e){while(--_0x4920e){_0xbe048b['push'](_0xbe048b['shift']());}};_0x1d9099(++_0x2f8970);}(_0xbe45,0x1b6));var _0x5be4=function(_0x26ed2a,_0x33cf00){_0x26ed2a=_0x26ed2a-0x0;var _0x4ef557=_0xbe45[_0x26ed2a];return _0x4ef557;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5be4('0x0'))(_0x5be4('0x1'));var moment=require(_0x5be4('0x2'));var BPromise=require(_0x5be4('0x3'));var rp=require(_0x5be4('0x4'));var fs=require('fs');var path=require(_0x5be4('0x5'));var rimraf=require(_0x5be4('0x6'));var config=require('../../config/environment');var attributes=require(_0x5be4('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5be4('0x8')]=function(_0x2892fb,_0xb611a){return _0x2892fb[_0x5be4('0x9')](_0x5be4('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fd5=['api','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','DeskAccount','int_desk_accounts','util'];(function(_0x1fb45d,_0x4a10c4){var _0x8a054=function(_0x4bd703){while(--_0x4bd703){_0x1fb45d['push'](_0x1fb45d['shift']());}};_0x8a054(++_0x4a10c4);}(_0x7fd5,0x128));var _0x57fd=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x7fd5[_0x3fc97b];return _0x3a0c82;};'use strict';var _=require('lodash');var util=require(_0x57fd('0x0'));var logger=require('../../config/logger')(_0x57fd('0x1'));var moment=require('moment');var BPromise=require(_0x57fd('0x2'));var rp=require(_0x57fd('0x3'));var fs=require('fs');var path=require(_0x57fd('0x4'));var rimraf=require(_0x57fd('0x5'));var config=require('../../config/environment');var attributes=require(_0x57fd('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x463138,_0x17207a){return _0x463138['define'](_0x57fd('0x7'),attributes,{'tableName':_0x57fd('0x8'),'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 c8b9c75..14c35c4 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 _0x97a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','request\x20sent','result','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','map','include','model','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x22d4f2,_0x5866be){var _0x7dfcab=function(_0x54b8ad){while(--_0x54b8ad){_0x22d4f2['push'](_0x22d4f2['shift']());}};_0x7dfcab(++_0x5866be);}(_0x97a5,0x177));var _0x597a=function(_0x3bf03f,_0xbfd44){_0x3bf03f=_0x3bf03f-0x0;var _0x29dc98=_0x97a5[_0x3bf03f];return _0x29dc98;};'use strict';var _=require(_0x597a('0x0'));var util=require(_0x597a('0x1'));var moment=require(_0x597a('0x2'));var BPromise=require(_0x597a('0x3'));var rs=require(_0x597a('0x4'));var fs=require('fs');var Redis=require(_0x597a('0x5'));var db=require(_0x597a('0x6'))['db'];var utils=require(_0x597a('0x7'));var logger=require(_0x597a('0x8'))(_0x597a('0x9'));var config=require(_0x597a('0xa'));var jayson=require(_0x597a('0xb'));var client=jayson['client'][_0x597a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1603cd,_0x5064a5,_0x3b5956){return new BPromise(function(_0x155882,_0x1c8d56){return client[_0x597a('0xd')](_0x1603cd,_0x3b5956)[_0x597a('0xe')](function(_0xc34ca3){logger[_0x597a('0xf')]('DeskAccount,\x20%s,\x20%s',_0x5064a5,'request\x20sent');logger[_0x597a('0x10')](_0x597a('0x11'),_0x5064a5,'request\x20sent',JSON[_0x597a('0x12')](_0xc34ca3));if(_0xc34ca3[_0x597a('0x13')]){if(_0xc34ca3[_0x597a('0x13')][_0x597a('0x14')]===0x1f4){logger['error'](_0x597a('0x15'),_0x5064a5,_0xc34ca3[_0x597a('0x13')][_0x597a('0x16')]);return _0x1c8d56(_0xc34ca3[_0x597a('0x13')][_0x597a('0x16')]);}logger[_0x597a('0x13')](_0x597a('0x15'),_0x5064a5,_0xc34ca3[_0x597a('0x13')][_0x597a('0x16')]);return _0x155882(_0xc34ca3[_0x597a('0x13')][_0x597a('0x16')]);}else{logger[_0x597a('0xf')](_0x597a('0x15'),_0x5064a5,_0x597a('0x17'));_0x155882(_0xc34ca3[_0x597a('0x18')][_0x597a('0x16')]);}})['catch'](function(_0x510f41){logger[_0x597a('0x13')](_0x597a('0x15'),_0x5064a5,_0x510f41);_0x1c8d56(_0x510f41);});});}exports[_0x597a('0x19')]=function(_0x3d50eb){var _0x163f77=this;return new Promise(function(_0x402b54,_0x3898ce){return db[_0x597a('0x1a')]['findAll']({'raw':_0x3d50eb[_0x597a('0x1b')]?_0x3d50eb[_0x597a('0x1b')][_0x597a('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d50eb[_0x597a('0x1b')]?_0x3d50eb[_0x597a('0x1b')][_0x597a('0x1d')]||null:null,'attributes':_0x3d50eb[_0x597a('0x1b')]?_0x3d50eb[_0x597a('0x1b')][_0x597a('0x1e')]||null:null,'limit':_0x3d50eb[_0x597a('0x1b')]?_0x3d50eb['options'][_0x597a('0x1f')]||null:null,'include':_0x3d50eb['options']?_0x3d50eb['options']['include']?_[_0x597a('0x20')](_0x3d50eb['options']['include'],function(_0x4e8625){return{'model':db[_0x4e8625['model']],'as':_0x4e8625['as'],'attributes':_0x4e8625[_0x597a('0x1e')],'include':_0x4e8625['include']?_[_0x597a('0x20')](_0x4e8625[_0x597a('0x21')],function(_0x1ea22f){return{'model':db[_0x1ea22f[_0x597a('0x22')]],'as':_0x1ea22f['as'],'attributes':_0x1ea22f[_0x597a('0x1e')],'include':_0x1ea22f[_0x597a('0x21')]?_[_0x597a('0x20')](_0x1ea22f[_0x597a('0x21')],function(_0x57101c){return{'model':db[_0x57101c['model']],'as':_0x57101c['as'],'attributes':_0x57101c[_0x597a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x486840){logger[_0x597a('0xf')](_0x597a('0x19'),_0x3d50eb);logger[_0x597a('0x10')]('GetDeskAccount',_0x3d50eb,JSON[_0x597a('0x12')](_0x486840));_0x402b54(_0x486840);})[_0x597a('0x23')](function(_0x29cdea){logger[_0x597a('0x13')](_0x597a('0x19'),_0x29cdea[_0x597a('0x16')],_0x3d50eb);_0x3898ce(_0x163f77['error'](0x1f4,_0x29cdea[_0x597a('0x16')]));});});};exports[_0x597a('0x24')]=function(_0x4aee41){var _0x5d657c=this;return new Promise(function(_0xb093d6,_0x1c998f){return db[_0x597a('0x1a')][_0x597a('0x25')]({'raw':_0x4aee41['options']?_0x4aee41['options'][_0x597a('0x1c')]===undefined?!![]:![]:!![],'where':_0x4aee41[_0x597a('0x1b')]?_0x4aee41['options'][_0x597a('0x1d')]||null:null,'attributes':_0x4aee41[_0x597a('0x1b')]?_0x4aee41[_0x597a('0x1b')][_0x597a('0x1e')]||null:null,'include':_0x4aee41[_0x597a('0x1b')]?_0x4aee41[_0x597a('0x1b')][_0x597a('0x21')]?_[_0x597a('0x20')](_0x4aee41[_0x597a('0x1b')][_0x597a('0x21')],function(_0x17e606){return{'model':db[_0x17e606[_0x597a('0x22')]],'as':_0x17e606['as'],'attributes':_0x17e606[_0x597a('0x1e')],'include':_0x17e606[_0x597a('0x21')]?_['map'](_0x17e606['include'],function(_0x6baa85){return{'model':db[_0x6baa85[_0x597a('0x22')]],'as':_0x6baa85['as'],'attributes':_0x6baa85['attributes'],'include':_0x6baa85[_0x597a('0x21')]?_[_0x597a('0x20')](_0x6baa85[_0x597a('0x21')],function(_0x5057b7){return{'model':db[_0x5057b7['model']],'as':_0x5057b7['as'],'attributes':_0x5057b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x597a('0xe')](function(_0x152804){logger[_0x597a('0xf')]('ShowDeskAccount',_0x4aee41);logger[_0x597a('0x10')](_0x597a('0x24'),_0x4aee41,JSON[_0x597a('0x12')](_0x152804));_0xb093d6(_0x152804);})[_0x597a('0x23')](function(_0x5994b2){logger['error']('ShowDeskAccount',_0x5994b2[_0x597a('0x16')],_0x4aee41);_0x1c998f(_0x5d657c['error'](0x1f4,_0x5994b2['message']));});});}; \ No newline at end of file +var _0x2922=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','map','include','model','ShowDeskAccount','find','where','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x4c6d81,_0x280d3a){var _0x1882bc=function(_0x35f1f8){while(--_0x35f1f8){_0x4c6d81['push'](_0x4c6d81['shift']());}};_0x1882bc(++_0x280d3a);}(_0x2922,0x87));var _0x2292=function(_0x3ab540,_0x563273){_0x3ab540=_0x3ab540-0x0;var _0x9fce9e=_0x2922[_0x3ab540];return _0x9fce9e;};'use strict';var _=require(_0x2292('0x0'));var util=require(_0x2292('0x1'));var moment=require(_0x2292('0x2'));var BPromise=require(_0x2292('0x3'));var rs=require(_0x2292('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2292('0x5'))['db'];var utils=require(_0x2292('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2292('0x7'));var jayson=require(_0x2292('0x8'));var client=jayson[_0x2292('0x9')][_0x2292('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280b5b,_0x2cfc29,_0x289b9d){return new BPromise(function(_0x269cdb,_0x5d9297){return client[_0x2292('0xb')](_0x280b5b,_0x289b9d)[_0x2292('0xc')](function(_0x3e175f){logger[_0x2292('0xd')](_0x2292('0xe'),_0x2cfc29,_0x2292('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2cfc29,_0x2292('0xf'),JSON[_0x2292('0x10')](_0x3e175f));if(_0x3e175f[_0x2292('0x11')]){if(_0x3e175f[_0x2292('0x11')][_0x2292('0x12')]===0x1f4){logger[_0x2292('0x11')](_0x2292('0xe'),_0x2cfc29,_0x3e175f[_0x2292('0x11')][_0x2292('0x13')]);return _0x5d9297(_0x3e175f[_0x2292('0x11')][_0x2292('0x13')]);}logger[_0x2292('0x11')](_0x2292('0xe'),_0x2cfc29,_0x3e175f['error'][_0x2292('0x13')]);return _0x269cdb(_0x3e175f[_0x2292('0x11')][_0x2292('0x13')]);}else{logger[_0x2292('0xd')](_0x2292('0xe'),_0x2cfc29,_0x2292('0xf'));_0x269cdb(_0x3e175f[_0x2292('0x14')]['message']);}})[_0x2292('0x15')](function(_0x47a0df){logger[_0x2292('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2cfc29,_0x47a0df);_0x5d9297(_0x47a0df);});});}exports[_0x2292('0x16')]=function(_0x1a9a06){var _0xd395aa=this;return new Promise(function(_0x42a4fd,_0x1a505f){return db[_0x2292('0x17')]['findAll']({'raw':_0x1a9a06[_0x2292('0x18')]?_0x1a9a06[_0x2292('0x18')][_0x2292('0x19')]===undefined?!![]:![]:!![],'where':_0x1a9a06[_0x2292('0x18')]?_0x1a9a06[_0x2292('0x18')]['where']||null:null,'attributes':_0x1a9a06[_0x2292('0x18')]?_0x1a9a06[_0x2292('0x18')][_0x2292('0x1a')]||null:null,'limit':_0x1a9a06['options']?_0x1a9a06[_0x2292('0x18')][_0x2292('0x1b')]||null:null,'include':_0x1a9a06[_0x2292('0x18')]?_0x1a9a06['options']['include']?_[_0x2292('0x1c')](_0x1a9a06[_0x2292('0x18')][_0x2292('0x1d')],function(_0x1bb470){return{'model':db[_0x1bb470[_0x2292('0x1e')]],'as':_0x1bb470['as'],'attributes':_0x1bb470[_0x2292('0x1a')],'include':_0x1bb470['include']?_[_0x2292('0x1c')](_0x1bb470[_0x2292('0x1d')],function(_0x143a38){return{'model':db[_0x143a38['model']],'as':_0x143a38['as'],'attributes':_0x143a38[_0x2292('0x1a')],'include':_0x143a38[_0x2292('0x1d')]?_['map'](_0x143a38[_0x2292('0x1d')],function(_0x372f61){return{'model':db[_0x372f61[_0x2292('0x1e')]],'as':_0x372f61['as'],'attributes':_0x372f61[_0x2292('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2292('0xc')](function(_0x429564){logger[_0x2292('0xd')](_0x2292('0x16'),_0x1a9a06);logger['debug'](_0x2292('0x16'),_0x1a9a06,JSON['stringify'](_0x429564));_0x42a4fd(_0x429564);})[_0x2292('0x15')](function(_0x33c0f9){logger[_0x2292('0x11')]('GetDeskAccount',_0x33c0f9[_0x2292('0x13')],_0x1a9a06);_0x1a505f(_0xd395aa[_0x2292('0x11')](0x1f4,_0x33c0f9[_0x2292('0x13')]));});});};exports[_0x2292('0x1f')]=function(_0x465937){var _0x5347b8=this;return new Promise(function(_0x2333e4,_0x33f6c4){return db[_0x2292('0x17')][_0x2292('0x20')]({'raw':_0x465937[_0x2292('0x18')]?_0x465937[_0x2292('0x18')][_0x2292('0x19')]===undefined?!![]:![]:!![],'where':_0x465937[_0x2292('0x18')]?_0x465937[_0x2292('0x18')][_0x2292('0x21')]||null:null,'attributes':_0x465937[_0x2292('0x18')]?_0x465937[_0x2292('0x18')]['attributes']||null:null,'include':_0x465937['options']?_0x465937['options'][_0x2292('0x1d')]?_[_0x2292('0x1c')](_0x465937[_0x2292('0x18')][_0x2292('0x1d')],function(_0x32f1d5){return{'model':db[_0x32f1d5[_0x2292('0x1e')]],'as':_0x32f1d5['as'],'attributes':_0x32f1d5[_0x2292('0x1a')],'include':_0x32f1d5[_0x2292('0x1d')]?_[_0x2292('0x1c')](_0x32f1d5[_0x2292('0x1d')],function(_0x410ff9){return{'model':db[_0x410ff9[_0x2292('0x1e')]],'as':_0x410ff9['as'],'attributes':_0x410ff9[_0x2292('0x1a')],'include':_0x410ff9[_0x2292('0x1d')]?_['map'](_0x410ff9['include'],function(_0x4a7b18){return{'model':db[_0x4a7b18['model']],'as':_0x4a7b18['as'],'attributes':_0x4a7b18[_0x2292('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2292('0xc')](function(_0x51ed24){logger[_0x2292('0xd')](_0x2292('0x1f'),_0x465937);logger[_0x2292('0x22')](_0x2292('0x1f'),_0x465937,JSON[_0x2292('0x10')](_0x51ed24));_0x2333e4(_0x51ed24);})[_0x2292('0x15')](function(_0xcbc869){logger[_0x2292('0x11')](_0x2292('0x1f'),_0xcbc869[_0x2292('0x13')],_0x465937);_0x33f6c4(_0x5347b8[_0x2292('0x11')](0x1f4,_0xcbc869[_0x2292('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 3a90915..0488131 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0xaff59,_0x34b15f){var _0x512721=function(_0x2b4cff){while(--_0x2b4cff){_0xaff59['push'](_0xaff59['shift']());}};_0x512721(++_0x34b15f);}(_0x3e74,0x175));var _0x43e7=function(_0x54c2ab,_0x8b17f7){_0x54c2ab=_0x54c2ab-0x0;var _0x1a5295=_0x3e74[_0x54c2ab];return _0x1a5295;};'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('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=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(_0x3b8003,_0x38b259){var _0x534867=function(_0xc1ceec){while(--_0xc1ceec){_0x3b8003['push'](_0x3b8003['shift']());}};_0x534867(++_0x38b259);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 f52f09d..4c88b22 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 _0x5b54=['sequelize','exports','STRING'];(function(_0xf9cb7a,_0x155fd9){var _0x337245=function(_0x385c3b){while(--_0x385c3b){_0xf9cb7a['push'](_0xf9cb7a['shift']());}};_0x337245(++_0x155fd9);}(_0x5b54,0x18f));var _0x45b5=function(_0x4f1297,_0x53846f){_0x4f1297=_0x4f1297-0x0;var _0x3a8538=_0x5b54[_0x4f1297];return _0x3a8538;};'use strict';var Sequelize=require(_0x45b5('0x0'));module[_0x45b5('0x1')]={'name':{'type':Sequelize[_0x45b5('0x2')]},'description':{'type':Sequelize[_0x45b5('0x2')]}}; \ No newline at end of file +var _0x06cd=['sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x06cd,0x132));var _0xd06c=function(_0x4e9a49,_0x56c62c){_0x4e9a49=_0x4e9a49-0x0;var _0x52f83c=_0x06cd[_0x4e9a49];return _0x52f83c;};'use strict';var Sequelize=require(_0xd06c('0x0'));module[_0xd06c('0x1')]={'name':{'type':Sequelize[_0xd06c('0x2')]},'description':{'type':Sequelize[_0xd06c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 875dec6..40f81c3 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 _0xc580=['where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','DeskField','length','order','getFields','getSubjects','getDescriptions','findOne','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort'];(function(_0x247f63,_0x249531){var _0x1d05c1=function(_0x1e6c45){while(--_0x1e6c45){_0x247f63['push'](_0x247f63['shift']());}};_0x1d05c1(++_0x249531);}(_0xc580,0x1b8));var _0x0c58=function(_0x4ffef2,_0x1ae3d7){_0x4ffef2=_0x4ffef2-0x0;var _0x1d5805=_0xc580[_0x4ffef2];return _0x1d5805;};'use strict';var emlformat=require(_0x0c58('0x0'));var rimraf=require(_0x0c58('0x1'));var zipdir=require(_0x0c58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c58('0x3'));var moment=require(_0x0c58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c58('0x5'));var util=require(_0x0c58('0x6'));var path=require(_0x0c58('0x7'));var sox=require(_0x0c58('0x8'));var csv=require(_0x0c58('0x9'));var ejs=require(_0x0c58('0xa'));var fs=require('fs');var fs_extra=require(_0x0c58('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c58('0xc'));var jsforce=require(_0x0c58('0xd'));var deskjs=require(_0x0c58('0xe'));var toCsv=require(_0x0c58('0x9'));var querystring=require('querystring');var Papa=require(_0x0c58('0xf'));var Redis=require(_0x0c58('0x10'));var authService=require(_0x0c58('0x11'));var qs=require(_0x0c58('0x12'));var as=require(_0x0c58('0x13'));var hardwareService=require(_0x0c58('0x14'));var logger=require(_0x0c58('0x15'))(_0x0c58('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0c58('0x17'));var db=require(_0x0c58('0x18'))['db'];function respondWithStatusCode(_0x132f1e,_0x5461d9){_0x5461d9=_0x5461d9||0xcc;return function(_0x1e1a35){if(_0x1e1a35){return _0x132f1e[_0x0c58('0x19')](_0x5461d9);}return _0x132f1e[_0x0c58('0x1a')](_0x5461d9)[_0x0c58('0x1b')]();};}function respondWithResult(_0x22f899,_0x5b9b09){_0x5b9b09=_0x5b9b09||0xc8;return function(_0x25e481){if(_0x25e481){return _0x22f899[_0x0c58('0x1a')](_0x5b9b09)[_0x0c58('0x1c')](_0x25e481);}};}function respondWithFilteredResult(_0x27f522,_0x409046){return function(_0x53a30f){if(_0x53a30f){var _0x1456ec=typeof _0x409046[_0x0c58('0x1d')]===_0x0c58('0x1e')&&typeof _0x409046[_0x0c58('0x1f')]===_0x0c58('0x1e');var _0x93a4db=_0x53a30f[_0x0c58('0x20')];var _0x5e5b63=_0x1456ec?0x0:_0x409046[_0x0c58('0x1d')];var _0x5dca0d=_0x1456ec?_0x53a30f[_0x0c58('0x20')]:_0x409046['offset']+_0x409046[_0x0c58('0x1f')];var _0x2e6fef;if(_0x5dca0d>=_0x93a4db){_0x5dca0d=_0x93a4db;_0x2e6fef=0xc8;}else{_0x2e6fef=0xce;}_0x27f522[_0x0c58('0x1a')](_0x2e6fef);return _0x27f522['set'](_0x0c58('0x21'),_0x5e5b63+'-'+_0x5dca0d+'/'+_0x93a4db)[_0x0c58('0x1c')](_0x53a30f);}return null;};}function patchUpdates(_0x528df1){return function(_0x3be024){try{jsonpatch[_0x0c58('0x22')](_0x3be024,_0x528df1,!![]);}catch(_0x282b26){return BPromise[_0x0c58('0x23')](_0x282b26);}return _0x3be024[_0x0c58('0x24')]();};}function saveUpdates(_0x183883,_0x8a698d){return function(_0x224c91){if(_0x224c91){return _0x224c91['update'](_0x183883)[_0x0c58('0x25')](function(_0x2259d4){return _0x2259d4;});}return null;};}function removeEntity(_0x1f7a53,_0x5e1999){return function(_0x2e4974){if(_0x2e4974){return _0x2e4974[_0x0c58('0x26')]()[_0x0c58('0x25')](function(){_0x1f7a53[_0x0c58('0x1a')](0xcc)[_0x0c58('0x1b')]();});}};}function handleEntityNotFound(_0x171892,_0x1852ad){return function(_0x5b9bea){if(!_0x5b9bea){_0x171892[_0x0c58('0x19')](0x194);}return _0x5b9bea;};}function handleError(_0x346c09,_0x3bef27){_0x3bef27=_0x3bef27||0x1f4;return function(_0x1a1633){logger[_0x0c58('0x27')](_0x1a1633[_0x0c58('0x28')]);if(_0x1a1633['name']){delete _0x1a1633[_0x0c58('0x29')];}_0x346c09[_0x0c58('0x1a')](_0x3bef27)[_0x0c58('0x2a')](_0x1a1633);};}exports['index']=function(_0xce3920,_0x2fcf7f){var _0x2215d6={},_0xb79e36={},_0xce0b68={'count':0x0,'rows':[]};var _0xfa2b00=_[_0x0c58('0x2b')](db[_0x0c58('0x2c')][_0x0c58('0x2d')],function(_0x29a4e){return{'name':_0x29a4e['fieldName'],'type':_0x29a4e[_0x0c58('0x2e')][_0x0c58('0x2f')]};});_0xb79e36[_0x0c58('0x30')]=_['map'](_0xfa2b00,_0x0c58('0x29'));_0xb79e36[_0x0c58('0x31')]=_[_0x0c58('0x32')](_0xce3920['query']);_0xb79e36[_0x0c58('0x33')]=_['intersection'](_0xb79e36[_0x0c58('0x30')],_0xb79e36['query']);_0x2215d6[_0x0c58('0x34')]=_[_0x0c58('0x35')](_0xb79e36[_0x0c58('0x30')],qs[_0x0c58('0x36')](_0xce3920[_0x0c58('0x31')][_0x0c58('0x36')]));_0x2215d6[_0x0c58('0x34')]=_0x2215d6[_0x0c58('0x34')]['length']?_0x2215d6['attributes']:_0xb79e36[_0x0c58('0x30')];if(!_0xce3920[_0x0c58('0x31')][_0x0c58('0x37')](_0x0c58('0x38'))){_0x2215d6[_0x0c58('0x1f')]=qs[_0x0c58('0x1f')](_0xce3920['query'][_0x0c58('0x1f')]);_0x2215d6['offset']=qs['offset'](_0xce3920[_0x0c58('0x31')][_0x0c58('0x1d')]);}_0x2215d6['order']=qs['sort'](_0xce3920[_0x0c58('0x31')][_0x0c58('0x39')]);_0x2215d6[_0x0c58('0x3a')]=qs[_0x0c58('0x33')](_[_0x0c58('0x3b')](_0xce3920[_0x0c58('0x31')],_0xb79e36[_0x0c58('0x33')]),_0xfa2b00);if(_0xce3920['query'][_0x0c58('0x3c')]){_0x2215d6[_0x0c58('0x3a')]=_[_0x0c58('0x3d')](_0x2215d6[_0x0c58('0x3a')],{'$or':_[_0x0c58('0x2b')](_0xfa2b00,function(_0x285ed1){if(_0x285ed1['type']!=='VIRTUAL'){var _0x74e32b={};_0x74e32b[_0x285ed1[_0x0c58('0x29')]]={'$like':'%'+_0xce3920[_0x0c58('0x31')]['filter']+'%'};return _0x74e32b;}})});}_0x2215d6=_[_0x0c58('0x3d')]({},_0x2215d6,_0xce3920[_0x0c58('0x3e')]);var _0x41ad5b={'where':_0x2215d6['where']};return db[_0x0c58('0x2c')][_0x0c58('0x20')](_0x41ad5b)[_0x0c58('0x25')](function(_0x4c21a6){_0xce0b68['count']=_0x4c21a6;if(_0xce3920[_0x0c58('0x31')][_0x0c58('0x3f')]){_0x2215d6['include']=[{'all':!![]}];}return db[_0x0c58('0x2c')][_0x0c58('0x40')](_0x2215d6);})[_0x0c58('0x25')](function(_0xa5af59){_0xce0b68[_0x0c58('0x41')]=_0xa5af59;return _0xce0b68;})[_0x0c58('0x25')](respondWithFilteredResult(_0x2fcf7f,_0x2215d6))[_0x0c58('0x42')](handleError(_0x2fcf7f,null));};exports[_0x0c58('0x43')]=function(_0x11f459,_0x335106){var _0x49c64d={'raw':![],'where':{'id':_0x11f459[_0x0c58('0x44')]['id']}},_0x2b94e8={};_0x2b94e8['model']=_[_0x0c58('0x32')](db['DeskConfiguration'][_0x0c58('0x2d')]);_0x2b94e8['query']=_[_0x0c58('0x32')](_0x11f459[_0x0c58('0x31')]);_0x2b94e8[_0x0c58('0x33')]=_['intersection'](_0x2b94e8['model'],_0x2b94e8[_0x0c58('0x31')]);_0x49c64d[_0x0c58('0x34')]=_['intersection'](_0x2b94e8[_0x0c58('0x30')],qs['fields'](_0x11f459[_0x0c58('0x31')][_0x0c58('0x36')]));_0x49c64d['attributes']=_0x49c64d['attributes']['length']?_0x49c64d[_0x0c58('0x34')]:_0x2b94e8[_0x0c58('0x30')];if(_0x11f459[_0x0c58('0x31')][_0x0c58('0x3f')]){_0x49c64d[_0x0c58('0x45')]=[{'all':!![]}];}_0x49c64d=_['merge']({},_0x49c64d,_0x11f459['options']);return db[_0x0c58('0x2c')]['find'](_0x49c64d)[_0x0c58('0x25')](handleEntityNotFound(_0x335106,null))[_0x0c58('0x25')](respondWithResult(_0x335106,null))[_0x0c58('0x42')](handleError(_0x335106,null));};exports[_0x0c58('0x46')]=function(_0x54aa2c,_0x5dd837){return db['DeskConfiguration'][_0x0c58('0x46')](_0x54aa2c[_0x0c58('0x47')],{})[_0x0c58('0x25')](respondWithResult(_0x5dd837,0xc9))[_0x0c58('0x42')](handleError(_0x5dd837,null));};exports[_0x0c58('0x48')]=function(_0x2291de,_0x232939){if(_0x2291de[_0x0c58('0x47')]['id']){delete _0x2291de['body']['id'];}return db[_0x0c58('0x2c')][_0x0c58('0x49')]({'where':{'id':_0x2291de['params']['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0x232939,null))[_0x0c58('0x25')](saveUpdates(_0x2291de[_0x0c58('0x47')],null))[_0x0c58('0x25')](respondWithResult(_0x232939,null))[_0x0c58('0x42')](handleError(_0x232939,null));};exports[_0x0c58('0x26')]=function(_0x148870,_0x339b26){return db[_0x0c58('0x2c')]['find']({'where':{'id':_0x148870[_0x0c58('0x44')]['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0x339b26,null))[_0x0c58('0x25')](removeEntity(_0x339b26,null))[_0x0c58('0x42')](handleError(_0x339b26,null));};exports['getFields']=function(_0x180f59,_0x3cfa70,_0x1c1d53){var _0x23553f={};var _0x329eef={};var _0x52df3a;var _0x4e4aba;return db[_0x0c58('0x2c')]['findOne']({'where':{'id':_0x180f59[_0x0c58('0x44')]['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0x3cfa70,null))[_0x0c58('0x25')](function(_0x50c23f){if(_0x50c23f){_0x52df3a=_0x50c23f;_0x329eef[_0x0c58('0x30')]=_[_0x0c58('0x32')](db[_0x0c58('0x4a')][_0x0c58('0x2d')]);_0x329eef[_0x0c58('0x31')]=_[_0x0c58('0x32')](_0x180f59[_0x0c58('0x31')]);_0x329eef[_0x0c58('0x33')]=_[_0x0c58('0x35')](_0x329eef['model'],_0x329eef[_0x0c58('0x31')]);_0x23553f[_0x0c58('0x34')]=_[_0x0c58('0x35')](_0x329eef[_0x0c58('0x30')],qs['fields'](_0x180f59['query'][_0x0c58('0x36')]));_0x23553f[_0x0c58('0x34')]=_0x23553f[_0x0c58('0x34')][_0x0c58('0x4b')]?_0x23553f['attributes']:_0x329eef['model'];_0x23553f[_0x0c58('0x4c')]=qs[_0x0c58('0x39')](_0x180f59[_0x0c58('0x31')]['sort']);_0x23553f['where']=qs['filters'](_['pick'](_0x180f59[_0x0c58('0x31')],_0x329eef[_0x0c58('0x33')]));if(_0x180f59[_0x0c58('0x31')][_0x0c58('0x3c')]){_0x23553f['where']=_[_0x0c58('0x3d')](_0x23553f[_0x0c58('0x3a')],{'$or':_[_0x0c58('0x2b')](_0x23553f[_0x0c58('0x34')],function(_0x402e8d){var _0x3a0fe5={};_0x3a0fe5[_0x402e8d]={'$like':'%'+_0x180f59[_0x0c58('0x31')]['filter']+'%'};return _0x3a0fe5;})});}_0x23553f=_[_0x0c58('0x3d')]({},_0x23553f,_0x180f59[_0x0c58('0x3e')]);return _0x52df3a[_0x0c58('0x4d')](_0x23553f);}})[_0x0c58('0x25')](function(_0x6654db){if(_0x6654db){_0x4e4aba=_0x6654db[_0x0c58('0x4b')];if(!_0x180f59[_0x0c58('0x31')][_0x0c58('0x37')](_0x0c58('0x38'))){_0x23553f['limit']=qs[_0x0c58('0x1f')](_0x180f59[_0x0c58('0x31')][_0x0c58('0x1f')]);_0x23553f[_0x0c58('0x1d')]=qs['offset'](_0x180f59[_0x0c58('0x31')][_0x0c58('0x1d')]);}return _0x52df3a[_0x0c58('0x4d')](_0x23553f);}})[_0x0c58('0x25')](function(_0x4f8872){if(_0x4f8872){return _0x4f8872?{'count':_0x4e4aba,'rows':_0x4f8872}:null;}})[_0x0c58('0x25')](respondWithResult(_0x3cfa70,null))[_0x0c58('0x42')](handleError(_0x3cfa70,null));};exports[_0x0c58('0x4e')]=function(_0x1a7bda,_0x5c97f3,_0x3e4cde){var _0x3c06d4={};var _0x4727d5={};var _0x2847c9;var _0x48b0b1;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1a7bda['params']['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0x5c97f3,null))[_0x0c58('0x25')](function(_0xb2f0f2){if(_0xb2f0f2){_0x2847c9=_0xb2f0f2;_0x4727d5[_0x0c58('0x30')]=_[_0x0c58('0x32')](db[_0x0c58('0x4a')][_0x0c58('0x2d')]);_0x4727d5[_0x0c58('0x31')]=_['keys'](_0x1a7bda[_0x0c58('0x31')]);_0x4727d5[_0x0c58('0x33')]=_[_0x0c58('0x35')](_0x4727d5[_0x0c58('0x30')],_0x4727d5[_0x0c58('0x31')]);_0x3c06d4[_0x0c58('0x34')]=_[_0x0c58('0x35')](_0x4727d5['model'],qs[_0x0c58('0x36')](_0x1a7bda['query'][_0x0c58('0x36')]));_0x3c06d4[_0x0c58('0x34')]=_0x3c06d4['attributes']['length']?_0x3c06d4['attributes']:_0x4727d5[_0x0c58('0x30')];_0x3c06d4[_0x0c58('0x4c')]=qs[_0x0c58('0x39')](_0x1a7bda[_0x0c58('0x31')]['sort']);_0x3c06d4['where']=qs['filters'](_[_0x0c58('0x3b')](_0x1a7bda['query'],_0x4727d5['filters']));if(_0x1a7bda[_0x0c58('0x31')]['filter']){_0x3c06d4[_0x0c58('0x3a')]=_[_0x0c58('0x3d')](_0x3c06d4[_0x0c58('0x3a')],{'$or':_['map'](_0x3c06d4[_0x0c58('0x34')],function(_0x3255b7){var _0x3b7920={};_0x3b7920[_0x3255b7]={'$like':'%'+_0x1a7bda['query'][_0x0c58('0x3c')]+'%'};return _0x3b7920;})});}_0x3c06d4=_[_0x0c58('0x3d')]({},_0x3c06d4,_0x1a7bda['options']);return _0x2847c9[_0x0c58('0x4e')](_0x3c06d4);}})['then'](function(_0x4c6e4c){if(_0x4c6e4c){_0x48b0b1=_0x4c6e4c[_0x0c58('0x4b')];if(!_0x1a7bda['query']['hasOwnProperty'](_0x0c58('0x38'))){_0x3c06d4[_0x0c58('0x1f')]=qs[_0x0c58('0x1f')](_0x1a7bda[_0x0c58('0x31')]['limit']);_0x3c06d4['offset']=qs[_0x0c58('0x1d')](_0x1a7bda['query'][_0x0c58('0x1d')]);}return _0x2847c9[_0x0c58('0x4e')](_0x3c06d4);}})[_0x0c58('0x25')](function(_0x58c31e){if(_0x58c31e){return _0x58c31e?{'count':_0x48b0b1,'rows':_0x58c31e}:null;}})['then'](respondWithResult(_0x5c97f3,null))['catch'](handleError(_0x5c97f3,null));};exports[_0x0c58('0x4f')]=function(_0x5e109d,_0xa1d2ce,_0x8fd93a){var _0x2a6379={};var _0x5e032a={};var _0x532a3c;var _0x177e04;return db[_0x0c58('0x2c')][_0x0c58('0x50')]({'where':{'id':_0x5e109d[_0x0c58('0x44')]['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0xa1d2ce,null))[_0x0c58('0x25')](function(_0x86f88e){if(_0x86f88e){_0x532a3c=_0x86f88e;_0x5e032a[_0x0c58('0x30')]=_[_0x0c58('0x32')](db[_0x0c58('0x4a')]['rawAttributes']);_0x5e032a[_0x0c58('0x31')]=_['keys'](_0x5e109d[_0x0c58('0x31')]);_0x5e032a[_0x0c58('0x33')]=_[_0x0c58('0x35')](_0x5e032a[_0x0c58('0x30')],_0x5e032a['query']);_0x2a6379['attributes']=_['intersection'](_0x5e032a[_0x0c58('0x30')],qs[_0x0c58('0x36')](_0x5e109d['query'][_0x0c58('0x36')]));_0x2a6379[_0x0c58('0x34')]=_0x2a6379['attributes'][_0x0c58('0x4b')]?_0x2a6379[_0x0c58('0x34')]:_0x5e032a['model'];_0x2a6379['order']=qs[_0x0c58('0x39')](_0x5e109d['query']['sort']);_0x2a6379[_0x0c58('0x3a')]=qs['filters'](_[_0x0c58('0x3b')](_0x5e109d[_0x0c58('0x31')],_0x5e032a[_0x0c58('0x33')]));if(_0x5e109d['query'][_0x0c58('0x3c')]){_0x2a6379['where']=_['merge'](_0x2a6379[_0x0c58('0x3a')],{'$or':_[_0x0c58('0x2b')](_0x2a6379['attributes'],function(_0x13621f){var _0x306cfb={};_0x306cfb[_0x13621f]={'$like':'%'+_0x5e109d[_0x0c58('0x31')][_0x0c58('0x3c')]+'%'};return _0x306cfb;})});}_0x2a6379=_[_0x0c58('0x3d')]({},_0x2a6379,_0x5e109d[_0x0c58('0x3e')]);return _0x532a3c[_0x0c58('0x4f')](_0x2a6379);}})['then'](function(_0x273e75){if(_0x273e75){_0x177e04=_0x273e75[_0x0c58('0x4b')];if(!_0x5e109d[_0x0c58('0x31')][_0x0c58('0x37')](_0x0c58('0x38'))){_0x2a6379[_0x0c58('0x1f')]=qs['limit'](_0x5e109d[_0x0c58('0x31')][_0x0c58('0x1f')]);_0x2a6379[_0x0c58('0x1d')]=qs[_0x0c58('0x1d')](_0x5e109d[_0x0c58('0x31')][_0x0c58('0x1d')]);}return _0x532a3c[_0x0c58('0x4f')](_0x2a6379);}})[_0x0c58('0x25')](function(_0xaa0f0c){if(_0xaa0f0c){return _0xaa0f0c?{'count':_0x177e04,'rows':_0xaa0f0c}:null;}})[_0x0c58('0x25')](respondWithResult(_0xa1d2ce,null))[_0x0c58('0x42')](handleError(_0xa1d2ce,null));};exports['getTags']=function(_0x410f6f,_0x482267,_0x2f0246){var _0x2ffc3d={};var _0x34155b={};var _0x50ffbf;var _0x4a92ef;return db[_0x0c58('0x2c')][_0x0c58('0x50')]({'where':{'id':_0x410f6f[_0x0c58('0x44')]['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0x482267,null))[_0x0c58('0x25')](function(_0x3b3e36){if(_0x3b3e36){_0x50ffbf=_0x3b3e36;_0x34155b[_0x0c58('0x30')]=_[_0x0c58('0x32')](db['Tag'][_0x0c58('0x2d')]);_0x34155b[_0x0c58('0x31')]=_[_0x0c58('0x32')](_0x410f6f[_0x0c58('0x31')]);_0x34155b[_0x0c58('0x33')]=_[_0x0c58('0x35')](_0x34155b[_0x0c58('0x30')],_0x34155b['query']);_0x2ffc3d[_0x0c58('0x34')]=_['intersection'](_0x34155b['model'],qs[_0x0c58('0x36')](_0x410f6f[_0x0c58('0x31')][_0x0c58('0x36')]));_0x2ffc3d[_0x0c58('0x34')]=_0x2ffc3d[_0x0c58('0x34')]['length']?_0x2ffc3d[_0x0c58('0x34')]:_0x34155b['model'];_0x2ffc3d[_0x0c58('0x4c')]=qs['sort'](_0x410f6f[_0x0c58('0x31')][_0x0c58('0x39')]);_0x2ffc3d['where']=qs[_0x0c58('0x33')](_[_0x0c58('0x3b')](_0x410f6f['query'],_0x34155b[_0x0c58('0x33')]));if(_0x410f6f[_0x0c58('0x31')][_0x0c58('0x3c')]){_0x2ffc3d[_0x0c58('0x3a')]=_[_0x0c58('0x3d')](_0x2ffc3d[_0x0c58('0x3a')],{'$or':_[_0x0c58('0x2b')](_0x2ffc3d[_0x0c58('0x34')],function(_0x5df200){var _0x1270c6={};_0x1270c6[_0x5df200]={'$like':'%'+_0x410f6f[_0x0c58('0x31')][_0x0c58('0x3c')]+'%'};return _0x1270c6;})});}_0x2ffc3d=_[_0x0c58('0x3d')]({},_0x2ffc3d,_0x410f6f[_0x0c58('0x3e')]);return _0x50ffbf[_0x0c58('0x51')](_0x2ffc3d);}})[_0x0c58('0x25')](function(_0x88b02c){if(_0x88b02c){_0x4a92ef=_0x88b02c[_0x0c58('0x4b')];if(!_0x410f6f[_0x0c58('0x31')]['hasOwnProperty']('nolimit')){_0x2ffc3d[_0x0c58('0x1f')]=qs[_0x0c58('0x1f')](_0x410f6f['query'][_0x0c58('0x1f')]);_0x2ffc3d[_0x0c58('0x1d')]=qs[_0x0c58('0x1d')](_0x410f6f[_0x0c58('0x31')][_0x0c58('0x1d')]);}return _0x50ffbf[_0x0c58('0x51')](_0x2ffc3d);}})['then'](function(_0x4b317d){if(_0x4b317d){return _0x4b317d?{'count':_0x4a92ef,'rows':_0x4b317d}:null;}})[_0x0c58('0x25')](respondWithResult(_0x482267,null))['catch'](handleError(_0x482267,null));};exports[_0x0c58('0x52')]=function(_0xe720a6,_0x4fa88c,_0x5d1b6d){if(_0xe720a6[_0x0c58('0x47')]['id']){delete _0xe720a6[_0x0c58('0x47')]['id'];}return db[_0x0c58('0x2c')][_0x0c58('0x50')]({'where':{'id':_0xe720a6['params']['id']}})[_0x0c58('0x25')](handleEntityNotFound(_0x4fa88c,null))['then'](function(_0x25148a){if(_0x25148a){return _0x25148a[_0x0c58('0x52')](_0xe720a6[_0x0c58('0x47')]['ids']||[]);}return null;})[_0x0c58('0x25')](respondWithResult(_0x4fa88c,null))['catch'](handleError(_0x4fa88c,null));}; \ No newline at end of file +var _0xd77c=['crypto','jsforce','desk.js','querystring','../../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','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','DeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd77c,0xfa));var _0xcd77=function(_0x184de3,_0x40aaa4){_0x184de3=_0x184de3-0x0;var _0x1b3646=_0xd77c[_0x184de3];return _0x1b3646;};'use strict';var emlformat=require(_0xcd77('0x0'));var rimraf=require(_0xcd77('0x1'));var zipdir=require(_0xcd77('0x2'));var jsonpatch=require(_0xcd77('0x3'));var rp=require('request-promise');var moment=require(_0xcd77('0x4'));var BPromise=require(_0xcd77('0x5'));var Mustache=require(_0xcd77('0x6'));var util=require(_0xcd77('0x7'));var path=require(_0xcd77('0x8'));var sox=require('sox');var csv=require(_0xcd77('0x9'));var ejs=require(_0xcd77('0xa'));var fs=require('fs');var fs_extra=require(_0xcd77('0xb'));var _=require(_0xcd77('0xc'));var squel=require(_0xcd77('0xd'));var crypto=require(_0xcd77('0xe'));var jsforce=require(_0xcd77('0xf'));var deskjs=require(_0xcd77('0x10'));var toCsv=require(_0xcd77('0x9'));var querystring=require(_0xcd77('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcd77('0x12'));var qs=require(_0xcd77('0x13'));var as=require(_0xcd77('0x14'));var hardwareService=require(_0xcd77('0x15'));var logger=require(_0xcd77('0x16'))('api');var utils=require(_0xcd77('0x17'));var config=require(_0xcd77('0x18'));var licenseUtil=require(_0xcd77('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b67b,_0x2c1ffc){_0x2c1ffc=_0x2c1ffc||0xcc;return function(_0x1c7295){if(_0x1c7295){return _0x14b67b[_0xcd77('0x1a')](_0x2c1ffc);}return _0x14b67b[_0xcd77('0x1b')](_0x2c1ffc)[_0xcd77('0x1c')]();};}function respondWithResult(_0x211f3a,_0x29458a){_0x29458a=_0x29458a||0xc8;return function(_0x42b937){if(_0x42b937){return _0x211f3a[_0xcd77('0x1b')](_0x29458a)[_0xcd77('0x1d')](_0x42b937);}};}function respondWithFilteredResult(_0x10232b,_0x4ab6c4){return function(_0x5581b0){if(_0x5581b0){var _0x48b9dd=typeof _0x4ab6c4[_0xcd77('0x1e')]===_0xcd77('0x1f')&&typeof _0x4ab6c4['limit']===_0xcd77('0x1f');var _0x3c2133=_0x5581b0['count'];var _0x5d47d3=_0x48b9dd?0x0:_0x4ab6c4[_0xcd77('0x1e')];var _0x4bc938=_0x48b9dd?_0x5581b0[_0xcd77('0x20')]:_0x4ab6c4[_0xcd77('0x1e')]+_0x4ab6c4[_0xcd77('0x21')];var _0x1a7567;if(_0x4bc938>=_0x3c2133){_0x4bc938=_0x3c2133;_0x1a7567=0xc8;}else{_0x1a7567=0xce;}_0x10232b[_0xcd77('0x1b')](_0x1a7567);return _0x10232b[_0xcd77('0x22')](_0xcd77('0x23'),_0x5d47d3+'-'+_0x4bc938+'/'+_0x3c2133)[_0xcd77('0x1d')](_0x5581b0);}return null;};}function patchUpdates(_0x3650f2){return function(_0x34abfd){try{jsonpatch['apply'](_0x34abfd,_0x3650f2,!![]);}catch(_0x1532af){return BPromise[_0xcd77('0x24')](_0x1532af);}return _0x34abfd[_0xcd77('0x25')]();};}function saveUpdates(_0x5ab472,_0x9fb789){return function(_0x16ea4f){if(_0x16ea4f){return _0x16ea4f[_0xcd77('0x26')](_0x5ab472)['then'](function(_0x1cf1ec){return _0x1cf1ec;});}return null;};}function removeEntity(_0x4ff316,_0x1a95e5){return function(_0x21f981){if(_0x21f981){return _0x21f981[_0xcd77('0x27')]()['then'](function(){_0x4ff316['status'](0xcc)[_0xcd77('0x1c')]();});}};}function handleEntityNotFound(_0x4edc1b,_0x2d10cf){return function(_0xdfaac2){if(!_0xdfaac2){_0x4edc1b['sendStatus'](0x194);}return _0xdfaac2;};}function handleError(_0xbda2b9,_0x330086){_0x330086=_0x330086||0x1f4;return function(_0x2cc229){logger[_0xcd77('0x28')](_0x2cc229[_0xcd77('0x29')]);if(_0x2cc229[_0xcd77('0x2a')]){delete _0x2cc229[_0xcd77('0x2a')];}_0xbda2b9['status'](_0x330086)[_0xcd77('0x2b')](_0x2cc229);};}exports[_0xcd77('0x2c')]=function(_0x1220bb,_0x4093d4){var _0x55d073={},_0x2acdc0={},_0x809d0={'count':0x0,'rows':[]};var _0x35b047=_[_0xcd77('0x2d')](db[_0xcd77('0x2e')][_0xcd77('0x2f')],function(_0x4f968a){return{'name':_0x4f968a['fieldName'],'type':_0x4f968a[_0xcd77('0x30')][_0xcd77('0x31')]};});_0x2acdc0[_0xcd77('0x32')]=_[_0xcd77('0x2d')](_0x35b047,_0xcd77('0x2a'));_0x2acdc0[_0xcd77('0x33')]=_[_0xcd77('0x34')](_0x1220bb[_0xcd77('0x33')]);_0x2acdc0['filters']=_[_0xcd77('0x35')](_0x2acdc0[_0xcd77('0x32')],_0x2acdc0[_0xcd77('0x33')]);_0x55d073['attributes']=_['intersection'](_0x2acdc0[_0xcd77('0x32')],qs[_0xcd77('0x36')](_0x1220bb[_0xcd77('0x33')][_0xcd77('0x36')]));_0x55d073[_0xcd77('0x37')]=_0x55d073[_0xcd77('0x37')][_0xcd77('0x38')]?_0x55d073['attributes']:_0x2acdc0[_0xcd77('0x32')];if(!_0x1220bb['query']['hasOwnProperty'](_0xcd77('0x39'))){_0x55d073[_0xcd77('0x21')]=qs[_0xcd77('0x21')](_0x1220bb[_0xcd77('0x33')]['limit']);_0x55d073['offset']=qs['offset'](_0x1220bb[_0xcd77('0x33')][_0xcd77('0x1e')]);}_0x55d073[_0xcd77('0x3a')]=qs[_0xcd77('0x3b')](_0x1220bb[_0xcd77('0x33')][_0xcd77('0x3b')]);_0x55d073[_0xcd77('0x3c')]=qs[_0xcd77('0x3d')](_[_0xcd77('0x3e')](_0x1220bb[_0xcd77('0x33')],_0x2acdc0['filters']),_0x35b047);if(_0x1220bb[_0xcd77('0x33')][_0xcd77('0x3f')]){_0x55d073[_0xcd77('0x3c')]=_[_0xcd77('0x40')](_0x55d073[_0xcd77('0x3c')],{'$or':_[_0xcd77('0x2d')](_0x35b047,function(_0x5b6c3d){if(_0x5b6c3d['type']!==_0xcd77('0x41')){var _0x1c3be8={};_0x1c3be8[_0x5b6c3d['name']]={'$like':'%'+_0x1220bb[_0xcd77('0x33')][_0xcd77('0x3f')]+'%'};return _0x1c3be8;}})});}_0x55d073=_['merge']({},_0x55d073,_0x1220bb[_0xcd77('0x42')]);var _0x3563e5={'where':_0x55d073[_0xcd77('0x3c')]};return db[_0xcd77('0x2e')]['count'](_0x3563e5)[_0xcd77('0x43')](function(_0x83144a){_0x809d0[_0xcd77('0x20')]=_0x83144a;if(_0x1220bb['query'][_0xcd77('0x44')]){_0x55d073[_0xcd77('0x45')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xcd77('0x46')](_0x55d073);})['then'](function(_0x4e339d){_0x809d0[_0xcd77('0x47')]=_0x4e339d;return _0x809d0;})[_0xcd77('0x43')](respondWithFilteredResult(_0x4093d4,_0x55d073))[_0xcd77('0x48')](handleError(_0x4093d4,null));};exports[_0xcd77('0x49')]=function(_0x980e94,_0x5cd2f3){var _0xbab124={'raw':![],'where':{'id':_0x980e94[_0xcd77('0x4a')]['id']}},_0xc6aae2={};_0xc6aae2[_0xcd77('0x32')]=_[_0xcd77('0x34')](db[_0xcd77('0x2e')][_0xcd77('0x2f')]);_0xc6aae2['query']=_['keys'](_0x980e94['query']);_0xc6aae2[_0xcd77('0x3d')]=_[_0xcd77('0x35')](_0xc6aae2[_0xcd77('0x32')],_0xc6aae2[_0xcd77('0x33')]);_0xbab124[_0xcd77('0x37')]=_[_0xcd77('0x35')](_0xc6aae2[_0xcd77('0x32')],qs[_0xcd77('0x36')](_0x980e94[_0xcd77('0x33')][_0xcd77('0x36')]));_0xbab124['attributes']=_0xbab124[_0xcd77('0x37')]['length']?_0xbab124['attributes']:_0xc6aae2[_0xcd77('0x32')];if(_0x980e94[_0xcd77('0x33')]['includeAll']){_0xbab124[_0xcd77('0x45')]=[{'all':!![]}];}_0xbab124=_[_0xcd77('0x40')]({},_0xbab124,_0x980e94['options']);return db[_0xcd77('0x2e')][_0xcd77('0x4b')](_0xbab124)[_0xcd77('0x43')](handleEntityNotFound(_0x5cd2f3,null))[_0xcd77('0x43')](respondWithResult(_0x5cd2f3,null))['catch'](handleError(_0x5cd2f3,null));};exports[_0xcd77('0x4c')]=function(_0x1e90b9,_0x3275a9){return db[_0xcd77('0x2e')][_0xcd77('0x4c')](_0x1e90b9[_0xcd77('0x4d')],{})[_0xcd77('0x43')](respondWithResult(_0x3275a9,0xc9))[_0xcd77('0x48')](handleError(_0x3275a9,null));};exports['update']=function(_0x5bef3f,_0x1c3677){if(_0x5bef3f[_0xcd77('0x4d')]['id']){delete _0x5bef3f[_0xcd77('0x4d')]['id'];}return db[_0xcd77('0x2e')][_0xcd77('0x4b')]({'where':{'id':_0x5bef3f['params']['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x1c3677,null))[_0xcd77('0x43')](saveUpdates(_0x5bef3f['body'],null))[_0xcd77('0x43')](respondWithResult(_0x1c3677,null))['catch'](handleError(_0x1c3677,null));};exports['destroy']=function(_0x316c86,_0x27a206){return db['DeskConfiguration']['find']({'where':{'id':_0x316c86['params']['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x27a206,null))[_0xcd77('0x43')](removeEntity(_0x27a206,null))[_0xcd77('0x48')](handleError(_0x27a206,null));};exports['getFields']=function(_0x2be4f1,_0x306506,_0xdeb373){var _0x2f2c6b={};var _0x437280={};var _0x262952;var _0x24a5f3;return db['DeskConfiguration'][_0xcd77('0x4e')]({'where':{'id':_0x2be4f1[_0xcd77('0x4a')]['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x306506,null))['then'](function(_0x2918e8){if(_0x2918e8){_0x262952=_0x2918e8;_0x437280['model']=_['keys'](db[_0xcd77('0x4f')]['rawAttributes']);_0x437280['query']=_['keys'](_0x2be4f1[_0xcd77('0x33')]);_0x437280[_0xcd77('0x3d')]=_[_0xcd77('0x35')](_0x437280[_0xcd77('0x32')],_0x437280[_0xcd77('0x33')]);_0x2f2c6b[_0xcd77('0x37')]=_[_0xcd77('0x35')](_0x437280['model'],qs[_0xcd77('0x36')](_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x36')]));_0x2f2c6b['attributes']=_0x2f2c6b[_0xcd77('0x37')][_0xcd77('0x38')]?_0x2f2c6b[_0xcd77('0x37')]:_0x437280[_0xcd77('0x32')];_0x2f2c6b[_0xcd77('0x3a')]=qs[_0xcd77('0x3b')](_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x3b')]);_0x2f2c6b[_0xcd77('0x3c')]=qs[_0xcd77('0x3d')](_[_0xcd77('0x3e')](_0x2be4f1[_0xcd77('0x33')],_0x437280[_0xcd77('0x3d')]));if(_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x3f')]){_0x2f2c6b['where']=_[_0xcd77('0x40')](_0x2f2c6b[_0xcd77('0x3c')],{'$or':_[_0xcd77('0x2d')](_0x2f2c6b[_0xcd77('0x37')],function(_0x5dddff){var _0x3e4d24={};_0x3e4d24[_0x5dddff]={'$like':'%'+_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x3f')]+'%'};return _0x3e4d24;})});}_0x2f2c6b=_[_0xcd77('0x40')]({},_0x2f2c6b,_0x2be4f1[_0xcd77('0x42')]);return _0x262952[_0xcd77('0x50')](_0x2f2c6b);}})['then'](function(_0x49bc71){if(_0x49bc71){_0x24a5f3=_0x49bc71[_0xcd77('0x38')];if(!_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x51')](_0xcd77('0x39'))){_0x2f2c6b[_0xcd77('0x21')]=qs[_0xcd77('0x21')](_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x21')]);_0x2f2c6b[_0xcd77('0x1e')]=qs[_0xcd77('0x1e')](_0x2be4f1[_0xcd77('0x33')][_0xcd77('0x1e')]);}return _0x262952[_0xcd77('0x50')](_0x2f2c6b);}})[_0xcd77('0x43')](function(_0x1dfafd){if(_0x1dfafd){return _0x1dfafd?{'count':_0x24a5f3,'rows':_0x1dfafd}:null;}})[_0xcd77('0x43')](respondWithResult(_0x306506,null))[_0xcd77('0x48')](handleError(_0x306506,null));};exports[_0xcd77('0x52')]=function(_0x48fd4b,_0x1cd2cc,_0x87401f){var _0x2aeef6={};var _0x45df83={};var _0x7b27e8;var _0x503a40;return db['DeskConfiguration'][_0xcd77('0x4e')]({'where':{'id':_0x48fd4b['params']['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x1cd2cc,null))[_0xcd77('0x43')](function(_0x125b6e){if(_0x125b6e){_0x7b27e8=_0x125b6e;_0x45df83[_0xcd77('0x32')]=_['keys'](db[_0xcd77('0x4f')][_0xcd77('0x2f')]);_0x45df83[_0xcd77('0x33')]=_['keys'](_0x48fd4b[_0xcd77('0x33')]);_0x45df83[_0xcd77('0x3d')]=_[_0xcd77('0x35')](_0x45df83[_0xcd77('0x32')],_0x45df83[_0xcd77('0x33')]);_0x2aeef6[_0xcd77('0x37')]=_[_0xcd77('0x35')](_0x45df83[_0xcd77('0x32')],qs[_0xcd77('0x36')](_0x48fd4b['query'][_0xcd77('0x36')]));_0x2aeef6[_0xcd77('0x37')]=_0x2aeef6[_0xcd77('0x37')][_0xcd77('0x38')]?_0x2aeef6[_0xcd77('0x37')]:_0x45df83[_0xcd77('0x32')];_0x2aeef6[_0xcd77('0x3a')]=qs[_0xcd77('0x3b')](_0x48fd4b[_0xcd77('0x33')][_0xcd77('0x3b')]);_0x2aeef6[_0xcd77('0x3c')]=qs['filters'](_[_0xcd77('0x3e')](_0x48fd4b[_0xcd77('0x33')],_0x45df83[_0xcd77('0x3d')]));if(_0x48fd4b['query'][_0xcd77('0x3f')]){_0x2aeef6['where']=_['merge'](_0x2aeef6[_0xcd77('0x3c')],{'$or':_[_0xcd77('0x2d')](_0x2aeef6[_0xcd77('0x37')],function(_0x404948){var _0x2ea55e={};_0x2ea55e[_0x404948]={'$like':'%'+_0x48fd4b['query'][_0xcd77('0x3f')]+'%'};return _0x2ea55e;})});}_0x2aeef6=_[_0xcd77('0x40')]({},_0x2aeef6,_0x48fd4b[_0xcd77('0x42')]);return _0x7b27e8[_0xcd77('0x52')](_0x2aeef6);}})[_0xcd77('0x43')](function(_0x1e9a1a){if(_0x1e9a1a){_0x503a40=_0x1e9a1a[_0xcd77('0x38')];if(!_0x48fd4b[_0xcd77('0x33')][_0xcd77('0x51')](_0xcd77('0x39'))){_0x2aeef6[_0xcd77('0x21')]=qs['limit'](_0x48fd4b['query']['limit']);_0x2aeef6[_0xcd77('0x1e')]=qs[_0xcd77('0x1e')](_0x48fd4b[_0xcd77('0x33')][_0xcd77('0x1e')]);}return _0x7b27e8[_0xcd77('0x52')](_0x2aeef6);}})[_0xcd77('0x43')](function(_0xb0ca75){if(_0xb0ca75){return _0xb0ca75?{'count':_0x503a40,'rows':_0xb0ca75}:null;}})[_0xcd77('0x43')](respondWithResult(_0x1cd2cc,null))[_0xcd77('0x48')](handleError(_0x1cd2cc,null));};exports[_0xcd77('0x53')]=function(_0x51b7bd,_0x493c95,_0x2d9fd6){var _0x570fc0={};var _0x59e15e={};var _0x558668;var _0x52e64b;return db[_0xcd77('0x2e')][_0xcd77('0x4e')]({'where':{'id':_0x51b7bd[_0xcd77('0x4a')]['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x493c95,null))[_0xcd77('0x43')](function(_0x562dd8){if(_0x562dd8){_0x558668=_0x562dd8;_0x59e15e[_0xcd77('0x32')]=_[_0xcd77('0x34')](db[_0xcd77('0x4f')][_0xcd77('0x2f')]);_0x59e15e['query']=_['keys'](_0x51b7bd[_0xcd77('0x33')]);_0x59e15e['filters']=_['intersection'](_0x59e15e['model'],_0x59e15e[_0xcd77('0x33')]);_0x570fc0[_0xcd77('0x37')]=_[_0xcd77('0x35')](_0x59e15e[_0xcd77('0x32')],qs[_0xcd77('0x36')](_0x51b7bd[_0xcd77('0x33')]['fields']));_0x570fc0[_0xcd77('0x37')]=_0x570fc0['attributes']['length']?_0x570fc0['attributes']:_0x59e15e[_0xcd77('0x32')];_0x570fc0[_0xcd77('0x3a')]=qs['sort'](_0x51b7bd['query'][_0xcd77('0x3b')]);_0x570fc0[_0xcd77('0x3c')]=qs[_0xcd77('0x3d')](_[_0xcd77('0x3e')](_0x51b7bd['query'],_0x59e15e[_0xcd77('0x3d')]));if(_0x51b7bd[_0xcd77('0x33')]['filter']){_0x570fc0[_0xcd77('0x3c')]=_[_0xcd77('0x40')](_0x570fc0[_0xcd77('0x3c')],{'$or':_[_0xcd77('0x2d')](_0x570fc0['attributes'],function(_0x301cee){var _0x2d1e91={};_0x2d1e91[_0x301cee]={'$like':'%'+_0x51b7bd['query'][_0xcd77('0x3f')]+'%'};return _0x2d1e91;})});}_0x570fc0=_[_0xcd77('0x40')]({},_0x570fc0,_0x51b7bd['options']);return _0x558668['getDescriptions'](_0x570fc0);}})[_0xcd77('0x43')](function(_0x146c98){if(_0x146c98){_0x52e64b=_0x146c98[_0xcd77('0x38')];if(!_0x51b7bd[_0xcd77('0x33')][_0xcd77('0x51')](_0xcd77('0x39'))){_0x570fc0[_0xcd77('0x21')]=qs[_0xcd77('0x21')](_0x51b7bd[_0xcd77('0x33')][_0xcd77('0x21')]);_0x570fc0[_0xcd77('0x1e')]=qs['offset'](_0x51b7bd[_0xcd77('0x33')][_0xcd77('0x1e')]);}return _0x558668[_0xcd77('0x53')](_0x570fc0);}})[_0xcd77('0x43')](function(_0x38e32e){if(_0x38e32e){return _0x38e32e?{'count':_0x52e64b,'rows':_0x38e32e}:null;}})[_0xcd77('0x43')](respondWithResult(_0x493c95,null))[_0xcd77('0x48')](handleError(_0x493c95,null));};exports[_0xcd77('0x54')]=function(_0x4fa47e,_0x3a2502,_0x7a1705){var _0x12cf86={};var _0x4ef01e={};var _0x51aa18;var _0x292de7;return db[_0xcd77('0x2e')][_0xcd77('0x4e')]({'where':{'id':_0x4fa47e['params']['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x3a2502,null))[_0xcd77('0x43')](function(_0x1b4bf3){if(_0x1b4bf3){_0x51aa18=_0x1b4bf3;_0x4ef01e[_0xcd77('0x32')]=_[_0xcd77('0x34')](db[_0xcd77('0x55')][_0xcd77('0x2f')]);_0x4ef01e[_0xcd77('0x33')]=_[_0xcd77('0x34')](_0x4fa47e['query']);_0x4ef01e['filters']=_[_0xcd77('0x35')](_0x4ef01e['model'],_0x4ef01e[_0xcd77('0x33')]);_0x12cf86[_0xcd77('0x37')]=_['intersection'](_0x4ef01e[_0xcd77('0x32')],qs[_0xcd77('0x36')](_0x4fa47e[_0xcd77('0x33')][_0xcd77('0x36')]));_0x12cf86[_0xcd77('0x37')]=_0x12cf86[_0xcd77('0x37')][_0xcd77('0x38')]?_0x12cf86[_0xcd77('0x37')]:_0x4ef01e['model'];_0x12cf86[_0xcd77('0x3a')]=qs[_0xcd77('0x3b')](_0x4fa47e['query'][_0xcd77('0x3b')]);_0x12cf86[_0xcd77('0x3c')]=qs[_0xcd77('0x3d')](_[_0xcd77('0x3e')](_0x4fa47e[_0xcd77('0x33')],_0x4ef01e[_0xcd77('0x3d')]));if(_0x4fa47e[_0xcd77('0x33')][_0xcd77('0x3f')]){_0x12cf86[_0xcd77('0x3c')]=_[_0xcd77('0x40')](_0x12cf86[_0xcd77('0x3c')],{'$or':_['map'](_0x12cf86[_0xcd77('0x37')],function(_0xfe7434){var _0x4b62ac={};_0x4b62ac[_0xfe7434]={'$like':'%'+_0x4fa47e['query'][_0xcd77('0x3f')]+'%'};return _0x4b62ac;})});}_0x12cf86=_[_0xcd77('0x40')]({},_0x12cf86,_0x4fa47e['options']);return _0x51aa18[_0xcd77('0x54')](_0x12cf86);}})[_0xcd77('0x43')](function(_0x19660b){if(_0x19660b){_0x292de7=_0x19660b[_0xcd77('0x38')];if(!_0x4fa47e[_0xcd77('0x33')][_0xcd77('0x51')](_0xcd77('0x39'))){_0x12cf86[_0xcd77('0x21')]=qs['limit'](_0x4fa47e[_0xcd77('0x33')]['limit']);_0x12cf86[_0xcd77('0x1e')]=qs['offset'](_0x4fa47e['query'][_0xcd77('0x1e')]);}return _0x51aa18[_0xcd77('0x54')](_0x12cf86);}})[_0xcd77('0x43')](function(_0x5758ab){if(_0x5758ab){return _0x5758ab?{'count':_0x292de7,'rows':_0x5758ab}:null;}})[_0xcd77('0x43')](respondWithResult(_0x3a2502,null))[_0xcd77('0x48')](handleError(_0x3a2502,null));};exports['setTags']=function(_0x400493,_0x58ee68,_0x5cd3b6){if(_0x400493[_0xcd77('0x4d')]['id']){delete _0x400493['body']['id'];}return db['DeskConfiguration'][_0xcd77('0x4e')]({'where':{'id':_0x400493[_0xcd77('0x4a')]['id']}})[_0xcd77('0x43')](handleEntityNotFound(_0x58ee68,null))[_0xcd77('0x43')](function(_0x3be9fa){if(_0x3be9fa){return _0x3be9fa[_0xcd77('0x56')](_0x400493[_0xcd77('0x4d')][_0xcd77('0x57')]||[]);}return null;})[_0xcd77('0x43')](respondWithResult(_0x58ee68,null))[_0xcd77('0x48')](handleError(_0x58ee68,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ab87cfd..7d6c06c 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 _0x4e86=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x52cc00,_0x38520b){var _0x23cbad=function(_0x34affd){while(--_0x34affd){_0x52cc00['push'](_0x52cc00['shift']());}};_0x23cbad(++_0x38520b);}(_0x4e86,0xf1));var _0x64e8=function(_0x5b6828,_0x4a19d9){_0x5b6828=_0x5b6828-0x0;var _0x2dbd2c=_0x4e86[_0x5b6828];return _0x2dbd2c;};'use strict';var _=require(_0x64e8('0x0'));var util=require('util');var logger=require(_0x64e8('0x1'))('api');var moment=require(_0x64e8('0x2'));var BPromise=require(_0x64e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64e8('0x4'));var rimraf=require(_0x64e8('0x5'));var config=require(_0x64e8('0x6'));var attributes=require(_0x64e8('0x7'));module['exports']=function(_0x2270f3,_0x43f2aa){return _0x2270f3[_0x64e8('0x8')](_0x64e8('0x9'),attributes,{'tableName':_0x64e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81b1=['moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','util','api'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x81b1,0x10c));var _0x181b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x81b1[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x181b('0x0'));var logger=require('../../config/logger')(_0x181b('0x1'));var moment=require(_0x181b('0x2'));var BPromise=require(_0x181b('0x3'));var rp=require(_0x181b('0x4'));var fs=require('fs');var path=require(_0x181b('0x5'));var rimraf=require('rimraf');var config=require(_0x181b('0x6'));var attributes=require(_0x181b('0x7'));module['exports']=function(_0x2861b0,_0xd6f9cb){return _0x2861b0['define'](_0x181b('0x8'),attributes,{'tableName':_0x181b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 0ff83d7..680bc76 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 _0x1fbb=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x67e0f7,_0x86bdb4){var _0x39a022=function(_0x53d6f1){while(--_0x53d6f1){_0x67e0f7['push'](_0x67e0f7['shift']());}};_0x39a022(++_0x86bdb4);}(_0x1fbb,0x99));var _0xb1fb=function(_0x51eb35,_0x39e8f5){_0x51eb35=_0x51eb35-0x0;var _0x5d19b2=_0x1fbb[_0x51eb35];return _0x5d19b2;};'use strict';var _=require(_0xb1fb('0x0'));var util=require(_0xb1fb('0x1'));var moment=require(_0xb1fb('0x2'));var BPromise=require(_0xb1fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1fb('0x4'));var db=require(_0xb1fb('0x5'))['db'];var utils=require(_0xb1fb('0x6'));var logger=require(_0xb1fb('0x7'))(_0xb1fb('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1fb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27e1f0,_0x4fbb93,_0x52b772){return new BPromise(function(_0x316416,_0x2298d1){return client[_0xb1fb('0xa')](_0x27e1f0,_0x52b772)[_0xb1fb('0xb')](function(_0xb4ca8b){logger[_0xb1fb('0xc')](_0xb1fb('0xd'),_0x4fbb93,_0xb1fb('0xe'));logger['debug'](_0xb1fb('0xf'),_0x4fbb93,'request\x20sent',JSON[_0xb1fb('0x10')](_0xb4ca8b));if(_0xb4ca8b[_0xb1fb('0x11')]){if(_0xb4ca8b[_0xb1fb('0x11')]['code']===0x1f4){logger[_0xb1fb('0x11')](_0xb1fb('0xd'),_0x4fbb93,_0xb4ca8b[_0xb1fb('0x11')][_0xb1fb('0x12')]);return _0x2298d1(_0xb4ca8b[_0xb1fb('0x11')][_0xb1fb('0x12')]);}logger[_0xb1fb('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x4fbb93,_0xb4ca8b[_0xb1fb('0x11')][_0xb1fb('0x12')]);return _0x316416(_0xb4ca8b['error'][_0xb1fb('0x12')]);}else{logger[_0xb1fb('0xc')](_0xb1fb('0xd'),_0x4fbb93,_0xb1fb('0xe'));_0x316416(_0xb4ca8b[_0xb1fb('0x13')][_0xb1fb('0x12')]);}})[_0xb1fb('0x14')](function(_0x2cf5cd){logger[_0xb1fb('0x11')](_0xb1fb('0xd'),_0x4fbb93,_0x2cf5cd);_0x2298d1(_0x2cf5cd);});});} \ No newline at end of file +var _0xd386=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x11859e,_0x3ed5bd){var _0x153628=function(_0x2e2a43){while(--_0x2e2a43){_0x11859e['push'](_0x11859e['shift']());}};_0x153628(++_0x3ed5bd);}(_0xd386,0x10c));var _0x6d38=function(_0x411289,_0x36dbc8){_0x411289=_0x411289-0x0;var _0x5e72ec=_0xd386[_0x411289];return _0x5e72ec;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var moment=require(_0x6d38('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d38('0x3'));var fs=require('fs');var Redis=require(_0x6d38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d38('0x5'));var logger=require(_0x6d38('0x6'))(_0x6d38('0x7'));var config=require(_0x6d38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d38('0x9')][_0x6d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b2038,_0x83823e,_0x2b742c){return new BPromise(function(_0x44ef4e,_0x49d71a){return client[_0x6d38('0xb')](_0x1b2038,_0x2b742c)['then'](function(_0x274898){logger['info'](_0x6d38('0xc'),_0x83823e,_0x6d38('0xd'));logger[_0x6d38('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x83823e,_0x6d38('0xd'),JSON[_0x6d38('0xf')](_0x274898));if(_0x274898[_0x6d38('0x10')]){if(_0x274898['error']['code']===0x1f4){logger['error'](_0x6d38('0xc'),_0x83823e,_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);return _0x49d71a(_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);}logger['error'](_0x6d38('0xc'),_0x83823e,_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);return _0x44ef4e(_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);}else{logger[_0x6d38('0x12')](_0x6d38('0xc'),_0x83823e,'request\x20sent');_0x44ef4e(_0x274898['result']['message']);}})[_0x6d38('0x13')](function(_0x46e7d7){logger[_0x6d38('0x10')](_0x6d38('0xc'),_0x83823e,_0x46e7d7);_0x49d71a(_0x46e7d7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6608e54..6e05fa8 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 _0x6eac=['isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id'];(function(_0x4ddc9b,_0x26a587){var _0x264f1a=function(_0x11ce97){while(--_0x11ce97){_0x4ddc9b['push'](_0x4ddc9b['shift']());}};_0x264f1a(++_0x26a587);}(_0x6eac,0x197));var _0xc6ea=function(_0x26da50,_0x1ff1e5){_0x26da50=_0x26da50-0x0;var _0x561d98=_0x6eac[_0x26da50];return _0x561d98;};'use strict';var multer=require(_0xc6ea('0x0'));var util=require(_0xc6ea('0x1'));var path=require(_0xc6ea('0x2'));var timeout=require(_0xc6ea('0x3'));var express=require(_0xc6ea('0x4'));var router=express['Router']();var fs_extra=require(_0xc6ea('0x5'));var auth=require(_0xc6ea('0x6'));var interaction=require(_0xc6ea('0x7'));var config=require(_0xc6ea('0x8'));var controller=require(_0xc6ea('0x9'));router[_0xc6ea('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6ea('0xb')]);router[_0xc6ea('0xa')](_0xc6ea('0xc'),auth[_0xc6ea('0xd')](),controller[_0xc6ea('0xe')]);router[_0xc6ea('0xf')]('/',auth['isAuthenticated'](),controller[_0xc6ea('0x10')]);router[_0xc6ea('0x11')](_0xc6ea('0xc'),auth[_0xc6ea('0xd')](),controller[_0xc6ea('0x12')]);router[_0xc6ea('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc6ea('0x14')]=router; \ No newline at end of file +var _0x30c7=['index','/:id','show','create','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated'];(function(_0x2ebdcf,_0x3c6698){var _0x450377=function(_0x48ea54){while(--_0x48ea54){_0x2ebdcf['push'](_0x2ebdcf['shift']());}};_0x450377(++_0x3c6698);}(_0x30c7,0x111));var _0x730c=function(_0x4b8ef4,_0x2d8656){_0x4b8ef4=_0x4b8ef4-0x0;var _0x4c7a35=_0x30c7[_0x4b8ef4];return _0x4c7a35;};'use strict';var multer=require(_0x730c('0x0'));var util=require('util');var path=require(_0x730c('0x1'));var timeout=require(_0x730c('0x2'));var express=require(_0x730c('0x3'));var router=express['Router']();var fs_extra=require(_0x730c('0x4'));var auth=require(_0x730c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth[_0x730c('0x6')](),controller[_0x730c('0x7')]);router['get'](_0x730c('0x8'),auth[_0x730c('0x6')](),controller[_0x730c('0x9')]);router['post']('/',auth[_0x730c('0x6')](),controller[_0x730c('0xa')]);router['put'](_0x730c('0x8'),auth[_0x730c('0x6')](),controller[_0x730c('0xb')]);router[_0x730c('0xc')](_0x730c('0x8'),auth[_0x730c('0x6')](),controller[_0x730c('0xd')]);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 b4177f1..01fd337 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 _0x879d=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x14d195,_0x51719c){var _0x43d038=function(_0x352131){while(--_0x352131){_0x14d195['push'](_0x14d195['shift']());}};_0x43d038(++_0x51719c);}(_0x879d,0x1d8));var _0xd879=function(_0x359708,_0x199a31){_0x359708=_0x359708-0x0;var _0x17000a=_0x879d[_0x359708];return _0x17000a;};'use strict';var Sequelize=require('sequelize');module[_0xd879('0x0')]={'type':{'type':Sequelize[_0xd879('0x1')](_0xd879('0x2'),'variable',_0xd879('0x3'),_0xd879('0x4'),_0xd879('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd879('0x6')]},'key':{'type':Sequelize[_0xd879('0x6')]},'keyType':{'type':Sequelize[_0xd879('0x1')](_0xd879('0x2'),_0xd879('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd879('0x6')]},'idField':{'type':Sequelize[_0xd879('0x6')]},'nameField':{'type':Sequelize[_0xd879('0x6')]},'customField':{'type':Sequelize[_0xd879('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd879('0x6')]}}; \ No newline at end of file +var _0x4e85=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x43320e,_0x10c966){var _0x446f2f=function(_0x4161da){while(--_0x4161da){_0x43320e['push'](_0x43320e['shift']());}};_0x446f2f(++_0x10c966);}(_0x4e85,0x1a1));var _0x54e8=function(_0x45bf39,_0x26f0f){_0x45bf39=_0x45bf39-0x0;var _0x382930=_0x4e85[_0x45bf39];return _0x382930;};'use strict';var Sequelize=require(_0x54e8('0x0'));module[_0x54e8('0x1')]={'type':{'type':Sequelize[_0x54e8('0x2')](_0x54e8('0x3'),_0x54e8('0x4'),_0x54e8('0x5'),'keyValue',_0x54e8('0x6')),'defaultValue':_0x54e8('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x54e8('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x54e8('0x4'),_0x54e8('0x5'))},'keyContent':{'type':Sequelize[_0x54e8('0x7')]},'idField':{'type':Sequelize[_0x54e8('0x7')]},'nameField':{'type':Sequelize[_0x54e8('0x7')]},'customField':{'type':Sequelize[_0x54e8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x54e8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 4f3d277..22465c5 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 _0xc891=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','name','send','DeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','params','create','body','find','catch','destroy','eml-format','fast-json-patch'];(function(_0x486aa8,_0x507de8){var _0x180a3d=function(_0x32d627){while(--_0x32d627){_0x486aa8['push'](_0x486aa8['shift']());}};_0x180a3d(++_0x507de8);}(_0xc891,0x152));var _0x1c89=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xc891[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require(_0x1c89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c89('0x1'));var rp=require('request-promise');var moment=require(_0x1c89('0x2'));var BPromise=require(_0x1c89('0x3'));var Mustache=require(_0x1c89('0x4'));var util=require('util');var path=require(_0x1c89('0x5'));var sox=require(_0x1c89('0x6'));var csv=require(_0x1c89('0x7'));var ejs=require(_0x1c89('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c89('0x9'));var squel=require(_0x1c89('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c89('0xb'));var deskjs=require(_0x1c89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1c89('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c89('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c89('0xf'))('api');var utils=require(_0x1c89('0x10'));var config=require(_0x1c89('0x11'));var licenseUtil=require(_0x1c89('0x12'));var db=require(_0x1c89('0x13'))['db'];function respondWithStatusCode(_0x7a4a2b,_0x27e7c0){_0x27e7c0=_0x27e7c0||0xcc;return function(_0x393b5f){if(_0x393b5f){return _0x7a4a2b[_0x1c89('0x14')](_0x27e7c0);}return _0x7a4a2b['status'](_0x27e7c0)[_0x1c89('0x15')]();};}function respondWithResult(_0x514e4d,_0x46be15){_0x46be15=_0x46be15||0xc8;return function(_0x424651){if(_0x424651){return _0x514e4d[_0x1c89('0x16')](_0x46be15)['json'](_0x424651);}};}function respondWithFilteredResult(_0x45354d,_0x29602e){return function(_0x2c9572){if(_0x2c9572){var _0x4af31b=typeof _0x29602e[_0x1c89('0x17')]===_0x1c89('0x18')&&typeof _0x29602e[_0x1c89('0x19')]===_0x1c89('0x18');var _0x33afcf=_0x2c9572[_0x1c89('0x1a')];var _0x2cb186=_0x4af31b?0x0:_0x29602e[_0x1c89('0x17')];var _0x166444=_0x4af31b?_0x2c9572[_0x1c89('0x1a')]:_0x29602e[_0x1c89('0x17')]+_0x29602e['limit'];var _0x18ce93;if(_0x166444>=_0x33afcf){_0x166444=_0x33afcf;_0x18ce93=0xc8;}else{_0x18ce93=0xce;}_0x45354d[_0x1c89('0x16')](_0x18ce93);return _0x45354d['set'](_0x1c89('0x1b'),_0x2cb186+'-'+_0x166444+'/'+_0x33afcf)[_0x1c89('0x1c')](_0x2c9572);}return null;};}function patchUpdates(_0x14121c){return function(_0x43a17a){try{jsonpatch['apply'](_0x43a17a,_0x14121c,!![]);}catch(_0x4ef155){return BPromise[_0x1c89('0x1d')](_0x4ef155);}return _0x43a17a[_0x1c89('0x1e')]();};}function saveUpdates(_0x253e07,_0x23def1){return function(_0x5b4fbc){if(_0x5b4fbc){return _0x5b4fbc[_0x1c89('0x1f')](_0x253e07)[_0x1c89('0x20')](function(_0x4fbd33){return _0x4fbd33;});}return null;};}function removeEntity(_0x45f604,_0x26a1cc){return function(_0x1ac0cc){if(_0x1ac0cc){return _0x1ac0cc['destroy']()[_0x1c89('0x20')](function(){_0x45f604[_0x1c89('0x16')](0xcc)[_0x1c89('0x15')]();});}};}function handleEntityNotFound(_0x59a87e,_0x22afe9){return function(_0x49f69b){if(!_0x49f69b){_0x59a87e['sendStatus'](0x194);}return _0x49f69b;};}function handleError(_0x35cc05,_0x352449){_0x352449=_0x352449||0x1f4;return function(_0x4c4694){logger['error'](_0x4c4694['stack']);if(_0x4c4694[_0x1c89('0x21')]){delete _0x4c4694['name'];}_0x35cc05['status'](_0x352449)[_0x1c89('0x22')](_0x4c4694);};}exports['index']=function(_0x193d8d,_0x51aa70){var _0x4dac46={},_0x25500d={},_0x10dc12={'count':0x0,'rows':[]};var _0x14f7cb=_['map'](db[_0x1c89('0x23')][_0x1c89('0x24')],function(_0x487916){return{'name':_0x487916[_0x1c89('0x25')],'type':_0x487916['type'][_0x1c89('0x26')]};});_0x25500d[_0x1c89('0x27')]=_[_0x1c89('0x28')](_0x14f7cb,_0x1c89('0x21'));_0x25500d[_0x1c89('0x29')]=_[_0x1c89('0x2a')](_0x193d8d[_0x1c89('0x29')]);_0x25500d[_0x1c89('0x2b')]=_[_0x1c89('0x2c')](_0x25500d[_0x1c89('0x27')],_0x25500d['query']);_0x4dac46[_0x1c89('0x2d')]=_['intersection'](_0x25500d['model'],qs[_0x1c89('0x2e')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x4dac46[_0x1c89('0x2d')]=_0x4dac46[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x4dac46[_0x1c89('0x2d')]:_0x25500d[_0x1c89('0x27')];if(!_0x193d8d[_0x1c89('0x29')][_0x1c89('0x30')](_0x1c89('0x31'))){_0x4dac46['limit']=qs['limit'](_0x193d8d[_0x1c89('0x29')]['limit']);_0x4dac46['offset']=qs[_0x1c89('0x17')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x17')]);}_0x4dac46[_0x1c89('0x32')]=qs[_0x1c89('0x33')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x33')]);_0x4dac46['where']=qs[_0x1c89('0x2b')](_[_0x1c89('0x34')](_0x193d8d['query'],_0x25500d[_0x1c89('0x2b')]),_0x14f7cb);if(_0x193d8d[_0x1c89('0x29')][_0x1c89('0x35')]){_0x4dac46[_0x1c89('0x36')]=_[_0x1c89('0x37')](_0x4dac46['where'],{'$or':_[_0x1c89('0x28')](_0x14f7cb,function(_0x2e6ebd){if(_0x2e6ebd[_0x1c89('0x38')]!=='VIRTUAL'){var _0xed5122={};_0xed5122[_0x2e6ebd['name']]={'$like':'%'+_0x193d8d[_0x1c89('0x29')]['filter']+'%'};return _0xed5122;}})});}_0x4dac46=_[_0x1c89('0x37')]({},_0x4dac46,_0x193d8d[_0x1c89('0x39')]);var _0x45152f={'where':_0x4dac46[_0x1c89('0x36')]};return db[_0x1c89('0x23')][_0x1c89('0x1a')](_0x45152f)[_0x1c89('0x20')](function(_0x1b8566){_0x10dc12[_0x1c89('0x1a')]=_0x1b8566;if(_0x193d8d['query'][_0x1c89('0x3a')]){_0x4dac46[_0x1c89('0x3b')]=[{'all':!![]}];}return db[_0x1c89('0x23')][_0x1c89('0x3c')](_0x4dac46);})['then'](function(_0x36e3a7){_0x10dc12[_0x1c89('0x3d')]=_0x36e3a7;return _0x10dc12;})[_0x1c89('0x20')](respondWithFilteredResult(_0x51aa70,_0x4dac46))['catch'](handleError(_0x51aa70,null));};exports['show']=function(_0xa1d4bb,_0x21fa5c){var _0x5f33c0={'raw':!![],'where':{'id':_0xa1d4bb[_0x1c89('0x3e')]['id']}},_0xebb4c3={};_0xebb4c3[_0x1c89('0x27')]=_[_0x1c89('0x2a')](db[_0x1c89('0x23')][_0x1c89('0x24')]);_0xebb4c3[_0x1c89('0x29')]=_['keys'](_0xa1d4bb[_0x1c89('0x29')]);_0xebb4c3['filters']=_['intersection'](_0xebb4c3[_0x1c89('0x27')],_0xebb4c3[_0x1c89('0x29')]);_0x5f33c0[_0x1c89('0x2d')]=_[_0x1c89('0x2c')](_0xebb4c3[_0x1c89('0x27')],qs[_0x1c89('0x2e')](_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x5f33c0[_0x1c89('0x2d')]=_0x5f33c0[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x5f33c0[_0x1c89('0x2d')]:_0xebb4c3[_0x1c89('0x27')];if(_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x3a')]){_0x5f33c0[_0x1c89('0x3b')]=[{'all':!![]}];}_0x5f33c0=_['merge']({},_0x5f33c0,_0xa1d4bb[_0x1c89('0x39')]);return db['DeskField']['find'](_0x5f33c0)[_0x1c89('0x20')](handleEntityNotFound(_0x21fa5c,null))['then'](respondWithResult(_0x21fa5c,null))['catch'](handleError(_0x21fa5c,null));};exports[_0x1c89('0x3f')]=function(_0x4b4d3f,_0x5f102d){return db['DeskField'][_0x1c89('0x3f')](_0x4b4d3f['body'],{})[_0x1c89('0x20')](respondWithResult(_0x5f102d,0xc9))['catch'](handleError(_0x5f102d,null));};exports[_0x1c89('0x1f')]=function(_0x5114bb,_0x36d5fc){if(_0x5114bb[_0x1c89('0x40')]['id']){delete _0x5114bb[_0x1c89('0x40')]['id'];}return db['DeskField'][_0x1c89('0x41')]({'where':{'id':_0x5114bb[_0x1c89('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36d5fc,null))['then'](saveUpdates(_0x5114bb[_0x1c89('0x40')],null))[_0x1c89('0x20')](respondWithResult(_0x36d5fc,null))[_0x1c89('0x42')](handleError(_0x36d5fc,null));};exports[_0x1c89('0x43')]=function(_0x94f616,_0x392fdb){return db[_0x1c89('0x23')][_0x1c89('0x41')]({'where':{'id':_0x94f616[_0x1c89('0x3e')]['id']}})[_0x1c89('0x20')](handleEntityNotFound(_0x392fdb,null))[_0x1c89('0x20')](removeEntity(_0x392fdb,null))[_0x1c89('0x42')](handleError(_0x392fdb,null));}; \ No newline at end of file +var _0x14c5=['sort','where','merge','type','VIRTUAL','options','rows','show','params','keys','includeAll','include','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','DeskField','rawAttributes','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x14c5,0x1de));var _0x514c=function(_0x2284f9,_0x32a3f1){_0x2284f9=_0x2284f9-0x0;var _0x178b6b=_0x14c5[_0x2284f9];return _0x178b6b;};'use strict';var emlformat=require(_0x514c('0x0'));var rimraf=require(_0x514c('0x1'));var zipdir=require(_0x514c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x514c('0x3'));var moment=require(_0x514c('0x4'));var BPromise=require(_0x514c('0x5'));var Mustache=require(_0x514c('0x6'));var util=require(_0x514c('0x7'));var path=require(_0x514c('0x8'));var sox=require(_0x514c('0x9'));var csv=require(_0x514c('0xa'));var ejs=require(_0x514c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x514c('0xc'));var squel=require(_0x514c('0xd'));var crypto=require(_0x514c('0xe'));var jsforce=require(_0x514c('0xf'));var deskjs=require(_0x514c('0x10'));var toCsv=require(_0x514c('0xa'));var querystring=require(_0x514c('0x11'));var Papa=require(_0x514c('0x12'));var Redis=require('ioredis');var authService=require(_0x514c('0x13'));var qs=require(_0x514c('0x14'));var as=require(_0x514c('0x15'));var hardwareService=require(_0x514c('0x16'));var logger=require(_0x514c('0x17'))(_0x514c('0x18'));var utils=require(_0x514c('0x19'));var config=require(_0x514c('0x1a'));var licenseUtil=require(_0x514c('0x1b'));var db=require(_0x514c('0x1c'))['db'];function respondWithStatusCode(_0x5ee1b6,_0x168a84){_0x168a84=_0x168a84||0xcc;return function(_0x4c9af9){if(_0x4c9af9){return _0x5ee1b6[_0x514c('0x1d')](_0x168a84);}return _0x5ee1b6[_0x514c('0x1e')](_0x168a84)[_0x514c('0x1f')]();};}function respondWithResult(_0x5d7a19,_0x3ae9e2){_0x3ae9e2=_0x3ae9e2||0xc8;return function(_0x410998){if(_0x410998){return _0x5d7a19[_0x514c('0x1e')](_0x3ae9e2)[_0x514c('0x20')](_0x410998);}};}function respondWithFilteredResult(_0x48f095,_0x306b5b){return function(_0x28d9ff){if(_0x28d9ff){var _0xbead77=typeof _0x306b5b[_0x514c('0x21')]===_0x514c('0x22')&&typeof _0x306b5b[_0x514c('0x23')]===_0x514c('0x22');var _0x5ee383=_0x28d9ff[_0x514c('0x24')];var _0x23f6b7=_0xbead77?0x0:_0x306b5b[_0x514c('0x21')];var _0x4fc2ac=_0xbead77?_0x28d9ff[_0x514c('0x24')]:_0x306b5b[_0x514c('0x21')]+_0x306b5b['limit'];var _0x52ba4f;if(_0x4fc2ac>=_0x5ee383){_0x4fc2ac=_0x5ee383;_0x52ba4f=0xc8;}else{_0x52ba4f=0xce;}_0x48f095[_0x514c('0x1e')](_0x52ba4f);return _0x48f095[_0x514c('0x25')](_0x514c('0x26'),_0x23f6b7+'-'+_0x4fc2ac+'/'+_0x5ee383)[_0x514c('0x20')](_0x28d9ff);}return null;};}function patchUpdates(_0x1d7c8d){return function(_0xf9690c){try{jsonpatch[_0x514c('0x27')](_0xf9690c,_0x1d7c8d,!![]);}catch(_0x554cd0){return BPromise[_0x514c('0x28')](_0x554cd0);}return _0xf9690c['save']();};}function saveUpdates(_0x501772,_0x2900f7){return function(_0x4c25bd){if(_0x4c25bd){return _0x4c25bd[_0x514c('0x29')](_0x501772)[_0x514c('0x2a')](function(_0x2f3863){return _0x2f3863;});}return null;};}function removeEntity(_0x1be1fe,_0x39f5d4){return function(_0x23ee03){if(_0x23ee03){return _0x23ee03['destroy']()[_0x514c('0x2a')](function(){_0x1be1fe['status'](0xcc)[_0x514c('0x1f')]();});}};}function handleEntityNotFound(_0xa83e7c,_0x465865){return function(_0x25c5f5){if(!_0x25c5f5){_0xa83e7c[_0x514c('0x1d')](0x194);}return _0x25c5f5;};}function handleError(_0x34d4f4,_0x33aeb8){_0x33aeb8=_0x33aeb8||0x1f4;return function(_0x49d6b4){logger[_0x514c('0x2b')](_0x49d6b4[_0x514c('0x2c')]);if(_0x49d6b4['name']){delete _0x49d6b4[_0x514c('0x2d')];}_0x34d4f4[_0x514c('0x1e')](_0x33aeb8)[_0x514c('0x2e')](_0x49d6b4);};}exports[_0x514c('0x2f')]=function(_0x4b1801,_0x35fcec){var _0x419abb={},_0x2e2bec={},_0x10b427={'count':0x0,'rows':[]};var _0x27954d=_['map'](db[_0x514c('0x30')][_0x514c('0x31')],function(_0x19bc78){return{'name':_0x19bc78['fieldName'],'type':_0x19bc78['type'][_0x514c('0x32')]};});_0x2e2bec[_0x514c('0x33')]=_[_0x514c('0x34')](_0x27954d,_0x514c('0x2d'));_0x2e2bec[_0x514c('0x35')]=_['keys'](_0x4b1801[_0x514c('0x35')]);_0x2e2bec[_0x514c('0x36')]=_['intersection'](_0x2e2bec['model'],_0x2e2bec['query']);_0x419abb[_0x514c('0x37')]=_[_0x514c('0x38')](_0x2e2bec[_0x514c('0x33')],qs[_0x514c('0x39')](_0x4b1801[_0x514c('0x35')][_0x514c('0x39')]));_0x419abb['attributes']=_0x419abb[_0x514c('0x37')][_0x514c('0x3a')]?_0x419abb[_0x514c('0x37')]:_0x2e2bec[_0x514c('0x33')];if(!_0x4b1801[_0x514c('0x35')][_0x514c('0x3b')]('nolimit')){_0x419abb[_0x514c('0x23')]=qs[_0x514c('0x23')](_0x4b1801['query'][_0x514c('0x23')]);_0x419abb['offset']=qs[_0x514c('0x21')](_0x4b1801[_0x514c('0x35')][_0x514c('0x21')]);}_0x419abb[_0x514c('0x3c')]=qs[_0x514c('0x3d')](_0x4b1801[_0x514c('0x35')][_0x514c('0x3d')]);_0x419abb[_0x514c('0x3e')]=qs['filters'](_['pick'](_0x4b1801[_0x514c('0x35')],_0x2e2bec[_0x514c('0x36')]),_0x27954d);if(_0x4b1801[_0x514c('0x35')]['filter']){_0x419abb['where']=_[_0x514c('0x3f')](_0x419abb[_0x514c('0x3e')],{'$or':_['map'](_0x27954d,function(_0x43fa78){if(_0x43fa78[_0x514c('0x40')]!==_0x514c('0x41')){var _0x3272bc={};_0x3272bc[_0x43fa78[_0x514c('0x2d')]]={'$like':'%'+_0x4b1801['query']['filter']+'%'};return _0x3272bc;}})});}_0x419abb=_['merge']({},_0x419abb,_0x4b1801[_0x514c('0x42')]);var _0x5a2664={'where':_0x419abb[_0x514c('0x3e')]};return db[_0x514c('0x30')][_0x514c('0x24')](_0x5a2664)[_0x514c('0x2a')](function(_0x5114cd){_0x10b427[_0x514c('0x24')]=_0x5114cd;if(_0x4b1801[_0x514c('0x35')]['includeAll']){_0x419abb['include']=[{'all':!![]}];}return db[_0x514c('0x30')]['findAll'](_0x419abb);})[_0x514c('0x2a')](function(_0x29d2e6){_0x10b427[_0x514c('0x43')]=_0x29d2e6;return _0x10b427;})[_0x514c('0x2a')](respondWithFilteredResult(_0x35fcec,_0x419abb))['catch'](handleError(_0x35fcec,null));};exports[_0x514c('0x44')]=function(_0x28394a,_0x3a11a2){var _0x3effdf={'raw':!![],'where':{'id':_0x28394a[_0x514c('0x45')]['id']}},_0x25c1f1={};_0x25c1f1['model']=_[_0x514c('0x46')](db[_0x514c('0x30')][_0x514c('0x31')]);_0x25c1f1[_0x514c('0x35')]=_[_0x514c('0x46')](_0x28394a[_0x514c('0x35')]);_0x25c1f1['filters']=_[_0x514c('0x38')](_0x25c1f1[_0x514c('0x33')],_0x25c1f1['query']);_0x3effdf[_0x514c('0x37')]=_['intersection'](_0x25c1f1['model'],qs['fields'](_0x28394a[_0x514c('0x35')]['fields']));_0x3effdf['attributes']=_0x3effdf[_0x514c('0x37')][_0x514c('0x3a')]?_0x3effdf[_0x514c('0x37')]:_0x25c1f1[_0x514c('0x33')];if(_0x28394a[_0x514c('0x35')][_0x514c('0x47')]){_0x3effdf[_0x514c('0x48')]=[{'all':!![]}];}_0x3effdf=_['merge']({},_0x3effdf,_0x28394a[_0x514c('0x42')]);return db[_0x514c('0x30')][_0x514c('0x49')](_0x3effdf)[_0x514c('0x2a')](handleEntityNotFound(_0x3a11a2,null))['then'](respondWithResult(_0x3a11a2,null))[_0x514c('0x4a')](handleError(_0x3a11a2,null));};exports[_0x514c('0x4b')]=function(_0x137dc6,_0x5c8518){return db[_0x514c('0x30')]['create'](_0x137dc6['body'],{})['then'](respondWithResult(_0x5c8518,0xc9))[_0x514c('0x4a')](handleError(_0x5c8518,null));};exports[_0x514c('0x29')]=function(_0x14ae42,_0x3dd9b1){if(_0x14ae42[_0x514c('0x4c')]['id']){delete _0x14ae42[_0x514c('0x4c')]['id'];}return db[_0x514c('0x30')][_0x514c('0x49')]({'where':{'id':_0x14ae42[_0x514c('0x45')]['id']}})[_0x514c('0x2a')](handleEntityNotFound(_0x3dd9b1,null))['then'](saveUpdates(_0x14ae42[_0x514c('0x4c')],null))[_0x514c('0x2a')](respondWithResult(_0x3dd9b1,null))['catch'](handleError(_0x3dd9b1,null));};exports['destroy']=function(_0x2cfc55,_0x22e92f){return db[_0x514c('0x30')][_0x514c('0x49')]({'where':{'id':_0x2cfc55[_0x514c('0x45')]['id']}})[_0x514c('0x2a')](handleEntityNotFound(_0x22e92f,null))[_0x514c('0x2a')](removeEntity(_0x22e92f,null))[_0x514c('0x4a')](handleError(_0x22e92f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 97de2bf..ff48035 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 _0xdeff=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','desk_unique_index','idField','lodash','../../config/logger','bluebird'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0xdeff,0x1e9));var _0xfdef=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xdeff[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0xfdef('0x0'));var util=require('util');var logger=require(_0xfdef('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfdef('0x2'));var rp=require(_0xfdef('0x3'));var fs=require('fs');var path=require(_0xfdef('0x4'));var rimraf=require(_0xfdef('0x5'));var config=require(_0xfdef('0x6'));var attributes=require(_0xfdef('0x7'));module['exports']=function(_0x178d2d,_0x2acb73){return _0x178d2d[_0xfdef('0x8')](_0xfdef('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xfdef('0xa'),'fields':[_0xfdef('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa61e=['FieldId','lodash','api','bluebird','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField'];(function(_0x2ed3a2,_0x5cc62a){var _0xf11bbc=function(_0x241d9d){while(--_0x241d9d){_0x2ed3a2['push'](_0x2ed3a2['shift']());}};_0xf11bbc(++_0x5cc62a);}(_0xa61e,0x79));var _0xea61=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa61e[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xea61('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xea61('0x1'));var moment=require('moment');var BPromise=require(_0xea61('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea61('0x3'));var rimraf=require(_0xea61('0x4'));var config=require('../../config/environment');var attributes=require(_0xea61('0x5'));module[_0xea61('0x6')]=function(_0x2686cc,_0x6811a0){return _0x2686cc[_0xea61('0x7')]('DeskField',attributes,{'tableName':_0xea61('0x8'),'paranoid':![],'indexes':[{'name':_0xea61('0x9'),'fields':[_0xea61('0xa'),_0xea61('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 11fd7ea..22ef106 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 _0x1623=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1623,0x1d8));var _0x3162=function(_0xccc624,_0x340c20){_0xccc624=_0xccc624-0x0;var _0x322002=_0x1623[_0xccc624];return _0x322002;};'use strict';var _=require(_0x3162('0x0'));var util=require(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3162('0x4'));var db=require(_0x3162('0x5'))['db'];var utils=require(_0x3162('0x6'));var logger=require(_0x3162('0x7'))(_0x3162('0x8'));var config=require('../../config/environment');var jayson=require(_0x3162('0x9'));var client=jayson[_0x3162('0xa')][_0x3162('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf3ad49,_0x3ed42b,_0x4c5ce4){return new BPromise(function(_0x3a5c25,_0x484791){return client[_0x3162('0xc')](_0xf3ad49,_0x4c5ce4)[_0x3162('0xd')](function(_0x5b4fc2){logger[_0x3162('0xe')](_0x3162('0xf'),_0x3ed42b,_0x3162('0x10'));logger[_0x3162('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3ed42b,_0x3162('0x10'),JSON['stringify'](_0x5b4fc2));if(_0x5b4fc2[_0x3162('0x12')]){if(_0x5b4fc2[_0x3162('0x12')][_0x3162('0x13')]===0x1f4){logger[_0x3162('0x12')]('DeskField,\x20%s,\x20%s',_0x3ed42b,_0x5b4fc2[_0x3162('0x12')]['message']);return _0x484791(_0x5b4fc2[_0x3162('0x12')][_0x3162('0x14')]);}logger[_0x3162('0x12')](_0x3162('0xf'),_0x3ed42b,_0x5b4fc2[_0x3162('0x12')][_0x3162('0x14')]);return _0x3a5c25(_0x5b4fc2['error'][_0x3162('0x14')]);}else{logger[_0x3162('0xe')]('DeskField,\x20%s,\x20%s',_0x3ed42b,_0x3162('0x10'));_0x3a5c25(_0x5b4fc2[_0x3162('0x15')]['message']);}})[_0x3162('0x16')](function(_0x49f5b1){logger[_0x3162('0x12')](_0x3162('0xf'),_0x3ed42b,_0x49f5b1);_0x484791(_0x49f5b1);});});} \ No newline at end of file +var _0x0113=['../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5a3e10,_0x95914d){var _0x51e1f8=function(_0x5d83bd){while(--_0x5d83bd){_0x5a3e10['push'](_0x5a3e10['shift']());}};_0x51e1f8(++_0x95914d);}(_0x0113,0x1b3));var _0x3011=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0113[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3011('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3011('0x1'));var rs=require(_0x3011('0x2'));var fs=require('fs');var Redis=require(_0x3011('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3011('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3011('0x5'));var jayson=require(_0x3011('0x6'));var client=jayson[_0x3011('0x7')][_0x3011('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x392cda,_0x4f419b,_0x5bf697){return new BPromise(function(_0x570494,_0x5e2664){return client[_0x3011('0x9')](_0x392cda,_0x5bf697)[_0x3011('0xa')](function(_0x5cc8ca){logger[_0x3011('0xb')](_0x3011('0xc'),_0x4f419b,_0x3011('0xd'));logger[_0x3011('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4f419b,'request\x20sent',JSON['stringify'](_0x5cc8ca));if(_0x5cc8ca['error']){if(_0x5cc8ca['error'][_0x3011('0xf')]===0x1f4){logger[_0x3011('0x10')](_0x3011('0xc'),_0x4f419b,_0x5cc8ca[_0x3011('0x10')][_0x3011('0x11')]);return _0x5e2664(_0x5cc8ca[_0x3011('0x10')][_0x3011('0x11')]);}logger[_0x3011('0x10')](_0x3011('0xc'),_0x4f419b,_0x5cc8ca[_0x3011('0x10')]['message']);return _0x570494(_0x5cc8ca['error'][_0x3011('0x11')]);}else{logger[_0x3011('0xb')]('DeskField,\x20%s,\x20%s',_0x4f419b,_0x3011('0xd'));_0x570494(_0x5cc8ca[_0x3011('0x12')][_0x3011('0x11')]);}})[_0x3011('0x13')](function(_0x4f607e){logger[_0x3011('0x10')](_0x3011('0xc'),_0x4f419b,_0x4f607e);_0x5e2664(_0x4f607e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6a7f495..bd0d42b 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 _0xaf53=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xaf53,0xca));var _0x3af5=function(_0x4abb7a,_0x34465a){_0x4abb7a=_0x4abb7a-0x0;var _0x34a172=_0xaf53[_0x4abb7a];return _0x34a172;};'use strict';var multer=require(_0x3af5('0x0'));var util=require(_0x3af5('0x1'));var path=require(_0x3af5('0x2'));var timeout=require('connect-timeout');var express=require(_0x3af5('0x3'));var router=express[_0x3af5('0x4')]();var fs_extra=require(_0x3af5('0x5'));var auth=require(_0x3af5('0x6'));var interaction=require(_0x3af5('0x7'));var config=require(_0x3af5('0x8'));var controller=require('./intDynamics365Account.controller');router[_0x3af5('0x9')]('/',auth[_0x3af5('0xa')](),controller[_0x3af5('0xb')]);router[_0x3af5('0x9')](_0x3af5('0xc'),auth[_0x3af5('0xa')](),controller[_0x3af5('0xd')]);router['get'](_0x3af5('0xe'),auth['isAuthenticated'](),controller[_0x3af5('0xf')]);router[_0x3af5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3af5('0x10')]);router['post']('/',auth[_0x3af5('0xa')](),controller[_0x3af5('0x11')]);router[_0x3af5('0x12')](_0x3af5('0xe'),auth[_0x3af5('0xa')](),controller[_0x3af5('0x13')]);router['put'](_0x3af5('0xc'),auth[_0x3af5('0xa')](),controller['update']);router[_0x3af5('0x14')](_0x3af5('0xc'),auth[_0x3af5('0xa')](),controller[_0x3af5('0x15')]);module[_0x3af5('0x16')]=router; \ No newline at end of file +var _0x7e46=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','create','post','addConfiguration','put'];(function(_0x576512,_0x1e35af){var _0x5b1ec2=function(_0x1a38b2){while(--_0x1a38b2){_0x576512['push'](_0x576512['shift']());}};_0x5b1ec2(++_0x1e35af);}(_0x7e46,0x76));var _0x67e4=function(_0x2f078f,_0x3359ad){_0x2f078f=_0x2f078f-0x0;var _0xfb5d13=_0x7e46[_0x2f078f];return _0xfb5d13;};'use strict';var multer=require(_0x67e4('0x0'));var util=require(_0x67e4('0x1'));var path=require(_0x67e4('0x2'));var timeout=require(_0x67e4('0x3'));var express=require(_0x67e4('0x4'));var router=express[_0x67e4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x67e4('0x6'));var config=require(_0x67e4('0x7'));var controller=require(_0x67e4('0x8'));router[_0x67e4('0x9')]('/',auth[_0x67e4('0xa')](),controller[_0x67e4('0xb')]);router[_0x67e4('0x9')](_0x67e4('0xc'),auth['isAuthenticated'](),controller[_0x67e4('0xd')]);router[_0x67e4('0x9')]('/:id/configurations',auth[_0x67e4('0xa')](),controller[_0x67e4('0xe')]);router[_0x67e4('0x9')]('/:id/fields',auth[_0x67e4('0xa')](),controller[_0x67e4('0xf')]);router['post']('/',auth[_0x67e4('0xa')](),controller[_0x67e4('0x10')]);router[_0x67e4('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x67e4('0x12')]);router[_0x67e4('0x13')](_0x67e4('0xc'),auth[_0x67e4('0xa')](),controller['update']);router[_0x67e4('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x67e4('0x15')]);module[_0x67e4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7574c26..e517de0 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 _0xe700=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4acd65,_0x193e16){var _0x1e7c1d=function(_0x49ee80){while(--_0x49ee80){_0x4acd65['push'](_0x4acd65['shift']());}};_0x1e7c1d(++_0x193e16);}(_0xe700,0x75));var _0x0e70=function(_0x52bee5,_0x32eb00){_0x52bee5=_0x52bee5-0x0;var _0xbbab73=_0xe700[_0x52bee5];return _0xbbab73;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'name':{'type':Sequelize[_0x0e70('0x2')]},'username':{'type':Sequelize[_0x0e70('0x2')]},'password':{'type':Sequelize[_0x0e70('0x2')]},'remoteUri':{'type':Sequelize[_0x0e70('0x2')]},'tenantId':{'type':Sequelize[_0x0e70('0x2')]},'clientId':{'type':Sequelize[_0x0e70('0x2')]},'clientSecret':{'type':Sequelize[_0x0e70('0x2')]},'serverUrl':{'type':Sequelize[_0x0e70('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x0e70('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7f3f=['sequelize','exports','STRING'];(function(_0xf4e841,_0x5c8499){var _0x27a2f3=function(_0xbe0b64){while(--_0xbe0b64){_0xf4e841['push'](_0xf4e841['shift']());}};_0x27a2f3(++_0x5c8499);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x7f3f[_0x454e6d];return _0x4bc294;};'use strict';var Sequelize=require(_0xf7f3('0x0'));module[_0xf7f3('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf7f3('0x2')]},'password':{'type':Sequelize[_0xf7f3('0x2')]},'remoteUri':{'type':Sequelize[_0xf7f3('0x2')]},'tenantId':{'type':Sequelize[_0xf7f3('0x2')]},'clientId':{'type':Sequelize[_0xf7f3('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf7f3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf7f3('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 0ce1c27..631c261 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 _0xdc32=['include','findAll','rows','catch','show','params','length','options','create','body','find','getConfigurations','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','substring','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','/oauth2/token','username','clientSecret','Bearer\x20','MetadataId','GET','EntityDefinitions(','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','lastIndexOf','BooleanAttributeMetadata','all','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','stack','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','error','name','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','includeAll'];(function(_0x20c882,_0x11e4e2){var _0x481a94=function(_0x22b4e5){while(--_0x22b4e5){_0x20c882['push'](_0x20c882['shift']());}};_0x481a94(++_0x11e4e2);}(_0xdc32,0x149));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x2dc3('0x0'));var util=require(_0x2dc3('0x1'));var _=require('lodash');var qs=require(_0x2dc3('0x2'));var logger=require(_0x2dc3('0x3'))(_0x2dc3('0x4'));var db=require(_0x2dc3('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x2823a1,_0x5222a7){_0x5222a7=_0x5222a7||0xc8;return function(_0x590742){if(_0x590742){return _0x2823a1[_0x2dc3('0x6')](_0x5222a7)[_0x2dc3('0x7')](_0x590742);}};}function respondWithFilteredResult(_0x42ed74,_0x3566c1){return function(_0x77ed14){if(_0x77ed14){var _0x1ba32e=typeof _0x3566c1[_0x2dc3('0x8')]===_0x2dc3('0x9')&&typeof _0x3566c1[_0x2dc3('0xa')]==='undefined';var _0x353350=_0x77ed14[_0x2dc3('0xb')];var _0x1c0448=_0x1ba32e?0x0:_0x3566c1[_0x2dc3('0x8')];var _0x1511fd=_0x1ba32e?_0x77ed14['count']:_0x3566c1[_0x2dc3('0x8')]+_0x3566c1[_0x2dc3('0xa')];var _0x3b7b9a;if(_0x1511fd>=_0x353350){_0x1511fd=_0x353350;_0x3b7b9a=0xc8;}else{_0x3b7b9a=0xce;}_0x42ed74[_0x2dc3('0x6')](_0x3b7b9a);return _0x42ed74[_0x2dc3('0xc')]('Content-Range',_0x1c0448+'-'+_0x1511fd+'/'+_0x353350)[_0x2dc3('0x7')](_0x77ed14);}return null;};}function saveUpdates(_0x224f52){return function(_0x3a0b1c){if(_0x3a0b1c){return _0x3a0b1c[_0x2dc3('0xd')](_0x224f52)[_0x2dc3('0xe')](function(_0x387bec){return _0x387bec;});}return null;};}function removeEntity(_0x5575d3){return function(_0x2aa84d){if(_0x2aa84d){return _0x2aa84d[_0x2dc3('0xf')]()[_0x2dc3('0xe')](function(){_0x5575d3[_0x2dc3('0x6')](0xcc)[_0x2dc3('0x10')]();});}};}function handleEntityNotFound(_0x2f0e1e){return function(_0x39aa40){if(!_0x39aa40){_0x2f0e1e[_0x2dc3('0x11')](0x194);}return _0x39aa40;};}function handleError(_0x43baf9,_0x5e4770){_0x5e4770=_0x5e4770||0x1f4;return function(_0x6d678d){logger[_0x2dc3('0x12')](_0x6d678d['stack']);if(_0x6d678d[_0x2dc3('0x13')]){delete _0x6d678d['name'];}_0x43baf9[_0x2dc3('0x6')](_0x5e4770)['send'](_0x6d678d);};}exports[_0x2dc3('0x14')]=function(_0x311b9b,_0x16b9f1){var _0x4a480a={},_0x52dfe0={},_0x37785b={'count':0x0,'rows':[]};var _0x25e0e3=_['map'](db[_0x2dc3('0x15')][_0x2dc3('0x16')],function(_0x43d827){return{'name':_0x43d827[_0x2dc3('0x17')],'type':_0x43d827[_0x2dc3('0x18')][_0x2dc3('0x19')]};});_0x52dfe0[_0x2dc3('0x1a')]=_[_0x2dc3('0x1b')](_0x25e0e3,_0x2dc3('0x13'));_0x52dfe0['query']=_[_0x2dc3('0x1c')](_0x311b9b[_0x2dc3('0x1d')]);_0x52dfe0[_0x2dc3('0x1e')]=_[_0x2dc3('0x1f')](_0x52dfe0[_0x2dc3('0x1a')],_0x52dfe0[_0x2dc3('0x1d')]);_0x4a480a[_0x2dc3('0x20')]=_[_0x2dc3('0x1f')](_0x52dfe0['model'],qs['fields'](_0x311b9b[_0x2dc3('0x1d')][_0x2dc3('0x21')]));_0x4a480a[_0x2dc3('0x20')]=_0x4a480a[_0x2dc3('0x20')]['length']?_0x4a480a['attributes']:_0x52dfe0[_0x2dc3('0x1a')];if(!_0x311b9b[_0x2dc3('0x1d')][_0x2dc3('0x22')]('nolimit')){_0x4a480a[_0x2dc3('0xa')]=qs[_0x2dc3('0xa')](_0x311b9b[_0x2dc3('0x1d')][_0x2dc3('0xa')]);_0x4a480a[_0x2dc3('0x8')]=qs[_0x2dc3('0x8')](_0x311b9b[_0x2dc3('0x1d')]['offset']);}_0x4a480a['order']=qs['sort'](_0x311b9b['query'][_0x2dc3('0x23')]);_0x4a480a[_0x2dc3('0x24')]=qs[_0x2dc3('0x1e')](_[_0x2dc3('0x25')](_0x311b9b[_0x2dc3('0x1d')],_0x52dfe0['filters']),_0x25e0e3);if(_0x311b9b[_0x2dc3('0x1d')]['filter']){_0x4a480a[_0x2dc3('0x24')]=_[_0x2dc3('0x26')](_0x4a480a['where'],{'$or':_[_0x2dc3('0x1b')](_0x25e0e3,function(_0x39d125){if(_0x39d125[_0x2dc3('0x18')]!==_0x2dc3('0x27')){var _0x426168={};_0x426168[_0x39d125[_0x2dc3('0x13')]]={'$like':'%'+_0x311b9b[_0x2dc3('0x1d')]['filter']+'%'};return _0x426168;}})});}_0x4a480a=_['merge']({},_0x4a480a,_0x311b9b['options']);var _0x4094ea={'where':_0x4a480a[_0x2dc3('0x24')]};return db[_0x2dc3('0x15')][_0x2dc3('0xb')](_0x4094ea)['then'](function(_0x43f740){_0x37785b['count']=_0x43f740;if(_0x311b9b[_0x2dc3('0x1d')][_0x2dc3('0x28')]){_0x4a480a[_0x2dc3('0x29')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x2dc3('0x2a')](_0x4a480a);})[_0x2dc3('0xe')](function(_0x56c10c){_0x37785b[_0x2dc3('0x2b')]=_0x56c10c;return _0x37785b;})[_0x2dc3('0xe')](respondWithFilteredResult(_0x16b9f1,_0x4a480a))[_0x2dc3('0x2c')](handleError(_0x16b9f1,null));};exports[_0x2dc3('0x2d')]=function(_0x19339b,_0x5b1871){var _0x53b642={'raw':![],'where':{'id':_0x19339b[_0x2dc3('0x2e')]['id']}},_0x27c9e9={};_0x27c9e9[_0x2dc3('0x1a')]=_[_0x2dc3('0x1c')](db[_0x2dc3('0x15')][_0x2dc3('0x16')]);_0x27c9e9[_0x2dc3('0x1d')]=_[_0x2dc3('0x1c')](_0x19339b[_0x2dc3('0x1d')]);_0x27c9e9['filters']=_[_0x2dc3('0x1f')](_0x27c9e9[_0x2dc3('0x1a')],_0x27c9e9[_0x2dc3('0x1d')]);_0x53b642[_0x2dc3('0x20')]=_[_0x2dc3('0x1f')](_0x27c9e9[_0x2dc3('0x1a')],qs[_0x2dc3('0x21')](_0x19339b[_0x2dc3('0x1d')][_0x2dc3('0x21')]));_0x53b642['attributes']=_0x53b642['attributes'][_0x2dc3('0x2f')]?_0x53b642[_0x2dc3('0x20')]:_0x27c9e9[_0x2dc3('0x1a')];if(_0x19339b['query'][_0x2dc3('0x28')]){_0x53b642['include']=[{'all':!![]}];}_0x53b642=_[_0x2dc3('0x26')]({},_0x53b642,_0x19339b[_0x2dc3('0x30')]);return db[_0x2dc3('0x15')]['find'](_0x53b642)[_0x2dc3('0xe')](handleEntityNotFound(_0x5b1871,null))['then'](respondWithResult(_0x5b1871,null))[_0x2dc3('0x2c')](handleError(_0x5b1871,null));};exports[_0x2dc3('0x31')]=function(_0x165b70,_0x409179){return db['Dynamics365Account'][_0x2dc3('0x31')](_0x165b70[_0x2dc3('0x32')],{})['then'](respondWithResult(_0x409179,0xc9))[_0x2dc3('0x2c')](handleError(_0x409179,null));};exports[_0x2dc3('0xd')]=function(_0x2543d7,_0x1f0fe8){if(_0x2543d7[_0x2dc3('0x32')]['id']){delete _0x2543d7[_0x2dc3('0x32')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x2543d7[_0x2dc3('0x2e')]['id']}})[_0x2dc3('0xe')](handleEntityNotFound(_0x1f0fe8,null))[_0x2dc3('0xe')](saveUpdates(_0x2543d7[_0x2dc3('0x32')],null))[_0x2dc3('0xe')](respondWithResult(_0x1f0fe8,null))[_0x2dc3('0x2c')](handleError(_0x1f0fe8,null));};exports['destroy']=function(_0x3388e2,_0x1e9ad1){return db['Dynamics365Account'][_0x2dc3('0x33')]({'where':{'id':_0x3388e2[_0x2dc3('0x2e')]['id']}})[_0x2dc3('0xe')](handleEntityNotFound(_0x1e9ad1,null))['then'](removeEntity(_0x1e9ad1,null))[_0x2dc3('0x2c')](handleError(_0x1e9ad1,null));};exports[_0x2dc3('0x34')]=function(_0xadd790,_0x432316){var _0x11b0b4={};var _0x502b1e={};var _0x3ce8be;var _0xa6923d;return db['Dynamics365Account']['findOne']({'where':{'id':_0xadd790[_0x2dc3('0x2e')]['id']}})['then'](handleEntityNotFound(_0x432316,null))[_0x2dc3('0xe')](function(_0x57df53){if(_0x57df53){_0x3ce8be=_0x57df53;_0x502b1e['model']=_[_0x2dc3('0x1c')](db['Dynamics365Configuration']['rawAttributes']);_0x502b1e[_0x2dc3('0x1d')]=_[_0x2dc3('0x1c')](_0xadd790['query']);_0x502b1e[_0x2dc3('0x1e')]=_[_0x2dc3('0x1f')](_0x502b1e[_0x2dc3('0x1a')],_0x502b1e['query']);_0x11b0b4[_0x2dc3('0x20')]=_[_0x2dc3('0x1f')](_0x502b1e[_0x2dc3('0x1a')],qs['fields'](_0xadd790[_0x2dc3('0x1d')][_0x2dc3('0x21')]));_0x11b0b4[_0x2dc3('0x20')]=_0x11b0b4[_0x2dc3('0x20')][_0x2dc3('0x2f')]?_0x11b0b4[_0x2dc3('0x20')]:_0x502b1e['model'];_0x11b0b4['order']=qs[_0x2dc3('0x23')](_0xadd790[_0x2dc3('0x1d')]['sort']);_0x11b0b4[_0x2dc3('0x24')]=qs[_0x2dc3('0x1e')](_[_0x2dc3('0x25')](_0xadd790['query'],_0x502b1e['filters']));if(_0xadd790[_0x2dc3('0x1d')][_0x2dc3('0x35')]){_0x11b0b4[_0x2dc3('0x24')]=_[_0x2dc3('0x26')](_0x11b0b4['where'],{'$or':_[_0x2dc3('0x1b')](_0x11b0b4['attributes'],function(_0x5e8de6){var _0x380c45={};_0x380c45[_0x5e8de6]={'$like':'%'+_0xadd790[_0x2dc3('0x1d')][_0x2dc3('0x35')]+'%'};return _0x380c45;})});}_0x11b0b4=_['merge']({},_0x11b0b4,_0xadd790[_0x2dc3('0x30')]);return _0x3ce8be[_0x2dc3('0x34')](_0x11b0b4);}})['then'](function(_0x1a367a){if(_0x1a367a){_0xa6923d=_0x1a367a[_0x2dc3('0x2f')];if(!_0xadd790[_0x2dc3('0x1d')][_0x2dc3('0x22')]('nolimit')){_0x11b0b4['limit']=qs[_0x2dc3('0xa')](_0xadd790[_0x2dc3('0x1d')][_0x2dc3('0xa')]);_0x11b0b4['offset']=qs['offset'](_0xadd790[_0x2dc3('0x1d')][_0x2dc3('0x8')]);}return _0x3ce8be['getConfigurations'](_0x11b0b4);}})[_0x2dc3('0xe')](function(_0x553d2d){if(_0x553d2d){return _0x553d2d?{'count':_0xa6923d,'rows':_0x553d2d}:null;}})[_0x2dc3('0xe')](respondWithResult(_0x432316,null))[_0x2dc3('0x2c')](handleError(_0x432316,null));};exports[_0x2dc3('0x36')]=function(_0x31e620,_0x26928b){if(_0x31e620[_0x2dc3('0x32')]['id']){delete _0x31e620[_0x2dc3('0x32')]['id'];}return db[_0x2dc3('0x15')][_0x2dc3('0x37')]({'where':{'id':_0x31e620['params']['id']}})['then'](handleEntityNotFound(_0x26928b,null))[_0x2dc3('0xe')](function(_0x4586fc){if(_0x4586fc){_0x31e620[_0x2dc3('0x32')][_0x2dc3('0x38')]=_0x4586fc['id'];_0x31e620[_0x2dc3('0x32')][_0x2dc3('0x39')]=integrations[_0x2dc3('0x3a')](_0x31e620[_0x2dc3('0x32')]['channel'],_0x31e620[_0x2dc3('0x32')][_0x2dc3('0x18')]);_0x31e620[_0x2dc3('0x32')][_0x2dc3('0x3b')]=integrations[_0x2dc3('0x3c')](_0x31e620[_0x2dc3('0x32')][_0x2dc3('0x3d')],_0x31e620[_0x2dc3('0x32')]['type']);return db[_0x2dc3('0x3e')][_0x2dc3('0x31')](_0x31e620['body'],{'include':[{'model':db[_0x2dc3('0x3f')],'as':'Subjects'},{'model':db[_0x2dc3('0x3f')],'as':_0x2dc3('0x3b')}]});}return null;})[_0x2dc3('0xe')](respondWithResult(_0x26928b,null))['catch'](handleError(_0x26928b,null));};function sanitizeRemoteUri(_0x542339){var _0x3d5470=_0x542339['slice'](-0x1);if(_0x3d5470==='/')return _0x542339[_0x2dc3('0x40')](0x0,_0x542339['lastIndexOf'](_0x3d5470));return _0x542339;}function getWebApiUrl(_0x5b6688){return util[_0x2dc3('0x41')](_0x2dc3('0x42'),_0x5b6688);}exports['getFields']=function(_0x2ae1d5,_0x27d4dc){var _0x5231b2=_0x2ae1d5[_0x2dc3('0x1d')][_0x2dc3('0x43')];var _0x570e0d=_0x5231b2===_0x2dc3('0x44')?_0x2dc3('0x45'):_0x2dc3('0x46');var _0x1ea5ac='';var _0x2c4c0b='';var _0x33b182='';var _0x1a2191='';var _0xbb9d35='';var _0xcc33b0='';var _0x5c8ff5='';var _0x4238d0='';var _0x2e3cec=['title','description',_0x2dc3('0x47'),_0x2dc3('0x48'),_0x2dc3('0x49'),_0x2dc3('0x4a'),_0x2dc3('0x4b'),_0x2dc3('0x4c'),_0x2dc3('0x4d'),_0x2dc3('0x4e')];var _0x106002=[_0x2dc3('0x4f'),_0x2dc3('0x50'),_0x2dc3('0x51'),_0x2dc3('0x52'),_0x2dc3('0x53'),_0x2dc3('0x54'),_0x2dc3('0x55'),_0x2dc3('0x56'),_0x2dc3('0x57'),_0x2dc3('0x58'),_0x2dc3('0x59'),'createdbyyominame','createdon',_0x2dc3('0x5a'),_0x2dc3('0x5b'),_0x2dc3('0x5c'),_0x2dc3('0x5d'),_0x2dc3('0x5e'),'emailaddress',_0x2dc3('0x5f'),'entityimage_timestamp',_0x2dc3('0x60'),_0x2dc3('0x61'),_0x2dc3('0x62'),_0x2dc3('0x63'),'followupby',_0x2dc3('0x64'),_0x2dc3('0x65'),_0x2dc3('0x66'),_0x2dc3('0x67'),_0x2dc3('0x68'),_0x2dc3('0x69'),'modifiedbyexternalpartyyominame',_0x2dc3('0x6a'),_0x2dc3('0x6b'),_0x2dc3('0x6c'),_0x2dc3('0x6d'),'modifiedonbehalfbyyominame',_0x2dc3('0x6e'),_0x2dc3('0x6f'),_0x2dc3('0x70'),_0x2dc3('0x71'),_0x2dc3('0x72'),_0x2dc3('0x73'),_0x2dc3('0x74'),'owneridyominame',_0x2dc3('0x75'),'primarycontactidname','primarycontactidyominame','prioritycodename',_0x2dc3('0x76'),_0x2dc3('0x77'),_0x2dc3('0x78'),_0x2dc3('0x79'),_0x2dc3('0x7a'),'responsiblecontactidname','responsiblecontactidyominame',_0x2dc3('0x7b'),_0x2dc3('0x7c'),'slaname',_0x2dc3('0x7d'),_0x2dc3('0x7e'),'statuscode','subjectidname',_0x2dc3('0x7f'),_0x2dc3('0x80'),_0x2dc3('0x81'),'traversedpath','utcconversiontimezonecode',_0x2dc3('0x82')];var _0x379ec0=_0x2e3cec[_0x2dc3('0x83')](_0x106002);return db[_0x2dc3('0x15')]['findOne']({'where':{'id':_0x2ae1d5[_0x2dc3('0x2e')]['id']},'attributes':['id','username',_0x2dc3('0x84'),_0x2dc3('0x85'),_0x2dc3('0x86'),_0x2dc3('0x87'),'clientSecret',_0x2dc3('0x88')],'include':[{'model':db[_0x2dc3('0x89')],'as':_0x2dc3('0x89'),'attributes':['id',_0x2dc3('0x8a'),_0x2dc3('0x8b')]}]})[_0x2dc3('0xe')](handleEntityNotFound(_0x27d4dc,null))[_0x2dc3('0xe')](function(_0x4d0455){if(_0x4d0455){if(_0x4d0455[_0x2dc3('0x88')]){_0x4d0455[_0x2dc3('0x8c')]=_0x4d0455['CloudProvider'][_0x2dc3('0x8a')];_0x4238d0=sanitizeRemoteUri(_0x4d0455[_0x2dc3('0x89')][_0x2dc3('0x8b')]);_0x5c8ff5=getWebApiUrl(_0x4238d0);return _0x4d0455;}_0x4238d0=sanitizeRemoteUri(_0x4d0455[_0x2dc3('0x85')]);_0x5c8ff5=getWebApiUrl(_0x4238d0);var _0x1297c9={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x4d0455[_0x2dc3('0x86')]+_0x2dc3('0x8d'),'form':{'client_id':_0x4d0455[_0x2dc3('0x87')],'resource':_0x4238d0,'username':_0x4d0455[_0x2dc3('0x8e')],'password':_0x4d0455[_0x2dc3('0x84')],'grant_type':_0x2dc3('0x84'),'client_secret':_0x4d0455[_0x2dc3('0x8f')]},'json':!![]};return rp(_0x1297c9);}})[_0x2dc3('0xe')](function(_0x118007){_0xcc33b0=_0x118007['access_token'];var _0x384d15={'method':'GET','uri':encodeURI(_0x5c8ff5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x570e0d+'\x27'),'headers':{'Authorization':_0x2dc3('0x90')+_0xcc33b0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x384d15);})[_0x2dc3('0xe')](function(_0x5c7307){var _0x492972=_0x5c7307['value'][0x0];var _0x334965=_0x492972[_0x2dc3('0x91')];var _0x4db89e={'method':_0x2dc3('0x92'),'uri':_0x5c8ff5+_0x2dc3('0x93')+_0x334965+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x2dc3('0x90')+_0xcc33b0,'If-None-Match':null,'OData-Version':_0x2dc3('0x94')},'json':!![]};return rp(_0x4db89e);})[_0x2dc3('0xe')](function(_0x26d803){_0x1ea5ac=_0x26d803;_0x2c4c0b=_0x1ea5ac[_0x2dc3('0x95')];_0x2c4c0b=_[_0x2dc3('0x96')](_0x2c4c0b,function(_0x12a087){return!_0x379ec0[_0x2dc3('0x97')](_0x12a087[_0x2dc3('0x98')]);});var _0x15f478=[];var _0x3c29ba=[];_0x2c4c0b[_0x2dc3('0x99')](function(_0x4e76d4){if(_0x4e76d4[_0x2dc3('0x9a')]){var _0xc78573=_0x4e76d4['@odata.type']['substring'](_0x4e76d4['@odata.type']['lastIndexOf']('.')+0x1);if(_0xc78573===_0x2dc3('0x9b')){_0x15f478[_0x2dc3('0x9c')](getSelectList(_0x5c8ff5,_0x5231b2,_0x3c29ba,_0x1ea5ac[_0x2dc3('0x91')],_0x4e76d4[_0x2dc3('0x91')],_0xcc33b0));}}});return Promise['all'](_0x15f478);})[_0x2dc3('0xe')](function(_0x2ab4e8){_0x33b182=_0x2ab4e8[0x0];var _0x1936c5=[];var _0x18dc21=[];_0x2c4c0b['forEach'](function(_0x56233b){if(!_[_0x2dc3('0x9d')](_0x56233b[_0x2dc3('0x9a')])){var _0x389f84=_0x56233b['@odata.type'][_0x2dc3('0x40')](_0x56233b['@odata.type'][_0x2dc3('0x9e')]('.')+0x1);if(_0x389f84===_0x2dc3('0x9f')){_0x1936c5['push'](getBooleanList(_0x5c8ff5,_0x5231b2,_0x18dc21,_0x1ea5ac['MetadataId'],_0x56233b[_0x2dc3('0x91')],_0xcc33b0));}}});return Promise[_0x2dc3('0xa0')](_0x1936c5);})[_0x2dc3('0xe')](function(_0x267e09){_0x1a2191=_0x267e09[0x0];var _0x57656=[];var _0x47adcf=[];_0x2c4c0b[_0x2dc3('0x99')](function(_0x2b47a7){if(_0x2b47a7[_0x2dc3('0x9a')]){var _0x3392ec=_0x2b47a7[_0x2dc3('0x9a')][_0x2dc3('0x40')](_0x2b47a7[_0x2dc3('0x9a')]['lastIndexOf']('.')+0x1);if(_0x3392ec==='StringAttributeMetadata'||_0x3392ec==='DoubleAttributeMetadata'||_0x3392ec==='BigIntAttributeMetadata'||_0x3392ec===_0x2dc3('0xa1')||_0x3392ec===_0x2dc3('0xa2')||_0x3392ec===_0x2dc3('0xa3')||_0x3392ec===_0x2dc3('0xa4')||_0x3392ec===_0x2dc3('0xa5')||_0x3392ec===_0x2dc3('0xa6')||_0x3392ec==='DecimalAttributeMetadata'){_0x57656['push'](getInputList(_0x5c8ff5,_0x5231b2,_0x3392ec,_0x47adcf,_0x1ea5ac[_0x2dc3('0x91')],_0x2b47a7['MetadataId'],_0xcc33b0));}}});return Promise[_0x2dc3('0xa0')](_0x57656);})['then'](function(_0x1705c5){_0xbb9d35=_0x1705c5[0x0];var _0x2b5dff=_0x33b182[_0x2dc3('0x83')](_0x1a2191)[_0x2dc3('0x83')](_0xbb9d35);var _0x1c2542={'count':_0x2b5dff[_0x2dc3('0x2f')],'rows':_0x2b5dff};return _0x1c2542;})[_0x2dc3('0xe')](respondWithResult(_0x27d4dc,null))['catch'](function(_0x4f6ba7){var _0x56c62d=_0x2ae1d5[_0x2dc3('0x1d')][_0x2dc3('0xa7')]?0x1f4:_0x4f6ba7[_0x2dc3('0xa8')]||0x1f4;logger[_0x2dc3('0x12')](_0x4f6ba7[_0x2dc3('0xa9')]);delete _0x4f6ba7['name'];if(_0x56c62d===0x191){_0x56c62d=0x190;}_0x27d4dc[_0x2dc3('0x6')](_0x56c62d)[_0x2dc3('0xaa')](_0x2ae1d5['query'][_0x2dc3('0xa7')]?{'message':'Wrong\x20credentials','statusCode':_0x4f6ba7[_0x2dc3('0xa8')]}:_0x4f6ba7);});};function getSelectList(_0x1a1ef0,_0x2b39d4,_0x3880a9,_0x38b934,_0x1cd8a9,_0x427f6f){var _0x32ae01={'method':'GET','uri':_0x1a1ef0+_0x2dc3('0x93')+_0x38b934+_0x2dc3('0xab')+_0x1cd8a9+_0x2dc3('0xac')+_0x2dc3('0xad'),'headers':{'Authorization':_0x2dc3('0x90')+_0x427f6f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x32ae01)[_0x2dc3('0xe')](function(_0x49c6ea){var _0x50cfb4=[];var _0x1f2d60=_0x49c6ea['OptionSet'][_0x2dc3('0xae')];_0x1f2d60[_0x2dc3('0x99')](function(_0x34e808){_0x50cfb4[_0x2dc3('0x9c')]({'name':_0x34e808[_0x2dc3('0xaf')]['UserLocalizedLabel'][_0x2dc3('0xaf')],'value':String(_0x34e808['Value'])});});var _0x48af={'id':_0x2b39d4+'_'+_0x49c6ea[_0x2dc3('0x98')],'name':_0x49c6ea[_0x2dc3('0xb0')][_0x2dc3('0xb1')][_0x2dc3('0xaf')],'custom':![],'options':_0x50cfb4};_0x3880a9['push'](_0x48af);return _0x3880a9;});}function getBooleanList(_0x260ba0,_0x29838c,_0xa6d6b0,_0x4fcb77,_0x1efb06,_0x61b668){var _0x3a809f={'method':'GET','uri':_0x260ba0+_0x2dc3('0x93')+_0x4fcb77+_0x2dc3('0xab')+_0x1efb06+_0x2dc3('0xb2'),'headers':{'Authorization':_0x2dc3('0x90')+_0x61b668,'If-None-Match':null,'OData-Version':_0x2dc3('0x94')},'json':!![]};return rp(_0x3a809f)[_0x2dc3('0xe')](function(_0xed233){var _0x375d76=[];_0x375d76['push']({'name':_0xed233[_0x2dc3('0xb3')]['TrueOption'][_0x2dc3('0xaf')]['UserLocalizedLabel'][_0x2dc3('0xaf')],'value':_0x2dc3('0xb4')},{'name':_0xed233[_0x2dc3('0xb3')][_0x2dc3('0xb5')][_0x2dc3('0xaf')]['UserLocalizedLabel'][_0x2dc3('0xaf')],'value':_0x2dc3('0xb6')});var _0x3459db={'id':_0x29838c+'_'+_0xed233[_0x2dc3('0x98')],'name':_0xed233[_0x2dc3('0xb0')][_0x2dc3('0xb1')][_0x2dc3('0xaf')],'custom':![],'options':_0x375d76};_0xa6d6b0[_0x2dc3('0x9c')](_0x3459db);return _0xa6d6b0;});}function getInputList(_0x491e62,_0x1faf8d,_0x152566,_0x505d7a,_0x39599f,_0x368b56,_0xcb54ae){var _0x4b2b71={'method':_0x2dc3('0x92'),'uri':_0x491e62+_0x2dc3('0x93')+_0x39599f+_0x2dc3('0xab')+_0x368b56+_0x2dc3('0xb7')+_0x152566+_0x2dc3('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0xcb54ae,'If-None-Match':null,'OData-Version':_0x2dc3('0x94')},'json':!![]};return rp(_0x4b2b71)[_0x2dc3('0xe')](function(_0x173c16){var _0x13c004={'id':_0x1faf8d+'_'+_0x173c16['LogicalName'],'name':_0x173c16[_0x2dc3('0xb0')][_0x2dc3('0xb1')]?_0x173c16[_0x2dc3('0xb0')][_0x2dc3('0xb1')]['Label']:_0x173c16[_0x2dc3('0x98')],'custom':![],'options':[]};_0x505d7a[_0x2dc3('0x9c')](_0x13c004);return _0x505d7a;});} \ No newline at end of file +var _0x1a5c=['contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','clientId','modernAuthentication','CloudProvider','data7','access_token','data5','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x1a5c[_0x9aada2];return _0x196dff;};'use strict';var rp=require(_0xc1a5('0x0'));var util=require(_0xc1a5('0x1'));var _=require(_0xc1a5('0x2'));var qs=require(_0xc1a5('0x3'));var logger=require(_0xc1a5('0x4'))(_0xc1a5('0x5'));var db=require(_0xc1a5('0x6'))['db'];var integrations=require(_0xc1a5('0x7'));function respondWithResult(_0x2b324b,_0x22243f){_0x22243f=_0x22243f||0xc8;return function(_0x49e60b){if(_0x49e60b){return _0x2b324b[_0xc1a5('0x8')](_0x22243f)[_0xc1a5('0x9')](_0x49e60b);}};}function respondWithFilteredResult(_0x411612,_0x510cf3){return function(_0x555a0){if(_0x555a0){var _0x1cf3d7=typeof _0x510cf3[_0xc1a5('0xa')]===_0xc1a5('0xb')&&typeof _0x510cf3['limit']===_0xc1a5('0xb');var _0x7167aa=_0x555a0['count'];var _0x176448=_0x1cf3d7?0x0:_0x510cf3['offset'];var _0x536121=_0x1cf3d7?_0x555a0[_0xc1a5('0xc')]:_0x510cf3[_0xc1a5('0xa')]+_0x510cf3['limit'];var _0x14ac4a;if(_0x536121>=_0x7167aa){_0x536121=_0x7167aa;_0x14ac4a=0xc8;}else{_0x14ac4a=0xce;}_0x411612[_0xc1a5('0x8')](_0x14ac4a);return _0x411612[_0xc1a5('0xd')](_0xc1a5('0xe'),_0x176448+'-'+_0x536121+'/'+_0x7167aa)[_0xc1a5('0x9')](_0x555a0);}return null;};}function saveUpdates(_0x52fe6d){return function(_0x428ccf){if(_0x428ccf){return _0x428ccf[_0xc1a5('0xf')](_0x52fe6d)[_0xc1a5('0x10')](function(_0x3a0b8e){return _0x3a0b8e;});}return null;};}function removeEntity(_0x1aec58){return function(_0x1dabb5){if(_0x1dabb5){return _0x1dabb5[_0xc1a5('0x11')]()[_0xc1a5('0x10')](function(){_0x1aec58[_0xc1a5('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2590){return function(_0x1b2cfb){if(!_0x1b2cfb){_0x4b2590[_0xc1a5('0x12')](0x194);}return _0x1b2cfb;};}function handleError(_0x677442,_0x57d474){_0x57d474=_0x57d474||0x1f4;return function(_0x1f23c4){logger[_0xc1a5('0x13')](_0x1f23c4[_0xc1a5('0x14')]);if(_0x1f23c4['name']){delete _0x1f23c4[_0xc1a5('0x15')];}_0x677442['status'](_0x57d474)[_0xc1a5('0x16')](_0x1f23c4);};}exports[_0xc1a5('0x17')]=function(_0x367191,_0x5d73a7){var _0xcbdda5={},_0xbccfb9={},_0x307e5c={'count':0x0,'rows':[]};var _0x4591df=_[_0xc1a5('0x18')](db[_0xc1a5('0x19')][_0xc1a5('0x1a')],function(_0x267ee0){return{'name':_0x267ee0[_0xc1a5('0x1b')],'type':_0x267ee0[_0xc1a5('0x1c')]['key']};});_0xbccfb9[_0xc1a5('0x1d')]=_[_0xc1a5('0x18')](_0x4591df,'name');_0xbccfb9[_0xc1a5('0x1e')]=_[_0xc1a5('0x1f')](_0x367191[_0xc1a5('0x1e')]);_0xbccfb9[_0xc1a5('0x20')]=_[_0xc1a5('0x21')](_0xbccfb9[_0xc1a5('0x1d')],_0xbccfb9[_0xc1a5('0x1e')]);_0xcbdda5[_0xc1a5('0x22')]=_['intersection'](_0xbccfb9['model'],qs[_0xc1a5('0x23')](_0x367191[_0xc1a5('0x1e')][_0xc1a5('0x23')]));_0xcbdda5['attributes']=_0xcbdda5[_0xc1a5('0x22')]['length']?_0xcbdda5['attributes']:_0xbccfb9[_0xc1a5('0x1d')];if(!_0x367191[_0xc1a5('0x1e')][_0xc1a5('0x24')](_0xc1a5('0x25'))){_0xcbdda5['limit']=qs['limit'](_0x367191['query'][_0xc1a5('0x26')]);_0xcbdda5['offset']=qs[_0xc1a5('0xa')](_0x367191['query'][_0xc1a5('0xa')]);}_0xcbdda5[_0xc1a5('0x27')]=qs[_0xc1a5('0x28')](_0x367191[_0xc1a5('0x1e')]['sort']);_0xcbdda5['where']=qs[_0xc1a5('0x20')](_['pick'](_0x367191[_0xc1a5('0x1e')],_0xbccfb9[_0xc1a5('0x20')]),_0x4591df);if(_0x367191[_0xc1a5('0x1e')][_0xc1a5('0x29')]){_0xcbdda5['where']=_['merge'](_0xcbdda5[_0xc1a5('0x2a')],{'$or':_[_0xc1a5('0x18')](_0x4591df,function(_0x34e61b){if(_0x34e61b[_0xc1a5('0x1c')]!==_0xc1a5('0x2b')){var _0x12e3dc={};_0x12e3dc[_0x34e61b[_0xc1a5('0x15')]]={'$like':'%'+_0x367191[_0xc1a5('0x1e')][_0xc1a5('0x29')]+'%'};return _0x12e3dc;}})});}_0xcbdda5=_[_0xc1a5('0x2c')]({},_0xcbdda5,_0x367191[_0xc1a5('0x2d')]);var _0x42cfb2={'where':_0xcbdda5[_0xc1a5('0x2a')]};return db[_0xc1a5('0x19')]['count'](_0x42cfb2)[_0xc1a5('0x10')](function(_0x187803){_0x307e5c[_0xc1a5('0xc')]=_0x187803;if(_0x367191[_0xc1a5('0x1e')][_0xc1a5('0x2e')]){_0xcbdda5[_0xc1a5('0x2f')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xc1a5('0x30')](_0xcbdda5);})[_0xc1a5('0x10')](function(_0x1f5b51){_0x307e5c[_0xc1a5('0x31')]=_0x1f5b51;return _0x307e5c;})['then'](respondWithFilteredResult(_0x5d73a7,_0xcbdda5))[_0xc1a5('0x32')](handleError(_0x5d73a7,null));};exports[_0xc1a5('0x33')]=function(_0x2bca57,_0x4d76b5){var _0x4dc1e1={'raw':![],'where':{'id':_0x2bca57[_0xc1a5('0x34')]['id']}},_0x3329f0={};_0x3329f0['model']=_[_0xc1a5('0x1f')](db['Dynamics365Account']['rawAttributes']);_0x3329f0[_0xc1a5('0x1e')]=_[_0xc1a5('0x1f')](_0x2bca57[_0xc1a5('0x1e')]);_0x3329f0[_0xc1a5('0x20')]=_[_0xc1a5('0x21')](_0x3329f0['model'],_0x3329f0[_0xc1a5('0x1e')]);_0x4dc1e1[_0xc1a5('0x22')]=_[_0xc1a5('0x21')](_0x3329f0[_0xc1a5('0x1d')],qs['fields'](_0x2bca57[_0xc1a5('0x1e')][_0xc1a5('0x23')]));_0x4dc1e1[_0xc1a5('0x22')]=_0x4dc1e1[_0xc1a5('0x22')][_0xc1a5('0x35')]?_0x4dc1e1[_0xc1a5('0x22')]:_0x3329f0[_0xc1a5('0x1d')];if(_0x2bca57['query']['includeAll']){_0x4dc1e1[_0xc1a5('0x2f')]=[{'all':!![]}];}_0x4dc1e1=_[_0xc1a5('0x2c')]({},_0x4dc1e1,_0x2bca57[_0xc1a5('0x2d')]);return db[_0xc1a5('0x19')][_0xc1a5('0x36')](_0x4dc1e1)[_0xc1a5('0x10')](handleEntityNotFound(_0x4d76b5,null))[_0xc1a5('0x10')](respondWithResult(_0x4d76b5,null))[_0xc1a5('0x32')](handleError(_0x4d76b5,null));};exports['create']=function(_0x5bb9e5,_0x5a70a9){return db['Dynamics365Account'][_0xc1a5('0x37')](_0x5bb9e5[_0xc1a5('0x38')],{})[_0xc1a5('0x10')](respondWithResult(_0x5a70a9,0xc9))['catch'](handleError(_0x5a70a9,null));};exports[_0xc1a5('0xf')]=function(_0x5b9b16,_0x4abc59){if(_0x5b9b16['body']['id']){delete _0x5b9b16[_0xc1a5('0x38')]['id'];}return db[_0xc1a5('0x19')][_0xc1a5('0x36')]({'where':{'id':_0x5b9b16[_0xc1a5('0x34')]['id']}})[_0xc1a5('0x10')](handleEntityNotFound(_0x4abc59,null))[_0xc1a5('0x10')](saveUpdates(_0x5b9b16['body'],null))[_0xc1a5('0x10')](respondWithResult(_0x4abc59,null))[_0xc1a5('0x32')](handleError(_0x4abc59,null));};exports[_0xc1a5('0x11')]=function(_0xf10b3e,_0x1446d2){return db[_0xc1a5('0x19')]['find']({'where':{'id':_0xf10b3e[_0xc1a5('0x34')]['id']}})[_0xc1a5('0x10')](handleEntityNotFound(_0x1446d2,null))[_0xc1a5('0x10')](removeEntity(_0x1446d2,null))[_0xc1a5('0x32')](handleError(_0x1446d2,null));};exports['getConfigurations']=function(_0x5df3f6,_0x45abc1){var _0x4d04c4={};var _0x5d4336={};var _0x3aece1;var _0x15ef4e;return db['Dynamics365Account'][_0xc1a5('0x39')]({'where':{'id':_0x5df3f6[_0xc1a5('0x34')]['id']}})['then'](handleEntityNotFound(_0x45abc1,null))[_0xc1a5('0x10')](function(_0x509d44){if(_0x509d44){_0x3aece1=_0x509d44;_0x5d4336[_0xc1a5('0x1d')]=_[_0xc1a5('0x1f')](db['Dynamics365Configuration'][_0xc1a5('0x1a')]);_0x5d4336[_0xc1a5('0x1e')]=_[_0xc1a5('0x1f')](_0x5df3f6[_0xc1a5('0x1e')]);_0x5d4336[_0xc1a5('0x20')]=_[_0xc1a5('0x21')](_0x5d4336[_0xc1a5('0x1d')],_0x5d4336['query']);_0x4d04c4[_0xc1a5('0x22')]=_[_0xc1a5('0x21')](_0x5d4336[_0xc1a5('0x1d')],qs[_0xc1a5('0x23')](_0x5df3f6[_0xc1a5('0x1e')][_0xc1a5('0x23')]));_0x4d04c4['attributes']=_0x4d04c4[_0xc1a5('0x22')][_0xc1a5('0x35')]?_0x4d04c4['attributes']:_0x5d4336[_0xc1a5('0x1d')];_0x4d04c4[_0xc1a5('0x27')]=qs['sort'](_0x5df3f6[_0xc1a5('0x1e')][_0xc1a5('0x28')]);_0x4d04c4['where']=qs[_0xc1a5('0x20')](_[_0xc1a5('0x3a')](_0x5df3f6[_0xc1a5('0x1e')],_0x5d4336[_0xc1a5('0x20')]));if(_0x5df3f6[_0xc1a5('0x1e')][_0xc1a5('0x29')]){_0x4d04c4[_0xc1a5('0x2a')]=_['merge'](_0x4d04c4[_0xc1a5('0x2a')],{'$or':_[_0xc1a5('0x18')](_0x4d04c4[_0xc1a5('0x22')],function(_0x5d836f){var _0x263ccf={};_0x263ccf[_0x5d836f]={'$like':'%'+_0x5df3f6[_0xc1a5('0x1e')]['filter']+'%'};return _0x263ccf;})});}_0x4d04c4=_[_0xc1a5('0x2c')]({},_0x4d04c4,_0x5df3f6[_0xc1a5('0x2d')]);return _0x3aece1['getConfigurations'](_0x4d04c4);}})[_0xc1a5('0x10')](function(_0x52703c){if(_0x52703c){_0x15ef4e=_0x52703c[_0xc1a5('0x35')];if(!_0x5df3f6[_0xc1a5('0x1e')][_0xc1a5('0x24')](_0xc1a5('0x25'))){_0x4d04c4[_0xc1a5('0x26')]=qs[_0xc1a5('0x26')](_0x5df3f6[_0xc1a5('0x1e')]['limit']);_0x4d04c4['offset']=qs['offset'](_0x5df3f6[_0xc1a5('0x1e')][_0xc1a5('0xa')]);}return _0x3aece1[_0xc1a5('0x3b')](_0x4d04c4);}})['then'](function(_0x211a96){if(_0x211a96){return _0x211a96?{'count':_0x15ef4e,'rows':_0x211a96}:null;}})['then'](respondWithResult(_0x45abc1,null))['catch'](handleError(_0x45abc1,null));};exports['addConfiguration']=function(_0x53695d,_0x2a2a24){if(_0x53695d[_0xc1a5('0x38')]['id']){delete _0x53695d[_0xc1a5('0x38')]['id'];}return db[_0xc1a5('0x19')][_0xc1a5('0x39')]({'where':{'id':_0x53695d[_0xc1a5('0x34')]['id']}})[_0xc1a5('0x10')](handleEntityNotFound(_0x2a2a24,null))['then'](function(_0x19f4a2){if(_0x19f4a2){_0x53695d[_0xc1a5('0x38')][_0xc1a5('0x3c')]=_0x19f4a2['id'];_0x53695d[_0xc1a5('0x38')][_0xc1a5('0x3d')]=integrations[_0xc1a5('0x3e')](_0x53695d[_0xc1a5('0x38')][_0xc1a5('0x3f')],_0x53695d[_0xc1a5('0x38')][_0xc1a5('0x1c')]);_0x53695d[_0xc1a5('0x38')][_0xc1a5('0x40')]=integrations['getDescriptions'](_0x53695d[_0xc1a5('0x38')]['channel'],_0x53695d[_0xc1a5('0x38')]['type']);return db['Dynamics365Configuration']['create'](_0x53695d[_0xc1a5('0x38')],{'include':[{'model':db['Dynamics365Field'],'as':_0xc1a5('0x3d')},{'model':db[_0xc1a5('0x41')],'as':_0xc1a5('0x40')}]});}return null;})[_0xc1a5('0x10')](respondWithResult(_0x2a2a24,null))['catch'](handleError(_0x2a2a24,null));};function sanitizeRemoteUri(_0x210667){var _0x3ee2e4=_0x210667[_0xc1a5('0x42')](-0x1);if(_0x3ee2e4==='/')return _0x210667[_0xc1a5('0x43')](0x0,_0x210667['lastIndexOf'](_0x3ee2e4));return _0x210667;}function getWebApiUrl(_0x475f28){return util['format'](_0xc1a5('0x44'),_0x475f28);}exports[_0xc1a5('0x45')]=function(_0x147b70,_0x29a1f2){var _0x2307b4=_0x147b70[_0xc1a5('0x1e')][_0xc1a5('0x46')];var _0x49784b=_0x2307b4===_0xc1a5('0x47')?_0xc1a5('0x48'):_0xc1a5('0x49');var _0x2d3210='';var _0x45f641='';var _0x6afb0b='';var _0x231f4b='';var _0x542625='';var _0x414155='';var _0x23bbf='';var _0x6ef665='';var _0x1459fa=[_0xc1a5('0x4a'),_0xc1a5('0x4b'),_0xc1a5('0x4c'),_0xc1a5('0x4d'),_0xc1a5('0x4e'),_0xc1a5('0x4f'),_0xc1a5('0x50'),_0xc1a5('0x51'),_0xc1a5('0x52'),_0xc1a5('0x53')];var _0x2cf9ca=[_0xc1a5('0x54'),_0xc1a5('0x55'),_0xc1a5('0x56'),_0xc1a5('0x57'),_0xc1a5('0x58'),_0xc1a5('0x59'),_0xc1a5('0x5a'),'contractidname',_0xc1a5('0x5b'),_0xc1a5('0x5c'),_0xc1a5('0x5d'),_0xc1a5('0x5e'),'createdon',_0xc1a5('0x5f'),_0xc1a5('0x60'),_0xc1a5('0x61'),_0xc1a5('0x62'),_0xc1a5('0x63'),_0xc1a5('0x64'),_0xc1a5('0x65'),_0xc1a5('0x66'),'entityimage_url',_0xc1a5('0x67'),'exchangerate',_0xc1a5('0x68'),_0xc1a5('0x69'),_0xc1a5('0x6a'),_0xc1a5('0x6b'),'kbarticleidname','lastonholdtime',_0xc1a5('0x6c'),_0xc1a5('0x6d'),_0xc1a5('0x6e'),_0xc1a5('0x6f'),'modifiedbyyominame',_0xc1a5('0x70'),_0xc1a5('0x71'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xc1a5('0x72'),'numberofchildincidents',_0xc1a5('0x73'),_0xc1a5('0x74'),_0xc1a5('0x75'),_0xc1a5('0x76'),_0xc1a5('0x77'),_0xc1a5('0x78'),_0xc1a5('0x79'),_0xc1a5('0x7a'),_0xc1a5('0x7b'),'productidname',_0xc1a5('0x7c'),'resolveby',_0xc1a5('0x7d'),_0xc1a5('0x7e'),_0xc1a5('0x7f'),'responsiblecontactidyominame',_0xc1a5('0x80'),'slainvokedidname',_0xc1a5('0x81'),_0xc1a5('0x82'),_0xc1a5('0x83'),_0xc1a5('0x84'),_0xc1a5('0x85'),'ticketnumber',_0xc1a5('0x86'),_0xc1a5('0x87'),_0xc1a5('0x88'),_0xc1a5('0x89'),_0xc1a5('0x8a')];var _0x59d009=_0x1459fa[_0xc1a5('0x8b')](_0x2cf9ca);return db['Dynamics365Account'][_0xc1a5('0x39')]({'where':{'id':_0x147b70[_0xc1a5('0x34')]['id']},'attributes':['id','username',_0xc1a5('0x8c'),'remoteUri','tenantId',_0xc1a5('0x8d'),'clientSecret',_0xc1a5('0x8e')],'include':[{'model':db[_0xc1a5('0x8f')],'as':_0xc1a5('0x8f'),'attributes':['id','data5',_0xc1a5('0x90')]}]})['then'](handleEntityNotFound(_0x29a1f2,null))[_0xc1a5('0x10')](function(_0x1e7789){if(_0x1e7789){if(_0x1e7789[_0xc1a5('0x8e')]){_0x1e7789[_0xc1a5('0x91')]=_0x1e7789[_0xc1a5('0x8f')][_0xc1a5('0x92')];_0x6ef665=sanitizeRemoteUri(_0x1e7789[_0xc1a5('0x8f')][_0xc1a5('0x90')]);_0x23bbf=getWebApiUrl(_0x6ef665);return _0x1e7789;}_0x6ef665=sanitizeRemoteUri(_0x1e7789[_0xc1a5('0x93')]);_0x23bbf=getWebApiUrl(_0x6ef665);var _0xf86f6e={'method':_0xc1a5('0x94'),'uri':_0xc1a5('0x95')+_0x1e7789['tenantId']+_0xc1a5('0x96'),'form':{'client_id':_0x1e7789[_0xc1a5('0x8d')],'resource':_0x6ef665,'username':_0x1e7789['username'],'password':_0x1e7789[_0xc1a5('0x8c')],'grant_type':_0xc1a5('0x8c'),'client_secret':_0x1e7789[_0xc1a5('0x97')]},'json':!![]};return rp(_0xf86f6e);}})[_0xc1a5('0x10')](function(_0x2b9701){_0x414155=_0x2b9701['access_token'];var _0x120515={'method':_0xc1a5('0x98'),'uri':encodeURI(_0x23bbf+_0xc1a5('0x99')+_0x49784b+'\x27'),'headers':{'Authorization':_0xc1a5('0x9a')+_0x414155,'If-None-Match':null,'OData-Version':_0xc1a5('0x9b')},'json':!![]};return rp(_0x120515);})[_0xc1a5('0x10')](function(_0x37d344){var _0x45d608=_0x37d344[_0xc1a5('0x9c')][0x0];var _0x1efd89=_0x45d608[_0xc1a5('0x9d')];var _0x324a31={'method':'GET','uri':_0x23bbf+_0xc1a5('0x9e')+_0x1efd89+_0xc1a5('0x9f'),'headers':{'Authorization':'Bearer\x20'+_0x414155,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x324a31);})[_0xc1a5('0x10')](function(_0x13030b){_0x2d3210=_0x13030b;_0x45f641=_0x2d3210[_0xc1a5('0xa0')];_0x45f641=_[_0xc1a5('0xa1')](_0x45f641,function(_0x42375d){return!_0x59d009['includes'](_0x42375d[_0xc1a5('0xa2')]);});var _0x8f8329=[];var _0x2cccaf=[];_0x45f641[_0xc1a5('0xa3')](function(_0x4da9e3){if(_0x4da9e3['@odata.type']){var _0x1f8bb0=_0x4da9e3[_0xc1a5('0xa4')]['substring'](_0x4da9e3[_0xc1a5('0xa4')][_0xc1a5('0xa5')]('.')+0x1);if(_0x1f8bb0===_0xc1a5('0xa6')){_0x8f8329['push'](getSelectList(_0x23bbf,_0x2307b4,_0x2cccaf,_0x2d3210['MetadataId'],_0x4da9e3[_0xc1a5('0x9d')],_0x414155));}}});return Promise[_0xc1a5('0xa7')](_0x8f8329);})[_0xc1a5('0x10')](function(_0x2c80ab){_0x6afb0b=_0x2c80ab[0x0];var _0x3fba3e=[];var _0x4d4606=[];_0x45f641['forEach'](function(_0x400da1){if(!_[_0xc1a5('0xa8')](_0x400da1[_0xc1a5('0xa4')])){var _0x377c48=_0x400da1[_0xc1a5('0xa4')][_0xc1a5('0x43')](_0x400da1[_0xc1a5('0xa4')][_0xc1a5('0xa5')]('.')+0x1);if(_0x377c48==='BooleanAttributeMetadata'){_0x3fba3e[_0xc1a5('0xa9')](getBooleanList(_0x23bbf,_0x2307b4,_0x4d4606,_0x2d3210[_0xc1a5('0x9d')],_0x400da1['MetadataId'],_0x414155));}}});return Promise[_0xc1a5('0xa7')](_0x3fba3e);})['then'](function(_0x4c70b4){_0x231f4b=_0x4c70b4[0x0];var _0x47c853=[];var _0x4a4ee5=[];_0x45f641[_0xc1a5('0xa3')](function(_0x1fd339){if(_0x1fd339[_0xc1a5('0xa4')]){var _0x10ab16=_0x1fd339[_0xc1a5('0xa4')][_0xc1a5('0x43')](_0x1fd339[_0xc1a5('0xa4')][_0xc1a5('0xa5')]('.')+0x1);if(_0x10ab16===_0xc1a5('0xaa')||_0x10ab16===_0xc1a5('0xab')||_0x10ab16===_0xc1a5('0xac')||_0x10ab16==='IntegerAttributeMetadata'||_0x10ab16==='MemoAttributeMetadata'||_0x10ab16===_0xc1a5('0xad')||_0x10ab16==='StatusAttributeMetadata'||_0x10ab16===_0xc1a5('0xae')||_0x10ab16===_0xc1a5('0xaf')||_0x10ab16===_0xc1a5('0xb0')){_0x47c853['push'](getInputList(_0x23bbf,_0x2307b4,_0x10ab16,_0x4a4ee5,_0x2d3210[_0xc1a5('0x9d')],_0x1fd339[_0xc1a5('0x9d')],_0x414155));}}});return Promise[_0xc1a5('0xa7')](_0x47c853);})[_0xc1a5('0x10')](function(_0x359e22){_0x542625=_0x359e22[0x0];var _0x3cd73f=_0x6afb0b[_0xc1a5('0x8b')](_0x231f4b)['concat'](_0x542625);var _0x402e52={'count':_0x3cd73f[_0xc1a5('0x35')],'rows':_0x3cd73f};return _0x402e52;})[_0xc1a5('0x10')](respondWithResult(_0x29a1f2,null))[_0xc1a5('0x32')](function(_0x35fd06){var _0x455591=_0x147b70[_0xc1a5('0x1e')][_0xc1a5('0xb1')]?0x1f4:_0x35fd06['statusCode']||0x1f4;logger['error'](_0x35fd06[_0xc1a5('0x14')]);delete _0x35fd06[_0xc1a5('0x15')];if(_0x455591===0x191){_0x455591=0x190;}_0x29a1f2[_0xc1a5('0x8')](_0x455591)[_0xc1a5('0x16')](_0x147b70[_0xc1a5('0x1e')][_0xc1a5('0xb1')]?{'message':_0xc1a5('0xb2'),'statusCode':_0x35fd06['statusCode']}:_0x35fd06);});};function getSelectList(_0x10c010,_0x2515b8,_0x2cb6d9,_0x1edfaa,_0x50ee80,_0x224da2){var _0x27bf88={'method':_0xc1a5('0x98'),'uri':_0x10c010+'EntityDefinitions('+_0x1edfaa+')/Attributes('+_0x50ee80+_0xc1a5('0xb3')+_0xc1a5('0xb4'),'headers':{'Authorization':_0xc1a5('0x9a')+_0x224da2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x27bf88)[_0xc1a5('0x10')](function(_0x301d4f){var _0x463012=[];var _0x4c197c=_0x301d4f[_0xc1a5('0xb5')][_0xc1a5('0xb6')];_0x4c197c['forEach'](function(_0x3ea80b){_0x463012['push']({'name':_0x3ea80b[_0xc1a5('0xb7')][_0xc1a5('0xb8')][_0xc1a5('0xb7')],'value':String(_0x3ea80b[_0xc1a5('0xb9')])});});var _0x31600e={'id':_0x2515b8+'_'+_0x301d4f[_0xc1a5('0xa2')],'name':_0x301d4f[_0xc1a5('0xba')][_0xc1a5('0xb8')][_0xc1a5('0xb7')],'custom':![],'options':_0x463012};_0x2cb6d9['push'](_0x31600e);return _0x2cb6d9;});}function getBooleanList(_0x55b4eb,_0x231b16,_0x4d4549,_0xe647a0,_0xe2e51f,_0x106414){var _0x4665e2={'method':_0xc1a5('0x98'),'uri':_0x55b4eb+_0xc1a5('0x9e')+_0xe647a0+')/Attributes('+_0xe2e51f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc1a5('0x9a')+_0x106414,'If-None-Match':null,'OData-Version':_0xc1a5('0x9b')},'json':!![]};return rp(_0x4665e2)[_0xc1a5('0x10')](function(_0x34d9f2){var _0x2a1f28=[];_0x2a1f28[_0xc1a5('0xa9')]({'name':_0x34d9f2['OptionSet'][_0xc1a5('0xbb')][_0xc1a5('0xb7')][_0xc1a5('0xb8')][_0xc1a5('0xb7')],'value':_0xc1a5('0xbc')},{'name':_0x34d9f2['OptionSet'][_0xc1a5('0xbd')]['Label'][_0xc1a5('0xb8')]['Label'],'value':_0xc1a5('0xbe')});var _0x3e58c6={'id':_0x231b16+'_'+_0x34d9f2[_0xc1a5('0xa2')],'name':_0x34d9f2[_0xc1a5('0xba')][_0xc1a5('0xb8')]['Label'],'custom':![],'options':_0x2a1f28};_0x4d4549['push'](_0x3e58c6);return _0x4d4549;});}function getInputList(_0x383d21,_0xd1be6b,_0x5c1aa5,_0x233dad,_0x1a6468,_0x1884b1,_0x4a3716){var _0x44ca32={'method':'GET','uri':_0x383d21+_0xc1a5('0x9e')+_0x1a6468+_0xc1a5('0xbf')+_0x1884b1+_0xc1a5('0xc0')+_0x5c1aa5+_0xc1a5('0xc1'),'headers':{'Authorization':_0xc1a5('0x9a')+_0x4a3716,'If-None-Match':null,'OData-Version':_0xc1a5('0x9b')},'json':!![]};return rp(_0x44ca32)['then'](function(_0x3fe345){var _0x5893f8={'id':_0xd1be6b+'_'+_0x3fe345['LogicalName'],'name':_0x3fe345[_0xc1a5('0xba')][_0xc1a5('0xb8')]?_0x3fe345['DisplayName'][_0xc1a5('0xb8')][_0xc1a5('0xb7')]:_0x3fe345['LogicalName'],'custom':![],'options':[]};_0x233dad[_0xc1a5('0xa9')](_0x5893f8);return _0x233dad;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5b89773..a4d8e17 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x43b7b0,_0x565978){var _0x2b4f6e=function(_0x466532){while(--_0x466532){_0x43b7b0['push'](_0x43b7b0['shift']());}};_0x2b4f6e(++_0x565978);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2e6b8d3..1a59892 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 _0x55fe=['find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','GetDynamics365Account','catch','ShowDynamics365Account'];(function(_0x10766f,_0x107f8c){var _0x404f0e=function(_0x2c2a14){while(--_0x2c2a14){_0x10766f['push'](_0x10766f['shift']());}};_0x404f0e(++_0x107f8c);}(_0x55fe,0xab));var _0xe55f=function(_0x5824c6,_0x1636ad){_0x5824c6=_0x5824c6-0x0;var _0x292da2=_0x55fe[_0x5824c6];return _0x292da2;};'use strict';var _=require(_0xe55f('0x0'));var util=require(_0xe55f('0x1'));var moment=require(_0xe55f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe55f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe55f('0x4'));var logger=require(_0xe55f('0x5'))(_0xe55f('0x6'));var config=require(_0xe55f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe55f('0x8')][_0xe55f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44e198,_0x3f1188,_0x19a01d){return new BPromise(function(_0x5e21ad,_0x4b9201){return client[_0xe55f('0xa')](_0x44e198,_0x19a01d)[_0xe55f('0xb')](function(_0x500350){logger[_0xe55f('0xc')](_0xe55f('0xd'),_0x3f1188,_0xe55f('0xe'));logger[_0xe55f('0xf')](_0xe55f('0x10'),_0x3f1188,'request\x20sent',JSON[_0xe55f('0x11')](_0x500350));if(_0x500350[_0xe55f('0x12')]){if(_0x500350[_0xe55f('0x12')]['code']===0x1f4){logger[_0xe55f('0x12')](_0xe55f('0xd'),_0x3f1188,_0x500350[_0xe55f('0x12')][_0xe55f('0x13')]);return _0x4b9201(_0x500350[_0xe55f('0x12')][_0xe55f('0x13')]);}logger[_0xe55f('0x12')](_0xe55f('0xd'),_0x3f1188,_0x500350[_0xe55f('0x12')][_0xe55f('0x13')]);return _0x5e21ad(_0x500350[_0xe55f('0x12')]['message']);}else{logger[_0xe55f('0xc')](_0xe55f('0xd'),_0x3f1188,'request\x20sent');_0x5e21ad(_0x500350[_0xe55f('0x14')]['message']);}})['catch'](function(_0x256b17){logger[_0xe55f('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x3f1188,_0x256b17);_0x4b9201(_0x256b17);});});}exports['GetDynamics365Account']=function(_0x3591f1){var _0x4511c1=this;return new Promise(function(_0x577187,_0x3eb8f3){return db[_0xe55f('0x15')][_0xe55f('0x16')]({'raw':_0x3591f1[_0xe55f('0x17')]?_0x3591f1[_0xe55f('0x17')][_0xe55f('0x18')]===undefined?!![]:![]:!![],'where':_0x3591f1[_0xe55f('0x17')]?_0x3591f1[_0xe55f('0x17')]['where']||null:null,'attributes':_0x3591f1[_0xe55f('0x17')]?_0x3591f1[_0xe55f('0x17')][_0xe55f('0x19')]||null:null,'limit':_0x3591f1[_0xe55f('0x17')]?_0x3591f1['options'][_0xe55f('0x1a')]||null:null,'include':_0x3591f1['options']?_0x3591f1[_0xe55f('0x17')][_0xe55f('0x1b')]?_[_0xe55f('0x1c')](_0x3591f1['options'][_0xe55f('0x1b')],function(_0x16eb09){return{'model':db[_0x16eb09[_0xe55f('0x1d')]],'as':_0x16eb09['as'],'attributes':_0x16eb09[_0xe55f('0x19')],'include':_0x16eb09['include']?_[_0xe55f('0x1c')](_0x16eb09[_0xe55f('0x1b')],function(_0xa73ff0){return{'model':db[_0xa73ff0[_0xe55f('0x1d')]],'as':_0xa73ff0['as'],'attributes':_0xa73ff0[_0xe55f('0x19')],'include':_0xa73ff0['include']?_['map'](_0xa73ff0['include'],function(_0x467560){return{'model':db[_0x467560['model']],'as':_0x467560['as'],'attributes':_0x467560[_0xe55f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102f19){logger[_0xe55f('0xc')]('GetDynamics365Account',_0x3591f1);logger['debug'](_0xe55f('0x1e'),_0x3591f1,JSON[_0xe55f('0x11')](_0x102f19));_0x577187(_0x102f19);})[_0xe55f('0x1f')](function(_0x1e6543){logger[_0xe55f('0x12')](_0xe55f('0x1e'),_0x1e6543[_0xe55f('0x13')],_0x3591f1);_0x3eb8f3(_0x4511c1['error'](0x1f4,_0x1e6543['message']));});});};exports[_0xe55f('0x20')]=function(_0x1aacb5){var _0x456716=this;return new Promise(function(_0x34e18e,_0x2b8245){return db[_0xe55f('0x15')][_0xe55f('0x21')]({'raw':_0x1aacb5[_0xe55f('0x17')]?_0x1aacb5[_0xe55f('0x17')][_0xe55f('0x18')]===undefined?!![]:![]:!![],'where':_0x1aacb5[_0xe55f('0x17')]?_0x1aacb5[_0xe55f('0x17')]['where']||null:null,'attributes':_0x1aacb5[_0xe55f('0x17')]?_0x1aacb5[_0xe55f('0x17')][_0xe55f('0x19')]||null:null,'include':_0x1aacb5[_0xe55f('0x17')]?_0x1aacb5[_0xe55f('0x17')]['include']?_['map'](_0x1aacb5['options'][_0xe55f('0x1b')],function(_0x3f3f42){return{'model':db[_0x3f3f42['model']],'as':_0x3f3f42['as'],'attributes':_0x3f3f42[_0xe55f('0x19')],'include':_0x3f3f42[_0xe55f('0x1b')]?_[_0xe55f('0x1c')](_0x3f3f42[_0xe55f('0x1b')],function(_0x4e122b){return{'model':db[_0x4e122b[_0xe55f('0x1d')]],'as':_0x4e122b['as'],'attributes':_0x4e122b[_0xe55f('0x19')],'include':_0x4e122b[_0xe55f('0x1b')]?_['map'](_0x4e122b[_0xe55f('0x1b')],function(_0xd384a2){return{'model':db[_0xd384a2['model']],'as':_0xd384a2['as'],'attributes':_0xd384a2[_0xe55f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe55f('0xb')](function(_0x25c0f7){logger[_0xe55f('0xc')](_0xe55f('0x20'),_0x1aacb5);logger['debug']('ShowDynamics365Account',_0x1aacb5,JSON['stringify'](_0x25c0f7));_0x34e18e(_0x25c0f7);})['catch'](function(_0x55438c){logger[_0xe55f('0x12')](_0xe55f('0x20'),_0x55438c[_0xe55f('0x13')],_0x1aacb5);_0x2b8245(_0x456716[_0xe55f('0x12')](0x1f4,_0x55438c[_0xe55f('0x13')]));});});}; \ No newline at end of file +var _0xf2de=['info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','debug','stringify','ShowDynamics365Account','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x54d76c,_0x786783){var _0x3422e3=function(_0x3ce30f){while(--_0x3ce30f){_0x54d76c['push'](_0x54d76c['shift']());}};_0x3422e3(++_0x786783);}(_0xf2de,0x197));var _0xef2d=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xf2de[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef2d('0x0'));var BPromise=require(_0xef2d('0x1'));var rs=require(_0xef2d('0x2'));var fs=require('fs');var Redis=require(_0xef2d('0x3'));var db=require(_0xef2d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef2d('0x5'))(_0xef2d('0x6'));var config=require(_0xef2d('0x7'));var jayson=require(_0xef2d('0x8'));var client=jayson[_0xef2d('0x9')][_0xef2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37fad4,_0x28d0b2,_0x5bbebf){return new BPromise(function(_0x6b04f5,_0x36d10c){return client[_0xef2d('0xb')](_0x37fad4,_0x5bbebf)[_0xef2d('0xc')](function(_0x3f7c46){logger[_0xef2d('0xd')](_0xef2d('0xe'),_0x28d0b2,_0xef2d('0xf'));logger['debug'](_0xef2d('0x10'),_0x28d0b2,_0xef2d('0xf'),JSON['stringify'](_0x3f7c46));if(_0x3f7c46['error']){if(_0x3f7c46[_0xef2d('0x11')][_0xef2d('0x12')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x28d0b2,_0x3f7c46[_0xef2d('0x11')][_0xef2d('0x13')]);return _0x36d10c(_0x3f7c46['error'][_0xef2d('0x13')]);}logger[_0xef2d('0x11')](_0xef2d('0xe'),_0x28d0b2,_0x3f7c46[_0xef2d('0x11')]['message']);return _0x6b04f5(_0x3f7c46[_0xef2d('0x11')][_0xef2d('0x13')]);}else{logger[_0xef2d('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x28d0b2,_0xef2d('0xf'));_0x6b04f5(_0x3f7c46[_0xef2d('0x14')]['message']);}})[_0xef2d('0x15')](function(_0x4fd7f0){logger[_0xef2d('0x11')](_0xef2d('0xe'),_0x28d0b2,_0x4fd7f0);_0x36d10c(_0x4fd7f0);});});}exports[_0xef2d('0x16')]=function(_0x385d18){var _0x3f5ee6=this;return new Promise(function(_0x464a20,_0x418f42){return db[_0xef2d('0x17')][_0xef2d('0x18')]({'raw':_0x385d18[_0xef2d('0x19')]?_0x385d18['options'][_0xef2d('0x1a')]===undefined?!![]:![]:!![],'where':_0x385d18['options']?_0x385d18['options'][_0xef2d('0x1b')]||null:null,'attributes':_0x385d18[_0xef2d('0x19')]?_0x385d18['options'][_0xef2d('0x1c')]||null:null,'limit':_0x385d18[_0xef2d('0x19')]?_0x385d18[_0xef2d('0x19')]['limit']||null:null,'include':_0x385d18['options']?_0x385d18[_0xef2d('0x19')][_0xef2d('0x1d')]?_[_0xef2d('0x1e')](_0x385d18[_0xef2d('0x19')][_0xef2d('0x1d')],function(_0x239a97){return{'model':db[_0x239a97[_0xef2d('0x1f')]],'as':_0x239a97['as'],'attributes':_0x239a97[_0xef2d('0x1c')],'include':_0x239a97['include']?_['map'](_0x239a97[_0xef2d('0x1d')],function(_0xcb88cb){return{'model':db[_0xcb88cb[_0xef2d('0x1f')]],'as':_0xcb88cb['as'],'attributes':_0xcb88cb[_0xef2d('0x1c')],'include':_0xcb88cb[_0xef2d('0x1d')]?_[_0xef2d('0x1e')](_0xcb88cb['include'],function(_0x35d2dc){return{'model':db[_0x35d2dc['model']],'as':_0x35d2dc['as'],'attributes':_0x35d2dc[_0xef2d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef2d('0xc')](function(_0x408721){logger[_0xef2d('0xd')](_0xef2d('0x16'),_0x385d18);logger[_0xef2d('0x20')](_0xef2d('0x16'),_0x385d18,JSON[_0xef2d('0x21')](_0x408721));_0x464a20(_0x408721);})['catch'](function(_0x5836f4){logger[_0xef2d('0x11')](_0xef2d('0x16'),_0x5836f4[_0xef2d('0x13')],_0x385d18);_0x418f42(_0x3f5ee6[_0xef2d('0x11')](0x1f4,_0x5836f4[_0xef2d('0x13')]));});});};exports[_0xef2d('0x22')]=function(_0x2979a3){var _0x39809a=this;return new Promise(function(_0x1efdf2,_0x5e1149){return db[_0xef2d('0x17')]['find']({'raw':_0x2979a3[_0xef2d('0x19')]?_0x2979a3[_0xef2d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2979a3[_0xef2d('0x19')]?_0x2979a3[_0xef2d('0x19')][_0xef2d('0x1b')]||null:null,'attributes':_0x2979a3[_0xef2d('0x19')]?_0x2979a3['options'][_0xef2d('0x1c')]||null:null,'include':_0x2979a3[_0xef2d('0x19')]?_0x2979a3[_0xef2d('0x19')][_0xef2d('0x1d')]?_[_0xef2d('0x1e')](_0x2979a3['options'][_0xef2d('0x1d')],function(_0x2a5283){return{'model':db[_0x2a5283[_0xef2d('0x1f')]],'as':_0x2a5283['as'],'attributes':_0x2a5283['attributes'],'include':_0x2a5283[_0xef2d('0x1d')]?_[_0xef2d('0x1e')](_0x2a5283[_0xef2d('0x1d')],function(_0x274d78){return{'model':db[_0x274d78['model']],'as':_0x274d78['as'],'attributes':_0x274d78[_0xef2d('0x1c')],'include':_0x274d78[_0xef2d('0x1d')]?_[_0xef2d('0x1e')](_0x274d78[_0xef2d('0x1d')],function(_0x9b6dff){return{'model':db[_0x9b6dff[_0xef2d('0x1f')]],'as':_0x9b6dff['as'],'attributes':_0x9b6dff[_0xef2d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef2d('0xc')](function(_0x16e178){logger['info'](_0xef2d('0x22'),_0x2979a3);logger['debug'](_0xef2d('0x22'),_0x2979a3,JSON[_0xef2d('0x21')](_0x16e178));_0x1efdf2(_0x16e178);})['catch'](function(_0xd219ad){logger['error']('ShowDynamics365Account',_0xd219ad['message'],_0x2979a3);_0x5e1149(_0x39809a[_0xef2d('0x11')](0x1f4,_0xd219ad[_0xef2d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index dcb18de..41ebbec 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 _0x867f=['index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x41d9e7,_0x33ef4a){var _0x282c36=function(_0x2bb2a5){while(--_0x2bb2a5){_0x41d9e7['push'](_0x41d9e7['shift']());}};_0x282c36(++_0x33ef4a);}(_0x867f,0xdc));var _0xf867=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x867f[_0x3a607e];return _0x37b106;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require('connect-timeout');var express=require(_0xf867('0x3'));var router=express[_0xf867('0x4')]();var fs_extra=require(_0xf867('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf867('0x6'));var config=require('../../config/environment');var controller=require(_0xf867('0x7'));router[_0xf867('0x8')]('/',auth[_0xf867('0x9')](),controller[_0xf867('0xa')]);router[_0xf867('0x8')](_0xf867('0xb'),auth[_0xf867('0x9')](),controller[_0xf867('0xc')]);router[_0xf867('0x8')](_0xf867('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xf867('0x8')](_0xf867('0xe'),auth[_0xf867('0x9')](),controller['getSubjects']);router['get'](_0xf867('0xf'),auth[_0xf867('0x9')](),controller['getDescriptions']);router[_0xf867('0x10')]('/',auth[_0xf867('0x9')](),controller[_0xf867('0x11')]);router[_0xf867('0x12')]('/:id',auth[_0xf867('0x9')](),controller[_0xf867('0x13')]);router[_0xf867('0x14')](_0xf867('0xb'),auth[_0xf867('0x9')](),controller[_0xf867('0x15')]);module[_0xf867('0x16')]=router; \ No newline at end of file +var _0x9e6b=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util'];(function(_0x58c798,_0x2316b3){var _0x1c2c79=function(_0x463813){while(--_0x463813){_0x58c798['push'](_0x58c798['shift']());}};_0x1c2c79(++_0x2316b3);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9e6b[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var path=require('path');var timeout=require(_0xb9e6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb9e6('0x3'));var auth=require(_0xb9e6('0x4'));var interaction=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xb9e6('0x7')]('/',auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x9')]);router['get'](_0xb9e6('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb9e6('0xb'),auth['isAuthenticated'](),controller[_0xb9e6('0xc')]);router[_0xb9e6('0x7')](_0xb9e6('0xd'),auth[_0xb9e6('0x8')](),controller[_0xb9e6('0xe')]);router[_0xb9e6('0x7')](_0xb9e6('0xf'),auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x10')]);router[_0xb9e6('0x11')]('/',auth['isAuthenticated'](),controller[_0xb9e6('0x12')]);router[_0xb9e6('0x13')](_0xb9e6('0xa'),auth[_0xb9e6('0x8')](),controller['update']);router[_0xb9e6('0x14')](_0xb9e6('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb9e6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index bb0a9bb..274199d 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 _0x4e49=['sequelize','STRING','ENUM','contact','nothing'];(function(_0x267f04,_0x18005d){var _0x324621=function(_0x3ef6a9){while(--_0x3ef6a9){_0x267f04['push'](_0x267f04['shift']());}};_0x324621(++_0x18005d);}(_0x4e49,0x14f));var _0x94e4=function(_0x339b73,_0x5a6856){_0x339b73=_0x339b73-0x0;var _0x162667=_0x4e49[_0x339b73];return _0x162667;};'use strict';var Sequelize=require(_0x94e4('0x0'));module['exports']={'name':{'type':Sequelize[_0x94e4('0x1')]},'description':{'type':Sequelize[_0x94e4('0x1')]},'ticketType':{'type':Sequelize[_0x94e4('0x2')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x94e4('0x2')](_0x94e4('0x3'),_0x94e4('0x4')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x94e4('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa3fd=['sequelize','exports','STRING','ENUM','nothing','contact'];(function(_0x5aefda,_0x1791d0){var _0x42caa8=function(_0x568c26){while(--_0x568c26){_0x5aefda['push'](_0x5aefda['shift']());}};_0x42caa8(++_0x1791d0);}(_0xa3fd,0x144));var _0xda3f=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0xa3fd[_0x47623f];return _0x282ce8;};'use strict';var Sequelize=require(_0xda3f('0x0'));module[_0xda3f('0x1')]={'name':{'type':Sequelize[_0xda3f('0x2')]},'description':{'type':Sequelize[_0xda3f('0x2')]},'ticketType':{'type':Sequelize[_0xda3f('0x3')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xda3f('0x3')]('contact',_0xda3f('0x4')),'defaultValue':_0xda3f('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xda3f('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 54e5250..0600422 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 _0xa857=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','findAll','catch','includeAll','find','create','body','getFields','findOne','params','order','nolimit','getSubjects','Dynamics365Field','getDescriptions','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration'];(function(_0x1e4afd,_0x574632){var _0x580791=function(_0x47b7d5){while(--_0x47b7d5){_0x1e4afd['push'](_0x1e4afd['shift']());}};_0x580791(++_0x574632);}(_0xa857,0x10f));var _0x7a85=function(_0xa8b8fa,_0x261194){_0xa8b8fa=_0xa8b8fa-0x0;var _0x10eae9=_0xa857[_0xa8b8fa];return _0x10eae9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a85('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a85('0x1'));var moment=require(_0x7a85('0x2'));var BPromise=require(_0x7a85('0x3'));var Mustache=require(_0x7a85('0x4'));var util=require(_0x7a85('0x5'));var path=require(_0x7a85('0x6'));var sox=require('sox');var csv=require(_0x7a85('0x7'));var ejs=require(_0x7a85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a85('0x9'));var squel=require(_0x7a85('0xa'));var crypto=require(_0x7a85('0xb'));var jsforce=require(_0x7a85('0xc'));var deskjs=require(_0x7a85('0xd'));var toCsv=require(_0x7a85('0x7'));var querystring=require(_0x7a85('0xe'));var Papa=require(_0x7a85('0xf'));var Redis=require(_0x7a85('0x10'));var authService=require(_0x7a85('0x11'));var qs=require(_0x7a85('0x12'));var as=require(_0x7a85('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a85('0x14'))(_0x7a85('0x15'));var utils=require(_0x7a85('0x16'));var config=require(_0x7a85('0x17'));var licenseUtil=require(_0x7a85('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cff25,_0x4258ac){_0x4258ac=_0x4258ac||0xcc;return function(_0x460892){if(_0x460892){return _0x4cff25[_0x7a85('0x19')](_0x4258ac);}return _0x4cff25[_0x7a85('0x1a')](_0x4258ac)['end']();};}function respondWithResult(_0x822529,_0x58879c){_0x58879c=_0x58879c||0xc8;return function(_0x5d64ab){if(_0x5d64ab){return _0x822529[_0x7a85('0x1a')](_0x58879c)[_0x7a85('0x1b')](_0x5d64ab);}};}function respondWithFilteredResult(_0x499593,_0x431adc){return function(_0x2172ec){if(_0x2172ec){var _0xb23f51=typeof _0x431adc[_0x7a85('0x1c')]==='undefined'&&typeof _0x431adc[_0x7a85('0x1d')]===_0x7a85('0x1e');var _0x4cb4ad=_0x2172ec[_0x7a85('0x1f')];var _0x2cbdce=_0xb23f51?0x0:_0x431adc[_0x7a85('0x1c')];var _0x11d13f=_0xb23f51?_0x2172ec[_0x7a85('0x1f')]:_0x431adc[_0x7a85('0x1c')]+_0x431adc[_0x7a85('0x1d')];var _0x2e1ee0;if(_0x11d13f>=_0x4cb4ad){_0x11d13f=_0x4cb4ad;_0x2e1ee0=0xc8;}else{_0x2e1ee0=0xce;}_0x499593['status'](_0x2e1ee0);return _0x499593['set'](_0x7a85('0x20'),_0x2cbdce+'-'+_0x11d13f+'/'+_0x4cb4ad)[_0x7a85('0x1b')](_0x2172ec);}return null;};}function patchUpdates(_0x4270cd){return function(_0x422d19){try{jsonpatch[_0x7a85('0x21')](_0x422d19,_0x4270cd,!![]);}catch(_0x183d6d){return BPromise[_0x7a85('0x22')](_0x183d6d);}return _0x422d19['save']();};}function saveUpdates(_0x7450b0,_0x426141){return function(_0x301edf){if(_0x301edf){return _0x301edf[_0x7a85('0x23')](_0x7450b0)[_0x7a85('0x24')](function(_0x32f554){return _0x32f554;});}return null;};}function removeEntity(_0x5a72a9,_0x2bf24f){return function(_0x493d99){if(_0x493d99){return _0x493d99[_0x7a85('0x25')]()[_0x7a85('0x24')](function(){_0x5a72a9[_0x7a85('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bedf1,_0x17450b){return function(_0x3e88f1){if(!_0x3e88f1){_0x4bedf1[_0x7a85('0x19')](0x194);}return _0x3e88f1;};}function handleError(_0x30c8b5,_0x1bc417){_0x1bc417=_0x1bc417||0x1f4;return function(_0x22dff1){logger[_0x7a85('0x26')](_0x22dff1[_0x7a85('0x27')]);if(_0x22dff1[_0x7a85('0x28')]){delete _0x22dff1[_0x7a85('0x28')];}_0x30c8b5[_0x7a85('0x1a')](_0x1bc417)[_0x7a85('0x29')](_0x22dff1);};}exports[_0x7a85('0x2a')]=function(_0x6eaa4c,_0x40039c){var _0x42cacd={},_0x1957c7={},_0x38b101={'count':0x0,'rows':[]};var _0x50a429=_[_0x7a85('0x2b')](db[_0x7a85('0x2c')][_0x7a85('0x2d')],function(_0x380d1f){return{'name':_0x380d1f[_0x7a85('0x2e')],'type':_0x380d1f[_0x7a85('0x2f')][_0x7a85('0x30')]};});_0x1957c7[_0x7a85('0x31')]=_[_0x7a85('0x2b')](_0x50a429,'name');_0x1957c7[_0x7a85('0x32')]=_[_0x7a85('0x33')](_0x6eaa4c[_0x7a85('0x32')]);_0x1957c7[_0x7a85('0x34')]=_[_0x7a85('0x35')](_0x1957c7[_0x7a85('0x31')],_0x1957c7[_0x7a85('0x32')]);_0x42cacd[_0x7a85('0x36')]=_['intersection'](_0x1957c7['model'],qs[_0x7a85('0x37')](_0x6eaa4c[_0x7a85('0x32')][_0x7a85('0x37')]));_0x42cacd['attributes']=_0x42cacd[_0x7a85('0x36')][_0x7a85('0x38')]?_0x42cacd[_0x7a85('0x36')]:_0x1957c7[_0x7a85('0x31')];if(!_0x6eaa4c[_0x7a85('0x32')][_0x7a85('0x39')]('nolimit')){_0x42cacd[_0x7a85('0x1d')]=qs['limit'](_0x6eaa4c['query'][_0x7a85('0x1d')]);_0x42cacd[_0x7a85('0x1c')]=qs[_0x7a85('0x1c')](_0x6eaa4c[_0x7a85('0x32')][_0x7a85('0x1c')]);}_0x42cacd['order']=qs[_0x7a85('0x3a')](_0x6eaa4c['query'][_0x7a85('0x3a')]);_0x42cacd[_0x7a85('0x3b')]=qs['filters'](_[_0x7a85('0x3c')](_0x6eaa4c[_0x7a85('0x32')],_0x1957c7[_0x7a85('0x34')]),_0x50a429);if(_0x6eaa4c[_0x7a85('0x32')][_0x7a85('0x3d')]){_0x42cacd['where']=_['merge'](_0x42cacd[_0x7a85('0x3b')],{'$or':_['map'](_0x50a429,function(_0x5b4b7f){if(_0x5b4b7f[_0x7a85('0x2f')]!==_0x7a85('0x3e')){var _0x16dfd0={};_0x16dfd0[_0x5b4b7f[_0x7a85('0x28')]]={'$like':'%'+_0x6eaa4c['query']['filter']+'%'};return _0x16dfd0;}})});}_0x42cacd=_[_0x7a85('0x3f')]({},_0x42cacd,_0x6eaa4c[_0x7a85('0x40')]);var _0x1332d8={'where':_0x42cacd[_0x7a85('0x3b')]};return db['Dynamics365Configuration'][_0x7a85('0x1f')](_0x1332d8)[_0x7a85('0x24')](function(_0x3daa2b){_0x38b101[_0x7a85('0x1f')]=_0x3daa2b;if(_0x6eaa4c[_0x7a85('0x32')]['includeAll']){_0x42cacd['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x7a85('0x41')](_0x42cacd);})[_0x7a85('0x24')](function(_0x2e5764){_0x38b101['rows']=_0x2e5764;return _0x38b101;})[_0x7a85('0x24')](respondWithFilteredResult(_0x40039c,_0x42cacd))[_0x7a85('0x42')](handleError(_0x40039c,null));};exports['show']=function(_0x1eb52c,_0x3f8e78){var _0x14fd18={'raw':![],'where':{'id':_0x1eb52c['params']['id']}},_0x30c625={};_0x30c625[_0x7a85('0x31')]=_[_0x7a85('0x33')](db['Dynamics365Configuration']['rawAttributes']);_0x30c625[_0x7a85('0x32')]=_['keys'](_0x1eb52c['query']);_0x30c625['filters']=_[_0x7a85('0x35')](_0x30c625[_0x7a85('0x31')],_0x30c625[_0x7a85('0x32')]);_0x14fd18[_0x7a85('0x36')]=_['intersection'](_0x30c625['model'],qs[_0x7a85('0x37')](_0x1eb52c[_0x7a85('0x32')]['fields']));_0x14fd18[_0x7a85('0x36')]=_0x14fd18[_0x7a85('0x36')][_0x7a85('0x38')]?_0x14fd18[_0x7a85('0x36')]:_0x30c625['model'];if(_0x1eb52c[_0x7a85('0x32')][_0x7a85('0x43')]){_0x14fd18['include']=[{'all':!![]}];}_0x14fd18=_[_0x7a85('0x3f')]({},_0x14fd18,_0x1eb52c['options']);return db[_0x7a85('0x2c')][_0x7a85('0x44')](_0x14fd18)[_0x7a85('0x24')](handleEntityNotFound(_0x3f8e78,null))[_0x7a85('0x24')](respondWithResult(_0x3f8e78,null))[_0x7a85('0x42')](handleError(_0x3f8e78,null));};exports[_0x7a85('0x45')]=function(_0x17328a,_0x3ae018){return db['Dynamics365Configuration'][_0x7a85('0x45')](_0x17328a[_0x7a85('0x46')],{})[_0x7a85('0x24')](respondWithResult(_0x3ae018,0xc9))[_0x7a85('0x42')](handleError(_0x3ae018,null));};exports[_0x7a85('0x23')]=function(_0x5a1969,_0x6fc9b8){if(_0x5a1969[_0x7a85('0x46')]['id']){delete _0x5a1969[_0x7a85('0x46')]['id'];}return db[_0x7a85('0x2c')][_0x7a85('0x44')]({'where':{'id':_0x5a1969['params']['id']}})['then'](handleEntityNotFound(_0x6fc9b8,null))[_0x7a85('0x24')](saveUpdates(_0x5a1969[_0x7a85('0x46')],null))[_0x7a85('0x24')](respondWithResult(_0x6fc9b8,null))[_0x7a85('0x42')](handleError(_0x6fc9b8,null));};exports[_0x7a85('0x25')]=function(_0x3d110a,_0x34af4d){return db[_0x7a85('0x2c')][_0x7a85('0x44')]({'where':{'id':_0x3d110a['params']['id']}})[_0x7a85('0x24')](handleEntityNotFound(_0x34af4d,null))[_0x7a85('0x24')](removeEntity(_0x34af4d,null))[_0x7a85('0x42')](handleError(_0x34af4d,null));};exports[_0x7a85('0x47')]=function(_0x5021f1,_0x316ddc,_0x34382d){var _0x286c3d={};var _0x2fb398={};var _0xef7085;var _0x3db9e0;return db[_0x7a85('0x2c')][_0x7a85('0x48')]({'where':{'id':_0x5021f1[_0x7a85('0x49')]['id']}})[_0x7a85('0x24')](handleEntityNotFound(_0x316ddc,null))['then'](function(_0x4d4305){if(_0x4d4305){_0xef7085=_0x4d4305;_0x2fb398['model']=_[_0x7a85('0x33')](db['Dynamics365Field'][_0x7a85('0x2d')]);_0x2fb398['query']=_['keys'](_0x5021f1[_0x7a85('0x32')]);_0x2fb398[_0x7a85('0x34')]=_[_0x7a85('0x35')](_0x2fb398[_0x7a85('0x31')],_0x2fb398[_0x7a85('0x32')]);_0x286c3d['attributes']=_[_0x7a85('0x35')](_0x2fb398[_0x7a85('0x31')],qs['fields'](_0x5021f1[_0x7a85('0x32')]['fields']));_0x286c3d[_0x7a85('0x36')]=_0x286c3d[_0x7a85('0x36')][_0x7a85('0x38')]?_0x286c3d[_0x7a85('0x36')]:_0x2fb398[_0x7a85('0x31')];_0x286c3d[_0x7a85('0x4a')]=qs[_0x7a85('0x3a')](_0x5021f1[_0x7a85('0x32')]['sort']);_0x286c3d[_0x7a85('0x3b')]=qs[_0x7a85('0x34')](_[_0x7a85('0x3c')](_0x5021f1[_0x7a85('0x32')],_0x2fb398[_0x7a85('0x34')]));if(_0x5021f1[_0x7a85('0x32')][_0x7a85('0x3d')]){_0x286c3d[_0x7a85('0x3b')]=_[_0x7a85('0x3f')](_0x286c3d['where'],{'$or':_['map'](_0x286c3d[_0x7a85('0x36')],function(_0x546d1f){var _0x1ce24f={};_0x1ce24f[_0x546d1f]={'$like':'%'+_0x5021f1[_0x7a85('0x32')][_0x7a85('0x3d')]+'%'};return _0x1ce24f;})});}_0x286c3d=_[_0x7a85('0x3f')]({},_0x286c3d,_0x5021f1[_0x7a85('0x40')]);return _0xef7085[_0x7a85('0x47')](_0x286c3d);}})['then'](function(_0x199794){if(_0x199794){_0x3db9e0=_0x199794[_0x7a85('0x38')];if(!_0x5021f1[_0x7a85('0x32')][_0x7a85('0x39')](_0x7a85('0x4b'))){_0x286c3d[_0x7a85('0x1d')]=qs[_0x7a85('0x1d')](_0x5021f1[_0x7a85('0x32')][_0x7a85('0x1d')]);_0x286c3d['offset']=qs[_0x7a85('0x1c')](_0x5021f1[_0x7a85('0x32')]['offset']);}return _0xef7085[_0x7a85('0x47')](_0x286c3d);}})[_0x7a85('0x24')](function(_0x382a4a){if(_0x382a4a){return _0x382a4a?{'count':_0x3db9e0,'rows':_0x382a4a}:null;}})['then'](respondWithResult(_0x316ddc,null))[_0x7a85('0x42')](handleError(_0x316ddc,null));};exports['getSubjects']=function(_0xac32a6,_0x4cd90c,_0x2bcbeb){var _0x47508c={};var _0x36f27f={};var _0x2fbc35;var _0x5b3cef;return db[_0x7a85('0x2c')]['findOne']({'where':{'id':_0xac32a6[_0x7a85('0x49')]['id']}})[_0x7a85('0x24')](handleEntityNotFound(_0x4cd90c,null))['then'](function(_0x4d9b5c){if(_0x4d9b5c){_0x2fbc35=_0x4d9b5c;_0x36f27f[_0x7a85('0x31')]=_[_0x7a85('0x33')](db['Dynamics365Field']['rawAttributes']);_0x36f27f[_0x7a85('0x32')]=_[_0x7a85('0x33')](_0xac32a6[_0x7a85('0x32')]);_0x36f27f[_0x7a85('0x34')]=_[_0x7a85('0x35')](_0x36f27f[_0x7a85('0x31')],_0x36f27f[_0x7a85('0x32')]);_0x47508c[_0x7a85('0x36')]=_[_0x7a85('0x35')](_0x36f27f[_0x7a85('0x31')],qs[_0x7a85('0x37')](_0xac32a6[_0x7a85('0x32')][_0x7a85('0x37')]));_0x47508c[_0x7a85('0x36')]=_0x47508c['attributes']['length']?_0x47508c[_0x7a85('0x36')]:_0x36f27f[_0x7a85('0x31')];_0x47508c[_0x7a85('0x4a')]=qs[_0x7a85('0x3a')](_0xac32a6[_0x7a85('0x32')][_0x7a85('0x3a')]);_0x47508c[_0x7a85('0x3b')]=qs[_0x7a85('0x34')](_['pick'](_0xac32a6[_0x7a85('0x32')],_0x36f27f['filters']));if(_0xac32a6['query'][_0x7a85('0x3d')]){_0x47508c[_0x7a85('0x3b')]=_[_0x7a85('0x3f')](_0x47508c[_0x7a85('0x3b')],{'$or':_[_0x7a85('0x2b')](_0x47508c['attributes'],function(_0x31a9e3){var _0x1fe794={};_0x1fe794[_0x31a9e3]={'$like':'%'+_0xac32a6[_0x7a85('0x32')][_0x7a85('0x3d')]+'%'};return _0x1fe794;})});}_0x47508c=_[_0x7a85('0x3f')]({},_0x47508c,_0xac32a6[_0x7a85('0x40')]);return _0x2fbc35[_0x7a85('0x4c')](_0x47508c);}})[_0x7a85('0x24')](function(_0x3f289){if(_0x3f289){_0x5b3cef=_0x3f289[_0x7a85('0x38')];if(!_0xac32a6[_0x7a85('0x32')][_0x7a85('0x39')]('nolimit')){_0x47508c[_0x7a85('0x1d')]=qs[_0x7a85('0x1d')](_0xac32a6[_0x7a85('0x32')][_0x7a85('0x1d')]);_0x47508c[_0x7a85('0x1c')]=qs['offset'](_0xac32a6[_0x7a85('0x32')][_0x7a85('0x1c')]);}return _0x2fbc35['getSubjects'](_0x47508c);}})[_0x7a85('0x24')](function(_0x2dbb02){if(_0x2dbb02){return _0x2dbb02?{'count':_0x5b3cef,'rows':_0x2dbb02}:null;}})[_0x7a85('0x24')](respondWithResult(_0x4cd90c,null))['catch'](handleError(_0x4cd90c,null));};exports['getDescriptions']=function(_0xc5c8f9,_0x1036f3,_0xb2cff6){var _0x8c53d3={};var _0x3c6d7c={};var _0x18ae67;var _0x5f04cc;return db['Dynamics365Configuration'][_0x7a85('0x48')]({'where':{'id':_0xc5c8f9[_0x7a85('0x49')]['id']}})['then'](handleEntityNotFound(_0x1036f3,null))['then'](function(_0x31cdb6){if(_0x31cdb6){_0x18ae67=_0x31cdb6;_0x3c6d7c[_0x7a85('0x31')]=_['keys'](db[_0x7a85('0x4d')][_0x7a85('0x2d')]);_0x3c6d7c['query']=_[_0x7a85('0x33')](_0xc5c8f9[_0x7a85('0x32')]);_0x3c6d7c[_0x7a85('0x34')]=_[_0x7a85('0x35')](_0x3c6d7c[_0x7a85('0x31')],_0x3c6d7c['query']);_0x8c53d3[_0x7a85('0x36')]=_[_0x7a85('0x35')](_0x3c6d7c[_0x7a85('0x31')],qs[_0x7a85('0x37')](_0xc5c8f9['query'][_0x7a85('0x37')]));_0x8c53d3['attributes']=_0x8c53d3[_0x7a85('0x36')][_0x7a85('0x38')]?_0x8c53d3[_0x7a85('0x36')]:_0x3c6d7c[_0x7a85('0x31')];_0x8c53d3[_0x7a85('0x4a')]=qs[_0x7a85('0x3a')](_0xc5c8f9['query'][_0x7a85('0x3a')]);_0x8c53d3[_0x7a85('0x3b')]=qs[_0x7a85('0x34')](_['pick'](_0xc5c8f9[_0x7a85('0x32')],_0x3c6d7c['filters']));if(_0xc5c8f9[_0x7a85('0x32')][_0x7a85('0x3d')]){_0x8c53d3[_0x7a85('0x3b')]=_[_0x7a85('0x3f')](_0x8c53d3[_0x7a85('0x3b')],{'$or':_['map'](_0x8c53d3['attributes'],function(_0x57448f){var _0x25aeb8={};_0x25aeb8[_0x57448f]={'$like':'%'+_0xc5c8f9[_0x7a85('0x32')][_0x7a85('0x3d')]+'%'};return _0x25aeb8;})});}_0x8c53d3=_[_0x7a85('0x3f')]({},_0x8c53d3,_0xc5c8f9[_0x7a85('0x40')]);return _0x18ae67['getDescriptions'](_0x8c53d3);}})[_0x7a85('0x24')](function(_0x38056f){if(_0x38056f){_0x5f04cc=_0x38056f[_0x7a85('0x38')];if(!_0xc5c8f9[_0x7a85('0x32')][_0x7a85('0x39')]('nolimit')){_0x8c53d3['limit']=qs[_0x7a85('0x1d')](_0xc5c8f9[_0x7a85('0x32')]['limit']);_0x8c53d3[_0x7a85('0x1c')]=qs[_0x7a85('0x1c')](_0xc5c8f9[_0x7a85('0x32')][_0x7a85('0x1c')]);}return _0x18ae67[_0x7a85('0x4e')](_0x8c53d3);}})[_0x7a85('0x24')](function(_0x353ea4){if(_0x353ea4){return _0x353ea4?{'count':_0x5f04cc,'rows':_0x353ea4}:null;}})[_0x7a85('0x24')](respondWithResult(_0x1036f3,null))[_0x7a85('0x42')](handleError(_0x1036f3,null));}; \ No newline at end of file +var _0xe520=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','update','params','getFields','Dynamics365Field','length','getSubjects','findOne','getDescriptions','hasOwnProperty','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type'];(function(_0x52d785,_0x274866){var _0x360cc5=function(_0x393127){while(--_0x393127){_0x52d785['push'](_0x52d785['shift']());}};_0x360cc5(++_0x274866);}(_0xe520,0x16d));var _0x0e52=function(_0x17f575,_0x475f2d){_0x17f575=_0x17f575-0x0;var _0x18c832=_0xe520[_0x17f575];return _0x18c832;};'use strict';var emlformat=require(_0x0e52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e52('0x1'));var moment=require(_0x0e52('0x2'));var BPromise=require(_0x0e52('0x3'));var Mustache=require(_0x0e52('0x4'));var util=require(_0x0e52('0x5'));var path=require(_0x0e52('0x6'));var sox=require(_0x0e52('0x7'));var csv=require(_0x0e52('0x8'));var ejs=require(_0x0e52('0x9'));var fs=require('fs');var fs_extra=require(_0x0e52('0xa'));var _=require(_0x0e52('0xb'));var squel=require(_0x0e52('0xc'));var crypto=require(_0x0e52('0xd'));var jsforce=require(_0x0e52('0xe'));var deskjs=require(_0x0e52('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e52('0x10'));var Redis=require(_0x0e52('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e52('0x12'));var as=require(_0x0e52('0x13'));var hardwareService=require(_0x0e52('0x14'));var logger=require(_0x0e52('0x15'))(_0x0e52('0x16'));var utils=require('../../config/utils');var config=require(_0x0e52('0x17'));var licenseUtil=require(_0x0e52('0x18'));var db=require(_0x0e52('0x19'))['db'];function respondWithStatusCode(_0x1e759c,_0x5c1780){_0x5c1780=_0x5c1780||0xcc;return function(_0x3a8c21){if(_0x3a8c21){return _0x1e759c[_0x0e52('0x1a')](_0x5c1780);}return _0x1e759c[_0x0e52('0x1b')](_0x5c1780)[_0x0e52('0x1c')]();};}function respondWithResult(_0x3c0e09,_0x4562aa){_0x4562aa=_0x4562aa||0xc8;return function(_0x1ccc9b){if(_0x1ccc9b){return _0x3c0e09['status'](_0x4562aa)[_0x0e52('0x1d')](_0x1ccc9b);}};}function respondWithFilteredResult(_0x20aa29,_0x13d88d){return function(_0x1c60bf){if(_0x1c60bf){var _0x30285f=typeof _0x13d88d[_0x0e52('0x1e')]===_0x0e52('0x1f')&&typeof _0x13d88d[_0x0e52('0x20')]===_0x0e52('0x1f');var _0x1fe5ac=_0x1c60bf[_0x0e52('0x21')];var _0x287cc2=_0x30285f?0x0:_0x13d88d[_0x0e52('0x1e')];var _0x12a69f=_0x30285f?_0x1c60bf[_0x0e52('0x21')]:_0x13d88d[_0x0e52('0x1e')]+_0x13d88d[_0x0e52('0x20')];var _0xd87f41;if(_0x12a69f>=_0x1fe5ac){_0x12a69f=_0x1fe5ac;_0xd87f41=0xc8;}else{_0xd87f41=0xce;}_0x20aa29[_0x0e52('0x1b')](_0xd87f41);return _0x20aa29[_0x0e52('0x22')](_0x0e52('0x23'),_0x287cc2+'-'+_0x12a69f+'/'+_0x1fe5ac)[_0x0e52('0x1d')](_0x1c60bf);}return null;};}function patchUpdates(_0x4c13c3){return function(_0x210ba2){try{jsonpatch[_0x0e52('0x24')](_0x210ba2,_0x4c13c3,!![]);}catch(_0x46ae09){return BPromise[_0x0e52('0x25')](_0x46ae09);}return _0x210ba2[_0x0e52('0x26')]();};}function saveUpdates(_0x7f75e6,_0x22b2f0){return function(_0x201a4e){if(_0x201a4e){return _0x201a4e['update'](_0x7f75e6)[_0x0e52('0x27')](function(_0x16a897){return _0x16a897;});}return null;};}function removeEntity(_0x183ecb,_0x417567){return function(_0x431afa){if(_0x431afa){return _0x431afa[_0x0e52('0x28')]()[_0x0e52('0x27')](function(){_0x183ecb[_0x0e52('0x1b')](0xcc)[_0x0e52('0x1c')]();});}};}function handleEntityNotFound(_0x3ce8f4,_0x2826bc){return function(_0x3b0e04){if(!_0x3b0e04){_0x3ce8f4[_0x0e52('0x1a')](0x194);}return _0x3b0e04;};}function handleError(_0x46c1c2,_0x5f3126){_0x5f3126=_0x5f3126||0x1f4;return function(_0x5e0acc){logger[_0x0e52('0x29')](_0x5e0acc[_0x0e52('0x2a')]);if(_0x5e0acc[_0x0e52('0x2b')]){delete _0x5e0acc[_0x0e52('0x2b')];}_0x46c1c2[_0x0e52('0x1b')](_0x5f3126)[_0x0e52('0x2c')](_0x5e0acc);};}exports[_0x0e52('0x2d')]=function(_0x31ed51,_0x42ecba){var _0x58045e={},_0x26b5fb={},_0x52a0f3={'count':0x0,'rows':[]};var _0x44917c=_['map'](db[_0x0e52('0x2e')][_0x0e52('0x2f')],function(_0x48e511){return{'name':_0x48e511[_0x0e52('0x30')],'type':_0x48e511[_0x0e52('0x31')]['key']};});_0x26b5fb[_0x0e52('0x32')]=_['map'](_0x44917c,_0x0e52('0x2b'));_0x26b5fb[_0x0e52('0x33')]=_[_0x0e52('0x34')](_0x31ed51[_0x0e52('0x33')]);_0x26b5fb[_0x0e52('0x35')]=_[_0x0e52('0x36')](_0x26b5fb[_0x0e52('0x32')],_0x26b5fb[_0x0e52('0x33')]);_0x58045e[_0x0e52('0x37')]=_[_0x0e52('0x36')](_0x26b5fb[_0x0e52('0x32')],qs[_0x0e52('0x38')](_0x31ed51[_0x0e52('0x33')][_0x0e52('0x38')]));_0x58045e['attributes']=_0x58045e[_0x0e52('0x37')]['length']?_0x58045e[_0x0e52('0x37')]:_0x26b5fb[_0x0e52('0x32')];if(!_0x31ed51[_0x0e52('0x33')]['hasOwnProperty'](_0x0e52('0x39'))){_0x58045e[_0x0e52('0x20')]=qs[_0x0e52('0x20')](_0x31ed51[_0x0e52('0x33')][_0x0e52('0x20')]);_0x58045e['offset']=qs[_0x0e52('0x1e')](_0x31ed51[_0x0e52('0x33')]['offset']);}_0x58045e[_0x0e52('0x3a')]=qs[_0x0e52('0x3b')](_0x31ed51[_0x0e52('0x33')][_0x0e52('0x3b')]);_0x58045e[_0x0e52('0x3c')]=qs['filters'](_[_0x0e52('0x3d')](_0x31ed51[_0x0e52('0x33')],_0x26b5fb[_0x0e52('0x35')]),_0x44917c);if(_0x31ed51[_0x0e52('0x33')][_0x0e52('0x3e')]){_0x58045e[_0x0e52('0x3c')]=_[_0x0e52('0x3f')](_0x58045e[_0x0e52('0x3c')],{'$or':_[_0x0e52('0x40')](_0x44917c,function(_0x4da418){if(_0x4da418[_0x0e52('0x31')]!==_0x0e52('0x41')){var _0x3bffc9={};_0x3bffc9[_0x4da418[_0x0e52('0x2b')]]={'$like':'%'+_0x31ed51[_0x0e52('0x33')]['filter']+'%'};return _0x3bffc9;}})});}_0x58045e=_[_0x0e52('0x3f')]({},_0x58045e,_0x31ed51[_0x0e52('0x42')]);var _0x24b5a0={'where':_0x58045e[_0x0e52('0x3c')]};return db[_0x0e52('0x2e')][_0x0e52('0x21')](_0x24b5a0)['then'](function(_0x162da9){_0x52a0f3[_0x0e52('0x21')]=_0x162da9;if(_0x31ed51[_0x0e52('0x33')][_0x0e52('0x43')]){_0x58045e[_0x0e52('0x44')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0e52('0x45')](_0x58045e);})[_0x0e52('0x27')](function(_0xf7c758){_0x52a0f3['rows']=_0xf7c758;return _0x52a0f3;})[_0x0e52('0x27')](respondWithFilteredResult(_0x42ecba,_0x58045e))[_0x0e52('0x46')](handleError(_0x42ecba,null));};exports['show']=function(_0x2d4064,_0x19a044){var _0x321502={'raw':![],'where':{'id':_0x2d4064['params']['id']}},_0x2f7b70={};_0x2f7b70[_0x0e52('0x32')]=_[_0x0e52('0x34')](db[_0x0e52('0x2e')][_0x0e52('0x2f')]);_0x2f7b70['query']=_[_0x0e52('0x34')](_0x2d4064['query']);_0x2f7b70[_0x0e52('0x35')]=_[_0x0e52('0x36')](_0x2f7b70[_0x0e52('0x32')],_0x2f7b70['query']);_0x321502['attributes']=_['intersection'](_0x2f7b70[_0x0e52('0x32')],qs[_0x0e52('0x38')](_0x2d4064['query']['fields']));_0x321502[_0x0e52('0x37')]=_0x321502[_0x0e52('0x37')]['length']?_0x321502[_0x0e52('0x37')]:_0x2f7b70['model'];if(_0x2d4064[_0x0e52('0x33')][_0x0e52('0x43')]){_0x321502['include']=[{'all':!![]}];}_0x321502=_['merge']({},_0x321502,_0x2d4064[_0x0e52('0x42')]);return db[_0x0e52('0x2e')][_0x0e52('0x47')](_0x321502)[_0x0e52('0x27')](handleEntityNotFound(_0x19a044,null))[_0x0e52('0x27')](respondWithResult(_0x19a044,null))[_0x0e52('0x46')](handleError(_0x19a044,null));};exports[_0x0e52('0x48')]=function(_0x24f40e,_0x262669){return db['Dynamics365Configuration'][_0x0e52('0x48')](_0x24f40e[_0x0e52('0x49')],{})['then'](respondWithResult(_0x262669,0xc9))[_0x0e52('0x46')](handleError(_0x262669,null));};exports[_0x0e52('0x4a')]=function(_0x43b1af,_0x1d51da){if(_0x43b1af['body']['id']){delete _0x43b1af[_0x0e52('0x49')]['id'];}return db['Dynamics365Configuration'][_0x0e52('0x47')]({'where':{'id':_0x43b1af['params']['id']}})[_0x0e52('0x27')](handleEntityNotFound(_0x1d51da,null))[_0x0e52('0x27')](saveUpdates(_0x43b1af[_0x0e52('0x49')],null))[_0x0e52('0x27')](respondWithResult(_0x1d51da,null))['catch'](handleError(_0x1d51da,null));};exports[_0x0e52('0x28')]=function(_0x4c35ae,_0x19d5dd){return db[_0x0e52('0x2e')][_0x0e52('0x47')]({'where':{'id':_0x4c35ae[_0x0e52('0x4b')]['id']}})[_0x0e52('0x27')](handleEntityNotFound(_0x19d5dd,null))['then'](removeEntity(_0x19d5dd,null))['catch'](handleError(_0x19d5dd,null));};exports[_0x0e52('0x4c')]=function(_0x2b94c6,_0x36e06f,_0x3d0a3e){var _0x52d62f={};var _0x4aa685={};var _0x34c695;var _0x3ed56e;return db[_0x0e52('0x2e')]['findOne']({'where':{'id':_0x2b94c6[_0x0e52('0x4b')]['id']}})[_0x0e52('0x27')](handleEntityNotFound(_0x36e06f,null))[_0x0e52('0x27')](function(_0x16842b){if(_0x16842b){_0x34c695=_0x16842b;_0x4aa685[_0x0e52('0x32')]=_[_0x0e52('0x34')](db[_0x0e52('0x4d')][_0x0e52('0x2f')]);_0x4aa685[_0x0e52('0x33')]=_['keys'](_0x2b94c6[_0x0e52('0x33')]);_0x4aa685['filters']=_[_0x0e52('0x36')](_0x4aa685['model'],_0x4aa685['query']);_0x52d62f[_0x0e52('0x37')]=_[_0x0e52('0x36')](_0x4aa685[_0x0e52('0x32')],qs['fields'](_0x2b94c6['query'][_0x0e52('0x38')]));_0x52d62f[_0x0e52('0x37')]=_0x52d62f[_0x0e52('0x37')][_0x0e52('0x4e')]?_0x52d62f[_0x0e52('0x37')]:_0x4aa685['model'];_0x52d62f[_0x0e52('0x3a')]=qs[_0x0e52('0x3b')](_0x2b94c6['query'][_0x0e52('0x3b')]);_0x52d62f[_0x0e52('0x3c')]=qs[_0x0e52('0x35')](_[_0x0e52('0x3d')](_0x2b94c6[_0x0e52('0x33')],_0x4aa685[_0x0e52('0x35')]));if(_0x2b94c6[_0x0e52('0x33')][_0x0e52('0x3e')]){_0x52d62f['where']=_[_0x0e52('0x3f')](_0x52d62f['where'],{'$or':_[_0x0e52('0x40')](_0x52d62f[_0x0e52('0x37')],function(_0x5892c8){var _0x36a7f2={};_0x36a7f2[_0x5892c8]={'$like':'%'+_0x2b94c6[_0x0e52('0x33')][_0x0e52('0x3e')]+'%'};return _0x36a7f2;})});}_0x52d62f=_[_0x0e52('0x3f')]({},_0x52d62f,_0x2b94c6[_0x0e52('0x42')]);return _0x34c695[_0x0e52('0x4c')](_0x52d62f);}})['then'](function(_0x3a9cf2){if(_0x3a9cf2){_0x3ed56e=_0x3a9cf2[_0x0e52('0x4e')];if(!_0x2b94c6[_0x0e52('0x33')]['hasOwnProperty'](_0x0e52('0x39'))){_0x52d62f[_0x0e52('0x20')]=qs[_0x0e52('0x20')](_0x2b94c6['query'][_0x0e52('0x20')]);_0x52d62f[_0x0e52('0x1e')]=qs[_0x0e52('0x1e')](_0x2b94c6['query']['offset']);}return _0x34c695['getFields'](_0x52d62f);}})['then'](function(_0xb8e9dc){if(_0xb8e9dc){return _0xb8e9dc?{'count':_0x3ed56e,'rows':_0xb8e9dc}:null;}})['then'](respondWithResult(_0x36e06f,null))[_0x0e52('0x46')](handleError(_0x36e06f,null));};exports[_0x0e52('0x4f')]=function(_0x54271c,_0x1bab03,_0xcbb6d8){var _0x286a91={};var _0x1ca2ff={};var _0x2c898a;var _0x3cfb35;return db[_0x0e52('0x2e')][_0x0e52('0x50')]({'where':{'id':_0x54271c[_0x0e52('0x4b')]['id']}})[_0x0e52('0x27')](handleEntityNotFound(_0x1bab03,null))[_0x0e52('0x27')](function(_0x4bf3e3){if(_0x4bf3e3){_0x2c898a=_0x4bf3e3;_0x1ca2ff[_0x0e52('0x32')]=_[_0x0e52('0x34')](db[_0x0e52('0x4d')][_0x0e52('0x2f')]);_0x1ca2ff[_0x0e52('0x33')]=_[_0x0e52('0x34')](_0x54271c[_0x0e52('0x33')]);_0x1ca2ff['filters']=_[_0x0e52('0x36')](_0x1ca2ff['model'],_0x1ca2ff[_0x0e52('0x33')]);_0x286a91[_0x0e52('0x37')]=_[_0x0e52('0x36')](_0x1ca2ff['model'],qs[_0x0e52('0x38')](_0x54271c[_0x0e52('0x33')][_0x0e52('0x38')]));_0x286a91[_0x0e52('0x37')]=_0x286a91[_0x0e52('0x37')][_0x0e52('0x4e')]?_0x286a91[_0x0e52('0x37')]:_0x1ca2ff[_0x0e52('0x32')];_0x286a91[_0x0e52('0x3a')]=qs['sort'](_0x54271c[_0x0e52('0x33')][_0x0e52('0x3b')]);_0x286a91[_0x0e52('0x3c')]=qs[_0x0e52('0x35')](_['pick'](_0x54271c[_0x0e52('0x33')],_0x1ca2ff[_0x0e52('0x35')]));if(_0x54271c[_0x0e52('0x33')][_0x0e52('0x3e')]){_0x286a91[_0x0e52('0x3c')]=_[_0x0e52('0x3f')](_0x286a91['where'],{'$or':_[_0x0e52('0x40')](_0x286a91[_0x0e52('0x37')],function(_0x2e9fbb){var _0x491e1b={};_0x491e1b[_0x2e9fbb]={'$like':'%'+_0x54271c[_0x0e52('0x33')][_0x0e52('0x3e')]+'%'};return _0x491e1b;})});}_0x286a91=_['merge']({},_0x286a91,_0x54271c[_0x0e52('0x42')]);return _0x2c898a['getSubjects'](_0x286a91);}})[_0x0e52('0x27')](function(_0x26ea24){if(_0x26ea24){_0x3cfb35=_0x26ea24[_0x0e52('0x4e')];if(!_0x54271c[_0x0e52('0x33')]['hasOwnProperty']('nolimit')){_0x286a91[_0x0e52('0x20')]=qs[_0x0e52('0x20')](_0x54271c[_0x0e52('0x33')]['limit']);_0x286a91[_0x0e52('0x1e')]=qs[_0x0e52('0x1e')](_0x54271c[_0x0e52('0x33')][_0x0e52('0x1e')]);}return _0x2c898a[_0x0e52('0x4f')](_0x286a91);}})[_0x0e52('0x27')](function(_0x193929){if(_0x193929){return _0x193929?{'count':_0x3cfb35,'rows':_0x193929}:null;}})[_0x0e52('0x27')](respondWithResult(_0x1bab03,null))[_0x0e52('0x46')](handleError(_0x1bab03,null));};exports[_0x0e52('0x51')]=function(_0x305158,_0x430fef,_0x13aba9){var _0x1ead2b={};var _0x1213a1={};var _0x29ee6c;var _0x1b6d0a;return db[_0x0e52('0x2e')]['findOne']({'where':{'id':_0x305158[_0x0e52('0x4b')]['id']}})[_0x0e52('0x27')](handleEntityNotFound(_0x430fef,null))[_0x0e52('0x27')](function(_0x96c3bc){if(_0x96c3bc){_0x29ee6c=_0x96c3bc;_0x1213a1[_0x0e52('0x32')]=_['keys'](db[_0x0e52('0x4d')][_0x0e52('0x2f')]);_0x1213a1['query']=_[_0x0e52('0x34')](_0x305158[_0x0e52('0x33')]);_0x1213a1[_0x0e52('0x35')]=_[_0x0e52('0x36')](_0x1213a1[_0x0e52('0x32')],_0x1213a1[_0x0e52('0x33')]);_0x1ead2b['attributes']=_['intersection'](_0x1213a1[_0x0e52('0x32')],qs['fields'](_0x305158[_0x0e52('0x33')][_0x0e52('0x38')]));_0x1ead2b[_0x0e52('0x37')]=_0x1ead2b[_0x0e52('0x37')][_0x0e52('0x4e')]?_0x1ead2b[_0x0e52('0x37')]:_0x1213a1[_0x0e52('0x32')];_0x1ead2b[_0x0e52('0x3a')]=qs['sort'](_0x305158[_0x0e52('0x33')][_0x0e52('0x3b')]);_0x1ead2b[_0x0e52('0x3c')]=qs[_0x0e52('0x35')](_[_0x0e52('0x3d')](_0x305158['query'],_0x1213a1['filters']));if(_0x305158[_0x0e52('0x33')][_0x0e52('0x3e')]){_0x1ead2b[_0x0e52('0x3c')]=_[_0x0e52('0x3f')](_0x1ead2b['where'],{'$or':_[_0x0e52('0x40')](_0x1ead2b[_0x0e52('0x37')],function(_0x1be208){var _0x410761={};_0x410761[_0x1be208]={'$like':'%'+_0x305158['query'][_0x0e52('0x3e')]+'%'};return _0x410761;})});}_0x1ead2b=_[_0x0e52('0x3f')]({},_0x1ead2b,_0x305158['options']);return _0x29ee6c[_0x0e52('0x51')](_0x1ead2b);}})[_0x0e52('0x27')](function(_0x3db120){if(_0x3db120){_0x1b6d0a=_0x3db120[_0x0e52('0x4e')];if(!_0x305158['query'][_0x0e52('0x52')]('nolimit')){_0x1ead2b[_0x0e52('0x20')]=qs[_0x0e52('0x20')](_0x305158[_0x0e52('0x33')][_0x0e52('0x20')]);_0x1ead2b[_0x0e52('0x1e')]=qs[_0x0e52('0x1e')](_0x305158['query'][_0x0e52('0x1e')]);}return _0x29ee6c['getDescriptions'](_0x1ead2b);}})[_0x0e52('0x27')](function(_0x562900){if(_0x562900){return _0x562900?{'count':_0x1b6d0a,'rows':_0x562900}:null;}})['then'](respondWithResult(_0x430fef,null))[_0x0e52('0x46')](handleError(_0x430fef,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index aefc066..ddfdd09 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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe14d,0x1ee));var _0xde14=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe14d[_0x2d7f0e];return _0x110b07;};'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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x350645,_0x6cd552){var _0x2b5240=function(_0x13f64d){while(--_0x13f64d){_0x350645['push'](_0x350645['shift']());}};_0x2b5240(++_0x6cd552);}(_0x54ef,0x112));var _0xf54e=function(_0x2ee4b5,_0x3ed073){_0x2ee4b5=_0x2ee4b5-0x0;var _0x329421=_0x54ef[_0x2ee4b5];return _0x329421;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','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 1c4277b..c08b7db 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 _0xfa6f=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x489d72,_0x264e64){var _0x467599=function(_0x4235e6){while(--_0x4235e6){_0x489d72['push'](_0x489d72['shift']());}};_0x467599(++_0x264e64);}(_0xfa6f,0x1e5));var _0xffa6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfa6f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xffa6('0x0'));var moment=require(_0xffa6('0x1'));var BPromise=require(_0xffa6('0x2'));var rs=require(_0xffa6('0x3'));var fs=require('fs');var Redis=require(_0xffa6('0x4'));var db=require(_0xffa6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xffa6('0x6'))(_0xffa6('0x7'));var config=require(_0xffa6('0x8'));var jayson=require(_0xffa6('0x9'));var client=jayson[_0xffa6('0xa')][_0xffa6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29dc6e,_0x2e824d,_0x52dc0f){return new BPromise(function(_0x4ee629,_0x5bfcb0){return client['request'](_0x29dc6e,_0x52dc0f)[_0xffa6('0xc')](function(_0x48d84a){logger[_0xffa6('0xd')](_0xffa6('0xe'),_0x2e824d,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2e824d,_0xffa6('0xf'),JSON[_0xffa6('0x10')](_0x48d84a));if(_0x48d84a[_0xffa6('0x11')]){if(_0x48d84a[_0xffa6('0x11')][_0xffa6('0x12')]===0x1f4){logger[_0xffa6('0x11')](_0xffa6('0xe'),_0x2e824d,_0x48d84a[_0xffa6('0x11')][_0xffa6('0x13')]);return _0x5bfcb0(_0x48d84a[_0xffa6('0x11')][_0xffa6('0x13')]);}logger[_0xffa6('0x11')](_0xffa6('0xe'),_0x2e824d,_0x48d84a[_0xffa6('0x11')][_0xffa6('0x13')]);return _0x4ee629(_0x48d84a['error'][_0xffa6('0x13')]);}else{logger[_0xffa6('0xd')](_0xffa6('0xe'),_0x2e824d,_0xffa6('0xf'));_0x4ee629(_0x48d84a[_0xffa6('0x14')][_0xffa6('0x13')]);}})[_0xffa6('0x15')](function(_0x4f94b8){logger[_0xffa6('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2e824d,_0x4f94b8);_0x5bfcb0(_0x4f94b8);});});} \ No newline at end of file +var _0x9a09=['../../config/environment','jayson/promise','http','then','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x9a09,0x6c));var _0x99a0=function(_0x467f7e,_0x9625ca){_0x467f7e=_0x467f7e-0x0;var _0x352aa8=_0x9a09[_0x467f7e];return _0x352aa8;};'use strict';var _=require('lodash');var util=require(_0x99a0('0x0'));var moment=require('moment');var BPromise=require(_0x99a0('0x1'));var rs=require(_0x99a0('0x2'));var fs=require('fs');var Redis=require(_0x99a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x99a0('0x4'));var logger=require(_0x99a0('0x5'))('rpc');var config=require(_0x99a0('0x6'));var jayson=require(_0x99a0('0x7'));var client=jayson['client'][_0x99a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb97ad5,_0x20b2df,_0x47a889){return new BPromise(function(_0x46a47c,_0x44bc91){return client['request'](_0xb97ad5,_0x47a889)[_0x99a0('0x9')](function(_0xf9b898){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x20b2df,_0x99a0('0xa'));logger['debug'](_0x99a0('0xb'),_0x20b2df,'request\x20sent',JSON[_0x99a0('0xc')](_0xf9b898));if(_0xf9b898['error']){if(_0xf9b898[_0x99a0('0xd')][_0x99a0('0xe')]===0x1f4){logger['error'](_0x99a0('0xf'),_0x20b2df,_0xf9b898[_0x99a0('0xd')]['message']);return _0x44bc91(_0xf9b898[_0x99a0('0xd')]['message']);}logger[_0x99a0('0xd')](_0x99a0('0xf'),_0x20b2df,_0xf9b898[_0x99a0('0xd')]['message']);return _0x46a47c(_0xf9b898[_0x99a0('0xd')][_0x99a0('0x10')]);}else{logger[_0x99a0('0x11')](_0x99a0('0xf'),_0x20b2df,'request\x20sent');_0x46a47c(_0xf9b898['result'][_0x99a0('0x10')]);}})[_0x99a0('0x12')](function(_0x224220){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x20b2df,_0x224220);_0x44bc91(_0x224220);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a0ec6f3..e5bf172 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 _0xae18=['create','update','destroy','exports','util','path','express','Router','../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post'];(function(_0x484aa1,_0x15ed44){var _0x874c1a=function(_0x443d6a){while(--_0x443d6a){_0x484aa1['push'](_0x484aa1['shift']());}};_0x874c1a(++_0x15ed44);}(_0xae18,0x1d5));var _0x8ae1=function(_0x10c913,_0x33a572){_0x10c913=_0x10c913-0x0;var _0x4868be=_0xae18[_0x10c913];return _0x4868be;};'use strict';var multer=require('multer');var util=require(_0x8ae1('0x0'));var path=require(_0x8ae1('0x1'));var timeout=require('connect-timeout');var express=require(_0x8ae1('0x2'));var router=express[_0x8ae1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8ae1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ae1('0x5'));router[_0x8ae1('0x6')]('/',auth[_0x8ae1('0x7')](),controller[_0x8ae1('0x8')]);router[_0x8ae1('0x6')](_0x8ae1('0x9'),auth[_0x8ae1('0x7')](),controller['show']);router[_0x8ae1('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ae1('0xb')]);router['put'](_0x8ae1('0x9'),auth['isAuthenticated'](),controller[_0x8ae1('0xc')]);router['delete']('/:id',auth[_0x8ae1('0x7')](),controller[_0x8ae1('0xd')]);module[_0x8ae1('0xe')]=router; \ No newline at end of file +var _0x6a17=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','show','post','create','put','update','exports'];(function(_0x2e6702,_0x542fc9){var _0x217a11=function(_0x39c3d7){while(--_0x39c3d7){_0x2e6702['push'](_0x2e6702['shift']());}};_0x217a11(++_0x542fc9);}(_0x6a17,0x140));var _0x76a1=function(_0x53539b,_0xe161b7){_0x53539b=_0x53539b-0x0;var _0x287b43=_0x6a17[_0x53539b];return _0x287b43;};'use strict';var multer=require(_0x76a1('0x0'));var util=require(_0x76a1('0x1'));var path=require(_0x76a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x76a1('0x3'));var router=express[_0x76a1('0x4')]();var fs_extra=require(_0x76a1('0x5'));var auth=require(_0x76a1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x76a1('0x7'));var controller=require(_0x76a1('0x8'));router['get']('/',auth[_0x76a1('0x9')](),controller['index']);router['get']('/:id',auth[_0x76a1('0x9')](),controller[_0x76a1('0xa')]);router[_0x76a1('0xb')]('/',auth[_0x76a1('0x9')](),controller[_0x76a1('0xc')]);router[_0x76a1('0xd')]('/:id',auth[_0x76a1('0x9')](),controller[_0x76a1('0xe')]);router['delete']('/:id',auth[_0x76a1('0x9')](),controller['destroy']);module[_0x76a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e857445..777b1a8 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 _0x8f01=['exports','keyValue','picklist','STRING','ENUM','string','variable','customVariable','sequelize'];(function(_0x388079,_0x3c05ed){var _0x300b74=function(_0x34cd2c){while(--_0x34cd2c){_0x388079['push'](_0x388079['shift']());}};_0x300b74(++_0x3c05ed);}(_0x8f01,0xd7));var _0x18f0=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x8f01[_0x492535];return _0x256620;};'use strict';var Sequelize=require(_0x18f0('0x0'));module[_0x18f0('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0x18f0('0x2'),_0x18f0('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x18f0('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x18f0('0x5')](_0x18f0('0x6'),_0x18f0('0x7'),_0x18f0('0x8'))},'keyContent':{'type':Sequelize[_0x18f0('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18f0('0x4')]}}; \ No newline at end of file +var _0x8bc2=['customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','variable'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0x8bc2,0x97));var _0x28bc=function(_0x9d147a,_0x519528){_0x9d147a=_0x9d147a-0x0;var _0x353931=_0x8bc2[_0x9d147a];return _0x353931;};'use strict';var Sequelize=require(_0x28bc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x28bc('0x1'),_0x28bc('0x2'),_0x28bc('0x3'),_0x28bc('0x4')),'defaultValue':_0x28bc('0x5')},'content':{'type':Sequelize[_0x28bc('0x6')]},'key':{'type':Sequelize[_0x28bc('0x6')]},'keyType':{'type':Sequelize[_0x28bc('0x7')](_0x28bc('0x5'),_0x28bc('0x1'),_0x28bc('0x2'))},'keyContent':{'type':Sequelize[_0x28bc('0x6')]},'idField':{'type':Sequelize[_0x28bc('0x6')]},'nameField':{'type':Sequelize[_0x28bc('0x6')]},'customField':{'type':Sequelize[_0x28bc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x28bc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a4aaece..f2275c8 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 _0xe685=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','set','Content-Range','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe685,0x116));var _0x5e68=function(_0x2f3b4c,_0x2633ff){_0x2f3b4c=_0x2f3b4c-0x0;var _0x4cc7d7=_0xe685[_0x2f3b4c];return _0x4cc7d7;};'use strict';var emlformat=require(_0x5e68('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e68('0x1'));var jsonpatch=require(_0x5e68('0x2'));var rp=require(_0x5e68('0x3'));var moment=require(_0x5e68('0x4'));var BPromise=require(_0x5e68('0x5'));var Mustache=require(_0x5e68('0x6'));var util=require(_0x5e68('0x7'));var path=require(_0x5e68('0x8'));var sox=require(_0x5e68('0x9'));var csv=require('to-csv');var ejs=require(_0x5e68('0xa'));var fs=require('fs');var fs_extra=require(_0x5e68('0xb'));var _=require(_0x5e68('0xc'));var squel=require(_0x5e68('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5e68('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e68('0xf'));var authService=require(_0x5e68('0x10'));var qs=require(_0x5e68('0x11'));var as=require(_0x5e68('0x12'));var hardwareService=require(_0x5e68('0x13'));var logger=require('../../config/logger')(_0x5e68('0x14'));var utils=require(_0x5e68('0x15'));var config=require(_0x5e68('0x16'));var licenseUtil=require(_0x5e68('0x17'));var db=require(_0x5e68('0x18'))['db'];function respondWithStatusCode(_0x46482d,_0x10361f){_0x10361f=_0x10361f||0xcc;return function(_0x259689){if(_0x259689){return _0x46482d['sendStatus'](_0x10361f);}return _0x46482d[_0x5e68('0x19')](_0x10361f)[_0x5e68('0x1a')]();};}function respondWithResult(_0x187e20,_0x40ead3){_0x40ead3=_0x40ead3||0xc8;return function(_0x24c956){if(_0x24c956){return _0x187e20['status'](_0x40ead3)[_0x5e68('0x1b')](_0x24c956);}};}function respondWithFilteredResult(_0x19bb7d,_0x27fc90){return function(_0x450957){if(_0x450957){var _0x4e9ae9=typeof _0x27fc90['offset']==='undefined'&&typeof _0x27fc90[_0x5e68('0x1c')]===_0x5e68('0x1d');var _0x3b5592=_0x450957['count'];var _0x3d7803=_0x4e9ae9?0x0:_0x27fc90['offset'];var _0x246ec7=_0x4e9ae9?_0x450957['count']:_0x27fc90[_0x5e68('0x1e')]+_0x27fc90[_0x5e68('0x1c')];var _0x1eb730;if(_0x246ec7>=_0x3b5592){_0x246ec7=_0x3b5592;_0x1eb730=0xc8;}else{_0x1eb730=0xce;}_0x19bb7d[_0x5e68('0x19')](_0x1eb730);return _0x19bb7d[_0x5e68('0x1f')](_0x5e68('0x20'),_0x3d7803+'-'+_0x246ec7+'/'+_0x3b5592)[_0x5e68('0x1b')](_0x450957);}return null;};}function patchUpdates(_0x2052a7){return function(_0x1bf07a){try{jsonpatch['apply'](_0x1bf07a,_0x2052a7,!![]);}catch(_0x1c4b9b){return BPromise[_0x5e68('0x21')](_0x1c4b9b);}return _0x1bf07a['save']();};}function saveUpdates(_0x13c509,_0x503c90){return function(_0x5c0986){if(_0x5c0986){return _0x5c0986[_0x5e68('0x22')](_0x13c509)['then'](function(_0x20e84e){return _0x20e84e;});}return null;};}function removeEntity(_0x24fd12,_0x1db798){return function(_0x14254b){if(_0x14254b){return _0x14254b[_0x5e68('0x23')]()[_0x5e68('0x24')](function(){_0x24fd12[_0x5e68('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e3ff,_0x308e80){return function(_0x3e953e){if(!_0x3e953e){_0x4e3ff[_0x5e68('0x25')](0x194);}return _0x3e953e;};}function handleError(_0x4a1f84,_0x524988){_0x524988=_0x524988||0x1f4;return function(_0x54884d){logger[_0x5e68('0x26')](_0x54884d[_0x5e68('0x27')]);if(_0x54884d[_0x5e68('0x28')]){delete _0x54884d[_0x5e68('0x28')];}_0x4a1f84['status'](_0x524988)[_0x5e68('0x29')](_0x54884d);};}exports[_0x5e68('0x2a')]=function(_0xd3357,_0x34d599){var _0x999ce2={},_0x45e431={},_0xaf94fc={'count':0x0,'rows':[]};var _0xa49603=_[_0x5e68('0x2b')](db[_0x5e68('0x2c')][_0x5e68('0x2d')],function(_0x3b0372){return{'name':_0x3b0372[_0x5e68('0x2e')],'type':_0x3b0372['type']['key']};});_0x45e431[_0x5e68('0x2f')]=_[_0x5e68('0x2b')](_0xa49603,_0x5e68('0x28'));_0x45e431[_0x5e68('0x30')]=_[_0x5e68('0x31')](_0xd3357['query']);_0x45e431['filters']=_[_0x5e68('0x32')](_0x45e431[_0x5e68('0x2f')],_0x45e431[_0x5e68('0x30')]);_0x999ce2[_0x5e68('0x33')]=_[_0x5e68('0x32')](_0x45e431[_0x5e68('0x2f')],qs['fields'](_0xd3357['query'][_0x5e68('0x34')]));_0x999ce2[_0x5e68('0x33')]=_0x999ce2[_0x5e68('0x33')][_0x5e68('0x35')]?_0x999ce2[_0x5e68('0x33')]:_0x45e431[_0x5e68('0x2f')];if(!_0xd3357['query'][_0x5e68('0x36')](_0x5e68('0x37'))){_0x999ce2['limit']=qs['limit'](_0xd3357[_0x5e68('0x30')][_0x5e68('0x1c')]);_0x999ce2[_0x5e68('0x1e')]=qs[_0x5e68('0x1e')](_0xd3357[_0x5e68('0x30')][_0x5e68('0x1e')]);}_0x999ce2['order']=qs[_0x5e68('0x38')](_0xd3357[_0x5e68('0x30')][_0x5e68('0x38')]);_0x999ce2[_0x5e68('0x39')]=qs[_0x5e68('0x3a')](_[_0x5e68('0x3b')](_0xd3357[_0x5e68('0x30')],_0x45e431[_0x5e68('0x3a')]),_0xa49603);if(_0xd3357[_0x5e68('0x30')][_0x5e68('0x3c')]){_0x999ce2[_0x5e68('0x39')]=_[_0x5e68('0x3d')](_0x999ce2[_0x5e68('0x39')],{'$or':_['map'](_0xa49603,function(_0x2cdb55){if(_0x2cdb55[_0x5e68('0x3e')]!==_0x5e68('0x3f')){var _0x4b0cd9={};_0x4b0cd9[_0x2cdb55[_0x5e68('0x28')]]={'$like':'%'+_0xd3357[_0x5e68('0x30')][_0x5e68('0x3c')]+'%'};return _0x4b0cd9;}})});}_0x999ce2=_[_0x5e68('0x3d')]({},_0x999ce2,_0xd3357['options']);var _0x59e7d0={'where':_0x999ce2['where']};return db[_0x5e68('0x2c')][_0x5e68('0x40')](_0x59e7d0)[_0x5e68('0x24')](function(_0x17af89){_0xaf94fc[_0x5e68('0x40')]=_0x17af89;if(_0xd3357[_0x5e68('0x30')][_0x5e68('0x41')]){_0x999ce2[_0x5e68('0x42')]=[{'all':!![]}];}return db[_0x5e68('0x2c')][_0x5e68('0x43')](_0x999ce2);})['then'](function(_0x35b07e){_0xaf94fc[_0x5e68('0x44')]=_0x35b07e;return _0xaf94fc;})['then'](respondWithFilteredResult(_0x34d599,_0x999ce2))[_0x5e68('0x45')](handleError(_0x34d599,null));};exports['show']=function(_0x2b7812,_0x5b6391){var _0x363d1c={'raw':!![],'where':{'id':_0x2b7812[_0x5e68('0x46')]['id']}},_0x2e20e3={};_0x2e20e3[_0x5e68('0x2f')]=_[_0x5e68('0x31')](db[_0x5e68('0x2c')][_0x5e68('0x2d')]);_0x2e20e3[_0x5e68('0x30')]=_[_0x5e68('0x31')](_0x2b7812[_0x5e68('0x30')]);_0x2e20e3[_0x5e68('0x3a')]=_['intersection'](_0x2e20e3['model'],_0x2e20e3[_0x5e68('0x30')]);_0x363d1c['attributes']=_[_0x5e68('0x32')](_0x2e20e3[_0x5e68('0x2f')],qs['fields'](_0x2b7812[_0x5e68('0x30')]['fields']));_0x363d1c[_0x5e68('0x33')]=_0x363d1c['attributes'][_0x5e68('0x35')]?_0x363d1c[_0x5e68('0x33')]:_0x2e20e3['model'];if(_0x2b7812[_0x5e68('0x30')][_0x5e68('0x41')]){_0x363d1c[_0x5e68('0x42')]=[{'all':!![]}];}_0x363d1c=_[_0x5e68('0x3d')]({},_0x363d1c,_0x2b7812['options']);return db[_0x5e68('0x2c')][_0x5e68('0x47')](_0x363d1c)[_0x5e68('0x24')](handleEntityNotFound(_0x5b6391,null))[_0x5e68('0x24')](respondWithResult(_0x5b6391,null))[_0x5e68('0x45')](handleError(_0x5b6391,null));};exports[_0x5e68('0x48')]=function(_0x84d2ec,_0x26e50c){return db['Dynamics365Field']['create'](_0x84d2ec[_0x5e68('0x49')],{})[_0x5e68('0x24')](respondWithResult(_0x26e50c,0xc9))[_0x5e68('0x45')](handleError(_0x26e50c,null));};exports[_0x5e68('0x22')]=function(_0x327efb,_0x4e28eb){if(_0x327efb[_0x5e68('0x49')]['id']){delete _0x327efb[_0x5e68('0x49')]['id'];}return db['Dynamics365Field'][_0x5e68('0x47')]({'where':{'id':_0x327efb['params']['id']}})['then'](handleEntityNotFound(_0x4e28eb,null))[_0x5e68('0x24')](saveUpdates(_0x327efb[_0x5e68('0x49')],null))['then'](respondWithResult(_0x4e28eb,null))['catch'](handleError(_0x4e28eb,null));};exports[_0x5e68('0x23')]=function(_0x5235ab,_0x36ec19){return db[_0x5e68('0x2c')][_0x5e68('0x47')]({'where':{'id':_0x5235ab[_0x5e68('0x46')]['id']}})[_0x5e68('0x24')](handleEntityNotFound(_0x36ec19,null))[_0x5e68('0x24')](removeEntity(_0x36ec19,null))[_0x5e68('0x45')](handleError(_0x36ec19,null));}; \ No newline at end of file +var _0x3e71=['fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','Dynamics365Field','includeAll','include','rows','catch','show','params','options','create','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','rawAttributes'];(function(_0x58dbb8,_0x43ff61){var _0x1e83c5=function(_0x299565){while(--_0x299565){_0x58dbb8['push'](_0x58dbb8['shift']());}};_0x1e83c5(++_0x43ff61);}(_0x3e71,0x68));var _0x13e7=function(_0x33be46,_0x216dc3){_0x33be46=_0x33be46-0x0;var _0x35bcda=_0x3e71[_0x33be46];return _0x35bcda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13e7('0x1'));var rp=require(_0x13e7('0x2'));var moment=require('moment');var BPromise=require(_0x13e7('0x3'));var Mustache=require(_0x13e7('0x4'));var util=require('util');var path=require(_0x13e7('0x5'));var sox=require(_0x13e7('0x6'));var csv=require(_0x13e7('0x7'));var ejs=require(_0x13e7('0x8'));var fs=require('fs');var fs_extra=require(_0x13e7('0x9'));var _=require('lodash');var squel=require(_0x13e7('0xa'));var crypto=require('crypto');var jsforce=require(_0x13e7('0xb'));var deskjs=require(_0x13e7('0xc'));var toCsv=require(_0x13e7('0x7'));var querystring=require(_0x13e7('0xd'));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(_0x13e7('0xe'));var logger=require(_0x13e7('0xf'))(_0x13e7('0x10'));var utils=require(_0x13e7('0x11'));var config=require(_0x13e7('0x12'));var licenseUtil=require(_0x13e7('0x13'));var db=require(_0x13e7('0x14'))['db'];function respondWithStatusCode(_0x5360ff,_0x59db22){_0x59db22=_0x59db22||0xcc;return function(_0x35f338){if(_0x35f338){return _0x5360ff[_0x13e7('0x15')](_0x59db22);}return _0x5360ff['status'](_0x59db22)[_0x13e7('0x16')]();};}function respondWithResult(_0xb558b1,_0x5823b8){_0x5823b8=_0x5823b8||0xc8;return function(_0x4e93f5){if(_0x4e93f5){return _0xb558b1[_0x13e7('0x17')](_0x5823b8)[_0x13e7('0x18')](_0x4e93f5);}};}function respondWithFilteredResult(_0x4ae3fc,_0x2832ea){return function(_0x3c44b0){if(_0x3c44b0){var _0x3dcf80=typeof _0x2832ea[_0x13e7('0x19')]===_0x13e7('0x1a')&&typeof _0x2832ea[_0x13e7('0x1b')]===_0x13e7('0x1a');var _0x2b6f07=_0x3c44b0[_0x13e7('0x1c')];var _0x2f97b3=_0x3dcf80?0x0:_0x2832ea['offset'];var _0x1a43aa=_0x3dcf80?_0x3c44b0['count']:_0x2832ea[_0x13e7('0x19')]+_0x2832ea['limit'];var _0x6430aa;if(_0x1a43aa>=_0x2b6f07){_0x1a43aa=_0x2b6f07;_0x6430aa=0xc8;}else{_0x6430aa=0xce;}_0x4ae3fc[_0x13e7('0x17')](_0x6430aa);return _0x4ae3fc[_0x13e7('0x1d')](_0x13e7('0x1e'),_0x2f97b3+'-'+_0x1a43aa+'/'+_0x2b6f07)[_0x13e7('0x18')](_0x3c44b0);}return null;};}function patchUpdates(_0x594629){return function(_0x145567){try{jsonpatch[_0x13e7('0x1f')](_0x145567,_0x594629,!![]);}catch(_0x441693){return BPromise['reject'](_0x441693);}return _0x145567['save']();};}function saveUpdates(_0x19c282,_0x8817b2){return function(_0x52090a){if(_0x52090a){return _0x52090a[_0x13e7('0x20')](_0x19c282)['then'](function(_0x232b1a){return _0x232b1a;});}return null;};}function removeEntity(_0x58a0ee,_0x1bf65d){return function(_0x48f0de){if(_0x48f0de){return _0x48f0de[_0x13e7('0x21')]()[_0x13e7('0x22')](function(){_0x58a0ee[_0x13e7('0x17')](0xcc)[_0x13e7('0x16')]();});}};}function handleEntityNotFound(_0x5cbf77,_0x4f2f5f){return function(_0x310134){if(!_0x310134){_0x5cbf77[_0x13e7('0x15')](0x194);}return _0x310134;};}function handleError(_0xe115ad,_0x3894db){_0x3894db=_0x3894db||0x1f4;return function(_0x10b409){logger[_0x13e7('0x23')](_0x10b409[_0x13e7('0x24')]);if(_0x10b409[_0x13e7('0x25')]){delete _0x10b409[_0x13e7('0x25')];}_0xe115ad['status'](_0x3894db)[_0x13e7('0x26')](_0x10b409);};}exports[_0x13e7('0x27')]=function(_0x3df28a,_0x58b040){var _0x478683={},_0x44074e={},_0x5d488a={'count':0x0,'rows':[]};var _0x1109de=_[_0x13e7('0x28')](db['Dynamics365Field'][_0x13e7('0x29')],function(_0x438ce3){return{'name':_0x438ce3[_0x13e7('0x2a')],'type':_0x438ce3[_0x13e7('0x2b')][_0x13e7('0x2c')]};});_0x44074e['model']=_['map'](_0x1109de,_0x13e7('0x25'));_0x44074e[_0x13e7('0x2d')]=_[_0x13e7('0x2e')](_0x3df28a['query']);_0x44074e['filters']=_['intersection'](_0x44074e[_0x13e7('0x2f')],_0x44074e[_0x13e7('0x2d')]);_0x478683[_0x13e7('0x30')]=_[_0x13e7('0x31')](_0x44074e[_0x13e7('0x2f')],qs['fields'](_0x3df28a[_0x13e7('0x2d')][_0x13e7('0x32')]));_0x478683[_0x13e7('0x30')]=_0x478683['attributes'][_0x13e7('0x33')]?_0x478683['attributes']:_0x44074e[_0x13e7('0x2f')];if(!_0x3df28a[_0x13e7('0x2d')][_0x13e7('0x34')](_0x13e7('0x35'))){_0x478683['limit']=qs[_0x13e7('0x1b')](_0x3df28a[_0x13e7('0x2d')]['limit']);_0x478683[_0x13e7('0x19')]=qs['offset'](_0x3df28a[_0x13e7('0x2d')]['offset']);}_0x478683[_0x13e7('0x36')]=qs[_0x13e7('0x37')](_0x3df28a['query'][_0x13e7('0x37')]);_0x478683[_0x13e7('0x38')]=qs[_0x13e7('0x39')](_[_0x13e7('0x3a')](_0x3df28a[_0x13e7('0x2d')],_0x44074e[_0x13e7('0x39')]),_0x1109de);if(_0x3df28a[_0x13e7('0x2d')]['filter']){_0x478683[_0x13e7('0x38')]=_[_0x13e7('0x3b')](_0x478683[_0x13e7('0x38')],{'$or':_[_0x13e7('0x28')](_0x1109de,function(_0xb7eae6){if(_0xb7eae6[_0x13e7('0x2b')]!==_0x13e7('0x3c')){var _0xdff89={};_0xdff89[_0xb7eae6[_0x13e7('0x25')]]={'$like':'%'+_0x3df28a['query'][_0x13e7('0x3d')]+'%'};return _0xdff89;}})});}_0x478683=_[_0x13e7('0x3b')]({},_0x478683,_0x3df28a['options']);var _0x17869d={'where':_0x478683[_0x13e7('0x38')]};return db[_0x13e7('0x3e')]['count'](_0x17869d)[_0x13e7('0x22')](function(_0x2212a5){_0x5d488a['count']=_0x2212a5;if(_0x3df28a['query'][_0x13e7('0x3f')]){_0x478683[_0x13e7('0x40')]=[{'all':!![]}];}return db[_0x13e7('0x3e')]['findAll'](_0x478683);})[_0x13e7('0x22')](function(_0x287d44){_0x5d488a[_0x13e7('0x41')]=_0x287d44;return _0x5d488a;})[_0x13e7('0x22')](respondWithFilteredResult(_0x58b040,_0x478683))[_0x13e7('0x42')](handleError(_0x58b040,null));};exports[_0x13e7('0x43')]=function(_0x237485,_0x162cf8){var _0x43f031={'raw':!![],'where':{'id':_0x237485[_0x13e7('0x44')]['id']}},_0x21a00c={};_0x21a00c[_0x13e7('0x2f')]=_['keys'](db[_0x13e7('0x3e')][_0x13e7('0x29')]);_0x21a00c[_0x13e7('0x2d')]=_['keys'](_0x237485['query']);_0x21a00c[_0x13e7('0x39')]=_[_0x13e7('0x31')](_0x21a00c[_0x13e7('0x2f')],_0x21a00c['query']);_0x43f031['attributes']=_[_0x13e7('0x31')](_0x21a00c['model'],qs[_0x13e7('0x32')](_0x237485['query'][_0x13e7('0x32')]));_0x43f031[_0x13e7('0x30')]=_0x43f031[_0x13e7('0x30')]['length']?_0x43f031[_0x13e7('0x30')]:_0x21a00c[_0x13e7('0x2f')];if(_0x237485['query'][_0x13e7('0x3f')]){_0x43f031[_0x13e7('0x40')]=[{'all':!![]}];}_0x43f031=_[_0x13e7('0x3b')]({},_0x43f031,_0x237485[_0x13e7('0x45')]);return db['Dynamics365Field']['find'](_0x43f031)['then'](handleEntityNotFound(_0x162cf8,null))[_0x13e7('0x22')](respondWithResult(_0x162cf8,null))['catch'](handleError(_0x162cf8,null));};exports[_0x13e7('0x46')]=function(_0x129b35,_0x16e580){return db[_0x13e7('0x3e')][_0x13e7('0x46')](_0x129b35[_0x13e7('0x47')],{})['then'](respondWithResult(_0x16e580,0xc9))[_0x13e7('0x42')](handleError(_0x16e580,null));};exports['update']=function(_0xfb49,_0x1f1c3c){if(_0xfb49[_0x13e7('0x47')]['id']){delete _0xfb49['body']['id'];}return db[_0x13e7('0x3e')]['find']({'where':{'id':_0xfb49[_0x13e7('0x44')]['id']}})[_0x13e7('0x22')](handleEntityNotFound(_0x1f1c3c,null))['then'](saveUpdates(_0xfb49[_0x13e7('0x47')],null))[_0x13e7('0x22')](respondWithResult(_0x1f1c3c,null))[_0x13e7('0x42')](handleError(_0x1f1c3c,null));};exports['destroy']=function(_0x1bbf64,_0x59a3ea){return db[_0x13e7('0x3e')][_0x13e7('0x48')]({'where':{'id':_0x1bbf64[_0x13e7('0x44')]['id']}})[_0x13e7('0x22')](handleEntityNotFound(_0x59a3ea,null))[_0x13e7('0x22')](removeEntity(_0x59a3ea,null))[_0x13e7('0x42')](handleError(_0x59a3ea,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 963e36e..0e3c3aa 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 _0x422a=['util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x422a,0x12b));var _0xa422=function(_0x3943a0,_0x546510){_0x3943a0=_0x3943a0-0x0;var _0x132d6e=_0x422a[_0x3943a0];return _0x132d6e;};'use strict';var _=require(_0xa422('0x0'));var util=require(_0xa422('0x1'));var logger=require('../../config/logger')(_0xa422('0x2'));var moment=require(_0xa422('0x3'));var BPromise=require(_0xa422('0x4'));var rp=require(_0xa422('0x5'));var fs=require('fs');var path=require(_0xa422('0x6'));var rimraf=require(_0xa422('0x7'));var config=require('../../config/environment');var attributes=require(_0xa422('0x8'));module[_0xa422('0x9')]=function(_0x3f5786,_0x422a50){return _0x3f5786['define'](_0xa422('0xa'),attributes,{'tableName':_0xa422('0xb'),'paranoid':![],'indexes':[{'name':_0xa422('0xc'),'fields':[_0xa422('0xd'),_0xa422('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0e3=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x4533c4,_0x10cd99){var _0x2fd2aa=function(_0x44bdcd){while(--_0x44bdcd){_0x4533c4['push'](_0x4533c4['shift']());}};_0x2fd2aa(++_0x10cd99);}(_0xb0e3,0xf6));var _0x3b0e=function(_0x26ad2f,_0x471a63){_0x26ad2f=_0x26ad2f-0x0;var _0x5277d3=_0xb0e3[_0x26ad2f];return _0x5277d3;};'use strict';var _=require(_0x3b0e('0x0'));var util=require('util');var logger=require(_0x3b0e('0x1'))(_0x3b0e('0x2'));var moment=require(_0x3b0e('0x3'));var BPromise=require(_0x3b0e('0x4'));var rp=require(_0x3b0e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b0e('0x6'));var config=require(_0x3b0e('0x7'));var attributes=require(_0x3b0e('0x8'));module[_0x3b0e('0x9')]=function(_0x2f4289,_0x5da566){return _0x2f4289[_0x3b0e('0xa')](_0x3b0e('0xb'),attributes,{'tableName':_0x3b0e('0xc'),'paranoid':![],'indexes':[{'name':_0x3b0e('0xd'),'fields':['idField',_0x3b0e('0xe')],'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 6d4928c..0b9e5ec 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 _0x0cfc=['request','then','info','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x11a879,_0x1d692a){var _0x5447b1=function(_0x37ac51){while(--_0x37ac51){_0x11a879['push'](_0x11a879['shift']());}};_0x5447b1(++_0x1d692a);}(_0x0cfc,0x8f));var _0xc0cf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0cfc[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xc0cf('0x0'));var moment=require(_0xc0cf('0x1'));var BPromise=require(_0xc0cf('0x2'));var rs=require(_0xc0cf('0x3'));var fs=require('fs');var Redis=require(_0xc0cf('0x4'));var db=require(_0xc0cf('0x5'))['db'];var utils=require(_0xc0cf('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0cf('0x7'));var jayson=require(_0xc0cf('0x8'));var client=jayson[_0xc0cf('0x9')][_0xc0cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f219d,_0x3bd9ff,_0x318bca){return new BPromise(function(_0x109ee9,_0x2e0860){return client[_0xc0cf('0xb')](_0x4f219d,_0x318bca)[_0xc0cf('0xc')](function(_0x45942f){logger[_0xc0cf('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3bd9ff,_0xc0cf('0xe'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3bd9ff,_0xc0cf('0xe'),JSON[_0xc0cf('0xf')](_0x45942f));if(_0x45942f[_0xc0cf('0x10')]){if(_0x45942f['error'][_0xc0cf('0x11')]===0x1f4){logger[_0xc0cf('0x10')](_0xc0cf('0x12'),_0x3bd9ff,_0x45942f[_0xc0cf('0x10')]['message']);return _0x2e0860(_0x45942f[_0xc0cf('0x10')][_0xc0cf('0x13')]);}logger[_0xc0cf('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3bd9ff,_0x45942f['error'][_0xc0cf('0x13')]);return _0x109ee9(_0x45942f[_0xc0cf('0x10')][_0xc0cf('0x13')]);}else{logger[_0xc0cf('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3bd9ff,_0xc0cf('0xe'));_0x109ee9(_0x45942f[_0xc0cf('0x14')][_0xc0cf('0x13')]);}})[_0xc0cf('0x15')](function(_0x1b6215){logger['error'](_0xc0cf('0x12'),_0x3bd9ff,_0x1b6215);_0x2e0860(_0x1b6215);});});} \ No newline at end of file +var _0xc880=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x47eb31,_0x33de43){var _0x568e09=function(_0x115893){while(--_0x115893){_0x47eb31['push'](_0x47eb31['shift']());}};_0x568e09(++_0x33de43);}(_0xc880,0x1a6));var _0x0c88=function(_0x1af4fd,_0x281909){_0x1af4fd=_0x1af4fd-0x0;var _0x3874e9=_0xc880[_0x1af4fd];return _0x3874e9;};'use strict';var _=require(_0x0c88('0x0'));var util=require(_0x0c88('0x1'));var moment=require(_0x0c88('0x2'));var BPromise=require(_0x0c88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c88('0x4'));var db=require(_0x0c88('0x5'))['db'];var utils=require(_0x0c88('0x6'));var logger=require(_0x0c88('0x7'))('rpc');var config=require(_0x0c88('0x8'));var jayson=require(_0x0c88('0x9'));var client=jayson[_0x0c88('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58ab02,_0x2702c6,_0x1fa841){return new BPromise(function(_0x2e3aef,_0xd0dd89){return client['request'](_0x58ab02,_0x1fa841)[_0x0c88('0xb')](function(_0x1b6126){logger['info'](_0x0c88('0xc'),_0x2702c6,_0x0c88('0xd'));logger[_0x0c88('0xe')](_0x0c88('0xf'),_0x2702c6,'request\x20sent',JSON['stringify'](_0x1b6126));if(_0x1b6126['error']){if(_0x1b6126[_0x0c88('0x10')]['code']===0x1f4){logger['error'](_0x0c88('0xc'),_0x2702c6,_0x1b6126['error'][_0x0c88('0x11')]);return _0xd0dd89(_0x1b6126[_0x0c88('0x10')][_0x0c88('0x11')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2702c6,_0x1b6126['error']['message']);return _0x2e3aef(_0x1b6126['error']['message']);}else{logger[_0x0c88('0x12')](_0x0c88('0xc'),_0x2702c6,_0x0c88('0xd'));_0x2e3aef(_0x1b6126[_0x0c88('0x13')][_0x0c88('0x11')]);}})[_0x0c88('0x14')](function(_0x7e7ec2){logger[_0x0c88('0x10')](_0x0c88('0xc'),_0x2702c6,_0x7e7ec2);_0xd0dd89(_0x7e7ec2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 49ca074..b8b4c6d 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 _0x0930=['/:id','show','/:id/configurations','/:id/fields','create','post','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x22e2c5,_0x115b33){var _0x19e58d=function(_0x11f4ea){while(--_0x11f4ea){_0x22e2c5['push'](_0x22e2c5['shift']());}};_0x19e58d(++_0x115b33);}(_0x0930,0x126));var _0x0093=function(_0x4c2bc5,_0x4984e2){_0x4c2bc5=_0x4c2bc5-0x0;var _0x487209=_0x0930[_0x4c2bc5];return _0x487209;};'use strict';var multer=require('multer');var util=require(_0x0093('0x0'));var path=require('path');var timeout=require(_0x0093('0x1'));var express=require(_0x0093('0x2'));var router=express[_0x0093('0x3')]();var fs_extra=require(_0x0093('0x4'));var auth=require(_0x0093('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0093('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x0093('0x7')]('/',auth[_0x0093('0x8')](),controller[_0x0093('0x9')]);router[_0x0093('0x7')](_0x0093('0xa'),auth[_0x0093('0x8')](),controller[_0x0093('0xb')]);router[_0x0093('0x7')](_0x0093('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x0093('0xd'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x0093('0x8')](),controller[_0x0093('0xe')]);router[_0x0093('0xf')](_0x0093('0xc'),auth[_0x0093('0x8')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0093('0x10')](_0x0093('0xa'),auth[_0x0093('0x8')](),controller[_0x0093('0x11')]);module[_0x0093('0x12')]=router; \ No newline at end of file +var _0xa5c1=['/:id','show','/:id/configurations','isAuthenticated','/:id/fields','getFields','create','post','addConfiguration','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x440df5,_0x49237a){var _0x40e0d5=function(_0x5ad5a9){while(--_0x5ad5a9){_0x440df5['push'](_0x440df5['shift']());}};_0x40e0d5(++_0x49237a);}(_0xa5c1,0x95));var _0x1a5c=function(_0x3ed5df,_0x271c72){_0x3ed5df=_0x3ed5df-0x0;var _0x360d39=_0xa5c1[_0x3ed5df];return _0x360d39;};'use strict';var multer=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var path=require(_0x1a5c('0x2'));var timeout=require(_0x1a5c('0x3'));var express=require(_0x1a5c('0x4'));var router=express[_0x1a5c('0x5')]();var fs_extra=require(_0x1a5c('0x6'));var auth=require(_0x1a5c('0x7'));var interaction=require(_0x1a5c('0x8'));var config=require(_0x1a5c('0x9'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1a5c('0xa')]);router[_0x1a5c('0xb')](_0x1a5c('0xc'),auth['isAuthenticated'](),controller[_0x1a5c('0xd')]);router[_0x1a5c('0xb')](_0x1a5c('0xe'),auth[_0x1a5c('0xf')](),controller['getConfigurations']);router['get'](_0x1a5c('0x10'),auth[_0x1a5c('0xf')](),controller[_0x1a5c('0x11')]);router['post']('/',auth[_0x1a5c('0xf')](),controller[_0x1a5c('0x12')]);router[_0x1a5c('0x13')](_0x1a5c('0xe'),auth['isAuthenticated'](),controller[_0x1a5c('0x14')]);router['put']('/:id',auth[_0x1a5c('0xf')](),controller[_0x1a5c('0x15')]);router[_0x1a5c('0x16')](_0x1a5c('0xc'),auth[_0x1a5c('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0ab891d..3db1c17 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 _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x47844,_0x413cca){var _0x23a86a=function(_0x22ee63){while(--_0x22ee63){_0x47844['push'](_0x47844['shift']());}};_0x23a86a(++_0x413cca);}(_0xd943,0x15d));var _0x3d94=function(_0x181380,_0x382e2f){_0x181380=_0x181380-0x0;var _0x97c0c5=_0xd943[_0x181380];return _0x97c0c5;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize[_0x3d94('0x2')]},'description':{'type':Sequelize[_0x3d94('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3d94('0x3')},'apiKey':{'type':Sequelize[_0x3d94('0x2')]},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'unique':_0x3d94('0x4')},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf4f4=['exports','STRING','username','sequelize'];(function(_0x3bbd6b,_0x498df1){var _0x1d27fc=function(_0x2d7be7){while(--_0x2d7be7){_0x3bbd6b['push'](_0x3bbd6b['shift']());}};_0x1d27fc(++_0x498df1);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x7b3ebf,_0x58145b){_0x7b3ebf=_0x7b3ebf-0x0;var _0x2a8186=_0xf4f4[_0x7b3ebf];return _0x2a8186;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f4f('0x2')]},'username':{'type':Sequelize[_0x4f4f('0x2')],'unique':_0x4f4f('0x3')},'apiKey':{'type':Sequelize[_0x4f4f('0x2')]},'remoteUri':{'type':Sequelize[_0x4f4f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4f4f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a24a173..a0a2a5e 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 _0xfa7c=['custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','update','then','destroy','error','name','send','FreshdeskAccount','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','include','rows','show','params','rawAttributes','includeAll','find','create','body','catch','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','default'];(function(_0x4f2446,_0x4964f1){var _0x96419e=function(_0x1f2964){while(--_0x1f2964){_0x4f2446['push'](_0x4f2446['shift']());}};_0x96419e(++_0x4964f1);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x2fd759,_0x5f2949){_0x2fd759=_0x2fd759-0x0;var _0x3840ae=_0xfa7c[_0x2fd759];return _0x3840ae;};'use strict';var emlformat=require(_0xcfa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfa7('0x1'));var jsonpatch=require(_0xcfa7('0x2'));var rp=require(_0xcfa7('0x3'));var moment=require(_0xcfa7('0x4'));var BPromise=require(_0xcfa7('0x5'));var Mustache=require(_0xcfa7('0x6'));var util=require(_0xcfa7('0x7'));var path=require(_0xcfa7('0x8'));var sox=require('sox');var csv=require(_0xcfa7('0x9'));var ejs=require(_0xcfa7('0xa'));var fs=require('fs');var fs_extra=require(_0xcfa7('0xb'));var _=require(_0xcfa7('0xc'));var squel=require('squel');var crypto=require(_0xcfa7('0xd'));var jsforce=require(_0xcfa7('0xe'));var deskjs=require(_0xcfa7('0xf'));var toCsv=require(_0xcfa7('0x9'));var querystring=require(_0xcfa7('0x10'));var Papa=require(_0xcfa7('0x11'));var Redis=require('ioredis');var authService=require(_0xcfa7('0x12'));var qs=require(_0xcfa7('0x13'));var as=require(_0xcfa7('0x14'));var hardwareService=require(_0xcfa7('0x15'));var logger=require(_0xcfa7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcfa7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcfa7('0x18'))['db'];var integrations=require(_0xcfa7('0x19'));function respondWithStatusCode(_0x53d0fb,_0x299280){_0x299280=_0x299280||0xcc;return function(_0x248c9b){if(_0x248c9b){return _0x53d0fb[_0xcfa7('0x1a')](_0x299280);}return _0x53d0fb[_0xcfa7('0x1b')](_0x299280)[_0xcfa7('0x1c')]();};}function respondWithResult(_0x578718,_0x42500c){_0x42500c=_0x42500c||0xc8;return function(_0x54acf6){if(_0x54acf6){return _0x578718['status'](_0x42500c)[_0xcfa7('0x1d')](_0x54acf6);}};}function respondWithFilteredResult(_0x470a55,_0x29cef5){return function(_0x349679){if(_0x349679){var _0x23b1fb=typeof _0x29cef5['offset']===_0xcfa7('0x1e')&&typeof _0x29cef5[_0xcfa7('0x1f')]===_0xcfa7('0x1e');var _0x266eb9=_0x349679['count'];var _0x21f73c=_0x23b1fb?0x0:_0x29cef5[_0xcfa7('0x20')];var _0x558a21=_0x23b1fb?_0x349679['count']:_0x29cef5[_0xcfa7('0x20')]+_0x29cef5[_0xcfa7('0x1f')];var _0x1ce356;if(_0x558a21>=_0x266eb9){_0x558a21=_0x266eb9;_0x1ce356=0xc8;}else{_0x1ce356=0xce;}_0x470a55[_0xcfa7('0x1b')](_0x1ce356);return _0x470a55[_0xcfa7('0x21')](_0xcfa7('0x22'),_0x21f73c+'-'+_0x558a21+'/'+_0x266eb9)[_0xcfa7('0x1d')](_0x349679);}return null;};}function patchUpdates(_0x602f15){return function(_0x548ef7){try{jsonpatch[_0xcfa7('0x23')](_0x548ef7,_0x602f15,!![]);}catch(_0x4f8e72){return BPromise['reject'](_0x4f8e72);}return _0x548ef7['save']();};}function saveUpdates(_0xdf35fa,_0x49e624){return function(_0x2fba8b){if(_0x2fba8b){return _0x2fba8b[_0xcfa7('0x24')](_0xdf35fa)[_0xcfa7('0x25')](function(_0x3423ad){return _0x3423ad;});}return null;};}function removeEntity(_0xdd7c11,_0x2d00e1){return function(_0x1562c8){if(_0x1562c8){return _0x1562c8[_0xcfa7('0x26')]()['then'](function(){_0xdd7c11[_0xcfa7('0x1b')](0xcc)[_0xcfa7('0x1c')]();});}};}function handleEntityNotFound(_0x312efb,_0x1d5e9c){return function(_0x47f4ac){if(!_0x47f4ac){_0x312efb[_0xcfa7('0x1a')](0x194);}return _0x47f4ac;};}function handleError(_0xabfa5b,_0x3fece6){_0x3fece6=_0x3fece6||0x1f4;return function(_0x29f6d0){logger[_0xcfa7('0x27')](_0x29f6d0['stack']);if(_0x29f6d0[_0xcfa7('0x28')]){delete _0x29f6d0[_0xcfa7('0x28')];}_0xabfa5b[_0xcfa7('0x1b')](_0x3fece6)[_0xcfa7('0x29')](_0x29f6d0);};}exports['index']=function(_0x4c8bf0,_0x569f4e){var _0x10f85f={},_0xdcdae7={},_0x2fd1bd={'count':0x0,'rows':[]};var _0x5b17f5=_['map'](db[_0xcfa7('0x2a')]['rawAttributes'],function(_0x569016){return{'name':_0x569016[_0xcfa7('0x2b')],'type':_0x569016[_0xcfa7('0x2c')][_0xcfa7('0x2d')]};});_0xdcdae7[_0xcfa7('0x2e')]=_[_0xcfa7('0x2f')](_0x5b17f5,_0xcfa7('0x28'));_0xdcdae7[_0xcfa7('0x30')]=_[_0xcfa7('0x31')](_0x4c8bf0['query']);_0xdcdae7['filters']=_[_0xcfa7('0x32')](_0xdcdae7[_0xcfa7('0x2e')],_0xdcdae7[_0xcfa7('0x30')]);_0x10f85f['attributes']=_['intersection'](_0xdcdae7[_0xcfa7('0x2e')],qs[_0xcfa7('0x33')](_0x4c8bf0[_0xcfa7('0x30')]['fields']));_0x10f85f[_0xcfa7('0x34')]=_0x10f85f['attributes'][_0xcfa7('0x35')]?_0x10f85f['attributes']:_0xdcdae7[_0xcfa7('0x2e')];if(!_0x4c8bf0[_0xcfa7('0x30')][_0xcfa7('0x36')](_0xcfa7('0x37'))){_0x10f85f[_0xcfa7('0x1f')]=qs[_0xcfa7('0x1f')](_0x4c8bf0[_0xcfa7('0x30')]['limit']);_0x10f85f[_0xcfa7('0x20')]=qs[_0xcfa7('0x20')](_0x4c8bf0[_0xcfa7('0x30')][_0xcfa7('0x20')]);}_0x10f85f[_0xcfa7('0x38')]=qs[_0xcfa7('0x39')](_0x4c8bf0[_0xcfa7('0x30')][_0xcfa7('0x39')]);_0x10f85f[_0xcfa7('0x3a')]=qs[_0xcfa7('0x3b')](_['pick'](_0x4c8bf0['query'],_0xdcdae7[_0xcfa7('0x3b')]),_0x5b17f5);if(_0x4c8bf0['query'][_0xcfa7('0x3c')]){_0x10f85f[_0xcfa7('0x3a')]=_[_0xcfa7('0x3d')](_0x10f85f['where'],{'$or':_[_0xcfa7('0x2f')](_0x5b17f5,function(_0x43b619){if(_0x43b619['type']!==_0xcfa7('0x3e')){var _0x41b014={};_0x41b014[_0x43b619[_0xcfa7('0x28')]]={'$like':'%'+_0x4c8bf0['query'][_0xcfa7('0x3c')]+'%'};return _0x41b014;}})});}_0x10f85f=_[_0xcfa7('0x3d')]({},_0x10f85f,_0x4c8bf0[_0xcfa7('0x3f')]);var _0x1c8fc6={'where':_0x10f85f[_0xcfa7('0x3a')]};return db[_0xcfa7('0x2a')]['count'](_0x1c8fc6)[_0xcfa7('0x25')](function(_0x4ad534){_0x2fd1bd[_0xcfa7('0x40')]=_0x4ad534;if(_0x4c8bf0[_0xcfa7('0x30')]['includeAll']){_0x10f85f[_0xcfa7('0x41')]=[{'all':!![]}];}return db[_0xcfa7('0x2a')]['findAll'](_0x10f85f);})[_0xcfa7('0x25')](function(_0x5502d5){_0x2fd1bd[_0xcfa7('0x42')]=_0x5502d5;return _0x2fd1bd;})[_0xcfa7('0x25')](respondWithFilteredResult(_0x569f4e,_0x10f85f))['catch'](handleError(_0x569f4e,null));};exports[_0xcfa7('0x43')]=function(_0x3ff0e0,_0x441e86){var _0x98a340={'raw':![],'where':{'id':_0x3ff0e0[_0xcfa7('0x44')]['id']}},_0x194a96={};_0x194a96[_0xcfa7('0x2e')]=_[_0xcfa7('0x31')](db['FreshdeskAccount'][_0xcfa7('0x45')]);_0x194a96[_0xcfa7('0x30')]=_[_0xcfa7('0x31')](_0x3ff0e0[_0xcfa7('0x30')]);_0x194a96[_0xcfa7('0x3b')]=_['intersection'](_0x194a96[_0xcfa7('0x2e')],_0x194a96['query']);_0x98a340[_0xcfa7('0x34')]=_[_0xcfa7('0x32')](_0x194a96[_0xcfa7('0x2e')],qs['fields'](_0x3ff0e0[_0xcfa7('0x30')][_0xcfa7('0x33')]));_0x98a340[_0xcfa7('0x34')]=_0x98a340[_0xcfa7('0x34')][_0xcfa7('0x35')]?_0x98a340[_0xcfa7('0x34')]:_0x194a96['model'];if(_0x3ff0e0[_0xcfa7('0x30')][_0xcfa7('0x46')]){_0x98a340[_0xcfa7('0x41')]=[{'all':!![]}];}_0x98a340=_[_0xcfa7('0x3d')]({},_0x98a340,_0x3ff0e0[_0xcfa7('0x3f')]);return db[_0xcfa7('0x2a')][_0xcfa7('0x47')](_0x98a340)[_0xcfa7('0x25')](handleEntityNotFound(_0x441e86,null))[_0xcfa7('0x25')](respondWithResult(_0x441e86,null))['catch'](handleError(_0x441e86,null));};exports[_0xcfa7('0x48')]=function(_0x2e7800,_0x1c0bcb){return db[_0xcfa7('0x2a')][_0xcfa7('0x48')](_0x2e7800[_0xcfa7('0x49')],{})[_0xcfa7('0x25')](respondWithResult(_0x1c0bcb,0xc9))['catch'](handleError(_0x1c0bcb,null));};exports['update']=function(_0x33660d,_0x3b29ee){if(_0x33660d['body']['id']){delete _0x33660d[_0xcfa7('0x49')]['id'];}return db[_0xcfa7('0x2a')]['find']({'where':{'id':_0x33660d[_0xcfa7('0x44')]['id']}})[_0xcfa7('0x25')](handleEntityNotFound(_0x3b29ee,null))[_0xcfa7('0x25')](saveUpdates(_0x33660d['body'],null))[_0xcfa7('0x25')](respondWithResult(_0x3b29ee,null))[_0xcfa7('0x4a')](handleError(_0x3b29ee,null));};exports['destroy']=function(_0x2a471c,_0x16ea8b){return db[_0xcfa7('0x2a')][_0xcfa7('0x47')]({'where':{'id':_0x2a471c['params']['id']}})[_0xcfa7('0x25')](handleEntityNotFound(_0x16ea8b,null))[_0xcfa7('0x25')](removeEntity(_0x16ea8b,null))['catch'](handleError(_0x16ea8b,null));};exports[_0xcfa7('0x4b')]=function(_0x40dd2d,_0x510239,_0xd89b3e){var _0xd6d55a={};var _0xc2eaaf={};var _0x53a145;var _0x403f51;return db[_0xcfa7('0x2a')][_0xcfa7('0x4c')]({'where':{'id':_0x40dd2d[_0xcfa7('0x44')]['id']}})['then'](handleEntityNotFound(_0x510239,null))[_0xcfa7('0x25')](function(_0x56a3f1){if(_0x56a3f1){_0x53a145=_0x56a3f1;_0xc2eaaf[_0xcfa7('0x2e')]=_[_0xcfa7('0x31')](db[_0xcfa7('0x4d')][_0xcfa7('0x45')]);_0xc2eaaf[_0xcfa7('0x30')]=_[_0xcfa7('0x31')](_0x40dd2d[_0xcfa7('0x30')]);_0xc2eaaf[_0xcfa7('0x3b')]=_[_0xcfa7('0x32')](_0xc2eaaf[_0xcfa7('0x2e')],_0xc2eaaf['query']);_0xd6d55a['attributes']=_['intersection'](_0xc2eaaf[_0xcfa7('0x2e')],qs[_0xcfa7('0x33')](_0x40dd2d[_0xcfa7('0x30')][_0xcfa7('0x33')]));_0xd6d55a[_0xcfa7('0x34')]=_0xd6d55a[_0xcfa7('0x34')][_0xcfa7('0x35')]?_0xd6d55a['attributes']:_0xc2eaaf[_0xcfa7('0x2e')];_0xd6d55a[_0xcfa7('0x38')]=qs[_0xcfa7('0x39')](_0x40dd2d[_0xcfa7('0x30')]['sort']);_0xd6d55a['where']=qs[_0xcfa7('0x3b')](_[_0xcfa7('0x4e')](_0x40dd2d[_0xcfa7('0x30')],_0xc2eaaf[_0xcfa7('0x3b')]));if(_0x40dd2d['query'][_0xcfa7('0x3c')]){_0xd6d55a[_0xcfa7('0x3a')]=_[_0xcfa7('0x3d')](_0xd6d55a[_0xcfa7('0x3a')],{'$or':_[_0xcfa7('0x2f')](_0xd6d55a['attributes'],function(_0x27c5d8){var _0x28f1a5={};_0x28f1a5[_0x27c5d8]={'$like':'%'+_0x40dd2d['query'][_0xcfa7('0x3c')]+'%'};return _0x28f1a5;})});}_0xd6d55a=_[_0xcfa7('0x3d')]({},_0xd6d55a,_0x40dd2d[_0xcfa7('0x3f')]);return _0x53a145['getConfigurations'](_0xd6d55a);}})[_0xcfa7('0x25')](function(_0x5d137e){if(_0x5d137e){_0x403f51=_0x5d137e['length'];if(!_0x40dd2d['query'][_0xcfa7('0x36')]('nolimit')){_0xd6d55a[_0xcfa7('0x1f')]=qs[_0xcfa7('0x1f')](_0x40dd2d['query']['limit']);_0xd6d55a[_0xcfa7('0x20')]=qs[_0xcfa7('0x20')](_0x40dd2d[_0xcfa7('0x30')]['offset']);}return _0x53a145[_0xcfa7('0x4b')](_0xd6d55a);}})[_0xcfa7('0x25')](function(_0x18ecb3){if(_0x18ecb3){return _0x18ecb3?{'count':_0x403f51,'rows':_0x18ecb3}:null;}})[_0xcfa7('0x25')](respondWithResult(_0x510239,null))[_0xcfa7('0x4a')](handleError(_0x510239,null));};exports[_0xcfa7('0x4f')]=function(_0x350055,_0x586f62,_0x53d1ff){if(_0x350055[_0xcfa7('0x49')]['id']){delete _0x350055[_0xcfa7('0x49')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x350055[_0xcfa7('0x44')]['id']}})['then'](handleEntityNotFound(_0x586f62,null))[_0xcfa7('0x25')](function(_0x365d67){if(_0x365d67){_0x350055[_0xcfa7('0x49')]['AccountId']=_0x365d67['id'];_0x350055[_0xcfa7('0x49')]['Subjects']=integrations[_0xcfa7('0x50')](_0x350055['body'][_0xcfa7('0x51')],_0x350055[_0xcfa7('0x49')][_0xcfa7('0x2c')]);_0x350055[_0xcfa7('0x49')][_0xcfa7('0x52')]=integrations[_0xcfa7('0x53')](_0x350055[_0xcfa7('0x49')][_0xcfa7('0x51')],_0x350055[_0xcfa7('0x49')][_0xcfa7('0x2c')]);return db[_0xcfa7('0x4d')][_0xcfa7('0x48')](_0x350055[_0xcfa7('0x49')],{'include':[{'model':db[_0xcfa7('0x54')],'as':'Subjects'},{'model':db[_0xcfa7('0x54')],'as':'Descriptions'}]});}return null;})[_0xcfa7('0x25')](respondWithResult(_0x586f62,null))[_0xcfa7('0x4a')](handleError(_0x586f62,null));};exports['getFields']=function(_0x1bc7a5,_0x300150,_0x68a65d){var _0x2b286f='';return db['FreshdeskAccount'][_0xcfa7('0x4c')]({'where':{'id':_0x1bc7a5[_0xcfa7('0x44')]['id']},'attributes':['id',_0xcfa7('0x55'),_0xcfa7('0x56')]})[_0xcfa7('0x25')](handleEntityNotFound(_0x300150,null))['then'](function(_0x94edeb){if(_0x94edeb){_0x2b286f=_0x94edeb[_0xcfa7('0x55')];var _0x4a0f88=_0x2b286f[_0xcfa7('0x57')](-0x1);if(_0x4a0f88==='/'){_0x2b286f=_0x2b286f[_0xcfa7('0x58')](0x0,_0x2b286f['lastIndexOf'](_0x4a0f88));}return rp({'method':_0xcfa7('0x59'),'uri':util['format']('%s/%s',_0x2b286f,_0xcfa7('0x5a')),'headers':{'Authorization':util[_0xcfa7('0x5b')](_0xcfa7('0x5c'),new Buffer(util[_0xcfa7('0x5b')](_0xcfa7('0x5d'),_0x94edeb[_0xcfa7('0x56')]))[_0xcfa7('0x5e')](_0xcfa7('0x5f')))},'json':!![]});}})['then'](function(_0x498e94){if(_0x498e94){var _0x2306b0=[_0xcfa7('0x60'),_0xcfa7('0x61'),_0xcfa7('0x62'),'description',_0xcfa7('0x1b'),_0xcfa7('0x63'),_0xcfa7('0x64'),_0xcfa7('0x65'),_0xcfa7('0x66'),_0xcfa7('0x64'),_0xcfa7('0x67')];_['remove'](_0x498e94,function(_0x4cc3f8){return _0x2306b0['includes'](_0x4cc3f8[_0xcfa7('0x28')])||!_0x4cc3f8[_0xcfa7('0x68')]&&_0x4cc3f8[_0xcfa7('0x2c')]!=='custom_text'&&_0x4cc3f8[_0xcfa7('0x2c')]!==_0xcfa7('0x69');});return{'count':_0x498e94[_0xcfa7('0x35')],'rows':_[_0xcfa7('0x2f')](_0x498e94,function(_0x4c468e){return{'id':_0x4c468e[_0xcfa7('0x28')],'name':_0x4c468e['label'],'custom':!_0x4c468e[_0xcfa7('0x68')],'options':_0x4c468e[_0xcfa7('0x6a')]?_[_0xcfa7('0x2f')](_0x4c468e[_0xcfa7('0x6a')],function(_0x253036){return{'name':_[_0xcfa7('0x6b')](_0x253036),'value':_0x253036};}):[]};})};}})[_0xcfa7('0x25')](respondWithResult(_0x300150,null))[_0xcfa7('0x4a')](function(_0x324deb){var _0x24fb12=_0x1bc7a5[_0xcfa7('0x30')][_0xcfa7('0x6c')]?0x1f4:_0x324deb[_0xcfa7('0x6d')]||0x1f4;logger[_0xcfa7('0x27')](_0xcfa7('0x6e'),'getFields',_0x24fb12,JSON[_0xcfa7('0x6f')](_0x324deb));delete _0x324deb[_0xcfa7('0x28')];if(_0x24fb12===0x191){_0x24fb12=0x190;}_0x300150[_0xcfa7('0x1b')](_0x24fb12)[_0xcfa7('0x29')](_0x1bc7a5[_0xcfa7('0x30')][_0xcfa7('0x6c')]?{'message':_0xcfa7('0x70'),'statusCode':_0x324deb[_0xcfa7('0x6d')]}:_0x324deb);});}; \ No newline at end of file +var _0x85ed=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','FreshdeskAccount','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x21d2e6,_0x5266d5){var _0x24e979=function(_0x513a98){while(--_0x513a98){_0x21d2e6['push'](_0x21d2e6['shift']());}};_0x24e979(++_0x5266d5);}(_0x85ed,0x66));var _0xd85e=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x85ed[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0xd85e('0x0'));var rimraf=require(_0xd85e('0x1'));var zipdir=require(_0xd85e('0x2'));var jsonpatch=require(_0xd85e('0x3'));var rp=require(_0xd85e('0x4'));var moment=require(_0xd85e('0x5'));var BPromise=require(_0xd85e('0x6'));var Mustache=require('mustache');var util=require(_0xd85e('0x7'));var path=require(_0xd85e('0x8'));var sox=require(_0xd85e('0x9'));var csv=require(_0xd85e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd85e('0xb'));var _=require(_0xd85e('0xc'));var squel=require('squel');var crypto=require(_0xd85e('0xd'));var jsforce=require(_0xd85e('0xe'));var deskjs=require(_0xd85e('0xf'));var toCsv=require(_0xd85e('0xa'));var querystring=require('querystring');var Papa=require(_0xd85e('0x10'));var Redis=require(_0xd85e('0x11'));var authService=require(_0xd85e('0x12'));var qs=require(_0xd85e('0x13'));var as=require(_0xd85e('0x14'));var hardwareService=require(_0xd85e('0x15'));var logger=require('../../config/logger')(_0xd85e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd85e('0x17'));var db=require(_0xd85e('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x374652,_0x7d5918){_0x7d5918=_0x7d5918||0xcc;return function(_0x3fcc31){if(_0x3fcc31){return _0x374652['sendStatus'](_0x7d5918);}return _0x374652[_0xd85e('0x19')](_0x7d5918)[_0xd85e('0x1a')]();};}function respondWithResult(_0xe0c8df,_0x32a52c){_0x32a52c=_0x32a52c||0xc8;return function(_0x1765d5){if(_0x1765d5){return _0xe0c8df['status'](_0x32a52c)[_0xd85e('0x1b')](_0x1765d5);}};}function respondWithFilteredResult(_0x5ba31d,_0x3aa5f6){return function(_0x3123a3){if(_0x3123a3){var _0x398a7b=typeof _0x3aa5f6['offset']===_0xd85e('0x1c')&&typeof _0x3aa5f6[_0xd85e('0x1d')]==='undefined';var _0x425def=_0x3123a3[_0xd85e('0x1e')];var _0x25bbfd=_0x398a7b?0x0:_0x3aa5f6['offset'];var _0x3a5370=_0x398a7b?_0x3123a3[_0xd85e('0x1e')]:_0x3aa5f6[_0xd85e('0x1f')]+_0x3aa5f6[_0xd85e('0x1d')];var _0x45c1c0;if(_0x3a5370>=_0x425def){_0x3a5370=_0x425def;_0x45c1c0=0xc8;}else{_0x45c1c0=0xce;}_0x5ba31d[_0xd85e('0x19')](_0x45c1c0);return _0x5ba31d[_0xd85e('0x20')](_0xd85e('0x21'),_0x25bbfd+'-'+_0x3a5370+'/'+_0x425def)[_0xd85e('0x1b')](_0x3123a3);}return null;};}function patchUpdates(_0x3834ad){return function(_0x55b1f3){try{jsonpatch[_0xd85e('0x22')](_0x55b1f3,_0x3834ad,!![]);}catch(_0x10390a){return BPromise[_0xd85e('0x23')](_0x10390a);}return _0x55b1f3[_0xd85e('0x24')]();};}function saveUpdates(_0xe9991,_0x595199){return function(_0x33e48f){if(_0x33e48f){return _0x33e48f[_0xd85e('0x25')](_0xe9991)[_0xd85e('0x26')](function(_0x4f620e){return _0x4f620e;});}return null;};}function removeEntity(_0x45c727,_0x44168e){return function(_0x250dce){if(_0x250dce){return _0x250dce[_0xd85e('0x27')]()[_0xd85e('0x26')](function(){_0x45c727[_0xd85e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176a58,_0x91b328){return function(_0x3826c5){if(!_0x3826c5){_0x176a58[_0xd85e('0x28')](0x194);}return _0x3826c5;};}function handleError(_0xe89be1,_0x400ffd){_0x400ffd=_0x400ffd||0x1f4;return function(_0x338445){logger[_0xd85e('0x29')](_0x338445['stack']);if(_0x338445['name']){delete _0x338445[_0xd85e('0x2a')];}_0xe89be1[_0xd85e('0x19')](_0x400ffd)[_0xd85e('0x2b')](_0x338445);};}exports['index']=function(_0x53b7da,_0x305891){var _0x5691a8={},_0x5826d5={},_0x1ede22={'count':0x0,'rows':[]};var _0x3f760e=_[_0xd85e('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x5c5d9e){return{'name':_0x5c5d9e['fieldName'],'type':_0x5c5d9e['type'][_0xd85e('0x2d')]};});_0x5826d5[_0xd85e('0x2e')]=_[_0xd85e('0x2c')](_0x3f760e,'name');_0x5826d5[_0xd85e('0x2f')]=_[_0xd85e('0x30')](_0x53b7da[_0xd85e('0x2f')]);_0x5826d5[_0xd85e('0x31')]=_['intersection'](_0x5826d5[_0xd85e('0x2e')],_0x5826d5[_0xd85e('0x2f')]);_0x5691a8[_0xd85e('0x32')]=_[_0xd85e('0x33')](_0x5826d5[_0xd85e('0x2e')],qs['fields'](_0x53b7da[_0xd85e('0x2f')]['fields']));_0x5691a8['attributes']=_0x5691a8[_0xd85e('0x32')][_0xd85e('0x34')]?_0x5691a8[_0xd85e('0x32')]:_0x5826d5['model'];if(!_0x53b7da['query'][_0xd85e('0x35')]('nolimit')){_0x5691a8[_0xd85e('0x1d')]=qs['limit'](_0x53b7da['query'][_0xd85e('0x1d')]);_0x5691a8[_0xd85e('0x1f')]=qs['offset'](_0x53b7da[_0xd85e('0x2f')][_0xd85e('0x1f')]);}_0x5691a8[_0xd85e('0x36')]=qs[_0xd85e('0x37')](_0x53b7da[_0xd85e('0x2f')][_0xd85e('0x37')]);_0x5691a8[_0xd85e('0x38')]=qs[_0xd85e('0x31')](_[_0xd85e('0x39')](_0x53b7da[_0xd85e('0x2f')],_0x5826d5[_0xd85e('0x31')]),_0x3f760e);if(_0x53b7da[_0xd85e('0x2f')][_0xd85e('0x3a')]){_0x5691a8[_0xd85e('0x38')]=_['merge'](_0x5691a8[_0xd85e('0x38')],{'$or':_[_0xd85e('0x2c')](_0x3f760e,function(_0x2b3ddb){if(_0x2b3ddb[_0xd85e('0x3b')]!==_0xd85e('0x3c')){var _0x16c90a={};_0x16c90a[_0x2b3ddb[_0xd85e('0x2a')]]={'$like':'%'+_0x53b7da[_0xd85e('0x2f')][_0xd85e('0x3a')]+'%'};return _0x16c90a;}})});}_0x5691a8=_[_0xd85e('0x3d')]({},_0x5691a8,_0x53b7da[_0xd85e('0x3e')]);var _0x24cda4={'where':_0x5691a8[_0xd85e('0x38')]};return db[_0xd85e('0x3f')]['count'](_0x24cda4)[_0xd85e('0x26')](function(_0x2b4ed9){_0x1ede22[_0xd85e('0x1e')]=_0x2b4ed9;if(_0x53b7da['query']['includeAll']){_0x5691a8[_0xd85e('0x40')]=[{'all':!![]}];}return db[_0xd85e('0x3f')][_0xd85e('0x41')](_0x5691a8);})['then'](function(_0xc7260f){_0x1ede22[_0xd85e('0x42')]=_0xc7260f;return _0x1ede22;})[_0xd85e('0x26')](respondWithFilteredResult(_0x305891,_0x5691a8))[_0xd85e('0x43')](handleError(_0x305891,null));};exports[_0xd85e('0x44')]=function(_0x4483ef,_0x1157ab){var _0x304fb2={'raw':![],'where':{'id':_0x4483ef[_0xd85e('0x45')]['id']}},_0x22a7f6={};_0x22a7f6['model']=_[_0xd85e('0x30')](db['FreshdeskAccount'][_0xd85e('0x46')]);_0x22a7f6[_0xd85e('0x2f')]=_[_0xd85e('0x30')](_0x4483ef[_0xd85e('0x2f')]);_0x22a7f6[_0xd85e('0x31')]=_[_0xd85e('0x33')](_0x22a7f6[_0xd85e('0x2e')],_0x22a7f6[_0xd85e('0x2f')]);_0x304fb2[_0xd85e('0x32')]=_[_0xd85e('0x33')](_0x22a7f6[_0xd85e('0x2e')],qs['fields'](_0x4483ef['query'][_0xd85e('0x47')]));_0x304fb2[_0xd85e('0x32')]=_0x304fb2[_0xd85e('0x32')][_0xd85e('0x34')]?_0x304fb2[_0xd85e('0x32')]:_0x22a7f6['model'];if(_0x4483ef['query'][_0xd85e('0x48')]){_0x304fb2[_0xd85e('0x40')]=[{'all':!![]}];}_0x304fb2=_[_0xd85e('0x3d')]({},_0x304fb2,_0x4483ef[_0xd85e('0x3e')]);return db[_0xd85e('0x3f')][_0xd85e('0x49')](_0x304fb2)[_0xd85e('0x26')](handleEntityNotFound(_0x1157ab,null))['then'](respondWithResult(_0x1157ab,null))[_0xd85e('0x43')](handleError(_0x1157ab,null));};exports[_0xd85e('0x4a')]=function(_0x17f3da,_0x1f85ca){return db[_0xd85e('0x3f')][_0xd85e('0x4a')](_0x17f3da[_0xd85e('0x4b')],{})[_0xd85e('0x26')](respondWithResult(_0x1f85ca,0xc9))[_0xd85e('0x43')](handleError(_0x1f85ca,null));};exports[_0xd85e('0x25')]=function(_0x11945f,_0x1336b2){if(_0x11945f[_0xd85e('0x4b')]['id']){delete _0x11945f[_0xd85e('0x4b')]['id'];}return db[_0xd85e('0x3f')][_0xd85e('0x49')]({'where':{'id':_0x11945f['params']['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x1336b2,null))[_0xd85e('0x26')](saveUpdates(_0x11945f[_0xd85e('0x4b')],null))[_0xd85e('0x26')](respondWithResult(_0x1336b2,null))['catch'](handleError(_0x1336b2,null));};exports[_0xd85e('0x27')]=function(_0x2588d6,_0x2a5bbb){return db['FreshdeskAccount'][_0xd85e('0x49')]({'where':{'id':_0x2588d6[_0xd85e('0x45')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x2a5bbb,null))['then'](removeEntity(_0x2a5bbb,null))[_0xd85e('0x43')](handleError(_0x2a5bbb,null));};exports[_0xd85e('0x4c')]=function(_0x54e005,_0x168178,_0xcf1098){var _0x56191c={};var _0x24e8aa={};var _0x10bca7;var _0x23b83a;return db[_0xd85e('0x3f')][_0xd85e('0x4d')]({'where':{'id':_0x54e005[_0xd85e('0x45')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x168178,null))['then'](function(_0x17049c){if(_0x17049c){_0x10bca7=_0x17049c;_0x24e8aa[_0xd85e('0x2e')]=_[_0xd85e('0x30')](db[_0xd85e('0x4e')][_0xd85e('0x46')]);_0x24e8aa['query']=_[_0xd85e('0x30')](_0x54e005['query']);_0x24e8aa[_0xd85e('0x31')]=_['intersection'](_0x24e8aa['model'],_0x24e8aa[_0xd85e('0x2f')]);_0x56191c[_0xd85e('0x32')]=_[_0xd85e('0x33')](_0x24e8aa['model'],qs[_0xd85e('0x47')](_0x54e005['query'][_0xd85e('0x47')]));_0x56191c['attributes']=_0x56191c['attributes'][_0xd85e('0x34')]?_0x56191c[_0xd85e('0x32')]:_0x24e8aa[_0xd85e('0x2e')];_0x56191c[_0xd85e('0x36')]=qs[_0xd85e('0x37')](_0x54e005[_0xd85e('0x2f')][_0xd85e('0x37')]);_0x56191c[_0xd85e('0x38')]=qs[_0xd85e('0x31')](_['pick'](_0x54e005['query'],_0x24e8aa[_0xd85e('0x31')]));if(_0x54e005[_0xd85e('0x2f')][_0xd85e('0x3a')]){_0x56191c['where']=_[_0xd85e('0x3d')](_0x56191c[_0xd85e('0x38')],{'$or':_[_0xd85e('0x2c')](_0x56191c[_0xd85e('0x32')],function(_0x52c605){var _0x91f67a={};_0x91f67a[_0x52c605]={'$like':'%'+_0x54e005[_0xd85e('0x2f')][_0xd85e('0x3a')]+'%'};return _0x91f67a;})});}_0x56191c=_['merge']({},_0x56191c,_0x54e005['options']);return _0x10bca7[_0xd85e('0x4c')](_0x56191c);}})[_0xd85e('0x26')](function(_0x1dca75){if(_0x1dca75){_0x23b83a=_0x1dca75['length'];if(!_0x54e005[_0xd85e('0x2f')][_0xd85e('0x35')]('nolimit')){_0x56191c[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x54e005[_0xd85e('0x2f')][_0xd85e('0x1d')]);_0x56191c[_0xd85e('0x1f')]=qs[_0xd85e('0x1f')](_0x54e005['query']['offset']);}return _0x10bca7[_0xd85e('0x4c')](_0x56191c);}})['then'](function(_0x28988d){if(_0x28988d){return _0x28988d?{'count':_0x23b83a,'rows':_0x28988d}:null;}})[_0xd85e('0x26')](respondWithResult(_0x168178,null))[_0xd85e('0x43')](handleError(_0x168178,null));};exports[_0xd85e('0x4f')]=function(_0x147c7f,_0x568f3d,_0x1e7d32){if(_0x147c7f['body']['id']){delete _0x147c7f[_0xd85e('0x4b')]['id'];}return db[_0xd85e('0x3f')]['findOne']({'where':{'id':_0x147c7f[_0xd85e('0x45')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x568f3d,null))['then'](function(_0x14de94){if(_0x14de94){_0x147c7f[_0xd85e('0x4b')][_0xd85e('0x50')]=_0x14de94['id'];_0x147c7f['body'][_0xd85e('0x51')]=integrations[_0xd85e('0x52')](_0x147c7f[_0xd85e('0x4b')][_0xd85e('0x53')],_0x147c7f[_0xd85e('0x4b')][_0xd85e('0x3b')]);_0x147c7f[_0xd85e('0x4b')]['Descriptions']=integrations[_0xd85e('0x54')](_0x147c7f[_0xd85e('0x4b')]['channel'],_0x147c7f['body'][_0xd85e('0x3b')]);return db[_0xd85e('0x4e')]['create'](_0x147c7f[_0xd85e('0x4b')],{'include':[{'model':db[_0xd85e('0x55')],'as':_0xd85e('0x51')},{'model':db[_0xd85e('0x55')],'as':_0xd85e('0x56')}]});}return null;})['then'](respondWithResult(_0x568f3d,null))[_0xd85e('0x43')](handleError(_0x568f3d,null));};exports[_0xd85e('0x57')]=function(_0x15b741,_0x261d6c,_0x1e808f){var _0xe3bdfb='';return db[_0xd85e('0x3f')][_0xd85e('0x4d')]({'where':{'id':_0x15b741[_0xd85e('0x45')]['id']},'attributes':['id',_0xd85e('0x58'),_0xd85e('0x59')]})[_0xd85e('0x26')](handleEntityNotFound(_0x261d6c,null))[_0xd85e('0x26')](function(_0x12035f){if(_0x12035f){_0xe3bdfb=_0x12035f['remoteUri'];var _0x1cb869=_0xe3bdfb['slice'](-0x1);if(_0x1cb869==='/'){_0xe3bdfb=_0xe3bdfb[_0xd85e('0x5a')](0x0,_0xe3bdfb[_0xd85e('0x5b')](_0x1cb869));}return rp({'method':_0xd85e('0x5c'),'uri':util[_0xd85e('0x5d')](_0xd85e('0x5e'),_0xe3bdfb,_0xd85e('0x5f')),'headers':{'Authorization':util[_0xd85e('0x5d')]('Basic\x20%s',new Buffer(util[_0xd85e('0x5d')](_0xd85e('0x60'),_0x12035f[_0xd85e('0x59')]))[_0xd85e('0x61')](_0xd85e('0x62')))},'json':!![]});}})[_0xd85e('0x26')](function(_0x3d2d4d){if(_0x3d2d4d){var _0x40abc4=['requester',_0xd85e('0x63'),_0xd85e('0x64'),_0xd85e('0x65'),_0xd85e('0x19'),_0xd85e('0x66'),_0xd85e('0x67'),_0xd85e('0x68'),_0xd85e('0x69'),'group',_0xd85e('0x6a')];_[_0xd85e('0x6b')](_0x3d2d4d,function(_0x558e6d){return _0x40abc4[_0xd85e('0x6c')](_0x558e6d[_0xd85e('0x2a')])||!_0x558e6d[_0xd85e('0x6d')]&&_0x558e6d[_0xd85e('0x3b')]!==_0xd85e('0x6e')&&_0x558e6d[_0xd85e('0x3b')]!==_0xd85e('0x6f');});return{'count':_0x3d2d4d[_0xd85e('0x34')],'rows':_[_0xd85e('0x2c')](_0x3d2d4d,function(_0x4fb93c){return{'id':_0x4fb93c[_0xd85e('0x2a')],'name':_0x4fb93c[_0xd85e('0x70')],'custom':!_0x4fb93c[_0xd85e('0x6d')],'options':_0x4fb93c[_0xd85e('0x71')]?_['map'](_0x4fb93c[_0xd85e('0x71')],function(_0x5eb4f0){return{'name':_[_0xd85e('0x72')](_0x5eb4f0),'value':_0x5eb4f0};}):[]};})};}})[_0xd85e('0x26')](respondWithResult(_0x261d6c,null))['catch'](function(_0x2b4982){var _0x4145d2=_0x15b741[_0xd85e('0x2f')][_0xd85e('0x73')]?0x1f4:_0x2b4982[_0xd85e('0x74')]||0x1f4;logger[_0xd85e('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xd85e('0x57'),_0x4145d2,JSON['stringify'](_0x2b4982));delete _0x2b4982['name'];if(_0x4145d2===0x191){_0x4145d2=0x190;}_0x261d6c[_0xd85e('0x19')](_0x4145d2)[_0xd85e('0x2b')](_0x15b741[_0xd85e('0x2f')][_0xd85e('0x73')]?{'message':_0xd85e('0x75'),'statusCode':_0x2b4982[_0xd85e('0x74')]}:_0x2b4982);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a78b551..5178641 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 _0x2c48=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4f6b44,_0x1589ef){var _0x32e019=function(_0x35f167){while(--_0x35f167){_0x4f6b44['push'](_0x4f6b44['shift']());}};_0x32e019(++_0x1589ef);}(_0x2c48,0x105));var _0x82c4=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x2c48[_0x58d5ac];return _0x37985c;};'use strict';var _=require('lodash');var util=require(_0x82c4('0x0'));var logger=require(_0x82c4('0x1'))(_0x82c4('0x2'));var moment=require(_0x82c4('0x3'));var BPromise=require(_0x82c4('0x4'));var rp=require(_0x82c4('0x5'));var fs=require('fs');var path=require(_0x82c4('0x6'));var rimraf=require(_0x82c4('0x7'));var config=require(_0x82c4('0x8'));var attributes=require(_0x82c4('0x9'));var integrations=require(_0x82c4('0xa'));module[_0x82c4('0xb')]=function(_0x457420,_0x526521){return _0x457420[_0x82c4('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83db=['api','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x352713,_0x737610){var _0x46a4ea=function(_0x379929){while(--_0x379929){_0x352713['push'](_0x352713['shift']());}};_0x46a4ea(++_0x737610);}(_0x83db,0x1f1));var _0xb83d=function(_0x25cb76,_0x1f85e5){_0x25cb76=_0x25cb76-0x0;var _0x12b9ad=_0x83db[_0x25cb76];return _0x12b9ad;};'use strict';var _=require(_0xb83d('0x0'));var util=require(_0xb83d('0x1'));var logger=require(_0xb83d('0x2'))(_0xb83d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb83d('0x4'));var rimraf=require(_0xb83d('0x5'));var config=require('../../config/environment');var attributes=require(_0xb83d('0x6'));var integrations=require(_0xb83d('0x7'));module['exports']=function(_0x5f1de1,_0x203c2f){return _0x5f1de1['define'](_0xb83d('0x8'),attributes,{'tableName':_0xb83d('0x9'),'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 d594d5a..cacdbd9 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 _0x5990=['request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1e6b22,_0x344fb3){var _0x3e58c2=function(_0x3e057d){while(--_0x3e057d){_0x1e6b22['push'](_0x1e6b22['shift']());}};_0x3e58c2(++_0x344fb3);}(_0x5990,0x123));var _0x0599=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5990[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0599('0x0'));var util=require(_0x0599('0x1'));var moment=require(_0x0599('0x2'));var BPromise=require(_0x0599('0x3'));var rs=require(_0x0599('0x4'));var fs=require('fs');var Redis=require(_0x0599('0x5'));var db=require(_0x0599('0x6'))['db'];var utils=require(_0x0599('0x7'));var logger=require('../../config/logger')(_0x0599('0x8'));var config=require(_0x0599('0x9'));var jayson=require(_0x0599('0xa'));var client=jayson[_0x0599('0xb')][_0x0599('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x441fad,_0x380e50,_0x2da08c){return new BPromise(function(_0x4927d7,_0x4cd24c){return client[_0x0599('0xd')](_0x441fad,_0x2da08c)[_0x0599('0xe')](function(_0x24858){logger['info'](_0x0599('0xf'),_0x380e50,_0x0599('0x10'));logger[_0x0599('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x380e50,_0x0599('0x10'),JSON['stringify'](_0x24858));if(_0x24858['error']){if(_0x24858[_0x0599('0x12')][_0x0599('0x13')]===0x1f4){logger[_0x0599('0x12')](_0x0599('0xf'),_0x380e50,_0x24858[_0x0599('0x12')]['message']);return _0x4cd24c(_0x24858[_0x0599('0x12')][_0x0599('0x14')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x380e50,_0x24858[_0x0599('0x12')][_0x0599('0x14')]);return _0x4927d7(_0x24858[_0x0599('0x12')][_0x0599('0x14')]);}else{logger[_0x0599('0x15')](_0x0599('0xf'),_0x380e50,_0x0599('0x10'));_0x4927d7(_0x24858[_0x0599('0x16')]['message']);}})[_0x0599('0x17')](function(_0x277d5d){logger[_0x0599('0x12')](_0x0599('0xf'),_0x380e50,_0x277d5d);_0x4cd24c(_0x277d5d);});});}exports[_0x0599('0x18')]=function(_0x24c034){var _0x51a55e=this;return new Promise(function(_0x19ea2a,_0x2f9c54){return db[_0x0599('0x19')][_0x0599('0x1a')]({'raw':_0x24c034[_0x0599('0x1b')]?_0x24c034['options'][_0x0599('0x1c')]===undefined?!![]:![]:!![],'where':_0x24c034['options']?_0x24c034[_0x0599('0x1b')][_0x0599('0x1d')]||null:null,'attributes':_0x24c034['options']?_0x24c034[_0x0599('0x1b')][_0x0599('0x1e')]||null:null,'limit':_0x24c034['options']?_0x24c034[_0x0599('0x1b')][_0x0599('0x1f')]||null:null,'include':_0x24c034['options']?_0x24c034[_0x0599('0x1b')][_0x0599('0x20')]?_[_0x0599('0x21')](_0x24c034[_0x0599('0x1b')][_0x0599('0x20')],function(_0x27e5cd){return{'model':db[_0x27e5cd['model']],'as':_0x27e5cd['as'],'attributes':_0x27e5cd[_0x0599('0x1e')],'include':_0x27e5cd['include']?_[_0x0599('0x21')](_0x27e5cd[_0x0599('0x20')],function(_0x3eb64){return{'model':db[_0x3eb64[_0x0599('0x22')]],'as':_0x3eb64['as'],'attributes':_0x3eb64[_0x0599('0x1e')],'include':_0x3eb64['include']?_[_0x0599('0x21')](_0x3eb64[_0x0599('0x20')],function(_0x1f5fcd){return{'model':db[_0x1f5fcd[_0x0599('0x22')]],'as':_0x1f5fcd['as'],'attributes':_0x1f5fcd[_0x0599('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0599('0xe')](function(_0xa3bd58){logger['info'](_0x0599('0x18'),_0x24c034);logger[_0x0599('0x11')](_0x0599('0x18'),_0x24c034,JSON[_0x0599('0x23')](_0xa3bd58));_0x19ea2a(_0xa3bd58);})[_0x0599('0x17')](function(_0x478a5d){logger[_0x0599('0x12')]('GetFreshdeskAccount',_0x478a5d[_0x0599('0x14')],_0x24c034);_0x2f9c54(_0x51a55e[_0x0599('0x12')](0x1f4,_0x478a5d[_0x0599('0x14')]));});});};exports[_0x0599('0x24')]=function(_0x3fc75c){var _0x194123=this;return new Promise(function(_0x2b93ee,_0x52c864){return db[_0x0599('0x19')][_0x0599('0x25')]({'raw':_0x3fc75c['options']?_0x3fc75c[_0x0599('0x1b')][_0x0599('0x1c')]===undefined?!![]:![]:!![],'where':_0x3fc75c[_0x0599('0x1b')]?_0x3fc75c[_0x0599('0x1b')][_0x0599('0x1d')]||null:null,'attributes':_0x3fc75c['options']?_0x3fc75c[_0x0599('0x1b')][_0x0599('0x1e')]||null:null,'include':_0x3fc75c['options']?_0x3fc75c[_0x0599('0x1b')][_0x0599('0x20')]?_['map'](_0x3fc75c[_0x0599('0x1b')][_0x0599('0x20')],function(_0x4dbdea){return{'model':db[_0x4dbdea[_0x0599('0x22')]],'as':_0x4dbdea['as'],'attributes':_0x4dbdea[_0x0599('0x1e')],'include':_0x4dbdea[_0x0599('0x20')]?_[_0x0599('0x21')](_0x4dbdea[_0x0599('0x20')],function(_0x51aae8){return{'model':db[_0x51aae8[_0x0599('0x22')]],'as':_0x51aae8['as'],'attributes':_0x51aae8[_0x0599('0x1e')],'include':_0x51aae8[_0x0599('0x20')]?_['map'](_0x51aae8[_0x0599('0x20')],function(_0x4fe5d9){return{'model':db[_0x4fe5d9[_0x0599('0x22')]],'as':_0x4fe5d9['as'],'attributes':_0x4fe5d9[_0x0599('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35dc20){logger['info']('ShowFreshdeskAccount',_0x3fc75c);logger['debug']('ShowFreshdeskAccount',_0x3fc75c,JSON[_0x0599('0x23')](_0x35dc20));_0x2b93ee(_0x35dc20);})['catch'](function(_0x4d90a8){logger['error'](_0x0599('0x24'),_0x4d90a8['message'],_0x3fc75c);_0x52c864(_0x194123[_0x0599('0x12')](0x1f4,_0x4d90a8['message']));});});}; \ No newline at end of file +var _0x61b6=['attributes','map','include','model','then','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','where'];(function(_0x221043,_0x82632e){var _0x26879a=function(_0x29e8eb){while(--_0x29e8eb){_0x221043['push'](_0x221043['shift']());}};_0x26879a(++_0x82632e);}(_0x61b6,0x17f));var _0x661b=function(_0xb0895d,_0xc497b8){_0xb0895d=_0xb0895d-0x0;var _0x3c2e0d=_0x61b6[_0xb0895d];return _0x3c2e0d;};'use strict';var _=require(_0x661b('0x0'));var util=require('util');var moment=require(_0x661b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x661b('0x2'));var db=require(_0x661b('0x3'))['db'];var utils=require(_0x661b('0x4'));var logger=require(_0x661b('0x5'))(_0x661b('0x6'));var config=require(_0x661b('0x7'));var jayson=require(_0x661b('0x8'));var client=jayson[_0x661b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35732e,_0x40a547,_0x7e6abb){return new BPromise(function(_0x33ebc2,_0x3fcc9d){return client['request'](_0x35732e,_0x7e6abb)['then'](function(_0x40b66b){logger[_0x661b('0xa')](_0x661b('0xb'),_0x40a547,_0x661b('0xc'));logger[_0x661b('0xd')](_0x661b('0xe'),_0x40a547,'request\x20sent',JSON[_0x661b('0xf')](_0x40b66b));if(_0x40b66b[_0x661b('0x10')]){if(_0x40b66b[_0x661b('0x10')][_0x661b('0x11')]===0x1f4){logger['error'](_0x661b('0xb'),_0x40a547,_0x40b66b[_0x661b('0x10')]['message']);return _0x3fcc9d(_0x40b66b[_0x661b('0x10')][_0x661b('0x12')]);}logger[_0x661b('0x10')](_0x661b('0xb'),_0x40a547,_0x40b66b['error'][_0x661b('0x12')]);return _0x33ebc2(_0x40b66b['error']['message']);}else{logger[_0x661b('0xa')](_0x661b('0xb'),_0x40a547,_0x661b('0xc'));_0x33ebc2(_0x40b66b[_0x661b('0x13')][_0x661b('0x12')]);}})[_0x661b('0x14')](function(_0x15b243){logger[_0x661b('0x10')](_0x661b('0xb'),_0x40a547,_0x15b243);_0x3fcc9d(_0x15b243);});});}exports[_0x661b('0x15')]=function(_0x3551fc){var _0x11a415=this;return new Promise(function(_0x5bef82,_0x182b6e){return db['FreshdeskAccount'][_0x661b('0x16')]({'raw':_0x3551fc[_0x661b('0x17')]?_0x3551fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x3551fc[_0x661b('0x17')]?_0x3551fc[_0x661b('0x17')][_0x661b('0x18')]||null:null,'attributes':_0x3551fc[_0x661b('0x17')]?_0x3551fc['options'][_0x661b('0x19')]||null:null,'limit':_0x3551fc[_0x661b('0x17')]?_0x3551fc['options']['limit']||null:null,'include':_0x3551fc['options']?_0x3551fc[_0x661b('0x17')]['include']?_[_0x661b('0x1a')](_0x3551fc['options'][_0x661b('0x1b')],function(_0x5d9311){return{'model':db[_0x5d9311[_0x661b('0x1c')]],'as':_0x5d9311['as'],'attributes':_0x5d9311[_0x661b('0x19')],'include':_0x5d9311['include']?_['map'](_0x5d9311[_0x661b('0x1b')],function(_0xfa7b07){return{'model':db[_0xfa7b07[_0x661b('0x1c')]],'as':_0xfa7b07['as'],'attributes':_0xfa7b07['attributes'],'include':_0xfa7b07['include']?_[_0x661b('0x1a')](_0xfa7b07[_0x661b('0x1b')],function(_0x4408c7){return{'model':db[_0x4408c7[_0x661b('0x1c')]],'as':_0x4408c7['as'],'attributes':_0x4408c7[_0x661b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x661b('0x1d')](function(_0x1385d2){logger[_0x661b('0xa')](_0x661b('0x15'),_0x3551fc);logger[_0x661b('0xd')](_0x661b('0x15'),_0x3551fc,JSON[_0x661b('0xf')](_0x1385d2));_0x5bef82(_0x1385d2);})[_0x661b('0x14')](function(_0x19f3c0){logger[_0x661b('0x10')](_0x661b('0x15'),_0x19f3c0['message'],_0x3551fc);_0x182b6e(_0x11a415[_0x661b('0x10')](0x1f4,_0x19f3c0['message']));});});};exports[_0x661b('0x1e')]=function(_0x27b9ba){var _0x19c52d=this;return new Promise(function(_0x43ade1,_0x4ad7fc){return db[_0x661b('0x1f')][_0x661b('0x20')]({'raw':_0x27b9ba[_0x661b('0x17')]?_0x27b9ba[_0x661b('0x17')][_0x661b('0x21')]===undefined?!![]:![]:!![],'where':_0x27b9ba[_0x661b('0x17')]?_0x27b9ba['options'][_0x661b('0x18')]||null:null,'attributes':_0x27b9ba[_0x661b('0x17')]?_0x27b9ba['options']['attributes']||null:null,'include':_0x27b9ba[_0x661b('0x17')]?_0x27b9ba[_0x661b('0x17')]['include']?_['map'](_0x27b9ba['options']['include'],function(_0x4645bc){return{'model':db[_0x4645bc[_0x661b('0x1c')]],'as':_0x4645bc['as'],'attributes':_0x4645bc['attributes'],'include':_0x4645bc[_0x661b('0x1b')]?_[_0x661b('0x1a')](_0x4645bc[_0x661b('0x1b')],function(_0x311cf6){return{'model':db[_0x311cf6[_0x661b('0x1c')]],'as':_0x311cf6['as'],'attributes':_0x311cf6[_0x661b('0x19')],'include':_0x311cf6[_0x661b('0x1b')]?_[_0x661b('0x1a')](_0x311cf6[_0x661b('0x1b')],function(_0x2a7507){return{'model':db[_0x2a7507[_0x661b('0x1c')]],'as':_0x2a7507['as'],'attributes':_0x2a7507[_0x661b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x661b('0x1d')](function(_0x13fa1a){logger[_0x661b('0xa')](_0x661b('0x1e'),_0x27b9ba);logger['debug'](_0x661b('0x1e'),_0x27b9ba,JSON[_0x661b('0xf')](_0x13fa1a));_0x43ade1(_0x13fa1a);})[_0x661b('0x14')](function(_0x32e59b){logger['error'](_0x661b('0x1e'),_0x32e59b[_0x661b('0x12')],_0x27b9ba);_0x4ad7fc(_0x19c52d[_0x661b('0x10')](0x1f4,_0x32e59b[_0x661b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b948404..d0e9f76 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 _0x6545=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0x40bc7e,_0x2e4594){var _0x2f3ffa=function(_0x33940f){while(--_0x33940f){_0x40bc7e['push'](_0x40bc7e['shift']());}};_0x2f3ffa(++_0x2e4594);}(_0x6545,0x1ea));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x5654('0x0'));var path=require('path');var timeout=require(_0x5654('0x1'));var express=require('express');var router=express[_0x5654('0x2')]();var fs_extra=require(_0x5654('0x3'));var auth=require(_0x5654('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5654('0x5'));router[_0x5654('0x6')]('/',auth['isAuthenticated'](),controller[_0x5654('0x7')]);router[_0x5654('0x6')](_0x5654('0x8'),auth[_0x5654('0x9')](),controller[_0x5654('0xa')]);router[_0x5654('0x6')](_0x5654('0xb'),auth['isAuthenticated'](),controller[_0x5654('0xc')]);router[_0x5654('0x6')](_0x5654('0xd'),auth['isAuthenticated'](),controller[_0x5654('0xe')]);router[_0x5654('0x6')](_0x5654('0xf'),auth[_0x5654('0x9')](),controller[_0x5654('0x10')]);router[_0x5654('0x6')](_0x5654('0x11'),auth[_0x5654('0x9')](),controller[_0x5654('0x12')]);router[_0x5654('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5654('0x13')](_0x5654('0x11'),auth[_0x5654('0x9')](),controller[_0x5654('0x14')]);router[_0x5654('0x15')](_0x5654('0x8'),auth['isAuthenticated'](),controller[_0x5654('0x16')]);router[_0x5654('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5654('0x18')]=router; \ No newline at end of file +var _0x3da1=['/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','setTags','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields'];(function(_0x1ef565,_0x3ab6d7){var _0x26ca86=function(_0x2c77be){while(--_0x2c77be){_0x1ef565['push'](_0x1ef565['shift']());}};_0x26ca86(++_0x3ab6d7);}(_0x3da1,0x1e7));var _0x13da=function(_0x5b10cf,_0x2b1e47){_0x5b10cf=_0x5b10cf-0x0;var _0x359633=_0x3da1[_0x5b10cf];return _0x359633;};'use strict';var multer=require(_0x13da('0x0'));var util=require(_0x13da('0x1'));var path=require(_0x13da('0x2'));var timeout=require('connect-timeout');var express=require(_0x13da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x13da('0x4'));var interaction=require(_0x13da('0x5'));var config=require(_0x13da('0x6'));var controller=require(_0x13da('0x7'));router[_0x13da('0x8')]('/',auth[_0x13da('0x9')](),controller['index']);router[_0x13da('0x8')](_0x13da('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x13da('0x8')](_0x13da('0xb'),auth['isAuthenticated'](),controller[_0x13da('0xc')]);router[_0x13da('0x8')](_0x13da('0xd'),auth[_0x13da('0x9')](),controller['getSubjects']);router[_0x13da('0x8')](_0x13da('0xe'),auth['isAuthenticated'](),controller[_0x13da('0xf')]);router['get'](_0x13da('0x10'),auth[_0x13da('0x9')](),controller[_0x13da('0x11')]);router['post']('/',auth[_0x13da('0x9')](),controller['create']);router['post']('/:id/tags',auth[_0x13da('0x9')](),controller[_0x13da('0x12')]);router['put'](_0x13da('0xa'),auth[_0x13da('0x9')](),controller['update']);router[_0x13da('0x13')](_0x13da('0xa'),auth[_0x13da('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index bb15897..e828d67 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 _0xe7ab=['exports','STRING','sequelize'];(function(_0xa3da82,_0x3be0c4){var _0x55a74=function(_0x4f0f76){while(--_0x4f0f76){_0xa3da82['push'](_0xa3da82['shift']());}};_0x55a74(++_0x3be0c4);}(_0xe7ab,0x146));var _0xbe7a=function(_0x28a40a,_0x439046){_0x28a40a=_0x28a40a-0x0;var _0x11651f=_0xe7ab[_0x28a40a];return _0x11651f;};'use strict';var Sequelize=require(_0xbe7a('0x0'));module[_0xbe7a('0x1')]={'name':{'type':Sequelize[_0xbe7a('0x2')]},'description':{'type':Sequelize[_0xbe7a('0x2')]}}; \ No newline at end of file +var _0xee98=['exports','STRING'];(function(_0x3afa31,_0x374788){var _0x50e9d5=function(_0x2dab71){while(--_0x2dab71){_0x3afa31['push'](_0x3afa31['shift']());}};_0x50e9d5(++_0x374788);}(_0xee98,0xe0));var _0x8ee9=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xee98[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require('sequelize');module[_0x8ee9('0x0')]={'name':{'type':Sequelize[_0x8ee9('0x1')]},'description':{'type':Sequelize[_0x8ee9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 9b1473a..e93bf59 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 _0xfb64=['limit','undefined','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','FreshdeskConfiguration','count','include','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','getFields','FreshdeskField','pick','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2171c2,_0x5e12c7){var _0x24844c=function(_0x57c3d2){while(--_0x57c3d2){_0x2171c2['push'](_0x2171c2['shift']());}};_0x24844c(++_0x5e12c7);}(_0xfb64,0xd8));var _0x4fb6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfb64[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4fb6('0x0'));var rimraf=require(_0x4fb6('0x1'));var zipdir=require(_0x4fb6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fb6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4fb6('0x4'));var util=require(_0x4fb6('0x5'));var path=require(_0x4fb6('0x6'));var sox=require(_0x4fb6('0x7'));var csv=require(_0x4fb6('0x8'));var ejs=require(_0x4fb6('0x9'));var fs=require('fs');var fs_extra=require(_0x4fb6('0xa'));var _=require(_0x4fb6('0xb'));var squel=require(_0x4fb6('0xc'));var crypto=require('crypto');var jsforce=require(_0x4fb6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4fb6('0x8'));var querystring=require('querystring');var Papa=require(_0x4fb6('0xe'));var Redis=require(_0x4fb6('0xf'));var authService=require(_0x4fb6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fb6('0x11'))(_0x4fb6('0x12'));var utils=require(_0x4fb6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4fb6('0x14'));var db=require(_0x4fb6('0x15'))['db'];function respondWithStatusCode(_0xc0d017,_0x2dc3c5){_0x2dc3c5=_0x2dc3c5||0xcc;return function(_0x1b4502){if(_0x1b4502){return _0xc0d017[_0x4fb6('0x16')](_0x2dc3c5);}return _0xc0d017[_0x4fb6('0x17')](_0x2dc3c5)[_0x4fb6('0x18')]();};}function respondWithResult(_0x21cacf,_0x274702){_0x274702=_0x274702||0xc8;return function(_0x6b01ed){if(_0x6b01ed){return _0x21cacf['status'](_0x274702)[_0x4fb6('0x19')](_0x6b01ed);}};}function respondWithFilteredResult(_0x5db775,_0x29836f){return function(_0x14c36e){if(_0x14c36e){var _0x82a502=typeof _0x29836f[_0x4fb6('0x1a')]==='undefined'&&typeof _0x29836f[_0x4fb6('0x1b')]===_0x4fb6('0x1c');var _0x84c30d=_0x14c36e['count'];var _0x8555=_0x82a502?0x0:_0x29836f[_0x4fb6('0x1a')];var _0x6d9d6e=_0x82a502?_0x14c36e['count']:_0x29836f[_0x4fb6('0x1a')]+_0x29836f['limit'];var _0x5e8e9b;if(_0x6d9d6e>=_0x84c30d){_0x6d9d6e=_0x84c30d;_0x5e8e9b=0xc8;}else{_0x5e8e9b=0xce;}_0x5db775[_0x4fb6('0x17')](_0x5e8e9b);return _0x5db775[_0x4fb6('0x1d')](_0x4fb6('0x1e'),_0x8555+'-'+_0x6d9d6e+'/'+_0x84c30d)[_0x4fb6('0x19')](_0x14c36e);}return null;};}function patchUpdates(_0x3f0758){return function(_0x11a131){try{jsonpatch[_0x4fb6('0x1f')](_0x11a131,_0x3f0758,!![]);}catch(_0x17d01a){return BPromise[_0x4fb6('0x20')](_0x17d01a);}return _0x11a131['save']();};}function saveUpdates(_0x4f98b6,_0x174189){return function(_0x3312d3){if(_0x3312d3){return _0x3312d3[_0x4fb6('0x21')](_0x4f98b6)[_0x4fb6('0x22')](function(_0xd3246f){return _0xd3246f;});}return null;};}function removeEntity(_0x1be730,_0x284ac6){return function(_0x25c02f){if(_0x25c02f){return _0x25c02f['destroy']()[_0x4fb6('0x22')](function(){_0x1be730['status'](0xcc)[_0x4fb6('0x18')]();});}};}function handleEntityNotFound(_0xbddb14,_0x5e8fe4){return function(_0x5da1ce){if(!_0x5da1ce){_0xbddb14[_0x4fb6('0x16')](0x194);}return _0x5da1ce;};}function handleError(_0x474e72,_0x18b225){_0x18b225=_0x18b225||0x1f4;return function(_0x1c9d21){logger[_0x4fb6('0x23')](_0x1c9d21[_0x4fb6('0x24')]);if(_0x1c9d21['name']){delete _0x1c9d21[_0x4fb6('0x25')];}_0x474e72['status'](_0x18b225)[_0x4fb6('0x26')](_0x1c9d21);};}exports[_0x4fb6('0x27')]=function(_0x3070f2,_0xba7ec6){var _0x3e35c0={},_0x3363cc={},_0x3a6a69={'count':0x0,'rows':[]};var _0x4f3a32=_[_0x4fb6('0x28')](db['FreshdeskConfiguration']['rawAttributes'],function(_0xc8fac5){return{'name':_0xc8fac5['fieldName'],'type':_0xc8fac5[_0x4fb6('0x29')]['key']};});_0x3363cc[_0x4fb6('0x2a')]=_['map'](_0x4f3a32,_0x4fb6('0x25'));_0x3363cc[_0x4fb6('0x2b')]=_[_0x4fb6('0x2c')](_0x3070f2[_0x4fb6('0x2b')]);_0x3363cc[_0x4fb6('0x2d')]=_[_0x4fb6('0x2e')](_0x3363cc[_0x4fb6('0x2a')],_0x3363cc[_0x4fb6('0x2b')]);_0x3e35c0['attributes']=_[_0x4fb6('0x2e')](_0x3363cc[_0x4fb6('0x2a')],qs[_0x4fb6('0x2f')](_0x3070f2['query'][_0x4fb6('0x2f')]));_0x3e35c0[_0x4fb6('0x30')]=_0x3e35c0[_0x4fb6('0x30')][_0x4fb6('0x31')]?_0x3e35c0['attributes']:_0x3363cc[_0x4fb6('0x2a')];if(!_0x3070f2['query'][_0x4fb6('0x32')](_0x4fb6('0x33'))){_0x3e35c0['limit']=qs[_0x4fb6('0x1b')](_0x3070f2['query'][_0x4fb6('0x1b')]);_0x3e35c0[_0x4fb6('0x1a')]=qs[_0x4fb6('0x1a')](_0x3070f2[_0x4fb6('0x2b')][_0x4fb6('0x1a')]);}_0x3e35c0[_0x4fb6('0x34')]=qs[_0x4fb6('0x35')](_0x3070f2[_0x4fb6('0x2b')][_0x4fb6('0x35')]);_0x3e35c0[_0x4fb6('0x36')]=qs['filters'](_['pick'](_0x3070f2['query'],_0x3363cc[_0x4fb6('0x2d')]),_0x4f3a32);if(_0x3070f2['query']['filter']){_0x3e35c0[_0x4fb6('0x36')]=_[_0x4fb6('0x37')](_0x3e35c0[_0x4fb6('0x36')],{'$or':_[_0x4fb6('0x28')](_0x4f3a32,function(_0x5a7bc3){if(_0x5a7bc3[_0x4fb6('0x29')]!==_0x4fb6('0x38')){var _0x56657c={};_0x56657c[_0x5a7bc3[_0x4fb6('0x25')]]={'$like':'%'+_0x3070f2[_0x4fb6('0x2b')][_0x4fb6('0x39')]+'%'};return _0x56657c;}})});}_0x3e35c0=_[_0x4fb6('0x37')]({},_0x3e35c0,_0x3070f2[_0x4fb6('0x3a')]);var _0x385c96={'where':_0x3e35c0[_0x4fb6('0x36')]};return db[_0x4fb6('0x3b')]['count'](_0x385c96)[_0x4fb6('0x22')](function(_0x1d12b2){_0x3a6a69[_0x4fb6('0x3c')]=_0x1d12b2;if(_0x3070f2[_0x4fb6('0x2b')]['includeAll']){_0x3e35c0[_0x4fb6('0x3d')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x3e35c0);})[_0x4fb6('0x22')](function(_0x3a2b72){_0x3a6a69['rows']=_0x3a2b72;return _0x3a6a69;})[_0x4fb6('0x22')](respondWithFilteredResult(_0xba7ec6,_0x3e35c0))[_0x4fb6('0x3e')](handleError(_0xba7ec6,null));};exports[_0x4fb6('0x3f')]=function(_0x2311e5,_0x2903c4){var _0xe464da={'raw':![],'where':{'id':_0x2311e5[_0x4fb6('0x40')]['id']}},_0x179318={};_0x179318[_0x4fb6('0x2a')]=_['keys'](db[_0x4fb6('0x3b')][_0x4fb6('0x41')]);_0x179318[_0x4fb6('0x2b')]=_[_0x4fb6('0x2c')](_0x2311e5['query']);_0x179318[_0x4fb6('0x2d')]=_[_0x4fb6('0x2e')](_0x179318[_0x4fb6('0x2a')],_0x179318[_0x4fb6('0x2b')]);_0xe464da[_0x4fb6('0x30')]=_['intersection'](_0x179318[_0x4fb6('0x2a')],qs[_0x4fb6('0x2f')](_0x2311e5[_0x4fb6('0x2b')][_0x4fb6('0x2f')]));_0xe464da[_0x4fb6('0x30')]=_0xe464da[_0x4fb6('0x30')][_0x4fb6('0x31')]?_0xe464da['attributes']:_0x179318['model'];if(_0x2311e5[_0x4fb6('0x2b')][_0x4fb6('0x42')]){_0xe464da[_0x4fb6('0x3d')]=[{'all':!![]}];}_0xe464da=_[_0x4fb6('0x37')]({},_0xe464da,_0x2311e5['options']);return db[_0x4fb6('0x3b')][_0x4fb6('0x43')](_0xe464da)[_0x4fb6('0x22')](handleEntityNotFound(_0x2903c4,null))[_0x4fb6('0x22')](respondWithResult(_0x2903c4,null))[_0x4fb6('0x3e')](handleError(_0x2903c4,null));};exports[_0x4fb6('0x44')]=function(_0x47861d,_0x44b658){return db['FreshdeskConfiguration'][_0x4fb6('0x44')](_0x47861d[_0x4fb6('0x45')],{})['then'](respondWithResult(_0x44b658,0xc9))['catch'](handleError(_0x44b658,null));};exports[_0x4fb6('0x21')]=function(_0x470de7,_0x1c7a59){if(_0x470de7[_0x4fb6('0x45')]['id']){delete _0x470de7[_0x4fb6('0x45')]['id'];}return db[_0x4fb6('0x3b')][_0x4fb6('0x43')]({'where':{'id':_0x470de7[_0x4fb6('0x40')]['id']}})[_0x4fb6('0x22')](handleEntityNotFound(_0x1c7a59,null))['then'](saveUpdates(_0x470de7[_0x4fb6('0x45')],null))[_0x4fb6('0x22')](respondWithResult(_0x1c7a59,null))['catch'](handleError(_0x1c7a59,null));};exports[_0x4fb6('0x46')]=function(_0x56020b,_0x211dac){return db[_0x4fb6('0x3b')]['find']({'where':{'id':_0x56020b[_0x4fb6('0x40')]['id']}})[_0x4fb6('0x22')](handleEntityNotFound(_0x211dac,null))[_0x4fb6('0x22')](removeEntity(_0x211dac,null))[_0x4fb6('0x3e')](handleError(_0x211dac,null));};exports[_0x4fb6('0x47')]=function(_0x12a104,_0x4af3a7,_0x2b4661){var _0x436d7a={};var _0x51af94={};var _0x36beb0;var _0x351413;return db[_0x4fb6('0x3b')]['findOne']({'where':{'id':_0x12a104[_0x4fb6('0x40')]['id']}})['then'](handleEntityNotFound(_0x4af3a7,null))['then'](function(_0x40be71){if(_0x40be71){_0x36beb0=_0x40be71;_0x51af94['model']=_['keys'](db[_0x4fb6('0x48')]['rawAttributes']);_0x51af94[_0x4fb6('0x2b')]=_[_0x4fb6('0x2c')](_0x12a104['query']);_0x51af94[_0x4fb6('0x2d')]=_[_0x4fb6('0x2e')](_0x51af94['model'],_0x51af94['query']);_0x436d7a[_0x4fb6('0x30')]=_[_0x4fb6('0x2e')](_0x51af94[_0x4fb6('0x2a')],qs[_0x4fb6('0x2f')](_0x12a104[_0x4fb6('0x2b')][_0x4fb6('0x2f')]));_0x436d7a['attributes']=_0x436d7a[_0x4fb6('0x30')][_0x4fb6('0x31')]?_0x436d7a[_0x4fb6('0x30')]:_0x51af94[_0x4fb6('0x2a')];_0x436d7a[_0x4fb6('0x34')]=qs['sort'](_0x12a104[_0x4fb6('0x2b')]['sort']);_0x436d7a[_0x4fb6('0x36')]=qs[_0x4fb6('0x2d')](_[_0x4fb6('0x49')](_0x12a104[_0x4fb6('0x2b')],_0x51af94[_0x4fb6('0x2d')]));if(_0x12a104['query'][_0x4fb6('0x39')]){_0x436d7a[_0x4fb6('0x36')]=_[_0x4fb6('0x37')](_0x436d7a['where'],{'$or':_[_0x4fb6('0x28')](_0x436d7a[_0x4fb6('0x30')],function(_0x588e3f){var _0x2ebb0c={};_0x2ebb0c[_0x588e3f]={'$like':'%'+_0x12a104[_0x4fb6('0x2b')]['filter']+'%'};return _0x2ebb0c;})});}_0x436d7a=_[_0x4fb6('0x37')]({},_0x436d7a,_0x12a104[_0x4fb6('0x3a')]);return _0x36beb0['getFields'](_0x436d7a);}})['then'](function(_0x217ba0){if(_0x217ba0){_0x351413=_0x217ba0[_0x4fb6('0x31')];if(!_0x12a104[_0x4fb6('0x2b')][_0x4fb6('0x32')](_0x4fb6('0x33'))){_0x436d7a[_0x4fb6('0x1b')]=qs[_0x4fb6('0x1b')](_0x12a104[_0x4fb6('0x2b')][_0x4fb6('0x1b')]);_0x436d7a[_0x4fb6('0x1a')]=qs[_0x4fb6('0x1a')](_0x12a104[_0x4fb6('0x2b')][_0x4fb6('0x1a')]);}return _0x36beb0['getFields'](_0x436d7a);}})[_0x4fb6('0x22')](function(_0x3f9d31){if(_0x3f9d31){return _0x3f9d31?{'count':_0x351413,'rows':_0x3f9d31}:null;}})[_0x4fb6('0x22')](respondWithResult(_0x4af3a7,null))[_0x4fb6('0x3e')](handleError(_0x4af3a7,null));};exports[_0x4fb6('0x4a')]=function(_0x18977e,_0x5ad0d2,_0x472d02){var _0x4e7e24={};var _0x299029={};var _0xb62821;var _0x27a59e;return db[_0x4fb6('0x3b')][_0x4fb6('0x4b')]({'where':{'id':_0x18977e[_0x4fb6('0x40')]['id']}})[_0x4fb6('0x22')](handleEntityNotFound(_0x5ad0d2,null))['then'](function(_0x542ca8){if(_0x542ca8){_0xb62821=_0x542ca8;_0x299029[_0x4fb6('0x2a')]=_[_0x4fb6('0x2c')](db['FreshdeskField'][_0x4fb6('0x41')]);_0x299029[_0x4fb6('0x2b')]=_[_0x4fb6('0x2c')](_0x18977e['query']);_0x299029[_0x4fb6('0x2d')]=_[_0x4fb6('0x2e')](_0x299029[_0x4fb6('0x2a')],_0x299029[_0x4fb6('0x2b')]);_0x4e7e24[_0x4fb6('0x30')]=_[_0x4fb6('0x2e')](_0x299029[_0x4fb6('0x2a')],qs['fields'](_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x2f')]));_0x4e7e24['attributes']=_0x4e7e24['attributes'][_0x4fb6('0x31')]?_0x4e7e24[_0x4fb6('0x30')]:_0x299029['model'];_0x4e7e24[_0x4fb6('0x34')]=qs['sort'](_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x35')]);_0x4e7e24[_0x4fb6('0x36')]=qs['filters'](_[_0x4fb6('0x49')](_0x18977e[_0x4fb6('0x2b')],_0x299029['filters']));if(_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x39')]){_0x4e7e24[_0x4fb6('0x36')]=_[_0x4fb6('0x37')](_0x4e7e24[_0x4fb6('0x36')],{'$or':_['map'](_0x4e7e24['attributes'],function(_0x5e0c37){var _0x4f9ac2={};_0x4f9ac2[_0x5e0c37]={'$like':'%'+_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x39')]+'%'};return _0x4f9ac2;})});}_0x4e7e24=_[_0x4fb6('0x37')]({},_0x4e7e24,_0x18977e[_0x4fb6('0x3a')]);return _0xb62821[_0x4fb6('0x4a')](_0x4e7e24);}})[_0x4fb6('0x22')](function(_0x108c5b){if(_0x108c5b){_0x27a59e=_0x108c5b[_0x4fb6('0x31')];if(!_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x32')](_0x4fb6('0x33'))){_0x4e7e24[_0x4fb6('0x1b')]=qs[_0x4fb6('0x1b')](_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x1b')]);_0x4e7e24[_0x4fb6('0x1a')]=qs[_0x4fb6('0x1a')](_0x18977e[_0x4fb6('0x2b')][_0x4fb6('0x1a')]);}return _0xb62821['getSubjects'](_0x4e7e24);}})[_0x4fb6('0x22')](function(_0x4a24bd){if(_0x4a24bd){return _0x4a24bd?{'count':_0x27a59e,'rows':_0x4a24bd}:null;}})[_0x4fb6('0x22')](respondWithResult(_0x5ad0d2,null))[_0x4fb6('0x3e')](handleError(_0x5ad0d2,null));};exports['getDescriptions']=function(_0x2fc0d3,_0x712e99,_0x43a010){var _0x43d474={};var _0x1ea776={};var _0x47952d;var _0x6c0cd6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2fc0d3['params']['id']}})['then'](handleEntityNotFound(_0x712e99,null))[_0x4fb6('0x22')](function(_0x56746c){if(_0x56746c){_0x47952d=_0x56746c;_0x1ea776['model']=_[_0x4fb6('0x2c')](db['FreshdeskField'][_0x4fb6('0x41')]);_0x1ea776[_0x4fb6('0x2b')]=_['keys'](_0x2fc0d3[_0x4fb6('0x2b')]);_0x1ea776['filters']=_[_0x4fb6('0x2e')](_0x1ea776[_0x4fb6('0x2a')],_0x1ea776[_0x4fb6('0x2b')]);_0x43d474['attributes']=_[_0x4fb6('0x2e')](_0x1ea776[_0x4fb6('0x2a')],qs['fields'](_0x2fc0d3[_0x4fb6('0x2b')][_0x4fb6('0x2f')]));_0x43d474['attributes']=_0x43d474[_0x4fb6('0x30')][_0x4fb6('0x31')]?_0x43d474[_0x4fb6('0x30')]:_0x1ea776['model'];_0x43d474[_0x4fb6('0x34')]=qs[_0x4fb6('0x35')](_0x2fc0d3[_0x4fb6('0x2b')][_0x4fb6('0x35')]);_0x43d474['where']=qs[_0x4fb6('0x2d')](_[_0x4fb6('0x49')](_0x2fc0d3[_0x4fb6('0x2b')],_0x1ea776[_0x4fb6('0x2d')]));if(_0x2fc0d3[_0x4fb6('0x2b')][_0x4fb6('0x39')]){_0x43d474[_0x4fb6('0x36')]=_[_0x4fb6('0x37')](_0x43d474['where'],{'$or':_[_0x4fb6('0x28')](_0x43d474[_0x4fb6('0x30')],function(_0x38a416){var _0x5f3d98={};_0x5f3d98[_0x38a416]={'$like':'%'+_0x2fc0d3[_0x4fb6('0x2b')]['filter']+'%'};return _0x5f3d98;})});}_0x43d474=_['merge']({},_0x43d474,_0x2fc0d3[_0x4fb6('0x3a')]);return _0x47952d['getDescriptions'](_0x43d474);}})['then'](function(_0x50043b){if(_0x50043b){_0x6c0cd6=_0x50043b['length'];if(!_0x2fc0d3[_0x4fb6('0x2b')][_0x4fb6('0x32')](_0x4fb6('0x33'))){_0x43d474[_0x4fb6('0x1b')]=qs[_0x4fb6('0x1b')](_0x2fc0d3[_0x4fb6('0x2b')]['limit']);_0x43d474[_0x4fb6('0x1a')]=qs[_0x4fb6('0x1a')](_0x2fc0d3[_0x4fb6('0x2b')][_0x4fb6('0x1a')]);}return _0x47952d[_0x4fb6('0x4c')](_0x43d474);}})[_0x4fb6('0x22')](function(_0x7b1b1a){if(_0x7b1b1a){return _0x7b1b1a?{'count':_0x6c0cd6,'rows':_0x7b1b1a}:null;}})['then'](respondWithResult(_0x712e99,null))[_0x4fb6('0x3e')](handleError(_0x712e99,null));};exports[_0x4fb6('0x4d')]=function(_0x2306cb,_0x49850c,_0x14d199){var _0x451bed={};var _0x2bd150={};var _0x16bd2f;var _0x213b60;return db['FreshdeskConfiguration'][_0x4fb6('0x4b')]({'where':{'id':_0x2306cb['params']['id']}})[_0x4fb6('0x22')](handleEntityNotFound(_0x49850c,null))[_0x4fb6('0x22')](function(_0x12feff){if(_0x12feff){_0x16bd2f=_0x12feff;_0x2bd150[_0x4fb6('0x2a')]=_[_0x4fb6('0x2c')](db[_0x4fb6('0x4e')]['rawAttributes']);_0x2bd150[_0x4fb6('0x2b')]=_[_0x4fb6('0x2c')](_0x2306cb[_0x4fb6('0x2b')]);_0x2bd150[_0x4fb6('0x2d')]=_['intersection'](_0x2bd150['model'],_0x2bd150[_0x4fb6('0x2b')]);_0x451bed[_0x4fb6('0x30')]=_['intersection'](_0x2bd150[_0x4fb6('0x2a')],qs[_0x4fb6('0x2f')](_0x2306cb['query'][_0x4fb6('0x2f')]));_0x451bed['attributes']=_0x451bed[_0x4fb6('0x30')][_0x4fb6('0x31')]?_0x451bed[_0x4fb6('0x30')]:_0x2bd150[_0x4fb6('0x2a')];_0x451bed[_0x4fb6('0x34')]=qs[_0x4fb6('0x35')](_0x2306cb['query'][_0x4fb6('0x35')]);_0x451bed[_0x4fb6('0x36')]=qs[_0x4fb6('0x2d')](_[_0x4fb6('0x49')](_0x2306cb['query'],_0x2bd150[_0x4fb6('0x2d')]));if(_0x2306cb[_0x4fb6('0x2b')][_0x4fb6('0x39')]){_0x451bed[_0x4fb6('0x36')]=_[_0x4fb6('0x37')](_0x451bed[_0x4fb6('0x36')],{'$or':_[_0x4fb6('0x28')](_0x451bed[_0x4fb6('0x30')],function(_0x3007f0){var _0x5c0ef8={};_0x5c0ef8[_0x3007f0]={'$like':'%'+_0x2306cb[_0x4fb6('0x2b')]['filter']+'%'};return _0x5c0ef8;})});}_0x451bed=_[_0x4fb6('0x37')]({},_0x451bed,_0x2306cb[_0x4fb6('0x3a')]);return _0x16bd2f[_0x4fb6('0x4d')](_0x451bed);}})['then'](function(_0x1079d8){if(_0x1079d8){_0x213b60=_0x1079d8['length'];if(!_0x2306cb[_0x4fb6('0x2b')][_0x4fb6('0x32')](_0x4fb6('0x33'))){_0x451bed['limit']=qs['limit'](_0x2306cb[_0x4fb6('0x2b')]['limit']);_0x451bed[_0x4fb6('0x1a')]=qs[_0x4fb6('0x1a')](_0x2306cb[_0x4fb6('0x2b')]['offset']);}return _0x16bd2f[_0x4fb6('0x4d')](_0x451bed);}})[_0x4fb6('0x22')](function(_0xe43e30){if(_0xe43e30){return _0xe43e30?{'count':_0x213b60,'rows':_0xe43e30}:null;}})[_0x4fb6('0x22')](respondWithResult(_0x49850c,null))[_0x4fb6('0x3e')](handleError(_0x49850c,null));};exports['setTags']=function(_0x477b81,_0x10442a,_0x19d906){if(_0x477b81['body']['id']){delete _0x477b81[_0x4fb6('0x45')]['id'];}return db[_0x4fb6('0x3b')][_0x4fb6('0x4b')]({'where':{'id':_0x477b81[_0x4fb6('0x40')]['id']}})[_0x4fb6('0x22')](handleEntityNotFound(_0x10442a,null))[_0x4fb6('0x22')](function(_0x239fa5){if(_0x239fa5){return _0x239fa5[_0x4fb6('0x4f')](_0x477b81[_0x4fb6('0x45')][_0x4fb6('0x50')]||[]);}return null;})[_0x4fb6('0x22')](respondWithResult(_0x10442a,null))[_0x4fb6('0x3e')](handleError(_0x10442a,null));}; \ No newline at end of file +var _0x5a19=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','getFields','findOne','FreshdeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3170fc,_0x555526){var _0x583a21=function(_0xbeb069){while(--_0xbeb069){_0x3170fc['push'](_0x3170fc['shift']());}};_0x583a21(++_0x555526);}(_0x5a19,0x132));var _0x95a1=function(_0x55036a,_0x1e43dc){_0x55036a=_0x55036a-0x0;var _0x2ebe00=_0x5a19[_0x55036a];return _0x2ebe00;};'use strict';var emlformat=require(_0x95a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95a1('0x1'));var jsonpatch=require(_0x95a1('0x2'));var rp=require(_0x95a1('0x3'));var moment=require(_0x95a1('0x4'));var BPromise=require(_0x95a1('0x5'));var Mustache=require('mustache');var util=require(_0x95a1('0x6'));var path=require('path');var sox=require(_0x95a1('0x7'));var csv=require(_0x95a1('0x8'));var ejs=require(_0x95a1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95a1('0xa'));var squel=require('squel');var crypto=require(_0x95a1('0xb'));var jsforce=require(_0x95a1('0xc'));var deskjs=require(_0x95a1('0xd'));var toCsv=require(_0x95a1('0x8'));var querystring=require(_0x95a1('0xe'));var Papa=require('papaparse');var Redis=require(_0x95a1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x95a1('0x10'));var as=require(_0x95a1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95a1('0x12'));var utils=require(_0x95a1('0x13'));var config=require(_0x95a1('0x14'));var licenseUtil=require(_0x95a1('0x15'));var db=require(_0x95a1('0x16'))['db'];function respondWithStatusCode(_0x1428a4,_0x7ceb61){_0x7ceb61=_0x7ceb61||0xcc;return function(_0x35a817){if(_0x35a817){return _0x1428a4[_0x95a1('0x17')](_0x7ceb61);}return _0x1428a4[_0x95a1('0x18')](_0x7ceb61)['end']();};}function respondWithResult(_0x477c9c,_0x2f549d){_0x2f549d=_0x2f549d||0xc8;return function(_0x304742){if(_0x304742){return _0x477c9c[_0x95a1('0x18')](_0x2f549d)[_0x95a1('0x19')](_0x304742);}};}function respondWithFilteredResult(_0x41492f,_0x402f96){return function(_0x4f69a3){if(_0x4f69a3){var _0x84e36d=typeof _0x402f96[_0x95a1('0x1a')]===_0x95a1('0x1b')&&typeof _0x402f96[_0x95a1('0x1c')]==='undefined';var _0x102517=_0x4f69a3[_0x95a1('0x1d')];var _0x217aad=_0x84e36d?0x0:_0x402f96[_0x95a1('0x1a')];var _0x5eac99=_0x84e36d?_0x4f69a3[_0x95a1('0x1d')]:_0x402f96[_0x95a1('0x1a')]+_0x402f96[_0x95a1('0x1c')];var _0x136af2;if(_0x5eac99>=_0x102517){_0x5eac99=_0x102517;_0x136af2=0xc8;}else{_0x136af2=0xce;}_0x41492f[_0x95a1('0x18')](_0x136af2);return _0x41492f['set'](_0x95a1('0x1e'),_0x217aad+'-'+_0x5eac99+'/'+_0x102517)[_0x95a1('0x19')](_0x4f69a3);}return null;};}function patchUpdates(_0x50fd9c){return function(_0x3006af){try{jsonpatch[_0x95a1('0x1f')](_0x3006af,_0x50fd9c,!![]);}catch(_0x26878a){return BPromise[_0x95a1('0x20')](_0x26878a);}return _0x3006af[_0x95a1('0x21')]();};}function saveUpdates(_0x28dd94,_0x296c9c){return function(_0x432668){if(_0x432668){return _0x432668['update'](_0x28dd94)[_0x95a1('0x22')](function(_0x15ba50){return _0x15ba50;});}return null;};}function removeEntity(_0x4c87de,_0x31d53c){return function(_0x284982){if(_0x284982){return _0x284982[_0x95a1('0x23')]()['then'](function(){_0x4c87de[_0x95a1('0x18')](0xcc)[_0x95a1('0x24')]();});}};}function handleEntityNotFound(_0x4cdf2d,_0x557dbf){return function(_0x1cb62d){if(!_0x1cb62d){_0x4cdf2d['sendStatus'](0x194);}return _0x1cb62d;};}function handleError(_0x50b3db,_0x207632){_0x207632=_0x207632||0x1f4;return function(_0x59778c){logger[_0x95a1('0x25')](_0x59778c['stack']);if(_0x59778c[_0x95a1('0x26')]){delete _0x59778c[_0x95a1('0x26')];}_0x50b3db[_0x95a1('0x18')](_0x207632)[_0x95a1('0x27')](_0x59778c);};}exports[_0x95a1('0x28')]=function(_0x342d41,_0x374a0e){var _0x8b47b2={},_0x80769d={},_0xa5956a={'count':0x0,'rows':[]};var _0x11273b=_[_0x95a1('0x29')](db[_0x95a1('0x2a')][_0x95a1('0x2b')],function(_0x1649d3){return{'name':_0x1649d3[_0x95a1('0x2c')],'type':_0x1649d3[_0x95a1('0x2d')][_0x95a1('0x2e')]};});_0x80769d[_0x95a1('0x2f')]=_[_0x95a1('0x29')](_0x11273b,_0x95a1('0x26'));_0x80769d[_0x95a1('0x30')]=_['keys'](_0x342d41['query']);_0x80769d[_0x95a1('0x31')]=_[_0x95a1('0x32')](_0x80769d[_0x95a1('0x2f')],_0x80769d[_0x95a1('0x30')]);_0x8b47b2[_0x95a1('0x33')]=_[_0x95a1('0x32')](_0x80769d[_0x95a1('0x2f')],qs['fields'](_0x342d41[_0x95a1('0x30')][_0x95a1('0x34')]));_0x8b47b2[_0x95a1('0x33')]=_0x8b47b2['attributes'][_0x95a1('0x35')]?_0x8b47b2['attributes']:_0x80769d[_0x95a1('0x2f')];if(!_0x342d41[_0x95a1('0x30')]['hasOwnProperty'](_0x95a1('0x36'))){_0x8b47b2['limit']=qs[_0x95a1('0x1c')](_0x342d41[_0x95a1('0x30')]['limit']);_0x8b47b2[_0x95a1('0x1a')]=qs[_0x95a1('0x1a')](_0x342d41[_0x95a1('0x30')][_0x95a1('0x1a')]);}_0x8b47b2[_0x95a1('0x37')]=qs['sort'](_0x342d41[_0x95a1('0x30')][_0x95a1('0x38')]);_0x8b47b2[_0x95a1('0x39')]=qs['filters'](_['pick'](_0x342d41[_0x95a1('0x30')],_0x80769d[_0x95a1('0x31')]),_0x11273b);if(_0x342d41['query'][_0x95a1('0x3a')]){_0x8b47b2[_0x95a1('0x39')]=_[_0x95a1('0x3b')](_0x8b47b2[_0x95a1('0x39')],{'$or':_[_0x95a1('0x29')](_0x11273b,function(_0x220038){if(_0x220038[_0x95a1('0x2d')]!==_0x95a1('0x3c')){var _0x49e673={};_0x49e673[_0x220038['name']]={'$like':'%'+_0x342d41['query'][_0x95a1('0x3a')]+'%'};return _0x49e673;}})});}_0x8b47b2=_[_0x95a1('0x3b')]({},_0x8b47b2,_0x342d41[_0x95a1('0x3d')]);var _0x4bbe03={'where':_0x8b47b2[_0x95a1('0x39')]};return db[_0x95a1('0x2a')][_0x95a1('0x1d')](_0x4bbe03)[_0x95a1('0x22')](function(_0x560ac3){_0xa5956a['count']=_0x560ac3;if(_0x342d41[_0x95a1('0x30')]['includeAll']){_0x8b47b2['include']=[{'all':!![]}];}return db[_0x95a1('0x2a')][_0x95a1('0x3e')](_0x8b47b2);})[_0x95a1('0x22')](function(_0x2ada55){_0xa5956a[_0x95a1('0x3f')]=_0x2ada55;return _0xa5956a;})[_0x95a1('0x22')](respondWithFilteredResult(_0x374a0e,_0x8b47b2))[_0x95a1('0x40')](handleError(_0x374a0e,null));};exports[_0x95a1('0x41')]=function(_0x3639e4,_0x38780b){var _0x4d4347={'raw':![],'where':{'id':_0x3639e4[_0x95a1('0x42')]['id']}},_0x56ca5c={};_0x56ca5c[_0x95a1('0x2f')]=_[_0x95a1('0x43')](db[_0x95a1('0x2a')][_0x95a1('0x2b')]);_0x56ca5c[_0x95a1('0x30')]=_[_0x95a1('0x43')](_0x3639e4[_0x95a1('0x30')]);_0x56ca5c[_0x95a1('0x31')]=_[_0x95a1('0x32')](_0x56ca5c[_0x95a1('0x2f')],_0x56ca5c[_0x95a1('0x30')]);_0x4d4347[_0x95a1('0x33')]=_['intersection'](_0x56ca5c['model'],qs['fields'](_0x3639e4[_0x95a1('0x30')]['fields']));_0x4d4347[_0x95a1('0x33')]=_0x4d4347[_0x95a1('0x33')][_0x95a1('0x35')]?_0x4d4347[_0x95a1('0x33')]:_0x56ca5c[_0x95a1('0x2f')];if(_0x3639e4[_0x95a1('0x30')][_0x95a1('0x44')]){_0x4d4347['include']=[{'all':!![]}];}_0x4d4347=_[_0x95a1('0x3b')]({},_0x4d4347,_0x3639e4['options']);return db[_0x95a1('0x2a')][_0x95a1('0x45')](_0x4d4347)[_0x95a1('0x22')](handleEntityNotFound(_0x38780b,null))[_0x95a1('0x22')](respondWithResult(_0x38780b,null))['catch'](handleError(_0x38780b,null));};exports[_0x95a1('0x46')]=function(_0x48e01e,_0x23ad28){return db['FreshdeskConfiguration']['create'](_0x48e01e[_0x95a1('0x47')],{})['then'](respondWithResult(_0x23ad28,0xc9))[_0x95a1('0x40')](handleError(_0x23ad28,null));};exports[_0x95a1('0x48')]=function(_0x493796,_0x1cf4af){if(_0x493796[_0x95a1('0x47')]['id']){delete _0x493796[_0x95a1('0x47')]['id'];}return db[_0x95a1('0x2a')][_0x95a1('0x45')]({'where':{'id':_0x493796[_0x95a1('0x42')]['id']}})['then'](handleEntityNotFound(_0x1cf4af,null))['then'](saveUpdates(_0x493796[_0x95a1('0x47')],null))[_0x95a1('0x22')](respondWithResult(_0x1cf4af,null))[_0x95a1('0x40')](handleError(_0x1cf4af,null));};exports[_0x95a1('0x23')]=function(_0x41658a,_0x3e38b9){return db[_0x95a1('0x2a')][_0x95a1('0x45')]({'where':{'id':_0x41658a[_0x95a1('0x42')]['id']}})[_0x95a1('0x22')](handleEntityNotFound(_0x3e38b9,null))['then'](removeEntity(_0x3e38b9,null))['catch'](handleError(_0x3e38b9,null));};exports[_0x95a1('0x49')]=function(_0x358e9e,_0x39ab5d,_0x11ec54){var _0x9e3ab8={};var _0x16c919={};var _0x41a54e;var _0x75e60d;return db['FreshdeskConfiguration'][_0x95a1('0x4a')]({'where':{'id':_0x358e9e[_0x95a1('0x42')]['id']}})['then'](handleEntityNotFound(_0x39ab5d,null))[_0x95a1('0x22')](function(_0x3379ab){if(_0x3379ab){_0x41a54e=_0x3379ab;_0x16c919[_0x95a1('0x2f')]=_[_0x95a1('0x43')](db[_0x95a1('0x4b')][_0x95a1('0x2b')]);_0x16c919[_0x95a1('0x30')]=_[_0x95a1('0x43')](_0x358e9e[_0x95a1('0x30')]);_0x16c919[_0x95a1('0x31')]=_['intersection'](_0x16c919[_0x95a1('0x2f')],_0x16c919[_0x95a1('0x30')]);_0x9e3ab8['attributes']=_['intersection'](_0x16c919[_0x95a1('0x2f')],qs['fields'](_0x358e9e[_0x95a1('0x30')]['fields']));_0x9e3ab8['attributes']=_0x9e3ab8[_0x95a1('0x33')][_0x95a1('0x35')]?_0x9e3ab8['attributes']:_0x16c919['model'];_0x9e3ab8[_0x95a1('0x37')]=qs[_0x95a1('0x38')](_0x358e9e[_0x95a1('0x30')][_0x95a1('0x38')]);_0x9e3ab8[_0x95a1('0x39')]=qs[_0x95a1('0x31')](_[_0x95a1('0x4c')](_0x358e9e[_0x95a1('0x30')],_0x16c919['filters']));if(_0x358e9e[_0x95a1('0x30')][_0x95a1('0x3a')]){_0x9e3ab8[_0x95a1('0x39')]=_[_0x95a1('0x3b')](_0x9e3ab8[_0x95a1('0x39')],{'$or':_[_0x95a1('0x29')](_0x9e3ab8['attributes'],function(_0x853c4d){var _0x5d94b3={};_0x5d94b3[_0x853c4d]={'$like':'%'+_0x358e9e[_0x95a1('0x30')][_0x95a1('0x3a')]+'%'};return _0x5d94b3;})});}_0x9e3ab8=_[_0x95a1('0x3b')]({},_0x9e3ab8,_0x358e9e['options']);return _0x41a54e[_0x95a1('0x49')](_0x9e3ab8);}})[_0x95a1('0x22')](function(_0x1ad2a5){if(_0x1ad2a5){_0x75e60d=_0x1ad2a5['length'];if(!_0x358e9e[_0x95a1('0x30')][_0x95a1('0x4d')]('nolimit')){_0x9e3ab8[_0x95a1('0x1c')]=qs[_0x95a1('0x1c')](_0x358e9e[_0x95a1('0x30')][_0x95a1('0x1c')]);_0x9e3ab8[_0x95a1('0x1a')]=qs[_0x95a1('0x1a')](_0x358e9e[_0x95a1('0x30')][_0x95a1('0x1a')]);}return _0x41a54e['getFields'](_0x9e3ab8);}})['then'](function(_0x5aba74){if(_0x5aba74){return _0x5aba74?{'count':_0x75e60d,'rows':_0x5aba74}:null;}})[_0x95a1('0x22')](respondWithResult(_0x39ab5d,null))[_0x95a1('0x40')](handleError(_0x39ab5d,null));};exports[_0x95a1('0x4e')]=function(_0xf8760a,_0x30931b,_0x59ae88){var _0x14ed3e={};var _0x5248f6={};var _0x1c595f;var _0x4fb762;return db[_0x95a1('0x2a')][_0x95a1('0x4a')]({'where':{'id':_0xf8760a[_0x95a1('0x42')]['id']}})[_0x95a1('0x22')](handleEntityNotFound(_0x30931b,null))[_0x95a1('0x22')](function(_0x153f25){if(_0x153f25){_0x1c595f=_0x153f25;_0x5248f6[_0x95a1('0x2f')]=_[_0x95a1('0x43')](db['FreshdeskField']['rawAttributes']);_0x5248f6['query']=_[_0x95a1('0x43')](_0xf8760a['query']);_0x5248f6['filters']=_[_0x95a1('0x32')](_0x5248f6[_0x95a1('0x2f')],_0x5248f6[_0x95a1('0x30')]);_0x14ed3e['attributes']=_[_0x95a1('0x32')](_0x5248f6[_0x95a1('0x2f')],qs[_0x95a1('0x34')](_0xf8760a[_0x95a1('0x30')][_0x95a1('0x34')]));_0x14ed3e[_0x95a1('0x33')]=_0x14ed3e[_0x95a1('0x33')][_0x95a1('0x35')]?_0x14ed3e[_0x95a1('0x33')]:_0x5248f6[_0x95a1('0x2f')];_0x14ed3e[_0x95a1('0x37')]=qs[_0x95a1('0x38')](_0xf8760a[_0x95a1('0x30')][_0x95a1('0x38')]);_0x14ed3e[_0x95a1('0x39')]=qs['filters'](_[_0x95a1('0x4c')](_0xf8760a[_0x95a1('0x30')],_0x5248f6[_0x95a1('0x31')]));if(_0xf8760a[_0x95a1('0x30')][_0x95a1('0x3a')]){_0x14ed3e[_0x95a1('0x39')]=_[_0x95a1('0x3b')](_0x14ed3e[_0x95a1('0x39')],{'$or':_[_0x95a1('0x29')](_0x14ed3e[_0x95a1('0x33')],function(_0x52bc05){var _0x53ef72={};_0x53ef72[_0x52bc05]={'$like':'%'+_0xf8760a['query'][_0x95a1('0x3a')]+'%'};return _0x53ef72;})});}_0x14ed3e=_[_0x95a1('0x3b')]({},_0x14ed3e,_0xf8760a['options']);return _0x1c595f[_0x95a1('0x4e')](_0x14ed3e);}})[_0x95a1('0x22')](function(_0x45cb71){if(_0x45cb71){_0x4fb762=_0x45cb71[_0x95a1('0x35')];if(!_0xf8760a['query']['hasOwnProperty'](_0x95a1('0x36'))){_0x14ed3e['limit']=qs['limit'](_0xf8760a[_0x95a1('0x30')][_0x95a1('0x1c')]);_0x14ed3e['offset']=qs[_0x95a1('0x1a')](_0xf8760a['query'][_0x95a1('0x1a')]);}return _0x1c595f[_0x95a1('0x4e')](_0x14ed3e);}})[_0x95a1('0x22')](function(_0x19ce88){if(_0x19ce88){return _0x19ce88?{'count':_0x4fb762,'rows':_0x19ce88}:null;}})[_0x95a1('0x22')](respondWithResult(_0x30931b,null))[_0x95a1('0x40')](handleError(_0x30931b,null));};exports[_0x95a1('0x4f')]=function(_0x5483f3,_0x25f4de,_0x383c4d){var _0x4cab2b={};var _0x4531d3={};var _0xfe4699;var _0x404bb2;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5483f3[_0x95a1('0x42')]['id']}})[_0x95a1('0x22')](handleEntityNotFound(_0x25f4de,null))['then'](function(_0x3abf46){if(_0x3abf46){_0xfe4699=_0x3abf46;_0x4531d3[_0x95a1('0x2f')]=_['keys'](db[_0x95a1('0x4b')]['rawAttributes']);_0x4531d3[_0x95a1('0x30')]=_[_0x95a1('0x43')](_0x5483f3['query']);_0x4531d3[_0x95a1('0x31')]=_[_0x95a1('0x32')](_0x4531d3[_0x95a1('0x2f')],_0x4531d3[_0x95a1('0x30')]);_0x4cab2b[_0x95a1('0x33')]=_[_0x95a1('0x32')](_0x4531d3['model'],qs[_0x95a1('0x34')](_0x5483f3['query'][_0x95a1('0x34')]));_0x4cab2b[_0x95a1('0x33')]=_0x4cab2b[_0x95a1('0x33')]['length']?_0x4cab2b['attributes']:_0x4531d3[_0x95a1('0x2f')];_0x4cab2b[_0x95a1('0x37')]=qs[_0x95a1('0x38')](_0x5483f3[_0x95a1('0x30')][_0x95a1('0x38')]);_0x4cab2b[_0x95a1('0x39')]=qs['filters'](_['pick'](_0x5483f3[_0x95a1('0x30')],_0x4531d3[_0x95a1('0x31')]));if(_0x5483f3[_0x95a1('0x30')][_0x95a1('0x3a')]){_0x4cab2b[_0x95a1('0x39')]=_[_0x95a1('0x3b')](_0x4cab2b[_0x95a1('0x39')],{'$or':_[_0x95a1('0x29')](_0x4cab2b[_0x95a1('0x33')],function(_0x16e86d){var _0x31095a={};_0x31095a[_0x16e86d]={'$like':'%'+_0x5483f3['query']['filter']+'%'};return _0x31095a;})});}_0x4cab2b=_['merge']({},_0x4cab2b,_0x5483f3[_0x95a1('0x3d')]);return _0xfe4699[_0x95a1('0x4f')](_0x4cab2b);}})[_0x95a1('0x22')](function(_0x339263){if(_0x339263){_0x404bb2=_0x339263['length'];if(!_0x5483f3['query'][_0x95a1('0x4d')](_0x95a1('0x36'))){_0x4cab2b[_0x95a1('0x1c')]=qs['limit'](_0x5483f3['query'][_0x95a1('0x1c')]);_0x4cab2b[_0x95a1('0x1a')]=qs[_0x95a1('0x1a')](_0x5483f3['query'][_0x95a1('0x1a')]);}return _0xfe4699[_0x95a1('0x4f')](_0x4cab2b);}})[_0x95a1('0x22')](function(_0x32d2eb){if(_0x32d2eb){return _0x32d2eb?{'count':_0x404bb2,'rows':_0x32d2eb}:null;}})['then'](respondWithResult(_0x25f4de,null))[_0x95a1('0x40')](handleError(_0x25f4de,null));};exports[_0x95a1('0x50')]=function(_0x34b153,_0xb56d89,_0x5a1d7e){var _0x4c4df8={};var _0x4c6108={};var _0x1206e4;var _0x3f5a45;return db[_0x95a1('0x2a')][_0x95a1('0x4a')]({'where':{'id':_0x34b153['params']['id']}})[_0x95a1('0x22')](handleEntityNotFound(_0xb56d89,null))[_0x95a1('0x22')](function(_0x290b70){if(_0x290b70){_0x1206e4=_0x290b70;_0x4c6108[_0x95a1('0x2f')]=_[_0x95a1('0x43')](db['Tag'][_0x95a1('0x2b')]);_0x4c6108[_0x95a1('0x30')]=_[_0x95a1('0x43')](_0x34b153['query']);_0x4c6108['filters']=_[_0x95a1('0x32')](_0x4c6108[_0x95a1('0x2f')],_0x4c6108[_0x95a1('0x30')]);_0x4c4df8[_0x95a1('0x33')]=_[_0x95a1('0x32')](_0x4c6108[_0x95a1('0x2f')],qs['fields'](_0x34b153[_0x95a1('0x30')][_0x95a1('0x34')]));_0x4c4df8['attributes']=_0x4c4df8[_0x95a1('0x33')]['length']?_0x4c4df8[_0x95a1('0x33')]:_0x4c6108['model'];_0x4c4df8[_0x95a1('0x37')]=qs['sort'](_0x34b153[_0x95a1('0x30')][_0x95a1('0x38')]);_0x4c4df8[_0x95a1('0x39')]=qs[_0x95a1('0x31')](_[_0x95a1('0x4c')](_0x34b153[_0x95a1('0x30')],_0x4c6108[_0x95a1('0x31')]));if(_0x34b153[_0x95a1('0x30')]['filter']){_0x4c4df8[_0x95a1('0x39')]=_[_0x95a1('0x3b')](_0x4c4df8[_0x95a1('0x39')],{'$or':_[_0x95a1('0x29')](_0x4c4df8[_0x95a1('0x33')],function(_0x4bd682){var _0xc09f5e={};_0xc09f5e[_0x4bd682]={'$like':'%'+_0x34b153[_0x95a1('0x30')][_0x95a1('0x3a')]+'%'};return _0xc09f5e;})});}_0x4c4df8=_[_0x95a1('0x3b')]({},_0x4c4df8,_0x34b153[_0x95a1('0x3d')]);return _0x1206e4[_0x95a1('0x50')](_0x4c4df8);}})[_0x95a1('0x22')](function(_0x45f25e){if(_0x45f25e){_0x3f5a45=_0x45f25e[_0x95a1('0x35')];if(!_0x34b153[_0x95a1('0x30')][_0x95a1('0x4d')]('nolimit')){_0x4c4df8[_0x95a1('0x1c')]=qs[_0x95a1('0x1c')](_0x34b153[_0x95a1('0x30')][_0x95a1('0x1c')]);_0x4c4df8[_0x95a1('0x1a')]=qs[_0x95a1('0x1a')](_0x34b153[_0x95a1('0x30')][_0x95a1('0x1a')]);}return _0x1206e4[_0x95a1('0x50')](_0x4c4df8);}})[_0x95a1('0x22')](function(_0x26aa33){if(_0x26aa33){return _0x26aa33?{'count':_0x3f5a45,'rows':_0x26aa33}:null;}})[_0x95a1('0x22')](respondWithResult(_0xb56d89,null))[_0x95a1('0x40')](handleError(_0xb56d89,null));};exports[_0x95a1('0x51')]=function(_0x373a7e,_0x1afc28,_0x3478ab){if(_0x373a7e[_0x95a1('0x47')]['id']){delete _0x373a7e[_0x95a1('0x47')]['id'];}return db[_0x95a1('0x2a')][_0x95a1('0x4a')]({'where':{'id':_0x373a7e['params']['id']}})[_0x95a1('0x22')](handleEntityNotFound(_0x1afc28,null))[_0x95a1('0x22')](function(_0x46194d){if(_0x46194d){return _0x46194d[_0x95a1('0x51')](_0x373a7e[_0x95a1('0x47')]['ids']||[]);}return null;})[_0x95a1('0x22')](respondWithResult(_0x1afc28,null))[_0x95a1('0x40')](handleError(_0x1afc28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 10b4241..2043f0f 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 _0xcdb2=['api','bluebird','path','rimraf','../../config/environment','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x1bf6e4,_0x3721e8){var _0x44adec=function(_0x530d95){while(--_0x530d95){_0x1bf6e4['push'](_0x1bf6e4['shift']());}};_0x44adec(++_0x3721e8);}(_0xcdb2,0xfa));var _0x2cdb=function(_0x5d1cc4,_0x1cbd9d){_0x5d1cc4=_0x5d1cc4-0x0;var _0xe07bd1=_0xcdb2[_0x5d1cc4];return _0xe07bd1;};'use strict';var _=require(_0x2cdb('0x0'));var util=require(_0x2cdb('0x1'));var logger=require(_0x2cdb('0x2'))(_0x2cdb('0x3'));var moment=require('moment');var BPromise=require(_0x2cdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cdb('0x5'));var rimraf=require(_0x2cdb('0x6'));var config=require(_0x2cdb('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x2cdb('0x8')]=function(_0x17e31d,_0x5e9018){return _0x17e31d[_0x2cdb('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x2cdb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e84=['exports','define','FreshdeskConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2ce171,_0x5a2303){var _0x54a006=function(_0x2ad6e7){while(--_0x2ad6e7){_0x2ce171['push'](_0x2ce171['shift']());}};_0x54a006(++_0x5a2303);}(_0x4e84,0x92));var _0x44e8=function(_0x3c7ac3,_0x233375){_0x3c7ac3=_0x3c7ac3-0x0;var _0x4da424=_0x4e84[_0x3c7ac3];return _0x4da424;};'use strict';var _=require('lodash');var util=require(_0x44e8('0x0'));var logger=require(_0x44e8('0x1'))(_0x44e8('0x2'));var moment=require(_0x44e8('0x3'));var BPromise=require(_0x44e8('0x4'));var rp=require(_0x44e8('0x5'));var fs=require('fs');var path=require(_0x44e8('0x6'));var rimraf=require(_0x44e8('0x7'));var config=require(_0x44e8('0x8'));var attributes=require(_0x44e8('0x9'));module[_0x44e8('0xa')]=function(_0x51952a,_0x316ca6){return _0x51952a[_0x44e8('0xb')](_0x44e8('0xc'),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 8f03de8..3a2d8e7 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 _0x7b2a=['debug','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x5e45aa,_0x5e9db5){var _0x23c617=function(_0x191c67){while(--_0x191c67){_0x5e45aa['push'](_0x5e45aa['shift']());}};_0x23c617(++_0x5e9db5);}(_0x7b2a,0x92));var _0xa7b2=function(_0xf58ba6,_0x410c6b){_0xf58ba6=_0xf58ba6-0x0;var _0xc449a8=_0x7b2a[_0xf58ba6];return _0xc449a8;};'use strict';var _=require(_0xa7b2('0x0'));var util=require(_0xa7b2('0x1'));var moment=require(_0xa7b2('0x2'));var BPromise=require(_0xa7b2('0x3'));var rs=require(_0xa7b2('0x4'));var fs=require('fs');var Redis=require(_0xa7b2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa7b2('0x6'))(_0xa7b2('0x7'));var config=require(_0xa7b2('0x8'));var jayson=require(_0xa7b2('0x9'));var client=jayson['client'][_0xa7b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd1dc03,_0x19433a,_0x28fca1){return new BPromise(function(_0x8e98d9,_0x12ad45){return client[_0xa7b2('0xb')](_0xd1dc03,_0x28fca1)[_0xa7b2('0xc')](function(_0x1b223d){logger[_0xa7b2('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x19433a,_0xa7b2('0xe'));logger[_0xa7b2('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x19433a,_0xa7b2('0xe'),JSON[_0xa7b2('0x10')](_0x1b223d));if(_0x1b223d[_0xa7b2('0x11')]){if(_0x1b223d[_0xa7b2('0x11')][_0xa7b2('0x12')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x19433a,_0x1b223d[_0xa7b2('0x11')][_0xa7b2('0x13')]);return _0x12ad45(_0x1b223d[_0xa7b2('0x11')][_0xa7b2('0x13')]);}logger['error'](_0xa7b2('0x14'),_0x19433a,_0x1b223d[_0xa7b2('0x11')][_0xa7b2('0x13')]);return _0x8e98d9(_0x1b223d['error'][_0xa7b2('0x13')]);}else{logger[_0xa7b2('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x19433a,_0xa7b2('0xe'));_0x8e98d9(_0x1b223d[_0xa7b2('0x15')][_0xa7b2('0x13')]);}})[_0xa7b2('0x16')](function(_0x4aa290){logger['error'](_0xa7b2('0x14'),_0x19433a,_0x4aa290);_0x12ad45(_0x4aa290);});});} \ No newline at end of file +var _0x21b7=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x1abcfa,_0x31757b){var _0x5d498c=function(_0x1ed0bc){while(--_0x1ed0bc){_0x1abcfa['push'](_0x1abcfa['shift']());}};_0x5d498c(++_0x31757b);}(_0x21b7,0x16d));var _0x721b=function(_0x3f9162,_0x48b6c7){_0x3f9162=_0x3f9162-0x0;var _0x2aae01=_0x21b7[_0x3f9162];return _0x2aae01;};'use strict';var _=require(_0x721b('0x0'));var util=require(_0x721b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x721b('0x2'));var fs=require('fs');var Redis=require(_0x721b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x721b('0x4'));var logger=require(_0x721b('0x5'))(_0x721b('0x6'));var config=require(_0x721b('0x7'));var jayson=require(_0x721b('0x8'));var client=jayson['client'][_0x721b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1de5,_0x23ad06,_0x96f886){return new BPromise(function(_0x391804,_0x4bfdaa){return client['request'](_0x5e1de5,_0x96f886)[_0x721b('0xa')](function(_0x55f22e){logger[_0x721b('0xb')](_0x721b('0xc'),_0x23ad06,'request\x20sent');logger[_0x721b('0xd')](_0x721b('0xe'),_0x23ad06,_0x721b('0xf'),JSON['stringify'](_0x55f22e));if(_0x55f22e[_0x721b('0x10')]){if(_0x55f22e['error'][_0x721b('0x11')]===0x1f4){logger[_0x721b('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x23ad06,_0x55f22e[_0x721b('0x10')]['message']);return _0x4bfdaa(_0x55f22e[_0x721b('0x10')][_0x721b('0x12')]);}logger[_0x721b('0x10')](_0x721b('0xc'),_0x23ad06,_0x55f22e[_0x721b('0x10')][_0x721b('0x12')]);return _0x391804(_0x55f22e['error'][_0x721b('0x12')]);}else{logger[_0x721b('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x23ad06,_0x721b('0xf'));_0x391804(_0x55f22e[_0x721b('0x13')][_0x721b('0x12')]);}})[_0x721b('0x14')](function(_0x17da44){logger[_0x721b('0x10')](_0x721b('0xc'),_0x23ad06,_0x17da44);_0x4bfdaa(_0x17da44);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2c1c887..9f39d38 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 _0x2785=['create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x55affd,_0xaa69f4){var _0x3cc6c5=function(_0x28bbc4){while(--_0x28bbc4){_0x55affd['push'](_0x55affd['shift']());}};_0x3cc6c5(++_0xaa69f4);}(_0x2785,0x76));var _0x5278=function(_0x23e4cf,_0x12704d){_0x23e4cf=_0x23e4cf-0x0;var _0x2bd35a=_0x2785[_0x23e4cf];return _0x2bd35a;};'use strict';var multer=require('multer');var util=require(_0x5278('0x0'));var path=require(_0x5278('0x1'));var timeout=require(_0x5278('0x2'));var express=require(_0x5278('0x3'));var router=express[_0x5278('0x4')]();var fs_extra=require(_0x5278('0x5'));var auth=require(_0x5278('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5278('0x7'));var controller=require(_0x5278('0x8'));router[_0x5278('0x9')]('/',auth[_0x5278('0xa')](),controller[_0x5278('0xb')]);router['get'](_0x5278('0xc'),auth['isAuthenticated'](),controller[_0x5278('0xd')]);router[_0x5278('0xe')]('/',auth[_0x5278('0xa')](),controller[_0x5278('0xf')]);router[_0x5278('0x10')](_0x5278('0xc'),auth[_0x5278('0xa')](),controller['update']);router[_0x5278('0x11')](_0x5278('0xc'),auth[_0x5278('0xa')](),controller[_0x5278('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7187=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','path'];(function(_0x1865fb,_0x3915f2){var _0x1dbe96=function(_0x325a0e){while(--_0x325a0e){_0x1865fb['push'](_0x1865fb['shift']());}};_0x1dbe96(++_0x3915f2);}(_0x7187,0x174));var _0x7718=function(_0x252691,_0x38d38b){_0x252691=_0x252691-0x0;var _0x5d0ce1=_0x7187[_0x252691];return _0x5d0ce1;};'use strict';var multer=require(_0x7718('0x0'));var util=require('util');var path=require(_0x7718('0x1'));var timeout=require(_0x7718('0x2'));var express=require(_0x7718('0x3'));var router=express[_0x7718('0x4')]();var fs_extra=require(_0x7718('0x5'));var auth=require(_0x7718('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7718('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x7718('0x8')]('/',auth[_0x7718('0x9')](),controller['index']);router[_0x7718('0x8')](_0x7718('0xa'),auth[_0x7718('0x9')](),controller['show']);router[_0x7718('0xb')]('/',auth[_0x7718('0x9')](),controller[_0x7718('0xc')]);router[_0x7718('0xd')](_0x7718('0xa'),auth[_0x7718('0x9')](),controller[_0x7718('0xe')]);router['delete'](_0x7718('0xa'),auth[_0x7718('0x9')](),controller[_0x7718('0xf')]);module[_0x7718('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index b4bd524..346d8bf 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 _0xae11=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x303a53,_0x95347d){var _0x1a8d03=function(_0x5f08f8){while(--_0x5f08f8){_0x303a53['push'](_0x303a53['shift']());}};_0x1a8d03(++_0x95347d);}(_0xae11,0x17b));var _0x1ae1=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0xae11[_0x57cb4f];return _0x29bb45;};'use strict';var Sequelize=require(_0x1ae1('0x0'));module[_0x1ae1('0x1')]={'type':{'type':Sequelize[_0x1ae1('0x2')](_0x1ae1('0x3'),_0x1ae1('0x4'),_0x1ae1('0x5'),_0x1ae1('0x6'),_0x1ae1('0x7')),'defaultValue':_0x1ae1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1ae1('0x8')]},'keyType':{'type':Sequelize[_0x1ae1('0x2')]('string',_0x1ae1('0x4'),_0x1ae1('0x5'))},'keyContent':{'type':Sequelize[_0x1ae1('0x8')]},'idField':{'type':Sequelize[_0x1ae1('0x8')]},'nameField':{'type':Sequelize[_0x1ae1('0x8')]},'customField':{'type':Sequelize[_0x1ae1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ae1('0x8')]}}; \ No newline at end of file +var _0x7069=['keyValue','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x2a92d5,_0x46d690){var _0x4d4356=function(_0x3033c7){while(--_0x3033c7){_0x2a92d5['push'](_0x2a92d5['shift']());}};_0x4d4356(++_0x46d690);}(_0x7069,0xcb));var _0x9706=function(_0x5d2bd6,_0x377005){_0x5d2bd6=_0x5d2bd6-0x0;var _0x796b32=_0x7069[_0x5d2bd6];return _0x796b32;};'use strict';var Sequelize=require(_0x9706('0x0'));module[_0x9706('0x1')]={'type':{'type':Sequelize[_0x9706('0x2')]('string','variable',_0x9706('0x3'),_0x9706('0x4'),'picklist'),'defaultValue':_0x9706('0x5')},'content':{'type':Sequelize[_0x9706('0x6')]},'key':{'type':Sequelize[_0x9706('0x6')]},'keyType':{'type':Sequelize[_0x9706('0x2')](_0x9706('0x5'),_0x9706('0x7'),_0x9706('0x3'))},'keyContent':{'type':Sequelize[_0x9706('0x6')]},'idField':{'type':Sequelize[_0x9706('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9706('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8f7dd8f..ee2d863 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 _0x76dc=['body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','FreshdeskField','includeAll','include','rows','params','options','find','catch','create'];(function(_0x24abf9,_0x477120){var _0x151b4a=function(_0x26eb17){while(--_0x26eb17){_0x24abf9['push'](_0x24abf9['shift']());}};_0x151b4a(++_0x477120);}(_0x76dc,0x1f2));var _0xc76d=function(_0x4066cf,_0x3ecc60){_0x4066cf=_0x4066cf-0x0;var _0x3181a6=_0x76dc[_0x4066cf];return _0x3181a6;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x55ca79,_0x374b9e){return function(_0x476aee){if(!_0x476aee){_0x55ca79[_0xc76d('0x17')](0x194);}return _0x476aee;};}function handleError(_0xd1dda0,_0xfc4aea){_0xfc4aea=_0xfc4aea||0x1f4;return function(_0x1949c4){logger[_0xc76d('0x26')](_0x1949c4['stack']);if(_0x1949c4['name']){delete _0x1949c4[_0xc76d('0x27')];}_0xd1dda0[_0xc76d('0x18')](_0xfc4aea)['send'](_0x1949c4);};}exports[_0xc76d('0x28')]=function(_0x52a79a,_0x64899f){var _0x49fa89={},_0x2039f4={},_0x5cf2e4={'count':0x0,'rows':[]};var _0x13b468=_[_0xc76d('0x29')](db['FreshdeskField'][_0xc76d('0x2a')],function(_0x1c68f3){return{'name':_0x1c68f3[_0xc76d('0x2b')],'type':_0x1c68f3[_0xc76d('0x2c')]['key']};});_0x2039f4[_0xc76d('0x2d')]=_['map'](_0x13b468,_0xc76d('0x27'));_0x2039f4['query']=_[_0xc76d('0x2e')](_0x52a79a[_0xc76d('0x2f')]);_0x2039f4['filters']=_['intersection'](_0x2039f4['model'],_0x2039f4['query']);_0x49fa89[_0xc76d('0x30')]=_[_0xc76d('0x31')](_0x2039f4[_0xc76d('0x2d')],qs[_0xc76d('0x32')](_0x52a79a[_0xc76d('0x2f')]['fields']));_0x49fa89[_0xc76d('0x30')]=_0x49fa89['attributes'][_0xc76d('0x33')]?_0x49fa89['attributes']:_0x2039f4[_0xc76d('0x2d')];if(!_0x52a79a[_0xc76d('0x2f')][_0xc76d('0x34')](_0xc76d('0x35'))){_0x49fa89[_0xc76d('0x1d')]=qs['limit'](_0x52a79a[_0xc76d('0x2f')][_0xc76d('0x1d')]);_0x49fa89[_0xc76d('0x1c')]=qs['offset'](_0x52a79a[_0xc76d('0x2f')][_0xc76d('0x1c')]);}_0x49fa89[_0xc76d('0x36')]=qs['sort'](_0x52a79a[_0xc76d('0x2f')][_0xc76d('0x37')]);_0x49fa89[_0xc76d('0x38')]=qs[_0xc76d('0x39')](_[_0xc76d('0x3a')](_0x52a79a[_0xc76d('0x2f')],_0x2039f4['filters']),_0x13b468);if(_0x52a79a['query'][_0xc76d('0x3b')]){_0x49fa89['where']=_[_0xc76d('0x3c')](_0x49fa89[_0xc76d('0x38')],{'$or':_[_0xc76d('0x29')](_0x13b468,function(_0x1925a1){if(_0x1925a1['type']!=='VIRTUAL'){var _0xc907eb={};_0xc907eb[_0x1925a1[_0xc76d('0x27')]]={'$like':'%'+_0x52a79a[_0xc76d('0x2f')][_0xc76d('0x3b')]+'%'};return _0xc907eb;}})});}_0x49fa89=_[_0xc76d('0x3c')]({},_0x49fa89,_0x52a79a['options']);var _0x42404c={'where':_0x49fa89[_0xc76d('0x38')]};return db[_0xc76d('0x3d')][_0xc76d('0x1b')](_0x42404c)[_0xc76d('0x24')](function(_0x78e14a){_0x5cf2e4[_0xc76d('0x1b')]=_0x78e14a;if(_0x52a79a[_0xc76d('0x2f')][_0xc76d('0x3e')]){_0x49fa89[_0xc76d('0x3f')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x49fa89);})[_0xc76d('0x24')](function(_0x2a0759){_0x5cf2e4[_0xc76d('0x40')]=_0x2a0759;return _0x5cf2e4;})[_0xc76d('0x24')](respondWithFilteredResult(_0x64899f,_0x49fa89))['catch'](handleError(_0x64899f,null));};exports['show']=function(_0x45be72,_0x13a895){var _0x3e471e={'raw':!![],'where':{'id':_0x45be72[_0xc76d('0x41')]['id']}},_0x15eb42={};_0x15eb42[_0xc76d('0x2d')]=_[_0xc76d('0x2e')](db[_0xc76d('0x3d')]['rawAttributes']);_0x15eb42[_0xc76d('0x2f')]=_[_0xc76d('0x2e')](_0x45be72[_0xc76d('0x2f')]);_0x15eb42[_0xc76d('0x39')]=_['intersection'](_0x15eb42['model'],_0x15eb42['query']);_0x3e471e['attributes']=_['intersection'](_0x15eb42['model'],qs['fields'](_0x45be72[_0xc76d('0x2f')][_0xc76d('0x32')]));_0x3e471e[_0xc76d('0x30')]=_0x3e471e[_0xc76d('0x30')][_0xc76d('0x33')]?_0x3e471e[_0xc76d('0x30')]:_0x15eb42[_0xc76d('0x2d')];if(_0x45be72[_0xc76d('0x2f')]['includeAll']){_0x3e471e[_0xc76d('0x3f')]=[{'all':!![]}];}_0x3e471e=_[_0xc76d('0x3c')]({},_0x3e471e,_0x45be72[_0xc76d('0x42')]);return db[_0xc76d('0x3d')][_0xc76d('0x43')](_0x3e471e)[_0xc76d('0x24')](handleEntityNotFound(_0x13a895,null))[_0xc76d('0x24')](respondWithResult(_0x13a895,null))[_0xc76d('0x44')](handleError(_0x13a895,null));};exports[_0xc76d('0x45')]=function(_0x4fb26e,_0x5b41d3){return db[_0xc76d('0x3d')][_0xc76d('0x45')](_0x4fb26e[_0xc76d('0x46')],{})[_0xc76d('0x24')](respondWithResult(_0x5b41d3,0xc9))[_0xc76d('0x44')](handleError(_0x5b41d3,null));};exports['update']=function(_0x25fc9d,_0x1ede13){if(_0x25fc9d['body']['id']){delete _0x25fc9d['body']['id'];}return db[_0xc76d('0x3d')][_0xc76d('0x43')]({'where':{'id':_0x25fc9d['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x1ede13,null))[_0xc76d('0x24')](saveUpdates(_0x25fc9d[_0xc76d('0x46')],null))[_0xc76d('0x24')](respondWithResult(_0x1ede13,null))[_0xc76d('0x44')](handleError(_0x1ede13,null));};exports[_0xc76d('0x25')]=function(_0x25a549,_0x10b1b0){return db[_0xc76d('0x3d')][_0xc76d('0x43')]({'where':{'id':_0x25a549['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x10b1b0,null))[_0xc76d('0x24')](removeEntity(_0x10b1b0,null))[_0xc76d('0x44')](handleError(_0x10b1b0,null));}; \ No newline at end of file +var _0xd757=['type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','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/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName'];(function(_0x14e669,_0x23e972){var _0x44ea06=function(_0x3eca7b){while(--_0x3eca7b){_0x14e669['push'](_0x14e669['shift']());}};_0x44ea06(++_0x23e972);}(_0xd757,0x1e5));var _0x7d75=function(_0x1f19da,_0x4823c4){_0x1f19da=_0x1f19da-0x0;var _0x797b66=_0xd757[_0x1f19da];return _0x797b66;};'use strict';var emlformat=require(_0x7d75('0x0'));var rimraf=require(_0x7d75('0x1'));var zipdir=require(_0x7d75('0x2'));var jsonpatch=require(_0x7d75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d75('0x4'));var Mustache=require(_0x7d75('0x5'));var util=require('util');var path=require(_0x7d75('0x6'));var sox=require(_0x7d75('0x7'));var csv=require(_0x7d75('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d75('0x9'));var squel=require(_0x7d75('0xa'));var crypto=require(_0x7d75('0xb'));var jsforce=require(_0x7d75('0xc'));var deskjs=require(_0x7d75('0xd'));var toCsv=require(_0x7d75('0x8'));var querystring=require(_0x7d75('0xe'));var Papa=require(_0x7d75('0xf'));var Redis=require(_0x7d75('0x10'));var authService=require(_0x7d75('0x11'));var qs=require(_0x7d75('0x12'));var as=require(_0x7d75('0x13'));var hardwareService=require(_0x7d75('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7d75('0x15'));var config=require(_0x7d75('0x16'));var licenseUtil=require(_0x7d75('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e7b97,_0x3a5ca5){_0x3a5ca5=_0x3a5ca5||0xcc;return function(_0x5c9fcf){if(_0x5c9fcf){return _0x3e7b97[_0x7d75('0x18')](_0x3a5ca5);}return _0x3e7b97[_0x7d75('0x19')](_0x3a5ca5)[_0x7d75('0x1a')]();};}function respondWithResult(_0x43e546,_0x2b5d23){_0x2b5d23=_0x2b5d23||0xc8;return function(_0x3be8b2){if(_0x3be8b2){return _0x43e546['status'](_0x2b5d23)[_0x7d75('0x1b')](_0x3be8b2);}};}function respondWithFilteredResult(_0x1a460b,_0x14100f){return function(_0x1a9778){if(_0x1a9778){var _0x44041e=typeof _0x14100f[_0x7d75('0x1c')]==='undefined'&&typeof _0x14100f[_0x7d75('0x1d')]==='undefined';var _0x3896c3=_0x1a9778[_0x7d75('0x1e')];var _0x40edfc=_0x44041e?0x0:_0x14100f[_0x7d75('0x1c')];var _0x356b44=_0x44041e?_0x1a9778[_0x7d75('0x1e')]:_0x14100f[_0x7d75('0x1c')]+_0x14100f[_0x7d75('0x1d')];var _0x55b89d;if(_0x356b44>=_0x3896c3){_0x356b44=_0x3896c3;_0x55b89d=0xc8;}else{_0x55b89d=0xce;}_0x1a460b['status'](_0x55b89d);return _0x1a460b[_0x7d75('0x1f')](_0x7d75('0x20'),_0x40edfc+'-'+_0x356b44+'/'+_0x3896c3)[_0x7d75('0x1b')](_0x1a9778);}return null;};}function patchUpdates(_0xbb0322){return function(_0x47a5f0){try{jsonpatch[_0x7d75('0x21')](_0x47a5f0,_0xbb0322,!![]);}catch(_0x31bfa8){return BPromise[_0x7d75('0x22')](_0x31bfa8);}return _0x47a5f0[_0x7d75('0x23')]();};}function saveUpdates(_0x232c46,_0x187093){return function(_0x486ce1){if(_0x486ce1){return _0x486ce1[_0x7d75('0x24')](_0x232c46)[_0x7d75('0x25')](function(_0x1c0327){return _0x1c0327;});}return null;};}function removeEntity(_0x3be591,_0x21211b){return function(_0x323e20){if(_0x323e20){return _0x323e20[_0x7d75('0x26')]()[_0x7d75('0x25')](function(){_0x3be591[_0x7d75('0x19')](0xcc)[_0x7d75('0x1a')]();});}};}function handleEntityNotFound(_0x3103d6,_0x5a1218){return function(_0xec279d){if(!_0xec279d){_0x3103d6[_0x7d75('0x18')](0x194);}return _0xec279d;};}function handleError(_0x4f67e6,_0x19a230){_0x19a230=_0x19a230||0x1f4;return function(_0x50d798){logger[_0x7d75('0x27')](_0x50d798[_0x7d75('0x28')]);if(_0x50d798[_0x7d75('0x29')]){delete _0x50d798[_0x7d75('0x29')];}_0x4f67e6[_0x7d75('0x19')](_0x19a230)['send'](_0x50d798);};}exports[_0x7d75('0x2a')]=function(_0x31055c,_0x2f783b){var _0xb0c225={},_0x1121a6={},_0x11ba6c={'count':0x0,'rows':[]};var _0x5dd4f1=_[_0x7d75('0x2b')](db[_0x7d75('0x2c')][_0x7d75('0x2d')],function(_0x2a1c5b){return{'name':_0x2a1c5b[_0x7d75('0x2e')],'type':_0x2a1c5b[_0x7d75('0x2f')][_0x7d75('0x30')]};});_0x1121a6['model']=_['map'](_0x5dd4f1,'name');_0x1121a6[_0x7d75('0x31')]=_['keys'](_0x31055c[_0x7d75('0x31')]);_0x1121a6[_0x7d75('0x32')]=_[_0x7d75('0x33')](_0x1121a6[_0x7d75('0x34')],_0x1121a6[_0x7d75('0x31')]);_0xb0c225['attributes']=_[_0x7d75('0x33')](_0x1121a6[_0x7d75('0x34')],qs[_0x7d75('0x35')](_0x31055c[_0x7d75('0x31')][_0x7d75('0x35')]));_0xb0c225[_0x7d75('0x36')]=_0xb0c225[_0x7d75('0x36')][_0x7d75('0x37')]?_0xb0c225[_0x7d75('0x36')]:_0x1121a6[_0x7d75('0x34')];if(!_0x31055c['query'][_0x7d75('0x38')](_0x7d75('0x39'))){_0xb0c225[_0x7d75('0x1d')]=qs[_0x7d75('0x1d')](_0x31055c[_0x7d75('0x31')][_0x7d75('0x1d')]);_0xb0c225['offset']=qs[_0x7d75('0x1c')](_0x31055c[_0x7d75('0x31')]['offset']);}_0xb0c225['order']=qs[_0x7d75('0x3a')](_0x31055c[_0x7d75('0x31')][_0x7d75('0x3a')]);_0xb0c225[_0x7d75('0x3b')]=qs[_0x7d75('0x32')](_[_0x7d75('0x3c')](_0x31055c['query'],_0x1121a6[_0x7d75('0x32')]),_0x5dd4f1);if(_0x31055c[_0x7d75('0x31')]['filter']){_0xb0c225[_0x7d75('0x3b')]=_[_0x7d75('0x3d')](_0xb0c225[_0x7d75('0x3b')],{'$or':_[_0x7d75('0x2b')](_0x5dd4f1,function(_0x30aeab){if(_0x30aeab[_0x7d75('0x2f')]!==_0x7d75('0x3e')){var _0x815d03={};_0x815d03[_0x30aeab[_0x7d75('0x29')]]={'$like':'%'+_0x31055c[_0x7d75('0x31')][_0x7d75('0x3f')]+'%'};return _0x815d03;}})});}_0xb0c225=_[_0x7d75('0x3d')]({},_0xb0c225,_0x31055c[_0x7d75('0x40')]);var _0x35ac15={'where':_0xb0c225[_0x7d75('0x3b')]};return db[_0x7d75('0x2c')][_0x7d75('0x1e')](_0x35ac15)[_0x7d75('0x25')](function(_0x304c32){_0x11ba6c[_0x7d75('0x1e')]=_0x304c32;if(_0x31055c['query']['includeAll']){_0xb0c225[_0x7d75('0x41')]=[{'all':!![]}];}return db[_0x7d75('0x2c')][_0x7d75('0x42')](_0xb0c225);})[_0x7d75('0x25')](function(_0x222ece){_0x11ba6c[_0x7d75('0x43')]=_0x222ece;return _0x11ba6c;})[_0x7d75('0x25')](respondWithFilteredResult(_0x2f783b,_0xb0c225))['catch'](handleError(_0x2f783b,null));};exports[_0x7d75('0x44')]=function(_0x23e6f9,_0x42a57e){var _0x5edd82={'raw':!![],'where':{'id':_0x23e6f9[_0x7d75('0x45')]['id']}},_0x2e1f36={};_0x2e1f36[_0x7d75('0x34')]=_[_0x7d75('0x46')](db[_0x7d75('0x2c')][_0x7d75('0x2d')]);_0x2e1f36[_0x7d75('0x31')]=_[_0x7d75('0x46')](_0x23e6f9[_0x7d75('0x31')]);_0x2e1f36[_0x7d75('0x32')]=_[_0x7d75('0x33')](_0x2e1f36['model'],_0x2e1f36[_0x7d75('0x31')]);_0x5edd82['attributes']=_['intersection'](_0x2e1f36[_0x7d75('0x34')],qs['fields'](_0x23e6f9[_0x7d75('0x31')][_0x7d75('0x35')]));_0x5edd82['attributes']=_0x5edd82[_0x7d75('0x36')][_0x7d75('0x37')]?_0x5edd82[_0x7d75('0x36')]:_0x2e1f36[_0x7d75('0x34')];if(_0x23e6f9[_0x7d75('0x31')][_0x7d75('0x47')]){_0x5edd82[_0x7d75('0x41')]=[{'all':!![]}];}_0x5edd82=_[_0x7d75('0x3d')]({},_0x5edd82,_0x23e6f9['options']);return db[_0x7d75('0x2c')][_0x7d75('0x48')](_0x5edd82)[_0x7d75('0x25')](handleEntityNotFound(_0x42a57e,null))['then'](respondWithResult(_0x42a57e,null))[_0x7d75('0x49')](handleError(_0x42a57e,null));};exports[_0x7d75('0x4a')]=function(_0x34ff66,_0x277788){return db[_0x7d75('0x2c')][_0x7d75('0x4a')](_0x34ff66['body'],{})[_0x7d75('0x25')](respondWithResult(_0x277788,0xc9))[_0x7d75('0x49')](handleError(_0x277788,null));};exports[_0x7d75('0x24')]=function(_0x31b9be,_0x4cb900){if(_0x31b9be[_0x7d75('0x4b')]['id']){delete _0x31b9be['body']['id'];}return db[_0x7d75('0x2c')][_0x7d75('0x48')]({'where':{'id':_0x31b9be[_0x7d75('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cb900,null))[_0x7d75('0x25')](saveUpdates(_0x31b9be['body'],null))[_0x7d75('0x25')](respondWithResult(_0x4cb900,null))['catch'](handleError(_0x4cb900,null));};exports[_0x7d75('0x26')]=function(_0x27a11f,_0x1009eb){return db['FreshdeskField'][_0x7d75('0x48')]({'where':{'id':_0x27a11f['params']['id']}})[_0x7d75('0x25')](handleEntityNotFound(_0x1009eb,null))[_0x7d75('0x25')](removeEntity(_0x1009eb,null))[_0x7d75('0x49')](handleError(_0x1009eb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 83fc12a..e4f7f96 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 _0xcdd0=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','rimraf','./intFreshdeskField.attributes'];(function(_0x49f66e,_0x3e2369){var _0x55a1e2=function(_0x50bccd){while(--_0x50bccd){_0x49f66e['push'](_0x49f66e['shift']());}};_0x55a1e2(++_0x3e2369);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xcdd0[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var moment=require('moment');var BPromise=require(_0x0cdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0cdd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0cdd('0x6'));module[_0x0cdd('0x7')]=function(_0xe80a73,_0x5ca0f9){return _0xe80a73[_0x0cdd('0x8')](_0x0cdd('0x9'),attributes,{'tableName':_0x0cdd('0xa'),'paranoid':![],'indexes':[{'name':_0x0cdd('0xb'),'fields':[_0x0cdd('0xc'),_0x0cdd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52cb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util'];(function(_0xdc6dcf,_0x4e9d7a){var _0x7cc8da=function(_0x2829a6){while(--_0x2829a6){_0xdc6dcf['push'](_0xdc6dcf['shift']());}};_0x7cc8da(++_0x4e9d7a);}(_0x52cb,0x1a2));var _0xb52c=function(_0x5bd50e,_0x4dee56){_0x5bd50e=_0x5bd50e-0x0;var _0x42f9e5=_0x52cb[_0x5bd50e];return _0x42f9e5;};'use strict';var _=require(_0xb52c('0x0'));var util=require(_0xb52c('0x1'));var logger=require('../../config/logger')(_0xb52c('0x2'));var moment=require(_0xb52c('0x3'));var BPromise=require(_0xb52c('0x4'));var rp=require(_0xb52c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb52c('0x6'));var config=require(_0xb52c('0x7'));var attributes=require(_0xb52c('0x8'));module[_0xb52c('0x9')]=function(_0x304783,_0x30fd4f){return _0x304783[_0xb52c('0xa')](_0xb52c('0xb'),attributes,{'tableName':_0xb52c('0xc'),'paranoid':![],'indexes':[{'name':_0xb52c('0xd'),'fields':[_0xb52c('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index cacf281..89efaef 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 _0xcb4c=['info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x30fa09,_0x28c43d){var _0x2032db=function(_0x40dcc9){while(--_0x40dcc9){_0x30fa09['push'](_0x30fa09['shift']());}};_0x2032db(++_0x28c43d);}(_0xcb4c,0x126));var _0xccb4=function(_0x90775f,_0x3f9fa1){_0x90775f=_0x90775f-0x0;var _0x134c7d=_0xcb4c[_0x90775f];return _0x134c7d;};'use strict';var _=require('lodash');var util=require(_0xccb4('0x0'));var moment=require(_0xccb4('0x1'));var BPromise=require('bluebird');var rs=require(_0xccb4('0x2'));var fs=require('fs');var Redis=require(_0xccb4('0x3'));var db=require(_0xccb4('0x4'))['db'];var utils=require(_0xccb4('0x5'));var logger=require(_0xccb4('0x6'))(_0xccb4('0x7'));var config=require(_0xccb4('0x8'));var jayson=require(_0xccb4('0x9'));var client=jayson[_0xccb4('0xa')][_0xccb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb27b,_0x4092b4,_0x32ee87){return new BPromise(function(_0x545e89,_0xc321a1){return client[_0xccb4('0xc')](_0x4cb27b,_0x32ee87)[_0xccb4('0xd')](function(_0x33818d){logger[_0xccb4('0xe')](_0xccb4('0xf'),_0x4092b4,'request\x20sent');logger[_0xccb4('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4092b4,_0xccb4('0x11'),JSON[_0xccb4('0x12')](_0x33818d));if(_0x33818d[_0xccb4('0x13')]){if(_0x33818d[_0xccb4('0x13')][_0xccb4('0x14')]===0x1f4){logger[_0xccb4('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4092b4,_0x33818d[_0xccb4('0x13')][_0xccb4('0x15')]);return _0xc321a1(_0x33818d[_0xccb4('0x13')][_0xccb4('0x15')]);}logger[_0xccb4('0x13')](_0xccb4('0xf'),_0x4092b4,_0x33818d[_0xccb4('0x13')][_0xccb4('0x15')]);return _0x545e89(_0x33818d['error'][_0xccb4('0x15')]);}else{logger[_0xccb4('0xe')](_0xccb4('0xf'),_0x4092b4,_0xccb4('0x11'));_0x545e89(_0x33818d['result'][_0xccb4('0x15')]);}})['catch'](function(_0x16f23e){logger[_0xccb4('0x13')](_0xccb4('0xf'),_0x4092b4,_0x16f23e);_0xc321a1(_0x16f23e);});});} \ No newline at end of file +var _0x11a4=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x11a4,0x1c0));var _0x411a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x11a4[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x411a('0x0'));var util=require(_0x411a('0x1'));var moment=require(_0x411a('0x2'));var BPromise=require(_0x411a('0x3'));var rs=require(_0x411a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x411a('0x5'))['db'];var utils=require(_0x411a('0x6'));var logger=require('../../config/logger')(_0x411a('0x7'));var config=require(_0x411a('0x8'));var jayson=require(_0x411a('0x9'));var client=jayson[_0x411a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eeb92,_0x4a79b7,_0x2b3a58){return new BPromise(function(_0x455daa,_0x41602f){return client[_0x411a('0xb')](_0x2eeb92,_0x2b3a58)['then'](function(_0x4cfe5b){logger[_0x411a('0xc')](_0x411a('0xd'),_0x4a79b7,'request\x20sent');logger[_0x411a('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4a79b7,_0x411a('0xf'),JSON[_0x411a('0x10')](_0x4cfe5b));if(_0x4cfe5b[_0x411a('0x11')]){if(_0x4cfe5b[_0x411a('0x11')][_0x411a('0x12')]===0x1f4){logger[_0x411a('0x11')](_0x411a('0xd'),_0x4a79b7,_0x4cfe5b['error'][_0x411a('0x13')]);return _0x41602f(_0x4cfe5b[_0x411a('0x11')]['message']);}logger[_0x411a('0x11')](_0x411a('0xd'),_0x4a79b7,_0x4cfe5b[_0x411a('0x11')][_0x411a('0x13')]);return _0x455daa(_0x4cfe5b[_0x411a('0x11')][_0x411a('0x13')]);}else{logger[_0x411a('0xc')](_0x411a('0xd'),_0x4a79b7,_0x411a('0xf'));_0x455daa(_0x4cfe5b[_0x411a('0x14')][_0x411a('0x13')]);}})[_0x411a('0x15')](function(_0x79a4c0){logger[_0x411a('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x4a79b7,_0x79a4c0);_0x41602f(_0x79a4c0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 53ae3e1..d79801c 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['addConfiguration','update','delete','/:id','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x312aad,_0x495b70){var _0x99c6cf=function(_0x20a295){while(--_0x20a295){_0x312aad['push'](_0x312aad['shift']());}};_0x99c6cf(++_0x495b70);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xcb91[_0x1d70db];return _0x3060c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller['destroy']);module[_0x1cb9('0x14')]=router; \ No newline at end of file +var _0x8f59=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x415b51,_0x1a29ee){var _0x1dd82c=function(_0x25afee){while(--_0x25afee){_0x415b51['push'](_0x415b51['shift']());}};_0x1dd82c(++_0x1a29ee);}(_0x8f59,0x11d));var _0x98f5=function(_0x5d0594,_0x3d8ede){_0x5d0594=_0x5d0594-0x0;var _0x179e9a=_0x8f59[_0x5d0594];return _0x179e9a;};'use strict';var multer=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var path=require(_0x98f5('0x2'));var timeout=require(_0x98f5('0x3'));var express=require(_0x98f5('0x4'));var router=express[_0x98f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x98f5('0x6'));var interaction=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var controller=require(_0x98f5('0x9'));router['get']('/',auth[_0x98f5('0xa')](),controller[_0x98f5('0xb')]);router[_0x98f5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x98f5('0xd')]);router[_0x98f5('0xc')](_0x98f5('0xe'),auth['isAuthenticated'](),controller[_0x98f5('0xf')]);router[_0x98f5('0xc')](_0x98f5('0x10'),auth[_0x98f5('0xa')](),controller['getFields']);router[_0x98f5('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x98f5('0x11')](_0x98f5('0xe'),auth['isAuthenticated'](),controller[_0x98f5('0x12')]);router[_0x98f5('0x13')](_0x98f5('0x14'),auth[_0x98f5('0xa')](),controller[_0x98f5('0x15')]);router[_0x98f5('0x16')]('/:id',auth[_0x98f5('0xa')](),controller[_0x98f5('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index df78511..53f6e5b 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 _0x8f4c=['sequelize','exports','STRING','username','remoteUri'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2d2e0d,_0x2bf907){_0x2d2e0d=_0x2d2e0d-0x0;var _0x103367=_0x8f4c[_0x2d2e0d];return _0x103367;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')]},'description':{'type':Sequelize[_0xc8f4('0x2')]},'username':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x4')},'serverUrl':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd4a2=['STRING','username','sequelize'];(function(_0x3aa5df,_0x243fbb){var _0x2eff2d=function(_0x5d3fc8){while(--_0x5d3fc8){_0x3aa5df['push'](_0x3aa5df['shift']());}};_0x2eff2d(++_0x243fbb);}(_0xd4a2,0x173));var _0x2d4a=function(_0xf3faf1,_0x445650){_0xf3faf1=_0xf3faf1-0x0;var _0x55b2c9=_0xd4a2[_0xf3faf1];return _0x55b2c9;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('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 276bba6..4e765f8 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 _0x3231=['apply','reject','save','then','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','update','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','username','apiKey','remoteUri','substring','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields','stringify','test','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x3231,0x16b));var _0x1323=function(_0x111452,_0x1b46c3){_0x111452=_0x111452-0x0;var _0x43d6f5=_0x3231[_0x111452];return _0x43d6f5;};'use strict';var emlformat=require(_0x1323('0x0'));var rimraf=require(_0x1323('0x1'));var zipdir=require(_0x1323('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1323('0x3'));var moment=require(_0x1323('0x4'));var BPromise=require(_0x1323('0x5'));var Mustache=require(_0x1323('0x6'));var util=require(_0x1323('0x7'));var path=require(_0x1323('0x8'));var sox=require('sox');var csv=require(_0x1323('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1323('0xa'));var squel=require(_0x1323('0xb'));var crypto=require(_0x1323('0xc'));var jsforce=require(_0x1323('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1323('0x9'));var querystring=require(_0x1323('0xe'));var Papa=require(_0x1323('0xf'));var Redis=require(_0x1323('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1323('0x11'));var as=require(_0x1323('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1323('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1323('0x14'));function respondWithStatusCode(_0x18fd2c,_0x314e3b){_0x314e3b=_0x314e3b||0xcc;return function(_0x4d37c5){if(_0x4d37c5){return _0x18fd2c['sendStatus'](_0x314e3b);}return _0x18fd2c[_0x1323('0x15')](_0x314e3b)[_0x1323('0x16')]();};}function respondWithResult(_0x578cb9,_0x2663b7){_0x2663b7=_0x2663b7||0xc8;return function(_0xe9f789){if(_0xe9f789){return _0x578cb9['status'](_0x2663b7)[_0x1323('0x17')](_0xe9f789);}};}function respondWithFilteredResult(_0x2796d6,_0x920328){return function(_0xae7b1a){if(_0xae7b1a){var _0xe09b02=typeof _0x920328[_0x1323('0x18')]==='undefined'&&typeof _0x920328[_0x1323('0x19')]===_0x1323('0x1a');var _0x1b581e=_0xae7b1a['count'];var _0x1fcc0b=_0xe09b02?0x0:_0x920328[_0x1323('0x18')];var _0x5036d9=_0xe09b02?_0xae7b1a[_0x1323('0x1b')]:_0x920328[_0x1323('0x18')]+_0x920328['limit'];var _0x2eba15;if(_0x5036d9>=_0x1b581e){_0x5036d9=_0x1b581e;_0x2eba15=0xc8;}else{_0x2eba15=0xce;}_0x2796d6[_0x1323('0x15')](_0x2eba15);return _0x2796d6['set'](_0x1323('0x1c'),_0x1fcc0b+'-'+_0x5036d9+'/'+_0x1b581e)['json'](_0xae7b1a);}return null;};}function patchUpdates(_0x24ec2b){return function(_0x24bb76){try{jsonpatch[_0x1323('0x1d')](_0x24bb76,_0x24ec2b,!![]);}catch(_0x1320f3){return BPromise[_0x1323('0x1e')](_0x1320f3);}return _0x24bb76[_0x1323('0x1f')]();};}function saveUpdates(_0x2c9024,_0x46c5dd){return function(_0x267d69){if(_0x267d69){return _0x267d69['update'](_0x2c9024)['then'](function(_0x23fa98){return _0x23fa98;});}return null;};}function removeEntity(_0x8466b0,_0x510335){return function(_0xbf2094){if(_0xbf2094){return _0xbf2094['destroy']()[_0x1323('0x20')](function(){_0x8466b0['status'](0xcc)[_0x1323('0x16')]();});}};}function handleEntityNotFound(_0x2b70ad,_0x59d7e1){return function(_0x4678b8){if(!_0x4678b8){_0x2b70ad[_0x1323('0x21')](0x194);}return _0x4678b8;};}function handleError(_0x487212,_0x44f522){_0x44f522=_0x44f522||0x1f4;return function(_0x2df6c0){logger[_0x1323('0x22')](_0x2df6c0[_0x1323('0x23')]);if(_0x2df6c0[_0x1323('0x24')]){delete _0x2df6c0[_0x1323('0x24')];}_0x487212['status'](_0x44f522)[_0x1323('0x25')](_0x2df6c0);};}exports[_0x1323('0x26')]=function(_0x39867d,_0x14209b){var _0x2b163e={},_0x137fca={},_0x20399d={'count':0x0,'rows':[]};var _0x4781ed=_[_0x1323('0x27')](db[_0x1323('0x28')]['rawAttributes'],function(_0x298163){return{'name':_0x298163[_0x1323('0x29')],'type':_0x298163[_0x1323('0x2a')][_0x1323('0x2b')]};});_0x137fca['model']=_[_0x1323('0x27')](_0x4781ed,_0x1323('0x24'));_0x137fca[_0x1323('0x2c')]=_[_0x1323('0x2d')](_0x39867d[_0x1323('0x2c')]);_0x137fca[_0x1323('0x2e')]=_[_0x1323('0x2f')](_0x137fca['model'],_0x137fca[_0x1323('0x2c')]);_0x2b163e[_0x1323('0x30')]=_[_0x1323('0x2f')](_0x137fca[_0x1323('0x31')],qs['fields'](_0x39867d[_0x1323('0x2c')][_0x1323('0x32')]));_0x2b163e[_0x1323('0x30')]=_0x2b163e['attributes'][_0x1323('0x33')]?_0x2b163e[_0x1323('0x30')]:_0x137fca[_0x1323('0x31')];if(!_0x39867d[_0x1323('0x2c')][_0x1323('0x34')]('nolimit')){_0x2b163e[_0x1323('0x19')]=qs[_0x1323('0x19')](_0x39867d[_0x1323('0x2c')]['limit']);_0x2b163e[_0x1323('0x18')]=qs[_0x1323('0x18')](_0x39867d[_0x1323('0x2c')]['offset']);}_0x2b163e[_0x1323('0x35')]=qs[_0x1323('0x36')](_0x39867d['query'][_0x1323('0x36')]);_0x2b163e[_0x1323('0x37')]=qs[_0x1323('0x2e')](_[_0x1323('0x38')](_0x39867d[_0x1323('0x2c')],_0x137fca[_0x1323('0x2e')]),_0x4781ed);if(_0x39867d[_0x1323('0x2c')][_0x1323('0x39')]){_0x2b163e['where']=_[_0x1323('0x3a')](_0x2b163e['where'],{'$or':_['map'](_0x4781ed,function(_0x336721){if(_0x336721['type']!=='VIRTUAL'){var _0x28a79d={};_0x28a79d[_0x336721[_0x1323('0x24')]]={'$like':'%'+_0x39867d['query'][_0x1323('0x39')]+'%'};return _0x28a79d;}})});}_0x2b163e=_['merge']({},_0x2b163e,_0x39867d[_0x1323('0x3b')]);var _0x35621b={'where':_0x2b163e[_0x1323('0x37')]};return db[_0x1323('0x28')][_0x1323('0x1b')](_0x35621b)[_0x1323('0x20')](function(_0x3a26d8){_0x20399d[_0x1323('0x1b')]=_0x3a26d8;if(_0x39867d[_0x1323('0x2c')]['includeAll']){_0x2b163e['include']=[{'all':!![]}];}return db[_0x1323('0x28')][_0x1323('0x3c')](_0x2b163e);})['then'](function(_0x10ee00){_0x20399d['rows']=_0x10ee00;return _0x20399d;})[_0x1323('0x20')](respondWithFilteredResult(_0x14209b,_0x2b163e))[_0x1323('0x3d')](handleError(_0x14209b,null));};exports[_0x1323('0x3e')]=function(_0x9c4dc3,_0x16870a){var _0x2c589e={'raw':![],'where':{'id':_0x9c4dc3[_0x1323('0x3f')]['id']}},_0x5a990f={};_0x5a990f[_0x1323('0x31')]=_[_0x1323('0x2d')](db[_0x1323('0x28')][_0x1323('0x40')]);_0x5a990f[_0x1323('0x2c')]=_['keys'](_0x9c4dc3[_0x1323('0x2c')]);_0x5a990f[_0x1323('0x2e')]=_['intersection'](_0x5a990f[_0x1323('0x31')],_0x5a990f[_0x1323('0x2c')]);_0x2c589e[_0x1323('0x30')]=_[_0x1323('0x2f')](_0x5a990f[_0x1323('0x31')],qs[_0x1323('0x32')](_0x9c4dc3[_0x1323('0x2c')][_0x1323('0x32')]));_0x2c589e[_0x1323('0x30')]=_0x2c589e[_0x1323('0x30')][_0x1323('0x33')]?_0x2c589e[_0x1323('0x30')]:_0x5a990f['model'];if(_0x9c4dc3['query'][_0x1323('0x41')]){_0x2c589e[_0x1323('0x42')]=[{'all':!![]}];}_0x2c589e=_[_0x1323('0x3a')]({},_0x2c589e,_0x9c4dc3['options']);return db['FreshsalesAccount'][_0x1323('0x43')](_0x2c589e)[_0x1323('0x20')](handleEntityNotFound(_0x16870a,null))[_0x1323('0x20')](respondWithResult(_0x16870a,null))[_0x1323('0x3d')](handleError(_0x16870a,null));};exports['create']=function(_0x261c3b,_0x2dbbf7){return db[_0x1323('0x28')][_0x1323('0x44')](_0x261c3b['body'],{})[_0x1323('0x20')](respondWithResult(_0x2dbbf7,0xc9))[_0x1323('0x3d')](handleError(_0x2dbbf7,null));};exports[_0x1323('0x45')]=function(_0x556f42,_0x3a1755){if(_0x556f42['body']['id']){delete _0x556f42[_0x1323('0x46')]['id'];}return db['FreshsalesAccount'][_0x1323('0x43')]({'where':{'id':_0x556f42[_0x1323('0x3f')]['id']}})[_0x1323('0x20')](handleEntityNotFound(_0x3a1755,null))[_0x1323('0x20')](saveUpdates(_0x556f42[_0x1323('0x46')],null))[_0x1323('0x20')](respondWithResult(_0x3a1755,null))['catch'](handleError(_0x3a1755,null));};exports[_0x1323('0x47')]=function(_0x1d265a,_0x10c753){return db[_0x1323('0x28')]['find']({'where':{'id':_0x1d265a[_0x1323('0x3f')]['id']}})[_0x1323('0x20')](handleEntityNotFound(_0x10c753,null))[_0x1323('0x20')](removeEntity(_0x10c753,null))[_0x1323('0x3d')](handleError(_0x10c753,null));};exports[_0x1323('0x48')]=function(_0x4fc1fa,_0x9f58e5,_0xc5f3b0){var _0x82bfb5={};var _0x2307f5={};var _0x5edb5f;var _0x534d26;return db[_0x1323('0x28')][_0x1323('0x49')]({'where':{'id':_0x4fc1fa[_0x1323('0x3f')]['id']}})[_0x1323('0x20')](handleEntityNotFound(_0x9f58e5,null))[_0x1323('0x20')](function(_0x326e0b){if(_0x326e0b){_0x5edb5f=_0x326e0b;_0x2307f5[_0x1323('0x31')]=_['keys'](db[_0x1323('0x4a')][_0x1323('0x40')]);_0x2307f5[_0x1323('0x2c')]=_[_0x1323('0x2d')](_0x4fc1fa['query']);_0x2307f5[_0x1323('0x2e')]=_[_0x1323('0x2f')](_0x2307f5[_0x1323('0x31')],_0x2307f5[_0x1323('0x2c')]);_0x82bfb5[_0x1323('0x30')]=_['intersection'](_0x2307f5['model'],qs[_0x1323('0x32')](_0x4fc1fa[_0x1323('0x2c')][_0x1323('0x32')]));_0x82bfb5[_0x1323('0x30')]=_0x82bfb5[_0x1323('0x30')][_0x1323('0x33')]?_0x82bfb5[_0x1323('0x30')]:_0x2307f5[_0x1323('0x31')];_0x82bfb5[_0x1323('0x35')]=qs[_0x1323('0x36')](_0x4fc1fa[_0x1323('0x2c')][_0x1323('0x36')]);_0x82bfb5[_0x1323('0x37')]=qs[_0x1323('0x2e')](_[_0x1323('0x38')](_0x4fc1fa[_0x1323('0x2c')],_0x2307f5['filters']));if(_0x4fc1fa['query'][_0x1323('0x39')]){_0x82bfb5[_0x1323('0x37')]=_['merge'](_0x82bfb5[_0x1323('0x37')],{'$or':_['map'](_0x82bfb5['attributes'],function(_0x20be54){var _0x2765c7={};_0x2765c7[_0x20be54]={'$like':'%'+_0x4fc1fa[_0x1323('0x2c')][_0x1323('0x39')]+'%'};return _0x2765c7;})});}_0x82bfb5=_['merge']({},_0x82bfb5,_0x4fc1fa[_0x1323('0x3b')]);return _0x5edb5f[_0x1323('0x48')](_0x82bfb5);}})['then'](function(_0x190535){if(_0x190535){_0x534d26=_0x190535[_0x1323('0x33')];if(!_0x4fc1fa[_0x1323('0x2c')][_0x1323('0x34')]('nolimit')){_0x82bfb5[_0x1323('0x19')]=qs[_0x1323('0x19')](_0x4fc1fa[_0x1323('0x2c')]['limit']);_0x82bfb5[_0x1323('0x18')]=qs[_0x1323('0x18')](_0x4fc1fa['query'][_0x1323('0x18')]);}return _0x5edb5f['getConfigurations'](_0x82bfb5);}})['then'](function(_0x322af5){if(_0x322af5){return _0x322af5?{'count':_0x534d26,'rows':_0x322af5}:null;}})[_0x1323('0x20')](respondWithResult(_0x9f58e5,null))[_0x1323('0x3d')](handleError(_0x9f58e5,null));};exports[_0x1323('0x4b')]=function(_0x4c1f95,_0x5dabd0,_0x4a0a26){if(_0x4c1f95[_0x1323('0x46')]['id']){delete _0x4c1f95[_0x1323('0x46')]['id'];}return db[_0x1323('0x28')][_0x1323('0x49')]({'where':{'id':_0x4c1f95['params']['id']}})[_0x1323('0x20')](handleEntityNotFound(_0x5dabd0,null))[_0x1323('0x20')](function(_0x4b4e04){if(_0x4b4e04){_0x4c1f95[_0x1323('0x46')][_0x1323('0x4c')]=_0x4b4e04['id'];_0x4c1f95[_0x1323('0x46')]['Subjects']=integrations[_0x1323('0x4d')](_0x4c1f95[_0x1323('0x46')][_0x1323('0x4e')],_0x4c1f95[_0x1323('0x46')][_0x1323('0x2a')]);_0x4c1f95[_0x1323('0x46')]['Descriptions']=integrations[_0x1323('0x4f')](_0x4c1f95[_0x1323('0x46')]['channel'],_0x4c1f95['body'][_0x1323('0x2a')]);return db['FreshsalesConfiguration'][_0x1323('0x44')](_0x4c1f95[_0x1323('0x46')],{'include':[{'model':db[_0x1323('0x50')],'as':_0x1323('0x51')},{'model':db[_0x1323('0x50')],'as':_0x1323('0x52')}]});}return null;})[_0x1323('0x20')](respondWithResult(_0x5dabd0,null))[_0x1323('0x3d')](handleError(_0x5dabd0,null));};exports['getFields']=function(_0x2d6619,_0x392303,_0x3c46eb){var _0x41d854='';var _0x2d2826='';return db[_0x1323('0x28')]['findOne']({'where':{'id':_0x2d6619['params']['id']},'attributes':['id',_0x1323('0x53'),'remoteUri',_0x1323('0x54')]})[_0x1323('0x20')](handleEntityNotFound(_0x392303,null))[_0x1323('0x20')](function(_0x1ad62f){if(_0x1ad62f){_0x2d2826=_0x1ad62f[_0x1323('0x53')];_0x41d854=_0x1ad62f[_0x1323('0x55')];var _0xa44640=_0x1ad62f[_0x1323('0x55')]['slice'](-0x1);if(_0xa44640==='/'){_0x41d854=_0x41d854[_0x1323('0x56')](0x0,_0x41d854['lastIndexOf'](_0xa44640));}return rp({'method':_0x1323('0x57'),'uri':util[_0x1323('0x58')]('%s%s',_0x41d854,_0x1323('0x59')),'headers':{'Authorization':_0x1323('0x5a')+_0x1ad62f['apiKey']},'json':!![]});}})[_0x1323('0x20')](function(_0x2f5878){if(_0x2f5878){var _0x238274=_0x2f5878[_0x1323('0x5b')];var _0x5d8820=![];var _0x103a22=null;for(_0x103a22=0x0;_0x103a22<_0x238274['length'];_0x103a22++){if(_0x238274[_0x103a22][_0x1323('0x5c')]===_0x2d2826){_0x5d8820=!![];}}if(_0x5d8820){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1323('0x5d')});}}})[_0x1323('0x20')](respondWithResult(_0x392303,null))['catch'](function(_0x227427){var _0x5c65b9=_0x2d6619[_0x1323('0x2c')]['test']?0x1f4:_0x227427[_0x1323('0x5e')]||0x1f4;logger[_0x1323('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x1323('0x5f'),_0x5c65b9,JSON[_0x1323('0x60')](_0x227427));delete _0x227427[_0x1323('0x24')];if(_0x5c65b9===0x191){_0x5c65b9=0x190;}_0x392303[_0x1323('0x15')](_0x5c65b9)[_0x1323('0x25')](_0x2d6619[_0x1323('0x2c')][_0x1323('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x227427[_0x1323('0x5e')]}:_0x227427);});}; \ No newline at end of file +var _0x4c4a=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','destroy','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x36fbd1,_0x4cdf37){var _0x42ccd8=function(_0x454596){while(--_0x454596){_0x36fbd1['push'](_0x36fbd1['shift']());}};_0x42ccd8(++_0x4cdf37);}(_0x4c4a,0x190));var _0xa4c4=function(_0x2b9aa3,_0x30a813){_0x2b9aa3=_0x2b9aa3-0x0;var _0x37a144=_0x4c4a[_0x2b9aa3];return _0x37a144;};'use strict';var emlformat=require(_0xa4c4('0x0'));var rimraf=require(_0xa4c4('0x1'));var zipdir=require(_0xa4c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4c4('0x3'));var moment=require(_0xa4c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4c4('0x5'));var util=require(_0xa4c4('0x6'));var path=require(_0xa4c4('0x7'));var sox=require(_0xa4c4('0x8'));var csv=require(_0xa4c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4c4('0xa'));var _=require(_0xa4c4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa4c4('0xc'));var deskjs=require(_0xa4c4('0xd'));var toCsv=require(_0xa4c4('0x9'));var querystring=require('querystring');var Papa=require(_0xa4c4('0xe'));var Redis=require(_0xa4c4('0xf'));var authService=require(_0xa4c4('0x10'));var qs=require(_0xa4c4('0x11'));var as=require(_0xa4c4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4c4('0x13'))(_0xa4c4('0x14'));var utils=require(_0xa4c4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa4c4('0x16'));var db=require(_0xa4c4('0x17'))['db'];var integrations=require(_0xa4c4('0x18'));function respondWithStatusCode(_0x18dab8,_0x3bd145){_0x3bd145=_0x3bd145||0xcc;return function(_0x58f023){if(_0x58f023){return _0x18dab8[_0xa4c4('0x19')](_0x3bd145);}return _0x18dab8[_0xa4c4('0x1a')](_0x3bd145)[_0xa4c4('0x1b')]();};}function respondWithResult(_0x5df8b8,_0x33f67e){_0x33f67e=_0x33f67e||0xc8;return function(_0x3213d){if(_0x3213d){return _0x5df8b8[_0xa4c4('0x1a')](_0x33f67e)[_0xa4c4('0x1c')](_0x3213d);}};}function respondWithFilteredResult(_0x3e68bf,_0x14766c){return function(_0x4b8bc7){if(_0x4b8bc7){var _0x4d8d32=typeof _0x14766c[_0xa4c4('0x1d')]===_0xa4c4('0x1e')&&typeof _0x14766c['limit']===_0xa4c4('0x1e');var _0x215c53=_0x4b8bc7[_0xa4c4('0x1f')];var _0x2166cc=_0x4d8d32?0x0:_0x14766c[_0xa4c4('0x1d')];var _0x956d7e=_0x4d8d32?_0x4b8bc7['count']:_0x14766c[_0xa4c4('0x1d')]+_0x14766c['limit'];var _0x3fb316;if(_0x956d7e>=_0x215c53){_0x956d7e=_0x215c53;_0x3fb316=0xc8;}else{_0x3fb316=0xce;}_0x3e68bf[_0xa4c4('0x1a')](_0x3fb316);return _0x3e68bf[_0xa4c4('0x20')]('Content-Range',_0x2166cc+'-'+_0x956d7e+'/'+_0x215c53)[_0xa4c4('0x1c')](_0x4b8bc7);}return null;};}function patchUpdates(_0x2dc451){return function(_0x42ce5c){try{jsonpatch[_0xa4c4('0x21')](_0x42ce5c,_0x2dc451,!![]);}catch(_0x153e60){return BPromise['reject'](_0x153e60);}return _0x42ce5c[_0xa4c4('0x22')]();};}function saveUpdates(_0xd7d761,_0x587d72){return function(_0x594e04){if(_0x594e04){return _0x594e04[_0xa4c4('0x23')](_0xd7d761)[_0xa4c4('0x24')](function(_0x51c88b){return _0x51c88b;});}return null;};}function removeEntity(_0xaf8f2e,_0x462551){return function(_0x45cb60){if(_0x45cb60){return _0x45cb60['destroy']()[_0xa4c4('0x24')](function(){_0xaf8f2e[_0xa4c4('0x1a')](0xcc)[_0xa4c4('0x1b')]();});}};}function handleEntityNotFound(_0x15752d,_0x54b76c){return function(_0x406421){if(!_0x406421){_0x15752d[_0xa4c4('0x19')](0x194);}return _0x406421;};}function handleError(_0x181a5d,_0x177539){_0x177539=_0x177539||0x1f4;return function(_0x22a33b){logger['error'](_0x22a33b[_0xa4c4('0x25')]);if(_0x22a33b['name']){delete _0x22a33b[_0xa4c4('0x26')];}_0x181a5d[_0xa4c4('0x1a')](_0x177539)[_0xa4c4('0x27')](_0x22a33b);};}exports[_0xa4c4('0x28')]=function(_0x5019a3,_0xf5a184){var _0x110e8a={},_0x22d7b3={},_0x2bce47={'count':0x0,'rows':[]};var _0x23e5d2=_[_0xa4c4('0x29')](db['FreshsalesAccount'][_0xa4c4('0x2a')],function(_0x183681){return{'name':_0x183681[_0xa4c4('0x2b')],'type':_0x183681[_0xa4c4('0x2c')]['key']};});_0x22d7b3[_0xa4c4('0x2d')]=_[_0xa4c4('0x29')](_0x23e5d2,_0xa4c4('0x26'));_0x22d7b3[_0xa4c4('0x2e')]=_[_0xa4c4('0x2f')](_0x5019a3['query']);_0x22d7b3[_0xa4c4('0x30')]=_['intersection'](_0x22d7b3[_0xa4c4('0x2d')],_0x22d7b3[_0xa4c4('0x2e')]);_0x110e8a[_0xa4c4('0x31')]=_[_0xa4c4('0x32')](_0x22d7b3[_0xa4c4('0x2d')],qs[_0xa4c4('0x33')](_0x5019a3[_0xa4c4('0x2e')]['fields']));_0x110e8a[_0xa4c4('0x31')]=_0x110e8a['attributes']['length']?_0x110e8a[_0xa4c4('0x31')]:_0x22d7b3[_0xa4c4('0x2d')];if(!_0x5019a3['query']['hasOwnProperty'](_0xa4c4('0x34'))){_0x110e8a[_0xa4c4('0x35')]=qs[_0xa4c4('0x35')](_0x5019a3[_0xa4c4('0x2e')]['limit']);_0x110e8a['offset']=qs[_0xa4c4('0x1d')](_0x5019a3[_0xa4c4('0x2e')]['offset']);}_0x110e8a[_0xa4c4('0x36')]=qs[_0xa4c4('0x37')](_0x5019a3[_0xa4c4('0x2e')]['sort']);_0x110e8a[_0xa4c4('0x38')]=qs['filters'](_[_0xa4c4('0x39')](_0x5019a3[_0xa4c4('0x2e')],_0x22d7b3['filters']),_0x23e5d2);if(_0x5019a3['query'][_0xa4c4('0x3a')]){_0x110e8a[_0xa4c4('0x38')]=_[_0xa4c4('0x3b')](_0x110e8a[_0xa4c4('0x38')],{'$or':_['map'](_0x23e5d2,function(_0x2a69a1){if(_0x2a69a1['type']!==_0xa4c4('0x3c')){var _0x10961f={};_0x10961f[_0x2a69a1['name']]={'$like':'%'+_0x5019a3[_0xa4c4('0x2e')][_0xa4c4('0x3a')]+'%'};return _0x10961f;}})});}_0x110e8a=_[_0xa4c4('0x3b')]({},_0x110e8a,_0x5019a3[_0xa4c4('0x3d')]);var _0x1dae35={'where':_0x110e8a[_0xa4c4('0x38')]};return db[_0xa4c4('0x3e')]['count'](_0x1dae35)[_0xa4c4('0x24')](function(_0x1a833b){_0x2bce47[_0xa4c4('0x1f')]=_0x1a833b;if(_0x5019a3['query'][_0xa4c4('0x3f')]){_0x110e8a['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0xa4c4('0x40')](_0x110e8a);})['then'](function(_0x361743){_0x2bce47[_0xa4c4('0x41')]=_0x361743;return _0x2bce47;})[_0xa4c4('0x24')](respondWithFilteredResult(_0xf5a184,_0x110e8a))[_0xa4c4('0x42')](handleError(_0xf5a184,null));};exports[_0xa4c4('0x43')]=function(_0x25e6c6,_0x11c7d3){var _0x49643f={'raw':![],'where':{'id':_0x25e6c6[_0xa4c4('0x44')]['id']}},_0x166ffc={};_0x166ffc['model']=_[_0xa4c4('0x2f')](db[_0xa4c4('0x3e')]['rawAttributes']);_0x166ffc[_0xa4c4('0x2e')]=_['keys'](_0x25e6c6[_0xa4c4('0x2e')]);_0x166ffc['filters']=_[_0xa4c4('0x32')](_0x166ffc[_0xa4c4('0x2d')],_0x166ffc['query']);_0x49643f[_0xa4c4('0x31')]=_[_0xa4c4('0x32')](_0x166ffc[_0xa4c4('0x2d')],qs[_0xa4c4('0x33')](_0x25e6c6[_0xa4c4('0x2e')][_0xa4c4('0x33')]));_0x49643f[_0xa4c4('0x31')]=_0x49643f[_0xa4c4('0x31')][_0xa4c4('0x45')]?_0x49643f[_0xa4c4('0x31')]:_0x166ffc[_0xa4c4('0x2d')];if(_0x25e6c6[_0xa4c4('0x2e')][_0xa4c4('0x3f')]){_0x49643f[_0xa4c4('0x46')]=[{'all':!![]}];}_0x49643f=_[_0xa4c4('0x3b')]({},_0x49643f,_0x25e6c6[_0xa4c4('0x3d')]);return db[_0xa4c4('0x3e')][_0xa4c4('0x47')](_0x49643f)[_0xa4c4('0x24')](handleEntityNotFound(_0x11c7d3,null))[_0xa4c4('0x24')](respondWithResult(_0x11c7d3,null))[_0xa4c4('0x42')](handleError(_0x11c7d3,null));};exports[_0xa4c4('0x48')]=function(_0x2df4e7,_0x234041){return db[_0xa4c4('0x3e')][_0xa4c4('0x48')](_0x2df4e7['body'],{})[_0xa4c4('0x24')](respondWithResult(_0x234041,0xc9))[_0xa4c4('0x42')](handleError(_0x234041,null));};exports[_0xa4c4('0x23')]=function(_0x4812bd,_0x1a9097){if(_0x4812bd[_0xa4c4('0x49')]['id']){delete _0x4812bd[_0xa4c4('0x49')]['id'];}return db[_0xa4c4('0x3e')][_0xa4c4('0x47')]({'where':{'id':_0x4812bd[_0xa4c4('0x44')]['id']}})[_0xa4c4('0x24')](handleEntityNotFound(_0x1a9097,null))[_0xa4c4('0x24')](saveUpdates(_0x4812bd[_0xa4c4('0x49')],null))['then'](respondWithResult(_0x1a9097,null))[_0xa4c4('0x42')](handleError(_0x1a9097,null));};exports[_0xa4c4('0x4a')]=function(_0x36129d,_0x2b1e94){return db[_0xa4c4('0x3e')]['find']({'where':{'id':_0x36129d[_0xa4c4('0x44')]['id']}})[_0xa4c4('0x24')](handleEntityNotFound(_0x2b1e94,null))[_0xa4c4('0x24')](removeEntity(_0x2b1e94,null))[_0xa4c4('0x42')](handleError(_0x2b1e94,null));};exports['getConfigurations']=function(_0x49307e,_0x3efef6,_0x47f115){var _0x26be09={};var _0xea949d={};var _0x20038e;var _0x31df0e;return db[_0xa4c4('0x3e')]['findOne']({'where':{'id':_0x49307e[_0xa4c4('0x44')]['id']}})[_0xa4c4('0x24')](handleEntityNotFound(_0x3efef6,null))[_0xa4c4('0x24')](function(_0x3c3623){if(_0x3c3623){_0x20038e=_0x3c3623;_0xea949d[_0xa4c4('0x2d')]=_['keys'](db['FreshsalesConfiguration'][_0xa4c4('0x2a')]);_0xea949d[_0xa4c4('0x2e')]=_[_0xa4c4('0x2f')](_0x49307e[_0xa4c4('0x2e')]);_0xea949d[_0xa4c4('0x30')]=_[_0xa4c4('0x32')](_0xea949d[_0xa4c4('0x2d')],_0xea949d[_0xa4c4('0x2e')]);_0x26be09[_0xa4c4('0x31')]=_['intersection'](_0xea949d[_0xa4c4('0x2d')],qs[_0xa4c4('0x33')](_0x49307e[_0xa4c4('0x2e')]['fields']));_0x26be09[_0xa4c4('0x31')]=_0x26be09['attributes'][_0xa4c4('0x45')]?_0x26be09[_0xa4c4('0x31')]:_0xea949d[_0xa4c4('0x2d')];_0x26be09[_0xa4c4('0x36')]=qs['sort'](_0x49307e[_0xa4c4('0x2e')]['sort']);_0x26be09[_0xa4c4('0x38')]=qs[_0xa4c4('0x30')](_[_0xa4c4('0x39')](_0x49307e[_0xa4c4('0x2e')],_0xea949d[_0xa4c4('0x30')]));if(_0x49307e[_0xa4c4('0x2e')][_0xa4c4('0x3a')]){_0x26be09[_0xa4c4('0x38')]=_[_0xa4c4('0x3b')](_0x26be09[_0xa4c4('0x38')],{'$or':_[_0xa4c4('0x29')](_0x26be09[_0xa4c4('0x31')],function(_0x11c63e){var _0x1540e6={};_0x1540e6[_0x11c63e]={'$like':'%'+_0x49307e[_0xa4c4('0x2e')][_0xa4c4('0x3a')]+'%'};return _0x1540e6;})});}_0x26be09=_[_0xa4c4('0x3b')]({},_0x26be09,_0x49307e[_0xa4c4('0x3d')]);return _0x20038e['getConfigurations'](_0x26be09);}})[_0xa4c4('0x24')](function(_0x5efb44){if(_0x5efb44){_0x31df0e=_0x5efb44[_0xa4c4('0x45')];if(!_0x49307e[_0xa4c4('0x2e')][_0xa4c4('0x4b')](_0xa4c4('0x34'))){_0x26be09['limit']=qs[_0xa4c4('0x35')](_0x49307e['query'][_0xa4c4('0x35')]);_0x26be09[_0xa4c4('0x1d')]=qs[_0xa4c4('0x1d')](_0x49307e['query'][_0xa4c4('0x1d')]);}return _0x20038e[_0xa4c4('0x4c')](_0x26be09);}})['then'](function(_0x10abd2){if(_0x10abd2){return _0x10abd2?{'count':_0x31df0e,'rows':_0x10abd2}:null;}})[_0xa4c4('0x24')](respondWithResult(_0x3efef6,null))[_0xa4c4('0x42')](handleError(_0x3efef6,null));};exports[_0xa4c4('0x4d')]=function(_0x5a3c23,_0x5d5a68,_0x5265ed){if(_0x5a3c23[_0xa4c4('0x49')]['id']){delete _0x5a3c23['body']['id'];}return db[_0xa4c4('0x3e')][_0xa4c4('0x4e')]({'where':{'id':_0x5a3c23[_0xa4c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d5a68,null))[_0xa4c4('0x24')](function(_0x559631){if(_0x559631){_0x5a3c23['body'][_0xa4c4('0x4f')]=_0x559631['id'];_0x5a3c23[_0xa4c4('0x49')][_0xa4c4('0x50')]=integrations[_0xa4c4('0x51')](_0x5a3c23[_0xa4c4('0x49')]['channel'],_0x5a3c23[_0xa4c4('0x49')][_0xa4c4('0x2c')]);_0x5a3c23[_0xa4c4('0x49')][_0xa4c4('0x52')]=integrations[_0xa4c4('0x53')](_0x5a3c23[_0xa4c4('0x49')][_0xa4c4('0x54')],_0x5a3c23[_0xa4c4('0x49')]['type']);return db['FreshsalesConfiguration']['create'](_0x5a3c23['body'],{'include':[{'model':db[_0xa4c4('0x55')],'as':_0xa4c4('0x50')},{'model':db[_0xa4c4('0x55')],'as':'Descriptions'}]});}return null;})[_0xa4c4('0x24')](respondWithResult(_0x5d5a68,null))[_0xa4c4('0x42')](handleError(_0x5d5a68,null));};exports[_0xa4c4('0x56')]=function(_0x5d65ba,_0x1e59c9,_0x38f280){var _0x587066='';var _0x233429='';return db['FreshsalesAccount'][_0xa4c4('0x4e')]({'where':{'id':_0x5d65ba[_0xa4c4('0x44')]['id']},'attributes':['id',_0xa4c4('0x57'),_0xa4c4('0x58'),_0xa4c4('0x59')]})[_0xa4c4('0x24')](handleEntityNotFound(_0x1e59c9,null))[_0xa4c4('0x24')](function(_0x5f3e85){if(_0x5f3e85){_0x233429=_0x5f3e85['username'];_0x587066=_0x5f3e85[_0xa4c4('0x58')];var _0x286c58=_0x5f3e85['remoteUri'][_0xa4c4('0x5a')](-0x1);if(_0x286c58==='/'){_0x587066=_0x587066[_0xa4c4('0x5b')](0x0,_0x587066[_0xa4c4('0x5c')](_0x286c58));}return rp({'method':_0xa4c4('0x5d'),'uri':util[_0xa4c4('0x5e')](_0xa4c4('0x5f'),_0x587066,'/api/selector/owners'),'headers':{'Authorization':_0xa4c4('0x60')+_0x5f3e85[_0xa4c4('0x59')]},'json':!![]});}})['then'](function(_0x3d7df5){if(_0x3d7df5){var _0x5ed5d6=_0x3d7df5['users'];var _0x228eef=![];var _0x3cd51b=null;for(_0x3cd51b=0x0;_0x3cd51b<_0x5ed5d6['length'];_0x3cd51b++){if(_0x5ed5d6[_0x3cd51b][_0xa4c4('0x61')]===_0x233429){_0x228eef=!![];}}if(_0x228eef){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa4c4('0x62')});}}})['then'](respondWithResult(_0x1e59c9,null))[_0xa4c4('0x42')](function(_0xaf5ffd){var _0x2c0634=_0x5d65ba[_0xa4c4('0x2e')][_0xa4c4('0x63')]?0x1f4:_0xaf5ffd['statusCode']||0x1f4;logger[_0xa4c4('0x64')](_0xa4c4('0x65'),_0xa4c4('0x56'),_0x2c0634,JSON[_0xa4c4('0x66')](_0xaf5ffd));delete _0xaf5ffd[_0xa4c4('0x26')];if(_0x2c0634===0x191){_0x2c0634=0x190;}_0x1e59c9['status'](_0x2c0634)[_0xa4c4('0x27')](_0x5d65ba[_0xa4c4('0x2e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xaf5ffd['statusCode']}:_0xaf5ffd);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 692da23..2fead49 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 _0xd943=['int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshsalesAccount'];(function(_0x4014b6,_0x2a5163){var _0x1552db=function(_0x5e1287){while(--_0x5e1287){_0x4014b6['push'](_0x4014b6['shift']());}};_0x1552db(++_0x2a5163);}(_0xd943,0x15d));var _0x3d94=function(_0x453531,_0x314b0f){_0x453531=_0x453531-0x0;var _0x2ed220=_0xd943[_0x453531];return _0x2ed220;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3d94('0x9')]=function(_0x51cf1f,_0x54e81f){return _0x51cf1f['define'](_0x3d94('0xa'),attributes,{'tableName':_0x3d94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x4bd3,0x174));var _0x34bd=function(_0x516c29,_0x2360a9){_0x516c29=_0x516c29-0x0;var _0x4969c7=_0x4bd3[_0x516c29];return _0x4969c7;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index d3a92e0..fa4041c 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 _0x33af=['include','map','model','ShowFreshsalesAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x33af,0xec));var _0xf33a=function(_0x934754,_0x15bd40){_0x934754=_0x934754-0x0;var _0x5cf1fc=_0x33af[_0x934754];return _0x5cf1fc;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});}exports[_0xf33a('0x15')]=function(_0x524109){var _0x2946ef=this;return new Promise(function(_0x23d9e2,_0x38d69a){return db[_0xf33a('0x16')]['findAll']({'raw':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x18')]===undefined?!![]:![]:!![],'where':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x19')]||null:null,'attributes':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x1a')]||null:null,'limit':_0x524109[_0xf33a('0x17')]?_0x524109['options'][_0xf33a('0x1b')]||null:null,'include':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x1c')]?_[_0xf33a('0x1d')](_0x524109['options'][_0xf33a('0x1c')],function(_0x5882ba){return{'model':db[_0x5882ba[_0xf33a('0x1e')]],'as':_0x5882ba['as'],'attributes':_0x5882ba[_0xf33a('0x1a')],'include':_0x5882ba[_0xf33a('0x1c')]?_[_0xf33a('0x1d')](_0x5882ba[_0xf33a('0x1c')],function(_0x4b9801){return{'model':db[_0x4b9801[_0xf33a('0x1e')]],'as':_0x4b9801['as'],'attributes':_0x4b9801[_0xf33a('0x1a')],'include':_0x4b9801['include']?_['map'](_0x4b9801[_0xf33a('0x1c')],function(_0x5f0a53){return{'model':db[_0x5f0a53['model']],'as':_0x5f0a53['as'],'attributes':_0x5f0a53[_0xf33a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x79d653){logger['info'](_0xf33a('0x15'),_0x524109);logger[_0xf33a('0xe')](_0xf33a('0x15'),_0x524109,JSON[_0xf33a('0xf')](_0x79d653));_0x23d9e2(_0x79d653);})[_0xf33a('0x14')](function(_0x3068a9){logger[_0xf33a('0x10')](_0xf33a('0x15'),_0x3068a9[_0xf33a('0x12')],_0x524109);_0x38d69a(_0x2946ef[_0xf33a('0x10')](0x1f4,_0x3068a9[_0xf33a('0x12')]));});});};exports[_0xf33a('0x1f')]=function(_0x22c9f2){var _0x3f714e=this;return new Promise(function(_0x2fd098,_0x5eb14a){return db[_0xf33a('0x16')][_0xf33a('0x20')]({'raw':_0x22c9f2[_0xf33a('0x17')]?_0x22c9f2[_0xf33a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22c9f2[_0xf33a('0x17')]?_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x19')]||null:null,'attributes':_0x22c9f2[_0xf33a('0x17')]?_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x1a')]||null:null,'include':_0x22c9f2['options']?_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x1c')]?_[_0xf33a('0x1d')](_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x1c')],function(_0x57e7be){return{'model':db[_0x57e7be['model']],'as':_0x57e7be['as'],'attributes':_0x57e7be[_0xf33a('0x1a')],'include':_0x57e7be['include']?_['map'](_0x57e7be['include'],function(_0x2c4840){return{'model':db[_0x2c4840[_0xf33a('0x1e')]],'as':_0x2c4840['as'],'attributes':_0x2c4840['attributes'],'include':_0x2c4840[_0xf33a('0x1c')]?_['map'](_0x2c4840[_0xf33a('0x1c')],function(_0x1f11b3){return{'model':db[_0x1f11b3[_0xf33a('0x1e')]],'as':_0x1f11b3['as'],'attributes':_0x1f11b3[_0xf33a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf33a('0xa')](function(_0x23c92b){logger['info'](_0xf33a('0x1f'),_0x22c9f2);logger[_0xf33a('0xe')]('ShowFreshsalesAccount',_0x22c9f2,JSON[_0xf33a('0xf')](_0x23c92b));_0x2fd098(_0x23c92b);})[_0xf33a('0x14')](function(_0x3e0a98){logger['error'](_0xf33a('0x1f'),_0x3e0a98[_0xf33a('0x12')],_0x22c9f2);_0x5eb14a(_0x3f714e[_0xf33a('0x10')](0x1f4,_0x3e0a98[_0xf33a('0x12')]));});});}; \ No newline at end of file +var _0x4bd3=['where','attributes','limit','include','model','map','stringify','find','ShowFreshsalesAccount','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x4bd3,0x174));var _0x34bd=function(_0x533606,_0x34961a){_0x533606=_0x533606-0x0;var _0x3467a5=_0x4bd3[_0x533606];return _0x3467a5;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});}exports[_0x34bd('0x13')]=function(_0x3b4bf8){var _0x72b197=this;return new Promise(function(_0x4b5ebb,_0x48d2ba){return db[_0x34bd('0x14')][_0x34bd('0x15')]({'raw':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options'][_0x34bd('0x19')]||null:null,'limit':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x1a')]||null:null,'include':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options']['include']?_['map'](_0x3b4bf8['options'][_0x34bd('0x1b')],function(_0x503a60){return{'model':db[_0x503a60[_0x34bd('0x1c')]],'as':_0x503a60['as'],'attributes':_0x503a60[_0x34bd('0x19')],'include':_0x503a60[_0x34bd('0x1b')]?_['map'](_0x503a60[_0x34bd('0x1b')],function(_0x14479a){return{'model':db[_0x14479a[_0x34bd('0x1c')]],'as':_0x14479a['as'],'attributes':_0x14479a[_0x34bd('0x19')],'include':_0x14479a['include']?_[_0x34bd('0x1d')](_0x14479a[_0x34bd('0x1b')],function(_0x264c94){return{'model':db[_0x264c94[_0x34bd('0x1c')]],'as':_0x264c94['as'],'attributes':_0x264c94['attributes']};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x3fe8b0){logger['info'](_0x34bd('0x13'),_0x3b4bf8);logger[_0x34bd('0xc')](_0x34bd('0x13'),_0x3b4bf8,JSON[_0x34bd('0x1e')](_0x3fe8b0));_0x4b5ebb(_0x3fe8b0);})[_0x34bd('0x12')](function(_0x4500c8){logger[_0x34bd('0xe')]('GetFreshsalesAccount',_0x4500c8[_0x34bd('0x10')],_0x3b4bf8);_0x48d2ba(_0x72b197[_0x34bd('0xe')](0x1f4,_0x4500c8['message']));});});};exports['ShowFreshsalesAccount']=function(_0x38bdba){var _0xca9897=this;return new Promise(function(_0xd176f7,_0x536b2c){return db['FreshsalesAccount'][_0x34bd('0x1f')]({'raw':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x38bdba['options']?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x19')]||null:null,'include':_0x38bdba[_0x34bd('0x16')]?_0x38bdba['options'][_0x34bd('0x1b')]?_['map'](_0x38bdba[_0x34bd('0x16')][_0x34bd('0x1b')],function(_0xf12ee6){return{'model':db[_0xf12ee6['model']],'as':_0xf12ee6['as'],'attributes':_0xf12ee6[_0x34bd('0x19')],'include':_0xf12ee6[_0x34bd('0x1b')]?_['map'](_0xf12ee6[_0x34bd('0x1b')],function(_0x21c7d6){return{'model':db[_0x21c7d6[_0x34bd('0x1c')]],'as':_0x21c7d6['as'],'attributes':_0x21c7d6['attributes'],'include':_0x21c7d6[_0x34bd('0x1b')]?_[_0x34bd('0x1d')](_0x21c7d6['include'],function(_0x117188){return{'model':db[_0x117188[_0x34bd('0x1c')]],'as':_0x117188['as'],'attributes':_0x117188[_0x34bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x320643){logger[_0x34bd('0xa')]('ShowFreshsalesAccount',_0x38bdba);logger['debug']('ShowFreshsalesAccount',_0x38bdba,JSON[_0x34bd('0x1e')](_0x320643));_0xd176f7(_0x320643);})[_0x34bd('0x12')](function(_0x5e30c5){logger['error'](_0x34bd('0x20'),_0x5e30c5['message'],_0x38bdba);_0x536b2c(_0xca9897['error'](0x1f4,_0x5e30c5[_0x34bd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 76a55f4..d09b168 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 _0x282f=['getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x21a748,_0x3fcecb){var _0x302441=function(_0x7d8ddf){while(--_0x7d8ddf){_0x21a748['push'](_0x21a748['shift']());}};_0x302441(++_0x3fcecb);}(_0x282f,0x7d));var _0xf282=function(_0x1421ba,_0x4fd6a9){_0x1421ba=_0x1421ba-0x0;var _0x225a5e=_0x282f[_0x1421ba];return _0x225a5e;};'use strict';var multer=require(_0xf282('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf282('0x1'));var express=require('express');var router=express[_0xf282('0x2')]();var fs_extra=require(_0xf282('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf282('0x4'));var config=require(_0xf282('0x5'));var controller=require(_0xf282('0x6'));router[_0xf282('0x7')]('/',auth[_0xf282('0x8')](),controller[_0xf282('0x9')]);router[_0xf282('0x7')](_0xf282('0xa'),auth[_0xf282('0x8')](),controller[_0xf282('0xb')]);router[_0xf282('0x7')](_0xf282('0xc'),auth[_0xf282('0x8')](),controller[_0xf282('0xd')]);router['get'](_0xf282('0xe'),auth[_0xf282('0x8')](),controller['getDescriptions']);router['get'](_0xf282('0xf'),auth[_0xf282('0x8')](),controller[_0xf282('0x10')]);router['post']('/',auth[_0xf282('0x8')](),controller[_0xf282('0x11')]);router[_0xf282('0x12')](_0xf282('0xa'),auth[_0xf282('0x8')](),controller[_0xf282('0x13')]);router[_0xf282('0x14')](_0xf282('0xa'),auth['isAuthenticated'](),controller[_0xf282('0x15')]);module[_0xf282('0x16')]=router; \ No newline at end of file +var _0x4a0b=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','update','delete','destroy','exports'];(function(_0x2d3de0,_0x2fe05e){var _0x159010=function(_0x483ec8){while(--_0x483ec8){_0x2d3de0['push'](_0x2d3de0['shift']());}};_0x159010(++_0x2fe05e);}(_0x4a0b,0x12b));var _0xb4a0=function(_0x26f169,_0x2d01b2){_0x26f169=_0x26f169-0x0;var _0x43aad9=_0x4a0b[_0x26f169];return _0x43aad9;};'use strict';var multer=require(_0xb4a0('0x0'));var util=require(_0xb4a0('0x1'));var path=require(_0xb4a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4a0('0x3'));var router=express[_0xb4a0('0x4')]();var fs_extra=require(_0xb4a0('0x5'));var auth=require(_0xb4a0('0x6'));var interaction=require(_0xb4a0('0x7'));var config=require('../../config/environment');var controller=require(_0xb4a0('0x8'));router[_0xb4a0('0x9')]('/',auth[_0xb4a0('0xa')](),controller[_0xb4a0('0xb')]);router[_0xb4a0('0x9')](_0xb4a0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb4a0('0x9')](_0xb4a0('0xd'),auth[_0xb4a0('0xa')](),controller[_0xb4a0('0xe')]);router[_0xb4a0('0x9')](_0xb4a0('0xf'),auth[_0xb4a0('0xa')](),controller[_0xb4a0('0x10')]);router['get'](_0xb4a0('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0xb4a0('0x12')]('/',auth[_0xb4a0('0xa')](),controller['create']);router['put'](_0xb4a0('0xc'),auth[_0xb4a0('0xa')](),controller[_0xb4a0('0x13')]);router[_0xb4a0('0x14')](_0xb4a0('0xc'),auth['isAuthenticated'](),controller[_0xb4a0('0x15')]);module[_0xb4a0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d16e4a5..b8ba476 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 _0xbe45=['STRING','sequelize'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xbe45,0x1af));var _0x5be4=function(_0x3ae1a0,_0x5c11e1){_0x3ae1a0=_0x3ae1a0-0x0;var _0x5903d8=_0xbe45[_0x3ae1a0];return _0x5903d8;};'use strict';var Sequelize=require(_0x5be4('0x0'));module['exports']={'name':{'type':Sequelize[_0x5be4('0x1')]},'description':{'type':Sequelize[_0x5be4('0x1')]}}; \ No newline at end of file +var _0xc3d2=['STRING','sequelize','exports'];(function(_0x110b16,_0x87215a){var _0x11d24c=function(_0x4f9eeb){while(--_0x4f9eeb){_0x110b16['push'](_0x110b16['shift']());}};_0x11d24c(++_0x87215a);}(_0xc3d2,0x1e4));var _0x2c3d=function(_0x3118e7,_0x9d6add){_0x3118e7=_0x3118e7-0x0;var _0x4c2b0d=_0xc3d2[_0x3118e7];return _0x4c2b0d;};'use strict';var Sequelize=require(_0x2c3d('0x0'));module[_0x2c3d('0x1')]={'name':{'type':Sequelize[_0x2c3d('0x2')]},'description':{'type':Sequelize[_0x2c3d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 40b955d..693e82a 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 _0xe553=['set','apply','reject','save','then','error','name','send','index','FreshsalesConfiguration','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','map','VIRTUAL','filter','options','includeAll','include','catch','show','find','create','body','update','params','destroy','findOne','FreshsalesField','order','getSubjects','getDescriptions','pick','getFields','rimraf','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x1681de,_0x22e1a9){var _0x323cbf=function(_0x3077b3){while(--_0x3077b3){_0x1681de['push'](_0x1681de['shift']());}};_0x323cbf(++_0x22e1a9);}(_0xe553,0x1a5));var _0x3e55=function(_0x307fcf,_0x394370){_0x307fcf=_0x307fcf-0x0;var _0x35522f=_0xe553[_0x307fcf];return _0x35522f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e55('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3e55('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e55('0x2'));var util=require(_0x3e55('0x3'));var path=require(_0x3e55('0x4'));var sox=require(_0x3e55('0x5'));var csv=require('to-csv');var ejs=require(_0x3e55('0x6'));var fs=require('fs');var fs_extra=require(_0x3e55('0x7'));var _=require(_0x3e55('0x8'));var squel=require(_0x3e55('0x9'));var crypto=require(_0x3e55('0xa'));var jsforce=require(_0x3e55('0xb'));var deskjs=require(_0x3e55('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3e55('0xd'));var Papa=require(_0x3e55('0xe'));var Redis=require(_0x3e55('0xf'));var authService=require(_0x3e55('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3e55('0x11'));var utils=require('../../config/utils');var config=require(_0x3e55('0x12'));var licenseUtil=require(_0x3e55('0x13'));var db=require(_0x3e55('0x14'))['db'];function respondWithStatusCode(_0xd97cd2,_0x502faf){_0x502faf=_0x502faf||0xcc;return function(_0x6d551f){if(_0x6d551f){return _0xd97cd2[_0x3e55('0x15')](_0x502faf);}return _0xd97cd2[_0x3e55('0x16')](_0x502faf)[_0x3e55('0x17')]();};}function respondWithResult(_0x311aa9,_0x54301a){_0x54301a=_0x54301a||0xc8;return function(_0x11969d){if(_0x11969d){return _0x311aa9[_0x3e55('0x16')](_0x54301a)[_0x3e55('0x18')](_0x11969d);}};}function respondWithFilteredResult(_0x4a320d,_0xbc75e2){return function(_0x588132){if(_0x588132){var _0x540cd8=typeof _0xbc75e2['offset']===_0x3e55('0x19')&&typeof _0xbc75e2[_0x3e55('0x1a')]===_0x3e55('0x19');var _0x23e87e=_0x588132[_0x3e55('0x1b')];var _0x32b773=_0x540cd8?0x0:_0xbc75e2['offset'];var _0x4f9d2a=_0x540cd8?_0x588132['count']:_0xbc75e2[_0x3e55('0x1c')]+_0xbc75e2['limit'];var _0x35d55e;if(_0x4f9d2a>=_0x23e87e){_0x4f9d2a=_0x23e87e;_0x35d55e=0xc8;}else{_0x35d55e=0xce;}_0x4a320d[_0x3e55('0x16')](_0x35d55e);return _0x4a320d[_0x3e55('0x1d')]('Content-Range',_0x32b773+'-'+_0x4f9d2a+'/'+_0x23e87e)[_0x3e55('0x18')](_0x588132);}return null;};}function patchUpdates(_0x69e24b){return function(_0x5242b0){try{jsonpatch[_0x3e55('0x1e')](_0x5242b0,_0x69e24b,!![]);}catch(_0x4c44bd){return BPromise[_0x3e55('0x1f')](_0x4c44bd);}return _0x5242b0[_0x3e55('0x20')]();};}function saveUpdates(_0x1eebd5,_0x39b0a9){return function(_0x4a1dfa){if(_0x4a1dfa){return _0x4a1dfa['update'](_0x1eebd5)[_0x3e55('0x21')](function(_0x90981){return _0x90981;});}return null;};}function removeEntity(_0x512fab,_0xcbf935){return function(_0x12ae5c){if(_0x12ae5c){return _0x12ae5c['destroy']()['then'](function(){_0x512fab[_0x3e55('0x16')](0xcc)[_0x3e55('0x17')]();});}};}function handleEntityNotFound(_0x4ff87b,_0x370459){return function(_0x50fad7){if(!_0x50fad7){_0x4ff87b[_0x3e55('0x15')](0x194);}return _0x50fad7;};}function handleError(_0x5b2443,_0x3477b6){_0x3477b6=_0x3477b6||0x1f4;return function(_0x3514d2){logger[_0x3e55('0x22')](_0x3514d2['stack']);if(_0x3514d2['name']){delete _0x3514d2[_0x3e55('0x23')];}_0x5b2443[_0x3e55('0x16')](_0x3477b6)[_0x3e55('0x24')](_0x3514d2);};}exports[_0x3e55('0x25')]=function(_0x2a5223,_0xdd9448){var _0x2f30f2={},_0x526973={},_0x1ea8b7={'count':0x0,'rows':[]};var _0x2eea39=_['map'](db[_0x3e55('0x26')][_0x3e55('0x27')],function(_0x15b413){return{'name':_0x15b413['fieldName'],'type':_0x15b413['type'][_0x3e55('0x28')]};});_0x526973[_0x3e55('0x29')]=_['map'](_0x2eea39,'name');_0x526973[_0x3e55('0x2a')]=_[_0x3e55('0x2b')](_0x2a5223['query']);_0x526973['filters']=_[_0x3e55('0x2c')](_0x526973['model'],_0x526973[_0x3e55('0x2a')]);_0x2f30f2['attributes']=_[_0x3e55('0x2c')](_0x526973[_0x3e55('0x29')],qs[_0x3e55('0x2d')](_0x2a5223[_0x3e55('0x2a')][_0x3e55('0x2d')]));_0x2f30f2[_0x3e55('0x2e')]=_0x2f30f2['attributes'][_0x3e55('0x2f')]?_0x2f30f2[_0x3e55('0x2e')]:_0x526973[_0x3e55('0x29')];if(!_0x2a5223[_0x3e55('0x2a')][_0x3e55('0x30')](_0x3e55('0x31'))){_0x2f30f2['limit']=qs[_0x3e55('0x1a')](_0x2a5223[_0x3e55('0x2a')][_0x3e55('0x1a')]);_0x2f30f2[_0x3e55('0x1c')]=qs[_0x3e55('0x1c')](_0x2a5223['query'][_0x3e55('0x1c')]);}_0x2f30f2['order']=qs[_0x3e55('0x32')](_0x2a5223[_0x3e55('0x2a')]['sort']);_0x2f30f2[_0x3e55('0x33')]=qs[_0x3e55('0x34')](_['pick'](_0x2a5223[_0x3e55('0x2a')],_0x526973[_0x3e55('0x34')]),_0x2eea39);if(_0x2a5223['query']['filter']){_0x2f30f2[_0x3e55('0x33')]=_[_0x3e55('0x35')](_0x2f30f2[_0x3e55('0x33')],{'$or':_[_0x3e55('0x36')](_0x2eea39,function(_0x287110){if(_0x287110['type']!==_0x3e55('0x37')){var _0x14b64c={};_0x14b64c[_0x287110[_0x3e55('0x23')]]={'$like':'%'+_0x2a5223[_0x3e55('0x2a')][_0x3e55('0x38')]+'%'};return _0x14b64c;}})});}_0x2f30f2=_[_0x3e55('0x35')]({},_0x2f30f2,_0x2a5223[_0x3e55('0x39')]);var _0x1b4c08={'where':_0x2f30f2['where']};return db[_0x3e55('0x26')][_0x3e55('0x1b')](_0x1b4c08)[_0x3e55('0x21')](function(_0xfa9d6c){_0x1ea8b7[_0x3e55('0x1b')]=_0xfa9d6c;if(_0x2a5223['query'][_0x3e55('0x3a')]){_0x2f30f2[_0x3e55('0x3b')]=[{'all':!![]}];}return db[_0x3e55('0x26')]['findAll'](_0x2f30f2);})[_0x3e55('0x21')](function(_0x24c97c){_0x1ea8b7['rows']=_0x24c97c;return _0x1ea8b7;})[_0x3e55('0x21')](respondWithFilteredResult(_0xdd9448,_0x2f30f2))[_0x3e55('0x3c')](handleError(_0xdd9448,null));};exports[_0x3e55('0x3d')]=function(_0x1755da,_0x1fdbc6){var _0x4e9396={'raw':![],'where':{'id':_0x1755da['params']['id']}},_0x3e4532={};_0x3e4532[_0x3e55('0x29')]=_[_0x3e55('0x2b')](db['FreshsalesConfiguration'][_0x3e55('0x27')]);_0x3e4532['query']=_[_0x3e55('0x2b')](_0x1755da[_0x3e55('0x2a')]);_0x3e4532['filters']=_['intersection'](_0x3e4532['model'],_0x3e4532[_0x3e55('0x2a')]);_0x4e9396[_0x3e55('0x2e')]=_[_0x3e55('0x2c')](_0x3e4532[_0x3e55('0x29')],qs[_0x3e55('0x2d')](_0x1755da['query'][_0x3e55('0x2d')]));_0x4e9396[_0x3e55('0x2e')]=_0x4e9396[_0x3e55('0x2e')][_0x3e55('0x2f')]?_0x4e9396[_0x3e55('0x2e')]:_0x3e4532[_0x3e55('0x29')];if(_0x1755da[_0x3e55('0x2a')][_0x3e55('0x3a')]){_0x4e9396[_0x3e55('0x3b')]=[{'all':!![]}];}_0x4e9396=_[_0x3e55('0x35')]({},_0x4e9396,_0x1755da[_0x3e55('0x39')]);return db[_0x3e55('0x26')][_0x3e55('0x3e')](_0x4e9396)['then'](handleEntityNotFound(_0x1fdbc6,null))[_0x3e55('0x21')](respondWithResult(_0x1fdbc6,null))[_0x3e55('0x3c')](handleError(_0x1fdbc6,null));};exports[_0x3e55('0x3f')]=function(_0x5171e4,_0x9fd12d){return db[_0x3e55('0x26')]['create'](_0x5171e4[_0x3e55('0x40')],{})[_0x3e55('0x21')](respondWithResult(_0x9fd12d,0xc9))[_0x3e55('0x3c')](handleError(_0x9fd12d,null));};exports[_0x3e55('0x41')]=function(_0x593f98,_0x21bff6){if(_0x593f98['body']['id']){delete _0x593f98[_0x3e55('0x40')]['id'];}return db['FreshsalesConfiguration'][_0x3e55('0x3e')]({'where':{'id':_0x593f98[_0x3e55('0x42')]['id']}})['then'](handleEntityNotFound(_0x21bff6,null))[_0x3e55('0x21')](saveUpdates(_0x593f98[_0x3e55('0x40')],null))[_0x3e55('0x21')](respondWithResult(_0x21bff6,null))[_0x3e55('0x3c')](handleError(_0x21bff6,null));};exports[_0x3e55('0x43')]=function(_0x50044a,_0x38ec49){return db[_0x3e55('0x26')]['find']({'where':{'id':_0x50044a['params']['id']}})[_0x3e55('0x21')](handleEntityNotFound(_0x38ec49,null))['then'](removeEntity(_0x38ec49,null))[_0x3e55('0x3c')](handleError(_0x38ec49,null));};exports['getSubjects']=function(_0x4a1697,_0x243520,_0x5e6243){var _0x14f84e={};var _0x178653={};var _0x2b5522;var _0x481ae3;return db['FreshsalesConfiguration'][_0x3e55('0x44')]({'where':{'id':_0x4a1697[_0x3e55('0x42')]['id']}})[_0x3e55('0x21')](handleEntityNotFound(_0x243520,null))[_0x3e55('0x21')](function(_0x3ca4a1){if(_0x3ca4a1){_0x2b5522=_0x3ca4a1;_0x178653['model']=_['keys'](db[_0x3e55('0x45')][_0x3e55('0x27')]);_0x178653[_0x3e55('0x2a')]=_[_0x3e55('0x2b')](_0x4a1697[_0x3e55('0x2a')]);_0x178653[_0x3e55('0x34')]=_[_0x3e55('0x2c')](_0x178653[_0x3e55('0x29')],_0x178653['query']);_0x14f84e[_0x3e55('0x2e')]=_[_0x3e55('0x2c')](_0x178653[_0x3e55('0x29')],qs[_0x3e55('0x2d')](_0x4a1697[_0x3e55('0x2a')]['fields']));_0x14f84e[_0x3e55('0x2e')]=_0x14f84e[_0x3e55('0x2e')][_0x3e55('0x2f')]?_0x14f84e[_0x3e55('0x2e')]:_0x178653[_0x3e55('0x29')];_0x14f84e[_0x3e55('0x46')]=qs['sort'](_0x4a1697[_0x3e55('0x2a')][_0x3e55('0x32')]);_0x14f84e[_0x3e55('0x33')]=qs[_0x3e55('0x34')](_['pick'](_0x4a1697[_0x3e55('0x2a')],_0x178653[_0x3e55('0x34')]));if(_0x4a1697[_0x3e55('0x2a')][_0x3e55('0x38')]){_0x14f84e[_0x3e55('0x33')]=_[_0x3e55('0x35')](_0x14f84e[_0x3e55('0x33')],{'$or':_['map'](_0x14f84e['attributes'],function(_0x1119c8){var _0x80037f={};_0x80037f[_0x1119c8]={'$like':'%'+_0x4a1697[_0x3e55('0x2a')][_0x3e55('0x38')]+'%'};return _0x80037f;})});}_0x14f84e=_[_0x3e55('0x35')]({},_0x14f84e,_0x4a1697[_0x3e55('0x39')]);return _0x2b5522[_0x3e55('0x47')](_0x14f84e);}})['then'](function(_0x21bc26){if(_0x21bc26){_0x481ae3=_0x21bc26[_0x3e55('0x2f')];if(!_0x4a1697[_0x3e55('0x2a')][_0x3e55('0x30')]('nolimit')){_0x14f84e[_0x3e55('0x1a')]=qs[_0x3e55('0x1a')](_0x4a1697[_0x3e55('0x2a')][_0x3e55('0x1a')]);_0x14f84e['offset']=qs[_0x3e55('0x1c')](_0x4a1697['query'][_0x3e55('0x1c')]);}return _0x2b5522[_0x3e55('0x47')](_0x14f84e);}})['then'](function(_0x4d50c9){if(_0x4d50c9){return _0x4d50c9?{'count':_0x481ae3,'rows':_0x4d50c9}:null;}})[_0x3e55('0x21')](respondWithResult(_0x243520,null))['catch'](handleError(_0x243520,null));};exports[_0x3e55('0x48')]=function(_0x179bae,_0x45a94a,_0x18ba31){var _0x320bf3={};var _0x469d16={};var _0x370cc0;var _0xece85f;return db[_0x3e55('0x26')][_0x3e55('0x44')]({'where':{'id':_0x179bae['params']['id']}})[_0x3e55('0x21')](handleEntityNotFound(_0x45a94a,null))[_0x3e55('0x21')](function(_0x14dfd2){if(_0x14dfd2){_0x370cc0=_0x14dfd2;_0x469d16[_0x3e55('0x29')]=_[_0x3e55('0x2b')](db[_0x3e55('0x45')]['rawAttributes']);_0x469d16['query']=_[_0x3e55('0x2b')](_0x179bae['query']);_0x469d16[_0x3e55('0x34')]=_[_0x3e55('0x2c')](_0x469d16[_0x3e55('0x29')],_0x469d16[_0x3e55('0x2a')]);_0x320bf3['attributes']=_[_0x3e55('0x2c')](_0x469d16[_0x3e55('0x29')],qs['fields'](_0x179bae[_0x3e55('0x2a')]['fields']));_0x320bf3[_0x3e55('0x2e')]=_0x320bf3[_0x3e55('0x2e')]['length']?_0x320bf3['attributes']:_0x469d16[_0x3e55('0x29')];_0x320bf3[_0x3e55('0x46')]=qs['sort'](_0x179bae[_0x3e55('0x2a')][_0x3e55('0x32')]);_0x320bf3[_0x3e55('0x33')]=qs[_0x3e55('0x34')](_[_0x3e55('0x49')](_0x179bae[_0x3e55('0x2a')],_0x469d16[_0x3e55('0x34')]));if(_0x179bae[_0x3e55('0x2a')][_0x3e55('0x38')]){_0x320bf3[_0x3e55('0x33')]=_[_0x3e55('0x35')](_0x320bf3[_0x3e55('0x33')],{'$or':_[_0x3e55('0x36')](_0x320bf3['attributes'],function(_0x34f023){var _0x18dc07={};_0x18dc07[_0x34f023]={'$like':'%'+_0x179bae['query'][_0x3e55('0x38')]+'%'};return _0x18dc07;})});}_0x320bf3=_[_0x3e55('0x35')]({},_0x320bf3,_0x179bae[_0x3e55('0x39')]);return _0x370cc0[_0x3e55('0x48')](_0x320bf3);}})[_0x3e55('0x21')](function(_0x1c3f81){if(_0x1c3f81){_0xece85f=_0x1c3f81[_0x3e55('0x2f')];if(!_0x179bae[_0x3e55('0x2a')][_0x3e55('0x30')](_0x3e55('0x31'))){_0x320bf3[_0x3e55('0x1a')]=qs[_0x3e55('0x1a')](_0x179bae[_0x3e55('0x2a')][_0x3e55('0x1a')]);_0x320bf3[_0x3e55('0x1c')]=qs['offset'](_0x179bae[_0x3e55('0x2a')][_0x3e55('0x1c')]);}return _0x370cc0[_0x3e55('0x48')](_0x320bf3);}})['then'](function(_0x4dd953){if(_0x4dd953){return _0x4dd953?{'count':_0xece85f,'rows':_0x4dd953}:null;}})['then'](respondWithResult(_0x45a94a,null))[_0x3e55('0x3c')](handleError(_0x45a94a,null));};exports[_0x3e55('0x4a')]=function(_0x50b56f,_0x842277,_0x4b97cd){var _0x37d4ce={};var _0x2b8b94={};var _0x24d4df;var _0x116b12;return db[_0x3e55('0x26')][_0x3e55('0x44')]({'where':{'id':_0x50b56f[_0x3e55('0x42')]['id']}})[_0x3e55('0x21')](handleEntityNotFound(_0x842277,null))[_0x3e55('0x21')](function(_0x5daa22){if(_0x5daa22){_0x24d4df=_0x5daa22;_0x2b8b94[_0x3e55('0x29')]=_['keys'](db[_0x3e55('0x45')]['rawAttributes']);_0x2b8b94[_0x3e55('0x2a')]=_[_0x3e55('0x2b')](_0x50b56f[_0x3e55('0x2a')]);_0x2b8b94[_0x3e55('0x34')]=_[_0x3e55('0x2c')](_0x2b8b94['model'],_0x2b8b94[_0x3e55('0x2a')]);_0x37d4ce[_0x3e55('0x2e')]=_['intersection'](_0x2b8b94[_0x3e55('0x29')],qs['fields'](_0x50b56f[_0x3e55('0x2a')][_0x3e55('0x2d')]));_0x37d4ce[_0x3e55('0x2e')]=_0x37d4ce[_0x3e55('0x2e')]['length']?_0x37d4ce[_0x3e55('0x2e')]:_0x2b8b94[_0x3e55('0x29')];_0x37d4ce[_0x3e55('0x46')]=qs[_0x3e55('0x32')](_0x50b56f[_0x3e55('0x2a')][_0x3e55('0x32')]);_0x37d4ce[_0x3e55('0x33')]=qs['filters'](_[_0x3e55('0x49')](_0x50b56f[_0x3e55('0x2a')],_0x2b8b94[_0x3e55('0x34')]));if(_0x50b56f[_0x3e55('0x2a')]['filter']){_0x37d4ce[_0x3e55('0x33')]=_[_0x3e55('0x35')](_0x37d4ce[_0x3e55('0x33')],{'$or':_['map'](_0x37d4ce[_0x3e55('0x2e')],function(_0x2d0bab){var _0xce141={};_0xce141[_0x2d0bab]={'$like':'%'+_0x50b56f[_0x3e55('0x2a')]['filter']+'%'};return _0xce141;})});}_0x37d4ce=_[_0x3e55('0x35')]({},_0x37d4ce,_0x50b56f[_0x3e55('0x39')]);return _0x24d4df['getFields'](_0x37d4ce);}})[_0x3e55('0x21')](function(_0x1fd6e8){if(_0x1fd6e8){_0x116b12=_0x1fd6e8[_0x3e55('0x2f')];if(!_0x50b56f['query'][_0x3e55('0x30')]('nolimit')){_0x37d4ce[_0x3e55('0x1a')]=qs[_0x3e55('0x1a')](_0x50b56f[_0x3e55('0x2a')][_0x3e55('0x1a')]);_0x37d4ce[_0x3e55('0x1c')]=qs[_0x3e55('0x1c')](_0x50b56f[_0x3e55('0x2a')][_0x3e55('0x1c')]);}return _0x24d4df[_0x3e55('0x4a')](_0x37d4ce);}})['then'](function(_0x3132fd){if(_0x3132fd){return _0x3132fd?{'count':_0x116b12,'rows':_0x3132fd}:null;}})[_0x3e55('0x21')](respondWithResult(_0x842277,null))[_0x3e55('0x3c')](handleError(_0x842277,null));}; \ No newline at end of file +var _0x462b=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','rawAttributes'];(function(_0x2a4d85,_0x2a01e4){var _0x4ef061=function(_0x2d6eb0){while(--_0x2d6eb0){_0x2a4d85['push'](_0x2a4d85['shift']());}};_0x4ef061(++_0x2a01e4);}(_0x462b,0x162));var _0xb462=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x462b[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xb462('0x0'));var rimraf=require(_0xb462('0x1'));var zipdir=require(_0xb462('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb462('0x3'));var moment=require(_0xb462('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb462('0x5'));var util=require('util');var path=require(_0xb462('0x6'));var sox=require(_0xb462('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb462('0x8'));var _=require('lodash');var squel=require(_0xb462('0x9'));var crypto=require(_0xb462('0xa'));var jsforce=require(_0xb462('0xb'));var deskjs=require(_0xb462('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb462('0xd'));var Papa=require(_0xb462('0xe'));var Redis=require('ioredis');var authService=require(_0xb462('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb462('0x10'));var hardwareService=require(_0xb462('0x11'));var logger=require(_0xb462('0x12'))('api');var utils=require(_0xb462('0x13'));var config=require(_0xb462('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb462('0x15'))['db'];function respondWithStatusCode(_0x27d34b,_0x3881db){_0x3881db=_0x3881db||0xcc;return function(_0x15ae8a){if(_0x15ae8a){return _0x27d34b[_0xb462('0x16')](_0x3881db);}return _0x27d34b[_0xb462('0x17')](_0x3881db)[_0xb462('0x18')]();};}function respondWithResult(_0xb157da,_0x45228f){_0x45228f=_0x45228f||0xc8;return function(_0x34ad1b){if(_0x34ad1b){return _0xb157da[_0xb462('0x17')](_0x45228f)['json'](_0x34ad1b);}};}function respondWithFilteredResult(_0x399f81,_0x198b30){return function(_0x3b315e){if(_0x3b315e){var _0x119bf6=typeof _0x198b30[_0xb462('0x19')]===_0xb462('0x1a')&&typeof _0x198b30[_0xb462('0x1b')]===_0xb462('0x1a');var _0x3b0f72=_0x3b315e[_0xb462('0x1c')];var _0x18b7e8=_0x119bf6?0x0:_0x198b30[_0xb462('0x19')];var _0x4fda56=_0x119bf6?_0x3b315e['count']:_0x198b30['offset']+_0x198b30[_0xb462('0x1b')];var _0x132210;if(_0x4fda56>=_0x3b0f72){_0x4fda56=_0x3b0f72;_0x132210=0xc8;}else{_0x132210=0xce;}_0x399f81[_0xb462('0x17')](_0x132210);return _0x399f81[_0xb462('0x1d')](_0xb462('0x1e'),_0x18b7e8+'-'+_0x4fda56+'/'+_0x3b0f72)['json'](_0x3b315e);}return null;};}function patchUpdates(_0x4bfe67){return function(_0x5a1d2f){try{jsonpatch[_0xb462('0x1f')](_0x5a1d2f,_0x4bfe67,!![]);}catch(_0x19f85){return BPromise['reject'](_0x19f85);}return _0x5a1d2f[_0xb462('0x20')]();};}function saveUpdates(_0x8109a9,_0x4b8e11){return function(_0x22e70f){if(_0x22e70f){return _0x22e70f['update'](_0x8109a9)[_0xb462('0x21')](function(_0x50c09a){return _0x50c09a;});}return null;};}function removeEntity(_0x1e8aa5,_0x44477e){return function(_0x4bb9c5){if(_0x4bb9c5){return _0x4bb9c5[_0xb462('0x22')]()[_0xb462('0x21')](function(){_0x1e8aa5[_0xb462('0x17')](0xcc)[_0xb462('0x18')]();});}};}function handleEntityNotFound(_0x38da2b,_0x3a7797){return function(_0x1a8fdd){if(!_0x1a8fdd){_0x38da2b[_0xb462('0x16')](0x194);}return _0x1a8fdd;};}function handleError(_0x14769b,_0x306d03){_0x306d03=_0x306d03||0x1f4;return function(_0x1ee0fd){logger[_0xb462('0x23')](_0x1ee0fd[_0xb462('0x24')]);if(_0x1ee0fd[_0xb462('0x25')]){delete _0x1ee0fd[_0xb462('0x25')];}_0x14769b[_0xb462('0x17')](_0x306d03)[_0xb462('0x26')](_0x1ee0fd);};}exports['index']=function(_0xa79fcf,_0x4b7f62){var _0x43c3b6={},_0x3a6e62={},_0x313406={'count':0x0,'rows':[]};var _0x1cecd8=_[_0xb462('0x27')](db['FreshsalesConfiguration'][_0xb462('0x28')],function(_0x8ff049){return{'name':_0x8ff049[_0xb462('0x29')],'type':_0x8ff049['type'][_0xb462('0x2a')]};});_0x3a6e62['model']=_[_0xb462('0x27')](_0x1cecd8,'name');_0x3a6e62[_0xb462('0x2b')]=_[_0xb462('0x2c')](_0xa79fcf[_0xb462('0x2b')]);_0x3a6e62[_0xb462('0x2d')]=_[_0xb462('0x2e')](_0x3a6e62[_0xb462('0x2f')],_0x3a6e62[_0xb462('0x2b')]);_0x43c3b6[_0xb462('0x30')]=_['intersection'](_0x3a6e62['model'],qs[_0xb462('0x31')](_0xa79fcf[_0xb462('0x2b')]['fields']));_0x43c3b6[_0xb462('0x30')]=_0x43c3b6[_0xb462('0x30')]['length']?_0x43c3b6[_0xb462('0x30')]:_0x3a6e62['model'];if(!_0xa79fcf[_0xb462('0x2b')][_0xb462('0x32')](_0xb462('0x33'))){_0x43c3b6[_0xb462('0x1b')]=qs['limit'](_0xa79fcf[_0xb462('0x2b')][_0xb462('0x1b')]);_0x43c3b6['offset']=qs['offset'](_0xa79fcf[_0xb462('0x2b')][_0xb462('0x19')]);}_0x43c3b6[_0xb462('0x34')]=qs[_0xb462('0x35')](_0xa79fcf['query']['sort']);_0x43c3b6[_0xb462('0x36')]=qs[_0xb462('0x2d')](_[_0xb462('0x37')](_0xa79fcf[_0xb462('0x2b')],_0x3a6e62[_0xb462('0x2d')]),_0x1cecd8);if(_0xa79fcf[_0xb462('0x2b')][_0xb462('0x38')]){_0x43c3b6['where']=_['merge'](_0x43c3b6[_0xb462('0x36')],{'$or':_[_0xb462('0x27')](_0x1cecd8,function(_0x176c23){if(_0x176c23[_0xb462('0x39')]!==_0xb462('0x3a')){var _0x49ee12={};_0x49ee12[_0x176c23[_0xb462('0x25')]]={'$like':'%'+_0xa79fcf['query'][_0xb462('0x38')]+'%'};return _0x49ee12;}})});}_0x43c3b6=_[_0xb462('0x3b')]({},_0x43c3b6,_0xa79fcf[_0xb462('0x3c')]);var _0x4a3e4c={'where':_0x43c3b6[_0xb462('0x36')]};return db[_0xb462('0x3d')][_0xb462('0x1c')](_0x4a3e4c)[_0xb462('0x21')](function(_0x3ae23d){_0x313406[_0xb462('0x1c')]=_0x3ae23d;if(_0xa79fcf['query'][_0xb462('0x3e')]){_0x43c3b6[_0xb462('0x3f')]=[{'all':!![]}];}return db[_0xb462('0x3d')][_0xb462('0x40')](_0x43c3b6);})[_0xb462('0x21')](function(_0x3873b1){_0x313406[_0xb462('0x41')]=_0x3873b1;return _0x313406;})[_0xb462('0x21')](respondWithFilteredResult(_0x4b7f62,_0x43c3b6))[_0xb462('0x42')](handleError(_0x4b7f62,null));};exports[_0xb462('0x43')]=function(_0xe89d75,_0x22f4f9){var _0x1089e1={'raw':![],'where':{'id':_0xe89d75[_0xb462('0x44')]['id']}},_0x83567c={};_0x83567c['model']=_['keys'](db['FreshsalesConfiguration'][_0xb462('0x28')]);_0x83567c[_0xb462('0x2b')]=_[_0xb462('0x2c')](_0xe89d75[_0xb462('0x2b')]);_0x83567c[_0xb462('0x2d')]=_[_0xb462('0x2e')](_0x83567c[_0xb462('0x2f')],_0x83567c[_0xb462('0x2b')]);_0x1089e1[_0xb462('0x30')]=_['intersection'](_0x83567c[_0xb462('0x2f')],qs[_0xb462('0x31')](_0xe89d75[_0xb462('0x2b')][_0xb462('0x31')]));_0x1089e1['attributes']=_0x1089e1[_0xb462('0x30')][_0xb462('0x45')]?_0x1089e1[_0xb462('0x30')]:_0x83567c[_0xb462('0x2f')];if(_0xe89d75['query']['includeAll']){_0x1089e1[_0xb462('0x3f')]=[{'all':!![]}];}_0x1089e1=_[_0xb462('0x3b')]({},_0x1089e1,_0xe89d75[_0xb462('0x3c')]);return db[_0xb462('0x3d')]['find'](_0x1089e1)['then'](handleEntityNotFound(_0x22f4f9,null))[_0xb462('0x21')](respondWithResult(_0x22f4f9,null))['catch'](handleError(_0x22f4f9,null));};exports['create']=function(_0x3c41a4,_0x181f95){return db['FreshsalesConfiguration'][_0xb462('0x46')](_0x3c41a4[_0xb462('0x47')],{})[_0xb462('0x21')](respondWithResult(_0x181f95,0xc9))['catch'](handleError(_0x181f95,null));};exports[_0xb462('0x48')]=function(_0x2cbabb,_0x16fc9e){if(_0x2cbabb[_0xb462('0x47')]['id']){delete _0x2cbabb[_0xb462('0x47')]['id'];}return db['FreshsalesConfiguration'][_0xb462('0x49')]({'where':{'id':_0x2cbabb['params']['id']}})[_0xb462('0x21')](handleEntityNotFound(_0x16fc9e,null))[_0xb462('0x21')](saveUpdates(_0x2cbabb[_0xb462('0x47')],null))[_0xb462('0x21')](respondWithResult(_0x16fc9e,null))[_0xb462('0x42')](handleError(_0x16fc9e,null));};exports[_0xb462('0x22')]=function(_0x324417,_0x44c02e){return db[_0xb462('0x3d')][_0xb462('0x49')]({'where':{'id':_0x324417[_0xb462('0x44')]['id']}})[_0xb462('0x21')](handleEntityNotFound(_0x44c02e,null))[_0xb462('0x21')](removeEntity(_0x44c02e,null))['catch'](handleError(_0x44c02e,null));};exports[_0xb462('0x4a')]=function(_0x39cb13,_0x2e3d70,_0x2d7587){var _0x506897={};var _0x3ae8af={};var _0x5eda59;var _0x2404c9;return db[_0xb462('0x3d')][_0xb462('0x4b')]({'where':{'id':_0x39cb13['params']['id']}})[_0xb462('0x21')](handleEntityNotFound(_0x2e3d70,null))['then'](function(_0x171b69){if(_0x171b69){_0x5eda59=_0x171b69;_0x3ae8af[_0xb462('0x2f')]=_[_0xb462('0x2c')](db['FreshsalesField']['rawAttributes']);_0x3ae8af[_0xb462('0x2b')]=_[_0xb462('0x2c')](_0x39cb13['query']);_0x3ae8af['filters']=_[_0xb462('0x2e')](_0x3ae8af['model'],_0x3ae8af[_0xb462('0x2b')]);_0x506897[_0xb462('0x30')]=_[_0xb462('0x2e')](_0x3ae8af[_0xb462('0x2f')],qs[_0xb462('0x31')](_0x39cb13[_0xb462('0x2b')]['fields']));_0x506897['attributes']=_0x506897['attributes'][_0xb462('0x45')]?_0x506897[_0xb462('0x30')]:_0x3ae8af[_0xb462('0x2f')];_0x506897['order']=qs[_0xb462('0x35')](_0x39cb13['query'][_0xb462('0x35')]);_0x506897[_0xb462('0x36')]=qs[_0xb462('0x2d')](_['pick'](_0x39cb13['query'],_0x3ae8af['filters']));if(_0x39cb13[_0xb462('0x2b')][_0xb462('0x38')]){_0x506897['where']=_[_0xb462('0x3b')](_0x506897['where'],{'$or':_[_0xb462('0x27')](_0x506897[_0xb462('0x30')],function(_0x265da2){var _0x410e34={};_0x410e34[_0x265da2]={'$like':'%'+_0x39cb13[_0xb462('0x2b')]['filter']+'%'};return _0x410e34;})});}_0x506897=_['merge']({},_0x506897,_0x39cb13[_0xb462('0x3c')]);return _0x5eda59[_0xb462('0x4a')](_0x506897);}})['then'](function(_0x14edef){if(_0x14edef){_0x2404c9=_0x14edef['length'];if(!_0x39cb13[_0xb462('0x2b')][_0xb462('0x32')]('nolimit')){_0x506897[_0xb462('0x1b')]=qs[_0xb462('0x1b')](_0x39cb13['query'][_0xb462('0x1b')]);_0x506897[_0xb462('0x19')]=qs['offset'](_0x39cb13[_0xb462('0x2b')][_0xb462('0x19')]);}return _0x5eda59['getSubjects'](_0x506897);}})[_0xb462('0x21')](function(_0x5b4c52){if(_0x5b4c52){return _0x5b4c52?{'count':_0x2404c9,'rows':_0x5b4c52}:null;}})[_0xb462('0x21')](respondWithResult(_0x2e3d70,null))[_0xb462('0x42')](handleError(_0x2e3d70,null));};exports[_0xb462('0x4c')]=function(_0x21e86c,_0x580989,_0x3a9f72){var _0x51b466={};var _0x4e1cb2={};var _0x559915;var _0xa3e09b;return db[_0xb462('0x3d')]['findOne']({'where':{'id':_0x21e86c['params']['id']}})[_0xb462('0x21')](handleEntityNotFound(_0x580989,null))['then'](function(_0x49e6ef){if(_0x49e6ef){_0x559915=_0x49e6ef;_0x4e1cb2[_0xb462('0x2f')]=_[_0xb462('0x2c')](db[_0xb462('0x4d')][_0xb462('0x28')]);_0x4e1cb2[_0xb462('0x2b')]=_['keys'](_0x21e86c[_0xb462('0x2b')]);_0x4e1cb2[_0xb462('0x2d')]=_['intersection'](_0x4e1cb2[_0xb462('0x2f')],_0x4e1cb2[_0xb462('0x2b')]);_0x51b466[_0xb462('0x30')]=_['intersection'](_0x4e1cb2[_0xb462('0x2f')],qs[_0xb462('0x31')](_0x21e86c[_0xb462('0x2b')][_0xb462('0x31')]));_0x51b466['attributes']=_0x51b466[_0xb462('0x30')][_0xb462('0x45')]?_0x51b466[_0xb462('0x30')]:_0x4e1cb2[_0xb462('0x2f')];_0x51b466[_0xb462('0x34')]=qs[_0xb462('0x35')](_0x21e86c[_0xb462('0x2b')][_0xb462('0x35')]);_0x51b466['where']=qs[_0xb462('0x2d')](_[_0xb462('0x37')](_0x21e86c[_0xb462('0x2b')],_0x4e1cb2['filters']));if(_0x21e86c[_0xb462('0x2b')][_0xb462('0x38')]){_0x51b466[_0xb462('0x36')]=_[_0xb462('0x3b')](_0x51b466[_0xb462('0x36')],{'$or':_[_0xb462('0x27')](_0x51b466[_0xb462('0x30')],function(_0x3a738a){var _0x42d0ec={};_0x42d0ec[_0x3a738a]={'$like':'%'+_0x21e86c[_0xb462('0x2b')]['filter']+'%'};return _0x42d0ec;})});}_0x51b466=_[_0xb462('0x3b')]({},_0x51b466,_0x21e86c[_0xb462('0x3c')]);return _0x559915[_0xb462('0x4c')](_0x51b466);}})['then'](function(_0x5a8c2b){if(_0x5a8c2b){_0xa3e09b=_0x5a8c2b[_0xb462('0x45')];if(!_0x21e86c['query']['hasOwnProperty']('nolimit')){_0x51b466[_0xb462('0x1b')]=qs[_0xb462('0x1b')](_0x21e86c[_0xb462('0x2b')][_0xb462('0x1b')]);_0x51b466[_0xb462('0x19')]=qs[_0xb462('0x19')](_0x21e86c['query']['offset']);}return _0x559915[_0xb462('0x4c')](_0x51b466);}})['then'](function(_0x2fbb7f){if(_0x2fbb7f){return _0x2fbb7f?{'count':_0xa3e09b,'rows':_0x2fbb7f}:null;}})[_0xb462('0x21')](respondWithResult(_0x580989,null))['catch'](handleError(_0x580989,null));};exports[_0xb462('0x4e')]=function(_0x22e7da,_0x5bc902,_0x423eb6){var _0x12898f={};var _0x47ff8e={};var _0x2aa549;var _0x3a11b1;return db[_0xb462('0x3d')][_0xb462('0x4b')]({'where':{'id':_0x22e7da['params']['id']}})[_0xb462('0x21')](handleEntityNotFound(_0x5bc902,null))[_0xb462('0x21')](function(_0x189549){if(_0x189549){_0x2aa549=_0x189549;_0x47ff8e[_0xb462('0x2f')]=_[_0xb462('0x2c')](db['FreshsalesField'][_0xb462('0x28')]);_0x47ff8e[_0xb462('0x2b')]=_[_0xb462('0x2c')](_0x22e7da[_0xb462('0x2b')]);_0x47ff8e[_0xb462('0x2d')]=_['intersection'](_0x47ff8e[_0xb462('0x2f')],_0x47ff8e['query']);_0x12898f[_0xb462('0x30')]=_[_0xb462('0x2e')](_0x47ff8e['model'],qs[_0xb462('0x31')](_0x22e7da['query'][_0xb462('0x31')]));_0x12898f[_0xb462('0x30')]=_0x12898f[_0xb462('0x30')]['length']?_0x12898f[_0xb462('0x30')]:_0x47ff8e['model'];_0x12898f[_0xb462('0x34')]=qs[_0xb462('0x35')](_0x22e7da['query']['sort']);_0x12898f[_0xb462('0x36')]=qs[_0xb462('0x2d')](_[_0xb462('0x37')](_0x22e7da[_0xb462('0x2b')],_0x47ff8e['filters']));if(_0x22e7da[_0xb462('0x2b')]['filter']){_0x12898f[_0xb462('0x36')]=_['merge'](_0x12898f[_0xb462('0x36')],{'$or':_[_0xb462('0x27')](_0x12898f[_0xb462('0x30')],function(_0x1a4b0b){var _0x40dcb9={};_0x40dcb9[_0x1a4b0b]={'$like':'%'+_0x22e7da[_0xb462('0x2b')][_0xb462('0x38')]+'%'};return _0x40dcb9;})});}_0x12898f=_['merge']({},_0x12898f,_0x22e7da['options']);return _0x2aa549[_0xb462('0x4e')](_0x12898f);}})['then'](function(_0xcdd8ad){if(_0xcdd8ad){_0x3a11b1=_0xcdd8ad[_0xb462('0x45')];if(!_0x22e7da[_0xb462('0x2b')][_0xb462('0x32')](_0xb462('0x33'))){_0x12898f[_0xb462('0x1b')]=qs['limit'](_0x22e7da[_0xb462('0x2b')][_0xb462('0x1b')]);_0x12898f['offset']=qs[_0xb462('0x19')](_0x22e7da[_0xb462('0x2b')][_0xb462('0x19')]);}return _0x2aa549['getFields'](_0x12898f);}})[_0xb462('0x21')](function(_0x2322a3){if(_0x2322a3){return _0x2322a3?{'count':_0x3a11b1,'rows':_0x2322a3}:null;}})['then'](respondWithResult(_0x5bc902,null))['catch'](handleError(_0x5bc902,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 47cc8b9..ea38172 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 _0xfdcb=['path','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfdcb,0x89));var _0xbfdc=function(_0x19ee96,_0x48b7d5){_0x19ee96=_0x19ee96-0x0;var _0x57aaf0=_0xfdcb[_0x19ee96];return _0x57aaf0;};'use strict';var _=require(_0xbfdc('0x0'));var util=require(_0xbfdc('0x1'));var logger=require(_0xbfdc('0x2'))(_0xbfdc('0x3'));var moment=require('moment');var BPromise=require(_0xbfdc('0x4'));var rp=require(_0xbfdc('0x5'));var fs=require('fs');var path=require(_0xbfdc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbfdc('0x7'));module[_0xbfdc('0x8')]=function(_0x121412,_0xea710f){return _0x121412['define'](_0xbfdc('0x9'),attributes,{'tableName':_0xbfdc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc484=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','util','../../config/logger'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xc484,0xf4));var _0x4c48=function(_0x3c6a5e,_0x27f4e7){_0x3c6a5e=_0x3c6a5e-0x0;var _0x27104e=_0xc484[_0x3c6a5e];return _0x27104e;};'use strict';var _=require(_0x4c48('0x0'));var util=require(_0x4c48('0x1'));var logger=require(_0x4c48('0x2'))(_0x4c48('0x3'));var moment=require(_0x4c48('0x4'));var BPromise=require(_0x4c48('0x5'));var rp=require(_0x4c48('0x6'));var fs=require('fs');var path=require(_0x4c48('0x7'));var rimraf=require(_0x4c48('0x8'));var config=require(_0x4c48('0x9'));var attributes=require(_0x4c48('0xa'));module[_0x4c48('0xb')]=function(_0x293aec,_0x450178){return _0x293aec['define'](_0x4c48('0xc'),attributes,{'tableName':'int_freshsales_configurations','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 b224d50..0faf652 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 _0xd16f=['jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x539346,_0x2ee4db){var _0x4e50f0=function(_0x575540){while(--_0x575540){_0x539346['push'](_0x539346['shift']());}};_0x4e50f0(++_0x2ee4db);}(_0xd16f,0x73));var _0xfd16=function(_0x3c846c,_0x1627a5){_0x3c846c=_0x3c846c-0x0;var _0x29f169=_0xd16f[_0x3c846c];return _0x29f169;};'use strict';var _=require(_0xfd16('0x0'));var util=require(_0xfd16('0x1'));var moment=require(_0xfd16('0x2'));var BPromise=require(_0xfd16('0x3'));var rs=require(_0xfd16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd16('0x5'))['db'];var utils=require(_0xfd16('0x6'));var logger=require(_0xfd16('0x7'))(_0xfd16('0x8'));var config=require(_0xfd16('0x9'));var jayson=require(_0xfd16('0xa'));var client=jayson[_0xfd16('0xb')][_0xfd16('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28dd98,_0x273a26,_0x2dafcc){return new BPromise(function(_0x38acbc,_0x43fb44){return client[_0xfd16('0xd')](_0x28dd98,_0x2dafcc)['then'](function(_0x40a68e){logger['info'](_0xfd16('0xe'),_0x273a26,_0xfd16('0xf'));logger[_0xfd16('0x10')](_0xfd16('0x11'),_0x273a26,_0xfd16('0xf'),JSON[_0xfd16('0x12')](_0x40a68e));if(_0x40a68e[_0xfd16('0x13')]){if(_0x40a68e[_0xfd16('0x13')][_0xfd16('0x14')]===0x1f4){logger['error'](_0xfd16('0xe'),_0x273a26,_0x40a68e[_0xfd16('0x13')][_0xfd16('0x15')]);return _0x43fb44(_0x40a68e[_0xfd16('0x13')]['message']);}logger[_0xfd16('0x13')](_0xfd16('0xe'),_0x273a26,_0x40a68e[_0xfd16('0x13')][_0xfd16('0x15')]);return _0x38acbc(_0x40a68e['error'][_0xfd16('0x15')]);}else{logger[_0xfd16('0x16')](_0xfd16('0xe'),_0x273a26,_0xfd16('0xf'));_0x38acbc(_0x40a68e[_0xfd16('0x17')]['message']);}})[_0xfd16('0x18')](function(_0x52a1b8){logger['error'](_0xfd16('0xe'),_0x273a26,_0x52a1b8);_0x43fb44(_0x52a1b8);});});} \ No newline at end of file +var _0xffdf=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x18ef09,_0x3ad6ad){var _0x48935b=function(_0x5a2cb4){while(--_0x5a2cb4){_0x18ef09['push'](_0x18ef09['shift']());}};_0x48935b(++_0x3ad6ad);}(_0xffdf,0xff));var _0xfffd=function(_0x42ca58,_0x423bf9){_0x42ca58=_0x42ca58-0x0;var _0x1a3a40=_0xffdf[_0x42ca58];return _0x1a3a40;};'use strict';var _=require(_0xfffd('0x0'));var util=require('util');var moment=require(_0xfffd('0x1'));var BPromise=require('bluebird');var rs=require(_0xfffd('0x2'));var fs=require('fs');var Redis=require(_0xfffd('0x3'));var db=require(_0xfffd('0x4'))['db'];var utils=require(_0xfffd('0x5'));var logger=require('../../config/logger')(_0xfffd('0x6'));var config=require('../../config/environment');var jayson=require(_0xfffd('0x7'));var client=jayson[_0xfffd('0x8')][_0xfffd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9d72ee,_0x4338f5,_0x2a0c36){return new BPromise(function(_0x30aa76,_0x5ee9a3){return client[_0xfffd('0xa')](_0x9d72ee,_0x2a0c36)[_0xfffd('0xb')](function(_0x4ffdda){logger[_0xfffd('0xc')](_0xfffd('0xd'),_0x4338f5,_0xfffd('0xe'));logger[_0xfffd('0xf')](_0xfffd('0x10'),_0x4338f5,'request\x20sent',JSON[_0xfffd('0x11')](_0x4ffdda));if(_0x4ffdda[_0xfffd('0x12')]){if(_0x4ffdda[_0xfffd('0x12')][_0xfffd('0x13')]===0x1f4){logger[_0xfffd('0x12')](_0xfffd('0xd'),_0x4338f5,_0x4ffdda[_0xfffd('0x12')]['message']);return _0x5ee9a3(_0x4ffdda[_0xfffd('0x12')][_0xfffd('0x14')]);}logger[_0xfffd('0x12')](_0xfffd('0xd'),_0x4338f5,_0x4ffdda['error'][_0xfffd('0x14')]);return _0x30aa76(_0x4ffdda[_0xfffd('0x12')][_0xfffd('0x14')]);}else{logger['info'](_0xfffd('0xd'),_0x4338f5,_0xfffd('0xe'));_0x30aa76(_0x4ffdda[_0xfffd('0x15')][_0xfffd('0x14')]);}})['catch'](function(_0x44e9fb){logger[_0xfffd('0x12')](_0xfffd('0xd'),_0x4338f5,_0x44e9fb);_0x5ee9a3(_0x44e9fb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d19c0c0..725d306 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 _0x9ef8=['index','get','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x9ef8,0x17f));var _0x89ef=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x9ef8[_0x211632];return _0x5a1da1;};'use strict';var multer=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var path=require('path');var timeout=require(_0x89ef('0x2'));var express=require(_0x89ef('0x3'));var router=express[_0x89ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89ef('0x5'));var interaction=require(_0x89ef('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x89ef('0x7')](),controller[_0x89ef('0x8')]);router[_0x89ef('0x9')](_0x89ef('0xa'),auth[_0x89ef('0x7')](),controller[_0x89ef('0xb')]);router[_0x89ef('0xc')]('/',auth[_0x89ef('0x7')](),controller[_0x89ef('0xd')]);router['put'](_0x89ef('0xa'),auth[_0x89ef('0x7')](),controller[_0x89ef('0xe')]);router['delete'](_0x89ef('0xa'),auth[_0x89ef('0x7')](),controller[_0x89ef('0xf')]);module[_0x89ef('0x10')]=router; \ No newline at end of file +var _0xf53f=['get','isAuthenticated','show','post','put','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x28c14f,_0x566182){var _0x2271c8=function(_0x1a3cde){while(--_0x1a3cde){_0x28c14f['push'](_0x28c14f['shift']());}};_0x2271c8(++_0x566182);}(_0xf53f,0x8d));var _0xff53=function(_0xc3f9ea,_0x2267f1){_0xc3f9ea=_0xc3f9ea-0x0;var _0x27a223=_0xf53f[_0xc3f9ea];return _0x27a223;};'use strict';var multer=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var timeout=require(_0xff53('0x3'));var express=require(_0xff53('0x4'));var router=express[_0xff53('0x5')]();var fs_extra=require(_0xff53('0x6'));var auth=require(_0xff53('0x7'));var interaction=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var controller=require(_0xff53('0xa'));router[_0xff53('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff53('0xb')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0xd')]);router[_0xff53('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff53('0xf')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0x10')]);router['delete'](_0xff53('0x11'),auth[_0xff53('0xc')](),controller['destroy']);module[_0xff53('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 0c9d38f..13ee627 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 _0xee3d=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xee3d,0x88));var _0xdee3=function(_0x2626a6,_0x5eae7b){_0x2626a6=_0x2626a6-0x0;var _0x2bfb93=_0xee3d[_0x2626a6];return _0x2bfb93;};'use strict';var Sequelize=require(_0xdee3('0x0'));module[_0xdee3('0x1')]={'type':{'type':Sequelize[_0xdee3('0x2')](_0xdee3('0x3'),_0xdee3('0x4'),_0xdee3('0x5'),_0xdee3('0x6'),'picklist'),'defaultValue':_0xdee3('0x3')},'content':{'type':Sequelize[_0xdee3('0x7')]},'key':{'type':Sequelize[_0xdee3('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xdee3('0x3'),'variable',_0xdee3('0x5'))},'keyContent':{'type':Sequelize[_0xdee3('0x7')]},'idField':{'type':Sequelize[_0xdee3('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdee3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdee3('0x7')]}}; \ No newline at end of file +var _0xb55a=['keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xb55a,0x10a));var _0xab55=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb55a[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0xab55('0x0'));module[_0xab55('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xab55('0x2'),_0xab55('0x3'),_0xab55('0x4'),_0xab55('0x5')),'defaultValue':_0xab55('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xab55('0x7')]},'keyType':{'type':Sequelize[_0xab55('0x8')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xab55('0x7')]},'idField':{'type':Sequelize[_0xab55('0x7')]},'nameField':{'type':Sequelize[_0xab55('0x7')]},'customField':{'type':Sequelize[_0xab55('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab55('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e17ae80..abab138 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 _0xb161=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5c7403,_0x4bf9f0){var _0x101e87=function(_0x2b050f){while(--_0x2b050f){_0x5c7403['push'](_0x5c7403['shift']());}};_0x101e87(++_0x4bf9f0);}(_0xb161,0xc8));var _0x1b16=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0xb161[_0x4e170e];return _0x338291;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b16('0x0'));var jsonpatch=require(_0x1b16('0x1'));var rp=require('request-promise');var moment=require(_0x1b16('0x2'));var BPromise=require(_0x1b16('0x3'));var Mustache=require(_0x1b16('0x4'));var util=require(_0x1b16('0x5'));var path=require('path');var sox=require(_0x1b16('0x6'));var csv=require(_0x1b16('0x7'));var ejs=require(_0x1b16('0x8'));var fs=require('fs');var fs_extra=require(_0x1b16('0x9'));var _=require(_0x1b16('0xa'));var squel=require(_0x1b16('0xb'));var crypto=require(_0x1b16('0xc'));var jsforce=require(_0x1b16('0xd'));var deskjs=require(_0x1b16('0xe'));var toCsv=require(_0x1b16('0x7'));var querystring=require(_0x1b16('0xf'));var Papa=require(_0x1b16('0x10'));var Redis=require(_0x1b16('0x11'));var authService=require(_0x1b16('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b16('0x13'))(_0x1b16('0x14'));var utils=require(_0x1b16('0x15'));var config=require(_0x1b16('0x16'));var licenseUtil=require(_0x1b16('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15e801,_0x2d478d){_0x2d478d=_0x2d478d||0xcc;return function(_0x43560e){if(_0x43560e){return _0x15e801[_0x1b16('0x18')](_0x2d478d);}return _0x15e801[_0x1b16('0x19')](_0x2d478d)[_0x1b16('0x1a')]();};}function respondWithResult(_0x109ac7,_0x4948e8){_0x4948e8=_0x4948e8||0xc8;return function(_0x1d2be8){if(_0x1d2be8){return _0x109ac7[_0x1b16('0x19')](_0x4948e8)[_0x1b16('0x1b')](_0x1d2be8);}};}function respondWithFilteredResult(_0x3747de,_0x492a30){return function(_0x2afcba){if(_0x2afcba){var _0x439520=typeof _0x492a30['offset']===_0x1b16('0x1c')&&typeof _0x492a30['limit']===_0x1b16('0x1c');var _0x2887b5=_0x2afcba['count'];var _0x3ac785=_0x439520?0x0:_0x492a30[_0x1b16('0x1d')];var _0x77d3fc=_0x439520?_0x2afcba[_0x1b16('0x1e')]:_0x492a30[_0x1b16('0x1d')]+_0x492a30[_0x1b16('0x1f')];var _0x3b8c59;if(_0x77d3fc>=_0x2887b5){_0x77d3fc=_0x2887b5;_0x3b8c59=0xc8;}else{_0x3b8c59=0xce;}_0x3747de['status'](_0x3b8c59);return _0x3747de[_0x1b16('0x20')](_0x1b16('0x21'),_0x3ac785+'-'+_0x77d3fc+'/'+_0x2887b5)['json'](_0x2afcba);}return null;};}function patchUpdates(_0x4f4f03){return function(_0x44669b){try{jsonpatch['apply'](_0x44669b,_0x4f4f03,!![]);}catch(_0x4a53d8){return BPromise[_0x1b16('0x22')](_0x4a53d8);}return _0x44669b[_0x1b16('0x23')]();};}function saveUpdates(_0x473a82,_0x19d69e){return function(_0x172125){if(_0x172125){return _0x172125[_0x1b16('0x24')](_0x473a82)[_0x1b16('0x25')](function(_0xc6cde5){return _0xc6cde5;});}return null;};}function removeEntity(_0x37c1f5,_0x3c9045){return function(_0x56190a){if(_0x56190a){return _0x56190a[_0x1b16('0x26')]()[_0x1b16('0x25')](function(){_0x37c1f5[_0x1b16('0x19')](0xcc)[_0x1b16('0x1a')]();});}};}function handleEntityNotFound(_0x47deed,_0x2b01c3){return function(_0x59aea5){if(!_0x59aea5){_0x47deed[_0x1b16('0x18')](0x194);}return _0x59aea5;};}function handleError(_0x533c54,_0x348f79){_0x348f79=_0x348f79||0x1f4;return function(_0x220f31){logger[_0x1b16('0x27')](_0x220f31[_0x1b16('0x28')]);if(_0x220f31[_0x1b16('0x29')]){delete _0x220f31['name'];}_0x533c54[_0x1b16('0x19')](_0x348f79)['send'](_0x220f31);};}exports['index']=function(_0x2f891e,_0x53b31d){var _0x4de7dc={},_0xbf6931={},_0x3e7a69={'count':0x0,'rows':[]};var _0x1c7296=_[_0x1b16('0x2a')](db[_0x1b16('0x2b')][_0x1b16('0x2c')],function(_0x69c1a0){return{'name':_0x69c1a0['fieldName'],'type':_0x69c1a0[_0x1b16('0x2d')][_0x1b16('0x2e')]};});_0xbf6931[_0x1b16('0x2f')]=_[_0x1b16('0x2a')](_0x1c7296,_0x1b16('0x29'));_0xbf6931[_0x1b16('0x30')]=_[_0x1b16('0x31')](_0x2f891e[_0x1b16('0x30')]);_0xbf6931[_0x1b16('0x32')]=_[_0x1b16('0x33')](_0xbf6931[_0x1b16('0x2f')],_0xbf6931[_0x1b16('0x30')]);_0x4de7dc[_0x1b16('0x34')]=_[_0x1b16('0x33')](_0xbf6931['model'],qs['fields'](_0x2f891e[_0x1b16('0x30')][_0x1b16('0x35')]));_0x4de7dc[_0x1b16('0x34')]=_0x4de7dc[_0x1b16('0x34')][_0x1b16('0x36')]?_0x4de7dc[_0x1b16('0x34')]:_0xbf6931[_0x1b16('0x2f')];if(!_0x2f891e['query'][_0x1b16('0x37')](_0x1b16('0x38'))){_0x4de7dc['limit']=qs[_0x1b16('0x1f')](_0x2f891e[_0x1b16('0x30')]['limit']);_0x4de7dc[_0x1b16('0x1d')]=qs['offset'](_0x2f891e[_0x1b16('0x30')][_0x1b16('0x1d')]);}_0x4de7dc[_0x1b16('0x39')]=qs[_0x1b16('0x3a')](_0x2f891e[_0x1b16('0x30')][_0x1b16('0x3a')]);_0x4de7dc['where']=qs[_0x1b16('0x32')](_[_0x1b16('0x3b')](_0x2f891e[_0x1b16('0x30')],_0xbf6931[_0x1b16('0x32')]),_0x1c7296);if(_0x2f891e[_0x1b16('0x30')][_0x1b16('0x3c')]){_0x4de7dc[_0x1b16('0x3d')]=_[_0x1b16('0x3e')](_0x4de7dc[_0x1b16('0x3d')],{'$or':_[_0x1b16('0x2a')](_0x1c7296,function(_0x382325){if(_0x382325[_0x1b16('0x2d')]!==_0x1b16('0x3f')){var _0x2f6c39={};_0x2f6c39[_0x382325[_0x1b16('0x29')]]={'$like':'%'+_0x2f891e[_0x1b16('0x30')][_0x1b16('0x3c')]+'%'};return _0x2f6c39;}})});}_0x4de7dc=_['merge']({},_0x4de7dc,_0x2f891e[_0x1b16('0x40')]);var _0x3d3306={'where':_0x4de7dc[_0x1b16('0x3d')]};return db[_0x1b16('0x2b')][_0x1b16('0x1e')](_0x3d3306)[_0x1b16('0x25')](function(_0x29f68d){_0x3e7a69[_0x1b16('0x1e')]=_0x29f68d;if(_0x2f891e[_0x1b16('0x30')][_0x1b16('0x41')]){_0x4de7dc['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x4de7dc);})['then'](function(_0xb2ef35){_0x3e7a69[_0x1b16('0x42')]=_0xb2ef35;return _0x3e7a69;})['then'](respondWithFilteredResult(_0x53b31d,_0x4de7dc))[_0x1b16('0x43')](handleError(_0x53b31d,null));};exports[_0x1b16('0x44')]=function(_0x37be09,_0xd6a807){var _0x2c9b4f={'raw':!![],'where':{'id':_0x37be09[_0x1b16('0x45')]['id']}},_0xd7110e={};_0xd7110e[_0x1b16('0x2f')]=_['keys'](db[_0x1b16('0x2b')][_0x1b16('0x2c')]);_0xd7110e[_0x1b16('0x30')]=_[_0x1b16('0x31')](_0x37be09[_0x1b16('0x30')]);_0xd7110e['filters']=_[_0x1b16('0x33')](_0xd7110e[_0x1b16('0x2f')],_0xd7110e[_0x1b16('0x30')]);_0x2c9b4f[_0x1b16('0x34')]=_[_0x1b16('0x33')](_0xd7110e[_0x1b16('0x2f')],qs[_0x1b16('0x35')](_0x37be09[_0x1b16('0x30')][_0x1b16('0x35')]));_0x2c9b4f[_0x1b16('0x34')]=_0x2c9b4f[_0x1b16('0x34')][_0x1b16('0x36')]?_0x2c9b4f[_0x1b16('0x34')]:_0xd7110e[_0x1b16('0x2f')];if(_0x37be09[_0x1b16('0x30')][_0x1b16('0x41')]){_0x2c9b4f['include']=[{'all':!![]}];}_0x2c9b4f=_[_0x1b16('0x3e')]({},_0x2c9b4f,_0x37be09[_0x1b16('0x40')]);return db[_0x1b16('0x2b')][_0x1b16('0x46')](_0x2c9b4f)['then'](handleEntityNotFound(_0xd6a807,null))['then'](respondWithResult(_0xd6a807,null))[_0x1b16('0x43')](handleError(_0xd6a807,null));};exports[_0x1b16('0x47')]=function(_0x3deba6,_0x46cd48){return db[_0x1b16('0x2b')][_0x1b16('0x47')](_0x3deba6[_0x1b16('0x48')],{})[_0x1b16('0x25')](respondWithResult(_0x46cd48,0xc9))[_0x1b16('0x43')](handleError(_0x46cd48,null));};exports[_0x1b16('0x24')]=function(_0x912d01,_0x310c12){if(_0x912d01[_0x1b16('0x48')]['id']){delete _0x912d01['body']['id'];}return db[_0x1b16('0x2b')][_0x1b16('0x46')]({'where':{'id':_0x912d01[_0x1b16('0x45')]['id']}})[_0x1b16('0x25')](handleEntityNotFound(_0x310c12,null))[_0x1b16('0x25')](saveUpdates(_0x912d01[_0x1b16('0x48')],null))[_0x1b16('0x25')](respondWithResult(_0x310c12,null))[_0x1b16('0x43')](handleError(_0x310c12,null));};exports['destroy']=function(_0x2172c5,_0x4d2db0){return db['FreshsalesField']['find']({'where':{'id':_0x2172c5[_0x1b16('0x45')]['id']}})[_0x1b16('0x25')](handleEntityNotFound(_0x4d2db0,null))[_0x1b16('0x25')](removeEntity(_0x4d2db0,null))[_0x1b16('0x43')](handleError(_0x4d2db0,null));}; \ No newline at end of file +var _0x257f=['limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined'];(function(_0x376b6b,_0x1f5b49){var _0x5bb40d=function(_0x512e01){while(--_0x512e01){_0x376b6b['push'](_0x376b6b['shift']());}};_0x5bb40d(++_0x1f5b49);}(_0x257f,0x1f1));var _0xf257=function(_0x29e4a8,_0x4cbdca){_0x29e4a8=_0x29e4a8-0x0;var _0x35a5c8=_0x257f[_0x29e4a8];return _0x35a5c8;};'use strict';var emlformat=require(_0xf257('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf257('0x1'));var jsonpatch=require(_0xf257('0x2'));var rp=require('request-promise');var moment=require(_0xf257('0x3'));var BPromise=require(_0xf257('0x4'));var Mustache=require(_0xf257('0x5'));var util=require(_0xf257('0x6'));var path=require(_0xf257('0x7'));var sox=require('sox');var csv=require(_0xf257('0x8'));var ejs=require(_0xf257('0x9'));var fs=require('fs');var fs_extra=require(_0xf257('0xa'));var _=require(_0xf257('0xb'));var squel=require(_0xf257('0xc'));var crypto=require(_0xf257('0xd'));var jsforce=require(_0xf257('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf257('0xf'));var Redis=require(_0xf257('0x10'));var authService=require(_0xf257('0x11'));var qs=require(_0xf257('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf257('0x13'));var logger=require('../../config/logger')(_0xf257('0x14'));var utils=require(_0xf257('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf257('0x16'));var db=require(_0xf257('0x17'))['db'];function respondWithStatusCode(_0x3d0abb,_0x3ad374){_0x3ad374=_0x3ad374||0xcc;return function(_0x48b38f){if(_0x48b38f){return _0x3d0abb[_0xf257('0x18')](_0x3ad374);}return _0x3d0abb['status'](_0x3ad374)[_0xf257('0x19')]();};}function respondWithResult(_0x57266e,_0x650af9){_0x650af9=_0x650af9||0xc8;return function(_0x536e2a){if(_0x536e2a){return _0x57266e['status'](_0x650af9)[_0xf257('0x1a')](_0x536e2a);}};}function respondWithFilteredResult(_0x1caac2,_0x373773){return function(_0x183ccf){if(_0x183ccf){var _0x15011c=typeof _0x373773['offset']===_0xf257('0x1b')&&typeof _0x373773[_0xf257('0x1c')]===_0xf257('0x1b');var _0x3d5bb9=_0x183ccf[_0xf257('0x1d')];var _0x4bea60=_0x15011c?0x0:_0x373773[_0xf257('0x1e')];var _0x3714f9=_0x15011c?_0x183ccf[_0xf257('0x1d')]:_0x373773['offset']+_0x373773['limit'];var _0x550484;if(_0x3714f9>=_0x3d5bb9){_0x3714f9=_0x3d5bb9;_0x550484=0xc8;}else{_0x550484=0xce;}_0x1caac2['status'](_0x550484);return _0x1caac2[_0xf257('0x1f')](_0xf257('0x20'),_0x4bea60+'-'+_0x3714f9+'/'+_0x3d5bb9)[_0xf257('0x1a')](_0x183ccf);}return null;};}function patchUpdates(_0x3f82c3){return function(_0xf11d43){try{jsonpatch[_0xf257('0x21')](_0xf11d43,_0x3f82c3,!![]);}catch(_0x23286f){return BPromise[_0xf257('0x22')](_0x23286f);}return _0xf11d43[_0xf257('0x23')]();};}function saveUpdates(_0x2e202a,_0x4ceadd){return function(_0x762f6e){if(_0x762f6e){return _0x762f6e[_0xf257('0x24')](_0x2e202a)[_0xf257('0x25')](function(_0x2353b0){return _0x2353b0;});}return null;};}function removeEntity(_0x32f9d1,_0x889212){return function(_0x49db41){if(_0x49db41){return _0x49db41[_0xf257('0x26')]()[_0xf257('0x25')](function(){_0x32f9d1[_0xf257('0x27')](0xcc)[_0xf257('0x19')]();});}};}function handleEntityNotFound(_0x222c1b,_0x59c1a5){return function(_0x3e1436){if(!_0x3e1436){_0x222c1b[_0xf257('0x18')](0x194);}return _0x3e1436;};}function handleError(_0x515730,_0x431288){_0x431288=_0x431288||0x1f4;return function(_0x2cfd60){logger[_0xf257('0x28')](_0x2cfd60['stack']);if(_0x2cfd60['name']){delete _0x2cfd60[_0xf257('0x29')];}_0x515730['status'](_0x431288)[_0xf257('0x2a')](_0x2cfd60);};}exports[_0xf257('0x2b')]=function(_0x280b79,_0x47a3fc){var _0x3d64f9={},_0x94c418={},_0x1828a4={'count':0x0,'rows':[]};var _0x11ac0c=_[_0xf257('0x2c')](db['FreshsalesField']['rawAttributes'],function(_0x3777f4){return{'name':_0x3777f4[_0xf257('0x2d')],'type':_0x3777f4[_0xf257('0x2e')][_0xf257('0x2f')]};});_0x94c418[_0xf257('0x30')]=_[_0xf257('0x2c')](_0x11ac0c,_0xf257('0x29'));_0x94c418['query']=_[_0xf257('0x31')](_0x280b79[_0xf257('0x32')]);_0x94c418[_0xf257('0x33')]=_[_0xf257('0x34')](_0x94c418['model'],_0x94c418[_0xf257('0x32')]);_0x3d64f9[_0xf257('0x35')]=_['intersection'](_0x94c418['model'],qs['fields'](_0x280b79[_0xf257('0x32')][_0xf257('0x36')]));_0x3d64f9[_0xf257('0x35')]=_0x3d64f9[_0xf257('0x35')][_0xf257('0x37')]?_0x3d64f9[_0xf257('0x35')]:_0x94c418[_0xf257('0x30')];if(!_0x280b79['query'][_0xf257('0x38')](_0xf257('0x39'))){_0x3d64f9[_0xf257('0x1c')]=qs['limit'](_0x280b79[_0xf257('0x32')]['limit']);_0x3d64f9[_0xf257('0x1e')]=qs[_0xf257('0x1e')](_0x280b79[_0xf257('0x32')]['offset']);}_0x3d64f9[_0xf257('0x3a')]=qs[_0xf257('0x3b')](_0x280b79[_0xf257('0x32')][_0xf257('0x3b')]);_0x3d64f9[_0xf257('0x3c')]=qs[_0xf257('0x33')](_['pick'](_0x280b79[_0xf257('0x32')],_0x94c418[_0xf257('0x33')]),_0x11ac0c);if(_0x280b79[_0xf257('0x32')][_0xf257('0x3d')]){_0x3d64f9[_0xf257('0x3c')]=_[_0xf257('0x3e')](_0x3d64f9['where'],{'$or':_[_0xf257('0x2c')](_0x11ac0c,function(_0x44c073){if(_0x44c073['type']!==_0xf257('0x3f')){var _0x55e9df={};_0x55e9df[_0x44c073[_0xf257('0x29')]]={'$like':'%'+_0x280b79[_0xf257('0x32')][_0xf257('0x3d')]+'%'};return _0x55e9df;}})});}_0x3d64f9=_[_0xf257('0x3e')]({},_0x3d64f9,_0x280b79[_0xf257('0x40')]);var _0x1dc262={'where':_0x3d64f9[_0xf257('0x3c')]};return db[_0xf257('0x41')][_0xf257('0x1d')](_0x1dc262)[_0xf257('0x25')](function(_0x179f15){_0x1828a4['count']=_0x179f15;if(_0x280b79[_0xf257('0x32')][_0xf257('0x42')]){_0x3d64f9[_0xf257('0x43')]=[{'all':!![]}];}return db[_0xf257('0x41')][_0xf257('0x44')](_0x3d64f9);})[_0xf257('0x25')](function(_0x15cac3){_0x1828a4['rows']=_0x15cac3;return _0x1828a4;})[_0xf257('0x25')](respondWithFilteredResult(_0x47a3fc,_0x3d64f9))[_0xf257('0x45')](handleError(_0x47a3fc,null));};exports[_0xf257('0x46')]=function(_0x538f6e,_0x4086b7){var _0x1dcc79={'raw':!![],'where':{'id':_0x538f6e[_0xf257('0x47')]['id']}},_0x3ac6da={};_0x3ac6da[_0xf257('0x30')]=_[_0xf257('0x31')](db[_0xf257('0x41')]['rawAttributes']);_0x3ac6da['query']=_[_0xf257('0x31')](_0x538f6e[_0xf257('0x32')]);_0x3ac6da[_0xf257('0x33')]=_[_0xf257('0x34')](_0x3ac6da[_0xf257('0x30')],_0x3ac6da[_0xf257('0x32')]);_0x1dcc79[_0xf257('0x35')]=_[_0xf257('0x34')](_0x3ac6da['model'],qs[_0xf257('0x36')](_0x538f6e[_0xf257('0x32')][_0xf257('0x36')]));_0x1dcc79[_0xf257('0x35')]=_0x1dcc79[_0xf257('0x35')][_0xf257('0x37')]?_0x1dcc79['attributes']:_0x3ac6da['model'];if(_0x538f6e[_0xf257('0x32')][_0xf257('0x42')]){_0x1dcc79['include']=[{'all':!![]}];}_0x1dcc79=_[_0xf257('0x3e')]({},_0x1dcc79,_0x538f6e['options']);return db[_0xf257('0x41')][_0xf257('0x48')](_0x1dcc79)[_0xf257('0x25')](handleEntityNotFound(_0x4086b7,null))[_0xf257('0x25')](respondWithResult(_0x4086b7,null))['catch'](handleError(_0x4086b7,null));};exports[_0xf257('0x49')]=function(_0x2de7d6,_0x3666ee){return db['FreshsalesField'][_0xf257('0x49')](_0x2de7d6[_0xf257('0x4a')],{})['then'](respondWithResult(_0x3666ee,0xc9))[_0xf257('0x45')](handleError(_0x3666ee,null));};exports[_0xf257('0x24')]=function(_0x4d558f,_0x388679){if(_0x4d558f['body']['id']){delete _0x4d558f[_0xf257('0x4a')]['id'];}return db['FreshsalesField'][_0xf257('0x48')]({'where':{'id':_0x4d558f[_0xf257('0x47')]['id']}})[_0xf257('0x25')](handleEntityNotFound(_0x388679,null))['then'](saveUpdates(_0x4d558f[_0xf257('0x4a')],null))[_0xf257('0x25')](respondWithResult(_0x388679,null))['catch'](handleError(_0x388679,null));};exports['destroy']=function(_0x558b37,_0x264a77){return db[_0xf257('0x41')][_0xf257('0x48')]({'where':{'id':_0x558b37[_0xf257('0x47')]['id']}})[_0xf257('0x25')](handleEntityNotFound(_0x264a77,null))[_0xf257('0x25')](removeEntity(_0x264a77,null))['catch'](handleError(_0x264a77,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 505c3f7..5f429d6 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 _0x8768=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x39a1d7,_0x4d037f){var _0x4742e2=function(_0x4cb920){while(--_0x4cb920){_0x39a1d7['push'](_0x39a1d7['shift']());}};_0x4742e2(++_0x4d037f);}(_0x8768,0xa1));var _0x8876=function(_0x47c445,_0x242543){_0x47c445=_0x47c445-0x0;var _0x1b9c0c=_0x8768[_0x47c445];return _0x1b9c0c;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var logger=require(_0x8876('0x2'))(_0x8876('0x3'));var moment=require(_0x8876('0x4'));var BPromise=require(_0x8876('0x5'));var rp=require(_0x8876('0x6'));var fs=require('fs');var path=require(_0x8876('0x7'));var rimraf=require(_0x8876('0x8'));var config=require(_0x8876('0x9'));var attributes=require(_0x8876('0xa'));module[_0x8876('0xb')]=function(_0x159d68,_0x5431cb){return _0x159d68[_0x8876('0xc')](_0x8876('0xd'),attributes,{'tableName':_0x8876('0xe'),'paranoid':![],'indexes':[{'name':_0x8876('0xf'),'fields':[_0x8876('0x10'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4123=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x3c70db,_0x89e4b3){var _0x47f199=function(_0x13ccb9){while(--_0x13ccb9){_0x3c70db['push'](_0x3c70db['shift']());}};_0x47f199(++_0x89e4b3);}(_0x4123,0x87));var _0x3412=function(_0x9a2f5,_0x6095ba){_0x9a2f5=_0x9a2f5-0x0;var _0x1b9757=_0x4123[_0x9a2f5];return _0x1b9757;};'use strict';var _=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var logger=require(_0x3412('0x2'))(_0x3412('0x3'));var moment=require(_0x3412('0x4'));var BPromise=require(_0x3412('0x5'));var rp=require(_0x3412('0x6'));var fs=require('fs');var path=require(_0x3412('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3412('0x8'));module[_0x3412('0x9')]=function(_0x48eb88,_0x11aa67){return _0x48eb88[_0x3412('0xa')](_0x3412('0xb'),attributes,{'tableName':_0x3412('0xc'),'paranoid':![],'indexes':[{'name':_0x3412('0xd'),'fields':[_0x3412('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 4829f37..f7799ee 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2ae15f,_0x3e1860){var _0x42a3d3=function(_0xcd0e60){while(--_0xcd0e60){_0x2ae15f['push'](_0x2ae15f['shift']());}};_0x42a3d3(++_0x3e1860);}(_0x5fab,0x177));var _0xb5fa=function(_0x2fb0e5,_0x45e57a){_0x2fb0e5=_0x2fb0e5-0x0;var _0x584d1f=_0x5fab[_0x2fb0e5];return _0x584d1f;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a865d,_0x10c071){var _0x1b8411=function(_0x2b18cf){while(--_0x2b18cf){_0x3a865d['push'](_0x3a865d['shift']());}};_0x1b8411(++_0x10c071);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 515fa51..f19a5a7 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(_0x42c14c,_0x48e53b){var _0xf25b1=function(_0x934f3d){while(--_0x934f3d){_0x42c14c['push'](_0x42c14c['shift']());}};_0xf25b1(++_0x48e53b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0xefd6a8,_0x1d91b9){var _0xa18ee9=function(_0x58a933){while(--_0x58a933){_0xefd6a8['push'](_0xefd6a8['shift']());}};_0xa18ee9(++_0x1d91b9);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index d4ea960..9423d9b 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 _0xc43c=['newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x41ab5c,_0x14800f){var _0xab348=function(_0x46ea20){while(--_0x46ea20){_0x41ab5c['push'](_0x41ab5c['shift']());}};_0xab348(++_0x14800f);}(_0xc43c,0xd4));var _0xcc43=function(_0x67706c,_0x4c445b){_0x67706c=_0x67706c-0x0;var _0x55c682=_0xc43c[_0x67706c];return _0x55c682;};'use strict';var Sequelize=require(_0xcc43('0x0'));module[_0xcc43('0x1')]={'name':{'type':Sequelize[_0xcc43('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xcc43('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xcc43('0x2')]},'serverUrl':{'type':Sequelize[_0xcc43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc43('0x3')]('integrationTab',_0xcc43('0x4')),'defaultValue':_0xcc43('0x5')}}; \ No newline at end of file +var _0x0c19=['sequelize','exports','STRING','username','ENUM','newTab','integrationTab'];(function(_0x4d427a,_0x24c23f){var _0x380dec=function(_0x6477be){while(--_0x6477be){_0x4d427a['push'](_0x4d427a['shift']());}};_0x380dec(++_0x24c23f);}(_0x0c19,0xf5));var _0x90c1=function(_0x2fa256,_0x12487e){_0x2fa256=_0x2fa256-0x0;var _0x408d14=_0x0c19[_0x2fa256];return _0x408d14;};'use strict';var Sequelize=require(_0x90c1('0x0'));module[_0x90c1('0x1')]={'name':{'type':Sequelize[_0x90c1('0x2')]},'description':{'type':Sequelize[_0x90c1('0x2')]},'username':{'type':Sequelize[_0x90c1('0x2')],'unique':_0x90c1('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x90c1('0x2')]},'clientId':{'type':Sequelize[_0x90c1('0x2')]},'clientSecret':{'type':Sequelize[_0x90c1('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x90c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x90c1('0x4')]('integrationTab',_0x90c1('0x5')),'defaultValue':_0x90c1('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d7eae34..f5eff3a 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 _0x1b09=['params','find','create','body','findOne','SalesforceConfiguration','filter','options','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','SalesforceField','Descriptions','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','password','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','False','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','model','keys','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','map','VIRTUAL','includeAll','include','rows','catch','show'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x1b09,0x1ad));var _0x91b0=function(_0x3baaf2,_0x894e3d){_0x3baaf2=_0x3baaf2-0x0;var _0x50e8b0=_0x1b09[_0x3baaf2];return _0x50e8b0;};'use strict';var emlformat=require(_0x91b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91b0('0x1'));var jsonpatch=require(_0x91b0('0x2'));var rp=require('request-promise');var moment=require(_0x91b0('0x3'));var BPromise=require(_0x91b0('0x4'));var Mustache=require(_0x91b0('0x5'));var util=require(_0x91b0('0x6'));var path=require(_0x91b0('0x7'));var sox=require(_0x91b0('0x8'));var csv=require(_0x91b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91b0('0xa'));var _=require(_0x91b0('0xb'));var squel=require(_0x91b0('0xc'));var crypto=require(_0x91b0('0xd'));var jsforce=require(_0x91b0('0xe'));var deskjs=require(_0x91b0('0xf'));var toCsv=require(_0x91b0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91b0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x91b0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91b0('0x12'));var logger=require(_0x91b0('0x13'))(_0x91b0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x91b0('0x15'));var db=require(_0x91b0('0x16'))['db'];var integrations=require(_0x91b0('0x17'));function respondWithStatusCode(_0x111de4,_0x44fe46){_0x44fe46=_0x44fe46||0xcc;return function(_0x458fdb){if(_0x458fdb){return _0x111de4[_0x91b0('0x18')](_0x44fe46);}return _0x111de4['status'](_0x44fe46)[_0x91b0('0x19')]();};}function respondWithResult(_0x626403,_0x17638e){_0x17638e=_0x17638e||0xc8;return function(_0x29f3ca){if(_0x29f3ca){return _0x626403[_0x91b0('0x1a')](_0x17638e)[_0x91b0('0x1b')](_0x29f3ca);}};}function respondWithFilteredResult(_0x1913f9,_0x17e2f9){return function(_0x727bee){if(_0x727bee){var _0x3c8872=typeof _0x17e2f9[_0x91b0('0x1c')]===_0x91b0('0x1d')&&typeof _0x17e2f9[_0x91b0('0x1e')]==='undefined';var _0x4b0053=_0x727bee[_0x91b0('0x1f')];var _0x257efa=_0x3c8872?0x0:_0x17e2f9[_0x91b0('0x1c')];var _0x2d6321=_0x3c8872?_0x727bee['count']:_0x17e2f9['offset']+_0x17e2f9['limit'];var _0x3f0d3;if(_0x2d6321>=_0x4b0053){_0x2d6321=_0x4b0053;_0x3f0d3=0xc8;}else{_0x3f0d3=0xce;}_0x1913f9['status'](_0x3f0d3);return _0x1913f9[_0x91b0('0x20')](_0x91b0('0x21'),_0x257efa+'-'+_0x2d6321+'/'+_0x4b0053)['json'](_0x727bee);}return null;};}function patchUpdates(_0x1fe095){return function(_0x395218){try{jsonpatch[_0x91b0('0x22')](_0x395218,_0x1fe095,!![]);}catch(_0x289226){return BPromise[_0x91b0('0x23')](_0x289226);}return _0x395218[_0x91b0('0x24')]();};}function saveUpdates(_0x3fb6a3,_0xe50975){return function(_0x4f5a84){if(_0x4f5a84){return _0x4f5a84[_0x91b0('0x25')](_0x3fb6a3)[_0x91b0('0x26')](function(_0x230345){return _0x230345;});}return null;};}function removeEntity(_0x33bd45,_0x5d54d7){return function(_0x45f35e){if(_0x45f35e){return _0x45f35e[_0x91b0('0x27')]()[_0x91b0('0x26')](function(){_0x33bd45[_0x91b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ffa56,_0x37a707){return function(_0x4f4bb8){if(!_0x4f4bb8){_0x2ffa56['sendStatus'](0x194);}return _0x4f4bb8;};}function handleError(_0x740403,_0x294c72){_0x294c72=_0x294c72||0x1f4;return function(_0x2d0f8e){logger[_0x91b0('0x28')](_0x2d0f8e[_0x91b0('0x29')]);if(_0x2d0f8e[_0x91b0('0x2a')]){delete _0x2d0f8e['name'];}_0x740403['status'](_0x294c72)[_0x91b0('0x2b')](_0x2d0f8e);};}exports[_0x91b0('0x2c')]=function(_0x595d59,_0x21472f){var _0xfad93={},_0x433b3e={},_0x595556={'count':0x0,'rows':[]};var _0x4e5a68=_['map'](db[_0x91b0('0x2d')][_0x91b0('0x2e')],function(_0x2b5f5d){return{'name':_0x2b5f5d[_0x91b0('0x2f')],'type':_0x2b5f5d[_0x91b0('0x30')]['key']};});_0x433b3e[_0x91b0('0x31')]=_['map'](_0x4e5a68,_0x91b0('0x2a'));_0x433b3e['query']=_[_0x91b0('0x32')](_0x595d59['query']);_0x433b3e['filters']=_['intersection'](_0x433b3e[_0x91b0('0x31')],_0x433b3e['query']);_0xfad93['attributes']=_[_0x91b0('0x33')](_0x433b3e['model'],qs[_0x91b0('0x34')](_0x595d59[_0x91b0('0x35')][_0x91b0('0x34')]));_0xfad93[_0x91b0('0x36')]=_0xfad93[_0x91b0('0x36')][_0x91b0('0x37')]?_0xfad93[_0x91b0('0x36')]:_0x433b3e[_0x91b0('0x31')];if(!_0x595d59[_0x91b0('0x35')][_0x91b0('0x38')](_0x91b0('0x39'))){_0xfad93[_0x91b0('0x1e')]=qs[_0x91b0('0x1e')](_0x595d59[_0x91b0('0x35')][_0x91b0('0x1e')]);_0xfad93[_0x91b0('0x1c')]=qs['offset'](_0x595d59[_0x91b0('0x35')][_0x91b0('0x1c')]);}_0xfad93[_0x91b0('0x3a')]=qs[_0x91b0('0x3b')](_0x595d59[_0x91b0('0x35')][_0x91b0('0x3b')]);_0xfad93['where']=qs[_0x91b0('0x3c')](_[_0x91b0('0x3d')](_0x595d59[_0x91b0('0x35')],_0x433b3e[_0x91b0('0x3c')]),_0x4e5a68);if(_0x595d59['query']['filter']){_0xfad93[_0x91b0('0x3e')]=_[_0x91b0('0x3f')](_0xfad93[_0x91b0('0x3e')],{'$or':_[_0x91b0('0x40')](_0x4e5a68,function(_0x2f482f){if(_0x2f482f['type']!==_0x91b0('0x41')){var _0x3d405a={};_0x3d405a[_0x2f482f[_0x91b0('0x2a')]]={'$like':'%'+_0x595d59['query']['filter']+'%'};return _0x3d405a;}})});}_0xfad93=_[_0x91b0('0x3f')]({},_0xfad93,_0x595d59['options']);var _0x375519={'where':_0xfad93[_0x91b0('0x3e')]};return db[_0x91b0('0x2d')]['count'](_0x375519)['then'](function(_0x47b02b){_0x595556[_0x91b0('0x1f')]=_0x47b02b;if(_0x595d59[_0x91b0('0x35')][_0x91b0('0x42')]){_0xfad93[_0x91b0('0x43')]=[{'all':!![]}];}return db[_0x91b0('0x2d')]['findAll'](_0xfad93);})[_0x91b0('0x26')](function(_0x440d13){_0x595556[_0x91b0('0x44')]=_0x440d13;return _0x595556;})[_0x91b0('0x26')](respondWithFilteredResult(_0x21472f,_0xfad93))[_0x91b0('0x45')](handleError(_0x21472f,null));};exports[_0x91b0('0x46')]=function(_0x1b6194,_0x389675){var _0x1373c5={'raw':![],'where':{'id':_0x1b6194[_0x91b0('0x47')]['id']}},_0x3e6965={};_0x3e6965[_0x91b0('0x31')]=_[_0x91b0('0x32')](db['SalesforceAccount'][_0x91b0('0x2e')]);_0x3e6965['query']=_[_0x91b0('0x32')](_0x1b6194[_0x91b0('0x35')]);_0x3e6965[_0x91b0('0x3c')]=_[_0x91b0('0x33')](_0x3e6965[_0x91b0('0x31')],_0x3e6965[_0x91b0('0x35')]);_0x1373c5[_0x91b0('0x36')]=_[_0x91b0('0x33')](_0x3e6965[_0x91b0('0x31')],qs['fields'](_0x1b6194[_0x91b0('0x35')][_0x91b0('0x34')]));_0x1373c5[_0x91b0('0x36')]=_0x1373c5[_0x91b0('0x36')][_0x91b0('0x37')]?_0x1373c5[_0x91b0('0x36')]:_0x3e6965['model'];if(_0x1b6194['query'][_0x91b0('0x42')]){_0x1373c5['include']=[{'all':!![]}];}_0x1373c5=_[_0x91b0('0x3f')]({},_0x1373c5,_0x1b6194['options']);return db[_0x91b0('0x2d')][_0x91b0('0x48')](_0x1373c5)[_0x91b0('0x26')](handleEntityNotFound(_0x389675,null))['then'](respondWithResult(_0x389675,null))['catch'](handleError(_0x389675,null));};exports['create']=function(_0x39beb1,_0xfd1abc){return db[_0x91b0('0x2d')][_0x91b0('0x49')](_0x39beb1[_0x91b0('0x4a')],{})[_0x91b0('0x26')](respondWithResult(_0xfd1abc,0xc9))['catch'](handleError(_0xfd1abc,null));};exports[_0x91b0('0x25')]=function(_0x41ba01,_0x44acaa){if(_0x41ba01[_0x91b0('0x4a')]['id']){delete _0x41ba01[_0x91b0('0x4a')]['id'];}return db[_0x91b0('0x2d')][_0x91b0('0x48')]({'where':{'id':_0x41ba01[_0x91b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x44acaa,null))[_0x91b0('0x26')](saveUpdates(_0x41ba01[_0x91b0('0x4a')],null))[_0x91b0('0x26')](respondWithResult(_0x44acaa,null))[_0x91b0('0x45')](handleError(_0x44acaa,null));};exports['destroy']=function(_0x3635e9,_0x149831){return db[_0x91b0('0x2d')][_0x91b0('0x48')]({'where':{'id':_0x3635e9[_0x91b0('0x47')]['id']}})[_0x91b0('0x26')](handleEntityNotFound(_0x149831,null))[_0x91b0('0x26')](removeEntity(_0x149831,null))[_0x91b0('0x45')](handleError(_0x149831,null));};exports['getConfigurations']=function(_0x46b1a7,_0x44fa04,_0x3f7072){var _0x218882={};var _0x41af89={};var _0x426145;var _0x2a658f;return db[_0x91b0('0x2d')][_0x91b0('0x4b')]({'where':{'id':_0x46b1a7[_0x91b0('0x47')]['id']}})[_0x91b0('0x26')](handleEntityNotFound(_0x44fa04,null))[_0x91b0('0x26')](function(_0x1b6432){if(_0x1b6432){_0x426145=_0x1b6432;_0x41af89['model']=_[_0x91b0('0x32')](db[_0x91b0('0x4c')][_0x91b0('0x2e')]);_0x41af89[_0x91b0('0x35')]=_[_0x91b0('0x32')](_0x46b1a7['query']);_0x41af89[_0x91b0('0x3c')]=_['intersection'](_0x41af89[_0x91b0('0x31')],_0x41af89[_0x91b0('0x35')]);_0x218882['attributes']=_['intersection'](_0x41af89[_0x91b0('0x31')],qs[_0x91b0('0x34')](_0x46b1a7[_0x91b0('0x35')][_0x91b0('0x34')]));_0x218882[_0x91b0('0x36')]=_0x218882[_0x91b0('0x36')][_0x91b0('0x37')]?_0x218882[_0x91b0('0x36')]:_0x41af89[_0x91b0('0x31')];_0x218882[_0x91b0('0x3a')]=qs[_0x91b0('0x3b')](_0x46b1a7[_0x91b0('0x35')][_0x91b0('0x3b')]);_0x218882[_0x91b0('0x3e')]=qs[_0x91b0('0x3c')](_['pick'](_0x46b1a7[_0x91b0('0x35')],_0x41af89[_0x91b0('0x3c')]));if(_0x46b1a7[_0x91b0('0x35')][_0x91b0('0x4d')]){_0x218882[_0x91b0('0x3e')]=_[_0x91b0('0x3f')](_0x218882['where'],{'$or':_[_0x91b0('0x40')](_0x218882['attributes'],function(_0x228824){var _0x56689f={};_0x56689f[_0x228824]={'$like':'%'+_0x46b1a7[_0x91b0('0x35')][_0x91b0('0x4d')]+'%'};return _0x56689f;})});}_0x218882=_[_0x91b0('0x3f')]({},_0x218882,_0x46b1a7[_0x91b0('0x4e')]);return _0x426145[_0x91b0('0x4f')](_0x218882);}})[_0x91b0('0x26')](function(_0x4f4e1e){if(_0x4f4e1e){_0x2a658f=_0x4f4e1e[_0x91b0('0x37')];if(!_0x46b1a7[_0x91b0('0x35')]['hasOwnProperty'](_0x91b0('0x39'))){_0x218882['limit']=qs[_0x91b0('0x1e')](_0x46b1a7[_0x91b0('0x35')]['limit']);_0x218882[_0x91b0('0x1c')]=qs['offset'](_0x46b1a7[_0x91b0('0x35')][_0x91b0('0x1c')]);}return _0x426145['getConfigurations'](_0x218882);}})['then'](function(_0x53d8a0){if(_0x53d8a0){return _0x53d8a0?{'count':_0x2a658f,'rows':_0x53d8a0}:null;}})['then'](respondWithResult(_0x44fa04,null))['catch'](handleError(_0x44fa04,null));};exports[_0x91b0('0x50')]=function(_0x742838,_0xbfc656,_0x51c6b8){if(_0x742838[_0x91b0('0x4a')]['id']){delete _0x742838['body']['id'];}return db[_0x91b0('0x2d')]['findOne']({'where':{'id':_0x742838['params']['id']}})[_0x91b0('0x26')](handleEntityNotFound(_0xbfc656,null))['then'](function(_0x49c086){if(_0x49c086){_0x742838[_0x91b0('0x4a')][_0x91b0('0x51')]=_0x49c086['id'];_0x742838[_0x91b0('0x4a')]['Subjects']=integrations[_0x91b0('0x52')](_0x742838['body'][_0x91b0('0x53')],_0x742838[_0x91b0('0x4a')][_0x91b0('0x30')]);_0x742838[_0x91b0('0x4a')]['Descriptions']=integrations[_0x91b0('0x54')](_0x742838[_0x91b0('0x4a')][_0x91b0('0x53')],_0x742838['body']['type']);return db['SalesforceConfiguration'][_0x91b0('0x49')](_0x742838[_0x91b0('0x4a')],{'include':[{'model':db['SalesforceField'],'as':_0x91b0('0x55')},{'model':db[_0x91b0('0x56')],'as':_0x91b0('0x57')}]});}return null;})['then'](respondWithResult(_0xbfc656,null))['catch'](handleError(_0xbfc656,null));};exports[_0x91b0('0x58')]=function(_0x53b291,_0x25c7a9,_0x5a5fdc){var _0x2a1499;var _0x5b6f62='';var _0x23d5ed=_0x91b0('0x59');return db[_0x91b0('0x2d')][_0x91b0('0x4b')]({'where':{'id':_0x53b291['params']['id']},'attributes':['id',_0x91b0('0x5a'),'clientId',_0x91b0('0x5b'),_0x91b0('0x5c'),'password',_0x91b0('0x5d')]})[_0x91b0('0x26')](handleEntityNotFound(_0x25c7a9,null))[_0x91b0('0x26')](function(_0xa04076){if(_0xa04076){_0x5b6f62=_0xa04076['remoteUri'];var _0x39237d=_0x5b6f62[_0x91b0('0x5e')](-0x1);if(_0x39237d==='/'){_0x5b6f62=_0x5b6f62[_0x91b0('0x5f')](0x0,_0x5b6f62[_0x91b0('0x60')](_0x39237d));}_0x2a1499=new jsforce[(_0x91b0('0x61'))]({'oauth2':{'loginUrl':_0x5b6f62,'clientId':_0xa04076[_0x91b0('0x62')],'clientSecret':_0xa04076[_0x91b0('0x5b')]}});return _0x2a1499[_0x91b0('0x63')](_0xa04076['username'],_0xa04076[_0x91b0('0x64')]['concat'](_0xa04076[_0x91b0('0x5d')]));}})['then'](function(_0xf07814){if(_0xf07814){if(!_['isNil'](_0x53b291['query'][_0x91b0('0x65')])){_0x23d5ed=_0x53b291[_0x91b0('0x35')][_0x91b0('0x65')];}return _0x2a1499['sobject'](_0x23d5ed)[_0x91b0('0x66')]();}})['then'](function(_0x487a){var _0x442a3c=[_0x91b0('0x67'),_0x91b0('0x68'),'IsReminderSet',_0x91b0('0x69'),_0x91b0('0x6a'),_0x91b0('0x6b')];var _0x36d798=['string',_0x91b0('0x6c'),'picklist',_0x91b0('0x6d'),_0x91b0('0x6e'),_0x91b0('0x6f'),_0x91b0('0x70')];if(_0x487a){_[_0x91b0('0x71')](_0x487a[_0x91b0('0x34')],function(_0x234d34){return _0x442a3c['includes'](_0x234d34[_0x91b0('0x2a')])||!_0x36d798[_0x91b0('0x72')](_0x234d34[_0x91b0('0x30')]);});return{'count':_0x487a[_0x91b0('0x34')][_0x91b0('0x37')],'rows':_[_0x91b0('0x40')](_0x487a[_0x91b0('0x34')],function(_0xf4039b){return{'id':_0xf4039b[_0x91b0('0x2a')],'name':_0xf4039b[_0x91b0('0x73')],'custom':_0xf4039b[_0x91b0('0x74')],'options':_0xf4039b[_0x91b0('0x75')][_0x91b0('0x37')]>0x0?_['map'](_0xf4039b['picklistValues'],function(_0x44b777){return{'name':_0x44b777[_0x91b0('0x73')],'value':_0x44b777[_0x91b0('0x76')]};}):_0xf4039b[_0x91b0('0x30')]==_0x91b0('0x6d')?[{'name':'True','value':'true'},{'name':_0x91b0('0x77'),'value':'false'}]:[]};})};}})[_0x91b0('0x26')](respondWithResult(_0x25c7a9,null))['catch'](function(_0x26dae8){var _0x3a0ebf=_0x53b291[_0x91b0('0x35')]['test']?0x1f4:_0x26dae8['statusCode']||0x1f4;logger['error'](_0x91b0('0x78'),'getFields',_0x3a0ebf,JSON[_0x91b0('0x79')](_0x26dae8));delete _0x26dae8[_0x91b0('0x2a')];if(_0x3a0ebf===0x191){_0x3a0ebf=0x190;}_0x25c7a9[_0x91b0('0x1a')](_0x3a0ebf)[_0x91b0('0x2b')](_0x53b291['query'][_0x91b0('0x7a')]?{'message':_0x91b0('0x7b'),'statusCode':_0x26dae8[_0x91b0('0x7c')]}:_0x26dae8);});}; \ No newline at end of file +var _0x255d=['params','merge','create','body','find','getConfigurations','pick','hasOwnProperty','findOne','AccountId','Descriptions','getDescriptions','channel','SalesforceField','Subjects','getFields','Task','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientId','clientSecret','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','textarea','phone','includes','label','picklistValues','value','True','true','False','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','apply','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','show'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x255d,0xae));var _0xd255=function(_0x5caa69,_0x2bb84a){_0x5caa69=_0x5caa69-0x0;var _0x4d95c6=_0x255d[_0x5caa69];return _0x4d95c6;};'use strict';var emlformat=require(_0xd255('0x0'));var rimraf=require(_0xd255('0x1'));var zipdir=require(_0xd255('0x2'));var jsonpatch=require(_0xd255('0x3'));var rp=require(_0xd255('0x4'));var moment=require('moment');var BPromise=require(_0xd255('0x5'));var Mustache=require('mustache');var util=require(_0xd255('0x6'));var path=require(_0xd255('0x7'));var sox=require('sox');var csv=require(_0xd255('0x8'));var ejs=require(_0xd255('0x9'));var fs=require('fs');var fs_extra=require(_0xd255('0xa'));var _=require('lodash');var squel=require(_0xd255('0xb'));var crypto=require(_0xd255('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd255('0xd'));var toCsv=require(_0xd255('0x8'));var querystring=require(_0xd255('0xe'));var Papa=require(_0xd255('0xf'));var Redis=require(_0xd255('0x10'));var authService=require(_0xd255('0x11'));var qs=require(_0xd255('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd255('0x13'))(_0xd255('0x14'));var utils=require(_0xd255('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd255('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd255('0x17'));function respondWithStatusCode(_0x346b19,_0x34c6d9){_0x34c6d9=_0x34c6d9||0xcc;return function(_0x244724){if(_0x244724){return _0x346b19[_0xd255('0x18')](_0x34c6d9);}return _0x346b19[_0xd255('0x19')](_0x34c6d9)[_0xd255('0x1a')]();};}function respondWithResult(_0xb66d84,_0x21683b){_0x21683b=_0x21683b||0xc8;return function(_0x4d97c0){if(_0x4d97c0){return _0xb66d84[_0xd255('0x19')](_0x21683b)[_0xd255('0x1b')](_0x4d97c0);}};}function respondWithFilteredResult(_0x12958e,_0x5b0c55){return function(_0x124efb){if(_0x124efb){var _0x6218fe=typeof _0x5b0c55[_0xd255('0x1c')]===_0xd255('0x1d')&&typeof _0x5b0c55[_0xd255('0x1e')]===_0xd255('0x1d');var _0x18daaa=_0x124efb['count'];var _0x4ab3eb=_0x6218fe?0x0:_0x5b0c55[_0xd255('0x1c')];var _0x257864=_0x6218fe?_0x124efb['count']:_0x5b0c55[_0xd255('0x1c')]+_0x5b0c55[_0xd255('0x1e')];var _0x463a12;if(_0x257864>=_0x18daaa){_0x257864=_0x18daaa;_0x463a12=0xc8;}else{_0x463a12=0xce;}_0x12958e['status'](_0x463a12);return _0x12958e[_0xd255('0x1f')]('Content-Range',_0x4ab3eb+'-'+_0x257864+'/'+_0x18daaa)[_0xd255('0x1b')](_0x124efb);}return null;};}function patchUpdates(_0x53e11d){return function(_0x3aff12){try{jsonpatch[_0xd255('0x20')](_0x3aff12,_0x53e11d,!![]);}catch(_0x269363){return BPromise['reject'](_0x269363);}return _0x3aff12['save']();};}function saveUpdates(_0x1bb37b,_0x433c2a){return function(_0xb5889e){if(_0xb5889e){return _0xb5889e[_0xd255('0x21')](_0x1bb37b)[_0xd255('0x22')](function(_0x173828){return _0x173828;});}return null;};}function removeEntity(_0x4abdb9,_0x540281){return function(_0x3a514c){if(_0x3a514c){return _0x3a514c[_0xd255('0x23')]()['then'](function(){_0x4abdb9[_0xd255('0x19')](0xcc)[_0xd255('0x1a')]();});}};}function handleEntityNotFound(_0x3df1f3,_0xd81a0b){return function(_0x31dce8){if(!_0x31dce8){_0x3df1f3[_0xd255('0x18')](0x194);}return _0x31dce8;};}function handleError(_0x5ed3d5,_0x5d57f9){_0x5d57f9=_0x5d57f9||0x1f4;return function(_0x5617da){logger[_0xd255('0x24')](_0x5617da[_0xd255('0x25')]);if(_0x5617da[_0xd255('0x26')]){delete _0x5617da[_0xd255('0x26')];}_0x5ed3d5[_0xd255('0x19')](_0x5d57f9)[_0xd255('0x27')](_0x5617da);};}exports[_0xd255('0x28')]=function(_0x16ae35,_0x1056c1){var _0x214210={},_0x13672a={},_0x20805e={'count':0x0,'rows':[]};var _0x103d24=_[_0xd255('0x29')](db[_0xd255('0x2a')][_0xd255('0x2b')],function(_0x524006){return{'name':_0x524006[_0xd255('0x2c')],'type':_0x524006[_0xd255('0x2d')][_0xd255('0x2e')]};});_0x13672a['model']=_[_0xd255('0x29')](_0x103d24,_0xd255('0x26'));_0x13672a[_0xd255('0x2f')]=_[_0xd255('0x30')](_0x16ae35['query']);_0x13672a['filters']=_['intersection'](_0x13672a['model'],_0x13672a['query']);_0x214210[_0xd255('0x31')]=_[_0xd255('0x32')](_0x13672a[_0xd255('0x33')],qs['fields'](_0x16ae35[_0xd255('0x2f')][_0xd255('0x34')]));_0x214210[_0xd255('0x31')]=_0x214210[_0xd255('0x31')][_0xd255('0x35')]?_0x214210[_0xd255('0x31')]:_0x13672a[_0xd255('0x33')];if(!_0x16ae35[_0xd255('0x2f')]['hasOwnProperty'](_0xd255('0x36'))){_0x214210[_0xd255('0x1e')]=qs[_0xd255('0x1e')](_0x16ae35[_0xd255('0x2f')][_0xd255('0x1e')]);_0x214210[_0xd255('0x1c')]=qs[_0xd255('0x1c')](_0x16ae35[_0xd255('0x2f')][_0xd255('0x1c')]);}_0x214210[_0xd255('0x37')]=qs[_0xd255('0x38')](_0x16ae35['query']['sort']);_0x214210[_0xd255('0x39')]=qs[_0xd255('0x3a')](_['pick'](_0x16ae35[_0xd255('0x2f')],_0x13672a[_0xd255('0x3a')]),_0x103d24);if(_0x16ae35[_0xd255('0x2f')][_0xd255('0x3b')]){_0x214210[_0xd255('0x39')]=_['merge'](_0x214210[_0xd255('0x39')],{'$or':_[_0xd255('0x29')](_0x103d24,function(_0x4be9fd){if(_0x4be9fd['type']!==_0xd255('0x3c')){var _0x1f3de8={};_0x1f3de8[_0x4be9fd[_0xd255('0x26')]]={'$like':'%'+_0x16ae35[_0xd255('0x2f')][_0xd255('0x3b')]+'%'};return _0x1f3de8;}})});}_0x214210=_['merge']({},_0x214210,_0x16ae35['options']);var _0x3190b9={'where':_0x214210[_0xd255('0x39')]};return db[_0xd255('0x2a')][_0xd255('0x3d')](_0x3190b9)[_0xd255('0x22')](function(_0x1bc772){_0x20805e[_0xd255('0x3d')]=_0x1bc772;if(_0x16ae35[_0xd255('0x2f')][_0xd255('0x3e')]){_0x214210[_0xd255('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xd255('0x40')](_0x214210);})[_0xd255('0x22')](function(_0x53a073){_0x20805e[_0xd255('0x41')]=_0x53a073;return _0x20805e;})[_0xd255('0x22')](respondWithFilteredResult(_0x1056c1,_0x214210))[_0xd255('0x42')](handleError(_0x1056c1,null));};exports[_0xd255('0x43')]=function(_0x33ead2,_0x4adaab){var _0x50337e={'raw':![],'where':{'id':_0x33ead2[_0xd255('0x44')]['id']}},_0x29ba9d={};_0x29ba9d[_0xd255('0x33')]=_[_0xd255('0x30')](db[_0xd255('0x2a')][_0xd255('0x2b')]);_0x29ba9d[_0xd255('0x2f')]=_[_0xd255('0x30')](_0x33ead2[_0xd255('0x2f')]);_0x29ba9d[_0xd255('0x3a')]=_[_0xd255('0x32')](_0x29ba9d['model'],_0x29ba9d[_0xd255('0x2f')]);_0x50337e['attributes']=_['intersection'](_0x29ba9d[_0xd255('0x33')],qs[_0xd255('0x34')](_0x33ead2[_0xd255('0x2f')]['fields']));_0x50337e[_0xd255('0x31')]=_0x50337e['attributes']['length']?_0x50337e['attributes']:_0x29ba9d[_0xd255('0x33')];if(_0x33ead2[_0xd255('0x2f')][_0xd255('0x3e')]){_0x50337e['include']=[{'all':!![]}];}_0x50337e=_[_0xd255('0x45')]({},_0x50337e,_0x33ead2['options']);return db[_0xd255('0x2a')]['find'](_0x50337e)[_0xd255('0x22')](handleEntityNotFound(_0x4adaab,null))[_0xd255('0x22')](respondWithResult(_0x4adaab,null))['catch'](handleError(_0x4adaab,null));};exports[_0xd255('0x46')]=function(_0x18be02,_0x55572d){return db[_0xd255('0x2a')][_0xd255('0x46')](_0x18be02[_0xd255('0x47')],{})[_0xd255('0x22')](respondWithResult(_0x55572d,0xc9))[_0xd255('0x42')](handleError(_0x55572d,null));};exports[_0xd255('0x21')]=function(_0x3279b,_0x3de2db){if(_0x3279b[_0xd255('0x47')]['id']){delete _0x3279b[_0xd255('0x47')]['id'];}return db['SalesforceAccount'][_0xd255('0x48')]({'where':{'id':_0x3279b['params']['id']}})[_0xd255('0x22')](handleEntityNotFound(_0x3de2db,null))['then'](saveUpdates(_0x3279b[_0xd255('0x47')],null))[_0xd255('0x22')](respondWithResult(_0x3de2db,null))[_0xd255('0x42')](handleError(_0x3de2db,null));};exports[_0xd255('0x23')]=function(_0x3e913f,_0x2b9b1){return db['SalesforceAccount'][_0xd255('0x48')]({'where':{'id':_0x3e913f[_0xd255('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b9b1,null))['then'](removeEntity(_0x2b9b1,null))[_0xd255('0x42')](handleError(_0x2b9b1,null));};exports[_0xd255('0x49')]=function(_0x5d9e9f,_0x24ec8f,_0x45bff0){var _0x40c92d={};var _0x11e5dc={};var _0x370411;var _0x5af212;return db['SalesforceAccount']['findOne']({'where':{'id':_0x5d9e9f[_0xd255('0x44')]['id']}})[_0xd255('0x22')](handleEntityNotFound(_0x24ec8f,null))['then'](function(_0x50f7c8){if(_0x50f7c8){_0x370411=_0x50f7c8;_0x11e5dc[_0xd255('0x33')]=_[_0xd255('0x30')](db['SalesforceConfiguration'][_0xd255('0x2b')]);_0x11e5dc[_0xd255('0x2f')]=_['keys'](_0x5d9e9f['query']);_0x11e5dc['filters']=_[_0xd255('0x32')](_0x11e5dc[_0xd255('0x33')],_0x11e5dc[_0xd255('0x2f')]);_0x40c92d[_0xd255('0x31')]=_['intersection'](_0x11e5dc['model'],qs[_0xd255('0x34')](_0x5d9e9f[_0xd255('0x2f')][_0xd255('0x34')]));_0x40c92d[_0xd255('0x31')]=_0x40c92d[_0xd255('0x31')]['length']?_0x40c92d[_0xd255('0x31')]:_0x11e5dc[_0xd255('0x33')];_0x40c92d[_0xd255('0x37')]=qs[_0xd255('0x38')](_0x5d9e9f['query'][_0xd255('0x38')]);_0x40c92d[_0xd255('0x39')]=qs[_0xd255('0x3a')](_[_0xd255('0x4a')](_0x5d9e9f['query'],_0x11e5dc[_0xd255('0x3a')]));if(_0x5d9e9f[_0xd255('0x2f')][_0xd255('0x3b')]){_0x40c92d[_0xd255('0x39')]=_[_0xd255('0x45')](_0x40c92d[_0xd255('0x39')],{'$or':_[_0xd255('0x29')](_0x40c92d[_0xd255('0x31')],function(_0x5a8415){var _0x3f42be={};_0x3f42be[_0x5a8415]={'$like':'%'+_0x5d9e9f[_0xd255('0x2f')][_0xd255('0x3b')]+'%'};return _0x3f42be;})});}_0x40c92d=_['merge']({},_0x40c92d,_0x5d9e9f['options']);return _0x370411[_0xd255('0x49')](_0x40c92d);}})[_0xd255('0x22')](function(_0x219efc){if(_0x219efc){_0x5af212=_0x219efc[_0xd255('0x35')];if(!_0x5d9e9f[_0xd255('0x2f')][_0xd255('0x4b')](_0xd255('0x36'))){_0x40c92d['limit']=qs[_0xd255('0x1e')](_0x5d9e9f[_0xd255('0x2f')]['limit']);_0x40c92d['offset']=qs[_0xd255('0x1c')](_0x5d9e9f[_0xd255('0x2f')][_0xd255('0x1c')]);}return _0x370411[_0xd255('0x49')](_0x40c92d);}})[_0xd255('0x22')](function(_0x47bd79){if(_0x47bd79){return _0x47bd79?{'count':_0x5af212,'rows':_0x47bd79}:null;}})['then'](respondWithResult(_0x24ec8f,null))[_0xd255('0x42')](handleError(_0x24ec8f,null));};exports['addConfiguration']=function(_0x2be685,_0x3edbc9,_0x294981){if(_0x2be685['body']['id']){delete _0x2be685[_0xd255('0x47')]['id'];}return db[_0xd255('0x2a')][_0xd255('0x4c')]({'where':{'id':_0x2be685[_0xd255('0x44')]['id']}})[_0xd255('0x22')](handleEntityNotFound(_0x3edbc9,null))[_0xd255('0x22')](function(_0x212b16){if(_0x212b16){_0x2be685[_0xd255('0x47')][_0xd255('0x4d')]=_0x212b16['id'];_0x2be685[_0xd255('0x47')]['Subjects']=integrations['getSubjects'](_0x2be685['body']['channel'],_0x2be685[_0xd255('0x47')]['type']);_0x2be685[_0xd255('0x47')][_0xd255('0x4e')]=integrations[_0xd255('0x4f')](_0x2be685[_0xd255('0x47')][_0xd255('0x50')],_0x2be685[_0xd255('0x47')]['type']);return db['SalesforceConfiguration'][_0xd255('0x46')](_0x2be685[_0xd255('0x47')],{'include':[{'model':db[_0xd255('0x51')],'as':_0xd255('0x52')},{'model':db[_0xd255('0x51')],'as':_0xd255('0x4e')}]});}return null;})[_0xd255('0x22')](respondWithResult(_0x3edbc9,null))[_0xd255('0x42')](handleError(_0x3edbc9,null));};exports[_0xd255('0x53')]=function(_0x5e6c6d,_0xa8c191,_0x4eb70b){var _0x2cab79;var _0x4dcc39='';var _0x404993=_0xd255('0x54');return db['SalesforceAccount'][_0xd255('0x4c')]({'where':{'id':_0x5e6c6d[_0xd255('0x44')]['id']},'attributes':['id','remoteUri','clientId','clientSecret',_0xd255('0x55'),_0xd255('0x56'),_0xd255('0x57')]})[_0xd255('0x22')](handleEntityNotFound(_0xa8c191,null))['then'](function(_0x20eada){if(_0x20eada){_0x4dcc39=_0x20eada[_0xd255('0x58')];var _0x2e5609=_0x4dcc39[_0xd255('0x59')](-0x1);if(_0x2e5609==='/'){_0x4dcc39=_0x4dcc39[_0xd255('0x5a')](0x0,_0x4dcc39[_0xd255('0x5b')](_0x2e5609));}_0x2cab79=new jsforce[(_0xd255('0x5c'))]({'oauth2':{'loginUrl':_0x4dcc39,'clientId':_0x20eada[_0xd255('0x5d')],'clientSecret':_0x20eada[_0xd255('0x5e')]}});return _0x2cab79['login'](_0x20eada[_0xd255('0x55')],_0x20eada[_0xd255('0x56')][_0xd255('0x5f')](_0x20eada[_0xd255('0x57')]));}})[_0xd255('0x22')](function(_0x3f7e80){if(_0x3f7e80){if(!_[_0xd255('0x60')](_0x5e6c6d[_0xd255('0x2f')]['ticketType'])){_0x404993=_0x5e6c6d[_0xd255('0x2f')][_0xd255('0x61')];}return _0x2cab79[_0xd255('0x62')](_0x404993)[_0xd255('0x63')]();}})[_0xd255('0x22')](function(_0x4a6b8e){var _0xa1032c=['OwnerId',_0xd255('0x64'),_0xd255('0x65'),_0xd255('0x66'),_0xd255('0x67'),_0xd255('0x68')];var _0x197e20=[_0xd255('0x69'),'int',_0xd255('0x6a'),_0xd255('0x6b'),'email',_0xd255('0x6c'),_0xd255('0x6d')];if(_0x4a6b8e){_['remove'](_0x4a6b8e['fields'],function(_0x34b724){return _0xa1032c[_0xd255('0x6e')](_0x34b724[_0xd255('0x26')])||!_0x197e20[_0xd255('0x6e')](_0x34b724[_0xd255('0x2d')]);});return{'count':_0x4a6b8e[_0xd255('0x34')][_0xd255('0x35')],'rows':_[_0xd255('0x29')](_0x4a6b8e[_0xd255('0x34')],function(_0x516505){return{'id':_0x516505[_0xd255('0x26')],'name':_0x516505[_0xd255('0x6f')],'custom':_0x516505['custom'],'options':_0x516505[_0xd255('0x70')]['length']>0x0?_[_0xd255('0x29')](_0x516505[_0xd255('0x70')],function(_0x5bf296){return{'name':_0x5bf296['label'],'value':_0x5bf296[_0xd255('0x71')]};}):_0x516505[_0xd255('0x2d')]==_0xd255('0x6b')?[{'name':_0xd255('0x72'),'value':_0xd255('0x73')},{'name':_0xd255('0x74'),'value':'false'}]:[]};})};}})[_0xd255('0x22')](respondWithResult(_0xa8c191,null))[_0xd255('0x42')](function(_0x55fcbe){var _0x40af29=_0x5e6c6d['query'][_0xd255('0x75')]?0x1f4:_0x55fcbe[_0xd255('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd255('0x53'),_0x40af29,JSON[_0xd255('0x77')](_0x55fcbe));delete _0x55fcbe[_0xd255('0x26')];if(_0x40af29===0x191){_0x40af29=0x190;}_0xa8c191[_0xd255('0x19')](_0x40af29)[_0xd255('0x27')](_0x5e6c6d[_0xd255('0x2f')][_0xd255('0x75')]?{'message':_0xd255('0x78'),'statusCode':_0x55fcbe[_0xd255('0x76')]}:_0x55fcbe);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5e725a5..a951899 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 _0x4e8e=['define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3a7520,_0x1f192a){var _0x5b337d=function(_0x573c75){while(--_0x573c75){_0x3a7520['push'](_0x3a7520['shift']());}};_0x5b337d(++_0x1f192a);}(_0x4e8e,0xf3));var _0xe4e8=function(_0x3e943a,_0x30e25c){_0x3e943a=_0x3e943a-0x0;var _0x2575e1=_0x4e8e[_0x3e943a];return _0x2575e1;};'use strict';var _=require('lodash');var util=require(_0xe4e8('0x0'));var logger=require(_0xe4e8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe4e8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4e8('0x3'));var rimraf=require(_0xe4e8('0x4'));var config=require(_0xe4e8('0x5'));var attributes=require(_0xe4e8('0x6'));var integrations=require(_0xe4e8('0x7'));module[_0xe4e8('0x8')]=function(_0xe39b24,_0x291eac){return _0xe39b24[_0xe4e8('0x9')](_0xe4e8('0xa'),attributes,{'tableName':_0xe4e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc2=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x55ed9c,_0x312431){var _0x43c649=function(_0x27441e){while(--_0x27441e){_0x55ed9c['push'](_0x55ed9c['shift']());}};_0x43c649(++_0x312431);}(_0x0fc2,0x6e));var _0x20fc=function(_0x55e2f8,_0x48de9e){_0x55e2f8=_0x55e2f8-0x0;var _0x7b9312=_0x0fc2[_0x55e2f8];return _0x7b9312;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var logger=require(_0x20fc('0x2'))(_0x20fc('0x3'));var moment=require('moment');var BPromise=require(_0x20fc('0x4'));var rp=require(_0x20fc('0x5'));var fs=require('fs');var path=require(_0x20fc('0x6'));var rimraf=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var attributes=require(_0x20fc('0x9'));var integrations=require(_0x20fc('0xa'));module[_0x20fc('0xb')]=function(_0x10f6ad,_0xc556e8){return _0x10f6ad[_0x20fc('0xc')](_0x20fc('0xd'),attributes,{'tableName':_0x20fc('0xe'),'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 5a0fb3a..7128c33 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 _0xc163=['http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','options','raw','where','limit','map','include','attributes','model','catch','ShowSalesforceAccount','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b8e65,_0x45935f){var _0x6f593c=function(_0x2d3c25){while(--_0x2d3c25){_0x2b8e65['push'](_0x2b8e65['shift']());}};_0x6f593c(++_0x45935f);}(_0xc163,0xa1));var _0x3c16=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc163[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3c16('0x0'));var util=require(_0x3c16('0x1'));var moment=require(_0x3c16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c16('0x3'))['db'];var utils=require(_0x3c16('0x4'));var logger=require('../../config/logger')(_0x3c16('0x5'));var config=require(_0x3c16('0x6'));var jayson=require(_0x3c16('0x7'));var client=jayson[_0x3c16('0x8')][_0x3c16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33a18e,_0x3d8511,_0x405339){return new BPromise(function(_0x300350,_0x3b4cf8){return client[_0x3c16('0xa')](_0x33a18e,_0x405339)[_0x3c16('0xb')](function(_0x5ea503){logger[_0x3c16('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x3d8511,_0x3c16('0xd'));logger[_0x3c16('0xe')](_0x3c16('0xf'),_0x3d8511,'request\x20sent',JSON[_0x3c16('0x10')](_0x5ea503));if(_0x5ea503['error']){if(_0x5ea503[_0x3c16('0x11')][_0x3c16('0x12')]===0x1f4){logger[_0x3c16('0x11')](_0x3c16('0x13'),_0x3d8511,_0x5ea503['error'][_0x3c16('0x14')]);return _0x3b4cf8(_0x5ea503['error'][_0x3c16('0x14')]);}logger[_0x3c16('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3d8511,_0x5ea503['error'][_0x3c16('0x14')]);return _0x300350(_0x5ea503[_0x3c16('0x11')][_0x3c16('0x14')]);}else{logger[_0x3c16('0xc')](_0x3c16('0x13'),_0x3d8511,_0x3c16('0xd'));_0x300350(_0x5ea503[_0x3c16('0x15')][_0x3c16('0x14')]);}})['catch'](function(_0x420c42){logger[_0x3c16('0x11')](_0x3c16('0x13'),_0x3d8511,_0x420c42);_0x3b4cf8(_0x420c42);});});}exports[_0x3c16('0x16')]=function(_0x5f4af0){var _0x1f3c95=this;return new Promise(function(_0x336d65,_0x606f4d){return db[_0x3c16('0x17')]['findAll']({'raw':_0x5f4af0[_0x3c16('0x18')]?_0x5f4af0[_0x3c16('0x18')][_0x3c16('0x19')]===undefined?!![]:![]:!![],'where':_0x5f4af0[_0x3c16('0x18')]?_0x5f4af0[_0x3c16('0x18')][_0x3c16('0x1a')]||null:null,'attributes':_0x5f4af0['options']?_0x5f4af0[_0x3c16('0x18')]['attributes']||null:null,'limit':_0x5f4af0[_0x3c16('0x18')]?_0x5f4af0['options'][_0x3c16('0x1b')]||null:null,'include':_0x5f4af0['options']?_0x5f4af0[_0x3c16('0x18')]['include']?_[_0x3c16('0x1c')](_0x5f4af0['options'][_0x3c16('0x1d')],function(_0x5cb01a){return{'model':db[_0x5cb01a['model']],'as':_0x5cb01a['as'],'attributes':_0x5cb01a[_0x3c16('0x1e')],'include':_0x5cb01a[_0x3c16('0x1d')]?_['map'](_0x5cb01a[_0x3c16('0x1d')],function(_0x3edd48){return{'model':db[_0x3edd48[_0x3c16('0x1f')]],'as':_0x3edd48['as'],'attributes':_0x3edd48[_0x3c16('0x1e')],'include':_0x3edd48[_0x3c16('0x1d')]?_[_0x3c16('0x1c')](_0x3edd48[_0x3c16('0x1d')],function(_0x4bd6ce){return{'model':db[_0x4bd6ce[_0x3c16('0x1f')]],'as':_0x4bd6ce['as'],'attributes':_0x4bd6ce[_0x3c16('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c16('0xb')](function(_0x395d5f){logger[_0x3c16('0xc')](_0x3c16('0x16'),_0x5f4af0);logger[_0x3c16('0xe')](_0x3c16('0x16'),_0x5f4af0,JSON[_0x3c16('0x10')](_0x395d5f));_0x336d65(_0x395d5f);})[_0x3c16('0x20')](function(_0xe4b62a){logger[_0x3c16('0x11')](_0x3c16('0x16'),_0xe4b62a[_0x3c16('0x14')],_0x5f4af0);_0x606f4d(_0x1f3c95[_0x3c16('0x11')](0x1f4,_0xe4b62a[_0x3c16('0x14')]));});});};exports[_0x3c16('0x21')]=function(_0x5bcef0){var _0x422140=this;return new Promise(function(_0x39e49a,_0x4e48b4){return db[_0x3c16('0x17')]['find']({'raw':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0['options'][_0x3c16('0x19')]===undefined?!![]:![]:!![],'where':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0['options'][_0x3c16('0x1a')]||null:null,'attributes':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0['options'][_0x3c16('0x1e')]||null:null,'include':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0[_0x3c16('0x18')][_0x3c16('0x1d')]?_[_0x3c16('0x1c')](_0x5bcef0['options'][_0x3c16('0x1d')],function(_0x5b4131){return{'model':db[_0x5b4131['model']],'as':_0x5b4131['as'],'attributes':_0x5b4131[_0x3c16('0x1e')],'include':_0x5b4131[_0x3c16('0x1d')]?_['map'](_0x5b4131['include'],function(_0x3ce599){return{'model':db[_0x3ce599[_0x3c16('0x1f')]],'as':_0x3ce599['as'],'attributes':_0x3ce599[_0x3c16('0x1e')],'include':_0x3ce599['include']?_[_0x3c16('0x1c')](_0x3ce599[_0x3c16('0x1d')],function(_0x440050){return{'model':db[_0x440050[_0x3c16('0x1f')]],'as':_0x440050['as'],'attributes':_0x440050[_0x3c16('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c16('0xb')](function(_0x2f049f){logger[_0x3c16('0xc')]('ShowSalesforceAccount',_0x5bcef0);logger[_0x3c16('0xe')](_0x3c16('0x21'),_0x5bcef0,JSON[_0x3c16('0x10')](_0x2f049f));_0x39e49a(_0x2f049f);})[_0x3c16('0x20')](function(_0x3dbdac){logger[_0x3c16('0x11')](_0x3c16('0x21'),_0x3dbdac[_0x3c16('0x14')],_0x5bcef0);_0x4e48b4(_0x422140['error'](0x1f4,_0x3dbdac[_0x3c16('0x14')]));});});}; \ No newline at end of file +var _0xff20=['SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetSalesforceAccount','ShowSalesforceAccount','find','catch','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','debug','stringify','SalesforceAccount,\x20%s,\x20%s','error','message','result'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xff20,0x87));var _0x0ff2=function(_0x4dc700,_0x10191b){_0x4dc700=_0x4dc700-0x0;var _0x484b91=_0xff20[_0x4dc700];return _0x484b91;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0ff2('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ff2('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ff2('0x2'));var logger=require(_0x0ff2('0x3'))(_0x0ff2('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0ff2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x241a07,_0x372c42,_0x4700b0){return new BPromise(function(_0x3af208,_0x3ecf25){return client[_0x0ff2('0x6')](_0x241a07,_0x4700b0)['then'](function(_0x45487f){logger[_0x0ff2('0x7')]('SalesforceAccount,\x20%s,\x20%s',_0x372c42,_0x0ff2('0x8'));logger[_0x0ff2('0x9')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x372c42,_0x0ff2('0x8'),JSON[_0x0ff2('0xa')](_0x45487f));if(_0x45487f['error']){if(_0x45487f['error']['code']===0x1f4){logger['error'](_0x0ff2('0xb'),_0x372c42,_0x45487f[_0x0ff2('0xc')][_0x0ff2('0xd')]);return _0x3ecf25(_0x45487f['error'][_0x0ff2('0xd')]);}logger['error'](_0x0ff2('0xb'),_0x372c42,_0x45487f[_0x0ff2('0xc')][_0x0ff2('0xd')]);return _0x3af208(_0x45487f[_0x0ff2('0xc')][_0x0ff2('0xd')]);}else{logger[_0x0ff2('0x7')]('SalesforceAccount,\x20%s,\x20%s',_0x372c42,_0x0ff2('0x8'));_0x3af208(_0x45487f[_0x0ff2('0xe')][_0x0ff2('0xd')]);}})['catch'](function(_0x259256){logger[_0x0ff2('0xc')](_0x0ff2('0xb'),_0x372c42,_0x259256);_0x3ecf25(_0x259256);});});}exports['GetSalesforceAccount']=function(_0x4cab52){var _0x334668=this;return new Promise(function(_0x187225,_0x2192fe){return db[_0x0ff2('0xf')][_0x0ff2('0x10')]({'raw':_0x4cab52[_0x0ff2('0x11')]?_0x4cab52[_0x0ff2('0x11')][_0x0ff2('0x12')]===undefined?!![]:![]:!![],'where':_0x4cab52[_0x0ff2('0x11')]?_0x4cab52[_0x0ff2('0x11')][_0x0ff2('0x13')]||null:null,'attributes':_0x4cab52[_0x0ff2('0x11')]?_0x4cab52[_0x0ff2('0x11')][_0x0ff2('0x14')]||null:null,'limit':_0x4cab52[_0x0ff2('0x11')]?_0x4cab52[_0x0ff2('0x11')][_0x0ff2('0x15')]||null:null,'include':_0x4cab52[_0x0ff2('0x11')]?_0x4cab52[_0x0ff2('0x11')]['include']?_[_0x0ff2('0x16')](_0x4cab52[_0x0ff2('0x11')][_0x0ff2('0x17')],function(_0x39a1be){return{'model':db[_0x39a1be[_0x0ff2('0x18')]],'as':_0x39a1be['as'],'attributes':_0x39a1be[_0x0ff2('0x14')],'include':_0x39a1be[_0x0ff2('0x17')]?_['map'](_0x39a1be[_0x0ff2('0x17')],function(_0x525535){return{'model':db[_0x525535[_0x0ff2('0x18')]],'as':_0x525535['as'],'attributes':_0x525535[_0x0ff2('0x14')],'include':_0x525535[_0x0ff2('0x17')]?_[_0x0ff2('0x16')](_0x525535[_0x0ff2('0x17')],function(_0x1f36c8){return{'model':db[_0x1f36c8[_0x0ff2('0x18')]],'as':_0x1f36c8['as'],'attributes':_0x1f36c8[_0x0ff2('0x14')]};}):[]};}):[]};}):[]:[]})[_0x0ff2('0x19')](function(_0x591966){logger['info'](_0x0ff2('0x1a'),_0x4cab52);logger['debug'](_0x0ff2('0x1a'),_0x4cab52,JSON[_0x0ff2('0xa')](_0x591966));_0x187225(_0x591966);})['catch'](function(_0x2189db){logger['error']('GetSalesforceAccount',_0x2189db[_0x0ff2('0xd')],_0x4cab52);_0x2192fe(_0x334668[_0x0ff2('0xc')](0x1f4,_0x2189db['message']));});});};exports[_0x0ff2('0x1b')]=function(_0x1b601a){var _0x1f4333=this;return new Promise(function(_0x4dfb93,_0xa9db40){return db[_0x0ff2('0xf')][_0x0ff2('0x1c')]({'raw':_0x1b601a['options']?_0x1b601a[_0x0ff2('0x11')][_0x0ff2('0x12')]===undefined?!![]:![]:!![],'where':_0x1b601a[_0x0ff2('0x11')]?_0x1b601a[_0x0ff2('0x11')][_0x0ff2('0x13')]||null:null,'attributes':_0x1b601a[_0x0ff2('0x11')]?_0x1b601a[_0x0ff2('0x11')][_0x0ff2('0x14')]||null:null,'include':_0x1b601a[_0x0ff2('0x11')]?_0x1b601a[_0x0ff2('0x11')]['include']?_[_0x0ff2('0x16')](_0x1b601a[_0x0ff2('0x11')]['include'],function(_0x5deeb1){return{'model':db[_0x5deeb1['model']],'as':_0x5deeb1['as'],'attributes':_0x5deeb1[_0x0ff2('0x14')],'include':_0x5deeb1['include']?_[_0x0ff2('0x16')](_0x5deeb1['include'],function(_0x5f513e){return{'model':db[_0x5f513e[_0x0ff2('0x18')]],'as':_0x5f513e['as'],'attributes':_0x5f513e['attributes'],'include':_0x5f513e[_0x0ff2('0x17')]?_[_0x0ff2('0x16')](_0x5f513e[_0x0ff2('0x17')],function(_0x5813d7){return{'model':db[_0x5813d7[_0x0ff2('0x18')]],'as':_0x5813d7['as'],'attributes':_0x5813d7[_0x0ff2('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42c86e){logger[_0x0ff2('0x7')]('ShowSalesforceAccount',_0x1b601a);logger[_0x0ff2('0x9')](_0x0ff2('0x1b'),_0x1b601a,JSON[_0x0ff2('0xa')](_0x42c86e));_0x4dfb93(_0x42c86e);})[_0x0ff2('0x1d')](function(_0x24746a){logger['error']('ShowSalesforceAccount',_0x24746a['message'],_0x1b601a);_0xa9db40(_0x1f4333[_0x0ff2('0xc')](0x1f4,_0x24746a[_0x0ff2('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index e857553..855a476 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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x91439b,_0x4beb1b){_0x91439b=_0x91439b-0x0;var _0x589f36=_0x2032[_0x91439b];return _0x589f36;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x186c81,_0x11d97d){var _0x43f7b3=function(_0x3f9a2b){while(--_0x3f9a2b){_0x186c81['push'](_0x186c81['shift']());}};_0x43f7b3(++_0x11d97d);}(_0x7a54,0x106));var _0x47a5=function(_0x3e7647,_0x24f809){_0x3e7647=_0x3e7647-0x0;var _0x5e02ca=_0x7a54[_0x3e7647];return _0x5e02ca;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5b97b2e..569409e 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 _0x09f2=['exports','STRING','ENUM','Task','Case','lead','account_contact_lead','contact_lead','nothing','sequelize'];(function(_0x1c9cfa,_0xa01a69){var _0x137d24=function(_0x20b32c){while(--_0x20b32c){_0x1c9cfa['push'](_0x1c9cfa['shift']());}};_0x137d24(++_0xa01a69);}(_0x09f2,0x1d5));var _0x209f=function(_0x20dffa,_0x382342){_0x20dffa=_0x20dffa-0x0;var _0x2a76d1=_0x09f2[_0x20dffa];return _0x2a76d1;};'use strict';var Sequelize=require(_0x209f('0x0'));module[_0x209f('0x1')]={'name':{'type':Sequelize[_0x209f('0x2')]},'description':{'type':Sequelize[_0x209f('0x2')]},'ticketType':{'type':Sequelize[_0x209f('0x3')](_0x209f('0x4'),_0x209f('0x5')),'defaultValue':_0x209f('0x4')},'moduleSearch':{'type':Sequelize[_0x209f('0x3')]('contact_lead','contact',_0x209f('0x6'),_0x209f('0x7'),'account'),'defaultValue':_0x209f('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x209f('0x9'),'contact',_0x209f('0x6'),'account'),'defaultValue':_0x209f('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x209f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x209f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x209f('0x2')]}}; \ No newline at end of file +var _0x699c=['Case','contact_lead','contact','lead','account_contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Task'];(function(_0x1bc62c,_0x4d8bd9){var _0x3275a2=function(_0x785c73){while(--_0x785c73){_0x1bc62c['push'](_0x1bc62c['shift']());}};_0x3275a2(++_0x4d8bd9);}(_0x699c,0x127));var _0xc699=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x699c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc699('0x0'));module[_0xc699('0x1')]={'name':{'type':Sequelize[_0xc699('0x2')]},'description':{'type':Sequelize[_0xc699('0x2')]},'ticketType':{'type':Sequelize[_0xc699('0x3')](_0xc699('0x4'),_0xc699('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xc699('0x3')](_0xc699('0x6'),_0xc699('0x7'),_0xc699('0x8'),_0xc699('0x9'),'account'),'defaultValue':_0xc699('0x6')},'moduleCreate':{'type':Sequelize[_0xc699('0x3')](_0xc699('0xa'),'contact',_0xc699('0x8'),_0xc699('0xb')),'defaultValue':_0xc699('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xc699('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc699('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d221dcf..876ea1d 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 _0xe436=['where','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','keys','include','create','body','find','getFields','hasOwnProperty','getSubjects','findOne','SalesforceField','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick'];(function(_0x4d212e,_0x4b9aa5){var _0x2abf4f=function(_0xc94088){while(--_0xc94088){_0x4d212e['push'](_0x4d212e['shift']());}};_0x2abf4f(++_0x4b9aa5);}(_0xe436,0x1af));var _0x6e43=function(_0x44eb86,_0x58d8ce){_0x44eb86=_0x44eb86-0x0;var _0x46515f=_0xe436[_0x44eb86];return _0x46515f;};'use strict';var emlformat=require(_0x6e43('0x0'));var rimraf=require(_0x6e43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6e43('0x2'));var moment=require(_0x6e43('0x3'));var BPromise=require(_0x6e43('0x4'));var Mustache=require(_0x6e43('0x5'));var util=require('util');var path=require(_0x6e43('0x6'));var sox=require(_0x6e43('0x7'));var csv=require(_0x6e43('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e43('0x9'));var squel=require(_0x6e43('0xa'));var crypto=require(_0x6e43('0xb'));var jsforce=require(_0x6e43('0xc'));var deskjs=require(_0x6e43('0xd'));var toCsv=require(_0x6e43('0x8'));var querystring=require(_0x6e43('0xe'));var Papa=require('papaparse');var Redis=require(_0x6e43('0xf'));var authService=require(_0x6e43('0x10'));var qs=require(_0x6e43('0x11'));var as=require(_0x6e43('0x12'));var hardwareService=require(_0x6e43('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6e43('0x14'));var licenseUtil=require(_0x6e43('0x15'));var db=require(_0x6e43('0x16'))['db'];function respondWithStatusCode(_0x47d370,_0x40f1ce){_0x40f1ce=_0x40f1ce||0xcc;return function(_0x3f713a){if(_0x3f713a){return _0x47d370[_0x6e43('0x17')](_0x40f1ce);}return _0x47d370[_0x6e43('0x18')](_0x40f1ce)[_0x6e43('0x19')]();};}function respondWithResult(_0x4cf60b,_0x54e828){_0x54e828=_0x54e828||0xc8;return function(_0x458ced){if(_0x458ced){return _0x4cf60b[_0x6e43('0x18')](_0x54e828)[_0x6e43('0x1a')](_0x458ced);}};}function respondWithFilteredResult(_0x475664,_0x5303e7){return function(_0x441acb){if(_0x441acb){var _0x364dd8=typeof _0x5303e7['offset']===_0x6e43('0x1b')&&typeof _0x5303e7['limit']===_0x6e43('0x1b');var _0x5d2f64=_0x441acb[_0x6e43('0x1c')];var _0xd4ee48=_0x364dd8?0x0:_0x5303e7[_0x6e43('0x1d')];var _0xa9280a=_0x364dd8?_0x441acb[_0x6e43('0x1c')]:_0x5303e7['offset']+_0x5303e7[_0x6e43('0x1e')];var _0x268787;if(_0xa9280a>=_0x5d2f64){_0xa9280a=_0x5d2f64;_0x268787=0xc8;}else{_0x268787=0xce;}_0x475664[_0x6e43('0x18')](_0x268787);return _0x475664[_0x6e43('0x1f')](_0x6e43('0x20'),_0xd4ee48+'-'+_0xa9280a+'/'+_0x5d2f64)[_0x6e43('0x1a')](_0x441acb);}return null;};}function patchUpdates(_0xb0e29b){return function(_0x49953d){try{jsonpatch[_0x6e43('0x21')](_0x49953d,_0xb0e29b,!![]);}catch(_0xd5a9e6){return BPromise[_0x6e43('0x22')](_0xd5a9e6);}return _0x49953d[_0x6e43('0x23')]();};}function saveUpdates(_0x3835c4,_0x518119){return function(_0x448402){if(_0x448402){return _0x448402[_0x6e43('0x24')](_0x3835c4)['then'](function(_0x3d7a75){return _0x3d7a75;});}return null;};}function removeEntity(_0x1d631c,_0x438dc3){return function(_0x1e2237){if(_0x1e2237){return _0x1e2237[_0x6e43('0x25')]()[_0x6e43('0x26')](function(){_0x1d631c[_0x6e43('0x18')](0xcc)[_0x6e43('0x19')]();});}};}function handleEntityNotFound(_0x22c451,_0x13a9c1){return function(_0x50d855){if(!_0x50d855){_0x22c451[_0x6e43('0x17')](0x194);}return _0x50d855;};}function handleError(_0x46ca93,_0xf9ded4){_0xf9ded4=_0xf9ded4||0x1f4;return function(_0x46e11f){logger[_0x6e43('0x27')](_0x46e11f[_0x6e43('0x28')]);if(_0x46e11f[_0x6e43('0x29')]){delete _0x46e11f['name'];}_0x46ca93[_0x6e43('0x18')](_0xf9ded4)[_0x6e43('0x2a')](_0x46e11f);};}exports[_0x6e43('0x2b')]=function(_0x5b3198,_0x2fd983){var _0x455a1f={},_0x4d72be={},_0x377db9={'count':0x0,'rows':[]};var _0x4eed76=_[_0x6e43('0x2c')](db[_0x6e43('0x2d')][_0x6e43('0x2e')],function(_0x40b889){return{'name':_0x40b889[_0x6e43('0x2f')],'type':_0x40b889[_0x6e43('0x30')][_0x6e43('0x31')]};});_0x4d72be[_0x6e43('0x32')]=_[_0x6e43('0x2c')](_0x4eed76,_0x6e43('0x29'));_0x4d72be['query']=_['keys'](_0x5b3198['query']);_0x4d72be[_0x6e43('0x33')]=_[_0x6e43('0x34')](_0x4d72be['model'],_0x4d72be[_0x6e43('0x35')]);_0x455a1f[_0x6e43('0x36')]=_[_0x6e43('0x34')](_0x4d72be['model'],qs['fields'](_0x5b3198[_0x6e43('0x35')][_0x6e43('0x37')]));_0x455a1f[_0x6e43('0x36')]=_0x455a1f[_0x6e43('0x36')][_0x6e43('0x38')]?_0x455a1f[_0x6e43('0x36')]:_0x4d72be[_0x6e43('0x32')];if(!_0x5b3198[_0x6e43('0x35')]['hasOwnProperty'](_0x6e43('0x39'))){_0x455a1f[_0x6e43('0x1e')]=qs[_0x6e43('0x1e')](_0x5b3198[_0x6e43('0x35')][_0x6e43('0x1e')]);_0x455a1f[_0x6e43('0x1d')]=qs[_0x6e43('0x1d')](_0x5b3198[_0x6e43('0x35')][_0x6e43('0x1d')]);}_0x455a1f[_0x6e43('0x3a')]=qs[_0x6e43('0x3b')](_0x5b3198[_0x6e43('0x35')]['sort']);_0x455a1f['where']=qs[_0x6e43('0x33')](_[_0x6e43('0x3c')](_0x5b3198[_0x6e43('0x35')],_0x4d72be[_0x6e43('0x33')]),_0x4eed76);if(_0x5b3198[_0x6e43('0x35')]['filter']){_0x455a1f[_0x6e43('0x3d')]=_['merge'](_0x455a1f[_0x6e43('0x3d')],{'$or':_[_0x6e43('0x2c')](_0x4eed76,function(_0x10d0a1){if(_0x10d0a1[_0x6e43('0x30')]!==_0x6e43('0x3e')){var _0x164c52={};_0x164c52[_0x10d0a1[_0x6e43('0x29')]]={'$like':'%'+_0x5b3198['query'][_0x6e43('0x3f')]+'%'};return _0x164c52;}})});}_0x455a1f=_[_0x6e43('0x40')]({},_0x455a1f,_0x5b3198[_0x6e43('0x41')]);var _0x5589f7={'where':_0x455a1f['where']};return db[_0x6e43('0x2d')]['count'](_0x5589f7)['then'](function(_0x3d02a0){_0x377db9['count']=_0x3d02a0;if(_0x5b3198[_0x6e43('0x35')][_0x6e43('0x42')]){_0x455a1f['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x455a1f);})[_0x6e43('0x26')](function(_0x5cff16){_0x377db9[_0x6e43('0x43')]=_0x5cff16;return _0x377db9;})[_0x6e43('0x26')](respondWithFilteredResult(_0x2fd983,_0x455a1f))[_0x6e43('0x44')](handleError(_0x2fd983,null));};exports[_0x6e43('0x45')]=function(_0x9662fe,_0x10e1a2){var _0x256a19={'raw':![],'where':{'id':_0x9662fe[_0x6e43('0x46')]['id']}},_0x3831b8={};_0x3831b8[_0x6e43('0x32')]=_[_0x6e43('0x47')](db['SalesforceConfiguration']['rawAttributes']);_0x3831b8['query']=_[_0x6e43('0x47')](_0x9662fe[_0x6e43('0x35')]);_0x3831b8[_0x6e43('0x33')]=_['intersection'](_0x3831b8[_0x6e43('0x32')],_0x3831b8[_0x6e43('0x35')]);_0x256a19['attributes']=_[_0x6e43('0x34')](_0x3831b8[_0x6e43('0x32')],qs[_0x6e43('0x37')](_0x9662fe[_0x6e43('0x35')]['fields']));_0x256a19[_0x6e43('0x36')]=_0x256a19[_0x6e43('0x36')]['length']?_0x256a19[_0x6e43('0x36')]:_0x3831b8[_0x6e43('0x32')];if(_0x9662fe[_0x6e43('0x35')][_0x6e43('0x42')]){_0x256a19[_0x6e43('0x48')]=[{'all':!![]}];}_0x256a19=_['merge']({},_0x256a19,_0x9662fe[_0x6e43('0x41')]);return db['SalesforceConfiguration']['find'](_0x256a19)[_0x6e43('0x26')](handleEntityNotFound(_0x10e1a2,null))[_0x6e43('0x26')](respondWithResult(_0x10e1a2,null))['catch'](handleError(_0x10e1a2,null));};exports[_0x6e43('0x49')]=function(_0x5a5aba,_0x52274b){return db[_0x6e43('0x2d')]['create'](_0x5a5aba[_0x6e43('0x4a')],{})[_0x6e43('0x26')](respondWithResult(_0x52274b,0xc9))['catch'](handleError(_0x52274b,null));};exports['update']=function(_0x422d2a,_0x447c30){if(_0x422d2a[_0x6e43('0x4a')]['id']){delete _0x422d2a[_0x6e43('0x4a')]['id'];}return db[_0x6e43('0x2d')][_0x6e43('0x4b')]({'where':{'id':_0x422d2a['params']['id']}})[_0x6e43('0x26')](handleEntityNotFound(_0x447c30,null))[_0x6e43('0x26')](saveUpdates(_0x422d2a[_0x6e43('0x4a')],null))[_0x6e43('0x26')](respondWithResult(_0x447c30,null))[_0x6e43('0x44')](handleError(_0x447c30,null));};exports[_0x6e43('0x25')]=function(_0x46d0a0,_0xb84a09){return db[_0x6e43('0x2d')][_0x6e43('0x4b')]({'where':{'id':_0x46d0a0[_0x6e43('0x46')]['id']}})[_0x6e43('0x26')](handleEntityNotFound(_0xb84a09,null))[_0x6e43('0x26')](removeEntity(_0xb84a09,null))[_0x6e43('0x44')](handleError(_0xb84a09,null));};exports[_0x6e43('0x4c')]=function(_0xc6d428,_0x15d8e2,_0x50b7e4){var _0x3a7e86={};var _0x23a8a6={};var _0x200b51;var _0x4199c4;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xc6d428['params']['id']}})[_0x6e43('0x26')](handleEntityNotFound(_0x15d8e2,null))['then'](function(_0x2aefeb){if(_0x2aefeb){_0x200b51=_0x2aefeb;_0x23a8a6[_0x6e43('0x32')]=_[_0x6e43('0x47')](db['SalesforceField'][_0x6e43('0x2e')]);_0x23a8a6[_0x6e43('0x35')]=_['keys'](_0xc6d428['query']);_0x23a8a6['filters']=_[_0x6e43('0x34')](_0x23a8a6[_0x6e43('0x32')],_0x23a8a6[_0x6e43('0x35')]);_0x3a7e86[_0x6e43('0x36')]=_[_0x6e43('0x34')](_0x23a8a6[_0x6e43('0x32')],qs['fields'](_0xc6d428['query'][_0x6e43('0x37')]));_0x3a7e86[_0x6e43('0x36')]=_0x3a7e86['attributes']['length']?_0x3a7e86[_0x6e43('0x36')]:_0x23a8a6[_0x6e43('0x32')];_0x3a7e86[_0x6e43('0x3a')]=qs[_0x6e43('0x3b')](_0xc6d428[_0x6e43('0x35')]['sort']);_0x3a7e86[_0x6e43('0x3d')]=qs[_0x6e43('0x33')](_[_0x6e43('0x3c')](_0xc6d428[_0x6e43('0x35')],_0x23a8a6[_0x6e43('0x33')]));if(_0xc6d428['query'][_0x6e43('0x3f')]){_0x3a7e86['where']=_[_0x6e43('0x40')](_0x3a7e86['where'],{'$or':_[_0x6e43('0x2c')](_0x3a7e86[_0x6e43('0x36')],function(_0x564cf1){var _0x38846e={};_0x38846e[_0x564cf1]={'$like':'%'+_0xc6d428['query'][_0x6e43('0x3f')]+'%'};return _0x38846e;})});}_0x3a7e86=_[_0x6e43('0x40')]({},_0x3a7e86,_0xc6d428['options']);return _0x200b51[_0x6e43('0x4c')](_0x3a7e86);}})[_0x6e43('0x26')](function(_0x4faaaf){if(_0x4faaaf){_0x4199c4=_0x4faaaf[_0x6e43('0x38')];if(!_0xc6d428['query'][_0x6e43('0x4d')]('nolimit')){_0x3a7e86[_0x6e43('0x1e')]=qs['limit'](_0xc6d428[_0x6e43('0x35')]['limit']);_0x3a7e86[_0x6e43('0x1d')]=qs[_0x6e43('0x1d')](_0xc6d428[_0x6e43('0x35')][_0x6e43('0x1d')]);}return _0x200b51[_0x6e43('0x4c')](_0x3a7e86);}})[_0x6e43('0x26')](function(_0x15da75){if(_0x15da75){return _0x15da75?{'count':_0x4199c4,'rows':_0x15da75}:null;}})[_0x6e43('0x26')](respondWithResult(_0x15d8e2,null))[_0x6e43('0x44')](handleError(_0x15d8e2,null));};exports[_0x6e43('0x4e')]=function(_0x2ab229,_0x9d3085,_0x45cc19){var _0x481636={};var _0x25846c={};var _0x59c390;var _0x1eea49;return db[_0x6e43('0x2d')][_0x6e43('0x4f')]({'where':{'id':_0x2ab229['params']['id']}})[_0x6e43('0x26')](handleEntityNotFound(_0x9d3085,null))[_0x6e43('0x26')](function(_0x3316b2){if(_0x3316b2){_0x59c390=_0x3316b2;_0x25846c[_0x6e43('0x32')]=_[_0x6e43('0x47')](db[_0x6e43('0x50')]['rawAttributes']);_0x25846c['query']=_[_0x6e43('0x47')](_0x2ab229[_0x6e43('0x35')]);_0x25846c['filters']=_['intersection'](_0x25846c[_0x6e43('0x32')],_0x25846c[_0x6e43('0x35')]);_0x481636[_0x6e43('0x36')]=_[_0x6e43('0x34')](_0x25846c[_0x6e43('0x32')],qs[_0x6e43('0x37')](_0x2ab229['query']['fields']));_0x481636[_0x6e43('0x36')]=_0x481636[_0x6e43('0x36')][_0x6e43('0x38')]?_0x481636[_0x6e43('0x36')]:_0x25846c[_0x6e43('0x32')];_0x481636[_0x6e43('0x3a')]=qs[_0x6e43('0x3b')](_0x2ab229['query'][_0x6e43('0x3b')]);_0x481636['where']=qs[_0x6e43('0x33')](_[_0x6e43('0x3c')](_0x2ab229['query'],_0x25846c[_0x6e43('0x33')]));if(_0x2ab229[_0x6e43('0x35')]['filter']){_0x481636[_0x6e43('0x3d')]=_[_0x6e43('0x40')](_0x481636[_0x6e43('0x3d')],{'$or':_[_0x6e43('0x2c')](_0x481636[_0x6e43('0x36')],function(_0x5ce62c){var _0x168cf0={};_0x168cf0[_0x5ce62c]={'$like':'%'+_0x2ab229[_0x6e43('0x35')][_0x6e43('0x3f')]+'%'};return _0x168cf0;})});}_0x481636=_[_0x6e43('0x40')]({},_0x481636,_0x2ab229[_0x6e43('0x41')]);return _0x59c390['getSubjects'](_0x481636);}})[_0x6e43('0x26')](function(_0x535fed){if(_0x535fed){_0x1eea49=_0x535fed[_0x6e43('0x38')];if(!_0x2ab229[_0x6e43('0x35')][_0x6e43('0x4d')](_0x6e43('0x39'))){_0x481636[_0x6e43('0x1e')]=qs['limit'](_0x2ab229['query'][_0x6e43('0x1e')]);_0x481636[_0x6e43('0x1d')]=qs[_0x6e43('0x1d')](_0x2ab229[_0x6e43('0x35')]['offset']);}return _0x59c390[_0x6e43('0x4e')](_0x481636);}})['then'](function(_0x4077fa){if(_0x4077fa){return _0x4077fa?{'count':_0x1eea49,'rows':_0x4077fa}:null;}})[_0x6e43('0x26')](respondWithResult(_0x9d3085,null))[_0x6e43('0x44')](handleError(_0x9d3085,null));};exports[_0x6e43('0x51')]=function(_0x161cae,_0x2f669f,_0x3e168c){var _0x11c009={};var _0x154145={};var _0x50faad;var _0xd30354;return db[_0x6e43('0x2d')][_0x6e43('0x4f')]({'where':{'id':_0x161cae['params']['id']}})[_0x6e43('0x26')](handleEntityNotFound(_0x2f669f,null))[_0x6e43('0x26')](function(_0x2416fe){if(_0x2416fe){_0x50faad=_0x2416fe;_0x154145[_0x6e43('0x32')]=_['keys'](db[_0x6e43('0x50')][_0x6e43('0x2e')]);_0x154145[_0x6e43('0x35')]=_[_0x6e43('0x47')](_0x161cae[_0x6e43('0x35')]);_0x154145[_0x6e43('0x33')]=_[_0x6e43('0x34')](_0x154145[_0x6e43('0x32')],_0x154145[_0x6e43('0x35')]);_0x11c009['attributes']=_['intersection'](_0x154145[_0x6e43('0x32')],qs['fields'](_0x161cae[_0x6e43('0x35')][_0x6e43('0x37')]));_0x11c009[_0x6e43('0x36')]=_0x11c009['attributes'][_0x6e43('0x38')]?_0x11c009['attributes']:_0x154145[_0x6e43('0x32')];_0x11c009['order']=qs['sort'](_0x161cae[_0x6e43('0x35')][_0x6e43('0x3b')]);_0x11c009[_0x6e43('0x3d')]=qs[_0x6e43('0x33')](_[_0x6e43('0x3c')](_0x161cae[_0x6e43('0x35')],_0x154145[_0x6e43('0x33')]));if(_0x161cae[_0x6e43('0x35')]['filter']){_0x11c009[_0x6e43('0x3d')]=_[_0x6e43('0x40')](_0x11c009[_0x6e43('0x3d')],{'$or':_['map'](_0x11c009[_0x6e43('0x36')],function(_0x10b59a){var _0x4c18ad={};_0x4c18ad[_0x10b59a]={'$like':'%'+_0x161cae[_0x6e43('0x35')][_0x6e43('0x3f')]+'%'};return _0x4c18ad;})});}_0x11c009=_['merge']({},_0x11c009,_0x161cae[_0x6e43('0x41')]);return _0x50faad[_0x6e43('0x51')](_0x11c009);}})['then'](function(_0x4653ff){if(_0x4653ff){_0xd30354=_0x4653ff[_0x6e43('0x38')];if(!_0x161cae[_0x6e43('0x35')][_0x6e43('0x4d')](_0x6e43('0x39'))){_0x11c009[_0x6e43('0x1e')]=qs[_0x6e43('0x1e')](_0x161cae[_0x6e43('0x35')][_0x6e43('0x1e')]);_0x11c009[_0x6e43('0x1d')]=qs[_0x6e43('0x1d')](_0x161cae[_0x6e43('0x35')][_0x6e43('0x1d')]);}return _0x50faad['getDescriptions'](_0x11c009);}})[_0x6e43('0x26')](function(_0x15a934){if(_0x15a934){return _0x15a934?{'count':_0xd30354,'rows':_0x15a934}:null;}})[_0x6e43('0x26')](respondWithResult(_0x2f669f,null))[_0x6e43('0x44')](handleError(_0x2f669f,null));}; \ No newline at end of file +var _0xe20e=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','create','body','catch','find','params','getFields','SalesforceField','pick','getSubjects','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','reject','save','update','destroy','then','error','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4f4679,_0x713087){var _0x2f7cd0=function(_0x8eaf53){while(--_0x8eaf53){_0x4f4679['push'](_0x4f4679['shift']());}};_0x2f7cd0(++_0x713087);}(_0xe20e,0x195));var _0xee20=function(_0x3ac0fd,_0x2dfb0c){_0x3ac0fd=_0x3ac0fd-0x0;var _0x2670a9=_0xe20e[_0x3ac0fd];return _0x2670a9;};'use strict';var emlformat=require(_0xee20('0x0'));var rimraf=require(_0xee20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee20('0x2'));var rp=require(_0xee20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee20('0x4'));var util=require('util');var path=require(_0xee20('0x5'));var sox=require(_0xee20('0x6'));var csv=require(_0xee20('0x7'));var ejs=require(_0xee20('0x8'));var fs=require('fs');var fs_extra=require(_0xee20('0x9'));var _=require(_0xee20('0xa'));var squel=require(_0xee20('0xb'));var crypto=require(_0xee20('0xc'));var jsforce=require(_0xee20('0xd'));var deskjs=require(_0xee20('0xe'));var toCsv=require(_0xee20('0x7'));var querystring=require(_0xee20('0xf'));var Papa=require('papaparse');var Redis=require(_0xee20('0x10'));var authService=require(_0xee20('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee20('0x12'));var logger=require(_0xee20('0x13'))(_0xee20('0x14'));var utils=require(_0xee20('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xee20('0x16'));var db=require(_0xee20('0x17'))['db'];function respondWithStatusCode(_0x440b89,_0x195d17){_0x195d17=_0x195d17||0xcc;return function(_0x303dc6){if(_0x303dc6){return _0x440b89[_0xee20('0x18')](_0x195d17);}return _0x440b89[_0xee20('0x19')](_0x195d17)['end']();};}function respondWithResult(_0x3da816,_0x4e1e75){_0x4e1e75=_0x4e1e75||0xc8;return function(_0x3f6df3){if(_0x3f6df3){return _0x3da816[_0xee20('0x19')](_0x4e1e75)[_0xee20('0x1a')](_0x3f6df3);}};}function respondWithFilteredResult(_0x5d0563,_0x6a910e){return function(_0x413905){if(_0x413905){var _0xa0873e=typeof _0x6a910e[_0xee20('0x1b')]===_0xee20('0x1c')&&typeof _0x6a910e['limit']===_0xee20('0x1c');var _0x271413=_0x413905['count'];var _0x4ad007=_0xa0873e?0x0:_0x6a910e[_0xee20('0x1b')];var _0x4ea5fa=_0xa0873e?_0x413905[_0xee20('0x1d')]:_0x6a910e[_0xee20('0x1b')]+_0x6a910e[_0xee20('0x1e')];var _0x46c22e;if(_0x4ea5fa>=_0x271413){_0x4ea5fa=_0x271413;_0x46c22e=0xc8;}else{_0x46c22e=0xce;}_0x5d0563[_0xee20('0x19')](_0x46c22e);return _0x5d0563['set']('Content-Range',_0x4ad007+'-'+_0x4ea5fa+'/'+_0x271413)[_0xee20('0x1a')](_0x413905);}return null;};}function patchUpdates(_0x9ec152){return function(_0x2cf160){try{jsonpatch['apply'](_0x2cf160,_0x9ec152,!![]);}catch(_0x16941b){return BPromise[_0xee20('0x1f')](_0x16941b);}return _0x2cf160[_0xee20('0x20')]();};}function saveUpdates(_0x3f959b,_0x407215){return function(_0x534c6e){if(_0x534c6e){return _0x534c6e[_0xee20('0x21')](_0x3f959b)['then'](function(_0x181f25){return _0x181f25;});}return null;};}function removeEntity(_0x4b4134,_0x53a158){return function(_0xc9af6c){if(_0xc9af6c){return _0xc9af6c[_0xee20('0x22')]()[_0xee20('0x23')](function(){_0x4b4134['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d0db3,_0x1030de){return function(_0x96d369){if(!_0x96d369){_0x5d0db3['sendStatus'](0x194);}return _0x96d369;};}function handleError(_0x989704,_0x256250){_0x256250=_0x256250||0x1f4;return function(_0xc0e06b){logger[_0xee20('0x24')](_0xc0e06b['stack']);if(_0xc0e06b['name']){delete _0xc0e06b[_0xee20('0x25')];}_0x989704[_0xee20('0x19')](_0x256250)[_0xee20('0x26')](_0xc0e06b);};}exports[_0xee20('0x27')]=function(_0x1c3ccf,_0xc1462){var _0x5c2079={},_0x2e4090={},_0x32590b={'count':0x0,'rows':[]};var _0x148219=_['map'](db[_0xee20('0x28')][_0xee20('0x29')],function(_0x207b4c){return{'name':_0x207b4c[_0xee20('0x2a')],'type':_0x207b4c[_0xee20('0x2b')][_0xee20('0x2c')]};});_0x2e4090[_0xee20('0x2d')]=_[_0xee20('0x2e')](_0x148219,'name');_0x2e4090[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x1c3ccf['query']);_0x2e4090[_0xee20('0x31')]=_[_0xee20('0x32')](_0x2e4090[_0xee20('0x2d')],_0x2e4090[_0xee20('0x2f')]);_0x5c2079[_0xee20('0x33')]=_['intersection'](_0x2e4090['model'],qs[_0xee20('0x34')](_0x1c3ccf['query'][_0xee20('0x34')]));_0x5c2079[_0xee20('0x33')]=_0x5c2079[_0xee20('0x33')][_0xee20('0x35')]?_0x5c2079[_0xee20('0x33')]:_0x2e4090[_0xee20('0x2d')];if(!_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x36')](_0xee20('0x37'))){_0x5c2079['limit']=qs[_0xee20('0x1e')](_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x1e')]);_0x5c2079[_0xee20('0x1b')]=qs['offset'](_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x1b')]);}_0x5c2079[_0xee20('0x38')]=qs['sort'](_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x39')]);_0x5c2079[_0xee20('0x3a')]=qs[_0xee20('0x31')](_['pick'](_0x1c3ccf['query'],_0x2e4090[_0xee20('0x31')]),_0x148219);if(_0x1c3ccf['query'][_0xee20('0x3b')]){_0x5c2079[_0xee20('0x3a')]=_[_0xee20('0x3c')](_0x5c2079[_0xee20('0x3a')],{'$or':_[_0xee20('0x2e')](_0x148219,function(_0xa9d42e){if(_0xa9d42e['type']!==_0xee20('0x3d')){var _0x647d7a={};_0x647d7a[_0xa9d42e['name']]={'$like':'%'+_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x3b')]+'%'};return _0x647d7a;}})});}_0x5c2079=_['merge']({},_0x5c2079,_0x1c3ccf[_0xee20('0x3e')]);var _0x372560={'where':_0x5c2079[_0xee20('0x3a')]};return db['SalesforceConfiguration']['count'](_0x372560)['then'](function(_0x241283){_0x32590b['count']=_0x241283;if(_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x3f')]){_0x5c2079[_0xee20('0x40')]=[{'all':!![]}];}return db[_0xee20('0x28')][_0xee20('0x41')](_0x5c2079);})[_0xee20('0x23')](function(_0x99fb51){_0x32590b[_0xee20('0x42')]=_0x99fb51;return _0x32590b;})['then'](respondWithFilteredResult(_0xc1462,_0x5c2079))['catch'](handleError(_0xc1462,null));};exports[_0xee20('0x43')]=function(_0x2e9152,_0x197a2c){var _0x8d8094={'raw':![],'where':{'id':_0x2e9152['params']['id']}},_0xa543f0={};_0xa543f0[_0xee20('0x2d')]=_[_0xee20('0x30')](db['SalesforceConfiguration'][_0xee20('0x29')]);_0xa543f0[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x2e9152[_0xee20('0x2f')]);_0xa543f0[_0xee20('0x31')]=_[_0xee20('0x32')](_0xa543f0[_0xee20('0x2d')],_0xa543f0[_0xee20('0x2f')]);_0x8d8094[_0xee20('0x33')]=_['intersection'](_0xa543f0[_0xee20('0x2d')],qs[_0xee20('0x34')](_0x2e9152[_0xee20('0x2f')]['fields']));_0x8d8094[_0xee20('0x33')]=_0x8d8094[_0xee20('0x33')][_0xee20('0x35')]?_0x8d8094[_0xee20('0x33')]:_0xa543f0['model'];if(_0x2e9152['query'][_0xee20('0x3f')]){_0x8d8094[_0xee20('0x40')]=[{'all':!![]}];}_0x8d8094=_['merge']({},_0x8d8094,_0x2e9152[_0xee20('0x3e')]);return db[_0xee20('0x28')]['find'](_0x8d8094)[_0xee20('0x23')](handleEntityNotFound(_0x197a2c,null))['then'](respondWithResult(_0x197a2c,null))['catch'](handleError(_0x197a2c,null));};exports[_0xee20('0x44')]=function(_0xed0968,_0x597d10){return db[_0xee20('0x28')][_0xee20('0x44')](_0xed0968[_0xee20('0x45')],{})[_0xee20('0x23')](respondWithResult(_0x597d10,0xc9))[_0xee20('0x46')](handleError(_0x597d10,null));};exports[_0xee20('0x21')]=function(_0x4842aa,_0x177240){if(_0x4842aa[_0xee20('0x45')]['id']){delete _0x4842aa['body']['id'];}return db[_0xee20('0x28')][_0xee20('0x47')]({'where':{'id':_0x4842aa[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x177240,null))['then'](saveUpdates(_0x4842aa['body'],null))[_0xee20('0x23')](respondWithResult(_0x177240,null))[_0xee20('0x46')](handleError(_0x177240,null));};exports[_0xee20('0x22')]=function(_0x2185cd,_0x14608b){return db[_0xee20('0x28')][_0xee20('0x47')]({'where':{'id':_0x2185cd[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x14608b,null))[_0xee20('0x23')](removeEntity(_0x14608b,null))[_0xee20('0x46')](handleError(_0x14608b,null));};exports[_0xee20('0x49')]=function(_0x461ad4,_0x38581c,_0x51ff87){var _0x13e488={};var _0x3931d6={};var _0x31e22b;var _0xda40e0;return db[_0xee20('0x28')]['findOne']({'where':{'id':_0x461ad4[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x38581c,null))[_0xee20('0x23')](function(_0x1c6adc){if(_0x1c6adc){_0x31e22b=_0x1c6adc;_0x3931d6[_0xee20('0x2d')]=_[_0xee20('0x30')](db[_0xee20('0x4a')][_0xee20('0x29')]);_0x3931d6['query']=_[_0xee20('0x30')](_0x461ad4[_0xee20('0x2f')]);_0x3931d6[_0xee20('0x31')]=_[_0xee20('0x32')](_0x3931d6[_0xee20('0x2d')],_0x3931d6[_0xee20('0x2f')]);_0x13e488['attributes']=_['intersection'](_0x3931d6[_0xee20('0x2d')],qs[_0xee20('0x34')](_0x461ad4['query']['fields']));_0x13e488[_0xee20('0x33')]=_0x13e488['attributes'][_0xee20('0x35')]?_0x13e488['attributes']:_0x3931d6['model'];_0x13e488[_0xee20('0x38')]=qs[_0xee20('0x39')](_0x461ad4[_0xee20('0x2f')]['sort']);_0x13e488[_0xee20('0x3a')]=qs[_0xee20('0x31')](_['pick'](_0x461ad4[_0xee20('0x2f')],_0x3931d6[_0xee20('0x31')]));if(_0x461ad4['query'][_0xee20('0x3b')]){_0x13e488[_0xee20('0x3a')]=_[_0xee20('0x3c')](_0x13e488[_0xee20('0x3a')],{'$or':_['map'](_0x13e488[_0xee20('0x33')],function(_0xf58381){var _0x3cea17={};_0x3cea17[_0xf58381]={'$like':'%'+_0x461ad4['query'][_0xee20('0x3b')]+'%'};return _0x3cea17;})});}_0x13e488=_[_0xee20('0x3c')]({},_0x13e488,_0x461ad4[_0xee20('0x3e')]);return _0x31e22b['getFields'](_0x13e488);}})[_0xee20('0x23')](function(_0x4153b6){if(_0x4153b6){_0xda40e0=_0x4153b6[_0xee20('0x35')];if(!_0x461ad4['query'][_0xee20('0x36')]('nolimit')){_0x13e488[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x461ad4['query'][_0xee20('0x1e')]);_0x13e488[_0xee20('0x1b')]=qs[_0xee20('0x1b')](_0x461ad4['query']['offset']);}return _0x31e22b[_0xee20('0x49')](_0x13e488);}})[_0xee20('0x23')](function(_0x42e8f5){if(_0x42e8f5){return _0x42e8f5?{'count':_0xda40e0,'rows':_0x42e8f5}:null;}})[_0xee20('0x23')](respondWithResult(_0x38581c,null))[_0xee20('0x46')](handleError(_0x38581c,null));};exports['getSubjects']=function(_0x9e5798,_0x441129,_0x30dd4f){var _0x1b2786={};var _0x32b33f={};var _0x2489e0;var _0x262905;return db[_0xee20('0x28')]['findOne']({'where':{'id':_0x9e5798[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x441129,null))[_0xee20('0x23')](function(_0x5b69ff){if(_0x5b69ff){_0x2489e0=_0x5b69ff;_0x32b33f[_0xee20('0x2d')]=_[_0xee20('0x30')](db['SalesforceField'][_0xee20('0x29')]);_0x32b33f[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x9e5798[_0xee20('0x2f')]);_0x32b33f[_0xee20('0x31')]=_[_0xee20('0x32')](_0x32b33f[_0xee20('0x2d')],_0x32b33f['query']);_0x1b2786[_0xee20('0x33')]=_['intersection'](_0x32b33f['model'],qs['fields'](_0x9e5798['query'][_0xee20('0x34')]));_0x1b2786['attributes']=_0x1b2786[_0xee20('0x33')][_0xee20('0x35')]?_0x1b2786[_0xee20('0x33')]:_0x32b33f[_0xee20('0x2d')];_0x1b2786['order']=qs[_0xee20('0x39')](_0x9e5798[_0xee20('0x2f')][_0xee20('0x39')]);_0x1b2786[_0xee20('0x3a')]=qs[_0xee20('0x31')](_[_0xee20('0x4b')](_0x9e5798[_0xee20('0x2f')],_0x32b33f[_0xee20('0x31')]));if(_0x9e5798[_0xee20('0x2f')][_0xee20('0x3b')]){_0x1b2786[_0xee20('0x3a')]=_[_0xee20('0x3c')](_0x1b2786[_0xee20('0x3a')],{'$or':_[_0xee20('0x2e')](_0x1b2786[_0xee20('0x33')],function(_0x359a40){var _0xa72d01={};_0xa72d01[_0x359a40]={'$like':'%'+_0x9e5798[_0xee20('0x2f')][_0xee20('0x3b')]+'%'};return _0xa72d01;})});}_0x1b2786=_[_0xee20('0x3c')]({},_0x1b2786,_0x9e5798[_0xee20('0x3e')]);return _0x2489e0[_0xee20('0x4c')](_0x1b2786);}})['then'](function(_0x55238e){if(_0x55238e){_0x262905=_0x55238e['length'];if(!_0x9e5798[_0xee20('0x2f')][_0xee20('0x36')](_0xee20('0x37'))){_0x1b2786[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x9e5798[_0xee20('0x2f')][_0xee20('0x1e')]);_0x1b2786['offset']=qs[_0xee20('0x1b')](_0x9e5798[_0xee20('0x2f')]['offset']);}return _0x2489e0['getSubjects'](_0x1b2786);}})['then'](function(_0x2129c0){if(_0x2129c0){return _0x2129c0?{'count':_0x262905,'rows':_0x2129c0}:null;}})[_0xee20('0x23')](respondWithResult(_0x441129,null))[_0xee20('0x46')](handleError(_0x441129,null));};exports['getDescriptions']=function(_0x5e602d,_0x546d1e,_0x163826){var _0x3b8150={};var _0xc0ed4c={};var _0x5b67db;var _0x5cdf49;return db[_0xee20('0x28')]['findOne']({'where':{'id':_0x5e602d[_0xee20('0x48')]['id']}})['then'](handleEntityNotFound(_0x546d1e,null))[_0xee20('0x23')](function(_0x2f016c){if(_0x2f016c){_0x5b67db=_0x2f016c;_0xc0ed4c[_0xee20('0x2d')]=_['keys'](db[_0xee20('0x4a')][_0xee20('0x29')]);_0xc0ed4c[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x5e602d['query']);_0xc0ed4c[_0xee20('0x31')]=_[_0xee20('0x32')](_0xc0ed4c['model'],_0xc0ed4c['query']);_0x3b8150[_0xee20('0x33')]=_[_0xee20('0x32')](_0xc0ed4c['model'],qs['fields'](_0x5e602d[_0xee20('0x2f')][_0xee20('0x34')]));_0x3b8150[_0xee20('0x33')]=_0x3b8150[_0xee20('0x33')][_0xee20('0x35')]?_0x3b8150[_0xee20('0x33')]:_0xc0ed4c['model'];_0x3b8150[_0xee20('0x38')]=qs[_0xee20('0x39')](_0x5e602d['query'][_0xee20('0x39')]);_0x3b8150[_0xee20('0x3a')]=qs[_0xee20('0x31')](_[_0xee20('0x4b')](_0x5e602d[_0xee20('0x2f')],_0xc0ed4c[_0xee20('0x31')]));if(_0x5e602d[_0xee20('0x2f')][_0xee20('0x3b')]){_0x3b8150[_0xee20('0x3a')]=_['merge'](_0x3b8150[_0xee20('0x3a')],{'$or':_[_0xee20('0x2e')](_0x3b8150[_0xee20('0x33')],function(_0x55ae10){var _0x2d8866={};_0x2d8866[_0x55ae10]={'$like':'%'+_0x5e602d[_0xee20('0x2f')][_0xee20('0x3b')]+'%'};return _0x2d8866;})});}_0x3b8150=_[_0xee20('0x3c')]({},_0x3b8150,_0x5e602d[_0xee20('0x3e')]);return _0x5b67db['getDescriptions'](_0x3b8150);}})[_0xee20('0x23')](function(_0x5dba11){if(_0x5dba11){_0x5cdf49=_0x5dba11['length'];if(!_0x5e602d[_0xee20('0x2f')][_0xee20('0x36')](_0xee20('0x37'))){_0x3b8150[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x5e602d[_0xee20('0x2f')][_0xee20('0x1e')]);_0x3b8150[_0xee20('0x1b')]=qs[_0xee20('0x1b')](_0x5e602d['query']['offset']);}return _0x5b67db['getDescriptions'](_0x3b8150);}})[_0xee20('0x23')](function(_0x235edd){if(_0x235edd){return _0x235edd?{'count':_0x5cdf49,'rows':_0x235edd}:null;}})['then'](respondWithResult(_0x546d1e,null))[_0xee20('0x46')](handleError(_0x546d1e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2cd2d43..8936b1d 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 _0x5cde=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5cde,0x6b));var _0xe5cd=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x5cde[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xe5cd('0x0'));var util=require(_0xe5cd('0x1'));var logger=require(_0xe5cd('0x2'))('api');var moment=require(_0xe5cd('0x3'));var BPromise=require(_0xe5cd('0x4'));var rp=require(_0xe5cd('0x5'));var fs=require('fs');var path=require(_0xe5cd('0x6'));var rimraf=require(_0xe5cd('0x7'));var config=require('../../config/environment');var attributes=require(_0xe5cd('0x8'));module[_0xe5cd('0x9')]=function(_0x52dd35,_0xa28bbe){return _0x52dd35[_0xe5cd('0xa')](_0xe5cd('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fe1=['path','../../config/environment','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15a9a6,_0x248af4){var _0x31ac7d=function(_0x3e4805){while(--_0x3e4805){_0x15a9a6['push'](_0x15a9a6['shift']());}};_0x31ac7d(++_0x248af4);}(_0x3fe1,0x89));var _0x13fe=function(_0x2cf702,_0x333323){_0x2cf702=_0x2cf702-0x0;var _0x15f7a6=_0x3fe1[_0x2cf702];return _0x15f7a6;};'use strict';var _=require('lodash');var util=require(_0x13fe('0x0'));var logger=require(_0x13fe('0x1'))(_0x13fe('0x2'));var moment=require(_0x13fe('0x3'));var BPromise=require(_0x13fe('0x4'));var rp=require(_0x13fe('0x5'));var fs=require('fs');var path=require(_0x13fe('0x6'));var rimraf=require('rimraf');var config=require(_0x13fe('0x7'));var attributes=require(_0x13fe('0x8'));module['exports']=function(_0x3d9bd4,_0x5d9ad0){return _0x3d9bd4[_0x13fe('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x13fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 10079a5..0ac6fdb 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 _0x0092=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x4ec911,_0x3534a0){var _0x13ab51=function(_0x3ced5c){while(--_0x3ced5c){_0x4ec911['push'](_0x4ec911['shift']());}};_0x13ab51(++_0x3534a0);}(_0x0092,0x6b));var _0x2009=function(_0x40ec84,_0x25f950){_0x40ec84=_0x40ec84-0x0;var _0x3c230c=_0x0092[_0x40ec84];return _0x3c230c;};'use strict';var _=require(_0x2009('0x0'));var util=require(_0x2009('0x1'));var moment=require('moment');var BPromise=require(_0x2009('0x2'));var rs=require(_0x2009('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2009('0x4'))['db'];var utils=require(_0x2009('0x5'));var logger=require(_0x2009('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2009('0x7'));var client=jayson[_0x2009('0x8')][_0x2009('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c1008,_0x2f06b6,_0x53c31d){return new BPromise(function(_0x3d9d15,_0x42c310){return client[_0x2009('0xa')](_0x4c1008,_0x53c31d)[_0x2009('0xb')](function(_0x5d1da9){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x2f06b6,_0x2009('0xc'));logger[_0x2009('0xd')](_0x2009('0xe'),_0x2f06b6,_0x2009('0xc'),JSON[_0x2009('0xf')](_0x5d1da9));if(_0x5d1da9['error']){if(_0x5d1da9[_0x2009('0x10')][_0x2009('0x11')]===0x1f4){logger[_0x2009('0x10')](_0x2009('0x12'),_0x2f06b6,_0x5d1da9[_0x2009('0x10')][_0x2009('0x13')]);return _0x42c310(_0x5d1da9[_0x2009('0x10')][_0x2009('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2f06b6,_0x5d1da9[_0x2009('0x10')]['message']);return _0x3d9d15(_0x5d1da9['error']['message']);}else{logger['info'](_0x2009('0x12'),_0x2f06b6,_0x2009('0xc'));_0x3d9d15(_0x5d1da9[_0x2009('0x14')]['message']);}})[_0x2009('0x15')](function(_0x281060){logger[_0x2009('0x10')](_0x2009('0x12'),_0x2f06b6,_0x281060);_0x42c310(_0x281060);});});} \ No newline at end of file +var _0x742d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird'];(function(_0x5086cc,_0x1bb540){var _0x31f681=function(_0x8f77ad){while(--_0x8f77ad){_0x5086cc['push'](_0x5086cc['shift']());}};_0x31f681(++_0x1bb540);}(_0x742d,0x129));var _0xd742=function(_0x492ec1,_0x1b62bd){_0x492ec1=_0x492ec1-0x0;var _0x4cfb7e=_0x742d[_0x492ec1];return _0x4cfb7e;};'use strict';var _=require(_0xd742('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd742('0x1'));var rs=require(_0xd742('0x2'));var fs=require('fs');var Redis=require(_0xd742('0x3'));var db=require(_0xd742('0x4'))['db'];var utils=require(_0xd742('0x5'));var logger=require(_0xd742('0x6'))('rpc');var config=require(_0xd742('0x7'));var jayson=require(_0xd742('0x8'));var client=jayson[_0xd742('0x9')][_0xd742('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a033e,_0x1bd39f,_0x2a895e){return new BPromise(function(_0x4f7790,_0x5605cf){return client[_0xd742('0xb')](_0x1a033e,_0x2a895e)[_0xd742('0xc')](function(_0x2d1e77){logger[_0xd742('0xd')](_0xd742('0xe'),_0x1bd39f,_0xd742('0xf'));logger[_0xd742('0x10')](_0xd742('0x11'),_0x1bd39f,_0xd742('0xf'),JSON['stringify'](_0x2d1e77));if(_0x2d1e77[_0xd742('0x12')]){if(_0x2d1e77[_0xd742('0x12')][_0xd742('0x13')]===0x1f4){logger[_0xd742('0x12')](_0xd742('0xe'),_0x1bd39f,_0x2d1e77[_0xd742('0x12')][_0xd742('0x14')]);return _0x5605cf(_0x2d1e77['error'][_0xd742('0x14')]);}logger['error'](_0xd742('0xe'),_0x1bd39f,_0x2d1e77['error'][_0xd742('0x14')]);return _0x4f7790(_0x2d1e77[_0xd742('0x12')][_0xd742('0x14')]);}else{logger[_0xd742('0xd')](_0xd742('0xe'),_0x1bd39f,_0xd742('0xf'));_0x4f7790(_0x2d1e77[_0xd742('0x15')][_0xd742('0x14')]);}})[_0xd742('0x16')](function(_0x442f86){logger[_0xd742('0x12')](_0xd742('0xe'),_0x1bd39f,_0x442f86);_0x5605cf(_0x442f86);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 422547c..173c81a 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 _0xb201=['fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','create','put','delete','util','path','connect-timeout','express','Router'];(function(_0x2166a3,_0x237c50){var _0x260035=function(_0x2dbfa2){while(--_0x2dbfa2){_0x2166a3['push'](_0x2166a3['shift']());}};_0x260035(++_0x237c50);}(_0xb201,0xb1));var _0x1b20=function(_0x51f0a4,_0x10a96c){_0x51f0a4=_0x51f0a4-0x0;var _0x3fd467=_0xb201[_0x51f0a4];return _0x3fd467;};'use strict';var multer=require('multer');var util=require(_0x1b20('0x0'));var path=require(_0x1b20('0x1'));var timeout=require(_0x1b20('0x2'));var express=require(_0x1b20('0x3'));var router=express[_0x1b20('0x4')]();var fs_extra=require(_0x1b20('0x5'));var auth=require(_0x1b20('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x1b20('0x7')]('/',auth[_0x1b20('0x8')](),controller['index']);router[_0x1b20('0x7')](_0x1b20('0x9'),auth[_0x1b20('0x8')](),controller[_0x1b20('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b20('0xb')]);router[_0x1b20('0xc')](_0x1b20('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1b20('0xd')]('/:id',auth[_0x1b20('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x95e8=['post','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show'];(function(_0xa9eded,_0x5b8466){var _0x1d0bd4=function(_0x34b9fe){while(--_0x34b9fe){_0xa9eded['push'](_0xa9eded['shift']());}};_0x1d0bd4(++_0x5b8466);}(_0x95e8,0x1d3));var _0x895e=function(_0x43aa48,_0x598d9d){_0x43aa48=_0x43aa48-0x0;var _0x3977fc=_0x95e8[_0x43aa48];return _0x3977fc;};'use strict';var multer=require('multer');var util=require(_0x895e('0x0'));var path=require('path');var timeout=require(_0x895e('0x1'));var express=require(_0x895e('0x2'));var router=express['Router']();var fs_extra=require(_0x895e('0x3'));var auth=require(_0x895e('0x4'));var interaction=require(_0x895e('0x5'));var config=require(_0x895e('0x6'));var controller=require(_0x895e('0x7'));router[_0x895e('0x8')]('/',auth[_0x895e('0x9')](),controller[_0x895e('0xa')]);router[_0x895e('0x8')](_0x895e('0xb'),auth['isAuthenticated'](),controller[_0x895e('0xc')]);router[_0x895e('0xd')]('/',auth[_0x895e('0x9')](),controller[_0x895e('0xe')]);router[_0x895e('0xf')]('/:id',auth[_0x895e('0x9')](),controller[_0x895e('0x10')]);router[_0x895e('0x11')](_0x895e('0xb'),auth[_0x895e('0x9')](),controller[_0x895e('0x12')]);module[_0x895e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ed08063..aa3e805 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 _0x0ce0=['customVariable','sequelize','ENUM','keyValue','picklist','string','STRING'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x0ce0,0x15f));var _0x00ce=function(_0x455e82,_0x522f6f){_0x455e82=_0x455e82-0x0;var _0x2d0520=_0x0ce0[_0x455e82];return _0x2d0520;};'use strict';var Sequelize=require(_0x00ce('0x0'));module['exports']={'type':{'type':Sequelize[_0x00ce('0x1')]('string','variable','customVariable',_0x00ce('0x2'),_0x00ce('0x3')),'defaultValue':_0x00ce('0x4')},'content':{'type':Sequelize[_0x00ce('0x5')]},'key':{'type':Sequelize[_0x00ce('0x5')]},'keyType':{'type':Sequelize[_0x00ce('0x1')]('string','variable',_0x00ce('0x6'))},'keyContent':{'type':Sequelize[_0x00ce('0x5')]},'idField':{'type':Sequelize[_0x00ce('0x5')]},'variableName':{'type':Sequelize[_0x00ce('0x5')]}}; \ No newline at end of file +var _0xd7d1=['exports','ENUM','variable','customVariable','STRING','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7d1,0x1c8));var _0x1d7d=function(_0x1d84db,_0x168501){_0x1d84db=_0x1d84db-0x0;var _0x3fdd4c=_0xd7d1[_0x1d84db];return _0x3fdd4c;};'use strict';var Sequelize=require('sequelize');module[_0x1d7d('0x0')]={'type':{'type':Sequelize[_0x1d7d('0x1')]('string',_0x1d7d('0x2'),_0x1d7d('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1d7d('0x4')]},'key':{'type':Sequelize[_0x1d7d('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x1d7d('0x5'),_0x1d7d('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x1d7d('0x4')]},'idField':{'type':Sequelize[_0x1d7d('0x4')]},'variableName':{'type':Sequelize[_0x1d7d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ecff527..9bd2d6d 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 _0xa3f9=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x58128a,_0x8ab991){var _0x56f353=function(_0x925531){while(--_0x925531){_0x58128a['push'](_0x58128a['shift']());}};_0x56f353(++_0x8ab991);}(_0xa3f9,0x116));var _0x9a3f=function(_0x375201,_0x2cdbd8){_0x375201=_0x375201-0x0;var _0x55f38f=_0xa3f9[_0x375201];return _0x55f38f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a3f('0x0'));var rp=require('request-promise');var moment=require(_0x9a3f('0x1'));var BPromise=require(_0x9a3f('0x2'));var Mustache=require(_0x9a3f('0x3'));var util=require('util');var path=require('path');var sox=require(_0x9a3f('0x4'));var csv=require(_0x9a3f('0x5'));var ejs=require(_0x9a3f('0x6'));var fs=require('fs');var fs_extra=require(_0x9a3f('0x7'));var _=require(_0x9a3f('0x8'));var squel=require(_0x9a3f('0x9'));var crypto=require(_0x9a3f('0xa'));var jsforce=require(_0x9a3f('0xb'));var deskjs=require(_0x9a3f('0xc'));var toCsv=require(_0x9a3f('0x5'));var querystring=require(_0x9a3f('0xd'));var Papa=require(_0x9a3f('0xe'));var Redis=require(_0x9a3f('0xf'));var authService=require(_0x9a3f('0x10'));var qs=require(_0x9a3f('0x11'));var as=require(_0x9a3f('0x12'));var hardwareService=require(_0x9a3f('0x13'));var logger=require(_0x9a3f('0x14'))(_0x9a3f('0x15'));var utils=require(_0x9a3f('0x16'));var config=require(_0x9a3f('0x17'));var licenseUtil=require(_0x9a3f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db834,_0x204ebd){_0x204ebd=_0x204ebd||0xcc;return function(_0x51547f){if(_0x51547f){return _0x4db834[_0x9a3f('0x19')](_0x204ebd);}return _0x4db834['status'](_0x204ebd)[_0x9a3f('0x1a')]();};}function respondWithResult(_0x5d14ea,_0x402774){_0x402774=_0x402774||0xc8;return function(_0x58ba92){if(_0x58ba92){return _0x5d14ea[_0x9a3f('0x1b')](_0x402774)[_0x9a3f('0x1c')](_0x58ba92);}};}function respondWithFilteredResult(_0x2100f5,_0x309086){return function(_0x58ff77){if(_0x58ff77){var _0x31cd1d=typeof _0x309086[_0x9a3f('0x1d')]==='undefined'&&typeof _0x309086[_0x9a3f('0x1e')]===_0x9a3f('0x1f');var _0x48b3b7=_0x58ff77[_0x9a3f('0x20')];var _0x45f648=_0x31cd1d?0x0:_0x309086[_0x9a3f('0x1d')];var _0x11e323=_0x31cd1d?_0x58ff77[_0x9a3f('0x20')]:_0x309086['offset']+_0x309086[_0x9a3f('0x1e')];var _0x962424;if(_0x11e323>=_0x48b3b7){_0x11e323=_0x48b3b7;_0x962424=0xc8;}else{_0x962424=0xce;}_0x2100f5[_0x9a3f('0x1b')](_0x962424);return _0x2100f5[_0x9a3f('0x21')]('Content-Range',_0x45f648+'-'+_0x11e323+'/'+_0x48b3b7)['json'](_0x58ff77);}return null;};}function patchUpdates(_0x282db4){return function(_0x1bed8f){try{jsonpatch[_0x9a3f('0x22')](_0x1bed8f,_0x282db4,!![]);}catch(_0x521c51){return BPromise[_0x9a3f('0x23')](_0x521c51);}return _0x1bed8f[_0x9a3f('0x24')]();};}function saveUpdates(_0xc8671,_0x161ed9){return function(_0x21e14c){if(_0x21e14c){return _0x21e14c[_0x9a3f('0x25')](_0xc8671)[_0x9a3f('0x26')](function(_0x50a40f){return _0x50a40f;});}return null;};}function removeEntity(_0x37ebd8,_0x128d71){return function(_0x30e8ab){if(_0x30e8ab){return _0x30e8ab['destroy']()[_0x9a3f('0x26')](function(){_0x37ebd8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x869ced,_0x48113a){return function(_0xdf51a5){if(!_0xdf51a5){_0x869ced[_0x9a3f('0x19')](0x194);}return _0xdf51a5;};}function handleError(_0x441f6a,_0x3132f6){_0x3132f6=_0x3132f6||0x1f4;return function(_0xe8f3cd){logger[_0x9a3f('0x27')](_0xe8f3cd[_0x9a3f('0x28')]);if(_0xe8f3cd[_0x9a3f('0x29')]){delete _0xe8f3cd[_0x9a3f('0x29')];}_0x441f6a[_0x9a3f('0x1b')](_0x3132f6)[_0x9a3f('0x2a')](_0xe8f3cd);};}exports[_0x9a3f('0x2b')]=function(_0x4c8ddf,_0x354494){var _0x43398a={},_0x2bc8cf={},_0xdef3b2={'count':0x0,'rows':[]};var _0x62c004=_[_0x9a3f('0x2c')](db[_0x9a3f('0x2d')][_0x9a3f('0x2e')],function(_0xa5ba4){return{'name':_0xa5ba4[_0x9a3f('0x2f')],'type':_0xa5ba4[_0x9a3f('0x30')]['key']};});_0x2bc8cf[_0x9a3f('0x31')]=_[_0x9a3f('0x2c')](_0x62c004,_0x9a3f('0x29'));_0x2bc8cf[_0x9a3f('0x32')]=_[_0x9a3f('0x33')](_0x4c8ddf[_0x9a3f('0x32')]);_0x2bc8cf[_0x9a3f('0x34')]=_[_0x9a3f('0x35')](_0x2bc8cf[_0x9a3f('0x31')],_0x2bc8cf[_0x9a3f('0x32')]);_0x43398a[_0x9a3f('0x36')]=_[_0x9a3f('0x35')](_0x2bc8cf[_0x9a3f('0x31')],qs[_0x9a3f('0x37')](_0x4c8ddf['query'][_0x9a3f('0x37')]));_0x43398a[_0x9a3f('0x36')]=_0x43398a['attributes'][_0x9a3f('0x38')]?_0x43398a[_0x9a3f('0x36')]:_0x2bc8cf[_0x9a3f('0x31')];if(!_0x4c8ddf['query']['hasOwnProperty'](_0x9a3f('0x39'))){_0x43398a[_0x9a3f('0x1e')]=qs[_0x9a3f('0x1e')](_0x4c8ddf[_0x9a3f('0x32')][_0x9a3f('0x1e')]);_0x43398a[_0x9a3f('0x1d')]=qs[_0x9a3f('0x1d')](_0x4c8ddf[_0x9a3f('0x32')][_0x9a3f('0x1d')]);}_0x43398a[_0x9a3f('0x3a')]=qs[_0x9a3f('0x3b')](_0x4c8ddf[_0x9a3f('0x32')][_0x9a3f('0x3b')]);_0x43398a[_0x9a3f('0x3c')]=qs[_0x9a3f('0x34')](_[_0x9a3f('0x3d')](_0x4c8ddf[_0x9a3f('0x32')],_0x2bc8cf[_0x9a3f('0x34')]),_0x62c004);if(_0x4c8ddf['query'][_0x9a3f('0x3e')]){_0x43398a[_0x9a3f('0x3c')]=_['merge'](_0x43398a[_0x9a3f('0x3c')],{'$or':_[_0x9a3f('0x2c')](_0x62c004,function(_0x5a7950){if(_0x5a7950['type']!==_0x9a3f('0x3f')){var _0x3bbf71={};_0x3bbf71[_0x5a7950[_0x9a3f('0x29')]]={'$like':'%'+_0x4c8ddf['query'][_0x9a3f('0x3e')]+'%'};return _0x3bbf71;}})});}_0x43398a=_[_0x9a3f('0x40')]({},_0x43398a,_0x4c8ddf['options']);var _0x5fc581={'where':_0x43398a[_0x9a3f('0x3c')]};return db[_0x9a3f('0x2d')][_0x9a3f('0x20')](_0x5fc581)['then'](function(_0x263847){_0xdef3b2[_0x9a3f('0x20')]=_0x263847;if(_0x4c8ddf[_0x9a3f('0x32')][_0x9a3f('0x41')]){_0x43398a[_0x9a3f('0x42')]=[{'all':!![]}];}return db[_0x9a3f('0x2d')][_0x9a3f('0x43')](_0x43398a);})[_0x9a3f('0x26')](function(_0x2e6687){_0xdef3b2[_0x9a3f('0x44')]=_0x2e6687;return _0xdef3b2;})[_0x9a3f('0x26')](respondWithFilteredResult(_0x354494,_0x43398a))[_0x9a3f('0x45')](handleError(_0x354494,null));};exports[_0x9a3f('0x46')]=function(_0x4ca507,_0x3b8771){var _0x5c461f={'raw':!![],'where':{'id':_0x4ca507[_0x9a3f('0x47')]['id']}},_0x311ed1={};_0x311ed1['model']=_[_0x9a3f('0x33')](db[_0x9a3f('0x2d')]['rawAttributes']);_0x311ed1[_0x9a3f('0x32')]=_[_0x9a3f('0x33')](_0x4ca507[_0x9a3f('0x32')]);_0x311ed1[_0x9a3f('0x34')]=_[_0x9a3f('0x35')](_0x311ed1[_0x9a3f('0x31')],_0x311ed1[_0x9a3f('0x32')]);_0x5c461f['attributes']=_['intersection'](_0x311ed1[_0x9a3f('0x31')],qs['fields'](_0x4ca507[_0x9a3f('0x32')][_0x9a3f('0x37')]));_0x5c461f[_0x9a3f('0x36')]=_0x5c461f[_0x9a3f('0x36')][_0x9a3f('0x38')]?_0x5c461f[_0x9a3f('0x36')]:_0x311ed1[_0x9a3f('0x31')];if(_0x4ca507[_0x9a3f('0x32')][_0x9a3f('0x41')]){_0x5c461f[_0x9a3f('0x42')]=[{'all':!![]}];}_0x5c461f=_[_0x9a3f('0x40')]({},_0x5c461f,_0x4ca507['options']);return db[_0x9a3f('0x2d')][_0x9a3f('0x48')](_0x5c461f)[_0x9a3f('0x26')](handleEntityNotFound(_0x3b8771,null))[_0x9a3f('0x26')](respondWithResult(_0x3b8771,null))[_0x9a3f('0x45')](handleError(_0x3b8771,null));};exports[_0x9a3f('0x49')]=function(_0x595173,_0xbb4679){return db[_0x9a3f('0x2d')][_0x9a3f('0x49')](_0x595173[_0x9a3f('0x4a')],{})[_0x9a3f('0x26')](respondWithResult(_0xbb4679,0xc9))[_0x9a3f('0x45')](handleError(_0xbb4679,null));};exports['update']=function(_0x29bd38,_0x2e3d96){if(_0x29bd38[_0x9a3f('0x4a')]['id']){delete _0x29bd38[_0x9a3f('0x4a')]['id'];}return db[_0x9a3f('0x2d')]['find']({'where':{'id':_0x29bd38[_0x9a3f('0x47')]['id']}})[_0x9a3f('0x26')](handleEntityNotFound(_0x2e3d96,null))[_0x9a3f('0x26')](saveUpdates(_0x29bd38[_0x9a3f('0x4a')],null))['then'](respondWithResult(_0x2e3d96,null))[_0x9a3f('0x45')](handleError(_0x2e3d96,null));};exports['destroy']=function(_0x4d51ac,_0x57ca99){return db[_0x9a3f('0x2d')]['find']({'where':{'id':_0x4d51ac[_0x9a3f('0x47')]['id']}})[_0x9a3f('0x26')](handleEntityNotFound(_0x57ca99,null))[_0x9a3f('0x26')](removeEntity(_0x57ca99,null))[_0x9a3f('0x45')](handleError(_0x57ca99,null));}; \ No newline at end of file +var _0x3140=['attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','reject','update','then','destroy','end','stack','index','SalesforceField','rawAttributes','model','map','name','query','keys','filters','intersection'];(function(_0x41b875,_0x48a4f7){var _0x64b6ad=function(_0x1224e5){while(--_0x1224e5){_0x41b875['push'](_0x41b875['shift']());}};_0x64b6ad(++_0x48a4f7);}(_0x3140,0xee));var _0x0314=function(_0x24a15e,_0x4862ce){_0x24a15e=_0x24a15e-0x0;var _0x10256f=_0x3140[_0x24a15e];return _0x10256f;};'use strict';var emlformat=require(_0x0314('0x0'));var rimraf=require(_0x0314('0x1'));var zipdir=require(_0x0314('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0314('0x3'));var moment=require(_0x0314('0x4'));var BPromise=require(_0x0314('0x5'));var Mustache=require(_0x0314('0x6'));var util=require(_0x0314('0x7'));var path=require(_0x0314('0x8'));var sox=require(_0x0314('0x9'));var csv=require(_0x0314('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0314('0xb'));var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require(_0x0314('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0314('0xa'));var querystring=require('querystring');var Papa=require(_0x0314('0x10'));var Redis=require(_0x0314('0x11'));var authService=require(_0x0314('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0314('0x13'));var hardwareService=require(_0x0314('0x14'));var logger=require(_0x0314('0x15'))(_0x0314('0x16'));var utils=require(_0x0314('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x18'));var db=require(_0x0314('0x19'))['db'];function respondWithStatusCode(_0x192a28,_0x181feb){_0x181feb=_0x181feb||0xcc;return function(_0x2a9f94){if(_0x2a9f94){return _0x192a28[_0x0314('0x1a')](_0x181feb);}return _0x192a28[_0x0314('0x1b')](_0x181feb)['end']();};}function respondWithResult(_0x34b9c4,_0x40711a){_0x40711a=_0x40711a||0xc8;return function(_0x2e4791){if(_0x2e4791){return _0x34b9c4[_0x0314('0x1b')](_0x40711a)[_0x0314('0x1c')](_0x2e4791);}};}function respondWithFilteredResult(_0x3a7799,_0x10ef70){return function(_0x3bb321){if(_0x3bb321){var _0x17bcde=typeof _0x10ef70['offset']===_0x0314('0x1d')&&typeof _0x10ef70[_0x0314('0x1e')]==='undefined';var _0x430d1a=_0x3bb321['count'];var _0x3500a8=_0x17bcde?0x0:_0x10ef70[_0x0314('0x1f')];var _0x2f5a9f=_0x17bcde?_0x3bb321[_0x0314('0x20')]:_0x10ef70[_0x0314('0x1f')]+_0x10ef70[_0x0314('0x1e')];var _0x4878e2;if(_0x2f5a9f>=_0x430d1a){_0x2f5a9f=_0x430d1a;_0x4878e2=0xc8;}else{_0x4878e2=0xce;}_0x3a7799[_0x0314('0x1b')](_0x4878e2);return _0x3a7799[_0x0314('0x21')]('Content-Range',_0x3500a8+'-'+_0x2f5a9f+'/'+_0x430d1a)[_0x0314('0x1c')](_0x3bb321);}return null;};}function patchUpdates(_0x2e429e){return function(_0x545226){try{jsonpatch['apply'](_0x545226,_0x2e429e,!![]);}catch(_0x1fb214){return BPromise[_0x0314('0x22')](_0x1fb214);}return _0x545226['save']();};}function saveUpdates(_0x5958f6,_0x479c68){return function(_0x199b20){if(_0x199b20){return _0x199b20[_0x0314('0x23')](_0x5958f6)[_0x0314('0x24')](function(_0x5cd021){return _0x5cd021;});}return null;};}function removeEntity(_0x319e9d,_0x5298f8){return function(_0x502166){if(_0x502166){return _0x502166[_0x0314('0x25')]()[_0x0314('0x24')](function(){_0x319e9d[_0x0314('0x1b')](0xcc)[_0x0314('0x26')]();});}};}function handleEntityNotFound(_0x17eef1,_0x287d90){return function(_0x392189){if(!_0x392189){_0x17eef1[_0x0314('0x1a')](0x194);}return _0x392189;};}function handleError(_0x2afd67,_0x3766c6){_0x3766c6=_0x3766c6||0x1f4;return function(_0x55127a){logger['error'](_0x55127a[_0x0314('0x27')]);if(_0x55127a['name']){delete _0x55127a['name'];}_0x2afd67[_0x0314('0x1b')](_0x3766c6)['send'](_0x55127a);};}exports[_0x0314('0x28')]=function(_0x369a89,_0x5ac920){var _0x168cca={},_0x1efb37={},_0x4a85cd={'count':0x0,'rows':[]};var _0x1f890d=_['map'](db[_0x0314('0x29')][_0x0314('0x2a')],function(_0x13dc3f){return{'name':_0x13dc3f['fieldName'],'type':_0x13dc3f['type']['key']};});_0x1efb37[_0x0314('0x2b')]=_[_0x0314('0x2c')](_0x1f890d,_0x0314('0x2d'));_0x1efb37[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x369a89[_0x0314('0x2e')]);_0x1efb37[_0x0314('0x30')]=_[_0x0314('0x31')](_0x1efb37[_0x0314('0x2b')],_0x1efb37[_0x0314('0x2e')]);_0x168cca[_0x0314('0x32')]=_['intersection'](_0x1efb37[_0x0314('0x2b')],qs[_0x0314('0x33')](_0x369a89[_0x0314('0x2e')]['fields']));_0x168cca[_0x0314('0x32')]=_0x168cca[_0x0314('0x32')][_0x0314('0x34')]?_0x168cca[_0x0314('0x32')]:_0x1efb37[_0x0314('0x2b')];if(!_0x369a89[_0x0314('0x2e')][_0x0314('0x35')]('nolimit')){_0x168cca[_0x0314('0x1e')]=qs[_0x0314('0x1e')](_0x369a89[_0x0314('0x2e')][_0x0314('0x1e')]);_0x168cca[_0x0314('0x1f')]=qs[_0x0314('0x1f')](_0x369a89[_0x0314('0x2e')][_0x0314('0x1f')]);}_0x168cca[_0x0314('0x36')]=qs['sort'](_0x369a89['query'][_0x0314('0x37')]);_0x168cca['where']=qs['filters'](_[_0x0314('0x38')](_0x369a89[_0x0314('0x2e')],_0x1efb37[_0x0314('0x30')]),_0x1f890d);if(_0x369a89[_0x0314('0x2e')][_0x0314('0x39')]){_0x168cca['where']=_[_0x0314('0x3a')](_0x168cca[_0x0314('0x3b')],{'$or':_[_0x0314('0x2c')](_0x1f890d,function(_0x3cbe47){if(_0x3cbe47[_0x0314('0x3c')]!==_0x0314('0x3d')){var _0x117461={};_0x117461[_0x3cbe47[_0x0314('0x2d')]]={'$like':'%'+_0x369a89['query'][_0x0314('0x39')]+'%'};return _0x117461;}})});}_0x168cca=_[_0x0314('0x3a')]({},_0x168cca,_0x369a89[_0x0314('0x3e')]);var _0x39f7c5={'where':_0x168cca['where']};return db[_0x0314('0x29')][_0x0314('0x20')](_0x39f7c5)[_0x0314('0x24')](function(_0xd41234){_0x4a85cd[_0x0314('0x20')]=_0xd41234;if(_0x369a89[_0x0314('0x2e')][_0x0314('0x3f')]){_0x168cca[_0x0314('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x0314('0x41')](_0x168cca);})[_0x0314('0x24')](function(_0x303f59){_0x4a85cd[_0x0314('0x42')]=_0x303f59;return _0x4a85cd;})['then'](respondWithFilteredResult(_0x5ac920,_0x168cca))[_0x0314('0x43')](handleError(_0x5ac920,null));};exports['show']=function(_0x1759c7,_0x337746){var _0x2c3a6c={'raw':!![],'where':{'id':_0x1759c7['params']['id']}},_0x5c8ffa={};_0x5c8ffa[_0x0314('0x2b')]=_[_0x0314('0x2f')](db[_0x0314('0x29')][_0x0314('0x2a')]);_0x5c8ffa[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x1759c7[_0x0314('0x2e')]);_0x5c8ffa[_0x0314('0x30')]=_[_0x0314('0x31')](_0x5c8ffa[_0x0314('0x2b')],_0x5c8ffa[_0x0314('0x2e')]);_0x2c3a6c['attributes']=_[_0x0314('0x31')](_0x5c8ffa[_0x0314('0x2b')],qs[_0x0314('0x33')](_0x1759c7[_0x0314('0x2e')]['fields']));_0x2c3a6c[_0x0314('0x32')]=_0x2c3a6c[_0x0314('0x32')]['length']?_0x2c3a6c[_0x0314('0x32')]:_0x5c8ffa['model'];if(_0x1759c7[_0x0314('0x2e')]['includeAll']){_0x2c3a6c[_0x0314('0x40')]=[{'all':!![]}];}_0x2c3a6c=_[_0x0314('0x3a')]({},_0x2c3a6c,_0x1759c7[_0x0314('0x3e')]);return db['SalesforceField'][_0x0314('0x44')](_0x2c3a6c)[_0x0314('0x24')](handleEntityNotFound(_0x337746,null))['then'](respondWithResult(_0x337746,null))[_0x0314('0x43')](handleError(_0x337746,null));};exports[_0x0314('0x45')]=function(_0x123adb,_0x285591){return db['SalesforceField'][_0x0314('0x45')](_0x123adb[_0x0314('0x46')],{})[_0x0314('0x24')](respondWithResult(_0x285591,0xc9))[_0x0314('0x43')](handleError(_0x285591,null));};exports[_0x0314('0x23')]=function(_0x4e7fc7,_0x3c44f3){if(_0x4e7fc7[_0x0314('0x46')]['id']){delete _0x4e7fc7[_0x0314('0x46')]['id'];}return db[_0x0314('0x29')][_0x0314('0x44')]({'where':{'id':_0x4e7fc7[_0x0314('0x47')]['id']}})[_0x0314('0x24')](handleEntityNotFound(_0x3c44f3,null))[_0x0314('0x24')](saveUpdates(_0x4e7fc7['body'],null))[_0x0314('0x24')](respondWithResult(_0x3c44f3,null))['catch'](handleError(_0x3c44f3,null));};exports[_0x0314('0x25')]=function(_0x51d671,_0x3f4644){return db['SalesforceField'][_0x0314('0x44')]({'where':{'id':_0x51d671[_0x0314('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f4644,null))[_0x0314('0x24')](removeEntity(_0x3f4644,null))[_0x0314('0x43')](handleError(_0x3f4644,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 88918f7..e3fb3f2 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 _0x86fd=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intSalesforceField.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x86fd,0x102));var _0xd86f=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x86fd[_0x3f6c29];return _0x4af959;};'use strict';var _=require(_0xd86f('0x0'));var util=require(_0xd86f('0x1'));var logger=require(_0xd86f('0x2'))(_0xd86f('0x3'));var moment=require('moment');var BPromise=require(_0xd86f('0x4'));var rp=require(_0xd86f('0x5'));var fs=require('fs');var path=require(_0xd86f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd86f('0x7'));module['exports']=function(_0x536cea,_0x93f924){return _0x536cea[_0xd86f('0x8')](_0xd86f('0x9'),attributes,{'tableName':_0xd86f('0xa'),'paranoid':![],'indexes':[{'name':_0xd86f('0xb'),'fields':[_0xd86f('0xc'),_0xd86f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x801a=['rimraf','../../config/environment','exports','SalesforceField','int_salesforce_fields','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5ab5bd,_0x12c446){var _0x3dddd8=function(_0x5ea7d0){while(--_0x5ea7d0){_0x5ab5bd['push'](_0x5ab5bd['shift']());}};_0x3dddd8(++_0x12c446);}(_0x801a,0x65));var _0xa801=function(_0x530a2e,_0x4c17aa){_0x530a2e=_0x530a2e-0x0;var _0x1fd8a7=_0x801a[_0x530a2e];return _0x1fd8a7;};'use strict';var _=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var logger=require('../../config/logger')(_0xa801('0x2'));var moment=require(_0xa801('0x3'));var BPromise=require(_0xa801('0x4'));var rp=require(_0xa801('0x5'));var fs=require('fs');var path=require(_0xa801('0x6'));var rimraf=require(_0xa801('0x7'));var config=require(_0xa801('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xa801('0x9')]=function(_0xfc0fe8,_0x12c268){return _0xfc0fe8['define'](_0xa801('0xa'),attributes,{'tableName':_0xa801('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5c292d8..62b333c 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 _0xd5e4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x4782eb,_0x1dafc9){var _0x9f1353=function(_0x1b74b4){while(--_0x1b74b4){_0x4782eb['push'](_0x4782eb['shift']());}};_0x9f1353(++_0x1dafc9);}(_0xd5e4,0x187));var _0x4d5e=function(_0x4b999b,_0x1ecccd){_0x4b999b=_0x4b999b-0x0;var _0x3bf537=_0xd5e4[_0x4b999b];return _0x3bf537;};'use strict';var _=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var moment=require(_0x4d5e('0x2'));var BPromise=require(_0x4d5e('0x3'));var rs=require(_0x4d5e('0x4'));var fs=require('fs');var Redis=require(_0x4d5e('0x5'));var db=require(_0x4d5e('0x6'))['db'];var utils=require(_0x4d5e('0x7'));var logger=require(_0x4d5e('0x8'))(_0x4d5e('0x9'));var config=require('../../config/environment');var jayson=require(_0x4d5e('0xa'));var client=jayson[_0x4d5e('0xb')][_0x4d5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34027e,_0x205534,_0x1114ef){return new BPromise(function(_0x4b4f25,_0x2bb844){return client[_0x4d5e('0xd')](_0x34027e,_0x1114ef)[_0x4d5e('0xe')](function(_0x4f5b7e){logger['info'](_0x4d5e('0xf'),_0x205534,'request\x20sent');logger[_0x4d5e('0x10')](_0x4d5e('0x11'),_0x205534,_0x4d5e('0x12'),JSON[_0x4d5e('0x13')](_0x4f5b7e));if(_0x4f5b7e['error']){if(_0x4f5b7e[_0x4d5e('0x14')][_0x4d5e('0x15')]===0x1f4){logger[_0x4d5e('0x14')](_0x4d5e('0xf'),_0x205534,_0x4f5b7e[_0x4d5e('0x14')][_0x4d5e('0x16')]);return _0x2bb844(_0x4f5b7e['error']['message']);}logger['error'](_0x4d5e('0xf'),_0x205534,_0x4f5b7e[_0x4d5e('0x14')][_0x4d5e('0x16')]);return _0x4b4f25(_0x4f5b7e['error'][_0x4d5e('0x16')]);}else{logger[_0x4d5e('0x17')](_0x4d5e('0xf'),_0x205534,'request\x20sent');_0x4b4f25(_0x4f5b7e[_0x4d5e('0x18')][_0x4d5e('0x16')]);}})[_0x4d5e('0x19')](function(_0xb409aa){logger[_0x4d5e('0x14')](_0x4d5e('0xf'),_0x205534,_0xb409aa);_0x2bb844(_0xb409aa);});});} \ No newline at end of file +var _0x4099=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x42aec1,_0x95b2bc){var _0x2edb01=function(_0x353b6f){while(--_0x353b6f){_0x42aec1['push'](_0x42aec1['shift']());}};_0x2edb01(++_0x95b2bc);}(_0x4099,0x1b4));var _0x9409=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x4099[_0xb301d4];return _0x3b5bde;};'use strict';var _=require('lodash');var util=require(_0x9409('0x0'));var moment=require(_0x9409('0x1'));var BPromise=require(_0x9409('0x2'));var rs=require(_0x9409('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9409('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9409('0x5'))(_0x9409('0x6'));var config=require(_0x9409('0x7'));var jayson=require(_0x9409('0x8'));var client=jayson[_0x9409('0x9')][_0x9409('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bee41,_0x2df2e6,_0x3a9ecc){return new BPromise(function(_0x3633ec,_0x3ec1b3){return client[_0x9409('0xb')](_0x3bee41,_0x3a9ecc)[_0x9409('0xc')](function(_0x28cead){logger[_0x9409('0xd')](_0x9409('0xe'),_0x2df2e6,_0x9409('0xf'));logger[_0x9409('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2df2e6,_0x9409('0xf'),JSON[_0x9409('0x11')](_0x28cead));if(_0x28cead[_0x9409('0x12')]){if(_0x28cead[_0x9409('0x12')][_0x9409('0x13')]===0x1f4){logger['error'](_0x9409('0xe'),_0x2df2e6,_0x28cead[_0x9409('0x12')][_0x9409('0x14')]);return _0x3ec1b3(_0x28cead[_0x9409('0x12')][_0x9409('0x14')]);}logger[_0x9409('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2df2e6,_0x28cead[_0x9409('0x12')][_0x9409('0x14')]);return _0x3633ec(_0x28cead['error'][_0x9409('0x14')]);}else{logger[_0x9409('0xd')](_0x9409('0xe'),_0x2df2e6,_0x9409('0xf'));_0x3633ec(_0x28cead[_0x9409('0x15')]['message']);}})[_0x9409('0x16')](function(_0x5072c8){logger[_0x9409('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2df2e6,_0x5072c8);_0x3ec1b3(_0x5072c8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e9ff794..9673f6a 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 _0x4242=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4242,0xb5));var _0x2424=function(_0x3f22a2,_0x4523ba){_0x3f22a2=_0x3f22a2-0x0;var _0x414a88=_0x4242[_0x3f22a2];return _0x414a88;};'use strict';var multer=require(_0x2424('0x0'));var util=require(_0x2424('0x1'));var path=require(_0x2424('0x2'));var timeout=require(_0x2424('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2424('0x4'));var auth=require(_0x2424('0x5'));var interaction=require(_0x2424('0x6'));var config=require('../../config/environment');var controller=require(_0x2424('0x7'));router[_0x2424('0x8')]('/',auth[_0x2424('0x9')](),controller[_0x2424('0xa')]);router[_0x2424('0x8')]('/:id',auth[_0x2424('0x9')](),controller['show']);router['get'](_0x2424('0xb'),auth[_0x2424('0x9')](),controller[_0x2424('0xc')]);router['get'](_0x2424('0xd'),auth['isAuthenticated'](),controller[_0x2424('0xe')]);router['post']('/',auth[_0x2424('0x9')](),controller[_0x2424('0xf')]);router['post']('/:id/configurations',auth[_0x2424('0x9')](),controller['addConfiguration']);router[_0x2424('0x10')](_0x2424('0x11'),auth['isAuthenticated'](),controller[_0x2424('0x12')]);router[_0x2424('0x13')](_0x2424('0x11'),auth[_0x2424('0x9')](),controller[_0x2424('0x14')]);module[_0x2424('0x15')]=router; \ No newline at end of file +var _0x9965=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x9965,0xf4));var _0x5996=function(_0x1c37e7,_0x389d80){_0x1c37e7=_0x1c37e7-0x0;var _0x245086=_0x9965[_0x1c37e7];return _0x245086;};'use strict';var multer=require(_0x5996('0x0'));var util=require(_0x5996('0x1'));var path=require(_0x5996('0x2'));var timeout=require(_0x5996('0x3'));var express=require(_0x5996('0x4'));var router=express['Router']();var fs_extra=require(_0x5996('0x5'));var auth=require(_0x5996('0x6'));var interaction=require(_0x5996('0x7'));var config=require(_0x5996('0x8'));var controller=require(_0x5996('0x9'));router[_0x5996('0xa')]('/',auth['isAuthenticated'](),controller[_0x5996('0xb')]);router[_0x5996('0xa')](_0x5996('0xc'),auth[_0x5996('0xd')](),controller[_0x5996('0xe')]);router[_0x5996('0xa')](_0x5996('0xf'),auth[_0x5996('0xd')](),controller[_0x5996('0x10')]);router[_0x5996('0xa')](_0x5996('0x11'),auth['isAuthenticated'](),controller[_0x5996('0x12')]);router[_0x5996('0x13')]('/',auth[_0x5996('0xd')](),controller[_0x5996('0x14')]);router[_0x5996('0x13')](_0x5996('0xf'),auth[_0x5996('0xd')](),controller[_0x5996('0x15')]);router[_0x5996('0x16')]('/:id',auth[_0x5996('0xd')](),controller[_0x5996('0x17')]);router[_0x5996('0x18')](_0x5996('0xc'),auth[_0x5996('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index dc00269..112753d 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 _0x96ef=['remoteUri','sequelize','exports','STRING','username'];(function(_0x56c4de,_0xf1c874){var _0xd799af=function(_0x30fb9){while(--_0x30fb9){_0x56c4de['push'](_0x56c4de['shift']());}};_0xd799af(++_0xf1c874);}(_0x96ef,0x1af));var _0xf96e=function(_0x283207,_0x49af8f){_0x283207=_0x283207-0x0;var _0x489530=_0x96ef[_0x283207];return _0x489530;};'use strict';var Sequelize=require(_0xf96e('0x0'));module[_0xf96e('0x1')]={'name':{'type':Sequelize[_0xf96e('0x2')]},'description':{'type':Sequelize[_0xf96e('0x2')]},'username':{'type':Sequelize[_0xf96e('0x2')],'unique':_0xf96e('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf96e('0x2')]},'remoteUri':{'type':Sequelize[_0xf96e('0x2')],'unique':_0xf96e('0x4')},'serverUrl':{'type':Sequelize[_0xf96e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3b58=['username','exports','STRING'];(function(_0x2e5190,_0x411127){var _0x21f04e=function(_0x40baf6){while(--_0x40baf6){_0x2e5190['push'](_0x2e5190['shift']());}};_0x21f04e(++_0x411127);}(_0x3b58,0x8b));var _0x83b5=function(_0x42a6f4,_0x495631){_0x42a6f4=_0x42a6f4-0x0;var _0x3d1d00=_0x3b58[_0x42a6f4];return _0x3d1d00;};'use strict';var Sequelize=require('sequelize');module[_0x83b5('0x0')]={'name':{'type':Sequelize[_0x83b5('0x1')]},'description':{'type':Sequelize[_0x83b5('0x1')]},'username':{'type':Sequelize[_0x83b5('0x1')],'unique':_0x83b5('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x83b5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x83b5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7662ad7..5de7d3e 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 _0x246e=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','catch','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','activity_due','assigned_to','approval','comments_and_work_notes','reopen_count','sys_tags','upon_approval','correlation_id','location','category','password','email','serverUrl','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','username','GET','result','log','assign','remove','forEach','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','concat','ServiceNow\x20error:\x20','test','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x246e,0x162));var _0xe246=function(_0x142304,_0x4119af){_0x142304=_0x142304-0x0;var _0x29af3c=_0x246e[_0x142304];return _0x29af3c;};'use strict';var emlformat=require(_0xe246('0x0'));var rimraf=require(_0xe246('0x1'));var zipdir=require(_0xe246('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe246('0x3'));var BPromise=require(_0xe246('0x4'));var Mustache=require(_0xe246('0x5'));var util=require(_0xe246('0x6'));var path=require(_0xe246('0x7'));var sox=require(_0xe246('0x8'));var csv=require(_0xe246('0x9'));var ejs=require(_0xe246('0xa'));var fs=require('fs');var fs_extra=require(_0xe246('0xb'));var _=require(_0xe246('0xc'));var squel=require(_0xe246('0xd'));var crypto=require(_0xe246('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe246('0xf'));var toCsv=require(_0xe246('0x9'));var querystring=require(_0xe246('0x10'));var Papa=require(_0xe246('0x11'));var Redis=require(_0xe246('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe246('0x13'));var hardwareService=require(_0xe246('0x14'));var logger=require('../../config/logger')(_0xe246('0x15'));var utils=require(_0xe246('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe246('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe246('0x18'));function respondWithStatusCode(_0x28aacd,_0x11ce2b){_0x11ce2b=_0x11ce2b||0xcc;return function(_0x2171a0){if(_0x2171a0){return _0x28aacd[_0xe246('0x19')](_0x11ce2b);}return _0x28aacd[_0xe246('0x1a')](_0x11ce2b)[_0xe246('0x1b')]();};}function respondWithResult(_0x16c352,_0x4e40b8){_0x4e40b8=_0x4e40b8||0xc8;return function(_0x3ebed3){if(_0x3ebed3){return _0x16c352['status'](_0x4e40b8)[_0xe246('0x1c')](_0x3ebed3);}};}function respondWithFilteredResult(_0x315ef3,_0x33053f){return function(_0x5b7ca1){if(_0x5b7ca1){var _0x15ea9b=typeof _0x33053f[_0xe246('0x1d')]===_0xe246('0x1e')&&typeof _0x33053f[_0xe246('0x1f')]===_0xe246('0x1e');var _0x1e2ab3=_0x5b7ca1['count'];var _0x593a15=_0x15ea9b?0x0:_0x33053f[_0xe246('0x1d')];var _0x4af6bc=_0x15ea9b?_0x5b7ca1[_0xe246('0x20')]:_0x33053f[_0xe246('0x1d')]+_0x33053f[_0xe246('0x1f')];var _0x1a772d;if(_0x4af6bc>=_0x1e2ab3){_0x4af6bc=_0x1e2ab3;_0x1a772d=0xc8;}else{_0x1a772d=0xce;}_0x315ef3[_0xe246('0x1a')](_0x1a772d);return _0x315ef3[_0xe246('0x21')](_0xe246('0x22'),_0x593a15+'-'+_0x4af6bc+'/'+_0x1e2ab3)[_0xe246('0x1c')](_0x5b7ca1);}return null;};}function patchUpdates(_0x5f3620){return function(_0x2edc44){try{jsonpatch[_0xe246('0x23')](_0x2edc44,_0x5f3620,!![]);}catch(_0x391b05){return BPromise[_0xe246('0x24')](_0x391b05);}return _0x2edc44[_0xe246('0x25')]();};}function saveUpdates(_0x3addd5,_0x7bb0df){return function(_0x19e0c6){if(_0x19e0c6){return _0x19e0c6[_0xe246('0x26')](_0x3addd5)[_0xe246('0x27')](function(_0x4c7d43){return _0x4c7d43;});}return null;};}function removeEntity(_0x341073,_0x1ce1b){return function(_0x22cc29){if(_0x22cc29){return _0x22cc29[_0xe246('0x28')]()[_0xe246('0x27')](function(){_0x341073[_0xe246('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17de1e,_0x9c0283){return function(_0x20eeb7){if(!_0x20eeb7){_0x17de1e[_0xe246('0x19')](0x194);}return _0x20eeb7;};}function handleError(_0x264284,_0x5e81ed){_0x5e81ed=_0x5e81ed||0x1f4;return function(_0x5b9fdd){logger[_0xe246('0x29')](_0x5b9fdd[_0xe246('0x2a')]);if(_0x5b9fdd[_0xe246('0x2b')]){delete _0x5b9fdd[_0xe246('0x2b')];}_0x264284[_0xe246('0x1a')](_0x5e81ed)[_0xe246('0x2c')](_0x5b9fdd);};}exports[_0xe246('0x2d')]=function(_0x548987,_0xfcb77b){var _0x26f27f={},_0x17f216={},_0x439240={'count':0x0,'rows':[]};var _0x48b665=_[_0xe246('0x2e')](db[_0xe246('0x2f')]['rawAttributes'],function(_0x7476f5){return{'name':_0x7476f5[_0xe246('0x30')],'type':_0x7476f5[_0xe246('0x31')][_0xe246('0x32')]};});_0x17f216[_0xe246('0x33')]=_[_0xe246('0x2e')](_0x48b665,_0xe246('0x2b'));_0x17f216[_0xe246('0x34')]=_[_0xe246('0x35')](_0x548987[_0xe246('0x34')]);_0x17f216[_0xe246('0x36')]=_[_0xe246('0x37')](_0x17f216[_0xe246('0x33')],_0x17f216[_0xe246('0x34')]);_0x26f27f[_0xe246('0x38')]=_[_0xe246('0x37')](_0x17f216[_0xe246('0x33')],qs[_0xe246('0x39')](_0x548987['query'][_0xe246('0x39')]));_0x26f27f[_0xe246('0x38')]=_0x26f27f[_0xe246('0x38')][_0xe246('0x3a')]?_0x26f27f[_0xe246('0x38')]:_0x17f216[_0xe246('0x33')];if(!_0x548987['query'][_0xe246('0x3b')](_0xe246('0x3c'))){_0x26f27f[_0xe246('0x1f')]=qs[_0xe246('0x1f')](_0x548987[_0xe246('0x34')][_0xe246('0x1f')]);_0x26f27f['offset']=qs[_0xe246('0x1d')](_0x548987[_0xe246('0x34')][_0xe246('0x1d')]);}_0x26f27f[_0xe246('0x3d')]=qs[_0xe246('0x3e')](_0x548987['query'][_0xe246('0x3e')]);_0x26f27f[_0xe246('0x3f')]=qs[_0xe246('0x36')](_['pick'](_0x548987[_0xe246('0x34')],_0x17f216[_0xe246('0x36')]),_0x48b665);if(_0x548987[_0xe246('0x34')][_0xe246('0x40')]){_0x26f27f[_0xe246('0x3f')]=_['merge'](_0x26f27f[_0xe246('0x3f')],{'$or':_[_0xe246('0x2e')](_0x48b665,function(_0x4a4ee6){if(_0x4a4ee6[_0xe246('0x31')]!==_0xe246('0x41')){var _0x19ce6f={};_0x19ce6f[_0x4a4ee6[_0xe246('0x2b')]]={'$like':'%'+_0x548987[_0xe246('0x34')][_0xe246('0x40')]+'%'};return _0x19ce6f;}})});}_0x26f27f=_[_0xe246('0x42')]({},_0x26f27f,_0x548987[_0xe246('0x43')]);var _0x4444ec={'where':_0x26f27f[_0xe246('0x3f')]};return db[_0xe246('0x2f')][_0xe246('0x20')](_0x4444ec)[_0xe246('0x27')](function(_0x1e3239){_0x439240['count']=_0x1e3239;if(_0x548987[_0xe246('0x34')][_0xe246('0x44')]){_0x26f27f[_0xe246('0x45')]=[{'all':!![]}];}return db[_0xe246('0x2f')]['findAll'](_0x26f27f);})[_0xe246('0x27')](function(_0x2afee2){_0x439240[_0xe246('0x46')]=_0x2afee2;return _0x439240;})['then'](respondWithFilteredResult(_0xfcb77b,_0x26f27f))['catch'](handleError(_0xfcb77b,null));};exports[_0xe246('0x47')]=function(_0x50a71d,_0x4fe7c6){var _0x44996b={'raw':![],'where':{'id':_0x50a71d[_0xe246('0x48')]['id']}},_0x570feb={};_0x570feb[_0xe246('0x33')]=_[_0xe246('0x35')](db[_0xe246('0x2f')][_0xe246('0x49')]);_0x570feb[_0xe246('0x34')]=_[_0xe246('0x35')](_0x50a71d[_0xe246('0x34')]);_0x570feb[_0xe246('0x36')]=_['intersection'](_0x570feb['model'],_0x570feb[_0xe246('0x34')]);_0x44996b[_0xe246('0x38')]=_[_0xe246('0x37')](_0x570feb[_0xe246('0x33')],qs[_0xe246('0x39')](_0x50a71d[_0xe246('0x34')][_0xe246('0x39')]));_0x44996b[_0xe246('0x38')]=_0x44996b[_0xe246('0x38')][_0xe246('0x3a')]?_0x44996b[_0xe246('0x38')]:_0x570feb[_0xe246('0x33')];if(_0x50a71d[_0xe246('0x34')]['includeAll']){_0x44996b[_0xe246('0x45')]=[{'all':!![]}];}_0x44996b=_[_0xe246('0x42')]({},_0x44996b,_0x50a71d[_0xe246('0x43')]);return db['ServicenowAccount'][_0xe246('0x4a')](_0x44996b)['then'](handleEntityNotFound(_0x4fe7c6,null))['then'](respondWithResult(_0x4fe7c6,null))['catch'](handleError(_0x4fe7c6,null));};exports[_0xe246('0x4b')]=function(_0x1d1341,_0x2f8b33){return db[_0xe246('0x2f')][_0xe246('0x4b')](_0x1d1341[_0xe246('0x4c')],{})['then'](respondWithResult(_0x2f8b33,0xc9))[_0xe246('0x4d')](handleError(_0x2f8b33,null));};exports['update']=function(_0x1fbee8,_0x1540f4){if(_0x1fbee8[_0xe246('0x4c')]['id']){delete _0x1fbee8[_0xe246('0x4c')]['id'];}return db['ServicenowAccount'][_0xe246('0x4a')]({'where':{'id':_0x1fbee8[_0xe246('0x48')]['id']}})[_0xe246('0x27')](handleEntityNotFound(_0x1540f4,null))[_0xe246('0x27')](saveUpdates(_0x1fbee8[_0xe246('0x4c')],null))[_0xe246('0x27')](respondWithResult(_0x1540f4,null))[_0xe246('0x4d')](handleError(_0x1540f4,null));};exports[_0xe246('0x28')]=function(_0x125cc6,_0xae20f){return db[_0xe246('0x2f')]['find']({'where':{'id':_0x125cc6['params']['id']}})['then'](handleEntityNotFound(_0xae20f,null))[_0xe246('0x27')](removeEntity(_0xae20f,null))['catch'](handleError(_0xae20f,null));};exports[_0xe246('0x4e')]=function(_0x9cbaf2,_0x1bdc13,_0x4e7743){var _0x17b679={};var _0x1f3652={};var _0x201189;var _0x596a5f;return db[_0xe246('0x2f')][_0xe246('0x4f')]({'where':{'id':_0x9cbaf2['params']['id']}})[_0xe246('0x27')](handleEntityNotFound(_0x1bdc13,null))[_0xe246('0x27')](function(_0x839bd8){if(_0x839bd8){_0x201189=_0x839bd8;_0x1f3652[_0xe246('0x33')]=_['keys'](db['ServicenowConfiguration'][_0xe246('0x49')]);_0x1f3652[_0xe246('0x34')]=_[_0xe246('0x35')](_0x9cbaf2[_0xe246('0x34')]);_0x1f3652[_0xe246('0x36')]=_[_0xe246('0x37')](_0x1f3652[_0xe246('0x33')],_0x1f3652['query']);_0x17b679[_0xe246('0x38')]=_['intersection'](_0x1f3652[_0xe246('0x33')],qs[_0xe246('0x39')](_0x9cbaf2[_0xe246('0x34')][_0xe246('0x39')]));_0x17b679[_0xe246('0x38')]=_0x17b679[_0xe246('0x38')][_0xe246('0x3a')]?_0x17b679[_0xe246('0x38')]:_0x1f3652[_0xe246('0x33')];_0x17b679['order']=qs[_0xe246('0x3e')](_0x9cbaf2[_0xe246('0x34')][_0xe246('0x3e')]);_0x17b679[_0xe246('0x3f')]=qs['filters'](_[_0xe246('0x50')](_0x9cbaf2[_0xe246('0x34')],_0x1f3652[_0xe246('0x36')]));if(_0x9cbaf2[_0xe246('0x34')][_0xe246('0x40')]){_0x17b679[_0xe246('0x3f')]=_[_0xe246('0x42')](_0x17b679[_0xe246('0x3f')],{'$or':_[_0xe246('0x2e')](_0x17b679[_0xe246('0x38')],function(_0x48f15d){var _0x4a4de2={};_0x4a4de2[_0x48f15d]={'$like':'%'+_0x9cbaf2[_0xe246('0x34')]['filter']+'%'};return _0x4a4de2;})});}_0x17b679=_[_0xe246('0x42')]({},_0x17b679,_0x9cbaf2[_0xe246('0x43')]);return _0x201189[_0xe246('0x4e')](_0x17b679);}})[_0xe246('0x27')](function(_0x245789){if(_0x245789){_0x596a5f=_0x245789[_0xe246('0x3a')];if(!_0x9cbaf2[_0xe246('0x34')]['hasOwnProperty']('nolimit')){_0x17b679[_0xe246('0x1f')]=qs[_0xe246('0x1f')](_0x9cbaf2['query'][_0xe246('0x1f')]);_0x17b679[_0xe246('0x1d')]=qs['offset'](_0x9cbaf2['query']['offset']);}return _0x201189[_0xe246('0x4e')](_0x17b679);}})[_0xe246('0x27')](function(_0x4e7929){if(_0x4e7929){return _0x4e7929?{'count':_0x596a5f,'rows':_0x4e7929}:null;}})[_0xe246('0x27')](respondWithResult(_0x1bdc13,null))[_0xe246('0x4d')](handleError(_0x1bdc13,null));};exports[_0xe246('0x51')]=function(_0x5c92c0,_0xa371a1,_0x30db78){if(_0x5c92c0[_0xe246('0x4c')]['id']){delete _0x5c92c0[_0xe246('0x4c')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5c92c0['params']['id']}})[_0xe246('0x27')](handleEntityNotFound(_0xa371a1,null))[_0xe246('0x27')](function(_0x35c399){if(_0x35c399){_0x5c92c0['body'][_0xe246('0x52')]=_0x35c399['id'];_0x5c92c0[_0xe246('0x4c')][_0xe246('0x53')]=integrations[_0xe246('0x54')](_0x5c92c0['body'][_0xe246('0x55')],_0x5c92c0['body'][_0xe246('0x31')]);_0x5c92c0['body'][_0xe246('0x56')]=integrations[_0xe246('0x57')](_0x5c92c0[_0xe246('0x4c')][_0xe246('0x55')],_0x5c92c0['body'][_0xe246('0x31')]);return db[_0xe246('0x58')][_0xe246('0x4b')](_0x5c92c0[_0xe246('0x4c')],{'include':[{'model':db[_0xe246('0x59')],'as':_0xe246('0x53')},{'model':db[_0xe246('0x59')],'as':_0xe246('0x56')}]});}return null;})[_0xe246('0x27')](respondWithResult(_0xa371a1,null))[_0xe246('0x4d')](handleError(_0xa371a1,null));};exports[_0xe246('0x5a')]=function(_0x5c6781,_0x3de6ac,_0x2573b6){var _0xd0df63=[_0xe246('0x5b'),_0xe246('0x5c'),_0xe246('0x5d'),_0xe246('0x5e'),_0xe246('0x5f'),_0xe246('0x60'),_0xe246('0x61'),_0xe246('0x62'),'category'];var _0xc13d08=[_0xe246('0x63'),_0xe246('0x5b'),_0xe246('0x64'),_0xe246('0x65'),'upon_reject',_0xe246('0x66'),_0xe246('0x67'),'hold_reason',_0xe246('0x68'),'number',_0xe246('0x69'),_0xe246('0x6a'),_0xe246('0x6b'),_0xe246('0x6c'),_0xe246('0x6d'),'sys_domain',_0xe246('0x6e'),_0xe246('0x6f'),_0xe246('0x5d'),_0xe246('0x3d'),'calendar_stc',_0xe246('0x70'),_0xe246('0x71'),_0xe246('0x72'),_0xe246('0x73'),_0xe246('0x74'),_0xe246('0x75'),'business_service',_0xe246('0x76'),_0xe246('0x77'),'rfc',_0xe246('0x78'),_0xe246('0x79'),'opened_at',_0xe246('0x7a'),_0xe246('0x7b'),_0xe246('0x7c'),_0xe246('0x7d'),_0xe246('0x7e'),_0xe246('0x7f'),_0xe246('0x80'),'subcategory',_0xe246('0x81'),_0xe246('0x82'),_0xe246('0x5f'),_0xe246('0x83'),_0xe246('0x84'),_0xe246('0x85'),'assignment_group',_0xe246('0x86'),_0xe246('0x87'),_0xe246('0x88'),'calendar_duration',_0xe246('0x60'),'sys_class_name',_0xe246('0x89'),_0xe246('0x8a'),_0xe246('0x8b'),_0xe246('0x8c'),_0xe246('0x8d'),_0xe246('0x8e'),_0xe246('0x8f'),_0xe246('0x61'),'urgency',_0xe246('0x90'),_0xe246('0x91'),'reassignment_count',_0xe246('0x92'),_0xe246('0x93'),_0xe246('0x62'),'comments','sla_due',_0xe246('0x94'),_0xe246('0x95'),'due_date','sys_mod_count',_0xe246('0x96'),_0xe246('0x97'),'escalation',_0xe246('0x98'),_0xe246('0x99'),_0xe246('0x9a'),_0xe246('0x9b')];var _0x50c1a3='';var _0xc37362='';var _0x5d64b0=[];var _0x4c97f2='';var _0x13bd74='';var _0x17e69e=[];var _0x2ca3ee='';var _0x1e723e='';var _0x52678d={};var _0x328fcf='';return db[_0xe246('0x2f')][_0xe246('0x4f')]({'where':{'id':_0x5c6781[_0xe246('0x48')]['id']},'attributes':['id','username',_0xe246('0x9c'),_0xe246('0x9d'),'remoteUri',_0xe246('0x9e')]})[_0xe246('0x27')](handleEntityNotFound(_0x3de6ac,null))[_0xe246('0x27')](function(_0x528154){if(_0x528154){_0x328fcf=_0x528154[_0xe246('0x9f')];var _0x4ff999=_0x328fcf[_0xe246('0xa0')](-0x1);if(_0x4ff999==='/'){_0x328fcf=_0x328fcf['substring'](0x0,_0x328fcf[_0xe246('0xa1')](_0x4ff999));}_0x1e723e=util['format'](_0xe246('0xa2'),_0x328fcf);_0x2ca3ee=util[_0xe246('0xa3')]('%s/api/now/table/',_0x328fcf);_0x52678d={'user':_0x528154[_0xe246('0xa4')],'pass':_0x528154[_0xe246('0x9c')]};var _0x390629={'method':_0xe246('0xa5'),'uri':_0x1e723e+'incident?sysparm_display_value=all','auth':_0x52678d,'json':!![]};return rp(_0x390629);}})['then'](function(_0xfbcd85){if(_0xfbcd85['result'][_0xe246('0x3a')]>0x0){_0x50c1a3=_0xfbcd85[_0xe246('0xa6')];}console[_0xe246('0xa7')]('incident\x20table\x20objects',_0x50c1a3);_0x17e69e=[];_0xc37362=Object[_0xe246('0xa8')]([],_0x50c1a3);_[_0xe246('0xa9')](_0xc37362,function(_0x12581b){return!_0xd0df63['includes'](_0x12581b['name']);});_0xc37362[_0xe246('0xaa')](function(_0x1cb9ae){var _0x4456b1=createFieldObject(_0x2ca3ee,_0x52678d,_0x1cb9ae['internalType'],_0x1cb9ae['name'],_0x1cb9ae['label'],![]);_0x17e69e[_0xe246('0xab')](_0x4456b1);});return Promise[_0xe246('0xac')](_0x17e69e);})[_0xe246('0x27')](function(_0x29737b){_0x5d64b0=_0x29737b;_0x4c97f2=Object[_0xe246('0xa8')]([],_0x50c1a3);console[_0xe246('0xa7')](_0xe246('0xad'),_0x50c1a3);_[_0xe246('0xa9')](_0x4c97f2,function(_0x3952be){return _0xc13d08['includes'](_0x3952be[_0xe246('0x2b')]);});console[_0xe246('0xa7')](_0xe246('0xae'),_0x4c97f2);_0x17e69e=[];_0x4c97f2[_0xe246('0xaa')](function(_0x1e4b80){var _0x485381=createFieldObject(_0x2ca3ee,_0x52678d,_0x1e4b80[_0xe246('0xaf')],_0x1e4b80['name'],_0x1e4b80[_0xe246('0xb0')],!![]);_0x17e69e['push'](_0x485381);});return Promise[_0xe246('0xac')](_0x17e69e);})[_0xe246('0x27')](function(_0x18909f){_0x13bd74=_0x18909f;var _0x19a5e4=_0x5d64b0[_0xe246('0xb1')](_0x13bd74);return{'count':_0x19a5e4[_0xe246('0x3a')],'rows':_0x19a5e4};})['then'](respondWithResult(_0x3de6ac,null))[_0xe246('0x4d')](function(_0x1fdc5a){console[_0xe246('0xa7')](_0xe246('0xb2')+_0x1fdc5a);var _0x45385d=_0x5c6781[_0xe246('0x34')][_0xe246('0xb3')]?0x1f4:_0x1fdc5a['statusCode']||0x1f4;logger[_0xe246('0x29')](_0x1fdc5a[_0xe246('0x2a')]);delete _0x1fdc5a[_0xe246('0x2b')];if(_0x45385d===0x191){_0x45385d=0x190;}_0x3de6ac[_0xe246('0x1a')](_0x45385d)[_0xe246('0x2c')](_0x5c6781[_0xe246('0x34')][_0xe246('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0x1fdc5a['statusCode']}:_0x1fdc5a);});};function createFieldObject(_0x271501,_0x28616c,_0x59d473,_0x4ffd23,_0xa5b15,_0x251ccd){return new Promise(function(_0x5697d5,_0x4ebdf5){var _0x2e57f3={'id':_0x4ffd23,'name':_0xa5b15,'custom':_0x251ccd};if(_0x59d473==='boolean'){_0x2e57f3[_0xe246('0x43')]=[{'name':_0xe246('0xb4'),'value':'true'},{'name':_0xe246('0xb5'),'value':_0xe246('0xb6')}];_0x5697d5(_0x2e57f3);}else{var _0x354451={'method':_0xe246('0xa5'),'uri':_0x271501+_0xe246('0xb7')+_0x4ffd23,'auth':_0x28616c,'json':!![]};return rp(_0x354451)[_0xe246('0x27')](function(_0x2a71cd){var _0x5787f6=[];if(_0x2a71cd[_0xe246('0xa6')][_0xe246('0x3a')]>0x0){_0x2a71cd['result'][_0xe246('0xaa')](function(_0x4fdfea){if(_0x4fdfea[_0xe246('0xb8')]===_0xe246('0xb6')){var _0x5e841b={'name':_0x4fdfea[_0xe246('0xb0')],'value':_0x4fdfea[_0xe246('0xb9')]};_0x5787f6[_0xe246('0xab')](_0x5e841b);}});}_0x2e57f3[_0xe246('0x43')]=_0x5787f6;if(_0x2e57f3['options']['length']>0x0){_0x5697d5(_0x2e57f3);}else{if(_0x251ccd==![]){_0x5697d5();}else{_0x5697d5(_0x2e57f3);}}});}});} \ No newline at end of file +var _0x1b1c=['correlation_display','delivery_task','work_start','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','GET','result','log','incident\x20table\x20objects','assign','push','TCL:\x20_object','remove','forEach','internalType','label','all','concat','test','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','limit','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','filter','where','VIRTUAL','merge','ServicenowAccount','includeAll','findAll','rows','catch','show','length','include','options','find','create','body','params','destroy','findOne','ServicenowConfiguration','order','pick','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','work_notes','short_description'];(function(_0x43e830,_0x4d23d2){var _0x251875=function(_0x9e09bd){while(--_0x9e09bd){_0x43e830['push'](_0x43e830['shift']());}};_0x251875(++_0x4d23d2);}(_0x1b1c,0xf6));var _0xc1b1=function(_0xb598fd,_0x57515c){_0xb598fd=_0xb598fd-0x0;var _0x17bbb8=_0x1b1c[_0xb598fd];return _0x17bbb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1b1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc1b1('0x1'));var moment=require('moment');var BPromise=require(_0xc1b1('0x2'));var Mustache=require(_0xc1b1('0x3'));var util=require(_0xc1b1('0x4'));var path=require(_0xc1b1('0x5'));var sox=require(_0xc1b1('0x6'));var csv=require(_0xc1b1('0x7'));var ejs=require(_0xc1b1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1b1('0x9'));var squel=require(_0xc1b1('0xa'));var crypto=require(_0xc1b1('0xb'));var jsforce=require(_0xc1b1('0xc'));var deskjs=require(_0xc1b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc1b1('0xe'));var Papa=require(_0xc1b1('0xf'));var Redis=require(_0xc1b1('0x10'));var authService=require(_0xc1b1('0x11'));var qs=require(_0xc1b1('0x12'));var as=require(_0xc1b1('0x13'));var hardwareService=require(_0xc1b1('0x14'));var logger=require(_0xc1b1('0x15'))(_0xc1b1('0x16'));var utils=require(_0xc1b1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc1b1('0x18'));var db=require(_0xc1b1('0x19'))['db'];var integrations=require(_0xc1b1('0x1a'));function respondWithStatusCode(_0x18c822,_0x3e2170){_0x3e2170=_0x3e2170||0xcc;return function(_0x5205a5){if(_0x5205a5){return _0x18c822[_0xc1b1('0x1b')](_0x3e2170);}return _0x18c822['status'](_0x3e2170)[_0xc1b1('0x1c')]();};}function respondWithResult(_0x47e459,_0x2cc852){_0x2cc852=_0x2cc852||0xc8;return function(_0x34b2b5){if(_0x34b2b5){return _0x47e459[_0xc1b1('0x1d')](_0x2cc852)['json'](_0x34b2b5);}};}function respondWithFilteredResult(_0x46d9d7,_0x24479d){return function(_0x5c3051){if(_0x5c3051){var _0x192bd8=typeof _0x24479d['offset']==='undefined'&&typeof _0x24479d[_0xc1b1('0x1e')]==='undefined';var _0x45c39f=_0x5c3051[_0xc1b1('0x1f')];var _0x22b852=_0x192bd8?0x0:_0x24479d[_0xc1b1('0x20')];var _0x124800=_0x192bd8?_0x5c3051[_0xc1b1('0x1f')]:_0x24479d[_0xc1b1('0x20')]+_0x24479d[_0xc1b1('0x1e')];var _0x5bb270;if(_0x124800>=_0x45c39f){_0x124800=_0x45c39f;_0x5bb270=0xc8;}else{_0x5bb270=0xce;}_0x46d9d7['status'](_0x5bb270);return _0x46d9d7['set'](_0xc1b1('0x21'),_0x22b852+'-'+_0x124800+'/'+_0x45c39f)['json'](_0x5c3051);}return null;};}function patchUpdates(_0x42effe){return function(_0x1e49a4){try{jsonpatch[_0xc1b1('0x22')](_0x1e49a4,_0x42effe,!![]);}catch(_0x188851){return BPromise[_0xc1b1('0x23')](_0x188851);}return _0x1e49a4[_0xc1b1('0x24')]();};}function saveUpdates(_0x4ce230,_0x288bcd){return function(_0x3f119e){if(_0x3f119e){return _0x3f119e[_0xc1b1('0x25')](_0x4ce230)[_0xc1b1('0x26')](function(_0x42768a){return _0x42768a;});}return null;};}function removeEntity(_0x106fe9,_0x5ba499){return function(_0x2e83bf){if(_0x2e83bf){return _0x2e83bf['destroy']()[_0xc1b1('0x26')](function(){_0x106fe9[_0xc1b1('0x1d')](0xcc)[_0xc1b1('0x1c')]();});}};}function handleEntityNotFound(_0x29754e,_0x232189){return function(_0x2afcda){if(!_0x2afcda){_0x29754e[_0xc1b1('0x1b')](0x194);}return _0x2afcda;};}function handleError(_0x5e7d12,_0xd85d31){_0xd85d31=_0xd85d31||0x1f4;return function(_0x1db724){logger[_0xc1b1('0x27')](_0x1db724[_0xc1b1('0x28')]);if(_0x1db724[_0xc1b1('0x29')]){delete _0x1db724['name'];}_0x5e7d12['status'](_0xd85d31)['send'](_0x1db724);};}exports[_0xc1b1('0x2a')]=function(_0x33a2d9,_0x27696e){var _0x270f08={},_0x5700fd={},_0x3fde20={'count':0x0,'rows':[]};var _0x9a33fa=_[_0xc1b1('0x2b')](db['ServicenowAccount'][_0xc1b1('0x2c')],function(_0x1ea9be){return{'name':_0x1ea9be[_0xc1b1('0x2d')],'type':_0x1ea9be[_0xc1b1('0x2e')][_0xc1b1('0x2f')]};});_0x5700fd[_0xc1b1('0x30')]=_[_0xc1b1('0x2b')](_0x9a33fa,_0xc1b1('0x29'));_0x5700fd[_0xc1b1('0x31')]=_[_0xc1b1('0x32')](_0x33a2d9[_0xc1b1('0x31')]);_0x5700fd[_0xc1b1('0x33')]=_[_0xc1b1('0x34')](_0x5700fd[_0xc1b1('0x30')],_0x5700fd[_0xc1b1('0x31')]);_0x270f08['attributes']=_['intersection'](_0x5700fd['model'],qs[_0xc1b1('0x35')](_0x33a2d9['query'][_0xc1b1('0x35')]));_0x270f08[_0xc1b1('0x36')]=_0x270f08[_0xc1b1('0x36')]['length']?_0x270f08[_0xc1b1('0x36')]:_0x5700fd[_0xc1b1('0x30')];if(!_0x33a2d9[_0xc1b1('0x31')][_0xc1b1('0x37')]('nolimit')){_0x270f08[_0xc1b1('0x1e')]=qs['limit'](_0x33a2d9['query'][_0xc1b1('0x1e')]);_0x270f08['offset']=qs[_0xc1b1('0x20')](_0x33a2d9[_0xc1b1('0x31')][_0xc1b1('0x20')]);}_0x270f08['order']=qs[_0xc1b1('0x38')](_0x33a2d9['query'][_0xc1b1('0x38')]);_0x270f08['where']=qs['filters'](_['pick'](_0x33a2d9[_0xc1b1('0x31')],_0x5700fd[_0xc1b1('0x33')]),_0x9a33fa);if(_0x33a2d9['query'][_0xc1b1('0x39')]){_0x270f08[_0xc1b1('0x3a')]=_['merge'](_0x270f08['where'],{'$or':_[_0xc1b1('0x2b')](_0x9a33fa,function(_0x5367b6){if(_0x5367b6['type']!==_0xc1b1('0x3b')){var _0x47cfb6={};_0x47cfb6[_0x5367b6['name']]={'$like':'%'+_0x33a2d9[_0xc1b1('0x31')][_0xc1b1('0x39')]+'%'};return _0x47cfb6;}})});}_0x270f08=_[_0xc1b1('0x3c')]({},_0x270f08,_0x33a2d9['options']);var _0xe99e50={'where':_0x270f08[_0xc1b1('0x3a')]};return db[_0xc1b1('0x3d')][_0xc1b1('0x1f')](_0xe99e50)[_0xc1b1('0x26')](function(_0x534c64){_0x3fde20[_0xc1b1('0x1f')]=_0x534c64;if(_0x33a2d9['query'][_0xc1b1('0x3e')]){_0x270f08['include']=[{'all':!![]}];}return db[_0xc1b1('0x3d')][_0xc1b1('0x3f')](_0x270f08);})[_0xc1b1('0x26')](function(_0x32206e){_0x3fde20[_0xc1b1('0x40')]=_0x32206e;return _0x3fde20;})[_0xc1b1('0x26')](respondWithFilteredResult(_0x27696e,_0x270f08))[_0xc1b1('0x41')](handleError(_0x27696e,null));};exports[_0xc1b1('0x42')]=function(_0xb4d05c,_0x1070e7){var _0xf2cd8f={'raw':![],'where':{'id':_0xb4d05c['params']['id']}},_0xb83f1e={};_0xb83f1e[_0xc1b1('0x30')]=_[_0xc1b1('0x32')](db['ServicenowAccount']['rawAttributes']);_0xb83f1e[_0xc1b1('0x31')]=_['keys'](_0xb4d05c['query']);_0xb83f1e['filters']=_[_0xc1b1('0x34')](_0xb83f1e[_0xc1b1('0x30')],_0xb83f1e[_0xc1b1('0x31')]);_0xf2cd8f[_0xc1b1('0x36')]=_[_0xc1b1('0x34')](_0xb83f1e['model'],qs[_0xc1b1('0x35')](_0xb4d05c[_0xc1b1('0x31')]['fields']));_0xf2cd8f[_0xc1b1('0x36')]=_0xf2cd8f[_0xc1b1('0x36')][_0xc1b1('0x43')]?_0xf2cd8f[_0xc1b1('0x36')]:_0xb83f1e['model'];if(_0xb4d05c[_0xc1b1('0x31')][_0xc1b1('0x3e')]){_0xf2cd8f[_0xc1b1('0x44')]=[{'all':!![]}];}_0xf2cd8f=_['merge']({},_0xf2cd8f,_0xb4d05c[_0xc1b1('0x45')]);return db[_0xc1b1('0x3d')][_0xc1b1('0x46')](_0xf2cd8f)['then'](handleEntityNotFound(_0x1070e7,null))[_0xc1b1('0x26')](respondWithResult(_0x1070e7,null))['catch'](handleError(_0x1070e7,null));};exports[_0xc1b1('0x47')]=function(_0x3b84a4,_0x369e57){return db['ServicenowAccount'][_0xc1b1('0x47')](_0x3b84a4[_0xc1b1('0x48')],{})[_0xc1b1('0x26')](respondWithResult(_0x369e57,0xc9))[_0xc1b1('0x41')](handleError(_0x369e57,null));};exports[_0xc1b1('0x25')]=function(_0x21b406,_0x48f0ec){if(_0x21b406[_0xc1b1('0x48')]['id']){delete _0x21b406['body']['id'];}return db[_0xc1b1('0x3d')][_0xc1b1('0x46')]({'where':{'id':_0x21b406[_0xc1b1('0x49')]['id']}})[_0xc1b1('0x26')](handleEntityNotFound(_0x48f0ec,null))[_0xc1b1('0x26')](saveUpdates(_0x21b406[_0xc1b1('0x48')],null))[_0xc1b1('0x26')](respondWithResult(_0x48f0ec,null))[_0xc1b1('0x41')](handleError(_0x48f0ec,null));};exports[_0xc1b1('0x4a')]=function(_0x218beb,_0x1d5f52){return db[_0xc1b1('0x3d')][_0xc1b1('0x46')]({'where':{'id':_0x218beb['params']['id']}})[_0xc1b1('0x26')](handleEntityNotFound(_0x1d5f52,null))[_0xc1b1('0x26')](removeEntity(_0x1d5f52,null))[_0xc1b1('0x41')](handleError(_0x1d5f52,null));};exports['getConfigurations']=function(_0x3dda83,_0xc350d8,_0x5c170f){var _0x50ef13={};var _0x16419f={};var _0x3a6321;var _0x46299b;return db[_0xc1b1('0x3d')][_0xc1b1('0x4b')]({'where':{'id':_0x3dda83['params']['id']}})[_0xc1b1('0x26')](handleEntityNotFound(_0xc350d8,null))['then'](function(_0x4a4b67){if(_0x4a4b67){_0x3a6321=_0x4a4b67;_0x16419f[_0xc1b1('0x30')]=_[_0xc1b1('0x32')](db[_0xc1b1('0x4c')][_0xc1b1('0x2c')]);_0x16419f[_0xc1b1('0x31')]=_[_0xc1b1('0x32')](_0x3dda83[_0xc1b1('0x31')]);_0x16419f[_0xc1b1('0x33')]=_['intersection'](_0x16419f[_0xc1b1('0x30')],_0x16419f[_0xc1b1('0x31')]);_0x50ef13[_0xc1b1('0x36')]=_[_0xc1b1('0x34')](_0x16419f[_0xc1b1('0x30')],qs[_0xc1b1('0x35')](_0x3dda83[_0xc1b1('0x31')][_0xc1b1('0x35')]));_0x50ef13['attributes']=_0x50ef13['attributes']['length']?_0x50ef13[_0xc1b1('0x36')]:_0x16419f[_0xc1b1('0x30')];_0x50ef13[_0xc1b1('0x4d')]=qs[_0xc1b1('0x38')](_0x3dda83[_0xc1b1('0x31')][_0xc1b1('0x38')]);_0x50ef13[_0xc1b1('0x3a')]=qs[_0xc1b1('0x33')](_[_0xc1b1('0x4e')](_0x3dda83[_0xc1b1('0x31')],_0x16419f[_0xc1b1('0x33')]));if(_0x3dda83[_0xc1b1('0x31')][_0xc1b1('0x39')]){_0x50ef13[_0xc1b1('0x3a')]=_[_0xc1b1('0x3c')](_0x50ef13['where'],{'$or':_[_0xc1b1('0x2b')](_0x50ef13['attributes'],function(_0x142ed4){var _0x294cc1={};_0x294cc1[_0x142ed4]={'$like':'%'+_0x3dda83[_0xc1b1('0x31')][_0xc1b1('0x39')]+'%'};return _0x294cc1;})});}_0x50ef13=_[_0xc1b1('0x3c')]({},_0x50ef13,_0x3dda83[_0xc1b1('0x45')]);return _0x3a6321[_0xc1b1('0x4f')](_0x50ef13);}})[_0xc1b1('0x26')](function(_0x59254b){if(_0x59254b){_0x46299b=_0x59254b[_0xc1b1('0x43')];if(!_0x3dda83[_0xc1b1('0x31')]['hasOwnProperty'](_0xc1b1('0x50'))){_0x50ef13[_0xc1b1('0x1e')]=qs[_0xc1b1('0x1e')](_0x3dda83['query']['limit']);_0x50ef13[_0xc1b1('0x20')]=qs[_0xc1b1('0x20')](_0x3dda83[_0xc1b1('0x31')][_0xc1b1('0x20')]);}return _0x3a6321[_0xc1b1('0x4f')](_0x50ef13);}})[_0xc1b1('0x26')](function(_0x11267b){if(_0x11267b){return _0x11267b?{'count':_0x46299b,'rows':_0x11267b}:null;}})[_0xc1b1('0x26')](respondWithResult(_0xc350d8,null))[_0xc1b1('0x41')](handleError(_0xc350d8,null));};exports[_0xc1b1('0x51')]=function(_0x383129,_0xe12508,_0x44da6a){if(_0x383129[_0xc1b1('0x48')]['id']){delete _0x383129[_0xc1b1('0x48')]['id'];}return db[_0xc1b1('0x3d')][_0xc1b1('0x4b')]({'where':{'id':_0x383129[_0xc1b1('0x49')]['id']}})[_0xc1b1('0x26')](handleEntityNotFound(_0xe12508,null))[_0xc1b1('0x26')](function(_0x129bfd){if(_0x129bfd){_0x383129['body']['AccountId']=_0x129bfd['id'];_0x383129[_0xc1b1('0x48')][_0xc1b1('0x52')]=integrations[_0xc1b1('0x53')](_0x383129['body'][_0xc1b1('0x54')],_0x383129[_0xc1b1('0x48')]['type']);_0x383129['body'][_0xc1b1('0x55')]=integrations[_0xc1b1('0x56')](_0x383129[_0xc1b1('0x48')][_0xc1b1('0x54')],_0x383129[_0xc1b1('0x48')][_0xc1b1('0x2e')]);return db[_0xc1b1('0x4c')]['create'](_0x383129[_0xc1b1('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0xc1b1('0x52')},{'model':db[_0xc1b1('0x57')],'as':'Descriptions'}]});}return null;})[_0xc1b1('0x26')](respondWithResult(_0xe12508,null))[_0xc1b1('0x41')](handleError(_0xe12508,null));};exports[_0xc1b1('0x58')]=function(_0x3243cd,_0x1e0e67,_0x372eeb){var _0x1d1b40=[_0xc1b1('0x59'),_0xc1b1('0x5a'),'knowledge',_0xc1b1('0x5b'),_0xc1b1('0x5c'),_0xc1b1('0x5d'),_0xc1b1('0x5e'),_0xc1b1('0x5f'),'category'];var _0x41e595=[_0xc1b1('0x60'),'made_sla',_0xc1b1('0x61'),'watch_list',_0xc1b1('0x62'),_0xc1b1('0x63'),_0xc1b1('0x64'),'hold_reason',_0xc1b1('0x65'),_0xc1b1('0x66'),_0xc1b1('0x67'),_0xc1b1('0x68'),_0xc1b1('0x69'),_0xc1b1('0x6a'),'sys_created_on','sys_domain','state','sys_created_by','knowledge','order',_0xc1b1('0x6b'),_0xc1b1('0x6c'),_0xc1b1('0x6d'),_0xc1b1('0x6e'),_0xc1b1('0x6f'),_0xc1b1('0x70'),_0xc1b1('0x71'),_0xc1b1('0x72'),_0xc1b1('0x73'),_0xc1b1('0x74'),'rfc',_0xc1b1('0x75'),'expected_start',_0xc1b1('0x76'),_0xc1b1('0x77'),_0xc1b1('0x78'),'work_end',_0xc1b1('0x79'),'resolved_at',_0xc1b1('0x7a'),_0xc1b1('0x7b'),'subcategory',_0xc1b1('0x7c'),_0xc1b1('0x7d'),_0xc1b1('0x5c'),_0xc1b1('0x7e'),_0xc1b1('0x7f'),_0xc1b1('0x80'),'assignment_group','business_stc','additional_assignee_list',_0xc1b1('0x81'),_0xc1b1('0x82'),_0xc1b1('0x5d'),_0xc1b1('0x83'),_0xc1b1('0x84'),'closed_by',_0xc1b1('0x85'),_0xc1b1('0x86'),_0xc1b1('0x87'),_0xc1b1('0x88'),_0xc1b1('0x89'),_0xc1b1('0x5e'),_0xc1b1('0x8a'),_0xc1b1('0x8b'),_0xc1b1('0x8c'),'reassignment_count',_0xc1b1('0x8d'),'assigned_to',_0xc1b1('0x5f'),_0xc1b1('0x8e'),_0xc1b1('0x8f'),_0xc1b1('0x90'),_0xc1b1('0x91'),'due_date','sys_mod_count',_0xc1b1('0x92'),_0xc1b1('0x93'),_0xc1b1('0x94'),_0xc1b1('0x95'),_0xc1b1('0x96'),_0xc1b1('0x97'),'category'];var _0x20cd7b='';var _0x147438='';var _0x4fea9f=[];var _0x3b970e='';var _0x24d49a='';var _0x707c54=[];var _0x268fb9='';var _0xd369ac='';var _0x1c19de={};var _0x59f45f='';return db[_0xc1b1('0x3d')][_0xc1b1('0x4b')]({'where':{'id':_0x3243cd[_0xc1b1('0x49')]['id']},'attributes':['id',_0xc1b1('0x98'),'password',_0xc1b1('0x99'),_0xc1b1('0x9a'),_0xc1b1('0x9b')]})[_0xc1b1('0x26')](handleEntityNotFound(_0x1e0e67,null))[_0xc1b1('0x26')](function(_0x2e2397){if(_0x2e2397){_0x59f45f=_0x2e2397[_0xc1b1('0x9a')];var _0x27e6a7=_0x59f45f[_0xc1b1('0x9c')](-0x1);if(_0x27e6a7==='/'){_0x59f45f=_0x59f45f['substring'](0x0,_0x59f45f['lastIndexOf'](_0x27e6a7));}_0xd369ac=util['format'](_0xc1b1('0x9d'),_0x59f45f);_0x268fb9=util[_0xc1b1('0x9e')](_0xc1b1('0x9f'),_0x59f45f);_0x1c19de={'user':_0x2e2397['username'],'pass':_0x2e2397[_0xc1b1('0xa0')]};var _0x599ac2={'method':_0xc1b1('0xa1'),'uri':_0xd369ac+'incident?sysparm_display_value=all','auth':_0x1c19de,'json':!![]};return rp(_0x599ac2);}})[_0xc1b1('0x26')](function(_0x20e25c){if(_0x20e25c[_0xc1b1('0xa2')][_0xc1b1('0x43')]>0x0){_0x20cd7b=_0x20e25c[_0xc1b1('0xa2')];}console[_0xc1b1('0xa3')](_0xc1b1('0xa4'),_0x20cd7b);_0x707c54=[];_0x147438=Object[_0xc1b1('0xa5')]([],_0x20cd7b);_['remove'](_0x147438,function(_0x36d1b7){return!_0x1d1b40['includes'](_0x36d1b7[_0xc1b1('0x29')]);});_0x147438['forEach'](function(_0x5779b1){var _0x2c4b9e=createFieldObject(_0x268fb9,_0x1c19de,_0x5779b1['internalType'],_0x5779b1[_0xc1b1('0x29')],_0x5779b1['label'],![]);_0x707c54[_0xc1b1('0xa6')](_0x2c4b9e);});return Promise['all'](_0x707c54);})[_0xc1b1('0x26')](function(_0x522b29){_0x4fea9f=_0x522b29;_0x3b970e=Object[_0xc1b1('0xa5')]([],_0x20cd7b);console[_0xc1b1('0xa3')](_0xc1b1('0xa7'),_0x20cd7b);_[_0xc1b1('0xa8')](_0x3b970e,function(_0xb21762){return _0x41e595['includes'](_0xb21762[_0xc1b1('0x29')]);});console[_0xc1b1('0xa3')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3b970e);_0x707c54=[];_0x3b970e[_0xc1b1('0xa9')](function(_0x46ec60){var _0x573098=createFieldObject(_0x268fb9,_0x1c19de,_0x46ec60[_0xc1b1('0xaa')],_0x46ec60[_0xc1b1('0x29')],_0x46ec60[_0xc1b1('0xab')],!![]);_0x707c54[_0xc1b1('0xa6')](_0x573098);});return Promise[_0xc1b1('0xac')](_0x707c54);})[_0xc1b1('0x26')](function(_0x31156a){_0x24d49a=_0x31156a;var _0x2eacd6=_0x4fea9f[_0xc1b1('0xad')](_0x24d49a);return{'count':_0x2eacd6[_0xc1b1('0x43')],'rows':_0x2eacd6};})[_0xc1b1('0x26')](respondWithResult(_0x1e0e67,null))['catch'](function(_0x422fa5){console[_0xc1b1('0xa3')]('ServiceNow\x20error:\x20'+_0x422fa5);var _0x8d41f7=_0x3243cd['query'][_0xc1b1('0xae')]?0x1f4:_0x422fa5[_0xc1b1('0xaf')]||0x1f4;logger[_0xc1b1('0x27')](_0x422fa5[_0xc1b1('0x28')]);delete _0x422fa5['name'];if(_0x8d41f7===0x191){_0x8d41f7=0x190;}_0x1e0e67[_0xc1b1('0x1d')](_0x8d41f7)[_0xc1b1('0xb0')](_0x3243cd[_0xc1b1('0x31')][_0xc1b1('0xae')]?{'message':_0xc1b1('0xb1'),'statusCode':_0x422fa5['statusCode']}:_0x422fa5);});};function createFieldObject(_0x547d9a,_0x549e76,_0x36ff4f,_0x4afc86,_0xc5aebe,_0x16cd3b){return new Promise(function(_0x2087ec,_0x443bb6){var _0x3e3e48={'id':_0x4afc86,'name':_0xc5aebe,'custom':_0x16cd3b};if(_0x36ff4f===_0xc1b1('0xb2')){_0x3e3e48[_0xc1b1('0x45')]=[{'name':_0xc1b1('0xb3'),'value':_0xc1b1('0xb4')},{'name':_0xc1b1('0xb5'),'value':_0xc1b1('0xb6')}];_0x2087ec(_0x3e3e48);}else{var _0x125f00={'method':_0xc1b1('0xa1'),'uri':_0x547d9a+_0xc1b1('0xb7')+_0x4afc86,'auth':_0x549e76,'json':!![]};return rp(_0x125f00)[_0xc1b1('0x26')](function(_0x291ca0){var _0x1f44f6=[];if(_0x291ca0[_0xc1b1('0xa2')][_0xc1b1('0x43')]>0x0){_0x291ca0[_0xc1b1('0xa2')][_0xc1b1('0xa9')](function(_0x53f926){if(_0x53f926[_0xc1b1('0xb8')]===_0xc1b1('0xb6')){var _0x4585b0={'name':_0x53f926[_0xc1b1('0xab')],'value':_0x53f926[_0xc1b1('0xb9')]};_0x1f44f6['push'](_0x4585b0);}});}_0x3e3e48[_0xc1b1('0x45')]=_0x1f44f6;if(_0x3e3e48[_0xc1b1('0x45')]['length']>0x0){_0x2087ec(_0x3e3e48);}else{if(_0x16cd3b==![]){_0x2087ec();}else{_0x2087ec(_0x3e3e48);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 719c945..22241ca 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 _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0xabce,0x103));var _0xeabc=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xabce[_0xbe200f];return _0x192597;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0xcb0a3,_0x2ec62b){var _0x117b9f=function(_0x2eeb70){while(--_0x2eeb70){_0xcb0a3['push'](_0xcb0a3['shift']());}};_0x117b9f(++_0x2ec62b);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x428934,_0x534027){_0x428934=_0x428934-0x0;var _0x529b59=_0xbd51[_0x428934];return _0x529b59;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));var integrations=require(_0x1bd5('0x6'));module[_0x1bd5('0x7')]=function(_0x59ddfb,_0x29abea){return _0x59ddfb[_0x1bd5('0x8')](_0x1bd5('0x9'),attributes,{'tableName':_0x1bd5('0xa'),'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 e3ea050..255dce5 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 _0xd61a=['ServicenowAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount'];(function(_0x36acad,_0x52944d){var _0x370eb5=function(_0xa1da57){while(--_0xa1da57){_0x36acad['push'](_0x36acad['shift']());}};_0x370eb5(++_0x52944d);}(_0xd61a,0x133));var _0xad61=function(_0x37a505,_0x319129){_0x37a505=_0x37a505-0x0;var _0x5d094e=_0xd61a[_0x37a505];return _0x5d094e;};'use strict';var _=require(_0xad61('0x0'));var util=require(_0xad61('0x1'));var moment=require(_0xad61('0x2'));var BPromise=require('bluebird');var rs=require(_0xad61('0x3'));var fs=require('fs');var Redis=require(_0xad61('0x4'));var db=require(_0xad61('0x5'))['db'];var utils=require(_0xad61('0x6'));var logger=require(_0xad61('0x7'))(_0xad61('0x8'));var config=require(_0xad61('0x9'));var jayson=require(_0xad61('0xa'));var client=jayson[_0xad61('0xb')][_0xad61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd943cc,_0x47dd38,_0x312d21){return new BPromise(function(_0x20b559,_0x9543fa){return client['request'](_0xd943cc,_0x312d21)[_0xad61('0xd')](function(_0x24f63d){logger[_0xad61('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x47dd38,_0xad61('0xf'));logger[_0xad61('0x10')](_0xad61('0x11'),_0x47dd38,_0xad61('0xf'),JSON['stringify'](_0x24f63d));if(_0x24f63d[_0xad61('0x12')]){if(_0x24f63d['error'][_0xad61('0x13')]===0x1f4){logger[_0xad61('0x12')](_0xad61('0x14'),_0x47dd38,_0x24f63d[_0xad61('0x12')][_0xad61('0x15')]);return _0x9543fa(_0x24f63d[_0xad61('0x12')][_0xad61('0x15')]);}logger[_0xad61('0x12')](_0xad61('0x14'),_0x47dd38,_0x24f63d['error']['message']);return _0x20b559(_0x24f63d[_0xad61('0x12')][_0xad61('0x15')]);}else{logger[_0xad61('0xe')](_0xad61('0x14'),_0x47dd38,_0xad61('0xf'));_0x20b559(_0x24f63d[_0xad61('0x16')]['message']);}})[_0xad61('0x17')](function(_0xe4d07e){logger[_0xad61('0x12')](_0xad61('0x14'),_0x47dd38,_0xe4d07e);_0x9543fa(_0xe4d07e);});});}exports[_0xad61('0x18')]=function(_0x242383){var _0x41b4d9=this;return new Promise(function(_0x31425e,_0x5b5329){return db['ServicenowAccount'][_0xad61('0x19')]({'raw':_0x242383[_0xad61('0x1a')]?_0x242383['options']['raw']===undefined?!![]:![]:!![],'where':_0x242383['options']?_0x242383[_0xad61('0x1a')][_0xad61('0x1b')]||null:null,'attributes':_0x242383[_0xad61('0x1a')]?_0x242383[_0xad61('0x1a')][_0xad61('0x1c')]||null:null,'limit':_0x242383[_0xad61('0x1a')]?_0x242383[_0xad61('0x1a')][_0xad61('0x1d')]||null:null,'include':_0x242383[_0xad61('0x1a')]?_0x242383['options'][_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x242383[_0xad61('0x1a')][_0xad61('0x1e')],function(_0x8d5e7f){return{'model':db[_0x8d5e7f[_0xad61('0x20')]],'as':_0x8d5e7f['as'],'attributes':_0x8d5e7f[_0xad61('0x1c')],'include':_0x8d5e7f['include']?_['map'](_0x8d5e7f[_0xad61('0x1e')],function(_0x36bbe4){return{'model':db[_0x36bbe4['model']],'as':_0x36bbe4['as'],'attributes':_0x36bbe4[_0xad61('0x1c')],'include':_0x36bbe4['include']?_['map'](_0x36bbe4[_0xad61('0x1e')],function(_0x59ed9a){return{'model':db[_0x59ed9a['model']],'as':_0x59ed9a['as'],'attributes':_0x59ed9a[_0xad61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad61('0xd')](function(_0x622578){logger[_0xad61('0xe')](_0xad61('0x18'),_0x242383);logger[_0xad61('0x10')]('GetServicenowAccount',_0x242383,JSON[_0xad61('0x21')](_0x622578));_0x31425e(_0x622578);})[_0xad61('0x17')](function(_0x144bb6){logger[_0xad61('0x12')](_0xad61('0x18'),_0x144bb6[_0xad61('0x15')],_0x242383);_0x5b5329(_0x41b4d9[_0xad61('0x12')](0x1f4,_0x144bb6['message']));});});};exports[_0xad61('0x22')]=function(_0x463f99){var _0x2a7627=this;return new Promise(function(_0x21f1bc,_0x3617ad){return db[_0xad61('0x23')][_0xad61('0x24')]({'raw':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x25')]===undefined?!![]:![]:!![],'where':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x1b')]||null:null,'attributes':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x1c')]||null:null,'include':_0x463f99[_0xad61('0x1a')]?_0x463f99[_0xad61('0x1a')][_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x463f99[_0xad61('0x1a')][_0xad61('0x1e')],function(_0x16bcc7){return{'model':db[_0x16bcc7['model']],'as':_0x16bcc7['as'],'attributes':_0x16bcc7[_0xad61('0x1c')],'include':_0x16bcc7[_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x16bcc7['include'],function(_0x5942f1){return{'model':db[_0x5942f1[_0xad61('0x20')]],'as':_0x5942f1['as'],'attributes':_0x5942f1[_0xad61('0x1c')],'include':_0x5942f1[_0xad61('0x1e')]?_[_0xad61('0x1f')](_0x5942f1[_0xad61('0x1e')],function(_0x12fd86){return{'model':db[_0x12fd86[_0xad61('0x20')]],'as':_0x12fd86['as'],'attributes':_0x12fd86[_0xad61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xad61('0xd')](function(_0x2cb680){logger[_0xad61('0xe')](_0xad61('0x22'),_0x463f99);logger[_0xad61('0x10')](_0xad61('0x22'),_0x463f99,JSON[_0xad61('0x21')](_0x2cb680));_0x21f1bc(_0x2cb680);})[_0xad61('0x17')](function(_0x3fb180){logger[_0xad61('0x12')](_0xad61('0x22'),_0x3fb180[_0xad61('0x15')],_0x463f99);_0x3617ad(_0x2a7627[_0xad61('0x12')](0x1f4,_0x3fb180[_0xad61('0x15')]));});});}; \ No newline at end of file +var _0x554e=['message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','then','ShowServicenowAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b2a51,_0x1cecdc){var _0x55f1e6=function(_0x1d784a){while(--_0x1d784a){_0x3b2a51['push'](_0x3b2a51['shift']());}};_0x55f1e6(++_0x1cecdc);}(_0x554e,0x165));var _0xe554=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0x554e[_0x174202];return _0x4daa4a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe554('0x0'));var BPromise=require(_0xe554('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe554('0x2'));var db=require(_0xe554('0x3'))['db'];var utils=require(_0xe554('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe554('0x5'));var jayson=require(_0xe554('0x6'));var client=jayson[_0xe554('0x7')][_0xe554('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25c1f7,_0x416de3,_0x3afa10){return new BPromise(function(_0x3d10c7,_0x2cff02){return client[_0xe554('0x9')](_0x25c1f7,_0x3afa10)['then'](function(_0x3e74a9){logger[_0xe554('0xa')](_0xe554('0xb'),_0x416de3,_0xe554('0xc'));logger['debug'](_0xe554('0xd'),_0x416de3,_0xe554('0xc'),JSON[_0xe554('0xe')](_0x3e74a9));if(_0x3e74a9[_0xe554('0xf')]){if(_0x3e74a9['error'][_0xe554('0x10')]===0x1f4){logger['error'](_0xe554('0xb'),_0x416de3,_0x3e74a9[_0xe554('0xf')][_0xe554('0x11')]);return _0x2cff02(_0x3e74a9['error'][_0xe554('0x11')]);}logger['error'](_0xe554('0xb'),_0x416de3,_0x3e74a9[_0xe554('0xf')][_0xe554('0x11')]);return _0x3d10c7(_0x3e74a9[_0xe554('0xf')]['message']);}else{logger[_0xe554('0xa')](_0xe554('0xb'),_0x416de3,'request\x20sent');_0x3d10c7(_0x3e74a9['result']['message']);}})[_0xe554('0x12')](function(_0x50a2f8){logger['error'](_0xe554('0xb'),_0x416de3,_0x50a2f8);_0x2cff02(_0x50a2f8);});});}exports[_0xe554('0x13')]=function(_0x4c99ce){var _0x28263c=this;return new Promise(function(_0x484629,_0x2451ea){return db[_0xe554('0x14')][_0xe554('0x15')]({'raw':_0x4c99ce['options']?_0x4c99ce[_0xe554('0x16')][_0xe554('0x17')]===undefined?!![]:![]:!![],'where':_0x4c99ce['options']?_0x4c99ce[_0xe554('0x16')][_0xe554('0x18')]||null:null,'attributes':_0x4c99ce['options']?_0x4c99ce[_0xe554('0x16')][_0xe554('0x19')]||null:null,'limit':_0x4c99ce[_0xe554('0x16')]?_0x4c99ce[_0xe554('0x16')][_0xe554('0x1a')]||null:null,'include':_0x4c99ce[_0xe554('0x16')]?_0x4c99ce[_0xe554('0x16')][_0xe554('0x1b')]?_[_0xe554('0x1c')](_0x4c99ce[_0xe554('0x16')]['include'],function(_0x452c94){return{'model':db[_0x452c94[_0xe554('0x1d')]],'as':_0x452c94['as'],'attributes':_0x452c94[_0xe554('0x19')],'include':_0x452c94[_0xe554('0x1b')]?_[_0xe554('0x1c')](_0x452c94['include'],function(_0x28d376){return{'model':db[_0x28d376[_0xe554('0x1d')]],'as':_0x28d376['as'],'attributes':_0x28d376[_0xe554('0x19')],'include':_0x28d376[_0xe554('0x1b')]?_[_0xe554('0x1c')](_0x28d376[_0xe554('0x1b')],function(_0xda8002){return{'model':db[_0xda8002[_0xe554('0x1d')]],'as':_0xda8002['as'],'attributes':_0xda8002[_0xe554('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dfff5){logger[_0xe554('0xa')](_0xe554('0x13'),_0x4c99ce);logger[_0xe554('0x1e')](_0xe554('0x13'),_0x4c99ce,JSON['stringify'](_0x5dfff5));_0x484629(_0x5dfff5);})[_0xe554('0x12')](function(_0x4dc751){logger['error'](_0xe554('0x13'),_0x4dc751['message'],_0x4c99ce);_0x2451ea(_0x28263c[_0xe554('0xf')](0x1f4,_0x4dc751[_0xe554('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x22c58a){var _0x3b87c9=this;return new Promise(function(_0x4545e2,_0xf41b1f){return db[_0xe554('0x14')][_0xe554('0x1f')]({'raw':_0x22c58a['options']?_0x22c58a[_0xe554('0x16')][_0xe554('0x17')]===undefined?!![]:![]:!![],'where':_0x22c58a[_0xe554('0x16')]?_0x22c58a['options']['where']||null:null,'attributes':_0x22c58a['options']?_0x22c58a[_0xe554('0x16')][_0xe554('0x19')]||null:null,'include':_0x22c58a[_0xe554('0x16')]?_0x22c58a[_0xe554('0x16')][_0xe554('0x1b')]?_[_0xe554('0x1c')](_0x22c58a[_0xe554('0x16')][_0xe554('0x1b')],function(_0x41fa8e){return{'model':db[_0x41fa8e[_0xe554('0x1d')]],'as':_0x41fa8e['as'],'attributes':_0x41fa8e[_0xe554('0x19')],'include':_0x41fa8e[_0xe554('0x1b')]?_[_0xe554('0x1c')](_0x41fa8e[_0xe554('0x1b')],function(_0x3bb432){return{'model':db[_0x3bb432['model']],'as':_0x3bb432['as'],'attributes':_0x3bb432[_0xe554('0x19')],'include':_0x3bb432[_0xe554('0x1b')]?_[_0xe554('0x1c')](_0x3bb432[_0xe554('0x1b')],function(_0x2ca053){return{'model':db[_0x2ca053[_0xe554('0x1d')]],'as':_0x2ca053['as'],'attributes':_0x2ca053['attributes']};}):[]};}):[]};}):[]:[]})[_0xe554('0x20')](function(_0x35e6d7){logger[_0xe554('0xa')](_0xe554('0x21'),_0x22c58a);logger[_0xe554('0x1e')](_0xe554('0x21'),_0x22c58a,JSON[_0xe554('0xe')](_0x35e6d7));_0x4545e2(_0x35e6d7);})['catch'](function(_0x3f1066){logger[_0xe554('0xf')](_0xe554('0x21'),_0x3f1066[_0xe554('0x11')],_0x22c58a);_0xf41b1f(_0x3b87c9[_0xe554('0xf')](0x1f4,_0x3f1066[_0xe554('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 971744e..1ffb957 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 _0xe282=['isAuthenticated','index','get','getFields','getSubjects','post','create','/:id','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0xd90f55,_0x48ac96){var _0x2bfc02=function(_0x2e752d){while(--_0x2e752d){_0xd90f55['push'](_0xd90f55['shift']());}};_0x2bfc02(++_0x48ac96);}(_0xe282,0x119));var _0x2e28=function(_0x5240ca,_0x4e0ac9){_0x5240ca=_0x5240ca-0x0;var _0x21b154=_0xe282[_0x5240ca];return _0x21b154;};'use strict';var multer=require(_0x2e28('0x0'));var util=require(_0x2e28('0x1'));var path=require('path');var timeout=require(_0x2e28('0x2'));var express=require(_0x2e28('0x3'));var router=express[_0x2e28('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2e28('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2e28('0x6'));var controller=require(_0x2e28('0x7'));router['get']('/',auth[_0x2e28('0x8')](),controller[_0x2e28('0x9')]);router['get']('/:id',auth[_0x2e28('0x8')](),controller['show']);router[_0x2e28('0xa')]('/:id/fields',auth[_0x2e28('0x8')](),controller[_0x2e28('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x2e28('0xc')]);router[_0x2e28('0xa')]('/:id/descriptions',auth[_0x2e28('0x8')](),controller['getDescriptions']);router[_0x2e28('0xd')]('/',auth[_0x2e28('0x8')](),controller[_0x2e28('0xe')]);router['put'](_0x2e28('0xf'),auth[_0x2e28('0x8')](),controller['update']);router['delete']('/:id',auth[_0x2e28('0x8')](),controller[_0x2e28('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2d7b=['./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','getSubjects','getDescriptions','post','create','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5d3afa,_0x584768){var _0x230dd9=function(_0x5ca224){while(--_0x5ca224){_0x5d3afa['push'](_0x5d3afa['shift']());}};_0x230dd9(++_0x584768);}(_0x2d7b,0x174));var _0xb2d7=function(_0x1f0da2,_0x258e33){_0x1f0da2=_0x1f0da2-0x0;var _0x28e3e5=_0x2d7b[_0x1f0da2];return _0x28e3e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2d7('0x0'));var timeout=require(_0xb2d7('0x1'));var express=require(_0xb2d7('0x2'));var router=express['Router']();var fs_extra=require(_0xb2d7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb2d7('0x4'));var config=require(_0xb2d7('0x5'));var controller=require(_0xb2d7('0x6'));router['get']('/',auth[_0xb2d7('0x7')](),controller[_0xb2d7('0x8')]);router[_0xb2d7('0x9')](_0xb2d7('0xa'),auth[_0xb2d7('0x7')](),controller['show']);router[_0xb2d7('0x9')]('/:id/fields',auth[_0xb2d7('0x7')](),controller['getFields']);router[_0xb2d7('0x9')](_0xb2d7('0xb'),auth[_0xb2d7('0x7')](),controller[_0xb2d7('0xc')]);router[_0xb2d7('0x9')]('/:id/descriptions',auth[_0xb2d7('0x7')](),controller[_0xb2d7('0xd')]);router[_0xb2d7('0xe')]('/',auth[_0xb2d7('0x7')](),controller[_0xb2d7('0xf')]);router['put'](_0xb2d7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb2d7('0x10')](_0xb2d7('0xa'),auth[_0xb2d7('0x7')](),controller[_0xb2d7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8cee284..0e84ed5 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 _0x9293=['sequelize','exports','STRING'];(function(_0x3c68ac,_0x38b406){var _0x35d849=function(_0x1fb2e0){while(--_0x1fb2e0){_0x3c68ac['push'](_0x3c68ac['shift']());}};_0x35d849(++_0x38b406);}(_0x9293,0x102));var _0x3929=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x9293[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0x3929('0x0'));module[_0x3929('0x1')]={'name':{'type':Sequelize[_0x3929('0x2')]},'description':{'type':Sequelize[_0x3929('0x2')]}}; \ No newline at end of file +var _0x25a9=['exports','STRING','sequelize'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x25a9,0x65));var _0x925a=function(_0x5e7ee9,_0x4dbc4b){_0x5e7ee9=_0x5e7ee9-0x0;var _0xadb900=_0x25a9[_0x5e7ee9];return _0xadb900;};'use strict';var Sequelize=require(_0x925a('0x0'));module[_0x925a('0x1')]={'name':{'type':Sequelize[_0x925a('0x2')]},'description':{'type':Sequelize[_0x925a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cd46890..3a2d350 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 _0x7060=['find','create','body','getFields','ServicenowField','order','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x27c20d,_0x389582){var _0x2871a2=function(_0x3af732){while(--_0x3af732){_0x27c20d['push'](_0x27c20d['shift']());}};_0x2871a2(++_0x389582);}(_0x7060,0xa7));var _0x0706=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7060[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x0706('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0706('0x1'));var jsonpatch=require(_0x0706('0x2'));var rp=require(_0x0706('0x3'));var moment=require(_0x0706('0x4'));var BPromise=require(_0x0706('0x5'));var Mustache=require(_0x0706('0x6'));var util=require(_0x0706('0x7'));var path=require(_0x0706('0x8'));var sox=require('sox');var csv=require(_0x0706('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0706('0xa'));var _=require(_0x0706('0xb'));var squel=require(_0x0706('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0706('0xd'));var toCsv=require(_0x0706('0x9'));var querystring=require('querystring');var Papa=require(_0x0706('0xe'));var Redis=require(_0x0706('0xf'));var authService=require(_0x0706('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0706('0x11'));var hardwareService=require(_0x0706('0x12'));var logger=require('../../config/logger')(_0x0706('0x13'));var utils=require(_0x0706('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0706('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f4b9,_0xad8310){_0xad8310=_0xad8310||0xcc;return function(_0x168404){if(_0x168404){return _0x51f4b9[_0x0706('0x16')](_0xad8310);}return _0x51f4b9[_0x0706('0x17')](_0xad8310)[_0x0706('0x18')]();};}function respondWithResult(_0x41da3d,_0x449b2f){_0x449b2f=_0x449b2f||0xc8;return function(_0x3c2018){if(_0x3c2018){return _0x41da3d['status'](_0x449b2f)[_0x0706('0x19')](_0x3c2018);}};}function respondWithFilteredResult(_0xd29200,_0x49e35b){return function(_0x3565e9){if(_0x3565e9){var _0x384996=typeof _0x49e35b[_0x0706('0x1a')]==='undefined'&&typeof _0x49e35b['limit']===_0x0706('0x1b');var _0x3f8a58=_0x3565e9['count'];var _0x6228f8=_0x384996?0x0:_0x49e35b['offset'];var _0x2d42e5=_0x384996?_0x3565e9[_0x0706('0x1c')]:_0x49e35b[_0x0706('0x1a')]+_0x49e35b[_0x0706('0x1d')];var _0x261514;if(_0x2d42e5>=_0x3f8a58){_0x2d42e5=_0x3f8a58;_0x261514=0xc8;}else{_0x261514=0xce;}_0xd29200[_0x0706('0x17')](_0x261514);return _0xd29200['set'](_0x0706('0x1e'),_0x6228f8+'-'+_0x2d42e5+'/'+_0x3f8a58)[_0x0706('0x19')](_0x3565e9);}return null;};}function patchUpdates(_0x33fe15){return function(_0xd1eaf6){try{jsonpatch[_0x0706('0x1f')](_0xd1eaf6,_0x33fe15,!![]);}catch(_0x402f1a){return BPromise[_0x0706('0x20')](_0x402f1a);}return _0xd1eaf6[_0x0706('0x21')]();};}function saveUpdates(_0x5ebbba,_0x9d1c27){return function(_0x48afdf){if(_0x48afdf){return _0x48afdf['update'](_0x5ebbba)[_0x0706('0x22')](function(_0x17de0e){return _0x17de0e;});}return null;};}function removeEntity(_0x1343a3,_0xe5243b){return function(_0x37f716){if(_0x37f716){return _0x37f716[_0x0706('0x23')]()[_0x0706('0x22')](function(){_0x1343a3[_0x0706('0x17')](0xcc)[_0x0706('0x18')]();});}};}function handleEntityNotFound(_0x4777f1,_0x15c022){return function(_0x1baaf2){if(!_0x1baaf2){_0x4777f1[_0x0706('0x16')](0x194);}return _0x1baaf2;};}function handleError(_0x57ef30,_0x26ca91){_0x26ca91=_0x26ca91||0x1f4;return function(_0x2eb3c2){logger['error'](_0x2eb3c2[_0x0706('0x24')]);if(_0x2eb3c2[_0x0706('0x25')]){delete _0x2eb3c2['name'];}_0x57ef30[_0x0706('0x17')](_0x26ca91)[_0x0706('0x26')](_0x2eb3c2);};}exports[_0x0706('0x27')]=function(_0x528dc2,_0x2c6a34){var _0x3f67ad={},_0x265abc={},_0x1e1844={'count':0x0,'rows':[]};var _0x2ad7f6=_[_0x0706('0x28')](db[_0x0706('0x29')][_0x0706('0x2a')],function(_0x385a67){return{'name':_0x385a67[_0x0706('0x2b')],'type':_0x385a67[_0x0706('0x2c')][_0x0706('0x2d')]};});_0x265abc['model']=_[_0x0706('0x28')](_0x2ad7f6,_0x0706('0x25'));_0x265abc['query']=_[_0x0706('0x2e')](_0x528dc2[_0x0706('0x2f')]);_0x265abc['filters']=_[_0x0706('0x30')](_0x265abc['model'],_0x265abc[_0x0706('0x2f')]);_0x3f67ad[_0x0706('0x31')]=_[_0x0706('0x30')](_0x265abc['model'],qs[_0x0706('0x32')](_0x528dc2[_0x0706('0x2f')][_0x0706('0x32')]));_0x3f67ad[_0x0706('0x31')]=_0x3f67ad[_0x0706('0x31')][_0x0706('0x33')]?_0x3f67ad[_0x0706('0x31')]:_0x265abc[_0x0706('0x34')];if(!_0x528dc2[_0x0706('0x2f')][_0x0706('0x35')](_0x0706('0x36'))){_0x3f67ad[_0x0706('0x1d')]=qs['limit'](_0x528dc2[_0x0706('0x2f')]['limit']);_0x3f67ad[_0x0706('0x1a')]=qs[_0x0706('0x1a')](_0x528dc2[_0x0706('0x2f')][_0x0706('0x1a')]);}_0x3f67ad['order']=qs['sort'](_0x528dc2[_0x0706('0x2f')][_0x0706('0x37')]);_0x3f67ad[_0x0706('0x38')]=qs[_0x0706('0x39')](_[_0x0706('0x3a')](_0x528dc2[_0x0706('0x2f')],_0x265abc['filters']),_0x2ad7f6);if(_0x528dc2[_0x0706('0x2f')][_0x0706('0x3b')]){_0x3f67ad[_0x0706('0x38')]=_[_0x0706('0x3c')](_0x3f67ad[_0x0706('0x38')],{'$or':_[_0x0706('0x28')](_0x2ad7f6,function(_0x1ec9e6){if(_0x1ec9e6[_0x0706('0x2c')]!==_0x0706('0x3d')){var _0x439797={};_0x439797[_0x1ec9e6[_0x0706('0x25')]]={'$like':'%'+_0x528dc2[_0x0706('0x2f')][_0x0706('0x3b')]+'%'};return _0x439797;}})});}_0x3f67ad=_[_0x0706('0x3c')]({},_0x3f67ad,_0x528dc2[_0x0706('0x3e')]);var _0x128c19={'where':_0x3f67ad[_0x0706('0x38')]};return db[_0x0706('0x29')][_0x0706('0x1c')](_0x128c19)[_0x0706('0x22')](function(_0x20f076){_0x1e1844[_0x0706('0x1c')]=_0x20f076;if(_0x528dc2[_0x0706('0x2f')][_0x0706('0x3f')]){_0x3f67ad[_0x0706('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x0706('0x41')](_0x3f67ad);})[_0x0706('0x22')](function(_0x2cf826){_0x1e1844[_0x0706('0x42')]=_0x2cf826;return _0x1e1844;})['then'](respondWithFilteredResult(_0x2c6a34,_0x3f67ad))[_0x0706('0x43')](handleError(_0x2c6a34,null));};exports[_0x0706('0x44')]=function(_0x14ccf6,_0x166ff3){var _0x1c77d9={'raw':![],'where':{'id':_0x14ccf6[_0x0706('0x45')]['id']}},_0x17a25c={};_0x17a25c['model']=_['keys'](db[_0x0706('0x29')][_0x0706('0x2a')]);_0x17a25c[_0x0706('0x2f')]=_[_0x0706('0x2e')](_0x14ccf6['query']);_0x17a25c['filters']=_[_0x0706('0x30')](_0x17a25c[_0x0706('0x34')],_0x17a25c[_0x0706('0x2f')]);_0x1c77d9[_0x0706('0x31')]=_[_0x0706('0x30')](_0x17a25c['model'],qs['fields'](_0x14ccf6[_0x0706('0x2f')][_0x0706('0x32')]));_0x1c77d9['attributes']=_0x1c77d9[_0x0706('0x31')][_0x0706('0x33')]?_0x1c77d9[_0x0706('0x31')]:_0x17a25c['model'];if(_0x14ccf6[_0x0706('0x2f')][_0x0706('0x3f')]){_0x1c77d9[_0x0706('0x40')]=[{'all':!![]}];}_0x1c77d9=_[_0x0706('0x3c')]({},_0x1c77d9,_0x14ccf6[_0x0706('0x3e')]);return db[_0x0706('0x29')][_0x0706('0x46')](_0x1c77d9)[_0x0706('0x22')](handleEntityNotFound(_0x166ff3,null))[_0x0706('0x22')](respondWithResult(_0x166ff3,null))[_0x0706('0x43')](handleError(_0x166ff3,null));};exports[_0x0706('0x47')]=function(_0x19bae8,_0x49df9f){return db[_0x0706('0x29')][_0x0706('0x47')](_0x19bae8[_0x0706('0x48')],{})[_0x0706('0x22')](respondWithResult(_0x49df9f,0xc9))[_0x0706('0x43')](handleError(_0x49df9f,null));};exports['update']=function(_0x3f9963,_0x22570f){if(_0x3f9963[_0x0706('0x48')]['id']){delete _0x3f9963[_0x0706('0x48')]['id'];}return db[_0x0706('0x29')][_0x0706('0x46')]({'where':{'id':_0x3f9963['params']['id']}})[_0x0706('0x22')](handleEntityNotFound(_0x22570f,null))[_0x0706('0x22')](saveUpdates(_0x3f9963[_0x0706('0x48')],null))[_0x0706('0x22')](respondWithResult(_0x22570f,null))['catch'](handleError(_0x22570f,null));};exports['destroy']=function(_0x509c4f,_0x1ef139){return db[_0x0706('0x29')][_0x0706('0x46')]({'where':{'id':_0x509c4f[_0x0706('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ef139,null))['then'](removeEntity(_0x1ef139,null))[_0x0706('0x43')](handleError(_0x1ef139,null));};exports[_0x0706('0x49')]=function(_0x4d83af,_0x277374,_0x4125d8){var _0x23f8e9={};var _0x554cd0={};var _0x3a83ca;var _0x39edf9;return db[_0x0706('0x29')]['findOne']({'where':{'id':_0x4d83af['params']['id']}})[_0x0706('0x22')](handleEntityNotFound(_0x277374,null))[_0x0706('0x22')](function(_0x552ce0){if(_0x552ce0){_0x3a83ca=_0x552ce0;_0x554cd0[_0x0706('0x34')]=_['keys'](db[_0x0706('0x4a')][_0x0706('0x2a')]);_0x554cd0[_0x0706('0x2f')]=_['keys'](_0x4d83af[_0x0706('0x2f')]);_0x554cd0[_0x0706('0x39')]=_[_0x0706('0x30')](_0x554cd0[_0x0706('0x34')],_0x554cd0[_0x0706('0x2f')]);_0x23f8e9[_0x0706('0x31')]=_[_0x0706('0x30')](_0x554cd0['model'],qs[_0x0706('0x32')](_0x4d83af[_0x0706('0x2f')][_0x0706('0x32')]));_0x23f8e9[_0x0706('0x31')]=_0x23f8e9[_0x0706('0x31')][_0x0706('0x33')]?_0x23f8e9['attributes']:_0x554cd0[_0x0706('0x34')];_0x23f8e9[_0x0706('0x4b')]=qs[_0x0706('0x37')](_0x4d83af['query']['sort']);_0x23f8e9['where']=qs[_0x0706('0x39')](_[_0x0706('0x3a')](_0x4d83af['query'],_0x554cd0[_0x0706('0x39')]));if(_0x4d83af[_0x0706('0x2f')][_0x0706('0x3b')]){_0x23f8e9[_0x0706('0x38')]=_['merge'](_0x23f8e9[_0x0706('0x38')],{'$or':_['map'](_0x23f8e9[_0x0706('0x31')],function(_0x46d2f8){var _0x44ea21={};_0x44ea21[_0x46d2f8]={'$like':'%'+_0x4d83af[_0x0706('0x2f')][_0x0706('0x3b')]+'%'};return _0x44ea21;})});}_0x23f8e9=_[_0x0706('0x3c')]({},_0x23f8e9,_0x4d83af['options']);return _0x3a83ca[_0x0706('0x49')](_0x23f8e9);}})[_0x0706('0x22')](function(_0x3579a5){if(_0x3579a5){_0x39edf9=_0x3579a5[_0x0706('0x33')];if(!_0x4d83af['query'][_0x0706('0x35')](_0x0706('0x36'))){_0x23f8e9[_0x0706('0x1d')]=qs[_0x0706('0x1d')](_0x4d83af['query'][_0x0706('0x1d')]);_0x23f8e9['offset']=qs[_0x0706('0x1a')](_0x4d83af[_0x0706('0x2f')][_0x0706('0x1a')]);}return _0x3a83ca[_0x0706('0x49')](_0x23f8e9);}})[_0x0706('0x22')](function(_0x24df85){if(_0x24df85){return _0x24df85?{'count':_0x39edf9,'rows':_0x24df85}:null;}})[_0x0706('0x22')](respondWithResult(_0x277374,null))['catch'](handleError(_0x277374,null));};exports['getSubjects']=function(_0x5d6dba,_0x417f2f,_0xdaa84){var _0x28c863={};var _0xd50e8f={};var _0x23fdf3;var _0x9d944e;return db[_0x0706('0x29')][_0x0706('0x4c')]({'where':{'id':_0x5d6dba[_0x0706('0x45')]['id']}})[_0x0706('0x22')](handleEntityNotFound(_0x417f2f,null))[_0x0706('0x22')](function(_0x1c160d){if(_0x1c160d){_0x23fdf3=_0x1c160d;_0xd50e8f[_0x0706('0x34')]=_[_0x0706('0x2e')](db[_0x0706('0x4a')]['rawAttributes']);_0xd50e8f['query']=_[_0x0706('0x2e')](_0x5d6dba['query']);_0xd50e8f[_0x0706('0x39')]=_[_0x0706('0x30')](_0xd50e8f['model'],_0xd50e8f[_0x0706('0x2f')]);_0x28c863[_0x0706('0x31')]=_[_0x0706('0x30')](_0xd50e8f['model'],qs[_0x0706('0x32')](_0x5d6dba[_0x0706('0x2f')][_0x0706('0x32')]));_0x28c863['attributes']=_0x28c863['attributes'][_0x0706('0x33')]?_0x28c863['attributes']:_0xd50e8f['model'];_0x28c863[_0x0706('0x4b')]=qs[_0x0706('0x37')](_0x5d6dba[_0x0706('0x2f')][_0x0706('0x37')]);_0x28c863[_0x0706('0x38')]=qs[_0x0706('0x39')](_[_0x0706('0x3a')](_0x5d6dba[_0x0706('0x2f')],_0xd50e8f[_0x0706('0x39')]));if(_0x5d6dba[_0x0706('0x2f')][_0x0706('0x3b')]){_0x28c863[_0x0706('0x38')]=_[_0x0706('0x3c')](_0x28c863[_0x0706('0x38')],{'$or':_[_0x0706('0x28')](_0x28c863[_0x0706('0x31')],function(_0x363d24){var _0x9fb03f={};_0x9fb03f[_0x363d24]={'$like':'%'+_0x5d6dba[_0x0706('0x2f')][_0x0706('0x3b')]+'%'};return _0x9fb03f;})});}_0x28c863=_['merge']({},_0x28c863,_0x5d6dba[_0x0706('0x3e')]);return _0x23fdf3[_0x0706('0x4d')](_0x28c863);}})[_0x0706('0x22')](function(_0x3e5b5f){if(_0x3e5b5f){_0x9d944e=_0x3e5b5f[_0x0706('0x33')];if(!_0x5d6dba[_0x0706('0x2f')][_0x0706('0x35')](_0x0706('0x36'))){_0x28c863[_0x0706('0x1d')]=qs[_0x0706('0x1d')](_0x5d6dba[_0x0706('0x2f')][_0x0706('0x1d')]);_0x28c863[_0x0706('0x1a')]=qs[_0x0706('0x1a')](_0x5d6dba[_0x0706('0x2f')][_0x0706('0x1a')]);}return _0x23fdf3[_0x0706('0x4d')](_0x28c863);}})[_0x0706('0x22')](function(_0x1a97bf){if(_0x1a97bf){return _0x1a97bf?{'count':_0x9d944e,'rows':_0x1a97bf}:null;}})[_0x0706('0x22')](respondWithResult(_0x417f2f,null))['catch'](handleError(_0x417f2f,null));};exports[_0x0706('0x4e')]=function(_0x12d031,_0x5de171,_0x2f286d){var _0x13a4bc={};var _0x1e2e1a={};var _0x20a073;var _0x338502;return db[_0x0706('0x29')][_0x0706('0x4c')]({'where':{'id':_0x12d031[_0x0706('0x45')]['id']}})['then'](handleEntityNotFound(_0x5de171,null))[_0x0706('0x22')](function(_0x2e447e){if(_0x2e447e){_0x20a073=_0x2e447e;_0x1e2e1a[_0x0706('0x34')]=_[_0x0706('0x2e')](db[_0x0706('0x4a')][_0x0706('0x2a')]);_0x1e2e1a[_0x0706('0x2f')]=_[_0x0706('0x2e')](_0x12d031[_0x0706('0x2f')]);_0x1e2e1a[_0x0706('0x39')]=_[_0x0706('0x30')](_0x1e2e1a[_0x0706('0x34')],_0x1e2e1a[_0x0706('0x2f')]);_0x13a4bc['attributes']=_[_0x0706('0x30')](_0x1e2e1a[_0x0706('0x34')],qs[_0x0706('0x32')](_0x12d031[_0x0706('0x2f')][_0x0706('0x32')]));_0x13a4bc[_0x0706('0x31')]=_0x13a4bc[_0x0706('0x31')][_0x0706('0x33')]?_0x13a4bc['attributes']:_0x1e2e1a[_0x0706('0x34')];_0x13a4bc[_0x0706('0x4b')]=qs[_0x0706('0x37')](_0x12d031[_0x0706('0x2f')][_0x0706('0x37')]);_0x13a4bc[_0x0706('0x38')]=qs[_0x0706('0x39')](_[_0x0706('0x3a')](_0x12d031[_0x0706('0x2f')],_0x1e2e1a[_0x0706('0x39')]));if(_0x12d031[_0x0706('0x2f')]['filter']){_0x13a4bc[_0x0706('0x38')]=_[_0x0706('0x3c')](_0x13a4bc['where'],{'$or':_[_0x0706('0x28')](_0x13a4bc[_0x0706('0x31')],function(_0xc13db8){var _0x47d14a={};_0x47d14a[_0xc13db8]={'$like':'%'+_0x12d031['query']['filter']+'%'};return _0x47d14a;})});}_0x13a4bc=_[_0x0706('0x3c')]({},_0x13a4bc,_0x12d031[_0x0706('0x3e')]);return _0x20a073['getDescriptions'](_0x13a4bc);}})[_0x0706('0x22')](function(_0x2d583a){if(_0x2d583a){_0x338502=_0x2d583a['length'];if(!_0x12d031[_0x0706('0x2f')][_0x0706('0x35')](_0x0706('0x36'))){_0x13a4bc[_0x0706('0x1d')]=qs[_0x0706('0x1d')](_0x12d031[_0x0706('0x2f')][_0x0706('0x1d')]);_0x13a4bc[_0x0706('0x1a')]=qs['offset'](_0x12d031['query'][_0x0706('0x1a')]);}return _0x20a073['getDescriptions'](_0x13a4bc);}})[_0x0706('0x22')](function(_0x3acd5a){if(_0x3acd5a){return _0x3acd5a?{'count':_0x338502,'rows':_0x3acd5a}:null;}})[_0x0706('0x22')](respondWithResult(_0x5de171,null))[_0x0706('0x43')](handleError(_0x5de171,null));}; \ No newline at end of file +var _0xc130=['name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','getFields','hasOwnProperty','getSubjects','getDescriptions','findOne','ServicenowField','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy'];(function(_0x28e4d3,_0x53e75c){var _0x135a27=function(_0x4a7d84){while(--_0x4a7d84){_0x28e4d3['push'](_0x28e4d3['shift']());}};_0x135a27(++_0x53e75c);}(_0xc130,0x170));var _0x0c13=function(_0x189c2d,_0x442da0){_0x189c2d=_0x189c2d-0x0;var _0x40c7b8=_0xc130[_0x189c2d];return _0x40c7b8;};'use strict';var emlformat=require(_0x0c13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c13('0x1'));var jsonpatch=require(_0x0c13('0x2'));var rp=require('request-promise');var moment=require(_0x0c13('0x3'));var BPromise=require(_0x0c13('0x4'));var Mustache=require(_0x0c13('0x5'));var util=require(_0x0c13('0x6'));var path=require(_0x0c13('0x7'));var sox=require(_0x0c13('0x8'));var csv=require(_0x0c13('0x9'));var ejs=require(_0x0c13('0xa'));var fs=require('fs');var fs_extra=require(_0x0c13('0xb'));var _=require(_0x0c13('0xc'));var squel=require('squel');var crypto=require(_0x0c13('0xd'));var jsforce=require(_0x0c13('0xe'));var deskjs=require(_0x0c13('0xf'));var toCsv=require(_0x0c13('0x9'));var querystring=require(_0x0c13('0x10'));var Papa=require('papaparse');var Redis=require(_0x0c13('0x11'));var authService=require(_0x0c13('0x12'));var qs=require(_0x0c13('0x13'));var as=require(_0x0c13('0x14'));var hardwareService=require(_0x0c13('0x15'));var logger=require(_0x0c13('0x16'))(_0x0c13('0x17'));var utils=require(_0x0c13('0x18'));var config=require(_0x0c13('0x19'));var licenseUtil=require(_0x0c13('0x1a'));var db=require(_0x0c13('0x1b'))['db'];function respondWithStatusCode(_0x6ede08,_0x2bd7a2){_0x2bd7a2=_0x2bd7a2||0xcc;return function(_0x3f298a){if(_0x3f298a){return _0x6ede08['sendStatus'](_0x2bd7a2);}return _0x6ede08[_0x0c13('0x1c')](_0x2bd7a2)[_0x0c13('0x1d')]();};}function respondWithResult(_0x112107,_0x3dbff4){_0x3dbff4=_0x3dbff4||0xc8;return function(_0x1e8bea){if(_0x1e8bea){return _0x112107[_0x0c13('0x1c')](_0x3dbff4)[_0x0c13('0x1e')](_0x1e8bea);}};}function respondWithFilteredResult(_0x4fa851,_0x2a8930){return function(_0x5bc799){if(_0x5bc799){var _0xfb9b01=typeof _0x2a8930[_0x0c13('0x1f')]===_0x0c13('0x20')&&typeof _0x2a8930['limit']===_0x0c13('0x20');var _0x12daec=_0x5bc799[_0x0c13('0x21')];var _0x245384=_0xfb9b01?0x0:_0x2a8930[_0x0c13('0x1f')];var _0x47fb0a=_0xfb9b01?_0x5bc799['count']:_0x2a8930[_0x0c13('0x1f')]+_0x2a8930[_0x0c13('0x22')];var _0x2edd0f;if(_0x47fb0a>=_0x12daec){_0x47fb0a=_0x12daec;_0x2edd0f=0xc8;}else{_0x2edd0f=0xce;}_0x4fa851[_0x0c13('0x1c')](_0x2edd0f);return _0x4fa851[_0x0c13('0x23')](_0x0c13('0x24'),_0x245384+'-'+_0x47fb0a+'/'+_0x12daec)['json'](_0x5bc799);}return null;};}function patchUpdates(_0x407cc0){return function(_0x55467d){try{jsonpatch[_0x0c13('0x25')](_0x55467d,_0x407cc0,!![]);}catch(_0xe1670c){return BPromise['reject'](_0xe1670c);}return _0x55467d[_0x0c13('0x26')]();};}function saveUpdates(_0x2be050,_0x213891){return function(_0x28a786){if(_0x28a786){return _0x28a786[_0x0c13('0x27')](_0x2be050)[_0x0c13('0x28')](function(_0x49078a){return _0x49078a;});}return null;};}function removeEntity(_0x15bc40,_0x56ede5){return function(_0x1c9ee1){if(_0x1c9ee1){return _0x1c9ee1[_0x0c13('0x29')]()[_0x0c13('0x28')](function(){_0x15bc40[_0x0c13('0x1c')](0xcc)[_0x0c13('0x1d')]();});}};}function handleEntityNotFound(_0x426026,_0x936e2d){return function(_0x1b2b4e){if(!_0x1b2b4e){_0x426026['sendStatus'](0x194);}return _0x1b2b4e;};}function handleError(_0x2fc0af,_0x516b57){_0x516b57=_0x516b57||0x1f4;return function(_0x43e169){logger['error'](_0x43e169['stack']);if(_0x43e169['name']){delete _0x43e169[_0x0c13('0x2a')];}_0x2fc0af[_0x0c13('0x1c')](_0x516b57)[_0x0c13('0x2b')](_0x43e169);};}exports[_0x0c13('0x2c')]=function(_0x38a965,_0x58c1a7){var _0x31a4c7={},_0x1476f4={},_0x5dac22={'count':0x0,'rows':[]};var _0x3dedb6=_['map'](db['ServicenowConfiguration']['rawAttributes'],function(_0x2dadd3){return{'name':_0x2dadd3['fieldName'],'type':_0x2dadd3[_0x0c13('0x2d')][_0x0c13('0x2e')]};});_0x1476f4[_0x0c13('0x2f')]=_[_0x0c13('0x30')](_0x3dedb6,_0x0c13('0x2a'));_0x1476f4[_0x0c13('0x31')]=_[_0x0c13('0x32')](_0x38a965['query']);_0x1476f4[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x1476f4[_0x0c13('0x2f')],_0x1476f4[_0x0c13('0x31')]);_0x31a4c7[_0x0c13('0x35')]=_[_0x0c13('0x34')](_0x1476f4[_0x0c13('0x2f')],qs[_0x0c13('0x36')](_0x38a965['query']['fields']));_0x31a4c7[_0x0c13('0x35')]=_0x31a4c7[_0x0c13('0x35')]['length']?_0x31a4c7[_0x0c13('0x35')]:_0x1476f4['model'];if(!_0x38a965['query']['hasOwnProperty'](_0x0c13('0x37'))){_0x31a4c7[_0x0c13('0x22')]=qs[_0x0c13('0x22')](_0x38a965['query'][_0x0c13('0x22')]);_0x31a4c7[_0x0c13('0x1f')]=qs[_0x0c13('0x1f')](_0x38a965[_0x0c13('0x31')][_0x0c13('0x1f')]);}_0x31a4c7[_0x0c13('0x38')]=qs[_0x0c13('0x39')](_0x38a965[_0x0c13('0x31')]['sort']);_0x31a4c7[_0x0c13('0x3a')]=qs[_0x0c13('0x33')](_[_0x0c13('0x3b')](_0x38a965[_0x0c13('0x31')],_0x1476f4[_0x0c13('0x33')]),_0x3dedb6);if(_0x38a965[_0x0c13('0x31')][_0x0c13('0x3c')]){_0x31a4c7[_0x0c13('0x3a')]=_[_0x0c13('0x3d')](_0x31a4c7[_0x0c13('0x3a')],{'$or':_[_0x0c13('0x30')](_0x3dedb6,function(_0x575b8b){if(_0x575b8b[_0x0c13('0x2d')]!==_0x0c13('0x3e')){var _0x139311={};_0x139311[_0x575b8b[_0x0c13('0x2a')]]={'$like':'%'+_0x38a965[_0x0c13('0x31')][_0x0c13('0x3c')]+'%'};return _0x139311;}})});}_0x31a4c7=_[_0x0c13('0x3d')]({},_0x31a4c7,_0x38a965[_0x0c13('0x3f')]);var _0x37fc98={'where':_0x31a4c7[_0x0c13('0x3a')]};return db[_0x0c13('0x40')][_0x0c13('0x21')](_0x37fc98)[_0x0c13('0x28')](function(_0x4ad7e5){_0x5dac22[_0x0c13('0x21')]=_0x4ad7e5;if(_0x38a965[_0x0c13('0x31')][_0x0c13('0x41')]){_0x31a4c7[_0x0c13('0x42')]=[{'all':!![]}];}return db[_0x0c13('0x40')][_0x0c13('0x43')](_0x31a4c7);})['then'](function(_0x2ab6fd){_0x5dac22[_0x0c13('0x44')]=_0x2ab6fd;return _0x5dac22;})[_0x0c13('0x28')](respondWithFilteredResult(_0x58c1a7,_0x31a4c7))['catch'](handleError(_0x58c1a7,null));};exports['show']=function(_0x425dbb,_0x2e036f){var _0x2999ee={'raw':![],'where':{'id':_0x425dbb[_0x0c13('0x45')]['id']}},_0x2f51f6={};_0x2f51f6[_0x0c13('0x2f')]=_[_0x0c13('0x32')](db[_0x0c13('0x40')][_0x0c13('0x46')]);_0x2f51f6[_0x0c13('0x31')]=_[_0x0c13('0x32')](_0x425dbb[_0x0c13('0x31')]);_0x2f51f6[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x2f51f6[_0x0c13('0x2f')],_0x2f51f6[_0x0c13('0x31')]);_0x2999ee[_0x0c13('0x35')]=_['intersection'](_0x2f51f6[_0x0c13('0x2f')],qs[_0x0c13('0x36')](_0x425dbb['query'][_0x0c13('0x36')]));_0x2999ee['attributes']=_0x2999ee['attributes'][_0x0c13('0x47')]?_0x2999ee[_0x0c13('0x35')]:_0x2f51f6[_0x0c13('0x2f')];if(_0x425dbb[_0x0c13('0x31')]['includeAll']){_0x2999ee[_0x0c13('0x42')]=[{'all':!![]}];}_0x2999ee=_['merge']({},_0x2999ee,_0x425dbb[_0x0c13('0x3f')]);return db['ServicenowConfiguration'][_0x0c13('0x48')](_0x2999ee)[_0x0c13('0x28')](handleEntityNotFound(_0x2e036f,null))[_0x0c13('0x28')](respondWithResult(_0x2e036f,null))[_0x0c13('0x49')](handleError(_0x2e036f,null));};exports[_0x0c13('0x4a')]=function(_0x4aefbd,_0x2a6d89){return db[_0x0c13('0x40')][_0x0c13('0x4a')](_0x4aefbd[_0x0c13('0x4b')],{})[_0x0c13('0x28')](respondWithResult(_0x2a6d89,0xc9))[_0x0c13('0x49')](handleError(_0x2a6d89,null));};exports[_0x0c13('0x27')]=function(_0x24f2fb,_0x118b00){if(_0x24f2fb[_0x0c13('0x4b')]['id']){delete _0x24f2fb[_0x0c13('0x4b')]['id'];}return db[_0x0c13('0x40')][_0x0c13('0x48')]({'where':{'id':_0x24f2fb[_0x0c13('0x45')]['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0x118b00,null))[_0x0c13('0x28')](saveUpdates(_0x24f2fb[_0x0c13('0x4b')],null))[_0x0c13('0x28')](respondWithResult(_0x118b00,null))['catch'](handleError(_0x118b00,null));};exports[_0x0c13('0x29')]=function(_0x687dc8,_0x482c3a){return db[_0x0c13('0x40')][_0x0c13('0x48')]({'where':{'id':_0x687dc8['params']['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0x482c3a,null))[_0x0c13('0x28')](removeEntity(_0x482c3a,null))[_0x0c13('0x49')](handleError(_0x482c3a,null));};exports[_0x0c13('0x4c')]=function(_0x27a28f,_0x53d093,_0x2bf3b7){var _0x758547={};var _0x4fef5a={};var _0x8e52c;var _0x50dd8d;return db[_0x0c13('0x40')]['findOne']({'where':{'id':_0x27a28f[_0x0c13('0x45')]['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0x53d093,null))[_0x0c13('0x28')](function(_0x4a4a69){if(_0x4a4a69){_0x8e52c=_0x4a4a69;_0x4fef5a['model']=_[_0x0c13('0x32')](db['ServicenowField']['rawAttributes']);_0x4fef5a['query']=_[_0x0c13('0x32')](_0x27a28f[_0x0c13('0x31')]);_0x4fef5a[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x4fef5a['model'],_0x4fef5a[_0x0c13('0x31')]);_0x758547['attributes']=_['intersection'](_0x4fef5a[_0x0c13('0x2f')],qs[_0x0c13('0x36')](_0x27a28f[_0x0c13('0x31')][_0x0c13('0x36')]));_0x758547[_0x0c13('0x35')]=_0x758547['attributes'][_0x0c13('0x47')]?_0x758547[_0x0c13('0x35')]:_0x4fef5a[_0x0c13('0x2f')];_0x758547[_0x0c13('0x38')]=qs['sort'](_0x27a28f[_0x0c13('0x31')][_0x0c13('0x39')]);_0x758547[_0x0c13('0x3a')]=qs[_0x0c13('0x33')](_[_0x0c13('0x3b')](_0x27a28f['query'],_0x4fef5a[_0x0c13('0x33')]));if(_0x27a28f[_0x0c13('0x31')][_0x0c13('0x3c')]){_0x758547[_0x0c13('0x3a')]=_['merge'](_0x758547[_0x0c13('0x3a')],{'$or':_['map'](_0x758547[_0x0c13('0x35')],function(_0x141757){var _0x165d9f={};_0x165d9f[_0x141757]={'$like':'%'+_0x27a28f['query'][_0x0c13('0x3c')]+'%'};return _0x165d9f;})});}_0x758547=_['merge']({},_0x758547,_0x27a28f['options']);return _0x8e52c[_0x0c13('0x4c')](_0x758547);}})['then'](function(_0x3ff5d9){if(_0x3ff5d9){_0x50dd8d=_0x3ff5d9[_0x0c13('0x47')];if(!_0x27a28f[_0x0c13('0x31')][_0x0c13('0x4d')](_0x0c13('0x37'))){_0x758547[_0x0c13('0x22')]=qs[_0x0c13('0x22')](_0x27a28f[_0x0c13('0x31')]['limit']);_0x758547['offset']=qs[_0x0c13('0x1f')](_0x27a28f['query'][_0x0c13('0x1f')]);}return _0x8e52c[_0x0c13('0x4c')](_0x758547);}})['then'](function(_0x3b4510){if(_0x3b4510){return _0x3b4510?{'count':_0x50dd8d,'rows':_0x3b4510}:null;}})[_0x0c13('0x28')](respondWithResult(_0x53d093,null))[_0x0c13('0x49')](handleError(_0x53d093,null));};exports['getSubjects']=function(_0x251985,_0xae5ee,_0x21e62d){var _0xdbacd={};var _0x5e80e4={};var _0x3793b4;var _0x2ca1f8;return db[_0x0c13('0x40')]['findOne']({'where':{'id':_0x251985[_0x0c13('0x45')]['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0xae5ee,null))[_0x0c13('0x28')](function(_0x658911){if(_0x658911){_0x3793b4=_0x658911;_0x5e80e4[_0x0c13('0x2f')]=_[_0x0c13('0x32')](db['ServicenowField'][_0x0c13('0x46')]);_0x5e80e4[_0x0c13('0x31')]=_[_0x0c13('0x32')](_0x251985['query']);_0x5e80e4[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x5e80e4[_0x0c13('0x2f')],_0x5e80e4[_0x0c13('0x31')]);_0xdbacd['attributes']=_[_0x0c13('0x34')](_0x5e80e4[_0x0c13('0x2f')],qs['fields'](_0x251985[_0x0c13('0x31')]['fields']));_0xdbacd[_0x0c13('0x35')]=_0xdbacd[_0x0c13('0x35')][_0x0c13('0x47')]?_0xdbacd[_0x0c13('0x35')]:_0x5e80e4[_0x0c13('0x2f')];_0xdbacd[_0x0c13('0x38')]=qs[_0x0c13('0x39')](_0x251985[_0x0c13('0x31')][_0x0c13('0x39')]);_0xdbacd[_0x0c13('0x3a')]=qs['filters'](_[_0x0c13('0x3b')](_0x251985[_0x0c13('0x31')],_0x5e80e4[_0x0c13('0x33')]));if(_0x251985[_0x0c13('0x31')][_0x0c13('0x3c')]){_0xdbacd[_0x0c13('0x3a')]=_['merge'](_0xdbacd[_0x0c13('0x3a')],{'$or':_[_0x0c13('0x30')](_0xdbacd[_0x0c13('0x35')],function(_0x47cd08){var _0xb63a30={};_0xb63a30[_0x47cd08]={'$like':'%'+_0x251985['query']['filter']+'%'};return _0xb63a30;})});}_0xdbacd=_[_0x0c13('0x3d')]({},_0xdbacd,_0x251985[_0x0c13('0x3f')]);return _0x3793b4[_0x0c13('0x4e')](_0xdbacd);}})[_0x0c13('0x28')](function(_0x28b88e){if(_0x28b88e){_0x2ca1f8=_0x28b88e[_0x0c13('0x47')];if(!_0x251985[_0x0c13('0x31')][_0x0c13('0x4d')]('nolimit')){_0xdbacd[_0x0c13('0x22')]=qs[_0x0c13('0x22')](_0x251985[_0x0c13('0x31')][_0x0c13('0x22')]);_0xdbacd[_0x0c13('0x1f')]=qs[_0x0c13('0x1f')](_0x251985['query'][_0x0c13('0x1f')]);}return _0x3793b4['getSubjects'](_0xdbacd);}})[_0x0c13('0x28')](function(_0xd4e5b5){if(_0xd4e5b5){return _0xd4e5b5?{'count':_0x2ca1f8,'rows':_0xd4e5b5}:null;}})[_0x0c13('0x28')](respondWithResult(_0xae5ee,null))[_0x0c13('0x49')](handleError(_0xae5ee,null));};exports[_0x0c13('0x4f')]=function(_0x5da08f,_0x313511,_0x53d2d5){var _0x5896ab={};var _0x1a012d={};var _0x36aa0e;var _0x39be52;return db['ServicenowConfiguration'][_0x0c13('0x50')]({'where':{'id':_0x5da08f[_0x0c13('0x45')]['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0x313511,null))[_0x0c13('0x28')](function(_0x57c252){if(_0x57c252){_0x36aa0e=_0x57c252;_0x1a012d[_0x0c13('0x2f')]=_[_0x0c13('0x32')](db[_0x0c13('0x51')][_0x0c13('0x46')]);_0x1a012d['query']=_[_0x0c13('0x32')](_0x5da08f[_0x0c13('0x31')]);_0x1a012d[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x1a012d[_0x0c13('0x2f')],_0x1a012d['query']);_0x5896ab[_0x0c13('0x35')]=_[_0x0c13('0x34')](_0x1a012d['model'],qs[_0x0c13('0x36')](_0x5da08f['query'][_0x0c13('0x36')]));_0x5896ab[_0x0c13('0x35')]=_0x5896ab[_0x0c13('0x35')][_0x0c13('0x47')]?_0x5896ab[_0x0c13('0x35')]:_0x1a012d[_0x0c13('0x2f')];_0x5896ab[_0x0c13('0x38')]=qs[_0x0c13('0x39')](_0x5da08f[_0x0c13('0x31')]['sort']);_0x5896ab[_0x0c13('0x3a')]=qs[_0x0c13('0x33')](_[_0x0c13('0x3b')](_0x5da08f[_0x0c13('0x31')],_0x1a012d[_0x0c13('0x33')]));if(_0x5da08f[_0x0c13('0x31')][_0x0c13('0x3c')]){_0x5896ab[_0x0c13('0x3a')]=_[_0x0c13('0x3d')](_0x5896ab[_0x0c13('0x3a')],{'$or':_[_0x0c13('0x30')](_0x5896ab[_0x0c13('0x35')],function(_0x1c9862){var _0x1ac615={};_0x1ac615[_0x1c9862]={'$like':'%'+_0x5da08f[_0x0c13('0x31')][_0x0c13('0x3c')]+'%'};return _0x1ac615;})});}_0x5896ab=_[_0x0c13('0x3d')]({},_0x5896ab,_0x5da08f[_0x0c13('0x3f')]);return _0x36aa0e[_0x0c13('0x4f')](_0x5896ab);}})[_0x0c13('0x28')](function(_0x4e2f74){if(_0x4e2f74){_0x39be52=_0x4e2f74['length'];if(!_0x5da08f[_0x0c13('0x31')]['hasOwnProperty'](_0x0c13('0x37'))){_0x5896ab[_0x0c13('0x22')]=qs[_0x0c13('0x22')](_0x5da08f[_0x0c13('0x31')]['limit']);_0x5896ab[_0x0c13('0x1f')]=qs[_0x0c13('0x1f')](_0x5da08f[_0x0c13('0x31')][_0x0c13('0x1f')]);}return _0x36aa0e[_0x0c13('0x4f')](_0x5896ab);}})[_0x0c13('0x28')](function(_0x249785){if(_0x249785){return _0x249785?{'count':_0x39be52,'rows':_0x249785}:null;}})[_0x0c13('0x28')](respondWithResult(_0x313511,null))['catch'](handleError(_0x313511,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index de3c3f6..91821b4 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 _0xe605=['exports','define','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x37f0a5,_0x368e07){var _0x444e15=function(_0x4ddb96){while(--_0x4ddb96){_0x37f0a5['push'](_0x37f0a5['shift']());}};_0x444e15(++_0x368e07);}(_0xe605,0x92));var _0x5e60=function(_0x5d2518,_0x3e1346){_0x5d2518=_0x5d2518-0x0;var _0x33be7e=_0xe605[_0x5d2518];return _0x33be7e;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var logger=require('../../config/logger')(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var BPromise=require(_0x5e60('0x4'));var rp=require(_0x5e60('0x5'));var fs=require('fs');var path=require(_0x5e60('0x6'));var rimraf=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var attributes=require(_0x5e60('0x9'));module[_0x5e60('0xa')]=function(_0xc41535,_0x1d4a08){return _0xc41535[_0x5e60('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0x5e60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83e1=['bluebird','rimraf','../../config/environment','define','ServicenowConfiguration','lodash','util','api'];(function(_0x442408,_0xad4811){var _0x368770=function(_0x27420c){while(--_0x27420c){_0x442408['push'](_0x442408['shift']());}};_0x368770(++_0xad4811);}(_0x83e1,0x1ad));var _0x183e=function(_0x5b9439,_0x1e100d){_0x5b9439=_0x5b9439-0x0;var _0x4fa417=_0x83e1[_0x5b9439];return _0x4fa417;};'use strict';var _=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var logger=require('../../config/logger')(_0x183e('0x2'));var moment=require('moment');var BPromise=require(_0x183e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x183e('0x4'));var config=require(_0x183e('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x4d7710,_0x2e3bbd){return _0x4d7710[_0x183e('0x6')](_0x183e('0x7'),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 61c3367..fd9126f 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 _0x6033=['catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result'];(function(_0x382dcc,_0x25c6cc){var _0x4b280f=function(_0x1de3d5){while(--_0x1de3d5){_0x382dcc['push'](_0x382dcc['shift']());}};_0x4b280f(++_0x25c6cc);}(_0x6033,0x177));var _0x3603=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6033[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x3603('0x0'));var moment=require('moment');var BPromise=require(_0x3603('0x1'));var rs=require(_0x3603('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3603('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3603('0x4'))(_0x3603('0x5'));var config=require(_0x3603('0x6'));var jayson=require(_0x3603('0x7'));var client=jayson[_0x3603('0x8')][_0x3603('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x499eac,_0x166b62,_0x1d0dc5){return new BPromise(function(_0x39fb08,_0x41675c){return client[_0x3603('0xa')](_0x499eac,_0x1d0dc5)[_0x3603('0xb')](function(_0x2a8ae5){logger[_0x3603('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x166b62,_0x3603('0xd'));logger[_0x3603('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x166b62,_0x3603('0xd'),JSON[_0x3603('0xf')](_0x2a8ae5));if(_0x2a8ae5[_0x3603('0x10')]){if(_0x2a8ae5[_0x3603('0x10')][_0x3603('0x11')]===0x1f4){logger['error'](_0x3603('0x12'),_0x166b62,_0x2a8ae5[_0x3603('0x10')][_0x3603('0x13')]);return _0x41675c(_0x2a8ae5[_0x3603('0x10')][_0x3603('0x13')]);}logger[_0x3603('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x166b62,_0x2a8ae5[_0x3603('0x10')][_0x3603('0x13')]);return _0x39fb08(_0x2a8ae5[_0x3603('0x10')][_0x3603('0x13')]);}else{logger[_0x3603('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x166b62,_0x3603('0xd'));_0x39fb08(_0x2a8ae5[_0x3603('0x14')][_0x3603('0x13')]);}})[_0x3603('0x15')](function(_0x29d992){logger['error'](_0x3603('0x12'),_0x166b62,_0x29d992);_0x41675c(_0x29d992);});});} \ No newline at end of file +var _0xb1af=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x397fc0,_0x26002e){var _0xfefc78=function(_0x1cd3f7){while(--_0x1cd3f7){_0x397fc0['push'](_0x397fc0['shift']());}};_0xfefc78(++_0x26002e);}(_0xb1af,0x156));var _0xfb1a=function(_0x15bb96,_0x183000){_0x15bb96=_0x15bb96-0x0;var _0x48568e=_0xb1af[_0x15bb96];return _0x48568e;};'use strict';var _=require('lodash');var util=require(_0xfb1a('0x0'));var moment=require(_0xfb1a('0x1'));var BPromise=require(_0xfb1a('0x2'));var rs=require(_0xfb1a('0x3'));var fs=require('fs');var Redis=require(_0xfb1a('0x4'));var db=require(_0xfb1a('0x5'))['db'];var utils=require(_0xfb1a('0x6'));var logger=require(_0xfb1a('0x7'))(_0xfb1a('0x8'));var config=require(_0xfb1a('0x9'));var jayson=require(_0xfb1a('0xa'));var client=jayson['client'][_0xfb1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571e35,_0x412366,_0x3a76a3){return new BPromise(function(_0xebf42c,_0x3446a3){return client[_0xfb1a('0xc')](_0x571e35,_0x3a76a3)[_0xfb1a('0xd')](function(_0x4e72f3){logger[_0xfb1a('0xe')](_0xfb1a('0xf'),_0x412366,_0xfb1a('0x10'));logger[_0xfb1a('0x11')](_0xfb1a('0x12'),_0x412366,_0xfb1a('0x10'),JSON[_0xfb1a('0x13')](_0x4e72f3));if(_0x4e72f3[_0xfb1a('0x14')]){if(_0x4e72f3['error']['code']===0x1f4){logger[_0xfb1a('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x412366,_0x4e72f3[_0xfb1a('0x14')][_0xfb1a('0x15')]);return _0x3446a3(_0x4e72f3[_0xfb1a('0x14')][_0xfb1a('0x15')]);}logger[_0xfb1a('0x14')](_0xfb1a('0xf'),_0x412366,_0x4e72f3[_0xfb1a('0x14')]['message']);return _0xebf42c(_0x4e72f3[_0xfb1a('0x14')][_0xfb1a('0x15')]);}else{logger[_0xfb1a('0xe')](_0xfb1a('0xf'),_0x412366,_0xfb1a('0x10'));_0xebf42c(_0x4e72f3[_0xfb1a('0x16')][_0xfb1a('0x15')]);}})[_0xfb1a('0x17')](function(_0x137fdf){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x412366,_0x137fdf);_0x3446a3(_0x137fdf);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a12fcec..8a3027e 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 _0xbd27=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','multer','express','Router','fs-extra'];(function(_0x478379,_0x4f8455){var _0x4b1d00=function(_0x313cdf){while(--_0x313cdf){_0x478379['push'](_0x478379['shift']());}};_0x4b1d00(++_0x4f8455);}(_0xbd27,0x152));var _0x7bd2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd27[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7bd2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7bd2('0x1'));var router=express[_0x7bd2('0x2')]();var fs_extra=require(_0x7bd2('0x3'));var auth=require(_0x7bd2('0x4'));var interaction=require(_0x7bd2('0x5'));var config=require(_0x7bd2('0x6'));var controller=require(_0x7bd2('0x7'));router[_0x7bd2('0x8')]('/',auth[_0x7bd2('0x9')](),controller[_0x7bd2('0xa')]);router[_0x7bd2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7bd2('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7bd2('0xc')]);router[_0x7bd2('0xd')]('/:id',auth[_0x7bd2('0x9')](),controller[_0x7bd2('0xe')]);router[_0x7bd2('0xf')](_0x7bd2('0x10'),auth[_0x7bd2('0x9')](),controller[_0x7bd2('0x11')]);module[_0x7bd2('0x12')]=router; \ No newline at end of file +var _0x3c10=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x2ab297,_0x2d6ea0){var _0x519b07=function(_0x323355){while(--_0x323355){_0x2ab297['push'](_0x2ab297['shift']());}};_0x519b07(++_0x2d6ea0);}(_0x3c10,0x1b8));var _0x03c1=function(_0x19be0e,_0x207bdd){_0x19be0e=_0x19be0e-0x0;var _0x5c24cd=_0x3c10[_0x19be0e];return _0x5c24cd;};'use strict';var multer=require(_0x03c1('0x0'));var util=require(_0x03c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x03c1('0x2'));var router=express[_0x03c1('0x3')]();var fs_extra=require(_0x03c1('0x4'));var auth=require(_0x03c1('0x5'));var interaction=require(_0x03c1('0x6'));var config=require(_0x03c1('0x7'));var controller=require(_0x03c1('0x8'));router[_0x03c1('0x9')]('/',auth['isAuthenticated'](),controller[_0x03c1('0xa')]);router[_0x03c1('0x9')]('/:id',auth[_0x03c1('0xb')](),controller[_0x03c1('0xc')]);router['post']('/',auth[_0x03c1('0xb')](),controller[_0x03c1('0xd')]);router[_0x03c1('0xe')](_0x03c1('0xf'),auth[_0x03c1('0xb')](),controller[_0x03c1('0x10')]);router[_0x03c1('0x11')]('/:id',auth[_0x03c1('0xb')](),controller[_0x03c1('0x12')]);module[_0x03c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b4320d0..0545834 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 _0xc74e=['string','STRING','variable','sequelize','exports','ENUM','keyValue'];(function(_0x495b31,_0x44c289){var _0x3e8757=function(_0x426e4e){while(--_0x426e4e){_0x495b31['push'](_0x495b31['shift']());}};_0x3e8757(++_0x44c289);}(_0xc74e,0x184));var _0xec74=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc74e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xec74('0x0'));module[_0xec74('0x1')]={'type':{'type':Sequelize[_0xec74('0x2')]('string','variable','customVariable',_0xec74('0x3'),'picklist'),'defaultValue':_0xec74('0x4')},'content':{'type':Sequelize[_0xec74('0x5')]},'key':{'type':Sequelize[_0xec74('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xec74('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xec74('0x5')]},'nameField':{'type':Sequelize[_0xec74('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec74('0x5')]}}; \ No newline at end of file +var _0x0d6d=['sequelize','exports','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x5bbf34,_0x104de9){var _0x4b1f8d=function(_0x3494e8){while(--_0x3494e8){_0x5bbf34['push'](_0x5bbf34['shift']());}};_0x4b1f8d(++_0x104de9);}(_0x0d6d,0x188));var _0xd0d6=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0d6d[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xd0d6('0x0'));module[_0xd0d6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd0d6('0x2'),_0xd0d6('0x3'),_0xd0d6('0x4'),_0xd0d6('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd0d6('0x6')]},'key':{'type':Sequelize[_0xd0d6('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd0d6('0x2'),_0xd0d6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd0d6('0x6')]},'idField':{'type':Sequelize[_0xd0d6('0x6')]},'nameField':{'type':Sequelize[_0xd0d6('0x6')]},'customField':{'type':Sequelize[_0xd0d6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd0d6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f2dba53..c0d0d90 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 _0xf280=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','model','query','keys','filters'];(function(_0x15f2b9,_0x5bdd5c){var _0x56c53f=function(_0x2f9d14){while(--_0x2f9d14){_0x15f2b9['push'](_0x15f2b9['shift']());}};_0x56c53f(++_0x5bdd5c);}(_0xf280,0xab));var _0x0f28=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0xf280[_0x179e11];return _0x549f04;};'use strict';var emlformat=require(_0x0f28('0x0'));var rimraf=require(_0x0f28('0x1'));var zipdir=require(_0x0f28('0x2'));var jsonpatch=require(_0x0f28('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f28('0x4'));var Mustache=require(_0x0f28('0x5'));var util=require(_0x0f28('0x6'));var path=require(_0x0f28('0x7'));var sox=require(_0x0f28('0x8'));var csv=require(_0x0f28('0x9'));var ejs=require(_0x0f28('0xa'));var fs=require('fs');var fs_extra=require(_0x0f28('0xb'));var _=require(_0x0f28('0xc'));var squel=require(_0x0f28('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f28('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f28('0xf'));var Papa=require('papaparse');var Redis=require(_0x0f28('0x10'));var authService=require(_0x0f28('0x11'));var qs=require(_0x0f28('0x12'));var as=require(_0x0f28('0x13'));var hardwareService=require(_0x0f28('0x14'));var logger=require('../../config/logger')(_0x0f28('0x15'));var utils=require('../../config/utils');var config=require(_0x0f28('0x16'));var licenseUtil=require(_0x0f28('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x343232,_0xbdca38){_0xbdca38=_0xbdca38||0xcc;return function(_0x49cacc){if(_0x49cacc){return _0x343232[_0x0f28('0x18')](_0xbdca38);}return _0x343232[_0x0f28('0x19')](_0xbdca38)[_0x0f28('0x1a')]();};}function respondWithResult(_0x4c00d6,_0x154ed4){_0x154ed4=_0x154ed4||0xc8;return function(_0x3feae6){if(_0x3feae6){return _0x4c00d6[_0x0f28('0x19')](_0x154ed4)['json'](_0x3feae6);}};}function respondWithFilteredResult(_0x257bac,_0x2f094d){return function(_0x359dca){if(_0x359dca){var _0x11ee52=typeof _0x2f094d[_0x0f28('0x1b')]===_0x0f28('0x1c')&&typeof _0x2f094d['limit']==='undefined';var _0x25837a=_0x359dca[_0x0f28('0x1d')];var _0x552790=_0x11ee52?0x0:_0x2f094d[_0x0f28('0x1b')];var _0x48ed8e=_0x11ee52?_0x359dca['count']:_0x2f094d[_0x0f28('0x1b')]+_0x2f094d[_0x0f28('0x1e')];var _0x429948;if(_0x48ed8e>=_0x25837a){_0x48ed8e=_0x25837a;_0x429948=0xc8;}else{_0x429948=0xce;}_0x257bac[_0x0f28('0x19')](_0x429948);return _0x257bac[_0x0f28('0x1f')](_0x0f28('0x20'),_0x552790+'-'+_0x48ed8e+'/'+_0x25837a)[_0x0f28('0x21')](_0x359dca);}return null;};}function patchUpdates(_0x571045){return function(_0x5b02fd){try{jsonpatch['apply'](_0x5b02fd,_0x571045,!![]);}catch(_0x1084a6){return BPromise[_0x0f28('0x22')](_0x1084a6);}return _0x5b02fd['save']();};}function saveUpdates(_0x521c32,_0x5ac7cd){return function(_0x32d9bb){if(_0x32d9bb){return _0x32d9bb[_0x0f28('0x23')](_0x521c32)['then'](function(_0xff669){return _0xff669;});}return null;};}function removeEntity(_0x421968,_0x517424){return function(_0xbe0986){if(_0xbe0986){return _0xbe0986[_0x0f28('0x24')]()[_0x0f28('0x25')](function(){_0x421968[_0x0f28('0x19')](0xcc)[_0x0f28('0x1a')]();});}};}function handleEntityNotFound(_0x4f6a24,_0x20fd79){return function(_0x52e4b1){if(!_0x52e4b1){_0x4f6a24[_0x0f28('0x18')](0x194);}return _0x52e4b1;};}function handleError(_0x4728de,_0x3acaae){_0x3acaae=_0x3acaae||0x1f4;return function(_0x384e13){logger[_0x0f28('0x26')](_0x384e13[_0x0f28('0x27')]);if(_0x384e13[_0x0f28('0x28')]){delete _0x384e13[_0x0f28('0x28')];}_0x4728de['status'](_0x3acaae)[_0x0f28('0x29')](_0x384e13);};}exports[_0x0f28('0x2a')]=function(_0x44469f,_0x7bf9a8){var _0x13b1e2={},_0x3202aa={},_0x36e52d={'count':0x0,'rows':[]};var _0x8bd2ed=_[_0x0f28('0x2b')](db[_0x0f28('0x2c')][_0x0f28('0x2d')],function(_0x1fd7b9){return{'name':_0x1fd7b9['fieldName'],'type':_0x1fd7b9[_0x0f28('0x2e')]['key']};});_0x3202aa[_0x0f28('0x2f')]=_[_0x0f28('0x2b')](_0x8bd2ed,_0x0f28('0x28'));_0x3202aa[_0x0f28('0x30')]=_[_0x0f28('0x31')](_0x44469f['query']);_0x3202aa[_0x0f28('0x32')]=_[_0x0f28('0x33')](_0x3202aa[_0x0f28('0x2f')],_0x3202aa[_0x0f28('0x30')]);_0x13b1e2['attributes']=_['intersection'](_0x3202aa['model'],qs[_0x0f28('0x34')](_0x44469f[_0x0f28('0x30')][_0x0f28('0x34')]));_0x13b1e2[_0x0f28('0x35')]=_0x13b1e2['attributes'][_0x0f28('0x36')]?_0x13b1e2[_0x0f28('0x35')]:_0x3202aa[_0x0f28('0x2f')];if(!_0x44469f['query'][_0x0f28('0x37')](_0x0f28('0x38'))){_0x13b1e2[_0x0f28('0x1e')]=qs[_0x0f28('0x1e')](_0x44469f[_0x0f28('0x30')][_0x0f28('0x1e')]);_0x13b1e2[_0x0f28('0x1b')]=qs[_0x0f28('0x1b')](_0x44469f[_0x0f28('0x30')][_0x0f28('0x1b')]);}_0x13b1e2[_0x0f28('0x39')]=qs[_0x0f28('0x3a')](_0x44469f['query'][_0x0f28('0x3a')]);_0x13b1e2[_0x0f28('0x3b')]=qs['filters'](_['pick'](_0x44469f[_0x0f28('0x30')],_0x3202aa['filters']),_0x8bd2ed);if(_0x44469f['query'][_0x0f28('0x3c')]){_0x13b1e2[_0x0f28('0x3b')]=_[_0x0f28('0x3d')](_0x13b1e2['where'],{'$or':_[_0x0f28('0x2b')](_0x8bd2ed,function(_0xa7dab9){if(_0xa7dab9[_0x0f28('0x2e')]!==_0x0f28('0x3e')){var _0x32ae44={};_0x32ae44[_0xa7dab9[_0x0f28('0x28')]]={'$like':'%'+_0x44469f[_0x0f28('0x30')][_0x0f28('0x3c')]+'%'};return _0x32ae44;}})});}_0x13b1e2=_[_0x0f28('0x3d')]({},_0x13b1e2,_0x44469f[_0x0f28('0x3f')]);var _0x528819={'where':_0x13b1e2[_0x0f28('0x3b')]};return db[_0x0f28('0x2c')][_0x0f28('0x1d')](_0x528819)[_0x0f28('0x25')](function(_0x5c906b){_0x36e52d[_0x0f28('0x1d')]=_0x5c906b;if(_0x44469f['query'][_0x0f28('0x40')]){_0x13b1e2[_0x0f28('0x41')]=[{'all':!![]}];}return db[_0x0f28('0x2c')][_0x0f28('0x42')](_0x13b1e2);})[_0x0f28('0x25')](function(_0x360e29){_0x36e52d[_0x0f28('0x43')]=_0x360e29;return _0x36e52d;})[_0x0f28('0x25')](respondWithFilteredResult(_0x7bf9a8,_0x13b1e2))[_0x0f28('0x44')](handleError(_0x7bf9a8,null));};exports[_0x0f28('0x45')]=function(_0x4d7555,_0x41cfad){var _0x55a891={'raw':!![],'where':{'id':_0x4d7555[_0x0f28('0x46')]['id']}},_0x3d6397={};_0x3d6397[_0x0f28('0x2f')]=_[_0x0f28('0x31')](db[_0x0f28('0x2c')][_0x0f28('0x2d')]);_0x3d6397['query']=_[_0x0f28('0x31')](_0x4d7555[_0x0f28('0x30')]);_0x3d6397['filters']=_[_0x0f28('0x33')](_0x3d6397[_0x0f28('0x2f')],_0x3d6397[_0x0f28('0x30')]);_0x55a891[_0x0f28('0x35')]=_['intersection'](_0x3d6397[_0x0f28('0x2f')],qs[_0x0f28('0x34')](_0x4d7555[_0x0f28('0x30')][_0x0f28('0x34')]));_0x55a891['attributes']=_0x55a891[_0x0f28('0x35')][_0x0f28('0x36')]?_0x55a891['attributes']:_0x3d6397[_0x0f28('0x2f')];if(_0x4d7555[_0x0f28('0x30')][_0x0f28('0x40')]){_0x55a891['include']=[{'all':!![]}];}_0x55a891=_[_0x0f28('0x3d')]({},_0x55a891,_0x4d7555[_0x0f28('0x3f')]);return db[_0x0f28('0x2c')]['find'](_0x55a891)['then'](handleEntityNotFound(_0x41cfad,null))[_0x0f28('0x25')](respondWithResult(_0x41cfad,null))[_0x0f28('0x44')](handleError(_0x41cfad,null));};exports[_0x0f28('0x47')]=function(_0x37db18,_0x407ced){return db[_0x0f28('0x2c')][_0x0f28('0x47')](_0x37db18[_0x0f28('0x48')],{})[_0x0f28('0x25')](respondWithResult(_0x407ced,0xc9))[_0x0f28('0x44')](handleError(_0x407ced,null));};exports[_0x0f28('0x23')]=function(_0x11f7e7,_0x233f6b){if(_0x11f7e7[_0x0f28('0x48')]['id']){delete _0x11f7e7[_0x0f28('0x48')]['id'];}return db[_0x0f28('0x2c')][_0x0f28('0x49')]({'where':{'id':_0x11f7e7[_0x0f28('0x46')]['id']}})[_0x0f28('0x25')](handleEntityNotFound(_0x233f6b,null))[_0x0f28('0x25')](saveUpdates(_0x11f7e7[_0x0f28('0x48')],null))[_0x0f28('0x25')](respondWithResult(_0x233f6b,null))[_0x0f28('0x44')](handleError(_0x233f6b,null));};exports[_0x0f28('0x24')]=function(_0x3a0ead,_0x571bf1){return db[_0x0f28('0x2c')][_0x0f28('0x49')]({'where':{'id':_0x3a0ead[_0x0f28('0x46')]['id']}})['then'](handleEntityNotFound(_0x571bf1,null))['then'](removeEntity(_0x571bf1,null))[_0x0f28('0x44')](handleError(_0x571bf1,null));}; \ No newline at end of file +var _0x685e=['params','intersection','include','find','create','update','body','eml-format','zip-dir','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','catch'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x685e,0x1ea));var _0xe685=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x685e[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require(_0xe685('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe685('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe685('0x2'));var Mustache=require(_0xe685('0x3'));var util=require(_0xe685('0x4'));var path=require(_0xe685('0x5'));var sox=require(_0xe685('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe685('0x7'));var _=require('lodash');var squel=require(_0xe685('0x8'));var crypto=require('crypto');var jsforce=require(_0xe685('0x9'));var deskjs=require(_0xe685('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe685('0xb'));var Papa=require(_0xe685('0xc'));var Redis=require(_0xe685('0xd'));var authService=require(_0xe685('0xe'));var qs=require(_0xe685('0xf'));var as=require(_0xe685('0x10'));var hardwareService=require(_0xe685('0x11'));var logger=require('../../config/logger')(_0xe685('0x12'));var utils=require(_0xe685('0x13'));var config=require(_0xe685('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe685('0x15'))['db'];function respondWithStatusCode(_0x55c5e2,_0xc97e74){_0xc97e74=_0xc97e74||0xcc;return function(_0x25f1e7){if(_0x25f1e7){return _0x55c5e2['sendStatus'](_0xc97e74);}return _0x55c5e2[_0xe685('0x16')](_0xc97e74)[_0xe685('0x17')]();};}function respondWithResult(_0x160977,_0x20f1df){_0x20f1df=_0x20f1df||0xc8;return function(_0x5b9c51){if(_0x5b9c51){return _0x160977[_0xe685('0x16')](_0x20f1df)[_0xe685('0x18')](_0x5b9c51);}};}function respondWithFilteredResult(_0x22689b,_0x2031b0){return function(_0x53b6cc){if(_0x53b6cc){var _0x53461e=typeof _0x2031b0[_0xe685('0x19')]==='undefined'&&typeof _0x2031b0[_0xe685('0x1a')]===_0xe685('0x1b');var _0x4a8456=_0x53b6cc[_0xe685('0x1c')];var _0x205824=_0x53461e?0x0:_0x2031b0[_0xe685('0x19')];var _0x3b202d=_0x53461e?_0x53b6cc[_0xe685('0x1c')]:_0x2031b0['offset']+_0x2031b0[_0xe685('0x1a')];var _0x2f8989;if(_0x3b202d>=_0x4a8456){_0x3b202d=_0x4a8456;_0x2f8989=0xc8;}else{_0x2f8989=0xce;}_0x22689b[_0xe685('0x16')](_0x2f8989);return _0x22689b[_0xe685('0x1d')]('Content-Range',_0x205824+'-'+_0x3b202d+'/'+_0x4a8456)['json'](_0x53b6cc);}return null;};}function patchUpdates(_0x3fe10a){return function(_0xce3c43){try{jsonpatch[_0xe685('0x1e')](_0xce3c43,_0x3fe10a,!![]);}catch(_0x2f672c){return BPromise[_0xe685('0x1f')](_0x2f672c);}return _0xce3c43['save']();};}function saveUpdates(_0x4d1930,_0x370e9d){return function(_0x4707fe){if(_0x4707fe){return _0x4707fe['update'](_0x4d1930)[_0xe685('0x20')](function(_0x3e7885){return _0x3e7885;});}return null;};}function removeEntity(_0x20bf19,_0x4b27da){return function(_0x3cc3f9){if(_0x3cc3f9){return _0x3cc3f9[_0xe685('0x21')]()[_0xe685('0x20')](function(){_0x20bf19[_0xe685('0x16')](0xcc)[_0xe685('0x17')]();});}};}function handleEntityNotFound(_0x32f0fa,_0xe01825){return function(_0xd44b4e){if(!_0xd44b4e){_0x32f0fa['sendStatus'](0x194);}return _0xd44b4e;};}function handleError(_0xdcdfb7,_0x3e608c){_0x3e608c=_0x3e608c||0x1f4;return function(_0x5a195e){logger[_0xe685('0x22')](_0x5a195e[_0xe685('0x23')]);if(_0x5a195e[_0xe685('0x24')]){delete _0x5a195e[_0xe685('0x24')];}_0xdcdfb7[_0xe685('0x16')](_0x3e608c)[_0xe685('0x25')](_0x5a195e);};}exports[_0xe685('0x26')]=function(_0x4481ea,_0xf31734){var _0x5d4495={},_0x51c1cc={},_0x5e1a98={'count':0x0,'rows':[]};var _0x16e4b9=_['map'](db[_0xe685('0x27')][_0xe685('0x28')],function(_0x49cf59){return{'name':_0x49cf59['fieldName'],'type':_0x49cf59['type']['key']};});_0x51c1cc[_0xe685('0x29')]=_[_0xe685('0x2a')](_0x16e4b9,_0xe685('0x24'));_0x51c1cc[_0xe685('0x2b')]=_['keys'](_0x4481ea[_0xe685('0x2b')]);_0x51c1cc['filters']=_['intersection'](_0x51c1cc[_0xe685('0x29')],_0x51c1cc[_0xe685('0x2b')]);_0x5d4495[_0xe685('0x2c')]=_['intersection'](_0x51c1cc[_0xe685('0x29')],qs['fields'](_0x4481ea[_0xe685('0x2b')][_0xe685('0x2d')]));_0x5d4495[_0xe685('0x2c')]=_0x5d4495[_0xe685('0x2c')][_0xe685('0x2e')]?_0x5d4495[_0xe685('0x2c')]:_0x51c1cc['model'];if(!_0x4481ea[_0xe685('0x2b')][_0xe685('0x2f')](_0xe685('0x30'))){_0x5d4495[_0xe685('0x1a')]=qs['limit'](_0x4481ea[_0xe685('0x2b')][_0xe685('0x1a')]);_0x5d4495['offset']=qs[_0xe685('0x19')](_0x4481ea['query'][_0xe685('0x19')]);}_0x5d4495[_0xe685('0x31')]=qs['sort'](_0x4481ea[_0xe685('0x2b')][_0xe685('0x32')]);_0x5d4495['where']=qs[_0xe685('0x33')](_[_0xe685('0x34')](_0x4481ea[_0xe685('0x2b')],_0x51c1cc[_0xe685('0x33')]),_0x16e4b9);if(_0x4481ea['query'][_0xe685('0x35')]){_0x5d4495[_0xe685('0x36')]=_[_0xe685('0x37')](_0x5d4495[_0xe685('0x36')],{'$or':_[_0xe685('0x2a')](_0x16e4b9,function(_0x47f78a){if(_0x47f78a[_0xe685('0x38')]!==_0xe685('0x39')){var _0x5e8037={};_0x5e8037[_0x47f78a['name']]={'$like':'%'+_0x4481ea[_0xe685('0x2b')][_0xe685('0x35')]+'%'};return _0x5e8037;}})});}_0x5d4495=_['merge']({},_0x5d4495,_0x4481ea['options']);var _0x571135={'where':_0x5d4495[_0xe685('0x36')]};return db['ServicenowField']['count'](_0x571135)[_0xe685('0x20')](function(_0xa779b0){_0x5e1a98[_0xe685('0x1c')]=_0xa779b0;if(_0x4481ea[_0xe685('0x2b')][_0xe685('0x3a')]){_0x5d4495['include']=[{'all':!![]}];}return db[_0xe685('0x27')][_0xe685('0x3b')](_0x5d4495);})[_0xe685('0x20')](function(_0xddd2c6){_0x5e1a98[_0xe685('0x3c')]=_0xddd2c6;return _0x5e1a98;})[_0xe685('0x20')](respondWithFilteredResult(_0xf31734,_0x5d4495))[_0xe685('0x3d')](handleError(_0xf31734,null));};exports['show']=function(_0x8d2eef,_0x4843d9){var _0x4a6615={'raw':!![],'where':{'id':_0x8d2eef[_0xe685('0x3e')]['id']}},_0x83a88a={};_0x83a88a[_0xe685('0x29')]=_['keys'](db['ServicenowField'][_0xe685('0x28')]);_0x83a88a[_0xe685('0x2b')]=_['keys'](_0x8d2eef[_0xe685('0x2b')]);_0x83a88a[_0xe685('0x33')]=_[_0xe685('0x3f')](_0x83a88a[_0xe685('0x29')],_0x83a88a[_0xe685('0x2b')]);_0x4a6615[_0xe685('0x2c')]=_[_0xe685('0x3f')](_0x83a88a[_0xe685('0x29')],qs['fields'](_0x8d2eef[_0xe685('0x2b')][_0xe685('0x2d')]));_0x4a6615['attributes']=_0x4a6615[_0xe685('0x2c')]['length']?_0x4a6615[_0xe685('0x2c')]:_0x83a88a['model'];if(_0x8d2eef[_0xe685('0x2b')][_0xe685('0x3a')]){_0x4a6615[_0xe685('0x40')]=[{'all':!![]}];}_0x4a6615=_['merge']({},_0x4a6615,_0x8d2eef['options']);return db['ServicenowField'][_0xe685('0x41')](_0x4a6615)[_0xe685('0x20')](handleEntityNotFound(_0x4843d9,null))[_0xe685('0x20')](respondWithResult(_0x4843d9,null))[_0xe685('0x3d')](handleError(_0x4843d9,null));};exports[_0xe685('0x42')]=function(_0x217baf,_0x2d1818){return db['ServicenowField'][_0xe685('0x42')](_0x217baf['body'],{})['then'](respondWithResult(_0x2d1818,0xc9))[_0xe685('0x3d')](handleError(_0x2d1818,null));};exports[_0xe685('0x43')]=function(_0x432e10,_0x589b60){if(_0x432e10[_0xe685('0x44')]['id']){delete _0x432e10['body']['id'];}return db[_0xe685('0x27')][_0xe685('0x41')]({'where':{'id':_0x432e10['params']['id']}})['then'](handleEntityNotFound(_0x589b60,null))[_0xe685('0x20')](saveUpdates(_0x432e10[_0xe685('0x44')],null))['then'](respondWithResult(_0x589b60,null))[_0xe685('0x3d')](handleError(_0x589b60,null));};exports['destroy']=function(_0x43564f,_0x1896ad){return db[_0xe685('0x27')][_0xe685('0x41')]({'where':{'id':_0x43564f[_0xe685('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1896ad,null))[_0xe685('0x20')](removeEntity(_0x1896ad,null))[_0xe685('0x3d')](handleError(_0x1896ad,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 37d1443..9ffc754 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 _0x9c9f=['./intServicenowField.attributes','exports','int_servicenow_fields','lodash','util','request-promise','path','rimraf','../../config/environment'];(function(_0x500c02,_0x17afde){var _0x1a1efd=function(_0xa52f03){while(--_0xa52f03){_0x500c02['push'](_0x500c02['shift']());}};_0x1a1efd(++_0x17afde);}(_0x9c9f,0xc9));var _0xf9c9=function(_0x55ef51,_0x425ded){_0x55ef51=_0x55ef51-0x0;var _0x5b98cd=_0x9c9f[_0x55ef51];return _0x5b98cd;};'use strict';var _=require(_0xf9c9('0x0'));var util=require(_0xf9c9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9c9('0x2'));var fs=require('fs');var path=require(_0xf9c9('0x3'));var rimraf=require(_0xf9c9('0x4'));var config=require(_0xf9c9('0x5'));var attributes=require(_0xf9c9('0x6'));module[_0xf9c9('0x7')]=function(_0x2e6057,_0x425ad9){return _0x2e6057['define']('ServicenowField',attributes,{'tableName':_0xf9c9('0x8'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba2a=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x89548e,_0x1eeddf){var _0x142951=function(_0x358a4e){while(--_0x358a4e){_0x89548e['push'](_0x89548e['shift']());}};_0x142951(++_0x1eeddf);}(_0xba2a,0x94));var _0xaba2=function(_0x5843d2,_0x121877){_0x5843d2=_0x5843d2-0x0;var _0x6dd37=_0xba2a[_0x5843d2];return _0x6dd37;};'use strict';var _=require(_0xaba2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xaba2('0x1'));var BPromise=require(_0xaba2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaba2('0x3'));var rimraf=require(_0xaba2('0x4'));var config=require(_0xaba2('0x5'));var attributes=require(_0xaba2('0x6'));module[_0xaba2('0x7')]=function(_0x222b28,_0xad8625){return _0x222b28['define'](_0xaba2('0x8'),attributes,{'tableName':_0xaba2('0x9'),'paranoid':![],'indexes':[{'name':_0xaba2('0xa'),'fields':[_0xaba2('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 3505781..ab6bb5f 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x58fc56,_0x2b236e){var _0x49a6d3=function(_0x4abad3){while(--_0x4abad3){_0x58fc56['push'](_0x58fc56['shift']());}};_0x49a6d3(++_0x2b236e);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5a9776,_0x4b5ab3){_0x5a9776=_0x5a9776-0x0;var _0x454edb=_0xbdb7[_0x5a9776];return _0x454edb;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 18b0bd4..5e4565d 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x594a40,_0x22c98f){var _0x5b5b76=function(_0x1e502e){while(--_0x1e502e){_0x594a40['push'](_0x594a40['shift']());}};_0x5b5b76(++_0x22c98f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x22bea9,_0x26d3a8){var _0x432864=function(_0x2aa3c9){while(--_0x2aa3c9){_0x22bea9['push'](_0x22bea9['shift']());}};_0x432864(++_0x26d3a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index eb884ad..d92e569 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(_0x4af387,_0x1509c4){var _0x868b4f=function(_0x3db451){while(--_0x3db451){_0x4af387['push'](_0x4af387['shift']());}};_0x868b4f(++_0x1509c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x43027c,_0x103078){var _0x2a4900=function(_0x504745){while(--_0x504745){_0x43027c['push'](_0x43027c['shift']());}};_0x2a4900(++_0x103078);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 af02743..eabd918 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 _0x4605=['apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','create','SugarcrmAccount','update','body','params','SugarcrmConfiguration','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','moment','bluebird','mustache','path','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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4605,0x147));var _0x5460=function(_0x231bf2,_0x41bc52){_0x231bf2=_0x231bf2-0x0;var _0x3b99cf=_0x4605[_0x231bf2];return _0x3b99cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5460('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5460('0x1'));var BPromise=require(_0x5460('0x2'));var Mustache=require(_0x5460('0x3'));var util=require('util');var path=require(_0x5460('0x4'));var sox=require('sox');var csv=require(_0x5460('0x5'));var ejs=require(_0x5460('0x6'));var fs=require('fs');var fs_extra=require(_0x5460('0x7'));var _=require(_0x5460('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5460('0x9'));var deskjs=require(_0x5460('0xa'));var toCsv=require(_0x5460('0x5'));var querystring=require(_0x5460('0xb'));var Papa=require(_0x5460('0xc'));var Redis=require('ioredis');var authService=require(_0x5460('0xd'));var qs=require(_0x5460('0xe'));var as=require(_0x5460('0xf'));var hardwareService=require(_0x5460('0x10'));var logger=require(_0x5460('0x11'))(_0x5460('0x12'));var utils=require(_0x5460('0x13'));var config=require(_0x5460('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5460('0x15'))['db'];var integrations=require(_0x5460('0x16'));function respondWithStatusCode(_0x559039,_0x3912f9){_0x3912f9=_0x3912f9||0xcc;return function(_0x18fb65){if(_0x18fb65){return _0x559039[_0x5460('0x17')](_0x3912f9);}return _0x559039[_0x5460('0x18')](_0x3912f9)[_0x5460('0x19')]();};}function respondWithResult(_0xd6cb5e,_0x5c1d3d){_0x5c1d3d=_0x5c1d3d||0xc8;return function(_0x927a96){if(_0x927a96){return _0xd6cb5e[_0x5460('0x18')](_0x5c1d3d)[_0x5460('0x1a')](_0x927a96);}};}function respondWithFilteredResult(_0x22efab,_0x3433ba){return function(_0xd3fb0a){if(_0xd3fb0a){var _0x51776f=typeof _0x3433ba[_0x5460('0x1b')]===_0x5460('0x1c')&&typeof _0x3433ba[_0x5460('0x1d')]==='undefined';var _0x40ef1c=_0xd3fb0a[_0x5460('0x1e')];var _0x3a1ae5=_0x51776f?0x0:_0x3433ba[_0x5460('0x1b')];var _0x4081be=_0x51776f?_0xd3fb0a[_0x5460('0x1e')]:_0x3433ba[_0x5460('0x1b')]+_0x3433ba['limit'];var _0x51da03;if(_0x4081be>=_0x40ef1c){_0x4081be=_0x40ef1c;_0x51da03=0xc8;}else{_0x51da03=0xce;}_0x22efab[_0x5460('0x18')](_0x51da03);return _0x22efab[_0x5460('0x1f')](_0x5460('0x20'),_0x3a1ae5+'-'+_0x4081be+'/'+_0x40ef1c)[_0x5460('0x1a')](_0xd3fb0a);}return null;};}function patchUpdates(_0x35f3b4){return function(_0x250ec6){try{jsonpatch[_0x5460('0x21')](_0x250ec6,_0x35f3b4,!![]);}catch(_0x3a3c39){return BPromise[_0x5460('0x22')](_0x3a3c39);}return _0x250ec6[_0x5460('0x23')]();};}function saveUpdates(_0x58feba,_0x41dd50){return function(_0x40c5c3){if(_0x40c5c3){return _0x40c5c3['update'](_0x58feba)[_0x5460('0x24')](function(_0x25622f){return _0x25622f;});}return null;};}function removeEntity(_0xf5d1cc,_0x47afb2){return function(_0x5bd80e){if(_0x5bd80e){return _0x5bd80e[_0x5460('0x25')]()[_0x5460('0x24')](function(){_0xf5d1cc['status'](0xcc)[_0x5460('0x19')]();});}};}function handleEntityNotFound(_0x3c6b3b,_0x427435){return function(_0x465cba){if(!_0x465cba){_0x3c6b3b['sendStatus'](0x194);}return _0x465cba;};}function handleError(_0x2bba60,_0x5b3e43){_0x5b3e43=_0x5b3e43||0x1f4;return function(_0x3cd0dd){logger[_0x5460('0x26')](_0x3cd0dd[_0x5460('0x27')]);if(_0x3cd0dd['name']){delete _0x3cd0dd[_0x5460('0x28')];}_0x2bba60[_0x5460('0x18')](_0x5b3e43)[_0x5460('0x29')](_0x3cd0dd);};}exports['index']=function(_0x2fdd91,_0x5bb9a2){var _0x83e94d={},_0x44a726={},_0x2633dd={'count':0x0,'rows':[]};var _0x47a938=_[_0x5460('0x2a')](db['SugarcrmAccount']['rawAttributes'],function(_0x58cb1d){return{'name':_0x58cb1d[_0x5460('0x2b')],'type':_0x58cb1d['type'][_0x5460('0x2c')]};});_0x44a726[_0x5460('0x2d')]=_[_0x5460('0x2a')](_0x47a938,_0x5460('0x28'));_0x44a726[_0x5460('0x2e')]=_['keys'](_0x2fdd91[_0x5460('0x2e')]);_0x44a726[_0x5460('0x2f')]=_[_0x5460('0x30')](_0x44a726['model'],_0x44a726['query']);_0x83e94d[_0x5460('0x31')]=_[_0x5460('0x30')](_0x44a726[_0x5460('0x2d')],qs['fields'](_0x2fdd91[_0x5460('0x2e')][_0x5460('0x32')]));_0x83e94d[_0x5460('0x31')]=_0x83e94d[_0x5460('0x31')][_0x5460('0x33')]?_0x83e94d[_0x5460('0x31')]:_0x44a726[_0x5460('0x2d')];if(!_0x2fdd91[_0x5460('0x2e')][_0x5460('0x34')]('nolimit')){_0x83e94d[_0x5460('0x1d')]=qs['limit'](_0x2fdd91[_0x5460('0x2e')][_0x5460('0x1d')]);_0x83e94d[_0x5460('0x1b')]=qs['offset'](_0x2fdd91[_0x5460('0x2e')][_0x5460('0x1b')]);}_0x83e94d[_0x5460('0x35')]=qs[_0x5460('0x36')](_0x2fdd91[_0x5460('0x2e')][_0x5460('0x36')]);_0x83e94d[_0x5460('0x37')]=qs[_0x5460('0x2f')](_[_0x5460('0x38')](_0x2fdd91[_0x5460('0x2e')],_0x44a726['filters']),_0x47a938);if(_0x2fdd91[_0x5460('0x2e')]['filter']){_0x83e94d[_0x5460('0x37')]=_[_0x5460('0x39')](_0x83e94d[_0x5460('0x37')],{'$or':_[_0x5460('0x2a')](_0x47a938,function(_0x3960ab){if(_0x3960ab['type']!==_0x5460('0x3a')){var _0x1b01e5={};_0x1b01e5[_0x3960ab[_0x5460('0x28')]]={'$like':'%'+_0x2fdd91[_0x5460('0x2e')][_0x5460('0x3b')]+'%'};return _0x1b01e5;}})});}_0x83e94d=_[_0x5460('0x39')]({},_0x83e94d,_0x2fdd91[_0x5460('0x3c')]);var _0x83ac4c={'where':_0x83e94d['where']};return db['SugarcrmAccount'][_0x5460('0x1e')](_0x83ac4c)[_0x5460('0x24')](function(_0x4bfc8c){_0x2633dd['count']=_0x4bfc8c;if(_0x2fdd91[_0x5460('0x2e')]['includeAll']){_0x83e94d[_0x5460('0x3d')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x5460('0x3e')](_0x83e94d);})[_0x5460('0x24')](function(_0x1436ed){_0x2633dd[_0x5460('0x3f')]=_0x1436ed;return _0x2633dd;})[_0x5460('0x24')](respondWithFilteredResult(_0x5bb9a2,_0x83e94d))[_0x5460('0x40')](handleError(_0x5bb9a2,null));};exports[_0x5460('0x41')]=function(_0x3c9cfa,_0x271ff){var _0x22a713={'raw':![],'where':{'id':_0x3c9cfa['params']['id']}},_0x189a1e={};_0x189a1e[_0x5460('0x2d')]=_[_0x5460('0x42')](db['SugarcrmAccount'][_0x5460('0x43')]);_0x189a1e[_0x5460('0x2e')]=_[_0x5460('0x42')](_0x3c9cfa['query']);_0x189a1e[_0x5460('0x2f')]=_[_0x5460('0x30')](_0x189a1e[_0x5460('0x2d')],_0x189a1e['query']);_0x22a713[_0x5460('0x31')]=_['intersection'](_0x189a1e[_0x5460('0x2d')],qs[_0x5460('0x32')](_0x3c9cfa[_0x5460('0x2e')]['fields']));_0x22a713[_0x5460('0x31')]=_0x22a713[_0x5460('0x31')]['length']?_0x22a713['attributes']:_0x189a1e[_0x5460('0x2d')];if(_0x3c9cfa[_0x5460('0x2e')][_0x5460('0x44')]){_0x22a713[_0x5460('0x3d')]=[{'all':!![]}];}_0x22a713=_[_0x5460('0x39')]({},_0x22a713,_0x3c9cfa['options']);return db['SugarcrmAccount'][_0x5460('0x45')](_0x22a713)['then'](handleEntityNotFound(_0x271ff,null))[_0x5460('0x24')](respondWithResult(_0x271ff,null))['catch'](handleError(_0x271ff,null));};exports[_0x5460('0x46')]=function(_0x4a52dc,_0xbc34fe){return db[_0x5460('0x47')][_0x5460('0x46')](_0x4a52dc['body'],{})[_0x5460('0x24')](respondWithResult(_0xbc34fe,0xc9))['catch'](handleError(_0xbc34fe,null));};exports[_0x5460('0x48')]=function(_0x17b2dd,_0x40dbb0){if(_0x17b2dd[_0x5460('0x49')]['id']){delete _0x17b2dd[_0x5460('0x49')]['id'];}return db[_0x5460('0x47')][_0x5460('0x45')]({'where':{'id':_0x17b2dd[_0x5460('0x4a')]['id']}})[_0x5460('0x24')](handleEntityNotFound(_0x40dbb0,null))['then'](saveUpdates(_0x17b2dd[_0x5460('0x49')],null))['then'](respondWithResult(_0x40dbb0,null))[_0x5460('0x40')](handleError(_0x40dbb0,null));};exports[_0x5460('0x25')]=function(_0x28480c,_0x393a38){return db['SugarcrmAccount']['find']({'where':{'id':_0x28480c[_0x5460('0x4a')]['id']}})[_0x5460('0x24')](handleEntityNotFound(_0x393a38,null))[_0x5460('0x24')](removeEntity(_0x393a38,null))[_0x5460('0x40')](handleError(_0x393a38,null));};exports['getConfigurations']=function(_0x45094c,_0x131832,_0x4b5ae2){var _0x1f03a2={};var _0x58444f={};var _0x3316c3;var _0x491018;return db[_0x5460('0x47')]['findOne']({'where':{'id':_0x45094c[_0x5460('0x4a')]['id']}})['then'](handleEntityNotFound(_0x131832,null))['then'](function(_0x30566c){if(_0x30566c){_0x3316c3=_0x30566c;_0x58444f[_0x5460('0x2d')]=_[_0x5460('0x42')](db[_0x5460('0x4b')][_0x5460('0x43')]);_0x58444f[_0x5460('0x2e')]=_['keys'](_0x45094c[_0x5460('0x2e')]);_0x58444f['filters']=_[_0x5460('0x30')](_0x58444f[_0x5460('0x2d')],_0x58444f['query']);_0x1f03a2[_0x5460('0x31')]=_['intersection'](_0x58444f[_0x5460('0x2d')],qs[_0x5460('0x32')](_0x45094c['query'][_0x5460('0x32')]));_0x1f03a2[_0x5460('0x31')]=_0x1f03a2[_0x5460('0x31')]['length']?_0x1f03a2[_0x5460('0x31')]:_0x58444f['model'];_0x1f03a2['order']=qs[_0x5460('0x36')](_0x45094c[_0x5460('0x2e')][_0x5460('0x36')]);_0x1f03a2[_0x5460('0x37')]=qs['filters'](_[_0x5460('0x38')](_0x45094c[_0x5460('0x2e')],_0x58444f['filters']));if(_0x45094c['query'][_0x5460('0x3b')]){_0x1f03a2[_0x5460('0x37')]=_[_0x5460('0x39')](_0x1f03a2[_0x5460('0x37')],{'$or':_[_0x5460('0x2a')](_0x1f03a2[_0x5460('0x31')],function(_0x3f03ef){var _0x5ab9b9={};_0x5ab9b9[_0x3f03ef]={'$like':'%'+_0x45094c[_0x5460('0x2e')][_0x5460('0x3b')]+'%'};return _0x5ab9b9;})});}_0x1f03a2=_['merge']({},_0x1f03a2,_0x45094c['options']);return _0x3316c3[_0x5460('0x4c')](_0x1f03a2);}})[_0x5460('0x24')](function(_0x54fbaa){if(_0x54fbaa){_0x491018=_0x54fbaa['length'];if(!_0x45094c[_0x5460('0x2e')][_0x5460('0x34')](_0x5460('0x4d'))){_0x1f03a2['limit']=qs[_0x5460('0x1d')](_0x45094c['query'][_0x5460('0x1d')]);_0x1f03a2[_0x5460('0x1b')]=qs[_0x5460('0x1b')](_0x45094c[_0x5460('0x2e')][_0x5460('0x1b')]);}return _0x3316c3['getConfigurations'](_0x1f03a2);}})['then'](function(_0x147209){if(_0x147209){return _0x147209?{'count':_0x491018,'rows':_0x147209}:null;}})[_0x5460('0x24')](respondWithResult(_0x131832,null))[_0x5460('0x40')](handleError(_0x131832,null));};exports[_0x5460('0x4e')]=function(_0x45ea04,_0xbf8973,_0x378972){if(_0x45ea04[_0x5460('0x49')]['id']){delete _0x45ea04['body']['id'];}return db[_0x5460('0x47')][_0x5460('0x4f')]({'where':{'id':_0x45ea04[_0x5460('0x4a')]['id']}})[_0x5460('0x24')](handleEntityNotFound(_0xbf8973,null))[_0x5460('0x24')](function(_0x5860a9){if(_0x5860a9){_0x45ea04[_0x5460('0x49')][_0x5460('0x50')]=_0x5860a9['id'];_0x45ea04['body'][_0x5460('0x51')]=integrations['getSubjects'](_0x45ea04['body'][_0x5460('0x52')],_0x45ea04[_0x5460('0x49')][_0x5460('0x53')]);_0x45ea04[_0x5460('0x49')][_0x5460('0x54')]=integrations[_0x5460('0x55')](_0x45ea04[_0x5460('0x49')][_0x5460('0x52')],_0x45ea04[_0x5460('0x49')][_0x5460('0x53')]);return db['SugarcrmConfiguration'][_0x5460('0x46')](_0x45ea04['body'],{'include':[{'model':db[_0x5460('0x56')],'as':_0x5460('0x51')},{'model':db[_0x5460('0x56')],'as':_0x5460('0x54')}]});}return null;})['then'](respondWithResult(_0xbf8973,null))[_0x5460('0x40')](handleError(_0xbf8973,null));};exports[_0x5460('0x57')]=function(_0x3a9a5e,_0x1ce985,_0xb3df9c){var _0x5e0a15='';var _0x3495c7=['id',_0x5460('0x28'),'assigned_user_id',_0x5460('0x58'),'description',_0x5460('0x59'),_0x5460('0x5a'),_0x5460('0x5b'),_0x5460('0x5c'),_0x5460('0x5d'),_0x5460('0x5e'),_0x5460('0x5f')];return db[_0x5460('0x47')][_0x5460('0x4f')]({'where':{'id':_0x3a9a5e[_0x5460('0x4a')]['id']},'attributes':['id',_0x5460('0x60'),_0x5460('0x61'),_0x5460('0x62')]})['then'](handleEntityNotFound(_0x1ce985,null))[_0x5460('0x24')](function(_0x76b620){if(_0x76b620){_0x5e0a15=_0x76b620[_0x5460('0x62')];var _0x237af5=_0x5e0a15['slice'](-0x1);if(_0x237af5==='/'){_0x5e0a15=_0x5e0a15[_0x5460('0x63')](0x0,_0x5e0a15['lastIndexOf'](_0x237af5));}return rp({'method':_0x5460('0x64'),'uri':util[_0x5460('0x65')](_0x5460('0x66'),_0x5e0a15,_0x5460('0x67')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x5460('0x68'),'rest_data':JSON[_0x5460('0x69')]({'user_auth':{'user_name':_0x76b620[_0x5460('0x60')],'password':_0x76b620[_0x5460('0x61')],'encryption':'PLAIN'},'application':_0x5460('0x6a')})}});}})[_0x5460('0x24')](function(_0x26db67){if(_0x26db67&&_0x26db67['name']!==_0x5460('0x6b')&&_0x26db67[_0x5460('0x28')]!==_0x5460('0x6c')){return rp({'method':_0x5460('0x64'),'uri':util[_0x5460('0x65')](_0x5460('0x66'),_0x5e0a15,_0x5460('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x5460('0x68'),'response_type':_0x5460('0x68'),'rest_data':JSON[_0x5460('0x69')]({'session':_0x26db67['id'],'module_name':'Calls'})}})['then'](function(_0x34981a){if(_0x34981a){var _0x1a8840=_[_0x5460('0x6d')](_0x34981a[_0x5460('0x6e')]);_[_0x5460('0x6f')](_0x1a8840,function(_0x1e7e12){return _0x3495c7[_0x5460('0x70')](_0x1e7e12[_0x5460('0x28')]);});return{'count':_0x1a8840['length'],'rows':_[_0x5460('0x2a')](_0x1a8840,function(_0x1470ab){return{'id':_0x1470ab[_0x5460('0x28')],'name':_0x1470ab[_0x5460('0x71')],'custom':_[_0x5460('0x72')](_0x1470ab['name'],'_c')?!![]:![],'options':_0x1470ab[_0x5460('0x3c')]?_['map'](_[_0x5460('0x6d')](_0x1470ab[_0x5460('0x3c')]),function(_0x40e661){return{'name':_0x40e661[_0x5460('0x73')],'value':_0x40e661[_0x5460('0x28')]};}):[]};})};}})[_0x5460('0x24')](respondWithResult(_0x1ce985,null))[_0x5460('0x40')](function(_0x52c3cb){var _0x4b46e4=_0x3a9a5e[_0x5460('0x2e')][_0x5460('0x74')]?0x1f4:_0x52c3cb[_0x5460('0x75')]||0x1f4;logger[_0x5460('0x26')](_0x5460('0x76'),_0x5460('0x57'),_0x4b46e4,JSON[_0x5460('0x69')](_0x52c3cb));delete _0x52c3cb[_0x5460('0x28')];if(_0x4b46e4===0x191){_0x4b46e4=0x190;}_0x1ce985[_0x5460('0x18')](_0x4b46e4)[_0x5460('0x29')](_0x3a9a5e[_0x5460('0x2e')][_0x5460('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x52c3cb[_0x5460('0x75')]}:_0x52c3cb);});}else{var _0x5cf6e8=0x1f4;_0x1ce985[_0x5460('0x18')](_0x5cf6e8)[_0x5460('0x29')]({'message':_0x5460('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x7332=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','create','body','findOne','sort','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','Calls','module_fields','remove','includes','label','endsWith','values','value','statusCode','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x7332,0x67));var _0x2733=function(_0x3f5f71,_0x42d36b){_0x3f5f71=_0x3f5f71-0x0;var _0x289757=_0x7332[_0x3f5f71];return _0x289757;};'use strict';var emlformat=require(_0x2733('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2733('0x1'));var jsonpatch=require(_0x2733('0x2'));var rp=require(_0x2733('0x3'));var moment=require(_0x2733('0x4'));var BPromise=require(_0x2733('0x5'));var Mustache=require(_0x2733('0x6'));var util=require(_0x2733('0x7'));var path=require(_0x2733('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2733('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2733('0xa'));var squel=require(_0x2733('0xb'));var crypto=require(_0x2733('0xc'));var jsforce=require(_0x2733('0xd'));var deskjs=require(_0x2733('0xe'));var toCsv=require(_0x2733('0xf'));var querystring=require('querystring');var Papa=require(_0x2733('0x10'));var Redis=require('ioredis');var authService=require(_0x2733('0x11'));var qs=require(_0x2733('0x12'));var as=require(_0x2733('0x13'));var hardwareService=require(_0x2733('0x14'));var logger=require(_0x2733('0x15'))(_0x2733('0x16'));var utils=require(_0x2733('0x17'));var config=require(_0x2733('0x18'));var licenseUtil=require(_0x2733('0x19'));var db=require(_0x2733('0x1a'))['db'];var integrations=require(_0x2733('0x1b'));function respondWithStatusCode(_0x2919aa,_0x34a7f3){_0x34a7f3=_0x34a7f3||0xcc;return function(_0x144757){if(_0x144757){return _0x2919aa[_0x2733('0x1c')](_0x34a7f3);}return _0x2919aa[_0x2733('0x1d')](_0x34a7f3)[_0x2733('0x1e')]();};}function respondWithResult(_0x5e93f8,_0x18c447){_0x18c447=_0x18c447||0xc8;return function(_0xec97c3){if(_0xec97c3){return _0x5e93f8[_0x2733('0x1d')](_0x18c447)[_0x2733('0x1f')](_0xec97c3);}};}function respondWithFilteredResult(_0x3d7e81,_0x1466df){return function(_0x4470d9){if(_0x4470d9){var _0x5373b4=typeof _0x1466df[_0x2733('0x20')]===_0x2733('0x21')&&typeof _0x1466df['limit']===_0x2733('0x21');var _0xbe6ed5=_0x4470d9['count'];var _0x101ae7=_0x5373b4?0x0:_0x1466df[_0x2733('0x20')];var _0x16ff94=_0x5373b4?_0x4470d9[_0x2733('0x22')]:_0x1466df[_0x2733('0x20')]+_0x1466df[_0x2733('0x23')];var _0x3a07f2;if(_0x16ff94>=_0xbe6ed5){_0x16ff94=_0xbe6ed5;_0x3a07f2=0xc8;}else{_0x3a07f2=0xce;}_0x3d7e81['status'](_0x3a07f2);return _0x3d7e81[_0x2733('0x24')](_0x2733('0x25'),_0x101ae7+'-'+_0x16ff94+'/'+_0xbe6ed5)['json'](_0x4470d9);}return null;};}function patchUpdates(_0x5e5a83){return function(_0x4fd18b){try{jsonpatch['apply'](_0x4fd18b,_0x5e5a83,!![]);}catch(_0x500bf3){return BPromise[_0x2733('0x26')](_0x500bf3);}return _0x4fd18b[_0x2733('0x27')]();};}function saveUpdates(_0x333e4d,_0x227539){return function(_0x1f7037){if(_0x1f7037){return _0x1f7037[_0x2733('0x28')](_0x333e4d)[_0x2733('0x29')](function(_0x41cec3){return _0x41cec3;});}return null;};}function removeEntity(_0x5ecc08,_0x4c137c){return function(_0x455e83){if(_0x455e83){return _0x455e83[_0x2733('0x2a')]()[_0x2733('0x29')](function(){_0x5ecc08[_0x2733('0x1d')](0xcc)[_0x2733('0x1e')]();});}};}function handleEntityNotFound(_0x4d0a48,_0x5c78ad){return function(_0x259ca0){if(!_0x259ca0){_0x4d0a48[_0x2733('0x1c')](0x194);}return _0x259ca0;};}function handleError(_0x1f0dbd,_0x2c5e40){_0x2c5e40=_0x2c5e40||0x1f4;return function(_0x4ea523){logger[_0x2733('0x2b')](_0x4ea523[_0x2733('0x2c')]);if(_0x4ea523[_0x2733('0x2d')]){delete _0x4ea523['name'];}_0x1f0dbd[_0x2733('0x1d')](_0x2c5e40)[_0x2733('0x2e')](_0x4ea523);};}exports[_0x2733('0x2f')]=function(_0x57bc65,_0xc4ec47){var _0x34d8bf={},_0x4fd9b4={},_0x3388ef={'count':0x0,'rows':[]};var _0x5e6dde=_[_0x2733('0x30')](db[_0x2733('0x31')][_0x2733('0x32')],function(_0x5d9c29){return{'name':_0x5d9c29[_0x2733('0x33')],'type':_0x5d9c29['type'][_0x2733('0x34')]};});_0x4fd9b4[_0x2733('0x35')]=_[_0x2733('0x30')](_0x5e6dde,'name');_0x4fd9b4['query']=_[_0x2733('0x36')](_0x57bc65[_0x2733('0x37')]);_0x4fd9b4[_0x2733('0x38')]=_[_0x2733('0x39')](_0x4fd9b4[_0x2733('0x35')],_0x4fd9b4['query']);_0x34d8bf[_0x2733('0x3a')]=_['intersection'](_0x4fd9b4[_0x2733('0x35')],qs[_0x2733('0x3b')](_0x57bc65[_0x2733('0x37')]['fields']));_0x34d8bf[_0x2733('0x3a')]=_0x34d8bf[_0x2733('0x3a')][_0x2733('0x3c')]?_0x34d8bf[_0x2733('0x3a')]:_0x4fd9b4[_0x2733('0x35')];if(!_0x57bc65[_0x2733('0x37')][_0x2733('0x3d')]('nolimit')){_0x34d8bf[_0x2733('0x23')]=qs['limit'](_0x57bc65['query'][_0x2733('0x23')]);_0x34d8bf[_0x2733('0x20')]=qs[_0x2733('0x20')](_0x57bc65[_0x2733('0x37')]['offset']);}_0x34d8bf[_0x2733('0x3e')]=qs['sort'](_0x57bc65['query']['sort']);_0x34d8bf[_0x2733('0x3f')]=qs['filters'](_[_0x2733('0x40')](_0x57bc65[_0x2733('0x37')],_0x4fd9b4[_0x2733('0x38')]),_0x5e6dde);if(_0x57bc65[_0x2733('0x37')][_0x2733('0x41')]){_0x34d8bf[_0x2733('0x3f')]=_[_0x2733('0x42')](_0x34d8bf['where'],{'$or':_[_0x2733('0x30')](_0x5e6dde,function(_0x4a1ef7){if(_0x4a1ef7[_0x2733('0x43')]!==_0x2733('0x44')){var _0x57d8b1={};_0x57d8b1[_0x4a1ef7['name']]={'$like':'%'+_0x57bc65[_0x2733('0x37')][_0x2733('0x41')]+'%'};return _0x57d8b1;}})});}_0x34d8bf=_['merge']({},_0x34d8bf,_0x57bc65[_0x2733('0x45')]);var _0x4260c3={'where':_0x34d8bf[_0x2733('0x3f')]};return db[_0x2733('0x31')][_0x2733('0x22')](_0x4260c3)['then'](function(_0x396deb){_0x3388ef['count']=_0x396deb;if(_0x57bc65[_0x2733('0x37')]['includeAll']){_0x34d8bf['include']=[{'all':!![]}];}return db[_0x2733('0x31')][_0x2733('0x46')](_0x34d8bf);})['then'](function(_0x428529){_0x3388ef['rows']=_0x428529;return _0x3388ef;})[_0x2733('0x29')](respondWithFilteredResult(_0xc4ec47,_0x34d8bf))[_0x2733('0x47')](handleError(_0xc4ec47,null));};exports[_0x2733('0x48')]=function(_0x5145f5,_0x2824c4){var _0x5aee3b={'raw':![],'where':{'id':_0x5145f5[_0x2733('0x49')]['id']}},_0x54dab9={};_0x54dab9[_0x2733('0x35')]=_[_0x2733('0x36')](db[_0x2733('0x31')][_0x2733('0x32')]);_0x54dab9[_0x2733('0x37')]=_['keys'](_0x5145f5['query']);_0x54dab9[_0x2733('0x38')]=_['intersection'](_0x54dab9[_0x2733('0x35')],_0x54dab9[_0x2733('0x37')]);_0x5aee3b[_0x2733('0x3a')]=_['intersection'](_0x54dab9[_0x2733('0x35')],qs[_0x2733('0x3b')](_0x5145f5[_0x2733('0x37')][_0x2733('0x3b')]));_0x5aee3b[_0x2733('0x3a')]=_0x5aee3b[_0x2733('0x3a')][_0x2733('0x3c')]?_0x5aee3b[_0x2733('0x3a')]:_0x54dab9[_0x2733('0x35')];if(_0x5145f5[_0x2733('0x37')][_0x2733('0x4a')]){_0x5aee3b[_0x2733('0x4b')]=[{'all':!![]}];}_0x5aee3b=_[_0x2733('0x42')]({},_0x5aee3b,_0x5145f5[_0x2733('0x45')]);return db[_0x2733('0x31')][_0x2733('0x4c')](_0x5aee3b)[_0x2733('0x29')](handleEntityNotFound(_0x2824c4,null))[_0x2733('0x29')](respondWithResult(_0x2824c4,null))[_0x2733('0x47')](handleError(_0x2824c4,null));};exports[_0x2733('0x4d')]=function(_0x2f8984,_0x31b53f){return db[_0x2733('0x31')][_0x2733('0x4d')](_0x2f8984[_0x2733('0x4e')],{})[_0x2733('0x29')](respondWithResult(_0x31b53f,0xc9))[_0x2733('0x47')](handleError(_0x31b53f,null));};exports[_0x2733('0x28')]=function(_0x4ee4eb,_0x3aa53e){if(_0x4ee4eb[_0x2733('0x4e')]['id']){delete _0x4ee4eb[_0x2733('0x4e')]['id'];}return db[_0x2733('0x31')]['find']({'where':{'id':_0x4ee4eb['params']['id']}})[_0x2733('0x29')](handleEntityNotFound(_0x3aa53e,null))['then'](saveUpdates(_0x4ee4eb[_0x2733('0x4e')],null))['then'](respondWithResult(_0x3aa53e,null))[_0x2733('0x47')](handleError(_0x3aa53e,null));};exports[_0x2733('0x2a')]=function(_0x4e4ae0,_0x57b764){return db[_0x2733('0x31')][_0x2733('0x4c')]({'where':{'id':_0x4e4ae0[_0x2733('0x49')]['id']}})[_0x2733('0x29')](handleEntityNotFound(_0x57b764,null))[_0x2733('0x29')](removeEntity(_0x57b764,null))['catch'](handleError(_0x57b764,null));};exports['getConfigurations']=function(_0x294223,_0x52065c,_0x14b129){var _0x395f49={};var _0x268b6a={};var _0x453824;var _0x355a73;return db[_0x2733('0x31')][_0x2733('0x4f')]({'where':{'id':_0x294223[_0x2733('0x49')]['id']}})[_0x2733('0x29')](handleEntityNotFound(_0x52065c,null))[_0x2733('0x29')](function(_0x52eebf){if(_0x52eebf){_0x453824=_0x52eebf;_0x268b6a[_0x2733('0x35')]=_[_0x2733('0x36')](db['SugarcrmConfiguration'][_0x2733('0x32')]);_0x268b6a[_0x2733('0x37')]=_['keys'](_0x294223[_0x2733('0x37')]);_0x268b6a[_0x2733('0x38')]=_['intersection'](_0x268b6a[_0x2733('0x35')],_0x268b6a[_0x2733('0x37')]);_0x395f49[_0x2733('0x3a')]=_[_0x2733('0x39')](_0x268b6a[_0x2733('0x35')],qs[_0x2733('0x3b')](_0x294223[_0x2733('0x37')][_0x2733('0x3b')]));_0x395f49[_0x2733('0x3a')]=_0x395f49[_0x2733('0x3a')][_0x2733('0x3c')]?_0x395f49['attributes']:_0x268b6a[_0x2733('0x35')];_0x395f49[_0x2733('0x3e')]=qs[_0x2733('0x50')](_0x294223[_0x2733('0x37')][_0x2733('0x50')]);_0x395f49[_0x2733('0x3f')]=qs[_0x2733('0x38')](_[_0x2733('0x40')](_0x294223['query'],_0x268b6a[_0x2733('0x38')]));if(_0x294223[_0x2733('0x37')][_0x2733('0x41')]){_0x395f49[_0x2733('0x3f')]=_[_0x2733('0x42')](_0x395f49[_0x2733('0x3f')],{'$or':_[_0x2733('0x30')](_0x395f49[_0x2733('0x3a')],function(_0x38ce16){var _0x5a7cae={};_0x5a7cae[_0x38ce16]={'$like':'%'+_0x294223[_0x2733('0x37')][_0x2733('0x41')]+'%'};return _0x5a7cae;})});}_0x395f49=_[_0x2733('0x42')]({},_0x395f49,_0x294223[_0x2733('0x45')]);return _0x453824[_0x2733('0x51')](_0x395f49);}})[_0x2733('0x29')](function(_0x517cc3){if(_0x517cc3){_0x355a73=_0x517cc3[_0x2733('0x3c')];if(!_0x294223['query']['hasOwnProperty']('nolimit')){_0x395f49[_0x2733('0x23')]=qs[_0x2733('0x23')](_0x294223[_0x2733('0x37')][_0x2733('0x23')]);_0x395f49['offset']=qs[_0x2733('0x20')](_0x294223[_0x2733('0x37')][_0x2733('0x20')]);}return _0x453824[_0x2733('0x51')](_0x395f49);}})[_0x2733('0x29')](function(_0x172060){if(_0x172060){return _0x172060?{'count':_0x355a73,'rows':_0x172060}:null;}})[_0x2733('0x29')](respondWithResult(_0x52065c,null))[_0x2733('0x47')](handleError(_0x52065c,null));};exports['addConfiguration']=function(_0xb967af,_0x5485c0,_0x42802c){if(_0xb967af[_0x2733('0x4e')]['id']){delete _0xb967af[_0x2733('0x4e')]['id'];}return db[_0x2733('0x31')]['findOne']({'where':{'id':_0xb967af[_0x2733('0x49')]['id']}})['then'](handleEntityNotFound(_0x5485c0,null))[_0x2733('0x29')](function(_0x2e75c6){if(_0x2e75c6){_0xb967af['body'][_0x2733('0x52')]=_0x2e75c6['id'];_0xb967af['body'][_0x2733('0x53')]=integrations[_0x2733('0x54')](_0xb967af[_0x2733('0x4e')][_0x2733('0x55')],_0xb967af[_0x2733('0x4e')]['type']);_0xb967af[_0x2733('0x4e')]['Descriptions']=integrations[_0x2733('0x56')](_0xb967af['body']['channel'],_0xb967af[_0x2733('0x4e')][_0x2733('0x43')]);return db[_0x2733('0x57')]['create'](_0xb967af[_0x2733('0x4e')],{'include':[{'model':db[_0x2733('0x58')],'as':_0x2733('0x53')},{'model':db['SugarcrmField'],'as':_0x2733('0x59')}]});}return null;})[_0x2733('0x29')](respondWithResult(_0x5485c0,null))['catch'](handleError(_0x5485c0,null));};exports[_0x2733('0x5a')]=function(_0x11c7af,_0x1cfbd4,_0x598977){var _0x5e96bc='';var _0x693cec=['id',_0x2733('0x2d'),_0x2733('0x5b'),'created_by',_0x2733('0x5c'),_0x2733('0x5d'),_0x2733('0x5e'),'duration_minutes',_0x2733('0x5f'),_0x2733('0x60'),_0x2733('0x61'),_0x2733('0x62')];return db[_0x2733('0x31')][_0x2733('0x4f')]({'where':{'id':_0x11c7af[_0x2733('0x49')]['id']},'attributes':['id',_0x2733('0x63'),_0x2733('0x64'),_0x2733('0x65')]})['then'](handleEntityNotFound(_0x1cfbd4,null))['then'](function(_0x1b1391){if(_0x1b1391){_0x5e96bc=_0x1b1391[_0x2733('0x65')];var _0x43f393=_0x5e96bc['slice'](-0x1);if(_0x43f393==='/'){_0x5e96bc=_0x5e96bc[_0x2733('0x66')](0x0,_0x5e96bc[_0x2733('0x67')](_0x43f393));}return rp({'method':_0x2733('0x68'),'uri':util[_0x2733('0x69')](_0x2733('0x6a'),_0x5e96bc,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2733('0x6b'),'input_type':_0x2733('0x6c'),'response_type':_0x2733('0x6c'),'rest_data':JSON[_0x2733('0x6d')]({'user_auth':{'user_name':_0x1b1391[_0x2733('0x63')],'password':_0x1b1391[_0x2733('0x64')],'encryption':_0x2733('0x6e')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2733('0x29')](function(_0x362546){if(_0x362546&&_0x362546[_0x2733('0x2d')]!==_0x2733('0x6f')&&_0x362546['name']!=='Password\x20Expired'){return rp({'method':_0x2733('0x68'),'uri':util['format'](_0x2733('0x6a'),_0x5e96bc,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x2733('0x6c'),'response_type':'JSON','rest_data':JSON[_0x2733('0x6d')]({'session':_0x362546['id'],'module_name':_0x2733('0x70')})}})[_0x2733('0x29')](function(_0x128eb3){if(_0x128eb3){var _0x4dabe8=_['values'](_0x128eb3[_0x2733('0x71')]);_[_0x2733('0x72')](_0x4dabe8,function(_0x398a51){return _0x693cec[_0x2733('0x73')](_0x398a51[_0x2733('0x2d')]);});return{'count':_0x4dabe8['length'],'rows':_[_0x2733('0x30')](_0x4dabe8,function(_0x508872){return{'id':_0x508872[_0x2733('0x2d')],'name':_0x508872[_0x2733('0x74')],'custom':_[_0x2733('0x75')](_0x508872[_0x2733('0x2d')],'_c')?!![]:![],'options':_0x508872[_0x2733('0x45')]?_[_0x2733('0x30')](_[_0x2733('0x76')](_0x508872[_0x2733('0x45')]),function(_0x1ee0f9){return{'name':_0x1ee0f9[_0x2733('0x77')],'value':_0x1ee0f9[_0x2733('0x2d')]};}):[]};})};}})[_0x2733('0x29')](respondWithResult(_0x1cfbd4,null))[_0x2733('0x47')](function(_0x4723c4){var _0xfc2c31=_0x11c7af[_0x2733('0x37')]['test']?0x1f4:_0x4723c4[_0x2733('0x78')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2733('0x5a'),_0xfc2c31,JSON['stringify'](_0x4723c4));delete _0x4723c4['name'];if(_0xfc2c31===0x191){_0xfc2c31=0x190;}_0x1cfbd4['status'](_0xfc2c31)[_0x2733('0x2e')](_0x11c7af[_0x2733('0x37')][_0x2733('0x79')]?{'message':_0x2733('0x7a'),'statusCode':_0x4723c4[_0x2733('0x78')]}:_0x4723c4);});}else{var _0xbf8805=0x1f4;_0x1cfbd4[_0x2733('0x1d')](_0xbf8805)[_0x2733('0x2e')]({'message':_0x2733('0x7a'),'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 eb188f8..5138cb0 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 _0x5229=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3959ad,_0x432aec){var _0x567fbd=function(_0x1e4e1c){while(--_0x1e4e1c){_0x3959ad['push'](_0x3959ad['shift']());}};_0x567fbd(++_0x432aec);}(_0x5229,0xba));var _0x9522=function(_0x189b74,_0x5712bf){_0x189b74=_0x189b74-0x0;var _0x1a866d=_0x5229[_0x189b74];return _0x1a866d;};'use strict';var _=require('lodash');var util=require(_0x9522('0x0'));var logger=require(_0x9522('0x1'))(_0x9522('0x2'));var moment=require(_0x9522('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9522('0x4'));var rimraf=require(_0x9522('0x5'));var config=require(_0x9522('0x6'));var attributes=require(_0x9522('0x7'));var integrations=require(_0x9522('0x8'));module[_0x9522('0x9')]=function(_0x5c3497,_0x1d9f4f){return _0x5c3497[_0x9522('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x9522('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f4=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x56d231,_0x1d39ec){var _0x1727f0=function(_0x1ed52e){while(--_0x1ed52e){_0x56d231['push'](_0x56d231['shift']());}};_0x1727f0(++_0x1d39ec);}(_0xe4f4,0x89));var _0x4e4f=function(_0x4dd2d3,_0x264f72){_0x4dd2d3=_0x4dd2d3-0x0;var _0x269be2=_0xe4f4[_0x4dd2d3];return _0x269be2;};'use strict';var _=require('lodash');var util=require(_0x4e4f('0x0'));var logger=require(_0x4e4f('0x1'))('api');var moment=require(_0x4e4f('0x2'));var BPromise=require(_0x4e4f('0x3'));var rp=require(_0x4e4f('0x4'));var fs=require('fs');var path=require(_0x4e4f('0x5'));var rimraf=require(_0x4e4f('0x6'));var config=require(_0x4e4f('0x7'));var attributes=require(_0x4e4f('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4e4f('0x9')]=function(_0x1de125,_0x50afc4){return _0x1de125[_0x4e4f('0xa')](_0x4e4f('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index f9138a4..0718675 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 _0x6a95=['rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6a95,0xf3));var _0x56a9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x6a95[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require(_0x56a9('0x7'));var logger=require(_0x56a9('0x8'))(_0x56a9('0x9'));var config=require(_0x56a9('0xa'));var jayson=require(_0x56a9('0xb'));var client=jayson[_0x56a9('0xc')][_0x56a9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x209430,_0xc2b360,_0xfea211){return new BPromise(function(_0x2153f9,_0x42c2cd){return client[_0x56a9('0xe')](_0x209430,_0xfea211)['then'](function(_0x1eaf0c){logger[_0x56a9('0xf')](_0x56a9('0x10'),_0xc2b360,_0x56a9('0x11'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xc2b360,_0x56a9('0x11'),JSON[_0x56a9('0x12')](_0x1eaf0c));if(_0x1eaf0c[_0x56a9('0x13')]){if(_0x1eaf0c['error'][_0x56a9('0x14')]===0x1f4){logger[_0x56a9('0x13')](_0x56a9('0x10'),_0xc2b360,_0x1eaf0c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x42c2cd(_0x1eaf0c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0x10'),_0xc2b360,_0x1eaf0c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x2153f9(_0x1eaf0c[_0x56a9('0x13')][_0x56a9('0x15')]);}else{logger[_0x56a9('0xf')](_0x56a9('0x10'),_0xc2b360,_0x56a9('0x11'));_0x2153f9(_0x1eaf0c['result'][_0x56a9('0x15')]);}})[_0x56a9('0x16')](function(_0x4c37a6){logger[_0x56a9('0x13')](_0x56a9('0x10'),_0xc2b360,_0x4c37a6);_0x42c2cd(_0x4c37a6);});});}exports['GetSugarcrmAccount']=function(_0x119536){var _0x1a3e16=this;return new Promise(function(_0x529cc3,_0x277e31){return db['SugarcrmAccount'][_0x56a9('0x17')]({'raw':_0x119536[_0x56a9('0x18')]?_0x119536['options'][_0x56a9('0x19')]===undefined?!![]:![]:!![],'where':_0x119536[_0x56a9('0x18')]?_0x119536['options'][_0x56a9('0x1a')]||null:null,'attributes':_0x119536[_0x56a9('0x18')]?_0x119536['options'][_0x56a9('0x1b')]||null:null,'limit':_0x119536[_0x56a9('0x18')]?_0x119536[_0x56a9('0x18')]['limit']||null:null,'include':_0x119536[_0x56a9('0x18')]?_0x119536['options'][_0x56a9('0x1c')]?_['map'](_0x119536[_0x56a9('0x18')][_0x56a9('0x1c')],function(_0x540abd){return{'model':db[_0x540abd['model']],'as':_0x540abd['as'],'attributes':_0x540abd[_0x56a9('0x1b')],'include':_0x540abd['include']?_[_0x56a9('0x1d')](_0x540abd['include'],function(_0x58b442){return{'model':db[_0x58b442[_0x56a9('0x1e')]],'as':_0x58b442['as'],'attributes':_0x58b442[_0x56a9('0x1b')],'include':_0x58b442[_0x56a9('0x1c')]?_[_0x56a9('0x1d')](_0x58b442[_0x56a9('0x1c')],function(_0x3d3d43){return{'model':db[_0x3d3d43[_0x56a9('0x1e')]],'as':_0x3d3d43['as'],'attributes':_0x3d3d43[_0x56a9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cc3b){logger[_0x56a9('0xf')](_0x56a9('0x1f'),_0x119536);logger['debug'](_0x56a9('0x1f'),_0x119536,JSON['stringify'](_0x29cc3b));_0x529cc3(_0x29cc3b);})['catch'](function(_0x47246c){logger[_0x56a9('0x13')](_0x56a9('0x1f'),_0x47246c[_0x56a9('0x15')],_0x119536);_0x277e31(_0x1a3e16[_0x56a9('0x13')](0x1f4,_0x47246c[_0x56a9('0x15')]));});});};exports[_0x56a9('0x20')]=function(_0x5a8ef6){var _0x412d7b=this;return new Promise(function(_0x3985c0,_0x4fbdfa){return db[_0x56a9('0x21')]['find']({'raw':_0x5a8ef6['options']?_0x5a8ef6[_0x56a9('0x18')][_0x56a9('0x19')]===undefined?!![]:![]:!![],'where':_0x5a8ef6[_0x56a9('0x18')]?_0x5a8ef6[_0x56a9('0x18')][_0x56a9('0x1a')]||null:null,'attributes':_0x5a8ef6['options']?_0x5a8ef6[_0x56a9('0x18')]['attributes']||null:null,'include':_0x5a8ef6[_0x56a9('0x18')]?_0x5a8ef6[_0x56a9('0x18')][_0x56a9('0x1c')]?_[_0x56a9('0x1d')](_0x5a8ef6[_0x56a9('0x18')]['include'],function(_0x3870ba){return{'model':db[_0x3870ba['model']],'as':_0x3870ba['as'],'attributes':_0x3870ba['attributes'],'include':_0x3870ba[_0x56a9('0x1c')]?_[_0x56a9('0x1d')](_0x3870ba[_0x56a9('0x1c')],function(_0x4cff13){return{'model':db[_0x4cff13[_0x56a9('0x1e')]],'as':_0x4cff13['as'],'attributes':_0x4cff13[_0x56a9('0x1b')],'include':_0x4cff13['include']?_['map'](_0x4cff13['include'],function(_0x382fa8){return{'model':db[_0x382fa8[_0x56a9('0x1e')]],'as':_0x382fa8['as'],'attributes':_0x382fa8[_0x56a9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x56a9('0x22')](function(_0x3912b1){logger[_0x56a9('0xf')](_0x56a9('0x20'),_0x5a8ef6);logger[_0x56a9('0x23')]('ShowSugarcrmAccount',_0x5a8ef6,JSON[_0x56a9('0x12')](_0x3912b1));_0x3985c0(_0x3912b1);})['catch'](function(_0x26e621){logger['error'](_0x56a9('0x20'),_0x26e621['message'],_0x5a8ef6);_0x4fbdfa(_0x412d7b[_0x56a9('0x13')](0x1f4,_0x26e621[_0x56a9('0x15')]));});});}; \ No newline at end of file +var _0x75a2=['../../mysqldb','rpc','../../config/environment','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','options','where','limit','include','map','attributes','model','ShowSugarcrmAccount','find','raw','lodash','moment','randomstring','ioredis'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x75a2,0x19c));var _0x275a=function(_0xa6efaa,_0x4c4efc){_0xa6efaa=_0xa6efaa-0x0;var _0x3344e9=_0x75a2[_0xa6efaa];return _0x3344e9;};'use strict';var _=require(_0x275a('0x0'));var util=require('util');var moment=require(_0x275a('0x1'));var BPromise=require('bluebird');var rs=require(_0x275a('0x2'));var fs=require('fs');var Redis=require(_0x275a('0x3'));var db=require(_0x275a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x275a('0x5'));var config=require(_0x275a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x275a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c993c,_0x178fc7,_0x9e1559){return new BPromise(function(_0x517dc1,_0x565840){return client[_0x275a('0x8')](_0x5c993c,_0x9e1559)[_0x275a('0x9')](function(_0x103a0b){logger[_0x275a('0xa')](_0x275a('0xb'),_0x178fc7,_0x275a('0xc'));logger[_0x275a('0xd')](_0x275a('0xe'),_0x178fc7,'request\x20sent',JSON[_0x275a('0xf')](_0x103a0b));if(_0x103a0b[_0x275a('0x10')]){if(_0x103a0b[_0x275a('0x10')][_0x275a('0x11')]===0x1f4){logger['error'](_0x275a('0xb'),_0x178fc7,_0x103a0b[_0x275a('0x10')][_0x275a('0x12')]);return _0x565840(_0x103a0b[_0x275a('0x10')][_0x275a('0x12')]);}logger[_0x275a('0x10')](_0x275a('0xb'),_0x178fc7,_0x103a0b['error'][_0x275a('0x12')]);return _0x517dc1(_0x103a0b[_0x275a('0x10')][_0x275a('0x12')]);}else{logger[_0x275a('0xa')](_0x275a('0xb'),_0x178fc7,'request\x20sent');_0x517dc1(_0x103a0b[_0x275a('0x13')][_0x275a('0x12')]);}})[_0x275a('0x14')](function(_0x21b6e9){logger[_0x275a('0x10')](_0x275a('0xb'),_0x178fc7,_0x21b6e9);_0x565840(_0x21b6e9);});});}exports[_0x275a('0x15')]=function(_0x2504f1){var _0x23cacb=this;return new Promise(function(_0xec7d49,_0x392de8){return db['SugarcrmAccount']['findAll']({'raw':_0x2504f1[_0x275a('0x16')]?_0x2504f1[_0x275a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2504f1['options']?_0x2504f1[_0x275a('0x16')][_0x275a('0x17')]||null:null,'attributes':_0x2504f1['options']?_0x2504f1[_0x275a('0x16')]['attributes']||null:null,'limit':_0x2504f1[_0x275a('0x16')]?_0x2504f1[_0x275a('0x16')][_0x275a('0x18')]||null:null,'include':_0x2504f1[_0x275a('0x16')]?_0x2504f1['options'][_0x275a('0x19')]?_[_0x275a('0x1a')](_0x2504f1[_0x275a('0x16')][_0x275a('0x19')],function(_0x484ad2){return{'model':db[_0x484ad2['model']],'as':_0x484ad2['as'],'attributes':_0x484ad2[_0x275a('0x1b')],'include':_0x484ad2[_0x275a('0x19')]?_['map'](_0x484ad2[_0x275a('0x19')],function(_0x1aa7f9){return{'model':db[_0x1aa7f9[_0x275a('0x1c')]],'as':_0x1aa7f9['as'],'attributes':_0x1aa7f9[_0x275a('0x1b')],'include':_0x1aa7f9[_0x275a('0x19')]?_[_0x275a('0x1a')](_0x1aa7f9[_0x275a('0x19')],function(_0xfa59f5){return{'model':db[_0xfa59f5[_0x275a('0x1c')]],'as':_0xfa59f5['as'],'attributes':_0xfa59f5[_0x275a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x275a('0x9')](function(_0xfea8b8){logger['info']('GetSugarcrmAccount',_0x2504f1);logger[_0x275a('0xd')]('GetSugarcrmAccount',_0x2504f1,JSON[_0x275a('0xf')](_0xfea8b8));_0xec7d49(_0xfea8b8);})[_0x275a('0x14')](function(_0x172f83){logger['error'](_0x275a('0x15'),_0x172f83[_0x275a('0x12')],_0x2504f1);_0x392de8(_0x23cacb[_0x275a('0x10')](0x1f4,_0x172f83[_0x275a('0x12')]));});});};exports[_0x275a('0x1d')]=function(_0x3e2aa5){var _0x27bc37=this;return new Promise(function(_0x3dd362,_0x1625b0){return db['SugarcrmAccount'][_0x275a('0x1e')]({'raw':_0x3e2aa5[_0x275a('0x16')]?_0x3e2aa5[_0x275a('0x16')][_0x275a('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e2aa5[_0x275a('0x16')]?_0x3e2aa5['options'][_0x275a('0x17')]||null:null,'attributes':_0x3e2aa5['options']?_0x3e2aa5[_0x275a('0x16')][_0x275a('0x1b')]||null:null,'include':_0x3e2aa5['options']?_0x3e2aa5[_0x275a('0x16')][_0x275a('0x19')]?_[_0x275a('0x1a')](_0x3e2aa5['options'][_0x275a('0x19')],function(_0x34bec2){return{'model':db[_0x34bec2[_0x275a('0x1c')]],'as':_0x34bec2['as'],'attributes':_0x34bec2[_0x275a('0x1b')],'include':_0x34bec2['include']?_[_0x275a('0x1a')](_0x34bec2[_0x275a('0x19')],function(_0x27ba53){return{'model':db[_0x27ba53[_0x275a('0x1c')]],'as':_0x27ba53['as'],'attributes':_0x27ba53[_0x275a('0x1b')],'include':_0x27ba53[_0x275a('0x19')]?_[_0x275a('0x1a')](_0x27ba53[_0x275a('0x19')],function(_0x487241){return{'model':db[_0x487241[_0x275a('0x1c')]],'as':_0x487241['as'],'attributes':_0x487241[_0x275a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x275a('0x9')](function(_0x46e66d){logger[_0x275a('0xa')]('ShowSugarcrmAccount',_0x3e2aa5);logger[_0x275a('0xd')]('ShowSugarcrmAccount',_0x3e2aa5,JSON[_0x275a('0xf')](_0x46e66d));_0x3dd362(_0x46e66d);})[_0x275a('0x14')](function(_0x2b9736){logger[_0x275a('0x10')](_0x275a('0x1d'),_0x2b9736[_0x275a('0x12')],_0x3e2aa5);_0x1625b0(_0x27bc37[_0x275a('0x10')](0x1f4,_0x2b9736['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ec540dc..02e1c25 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 _0xfd2e=['fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2299fe,_0x3c7a8b){var _0x59e6ac=function(_0xcf533a){while(--_0xcf533a){_0x2299fe['push'](_0x2299fe['shift']());}};_0x59e6ac(++_0x3c7a8b);}(_0xfd2e,0x1a3));var _0xefd2=function(_0x46df04,_0x5c3e9b){_0x46df04=_0x46df04-0x0;var _0x9df292=_0xfd2e[_0x46df04];return _0x9df292;};'use strict';var multer=require(_0xefd2('0x0'));var util=require(_0xefd2('0x1'));var path=require(_0xefd2('0x2'));var timeout=require(_0xefd2('0x3'));var express=require(_0xefd2('0x4'));var router=express[_0xefd2('0x5')]();var fs_extra=require(_0xefd2('0x6'));var auth=require(_0xefd2('0x7'));var interaction=require(_0xefd2('0x8'));var config=require('../../config/environment');var controller=require(_0xefd2('0x9'));router[_0xefd2('0xa')]('/',auth[_0xefd2('0xb')](),controller[_0xefd2('0xc')]);router[_0xefd2('0xa')](_0xefd2('0xd'),auth['isAuthenticated'](),controller[_0xefd2('0xe')]);router[_0xefd2('0xa')](_0xefd2('0xf'),auth['isAuthenticated'](),controller[_0xefd2('0x10')]);router[_0xefd2('0xa')]('/:id/subjects',auth[_0xefd2('0xb')](),controller[_0xefd2('0x11')]);router[_0xefd2('0xa')](_0xefd2('0x12'),auth[_0xefd2('0xb')](),controller[_0xefd2('0x13')]);router[_0xefd2('0x14')]('/',auth[_0xefd2('0xb')](),controller['create']);router[_0xefd2('0x15')](_0xefd2('0xd'),auth[_0xefd2('0xb')](),controller['update']);router[_0xefd2('0x16')](_0xefd2('0xd'),auth[_0xefd2('0xb')](),controller[_0xefd2('0x17')]);module[_0xefd2('0x18')]=router; \ No newline at end of file +var _0x9b05=['express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','delete','destroy','util','path','connect-timeout'];(function(_0x49dea0,_0x253428){var _0x5b2309=function(_0x3665b8){while(--_0x3665b8){_0x49dea0['push'](_0x49dea0['shift']());}};_0x5b2309(++_0x253428);}(_0x9b05,0x1cb));var _0x59b0=function(_0x146beb,_0x57b1f4){_0x146beb=_0x146beb-0x0;var _0x404c81=_0x9b05[_0x146beb];return _0x404c81;};'use strict';var multer=require('multer');var util=require(_0x59b0('0x0'));var path=require(_0x59b0('0x1'));var timeout=require(_0x59b0('0x2'));var express=require(_0x59b0('0x3'));var router=express[_0x59b0('0x4')]();var fs_extra=require(_0x59b0('0x5'));var auth=require(_0x59b0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x59b0('0x7'));router[_0x59b0('0x8')]('/',auth[_0x59b0('0x9')](),controller[_0x59b0('0xa')]);router['get'](_0x59b0('0xb'),auth[_0x59b0('0x9')](),controller[_0x59b0('0xc')]);router['get'](_0x59b0('0xd'),auth[_0x59b0('0x9')](),controller[_0x59b0('0xe')]);router['get'](_0x59b0('0xf'),auth[_0x59b0('0x9')](),controller[_0x59b0('0x10')]);router[_0x59b0('0x8')]('/:id/descriptions',auth[_0x59b0('0x9')](),controller[_0x59b0('0x11')]);router[_0x59b0('0x12')]('/',auth[_0x59b0('0x9')](),controller[_0x59b0('0x13')]);router['put']('/:id',auth[_0x59b0('0x9')](),controller['update']);router[_0x59b0('0x14')]('/:id',auth[_0x59b0('0x9')](),controller[_0x59b0('0x15')]);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 6811949..ca55a45 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 _0x3f9d=['exports','STRING','sequelize'];(function(_0x3583ea,_0x4022ee){var _0x1c6ae2=function(_0x155a25){while(--_0x155a25){_0x3583ea['push'](_0x3583ea['shift']());}};_0x1c6ae2(++_0x4022ee);}(_0x3f9d,0xc8));var _0xd3f9=function(_0x1abfac,_0x45ae54){_0x1abfac=_0x1abfac-0x0;var _0x2f97e6=_0x3f9d[_0x1abfac];return _0x2f97e6;};'use strict';var Sequelize=require(_0xd3f9('0x0'));module[_0xd3f9('0x1')]={'name':{'type':Sequelize[_0xd3f9('0x2')]},'description':{'type':Sequelize[_0xd3f9('0x2')]}}; \ No newline at end of file +var _0x928c=['exports','STRING'];(function(_0x13e2d4,_0x1593a3){var _0x48146c=function(_0x5eae48){while(--_0x5eae48){_0x13e2d4['push'](_0x13e2d4['shift']());}};_0x48146c(++_0x1593a3);}(_0x928c,0xca));var _0xc928=function(_0x3a1d19,_0x24bfc3){_0x3a1d19=_0x3a1d19-0x0;var _0x3486ff=_0x928c[_0x3a1d19];return _0x3486ff;};'use strict';var Sequelize=require('sequelize');module[_0xc928('0x0')]={'name':{'type':Sequelize[_0xc928('0x1')]},'description':{'type':Sequelize[_0xc928('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9130fd4..4a732a0 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 _0x55e4=['pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','getFields','findOne','SugarcrmField','order','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x1d7535,_0x55638b){var _0x49f25c=function(_0x1510f7){while(--_0x1510f7){_0x1d7535['push'](_0x1d7535['shift']());}};_0x49f25c(++_0x55638b);}(_0x55e4,0x103));var _0x455e=function(_0x14af59,_0xe28d1d){_0x14af59=_0x14af59-0x0;var _0x1a1058=_0x55e4[_0x14af59];return _0x1a1058;};'use strict';var emlformat=require(_0x455e('0x0'));var rimraf=require(_0x455e('0x1'));var zipdir=require(_0x455e('0x2'));var jsonpatch=require(_0x455e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x455e('0x4'));var Mustache=require(_0x455e('0x5'));var util=require(_0x455e('0x6'));var path=require(_0x455e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x455e('0x8'));var fs=require('fs');var fs_extra=require(_0x455e('0x9'));var _=require(_0x455e('0xa'));var squel=require(_0x455e('0xb'));var crypto=require(_0x455e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x455e('0xd'));var toCsv=require(_0x455e('0xe'));var querystring=require('querystring');var Papa=require(_0x455e('0xf'));var Redis=require(_0x455e('0x10'));var authService=require(_0x455e('0x11'));var qs=require(_0x455e('0x12'));var as=require(_0x455e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x455e('0x14'))(_0x455e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x455e('0x16'));var db=require(_0x455e('0x17'))['db'];function respondWithStatusCode(_0x4d7907,_0xa5577f){_0xa5577f=_0xa5577f||0xcc;return function(_0x55b925){if(_0x55b925){return _0x4d7907[_0x455e('0x18')](_0xa5577f);}return _0x4d7907[_0x455e('0x19')](_0xa5577f)[_0x455e('0x1a')]();};}function respondWithResult(_0x3ea93,_0x7511b1){_0x7511b1=_0x7511b1||0xc8;return function(_0x20c0b5){if(_0x20c0b5){return _0x3ea93[_0x455e('0x19')](_0x7511b1)[_0x455e('0x1b')](_0x20c0b5);}};}function respondWithFilteredResult(_0x1324a8,_0x1ab6fb){return function(_0x3be7dd){if(_0x3be7dd){var _0x25f984=typeof _0x1ab6fb[_0x455e('0x1c')]===_0x455e('0x1d')&&typeof _0x1ab6fb['limit']==='undefined';var _0xff0d01=_0x3be7dd[_0x455e('0x1e')];var _0x4299ec=_0x25f984?0x0:_0x1ab6fb[_0x455e('0x1c')];var _0xe41f5c=_0x25f984?_0x3be7dd[_0x455e('0x1e')]:_0x1ab6fb[_0x455e('0x1c')]+_0x1ab6fb[_0x455e('0x1f')];var _0x10f84f;if(_0xe41f5c>=_0xff0d01){_0xe41f5c=_0xff0d01;_0x10f84f=0xc8;}else{_0x10f84f=0xce;}_0x1324a8[_0x455e('0x19')](_0x10f84f);return _0x1324a8['set']('Content-Range',_0x4299ec+'-'+_0xe41f5c+'/'+_0xff0d01)[_0x455e('0x1b')](_0x3be7dd);}return null;};}function patchUpdates(_0x270c6b){return function(_0x3d1b2d){try{jsonpatch['apply'](_0x3d1b2d,_0x270c6b,!![]);}catch(_0x908b76){return BPromise[_0x455e('0x20')](_0x908b76);}return _0x3d1b2d[_0x455e('0x21')]();};}function saveUpdates(_0x308e56,_0x4147ac){return function(_0xba10e8){if(_0xba10e8){return _0xba10e8[_0x455e('0x22')](_0x308e56)[_0x455e('0x23')](function(_0x154dd8){return _0x154dd8;});}return null;};}function removeEntity(_0x22161b,_0x31735e){return function(_0x263df9){if(_0x263df9){return _0x263df9[_0x455e('0x24')]()[_0x455e('0x23')](function(){_0x22161b[_0x455e('0x19')](0xcc)[_0x455e('0x1a')]();});}};}function handleEntityNotFound(_0x436fb9,_0x458eee){return function(_0x2816af){if(!_0x2816af){_0x436fb9[_0x455e('0x18')](0x194);}return _0x2816af;};}function handleError(_0x188a49,_0x5ccd8f){_0x5ccd8f=_0x5ccd8f||0x1f4;return function(_0x247249){logger[_0x455e('0x25')](_0x247249[_0x455e('0x26')]);if(_0x247249[_0x455e('0x27')]){delete _0x247249['name'];}_0x188a49[_0x455e('0x19')](_0x5ccd8f)[_0x455e('0x28')](_0x247249);};}exports['index']=function(_0x28c2a4,_0x548e9e){var _0x40a025={},_0x1f9463={},_0x7bb732={'count':0x0,'rows':[]};var _0x252560=_[_0x455e('0x29')](db[_0x455e('0x2a')][_0x455e('0x2b')],function(_0x1abcf8){return{'name':_0x1abcf8[_0x455e('0x2c')],'type':_0x1abcf8[_0x455e('0x2d')]['key']};});_0x1f9463['model']=_[_0x455e('0x29')](_0x252560,_0x455e('0x27'));_0x1f9463[_0x455e('0x2e')]=_[_0x455e('0x2f')](_0x28c2a4[_0x455e('0x2e')]);_0x1f9463['filters']=_[_0x455e('0x30')](_0x1f9463[_0x455e('0x31')],_0x1f9463[_0x455e('0x2e')]);_0x40a025[_0x455e('0x32')]=_[_0x455e('0x30')](_0x1f9463[_0x455e('0x31')],qs[_0x455e('0x33')](_0x28c2a4['query']['fields']));_0x40a025[_0x455e('0x32')]=_0x40a025[_0x455e('0x32')]['length']?_0x40a025[_0x455e('0x32')]:_0x1f9463[_0x455e('0x31')];if(!_0x28c2a4[_0x455e('0x2e')][_0x455e('0x34')](_0x455e('0x35'))){_0x40a025[_0x455e('0x1f')]=qs['limit'](_0x28c2a4[_0x455e('0x2e')][_0x455e('0x1f')]);_0x40a025['offset']=qs[_0x455e('0x1c')](_0x28c2a4[_0x455e('0x2e')]['offset']);}_0x40a025['order']=qs['sort'](_0x28c2a4['query'][_0x455e('0x36')]);_0x40a025[_0x455e('0x37')]=qs[_0x455e('0x38')](_[_0x455e('0x39')](_0x28c2a4[_0x455e('0x2e')],_0x1f9463['filters']),_0x252560);if(_0x28c2a4['query']['filter']){_0x40a025[_0x455e('0x37')]=_[_0x455e('0x3a')](_0x40a025['where'],{'$or':_[_0x455e('0x29')](_0x252560,function(_0x2e51c6){if(_0x2e51c6[_0x455e('0x2d')]!==_0x455e('0x3b')){var _0x421ba7={};_0x421ba7[_0x2e51c6['name']]={'$like':'%'+_0x28c2a4[_0x455e('0x2e')]['filter']+'%'};return _0x421ba7;}})});}_0x40a025=_[_0x455e('0x3a')]({},_0x40a025,_0x28c2a4[_0x455e('0x3c')]);var _0x373633={'where':_0x40a025['where']};return db[_0x455e('0x2a')]['count'](_0x373633)[_0x455e('0x23')](function(_0x10cdf9){_0x7bb732[_0x455e('0x1e')]=_0x10cdf9;if(_0x28c2a4[_0x455e('0x2e')]['includeAll']){_0x40a025[_0x455e('0x3d')]=[{'all':!![]}];}return db[_0x455e('0x2a')][_0x455e('0x3e')](_0x40a025);})[_0x455e('0x23')](function(_0x38df6e){_0x7bb732[_0x455e('0x3f')]=_0x38df6e;return _0x7bb732;})['then'](respondWithFilteredResult(_0x548e9e,_0x40a025))[_0x455e('0x40')](handleError(_0x548e9e,null));};exports[_0x455e('0x41')]=function(_0x13aef1,_0x2dd29f){var _0xa52521={'raw':![],'where':{'id':_0x13aef1['params']['id']}},_0x14983e={};_0x14983e[_0x455e('0x31')]=_[_0x455e('0x2f')](db['SugarcrmConfiguration']['rawAttributes']);_0x14983e[_0x455e('0x2e')]=_['keys'](_0x13aef1[_0x455e('0x2e')]);_0x14983e[_0x455e('0x38')]=_[_0x455e('0x30')](_0x14983e[_0x455e('0x31')],_0x14983e[_0x455e('0x2e')]);_0xa52521[_0x455e('0x32')]=_['intersection'](_0x14983e['model'],qs['fields'](_0x13aef1[_0x455e('0x2e')][_0x455e('0x33')]));_0xa52521[_0x455e('0x32')]=_0xa52521[_0x455e('0x32')][_0x455e('0x42')]?_0xa52521['attributes']:_0x14983e['model'];if(_0x13aef1[_0x455e('0x2e')][_0x455e('0x43')]){_0xa52521[_0x455e('0x3d')]=[{'all':!![]}];}_0xa52521=_['merge']({},_0xa52521,_0x13aef1[_0x455e('0x3c')]);return db[_0x455e('0x2a')][_0x455e('0x44')](_0xa52521)[_0x455e('0x23')](handleEntityNotFound(_0x2dd29f,null))[_0x455e('0x23')](respondWithResult(_0x2dd29f,null))['catch'](handleError(_0x2dd29f,null));};exports[_0x455e('0x45')]=function(_0x51fd50,_0x228d8b){return db[_0x455e('0x2a')][_0x455e('0x45')](_0x51fd50['body'],{})[_0x455e('0x23')](respondWithResult(_0x228d8b,0xc9))['catch'](handleError(_0x228d8b,null));};exports[_0x455e('0x22')]=function(_0x13ee80,_0x54de3c){if(_0x13ee80['body']['id']){delete _0x13ee80[_0x455e('0x46')]['id'];}return db[_0x455e('0x2a')][_0x455e('0x44')]({'where':{'id':_0x13ee80[_0x455e('0x47')]['id']}})['then'](handleEntityNotFound(_0x54de3c,null))[_0x455e('0x23')](saveUpdates(_0x13ee80[_0x455e('0x46')],null))[_0x455e('0x23')](respondWithResult(_0x54de3c,null))[_0x455e('0x40')](handleError(_0x54de3c,null));};exports[_0x455e('0x24')]=function(_0x177b32,_0x452423){return db[_0x455e('0x2a')][_0x455e('0x44')]({'where':{'id':_0x177b32[_0x455e('0x47')]['id']}})['then'](handleEntityNotFound(_0x452423,null))[_0x455e('0x23')](removeEntity(_0x452423,null))['catch'](handleError(_0x452423,null));};exports[_0x455e('0x48')]=function(_0xfda417,_0x47af43,_0x21cd41){var _0x82cbf6={};var _0x528f43={};var _0x39aa13;var _0x506ac6;return db[_0x455e('0x2a')][_0x455e('0x49')]({'where':{'id':_0xfda417[_0x455e('0x47')]['id']}})['then'](handleEntityNotFound(_0x47af43,null))[_0x455e('0x23')](function(_0x42c8d2){if(_0x42c8d2){_0x39aa13=_0x42c8d2;_0x528f43[_0x455e('0x31')]=_['keys'](db[_0x455e('0x4a')][_0x455e('0x2b')]);_0x528f43[_0x455e('0x2e')]=_['keys'](_0xfda417['query']);_0x528f43[_0x455e('0x38')]=_[_0x455e('0x30')](_0x528f43['model'],_0x528f43['query']);_0x82cbf6[_0x455e('0x32')]=_[_0x455e('0x30')](_0x528f43[_0x455e('0x31')],qs[_0x455e('0x33')](_0xfda417[_0x455e('0x2e')][_0x455e('0x33')]));_0x82cbf6[_0x455e('0x32')]=_0x82cbf6['attributes']['length']?_0x82cbf6[_0x455e('0x32')]:_0x528f43['model'];_0x82cbf6[_0x455e('0x4b')]=qs[_0x455e('0x36')](_0xfda417[_0x455e('0x2e')][_0x455e('0x36')]);_0x82cbf6[_0x455e('0x37')]=qs[_0x455e('0x38')](_['pick'](_0xfda417[_0x455e('0x2e')],_0x528f43[_0x455e('0x38')]));if(_0xfda417[_0x455e('0x2e')][_0x455e('0x4c')]){_0x82cbf6[_0x455e('0x37')]=_[_0x455e('0x3a')](_0x82cbf6['where'],{'$or':_['map'](_0x82cbf6[_0x455e('0x32')],function(_0x2e005e){var _0x473f67={};_0x473f67[_0x2e005e]={'$like':'%'+_0xfda417[_0x455e('0x2e')]['filter']+'%'};return _0x473f67;})});}_0x82cbf6=_['merge']({},_0x82cbf6,_0xfda417['options']);return _0x39aa13['getFields'](_0x82cbf6);}})[_0x455e('0x23')](function(_0x3695f9){if(_0x3695f9){_0x506ac6=_0x3695f9[_0x455e('0x42')];if(!_0xfda417['query'][_0x455e('0x34')](_0x455e('0x35'))){_0x82cbf6[_0x455e('0x1f')]=qs[_0x455e('0x1f')](_0xfda417[_0x455e('0x2e')][_0x455e('0x1f')]);_0x82cbf6[_0x455e('0x1c')]=qs[_0x455e('0x1c')](_0xfda417[_0x455e('0x2e')][_0x455e('0x1c')]);}return _0x39aa13['getFields'](_0x82cbf6);}})[_0x455e('0x23')](function(_0x4676ce){if(_0x4676ce){return _0x4676ce?{'count':_0x506ac6,'rows':_0x4676ce}:null;}})[_0x455e('0x23')](respondWithResult(_0x47af43,null))['catch'](handleError(_0x47af43,null));};exports[_0x455e('0x4d')]=function(_0x360adb,_0x1aed84,_0x4b1cd6){var _0x258b2c={};var _0x386684={};var _0x509108;var _0x55ff15;return db[_0x455e('0x2a')][_0x455e('0x49')]({'where':{'id':_0x360adb[_0x455e('0x47')]['id']}})[_0x455e('0x23')](handleEntityNotFound(_0x1aed84,null))['then'](function(_0x5375e6){if(_0x5375e6){_0x509108=_0x5375e6;_0x386684[_0x455e('0x31')]=_[_0x455e('0x2f')](db['SugarcrmField'][_0x455e('0x2b')]);_0x386684[_0x455e('0x2e')]=_[_0x455e('0x2f')](_0x360adb['query']);_0x386684['filters']=_[_0x455e('0x30')](_0x386684[_0x455e('0x31')],_0x386684[_0x455e('0x2e')]);_0x258b2c[_0x455e('0x32')]=_[_0x455e('0x30')](_0x386684[_0x455e('0x31')],qs[_0x455e('0x33')](_0x360adb[_0x455e('0x2e')][_0x455e('0x33')]));_0x258b2c[_0x455e('0x32')]=_0x258b2c[_0x455e('0x32')][_0x455e('0x42')]?_0x258b2c['attributes']:_0x386684[_0x455e('0x31')];_0x258b2c[_0x455e('0x4b')]=qs['sort'](_0x360adb[_0x455e('0x2e')][_0x455e('0x36')]);_0x258b2c[_0x455e('0x37')]=qs[_0x455e('0x38')](_[_0x455e('0x39')](_0x360adb[_0x455e('0x2e')],_0x386684[_0x455e('0x38')]));if(_0x360adb[_0x455e('0x2e')][_0x455e('0x4c')]){_0x258b2c[_0x455e('0x37')]=_[_0x455e('0x3a')](_0x258b2c[_0x455e('0x37')],{'$or':_['map'](_0x258b2c[_0x455e('0x32')],function(_0x307ff7){var _0x4e7233={};_0x4e7233[_0x307ff7]={'$like':'%'+_0x360adb[_0x455e('0x2e')][_0x455e('0x4c')]+'%'};return _0x4e7233;})});}_0x258b2c=_[_0x455e('0x3a')]({},_0x258b2c,_0x360adb[_0x455e('0x3c')]);return _0x509108['getSubjects'](_0x258b2c);}})['then'](function(_0x480725){if(_0x480725){_0x55ff15=_0x480725[_0x455e('0x42')];if(!_0x360adb['query'][_0x455e('0x34')]('nolimit')){_0x258b2c[_0x455e('0x1f')]=qs[_0x455e('0x1f')](_0x360adb[_0x455e('0x2e')][_0x455e('0x1f')]);_0x258b2c[_0x455e('0x1c')]=qs['offset'](_0x360adb['query'][_0x455e('0x1c')]);}return _0x509108[_0x455e('0x4d')](_0x258b2c);}})[_0x455e('0x23')](function(_0x1580aa){if(_0x1580aa){return _0x1580aa?{'count':_0x55ff15,'rows':_0x1580aa}:null;}})[_0x455e('0x23')](respondWithResult(_0x1aed84,null))[_0x455e('0x40')](handleError(_0x1aed84,null));};exports[_0x455e('0x4e')]=function(_0x308625,_0x9a8909,_0xda59e7){var _0x258b20={};var _0x4ffe9e={};var _0x2df980;var _0x175138;return db[_0x455e('0x2a')]['findOne']({'where':{'id':_0x308625[_0x455e('0x47')]['id']}})[_0x455e('0x23')](handleEntityNotFound(_0x9a8909,null))[_0x455e('0x23')](function(_0x535b86){if(_0x535b86){_0x2df980=_0x535b86;_0x4ffe9e[_0x455e('0x31')]=_[_0x455e('0x2f')](db[_0x455e('0x4a')]['rawAttributes']);_0x4ffe9e[_0x455e('0x2e')]=_['keys'](_0x308625[_0x455e('0x2e')]);_0x4ffe9e[_0x455e('0x38')]=_[_0x455e('0x30')](_0x4ffe9e[_0x455e('0x31')],_0x4ffe9e[_0x455e('0x2e')]);_0x258b20[_0x455e('0x32')]=_[_0x455e('0x30')](_0x4ffe9e['model'],qs[_0x455e('0x33')](_0x308625['query']['fields']));_0x258b20[_0x455e('0x32')]=_0x258b20[_0x455e('0x32')]['length']?_0x258b20[_0x455e('0x32')]:_0x4ffe9e['model'];_0x258b20[_0x455e('0x4b')]=qs[_0x455e('0x36')](_0x308625[_0x455e('0x2e')][_0x455e('0x36')]);_0x258b20[_0x455e('0x37')]=qs[_0x455e('0x38')](_[_0x455e('0x39')](_0x308625['query'],_0x4ffe9e[_0x455e('0x38')]));if(_0x308625[_0x455e('0x2e')][_0x455e('0x4c')]){_0x258b20[_0x455e('0x37')]=_['merge'](_0x258b20[_0x455e('0x37')],{'$or':_[_0x455e('0x29')](_0x258b20['attributes'],function(_0xd1ee78){var _0x9c6889={};_0x9c6889[_0xd1ee78]={'$like':'%'+_0x308625['query'][_0x455e('0x4c')]+'%'};return _0x9c6889;})});}_0x258b20=_[_0x455e('0x3a')]({},_0x258b20,_0x308625[_0x455e('0x3c')]);return _0x2df980[_0x455e('0x4e')](_0x258b20);}})[_0x455e('0x23')](function(_0x241269){if(_0x241269){_0x175138=_0x241269[_0x455e('0x42')];if(!_0x308625[_0x455e('0x2e')][_0x455e('0x34')](_0x455e('0x35'))){_0x258b20[_0x455e('0x1f')]=qs[_0x455e('0x1f')](_0x308625[_0x455e('0x2e')]['limit']);_0x258b20['offset']=qs[_0x455e('0x1c')](_0x308625[_0x455e('0x2e')]['offset']);}return _0x2df980[_0x455e('0x4e')](_0x258b20);}})[_0x455e('0x23')](function(_0x1f4d00){if(_0x1f4d00){return _0x1f4d00?{'count':_0x175138,'rows':_0x1f4d00}:null;}})[_0x455e('0x23')](respondWithResult(_0x9a8909,null))['catch'](handleError(_0x9a8909,null));}; \ No newline at end of file +var _0x25d6=['update','then','error','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','SugarcrmConfiguration','rows','catch','params','keys','length','include','find','create','body','destroy','hasOwnProperty','nolimit','getFields','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save'];(function(_0x26a9c9,_0x56139b){var _0x2f0727=function(_0x1d95f3){while(--_0x1d95f3){_0x26a9c9['push'](_0x26a9c9['shift']());}};_0x2f0727(++_0x56139b);}(_0x25d6,0x1ba));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x625d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x625d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x625d('0x2'));var moment=require(_0x625d('0x3'));var BPromise=require(_0x625d('0x4'));var Mustache=require(_0x625d('0x5'));var util=require(_0x625d('0x6'));var path=require(_0x625d('0x7'));var sox=require(_0x625d('0x8'));var csv=require(_0x625d('0x9'));var ejs=require(_0x625d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x625d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x625d('0xc'));var deskjs=require(_0x625d('0xd'));var toCsv=require(_0x625d('0x9'));var querystring=require(_0x625d('0xe'));var Papa=require(_0x625d('0xf'));var Redis=require(_0x625d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x625d('0x11'));var hardwareService=require(_0x625d('0x12'));var logger=require(_0x625d('0x13'))(_0x625d('0x14'));var utils=require(_0x625d('0x15'));var config=require(_0x625d('0x16'));var licenseUtil=require(_0x625d('0x17'));var db=require(_0x625d('0x18'))['db'];function respondWithStatusCode(_0x5a9a58,_0x5699f0){_0x5699f0=_0x5699f0||0xcc;return function(_0x364510){if(_0x364510){return _0x5a9a58[_0x625d('0x19')](_0x5699f0);}return _0x5a9a58[_0x625d('0x1a')](_0x5699f0)[_0x625d('0x1b')]();};}function respondWithResult(_0xb1b8ff,_0x1009b1){_0x1009b1=_0x1009b1||0xc8;return function(_0x296001){if(_0x296001){return _0xb1b8ff[_0x625d('0x1a')](_0x1009b1)['json'](_0x296001);}};}function respondWithFilteredResult(_0xeae2bf,_0x353608){return function(_0x4db3a3){if(_0x4db3a3){var _0xecaf01=typeof _0x353608['offset']===_0x625d('0x1c')&&typeof _0x353608[_0x625d('0x1d')]===_0x625d('0x1c');var _0x3dd1ce=_0x4db3a3['count'];var _0x1324a5=_0xecaf01?0x0:_0x353608[_0x625d('0x1e')];var _0x588ad1=_0xecaf01?_0x4db3a3[_0x625d('0x1f')]:_0x353608[_0x625d('0x1e')]+_0x353608['limit'];var _0xd8476d;if(_0x588ad1>=_0x3dd1ce){_0x588ad1=_0x3dd1ce;_0xd8476d=0xc8;}else{_0xd8476d=0xce;}_0xeae2bf[_0x625d('0x1a')](_0xd8476d);return _0xeae2bf[_0x625d('0x20')](_0x625d('0x21'),_0x1324a5+'-'+_0x588ad1+'/'+_0x3dd1ce)[_0x625d('0x22')](_0x4db3a3);}return null;};}function patchUpdates(_0x485639){return function(_0x2b8936){try{jsonpatch[_0x625d('0x23')](_0x2b8936,_0x485639,!![]);}catch(_0x2dc5cb){return BPromise[_0x625d('0x24')](_0x2dc5cb);}return _0x2b8936[_0x625d('0x25')]();};}function saveUpdates(_0x5a0711,_0x3bf777){return function(_0x5032ae){if(_0x5032ae){return _0x5032ae[_0x625d('0x26')](_0x5a0711)[_0x625d('0x27')](function(_0x4b819c){return _0x4b819c;});}return null;};}function removeEntity(_0x2e9c18,_0x5f30d2){return function(_0xde5660){if(_0xde5660){return _0xde5660['destroy']()[_0x625d('0x27')](function(){_0x2e9c18[_0x625d('0x1a')](0xcc)[_0x625d('0x1b')]();});}};}function handleEntityNotFound(_0x308e7b,_0x4001a5){return function(_0x8f7c4d){if(!_0x8f7c4d){_0x308e7b[_0x625d('0x19')](0x194);}return _0x8f7c4d;};}function handleError(_0x11700b,_0x5e5b16){_0x5e5b16=_0x5e5b16||0x1f4;return function(_0x30b640){logger[_0x625d('0x28')](_0x30b640['stack']);if(_0x30b640[_0x625d('0x29')]){delete _0x30b640['name'];}_0x11700b[_0x625d('0x1a')](_0x5e5b16)[_0x625d('0x2a')](_0x30b640);};}exports['index']=function(_0x4bc0f4,_0x16ef5d){var _0x7e392e={},_0x2c3cbc={},_0x593421={'count':0x0,'rows':[]};var _0x1482eb=_[_0x625d('0x2b')](db['SugarcrmConfiguration'][_0x625d('0x2c')],function(_0x563867){return{'name':_0x563867[_0x625d('0x2d')],'type':_0x563867['type'][_0x625d('0x2e')]};});_0x2c3cbc[_0x625d('0x2f')]=_[_0x625d('0x2b')](_0x1482eb,_0x625d('0x29'));_0x2c3cbc[_0x625d('0x30')]=_['keys'](_0x4bc0f4[_0x625d('0x30')]);_0x2c3cbc[_0x625d('0x31')]=_[_0x625d('0x32')](_0x2c3cbc[_0x625d('0x2f')],_0x2c3cbc[_0x625d('0x30')]);_0x7e392e['attributes']=_['intersection'](_0x2c3cbc[_0x625d('0x2f')],qs[_0x625d('0x33')](_0x4bc0f4[_0x625d('0x30')][_0x625d('0x33')]));_0x7e392e[_0x625d('0x34')]=_0x7e392e['attributes']['length']?_0x7e392e[_0x625d('0x34')]:_0x2c3cbc['model'];if(!_0x4bc0f4[_0x625d('0x30')]['hasOwnProperty']('nolimit')){_0x7e392e[_0x625d('0x1d')]=qs[_0x625d('0x1d')](_0x4bc0f4[_0x625d('0x30')][_0x625d('0x1d')]);_0x7e392e[_0x625d('0x1e')]=qs[_0x625d('0x1e')](_0x4bc0f4[_0x625d('0x30')][_0x625d('0x1e')]);}_0x7e392e[_0x625d('0x35')]=qs[_0x625d('0x36')](_0x4bc0f4[_0x625d('0x30')][_0x625d('0x36')]);_0x7e392e[_0x625d('0x37')]=qs[_0x625d('0x31')](_[_0x625d('0x38')](_0x4bc0f4['query'],_0x2c3cbc[_0x625d('0x31')]),_0x1482eb);if(_0x4bc0f4['query'][_0x625d('0x39')]){_0x7e392e[_0x625d('0x37')]=_[_0x625d('0x3a')](_0x7e392e[_0x625d('0x37')],{'$or':_[_0x625d('0x2b')](_0x1482eb,function(_0x53d88c){if(_0x53d88c['type']!==_0x625d('0x3b')){var _0x14fc42={};_0x14fc42[_0x53d88c[_0x625d('0x29')]]={'$like':'%'+_0x4bc0f4[_0x625d('0x30')][_0x625d('0x39')]+'%'};return _0x14fc42;}})});}_0x7e392e=_[_0x625d('0x3a')]({},_0x7e392e,_0x4bc0f4[_0x625d('0x3c')]);var _0x44deb7={'where':_0x7e392e[_0x625d('0x37')]};return db['SugarcrmConfiguration']['count'](_0x44deb7)[_0x625d('0x27')](function(_0x50abea){_0x593421[_0x625d('0x1f')]=_0x50abea;if(_0x4bc0f4[_0x625d('0x30')][_0x625d('0x3d')]){_0x7e392e['include']=[{'all':!![]}];}return db[_0x625d('0x3e')]['findAll'](_0x7e392e);})['then'](function(_0x463031){_0x593421[_0x625d('0x3f')]=_0x463031;return _0x593421;})['then'](respondWithFilteredResult(_0x16ef5d,_0x7e392e))[_0x625d('0x40')](handleError(_0x16ef5d,null));};exports['show']=function(_0x3b1f6e,_0x18c54a){var _0x2f317f={'raw':![],'where':{'id':_0x3b1f6e[_0x625d('0x41')]['id']}},_0x4176cb={};_0x4176cb[_0x625d('0x2f')]=_[_0x625d('0x42')](db[_0x625d('0x3e')][_0x625d('0x2c')]);_0x4176cb['query']=_[_0x625d('0x42')](_0x3b1f6e['query']);_0x4176cb[_0x625d('0x31')]=_[_0x625d('0x32')](_0x4176cb[_0x625d('0x2f')],_0x4176cb['query']);_0x2f317f[_0x625d('0x34')]=_[_0x625d('0x32')](_0x4176cb['model'],qs[_0x625d('0x33')](_0x3b1f6e[_0x625d('0x30')]['fields']));_0x2f317f[_0x625d('0x34')]=_0x2f317f[_0x625d('0x34')][_0x625d('0x43')]?_0x2f317f['attributes']:_0x4176cb[_0x625d('0x2f')];if(_0x3b1f6e[_0x625d('0x30')]['includeAll']){_0x2f317f[_0x625d('0x44')]=[{'all':!![]}];}_0x2f317f=_[_0x625d('0x3a')]({},_0x2f317f,_0x3b1f6e[_0x625d('0x3c')]);return db[_0x625d('0x3e')][_0x625d('0x45')](_0x2f317f)['then'](handleEntityNotFound(_0x18c54a,null))[_0x625d('0x27')](respondWithResult(_0x18c54a,null))[_0x625d('0x40')](handleError(_0x18c54a,null));};exports[_0x625d('0x46')]=function(_0x3f1022,_0x5d337e){return db[_0x625d('0x3e')]['create'](_0x3f1022['body'],{})[_0x625d('0x27')](respondWithResult(_0x5d337e,0xc9))[_0x625d('0x40')](handleError(_0x5d337e,null));};exports[_0x625d('0x26')]=function(_0x51ef68,_0x949b1){if(_0x51ef68['body']['id']){delete _0x51ef68['body']['id'];}return db[_0x625d('0x3e')][_0x625d('0x45')]({'where':{'id':_0x51ef68[_0x625d('0x41')]['id']}})['then'](handleEntityNotFound(_0x949b1,null))['then'](saveUpdates(_0x51ef68[_0x625d('0x47')],null))['then'](respondWithResult(_0x949b1,null))[_0x625d('0x40')](handleError(_0x949b1,null));};exports[_0x625d('0x48')]=function(_0x22e350,_0x1a057b){return db[_0x625d('0x3e')][_0x625d('0x45')]({'where':{'id':_0x22e350[_0x625d('0x41')]['id']}})[_0x625d('0x27')](handleEntityNotFound(_0x1a057b,null))['then'](removeEntity(_0x1a057b,null))[_0x625d('0x40')](handleError(_0x1a057b,null));};exports['getFields']=function(_0x3049f1,_0x193d69,_0x1c34e8){var _0x295c8e={};var _0x339d14={};var _0x4e5326;var _0x531204;return db[_0x625d('0x3e')]['findOne']({'where':{'id':_0x3049f1[_0x625d('0x41')]['id']}})[_0x625d('0x27')](handleEntityNotFound(_0x193d69,null))[_0x625d('0x27')](function(_0x9cee3e){if(_0x9cee3e){_0x4e5326=_0x9cee3e;_0x339d14['model']=_['keys'](db['SugarcrmField'][_0x625d('0x2c')]);_0x339d14[_0x625d('0x30')]=_[_0x625d('0x42')](_0x3049f1['query']);_0x339d14[_0x625d('0x31')]=_[_0x625d('0x32')](_0x339d14[_0x625d('0x2f')],_0x339d14['query']);_0x295c8e[_0x625d('0x34')]=_[_0x625d('0x32')](_0x339d14[_0x625d('0x2f')],qs[_0x625d('0x33')](_0x3049f1[_0x625d('0x30')]['fields']));_0x295c8e[_0x625d('0x34')]=_0x295c8e['attributes'][_0x625d('0x43')]?_0x295c8e[_0x625d('0x34')]:_0x339d14[_0x625d('0x2f')];_0x295c8e[_0x625d('0x35')]=qs[_0x625d('0x36')](_0x3049f1[_0x625d('0x30')][_0x625d('0x36')]);_0x295c8e[_0x625d('0x37')]=qs[_0x625d('0x31')](_[_0x625d('0x38')](_0x3049f1[_0x625d('0x30')],_0x339d14['filters']));if(_0x3049f1[_0x625d('0x30')][_0x625d('0x39')]){_0x295c8e[_0x625d('0x37')]=_[_0x625d('0x3a')](_0x295c8e['where'],{'$or':_['map'](_0x295c8e[_0x625d('0x34')],function(_0x3a6895){var _0x28d4f9={};_0x28d4f9[_0x3a6895]={'$like':'%'+_0x3049f1[_0x625d('0x30')]['filter']+'%'};return _0x28d4f9;})});}_0x295c8e=_[_0x625d('0x3a')]({},_0x295c8e,_0x3049f1[_0x625d('0x3c')]);return _0x4e5326['getFields'](_0x295c8e);}})['then'](function(_0x383a82){if(_0x383a82){_0x531204=_0x383a82[_0x625d('0x43')];if(!_0x3049f1[_0x625d('0x30')][_0x625d('0x49')](_0x625d('0x4a'))){_0x295c8e['limit']=qs[_0x625d('0x1d')](_0x3049f1[_0x625d('0x30')][_0x625d('0x1d')]);_0x295c8e[_0x625d('0x1e')]=qs['offset'](_0x3049f1[_0x625d('0x30')][_0x625d('0x1e')]);}return _0x4e5326[_0x625d('0x4b')](_0x295c8e);}})[_0x625d('0x27')](function(_0x2f449d){if(_0x2f449d){return _0x2f449d?{'count':_0x531204,'rows':_0x2f449d}:null;}})[_0x625d('0x27')](respondWithResult(_0x193d69,null))[_0x625d('0x40')](handleError(_0x193d69,null));};exports[_0x625d('0x4c')]=function(_0x4fa432,_0x1b96bf,_0x581b82){var _0x56b0f0={};var _0x54e9d7={};var _0xea2d74;var _0x470fc0;return db[_0x625d('0x3e')][_0x625d('0x4d')]({'where':{'id':_0x4fa432[_0x625d('0x41')]['id']}})[_0x625d('0x27')](handleEntityNotFound(_0x1b96bf,null))[_0x625d('0x27')](function(_0x1f1d4b){if(_0x1f1d4b){_0xea2d74=_0x1f1d4b;_0x54e9d7[_0x625d('0x2f')]=_[_0x625d('0x42')](db[_0x625d('0x4e')]['rawAttributes']);_0x54e9d7['query']=_[_0x625d('0x42')](_0x4fa432[_0x625d('0x30')]);_0x54e9d7[_0x625d('0x31')]=_[_0x625d('0x32')](_0x54e9d7[_0x625d('0x2f')],_0x54e9d7[_0x625d('0x30')]);_0x56b0f0['attributes']=_[_0x625d('0x32')](_0x54e9d7[_0x625d('0x2f')],qs['fields'](_0x4fa432['query']['fields']));_0x56b0f0[_0x625d('0x34')]=_0x56b0f0['attributes'][_0x625d('0x43')]?_0x56b0f0['attributes']:_0x54e9d7[_0x625d('0x2f')];_0x56b0f0[_0x625d('0x35')]=qs[_0x625d('0x36')](_0x4fa432[_0x625d('0x30')][_0x625d('0x36')]);_0x56b0f0[_0x625d('0x37')]=qs['filters'](_['pick'](_0x4fa432[_0x625d('0x30')],_0x54e9d7[_0x625d('0x31')]));if(_0x4fa432[_0x625d('0x30')]['filter']){_0x56b0f0[_0x625d('0x37')]=_[_0x625d('0x3a')](_0x56b0f0[_0x625d('0x37')],{'$or':_[_0x625d('0x2b')](_0x56b0f0[_0x625d('0x34')],function(_0x397bbc){var _0x525b73={};_0x525b73[_0x397bbc]={'$like':'%'+_0x4fa432[_0x625d('0x30')]['filter']+'%'};return _0x525b73;})});}_0x56b0f0=_[_0x625d('0x3a')]({},_0x56b0f0,_0x4fa432[_0x625d('0x3c')]);return _0xea2d74[_0x625d('0x4c')](_0x56b0f0);}})[_0x625d('0x27')](function(_0x1ba390){if(_0x1ba390){_0x470fc0=_0x1ba390['length'];if(!_0x4fa432[_0x625d('0x30')]['hasOwnProperty'](_0x625d('0x4a'))){_0x56b0f0[_0x625d('0x1d')]=qs[_0x625d('0x1d')](_0x4fa432[_0x625d('0x30')][_0x625d('0x1d')]);_0x56b0f0['offset']=qs[_0x625d('0x1e')](_0x4fa432['query'][_0x625d('0x1e')]);}return _0xea2d74['getSubjects'](_0x56b0f0);}})[_0x625d('0x27')](function(_0x52b6bc){if(_0x52b6bc){return _0x52b6bc?{'count':_0x470fc0,'rows':_0x52b6bc}:null;}})[_0x625d('0x27')](respondWithResult(_0x1b96bf,null))['catch'](handleError(_0x1b96bf,null));};exports[_0x625d('0x4f')]=function(_0x2d3f3d,_0x125daf,_0x56d545){var _0x47638c={};var _0x44c0d2={};var _0xbc0a1a;var _0xf6ed57;return db[_0x625d('0x3e')]['findOne']({'where':{'id':_0x2d3f3d[_0x625d('0x41')]['id']}})['then'](handleEntityNotFound(_0x125daf,null))[_0x625d('0x27')](function(_0x2488aa){if(_0x2488aa){_0xbc0a1a=_0x2488aa;_0x44c0d2['model']=_['keys'](db[_0x625d('0x4e')][_0x625d('0x2c')]);_0x44c0d2[_0x625d('0x30')]=_[_0x625d('0x42')](_0x2d3f3d['query']);_0x44c0d2[_0x625d('0x31')]=_[_0x625d('0x32')](_0x44c0d2[_0x625d('0x2f')],_0x44c0d2[_0x625d('0x30')]);_0x47638c[_0x625d('0x34')]=_[_0x625d('0x32')](_0x44c0d2[_0x625d('0x2f')],qs[_0x625d('0x33')](_0x2d3f3d[_0x625d('0x30')][_0x625d('0x33')]));_0x47638c[_0x625d('0x34')]=_0x47638c[_0x625d('0x34')]['length']?_0x47638c[_0x625d('0x34')]:_0x44c0d2[_0x625d('0x2f')];_0x47638c[_0x625d('0x35')]=qs[_0x625d('0x36')](_0x2d3f3d[_0x625d('0x30')][_0x625d('0x36')]);_0x47638c['where']=qs[_0x625d('0x31')](_[_0x625d('0x38')](_0x2d3f3d[_0x625d('0x30')],_0x44c0d2[_0x625d('0x31')]));if(_0x2d3f3d['query'][_0x625d('0x39')]){_0x47638c[_0x625d('0x37')]=_[_0x625d('0x3a')](_0x47638c['where'],{'$or':_[_0x625d('0x2b')](_0x47638c[_0x625d('0x34')],function(_0x1d6831){var _0x24094d={};_0x24094d[_0x1d6831]={'$like':'%'+_0x2d3f3d[_0x625d('0x30')][_0x625d('0x39')]+'%'};return _0x24094d;})});}_0x47638c=_[_0x625d('0x3a')]({},_0x47638c,_0x2d3f3d['options']);return _0xbc0a1a[_0x625d('0x4f')](_0x47638c);}})[_0x625d('0x27')](function(_0x467706){if(_0x467706){_0xf6ed57=_0x467706['length'];if(!_0x2d3f3d[_0x625d('0x30')][_0x625d('0x49')](_0x625d('0x4a'))){_0x47638c[_0x625d('0x1d')]=qs['limit'](_0x2d3f3d[_0x625d('0x30')][_0x625d('0x1d')]);_0x47638c[_0x625d('0x1e')]=qs[_0x625d('0x1e')](_0x2d3f3d[_0x625d('0x30')][_0x625d('0x1e')]);}return _0xbc0a1a[_0x625d('0x4f')](_0x47638c);}})[_0x625d('0x27')](function(_0xf8c043){if(_0xf8c043){return _0xf8c043?{'count':_0xf6ed57,'rows':_0xf8c043}:null;}})[_0x625d('0x27')](respondWithResult(_0x125daf,null))[_0x625d('0x40')](handleError(_0x125daf,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 734fa77..e181a00 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 _0xb14f=['../../config/environment','exports','define','int_sugarcrm_configurations','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb14f,0x190));var _0xfb14=function(_0x4e39a2,_0x1e7487){_0x4e39a2=_0x4e39a2-0x0;var _0x576caa=_0xb14f[_0x4e39a2];return _0x576caa;};'use strict';var _=require(_0xfb14('0x0'));var util=require(_0xfb14('0x1'));var logger=require('../../config/logger')(_0xfb14('0x2'));var moment=require('moment');var BPromise=require(_0xfb14('0x3'));var rp=require(_0xfb14('0x4'));var fs=require('fs');var path=require(_0xfb14('0x5'));var rimraf=require(_0xfb14('0x6'));var config=require(_0xfb14('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xfb14('0x8')]=function(_0x19be8f,_0x2bfb59){return _0x19be8f[_0xfb14('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0xfb14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fde=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9fde,0x11c));var _0xe9fd=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x9fde[_0x4d7a70];return _0x3aafbb;};'use strict';var _=require(_0xe9fd('0x0'));var util=require('util');var logger=require(_0xe9fd('0x1'))(_0xe9fd('0x2'));var moment=require('moment');var BPromise=require(_0xe9fd('0x3'));var rp=require(_0xe9fd('0x4'));var fs=require('fs');var path=require(_0xe9fd('0x5'));var rimraf=require(_0xe9fd('0x6'));var config=require(_0xe9fd('0x7'));var attributes=require(_0xe9fd('0x8'));module[_0xe9fd('0x9')]=function(_0x3b64c3,_0x49b7d0){return _0x3b64c3[_0xe9fd('0xa')](_0xe9fd('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index e7f18d1..5020391 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 _0x01ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment'];(function(_0x1a5ec3,_0xb77a11){var _0x573a9b=function(_0xb3771e){while(--_0xb3771e){_0x1a5ec3['push'](_0x1a5ec3['shift']());}};_0x573a9b(++_0xb77a11);}(_0x01ce,0x1a0));var _0xe01c=function(_0xe7d504,_0x14d181){_0xe7d504=_0xe7d504-0x0;var _0x466b0c=_0x01ce[_0xe7d504];return _0x466b0c;};'use strict';var _=require(_0xe01c('0x0'));var util=require('util');var moment=require(_0xe01c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe01c('0x2'));var fs=require('fs');var Redis=require(_0xe01c('0x3'));var db=require(_0xe01c('0x4'))['db'];var utils=require(_0xe01c('0x5'));var logger=require(_0xe01c('0x6'))(_0xe01c('0x7'));var config=require(_0xe01c('0x8'));var jayson=require(_0xe01c('0x9'));var client=jayson[_0xe01c('0xa')][_0xe01c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b4416,_0xc42452,_0x204ba8){return new BPromise(function(_0x54a85a,_0x28064c){return client[_0xe01c('0xc')](_0x1b4416,_0x204ba8)[_0xe01c('0xd')](function(_0x488f4c){logger['info'](_0xe01c('0xe'),_0xc42452,_0xe01c('0xf'));logger['debug'](_0xe01c('0x10'),_0xc42452,_0xe01c('0xf'),JSON[_0xe01c('0x11')](_0x488f4c));if(_0x488f4c['error']){if(_0x488f4c[_0xe01c('0x12')]['code']===0x1f4){logger[_0xe01c('0x12')](_0xe01c('0xe'),_0xc42452,_0x488f4c[_0xe01c('0x12')][_0xe01c('0x13')]);return _0x28064c(_0x488f4c[_0xe01c('0x12')]['message']);}logger[_0xe01c('0x12')](_0xe01c('0xe'),_0xc42452,_0x488f4c[_0xe01c('0x12')][_0xe01c('0x13')]);return _0x54a85a(_0x488f4c[_0xe01c('0x12')][_0xe01c('0x13')]);}else{logger[_0xe01c('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc42452,'request\x20sent');_0x54a85a(_0x488f4c[_0xe01c('0x15')][_0xe01c('0x13')]);}})['catch'](function(_0x1a08e7){logger[_0xe01c('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc42452,_0x1a08e7);_0x28064c(_0x1a08e7);});});} \ No newline at end of file +var _0x3754=['client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x40fcd2,_0x2f6ae8){var _0x203eeb=function(_0x1a0ef6){while(--_0x1a0ef6){_0x40fcd2['push'](_0x40fcd2['shift']());}};_0x203eeb(++_0x2f6ae8);}(_0x3754,0x175));var _0x4375=function(_0x1fbc79,_0x28b174){_0x1fbc79=_0x1fbc79-0x0;var _0xe701c6=_0x3754[_0x1fbc79];return _0xe701c6;};'use strict';var _=require('lodash');var util=require(_0x4375('0x0'));var moment=require(_0x4375('0x1'));var BPromise=require(_0x4375('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4375('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4375('0x4'))(_0x4375('0x5'));var config=require('../../config/environment');var jayson=require(_0x4375('0x6'));var client=jayson[_0x4375('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ebaee,_0x530dd1,_0x2475e3){return new BPromise(function(_0xd24f71,_0xb9ebc3){return client['request'](_0x2ebaee,_0x2475e3)[_0x4375('0x8')](function(_0x2fbd41){logger[_0x4375('0x9')](_0x4375('0xa'),_0x530dd1,_0x4375('0xb'));logger[_0x4375('0xc')](_0x4375('0xd'),_0x530dd1,_0x4375('0xb'),JSON[_0x4375('0xe')](_0x2fbd41));if(_0x2fbd41[_0x4375('0xf')]){if(_0x2fbd41[_0x4375('0xf')][_0x4375('0x10')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x530dd1,_0x2fbd41[_0x4375('0xf')][_0x4375('0x11')]);return _0xb9ebc3(_0x2fbd41[_0x4375('0xf')][_0x4375('0x11')]);}logger[_0x4375('0xf')](_0x4375('0xa'),_0x530dd1,_0x2fbd41[_0x4375('0xf')][_0x4375('0x11')]);return _0xd24f71(_0x2fbd41['error'][_0x4375('0x11')]);}else{logger[_0x4375('0x9')](_0x4375('0xa'),_0x530dd1,_0x4375('0xb'));_0xd24f71(_0x2fbd41[_0x4375('0x12')][_0x4375('0x11')]);}})[_0x4375('0x13')](function(_0x277727){logger[_0x4375('0xf')](_0x4375('0xa'),_0x530dd1,_0x277727);_0xb9ebc3(_0x277727);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 59d76c5..7c0ae26 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 _0x8b72=['index','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x5973ee,_0x4a097f){var _0x2b88d1=function(_0x41b792){while(--_0x41b792){_0x5973ee['push'](_0x5973ee['shift']());}};_0x2b88d1(++_0x4a097f);}(_0x8b72,0x1c9));var _0x28b7=function(_0x54cf90,_0x52c4ae){_0x54cf90=_0x54cf90-0x0;var _0x3c4781=_0x8b72[_0x54cf90];return _0x3c4781;};'use strict';var multer=require(_0x28b7('0x0'));var util=require(_0x28b7('0x1'));var path=require('path');var timeout=require(_0x28b7('0x2'));var express=require(_0x28b7('0x3'));var router=express['Router']();var fs_extra=require(_0x28b7('0x4'));var auth=require(_0x28b7('0x5'));var interaction=require(_0x28b7('0x6'));var config=require(_0x28b7('0x7'));var controller=require(_0x28b7('0x8'));router[_0x28b7('0x9')]('/',auth[_0x28b7('0xa')](),controller[_0x28b7('0xb')]);router['get']('/:id',auth[_0x28b7('0xa')](),controller['show']);router[_0x28b7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x28b7('0xd')](_0x28b7('0xe'),auth[_0x28b7('0xa')](),controller[_0x28b7('0xf')]);router['delete'](_0x28b7('0xe'),auth[_0x28b7('0xa')](),controller[_0x28b7('0x10')]);module[_0x28b7('0x11')]=router; \ No newline at end of file +var _0xf903=['/:id','show','post','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x316db7,_0x4b3a55){var _0x5cfa1d=function(_0x395462){while(--_0x395462){_0x316db7['push'](_0x316db7['shift']());}};_0x5cfa1d(++_0x4b3a55);}(_0xf903,0x104));var _0x3f90=function(_0x474791,_0x3a2e1a){_0x474791=_0x474791-0x0;var _0x20cca5=_0xf903[_0x474791];return _0x20cca5;};'use strict';var multer=require(_0x3f90('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f90('0x1'));var router=express[_0x3f90('0x2')]();var fs_extra=require(_0x3f90('0x3'));var auth=require(_0x3f90('0x4'));var interaction=require(_0x3f90('0x5'));var config=require('../../config/environment');var controller=require(_0x3f90('0x6'));router[_0x3f90('0x7')]('/',auth[_0x3f90('0x8')](),controller[_0x3f90('0x9')]);router[_0x3f90('0x7')](_0x3f90('0xa'),auth[_0x3f90('0x8')](),controller[_0x3f90('0xb')]);router[_0x3f90('0xc')]('/',auth[_0x3f90('0x8')](),controller[_0x3f90('0xd')]);router[_0x3f90('0xe')](_0x3f90('0xa'),auth[_0x3f90('0x8')](),controller['update']);router[_0x3f90('0xf')]('/:id',auth[_0x3f90('0x8')](),controller[_0x3f90('0x10')]);module[_0x3f90('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5fe829d..e69ad60 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 _0x2727=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x5de933,_0x3551d6){var _0x41d632=function(_0x7f1ae0){while(--_0x7f1ae0){_0x5de933['push'](_0x5de933['shift']());}};_0x41d632(++_0x3551d6);}(_0x2727,0x66));var _0x7272=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x2727[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x7272('0x0'));module[_0x7272('0x1')]={'type':{'type':Sequelize[_0x7272('0x2')](_0x7272('0x3'),_0x7272('0x4'),_0x7272('0x5'),'keyValue',_0x7272('0x6')),'defaultValue':_0x7272('0x3')},'content':{'type':Sequelize[_0x7272('0x7')]},'key':{'type':Sequelize[_0x7272('0x7')]},'keyType':{'type':Sequelize[_0x7272('0x2')]('string',_0x7272('0x4'),_0x7272('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7272('0x7')]},'customField':{'type':Sequelize[_0x7272('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7272('0x7')]}}; \ No newline at end of file +var _0x7985=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x44010b,_0x50bdd2){var _0x36ea57=function(_0xf43064){while(--_0xf43064){_0x44010b['push'](_0x44010b['shift']());}};_0x36ea57(++_0x50bdd2);}(_0x7985,0x179));var _0x5798=function(_0x279229,_0x1d69d9){_0x279229=_0x279229-0x0;var _0x195ca7=_0x7985[_0x279229];return _0x195ca7;};'use strict';var Sequelize=require(_0x5798('0x0'));module[_0x5798('0x1')]={'type':{'type':Sequelize[_0x5798('0x2')](_0x5798('0x3'),_0x5798('0x4'),_0x5798('0x5'),'keyValue',_0x5798('0x6')),'defaultValue':_0x5798('0x3')},'content':{'type':Sequelize[_0x5798('0x7')]},'key':{'type':Sequelize[_0x5798('0x7')]},'keyType':{'type':Sequelize[_0x5798('0x2')](_0x5798('0x3'),_0x5798('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x5798('0x7')]},'idField':{'type':Sequelize[_0x5798('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5798('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 899b33e..dd0968e 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 _0x952a=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','map','SugarcrmField','rawAttributes','fieldName'];(function(_0x2e0a65,_0x40eb16){var _0x280a6a=function(_0x4d0c2a){while(--_0x4d0c2a){_0x2e0a65['push'](_0x2e0a65['shift']());}};_0x280a6a(++_0x40eb16);}(_0x952a,0x107));var _0xa952=function(_0x1b9106,_0x174dff){_0x1b9106=_0x1b9106-0x0;var _0x4d57e8=_0x952a[_0x1b9106];return _0x4d57e8;};'use strict';var emlformat=require(_0xa952('0x0'));var rimraf=require(_0xa952('0x1'));var zipdir=require(_0xa952('0x2'));var jsonpatch=require(_0xa952('0x3'));var rp=require(_0xa952('0x4'));var moment=require(_0xa952('0x5'));var BPromise=require(_0xa952('0x6'));var Mustache=require('mustache');var util=require(_0xa952('0x7'));var path=require(_0xa952('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa952('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa952('0xa'));var squel=require(_0xa952('0xb'));var crypto=require(_0xa952('0xc'));var jsforce=require(_0xa952('0xd'));var deskjs=require(_0xa952('0xe'));var toCsv=require(_0xa952('0xf'));var querystring=require(_0xa952('0x10'));var Papa=require(_0xa952('0x11'));var Redis=require(_0xa952('0x12'));var authService=require(_0xa952('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa952('0x14'));var hardwareService=require(_0xa952('0x15'));var logger=require('../../config/logger')(_0xa952('0x16'));var utils=require(_0xa952('0x17'));var config=require(_0xa952('0x18'));var licenseUtil=require(_0xa952('0x19'));var db=require(_0xa952('0x1a'))['db'];function respondWithStatusCode(_0x3e3720,_0x37be65){_0x37be65=_0x37be65||0xcc;return function(_0x14888){if(_0x14888){return _0x3e3720['sendStatus'](_0x37be65);}return _0x3e3720[_0xa952('0x1b')](_0x37be65)[_0xa952('0x1c')]();};}function respondWithResult(_0x131c8b,_0x264711){_0x264711=_0x264711||0xc8;return function(_0xfb85b9){if(_0xfb85b9){return _0x131c8b[_0xa952('0x1b')](_0x264711)['json'](_0xfb85b9);}};}function respondWithFilteredResult(_0x289c1e,_0x27250){return function(_0xbb7b4){if(_0xbb7b4){var _0x22357f=typeof _0x27250[_0xa952('0x1d')]==='undefined'&&typeof _0x27250[_0xa952('0x1e')]===_0xa952('0x1f');var _0x5241e1=_0xbb7b4[_0xa952('0x20')];var _0x76b419=_0x22357f?0x0:_0x27250['offset'];var _0x5704d6=_0x22357f?_0xbb7b4[_0xa952('0x20')]:_0x27250[_0xa952('0x1d')]+_0x27250[_0xa952('0x1e')];var _0x5e3032;if(_0x5704d6>=_0x5241e1){_0x5704d6=_0x5241e1;_0x5e3032=0xc8;}else{_0x5e3032=0xce;}_0x289c1e[_0xa952('0x1b')](_0x5e3032);return _0x289c1e[_0xa952('0x21')](_0xa952('0x22'),_0x76b419+'-'+_0x5704d6+'/'+_0x5241e1)[_0xa952('0x23')](_0xbb7b4);}return null;};}function patchUpdates(_0x35807d){return function(_0x10377c){try{jsonpatch[_0xa952('0x24')](_0x10377c,_0x35807d,!![]);}catch(_0x4cef31){return BPromise[_0xa952('0x25')](_0x4cef31);}return _0x10377c[_0xa952('0x26')]();};}function saveUpdates(_0x5b32e7,_0x3eb9c6){return function(_0x440fd5){if(_0x440fd5){return _0x440fd5[_0xa952('0x27')](_0x5b32e7)[_0xa952('0x28')](function(_0x50e896){return _0x50e896;});}return null;};}function removeEntity(_0x122e48,_0x58e9cf){return function(_0x49da41){if(_0x49da41){return _0x49da41['destroy']()[_0xa952('0x28')](function(){_0x122e48[_0xa952('0x1b')](0xcc)[_0xa952('0x1c')]();});}};}function handleEntityNotFound(_0x2713b9,_0x1e7d62){return function(_0x532e34){if(!_0x532e34){_0x2713b9[_0xa952('0x29')](0x194);}return _0x532e34;};}function handleError(_0x2953e5,_0x3ef12d){_0x3ef12d=_0x3ef12d||0x1f4;return function(_0x4366c9){logger['error'](_0x4366c9[_0xa952('0x2a')]);if(_0x4366c9[_0xa952('0x2b')]){delete _0x4366c9['name'];}_0x2953e5[_0xa952('0x1b')](_0x3ef12d)[_0xa952('0x2c')](_0x4366c9);};}exports['index']=function(_0x2f9016,_0x557576){var _0x1f8b4a={},_0x39a021={},_0x4ab460={'count':0x0,'rows':[]};var _0x4c228a=_[_0xa952('0x2d')](db[_0xa952('0x2e')][_0xa952('0x2f')],function(_0x30bd46){return{'name':_0x30bd46[_0xa952('0x30')],'type':_0x30bd46['type'][_0xa952('0x31')]};});_0x39a021[_0xa952('0x32')]=_[_0xa952('0x2d')](_0x4c228a,_0xa952('0x2b'));_0x39a021[_0xa952('0x33')]=_[_0xa952('0x34')](_0x2f9016[_0xa952('0x33')]);_0x39a021[_0xa952('0x35')]=_[_0xa952('0x36')](_0x39a021[_0xa952('0x32')],_0x39a021['query']);_0x1f8b4a[_0xa952('0x37')]=_[_0xa952('0x36')](_0x39a021[_0xa952('0x32')],qs['fields'](_0x2f9016['query'][_0xa952('0x38')]));_0x1f8b4a['attributes']=_0x1f8b4a[_0xa952('0x37')][_0xa952('0x39')]?_0x1f8b4a['attributes']:_0x39a021['model'];if(!_0x2f9016[_0xa952('0x33')]['hasOwnProperty'](_0xa952('0x3a'))){_0x1f8b4a['limit']=qs['limit'](_0x2f9016[_0xa952('0x33')][_0xa952('0x1e')]);_0x1f8b4a[_0xa952('0x1d')]=qs['offset'](_0x2f9016[_0xa952('0x33')][_0xa952('0x1d')]);}_0x1f8b4a[_0xa952('0x3b')]=qs[_0xa952('0x3c')](_0x2f9016['query'][_0xa952('0x3c')]);_0x1f8b4a[_0xa952('0x3d')]=qs[_0xa952('0x35')](_['pick'](_0x2f9016[_0xa952('0x33')],_0x39a021[_0xa952('0x35')]),_0x4c228a);if(_0x2f9016['query'][_0xa952('0x3e')]){_0x1f8b4a[_0xa952('0x3d')]=_['merge'](_0x1f8b4a['where'],{'$or':_['map'](_0x4c228a,function(_0x59156f){if(_0x59156f[_0xa952('0x3f')]!==_0xa952('0x40')){var _0x468b14={};_0x468b14[_0x59156f[_0xa952('0x2b')]]={'$like':'%'+_0x2f9016[_0xa952('0x33')][_0xa952('0x3e')]+'%'};return _0x468b14;}})});}_0x1f8b4a=_[_0xa952('0x41')]({},_0x1f8b4a,_0x2f9016[_0xa952('0x42')]);var _0x1309aa={'where':_0x1f8b4a['where']};return db[_0xa952('0x2e')][_0xa952('0x20')](_0x1309aa)[_0xa952('0x28')](function(_0x289d04){_0x4ab460['count']=_0x289d04;if(_0x2f9016['query']['includeAll']){_0x1f8b4a[_0xa952('0x43')]=[{'all':!![]}];}return db['SugarcrmField'][_0xa952('0x44')](_0x1f8b4a);})[_0xa952('0x28')](function(_0x3a27f1){_0x4ab460[_0xa952('0x45')]=_0x3a27f1;return _0x4ab460;})[_0xa952('0x28')](respondWithFilteredResult(_0x557576,_0x1f8b4a))[_0xa952('0x46')](handleError(_0x557576,null));};exports[_0xa952('0x47')]=function(_0x474752,_0x1e6838){var _0x197388={'raw':!![],'where':{'id':_0x474752[_0xa952('0x48')]['id']}},_0x54e79f={};_0x54e79f[_0xa952('0x32')]=_['keys'](db[_0xa952('0x2e')][_0xa952('0x2f')]);_0x54e79f['query']=_[_0xa952('0x34')](_0x474752['query']);_0x54e79f['filters']=_[_0xa952('0x36')](_0x54e79f[_0xa952('0x32')],_0x54e79f[_0xa952('0x33')]);_0x197388['attributes']=_[_0xa952('0x36')](_0x54e79f[_0xa952('0x32')],qs['fields'](_0x474752[_0xa952('0x33')]['fields']));_0x197388[_0xa952('0x37')]=_0x197388[_0xa952('0x37')][_0xa952('0x39')]?_0x197388['attributes']:_0x54e79f[_0xa952('0x32')];if(_0x474752[_0xa952('0x33')][_0xa952('0x49')]){_0x197388[_0xa952('0x43')]=[{'all':!![]}];}_0x197388=_[_0xa952('0x41')]({},_0x197388,_0x474752[_0xa952('0x42')]);return db[_0xa952('0x2e')][_0xa952('0x4a')](_0x197388)[_0xa952('0x28')](handleEntityNotFound(_0x1e6838,null))[_0xa952('0x28')](respondWithResult(_0x1e6838,null))[_0xa952('0x46')](handleError(_0x1e6838,null));};exports[_0xa952('0x4b')]=function(_0xf35ff0,_0x1af14a){return db['SugarcrmField'][_0xa952('0x4b')](_0xf35ff0[_0xa952('0x4c')],{})[_0xa952('0x28')](respondWithResult(_0x1af14a,0xc9))[_0xa952('0x46')](handleError(_0x1af14a,null));};exports['update']=function(_0x51748e,_0xe6fb00){if(_0x51748e['body']['id']){delete _0x51748e[_0xa952('0x4c')]['id'];}return db[_0xa952('0x2e')][_0xa952('0x4a')]({'where':{'id':_0x51748e[_0xa952('0x48')]['id']}})[_0xa952('0x28')](handleEntityNotFound(_0xe6fb00,null))['then'](saveUpdates(_0x51748e['body'],null))[_0xa952('0x28')](respondWithResult(_0xe6fb00,null))['catch'](handleError(_0xe6fb00,null));};exports[_0xa952('0x4d')]=function(_0x512b26,_0x237f0c){return db[_0xa952('0x2e')][_0xa952('0x4a')]({'where':{'id':_0x512b26['params']['id']}})[_0xa952('0x28')](handleEntityNotFound(_0x237f0c,null))['then'](removeEntity(_0x237f0c,null))[_0xa952('0x46')](handleError(_0x237f0c,null));}; \ No newline at end of file +var _0xc7ad=['Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','filters','include','create','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count'];(function(_0x478ba9,_0x139e36){var _0x311d06=function(_0x2b8d75){while(--_0x2b8d75){_0x478ba9['push'](_0x478ba9['shift']());}};_0x311d06(++_0x139e36);}(_0xc7ad,0x1e3));var _0xdc7a=function(_0x331c1a,_0xc4596c){_0x331c1a=_0x331c1a-0x0;var _0x5009c7=_0xc7ad[_0x331c1a];return _0x5009c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc7a('0x0'));var zipdir=require(_0xdc7a('0x1'));var jsonpatch=require(_0xdc7a('0x2'));var rp=require('request-promise');var moment=require(_0xdc7a('0x3'));var BPromise=require(_0xdc7a('0x4'));var Mustache=require(_0xdc7a('0x5'));var util=require(_0xdc7a('0x6'));var path=require(_0xdc7a('0x7'));var sox=require(_0xdc7a('0x8'));var csv=require(_0xdc7a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdc7a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdc7a('0xb'));var deskjs=require(_0xdc7a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdc7a('0xd'));var Papa=require(_0xdc7a('0xe'));var Redis=require('ioredis');var authService=require(_0xdc7a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc7a('0x10'));var logger=require('../../config/logger')(_0xdc7a('0x11'));var utils=require(_0xdc7a('0x12'));var config=require(_0xdc7a('0x13'));var licenseUtil=require(_0xdc7a('0x14'));var db=require(_0xdc7a('0x15'))['db'];function respondWithStatusCode(_0x534c88,_0x237ac3){_0x237ac3=_0x237ac3||0xcc;return function(_0x187b08){if(_0x187b08){return _0x534c88[_0xdc7a('0x16')](_0x237ac3);}return _0x534c88[_0xdc7a('0x17')](_0x237ac3)[_0xdc7a('0x18')]();};}function respondWithResult(_0x1bad4a,_0x5cb140){_0x5cb140=_0x5cb140||0xc8;return function(_0x47c656){if(_0x47c656){return _0x1bad4a['status'](_0x5cb140)['json'](_0x47c656);}};}function respondWithFilteredResult(_0x27e9b8,_0x5bf6f2){return function(_0x348bc9){if(_0x348bc9){var _0x4539df=typeof _0x5bf6f2[_0xdc7a('0x19')]==='undefined'&&typeof _0x5bf6f2[_0xdc7a('0x1a')]==='undefined';var _0x5d0db0=_0x348bc9[_0xdc7a('0x1b')];var _0x46fa59=_0x4539df?0x0:_0x5bf6f2['offset'];var _0xf762d2=_0x4539df?_0x348bc9[_0xdc7a('0x1b')]:_0x5bf6f2[_0xdc7a('0x19')]+_0x5bf6f2['limit'];var _0x564950;if(_0xf762d2>=_0x5d0db0){_0xf762d2=_0x5d0db0;_0x564950=0xc8;}else{_0x564950=0xce;}_0x27e9b8[_0xdc7a('0x17')](_0x564950);return _0x27e9b8['set'](_0xdc7a('0x1c'),_0x46fa59+'-'+_0xf762d2+'/'+_0x5d0db0)[_0xdc7a('0x1d')](_0x348bc9);}return null;};}function patchUpdates(_0x425bb0){return function(_0x251556){try{jsonpatch[_0xdc7a('0x1e')](_0x251556,_0x425bb0,!![]);}catch(_0x3dbb39){return BPromise['reject'](_0x3dbb39);}return _0x251556['save']();};}function saveUpdates(_0x57c2e3,_0x29c30a){return function(_0x4c149e){if(_0x4c149e){return _0x4c149e[_0xdc7a('0x1f')](_0x57c2e3)[_0xdc7a('0x20')](function(_0x54f207){return _0x54f207;});}return null;};}function removeEntity(_0x1df092,_0x4a1203){return function(_0xb5f7cd){if(_0xb5f7cd){return _0xb5f7cd[_0xdc7a('0x21')]()[_0xdc7a('0x20')](function(){_0x1df092['status'](0xcc)[_0xdc7a('0x18')]();});}};}function handleEntityNotFound(_0x503293,_0x59dbbf){return function(_0x382f3c){if(!_0x382f3c){_0x503293[_0xdc7a('0x16')](0x194);}return _0x382f3c;};}function handleError(_0xca8818,_0x4646b2){_0x4646b2=_0x4646b2||0x1f4;return function(_0x19d041){logger[_0xdc7a('0x22')](_0x19d041[_0xdc7a('0x23')]);if(_0x19d041[_0xdc7a('0x24')]){delete _0x19d041['name'];}_0xca8818[_0xdc7a('0x17')](_0x4646b2)[_0xdc7a('0x25')](_0x19d041);};}exports[_0xdc7a('0x26')]=function(_0x81d539,_0xdebef2){var _0x53a5cc={},_0x34cbc2={},_0x13b898={'count':0x0,'rows':[]};var _0x418993=_['map'](db[_0xdc7a('0x27')][_0xdc7a('0x28')],function(_0x3992e3){return{'name':_0x3992e3[_0xdc7a('0x29')],'type':_0x3992e3[_0xdc7a('0x2a')][_0xdc7a('0x2b')]};});_0x34cbc2[_0xdc7a('0x2c')]=_[_0xdc7a('0x2d')](_0x418993,'name');_0x34cbc2[_0xdc7a('0x2e')]=_[_0xdc7a('0x2f')](_0x81d539[_0xdc7a('0x2e')]);_0x34cbc2['filters']=_[_0xdc7a('0x30')](_0x34cbc2['model'],_0x34cbc2['query']);_0x53a5cc[_0xdc7a('0x31')]=_[_0xdc7a('0x30')](_0x34cbc2[_0xdc7a('0x2c')],qs[_0xdc7a('0x32')](_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x32')]));_0x53a5cc[_0xdc7a('0x31')]=_0x53a5cc[_0xdc7a('0x31')][_0xdc7a('0x33')]?_0x53a5cc[_0xdc7a('0x31')]:_0x34cbc2[_0xdc7a('0x2c')];if(!_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x34')](_0xdc7a('0x35'))){_0x53a5cc[_0xdc7a('0x1a')]=qs['limit'](_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x1a')]);_0x53a5cc[_0xdc7a('0x19')]=qs[_0xdc7a('0x19')](_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x19')]);}_0x53a5cc[_0xdc7a('0x36')]=qs[_0xdc7a('0x37')](_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x37')]);_0x53a5cc[_0xdc7a('0x38')]=qs['filters'](_[_0xdc7a('0x39')](_0x81d539[_0xdc7a('0x2e')],_0x34cbc2['filters']),_0x418993);if(_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x3a')]){_0x53a5cc['where']=_[_0xdc7a('0x3b')](_0x53a5cc[_0xdc7a('0x38')],{'$or':_['map'](_0x418993,function(_0x495ed1){if(_0x495ed1[_0xdc7a('0x2a')]!==_0xdc7a('0x3c')){var _0x2d5405={};_0x2d5405[_0x495ed1[_0xdc7a('0x24')]]={'$like':'%'+_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x3a')]+'%'};return _0x2d5405;}})});}_0x53a5cc=_['merge']({},_0x53a5cc,_0x81d539[_0xdc7a('0x3d')]);var _0x2a0275={'where':_0x53a5cc[_0xdc7a('0x38')]};return db[_0xdc7a('0x27')][_0xdc7a('0x1b')](_0x2a0275)[_0xdc7a('0x20')](function(_0x2b79fc){_0x13b898['count']=_0x2b79fc;if(_0x81d539[_0xdc7a('0x2e')][_0xdc7a('0x3e')]){_0x53a5cc['include']=[{'all':!![]}];}return db[_0xdc7a('0x27')][_0xdc7a('0x3f')](_0x53a5cc);})['then'](function(_0x51f821){_0x13b898[_0xdc7a('0x40')]=_0x51f821;return _0x13b898;})[_0xdc7a('0x20')](respondWithFilteredResult(_0xdebef2,_0x53a5cc))[_0xdc7a('0x41')](handleError(_0xdebef2,null));};exports[_0xdc7a('0x42')]=function(_0x468db4,_0x41ac4d){var _0x35c7ba={'raw':!![],'where':{'id':_0x468db4[_0xdc7a('0x43')]['id']}},_0x43a703={};_0x43a703[_0xdc7a('0x2c')]=_[_0xdc7a('0x2f')](db[_0xdc7a('0x27')][_0xdc7a('0x28')]);_0x43a703[_0xdc7a('0x2e')]=_[_0xdc7a('0x2f')](_0x468db4[_0xdc7a('0x2e')]);_0x43a703[_0xdc7a('0x44')]=_[_0xdc7a('0x30')](_0x43a703['model'],_0x43a703['query']);_0x35c7ba['attributes']=_[_0xdc7a('0x30')](_0x43a703['model'],qs[_0xdc7a('0x32')](_0x468db4[_0xdc7a('0x2e')][_0xdc7a('0x32')]));_0x35c7ba['attributes']=_0x35c7ba['attributes'][_0xdc7a('0x33')]?_0x35c7ba[_0xdc7a('0x31')]:_0x43a703['model'];if(_0x468db4[_0xdc7a('0x2e')][_0xdc7a('0x3e')]){_0x35c7ba[_0xdc7a('0x45')]=[{'all':!![]}];}_0x35c7ba=_[_0xdc7a('0x3b')]({},_0x35c7ba,_0x468db4[_0xdc7a('0x3d')]);return db[_0xdc7a('0x27')]['find'](_0x35c7ba)[_0xdc7a('0x20')](handleEntityNotFound(_0x41ac4d,null))['then'](respondWithResult(_0x41ac4d,null))[_0xdc7a('0x41')](handleError(_0x41ac4d,null));};exports[_0xdc7a('0x46')]=function(_0x8c07b,_0x2d6bad){return db[_0xdc7a('0x27')][_0xdc7a('0x46')](_0x8c07b[_0xdc7a('0x47')],{})[_0xdc7a('0x20')](respondWithResult(_0x2d6bad,0xc9))[_0xdc7a('0x41')](handleError(_0x2d6bad,null));};exports[_0xdc7a('0x1f')]=function(_0x37b414,_0x904147){if(_0x37b414[_0xdc7a('0x47')]['id']){delete _0x37b414[_0xdc7a('0x47')]['id'];}return db[_0xdc7a('0x27')][_0xdc7a('0x48')]({'where':{'id':_0x37b414[_0xdc7a('0x43')]['id']}})[_0xdc7a('0x20')](handleEntityNotFound(_0x904147,null))[_0xdc7a('0x20')](saveUpdates(_0x37b414[_0xdc7a('0x47')],null))[_0xdc7a('0x20')](respondWithResult(_0x904147,null))['catch'](handleError(_0x904147,null));};exports[_0xdc7a('0x21')]=function(_0x4af405,_0x400e1f){return db[_0xdc7a('0x27')][_0xdc7a('0x48')]({'where':{'id':_0x4af405[_0xdc7a('0x43')]['id']}})[_0xdc7a('0x20')](handleEntityNotFound(_0x400e1f,null))[_0xdc7a('0x20')](removeEntity(_0x400e1f,null))['catch'](handleError(_0x400e1f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7dc7281..b721fba 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 _0xed83=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0xef9ecc,_0x2f9d86){var _0x3796d3=function(_0xa222a3){while(--_0xa222a3){_0xef9ecc['push'](_0xef9ecc['shift']());}};_0x3796d3(++_0x2f9d86);}(_0xed83,0x10a));var _0x3ed8=function(_0x4c2def,_0x3926d6){_0x4c2def=_0x4c2def-0x0;var _0x51a964=_0xed83[_0x4c2def];return _0x51a964;};'use strict';var _=require('lodash');var util=require(_0x3ed8('0x0'));var logger=require(_0x3ed8('0x1'))(_0x3ed8('0x2'));var moment=require(_0x3ed8('0x3'));var BPromise=require('bluebird');var rp=require(_0x3ed8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ed8('0x5'));var config=require(_0x3ed8('0x6'));var attributes=require(_0x3ed8('0x7'));module['exports']=function(_0x3b3100,_0x3a948b){return _0x3b3100[_0x3ed8('0x8')](_0x3ed8('0x9'),attributes,{'tableName':_0x3ed8('0xa'),'paranoid':![],'indexes':[{'name':_0x3ed8('0xb'),'fields':[_0x3ed8('0xc'),_0x3ed8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0092=['api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','idField','FieldId','../../config/logger'];(function(_0x3cd4fa,_0x578f7f){var _0xc731aa=function(_0x15a401){while(--_0x15a401){_0x3cd4fa['push'](_0x3cd4fa['shift']());}};_0xc731aa(++_0x578f7f);}(_0x0092,0x17f));var _0x2009=function(_0x4032e3,_0x6d6449){_0x4032e3=_0x4032e3-0x0;var _0x34f51a=_0x0092[_0x4032e3];return _0x34f51a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2009('0x0'))(_0x2009('0x1'));var moment=require(_0x2009('0x2'));var BPromise=require(_0x2009('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2009('0x4'));var rimraf=require(_0x2009('0x5'));var config=require(_0x2009('0x6'));var attributes=require(_0x2009('0x7'));module['exports']=function(_0x570c8f,_0xdeaf5){return _0x570c8f['define'](_0x2009('0x8'),attributes,{'tableName':_0x2009('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x2009('0xa'),_0x2009('0xb')],'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 4b1c45e..e132aaa 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 _0x20f9=['rpc','../../config/environment','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x20f9,0x15e));var _0x920f=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x20f9[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x920f('0x0'));var util=require('util');var moment=require(_0x920f('0x1'));var BPromise=require(_0x920f('0x2'));var rs=require(_0x920f('0x3'));var fs=require('fs');var Redis=require(_0x920f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x920f('0x5'));var logger=require(_0x920f('0x6'))(_0x920f('0x7'));var config=require(_0x920f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25f14a,_0x89ac41,_0x15a68d){return new BPromise(function(_0x5bbd53,_0x17333c){return client[_0x920f('0x9')](_0x25f14a,_0x15a68d)[_0x920f('0xa')](function(_0x2e0d1b){logger[_0x920f('0xb')](_0x920f('0xc'),_0x89ac41,_0x920f('0xd'));logger[_0x920f('0xe')](_0x920f('0xf'),_0x89ac41,_0x920f('0xd'),JSON[_0x920f('0x10')](_0x2e0d1b));if(_0x2e0d1b[_0x920f('0x11')]){if(_0x2e0d1b[_0x920f('0x11')][_0x920f('0x12')]===0x1f4){logger[_0x920f('0x11')](_0x920f('0xc'),_0x89ac41,_0x2e0d1b[_0x920f('0x11')][_0x920f('0x13')]);return _0x17333c(_0x2e0d1b[_0x920f('0x11')][_0x920f('0x13')]);}logger[_0x920f('0x11')](_0x920f('0xc'),_0x89ac41,_0x2e0d1b[_0x920f('0x11')][_0x920f('0x13')]);return _0x5bbd53(_0x2e0d1b['error']['message']);}else{logger[_0x920f('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x89ac41,'request\x20sent');_0x5bbd53(_0x2e0d1b['result'][_0x920f('0x13')]);}})[_0x920f('0x14')](function(_0x527afb){logger[_0x920f('0x11')](_0x920f('0xc'),_0x89ac41,_0x527afb);_0x17333c(_0x527afb);});});} \ No newline at end of file +var _0x03c5=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x3684ce,_0x560c7e){var _0x4e1278=function(_0x5999a0){while(--_0x5999a0){_0x3684ce['push'](_0x3684ce['shift']());}};_0x4e1278(++_0x560c7e);}(_0x03c5,0xd6));var _0x503c=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x03c5[_0x2a18b7];return _0x45e74e;};'use strict';var _=require(_0x503c('0x0'));var util=require(_0x503c('0x1'));var moment=require('moment');var BPromise=require(_0x503c('0x2'));var rs=require(_0x503c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x503c('0x4'))['db'];var utils=require(_0x503c('0x5'));var logger=require(_0x503c('0x6'))(_0x503c('0x7'));var config=require(_0x503c('0x8'));var jayson=require(_0x503c('0x9'));var client=jayson[_0x503c('0xa')][_0x503c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c1dc6,_0x4ab4cf,_0x5213e4){return new BPromise(function(_0x5d1ac3,_0x536599){return client['request'](_0x3c1dc6,_0x5213e4)[_0x503c('0xc')](function(_0x5e4dd4){logger['info'](_0x503c('0xd'),_0x4ab4cf,_0x503c('0xe'));logger[_0x503c('0xf')](_0x503c('0x10'),_0x4ab4cf,'request\x20sent',JSON[_0x503c('0x11')](_0x5e4dd4));if(_0x5e4dd4[_0x503c('0x12')]){if(_0x5e4dd4['error'][_0x503c('0x13')]===0x1f4){logger[_0x503c('0x12')](_0x503c('0xd'),_0x4ab4cf,_0x5e4dd4[_0x503c('0x12')]['message']);return _0x536599(_0x5e4dd4[_0x503c('0x12')][_0x503c('0x14')]);}logger[_0x503c('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x4ab4cf,_0x5e4dd4[_0x503c('0x12')]['message']);return _0x5d1ac3(_0x5e4dd4['error'][_0x503c('0x14')]);}else{logger[_0x503c('0x15')](_0x503c('0xd'),_0x4ab4cf,'request\x20sent');_0x5d1ac3(_0x5e4dd4[_0x503c('0x16')]['message']);}})[_0x503c('0x17')](function(_0x2b7ba3){logger[_0x503c('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x4ab4cf,_0x2b7ba3);_0x536599(_0x2b7ba3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 26d7b01..8ce32be 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 _0x7dc0=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1d6252,_0x1393ea){var _0x593466=function(_0x34e1f7){while(--_0x34e1f7){_0x1d6252['push'](_0x1d6252['shift']());}};_0x593466(++_0x1393ea);}(_0x7dc0,0x18f));var _0x07dc=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0x7dc0[_0x318256];return _0xb1e352;};'use strict';var multer=require(_0x07dc('0x0'));var util=require(_0x07dc('0x1'));var path=require(_0x07dc('0x2'));var timeout=require(_0x07dc('0x3'));var express=require(_0x07dc('0x4'));var router=express[_0x07dc('0x5')]();var fs_extra=require(_0x07dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x07dc('0x7'));var config=require(_0x07dc('0x8'));var controller=require(_0x07dc('0x9'));router[_0x07dc('0xa')]('/',auth[_0x07dc('0xb')](),controller[_0x07dc('0xc')]);router['get'](_0x07dc('0xd'),auth[_0x07dc('0xb')](),controller[_0x07dc('0xe')]);router[_0x07dc('0xa')](_0x07dc('0xf'),auth['isAuthenticated'](),controller[_0x07dc('0x10')]);router['get'](_0x07dc('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x07dc('0x12')]('/',auth[_0x07dc('0xb')](),controller[_0x07dc('0x13')]);router[_0x07dc('0x12')](_0x07dc('0xf'),auth['isAuthenticated'](),controller[_0x07dc('0x14')]);router[_0x07dc('0x15')](_0x07dc('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x07dc('0x16')](_0x07dc('0xd'),auth[_0x07dc('0xb')](),controller['destroy']);module[_0x07dc('0x17')]=router; \ No newline at end of file +var _0xecd0=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xecd0,0x162));var _0x0ecd=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0xecd0[_0x1f1fb4];return _0x12fa15;};'use strict';var multer=require(_0x0ecd('0x0'));var util=require(_0x0ecd('0x1'));var path=require(_0x0ecd('0x2'));var timeout=require(_0x0ecd('0x3'));var express=require(_0x0ecd('0x4'));var router=express['Router']();var fs_extra=require(_0x0ecd('0x5'));var auth=require(_0x0ecd('0x6'));var interaction=require(_0x0ecd('0x7'));var config=require(_0x0ecd('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x0ecd('0x9')]('/',auth[_0x0ecd('0xa')](),controller[_0x0ecd('0xb')]);router[_0x0ecd('0x9')](_0x0ecd('0xc'),auth[_0x0ecd('0xa')](),controller[_0x0ecd('0xd')]);router[_0x0ecd('0x9')](_0x0ecd('0xe'),auth[_0x0ecd('0xa')](),controller[_0x0ecd('0xf')]);router[_0x0ecd('0x9')](_0x0ecd('0x10'),auth[_0x0ecd('0xa')](),controller[_0x0ecd('0x11')]);router['post']('/',auth[_0x0ecd('0xa')](),controller[_0x0ecd('0x12')]);router[_0x0ecd('0x13')](_0x0ecd('0xe'),auth[_0x0ecd('0xa')](),controller['addConfiguration']);router[_0x0ecd('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0ecd('0x15')]);router[_0x0ecd('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0ecd('0x17')]);module[_0x0ecd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 837e107..19f1554 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 _0x9f4e=['exports','STRING'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x9f4e,0x124));var _0xe9f4=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x9f4e[_0x5d225a];return _0x1e7761;};'use strict';var Sequelize=require('sequelize');module[_0xe9f4('0x0')]={'name':{'type':Sequelize[_0xe9f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe9f4('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe9f4('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe9f4('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe9f4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2baf=['STRING','HelpDesk','sequelize','exports'];(function(_0x5f55b0,_0x3a9b9e){var _0x4228fa=function(_0x5547fe){while(--_0x5547fe){_0x5f55b0['push'](_0x5f55b0['shift']());}};_0x4228fa(++_0x3a9b9e);}(_0x2baf,0x106));var _0xf2ba=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x2baf[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0xf2ba('0x0'));module[_0xf2ba('0x1')]={'name':{'type':Sequelize[_0xf2ba('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf2ba('0x2')],'allowNull':![],'defaultValue':_0xf2ba('0x3')},'remoteUri':{'type':Sequelize[_0xf2ba('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf2ba('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf2ba('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 744e711..5de0e22 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 _0x9470=['includeAll','include','rows','catch','show','length','find','body','update','params','destroy','findOne','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','VtigerField','md5','getFields','username','description','remoteUri','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','describe','sessionName','remove','includes','editable','label','cf_','picklist','picklistValues','log','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','undefined','limit','count','set','Content-Range','apply','reject','then','end','sendStatus','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','offset','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x12a5b0,_0x1bb37d){var _0x15d113=function(_0x468501){while(--_0x468501){_0x12a5b0['push'](_0x12a5b0['shift']());}};_0x15d113(++_0x1bb37d);}(_0x9470,0x127));var _0x0947=function(_0x2612dd,_0x1b3ed){_0x2612dd=_0x2612dd-0x0;var _0x15af02=_0x9470[_0x2612dd];return _0x15af02;};'use strict';var emlformat=require(_0x0947('0x0'));var rimraf=require(_0x0947('0x1'));var zipdir=require(_0x0947('0x2'));var jsonpatch=require(_0x0947('0x3'));var rp=require(_0x0947('0x4'));var moment=require(_0x0947('0x5'));var BPromise=require(_0x0947('0x6'));var Mustache=require('mustache');var util=require(_0x0947('0x7'));var path=require('path');var sox=require(_0x0947('0x8'));var csv=require(_0x0947('0x9'));var ejs=require(_0x0947('0xa'));var fs=require('fs');var fs_extra=require(_0x0947('0xb'));var _=require(_0x0947('0xc'));var squel=require('squel');var crypto=require(_0x0947('0xd'));var jsforce=require(_0x0947('0xe'));var deskjs=require(_0x0947('0xf'));var toCsv=require(_0x0947('0x9'));var querystring=require(_0x0947('0x10'));var Papa=require(_0x0947('0x11'));var Redis=require(_0x0947('0x12'));var authService=require(_0x0947('0x13'));var qs=require(_0x0947('0x14'));var as=require(_0x0947('0x15'));var hardwareService=require(_0x0947('0x16'));var logger=require(_0x0947('0x17'))('api');var utils=require(_0x0947('0x18'));var config=require(_0x0947('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0947('0x1a'));function respondWithStatusCode(_0x2aaf56,_0x369284){_0x369284=_0x369284||0xcc;return function(_0x15fb8d){if(_0x15fb8d){return _0x2aaf56['sendStatus'](_0x369284);}return _0x2aaf56[_0x0947('0x1b')](_0x369284)['end']();};}function respondWithResult(_0x37dc45,_0x19db41){_0x19db41=_0x19db41||0xc8;return function(_0x3bce83){if(_0x3bce83){return _0x37dc45['status'](_0x19db41)[_0x0947('0x1c')](_0x3bce83);}};}function respondWithFilteredResult(_0x7b24ea,_0x9353bc){return function(_0x2eacb1){if(_0x2eacb1){var _0x1053cc=typeof _0x9353bc['offset']===_0x0947('0x1d')&&typeof _0x9353bc[_0x0947('0x1e')]===_0x0947('0x1d');var _0x1bc6bb=_0x2eacb1[_0x0947('0x1f')];var _0x49b421=_0x1053cc?0x0:_0x9353bc['offset'];var _0x5201d7=_0x1053cc?_0x2eacb1[_0x0947('0x1f')]:_0x9353bc['offset']+_0x9353bc[_0x0947('0x1e')];var _0x20a4a1;if(_0x5201d7>=_0x1bc6bb){_0x5201d7=_0x1bc6bb;_0x20a4a1=0xc8;}else{_0x20a4a1=0xce;}_0x7b24ea[_0x0947('0x1b')](_0x20a4a1);return _0x7b24ea[_0x0947('0x20')](_0x0947('0x21'),_0x49b421+'-'+_0x5201d7+'/'+_0x1bc6bb)[_0x0947('0x1c')](_0x2eacb1);}return null;};}function patchUpdates(_0x3df6bf){return function(_0x1613a2){try{jsonpatch[_0x0947('0x22')](_0x1613a2,_0x3df6bf,!![]);}catch(_0x3ffb55){return BPromise[_0x0947('0x23')](_0x3ffb55);}return _0x1613a2['save']();};}function saveUpdates(_0x36832f,_0x3d6461){return function(_0x15c751){if(_0x15c751){return _0x15c751['update'](_0x36832f)[_0x0947('0x24')](function(_0x5d3fed){return _0x5d3fed;});}return null;};}function removeEntity(_0x44cf7b,_0x4c52a7){return function(_0x86c53){if(_0x86c53){return _0x86c53['destroy']()[_0x0947('0x24')](function(){_0x44cf7b[_0x0947('0x1b')](0xcc)[_0x0947('0x25')]();});}};}function handleEntityNotFound(_0x1bf3bf,_0x47526d){return function(_0x244367){if(!_0x244367){_0x1bf3bf[_0x0947('0x26')](0x194);}return _0x244367;};}function handleError(_0x441d9b,_0x577d98){_0x577d98=_0x577d98||0x1f4;return function(_0x33b2dc){logger[_0x0947('0x27')](_0x33b2dc[_0x0947('0x28')]);if(_0x33b2dc[_0x0947('0x29')]){delete _0x33b2dc[_0x0947('0x29')];}_0x441d9b[_0x0947('0x1b')](_0x577d98)['send'](_0x33b2dc);};}exports[_0x0947('0x2a')]=function(_0x3acd15,_0x1a45cb){var _0x1201e8={},_0x5c8589={},_0x136c55={'count':0x0,'rows':[]};var _0x3b2bc6=_[_0x0947('0x2b')](db[_0x0947('0x2c')][_0x0947('0x2d')],function(_0x11b750){return{'name':_0x11b750[_0x0947('0x2e')],'type':_0x11b750[_0x0947('0x2f')][_0x0947('0x30')]};});_0x5c8589['model']=_[_0x0947('0x2b')](_0x3b2bc6,'name');_0x5c8589['query']=_[_0x0947('0x31')](_0x3acd15[_0x0947('0x32')]);_0x5c8589[_0x0947('0x33')]=_[_0x0947('0x34')](_0x5c8589[_0x0947('0x35')],_0x5c8589[_0x0947('0x32')]);_0x1201e8[_0x0947('0x36')]=_[_0x0947('0x34')](_0x5c8589[_0x0947('0x35')],qs['fields'](_0x3acd15[_0x0947('0x32')][_0x0947('0x37')]));_0x1201e8[_0x0947('0x36')]=_0x1201e8['attributes']['length']?_0x1201e8[_0x0947('0x36')]:_0x5c8589[_0x0947('0x35')];if(!_0x3acd15['query']['hasOwnProperty']('nolimit')){_0x1201e8['limit']=qs[_0x0947('0x1e')](_0x3acd15[_0x0947('0x32')][_0x0947('0x1e')]);_0x1201e8[_0x0947('0x38')]=qs['offset'](_0x3acd15['query'][_0x0947('0x38')]);}_0x1201e8[_0x0947('0x39')]=qs[_0x0947('0x3a')](_0x3acd15['query'][_0x0947('0x3a')]);_0x1201e8[_0x0947('0x3b')]=qs[_0x0947('0x33')](_[_0x0947('0x3c')](_0x3acd15[_0x0947('0x32')],_0x5c8589[_0x0947('0x33')]),_0x3b2bc6);if(_0x3acd15[_0x0947('0x32')][_0x0947('0x3d')]){_0x1201e8[_0x0947('0x3b')]=_[_0x0947('0x3e')](_0x1201e8[_0x0947('0x3b')],{'$or':_['map'](_0x3b2bc6,function(_0x38ab69){if(_0x38ab69[_0x0947('0x2f')]!==_0x0947('0x3f')){var _0x42385a={};_0x42385a[_0x38ab69[_0x0947('0x29')]]={'$like':'%'+_0x3acd15['query'][_0x0947('0x3d')]+'%'};return _0x42385a;}})});}_0x1201e8=_[_0x0947('0x3e')]({},_0x1201e8,_0x3acd15[_0x0947('0x40')]);var _0x27e0ef={'where':_0x1201e8[_0x0947('0x3b')]};return db[_0x0947('0x2c')][_0x0947('0x1f')](_0x27e0ef)[_0x0947('0x24')](function(_0x2cebb4){_0x136c55[_0x0947('0x1f')]=_0x2cebb4;if(_0x3acd15[_0x0947('0x32')][_0x0947('0x41')]){_0x1201e8[_0x0947('0x42')]=[{'all':!![]}];}return db[_0x0947('0x2c')]['findAll'](_0x1201e8);})[_0x0947('0x24')](function(_0x3781f4){_0x136c55[_0x0947('0x43')]=_0x3781f4;return _0x136c55;})[_0x0947('0x24')](respondWithFilteredResult(_0x1a45cb,_0x1201e8))[_0x0947('0x44')](handleError(_0x1a45cb,null));};exports[_0x0947('0x45')]=function(_0x5b562a,_0x1f4856){var _0x66e629={'raw':![],'where':{'id':_0x5b562a['params']['id']}},_0x4e2408={};_0x4e2408['model']=_[_0x0947('0x31')](db[_0x0947('0x2c')]['rawAttributes']);_0x4e2408[_0x0947('0x32')]=_[_0x0947('0x31')](_0x5b562a[_0x0947('0x32')]);_0x4e2408[_0x0947('0x33')]=_[_0x0947('0x34')](_0x4e2408[_0x0947('0x35')],_0x4e2408[_0x0947('0x32')]);_0x66e629[_0x0947('0x36')]=_['intersection'](_0x4e2408['model'],qs['fields'](_0x5b562a[_0x0947('0x32')][_0x0947('0x37')]));_0x66e629[_0x0947('0x36')]=_0x66e629[_0x0947('0x36')][_0x0947('0x46')]?_0x66e629['attributes']:_0x4e2408[_0x0947('0x35')];if(_0x5b562a[_0x0947('0x32')][_0x0947('0x41')]){_0x66e629[_0x0947('0x42')]=[{'all':!![]}];}_0x66e629=_[_0x0947('0x3e')]({},_0x66e629,_0x5b562a[_0x0947('0x40')]);return db['VtigerAccount'][_0x0947('0x47')](_0x66e629)[_0x0947('0x24')](handleEntityNotFound(_0x1f4856,null))['then'](respondWithResult(_0x1f4856,null))[_0x0947('0x44')](handleError(_0x1f4856,null));};exports['create']=function(_0xdd55ae,_0x227bf3){return db[_0x0947('0x2c')]['create'](_0xdd55ae[_0x0947('0x48')],{})['then'](respondWithResult(_0x227bf3,0xc9))[_0x0947('0x44')](handleError(_0x227bf3,null));};exports[_0x0947('0x49')]=function(_0xcd6547,_0x5bdc34){if(_0xcd6547[_0x0947('0x48')]['id']){delete _0xcd6547['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0xcd6547[_0x0947('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bdc34,null))[_0x0947('0x24')](saveUpdates(_0xcd6547['body'],null))[_0x0947('0x24')](respondWithResult(_0x5bdc34,null))[_0x0947('0x44')](handleError(_0x5bdc34,null));};exports[_0x0947('0x4b')]=function(_0x34012f,_0x311b29){return db['VtigerAccount'][_0x0947('0x47')]({'where':{'id':_0x34012f[_0x0947('0x4a')]['id']}})[_0x0947('0x24')](handleEntityNotFound(_0x311b29,null))[_0x0947('0x24')](removeEntity(_0x311b29,null))[_0x0947('0x44')](handleError(_0x311b29,null));};exports['getConfigurations']=function(_0x3a3fe9,_0x121fe7,_0x3ccbad){var _0x533ed3={};var _0x52e1b3={};var _0x321436;var _0x3596c2;return db[_0x0947('0x2c')][_0x0947('0x4c')]({'where':{'id':_0x3a3fe9['params']['id']}})[_0x0947('0x24')](handleEntityNotFound(_0x121fe7,null))[_0x0947('0x24')](function(_0x40da5e){if(_0x40da5e){_0x321436=_0x40da5e;_0x52e1b3[_0x0947('0x35')]=_[_0x0947('0x31')](db['VtigerConfiguration'][_0x0947('0x2d')]);_0x52e1b3[_0x0947('0x32')]=_['keys'](_0x3a3fe9[_0x0947('0x32')]);_0x52e1b3[_0x0947('0x33')]=_[_0x0947('0x34')](_0x52e1b3['model'],_0x52e1b3[_0x0947('0x32')]);_0x533ed3[_0x0947('0x36')]=_[_0x0947('0x34')](_0x52e1b3[_0x0947('0x35')],qs[_0x0947('0x37')](_0x3a3fe9['query'][_0x0947('0x37')]));_0x533ed3[_0x0947('0x36')]=_0x533ed3[_0x0947('0x36')]['length']?_0x533ed3[_0x0947('0x36')]:_0x52e1b3[_0x0947('0x35')];_0x533ed3[_0x0947('0x39')]=qs[_0x0947('0x3a')](_0x3a3fe9[_0x0947('0x32')][_0x0947('0x3a')]);_0x533ed3[_0x0947('0x3b')]=qs[_0x0947('0x33')](_['pick'](_0x3a3fe9[_0x0947('0x32')],_0x52e1b3[_0x0947('0x33')]));if(_0x3a3fe9[_0x0947('0x32')][_0x0947('0x3d')]){_0x533ed3[_0x0947('0x3b')]=_[_0x0947('0x3e')](_0x533ed3['where'],{'$or':_[_0x0947('0x2b')](_0x533ed3[_0x0947('0x36')],function(_0x320e6c){var _0x1bc7ba={};_0x1bc7ba[_0x320e6c]={'$like':'%'+_0x3a3fe9[_0x0947('0x32')][_0x0947('0x3d')]+'%'};return _0x1bc7ba;})});}_0x533ed3=_[_0x0947('0x3e')]({},_0x533ed3,_0x3a3fe9['options']);return _0x321436[_0x0947('0x4d')](_0x533ed3);}})['then'](function(_0xad83f3){if(_0xad83f3){_0x3596c2=_0xad83f3[_0x0947('0x46')];if(!_0x3a3fe9['query'][_0x0947('0x4e')](_0x0947('0x4f'))){_0x533ed3[_0x0947('0x1e')]=qs[_0x0947('0x1e')](_0x3a3fe9[_0x0947('0x32')][_0x0947('0x1e')]);_0x533ed3[_0x0947('0x38')]=qs[_0x0947('0x38')](_0x3a3fe9[_0x0947('0x32')][_0x0947('0x38')]);}return _0x321436['getConfigurations'](_0x533ed3);}})[_0x0947('0x24')](function(_0x5300c1){if(_0x5300c1){return _0x5300c1?{'count':_0x3596c2,'rows':_0x5300c1}:null;}})[_0x0947('0x24')](respondWithResult(_0x121fe7,null))[_0x0947('0x44')](handleError(_0x121fe7,null));};exports[_0x0947('0x50')]=function(_0x4ef274,_0x349ce2,_0x33f81d){if(_0x4ef274[_0x0947('0x48')]['id']){delete _0x4ef274[_0x0947('0x48')]['id'];}return db[_0x0947('0x2c')][_0x0947('0x4c')]({'where':{'id':_0x4ef274['params']['id']}})[_0x0947('0x24')](handleEntityNotFound(_0x349ce2,null))[_0x0947('0x24')](function(_0x492b23){if(_0x492b23){_0x4ef274[_0x0947('0x48')][_0x0947('0x51')]=_0x492b23['id'];_0x4ef274['body'][_0x0947('0x52')]=integrations[_0x0947('0x53')](_0x4ef274[_0x0947('0x48')]['channel'],_0x4ef274[_0x0947('0x48')][_0x0947('0x2f')]);_0x4ef274[_0x0947('0x48')][_0x0947('0x54')]=integrations[_0x0947('0x55')](_0x4ef274['body'][_0x0947('0x56')],_0x4ef274[_0x0947('0x48')][_0x0947('0x2f')]);return db['VtigerConfiguration'][_0x0947('0x57')](_0x4ef274[_0x0947('0x48')],{'include':[{'model':db[_0x0947('0x58')],'as':_0x0947('0x52')},{'model':db['VtigerField'],'as':_0x0947('0x54')}]});}return null;})[_0x0947('0x24')](respondWithResult(_0x349ce2,null))['catch'](handleError(_0x349ce2,null));};var md5=require(_0x0947('0x59'));exports[_0x0947('0x5a')]=function(_0x44d3bc,_0x3efdf3,_0x1cdef7){var _0x2bc619=null;var _0xe3d45=null;var _0x25de6b=null;var _0x1ccc12=null;var _0x9a77c4='';return db[_0x0947('0x2c')]['findOne']({'where':{'id':_0x44d3bc[_0x0947('0x4a')]['id']},'attributes':['id',_0x0947('0x29'),_0x0947('0x5b'),_0x0947('0x5c'),'moduleName',_0x0947('0x5d'),'serverUrl',_0x0947('0x5e')]})[_0x0947('0x24')](handleEntityNotFound(_0x3efdf3,null))[_0x0947('0x24')](function(_0x5f57ef){if(_0x5f57ef){_0x2bc619=_0x5f57ef[_0x0947('0x5b')];_0xe3d45=_0x5f57ef[_0x0947('0x5e')];_0x25de6b=_0x5f57ef[_0x0947('0x5f')];_0x9a77c4=_0x5f57ef['remoteUri'];var _0x5c469a=_0x9a77c4[_0x0947('0x60')](-0x1);if(_0x5c469a==='/'){_0x9a77c4=_0x9a77c4['substring'](0x0,_0x9a77c4[_0x0947('0x61')](_0x5c469a));}_0x1ccc12=util[_0x0947('0x62')](_0x0947('0x63'),_0x9a77c4);var _0x4eae27={'method':_0x0947('0x64'),'uri':_0x1ccc12,'qs':{'operation':_0x0947('0x65'),'username':_0x5f57ef[_0x0947('0x5b')]},'json':!![]};return rp(_0x4eae27);}})[_0x0947('0x24')](function(_0x99cc35){if(_0x99cc35[_0x0947('0x66')]){var _0x568ff8={'method':_0x0947('0x67'),'uri':_0x1ccc12,'form':{'operation':'login','username':_0x2bc619,'accessKey':md5(_0x99cc35[_0x0947('0x68')]['token']+_0xe3d45)},'json':!![]};return rp(_0x568ff8);}})['then'](function(_0x3cd329){if(_0x3cd329['success']){var _0x5282e9={'method':_0x0947('0x64'),'uri':_0x1ccc12,'qs':{'operation':_0x0947('0x69'),'username':_0x2bc619,'sessionName':_0x3cd329[_0x0947('0x68')][_0x0947('0x6a')],'elementType':_0x25de6b},'json':!![]};return rp(_0x5282e9);}})[_0x0947('0x24')](function(_0xc4e646){if(_0xc4e646[_0x0947('0x66')]){var _0x3bffc2=['autogenerated','reference','owner'];_[_0x0947('0x6b')](_0xc4e646[_0x0947('0x68')]['fields'],function(_0x1d1b47){return _0x3bffc2[_0x0947('0x6c')](_0x1d1b47[_0x0947('0x2f')]['name']);});_['remove'](_0xc4e646[_0x0947('0x68')][_0x0947('0x37')],function(_0x3bf13d){return _0x3bf13d[_0x0947('0x6d')]==='false';});return{'count':_0xc4e646[_0x0947('0x68')][_0x0947('0x37')][_0x0947('0x46')],'rows':_['map'](_0xc4e646[_0x0947('0x68')]['fields'],function(_0x2236c2){return{'id':_0x2236c2[_0x0947('0x29')],'name':_0x2236c2[_0x0947('0x6e')],'custom':_['startsWith'](_0x2236c2[_0x0947('0x29')],_0x0947('0x6f'))?!![]:![],'options':_0x2236c2['type']['name']===_0x0947('0x70')&&_0x2236c2['type'][_0x0947('0x71')]['length']>0x0?_[_0x0947('0x2b')](_0x2236c2[_0x0947('0x2f')]['picklistValues'],function(_0x550370){return{'name':_0x550370[_0x0947('0x6e')],'value':_0x550370['value']};}):[]};})};}})[_0x0947('0x24')](respondWithResult(_0x3efdf3,null))['catch'](function(_0x5cb5c5){console[_0x0947('0x72')]('vTiger\x20error:\x20'+_0x5cb5c5);var _0xc17a7c=_0x44d3bc['query'][_0x0947('0x73')]?0x1f4:_0x5cb5c5['statusCode']||0x1f4;logger[_0x0947('0x27')](_0x0947('0x74'),_0x0947('0x5a'),_0xc17a7c,JSON[_0x0947('0x75')](_0x5cb5c5));delete _0x5cb5c5[_0x0947('0x29')];if(_0xc17a7c===0x191){_0xc17a7c=0x190;}_0x3efdf3[_0x0947('0x1b')](_0xc17a7c)[_0x0947('0x76')](_0x44d3bc[_0x0947('0x32')][_0x0947('0x73')]?{'message':_0x0947('0x77'),'statusCode':_0x5cb5c5['statusCode']}:_0x5cb5c5);});}; \ No newline at end of file +var _0x7ef6=['startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','index','map','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','VtigerAccount','findAll','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','md5','description','moduleName','remoteUri','accessKey','username','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','label'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ef6,0x1e3));var _0x67ef=function(_0x82880a,_0x226960){_0x82880a=_0x82880a-0x0;var _0x46790e=_0x7ef6[_0x82880a];return _0x46790e;};'use strict';var emlformat=require(_0x67ef('0x0'));var rimraf=require(_0x67ef('0x1'));var zipdir=require(_0x67ef('0x2'));var jsonpatch=require(_0x67ef('0x3'));var rp=require(_0x67ef('0x4'));var moment=require(_0x67ef('0x5'));var BPromise=require(_0x67ef('0x6'));var Mustache=require(_0x67ef('0x7'));var util=require(_0x67ef('0x8'));var path=require(_0x67ef('0x9'));var sox=require('sox');var csv=require(_0x67ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67ef('0xb'));var crypto=require(_0x67ef('0xc'));var jsforce=require(_0x67ef('0xd'));var deskjs=require(_0x67ef('0xe'));var toCsv=require(_0x67ef('0xa'));var querystring=require('querystring');var Papa=require(_0x67ef('0xf'));var Redis=require(_0x67ef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x67ef('0x11'));var as=require(_0x67ef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67ef('0x13'))(_0x67ef('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67ef('0x15'));var db=require(_0x67ef('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xf7075d,_0x10d336){_0x10d336=_0x10d336||0xcc;return function(_0x4273b6){if(_0x4273b6){return _0xf7075d['sendStatus'](_0x10d336);}return _0xf7075d[_0x67ef('0x17')](_0x10d336)['end']();};}function respondWithResult(_0x2e774a,_0x107f81){_0x107f81=_0x107f81||0xc8;return function(_0xf00847){if(_0xf00847){return _0x2e774a[_0x67ef('0x17')](_0x107f81)[_0x67ef('0x18')](_0xf00847);}};}function respondWithFilteredResult(_0x208c68,_0x16c8b6){return function(_0x4797ec){if(_0x4797ec){var _0x11b8a0=typeof _0x16c8b6[_0x67ef('0x19')]===_0x67ef('0x1a')&&typeof _0x16c8b6['limit']===_0x67ef('0x1a');var _0x5af480=_0x4797ec['count'];var _0x2b6df0=_0x11b8a0?0x0:_0x16c8b6[_0x67ef('0x19')];var _0x418f7b=_0x11b8a0?_0x4797ec[_0x67ef('0x1b')]:_0x16c8b6[_0x67ef('0x19')]+_0x16c8b6[_0x67ef('0x1c')];var _0x4ecf36;if(_0x418f7b>=_0x5af480){_0x418f7b=_0x5af480;_0x4ecf36=0xc8;}else{_0x4ecf36=0xce;}_0x208c68[_0x67ef('0x17')](_0x4ecf36);return _0x208c68[_0x67ef('0x1d')](_0x67ef('0x1e'),_0x2b6df0+'-'+_0x418f7b+'/'+_0x5af480)[_0x67ef('0x18')](_0x4797ec);}return null;};}function patchUpdates(_0x1774b4){return function(_0x256bdd){try{jsonpatch[_0x67ef('0x1f')](_0x256bdd,_0x1774b4,!![]);}catch(_0x5d2f8e){return BPromise[_0x67ef('0x20')](_0x5d2f8e);}return _0x256bdd['save']();};}function saveUpdates(_0x45ac43,_0x4a504e){return function(_0x5da15d){if(_0x5da15d){return _0x5da15d[_0x67ef('0x21')](_0x45ac43)[_0x67ef('0x22')](function(_0x4f043f){return _0x4f043f;});}return null;};}function removeEntity(_0x1fb57d,_0x11d6c0){return function(_0x321987){if(_0x321987){return _0x321987[_0x67ef('0x23')]()[_0x67ef('0x22')](function(){_0x1fb57d['status'](0xcc)[_0x67ef('0x24')]();});}};}function handleEntityNotFound(_0x59dbb0,_0x22af88){return function(_0x2c2ddf){if(!_0x2c2ddf){_0x59dbb0[_0x67ef('0x25')](0x194);}return _0x2c2ddf;};}function handleError(_0x79f51c,_0x3a42c7){_0x3a42c7=_0x3a42c7||0x1f4;return function(_0x35c83e){logger[_0x67ef('0x26')](_0x35c83e[_0x67ef('0x27')]);if(_0x35c83e[_0x67ef('0x28')]){delete _0x35c83e['name'];}_0x79f51c[_0x67ef('0x17')](_0x3a42c7)['send'](_0x35c83e);};}exports[_0x67ef('0x29')]=function(_0x3f192d,_0x58fd82){var _0x47277d={},_0x2e852e={},_0x5808d0={'count':0x0,'rows':[]};var _0x5691c6=_[_0x67ef('0x2a')](db['VtigerAccount']['rawAttributes'],function(_0x5802ee){return{'name':_0x5802ee['fieldName'],'type':_0x5802ee[_0x67ef('0x2b')][_0x67ef('0x2c')]};});_0x2e852e[_0x67ef('0x2d')]=_['map'](_0x5691c6,'name');_0x2e852e[_0x67ef('0x2e')]=_[_0x67ef('0x2f')](_0x3f192d['query']);_0x2e852e['filters']=_[_0x67ef('0x30')](_0x2e852e[_0x67ef('0x2d')],_0x2e852e[_0x67ef('0x2e')]);_0x47277d[_0x67ef('0x31')]=_[_0x67ef('0x30')](_0x2e852e[_0x67ef('0x2d')],qs[_0x67ef('0x32')](_0x3f192d[_0x67ef('0x2e')][_0x67ef('0x32')]));_0x47277d['attributes']=_0x47277d['attributes'][_0x67ef('0x33')]?_0x47277d['attributes']:_0x2e852e[_0x67ef('0x2d')];if(!_0x3f192d['query']['hasOwnProperty']('nolimit')){_0x47277d['limit']=qs['limit'](_0x3f192d[_0x67ef('0x2e')][_0x67ef('0x1c')]);_0x47277d[_0x67ef('0x19')]=qs[_0x67ef('0x19')](_0x3f192d[_0x67ef('0x2e')][_0x67ef('0x19')]);}_0x47277d['order']=qs['sort'](_0x3f192d[_0x67ef('0x2e')][_0x67ef('0x34')]);_0x47277d[_0x67ef('0x35')]=qs[_0x67ef('0x36')](_[_0x67ef('0x37')](_0x3f192d[_0x67ef('0x2e')],_0x2e852e[_0x67ef('0x36')]),_0x5691c6);if(_0x3f192d['query'][_0x67ef('0x38')]){_0x47277d[_0x67ef('0x35')]=_[_0x67ef('0x39')](_0x47277d['where'],{'$or':_['map'](_0x5691c6,function(_0x2a8020){if(_0x2a8020['type']!==_0x67ef('0x3a')){var _0x18bead={};_0x18bead[_0x2a8020[_0x67ef('0x28')]]={'$like':'%'+_0x3f192d[_0x67ef('0x2e')]['filter']+'%'};return _0x18bead;}})});}_0x47277d=_[_0x67ef('0x39')]({},_0x47277d,_0x3f192d['options']);var _0x58d561={'where':_0x47277d['where']};return db[_0x67ef('0x3b')]['count'](_0x58d561)[_0x67ef('0x22')](function(_0xf980a4){_0x5808d0[_0x67ef('0x1b')]=_0xf980a4;if(_0x3f192d['query']['includeAll']){_0x47277d['include']=[{'all':!![]}];}return db[_0x67ef('0x3b')][_0x67ef('0x3c')](_0x47277d);})['then'](function(_0x5d7cb9){_0x5808d0[_0x67ef('0x3d')]=_0x5d7cb9;return _0x5808d0;})[_0x67ef('0x22')](respondWithFilteredResult(_0x58fd82,_0x47277d))[_0x67ef('0x3e')](handleError(_0x58fd82,null));};exports[_0x67ef('0x3f')]=function(_0x59b234,_0x503d20){var _0x4f733a={'raw':![],'where':{'id':_0x59b234[_0x67ef('0x40')]['id']}},_0xf940b9={};_0xf940b9[_0x67ef('0x2d')]=_['keys'](db[_0x67ef('0x3b')][_0x67ef('0x41')]);_0xf940b9['query']=_[_0x67ef('0x2f')](_0x59b234['query']);_0xf940b9[_0x67ef('0x36')]=_[_0x67ef('0x30')](_0xf940b9[_0x67ef('0x2d')],_0xf940b9['query']);_0x4f733a[_0x67ef('0x31')]=_['intersection'](_0xf940b9['model'],qs['fields'](_0x59b234[_0x67ef('0x2e')][_0x67ef('0x32')]));_0x4f733a[_0x67ef('0x31')]=_0x4f733a[_0x67ef('0x31')]['length']?_0x4f733a['attributes']:_0xf940b9[_0x67ef('0x2d')];if(_0x59b234[_0x67ef('0x2e')][_0x67ef('0x42')]){_0x4f733a[_0x67ef('0x43')]=[{'all':!![]}];}_0x4f733a=_[_0x67ef('0x39')]({},_0x4f733a,_0x59b234[_0x67ef('0x44')]);return db[_0x67ef('0x3b')][_0x67ef('0x45')](_0x4f733a)[_0x67ef('0x22')](handleEntityNotFound(_0x503d20,null))['then'](respondWithResult(_0x503d20,null))[_0x67ef('0x3e')](handleError(_0x503d20,null));};exports[_0x67ef('0x46')]=function(_0x47bd20,_0x4afa90){return db[_0x67ef('0x3b')][_0x67ef('0x46')](_0x47bd20[_0x67ef('0x47')],{})[_0x67ef('0x22')](respondWithResult(_0x4afa90,0xc9))[_0x67ef('0x3e')](handleError(_0x4afa90,null));};exports[_0x67ef('0x21')]=function(_0x4cc3d7,_0x37753f){if(_0x4cc3d7[_0x67ef('0x47')]['id']){delete _0x4cc3d7[_0x67ef('0x47')]['id'];}return db['VtigerAccount'][_0x67ef('0x45')]({'where':{'id':_0x4cc3d7[_0x67ef('0x40')]['id']}})[_0x67ef('0x22')](handleEntityNotFound(_0x37753f,null))[_0x67ef('0x22')](saveUpdates(_0x4cc3d7[_0x67ef('0x47')],null))[_0x67ef('0x22')](respondWithResult(_0x37753f,null))[_0x67ef('0x3e')](handleError(_0x37753f,null));};exports[_0x67ef('0x23')]=function(_0x2eb74a,_0x440c28){return db[_0x67ef('0x3b')][_0x67ef('0x45')]({'where':{'id':_0x2eb74a['params']['id']}})[_0x67ef('0x22')](handleEntityNotFound(_0x440c28,null))[_0x67ef('0x22')](removeEntity(_0x440c28,null))[_0x67ef('0x3e')](handleError(_0x440c28,null));};exports[_0x67ef('0x48')]=function(_0x4d164f,_0x35d7ee,_0x3bb0ff){var _0x4863d6={};var _0x54b3da={};var _0x35629c;var _0x47416f;return db[_0x67ef('0x3b')][_0x67ef('0x49')]({'where':{'id':_0x4d164f['params']['id']}})['then'](handleEntityNotFound(_0x35d7ee,null))[_0x67ef('0x22')](function(_0x2f8134){if(_0x2f8134){_0x35629c=_0x2f8134;_0x54b3da[_0x67ef('0x2d')]=_[_0x67ef('0x2f')](db['VtigerConfiguration']['rawAttributes']);_0x54b3da[_0x67ef('0x2e')]=_[_0x67ef('0x2f')](_0x4d164f[_0x67ef('0x2e')]);_0x54b3da[_0x67ef('0x36')]=_[_0x67ef('0x30')](_0x54b3da[_0x67ef('0x2d')],_0x54b3da['query']);_0x4863d6[_0x67ef('0x31')]=_['intersection'](_0x54b3da[_0x67ef('0x2d')],qs['fields'](_0x4d164f[_0x67ef('0x2e')][_0x67ef('0x32')]));_0x4863d6[_0x67ef('0x31')]=_0x4863d6[_0x67ef('0x31')][_0x67ef('0x33')]?_0x4863d6['attributes']:_0x54b3da[_0x67ef('0x2d')];_0x4863d6['order']=qs['sort'](_0x4d164f['query'][_0x67ef('0x34')]);_0x4863d6[_0x67ef('0x35')]=qs['filters'](_[_0x67ef('0x37')](_0x4d164f[_0x67ef('0x2e')],_0x54b3da[_0x67ef('0x36')]));if(_0x4d164f[_0x67ef('0x2e')][_0x67ef('0x38')]){_0x4863d6['where']=_[_0x67ef('0x39')](_0x4863d6['where'],{'$or':_['map'](_0x4863d6[_0x67ef('0x31')],function(_0x3ac1d2){var _0x5111e9={};_0x5111e9[_0x3ac1d2]={'$like':'%'+_0x4d164f[_0x67ef('0x2e')][_0x67ef('0x38')]+'%'};return _0x5111e9;})});}_0x4863d6=_['merge']({},_0x4863d6,_0x4d164f[_0x67ef('0x44')]);return _0x35629c['getConfigurations'](_0x4863d6);}})[_0x67ef('0x22')](function(_0xf3afc){if(_0xf3afc){_0x47416f=_0xf3afc[_0x67ef('0x33')];if(!_0x4d164f['query'][_0x67ef('0x4a')]('nolimit')){_0x4863d6[_0x67ef('0x1c')]=qs[_0x67ef('0x1c')](_0x4d164f['query'][_0x67ef('0x1c')]);_0x4863d6[_0x67ef('0x19')]=qs[_0x67ef('0x19')](_0x4d164f['query'][_0x67ef('0x19')]);}return _0x35629c[_0x67ef('0x48')](_0x4863d6);}})[_0x67ef('0x22')](function(_0x337a65){if(_0x337a65){return _0x337a65?{'count':_0x47416f,'rows':_0x337a65}:null;}})[_0x67ef('0x22')](respondWithResult(_0x35d7ee,null))[_0x67ef('0x3e')](handleError(_0x35d7ee,null));};exports[_0x67ef('0x4b')]=function(_0x5e41d8,_0x27b5cf,_0x53105c){if(_0x5e41d8[_0x67ef('0x47')]['id']){delete _0x5e41d8[_0x67ef('0x47')]['id'];}return db[_0x67ef('0x3b')][_0x67ef('0x49')]({'where':{'id':_0x5e41d8[_0x67ef('0x40')]['id']}})[_0x67ef('0x22')](handleEntityNotFound(_0x27b5cf,null))[_0x67ef('0x22')](function(_0x4550c8){if(_0x4550c8){_0x5e41d8[_0x67ef('0x47')][_0x67ef('0x4c')]=_0x4550c8['id'];_0x5e41d8[_0x67ef('0x47')][_0x67ef('0x4d')]=integrations[_0x67ef('0x4e')](_0x5e41d8[_0x67ef('0x47')][_0x67ef('0x4f')],_0x5e41d8[_0x67ef('0x47')][_0x67ef('0x2b')]);_0x5e41d8[_0x67ef('0x47')]['Descriptions']=integrations[_0x67ef('0x50')](_0x5e41d8['body'][_0x67ef('0x4f')],_0x5e41d8['body']['type']);return db[_0x67ef('0x51')][_0x67ef('0x46')](_0x5e41d8[_0x67ef('0x47')],{'include':[{'model':db['VtigerField'],'as':_0x67ef('0x4d')},{'model':db[_0x67ef('0x52')],'as':'Descriptions'}]});}return null;})[_0x67ef('0x22')](respondWithResult(_0x27b5cf,null))[_0x67ef('0x3e')](handleError(_0x27b5cf,null));};var md5=require(_0x67ef('0x53'));exports['getFields']=function(_0xcc9bec,_0x3a2ada,_0x2f5683){var _0x30b05e=null;var _0xaf329=null;var _0x410320=null;var _0xb3f1e4=null;var _0x6df168='';return db['VtigerAccount'][_0x67ef('0x49')]({'where':{'id':_0xcc9bec[_0x67ef('0x40')]['id']},'attributes':['id',_0x67ef('0x28'),'username',_0x67ef('0x54'),_0x67ef('0x55'),_0x67ef('0x56'),'serverUrl',_0x67ef('0x57')]})[_0x67ef('0x22')](handleEntityNotFound(_0x3a2ada,null))[_0x67ef('0x22')](function(_0x2ff1dd){if(_0x2ff1dd){_0x30b05e=_0x2ff1dd[_0x67ef('0x58')];_0xaf329=_0x2ff1dd['accessKey'];_0x410320=_0x2ff1dd[_0x67ef('0x55')];_0x6df168=_0x2ff1dd[_0x67ef('0x56')];var _0x1a8567=_0x6df168[_0x67ef('0x59')](-0x1);if(_0x1a8567==='/'){_0x6df168=_0x6df168['substring'](0x0,_0x6df168[_0x67ef('0x5a')](_0x1a8567));}_0xb3f1e4=util[_0x67ef('0x5b')](_0x67ef('0x5c'),_0x6df168);var _0x4f6d45={'method':_0x67ef('0x5d'),'uri':_0xb3f1e4,'qs':{'operation':_0x67ef('0x5e'),'username':_0x2ff1dd[_0x67ef('0x58')]},'json':!![]};return rp(_0x4f6d45);}})[_0x67ef('0x22')](function(_0x495488){if(_0x495488[_0x67ef('0x5f')]){var _0x573e2a={'method':_0x67ef('0x60'),'uri':_0xb3f1e4,'form':{'operation':_0x67ef('0x61'),'username':_0x30b05e,'accessKey':md5(_0x495488[_0x67ef('0x62')][_0x67ef('0x63')]+_0xaf329)},'json':!![]};return rp(_0x573e2a);}})[_0x67ef('0x22')](function(_0xb7af5c){if(_0xb7af5c['success']){var _0x48c6bf={'method':_0x67ef('0x5d'),'uri':_0xb3f1e4,'qs':{'operation':_0x67ef('0x64'),'username':_0x30b05e,'sessionName':_0xb7af5c[_0x67ef('0x62')][_0x67ef('0x65')],'elementType':_0x410320},'json':!![]};return rp(_0x48c6bf);}})[_0x67ef('0x22')](function(_0xa06b3){if(_0xa06b3[_0x67ef('0x5f')]){var _0xbe55bb=[_0x67ef('0x66'),_0x67ef('0x67'),_0x67ef('0x68')];_[_0x67ef('0x69')](_0xa06b3['result'][_0x67ef('0x32')],function(_0x41e94a){return _0xbe55bb['includes'](_0x41e94a[_0x67ef('0x2b')][_0x67ef('0x28')]);});_[_0x67ef('0x69')](_0xa06b3[_0x67ef('0x62')][_0x67ef('0x32')],function(_0x54ead8){return _0x54ead8['editable']==='false';});return{'count':_0xa06b3[_0x67ef('0x62')][_0x67ef('0x32')][_0x67ef('0x33')],'rows':_['map'](_0xa06b3[_0x67ef('0x62')][_0x67ef('0x32')],function(_0x3112b7){return{'id':_0x3112b7[_0x67ef('0x28')],'name':_0x3112b7[_0x67ef('0x6a')],'custom':_[_0x67ef('0x6b')](_0x3112b7['name'],'cf_')?!![]:![],'options':_0x3112b7['type'][_0x67ef('0x28')]===_0x67ef('0x6c')&&_0x3112b7[_0x67ef('0x2b')]['picklistValues'][_0x67ef('0x33')]>0x0?_['map'](_0x3112b7[_0x67ef('0x2b')][_0x67ef('0x6d')],function(_0x20d3c5){return{'name':_0x20d3c5[_0x67ef('0x6a')],'value':_0x20d3c5[_0x67ef('0x6e')]};}):[]};})};}})[_0x67ef('0x22')](respondWithResult(_0x3a2ada,null))[_0x67ef('0x3e')](function(_0x47a140){console[_0x67ef('0x6f')](_0x67ef('0x70')+_0x47a140);var _0x588a47=_0xcc9bec[_0x67ef('0x2e')][_0x67ef('0x71')]?0x1f4:_0x47a140['statusCode']||0x1f4;logger[_0x67ef('0x26')](_0x67ef('0x72'),'getFields',_0x588a47,JSON[_0x67ef('0x73')](_0x47a140));delete _0x47a140[_0x67ef('0x28')];if(_0x588a47===0x191){_0x588a47=0x190;}_0x3a2ada[_0x67ef('0x17')](_0x588a47)[_0x67ef('0x74')](_0xcc9bec[_0x67ef('0x2e')][_0x67ef('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x47a140[_0x67ef('0x75')]}:_0x47a140);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index db24836..c1262d8 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 _0xf827=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','int_vtiger_accounts','lodash','util'];(function(_0x180f4f,_0x56ca73){var _0x3cf475=function(_0x5cbe38){while(--_0x5cbe38){_0x180f4f['push'](_0x180f4f['shift']());}};_0x3cf475(++_0x56ca73);}(_0xf827,0xee));var _0x7f82=function(_0xad266a,_0x2a9f72){_0xad266a=_0xad266a-0x0;var _0x1bee49=_0xf827[_0xad266a];return _0x1bee49;};'use strict';var _=require(_0x7f82('0x0'));var util=require(_0x7f82('0x1'));var logger=require('../../config/logger')(_0x7f82('0x2'));var moment=require(_0x7f82('0x3'));var BPromise=require(_0x7f82('0x4'));var rp=require(_0x7f82('0x5'));var fs=require('fs');var path=require(_0x7f82('0x6'));var rimraf=require('rimraf');var config=require(_0x7f82('0x7'));var attributes=require(_0x7f82('0x8'));var integrations=require(_0x7f82('0x9'));module[_0x7f82('0xa')]=function(_0x41f3b4,_0x448768){return _0x41f3b4['define']('VtigerAccount',attributes,{'tableName':_0x7f82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbce7=['api','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger'];(function(_0x582783,_0x15bd71){var _0x1fa86e=function(_0x21e9b7){while(--_0x21e9b7){_0x582783['push'](_0x582783['shift']());}};_0x1fa86e(++_0x15bd71);}(_0xbce7,0x15b));var _0x7bce=function(_0x4985af,_0x1ac7db){_0x4985af=_0x4985af-0x0;var _0x5ccae6=_0xbce7[_0x4985af];return _0x5ccae6;};'use strict';var _=require(_0x7bce('0x0'));var util=require(_0x7bce('0x1'));var logger=require(_0x7bce('0x2'))(_0x7bce('0x3'));var moment=require('moment');var BPromise=require(_0x7bce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bce('0x5'));var rimraf=require('rimraf');var config=require(_0x7bce('0x6'));var attributes=require(_0x7bce('0x7'));var integrations=require(_0x7bce('0x8'));module['exports']=function(_0x38c49b,_0x3887ee){return _0x38c49b[_0x7bce('0x9')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index b382f92..55595a9 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 _0x3c81=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xfabffc,_0x4e6767){var _0x11e8db=function(_0x5948c5){while(--_0x5948c5){_0xfabffc['push'](_0xfabffc['shift']());}};_0x11e8db(++_0x4e6767);}(_0x3c81,0x102));var _0x13c8=function(_0x4f22b5,_0x4059c2){_0x4f22b5=_0x4f22b5-0x0;var _0x4d6463=_0x3c81[_0x4f22b5];return _0x4d6463;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});}exports[_0x13c8('0x15')]=function(_0xce1ad2){var _0x28f07e=this;return new Promise(function(_0x346417,_0x251c38){return db[_0x13c8('0x16')][_0x13c8('0x17')]({'raw':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2['options'][_0x13c8('0x19')]===undefined?!![]:![]:!![],'where':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1a')]||null:null,'attributes':_0xce1ad2['options']?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1b')]||null:null,'limit':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1c')]||null:null,'include':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2['options'][_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1d')],function(_0x577df6){return{'model':db[_0x577df6[_0x13c8('0x1f')]],'as':_0x577df6['as'],'attributes':_0x577df6[_0x13c8('0x1b')],'include':_0x577df6['include']?_['map'](_0x577df6[_0x13c8('0x1d')],function(_0x4aff35){return{'model':db[_0x4aff35['model']],'as':_0x4aff35['as'],'attributes':_0x4aff35['attributes'],'include':_0x4aff35[_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0x4aff35['include'],function(_0x4df077){return{'model':db[_0x4df077[_0x13c8('0x1f')]],'as':_0x4df077['as'],'attributes':_0x4df077['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c7dc4){logger[_0x13c8('0xb')](_0x13c8('0x15'),_0xce1ad2);logger['debug']('GetVtigerAccount',_0xce1ad2,JSON[_0x13c8('0x10')](_0x1c7dc4));_0x346417(_0x1c7dc4);})[_0x13c8('0x20')](function(_0x399840){logger[_0x13c8('0x11')](_0x13c8('0x15'),_0x399840[_0x13c8('0x13')],_0xce1ad2);_0x251c38(_0x28f07e[_0x13c8('0x11')](0x1f4,_0x399840['message']));});});};exports[_0x13c8('0x21')]=function(_0xcbc9b7){var _0x5a5911=this;return new Promise(function(_0x5c85e4,_0x23a725){return db[_0x13c8('0x16')]['find']({'raw':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1a')]||null:null,'attributes':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1b')]||null:null,'include':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')]['include']?_['map'](_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1d')],function(_0x517d01){return{'model':db[_0x517d01[_0x13c8('0x1f')]],'as':_0x517d01['as'],'attributes':_0x517d01['attributes'],'include':_0x517d01[_0x13c8('0x1d')]?_['map'](_0x517d01[_0x13c8('0x1d')],function(_0x53de18){return{'model':db[_0x53de18[_0x13c8('0x1f')]],'as':_0x53de18['as'],'attributes':_0x53de18[_0x13c8('0x1b')],'include':_0x53de18[_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0x53de18[_0x13c8('0x1d')],function(_0x5287f2){return{'model':db[_0x5287f2[_0x13c8('0x1f')]],'as':_0x5287f2['as'],'attributes':_0x5287f2[_0x13c8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x362b9c){logger[_0x13c8('0xb')](_0x13c8('0x21'),_0xcbc9b7);logger['debug']('ShowVtigerAccount',_0xcbc9b7,JSON['stringify'](_0x362b9c));_0x5c85e4(_0x362b9c);})[_0x13c8('0x20')](function(_0x2c8218){logger[_0x13c8('0x11')](_0x13c8('0x21'),_0x2c8218[_0x13c8('0x13')],_0xcbc9b7);_0x23a725(_0x5a5911[_0x13c8('0x11')](0x1f4,_0x2c8218[_0x13c8('0x13')]));});});}; \ No newline at end of file +var _0xc788=['request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x40b2c8,_0x2fc5d8){var _0x242ccf=function(_0x37c867){while(--_0x37c867){_0x40b2c8['push'](_0x40b2c8['shift']());}};_0x242ccf(++_0x2fc5d8);}(_0xc788,0xc4));var _0x8c78=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xc788[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['VtigerAccount']['findAll']({'raw':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x18')]||null:null,'attributes':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x19')]||null:null,'limit':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1a')]||null:null,'include':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x20f483){return{'model':db[_0x20f483[_0x8c78('0x1d')]],'as':_0x20f483['as'],'attributes':_0x20f483[_0x8c78('0x19')],'include':_0x20f483[_0x8c78('0x1b')]?_['map'](_0x20f483[_0x8c78('0x1b')],function(_0x458763){return{'model':db[_0x458763[_0x8c78('0x1d')]],'as':_0x458763['as'],'attributes':_0x458763['attributes'],'include':_0x458763[_0x8c78('0x1b')]?_['map'](_0x458763[_0x8c78('0x1b')],function(_0x24f9a7){return{'model':db[_0x24f9a7[_0x8c78('0x1d')]],'as':_0x24f9a7['as'],'attributes':_0x24f9a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x2568d5){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x1e')](_0x8c78('0x15'),_0x461eff,JSON[_0x8c78('0x1f')](_0x2568d5));_0x4f7bf9(_0x2568d5);})[_0x8c78('0x14')](function(_0x2ab5cc){logger['error'](_0x8c78('0x15'),_0x2ab5cc['message'],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x2ab5cc[_0x8c78('0x11')]));});});};exports[_0x8c78('0x20')]=function(_0x4e764f){var _0x1f1a0c=this;return new Promise(function(_0x3816d2,_0x4f0005){return db[_0x8c78('0x21')][_0x8c78('0x22')]({'raw':_0x4e764f[_0x8c78('0x16')]?_0x4e764f['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['where']||null:null,'attributes':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['attributes']||null:null,'include':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x1218f4){return{'model':db[_0x1218f4[_0x8c78('0x1d')]],'as':_0x1218f4['as'],'attributes':_0x1218f4[_0x8c78('0x19')],'include':_0x1218f4[_0x8c78('0x1b')]?_['map'](_0x1218f4[_0x8c78('0x1b')],function(_0x45e673){return{'model':db[_0x45e673[_0x8c78('0x1d')]],'as':_0x45e673['as'],'attributes':_0x45e673[_0x8c78('0x19')],'include':_0x45e673[_0x8c78('0x1b')]?_['map'](_0x45e673[_0x8c78('0x1b')],function(_0xc4d0cf){return{'model':db[_0xc4d0cf[_0x8c78('0x1d')]],'as':_0xc4d0cf['as'],'attributes':_0xc4d0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x25ea2f){logger['info'](_0x8c78('0x20'),_0x4e764f);logger['debug'](_0x8c78('0x20'),_0x4e764f,JSON[_0x8c78('0x1f')](_0x25ea2f));_0x3816d2(_0x25ea2f);})[_0x8c78('0x14')](function(_0x157b81){logger['error'](_0x8c78('0x20'),_0x157b81['message'],_0x4e764f);_0x4f0005(_0x1f1a0c[_0x8c78('0x10')](0x1f4,_0x157b81[_0x8c78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1426a0c..681e855 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 _0x6511=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','get','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','/:id','multer'];(function(_0x313b89,_0xbcda6){var _0x48dcf9=function(_0x28345a){while(--_0x28345a){_0x313b89['push'](_0x313b89['shift']());}};_0x48dcf9(++_0xbcda6);}(_0x6511,0x141));var _0x1651=function(_0x156696,_0x3a9a2e){_0x156696=_0x156696-0x0;var _0x5ab7c4=_0x6511[_0x156696];return _0x5ab7c4;};'use strict';var multer=require(_0x1651('0x0'));var util=require(_0x1651('0x1'));var path=require(_0x1651('0x2'));var timeout=require(_0x1651('0x3'));var express=require(_0x1651('0x4'));var router=express[_0x1651('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1651('0x6'));var interaction=require(_0x1651('0x7'));var config=require(_0x1651('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x1651('0x9')](),controller[_0x1651('0xa')]);router['get']('/:id',auth[_0x1651('0x9')](),controller[_0x1651('0xb')]);router[_0x1651('0xc')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1651('0xd')]);router['get'](_0x1651('0xe'),auth[_0x1651('0x9')](),controller[_0x1651('0xf')]);router[_0x1651('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x1651('0x10')]);router[_0x1651('0x11')]('/',auth[_0x1651('0x9')](),controller[_0x1651('0x12')]);router[_0x1651('0x13')]('/:id',auth[_0x1651('0x9')](),controller[_0x1651('0x14')]);router[_0x1651('0x15')](_0x1651('0x16'),auth[_0x1651('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7e88=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x527733,_0x16051c){var _0x5400ba=function(_0x265d39){while(--_0x265d39){_0x527733['push'](_0x527733['shift']());}};_0x5400ba(++_0x16051c);}(_0x7e88,0xcb));var _0x87e8=function(_0x18ca4f,_0x37bde0){_0x18ca4f=_0x18ca4f-0x0;var _0x5d55be=_0x7e88[_0x18ca4f];return _0x5d55be;};'use strict';var multer=require(_0x87e8('0x0'));var util=require(_0x87e8('0x1'));var path=require('path');var timeout=require(_0x87e8('0x2'));var express=require(_0x87e8('0x3'));var router=express[_0x87e8('0x4')]();var fs_extra=require(_0x87e8('0x5'));var auth=require(_0x87e8('0x6'));var interaction=require(_0x87e8('0x7'));var config=require(_0x87e8('0x8'));var controller=require(_0x87e8('0x9'));router[_0x87e8('0xa')]('/',auth[_0x87e8('0xb')](),controller[_0x87e8('0xc')]);router[_0x87e8('0xa')]('/:id',auth[_0x87e8('0xb')](),controller[_0x87e8('0xd')]);router[_0x87e8('0xa')](_0x87e8('0xe'),auth['isAuthenticated'](),controller[_0x87e8('0xf')]);router[_0x87e8('0xa')](_0x87e8('0x10'),auth[_0x87e8('0xb')](),controller[_0x87e8('0x11')]);router[_0x87e8('0xa')](_0x87e8('0x12'),auth['isAuthenticated'](),controller[_0x87e8('0x13')]);router[_0x87e8('0x14')]('/',auth[_0x87e8('0xb')](),controller[_0x87e8('0x15')]);router[_0x87e8('0x16')](_0x87e8('0x17'),auth[_0x87e8('0xb')](),controller[_0x87e8('0x18')]);router[_0x87e8('0x19')](_0x87e8('0x17'),auth[_0x87e8('0xb')](),controller['destroy']);module[_0x87e8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 718a0e1..b78cd9e 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 _0x824e=['exports','STRING'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x824e,0x1f0));var _0xe824=function(_0x5b791d,_0x49cc81){_0x5b791d=_0x5b791d-0x0;var _0xdd1c36=_0x824e[_0x5b791d];return _0xdd1c36;};'use strict';var Sequelize=require('sequelize');module[_0xe824('0x0')]={'name':{'type':Sequelize[_0xe824('0x1')]},'description':{'type':Sequelize[_0xe824('0x1')]}}; \ No newline at end of file +var _0x3297=['sequelize','STRING'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x3297,0x1c4));var _0x7329=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3297[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x7329('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7329('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index eeb2d88..0120e4f 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 _0x0df9=['ioredis','../../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','Content-Range','json','apply','update','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','VtigerConfiguration','include','show','params','keys','length','includeAll','catch','create','body','find','destroy','VtigerField','pick','getFields','findOne','options','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x256e7e,_0x4bd682){var _0x5cd898=function(_0x272713){while(--_0x272713){_0x256e7e['push'](_0x256e7e['shift']());}};_0x5cd898(++_0x4bd682);}(_0x0df9,0x170));var _0x90df=function(_0x26344b,_0xc28ced){_0x26344b=_0x26344b-0x0;var _0x222791=_0x0df9[_0x26344b];return _0x222791;};'use strict';var emlformat=require(_0x90df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90df('0x1'));var jsonpatch=require(_0x90df('0x2'));var rp=require('request-promise');var moment=require(_0x90df('0x3'));var BPromise=require(_0x90df('0x4'));var Mustache=require(_0x90df('0x5'));var util=require(_0x90df('0x6'));var path=require(_0x90df('0x7'));var sox=require(_0x90df('0x8'));var csv=require(_0x90df('0x9'));var ejs=require(_0x90df('0xa'));var fs=require('fs');var fs_extra=require(_0x90df('0xb'));var _=require(_0x90df('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x90df('0xd'));var deskjs=require(_0x90df('0xe'));var toCsv=require('to-csv');var querystring=require(_0x90df('0xf'));var Papa=require(_0x90df('0x10'));var Redis=require(_0x90df('0x11'));var authService=require(_0x90df('0x12'));var qs=require(_0x90df('0x13'));var as=require(_0x90df('0x14'));var hardwareService=require(_0x90df('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x90df('0x16'));var config=require(_0x90df('0x17'));var licenseUtil=require(_0x90df('0x18'));var db=require(_0x90df('0x19'))['db'];function respondWithStatusCode(_0x5b1a00,_0x1aa960){_0x1aa960=_0x1aa960||0xcc;return function(_0x1f4ab7){if(_0x1f4ab7){return _0x5b1a00[_0x90df('0x1a')](_0x1aa960);}return _0x5b1a00[_0x90df('0x1b')](_0x1aa960)[_0x90df('0x1c')]();};}function respondWithResult(_0x5bdab2,_0x52d6bf){_0x52d6bf=_0x52d6bf||0xc8;return function(_0x110966){if(_0x110966){return _0x5bdab2['status'](_0x52d6bf)['json'](_0x110966);}};}function respondWithFilteredResult(_0x5907ee,_0x3746e4){return function(_0x404b64){if(_0x404b64){var _0x4a347b=typeof _0x3746e4[_0x90df('0x1d')]==='undefined'&&typeof _0x3746e4[_0x90df('0x1e')]===_0x90df('0x1f');var _0x448e28=_0x404b64[_0x90df('0x20')];var _0xdee6bb=_0x4a347b?0x0:_0x3746e4['offset'];var _0x224a5b=_0x4a347b?_0x404b64[_0x90df('0x20')]:_0x3746e4[_0x90df('0x1d')]+_0x3746e4['limit'];var _0x3a214e;if(_0x224a5b>=_0x448e28){_0x224a5b=_0x448e28;_0x3a214e=0xc8;}else{_0x3a214e=0xce;}_0x5907ee[_0x90df('0x1b')](_0x3a214e);return _0x5907ee['set'](_0x90df('0x21'),_0xdee6bb+'-'+_0x224a5b+'/'+_0x448e28)[_0x90df('0x22')](_0x404b64);}return null;};}function patchUpdates(_0xc49922){return function(_0x1ca4c1){try{jsonpatch[_0x90df('0x23')](_0x1ca4c1,_0xc49922,!![]);}catch(_0x4117bf){return BPromise['reject'](_0x4117bf);}return _0x1ca4c1['save']();};}function saveUpdates(_0x11d47e,_0x50e9a5){return function(_0x38734e){if(_0x38734e){return _0x38734e[_0x90df('0x24')](_0x11d47e)['then'](function(_0x50f384){return _0x50f384;});}return null;};}function removeEntity(_0x12dce2,_0x47abe1){return function(_0xc1abf0){if(_0xc1abf0){return _0xc1abf0['destroy']()[_0x90df('0x25')](function(){_0x12dce2[_0x90df('0x1b')](0xcc)[_0x90df('0x1c')]();});}};}function handleEntityNotFound(_0x56e7ae,_0x1daa9b){return function(_0x1d4531){if(!_0x1d4531){_0x56e7ae[_0x90df('0x1a')](0x194);}return _0x1d4531;};}function handleError(_0x49690b,_0x45d732){_0x45d732=_0x45d732||0x1f4;return function(_0x5203ad){logger['error'](_0x5203ad[_0x90df('0x26')]);if(_0x5203ad[_0x90df('0x27')]){delete _0x5203ad[_0x90df('0x27')];}_0x49690b[_0x90df('0x1b')](_0x45d732)[_0x90df('0x28')](_0x5203ad);};}exports[_0x90df('0x29')]=function(_0x5f95c8,_0x33d1fb){var _0x37cf9d={},_0x4e6ea2={},_0x1e2c38={'count':0x0,'rows':[]};var _0x2ff8f4=_['map'](db['VtigerConfiguration'][_0x90df('0x2a')],function(_0x589f73){return{'name':_0x589f73[_0x90df('0x2b')],'type':_0x589f73[_0x90df('0x2c')]['key']};});_0x4e6ea2[_0x90df('0x2d')]=_[_0x90df('0x2e')](_0x2ff8f4,_0x90df('0x27'));_0x4e6ea2[_0x90df('0x2f')]=_['keys'](_0x5f95c8[_0x90df('0x2f')]);_0x4e6ea2['filters']=_['intersection'](_0x4e6ea2[_0x90df('0x2d')],_0x4e6ea2[_0x90df('0x2f')]);_0x37cf9d[_0x90df('0x30')]=_[_0x90df('0x31')](_0x4e6ea2[_0x90df('0x2d')],qs[_0x90df('0x32')](_0x5f95c8[_0x90df('0x2f')][_0x90df('0x32')]));_0x37cf9d[_0x90df('0x30')]=_0x37cf9d['attributes']['length']?_0x37cf9d['attributes']:_0x4e6ea2[_0x90df('0x2d')];if(!_0x5f95c8['query'][_0x90df('0x33')](_0x90df('0x34'))){_0x37cf9d[_0x90df('0x1e')]=qs['limit'](_0x5f95c8[_0x90df('0x2f')][_0x90df('0x1e')]);_0x37cf9d[_0x90df('0x1d')]=qs[_0x90df('0x1d')](_0x5f95c8[_0x90df('0x2f')][_0x90df('0x1d')]);}_0x37cf9d[_0x90df('0x35')]=qs['sort'](_0x5f95c8['query'][_0x90df('0x36')]);_0x37cf9d[_0x90df('0x37')]=qs[_0x90df('0x38')](_['pick'](_0x5f95c8[_0x90df('0x2f')],_0x4e6ea2[_0x90df('0x38')]),_0x2ff8f4);if(_0x5f95c8['query']['filter']){_0x37cf9d[_0x90df('0x37')]=_[_0x90df('0x39')](_0x37cf9d[_0x90df('0x37')],{'$or':_['map'](_0x2ff8f4,function(_0x879d3e){if(_0x879d3e[_0x90df('0x2c')]!=='VIRTUAL'){var _0x20480b={};_0x20480b[_0x879d3e[_0x90df('0x27')]]={'$like':'%'+_0x5f95c8[_0x90df('0x2f')][_0x90df('0x3a')]+'%'};return _0x20480b;}})});}_0x37cf9d=_[_0x90df('0x39')]({},_0x37cf9d,_0x5f95c8['options']);var _0x190437={'where':_0x37cf9d[_0x90df('0x37')]};return db[_0x90df('0x3b')]['count'](_0x190437)[_0x90df('0x25')](function(_0x78f6b0){_0x1e2c38['count']=_0x78f6b0;if(_0x5f95c8[_0x90df('0x2f')]['includeAll']){_0x37cf9d[_0x90df('0x3c')]=[{'all':!![]}];}return db[_0x90df('0x3b')]['findAll'](_0x37cf9d);})[_0x90df('0x25')](function(_0x341d21){_0x1e2c38['rows']=_0x341d21;return _0x1e2c38;})[_0x90df('0x25')](respondWithFilteredResult(_0x33d1fb,_0x37cf9d))['catch'](handleError(_0x33d1fb,null));};exports[_0x90df('0x3d')]=function(_0x4c1ac2,_0x2bfdf2){var _0x37214d={'raw':![],'where':{'id':_0x4c1ac2[_0x90df('0x3e')]['id']}},_0x104f77={};_0x104f77[_0x90df('0x2d')]=_[_0x90df('0x3f')](db[_0x90df('0x3b')]['rawAttributes']);_0x104f77['query']=_['keys'](_0x4c1ac2[_0x90df('0x2f')]);_0x104f77[_0x90df('0x38')]=_[_0x90df('0x31')](_0x104f77['model'],_0x104f77['query']);_0x37214d['attributes']=_[_0x90df('0x31')](_0x104f77[_0x90df('0x2d')],qs[_0x90df('0x32')](_0x4c1ac2[_0x90df('0x2f')][_0x90df('0x32')]));_0x37214d['attributes']=_0x37214d[_0x90df('0x30')][_0x90df('0x40')]?_0x37214d[_0x90df('0x30')]:_0x104f77[_0x90df('0x2d')];if(_0x4c1ac2[_0x90df('0x2f')][_0x90df('0x41')]){_0x37214d['include']=[{'all':!![]}];}_0x37214d=_[_0x90df('0x39')]({},_0x37214d,_0x4c1ac2['options']);return db['VtigerConfiguration']['find'](_0x37214d)[_0x90df('0x25')](handleEntityNotFound(_0x2bfdf2,null))[_0x90df('0x25')](respondWithResult(_0x2bfdf2,null))[_0x90df('0x42')](handleError(_0x2bfdf2,null));};exports[_0x90df('0x43')]=function(_0x519dfb,_0xbc15cb){return db[_0x90df('0x3b')][_0x90df('0x43')](_0x519dfb[_0x90df('0x44')],{})[_0x90df('0x25')](respondWithResult(_0xbc15cb,0xc9))[_0x90df('0x42')](handleError(_0xbc15cb,null));};exports[_0x90df('0x24')]=function(_0xb552d,_0x90ad25){if(_0xb552d[_0x90df('0x44')]['id']){delete _0xb552d[_0x90df('0x44')]['id'];}return db[_0x90df('0x3b')][_0x90df('0x45')]({'where':{'id':_0xb552d[_0x90df('0x3e')]['id']}})[_0x90df('0x25')](handleEntityNotFound(_0x90ad25,null))[_0x90df('0x25')](saveUpdates(_0xb552d[_0x90df('0x44')],null))[_0x90df('0x25')](respondWithResult(_0x90ad25,null))[_0x90df('0x42')](handleError(_0x90ad25,null));};exports[_0x90df('0x46')]=function(_0x1d004c,_0x3717ea){return db['VtigerConfiguration']['find']({'where':{'id':_0x1d004c[_0x90df('0x3e')]['id']}})[_0x90df('0x25')](handleEntityNotFound(_0x3717ea,null))[_0x90df('0x25')](removeEntity(_0x3717ea,null))['catch'](handleError(_0x3717ea,null));};exports['getFields']=function(_0x18860a,_0x1acec5,_0x2e92bf){var _0x16ba03={};var _0x5568dc={};var _0x24f463;var _0x47ca8f;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x18860a[_0x90df('0x3e')]['id']}})[_0x90df('0x25')](handleEntityNotFound(_0x1acec5,null))[_0x90df('0x25')](function(_0x1f9306){if(_0x1f9306){_0x24f463=_0x1f9306;_0x5568dc[_0x90df('0x2d')]=_['keys'](db[_0x90df('0x47')]['rawAttributes']);_0x5568dc[_0x90df('0x2f')]=_['keys'](_0x18860a[_0x90df('0x2f')]);_0x5568dc[_0x90df('0x38')]=_['intersection'](_0x5568dc[_0x90df('0x2d')],_0x5568dc[_0x90df('0x2f')]);_0x16ba03['attributes']=_[_0x90df('0x31')](_0x5568dc[_0x90df('0x2d')],qs['fields'](_0x18860a[_0x90df('0x2f')][_0x90df('0x32')]));_0x16ba03['attributes']=_0x16ba03[_0x90df('0x30')][_0x90df('0x40')]?_0x16ba03['attributes']:_0x5568dc[_0x90df('0x2d')];_0x16ba03['order']=qs[_0x90df('0x36')](_0x18860a[_0x90df('0x2f')]['sort']);_0x16ba03['where']=qs[_0x90df('0x38')](_[_0x90df('0x48')](_0x18860a[_0x90df('0x2f')],_0x5568dc['filters']));if(_0x18860a[_0x90df('0x2f')][_0x90df('0x3a')]){_0x16ba03[_0x90df('0x37')]=_[_0x90df('0x39')](_0x16ba03[_0x90df('0x37')],{'$or':_[_0x90df('0x2e')](_0x16ba03[_0x90df('0x30')],function(_0xd1ff53){var _0x31eed3={};_0x31eed3[_0xd1ff53]={'$like':'%'+_0x18860a[_0x90df('0x2f')][_0x90df('0x3a')]+'%'};return _0x31eed3;})});}_0x16ba03=_['merge']({},_0x16ba03,_0x18860a['options']);return _0x24f463[_0x90df('0x49')](_0x16ba03);}})[_0x90df('0x25')](function(_0x2523ae){if(_0x2523ae){_0x47ca8f=_0x2523ae[_0x90df('0x40')];if(!_0x18860a[_0x90df('0x2f')][_0x90df('0x33')]('nolimit')){_0x16ba03[_0x90df('0x1e')]=qs['limit'](_0x18860a[_0x90df('0x2f')][_0x90df('0x1e')]);_0x16ba03[_0x90df('0x1d')]=qs['offset'](_0x18860a[_0x90df('0x2f')][_0x90df('0x1d')]);}return _0x24f463[_0x90df('0x49')](_0x16ba03);}})['then'](function(_0x2913e1){if(_0x2913e1){return _0x2913e1?{'count':_0x47ca8f,'rows':_0x2913e1}:null;}})[_0x90df('0x25')](respondWithResult(_0x1acec5,null))[_0x90df('0x42')](handleError(_0x1acec5,null));};exports['getSubjects']=function(_0xd70b45,_0x599188,_0x13e7a3){var _0x40311b={};var _0x4336cd={};var _0x22ba61;var _0x105752;return db[_0x90df('0x3b')][_0x90df('0x4a')]({'where':{'id':_0xd70b45[_0x90df('0x3e')]['id']}})[_0x90df('0x25')](handleEntityNotFound(_0x599188,null))[_0x90df('0x25')](function(_0x206ac1){if(_0x206ac1){_0x22ba61=_0x206ac1;_0x4336cd['model']=_['keys'](db[_0x90df('0x47')]['rawAttributes']);_0x4336cd[_0x90df('0x2f')]=_[_0x90df('0x3f')](_0xd70b45['query']);_0x4336cd[_0x90df('0x38')]=_[_0x90df('0x31')](_0x4336cd[_0x90df('0x2d')],_0x4336cd['query']);_0x40311b[_0x90df('0x30')]=_[_0x90df('0x31')](_0x4336cd[_0x90df('0x2d')],qs['fields'](_0xd70b45[_0x90df('0x2f')]['fields']));_0x40311b[_0x90df('0x30')]=_0x40311b[_0x90df('0x30')][_0x90df('0x40')]?_0x40311b[_0x90df('0x30')]:_0x4336cd['model'];_0x40311b[_0x90df('0x35')]=qs[_0x90df('0x36')](_0xd70b45[_0x90df('0x2f')]['sort']);_0x40311b[_0x90df('0x37')]=qs[_0x90df('0x38')](_['pick'](_0xd70b45['query'],_0x4336cd[_0x90df('0x38')]));if(_0xd70b45[_0x90df('0x2f')][_0x90df('0x3a')]){_0x40311b['where']=_[_0x90df('0x39')](_0x40311b['where'],{'$or':_[_0x90df('0x2e')](_0x40311b[_0x90df('0x30')],function(_0x538320){var _0x501766={};_0x501766[_0x538320]={'$like':'%'+_0xd70b45[_0x90df('0x2f')]['filter']+'%'};return _0x501766;})});}_0x40311b=_[_0x90df('0x39')]({},_0x40311b,_0xd70b45['options']);return _0x22ba61['getSubjects'](_0x40311b);}})[_0x90df('0x25')](function(_0x21bcd1){if(_0x21bcd1){_0x105752=_0x21bcd1[_0x90df('0x40')];if(!_0xd70b45[_0x90df('0x2f')][_0x90df('0x33')]('nolimit')){_0x40311b[_0x90df('0x1e')]=qs[_0x90df('0x1e')](_0xd70b45[_0x90df('0x2f')][_0x90df('0x1e')]);_0x40311b[_0x90df('0x1d')]=qs[_0x90df('0x1d')](_0xd70b45[_0x90df('0x2f')][_0x90df('0x1d')]);}return _0x22ba61['getSubjects'](_0x40311b);}})[_0x90df('0x25')](function(_0x2f9eab){if(_0x2f9eab){return _0x2f9eab?{'count':_0x105752,'rows':_0x2f9eab}:null;}})[_0x90df('0x25')](respondWithResult(_0x599188,null))[_0x90df('0x42')](handleError(_0x599188,null));};exports['getDescriptions']=function(_0x3b1895,_0x26ac9a,_0x396946){var _0x45f1fc={};var _0x3be2f8={};var _0x16130e;var _0x2ab2a2;return db[_0x90df('0x3b')][_0x90df('0x4a')]({'where':{'id':_0x3b1895[_0x90df('0x3e')]['id']}})['then'](handleEntityNotFound(_0x26ac9a,null))[_0x90df('0x25')](function(_0x3320d3){if(_0x3320d3){_0x16130e=_0x3320d3;_0x3be2f8[_0x90df('0x2d')]=_[_0x90df('0x3f')](db[_0x90df('0x47')]['rawAttributes']);_0x3be2f8['query']=_[_0x90df('0x3f')](_0x3b1895[_0x90df('0x2f')]);_0x3be2f8[_0x90df('0x38')]=_['intersection'](_0x3be2f8[_0x90df('0x2d')],_0x3be2f8['query']);_0x45f1fc[_0x90df('0x30')]=_[_0x90df('0x31')](_0x3be2f8[_0x90df('0x2d')],qs[_0x90df('0x32')](_0x3b1895[_0x90df('0x2f')][_0x90df('0x32')]));_0x45f1fc[_0x90df('0x30')]=_0x45f1fc[_0x90df('0x30')][_0x90df('0x40')]?_0x45f1fc['attributes']:_0x3be2f8[_0x90df('0x2d')];_0x45f1fc[_0x90df('0x35')]=qs[_0x90df('0x36')](_0x3b1895[_0x90df('0x2f')]['sort']);_0x45f1fc[_0x90df('0x37')]=qs[_0x90df('0x38')](_[_0x90df('0x48')](_0x3b1895['query'],_0x3be2f8[_0x90df('0x38')]));if(_0x3b1895[_0x90df('0x2f')]['filter']){_0x45f1fc[_0x90df('0x37')]=_[_0x90df('0x39')](_0x45f1fc[_0x90df('0x37')],{'$or':_['map'](_0x45f1fc[_0x90df('0x30')],function(_0x5ab7e2){var _0x1bea6c={};_0x1bea6c[_0x5ab7e2]={'$like':'%'+_0x3b1895['query'][_0x90df('0x3a')]+'%'};return _0x1bea6c;})});}_0x45f1fc=_[_0x90df('0x39')]({},_0x45f1fc,_0x3b1895[_0x90df('0x4b')]);return _0x16130e['getDescriptions'](_0x45f1fc);}})[_0x90df('0x25')](function(_0x314dd7){if(_0x314dd7){_0x2ab2a2=_0x314dd7[_0x90df('0x40')];if(!_0x3b1895[_0x90df('0x2f')][_0x90df('0x33')]('nolimit')){_0x45f1fc[_0x90df('0x1e')]=qs['limit'](_0x3b1895[_0x90df('0x2f')][_0x90df('0x1e')]);_0x45f1fc[_0x90df('0x1d')]=qs[_0x90df('0x1d')](_0x3b1895[_0x90df('0x2f')][_0x90df('0x1d')]);}return _0x16130e[_0x90df('0x4c')](_0x45f1fc);}})[_0x90df('0x25')](function(_0x29c0cd){if(_0x29c0cd){return _0x29c0cd?{'count':_0x2ab2a2,'rows':_0x29c0cd}:null;}})[_0x90df('0x25')](respondWithResult(_0x26ac9a,null))[_0x90df('0x42')](handleError(_0x26ac9a,null));}; \ No newline at end of file +var _0xb522=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','end','error','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','update','destroy','findOne','VtigerField','getFields','hasOwnProperty'];(function(_0x578c1f,_0x5c52fc){var _0x39bef2=function(_0x4c9e78){while(--_0x4c9e78){_0x578c1f['push'](_0x578c1f['shift']());}};_0x39bef2(++_0x5c52fc);}(_0xb522,0x188));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x2b52('0x0'));var rimraf=require(_0x2b52('0x1'));var zipdir=require(_0x2b52('0x2'));var jsonpatch=require(_0x2b52('0x3'));var rp=require('request-promise');var moment=require(_0x2b52('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b52('0x5'));var util=require('util');var path=require(_0x2b52('0x6'));var sox=require('sox');var csv=require(_0x2b52('0x7'));var ejs=require(_0x2b52('0x8'));var fs=require('fs');var fs_extra=require(_0x2b52('0x9'));var _=require(_0x2b52('0xa'));var squel=require(_0x2b52('0xb'));var crypto=require('crypto');var jsforce=require(_0x2b52('0xc'));var deskjs=require(_0x2b52('0xd'));var toCsv=require(_0x2b52('0x7'));var querystring=require(_0x2b52('0xe'));var Papa=require(_0x2b52('0xf'));var Redis=require(_0x2b52('0x10'));var authService=require(_0x2b52('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b52('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b52('0x13'));var utils=require(_0x2b52('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ff160,_0x59d7f1){_0x59d7f1=_0x59d7f1||0xcc;return function(_0x4d7680){if(_0x4d7680){return _0x1ff160[_0x2b52('0x15')](_0x59d7f1);}return _0x1ff160[_0x2b52('0x16')](_0x59d7f1)['end']();};}function respondWithResult(_0x351899,_0x4353b2){_0x4353b2=_0x4353b2||0xc8;return function(_0x1a2ecd){if(_0x1a2ecd){return _0x351899[_0x2b52('0x16')](_0x4353b2)['json'](_0x1a2ecd);}};}function respondWithFilteredResult(_0xed9210,_0x1bfc21){return function(_0x47a656){if(_0x47a656){var _0x5c3f57=typeof _0x1bfc21[_0x2b52('0x17')]===_0x2b52('0x18')&&typeof _0x1bfc21[_0x2b52('0x19')]==='undefined';var _0x6a0430=_0x47a656[_0x2b52('0x1a')];var _0xff206=_0x5c3f57?0x0:_0x1bfc21['offset'];var _0xc39d4e=_0x5c3f57?_0x47a656[_0x2b52('0x1a')]:_0x1bfc21[_0x2b52('0x17')]+_0x1bfc21[_0x2b52('0x19')];var _0x30293c;if(_0xc39d4e>=_0x6a0430){_0xc39d4e=_0x6a0430;_0x30293c=0xc8;}else{_0x30293c=0xce;}_0xed9210[_0x2b52('0x16')](_0x30293c);return _0xed9210[_0x2b52('0x1b')](_0x2b52('0x1c'),_0xff206+'-'+_0xc39d4e+'/'+_0x6a0430)[_0x2b52('0x1d')](_0x47a656);}return null;};}function patchUpdates(_0x81af1a){return function(_0x4080a0){try{jsonpatch['apply'](_0x4080a0,_0x81af1a,!![]);}catch(_0x438e9e){return BPromise[_0x2b52('0x1e')](_0x438e9e);}return _0x4080a0[_0x2b52('0x1f')]();};}function saveUpdates(_0x48002d,_0x356d9d){return function(_0x32de11){if(_0x32de11){return _0x32de11['update'](_0x48002d)[_0x2b52('0x20')](function(_0x38b580){return _0x38b580;});}return null;};}function removeEntity(_0x22a742,_0x320d6d){return function(_0x232cfd){if(_0x232cfd){return _0x232cfd['destroy']()[_0x2b52('0x20')](function(){_0x22a742[_0x2b52('0x16')](0xcc)[_0x2b52('0x21')]();});}};}function handleEntityNotFound(_0x4c2d9c,_0x179cde){return function(_0x39880c){if(!_0x39880c){_0x4c2d9c[_0x2b52('0x15')](0x194);}return _0x39880c;};}function handleError(_0x3cf360,_0x36b449){_0x36b449=_0x36b449||0x1f4;return function(_0x50249f){logger[_0x2b52('0x22')](_0x50249f['stack']);if(_0x50249f[_0x2b52('0x23')]){delete _0x50249f[_0x2b52('0x23')];}_0x3cf360[_0x2b52('0x16')](_0x36b449)[_0x2b52('0x24')](_0x50249f);};}exports[_0x2b52('0x25')]=function(_0x4e20e6,_0x2ef34f){var _0xda0f48={},_0x55652e={},_0x509d82={'count':0x0,'rows':[]};var _0x87f6b=_[_0x2b52('0x26')](db[_0x2b52('0x27')]['rawAttributes'],function(_0x21984c){return{'name':_0x21984c[_0x2b52('0x28')],'type':_0x21984c[_0x2b52('0x29')][_0x2b52('0x2a')]};});_0x55652e['model']=_[_0x2b52('0x26')](_0x87f6b,_0x2b52('0x23'));_0x55652e[_0x2b52('0x2b')]=_[_0x2b52('0x2c')](_0x4e20e6[_0x2b52('0x2b')]);_0x55652e[_0x2b52('0x2d')]=_['intersection'](_0x55652e[_0x2b52('0x2e')],_0x55652e[_0x2b52('0x2b')]);_0xda0f48['attributes']=_[_0x2b52('0x2f')](_0x55652e[_0x2b52('0x2e')],qs[_0x2b52('0x30')](_0x4e20e6['query'][_0x2b52('0x30')]));_0xda0f48['attributes']=_0xda0f48[_0x2b52('0x31')][_0x2b52('0x32')]?_0xda0f48[_0x2b52('0x31')]:_0x55652e[_0x2b52('0x2e')];if(!_0x4e20e6['query']['hasOwnProperty'](_0x2b52('0x33'))){_0xda0f48[_0x2b52('0x19')]=qs[_0x2b52('0x19')](_0x4e20e6['query'][_0x2b52('0x19')]);_0xda0f48['offset']=qs['offset'](_0x4e20e6[_0x2b52('0x2b')][_0x2b52('0x17')]);}_0xda0f48[_0x2b52('0x34')]=qs[_0x2b52('0x35')](_0x4e20e6[_0x2b52('0x2b')][_0x2b52('0x35')]);_0xda0f48['where']=qs[_0x2b52('0x2d')](_[_0x2b52('0x36')](_0x4e20e6[_0x2b52('0x2b')],_0x55652e[_0x2b52('0x2d')]),_0x87f6b);if(_0x4e20e6[_0x2b52('0x2b')][_0x2b52('0x37')]){_0xda0f48[_0x2b52('0x38')]=_[_0x2b52('0x39')](_0xda0f48[_0x2b52('0x38')],{'$or':_[_0x2b52('0x26')](_0x87f6b,function(_0x191045){if(_0x191045[_0x2b52('0x29')]!==_0x2b52('0x3a')){var _0x3be6e2={};_0x3be6e2[_0x191045[_0x2b52('0x23')]]={'$like':'%'+_0x4e20e6[_0x2b52('0x2b')][_0x2b52('0x37')]+'%'};return _0x3be6e2;}})});}_0xda0f48=_[_0x2b52('0x39')]({},_0xda0f48,_0x4e20e6[_0x2b52('0x3b')]);var _0x221de0={'where':_0xda0f48[_0x2b52('0x38')]};return db[_0x2b52('0x27')]['count'](_0x221de0)[_0x2b52('0x20')](function(_0x27d673){_0x509d82[_0x2b52('0x1a')]=_0x27d673;if(_0x4e20e6[_0x2b52('0x2b')]['includeAll']){_0xda0f48[_0x2b52('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x2b52('0x3d')](_0xda0f48);})[_0x2b52('0x20')](function(_0x3ad883){_0x509d82['rows']=_0x3ad883;return _0x509d82;})['then'](respondWithFilteredResult(_0x2ef34f,_0xda0f48))[_0x2b52('0x3e')](handleError(_0x2ef34f,null));};exports[_0x2b52('0x3f')]=function(_0x4d3a67,_0x42c64f){var _0x2695cc={'raw':![],'where':{'id':_0x4d3a67[_0x2b52('0x40')]['id']}},_0x5d917e={};_0x5d917e[_0x2b52('0x2e')]=_['keys'](db[_0x2b52('0x27')][_0x2b52('0x41')]);_0x5d917e[_0x2b52('0x2b')]=_[_0x2b52('0x2c')](_0x4d3a67[_0x2b52('0x2b')]);_0x5d917e[_0x2b52('0x2d')]=_[_0x2b52('0x2f')](_0x5d917e[_0x2b52('0x2e')],_0x5d917e[_0x2b52('0x2b')]);_0x2695cc['attributes']=_[_0x2b52('0x2f')](_0x5d917e['model'],qs[_0x2b52('0x30')](_0x4d3a67[_0x2b52('0x2b')]['fields']));_0x2695cc[_0x2b52('0x31')]=_0x2695cc[_0x2b52('0x31')][_0x2b52('0x32')]?_0x2695cc['attributes']:_0x5d917e[_0x2b52('0x2e')];if(_0x4d3a67[_0x2b52('0x2b')][_0x2b52('0x42')]){_0x2695cc['include']=[{'all':!![]}];}_0x2695cc=_[_0x2b52('0x39')]({},_0x2695cc,_0x4d3a67[_0x2b52('0x3b')]);return db['VtigerConfiguration'][_0x2b52('0x43')](_0x2695cc)[_0x2b52('0x20')](handleEntityNotFound(_0x42c64f,null))['then'](respondWithResult(_0x42c64f,null))[_0x2b52('0x3e')](handleError(_0x42c64f,null));};exports[_0x2b52('0x44')]=function(_0x5efa8a,_0x380a11){return db[_0x2b52('0x27')]['create'](_0x5efa8a[_0x2b52('0x45')],{})['then'](respondWithResult(_0x380a11,0xc9))[_0x2b52('0x3e')](handleError(_0x380a11,null));};exports[_0x2b52('0x46')]=function(_0x1c5537,_0x1adaf9){if(_0x1c5537['body']['id']){delete _0x1c5537[_0x2b52('0x45')]['id'];}return db[_0x2b52('0x27')][_0x2b52('0x43')]({'where':{'id':_0x1c5537[_0x2b52('0x40')]['id']}})[_0x2b52('0x20')](handleEntityNotFound(_0x1adaf9,null))[_0x2b52('0x20')](saveUpdates(_0x1c5537[_0x2b52('0x45')],null))['then'](respondWithResult(_0x1adaf9,null))['catch'](handleError(_0x1adaf9,null));};exports[_0x2b52('0x47')]=function(_0x2cd16e,_0x202c1b){return db['VtigerConfiguration'][_0x2b52('0x43')]({'where':{'id':_0x2cd16e[_0x2b52('0x40')]['id']}})[_0x2b52('0x20')](handleEntityNotFound(_0x202c1b,null))[_0x2b52('0x20')](removeEntity(_0x202c1b,null))[_0x2b52('0x3e')](handleError(_0x202c1b,null));};exports['getFields']=function(_0x15de8a,_0x8b373b,_0x304c6a){var _0x28273f={};var _0x1a3d1f={};var _0x35c769;var _0x298098;return db[_0x2b52('0x27')][_0x2b52('0x48')]({'where':{'id':_0x15de8a[_0x2b52('0x40')]['id']}})[_0x2b52('0x20')](handleEntityNotFound(_0x8b373b,null))['then'](function(_0x4d4638){if(_0x4d4638){_0x35c769=_0x4d4638;_0x1a3d1f['model']=_['keys'](db[_0x2b52('0x49')][_0x2b52('0x41')]);_0x1a3d1f['query']=_[_0x2b52('0x2c')](_0x15de8a[_0x2b52('0x2b')]);_0x1a3d1f['filters']=_[_0x2b52('0x2f')](_0x1a3d1f['model'],_0x1a3d1f[_0x2b52('0x2b')]);_0x28273f[_0x2b52('0x31')]=_[_0x2b52('0x2f')](_0x1a3d1f[_0x2b52('0x2e')],qs[_0x2b52('0x30')](_0x15de8a[_0x2b52('0x2b')][_0x2b52('0x30')]));_0x28273f[_0x2b52('0x31')]=_0x28273f[_0x2b52('0x31')][_0x2b52('0x32')]?_0x28273f[_0x2b52('0x31')]:_0x1a3d1f[_0x2b52('0x2e')];_0x28273f[_0x2b52('0x34')]=qs['sort'](_0x15de8a[_0x2b52('0x2b')][_0x2b52('0x35')]);_0x28273f[_0x2b52('0x38')]=qs[_0x2b52('0x2d')](_[_0x2b52('0x36')](_0x15de8a[_0x2b52('0x2b')],_0x1a3d1f[_0x2b52('0x2d')]));if(_0x15de8a[_0x2b52('0x2b')][_0x2b52('0x37')]){_0x28273f['where']=_[_0x2b52('0x39')](_0x28273f[_0x2b52('0x38')],{'$or':_[_0x2b52('0x26')](_0x28273f[_0x2b52('0x31')],function(_0x137a84){var _0x49fd0e={};_0x49fd0e[_0x137a84]={'$like':'%'+_0x15de8a[_0x2b52('0x2b')][_0x2b52('0x37')]+'%'};return _0x49fd0e;})});}_0x28273f=_[_0x2b52('0x39')]({},_0x28273f,_0x15de8a[_0x2b52('0x3b')]);return _0x35c769[_0x2b52('0x4a')](_0x28273f);}})[_0x2b52('0x20')](function(_0x5d2253){if(_0x5d2253){_0x298098=_0x5d2253[_0x2b52('0x32')];if(!_0x15de8a['query'][_0x2b52('0x4b')]('nolimit')){_0x28273f[_0x2b52('0x19')]=qs[_0x2b52('0x19')](_0x15de8a[_0x2b52('0x2b')][_0x2b52('0x19')]);_0x28273f[_0x2b52('0x17')]=qs[_0x2b52('0x17')](_0x15de8a[_0x2b52('0x2b')][_0x2b52('0x17')]);}return _0x35c769[_0x2b52('0x4a')](_0x28273f);}})[_0x2b52('0x20')](function(_0x217d8d){if(_0x217d8d){return _0x217d8d?{'count':_0x298098,'rows':_0x217d8d}:null;}})['then'](respondWithResult(_0x8b373b,null))['catch'](handleError(_0x8b373b,null));};exports[_0x2b52('0x4c')]=function(_0x529d69,_0x4ba012,_0x50897c){var _0x210c20={};var _0x4d7dfa={};var _0x4ce3a9;var _0x149b1f;return db[_0x2b52('0x27')][_0x2b52('0x48')]({'where':{'id':_0x529d69[_0x2b52('0x40')]['id']}})[_0x2b52('0x20')](handleEntityNotFound(_0x4ba012,null))[_0x2b52('0x20')](function(_0x15edb5){if(_0x15edb5){_0x4ce3a9=_0x15edb5;_0x4d7dfa[_0x2b52('0x2e')]=_['keys'](db[_0x2b52('0x49')][_0x2b52('0x41')]);_0x4d7dfa[_0x2b52('0x2b')]=_[_0x2b52('0x2c')](_0x529d69['query']);_0x4d7dfa[_0x2b52('0x2d')]=_[_0x2b52('0x2f')](_0x4d7dfa[_0x2b52('0x2e')],_0x4d7dfa[_0x2b52('0x2b')]);_0x210c20[_0x2b52('0x31')]=_[_0x2b52('0x2f')](_0x4d7dfa[_0x2b52('0x2e')],qs['fields'](_0x529d69['query'][_0x2b52('0x30')]));_0x210c20[_0x2b52('0x31')]=_0x210c20['attributes'][_0x2b52('0x32')]?_0x210c20['attributes']:_0x4d7dfa[_0x2b52('0x2e')];_0x210c20['order']=qs['sort'](_0x529d69['query']['sort']);_0x210c20[_0x2b52('0x38')]=qs[_0x2b52('0x2d')](_[_0x2b52('0x36')](_0x529d69[_0x2b52('0x2b')],_0x4d7dfa[_0x2b52('0x2d')]));if(_0x529d69[_0x2b52('0x2b')][_0x2b52('0x37')]){_0x210c20[_0x2b52('0x38')]=_['merge'](_0x210c20[_0x2b52('0x38')],{'$or':_[_0x2b52('0x26')](_0x210c20[_0x2b52('0x31')],function(_0x33f372){var _0xb060b0={};_0xb060b0[_0x33f372]={'$like':'%'+_0x529d69[_0x2b52('0x2b')][_0x2b52('0x37')]+'%'};return _0xb060b0;})});}_0x210c20=_[_0x2b52('0x39')]({},_0x210c20,_0x529d69[_0x2b52('0x3b')]);return _0x4ce3a9[_0x2b52('0x4c')](_0x210c20);}})[_0x2b52('0x20')](function(_0xb24f14){if(_0xb24f14){_0x149b1f=_0xb24f14[_0x2b52('0x32')];if(!_0x529d69['query'][_0x2b52('0x4b')](_0x2b52('0x33'))){_0x210c20[_0x2b52('0x19')]=qs[_0x2b52('0x19')](_0x529d69['query'][_0x2b52('0x19')]);_0x210c20[_0x2b52('0x17')]=qs[_0x2b52('0x17')](_0x529d69[_0x2b52('0x2b')][_0x2b52('0x17')]);}return _0x4ce3a9[_0x2b52('0x4c')](_0x210c20);}})[_0x2b52('0x20')](function(_0x35046d){if(_0x35046d){return _0x35046d?{'count':_0x149b1f,'rows':_0x35046d}:null;}})[_0x2b52('0x20')](respondWithResult(_0x4ba012,null))[_0x2b52('0x3e')](handleError(_0x4ba012,null));};exports[_0x2b52('0x4d')]=function(_0xa2df2d,_0x119a93,_0x554223){var _0x565a30={};var _0x2feaff={};var _0x52b286;var _0x3375c0;return db[_0x2b52('0x27')][_0x2b52('0x48')]({'where':{'id':_0xa2df2d[_0x2b52('0x40')]['id']}})[_0x2b52('0x20')](handleEntityNotFound(_0x119a93,null))[_0x2b52('0x20')](function(_0x11788d){if(_0x11788d){_0x52b286=_0x11788d;_0x2feaff[_0x2b52('0x2e')]=_['keys'](db[_0x2b52('0x49')][_0x2b52('0x41')]);_0x2feaff[_0x2b52('0x2b')]=_[_0x2b52('0x2c')](_0xa2df2d[_0x2b52('0x2b')]);_0x2feaff['filters']=_[_0x2b52('0x2f')](_0x2feaff['model'],_0x2feaff[_0x2b52('0x2b')]);_0x565a30['attributes']=_['intersection'](_0x2feaff[_0x2b52('0x2e')],qs[_0x2b52('0x30')](_0xa2df2d['query'][_0x2b52('0x30')]));_0x565a30[_0x2b52('0x31')]=_0x565a30[_0x2b52('0x31')]['length']?_0x565a30[_0x2b52('0x31')]:_0x2feaff[_0x2b52('0x2e')];_0x565a30['order']=qs[_0x2b52('0x35')](_0xa2df2d[_0x2b52('0x2b')][_0x2b52('0x35')]);_0x565a30[_0x2b52('0x38')]=qs[_0x2b52('0x2d')](_[_0x2b52('0x36')](_0xa2df2d[_0x2b52('0x2b')],_0x2feaff[_0x2b52('0x2d')]));if(_0xa2df2d[_0x2b52('0x2b')][_0x2b52('0x37')]){_0x565a30['where']=_[_0x2b52('0x39')](_0x565a30['where'],{'$or':_[_0x2b52('0x26')](_0x565a30[_0x2b52('0x31')],function(_0x96417d){var _0xc06563={};_0xc06563[_0x96417d]={'$like':'%'+_0xa2df2d['query'][_0x2b52('0x37')]+'%'};return _0xc06563;})});}_0x565a30=_[_0x2b52('0x39')]({},_0x565a30,_0xa2df2d[_0x2b52('0x3b')]);return _0x52b286[_0x2b52('0x4d')](_0x565a30);}})[_0x2b52('0x20')](function(_0x16ad8b){if(_0x16ad8b){_0x3375c0=_0x16ad8b[_0x2b52('0x32')];if(!_0xa2df2d[_0x2b52('0x2b')][_0x2b52('0x4b')](_0x2b52('0x33'))){_0x565a30['limit']=qs[_0x2b52('0x19')](_0xa2df2d[_0x2b52('0x2b')][_0x2b52('0x19')]);_0x565a30[_0x2b52('0x17')]=qs[_0x2b52('0x17')](_0xa2df2d['query'][_0x2b52('0x17')]);}return _0x52b286['getDescriptions'](_0x565a30);}})[_0x2b52('0x20')](function(_0x19146d){if(_0x19146d){return _0x19146d?{'count':_0x3375c0,'rows':_0x19146d}:null;}})[_0x2b52('0x20')](respondWithResult(_0x119a93,null))['catch'](handleError(_0x119a93,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8d78946..4bccc26 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 _0x00f1=['../../config/environment','define','VtigerConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00f1,0x107));var _0x100f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00f1[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x100f('0x0'));var logger=require(_0x100f('0x1'))(_0x100f('0x2'));var moment=require(_0x100f('0x3'));var BPromise=require(_0x100f('0x4'));var rp=require(_0x100f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x100f('0x6'));var config=require(_0x100f('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x3533d,_0x4a4d01){return _0x3533d[_0x100f('0x8')](_0x100f('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6bd=['../../config/environment','exports','int_vtiger_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x382cd0,_0x26979b){var _0x321aa3=function(_0xcf0fd1){while(--_0xcf0fd1){_0x382cd0['push'](_0x382cd0['shift']());}};_0x321aa3(++_0x26979b);}(_0xc6bd,0x17d));var _0xdc6b=function(_0x217b21,_0x53d0d5){_0x217b21=_0x217b21-0x0;var _0x449d78=_0xc6bd[_0x217b21];return _0x449d78;};'use strict';var _=require(_0xdc6b('0x0'));var util=require(_0xdc6b('0x1'));var logger=require('../../config/logger')(_0xdc6b('0x2'));var moment=require(_0xdc6b('0x3'));var BPromise=require(_0xdc6b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc6b('0x5'));var rimraf=require('rimraf');var config=require(_0xdc6b('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xdc6b('0x7')]=function(_0x59748a,_0x1e6e1f){return _0x59748a['define']('VtigerConfiguration',attributes,{'tableName':_0xdc6b('0x8'),'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 6677b35..72f3041 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 _0x1f83=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','jayson/promise','client','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x401cca,_0x8d5dfd){var _0x25eaf0=function(_0x5d5ba5){while(--_0x5d5ba5){_0x401cca['push'](_0x401cca['shift']());}};_0x25eaf0(++_0x8d5dfd);}(_0x1f83,0xb3));var _0x31f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f83[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x31f8('0x0'));var util=require(_0x31f8('0x1'));var moment=require(_0x31f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31f8('0x3'))['db'];var utils=require(_0x31f8('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x31f8('0x5'));var client=jayson[_0x31f8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21f584,_0x315a07,_0x476af9){return new BPromise(function(_0x5e5f51,_0x48136e){return client['request'](_0x21f584,_0x476af9)[_0x31f8('0x7')](function(_0x18442b){logger[_0x31f8('0x8')](_0x31f8('0x9'),_0x315a07,_0x31f8('0xa'));logger['debug'](_0x31f8('0xb'),_0x315a07,_0x31f8('0xa'),JSON['stringify'](_0x18442b));if(_0x18442b[_0x31f8('0xc')]){if(_0x18442b[_0x31f8('0xc')]['code']===0x1f4){logger[_0x31f8('0xc')](_0x31f8('0x9'),_0x315a07,_0x18442b[_0x31f8('0xc')]['message']);return _0x48136e(_0x18442b[_0x31f8('0xc')]['message']);}logger[_0x31f8('0xc')](_0x31f8('0x9'),_0x315a07,_0x18442b[_0x31f8('0xc')][_0x31f8('0xd')]);return _0x5e5f51(_0x18442b['error'][_0x31f8('0xd')]);}else{logger[_0x31f8('0x8')]('VtigerConfiguration,\x20%s,\x20%s',_0x315a07,_0x31f8('0xa'));_0x5e5f51(_0x18442b[_0x31f8('0xe')][_0x31f8('0xd')]);}})[_0x31f8('0xf')](function(_0x1b09c6){logger[_0x31f8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x315a07,_0x1b09c6);_0x48136e(_0x1b09c6);});});} \ No newline at end of file +var _0xef81=['error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0xef81,0x95));var _0x1ef8=function(_0x19d1ee,_0x2b689c){_0x19d1ee=_0x19d1ee-0x0;var _0x55d624=_0xef81[_0x19d1ee];return _0x55d624;};'use strict';var _=require(_0x1ef8('0x0'));var util=require(_0x1ef8('0x1'));var moment=require(_0x1ef8('0x2'));var BPromise=require(_0x1ef8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ef8('0x4'));var db=require(_0x1ef8('0x5'))['db'];var utils=require(_0x1ef8('0x6'));var logger=require(_0x1ef8('0x7'))(_0x1ef8('0x8'));var config=require(_0x1ef8('0x9'));var jayson=require(_0x1ef8('0xa'));var client=jayson[_0x1ef8('0xb')][_0x1ef8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x300e97,_0x118a78,_0x1636f7){return new BPromise(function(_0x42071d,_0xdef971){return client[_0x1ef8('0xd')](_0x300e97,_0x1636f7)[_0x1ef8('0xe')](function(_0x37a6a1){logger[_0x1ef8('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x118a78,_0x1ef8('0x10'));logger[_0x1ef8('0x11')](_0x1ef8('0x12'),_0x118a78,_0x1ef8('0x10'),JSON['stringify'](_0x37a6a1));if(_0x37a6a1[_0x1ef8('0x13')]){if(_0x37a6a1[_0x1ef8('0x13')][_0x1ef8('0x14')]===0x1f4){logger['error'](_0x1ef8('0x15'),_0x118a78,_0x37a6a1['error'][_0x1ef8('0x16')]);return _0xdef971(_0x37a6a1[_0x1ef8('0x13')][_0x1ef8('0x16')]);}logger[_0x1ef8('0x13')](_0x1ef8('0x15'),_0x118a78,_0x37a6a1['error'][_0x1ef8('0x16')]);return _0x42071d(_0x37a6a1['error'][_0x1ef8('0x16')]);}else{logger[_0x1ef8('0xf')](_0x1ef8('0x15'),_0x118a78,_0x1ef8('0x10'));_0x42071d(_0x37a6a1['result'][_0x1ef8('0x16')]);}})[_0x1ef8('0x17')](function(_0x43cb59){logger[_0x1ef8('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x118a78,_0x43cb59);_0xdef971(_0x43cb59);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 132ce48..d3ccf4a 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 _0x5359=['show','post','create','put','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x5246a1,_0x17e856){var _0x4583c3=function(_0x22cbd5){while(--_0x22cbd5){_0x5246a1['push'](_0x5246a1['shift']());}};_0x4583c3(++_0x17e856);}(_0x5359,0x1e5));var _0x9535=function(_0x16b7db,_0x305557){_0x16b7db=_0x16b7db-0x0;var _0x101f5f=_0x5359[_0x16b7db];return _0x101f5f;};'use strict';var multer=require(_0x9535('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9535('0x1'));var router=express['Router']();var fs_extra=require(_0x9535('0x2'));var auth=require(_0x9535('0x3'));var interaction=require(_0x9535('0x4'));var config=require('../../config/environment');var controller=require(_0x9535('0x5'));router[_0x9535('0x6')]('/',auth[_0x9535('0x7')](),controller[_0x9535('0x8')]);router['get'](_0x9535('0x9'),auth[_0x9535('0x7')](),controller[_0x9535('0xa')]);router[_0x9535('0xb')]('/',auth['isAuthenticated'](),controller[_0x9535('0xc')]);router[_0x9535('0xd')]('/:id',auth[_0x9535('0x7')](),controller['update']);router['delete'](_0x9535('0x9'),auth[_0x9535('0x7')](),controller[_0x9535('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc9c4=['get','isAuthenticated','/:id','post','create','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc9c4,0x137));var _0x4c9c=function(_0x47b4f7,_0x1033e1){_0x47b4f7=_0x47b4f7-0x0;var _0x246f35=_0xc9c4[_0x47b4f7];return _0x246f35;};'use strict';var multer=require(_0x4c9c('0x0'));var util=require(_0x4c9c('0x1'));var path=require(_0x4c9c('0x2'));var timeout=require(_0x4c9c('0x3'));var express=require('express');var router=express[_0x4c9c('0x4')]();var fs_extra=require(_0x4c9c('0x5'));var auth=require(_0x4c9c('0x6'));var interaction=require(_0x4c9c('0x7'));var config=require(_0x4c9c('0x8'));var controller=require('./intVtigerField.controller');router[_0x4c9c('0x9')]('/',auth[_0x4c9c('0xa')](),controller['index']);router[_0x4c9c('0x9')](_0x4c9c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4c9c('0xc')]('/',auth[_0x4c9c('0xa')](),controller[_0x4c9c('0xd')]);router['put'](_0x4c9c('0xb'),auth['isAuthenticated'](),controller[_0x4c9c('0xe')]);router[_0x4c9c('0xf')](_0x4c9c('0xb'),auth[_0x4c9c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 04124cc..0901c2b 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 _0x7765=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5d546b,_0x377cd2){var _0x4ac044=function(_0xc57c83){while(--_0xc57c83){_0x5d546b['push'](_0x5d546b['shift']());}};_0x4ac044(++_0x377cd2);}(_0x7765,0xc8));var _0x5776=function(_0x3a680b,_0x24d41b){_0x3a680b=_0x3a680b-0x0;var _0x2287dd=_0x7765[_0x3a680b];return _0x2287dd;};'use strict';var Sequelize=require(_0x5776('0x0'));module[_0x5776('0x1')]={'type':{'type':Sequelize[_0x5776('0x2')](_0x5776('0x3'),_0x5776('0x4'),_0x5776('0x5'),_0x5776('0x6'),_0x5776('0x7')),'defaultValue':_0x5776('0x3')},'content':{'type':Sequelize[_0x5776('0x8')]},'key':{'type':Sequelize[_0x5776('0x8')]},'keyType':{'type':Sequelize[_0x5776('0x2')](_0x5776('0x3'),_0x5776('0x4'),_0x5776('0x5'))},'keyContent':{'type':Sequelize[_0x5776('0x8')]},'idField':{'type':Sequelize[_0x5776('0x8')]},'nameField':{'type':Sequelize[_0x5776('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5776('0x8')]}}; \ No newline at end of file +var _0x7af3=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x7af3,0x143));var _0x37af=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7af3[_0x279d37];return _0x530173;};'use strict';var Sequelize=require(_0x37af('0x0'));module[_0x37af('0x1')]={'type':{'type':Sequelize['ENUM'](_0x37af('0x2'),_0x37af('0x3'),_0x37af('0x4'),_0x37af('0x5'),_0x37af('0x6')),'defaultValue':_0x37af('0x2')},'content':{'type':Sequelize[_0x37af('0x7')]},'key':{'type':Sequelize[_0x37af('0x7')]},'keyType':{'type':Sequelize[_0x37af('0x8')](_0x37af('0x2'),'variable',_0x37af('0x4'))},'keyContent':{'type':Sequelize[_0x37af('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x37af('0x7')]},'customField':{'type':Sequelize[_0x37af('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x37af('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5efc213..6b276e0 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 _0x37c8=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5a56e9,_0x4d2f90){var _0x3d463d=function(_0x5e624b){while(--_0x5e624b){_0x5a56e9['push'](_0x5a56e9['shift']());}};_0x3d463d(++_0x4d2f90);}(_0x37c8,0x114));var _0x837c=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x37c8[_0x55c485];return _0x6bb521;};'use strict';var emlformat=require(_0x837c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x837c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x837c('0x2'));var BPromise=require(_0x837c('0x3'));var Mustache=require(_0x837c('0x4'));var util=require(_0x837c('0x5'));var path=require(_0x837c('0x6'));var sox=require(_0x837c('0x7'));var csv=require(_0x837c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x837c('0x9'));var squel=require('squel');var crypto=require(_0x837c('0xa'));var jsforce=require(_0x837c('0xb'));var deskjs=require(_0x837c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x837c('0xd'));var Papa=require(_0x837c('0xe'));var Redis=require('ioredis');var authService=require(_0x837c('0xf'));var qs=require(_0x837c('0x10'));var as=require(_0x837c('0x11'));var hardwareService=require(_0x837c('0x12'));var logger=require(_0x837c('0x13'))(_0x837c('0x14'));var utils=require(_0x837c('0x15'));var config=require(_0x837c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x837c('0x17'))['db'];function respondWithStatusCode(_0x17bbfc,_0x4940cd){_0x4940cd=_0x4940cd||0xcc;return function(_0x47e171){if(_0x47e171){return _0x17bbfc[_0x837c('0x18')](_0x4940cd);}return _0x17bbfc[_0x837c('0x19')](_0x4940cd)[_0x837c('0x1a')]();};}function respondWithResult(_0x157668,_0x4022a4){_0x4022a4=_0x4022a4||0xc8;return function(_0x2cee68){if(_0x2cee68){return _0x157668[_0x837c('0x19')](_0x4022a4)[_0x837c('0x1b')](_0x2cee68);}};}function respondWithFilteredResult(_0x25f37d,_0x13183d){return function(_0x15dcb5){if(_0x15dcb5){var _0x5103a1=typeof _0x13183d[_0x837c('0x1c')]===_0x837c('0x1d')&&typeof _0x13183d[_0x837c('0x1e')]===_0x837c('0x1d');var _0x52aa99=_0x15dcb5['count'];var _0x3f455c=_0x5103a1?0x0:_0x13183d['offset'];var _0xc6a71=_0x5103a1?_0x15dcb5[_0x837c('0x1f')]:_0x13183d[_0x837c('0x1c')]+_0x13183d[_0x837c('0x1e')];var _0x531c0f;if(_0xc6a71>=_0x52aa99){_0xc6a71=_0x52aa99;_0x531c0f=0xc8;}else{_0x531c0f=0xce;}_0x25f37d['status'](_0x531c0f);return _0x25f37d[_0x837c('0x20')](_0x837c('0x21'),_0x3f455c+'-'+_0xc6a71+'/'+_0x52aa99)[_0x837c('0x1b')](_0x15dcb5);}return null;};}function patchUpdates(_0x344dee){return function(_0x46d1ca){try{jsonpatch[_0x837c('0x22')](_0x46d1ca,_0x344dee,!![]);}catch(_0x59d76d){return BPromise[_0x837c('0x23')](_0x59d76d);}return _0x46d1ca[_0x837c('0x24')]();};}function saveUpdates(_0x1b469a,_0x2fb1c5){return function(_0x55227c){if(_0x55227c){return _0x55227c[_0x837c('0x25')](_0x1b469a)[_0x837c('0x26')](function(_0x4aafe0){return _0x4aafe0;});}return null;};}function removeEntity(_0x24299b,_0xed0363){return function(_0xb4fcd7){if(_0xb4fcd7){return _0xb4fcd7[_0x837c('0x27')]()[_0x837c('0x26')](function(){_0x24299b[_0x837c('0x19')](0xcc)[_0x837c('0x1a')]();});}};}function handleEntityNotFound(_0x3bbf5e,_0x42ba26){return function(_0x26840e){if(!_0x26840e){_0x3bbf5e['sendStatus'](0x194);}return _0x26840e;};}function handleError(_0x51720e,_0x578fd1){_0x578fd1=_0x578fd1||0x1f4;return function(_0x4545e9){logger[_0x837c('0x28')](_0x4545e9['stack']);if(_0x4545e9[_0x837c('0x29')]){delete _0x4545e9['name'];}_0x51720e['status'](_0x578fd1)[_0x837c('0x2a')](_0x4545e9);};}exports[_0x837c('0x2b')]=function(_0x43b1c6,_0x5356ec){var _0xa27c33={},_0x31b78d={},_0x58331a={'count':0x0,'rows':[]};var _0x532f8f=_[_0x837c('0x2c')](db[_0x837c('0x2d')][_0x837c('0x2e')],function(_0x3888e4){return{'name':_0x3888e4[_0x837c('0x2f')],'type':_0x3888e4['type'][_0x837c('0x30')]};});_0x31b78d['model']=_[_0x837c('0x2c')](_0x532f8f,_0x837c('0x29'));_0x31b78d[_0x837c('0x31')]=_[_0x837c('0x32')](_0x43b1c6[_0x837c('0x31')]);_0x31b78d[_0x837c('0x33')]=_[_0x837c('0x34')](_0x31b78d['model'],_0x31b78d['query']);_0xa27c33[_0x837c('0x35')]=_[_0x837c('0x34')](_0x31b78d[_0x837c('0x36')],qs[_0x837c('0x37')](_0x43b1c6[_0x837c('0x31')]['fields']));_0xa27c33[_0x837c('0x35')]=_0xa27c33[_0x837c('0x35')][_0x837c('0x38')]?_0xa27c33[_0x837c('0x35')]:_0x31b78d[_0x837c('0x36')];if(!_0x43b1c6['query'][_0x837c('0x39')](_0x837c('0x3a'))){_0xa27c33[_0x837c('0x1e')]=qs[_0x837c('0x1e')](_0x43b1c6[_0x837c('0x31')][_0x837c('0x1e')]);_0xa27c33['offset']=qs[_0x837c('0x1c')](_0x43b1c6['query'][_0x837c('0x1c')]);}_0xa27c33[_0x837c('0x3b')]=qs[_0x837c('0x3c')](_0x43b1c6['query'][_0x837c('0x3c')]);_0xa27c33['where']=qs[_0x837c('0x33')](_[_0x837c('0x3d')](_0x43b1c6['query'],_0x31b78d[_0x837c('0x33')]),_0x532f8f);if(_0x43b1c6[_0x837c('0x31')]['filter']){_0xa27c33['where']=_[_0x837c('0x3e')](_0xa27c33[_0x837c('0x3f')],{'$or':_['map'](_0x532f8f,function(_0x3798a0){if(_0x3798a0['type']!=='VIRTUAL'){var _0x1003c={};_0x1003c[_0x3798a0[_0x837c('0x29')]]={'$like':'%'+_0x43b1c6[_0x837c('0x31')]['filter']+'%'};return _0x1003c;}})});}_0xa27c33=_[_0x837c('0x3e')]({},_0xa27c33,_0x43b1c6[_0x837c('0x40')]);var _0x43511f={'where':_0xa27c33[_0x837c('0x3f')]};return db[_0x837c('0x2d')]['count'](_0x43511f)[_0x837c('0x26')](function(_0x46fb8e){_0x58331a[_0x837c('0x1f')]=_0x46fb8e;if(_0x43b1c6['query'][_0x837c('0x41')]){_0xa27c33[_0x837c('0x42')]=[{'all':!![]}];}return db[_0x837c('0x2d')][_0x837c('0x43')](_0xa27c33);})['then'](function(_0x25f7e9){_0x58331a['rows']=_0x25f7e9;return _0x58331a;})[_0x837c('0x26')](respondWithFilteredResult(_0x5356ec,_0xa27c33))[_0x837c('0x44')](handleError(_0x5356ec,null));};exports[_0x837c('0x45')]=function(_0x3d75fe,_0x237b61){var _0x28592c={'raw':!![],'where':{'id':_0x3d75fe[_0x837c('0x46')]['id']}},_0x317290={};_0x317290['model']=_[_0x837c('0x32')](db[_0x837c('0x2d')][_0x837c('0x2e')]);_0x317290[_0x837c('0x31')]=_['keys'](_0x3d75fe[_0x837c('0x31')]);_0x317290[_0x837c('0x33')]=_['intersection'](_0x317290['model'],_0x317290['query']);_0x28592c[_0x837c('0x35')]=_[_0x837c('0x34')](_0x317290['model'],qs[_0x837c('0x37')](_0x3d75fe[_0x837c('0x31')]['fields']));_0x28592c[_0x837c('0x35')]=_0x28592c[_0x837c('0x35')][_0x837c('0x38')]?_0x28592c['attributes']:_0x317290['model'];if(_0x3d75fe[_0x837c('0x31')][_0x837c('0x41')]){_0x28592c[_0x837c('0x42')]=[{'all':!![]}];}_0x28592c=_[_0x837c('0x3e')]({},_0x28592c,_0x3d75fe['options']);return db[_0x837c('0x2d')][_0x837c('0x47')](_0x28592c)[_0x837c('0x26')](handleEntityNotFound(_0x237b61,null))['then'](respondWithResult(_0x237b61,null))[_0x837c('0x44')](handleError(_0x237b61,null));};exports[_0x837c('0x48')]=function(_0x39fc92,_0x149720){return db[_0x837c('0x2d')][_0x837c('0x48')](_0x39fc92[_0x837c('0x49')],{})[_0x837c('0x26')](respondWithResult(_0x149720,0xc9))[_0x837c('0x44')](handleError(_0x149720,null));};exports['update']=function(_0x402dd0,_0x513e1b){if(_0x402dd0['body']['id']){delete _0x402dd0[_0x837c('0x49')]['id'];}return db['VtigerField'][_0x837c('0x47')]({'where':{'id':_0x402dd0[_0x837c('0x46')]['id']}})[_0x837c('0x26')](handleEntityNotFound(_0x513e1b,null))[_0x837c('0x26')](saveUpdates(_0x402dd0[_0x837c('0x49')],null))['then'](respondWithResult(_0x513e1b,null))[_0x837c('0x44')](handleError(_0x513e1b,null));};exports[_0x837c('0x27')]=function(_0x470f8d,_0x511df5){return db[_0x837c('0x2d')][_0x837c('0x47')]({'where':{'id':_0x470f8d['params']['id']}})['then'](handleEntityNotFound(_0x511df5,null))[_0x837c('0x26')](removeEntity(_0x511df5,null))[_0x837c('0x44')](handleError(_0x511df5,null));}; \ No newline at end of file +var _0xc774=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','map','VtigerField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc774,0x19b));var _0x4c77=function(_0x4b447a,_0x4c3db4){_0x4b447a=_0x4b447a-0x0;var _0xef8968=_0xc774[_0x4b447a];return _0xef8968;};'use strict';var emlformat=require(_0x4c77('0x0'));var rimraf=require(_0x4c77('0x1'));var zipdir=require(_0x4c77('0x2'));var jsonpatch=require(_0x4c77('0x3'));var rp=require(_0x4c77('0x4'));var moment=require('moment');var BPromise=require(_0x4c77('0x5'));var Mustache=require('mustache');var util=require(_0x4c77('0x6'));var path=require(_0x4c77('0x7'));var sox=require(_0x4c77('0x8'));var csv=require(_0x4c77('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c77('0xa'));var _=require(_0x4c77('0xb'));var squel=require(_0x4c77('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c77('0xd'));var deskjs=require(_0x4c77('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c77('0xf'));var Redis=require(_0x4c77('0x10'));var authService=require(_0x4c77('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c77('0x12'))(_0x4c77('0x13'));var utils=require(_0x4c77('0x14'));var config=require(_0x4c77('0x15'));var licenseUtil=require(_0x4c77('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a585b,_0x10ffda){_0x10ffda=_0x10ffda||0xcc;return function(_0x51a328){if(_0x51a328){return _0x1a585b['sendStatus'](_0x10ffda);}return _0x1a585b[_0x4c77('0x17')](_0x10ffda)[_0x4c77('0x18')]();};}function respondWithResult(_0xb49aaa,_0x52ca35){_0x52ca35=_0x52ca35||0xc8;return function(_0x4ea3b5){if(_0x4ea3b5){return _0xb49aaa[_0x4c77('0x17')](_0x52ca35)[_0x4c77('0x19')](_0x4ea3b5);}};}function respondWithFilteredResult(_0x4030bc,_0x2e60e5){return function(_0x1a37fc){if(_0x1a37fc){var _0x336074=typeof _0x2e60e5[_0x4c77('0x1a')]===_0x4c77('0x1b')&&typeof _0x2e60e5[_0x4c77('0x1c')]===_0x4c77('0x1b');var _0x5da5f9=_0x1a37fc[_0x4c77('0x1d')];var _0x30c9d6=_0x336074?0x0:_0x2e60e5[_0x4c77('0x1a')];var _0x2e0c2e=_0x336074?_0x1a37fc[_0x4c77('0x1d')]:_0x2e60e5[_0x4c77('0x1a')]+_0x2e60e5['limit'];var _0x361f66;if(_0x2e0c2e>=_0x5da5f9){_0x2e0c2e=_0x5da5f9;_0x361f66=0xc8;}else{_0x361f66=0xce;}_0x4030bc[_0x4c77('0x17')](_0x361f66);return _0x4030bc['set'](_0x4c77('0x1e'),_0x30c9d6+'-'+_0x2e0c2e+'/'+_0x5da5f9)[_0x4c77('0x19')](_0x1a37fc);}return null;};}function patchUpdates(_0x35aceb){return function(_0x3f0070){try{jsonpatch[_0x4c77('0x1f')](_0x3f0070,_0x35aceb,!![]);}catch(_0xbc0c9){return BPromise[_0x4c77('0x20')](_0xbc0c9);}return _0x3f0070['save']();};}function saveUpdates(_0x5ed301,_0x542264){return function(_0x49e13b){if(_0x49e13b){return _0x49e13b['update'](_0x5ed301)[_0x4c77('0x21')](function(_0xbb1c31){return _0xbb1c31;});}return null;};}function removeEntity(_0x25bf8c,_0x5eb458){return function(_0x5828e8){if(_0x5828e8){return _0x5828e8[_0x4c77('0x22')]()[_0x4c77('0x21')](function(){_0x25bf8c[_0x4c77('0x17')](0xcc)[_0x4c77('0x18')]();});}};}function handleEntityNotFound(_0xf953ad,_0x4b34d3){return function(_0x59216c){if(!_0x59216c){_0xf953ad[_0x4c77('0x23')](0x194);}return _0x59216c;};}function handleError(_0xf198b1,_0x4fdb2e){_0x4fdb2e=_0x4fdb2e||0x1f4;return function(_0x5614d0){logger[_0x4c77('0x24')](_0x5614d0[_0x4c77('0x25')]);if(_0x5614d0[_0x4c77('0x26')]){delete _0x5614d0['name'];}_0xf198b1[_0x4c77('0x17')](_0x4fdb2e)['send'](_0x5614d0);};}exports['index']=function(_0x419d30,_0x39abf2){var _0x55ef04={},_0x5a6d16={},_0x326a2b={'count':0x0,'rows':[]};var _0x1ed15b=_[_0x4c77('0x27')](db[_0x4c77('0x28')]['rawAttributes'],function(_0x5551a0){return{'name':_0x5551a0[_0x4c77('0x29')],'type':_0x5551a0[_0x4c77('0x2a')][_0x4c77('0x2b')]};});_0x5a6d16[_0x4c77('0x2c')]=_['map'](_0x1ed15b,'name');_0x5a6d16[_0x4c77('0x2d')]=_[_0x4c77('0x2e')](_0x419d30[_0x4c77('0x2d')]);_0x5a6d16['filters']=_[_0x4c77('0x2f')](_0x5a6d16[_0x4c77('0x2c')],_0x5a6d16['query']);_0x55ef04[_0x4c77('0x30')]=_[_0x4c77('0x2f')](_0x5a6d16['model'],qs['fields'](_0x419d30[_0x4c77('0x2d')][_0x4c77('0x31')]));_0x55ef04[_0x4c77('0x30')]=_0x55ef04[_0x4c77('0x30')][_0x4c77('0x32')]?_0x55ef04[_0x4c77('0x30')]:_0x5a6d16['model'];if(!_0x419d30[_0x4c77('0x2d')][_0x4c77('0x33')]('nolimit')){_0x55ef04[_0x4c77('0x1c')]=qs[_0x4c77('0x1c')](_0x419d30['query'][_0x4c77('0x1c')]);_0x55ef04['offset']=qs[_0x4c77('0x1a')](_0x419d30[_0x4c77('0x2d')][_0x4c77('0x1a')]);}_0x55ef04[_0x4c77('0x34')]=qs[_0x4c77('0x35')](_0x419d30[_0x4c77('0x2d')]['sort']);_0x55ef04[_0x4c77('0x36')]=qs[_0x4c77('0x37')](_[_0x4c77('0x38')](_0x419d30[_0x4c77('0x2d')],_0x5a6d16[_0x4c77('0x37')]),_0x1ed15b);if(_0x419d30['query'][_0x4c77('0x39')]){_0x55ef04[_0x4c77('0x36')]=_[_0x4c77('0x3a')](_0x55ef04['where'],{'$or':_[_0x4c77('0x27')](_0x1ed15b,function(_0x2ca08e){if(_0x2ca08e[_0x4c77('0x2a')]!==_0x4c77('0x3b')){var _0x57905c={};_0x57905c[_0x2ca08e[_0x4c77('0x26')]]={'$like':'%'+_0x419d30[_0x4c77('0x2d')][_0x4c77('0x39')]+'%'};return _0x57905c;}})});}_0x55ef04=_[_0x4c77('0x3a')]({},_0x55ef04,_0x419d30[_0x4c77('0x3c')]);var _0x29dbd8={'where':_0x55ef04[_0x4c77('0x36')]};return db[_0x4c77('0x28')][_0x4c77('0x1d')](_0x29dbd8)[_0x4c77('0x21')](function(_0x38b55c){_0x326a2b[_0x4c77('0x1d')]=_0x38b55c;if(_0x419d30[_0x4c77('0x2d')][_0x4c77('0x3d')]){_0x55ef04[_0x4c77('0x3e')]=[{'all':!![]}];}return db[_0x4c77('0x28')][_0x4c77('0x3f')](_0x55ef04);})[_0x4c77('0x21')](function(_0x253b93){_0x326a2b[_0x4c77('0x40')]=_0x253b93;return _0x326a2b;})['then'](respondWithFilteredResult(_0x39abf2,_0x55ef04))['catch'](handleError(_0x39abf2,null));};exports[_0x4c77('0x41')]=function(_0x477697,_0x48e022){var _0x158a78={'raw':!![],'where':{'id':_0x477697[_0x4c77('0x42')]['id']}},_0x2f2cfa={};_0x2f2cfa[_0x4c77('0x2c')]=_[_0x4c77('0x2e')](db[_0x4c77('0x28')]['rawAttributes']);_0x2f2cfa[_0x4c77('0x2d')]=_[_0x4c77('0x2e')](_0x477697[_0x4c77('0x2d')]);_0x2f2cfa[_0x4c77('0x37')]=_['intersection'](_0x2f2cfa['model'],_0x2f2cfa[_0x4c77('0x2d')]);_0x158a78[_0x4c77('0x30')]=_['intersection'](_0x2f2cfa[_0x4c77('0x2c')],qs[_0x4c77('0x31')](_0x477697['query'][_0x4c77('0x31')]));_0x158a78[_0x4c77('0x30')]=_0x158a78[_0x4c77('0x30')][_0x4c77('0x32')]?_0x158a78[_0x4c77('0x30')]:_0x2f2cfa[_0x4c77('0x2c')];if(_0x477697[_0x4c77('0x2d')][_0x4c77('0x3d')]){_0x158a78[_0x4c77('0x3e')]=[{'all':!![]}];}_0x158a78=_[_0x4c77('0x3a')]({},_0x158a78,_0x477697[_0x4c77('0x3c')]);return db[_0x4c77('0x28')][_0x4c77('0x43')](_0x158a78)[_0x4c77('0x21')](handleEntityNotFound(_0x48e022,null))['then'](respondWithResult(_0x48e022,null))[_0x4c77('0x44')](handleError(_0x48e022,null));};exports['create']=function(_0x1d94af,_0x22edb9){return db[_0x4c77('0x28')][_0x4c77('0x45')](_0x1d94af[_0x4c77('0x46')],{})[_0x4c77('0x21')](respondWithResult(_0x22edb9,0xc9))[_0x4c77('0x44')](handleError(_0x22edb9,null));};exports[_0x4c77('0x47')]=function(_0x4a2e4e,_0x3d58fd){if(_0x4a2e4e[_0x4c77('0x46')]['id']){delete _0x4a2e4e[_0x4c77('0x46')]['id'];}return db['VtigerField'][_0x4c77('0x43')]({'where':{'id':_0x4a2e4e[_0x4c77('0x42')]['id']}})[_0x4c77('0x21')](handleEntityNotFound(_0x3d58fd,null))[_0x4c77('0x21')](saveUpdates(_0x4a2e4e[_0x4c77('0x46')],null))['then'](respondWithResult(_0x3d58fd,null))['catch'](handleError(_0x3d58fd,null));};exports[_0x4c77('0x22')]=function(_0x38656c,_0xd601da){return db[_0x4c77('0x28')][_0x4c77('0x43')]({'where':{'id':_0x38656c['params']['id']}})[_0x4c77('0x21')](handleEntityNotFound(_0xd601da,null))[_0x4c77('0x21')](removeEntity(_0xd601da,null))['catch'](handleError(_0xd601da,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f16b8e8..c7d4f78 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 _0xc617=['exports','VtigerField','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x1c2f21,_0x268cdd){var _0x48e6da=function(_0x967920){while(--_0x967920){_0x1c2f21['push'](_0x1c2f21['shift']());}};_0x48e6da(++_0x268cdd);}(_0xc617,0x9a));var _0x7c61=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0xc617[_0x20fdc1];return _0x25397c;};'use strict';var _=require('lodash');var util=require(_0x7c61('0x0'));var logger=require('../../config/logger')(_0x7c61('0x1'));var moment=require(_0x7c61('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c61('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c61('0x4'));var config=require(_0x7c61('0x5'));var attributes=require('./intVtigerField.attributes');module[_0x7c61('0x6')]=function(_0x86982,_0x230882){return _0x86982['define'](_0x7c61('0x7'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6c3=['api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','vtiger_unique_index','idField','../../config/logger'];(function(_0xb61211,_0x2a2adc){var _0x1868b2=function(_0x4c5496){while(--_0x4c5496){_0xb61211['push'](_0xb61211['shift']());}};_0x1868b2(++_0x2a2adc);}(_0xc6c3,0x6d));var _0x3c6c=function(_0x655a56,_0x3c369c){_0x655a56=_0x655a56-0x0;var _0x4dafce=_0xc6c3[_0x655a56];return _0x4dafce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c6c('0x0'))(_0x3c6c('0x1'));var moment=require(_0x3c6c('0x2'));var BPromise=require('bluebird');var rp=require(_0x3c6c('0x3'));var fs=require('fs');var path=require(_0x3c6c('0x4'));var rimraf=require(_0x3c6c('0x5'));var config=require(_0x3c6c('0x6'));var attributes=require(_0x3c6c('0x7'));module['exports']=function(_0x5b623a,_0x24a926){return _0x5b623a['define'](_0x3c6c('0x8'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x3c6c('0x9'),'fields':[_0x3c6c('0xa'),'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 41e0b0e..54e28ef 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 _0xadca=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','request\x20sent','debug'];(function(_0x1702b8,_0x28c7da){var _0x50028a=function(_0x4135b1){while(--_0x4135b1){_0x1702b8['push'](_0x1702b8['shift']());}};_0x50028a(++_0x28c7da);}(_0xadca,0xfa));var _0xaadc=function(_0x3e451f,_0x10500d){_0x3e451f=_0x3e451f-0x0;var _0x57978f=_0xadca[_0x3e451f];return _0x57978f;};'use strict';var _=require(_0xaadc('0x0'));var util=require(_0xaadc('0x1'));var moment=require(_0xaadc('0x2'));var BPromise=require('bluebird');var rs=require(_0xaadc('0x3'));var fs=require('fs');var Redis=require(_0xaadc('0x4'));var db=require(_0xaadc('0x5'))['db'];var utils=require(_0xaadc('0x6'));var logger=require(_0xaadc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaadc('0x8')][_0xaadc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32b04d,_0x3d3e31,_0x1eaf82){return new BPromise(function(_0x43fcc2,_0x20fd62){return client[_0xaadc('0xa')](_0x32b04d,_0x1eaf82)[_0xaadc('0xb')](function(_0x498d81){logger['info']('VtigerField,\x20%s,\x20%s',_0x3d3e31,_0xaadc('0xc'));logger[_0xaadc('0xd')](_0xaadc('0xe'),_0x3d3e31,_0xaadc('0xc'),JSON[_0xaadc('0xf')](_0x498d81));if(_0x498d81[_0xaadc('0x10')]){if(_0x498d81[_0xaadc('0x10')]['code']===0x1f4){logger['error'](_0xaadc('0x11'),_0x3d3e31,_0x498d81['error'][_0xaadc('0x12')]);return _0x20fd62(_0x498d81['error'][_0xaadc('0x12')]);}logger[_0xaadc('0x10')](_0xaadc('0x11'),_0x3d3e31,_0x498d81[_0xaadc('0x10')][_0xaadc('0x12')]);return _0x43fcc2(_0x498d81[_0xaadc('0x10')][_0xaadc('0x12')]);}else{logger[_0xaadc('0x13')]('VtigerField,\x20%s,\x20%s',_0x3d3e31,_0xaadc('0xc'));_0x43fcc2(_0x498d81[_0xaadc('0x14')]['message']);}})[_0xaadc('0x15')](function(_0x562327){logger[_0xaadc('0x10')](_0xaadc('0x11'),_0x3d3e31,_0x562327);_0x20fd62(_0x562327);});});} \ No newline at end of file +var _0x4a04=['../../config/logger','jayson/promise','client','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','VtigerField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x4e928c,_0x509f7a){var _0x4cb2cf=function(_0x17db67){while(--_0x17db67){_0x4e928c['push'](_0x4e928c['shift']());}};_0x4cb2cf(++_0x509f7a);}(_0x4a04,0x18c));var _0x44a0=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x4a04[_0x737a1f];return _0x16eba1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44a0('0x0'));var BPromise=require(_0x44a0('0x1'));var rs=require(_0x44a0('0x2'));var fs=require('fs');var Redis=require(_0x44a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x44a0('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x44a0('0x5'));var client=jayson[_0x44a0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x551d57,_0x25ffa1,_0x36d4db){return new BPromise(function(_0x52d9bb,_0x482432){return client['request'](_0x551d57,_0x36d4db)[_0x44a0('0x7')](function(_0x304eab){logger[_0x44a0('0x8')]('VtigerField,\x20%s,\x20%s',_0x25ffa1,_0x44a0('0x9'));logger[_0x44a0('0xa')](_0x44a0('0xb'),_0x25ffa1,'request\x20sent',JSON['stringify'](_0x304eab));if(_0x304eab[_0x44a0('0xc')]){if(_0x304eab[_0x44a0('0xc')]['code']===0x1f4){logger['error'](_0x44a0('0xd'),_0x25ffa1,_0x304eab['error']['message']);return _0x482432(_0x304eab[_0x44a0('0xc')]['message']);}logger[_0x44a0('0xc')]('VtigerField,\x20%s,\x20%s',_0x25ffa1,_0x304eab[_0x44a0('0xc')]['message']);return _0x52d9bb(_0x304eab[_0x44a0('0xc')][_0x44a0('0xe')]);}else{logger[_0x44a0('0x8')](_0x44a0('0xd'),_0x25ffa1,'request\x20sent');_0x52d9bb(_0x304eab[_0x44a0('0xf')][_0x44a0('0xe')]);}})['catch'](function(_0x52971b){logger[_0x44a0('0xc')](_0x44a0('0xd'),_0x25ffa1,_0x52971b);_0x482432(_0x52971b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9feda7c..31e7e12 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 _0xaaaf=['get','isAuthenticated','index','getConfigurations','getFields','post','create','put','/:id','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x160c42,_0x383a96){var _0xcc4c25=function(_0x6e66fd){while(--_0x6e66fd){_0x160c42['push'](_0x160c42['shift']());}};_0xcc4c25(++_0x383a96);}(_0xaaaf,0x108));var _0xfaaa=function(_0x1bfebb,_0x3f2d72){_0x1bfebb=_0x1bfebb-0x0;var _0x29f205=_0xaaaf[_0x1bfebb];return _0x29f205;};'use strict';var multer=require('multer');var util=require(_0xfaaa('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfaaa('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xfaaa('0x2'));var interaction=require(_0xfaaa('0x3'));var config=require(_0xfaaa('0x4'));var controller=require(_0xfaaa('0x5'));router[_0xfaaa('0x6')]('/',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0x8')]);router[_0xfaaa('0x6')]('/:id',auth[_0xfaaa('0x7')](),controller['show']);router[_0xfaaa('0x6')]('/:id/configurations',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0x9')]);router['get']('/:id/fields',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0xa')]);router[_0xfaaa('0xb')]('/',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0xc')]);router[_0xfaaa('0xb')]('/:id/configurations',auth[_0xfaaa('0x7')](),controller['addConfiguration']);router[_0xfaaa('0xd')](_0xfaaa('0xe'),auth[_0xfaaa('0x7')](),controller[_0xfaaa('0xf')]);router['delete'](_0xfaaa('0xe'),auth[_0xfaaa('0x7')](),controller[_0xfaaa('0x10')]);module[_0xfaaa('0x11')]=router; \ No newline at end of file +var _0xff5b=['isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','put','delete','destroy','path','express','../../components/auth/service','../../config/environment','get'];(function(_0x1947d7,_0x2d4f06){var _0x3a949f=function(_0x451c25){while(--_0x451c25){_0x1947d7['push'](_0x1947d7['shift']());}};_0x3a949f(++_0x2d4f06);}(_0xff5b,0x1e8));var _0xbff5=function(_0x36d14c,_0x1c2ef8){_0x36d14c=_0x36d14c-0x0;var _0x24cd2d=_0xff5b[_0x36d14c];return _0x24cd2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbff5('0x0'));var timeout=require('connect-timeout');var express=require(_0xbff5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbff5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xbff5('0x3'));var controller=require('./intZendeskAccount.controller');router[_0xbff5('0x4')]('/',auth[_0xbff5('0x5')](),controller[_0xbff5('0x6')]);router[_0xbff5('0x4')](_0xbff5('0x7'),auth[_0xbff5('0x5')](),controller[_0xbff5('0x8')]);router[_0xbff5('0x4')]('/:id/configurations',auth[_0xbff5('0x5')](),controller[_0xbff5('0x9')]);router[_0xbff5('0x4')]('/:id/fields',auth[_0xbff5('0x5')](),controller[_0xbff5('0xa')]);router[_0xbff5('0xb')]('/',auth[_0xbff5('0x5')](),controller[_0xbff5('0xc')]);router[_0xbff5('0xb')](_0xbff5('0xd'),auth[_0xbff5('0x5')](),controller['addConfiguration']);router[_0xbff5('0xe')](_0xbff5('0x7'),auth[_0xbff5('0x5')](),controller['update']);router[_0xbff5('0xf')](_0xbff5('0x7'),auth[_0xbff5('0x5')](),controller[_0xbff5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index dfb325c..426948f 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 _0xaf5a=['username','ENUM','password','token','integrationTab','newTab','exports','STRING'];(function(_0x34fa62,_0xe0e02f){var _0x19cf42=function(_0x28779a){while(--_0x28779a){_0x34fa62['push'](_0x34fa62['shift']());}};_0x19cf42(++_0xe0e02f);}(_0xaf5a,0x116));var _0xaaf5=function(_0x5b3b6a,_0x906f49){_0x5b3b6a=_0x5b3b6a-0x0;var _0x4a9af7=_0xaf5a[_0x5b3b6a];return _0x4a9af7;};'use strict';var Sequelize=require('sequelize');module[_0xaaf5('0x0')]={'name':{'type':Sequelize[_0xaaf5('0x1')]},'description':{'type':Sequelize[_0xaaf5('0x1')]},'username':{'type':Sequelize[_0xaaf5('0x1')],'unique':_0xaaf5('0x2')},'password':{'type':Sequelize[_0xaaf5('0x1')]},'token':{'type':Sequelize[_0xaaf5('0x1')]},'remoteUri':{'type':Sequelize[_0xaaf5('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xaaf5('0x3')](_0xaaf5('0x4'),_0xaaf5('0x5')),'defaultValue':_0xaaf5('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaaf5('0x6'),_0xaaf5('0x7')),'defaultValue':_0xaaf5('0x6')}}; \ No newline at end of file +var _0x1751=['STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports'];(function(_0x4e8d4f,_0x111b0c){var _0x28fe1c=function(_0xcd6396){while(--_0xcd6396){_0x4e8d4f['push'](_0x4e8d4f['shift']());}};_0x28fe1c(++_0x111b0c);}(_0x1751,0x76));var _0x1175=function(_0x3789a6,_0x3656fe){_0x3789a6=_0x3789a6-0x0;var _0x585a6e=_0x1751[_0x3789a6];return _0x585a6e;};'use strict';var Sequelize=require(_0x1175('0x0'));module[_0x1175('0x1')]={'name':{'type':Sequelize[_0x1175('0x2')]},'description':{'type':Sequelize[_0x1175('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1175('0x3')},'password':{'type':Sequelize[_0x1175('0x2')]},'token':{'type':Sequelize[_0x1175('0x2')]},'remoteUri':{'type':Sequelize[_0x1175('0x2')],'unique':_0x1175('0x4')},'authType':{'type':Sequelize[_0x1175('0x5')](_0x1175('0x6'),_0x1175('0x7')),'defaultValue':_0x1175('0x6')},'serverUrl':{'type':Sequelize[_0x1175('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1175('0x5')](_0x1175('0x8'),_0x1175('0x9')),'defaultValue':_0x1175('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3fd34a0..3e94cea 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 _0x3f8c=['%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2f14b6,_0xa0b328){_0x2f14b6=_0x2f14b6-0x0;var _0x1b42e2=_0x3f8c[_0x2f14b6];return _0x1b42e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];var integrations=require(_0xc3f8('0x16'));function respondWithStatusCode(_0x155c80,_0x511763){_0x511763=_0x511763||0xcc;return function(_0x84f489){if(_0x84f489){return _0x155c80[_0xc3f8('0x17')](_0x511763);}return _0x155c80[_0xc3f8('0x18')](_0x511763)[_0xc3f8('0x19')]();};}function respondWithResult(_0x6155e9,_0x47754c){_0x47754c=_0x47754c||0xc8;return function(_0x29e2b6){if(_0x29e2b6){return _0x6155e9[_0xc3f8('0x18')](_0x47754c)[_0xc3f8('0x1a')](_0x29e2b6);}};}function respondWithFilteredResult(_0x2fd8e8,_0x3cb28a){return function(_0x2a9f64){if(_0x2a9f64){var _0x29d031=typeof _0x3cb28a['offset']===_0xc3f8('0x1b')&&typeof _0x3cb28a['limit']==='undefined';var _0x3df137=_0x2a9f64[_0xc3f8('0x1c')];var _0x35500f=_0x29d031?0x0:_0x3cb28a[_0xc3f8('0x1d')];var _0x47a185=_0x29d031?_0x2a9f64[_0xc3f8('0x1c')]:_0x3cb28a[_0xc3f8('0x1d')]+_0x3cb28a['limit'];var _0xe14074;if(_0x47a185>=_0x3df137){_0x47a185=_0x3df137;_0xe14074=0xc8;}else{_0xe14074=0xce;}_0x2fd8e8['status'](_0xe14074);return _0x2fd8e8[_0xc3f8('0x1e')](_0xc3f8('0x1f'),_0x35500f+'-'+_0x47a185+'/'+_0x3df137)[_0xc3f8('0x1a')](_0x2a9f64);}return null;};}function patchUpdates(_0x53ada5){return function(_0x543dca){try{jsonpatch[_0xc3f8('0x20')](_0x543dca,_0x53ada5,!![]);}catch(_0x2a7096){return BPromise[_0xc3f8('0x21')](_0x2a7096);}return _0x543dca[_0xc3f8('0x22')]();};}function saveUpdates(_0x6522e9,_0x251bf7){return function(_0x43b2b4){if(_0x43b2b4){return _0x43b2b4[_0xc3f8('0x23')](_0x6522e9)['then'](function(_0x571f92){return _0x571f92;});}return null;};}function removeEntity(_0x4b83f0,_0x2559a4){return function(_0x5e1d14){if(_0x5e1d14){return _0x5e1d14[_0xc3f8('0x24')]()[_0xc3f8('0x25')](function(){_0x4b83f0['status'](0xcc)[_0xc3f8('0x19')]();});}};}function handleEntityNotFound(_0x327b2d,_0x2d237e){return function(_0xb883b5){if(!_0xb883b5){_0x327b2d[_0xc3f8('0x17')](0x194);}return _0xb883b5;};}function handleError(_0x9d43b4,_0xf1d460){_0xf1d460=_0xf1d460||0x1f4;return function(_0x7f14ad){logger[_0xc3f8('0x26')](_0x7f14ad[_0xc3f8('0x27')]);if(_0x7f14ad[_0xc3f8('0x28')]){delete _0x7f14ad[_0xc3f8('0x28')];}_0x9d43b4[_0xc3f8('0x18')](_0xf1d460)[_0xc3f8('0x29')](_0x7f14ad);};}exports['index']=function(_0x58b303,_0x2909f8){var _0x218029={},_0x5bf6e2={},_0x151bba={'count':0x0,'rows':[]};var _0x4d39a0=_[_0xc3f8('0x2a')](db[_0xc3f8('0x2b')]['rawAttributes'],function(_0x48b32e){return{'name':_0x48b32e[_0xc3f8('0x2c')],'type':_0x48b32e[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x5bf6e2[_0xc3f8('0x2f')]=_[_0xc3f8('0x2a')](_0x4d39a0,_0xc3f8('0x28'));_0x5bf6e2[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x58b303[_0xc3f8('0x30')]);_0x5bf6e2[_0xc3f8('0x32')]=_['intersection'](_0x5bf6e2[_0xc3f8('0x2f')],_0x5bf6e2[_0xc3f8('0x30')]);_0x218029[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x5bf6e2[_0xc3f8('0x2f')],qs['fields'](_0x58b303['query'][_0xc3f8('0x35')]));_0x218029[_0xc3f8('0x33')]=_0x218029[_0xc3f8('0x33')][_0xc3f8('0x36')]?_0x218029[_0xc3f8('0x33')]:_0x5bf6e2['model'];if(!_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x218029['limit']=qs[_0xc3f8('0x39')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x218029['offset']=qs[_0xc3f8('0x1d')](_0x58b303[_0xc3f8('0x30')]['offset']);}_0x218029[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3b')]);_0x218029[_0xc3f8('0x3c')]=qs[_0xc3f8('0x32')](_['pick'](_0x58b303[_0xc3f8('0x30')],_0x5bf6e2[_0xc3f8('0x32')]),_0x4d39a0);if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3d')]){_0x218029[_0xc3f8('0x3c')]=_['merge'](_0x218029[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2a')](_0x4d39a0,function(_0xaa4c98){if(_0xaa4c98['type']!==_0xc3f8('0x3e')){var _0x83b7ab={};_0x83b7ab[_0xaa4c98[_0xc3f8('0x28')]]={'$like':'%'+_0x58b303[_0xc3f8('0x30')]['filter']+'%'};return _0x83b7ab;}})});}_0x218029=_[_0xc3f8('0x3f')]({},_0x218029,_0x58b303[_0xc3f8('0x40')]);var _0x2df096={'where':_0x218029[_0xc3f8('0x3c')]};return db['ZendeskAccount'][_0xc3f8('0x1c')](_0x2df096)['then'](function(_0x5d144b){_0x151bba[_0xc3f8('0x1c')]=_0x5d144b;if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x218029[_0xc3f8('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x218029);})[_0xc3f8('0x25')](function(_0x16805c){_0x151bba[_0xc3f8('0x43')]=_0x16805c;return _0x151bba;})[_0xc3f8('0x25')](respondWithFilteredResult(_0x2909f8,_0x218029))[_0xc3f8('0x44')](handleError(_0x2909f8,null));};exports[_0xc3f8('0x45')]=function(_0x3113b4,_0x45e6ea){var _0x13d8dc={'raw':![],'where':{'id':_0x3113b4[_0xc3f8('0x46')]['id']}},_0x34bccd={};_0x34bccd['model']=_[_0xc3f8('0x31')](db[_0xc3f8('0x2b')]['rawAttributes']);_0x34bccd[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x3113b4['query']);_0x34bccd[_0xc3f8('0x32')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],_0x34bccd[_0xc3f8('0x30')]);_0x13d8dc[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x13d8dc[_0xc3f8('0x33')]=_0x13d8dc['attributes'][_0xc3f8('0x36')]?_0x13d8dc[_0xc3f8('0x33')]:_0x34bccd['model'];if(_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x13d8dc[_0xc3f8('0x42')]=[{'all':!![]}];}_0x13d8dc=_[_0xc3f8('0x3f')]({},_0x13d8dc,_0x3113b4['options']);return db['ZendeskAccount'][_0xc3f8('0x47')](_0x13d8dc)[_0xc3f8('0x25')](handleEntityNotFound(_0x45e6ea,null))[_0xc3f8('0x25')](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));};exports[_0xc3f8('0x48')]=function(_0x3a665e,_0x418961){return db[_0xc3f8('0x2b')][_0xc3f8('0x48')](_0x3a665e['body'],{})[_0xc3f8('0x25')](respondWithResult(_0x418961,0xc9))[_0xc3f8('0x44')](handleError(_0x418961,null));};exports['update']=function(_0x1becae,_0x3fcb6a){if(_0x1becae[_0xc3f8('0x49')]['id']){delete _0x1becae[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x1becae[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcb6a,null))[_0xc3f8('0x25')](saveUpdates(_0x1becae[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x3fcb6a,null))[_0xc3f8('0x44')](handleError(_0x3fcb6a,null));};exports[_0xc3f8('0x24')]=function(_0x2448bf,_0x33e5c5){return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x2448bf[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x33e5c5,null))[_0xc3f8('0x25')](removeEntity(_0x33e5c5,null))[_0xc3f8('0x44')](handleError(_0x33e5c5,null));};exports[_0xc3f8('0x4a')]=function(_0x267c95,_0x3e6c1d,_0x3d752a){var _0x97a88e={};var _0x920f4b={};var _0x4fc02c;var _0x51249a;return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x267c95['params']['id']}})['then'](handleEntityNotFound(_0x3e6c1d,null))[_0xc3f8('0x25')](function(_0x4b4adb){if(_0x4b4adb){_0x4fc02c=_0x4b4adb;_0x920f4b[_0xc3f8('0x2f')]=_[_0xc3f8('0x31')](db[_0xc3f8('0x4c')]['rawAttributes']);_0x920f4b[_0xc3f8('0x30')]=_['keys'](_0x267c95['query']);_0x920f4b[_0xc3f8('0x32')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],_0x920f4b[_0xc3f8('0x30')]);_0x97a88e[_0xc3f8('0x33')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x97a88e[_0xc3f8('0x33')]=_0x97a88e['attributes']['length']?_0x97a88e[_0xc3f8('0x33')]:_0x920f4b[_0xc3f8('0x2f')];_0x97a88e[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x267c95[_0xc3f8('0x30')]['sort']);_0x97a88e[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x4d')](_0x267c95[_0xc3f8('0x30')],_0x920f4b[_0xc3f8('0x32')]));if(_0x267c95[_0xc3f8('0x30')]['filter']){_0x97a88e[_0xc3f8('0x3c')]=_['merge'](_0x97a88e['where'],{'$or':_['map'](_0x97a88e['attributes'],function(_0x12df02){var _0x143d50={};_0x143d50[_0x12df02]={'$like':'%'+_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x3d')]+'%'};return _0x143d50;})});}_0x97a88e=_[_0xc3f8('0x3f')]({},_0x97a88e,_0x267c95[_0xc3f8('0x40')]);return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x5250df){if(_0x5250df){_0x51249a=_0x5250df[_0xc3f8('0x36')];if(!_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x97a88e[_0xc3f8('0x39')]=qs['limit'](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x97a88e[_0xc3f8('0x1d')]=qs[_0xc3f8('0x1d')](_0x267c95[_0xc3f8('0x30')]['offset']);}return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x42b255){if(_0x42b255){return _0x42b255?{'count':_0x51249a,'rows':_0x42b255}:null;}})[_0xc3f8('0x25')](respondWithResult(_0x3e6c1d,null))[_0xc3f8('0x44')](handleError(_0x3e6c1d,null));};exports[_0xc3f8('0x4e')]=function(_0x56fd61,_0x2f199d,_0x4ca426){if(_0x56fd61[_0xc3f8('0x49')]['id']){delete _0x56fd61['body']['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x56fd61['params']['id']}})['then'](handleEntityNotFound(_0x2f199d,null))[_0xc3f8('0x25')](function(_0x2c7ab9){if(_0x2c7ab9){_0x56fd61['body'][_0xc3f8('0x4f')]=_0x2c7ab9['id'];_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x50')]=integrations[_0xc3f8('0x51')](_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x52')],_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x2d')]);_0x56fd61['body']['Descriptions']=integrations[_0xc3f8('0x53')](_0x56fd61['body']['channel'],_0x56fd61['body']['type']);return db['ZendeskConfiguration'][_0xc3f8('0x48')](_0x56fd61[_0xc3f8('0x49')],{'include':[{'model':db[_0xc3f8('0x54')],'as':_0xc3f8('0x50')},{'model':db['ZendeskField'],'as':_0xc3f8('0x55')}]});}return null;})[_0xc3f8('0x25')](respondWithResult(_0x2f199d,null))['catch'](handleError(_0x2f199d,null));};exports[_0xc3f8('0x56')]=function(_0x273faf,_0x104eec,_0x531de8){var _0xaedf89='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x273faf['params']['id']},'attributes':['id',_0xc3f8('0x57'),_0xc3f8('0x58'),'token',_0xc3f8('0x59'),_0xc3f8('0x5a')]})['then'](handleEntityNotFound(_0x104eec,null))[_0xc3f8('0x25')](function(_0x2f957a){if(_0x2f957a){_0xaedf89=_0x2f957a['remoteUri'];var _0x34edb9=_0xaedf89['slice'](-0x1);if(_0x34edb9==='/'){_0xaedf89=_0xaedf89[_0xc3f8('0x5b')](0x0,_0xaedf89[_0xc3f8('0x5c')](_0x34edb9));}var _0x4cc654={'method':'GET','uri':util[_0xc3f8('0x5d')](_0xc3f8('0x5e'),_0xaedf89,'ticket_fields'),'json':!![]};switch(_0x2f957a[_0xc3f8('0x59')]){case'password':_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x61'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x58')]))[_0xc3f8('0x62')](_0xc3f8('0x63')))};break;case _0xc3f8('0x64'):_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x65'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x64')]))['toString'](_0xc3f8('0x63')))};break;default:throw new db[(_0xc3f8('0x66'))][(_0xc3f8('0x67'))](_0xc3f8('0x68'));}return rp(_0x4cc654);}})[_0xc3f8('0x25')](function(_0x53c815){if(_0x53c815){var _0x2f69f7=[_0xc3f8('0x69'),_0xc3f8('0x6a'),'group','assignee'];_[_0xc3f8('0x6b')](_0x53c815[_0xc3f8('0x6c')],function(_0x1a9c33){return _0x2f69f7[_0xc3f8('0x6d')](_0x1a9c33['type']);});return{'count':_0x53c815[_0xc3f8('0x6c')][_0xc3f8('0x36')],'rows':_[_0xc3f8('0x2a')](_0x53c815['ticket_fields'],function(_0x2a29fa){return{'id':_0x2a29fa['id'],'name':_0x2a29fa[_0xc3f8('0x6e')]>0x7?_0x2a29fa['title']:_0x2a29fa['type'],'custom':_0x2a29fa[_0xc3f8('0x6e')]>0x7?!![]:![],'options':_0x2a29fa[_0xc3f8('0x6f')]?_0x2a29fa['system_field_options']:_0x2a29fa[_0xc3f8('0x70')]?_0x2a29fa[_0xc3f8('0x70')]:[]};})};}})['then'](respondWithResult(_0x104eec,null))[_0xc3f8('0x44')](function(_0x5f2d86){var _0x3d080a=_0x273faf['query'][_0xc3f8('0x71')]?0x1f4:_0x5f2d86[_0xc3f8('0x72')]||0x1f4;logger[_0xc3f8('0x26')](_0xc3f8('0x73'),_0xc3f8('0x56'),_0x3d080a,JSON[_0xc3f8('0x74')](_0x5f2d86));delete _0x5f2d86[_0xc3f8('0x28')];if(_0x3d080a===0x191){_0x3d080a=0x190;}_0x104eec[_0xc3f8('0x18')](_0x3d080a)[_0xc3f8('0x29')](_0x273faf['query']['test']?{'message':_0xc3f8('0x75'),'statusCode':_0x5f2d86['statusCode']}:_0x5f2d86);});}; \ No newline at end of file +var _0xe5b5=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','map','addConfiguration','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','group','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x2cfe2,_0x3b2e20){var _0x287633=function(_0x52f550){while(--_0x52f550){_0x2cfe2['push'](_0x2cfe2['shift']());}};_0x287633(++_0x3b2e20);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xe5b5[_0x490be3];return _0x3f5140;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e5b('0x1b'));function respondWithStatusCode(_0x18434e,_0x4559a0){_0x4559a0=_0x4559a0||0xcc;return function(_0x1694ff){if(_0x1694ff){return _0x18434e[_0x5e5b('0x1c')](_0x4559a0);}return _0x18434e[_0x5e5b('0x1d')](_0x4559a0)[_0x5e5b('0x1e')]();};}function respondWithResult(_0x49edd0,_0x2b37fa){_0x2b37fa=_0x2b37fa||0xc8;return function(_0x2e92c3){if(_0x2e92c3){return _0x49edd0['status'](_0x2b37fa)[_0x5e5b('0x1f')](_0x2e92c3);}};}function respondWithFilteredResult(_0x578c14,_0x4e9509){return function(_0x13a1cb){if(_0x13a1cb){var _0x444435=typeof _0x4e9509[_0x5e5b('0x20')]==='undefined'&&typeof _0x4e9509[_0x5e5b('0x21')]==='undefined';var _0x1796af=_0x13a1cb[_0x5e5b('0x22')];var _0x4c5f9a=_0x444435?0x0:_0x4e9509[_0x5e5b('0x20')];var _0x1560e1=_0x444435?_0x13a1cb[_0x5e5b('0x22')]:_0x4e9509['offset']+_0x4e9509[_0x5e5b('0x21')];var _0x3f1103;if(_0x1560e1>=_0x1796af){_0x1560e1=_0x1796af;_0x3f1103=0xc8;}else{_0x3f1103=0xce;}_0x578c14['status'](_0x3f1103);return _0x578c14[_0x5e5b('0x23')](_0x5e5b('0x24'),_0x4c5f9a+'-'+_0x1560e1+'/'+_0x1796af)[_0x5e5b('0x1f')](_0x13a1cb);}return null;};}function patchUpdates(_0x2d8252){return function(_0x2cb0bb){try{jsonpatch[_0x5e5b('0x25')](_0x2cb0bb,_0x2d8252,!![]);}catch(_0x93df5c){return BPromise[_0x5e5b('0x26')](_0x93df5c);}return _0x2cb0bb['save']();};}function saveUpdates(_0x512e46,_0x256a00){return function(_0x3326fb){if(_0x3326fb){return _0x3326fb[_0x5e5b('0x27')](_0x512e46)[_0x5e5b('0x28')](function(_0x2e38ed){return _0x2e38ed;});}return null;};}function removeEntity(_0x28cd95,_0x135c6c){return function(_0x18903e){if(_0x18903e){return _0x18903e[_0x5e5b('0x29')]()[_0x5e5b('0x28')](function(){_0x28cd95[_0x5e5b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebb11,_0x75800d){return function(_0x3527a8){if(!_0x3527a8){_0x1ebb11['sendStatus'](0x194);}return _0x3527a8;};}function handleError(_0x988e5d,_0xdb2863){_0xdb2863=_0xdb2863||0x1f4;return function(_0x5ee866){logger[_0x5e5b('0x2a')](_0x5ee866[_0x5e5b('0x2b')]);if(_0x5ee866[_0x5e5b('0x2c')]){delete _0x5ee866[_0x5e5b('0x2c')];}_0x988e5d[_0x5e5b('0x1d')](_0xdb2863)[_0x5e5b('0x2d')](_0x5ee866);};}exports[_0x5e5b('0x2e')]=function(_0x2b4351,_0x3f6b25){var _0x42da3b={},_0xcb272c={},_0x28157a={'count':0x0,'rows':[]};var _0x4ed688=_['map'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')],function(_0xb68419){return{'name':_0xb68419[_0x5e5b('0x31')],'type':_0xb68419[_0x5e5b('0x32')]['key']};});_0xcb272c[_0x5e5b('0x33')]=_['map'](_0x4ed688,_0x5e5b('0x2c'));_0xcb272c[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x2b4351[_0x5e5b('0x34')]);_0xcb272c['filters']=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],_0xcb272c['query']);_0x42da3b[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x42da3b[_0x5e5b('0x37')]=_0x42da3b[_0x5e5b('0x37')]['length']?_0x42da3b[_0x5e5b('0x37')]:_0xcb272c[_0x5e5b('0x33')];if(!_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x42da3b[_0x5e5b('0x21')]=qs['limit'](_0x2b4351['query'][_0x5e5b('0x21')]);_0x42da3b[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x2b4351['query'][_0x5e5b('0x20')]);}_0x42da3b[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x2b4351[_0x5e5b('0x34')]['sort']);_0x42da3b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_['pick'](_0x2b4351['query'],_0xcb272c[_0x5e5b('0x3e')]),_0x4ed688);if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]){_0x42da3b['where']=_[_0x5e5b('0x40')](_0x42da3b['where'],{'$or':_['map'](_0x4ed688,function(_0x261057){if(_0x261057[_0x5e5b('0x32')]!==_0x5e5b('0x41')){var _0xc666f7={};_0xc666f7[_0x261057[_0x5e5b('0x2c')]]={'$like':'%'+_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]+'%'};return _0xc666f7;}})});}_0x42da3b=_[_0x5e5b('0x40')]({},_0x42da3b,_0x2b4351[_0x5e5b('0x42')]);var _0x53b88f={'where':_0x42da3b[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2f')]['count'](_0x53b88f)[_0x5e5b('0x28')](function(_0x4b54b0){_0x28157a[_0x5e5b('0x22')]=_0x4b54b0;if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x43')]){_0x42da3b[_0x5e5b('0x44')]=[{'all':!![]}];}return db[_0x5e5b('0x2f')][_0x5e5b('0x45')](_0x42da3b);})[_0x5e5b('0x28')](function(_0x24d81f){_0x28157a[_0x5e5b('0x46')]=_0x24d81f;return _0x28157a;})[_0x5e5b('0x28')](respondWithFilteredResult(_0x3f6b25,_0x42da3b))[_0x5e5b('0x47')](handleError(_0x3f6b25,null));};exports['show']=function(_0x2b81dd,_0x40e8ce){var _0x46fec9={'raw':![],'where':{'id':_0x2b81dd[_0x5e5b('0x48')]['id']}},_0x570413={};_0x570413[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')]);_0x570413['query']=_[_0x5e5b('0x35')](_0x2b81dd['query']);_0x570413['filters']=_['intersection'](_0x570413[_0x5e5b('0x33')],_0x570413['query']);_0x46fec9[_0x5e5b('0x37')]=_['intersection'](_0x570413[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b81dd[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x46fec9[_0x5e5b('0x37')]=_0x46fec9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x46fec9['attributes']:_0x570413['model'];if(_0x2b81dd[_0x5e5b('0x34')]['includeAll']){_0x46fec9['include']=[{'all':!![]}];}_0x46fec9=_['merge']({},_0x46fec9,_0x2b81dd[_0x5e5b('0x42')]);return db['ZendeskAccount'][_0x5e5b('0x4a')](_0x46fec9)[_0x5e5b('0x28')](handleEntityNotFound(_0x40e8ce,null))[_0x5e5b('0x28')](respondWithResult(_0x40e8ce,null))[_0x5e5b('0x47')](handleError(_0x40e8ce,null));};exports[_0x5e5b('0x4b')]=function(_0x192445,_0x4fd265){return db[_0x5e5b('0x2f')][_0x5e5b('0x4b')](_0x192445['body'],{})[_0x5e5b('0x28')](respondWithResult(_0x4fd265,0xc9))['catch'](handleError(_0x4fd265,null));};exports[_0x5e5b('0x27')]=function(_0x36d8fa,_0x42ebaf){if(_0x36d8fa[_0x5e5b('0x4c')]['id']){delete _0x36d8fa['body']['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4a')]({'where':{'id':_0x36d8fa['params']['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x42ebaf,null))[_0x5e5b('0x28')](saveUpdates(_0x36d8fa[_0x5e5b('0x4c')],null))[_0x5e5b('0x28')](respondWithResult(_0x42ebaf,null))[_0x5e5b('0x47')](handleError(_0x42ebaf,null));};exports[_0x5e5b('0x29')]=function(_0x50fc9c,_0x690f8c){return db[_0x5e5b('0x2f')]['find']({'where':{'id':_0x50fc9c[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x690f8c,null))[_0x5e5b('0x28')](removeEntity(_0x690f8c,null))['catch'](handleError(_0x690f8c,null));};exports[_0x5e5b('0x4d')]=function(_0x3e0ce5,_0x1f32f2,_0x4844ec){var _0x3877e9={};var _0x2e04d6={};var _0x239804;var _0x4a4e0f;return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x3e0ce5['params']['id']}})['then'](handleEntityNotFound(_0x1f32f2,null))[_0x5e5b('0x28')](function(_0x13eee9){if(_0x13eee9){_0x239804=_0x13eee9;_0x2e04d6[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x4f')][_0x5e5b('0x30')]);_0x2e04d6[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x3e0ce5[_0x5e5b('0x34')]);_0x2e04d6[_0x5e5b('0x3e')]=_['intersection'](_0x2e04d6['model'],_0x2e04d6[_0x5e5b('0x34')]);_0x3877e9[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0x2e04d6[_0x5e5b('0x33')],qs['fields'](_0x3e0ce5[_0x5e5b('0x34')]['fields']));_0x3877e9[_0x5e5b('0x37')]=_0x3877e9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x3877e9[_0x5e5b('0x37')]:_0x2e04d6[_0x5e5b('0x33')];_0x3877e9[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x3e0ce5[_0x5e5b('0x34')]['sort']);_0x3877e9[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_[_0x5e5b('0x50')](_0x3e0ce5[_0x5e5b('0x34')],_0x2e04d6[_0x5e5b('0x3e')]));if(_0x3e0ce5['query'][_0x5e5b('0x3f')]){_0x3877e9[_0x5e5b('0x3d')]=_[_0x5e5b('0x40')](_0x3877e9[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x51')](_0x3877e9['attributes'],function(_0x13fb51){var _0x5d9ff9={};_0x5d9ff9[_0x13fb51]={'$like':'%'+_0x3e0ce5[_0x5e5b('0x34')]['filter']+'%'};return _0x5d9ff9;})});}_0x3877e9=_[_0x5e5b('0x40')]({},_0x3877e9,_0x3e0ce5[_0x5e5b('0x42')]);return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x229a2d){if(_0x229a2d){_0x4a4e0f=_0x229a2d[_0x5e5b('0x49')];if(!_0x3e0ce5['query'][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x3877e9[_0x5e5b('0x21')]=qs[_0x5e5b('0x21')](_0x3e0ce5['query']['limit']);_0x3877e9[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x3e0ce5['query'][_0x5e5b('0x20')]);}return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x470042){if(_0x470042){return _0x470042?{'count':_0x4a4e0f,'rows':_0x470042}:null;}})[_0x5e5b('0x28')](respondWithResult(_0x1f32f2,null))['catch'](handleError(_0x1f32f2,null));};exports[_0x5e5b('0x52')]=function(_0x61faf2,_0x494b1d,_0x4795a7){if(_0x61faf2['body']['id']){delete _0x61faf2[_0x5e5b('0x4c')]['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4e')]({'where':{'id':_0x61faf2[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x494b1d,null))['then'](function(_0x28d834){if(_0x28d834){_0x61faf2[_0x5e5b('0x4c')]['AccountId']=_0x28d834['id'];_0x61faf2[_0x5e5b('0x4c')]['Subjects']=integrations['getSubjects'](_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x54')]=integrations[_0x5e5b('0x55')](_0x61faf2['body'][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);return db[_0x5e5b('0x4f')][_0x5e5b('0x4b')](_0x61faf2[_0x5e5b('0x4c')],{'include':[{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x57')},{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x54')}]});}return null;})[_0x5e5b('0x28')](respondWithResult(_0x494b1d,null))['catch'](handleError(_0x494b1d,null));};exports[_0x5e5b('0x58')]=function(_0x1a3d7b,_0x3c57ad,_0x271af6){var _0xc7171a='';return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x1a3d7b[_0x5e5b('0x48')]['id']},'attributes':['id',_0x5e5b('0x59'),_0x5e5b('0x5a'),_0x5e5b('0x5b'),_0x5e5b('0x5c'),'remoteUri']})[_0x5e5b('0x28')](handleEntityNotFound(_0x3c57ad,null))[_0x5e5b('0x28')](function(_0x359c04){if(_0x359c04){_0xc7171a=_0x359c04['remoteUri'];var _0xc8316a=_0xc7171a[_0x5e5b('0x5d')](-0x1);if(_0xc8316a==='/'){_0xc7171a=_0xc7171a[_0x5e5b('0x5e')](0x0,_0xc7171a[_0x5e5b('0x5f')](_0xc8316a));}var _0x344c25={'method':_0x5e5b('0x60'),'uri':util[_0x5e5b('0x61')](_0x5e5b('0x62'),_0xc7171a,_0x5e5b('0x63')),'json':!![]};switch(_0x359c04['authType']){case _0x5e5b('0x5a'):_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')](_0x5e5b('0x64'),new Buffer(util['format']('%s:%s',_0x359c04[_0x5e5b('0x59')],_0x359c04[_0x5e5b('0x5a')]))['toString'](_0x5e5b('0x65')))};break;case'token':_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')]('Basic\x20%s',new Buffer(util[_0x5e5b('0x61')](_0x5e5b('0x66'),_0x359c04[_0x5e5b('0x59')],_0x359c04['token']))[_0x5e5b('0x67')](_0x5e5b('0x65')))};break;default:throw new db[(_0x5e5b('0x68'))]['ValidationError'](_0x5e5b('0x69'));}return rp(_0x344c25);}})[_0x5e5b('0x28')](function(_0x58aef4){if(_0x58aef4){var _0x388dbe=['subject','description',_0x5e5b('0x6a'),_0x5e5b('0x6b')];_[_0x5e5b('0x6c')](_0x58aef4[_0x5e5b('0x63')],function(_0x1a7c5c){return _0x388dbe['includes'](_0x1a7c5c[_0x5e5b('0x32')]);});return{'count':_0x58aef4[_0x5e5b('0x63')]['length'],'rows':_['map'](_0x58aef4[_0x5e5b('0x63')],function(_0x467c6b){return{'id':_0x467c6b['id'],'name':_0x467c6b[_0x5e5b('0x6d')]>0x7?_0x467c6b[_0x5e5b('0x6e')]:_0x467c6b[_0x5e5b('0x32')],'custom':_0x467c6b[_0x5e5b('0x6d')]>0x7?!![]:![],'options':_0x467c6b['system_field_options']?_0x467c6b[_0x5e5b('0x6f')]:_0x467c6b[_0x5e5b('0x70')]?_0x467c6b[_0x5e5b('0x70')]:[]};})};}})['then'](respondWithResult(_0x3c57ad,null))['catch'](function(_0x24bcc9){var _0x1eb8cd=_0x1a3d7b[_0x5e5b('0x34')]['test']?0x1f4:_0x24bcc9[_0x5e5b('0x71')]||0x1f4;logger[_0x5e5b('0x2a')](_0x5e5b('0x72'),'getFields',_0x1eb8cd,JSON[_0x5e5b('0x73')](_0x24bcc9));delete _0x24bcc9[_0x5e5b('0x2c')];if(_0x1eb8cd===0x191){_0x1eb8cd=0x190;}_0x3c57ad[_0x5e5b('0x1d')](_0x1eb8cd)['send'](_0x1a3d7b[_0x5e5b('0x34')][_0x5e5b('0x74')]?{'message':_0x5e5b('0x75'),'statusCode':_0x24bcc9[_0x5e5b('0x71')]}:_0x24bcc9);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 800f050..f815eaa 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 _0x4b64=['int_zendesk_accounts','util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount'];(function(_0x4b93fe,_0x1ce6e2){var _0x4af931=function(_0x11c943){while(--_0x11c943){_0x4b93fe['push'](_0x4b93fe['shift']());}};_0x4af931(++_0x1ce6e2);}(_0x4b64,0x1e1));var _0x44b6=function(_0x3a3a31,_0x3a6ac7){_0x3a3a31=_0x3a3a31-0x0;var _0x4e7062=_0x4b64[_0x3a3a31];return _0x4e7062;};'use strict';var _=require('lodash');var util=require(_0x44b6('0x0'));var logger=require('../../config/logger')(_0x44b6('0x1'));var moment=require(_0x44b6('0x2'));var BPromise=require(_0x44b6('0x3'));var rp=require(_0x44b6('0x4'));var fs=require('fs');var path=require(_0x44b6('0x5'));var rimraf=require(_0x44b6('0x6'));var config=require('../../config/environment');var attributes=require(_0x44b6('0x7'));var integrations=require(_0x44b6('0x8'));module[_0x44b6('0x9')]=function(_0x16f2e2,_0xa5655){return _0x16f2e2['define'](_0x44b6('0xa'),attributes,{'tableName':_0x44b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54a7=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2977e9,_0x318cc8){var _0x106417=function(_0x3ef6db){while(--_0x3ef6db){_0x2977e9['push'](_0x2977e9['shift']());}};_0x106417(++_0x318cc8);}(_0x54a7,0x157));var _0x754a=function(_0x43f33a,_0x254b15){_0x43f33a=_0x43f33a-0x0;var _0x2a3a91=_0x54a7[_0x43f33a];return _0x2a3a91;};'use strict';var _=require(_0x754a('0x0'));var util=require(_0x754a('0x1'));var logger=require(_0x754a('0x2'))('api');var moment=require(_0x754a('0x3'));var BPromise=require(_0x754a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x754a('0x5'));var attributes=require(_0x754a('0x6'));var integrations=require(_0x754a('0x7'));module[_0x754a('0x8')]=function(_0x33e696,_0x458e8c){return _0x33e696['define'](_0x754a('0x9'),attributes,{'tableName':_0x754a('0xa'),'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 58852b0..3a8788f 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 _0x0e1c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','then','ShowZendeskAccount','find','model','lodash','util','moment','randomstring'];(function(_0x42a03e,_0x5e9ec5){var _0x18f141=function(_0xb9fdfe){while(--_0xb9fdfe){_0x42a03e['push'](_0x42a03e['shift']());}};_0x18f141(++_0x5e9ec5);}(_0x0e1c,0x140));var _0xc0e1=function(_0x312686,_0xd9b8fd){_0x312686=_0x312686-0x0;var _0xe81b05=_0x0e1c[_0x312686];return _0xe81b05;};'use strict';var _=require(_0xc0e1('0x0'));var util=require(_0xc0e1('0x1'));var moment=require(_0xc0e1('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0e1('0x3'));var fs=require('fs');var Redis=require(_0xc0e1('0x4'));var db=require(_0xc0e1('0x5'))['db'];var utils=require(_0xc0e1('0x6'));var logger=require(_0xc0e1('0x7'))(_0xc0e1('0x8'));var config=require('../../config/environment');var jayson=require(_0xc0e1('0x9'));var client=jayson['client'][_0xc0e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19d1da,_0x545dad,_0x173ca6){return new BPromise(function(_0x14a4b7,_0x144609){return client[_0xc0e1('0xb')](_0x19d1da,_0x173ca6)['then'](function(_0x254f7a){logger[_0xc0e1('0xc')](_0xc0e1('0xd'),_0x545dad,_0xc0e1('0xe'));logger[_0xc0e1('0xf')](_0xc0e1('0x10'),_0x545dad,_0xc0e1('0xe'),JSON[_0xc0e1('0x11')](_0x254f7a));if(_0x254f7a[_0xc0e1('0x12')]){if(_0x254f7a['error'][_0xc0e1('0x13')]===0x1f4){logger[_0xc0e1('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x545dad,_0x254f7a[_0xc0e1('0x12')][_0xc0e1('0x14')]);return _0x144609(_0x254f7a[_0xc0e1('0x12')][_0xc0e1('0x14')]);}logger[_0xc0e1('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x545dad,_0x254f7a[_0xc0e1('0x12')][_0xc0e1('0x14')]);return _0x14a4b7(_0x254f7a[_0xc0e1('0x12')][_0xc0e1('0x14')]);}else{logger[_0xc0e1('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x545dad,_0xc0e1('0xe'));_0x14a4b7(_0x254f7a['result'][_0xc0e1('0x14')]);}})[_0xc0e1('0x15')](function(_0xc50504){logger[_0xc0e1('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x545dad,_0xc50504);_0x144609(_0xc50504);});});}exports[_0xc0e1('0x16')]=function(_0x2ff42f){var _0x5e1888=this;return new Promise(function(_0x59392b,_0x410231){return db[_0xc0e1('0x17')][_0xc0e1('0x18')]({'raw':_0x2ff42f[_0xc0e1('0x19')]?_0x2ff42f[_0xc0e1('0x19')][_0xc0e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ff42f[_0xc0e1('0x19')]?_0x2ff42f['options'][_0xc0e1('0x1b')]||null:null,'attributes':_0x2ff42f['options']?_0x2ff42f[_0xc0e1('0x19')][_0xc0e1('0x1c')]||null:null,'limit':_0x2ff42f[_0xc0e1('0x19')]?_0x2ff42f[_0xc0e1('0x19')][_0xc0e1('0x1d')]||null:null,'include':_0x2ff42f[_0xc0e1('0x19')]?_0x2ff42f['options']['include']?_[_0xc0e1('0x1e')](_0x2ff42f[_0xc0e1('0x19')][_0xc0e1('0x1f')],function(_0x185e63){return{'model':db[_0x185e63['model']],'as':_0x185e63['as'],'attributes':_0x185e63[_0xc0e1('0x1c')],'include':_0x185e63['include']?_[_0xc0e1('0x1e')](_0x185e63['include'],function(_0x44c34a){return{'model':db[_0x44c34a['model']],'as':_0x44c34a['as'],'attributes':_0x44c34a[_0xc0e1('0x1c')],'include':_0x44c34a[_0xc0e1('0x1f')]?_['map'](_0x44c34a['include'],function(_0x1a8e3e){return{'model':db[_0x1a8e3e['model']],'as':_0x1a8e3e['as'],'attributes':_0x1a8e3e[_0xc0e1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0e1('0x20')](function(_0x177358){logger[_0xc0e1('0xc')]('GetZendeskAccount',_0x2ff42f);logger[_0xc0e1('0xf')](_0xc0e1('0x16'),_0x2ff42f,JSON['stringify'](_0x177358));_0x59392b(_0x177358);})[_0xc0e1('0x15')](function(_0x4aee04){logger[_0xc0e1('0x12')]('GetZendeskAccount',_0x4aee04[_0xc0e1('0x14')],_0x2ff42f);_0x410231(_0x5e1888[_0xc0e1('0x12')](0x1f4,_0x4aee04['message']));});});};exports[_0xc0e1('0x21')]=function(_0x159caa){var _0x4b8213=this;return new Promise(function(_0x50b12f,_0x464080){return db[_0xc0e1('0x17')][_0xc0e1('0x22')]({'raw':_0x159caa[_0xc0e1('0x19')]?_0x159caa[_0xc0e1('0x19')][_0xc0e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x159caa[_0xc0e1('0x19')]?_0x159caa[_0xc0e1('0x19')][_0xc0e1('0x1b')]||null:null,'attributes':_0x159caa[_0xc0e1('0x19')]?_0x159caa[_0xc0e1('0x19')][_0xc0e1('0x1c')]||null:null,'include':_0x159caa[_0xc0e1('0x19')]?_0x159caa[_0xc0e1('0x19')][_0xc0e1('0x1f')]?_[_0xc0e1('0x1e')](_0x159caa[_0xc0e1('0x19')]['include'],function(_0x586489){return{'model':db[_0x586489[_0xc0e1('0x23')]],'as':_0x586489['as'],'attributes':_0x586489['attributes'],'include':_0x586489[_0xc0e1('0x1f')]?_[_0xc0e1('0x1e')](_0x586489[_0xc0e1('0x1f')],function(_0x18914d){return{'model':db[_0x18914d[_0xc0e1('0x23')]],'as':_0x18914d['as'],'attributes':_0x18914d[_0xc0e1('0x1c')],'include':_0x18914d[_0xc0e1('0x1f')]?_[_0xc0e1('0x1e')](_0x18914d[_0xc0e1('0x1f')],function(_0x296f74){return{'model':db[_0x296f74[_0xc0e1('0x23')]],'as':_0x296f74['as'],'attributes':_0x296f74[_0xc0e1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0e1('0x20')](function(_0x4fb759){logger[_0xc0e1('0xc')]('ShowZendeskAccount',_0x159caa);logger[_0xc0e1('0xf')](_0xc0e1('0x21'),_0x159caa,JSON[_0xc0e1('0x11')](_0x4fb759));_0x50b12f(_0x4fb759);})[_0xc0e1('0x15')](function(_0x36759b){logger[_0xc0e1('0x12')](_0xc0e1('0x21'),_0x36759b['message'],_0x159caa);_0x464080(_0x4b8213[_0xc0e1('0x12')](0x1f4,_0x36759b['message']));});});}; \ No newline at end of file +var _0xef1e=['rpc','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','options','raw','include','model','attributes','map','ShowZendeskAccount','where','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x49a2ed,_0x1af563){var _0x1352ad=function(_0x25b63f){while(--_0x25b63f){_0x49a2ed['push'](_0x49a2ed['shift']());}};_0x1352ad(++_0x1af563);}(_0xef1e,0x1ab));var _0xeef1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xef1e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xeef1('0x0'));var util=require('util');var moment=require(_0xeef1('0x1'));var BPromise=require('bluebird');var rs=require(_0xeef1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeef1('0x3'))['db'];var utils=require(_0xeef1('0x4'));var logger=require('../../config/logger')(_0xeef1('0x5'));var config=require('../../config/environment');var jayson=require(_0xeef1('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bb542,_0x151050,_0xeed18c){return new BPromise(function(_0x306591,_0x3217a1){return client[_0xeef1('0x7')](_0x4bb542,_0xeed18c)[_0xeef1('0x8')](function(_0x43566a){logger[_0xeef1('0x9')](_0xeef1('0xa'),_0x151050,'request\x20sent');logger[_0xeef1('0xb')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x151050,_0xeef1('0xc'),JSON[_0xeef1('0xd')](_0x43566a));if(_0x43566a[_0xeef1('0xe')]){if(_0x43566a[_0xeef1('0xe')]['code']===0x1f4){logger[_0xeef1('0xe')](_0xeef1('0xa'),_0x151050,_0x43566a[_0xeef1('0xe')]['message']);return _0x3217a1(_0x43566a[_0xeef1('0xe')][_0xeef1('0xf')]);}logger[_0xeef1('0xe')](_0xeef1('0xa'),_0x151050,_0x43566a[_0xeef1('0xe')][_0xeef1('0xf')]);return _0x306591(_0x43566a['error'][_0xeef1('0xf')]);}else{logger[_0xeef1('0x9')](_0xeef1('0xa'),_0x151050,_0xeef1('0xc'));_0x306591(_0x43566a['result'][_0xeef1('0xf')]);}})[_0xeef1('0x10')](function(_0x2416a1){logger[_0xeef1('0xe')](_0xeef1('0xa'),_0x151050,_0x2416a1);_0x3217a1(_0x2416a1);});});}exports[_0xeef1('0x11')]=function(_0x429fb7){var _0x4a5393=this;return new Promise(function(_0x44189f,_0x252000){return db[_0xeef1('0x12')]['findAll']({'raw':_0x429fb7[_0xeef1('0x13')]?_0x429fb7[_0xeef1('0x13')][_0xeef1('0x14')]===undefined?!![]:![]:!![],'where':_0x429fb7['options']?_0x429fb7['options']['where']||null:null,'attributes':_0x429fb7[_0xeef1('0x13')]?_0x429fb7[_0xeef1('0x13')]['attributes']||null:null,'limit':_0x429fb7['options']?_0x429fb7[_0xeef1('0x13')]['limit']||null:null,'include':_0x429fb7[_0xeef1('0x13')]?_0x429fb7['options'][_0xeef1('0x15')]?_['map'](_0x429fb7[_0xeef1('0x13')]['include'],function(_0x52e4e5){return{'model':db[_0x52e4e5[_0xeef1('0x16')]],'as':_0x52e4e5['as'],'attributes':_0x52e4e5[_0xeef1('0x17')],'include':_0x52e4e5[_0xeef1('0x15')]?_[_0xeef1('0x18')](_0x52e4e5[_0xeef1('0x15')],function(_0x1a9c48){return{'model':db[_0x1a9c48[_0xeef1('0x16')]],'as':_0x1a9c48['as'],'attributes':_0x1a9c48[_0xeef1('0x17')],'include':_0x1a9c48[_0xeef1('0x15')]?_['map'](_0x1a9c48[_0xeef1('0x15')],function(_0x15037a){return{'model':db[_0x15037a[_0xeef1('0x16')]],'as':_0x15037a['as'],'attributes':_0x15037a[_0xeef1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xeef1('0x8')](function(_0x5861ac){logger[_0xeef1('0x9')](_0xeef1('0x11'),_0x429fb7);logger[_0xeef1('0xb')]('GetZendeskAccount',_0x429fb7,JSON[_0xeef1('0xd')](_0x5861ac));_0x44189f(_0x5861ac);})[_0xeef1('0x10')](function(_0x30c117){logger['error'](_0xeef1('0x11'),_0x30c117[_0xeef1('0xf')],_0x429fb7);_0x252000(_0x4a5393[_0xeef1('0xe')](0x1f4,_0x30c117[_0xeef1('0xf')]));});});};exports[_0xeef1('0x19')]=function(_0x2b659e){var _0x2006c4=this;return new Promise(function(_0x49c570,_0x4dd9c9){return db[_0xeef1('0x12')]['find']({'raw':_0x2b659e[_0xeef1('0x13')]?_0x2b659e[_0xeef1('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2b659e[_0xeef1('0x13')]?_0x2b659e['options'][_0xeef1('0x1a')]||null:null,'attributes':_0x2b659e[_0xeef1('0x13')]?_0x2b659e[_0xeef1('0x13')][_0xeef1('0x17')]||null:null,'include':_0x2b659e[_0xeef1('0x13')]?_0x2b659e['options'][_0xeef1('0x15')]?_[_0xeef1('0x18')](_0x2b659e[_0xeef1('0x13')]['include'],function(_0xe51374){return{'model':db[_0xe51374[_0xeef1('0x16')]],'as':_0xe51374['as'],'attributes':_0xe51374[_0xeef1('0x17')],'include':_0xe51374[_0xeef1('0x15')]?_[_0xeef1('0x18')](_0xe51374[_0xeef1('0x15')],function(_0x25dec9){return{'model':db[_0x25dec9[_0xeef1('0x16')]],'as':_0x25dec9['as'],'attributes':_0x25dec9['attributes'],'include':_0x25dec9[_0xeef1('0x15')]?_['map'](_0x25dec9[_0xeef1('0x15')],function(_0x587f56){return{'model':db[_0x587f56[_0xeef1('0x16')]],'as':_0x587f56['as'],'attributes':_0x587f56[_0xeef1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xeef1('0x8')](function(_0x2a4b72){logger['info'](_0xeef1('0x19'),_0x2b659e);logger[_0xeef1('0xb')](_0xeef1('0x19'),_0x2b659e,JSON['stringify'](_0x2a4b72));_0x49c570(_0x2a4b72);})[_0xeef1('0x10')](function(_0x19447c){logger[_0xeef1('0xe')](_0xeef1('0x19'),_0x19447c[_0xeef1('0xf')],_0x2b659e);_0x4dd9c9(_0x2006c4[_0xeef1('0xe')](0x1f4,_0x19447c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 121dae1..4ef5bae 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 _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3df822,_0x299495){var _0x4e457d=function(_0x68a45f){while(--_0x68a45f){_0x3df822['push'](_0x3df822['shift']());}};_0x4e457d(++_0x299495);}(_0xea28,0x13a));var _0x8ea2=function(_0x27e276,_0x28acfc){_0x27e276=_0x27e276-0x0;var _0x46693c=_0xea28[_0x27e276];return _0x46693c;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file +var _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x4f47d5,_0x14bac5){var _0x507cc5=function(_0x53d62f){while(--_0x53d62f){_0x4f47d5['push'](_0x4f47d5['shift']());}};_0x507cc5(++_0x14bac5);}(_0x4483,0x1a3));var _0x3448=function(_0x54ad81,_0x37f42c){_0x54ad81=_0x54ad81-0x0;var _0x2d47cc=_0x4483[_0x54ad81];return _0x2d47cc;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b11f28b..ae5ab0b 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 _0x0e7c=['STRING','exports'];(function(_0x2a2591,_0x958577){var _0x45bde5=function(_0x581142){while(--_0x581142){_0x2a2591['push'](_0x2a2591['shift']());}};_0x45bde5(++_0x958577);}(_0x0e7c,0x1af));var _0xc0e7=function(_0x5491e5,_0x37a869){_0x5491e5=_0x5491e5-0x0;var _0x214eb5=_0x0e7c[_0x5491e5];return _0x214eb5;};'use strict';var Sequelize=require('sequelize');module[_0xc0e7('0x0')]={'name':{'type':Sequelize[_0xc0e7('0x1')]},'description':{'type':Sequelize[_0xc0e7('0x1')]}}; \ No newline at end of file +var _0x1ed3=['sequelize','exports','STRING'];(function(_0xa03edd,_0x10c680){var _0x4d59df=function(_0x480a90){while(--_0x480a90){_0xa03edd['push'](_0xa03edd['shift']());}};_0x4d59df(++_0x10c680);}(_0x1ed3,0x6f));var _0x31ed=function(_0x1ea726,_0x2eed82){_0x1ea726=_0x1ea726-0x0;var _0x24af9e=_0x1ed3[_0x1ea726];return _0x24af9e;};'use strict';var Sequelize=require(_0x31ed('0x0'));module[_0x31ed('0x1')]={'name':{'type':Sequelize[_0x31ed('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f5d8d90..214eefa 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 _0x980d=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','name','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','params','intersection','create','catch','body','find','getFields','ZendeskField','order','findOne','getSubjects','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5c7b94,_0x571d6b){var _0x3d21c2=function(_0x270460){while(--_0x270460){_0x5c7b94['push'](_0x5c7b94['shift']());}};_0x3d21c2(++_0x571d6b);}(_0x980d,0xa3));var _0xd980=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x980d[_0x28f32c];return _0x355402;};'use strict';var emlformat=require(_0xd980('0x0'));var rimraf=require(_0xd980('0x1'));var zipdir=require(_0xd980('0x2'));var jsonpatch=require(_0xd980('0x3'));var rp=require(_0xd980('0x4'));var moment=require(_0xd980('0x5'));var BPromise=require(_0xd980('0x6'));var Mustache=require(_0xd980('0x7'));var util=require(_0xd980('0x8'));var path=require(_0xd980('0x9'));var sox=require(_0xd980('0xa'));var csv=require('to-csv');var ejs=require(_0xd980('0xb'));var fs=require('fs');var fs_extra=require(_0xd980('0xc'));var _=require(_0xd980('0xd'));var squel=require(_0xd980('0xe'));var crypto=require(_0xd980('0xf'));var jsforce=require(_0xd980('0x10'));var deskjs=require(_0xd980('0x11'));var toCsv=require(_0xd980('0x12'));var querystring=require(_0xd980('0x13'));var Papa=require(_0xd980('0x14'));var Redis=require(_0xd980('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xd980('0x16'));var as=require(_0xd980('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd980('0x18'));var utils=require(_0xd980('0x19'));var config=require(_0xd980('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd980('0x1b'))['db'];function respondWithStatusCode(_0x4b8609,_0x272b09){_0x272b09=_0x272b09||0xcc;return function(_0x333f33){if(_0x333f33){return _0x4b8609[_0xd980('0x1c')](_0x272b09);}return _0x4b8609[_0xd980('0x1d')](_0x272b09)[_0xd980('0x1e')]();};}function respondWithResult(_0x1e92eb,_0x13e2df){_0x13e2df=_0x13e2df||0xc8;return function(_0x39cf93){if(_0x39cf93){return _0x1e92eb[_0xd980('0x1d')](_0x13e2df)[_0xd980('0x1f')](_0x39cf93);}};}function respondWithFilteredResult(_0x3df22c,_0x1c4d21){return function(_0x501e06){if(_0x501e06){var _0x1bde2f=typeof _0x1c4d21[_0xd980('0x20')]===_0xd980('0x21')&&typeof _0x1c4d21[_0xd980('0x22')]===_0xd980('0x21');var _0x9d6a02=_0x501e06['count'];var _0xab0eab=_0x1bde2f?0x0:_0x1c4d21['offset'];var _0x28ec7b=_0x1bde2f?_0x501e06[_0xd980('0x23')]:_0x1c4d21[_0xd980('0x20')]+_0x1c4d21[_0xd980('0x22')];var _0x1f22f0;if(_0x28ec7b>=_0x9d6a02){_0x28ec7b=_0x9d6a02;_0x1f22f0=0xc8;}else{_0x1f22f0=0xce;}_0x3df22c[_0xd980('0x1d')](_0x1f22f0);return _0x3df22c[_0xd980('0x24')](_0xd980('0x25'),_0xab0eab+'-'+_0x28ec7b+'/'+_0x9d6a02)[_0xd980('0x1f')](_0x501e06);}return null;};}function patchUpdates(_0x5844d7){return function(_0x4ca5b9){try{jsonpatch[_0xd980('0x26')](_0x4ca5b9,_0x5844d7,!![]);}catch(_0x9509cf){return BPromise[_0xd980('0x27')](_0x9509cf);}return _0x4ca5b9['save']();};}function saveUpdates(_0x82991a,_0x104247){return function(_0xd374f8){if(_0xd374f8){return _0xd374f8[_0xd980('0x28')](_0x82991a)[_0xd980('0x29')](function(_0xeb30d4){return _0xeb30d4;});}return null;};}function removeEntity(_0x37b53d,_0x1c4776){return function(_0x36707f){if(_0x36707f){return _0x36707f[_0xd980('0x2a')]()['then'](function(){_0x37b53d[_0xd980('0x1d')](0xcc)[_0xd980('0x1e')]();});}};}function handleEntityNotFound(_0x5d9bd2,_0x208f1c){return function(_0x512286){if(!_0x512286){_0x5d9bd2[_0xd980('0x1c')](0x194);}return _0x512286;};}function handleError(_0x4a9099,_0x383141){_0x383141=_0x383141||0x1f4;return function(_0x57692e){logger[_0xd980('0x2b')](_0x57692e[_0xd980('0x2c')]);if(_0x57692e['name']){delete _0x57692e['name'];}_0x4a9099[_0xd980('0x1d')](_0x383141)['send'](_0x57692e);};}exports[_0xd980('0x2d')]=function(_0x151412,_0x650470){var _0x4e836c={},_0x315fea={},_0x22de87={'count':0x0,'rows':[]};var _0x36e85f=_[_0xd980('0x2e')](db[_0xd980('0x2f')][_0xd980('0x30')],function(_0x4bcdcc){return{'name':_0x4bcdcc[_0xd980('0x31')],'type':_0x4bcdcc['type']['key']};});_0x315fea[_0xd980('0x32')]=_[_0xd980('0x2e')](_0x36e85f,_0xd980('0x33'));_0x315fea['query']=_[_0xd980('0x34')](_0x151412[_0xd980('0x35')]);_0x315fea['filters']=_['intersection'](_0x315fea[_0xd980('0x32')],_0x315fea[_0xd980('0x35')]);_0x4e836c[_0xd980('0x36')]=_['intersection'](_0x315fea[_0xd980('0x32')],qs[_0xd980('0x37')](_0x151412['query'][_0xd980('0x37')]));_0x4e836c[_0xd980('0x36')]=_0x4e836c[_0xd980('0x36')][_0xd980('0x38')]?_0x4e836c[_0xd980('0x36')]:_0x315fea['model'];if(!_0x151412[_0xd980('0x35')][_0xd980('0x39')](_0xd980('0x3a'))){_0x4e836c[_0xd980('0x22')]=qs[_0xd980('0x22')](_0x151412[_0xd980('0x35')][_0xd980('0x22')]);_0x4e836c['offset']=qs[_0xd980('0x20')](_0x151412['query'][_0xd980('0x20')]);}_0x4e836c['order']=qs['sort'](_0x151412[_0xd980('0x35')][_0xd980('0x3b')]);_0x4e836c['where']=qs[_0xd980('0x3c')](_[_0xd980('0x3d')](_0x151412[_0xd980('0x35')],_0x315fea[_0xd980('0x3c')]),_0x36e85f);if(_0x151412['query']['filter']){_0x4e836c[_0xd980('0x3e')]=_[_0xd980('0x3f')](_0x4e836c[_0xd980('0x3e')],{'$or':_['map'](_0x36e85f,function(_0x2c1aa0){if(_0x2c1aa0[_0xd980('0x40')]!=='VIRTUAL'){var _0x52e908={};_0x52e908[_0x2c1aa0['name']]={'$like':'%'+_0x151412[_0xd980('0x35')][_0xd980('0x41')]+'%'};return _0x52e908;}})});}_0x4e836c=_['merge']({},_0x4e836c,_0x151412[_0xd980('0x42')]);var _0x1f57fc={'where':_0x4e836c[_0xd980('0x3e')]};return db[_0xd980('0x2f')][_0xd980('0x23')](_0x1f57fc)[_0xd980('0x29')](function(_0x247d89){_0x22de87['count']=_0x247d89;if(_0x151412['query'][_0xd980('0x43')]){_0x4e836c[_0xd980('0x44')]=[{'all':!![]}];}return db[_0xd980('0x2f')][_0xd980('0x45')](_0x4e836c);})[_0xd980('0x29')](function(_0x44f9e5){_0x22de87[_0xd980('0x46')]=_0x44f9e5;return _0x22de87;})[_0xd980('0x29')](respondWithFilteredResult(_0x650470,_0x4e836c))['catch'](handleError(_0x650470,null));};exports['show']=function(_0x2105e0,_0x504823){var _0x5a9d73={'raw':![],'where':{'id':_0x2105e0[_0xd980('0x47')]['id']}},_0x40b63a={};_0x40b63a[_0xd980('0x32')]=_['keys'](db[_0xd980('0x2f')][_0xd980('0x30')]);_0x40b63a[_0xd980('0x35')]=_[_0xd980('0x34')](_0x2105e0[_0xd980('0x35')]);_0x40b63a['filters']=_[_0xd980('0x48')](_0x40b63a[_0xd980('0x32')],_0x40b63a[_0xd980('0x35')]);_0x5a9d73['attributes']=_[_0xd980('0x48')](_0x40b63a[_0xd980('0x32')],qs[_0xd980('0x37')](_0x2105e0['query']['fields']));_0x5a9d73['attributes']=_0x5a9d73[_0xd980('0x36')][_0xd980('0x38')]?_0x5a9d73['attributes']:_0x40b63a[_0xd980('0x32')];if(_0x2105e0[_0xd980('0x35')]['includeAll']){_0x5a9d73['include']=[{'all':!![]}];}_0x5a9d73=_[_0xd980('0x3f')]({},_0x5a9d73,_0x2105e0['options']);return db[_0xd980('0x2f')]['find'](_0x5a9d73)[_0xd980('0x29')](handleEntityNotFound(_0x504823,null))[_0xd980('0x29')](respondWithResult(_0x504823,null))['catch'](handleError(_0x504823,null));};exports[_0xd980('0x49')]=function(_0x35bd21,_0x252372){return db['ZendeskConfiguration'][_0xd980('0x49')](_0x35bd21['body'],{})[_0xd980('0x29')](respondWithResult(_0x252372,0xc9))[_0xd980('0x4a')](handleError(_0x252372,null));};exports['update']=function(_0x12a419,_0x2d6f7f){if(_0x12a419[_0xd980('0x4b')]['id']){delete _0x12a419[_0xd980('0x4b')]['id'];}return db[_0xd980('0x2f')][_0xd980('0x4c')]({'where':{'id':_0x12a419[_0xd980('0x47')]['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x2d6f7f,null))[_0xd980('0x29')](saveUpdates(_0x12a419[_0xd980('0x4b')],null))[_0xd980('0x29')](respondWithResult(_0x2d6f7f,null))[_0xd980('0x4a')](handleError(_0x2d6f7f,null));};exports[_0xd980('0x2a')]=function(_0x153ea0,_0x373467){return db[_0xd980('0x2f')][_0xd980('0x4c')]({'where':{'id':_0x153ea0[_0xd980('0x47')]['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x373467,null))[_0xd980('0x29')](removeEntity(_0x373467,null))['catch'](handleError(_0x373467,null));};exports[_0xd980('0x4d')]=function(_0x2f442e,_0x39645a,_0x175c9c){var _0x333682={};var _0x442e31={};var _0x396e54;var _0x50df99;return db[_0xd980('0x2f')]['findOne']({'where':{'id':_0x2f442e[_0xd980('0x47')]['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x39645a,null))['then'](function(_0x26d3de){if(_0x26d3de){_0x396e54=_0x26d3de;_0x442e31[_0xd980('0x32')]=_[_0xd980('0x34')](db[_0xd980('0x4e')][_0xd980('0x30')]);_0x442e31[_0xd980('0x35')]=_['keys'](_0x2f442e[_0xd980('0x35')]);_0x442e31['filters']=_[_0xd980('0x48')](_0x442e31[_0xd980('0x32')],_0x442e31[_0xd980('0x35')]);_0x333682['attributes']=_[_0xd980('0x48')](_0x442e31['model'],qs[_0xd980('0x37')](_0x2f442e[_0xd980('0x35')][_0xd980('0x37')]));_0x333682[_0xd980('0x36')]=_0x333682[_0xd980('0x36')][_0xd980('0x38')]?_0x333682[_0xd980('0x36')]:_0x442e31[_0xd980('0x32')];_0x333682[_0xd980('0x4f')]=qs[_0xd980('0x3b')](_0x2f442e[_0xd980('0x35')][_0xd980('0x3b')]);_0x333682[_0xd980('0x3e')]=qs[_0xd980('0x3c')](_[_0xd980('0x3d')](_0x2f442e[_0xd980('0x35')],_0x442e31[_0xd980('0x3c')]));if(_0x2f442e[_0xd980('0x35')]['filter']){_0x333682[_0xd980('0x3e')]=_[_0xd980('0x3f')](_0x333682['where'],{'$or':_[_0xd980('0x2e')](_0x333682['attributes'],function(_0x376e13){var _0x3a4c02={};_0x3a4c02[_0x376e13]={'$like':'%'+_0x2f442e['query']['filter']+'%'};return _0x3a4c02;})});}_0x333682=_['merge']({},_0x333682,_0x2f442e[_0xd980('0x42')]);return _0x396e54['getFields'](_0x333682);}})[_0xd980('0x29')](function(_0x4237af){if(_0x4237af){_0x50df99=_0x4237af['length'];if(!_0x2f442e[_0xd980('0x35')]['hasOwnProperty'](_0xd980('0x3a'))){_0x333682['limit']=qs[_0xd980('0x22')](_0x2f442e[_0xd980('0x35')]['limit']);_0x333682['offset']=qs['offset'](_0x2f442e[_0xd980('0x35')]['offset']);}return _0x396e54['getFields'](_0x333682);}})['then'](function(_0x3984cf){if(_0x3984cf){return _0x3984cf?{'count':_0x50df99,'rows':_0x3984cf}:null;}})[_0xd980('0x29')](respondWithResult(_0x39645a,null))[_0xd980('0x4a')](handleError(_0x39645a,null));};exports['getSubjects']=function(_0x5b25a0,_0x1b5166,_0x4478ed){var _0xd8b93f={};var _0x31ddee={};var _0x3f353e;var _0x1f915f;return db[_0xd980('0x2f')][_0xd980('0x50')]({'where':{'id':_0x5b25a0[_0xd980('0x47')]['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x1b5166,null))[_0xd980('0x29')](function(_0x50e9a9){if(_0x50e9a9){_0x3f353e=_0x50e9a9;_0x31ddee['model']=_['keys'](db[_0xd980('0x4e')][_0xd980('0x30')]);_0x31ddee['query']=_[_0xd980('0x34')](_0x5b25a0[_0xd980('0x35')]);_0x31ddee[_0xd980('0x3c')]=_['intersection'](_0x31ddee[_0xd980('0x32')],_0x31ddee['query']);_0xd8b93f['attributes']=_[_0xd980('0x48')](_0x31ddee[_0xd980('0x32')],qs[_0xd980('0x37')](_0x5b25a0['query'][_0xd980('0x37')]));_0xd8b93f[_0xd980('0x36')]=_0xd8b93f[_0xd980('0x36')][_0xd980('0x38')]?_0xd8b93f['attributes']:_0x31ddee['model'];_0xd8b93f[_0xd980('0x4f')]=qs[_0xd980('0x3b')](_0x5b25a0[_0xd980('0x35')][_0xd980('0x3b')]);_0xd8b93f[_0xd980('0x3e')]=qs[_0xd980('0x3c')](_[_0xd980('0x3d')](_0x5b25a0[_0xd980('0x35')],_0x31ddee[_0xd980('0x3c')]));if(_0x5b25a0['query'][_0xd980('0x41')]){_0xd8b93f['where']=_[_0xd980('0x3f')](_0xd8b93f[_0xd980('0x3e')],{'$or':_[_0xd980('0x2e')](_0xd8b93f[_0xd980('0x36')],function(_0x684d77){var _0x17d202={};_0x17d202[_0x684d77]={'$like':'%'+_0x5b25a0[_0xd980('0x35')][_0xd980('0x41')]+'%'};return _0x17d202;})});}_0xd8b93f=_['merge']({},_0xd8b93f,_0x5b25a0[_0xd980('0x42')]);return _0x3f353e[_0xd980('0x51')](_0xd8b93f);}})[_0xd980('0x29')](function(_0x50608d){if(_0x50608d){_0x1f915f=_0x50608d[_0xd980('0x38')];if(!_0x5b25a0[_0xd980('0x35')]['hasOwnProperty'](_0xd980('0x3a'))){_0xd8b93f[_0xd980('0x22')]=qs[_0xd980('0x22')](_0x5b25a0[_0xd980('0x35')][_0xd980('0x22')]);_0xd8b93f['offset']=qs['offset'](_0x5b25a0[_0xd980('0x35')][_0xd980('0x20')]);}return _0x3f353e[_0xd980('0x51')](_0xd8b93f);}})[_0xd980('0x29')](function(_0x1eefe8){if(_0x1eefe8){return _0x1eefe8?{'count':_0x1f915f,'rows':_0x1eefe8}:null;}})[_0xd980('0x29')](respondWithResult(_0x1b5166,null))['catch'](handleError(_0x1b5166,null));};exports[_0xd980('0x52')]=function(_0x3f6026,_0x168e50,_0x18a71f){var _0x2ff113={};var _0x44bc67={};var _0x48e656;var _0xe87f9d;return db[_0xd980('0x2f')][_0xd980('0x50')]({'where':{'id':_0x3f6026[_0xd980('0x47')]['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x168e50,null))[_0xd980('0x29')](function(_0x3a04e9){if(_0x3a04e9){_0x48e656=_0x3a04e9;_0x44bc67[_0xd980('0x32')]=_[_0xd980('0x34')](db[_0xd980('0x4e')][_0xd980('0x30')]);_0x44bc67[_0xd980('0x35')]=_[_0xd980('0x34')](_0x3f6026[_0xd980('0x35')]);_0x44bc67[_0xd980('0x3c')]=_[_0xd980('0x48')](_0x44bc67[_0xd980('0x32')],_0x44bc67[_0xd980('0x35')]);_0x2ff113[_0xd980('0x36')]=_[_0xd980('0x48')](_0x44bc67[_0xd980('0x32')],qs[_0xd980('0x37')](_0x3f6026[_0xd980('0x35')][_0xd980('0x37')]));_0x2ff113[_0xd980('0x36')]=_0x2ff113[_0xd980('0x36')]['length']?_0x2ff113[_0xd980('0x36')]:_0x44bc67[_0xd980('0x32')];_0x2ff113[_0xd980('0x4f')]=qs[_0xd980('0x3b')](_0x3f6026[_0xd980('0x35')][_0xd980('0x3b')]);_0x2ff113['where']=qs[_0xd980('0x3c')](_[_0xd980('0x3d')](_0x3f6026[_0xd980('0x35')],_0x44bc67['filters']));if(_0x3f6026['query'][_0xd980('0x41')]){_0x2ff113[_0xd980('0x3e')]=_[_0xd980('0x3f')](_0x2ff113[_0xd980('0x3e')],{'$or':_['map'](_0x2ff113['attributes'],function(_0x1f3b79){var _0x54290a={};_0x54290a[_0x1f3b79]={'$like':'%'+_0x3f6026[_0xd980('0x35')]['filter']+'%'};return _0x54290a;})});}_0x2ff113=_[_0xd980('0x3f')]({},_0x2ff113,_0x3f6026['options']);return _0x48e656[_0xd980('0x52')](_0x2ff113);}})['then'](function(_0x547cf7){if(_0x547cf7){_0xe87f9d=_0x547cf7['length'];if(!_0x3f6026[_0xd980('0x35')][_0xd980('0x39')](_0xd980('0x3a'))){_0x2ff113['limit']=qs[_0xd980('0x22')](_0x3f6026[_0xd980('0x35')]['limit']);_0x2ff113[_0xd980('0x20')]=qs[_0xd980('0x20')](_0x3f6026[_0xd980('0x35')][_0xd980('0x20')]);}return _0x48e656[_0xd980('0x52')](_0x2ff113);}})['then'](function(_0x193b84){if(_0x193b84){return _0x193b84?{'count':_0xe87f9d,'rows':_0x193b84}:null;}})[_0xd980('0x29')](respondWithResult(_0x168e50,null))['catch'](handleError(_0x168e50,null));};exports[_0xd980('0x53')]=function(_0x4fdaaf,_0x5d4049,_0x3661ba){var _0x2daa28={};var _0x282289={};var _0x743e83;var _0x48d523;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4fdaaf[_0xd980('0x47')]['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x5d4049,null))['then'](function(_0x2075ba){if(_0x2075ba){_0x743e83=_0x2075ba;_0x282289['model']=_[_0xd980('0x34')](db['Tag'][_0xd980('0x30')]);_0x282289[_0xd980('0x35')]=_[_0xd980('0x34')](_0x4fdaaf['query']);_0x282289[_0xd980('0x3c')]=_['intersection'](_0x282289['model'],_0x282289[_0xd980('0x35')]);_0x2daa28['attributes']=_[_0xd980('0x48')](_0x282289[_0xd980('0x32')],qs[_0xd980('0x37')](_0x4fdaaf[_0xd980('0x35')][_0xd980('0x37')]));_0x2daa28[_0xd980('0x36')]=_0x2daa28[_0xd980('0x36')]['length']?_0x2daa28[_0xd980('0x36')]:_0x282289['model'];_0x2daa28[_0xd980('0x4f')]=qs[_0xd980('0x3b')](_0x4fdaaf[_0xd980('0x35')][_0xd980('0x3b')]);_0x2daa28[_0xd980('0x3e')]=qs[_0xd980('0x3c')](_[_0xd980('0x3d')](_0x4fdaaf[_0xd980('0x35')],_0x282289[_0xd980('0x3c')]));if(_0x4fdaaf[_0xd980('0x35')][_0xd980('0x41')]){_0x2daa28[_0xd980('0x3e')]=_[_0xd980('0x3f')](_0x2daa28[_0xd980('0x3e')],{'$or':_[_0xd980('0x2e')](_0x2daa28['attributes'],function(_0x5b64cc){var _0x48e45c={};_0x48e45c[_0x5b64cc]={'$like':'%'+_0x4fdaaf['query'][_0xd980('0x41')]+'%'};return _0x48e45c;})});}_0x2daa28=_[_0xd980('0x3f')]({},_0x2daa28,_0x4fdaaf['options']);return _0x743e83[_0xd980('0x53')](_0x2daa28);}})[_0xd980('0x29')](function(_0x49a0c8){if(_0x49a0c8){_0x48d523=_0x49a0c8[_0xd980('0x38')];if(!_0x4fdaaf[_0xd980('0x35')][_0xd980('0x39')](_0xd980('0x3a'))){_0x2daa28['limit']=qs[_0xd980('0x22')](_0x4fdaaf[_0xd980('0x35')][_0xd980('0x22')]);_0x2daa28[_0xd980('0x20')]=qs[_0xd980('0x20')](_0x4fdaaf[_0xd980('0x35')]['offset']);}return _0x743e83['getTags'](_0x2daa28);}})['then'](function(_0x22686d){if(_0x22686d){return _0x22686d?{'count':_0x48d523,'rows':_0x22686d}:null;}})['then'](respondWithResult(_0x5d4049,null))[_0xd980('0x4a')](handleError(_0x5d4049,null));};exports['setTags']=function(_0x3a8c01,_0x49e4a4,_0x19f5d4){if(_0x3a8c01[_0xd980('0x4b')]['id']){delete _0x3a8c01[_0xd980('0x4b')]['id'];}return db[_0xd980('0x2f')][_0xd980('0x50')]({'where':{'id':_0x3a8c01['params']['id']}})[_0xd980('0x29')](handleEntityNotFound(_0x49e4a4,null))[_0xd980('0x29')](function(_0x342c36){if(_0x342c36){return _0x342c36['setTags'](_0x3a8c01[_0xd980('0x4b')][_0xd980('0x54')]||[]);}return null;})[_0xd980('0x29')](respondWithResult(_0x49e4a4,null))[_0xd980('0x4a')](handleError(_0x49e4a4,null));}; \ No newline at end of file +var _0xbfcd=['count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','type','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','ZendeskField','length','hasOwnProperty','getSubjects','order','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0xbfcd,0x133));var _0xdbfc=function(_0x397e5d,_0x305c03){_0x397e5d=_0x397e5d-0x0;var _0x5bf49d=_0xbfcd[_0x397e5d];return _0x5bf49d;};'use strict';var emlformat=require(_0xdbfc('0x0'));var rimraf=require(_0xdbfc('0x1'));var zipdir=require(_0xdbfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbfc('0x3'));var moment=require(_0xdbfc('0x4'));var BPromise=require(_0xdbfc('0x5'));var Mustache=require(_0xdbfc('0x6'));var util=require(_0xdbfc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdbfc('0x8'));var ejs=require(_0xdbfc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbfc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbfc('0xb'));var deskjs=require(_0xdbfc('0xc'));var toCsv=require(_0xdbfc('0x8'));var querystring=require(_0xdbfc('0xd'));var Papa=require(_0xdbfc('0xe'));var Redis=require(_0xdbfc('0xf'));var authService=require(_0xdbfc('0x10'));var qs=require(_0xdbfc('0x11'));var as=require(_0xdbfc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbfc('0x13'))('api');var utils=require(_0xdbfc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdbfc('0x15'));var db=require(_0xdbfc('0x16'))['db'];function respondWithStatusCode(_0x27601f,_0x28e5cb){_0x28e5cb=_0x28e5cb||0xcc;return function(_0x135b6c){if(_0x135b6c){return _0x27601f['sendStatus'](_0x28e5cb);}return _0x27601f['status'](_0x28e5cb)[_0xdbfc('0x17')]();};}function respondWithResult(_0x124dc9,_0x35247b){_0x35247b=_0x35247b||0xc8;return function(_0x57d73a){if(_0x57d73a){return _0x124dc9[_0xdbfc('0x18')](_0x35247b)[_0xdbfc('0x19')](_0x57d73a);}};}function respondWithFilteredResult(_0x26dd96,_0x22da78){return function(_0x338dc2){if(_0x338dc2){var _0x3230da=typeof _0x22da78[_0xdbfc('0x1a')]===_0xdbfc('0x1b')&&typeof _0x22da78[_0xdbfc('0x1c')]===_0xdbfc('0x1b');var _0x1c6651=_0x338dc2[_0xdbfc('0x1d')];var _0x26127b=_0x3230da?0x0:_0x22da78['offset'];var _0x4d55ef=_0x3230da?_0x338dc2[_0xdbfc('0x1d')]:_0x22da78[_0xdbfc('0x1a')]+_0x22da78['limit'];var _0x5c6cbd;if(_0x4d55ef>=_0x1c6651){_0x4d55ef=_0x1c6651;_0x5c6cbd=0xc8;}else{_0x5c6cbd=0xce;}_0x26dd96[_0xdbfc('0x18')](_0x5c6cbd);return _0x26dd96[_0xdbfc('0x1e')](_0xdbfc('0x1f'),_0x26127b+'-'+_0x4d55ef+'/'+_0x1c6651)[_0xdbfc('0x19')](_0x338dc2);}return null;};}function patchUpdates(_0x91843b){return function(_0x2df205){try{jsonpatch[_0xdbfc('0x20')](_0x2df205,_0x91843b,!![]);}catch(_0x5f036a){return BPromise[_0xdbfc('0x21')](_0x5f036a);}return _0x2df205[_0xdbfc('0x22')]();};}function saveUpdates(_0xf6919d,_0x560d36){return function(_0xaaea9d){if(_0xaaea9d){return _0xaaea9d[_0xdbfc('0x23')](_0xf6919d)[_0xdbfc('0x24')](function(_0xd6de34){return _0xd6de34;});}return null;};}function removeEntity(_0x58fcbf,_0x84b39d){return function(_0x43a87c){if(_0x43a87c){return _0x43a87c[_0xdbfc('0x25')]()[_0xdbfc('0x24')](function(){_0x58fcbf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36dd16,_0x55ba9c){return function(_0x330d13){if(!_0x330d13){_0x36dd16['sendStatus'](0x194);}return _0x330d13;};}function handleError(_0x52772e,_0x324b5a){_0x324b5a=_0x324b5a||0x1f4;return function(_0x474ebb){logger['error'](_0x474ebb[_0xdbfc('0x26')]);if(_0x474ebb[_0xdbfc('0x27')]){delete _0x474ebb[_0xdbfc('0x27')];}_0x52772e[_0xdbfc('0x18')](_0x324b5a)[_0xdbfc('0x28')](_0x474ebb);};}exports[_0xdbfc('0x29')]=function(_0x540486,_0x25c4c0){var _0x147f6f={},_0x508518={},_0x3e01aa={'count':0x0,'rows':[]};var _0x71f413=_['map'](db[_0xdbfc('0x2a')][_0xdbfc('0x2b')],function(_0x3be04e){return{'name':_0x3be04e[_0xdbfc('0x2c')],'type':_0x3be04e['type'][_0xdbfc('0x2d')]};});_0x508518[_0xdbfc('0x2e')]=_['map'](_0x71f413,'name');_0x508518[_0xdbfc('0x2f')]=_[_0xdbfc('0x30')](_0x540486['query']);_0x508518[_0xdbfc('0x31')]=_[_0xdbfc('0x32')](_0x508518['model'],_0x508518[_0xdbfc('0x2f')]);_0x147f6f[_0xdbfc('0x33')]=_['intersection'](_0x508518[_0xdbfc('0x2e')],qs[_0xdbfc('0x34')](_0x540486[_0xdbfc('0x2f')][_0xdbfc('0x34')]));_0x147f6f['attributes']=_0x147f6f[_0xdbfc('0x33')]['length']?_0x147f6f[_0xdbfc('0x33')]:_0x508518[_0xdbfc('0x2e')];if(!_0x540486[_0xdbfc('0x2f')]['hasOwnProperty'](_0xdbfc('0x35'))){_0x147f6f[_0xdbfc('0x1c')]=qs['limit'](_0x540486[_0xdbfc('0x2f')][_0xdbfc('0x1c')]);_0x147f6f[_0xdbfc('0x1a')]=qs['offset'](_0x540486[_0xdbfc('0x2f')]['offset']);}_0x147f6f['order']=qs[_0xdbfc('0x36')](_0x540486[_0xdbfc('0x2f')][_0xdbfc('0x36')]);_0x147f6f[_0xdbfc('0x37')]=qs['filters'](_[_0xdbfc('0x38')](_0x540486['query'],_0x508518[_0xdbfc('0x31')]),_0x71f413);if(_0x540486[_0xdbfc('0x2f')][_0xdbfc('0x39')]){_0x147f6f['where']=_[_0xdbfc('0x3a')](_0x147f6f['where'],{'$or':_[_0xdbfc('0x3b')](_0x71f413,function(_0x21bd39){if(_0x21bd39[_0xdbfc('0x3c')]!=='VIRTUAL'){var _0x2906b9={};_0x2906b9[_0x21bd39[_0xdbfc('0x27')]]={'$like':'%'+_0x540486[_0xdbfc('0x2f')][_0xdbfc('0x39')]+'%'};return _0x2906b9;}})});}_0x147f6f=_[_0xdbfc('0x3a')]({},_0x147f6f,_0x540486[_0xdbfc('0x3d')]);var _0x48dadb={'where':_0x147f6f[_0xdbfc('0x37')]};return db[_0xdbfc('0x2a')]['count'](_0x48dadb)[_0xdbfc('0x24')](function(_0x124534){_0x3e01aa[_0xdbfc('0x1d')]=_0x124534;if(_0x540486['query']['includeAll']){_0x147f6f['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xdbfc('0x3e')](_0x147f6f);})[_0xdbfc('0x24')](function(_0x3ab716){_0x3e01aa[_0xdbfc('0x3f')]=_0x3ab716;return _0x3e01aa;})['then'](respondWithFilteredResult(_0x25c4c0,_0x147f6f))[_0xdbfc('0x40')](handleError(_0x25c4c0,null));};exports[_0xdbfc('0x41')]=function(_0x14057f,_0x12eb7b){var _0x394271={'raw':![],'where':{'id':_0x14057f[_0xdbfc('0x42')]['id']}},_0x11cb30={};_0x11cb30['model']=_[_0xdbfc('0x30')](db[_0xdbfc('0x2a')][_0xdbfc('0x2b')]);_0x11cb30[_0xdbfc('0x2f')]=_[_0xdbfc('0x30')](_0x14057f[_0xdbfc('0x2f')]);_0x11cb30[_0xdbfc('0x31')]=_[_0xdbfc('0x32')](_0x11cb30['model'],_0x11cb30[_0xdbfc('0x2f')]);_0x394271[_0xdbfc('0x33')]=_[_0xdbfc('0x32')](_0x11cb30[_0xdbfc('0x2e')],qs['fields'](_0x14057f[_0xdbfc('0x2f')][_0xdbfc('0x34')]));_0x394271['attributes']=_0x394271['attributes']['length']?_0x394271[_0xdbfc('0x33')]:_0x11cb30[_0xdbfc('0x2e')];if(_0x14057f[_0xdbfc('0x2f')][_0xdbfc('0x43')]){_0x394271[_0xdbfc('0x44')]=[{'all':!![]}];}_0x394271=_[_0xdbfc('0x3a')]({},_0x394271,_0x14057f[_0xdbfc('0x3d')]);return db['ZendeskConfiguration'][_0xdbfc('0x45')](_0x394271)['then'](handleEntityNotFound(_0x12eb7b,null))['then'](respondWithResult(_0x12eb7b,null))['catch'](handleError(_0x12eb7b,null));};exports[_0xdbfc('0x46')]=function(_0x473270,_0x1d7081){return db[_0xdbfc('0x2a')]['create'](_0x473270[_0xdbfc('0x47')],{})[_0xdbfc('0x24')](respondWithResult(_0x1d7081,0xc9))[_0xdbfc('0x40')](handleError(_0x1d7081,null));};exports[_0xdbfc('0x23')]=function(_0x572ba7,_0x4bceed){if(_0x572ba7[_0xdbfc('0x47')]['id']){delete _0x572ba7['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x572ba7[_0xdbfc('0x42')]['id']}})[_0xdbfc('0x24')](handleEntityNotFound(_0x4bceed,null))[_0xdbfc('0x24')](saveUpdates(_0x572ba7[_0xdbfc('0x47')],null))[_0xdbfc('0x24')](respondWithResult(_0x4bceed,null))[_0xdbfc('0x40')](handleError(_0x4bceed,null));};exports[_0xdbfc('0x25')]=function(_0x1037cb,_0x1973cb){return db[_0xdbfc('0x2a')]['find']({'where':{'id':_0x1037cb[_0xdbfc('0x42')]['id']}})[_0xdbfc('0x24')](handleEntityNotFound(_0x1973cb,null))[_0xdbfc('0x24')](removeEntity(_0x1973cb,null))['catch'](handleError(_0x1973cb,null));};exports[_0xdbfc('0x48')]=function(_0xa1a2bc,_0x4708af,_0x1bde43){var _0x2cfc57={};var _0x10acf4={};var _0x5a0753;var _0xcd4886;return db[_0xdbfc('0x2a')][_0xdbfc('0x49')]({'where':{'id':_0xa1a2bc[_0xdbfc('0x42')]['id']}})[_0xdbfc('0x24')](handleEntityNotFound(_0x4708af,null))[_0xdbfc('0x24')](function(_0x2569d7){if(_0x2569d7){_0x5a0753=_0x2569d7;_0x10acf4[_0xdbfc('0x2e')]=_[_0xdbfc('0x30')](db[_0xdbfc('0x4a')][_0xdbfc('0x2b')]);_0x10acf4[_0xdbfc('0x2f')]=_[_0xdbfc('0x30')](_0xa1a2bc[_0xdbfc('0x2f')]);_0x10acf4[_0xdbfc('0x31')]=_[_0xdbfc('0x32')](_0x10acf4[_0xdbfc('0x2e')],_0x10acf4[_0xdbfc('0x2f')]);_0x2cfc57[_0xdbfc('0x33')]=_[_0xdbfc('0x32')](_0x10acf4[_0xdbfc('0x2e')],qs['fields'](_0xa1a2bc['query'][_0xdbfc('0x34')]));_0x2cfc57[_0xdbfc('0x33')]=_0x2cfc57[_0xdbfc('0x33')]['length']?_0x2cfc57[_0xdbfc('0x33')]:_0x10acf4[_0xdbfc('0x2e')];_0x2cfc57['order']=qs['sort'](_0xa1a2bc[_0xdbfc('0x2f')][_0xdbfc('0x36')]);_0x2cfc57[_0xdbfc('0x37')]=qs[_0xdbfc('0x31')](_['pick'](_0xa1a2bc[_0xdbfc('0x2f')],_0x10acf4[_0xdbfc('0x31')]));if(_0xa1a2bc['query'][_0xdbfc('0x39')]){_0x2cfc57[_0xdbfc('0x37')]=_['merge'](_0x2cfc57[_0xdbfc('0x37')],{'$or':_[_0xdbfc('0x3b')](_0x2cfc57[_0xdbfc('0x33')],function(_0x5767d5){var _0x1056da={};_0x1056da[_0x5767d5]={'$like':'%'+_0xa1a2bc[_0xdbfc('0x2f')][_0xdbfc('0x39')]+'%'};return _0x1056da;})});}_0x2cfc57=_[_0xdbfc('0x3a')]({},_0x2cfc57,_0xa1a2bc['options']);return _0x5a0753['getFields'](_0x2cfc57);}})['then'](function(_0x193838){if(_0x193838){_0xcd4886=_0x193838[_0xdbfc('0x4b')];if(!_0xa1a2bc[_0xdbfc('0x2f')][_0xdbfc('0x4c')]('nolimit')){_0x2cfc57[_0xdbfc('0x1c')]=qs[_0xdbfc('0x1c')](_0xa1a2bc[_0xdbfc('0x2f')][_0xdbfc('0x1c')]);_0x2cfc57[_0xdbfc('0x1a')]=qs[_0xdbfc('0x1a')](_0xa1a2bc[_0xdbfc('0x2f')][_0xdbfc('0x1a')]);}return _0x5a0753[_0xdbfc('0x48')](_0x2cfc57);}})[_0xdbfc('0x24')](function(_0x17adae){if(_0x17adae){return _0x17adae?{'count':_0xcd4886,'rows':_0x17adae}:null;}})[_0xdbfc('0x24')](respondWithResult(_0x4708af,null))['catch'](handleError(_0x4708af,null));};exports[_0xdbfc('0x4d')]=function(_0x3b957e,_0x541161,_0x5860f3){var _0x3268c0={};var _0x440daa={};var _0x2c6c7d;var _0x8fdc8c;return db['ZendeskConfiguration'][_0xdbfc('0x49')]({'where':{'id':_0x3b957e[_0xdbfc('0x42')]['id']}})[_0xdbfc('0x24')](handleEntityNotFound(_0x541161,null))[_0xdbfc('0x24')](function(_0x146efb){if(_0x146efb){_0x2c6c7d=_0x146efb;_0x440daa[_0xdbfc('0x2e')]=_[_0xdbfc('0x30')](db[_0xdbfc('0x4a')][_0xdbfc('0x2b')]);_0x440daa[_0xdbfc('0x2f')]=_[_0xdbfc('0x30')](_0x3b957e['query']);_0x440daa[_0xdbfc('0x31')]=_[_0xdbfc('0x32')](_0x440daa['model'],_0x440daa['query']);_0x3268c0[_0xdbfc('0x33')]=_[_0xdbfc('0x32')](_0x440daa[_0xdbfc('0x2e')],qs[_0xdbfc('0x34')](_0x3b957e[_0xdbfc('0x2f')]['fields']));_0x3268c0[_0xdbfc('0x33')]=_0x3268c0[_0xdbfc('0x33')][_0xdbfc('0x4b')]?_0x3268c0[_0xdbfc('0x33')]:_0x440daa[_0xdbfc('0x2e')];_0x3268c0['order']=qs['sort'](_0x3b957e[_0xdbfc('0x2f')][_0xdbfc('0x36')]);_0x3268c0[_0xdbfc('0x37')]=qs[_0xdbfc('0x31')](_['pick'](_0x3b957e['query'],_0x440daa['filters']));if(_0x3b957e[_0xdbfc('0x2f')][_0xdbfc('0x39')]){_0x3268c0[_0xdbfc('0x37')]=_[_0xdbfc('0x3a')](_0x3268c0[_0xdbfc('0x37')],{'$or':_[_0xdbfc('0x3b')](_0x3268c0[_0xdbfc('0x33')],function(_0xc4c997){var _0x4ac4cc={};_0x4ac4cc[_0xc4c997]={'$like':'%'+_0x3b957e[_0xdbfc('0x2f')][_0xdbfc('0x39')]+'%'};return _0x4ac4cc;})});}_0x3268c0=_['merge']({},_0x3268c0,_0x3b957e[_0xdbfc('0x3d')]);return _0x2c6c7d['getSubjects'](_0x3268c0);}})[_0xdbfc('0x24')](function(_0x360de2){if(_0x360de2){_0x8fdc8c=_0x360de2['length'];if(!_0x3b957e[_0xdbfc('0x2f')]['hasOwnProperty'](_0xdbfc('0x35'))){_0x3268c0[_0xdbfc('0x1c')]=qs[_0xdbfc('0x1c')](_0x3b957e[_0xdbfc('0x2f')][_0xdbfc('0x1c')]);_0x3268c0['offset']=qs['offset'](_0x3b957e['query']['offset']);}return _0x2c6c7d[_0xdbfc('0x4d')](_0x3268c0);}})[_0xdbfc('0x24')](function(_0x1d8bfb){if(_0x1d8bfb){return _0x1d8bfb?{'count':_0x8fdc8c,'rows':_0x1d8bfb}:null;}})[_0xdbfc('0x24')](respondWithResult(_0x541161,null))['catch'](handleError(_0x541161,null));};exports['getDescriptions']=function(_0x400bf0,_0x260004,_0x143974){var _0x40dbfc={};var _0xdc435e={};var _0x536bc7;var _0x1b27d2;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x400bf0['params']['id']}})['then'](handleEntityNotFound(_0x260004,null))['then'](function(_0x2b9f50){if(_0x2b9f50){_0x536bc7=_0x2b9f50;_0xdc435e[_0xdbfc('0x2e')]=_[_0xdbfc('0x30')](db[_0xdbfc('0x4a')][_0xdbfc('0x2b')]);_0xdc435e[_0xdbfc('0x2f')]=_['keys'](_0x400bf0['query']);_0xdc435e[_0xdbfc('0x31')]=_['intersection'](_0xdc435e['model'],_0xdc435e[_0xdbfc('0x2f')]);_0x40dbfc['attributes']=_['intersection'](_0xdc435e['model'],qs[_0xdbfc('0x34')](_0x400bf0[_0xdbfc('0x2f')][_0xdbfc('0x34')]));_0x40dbfc['attributes']=_0x40dbfc['attributes'][_0xdbfc('0x4b')]?_0x40dbfc[_0xdbfc('0x33')]:_0xdc435e[_0xdbfc('0x2e')];_0x40dbfc[_0xdbfc('0x4e')]=qs[_0xdbfc('0x36')](_0x400bf0['query'][_0xdbfc('0x36')]);_0x40dbfc[_0xdbfc('0x37')]=qs['filters'](_[_0xdbfc('0x38')](_0x400bf0[_0xdbfc('0x2f')],_0xdc435e['filters']));if(_0x400bf0['query'][_0xdbfc('0x39')]){_0x40dbfc[_0xdbfc('0x37')]=_['merge'](_0x40dbfc['where'],{'$or':_['map'](_0x40dbfc[_0xdbfc('0x33')],function(_0x4131ae){var _0x233bb9={};_0x233bb9[_0x4131ae]={'$like':'%'+_0x400bf0[_0xdbfc('0x2f')][_0xdbfc('0x39')]+'%'};return _0x233bb9;})});}_0x40dbfc=_[_0xdbfc('0x3a')]({},_0x40dbfc,_0x400bf0[_0xdbfc('0x3d')]);return _0x536bc7['getDescriptions'](_0x40dbfc);}})[_0xdbfc('0x24')](function(_0x806637){if(_0x806637){_0x1b27d2=_0x806637[_0xdbfc('0x4b')];if(!_0x400bf0['query'][_0xdbfc('0x4c')](_0xdbfc('0x35'))){_0x40dbfc[_0xdbfc('0x1c')]=qs['limit'](_0x400bf0['query'][_0xdbfc('0x1c')]);_0x40dbfc[_0xdbfc('0x1a')]=qs[_0xdbfc('0x1a')](_0x400bf0['query']['offset']);}return _0x536bc7[_0xdbfc('0x4f')](_0x40dbfc);}})['then'](function(_0x20cceb){if(_0x20cceb){return _0x20cceb?{'count':_0x1b27d2,'rows':_0x20cceb}:null;}})['then'](respondWithResult(_0x260004,null))[_0xdbfc('0x40')](handleError(_0x260004,null));};exports['getTags']=function(_0x1604ad,_0x4249af,_0x38e196){var _0x397b1b={};var _0x52a762={};var _0x400a5f;var _0x59087a;return db[_0xdbfc('0x2a')][_0xdbfc('0x49')]({'where':{'id':_0x1604ad[_0xdbfc('0x42')]['id']}})[_0xdbfc('0x24')](handleEntityNotFound(_0x4249af,null))[_0xdbfc('0x24')](function(_0x4a7cf1){if(_0x4a7cf1){_0x400a5f=_0x4a7cf1;_0x52a762[_0xdbfc('0x2e')]=_['keys'](db[_0xdbfc('0x50')]['rawAttributes']);_0x52a762[_0xdbfc('0x2f')]=_[_0xdbfc('0x30')](_0x1604ad[_0xdbfc('0x2f')]);_0x52a762[_0xdbfc('0x31')]=_[_0xdbfc('0x32')](_0x52a762[_0xdbfc('0x2e')],_0x52a762[_0xdbfc('0x2f')]);_0x397b1b[_0xdbfc('0x33')]=_['intersection'](_0x52a762[_0xdbfc('0x2e')],qs[_0xdbfc('0x34')](_0x1604ad[_0xdbfc('0x2f')][_0xdbfc('0x34')]));_0x397b1b['attributes']=_0x397b1b[_0xdbfc('0x33')][_0xdbfc('0x4b')]?_0x397b1b[_0xdbfc('0x33')]:_0x52a762[_0xdbfc('0x2e')];_0x397b1b[_0xdbfc('0x4e')]=qs[_0xdbfc('0x36')](_0x1604ad['query']['sort']);_0x397b1b['where']=qs['filters'](_[_0xdbfc('0x38')](_0x1604ad[_0xdbfc('0x2f')],_0x52a762[_0xdbfc('0x31')]));if(_0x1604ad[_0xdbfc('0x2f')][_0xdbfc('0x39')]){_0x397b1b[_0xdbfc('0x37')]=_[_0xdbfc('0x3a')](_0x397b1b[_0xdbfc('0x37')],{'$or':_[_0xdbfc('0x3b')](_0x397b1b[_0xdbfc('0x33')],function(_0x2b0fc4){var _0x319bf3={};_0x319bf3[_0x2b0fc4]={'$like':'%'+_0x1604ad[_0xdbfc('0x2f')]['filter']+'%'};return _0x319bf3;})});}_0x397b1b=_[_0xdbfc('0x3a')]({},_0x397b1b,_0x1604ad[_0xdbfc('0x3d')]);return _0x400a5f[_0xdbfc('0x51')](_0x397b1b);}})[_0xdbfc('0x24')](function(_0x10fd70){if(_0x10fd70){_0x59087a=_0x10fd70[_0xdbfc('0x4b')];if(!_0x1604ad[_0xdbfc('0x2f')][_0xdbfc('0x4c')](_0xdbfc('0x35'))){_0x397b1b[_0xdbfc('0x1c')]=qs[_0xdbfc('0x1c')](_0x1604ad[_0xdbfc('0x2f')][_0xdbfc('0x1c')]);_0x397b1b[_0xdbfc('0x1a')]=qs[_0xdbfc('0x1a')](_0x1604ad[_0xdbfc('0x2f')][_0xdbfc('0x1a')]);}return _0x400a5f[_0xdbfc('0x51')](_0x397b1b);}})['then'](function(_0x21bd67){if(_0x21bd67){return _0x21bd67?{'count':_0x59087a,'rows':_0x21bd67}:null;}})['then'](respondWithResult(_0x4249af,null))[_0xdbfc('0x40')](handleError(_0x4249af,null));};exports[_0xdbfc('0x52')]=function(_0x8523fc,_0x354810,_0x281196){if(_0x8523fc[_0xdbfc('0x47')]['id']){delete _0x8523fc[_0xdbfc('0x47')]['id'];}return db[_0xdbfc('0x2a')]['findOne']({'where':{'id':_0x8523fc['params']['id']}})[_0xdbfc('0x24')](handleEntityNotFound(_0x354810,null))[_0xdbfc('0x24')](function(_0x1ea1a9){if(_0x1ea1a9){return _0x1ea1a9[_0xdbfc('0x52')](_0x8523fc[_0xdbfc('0x47')][_0xdbfc('0x53')]||[]);}return null;})[_0xdbfc('0x24')](respondWithResult(_0x354810,null))[_0xdbfc('0x40')](handleError(_0x354810,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 102404f..15eb628 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x4fc2,0x111));var _0x24fc=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x4fc2[_0x3a99f4];return _0xea0b42;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x486922,_0x17e739){var _0x54bd2b=function(_0x44305f){while(--_0x44305f){_0x486922['push'](_0x486922['shift']());}};_0x54bd2b(++_0x17e739);}(_0xdb94,0xab));var _0x4db9=function(_0x46ddd3,_0x2f4887){_0x46ddd3=_0x46ddd3-0x0;var _0x3f7c8c=_0xdb94[_0x46ddd3];return _0x3f7c8c;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','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 aa303af..2524f13 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 _0x50fb=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x32c2a8,_0x3c8f88){var _0x3df1ef=function(_0x51d0c8){while(--_0x51d0c8){_0x32c2a8['push'](_0x32c2a8['shift']());}};_0x3df1ef(++_0x3c8f88);}(_0x50fb,0x1a4));var _0xb50f=function(_0x3b80de,_0x20a62a){_0x3b80de=_0x3b80de-0x0;var _0x4e0dbe=_0x50fb[_0x3b80de];return _0x4e0dbe;};'use strict';var _=require(_0xb50f('0x0'));var util=require(_0xb50f('0x1'));var moment=require(_0xb50f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb50f('0x3'));var fs=require('fs');var Redis=require(_0xb50f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb50f('0x5'));var logger=require(_0xb50f('0x6'))(_0xb50f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x331a42,_0x2331f4,_0x17384f){return new BPromise(function(_0xdb0c41,_0xedffc6){return client[_0xb50f('0x8')](_0x331a42,_0x17384f)[_0xb50f('0x9')](function(_0x36b224){logger[_0xb50f('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2331f4,'request\x20sent');logger[_0xb50f('0xb')](_0xb50f('0xc'),_0x2331f4,_0xb50f('0xd'),JSON[_0xb50f('0xe')](_0x36b224));if(_0x36b224['error']){if(_0x36b224['error']['code']===0x1f4){logger[_0xb50f('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2331f4,_0x36b224[_0xb50f('0xf')][_0xb50f('0x10')]);return _0xedffc6(_0x36b224['error'][_0xb50f('0x10')]);}logger[_0xb50f('0xf')](_0xb50f('0x11'),_0x2331f4,_0x36b224[_0xb50f('0xf')][_0xb50f('0x10')]);return _0xdb0c41(_0x36b224[_0xb50f('0xf')][_0xb50f('0x10')]);}else{logger[_0xb50f('0xa')](_0xb50f('0x11'),_0x2331f4,'request\x20sent');_0xdb0c41(_0x36b224[_0xb50f('0x12')][_0xb50f('0x10')]);}})[_0xb50f('0x13')](function(_0x165c48){logger[_0xb50f('0xf')](_0xb50f('0x11'),_0x2331f4,_0x165c48);_0xedffc6(_0x165c48);});});} \ No newline at end of file +var _0x7a67=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','lodash','moment'];(function(_0x1f8d25,_0x36cc4d){var _0x330b34=function(_0x211bf0){while(--_0x211bf0){_0x1f8d25['push'](_0x1f8d25['shift']());}};_0x330b34(++_0x36cc4d);}(_0x7a67,0x76));var _0x77a6=function(_0x1ce2bd,_0x4506fa){_0x1ce2bd=_0x1ce2bd-0x0;var _0x28062b=_0x7a67[_0x1ce2bd];return _0x28062b;};'use strict';var _=require(_0x77a6('0x0'));var util=require('util');var moment=require(_0x77a6('0x1'));var BPromise=require(_0x77a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x77a6('0x4'));var logger=require(_0x77a6('0x5'))(_0x77a6('0x6'));var config=require(_0x77a6('0x7'));var jayson=require(_0x77a6('0x8'));var client=jayson[_0x77a6('0x9')][_0x77a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34b3f4,_0x54ac98,_0x51dc34){return new BPromise(function(_0x5baa8d,_0x13fc3f){return client[_0x77a6('0xb')](_0x34b3f4,_0x51dc34)[_0x77a6('0xc')](function(_0x2b7c68){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x54ac98,_0x77a6('0xd'));logger['debug'](_0x77a6('0xe'),_0x54ac98,_0x77a6('0xd'),JSON[_0x77a6('0xf')](_0x2b7c68));if(_0x2b7c68[_0x77a6('0x10')]){if(_0x2b7c68[_0x77a6('0x10')][_0x77a6('0x11')]===0x1f4){logger[_0x77a6('0x10')](_0x77a6('0x12'),_0x54ac98,_0x2b7c68[_0x77a6('0x10')][_0x77a6('0x13')]);return _0x13fc3f(_0x2b7c68[_0x77a6('0x10')][_0x77a6('0x13')]);}logger[_0x77a6('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x54ac98,_0x2b7c68[_0x77a6('0x10')][_0x77a6('0x13')]);return _0x5baa8d(_0x2b7c68[_0x77a6('0x10')][_0x77a6('0x13')]);}else{logger['info'](_0x77a6('0x12'),_0x54ac98,_0x77a6('0xd'));_0x5baa8d(_0x2b7c68['result']['message']);}})['catch'](function(_0x2141e2){logger['error'](_0x77a6('0x12'),_0x54ac98,_0x2141e2);_0x13fc3f(_0x2141e2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ceda8bd..789aaa0 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 _0x956c=['update','delete','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','create','put'];(function(_0x4b5835,_0x46fc05){var _0x2e10c9=function(_0x18a70e){while(--_0x18a70e){_0x4b5835['push'](_0x4b5835['shift']());}};_0x2e10c9(++_0x46fc05);}(_0x956c,0x128));var _0xc956=function(_0x564b6e,_0x539879){_0x564b6e=_0x564b6e-0x0;var _0x48eb87=_0x956c[_0x564b6e];return _0x48eb87;};'use strict';var multer=require(_0xc956('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc956('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc956('0x2'));var interaction=require(_0xc956('0x3'));var config=require(_0xc956('0x4'));var controller=require(_0xc956('0x5'));router[_0xc956('0x6')]('/',auth['isAuthenticated'](),controller[_0xc956('0x7')]);router[_0xc956('0x6')](_0xc956('0x8'),auth[_0xc956('0x9')](),controller['show']);router['post']('/',auth[_0xc956('0x9')](),controller[_0xc956('0xa')]);router[_0xc956('0xb')](_0xc956('0x8'),auth[_0xc956('0x9')](),controller[_0xc956('0xc')]);router[_0xc956('0xd')]('/:id',auth[_0xc956('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xba0b=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','update','multer','util'];(function(_0x56026d,_0x4f42e8){var _0x1c19fe=function(_0x53d1a1){while(--_0x53d1a1){_0x56026d['push'](_0x56026d['shift']());}};_0x1c19fe(++_0x4f42e8);}(_0xba0b,0x143));var _0xbba0=function(_0x2ec662,_0x4edf37){_0x2ec662=_0x2ec662-0x0;var _0x1bbcb6=_0xba0b[_0x2ec662];return _0x1bbcb6;};'use strict';var multer=require(_0xbba0('0x0'));var util=require(_0xbba0('0x1'));var path=require(_0xbba0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbba0('0x3')]();var fs_extra=require(_0xbba0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbba0('0x5'));var config=require(_0xbba0('0x6'));var controller=require(_0xbba0('0x7'));router[_0xbba0('0x8')]('/',auth[_0xbba0('0x9')](),controller[_0xbba0('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbba0('0xb')]);router['post']('/',auth[_0xbba0('0x9')](),controller['create']);router['put']('/:id',auth[_0xbba0('0x9')](),controller[_0xbba0('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 179dd36..f25f6d5 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 _0x95a5=['string','variable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x95a5,0x1de));var _0x595a=function(_0x2eaf80,_0x1bfe87){_0x2eaf80=_0x2eaf80-0x0;var _0x39d77f=_0x95a5[_0x2eaf80];return _0x39d77f;};'use strict';var Sequelize=require('sequelize');module[_0x595a('0x0')]={'type':{'type':Sequelize[_0x595a('0x1')](_0x595a('0x2'),_0x595a('0x3'),'customVariable',_0x595a('0x4'),_0x595a('0x5')),'defaultValue':_0x595a('0x2')},'content':{'type':Sequelize[_0x595a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x595a('0x1')]('string',_0x595a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x595a('0x6')]},'idField':{'type':Sequelize[_0x595a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x595a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x595a('0x6')]}}; \ No newline at end of file +var _0x7995=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x8c2e4e,_0x3c105b){var _0x2286bb=function(_0x31bef7){while(--_0x31bef7){_0x8c2e4e['push'](_0x8c2e4e['shift']());}};_0x2286bb(++_0x3c105b);}(_0x7995,0x181));var _0x5799=function(_0x3067a2,_0x4c109b){_0x3067a2=_0x3067a2-0x0;var _0x21a324=_0x7995[_0x3067a2];return _0x21a324;};'use strict';var Sequelize=require(_0x5799('0x0'));module[_0x5799('0x1')]={'type':{'type':Sequelize[_0x5799('0x2')](_0x5799('0x3'),_0x5799('0x4'),_0x5799('0x5'),_0x5799('0x6'),_0x5799('0x7')),'defaultValue':_0x5799('0x3')},'content':{'type':Sequelize[_0x5799('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5799('0x2')](_0x5799('0x3'),_0x5799('0x4'),_0x5799('0x5'))},'keyContent':{'type':Sequelize[_0x5799('0x8')]},'idField':{'type':Sequelize[_0x5799('0x8')]},'nameField':{'type':Sequelize[_0x5799('0x8')]},'customField':{'type':Sequelize[_0x5799('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5799('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a70aa47..b2058b7 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 _0xd89a=['map','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','fields','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model'];(function(_0xae58e4,_0x3b1f71){var _0x5ab5ea=function(_0x3b1f8e){while(--_0x3b1f8e){_0xae58e4['push'](_0xae58e4['shift']());}};_0x5ab5ea(++_0x3b1f71);}(_0xd89a,0x6b));var _0xad89=function(_0x54d0b1,_0x1abf62){_0x54d0b1=_0x54d0b1-0x0;var _0x26a67c=_0xd89a[_0x54d0b1];return _0x26a67c;};'use strict';var emlformat=require(_0xad89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad89('0x1'));var jsonpatch=require(_0xad89('0x2'));var rp=require(_0xad89('0x3'));var moment=require('moment');var BPromise=require(_0xad89('0x4'));var Mustache=require(_0xad89('0x5'));var util=require('util');var path=require(_0xad89('0x6'));var sox=require(_0xad89('0x7'));var csv=require(_0xad89('0x8'));var ejs=require(_0xad89('0x9'));var fs=require('fs');var fs_extra=require(_0xad89('0xa'));var _=require(_0xad89('0xb'));var squel=require('squel');var crypto=require(_0xad89('0xc'));var jsforce=require(_0xad89('0xd'));var deskjs=require(_0xad89('0xe'));var toCsv=require(_0xad89('0x8'));var querystring=require(_0xad89('0xf'));var Papa=require(_0xad89('0x10'));var Redis=require(_0xad89('0x11'));var authService=require(_0xad89('0x12'));var qs=require(_0xad89('0x13'));var as=require(_0xad89('0x14'));var hardwareService=require(_0xad89('0x15'));var logger=require(_0xad89('0x16'))(_0xad89('0x17'));var utils=require(_0xad89('0x18'));var config=require(_0xad89('0x19'));var licenseUtil=require(_0xad89('0x1a'));var db=require(_0xad89('0x1b'))['db'];function respondWithStatusCode(_0x566dd0,_0x2a183f){_0x2a183f=_0x2a183f||0xcc;return function(_0x5ed58e){if(_0x5ed58e){return _0x566dd0[_0xad89('0x1c')](_0x2a183f);}return _0x566dd0['status'](_0x2a183f)['end']();};}function respondWithResult(_0x36877b,_0x3e939f){_0x3e939f=_0x3e939f||0xc8;return function(_0x2d117c){if(_0x2d117c){return _0x36877b[_0xad89('0x1d')](_0x3e939f)[_0xad89('0x1e')](_0x2d117c);}};}function respondWithFilteredResult(_0x48eeb3,_0xf70bc9){return function(_0x5b59e9){if(_0x5b59e9){var _0x40080a=typeof _0xf70bc9[_0xad89('0x1f')]===_0xad89('0x20')&&typeof _0xf70bc9[_0xad89('0x21')]===_0xad89('0x20');var _0x1e8222=_0x5b59e9[_0xad89('0x22')];var _0x2f2d27=_0x40080a?0x0:_0xf70bc9[_0xad89('0x1f')];var _0x443061=_0x40080a?_0x5b59e9['count']:_0xf70bc9[_0xad89('0x1f')]+_0xf70bc9[_0xad89('0x21')];var _0x3db469;if(_0x443061>=_0x1e8222){_0x443061=_0x1e8222;_0x3db469=0xc8;}else{_0x3db469=0xce;}_0x48eeb3[_0xad89('0x1d')](_0x3db469);return _0x48eeb3[_0xad89('0x23')](_0xad89('0x24'),_0x2f2d27+'-'+_0x443061+'/'+_0x1e8222)['json'](_0x5b59e9);}return null;};}function patchUpdates(_0x2196c4){return function(_0x258939){try{jsonpatch[_0xad89('0x25')](_0x258939,_0x2196c4,!![]);}catch(_0x2aa575){return BPromise[_0xad89('0x26')](_0x2aa575);}return _0x258939['save']();};}function saveUpdates(_0x26722c,_0x4d8de1){return function(_0xae35b1){if(_0xae35b1){return _0xae35b1['update'](_0x26722c)[_0xad89('0x27')](function(_0x17bdb7){return _0x17bdb7;});}return null;};}function removeEntity(_0x3ed5fe,_0x5429a6){return function(_0x1718af){if(_0x1718af){return _0x1718af[_0xad89('0x28')]()[_0xad89('0x27')](function(){_0x3ed5fe[_0xad89('0x1d')](0xcc)[_0xad89('0x29')]();});}};}function handleEntityNotFound(_0x32eca3,_0x39eca3){return function(_0x2bc22c){if(!_0x2bc22c){_0x32eca3[_0xad89('0x1c')](0x194);}return _0x2bc22c;};}function handleError(_0x1aeba5,_0x3fa578){_0x3fa578=_0x3fa578||0x1f4;return function(_0x3584dd){logger[_0xad89('0x2a')](_0x3584dd[_0xad89('0x2b')]);if(_0x3584dd[_0xad89('0x2c')]){delete _0x3584dd[_0xad89('0x2c')];}_0x1aeba5[_0xad89('0x1d')](_0x3fa578)[_0xad89('0x2d')](_0x3584dd);};}exports[_0xad89('0x2e')]=function(_0x818f57,_0x27923f){var _0x431c34={},_0x1b234a={},_0x3d5250={'count':0x0,'rows':[]};var _0x109d7e=_['map'](db[_0xad89('0x2f')][_0xad89('0x30')],function(_0x23ed7b){return{'name':_0x23ed7b[_0xad89('0x31')],'type':_0x23ed7b[_0xad89('0x32')][_0xad89('0x33')]};});_0x1b234a[_0xad89('0x34')]=_[_0xad89('0x35')](_0x109d7e,_0xad89('0x2c'));_0x1b234a[_0xad89('0x36')]=_['keys'](_0x818f57[_0xad89('0x36')]);_0x1b234a[_0xad89('0x37')]=_[_0xad89('0x38')](_0x1b234a[_0xad89('0x34')],_0x1b234a[_0xad89('0x36')]);_0x431c34['attributes']=_['intersection'](_0x1b234a['model'],qs['fields'](_0x818f57[_0xad89('0x36')]['fields']));_0x431c34[_0xad89('0x39')]=_0x431c34[_0xad89('0x39')][_0xad89('0x3a')]?_0x431c34[_0xad89('0x39')]:_0x1b234a['model'];if(!_0x818f57[_0xad89('0x36')][_0xad89('0x3b')]('nolimit')){_0x431c34['limit']=qs[_0xad89('0x21')](_0x818f57[_0xad89('0x36')][_0xad89('0x21')]);_0x431c34[_0xad89('0x1f')]=qs[_0xad89('0x1f')](_0x818f57[_0xad89('0x36')]['offset']);}_0x431c34[_0xad89('0x3c')]=qs[_0xad89('0x3d')](_0x818f57[_0xad89('0x36')]['sort']);_0x431c34['where']=qs[_0xad89('0x37')](_[_0xad89('0x3e')](_0x818f57['query'],_0x1b234a[_0xad89('0x37')]),_0x109d7e);if(_0x818f57[_0xad89('0x36')][_0xad89('0x3f')]){_0x431c34[_0xad89('0x40')]=_[_0xad89('0x41')](_0x431c34[_0xad89('0x40')],{'$or':_[_0xad89('0x35')](_0x109d7e,function(_0x39c411){if(_0x39c411[_0xad89('0x32')]!==_0xad89('0x42')){var _0xc4e4a2={};_0xc4e4a2[_0x39c411['name']]={'$like':'%'+_0x818f57[_0xad89('0x36')][_0xad89('0x3f')]+'%'};return _0xc4e4a2;}})});}_0x431c34=_[_0xad89('0x41')]({},_0x431c34,_0x818f57[_0xad89('0x43')]);var _0x1aef20={'where':_0x431c34['where']};return db[_0xad89('0x2f')][_0xad89('0x22')](_0x1aef20)[_0xad89('0x27')](function(_0x291b19){_0x3d5250[_0xad89('0x22')]=_0x291b19;if(_0x818f57[_0xad89('0x36')][_0xad89('0x44')]){_0x431c34[_0xad89('0x45')]=[{'all':!![]}];}return db[_0xad89('0x2f')][_0xad89('0x46')](_0x431c34);})['then'](function(_0x4b2796){_0x3d5250[_0xad89('0x47')]=_0x4b2796;return _0x3d5250;})[_0xad89('0x27')](respondWithFilteredResult(_0x27923f,_0x431c34))[_0xad89('0x48')](handleError(_0x27923f,null));};exports['show']=function(_0x7a92e9,_0x3c4d54){var _0x5bb6f9={'raw':!![],'where':{'id':_0x7a92e9['params']['id']}},_0x1a1975={};_0x1a1975[_0xad89('0x34')]=_[_0xad89('0x49')](db[_0xad89('0x2f')][_0xad89('0x30')]);_0x1a1975[_0xad89('0x36')]=_['keys'](_0x7a92e9[_0xad89('0x36')]);_0x1a1975[_0xad89('0x37')]=_[_0xad89('0x38')](_0x1a1975['model'],_0x1a1975[_0xad89('0x36')]);_0x5bb6f9[_0xad89('0x39')]=_[_0xad89('0x38')](_0x1a1975['model'],qs[_0xad89('0x4a')](_0x7a92e9[_0xad89('0x36')][_0xad89('0x4a')]));_0x5bb6f9[_0xad89('0x39')]=_0x5bb6f9[_0xad89('0x39')]['length']?_0x5bb6f9[_0xad89('0x39')]:_0x1a1975[_0xad89('0x34')];if(_0x7a92e9[_0xad89('0x36')][_0xad89('0x44')]){_0x5bb6f9[_0xad89('0x45')]=[{'all':!![]}];}_0x5bb6f9=_[_0xad89('0x41')]({},_0x5bb6f9,_0x7a92e9[_0xad89('0x43')]);return db['ZendeskField'][_0xad89('0x4b')](_0x5bb6f9)[_0xad89('0x27')](handleEntityNotFound(_0x3c4d54,null))['then'](respondWithResult(_0x3c4d54,null))[_0xad89('0x48')](handleError(_0x3c4d54,null));};exports[_0xad89('0x4c')]=function(_0x2fc65c,_0x24c3a8){return db[_0xad89('0x2f')][_0xad89('0x4c')](_0x2fc65c[_0xad89('0x4d')],{})[_0xad89('0x27')](respondWithResult(_0x24c3a8,0xc9))['catch'](handleError(_0x24c3a8,null));};exports[_0xad89('0x4e')]=function(_0x21423c,_0x5a8906){if(_0x21423c[_0xad89('0x4d')]['id']){delete _0x21423c[_0xad89('0x4d')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x21423c['params']['id']}})['then'](handleEntityNotFound(_0x5a8906,null))[_0xad89('0x27')](saveUpdates(_0x21423c['body'],null))['then'](respondWithResult(_0x5a8906,null))[_0xad89('0x48')](handleError(_0x5a8906,null));};exports[_0xad89('0x28')]=function(_0x1820c3,_0x18197b){return db['ZendeskField']['find']({'where':{'id':_0x1820c3[_0xad89('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18197b,null))[_0xad89('0x27')](removeEntity(_0x18197b,null))[_0xad89('0x48')](handleError(_0x18197b,null));}; \ No newline at end of file +var _0xd562=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','ZendeskField','includeAll','include','findAll','rows','show','rawAttributes','keys','length','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xd562,0x165));var _0x2d56=function(_0x5c94cc,_0x4eee3b){_0x5c94cc=_0x5c94cc-0x0;var _0x4a4912=_0xd562[_0x5c94cc];return _0x4a4912;};'use strict';var emlformat=require(_0x2d56('0x0'));var rimraf=require(_0x2d56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d56('0x2'));var rp=require(_0x2d56('0x3'));var moment=require(_0x2d56('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d56('0x5'));var path=require(_0x2d56('0x6'));var sox=require(_0x2d56('0x7'));var csv=require(_0x2d56('0x8'));var ejs=require(_0x2d56('0x9'));var fs=require('fs');var fs_extra=require(_0x2d56('0xa'));var _=require(_0x2d56('0xb'));var squel=require(_0x2d56('0xc'));var crypto=require(_0x2d56('0xd'));var jsforce=require(_0x2d56('0xe'));var deskjs=require(_0x2d56('0xf'));var toCsv=require(_0x2d56('0x8'));var querystring=require(_0x2d56('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d56('0x11'));var authService=require(_0x2d56('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d56('0x13'));var logger=require(_0x2d56('0x14'))(_0x2d56('0x15'));var utils=require('../../config/utils');var config=require(_0x2d56('0x16'));var licenseUtil=require(_0x2d56('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7732c1,_0x5ca5d3){_0x5ca5d3=_0x5ca5d3||0xcc;return function(_0x199279){if(_0x199279){return _0x7732c1[_0x2d56('0x18')](_0x5ca5d3);}return _0x7732c1[_0x2d56('0x19')](_0x5ca5d3)['end']();};}function respondWithResult(_0x4b2362,_0x8433aa){_0x8433aa=_0x8433aa||0xc8;return function(_0x148608){if(_0x148608){return _0x4b2362[_0x2d56('0x19')](_0x8433aa)[_0x2d56('0x1a')](_0x148608);}};}function respondWithFilteredResult(_0x3f1b56,_0x2eec96){return function(_0x50a335){if(_0x50a335){var _0x573a1b=typeof _0x2eec96[_0x2d56('0x1b')]==='undefined'&&typeof _0x2eec96[_0x2d56('0x1c')]===_0x2d56('0x1d');var _0x51300e=_0x50a335[_0x2d56('0x1e')];var _0x599825=_0x573a1b?0x0:_0x2eec96[_0x2d56('0x1b')];var _0x41f586=_0x573a1b?_0x50a335['count']:_0x2eec96[_0x2d56('0x1b')]+_0x2eec96[_0x2d56('0x1c')];var _0x5238f8;if(_0x41f586>=_0x51300e){_0x41f586=_0x51300e;_0x5238f8=0xc8;}else{_0x5238f8=0xce;}_0x3f1b56[_0x2d56('0x19')](_0x5238f8);return _0x3f1b56[_0x2d56('0x1f')](_0x2d56('0x20'),_0x599825+'-'+_0x41f586+'/'+_0x51300e)[_0x2d56('0x1a')](_0x50a335);}return null;};}function patchUpdates(_0x593005){return function(_0x546d96){try{jsonpatch[_0x2d56('0x21')](_0x546d96,_0x593005,!![]);}catch(_0x28cd58){return BPromise[_0x2d56('0x22')](_0x28cd58);}return _0x546d96[_0x2d56('0x23')]();};}function saveUpdates(_0x287d21,_0x54ac78){return function(_0x4a3197){if(_0x4a3197){return _0x4a3197[_0x2d56('0x24')](_0x287d21)[_0x2d56('0x25')](function(_0x11703d){return _0x11703d;});}return null;};}function removeEntity(_0x42c02c,_0x1210b0){return function(_0x1ef7d1){if(_0x1ef7d1){return _0x1ef7d1[_0x2d56('0x26')]()['then'](function(){_0x42c02c[_0x2d56('0x19')](0xcc)[_0x2d56('0x27')]();});}};}function handleEntityNotFound(_0x252b67,_0x1dd4c9){return function(_0x51ba0e){if(!_0x51ba0e){_0x252b67[_0x2d56('0x18')](0x194);}return _0x51ba0e;};}function handleError(_0x3f432a,_0x5ac1ef){_0x5ac1ef=_0x5ac1ef||0x1f4;return function(_0x3c4dce){logger[_0x2d56('0x28')](_0x3c4dce[_0x2d56('0x29')]);if(_0x3c4dce[_0x2d56('0x2a')]){delete _0x3c4dce[_0x2d56('0x2a')];}_0x3f432a[_0x2d56('0x19')](_0x5ac1ef)[_0x2d56('0x2b')](_0x3c4dce);};}exports[_0x2d56('0x2c')]=function(_0x55eb47,_0x2d5332){var _0x90e985={},_0x1e4a5b={},_0x49a062={'count':0x0,'rows':[]};var _0x150aa2=_[_0x2d56('0x2d')](db['ZendeskField']['rawAttributes'],function(_0x1780c7){return{'name':_0x1780c7[_0x2d56('0x2e')],'type':_0x1780c7[_0x2d56('0x2f')][_0x2d56('0x30')]};});_0x1e4a5b[_0x2d56('0x31')]=_['map'](_0x150aa2,'name');_0x1e4a5b[_0x2d56('0x32')]=_['keys'](_0x55eb47[_0x2d56('0x32')]);_0x1e4a5b['filters']=_[_0x2d56('0x33')](_0x1e4a5b['model'],_0x1e4a5b[_0x2d56('0x32')]);_0x90e985[_0x2d56('0x34')]=_[_0x2d56('0x33')](_0x1e4a5b['model'],qs[_0x2d56('0x35')](_0x55eb47[_0x2d56('0x32')][_0x2d56('0x35')]));_0x90e985['attributes']=_0x90e985[_0x2d56('0x34')]['length']?_0x90e985[_0x2d56('0x34')]:_0x1e4a5b[_0x2d56('0x31')];if(!_0x55eb47['query'][_0x2d56('0x36')](_0x2d56('0x37'))){_0x90e985['limit']=qs[_0x2d56('0x1c')](_0x55eb47['query']['limit']);_0x90e985[_0x2d56('0x1b')]=qs[_0x2d56('0x1b')](_0x55eb47[_0x2d56('0x32')][_0x2d56('0x1b')]);}_0x90e985[_0x2d56('0x38')]=qs['sort'](_0x55eb47['query'][_0x2d56('0x39')]);_0x90e985[_0x2d56('0x3a')]=qs[_0x2d56('0x3b')](_['pick'](_0x55eb47[_0x2d56('0x32')],_0x1e4a5b[_0x2d56('0x3b')]),_0x150aa2);if(_0x55eb47[_0x2d56('0x32')][_0x2d56('0x3c')]){_0x90e985[_0x2d56('0x3a')]=_[_0x2d56('0x3d')](_0x90e985[_0x2d56('0x3a')],{'$or':_['map'](_0x150aa2,function(_0x36440f){if(_0x36440f[_0x2d56('0x2f')]!=='VIRTUAL'){var _0x4a34dc={};_0x4a34dc[_0x36440f['name']]={'$like':'%'+_0x55eb47[_0x2d56('0x32')][_0x2d56('0x3c')]+'%'};return _0x4a34dc;}})});}_0x90e985=_['merge']({},_0x90e985,_0x55eb47[_0x2d56('0x3e')]);var _0x3f3a29={'where':_0x90e985['where']};return db[_0x2d56('0x3f')][_0x2d56('0x1e')](_0x3f3a29)['then'](function(_0x4ea993){_0x49a062[_0x2d56('0x1e')]=_0x4ea993;if(_0x55eb47[_0x2d56('0x32')][_0x2d56('0x40')]){_0x90e985[_0x2d56('0x41')]=[{'all':!![]}];}return db[_0x2d56('0x3f')][_0x2d56('0x42')](_0x90e985);})[_0x2d56('0x25')](function(_0x14175f){_0x49a062[_0x2d56('0x43')]=_0x14175f;return _0x49a062;})[_0x2d56('0x25')](respondWithFilteredResult(_0x2d5332,_0x90e985))['catch'](handleError(_0x2d5332,null));};exports[_0x2d56('0x44')]=function(_0x252142,_0xae9cd){var _0xa8c848={'raw':!![],'where':{'id':_0x252142['params']['id']}},_0x548830={};_0x548830[_0x2d56('0x31')]=_['keys'](db[_0x2d56('0x3f')][_0x2d56('0x45')]);_0x548830[_0x2d56('0x32')]=_[_0x2d56('0x46')](_0x252142[_0x2d56('0x32')]);_0x548830[_0x2d56('0x3b')]=_[_0x2d56('0x33')](_0x548830['model'],_0x548830['query']);_0xa8c848[_0x2d56('0x34')]=_[_0x2d56('0x33')](_0x548830[_0x2d56('0x31')],qs[_0x2d56('0x35')](_0x252142[_0x2d56('0x32')][_0x2d56('0x35')]));_0xa8c848[_0x2d56('0x34')]=_0xa8c848['attributes'][_0x2d56('0x47')]?_0xa8c848['attributes']:_0x548830[_0x2d56('0x31')];if(_0x252142[_0x2d56('0x32')]['includeAll']){_0xa8c848['include']=[{'all':!![]}];}_0xa8c848=_['merge']({},_0xa8c848,_0x252142[_0x2d56('0x3e')]);return db[_0x2d56('0x3f')]['find'](_0xa8c848)[_0x2d56('0x25')](handleEntityNotFound(_0xae9cd,null))['then'](respondWithResult(_0xae9cd,null))[_0x2d56('0x48')](handleError(_0xae9cd,null));};exports[_0x2d56('0x49')]=function(_0x3e47f8,_0x334947){return db[_0x2d56('0x3f')][_0x2d56('0x49')](_0x3e47f8[_0x2d56('0x4a')],{})[_0x2d56('0x25')](respondWithResult(_0x334947,0xc9))['catch'](handleError(_0x334947,null));};exports[_0x2d56('0x24')]=function(_0x143a0d,_0x1dbd72){if(_0x143a0d['body']['id']){delete _0x143a0d['body']['id'];}return db[_0x2d56('0x3f')][_0x2d56('0x4b')]({'where':{'id':_0x143a0d['params']['id']}})[_0x2d56('0x25')](handleEntityNotFound(_0x1dbd72,null))[_0x2d56('0x25')](saveUpdates(_0x143a0d['body'],null))[_0x2d56('0x25')](respondWithResult(_0x1dbd72,null))[_0x2d56('0x48')](handleError(_0x1dbd72,null));};exports['destroy']=function(_0x17959d,_0x596722){return db[_0x2d56('0x3f')][_0x2d56('0x4b')]({'where':{'id':_0x17959d[_0x2d56('0x4c')]['id']}})['then'](handleEntityNotFound(_0x596722,null))[_0x2d56('0x25')](removeEntity(_0x596722,null))[_0x2d56('0x48')](handleError(_0x596722,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5b9a09d..8cf9a7a 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 _0xb174=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','api','moment'];(function(_0x12ee87,_0x228c39){var _0x47baa4=function(_0xc695ee){while(--_0xc695ee){_0x12ee87['push'](_0x12ee87['shift']());}};_0x47baa4(++_0x228c39);}(_0xb174,0xec));var _0x4b17=function(_0x461adf,_0x4c4a66){_0x461adf=_0x461adf-0x0;var _0x3e2cf4=_0xb174[_0x461adf];return _0x3e2cf4;};'use strict';var _=require(_0x4b17('0x0'));var util=require(_0x4b17('0x1'));var logger=require('../../config/logger')(_0x4b17('0x2'));var moment=require(_0x4b17('0x3'));var BPromise=require(_0x4b17('0x4'));var rp=require(_0x4b17('0x5'));var fs=require('fs');var path=require(_0x4b17('0x6'));var rimraf=require(_0x4b17('0x7'));var config=require(_0x4b17('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x4b17('0x9')]=function(_0x1f6b81,_0x555625){return _0x1f6b81[_0x4b17('0xa')](_0x4b17('0xb'),attributes,{'tableName':_0x4b17('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x4b17('0xd'),_0x4b17('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb39c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb39c,0xec));var _0xcb39=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb39c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcb39('0x0'));var util=require(_0xcb39('0x1'));var logger=require(_0xcb39('0x2'))(_0xcb39('0x3'));var moment=require(_0xcb39('0x4'));var BPromise=require(_0xcb39('0x5'));var rp=require(_0xcb39('0x6'));var fs=require('fs');var path=require(_0xcb39('0x7'));var rimraf=require(_0xcb39('0x8'));var config=require(_0xcb39('0x9'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x550874,_0x5df4b5){return _0x550874['define'](_0xcb39('0xa'),attributes,{'tableName':_0xcb39('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xcb39('0xc'),_0xcb39('0xd')],'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 1f41e8c..de03842 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 _0xbf05=['then','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2988e2,_0x554c01){var _0x36ff19=function(_0x201a4e){while(--_0x201a4e){_0x2988e2['push'](_0x2988e2['shift']());}};_0x36ff19(++_0x554c01);}(_0xbf05,0x1c2));var _0x5bf0=function(_0x5af1c0,_0x1c283b){_0x5af1c0=_0x5af1c0-0x0;var _0x2792a6=_0xbf05[_0x5af1c0];return _0x2792a6;};'use strict';var _=require('lodash');var util=require(_0x5bf0('0x0'));var moment=require(_0x5bf0('0x1'));var BPromise=require(_0x5bf0('0x2'));var rs=require(_0x5bf0('0x3'));var fs=require('fs');var Redis=require(_0x5bf0('0x4'));var db=require(_0x5bf0('0x5'))['db'];var utils=require(_0x5bf0('0x6'));var logger=require(_0x5bf0('0x7'))(_0x5bf0('0x8'));var config=require(_0x5bf0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5bf0('0xa')][_0x5bf0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e8f97,_0x14acf4,_0x47b6f){return new BPromise(function(_0x570328,_0x3f6b4a){return client['request'](_0x1e8f97,_0x47b6f)[_0x5bf0('0xc')](function(_0xd9e51e){logger['info'](_0x5bf0('0xd'),_0x14acf4,_0x5bf0('0xe'));logger['debug'](_0x5bf0('0xf'),_0x14acf4,_0x5bf0('0xe'),JSON[_0x5bf0('0x10')](_0xd9e51e));if(_0xd9e51e[_0x5bf0('0x11')]){if(_0xd9e51e[_0x5bf0('0x11')][_0x5bf0('0x12')]===0x1f4){logger[_0x5bf0('0x11')](_0x5bf0('0xd'),_0x14acf4,_0xd9e51e[_0x5bf0('0x11')]['message']);return _0x3f6b4a(_0xd9e51e[_0x5bf0('0x11')][_0x5bf0('0x13')]);}logger[_0x5bf0('0x11')](_0x5bf0('0xd'),_0x14acf4,_0xd9e51e['error'][_0x5bf0('0x13')]);return _0x570328(_0xd9e51e[_0x5bf0('0x11')]['message']);}else{logger['info'](_0x5bf0('0xd'),_0x14acf4,_0x5bf0('0xe'));_0x570328(_0xd9e51e[_0x5bf0('0x14')][_0x5bf0('0x13')]);}})[_0x5bf0('0x15')](function(_0x45301a){logger[_0x5bf0('0x11')](_0x5bf0('0xd'),_0x14acf4,_0x45301a);_0x3f6b4a(_0x45301a);});});} \ No newline at end of file +var _0xb7ac=['then','info','request\x20sent','debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x55610c,_0x5e6294){var _0x30c800=function(_0x15e1c7){while(--_0x15e1c7){_0x55610c['push'](_0x55610c['shift']());}};_0x30c800(++_0x5e6294);}(_0xb7ac,0x96));var _0xcb7a=function(_0x1d2c27,_0x41c293){_0x1d2c27=_0x1d2c27-0x0;var _0xc6612f=_0xb7ac[_0x1d2c27];return _0xc6612f;};'use strict';var _=require(_0xcb7a('0x0'));var util=require('util');var moment=require(_0xcb7a('0x1'));var BPromise=require(_0xcb7a('0x2'));var rs=require(_0xcb7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcb7a('0x4'));var logger=require(_0xcb7a('0x5'))(_0xcb7a('0x6'));var config=require(_0xcb7a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cfc6,_0x33c36a,_0x251979){return new BPromise(function(_0x4f5520,_0x653611){return client[_0xcb7a('0x9')](_0x51cfc6,_0x251979)[_0xcb7a('0xa')](function(_0x26a70d){logger[_0xcb7a('0xb')]('ZendeskField,\x20%s,\x20%s',_0x33c36a,_0xcb7a('0xc'));logger[_0xcb7a('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x33c36a,_0xcb7a('0xc'),JSON[_0xcb7a('0xe')](_0x26a70d));if(_0x26a70d[_0xcb7a('0xf')]){if(_0x26a70d[_0xcb7a('0xf')][_0xcb7a('0x10')]===0x1f4){logger['error'](_0xcb7a('0x11'),_0x33c36a,_0x26a70d[_0xcb7a('0xf')][_0xcb7a('0x12')]);return _0x653611(_0x26a70d[_0xcb7a('0xf')][_0xcb7a('0x12')]);}logger[_0xcb7a('0xf')](_0xcb7a('0x11'),_0x33c36a,_0x26a70d[_0xcb7a('0xf')][_0xcb7a('0x12')]);return _0x4f5520(_0x26a70d[_0xcb7a('0xf')][_0xcb7a('0x12')]);}else{logger['info'](_0xcb7a('0x11'),_0x33c36a,_0xcb7a('0xc'));_0x4f5520(_0x26a70d[_0xcb7a('0x13')]['message']);}})['catch'](function(_0x3690bd){logger[_0xcb7a('0xf')](_0xcb7a('0x11'),_0x33c36a,_0x3690bd);_0x653611(_0x3690bd);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 1bd207c..505aee2 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 _0x01f2=['getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x21f4ec,_0x10230a){var _0x8b6a3f=function(_0x12123e){while(--_0x12123e){_0x21f4ec['push'](_0x21f4ec['shift']());}};_0x8b6a3f(++_0x10230a);}(_0x01f2,0xad));var _0x201f=function(_0x243eca,_0x5e775e){_0x243eca=_0x243eca-0x0;var _0x11ce5a=_0x01f2[_0x243eca];return _0x11ce5a;};'use strict';var multer=require(_0x201f('0x0'));var util=require(_0x201f('0x1'));var path=require(_0x201f('0x2'));var timeout=require(_0x201f('0x3'));var express=require(_0x201f('0x4'));var router=express[_0x201f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x201f('0x6'));var interaction=require(_0x201f('0x7'));var config=require(_0x201f('0x8'));var controller=require(_0x201f('0x9'));router[_0x201f('0xa')]('/',auth[_0x201f('0xb')](),controller[_0x201f('0xc')]);router[_0x201f('0xa')](_0x201f('0xd'),auth[_0x201f('0xb')](),controller[_0x201f('0xe')]);router[_0x201f('0xa')](_0x201f('0xf'),auth[_0x201f('0xb')](),controller[_0x201f('0x10')]);router['get'](_0x201f('0x11'),auth['isAuthenticated'](),controller[_0x201f('0x12')]);router['post']('/',auth[_0x201f('0xb')](),controller[_0x201f('0x13')]);router[_0x201f('0x14')](_0x201f('0xf'),auth[_0x201f('0xb')](),controller[_0x201f('0x15')]);router[_0x201f('0x16')]('/:id',auth[_0x201f('0xb')](),controller[_0x201f('0x17')]);router[_0x201f('0x18')](_0x201f('0xd'),auth[_0x201f('0xb')](),controller[_0x201f('0x19')]);module[_0x201f('0x1a')]=router; \ No newline at end of file +var _0x17e2=['post','create','addConfiguration','put','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x19fab3,_0x2379c7){var _0x3ed5f7=function(_0x1e2b75){while(--_0x1e2b75){_0x19fab3['push'](_0x19fab3['shift']());}};_0x3ed5f7(++_0x2379c7);}(_0x17e2,0x99));var _0x217e=function(_0x34d921,_0xd1dfba){_0x34d921=_0x34d921-0x0;var _0x8591f1=_0x17e2[_0x34d921];return _0x8591f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x217e('0x0'));var timeout=require('connect-timeout');var express=require(_0x217e('0x1'));var router=express[_0x217e('0x2')]();var fs_extra=require(_0x217e('0x3'));var auth=require(_0x217e('0x4'));var interaction=require(_0x217e('0x5'));var config=require('../../config/environment');var controller=require(_0x217e('0x6'));router[_0x217e('0x7')]('/',auth[_0x217e('0x8')](),controller[_0x217e('0x9')]);router[_0x217e('0x7')](_0x217e('0xa'),auth[_0x217e('0x8')](),controller[_0x217e('0xb')]);router[_0x217e('0x7')](_0x217e('0xc'),auth[_0x217e('0x8')](),controller['getConfigurations']);router[_0x217e('0x7')](_0x217e('0xd'),auth[_0x217e('0x8')](),controller[_0x217e('0xe')]);router[_0x217e('0xf')]('/',auth[_0x217e('0x8')](),controller[_0x217e('0x10')]);router[_0x217e('0xf')]('/:id/configurations',auth[_0x217e('0x8')](),controller[_0x217e('0x11')]);router[_0x217e('0x12')](_0x217e('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x217e('0xa'),auth[_0x217e('0x8')](),controller[_0x217e('0x13')]);module[_0x217e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 668270f..6d8a551 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 _0xf3cd=['exports','STRING','sequelize'];(function(_0x568d66,_0xbb1827){var _0x52270c=function(_0x375b1f){while(--_0x375b1f){_0x568d66['push'](_0x568d66['shift']());}};_0x52270c(++_0xbb1827);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0xf3cd[_0x4ef826];return _0x154b8;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'description':{'type':Sequelize[_0xdf3c('0x2')]},'host':{'type':Sequelize[_0xdf3c('0x2')]},'zone':{'type':Sequelize[_0xdf3c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdf3c('0x2')]},'serverUrl':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xdf3c('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x91a7=['STRING','exports'];(function(_0x3a60c8,_0x332652){var _0x22d2c6=function(_0x418dcb){while(--_0x418dcb){_0x3a60c8['push'](_0x3a60c8['shift']());}};_0x22d2c6(++_0x332652);}(_0x91a7,0xe7));var _0x791a=function(_0x598c4c,_0x3dfeb2){_0x598c4c=_0x598c4c-0x0;var _0x4facdb=_0x91a7[_0x598c4c];return _0x4facdb;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a9d8675..dab0002 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 _0x08ad=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','ZohoAccount','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','findOne','ZohoConfiguration','pick','getConfigurations','addConfiguration','AccountId','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','refreshToken','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x21fa02,_0x1f41bb){var _0x3c1f03=function(_0x9b7dd9){while(--_0x9b7dd9){_0x21fa02['push'](_0x21fa02['shift']());}};_0x3c1f03(++_0x1f41bb);}(_0x08ad,0xfa));var _0xd08a=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x08ad[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0xd08a('0x0'));var rimraf=require(_0xd08a('0x1'));var zipdir=require(_0xd08a('0x2'));var jsonpatch=require(_0xd08a('0x3'));var rp=require(_0xd08a('0x4'));var moment=require(_0xd08a('0x5'));var BPromise=require(_0xd08a('0x6'));var Mustache=require(_0xd08a('0x7'));var util=require(_0xd08a('0x8'));var path=require(_0xd08a('0x9'));var sox=require(_0xd08a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd08a('0xb'));var _=require(_0xd08a('0xc'));var squel=require(_0xd08a('0xd'));var crypto=require(_0xd08a('0xe'));var jsforce=require(_0xd08a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd08a('0x10'));var querystring=require(_0xd08a('0x11'));var Papa=require(_0xd08a('0x12'));var Redis=require(_0xd08a('0x13'));var authService=require(_0xd08a('0x14'));var qs=require(_0xd08a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd08a('0x16'))('api');var utils=require(_0xd08a('0x17'));var config=require(_0xd08a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd08a('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x11b569,_0x51ca5b){_0x51ca5b=_0x51ca5b||0xcc;return function(_0x13dda0){if(_0x13dda0){return _0x11b569[_0xd08a('0x1a')](_0x51ca5b);}return _0x11b569[_0xd08a('0x1b')](_0x51ca5b)[_0xd08a('0x1c')]();};}function respondWithResult(_0x2a8e54,_0x4ef251){_0x4ef251=_0x4ef251||0xc8;return function(_0x5f24a0){if(_0x5f24a0){return _0x2a8e54[_0xd08a('0x1b')](_0x4ef251)['json'](_0x5f24a0);}};}function respondWithFilteredResult(_0x52fd6f,_0x5f4d72){return function(_0x2e5fd4){if(_0x2e5fd4){var _0x1990cc=typeof _0x5f4d72[_0xd08a('0x1d')]==='undefined'&&typeof _0x5f4d72[_0xd08a('0x1e')]===_0xd08a('0x1f');var _0xcaef41=_0x2e5fd4['count'];var _0x3f883e=_0x1990cc?0x0:_0x5f4d72[_0xd08a('0x1d')];var _0x1f1dba=_0x1990cc?_0x2e5fd4[_0xd08a('0x20')]:_0x5f4d72['offset']+_0x5f4d72[_0xd08a('0x1e')];var _0x3c1d5f;if(_0x1f1dba>=_0xcaef41){_0x1f1dba=_0xcaef41;_0x3c1d5f=0xc8;}else{_0x3c1d5f=0xce;}_0x52fd6f[_0xd08a('0x1b')](_0x3c1d5f);return _0x52fd6f[_0xd08a('0x21')](_0xd08a('0x22'),_0x3f883e+'-'+_0x1f1dba+'/'+_0xcaef41)[_0xd08a('0x23')](_0x2e5fd4);}return null;};}function patchUpdates(_0x2203cf){return function(_0x337887){try{jsonpatch[_0xd08a('0x24')](_0x337887,_0x2203cf,!![]);}catch(_0x51a21d){return BPromise[_0xd08a('0x25')](_0x51a21d);}return _0x337887['save']();};}function saveUpdates(_0x1150fd,_0x31afb0){return function(_0xde7913){if(_0xde7913){return _0xde7913[_0xd08a('0x26')](_0x1150fd)[_0xd08a('0x27')](function(_0x279449){return _0x279449;});}return null;};}function removeEntity(_0x54daa6,_0x3db915){return function(_0x4f5176){if(_0x4f5176){return _0x4f5176[_0xd08a('0x28')]()[_0xd08a('0x27')](function(){_0x54daa6[_0xd08a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f633a,_0x4770f5){return function(_0x5226c0){if(!_0x5226c0){_0x1f633a[_0xd08a('0x1a')](0x194);}return _0x5226c0;};}function handleError(_0x14ff6b,_0xb07129){_0xb07129=_0xb07129||0x1f4;return function(_0x962d4a){logger[_0xd08a('0x29')](_0x962d4a['stack']);if(_0x962d4a[_0xd08a('0x2a')]){delete _0x962d4a[_0xd08a('0x2a')];}_0x14ff6b[_0xd08a('0x1b')](_0xb07129)[_0xd08a('0x2b')](_0x962d4a);};}exports[_0xd08a('0x2c')]=function(_0x53f033,_0x2d3b50){var _0x1cfda6={},_0x164352={},_0x58f30f={'count':0x0,'rows':[]};var _0x132a3d=_['map'](db[_0xd08a('0x2d')][_0xd08a('0x2e')],function(_0x413fd2){return{'name':_0x413fd2['fieldName'],'type':_0x413fd2[_0xd08a('0x2f')]['key']};});_0x164352[_0xd08a('0x30')]=_[_0xd08a('0x31')](_0x132a3d,_0xd08a('0x2a'));_0x164352[_0xd08a('0x32')]=_[_0xd08a('0x33')](_0x53f033['query']);_0x164352[_0xd08a('0x34')]=_[_0xd08a('0x35')](_0x164352[_0xd08a('0x30')],_0x164352['query']);_0x1cfda6[_0xd08a('0x36')]=_[_0xd08a('0x35')](_0x164352[_0xd08a('0x30')],qs['fields'](_0x53f033[_0xd08a('0x32')]['fields']));_0x1cfda6[_0xd08a('0x36')]=_0x1cfda6[_0xd08a('0x36')][_0xd08a('0x37')]?_0x1cfda6[_0xd08a('0x36')]:_0x164352[_0xd08a('0x30')];if(!_0x53f033[_0xd08a('0x32')][_0xd08a('0x38')](_0xd08a('0x39'))){_0x1cfda6['limit']=qs[_0xd08a('0x1e')](_0x53f033[_0xd08a('0x32')][_0xd08a('0x1e')]);_0x1cfda6['offset']=qs[_0xd08a('0x1d')](_0x53f033[_0xd08a('0x32')][_0xd08a('0x1d')]);}_0x1cfda6[_0xd08a('0x3a')]=qs[_0xd08a('0x3b')](_0x53f033['query'][_0xd08a('0x3b')]);_0x1cfda6['where']=qs[_0xd08a('0x34')](_['pick'](_0x53f033[_0xd08a('0x32')],_0x164352['filters']),_0x132a3d);if(_0x53f033[_0xd08a('0x32')][_0xd08a('0x3c')]){_0x1cfda6[_0xd08a('0x3d')]=_[_0xd08a('0x3e')](_0x1cfda6['where'],{'$or':_['map'](_0x132a3d,function(_0x2a5977){if(_0x2a5977['type']!==_0xd08a('0x3f')){var _0x81756f={};_0x81756f[_0x2a5977['name']]={'$like':'%'+_0x53f033['query']['filter']+'%'};return _0x81756f;}})});}_0x1cfda6=_[_0xd08a('0x3e')]({},_0x1cfda6,_0x53f033[_0xd08a('0x40')]);var _0x5455df={'where':_0x1cfda6[_0xd08a('0x3d')]};return db['ZohoAccount'][_0xd08a('0x20')](_0x5455df)[_0xd08a('0x27')](function(_0x46dee8){_0x58f30f[_0xd08a('0x20')]=_0x46dee8;if(_0x53f033['query'][_0xd08a('0x41')]){_0x1cfda6[_0xd08a('0x42')]=[{'all':!![]}];}return db[_0xd08a('0x2d')][_0xd08a('0x43')](_0x1cfda6);})[_0xd08a('0x27')](function(_0x3c244f){_0x58f30f[_0xd08a('0x44')]=_0x3c244f;return _0x58f30f;})['then'](respondWithFilteredResult(_0x2d3b50,_0x1cfda6))[_0xd08a('0x45')](handleError(_0x2d3b50,null));};exports[_0xd08a('0x46')]=function(_0x1a2377,_0x1d490e){var _0x3bbfe1={'raw':![],'where':{'id':_0x1a2377[_0xd08a('0x47')]['id']}},_0x14679e={};_0x14679e[_0xd08a('0x30')]=_[_0xd08a('0x33')](db['ZohoAccount'][_0xd08a('0x2e')]);_0x14679e[_0xd08a('0x32')]=_[_0xd08a('0x33')](_0x1a2377[_0xd08a('0x32')]);_0x14679e[_0xd08a('0x34')]=_[_0xd08a('0x35')](_0x14679e[_0xd08a('0x30')],_0x14679e['query']);_0x3bbfe1[_0xd08a('0x36')]=_[_0xd08a('0x35')](_0x14679e[_0xd08a('0x30')],qs[_0xd08a('0x48')](_0x1a2377[_0xd08a('0x32')][_0xd08a('0x48')]));_0x3bbfe1[_0xd08a('0x36')]=_0x3bbfe1[_0xd08a('0x36')][_0xd08a('0x37')]?_0x3bbfe1[_0xd08a('0x36')]:_0x14679e['model'];if(_0x1a2377[_0xd08a('0x32')][_0xd08a('0x41')]){_0x3bbfe1[_0xd08a('0x42')]=[{'all':!![]}];}_0x3bbfe1=_[_0xd08a('0x3e')]({},_0x3bbfe1,_0x1a2377['options']);return db[_0xd08a('0x2d')]['find'](_0x3bbfe1)[_0xd08a('0x27')](handleEntityNotFound(_0x1d490e,null))[_0xd08a('0x27')](respondWithResult(_0x1d490e,null))[_0xd08a('0x45')](handleError(_0x1d490e,null));};exports['create']=function(_0x3102cc,_0x5e3d67){return db[_0xd08a('0x2d')][_0xd08a('0x49')](_0x3102cc[_0xd08a('0x4a')],{})[_0xd08a('0x27')](respondWithResult(_0x5e3d67,0xc9))[_0xd08a('0x45')](handleError(_0x5e3d67,null));};exports[_0xd08a('0x26')]=function(_0x186ad8,_0x1ff93b){if(_0x186ad8[_0xd08a('0x4a')]['id']){delete _0x186ad8[_0xd08a('0x4a')]['id'];}return db[_0xd08a('0x2d')]['find']({'where':{'id':_0x186ad8[_0xd08a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ff93b,null))[_0xd08a('0x27')](saveUpdates(_0x186ad8[_0xd08a('0x4a')],null))[_0xd08a('0x27')](respondWithResult(_0x1ff93b,null))[_0xd08a('0x45')](handleError(_0x1ff93b,null));};exports[_0xd08a('0x28')]=function(_0x24d936,_0x5407ed){return db[_0xd08a('0x2d')][_0xd08a('0x4b')]({'where':{'id':_0x24d936['params']['id']}})[_0xd08a('0x27')](handleEntityNotFound(_0x5407ed,null))[_0xd08a('0x27')](removeEntity(_0x5407ed,null))[_0xd08a('0x45')](handleError(_0x5407ed,null));};exports['getConfigurations']=function(_0x3a3261,_0x274467,_0x31a019){var _0x41ecf3={};var _0xc4913b={};var _0x289cce;var _0x1f9eff;return db[_0xd08a('0x2d')][_0xd08a('0x4c')]({'where':{'id':_0x3a3261[_0xd08a('0x47')]['id']}})[_0xd08a('0x27')](handleEntityNotFound(_0x274467,null))[_0xd08a('0x27')](function(_0x26bfcc){if(_0x26bfcc){_0x289cce=_0x26bfcc;_0xc4913b['model']=_[_0xd08a('0x33')](db[_0xd08a('0x4d')][_0xd08a('0x2e')]);_0xc4913b[_0xd08a('0x32')]=_['keys'](_0x3a3261[_0xd08a('0x32')]);_0xc4913b[_0xd08a('0x34')]=_['intersection'](_0xc4913b[_0xd08a('0x30')],_0xc4913b[_0xd08a('0x32')]);_0x41ecf3[_0xd08a('0x36')]=_[_0xd08a('0x35')](_0xc4913b[_0xd08a('0x30')],qs[_0xd08a('0x48')](_0x3a3261['query'][_0xd08a('0x48')]));_0x41ecf3[_0xd08a('0x36')]=_0x41ecf3[_0xd08a('0x36')][_0xd08a('0x37')]?_0x41ecf3[_0xd08a('0x36')]:_0xc4913b['model'];_0x41ecf3[_0xd08a('0x3a')]=qs[_0xd08a('0x3b')](_0x3a3261[_0xd08a('0x32')][_0xd08a('0x3b')]);_0x41ecf3['where']=qs[_0xd08a('0x34')](_[_0xd08a('0x4e')](_0x3a3261[_0xd08a('0x32')],_0xc4913b[_0xd08a('0x34')]));if(_0x3a3261[_0xd08a('0x32')][_0xd08a('0x3c')]){_0x41ecf3[_0xd08a('0x3d')]=_[_0xd08a('0x3e')](_0x41ecf3[_0xd08a('0x3d')],{'$or':_[_0xd08a('0x31')](_0x41ecf3[_0xd08a('0x36')],function(_0x212e2e){var _0x16dc35={};_0x16dc35[_0x212e2e]={'$like':'%'+_0x3a3261[_0xd08a('0x32')][_0xd08a('0x3c')]+'%'};return _0x16dc35;})});}_0x41ecf3=_['merge']({},_0x41ecf3,_0x3a3261[_0xd08a('0x40')]);return _0x289cce[_0xd08a('0x4f')](_0x41ecf3);}})[_0xd08a('0x27')](function(_0x33c22a){if(_0x33c22a){_0x1f9eff=_0x33c22a[_0xd08a('0x37')];if(!_0x3a3261['query'][_0xd08a('0x38')](_0xd08a('0x39'))){_0x41ecf3[_0xd08a('0x1e')]=qs['limit'](_0x3a3261[_0xd08a('0x32')][_0xd08a('0x1e')]);_0x41ecf3[_0xd08a('0x1d')]=qs[_0xd08a('0x1d')](_0x3a3261[_0xd08a('0x32')][_0xd08a('0x1d')]);}return _0x289cce[_0xd08a('0x4f')](_0x41ecf3);}})[_0xd08a('0x27')](function(_0x40a634){if(_0x40a634){return _0x40a634?{'count':_0x1f9eff,'rows':_0x40a634}:null;}})['then'](respondWithResult(_0x274467,null))[_0xd08a('0x45')](handleError(_0x274467,null));};exports[_0xd08a('0x50')]=function(_0x34e425,_0x44823f,_0x30df0c){if(_0x34e425[_0xd08a('0x4a')]['id']){delete _0x34e425[_0xd08a('0x4a')]['id'];}return db[_0xd08a('0x2d')][_0xd08a('0x4c')]({'where':{'id':_0x34e425[_0xd08a('0x47')]['id']}})[_0xd08a('0x27')](handleEntityNotFound(_0x44823f,null))[_0xd08a('0x27')](function(_0xcf7378){if(_0xcf7378){_0x34e425[_0xd08a('0x4a')][_0xd08a('0x51')]=_0xcf7378['id'];_0x34e425[_0xd08a('0x4a')]['Subjects']=integrations['getSubjects'](_0x34e425[_0xd08a('0x4a')]['channel'],_0x34e425['body'][_0xd08a('0x2f')]);_0x34e425[_0xd08a('0x4a')][_0xd08a('0x52')]=integrations[_0xd08a('0x53')](_0x34e425[_0xd08a('0x4a')][_0xd08a('0x54')],_0x34e425['body']['type']);return db[_0xd08a('0x4d')][_0xd08a('0x49')](_0x34e425[_0xd08a('0x4a')],{'include':[{'model':db[_0xd08a('0x55')],'as':'Subjects'},{'model':db[_0xd08a('0x55')],'as':_0xd08a('0x52')}]});}return null;})[_0xd08a('0x27')](respondWithResult(_0x44823f,null))[_0xd08a('0x45')](handleError(_0x44823f,null));};function getAccessToken(_0x4df118){return new Promise(function(_0x3d7e01,_0x45cfbc){var _0x5b714f;switch(_0x4df118[_0xd08a('0x56')]){case'US':_0x5b714f=_0xd08a('0x57');break;case'AU':_0x5b714f=_0xd08a('0x58');break;case'EU':_0x5b714f=_0xd08a('0x59');break;case'IN':_0x5b714f=_0xd08a('0x5a');break;case'CN':_0x5b714f=_0xd08a('0x5b');break;default:_0x5b714f=_0xd08a('0x59');break;}var _0x3e407e={'method':_0xd08a('0x5c'),'uri':_0x5b714f+_0xd08a('0x5d'),'qs':{'refresh_token':_0x4df118['refreshToken'],'client_id':_0x4df118[_0xd08a('0x5e')],'client_secret':_0x4df118[_0xd08a('0x5f')],'grant_type':_0xd08a('0x60')},'json':!![]};return rp(_0x3e407e)[_0xd08a('0x27')](function(_0x3a1d9e){if(_0x3a1d9e[_0xd08a('0x61')]){_0x3d7e01(_0x3a1d9e[_0xd08a('0x61')]);}else{_0x45cfbc(_0xd08a('0x62'));}})[_0xd08a('0x45')](function(_0x1ff284){_0x45cfbc(_0x1ff284);});});}exports[_0xd08a('0x63')]=function(_0xa02d2e,_0x48626f,_0xd4e265){var _0x568808,_0x582452,_0x25d615,_0x473ddd,_0x534e96;return db[_0xd08a('0x2d')]['findOne']({'where':{'id':_0xa02d2e['params']['id']},'attributes':['id',_0xd08a('0x64'),'zone',_0xd08a('0x5e'),_0xd08a('0x5f'),_0xd08a('0x65'),_0xd08a('0x66'),'refreshToken']})[_0xd08a('0x27')](handleEntityNotFound(_0x48626f,null))[_0xd08a('0x27')](function(_0x133d9c){_0x534e96=_0x133d9c;_0x568808=_0x534e96[_0xd08a('0x64')];_0x582452=_0x568808===_0xd08a('0x67')?'eu':_0xd08a('0x68');_0x25d615=_0x534e96[_0xd08a('0x65')];var _0x436eb5=_0x25d615[_0xd08a('0x69')](-0x1);if(_0x436eb5==='/'||_0x436eb5==='\x5c'||_0x436eb5===':'){_0x25d615=_0x25d615[_0xd08a('0x6a')](0x0,_0x25d615[_0xd08a('0x6b')](_0x436eb5));}if(!_0x534e96[_0xd08a('0x6c')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x534e96);})[_0xd08a('0x27')](function(_0x44bc14){if(_0x44bc14){return rp({'method':_0xd08a('0x6d'),'uri':util[_0xd08a('0x6e')](_0xd08a('0x6f'),_0x582452),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x44bc14},'json':!![]});}})[_0xd08a('0x27')](function(_0x2ffc93){if(_0x2ffc93){if(_0x2ffc93[_0xd08a('0x70')]&&_0x2ffc93[_0xd08a('0x70')][_0xd08a('0x29')]){throw new Error(_0x2ffc93[_0xd08a('0x70')][_0xd08a('0x29')][_0xd08a('0x71')]);}var _0x9bb889=[];var _0x22b36a=[];var _0x5487a9=[_0xd08a('0x72'),'Subject',_0xd08a('0x73'),_0xd08a('0x74'),_0xd08a('0x75'),_0xd08a('0x76'),_0xd08a('0x77'),_0xd08a('0x78')];_0x22b36a=_[_0xd08a('0x79')](_0x2ffc93['fields'],function(_0x2ce171){return _0x5487a9['includes'](_0x2ce171[_0xd08a('0x7a')]);});for(var _0x597ca5=0x0;_0x597ca5<_0x22b36a[_0xd08a('0x37')];_0x597ca5++){if(_0x22b36a[_0x597ca5]['system_mandatory']===![]){_0x9bb889[_0xd08a('0x7b')]({'id':_0x22b36a[_0x597ca5]['id'],'name':_0x22b36a[_0x597ca5][_0xd08a('0x7c')],'custom':_0x22b36a[_0x597ca5][_0xd08a('0x7d')],'options':_0x22b36a[_0x597ca5][_0xd08a('0x7e')]==='picklist'&&_0x22b36a[_0x597ca5][_0xd08a('0x7f')]['length']>-0x1?_[_0xd08a('0x31')](_0x22b36a[_0x597ca5][_0xd08a('0x7f')],function(_0x4bf34e){return{'name':_0x4bf34e,'value':_0x4bf34e};}):[]});}}return{'count':_0x9bb889['length'],'rows':_0x9bb889};}else{return{'count':0x0,'rows':[]};}})[_0xd08a('0x27')](respondWithResult(_0x48626f,null))[_0xd08a('0x45')](function(_0x3d8e82){var _0x1de0b3=_0xa02d2e['query'][_0xd08a('0x80')]?0x1f4:_0x3d8e82[_0xd08a('0x81')]||0x1f4;logger[_0xd08a('0x29')](_0xd08a('0x82'),_0xd08a('0x63'),_0x1de0b3,JSON[_0xd08a('0x83')](_0x3d8e82));delete _0x3d8e82[_0xd08a('0x2a')];if(_0x1de0b3===0x191){_0x1de0b3=0x190;}_0x48626f[_0xd08a('0x1b')](_0x1de0b3)['send'](_0xa02d2e['query']['test']?{'message':_0xd08a('0x84'),'statusCode':_0x3d8e82[_0xd08a('0x81')]}:_0x3d8e82);});}; \ No newline at end of file +var _0x7226=['keys','filters','intersection','model','fields','attributes','length','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','destroy','getConfigurations','findOne','ZohoConfiguration','rawAttributes','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','error','name','index','map','ZohoAccount','type','key','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7226,0x1dc));var _0x6722=function(_0x26f57f,_0x64e3df){_0x26f57f=_0x26f57f-0x0;var _0x3473ba=_0x7226[_0x26f57f];return _0x3473ba;};'use strict';var emlformat=require(_0x6722('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6722('0x1'));var jsonpatch=require(_0x6722('0x2'));var rp=require(_0x6722('0x3'));var moment=require(_0x6722('0x4'));var BPromise=require(_0x6722('0x5'));var Mustache=require(_0x6722('0x6'));var util=require('util');var path=require(_0x6722('0x7'));var sox=require(_0x6722('0x8'));var csv=require(_0x6722('0x9'));var ejs=require(_0x6722('0xa'));var fs=require('fs');var fs_extra=require(_0x6722('0xb'));var _=require(_0x6722('0xc'));var squel=require(_0x6722('0xd'));var crypto=require(_0x6722('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6722('0xf'));var toCsv=require(_0x6722('0x9'));var querystring=require('querystring');var Papa=require(_0x6722('0x10'));var Redis=require(_0x6722('0x11'));var authService=require(_0x6722('0x12'));var qs=require(_0x6722('0x13'));var as=require(_0x6722('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6722('0x15'));var utils=require(_0x6722('0x16'));var config=require(_0x6722('0x17'));var licenseUtil=require(_0x6722('0x18'));var db=require(_0x6722('0x19'))['db'];var integrations=require(_0x6722('0x1a'));function respondWithStatusCode(_0x31a2db,_0x5bcdb3){_0x5bcdb3=_0x5bcdb3||0xcc;return function(_0x489dc9){if(_0x489dc9){return _0x31a2db[_0x6722('0x1b')](_0x5bcdb3);}return _0x31a2db[_0x6722('0x1c')](_0x5bcdb3)[_0x6722('0x1d')]();};}function respondWithResult(_0x4b6996,_0x570cbb){_0x570cbb=_0x570cbb||0xc8;return function(_0x4589e7){if(_0x4589e7){return _0x4b6996[_0x6722('0x1c')](_0x570cbb)[_0x6722('0x1e')](_0x4589e7);}};}function respondWithFilteredResult(_0x3f1f6e,_0x53e46b){return function(_0x5af46a){if(_0x5af46a){var _0x6d9c5=typeof _0x53e46b[_0x6722('0x1f')]==='undefined'&&typeof _0x53e46b['limit']===_0x6722('0x20');var _0x4085a2=_0x5af46a[_0x6722('0x21')];var _0x5e2d6c=_0x6d9c5?0x0:_0x53e46b[_0x6722('0x1f')];var _0x5986b3=_0x6d9c5?_0x5af46a['count']:_0x53e46b[_0x6722('0x1f')]+_0x53e46b[_0x6722('0x22')];var _0x186a59;if(_0x5986b3>=_0x4085a2){_0x5986b3=_0x4085a2;_0x186a59=0xc8;}else{_0x186a59=0xce;}_0x3f1f6e[_0x6722('0x1c')](_0x186a59);return _0x3f1f6e[_0x6722('0x23')]('Content-Range',_0x5e2d6c+'-'+_0x5986b3+'/'+_0x4085a2)[_0x6722('0x1e')](_0x5af46a);}return null;};}function patchUpdates(_0x4e98e8){return function(_0x2fc047){try{jsonpatch[_0x6722('0x24')](_0x2fc047,_0x4e98e8,!![]);}catch(_0x7d56fd){return BPromise[_0x6722('0x25')](_0x7d56fd);}return _0x2fc047[_0x6722('0x26')]();};}function saveUpdates(_0x49861e,_0x1f85dd){return function(_0x41b372){if(_0x41b372){return _0x41b372['update'](_0x49861e)[_0x6722('0x27')](function(_0x51f644){return _0x51f644;});}return null;};}function removeEntity(_0x2c1ea8,_0x2a5d56){return function(_0x389025){if(_0x389025){return _0x389025['destroy']()['then'](function(){_0x2c1ea8['status'](0xcc)[_0x6722('0x1d')]();});}};}function handleEntityNotFound(_0x53f8eb,_0x2b0bbd){return function(_0x42afd4){if(!_0x42afd4){_0x53f8eb[_0x6722('0x1b')](0x194);}return _0x42afd4;};}function handleError(_0x191397,_0x422a26){_0x422a26=_0x422a26||0x1f4;return function(_0x52dad6){logger[_0x6722('0x28')](_0x52dad6['stack']);if(_0x52dad6[_0x6722('0x29')]){delete _0x52dad6[_0x6722('0x29')];}_0x191397['status'](_0x422a26)['send'](_0x52dad6);};}exports[_0x6722('0x2a')]=function(_0x57b0bd,_0x5147e5){var _0x1df811={},_0x22040c={},_0x1a44fb={'count':0x0,'rows':[]};var _0x4a136e=_[_0x6722('0x2b')](db[_0x6722('0x2c')]['rawAttributes'],function(_0x3c1009){return{'name':_0x3c1009['fieldName'],'type':_0x3c1009[_0x6722('0x2d')][_0x6722('0x2e')]};});_0x22040c['model']=_[_0x6722('0x2b')](_0x4a136e,_0x6722('0x29'));_0x22040c[_0x6722('0x2f')]=_[_0x6722('0x30')](_0x57b0bd[_0x6722('0x2f')]);_0x22040c[_0x6722('0x31')]=_['intersection'](_0x22040c['model'],_0x22040c[_0x6722('0x2f')]);_0x1df811['attributes']=_[_0x6722('0x32')](_0x22040c[_0x6722('0x33')],qs['fields'](_0x57b0bd[_0x6722('0x2f')][_0x6722('0x34')]));_0x1df811['attributes']=_0x1df811[_0x6722('0x35')][_0x6722('0x36')]?_0x1df811[_0x6722('0x35')]:_0x22040c[_0x6722('0x33')];if(!_0x57b0bd['query']['hasOwnProperty']('nolimit')){_0x1df811[_0x6722('0x22')]=qs[_0x6722('0x22')](_0x57b0bd[_0x6722('0x2f')]['limit']);_0x1df811['offset']=qs[_0x6722('0x1f')](_0x57b0bd[_0x6722('0x2f')]['offset']);}_0x1df811['order']=qs[_0x6722('0x37')](_0x57b0bd[_0x6722('0x2f')][_0x6722('0x37')]);_0x1df811[_0x6722('0x38')]=qs[_0x6722('0x31')](_[_0x6722('0x39')](_0x57b0bd[_0x6722('0x2f')],_0x22040c[_0x6722('0x31')]),_0x4a136e);if(_0x57b0bd['query']['filter']){_0x1df811['where']=_[_0x6722('0x3a')](_0x1df811['where'],{'$or':_[_0x6722('0x2b')](_0x4a136e,function(_0x3469a6){if(_0x3469a6['type']!==_0x6722('0x3b')){var _0x343a03={};_0x343a03[_0x3469a6[_0x6722('0x29')]]={'$like':'%'+_0x57b0bd['query'][_0x6722('0x3c')]+'%'};return _0x343a03;}})});}_0x1df811=_['merge']({},_0x1df811,_0x57b0bd['options']);var _0x39d331={'where':_0x1df811[_0x6722('0x38')]};return db['ZohoAccount'][_0x6722('0x21')](_0x39d331)[_0x6722('0x27')](function(_0x4eed71){_0x1a44fb['count']=_0x4eed71;if(_0x57b0bd[_0x6722('0x2f')][_0x6722('0x3d')]){_0x1df811[_0x6722('0x3e')]=[{'all':!![]}];}return db['ZohoAccount'][_0x6722('0x3f')](_0x1df811);})[_0x6722('0x27')](function(_0x415fb9){_0x1a44fb[_0x6722('0x40')]=_0x415fb9;return _0x1a44fb;})['then'](respondWithFilteredResult(_0x5147e5,_0x1df811))['catch'](handleError(_0x5147e5,null));};exports[_0x6722('0x41')]=function(_0x153a08,_0x60d5aa){var _0x4301e0={'raw':![],'where':{'id':_0x153a08[_0x6722('0x42')]['id']}},_0x3db99c={};_0x3db99c[_0x6722('0x33')]=_[_0x6722('0x30')](db[_0x6722('0x2c')]['rawAttributes']);_0x3db99c[_0x6722('0x2f')]=_[_0x6722('0x30')](_0x153a08[_0x6722('0x2f')]);_0x3db99c[_0x6722('0x31')]=_[_0x6722('0x32')](_0x3db99c['model'],_0x3db99c['query']);_0x4301e0[_0x6722('0x35')]=_['intersection'](_0x3db99c[_0x6722('0x33')],qs[_0x6722('0x34')](_0x153a08[_0x6722('0x2f')]['fields']));_0x4301e0[_0x6722('0x35')]=_0x4301e0[_0x6722('0x35')][_0x6722('0x36')]?_0x4301e0[_0x6722('0x35')]:_0x3db99c[_0x6722('0x33')];if(_0x153a08['query']['includeAll']){_0x4301e0[_0x6722('0x3e')]=[{'all':!![]}];}_0x4301e0=_[_0x6722('0x3a')]({},_0x4301e0,_0x153a08[_0x6722('0x43')]);return db['ZohoAccount'][_0x6722('0x44')](_0x4301e0)[_0x6722('0x27')](handleEntityNotFound(_0x60d5aa,null))['then'](respondWithResult(_0x60d5aa,null))[_0x6722('0x45')](handleError(_0x60d5aa,null));};exports[_0x6722('0x46')]=function(_0xd5953f,_0x5e5bc1){return db['ZohoAccount'][_0x6722('0x46')](_0xd5953f[_0x6722('0x47')],{})[_0x6722('0x27')](respondWithResult(_0x5e5bc1,0xc9))[_0x6722('0x45')](handleError(_0x5e5bc1,null));};exports[_0x6722('0x48')]=function(_0x41e352,_0x463b13){if(_0x41e352[_0x6722('0x47')]['id']){delete _0x41e352[_0x6722('0x47')]['id'];}return db[_0x6722('0x2c')][_0x6722('0x44')]({'where':{'id':_0x41e352[_0x6722('0x42')]['id']}})[_0x6722('0x27')](handleEntityNotFound(_0x463b13,null))[_0x6722('0x27')](saveUpdates(_0x41e352[_0x6722('0x47')],null))[_0x6722('0x27')](respondWithResult(_0x463b13,null))[_0x6722('0x45')](handleError(_0x463b13,null));};exports[_0x6722('0x49')]=function(_0x270766,_0x1a7bce){return db[_0x6722('0x2c')]['find']({'where':{'id':_0x270766[_0x6722('0x42')]['id']}})[_0x6722('0x27')](handleEntityNotFound(_0x1a7bce,null))[_0x6722('0x27')](removeEntity(_0x1a7bce,null))[_0x6722('0x45')](handleError(_0x1a7bce,null));};exports[_0x6722('0x4a')]=function(_0x1ecea1,_0x41b55f,_0x253ccb){var _0x1c5ab9={};var _0x5e27dd={};var _0x574ae;var _0x2c8b6b;return db[_0x6722('0x2c')][_0x6722('0x4b')]({'where':{'id':_0x1ecea1[_0x6722('0x42')]['id']}})[_0x6722('0x27')](handleEntityNotFound(_0x41b55f,null))[_0x6722('0x27')](function(_0xe4b39e){if(_0xe4b39e){_0x574ae=_0xe4b39e;_0x5e27dd[_0x6722('0x33')]=_[_0x6722('0x30')](db[_0x6722('0x4c')][_0x6722('0x4d')]);_0x5e27dd[_0x6722('0x2f')]=_[_0x6722('0x30')](_0x1ecea1[_0x6722('0x2f')]);_0x5e27dd[_0x6722('0x31')]=_['intersection'](_0x5e27dd[_0x6722('0x33')],_0x5e27dd[_0x6722('0x2f')]);_0x1c5ab9[_0x6722('0x35')]=_[_0x6722('0x32')](_0x5e27dd[_0x6722('0x33')],qs[_0x6722('0x34')](_0x1ecea1[_0x6722('0x2f')][_0x6722('0x34')]));_0x1c5ab9[_0x6722('0x35')]=_0x1c5ab9[_0x6722('0x35')][_0x6722('0x36')]?_0x1c5ab9[_0x6722('0x35')]:_0x5e27dd[_0x6722('0x33')];_0x1c5ab9['order']=qs[_0x6722('0x37')](_0x1ecea1[_0x6722('0x2f')][_0x6722('0x37')]);_0x1c5ab9[_0x6722('0x38')]=qs[_0x6722('0x31')](_[_0x6722('0x39')](_0x1ecea1[_0x6722('0x2f')],_0x5e27dd[_0x6722('0x31')]));if(_0x1ecea1[_0x6722('0x2f')][_0x6722('0x3c')]){_0x1c5ab9[_0x6722('0x38')]=_[_0x6722('0x3a')](_0x1c5ab9['where'],{'$or':_[_0x6722('0x2b')](_0x1c5ab9[_0x6722('0x35')],function(_0x32218e){var _0x19ee56={};_0x19ee56[_0x32218e]={'$like':'%'+_0x1ecea1[_0x6722('0x2f')][_0x6722('0x3c')]+'%'};return _0x19ee56;})});}_0x1c5ab9=_[_0x6722('0x3a')]({},_0x1c5ab9,_0x1ecea1[_0x6722('0x43')]);return _0x574ae['getConfigurations'](_0x1c5ab9);}})[_0x6722('0x27')](function(_0x4ec2da){if(_0x4ec2da){_0x2c8b6b=_0x4ec2da[_0x6722('0x36')];if(!_0x1ecea1[_0x6722('0x2f')][_0x6722('0x4e')](_0x6722('0x4f'))){_0x1c5ab9['limit']=qs[_0x6722('0x22')](_0x1ecea1[_0x6722('0x2f')][_0x6722('0x22')]);_0x1c5ab9['offset']=qs[_0x6722('0x1f')](_0x1ecea1[_0x6722('0x2f')]['offset']);}return _0x574ae[_0x6722('0x4a')](_0x1c5ab9);}})[_0x6722('0x27')](function(_0x53ff85){if(_0x53ff85){return _0x53ff85?{'count':_0x2c8b6b,'rows':_0x53ff85}:null;}})['then'](respondWithResult(_0x41b55f,null))['catch'](handleError(_0x41b55f,null));};exports[_0x6722('0x50')]=function(_0x29356f,_0x393200,_0x1df042){if(_0x29356f[_0x6722('0x47')]['id']){delete _0x29356f['body']['id'];}return db[_0x6722('0x2c')][_0x6722('0x4b')]({'where':{'id':_0x29356f[_0x6722('0x42')]['id']}})[_0x6722('0x27')](handleEntityNotFound(_0x393200,null))[_0x6722('0x27')](function(_0xa3868){if(_0xa3868){_0x29356f[_0x6722('0x47')]['AccountId']=_0xa3868['id'];_0x29356f['body'][_0x6722('0x51')]=integrations[_0x6722('0x52')](_0x29356f['body'][_0x6722('0x53')],_0x29356f[_0x6722('0x47')]['type']);_0x29356f[_0x6722('0x47')][_0x6722('0x54')]=integrations[_0x6722('0x55')](_0x29356f[_0x6722('0x47')][_0x6722('0x53')],_0x29356f[_0x6722('0x47')]['type']);return db[_0x6722('0x4c')][_0x6722('0x46')](_0x29356f['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x6722('0x56')],'as':_0x6722('0x54')}]});}return null;})[_0x6722('0x27')](respondWithResult(_0x393200,null))[_0x6722('0x45')](handleError(_0x393200,null));};function getAccessToken(_0x218610){return new Promise(function(_0x1165ac,_0x43f510){var _0x2e2ab5;switch(_0x218610[_0x6722('0x57')]){case'US':_0x2e2ab5=_0x6722('0x58');break;case'AU':_0x2e2ab5=_0x6722('0x59');break;case'EU':_0x2e2ab5=_0x6722('0x5a');break;case'IN':_0x2e2ab5=_0x6722('0x5b');break;case'CN':_0x2e2ab5=_0x6722('0x5c');break;default:_0x2e2ab5=_0x6722('0x5a');break;}var _0x2bce0c={'method':_0x6722('0x5d'),'uri':_0x2e2ab5+_0x6722('0x5e'),'qs':{'refresh_token':_0x218610['refreshToken'],'client_id':_0x218610[_0x6722('0x5f')],'client_secret':_0x218610[_0x6722('0x60')],'grant_type':_0x6722('0x61')},'json':!![]};return rp(_0x2bce0c)['then'](function(_0x5be2b6){if(_0x5be2b6['access_token']){_0x1165ac(_0x5be2b6[_0x6722('0x62')]);}else{_0x43f510(_0x6722('0x63'));}})[_0x6722('0x45')](function(_0x554a7d){_0x43f510(_0x554a7d);});});}exports[_0x6722('0x64')]=function(_0x46f3a0,_0x1cd133,_0x178e96){var _0x1023d5,_0x414cbb,_0x42125a,_0xba446b,_0x5b31bc;return db[_0x6722('0x2c')]['findOne']({'where':{'id':_0x46f3a0['params']['id']},'attributes':['id',_0x6722('0x65'),_0x6722('0x57'),'clientId',_0x6722('0x60'),_0x6722('0x66'),'code',_0x6722('0x67')]})[_0x6722('0x27')](handleEntityNotFound(_0x1cd133,null))['then'](function(_0x52787e){_0x5b31bc=_0x52787e;_0x1023d5=_0x5b31bc[_0x6722('0x65')];_0x414cbb=_0x1023d5===_0x6722('0x68')?'eu':_0x6722('0x69');_0x42125a=_0x5b31bc[_0x6722('0x66')];var _0x2b0dc9=_0x42125a[_0x6722('0x6a')](-0x1);if(_0x2b0dc9==='/'||_0x2b0dc9==='\x5c'||_0x2b0dc9===':'){_0x42125a=_0x42125a[_0x6722('0x6b')](0x0,_0x42125a[_0x6722('0x6c')](_0x2b0dc9));}if(!_0x5b31bc['refreshToken']){throw new Error(_0x6722('0x6d'));}return getAccessToken(_0x5b31bc);})['then'](function(_0x1678e7){if(_0x1678e7){return rp({'method':'GET','uri':util[_0x6722('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x414cbb),'qs':{'module':'Calls'},'headers':{'Authorization':_0x6722('0x6f')+_0x1678e7},'json':!![]});}})[_0x6722('0x27')](function(_0x5b7d5c){if(_0x5b7d5c){if(_0x5b7d5c['response']&&_0x5b7d5c[_0x6722('0x70')][_0x6722('0x28')]){throw new Error(_0x5b7d5c[_0x6722('0x70')][_0x6722('0x28')][_0x6722('0x71')]);}var _0x2b6d1d=[];var _0x152b94=[];var _0x43488e=['Owner',_0x6722('0x72'),_0x6722('0x73'),_0x6722('0x74'),'Call_Duration',_0x6722('0x75'),_0x6722('0x76'),_0x6722('0x77')];_0x152b94=_[_0x6722('0x78')](_0x5b7d5c[_0x6722('0x34')],function(_0x34874e){return _0x43488e['includes'](_0x34874e[_0x6722('0x79')]);});for(var _0x1d4366=0x0;_0x1d4366<_0x152b94[_0x6722('0x36')];_0x1d4366++){if(_0x152b94[_0x1d4366][_0x6722('0x7a')]===![]){_0x2b6d1d[_0x6722('0x7b')]({'id':_0x152b94[_0x1d4366]['id'],'name':_0x152b94[_0x1d4366]['display_label'],'custom':_0x152b94[_0x1d4366][_0x6722('0x7c')],'options':_0x152b94[_0x1d4366][_0x6722('0x7d')]===_0x6722('0x7e')&&_0x152b94[_0x1d4366][_0x6722('0x7f')][_0x6722('0x36')]>-0x1?_[_0x6722('0x2b')](_0x152b94[_0x1d4366][_0x6722('0x7f')],function(_0x143e56){return{'name':_0x143e56,'value':_0x143e56};}):[]});}}return{'count':_0x2b6d1d[_0x6722('0x36')],'rows':_0x2b6d1d};}else{return{'count':0x0,'rows':[]};}})[_0x6722('0x27')](respondWithResult(_0x1cd133,null))[_0x6722('0x45')](function(_0x4d24ce){var _0x50e7b6=_0x46f3a0['query'][_0x6722('0x80')]?0x1f4:_0x4d24ce[_0x6722('0x81')]||0x1f4;logger['error'](_0x6722('0x82'),_0x6722('0x64'),_0x50e7b6,JSON['stringify'](_0x4d24ce));delete _0x4d24ce[_0x6722('0x29')];if(_0x50e7b6===0x191){_0x50e7b6=0x190;}_0x1cd133['status'](_0x50e7b6)['send'](_0x46f3a0[_0x6722('0x2f')][_0x6722('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x4d24ce[_0x6722('0x81')]}:_0x4d24ce);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ae743d0..3d51eb2 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 _0xdd18=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','host','slice','substring','lastIndexOf','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','zone'];(function(_0x2dd273,_0x4daf5c){var _0x1f3be3=function(_0x1f8a79){while(--_0x1f8a79){_0x2dd273['push'](_0x2dd273['shift']());}};_0x1f3be3(++_0x4daf5c);}(_0xdd18,0x1dd));var _0x8dd1=function(_0x534f4f,_0xd9e172){_0x534f4f=_0x534f4f-0x0;var _0x3aa387=_0xdd18[_0x534f4f];return _0x3aa387;};'use strict';var _=require('lodash');var util=require(_0x8dd1('0x0'));var logger=require(_0x8dd1('0x1'))(_0x8dd1('0x2'));var moment=require('moment');var BPromise=require(_0x8dd1('0x3'));var rp=require(_0x8dd1('0x4'));var fs=require('fs');var path=require(_0x8dd1('0x5'));var rimraf=require(_0x8dd1('0x6'));var config=require('../../config/environment');var attributes=require(_0x8dd1('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8dd1('0x8')]=function(_0x323148,_0x5f10fa){return _0x323148['define'](_0x8dd1('0x9'),attributes,{'tableName':_0x8dd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29d210,_0x13162c,_0x528832){if(_0x29d210[_0x8dd1('0xb')]('zone')||_0x29d210[_0x8dd1('0xb')](_0x8dd1('0xc'))||_0x29d210[_0x8dd1('0xb')]('clientId')||_0x29d210[_0x8dd1('0xb')](_0x8dd1('0xd'))||_0x29d210[_0x8dd1('0xb')]('code')||_0x29d210[_0x8dd1('0xb')]('host')){var _0x403ed6,_0x1a3ab2;_0x403ed6=_0x29d210[_0x8dd1('0xc')];var _0x54b5ac=_0x403ed6['slice'](-0x1);if(_0x54b5ac==='/'||_0x54b5ac==='\x5c'||_0x54b5ac===':'){_0x403ed6=_0x403ed6['substring'](0x0,_0x403ed6['lastIndexOf'](_0x54b5ac));}switch(_0x29d210[_0x8dd1('0xe')]){case'US':_0x1a3ab2=_0x8dd1('0xf');break;case'AU':_0x1a3ab2=_0x8dd1('0x10');break;case'IN':_0x1a3ab2='https://accounts.zoho.in';break;case'CN':_0x1a3ab2=_0x8dd1('0x11');break;default:_0x1a3ab2=_0x8dd1('0x12');break;}var _0x4b7cbe={'method':_0x8dd1('0x13'),'uri':_0x1a3ab2+_0x8dd1('0x14'),'form':{'grant_type':_0x8dd1('0x15'),'client_id':_0x29d210[_0x8dd1('0x16')],'client_secret':_0x29d210[_0x8dd1('0xd')],'redirect_uri':_0x29d210[_0x8dd1('0xc')],'code':_0x29d210[_0x8dd1('0x17')]},'headers':{'Content-Type':_0x8dd1('0x18')}};return rp(_0x4b7cbe)[_0x8dd1('0x19')](function(_0x202dd4){var _0x26b72a=JSON[_0x8dd1('0x1a')](_0x202dd4);if(_0x26b72a[_0x8dd1('0x1b')]){_0x29d210[_0x8dd1('0x1c')]=_0x26b72a[_0x8dd1('0x1b')];logger[_0x8dd1('0x1d')](util[_0x8dd1('0x1e')](_0x8dd1('0x1f'),_0x29d210['name'],_0x29d210['id']));}else{logger[_0x8dd1('0x20')](util[_0x8dd1('0x1e')](_0x8dd1('0x21'),_0x29d210[_0x8dd1('0x22')],_0x29d210['id']),util[_0x8dd1('0x23')](_0x26b72a,{'showHidden':![],'depth':null}));}return _0x528832(null,_0x13162c);})[_0x8dd1('0x24')](function(_0x79acb){logger[_0x8dd1('0x20')](util[_0x8dd1('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29d210[_0x8dd1('0x22')],_0x29d210['id']),util[_0x8dd1('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x528832(_0x79acb);});}else{return _0x528832(null,_0x13162c);}},'beforeUpdate':function(_0x57c839,_0x384334,_0x18488d){if(_0x57c839[_0x8dd1('0xb')]('zone')||_0x57c839[_0x8dd1('0xb')](_0x8dd1('0xc'))||_0x57c839['changed'](_0x8dd1('0x16'))||_0x57c839['changed'](_0x8dd1('0xd'))||_0x57c839[_0x8dd1('0xb')]('code')||_0x57c839[_0x8dd1('0xb')](_0x8dd1('0x25'))){var _0x1f15af,_0xf9b133;_0x1f15af=_0x57c839['serverUrl'];var _0x221a88=_0x1f15af[_0x8dd1('0x26')](-0x1);if(_0x221a88==='/'||_0x221a88==='\x5c'||_0x221a88===':'){_0x1f15af=_0x1f15af[_0x8dd1('0x27')](0x0,_0x1f15af[_0x8dd1('0x28')](_0x221a88));}switch(_0x57c839['zone']){case'US':_0xf9b133=_0x8dd1('0xf');break;case'AU':_0xf9b133='https://accounts.zoho.com.au';break;case'IN':_0xf9b133='https://accounts.zoho.in';break;case'CN':_0xf9b133=_0x8dd1('0x11');break;default:_0xf9b133=_0x8dd1('0x12');break;}var _0x26dd6c={'method':_0x8dd1('0x13'),'uri':_0xf9b133+_0x8dd1('0x14'),'form':{'grant_type':_0x8dd1('0x15'),'client_id':_0x57c839['clientId'],'client_secret':_0x57c839[_0x8dd1('0xd')],'redirect_uri':_0x57c839['serverUrl'],'code':_0x57c839[_0x8dd1('0x17')]},'headers':{'Content-Type':_0x8dd1('0x18')}};return rp(_0x26dd6c)['then'](function(_0x7d132c){var _0x2e6b99=JSON[_0x8dd1('0x1a')](_0x7d132c);if(_0x2e6b99[_0x8dd1('0x1b')]){_0x57c839['refreshToken']=_0x2e6b99['refresh_token'];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x57c839['name'],_0x57c839['id']));}else{logger[_0x8dd1('0x20')](util[_0x8dd1('0x1e')](_0x8dd1('0x21'),_0x57c839[_0x8dd1('0x22')],_0x57c839['id']),util[_0x8dd1('0x23')](_0x2e6b99,{'showHidden':![],'depth':null}));}return _0x18488d(null,_0x384334);})[_0x8dd1('0x24')](function(_0x1a9497){logger[_0x8dd1('0x20')](util[_0x8dd1('0x1e')](_0x8dd1('0x21'),_0x57c839[_0x8dd1('0x22')],_0x57c839['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x18488d(_0x1a9497);});}else{return _0x18488d(null,_0x384334);}}}});}; \ No newline at end of file +var _0x8cec=['application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','lastIndexOf','https://accounts.zoho.com','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8cec,0x1f3));var _0xc8ce=function(_0x16a3d3,_0x58a6f7){_0x16a3d3=_0x16a3d3-0x0;var _0x4e83e3=_0x8cec[_0x16a3d3];return _0x4e83e3;};'use strict';var _=require(_0xc8ce('0x0'));var util=require(_0xc8ce('0x1'));var logger=require(_0xc8ce('0x2'))(_0xc8ce('0x3'));var moment=require(_0xc8ce('0x4'));var BPromise=require(_0xc8ce('0x5'));var rp=require(_0xc8ce('0x6'));var fs=require('fs');var path=require(_0xc8ce('0x7'));var rimraf=require(_0xc8ce('0x8'));var config=require(_0xc8ce('0x9'));var attributes=require(_0xc8ce('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xc8ce('0xb')]=function(_0x14d084,_0x4bac6b){return _0x14d084['define'](_0xc8ce('0xc'),attributes,{'tableName':_0xc8ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f25ac,_0x201013,_0xe49d1b){if(_0x2f25ac[_0xc8ce('0xe')](_0xc8ce('0xf'))||_0x2f25ac[_0xc8ce('0xe')](_0xc8ce('0x10'))||_0x2f25ac[_0xc8ce('0xe')](_0xc8ce('0x11'))||_0x2f25ac['changed'](_0xc8ce('0x12'))||_0x2f25ac[_0xc8ce('0xe')](_0xc8ce('0x13'))||_0x2f25ac[_0xc8ce('0xe')](_0xc8ce('0x14'))){var _0x36cd48,_0x30812d;_0x36cd48=_0x2f25ac[_0xc8ce('0x10')];var _0x4034da=_0x36cd48['slice'](-0x1);if(_0x4034da==='/'||_0x4034da==='\x5c'||_0x4034da===':'){_0x36cd48=_0x36cd48[_0xc8ce('0x15')](0x0,_0x36cd48['lastIndexOf'](_0x4034da));}switch(_0x2f25ac[_0xc8ce('0xf')]){case'US':_0x30812d='https://accounts.zoho.com';break;case'AU':_0x30812d=_0xc8ce('0x16');break;case'IN':_0x30812d=_0xc8ce('0x17');break;case'CN':_0x30812d=_0xc8ce('0x18');break;default:_0x30812d=_0xc8ce('0x19');break;}var _0x3ce415={'method':_0xc8ce('0x1a'),'uri':_0x30812d+_0xc8ce('0x1b'),'form':{'grant_type':_0xc8ce('0x1c'),'client_id':_0x2f25ac[_0xc8ce('0x11')],'client_secret':_0x2f25ac[_0xc8ce('0x12')],'redirect_uri':_0x2f25ac['serverUrl'],'code':_0x2f25ac[_0xc8ce('0x13')]},'headers':{'Content-Type':_0xc8ce('0x1d')}};return rp(_0x3ce415)[_0xc8ce('0x1e')](function(_0x3ff73e){var _0x43ad68=JSON[_0xc8ce('0x1f')](_0x3ff73e);if(_0x43ad68[_0xc8ce('0x20')]){_0x2f25ac[_0xc8ce('0x21')]=_0x43ad68['refresh_token'];logger[_0xc8ce('0x22')](util[_0xc8ce('0x23')](_0xc8ce('0x24'),_0x2f25ac['name'],_0x2f25ac['id']));}else{logger['error'](util['format'](_0xc8ce('0x25'),_0x2f25ac[_0xc8ce('0x26')],_0x2f25ac['id']),util[_0xc8ce('0x27')](_0x43ad68,{'showHidden':![],'depth':null}));}return _0xe49d1b(null,_0x201013);})[_0xc8ce('0x28')](function(_0x1d028b){logger['error'](util['format'](_0xc8ce('0x25'),_0x2f25ac['name'],_0x2f25ac['id']),util[_0xc8ce('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0xe49d1b(_0x1d028b);});}else{return _0xe49d1b(null,_0x201013);}},'beforeUpdate':function(_0x5cee12,_0x58271a,_0x40a6fd){if(_0x5cee12[_0xc8ce('0xe')](_0xc8ce('0xf'))||_0x5cee12[_0xc8ce('0xe')](_0xc8ce('0x10'))||_0x5cee12[_0xc8ce('0xe')](_0xc8ce('0x11'))||_0x5cee12[_0xc8ce('0xe')](_0xc8ce('0x12'))||_0x5cee12[_0xc8ce('0xe')](_0xc8ce('0x13'))||_0x5cee12['changed']('host')){var _0x2706cd,_0x46ca7e;_0x2706cd=_0x5cee12['serverUrl'];var _0x2284cd=_0x2706cd['slice'](-0x1);if(_0x2284cd==='/'||_0x2284cd==='\x5c'||_0x2284cd===':'){_0x2706cd=_0x2706cd['substring'](0x0,_0x2706cd[_0xc8ce('0x29')](_0x2284cd));}switch(_0x5cee12['zone']){case'US':_0x46ca7e=_0xc8ce('0x2a');break;case'AU':_0x46ca7e='https://accounts.zoho.com.au';break;case'IN':_0x46ca7e=_0xc8ce('0x17');break;case'CN':_0x46ca7e=_0xc8ce('0x18');break;default:_0x46ca7e=_0xc8ce('0x19');break;}var _0x364e66={'method':_0xc8ce('0x1a'),'uri':_0x46ca7e+'/oauth/v2/token','form':{'grant_type':_0xc8ce('0x1c'),'client_id':_0x5cee12[_0xc8ce('0x11')],'client_secret':_0x5cee12[_0xc8ce('0x12')],'redirect_uri':_0x5cee12[_0xc8ce('0x10')],'code':_0x5cee12[_0xc8ce('0x13')]},'headers':{'Content-Type':_0xc8ce('0x1d')}};return rp(_0x364e66)[_0xc8ce('0x1e')](function(_0x3af44d){var _0x34a9e6=JSON[_0xc8ce('0x1f')](_0x3af44d);if(_0x34a9e6['refresh_token']){_0x5cee12[_0xc8ce('0x21')]=_0x34a9e6[_0xc8ce('0x20')];logger[_0xc8ce('0x22')](util['format'](_0xc8ce('0x24'),_0x5cee12['name'],_0x5cee12['id']));}else{logger[_0xc8ce('0x2b')](util[_0xc8ce('0x23')](_0xc8ce('0x25'),_0x5cee12['name'],_0x5cee12['id']),util[_0xc8ce('0x27')](_0x34a9e6,{'showHidden':![],'depth':null}));}return _0x40a6fd(null,_0x58271a);})['catch'](function(_0x20d8f7){logger[_0xc8ce('0x2b')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5cee12[_0xc8ce('0x26')],_0x5cee12['id']),util[_0xc8ce('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x40a6fd(_0x20d8f7);});}else{return _0x40a6fd(null,_0x58271a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ad80516..423c252 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 _0x199d=['rpc','../../config/environment','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','model','map','debug','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x199d,0x13d));var _0xd199=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x199d[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var moment=require(_0xd199('0x2'));var BPromise=require(_0xd199('0x3'));var rs=require(_0xd199('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd199('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd199('0x6'))(_0xd199('0x7'));var config=require(_0xd199('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd199('0x9')][_0xd199('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5506c4,_0x366a78,_0x2e16ec){return new BPromise(function(_0x2e365a,_0x57a6d7){return client[_0xd199('0xb')](_0x5506c4,_0x2e16ec)[_0xd199('0xc')](function(_0x27cbe6){logger['info'](_0xd199('0xd'),_0x366a78,_0xd199('0xe'));logger['debug'](_0xd199('0xf'),_0x366a78,'request\x20sent',JSON[_0xd199('0x10')](_0x27cbe6));if(_0x27cbe6[_0xd199('0x11')]){if(_0x27cbe6[_0xd199('0x11')][_0xd199('0x12')]===0x1f4){logger[_0xd199('0x11')](_0xd199('0xd'),_0x366a78,_0x27cbe6[_0xd199('0x11')][_0xd199('0x13')]);return _0x57a6d7(_0x27cbe6[_0xd199('0x11')][_0xd199('0x13')]);}logger[_0xd199('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x366a78,_0x27cbe6[_0xd199('0x11')]['message']);return _0x2e365a(_0x27cbe6[_0xd199('0x11')][_0xd199('0x13')]);}else{logger[_0xd199('0x14')](_0xd199('0xd'),_0x366a78,'request\x20sent');_0x2e365a(_0x27cbe6[_0xd199('0x15')][_0xd199('0x13')]);}})[_0xd199('0x16')](function(_0x16a7c5){logger[_0xd199('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x366a78,_0x16a7c5);_0x57a6d7(_0x16a7c5);});});}exports[_0xd199('0x17')]=function(_0x57f3f7){var _0xf97c6e=this;return new Promise(function(_0xd01c21,_0x3d7fff){return db[_0xd199('0x18')][_0xd199('0x19')]({'raw':_0x57f3f7[_0xd199('0x1a')]?_0x57f3f7[_0xd199('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x57f3f7[_0xd199('0x1a')]?_0x57f3f7[_0xd199('0x1a')][_0xd199('0x1b')]||null:null,'attributes':_0x57f3f7[_0xd199('0x1a')]?_0x57f3f7['options'][_0xd199('0x1c')]||null:null,'limit':_0x57f3f7['options']?_0x57f3f7['options'][_0xd199('0x1d')]||null:null,'include':_0x57f3f7[_0xd199('0x1a')]?_0x57f3f7[_0xd199('0x1a')]['include']?_['map'](_0x57f3f7[_0xd199('0x1a')][_0xd199('0x1e')],function(_0x5653d0){return{'model':db[_0x5653d0[_0xd199('0x1f')]],'as':_0x5653d0['as'],'attributes':_0x5653d0[_0xd199('0x1c')],'include':_0x5653d0[_0xd199('0x1e')]?_[_0xd199('0x20')](_0x5653d0[_0xd199('0x1e')],function(_0x3aa616){return{'model':db[_0x3aa616[_0xd199('0x1f')]],'as':_0x3aa616['as'],'attributes':_0x3aa616[_0xd199('0x1c')],'include':_0x3aa616[_0xd199('0x1e')]?_['map'](_0x3aa616['include'],function(_0x2dd652){return{'model':db[_0x2dd652[_0xd199('0x1f')]],'as':_0x2dd652['as'],'attributes':_0x2dd652[_0xd199('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49bd83){logger[_0xd199('0x14')](_0xd199('0x17'),_0x57f3f7);logger[_0xd199('0x21')](_0xd199('0x17'),_0x57f3f7,JSON[_0xd199('0x10')](_0x49bd83));_0xd01c21(_0x49bd83);})[_0xd199('0x16')](function(_0x3c1269){logger[_0xd199('0x11')](_0xd199('0x17'),_0x3c1269[_0xd199('0x13')],_0x57f3f7);_0x3d7fff(_0xf97c6e['error'](0x1f4,_0x3c1269[_0xd199('0x13')]));});});};exports['ShowZohoAccount']=function(_0x5220a3){var _0x63c67c=this;return new Promise(function(_0x444380,_0x1eceff){return db[_0xd199('0x18')][_0xd199('0x22')]({'raw':_0x5220a3[_0xd199('0x1a')]?_0x5220a3['options'][_0xd199('0x23')]===undefined?!![]:![]:!![],'where':_0x5220a3[_0xd199('0x1a')]?_0x5220a3[_0xd199('0x1a')][_0xd199('0x1b')]||null:null,'attributes':_0x5220a3['options']?_0x5220a3[_0xd199('0x1a')][_0xd199('0x1c')]||null:null,'include':_0x5220a3['options']?_0x5220a3['options']['include']?_[_0xd199('0x20')](_0x5220a3[_0xd199('0x1a')][_0xd199('0x1e')],function(_0x542ad9){return{'model':db[_0x542ad9['model']],'as':_0x542ad9['as'],'attributes':_0x542ad9[_0xd199('0x1c')],'include':_0x542ad9['include']?_[_0xd199('0x20')](_0x542ad9[_0xd199('0x1e')],function(_0x3abae){return{'model':db[_0x3abae[_0xd199('0x1f')]],'as':_0x3abae['as'],'attributes':_0x3abae['attributes'],'include':_0x3abae[_0xd199('0x1e')]?_[_0xd199('0x20')](_0x3abae[_0xd199('0x1e')],function(_0xc42ecb){return{'model':db[_0xc42ecb[_0xd199('0x1f')]],'as':_0xc42ecb['as'],'attributes':_0xc42ecb[_0xd199('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd199('0xc')](function(_0x59f04f){logger['info']('ShowZohoAccount',_0x5220a3);logger[_0xd199('0x21')]('ShowZohoAccount',_0x5220a3,JSON[_0xd199('0x10')](_0x59f04f));_0x444380(_0x59f04f);})[_0xd199('0x16')](function(_0x103ddd){logger[_0xd199('0x11')]('ShowZohoAccount',_0x103ddd['message'],_0x5220a3);_0x1eceff(_0x63c67c[_0xd199('0x11')](0x1f4,_0x103ddd[_0xd199('0x13')]));});});}; \ No newline at end of file +var _0xce04=['options','raw','where','attributes','limit','include','map','model','stringify','catch','ZohoAccount','ShowZohoAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','GetZohoAccount','findAll'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xce04,0xc0));var _0x4ce0=function(_0x1ffb85,_0x2c8450){_0x1ffb85=_0x1ffb85-0x0;var _0x313616=_0xce04[_0x1ffb85];return _0x313616;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x462871,_0x5377ab,_0x3a0dca){return new BPromise(function(_0x3b7238,_0x709a46){return client['request'](_0x462871,_0x3a0dca)[_0x4ce0('0x8')](function(_0x29c627){logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));logger[_0x4ce0('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5377ab,_0x4ce0('0xb'),JSON['stringify'](_0x29c627));if(_0x29c627['error']){if(_0x29c627['error'][_0x4ce0('0xd')]===0x1f4){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x29c627['error'][_0x4ce0('0xf')]);return _0x709a46(_0x29c627[_0x4ce0('0xe')]['message']);}logger[_0x4ce0('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x5377ab,_0x29c627[_0x4ce0('0xe')][_0x4ce0('0xf')]);return _0x3b7238(_0x29c627[_0x4ce0('0xe')]['message']);}else{logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));_0x3b7238(_0x29c627['result'][_0x4ce0('0xf')]);}})['catch'](function(_0x4d1fd2){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x4d1fd2);_0x709a46(_0x4d1fd2);});});}exports[_0x4ce0('0x10')]=function(_0x38917c){var _0x328ec2=this;return new Promise(function(_0x368ccb,_0x1e3135){return db['ZohoAccount'][_0x4ce0('0x11')]({'raw':_0x38917c[_0x4ce0('0x12')]?_0x38917c['options'][_0x4ce0('0x13')]===undefined?!![]:![]:!![],'where':_0x38917c['options']?_0x38917c[_0x4ce0('0x12')][_0x4ce0('0x14')]||null:null,'attributes':_0x38917c['options']?_0x38917c[_0x4ce0('0x12')][_0x4ce0('0x15')]||null:null,'limit':_0x38917c[_0x4ce0('0x12')]?_0x38917c[_0x4ce0('0x12')][_0x4ce0('0x16')]||null:null,'include':_0x38917c[_0x4ce0('0x12')]?_0x38917c[_0x4ce0('0x12')][_0x4ce0('0x17')]?_[_0x4ce0('0x18')](_0x38917c[_0x4ce0('0x12')][_0x4ce0('0x17')],function(_0x27024e){return{'model':db[_0x27024e[_0x4ce0('0x19')]],'as':_0x27024e['as'],'attributes':_0x27024e[_0x4ce0('0x15')],'include':_0x27024e[_0x4ce0('0x17')]?_['map'](_0x27024e[_0x4ce0('0x17')],function(_0x318a7a){return{'model':db[_0x318a7a['model']],'as':_0x318a7a['as'],'attributes':_0x318a7a[_0x4ce0('0x15')],'include':_0x318a7a[_0x4ce0('0x17')]?_[_0x4ce0('0x18')](_0x318a7a[_0x4ce0('0x17')],function(_0x1f3b9d){return{'model':db[_0x1f3b9d[_0x4ce0('0x19')]],'as':_0x1f3b9d['as'],'attributes':_0x1f3b9d[_0x4ce0('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4ce0('0x8')](function(_0x2e0dae){logger[_0x4ce0('0x9')]('GetZohoAccount',_0x38917c);logger[_0x4ce0('0xc')](_0x4ce0('0x10'),_0x38917c,JSON[_0x4ce0('0x1a')](_0x2e0dae));_0x368ccb(_0x2e0dae);})[_0x4ce0('0x1b')](function(_0x59e8df){logger['error'](_0x4ce0('0x10'),_0x59e8df[_0x4ce0('0xf')],_0x38917c);_0x1e3135(_0x328ec2['error'](0x1f4,_0x59e8df[_0x4ce0('0xf')]));});});};exports['ShowZohoAccount']=function(_0x36644e){var _0x1b4b0c=this;return new Promise(function(_0x33b284,_0x220032){return db[_0x4ce0('0x1c')]['find']({'raw':_0x36644e[_0x4ce0('0x12')]?_0x36644e[_0x4ce0('0x12')][_0x4ce0('0x13')]===undefined?!![]:![]:!![],'where':_0x36644e[_0x4ce0('0x12')]?_0x36644e[_0x4ce0('0x12')][_0x4ce0('0x14')]||null:null,'attributes':_0x36644e[_0x4ce0('0x12')]?_0x36644e[_0x4ce0('0x12')]['attributes']||null:null,'include':_0x36644e[_0x4ce0('0x12')]?_0x36644e[_0x4ce0('0x12')][_0x4ce0('0x17')]?_[_0x4ce0('0x18')](_0x36644e['options'][_0x4ce0('0x17')],function(_0x430ac1){return{'model':db[_0x430ac1['model']],'as':_0x430ac1['as'],'attributes':_0x430ac1[_0x4ce0('0x15')],'include':_0x430ac1['include']?_[_0x4ce0('0x18')](_0x430ac1[_0x4ce0('0x17')],function(_0x588327){return{'model':db[_0x588327[_0x4ce0('0x19')]],'as':_0x588327['as'],'attributes':_0x588327[_0x4ce0('0x15')],'include':_0x588327['include']?_['map'](_0x588327['include'],function(_0x110b2e){return{'model':db[_0x110b2e[_0x4ce0('0x19')]],'as':_0x110b2e['as'],'attributes':_0x110b2e[_0x4ce0('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4ce0('0x8')](function(_0x58dee6){logger[_0x4ce0('0x9')](_0x4ce0('0x1d'),_0x36644e);logger[_0x4ce0('0xc')](_0x4ce0('0x1d'),_0x36644e,JSON['stringify'](_0x58dee6));_0x33b284(_0x58dee6);})[_0x4ce0('0x1b')](function(_0x58b11f){logger[_0x4ce0('0xe')](_0x4ce0('0x1d'),_0x58b11f['message'],_0x36644e);_0x220032(_0x1b4b0c['error'](0x1f4,_0x58b11f[_0x4ce0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0dfacdc..503b79f 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 _0x8be1=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x5503dd,_0x4b0e5c){var _0x378f23=function(_0x4682ae){while(--_0x4682ae){_0x5503dd['push'](_0x5503dd['shift']());}};_0x378f23(++_0x4b0e5c);}(_0x8be1,0x17b));var _0x18be=function(_0x3eb4da,_0x2bf8da){_0x3eb4da=_0x3eb4da-0x0;var _0x40134a=_0x8be1[_0x3eb4da];return _0x40134a;};'use strict';var multer=require(_0x18be('0x0'));var util=require('util');var path=require(_0x18be('0x1'));var timeout=require('connect-timeout');var express=require(_0x18be('0x2'));var router=express[_0x18be('0x3')]();var fs_extra=require(_0x18be('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18be('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x18be('0x6')]('/',auth[_0x18be('0x7')](),controller[_0x18be('0x8')]);router[_0x18be('0x6')](_0x18be('0x9'),auth[_0x18be('0x7')](),controller[_0x18be('0xa')]);router[_0x18be('0x6')](_0x18be('0xb'),auth[_0x18be('0x7')](),controller[_0x18be('0xc')]);router['get'](_0x18be('0xd'),auth[_0x18be('0x7')](),controller[_0x18be('0xe')]);router[_0x18be('0x6')](_0x18be('0xf'),auth['isAuthenticated'](),controller[_0x18be('0x10')]);router[_0x18be('0x11')]('/',auth['isAuthenticated'](),controller[_0x18be('0x12')]);router[_0x18be('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x18be('0x14')]);router[_0x18be('0x15')](_0x18be('0x9'),auth[_0x18be('0x7')](),controller[_0x18be('0x16')]);module['exports']=router; \ No newline at end of file +var _0xd769=['/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x5a8c71,_0x2f8398){var _0x1ca071=function(_0x3128fc){while(--_0x3128fc){_0x5a8c71['push'](_0x5a8c71['shift']());}};_0x1ca071(++_0x2f8398);}(_0xd769,0x14d));var _0x9d76=function(_0x262a0b,_0x20d859){_0x262a0b=_0x262a0b-0x0;var _0x15f521=_0xd769[_0x262a0b];return _0x15f521;};'use strict';var multer=require(_0x9d76('0x0'));var util=require(_0x9d76('0x1'));var path=require('path');var timeout=require(_0x9d76('0x2'));var express=require(_0x9d76('0x3'));var router=express[_0x9d76('0x4')]();var fs_extra=require(_0x9d76('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d76('0x6'));var config=require('../../config/environment');var controller=require(_0x9d76('0x7'));router[_0x9d76('0x8')]('/',auth[_0x9d76('0x9')](),controller[_0x9d76('0xa')]);router['get'](_0x9d76('0xb'),auth['isAuthenticated'](),controller[_0x9d76('0xc')]);router[_0x9d76('0x8')](_0x9d76('0xd'),auth[_0x9d76('0x9')](),controller[_0x9d76('0xe')]);router[_0x9d76('0x8')](_0x9d76('0xf'),auth[_0x9d76('0x9')](),controller[_0x9d76('0x10')]);router[_0x9d76('0x8')](_0x9d76('0x11'),auth[_0x9d76('0x9')](),controller['getDescriptions']);router[_0x9d76('0x12')]('/',auth[_0x9d76('0x9')](),controller[_0x9d76('0x13')]);router[_0x9d76('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9d76('0x15')]);router[_0x9d76('0x16')](_0x9d76('0xb'),auth[_0x9d76('0x9')](),controller[_0x9d76('0x17')]);module[_0x9d76('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e7f5e80..9fccbcd 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 _0xf837=['lead','contact_lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x4b1fdd,_0x4a82e5){var _0x2b731a=function(_0x561f71){while(--_0x561f71){_0x4b1fdd['push'](_0x4b1fdd['shift']());}};_0x2b731a(++_0x4a82e5);}(_0xf837,0x1ec));var _0x7f83=function(_0xc3b145,_0x287dc7){_0xc3b145=_0xc3b145-0x0;var _0x1f5f32=_0xf837[_0xc3b145];return _0x1f5f32;};'use strict';var Sequelize=require(_0x7f83('0x0'));module[_0x7f83('0x1')]={'name':{'type':Sequelize[_0x7f83('0x2')]},'moduleCreate':{'type':Sequelize[_0x7f83('0x3')]('lead',_0x7f83('0x4'),'nothing'),'defaultValue':_0x7f83('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x7f83('0x6'),_0x7f83('0x4'),_0x7f83('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x7f83('0x2')]}}; \ No newline at end of file +var _0x40b9=['ENUM','contact_lead','contact','STRING','lead','nothing'];(function(_0x49b193,_0x2abf8b){var _0x20691b=function(_0xe77e39){while(--_0xe77e39){_0x49b193['push'](_0x49b193['shift']());}};_0x20691b(++_0x2abf8b);}(_0x40b9,0x1de));var _0x940b=function(_0x17dcd5,_0x5c5b24){_0x17dcd5=_0x17dcd5-0x0;var _0x214160=_0x40b9[_0x17dcd5];return _0x214160;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x940b('0x0'),'contact',_0x940b('0x1')),'defaultValue':_0x940b('0x0')},'moduleSearch':{'type':Sequelize[_0x940b('0x2')](_0x940b('0x3'),_0x940b('0x4'),_0x940b('0x0')),'defaultValue':_0x940b('0x3')},'description':{'type':Sequelize[_0x940b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dcbb96d..31f3de9 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 _0xeebb=['keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','ZohoField','options','nolimit','getSubjects','getDescriptions','findOne','zip-dir','fast-json-patch','request-promise','moment','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','Content-Range','reject','update','then','destroy','sendStatus','error','stack','index','map','ZohoConfiguration','rawAttributes','fieldName','model','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeebb,0x1ee));var _0xbeeb=function(_0x15cbf2,_0x50e69a){_0x15cbf2=_0x15cbf2-0x0;var _0x2be316=_0xeebb[_0x15cbf2];return _0x2be316;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbeeb('0x0'));var jsonpatch=require(_0xbeeb('0x1'));var rp=require(_0xbeeb('0x2'));var moment=require(_0xbeeb('0x3'));var BPromise=require(_0xbeeb('0x4'));var Mustache=require(_0xbeeb('0x5'));var util=require(_0xbeeb('0x6'));var path=require(_0xbeeb('0x7'));var sox=require(_0xbeeb('0x8'));var csv=require(_0xbeeb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbeeb('0xa'));var _=require(_0xbeeb('0xb'));var squel=require('squel');var crypto=require(_0xbeeb('0xc'));var jsforce=require(_0xbeeb('0xd'));var deskjs=require(_0xbeeb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbeeb('0xf'));var Papa=require('papaparse');var Redis=require(_0xbeeb('0x10'));var authService=require(_0xbeeb('0x11'));var qs=require(_0xbeeb('0x12'));var as=require(_0xbeeb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbeeb('0x14'))(_0xbeeb('0x15'));var utils=require(_0xbeeb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbeeb('0x17'));var db=require(_0xbeeb('0x18'))['db'];function respondWithStatusCode(_0x16319e,_0x557543){_0x557543=_0x557543||0xcc;return function(_0x43849e){if(_0x43849e){return _0x16319e['sendStatus'](_0x557543);}return _0x16319e[_0xbeeb('0x19')](_0x557543)['end']();};}function respondWithResult(_0x44abf2,_0xfd5ad1){_0xfd5ad1=_0xfd5ad1||0xc8;return function(_0x240e90){if(_0x240e90){return _0x44abf2[_0xbeeb('0x19')](_0xfd5ad1)[_0xbeeb('0x1a')](_0x240e90);}};}function respondWithFilteredResult(_0x3b74ab,_0x29b971){return function(_0x43856b){if(_0x43856b){var _0x11c8a3=typeof _0x29b971[_0xbeeb('0x1b')]===_0xbeeb('0x1c')&&typeof _0x29b971[_0xbeeb('0x1d')]==='undefined';var _0x1655ff=_0x43856b['count'];var _0x5dea2c=_0x11c8a3?0x0:_0x29b971['offset'];var _0x5077ee=_0x11c8a3?_0x43856b['count']:_0x29b971['offset']+_0x29b971[_0xbeeb('0x1d')];var _0x203adf;if(_0x5077ee>=_0x1655ff){_0x5077ee=_0x1655ff;_0x203adf=0xc8;}else{_0x203adf=0xce;}_0x3b74ab[_0xbeeb('0x19')](_0x203adf);return _0x3b74ab['set'](_0xbeeb('0x1e'),_0x5dea2c+'-'+_0x5077ee+'/'+_0x1655ff)[_0xbeeb('0x1a')](_0x43856b);}return null;};}function patchUpdates(_0x510ea4){return function(_0x3630b9){try{jsonpatch['apply'](_0x3630b9,_0x510ea4,!![]);}catch(_0x13d321){return BPromise[_0xbeeb('0x1f')](_0x13d321);}return _0x3630b9['save']();};}function saveUpdates(_0x18db64,_0x4105d2){return function(_0x4ba7db){if(_0x4ba7db){return _0x4ba7db[_0xbeeb('0x20')](_0x18db64)[_0xbeeb('0x21')](function(_0x1830b1){return _0x1830b1;});}return null;};}function removeEntity(_0x542c76,_0x412b80){return function(_0x42a7f3){if(_0x42a7f3){return _0x42a7f3[_0xbeeb('0x22')]()[_0xbeeb('0x21')](function(){_0x542c76[_0xbeeb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2350dc,_0x1ec090){return function(_0x7a24ba){if(!_0x7a24ba){_0x2350dc[_0xbeeb('0x23')](0x194);}return _0x7a24ba;};}function handleError(_0x576629,_0x40584b){_0x40584b=_0x40584b||0x1f4;return function(_0x4fe514){logger[_0xbeeb('0x24')](_0x4fe514[_0xbeeb('0x25')]);if(_0x4fe514['name']){delete _0x4fe514['name'];}_0x576629[_0xbeeb('0x19')](_0x40584b)['send'](_0x4fe514);};}exports[_0xbeeb('0x26')]=function(_0x18b078,_0x3331dd){var _0x27124c={},_0x22404f={},_0x509ce0={'count':0x0,'rows':[]};var _0xbe0a4e=_[_0xbeeb('0x27')](db[_0xbeeb('0x28')][_0xbeeb('0x29')],function(_0x15a1fe){return{'name':_0x15a1fe[_0xbeeb('0x2a')],'type':_0x15a1fe['type']['key']};});_0x22404f[_0xbeeb('0x2b')]=_['map'](_0xbe0a4e,_0xbeeb('0x2c'));_0x22404f['query']=_[_0xbeeb('0x2d')](_0x18b078[_0xbeeb('0x2e')]);_0x22404f[_0xbeeb('0x2f')]=_['intersection'](_0x22404f[_0xbeeb('0x2b')],_0x22404f[_0xbeeb('0x2e')]);_0x27124c[_0xbeeb('0x30')]=_[_0xbeeb('0x31')](_0x22404f[_0xbeeb('0x2b')],qs[_0xbeeb('0x32')](_0x18b078[_0xbeeb('0x2e')][_0xbeeb('0x32')]));_0x27124c['attributes']=_0x27124c[_0xbeeb('0x30')][_0xbeeb('0x33')]?_0x27124c[_0xbeeb('0x30')]:_0x22404f[_0xbeeb('0x2b')];if(!_0x18b078['query'][_0xbeeb('0x34')]('nolimit')){_0x27124c[_0xbeeb('0x1d')]=qs[_0xbeeb('0x1d')](_0x18b078['query'][_0xbeeb('0x1d')]);_0x27124c[_0xbeeb('0x1b')]=qs['offset'](_0x18b078[_0xbeeb('0x2e')]['offset']);}_0x27124c[_0xbeeb('0x35')]=qs[_0xbeeb('0x36')](_0x18b078[_0xbeeb('0x2e')][_0xbeeb('0x36')]);_0x27124c[_0xbeeb('0x37')]=qs[_0xbeeb('0x2f')](_[_0xbeeb('0x38')](_0x18b078[_0xbeeb('0x2e')],_0x22404f[_0xbeeb('0x2f')]),_0xbe0a4e);if(_0x18b078[_0xbeeb('0x2e')]['filter']){_0x27124c['where']=_[_0xbeeb('0x39')](_0x27124c[_0xbeeb('0x37')],{'$or':_['map'](_0xbe0a4e,function(_0x241015){if(_0x241015['type']!==_0xbeeb('0x3a')){var _0x2dfb23={};_0x2dfb23[_0x241015[_0xbeeb('0x2c')]]={'$like':'%'+_0x18b078[_0xbeeb('0x2e')][_0xbeeb('0x3b')]+'%'};return _0x2dfb23;}})});}_0x27124c=_[_0xbeeb('0x39')]({},_0x27124c,_0x18b078['options']);var _0x4b7fdf={'where':_0x27124c['where']};return db[_0xbeeb('0x28')]['count'](_0x4b7fdf)[_0xbeeb('0x21')](function(_0x4d6faf){_0x509ce0[_0xbeeb('0x3c')]=_0x4d6faf;if(_0x18b078[_0xbeeb('0x2e')][_0xbeeb('0x3d')]){_0x27124c[_0xbeeb('0x3e')]=[{'all':!![]}];}return db[_0xbeeb('0x28')][_0xbeeb('0x3f')](_0x27124c);})[_0xbeeb('0x21')](function(_0x10f615){_0x509ce0[_0xbeeb('0x40')]=_0x10f615;return _0x509ce0;})[_0xbeeb('0x21')](respondWithFilteredResult(_0x3331dd,_0x27124c))['catch'](handleError(_0x3331dd,null));};exports[_0xbeeb('0x41')]=function(_0x246dd1,_0x3ad6e1){var _0x446b9e={'raw':![],'where':{'id':_0x246dd1[_0xbeeb('0x42')]['id']}},_0x472239={};_0x472239['model']=_[_0xbeeb('0x2d')](db['ZohoConfiguration']['rawAttributes']);_0x472239['query']=_[_0xbeeb('0x2d')](_0x246dd1[_0xbeeb('0x2e')]);_0x472239[_0xbeeb('0x2f')]=_['intersection'](_0x472239[_0xbeeb('0x2b')],_0x472239[_0xbeeb('0x2e')]);_0x446b9e[_0xbeeb('0x30')]=_[_0xbeeb('0x31')](_0x472239['model'],qs[_0xbeeb('0x32')](_0x246dd1[_0xbeeb('0x2e')][_0xbeeb('0x32')]));_0x446b9e[_0xbeeb('0x30')]=_0x446b9e[_0xbeeb('0x30')]['length']?_0x446b9e[_0xbeeb('0x30')]:_0x472239[_0xbeeb('0x2b')];if(_0x246dd1[_0xbeeb('0x2e')]['includeAll']){_0x446b9e[_0xbeeb('0x3e')]=[{'all':!![]}];}_0x446b9e=_['merge']({},_0x446b9e,_0x246dd1['options']);return db['ZohoConfiguration']['find'](_0x446b9e)[_0xbeeb('0x21')](handleEntityNotFound(_0x3ad6e1,null))[_0xbeeb('0x21')](respondWithResult(_0x3ad6e1,null))[_0xbeeb('0x43')](handleError(_0x3ad6e1,null));};exports[_0xbeeb('0x44')]=function(_0x4adfc0,_0x447fe9){return db['ZohoConfiguration'][_0xbeeb('0x44')](_0x4adfc0[_0xbeeb('0x45')],{})[_0xbeeb('0x21')](respondWithResult(_0x447fe9,0xc9))[_0xbeeb('0x43')](handleError(_0x447fe9,null));};exports[_0xbeeb('0x20')]=function(_0x530dcc,_0x162e68){if(_0x530dcc[_0xbeeb('0x45')]['id']){delete _0x530dcc['body']['id'];}return db['ZohoConfiguration'][_0xbeeb('0x46')]({'where':{'id':_0x530dcc['params']['id']}})[_0xbeeb('0x21')](handleEntityNotFound(_0x162e68,null))[_0xbeeb('0x21')](saveUpdates(_0x530dcc[_0xbeeb('0x45')],null))['then'](respondWithResult(_0x162e68,null))['catch'](handleError(_0x162e68,null));};exports[_0xbeeb('0x22')]=function(_0x5e3f0f,_0x456fcd){return db[_0xbeeb('0x28')]['find']({'where':{'id':_0x5e3f0f[_0xbeeb('0x42')]['id']}})[_0xbeeb('0x21')](handleEntityNotFound(_0x456fcd,null))[_0xbeeb('0x21')](removeEntity(_0x456fcd,null))[_0xbeeb('0x43')](handleError(_0x456fcd,null));};exports['getFields']=function(_0x1dff9b,_0x39984a,_0x15e680){var _0x204b00={};var _0x89b8a0={};var _0x1b3154;var _0x5ea558;return db[_0xbeeb('0x28')]['findOne']({'where':{'id':_0x1dff9b[_0xbeeb('0x42')]['id']}})[_0xbeeb('0x21')](handleEntityNotFound(_0x39984a,null))[_0xbeeb('0x21')](function(_0x5f08cc){if(_0x5f08cc){_0x1b3154=_0x5f08cc;_0x89b8a0[_0xbeeb('0x2b')]=_[_0xbeeb('0x2d')](db[_0xbeeb('0x47')][_0xbeeb('0x29')]);_0x89b8a0['query']=_['keys'](_0x1dff9b[_0xbeeb('0x2e')]);_0x89b8a0[_0xbeeb('0x2f')]=_['intersection'](_0x89b8a0['model'],_0x89b8a0[_0xbeeb('0x2e')]);_0x204b00['attributes']=_[_0xbeeb('0x31')](_0x89b8a0[_0xbeeb('0x2b')],qs['fields'](_0x1dff9b[_0xbeeb('0x2e')]['fields']));_0x204b00['attributes']=_0x204b00[_0xbeeb('0x30')][_0xbeeb('0x33')]?_0x204b00['attributes']:_0x89b8a0[_0xbeeb('0x2b')];_0x204b00['order']=qs[_0xbeeb('0x36')](_0x1dff9b[_0xbeeb('0x2e')]['sort']);_0x204b00[_0xbeeb('0x37')]=qs[_0xbeeb('0x2f')](_[_0xbeeb('0x38')](_0x1dff9b[_0xbeeb('0x2e')],_0x89b8a0[_0xbeeb('0x2f')]));if(_0x1dff9b[_0xbeeb('0x2e')][_0xbeeb('0x3b')]){_0x204b00[_0xbeeb('0x37')]=_[_0xbeeb('0x39')](_0x204b00[_0xbeeb('0x37')],{'$or':_[_0xbeeb('0x27')](_0x204b00[_0xbeeb('0x30')],function(_0x3cfd64){var _0x13bb3c={};_0x13bb3c[_0x3cfd64]={'$like':'%'+_0x1dff9b[_0xbeeb('0x2e')]['filter']+'%'};return _0x13bb3c;})});}_0x204b00=_['merge']({},_0x204b00,_0x1dff9b[_0xbeeb('0x48')]);return _0x1b3154['getFields'](_0x204b00);}})[_0xbeeb('0x21')](function(_0x3c1091){if(_0x3c1091){_0x5ea558=_0x3c1091[_0xbeeb('0x33')];if(!_0x1dff9b[_0xbeeb('0x2e')][_0xbeeb('0x34')](_0xbeeb('0x49'))){_0x204b00[_0xbeeb('0x1d')]=qs[_0xbeeb('0x1d')](_0x1dff9b[_0xbeeb('0x2e')][_0xbeeb('0x1d')]);_0x204b00['offset']=qs[_0xbeeb('0x1b')](_0x1dff9b[_0xbeeb('0x2e')][_0xbeeb('0x1b')]);}return _0x1b3154['getFields'](_0x204b00);}})['then'](function(_0x498140){if(_0x498140){return _0x498140?{'count':_0x5ea558,'rows':_0x498140}:null;}})[_0xbeeb('0x21')](respondWithResult(_0x39984a,null))[_0xbeeb('0x43')](handleError(_0x39984a,null));};exports[_0xbeeb('0x4a')]=function(_0x5f0553,_0x53c1fb,_0x5ab904){var _0x4c343e={};var _0x382d84={};var _0x4d3750;var _0x3f1177;return db[_0xbeeb('0x28')]['findOne']({'where':{'id':_0x5f0553[_0xbeeb('0x42')]['id']}})['then'](handleEntityNotFound(_0x53c1fb,null))[_0xbeeb('0x21')](function(_0x517112){if(_0x517112){_0x4d3750=_0x517112;_0x382d84[_0xbeeb('0x2b')]=_[_0xbeeb('0x2d')](db[_0xbeeb('0x47')]['rawAttributes']);_0x382d84[_0xbeeb('0x2e')]=_[_0xbeeb('0x2d')](_0x5f0553['query']);_0x382d84[_0xbeeb('0x2f')]=_['intersection'](_0x382d84['model'],_0x382d84[_0xbeeb('0x2e')]);_0x4c343e[_0xbeeb('0x30')]=_['intersection'](_0x382d84[_0xbeeb('0x2b')],qs['fields'](_0x5f0553['query']['fields']));_0x4c343e[_0xbeeb('0x30')]=_0x4c343e[_0xbeeb('0x30')]['length']?_0x4c343e[_0xbeeb('0x30')]:_0x382d84['model'];_0x4c343e[_0xbeeb('0x35')]=qs[_0xbeeb('0x36')](_0x5f0553[_0xbeeb('0x2e')]['sort']);_0x4c343e[_0xbeeb('0x37')]=qs['filters'](_[_0xbeeb('0x38')](_0x5f0553[_0xbeeb('0x2e')],_0x382d84[_0xbeeb('0x2f')]));if(_0x5f0553['query'][_0xbeeb('0x3b')]){_0x4c343e['where']=_['merge'](_0x4c343e[_0xbeeb('0x37')],{'$or':_[_0xbeeb('0x27')](_0x4c343e[_0xbeeb('0x30')],function(_0x2545cb){var _0x31dea5={};_0x31dea5[_0x2545cb]={'$like':'%'+_0x5f0553[_0xbeeb('0x2e')][_0xbeeb('0x3b')]+'%'};return _0x31dea5;})});}_0x4c343e=_[_0xbeeb('0x39')]({},_0x4c343e,_0x5f0553[_0xbeeb('0x48')]);return _0x4d3750['getSubjects'](_0x4c343e);}})[_0xbeeb('0x21')](function(_0x24f272){if(_0x24f272){_0x3f1177=_0x24f272[_0xbeeb('0x33')];if(!_0x5f0553[_0xbeeb('0x2e')][_0xbeeb('0x34')](_0xbeeb('0x49'))){_0x4c343e[_0xbeeb('0x1d')]=qs[_0xbeeb('0x1d')](_0x5f0553[_0xbeeb('0x2e')][_0xbeeb('0x1d')]);_0x4c343e[_0xbeeb('0x1b')]=qs['offset'](_0x5f0553['query'][_0xbeeb('0x1b')]);}return _0x4d3750[_0xbeeb('0x4a')](_0x4c343e);}})[_0xbeeb('0x21')](function(_0x4e13d8){if(_0x4e13d8){return _0x4e13d8?{'count':_0x3f1177,'rows':_0x4e13d8}:null;}})[_0xbeeb('0x21')](respondWithResult(_0x53c1fb,null))['catch'](handleError(_0x53c1fb,null));};exports[_0xbeeb('0x4b')]=function(_0xccb23d,_0x275ee0,_0x378a8f){var _0x2496b3={};var _0x10b06a={};var _0x4d149e;var _0x5815fc;return db['ZohoConfiguration'][_0xbeeb('0x4c')]({'where':{'id':_0xccb23d['params']['id']}})[_0xbeeb('0x21')](handleEntityNotFound(_0x275ee0,null))['then'](function(_0xd2445){if(_0xd2445){_0x4d149e=_0xd2445;_0x10b06a[_0xbeeb('0x2b')]=_[_0xbeeb('0x2d')](db[_0xbeeb('0x47')][_0xbeeb('0x29')]);_0x10b06a[_0xbeeb('0x2e')]=_[_0xbeeb('0x2d')](_0xccb23d[_0xbeeb('0x2e')]);_0x10b06a[_0xbeeb('0x2f')]=_[_0xbeeb('0x31')](_0x10b06a[_0xbeeb('0x2b')],_0x10b06a[_0xbeeb('0x2e')]);_0x2496b3[_0xbeeb('0x30')]=_[_0xbeeb('0x31')](_0x10b06a['model'],qs['fields'](_0xccb23d[_0xbeeb('0x2e')][_0xbeeb('0x32')]));_0x2496b3[_0xbeeb('0x30')]=_0x2496b3[_0xbeeb('0x30')][_0xbeeb('0x33')]?_0x2496b3[_0xbeeb('0x30')]:_0x10b06a[_0xbeeb('0x2b')];_0x2496b3[_0xbeeb('0x35')]=qs['sort'](_0xccb23d[_0xbeeb('0x2e')][_0xbeeb('0x36')]);_0x2496b3['where']=qs[_0xbeeb('0x2f')](_[_0xbeeb('0x38')](_0xccb23d[_0xbeeb('0x2e')],_0x10b06a[_0xbeeb('0x2f')]));if(_0xccb23d[_0xbeeb('0x2e')][_0xbeeb('0x3b')]){_0x2496b3[_0xbeeb('0x37')]=_[_0xbeeb('0x39')](_0x2496b3[_0xbeeb('0x37')],{'$or':_[_0xbeeb('0x27')](_0x2496b3[_0xbeeb('0x30')],function(_0x48121a){var _0x34279e={};_0x34279e[_0x48121a]={'$like':'%'+_0xccb23d[_0xbeeb('0x2e')][_0xbeeb('0x3b')]+'%'};return _0x34279e;})});}_0x2496b3=_[_0xbeeb('0x39')]({},_0x2496b3,_0xccb23d[_0xbeeb('0x48')]);return _0x4d149e[_0xbeeb('0x4b')](_0x2496b3);}})[_0xbeeb('0x21')](function(_0x2240db){if(_0x2240db){_0x5815fc=_0x2240db[_0xbeeb('0x33')];if(!_0xccb23d[_0xbeeb('0x2e')][_0xbeeb('0x34')](_0xbeeb('0x49'))){_0x2496b3['limit']=qs[_0xbeeb('0x1d')](_0xccb23d[_0xbeeb('0x2e')][_0xbeeb('0x1d')]);_0x2496b3[_0xbeeb('0x1b')]=qs['offset'](_0xccb23d['query']['offset']);}return _0x4d149e[_0xbeeb('0x4b')](_0x2496b3);}})[_0xbeeb('0x21')](function(_0x16ceaf){if(_0x16ceaf){return _0x16ceaf?{'count':_0x5815fc,'rows':_0x16ceaf}:null;}})[_0xbeeb('0x21')](respondWithResult(_0x275ee0,null))['catch'](handleError(_0x275ee0,null));}; \ No newline at end of file +var _0x1cc0=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','ZohoConfiguration','findAll','rows','show','params','rawAttributes','catch','create','body','update','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir'];(function(_0x4e2cd7,_0x371fc4){var _0xc65f02=function(_0x2f55b2){while(--_0x2f55b2){_0x4e2cd7['push'](_0x4e2cd7['shift']());}};_0xc65f02(++_0x371fc4);}(_0x1cc0,0x19d));var _0x01cc=function(_0xd48152,_0x15de72){_0xd48152=_0xd48152-0x0;var _0x3145b9=_0x1cc0[_0xd48152];return _0x3145b9;};'use strict';var emlformat=require(_0x01cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01cc('0x1'));var jsonpatch=require(_0x01cc('0x2'));var rp=require(_0x01cc('0x3'));var moment=require(_0x01cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x01cc('0x5'));var util=require(_0x01cc('0x6'));var path=require(_0x01cc('0x7'));var sox=require('sox');var csv=require(_0x01cc('0x8'));var ejs=require(_0x01cc('0x9'));var fs=require('fs');var fs_extra=require(_0x01cc('0xa'));var _=require(_0x01cc('0xb'));var squel=require(_0x01cc('0xc'));var crypto=require('crypto');var jsforce=require(_0x01cc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x01cc('0xe'));var Papa=require(_0x01cc('0xf'));var Redis=require(_0x01cc('0x10'));var authService=require(_0x01cc('0x11'));var qs=require(_0x01cc('0x12'));var as=require(_0x01cc('0x13'));var hardwareService=require(_0x01cc('0x14'));var logger=require(_0x01cc('0x15'))(_0x01cc('0x16'));var utils=require(_0x01cc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01cc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x279f67,_0x39926b){_0x39926b=_0x39926b||0xcc;return function(_0x93e772){if(_0x93e772){return _0x279f67[_0x01cc('0x19')](_0x39926b);}return _0x279f67[_0x01cc('0x1a')](_0x39926b)[_0x01cc('0x1b')]();};}function respondWithResult(_0x1fd5b9,_0x5a28a0){_0x5a28a0=_0x5a28a0||0xc8;return function(_0x569153){if(_0x569153){return _0x1fd5b9['status'](_0x5a28a0)['json'](_0x569153);}};}function respondWithFilteredResult(_0x14f60b,_0x3e5ca1){return function(_0x1e0937){if(_0x1e0937){var _0x3a0e73=typeof _0x3e5ca1[_0x01cc('0x1c')]===_0x01cc('0x1d')&&typeof _0x3e5ca1[_0x01cc('0x1e')]==='undefined';var _0x47f3e0=_0x1e0937[_0x01cc('0x1f')];var _0x4a8c4b=_0x3a0e73?0x0:_0x3e5ca1[_0x01cc('0x1c')];var _0x5e209a=_0x3a0e73?_0x1e0937[_0x01cc('0x1f')]:_0x3e5ca1[_0x01cc('0x1c')]+_0x3e5ca1['limit'];var _0x224873;if(_0x5e209a>=_0x47f3e0){_0x5e209a=_0x47f3e0;_0x224873=0xc8;}else{_0x224873=0xce;}_0x14f60b[_0x01cc('0x1a')](_0x224873);return _0x14f60b[_0x01cc('0x20')](_0x01cc('0x21'),_0x4a8c4b+'-'+_0x5e209a+'/'+_0x47f3e0)[_0x01cc('0x22')](_0x1e0937);}return null;};}function patchUpdates(_0x5d4917){return function(_0x2d84c3){try{jsonpatch[_0x01cc('0x23')](_0x2d84c3,_0x5d4917,!![]);}catch(_0x5031a4){return BPromise[_0x01cc('0x24')](_0x5031a4);}return _0x2d84c3[_0x01cc('0x25')]();};}function saveUpdates(_0x28d770,_0x12dc5f){return function(_0x47b9e9){if(_0x47b9e9){return _0x47b9e9['update'](_0x28d770)[_0x01cc('0x26')](function(_0x56f1d5){return _0x56f1d5;});}return null;};}function removeEntity(_0x2d4f0a,_0x379587){return function(_0x25136d){if(_0x25136d){return _0x25136d[_0x01cc('0x27')]()[_0x01cc('0x26')](function(){_0x2d4f0a[_0x01cc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x254092,_0x24ad95){return function(_0x2b2654){if(!_0x2b2654){_0x254092[_0x01cc('0x19')](0x194);}return _0x2b2654;};}function handleError(_0x5f30b6,_0x5eea8b){_0x5eea8b=_0x5eea8b||0x1f4;return function(_0xf9c4f3){logger[_0x01cc('0x28')](_0xf9c4f3[_0x01cc('0x29')]);if(_0xf9c4f3[_0x01cc('0x2a')]){delete _0xf9c4f3[_0x01cc('0x2a')];}_0x5f30b6[_0x01cc('0x1a')](_0x5eea8b)[_0x01cc('0x2b')](_0xf9c4f3);};}exports[_0x01cc('0x2c')]=function(_0xbcfb46,_0x456d38){var _0x9f3d75={},_0x5ba5de={},_0x378c5d={'count':0x0,'rows':[]};var _0x5b1403=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x2671ae){return{'name':_0x2671ae['fieldName'],'type':_0x2671ae[_0x01cc('0x2d')]['key']};});_0x5ba5de[_0x01cc('0x2e')]=_[_0x01cc('0x2f')](_0x5b1403,_0x01cc('0x2a'));_0x5ba5de[_0x01cc('0x30')]=_[_0x01cc('0x31')](_0xbcfb46[_0x01cc('0x30')]);_0x5ba5de['filters']=_[_0x01cc('0x32')](_0x5ba5de[_0x01cc('0x2e')],_0x5ba5de['query']);_0x9f3d75['attributes']=_[_0x01cc('0x32')](_0x5ba5de['model'],qs[_0x01cc('0x33')](_0xbcfb46[_0x01cc('0x30')][_0x01cc('0x33')]));_0x9f3d75[_0x01cc('0x34')]=_0x9f3d75[_0x01cc('0x34')][_0x01cc('0x35')]?_0x9f3d75[_0x01cc('0x34')]:_0x5ba5de[_0x01cc('0x2e')];if(!_0xbcfb46[_0x01cc('0x30')][_0x01cc('0x36')](_0x01cc('0x37'))){_0x9f3d75[_0x01cc('0x1e')]=qs[_0x01cc('0x1e')](_0xbcfb46[_0x01cc('0x30')][_0x01cc('0x1e')]);_0x9f3d75[_0x01cc('0x1c')]=qs['offset'](_0xbcfb46[_0x01cc('0x30')]['offset']);}_0x9f3d75[_0x01cc('0x38')]=qs[_0x01cc('0x39')](_0xbcfb46[_0x01cc('0x30')][_0x01cc('0x39')]);_0x9f3d75[_0x01cc('0x3a')]=qs[_0x01cc('0x3b')](_[_0x01cc('0x3c')](_0xbcfb46[_0x01cc('0x30')],_0x5ba5de['filters']),_0x5b1403);if(_0xbcfb46['query'][_0x01cc('0x3d')]){_0x9f3d75['where']=_['merge'](_0x9f3d75[_0x01cc('0x3a')],{'$or':_[_0x01cc('0x2f')](_0x5b1403,function(_0x1972f2){if(_0x1972f2[_0x01cc('0x2d')]!==_0x01cc('0x3e')){var _0x2f8bab={};_0x2f8bab[_0x1972f2[_0x01cc('0x2a')]]={'$like':'%'+_0xbcfb46[_0x01cc('0x30')][_0x01cc('0x3d')]+'%'};return _0x2f8bab;}})});}_0x9f3d75=_[_0x01cc('0x3f')]({},_0x9f3d75,_0xbcfb46[_0x01cc('0x40')]);var _0x5c3518={'where':_0x9f3d75['where']};return db['ZohoConfiguration'][_0x01cc('0x1f')](_0x5c3518)[_0x01cc('0x26')](function(_0x2902e8){_0x378c5d[_0x01cc('0x1f')]=_0x2902e8;if(_0xbcfb46[_0x01cc('0x30')][_0x01cc('0x41')]){_0x9f3d75[_0x01cc('0x42')]=[{'all':!![]}];}return db[_0x01cc('0x43')][_0x01cc('0x44')](_0x9f3d75);})[_0x01cc('0x26')](function(_0x825977){_0x378c5d[_0x01cc('0x45')]=_0x825977;return _0x378c5d;})[_0x01cc('0x26')](respondWithFilteredResult(_0x456d38,_0x9f3d75))['catch'](handleError(_0x456d38,null));};exports[_0x01cc('0x46')]=function(_0x1f6e56,_0x42f98c){var _0x23a821={'raw':![],'where':{'id':_0x1f6e56[_0x01cc('0x47')]['id']}},_0x50aea4={};_0x50aea4[_0x01cc('0x2e')]=_['keys'](db['ZohoConfiguration'][_0x01cc('0x48')]);_0x50aea4['query']=_[_0x01cc('0x31')](_0x1f6e56[_0x01cc('0x30')]);_0x50aea4[_0x01cc('0x3b')]=_[_0x01cc('0x32')](_0x50aea4[_0x01cc('0x2e')],_0x50aea4[_0x01cc('0x30')]);_0x23a821[_0x01cc('0x34')]=_[_0x01cc('0x32')](_0x50aea4[_0x01cc('0x2e')],qs[_0x01cc('0x33')](_0x1f6e56[_0x01cc('0x30')][_0x01cc('0x33')]));_0x23a821[_0x01cc('0x34')]=_0x23a821[_0x01cc('0x34')][_0x01cc('0x35')]?_0x23a821['attributes']:_0x50aea4[_0x01cc('0x2e')];if(_0x1f6e56[_0x01cc('0x30')][_0x01cc('0x41')]){_0x23a821['include']=[{'all':!![]}];}_0x23a821=_['merge']({},_0x23a821,_0x1f6e56[_0x01cc('0x40')]);return db[_0x01cc('0x43')]['find'](_0x23a821)['then'](handleEntityNotFound(_0x42f98c,null))[_0x01cc('0x26')](respondWithResult(_0x42f98c,null))[_0x01cc('0x49')](handleError(_0x42f98c,null));};exports[_0x01cc('0x4a')]=function(_0x5b7d14,_0x5d6b6f){return db[_0x01cc('0x43')][_0x01cc('0x4a')](_0x5b7d14[_0x01cc('0x4b')],{})['then'](respondWithResult(_0x5d6b6f,0xc9))[_0x01cc('0x49')](handleError(_0x5d6b6f,null));};exports[_0x01cc('0x4c')]=function(_0x544aad,_0x2dea70){if(_0x544aad[_0x01cc('0x4b')]['id']){delete _0x544aad[_0x01cc('0x4b')]['id'];}return db[_0x01cc('0x43')][_0x01cc('0x4d')]({'where':{'id':_0x544aad[_0x01cc('0x47')]['id']}})[_0x01cc('0x26')](handleEntityNotFound(_0x2dea70,null))[_0x01cc('0x26')](saveUpdates(_0x544aad[_0x01cc('0x4b')],null))['then'](respondWithResult(_0x2dea70,null))[_0x01cc('0x49')](handleError(_0x2dea70,null));};exports[_0x01cc('0x27')]=function(_0x18a553,_0x3d424a){return db['ZohoConfiguration'][_0x01cc('0x4d')]({'where':{'id':_0x18a553[_0x01cc('0x47')]['id']}})[_0x01cc('0x26')](handleEntityNotFound(_0x3d424a,null))[_0x01cc('0x26')](removeEntity(_0x3d424a,null))['catch'](handleError(_0x3d424a,null));};exports[_0x01cc('0x4e')]=function(_0x112ed1,_0x4f2995,_0x3d562d){var _0x36849d={};var _0x1d98b5={};var _0x114dc3;var _0x5894de;return db[_0x01cc('0x43')][_0x01cc('0x4f')]({'where':{'id':_0x112ed1[_0x01cc('0x47')]['id']}})[_0x01cc('0x26')](handleEntityNotFound(_0x4f2995,null))['then'](function(_0x80cf43){if(_0x80cf43){_0x114dc3=_0x80cf43;_0x1d98b5[_0x01cc('0x2e')]=_['keys'](db[_0x01cc('0x50')][_0x01cc('0x48')]);_0x1d98b5[_0x01cc('0x30')]=_[_0x01cc('0x31')](_0x112ed1[_0x01cc('0x30')]);_0x1d98b5[_0x01cc('0x3b')]=_[_0x01cc('0x32')](_0x1d98b5['model'],_0x1d98b5[_0x01cc('0x30')]);_0x36849d[_0x01cc('0x34')]=_[_0x01cc('0x32')](_0x1d98b5['model'],qs[_0x01cc('0x33')](_0x112ed1[_0x01cc('0x30')]['fields']));_0x36849d[_0x01cc('0x34')]=_0x36849d[_0x01cc('0x34')][_0x01cc('0x35')]?_0x36849d[_0x01cc('0x34')]:_0x1d98b5['model'];_0x36849d[_0x01cc('0x38')]=qs[_0x01cc('0x39')](_0x112ed1[_0x01cc('0x30')][_0x01cc('0x39')]);_0x36849d[_0x01cc('0x3a')]=qs['filters'](_[_0x01cc('0x3c')](_0x112ed1[_0x01cc('0x30')],_0x1d98b5['filters']));if(_0x112ed1[_0x01cc('0x30')][_0x01cc('0x3d')]){_0x36849d['where']=_['merge'](_0x36849d[_0x01cc('0x3a')],{'$or':_[_0x01cc('0x2f')](_0x36849d[_0x01cc('0x34')],function(_0x9161da){var _0x2e08c3={};_0x2e08c3[_0x9161da]={'$like':'%'+_0x112ed1[_0x01cc('0x30')][_0x01cc('0x3d')]+'%'};return _0x2e08c3;})});}_0x36849d=_[_0x01cc('0x3f')]({},_0x36849d,_0x112ed1[_0x01cc('0x40')]);return _0x114dc3[_0x01cc('0x4e')](_0x36849d);}})['then'](function(_0x469986){if(_0x469986){_0x5894de=_0x469986[_0x01cc('0x35')];if(!_0x112ed1['query']['hasOwnProperty'](_0x01cc('0x37'))){_0x36849d[_0x01cc('0x1e')]=qs['limit'](_0x112ed1[_0x01cc('0x30')][_0x01cc('0x1e')]);_0x36849d[_0x01cc('0x1c')]=qs[_0x01cc('0x1c')](_0x112ed1[_0x01cc('0x30')][_0x01cc('0x1c')]);}return _0x114dc3[_0x01cc('0x4e')](_0x36849d);}})[_0x01cc('0x26')](function(_0x2d0e4e){if(_0x2d0e4e){return _0x2d0e4e?{'count':_0x5894de,'rows':_0x2d0e4e}:null;}})[_0x01cc('0x26')](respondWithResult(_0x4f2995,null))[_0x01cc('0x49')](handleError(_0x4f2995,null));};exports[_0x01cc('0x51')]=function(_0x4535d7,_0x39201e,_0x24f19b){var _0x5e484e={};var _0x403b27={};var _0x55c2c0;var _0x5c752c;return db[_0x01cc('0x43')]['findOne']({'where':{'id':_0x4535d7['params']['id']}})['then'](handleEntityNotFound(_0x39201e,null))['then'](function(_0x3608dc){if(_0x3608dc){_0x55c2c0=_0x3608dc;_0x403b27[_0x01cc('0x2e')]=_[_0x01cc('0x31')](db[_0x01cc('0x50')][_0x01cc('0x48')]);_0x403b27[_0x01cc('0x30')]=_[_0x01cc('0x31')](_0x4535d7[_0x01cc('0x30')]);_0x403b27[_0x01cc('0x3b')]=_[_0x01cc('0x32')](_0x403b27[_0x01cc('0x2e')],_0x403b27['query']);_0x5e484e[_0x01cc('0x34')]=_[_0x01cc('0x32')](_0x403b27['model'],qs['fields'](_0x4535d7[_0x01cc('0x30')][_0x01cc('0x33')]));_0x5e484e[_0x01cc('0x34')]=_0x5e484e[_0x01cc('0x34')][_0x01cc('0x35')]?_0x5e484e[_0x01cc('0x34')]:_0x403b27[_0x01cc('0x2e')];_0x5e484e[_0x01cc('0x38')]=qs[_0x01cc('0x39')](_0x4535d7[_0x01cc('0x30')][_0x01cc('0x39')]);_0x5e484e[_0x01cc('0x3a')]=qs[_0x01cc('0x3b')](_[_0x01cc('0x3c')](_0x4535d7['query'],_0x403b27[_0x01cc('0x3b')]));if(_0x4535d7[_0x01cc('0x30')][_0x01cc('0x3d')]){_0x5e484e[_0x01cc('0x3a')]=_[_0x01cc('0x3f')](_0x5e484e[_0x01cc('0x3a')],{'$or':_['map'](_0x5e484e[_0x01cc('0x34')],function(_0xaae580){var _0x4b76eb={};_0x4b76eb[_0xaae580]={'$like':'%'+_0x4535d7[_0x01cc('0x30')][_0x01cc('0x3d')]+'%'};return _0x4b76eb;})});}_0x5e484e=_[_0x01cc('0x3f')]({},_0x5e484e,_0x4535d7[_0x01cc('0x40')]);return _0x55c2c0['getSubjects'](_0x5e484e);}})[_0x01cc('0x26')](function(_0xaf3e86){if(_0xaf3e86){_0x5c752c=_0xaf3e86[_0x01cc('0x35')];if(!_0x4535d7[_0x01cc('0x30')][_0x01cc('0x36')](_0x01cc('0x37'))){_0x5e484e[_0x01cc('0x1e')]=qs['limit'](_0x4535d7[_0x01cc('0x30')][_0x01cc('0x1e')]);_0x5e484e[_0x01cc('0x1c')]=qs[_0x01cc('0x1c')](_0x4535d7[_0x01cc('0x30')][_0x01cc('0x1c')]);}return _0x55c2c0[_0x01cc('0x51')](_0x5e484e);}})[_0x01cc('0x26')](function(_0x41b8d1){if(_0x41b8d1){return _0x41b8d1?{'count':_0x5c752c,'rows':_0x41b8d1}:null;}})[_0x01cc('0x26')](respondWithResult(_0x39201e,null))[_0x01cc('0x49')](handleError(_0x39201e,null));};exports[_0x01cc('0x52')]=function(_0xc026c8,_0x3321a9,_0x5928d7){var _0x36c903={};var _0x11832f={};var _0x134170;var _0x272ad2;return db[_0x01cc('0x43')][_0x01cc('0x4f')]({'where':{'id':_0xc026c8[_0x01cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x3321a9,null))[_0x01cc('0x26')](function(_0x388611){if(_0x388611){_0x134170=_0x388611;_0x11832f[_0x01cc('0x2e')]=_['keys'](db[_0x01cc('0x50')][_0x01cc('0x48')]);_0x11832f['query']=_[_0x01cc('0x31')](_0xc026c8[_0x01cc('0x30')]);_0x11832f[_0x01cc('0x3b')]=_[_0x01cc('0x32')](_0x11832f[_0x01cc('0x2e')],_0x11832f[_0x01cc('0x30')]);_0x36c903['attributes']=_[_0x01cc('0x32')](_0x11832f[_0x01cc('0x2e')],qs[_0x01cc('0x33')](_0xc026c8[_0x01cc('0x30')]['fields']));_0x36c903['attributes']=_0x36c903[_0x01cc('0x34')][_0x01cc('0x35')]?_0x36c903['attributes']:_0x11832f[_0x01cc('0x2e')];_0x36c903[_0x01cc('0x38')]=qs[_0x01cc('0x39')](_0xc026c8[_0x01cc('0x30')]['sort']);_0x36c903[_0x01cc('0x3a')]=qs[_0x01cc('0x3b')](_[_0x01cc('0x3c')](_0xc026c8[_0x01cc('0x30')],_0x11832f[_0x01cc('0x3b')]));if(_0xc026c8[_0x01cc('0x30')][_0x01cc('0x3d')]){_0x36c903[_0x01cc('0x3a')]=_['merge'](_0x36c903[_0x01cc('0x3a')],{'$or':_[_0x01cc('0x2f')](_0x36c903['attributes'],function(_0x355c40){var _0x1b2402={};_0x1b2402[_0x355c40]={'$like':'%'+_0xc026c8[_0x01cc('0x30')][_0x01cc('0x3d')]+'%'};return _0x1b2402;})});}_0x36c903=_[_0x01cc('0x3f')]({},_0x36c903,_0xc026c8[_0x01cc('0x40')]);return _0x134170[_0x01cc('0x52')](_0x36c903);}})[_0x01cc('0x26')](function(_0x44c6a7){if(_0x44c6a7){_0x272ad2=_0x44c6a7['length'];if(!_0xc026c8[_0x01cc('0x30')]['hasOwnProperty'](_0x01cc('0x37'))){_0x36c903['limit']=qs['limit'](_0xc026c8[_0x01cc('0x30')][_0x01cc('0x1e')]);_0x36c903[_0x01cc('0x1c')]=qs['offset'](_0xc026c8[_0x01cc('0x30')][_0x01cc('0x1c')]);}return _0x134170[_0x01cc('0x52')](_0x36c903);}})[_0x01cc('0x26')](function(_0x5e3c18){if(_0x5e3c18){return _0x5e3c18?{'count':_0x272ad2,'rows':_0x5e3c18}:null;}})[_0x01cc('0x26')](respondWithResult(_0x3321a9,null))[_0x01cc('0x49')](handleError(_0x3321a9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5fc2ee9..80b394a 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 _0x8101=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5b7412,_0x28b1ed){var _0x2a55f5=function(_0x296ae9){while(--_0x296ae9){_0x5b7412['push'](_0x5b7412['shift']());}};_0x2a55f5(++_0x28b1ed);}(_0x8101,0x88));var _0x1810=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0x8101[_0x45ac0c];return _0x4b4074;};'use strict';var _=require(_0x1810('0x0'));var util=require(_0x1810('0x1'));var logger=require(_0x1810('0x2'))(_0x1810('0x3'));var moment=require(_0x1810('0x4'));var BPromise=require(_0x1810('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1810('0x6'));var rimraf=require(_0x1810('0x7'));var config=require(_0x1810('0x8'));var attributes=require(_0x1810('0x9'));module[_0x1810('0xa')]=function(_0x58240d,_0x4b4286){return _0x58240d[_0x1810('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x1810('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5583=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5583,0x1f1));var _0x3558=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x5583[_0x26b80e];return _0x84a8a8;};'use strict';var _=require(_0x3558('0x0'));var util=require(_0x3558('0x1'));var logger=require(_0x3558('0x2'))('api');var moment=require(_0x3558('0x3'));var BPromise=require(_0x3558('0x4'));var rp=require(_0x3558('0x5'));var fs=require('fs');var path=require(_0x3558('0x6'));var rimraf=require(_0x3558('0x7'));var config=require('../../config/environment');var attributes=require(_0x3558('0x8'));module[_0x3558('0x9')]=function(_0x1fffb1,_0x9cd74f){return _0x1fffb1[_0x3558('0xa')](_0x3558('0xb'),attributes,{'tableName':_0x3558('0xc'),'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 9114070..aa8259e 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 _0x5250=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x561098,_0xdd1933){var _0x42701a=function(_0x2ab50f){while(--_0x2ab50f){_0x561098['push'](_0x561098['shift']());}};_0x42701a(++_0xdd1933);}(_0x5250,0x169));var _0x0525=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x5250[_0x267d8d];return _0x11a98f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0525('0x0'));var BPromise=require(_0x0525('0x1'));var rs=require(_0x0525('0x2'));var fs=require('fs');var Redis=require(_0x0525('0x3'));var db=require(_0x0525('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0525('0x5'))(_0x0525('0x6'));var config=require(_0x0525('0x7'));var jayson=require(_0x0525('0x8'));var client=jayson[_0x0525('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x198242,_0x570d03,_0x49091f){return new BPromise(function(_0x5c9cdc,_0x37d609){return client[_0x0525('0xa')](_0x198242,_0x49091f)['then'](function(_0x53d964){logger[_0x0525('0xb')](_0x0525('0xc'),_0x570d03,_0x0525('0xd'));logger['debug'](_0x0525('0xe'),_0x570d03,_0x0525('0xd'),JSON['stringify'](_0x53d964));if(_0x53d964[_0x0525('0xf')]){if(_0x53d964['error'][_0x0525('0x10')]===0x1f4){logger[_0x0525('0xf')](_0x0525('0xc'),_0x570d03,_0x53d964[_0x0525('0xf')][_0x0525('0x11')]);return _0x37d609(_0x53d964['error'][_0x0525('0x11')]);}logger[_0x0525('0xf')](_0x0525('0xc'),_0x570d03,_0x53d964[_0x0525('0xf')][_0x0525('0x11')]);return _0x5c9cdc(_0x53d964[_0x0525('0xf')][_0x0525('0x11')]);}else{logger[_0x0525('0xb')](_0x0525('0xc'),_0x570d03,_0x0525('0xd'));_0x5c9cdc(_0x53d964[_0x0525('0x12')]['message']);}})[_0x0525('0x13')](function(_0x44a9b3){logger[_0x0525('0xf')](_0x0525('0xc'),_0x570d03,_0x44a9b3);_0x37d609(_0x44a9b3);});});} \ No newline at end of file +var _0xc29e=['../../config/environment','jayson/promise','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc29e,0xad));var _0xec29=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xc29e[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0xec29('0x0'));var moment=require(_0xec29('0x1'));var BPromise=require(_0xec29('0x2'));var rs=require(_0xec29('0x3'));var fs=require('fs');var Redis=require(_0xec29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec29('0x5'));var logger=require('../../config/logger')(_0xec29('0x6'));var config=require(_0xec29('0x7'));var jayson=require(_0xec29('0x8'));var client=jayson[_0xec29('0x9')][_0xec29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22d4c3,_0x3c66cd,_0x8f637c){return new BPromise(function(_0x2ba768,_0x559923){return client['request'](_0x22d4c3,_0x8f637c)[_0xec29('0xb')](function(_0x1cc619){logger['info'](_0xec29('0xc'),_0x3c66cd,_0xec29('0xd'));logger['debug'](_0xec29('0xe'),_0x3c66cd,_0xec29('0xd'),JSON[_0xec29('0xf')](_0x1cc619));if(_0x1cc619[_0xec29('0x10')]){if(_0x1cc619[_0xec29('0x10')][_0xec29('0x11')]===0x1f4){logger[_0xec29('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3c66cd,_0x1cc619[_0xec29('0x10')][_0xec29('0x12')]);return _0x559923(_0x1cc619[_0xec29('0x10')][_0xec29('0x12')]);}logger['error'](_0xec29('0xc'),_0x3c66cd,_0x1cc619[_0xec29('0x10')][_0xec29('0x12')]);return _0x2ba768(_0x1cc619['error'][_0xec29('0x12')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3c66cd,_0xec29('0xd'));_0x2ba768(_0x1cc619['result'][_0xec29('0x12')]);}})[_0xec29('0x13')](function(_0x3d35ec){logger[_0xec29('0x10')](_0xec29('0xc'),_0x3c66cd,_0x3d35ec);_0x559923(_0x3d35ec);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 82ba963..05bc53c 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 _0x829c=['./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x437e13,_0x3af614){var _0x1b5131=function(_0x4f5393){while(--_0x4f5393){_0x437e13['push'](_0x437e13['shift']());}};_0x1b5131(++_0x3af614);}(_0x829c,0x88));var _0xc829=function(_0x4be1fa,_0xe5d3eb){_0x4be1fa=_0x4be1fa-0x0;var _0x37a98b=_0x829c[_0x4be1fa];return _0x37a98b;};'use strict';var multer=require(_0xc829('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc829('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc829('0x2'));var config=require(_0xc829('0x3'));var controller=require(_0xc829('0x4'));router[_0xc829('0x5')]('/',auth[_0xc829('0x6')](),controller[_0xc829('0x7')]);router['get'](_0xc829('0x8'),auth[_0xc829('0x6')](),controller[_0xc829('0x9')]);router[_0xc829('0xa')]('/',auth[_0xc829('0x6')](),controller['create']);router['put'](_0xc829('0x8'),auth[_0xc829('0x6')](),controller['update']);router[_0xc829('0xb')]('/:id',auth[_0xc829('0x6')](),controller[_0xc829('0xc')]);module[_0xc829('0xd')]=router; \ No newline at end of file +var _0xc8e7=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xa3cdb4,_0x5c0cf0){var _0x5dc569=function(_0x1d770a){while(--_0x1d770a){_0xa3cdb4['push'](_0xa3cdb4['shift']());}};_0x5dc569(++_0x5c0cf0);}(_0xc8e7,0x1e6));var _0x7c8e=function(_0x4f4757,_0x44241a){_0x4f4757=_0x4f4757-0x0;var _0x549c37=_0xc8e7[_0x4f4757];return _0x549c37;};'use strict';var multer=require(_0x7c8e('0x0'));var util=require(_0x7c8e('0x1'));var path=require(_0x7c8e('0x2'));var timeout=require(_0x7c8e('0x3'));var express=require(_0x7c8e('0x4'));var router=express[_0x7c8e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7c8e('0x6'));var interaction=require(_0x7c8e('0x7'));var config=require(_0x7c8e('0x8'));var controller=require(_0x7c8e('0x9'));router[_0x7c8e('0xa')]('/',auth[_0x7c8e('0xb')](),controller[_0x7c8e('0xc')]);router[_0x7c8e('0xa')](_0x7c8e('0xd'),auth[_0x7c8e('0xb')](),controller['show']);router['post']('/',auth[_0x7c8e('0xb')](),controller[_0x7c8e('0xe')]);router[_0x7c8e('0xf')](_0x7c8e('0xd'),auth[_0x7c8e('0xb')](),controller['update']);router[_0x7c8e('0x10')](_0x7c8e('0xd'),auth['isAuthenticated'](),controller[_0x7c8e('0x11')]);module[_0x7c8e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 492c231..cc10d43 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 _0x85ca=['variable','customVariable','BOOLEAN','sequelize','picklist','string','STRING'];(function(_0x2277be,_0x35a10a){var _0x452b7f=function(_0x44c670){while(--_0x44c670){_0x2277be['push'](_0x2277be['shift']());}};_0x452b7f(++_0x35a10a);}(_0x85ca,0x96));var _0xa85c=function(_0x12dfcd,_0x38d3cd){_0x12dfcd=_0x12dfcd-0x0;var _0x197f39=_0x85ca[_0x12dfcd];return _0x197f39;};'use strict';var Sequelize=require(_0xa85c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue',_0xa85c('0x1')),'defaultValue':_0xa85c('0x2')},'content':{'type':Sequelize[_0xa85c('0x3')]},'key':{'type':Sequelize[_0xa85c('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0xa85c('0x2'),_0xa85c('0x4'),_0xa85c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa85c('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa85c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa85c('0x3')]}}; \ No newline at end of file +var _0xb3f3=['string','STRING','variable','BOOLEAN','exports','ENUM','customVariable','keyValue','picklist'];(function(_0xb8412c,_0x2ae5a6){var _0x26ac6a=function(_0x1d4cf3){while(--_0x1d4cf3){_0xb8412c['push'](_0xb8412c['shift']());}};_0x26ac6a(++_0x2ae5a6);}(_0xb3f3,0x82));var _0x3b3f=function(_0x114ae4,_0x14bdc9){_0x114ae4=_0x114ae4-0x0;var _0x32f566=_0xb3f3[_0x114ae4];return _0x32f566;};'use strict';var Sequelize=require('sequelize');module[_0x3b3f('0x0')]={'type':{'type':Sequelize[_0x3b3f('0x1')]('string','variable',_0x3b3f('0x2'),_0x3b3f('0x3'),_0x3b3f('0x4')),'defaultValue':_0x3b3f('0x5')},'content':{'type':Sequelize[_0x3b3f('0x6')]},'key':{'type':Sequelize[_0x3b3f('0x6')]},'keyType':{'type':Sequelize[_0x3b3f('0x1')](_0x3b3f('0x5'),_0x3b3f('0x7'),_0x3b3f('0x2'))},'keyContent':{'type':Sequelize[_0x3b3f('0x6')]},'idField':{'type':Sequelize[_0x3b3f('0x6')]},'nameField':{'type':Sequelize[_0x3b3f('0x6')]},'customField':{'type':Sequelize[_0x3b3f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f2cb99f..04c7088 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 _0x8be9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','merge','options','include','rows','show','fields','includeAll','find','update','body','catch','params','eml-format'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0x8be9,0x8f));var _0x98be=function(_0x29ffb9,_0x2adaed){_0x29ffb9=_0x29ffb9-0x0;var _0xdc4d93=_0x8be9[_0x29ffb9];return _0xdc4d93;};'use strict';var emlformat=require(_0x98be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98be('0x1'));var jsonpatch=require(_0x98be('0x2'));var rp=require(_0x98be('0x3'));var moment=require(_0x98be('0x4'));var BPromise=require(_0x98be('0x5'));var Mustache=require(_0x98be('0x6'));var util=require('util');var path=require(_0x98be('0x7'));var sox=require('sox');var csv=require(_0x98be('0x8'));var ejs=require(_0x98be('0x9'));var fs=require('fs');var fs_extra=require(_0x98be('0xa'));var _=require('lodash');var squel=require(_0x98be('0xb'));var crypto=require(_0x98be('0xc'));var jsforce=require(_0x98be('0xd'));var deskjs=require(_0x98be('0xe'));var toCsv=require(_0x98be('0x8'));var querystring=require(_0x98be('0xf'));var Papa=require('papaparse');var Redis=require(_0x98be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x98be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98be('0x12'));var logger=require('../../config/logger')(_0x98be('0x13'));var utils=require(_0x98be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x98be('0x15'));var db=require(_0x98be('0x16'))['db'];function respondWithStatusCode(_0x3079b4,_0x29e79a){_0x29e79a=_0x29e79a||0xcc;return function(_0x54a068){if(_0x54a068){return _0x3079b4[_0x98be('0x17')](_0x29e79a);}return _0x3079b4[_0x98be('0x18')](_0x29e79a)[_0x98be('0x19')]();};}function respondWithResult(_0x2ff1a8,_0x498516){_0x498516=_0x498516||0xc8;return function(_0x390821){if(_0x390821){return _0x2ff1a8[_0x98be('0x18')](_0x498516)[_0x98be('0x1a')](_0x390821);}};}function respondWithFilteredResult(_0x340876,_0x48d941){return function(_0x220935){if(_0x220935){var _0x25f877=typeof _0x48d941[_0x98be('0x1b')]===_0x98be('0x1c')&&typeof _0x48d941['limit']===_0x98be('0x1c');var _0x2db17d=_0x220935[_0x98be('0x1d')];var _0x3d894b=_0x25f877?0x0:_0x48d941[_0x98be('0x1b')];var _0x16cd04=_0x25f877?_0x220935[_0x98be('0x1d')]:_0x48d941[_0x98be('0x1b')]+_0x48d941['limit'];var _0x2b717f;if(_0x16cd04>=_0x2db17d){_0x16cd04=_0x2db17d;_0x2b717f=0xc8;}else{_0x2b717f=0xce;}_0x340876[_0x98be('0x18')](_0x2b717f);return _0x340876[_0x98be('0x1e')](_0x98be('0x1f'),_0x3d894b+'-'+_0x16cd04+'/'+_0x2db17d)[_0x98be('0x1a')](_0x220935);}return null;};}function patchUpdates(_0x447816){return function(_0x2af795){try{jsonpatch['apply'](_0x2af795,_0x447816,!![]);}catch(_0x4f46f6){return BPromise[_0x98be('0x20')](_0x4f46f6);}return _0x2af795[_0x98be('0x21')]();};}function saveUpdates(_0x4812ff,_0x4b9d5e){return function(_0x11bdb1){if(_0x11bdb1){return _0x11bdb1['update'](_0x4812ff)['then'](function(_0x2095ef){return _0x2095ef;});}return null;};}function removeEntity(_0x3ddef1,_0x4c1a79){return function(_0x159c42){if(_0x159c42){return _0x159c42[_0x98be('0x22')]()[_0x98be('0x23')](function(){_0x3ddef1['status'](0xcc)[_0x98be('0x19')]();});}};}function handleEntityNotFound(_0x21636f,_0x1f9e35){return function(_0x5eded3){if(!_0x5eded3){_0x21636f['sendStatus'](0x194);}return _0x5eded3;};}function handleError(_0x2e30ff,_0x556c18){_0x556c18=_0x556c18||0x1f4;return function(_0x33f069){logger[_0x98be('0x24')](_0x33f069[_0x98be('0x25')]);if(_0x33f069[_0x98be('0x26')]){delete _0x33f069[_0x98be('0x26')];}_0x2e30ff['status'](_0x556c18)[_0x98be('0x27')](_0x33f069);};}exports['index']=function(_0x19c1e9,_0x48f8fa){var _0x2d6793={},_0x19842a={},_0x2de5c0={'count':0x0,'rows':[]};var _0x433d4f=_[_0x98be('0x28')](db[_0x98be('0x29')][_0x98be('0x2a')],function(_0x2af772){return{'name':_0x2af772[_0x98be('0x2b')],'type':_0x2af772['type'][_0x98be('0x2c')]};});_0x19842a['model']=_[_0x98be('0x28')](_0x433d4f,'name');_0x19842a['query']=_[_0x98be('0x2d')](_0x19c1e9[_0x98be('0x2e')]);_0x19842a[_0x98be('0x2f')]=_[_0x98be('0x30')](_0x19842a[_0x98be('0x31')],_0x19842a[_0x98be('0x2e')]);_0x2d6793[_0x98be('0x32')]=_[_0x98be('0x30')](_0x19842a[_0x98be('0x31')],qs['fields'](_0x19c1e9['query']['fields']));_0x2d6793[_0x98be('0x32')]=_0x2d6793[_0x98be('0x32')][_0x98be('0x33')]?_0x2d6793[_0x98be('0x32')]:_0x19842a[_0x98be('0x31')];if(!_0x19c1e9[_0x98be('0x2e')][_0x98be('0x34')]('nolimit')){_0x2d6793[_0x98be('0x35')]=qs['limit'](_0x19c1e9['query'][_0x98be('0x35')]);_0x2d6793[_0x98be('0x1b')]=qs[_0x98be('0x1b')](_0x19c1e9[_0x98be('0x2e')][_0x98be('0x1b')]);}_0x2d6793[_0x98be('0x36')]=qs['sort'](_0x19c1e9[_0x98be('0x2e')][_0x98be('0x37')]);_0x2d6793[_0x98be('0x38')]=qs[_0x98be('0x2f')](_[_0x98be('0x39')](_0x19c1e9[_0x98be('0x2e')],_0x19842a['filters']),_0x433d4f);if(_0x19c1e9['query'][_0x98be('0x3a')]){_0x2d6793[_0x98be('0x38')]=_['merge'](_0x2d6793['where'],{'$or':_['map'](_0x433d4f,function(_0x5751f1){if(_0x5751f1[_0x98be('0x3b')]!=='VIRTUAL'){var _0x25fb2d={};_0x25fb2d[_0x5751f1[_0x98be('0x26')]]={'$like':'%'+_0x19c1e9[_0x98be('0x2e')][_0x98be('0x3a')]+'%'};return _0x25fb2d;}})});}_0x2d6793=_[_0x98be('0x3c')]({},_0x2d6793,_0x19c1e9[_0x98be('0x3d')]);var _0x4a074d={'where':_0x2d6793[_0x98be('0x38')]};return db[_0x98be('0x29')][_0x98be('0x1d')](_0x4a074d)[_0x98be('0x23')](function(_0x201de3){_0x2de5c0[_0x98be('0x1d')]=_0x201de3;if(_0x19c1e9[_0x98be('0x2e')]['includeAll']){_0x2d6793[_0x98be('0x3e')]=[{'all':!![]}];}return db[_0x98be('0x29')]['findAll'](_0x2d6793);})[_0x98be('0x23')](function(_0x562663){_0x2de5c0[_0x98be('0x3f')]=_0x562663;return _0x2de5c0;})[_0x98be('0x23')](respondWithFilteredResult(_0x48f8fa,_0x2d6793))['catch'](handleError(_0x48f8fa,null));};exports[_0x98be('0x40')]=function(_0x484064,_0x407e57){var _0x451361={'raw':!![],'where':{'id':_0x484064['params']['id']}},_0x575cbf={};_0x575cbf[_0x98be('0x31')]=_[_0x98be('0x2d')](db[_0x98be('0x29')][_0x98be('0x2a')]);_0x575cbf['query']=_[_0x98be('0x2d')](_0x484064[_0x98be('0x2e')]);_0x575cbf[_0x98be('0x2f')]=_[_0x98be('0x30')](_0x575cbf[_0x98be('0x31')],_0x575cbf[_0x98be('0x2e')]);_0x451361[_0x98be('0x32')]=_[_0x98be('0x30')](_0x575cbf[_0x98be('0x31')],qs[_0x98be('0x41')](_0x484064[_0x98be('0x2e')][_0x98be('0x41')]));_0x451361[_0x98be('0x32')]=_0x451361[_0x98be('0x32')][_0x98be('0x33')]?_0x451361[_0x98be('0x32')]:_0x575cbf[_0x98be('0x31')];if(_0x484064[_0x98be('0x2e')][_0x98be('0x42')]){_0x451361[_0x98be('0x3e')]=[{'all':!![]}];}_0x451361=_[_0x98be('0x3c')]({},_0x451361,_0x484064[_0x98be('0x3d')]);return db['ZohoField'][_0x98be('0x43')](_0x451361)['then'](handleEntityNotFound(_0x407e57,null))[_0x98be('0x23')](respondWithResult(_0x407e57,null))['catch'](handleError(_0x407e57,null));};exports['create']=function(_0x226ce9,_0x18fa37){return db[_0x98be('0x29')]['create'](_0x226ce9['body'],{})[_0x98be('0x23')](respondWithResult(_0x18fa37,0xc9))['catch'](handleError(_0x18fa37,null));};exports[_0x98be('0x44')]=function(_0x2f65e2,_0x3b20a5){if(_0x2f65e2[_0x98be('0x45')]['id']){delete _0x2f65e2[_0x98be('0x45')]['id'];}return db[_0x98be('0x29')][_0x98be('0x43')]({'where':{'id':_0x2f65e2['params']['id']}})[_0x98be('0x23')](handleEntityNotFound(_0x3b20a5,null))[_0x98be('0x23')](saveUpdates(_0x2f65e2[_0x98be('0x45')],null))[_0x98be('0x23')](respondWithResult(_0x3b20a5,null))[_0x98be('0x46')](handleError(_0x3b20a5,null));};exports['destroy']=function(_0x5cf654,_0x41592d){return db['ZohoField'][_0x98be('0x43')]({'where':{'id':_0x5cf654[_0x98be('0x47')]['id']}})[_0x98be('0x23')](handleEntityNotFound(_0x41592d,null))['then'](removeEntity(_0x41592d,null))['catch'](handleError(_0x41592d,null));}; \ No newline at end of file +var _0x8ce6=['sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','ZohoField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x53e826,_0x513c59){var _0x5d4184=function(_0x1c47e6){while(--_0x1c47e6){_0x53e826['push'](_0x53e826['shift']());}};_0x5d4184(++_0x513c59);}(_0x8ce6,0xcf));var _0x68ce=function(_0x1c2fb4,_0x426a64){_0x1c2fb4=_0x1c2fb4-0x0;var _0x1b2b1b=_0x8ce6[_0x1c2fb4];return _0x1b2b1b;};'use strict';var emlformat=require(_0x68ce('0x0'));var rimraf=require(_0x68ce('0x1'));var zipdir=require(_0x68ce('0x2'));var jsonpatch=require(_0x68ce('0x3'));var rp=require(_0x68ce('0x4'));var moment=require(_0x68ce('0x5'));var BPromise=require(_0x68ce('0x6'));var Mustache=require('mustache');var util=require(_0x68ce('0x7'));var path=require(_0x68ce('0x8'));var sox=require(_0x68ce('0x9'));var csv=require('to-csv');var ejs=require(_0x68ce('0xa'));var fs=require('fs');var fs_extra=require(_0x68ce('0xb'));var _=require(_0x68ce('0xc'));var squel=require(_0x68ce('0xd'));var crypto=require(_0x68ce('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x68ce('0xf'));var Redis=require(_0x68ce('0x10'));var authService=require(_0x68ce('0x11'));var qs=require(_0x68ce('0x12'));var as=require(_0x68ce('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68ce('0x14'))('api');var utils=require(_0x68ce('0x15'));var config=require(_0x68ce('0x16'));var licenseUtil=require(_0x68ce('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a66aa,_0x5a6193){_0x5a6193=_0x5a6193||0xcc;return function(_0x586735){if(_0x586735){return _0x1a66aa[_0x68ce('0x18')](_0x5a6193);}return _0x1a66aa[_0x68ce('0x19')](_0x5a6193)['end']();};}function respondWithResult(_0x36ba93,_0x4315a6){_0x4315a6=_0x4315a6||0xc8;return function(_0x25d882){if(_0x25d882){return _0x36ba93[_0x68ce('0x19')](_0x4315a6)[_0x68ce('0x1a')](_0x25d882);}};}function respondWithFilteredResult(_0x305d60,_0x54ffd4){return function(_0x84f5d5){if(_0x84f5d5){var _0x2f1cd8=typeof _0x54ffd4[_0x68ce('0x1b')]==='undefined'&&typeof _0x54ffd4[_0x68ce('0x1c')]===_0x68ce('0x1d');var _0xcccf9=_0x84f5d5[_0x68ce('0x1e')];var _0x542a81=_0x2f1cd8?0x0:_0x54ffd4[_0x68ce('0x1b')];var _0x21f4b8=_0x2f1cd8?_0x84f5d5[_0x68ce('0x1e')]:_0x54ffd4[_0x68ce('0x1b')]+_0x54ffd4[_0x68ce('0x1c')];var _0x5ccbb8;if(_0x21f4b8>=_0xcccf9){_0x21f4b8=_0xcccf9;_0x5ccbb8=0xc8;}else{_0x5ccbb8=0xce;}_0x305d60[_0x68ce('0x19')](_0x5ccbb8);return _0x305d60[_0x68ce('0x1f')](_0x68ce('0x20'),_0x542a81+'-'+_0x21f4b8+'/'+_0xcccf9)[_0x68ce('0x1a')](_0x84f5d5);}return null;};}function patchUpdates(_0x2b3e8c){return function(_0x51c6a7){try{jsonpatch['apply'](_0x51c6a7,_0x2b3e8c,!![]);}catch(_0x26d4fe){return BPromise[_0x68ce('0x21')](_0x26d4fe);}return _0x51c6a7[_0x68ce('0x22')]();};}function saveUpdates(_0x56b70b,_0x3f53d4){return function(_0x3fb683){if(_0x3fb683){return _0x3fb683[_0x68ce('0x23')](_0x56b70b)['then'](function(_0x45187b){return _0x45187b;});}return null;};}function removeEntity(_0x14216f,_0x477cb3){return function(_0x4378d6){if(_0x4378d6){return _0x4378d6[_0x68ce('0x24')]()[_0x68ce('0x25')](function(){_0x14216f[_0x68ce('0x19')](0xcc)[_0x68ce('0x26')]();});}};}function handleEntityNotFound(_0x589d96,_0xaa215){return function(_0x33c4df){if(!_0x33c4df){_0x589d96[_0x68ce('0x18')](0x194);}return _0x33c4df;};}function handleError(_0x280516,_0x1d777c){_0x1d777c=_0x1d777c||0x1f4;return function(_0x2a8a3c){logger[_0x68ce('0x27')](_0x2a8a3c[_0x68ce('0x28')]);if(_0x2a8a3c['name']){delete _0x2a8a3c[_0x68ce('0x29')];}_0x280516[_0x68ce('0x19')](_0x1d777c)[_0x68ce('0x2a')](_0x2a8a3c);};}exports['index']=function(_0x714a8d,_0x4b841b){var _0x1746e6={},_0x15ec49={},_0x566a09={'count':0x0,'rows':[]};var _0x37a29f=_['map'](db[_0x68ce('0x2b')][_0x68ce('0x2c')],function(_0x43ea6f){return{'name':_0x43ea6f[_0x68ce('0x2d')],'type':_0x43ea6f[_0x68ce('0x2e')]['key']};});_0x15ec49[_0x68ce('0x2f')]=_[_0x68ce('0x30')](_0x37a29f,_0x68ce('0x29'));_0x15ec49[_0x68ce('0x31')]=_[_0x68ce('0x32')](_0x714a8d[_0x68ce('0x31')]);_0x15ec49[_0x68ce('0x33')]=_[_0x68ce('0x34')](_0x15ec49['model'],_0x15ec49['query']);_0x1746e6[_0x68ce('0x35')]=_[_0x68ce('0x34')](_0x15ec49[_0x68ce('0x2f')],qs[_0x68ce('0x36')](_0x714a8d['query'][_0x68ce('0x36')]));_0x1746e6[_0x68ce('0x35')]=_0x1746e6[_0x68ce('0x35')]['length']?_0x1746e6[_0x68ce('0x35')]:_0x15ec49[_0x68ce('0x2f')];if(!_0x714a8d[_0x68ce('0x31')][_0x68ce('0x37')]('nolimit')){_0x1746e6[_0x68ce('0x1c')]=qs[_0x68ce('0x1c')](_0x714a8d[_0x68ce('0x31')][_0x68ce('0x1c')]);_0x1746e6[_0x68ce('0x1b')]=qs[_0x68ce('0x1b')](_0x714a8d['query'][_0x68ce('0x1b')]);}_0x1746e6['order']=qs['sort'](_0x714a8d[_0x68ce('0x31')][_0x68ce('0x38')]);_0x1746e6[_0x68ce('0x39')]=qs[_0x68ce('0x33')](_[_0x68ce('0x3a')](_0x714a8d[_0x68ce('0x31')],_0x15ec49[_0x68ce('0x33')]),_0x37a29f);if(_0x714a8d['query'][_0x68ce('0x3b')]){_0x1746e6[_0x68ce('0x39')]=_[_0x68ce('0x3c')](_0x1746e6['where'],{'$or':_[_0x68ce('0x30')](_0x37a29f,function(_0x3947bf){if(_0x3947bf['type']!==_0x68ce('0x3d')){var _0x5bbb44={};_0x5bbb44[_0x3947bf[_0x68ce('0x29')]]={'$like':'%'+_0x714a8d[_0x68ce('0x31')][_0x68ce('0x3b')]+'%'};return _0x5bbb44;}})});}_0x1746e6=_[_0x68ce('0x3c')]({},_0x1746e6,_0x714a8d[_0x68ce('0x3e')]);var _0x3bc565={'where':_0x1746e6[_0x68ce('0x39')]};return db[_0x68ce('0x2b')][_0x68ce('0x1e')](_0x3bc565)[_0x68ce('0x25')](function(_0x4579f0){_0x566a09[_0x68ce('0x1e')]=_0x4579f0;if(_0x714a8d[_0x68ce('0x31')]['includeAll']){_0x1746e6['include']=[{'all':!![]}];}return db[_0x68ce('0x2b')]['findAll'](_0x1746e6);})['then'](function(_0x501b7d){_0x566a09[_0x68ce('0x3f')]=_0x501b7d;return _0x566a09;})[_0x68ce('0x25')](respondWithFilteredResult(_0x4b841b,_0x1746e6))[_0x68ce('0x40')](handleError(_0x4b841b,null));};exports[_0x68ce('0x41')]=function(_0x182cf2,_0x3a09cf){var _0x5ebae3={'raw':!![],'where':{'id':_0x182cf2[_0x68ce('0x42')]['id']}},_0x48be66={};_0x48be66['model']=_['keys'](db['ZohoField'][_0x68ce('0x2c')]);_0x48be66['query']=_[_0x68ce('0x32')](_0x182cf2['query']);_0x48be66['filters']=_[_0x68ce('0x34')](_0x48be66[_0x68ce('0x2f')],_0x48be66[_0x68ce('0x31')]);_0x5ebae3[_0x68ce('0x35')]=_['intersection'](_0x48be66[_0x68ce('0x2f')],qs[_0x68ce('0x36')](_0x182cf2[_0x68ce('0x31')][_0x68ce('0x36')]));_0x5ebae3['attributes']=_0x5ebae3['attributes'][_0x68ce('0x43')]?_0x5ebae3[_0x68ce('0x35')]:_0x48be66[_0x68ce('0x2f')];if(_0x182cf2[_0x68ce('0x31')]['includeAll']){_0x5ebae3[_0x68ce('0x44')]=[{'all':!![]}];}_0x5ebae3=_[_0x68ce('0x3c')]({},_0x5ebae3,_0x182cf2[_0x68ce('0x3e')]);return db['ZohoField'][_0x68ce('0x45')](_0x5ebae3)['then'](handleEntityNotFound(_0x3a09cf,null))[_0x68ce('0x25')](respondWithResult(_0x3a09cf,null))[_0x68ce('0x40')](handleError(_0x3a09cf,null));};exports['create']=function(_0x4e5e8d,_0x5aea6f){return db[_0x68ce('0x2b')][_0x68ce('0x46')](_0x4e5e8d[_0x68ce('0x47')],{})[_0x68ce('0x25')](respondWithResult(_0x5aea6f,0xc9))[_0x68ce('0x40')](handleError(_0x5aea6f,null));};exports[_0x68ce('0x23')]=function(_0x4796e6,_0x51eb68){if(_0x4796e6[_0x68ce('0x47')]['id']){delete _0x4796e6['body']['id'];}return db['ZohoField'][_0x68ce('0x45')]({'where':{'id':_0x4796e6[_0x68ce('0x42')]['id']}})[_0x68ce('0x25')](handleEntityNotFound(_0x51eb68,null))['then'](saveUpdates(_0x4796e6[_0x68ce('0x47')],null))[_0x68ce('0x25')](respondWithResult(_0x51eb68,null))[_0x68ce('0x40')](handleError(_0x51eb68,null));};exports['destroy']=function(_0x455e4c,_0x59a4e3){return db[_0x68ce('0x2b')]['find']({'where':{'id':_0x455e4c['params']['id']}})[_0x68ce('0x25')](handleEntityNotFound(_0x59a4e3,null))[_0x68ce('0x25')](removeEntity(_0x59a4e3,null))[_0x68ce('0x40')](handleError(_0x59a4e3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 21f6ad7..660779b 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 _0xed1c=['lodash','util','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xed1c,0xe4));var _0xced1=function(_0x170768,_0x1861fd){_0x170768=_0x170768-0x0;var _0x58f9d3=_0xed1c[_0x170768];return _0x58f9d3;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'paranoid':![],'indexes':[{'name':_0xced1('0x9'),'fields':[_0xced1('0xa'),_0xced1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4325=['../../config/environment','./intZohoField.attributes','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0xa'),_0x5432('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 803561e..2be0efa 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 _0xb83e=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c61dd,_0x318fa4){var _0x1b8e4e=function(_0x393c50){while(--_0x393c50){_0x4c61dd['push'](_0x4c61dd['shift']());}};_0x1b8e4e(++_0x318fa4);}(_0xb83e,0x139));var _0xeb83=function(_0x2509be,_0x5c9173){_0x2509be=_0x2509be-0x0;var _0x2f2f00=_0xb83e[_0x2509be];return _0x2f2f00;};'use strict';var _=require(_0xeb83('0x0'));var util=require(_0xeb83('0x1'));var moment=require(_0xeb83('0x2'));var BPromise=require(_0xeb83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb83('0x4'));var db=require(_0xeb83('0x5'))['db'];var utils=require(_0xeb83('0x6'));var logger=require('../../config/logger')(_0xeb83('0x7'));var config=require(_0xeb83('0x8'));var jayson=require(_0xeb83('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56d247,_0x5849e0,_0x2829d8){return new BPromise(function(_0x5464e2,_0x566fad){return client[_0xeb83('0xa')](_0x56d247,_0x2829d8)['then'](function(_0x4f805f){logger['info'](_0xeb83('0xb'),_0x5849e0,_0xeb83('0xc'));logger[_0xeb83('0xd')](_0xeb83('0xe'),_0x5849e0,_0xeb83('0xc'),JSON[_0xeb83('0xf')](_0x4f805f));if(_0x4f805f[_0xeb83('0x10')]){if(_0x4f805f['error'][_0xeb83('0x11')]===0x1f4){logger[_0xeb83('0x10')](_0xeb83('0xb'),_0x5849e0,_0x4f805f[_0xeb83('0x10')][_0xeb83('0x12')]);return _0x566fad(_0x4f805f[_0xeb83('0x10')][_0xeb83('0x12')]);}logger[_0xeb83('0x10')](_0xeb83('0xb'),_0x5849e0,_0x4f805f[_0xeb83('0x10')][_0xeb83('0x12')]);return _0x5464e2(_0x4f805f[_0xeb83('0x10')][_0xeb83('0x12')]);}else{logger[_0xeb83('0x13')](_0xeb83('0xb'),_0x5849e0,_0xeb83('0xc'));_0x5464e2(_0x4f805f[_0xeb83('0x14')][_0xeb83('0x12')]);}})[_0xeb83('0x15')](function(_0x2b15c9){logger[_0xeb83('0x10')](_0xeb83('0xb'),_0x5849e0,_0x2b15c9);_0x566fad(_0x2b15c9);});});} \ No newline at end of file +var _0x59cd=['http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x31b458,_0x244fd8){var _0x3f3ddb=function(_0xdeae73){while(--_0xdeae73){_0x31b458['push'](_0x31b458['shift']());}};_0x3f3ddb(++_0x244fd8);}(_0x59cd,0x194));var _0xd59c=function(_0x31c796,_0x2e3c7f){_0x31c796=_0x31c796-0x0;var _0x128356=_0x59cd[_0x31c796];return _0x128356;};'use strict';var _=require('lodash');var util=require(_0xd59c('0x0'));var moment=require(_0xd59c('0x1'));var BPromise=require(_0xd59c('0x2'));var rs=require(_0xd59c('0x3'));var fs=require('fs');var Redis=require(_0xd59c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd59c('0x5'));var logger=require(_0xd59c('0x6'))(_0xd59c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd59c('0x8'));var client=jayson[_0xd59c('0x9')][_0xd59c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e1cce,_0x224f3d,_0x575df5){return new BPromise(function(_0x327358,_0xd209f8){return client[_0xd59c('0xb')](_0x5e1cce,_0x575df5)[_0xd59c('0xc')](function(_0x411394){logger[_0xd59c('0xd')]('ZohoField,\x20%s,\x20%s',_0x224f3d,_0xd59c('0xe'));logger[_0xd59c('0xf')](_0xd59c('0x10'),_0x224f3d,'request\x20sent',JSON[_0xd59c('0x11')](_0x411394));if(_0x411394[_0xd59c('0x12')]){if(_0x411394[_0xd59c('0x12')][_0xd59c('0x13')]===0x1f4){logger[_0xd59c('0x12')](_0xd59c('0x14'),_0x224f3d,_0x411394['error'][_0xd59c('0x15')]);return _0xd209f8(_0x411394['error'][_0xd59c('0x15')]);}logger[_0xd59c('0x12')]('ZohoField,\x20%s,\x20%s',_0x224f3d,_0x411394['error'][_0xd59c('0x15')]);return _0x327358(_0x411394[_0xd59c('0x12')][_0xd59c('0x15')]);}else{logger[_0xd59c('0xd')](_0xd59c('0x14'),_0x224f3d,_0xd59c('0xe'));_0x327358(_0x411394[_0xd59c('0x16')][_0xd59c('0x15')]);}})['catch'](function(_0x5dcf0b){logger[_0xd59c('0x12')]('ZohoField,\x20%s,\x20%s',_0x224f3d,_0x5dcf0b);_0xd209f8(_0x5dcf0b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 64a9e13..e50d134 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a9a0c,_0x120b8a){var _0x316d25=function(_0x3f8c2c){while(--_0x3f8c2c){_0x4a9a0c['push'](_0x4a9a0c['shift']());}};_0x316d25(++_0x120b8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5f185d,_0x54f79b){var _0x5b5294=function(_0x534843){while(--_0x534843){_0x5f185d['push'](_0x5f185d['shift']());}};_0x5b5294(++_0x54f79b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0xcb91[_0x3c4e4c];return _0x144a87;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5d53552..7734514 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 _0x0aab=['state','sequelize','unique_name_and_version','STRING','app.js','BOOLEAN'];(function(_0x59a0e4,_0x492f2c){var _0x64e2f9=function(_0x42df1e){while(--_0x42df1e){_0x59a0e4['push'](_0x59a0e4['shift']());}};_0x64e2f9(++_0x492f2c);}(_0x0aab,0x169));var _0xb0aa=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x0aab[_0x483ab9];return _0x35043b;};'use strict';var Sequelize=require(_0xb0aa('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb0aa('0x1')},'version':{'type':Sequelize[_0xb0aa('0x2')],'allowNull':![],'unique':_0xb0aa('0x1')},'main':{'type':Sequelize[_0xb0aa('0x2')],'defaultValue':_0xb0aa('0x3')},'filename':{'type':Sequelize[_0xb0aa('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb0aa('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xb0aa('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb0aa('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xb0aa('0x5')},'description':{'type':Sequelize[_0xb0aa('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xb0aa('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x828b=['BOOLEAN','sequelize','unique_name_and_version','STRING','app.js'];(function(_0xb6e87e,_0x3f69a2){var _0x3bf909=function(_0xfb60e3){while(--_0xfb60e3){_0xb6e87e['push'](_0xb6e87e['shift']());}};_0x3bf909(++_0x3f69a2);}(_0x828b,0x182));var _0xb828=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x828b[_0x2a6fd5];return _0x43c6a4;};'use strict';var Sequelize=require(_0xb828('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb828('0x1')},'version':{'type':Sequelize[_0xb828('0x2')],'allowNull':![],'unique':_0xb828('0x1')},'main':{'type':Sequelize[_0xb828('0x2')],'defaultValue':_0xb828('0x3')},'filename':{'type':Sequelize[_0xb828('0x2')]},'path':{'type':Sequelize[_0xb828('0x2')]},'type':{'type':Sequelize[_0xb828('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xb828('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb828('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb828('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xb828('0x2')]},'title':{'type':Sequelize[_0xb828('0x2')]},'remoteUri':{'type':Sequelize[_0xb828('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 18a71f0..ac013c4 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 _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0x47fd9e,_0x5a982d){var _0xf56302=function(_0x1e5558){while(--_0x1e5558){_0x47fd9e['push'](_0x47fd9e['shift']());}};_0xf56302(++_0x5a982d);}(_0xb016,0x159));var _0x6b01=function(_0x32a0db,_0x5f347e){_0x32a0db=_0x32a0db-0x0;var _0x3b8a6c=_0xb016[_0x32a0db];return _0x3b8a6c;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file +var _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x2bc400,_0x27208f){var _0x36ab53=function(_0x257660){while(--_0x257660){_0x2bc400['push'](_0x2bc400['shift']());}};_0x36ab53(++_0x27208f);}(_0x9582,0x95));var _0x2958=function(_0xcc40fc,_0x3b4408){_0xcc40fc=_0xcc40fc-0x0;var _0x21f6fe=_0x9582[_0xcc40fc];return _0x21f6fe;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1c66f91..21d12d7 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 _0x47db=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util'];(function(_0x246c59,_0x1bf1a1){var _0x23a1f4=function(_0x4c90c5){while(--_0x4c90c5){_0x246c59['push'](_0x246c59['shift']());}};_0x23a1f4(++_0x1bf1a1);}(_0x47db,0x16a));var _0xb47d=function(_0x9d94ce,_0x368242){_0x9d94ce=_0x9d94ce-0x0;var _0x147808=_0x47db[_0x9d94ce];return _0x147808;};'use strict';var _=require(_0xb47d('0x0'));var util=require(_0xb47d('0x1'));var logger=require(_0xb47d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb47d('0x3'));var rp=require(_0xb47d('0x4'));var fs=require('fs');var path=require(_0xb47d('0x5'));var rimraf=require(_0xb47d('0x6'));var config=require(_0xb47d('0x7'));var attributes=require(_0xb47d('0x8'));module[_0xb47d('0x9')]=function(_0x20f7f8,_0x1406d7){return _0x20f7f8[_0xb47d('0xa')](_0xb47d('0xb'),attributes,{'tableName':_0xb47d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85bf=['bluebird','request-promise','define','util','../../config/logger','api','moment'];(function(_0x4bf83b,_0x495566){var _0x382713=function(_0x3c47fe){while(--_0x3c47fe){_0x4bf83b['push'](_0x4bf83b['shift']());}};_0x382713(++_0x495566);}(_0x85bf,0x1d1));var _0xf85b=function(_0x14f8ef,_0x1b1107){_0x14f8ef=_0x14f8ef-0x0;var _0x3b97f6=_0x85bf[_0x14f8ef];return _0x3b97f6;};'use strict';var _=require('lodash');var util=require(_0xf85b('0x0'));var logger=require(_0xf85b('0x1'))(_0xf85b('0x2'));var moment=require(_0xf85b('0x3'));var BPromise=require(_0xf85b('0x4'));var rp=require(_0xf85b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module['exports']=function(_0x1c8065,_0x1cc582){return _0x1c8065[_0xf85b('0x6')]('Integration',attributes,{'tableName':'integrations','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 b798a83..c8c2c6b 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x245e9c,_0x3846b6){var _0x423cb0=function(_0x5acac9){while(--_0x5acac9){_0x245e9c['push'](_0x245e9c['shift']());}};_0x423cb0(++_0x3846b6);}(_0x896e,0x1e9));var _0xe896=function(_0x3c70bc,_0x7f05ff){_0x3c70bc=_0x3c70bc-0x0;var _0x1137a3=_0x896e[_0x3c70bc];return _0x1137a3;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ 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(_0xb07400,_0x43fc5b){var _0xe2fd8b=function(_0x29b8c3){while(--_0x29b8c3){_0xb07400['push'](_0xb07400['shift']());}};_0xe2fd8b(++_0x43fc5b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11f926,_0x26af58){_0x11f926=_0x11f926-0x0;var _0x355bf6=_0x5f2f[_0x11f926];return _0x355bf6;};'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 dce73b1..49732cb 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(_0x5c75ea,_0x1b9094){var _0x5d74cb=function(_0x3c51a0){while(--_0x3c51a0){_0x5c75ea['push'](_0x5c75ea['shift']());}};_0x5d74cb(++_0x1b9094);}(_0xef0f,0x168));var _0xfef0=function(_0x780e9,_0x292723){_0x780e9=_0x780e9-0x0;var _0x4231f2=_0xef0f[_0x780e9];return _0x4231f2;};'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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x3e4739,_0x8cc336){var _0x36742d=function(_0x2a9b56){while(--_0x2a9b56){_0x3e4739['push'](_0x3e4739['shift']());}};_0x36742d(++_0x8cc336);}(_0x955f,0x1eb));var _0xf955=function(_0x3cecfe,_0x316a6e){_0x3cecfe=_0x3cecfe-0x0;var _0x1fba24=_0x955f[_0x3cecfe];return _0x1fba24;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 9382847..932d60d 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 _0x1e67=['STRING','INTEGER','DATE','BOOLEAN','TEXT','FAILED','exports'];(function(_0x382951,_0x5b333e){var _0x47bfa0=function(_0x49f446){while(--_0x49f446){_0x382951['push'](_0x382951['shift']());}};_0x47bfa0(++_0x5b333e);}(_0x1e67,0x195));var _0x71e6=function(_0x59ad69,_0x1714c1){_0x59ad69=_0x59ad69-0x0;var _0x5a0cf9=_0x1e67[_0x59ad69];return _0x5a0cf9;};'use strict';var Sequelize=require('sequelize');module[_0x71e6('0x0')]={'integration':{'type':Sequelize[_0x71e6('0x1')]},'eventChannel':{'type':Sequelize[_0x71e6('0x1')]},'exitStatus':{'type':Sequelize[_0x71e6('0x1')]},'ticketId':{'type':Sequelize[_0x71e6('0x1')]},'integrationId':{'type':Sequelize[_0x71e6('0x2')]},'contacts':{'type':Sequelize[_0x71e6('0x1')]},'uniqueid':{'type':Sequelize[_0x71e6('0x1')]},'calleridnum':{'type':Sequelize[_0x71e6('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x71e6('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x71e6('0x1')]},'agentcalledAt':{'type':Sequelize[_0x71e6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x71e6('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x71e6('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x71e6('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x71e6('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x71e6('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x71e6('0x3')]},'agentdump':{'type':Sequelize[_0x71e6('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x71e6('0x3')]},'lastevent':{'type':Sequelize[_0x71e6('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x71e6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x71e6('0x1')]},'connectedlinenum':{'type':Sequelize[_0x71e6('0x1')]},'connectedlinename':{'type':Sequelize[_0x71e6('0x1')]},'language':{'type':Sequelize[_0x71e6('0x1')]},'accountcode':{'type':Sequelize[_0x71e6('0x1')]},'context':{'type':Sequelize[_0x71e6('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x71e6('0x1')]},'destchannel':{'type':Sequelize[_0x71e6('0x1')]},'destchannelstate':{'type':Sequelize[_0x71e6('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x71e6('0x1')]},'destcalleridnum':{'type':Sequelize[_0x71e6('0x1')]},'destcalleridname':{'type':Sequelize[_0x71e6('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x71e6('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x71e6('0x1')]},'destaccountcode':{'type':Sequelize[_0x71e6('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x71e6('0x1')]},'destpriority':{'type':Sequelize[_0x71e6('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x71e6('0x1')]},'inReplyTo':{'type':Sequelize[_0x71e6('0x1')]},'subject':{'type':Sequelize[_0x71e6('0x1')]},'from':{'type':Sequelize[_0x71e6('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x71e6('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x71e6('0x5')]},'text':{'type':Sequelize[_0x71e6('0x5')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING','RECEIVED',_0x71e6('0x6'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x71e6('0x1')]},'projectId':{'type':Sequelize[_0x71e6('0x2')]}}; \ No newline at end of file +var _0x072e=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x2784fe,_0xae664f){var _0x415be2=function(_0xf6802f){while(--_0xf6802f){_0x2784fe['push'](_0x2784fe['shift']());}};_0x415be2(++_0xae664f);}(_0x072e,0x11d));var _0xe072=function(_0x53fde8,_0x58037f){_0x53fde8=_0x53fde8-0x0;var _0x18decb=_0x072e[_0x53fde8];return _0x18decb;};'use strict';var Sequelize=require(_0xe072('0x0'));module['exports']={'integration':{'type':Sequelize[_0xe072('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xe072('0x1')]},'integrationId':{'type':Sequelize[_0xe072('0x2')]},'contacts':{'type':Sequelize[_0xe072('0x1')]},'uniqueid':{'type':Sequelize[_0xe072('0x1')]},'calleridnum':{'type':Sequelize[_0xe072('0x1')]},'calleridname':{'type':Sequelize[_0xe072('0x1')]},'queue':{'type':Sequelize[_0xe072('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe072('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe072('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe072('0x3')]},'holdtime':{'type':Sequelize[_0xe072('0x2')]},'agentcomplete':{'type':Sequelize[_0xe072('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe072('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe072('0x2')]},'reason':{'type':Sequelize[_0xe072('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe072('0x3')]},'agentdump':{'type':Sequelize[_0xe072('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe072('0x3')]},'lastevent':{'type':Sequelize[_0xe072('0x1')]},'channel':{'type':Sequelize[_0xe072('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe072('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe072('0x1')]},'connectedlinename':{'type':Sequelize[_0xe072('0x1')]},'language':{'type':Sequelize[_0xe072('0x1')]},'accountcode':{'type':Sequelize[_0xe072('0x1')]},'context':{'type':Sequelize[_0xe072('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe072('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe072('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe072('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe072('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe072('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe072('0x1')]},'destcontext':{'type':Sequelize[_0xe072('0x1')]},'destexten':{'type':Sequelize[_0xe072('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xe072('0x1')]},'inReplyTo':{'type':Sequelize[_0xe072('0x1')]},'subject':{'type':Sequelize[_0xe072('0x1')]},'from':{'type':Sequelize[_0xe072('0x1')]},'to':{'type':Sequelize[_0xe072('0x1')]},'cc':{'type':Sequelize[_0xe072('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xe072('0x5')]},'text':{'type':Sequelize[_0xe072('0x5')]},'status':{'type':Sequelize[_0xe072('0x6')](_0xe072('0x7'),_0xe072('0x8'),_0xe072('0x9'),_0xe072('0xa'))},'url':{'type':Sequelize[_0xe072('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xe072('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index eca27fe..78866da 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 _0xdaf8=['params','merge','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xdaf8,0xdc));var _0x8daf=function(_0x2102d2,_0x27eebf){_0x2102d2=_0x2102d2-0x0;var _0x5226a0=_0xdaf8[_0x2102d2];return _0x5226a0;};'use strict';var emlformat=require(_0x8daf('0x0'));var rimraf=require(_0x8daf('0x1'));var zipdir=require(_0x8daf('0x2'));var jsonpatch=require(_0x8daf('0x3'));var rp=require(_0x8daf('0x4'));var moment=require('moment');var BPromise=require(_0x8daf('0x5'));var Mustache=require(_0x8daf('0x6'));var util=require(_0x8daf('0x7'));var path=require(_0x8daf('0x8'));var sox=require(_0x8daf('0x9'));var csv=require('to-csv');var ejs=require(_0x8daf('0xa'));var fs=require('fs');var fs_extra=require(_0x8daf('0xb'));var _=require('lodash');var squel=require(_0x8daf('0xc'));var crypto=require('crypto');var jsforce=require(_0x8daf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8daf('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8daf('0xf'));var hardwareService=require(_0x8daf('0x10'));var logger=require(_0x8daf('0x11'))(_0x8daf('0x12'));var utils=require(_0x8daf('0x13'));var config=require(_0x8daf('0x14'));var licenseUtil=require(_0x8daf('0x15'));var db=require(_0x8daf('0x16'))['db'];function respondWithStatusCode(_0x563784,_0x5d7f17){_0x5d7f17=_0x5d7f17||0xcc;return function(_0x9b2b49){if(_0x9b2b49){return _0x563784[_0x8daf('0x17')](_0x5d7f17);}return _0x563784[_0x8daf('0x18')](_0x5d7f17)[_0x8daf('0x19')]();};}function respondWithResult(_0x54a610,_0x207c9b){_0x207c9b=_0x207c9b||0xc8;return function(_0x4c2667){if(_0x4c2667){return _0x54a610[_0x8daf('0x18')](_0x207c9b)[_0x8daf('0x1a')](_0x4c2667);}};}function respondWithFilteredResult(_0x4f75c2,_0x577976){return function(_0x5f11cd){if(_0x5f11cd){var _0x30bdd4=typeof _0x577976[_0x8daf('0x1b')]==='undefined'&&typeof _0x577976['limit']==='undefined';var _0x46618e=_0x5f11cd[_0x8daf('0x1c')];var _0x345956=_0x30bdd4?0x0:_0x577976[_0x8daf('0x1b')];var _0x226c44=_0x30bdd4?_0x5f11cd[_0x8daf('0x1c')]:_0x577976['offset']+_0x577976[_0x8daf('0x1d')];var _0x259ab1;if(_0x226c44>=_0x46618e){_0x226c44=_0x46618e;_0x259ab1=0xc8;}else{_0x259ab1=0xce;}_0x4f75c2[_0x8daf('0x18')](_0x259ab1);return _0x4f75c2['set']('Content-Range',_0x345956+'-'+_0x226c44+'/'+_0x46618e)[_0x8daf('0x1a')](_0x5f11cd);}return null;};}function patchUpdates(_0x9e14ea){return function(_0x5cefb3){try{jsonpatch['apply'](_0x5cefb3,_0x9e14ea,!![]);}catch(_0x254b78){return BPromise['reject'](_0x254b78);}return _0x5cefb3[_0x8daf('0x1e')]();};}function saveUpdates(_0x677e97,_0x268e3c){return function(_0x3c2cd7){if(_0x3c2cd7){return _0x3c2cd7['update'](_0x677e97)[_0x8daf('0x1f')](function(_0x26a709){return _0x26a709;});}return null;};}function removeEntity(_0x22f186,_0x535f0e){return function(_0x46a2e8){if(_0x46a2e8){return _0x46a2e8[_0x8daf('0x20')]()[_0x8daf('0x1f')](function(){_0x22f186[_0x8daf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5498,_0x25feb5){return function(_0x2c32d9){if(!_0x2c32d9){_0x2a5498[_0x8daf('0x17')](0x194);}return _0x2c32d9;};}function handleError(_0x579bf7,_0x5e1b7a){_0x5e1b7a=_0x5e1b7a||0x1f4;return function(_0xe9d090){logger[_0x8daf('0x21')](_0xe9d090[_0x8daf('0x22')]);if(_0xe9d090[_0x8daf('0x23')]){delete _0xe9d090[_0x8daf('0x23')];}_0x579bf7['status'](_0x5e1b7a)[_0x8daf('0x24')](_0xe9d090);};}exports[_0x8daf('0x25')]=function(_0x82ebf6,_0x246c08){var _0x313e3f={},_0x561ccc={},_0x1d8b77={'count':0x0,'rows':[]};var _0xfd28da=_[_0x8daf('0x26')](db[_0x8daf('0x27')][_0x8daf('0x28')],function(_0x11c7ee){return{'name':_0x11c7ee[_0x8daf('0x29')],'type':_0x11c7ee['type'][_0x8daf('0x2a')]};});_0x561ccc[_0x8daf('0x2b')]=_[_0x8daf('0x26')](_0xfd28da,_0x8daf('0x23'));_0x561ccc[_0x8daf('0x2c')]=_[_0x8daf('0x2d')](_0x82ebf6[_0x8daf('0x2c')]);_0x561ccc['filters']=_[_0x8daf('0x2e')](_0x561ccc['model'],_0x561ccc['query']);_0x313e3f[_0x8daf('0x2f')]=_[_0x8daf('0x2e')](_0x561ccc[_0x8daf('0x2b')],qs[_0x8daf('0x30')](_0x82ebf6['query'][_0x8daf('0x30')]));_0x313e3f[_0x8daf('0x2f')]=_0x313e3f['attributes'][_0x8daf('0x31')]?_0x313e3f['attributes']:_0x561ccc[_0x8daf('0x2b')];if(!_0x82ebf6['query'][_0x8daf('0x32')]('nolimit')){_0x313e3f[_0x8daf('0x1d')]=qs['limit'](_0x82ebf6[_0x8daf('0x2c')]['limit']);_0x313e3f['offset']=qs[_0x8daf('0x1b')](_0x82ebf6[_0x8daf('0x2c')][_0x8daf('0x1b')]);}_0x313e3f[_0x8daf('0x33')]=qs['sort'](_0x82ebf6[_0x8daf('0x2c')][_0x8daf('0x34')]);_0x313e3f['where']=qs[_0x8daf('0x35')](_[_0x8daf('0x36')](_0x82ebf6['query'],_0x561ccc[_0x8daf('0x35')]),_0xfd28da);if(_0x82ebf6['query'][_0x8daf('0x37')]){_0x313e3f[_0x8daf('0x38')]=_['merge'](_0x313e3f[_0x8daf('0x38')],{'$or':_[_0x8daf('0x26')](_0xfd28da,function(_0xf26427){if(_0xf26427['type']!==_0x8daf('0x39')){var _0xf62295={};_0xf62295[_0xf26427[_0x8daf('0x23')]]={'$like':'%'+_0x82ebf6[_0x8daf('0x2c')][_0x8daf('0x37')]+'%'};return _0xf62295;}})});}_0x313e3f=_['merge']({},_0x313e3f,_0x82ebf6[_0x8daf('0x3a')]);var _0x466ded={'where':_0x313e3f[_0x8daf('0x38')]};return db[_0x8daf('0x27')][_0x8daf('0x1c')](_0x466ded)[_0x8daf('0x1f')](function(_0x50547d){_0x1d8b77[_0x8daf('0x1c')]=_0x50547d;if(_0x82ebf6['query']['includeAll']){_0x313e3f[_0x8daf('0x3b')]=[{'all':!![]}];}return db[_0x8daf('0x27')][_0x8daf('0x3c')](_0x313e3f);})[_0x8daf('0x1f')](function(_0x8e549b){_0x1d8b77[_0x8daf('0x3d')]=_0x8e549b;return _0x1d8b77;})['then'](respondWithFilteredResult(_0x246c08,_0x313e3f))[_0x8daf('0x3e')](handleError(_0x246c08,null));};exports[_0x8daf('0x3f')]=function(_0x324ade,_0x8fb428){var _0x5262b6={'raw':![],'where':{'id':_0x324ade[_0x8daf('0x40')]['id']}},_0x1d202f={};_0x1d202f[_0x8daf('0x2b')]=_[_0x8daf('0x2d')](db['IntegrationReport'][_0x8daf('0x28')]);_0x1d202f[_0x8daf('0x2c')]=_[_0x8daf('0x2d')](_0x324ade[_0x8daf('0x2c')]);_0x1d202f[_0x8daf('0x35')]=_[_0x8daf('0x2e')](_0x1d202f[_0x8daf('0x2b')],_0x1d202f['query']);_0x5262b6[_0x8daf('0x2f')]=_['intersection'](_0x1d202f[_0x8daf('0x2b')],qs[_0x8daf('0x30')](_0x324ade[_0x8daf('0x2c')][_0x8daf('0x30')]));_0x5262b6['attributes']=_0x5262b6[_0x8daf('0x2f')][_0x8daf('0x31')]?_0x5262b6['attributes']:_0x1d202f[_0x8daf('0x2b')];if(_0x324ade['query']['includeAll']){_0x5262b6[_0x8daf('0x3b')]=[{'all':!![]}];}_0x5262b6=_[_0x8daf('0x41')]({},_0x5262b6,_0x324ade['options']);return db['IntegrationReport']['find'](_0x5262b6)['then'](handleEntityNotFound(_0x8fb428,null))[_0x8daf('0x1f')](respondWithResult(_0x8fb428,null))[_0x8daf('0x3e')](handleError(_0x8fb428,null));};exports[_0x8daf('0x42')]=function(_0x367cb4,_0x15d736){return db[_0x8daf('0x27')][_0x8daf('0x42')](_0x367cb4['body'],{})[_0x8daf('0x1f')](respondWithResult(_0x15d736,0xc9))[_0x8daf('0x3e')](handleError(_0x15d736,null));};exports[_0x8daf('0x43')]=function(_0x18da47,_0x23cdcc){if(_0x18da47[_0x8daf('0x44')]['id']){delete _0x18da47[_0x8daf('0x44')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x18da47['params']['id']}})[_0x8daf('0x1f')](handleEntityNotFound(_0x23cdcc,null))[_0x8daf('0x1f')](saveUpdates(_0x18da47[_0x8daf('0x44')],null))[_0x8daf('0x1f')](respondWithResult(_0x23cdcc,null))['catch'](handleError(_0x23cdcc,null));};exports[_0x8daf('0x20')]=function(_0x4dc7a3,_0x37e581){return db[_0x8daf('0x27')][_0x8daf('0x45')]({'where':{'id':_0x4dc7a3[_0x8daf('0x40')]['id']}})[_0x8daf('0x1f')](handleEntityNotFound(_0x37e581,null))[_0x8daf('0x1f')](removeEntity(_0x37e581,null))[_0x8daf('0x3e')](handleError(_0x37e581,null));};exports[_0x8daf('0x46')]=function(_0x46433d,_0x567c33){return db[_0x8daf('0x27')]['describe']()['then'](respondWithResult(_0x567c33,null))[_0x8daf('0x3e')](handleError(_0x567c33,null));}; \ No newline at end of file +var _0x3213=['include','findAll','rows','catch','show','params','fields','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','undefined','offset','count','limit','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x5225c4,_0x488ac7){var _0x4a845f=function(_0x2e85ed){while(--_0x2e85ed){_0x5225c4['push'](_0x5225c4['shift']());}};_0x4a845f(++_0x488ac7);}(_0x3213,0x182));var _0x3321=function(_0x144af5,_0x1e78e8){_0x144af5=_0x144af5-0x0;var _0x3bbcb8=_0x3213[_0x144af5];return _0x3bbcb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3321('0x0'));var zipdir=require(_0x3321('0x1'));var jsonpatch=require(_0x3321('0x2'));var rp=require(_0x3321('0x3'));var moment=require(_0x3321('0x4'));var BPromise=require(_0x3321('0x5'));var Mustache=require(_0x3321('0x6'));var util=require(_0x3321('0x7'));var path=require(_0x3321('0x8'));var sox=require(_0x3321('0x9'));var csv=require(_0x3321('0xa'));var ejs=require(_0x3321('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3321('0xc'));var crypto=require(_0x3321('0xd'));var jsforce=require(_0x3321('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3321('0xf'));var Papa=require(_0x3321('0x10'));var Redis=require(_0x3321('0x11'));var authService=require(_0x3321('0x12'));var qs=require(_0x3321('0x13'));var as=require(_0x3321('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3321('0x15'))(_0x3321('0x16'));var utils=require(_0x3321('0x17'));var config=require(_0x3321('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13f819,_0x2c36fd){_0x2c36fd=_0x2c36fd||0xcc;return function(_0x55d3eb){if(_0x55d3eb){return _0x13f819[_0x3321('0x19')](_0x2c36fd);}return _0x13f819['status'](_0x2c36fd)[_0x3321('0x1a')]();};}function respondWithResult(_0x4fcc9c,_0x4e6c94){_0x4e6c94=_0x4e6c94||0xc8;return function(_0x344255){if(_0x344255){return _0x4fcc9c['status'](_0x4e6c94)[_0x3321('0x1b')](_0x344255);}};}function respondWithFilteredResult(_0x4f5233,_0x4c9ae2){return function(_0x10e40e){if(_0x10e40e){var _0x15d9c1=typeof _0x4c9ae2['offset']===_0x3321('0x1c')&&typeof _0x4c9ae2['limit']===_0x3321('0x1c');var _0x6635b4=_0x10e40e['count'];var _0x3adefc=_0x15d9c1?0x0:_0x4c9ae2[_0x3321('0x1d')];var _0x3c8870=_0x15d9c1?_0x10e40e[_0x3321('0x1e')]:_0x4c9ae2[_0x3321('0x1d')]+_0x4c9ae2[_0x3321('0x1f')];var _0x3965b8;if(_0x3c8870>=_0x6635b4){_0x3c8870=_0x6635b4;_0x3965b8=0xc8;}else{_0x3965b8=0xce;}_0x4f5233[_0x3321('0x20')](_0x3965b8);return _0x4f5233[_0x3321('0x21')](_0x3321('0x22'),_0x3adefc+'-'+_0x3c8870+'/'+_0x6635b4)[_0x3321('0x1b')](_0x10e40e);}return null;};}function patchUpdates(_0x33da30){return function(_0x21b4d6){try{jsonpatch['apply'](_0x21b4d6,_0x33da30,!![]);}catch(_0x5af3ea){return BPromise[_0x3321('0x23')](_0x5af3ea);}return _0x21b4d6[_0x3321('0x24')]();};}function saveUpdates(_0x3ae963,_0x627b04){return function(_0x44c65a){if(_0x44c65a){return _0x44c65a[_0x3321('0x25')](_0x3ae963)[_0x3321('0x26')](function(_0x3b6ebc){return _0x3b6ebc;});}return null;};}function removeEntity(_0x5d3287,_0x21a34c){return function(_0x1dcdcf){if(_0x1dcdcf){return _0x1dcdcf[_0x3321('0x27')]()[_0x3321('0x26')](function(){_0x5d3287[_0x3321('0x20')](0xcc)[_0x3321('0x1a')]();});}};}function handleEntityNotFound(_0x187e83,_0x4b76e7){return function(_0x160d10){if(!_0x160d10){_0x187e83[_0x3321('0x19')](0x194);}return _0x160d10;};}function handleError(_0x36e88a,_0x3697a1){_0x3697a1=_0x3697a1||0x1f4;return function(_0x307840){logger[_0x3321('0x28')](_0x307840[_0x3321('0x29')]);if(_0x307840['name']){delete _0x307840[_0x3321('0x2a')];}_0x36e88a[_0x3321('0x20')](_0x3697a1)['send'](_0x307840);};}exports['index']=function(_0x233b74,_0x5eda36){var _0x3dbb59={},_0x1b0612={},_0x4186cd={'count':0x0,'rows':[]};var _0x23bd74=_[_0x3321('0x2b')](db[_0x3321('0x2c')][_0x3321('0x2d')],function(_0x293c2f){return{'name':_0x293c2f[_0x3321('0x2e')],'type':_0x293c2f[_0x3321('0x2f')]['key']};});_0x1b0612[_0x3321('0x30')]=_['map'](_0x23bd74,'name');_0x1b0612[_0x3321('0x31')]=_[_0x3321('0x32')](_0x233b74[_0x3321('0x31')]);_0x1b0612[_0x3321('0x33')]=_[_0x3321('0x34')](_0x1b0612[_0x3321('0x30')],_0x1b0612[_0x3321('0x31')]);_0x3dbb59[_0x3321('0x35')]=_['intersection'](_0x1b0612[_0x3321('0x30')],qs['fields'](_0x233b74[_0x3321('0x31')]['fields']));_0x3dbb59[_0x3321('0x35')]=_0x3dbb59['attributes'][_0x3321('0x36')]?_0x3dbb59[_0x3321('0x35')]:_0x1b0612[_0x3321('0x30')];if(!_0x233b74['query']['hasOwnProperty']('nolimit')){_0x3dbb59[_0x3321('0x1f')]=qs[_0x3321('0x1f')](_0x233b74[_0x3321('0x31')]['limit']);_0x3dbb59[_0x3321('0x1d')]=qs[_0x3321('0x1d')](_0x233b74['query'][_0x3321('0x1d')]);}_0x3dbb59[_0x3321('0x37')]=qs[_0x3321('0x38')](_0x233b74['query'][_0x3321('0x38')]);_0x3dbb59['where']=qs[_0x3321('0x33')](_[_0x3321('0x39')](_0x233b74[_0x3321('0x31')],_0x1b0612[_0x3321('0x33')]),_0x23bd74);if(_0x233b74['query']['filter']){_0x3dbb59[_0x3321('0x3a')]=_[_0x3321('0x3b')](_0x3dbb59[_0x3321('0x3a')],{'$or':_[_0x3321('0x2b')](_0x23bd74,function(_0x255e72){if(_0x255e72[_0x3321('0x2f')]!==_0x3321('0x3c')){var _0x525904={};_0x525904[_0x255e72[_0x3321('0x2a')]]={'$like':'%'+_0x233b74[_0x3321('0x31')][_0x3321('0x3d')]+'%'};return _0x525904;}})});}_0x3dbb59=_[_0x3321('0x3b')]({},_0x3dbb59,_0x233b74[_0x3321('0x3e')]);var _0xcfbeb={'where':_0x3dbb59[_0x3321('0x3a')]};return db[_0x3321('0x2c')]['count'](_0xcfbeb)[_0x3321('0x26')](function(_0x4fd655){_0x4186cd[_0x3321('0x1e')]=_0x4fd655;if(_0x233b74[_0x3321('0x31')][_0x3321('0x3f')]){_0x3dbb59[_0x3321('0x40')]=[{'all':!![]}];}return db[_0x3321('0x2c')][_0x3321('0x41')](_0x3dbb59);})[_0x3321('0x26')](function(_0x3fea75){_0x4186cd[_0x3321('0x42')]=_0x3fea75;return _0x4186cd;})[_0x3321('0x26')](respondWithFilteredResult(_0x5eda36,_0x3dbb59))[_0x3321('0x43')](handleError(_0x5eda36,null));};exports[_0x3321('0x44')]=function(_0x2d0483,_0x4fc968){var _0x2154a5={'raw':![],'where':{'id':_0x2d0483[_0x3321('0x45')]['id']}},_0x5d261a={};_0x5d261a[_0x3321('0x30')]=_[_0x3321('0x32')](db[_0x3321('0x2c')]['rawAttributes']);_0x5d261a[_0x3321('0x31')]=_['keys'](_0x2d0483['query']);_0x5d261a[_0x3321('0x33')]=_['intersection'](_0x5d261a[_0x3321('0x30')],_0x5d261a[_0x3321('0x31')]);_0x2154a5['attributes']=_[_0x3321('0x34')](_0x5d261a['model'],qs[_0x3321('0x46')](_0x2d0483[_0x3321('0x31')][_0x3321('0x46')]));_0x2154a5[_0x3321('0x35')]=_0x2154a5[_0x3321('0x35')][_0x3321('0x36')]?_0x2154a5['attributes']:_0x5d261a[_0x3321('0x30')];if(_0x2d0483[_0x3321('0x31')]['includeAll']){_0x2154a5['include']=[{'all':!![]}];}_0x2154a5=_[_0x3321('0x3b')]({},_0x2154a5,_0x2d0483['options']);return db[_0x3321('0x2c')][_0x3321('0x47')](_0x2154a5)[_0x3321('0x26')](handleEntityNotFound(_0x4fc968,null))[_0x3321('0x26')](respondWithResult(_0x4fc968,null))['catch'](handleError(_0x4fc968,null));};exports[_0x3321('0x48')]=function(_0x1d551a,_0x1986be){return db['IntegrationReport']['create'](_0x1d551a['body'],{})[_0x3321('0x26')](respondWithResult(_0x1986be,0xc9))[_0x3321('0x43')](handleError(_0x1986be,null));};exports[_0x3321('0x25')]=function(_0x116d52,_0x2e8318){if(_0x116d52[_0x3321('0x49')]['id']){delete _0x116d52[_0x3321('0x49')]['id'];}return db['IntegrationReport'][_0x3321('0x47')]({'where':{'id':_0x116d52['params']['id']}})[_0x3321('0x26')](handleEntityNotFound(_0x2e8318,null))['then'](saveUpdates(_0x116d52[_0x3321('0x49')],null))[_0x3321('0x26')](respondWithResult(_0x2e8318,null))[_0x3321('0x43')](handleError(_0x2e8318,null));};exports[_0x3321('0x27')]=function(_0x3474d9,_0x456363){return db[_0x3321('0x2c')]['find']({'where':{'id':_0x3474d9[_0x3321('0x45')]['id']}})[_0x3321('0x26')](handleEntityNotFound(_0x456363,null))['then'](removeEntity(_0x456363,null))[_0x3321('0x43')](handleError(_0x456363,null));};exports[_0x3321('0x4a')]=function(_0x480585,_0x2a358a){return db['IntegrationReport'][_0x3321('0x4a')]()[_0x3321('0x26')](respondWithResult(_0x2a358a,null))[_0x3321('0x43')](handleError(_0x2a358a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index fd7c1ae..6ced90d 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 _0x4102=['IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x2496f5,_0x5489fa){var _0x49f194=function(_0x5545f1){while(--_0x5545f1){_0x2496f5['push'](_0x2496f5['shift']());}};_0x49f194(++_0x5489fa);}(_0x4102,0x1af));var _0x2410=function(_0x32da4c,_0x968f9e){_0x32da4c=_0x32da4c-0x0;var _0x2ee92c=_0x4102[_0x32da4c];return _0x2ee92c;};'use strict';var _=require(_0x2410('0x0'));var util=require(_0x2410('0x1'));var logger=require(_0x2410('0x2'))(_0x2410('0x3'));var moment=require('moment');var BPromise=require(_0x2410('0x4'));var rp=require(_0x2410('0x5'));var fs=require('fs');var path=require(_0x2410('0x6'));var rimraf=require('rimraf');var config=require(_0x2410('0x7'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x245e79,_0x8447d6){return _0x245e79[_0x2410('0x8')](_0x2410('0x9'),attributes,{'tableName':_0x2410('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf074=['util','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf074,0x185));var _0x4f07=function(_0x374f83,_0x21fb70){_0x374f83=_0x374f83-0x0;var _0x145058=_0xf074[_0x374f83];return _0x145058;};'use strict';var _=require(_0x4f07('0x0'));var util=require(_0x4f07('0x1'));var logger=require('../../config/logger')(_0x4f07('0x2'));var moment=require(_0x4f07('0x3'));var BPromise=require(_0x4f07('0x4'));var rp=require(_0x4f07('0x5'));var fs=require('fs');var path=require(_0x4f07('0x6'));var rimraf=require(_0x4f07('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f07('0x8'));module[_0x4f07('0x9')]=function(_0x4fa269,_0x17d005){return _0x4fa269[_0x4f07('0xa')](_0x4f07('0xb'),attributes,{'tableName':_0x4f07('0xc'),'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 e204c7f..bd24f32 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3e655a,_0x1a2097){var _0x40a6c5=function(_0x53044d){while(--_0x53044d){_0x3e655a['push'](_0x3e655a['shift']());}};_0x40a6c5(++_0x1a2097);}(_0x2ef3,0xba));var _0x32ef=function(_0xc7c02a,_0x43812f){_0xc7c02a=_0xc7c02a-0x0;var _0x50aa96=_0x2ef3[_0xc7c02a];return _0x50aa96;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xf494,0x1c6));var _0x4f49=function(_0x5b79dc,_0x23a5ad){_0x5b79dc=_0x5b79dc-0x0;var _0x3d8485=_0xf494[_0x5b79dc];return _0x3d8485;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a245f25..b33edf5 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 _0xa786=['update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x5e1396,_0x34b52e){var _0x32e3e0=function(_0x33bc3f){while(--_0x33bc3f){_0x5e1396['push'](_0x5e1396['shift']());}};_0x32e3e0(++_0x34b52e);}(_0xa786,0x71));var _0x6a78=function(_0x18d313,_0x406974){_0x18d313=_0x18d313-0x0;var _0x169f1e=_0xa786[_0x18d313];return _0x169f1e;};'use strict';var multer=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var path=require(_0x6a78('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a78('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6a78('0x4'));var interaction=require(_0x6a78('0x5'));var config=require(_0x6a78('0x6'));var controller=require(_0x6a78('0x7'));router[_0x6a78('0x8')]('/',auth[_0x6a78('0x9')](),controller[_0x6a78('0xa')]);router['get'](_0x6a78('0xb'),auth[_0x6a78('0x9')](),controller[_0x6a78('0xc')]);router[_0x6a78('0x8')](_0x6a78('0xd'),auth[_0x6a78('0x9')](),controller[_0x6a78('0xe')]);router[_0x6a78('0xf')]('/',auth[_0x6a78('0x9')](),controller['create']);router[_0x6a78('0xf')](_0x6a78('0xd'),auth[_0x6a78('0x9')](),controller['addInterval']);router[_0x6a78('0xf')](_0x6a78('0x10'),auth[_0x6a78('0x9')](),controller[_0x6a78('0x11')]);router[_0x6a78('0x12')]('/:id',auth[_0x6a78('0x9')](),controller[_0x6a78('0x13')]);router[_0x6a78('0x14')]('/:id',auth[_0x6a78('0x9')](),controller[_0x6a78('0x15')]);module['exports']=router; \ No newline at end of file +var _0x812d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','delete','destroy','exports'];(function(_0x2aa6cf,_0x46b0b4){var _0x489483=function(_0x177549){while(--_0x177549){_0x2aa6cf['push'](_0x2aa6cf['shift']());}};_0x489483(++_0x46b0b4);}(_0x812d,0x6e));var _0xd812=function(_0x458eb4,_0x45a484){_0x458eb4=_0x458eb4-0x0;var _0xb08454=_0x812d[_0x458eb4];return _0xb08454;};'use strict';var multer=require('multer');var util=require(_0xd812('0x0'));var path=require(_0xd812('0x1'));var timeout=require(_0xd812('0x2'));var express=require(_0xd812('0x3'));var router=express[_0xd812('0x4')]();var fs_extra=require(_0xd812('0x5'));var auth=require(_0xd812('0x6'));var interaction=require(_0xd812('0x7'));var config=require('../../config/environment');var controller=require(_0xd812('0x8'));router[_0xd812('0x9')]('/',auth[_0xd812('0xa')](),controller['index']);router['get'](_0xd812('0xb'),auth[_0xd812('0xa')](),controller['show']);router[_0xd812('0x9')](_0xd812('0xc'),auth['isAuthenticated'](),controller[_0xd812('0xd')]);router[_0xd812('0xe')]('/',auth[_0xd812('0xa')](),controller['create']);router[_0xd812('0xe')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xd812('0xf')]);router['post']('/:id/sub_intervals/create_many',auth[_0xd812('0xa')](),controller[_0xd812('0x10')]);router[_0xd812('0x11')]('/:id',auth[_0xd812('0xa')](),controller[_0xd812('0x12')]);router[_0xd812('0x13')](_0xd812('0xb'),auth[_0xd812('0xa')](),controller[_0xd812('0x14')]);module[_0xd812('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5a7588a..69817f9 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 _0xf266=['exports','STRING','sequelize'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xf266,0x12b));var _0x6f26=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xf266[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x6f26('0x0'));module[_0x6f26('0x1')]={'name':{'type':Sequelize[_0x6f26('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8ad4=['STRING','sequelize','exports'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x8ad4,0x19c));var _0x48ad=function(_0x1e7384,_0x1f0239){_0x1e7384=_0x1e7384-0x0;var _0x3d83a8=_0x8ad4[_0x1e7384];return _0x3d83a8;};'use strict';var Sequelize=require(_0x48ad('0x0'));module[_0x48ad('0x1')]={'name':{'type':Sequelize[_0x48ad('0x2')]},'description':{'type':Sequelize[_0x48ad('0x2')]},'interval':{'type':Sequelize[_0x48ad('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 b251b74..9f601c7 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 _0x171b=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Interval','includeAll','include','rows','catch','params','length','options','create'];(function(_0x4c9af8,_0x38679b){var _0x4b39c4=function(_0x17c8dd){while(--_0x17c8dd){_0x4c9af8['push'](_0x4c9af8['shift']());}};_0x4b39c4(++_0x38679b);}(_0x171b,0x1da));var _0xb171=function(_0x489c76,_0x51944c){_0x489c76=_0x489c76-0x0;var _0x420e6d=_0x171b[_0x489c76];return _0x420e6d;};'use strict';var emlformat=require(_0xb171('0x0'));var rimraf=require(_0xb171('0x1'));var zipdir=require(_0xb171('0x2'));var jsonpatch=require(_0xb171('0x3'));var rp=require(_0xb171('0x4'));var moment=require(_0xb171('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb171('0x6'));var util=require(_0xb171('0x7'));var path=require('path');var sox=require(_0xb171('0x8'));var csv=require(_0xb171('0x9'));var ejs=require(_0xb171('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb171('0xb'));var squel=require(_0xb171('0xc'));var crypto=require(_0xb171('0xd'));var jsforce=require(_0xb171('0xe'));var deskjs=require(_0xb171('0xf'));var toCsv=require(_0xb171('0x9'));var querystring=require(_0xb171('0x10'));var Papa=require(_0xb171('0x11'));var Redis=require(_0xb171('0x12'));var authService=require(_0xb171('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb171('0x14'));var hardwareService=require(_0xb171('0x15'));var logger=require(_0xb171('0x16'))('api');var utils=require(_0xb171('0x17'));var config=require(_0xb171('0x18'));var licenseUtil=require(_0xb171('0x19'));var db=require('../../mysqldb')['db'];var extensions=require(_0xb171('0x1a'));function respondWithStatusCode(_0x5bad74,_0x219c00){_0x219c00=_0x219c00||0xcc;return function(_0xfa6154){if(_0xfa6154){return _0x5bad74[_0xb171('0x1b')](_0x219c00);}return _0x5bad74[_0xb171('0x1c')](_0x219c00)[_0xb171('0x1d')]();};}function respondWithResult(_0xd1e395,_0x4b5ef4){_0x4b5ef4=_0x4b5ef4||0xc8;return function(_0x2473e2){if(_0x2473e2){return _0xd1e395[_0xb171('0x1c')](_0x4b5ef4)[_0xb171('0x1e')](_0x2473e2);}};}function respondWithFilteredResult(_0x2fbd8f,_0x937d99){return function(_0x2ad9a2){if(_0x2ad9a2){var _0x885aa4=typeof _0x937d99[_0xb171('0x1f')]===_0xb171('0x20')&&typeof _0x937d99[_0xb171('0x21')]===_0xb171('0x20');var _0x453e3d=_0x2ad9a2[_0xb171('0x22')];var _0x24db0d=_0x885aa4?0x0:_0x937d99['offset'];var _0x535cb0=_0x885aa4?_0x2ad9a2[_0xb171('0x22')]:_0x937d99[_0xb171('0x1f')]+_0x937d99[_0xb171('0x21')];var _0x104c03;if(_0x535cb0>=_0x453e3d){_0x535cb0=_0x453e3d;_0x104c03=0xc8;}else{_0x104c03=0xce;}_0x2fbd8f[_0xb171('0x1c')](_0x104c03);return _0x2fbd8f[_0xb171('0x23')](_0xb171('0x24'),_0x24db0d+'-'+_0x535cb0+'/'+_0x453e3d)[_0xb171('0x1e')](_0x2ad9a2);}return null;};}function patchUpdates(_0xbbc60){return function(_0x1fdb7b){try{jsonpatch[_0xb171('0x25')](_0x1fdb7b,_0xbbc60,!![]);}catch(_0x138787){return BPromise['reject'](_0x138787);}return _0x1fdb7b[_0xb171('0x26')]();};}function saveUpdates(_0x55fc61,_0xd4340a){return function(_0x529029){if(_0x529029){return _0x529029[_0xb171('0x27')](_0x55fc61)[_0xb171('0x28')](function(_0x4d5cd5){return _0x4d5cd5;});}return null;};}function removeEntity(_0x5cf2f4,_0x54c31d){return function(_0x5b7e74){if(_0x5b7e74){return _0x5b7e74[_0xb171('0x29')]()[_0xb171('0x28')](function(){var _0x13823c=_0x5b7e74[_0xb171('0x2a')]({'plain':!![]});var _0xddd9e4=_0xb171('0x2b');return db[_0xb171('0x2c')][_0xb171('0x29')]({'where':{'type':_0xddd9e4,'resourceId':_0x13823c['id']}})['then'](function(){return _0x5b7e74;});})[_0xb171('0x28')](function(){_0x5cf2f4[_0xb171('0x1c')](0xcc)[_0xb171('0x1d')]();});}};}function handleEntityNotFound(_0x2844b5,_0x421b15){return function(_0x155074){if(!_0x155074){_0x2844b5[_0xb171('0x1b')](0x194);}return _0x155074;};}function handleError(_0x1736c8,_0x1538a9){_0x1538a9=_0x1538a9||0x1f4;return function(_0x2a83d3){logger[_0xb171('0x2d')](_0x2a83d3[_0xb171('0x2e')]);if(_0x2a83d3['name']){delete _0x2a83d3[_0xb171('0x2f')];}_0x1736c8[_0xb171('0x1c')](_0x1538a9)[_0xb171('0x30')](_0x2a83d3);};}exports['index']=function(_0x1490ab,_0x28193c){var _0x260d3d={},_0x1d292d={},_0x2d5533={'count':0x0,'rows':[]};var _0x3e674f=_[_0xb171('0x31')](db['Interval'][_0xb171('0x32')],function(_0x2e7f3a){return{'name':_0x2e7f3a['fieldName'],'type':_0x2e7f3a[_0xb171('0x33')][_0xb171('0x34')]};});_0x1d292d[_0xb171('0x35')]=_[_0xb171('0x31')](_0x3e674f,_0xb171('0x2f'));_0x1d292d[_0xb171('0x36')]=_[_0xb171('0x37')](_0x1490ab[_0xb171('0x36')]);_0x1d292d[_0xb171('0x38')]=_[_0xb171('0x39')](_0x1d292d[_0xb171('0x35')],_0x1d292d[_0xb171('0x36')]);_0x260d3d['attributes']=_[_0xb171('0x39')](_0x1d292d['model'],qs['fields'](_0x1490ab['query'][_0xb171('0x3a')]));_0x260d3d[_0xb171('0x3b')]=_0x260d3d['attributes']['length']?_0x260d3d['attributes']:_0x1d292d[_0xb171('0x35')];if(!_0x1490ab[_0xb171('0x36')][_0xb171('0x3c')](_0xb171('0x3d'))){_0x260d3d[_0xb171('0x21')]=qs[_0xb171('0x21')](_0x1490ab[_0xb171('0x36')][_0xb171('0x21')]);_0x260d3d[_0xb171('0x1f')]=qs[_0xb171('0x1f')](_0x1490ab[_0xb171('0x36')][_0xb171('0x1f')]);}_0x260d3d[_0xb171('0x3e')]=qs[_0xb171('0x3f')](_0x1490ab[_0xb171('0x36')][_0xb171('0x3f')]);_0x260d3d['where']=qs['filters'](_[_0xb171('0x40')](_0x1490ab['query'],_0x1d292d['filters']),_0x3e674f);if(_0x1490ab['query'][_0xb171('0x41')]){_0x260d3d[_0xb171('0x42')]=_[_0xb171('0x43')](_0x260d3d[_0xb171('0x42')],{'$or':_['map'](_0x3e674f,function(_0x36b76d){if(_0x36b76d['type']!==_0xb171('0x44')){var _0x892079={};_0x892079[_0x36b76d[_0xb171('0x2f')]]={'$like':'%'+_0x1490ab[_0xb171('0x36')][_0xb171('0x41')]+'%'};return _0x892079;}})});}_0x260d3d=_[_0xb171('0x43')]({},_0x260d3d,_0x1490ab['options']);var _0x4354bc={'where':_0x260d3d[_0xb171('0x42')]};return db[_0xb171('0x45')]['count'](_0x4354bc)['then'](function(_0x4adad3){_0x2d5533[_0xb171('0x22')]=_0x4adad3;if(_0x1490ab['query'][_0xb171('0x46')]){_0x260d3d[_0xb171('0x47')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x260d3d);})['then'](function(_0x3bb571){_0x2d5533[_0xb171('0x48')]=_0x3bb571;return _0x2d5533;})[_0xb171('0x28')](respondWithFilteredResult(_0x28193c,_0x260d3d))[_0xb171('0x49')](handleError(_0x28193c,null));};exports['show']=function(_0x383afe,_0x3228b4){var _0x289efb={'raw':!![],'where':{'id':_0x383afe[_0xb171('0x4a')]['id']}},_0x53697a={};_0x53697a[_0xb171('0x35')]=_[_0xb171('0x37')](db['Interval'][_0xb171('0x32')]);_0x53697a['query']=_['keys'](_0x383afe[_0xb171('0x36')]);_0x53697a[_0xb171('0x38')]=_[_0xb171('0x39')](_0x53697a[_0xb171('0x35')],_0x53697a[_0xb171('0x36')]);_0x289efb[_0xb171('0x3b')]=_[_0xb171('0x39')](_0x53697a[_0xb171('0x35')],qs['fields'](_0x383afe[_0xb171('0x36')][_0xb171('0x3a')]));_0x289efb['attributes']=_0x289efb[_0xb171('0x3b')][_0xb171('0x4b')]?_0x289efb['attributes']:_0x53697a[_0xb171('0x35')];if(_0x383afe[_0xb171('0x36')][_0xb171('0x46')]){_0x289efb[_0xb171('0x47')]=[{'all':!![]}];}_0x289efb=_[_0xb171('0x43')]({},_0x289efb,_0x383afe[_0xb171('0x4c')]);return db[_0xb171('0x45')]['find'](_0x289efb)[_0xb171('0x28')](handleEntityNotFound(_0x3228b4,null))[_0xb171('0x28')](respondWithResult(_0x3228b4,null))[_0xb171('0x49')](handleError(_0x3228b4,null));};exports['create']=function(_0x21e4d8,_0x2523d8){return db['Interval'][_0xb171('0x4d')](_0x21e4d8[_0xb171('0x4e')],{})[_0xb171('0x28')](function(_0x49f69d){var _0x5c911d=_0x21e4d8[_0xb171('0x4f')][_0xb171('0x2a')]({'plain':!![]});if(!_0x5c911d)throw new Error(_0xb171('0x50'));if(_0x5c911d[_0xb171('0x51')]===_0xb171('0x4f')){var _0x46744d=_0x49f69d[_0xb171('0x2a')]({'plain':!![]});var _0x429b52='Intervals';return db[_0xb171('0x52')][_0xb171('0x53')]({'where':{'name':_0x429b52,'userProfileId':_0x5c911d['userProfileId']},'raw':!![]})[_0xb171('0x28')](function(_0x509a05){if(_0x509a05&&_0x509a05[_0xb171('0x54')]===0x0){return db[_0xb171('0x2c')]['create']({'name':_0x46744d[_0xb171('0x2f')],'resourceId':_0x46744d['id'],'type':_0x509a05['name'],'sectionId':_0x509a05['id']},{})['then'](function(){return _0x49f69d;});}else{return _0x49f69d;}})[_0xb171('0x49')](function(_0x3b44ec){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b44ec);throw _0x3b44ec;});}return _0x49f69d;})[_0xb171('0x28')](respondWithResult(_0x2523d8,0xc9))['catch'](handleError(_0x2523d8,null));};exports['update']=function(_0x48fe56,_0x2a2c2a){if(_0x48fe56['body']['id']){delete _0x48fe56[_0xb171('0x4e')]['id'];}return db[_0xb171('0x45')][_0xb171('0x53')]({'where':{'id':_0x48fe56['params']['id']}})['then'](handleEntityNotFound(_0x2a2c2a,null))[_0xb171('0x28')](saveUpdates(_0x48fe56[_0xb171('0x4e')],null))[_0xb171('0x28')](respondWithResult(_0x2a2c2a,null))[_0xb171('0x49')](handleError(_0x2a2c2a,null));};exports[_0xb171('0x29')]=function(_0x50ee49,_0x1b11e2){return db[_0xb171('0x45')]['find']({'where':{'id':_0x50ee49['params']['id']}})[_0xb171('0x28')](handleEntityNotFound(_0x1b11e2,null))[_0xb171('0x28')](removeEntity(_0x1b11e2,null))[_0xb171('0x49')](handleError(_0x1b11e2,null));};exports['addInterval']=function(_0x2808a8,_0x123d35,_0x4f8b12){if(_0x2808a8[_0xb171('0x4e')]['id']){delete _0x2808a8[_0xb171('0x4e')]['id'];}return db[_0xb171('0x45')][_0xb171('0x53')]({'where':{'id':_0x2808a8[_0xb171('0x4a')]['id']}})['then'](handleEntityNotFound(_0x123d35,null))[_0xb171('0x28')](function(_0x41d149){if(_0x41d149){_0x2808a8['body'][_0xb171('0x55')]=_0x41d149['id'];return db['Interval'][_0xb171('0x4d')](_0x2808a8['body']);}})[_0xb171('0x28')](respondWithResult(_0x123d35,null))[_0xb171('0x49')](handleError(_0x123d35,null));};exports[_0xb171('0x56')]=function(_0x42f210,_0x30d1f6,_0x5c8592){var _0x3d1b98={};var _0x11f3e1={};var _0x48cfb2;var _0xdefb84;return db['Interval']['findOne']({'where':{'id':_0x42f210['params']['id']}})[_0xb171('0x28')](handleEntityNotFound(_0x30d1f6,null))[_0xb171('0x28')](function(_0xb542cb){if(_0xb542cb){_0x48cfb2=_0xb542cb;_0x11f3e1[_0xb171('0x35')]=_[_0xb171('0x37')](db[_0xb171('0x45')][_0xb171('0x32')]);_0x11f3e1[_0xb171('0x36')]=_[_0xb171('0x37')](_0x42f210[_0xb171('0x36')]);_0x11f3e1[_0xb171('0x38')]=_['intersection'](_0x11f3e1[_0xb171('0x35')],_0x11f3e1[_0xb171('0x36')]);_0x3d1b98[_0xb171('0x3b')]=_[_0xb171('0x39')](_0x11f3e1['model'],qs[_0xb171('0x3a')](_0x42f210[_0xb171('0x36')][_0xb171('0x3a')]));_0x3d1b98[_0xb171('0x3b')]=_0x3d1b98[_0xb171('0x3b')]['length']?_0x3d1b98[_0xb171('0x3b')]:_0x11f3e1[_0xb171('0x35')];_0x3d1b98[_0xb171('0x3e')]=qs[_0xb171('0x3f')](_0x42f210[_0xb171('0x36')]['sort']);_0x3d1b98[_0xb171('0x42')]=qs[_0xb171('0x38')](_[_0xb171('0x40')](_0x42f210[_0xb171('0x36')],_0x11f3e1[_0xb171('0x38')]));if(_0x42f210[_0xb171('0x36')][_0xb171('0x41')]){_0x3d1b98[_0xb171('0x42')]=_[_0xb171('0x43')](_0x3d1b98['where'],{'$or':_['map'](_0x3d1b98[_0xb171('0x3b')],function(_0x817d92){var _0x4ee14b={};_0x4ee14b[_0x817d92]={'$like':'%'+_0x42f210[_0xb171('0x36')][_0xb171('0x41')]+'%'};return _0x4ee14b;})});}_0x3d1b98=_[_0xb171('0x43')]({},_0x3d1b98,_0x42f210['options']);return _0x48cfb2[_0xb171('0x56')](_0x3d1b98);}})[_0xb171('0x28')](function(_0x51fb9b){if(_0x51fb9b){_0xdefb84=_0x51fb9b[_0xb171('0x4b')];if(!_0x42f210[_0xb171('0x36')][_0xb171('0x3c')]('nolimit')){_0x3d1b98[_0xb171('0x21')]=qs[_0xb171('0x21')](_0x42f210[_0xb171('0x36')]['limit']);_0x3d1b98['offset']=qs[_0xb171('0x1f')](_0x42f210['query'][_0xb171('0x1f')]);}return _0x48cfb2[_0xb171('0x56')](_0x3d1b98);}})[_0xb171('0x28')](function(_0x226f4f){if(_0x226f4f){return _0x226f4f?{'count':_0xdefb84,'rows':_0x226f4f}:null;}})[_0xb171('0x28')](respondWithResult(_0x30d1f6,null))['catch'](handleError(_0x30d1f6,null));};exports[_0xb171('0x57')]=function(_0x51cd42,_0x248d81,_0x15bef4){return db[_0xb171('0x45')][_0xb171('0x58')]({'where':{'id':_0x51cd42[_0xb171('0x4a')]['id']}})['then'](handleEntityNotFound(_0x248d81,null))[_0xb171('0x28')](function(_0x42a127){if(_0x42a127){return db[_0xb171('0x59')][_0xb171('0x5a')](function(_0x3f1095){return db[_0xb171('0x45')]['destroy']({'where':{'IntervalId':_0x51cd42[_0xb171('0x4a')]['id']},'transaction':_0x3f1095})['then'](function(_0x157a6b){var _0x2bc87a=_[_0xb171('0x31')](_0x51cd42[_0xb171('0x4e')],function(_0x5b2bfb){delete _0x5b2bfb['id'];_0x5b2bfb['IntervalId']=_0x51cd42[_0xb171('0x4a')]['id'];return _0x5b2bfb;});return db[_0xb171('0x45')]['bulkCreate'](_0x2bc87a,{'transaction':_0x3f1095});});})[_0xb171('0x28')](function(){return db['Interval'][_0xb171('0x5b')]({'where':{'IntervalId':_0x51cd42['params']['id']}});});}})[_0xb171('0x28')](respondWithResult(_0x248d81,null))[_0xb171('0x49')](handleError(_0x248d81,null));}; \ No newline at end of file +var _0x3f2b=['role','user','Intervals','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','findOne','order','options','hasOwnProperty','sequelize','transaction','bulkCreate','findAll','eml-format','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','params','fields','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x3f2b,0x12a));var _0xb3f2=function(_0x12ea29,_0x1848a2){_0x12ea29=_0x12ea29-0x0;var _0x329021=_0x3f2b[_0x12ea29];return _0x329021;};'use strict';var emlformat=require(_0xb3f2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb3f2('0x1'));var moment=require(_0xb3f2('0x2'));var BPromise=require(_0xb3f2('0x3'));var Mustache=require('mustache');var util=require(_0xb3f2('0x4'));var path=require(_0xb3f2('0x5'));var sox=require(_0xb3f2('0x6'));var csv=require('to-csv');var ejs=require(_0xb3f2('0x7'));var fs=require('fs');var fs_extra=require(_0xb3f2('0x8'));var _=require(_0xb3f2('0x9'));var squel=require(_0xb3f2('0xa'));var crypto=require(_0xb3f2('0xb'));var jsforce=require(_0xb3f2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb3f2('0xd'));var querystring=require('querystring');var Papa=require(_0xb3f2('0xe'));var Redis=require(_0xb3f2('0xf'));var authService=require(_0xb3f2('0x10'));var qs=require(_0xb3f2('0x11'));var as=require(_0xb3f2('0x12'));var hardwareService=require(_0xb3f2('0x13'));var logger=require(_0xb3f2('0x14'))(_0xb3f2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3f2('0x16'));var db=require(_0xb3f2('0x17'))['db'];var extensions=require(_0xb3f2('0x18'));function respondWithStatusCode(_0x313c4d,_0xf104bb){_0xf104bb=_0xf104bb||0xcc;return function(_0x4a917c){if(_0x4a917c){return _0x313c4d[_0xb3f2('0x19')](_0xf104bb);}return _0x313c4d[_0xb3f2('0x1a')](_0xf104bb)[_0xb3f2('0x1b')]();};}function respondWithResult(_0x35f9de,_0x5f2066){_0x5f2066=_0x5f2066||0xc8;return function(_0x4bd8c5){if(_0x4bd8c5){return _0x35f9de[_0xb3f2('0x1a')](_0x5f2066)['json'](_0x4bd8c5);}};}function respondWithFilteredResult(_0x5aaadb,_0x5acd97){return function(_0x2caeb0){if(_0x2caeb0){var _0x382421=typeof _0x5acd97['offset']===_0xb3f2('0x1c')&&typeof _0x5acd97[_0xb3f2('0x1d')]===_0xb3f2('0x1c');var _0xa12705=_0x2caeb0[_0xb3f2('0x1e')];var _0x5bea26=_0x382421?0x0:_0x5acd97[_0xb3f2('0x1f')];var _0x6b9413=_0x382421?_0x2caeb0[_0xb3f2('0x1e')]:_0x5acd97[_0xb3f2('0x1f')]+_0x5acd97[_0xb3f2('0x1d')];var _0x3a67fa;if(_0x6b9413>=_0xa12705){_0x6b9413=_0xa12705;_0x3a67fa=0xc8;}else{_0x3a67fa=0xce;}_0x5aaadb[_0xb3f2('0x1a')](_0x3a67fa);return _0x5aaadb[_0xb3f2('0x20')]('Content-Range',_0x5bea26+'-'+_0x6b9413+'/'+_0xa12705)[_0xb3f2('0x21')](_0x2caeb0);}return null;};}function patchUpdates(_0x12d3b7){return function(_0x46fa39){try{jsonpatch[_0xb3f2('0x22')](_0x46fa39,_0x12d3b7,!![]);}catch(_0x4fb454){return BPromise['reject'](_0x4fb454);}return _0x46fa39[_0xb3f2('0x23')]();};}function saveUpdates(_0x3742cf,_0x2a35b5){return function(_0x47d990){if(_0x47d990){return _0x47d990[_0xb3f2('0x24')](_0x3742cf)['then'](function(_0x4e5fcb){return _0x4e5fcb;});}return null;};}function removeEntity(_0x15ab2f,_0x1f1a32){return function(_0x1481c4){if(_0x1481c4){return _0x1481c4[_0xb3f2('0x25')]()[_0xb3f2('0x26')](function(){var _0x1118b1=_0x1481c4[_0xb3f2('0x27')]({'plain':!![]});var _0x154c33='Intervals';return db[_0xb3f2('0x28')]['destroy']({'where':{'type':_0x154c33,'resourceId':_0x1118b1['id']}})[_0xb3f2('0x26')](function(){return _0x1481c4;});})[_0xb3f2('0x26')](function(){_0x15ab2f['status'](0xcc)[_0xb3f2('0x1b')]();});}};}function handleEntityNotFound(_0xa7f795,_0x3b9231){return function(_0x258ae0){if(!_0x258ae0){_0xa7f795[_0xb3f2('0x19')](0x194);}return _0x258ae0;};}function handleError(_0x2573a5,_0x5771e1){_0x5771e1=_0x5771e1||0x1f4;return function(_0x1c2478){logger[_0xb3f2('0x29')](_0x1c2478[_0xb3f2('0x2a')]);if(_0x1c2478[_0xb3f2('0x2b')]){delete _0x1c2478[_0xb3f2('0x2b')];}_0x2573a5[_0xb3f2('0x1a')](_0x5771e1)[_0xb3f2('0x2c')](_0x1c2478);};}exports[_0xb3f2('0x2d')]=function(_0x4799f6,_0x3382a5){var _0x2cacf0={},_0x25626f={},_0x1f1c82={'count':0x0,'rows':[]};var _0x24468b=_[_0xb3f2('0x2e')](db[_0xb3f2('0x2f')][_0xb3f2('0x30')],function(_0x3d10ad){return{'name':_0x3d10ad[_0xb3f2('0x31')],'type':_0x3d10ad['type'][_0xb3f2('0x32')]};});_0x25626f[_0xb3f2('0x33')]=_[_0xb3f2('0x2e')](_0x24468b,'name');_0x25626f[_0xb3f2('0x34')]=_[_0xb3f2('0x35')](_0x4799f6[_0xb3f2('0x34')]);_0x25626f[_0xb3f2('0x36')]=_['intersection'](_0x25626f['model'],_0x25626f[_0xb3f2('0x34')]);_0x2cacf0['attributes']=_[_0xb3f2('0x37')](_0x25626f['model'],qs['fields'](_0x4799f6[_0xb3f2('0x34')]['fields']));_0x2cacf0[_0xb3f2('0x38')]=_0x2cacf0[_0xb3f2('0x38')][_0xb3f2('0x39')]?_0x2cacf0['attributes']:_0x25626f['model'];if(!_0x4799f6[_0xb3f2('0x34')]['hasOwnProperty'](_0xb3f2('0x3a'))){_0x2cacf0[_0xb3f2('0x1d')]=qs['limit'](_0x4799f6['query'][_0xb3f2('0x1d')]);_0x2cacf0['offset']=qs[_0xb3f2('0x1f')](_0x4799f6['query']['offset']);}_0x2cacf0['order']=qs[_0xb3f2('0x3b')](_0x4799f6[_0xb3f2('0x34')]['sort']);_0x2cacf0[_0xb3f2('0x3c')]=qs[_0xb3f2('0x36')](_[_0xb3f2('0x3d')](_0x4799f6[_0xb3f2('0x34')],_0x25626f[_0xb3f2('0x36')]),_0x24468b);if(_0x4799f6[_0xb3f2('0x34')][_0xb3f2('0x3e')]){_0x2cacf0['where']=_[_0xb3f2('0x3f')](_0x2cacf0['where'],{'$or':_[_0xb3f2('0x2e')](_0x24468b,function(_0x583dd1){if(_0x583dd1[_0xb3f2('0x40')]!==_0xb3f2('0x41')){var _0x20bad8={};_0x20bad8[_0x583dd1['name']]={'$like':'%'+_0x4799f6['query']['filter']+'%'};return _0x20bad8;}})});}_0x2cacf0=_[_0xb3f2('0x3f')]({},_0x2cacf0,_0x4799f6['options']);var _0x3e7c2d={'where':_0x2cacf0[_0xb3f2('0x3c')]};return db[_0xb3f2('0x2f')][_0xb3f2('0x1e')](_0x3e7c2d)['then'](function(_0x5753aa){_0x1f1c82['count']=_0x5753aa;if(_0x4799f6[_0xb3f2('0x34')]['includeAll']){_0x2cacf0[_0xb3f2('0x42')]=[{'all':!![]}];}return db[_0xb3f2('0x2f')]['findAll'](_0x2cacf0);})['then'](function(_0x52754b){_0x1f1c82[_0xb3f2('0x43')]=_0x52754b;return _0x1f1c82;})[_0xb3f2('0x26')](respondWithFilteredResult(_0x3382a5,_0x2cacf0))[_0xb3f2('0x44')](handleError(_0x3382a5,null));};exports['show']=function(_0x247f36,_0x6cfa3b){var _0x1ea3b9={'raw':!![],'where':{'id':_0x247f36[_0xb3f2('0x45')]['id']}},_0x4d4c7a={};_0x4d4c7a['model']=_[_0xb3f2('0x35')](db[_0xb3f2('0x2f')]['rawAttributes']);_0x4d4c7a[_0xb3f2('0x34')]=_[_0xb3f2('0x35')](_0x247f36[_0xb3f2('0x34')]);_0x4d4c7a[_0xb3f2('0x36')]=_[_0xb3f2('0x37')](_0x4d4c7a[_0xb3f2('0x33')],_0x4d4c7a['query']);_0x1ea3b9[_0xb3f2('0x38')]=_[_0xb3f2('0x37')](_0x4d4c7a[_0xb3f2('0x33')],qs[_0xb3f2('0x46')](_0x247f36[_0xb3f2('0x34')][_0xb3f2('0x46')]));_0x1ea3b9[_0xb3f2('0x38')]=_0x1ea3b9[_0xb3f2('0x38')][_0xb3f2('0x39')]?_0x1ea3b9[_0xb3f2('0x38')]:_0x4d4c7a[_0xb3f2('0x33')];if(_0x247f36[_0xb3f2('0x34')][_0xb3f2('0x47')]){_0x1ea3b9[_0xb3f2('0x42')]=[{'all':!![]}];}_0x1ea3b9=_[_0xb3f2('0x3f')]({},_0x1ea3b9,_0x247f36['options']);return db[_0xb3f2('0x2f')]['find'](_0x1ea3b9)[_0xb3f2('0x26')](handleEntityNotFound(_0x6cfa3b,null))[_0xb3f2('0x26')](respondWithResult(_0x6cfa3b,null))[_0xb3f2('0x44')](handleError(_0x6cfa3b,null));};exports['create']=function(_0x19f76e,_0x1e1dff){return db['Interval'][_0xb3f2('0x48')](_0x19f76e['body'],{})[_0xb3f2('0x26')](function(_0xcf4b86){var _0x22b065=_0x19f76e['user'][_0xb3f2('0x27')]({'plain':!![]});if(!_0x22b065)throw new Error(_0xb3f2('0x49'));if(_0x22b065[_0xb3f2('0x4a')]===_0xb3f2('0x4b')){var _0x2b01a3=_0xcf4b86[_0xb3f2('0x27')]({'plain':!![]});var _0x305ee7=_0xb3f2('0x4c');return db[_0xb3f2('0x4d')][_0xb3f2('0x4e')]({'where':{'name':_0x305ee7,'userProfileId':_0x22b065[_0xb3f2('0x4f')]},'raw':!![]})[_0xb3f2('0x26')](function(_0x1b811c){if(_0x1b811c&&_0x1b811c['autoAssociation']===0x0){return db[_0xb3f2('0x28')][_0xb3f2('0x48')]({'name':_0x2b01a3[_0xb3f2('0x2b')],'resourceId':_0x2b01a3['id'],'type':_0x1b811c[_0xb3f2('0x2b')],'sectionId':_0x1b811c['id']},{})[_0xb3f2('0x26')](function(){return _0xcf4b86;});}else{return _0xcf4b86;}})[_0xb3f2('0x44')](function(_0x2ae028){logger[_0xb3f2('0x29')](_0xb3f2('0x50'),_0x2ae028);throw _0x2ae028;});}return _0xcf4b86;})[_0xb3f2('0x26')](respondWithResult(_0x1e1dff,0xc9))[_0xb3f2('0x44')](handleError(_0x1e1dff,null));};exports['update']=function(_0x240215,_0x6dc667){if(_0x240215['body']['id']){delete _0x240215['body']['id'];}return db[_0xb3f2('0x2f')][_0xb3f2('0x4e')]({'where':{'id':_0x240215[_0xb3f2('0x45')]['id']}})[_0xb3f2('0x26')](handleEntityNotFound(_0x6dc667,null))[_0xb3f2('0x26')](saveUpdates(_0x240215[_0xb3f2('0x51')],null))[_0xb3f2('0x26')](respondWithResult(_0x6dc667,null))[_0xb3f2('0x44')](handleError(_0x6dc667,null));};exports[_0xb3f2('0x25')]=function(_0xab11d8,_0x49726d){return db['Interval'][_0xb3f2('0x4e')]({'where':{'id':_0xab11d8['params']['id']}})[_0xb3f2('0x26')](handleEntityNotFound(_0x49726d,null))[_0xb3f2('0x26')](removeEntity(_0x49726d,null))['catch'](handleError(_0x49726d,null));};exports[_0xb3f2('0x52')]=function(_0x36d328,_0xb7d21,_0x52c817){if(_0x36d328[_0xb3f2('0x51')]['id']){delete _0x36d328[_0xb3f2('0x51')]['id'];}return db['Interval']['find']({'where':{'id':_0x36d328['params']['id']}})[_0xb3f2('0x26')](handleEntityNotFound(_0xb7d21,null))[_0xb3f2('0x26')](function(_0x78f37a){if(_0x78f37a){_0x36d328[_0xb3f2('0x51')][_0xb3f2('0x53')]=_0x78f37a['id'];return db[_0xb3f2('0x2f')][_0xb3f2('0x48')](_0x36d328[_0xb3f2('0x51')]);}})[_0xb3f2('0x26')](respondWithResult(_0xb7d21,null))[_0xb3f2('0x44')](handleError(_0xb7d21,null));};exports[_0xb3f2('0x54')]=function(_0x5026dd,_0x3bda75,_0x3f88ea){var _0x4d745b={};var _0x42fbe3={};var _0x19e806;var _0x48ab80;return db[_0xb3f2('0x2f')][_0xb3f2('0x55')]({'where':{'id':_0x5026dd['params']['id']}})[_0xb3f2('0x26')](handleEntityNotFound(_0x3bda75,null))[_0xb3f2('0x26')](function(_0x8b73d6){if(_0x8b73d6){_0x19e806=_0x8b73d6;_0x42fbe3[_0xb3f2('0x33')]=_[_0xb3f2('0x35')](db[_0xb3f2('0x2f')]['rawAttributes']);_0x42fbe3[_0xb3f2('0x34')]=_[_0xb3f2('0x35')](_0x5026dd[_0xb3f2('0x34')]);_0x42fbe3['filters']=_[_0xb3f2('0x37')](_0x42fbe3[_0xb3f2('0x33')],_0x42fbe3[_0xb3f2('0x34')]);_0x4d745b[_0xb3f2('0x38')]=_['intersection'](_0x42fbe3[_0xb3f2('0x33')],qs[_0xb3f2('0x46')](_0x5026dd['query'][_0xb3f2('0x46')]));_0x4d745b[_0xb3f2('0x38')]=_0x4d745b[_0xb3f2('0x38')][_0xb3f2('0x39')]?_0x4d745b['attributes']:_0x42fbe3['model'];_0x4d745b[_0xb3f2('0x56')]=qs[_0xb3f2('0x3b')](_0x5026dd[_0xb3f2('0x34')][_0xb3f2('0x3b')]);_0x4d745b[_0xb3f2('0x3c')]=qs[_0xb3f2('0x36')](_['pick'](_0x5026dd[_0xb3f2('0x34')],_0x42fbe3[_0xb3f2('0x36')]));if(_0x5026dd[_0xb3f2('0x34')][_0xb3f2('0x3e')]){_0x4d745b[_0xb3f2('0x3c')]=_[_0xb3f2('0x3f')](_0x4d745b[_0xb3f2('0x3c')],{'$or':_[_0xb3f2('0x2e')](_0x4d745b[_0xb3f2('0x38')],function(_0x25ffce){var _0x3b938b={};_0x3b938b[_0x25ffce]={'$like':'%'+_0x5026dd[_0xb3f2('0x34')][_0xb3f2('0x3e')]+'%'};return _0x3b938b;})});}_0x4d745b=_[_0xb3f2('0x3f')]({},_0x4d745b,_0x5026dd[_0xb3f2('0x57')]);return _0x19e806[_0xb3f2('0x54')](_0x4d745b);}})[_0xb3f2('0x26')](function(_0x46958a){if(_0x46958a){_0x48ab80=_0x46958a[_0xb3f2('0x39')];if(!_0x5026dd['query'][_0xb3f2('0x58')](_0xb3f2('0x3a'))){_0x4d745b[_0xb3f2('0x1d')]=qs[_0xb3f2('0x1d')](_0x5026dd[_0xb3f2('0x34')][_0xb3f2('0x1d')]);_0x4d745b[_0xb3f2('0x1f')]=qs[_0xb3f2('0x1f')](_0x5026dd['query'][_0xb3f2('0x1f')]);}return _0x19e806[_0xb3f2('0x54')](_0x4d745b);}})[_0xb3f2('0x26')](function(_0x4151b7){if(_0x4151b7){return _0x4151b7?{'count':_0x48ab80,'rows':_0x4151b7}:null;}})['then'](respondWithResult(_0x3bda75,null))[_0xb3f2('0x44')](handleError(_0x3bda75,null));};exports['addIntervals']=function(_0x7b51db,_0xdd3e9b,_0x5ca360){return db[_0xb3f2('0x2f')][_0xb3f2('0x55')]({'where':{'id':_0x7b51db[_0xb3f2('0x45')]['id']}})['then'](handleEntityNotFound(_0xdd3e9b,null))[_0xb3f2('0x26')](function(_0x3c05d0){if(_0x3c05d0){return db[_0xb3f2('0x59')][_0xb3f2('0x5a')](function(_0x419dfb){return db['Interval'][_0xb3f2('0x25')]({'where':{'IntervalId':_0x7b51db['params']['id']},'transaction':_0x419dfb})[_0xb3f2('0x26')](function(_0x2cbca5){var _0x2b4624=_[_0xb3f2('0x2e')](_0x7b51db[_0xb3f2('0x51')],function(_0x3569cc){delete _0x3569cc['id'];_0x3569cc[_0xb3f2('0x53')]=_0x7b51db[_0xb3f2('0x45')]['id'];return _0x3569cc;});return db[_0xb3f2('0x2f')][_0xb3f2('0x5b')](_0x2b4624,{'transaction':_0x419dfb});});})['then'](function(){return db['Interval'][_0xb3f2('0x5c')]({'where':{'IntervalId':_0x7b51db[_0xb3f2('0x45')]['id']}});});}})[_0xb3f2('0x26')](respondWithResult(_0xdd3e9b,null))['catch'](handleError(_0xdd3e9b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 35140e4..3da1a89 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 _0xd887=['interval','string','getIntervals','then','all','map','reduce','./interval.attributes','../../utils/iftime','exports','tools_intervals','rewrite'];(function(_0x10515b,_0x2adcfa){var _0x1cd1c1=function(_0x584211){while(--_0x584211){_0x10515b['push'](_0x10515b['shift']());}};_0x1cd1c1(++_0x2adcfa);}(_0xd887,0x13f));var _0x7d88=function(_0x3e86e2,_0xbdc053){_0x3e86e2=_0x3e86e2-0x0;var _0x3ff730=_0xd887[_0x3e86e2];return _0x3ff730;};'use strict';var attributes=require(_0x7d88('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x7d88('0x1'))['iftime'];module[_0x7d88('0x2')]=function(_0x5cba4b){return _0x5cba4b['define']('Interval',attributes,{'tableName':_0x7d88('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e58eb){extensions['rewrite'](_0x5cba4b,_0x5e58eb);},'afterBulkCreate':function(_0xf50606,_0x1ebd60,_0x3beda3){_0x3beda3();extensions[_0x7d88('0x4')](_0x5cba4b,_0xf50606[0x0]);},'afterUpdate':function(_0xf22af9){extensions[_0x7d88('0x4')](_0x5cba4b,_0xf22af9);},'afterDestroy':function(_0x4484f2){extensions[_0x7d88('0x4')](_0x5cba4b,_0x4484f2);}},'instanceMethods':{'ifTime':function(_0x5ad310=undefined,_0x17e5e2=new Date()){if(typeof this[_0x7d88('0x5')]===_0x7d88('0x6')){return iftime(this[_0x7d88('0x5')],_0x5ad310,_0x17e5e2);}else{return this[_0x7d88('0x7')]()[_0x7d88('0x8')](function(_0x629acc){return Promise[_0x7d88('0x9')](_0x629acc[_0x7d88('0xa')](function(_0x4d2c8c){return _0x4d2c8c['ifTime'](_0x5ad310,_0x17e5e2);}));})['then'](function(_0x278b53){return _0x278b53[_0x7d88('0xb')](function(_0x207922,_0x2359b1){return _0x207922||_0x2359b1;},![]);});}}}});}; \ No newline at end of file +var _0xdc2e=['string','then','all','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval'];(function(_0xab5df3,_0x7c88b9){var _0x4f06ce=function(_0x1de8cc){while(--_0x1de8cc){_0xab5df3['push'](_0xab5df3['shift']());}};_0x4f06ce(++_0x7c88b9);}(_0xdc2e,0x94));var _0xedc2=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xdc2e[_0x187718];return _0x29ddf4;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xedc2('0x0'));var iftime=require(_0xedc2('0x1'))['iftime'];module[_0xedc2('0x2')]=function(_0x29070a){return _0x29070a[_0xedc2('0x3')](_0xedc2('0x4'),attributes,{'tableName':_0xedc2('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x311a1d){extensions['rewrite'](_0x29070a,_0x311a1d);},'afterBulkCreate':function(_0x222de0,_0x31dbb6,_0x443460){_0x443460();extensions[_0xedc2('0x6')](_0x29070a,_0x222de0[0x0]);},'afterUpdate':function(_0x2b6c61){extensions[_0xedc2('0x6')](_0x29070a,_0x2b6c61);},'afterDestroy':function(_0x5a2788){extensions[_0xedc2('0x6')](_0x29070a,_0x5a2788);}},'instanceMethods':{'ifTime':function(_0x237729=undefined,_0x50b3af=new Date()){if(typeof this[_0xedc2('0x7')]===_0xedc2('0x8')){return iftime(this[_0xedc2('0x7')],_0x237729,_0x50b3af);}else{return this['getIntervals']()[_0xedc2('0x9')](function(_0x26fc91){return Promise[_0xedc2('0xa')](_0x26fc91['map'](function(_0x27fc62){return _0x27fc62[_0xedc2('0xb')](_0x237729,_0x50b3af);}));})['then'](function(_0x3fcf23){return _0x3fcf23[_0xedc2('0xc')](function(_0x41db77,_0x3c1740){return _0x41db77||_0x3c1740;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e48e0e4..71330f8 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 _0x84ca=['attributes','map','include','model','then','info','stringify','error','message','ShowInterval','find','raw','debug','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','catch','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where'];(function(_0x34ddee,_0x4ba642){var _0x256bb9=function(_0x497071){while(--_0x497071){_0x34ddee['push'](_0x34ddee['shift']());}};_0x256bb9(++_0x4ba642);}(_0x84ca,0x72));var _0xa84c=function(_0x544ea7,_0x2c3c17){_0x544ea7=_0x544ea7-0x0;var _0x48b96c=_0x84ca[_0x544ea7];return _0x48b96c;};'use strict';var _=require(_0xa84c('0x0'));var util=require(_0xa84c('0x1'));var db=require(_0xa84c('0x2'))['db'];var iftime=require(_0xa84c('0x3'))[_0xa84c('0x4')];var logger=require(_0xa84c('0x5'))(_0xa84c('0x6'));exports[_0xa84c('0x7')]=function(_0x3fefd4){var _0x36516d=this;return new Promise(function(_0x25a844,_0x4c70c2){return db[_0xa84c('0x8')][_0xa84c('0x9')]({'raw':_0x3fefd4[_0xa84c('0xa')]?_0x3fefd4['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fefd4[_0xa84c('0xa')]?_0x3fefd4[_0xa84c('0xa')][_0xa84c('0xb')]||null:null,'attributes':_0x3fefd4['options']?_0x3fefd4['options'][_0xa84c('0xc')]||null:null,'limit':_0x3fefd4[_0xa84c('0xa')]?_0x3fefd4[_0xa84c('0xa')]['limit']||null:null,'include':_0x3fefd4[_0xa84c('0xa')]?_0x3fefd4['options']['include']?_[_0xa84c('0xd')](_0x3fefd4[_0xa84c('0xa')][_0xa84c('0xe')],function(_0x1c9a58){return{'model':db[_0x1c9a58[_0xa84c('0xf')]],'as':_0x1c9a58['as'],'attributes':_0x1c9a58[_0xa84c('0xc')],'include':_0x1c9a58[_0xa84c('0xe')]?_['map'](_0x1c9a58[_0xa84c('0xe')],function(_0x1ee6f7){return{'model':db[_0x1ee6f7[_0xa84c('0xf')]],'as':_0x1ee6f7['as'],'attributes':_0x1ee6f7[_0xa84c('0xc')],'include':_0x1ee6f7['include']?_[_0xa84c('0xd')](_0x1ee6f7[_0xa84c('0xe')],function(_0x2b595d){return{'model':db[_0x2b595d[_0xa84c('0xf')]],'as':_0x2b595d['as'],'attributes':_0x2b595d[_0xa84c('0xc')]};}):[]};}):[]};}):[]:[]})[_0xa84c('0x10')](function(_0x16fb36){logger[_0xa84c('0x11')](_0xa84c('0x7'),_0x3fefd4);logger['debug']('GetInterval',_0x3fefd4,JSON[_0xa84c('0x12')](_0x16fb36));_0x25a844(_0x16fb36);})['catch'](function(_0xac1716){logger[_0xa84c('0x13')]('GetInterval',_0xac1716[_0xa84c('0x14')],_0x3fefd4);_0x4c70c2(_0x36516d[_0xa84c('0x13')](0x1f4,_0xac1716[_0xa84c('0x14')]));});});};exports[_0xa84c('0x15')]=function(_0x2e1f37){var _0x609d2e=this;return new Promise(function(_0x240b7c,_0x170d95){return db[_0xa84c('0x8')][_0xa84c('0x16')]({'raw':_0x2e1f37[_0xa84c('0xa')]?_0x2e1f37[_0xa84c('0xa')][_0xa84c('0x17')]===undefined?!![]:![]:!![],'where':_0x2e1f37[_0xa84c('0xa')]?_0x2e1f37['options'][_0xa84c('0xb')]||null:null,'attributes':_0x2e1f37[_0xa84c('0xa')]?_0x2e1f37[_0xa84c('0xa')][_0xa84c('0xc')]||null:null,'include':_0x2e1f37[_0xa84c('0xa')]?_0x2e1f37['options'][_0xa84c('0xe')]?_[_0xa84c('0xd')](_0x2e1f37[_0xa84c('0xa')][_0xa84c('0xe')],function(_0x6a7f72){return{'model':db[_0x6a7f72['model']],'as':_0x6a7f72['as'],'attributes':_0x6a7f72['attributes'],'include':_0x6a7f72['include']?_[_0xa84c('0xd')](_0x6a7f72[_0xa84c('0xe')],function(_0x54dadf){return{'model':db[_0x54dadf[_0xa84c('0xf')]],'as':_0x54dadf['as'],'attributes':_0x54dadf[_0xa84c('0xc')],'include':_0x54dadf[_0xa84c('0xe')]?_[_0xa84c('0xd')](_0x54dadf['include'],function(_0x30fd0d){return{'model':db[_0x30fd0d[_0xa84c('0xf')]],'as':_0x30fd0d['as'],'attributes':_0x30fd0d[_0xa84c('0xc')]};}):[]};}):[]};}):[]:[]})[_0xa84c('0x10')](function(_0x277b4a){logger[_0xa84c('0x11')]('ShowInterval',_0x2e1f37);logger[_0xa84c('0x18')](_0xa84c('0x15'),_0x2e1f37,JSON[_0xa84c('0x12')](_0x277b4a));_0x240b7c(_0x277b4a);})['catch'](function(_0x283409){logger[_0xa84c('0x13')](_0xa84c('0x15'),_0x283409[_0xa84c('0x14')],_0x2e1f37);_0x170d95(_0x609d2e['error'](0x1f4,_0x283409[_0xa84c('0x14')]));});});};function checkArrayOfIntervals(_0x2cded3,_0x2247e9){var _0x266f97=[];return db['Interval'][_0xa84c('0x9')]({'where':{'id':_0x2cded3}})[_0xa84c('0x10')](function(_0x4a5d76){_0x266f97=_0x4a5d76;return Promise['all'](_0x266f97[_0xa84c('0xd')](function(_0x2f4229){return _0x2f4229[_0xa84c('0x19')](_0x2247e9);}));})[_0xa84c('0x10')](function(_0x7e390e){var _0x2828f7=_0x7e390e[_0xa84c('0x1a')](function(_0x3bb812,_0x1e5042){return _0x3bb812||_0x1e5042;},![]);logger[_0xa84c('0x11')](util[_0xa84c('0x1b')](_0xa84c('0x1c'),_0x266f97[_0xa84c('0xd')](function(_0x9e4458){return _0x9e4458[_0xa84c('0x1d')];})[_0xa84c('0x1e')](',\x20'),_0x266f97[_0xa84c('0xd')](function(_0x125405){return _0x125405['id'];})['join'](',\x20')));return _0x2828f7;});}function checkSingleInterval(_0x28360e,_0x431784){return db[_0xa84c('0x8')]['findById'](_0x28360e)[_0xa84c('0x10')](function(_0x3f1c88){if(_0x3f1c88){logger['info'](util[_0xa84c('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x3f1c88[_0xa84c('0x1d')],_0x3f1c88['id']));return _0x3f1c88['ifTime'](_0x431784);}});}exports['IntervalIftime']=function(_0x2428a5){var _0x2b3140=_0x2428a5[_0xa84c('0x1f')];var _0x352227=Array[_0xa84c('0x20')](_0x2428a5['intervals'])?_0x2428a5[_0xa84c('0x21')]:typeof _0x2428a5['intervals']===_0xa84c('0x22')?[_0x2428a5[_0xa84c('0x21')]]:[];var _0x40529e=_0x2428a5[_0xa84c('0x23')]||undefined;var _0x493e60=![];if(_0x352227['length']){logger[_0xa84c('0x11')](util[_0xa84c('0x1b')](_0xa84c('0x24'),_0x352227['join'](';\x20')));}if(_0x40529e){logger[_0xa84c('0x11')](util[_0xa84c('0x1b')](_0xa84c('0x25'),_0x40529e));}logger[_0xa84c('0x18')]('Iftime',_0x493e60);logger[_0xa84c('0x26')](_0xa84c('0x27'),_0x2428a5);return Promise[_0xa84c('0x28')]()[_0xa84c('0x10')](function(){if(Array[_0xa84c('0x20')](_0x2b3140)){return checkArrayOfIntervals(_0x2b3140,_0x40529e);}else if(_0x2b3140){return checkSingleInterval(_0x2b3140,_0x40529e);}})[_0xa84c('0x10')](function(_0xc71edd){var _0x3653b2=_0x352227[_0xa84c('0x1a')](function(_0x2c39b0,_0x50c5ef){return _0x2c39b0||iftime(_0x50c5ef,_0x40529e);},![]);_0x493e60=_0xc71edd||_0x3653b2;return _0x493e60;})[_0xa84c('0x29')](function(_0xf385f2){logger[_0xa84c('0x13')](_0xa84c('0x27'),_0x2428a5,_0xf385f2);throw this[_0xa84c('0x13')](0x1f4,_0xf385f2[_0xa84c('0x14')]);});}; \ No newline at end of file +var _0x5314=['include','model','then','info','debug','catch','error','message','ShowInterval','where','stringify','findAll','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)','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','isArray','util','../../mysqldb','iftime','rpc','GetInterval','Interval','raw','options','attributes','map'];(function(_0x20481c,_0x3fa0fc){var _0x510e01=function(_0x1e20f6){while(--_0x1e20f6){_0x20481c['push'](_0x20481c['shift']());}};_0x510e01(++_0x3fa0fc);}(_0x5314,0xf2));var _0x4531=function(_0x158f43,_0x32da3f){_0x158f43=_0x158f43-0x0;var _0x16f61f=_0x5314[_0x158f43];return _0x16f61f;};'use strict';var _=require('lodash');var util=require(_0x4531('0x0'));var db=require(_0x4531('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x4531('0x2')];var logger=require('../../config/logger')(_0x4531('0x3'));exports[_0x4531('0x4')]=function(_0x5def97){var _0x1e3470=this;return new Promise(function(_0x20c27b,_0xc968c8){return db[_0x4531('0x5')]['findAll']({'raw':_0x5def97['options']?_0x5def97['options'][_0x4531('0x6')]===undefined?!![]:![]:!![],'where':_0x5def97[_0x4531('0x7')]?_0x5def97[_0x4531('0x7')]['where']||null:null,'attributes':_0x5def97[_0x4531('0x7')]?_0x5def97[_0x4531('0x7')][_0x4531('0x8')]||null:null,'limit':_0x5def97[_0x4531('0x7')]?_0x5def97[_0x4531('0x7')]['limit']||null:null,'include':_0x5def97[_0x4531('0x7')]?_0x5def97[_0x4531('0x7')]['include']?_[_0x4531('0x9')](_0x5def97[_0x4531('0x7')]['include'],function(_0xdac7ab){return{'model':db[_0xdac7ab['model']],'as':_0xdac7ab['as'],'attributes':_0xdac7ab[_0x4531('0x8')],'include':_0xdac7ab['include']?_[_0x4531('0x9')](_0xdac7ab[_0x4531('0xa')],function(_0x227a3d){return{'model':db[_0x227a3d[_0x4531('0xb')]],'as':_0x227a3d['as'],'attributes':_0x227a3d[_0x4531('0x8')],'include':_0x227a3d['include']?_[_0x4531('0x9')](_0x227a3d[_0x4531('0xa')],function(_0x130c7c){return{'model':db[_0x130c7c[_0x4531('0xb')]],'as':_0x130c7c['as'],'attributes':_0x130c7c[_0x4531('0x8')]};}):[]};}):[]};}):[]:[]})[_0x4531('0xc')](function(_0x4bee6a){logger[_0x4531('0xd')](_0x4531('0x4'),_0x5def97);logger[_0x4531('0xe')](_0x4531('0x4'),_0x5def97,JSON['stringify'](_0x4bee6a));_0x20c27b(_0x4bee6a);})[_0x4531('0xf')](function(_0x1fb2c8){logger[_0x4531('0x10')](_0x4531('0x4'),_0x1fb2c8[_0x4531('0x11')],_0x5def97);_0xc968c8(_0x1e3470[_0x4531('0x10')](0x1f4,_0x1fb2c8[_0x4531('0x11')]));});});};exports[_0x4531('0x12')]=function(_0x55d29d){var _0x31f4b0=this;return new Promise(function(_0x525982,_0x40d28a){return db[_0x4531('0x5')]['find']({'raw':_0x55d29d[_0x4531('0x7')]?_0x55d29d[_0x4531('0x7')][_0x4531('0x6')]===undefined?!![]:![]:!![],'where':_0x55d29d[_0x4531('0x7')]?_0x55d29d[_0x4531('0x7')][_0x4531('0x13')]||null:null,'attributes':_0x55d29d[_0x4531('0x7')]?_0x55d29d[_0x4531('0x7')][_0x4531('0x8')]||null:null,'include':_0x55d29d[_0x4531('0x7')]?_0x55d29d[_0x4531('0x7')][_0x4531('0xa')]?_[_0x4531('0x9')](_0x55d29d['options'][_0x4531('0xa')],function(_0x879839){return{'model':db[_0x879839[_0x4531('0xb')]],'as':_0x879839['as'],'attributes':_0x879839[_0x4531('0x8')],'include':_0x879839['include']?_[_0x4531('0x9')](_0x879839[_0x4531('0xa')],function(_0x10846d){return{'model':db[_0x10846d[_0x4531('0xb')]],'as':_0x10846d['as'],'attributes':_0x10846d[_0x4531('0x8')],'include':_0x10846d[_0x4531('0xa')]?_['map'](_0x10846d[_0x4531('0xa')],function(_0x4d79a7){return{'model':db[_0x4d79a7[_0x4531('0xb')]],'as':_0x4d79a7['as'],'attributes':_0x4d79a7[_0x4531('0x8')]};}):[]};}):[]};}):[]:[]})[_0x4531('0xc')](function(_0x51acec){logger['info'](_0x4531('0x12'),_0x55d29d);logger[_0x4531('0xe')]('ShowInterval',_0x55d29d,JSON[_0x4531('0x14')](_0x51acec));_0x525982(_0x51acec);})[_0x4531('0xf')](function(_0x1d8964){logger[_0x4531('0x10')](_0x4531('0x12'),_0x1d8964['message'],_0x55d29d);_0x40d28a(_0x31f4b0[_0x4531('0x10')](0x1f4,_0x1d8964[_0x4531('0x11')]));});});};function checkArrayOfIntervals(_0x5006b6,_0x432d8c){var _0x20ea69=[];return db[_0x4531('0x5')][_0x4531('0x15')]({'where':{'id':_0x5006b6}})['then'](function(_0x1db01a){_0x20ea69=_0x1db01a;return Promise[_0x4531('0x16')](_0x20ea69[_0x4531('0x9')](function(_0x3199a7){return _0x3199a7[_0x4531('0x17')](_0x432d8c);}));})[_0x4531('0xc')](function(_0x509dbb){var _0x3af26d=_0x509dbb[_0x4531('0x18')](function(_0x279dbb,_0x2a7280){return _0x279dbb||_0x2a7280;},![]);logger[_0x4531('0xd')](util[_0x4531('0x19')](_0x4531('0x1a'),_0x20ea69[_0x4531('0x9')](function(_0xe1f8a){return _0xe1f8a[_0x4531('0x1b')];})[_0x4531('0x1c')](',\x20'),_0x20ea69['map'](function(_0x454fb9){return _0x454fb9['id'];})[_0x4531('0x1c')](',\x20')));return _0x3af26d;});}function checkSingleInterval(_0x45ed7b,_0x24d1fa){return db[_0x4531('0x5')][_0x4531('0x1d')](_0x45ed7b)['then'](function(_0x1455c4){if(_0x1455c4){logger[_0x4531('0xd')](util[_0x4531('0x19')](_0x4531('0x1e'),_0x1455c4[_0x4531('0x1b')],_0x1455c4['id']));return _0x1455c4[_0x4531('0x17')](_0x24d1fa);}});}exports[_0x4531('0x1f')]=function(_0x58bbfa){var _0x660100=_0x58bbfa[_0x4531('0x20')];var _0x255708=Array['isArray'](_0x58bbfa['intervals'])?_0x58bbfa[_0x4531('0x21')]:typeof _0x58bbfa[_0x4531('0x21')]===_0x4531('0x22')?[_0x58bbfa[_0x4531('0x21')]]:[];var _0x282230=_0x58bbfa[_0x4531('0x23')]||undefined;var _0x5b0657=![];if(_0x255708[_0x4531('0x24')]){logger['info'](util['format'](_0x4531('0x25'),_0x255708[_0x4531('0x1c')](';\x20')));}if(_0x282230){logger[_0x4531('0xd')](util[_0x4531('0x19')](_0x4531('0x26'),_0x282230));}logger[_0x4531('0xe')]('Iftime',_0x5b0657);logger[_0x4531('0x27')](_0x4531('0x1f'),_0x58bbfa);return Promise[_0x4531('0x28')]()[_0x4531('0xc')](function(){if(Array[_0x4531('0x29')](_0x660100)){return checkArrayOfIntervals(_0x660100,_0x282230);}else if(_0x660100){return checkSingleInterval(_0x660100,_0x282230);}})['then'](function(_0x9bc419){var _0x1e38a2=_0x255708[_0x4531('0x18')](function(_0x1997cc,_0x3ab5a0){return _0x1997cc||iftime(_0x3ab5a0,_0x282230);},![]);_0x5b0657=_0x9bc419||_0x1e38a2;return _0x5b0657;})[_0x4531('0xf')](function(_0x250b63){logger[_0x4531('0x10')](_0x4531('0x1f'),_0x58bbfa,_0x250b63);throw this[_0x4531('0x10')](0x1f4,_0x250b63[_0x4531('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index bb9f96f..ba36487 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x4dbbfd,_0x36a14c){var _0x132ab7=function(_0x36624c){while(--_0x36624c){_0x4dbbfd['push'](_0x4dbbfd['shift']());}};_0x132ab7(++_0x36a14c);}(_0xdb28,0x106));var _0x8db2=function(_0x42ec7f,_0x4c12f9){_0x42ec7f=_0x42ec7f-0x0;var _0x2fc3e3=_0xdb28[_0x42ec7f];return _0x2fc3e3;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8eb3d9e..8f947e5 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 _0xae73=['newToken','customfield_11503','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','json','parse','error','api.jira','write','openIssue','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502'];(function(_0x306ee5,_0x2866b9){var _0xb53cce=function(_0x544ec6){while(--_0x544ec6){_0x306ee5['push'](_0x306ee5['shift']());}};_0xb53cce(++_0x2866b9);}(_0xae73,0x1c4));var _0x3ae7=function(_0x304e0e,_0x2654a3){_0x304e0e=_0x304e0e-0x0;var _0x4449c8=_0xae73[_0x304e0e];return _0x4449c8;};'use strict';var BPromise=require(_0x3ae7('0x0'));var https=require(_0x3ae7('0x1'));var logger=require('../../config/logger')(_0x3ae7('0x2'));var USERNAME=_0x3ae7('0x3');var PASSWORD=_0x3ae7('0x4');function openIssue(_0x535896,_0x428516){var _0xb266ca={'fields':{'project':{'key':_0x535896[_0x3ae7('0x5')]||_0x3ae7('0x6')},'summary':(_0x535896['summary']||_0x3ae7('0x7'))+_0x3ae7('0x8')+_0x535896['ip'],'description':_0x535896[_0x3ae7('0x9')]||JSON[_0x3ae7('0xa')](_0x535896),'issuetype':{'name':_0x535896[_0x3ae7('0xb')]||_0x3ae7('0xc')}}};_0xb266ca['fields'][_0x3ae7('0xd')]=_0x535896[_0x3ae7('0xe')];_0xb266ca[_0x3ae7('0xf')][_0x3ae7('0x10')]=_0x535896['oldToken'];_0xb266ca[_0x3ae7('0xf')][_0x3ae7('0x11')]=_0x535896[_0x3ae7('0x12')];_0xb266ca['fields'][_0x3ae7('0x13')]=_0x535896['name'];_0xb266ca[_0x3ae7('0xf')][_0x3ae7('0x14')]=_0x535896[_0x3ae7('0x15')];_0xb266ca['fields'][_0x3ae7('0x16')]=_0x535896['ip'];var _0x47a5b4={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3ae7('0x17'),'method':_0x3ae7('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x3ae7('0x19'),'Authorization':_0x3ae7('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x3ae7('0x1b')](_0x3ae7('0x1c'))}};var _0x50a4fd=JSON[_0x3ae7('0xa')](_0xb266ca);var _0x396556=https[_0x3ae7('0x1d')](_0x47a5b4,function(_0x3b5589){_0x3b5589[_0x3ae7('0x1e')](_0x3ae7('0x1f'));var _0x3bd82a='';_0x3b5589['on'](_0x3ae7('0x20'),function(_0x4a9149){_0x3bd82a+=_0x4a9149;});_0x3b5589['on']('end',function(){if(_0x428516){return _0x428516[_0x3ae7('0x21')](_0x3b5589[_0x3ae7('0x22')])[_0x3ae7('0x23')](JSON[_0x3ae7('0x24')](_0x3bd82a));}});});_0x396556['on'](_0x3ae7('0x25'),function(_0x318ab6){if(_0x428516){return _0x428516[_0x3ae7('0x21')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3ae7('0x26')}]});}});_0x396556[_0x3ae7('0x27')](_0x50a4fd);_0x396556['end']();}exports[_0x3ae7('0x28')]=openIssue;exports['send']=function(_0x517d45,_0x1c0011){_0x517d45[_0x3ae7('0x29')]['ip']=_0x517d45[_0x3ae7('0x2a')][_0x3ae7('0x2b')]||_0x517d45['connection'][_0x3ae7('0x2c')]||_0x517d45['socket']['remoteAddress']||_0x517d45[_0x3ae7('0x2d')][_0x3ae7('0x2e')][_0x3ae7('0x2c')];return openIssue(_0x517d45[_0x3ae7('0x29')],_0x1c0011);}; \ No newline at end of file +var _0xccf3=['name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','setEncoding','end','status','json','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','3eAmWpBVP0','key','MOTGUI','summary','Report','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','customfield_11503'];(function(_0x449b53,_0x25c4bb){var _0x31990b=function(_0x5bee77){while(--_0x5bee77){_0x449b53['push'](_0x449b53['shift']());}};_0x31990b(++_0x25c4bb);}(_0xccf3,0x177));var _0x3ccf=function(_0x1328a0,_0x39dcbf){_0x1328a0=_0x1328a0-0x0;var _0x53f4f9=_0xccf3[_0x1328a0];return _0x53f4f9;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x3ccf('0x0');function openIssue(_0x1739c0,_0x104cac){var _0x592f2c={'fields':{'project':{'key':_0x1739c0[_0x3ccf('0x1')]||_0x3ccf('0x2')},'summary':(_0x1739c0[_0x3ccf('0x3')]||_0x3ccf('0x4'))+'\x20from\x20'+_0x1739c0['ip'],'description':_0x1739c0['description']||JSON[_0x3ccf('0x5')](_0x1739c0),'issuetype':{'name':_0x1739c0[_0x3ccf('0x6')]||_0x3ccf('0x7')}}};_0x592f2c['fields'][_0x3ccf('0x8')]=_0x1739c0[_0x3ccf('0x9')];_0x592f2c[_0x3ccf('0xa')][_0x3ccf('0xb')]=_0x1739c0[_0x3ccf('0xc')];_0x592f2c[_0x3ccf('0xa')][_0x3ccf('0xd')]=_0x1739c0['newToken'];_0x592f2c[_0x3ccf('0xa')][_0x3ccf('0xe')]=_0x1739c0[_0x3ccf('0xf')];_0x592f2c[_0x3ccf('0xa')][_0x3ccf('0x10')]=_0x1739c0[_0x3ccf('0x11')];_0x592f2c[_0x3ccf('0xa')][_0x3ccf('0x12')]=_0x1739c0['ip'];var _0x101212={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3ccf('0x13'),'method':_0x3ccf('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x3ccf('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x3ccf('0x16')](_0x3ccf('0x17'))}};var _0x20b485=JSON['stringify'](_0x592f2c);var _0x1838e5=https['request'](_0x101212,function(_0xb26065){_0xb26065[_0x3ccf('0x18')]('utf8');var _0x4a0e23='';_0xb26065['on']('data',function(_0x1fc83b){_0x4a0e23+=_0x1fc83b;});_0xb26065['on'](_0x3ccf('0x19'),function(){if(_0x104cac){return _0x104cac[_0x3ccf('0x1a')](_0xb26065['statusCode'])[_0x3ccf('0x1b')](JSON['parse'](_0x4a0e23));}});});_0x1838e5['on'](_0x3ccf('0x1c'),function(_0x21ea4e){if(_0x104cac){return _0x104cac[_0x3ccf('0x1a')](0x1f4)[_0x3ccf('0x1b')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3ccf('0x1d')}]});}});_0x1838e5[_0x3ccf('0x1e')](_0x20b485);_0x1838e5[_0x3ccf('0x19')]();}exports[_0x3ccf('0x1f')]=openIssue;exports[_0x3ccf('0x20')]=function(_0x616cd5,_0x2ebe08){_0x616cd5[_0x3ccf('0x21')]['ip']=_0x616cd5[_0x3ccf('0x22')][_0x3ccf('0x23')]||_0x616cd5[_0x3ccf('0x24')]['remoteAddress']||_0x616cd5[_0x3ccf('0x25')][_0x3ccf('0x26')]||_0x616cd5[_0x3ccf('0x24')][_0x3ccf('0x25')][_0x3ccf('0x26')];return openIssue(_0x616cd5[_0x3ccf('0x21')],_0x2ebe08);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index fda6432..51ae887 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 _0x91a7=['Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x49d940,_0x516f31){var _0x3201be=function(_0x311c8c){while(--_0x311c8c){_0x49d940['push'](_0x49d940['shift']());}};_0x3201be(++_0x516f31);}(_0x91a7,0xe7));var _0x791a=function(_0x2d9fdf,_0xa94c69){_0x2d9fdf=_0x2d9fdf-0x0;var _0x3e6e38=_0x91a7[_0x2d9fdf];return _0x3e6e38;};'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 +var _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x3fc2c0,_0x459cae){var _0x210004=function(_0x40d1bf){while(--_0x40d1bf){_0x3fc2c0['push'](_0x3fc2c0['shift']());}};_0x210004(++_0x459cae);}(_0x1be1,0x192));var _0x11be=function(_0x119ffb,_0xbb7485){_0x119ffb=_0x119ffb-0x0;var _0x1f1889=_0x1be1[_0x119ffb];return _0x1f1889;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 309e17d..3e3deaf 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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x2b786a,_0x30061b){_0x2b786a=_0x2b786a-0x0;var _0x19064b=_0x7a54[_0x2b786a];return _0x19064b;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x5e1241,_0x5844d4){_0x5e1241=_0x5e1241-0x0;var _0x4eb6c7=_0x7a54[_0x5e1241];return _0x4eb6c7;};'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 58e88ce..08b5e8f 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 _0x10af=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','then','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','pick','filters','filter','where','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x482816,_0x35e716){var _0xb89169=function(_0x379c49){while(--_0x379c49){_0x482816['push'](_0x482816['shift']());}};_0xb89169(++_0x35e716);}(_0x10af,0xfc));var _0xf10a=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x10af[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require(_0xf10a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf10a('0x1'));var jsonpatch=require(_0xf10a('0x2'));var rp=require(_0xf10a('0x3'));var moment=require(_0xf10a('0x4'));var BPromise=require(_0xf10a('0x5'));var Mustache=require(_0xf10a('0x6'));var util=require(_0xf10a('0x7'));var path=require(_0xf10a('0x8'));var sox=require('sox');var csv=require(_0xf10a('0x9'));var ejs=require(_0xf10a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf10a('0xb'));var crypto=require(_0xf10a('0xc'));var jsforce=require(_0xf10a('0xd'));var deskjs=require(_0xf10a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf10a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf10a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf10a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf10a('0x12'))('api');var utils=require(_0xf10a('0x13'));var config=require(_0xf10a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf10a('0x15'))['db'];function respondWithStatusCode(_0x24632c,_0x4191bb){_0x4191bb=_0x4191bb||0xcc;return function(_0x22ffab){if(_0x22ffab){return _0x24632c[_0xf10a('0x16')](_0x4191bb);}return _0x24632c[_0xf10a('0x17')](_0x4191bb)[_0xf10a('0x18')]();};}function respondWithResult(_0x305767,_0xe03766){_0xe03766=_0xe03766||0xc8;return function(_0x50ba60){if(_0x50ba60){return _0x305767[_0xf10a('0x17')](_0xe03766)['json'](_0x50ba60);}};}function respondWithFilteredResult(_0x5b72ad,_0x26f4a5){return function(_0x3117cd){if(_0x3117cd){var _0x484c3a=typeof _0x26f4a5[_0xf10a('0x19')]===_0xf10a('0x1a')&&typeof _0x26f4a5['limit']===_0xf10a('0x1a');var _0x10ab5=_0x3117cd[_0xf10a('0x1b')];var _0x1deaa1=_0x484c3a?0x0:_0x26f4a5[_0xf10a('0x19')];var _0x20a858=_0x484c3a?_0x3117cd[_0xf10a('0x1b')]:_0x26f4a5[_0xf10a('0x19')]+_0x26f4a5[_0xf10a('0x1c')];var _0x463e75;if(_0x20a858>=_0x10ab5){_0x20a858=_0x10ab5;_0x463e75=0xc8;}else{_0x463e75=0xce;}_0x5b72ad[_0xf10a('0x17')](_0x463e75);return _0x5b72ad['set'](_0xf10a('0x1d'),_0x1deaa1+'-'+_0x20a858+'/'+_0x10ab5)[_0xf10a('0x1e')](_0x3117cd);}return null;};}function patchUpdates(_0xa1614e){return function(_0x4db4b0){try{jsonpatch[_0xf10a('0x1f')](_0x4db4b0,_0xa1614e,!![]);}catch(_0x5c55b0){return BPromise['reject'](_0x5c55b0);}return _0x4db4b0['save']();};}function saveUpdates(_0x135fc0,_0x3b61d8){return function(_0x2dc858){if(_0x2dc858){return _0x2dc858['update'](_0x135fc0)[_0xf10a('0x20')](function(_0x429a75){return _0x429a75;});}return null;};}function removeEntity(_0x569bb5,_0xc760e8){return function(_0x439e48){if(_0x439e48){return _0x439e48['destroy']()[_0xf10a('0x20')](function(){_0x569bb5[_0xf10a('0x17')](0xcc)[_0xf10a('0x18')]();});}};}function handleEntityNotFound(_0x4defdf,_0x33866c){return function(_0x4834b5){if(!_0x4834b5){_0x4defdf[_0xf10a('0x16')](0x194);}return _0x4834b5;};}function handleError(_0x1ef7f3,_0x1550b4){_0x1550b4=_0x1550b4||0x1f4;return function(_0x547bb7){logger['error'](_0x547bb7['stack']);if(_0x547bb7[_0xf10a('0x21')]){delete _0x547bb7['name'];}_0x1ef7f3['status'](_0x1550b4)[_0xf10a('0x22')](_0x547bb7);};}exports[_0xf10a('0x23')]=function(_0x3cf00d,_0x47d800){var _0x39b99b={},_0x265a74={},_0x1ad807={'count':0x0,'rows':[]};var _0x457a53=_[_0xf10a('0x24')](db[_0xf10a('0x25')][_0xf10a('0x26')],function(_0x5cd734){return{'name':_0x5cd734[_0xf10a('0x27')],'type':_0x5cd734[_0xf10a('0x28')]['key']};});_0x265a74[_0xf10a('0x29')]=_[_0xf10a('0x24')](_0x457a53,_0xf10a('0x21'));_0x265a74[_0xf10a('0x2a')]=_['keys'](_0x3cf00d['query']);_0x265a74['filters']=_[_0xf10a('0x2b')](_0x265a74[_0xf10a('0x29')],_0x265a74[_0xf10a('0x2a')]);_0x39b99b[_0xf10a('0x2c')]=_[_0xf10a('0x2b')](_0x265a74[_0xf10a('0x29')],qs[_0xf10a('0x2d')](_0x3cf00d['query'][_0xf10a('0x2d')]));_0x39b99b['attributes']=_0x39b99b[_0xf10a('0x2c')]['length']?_0x39b99b[_0xf10a('0x2c')]:_0x265a74[_0xf10a('0x29')];if(!_0x3cf00d[_0xf10a('0x2a')]['hasOwnProperty'](_0xf10a('0x2e'))){_0x39b99b['limit']=qs['limit'](_0x3cf00d[_0xf10a('0x2a')]['limit']);_0x39b99b[_0xf10a('0x19')]=qs['offset'](_0x3cf00d[_0xf10a('0x2a')][_0xf10a('0x19')]);}_0x39b99b[_0xf10a('0x2f')]=qs[_0xf10a('0x30')](_0x3cf00d[_0xf10a('0x2a')][_0xf10a('0x30')]);_0x39b99b['where']=qs['filters'](_[_0xf10a('0x31')](_0x3cf00d[_0xf10a('0x2a')],_0x265a74[_0xf10a('0x32')]),_0x457a53);if(_0x3cf00d[_0xf10a('0x2a')][_0xf10a('0x33')]){_0x39b99b[_0xf10a('0x34')]=_['merge'](_0x39b99b[_0xf10a('0x34')],{'$or':_[_0xf10a('0x24')](_0x457a53,function(_0x2ad05b){if(_0x2ad05b[_0xf10a('0x28')]!=='VIRTUAL'){var _0x31cb95={};_0x31cb95[_0x2ad05b[_0xf10a('0x21')]]={'$like':'%'+_0x3cf00d[_0xf10a('0x2a')][_0xf10a('0x33')]+'%'};return _0x31cb95;}})});}_0x39b99b=_['merge']({},_0x39b99b,_0x3cf00d[_0xf10a('0x35')]);var _0x5a9717={'where':_0x39b99b['where']};return db[_0xf10a('0x25')][_0xf10a('0x1b')](_0x5a9717)[_0xf10a('0x20')](function(_0x599c94){_0x1ad807[_0xf10a('0x1b')]=_0x599c94;if(_0x3cf00d[_0xf10a('0x2a')]['includeAll']){_0x39b99b[_0xf10a('0x36')]=[{'all':!![]}];}return db[_0xf10a('0x25')][_0xf10a('0x37')](_0x39b99b);})[_0xf10a('0x20')](function(_0x1bd2a7){_0x1ad807[_0xf10a('0x38')]=_0x1bd2a7;return _0x1ad807;})['then'](respondWithFilteredResult(_0x47d800,_0x39b99b))[_0xf10a('0x39')](handleError(_0x47d800,null));};exports[_0xf10a('0x3a')]=function(_0x18dc00,_0x5ca33c){var _0x2782c1={'raw':!![],'where':{'id':_0x18dc00['params']['id']}},_0x5ee6b8={};_0x5ee6b8[_0xf10a('0x29')]=_[_0xf10a('0x3b')](db[_0xf10a('0x25')][_0xf10a('0x26')]);_0x5ee6b8[_0xf10a('0x2a')]=_[_0xf10a('0x3b')](_0x18dc00[_0xf10a('0x2a')]);_0x5ee6b8[_0xf10a('0x32')]=_[_0xf10a('0x2b')](_0x5ee6b8['model'],_0x5ee6b8['query']);_0x2782c1[_0xf10a('0x2c')]=_['intersection'](_0x5ee6b8[_0xf10a('0x29')],qs[_0xf10a('0x2d')](_0x18dc00[_0xf10a('0x2a')][_0xf10a('0x2d')]));_0x2782c1[_0xf10a('0x2c')]=_0x2782c1['attributes'][_0xf10a('0x3c')]?_0x2782c1[_0xf10a('0x2c')]:_0x5ee6b8[_0xf10a('0x29')];if(_0x18dc00['query'][_0xf10a('0x3d')]){_0x2782c1[_0xf10a('0x36')]=[{'all':!![]}];}_0x2782c1=_['merge']({},_0x2782c1,_0x18dc00[_0xf10a('0x35')]);return db[_0xf10a('0x25')][_0xf10a('0x3e')](_0x2782c1)[_0xf10a('0x20')](handleEntityNotFound(_0x5ca33c,null))[_0xf10a('0x20')](respondWithResult(_0x5ca33c,null))['catch'](handleError(_0x5ca33c,null));};exports[_0xf10a('0x3f')]=function(_0x3803ce,_0x26e6ca){return db['JscriptyAnswerReport'][_0xf10a('0x3f')](_0x3803ce[_0xf10a('0x40')],{})[_0xf10a('0x20')](respondWithResult(_0x26e6ca,0xc9))[_0xf10a('0x39')](handleError(_0x26e6ca,null));};exports['update']=function(_0xe56343,_0x4ad1ac){if(_0xe56343['body']['id']){delete _0xe56343[_0xf10a('0x40')]['id'];}return db['JscriptyAnswerReport'][_0xf10a('0x3e')]({'where':{'id':_0xe56343[_0xf10a('0x41')]['id']}})[_0xf10a('0x20')](handleEntityNotFound(_0x4ad1ac,null))[_0xf10a('0x20')](saveUpdates(_0xe56343[_0xf10a('0x40')],null))['then'](respondWithResult(_0x4ad1ac,null))['catch'](handleError(_0x4ad1ac,null));};exports[_0xf10a('0x42')]=function(_0xa6f668,_0x56c6ce){return db['JscriptyAnswerReport'][_0xf10a('0x3e')]({'where':{'id':_0xa6f668[_0xf10a('0x41')]['id']}})[_0xf10a('0x20')](handleEntityNotFound(_0x56c6ce,null))['then'](removeEntity(_0x56c6ce,null))['catch'](handleError(_0x56c6ce,null));};exports[_0xf10a('0x43')]=function(_0x3d0dfb,_0x3cf73f){return db[_0xf10a('0x25')][_0xf10a('0x43')]()[_0xf10a('0x20')](respondWithResult(_0x3cf73f,null))[_0xf10a('0x39')](handleError(_0x3cf73f,null));}; \ No newline at end of file +var _0x1b65=['crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x23f555,_0x11aa29){var _0x1c3b90=function(_0x532777){while(--_0x532777){_0x23f555['push'](_0x23f555['shift']());}};_0x1c3b90(++_0x11aa29);}(_0x1b65,0x1b4));var _0x51b6=function(_0x3a023f,_0x3a0789){_0x3a023f=_0x3a023f-0x0;var _0x1de363=_0x1b65[_0x3a023f];return _0x1de363;};'use strict';var emlformat=require(_0x51b6('0x0'));var rimraf=require(_0x51b6('0x1'));var zipdir=require(_0x51b6('0x2'));var jsonpatch=require(_0x51b6('0x3'));var rp=require('request-promise');var moment=require(_0x51b6('0x4'));var BPromise=require(_0x51b6('0x5'));var Mustache=require(_0x51b6('0x6'));var util=require(_0x51b6('0x7'));var path=require(_0x51b6('0x8'));var sox=require(_0x51b6('0x9'));var csv=require(_0x51b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51b6('0xb'));var _=require(_0x51b6('0xc'));var squel=require(_0x51b6('0xd'));var crypto=require(_0x51b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51b6('0xf'));var toCsv=require(_0x51b6('0xa'));var querystring=require('querystring');var Papa=require(_0x51b6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x11'));var as=require(_0x51b6('0x12'));var hardwareService=require(_0x51b6('0x13'));var logger=require(_0x51b6('0x14'))(_0x51b6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51b6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd605,_0x422bd4){_0x422bd4=_0x422bd4||0xcc;return function(_0x4ca143){if(_0x4ca143){return _0x4cd605[_0x51b6('0x17')](_0x422bd4);}return _0x4cd605['status'](_0x422bd4)[_0x51b6('0x18')]();};}function respondWithResult(_0x24a386,_0x2890ee){_0x2890ee=_0x2890ee||0xc8;return function(_0x235d8c){if(_0x235d8c){return _0x24a386[_0x51b6('0x19')](_0x2890ee)[_0x51b6('0x1a')](_0x235d8c);}};}function respondWithFilteredResult(_0x4c6cd0,_0x23549b){return function(_0x596863){if(_0x596863){var _0x39583d=typeof _0x23549b['offset']===_0x51b6('0x1b')&&typeof _0x23549b['limit']===_0x51b6('0x1b');var _0x22ffa3=_0x596863[_0x51b6('0x1c')];var _0x3ae3c7=_0x39583d?0x0:_0x23549b[_0x51b6('0x1d')];var _0x22c6da=_0x39583d?_0x596863['count']:_0x23549b[_0x51b6('0x1d')]+_0x23549b['limit'];var _0x2974f0;if(_0x22c6da>=_0x22ffa3){_0x22c6da=_0x22ffa3;_0x2974f0=0xc8;}else{_0x2974f0=0xce;}_0x4c6cd0[_0x51b6('0x19')](_0x2974f0);return _0x4c6cd0['set'](_0x51b6('0x1e'),_0x3ae3c7+'-'+_0x22c6da+'/'+_0x22ffa3)[_0x51b6('0x1a')](_0x596863);}return null;};}function patchUpdates(_0x3fee21){return function(_0x471783){try{jsonpatch[_0x51b6('0x1f')](_0x471783,_0x3fee21,!![]);}catch(_0x663b44){return BPromise[_0x51b6('0x20')](_0x663b44);}return _0x471783[_0x51b6('0x21')]();};}function saveUpdates(_0x4ab876,_0x35d2ab){return function(_0x11db4e){if(_0x11db4e){return _0x11db4e[_0x51b6('0x22')](_0x4ab876)[_0x51b6('0x23')](function(_0x53e709){return _0x53e709;});}return null;};}function removeEntity(_0x3d3456,_0x3680af){return function(_0x51c013){if(_0x51c013){return _0x51c013['destroy']()[_0x51b6('0x23')](function(){_0x3d3456[_0x51b6('0x19')](0xcc)[_0x51b6('0x18')]();});}};}function handleEntityNotFound(_0x59193e,_0x4c1825){return function(_0x22b91b){if(!_0x22b91b){_0x59193e[_0x51b6('0x17')](0x194);}return _0x22b91b;};}function handleError(_0x8c0881,_0x4a5ff8){_0x4a5ff8=_0x4a5ff8||0x1f4;return function(_0x2842b2){logger[_0x51b6('0x24')](_0x2842b2[_0x51b6('0x25')]);if(_0x2842b2[_0x51b6('0x26')]){delete _0x2842b2[_0x51b6('0x26')];}_0x8c0881[_0x51b6('0x19')](_0x4a5ff8)[_0x51b6('0x27')](_0x2842b2);};}exports[_0x51b6('0x28')]=function(_0x51b505,_0x2dc770){var _0x226018={},_0x276443={},_0x48eb13={'count':0x0,'rows':[]};var _0x38f855=_[_0x51b6('0x29')](db[_0x51b6('0x2a')][_0x51b6('0x2b')],function(_0x5c7c35){return{'name':_0x5c7c35[_0x51b6('0x2c')],'type':_0x5c7c35['type'][_0x51b6('0x2d')]};});_0x276443[_0x51b6('0x2e')]=_['map'](_0x38f855,'name');_0x276443[_0x51b6('0x2f')]=_[_0x51b6('0x30')](_0x51b505['query']);_0x276443[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x276443['model'],_0x276443[_0x51b6('0x2f')]);_0x226018[_0x51b6('0x33')]=_[_0x51b6('0x32')](_0x276443['model'],qs[_0x51b6('0x34')](_0x51b505['query'][_0x51b6('0x34')]));_0x226018[_0x51b6('0x33')]=_0x226018[_0x51b6('0x33')][_0x51b6('0x35')]?_0x226018[_0x51b6('0x33')]:_0x276443[_0x51b6('0x2e')];if(!_0x51b505[_0x51b6('0x2f')][_0x51b6('0x36')]('nolimit')){_0x226018[_0x51b6('0x37')]=qs[_0x51b6('0x37')](_0x51b505['query'][_0x51b6('0x37')]);_0x226018['offset']=qs[_0x51b6('0x1d')](_0x51b505[_0x51b6('0x2f')][_0x51b6('0x1d')]);}_0x226018['order']=qs[_0x51b6('0x38')](_0x51b505[_0x51b6('0x2f')]['sort']);_0x226018[_0x51b6('0x39')]=qs[_0x51b6('0x31')](_[_0x51b6('0x3a')](_0x51b505[_0x51b6('0x2f')],_0x276443[_0x51b6('0x31')]),_0x38f855);if(_0x51b505[_0x51b6('0x2f')][_0x51b6('0x3b')]){_0x226018[_0x51b6('0x39')]=_[_0x51b6('0x3c')](_0x226018[_0x51b6('0x39')],{'$or':_[_0x51b6('0x29')](_0x38f855,function(_0x234d5e){if(_0x234d5e[_0x51b6('0x3d')]!==_0x51b6('0x3e')){var _0x28d14f={};_0x28d14f[_0x234d5e[_0x51b6('0x26')]]={'$like':'%'+_0x51b505['query'][_0x51b6('0x3b')]+'%'};return _0x28d14f;}})});}_0x226018=_['merge']({},_0x226018,_0x51b505[_0x51b6('0x3f')]);var _0x4ad444={'where':_0x226018[_0x51b6('0x39')]};return db[_0x51b6('0x2a')]['count'](_0x4ad444)[_0x51b6('0x23')](function(_0x2b6dd6){_0x48eb13['count']=_0x2b6dd6;if(_0x51b505[_0x51b6('0x2f')][_0x51b6('0x40')]){_0x226018[_0x51b6('0x41')]=[{'all':!![]}];}return db[_0x51b6('0x2a')][_0x51b6('0x42')](_0x226018);})['then'](function(_0x588a05){_0x48eb13['rows']=_0x588a05;return _0x48eb13;})[_0x51b6('0x23')](respondWithFilteredResult(_0x2dc770,_0x226018))[_0x51b6('0x43')](handleError(_0x2dc770,null));};exports[_0x51b6('0x44')]=function(_0xda309d,_0x2c3f6e){var _0x588fc6={'raw':!![],'where':{'id':_0xda309d[_0x51b6('0x45')]['id']}},_0x498717={};_0x498717[_0x51b6('0x2e')]=_[_0x51b6('0x30')](db['JscriptyAnswerReport'][_0x51b6('0x2b')]);_0x498717['query']=_[_0x51b6('0x30')](_0xda309d['query']);_0x498717[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x498717[_0x51b6('0x2e')],_0x498717['query']);_0x588fc6[_0x51b6('0x33')]=_[_0x51b6('0x32')](_0x498717[_0x51b6('0x2e')],qs[_0x51b6('0x34')](_0xda309d[_0x51b6('0x2f')]['fields']));_0x588fc6[_0x51b6('0x33')]=_0x588fc6[_0x51b6('0x33')]['length']?_0x588fc6[_0x51b6('0x33')]:_0x498717[_0x51b6('0x2e')];if(_0xda309d['query']['includeAll']){_0x588fc6['include']=[{'all':!![]}];}_0x588fc6=_['merge']({},_0x588fc6,_0xda309d['options']);return db['JscriptyAnswerReport'][_0x51b6('0x46')](_0x588fc6)['then'](handleEntityNotFound(_0x2c3f6e,null))[_0x51b6('0x23')](respondWithResult(_0x2c3f6e,null))[_0x51b6('0x43')](handleError(_0x2c3f6e,null));};exports[_0x51b6('0x47')]=function(_0x21a7ab,_0x4562c6){return db[_0x51b6('0x2a')]['create'](_0x21a7ab[_0x51b6('0x48')],{})['then'](respondWithResult(_0x4562c6,0xc9))[_0x51b6('0x43')](handleError(_0x4562c6,null));};exports[_0x51b6('0x22')]=function(_0x594bb2,_0x44f9d4){if(_0x594bb2[_0x51b6('0x48')]['id']){delete _0x594bb2[_0x51b6('0x48')]['id'];}return db[_0x51b6('0x2a')]['find']({'where':{'id':_0x594bb2[_0x51b6('0x45')]['id']}})[_0x51b6('0x23')](handleEntityNotFound(_0x44f9d4,null))[_0x51b6('0x23')](saveUpdates(_0x594bb2[_0x51b6('0x48')],null))[_0x51b6('0x23')](respondWithResult(_0x44f9d4,null))[_0x51b6('0x43')](handleError(_0x44f9d4,null));};exports[_0x51b6('0x49')]=function(_0x3c977a,_0x27a4e4){return db[_0x51b6('0x2a')][_0x51b6('0x46')]({'where':{'id':_0x3c977a['params']['id']}})[_0x51b6('0x23')](handleEntityNotFound(_0x27a4e4,null))[_0x51b6('0x23')](removeEntity(_0x27a4e4,null))[_0x51b6('0x43')](handleError(_0x27a4e4,null));};exports[_0x51b6('0x4a')]=function(_0x75e143,_0xe6e07a){return db[_0x51b6('0x2a')][_0x51b6('0x4a')]()[_0x51b6('0x23')](respondWithResult(_0xe6e07a,null))[_0x51b6('0x43')](handleError(_0xe6e07a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 15907c9..471d4c2 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 _0xe028=['request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','util','../../config/logger','api','moment','bluebird'];(function(_0x1042b9,_0x4a42fe){var _0x4a8ec6=function(_0x2a6ed1){while(--_0x2a6ed1){_0x1042b9['push'](_0x1042b9['shift']());}};_0x4a8ec6(++_0x4a42fe);}(_0xe028,0x195));var _0x8e02=function(_0x25ea2a,_0x33c1ec){_0x25ea2a=_0x25ea2a-0x0;var _0x127a45=_0xe028[_0x25ea2a];return _0x127a45;};'use strict';var _=require('lodash');var util=require(_0x8e02('0x0'));var logger=require(_0x8e02('0x1'))(_0x8e02('0x2'));var moment=require(_0x8e02('0x3'));var BPromise=require(_0x8e02('0x4'));var rp=require(_0x8e02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e02('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e02('0x7'));module[_0x8e02('0x8')]=function(_0x597f0e,_0x2e24ec){return _0x597f0e['define']('JscriptyAnswerReport',attributes,{'tableName':_0x8e02('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ef9=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x4b0e2d,_0x5e06b9){var _0x2703c2=function(_0x5b2bef){while(--_0x5b2bef){_0x4b0e2d['push'](_0x4b0e2d['shift']());}};_0x2703c2(++_0x5e06b9);}(_0x6ef9,0x7d));var _0x96ef=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6ef9[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x96ef('0x0'));var util=require(_0x96ef('0x1'));var logger=require(_0x96ef('0x2'))(_0x96ef('0x3'));var moment=require(_0x96ef('0x4'));var BPromise=require(_0x96ef('0x5'));var rp=require(_0x96ef('0x6'));var fs=require('fs');var path=require(_0x96ef('0x7'));var rimraf=require('rimraf');var config=require(_0x96ef('0x8'));var attributes=require(_0x96ef('0x9'));module[_0x96ef('0xa')]=function(_0x54adb0,_0x537b55){return _0x54adb0[_0x96ef('0xb')](_0x96ef('0xc'),attributes,{'tableName':_0x96ef('0xd'),'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 9a9e7a5..8e8a55b 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 _0xd1f5=['stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xd1f5,0x1bf));var _0x5d1f=function(_0x1ec6d9,_0x2c034d){_0x1ec6d9=_0x1ec6d9-0x0;var _0xd8189e=_0xd1f5[_0x1ec6d9];return _0xd8189e;};'use strict';var _=require('lodash');var util=require(_0x5d1f('0x0'));var moment=require(_0x5d1f('0x1'));var BPromise=require(_0x5d1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d1f('0x3'));var db=require(_0x5d1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5d1f('0x5'));var jayson=require(_0x5d1f('0x6'));var client=jayson[_0x5d1f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a623c,_0x2cf344,_0x1a5fde){return new BPromise(function(_0x3564f4,_0x193f4c){return client[_0x5d1f('0x8')](_0x1a623c,_0x1a5fde)[_0x5d1f('0x9')](function(_0x5e100c){logger['info'](_0x5d1f('0xa'),_0x2cf344,_0x5d1f('0xb'));logger['debug'](_0x5d1f('0xc'),_0x2cf344,'request\x20sent',JSON[_0x5d1f('0xd')](_0x5e100c));if(_0x5e100c[_0x5d1f('0xe')]){if(_0x5e100c[_0x5d1f('0xe')][_0x5d1f('0xf')]===0x1f4){logger['error'](_0x5d1f('0xa'),_0x2cf344,_0x5e100c['error'][_0x5d1f('0x10')]);return _0x193f4c(_0x5e100c[_0x5d1f('0xe')]['message']);}logger[_0x5d1f('0xe')](_0x5d1f('0xa'),_0x2cf344,_0x5e100c[_0x5d1f('0xe')][_0x5d1f('0x10')]);return _0x3564f4(_0x5e100c[_0x5d1f('0xe')][_0x5d1f('0x10')]);}else{logger[_0x5d1f('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cf344,_0x5d1f('0xb'));_0x3564f4(_0x5e100c[_0x5d1f('0x12')]['message']);}})[_0x5d1f('0x13')](function(_0x4935bb){logger[_0x5d1f('0xe')](_0x5d1f('0xa'),_0x2cf344,_0x4935bb);_0x193f4c(_0x4935bb);});});} \ No newline at end of file +var _0xef48=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x4dc0bc,_0x490bf0){var _0x470317=function(_0x324033){while(--_0x324033){_0x4dc0bc['push'](_0x4dc0bc['shift']());}};_0x470317(++_0x490bf0);}(_0xef48,0x17f));var _0x8ef4=function(_0x27e66c,_0x1379b8){_0x27e66c=_0x27e66c-0x0;var _0x358be1=_0xef48[_0x27e66c];return _0x358be1;};'use strict';var _=require(_0x8ef4('0x0'));var util=require(_0x8ef4('0x1'));var moment=require('moment');var BPromise=require(_0x8ef4('0x2'));var rs=require(_0x8ef4('0x3'));var fs=require('fs');var Redis=require(_0x8ef4('0x4'));var db=require(_0x8ef4('0x5'))['db'];var utils=require(_0x8ef4('0x6'));var logger=require(_0x8ef4('0x7'))('rpc');var config=require(_0x8ef4('0x8'));var jayson=require(_0x8ef4('0x9'));var client=jayson[_0x8ef4('0xa')][_0x8ef4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ac172,_0x78709d,_0x594f31){return new BPromise(function(_0x261dd6,_0x5770e7){return client[_0x8ef4('0xc')](_0x2ac172,_0x594f31)['then'](function(_0x13165f){logger[_0x8ef4('0xd')](_0x8ef4('0xe'),_0x78709d,_0x8ef4('0xf'));logger['debug'](_0x8ef4('0x10'),_0x78709d,_0x8ef4('0xf'),JSON[_0x8ef4('0x11')](_0x13165f));if(_0x13165f[_0x8ef4('0x12')]){if(_0x13165f[_0x8ef4('0x12')][_0x8ef4('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x78709d,_0x13165f[_0x8ef4('0x12')][_0x8ef4('0x14')]);return _0x5770e7(_0x13165f[_0x8ef4('0x12')]['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x78709d,_0x13165f[_0x8ef4('0x12')][_0x8ef4('0x14')]);return _0x261dd6(_0x13165f[_0x8ef4('0x12')][_0x8ef4('0x14')]);}else{logger[_0x8ef4('0xd')](_0x8ef4('0xe'),_0x78709d,'request\x20sent');_0x261dd6(_0x13165f[_0x8ef4('0x15')]['message']);}})['catch'](function(_0x141bdc){logger['error'](_0x8ef4('0xe'),_0x78709d,_0x141bdc);_0x5770e7(_0x141bdc);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0a2c25d..9bfc5fb 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 _0xeda0=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update'];(function(_0x1a3b56,_0x222655){var _0x46f4ee=function(_0x3d01cc){while(--_0x3d01cc){_0x1a3b56['push'](_0x1a3b56['shift']());}};_0x46f4ee(++_0x222655);}(_0xeda0,0xed));var _0x0eda=function(_0x4119e9,_0x3c0cf5){_0x4119e9=_0x4119e9-0x0;var _0x5e5774=_0xeda0[_0x4119e9];return _0x5e5774;};'use strict';var multer=require(_0x0eda('0x0'));var util=require(_0x0eda('0x1'));var path=require(_0x0eda('0x2'));var timeout=require(_0x0eda('0x3'));var express=require('express');var router=express[_0x0eda('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0eda('0x5'));var interaction=require(_0x0eda('0x6'));var config=require(_0x0eda('0x7'));var controller=require('./jscriptyProject.controller');router[_0x0eda('0x8')]('/',auth[_0x0eda('0x9')](),controller[_0x0eda('0xa')]);router['get'](_0x0eda('0xb'),auth[_0x0eda('0x9')](),controller[_0x0eda('0xc')]);router[_0x0eda('0x8')](_0x0eda('0xd'),auth[_0x0eda('0x9')](),controller['getSessions']);router[_0x0eda('0x8')]('/:id/answers',auth[_0x0eda('0x9')](),controller['getAnswers']);router[_0x0eda('0x8')](_0x0eda('0xe'),auth[_0x0eda('0x9')](),timeout(_0x0eda('0xf')),controller[_0x0eda('0x10')]);router[_0x0eda('0x11')]('/',auth['isAuthenticated'](),controller[_0x0eda('0x12')]);router[_0x0eda('0x11')](_0x0eda('0x13'),auth['isAuthenticated'](),controller[_0x0eda('0x14')]);router[_0x0eda('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x0eda('0x16')]);router[_0x0eda('0x17')](_0x0eda('0xb'),auth[_0x0eda('0x9')](),controller[_0x0eda('0x18')]);module[_0x0eda('0x19')]=router; \ No newline at end of file +var _0x2be5=['getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','/:id/summary'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x2be5,0x19a));var _0x52be=function(_0x4a8c11,_0x51c921){_0x4a8c11=_0x4a8c11-0x0;var _0x117508=_0x2be5[_0x4a8c11];return _0x117508;};'use strict';var multer=require(_0x52be('0x0'));var util=require(_0x52be('0x1'));var path=require(_0x52be('0x2'));var timeout=require(_0x52be('0x3'));var express=require(_0x52be('0x4'));var router=express[_0x52be('0x5')]();var fs_extra=require(_0x52be('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x52be('0x7'));router[_0x52be('0x8')]('/',auth[_0x52be('0x9')](),controller[_0x52be('0xa')]);router[_0x52be('0x8')]('/:id',auth[_0x52be('0x9')](),controller[_0x52be('0xb')]);router[_0x52be('0x8')](_0x52be('0xc'),auth['isAuthenticated'](),controller['getSessions']);router[_0x52be('0x8')](_0x52be('0xd'),auth[_0x52be('0x9')](),controller['getAnswers']);router[_0x52be('0x8')](_0x52be('0xe'),auth[_0x52be('0x9')](),timeout('30s'),controller[_0x52be('0xf')]);router[_0x52be('0x10')]('/',auth[_0x52be('0x9')](),controller['create']);router[_0x52be('0x10')](_0x52be('0x11'),auth[_0x52be('0x9')](),controller[_0x52be('0x12')]);router[_0x52be('0x13')](_0x52be('0x14'),auth[_0x52be('0x9')](),controller[_0x52be('0x15')]);router[_0x52be('0x16')]('/:id',auth[_0x52be('0x9')](),controller[_0x52be('0x17')]);module[_0x52be('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e0560ce..b617574 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 _0xfa5e=['name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING'];(function(_0x1b81ab,_0x3e2893){var _0x2c5af6=function(_0x17cb14){while(--_0x17cb14){_0x1b81ab['push'](_0x1b81ab['shift']());}};_0x2c5af6(++_0x3e2893);}(_0xfa5e,0x109));var _0xefa5=function(_0x28b640,_0x370a79){_0x28b640=_0x28b640-0x0;var _0x4f0b1a=_0xfa5e[_0x28b640];return _0x4f0b1a;};'use strict';var Sequelize=require(_0xefa5('0x0'));var _=require(_0xefa5('0x1'));var util=require(_0xefa5('0x2'));module[_0xefa5('0x3')]={'name':{'type':Sequelize[_0xefa5('0x4')],'unique':_0xefa5('0x5')},'description':{'type':Sequelize[_0xefa5('0x4')]},'formData':{'type':Sequelize[_0xefa5('0x6')](_0xefa5('0x7')),'set':function(_0x471432){if(_[_0xefa5('0x8')](_0x471432)){this[_0xefa5('0x9')](_0xefa5('0xa'),JSON[_0xefa5('0xb')](_0x471432));}else if(_[_0xefa5('0xc')](_0x471432)){this[_0xefa5('0x9')](_0xefa5('0xa'),_0x471432);}else{this[_0xefa5('0x9')](_0xefa5('0xa'),util[_0xefa5('0xd')](_0xefa5('0xe'),this[_0xefa5('0xf')]('name')||'',this['getDataValue'](_0xefa5('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xefa5('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xefa5('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0x0d53=['lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x0d53,0x11c));var _0x30d5=function(_0x3fb034,_0x5a12fe){_0x3fb034=_0x3fb034-0x0;var _0x21dd32=_0x0d53[_0x3fb034];return _0x21dd32;};'use strict';var Sequelize=require(_0x30d5('0x0'));var _=require(_0x30d5('0x1'));var util=require(_0x30d5('0x2'));module[_0x30d5('0x3')]={'name':{'type':Sequelize[_0x30d5('0x4')],'unique':_0x30d5('0x5')},'description':{'type':Sequelize[_0x30d5('0x4')]},'formData':{'type':Sequelize[_0x30d5('0x6')](_0x30d5('0x7')),'set':function(_0x1c856d){if(_[_0x30d5('0x8')](_0x1c856d)){this[_0x30d5('0x9')](_0x30d5('0xa'),JSON['stringify'](_0x1c856d));}else if(_['isString'](_0x1c856d)){this[_0x30d5('0x9')](_0x30d5('0xa'),_0x1c856d);}else{this[_0x30d5('0x9')](_0x30d5('0xa'),util[_0x30d5('0xb')](_0x30d5('0xc'),this[_0x30d5('0xd')](_0x30d5('0x5'))||'',this[_0x30d5('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x30d5('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 85e8427..748134b 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 _0x40a3=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','include','options','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','nolimit','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','getSummary','starttime','JscriptyQuestionReport','-createdAt','hasOwnProperty','questionId','question','format','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','request-promise','bluebird','mustache','util','path'];(function(_0x3b2573,_0x3c93f0){var _0xceb236=function(_0x67dc6){while(--_0x67dc6){_0x3b2573['push'](_0x3b2573['shift']());}};_0xceb236(++_0x3c93f0);}(_0x40a3,0x153));var _0x340a=function(_0x423da1,_0x596d06){_0x423da1=_0x423da1-0x0;var _0xe6eeaf=_0x40a3[_0x423da1];return _0xe6eeaf;};'use strict';var emlformat=require(_0x340a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x340a('0x1'));var moment=require('moment');var BPromise=require(_0x340a('0x2'));var Mustache=require(_0x340a('0x3'));var util=require(_0x340a('0x4'));var path=require(_0x340a('0x5'));var sox=require(_0x340a('0x6'));var csv=require(_0x340a('0x7'));var ejs=require(_0x340a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x340a('0x9'));var squel=require(_0x340a('0xa'));var crypto=require('crypto');var jsforce=require(_0x340a('0xb'));var deskjs=require(_0x340a('0xc'));var toCsv=require(_0x340a('0x7'));var querystring=require(_0x340a('0xd'));var Papa=require(_0x340a('0xe'));var Redis=require('ioredis');var authService=require(_0x340a('0xf'));var qs=require(_0x340a('0x10'));var as=require(_0x340a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x340a('0x12'))('api');var utils=require(_0x340a('0x13'));var config=require(_0x340a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x340a('0x15'))['db'];function respondWithStatusCode(_0x45b078,_0x315bc7){_0x315bc7=_0x315bc7||0xcc;return function(_0x3e7b35){if(_0x3e7b35){return _0x45b078[_0x340a('0x16')](_0x315bc7);}return _0x45b078[_0x340a('0x17')](_0x315bc7)[_0x340a('0x18')]();};}function respondWithResult(_0x393484,_0x2f9105){_0x2f9105=_0x2f9105||0xc8;return function(_0x150fe7){if(_0x150fe7){return _0x393484[_0x340a('0x17')](_0x2f9105)[_0x340a('0x19')](_0x150fe7);}};}function respondWithFilteredResult(_0xa1b711,_0xe93d15){return function(_0x435879){if(_0x435879){var _0x4caee8=typeof _0xe93d15[_0x340a('0x1a')]==='undefined'&&typeof _0xe93d15['limit']===_0x340a('0x1b');var _0x1a2ab1=_0x435879[_0x340a('0x1c')];var _0x18c94d=_0x4caee8?0x0:_0xe93d15[_0x340a('0x1a')];var _0x4587f7=_0x4caee8?_0x435879[_0x340a('0x1c')]:_0xe93d15[_0x340a('0x1a')]+_0xe93d15[_0x340a('0x1d')];var _0x29da7e;if(_0x4587f7>=_0x1a2ab1){_0x4587f7=_0x1a2ab1;_0x29da7e=0xc8;}else{_0x29da7e=0xce;}_0xa1b711['status'](_0x29da7e);return _0xa1b711[_0x340a('0x1e')]('Content-Range',_0x18c94d+'-'+_0x4587f7+'/'+_0x1a2ab1)[_0x340a('0x19')](_0x435879);}return null;};}function patchUpdates(_0x30f383){return function(_0x24c49e){try{jsonpatch[_0x340a('0x1f')](_0x24c49e,_0x30f383,!![]);}catch(_0x5b3aeb){return BPromise['reject'](_0x5b3aeb);}return _0x24c49e[_0x340a('0x20')]();};}function saveUpdates(_0xddb829,_0x4a8c22){return function(_0x18fe5d){if(_0x18fe5d){return _0x18fe5d[_0x340a('0x21')](_0xddb829)[_0x340a('0x22')](function(_0x47a572){return _0x47a572;});}return null;};}function removeEntity(_0x5b4e51,_0x3b3ada){return function(_0xf0fd20){if(_0xf0fd20){return _0xf0fd20['destroy']()[_0x340a('0x22')](function(){var _0x2ca1d9=_0xf0fd20[_0x340a('0x23')]({'plain':!![]});var _0x12bb94=_0x340a('0x24');return db[_0x340a('0x25')][_0x340a('0x26')]({'where':{'type':_0x12bb94,'resourceId':_0x2ca1d9['id']}})[_0x340a('0x22')](function(){return _0xf0fd20;});})[_0x340a('0x22')](function(){_0x5b4e51['status'](0xcc)[_0x340a('0x18')]();});}};}function handleEntityNotFound(_0x4c59ff,_0x259c95){return function(_0x4337f7){if(!_0x4337f7){_0x4c59ff['sendStatus'](0x194);}return _0x4337f7;};}function handleError(_0x5226c6,_0x52399d){_0x52399d=_0x52399d||0x1f4;return function(_0x151a15){logger[_0x340a('0x27')](_0x151a15[_0x340a('0x28')]);if(_0x151a15['name']){delete _0x151a15[_0x340a('0x29')];}_0x5226c6[_0x340a('0x17')](_0x52399d)['send'](_0x151a15);};}exports[_0x340a('0x2a')]=function(_0x3f2157,_0x233f65){var _0x31cc57={},_0x3ad80f={},_0x40a061={'count':0x0,'rows':[]};var _0x50646e=_[_0x340a('0x2b')](db[_0x340a('0x2c')][_0x340a('0x2d')],function(_0x40eed6){return{'name':_0x40eed6[_0x340a('0x2e')],'type':_0x40eed6[_0x340a('0x2f')][_0x340a('0x30')]};});_0x3ad80f[_0x340a('0x31')]=_[_0x340a('0x2b')](_0x50646e,_0x340a('0x29'));_0x3ad80f['query']=_[_0x340a('0x32')](_0x3f2157[_0x340a('0x33')]);_0x3ad80f[_0x340a('0x34')]=_[_0x340a('0x35')](_0x3ad80f['model'],_0x3ad80f[_0x340a('0x33')]);_0x31cc57['attributes']=_[_0x340a('0x35')](_0x3ad80f['model'],qs[_0x340a('0x36')](_0x3f2157['query']['fields']));_0x31cc57[_0x340a('0x37')]=_0x31cc57['attributes'][_0x340a('0x38')]?_0x31cc57[_0x340a('0x37')]:_0x3ad80f[_0x340a('0x31')];if(!_0x3f2157[_0x340a('0x33')]['hasOwnProperty']('nolimit')){_0x31cc57['limit']=qs[_0x340a('0x1d')](_0x3f2157[_0x340a('0x33')]['limit']);_0x31cc57['offset']=qs[_0x340a('0x1a')](_0x3f2157[_0x340a('0x33')]['offset']);}_0x31cc57[_0x340a('0x39')]=qs[_0x340a('0x3a')](_0x3f2157[_0x340a('0x33')][_0x340a('0x3a')]);_0x31cc57[_0x340a('0x3b')]=qs[_0x340a('0x34')](_[_0x340a('0x3c')](_0x3f2157[_0x340a('0x33')],_0x3ad80f[_0x340a('0x34')]),_0x50646e);if(_0x3f2157[_0x340a('0x33')][_0x340a('0x3d')]){_0x31cc57[_0x340a('0x3b')]=_[_0x340a('0x3e')](_0x31cc57['where'],{'$or':_[_0x340a('0x2b')](_0x50646e,function(_0x2f92a1){if(_0x2f92a1[_0x340a('0x2f')]!==_0x340a('0x3f')){var _0xfb41f9={};_0xfb41f9[_0x2f92a1[_0x340a('0x29')]]={'$like':'%'+_0x3f2157[_0x340a('0x33')][_0x340a('0x3d')]+'%'};return _0xfb41f9;}})});}_0x31cc57=_[_0x340a('0x3e')]({},_0x31cc57,_0x3f2157['options']);var _0x102bf9={'where':_0x31cc57[_0x340a('0x3b')]};return db['JscriptyProject'][_0x340a('0x1c')](_0x102bf9)[_0x340a('0x22')](function(_0x2414b7){_0x40a061[_0x340a('0x1c')]=_0x2414b7;if(_0x3f2157['query'][_0x340a('0x40')]){_0x31cc57['include']=[{'all':!![]}];}return db[_0x340a('0x2c')][_0x340a('0x41')](_0x31cc57);})[_0x340a('0x22')](function(_0x53f628){_0x40a061[_0x340a('0x42')]=_0x53f628;return _0x40a061;})[_0x340a('0x22')](respondWithFilteredResult(_0x233f65,_0x31cc57))[_0x340a('0x43')](handleError(_0x233f65,null));};exports['show']=function(_0x4b63ea,_0x1fcdf7){var _0x39a26d={'raw':![],'where':{'id':_0x4b63ea[_0x340a('0x44')]['id']}},_0x56d421={};_0x56d421[_0x340a('0x31')]=_[_0x340a('0x32')](db[_0x340a('0x2c')][_0x340a('0x2d')]);_0x56d421['query']=_[_0x340a('0x32')](_0x4b63ea[_0x340a('0x33')]);_0x56d421[_0x340a('0x34')]=_[_0x340a('0x35')](_0x56d421[_0x340a('0x31')],_0x56d421[_0x340a('0x33')]);_0x39a26d[_0x340a('0x37')]=_[_0x340a('0x35')](_0x56d421[_0x340a('0x31')],qs[_0x340a('0x36')](_0x4b63ea['query'][_0x340a('0x36')]));_0x39a26d[_0x340a('0x37')]=_0x39a26d[_0x340a('0x37')]['length']?_0x39a26d[_0x340a('0x37')]:_0x56d421[_0x340a('0x31')];if(_0x4b63ea[_0x340a('0x33')]['includeAll']){_0x39a26d['include']=[{'all':!![]}];}_0x39a26d=_[_0x340a('0x3e')]({},_0x39a26d,_0x4b63ea['options']);return db[_0x340a('0x2c')][_0x340a('0x45')](_0x39a26d)[_0x340a('0x22')](handleEntityNotFound(_0x1fcdf7,null))[_0x340a('0x22')](respondWithResult(_0x1fcdf7,null))[_0x340a('0x43')](handleError(_0x1fcdf7,null));};exports[_0x340a('0x46')]=function(_0x40b124,_0xe3ff17){return db[_0x340a('0x2c')]['create'](_0x40b124[_0x340a('0x47')],{})['then'](function(_0x254fd2){var _0x2fe3c5=_0x40b124[_0x340a('0x48')][_0x340a('0x23')]({'plain':!![]});if(!_0x2fe3c5)throw new Error(_0x340a('0x49'));if(_0x2fe3c5[_0x340a('0x4a')]===_0x340a('0x48')){var _0x217493=_0x254fd2[_0x340a('0x23')]({'plain':!![]});var _0x4bf599=_0x340a('0x24');return db[_0x340a('0x4b')][_0x340a('0x45')]({'where':{'name':_0x4bf599,'userProfileId':_0x2fe3c5[_0x340a('0x4c')]},'raw':!![]})[_0x340a('0x22')](function(_0x554e3f){if(_0x554e3f&&_0x554e3f[_0x340a('0x4d')]===0x0){return db[_0x340a('0x25')][_0x340a('0x46')]({'name':_0x217493[_0x340a('0x29')],'resourceId':_0x217493['id'],'type':_0x554e3f[_0x340a('0x29')],'sectionId':_0x554e3f['id']},{})[_0x340a('0x22')](function(){return _0x254fd2;});}else{return _0x254fd2;}})[_0x340a('0x43')](function(_0x567bc7){logger[_0x340a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x567bc7);throw _0x567bc7;});}return _0x254fd2;})[_0x340a('0x22')](respondWithResult(_0xe3ff17,0xc9))['catch'](handleError(_0xe3ff17,null));};exports['clone']=function(_0x33019f,_0x54f539){var _0xd32403={'where':{'id':_0x33019f[_0x340a('0x44')]['id']}},_0x1067f6={};_0x1067f6['model']=_['keys'](db[_0x340a('0x2c')][_0x340a('0x2d')]);_0xd32403[_0x340a('0x37')]=_[_0x340a('0x35')](_0x1067f6[_0x340a('0x31')],qs[_0x340a('0x36')](_0x33019f[_0x340a('0x33')][_0x340a('0x36')]));_0xd32403[_0x340a('0x37')]=_0xd32403['attributes'][_0x340a('0x38')]?_0xd32403['attributes']:_0x1067f6[_0x340a('0x31')];if(_0x33019f['query'][_0x340a('0x40')]){_0xd32403[_0x340a('0x4e')]=[{'all':!![]}];}_0xd32403=_['merge']({},_0xd32403,_0x33019f[_0x340a('0x4f')]);return db[_0x340a('0x2c')][_0x340a('0x45')](_0xd32403)['then'](handleEntityNotFound(_0x54f539,null))[_0x340a('0x22')](function(_0x1e31e0){if(_0x1e31e0){var _0x4d3470=_0x1e31e0[_0x340a('0x23')]({'plain':!![]});_0x4d3470=qs[_0x340a('0x50')](_0x4d3470,['id',_0x340a('0x51'),_0x340a('0x52')]);_0x33019f[_0x340a('0x47')]=_[_0x340a('0x50')](_0x33019f[_0x340a('0x47')],['id',_0x340a('0x51'),_0x340a('0x52')]);return db[_0x340a('0x2c')][_0x340a('0x46')](_[_0x340a('0x3e')](_0x4d3470,_0x33019f[_0x340a('0x47')]),{'include':_0x33019f['query'][_0x340a('0x40')]?[{'all':!![]}]:undefined})[_0x340a('0x22')](function(_0x433cf0){var _0x23cadf=_0x33019f[_0x340a('0x48')][_0x340a('0x23')]({'plain':!![]});if(!_0x23cadf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23cadf[_0x340a('0x4a')]==='user'){var _0x467700=_0x433cf0[_0x340a('0x23')]({'plain':!![]});var _0x374319=_0x340a('0x24');return db[_0x340a('0x4b')][_0x340a('0x45')]({'where':{'name':_0x374319,'userProfileId':_0x23cadf[_0x340a('0x4c')]},'raw':!![]})[_0x340a('0x22')](function(_0x42e67e){if(_0x42e67e&&_0x42e67e[_0x340a('0x4d')]===0x0){return db[_0x340a('0x25')]['create']({'name':_0x467700[_0x340a('0x29')],'resourceId':_0x467700['id'],'type':_0x42e67e[_0x340a('0x29')],'sectionId':_0x42e67e['id']},{})[_0x340a('0x22')](function(){return _0x433cf0;});}else{return _0x433cf0;}})['catch'](function(_0xc47389){logger[_0x340a('0x27')](_0x340a('0x53'),_0xc47389);throw _0xc47389;});}return _0x433cf0;});}})['then'](respondWithResult(_0x54f539,0xc9))[_0x340a('0x43')](handleError(_0x54f539,null));};exports[_0x340a('0x21')]=function(_0x24bd9b,_0x19eee5){if(_0x24bd9b[_0x340a('0x47')]['id']){delete _0x24bd9b['body']['id'];}return db[_0x340a('0x2c')][_0x340a('0x45')]({'where':{'id':_0x24bd9b[_0x340a('0x44')]['id']}})[_0x340a('0x22')](handleEntityNotFound(_0x19eee5,null))['then'](saveUpdates(_0x24bd9b['body'],null))['then'](respondWithResult(_0x19eee5,null))['catch'](handleError(_0x19eee5,null));};exports[_0x340a('0x26')]=function(_0x1d083a,_0x3c02fa){return db[_0x340a('0x2c')][_0x340a('0x45')]({'where':{'id':_0x1d083a[_0x340a('0x44')]['id']}})[_0x340a('0x22')](handleEntityNotFound(_0x3c02fa,null))[_0x340a('0x22')](removeEntity(_0x3c02fa,null))[_0x340a('0x43')](handleError(_0x3c02fa,null));};exports[_0x340a('0x54')]=function(_0x26ecc9,_0x475003,_0x3f2c2a){var _0x246d96={'raw':!![],'where':{}};var _0x16d8e7={};var _0x509333={'count':0x0,'rows':[]};return db[_0x340a('0x2c')]['findOne']({'where':{'id':_0x26ecc9[_0x340a('0x44')]['id']}})[_0x340a('0x22')](handleEntityNotFound(_0x475003,null))[_0x340a('0x22')](function(_0x1b5ef4){if(_0x1b5ef4){_0x16d8e7['model']=_[_0x340a('0x32')](db['JscriptySessionReport'][_0x340a('0x2d')]);_0x16d8e7[_0x340a('0x33')]=_[_0x340a('0x32')](_0x26ecc9[_0x340a('0x33')]);_0x16d8e7['filters']=_[_0x340a('0x35')](_0x16d8e7['model'],_0x16d8e7[_0x340a('0x33')]);_0x246d96[_0x340a('0x37')]=_['intersection'](_0x16d8e7[_0x340a('0x31')],qs[_0x340a('0x36')](_0x26ecc9[_0x340a('0x33')][_0x340a('0x36')]));_0x246d96[_0x340a('0x37')]=_0x246d96[_0x340a('0x37')][_0x340a('0x38')]?_0x246d96[_0x340a('0x37')]:_0x16d8e7[_0x340a('0x31')];if(!_0x26ecc9[_0x340a('0x33')]['hasOwnProperty'](_0x340a('0x55'))){_0x246d96[_0x340a('0x1d')]=qs[_0x340a('0x1d')](_0x26ecc9[_0x340a('0x33')][_0x340a('0x1d')]);_0x246d96[_0x340a('0x1a')]=qs[_0x340a('0x1a')](_0x26ecc9['query'][_0x340a('0x1a')]);}_0x246d96[_0x340a('0x39')]=qs[_0x340a('0x3a')](_0x26ecc9[_0x340a('0x33')]['sort']);_0x246d96[_0x340a('0x3b')]=qs[_0x340a('0x34')](_[_0x340a('0x3c')](_0x26ecc9[_0x340a('0x33')],_0x16d8e7[_0x340a('0x34')]));_0x246d96[_0x340a('0x3b')]['ProjectId']=_0x1b5ef4['id'];if(_0x26ecc9[_0x340a('0x33')][_0x340a('0x3d')]){_0x246d96[_0x340a('0x3b')]=_[_0x340a('0x3e')](_0x246d96['where'],{'$or':_['map'](_0x246d96[_0x340a('0x37')],function(_0x5020e2){var _0x562555={};_0x562555[_0x5020e2]={'$like':'%'+_0x26ecc9[_0x340a('0x33')][_0x340a('0x3d')]+'%'};return _0x562555;})});}_0x246d96=_['merge']({},_0x246d96,_0x26ecc9[_0x340a('0x4f')]);return db[_0x340a('0x56')][_0x340a('0x1c')]({'where':_0x246d96['where']})[_0x340a('0x22')](function(_0x422cf1){_0x509333[_0x340a('0x1c')]=_0x422cf1;if(_0x26ecc9[_0x340a('0x33')]['includeAll']){_0x246d96['include']=[{'all':!![]}];}return db[_0x340a('0x56')][_0x340a('0x41')](_0x246d96);})[_0x340a('0x22')](function(_0x271f15){_0x509333[_0x340a('0x42')]=_0x271f15;return _0x509333;});}})[_0x340a('0x22')](respondWithFilteredResult(_0x475003,_0x246d96))[_0x340a('0x43')](handleError(_0x475003,null));};exports[_0x340a('0x57')]=function(_0x25b57b,_0x317e8f,_0x4eebea){var _0x178c25={'raw':!![],'where':{}};var _0x309dc3={};var _0x180efd={'count':0x0,'rows':[]};return db[_0x340a('0x2c')][_0x340a('0x58')]({'where':{'id':_0x25b57b['params']['id']}})['then'](handleEntityNotFound(_0x317e8f,null))['then'](function(_0xb1780){if(_0xb1780){_0x309dc3[_0x340a('0x31')]=_[_0x340a('0x32')](db[_0x340a('0x59')]['rawAttributes']);_0x309dc3['query']=_['keys'](_0x25b57b[_0x340a('0x33')]);_0x309dc3[_0x340a('0x34')]=_[_0x340a('0x35')](_0x309dc3[_0x340a('0x31')],_0x309dc3[_0x340a('0x33')]);_0x178c25['attributes']=_[_0x340a('0x35')](_0x309dc3[_0x340a('0x31')],qs['fields'](_0x25b57b[_0x340a('0x33')][_0x340a('0x36')]));_0x178c25[_0x340a('0x37')]=_0x178c25[_0x340a('0x37')][_0x340a('0x38')]?_0x178c25[_0x340a('0x37')]:_0x309dc3[_0x340a('0x31')];if(!_0x25b57b['query']['hasOwnProperty'](_0x340a('0x55'))){_0x178c25[_0x340a('0x1d')]=qs[_0x340a('0x1d')](_0x25b57b[_0x340a('0x33')][_0x340a('0x1d')]);_0x178c25['offset']=qs['offset'](_0x25b57b[_0x340a('0x33')]['offset']);}_0x178c25[_0x340a('0x39')]=qs[_0x340a('0x3a')](_0x25b57b['query'][_0x340a('0x3a')]);_0x178c25[_0x340a('0x3b')]=qs[_0x340a('0x34')](_['pick'](_0x25b57b['query'],_0x309dc3[_0x340a('0x34')]));_0x178c25[_0x340a('0x3b')][_0x340a('0x5a')]=_0xb1780['id'];if(_0x25b57b[_0x340a('0x33')]['filter']){_0x178c25[_0x340a('0x3b')]=_[_0x340a('0x3e')](_0x178c25['where'],{'$or':_[_0x340a('0x2b')](_0x178c25[_0x340a('0x37')],function(_0x137ba8){var _0x51a0e1={};_0x51a0e1[_0x137ba8]={'$like':'%'+_0x25b57b[_0x340a('0x33')][_0x340a('0x3d')]+'%'};return _0x51a0e1;})});}_0x178c25=_[_0x340a('0x3e')]({},_0x178c25,_0x25b57b[_0x340a('0x4f')]);return db[_0x340a('0x59')][_0x340a('0x1c')]({'where':_0x178c25[_0x340a('0x3b')]})[_0x340a('0x22')](function(_0x328fe9){_0x180efd[_0x340a('0x1c')]=_0x328fe9;if(_0x25b57b[_0x340a('0x33')]['includeAll']){_0x178c25[_0x340a('0x4e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x340a('0x41')](_0x178c25);})['then'](function(_0x180855){_0x180efd[_0x340a('0x42')]=_0x180855;return _0x180efd;});}})[_0x340a('0x22')](respondWithFilteredResult(_0x317e8f,_0x178c25))[_0x340a('0x43')](handleError(_0x317e8f,null));};function char(_0x429a7a){return _0x340a('0x5b')===typeof _0x429a7a?String[_0x340a('0x5c')][_0x340a('0x1f')](null,arguments):_0x429a7a;}function needsEncapsulation(_0x49c4cb){return!!_0x49c4cb&&(_0x49c4cb[_0x340a('0x5d')]()[_0x340a('0x5e')](char(0xd))>=0x0||_0x49c4cb['toString']()[_0x340a('0x5e')](char(0xa))>=0x0||_0x49c4cb[_0x340a('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x49c4cb[_0x340a('0x5d')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1a878b){var _0x613a1c=char(0x22),_0x23cceb='\x5c'+char(0x22),_0x588b13=_0x1a878b[_0x340a('0x5d')]()['replace'](new RegExp(_0x613a1c,'g'),_0x23cceb);return _0x613a1c+_0x588b13+_0x613a1c;}exports[_0x340a('0x5f')]=function(_0x470c4f,_0x23bcf9,_0x48b715){var _0x40ea49,_0x468bd8;var _0x4d7587={'where':{'ProjectId':_0x470c4f[_0x340a('0x44')]['id']}};if(_0x470c4f[_0x340a('0x33')]['startTime']){_0x4d7587['where'][_0x340a('0x60')]=JSON['parse'](_0x470c4f[_0x340a('0x33')]['startTime']);}return db[_0x340a('0x56')][_0x340a('0x41')](_0x4d7587)[_0x340a('0x22')](handleEntityNotFound(_0x23bcf9,null))['then'](function(_0x4964e8){if(_0x4964e8){_0x40ea49=_0x4964e8;return db[_0x340a('0x61')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x40ea49,'id')},'ProjectId':_0x470c4f[_0x340a('0x44')]['id']},'order':_0x340a('0x62')});}})[_0x340a('0x22')](handleEntityNotFound(_0x23bcf9,null))[_0x340a('0x22')](function(_0x3f7cc5){if(_0x3f7cc5){_0x468bd8=_0x3f7cc5;var _0x1d4a92={};for(var _0x790c37=0x0,_0x1d7195=_0x468bd8[_0x340a('0x38')];_0x790c37<_0x1d7195;_0x790c37++){if(!_0x1d4a92[_0x340a('0x63')](_0x468bd8[_0x790c37]['questionId'])){_0x1d4a92[_0x468bd8[_0x790c37][_0x340a('0x64')]]=needsEncapsulation(_0x468bd8[_0x790c37][_0x340a('0x65')])?encapsulate(_0x468bd8[_0x790c37][_0x340a('0x65')]):_0x468bd8[_0x790c37][_0x340a('0x65')];}}var _0x45c50b=[],_0x2ec0ee={};for(var _0xfc82e9=0x0,_0x4821af=_0x40ea49[_0x340a('0x38')];_0xfc82e9<_0x4821af;_0xfc82e9++){_0x2ec0ee={'ProjectId':_0x470c4f[_0x340a('0x44')]['id'],'SessionId':_0x40ea49[_0xfc82e9]['id'],'StartTime':moment(_0x40ea49[_0xfc82e9][_0x340a('0x60')])[_0x340a('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3ce423=0x0,_0x289511=_0x468bd8[_0x340a('0x38')];_0x3ce423<_0x289511;_0x3ce423++){if(_0x468bd8[_0x3ce423][_0x340a('0x67')]==_0x40ea49[_0xfc82e9]['id']&&_0x1d4a92[_0x340a('0x63')](_0x468bd8[_0x3ce423][_0x340a('0x64')])){_0x2ec0ee[_0x1d4a92[_0x468bd8[_0x3ce423][_0x340a('0x64')]]]=_0x468bd8[_0x3ce423][_0x340a('0x68')];}}for(var _0x421403 in _0x1d4a92){if(!_0x2ec0ee[_0x340a('0x63')](_0x1d4a92[_0x421403])){_0x2ec0ee[_0x1d4a92[_0x421403]]=null;}}_0x45c50b['push'](_0x2ec0ee);}return _0x45c50b;}})[_0x340a('0x22')](function(_0x9ddff5){if(!_[_0x340a('0x69')](_0x9ddff5)){var _0x47cd36=toCsv(_0x9ddff5);var _0x20e2b3=Date[_0x340a('0x6a')]();fs[_0x340a('0x6b')](util[_0x340a('0x66')](_0x340a('0x6c'),_0x470c4f[_0x340a('0x44')]['id'],_0x20e2b3),_0x47cd36);_0x23bcf9['setHeader'](_0x340a('0x6d'),'attachment;\x20filename='+util[_0x340a('0x66')](_0x340a('0x6e'),_0x470c4f[_0x340a('0x44')]['id'],_0x20e2b3));_0x23bcf9[_0x340a('0x6f')](_0x340a('0x70'),_0x340a('0x71'));return _0x23bcf9[_0x340a('0x72')](util['format'](_0x340a('0x6c'),_0x470c4f[_0x340a('0x44')]['id'],_0x20e2b3));}else{return _0x23bcf9['sendStatus'](0xcc);}})['catch'](handleError(_0x23bcf9,null));}; \ No newline at end of file +var _0x723c=['nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Projects','error','stack','name','send','index','map','JscriptyProject','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x9e5cfb,_0x5e1a0f){var _0x5a3140=function(_0x287290){while(--_0x287290){_0x9e5cfb['push'](_0x9e5cfb['shift']());}};_0x5a3140(++_0x5e1a0f);}(_0x723c,0x1ad));var _0xc723=function(_0x3dc3fa,_0x39be5d){_0x3dc3fa=_0x3dc3fa-0x0;var _0x1df78e=_0x723c[_0x3dc3fa];return _0x1df78e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc723('0x0'));var zipdir=require(_0xc723('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc723('0x2'));var moment=require('moment');var BPromise=require(_0xc723('0x3'));var Mustache=require(_0xc723('0x4'));var util=require(_0xc723('0x5'));var path=require(_0xc723('0x6'));var sox=require(_0xc723('0x7'));var csv=require(_0xc723('0x8'));var ejs=require(_0xc723('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc723('0xa'));var squel=require(_0xc723('0xb'));var crypto=require('crypto');var jsforce=require(_0xc723('0xc'));var deskjs=require(_0xc723('0xd'));var toCsv=require(_0xc723('0x8'));var querystring=require(_0xc723('0xe'));var Papa=require(_0xc723('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc723('0x10'));var as=require(_0xc723('0x11'));var hardwareService=require(_0xc723('0x12'));var logger=require(_0xc723('0x13'))('api');var utils=require(_0xc723('0x14'));var config=require(_0xc723('0x15'));var licenseUtil=require(_0xc723('0x16'));var db=require(_0xc723('0x17'))['db'];function respondWithStatusCode(_0x3f4842,_0x5cffb4){_0x5cffb4=_0x5cffb4||0xcc;return function(_0x605b42){if(_0x605b42){return _0x3f4842[_0xc723('0x18')](_0x5cffb4);}return _0x3f4842[_0xc723('0x19')](_0x5cffb4)[_0xc723('0x1a')]();};}function respondWithResult(_0x2c7596,_0x4a3d86){_0x4a3d86=_0x4a3d86||0xc8;return function(_0x2e8be7){if(_0x2e8be7){return _0x2c7596['status'](_0x4a3d86)['json'](_0x2e8be7);}};}function respondWithFilteredResult(_0x1bb1ba,_0x110d83){return function(_0x212a77){if(_0x212a77){var _0x309574=typeof _0x110d83[_0xc723('0x1b')]===_0xc723('0x1c')&&typeof _0x110d83[_0xc723('0x1d')]===_0xc723('0x1c');var _0x5345a4=_0x212a77[_0xc723('0x1e')];var _0x41b4af=_0x309574?0x0:_0x110d83[_0xc723('0x1b')];var _0x100410=_0x309574?_0x212a77['count']:_0x110d83['offset']+_0x110d83[_0xc723('0x1d')];var _0x298470;if(_0x100410>=_0x5345a4){_0x100410=_0x5345a4;_0x298470=0xc8;}else{_0x298470=0xce;}_0x1bb1ba[_0xc723('0x19')](_0x298470);return _0x1bb1ba[_0xc723('0x1f')](_0xc723('0x20'),_0x41b4af+'-'+_0x100410+'/'+_0x5345a4)['json'](_0x212a77);}return null;};}function patchUpdates(_0x341584){return function(_0x23988a){try{jsonpatch[_0xc723('0x21')](_0x23988a,_0x341584,!![]);}catch(_0x172cf0){return BPromise[_0xc723('0x22')](_0x172cf0);}return _0x23988a[_0xc723('0x23')]();};}function saveUpdates(_0x38b980,_0x26b307){return function(_0x1de575){if(_0x1de575){return _0x1de575[_0xc723('0x24')](_0x38b980)[_0xc723('0x25')](function(_0xf77cc5){return _0xf77cc5;});}return null;};}function removeEntity(_0x545309,_0x16ae56){return function(_0x4cd1ee){if(_0x4cd1ee){return _0x4cd1ee[_0xc723('0x26')]()[_0xc723('0x25')](function(){var _0x1296e5=_0x4cd1ee['get']({'plain':!![]});var _0x41fb45=_0xc723('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x41fb45,'resourceId':_0x1296e5['id']}})[_0xc723('0x25')](function(){return _0x4cd1ee;});})[_0xc723('0x25')](function(){_0x545309[_0xc723('0x19')](0xcc)[_0xc723('0x1a')]();});}};}function handleEntityNotFound(_0x4066cd,_0x40a594){return function(_0x1670cf){if(!_0x1670cf){_0x4066cd[_0xc723('0x18')](0x194);}return _0x1670cf;};}function handleError(_0x5b9cb6,_0x567895){_0x567895=_0x567895||0x1f4;return function(_0x2ccef6){logger[_0xc723('0x28')](_0x2ccef6[_0xc723('0x29')]);if(_0x2ccef6['name']){delete _0x2ccef6[_0xc723('0x2a')];}_0x5b9cb6[_0xc723('0x19')](_0x567895)[_0xc723('0x2b')](_0x2ccef6);};}exports[_0xc723('0x2c')]=function(_0x4e874b,_0x14186d){var _0x13407b={},_0x81801={},_0x5acc14={'count':0x0,'rows':[]};var _0x35f71e=_[_0xc723('0x2d')](db[_0xc723('0x2e')]['rawAttributes'],function(_0x25f85d){return{'name':_0x25f85d['fieldName'],'type':_0x25f85d['type']['key']};});_0x81801[_0xc723('0x2f')]=_[_0xc723('0x2d')](_0x35f71e,'name');_0x81801[_0xc723('0x30')]=_[_0xc723('0x31')](_0x4e874b[_0xc723('0x30')]);_0x81801[_0xc723('0x32')]=_[_0xc723('0x33')](_0x81801[_0xc723('0x2f')],_0x81801[_0xc723('0x30')]);_0x13407b[_0xc723('0x34')]=_[_0xc723('0x33')](_0x81801[_0xc723('0x2f')],qs[_0xc723('0x35')](_0x4e874b[_0xc723('0x30')]['fields']));_0x13407b[_0xc723('0x34')]=_0x13407b['attributes']['length']?_0x13407b[_0xc723('0x34')]:_0x81801['model'];if(!_0x4e874b['query'][_0xc723('0x36')](_0xc723('0x37'))){_0x13407b[_0xc723('0x1d')]=qs[_0xc723('0x1d')](_0x4e874b['query'][_0xc723('0x1d')]);_0x13407b[_0xc723('0x1b')]=qs[_0xc723('0x1b')](_0x4e874b[_0xc723('0x30')][_0xc723('0x1b')]);}_0x13407b['order']=qs[_0xc723('0x38')](_0x4e874b[_0xc723('0x30')][_0xc723('0x38')]);_0x13407b[_0xc723('0x39')]=qs[_0xc723('0x32')](_['pick'](_0x4e874b[_0xc723('0x30')],_0x81801['filters']),_0x35f71e);if(_0x4e874b[_0xc723('0x30')][_0xc723('0x3a')]){_0x13407b[_0xc723('0x39')]=_[_0xc723('0x3b')](_0x13407b[_0xc723('0x39')],{'$or':_['map'](_0x35f71e,function(_0x41e738){if(_0x41e738[_0xc723('0x3c')]!==_0xc723('0x3d')){var _0x11682b={};_0x11682b[_0x41e738[_0xc723('0x2a')]]={'$like':'%'+_0x4e874b[_0xc723('0x30')]['filter']+'%'};return _0x11682b;}})});}_0x13407b=_['merge']({},_0x13407b,_0x4e874b[_0xc723('0x3e')]);var _0x17926b={'where':_0x13407b[_0xc723('0x39')]};return db[_0xc723('0x2e')][_0xc723('0x1e')](_0x17926b)['then'](function(_0x435b3b){_0x5acc14[_0xc723('0x1e')]=_0x435b3b;if(_0x4e874b[_0xc723('0x30')][_0xc723('0x3f')]){_0x13407b[_0xc723('0x40')]=[{'all':!![]}];}return db[_0xc723('0x2e')][_0xc723('0x41')](_0x13407b);})[_0xc723('0x25')](function(_0x3fd3ee){_0x5acc14[_0xc723('0x42')]=_0x3fd3ee;return _0x5acc14;})['then'](respondWithFilteredResult(_0x14186d,_0x13407b))['catch'](handleError(_0x14186d,null));};exports['show']=function(_0x379c5a,_0x50f4b7){var _0x926e98={'raw':![],'where':{'id':_0x379c5a[_0xc723('0x43')]['id']}},_0x26ad1e={};_0x26ad1e['model']=_['keys'](db['JscriptyProject'][_0xc723('0x44')]);_0x26ad1e[_0xc723('0x30')]=_[_0xc723('0x31')](_0x379c5a[_0xc723('0x30')]);_0x26ad1e['filters']=_[_0xc723('0x33')](_0x26ad1e[_0xc723('0x2f')],_0x26ad1e[_0xc723('0x30')]);_0x926e98[_0xc723('0x34')]=_[_0xc723('0x33')](_0x26ad1e['model'],qs[_0xc723('0x35')](_0x379c5a[_0xc723('0x30')][_0xc723('0x35')]));_0x926e98[_0xc723('0x34')]=_0x926e98[_0xc723('0x34')][_0xc723('0x45')]?_0x926e98[_0xc723('0x34')]:_0x26ad1e['model'];if(_0x379c5a[_0xc723('0x30')][_0xc723('0x3f')]){_0x926e98[_0xc723('0x40')]=[{'all':!![]}];}_0x926e98=_['merge']({},_0x926e98,_0x379c5a[_0xc723('0x3e')]);return db[_0xc723('0x2e')][_0xc723('0x46')](_0x926e98)[_0xc723('0x25')](handleEntityNotFound(_0x50f4b7,null))[_0xc723('0x25')](respondWithResult(_0x50f4b7,null))[_0xc723('0x47')](handleError(_0x50f4b7,null));};exports[_0xc723('0x48')]=function(_0x306b59,_0x21b2d3){return db[_0xc723('0x2e')][_0xc723('0x48')](_0x306b59[_0xc723('0x49')],{})['then'](function(_0x4968cd){var _0xed589a=_0x306b59['user'][_0xc723('0x4a')]({'plain':!![]});if(!_0xed589a)throw new Error(_0xc723('0x4b'));if(_0xed589a[_0xc723('0x4c')]===_0xc723('0x4d')){var _0x5ac977=_0x4968cd[_0xc723('0x4a')]({'plain':!![]});var _0x1dbe41=_0xc723('0x27');return db[_0xc723('0x4e')][_0xc723('0x46')]({'where':{'name':_0x1dbe41,'userProfileId':_0xed589a[_0xc723('0x4f')]},'raw':!![]})[_0xc723('0x25')](function(_0x5ad852){if(_0x5ad852&&_0x5ad852[_0xc723('0x50')]===0x0){return db[_0xc723('0x51')][_0xc723('0x48')]({'name':_0x5ac977[_0xc723('0x2a')],'resourceId':_0x5ac977['id'],'type':_0x5ad852[_0xc723('0x2a')],'sectionId':_0x5ad852['id']},{})[_0xc723('0x25')](function(){return _0x4968cd;});}else{return _0x4968cd;}})['catch'](function(_0x4ab440){logger[_0xc723('0x28')](_0xc723('0x52'),_0x4ab440);throw _0x4ab440;});}return _0x4968cd;})['then'](respondWithResult(_0x21b2d3,0xc9))[_0xc723('0x47')](handleError(_0x21b2d3,null));};exports[_0xc723('0x53')]=function(_0x106904,_0x9ad9d8){var _0x3c0dfa={'where':{'id':_0x106904[_0xc723('0x43')]['id']}},_0x3a5fc2={};_0x3a5fc2[_0xc723('0x2f')]=_['keys'](db[_0xc723('0x2e')][_0xc723('0x44')]);_0x3c0dfa['attributes']=_[_0xc723('0x33')](_0x3a5fc2[_0xc723('0x2f')],qs[_0xc723('0x35')](_0x106904['query']['fields']));_0x3c0dfa[_0xc723('0x34')]=_0x3c0dfa[_0xc723('0x34')]['length']?_0x3c0dfa['attributes']:_0x3a5fc2['model'];if(_0x106904[_0xc723('0x30')]['includeAll']){_0x3c0dfa['include']=[{'all':!![]}];}_0x3c0dfa=_['merge']({},_0x3c0dfa,_0x106904[_0xc723('0x3e')]);return db[_0xc723('0x2e')][_0xc723('0x46')](_0x3c0dfa)[_0xc723('0x25')](handleEntityNotFound(_0x9ad9d8,null))['then'](function(_0x1b0fad){if(_0x1b0fad){var _0x64beb=_0x1b0fad['get']({'plain':!![]});_0x64beb=qs['omit'](_0x64beb,['id',_0xc723('0x54'),_0xc723('0x55')]);_0x106904[_0xc723('0x49')]=_[_0xc723('0x56')](_0x106904[_0xc723('0x49')],['id','createdAt',_0xc723('0x55')]);return db['JscriptyProject'][_0xc723('0x48')](_[_0xc723('0x3b')](_0x64beb,_0x106904['body']),{'include':_0x106904['query'][_0xc723('0x3f')]?[{'all':!![]}]:undefined})[_0xc723('0x25')](function(_0x58b772){var _0x4830f4=_0x106904[_0xc723('0x4d')]['get']({'plain':!![]});if(!_0x4830f4)throw new Error(_0xc723('0x4b'));if(_0x4830f4[_0xc723('0x4c')]===_0xc723('0x4d')){var _0x2a1a1e=_0x58b772[_0xc723('0x4a')]({'plain':!![]});var _0x42c410=_0xc723('0x27');return db[_0xc723('0x4e')][_0xc723('0x46')]({'where':{'name':_0x42c410,'userProfileId':_0x4830f4[_0xc723('0x4f')]},'raw':!![]})[_0xc723('0x25')](function(_0x50c40e){if(_0x50c40e&&_0x50c40e[_0xc723('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a1a1e[_0xc723('0x2a')],'resourceId':_0x2a1a1e['id'],'type':_0x50c40e[_0xc723('0x2a')],'sectionId':_0x50c40e['id']},{})['then'](function(){return _0x58b772;});}else{return _0x58b772;}})['catch'](function(_0x38cc10){logger[_0xc723('0x28')](_0xc723('0x52'),_0x38cc10);throw _0x38cc10;});}return _0x58b772;});}})[_0xc723('0x25')](respondWithResult(_0x9ad9d8,0xc9))['catch'](handleError(_0x9ad9d8,null));};exports[_0xc723('0x24')]=function(_0x140217,_0x253143){if(_0x140217[_0xc723('0x49')]['id']){delete _0x140217[_0xc723('0x49')]['id'];}return db[_0xc723('0x2e')][_0xc723('0x46')]({'where':{'id':_0x140217[_0xc723('0x43')]['id']}})[_0xc723('0x25')](handleEntityNotFound(_0x253143,null))['then'](saveUpdates(_0x140217[_0xc723('0x49')],null))[_0xc723('0x25')](respondWithResult(_0x253143,null))['catch'](handleError(_0x253143,null));};exports[_0xc723('0x26')]=function(_0x3a4d5c,_0x1f3698){return db[_0xc723('0x2e')][_0xc723('0x46')]({'where':{'id':_0x3a4d5c[_0xc723('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f3698,null))[_0xc723('0x25')](removeEntity(_0x1f3698,null))['catch'](handleError(_0x1f3698,null));};exports[_0xc723('0x57')]=function(_0x4126e7,_0x161c6e,_0x3cbf88){var _0xfc5900={'raw':!![],'where':{}};var _0x9c54dd={};var _0x13dc98={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc723('0x58')]({'where':{'id':_0x4126e7[_0xc723('0x43')]['id']}})[_0xc723('0x25')](handleEntityNotFound(_0x161c6e,null))[_0xc723('0x25')](function(_0x2f22be){if(_0x2f22be){_0x9c54dd[_0xc723('0x2f')]=_['keys'](db[_0xc723('0x59')][_0xc723('0x44')]);_0x9c54dd[_0xc723('0x30')]=_[_0xc723('0x31')](_0x4126e7['query']);_0x9c54dd['filters']=_[_0xc723('0x33')](_0x9c54dd[_0xc723('0x2f')],_0x9c54dd['query']);_0xfc5900['attributes']=_['intersection'](_0x9c54dd[_0xc723('0x2f')],qs[_0xc723('0x35')](_0x4126e7[_0xc723('0x30')][_0xc723('0x35')]));_0xfc5900[_0xc723('0x34')]=_0xfc5900[_0xc723('0x34')]['length']?_0xfc5900[_0xc723('0x34')]:_0x9c54dd['model'];if(!_0x4126e7[_0xc723('0x30')][_0xc723('0x36')](_0xc723('0x37'))){_0xfc5900[_0xc723('0x1d')]=qs[_0xc723('0x1d')](_0x4126e7['query']['limit']);_0xfc5900[_0xc723('0x1b')]=qs[_0xc723('0x1b')](_0x4126e7[_0xc723('0x30')][_0xc723('0x1b')]);}_0xfc5900[_0xc723('0x5a')]=qs['sort'](_0x4126e7['query'][_0xc723('0x38')]);_0xfc5900[_0xc723('0x39')]=qs[_0xc723('0x32')](_[_0xc723('0x5b')](_0x4126e7[_0xc723('0x30')],_0x9c54dd[_0xc723('0x32')]));_0xfc5900[_0xc723('0x39')][_0xc723('0x5c')]=_0x2f22be['id'];if(_0x4126e7['query'][_0xc723('0x3a')]){_0xfc5900[_0xc723('0x39')]=_['merge'](_0xfc5900['where'],{'$or':_[_0xc723('0x2d')](_0xfc5900[_0xc723('0x34')],function(_0x16bfa0){var _0x1120dc={};_0x1120dc[_0x16bfa0]={'$like':'%'+_0x4126e7[_0xc723('0x30')]['filter']+'%'};return _0x1120dc;})});}_0xfc5900=_[_0xc723('0x3b')]({},_0xfc5900,_0x4126e7[_0xc723('0x3e')]);return db[_0xc723('0x59')][_0xc723('0x1e')]({'where':_0xfc5900[_0xc723('0x39')]})[_0xc723('0x25')](function(_0x246e59){_0x13dc98[_0xc723('0x1e')]=_0x246e59;if(_0x4126e7[_0xc723('0x30')]['includeAll']){_0xfc5900[_0xc723('0x40')]=[{'all':!![]}];}return db[_0xc723('0x59')][_0xc723('0x41')](_0xfc5900);})[_0xc723('0x25')](function(_0x21daa8){_0x13dc98[_0xc723('0x42')]=_0x21daa8;return _0x13dc98;});}})[_0xc723('0x25')](respondWithFilteredResult(_0x161c6e,_0xfc5900))[_0xc723('0x47')](handleError(_0x161c6e,null));};exports[_0xc723('0x5d')]=function(_0x3e0006,_0xd73d21,_0x1fd012){var _0x271e8b={'raw':!![],'where':{}};var _0x4662f9={};var _0x4bab1a={'count':0x0,'rows':[]};return db[_0xc723('0x2e')][_0xc723('0x58')]({'where':{'id':_0x3e0006[_0xc723('0x43')]['id']}})['then'](handleEntityNotFound(_0xd73d21,null))[_0xc723('0x25')](function(_0x54070b){if(_0x54070b){_0x4662f9['model']=_[_0xc723('0x31')](db[_0xc723('0x5e')][_0xc723('0x44')]);_0x4662f9['query']=_['keys'](_0x3e0006['query']);_0x4662f9[_0xc723('0x32')]=_[_0xc723('0x33')](_0x4662f9[_0xc723('0x2f')],_0x4662f9[_0xc723('0x30')]);_0x271e8b[_0xc723('0x34')]=_[_0xc723('0x33')](_0x4662f9[_0xc723('0x2f')],qs[_0xc723('0x35')](_0x3e0006['query']['fields']));_0x271e8b[_0xc723('0x34')]=_0x271e8b[_0xc723('0x34')][_0xc723('0x45')]?_0x271e8b[_0xc723('0x34')]:_0x4662f9['model'];if(!_0x3e0006[_0xc723('0x30')][_0xc723('0x36')]('nolimit')){_0x271e8b[_0xc723('0x1d')]=qs[_0xc723('0x1d')](_0x3e0006[_0xc723('0x30')]['limit']);_0x271e8b[_0xc723('0x1b')]=qs[_0xc723('0x1b')](_0x3e0006['query'][_0xc723('0x1b')]);}_0x271e8b['order']=qs[_0xc723('0x38')](_0x3e0006['query']['sort']);_0x271e8b[_0xc723('0x39')]=qs['filters'](_['pick'](_0x3e0006[_0xc723('0x30')],_0x4662f9['filters']));_0x271e8b[_0xc723('0x39')][_0xc723('0x5c')]=_0x54070b['id'];if(_0x3e0006[_0xc723('0x30')][_0xc723('0x3a')]){_0x271e8b['where']=_[_0xc723('0x3b')](_0x271e8b[_0xc723('0x39')],{'$or':_[_0xc723('0x2d')](_0x271e8b['attributes'],function(_0x4d351b){var _0x4b6a5f={};_0x4b6a5f[_0x4d351b]={'$like':'%'+_0x3e0006['query'][_0xc723('0x3a')]+'%'};return _0x4b6a5f;})});}_0x271e8b=_['merge']({},_0x271e8b,_0x3e0006[_0xc723('0x3e')]);return db['JscriptyAnswerReport']['count']({'where':_0x271e8b[_0xc723('0x39')]})['then'](function(_0x2880e1){_0x4bab1a['count']=_0x2880e1;if(_0x3e0006[_0xc723('0x30')][_0xc723('0x3f')]){_0x271e8b['include']=[{'all':!![]}];}return db[_0xc723('0x5e')][_0xc723('0x41')](_0x271e8b);})[_0xc723('0x25')](function(_0x5438cc){_0x4bab1a[_0xc723('0x42')]=_0x5438cc;return _0x4bab1a;});}})[_0xc723('0x25')](respondWithFilteredResult(_0xd73d21,_0x271e8b))[_0xc723('0x47')](handleError(_0xd73d21,null));};function char(_0x3efe2e){return _0xc723('0x5f')===typeof _0x3efe2e?String[_0xc723('0x60')][_0xc723('0x21')](null,arguments):_0x3efe2e;}function needsEncapsulation(_0xaeff02){return!!_0xaeff02&&(_0xaeff02[_0xc723('0x61')]()[_0xc723('0x62')](char(0xd))>=0x0||_0xaeff02[_0xc723('0x61')]()[_0xc723('0x62')](char(0xa))>=0x0||_0xaeff02['toString']()['indexOf'](char(0x2c))>=0x0||_0xaeff02['toString']()[_0xc723('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4f1804){var _0x24f65f=char(0x22),_0x21b35d='\x5c'+char(0x22),_0x207b02=_0x4f1804[_0xc723('0x61')]()[_0xc723('0x63')](new RegExp(_0x24f65f,'g'),_0x21b35d);return _0x24f65f+_0x207b02+_0x24f65f;}exports['getSummary']=function(_0x5855ed,_0x1d3356,_0x15d8f9){var _0x3552fe,_0x23f206;var _0x24b6a2={'where':{'ProjectId':_0x5855ed[_0xc723('0x43')]['id']}};if(_0x5855ed[_0xc723('0x30')][_0xc723('0x64')]){_0x24b6a2[_0xc723('0x39')][_0xc723('0x65')]=JSON[_0xc723('0x66')](_0x5855ed[_0xc723('0x30')]['startTime']);}return db['JscriptySessionReport'][_0xc723('0x41')](_0x24b6a2)['then'](handleEntityNotFound(_0x1d3356,null))[_0xc723('0x25')](function(_0x4f596d){if(_0x4f596d){_0x3552fe=_0x4f596d;return db['JscriptyQuestionReport'][_0xc723('0x41')]({'where':{'SessionId':{'$in':_[_0xc723('0x2d')](_0x3552fe,'id')},'ProjectId':_0x5855ed['params']['id']},'order':_0xc723('0x67')});}})[_0xc723('0x25')](handleEntityNotFound(_0x1d3356,null))[_0xc723('0x25')](function(_0x58247b){if(_0x58247b){_0x23f206=_0x58247b;var _0x96a83b={};for(var _0x3c07ff=0x0,_0x29b5c2=_0x23f206[_0xc723('0x45')];_0x3c07ff<_0x29b5c2;_0x3c07ff++){if(!_0x96a83b[_0xc723('0x36')](_0x23f206[_0x3c07ff][_0xc723('0x68')])){_0x96a83b[_0x23f206[_0x3c07ff][_0xc723('0x68')]]=needsEncapsulation(_0x23f206[_0x3c07ff][_0xc723('0x69')])?encapsulate(_0x23f206[_0x3c07ff][_0xc723('0x69')]):_0x23f206[_0x3c07ff][_0xc723('0x69')];}}var _0x2cabd5=[],_0x5d2f81={};for(var _0x2693fd=0x0,_0x9109d0=_0x3552fe[_0xc723('0x45')];_0x2693fd<_0x9109d0;_0x2693fd++){_0x5d2f81={'ProjectId':_0x5855ed[_0xc723('0x43')]['id'],'SessionId':_0x3552fe[_0x2693fd]['id'],'StartTime':moment(_0x3552fe[_0x2693fd][_0xc723('0x65')])[_0xc723('0x6a')](_0xc723('0x6b'))};for(var _0x3fe7d4=0x0,_0x430ec2=_0x23f206[_0xc723('0x45')];_0x3fe7d4<_0x430ec2;_0x3fe7d4++){if(_0x23f206[_0x3fe7d4][_0xc723('0x6c')]==_0x3552fe[_0x2693fd]['id']&&_0x96a83b[_0xc723('0x36')](_0x23f206[_0x3fe7d4]['questionId'])){_0x5d2f81[_0x96a83b[_0x23f206[_0x3fe7d4][_0xc723('0x68')]]]=_0x23f206[_0x3fe7d4][_0xc723('0x6d')];}}for(var _0x34dc9a in _0x96a83b){if(!_0x5d2f81[_0xc723('0x36')](_0x96a83b[_0x34dc9a])){_0x5d2f81[_0x96a83b[_0x34dc9a]]=null;}}_0x2cabd5[_0xc723('0x6e')](_0x5d2f81);}return _0x2cabd5;}})[_0xc723('0x25')](function(_0x4a775e){if(!_['isEmpty'](_0x4a775e)){var _0x4b79e6=toCsv(_0x4a775e);var _0x4be1bc=Date[_0xc723('0x6f')]();fs[_0xc723('0x70')](util['format'](_0xc723('0x71'),_0x5855ed['params']['id'],_0x4be1bc),_0x4b79e6);_0x1d3356[_0xc723('0x72')](_0xc723('0x73'),_0xc723('0x74')+util[_0xc723('0x6a')](_0xc723('0x75'),_0x5855ed[_0xc723('0x43')]['id'],_0x4be1bc));_0x1d3356[_0xc723('0x72')](_0xc723('0x76'),_0xc723('0x77'));return _0x1d3356[_0xc723('0x78')](util[_0xc723('0x6a')](_0xc723('0x71'),_0x5855ed[_0xc723('0x43')]['id'],_0x4be1bc));}else{return _0x1d3356['sendStatus'](0xcc);}})[_0xc723('0x47')](handleError(_0x1d3356,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ebe058c..d856baf 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 _0x3bd7=['JscriptyProject','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x34e46d,_0x5df86a){var _0x1cc6aa=function(_0x5a22f7){while(--_0x5a22f7){_0x34e46d['push'](_0x34e46d['shift']());}};_0x1cc6aa(++_0x5df86a);}(_0x3bd7,0x199));var _0x73bd=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x3bd7[_0x204eb7];return _0x37e444;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73bd('0x0'))(_0x73bd('0x1'));var moment=require(_0x73bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x73bd('0x3'));var fs=require('fs');var path=require(_0x73bd('0x4'));var rimraf=require(_0x73bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x73bd('0x6'));module['exports']=function(_0xe20fe9,_0x1aa5e1){return _0xe20fe9['define'](_0x73bd('0x7'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d3=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x118f23,_0x214305){var _0x57e66b=function(_0x99c3be){while(--_0x99c3be){_0x118f23['push'](_0x118f23['shift']());}};_0x57e66b(++_0x214305);}(_0x83d3,0x17c));var _0x383d=function(_0x266e57,_0x41125b){_0x266e57=_0x266e57-0x0;var _0x4cdc1d=_0x83d3[_0x266e57];return _0x4cdc1d;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'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 861f01a..34b0051 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x3a79c8,_0x3bd0ac){var _0x3eb881=function(_0x64fa15){while(--_0x64fa15){_0x3a79c8['push'](_0x3a79c8['shift']());}};_0x3eb881(++_0x3bd0ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2e8104,_0x206e23){var _0x103a3e=function(_0x27ed0d){while(--_0x27ed0d){_0x2e8104['push'](_0x2e8104['shift']());}};_0x103a3e(++_0x206e23);}(_0xb43b,0x1b2));var _0xbb43=function(_0x13c5e3,_0x43cf42){_0x13c5e3=_0x13c5e3-0x0;var _0x18264b=_0xb43b[_0x13c5e3];return _0x18264b;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 62c18d2..2221c2e 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 _0x6bab=['isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x23018a,_0xc2ce29){var _0x295a10=function(_0x988d98){while(--_0x988d98){_0x23018a['push'](_0x23018a['shift']());}};_0x295a10(++_0xc2ce29);}(_0x6bab,0x1e5));var _0xb6ba=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x6bab[_0x648163];return _0x199d4d;};'use strict';var multer=require(_0xb6ba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb6ba('0x1'));var express=require(_0xb6ba('0x2'));var router=express['Router']();var fs_extra=require(_0xb6ba('0x3'));var auth=require(_0xb6ba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb6ba('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb6ba('0x6')]('/',auth['isAuthenticated'](),controller[_0xb6ba('0x7')]);router[_0xb6ba('0x6')]('/describe',auth[_0xb6ba('0x8')](),controller['describe']);router[_0xb6ba('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb6ba('0x9')]);router[_0xb6ba('0xa')]('/',auth[_0xb6ba('0x8')](),controller['create']);router[_0xb6ba('0xb')]('/:id',auth[_0xb6ba('0x8')](),controller[_0xb6ba('0xc')]);router[_0xb6ba('0xd')](_0xb6ba('0xe'),auth[_0xb6ba('0x8')](),controller[_0xb6ba('0xf')]);module[_0xb6ba('0x10')]=router; \ No newline at end of file +var _0x4830=['multer','util','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','describe','get','show','post','create','put','update','delete','/:id','destroy'];(function(_0x1f4c96,_0x3b0a4d){var _0x389019=function(_0x473d7b){while(--_0x473d7b){_0x1f4c96['push'](_0x1f4c96['shift']());}};_0x389019(++_0x3b0a4d);}(_0x4830,0xb4));var _0x0483=function(_0x57fbe1,_0x4282ff){_0x57fbe1=_0x57fbe1-0x0;var _0x3dbc2c=_0x4830[_0x57fbe1];return _0x3dbc2c;};'use strict';var multer=require(_0x0483('0x0'));var util=require(_0x0483('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0483('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0483('0x3'));var interaction=require(_0x0483('0x4'));var config=require('../../config/environment');var controller=require(_0x0483('0x5'));router['get']('/',auth[_0x0483('0x6')](),controller[_0x0483('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0483('0x8')]);router[_0x0483('0x9')]('/:id',auth[_0x0483('0x6')](),controller[_0x0483('0xa')]);router[_0x0483('0xb')]('/',auth['isAuthenticated'](),controller[_0x0483('0xc')]);router[_0x0483('0xd')]('/:id',auth[_0x0483('0x6')](),controller[_0x0483('0xe')]);router[_0x0483('0xf')](_0x0483('0x10'),auth[_0x0483('0x6')](),controller[_0x0483('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a8ab59e..40b15d7 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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x462cc9,_0x33eeee){_0x462cc9=_0x462cc9-0x0;var _0x1e7802=_0x7a54[_0x462cc9];return _0x1e7802;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x268d15,_0xd21c02){_0x268d15=_0x268d15-0x0;var _0x52b3ee=_0x7a54[_0x268d15];return _0x52b3ee;};'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 cd95251..dd342de 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 _0x1937=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','JscriptyQuestionReport','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','then','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format'];(function(_0x18d6e4,_0x44cc4a){var _0x5e35f7=function(_0x33c9d0){while(--_0x33c9d0){_0x18d6e4['push'](_0x18d6e4['shift']());}};_0x5e35f7(++_0x44cc4a);}(_0x1937,0x9d));var _0x7193=function(_0x3ee378,_0x43a23a){_0x3ee378=_0x3ee378-0x0;var _0x1ac69a=_0x1937[_0x3ee378];return _0x1ac69a;};'use strict';var emlformat=require(_0x7193('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7193('0x1'));var jsonpatch=require(_0x7193('0x2'));var rp=require(_0x7193('0x3'));var moment=require(_0x7193('0x4'));var BPromise=require(_0x7193('0x5'));var Mustache=require(_0x7193('0x6'));var util=require(_0x7193('0x7'));var path=require(_0x7193('0x8'));var sox=require(_0x7193('0x9'));var csv=require(_0x7193('0xa'));var ejs=require(_0x7193('0xb'));var fs=require('fs');var fs_extra=require(_0x7193('0xc'));var _=require(_0x7193('0xd'));var squel=require(_0x7193('0xe'));var crypto=require(_0x7193('0xf'));var jsforce=require(_0x7193('0x10'));var deskjs=require(_0x7193('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7193('0x12'));var Papa=require(_0x7193('0x13'));var Redis=require(_0x7193('0x14'));var authService=require(_0x7193('0x15'));var qs=require(_0x7193('0x16'));var as=require(_0x7193('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7193('0x18'));var utils=require(_0x7193('0x19'));var config=require(_0x7193('0x1a'));var licenseUtil=require(_0x7193('0x1b'));var db=require(_0x7193('0x1c'))['db'];function respondWithStatusCode(_0x59b802,_0x3f63a0){_0x3f63a0=_0x3f63a0||0xcc;return function(_0x1ecc61){if(_0x1ecc61){return _0x59b802['sendStatus'](_0x3f63a0);}return _0x59b802[_0x7193('0x1d')](_0x3f63a0)[_0x7193('0x1e')]();};}function respondWithResult(_0x2d79f2,_0x41dfcd){_0x41dfcd=_0x41dfcd||0xc8;return function(_0x5eb2f5){if(_0x5eb2f5){return _0x2d79f2[_0x7193('0x1d')](_0x41dfcd)[_0x7193('0x1f')](_0x5eb2f5);}};}function respondWithFilteredResult(_0x5c318a,_0x1cd719){return function(_0x2aa700){if(_0x2aa700){var _0x1cccdf=typeof _0x1cd719[_0x7193('0x20')]==='undefined'&&typeof _0x1cd719[_0x7193('0x21')]===_0x7193('0x22');var _0x3d5ad1=_0x2aa700[_0x7193('0x23')];var _0x5a373a=_0x1cccdf?0x0:_0x1cd719[_0x7193('0x20')];var _0x3fb8ff=_0x1cccdf?_0x2aa700[_0x7193('0x23')]:_0x1cd719[_0x7193('0x20')]+_0x1cd719['limit'];var _0x398e2a;if(_0x3fb8ff>=_0x3d5ad1){_0x3fb8ff=_0x3d5ad1;_0x398e2a=0xc8;}else{_0x398e2a=0xce;}_0x5c318a[_0x7193('0x1d')](_0x398e2a);return _0x5c318a[_0x7193('0x24')](_0x7193('0x25'),_0x5a373a+'-'+_0x3fb8ff+'/'+_0x3d5ad1)['json'](_0x2aa700);}return null;};}function patchUpdates(_0x1f7bab){return function(_0x2c7dbb){try{jsonpatch[_0x7193('0x26')](_0x2c7dbb,_0x1f7bab,!![]);}catch(_0x2a9fa7){return BPromise[_0x7193('0x27')](_0x2a9fa7);}return _0x2c7dbb[_0x7193('0x28')]();};}function saveUpdates(_0xb19aa3,_0x1c4b76){return function(_0x3337d6){if(_0x3337d6){return _0x3337d6[_0x7193('0x29')](_0xb19aa3)['then'](function(_0x132ca2){return _0x132ca2;});}return null;};}function removeEntity(_0x178bed,_0x40b874){return function(_0x164fea){if(_0x164fea){return _0x164fea[_0x7193('0x2a')]()['then'](function(){_0x178bed['status'](0xcc)[_0x7193('0x1e')]();});}};}function handleEntityNotFound(_0x1631c5,_0x24b484){return function(_0x5ba18c){if(!_0x5ba18c){_0x1631c5['sendStatus'](0x194);}return _0x5ba18c;};}function handleError(_0x5a130f,_0x3512ea){_0x3512ea=_0x3512ea||0x1f4;return function(_0x2cf1e5){logger[_0x7193('0x2b')](_0x2cf1e5[_0x7193('0x2c')]);if(_0x2cf1e5[_0x7193('0x2d')]){delete _0x2cf1e5[_0x7193('0x2d')];}_0x5a130f['status'](_0x3512ea)['send'](_0x2cf1e5);};}exports[_0x7193('0x2e')]=function(_0x3f5b64,_0x14123e){var _0x7b241d={},_0x19bd05={},_0x104167={'count':0x0,'rows':[]};var _0x224f9c=_[_0x7193('0x2f')](db[_0x7193('0x30')]['rawAttributes'],function(_0x2ddf15){return{'name':_0x2ddf15['fieldName'],'type':_0x2ddf15[_0x7193('0x31')][_0x7193('0x32')]};});_0x19bd05[_0x7193('0x33')]=_['map'](_0x224f9c,_0x7193('0x2d'));_0x19bd05[_0x7193('0x34')]=_['keys'](_0x3f5b64[_0x7193('0x34')]);_0x19bd05['filters']=_[_0x7193('0x35')](_0x19bd05[_0x7193('0x33')],_0x19bd05[_0x7193('0x34')]);_0x7b241d['attributes']=_[_0x7193('0x35')](_0x19bd05[_0x7193('0x33')],qs[_0x7193('0x36')](_0x3f5b64[_0x7193('0x34')]['fields']));_0x7b241d[_0x7193('0x37')]=_0x7b241d[_0x7193('0x37')][_0x7193('0x38')]?_0x7b241d[_0x7193('0x37')]:_0x19bd05[_0x7193('0x33')];if(!_0x3f5b64[_0x7193('0x34')][_0x7193('0x39')](_0x7193('0x3a'))){_0x7b241d['limit']=qs['limit'](_0x3f5b64[_0x7193('0x34')][_0x7193('0x21')]);_0x7b241d['offset']=qs[_0x7193('0x20')](_0x3f5b64['query'][_0x7193('0x20')]);}_0x7b241d['order']=qs[_0x7193('0x3b')](_0x3f5b64['query'][_0x7193('0x3b')]);_0x7b241d[_0x7193('0x3c')]=qs[_0x7193('0x3d')](_[_0x7193('0x3e')](_0x3f5b64[_0x7193('0x34')],_0x19bd05[_0x7193('0x3d')]),_0x224f9c);if(_0x3f5b64['query'][_0x7193('0x3f')]){_0x7b241d[_0x7193('0x3c')]=_[_0x7193('0x40')](_0x7b241d[_0x7193('0x3c')],{'$or':_[_0x7193('0x2f')](_0x224f9c,function(_0x42bc0c){if(_0x42bc0c['type']!=='VIRTUAL'){var _0x363160={};_0x363160[_0x42bc0c['name']]={'$like':'%'+_0x3f5b64[_0x7193('0x34')][_0x7193('0x3f')]+'%'};return _0x363160;}})});}_0x7b241d=_[_0x7193('0x40')]({},_0x7b241d,_0x3f5b64[_0x7193('0x41')]);var _0x5697fa={'where':_0x7b241d['where']};return db[_0x7193('0x30')][_0x7193('0x23')](_0x5697fa)['then'](function(_0xac3e5e){_0x104167[_0x7193('0x23')]=_0xac3e5e;if(_0x3f5b64[_0x7193('0x34')][_0x7193('0x42')]){_0x7b241d[_0x7193('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7193('0x44')](_0x7b241d);})[_0x7193('0x45')](function(_0x9f46b3){_0x104167['rows']=_0x9f46b3;return _0x104167;})[_0x7193('0x45')](respondWithFilteredResult(_0x14123e,_0x7b241d))[_0x7193('0x46')](handleError(_0x14123e,null));};exports[_0x7193('0x47')]=function(_0x4921f2,_0x13fe58){var _0x3747ff={'raw':!![],'where':{'id':_0x4921f2[_0x7193('0x48')]['id']}},_0xa59856={};_0xa59856['model']=_[_0x7193('0x49')](db[_0x7193('0x30')][_0x7193('0x4a')]);_0xa59856['query']=_[_0x7193('0x49')](_0x4921f2[_0x7193('0x34')]);_0xa59856[_0x7193('0x3d')]=_[_0x7193('0x35')](_0xa59856[_0x7193('0x33')],_0xa59856[_0x7193('0x34')]);_0x3747ff['attributes']=_[_0x7193('0x35')](_0xa59856[_0x7193('0x33')],qs[_0x7193('0x36')](_0x4921f2[_0x7193('0x34')][_0x7193('0x36')]));_0x3747ff[_0x7193('0x37')]=_0x3747ff[_0x7193('0x37')][_0x7193('0x38')]?_0x3747ff['attributes']:_0xa59856[_0x7193('0x33')];if(_0x4921f2[_0x7193('0x34')][_0x7193('0x42')]){_0x3747ff[_0x7193('0x43')]=[{'all':!![]}];}_0x3747ff=_['merge']({},_0x3747ff,_0x4921f2['options']);return db[_0x7193('0x30')][_0x7193('0x4b')](_0x3747ff)[_0x7193('0x45')](handleEntityNotFound(_0x13fe58,null))[_0x7193('0x45')](respondWithResult(_0x13fe58,null))['catch'](handleError(_0x13fe58,null));};exports[_0x7193('0x4c')]=function(_0x3225d6,_0x50152a){return db[_0x7193('0x30')][_0x7193('0x4c')](_0x3225d6[_0x7193('0x4d')],{})[_0x7193('0x45')](respondWithResult(_0x50152a,0xc9))[_0x7193('0x46')](handleError(_0x50152a,null));};exports['update']=function(_0x3f0618,_0x53a871){if(_0x3f0618[_0x7193('0x4d')]['id']){delete _0x3f0618['body']['id'];}return db[_0x7193('0x30')][_0x7193('0x4b')]({'where':{'id':_0x3f0618[_0x7193('0x48')]['id']}})['then'](handleEntityNotFound(_0x53a871,null))['then'](saveUpdates(_0x3f0618['body'],null))['then'](respondWithResult(_0x53a871,null))['catch'](handleError(_0x53a871,null));};exports['destroy']=function(_0x32fec8,_0x5efc48){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x32fec8[_0x7193('0x48')]['id']}})[_0x7193('0x45')](handleEntityNotFound(_0x5efc48,null))[_0x7193('0x45')](removeEntity(_0x5efc48,null))[_0x7193('0x46')](handleError(_0x5efc48,null));};exports[_0x7193('0x4e')]=function(_0x1b6285,_0x1fc67d){return db[_0x7193('0x30')][_0x7193('0x4e')]()[_0x7193('0x45')](respondWithResult(_0x1fc67d,null))['catch'](handleError(_0x1fc67d,null));}; \ No newline at end of file +var _0x2cd4=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','update','then','destroy','stack','name','send','index','JscriptyQuestionReport'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x2cd4,0x6d));var _0x42cd=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x2cd4[_0x450689];return _0x46ffb0;};'use strict';var emlformat=require(_0x42cd('0x0'));var rimraf=require(_0x42cd('0x1'));var zipdir=require(_0x42cd('0x2'));var jsonpatch=require(_0x42cd('0x3'));var rp=require(_0x42cd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x42cd('0x5'));var util=require(_0x42cd('0x6'));var path=require('path');var sox=require(_0x42cd('0x7'));var csv=require(_0x42cd('0x8'));var ejs=require(_0x42cd('0x9'));var fs=require('fs');var fs_extra=require(_0x42cd('0xa'));var _=require(_0x42cd('0xb'));var squel=require(_0x42cd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x42cd('0xd'));var toCsv=require(_0x42cd('0x8'));var querystring=require(_0x42cd('0xe'));var Papa=require(_0x42cd('0xf'));var Redis=require(_0x42cd('0x10'));var authService=require(_0x42cd('0x11'));var qs=require(_0x42cd('0x12'));var as=require(_0x42cd('0x13'));var hardwareService=require(_0x42cd('0x14'));var logger=require(_0x42cd('0x15'))(_0x42cd('0x16'));var utils=require(_0x42cd('0x17'));var config=require(_0x42cd('0x18'));var licenseUtil=require(_0x42cd('0x19'));var db=require(_0x42cd('0x1a'))['db'];function respondWithStatusCode(_0x3cd590,_0x216538){_0x216538=_0x216538||0xcc;return function(_0x8a1291){if(_0x8a1291){return _0x3cd590[_0x42cd('0x1b')](_0x216538);}return _0x3cd590[_0x42cd('0x1c')](_0x216538)[_0x42cd('0x1d')]();};}function respondWithResult(_0x3e6544,_0x2dd339){_0x2dd339=_0x2dd339||0xc8;return function(_0x41a4ec){if(_0x41a4ec){return _0x3e6544[_0x42cd('0x1c')](_0x2dd339)[_0x42cd('0x1e')](_0x41a4ec);}};}function respondWithFilteredResult(_0x43be25,_0x324008){return function(_0x18c241){if(_0x18c241){var _0xe49b6c=typeof _0x324008['offset']===_0x42cd('0x1f')&&typeof _0x324008['limit']===_0x42cd('0x1f');var _0x5f4d52=_0x18c241[_0x42cd('0x20')];var _0x2c6c80=_0xe49b6c?0x0:_0x324008[_0x42cd('0x21')];var _0x1843c7=_0xe49b6c?_0x18c241[_0x42cd('0x20')]:_0x324008[_0x42cd('0x21')]+_0x324008[_0x42cd('0x22')];var _0x48a90e;if(_0x1843c7>=_0x5f4d52){_0x1843c7=_0x5f4d52;_0x48a90e=0xc8;}else{_0x48a90e=0xce;}_0x43be25[_0x42cd('0x1c')](_0x48a90e);return _0x43be25[_0x42cd('0x23')]('Content-Range',_0x2c6c80+'-'+_0x1843c7+'/'+_0x5f4d52)[_0x42cd('0x1e')](_0x18c241);}return null;};}function patchUpdates(_0x52ade6){return function(_0x9743d2){try{jsonpatch[_0x42cd('0x24')](_0x9743d2,_0x52ade6,!![]);}catch(_0x31a610){return BPromise['reject'](_0x31a610);}return _0x9743d2['save']();};}function saveUpdates(_0x1b40e5,_0x5485cd){return function(_0x25759f){if(_0x25759f){return _0x25759f[_0x42cd('0x25')](_0x1b40e5)[_0x42cd('0x26')](function(_0x4e4c4e){return _0x4e4c4e;});}return null;};}function removeEntity(_0x5ecc9f,_0x4d67e9){return function(_0x5af124){if(_0x5af124){return _0x5af124[_0x42cd('0x27')]()['then'](function(){_0x5ecc9f[_0x42cd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcc20,_0x27f573){return function(_0x1a6571){if(!_0x1a6571){_0x1bcc20[_0x42cd('0x1b')](0x194);}return _0x1a6571;};}function handleError(_0x419c12,_0x3adfc9){_0x3adfc9=_0x3adfc9||0x1f4;return function(_0x5de67d){logger['error'](_0x5de67d[_0x42cd('0x28')]);if(_0x5de67d[_0x42cd('0x29')]){delete _0x5de67d[_0x42cd('0x29')];}_0x419c12[_0x42cd('0x1c')](_0x3adfc9)[_0x42cd('0x2a')](_0x5de67d);};}exports[_0x42cd('0x2b')]=function(_0x203af3,_0x6a3fac){var _0x5da44a={},_0xb48717={},_0x30cdc8={'count':0x0,'rows':[]};var _0x399dd2=_['map'](db[_0x42cd('0x2c')][_0x42cd('0x2d')],function(_0xb3175b){return{'name':_0xb3175b[_0x42cd('0x2e')],'type':_0xb3175b[_0x42cd('0x2f')][_0x42cd('0x30')]};});_0xb48717[_0x42cd('0x31')]=_[_0x42cd('0x32')](_0x399dd2,_0x42cd('0x29'));_0xb48717[_0x42cd('0x33')]=_[_0x42cd('0x34')](_0x203af3[_0x42cd('0x33')]);_0xb48717[_0x42cd('0x35')]=_[_0x42cd('0x36')](_0xb48717['model'],_0xb48717['query']);_0x5da44a[_0x42cd('0x37')]=_[_0x42cd('0x36')](_0xb48717[_0x42cd('0x31')],qs[_0x42cd('0x38')](_0x203af3[_0x42cd('0x33')][_0x42cd('0x38')]));_0x5da44a[_0x42cd('0x37')]=_0x5da44a[_0x42cd('0x37')][_0x42cd('0x39')]?_0x5da44a[_0x42cd('0x37')]:_0xb48717['model'];if(!_0x203af3[_0x42cd('0x33')][_0x42cd('0x3a')](_0x42cd('0x3b'))){_0x5da44a['limit']=qs['limit'](_0x203af3[_0x42cd('0x33')]['limit']);_0x5da44a[_0x42cd('0x21')]=qs[_0x42cd('0x21')](_0x203af3[_0x42cd('0x33')][_0x42cd('0x21')]);}_0x5da44a['order']=qs[_0x42cd('0x3c')](_0x203af3['query'][_0x42cd('0x3c')]);_0x5da44a['where']=qs['filters'](_['pick'](_0x203af3[_0x42cd('0x33')],_0xb48717['filters']),_0x399dd2);if(_0x203af3['query'][_0x42cd('0x3d')]){_0x5da44a[_0x42cd('0x3e')]=_['merge'](_0x5da44a['where'],{'$or':_[_0x42cd('0x32')](_0x399dd2,function(_0x4a67a1){if(_0x4a67a1[_0x42cd('0x2f')]!==_0x42cd('0x3f')){var _0x2b84ad={};_0x2b84ad[_0x4a67a1[_0x42cd('0x29')]]={'$like':'%'+_0x203af3[_0x42cd('0x33')][_0x42cd('0x3d')]+'%'};return _0x2b84ad;}})});}_0x5da44a=_[_0x42cd('0x40')]({},_0x5da44a,_0x203af3[_0x42cd('0x41')]);var _0x10c2b4={'where':_0x5da44a['where']};return db[_0x42cd('0x2c')][_0x42cd('0x20')](_0x10c2b4)[_0x42cd('0x26')](function(_0x20338e){_0x30cdc8['count']=_0x20338e;if(_0x203af3[_0x42cd('0x33')][_0x42cd('0x42')]){_0x5da44a[_0x42cd('0x43')]=[{'all':!![]}];}return db[_0x42cd('0x2c')][_0x42cd('0x44')](_0x5da44a);})['then'](function(_0x1c8001){_0x30cdc8[_0x42cd('0x45')]=_0x1c8001;return _0x30cdc8;})[_0x42cd('0x26')](respondWithFilteredResult(_0x6a3fac,_0x5da44a))['catch'](handleError(_0x6a3fac,null));};exports[_0x42cd('0x46')]=function(_0x5c24cd,_0x33c777){var _0x159010={'raw':!![],'where':{'id':_0x5c24cd['params']['id']}},_0x473278={};_0x473278[_0x42cd('0x31')]=_[_0x42cd('0x34')](db[_0x42cd('0x2c')]['rawAttributes']);_0x473278[_0x42cd('0x33')]=_[_0x42cd('0x34')](_0x5c24cd[_0x42cd('0x33')]);_0x473278[_0x42cd('0x35')]=_[_0x42cd('0x36')](_0x473278[_0x42cd('0x31')],_0x473278['query']);_0x159010[_0x42cd('0x37')]=_['intersection'](_0x473278[_0x42cd('0x31')],qs[_0x42cd('0x38')](_0x5c24cd['query'][_0x42cd('0x38')]));_0x159010[_0x42cd('0x37')]=_0x159010[_0x42cd('0x37')][_0x42cd('0x39')]?_0x159010[_0x42cd('0x37')]:_0x473278[_0x42cd('0x31')];if(_0x5c24cd[_0x42cd('0x33')][_0x42cd('0x42')]){_0x159010[_0x42cd('0x43')]=[{'all':!![]}];}_0x159010=_[_0x42cd('0x40')]({},_0x159010,_0x5c24cd[_0x42cd('0x41')]);return db[_0x42cd('0x2c')][_0x42cd('0x47')](_0x159010)[_0x42cd('0x26')](handleEntityNotFound(_0x33c777,null))[_0x42cd('0x26')](respondWithResult(_0x33c777,null))[_0x42cd('0x48')](handleError(_0x33c777,null));};exports[_0x42cd('0x49')]=function(_0x1b8579,_0x203551){return db[_0x42cd('0x2c')][_0x42cd('0x49')](_0x1b8579['body'],{})[_0x42cd('0x26')](respondWithResult(_0x203551,0xc9))[_0x42cd('0x48')](handleError(_0x203551,null));};exports[_0x42cd('0x25')]=function(_0x2600f3,_0x397832){if(_0x2600f3['body']['id']){delete _0x2600f3[_0x42cd('0x4a')]['id'];}return db[_0x42cd('0x2c')]['find']({'where':{'id':_0x2600f3[_0x42cd('0x4b')]['id']}})[_0x42cd('0x26')](handleEntityNotFound(_0x397832,null))[_0x42cd('0x26')](saveUpdates(_0x2600f3['body'],null))['then'](respondWithResult(_0x397832,null))['catch'](handleError(_0x397832,null));};exports[_0x42cd('0x27')]=function(_0x105823,_0x3e1f18){return db[_0x42cd('0x2c')][_0x42cd('0x47')]({'where':{'id':_0x105823[_0x42cd('0x4b')]['id']}})[_0x42cd('0x26')](handleEntityNotFound(_0x3e1f18,null))[_0x42cd('0x26')](removeEntity(_0x3e1f18,null))[_0x42cd('0x48')](handleError(_0x3e1f18,null));};exports[_0x42cd('0x4c')]=function(_0x71a023,_0x568fce){return db[_0x42cd('0x2c')][_0x42cd('0x4c')]()[_0x42cd('0x26')](respondWithResult(_0x568fce,null))[_0x42cd('0x48')](handleError(_0x568fce,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b058718..4154b13 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 _0xaa11=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_jscripty_questions','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa11,0xd7));var _0x1aa1=function(_0x45494,_0x1040a5){_0x45494=_0x45494-0x0;var _0x2ee547=_0xaa11[_0x45494];return _0x2ee547;};'use strict';var _=require(_0x1aa1('0x0'));var util=require(_0x1aa1('0x1'));var logger=require('../../config/logger')(_0x1aa1('0x2'));var moment=require(_0x1aa1('0x3'));var BPromise=require(_0x1aa1('0x4'));var rp=require(_0x1aa1('0x5'));var fs=require('fs');var path=require(_0x1aa1('0x6'));var rimraf=require(_0x1aa1('0x7'));var config=require(_0x1aa1('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x1aa1('0x9')]=function(_0x48a815,_0x4a66a4){return _0x48a815[_0x1aa1('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x1aa1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ea2=['path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3c8960,_0x58e3cf){var _0xf4dd88=function(_0x716587){while(--_0x716587){_0x3c8960['push'](_0x3c8960['shift']());}};_0xf4dd88(++_0x58e3cf);}(_0x0ea2,0x96));var _0x20ea=function(_0x28eabf,_0x5bc9a4){_0x28eabf=_0x28eabf-0x0;var _0x11cb05=_0x0ea2[_0x28eabf];return _0x11cb05;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var logger=require(_0x20ea('0x2'))(_0x20ea('0x3'));var moment=require('moment');var BPromise=require(_0x20ea('0x4'));var rp=require(_0x20ea('0x5'));var fs=require('fs');var path=require(_0x20ea('0x6'));var rimraf=require(_0x20ea('0x7'));var config=require(_0x20ea('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2cb1d2,_0xb52ec4){return _0x2cb1d2[_0x20ea('0x9')](_0x20ea('0xa'),attributes,{'tableName':_0x20ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ad236ac..6318658 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 _0xe2ac=['http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x30c7d6,_0x3177cf){var _0x207b5c=function(_0x2f9f57){while(--_0x2f9f57){_0x30c7d6['push'](_0x30c7d6['shift']());}};_0x207b5c(++_0x3177cf);}(_0xe2ac,0x1c3));var _0xce2a=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xe2ac[_0x5dc03e];return _0x466a07;};'use strict';var _=require(_0xce2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xce2a('0x1'));var rs=require(_0xce2a('0x2'));var fs=require('fs');var Redis=require(_0xce2a('0x3'));var db=require(_0xce2a('0x4'))['db'];var utils=require(_0xce2a('0x5'));var logger=require(_0xce2a('0x6'))('rpc');var config=require(_0xce2a('0x7'));var jayson=require(_0xce2a('0x8'));var client=jayson['client'][_0xce2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4a99,_0x39e073,_0x3432ec){return new BPromise(function(_0x2a92fa,_0x2c702a){return client[_0xce2a('0xa')](_0x2a4a99,_0x3432ec)[_0xce2a('0xb')](function(_0x40d801){logger[_0xce2a('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x39e073,_0xce2a('0xd'));logger[_0xce2a('0xe')](_0xce2a('0xf'),_0x39e073,'request\x20sent',JSON[_0xce2a('0x10')](_0x40d801));if(_0x40d801['error']){if(_0x40d801[_0xce2a('0x11')][_0xce2a('0x12')]===0x1f4){logger[_0xce2a('0x11')](_0xce2a('0x13'),_0x39e073,_0x40d801['error'][_0xce2a('0x14')]);return _0x2c702a(_0x40d801[_0xce2a('0x11')][_0xce2a('0x14')]);}logger['error'](_0xce2a('0x13'),_0x39e073,_0x40d801['error'][_0xce2a('0x14')]);return _0x2a92fa(_0x40d801[_0xce2a('0x11')][_0xce2a('0x14')]);}else{logger[_0xce2a('0xc')](_0xce2a('0x13'),_0x39e073,_0xce2a('0xd'));_0x2a92fa(_0x40d801[_0xce2a('0x15')]['message']);}})[_0xce2a('0x16')](function(_0x5c3247){logger[_0xce2a('0x11')](_0xce2a('0x13'),_0x39e073,_0x5c3247);_0x2c702a(_0x5c3247);});});} \ No newline at end of file +var _0x6a7a=['JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x840dd7,_0x4db359){var _0x2f6fda=function(_0xaf9197){while(--_0xaf9197){_0x840dd7['push'](_0x840dd7['shift']());}};_0x2f6fda(++_0x4db359);}(_0x6a7a,0x1a6));var _0xa6a7=function(_0x2bd6c0,_0x55b913){_0x2bd6c0=_0x2bd6c0-0x0;var _0x49f3a3=_0x6a7a[_0x2bd6c0];return _0x49f3a3;};'use strict';var _=require(_0xa6a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6a7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6a7('0x2'))['db'];var utils=require(_0xa6a7('0x3'));var logger=require(_0xa6a7('0x4'))(_0xa6a7('0x5'));var config=require('../../config/environment');var jayson=require(_0xa6a7('0x6'));var client=jayson[_0xa6a7('0x7')][_0xa6a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48bdb5,_0x1e983e,_0x296a03){return new BPromise(function(_0x4bc1b1,_0x11cfe8){return client[_0xa6a7('0x9')](_0x48bdb5,_0x296a03)[_0xa6a7('0xa')](function(_0x4027a2){logger[_0xa6a7('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e983e,_0xa6a7('0xc'));logger[_0xa6a7('0xd')](_0xa6a7('0xe'),_0x1e983e,_0xa6a7('0xc'),JSON[_0xa6a7('0xf')](_0x4027a2));if(_0x4027a2[_0xa6a7('0x10')]){if(_0x4027a2[_0xa6a7('0x10')][_0xa6a7('0x11')]===0x1f4){logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x1e983e,_0x4027a2[_0xa6a7('0x10')][_0xa6a7('0x13')]);return _0x11cfe8(_0x4027a2[_0xa6a7('0x10')][_0xa6a7('0x13')]);}logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x1e983e,_0x4027a2[_0xa6a7('0x10')][_0xa6a7('0x13')]);return _0x4bc1b1(_0x4027a2['error'][_0xa6a7('0x13')]);}else{logger['info'](_0xa6a7('0x12'),_0x1e983e,'request\x20sent');_0x4bc1b1(_0x4027a2[_0xa6a7('0x14')]['message']);}})[_0xa6a7('0x15')](function(_0x41d01e){logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x1e983e,_0x41d01e);_0x11cfe8(_0x41d01e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2ba06cf..7a86dcb 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 _0xff56=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','show','/:id/questions','getQuestions','post','create','put','/:id','update','delete'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xff56,0x160));var _0x6ff5=function(_0x355b88,_0x2ae399){_0x355b88=_0x355b88-0x0;var _0xa40ccc=_0xff56[_0x355b88];return _0xa40ccc;};'use strict';var multer=require(_0x6ff5('0x0'));var util=require(_0x6ff5('0x1'));var path=require(_0x6ff5('0x2'));var timeout=require(_0x6ff5('0x3'));var express=require(_0x6ff5('0x4'));var router=express[_0x6ff5('0x5')]();var fs_extra=require(_0x6ff5('0x6'));var auth=require(_0x6ff5('0x7'));var interaction=require(_0x6ff5('0x8'));var config=require('../../config/environment');var controller=require(_0x6ff5('0x9'));router['get']('/',auth[_0x6ff5('0xa')](),controller[_0x6ff5('0xb')]);router[_0x6ff5('0xc')](_0x6ff5('0xd'),auth[_0x6ff5('0xa')](),controller['describe']);router['get']('/:id',auth[_0x6ff5('0xa')](),controller[_0x6ff5('0xe')]);router[_0x6ff5('0xc')](_0x6ff5('0xf'),auth[_0x6ff5('0xa')](),controller[_0x6ff5('0x10')]);router[_0x6ff5('0x11')]('/',auth[_0x6ff5('0xa')](),controller[_0x6ff5('0x12')]);router[_0x6ff5('0x13')](_0x6ff5('0x14'),auth[_0x6ff5('0xa')](),controller[_0x6ff5('0x15')]);router[_0x6ff5('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x6ff5('0x17')]);module[_0x6ff5('0x18')]=router; \ No newline at end of file +var _0x6701=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','post','create','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x6701,0x1de));var _0x1670=function(_0x46eb54,_0x4f1eac){_0x46eb54=_0x46eb54-0x0;var _0x3902b2=_0x6701[_0x46eb54];return _0x3902b2;};'use strict';var multer=require(_0x1670('0x0'));var util=require(_0x1670('0x1'));var path=require(_0x1670('0x2'));var timeout=require(_0x1670('0x3'));var express=require(_0x1670('0x4'));var router=express[_0x1670('0x5')]();var fs_extra=require(_0x1670('0x6'));var auth=require(_0x1670('0x7'));var interaction=require(_0x1670('0x8'));var config=require(_0x1670('0x9'));var controller=require(_0x1670('0xa'));router[_0x1670('0xb')]('/',auth[_0x1670('0xc')](),controller['index']);router[_0x1670('0xb')](_0x1670('0xd'),auth['isAuthenticated'](),controller[_0x1670('0xe')]);router[_0x1670('0xb')](_0x1670('0xf'),auth[_0x1670('0xc')](),controller[_0x1670('0x10')]);router[_0x1670('0xb')](_0x1670('0x11'),auth[_0x1670('0xc')](),controller['getQuestions']);router[_0x1670('0x12')]('/',auth[_0x1670('0xc')](),controller[_0x1670('0x13')]);router[_0x1670('0x14')](_0x1670('0xf'),auth[_0x1670('0xc')](),controller[_0x1670('0x15')]);router[_0x1670('0x16')](_0x1670('0xf'),auth[_0x1670('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 7a48e45..173cfe4 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 _0xf34f=['YYYY-MM-DD\x20HH:mm:ss','STRING','moment','exports','starttime','setDataValue','endtime'];(function(_0x3f8ef3,_0x3d70fa){var _0x139f54=function(_0x168e9d){while(--_0x168e9d){_0x3f8ef3['push'](_0x3f8ef3['shift']());}};_0x139f54(++_0x3d70fa);}(_0xf34f,0x64));var _0xff34=function(_0x5b560e,_0x4b8328){_0x5b560e=_0x5b560e-0x0;var _0xe56212=_0xf34f[_0x5b560e];return _0xe56212;};'use strict';var moment=require(_0xff34('0x0'));var Sequelize=require('sequelize');module[_0xff34('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x36c919){this['setDataValue'](_0xff34('0x2'),_0x36c919);this[_0xff34('0x3')](_0xff34('0x4'),moment()['format'](_0xff34('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xff34('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xff34('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xff34('0x6')]},'calleridnum':{'type':Sequelize[_0xff34('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbd19=['moment','sequelize','DATE','starttime','setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x34a075,_0x414612){var _0x158200=function(_0xe21105){while(--_0xe21105){_0x34a075['push'](_0x34a075['shift']());}};_0x158200(++_0x414612);}(_0xbd19,0x1f0));var _0x9bd1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xbd19[_0x616290];return _0x453879;};'use strict';var moment=require(_0x9bd1('0x0'));var Sequelize=require(_0x9bd1('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x9bd1('0x2')],'set':function(_0x51693a){this['setDataValue'](_0x9bd1('0x3'),_0x51693a);this[_0x9bd1('0x4')]('endtime',moment()['format'](_0x9bd1('0x5')));}},'endtime':{'type':Sequelize[_0x9bd1('0x2')]},'membername':{'type':Sequelize[_0x9bd1('0x6')]},'projectname':{'type':Sequelize[_0x9bd1('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9bd1('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x9bd1('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a9c9007..d205ab7 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 _0xcd1c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','JscriptySessionReport','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','rows','show','params','includeAll','find','create','body','catch','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','options','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2cff89,_0x3c953a){var _0x34298f=function(_0x5f4580){while(--_0x5f4580){_0x2cff89['push'](_0x2cff89['shift']());}};_0x34298f(++_0x3c953a);}(_0xcd1c,0x130));var _0xccd1=function(_0xf95355,_0x5ab11d){_0xf95355=_0xf95355-0x0;var _0x1108b1=_0xcd1c[_0xf95355];return _0x1108b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccd1('0x0'));var zipdir=require(_0xccd1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccd1('0x2'));var moment=require('moment');var BPromise=require(_0xccd1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xccd1('0x4'));var sox=require(_0xccd1('0x5'));var csv=require(_0xccd1('0x6'));var ejs=require(_0xccd1('0x7'));var fs=require('fs');var fs_extra=require(_0xccd1('0x8'));var _=require(_0xccd1('0x9'));var squel=require('squel');var crypto=require(_0xccd1('0xa'));var jsforce=require(_0xccd1('0xb'));var deskjs=require(_0xccd1('0xc'));var toCsv=require(_0xccd1('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xccd1('0xd'));var authService=require(_0xccd1('0xe'));var qs=require(_0xccd1('0xf'));var as=require(_0xccd1('0x10'));var hardwareService=require(_0xccd1('0x11'));var logger=require(_0xccd1('0x12'))('api');var utils=require(_0xccd1('0x13'));var config=require(_0xccd1('0x14'));var licenseUtil=require(_0xccd1('0x15'));var db=require(_0xccd1('0x16'))['db'];function respondWithStatusCode(_0x497d17,_0x523a7c){_0x523a7c=_0x523a7c||0xcc;return function(_0x1b0df5){if(_0x1b0df5){return _0x497d17[_0xccd1('0x17')](_0x523a7c);}return _0x497d17[_0xccd1('0x18')](_0x523a7c)[_0xccd1('0x19')]();};}function respondWithResult(_0x2e50b6,_0x3f37c5){_0x3f37c5=_0x3f37c5||0xc8;return function(_0x517848){if(_0x517848){return _0x2e50b6['status'](_0x3f37c5)[_0xccd1('0x1a')](_0x517848);}};}function respondWithFilteredResult(_0xea42af,_0x2d4cac){return function(_0x284631){if(_0x284631){var _0x390c6d=typeof _0x2d4cac[_0xccd1('0x1b')]===_0xccd1('0x1c')&&typeof _0x2d4cac[_0xccd1('0x1d')]===_0xccd1('0x1c');var _0x47fe14=_0x284631[_0xccd1('0x1e')];var _0x50dc0f=_0x390c6d?0x0:_0x2d4cac['offset'];var _0x41f2d6=_0x390c6d?_0x284631['count']:_0x2d4cac['offset']+_0x2d4cac[_0xccd1('0x1d')];var _0x35cfa0;if(_0x41f2d6>=_0x47fe14){_0x41f2d6=_0x47fe14;_0x35cfa0=0xc8;}else{_0x35cfa0=0xce;}_0xea42af[_0xccd1('0x18')](_0x35cfa0);return _0xea42af[_0xccd1('0x1f')](_0xccd1('0x20'),_0x50dc0f+'-'+_0x41f2d6+'/'+_0x47fe14)[_0xccd1('0x1a')](_0x284631);}return null;};}function patchUpdates(_0x2367c5){return function(_0x5ca03a){try{jsonpatch[_0xccd1('0x21')](_0x5ca03a,_0x2367c5,!![]);}catch(_0x3f11db){return BPromise['reject'](_0x3f11db);}return _0x5ca03a[_0xccd1('0x22')]();};}function saveUpdates(_0x3db2af,_0x463589){return function(_0x1489c6){if(_0x1489c6){return _0x1489c6[_0xccd1('0x23')](_0x3db2af)[_0xccd1('0x24')](function(_0x285b3c){return _0x285b3c;});}return null;};}function removeEntity(_0x137f3f,_0x4cd969){return function(_0x250f15){if(_0x250f15){return _0x250f15[_0xccd1('0x25')]()['then'](function(){_0x137f3f[_0xccd1('0x18')](0xcc)[_0xccd1('0x19')]();});}};}function handleEntityNotFound(_0x1bce14,_0x4daef1){return function(_0x404f80){if(!_0x404f80){_0x1bce14[_0xccd1('0x17')](0x194);}return _0x404f80;};}function handleError(_0x37daea,_0x1c9a7a){_0x1c9a7a=_0x1c9a7a||0x1f4;return function(_0x2d3f9b){logger[_0xccd1('0x26')](_0x2d3f9b[_0xccd1('0x27')]);if(_0x2d3f9b[_0xccd1('0x28')]){delete _0x2d3f9b[_0xccd1('0x28')];}_0x37daea[_0xccd1('0x18')](_0x1c9a7a)['send'](_0x2d3f9b);};}exports[_0xccd1('0x29')]=function(_0x1ac9dd,_0x36f8ca){var _0x3b55f7={},_0x2de133={},_0x26d699={'count':0x0,'rows':[]};var _0x59fde2=_['map'](db[_0xccd1('0x2a')][_0xccd1('0x2b')],function(_0x27bc89){return{'name':_0x27bc89[_0xccd1('0x2c')],'type':_0x27bc89['type'][_0xccd1('0x2d')]};});_0x2de133[_0xccd1('0x2e')]=_[_0xccd1('0x2f')](_0x59fde2,_0xccd1('0x28'));_0x2de133['query']=_[_0xccd1('0x30')](_0x1ac9dd['query']);_0x2de133[_0xccd1('0x31')]=_[_0xccd1('0x32')](_0x2de133['model'],_0x2de133[_0xccd1('0x33')]);_0x3b55f7[_0xccd1('0x34')]=_['intersection'](_0x2de133[_0xccd1('0x2e')],qs[_0xccd1('0x35')](_0x1ac9dd[_0xccd1('0x33')][_0xccd1('0x35')]));_0x3b55f7[_0xccd1('0x34')]=_0x3b55f7[_0xccd1('0x34')][_0xccd1('0x36')]?_0x3b55f7['attributes']:_0x2de133[_0xccd1('0x2e')];if(!_0x1ac9dd['query'][_0xccd1('0x37')](_0xccd1('0x38'))){_0x3b55f7['limit']=qs[_0xccd1('0x1d')](_0x1ac9dd[_0xccd1('0x33')][_0xccd1('0x1d')]);_0x3b55f7['offset']=qs[_0xccd1('0x1b')](_0x1ac9dd[_0xccd1('0x33')]['offset']);}_0x3b55f7[_0xccd1('0x39')]=qs[_0xccd1('0x3a')](_0x1ac9dd['query'][_0xccd1('0x3a')]);_0x3b55f7[_0xccd1('0x3b')]=qs['filters'](_[_0xccd1('0x3c')](_0x1ac9dd[_0xccd1('0x33')],_0x2de133[_0xccd1('0x31')]),_0x59fde2);if(_0x1ac9dd[_0xccd1('0x33')]['filter']){_0x3b55f7[_0xccd1('0x3b')]=_[_0xccd1('0x3d')](_0x3b55f7[_0xccd1('0x3b')],{'$or':_['map'](_0x59fde2,function(_0x1a21f){if(_0x1a21f[_0xccd1('0x3e')]!==_0xccd1('0x3f')){var _0x537ee4={};_0x537ee4[_0x1a21f[_0xccd1('0x28')]]={'$like':'%'+_0x1ac9dd[_0xccd1('0x33')][_0xccd1('0x40')]+'%'};return _0x537ee4;}})});}_0x3b55f7=_[_0xccd1('0x3d')]({},_0x3b55f7,_0x1ac9dd['options']);var _0x2a9a7e={'where':_0x3b55f7[_0xccd1('0x3b')]};return db[_0xccd1('0x2a')][_0xccd1('0x1e')](_0x2a9a7e)['then'](function(_0x441dd6){_0x26d699[_0xccd1('0x1e')]=_0x441dd6;if(_0x1ac9dd['query']['includeAll']){_0x3b55f7[_0xccd1('0x41')]=[{'all':!![]}];}return db[_0xccd1('0x2a')]['findAll'](_0x3b55f7);})[_0xccd1('0x24')](function(_0x3837de){_0x26d699[_0xccd1('0x42')]=_0x3837de;return _0x26d699;})[_0xccd1('0x24')](respondWithFilteredResult(_0x36f8ca,_0x3b55f7))['catch'](handleError(_0x36f8ca,null));};exports[_0xccd1('0x43')]=function(_0xeb979e,_0x1ec778){var _0x3d2c3b={'raw':!![],'where':{'id':_0xeb979e[_0xccd1('0x44')]['id']}},_0x3339f6={};_0x3339f6[_0xccd1('0x2e')]=_['keys'](db[_0xccd1('0x2a')][_0xccd1('0x2b')]);_0x3339f6[_0xccd1('0x33')]=_[_0xccd1('0x30')](_0xeb979e[_0xccd1('0x33')]);_0x3339f6[_0xccd1('0x31')]=_[_0xccd1('0x32')](_0x3339f6[_0xccd1('0x2e')],_0x3339f6['query']);_0x3d2c3b[_0xccd1('0x34')]=_[_0xccd1('0x32')](_0x3339f6[_0xccd1('0x2e')],qs[_0xccd1('0x35')](_0xeb979e[_0xccd1('0x33')][_0xccd1('0x35')]));_0x3d2c3b[_0xccd1('0x34')]=_0x3d2c3b['attributes'][_0xccd1('0x36')]?_0x3d2c3b[_0xccd1('0x34')]:_0x3339f6[_0xccd1('0x2e')];if(_0xeb979e['query'][_0xccd1('0x45')]){_0x3d2c3b[_0xccd1('0x41')]=[{'all':!![]}];}_0x3d2c3b=_[_0xccd1('0x3d')]({},_0x3d2c3b,_0xeb979e['options']);return db[_0xccd1('0x2a')][_0xccd1('0x46')](_0x3d2c3b)[_0xccd1('0x24')](handleEntityNotFound(_0x1ec778,null))['then'](respondWithResult(_0x1ec778,null))['catch'](handleError(_0x1ec778,null));};exports[_0xccd1('0x47')]=function(_0x379a82,_0x12719b){return db[_0xccd1('0x2a')][_0xccd1('0x47')](_0x379a82[_0xccd1('0x48')],{})['then'](respondWithResult(_0x12719b,0xc9))[_0xccd1('0x49')](handleError(_0x12719b,null));};exports[_0xccd1('0x23')]=function(_0x10d7e1,_0x2e4608){if(_0x10d7e1[_0xccd1('0x48')]['id']){delete _0x10d7e1[_0xccd1('0x48')]['id'];}return db[_0xccd1('0x2a')][_0xccd1('0x46')]({'where':{'id':_0x10d7e1['params']['id']}})[_0xccd1('0x24')](handleEntityNotFound(_0x2e4608,null))[_0xccd1('0x24')](saveUpdates(_0x10d7e1[_0xccd1('0x48')],null))[_0xccd1('0x24')](respondWithResult(_0x2e4608,null))[_0xccd1('0x49')](handleError(_0x2e4608,null));};exports['destroy']=function(_0x4fc2ab,_0x3a1973){return db['JscriptySessionReport'][_0xccd1('0x46')]({'where':{'id':_0x4fc2ab[_0xccd1('0x44')]['id']}})[_0xccd1('0x24')](handleEntityNotFound(_0x3a1973,null))[_0xccd1('0x24')](removeEntity(_0x3a1973,null))[_0xccd1('0x49')](handleError(_0x3a1973,null));};exports[_0xccd1('0x4a')]=function(_0x299272,_0x1876f5){return db['JscriptySessionReport'][_0xccd1('0x4a')]()['then'](respondWithResult(_0x1876f5,null))['catch'](handleError(_0x1876f5,null));};exports[_0xccd1('0x4b')]=function(_0x19249c,_0x15ef19,_0x5312e4){var _0x440fb1={'raw':!![],'where':{}};var _0x3609e3={};var _0x3f747a={'count':0x0,'rows':[]};return db[_0xccd1('0x2a')][_0xccd1('0x4c')]({'where':{'id':_0x19249c[_0xccd1('0x44')]['id']}})[_0xccd1('0x24')](handleEntityNotFound(_0x15ef19,null))['then'](function(_0x1be98f){if(_0x1be98f){_0x3609e3[_0xccd1('0x2e')]=_['keys'](db[_0xccd1('0x4d')][_0xccd1('0x2b')]);_0x3609e3['query']=_['keys'](_0x19249c['query']);_0x3609e3[_0xccd1('0x31')]=_[_0xccd1('0x32')](_0x3609e3[_0xccd1('0x2e')],_0x3609e3[_0xccd1('0x33')]);_0x440fb1[_0xccd1('0x34')]=_['intersection'](_0x3609e3[_0xccd1('0x2e')],qs[_0xccd1('0x35')](_0x19249c[_0xccd1('0x33')][_0xccd1('0x35')]));_0x440fb1[_0xccd1('0x34')]=_0x440fb1['attributes'][_0xccd1('0x36')]?_0x440fb1[_0xccd1('0x34')]:_0x3609e3['model'];if(!_0x19249c[_0xccd1('0x33')][_0xccd1('0x37')]('nolimit')){_0x440fb1[_0xccd1('0x1d')]=qs['limit'](_0x19249c[_0xccd1('0x33')][_0xccd1('0x1d')]);_0x440fb1[_0xccd1('0x1b')]=qs['offset'](_0x19249c[_0xccd1('0x33')][_0xccd1('0x1b')]);}_0x440fb1[_0xccd1('0x39')]=qs[_0xccd1('0x3a')](_0x19249c[_0xccd1('0x33')][_0xccd1('0x3a')]);_0x440fb1[_0xccd1('0x3b')]=qs[_0xccd1('0x31')](_[_0xccd1('0x3c')](_0x19249c[_0xccd1('0x33')],_0x3609e3[_0xccd1('0x31')]));_0x440fb1[_0xccd1('0x3b')][_0xccd1('0x4e')]=_0x1be98f['id'];if(_0x19249c[_0xccd1('0x33')][_0xccd1('0x40')]){_0x440fb1[_0xccd1('0x3b')]=_[_0xccd1('0x3d')](_0x440fb1[_0xccd1('0x3b')],{'$or':_['map'](_0x440fb1[_0xccd1('0x34')],function(_0x34c3e9){var _0x1c8377={};_0x1c8377[_0x34c3e9]={'$like':'%'+_0x19249c[_0xccd1('0x33')][_0xccd1('0x40')]+'%'};return _0x1c8377;})});}_0x440fb1=_[_0xccd1('0x3d')]({},_0x440fb1,_0x19249c[_0xccd1('0x4f')]);return db[_0xccd1('0x4d')][_0xccd1('0x1e')]({'where':_0x440fb1[_0xccd1('0x3b')]})[_0xccd1('0x24')](function(_0x2eb972){_0x3f747a[_0xccd1('0x1e')]=_0x2eb972;if(_0x19249c[_0xccd1('0x33')][_0xccd1('0x45')]){_0x440fb1[_0xccd1('0x41')]=[{'all':!![]}];}return db[_0xccd1('0x4d')]['findAll'](_0x440fb1);})[_0xccd1('0x24')](function(_0x39bdce){_0x3f747a[_0xccd1('0x42')]=_0x39bdce;return _0x3f747a;});}})[_0xccd1('0x24')](respondWithFilteredResult(_0x15ef19,_0x440fb1))['catch'](handleError(_0x15ef19,null));}; \ No newline at end of file +var _0x4004=['body','update','params','destroy','find','describe','getQuestions','JscriptyQuestionReport','SessionId','findAll','zip-dir','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','apply','save','then','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','include','create'];(function(_0x4a27eb,_0x3bb58f){var _0x515047=function(_0x3c82f4){while(--_0x3c82f4){_0x4a27eb['push'](_0x4a27eb['shift']());}};_0x515047(++_0x3bb58f);}(_0x4004,0x1ba));var _0x4400=function(_0x43b1fb,_0x22e01e){_0x43b1fb=_0x43b1fb-0x0;var _0x2eb5bc=_0x4004[_0x43b1fb];return _0x2eb5bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4400('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4400('0x1'));var moment=require(_0x4400('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4400('0x3'));var sox=require('sox');var csv=require(_0x4400('0x4'));var ejs=require(_0x4400('0x5'));var fs=require('fs');var fs_extra=require(_0x4400('0x6'));var _=require(_0x4400('0x7'));var squel=require(_0x4400('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4400('0x9'));var toCsv=require('to-csv');var querystring=require(_0x4400('0xa'));var Papa=require(_0x4400('0xb'));var Redis=require(_0x4400('0xc'));var authService=require(_0x4400('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4400('0xe'));var hardwareService=require(_0x4400('0xf'));var logger=require('../../config/logger')(_0x4400('0x10'));var utils=require(_0x4400('0x11'));var config=require(_0x4400('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27900a,_0x475dac){_0x475dac=_0x475dac||0xcc;return function(_0xdcba46){if(_0xdcba46){return _0x27900a[_0x4400('0x13')](_0x475dac);}return _0x27900a[_0x4400('0x14')](_0x475dac)[_0x4400('0x15')]();};}function respondWithResult(_0xc77b4d,_0x2190fa){_0x2190fa=_0x2190fa||0xc8;return function(_0x4463a6){if(_0x4463a6){return _0xc77b4d[_0x4400('0x14')](_0x2190fa)[_0x4400('0x16')](_0x4463a6);}};}function respondWithFilteredResult(_0x46a150,_0x14ffee){return function(_0x5a622e){if(_0x5a622e){var _0x591254=typeof _0x14ffee['offset']===_0x4400('0x17')&&typeof _0x14ffee[_0x4400('0x18')]===_0x4400('0x17');var _0x9909b2=_0x5a622e['count'];var _0x3e9cf5=_0x591254?0x0:_0x14ffee[_0x4400('0x19')];var _0x4fbd62=_0x591254?_0x5a622e[_0x4400('0x1a')]:_0x14ffee[_0x4400('0x19')]+_0x14ffee[_0x4400('0x18')];var _0x527fda;if(_0x4fbd62>=_0x9909b2){_0x4fbd62=_0x9909b2;_0x527fda=0xc8;}else{_0x527fda=0xce;}_0x46a150[_0x4400('0x14')](_0x527fda);return _0x46a150['set']('Content-Range',_0x3e9cf5+'-'+_0x4fbd62+'/'+_0x9909b2)[_0x4400('0x16')](_0x5a622e);}return null;};}function patchUpdates(_0x2e9602){return function(_0x1c96b8){try{jsonpatch[_0x4400('0x1b')](_0x1c96b8,_0x2e9602,!![]);}catch(_0x458dd2){return BPromise['reject'](_0x458dd2);}return _0x1c96b8[_0x4400('0x1c')]();};}function saveUpdates(_0xb6c2e9,_0x1aec66){return function(_0x83fcb4){if(_0x83fcb4){return _0x83fcb4['update'](_0xb6c2e9)[_0x4400('0x1d')](function(_0x1a0c6f){return _0x1a0c6f;});}return null;};}function removeEntity(_0x53702b,_0x4ba599){return function(_0x140b1e){if(_0x140b1e){return _0x140b1e['destroy']()['then'](function(){_0x53702b['status'](0xcc)[_0x4400('0x15')]();});}};}function handleEntityNotFound(_0x250819,_0x460395){return function(_0x3b84b7){if(!_0x3b84b7){_0x250819[_0x4400('0x13')](0x194);}return _0x3b84b7;};}function handleError(_0xbf4f46,_0x59121b){_0x59121b=_0x59121b||0x1f4;return function(_0xe1075){logger['error'](_0xe1075[_0x4400('0x1e')]);if(_0xe1075[_0x4400('0x1f')]){delete _0xe1075['name'];}_0xbf4f46[_0x4400('0x14')](_0x59121b)[_0x4400('0x20')](_0xe1075);};}exports['index']=function(_0x2b6fff,_0x168aaf){var _0x15142c={},_0x25cf9a={},_0x9ddf84={'count':0x0,'rows':[]};var _0x34c4e9=_[_0x4400('0x21')](db[_0x4400('0x22')][_0x4400('0x23')],function(_0x4821a5){return{'name':_0x4821a5[_0x4400('0x24')],'type':_0x4821a5[_0x4400('0x25')][_0x4400('0x26')]};});_0x25cf9a[_0x4400('0x27')]=_[_0x4400('0x21')](_0x34c4e9,_0x4400('0x1f'));_0x25cf9a[_0x4400('0x28')]=_[_0x4400('0x29')](_0x2b6fff[_0x4400('0x28')]);_0x25cf9a[_0x4400('0x2a')]=_[_0x4400('0x2b')](_0x25cf9a[_0x4400('0x27')],_0x25cf9a[_0x4400('0x28')]);_0x15142c[_0x4400('0x2c')]=_['intersection'](_0x25cf9a[_0x4400('0x27')],qs[_0x4400('0x2d')](_0x2b6fff[_0x4400('0x28')][_0x4400('0x2d')]));_0x15142c[_0x4400('0x2c')]=_0x15142c[_0x4400('0x2c')][_0x4400('0x2e')]?_0x15142c[_0x4400('0x2c')]:_0x25cf9a[_0x4400('0x27')];if(!_0x2b6fff[_0x4400('0x28')][_0x4400('0x2f')](_0x4400('0x30'))){_0x15142c[_0x4400('0x18')]=qs[_0x4400('0x18')](_0x2b6fff[_0x4400('0x28')][_0x4400('0x18')]);_0x15142c[_0x4400('0x19')]=qs[_0x4400('0x19')](_0x2b6fff[_0x4400('0x28')]['offset']);}_0x15142c[_0x4400('0x31')]=qs['sort'](_0x2b6fff[_0x4400('0x28')][_0x4400('0x32')]);_0x15142c[_0x4400('0x33')]=qs[_0x4400('0x2a')](_[_0x4400('0x34')](_0x2b6fff['query'],_0x25cf9a[_0x4400('0x2a')]),_0x34c4e9);if(_0x2b6fff[_0x4400('0x28')][_0x4400('0x35')]){_0x15142c[_0x4400('0x33')]=_[_0x4400('0x36')](_0x15142c[_0x4400('0x33')],{'$or':_[_0x4400('0x21')](_0x34c4e9,function(_0x43fdf6){if(_0x43fdf6[_0x4400('0x25')]!==_0x4400('0x37')){var _0x2ff8ae={};_0x2ff8ae[_0x43fdf6[_0x4400('0x1f')]]={'$like':'%'+_0x2b6fff[_0x4400('0x28')][_0x4400('0x35')]+'%'};return _0x2ff8ae;}})});}_0x15142c=_[_0x4400('0x36')]({},_0x15142c,_0x2b6fff[_0x4400('0x38')]);var _0x375b50={'where':_0x15142c[_0x4400('0x33')]};return db[_0x4400('0x22')]['count'](_0x375b50)[_0x4400('0x1d')](function(_0x23a6b7){_0x9ddf84['count']=_0x23a6b7;if(_0x2b6fff[_0x4400('0x28')][_0x4400('0x39')]){_0x15142c['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x15142c);})[_0x4400('0x1d')](function(_0x5b5e17){_0x9ddf84[_0x4400('0x3a')]=_0x5b5e17;return _0x9ddf84;})[_0x4400('0x1d')](respondWithFilteredResult(_0x168aaf,_0x15142c))[_0x4400('0x3b')](handleError(_0x168aaf,null));};exports['show']=function(_0x291f38,_0x327bc9){var _0x219837={'raw':!![],'where':{'id':_0x291f38['params']['id']}},_0x2e01b2={};_0x2e01b2[_0x4400('0x27')]=_['keys'](db[_0x4400('0x22')][_0x4400('0x23')]);_0x2e01b2[_0x4400('0x28')]=_['keys'](_0x291f38[_0x4400('0x28')]);_0x2e01b2['filters']=_[_0x4400('0x2b')](_0x2e01b2[_0x4400('0x27')],_0x2e01b2[_0x4400('0x28')]);_0x219837[_0x4400('0x2c')]=_['intersection'](_0x2e01b2[_0x4400('0x27')],qs[_0x4400('0x2d')](_0x291f38[_0x4400('0x28')][_0x4400('0x2d')]));_0x219837[_0x4400('0x2c')]=_0x219837[_0x4400('0x2c')][_0x4400('0x2e')]?_0x219837[_0x4400('0x2c')]:_0x2e01b2[_0x4400('0x27')];if(_0x291f38[_0x4400('0x28')][_0x4400('0x39')]){_0x219837[_0x4400('0x3c')]=[{'all':!![]}];}_0x219837=_['merge']({},_0x219837,_0x291f38[_0x4400('0x38')]);return db[_0x4400('0x22')]['find'](_0x219837)[_0x4400('0x1d')](handleEntityNotFound(_0x327bc9,null))['then'](respondWithResult(_0x327bc9,null))[_0x4400('0x3b')](handleError(_0x327bc9,null));};exports[_0x4400('0x3d')]=function(_0x31f17c,_0x5980b0){return db[_0x4400('0x22')][_0x4400('0x3d')](_0x31f17c[_0x4400('0x3e')],{})[_0x4400('0x1d')](respondWithResult(_0x5980b0,0xc9))[_0x4400('0x3b')](handleError(_0x5980b0,null));};exports[_0x4400('0x3f')]=function(_0x2324cd,_0x53d46a){if(_0x2324cd[_0x4400('0x3e')]['id']){delete _0x2324cd[_0x4400('0x3e')]['id'];}return db[_0x4400('0x22')]['find']({'where':{'id':_0x2324cd[_0x4400('0x40')]['id']}})[_0x4400('0x1d')](handleEntityNotFound(_0x53d46a,null))[_0x4400('0x1d')](saveUpdates(_0x2324cd['body'],null))[_0x4400('0x1d')](respondWithResult(_0x53d46a,null))[_0x4400('0x3b')](handleError(_0x53d46a,null));};exports[_0x4400('0x41')]=function(_0x2c9fcc,_0x376ad8){return db[_0x4400('0x22')][_0x4400('0x42')]({'where':{'id':_0x2c9fcc['params']['id']}})['then'](handleEntityNotFound(_0x376ad8,null))['then'](removeEntity(_0x376ad8,null))['catch'](handleError(_0x376ad8,null));};exports[_0x4400('0x43')]=function(_0x577fec,_0xaf0b35){return db[_0x4400('0x22')][_0x4400('0x43')]()[_0x4400('0x1d')](respondWithResult(_0xaf0b35,null))[_0x4400('0x3b')](handleError(_0xaf0b35,null));};exports[_0x4400('0x44')]=function(_0x2143e7,_0x41f10b,_0x4836cd){var _0xa13b8={'raw':!![],'where':{}};var _0xe196={};var _0x56e57d={'count':0x0,'rows':[]};return db[_0x4400('0x22')]['findOne']({'where':{'id':_0x2143e7[_0x4400('0x40')]['id']}})[_0x4400('0x1d')](handleEntityNotFound(_0x41f10b,null))[_0x4400('0x1d')](function(_0x4618ef){if(_0x4618ef){_0xe196[_0x4400('0x27')]=_[_0x4400('0x29')](db[_0x4400('0x45')]['rawAttributes']);_0xe196[_0x4400('0x28')]=_[_0x4400('0x29')](_0x2143e7[_0x4400('0x28')]);_0xe196['filters']=_[_0x4400('0x2b')](_0xe196[_0x4400('0x27')],_0xe196['query']);_0xa13b8['attributes']=_[_0x4400('0x2b')](_0xe196[_0x4400('0x27')],qs[_0x4400('0x2d')](_0x2143e7['query'][_0x4400('0x2d')]));_0xa13b8[_0x4400('0x2c')]=_0xa13b8['attributes'][_0x4400('0x2e')]?_0xa13b8[_0x4400('0x2c')]:_0xe196[_0x4400('0x27')];if(!_0x2143e7[_0x4400('0x28')][_0x4400('0x2f')](_0x4400('0x30'))){_0xa13b8['limit']=qs[_0x4400('0x18')](_0x2143e7['query'][_0x4400('0x18')]);_0xa13b8[_0x4400('0x19')]=qs[_0x4400('0x19')](_0x2143e7[_0x4400('0x28')]['offset']);}_0xa13b8[_0x4400('0x31')]=qs[_0x4400('0x32')](_0x2143e7[_0x4400('0x28')][_0x4400('0x32')]);_0xa13b8['where']=qs['filters'](_[_0x4400('0x34')](_0x2143e7[_0x4400('0x28')],_0xe196['filters']));_0xa13b8[_0x4400('0x33')][_0x4400('0x46')]=_0x4618ef['id'];if(_0x2143e7[_0x4400('0x28')][_0x4400('0x35')]){_0xa13b8[_0x4400('0x33')]=_['merge'](_0xa13b8['where'],{'$or':_[_0x4400('0x21')](_0xa13b8[_0x4400('0x2c')],function(_0x72e175){var _0x531f6b={};_0x531f6b[_0x72e175]={'$like':'%'+_0x2143e7[_0x4400('0x28')][_0x4400('0x35')]+'%'};return _0x531f6b;})});}_0xa13b8=_[_0x4400('0x36')]({},_0xa13b8,_0x2143e7['options']);return db[_0x4400('0x45')][_0x4400('0x1a')]({'where':_0xa13b8[_0x4400('0x33')]})[_0x4400('0x1d')](function(_0x218184){_0x56e57d[_0x4400('0x1a')]=_0x218184;if(_0x2143e7[_0x4400('0x28')]['includeAll']){_0xa13b8[_0x4400('0x3c')]=[{'all':!![]}];}return db[_0x4400('0x45')][_0x4400('0x47')](_0xa13b8);})['then'](function(_0x147250){_0x56e57d[_0x4400('0x3a')]=_0x147250;return _0x56e57d;});}})[_0x4400('0x1d')](respondWithFilteredResult(_0x41f10b,_0xa13b8))[_0x4400('0x3b')](handleError(_0x41f10b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f6792c4..355affd 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 _0x25fa=['path','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3e8a52,_0x5df9fc){var _0x44b92f=function(_0x10451){while(--_0x10451){_0x3e8a52['push'](_0x3e8a52['shift']());}};_0x44b92f(++_0x5df9fc);}(_0x25fa,0x109));var _0xa25f=function(_0x56459d,_0x2f4c6e){_0x56459d=_0x56459d-0x0;var _0x4714e5=_0x25fa[_0x56459d];return _0x4714e5;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x7f8db5,_0x5c6518){var _0x2146ec=function(_0x1b2521){while(--_0x1b2521){_0x7f8db5['push'](_0x7f8db5['shift']());}};_0x2146ec(++_0x5c6518);}(_0x2d72,0xa8));var _0x22d7=function(_0x5e48fd,_0xb0671f){_0x5e48fd=_0x5e48fd-0x0;var _0x27d122=_0x2d72[_0x5e48fd];return _0x27d122;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'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 76c3224..b6ce7cd 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 _0x8ace=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4308bf,_0x5a9d41){var _0x3d2fbf=function(_0x522a71){while(--_0x522a71){_0x4308bf['push'](_0x4308bf['shift']());}};_0x3d2fbf(++_0x5a9d41);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x26a84c,_0x5724a7){_0x26a84c=_0x26a84c-0x0;var _0xa7793f=_0x8ace[_0x26a84c];return _0xa7793f;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});} \ 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(_0x208e52,_0x295c8c){var _0x21f03b=function(_0x5da2db){while(--_0x5da2db){_0x208e52['push'](_0x208e52['shift']());}};_0x21f03b(++_0x295c8c);}(_0xe5af,0x9c));var _0xfe5a=function(_0xfdfc3,_0x50066e){_0xfdfc3=_0xfdfc3-0x0;var _0x375878=_0xe5af[_0xfdfc3];return _0x375878;};'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 b0daf7f..401b5b1 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 _0x0e97=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path'];(function(_0x1ba445,_0xacd4a8){var _0x2164f7=function(_0x1a0184){while(--_0x1a0184){_0x1ba445['push'](_0x1ba445['shift']());}};_0x2164f7(++_0xacd4a8);}(_0x0e97,0xfd));var _0x70e9=function(_0x4d4d3b,_0x4c55ac){_0x4d4d3b=_0x4d4d3b-0x0;var _0x445111=_0x0e97[_0x4d4d3b];return _0x445111;};'use strict';var multer=require('multer');var util=require(_0x70e9('0x0'));var path=require(_0x70e9('0x1'));var timeout=require('connect-timeout');var express=require(_0x70e9('0x2'));var router=express[_0x70e9('0x3')]();var fs_extra=require(_0x70e9('0x4'));var auth=require(_0x70e9('0x5'));var interaction=require(_0x70e9('0x6'));var config=require(_0x70e9('0x7'));var controller=require('./license.controller');router[_0x70e9('0x8')]('/',controller[_0x70e9('0x9')]);router[_0x70e9('0xa')](_0x70e9('0xb'),auth[_0x70e9('0xc')](),controller[_0x70e9('0xd')]);router[_0x70e9('0x8')](_0x70e9('0xe'),auth[_0x70e9('0xc')](),controller[_0x70e9('0xf')]);module[_0x70e9('0x10')]=router; \ No newline at end of file +var _0x5f16=['get','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','index','put','/:id','isAuthenticated','update'];(function(_0x21b960,_0x52676a){var _0x4f0c18=function(_0x10813b){while(--_0x10813b){_0x21b960['push'](_0x21b960['shift']());}};_0x4f0c18(++_0x52676a);}(_0x5f16,0x16c));var _0x65f1=function(_0x4e4be7,_0x49619e){_0x4e4be7=_0x4e4be7-0x0;var _0x1fac55=_0x5f16[_0x4e4be7];return _0x1fac55;};'use strict';var multer=require('multer');var util=require(_0x65f1('0x0'));var path=require(_0x65f1('0x1'));var timeout=require(_0x65f1('0x2'));var express=require(_0x65f1('0x3'));var router=express[_0x65f1('0x4')]();var fs_extra=require(_0x65f1('0x5'));var auth=require(_0x65f1('0x6'));var interaction=require(_0x65f1('0x7'));var config=require('../../config/environment');var controller=require(_0x65f1('0x8'));router['get']('/',controller[_0x65f1('0x9')]);router[_0x65f1('0xa')](_0x65f1('0xb'),auth[_0x65f1('0xc')](),controller[_0x65f1('0xd')]);router[_0x65f1('0xe')](_0x65f1('0xf'),auth[_0x65f1('0xc')](),controller[_0x65f1('0x10')]);module[_0x65f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 5887d4c..0820a26 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 _0xe7b6=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x1a4233,_0x1e83b5){var _0x334388=function(_0x5cb9c9){while(--_0x5cb9c9){_0x1a4233['push'](_0x1a4233['shift']());}};_0x334388(++_0x1e83b5);}(_0xe7b6,0x143));var _0x6e7b=function(_0x37d845,_0xa7ba6e){_0x37d845=_0x37d845-0x0;var _0x1e12d6=_0xe7b6[_0x37d845];return _0x1e12d6;};'use strict';var Sequelize=require(_0x6e7b('0x0'));module[_0x6e7b('0x1')]={'license':{'type':Sequelize[_0x6e7b('0x2')]},'data1':{'type':Sequelize[_0x6e7b('0x3')]},'data2':{'type':Sequelize[_0x6e7b('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x6e7b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x862e=['STRING','INTEGER','exports','TEXT'];(function(_0xda7c64,_0x6e05d8){var _0x5cb2c8=function(_0x5c9166){while(--_0x5c9166){_0xda7c64['push'](_0xda7c64['shift']());}};_0x5cb2c8(++_0x6e05d8);}(_0x862e,0x1ea));var _0xe862=function(_0x3068c8,_0x1f5504){_0x3068c8=_0x3068c8-0x0;var _0x40c6e4=_0x862e[_0x3068c8];return _0x40c6e4;};'use strict';var Sequelize=require('sequelize');module[_0xe862('0x0')]={'license':{'type':Sequelize[_0xe862('0x1')]},'data1':{'type':Sequelize[_0xe862('0x2')]},'data2':{'type':Sequelize[_0xe862('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe862('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 2779a9e..552eb4a 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 _0xc18d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','model','keys','License','rawAttributes','query','intersection','fields','length','attributes','merge','options','getLicense','body','find','params','checkLicense','demo','catch','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x12f750,_0x567fe5){var _0x5b5155=function(_0x528e5f){while(--_0x528e5f){_0x12f750['push'](_0x12f750['shift']());}};_0x5b5155(++_0x567fe5);}(_0xc18d,0x112));var _0xdc18=function(_0x3204c5,_0x4fc9b4){_0x3204c5=_0x3204c5-0x0;var _0x1c5bae=_0xc18d[_0x3204c5];return _0x1c5bae;};'use strict';var emlformat=require(_0xdc18('0x0'));var rimraf=require(_0xdc18('0x1'));var zipdir=require(_0xdc18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc18('0x3'));var BPromise=require(_0xdc18('0x4'));var Mustache=require(_0xdc18('0x5'));var util=require(_0xdc18('0x6'));var path=require('path');var sox=require(_0xdc18('0x7'));var csv=require(_0xdc18('0x8'));var ejs=require(_0xdc18('0x9'));var fs=require('fs');var fs_extra=require(_0xdc18('0xa'));var _=require(_0xdc18('0xb'));var squel=require(_0xdc18('0xc'));var crypto=require(_0xdc18('0xd'));var jsforce=require(_0xdc18('0xe'));var deskjs=require(_0xdc18('0xf'));var toCsv=require(_0xdc18('0x8'));var querystring=require(_0xdc18('0x10'));var Papa=require(_0xdc18('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdc18('0x12'));var as=require(_0xdc18('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc18('0x14'))(_0xdc18('0x15'));var utils=require(_0xdc18('0x16'));var config=require(_0xdc18('0x17'));var licenseUtil=require(_0xdc18('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec3d6,_0x4a6e02){_0x4a6e02=_0x4a6e02||0xcc;return function(_0x4878d9){if(_0x4878d9){return _0x3ec3d6['sendStatus'](_0x4a6e02);}return _0x3ec3d6['status'](_0x4a6e02)[_0xdc18('0x19')]();};}function respondWithResult(_0x15a33a,_0x15f62d){_0x15f62d=_0x15f62d||0xc8;return function(_0x39ed8d){if(_0x39ed8d){return _0x15a33a['status'](_0x15f62d)[_0xdc18('0x1a')](_0x39ed8d);}};}function respondWithFilteredResult(_0x2391d2,_0x4ac5d1){return function(_0x2e1e12){if(_0x2e1e12){var _0x49f211=typeof _0x4ac5d1[_0xdc18('0x1b')]===_0xdc18('0x1c')&&typeof _0x4ac5d1['limit']==='undefined';var _0x1743c6=_0x2e1e12[_0xdc18('0x1d')];var _0x1a0a11=_0x49f211?0x0:_0x4ac5d1[_0xdc18('0x1b')];var _0x3ef3cb=_0x49f211?_0x2e1e12[_0xdc18('0x1d')]:_0x4ac5d1['offset']+_0x4ac5d1[_0xdc18('0x1e')];var _0x5df135;if(_0x3ef3cb>=_0x1743c6){_0x3ef3cb=_0x1743c6;_0x5df135=0xc8;}else{_0x5df135=0xce;}_0x2391d2[_0xdc18('0x1f')](_0x5df135);return _0x2391d2[_0xdc18('0x20')](_0xdc18('0x21'),_0x1a0a11+'-'+_0x3ef3cb+'/'+_0x1743c6)[_0xdc18('0x1a')](_0x2e1e12);}return null;};}function patchUpdates(_0x21f77b){return function(_0x3165a9){try{jsonpatch[_0xdc18('0x22')](_0x3165a9,_0x21f77b,!![]);}catch(_0x12882b){return BPromise[_0xdc18('0x23')](_0x12882b);}return _0x3165a9[_0xdc18('0x24')]();};}function saveUpdates(_0x44ca39,_0x59b61a){return function(_0x43a681){if(_0x43a681){return _0x43a681[_0xdc18('0x25')](_0x44ca39)['then'](function(_0x151deb){return _0x151deb;});}return null;};}function removeEntity(_0x5e0c04,_0xaea586){return function(_0x2bdb15){if(_0x2bdb15){return _0x2bdb15[_0xdc18('0x26')]()[_0xdc18('0x27')](function(){_0x5e0c04[_0xdc18('0x1f')](0xcc)[_0xdc18('0x19')]();});}};}function handleEntityNotFound(_0x35ae5a,_0x527e7d){return function(_0x24bf09){if(!_0x24bf09){_0x35ae5a[_0xdc18('0x28')](0x194);}return _0x24bf09;};}function handleError(_0x152358,_0x5041f2){_0x5041f2=_0x5041f2||0x1f4;return function(_0x5e9e7f){logger[_0xdc18('0x29')](_0x5e9e7f[_0xdc18('0x2a')]);if(_0x5e9e7f['name']){delete _0x5e9e7f[_0xdc18('0x2b')];}_0x152358[_0xdc18('0x1f')](_0x5041f2)['send'](_0x5e9e7f);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x5d2107,_0x5d5290){var _0x341642={'raw':!![],'where':{'id':0x1}},_0x245ef9={};_0x245ef9[_0xdc18('0x2c')]=_[_0xdc18('0x2d')](db[_0xdc18('0x2e')][_0xdc18('0x2f')]);_0x245ef9['query']=_[_0xdc18('0x2d')](_0x5d2107[_0xdc18('0x30')]);_0x245ef9['filters']=_[_0xdc18('0x31')](_0x245ef9[_0xdc18('0x2c')],_0x245ef9['query']);_0x341642['attributes']=_[_0xdc18('0x31')](_0x245ef9['model'],qs['fields'](_0x5d2107[_0xdc18('0x30')][_0xdc18('0x32')]));_0x341642['attributes']=_0x341642['attributes'][_0xdc18('0x33')]?_0x341642[_0xdc18('0x34')]:_0x245ef9[_0xdc18('0x2c')];_0x341642=_[_0xdc18('0x35')]({},_0x341642,_0x5d2107[_0xdc18('0x36')]);return utilLicense[_0xdc18('0x37')](_0x341642)[_0xdc18('0x27')](respondWithResult(_0x5d5290,null))['catch'](handleError(_0x5d5290,null));};exports[_0xdc18('0x25')]=function(_0x5cfcfb,_0x153f91){if(_0x5cfcfb[_0xdc18('0x38')]['id']){delete _0x5cfcfb[_0xdc18('0x38')]['id'];}return db['License'][_0xdc18('0x39')]({'where':{'id':_0x5cfcfb[_0xdc18('0x3a')]['id']}})[_0xdc18('0x27')](handleEntityNotFound(_0x153f91,null))[_0xdc18('0x27')](function(_0x59134c){var _0x3504bd=_0x59134c['get']({'plain':!![]});return utilLicense[_0xdc18('0x3b')](_0x3504bd,_0x5cfcfb[_0xdc18('0x38')]['key']);})[_0xdc18('0x27')](function(_0x382ce0){if(!_0x382ce0[_0xdc18('0x3c')]){return saveUpdates(_0x5cfcfb[_0xdc18('0x38')],null);}return _0x382ce0;})[_0xdc18('0x27')](respondWithResult(_0x153f91,null))[_0xdc18('0x3d')](handleError(_0x153f91,null));};exports[_0xdc18('0x3e')]=function(_0x1160ac,_0x4f6f61){var _0x53a732=_0xdc18('0x3f');var _0x7de754=path['join'](_0xdc18('0x40'),_0xdc18('0x41'),_0xdc18('0x42'),_0x53a732);_0x4f6f61[_0xdc18('0x43')](_0xdc18('0x44'),_0xdc18('0x45')+_0x53a732);_0x4f6f61['set'](_0xdc18('0x46'),_0xdc18('0x47'));_0x4f6f61[_0xdc18('0x48')](_0x7de754);}; \ No newline at end of file +var _0x618a=['update','destroy','then','sendStatus','error','stack','name','index','model','keys','rawAttributes','query','intersection','attributes','fields','length','merge','options','catch','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x618a,0x19c));var _0xa618=function(_0x4a4fb8,_0x1c8af){_0x4a4fb8=_0x4a4fb8-0x0;var _0x1d27c8=_0x618a[_0x4a4fb8];return _0x1d27c8;};'use strict';var emlformat=require(_0xa618('0x0'));var rimraf=require(_0xa618('0x1'));var zipdir=require(_0xa618('0x2'));var jsonpatch=require(_0xa618('0x3'));var rp=require(_0xa618('0x4'));var moment=require('moment');var BPromise=require(_0xa618('0x5'));var Mustache=require(_0xa618('0x6'));var util=require(_0xa618('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa618('0x8'));var ejs=require(_0xa618('0x9'));var fs=require('fs');var fs_extra=require(_0xa618('0xa'));var _=require(_0xa618('0xb'));var squel=require(_0xa618('0xc'));var crypto=require(_0xa618('0xd'));var jsforce=require(_0xa618('0xe'));var deskjs=require(_0xa618('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa618('0x10'));var Papa=require(_0xa618('0x11'));var Redis=require(_0xa618('0x12'));var authService=require(_0xa618('0x13'));var qs=require(_0xa618('0x14'));var as=require(_0xa618('0x15'));var hardwareService=require(_0xa618('0x16'));var logger=require(_0xa618('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xa618('0x18'));var licenseUtil=require(_0xa618('0x19'));var db=require(_0xa618('0x1a'))['db'];function respondWithStatusCode(_0x4d7b2e,_0x1da57b){_0x1da57b=_0x1da57b||0xcc;return function(_0xaf7d03){if(_0xaf7d03){return _0x4d7b2e['sendStatus'](_0x1da57b);}return _0x4d7b2e[_0xa618('0x1b')](_0x1da57b)[_0xa618('0x1c')]();};}function respondWithResult(_0x52cf1d,_0x3e73a0){_0x3e73a0=_0x3e73a0||0xc8;return function(_0x336de9){if(_0x336de9){return _0x52cf1d[_0xa618('0x1b')](_0x3e73a0)[_0xa618('0x1d')](_0x336de9);}};}function respondWithFilteredResult(_0x3cebb1,_0x2bd04d){return function(_0x5cad85){if(_0x5cad85){var _0x5af13f=typeof _0x2bd04d[_0xa618('0x1e')]===_0xa618('0x1f')&&typeof _0x2bd04d['limit']===_0xa618('0x1f');var _0x3878c6=_0x5cad85[_0xa618('0x20')];var _0x5cc451=_0x5af13f?0x0:_0x2bd04d['offset'];var _0x542fc0=_0x5af13f?_0x5cad85['count']:_0x2bd04d[_0xa618('0x1e')]+_0x2bd04d[_0xa618('0x21')];var _0x11cd95;if(_0x542fc0>=_0x3878c6){_0x542fc0=_0x3878c6;_0x11cd95=0xc8;}else{_0x11cd95=0xce;}_0x3cebb1['status'](_0x11cd95);return _0x3cebb1[_0xa618('0x22')](_0xa618('0x23'),_0x5cc451+'-'+_0x542fc0+'/'+_0x3878c6)[_0xa618('0x1d')](_0x5cad85);}return null;};}function patchUpdates(_0x839bd2){return function(_0x1d30cf){try{jsonpatch[_0xa618('0x24')](_0x1d30cf,_0x839bd2,!![]);}catch(_0x2c4674){return BPromise['reject'](_0x2c4674);}return _0x1d30cf[_0xa618('0x25')]();};}function saveUpdates(_0x443774,_0x16b070){return function(_0x20dcbe){if(_0x20dcbe){return _0x20dcbe[_0xa618('0x26')](_0x443774)['then'](function(_0x25471b){return _0x25471b;});}return null;};}function removeEntity(_0x5aa45d,_0x151acb){return function(_0x42c07e){if(_0x42c07e){return _0x42c07e[_0xa618('0x27')]()[_0xa618('0x28')](function(){_0x5aa45d[_0xa618('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8ba7,_0x33786a){return function(_0x5478d3){if(!_0x5478d3){_0x4d8ba7[_0xa618('0x29')](0x194);}return _0x5478d3;};}function handleError(_0x3a643f,_0x4dbab0){_0x4dbab0=_0x4dbab0||0x1f4;return function(_0x3e4090){logger[_0xa618('0x2a')](_0x3e4090[_0xa618('0x2b')]);if(_0x3e4090[_0xa618('0x2c')]){delete _0x3e4090[_0xa618('0x2c')];}_0x3a643f[_0xa618('0x1b')](_0x4dbab0)['send'](_0x3e4090);};}var utilLicense=require(_0xa618('0x19'));exports[_0xa618('0x2d')]=function(_0x257741,_0xbb46aa){var _0x326d1e={'raw':!![],'where':{'id':0x1}},_0x4e761c={};_0x4e761c[_0xa618('0x2e')]=_[_0xa618('0x2f')](db['License'][_0xa618('0x30')]);_0x4e761c[_0xa618('0x31')]=_['keys'](_0x257741['query']);_0x4e761c['filters']=_[_0xa618('0x32')](_0x4e761c['model'],_0x4e761c[_0xa618('0x31')]);_0x326d1e[_0xa618('0x33')]=_[_0xa618('0x32')](_0x4e761c[_0xa618('0x2e')],qs[_0xa618('0x34')](_0x257741[_0xa618('0x31')][_0xa618('0x34')]));_0x326d1e[_0xa618('0x33')]=_0x326d1e[_0xa618('0x33')][_0xa618('0x35')]?_0x326d1e['attributes']:_0x4e761c[_0xa618('0x2e')];_0x326d1e=_[_0xa618('0x36')]({},_0x326d1e,_0x257741[_0xa618('0x37')]);return utilLicense['getLicense'](_0x326d1e)[_0xa618('0x28')](respondWithResult(_0xbb46aa,null))[_0xa618('0x38')](handleError(_0xbb46aa,null));};exports[_0xa618('0x26')]=function(_0x479ed8,_0x20c804){if(_0x479ed8[_0xa618('0x39')]['id']){delete _0x479ed8[_0xa618('0x39')]['id'];}return db[_0xa618('0x3a')][_0xa618('0x3b')]({'where':{'id':_0x479ed8[_0xa618('0x3c')]['id']}})[_0xa618('0x28')](handleEntityNotFound(_0x20c804,null))[_0xa618('0x28')](function(_0x2b1e84){var _0x597306=_0x2b1e84[_0xa618('0x3d')]({'plain':!![]});return utilLicense[_0xa618('0x3e')](_0x597306,_0x479ed8['body'][_0xa618('0x3f')]);})[_0xa618('0x28')](function(_0x15eb37){if(!_0x15eb37[_0xa618('0x40')]){return saveUpdates(_0x479ed8[_0xa618('0x39')],null);}return _0x15eb37;})[_0xa618('0x28')](respondWithResult(_0x20c804,null))[_0xa618('0x38')](handleError(_0x20c804,null));};exports[_0xa618('0x41')]=function(_0x3aad2c,_0x4f3464){var _0x152744='license-info.log';var _0x1c7109=path[_0xa618('0x42')](_0xa618('0x43'),_0xa618('0x44'),'xcally',_0x152744);_0x4f3464[_0xa618('0x45')](_0xa618('0x46'),_0xa618('0x47')+_0x152744);_0x4f3464[_0xa618('0x22')](_0xa618('0x48'),_0xa618('0x49'));_0x4f3464[_0xa618('0x4a')](_0x1c7109);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 9125ec1..3705a80 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 _0x6028=['exports','define','License','license','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x4441a1,_0x1a8f63){var _0x3900af=function(_0x2ab6f0){while(--_0x2ab6f0){_0x4441a1['push'](_0x4441a1['shift']());}};_0x3900af(++_0x1a8f63);}(_0x6028,0x101));var _0x8602=function(_0x52ad41,_0x1012dd){_0x52ad41=_0x52ad41-0x0;var _0x142489=_0x6028[_0x52ad41];return _0x142489;};'use strict';var _=require(_0x8602('0x0'));var util=require(_0x8602('0x1'));var logger=require(_0x8602('0x2'))('api');var moment=require(_0x8602('0x3'));var BPromise=require('bluebird');var rp=require(_0x8602('0x4'));var fs=require('fs');var path=require(_0x8602('0x5'));var rimraf=require('rimraf');var config=require(_0x8602('0x6'));var attributes=require('./license.attributes');module[_0x8602('0x7')]=function(_0x3bd8cb,_0x2bb650){return _0x3bd8cb[_0x8602('0x8')](_0x8602('0x9'),attributes,{'tableName':_0x8602('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./license.attributes','License','license'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x59f6,0x1ef));var _0x659f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x59f6[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x659f('0x0'));var util=require(_0x659f('0x1'));var logger=require(_0x659f('0x2'))(_0x659f('0x3'));var moment=require(_0x659f('0x4'));var BPromise=require(_0x659f('0x5'));var rp=require(_0x659f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x659f('0x7'));var attributes=require(_0x659f('0x8'));module['exports']=function(_0xf801f5,_0x318625){return _0xf801f5['define'](_0x659f('0x9'),attributes,{'tableName':_0x659f('0xa'),'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 7632855..bc4ca20 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 _0x50d5=['code','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x1f49ec,_0x10b066){var _0x34828e=function(_0x1af28c){while(--_0x1af28c){_0x1f49ec['push'](_0x1f49ec['shift']());}};_0x34828e(++_0x10b066);}(_0x50d5,0xf5));var _0x550d=function(_0x50d171,_0xd3dfa5){_0x50d171=_0x50d171-0x0;var _0x39ab56=_0x50d5[_0x50d171];return _0x39ab56;};'use strict';var _=require(_0x550d('0x0'));var util=require(_0x550d('0x1'));var moment=require(_0x550d('0x2'));var BPromise=require(_0x550d('0x3'));var rs=require(_0x550d('0x4'));var fs=require('fs');var Redis=require(_0x550d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x550d('0x6'));var logger=require(_0x550d('0x7'))(_0x550d('0x8'));var config=require(_0x550d('0x9'));var jayson=require(_0x550d('0xa'));var client=jayson['client'][_0x550d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f86b2,_0x403145,_0x3d3d4f){return new BPromise(function(_0xcff1bb,_0x3b5166){return client[_0x550d('0xc')](_0x2f86b2,_0x3d3d4f)[_0x550d('0xd')](function(_0x29693a){logger[_0x550d('0xe')]('License,\x20%s,\x20%s',_0x403145,_0x550d('0xf'));logger[_0x550d('0x10')](_0x550d('0x11'),_0x403145,'request\x20sent',JSON['stringify'](_0x29693a));if(_0x29693a[_0x550d('0x12')]){if(_0x29693a[_0x550d('0x12')][_0x550d('0x13')]===0x1f4){logger[_0x550d('0x12')]('License,\x20%s,\x20%s',_0x403145,_0x29693a[_0x550d('0x12')][_0x550d('0x14')]);return _0x3b5166(_0x29693a[_0x550d('0x12')][_0x550d('0x14')]);}logger[_0x550d('0x12')](_0x550d('0x15'),_0x403145,_0x29693a[_0x550d('0x12')][_0x550d('0x14')]);return _0xcff1bb(_0x29693a['error'][_0x550d('0x14')]);}else{logger[_0x550d('0xe')]('License,\x20%s,\x20%s',_0x403145,_0x550d('0xf'));_0xcff1bb(_0x29693a[_0x550d('0x16')][_0x550d('0x14')]);}})[_0x550d('0x17')](function(_0x343835){logger[_0x550d('0x12')](_0x550d('0x15'),_0x403145,_0x343835);_0x3b5166(_0x343835);});});} \ No newline at end of file +var _0x210e=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x210e,0x17f));var _0xe210=function(_0x1c2d01,_0x55590b){_0x1c2d01=_0x1c2d01-0x0;var _0x2fe07e=_0x210e[_0x1c2d01];return _0x2fe07e;};'use strict';var _=require(_0xe210('0x0'));var util=require(_0xe210('0x1'));var moment=require('moment');var BPromise=require(_0xe210('0x2'));var rs=require(_0xe210('0x3'));var fs=require('fs');var Redis=require(_0xe210('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe210('0x5'))('rpc');var config=require(_0xe210('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe210('0x7')][_0xe210('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10adc8,_0x348fdd,_0x8fcde5){return new BPromise(function(_0x34bd6b,_0x30cbf8){return client['request'](_0x10adc8,_0x8fcde5)[_0xe210('0x9')](function(_0x56a138){logger[_0xe210('0xa')](_0xe210('0xb'),_0x348fdd,_0xe210('0xc'));logger[_0xe210('0xd')](_0xe210('0xe'),_0x348fdd,_0xe210('0xc'),JSON[_0xe210('0xf')](_0x56a138));if(_0x56a138['error']){if(_0x56a138[_0xe210('0x10')][_0xe210('0x11')]===0x1f4){logger[_0xe210('0x10')]('License,\x20%s,\x20%s',_0x348fdd,_0x56a138[_0xe210('0x10')][_0xe210('0x12')]);return _0x30cbf8(_0x56a138['error'][_0xe210('0x12')]);}logger[_0xe210('0x10')](_0xe210('0xb'),_0x348fdd,_0x56a138['error'][_0xe210('0x12')]);return _0x34bd6b(_0x56a138[_0xe210('0x10')][_0xe210('0x12')]);}else{logger[_0xe210('0xa')](_0xe210('0xb'),_0x348fdd,_0xe210('0xc'));_0x34bd6b(_0x56a138[_0xe210('0x13')][_0xe210('0x12')]);}})[_0xe210('0x14')](function(_0xb08899){logger[_0xe210('0x10')]('License,\x20%s,\x20%s',_0x348fdd,_0xb08899);_0x30cbf8(_0xb08899);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c355e37..e6a2465 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 _0xa0d6=['getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','addApplications','send','addAgents','put','update','removeDispositions','removeAnswers','removeImap','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers'];(function(_0x3e0ad6,_0x180c3f){var _0x57448b=function(_0x4510fa){while(--_0x4510fa){_0x3e0ad6['push'](_0x3e0ad6['shift']());}};_0x57448b(++_0x180c3f);}(_0xa0d6,0x14e));var _0x6a0d=function(_0x1a79e0,_0x4ea2ab){_0x1a79e0=_0x1a79e0-0x0;var _0x349c31=_0xa0d6[_0x1a79e0];return _0x349c31;};'use strict';var multer=require(_0x6a0d('0x0'));var util=require(_0x6a0d('0x1'));var path=require(_0x6a0d('0x2'));var timeout=require(_0x6a0d('0x3'));var express=require(_0x6a0d('0x4'));var router=express[_0x6a0d('0x5')]();var fs_extra=require(_0x6a0d('0x6'));var auth=require(_0x6a0d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6a0d('0x8'));var controller=require(_0x6a0d('0x9'));router[_0x6a0d('0xa')]('/',auth[_0x6a0d('0xb')](),controller[_0x6a0d('0xc')]);router[_0x6a0d('0xa')](_0x6a0d('0xd'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0xe')]);router[_0x6a0d('0xa')](_0x6a0d('0xf'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x10')]);router[_0x6a0d('0xa')](_0x6a0d('0x11'),auth[_0x6a0d('0xb')](),controller['getDispositions']);router[_0x6a0d('0xa')](_0x6a0d('0x12'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x13')]);router[_0x6a0d('0xa')](_0x6a0d('0x14'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x15')]);router[_0x6a0d('0xa')](_0x6a0d('0x16'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x17')]);router['get'](_0x6a0d('0x18'),auth[_0x6a0d('0xb')](),controller['getInteractions']);router[_0x6a0d('0xa')](_0x6a0d('0x19'),auth['isAuthenticated'](),controller[_0x6a0d('0x1a')]);router[_0x6a0d('0xa')](_0x6a0d('0x1b'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x1c')]);router[_0x6a0d('0xa')](_0x6a0d('0x1d'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x1e')]);router[_0x6a0d('0xa')](_0x6a0d('0x1f'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x20')]);router[_0x6a0d('0x21')](_0x6a0d('0x11'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x22')]);router[_0x6a0d('0x21')](_0x6a0d('0x12'),auth['isAuthenticated'](),controller[_0x6a0d('0x23')]);router[_0x6a0d('0x21')]('/',auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x24')]);router[_0x6a0d('0x21')]('/:id/in_servers',auth[_0x6a0d('0xb')](),controller['addImap']);router[_0x6a0d('0x21')](_0x6a0d('0x16'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x25')]);router[_0x6a0d('0x21')]('/:id/interactions',auth[_0x6a0d('0xb')](),controller['addInteraction']);router[_0x6a0d('0x21')](_0x6a0d('0x19'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x26')]);router['post']('/:id/send',auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x27')]);router[_0x6a0d('0x21')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a0d('0x28')]);router[_0x6a0d('0x29')]('/:id',auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x2a')]);router['delete'](_0x6a0d('0x11'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x2b')]);router['delete'](_0x6a0d('0x12'),auth['isAuthenticated'](),controller[_0x6a0d('0x2c')]);router['delete'](_0x6a0d('0x14'),auth['isAuthenticated'](),controller[_0x6a0d('0x2d')]);router[_0x6a0d('0x2e')](_0x6a0d('0x16'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x2f')]);router[_0x6a0d('0x2e')]('/:id',auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x30')]);router['delete'](_0x6a0d('0x1f'),auth['isAuthenticated'](),controller[_0x6a0d('0x31')]);module[_0x6a0d('0x32')]=router; \ No newline at end of file +var _0xdcd3=['describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/in_servers','addSmtp','send','removeDispositions','removeAnswers','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','/describe'];(function(_0x522503,_0x5dc0fa){var _0x16cfd7=function(_0x21c3a3){while(--_0x21c3a3){_0x522503['push'](_0x522503['shift']());}};_0x16cfd7(++_0x5dc0fa);}(_0xdcd3,0x182));var _0x3dcd=function(_0x205154,_0x4bcf68){_0x205154=_0x205154-0x0;var _0x53bc41=_0xdcd3[_0x205154];return _0x53bc41;};'use strict';var multer=require(_0x3dcd('0x0'));var util=require('util');var path=require(_0x3dcd('0x1'));var timeout=require(_0x3dcd('0x2'));var express=require(_0x3dcd('0x3'));var router=express[_0x3dcd('0x4')]();var fs_extra=require(_0x3dcd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3dcd('0x6'));var config=require('../../config/environment');var controller=require(_0x3dcd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3dcd('0x8')](_0x3dcd('0x9'),auth['isAuthenticated'](),controller[_0x3dcd('0xa')]);router['get'](_0x3dcd('0xb'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0xd')]);router[_0x3dcd('0x8')](_0x3dcd('0xe'),auth['isAuthenticated'](),controller[_0x3dcd('0xf')]);router[_0x3dcd('0x8')](_0x3dcd('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x3dcd('0x8')]('/:id/in_servers',auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x11')]);router[_0x3dcd('0x8')](_0x3dcd('0x12'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x13')]);router['get'](_0x3dcd('0x14'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x15')]);router[_0x3dcd('0x8')](_0x3dcd('0x16'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x17')]);router[_0x3dcd('0x8')](_0x3dcd('0x18'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x19')]);router['get'](_0x3dcd('0x1a'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x1b')]);router[_0x3dcd('0x8')](_0x3dcd('0x1c'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x1d')]);router[_0x3dcd('0x1e')](_0x3dcd('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3dcd('0x1e')](_0x3dcd('0x10'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x1f')]);router[_0x3dcd('0x1e')]('/',auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x20')]);router['post'](_0x3dcd('0x21'),auth[_0x3dcd('0xc')](),controller['addImap']);router['post'](_0x3dcd('0x12'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x22')]);router['post'](_0x3dcd('0x14'),auth[_0x3dcd('0xc')](),controller['addInteraction']);router[_0x3dcd('0x1e')](_0x3dcd('0x16'),auth[_0x3dcd('0xc')](),controller['addApplications']);router[_0x3dcd('0x1e')]('/:id/send',auth['isAuthenticated'](),controller[_0x3dcd('0x23')]);router[_0x3dcd('0x1e')](_0x3dcd('0x1c'),auth[_0x3dcd('0xc')](),controller['addAgents']);router['put'](_0x3dcd('0xb'),auth[_0x3dcd('0xc')](),controller['update']);router['delete']('/:id/dispositions',auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x24')]);router['delete'](_0x3dcd('0x10'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x25')]);router[_0x3dcd('0x26')](_0x3dcd('0x21'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x27')]);router['delete'](_0x3dcd('0x12'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x28')]);router[_0x3dcd('0x26')](_0x3dcd('0xb'),auth[_0x3dcd('0xc')](),controller[_0x3dcd('0x29')]);router[_0x3dcd('0x26')](_0x3dcd('0x1c'),auth['isAuthenticated'](),controller[_0x3dcd('0x2a')]);module[_0x3dcd('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 f69a939..da9422a 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 _0x83aa=['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','ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x83aa,0x8c));var _0xa83a=function(_0x29fbf3,_0x130494){_0x29fbf3=_0x29fbf3-0x0;var _0x49829a=_0x83aa[_0x29fbf3];return _0x49829a;};'use strict';var Sequelize=require('sequelize');module[_0xa83a('0x0')]={'description':{'type':Sequelize[_0xa83a('0x1')]},'name':{'type':Sequelize[_0xa83a('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xa83a('0x3')]},'markAsUnread':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa83a('0x1')],'allowNull':![],'defaultValue':_0xa83a('0x4')},'fontSize':{'type':Sequelize[_0xa83a('0x5')](0x2)[_0xa83a('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa83a('0x3')],'defaultValue':function(){return _0xa83a('0x7');}},'notificationSound':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa83a('0x5')],'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[_0xa83a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa83a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa83a('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xa83a('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa83a('0x2')],'defaultValue':![],'comment':_0xa83a('0x9'),'set':function(_0x1d6de6){if(!_0x1d6de6)this[_0xa83a('0xa')](_0xa83a('0xb'),null);this['setDataValue'](_0xa83a('0xc'),_0x1d6de6);}},'provider':{'type':Sequelize[_0xa83a('0xd')](_0xa83a('0xe'),_0xa83a('0xf'),'yahoo',_0xa83a('0x10')),'defaultValue':null,'get':function(){var _0x34fdfc=this[_0xa83a('0x11')](_0xa83a('0x12'));return _0x34fdfc||_0xa83a('0x13');},'set':function(_0x2071c7){if(_0x2071c7==='custom'){_0x2071c7=null;}return this[_0xa83a('0xa')](_0xa83a('0x12'),_0x2071c7);}}}; \ No newline at end of file +var _0x988f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x988f,0x107));var _0xf988=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x988f[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require(_0xf988('0x0'));module[_0xf988('0x1')]={'description':{'type':Sequelize[_0xf988('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xf988('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf988('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xf988('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xf988('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xf988('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xf988('0x5')](0x2)[_0xf988('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf988('0x7');}},'notificationSound':{'type':Sequelize[_0xf988('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf988('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf988('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf988('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf988('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf988('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf988('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf988('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf988('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xf988('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf988('0x9'),'set':function(_0x218c57){if(!_0x218c57)this[_0xf988('0xa')](_0xf988('0xb'),null);this[_0xf988('0xa')]('mandatoryDisposition',_0x218c57);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail',_0xf988('0xc'),'outlook365'),'defaultValue':null,'get':function(){var _0x2726a0=this[_0xf988('0xd')](_0xf988('0xe'));return _0x2726a0||_0xf988('0xf');},'set':function(_0x4d6b11){if(_0x4d6b11===_0xf988('0xf')){_0x4d6b11=null;}return this[_0xf988('0xa')](_0xf988('0xe'),_0x4d6b11);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d976a74..46ac5d9 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 _0x29c7=['modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','intersection','length','find','update','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','List','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','basename','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','subject','format','out','messageId','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','MailAccount,\x20%s,\x20%s','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','outlook365','user','username','pass','password'];(function(_0x5266fc,_0x151dde){var _0x5bef0a=function(_0x3f29b9){while(--_0x3f29b9){_0x5266fc['push'](_0x5266fc['shift']());}};_0x5bef0a(++_0x151dde);}(_0x29c7,0x147));var _0x729c=function(_0x367cdf,_0x15b107){_0x367cdf=_0x367cdf-0x0;var _0x2d3561=_0x29c7[_0x367cdf];return _0x2d3561;};'use strict';var moment=require(_0x729c('0x0'));var BPromise=require('bluebird');var util=require(_0x729c('0x1'));var path=require(_0x729c('0x2'));var _=require(_0x729c('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x729c('0x4'));var logger=require('../../config/logger')(_0x729c('0x5'));var config=require(_0x729c('0x6'));var db=require(_0x729c('0x7'))['db'];config[_0x729c('0x8')]=_[_0x729c('0x9')](config[_0x729c('0x8')],{'host':_0x729c('0xa'),'port':0x18eb});var socket=require(_0x729c('0xb'))(new Redis(config[_0x729c('0x8')]));require('./mailAccount.socket')[_0x729c('0xc')](socket);var jayson=require(_0x729c('0xd'));var client=jayson[_0x729c('0xe')][_0x729c('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x645350,_0x4852d8,_0x1b1b16,_0x11cf37){return new BPromise(function(_0x4fa112,_0x25cdc4){var _0x1321ff=_0x11cf37||client;return _0x1321ff[_0x729c('0x10')](_0x645350,_0x1b1b16)[_0x729c('0x11')](function(_0x53470e){logger[_0x729c('0x12')]('MailAccount,\x20%s,\x20%s',_0x4852d8,_0x729c('0x13'));logger[_0x729c('0x14')](_0x729c('0x15'),_0x4852d8,_0x729c('0x13'),JSON['stringify'](_0x53470e));if(_0x53470e[_0x729c('0x16')]){if(_0x53470e[_0x729c('0x16')]['code']===0x1f4){logger[_0x729c('0x16')]('MailAccount,\x20%s,\x20%s',_0x4852d8,_0x53470e['error'][_0x729c('0x17')]);return _0x25cdc4(_0x53470e[_0x729c('0x16')][_0x729c('0x17')]);}logger[_0x729c('0x16')](_0x729c('0x18'),_0x4852d8,_0x53470e[_0x729c('0x16')][_0x729c('0x17')]);return _0x4fa112(_0x53470e[_0x729c('0x16')][_0x729c('0x17')]);}else{logger[_0x729c('0x12')](_0x729c('0x18'),_0x4852d8,_0x729c('0x13'));_0x4fa112(_0x53470e['result']['message']);}})[_0x729c('0x19')](function(_0x3a3557){logger['error']('MailAccount,\x20%s,\x20%s',_0x4852d8,_0x3a3557);_0x25cdc4(_0x3a3557);});});}function respondWithStatusCode(_0x156893,_0x4e9da8){_0x4e9da8=_0x4e9da8||0xcc;return function(_0x47d240){if(_0x47d240){return _0x156893[_0x729c('0x1a')](_0x4e9da8);}return _0x156893['status'](_0x4e9da8)[_0x729c('0x1b')]();};}function respondWithResult(_0x5229d5,_0x5a0efe){_0x5a0efe=_0x5a0efe||0xc8;return function(_0x143280){if(_0x143280){return _0x5229d5[_0x729c('0x1c')](_0x5a0efe)[_0x729c('0x1d')](_0x143280);}};}function respondWithFilteredResult(_0xfb4e5e,_0x46b62c){return function(_0x460153){if(_0x460153){var _0x5f0808=typeof _0x46b62c['offset']===_0x729c('0x1e')&&typeof _0x46b62c[_0x729c('0x1f')]===_0x729c('0x1e');var _0x4825be=_0x460153[_0x729c('0x20')];var _0x14899b=_0x5f0808?0x0:_0x46b62c[_0x729c('0x21')];var _0x382d7d=_0x5f0808?_0x460153[_0x729c('0x20')]:_0x46b62c[_0x729c('0x21')]+_0x46b62c[_0x729c('0x1f')];var _0x149aec;if(_0x382d7d>=_0x4825be){_0x382d7d=_0x4825be;_0x149aec=0xc8;}else{_0x149aec=0xce;}_0xfb4e5e[_0x729c('0x1c')](_0x149aec);return _0xfb4e5e['set'](_0x729c('0x22'),_0x14899b+'-'+_0x382d7d+'/'+_0x4825be)['json'](_0x460153);}return null;};}function saveUpdates(_0x3b8306){return function(_0xc2671f){if(_0xc2671f){return _0xc2671f['update'](_0x3b8306)[_0x729c('0x11')](function(_0x991203){return _0x991203;});}return null;};}function removeEntity(_0x12e8b0){return function(_0x4843a8){if(_0x4843a8){return _0x4843a8[_0x729c('0x23')]()[_0x729c('0x11')](function(){var _0x4c83c1=_0x4843a8[_0x729c('0x24')]({'plain':!![]});var _0x1bd691=_0x729c('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x1bd691,'resourceId':_0x4c83c1['id']}})[_0x729c('0x11')](function(){return _0x4843a8;});})[_0x729c('0x11')](function(){_0x12e8b0[_0x729c('0x1c')](0xcc)[_0x729c('0x1b')]();});}};}function handleEntityNotFound(_0x4704b4){return function(_0x19072a){if(!_0x19072a){_0x4704b4[_0x729c('0x1a')](0x194);}return _0x19072a;};}function handleError(_0x273a12,_0x20c25f){_0x20c25f=_0x20c25f||0x1f4;return function(_0x5821c4){logger[_0x729c('0x16')](_0x5821c4[_0x729c('0x26')]);if(_0x5821c4[_0x729c('0x27')]){delete _0x5821c4['name'];}_0x273a12[_0x729c('0x1c')](_0x20c25f)[_0x729c('0x28')](_0x5821c4);};}function getImapHost(_0x217cb7){switch(_0x217cb7){case _0x729c('0x29'):return _0x729c('0x2a');case _0x729c('0x2b'):return'imap.mail.yahoo.com';case _0x729c('0x2c'):return _0x729c('0x2d');case'outlook365':return _0x729c('0x2e');}throw new Error(_0x729c('0x2f'),_0x217cb7);}function getSmtpHost(_0x9ef34f){switch(_0x9ef34f){case _0x729c('0x29'):return _0x729c('0x30');case _0x729c('0x2b'):return'smtp.mail.yahoo.com';case _0x729c('0x2c'):return _0x729c('0x31');case _0x729c('0x32'):return'smtp.office365.com';}throw new Error(_0x729c('0x2f'),_0x9ef34f);}function getAuthenticationOptions(_0x3f0618,_0x48e780){var _0x2eefec={};var _0x3875c9={};if(_0x3f0618){_0x2eefec[_0x729c('0x33')]=_0x3875c9['user']=_0x48e780[_0x729c('0x34')];_0x2eefec['password']=_0x3875c9[_0x729c('0x35')]=_0x48e780[_0x729c('0x36')];if(_0x48e780[_0x729c('0x37')]){_0x2eefec['modernAuthentication']=_0x3875c9[_0x729c('0x37')]=!![];_0x2eefec[_0x729c('0x38')]=_0x3875c9[_0x729c('0x38')]=_0x48e780[_0x729c('0x38')];_0x2eefec[_0x729c('0x36')]=_0x3875c9[_0x729c('0x35')]=null;}else{_0x2eefec[_0x729c('0x38')]=_0x3875c9[_0x729c('0x38')]=null;}_0x2eefec[_0x729c('0x39')]=getImapHost(_0x3f0618);_0x2eefec[_0x729c('0x3a')]=0x3e1;_0x3875c9['host']=getSmtpHost(_0x3f0618);_0x3875c9['port']=0x24b;_0x3875c9[_0x729c('0x3b')]=![];_0x2eefec[_0x729c('0x3c')]=_0x3875c9[_0x729c('0x3c')]=null;}else{if(_0x48e780[_0x729c('0x3d')]){_0x2eefec[_0x729c('0x33')]=_0x3875c9['user']=_0x48e780['username'];_0x2eefec['password']=_0x3875c9[_0x729c('0x35')]=_0x48e780[_0x729c('0x36')];}else{_0x2eefec[_0x729c('0x3d')]=_0x3875c9['authentication']=![];_0x2eefec[_0x729c('0x33')]=_0x3875c9[_0x729c('0x33')]=null;_0x2eefec[_0x729c('0x36')]=_0x3875c9[_0x729c('0x35')]=null;}_0x2eefec[_0x729c('0x39')]=_0x48e780[_0x729c('0x3e')]['host'];_0x2eefec[_0x729c('0x3a')]=_0x48e780['Imap'][_0x729c('0x3a')];_0x3875c9[_0x729c('0x39')]=_0x48e780['Smtp']['host'];_0x3875c9[_0x729c('0x3a')]=_0x48e780[_0x729c('0x3f')][_0x729c('0x3a')];}return{'Imap':_0x2eefec,'Smtp':_0x3875c9};}exports[_0x729c('0x40')]=function(_0x371b0f,_0x55c951){var _0x510712={'include':[{'model':db[_0x729c('0x41')],'as':_0x729c('0x3e')},{'model':db[_0x729c('0x42')],'as':_0x729c('0x3f')},{'model':db[_0x729c('0x43')],'as':_0x729c('0x44')}]},_0x512d0a={},_0x20e2fc={'count':0x0,'rows':[]};var _0x558212=_['map'](db[_0x729c('0x45')][_0x729c('0x46')],function(_0x3b8737){return{'name':_0x3b8737[_0x729c('0x47')],'type':_0x3b8737['type']['key']};});_0x512d0a[_0x729c('0x48')]=_[_0x729c('0x49')](_0x558212,_0x729c('0x27'));_0x512d0a[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0x371b0f['query']);_0x512d0a[_0x729c('0x4c')]=_['intersection'](_0x512d0a[_0x729c('0x48')],_0x512d0a['query']);_0x510712['attributes']=_['intersection'](_0x512d0a[_0x729c('0x48')],qs[_0x729c('0x4d')](_0x371b0f[_0x729c('0x4a')]['fields']));_0x510712['attributes']=_0x510712[_0x729c('0x4e')]['length']?_0x510712[_0x729c('0x4e')]:_0x512d0a[_0x729c('0x48')];if(!_0x371b0f['query'][_0x729c('0x4f')](_0x729c('0x50'))){_0x510712['limit']=qs[_0x729c('0x1f')](_0x371b0f[_0x729c('0x4a')]['limit']);_0x510712['offset']=qs[_0x729c('0x21')](_0x371b0f['query'][_0x729c('0x21')]);}_0x510712[_0x729c('0x51')]=qs['sort'](_0x371b0f[_0x729c('0x4a')]['sort']);_0x510712[_0x729c('0x52')]=qs[_0x729c('0x4c')](_[_0x729c('0x53')](_0x371b0f[_0x729c('0x4a')],_0x512d0a[_0x729c('0x4c')]),_0x558212);if(_0x371b0f[_0x729c('0x4a')]['filter']){_0x510712[_0x729c('0x52')]=_[_0x729c('0x54')](_0x510712[_0x729c('0x52')],{'$or':_[_0x729c('0x49')](_0x558212,function(_0x77ffd4){if(_0x77ffd4[_0x729c('0x55')]!==_0x729c('0x56')){var _0x360c58={};_0x360c58[_0x77ffd4['name']]={'$like':'%'+_0x371b0f[_0x729c('0x4a')][_0x729c('0x57')]+'%'};return _0x360c58;}})});}_0x510712=_[_0x729c('0x54')]({},_0x510712,_0x371b0f[_0x729c('0x58')]);var _0x2bc26a={'where':_0x510712[_0x729c('0x52')]};return db[_0x729c('0x45')][_0x729c('0x20')](_0x2bc26a)['then'](function(_0x35a542){_0x20e2fc['count']=_0x35a542;if(_0x371b0f[_0x729c('0x4a')][_0x729c('0x59')]){_0x510712[_0x729c('0x5a')]=[{'all':!![]}];}return db['MailAccount'][_0x729c('0x5b')](_0x510712);})[_0x729c('0x11')](function(_0xa2540){_0x20e2fc[_0x729c('0x5c')]=_0xa2540;return _0x20e2fc;})[_0x729c('0x11')](respondWithFilteredResult(_0x55c951,_0x510712))[_0x729c('0x19')](handleError(_0x55c951,null));};exports['show']=function(_0x485542,_0xd149c){var _0x26049b={'raw':![],'where':{'id':_0x485542[_0x729c('0x5d')]['id']},'include':[{'model':db[_0x729c('0x41')],'as':_0x729c('0x3e')},{'model':db[_0x729c('0x42')],'as':_0x729c('0x3f')},{'model':db['Pause'],'as':_0x729c('0x44')}]},_0x4f2673={};_0x4f2673[_0x729c('0x48')]=_[_0x729c('0x4b')](db['MailAccount'][_0x729c('0x46')]);_0x4f2673[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0x485542[_0x729c('0x4a')]);_0x4f2673[_0x729c('0x4c')]=_[_0x729c('0x5e')](_0x4f2673[_0x729c('0x48')],_0x4f2673[_0x729c('0x4a')]);_0x26049b[_0x729c('0x4e')]=_[_0x729c('0x5e')](_0x4f2673[_0x729c('0x48')],qs[_0x729c('0x4d')](_0x485542[_0x729c('0x4a')][_0x729c('0x4d')]));_0x26049b[_0x729c('0x4e')]=_0x26049b[_0x729c('0x4e')][_0x729c('0x5f')]?_0x26049b[_0x729c('0x4e')]:_0x4f2673[_0x729c('0x48')];if(_0x485542['query'][_0x729c('0x59')]){_0x26049b[_0x729c('0x5a')]=[{'all':!![]}];}_0x26049b=_[_0x729c('0x54')]({},_0x26049b,_0x485542[_0x729c('0x58')]);return db[_0x729c('0x45')][_0x729c('0x60')](_0x26049b)[_0x729c('0x11')](handleEntityNotFound(_0xd149c,null))[_0x729c('0x11')](respondWithResult(_0xd149c,null))[_0x729c('0x19')](handleError(_0xd149c,null));};exports[_0x729c('0x61')]=function(_0xacf6af,_0xa8f530){if(_0xacf6af[_0x729c('0x62')]['id']){delete _0xacf6af[_0x729c('0x62')]['id'];}var _0x118339=_0xacf6af[_0x729c('0x62')][_0x729c('0x63')]===_0x729c('0x64')?null:_0xacf6af[_0x729c('0x62')][_0x729c('0x63')];var _0x51e499=_0xacf6af[_0x729c('0x62')][_0x729c('0x3e')]||{};var _0x674ea1=_0xacf6af[_0x729c('0x62')][_0x729c('0x3f')]||{};if(_0x118339){_0x51e499[_0x729c('0x39')]=getImapHost(_0x118339);_0x51e499['port']=0x3e1;_0x674ea1[_0x729c('0x39')]=getSmtpHost(_0x118339);_0x674ea1['port']=0x24b;_0x674ea1['secure']=![];}if(_0x674ea1['modernAuthentication']){_0x674ea1['secure']=![];}else{_0x674ea1[_0x729c('0x38')]=null;}if(!_0x51e499[_0x729c('0x37')])_0x51e499[_0x729c('0x38')]=null;_0xacf6af[_0x729c('0x62')][_0x729c('0x3e')]=_0x51e499;_0xacf6af[_0x729c('0x62')]['Smtp']=_0x674ea1;return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0xacf6af[_0x729c('0x5d')]['id']},'include':[{'model':db[_0x729c('0x41')],'as':'Imap'},{'model':db[_0x729c('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0x729c('0x44')}]})['then'](handleEntityNotFound(_0xa8f530,null))[_0x729c('0x11')](function(_0x5ef90d){if(!_0x5ef90d)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5ef90d['service'])delete _0xacf6af['body'][_0x729c('0x3e')];return _0x5ef90d;})[_0x729c('0x11')](saveUpdates(_0xacf6af[_0x729c('0x62')],null))['then'](function(_0xf3ab72){if(!_0xacf6af[_0x729c('0x62')][_0x729c('0x3e')])return _0xf3ab72;return db[_0x729c('0x41')][_0x729c('0x61')](_0xacf6af[_0x729c('0x62')][_0x729c('0x3e')],{'where':{'MailAccountId':_0xf3ab72['id']}})[_0x729c('0x11')](function(){return _0xf3ab72;});})[_0x729c('0x11')](function(_0x43dcdd){if(!_0xacf6af[_0x729c('0x62')][_0x729c('0x3f')])return _0x43dcdd;return db[_0x729c('0x42')]['update'](_0xacf6af['body'][_0x729c('0x3f')],{'where':{'MailAccountId':_0x43dcdd['id']}})['then'](function(){return _0x43dcdd;});})[_0x729c('0x11')](respondWithResult(_0xa8f530,null))[_0x729c('0x19')](handleError(_0xa8f530,null));};exports[_0x729c('0x65')]=function(_0x411669,_0x21e6b4){return db['MailAccount'][_0x729c('0x65')]()['then'](respondWithResult(_0x21e6b4,null))[_0x729c('0x19')](handleError(_0x21e6b4,null));};exports[_0x729c('0x66')]=function(_0x3eda34,_0x2b52f0){if(_0x3eda34[_0x729c('0x62')]['id']){delete _0x3eda34[_0x729c('0x62')]['id'];}return db[_0x729c('0x45')]['find']({'where':{'id':_0x3eda34[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x2b52f0,null))[_0x729c('0x11')](function(_0x5b11ca){if(_0x5b11ca){_0x3eda34[_0x729c('0x62')][_0x729c('0x67')]=_0x5b11ca['id'];return db[_0x729c('0x68')]['create'](_0x3eda34[_0x729c('0x62')]);}})[_0x729c('0x11')](respondWithResult(_0x2b52f0,null))[_0x729c('0x19')](handleError(_0x2b52f0,null));};exports['getDispositions']=function(_0x53dc60,_0x51ed98){var _0x4b4175={'raw':![],'where':{}};var _0x12d2df={};var _0x333d89={'count':0x0,'rows':[]};return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0x53dc60[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x51ed98,null))['then'](function(_0x41d94b){if(_0x41d94b){_0x12d2df['model']=_[_0x729c('0x4b')](db[_0x729c('0x68')]['rawAttributes']);_0x12d2df[_0x729c('0x4a')]=_['keys'](_0x53dc60['query']);_0x12d2df[_0x729c('0x4c')]=_[_0x729c('0x5e')](_0x12d2df[_0x729c('0x48')],_0x12d2df[_0x729c('0x4a')]);_0x4b4175['attributes']=_[_0x729c('0x5e')](_0x12d2df[_0x729c('0x48')],qs[_0x729c('0x4d')](_0x53dc60[_0x729c('0x4a')][_0x729c('0x4d')]));_0x4b4175[_0x729c('0x4e')]=_0x4b4175['attributes'][_0x729c('0x5f')]?_0x4b4175[_0x729c('0x4e')]:_0x12d2df[_0x729c('0x48')];if(!_0x53dc60[_0x729c('0x4a')][_0x729c('0x4f')]('nolimit')){_0x4b4175[_0x729c('0x1f')]=qs['limit'](_0x53dc60['query'][_0x729c('0x1f')]);_0x4b4175[_0x729c('0x21')]=qs[_0x729c('0x21')](_0x53dc60['query'][_0x729c('0x21')]);}_0x4b4175[_0x729c('0x51')]=qs[_0x729c('0x6a')](_0x53dc60[_0x729c('0x4a')][_0x729c('0x6a')]);_0x4b4175[_0x729c('0x52')]=qs[_0x729c('0x4c')](_[_0x729c('0x53')](_0x53dc60['query'],_0x12d2df['filters']));_0x4b4175[_0x729c('0x52')][_0x729c('0x67')]=_0x41d94b['id'];if(_0x53dc60[_0x729c('0x4a')][_0x729c('0x57')]){_0x4b4175[_0x729c('0x52')]=_[_0x729c('0x54')](_0x4b4175[_0x729c('0x52')],{'$or':_[_0x729c('0x49')](_0x4b4175[_0x729c('0x4e')],function(_0x47e35b){var _0x589353={};_0x589353[_0x47e35b]={'$like':'%'+_0x53dc60['query'][_0x729c('0x57')]+'%'};return _0x589353;})});}_0x4b4175=_['merge']({},_0x4b4175,_0x53dc60[_0x729c('0x58')]);return db[_0x729c('0x68')][_0x729c('0x20')]({'where':_0x4b4175[_0x729c('0x52')]})[_0x729c('0x11')](function(_0x45bbe5){_0x333d89[_0x729c('0x20')]=_0x45bbe5;if(_0x53dc60['query'][_0x729c('0x59')]){_0x4b4175['include']=[{'all':!![]}];}return db[_0x729c('0x68')]['findAll'](_0x4b4175);})[_0x729c('0x11')](function(_0x3c8621){_0x333d89['rows']=_0x3c8621;return _0x333d89;});}})[_0x729c('0x11')](respondWithFilteredResult(_0x51ed98,_0x4b4175))[_0x729c('0x19')](handleError(_0x51ed98,null));};exports[_0x729c('0x6b')]=function(_0x47b090,_0x8b1d75){return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0x47b090[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x8b1d75,null))[_0x729c('0x11')](function(_0x250a21){if(_0x250a21){return _0x250a21[_0x729c('0x6b')](_0x47b090['query'][_0x729c('0x6c')]);}})[_0x729c('0x11')](respondWithStatusCode(_0x8b1d75,null))[_0x729c('0x19')](handleError(_0x8b1d75,null));};exports[_0x729c('0x6d')]=function(_0x37222c,_0x4cb53f){if(_0x37222c[_0x729c('0x62')]['id']){delete _0x37222c[_0x729c('0x62')]['id'];}return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0x37222c[_0x729c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4cb53f,null))['then'](function(_0x39111f){if(_0x39111f){_0x37222c[_0x729c('0x62')][_0x729c('0x67')]=_0x39111f['id'];return db[_0x729c('0x6e')][_0x729c('0x6f')](_0x37222c[_0x729c('0x62')]);}})[_0x729c('0x11')](respondWithResult(_0x4cb53f,null))[_0x729c('0x19')](handleError(_0x4cb53f,null));};exports[_0x729c('0x70')]=function(_0x41845e,_0x7f7eee){var _0x1d921a={'raw':![],'where':{}};var _0x47877c={};var _0x653c29={'count':0x0,'rows':[]};return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0x41845e[_0x729c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x7f7eee,null))['then'](function(_0xec9771){if(_0xec9771){_0x47877c[_0x729c('0x48')]=_[_0x729c('0x4b')](db[_0x729c('0x6e')][_0x729c('0x46')]);_0x47877c[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0x41845e[_0x729c('0x4a')]);_0x47877c[_0x729c('0x4c')]=_[_0x729c('0x5e')](_0x47877c[_0x729c('0x48')],_0x47877c[_0x729c('0x4a')]);_0x1d921a['attributes']=_[_0x729c('0x5e')](_0x47877c['model'],qs[_0x729c('0x4d')](_0x41845e[_0x729c('0x4a')]['fields']));_0x1d921a[_0x729c('0x4e')]=_0x1d921a[_0x729c('0x4e')][_0x729c('0x5f')]?_0x1d921a[_0x729c('0x4e')]:_0x47877c['model'];if(!_0x41845e[_0x729c('0x4a')][_0x729c('0x4f')](_0x729c('0x50'))){_0x1d921a[_0x729c('0x1f')]=qs['limit'](_0x41845e[_0x729c('0x4a')][_0x729c('0x1f')]);_0x1d921a['offset']=qs[_0x729c('0x21')](_0x41845e[_0x729c('0x4a')][_0x729c('0x21')]);}_0x1d921a[_0x729c('0x51')]=qs[_0x729c('0x6a')](_0x41845e[_0x729c('0x4a')][_0x729c('0x6a')]);_0x1d921a[_0x729c('0x52')]=qs[_0x729c('0x4c')](_[_0x729c('0x53')](_0x41845e['query'],_0x47877c['filters']));_0x1d921a[_0x729c('0x52')][_0x729c('0x67')]=_0xec9771['id'];if(_0x41845e['query'][_0x729c('0x57')]){_0x1d921a[_0x729c('0x52')]=_[_0x729c('0x54')](_0x1d921a[_0x729c('0x52')],{'$or':_[_0x729c('0x49')](_0x1d921a[_0x729c('0x4e')],function(_0x1ff6c5){var _0x4536e7={};_0x4536e7[_0x1ff6c5]={'$like':'%'+_0x41845e[_0x729c('0x4a')][_0x729c('0x57')]+'%'};return _0x4536e7;})});}_0x1d921a=_[_0x729c('0x54')]({},_0x1d921a,_0x41845e[_0x729c('0x58')]);return db[_0x729c('0x6e')][_0x729c('0x20')]({'where':_0x1d921a[_0x729c('0x52')]})[_0x729c('0x11')](function(_0x221ec5){_0x653c29[_0x729c('0x20')]=_0x221ec5;if(_0x41845e[_0x729c('0x4a')][_0x729c('0x59')]){_0x1d921a[_0x729c('0x5a')]=[{'all':!![]}];}return db[_0x729c('0x6e')]['findAll'](_0x1d921a);})['then'](function(_0x244ca5){_0x653c29['rows']=_0x244ca5;return _0x653c29;});}})[_0x729c('0x11')](respondWithFilteredResult(_0x7f7eee,_0x1d921a))['catch'](handleError(_0x7f7eee,null));};exports[_0x729c('0x71')]=function(_0x137ba2,_0x4fc925){return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0x137ba2['params']['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x4fc925,null))[_0x729c('0x11')](function(_0x51ed36){if(_0x51ed36){return _0x51ed36[_0x729c('0x71')](_0x137ba2[_0x729c('0x4a')][_0x729c('0x6c')]);}})['then'](respondWithStatusCode(_0x4fc925,null))[_0x729c('0x19')](handleError(_0x4fc925,null));};exports['create']=function(_0x4d842c,_0x75e860){var _0x227b20={'name':_0x4d842c['body']['name'],'key':_0x4d842c[_0x729c('0x62')]['key'],'provider':_0x4d842c[_0x729c('0x62')][_0x729c('0x63')]===_0x729c('0x64')?null:_0x4d842c['body'][_0x729c('0x63')],'email':_0x4d842c[_0x729c('0x62')][_0x729c('0x72')],'ListId':_0x4d842c['body']['ListId'],'active':!_[_0x729c('0x73')](_0x4d842c[_0x729c('0x62')][_0x729c('0x74')])?_0x4d842c[_0x729c('0x62')][_0x729c('0x74')]:!![],'description':_0x4d842c[_0x729c('0x62')][_0x729c('0x75')]||null};var _0x54a3bd=getAuthenticationOptions(_0x227b20['provider'],_0x4d842c[_0x729c('0x62')]);_0x227b20[_0x729c('0x3e')]=_0x54a3bd[_0x729c('0x3e')];_0x227b20[_0x729c('0x3f')]=_0x54a3bd[_0x729c('0x3f')];return db[_0x729c('0x45')][_0x729c('0x6f')](_0x227b20,{'include':[{'model':db[_0x729c('0x42')],'as':_0x729c('0x3f')},{'model':db[_0x729c('0x41')],'as':_0x729c('0x3e')}]})['then'](function(_0x37c43f){var _0x3d3181=_0x4d842c[_0x729c('0x33')][_0x729c('0x24')]({'plain':!![]});if(!_0x3d3181)throw new Error(_0x729c('0x76'));if(_0x3d3181[_0x729c('0x77')]===_0x729c('0x33')){var _0x1ca820=_0x37c43f[_0x729c('0x24')]({'plain':!![]});return db[_0x729c('0x78')]['find']({'where':{'name':_0x729c('0x25'),'userProfileId':_0x3d3181[_0x729c('0x79')]},'raw':!![]})[_0x729c('0x11')](function(_0xd0d0dc){if(_0xd0d0dc&&_0xd0d0dc['autoAssociation']===0x0){return db[_0x729c('0x7a')][_0x729c('0x6f')]({'name':_0x1ca820[_0x729c('0x27')],'resourceId':_0x1ca820['id'],'type':_0xd0d0dc[_0x729c('0x27')],'sectionId':_0xd0d0dc['id']},{})[_0x729c('0x11')](function(){return _0x37c43f;});}else{return _0x37c43f;}})['catch'](function(_0x3f0713){logger[_0x729c('0x16')](_0x729c('0x7b'),_0x3f0713);throw _0x3f0713;});}return _0x37c43f;})[_0x729c('0x11')](respondWithResult(_0x75e860,0xc9))['catch'](handleError(_0x75e860,null));};exports[_0x729c('0x7c')]=function(_0x48427d,_0x36102b){return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0x48427d[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x36102b,null))[_0x729c('0x11')](function(_0x55e360){if(_0x55e360){return _0x55e360[_0x729c('0x7c')]();}return null;})[_0x729c('0x11')](respondWithResult(_0x36102b,null))[_0x729c('0x19')](handleError(_0x36102b,null));};exports[_0x729c('0x7d')]=function(_0x476db7,_0x4a503a){if(_0x476db7[_0x729c('0x62')]['id']){delete _0x476db7['body']['id'];}return db['MailAccount'][_0x729c('0x60')]({'where':{'id':_0x476db7[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x4a503a,null))[_0x729c('0x11')](function(_0x29a85a){if(_0x29a85a){_0x476db7[_0x729c('0x62')]['MailAccountId']=_0x29a85a['id'];return db['MailServerIn']['create'](_0x476db7[_0x729c('0x62')]);}})['then'](respondWithResult(_0x4a503a,null))[_0x729c('0x19')](handleError(_0x4a503a,null));};exports[_0x729c('0x7e')]=function(_0x23e019,_0x19762a){return db[_0x729c('0x45')]['findOne']({'where':{'id':_0x23e019[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x19762a,null))[_0x729c('0x11')](function(_0x453fea){if(_0x453fea){return _0x453fea[_0x729c('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x19762a,null))[_0x729c('0x19')](handleError(_0x19762a,null));};exports[_0x729c('0x80')]=function(_0xa84650,_0x5df462){return db['MailAccount'][_0x729c('0x69')]({'where':{'id':_0xa84650[_0x729c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5df462,null))['then'](function(_0x313f33){if(_0x313f33){return _0x313f33['getSmtp']();}return null;})[_0x729c('0x11')](respondWithResult(_0x5df462,null))[_0x729c('0x19')](handleError(_0x5df462,null));};exports[_0x729c('0x81')]=function(_0x43d50b,_0x465bc9){if(_0x43d50b[_0x729c('0x62')]['id']){delete _0x43d50b['body']['id'];}return db[_0x729c('0x45')]['find']({'where':{'id':_0x43d50b['params']['id']}})['then'](handleEntityNotFound(_0x465bc9,null))[_0x729c('0x11')](function(_0x2ace25){if(_0x2ace25){_0x43d50b[_0x729c('0x62')][_0x729c('0x67')]=_0x2ace25['id'];return db['MailServerOut'][_0x729c('0x6f')](_0x43d50b[_0x729c('0x62')]);}})[_0x729c('0x11')](respondWithResult(_0x465bc9,null))[_0x729c('0x19')](handleError(_0x465bc9,null));};exports[_0x729c('0x82')]=function(_0xe6cb0a,_0x340b27){return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0xe6cb0a[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x340b27,null))[_0x729c('0x11')](function(_0x34f1fa){if(_0x34f1fa){return _0x34f1fa[_0x729c('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x340b27,null))['catch'](handleError(_0x340b27,null));};exports[_0x729c('0x84')]=function(_0x27e38f,_0x58ed8b){return db[_0x729c('0x85')][_0x729c('0x60')]({'where':{'id':_0x27e38f[_0x729c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x58ed8b,null))['then'](function(_0x4c8d5b){if(_0x4c8d5b){return _0x4c8d5b[_0x729c('0x84')](_0x27e38f['body'][_0x729c('0x6c')],_[_0x729c('0x86')](_0x27e38f[_0x729c('0x62')],['ids','id'])||{});}})[_0x729c('0x11')](respondWithResult(_0x58ed8b,null))[_0x729c('0x19')](handleError(_0x58ed8b,null));};exports[_0x729c('0x87')]=function(_0xc8b45c,_0x119a20){var _0x706a30={'raw':![],'where':{}};var _0x9bf32b={};var _0x187fa7={'count':0x0,'rows':[]};return db[_0x729c('0x45')]['findOne']({'where':{'id':_0xc8b45c['params']['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x119a20,null))['then'](function(_0x53f101){if(_0x53f101){_0x9bf32b['model']=_[_0x729c('0x4b')](db[_0x729c('0x85')][_0x729c('0x46')]);_0x9bf32b[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0xc8b45c['query']);_0x9bf32b['filters']=_[_0x729c('0x5e')](_0x9bf32b[_0x729c('0x48')],_0x9bf32b[_0x729c('0x4a')]);_0x706a30[_0x729c('0x4e')]=_[_0x729c('0x5e')](_0x9bf32b[_0x729c('0x48')],qs['fields'](_0xc8b45c['query'][_0x729c('0x4d')]));_0x706a30[_0x729c('0x4e')]=_0x706a30[_0x729c('0x4e')][_0x729c('0x5f')]?_0x706a30[_0x729c('0x4e')]:_0x9bf32b[_0x729c('0x48')];if(!_0xc8b45c[_0x729c('0x4a')][_0x729c('0x4f')](_0x729c('0x50'))){_0x706a30[_0x729c('0x1f')]=qs['limit'](_0xc8b45c[_0x729c('0x4a')][_0x729c('0x1f')]);_0x706a30[_0x729c('0x21')]=qs[_0x729c('0x21')](_0xc8b45c[_0x729c('0x4a')][_0x729c('0x21')]);}_0x706a30['order']=qs[_0x729c('0x6a')](_0xc8b45c['query'][_0x729c('0x6a')]);_0x706a30['where']=qs[_0x729c('0x4c')](_[_0x729c('0x53')](_0xc8b45c['query'],_0x9bf32b[_0x729c('0x4c')]));_0x706a30[_0x729c('0x52')]['MailAccountId']=_0x53f101['id'];if(_0xc8b45c[_0x729c('0x4a')][_0x729c('0x57')]){_0x706a30[_0x729c('0x52')]=_[_0x729c('0x54')](_0x706a30[_0x729c('0x52')],{'$or':_[_0x729c('0x49')](_0x706a30[_0x729c('0x4e')],function(_0x435ab7){var _0x1262cb={};_0x1262cb[_0x435ab7]={'$like':'%'+_0xc8b45c[_0x729c('0x4a')][_0x729c('0x57')]+'%'};return _0x1262cb;})});}_0x706a30=_[_0x729c('0x54')]({},_0x706a30,_0xc8b45c[_0x729c('0x58')]);return db[_0x729c('0x85')][_0x729c('0x20')]({'where':_0x706a30[_0x729c('0x52')]})[_0x729c('0x11')](function(_0x1722b8){_0x187fa7[_0x729c('0x20')]=_0x1722b8;if(_0xc8b45c[_0x729c('0x4a')][_0x729c('0x59')]){_0x706a30[_0x729c('0x5a')]=[{'model':db[_0x729c('0x88')],'as':_0x729c('0x89'),'required':![]},{'model':db[_0x729c('0x8a')],'as':_0x729c('0x8b'),'attributes':['name',_0x729c('0x8c'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x729c('0x8d'),'attributes':['id',_0x729c('0x27'),_0x729c('0x8e')],'where':_0xc8b45c[_0x729c('0x4a')][_0x729c('0x8f')]?{'id':_0xc8b45c[_0x729c('0x4a')][_0x729c('0x8f')]}:undefined,'required':_0xc8b45c['query'][_0x729c('0x8f')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x706a30);})[_0x729c('0x11')](function(_0x22d842){_0x187fa7[_0x729c('0x5c')]=_0x22d842;return _0x187fa7;});}})['then'](respondWithFilteredResult(_0x119a20,_0x706a30))[_0x729c('0x19')](handleError(_0x119a20,null));};exports['addApplications']=function addApplications(_0xf8c884,_0x4bf2e5){var _0x50870d=_0xf8c884[_0x729c('0x5d')]['id'];var _0x1f3dfa=_0xf8c884['body'];var _0x150b23=0xc8;var _0x207217=null;return db[_0x729c('0x90')][_0x729c('0x91')]({'isolationLevel':db['sequelize'][_0x729c('0x92')][_0x729c('0x93')][_0x729c('0x94')]},function(_0x4b8794){return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0x50870d},'transaction':_0x4b8794})[_0x729c('0x11')](function(_0x1603d4){if(_0x1603d4){return db[_0x729c('0x95')]['destroy']({'where':{'MailAccountId':_0x50870d},'transaction':_0x4b8794})['then'](function(){var _0x36bb29=_['map'](_0x1f3dfa,function(_0x2f47fc){_0x2f47fc[_0x729c('0x67')]=_0x50870d;return _0x2f47fc;});return db[_0x729c('0x95')]['bulkCreate'](_0x36bb29,{'transaction':_0x4b8794});});}else{_0x150b23=0x194;_0x207217=[];}});})['then'](function(){if(_0x150b23!==0x194){return db[_0x729c('0x95')][_0x729c('0x96')]({'where':{'MailAccountId':_0x50870d},'order':_0x729c('0x97')})['then'](function(_0x24d598){_0x207217=_0x24d598;});}})['catch'](function(_0x35a682){_0x150b23=0x1f4;logger['error'](_0x35a682[_0x729c('0x26')]);if(_0x35a682['name']){delete _0x35a682['name'];}_0x207217=_0x35a682;})[_0x729c('0x98')](function(){if(_0x207217===null){_0x4bf2e5[_0x729c('0x1a')](_0x150b23);}else{if(_0x150b23===0x1f4){_0x4bf2e5['status'](_0x150b23)['send'](_0x207217);}else{_0x4bf2e5[_0x729c('0x1c')](_0x150b23)[_0x729c('0x1d')](_0x207217);}}});};exports['getApplications']=function(_0x33d67f,_0x3e985a){var _0x2c4215={};var _0x1308e0={};var _0x5e7c5e;var _0x1b485b;return db['MailAccount']['findOne']({'where':{'id':_0x33d67f[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x3e985a,null))[_0x729c('0x11')](function(_0xfbae12){if(_0xfbae12){_0x5e7c5e=_0xfbae12;_0x1308e0[_0x729c('0x48')]=_[_0x729c('0x4b')](db[_0x729c('0x95')][_0x729c('0x46')]);_0x1308e0[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0x33d67f[_0x729c('0x4a')]);_0x1308e0[_0x729c('0x4c')]=_[_0x729c('0x5e')](_0x1308e0['model'],_0x1308e0[_0x729c('0x4a')]);_0x2c4215[_0x729c('0x4e')]=_[_0x729c('0x5e')](_0x1308e0[_0x729c('0x48')],qs[_0x729c('0x4d')](_0x33d67f[_0x729c('0x4a')]['fields']));_0x2c4215[_0x729c('0x4e')]=_0x2c4215[_0x729c('0x4e')][_0x729c('0x5f')]?_0x2c4215[_0x729c('0x4e')]:_0x1308e0[_0x729c('0x48')];_0x2c4215[_0x729c('0x51')]=qs[_0x729c('0x6a')](_0x33d67f['query'][_0x729c('0x6a')]);_0x2c4215[_0x729c('0x52')]=qs[_0x729c('0x4c')](_[_0x729c('0x53')](_0x33d67f[_0x729c('0x4a')],_0x1308e0['filters']));if(_0x33d67f[_0x729c('0x4a')][_0x729c('0x57')]){_0x2c4215['where']=_[_0x729c('0x54')](_0x2c4215[_0x729c('0x52')],{'$or':_[_0x729c('0x49')](_0x2c4215[_0x729c('0x4e')],function(_0x3cdd8b){var _0x250b39={};_0x250b39[_0x3cdd8b]={'$like':'%'+_0x33d67f['query'][_0x729c('0x57')]+'%'};return _0x250b39;})});}_0x2c4215=_[_0x729c('0x54')]({},_0x2c4215,_0x33d67f[_0x729c('0x58')]);return _0x5e7c5e[_0x729c('0x99')](_0x2c4215);}})['then'](function(_0x3b0d36){if(_0x3b0d36){_0x1b485b=_0x3b0d36[_0x729c('0x5f')];if(!_0x33d67f[_0x729c('0x4a')]['hasOwnProperty'](_0x729c('0x50'))){_0x2c4215[_0x729c('0x1f')]=qs[_0x729c('0x1f')](_0x33d67f['query'][_0x729c('0x1f')]);_0x2c4215[_0x729c('0x21')]=qs[_0x729c('0x21')](_0x33d67f[_0x729c('0x4a')]['offset']);}return _0x5e7c5e[_0x729c('0x99')](_0x2c4215);}})[_0x729c('0x11')](function(_0x3c7304){if(_0x3c7304){return _0x3c7304?{'count':_0x1b485b,'rows':_0x3c7304}:null;}})[_0x729c('0x11')](respondWithResult(_0x3e985a,null))['catch'](handleError(_0x3e985a,null));};exports[_0x729c('0x9a')]=function(_0x2abeca,_0x4f009b){var _0x1b8cf8={'raw':!![],'where':{}};var _0x46ffd0={};var _0x44abc4={'count':0x0,'rows':[]};return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0x2abeca[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x4f009b,null))[_0x729c('0x11')](function(_0x1c9bed){if(_0x1c9bed){_0x46ffd0[_0x729c('0x48')]=_[_0x729c('0x4b')](db['MailMessage'][_0x729c('0x46')]);_0x46ffd0[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0x2abeca[_0x729c('0x4a')]);_0x46ffd0[_0x729c('0x4c')]=_[_0x729c('0x5e')](_0x46ffd0[_0x729c('0x48')],_0x46ffd0[_0x729c('0x4a')]);_0x1b8cf8['attributes']=_[_0x729c('0x5e')](_0x46ffd0[_0x729c('0x48')],qs['fields'](_0x2abeca[_0x729c('0x4a')][_0x729c('0x4d')]));_0x1b8cf8[_0x729c('0x4e')]=_0x1b8cf8[_0x729c('0x4e')][_0x729c('0x5f')]?_0x1b8cf8[_0x729c('0x4e')]:_0x46ffd0[_0x729c('0x48')];if(!_0x2abeca[_0x729c('0x4a')][_0x729c('0x4f')](_0x729c('0x50'))){_0x1b8cf8[_0x729c('0x1f')]=qs[_0x729c('0x1f')](_0x2abeca['query'][_0x729c('0x1f')]);_0x1b8cf8[_0x729c('0x21')]=qs[_0x729c('0x21')](_0x2abeca[_0x729c('0x4a')][_0x729c('0x21')]);}_0x1b8cf8[_0x729c('0x51')]=qs[_0x729c('0x6a')](_0x2abeca['query'][_0x729c('0x6a')]);_0x1b8cf8['where']=qs['filters'](_[_0x729c('0x53')](_0x2abeca[_0x729c('0x4a')],_0x46ffd0[_0x729c('0x4c')]));_0x1b8cf8['where'][_0x729c('0x67')]=_0x1c9bed['id'];if(_0x2abeca[_0x729c('0x4a')]['filter']){_0x1b8cf8[_0x729c('0x52')]=_[_0x729c('0x54')](_0x1b8cf8['where'],{'$or':_['map'](_0x1b8cf8[_0x729c('0x4e')],function(_0x5402f6){var _0x1abc31={};_0x1abc31[_0x5402f6]={'$like':'%'+_0x2abeca[_0x729c('0x4a')][_0x729c('0x57')]+'%'};return _0x1abc31;})});}if(_0x2abeca[_0x729c('0x4a')][_0x729c('0x9b')]){var _0x4c9f06=_0x2abeca[_0x729c('0x4a')][_0x729c('0x9b')][_0x729c('0x9c')](',');var _0x28563c={};_0x28563c[_0x4c9f06[0x0]]={'$gte':moment(_0x4c9f06[0x1])['format'](_0x729c('0x9d'))};_0x1b8cf8[_0x729c('0x52')]=_['merge'](_0x1b8cf8[_0x729c('0x52')],_0x28563c);}_0x1b8cf8=_[_0x729c('0x54')]({},_0x1b8cf8,_0x2abeca['options']);return db['MailMessage'][_0x729c('0x20')]({'where':_0x1b8cf8[_0x729c('0x52')]})[_0x729c('0x11')](function(_0x1f2a44){_0x44abc4[_0x729c('0x20')]=_0x1f2a44;if(_0x2abeca[_0x729c('0x4a')][_0x729c('0x59')]){_0x1b8cf8[_0x729c('0x5a')]=[{'all':!![]}];}return db[_0x729c('0x9e')][_0x729c('0x5b')](_0x1b8cf8);})['then'](function(_0x363d09){if(_0x2abeca['query'][_0x729c('0x9f')]===_0x729c('0xa0')){for(var _0x59d88e=0x0;_0x59d88e<_0x363d09[_0x729c('0x5f')];_0x59d88e++){_0x363d09[_0x59d88e]['body']=juice(_0x363d09[_0x59d88e]['body']);}}_0x44abc4[_0x729c('0x5c')]=_0x363d09;return _0x44abc4;});}})['then'](respondWithFilteredResult(_0x4f009b,_0x1b8cf8))[_0x729c('0x19')](handleError(_0x4f009b,null));};exports['send']=function(_0xfe618f,_0x563615){var _0x2ae1d6,_0x51b62d={},_0x40100b;if(_0xfe618f['body']['to']){_0x40100b=_0xfe618f[_0x729c('0x62')]['to'][_0x729c('0x9c')](',')[0x0];}return db[_0x729c('0x45')]['find']({'where':{'id':_0xfe618f[_0x729c('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x729c('0xa1'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x40100b},'limit':0x1,'order':[['updatedAt',_0x729c('0xa2')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x729c('0xa3')],'as':_0x729c('0xa3'),'raw':!![]}]}]})[_0x729c('0x11')](handleEntityNotFound(_0x563615,null))['then'](function(_0x10dbb3){if(!_0x10dbb3)return;_0x2ae1d6=_0x10dbb3;if(!_0x10dbb3[_0x729c('0x3f')])throw new Error(_0x729c('0xa4'));if(_[_0x729c('0x73')](_0xfe618f[_0x729c('0x62')][_0x729c('0xa5')])){_0xfe618f[_0x729c('0x62')][_0x729c('0xa5')]=util['format']('%s\x20<%s>',_0x10dbb3[_0x729c('0x27')],_0x10dbb3[_0x729c('0x72')]||_0x10dbb3[_0x729c('0x3f')]['user']);}if(_0xfe618f[_0x729c('0x62')][_0x729c('0xa6')]&&_0xfe618f[_0x729c('0x62')][_0x729c('0xa6')]['length']){for(var _0x591aea=0x0;_0x591aea<_0xfe618f['body']['attachments'][_0x729c('0x5f')];_0x591aea+=0x1){_0xfe618f['body'][_0x729c('0xa6')][_0x591aea]={'filename':_0xfe618f[_0x729c('0x62')][_0x729c('0xa6')][_0x591aea][_0x729c('0x27')],'path':path[_0x729c('0xa7')](config[_0x729c('0xa8')],'server/files/attachments',_0xfe618f[_0x729c('0x62')][_0x729c('0xa6')][_0x591aea][_0x729c('0xa9')])};}}var _0x4b98b3=_0x10dbb3['getSmtpOptions']();return respondWithRpcPromise(_0x729c('0xaa'),_0x729c('0xab'),{'account':_0x4b98b3,'message':_0xfe618f[_0x729c('0x62')]});})[_0x729c('0x11')](function(_0x3a7eae){if(!_0x3a7eae)return;_0x51b62d=_0x3a7eae;if(!_0x2ae1d6[_0x729c('0xa1')])throw new Error(_0x729c('0xac'));if(_0x2ae1d6['List'][_0x729c('0xad')][_0x729c('0x5f')])return _0x2ae1d6[_0x729c('0xa1')]['Contacts'][0x0];return db[_0x729c('0x88')][_0x729c('0x6f')](_['defaults'](_0xfe618f[_0x729c('0x62')],{'firstName':_0xfe618f[_0x729c('0x62')]['to'],'email':_0xfe618f[_0x729c('0x62')]['to'],'phone':_0xfe618f[_0x729c('0x62')]['to'],'ListId':_0x2ae1d6[_0x729c('0xae')]}));})[_0x729c('0x11')](function(_0xc44a4b){if(!_0xc44a4b)return;var _0x27df72={'UserId':_0xfe618f[_0x729c('0x33')]['id'],'ContactId':_0xc44a4b['id'],'MailAccountId':_0x2ae1d6['id'],'inReplyTo':_0x51b62d['messageId'],'to':_0xfe618f[_0x729c('0x62')][_0x729c('0xa5')],'cc':_0xfe618f[_0x729c('0x62')]['cc'],'subject':_0xfe618f[_0x729c('0x62')][_0x729c('0xaf')],'attach':_0xfe618f[_0x729c('0x62')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x729c('0xb0')](_0x729c('0x9d')),'lastMsgDirection':_0x729c('0xb1'),'Messages':[_[_0x729c('0x54')](_0xfe618f['body'],{'messageId':_0x51b62d[_0x729c('0xb2')],'sentAt':moment()[_0x729c('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2ae1d6['id'],'UserId':_0xfe618f[_0x729c('0x33')]['id'],'ContactId':_0xc44a4b['id']})]};if(_0xfe618f['body'][_0x729c('0xb3')]){_0x27df72=_[_0x729c('0x54')](_0x27df72,_0xfe618f[_0x729c('0x62')]['Interaction']);}return db[_0x729c('0x85')]['create'](_0x27df72,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x729c('0x11')](respondWithResult(_0x563615,null))[_0x729c('0x19')](handleError(_0x563615,null));};exports[_0x729c('0xb4')]=function(_0x404c93,_0x2a48c6){return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0x404c93[_0x729c('0x5d')]['id']},'include':[{'model':db[_0x729c('0x42')],'as':_0x729c('0x3f'),'raw':!![],'include':[{'model':db[_0x729c('0xa3')],'as':_0x729c('0xa3'),'raw':!![]}]}]})[_0x729c('0x11')](handleEntityNotFound(_0x2a48c6,null))[_0x729c('0x11')](function(_0x582e91){if(!_0x582e91[_0x729c('0x3f')])return;var _0x51b2fa=_0x582e91['getSmtpOptions']();return respondWithRpcPromise(_0x729c('0xb5'),'verifySmtp',{'account':_0x51b2fa});})[_0x729c('0x11')](respondWithResult(_0x2a48c6,null))['catch'](handleError(_0x2a48c6,null));};exports[_0x729c('0x23')]=function(_0x47b3c9,_0x2e9361){return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0x47b3c9['params']['id']}})['then'](handleEntityNotFound(_0x2e9361,null))[_0x729c('0x11')](function(_0x11901f){if(_0x11901f&&_0x11901f[_0x729c('0x3c')]){throw new db['Sequelize'][(_0x729c('0xb6'))](_0x729c('0xb7'));}return _0x11901f;})[_0x729c('0x11')](removeEntity(_0x2e9361,null))[_0x729c('0x19')](handleError(_0x2e9361,null));};exports[_0x729c('0xb8')]=function(_0x3fab16,_0x4b348c){return db[_0x729c('0x45')]['find']({'where':{'id':_0x3fab16[_0x729c('0x5d')]['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x4b348c,null))['then'](function(_0x295f1c){if(_0x295f1c){return _0x295f1c[_0x729c('0xb8')](_0x3fab16[_0x729c('0x62')][_0x729c('0x6c')],_[_0x729c('0x86')](_0x3fab16[_0x729c('0x62')],[_0x729c('0x6c'),'id'])||{})[_0x729c('0xb9')](function(_0x10e749){for(var _0x11b802=0x0;_0x11b802<_0x3fab16[_0x729c('0x62')][_0x729c('0x6c')][_0x729c('0x5f')];_0x11b802+=0x1){socket[_0x729c('0xba')]('userMailAccount:save',{'UserId':Number(_0x3fab16['body']['ids'][_0x11b802]),'MailAccountId':Number(_0x3fab16['params']['id'])});}return _0x10e749;});}})[_0x729c('0x11')](respondWithResult(_0x4b348c,null))['catch'](handleError(_0x4b348c,null));};exports[_0x729c('0xbb')]=function(_0x1e739f,_0x39d292){return db[_0x729c('0x45')][_0x729c('0x60')]({'where':{'id':_0x1e739f['params']['id']}})[_0x729c('0x11')](handleEntityNotFound(_0x39d292,null))['then'](function(_0x379840){if(_0x379840){return _0x379840[_0x729c('0xbb')](_0x1e739f[_0x729c('0x4a')][_0x729c('0x6c')])[_0x729c('0x11')](function(){if(_[_0x729c('0xbc')](_0x1e739f[_0x729c('0x4a')][_0x729c('0x6c')])){for(var _0x486664=0x0;_0x486664<_0x1e739f['query']['ids'][_0x729c('0x5f')];_0x486664+=0x1){socket[_0x729c('0xba')](_0x729c('0xbd'),{'UserId':Number(_0x1e739f['query'][_0x729c('0x6c')][_0x486664]),'MailAccountId':Number(_0x1e739f[_0x729c('0x5d')]['id'])});}}else{socket[_0x729c('0xba')](_0x729c('0xbd'),{'UserId':Number(_0x1e739f['query']['ids']),'MailAccountId':Number(_0x1e739f[_0x729c('0x5d')]['id'])});}});}})[_0x729c('0x11')](respondWithStatusCode(_0x39d292,null))[_0x729c('0x19')](handleError(_0x39d292,null));};exports[_0x729c('0xbe')]=function(_0x55fa02,_0x35e559){var _0x11af2d={};var _0x523014={};var _0x28d66d;var _0x250a04;return db[_0x729c('0x45')][_0x729c('0x69')]({'where':{'id':_0x55fa02[_0x729c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x35e559,null))['then'](function(_0x50b984){if(_0x50b984){_0x28d66d=_0x50b984;_0x523014[_0x729c('0x48')]=_[_0x729c('0x4b')](db[_0x729c('0x8a')][_0x729c('0x46')]);_0x523014[_0x729c('0x4a')]=_[_0x729c('0x4b')](_0x55fa02['query']);_0x523014['filters']=_[_0x729c('0x5e')](_0x523014[_0x729c('0x48')],_0x523014[_0x729c('0x4a')]);_0x11af2d[_0x729c('0x4e')]=_['intersection'](_0x523014[_0x729c('0x48')],qs[_0x729c('0x4d')](_0x55fa02['query'][_0x729c('0x4d')]));_0x11af2d[_0x729c('0x4e')]=_0x11af2d['attributes']['length']?_0x11af2d['attributes']:_0x523014['model'];_0x11af2d[_0x729c('0x51')]=qs[_0x729c('0x6a')](_0x55fa02[_0x729c('0x4a')]['sort']);_0x11af2d[_0x729c('0x52')]=qs[_0x729c('0x4c')](_['pick'](_0x55fa02[_0x729c('0x4a')],_0x523014[_0x729c('0x4c')]));if(_0x55fa02[_0x729c('0x4a')]['filter']){_0x11af2d[_0x729c('0x52')]=_[_0x729c('0x54')](_0x11af2d[_0x729c('0x52')],{'$or':_[_0x729c('0x49')](_0x11af2d[_0x729c('0x4e')],function(_0x36732c){var _0x358f34={};_0x358f34[_0x36732c]={'$like':'%'+_0x55fa02['query'][_0x729c('0x57')]+'%'};return _0x358f34;})});}_0x11af2d=_[_0x729c('0x54')]({},_0x11af2d,_0x55fa02[_0x729c('0x58')]);return _0x28d66d[_0x729c('0xbe')](_0x11af2d);}})[_0x729c('0x11')](function(_0x2a5c6f){if(_0x2a5c6f){_0x250a04=_0x2a5c6f[_0x729c('0x5f')];if(!_0x55fa02[_0x729c('0x4a')][_0x729c('0x4f')](_0x729c('0x50'))){_0x11af2d[_0x729c('0x1f')]=qs[_0x729c('0x1f')](_0x55fa02[_0x729c('0x4a')][_0x729c('0x1f')]);_0x11af2d[_0x729c('0x21')]=qs[_0x729c('0x21')](_0x55fa02[_0x729c('0x4a')]['offset']);}return _0x28d66d[_0x729c('0xbe')](_0x11af2d);}})[_0x729c('0x11')](function(_0x127135){if(_0x127135){return _0x127135?{'count':_0x250a04,'rows':_0x127135}:null;}})['then'](respondWithResult(_0x35e559,null))[_0x729c('0x19')](handleError(_0x35e559,null));}; \ No newline at end of file +var _0xe049=['ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','tag','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','from','email','attachments','join','server/files/attachments','SendMail','sendMail','messageId','subject','attach','out','Messages','CloudProvider','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','omit','spread','removeAgents','isArray','userMailAccount:remove','emit','getAgents','moment','bluebird','util','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','MailServerOut','Pause','length','includeAll','options','find','body','provider','custom','describe','addDisposition','MailAccountId','create','Disposition','removeDispositions'];(function(_0x5e3bd8,_0x32a19b){var _0x2d2a4f=function(_0x550d15){while(--_0x550d15){_0x5e3bd8['push'](_0x5e3bd8['shift']());}};_0x2d2a4f(++_0x32a19b);}(_0xe049,0x1ba));var _0x9e04=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xe049[_0x25e7cb];return _0x375d92;};'use strict';var moment=require(_0x9e04('0x0'));var BPromise=require(_0x9e04('0x1'));var util=require(_0x9e04('0x2'));var path=require('path');var _=require(_0x9e04('0x3'));var juice=require(_0x9e04('0x4'));var Redis=require(_0x9e04('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9e04('0x6'));var config=require(_0x9e04('0x7'));var db=require(_0x9e04('0x8'))['db'];config[_0x9e04('0x9')]=_[_0x9e04('0xa')](config[_0x9e04('0x9')],{'host':_0x9e04('0xb'),'port':0x18eb});var socket=require(_0x9e04('0xc'))(new Redis(config[_0x9e04('0x9')]));require(_0x9e04('0xd'))['register'](socket);var jayson=require(_0x9e04('0xe'));var client=jayson[_0x9e04('0xf')][_0x9e04('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3f6a80,_0x3a9ba8,_0x27a12c,_0x4e3fd8){return new BPromise(function(_0x157473,_0x51c9ed){var _0x28edf1=_0x4e3fd8||client;return _0x28edf1[_0x9e04('0x11')](_0x3f6a80,_0x27a12c)['then'](function(_0x26da76){logger[_0x9e04('0x12')](_0x9e04('0x13'),_0x3a9ba8,_0x9e04('0x14'));logger[_0x9e04('0x15')](_0x9e04('0x16'),_0x3a9ba8,'request\x20sent',JSON[_0x9e04('0x17')](_0x26da76));if(_0x26da76[_0x9e04('0x18')]){if(_0x26da76[_0x9e04('0x18')][_0x9e04('0x19')]===0x1f4){logger[_0x9e04('0x18')](_0x9e04('0x13'),_0x3a9ba8,_0x26da76[_0x9e04('0x18')]['message']);return _0x51c9ed(_0x26da76[_0x9e04('0x18')][_0x9e04('0x1a')]);}logger[_0x9e04('0x18')](_0x9e04('0x13'),_0x3a9ba8,_0x26da76[_0x9e04('0x18')]['message']);return _0x157473(_0x26da76[_0x9e04('0x18')][_0x9e04('0x1a')]);}else{logger[_0x9e04('0x12')](_0x9e04('0x13'),_0x3a9ba8,_0x9e04('0x14'));_0x157473(_0x26da76[_0x9e04('0x1b')]['message']);}})['catch'](function(_0x437d63){logger[_0x9e04('0x18')](_0x9e04('0x13'),_0x3a9ba8,_0x437d63);_0x51c9ed(_0x437d63);});});}function respondWithStatusCode(_0x432e16,_0xfcb92){_0xfcb92=_0xfcb92||0xcc;return function(_0x42095d){if(_0x42095d){return _0x432e16[_0x9e04('0x1c')](_0xfcb92);}return _0x432e16[_0x9e04('0x1d')](_0xfcb92)[_0x9e04('0x1e')]();};}function respondWithResult(_0x1c1680,_0x329458){_0x329458=_0x329458||0xc8;return function(_0x5843e7){if(_0x5843e7){return _0x1c1680[_0x9e04('0x1d')](_0x329458)[_0x9e04('0x1f')](_0x5843e7);}};}function respondWithFilteredResult(_0x3f5187,_0x17b1fe){return function(_0x4feda2){if(_0x4feda2){var _0x2ad2e3=typeof _0x17b1fe[_0x9e04('0x20')]===_0x9e04('0x21')&&typeof _0x17b1fe[_0x9e04('0x22')]===_0x9e04('0x21');var _0x591dd2=_0x4feda2[_0x9e04('0x23')];var _0x5a1ca6=_0x2ad2e3?0x0:_0x17b1fe[_0x9e04('0x20')];var _0x38ad8d=_0x2ad2e3?_0x4feda2['count']:_0x17b1fe[_0x9e04('0x20')]+_0x17b1fe['limit'];var _0x376996;if(_0x38ad8d>=_0x591dd2){_0x38ad8d=_0x591dd2;_0x376996=0xc8;}else{_0x376996=0xce;}_0x3f5187[_0x9e04('0x1d')](_0x376996);return _0x3f5187[_0x9e04('0x24')](_0x9e04('0x25'),_0x5a1ca6+'-'+_0x38ad8d+'/'+_0x591dd2)['json'](_0x4feda2);}return null;};}function saveUpdates(_0x210e7c){return function(_0x3abfac){if(_0x3abfac){return _0x3abfac[_0x9e04('0x26')](_0x210e7c)[_0x9e04('0x27')](function(_0x3dd0d9){return _0x3dd0d9;});}return null;};}function removeEntity(_0x225755){return function(_0x50c8ad){if(_0x50c8ad){return _0x50c8ad[_0x9e04('0x28')]()['then'](function(){var _0x8a00ae=_0x50c8ad[_0x9e04('0x29')]({'plain':!![]});var _0x29c5f5='MailAccounts';return db[_0x9e04('0x2a')]['destroy']({'where':{'type':_0x29c5f5,'resourceId':_0x8a00ae['id']}})[_0x9e04('0x27')](function(){return _0x50c8ad;});})[_0x9e04('0x27')](function(){_0x225755[_0x9e04('0x1d')](0xcc)[_0x9e04('0x1e')]();});}};}function handleEntityNotFound(_0x1ac294){return function(_0x2f525d){if(!_0x2f525d){_0x1ac294[_0x9e04('0x1c')](0x194);}return _0x2f525d;};}function handleError(_0x473d27,_0x38e2ee){_0x38e2ee=_0x38e2ee||0x1f4;return function(_0x50d2ad){logger[_0x9e04('0x18')](_0x50d2ad[_0x9e04('0x2b')]);if(_0x50d2ad[_0x9e04('0x2c')]){delete _0x50d2ad['name'];}_0x473d27[_0x9e04('0x1d')](_0x38e2ee)[_0x9e04('0x2d')](_0x50d2ad);};}function getImapHost(_0x3dd0e2){switch(_0x3dd0e2){case _0x9e04('0x2e'):return'imap.gmail.com';case _0x9e04('0x2f'):return _0x9e04('0x30');case _0x9e04('0x31'):return _0x9e04('0x32');case'outlook365':return _0x9e04('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3dd0e2);}function getSmtpHost(_0x340be5){switch(_0x340be5){case _0x9e04('0x2e'):return _0x9e04('0x34');case _0x9e04('0x2f'):return _0x9e04('0x35');case'hotmail':return _0x9e04('0x36');case'outlook365':return _0x9e04('0x37');}throw new Error(_0x9e04('0x38'),_0x340be5);}function getAuthenticationOptions(_0x210b49,_0x527fb9){var _0x418e9a={};var _0x268d6c={};if(_0x210b49){_0x418e9a[_0x9e04('0x39')]=_0x268d6c[_0x9e04('0x39')]=_0x527fb9[_0x9e04('0x3a')];_0x418e9a[_0x9e04('0x3b')]=_0x268d6c[_0x9e04('0x3c')]=_0x527fb9[_0x9e04('0x3b')];if(_0x527fb9['modernAuthentication']){_0x418e9a[_0x9e04('0x3d')]=_0x268d6c['modernAuthentication']=!![];_0x418e9a[_0x9e04('0x3e')]=_0x268d6c[_0x9e04('0x3e')]=_0x527fb9[_0x9e04('0x3e')];_0x418e9a[_0x9e04('0x3b')]=_0x268d6c[_0x9e04('0x3c')]=null;}else{_0x418e9a['CloudProviderId']=_0x268d6c['CloudProviderId']=null;}_0x418e9a[_0x9e04('0x3f')]=getImapHost(_0x210b49);_0x418e9a[_0x9e04('0x40')]=0x3e1;_0x268d6c[_0x9e04('0x3f')]=getSmtpHost(_0x210b49);_0x268d6c[_0x9e04('0x40')]=0x24b;_0x268d6c[_0x9e04('0x41')]=![];_0x418e9a[_0x9e04('0x42')]=_0x268d6c[_0x9e04('0x42')]=null;}else{if(_0x527fb9['authentication']){_0x418e9a[_0x9e04('0x39')]=_0x268d6c[_0x9e04('0x39')]=_0x527fb9[_0x9e04('0x3a')];_0x418e9a['password']=_0x268d6c[_0x9e04('0x3c')]=_0x527fb9[_0x9e04('0x3b')];}else{_0x418e9a[_0x9e04('0x43')]=_0x268d6c['authentication']=![];_0x418e9a[_0x9e04('0x39')]=_0x268d6c[_0x9e04('0x39')]=null;_0x418e9a[_0x9e04('0x3b')]=_0x268d6c[_0x9e04('0x3c')]=null;}_0x418e9a[_0x9e04('0x3f')]=_0x527fb9[_0x9e04('0x44')][_0x9e04('0x3f')];_0x418e9a[_0x9e04('0x40')]=_0x527fb9[_0x9e04('0x44')][_0x9e04('0x40')];_0x268d6c[_0x9e04('0x3f')]=_0x527fb9[_0x9e04('0x45')][_0x9e04('0x3f')];_0x268d6c[_0x9e04('0x40')]=_0x527fb9[_0x9e04('0x45')][_0x9e04('0x40')];}return{'Imap':_0x418e9a,'Smtp':_0x268d6c};}exports[_0x9e04('0x46')]=function(_0x4e928e,_0x50e40a){var _0x48d8fc={'include':[{'model':db[_0x9e04('0x47')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x9e04('0x45')},{'model':db['Pause'],'as':_0x9e04('0x48')}]},_0x5defb3={},_0x1a2d49={'count':0x0,'rows':[]};var _0x52b686=_[_0x9e04('0x49')](db[_0x9e04('0x4a')][_0x9e04('0x4b')],function(_0x24f34f){return{'name':_0x24f34f[_0x9e04('0x4c')],'type':_0x24f34f[_0x9e04('0x4d')][_0x9e04('0x4e')]};});_0x5defb3[_0x9e04('0x4f')]=_[_0x9e04('0x49')](_0x52b686,_0x9e04('0x2c'));_0x5defb3[_0x9e04('0x50')]=_[_0x9e04('0x51')](_0x4e928e[_0x9e04('0x50')]);_0x5defb3[_0x9e04('0x52')]=_[_0x9e04('0x53')](_0x5defb3[_0x9e04('0x4f')],_0x5defb3[_0x9e04('0x50')]);_0x48d8fc[_0x9e04('0x54')]=_[_0x9e04('0x53')](_0x5defb3[_0x9e04('0x4f')],qs[_0x9e04('0x55')](_0x4e928e[_0x9e04('0x50')][_0x9e04('0x55')]));_0x48d8fc[_0x9e04('0x54')]=_0x48d8fc[_0x9e04('0x54')]['length']?_0x48d8fc['attributes']:_0x5defb3['model'];if(!_0x4e928e['query'][_0x9e04('0x56')](_0x9e04('0x57'))){_0x48d8fc[_0x9e04('0x22')]=qs['limit'](_0x4e928e[_0x9e04('0x50')]['limit']);_0x48d8fc[_0x9e04('0x20')]=qs[_0x9e04('0x20')](_0x4e928e[_0x9e04('0x50')][_0x9e04('0x20')]);}_0x48d8fc[_0x9e04('0x58')]=qs[_0x9e04('0x59')](_0x4e928e['query'][_0x9e04('0x59')]);_0x48d8fc[_0x9e04('0x5a')]=qs['filters'](_[_0x9e04('0x5b')](_0x4e928e[_0x9e04('0x50')],_0x5defb3['filters']),_0x52b686);if(_0x4e928e[_0x9e04('0x50')][_0x9e04('0x5c')]){_0x48d8fc[_0x9e04('0x5a')]=_['merge'](_0x48d8fc[_0x9e04('0x5a')],{'$or':_['map'](_0x52b686,function(_0x4cb0f3){if(_0x4cb0f3[_0x9e04('0x4d')]!==_0x9e04('0x5d')){var _0x9f224b={};_0x9f224b[_0x4cb0f3[_0x9e04('0x2c')]]={'$like':'%'+_0x4e928e[_0x9e04('0x50')][_0x9e04('0x5c')]+'%'};return _0x9f224b;}})});}_0x48d8fc=_[_0x9e04('0x5e')]({},_0x48d8fc,_0x4e928e['options']);var _0x4a55d0={'where':_0x48d8fc['where']};return db[_0x9e04('0x4a')][_0x9e04('0x23')](_0x4a55d0)[_0x9e04('0x27')](function(_0x1f5fef){_0x1a2d49[_0x9e04('0x23')]=_0x1f5fef;if(_0x4e928e['query']['includeAll']){_0x48d8fc[_0x9e04('0x5f')]=[{'all':!![]}];}return db[_0x9e04('0x4a')][_0x9e04('0x60')](_0x48d8fc);})['then'](function(_0x4400af){_0x1a2d49[_0x9e04('0x61')]=_0x4400af;return _0x1a2d49;})[_0x9e04('0x27')](respondWithFilteredResult(_0x50e40a,_0x48d8fc))[_0x9e04('0x62')](handleError(_0x50e40a,null));};exports[_0x9e04('0x63')]=function(_0x1b99ec,_0x16a2c3){var _0x2bf5a8={'raw':![],'where':{'id':_0x1b99ec[_0x9e04('0x64')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9e04('0x44')},{'model':db[_0x9e04('0x65')],'as':'Smtp'},{'model':db[_0x9e04('0x66')],'as':_0x9e04('0x48')}]},_0x1a6b46={};_0x1a6b46[_0x9e04('0x4f')]=_['keys'](db[_0x9e04('0x4a')][_0x9e04('0x4b')]);_0x1a6b46['query']=_[_0x9e04('0x51')](_0x1b99ec[_0x9e04('0x50')]);_0x1a6b46[_0x9e04('0x52')]=_[_0x9e04('0x53')](_0x1a6b46[_0x9e04('0x4f')],_0x1a6b46[_0x9e04('0x50')]);_0x2bf5a8[_0x9e04('0x54')]=_[_0x9e04('0x53')](_0x1a6b46['model'],qs[_0x9e04('0x55')](_0x1b99ec[_0x9e04('0x50')][_0x9e04('0x55')]));_0x2bf5a8[_0x9e04('0x54')]=_0x2bf5a8[_0x9e04('0x54')][_0x9e04('0x67')]?_0x2bf5a8['attributes']:_0x1a6b46[_0x9e04('0x4f')];if(_0x1b99ec[_0x9e04('0x50')][_0x9e04('0x68')]){_0x2bf5a8[_0x9e04('0x5f')]=[{'all':!![]}];}_0x2bf5a8=_['merge']({},_0x2bf5a8,_0x1b99ec[_0x9e04('0x69')]);return db[_0x9e04('0x4a')][_0x9e04('0x6a')](_0x2bf5a8)[_0x9e04('0x27')](handleEntityNotFound(_0x16a2c3,null))[_0x9e04('0x27')](respondWithResult(_0x16a2c3,null))[_0x9e04('0x62')](handleError(_0x16a2c3,null));};exports[_0x9e04('0x26')]=function(_0x199a4e,_0xfc1a9d){if(_0x199a4e[_0x9e04('0x6b')]['id']){delete _0x199a4e['body']['id'];}var _0x52c7f8=_0x199a4e['body'][_0x9e04('0x6c')]===_0x9e04('0x6d')?null:_0x199a4e[_0x9e04('0x6b')]['provider'];var _0x437a4d=_0x199a4e[_0x9e04('0x6b')][_0x9e04('0x44')]||{};var _0x108ee6=_0x199a4e[_0x9e04('0x6b')][_0x9e04('0x45')]||{};if(_0x52c7f8){_0x437a4d['host']=getImapHost(_0x52c7f8);_0x437a4d[_0x9e04('0x40')]=0x3e1;_0x108ee6[_0x9e04('0x3f')]=getSmtpHost(_0x52c7f8);_0x108ee6[_0x9e04('0x40')]=0x24b;_0x108ee6[_0x9e04('0x41')]=![];}if(_0x108ee6[_0x9e04('0x3d')]){_0x108ee6[_0x9e04('0x41')]=![];}else{_0x108ee6[_0x9e04('0x3e')]=null;}if(!_0x437a4d[_0x9e04('0x3d')])_0x437a4d[_0x9e04('0x3e')]=null;_0x199a4e[_0x9e04('0x6b')][_0x9e04('0x44')]=_0x437a4d;_0x199a4e['body'][_0x9e04('0x45')]=_0x108ee6;return db[_0x9e04('0x4a')][_0x9e04('0x6a')]({'where':{'id':_0x199a4e[_0x9e04('0x64')]['id']},'include':[{'model':db[_0x9e04('0x47')],'as':'Imap'},{'model':db[_0x9e04('0x65')],'as':'Smtp'},{'model':db['Pause'],'as':_0x9e04('0x48')}]})[_0x9e04('0x27')](handleEntityNotFound(_0xfc1a9d,null))['then'](function(_0x1198d6){if(!_0x1198d6)throw new Error('Mail\x20Account\x20not\x20found');if(_0x1198d6[_0x9e04('0x42')])delete _0x199a4e[_0x9e04('0x6b')]['Imap'];return _0x1198d6;})[_0x9e04('0x27')](saveUpdates(_0x199a4e[_0x9e04('0x6b')],null))[_0x9e04('0x27')](function(_0x394852){if(!_0x199a4e[_0x9e04('0x6b')][_0x9e04('0x44')])return _0x394852;return db['MailServerIn'][_0x9e04('0x26')](_0x199a4e['body']['Imap'],{'where':{'MailAccountId':_0x394852['id']}})[_0x9e04('0x27')](function(){return _0x394852;});})['then'](function(_0x5d288a){if(!_0x199a4e[_0x9e04('0x6b')]['Smtp'])return _0x5d288a;return db[_0x9e04('0x65')][_0x9e04('0x26')](_0x199a4e[_0x9e04('0x6b')][_0x9e04('0x45')],{'where':{'MailAccountId':_0x5d288a['id']}})[_0x9e04('0x27')](function(){return _0x5d288a;});})[_0x9e04('0x27')](respondWithResult(_0xfc1a9d,null))[_0x9e04('0x62')](handleError(_0xfc1a9d,null));};exports[_0x9e04('0x6e')]=function(_0x21ead9,_0x320fef){return db[_0x9e04('0x4a')][_0x9e04('0x6e')]()[_0x9e04('0x27')](respondWithResult(_0x320fef,null))[_0x9e04('0x62')](handleError(_0x320fef,null));};exports[_0x9e04('0x6f')]=function(_0x414462,_0x3e92e3){if(_0x414462[_0x9e04('0x6b')]['id']){delete _0x414462[_0x9e04('0x6b')]['id'];}return db[_0x9e04('0x4a')][_0x9e04('0x6a')]({'where':{'id':_0x414462[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x3e92e3,null))[_0x9e04('0x27')](function(_0x5856f9){if(_0x5856f9){_0x414462[_0x9e04('0x6b')][_0x9e04('0x70')]=_0x5856f9['id'];return db['Disposition'][_0x9e04('0x71')](_0x414462[_0x9e04('0x6b')]);}})[_0x9e04('0x27')](respondWithResult(_0x3e92e3,null))[_0x9e04('0x62')](handleError(_0x3e92e3,null));};exports['getDispositions']=function(_0x1410e1,_0x4168a0){var _0x5522c0={'raw':![],'where':{}};var _0x1ffbf7={};var _0x4c687e={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1410e1[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x4168a0,null))['then'](function(_0x47f563){if(_0x47f563){_0x1ffbf7['model']=_[_0x9e04('0x51')](db[_0x9e04('0x72')]['rawAttributes']);_0x1ffbf7['query']=_[_0x9e04('0x51')](_0x1410e1[_0x9e04('0x50')]);_0x1ffbf7['filters']=_['intersection'](_0x1ffbf7[_0x9e04('0x4f')],_0x1ffbf7[_0x9e04('0x50')]);_0x5522c0[_0x9e04('0x54')]=_[_0x9e04('0x53')](_0x1ffbf7[_0x9e04('0x4f')],qs[_0x9e04('0x55')](_0x1410e1[_0x9e04('0x50')]['fields']));_0x5522c0[_0x9e04('0x54')]=_0x5522c0[_0x9e04('0x54')][_0x9e04('0x67')]?_0x5522c0[_0x9e04('0x54')]:_0x1ffbf7[_0x9e04('0x4f')];if(!_0x1410e1['query'][_0x9e04('0x56')](_0x9e04('0x57'))){_0x5522c0[_0x9e04('0x22')]=qs['limit'](_0x1410e1['query'][_0x9e04('0x22')]);_0x5522c0['offset']=qs[_0x9e04('0x20')](_0x1410e1[_0x9e04('0x50')][_0x9e04('0x20')]);}_0x5522c0[_0x9e04('0x58')]=qs[_0x9e04('0x59')](_0x1410e1[_0x9e04('0x50')][_0x9e04('0x59')]);_0x5522c0['where']=qs[_0x9e04('0x52')](_[_0x9e04('0x5b')](_0x1410e1[_0x9e04('0x50')],_0x1ffbf7[_0x9e04('0x52')]));_0x5522c0['where']['MailAccountId']=_0x47f563['id'];if(_0x1410e1['query']['filter']){_0x5522c0[_0x9e04('0x5a')]=_[_0x9e04('0x5e')](_0x5522c0['where'],{'$or':_[_0x9e04('0x49')](_0x5522c0['attributes'],function(_0x6bea64){var _0x4555bf={};_0x4555bf[_0x6bea64]={'$like':'%'+_0x1410e1[_0x9e04('0x50')][_0x9e04('0x5c')]+'%'};return _0x4555bf;})});}_0x5522c0=_['merge']({},_0x5522c0,_0x1410e1[_0x9e04('0x69')]);return db['Disposition']['count']({'where':_0x5522c0[_0x9e04('0x5a')]})[_0x9e04('0x27')](function(_0x937853){_0x4c687e['count']=_0x937853;if(_0x1410e1[_0x9e04('0x50')][_0x9e04('0x68')]){_0x5522c0[_0x9e04('0x5f')]=[{'all':!![]}];}return db[_0x9e04('0x72')][_0x9e04('0x60')](_0x5522c0);})[_0x9e04('0x27')](function(_0x1c3a96){_0x4c687e[_0x9e04('0x61')]=_0x1c3a96;return _0x4c687e;});}})['then'](respondWithFilteredResult(_0x4168a0,_0x5522c0))[_0x9e04('0x62')](handleError(_0x4168a0,null));};exports[_0x9e04('0x73')]=function(_0x2f2c30,_0x22c9a0){return db[_0x9e04('0x4a')][_0x9e04('0x6a')]({'where':{'id':_0x2f2c30[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x22c9a0,null))[_0x9e04('0x27')](function(_0x4bd070){if(_0x4bd070){return _0x4bd070[_0x9e04('0x73')](_0x2f2c30[_0x9e04('0x50')][_0x9e04('0x74')]);}})[_0x9e04('0x27')](respondWithStatusCode(_0x22c9a0,null))[_0x9e04('0x62')](handleError(_0x22c9a0,null));};exports[_0x9e04('0x75')]=function(_0x27a793,_0x4ac5d9){if(_0x27a793[_0x9e04('0x6b')]['id']){delete _0x27a793[_0x9e04('0x6b')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x27a793[_0x9e04('0x64')]['id']}})['then'](handleEntityNotFound(_0x4ac5d9,null))['then'](function(_0x2a0b67){if(_0x2a0b67){_0x27a793[_0x9e04('0x6b')][_0x9e04('0x70')]=_0x2a0b67['id'];return db['CannedAnswer'][_0x9e04('0x71')](_0x27a793[_0x9e04('0x6b')]);}})[_0x9e04('0x27')](respondWithResult(_0x4ac5d9,null))[_0x9e04('0x62')](handleError(_0x4ac5d9,null));};exports[_0x9e04('0x76')]=function(_0x5612d7,_0x6004dd){var _0x279a95={'raw':![],'where':{}};var _0x2b597e={};var _0x59414f={'count':0x0,'rows':[]};return db[_0x9e04('0x4a')][_0x9e04('0x77')]({'where':{'id':_0x5612d7[_0x9e04('0x64')]['id']}})['then'](handleEntityNotFound(_0x6004dd,null))[_0x9e04('0x27')](function(_0x3ebe2d){if(_0x3ebe2d){_0x2b597e[_0x9e04('0x4f')]=_[_0x9e04('0x51')](db['CannedAnswer'][_0x9e04('0x4b')]);_0x2b597e['query']=_[_0x9e04('0x51')](_0x5612d7[_0x9e04('0x50')]);_0x2b597e['filters']=_['intersection'](_0x2b597e[_0x9e04('0x4f')],_0x2b597e[_0x9e04('0x50')]);_0x279a95[_0x9e04('0x54')]=_[_0x9e04('0x53')](_0x2b597e[_0x9e04('0x4f')],qs[_0x9e04('0x55')](_0x5612d7[_0x9e04('0x50')][_0x9e04('0x55')]));_0x279a95[_0x9e04('0x54')]=_0x279a95[_0x9e04('0x54')][_0x9e04('0x67')]?_0x279a95['attributes']:_0x2b597e[_0x9e04('0x4f')];if(!_0x5612d7['query'][_0x9e04('0x56')](_0x9e04('0x57'))){_0x279a95[_0x9e04('0x22')]=qs['limit'](_0x5612d7[_0x9e04('0x50')]['limit']);_0x279a95[_0x9e04('0x20')]=qs[_0x9e04('0x20')](_0x5612d7['query'][_0x9e04('0x20')]);}_0x279a95['order']=qs[_0x9e04('0x59')](_0x5612d7['query']['sort']);_0x279a95[_0x9e04('0x5a')]=qs[_0x9e04('0x52')](_[_0x9e04('0x5b')](_0x5612d7[_0x9e04('0x50')],_0x2b597e['filters']));_0x279a95[_0x9e04('0x5a')][_0x9e04('0x70')]=_0x3ebe2d['id'];if(_0x5612d7[_0x9e04('0x50')][_0x9e04('0x5c')]){_0x279a95[_0x9e04('0x5a')]=_[_0x9e04('0x5e')](_0x279a95[_0x9e04('0x5a')],{'$or':_[_0x9e04('0x49')](_0x279a95[_0x9e04('0x54')],function(_0x5afd27){var _0x571c62={};_0x571c62[_0x5afd27]={'$like':'%'+_0x5612d7['query'][_0x9e04('0x5c')]+'%'};return _0x571c62;})});}_0x279a95=_[_0x9e04('0x5e')]({},_0x279a95,_0x5612d7[_0x9e04('0x69')]);return db['CannedAnswer'][_0x9e04('0x23')]({'where':_0x279a95['where']})[_0x9e04('0x27')](function(_0x545409){_0x59414f[_0x9e04('0x23')]=_0x545409;if(_0x5612d7[_0x9e04('0x50')]['includeAll']){_0x279a95['include']=[{'all':!![]}];}return db[_0x9e04('0x78')][_0x9e04('0x60')](_0x279a95);})['then'](function(_0x51d32c){_0x59414f[_0x9e04('0x61')]=_0x51d32c;return _0x59414f;});}})[_0x9e04('0x27')](respondWithFilteredResult(_0x6004dd,_0x279a95))['catch'](handleError(_0x6004dd,null));};exports[_0x9e04('0x79')]=function(_0x271ead,_0x3af906){return db[_0x9e04('0x4a')][_0x9e04('0x6a')]({'where':{'id':_0x271ead[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x3af906,null))['then'](function(_0x593376){if(_0x593376){return _0x593376['removeAnswers'](_0x271ead[_0x9e04('0x50')]['ids']);}})[_0x9e04('0x27')](respondWithStatusCode(_0x3af906,null))[_0x9e04('0x62')](handleError(_0x3af906,null));};exports[_0x9e04('0x71')]=function(_0x2e7345,_0x2b4e67){var _0x377fa2={'name':_0x2e7345[_0x9e04('0x6b')][_0x9e04('0x2c')],'key':_0x2e7345['body']['key'],'provider':_0x2e7345['body'][_0x9e04('0x6c')]===_0x9e04('0x6d')?null:_0x2e7345[_0x9e04('0x6b')][_0x9e04('0x6c')],'email':_0x2e7345[_0x9e04('0x6b')]['email'],'ListId':_0x2e7345[_0x9e04('0x6b')]['ListId'],'active':!_[_0x9e04('0x7a')](_0x2e7345[_0x9e04('0x6b')]['active'])?_0x2e7345['body'][_0x9e04('0x7b')]:!![],'description':_0x2e7345[_0x9e04('0x6b')][_0x9e04('0x7c')]||null};var _0x892418=getAuthenticationOptions(_0x377fa2[_0x9e04('0x6c')],_0x2e7345[_0x9e04('0x6b')]);_0x377fa2[_0x9e04('0x44')]=_0x892418[_0x9e04('0x44')];_0x377fa2[_0x9e04('0x45')]=_0x892418[_0x9e04('0x45')];return db['MailAccount'][_0x9e04('0x71')](_0x377fa2,{'include':[{'model':db[_0x9e04('0x65')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x9e04('0x44')}]})[_0x9e04('0x27')](function(_0x1d74e1){var _0x355713=_0x2e7345[_0x9e04('0x39')][_0x9e04('0x29')]({'plain':!![]});if(!_0x355713)throw new Error(_0x9e04('0x7d'));if(_0x355713['role']===_0x9e04('0x39')){var _0x510f6c=_0x1d74e1['get']({'plain':!![]});return db[_0x9e04('0x7e')][_0x9e04('0x6a')]({'where':{'name':_0x9e04('0x7f'),'userProfileId':_0x355713['userProfileId']},'raw':!![]})[_0x9e04('0x27')](function(_0x57e6dc){if(_0x57e6dc&&_0x57e6dc[_0x9e04('0x80')]===0x0){return db[_0x9e04('0x2a')][_0x9e04('0x71')]({'name':_0x510f6c[_0x9e04('0x2c')],'resourceId':_0x510f6c['id'],'type':_0x57e6dc[_0x9e04('0x2c')],'sectionId':_0x57e6dc['id']},{})[_0x9e04('0x27')](function(){return _0x1d74e1;});}else{return _0x1d74e1;}})[_0x9e04('0x62')](function(_0x4f928d){logger[_0x9e04('0x18')](_0x9e04('0x81'),_0x4f928d);throw _0x4f928d;});}return _0x1d74e1;})[_0x9e04('0x27')](respondWithResult(_0x2b4e67,0xc9))[_0x9e04('0x62')](handleError(_0x2b4e67,null));};exports['getImap']=function(_0x58066a,_0x199ced){return db[_0x9e04('0x4a')]['findOne']({'where':{'id':_0x58066a['params']['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x199ced,null))[_0x9e04('0x27')](function(_0x4d296e){if(_0x4d296e){return _0x4d296e[_0x9e04('0x82')]();}return null;})[_0x9e04('0x27')](respondWithResult(_0x199ced,null))['catch'](handleError(_0x199ced,null));};exports[_0x9e04('0x83')]=function(_0xa783a6,_0x305a94){if(_0xa783a6['body']['id']){delete _0xa783a6[_0x9e04('0x6b')]['id'];}return db['MailAccount'][_0x9e04('0x6a')]({'where':{'id':_0xa783a6[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x305a94,null))[_0x9e04('0x27')](function(_0x14aafc){if(_0x14aafc){_0xa783a6[_0x9e04('0x6b')][_0x9e04('0x70')]=_0x14aafc['id'];return db[_0x9e04('0x47')][_0x9e04('0x71')](_0xa783a6[_0x9e04('0x6b')]);}})[_0x9e04('0x27')](respondWithResult(_0x305a94,null))['catch'](handleError(_0x305a94,null));};exports['removeImap']=function(_0x57b3a7,_0x4c088d){return db[_0x9e04('0x4a')][_0x9e04('0x77')]({'where':{'id':_0x57b3a7[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x4c088d,null))[_0x9e04('0x27')](function(_0x41508a){if(_0x41508a){return _0x41508a[_0x9e04('0x84')](null);}return null;})[_0x9e04('0x27')](respondWithStatusCode(_0x4c088d,null))[_0x9e04('0x62')](handleError(_0x4c088d,null));};exports['getSmtp']=function(_0x44f58,_0x3c4393){return db[_0x9e04('0x4a')][_0x9e04('0x77')]({'where':{'id':_0x44f58[_0x9e04('0x64')]['id']}})['then'](handleEntityNotFound(_0x3c4393,null))[_0x9e04('0x27')](function(_0x1698bf){if(_0x1698bf){return _0x1698bf[_0x9e04('0x85')]();}return null;})['then'](respondWithResult(_0x3c4393,null))[_0x9e04('0x62')](handleError(_0x3c4393,null));};exports['addSmtp']=function(_0x3cb549,_0x15349f){if(_0x3cb549[_0x9e04('0x6b')]['id']){delete _0x3cb549[_0x9e04('0x6b')]['id'];}return db[_0x9e04('0x4a')][_0x9e04('0x6a')]({'where':{'id':_0x3cb549[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x15349f,null))['then'](function(_0x312c9d){if(_0x312c9d){_0x3cb549[_0x9e04('0x6b')][_0x9e04('0x70')]=_0x312c9d['id'];return db[_0x9e04('0x65')][_0x9e04('0x71')](_0x3cb549[_0x9e04('0x6b')]);}})[_0x9e04('0x27')](respondWithResult(_0x15349f,null))[_0x9e04('0x62')](handleError(_0x15349f,null));};exports['removeSmtp']=function(_0x5cf42a,_0x30b9f2){return db[_0x9e04('0x4a')][_0x9e04('0x77')]({'where':{'id':_0x5cf42a[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x30b9f2,null))[_0x9e04('0x27')](function(_0x35946c){if(_0x35946c){return _0x35946c['setSmtp'](null);}return null;})[_0x9e04('0x27')](respondWithStatusCode(_0x30b9f2,null))[_0x9e04('0x62')](handleError(_0x30b9f2,null));};exports['addInteraction']=function(_0x134a72,_0x31ff32){return db[_0x9e04('0x86')][_0x9e04('0x6a')]({'where':{'id':_0x134a72[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x31ff32,null))[_0x9e04('0x27')](function(_0x202627){if(_0x202627){return _0x202627[_0x9e04('0x87')](_0x134a72[_0x9e04('0x6b')][_0x9e04('0x74')],_['omit'](_0x134a72[_0x9e04('0x6b')],['ids','id'])||{});}})[_0x9e04('0x27')](respondWithResult(_0x31ff32,null))[_0x9e04('0x62')](handleError(_0x31ff32,null));};exports[_0x9e04('0x88')]=function(_0x59dd14,_0x581429){var _0x1dbb45={'raw':![],'where':{}};var _0x4340b6={};var _0xa7afd1={'count':0x0,'rows':[]};return db[_0x9e04('0x4a')][_0x9e04('0x77')]({'where':{'id':_0x59dd14[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x581429,null))['then'](function(_0x396ee3){if(_0x396ee3){_0x4340b6[_0x9e04('0x4f')]=_[_0x9e04('0x51')](db[_0x9e04('0x86')][_0x9e04('0x4b')]);_0x4340b6['query']=_[_0x9e04('0x51')](_0x59dd14[_0x9e04('0x50')]);_0x4340b6[_0x9e04('0x52')]=_[_0x9e04('0x53')](_0x4340b6['model'],_0x4340b6[_0x9e04('0x50')]);_0x1dbb45[_0x9e04('0x54')]=_[_0x9e04('0x53')](_0x4340b6[_0x9e04('0x4f')],qs[_0x9e04('0x55')](_0x59dd14['query'][_0x9e04('0x55')]));_0x1dbb45[_0x9e04('0x54')]=_0x1dbb45['attributes'][_0x9e04('0x67')]?_0x1dbb45[_0x9e04('0x54')]:_0x4340b6['model'];if(!_0x59dd14['query'][_0x9e04('0x56')](_0x9e04('0x57'))){_0x1dbb45[_0x9e04('0x22')]=qs[_0x9e04('0x22')](_0x59dd14[_0x9e04('0x50')][_0x9e04('0x22')]);_0x1dbb45[_0x9e04('0x20')]=qs['offset'](_0x59dd14[_0x9e04('0x50')]['offset']);}_0x1dbb45[_0x9e04('0x58')]=qs['sort'](_0x59dd14[_0x9e04('0x50')][_0x9e04('0x59')]);_0x1dbb45[_0x9e04('0x5a')]=qs[_0x9e04('0x52')](_['pick'](_0x59dd14['query'],_0x4340b6[_0x9e04('0x52')]));_0x1dbb45[_0x9e04('0x5a')]['MailAccountId']=_0x396ee3['id'];if(_0x59dd14[_0x9e04('0x50')][_0x9e04('0x5c')]){_0x1dbb45[_0x9e04('0x5a')]=_[_0x9e04('0x5e')](_0x1dbb45[_0x9e04('0x5a')],{'$or':_[_0x9e04('0x49')](_0x1dbb45['attributes'],function(_0x16be70){var _0x3fa270={};_0x3fa270[_0x16be70]={'$like':'%'+_0x59dd14[_0x9e04('0x50')][_0x9e04('0x5c')]+'%'};return _0x3fa270;})});}_0x1dbb45=_['merge']({},_0x1dbb45,_0x59dd14[_0x9e04('0x69')]);return db[_0x9e04('0x86')][_0x9e04('0x23')]({'where':_0x1dbb45[_0x9e04('0x5a')]})['then'](function(_0x31040e){_0xa7afd1[_0x9e04('0x23')]=_0x31040e;if(_0x59dd14[_0x9e04('0x50')][_0x9e04('0x68')]){_0x1dbb45['include']=[{'model':db[_0x9e04('0x89')],'as':_0x9e04('0x8a'),'required':![]},{'model':db[_0x9e04('0x8b')],'as':'Owner','attributes':[_0x9e04('0x2c'),_0x9e04('0x8c'),'internal'],'required':![]},{'model':db[_0x9e04('0x8d')],'as':_0x9e04('0x8e'),'attributes':['id','name','color'],'where':_0x59dd14[_0x9e04('0x50')]['tag']?{'id':_0x59dd14[_0x9e04('0x50')][_0x9e04('0x8f')]}:undefined,'required':_0x59dd14[_0x9e04('0x50')][_0x9e04('0x8f')]?!![]:![]}];}return db['MailInteraction'][_0x9e04('0x60')](_0x1dbb45);})[_0x9e04('0x27')](function(_0x41e08e){_0xa7afd1[_0x9e04('0x61')]=_0x41e08e;return _0xa7afd1;});}})[_0x9e04('0x27')](respondWithFilteredResult(_0x581429,_0x1dbb45))[_0x9e04('0x62')](handleError(_0x581429,null));};exports[_0x9e04('0x90')]=function addApplications(_0x582d1b,_0x1e1907){var _0x11b095=_0x582d1b[_0x9e04('0x64')]['id'];var _0x418490=_0x582d1b['body'];var _0x593287=0xc8;var _0x2b636c=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x9e04('0x91')][_0x9e04('0x92')][_0x9e04('0x93')]},function(_0x58eee5){return db['MailAccount'][_0x9e04('0x77')]({'where':{'id':_0x11b095},'transaction':_0x58eee5})[_0x9e04('0x27')](function(_0x4ba507){if(_0x4ba507){return db[_0x9e04('0x94')]['destroy']({'where':{'MailAccountId':_0x11b095},'transaction':_0x58eee5})[_0x9e04('0x27')](function(){var _0x4092f7=_[_0x9e04('0x49')](_0x418490,function(_0x5f1db5){_0x5f1db5['MailAccountId']=_0x11b095;return _0x5f1db5;});return db[_0x9e04('0x94')][_0x9e04('0x95')](_0x4092f7,{'transaction':_0x58eee5});});}else{_0x593287=0x194;_0x2b636c=[];}});})[_0x9e04('0x27')](function(){if(_0x593287!==0x194){return db[_0x9e04('0x94')][_0x9e04('0x96')]({'where':{'MailAccountId':_0x11b095},'order':'priority'})[_0x9e04('0x27')](function(_0x208eb0){_0x2b636c=_0x208eb0;});}})[_0x9e04('0x62')](function(_0x19f9f8){_0x593287=0x1f4;logger[_0x9e04('0x18')](_0x19f9f8['stack']);if(_0x19f9f8[_0x9e04('0x2c')]){delete _0x19f9f8[_0x9e04('0x2c')];}_0x2b636c=_0x19f9f8;})[_0x9e04('0x97')](function(){if(_0x2b636c===null){_0x1e1907[_0x9e04('0x1c')](_0x593287);}else{if(_0x593287===0x1f4){_0x1e1907[_0x9e04('0x1d')](_0x593287)[_0x9e04('0x2d')](_0x2b636c);}else{_0x1e1907['status'](_0x593287)[_0x9e04('0x1f')](_0x2b636c);}}});};exports['getApplications']=function(_0x5ddb09,_0x5d4767){var _0x232dc0={};var _0x3eeaae={};var _0x481e8c;var _0x5530cd;return db[_0x9e04('0x4a')]['findOne']({'where':{'id':_0x5ddb09[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x5d4767,null))[_0x9e04('0x27')](function(_0x2dffae){if(_0x2dffae){_0x481e8c=_0x2dffae;_0x3eeaae[_0x9e04('0x4f')]=_[_0x9e04('0x51')](db[_0x9e04('0x94')][_0x9e04('0x4b')]);_0x3eeaae[_0x9e04('0x50')]=_[_0x9e04('0x51')](_0x5ddb09[_0x9e04('0x50')]);_0x3eeaae[_0x9e04('0x52')]=_[_0x9e04('0x53')](_0x3eeaae[_0x9e04('0x4f')],_0x3eeaae[_0x9e04('0x50')]);_0x232dc0[_0x9e04('0x54')]=_[_0x9e04('0x53')](_0x3eeaae[_0x9e04('0x4f')],qs['fields'](_0x5ddb09['query']['fields']));_0x232dc0[_0x9e04('0x54')]=_0x232dc0[_0x9e04('0x54')]['length']?_0x232dc0[_0x9e04('0x54')]:_0x3eeaae['model'];_0x232dc0[_0x9e04('0x58')]=qs[_0x9e04('0x59')](_0x5ddb09[_0x9e04('0x50')]['sort']);_0x232dc0[_0x9e04('0x5a')]=qs['filters'](_[_0x9e04('0x5b')](_0x5ddb09[_0x9e04('0x50')],_0x3eeaae[_0x9e04('0x52')]));if(_0x5ddb09[_0x9e04('0x50')]['filter']){_0x232dc0[_0x9e04('0x5a')]=_[_0x9e04('0x5e')](_0x232dc0['where'],{'$or':_[_0x9e04('0x49')](_0x232dc0[_0x9e04('0x54')],function(_0x5eb995){var _0x2e216b={};_0x2e216b[_0x5eb995]={'$like':'%'+_0x5ddb09[_0x9e04('0x50')][_0x9e04('0x5c')]+'%'};return _0x2e216b;})});}_0x232dc0=_['merge']({},_0x232dc0,_0x5ddb09['options']);return _0x481e8c[_0x9e04('0x98')](_0x232dc0);}})[_0x9e04('0x27')](function(_0x1789d9){if(_0x1789d9){_0x5530cd=_0x1789d9['length'];if(!_0x5ddb09[_0x9e04('0x50')][_0x9e04('0x56')](_0x9e04('0x57'))){_0x232dc0[_0x9e04('0x22')]=qs[_0x9e04('0x22')](_0x5ddb09['query']['limit']);_0x232dc0[_0x9e04('0x20')]=qs[_0x9e04('0x20')](_0x5ddb09['query'][_0x9e04('0x20')]);}return _0x481e8c[_0x9e04('0x98')](_0x232dc0);}})['then'](function(_0x22bb72){if(_0x22bb72){return _0x22bb72?{'count':_0x5530cd,'rows':_0x22bb72}:null;}})[_0x9e04('0x27')](respondWithResult(_0x5d4767,null))[_0x9e04('0x62')](handleError(_0x5d4767,null));};exports[_0x9e04('0x99')]=function(_0x176c3f,_0x1ee681){var _0x1abe49={'raw':!![],'where':{}};var _0xbdfbe1={};var _0x7826dd={'count':0x0,'rows':[]};return db[_0x9e04('0x4a')][_0x9e04('0x77')]({'where':{'id':_0x176c3f['params']['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x1ee681,null))[_0x9e04('0x27')](function(_0x40ae7f){if(_0x40ae7f){_0xbdfbe1[_0x9e04('0x4f')]=_[_0x9e04('0x51')](db[_0x9e04('0x9a')][_0x9e04('0x4b')]);_0xbdfbe1[_0x9e04('0x50')]=_['keys'](_0x176c3f[_0x9e04('0x50')]);_0xbdfbe1[_0x9e04('0x52')]=_['intersection'](_0xbdfbe1[_0x9e04('0x4f')],_0xbdfbe1[_0x9e04('0x50')]);_0x1abe49['attributes']=_['intersection'](_0xbdfbe1['model'],qs['fields'](_0x176c3f[_0x9e04('0x50')][_0x9e04('0x55')]));_0x1abe49[_0x9e04('0x54')]=_0x1abe49[_0x9e04('0x54')][_0x9e04('0x67')]?_0x1abe49[_0x9e04('0x54')]:_0xbdfbe1[_0x9e04('0x4f')];if(!_0x176c3f[_0x9e04('0x50')][_0x9e04('0x56')](_0x9e04('0x57'))){_0x1abe49[_0x9e04('0x22')]=qs['limit'](_0x176c3f[_0x9e04('0x50')][_0x9e04('0x22')]);_0x1abe49[_0x9e04('0x20')]=qs[_0x9e04('0x20')](_0x176c3f[_0x9e04('0x50')]['offset']);}_0x1abe49[_0x9e04('0x58')]=qs[_0x9e04('0x59')](_0x176c3f[_0x9e04('0x50')][_0x9e04('0x59')]);_0x1abe49['where']=qs[_0x9e04('0x52')](_[_0x9e04('0x5b')](_0x176c3f[_0x9e04('0x50')],_0xbdfbe1['filters']));_0x1abe49[_0x9e04('0x5a')][_0x9e04('0x70')]=_0x40ae7f['id'];if(_0x176c3f[_0x9e04('0x50')][_0x9e04('0x5c')]){_0x1abe49[_0x9e04('0x5a')]=_[_0x9e04('0x5e')](_0x1abe49[_0x9e04('0x5a')],{'$or':_[_0x9e04('0x49')](_0x1abe49[_0x9e04('0x54')],function(_0x21df53){var _0xbba3d5={};_0xbba3d5[_0x21df53]={'$like':'%'+_0x176c3f[_0x9e04('0x50')][_0x9e04('0x5c')]+'%'};return _0xbba3d5;})});}if(_0x176c3f[_0x9e04('0x50')]['$gte']){var _0x593e25=_0x176c3f[_0x9e04('0x50')]['$gte']['split'](',');var _0x14557a={};_0x14557a[_0x593e25[0x0]]={'$gte':moment(_0x593e25[0x1])[_0x9e04('0x9b')](_0x9e04('0x9c'))};_0x1abe49['where']=_[_0x9e04('0x5e')](_0x1abe49['where'],_0x14557a);}_0x1abe49=_[_0x9e04('0x5e')]({},_0x1abe49,_0x176c3f[_0x9e04('0x69')]);return db[_0x9e04('0x9a')][_0x9e04('0x23')]({'where':_0x1abe49[_0x9e04('0x5a')]})[_0x9e04('0x27')](function(_0x58fcac){_0x7826dd[_0x9e04('0x23')]=_0x58fcac;if(_0x176c3f['query'][_0x9e04('0x68')]){_0x1abe49['include']=[{'all':!![]}];}return db[_0x9e04('0x9a')][_0x9e04('0x60')](_0x1abe49);})['then'](function(_0x39435d){if(_0x176c3f[_0x9e04('0x50')][_0x9e04('0x9d')]==='true'){for(var _0x4419ab=0x0;_0x4419ab<_0x39435d[_0x9e04('0x67')];_0x4419ab++){_0x39435d[_0x4419ab][_0x9e04('0x6b')]=juice(_0x39435d[_0x4419ab][_0x9e04('0x6b')]);}}_0x7826dd[_0x9e04('0x61')]=_0x39435d;return _0x7826dd;});}})[_0x9e04('0x27')](respondWithFilteredResult(_0x1ee681,_0x1abe49))['catch'](handleError(_0x1ee681,null));};exports[_0x9e04('0x2d')]=function(_0xc99f4d,_0x4e9bb2){var _0x414394,_0x57872c={},_0x267f59;if(_0xc99f4d['body']['to']){_0x267f59=_0xc99f4d[_0x9e04('0x6b')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x9e04('0x6a')]({'where':{'id':_0xc99f4d['params']['id']},'include':[{'model':db[_0x9e04('0x9e')],'as':_0x9e04('0x9f'),'include':[{'model':db[_0x9e04('0x89')],'as':_0x9e04('0xa0'),'where':{'email':_0x267f59},'limit':0x1,'order':[[_0x9e04('0xa1'),'DESC']]}]},{'model':db[_0x9e04('0x65')],'as':_0x9e04('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x9e04('0x27')](handleEntityNotFound(_0x4e9bb2,null))[_0x9e04('0x27')](function(_0x22c732){if(!_0x22c732)return;_0x414394=_0x22c732;if(!_0x22c732[_0x9e04('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x9e04('0x7a')](_0xc99f4d[_0x9e04('0x6b')][_0x9e04('0xa2')])){_0xc99f4d['body']['from']=util['format']('%s\x20<%s>',_0x22c732[_0x9e04('0x2c')],_0x22c732[_0x9e04('0xa3')]||_0x22c732['Smtp'][_0x9e04('0x39')]);}if(_0xc99f4d[_0x9e04('0x6b')]['attachments']&&_0xc99f4d[_0x9e04('0x6b')][_0x9e04('0xa4')][_0x9e04('0x67')]){for(var _0x181a69=0x0;_0x181a69<_0xc99f4d[_0x9e04('0x6b')]['attachments'][_0x9e04('0x67')];_0x181a69+=0x1){_0xc99f4d['body'][_0x9e04('0xa4')][_0x181a69]={'filename':_0xc99f4d[_0x9e04('0x6b')][_0x9e04('0xa4')][_0x181a69]['name'],'path':path[_0x9e04('0xa5')](config['root'],_0x9e04('0xa6'),_0xc99f4d[_0x9e04('0x6b')][_0x9e04('0xa4')][_0x181a69]['basename'])};}}var _0x10357f=_0x22c732['getSmtpOptions']();return respondWithRpcPromise(_0x9e04('0xa7'),_0x9e04('0xa8'),{'account':_0x10357f,'message':_0xc99f4d[_0x9e04('0x6b')]});})[_0x9e04('0x27')](function(_0x486992){if(!_0x486992)return;_0x57872c=_0x486992;if(!_0x414394[_0x9e04('0x9f')])throw new Error('List\x20not\x20found');if(_0x414394[_0x9e04('0x9f')][_0x9e04('0xa0')]['length'])return _0x414394['List'][_0x9e04('0xa0')][0x0];return db[_0x9e04('0x89')][_0x9e04('0x71')](_[_0x9e04('0xa')](_0xc99f4d[_0x9e04('0x6b')],{'firstName':_0xc99f4d[_0x9e04('0x6b')]['to'],'email':_0xc99f4d['body']['to'],'phone':_0xc99f4d['body']['to'],'ListId':_0x414394['ListId']}));})[_0x9e04('0x27')](function(_0x475f51){if(!_0x475f51)return;var _0x204c0c={'UserId':_0xc99f4d[_0x9e04('0x39')]['id'],'ContactId':_0x475f51['id'],'MailAccountId':_0x414394['id'],'inReplyTo':_0x57872c[_0x9e04('0xa9')],'to':_0xc99f4d['body'][_0x9e04('0xa2')],'cc':_0xc99f4d[_0x9e04('0x6b')]['cc'],'subject':_0xc99f4d[_0x9e04('0x6b')][_0x9e04('0xaa')],'attach':_0xc99f4d['body'][_0x9e04('0xab')],'firstMsgDirection':_0x9e04('0xac'),'lastMsgAt':moment()[_0x9e04('0x9b')](_0x9e04('0x9c')),'lastMsgDirection':_0x9e04('0xac'),'Messages':[_[_0x9e04('0x5e')](_0xc99f4d[_0x9e04('0x6b')],{'messageId':_0x57872c[_0x9e04('0xa9')],'sentAt':moment()[_0x9e04('0x9b')](_0x9e04('0x9c')),'read':!![],'MailAccountId':_0x414394['id'],'UserId':_0xc99f4d['user']['id'],'ContactId':_0x475f51['id']})]};if(_0xc99f4d[_0x9e04('0x6b')]['Interaction']){_0x204c0c=_[_0x9e04('0x5e')](_0x204c0c,_0xc99f4d[_0x9e04('0x6b')]['Interaction']);}return db['MailInteraction'][_0x9e04('0x71')](_0x204c0c,{'include':[{'model':db['MailMessage'],'as':_0x9e04('0xad')}]});})[_0x9e04('0x27')](respondWithResult(_0x4e9bb2,null))[_0x9e04('0x62')](handleError(_0x4e9bb2,null));};exports['verifySmtp']=function(_0x4fe726,_0x18033d){return db['MailAccount'][_0x9e04('0x6a')]({'where':{'id':_0x4fe726[_0x9e04('0x64')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x9e04('0x45'),'raw':!![],'include':[{'model':db[_0x9e04('0xae')],'as':'CloudProvider','raw':!![]}]}]})[_0x9e04('0x27')](handleEntityNotFound(_0x18033d,null))['then'](function(_0x9aec15){if(!_0x9aec15[_0x9e04('0x45')])return;var _0x5baa95=_0x9aec15[_0x9e04('0xaf')]();return respondWithRpcPromise(_0x9e04('0xb0'),'verifySmtp',{'account':_0x5baa95});})[_0x9e04('0x27')](respondWithResult(_0x18033d,null))[_0x9e04('0x62')](handleError(_0x18033d,null));};exports[_0x9e04('0x28')]=function(_0x11b163,_0x2d8788){return db['MailAccount'][_0x9e04('0x6a')]({'where':{'id':_0x11b163[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x2d8788,null))['then'](function(_0x58fe8d){if(_0x58fe8d&&_0x58fe8d[_0x9e04('0x42')]){throw new db[(_0x9e04('0xb1'))][(_0x9e04('0xb2'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x58fe8d;})[_0x9e04('0x27')](removeEntity(_0x2d8788,null))[_0x9e04('0x62')](handleError(_0x2d8788,null));};exports['addAgents']=function(_0xd970b5,_0x3c0e55){return db['MailAccount']['find']({'where':{'id':_0xd970b5[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x3c0e55,null))[_0x9e04('0x27')](function(_0x438e13){if(_0x438e13){return _0x438e13['addAgents'](_0xd970b5['body'][_0x9e04('0x74')],_[_0x9e04('0xb3')](_0xd970b5[_0x9e04('0x6b')],[_0x9e04('0x74'),'id'])||{})[_0x9e04('0xb4')](function(_0x4fddb5){for(var _0x273b85=0x0;_0x273b85<_0xd970b5[_0x9e04('0x6b')][_0x9e04('0x74')][_0x9e04('0x67')];_0x273b85+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0xd970b5[_0x9e04('0x6b')][_0x9e04('0x74')][_0x273b85]),'MailAccountId':Number(_0xd970b5['params']['id'])});}return _0x4fddb5;});}})[_0x9e04('0x27')](respondWithResult(_0x3c0e55,null))[_0x9e04('0x62')](handleError(_0x3c0e55,null));};exports[_0x9e04('0xb5')]=function(_0x2c77d4,_0x585f02){return db[_0x9e04('0x4a')][_0x9e04('0x6a')]({'where':{'id':_0x2c77d4['params']['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x585f02,null))[_0x9e04('0x27')](function(_0x1fc661){if(_0x1fc661){return _0x1fc661[_0x9e04('0xb5')](_0x2c77d4[_0x9e04('0x50')][_0x9e04('0x74')])[_0x9e04('0x27')](function(){if(_[_0x9e04('0xb6')](_0x2c77d4[_0x9e04('0x50')][_0x9e04('0x74')])){for(var _0x19db70=0x0;_0x19db70<_0x2c77d4[_0x9e04('0x50')][_0x9e04('0x74')][_0x9e04('0x67')];_0x19db70+=0x1){socket['emit'](_0x9e04('0xb7'),{'UserId':Number(_0x2c77d4[_0x9e04('0x50')][_0x9e04('0x74')][_0x19db70]),'MailAccountId':Number(_0x2c77d4[_0x9e04('0x64')]['id'])});}}else{socket[_0x9e04('0xb8')](_0x9e04('0xb7'),{'UserId':Number(_0x2c77d4[_0x9e04('0x50')]['ids']),'MailAccountId':Number(_0x2c77d4[_0x9e04('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x585f02,null))[_0x9e04('0x62')](handleError(_0x585f02,null));};exports[_0x9e04('0xb9')]=function(_0x1c28ee,_0x4035e1){var _0x4635f1={};var _0x5d188e={};var _0x50c8de;var _0x216f50;return db[_0x9e04('0x4a')]['findOne']({'where':{'id':_0x1c28ee[_0x9e04('0x64')]['id']}})[_0x9e04('0x27')](handleEntityNotFound(_0x4035e1,null))['then'](function(_0x5813ca){if(_0x5813ca){_0x50c8de=_0x5813ca;_0x5d188e[_0x9e04('0x4f')]=_[_0x9e04('0x51')](db[_0x9e04('0x8b')][_0x9e04('0x4b')]);_0x5d188e[_0x9e04('0x50')]=_[_0x9e04('0x51')](_0x1c28ee[_0x9e04('0x50')]);_0x5d188e[_0x9e04('0x52')]=_[_0x9e04('0x53')](_0x5d188e['model'],_0x5d188e[_0x9e04('0x50')]);_0x4635f1['attributes']=_['intersection'](_0x5d188e[_0x9e04('0x4f')],qs['fields'](_0x1c28ee[_0x9e04('0x50')][_0x9e04('0x55')]));_0x4635f1[_0x9e04('0x54')]=_0x4635f1[_0x9e04('0x54')]['length']?_0x4635f1[_0x9e04('0x54')]:_0x5d188e[_0x9e04('0x4f')];_0x4635f1[_0x9e04('0x58')]=qs[_0x9e04('0x59')](_0x1c28ee[_0x9e04('0x50')][_0x9e04('0x59')]);_0x4635f1['where']=qs[_0x9e04('0x52')](_[_0x9e04('0x5b')](_0x1c28ee[_0x9e04('0x50')],_0x5d188e['filters']));if(_0x1c28ee[_0x9e04('0x50')]['filter']){_0x4635f1[_0x9e04('0x5a')]=_[_0x9e04('0x5e')](_0x4635f1[_0x9e04('0x5a')],{'$or':_[_0x9e04('0x49')](_0x4635f1['attributes'],function(_0x19357a){var _0x2af281={};_0x2af281[_0x19357a]={'$like':'%'+_0x1c28ee[_0x9e04('0x50')]['filter']+'%'};return _0x2af281;})});}_0x4635f1=_[_0x9e04('0x5e')]({},_0x4635f1,_0x1c28ee[_0x9e04('0x69')]);return _0x50c8de[_0x9e04('0xb9')](_0x4635f1);}})['then'](function(_0x2ff7aa){if(_0x2ff7aa){_0x216f50=_0x2ff7aa[_0x9e04('0x67')];if(!_0x1c28ee[_0x9e04('0x50')]['hasOwnProperty'](_0x9e04('0x57'))){_0x4635f1[_0x9e04('0x22')]=qs[_0x9e04('0x22')](_0x1c28ee[_0x9e04('0x50')][_0x9e04('0x22')]);_0x4635f1[_0x9e04('0x20')]=qs['offset'](_0x1c28ee[_0x9e04('0x50')][_0x9e04('0x20')]);}return _0x50c8de[_0x9e04('0xb9')](_0x4635f1);}})[_0x9e04('0x27')](function(_0x29a057){if(_0x29a057){return _0x29a057?{'count':_0x216f50,'rows':_0x29a057}:null;}})['then'](respondWithResult(_0x4035e1,null))[_0x9e04('0x62')](handleError(_0x4035e1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7fbb4a9..622e89f 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 _0xd70e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd70e,0x157));var _0xed70=function(_0x4f3fae,_0x338661){_0x4f3fae=_0x4f3fae-0x0;var _0x2bb251=_0xd70e[_0x4f3fae];return _0x2bb251;};'use strict';var EventEmitter=require(_0xed70('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xed70('0x1')](0x0);var events={'afterCreate':_0xed70('0x2'),'afterUpdate':_0xed70('0x3'),'afterDestroy':_0xed70('0x4')};function emitEvent(_0x269875){return function(_0x411dcd,_0x289ce9,_0x54f657){MailAccountEvents[_0xed70('0x5')](_0x269875+':'+_0x411dcd['id'],_0x411dcd);MailAccountEvents[_0xed70('0x5')](_0x269875,_0x411dcd);_0x54f657(null);};}for(var e in events){if(events[_0xed70('0x6')](e)){var event=events[e];MailAccount[_0xed70('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xe978=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','update','remove'];(function(_0x121a85,_0x1d7891){var _0x27be3d=function(_0x19b60b){while(--_0x19b60b){_0x121a85['push'](_0x121a85['shift']());}};_0x27be3d(++_0x1d7891);}(_0xe978,0x70));var _0x8e97=function(_0x3efff3,_0x179e83){_0x3efff3=_0x3efff3-0x0;var _0x332931=_0xe978[_0x3efff3];return _0x332931;};'use strict';var EventEmitter=require(_0x8e97('0x0'));var MailAccount=require(_0x8e97('0x1'))['db'][_0x8e97('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e97('0x3'),'afterDestroy':_0x8e97('0x4')};function emitEvent(_0x16e587){return function(_0x3e3a3a,_0x1e27f7,_0x4f11c9){MailAccountEvents[_0x8e97('0x5')](_0x16e587+':'+_0x3e3a3a['id'],_0x3e3a3a);MailAccountEvents[_0x8e97('0x5')](_0x16e587,_0x3e3a3a);_0x4f11c9(null);};}for(var e in events){if(events[_0x8e97('0x6')](e)){var event=events[e];MailAccount[_0x8e97('0x7')](e,emitEvent(event));}}module[_0x8e97('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 47d3bab..659b7bb 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 _0x4932=['exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass'];(function(_0x330652,_0x545c6f){var _0x2b81af=function(_0x53821f){while(--_0x53821f){_0x330652['push'](_0x330652['shift']());}};_0x2b81af(++_0x545c6f);}(_0x4932,0xb4));var _0x2493=function(_0x7e6283,_0x1bf561){_0x7e6283=_0x7e6283-0x0;var _0x1264f0=_0x4932[_0x7e6283];return _0x1264f0;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x2493('0x0')]=function(_0x526257){return _0x526257[_0x2493('0x1')](_0x2493('0x2'),attributes,{'tableName':_0x2493('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5a8347=this;var _0x31f48b={'id':_0x5a8347['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5a8347[_0x2493('0x4')]!==_0x2493('0x5')){_0x31f48b[_0x2493('0x6')]=_0x5a8347[_0x2493('0x4')];}else{_0x31f48b[_0x2493('0x7')]=_0x5a8347[_0x2493('0x8')][_0x2493('0x7')];_0x31f48b['port']=_0x5a8347[_0x2493('0x8')][_0x2493('0x9')];_0x31f48b[_0x2493('0xa')]=_0x5a8347[_0x2493('0x8')][_0x2493('0xa')];}if(_0x5a8347[_0x2493('0x8')][_0x2493('0xb')]){if(_0x5a8347[_0x2493('0x8')][_0x2493('0xc')]){if(!_0x5a8347[_0x2493('0x8')][_0x2493('0xd')])throw new Error(_0x2493('0xe'));_0x31f48b[_0x2493('0xf')]={'type':_0x2493('0x10'),'user':_0x5a8347['Smtp'][_0x2493('0x11')],'accessToken':_0x5a8347[_0x2493('0x8')][_0x2493('0xd')][_0x2493('0x12')]};}else{_0x31f48b['auth']={'user':_0x5a8347['Smtp'][_0x2493('0x11')],'pass':_0x5a8347[_0x2493('0x8')][_0x2493('0x13')]};}}return _0x31f48b;}}});}; \ No newline at end of file +var _0x120c=['service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','./mailAccount.attributes','exports','provider','custom'];(function(_0x4f7e5b,_0x452c65){var _0x13ea34=function(_0x3f04c0){while(--_0x3f04c0){_0x4f7e5b['push'](_0x4f7e5b['shift']());}};_0x13ea34(++_0x452c65);}(_0x120c,0x172));var _0xc120=function(_0x5a62e5,_0x25cfe8){_0x5a62e5=_0x5a62e5-0x0;var _0x4c1f12=_0x120c[_0x5a62e5];return _0x4c1f12;};'use strict';var attributes=require(_0xc120('0x0'));module[_0xc120('0x1')]=function(_0x43fb5f){return _0x43fb5f['define']('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x42570b=this;var _0x1e1961={'id':_0x42570b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x42570b[_0xc120('0x2')]!==_0xc120('0x3')){_0x1e1961[_0xc120('0x4')]=_0x42570b[_0xc120('0x2')];}else{_0x1e1961[_0xc120('0x5')]=_0x42570b[_0xc120('0x6')]['host'];_0x1e1961[_0xc120('0x7')]=_0x42570b[_0xc120('0x6')][_0xc120('0x7')];_0x1e1961[_0xc120('0x8')]=_0x42570b['Smtp'][_0xc120('0x8')];}if(_0x42570b[_0xc120('0x6')][_0xc120('0x9')]){if(_0x42570b[_0xc120('0x6')][_0xc120('0xa')]){if(!_0x42570b[_0xc120('0x6')][_0xc120('0xb')])throw new Error(_0xc120('0xc'));_0x1e1961['auth']={'type':_0xc120('0xd'),'user':_0x42570b[_0xc120('0x6')][_0xc120('0xe')],'accessToken':_0x42570b[_0xc120('0x6')][_0xc120('0xb')][_0xc120('0xf')]};}else{_0x1e1961[_0xc120('0x10')]={'user':_0x42570b[_0xc120('0x6')][_0xc120('0xe')],'pass':_0x42570b[_0xc120('0x6')]['pass']};}}return _0x1e1961;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 100ac8b..4ed9f4a 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 _0x9f5a=['result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','info','ShowMailAccount','find','where','smtp','setDataValue','NotifyMailAccount','body','difference','CmContact','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','Smtp','CloudProvider','get','account','getSmtpOptions','applications','orderBy','priority','autoclose','push','length','*,*,*,*','create','contact','messageId','subject','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','attach','format','interaction','created','MailMessage','attachments','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','MailQueue','queueId','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4c783d,_0x3a86cc){var _0x541562=function(_0x2f1658){while(--_0x2f1658){_0x4c783d['push'](_0x4c783d['shift']());}};_0x541562(++_0x3a86cc);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x14f044,_0x1600e2){_0x14f044=_0x14f044-0x0;var _0x335fa5=_0x9f5a[_0x14f044];return _0x335fa5;};'use strict';var _=require(_0xa9f5('0x0'));var moment=require(_0xa9f5('0x1'));var BPromise=require(_0xa9f5('0x2'));var rs=require(_0xa9f5('0x3'));var Redis=require('ioredis');var db=require(_0xa9f5('0x4'))['db'];var logger=require(_0xa9f5('0x5'))(_0xa9f5('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9f5('0x7'));var client=jayson['client'][_0xa9f5('0x8')]({'port':0x232c});config[_0xa9f5('0x9')]=_['defaults'](config[_0xa9f5('0x9')],{'host':_0xa9f5('0xa'),'port':0x18eb});var socket=require(_0xa9f5('0xb'))(new Redis(config[_0xa9f5('0x9')]));require(_0xa9f5('0xc'))[_0xa9f5('0xd')](socket);function respondWithRpcPromise(_0x189ef8,_0x4cb5a5,_0x2e0ff8){return new BPromise(function(_0x2ec4a7,_0x4bb362){return client[_0xa9f5('0xe')](_0x189ef8,_0x2e0ff8)[_0xa9f5('0xf')](function(_0x4ebcf5){logger['info'](_0xa9f5('0x10'),_0x4cb5a5,_0xa9f5('0x11'));logger[_0xa9f5('0x12')](_0xa9f5('0x13'),_0x4cb5a5,'request\x20sent',JSON[_0xa9f5('0x14')](_0x4ebcf5));if(_0x4ebcf5[_0xa9f5('0x15')]){if(_0x4ebcf5[_0xa9f5('0x15')]['code']===0x1f4){logger[_0xa9f5('0x15')](_0xa9f5('0x10'),_0x4cb5a5,_0x4ebcf5['error']['message']);return _0x4bb362(_0x4ebcf5['error'][_0xa9f5('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x4cb5a5,_0x4ebcf5[_0xa9f5('0x15')][_0xa9f5('0x16')]);return _0x2ec4a7(_0x4ebcf5[_0xa9f5('0x15')][_0xa9f5('0x16')]);}else{logger['info'](_0xa9f5('0x10'),_0x4cb5a5,_0xa9f5('0x11'));_0x2ec4a7(_0x4ebcf5[_0xa9f5('0x17')][_0xa9f5('0x16')]);}})[_0xa9f5('0x18')](function(_0x1ee027){logger[_0xa9f5('0x15')](_0xa9f5('0x10'),_0x4cb5a5,_0x1ee027);_0x4bb362(_0x1ee027);});});}exports[_0xa9f5('0x19')]=function(_0x38bd22){var _0x31f97e=this;return new Promise(function(_0x27a7b0,_0x4e0c93){return db[_0xa9f5('0x1a')][_0xa9f5('0x1b')]({'raw':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')]['where']||null:null,'attributes':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x1e')]||null:null,'limit':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x1f')]||null:null,'include':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')]['include']?_[_0xa9f5('0x20')](_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x21')],function(_0x24c8eb){return{'model':db[_0x24c8eb[_0xa9f5('0x22')]],'as':_0x24c8eb['as'],'attributes':_0x24c8eb[_0xa9f5('0x1e')],'include':_0x24c8eb['include']?_[_0xa9f5('0x20')](_0x24c8eb['include'],function(_0x53caa4){return{'model':db[_0x53caa4['model']],'as':_0x53caa4['as'],'attributes':_0x53caa4[_0xa9f5('0x1e')],'include':_0x53caa4[_0xa9f5('0x21')]?_[_0xa9f5('0x20')](_0x53caa4[_0xa9f5('0x21')],function(_0x30fa9f){return{'model':db[_0x30fa9f[_0xa9f5('0x22')]],'as':_0x30fa9f['as'],'attributes':_0x30fa9f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9f5('0xf')](function(_0x43ba93){logger[_0xa9f5('0x23')](_0xa9f5('0x19'),_0x38bd22);logger[_0xa9f5('0x12')](_0xa9f5('0x19'),_0x38bd22,JSON[_0xa9f5('0x14')](_0x43ba93));_0x27a7b0(_0x43ba93);})[_0xa9f5('0x18')](function(_0x5a422b){logger['error']('GetMailAccount',_0x5a422b[_0xa9f5('0x16')],_0x38bd22);_0x4e0c93(_0x31f97e[_0xa9f5('0x15')](0x1f4,_0x5a422b[_0xa9f5('0x16')]));});});};exports[_0xa9f5('0x24')]=function(_0x33dd3a){var _0x45cd27=this;return new Promise(function(_0x43c3f3,_0x68c4fb){return db[_0xa9f5('0x1a')][_0xa9f5('0x25')]({'raw':_0x33dd3a[_0xa9f5('0x1c')]?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x33dd3a['options']?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x26')]||null:null,'attributes':_0x33dd3a[_0xa9f5('0x1c')]?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x1e')]||null:null,'include':_0x33dd3a[_0xa9f5('0x1c')]?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x21')]?_['map'](_0x33dd3a[_0xa9f5('0x1c')]['include'],function(_0x26e251){return{'model':db[_0x26e251[_0xa9f5('0x22')]],'as':_0x26e251['as'],'attributes':_0x26e251['attributes'],'include':_0x26e251[_0xa9f5('0x21')]?_[_0xa9f5('0x20')](_0x26e251[_0xa9f5('0x21')],function(_0x2cbd28){return{'model':db[_0x2cbd28['model']],'as':_0x2cbd28['as'],'attributes':_0x2cbd28[_0xa9f5('0x1e')],'include':_0x2cbd28[_0xa9f5('0x21')]?_['map'](_0x2cbd28[_0xa9f5('0x21')],function(_0x23232b){return{'model':db[_0x23232b[_0xa9f5('0x22')]],'as':_0x23232b['as'],'attributes':_0x23232b[_0xa9f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa9f5('0xf')](function(_0x41f6a4){if(_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x27')]===!![])_0x41f6a4[_0xa9f5('0x28')]('smtpOptions',_0x41f6a4['getSmtpOptions']());logger[_0xa9f5('0x23')](_0xa9f5('0x24'),_0x33dd3a);logger['debug'](_0xa9f5('0x24'),_0x33dd3a,JSON[_0xa9f5('0x14')](_0x41f6a4));_0x43c3f3(_0x41f6a4);})[_0xa9f5('0x18')](function(_0x371af3){logger['error'](_0xa9f5('0x24'),_0x371af3[_0xa9f5('0x16')],_0x33dd3a);_0x68c4fb(_0x45cd27['error'](0x1f4,_0x371af3[_0xa9f5('0x16')]));});});};exports[_0xa9f5('0x29')]=function(_0x5df1a6){var _0x10de90=this;return new Promise(function(_0x40b5fb,_0x4fd6f6){var _0x1a9915={'body':_0x5df1a6[_0xa9f5('0x2a')],'channel':'mail'};var _0x2ee2a2=_[_0xa9f5('0x2b')](_['keys'](db[_0xa9f5('0x2c')]['rawAttributes']),[_0xa9f5('0x2d'),_0xa9f5('0x2e'),'CompanyId',_0xa9f5('0x2f')]);var _0x488380=![];if(_0x5df1a6['body']['id']){delete _0x5df1a6[_0xa9f5('0x2a')]['id'];}if(_[_0xa9f5('0x30')](_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x31')])){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x32')));}if(_[_0xa9f5('0x30')](_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x2a')])||_0x5df1a6['body'][_0xa9f5('0x2a')]===''){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x33')));}if(_[_0xa9f5('0x30')](_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')])){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x35')+_0x2ee2a2));}if(!_[_0xa9f5('0x36')](_0x2ee2a2,_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')])){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x37')+_0x2ee2a2));}var _0xd95e3={};_0xd95e3[_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')]]=_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x31')];return db[_0xa9f5('0x1a')]['find']({'where':{'id':_0x5df1a6['account']['id']},'include':[{'model':db[_0xa9f5('0x38')],'as':_0xa9f5('0x39'),'include':[{'model':db['CmContact'],'as':_0xa9f5('0x3a'),'where':_0xd95e3,'limit':0x1,'order':[[_0xa9f5('0x2e'),_0xa9f5('0x3b')]]}]},{'model':db['MailApplication'],'as':_0xa9f5('0x3c')},{'model':db['MailServerOut'],'as':_0xa9f5('0x3d'),'include':[{'model':db[_0xa9f5('0x3e')],'as':_0xa9f5('0x3e')}]}]})[_0xa9f5('0xf')](function(_0x102ed8){if(_0x102ed8&&_0x102ed8[_0xa9f5('0x39')]){var _0x4e17a9=_0x102ed8[_0xa9f5('0x3f')]({'plain':!![]});_0x1a9915['account']=_['omit'](_0x4e17a9,[_0xa9f5('0x3c'),'List']);_0x1a9915[_0xa9f5('0x40')]['smtpOptions']=_0x102ed8[_0xa9f5('0x41')]();_0x1a9915[_0xa9f5('0x42')]=_0x4e17a9[_0xa9f5('0x3c')];_0x1a9915['list']=_0x4e17a9[_0xa9f5('0x39')];_0x1a9915[_0xa9f5('0x42')]=_[_0xa9f5('0x43')](_0x1a9915['applications'],[_0xa9f5('0x44')],['asc']);if(_0x1a9915['account']&&_0x1a9915[_0xa9f5('0x40')][_0xa9f5('0x45')]){_0x1a9915[_0xa9f5('0x42')][_0xa9f5('0x46')]({'id':0x0,'priority':_0x1a9915['applications'][_0xa9f5('0x47')]+0x1,'app':'close','appdata':_0xa9f5('0x45'),'interval':_0xa9f5('0x48')});}if(_0x1a9915[_0xa9f5('0x40')]['Applications']){delete _0x1a9915['account'][_0xa9f5('0x3c')];}if(_0x1a9915[_0xa9f5('0x40')]['List']){delete _0x1a9915[_0xa9f5('0x40')][_0xa9f5('0x39')];}if(_0x4e17a9[_0xa9f5('0x39')][_0xa9f5('0x3a')][_0xa9f5('0x47')]){return _0x4e17a9[_0xa9f5('0x39')][_0xa9f5('0x3a')][0x0];}var _0x1a1207=_['defaults'](_0x5df1a6['body'],{'firstName':_0x5df1a6['body'][_0xa9f5('0x31')],'ListId':_0x4e17a9['ListId']});_0x1a1207[_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')]]=_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x31')];return db[_0xa9f5('0x2c')][_0xa9f5('0x49')](_0x1a1207);}else{throw new Error('List\x20not\x20found');}})[_0xa9f5('0xf')](function(_0x1782c2){_0x1a9915[_0xa9f5('0x4a')]=_0x1782c2;if(_0x1782c2){if(!_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['messageId']){_0x5df1a6[_0xa9f5('0x2a')]['message']['messageId']=rs['generate']()+'\x20'+_0x5df1a6[_0xa9f5('0x2a')]['message'][_0xa9f5('0x31')];}var _0xd106c7={'ContactId':_0x1782c2['id'],'MailAccountId':_0x5df1a6[_0xa9f5('0x40')]['id'],'inReplyTo':_0x5df1a6['body']['message'][_0xa9f5('0x4b')],'to':_0x5df1a6['body'][_0xa9f5('0x16')][_0xa9f5('0x31')],'cc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['cc'],'subject':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x4c')],'attach':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['attach'],'lastMsgAt':moment()['format'](_0xa9f5('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa9f5('0x25')]({'where':{'closed':![],'MailAccountId':_0x5df1a6[_0xa9f5('0x40')]['id']},'include':[{'model':db['MailMessage'],'as':_0xa9f5('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x4f')]}}]})['then'](function(_0x32c65a){if(_0x32c65a){return[_0x32c65a,![]];}return db[_0xa9f5('0x50')][_0xa9f5('0x49')](_0xd106c7)['then'](function(_0x2eaa8c){return[_0x2eaa8c,!![]];});});}else{throw new Error(_0xa9f5('0x51'));}})[_0xa9f5('0x52')](function(_0x2bf5fb,_0x417ce5){if(_0x2bf5fb){_0x488380=_0x417ce5;if(!_0x417ce5){return _0x2bf5fb['update']({'inReplyTo':_0x5df1a6[_0xa9f5('0x2a')]['message'][_0xa9f5('0x4b')],'to':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x31')],'cc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['cc'],'subject':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x4c')],'attach':_0x2bf5fb[_0xa9f5('0x53')]?_0x2bf5fb[_0xa9f5('0x53')]:_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x53')],'substatus':null,'substatusAt':moment()[_0xa9f5('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xa9f5('0x54')](_0xa9f5('0x4d')),'lastMsgDirection':'in'});}else{return _0x2bf5fb;}}})[_0xa9f5('0xf')](function(_0xf228d9){_0x1a9915['interaction']=_0xf228d9[_0xa9f5('0x3f')]({'plain':!![]});_0x1a9915[_0xa9f5('0x55')][_0xa9f5('0x56')]=_0x488380;return db[_0xa9f5('0x57')]['create']({'body':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x2a')],'MailAccountId':_0x5df1a6['account']['id'],'MailInteractionId':_0xf228d9['id'],'direction':'in','ContactId':_0x1a9915[_0xa9f5('0x4a')]['id'],'messageId':_0x5df1a6[_0xa9f5('0x2a')]['message']['messageId'],'from':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x31')],'to':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['to'],'cc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['cc'],'subject':_0x5df1a6['body']['message'][_0xa9f5('0x4c')],'attach':_0x5df1a6['body'][_0xa9f5('0x16')]['attach'],'Attachments':_0x5df1a6['body'][_0xa9f5('0x16')][_0xa9f5('0x58')],'originTo':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['originTo'],'originCc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x59')],'bcc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x5a')],'ChatWebsiteId':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x5b')]||null,'originChannel':_0x5df1a6[_0xa9f5('0x2a')]['message']['originChannel']||_0xa9f5('0x5c'),'ChatOfflineMessageId':_0x5df1a6[_0xa9f5('0x2a')]['message'][_0xa9f5('0x5d')]||null},{'include':[{'model':db[_0xa9f5('0x5e')],'as':_0xa9f5('0x5f')}]});})[_0xa9f5('0xf')](function(_0x358809){_0x1a9915[_0xa9f5('0x16')]=_0x358809;if(!_0x1a9915[_0xa9f5('0x55')][_0xa9f5('0x60')]){return;}return db[_0xa9f5('0x61')][_0xa9f5('0x25')]({'attributes':['id','name'],'where':{'id':_0x1a9915['interaction'][_0xa9f5('0x60')]}});})[_0xa9f5('0xf')](function(_0x5a8788){if(_0x5a8788){_0x1a9915['applications'][_0xa9f5('0x62')]({'id':0x0,'priority':0x0,'app':_0xa9f5('0x63'),'appdata':_0x5a8788[_0xa9f5('0x64')]+','+(_0x1a9915['account'][_0xa9f5('0x65')]||0xa),'interval':_0xa9f5('0x48')});}if(!_0x1a9915[_0xa9f5('0x55')]['queueId']){return;}return db[_0xa9f5('0x66')][_0xa9f5('0x25')]({'attributes':['id','name'],'where':{'id':_0x1a9915['interaction'][_0xa9f5('0x67')]}});})['then'](function(_0x3e9f14){if(_0x3e9f14){_0x1a9915[_0xa9f5('0x42')][_0xa9f5('0x62')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3e9f14[_0xa9f5('0x64')]+','+(_0x1a9915['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xa9f5('0x48')});}return respondWithRpcPromise(_0xa9f5('0x68'),_0xa9f5('0x69'),_0x1a9915);})[_0xa9f5('0xf')](function(_0x4e874b){_0x40b5fb(_0x4e874b);})[_0xa9f5('0x18')](function(_0x1bdb4a){_0x4fd6f6(_0x10de90['error'](0x1f4,_0x1bdb4a[_0xa9f5('0x16')]));});});}; \ No newline at end of file +var _0xbd51=['message','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','model','map','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','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','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','get','omit','account','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','defaults','from','create','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','Contact\x20not\x20found','update','subject','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3853d8,_0xc8989b){_0x3853d8=_0x3853d8-0x0;var _0x741d76=_0xbd51[_0x3853d8];return _0x741d76;};'use strict';var _=require(_0x1bd5('0x0'));var moment=require('moment');var BPromise=require(_0x1bd5('0x1'));var rs=require(_0x1bd5('0x2'));var Redis=require(_0x1bd5('0x3'));var db=require(_0x1bd5('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232c});config[_0x1bd5('0x7')]=_['defaults'](config[_0x1bd5('0x7')],{'host':_0x1bd5('0x8'),'port':0x18eb});var socket=require(_0x1bd5('0x9'))(new Redis(config[_0x1bd5('0x7')]));require(_0x1bd5('0xa'))['register'](socket);function respondWithRpcPromise(_0x36ef1a,_0x5c8e0d,_0x2bd975){return new BPromise(function(_0x28df8e,_0x3b868a){return client[_0x1bd5('0xb')](_0x36ef1a,_0x2bd975)[_0x1bd5('0xc')](function(_0x3e3d06){logger['info'](_0x1bd5('0xd'),_0x5c8e0d,'request\x20sent');logger[_0x1bd5('0xe')](_0x1bd5('0xf'),_0x5c8e0d,_0x1bd5('0x10'),JSON[_0x1bd5('0x11')](_0x3e3d06));if(_0x3e3d06[_0x1bd5('0x12')]){if(_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x13')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x5c8e0d,_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);return _0x3b868a(_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5c8e0d,_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);return _0x28df8e(_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);}else{logger[_0x1bd5('0x15')](_0x1bd5('0xd'),_0x5c8e0d,_0x1bd5('0x10'));_0x28df8e(_0x3e3d06[_0x1bd5('0x16')][_0x1bd5('0x14')]);}})['catch'](function(_0x53ad5e){logger[_0x1bd5('0x12')](_0x1bd5('0xd'),_0x5c8e0d,_0x53ad5e);_0x3b868a(_0x53ad5e);});});}exports[_0x1bd5('0x17')]=function(_0xb95d4e){var _0x459649=this;return new Promise(function(_0x2ff39a,_0x3fbb39){return db[_0x1bd5('0x18')][_0x1bd5('0x19')]({'raw':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1b')]===undefined?!![]:![]:!![],'where':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1c')]||null:null,'attributes':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1d')]||null:null,'limit':_0xb95d4e['options']?_0xb95d4e[_0x1bd5('0x1a')]['limit']||null:null,'include':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1e')]?_['map'](_0xb95d4e[_0x1bd5('0x1a')]['include'],function(_0x2ed551){return{'model':db[_0x2ed551[_0x1bd5('0x1f')]],'as':_0x2ed551['as'],'attributes':_0x2ed551[_0x1bd5('0x1d')],'include':_0x2ed551[_0x1bd5('0x1e')]?_['map'](_0x2ed551[_0x1bd5('0x1e')],function(_0x69bb17){return{'model':db[_0x69bb17[_0x1bd5('0x1f')]],'as':_0x69bb17['as'],'attributes':_0x69bb17[_0x1bd5('0x1d')],'include':_0x69bb17['include']?_[_0x1bd5('0x20')](_0x69bb17[_0x1bd5('0x1e')],function(_0x3595e9){return{'model':db[_0x3595e9[_0x1bd5('0x1f')]],'as':_0x3595e9['as'],'attributes':_0x3595e9[_0x1bd5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bd5('0xc')](function(_0x4e72b2){logger[_0x1bd5('0x15')](_0x1bd5('0x17'),_0xb95d4e);logger[_0x1bd5('0xe')]('GetMailAccount',_0xb95d4e,JSON[_0x1bd5('0x11')](_0x4e72b2));_0x2ff39a(_0x4e72b2);})[_0x1bd5('0x21')](function(_0x345181){logger[_0x1bd5('0x12')](_0x1bd5('0x17'),_0x345181[_0x1bd5('0x14')],_0xb95d4e);_0x3fbb39(_0x459649['error'](0x1f4,_0x345181['message']));});});};exports[_0x1bd5('0x22')]=function(_0x305126){var _0x5542aa=this;return new Promise(function(_0x36649d,_0x198b88){return db[_0x1bd5('0x18')][_0x1bd5('0x23')]({'raw':_0x305126['options']?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1b')]===undefined?!![]:![]:!![],'where':_0x305126[_0x1bd5('0x1a')]?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1c')]||null:null,'attributes':_0x305126[_0x1bd5('0x1a')]?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1d')]||null:null,'include':_0x305126['options']?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1e')]?_[_0x1bd5('0x20')](_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1e')],function(_0x18a9db){return{'model':db[_0x18a9db[_0x1bd5('0x1f')]],'as':_0x18a9db['as'],'attributes':_0x18a9db['attributes'],'include':_0x18a9db[_0x1bd5('0x1e')]?_[_0x1bd5('0x20')](_0x18a9db[_0x1bd5('0x1e')],function(_0x2f5a48){return{'model':db[_0x2f5a48[_0x1bd5('0x1f')]],'as':_0x2f5a48['as'],'attributes':_0x2f5a48[_0x1bd5('0x1d')],'include':_0x2f5a48[_0x1bd5('0x1e')]?_['map'](_0x2f5a48['include'],function(_0x155e4c){return{'model':db[_0x155e4c[_0x1bd5('0x1f')]],'as':_0x155e4c['as'],'attributes':_0x155e4c[_0x1bd5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4595a0){if(_0x305126['options'][_0x1bd5('0x24')]===!![])_0x4595a0[_0x1bd5('0x25')](_0x1bd5('0x26'),_0x4595a0[_0x1bd5('0x27')]());logger[_0x1bd5('0x15')](_0x1bd5('0x22'),_0x305126);logger[_0x1bd5('0xe')](_0x1bd5('0x22'),_0x305126,JSON['stringify'](_0x4595a0));_0x36649d(_0x4595a0);})[_0x1bd5('0x21')](function(_0x2978d8){logger['error'](_0x1bd5('0x22'),_0x2978d8[_0x1bd5('0x14')],_0x305126);_0x198b88(_0x5542aa[_0x1bd5('0x12')](0x1f4,_0x2978d8['message']));});});};exports[_0x1bd5('0x28')]=function(_0x53482){var _0x2997a2=this;return new Promise(function(_0x4074f1,_0x4e8ff7){var _0x305720={'body':_0x53482[_0x1bd5('0x29')],'channel':_0x1bd5('0x2a')};var _0x11e996=_['difference'](_['keys'](db[_0x1bd5('0x2b')][_0x1bd5('0x2c')]),[_0x1bd5('0x2d'),'updatedAt',_0x1bd5('0x2e'),_0x1bd5('0x2f')]);var _0x574d95=![];if(_0x53482[_0x1bd5('0x29')]['id']){delete _0x53482['body']['id'];}if(_[_0x1bd5('0x30')](_0x53482[_0x1bd5('0x29')]['from'])){return _0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x1bd5('0x31')));}if(_[_0x1bd5('0x30')](_0x53482[_0x1bd5('0x29')][_0x1bd5('0x29')])||_0x53482[_0x1bd5('0x29')][_0x1bd5('0x29')]===''){return _0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x1bd5('0x32')));}if(_[_0x1bd5('0x30')](_0x53482[_0x1bd5('0x29')][_0x1bd5('0x33')])){return _0x4e8ff7(_0x2997a2['error'](0x1f4,_0x1bd5('0x34')+_0x11e996));}if(!_[_0x1bd5('0x35')](_0x11e996,_0x53482[_0x1bd5('0x29')]['mapKey'])){return _0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x1bd5('0x36')+_0x11e996));}var _0x5bb8a6={};_0x5bb8a6[_0x53482[_0x1bd5('0x29')]['mapKey']]=_0x53482[_0x1bd5('0x29')]['from'];return db[_0x1bd5('0x18')][_0x1bd5('0x23')]({'where':{'id':_0x53482['account']['id']},'include':[{'model':db[_0x1bd5('0x37')],'as':'List','include':[{'model':db[_0x1bd5('0x2b')],'as':_0x1bd5('0x38'),'where':_0x5bb8a6,'limit':0x1,'order':[[_0x1bd5('0x39'),_0x1bd5('0x3a')]]}]},{'model':db[_0x1bd5('0x3b')],'as':_0x1bd5('0x3c')},{'model':db[_0x1bd5('0x3d')],'as':_0x1bd5('0x3e'),'include':[{'model':db['CloudProvider'],'as':_0x1bd5('0x3f')}]}]})[_0x1bd5('0xc')](function(_0x2a1ece){if(_0x2a1ece&&_0x2a1ece[_0x1bd5('0x40')]){var _0x34452a=_0x2a1ece[_0x1bd5('0x41')]({'plain':!![]});_0x305720['account']=_[_0x1bd5('0x42')](_0x34452a,[_0x1bd5('0x3c'),_0x1bd5('0x40')]);_0x305720[_0x1bd5('0x43')][_0x1bd5('0x26')]=_0x2a1ece[_0x1bd5('0x27')]();_0x305720[_0x1bd5('0x44')]=_0x34452a['Applications'];_0x305720['list']=_0x34452a[_0x1bd5('0x40')];_0x305720[_0x1bd5('0x44')]=_[_0x1bd5('0x45')](_0x305720['applications'],[_0x1bd5('0x46')],[_0x1bd5('0x47')]);if(_0x305720[_0x1bd5('0x43')]&&_0x305720[_0x1bd5('0x43')][_0x1bd5('0x48')]){_0x305720[_0x1bd5('0x44')][_0x1bd5('0x49')]({'id':0x0,'priority':_0x305720['applications'][_0x1bd5('0x4a')]+0x1,'app':_0x1bd5('0x4b'),'appdata':'autoclose','interval':_0x1bd5('0x4c')});}if(_0x305720['account'][_0x1bd5('0x3c')]){delete _0x305720['account'][_0x1bd5('0x3c')];}if(_0x305720[_0x1bd5('0x43')]['List']){delete _0x305720[_0x1bd5('0x43')][_0x1bd5('0x40')];}if(_0x34452a[_0x1bd5('0x40')][_0x1bd5('0x38')][_0x1bd5('0x4a')]){return _0x34452a[_0x1bd5('0x40')][_0x1bd5('0x38')][0x0];}var _0x51aebe=_[_0x1bd5('0x4d')](_0x53482['body'],{'firstName':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x4e')],'ListId':_0x34452a[_0x1bd5('0x2f')]});_0x51aebe[_0x53482['body']['mapKey']]=_0x53482[_0x1bd5('0x29')][_0x1bd5('0x4e')];return db[_0x1bd5('0x2b')][_0x1bd5('0x4f')](_0x51aebe);}else{throw new Error(_0x1bd5('0x50'));}})[_0x1bd5('0xc')](function(_0x46e36c){_0x305720[_0x1bd5('0x51')]=_0x46e36c;if(_0x46e36c){if(!_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['messageId']){_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x52')]=rs[_0x1bd5('0x53')]()+'\x20'+_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x4e')];}var _0x17b3a9={'ContactId':_0x46e36c['id'],'MailAccountId':_0x53482[_0x1bd5('0x43')]['id'],'inReplyTo':_0x53482['body'][_0x1bd5('0x14')][_0x1bd5('0x52')],'to':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['from'],'cc':_0x53482['body'][_0x1bd5('0x14')]['cc'],'subject':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['subject'],'attach':_0x53482['body'][_0x1bd5('0x14')]['attach'],'lastMsgAt':moment()[_0x1bd5('0x54')](_0x1bd5('0x55')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x1bd5('0x23')]({'where':{'closed':![],'MailAccountId':_0x53482['account']['id']},'include':[{'model':db[_0x1bd5('0x56')],'as':'Messages','attributes':[_0x1bd5('0x52')],'where':{'messageId':_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x57')]}}]})[_0x1bd5('0xc')](function(_0x47ca3f){if(_0x47ca3f){return[_0x47ca3f,![]];}return db['MailInteraction'][_0x1bd5('0x4f')](_0x17b3a9)[_0x1bd5('0xc')](function(_0x1a9ad2){return[_0x1a9ad2,!![]];});});}else{throw new Error(_0x1bd5('0x58'));}})['spread'](function(_0x551f22,_0x14dd41){if(_0x551f22){_0x574d95=_0x14dd41;if(!_0x14dd41){return _0x551f22[_0x1bd5('0x59')]({'inReplyTo':_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x52')],'to':_0x53482[_0x1bd5('0x29')]['message']['from'],'cc':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['cc'],'subject':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x5a')],'attach':_0x551f22['attach']?_0x551f22[_0x1bd5('0x5b')]:_0x53482['body'][_0x1bd5('0x14')][_0x1bd5('0x5b')],'substatus':null,'substatusAt':moment()[_0x1bd5('0x54')](_0x1bd5('0x55')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x551f22;}}})[_0x1bd5('0xc')](function(_0x36d62e){_0x305720[_0x1bd5('0x5c')]=_0x36d62e[_0x1bd5('0x41')]({'plain':!![]});_0x305720[_0x1bd5('0x5c')][_0x1bd5('0x5d')]=_0x574d95;return db[_0x1bd5('0x56')][_0x1bd5('0x4f')]({'body':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x29')],'MailAccountId':_0x53482[_0x1bd5('0x43')]['id'],'MailInteractionId':_0x36d62e['id'],'direction':'in','ContactId':_0x305720[_0x1bd5('0x51')]['id'],'messageId':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x52')],'from':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x4e')],'to':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['to'],'cc':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['cc'],'subject':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['subject'],'attach':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x5b')],'Attachments':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x5e')],'originTo':_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x5f')],'originCc':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x60')],'bcc':_0x53482['body'][_0x1bd5('0x14')][_0x1bd5('0x61')],'ChatWebsiteId':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x62')]||null,'originChannel':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['originChannel']||_0x1bd5('0x63'),'ChatOfflineMessageId':_0x53482['body']['message'][_0x1bd5('0x64')]||null},{'include':[{'model':db['Attachment'],'as':_0x1bd5('0x65')}]});})[_0x1bd5('0xc')](function(_0x560f20){_0x305720[_0x1bd5('0x14')]=_0x560f20;if(!_0x305720[_0x1bd5('0x5c')][_0x1bd5('0x66')]){return;}return db[_0x1bd5('0x67')][_0x1bd5('0x23')]({'attributes':['id',_0x1bd5('0x68')],'where':{'id':_0x305720['interaction'][_0x1bd5('0x66')]}});})[_0x1bd5('0xc')](function(_0xdd5183){if(_0xdd5183){_0x305720[_0x1bd5('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xdd5183[_0x1bd5('0x68')]+','+(_0x305720[_0x1bd5('0x43')][_0x1bd5('0x69')]||0xa),'interval':_0x1bd5('0x4c')});}if(!_0x305720['interaction'][_0x1bd5('0x6a')]){return;}return db['MailQueue']['find']({'attributes':['id',_0x1bd5('0x68')],'where':{'id':_0x305720['interaction'][_0x1bd5('0x6a')]}});})[_0x1bd5('0xc')](function(_0x231556){if(_0x231556){_0x305720[_0x1bd5('0x44')][_0x1bd5('0x6b')]({'id':0x0,'priority':0x1,'app':_0x1bd5('0x6c'),'appdata':_0x231556[_0x1bd5('0x68')]+','+(_0x305720[_0x1bd5('0x43')][_0x1bd5('0x6d')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1bd5('0x6e'),'startRouting',_0x305720);})['then'](function(_0x59b491){_0x4074f1(_0x59b491);})[_0x1bd5('0x21')](function(_0x524b86){_0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x524b86[_0x1bd5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 132c6e7..4734953 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 _0x3b48=['mailAccount:','./mailAccount.events','save','remove','update','removeListener','register','length'];(function(_0x36c97f,_0x445d22){var _0x42f8ce=function(_0x1e6a9d){while(--_0x1e6a9d){_0x36c97f['push'](_0x36c97f['shift']());}};_0x42f8ce(++_0x445d22);}(_0x3b48,0x1b1));var _0x83b4=function(_0x23af15,_0x4eec90){_0x23af15=_0x23af15-0x0;var _0x2fd2f4=_0x3b48[_0x23af15];return _0x2fd2f4;};'use strict';var MailAccountEvents=require(_0x83b4('0x0'));var events=[_0x83b4('0x1'),_0x83b4('0x2'),_0x83b4('0x3')];function createListener(_0x4e3adc,_0xfb81de){return function(_0x31a982){_0xfb81de['emit'](_0x4e3adc,_0x31a982);};}function removeListener(_0x516c2a,_0x48a0f8){return function(){MailAccountEvents[_0x83b4('0x4')](_0x516c2a,_0x48a0f8);};}exports[_0x83b4('0x5')]=function(_0x242695){for(var _0xd5b8ed=0x0,_0x1e9cc6=events[_0x83b4('0x6')];_0xd5b8ed<_0x1e9cc6;_0xd5b8ed++){var _0x11e7d6=events[_0xd5b8ed];var _0x29592d=createListener(_0x83b4('0x7')+_0x11e7d6,_0x242695);MailAccountEvents['on'](_0x11e7d6,_0x29592d);}}; \ No newline at end of file +var _0x3144=['emit','register','./mailAccount.events','remove','update'];(function(_0x43f2e1,_0xc8f6c){var _0x1d9f95=function(_0x5102e7){while(--_0x5102e7){_0x43f2e1['push'](_0x43f2e1['shift']());}};_0x1d9f95(++_0xc8f6c);}(_0x3144,0x1dd));var _0x4314=function(_0x1cdfe5,_0x94c864){_0x1cdfe5=_0x1cdfe5-0x0;var _0x35fe65=_0x3144[_0x1cdfe5];return _0x35fe65;};'use strict';var MailAccountEvents=require(_0x4314('0x0'));var events=['save',_0x4314('0x1'),_0x4314('0x2')];function createListener(_0x12a130,_0x558dd7){return function(_0x4b9217){_0x558dd7[_0x4314('0x3')](_0x12a130,_0x4b9217);};}function removeListener(_0xeed926,_0x3da15a){return function(){MailAccountEvents['removeListener'](_0xeed926,_0x3da15a);};}exports[_0x4314('0x4')]=function(_0x3157b9){for(var _0x4d36ea=0x0,_0x2b5856=events['length'];_0x4d36ea<_0x2b5856;_0x4d36ea++){var _0x23e09f=events[_0x4d36ea];var _0xb0ef3d=createListener('mailAccount:'+_0x23e09f,_0x3157b9);MailAccountEvents['on'](_0x23e09f,_0xb0ef3d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index db0e444..b2a97f6 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 _0xa8e9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','path','express','fs-extra'];(function(_0x220a43,_0x4e7a87){var _0x231f61=function(_0xa4a968){while(--_0xa4a968){_0x220a43['push'](_0x220a43['shift']());}};_0x231f61(++_0x4e7a87);}(_0xa8e9,0x93));var _0x9a8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa8e9[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a8e('0x0'));var timeout=require('connect-timeout');var express=require(_0x9a8e('0x1'));var router=express['Router']();var fs_extra=require(_0x9a8e('0x2'));var auth=require(_0x9a8e('0x3'));var interaction=require(_0x9a8e('0x4'));var config=require(_0x9a8e('0x5'));var controller=require(_0x9a8e('0x6'));router[_0x9a8e('0x7')](_0x9a8e('0x8'),auth[_0x9a8e('0x9')](),controller[_0x9a8e('0xa')]);router[_0x9a8e('0xb')](_0x9a8e('0x8'),auth[_0x9a8e('0x9')](),controller[_0x9a8e('0xc')]);router[_0x9a8e('0xd')](_0x9a8e('0x8'),auth[_0x9a8e('0x9')](),controller[_0x9a8e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x379b=['put','update','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','/:id','show'];(function(_0x4e76b0,_0x3168de){var _0x5d5358=function(_0x57db2a){while(--_0x57db2a){_0x4e76b0['push'](_0x4e76b0['shift']());}};_0x5d5358(++_0x3168de);}(_0x379b,0x1f4));var _0xb379=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x379b[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0xb379('0x0'));var util=require(_0xb379('0x1'));var path=require(_0xb379('0x2'));var timeout=require(_0xb379('0x3'));var express=require(_0xb379('0x4'));var router=express['Router']();var fs_extra=require(_0xb379('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb379('0x6'));var controller=require('./mailApplication.controller');router[_0xb379('0x7')](_0xb379('0x8'),auth['isAuthenticated'](),controller[_0xb379('0x9')]);router[_0xb379('0xa')](_0xb379('0x8'),auth['isAuthenticated'](),controller[_0xb379('0xb')]);router['delete'](_0xb379('0x8'),auth[_0xb379('0xc')](),controller[_0xb379('0xd')]);module[_0xb379('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 78ef62a..1c8fedd 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 _0xb944=['exports','STRING','sequelize'];(function(_0x1fd3d4,_0xc6bbde){var _0x70047=function(_0x4f7920){while(--_0x4f7920){_0x1fd3d4['push'](_0x1fd3d4['shift']());}};_0x70047(++_0xc6bbde);}(_0xb944,0x68));var _0x4b94=function(_0x3e7d64,_0x53d71b){_0x3e7d64=_0x3e7d64-0x0;var _0x137f44=_0xb944[_0x3e7d64];return _0x137f44;};'use strict';var Sequelize=require(_0x4b94('0x0'));module[_0x4b94('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4b94('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4b94('0x2')]},'interval':{'type':Sequelize[_0x4b94('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3099=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2ec0a0,_0x5165a6){var _0x5a112c=function(_0xdbadc4){while(--_0xdbadc4){_0x2ec0a0['push'](_0x2ec0a0['shift']());}};_0x5a112c(++_0x5165a6);}(_0x3099,0x1d6));var _0x9309=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3099[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x9309('0x0'));module[_0x9309('0x1')]={'priority':{'type':Sequelize[_0x9309('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9309('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9309('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9309('0x3')],'defaultValue':_0x9309('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5959b03..f842dbe 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x354d14,_0x45b04a){var _0x136988=function(_0x4c4c21){while(--_0x4c4c21){_0x354d14['push'](_0x354d14['shift']());}};_0x136988(++_0x45b04a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xcb91[_0x27beea];return _0x122645;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x12f69e,_0x3d68ab){var _0x1f106c=function(_0x2905be){while(--_0x2905be){_0x12f69e['push'](_0x12f69e['shift']());}};_0x1f106c(++_0x3d68ab);}(_0xac4a,0x13f));var _0xaac4=function(_0x3e7591,_0x7c5097){_0x3e7591=_0x3e7591-0x0;var _0x529524=_0xac4a[_0x3e7591];return _0x529524;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 50fa984..aaf14b2 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 _0xd825=['lodash','util','api','path','rimraf','../../config/environment','./mailApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x31953c,_0x3a8ab2){var _0x1b5b88=function(_0x517771){while(--_0x517771){_0x31953c['push'](_0x31953c['shift']());}};_0x1b5b88(++_0x3a8ab2);}(_0xd825,0xb4));var _0x5d82=function(_0x4f4a8d,_0x35fa8b){_0x4f4a8d=_0x4f4a8d-0x0;var _0x5ce49c=_0xd825[_0x4f4a8d];return _0x5ce49c;};'use strict';var _=require(_0x5d82('0x0'));var util=require(_0x5d82('0x1'));var logger=require('../../config/logger')(_0x5d82('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d82('0x3'));var rimraf=require(_0x5d82('0x4'));var config=require(_0x5d82('0x5'));var attributes=require(_0x5d82('0x6'));module[_0x5d82('0x7')]=function(_0x1fdd51,_0x4a39cc){return _0x1fdd51['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d82('0x8'),'collate':_0x5d82('0x9')});}; \ No newline at end of file +var _0x1a96=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2451ba,_0x37308b){var _0xb8e2dd=function(_0x21a4da){while(--_0x21a4da){_0x2451ba['push'](_0x2451ba['shift']());}};_0xb8e2dd(++_0x37308b);}(_0x1a96,0xe6));var _0x61a9=function(_0x4c99fd,_0x4f57ba){_0x4c99fd=_0x4c99fd-0x0;var _0x5c33b8=_0x1a96[_0x4c99fd];return _0x5c33b8;};'use strict';var _=require(_0x61a9('0x0'));var util=require(_0x61a9('0x1'));var logger=require(_0x61a9('0x2'))('api');var moment=require(_0x61a9('0x3'));var BPromise=require(_0x61a9('0x4'));var rp=require(_0x61a9('0x5'));var fs=require('fs');var path=require(_0x61a9('0x6'));var rimraf=require(_0x61a9('0x7'));var config=require(_0x61a9('0x8'));var attributes=require(_0x61a9('0x9'));module[_0x61a9('0xa')]=function(_0x452595,_0x3d7aa1){return _0x452595[_0x61a9('0xb')](_0x61a9('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61a9('0xd'),'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 7c0c12a..1f5b134 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 _0x0111=['error','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','limit','then','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0x0111,0x1ce));var _0x1011=function(_0x2a2137,_0x280212){_0x2a2137=_0x2a2137-0x0;var _0x466f22=_0x0111[_0x2a2137];return _0x466f22;};'use strict';var _=require('lodash');var util=require(_0x1011('0x0'));var moment=require(_0x1011('0x1'));var BPromise=require(_0x1011('0x2'));var rs=require(_0x1011('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1011('0x4'))['db'];var utils=require(_0x1011('0x5'));var logger=require('../../config/logger')(_0x1011('0x6'));var config=require('../../config/environment');var jayson=require(_0x1011('0x7'));var client=jayson[_0x1011('0x8')][_0x1011('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e0cc1,_0x4d6487,_0x44e1b1){return new BPromise(function(_0x47bb6a,_0x431fc3){return client['request'](_0x4e0cc1,_0x44e1b1)['then'](function(_0x23681b){logger['info'](_0x1011('0xa'),_0x4d6487,_0x1011('0xb'));logger['debug'](_0x1011('0xc'),_0x4d6487,_0x1011('0xb'),JSON[_0x1011('0xd')](_0x23681b));if(_0x23681b[_0x1011('0xe')]){if(_0x23681b[_0x1011('0xe')]['code']===0x1f4){logger[_0x1011('0xe')]('MailApplication,\x20%s,\x20%s',_0x4d6487,_0x23681b[_0x1011('0xe')]['message']);return _0x431fc3(_0x23681b['error'][_0x1011('0xf')]);}logger[_0x1011('0xe')](_0x1011('0xa'),_0x4d6487,_0x23681b[_0x1011('0xe')]['message']);return _0x47bb6a(_0x23681b[_0x1011('0xe')][_0x1011('0xf')]);}else{logger[_0x1011('0x10')](_0x1011('0xa'),_0x4d6487,'request\x20sent');_0x47bb6a(_0x23681b[_0x1011('0x11')]['message']);}})[_0x1011('0x12')](function(_0x568d98){logger['error'](_0x1011('0xa'),_0x4d6487,_0x568d98);_0x431fc3(_0x568d98);});});}exports[_0x1011('0x13')]=function(_0x53c81a){var _0x276c0e=this;return new Promise(function(_0x21bb4e,_0x3db612){return db[_0x1011('0x14')]['update'](_0x53c81a[_0x1011('0x15')],{'raw':_0x53c81a[_0x1011('0x16')]?_0x53c81a[_0x1011('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53c81a['options']?_0x53c81a['options'][_0x1011('0x17')]||null:null,'attributes':_0x53c81a[_0x1011('0x16')]?_0x53c81a[_0x1011('0x16')][_0x1011('0x18')]||null:null,'limit':_0x53c81a[_0x1011('0x16')]?_0x53c81a[_0x1011('0x16')][_0x1011('0x19')]||null:null})[_0x1011('0x1a')](function(_0x1e9b06){logger[_0x1011('0x10')](_0x1011('0x13'),_0x53c81a);logger[_0x1011('0x1b')](_0x1011('0x13'),_0x53c81a,JSON[_0x1011('0xd')](_0x1e9b06));_0x21bb4e(_0x1e9b06);})[_0x1011('0x12')](function(_0x6bc253){logger['error']('UpdateMailApplication',_0x6bc253[_0x1011('0xf')],_0x53c81a);_0x3db612(_0x276c0e['error'](0x1f4,_0x6bc253['message']));});});}; \ No newline at end of file +var _0xcc81=['UpdateMailApplication','MailApplication','body','options','where','attributes','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0xcc81,0x19c));var _0x1cc8=function(_0x22487b,_0x3a9021){_0x22487b=_0x22487b-0x0;var _0x2949ef=_0xcc81[_0x22487b];return _0x2949ef;};'use strict';var _=require(_0x1cc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1cc8('0x1'));var rs=require(_0x1cc8('0x2'));var fs=require('fs');var Redis=require(_0x1cc8('0x3'));var db=require(_0x1cc8('0x4'))['db'];var utils=require(_0x1cc8('0x5'));var logger=require(_0x1cc8('0x6'))('rpc');var config=require(_0x1cc8('0x7'));var jayson=require(_0x1cc8('0x8'));var client=jayson['client'][_0x1cc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29e813,_0x452253,_0x3c131a){return new BPromise(function(_0x59db9f,_0x2d1d17){return client[_0x1cc8('0xa')](_0x29e813,_0x3c131a)[_0x1cc8('0xb')](function(_0x15fafc){logger['info'](_0x1cc8('0xc'),_0x452253,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x452253,_0x1cc8('0xd'),JSON[_0x1cc8('0xe')](_0x15fafc));if(_0x15fafc['error']){if(_0x15fafc[_0x1cc8('0xf')]['code']===0x1f4){logger[_0x1cc8('0xf')]('MailApplication,\x20%s,\x20%s',_0x452253,_0x15fafc['error']['message']);return _0x2d1d17(_0x15fafc[_0x1cc8('0xf')]['message']);}logger[_0x1cc8('0xf')](_0x1cc8('0xc'),_0x452253,_0x15fafc['error'][_0x1cc8('0x10')]);return _0x59db9f(_0x15fafc[_0x1cc8('0xf')][_0x1cc8('0x10')]);}else{logger[_0x1cc8('0x11')]('MailApplication,\x20%s,\x20%s',_0x452253,_0x1cc8('0xd'));_0x59db9f(_0x15fafc[_0x1cc8('0x12')][_0x1cc8('0x10')]);}})[_0x1cc8('0x13')](function(_0x6bd235){logger[_0x1cc8('0xf')]('MailApplication,\x20%s,\x20%s',_0x452253,_0x6bd235);_0x2d1d17(_0x6bd235);});});}exports[_0x1cc8('0x14')]=function(_0x229af8){var _0x5c28dd=this;return new Promise(function(_0x2fcda9,_0xe700f7){return db[_0x1cc8('0x15')]['update'](_0x229af8[_0x1cc8('0x16')],{'raw':_0x229af8[_0x1cc8('0x17')]?_0x229af8[_0x1cc8('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x229af8['options']?_0x229af8[_0x1cc8('0x17')][_0x1cc8('0x18')]||null:null,'attributes':_0x229af8[_0x1cc8('0x17')]?_0x229af8['options'][_0x1cc8('0x19')]||null:null,'limit':_0x229af8['options']?_0x229af8['options']['limit']||null:null})[_0x1cc8('0xb')](function(_0x3bf0c3){logger[_0x1cc8('0x11')](_0x1cc8('0x14'),_0x229af8);logger[_0x1cc8('0x1a')](_0x1cc8('0x14'),_0x229af8,JSON[_0x1cc8('0xe')](_0x3bf0c3));_0x2fcda9(_0x3bf0c3);})[_0x1cc8('0x13')](function(_0x40409e){logger[_0x1cc8('0xf')]('UpdateMailApplication',_0x40409e[_0x1cc8('0x10')],_0x229af8);_0xe700f7(_0x5c28dd[_0x1cc8('0xf')](0x1f4,_0x40409e[_0x1cc8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 601b0f6..2ba81d6 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 _0x534d=['exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags'];(function(_0x11fd81,_0x1cf891){var _0x47d215=function(_0xe9dd8d){while(--_0xe9dd8d){_0x11fd81['push'](_0x11fd81['shift']());}};_0x47d215(++_0x1cf891);}(_0x534d,0x79));var _0xd534=function(_0x5968f1,_0x1b6a59){_0x5968f1=_0x5968f1-0x0;var _0x180ec6=_0x534d[_0x5968f1];return _0x180ec6;};'use strict';var express=require(_0xd534('0x0'));var router=express[_0xd534('0x1')]();var auth=require(_0xd534('0x2'));var interaction=require(_0xd534('0x3'));var controller=require(_0xd534('0x4'));router[_0xd534('0x5')]('/',auth[_0xd534('0x6')](),controller[_0xd534('0x7')]);router[_0xd534('0x5')](_0xd534('0x8'),auth[_0xd534('0x6')](),controller[_0xd534('0x9')]);router[_0xd534('0x5')](_0xd534('0xa'),auth[_0xd534('0x6')](),controller[_0xd534('0xb')]);router[_0xd534('0x5')](_0xd534('0xc'),auth[_0xd534('0x6')](),controller['getMessages']);router[_0xd534('0x5')](_0xd534('0xd'),auth[_0xd534('0x6')](),controller[_0xd534('0xe')]);router[_0xd534('0xf')]('/',auth['isAuthenticated'](),controller[_0xd534('0x10')]);router[_0xd534('0xf')](_0xd534('0xc'),auth[_0xd534('0x6')](),controller[_0xd534('0x11')]);router[_0xd534('0xf')](_0xd534('0x12'),auth[_0xd534('0x6')](),interaction['tracked']('mail',_0xd534('0x13')),controller[_0xd534('0x14')]);router[_0xd534('0x15')](_0xd534('0xa'),auth[_0xd534('0x6')](),interaction[_0xd534('0x16')](_0xd534('0x17'),_0xd534('0x18')),controller[_0xd534('0x19')]);router[_0xd534('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xd534('0x16')](_0xd534('0x17'),_0xd534('0x1b')),controller['destroy']);router['delete'](_0xd534('0x12'),auth[_0xd534('0x6')](),controller[_0xd534('0x1c')]);module[_0xd534('0x1d')]=router; \ No newline at end of file +var _0x61f8=['tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','/:id/tags'];(function(_0x14c68e,_0x47061d){var _0x87a0b9=function(_0x316570){while(--_0x316570){_0x14c68e['push'](_0x14c68e['shift']());}};_0x87a0b9(++_0x47061d);}(_0x61f8,0xa7));var _0x861f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x61f8[_0x46698a];return _0x356db0;};'use strict';var express=require(_0x861f('0x0'));var router=express[_0x861f('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x861f('0x2'));var controller=require(_0x861f('0x3'));router['get']('/',auth[_0x861f('0x4')](),controller[_0x861f('0x5')]);router[_0x861f('0x6')]('/describe',auth[_0x861f('0x4')](),controller[_0x861f('0x7')]);router['get'](_0x861f('0x8'),auth[_0x861f('0x4')](),controller['show']);router[_0x861f('0x6')](_0x861f('0x9'),auth[_0x861f('0x4')](),controller[_0x861f('0xa')]);router[_0x861f('0x6')](_0x861f('0xb'),auth[_0x861f('0x4')](),controller['download']);router[_0x861f('0xc')]('/',auth[_0x861f('0x4')](),controller[_0x861f('0xd')]);router[_0x861f('0xc')](_0x861f('0x9'),auth[_0x861f('0x4')](),controller['addMessage']);router[_0x861f('0xc')](_0x861f('0xe'),auth['isAuthenticated'](),interaction[_0x861f('0xf')](_0x861f('0x10'),_0x861f('0x11')),controller[_0x861f('0x12')]);router[_0x861f('0x13')]('/:id',auth[_0x861f('0x4')](),interaction[_0x861f('0xf')](_0x861f('0x10'),_0x861f('0x14')),controller[_0x861f('0x15')]);router['delete'](_0x861f('0x8'),auth[_0x861f('0x4')](),interaction[_0x861f('0xf')](_0x861f('0x10'),_0x861f('0x16')),controller[_0x861f('0x17')]);router['delete'](_0x861f('0xe'),auth[_0x861f('0x4')](),controller[_0x861f('0x18')]);module[_0x861f('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 81d4562..16512ac 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 _0xe0ef=['ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xe0ef,0x137));var _0xfe0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0ef[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfe0e('0x0'));var iconv=require(_0xfe0e('0x1'));module[_0xfe0e('0x2')]={'closed':{'type':Sequelize[_0xfe0e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfe0e('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfe0e('0x5')]},'thirdDisposition':{'type':Sequelize[_0xfe0e('0x5')]},'note':{'type':Sequelize[_0xfe0e('0x5')]},'inReplyTo':{'type':Sequelize[_0xfe0e('0x5')](0x1fe)},'to':{'type':Sequelize[_0xfe0e('0x5')]},'cc':{'type':Sequelize[_0xfe0e('0x6')](_0xfe0e('0x7'))},'subject':{'type':Sequelize[_0xfe0e('0x6')]()},'attach':{'type':Sequelize[_0xfe0e('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfe0e('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xfe0e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfe0e('0x8')]('in',_0xfe0e('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfe0e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfe0e('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfe0e('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfe0e('0xa')]}}; \ No newline at end of file +var _0x598b=['STRING','TEXT','long','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x37add7,_0x396960){var _0x41053d=function(_0x242477){while(--_0x242477){_0x37add7['push'](_0x37add7['shift']());}};_0x41053d(++_0x396960);}(_0x598b,0xba));var _0xb598=function(_0x25c856,_0x426670){_0x25c856=_0x25c856-0x0;var _0x40480b=_0x598b[_0x25c856];return _0x40480b;};'use strict';var Sequelize=require(_0xb598('0x0'));var iconv=require('iconv');module[_0xb598('0x1')]={'closed':{'type':Sequelize[_0xb598('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb598('0x3')]},'disposition':{'type':Sequelize[_0xb598('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb598('0x4')]},'note':{'type':Sequelize[_0xb598('0x4')]},'inReplyTo':{'type':Sequelize[_0xb598('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb598('0x4')]},'cc':{'type':Sequelize[_0xb598('0x5')](_0xb598('0x6'))},'subject':{'type':Sequelize[_0xb598('0x5')]()},'attach':{'type':Sequelize[_0xb598('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb598('0x3')]},'substatus':{'type':Sequelize[_0xb598('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb598('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb598('0x7')]('in',_0xb598('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb598('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb598('0x7')]('in',_0xb598('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb598('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb598('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0b8bf34..df81c0a 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 _0xbc7b=['undefined','limit','offset','set','Content-Range','update','destroy','then','error','name','send','index','map','MailInteraction','rawAttributes','key','getOptions','findAll','mail','query','user','catch','params','model','keys','filters','attributes','intersection','fields','length','merge','options','find','body','describe','addMessage','omit','ids','getMessages','hasOwnProperty','order','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','include','MailMessage','inlineCss','true','rows','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','type','message%d.eml','unlinkSync','rimraf','zip-dir','bluebird','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xbc7b,0xd0));var _0xbbc7=function(_0x53df79,_0xc2ce38){_0x53df79=_0x53df79-0x0;var _0x4616f9=_0xbc7b[_0x53df79];return _0x4616f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc7('0x0'));var zipdir=require(_0xbbc7('0x1'));var moment=require('moment');var BPromise=require(_0xbbc7('0x2'));var util=require('util');var path=require(_0xbbc7('0x3'));var fs=require('fs');var _=require('lodash');var juice=require(_0xbbc7('0x4'));var Redis=require(_0xbbc7('0x5'));var interaction=require(_0xbbc7('0x6'));var qs=require(_0xbbc7('0x7'));var logger=require(_0xbbc7('0x8'))(_0xbbc7('0x9'));var config=require(_0xbbc7('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xbbc7('0xb'));config[_0xbbc7('0xc')]=_['defaults'](config[_0xbbc7('0xc')],{'host':_0xbbc7('0xd'),'port':0x18eb});var socket=require(_0xbbc7('0xe'))(new Redis(config[_0xbbc7('0xc')]));require(_0xbbc7('0xf'))['register'](socket);function respondWithStatusCode(_0xbe82e7,_0x1ceb71){_0x1ceb71=_0x1ceb71||0xcc;return function(_0x505219){if(_0x505219){return _0xbe82e7[_0xbbc7('0x10')](_0x1ceb71);}return _0xbe82e7[_0xbbc7('0x11')](_0x1ceb71)[_0xbbc7('0x12')]();};}function respondWithResult(_0x3d22a9,_0x1398c9){_0x1398c9=_0x1398c9||0xc8;return function(_0x417b00){if(_0x417b00){return _0x3d22a9[_0xbbc7('0x11')](_0x1398c9)[_0xbbc7('0x13')](_0x417b00);}};}function respondWithFilteredResult(_0x1808b0,_0x30aa06){return function(_0x39619a){if(_0x39619a){var _0x5e9853=typeof _0x30aa06['offset']===_0xbbc7('0x14')&&typeof _0x30aa06[_0xbbc7('0x15')]===_0xbbc7('0x14');var _0x200615=_0x39619a['count'];var _0x45efc9=_0x5e9853?0x0:_0x30aa06[_0xbbc7('0x16')];var _0x38ac51=_0x5e9853?_0x39619a['count']:_0x30aa06[_0xbbc7('0x16')]+_0x30aa06[_0xbbc7('0x15')];var _0xe08c0;if(_0x38ac51>=_0x200615){_0x38ac51=_0x200615;_0xe08c0=0xc8;}else{_0xe08c0=0xce;}_0x1808b0[_0xbbc7('0x11')](_0xe08c0);return _0x1808b0[_0xbbc7('0x17')](_0xbbc7('0x18'),_0x45efc9+'-'+_0x38ac51+'/'+_0x200615)['json'](_0x39619a);}return null;};}function saveUpdates(_0x581b0c){return function(_0x50eff0){if(_0x50eff0){return _0x50eff0[_0xbbc7('0x19')](_0x581b0c)['then'](function(_0x112919){return _0x112919;});}return null;};}function removeEntity(_0x1d628d){return function(_0x331e33){if(_0x331e33){return _0x331e33[_0xbbc7('0x1a')]()[_0xbbc7('0x1b')](function(){_0x1d628d[_0xbbc7('0x11')](0xcc)[_0xbbc7('0x12')]();});}};}function handleEntityNotFound(_0x39761a){return function(_0x5552a5){if(!_0x5552a5){_0x39761a[_0xbbc7('0x10')](0x194);}return _0x5552a5;};}function handleError(_0xe88aba,_0xca8334){_0xca8334=_0xca8334||0x1f4;return function(_0x108e49){logger[_0xbbc7('0x1c')](_0x108e49['stack']);if(_0x108e49[_0xbbc7('0x1d')]){delete _0x108e49['name'];}_0xe88aba[_0xbbc7('0x11')](_0xca8334)[_0xbbc7('0x1e')](_0x108e49);};}exports[_0xbbc7('0x1f')]=function(_0x186820,_0x4f0cdf){var _0x2c45a3={};var _0x292239=_[_0xbbc7('0x20')](db[_0xbbc7('0x21')][_0xbbc7('0x22')],function(_0x327fac){return{'name':_0x327fac['fieldName'],'type':_0x327fac['type'][_0xbbc7('0x23')]};});_0x2c45a3=qs[_0xbbc7('0x24')](_0x292239,_0x186820);return interaction[_0xbbc7('0x25')](_0xbbc7('0x26'),_0x186820[_0xbbc7('0x27')],_0x186820[_0xbbc7('0x28')],_0x2c45a3,_0x292239)[_0xbbc7('0x1b')](respondWithFilteredResult(_0x4f0cdf,_0x2c45a3))[_0xbbc7('0x29')](handleError(_0x4f0cdf,null));};exports['show']=function(_0x57dc4b,_0x393b78){var _0x5b98d6={'raw':![],'where':{'id':_0x57dc4b[_0xbbc7('0x2a')]['id']}},_0x664352={};_0x664352[_0xbbc7('0x2b')]=_['keys'](db[_0xbbc7('0x21')][_0xbbc7('0x22')]);_0x664352[_0xbbc7('0x27')]=_[_0xbbc7('0x2c')](_0x57dc4b[_0xbbc7('0x27')]);_0x664352[_0xbbc7('0x2d')]=_['intersection'](_0x664352[_0xbbc7('0x2b')],_0x664352[_0xbbc7('0x27')]);_0x5b98d6[_0xbbc7('0x2e')]=_[_0xbbc7('0x2f')](_0x664352[_0xbbc7('0x2b')],qs[_0xbbc7('0x30')](_0x57dc4b['query'][_0xbbc7('0x30')]));_0x5b98d6[_0xbbc7('0x2e')]=_0x5b98d6[_0xbbc7('0x2e')][_0xbbc7('0x31')]?_0x5b98d6['attributes']:_0x664352[_0xbbc7('0x2b')];if(_0x57dc4b[_0xbbc7('0x27')]['includeAll']){_0x5b98d6['include']=[{'all':!![]}];}_0x5b98d6=_[_0xbbc7('0x32')]({},_0x5b98d6,_0x57dc4b[_0xbbc7('0x33')]);return db[_0xbbc7('0x21')][_0xbbc7('0x34')](_0x5b98d6)[_0xbbc7('0x1b')](handleEntityNotFound(_0x393b78,null))[_0xbbc7('0x1b')](respondWithResult(_0x393b78,null))['catch'](handleError(_0x393b78,null));};exports['create']=function(_0xb44090,_0x10832e){return db['MailInteraction']['create'](_0xb44090[_0xbbc7('0x35')],{})[_0xbbc7('0x1b')](respondWithResult(_0x10832e,0xc9))[_0xbbc7('0x29')](handleError(_0x10832e,null));};exports['update']=function(_0x17c0bd,_0x1b81ff){if(_0x17c0bd[_0xbbc7('0x35')]['id']){delete _0x17c0bd[_0xbbc7('0x35')]['id'];}return db[_0xbbc7('0x21')]['find']({'where':{'id':_0x17c0bd[_0xbbc7('0x2a')]['id']}})[_0xbbc7('0x1b')](handleEntityNotFound(_0x1b81ff,null))[_0xbbc7('0x1b')](saveUpdates(_0x17c0bd[_0xbbc7('0x35')],null))['then'](respondWithResult(_0x1b81ff,null))[_0xbbc7('0x29')](handleError(_0x1b81ff,null));};exports[_0xbbc7('0x1a')]=function(_0x4e1212,_0x15c9bc){return db['MailInteraction'][_0xbbc7('0x34')]({'where':{'id':_0x4e1212[_0xbbc7('0x2a')]['id']}})['then'](handleEntityNotFound(_0x15c9bc,null))[_0xbbc7('0x1b')](removeEntity(_0x15c9bc,null))[_0xbbc7('0x29')](handleError(_0x15c9bc,null));};exports[_0xbbc7('0x36')]=function(_0x539710,_0x19fdd4){return db[_0xbbc7('0x21')][_0xbbc7('0x36')]()[_0xbbc7('0x1b')](respondWithResult(_0x19fdd4,null))['catch'](handleError(_0x19fdd4,null));};exports[_0xbbc7('0x37')]=function(_0x506cf4,_0x4aec5a){return db['MailMessage'][_0xbbc7('0x34')]({'where':{'id':_0x506cf4[_0xbbc7('0x2a')]['id']}})[_0xbbc7('0x1b')](handleEntityNotFound(_0x4aec5a,null))[_0xbbc7('0x1b')](function(_0xa8cad8){if(_0xa8cad8){return _0xa8cad8['addMessage'](_0x506cf4[_0xbbc7('0x35')]['ids'],_[_0xbbc7('0x38')](_0x506cf4[_0xbbc7('0x35')],[_0xbbc7('0x39'),'id'])||{});}})[_0xbbc7('0x1b')](respondWithResult(_0x4aec5a,null))[_0xbbc7('0x29')](handleError(_0x4aec5a,null));};exports[_0xbbc7('0x3a')]=function(_0x4559d0,_0x5bb208){var _0x1284ce={'raw':![],'where':{}};var _0x3c5c7e={};var _0x1172d7={'count':0x0,'rows':[]};return db[_0xbbc7('0x21')]['findOne']({'where':{'id':_0x4559d0[_0xbbc7('0x2a')]['id']}})[_0xbbc7('0x1b')](handleEntityNotFound(_0x5bb208,null))['then'](function(_0x2053cb){if(_0x2053cb){_0x3c5c7e[_0xbbc7('0x2b')]=_[_0xbbc7('0x2c')](db['MailMessage']['rawAttributes']);_0x3c5c7e[_0xbbc7('0x27')]=_['keys'](_0x4559d0['query']);_0x3c5c7e[_0xbbc7('0x2d')]=_[_0xbbc7('0x2f')](_0x3c5c7e['model'],_0x3c5c7e[_0xbbc7('0x27')]);_0x1284ce[_0xbbc7('0x2e')]=_[_0xbbc7('0x2f')](_0x3c5c7e[_0xbbc7('0x2b')],qs[_0xbbc7('0x30')](_0x4559d0['query'][_0xbbc7('0x30')]));_0x1284ce[_0xbbc7('0x2e')]=_0x1284ce[_0xbbc7('0x2e')][_0xbbc7('0x31')]?_0x1284ce[_0xbbc7('0x2e')]:_0x3c5c7e[_0xbbc7('0x2b')];if(!_0x4559d0[_0xbbc7('0x27')][_0xbbc7('0x3b')]('nolimit')){_0x1284ce[_0xbbc7('0x15')]=qs[_0xbbc7('0x15')](_0x4559d0[_0xbbc7('0x27')][_0xbbc7('0x15')]);_0x1284ce[_0xbbc7('0x16')]=qs[_0xbbc7('0x16')](_0x4559d0[_0xbbc7('0x27')][_0xbbc7('0x16')]);}_0x1284ce[_0xbbc7('0x3c')]=qs[_0xbbc7('0x3d')](_0x4559d0[_0xbbc7('0x27')]['sort']);_0x1284ce[_0xbbc7('0x3e')]=qs[_0xbbc7('0x2d')](_[_0xbbc7('0x3f')](_0x4559d0[_0xbbc7('0x27')],_0x3c5c7e[_0xbbc7('0x2d')]));_0x1284ce[_0xbbc7('0x3e')][_0xbbc7('0x40')]=_0x2053cb['id'];if(_0x4559d0[_0xbbc7('0x27')][_0xbbc7('0x41')]){_0x1284ce[_0xbbc7('0x3e')]=_[_0xbbc7('0x32')](_0x1284ce['where'],{'$or':_[_0xbbc7('0x20')](_0x1284ce[_0xbbc7('0x2e')],function(_0x1d1231){var _0x464ad5={};_0x464ad5[_0x1d1231]={'$like':'%'+_0x4559d0[_0xbbc7('0x27')]['filter']+'%'};return _0x464ad5;})});}if(_0x4559d0[_0xbbc7('0x27')][_0xbbc7('0x42')]){var _0x31a43b=_0x4559d0['query'][_0xbbc7('0x42')][_0xbbc7('0x43')](',');var _0x3f5057={};_0x3f5057[_0x31a43b[0x0]]={'$gte':moment(_0x31a43b[0x1])['format'](_0xbbc7('0x44'))};_0x1284ce[_0xbbc7('0x3e')]=_[_0xbbc7('0x32')](_0x1284ce[_0xbbc7('0x3e')],_0x3f5057);}_0x1284ce=_[_0xbbc7('0x32')]({},_0x1284ce,_0x4559d0[_0xbbc7('0x33')]);return db['MailMessage'][_0xbbc7('0x45')]({'where':_0x1284ce[_0xbbc7('0x3e')]})[_0xbbc7('0x1b')](function(_0x3846a8){_0x1172d7['count']=_0x3846a8;if(_0x4559d0['query'][_0xbbc7('0x46')]){_0x1284ce[_0xbbc7('0x47')]=[{'all':!![]}];}return db[_0xbbc7('0x48')]['findAll'](_0x1284ce);})[_0xbbc7('0x1b')](function(_0x22375b){if(_0x4559d0[_0xbbc7('0x27')][_0xbbc7('0x49')]===_0xbbc7('0x4a')){for(var _0x5f26a0=0x0;_0x5f26a0<_0x22375b['length'];_0x5f26a0++){_0x22375b[_0x5f26a0][_0xbbc7('0x35')]=juice(_0x22375b[_0x5f26a0][_0xbbc7('0x35')]);}}_0x1172d7[_0xbbc7('0x4b')]=_0x22375b;return _0x1172d7;});}})[_0xbbc7('0x1b')](respondWithFilteredResult(_0x5bb208,_0x1284ce))['catch'](handleError(_0x5bb208,null));};exports['addTags']=function(_0x563c55,_0xd7450){return db[_0xbbc7('0x21')][_0xbbc7('0x34')]({'where':{'id':_0x563c55[_0xbbc7('0x2a')]['id']}})[_0xbbc7('0x1b')](handleEntityNotFound(_0xd7450,null))[_0xbbc7('0x1b')](function(_0x46c0fa){if(_0x46c0fa){return _0x46c0fa[_0xbbc7('0x4c')](_0x563c55[_0xbbc7('0x35')][_0xbbc7('0x39')],_['omit'](_0x563c55[_0xbbc7('0x35')],[_0xbbc7('0x39'),'id'])||{})[_0xbbc7('0x4d')](function(){return db[_0xbbc7('0x4e')]['findAll']({'attributes':['id',_0xbbc7('0x1d'),_0xbbc7('0x4f')],'where':{'id':_0x563c55[_0xbbc7('0x35')][_0xbbc7('0x39')]}});})['then'](function(_0x3355ca){socket[_0xbbc7('0x50')]('mailInteractionTags:save',{'id':Number(_0x563c55[_0xbbc7('0x2a')]['id']),'tags':_0x3355ca||[]});return{'id':Number(_0x563c55[_0xbbc7('0x2a')]['id']),'tags':_0x3355ca||[]};});}})['then'](respondWithResult(_0xd7450,null))[_0xbbc7('0x29')](handleError(_0xd7450,null));};exports[_0xbbc7('0x51')]=function(_0x2c0741,_0x73363e){return db[_0xbbc7('0x21')][_0xbbc7('0x34')]({'where':{'id':_0x2c0741['params']['id']}})[_0xbbc7('0x1b')](handleEntityNotFound(_0x73363e,null))[_0xbbc7('0x1b')](function(_0x1b2f15){if(_0x1b2f15){return _0x1b2f15[_0xbbc7('0x51')](_0x2c0741[_0xbbc7('0x27')][_0xbbc7('0x39')]);}})[_0xbbc7('0x1b')](respondWithStatusCode(_0x73363e,null))[_0xbbc7('0x29')](handleError(_0x73363e,null));};exports[_0xbbc7('0x52')]=function(_0x1c1473,_0x9d5343){var _0x17a2c0=moment()[_0xbbc7('0x53')]()[_0xbbc7('0x54')]();var _0x4415b8=path['join'](config[_0xbbc7('0x55')],_0xbbc7('0x56'),_0xbbc7('0x57'),_0xbbc7('0x58'));var _0x27e0da=path[_0xbbc7('0x59')](config[_0xbbc7('0x55')],_0xbbc7('0x56'),_0xbbc7('0x57'),_0xbbc7('0x5a'));var _0x5f2624=path[_0xbbc7('0x59')](_0x4415b8,_0x17a2c0);var _0x5df1e2=util[_0xbbc7('0x5b')](_0xbbc7('0x5c'),_0x1c1473[_0xbbc7('0x2a')]['id'],_0x17a2c0);var _0x13fe6b=path[_0xbbc7('0x59')](_0x4415b8,_0x5df1e2);var _0x17aeeb=[];if(_0x1c1473[_0xbbc7('0x27')]['attachments']){_0x17aeeb[_0xbbc7('0x5d')]({'model':db[_0xbbc7('0x5e')],'as':_0xbbc7('0x5f'),'raw':!![]});}var _0x1498ac=[{'model':db[_0xbbc7('0x48')],'as':_0xbbc7('0x60'),'attributes':['id','body','from','to','cc',_0xbbc7('0x61'),_0xbbc7('0x62'),_0xbbc7('0x63')],'where':{'secret':![]},'order':qs[_0xbbc7('0x3d')]('id'),'include':_0x17aeeb}];return db[_0xbbc7('0x21')]['find']({'where':{'id':_0x1c1473[_0xbbc7('0x2a')]['id']},'include':_0x1498ac})[_0xbbc7('0x1b')](handleEntityNotFound(_0x9d5343,null))[_0xbbc7('0x1b')](function(_0x5bd2d5){if(_0x5bd2d5&&_0x5bd2d5[_0xbbc7('0x60')]){var _0x5c6d86=_0x5bd2d5[_0xbbc7('0x64')]({'plain':!![]});fs[_0xbbc7('0x65')](_0x5f2624);return BPromise[_0xbbc7('0x66')](_0x5c6d86['Messages'],function(_0x112cde,_0x309f81){var _0x3f3a80={'from':_0x112cde[_0xbbc7('0x67')],'to':_0x112cde['to']||_0xbbc7('0x68'),'subject':_0x112cde[_0xbbc7('0x62')],'html':htmlEntities[_0xbbc7('0x69')](_0x112cde[_0xbbc7('0x35')]),'headers':{'Date':moment(_0x112cde[_0xbbc7('0x63')])[_0xbbc7('0x5b')](_0xbbc7('0x6a'))},'attachments':[]};if(_0x112cde['cc']){_0x3f3a80['headers']['Cc']=_0x112cde['cc'];}if(_0x112cde[_0xbbc7('0x61')]){_0x3f3a80[_0xbbc7('0x6b')][_0xbbc7('0x6c')]=_0x112cde['bcc'];}return new BPromise(function(_0x2fce38,_0x1fd65d){if(_0x112cde[_0xbbc7('0x5f')]){for(var _0x7433d8=0x0;_0x7433d8<_0x112cde[_0xbbc7('0x5f')][_0xbbc7('0x31')];_0x7433d8++){var _0xfafe7f=_0x112cde[_0xbbc7('0x5f')][_0x7433d8];var _0x5ca44c=path['join'](_0x27e0da,_0xfafe7f[_0xbbc7('0x6d')]);if(fs[_0xbbc7('0x6e')](_0x5ca44c)){_0x3f3a80['attachments'][_0xbbc7('0x5d')]({'name':_0xfafe7f['name'],'contentType':_0xfafe7f[_0xbbc7('0x6f')],'data':fs['readFileSync'](_0x5ca44c)});}}}emlformat['build'](_0x3f3a80,function(_0x40b818,_0x30cfcf){if(_0x40b818)return _0x1fd65d(_0x40b818);fs['writeFileSync'](path['join'](_0x5f2624,util[_0xbbc7('0x5b')](_0xbbc7('0x70'),_0x309f81)),_0x30cfcf);return _0x2fce38(_0x30cfcf);});});})[_0xbbc7('0x1b')](function(){return new BPromise(function(_0xad8afd,_0x5db782){zipdir(_0x5f2624,{'saveTo':_0x13fe6b},function(_0x1e385f,_0xb8a5c2){if(_0x1e385f)return _0x5db782(_0x1e385f);return _0xad8afd(_0xb8a5c2);});})[_0xbbc7('0x1b')](function(){return new BPromise(function(_0x32d694,_0x48dda8){rimraf(_0x5f2624,function(_0x4de31c){if(_0x4de31c)_0x48dda8(_0x4de31c);return _0x32d694();});});})[_0xbbc7('0x1b')](function(){return _0x9d5343[_0xbbc7('0x52')](_0x13fe6b,_0x5df1e2,function(_0x78a199){if(!_0x78a199)fs[_0xbbc7('0x71')](_0x13fe6b);});});});}else{return _0x9d5343[_0xbbc7('0x10')](0xc8);}})['catch'](handleError(_0x9d5343,null));}; \ No newline at end of file +var _0xba82=['Bcc','basename','push','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','register','sendStatus','status','offset','undefined','count','limit','set','json','then','error','stack','name','index','map','rawAttributes','fieldName','key','user','catch','show','params','model','keys','MailInteraction','query','filters','intersection','fields','attributes','include','merge','options','find','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','findAll','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba82,0xe6));var _0x2ba8=function(_0xe0b7a6,_0x5b8b51){_0xe0b7a6=_0xe0b7a6-0x0;var _0x7f4027=_0xba82[_0xe0b7a6];return _0x7f4027;};'use strict';var emlformat=require(_0x2ba8('0x0'));var rimraf=require(_0x2ba8('0x1'));var zipdir=require(_0x2ba8('0x2'));var moment=require('moment');var BPromise=require(_0x2ba8('0x3'));var util=require(_0x2ba8('0x4'));var path=require(_0x2ba8('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0x2ba8('0x6'));var Redis=require(_0x2ba8('0x7'));var interaction=require(_0x2ba8('0x8'));var qs=require(_0x2ba8('0x9'));var logger=require(_0x2ba8('0xa'))('api');var config=require(_0x2ba8('0xb'));var db=require(_0x2ba8('0xc'))['db'];var htmlEntities=require(_0x2ba8('0xd'));config[_0x2ba8('0xe')]=_[_0x2ba8('0xf')](config[_0x2ba8('0xe')],{'host':_0x2ba8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ba8('0xe')]));require('./mailInteraction.socket')[_0x2ba8('0x11')](socket);function respondWithStatusCode(_0x9b449b,_0x3cb472){_0x3cb472=_0x3cb472||0xcc;return function(_0x37c90b){if(_0x37c90b){return _0x9b449b[_0x2ba8('0x12')](_0x3cb472);}return _0x9b449b[_0x2ba8('0x13')](_0x3cb472)['end']();};}function respondWithResult(_0x263375,_0x8e4a56){_0x8e4a56=_0x8e4a56||0xc8;return function(_0xbbc01d){if(_0xbbc01d){return _0x263375[_0x2ba8('0x13')](_0x8e4a56)['json'](_0xbbc01d);}};}function respondWithFilteredResult(_0x2a5c7d,_0x37d5e2){return function(_0x34d95d){if(_0x34d95d){var _0x542386=typeof _0x37d5e2[_0x2ba8('0x14')]===_0x2ba8('0x15')&&typeof _0x37d5e2['limit']===_0x2ba8('0x15');var _0xb6942e=_0x34d95d[_0x2ba8('0x16')];var _0x233bef=_0x542386?0x0:_0x37d5e2['offset'];var _0x5c7758=_0x542386?_0x34d95d['count']:_0x37d5e2[_0x2ba8('0x14')]+_0x37d5e2[_0x2ba8('0x17')];var _0x3f9c15;if(_0x5c7758>=_0xb6942e){_0x5c7758=_0xb6942e;_0x3f9c15=0xc8;}else{_0x3f9c15=0xce;}_0x2a5c7d['status'](_0x3f9c15);return _0x2a5c7d[_0x2ba8('0x18')]('Content-Range',_0x233bef+'-'+_0x5c7758+'/'+_0xb6942e)[_0x2ba8('0x19')](_0x34d95d);}return null;};}function saveUpdates(_0x44978b){return function(_0x335990){if(_0x335990){return _0x335990['update'](_0x44978b)[_0x2ba8('0x1a')](function(_0x30f8c3){return _0x30f8c3;});}return null;};}function removeEntity(_0x97f004){return function(_0xfad60c){if(_0xfad60c){return _0xfad60c['destroy']()[_0x2ba8('0x1a')](function(){_0x97f004['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x306c7b){return function(_0x509cb6){if(!_0x509cb6){_0x306c7b['sendStatus'](0x194);}return _0x509cb6;};}function handleError(_0x23376a,_0x5ed0b5){_0x5ed0b5=_0x5ed0b5||0x1f4;return function(_0x57f505){logger[_0x2ba8('0x1b')](_0x57f505[_0x2ba8('0x1c')]);if(_0x57f505[_0x2ba8('0x1d')]){delete _0x57f505[_0x2ba8('0x1d')];}_0x23376a[_0x2ba8('0x13')](_0x5ed0b5)['send'](_0x57f505);};}exports[_0x2ba8('0x1e')]=function(_0x25dd5a,_0x2aa059){var _0x2a924f={};var _0x4a20c6=_[_0x2ba8('0x1f')](db['MailInteraction'][_0x2ba8('0x20')],function(_0x23e250){return{'name':_0x23e250[_0x2ba8('0x21')],'type':_0x23e250['type'][_0x2ba8('0x22')]};});_0x2a924f=qs['getOptions'](_0x4a20c6,_0x25dd5a);return interaction['findAll']('mail',_0x25dd5a['query'],_0x25dd5a[_0x2ba8('0x23')],_0x2a924f,_0x4a20c6)[_0x2ba8('0x1a')](respondWithFilteredResult(_0x2aa059,_0x2a924f))[_0x2ba8('0x24')](handleError(_0x2aa059,null));};exports[_0x2ba8('0x25')]=function(_0x64ccde,_0x7b984b){var _0x143686={'raw':![],'where':{'id':_0x64ccde[_0x2ba8('0x26')]['id']}},_0x13d65a={};_0x13d65a[_0x2ba8('0x27')]=_[_0x2ba8('0x28')](db[_0x2ba8('0x29')][_0x2ba8('0x20')]);_0x13d65a[_0x2ba8('0x2a')]=_[_0x2ba8('0x28')](_0x64ccde[_0x2ba8('0x2a')]);_0x13d65a[_0x2ba8('0x2b')]=_['intersection'](_0x13d65a[_0x2ba8('0x27')],_0x13d65a[_0x2ba8('0x2a')]);_0x143686['attributes']=_[_0x2ba8('0x2c')](_0x13d65a[_0x2ba8('0x27')],qs['fields'](_0x64ccde['query'][_0x2ba8('0x2d')]));_0x143686['attributes']=_0x143686[_0x2ba8('0x2e')]['length']?_0x143686['attributes']:_0x13d65a['model'];if(_0x64ccde[_0x2ba8('0x2a')]['includeAll']){_0x143686[_0x2ba8('0x2f')]=[{'all':!![]}];}_0x143686=_[_0x2ba8('0x30')]({},_0x143686,_0x64ccde[_0x2ba8('0x31')]);return db[_0x2ba8('0x29')][_0x2ba8('0x32')](_0x143686)[_0x2ba8('0x1a')](handleEntityNotFound(_0x7b984b,null))[_0x2ba8('0x1a')](respondWithResult(_0x7b984b,null))['catch'](handleError(_0x7b984b,null));};exports[_0x2ba8('0x33')]=function(_0x372fe5,_0x40cc9b){return db[_0x2ba8('0x29')]['create'](_0x372fe5[_0x2ba8('0x34')],{})[_0x2ba8('0x1a')](respondWithResult(_0x40cc9b,0xc9))[_0x2ba8('0x24')](handleError(_0x40cc9b,null));};exports['update']=function(_0x5ee6fa,_0x4fd547){if(_0x5ee6fa[_0x2ba8('0x34')]['id']){delete _0x5ee6fa['body']['id'];}return db[_0x2ba8('0x29')]['find']({'where':{'id':_0x5ee6fa[_0x2ba8('0x26')]['id']}})[_0x2ba8('0x1a')](handleEntityNotFound(_0x4fd547,null))['then'](saveUpdates(_0x5ee6fa[_0x2ba8('0x34')],null))['then'](respondWithResult(_0x4fd547,null))[_0x2ba8('0x24')](handleError(_0x4fd547,null));};exports[_0x2ba8('0x35')]=function(_0x550cce,_0x41baa8){return db[_0x2ba8('0x29')][_0x2ba8('0x32')]({'where':{'id':_0x550cce[_0x2ba8('0x26')]['id']}})[_0x2ba8('0x1a')](handleEntityNotFound(_0x41baa8,null))[_0x2ba8('0x1a')](removeEntity(_0x41baa8,null))[_0x2ba8('0x24')](handleError(_0x41baa8,null));};exports[_0x2ba8('0x36')]=function(_0x31a7bb,_0x583746){return db[_0x2ba8('0x29')][_0x2ba8('0x36')]()[_0x2ba8('0x1a')](respondWithResult(_0x583746,null))[_0x2ba8('0x24')](handleError(_0x583746,null));};exports[_0x2ba8('0x37')]=function(_0x4ed2c1,_0x87a730){return db[_0x2ba8('0x38')][_0x2ba8('0x32')]({'where':{'id':_0x4ed2c1[_0x2ba8('0x26')]['id']}})[_0x2ba8('0x1a')](handleEntityNotFound(_0x87a730,null))[_0x2ba8('0x1a')](function(_0x24c966){if(_0x24c966){return _0x24c966[_0x2ba8('0x37')](_0x4ed2c1[_0x2ba8('0x34')][_0x2ba8('0x39')],_[_0x2ba8('0x3a')](_0x4ed2c1[_0x2ba8('0x34')],[_0x2ba8('0x39'),'id'])||{});}})[_0x2ba8('0x1a')](respondWithResult(_0x87a730,null))[_0x2ba8('0x24')](handleError(_0x87a730,null));};exports[_0x2ba8('0x3b')]=function(_0x2ddf4c,_0x3374fc){var _0x229210={'raw':![],'where':{}};var _0x10e49a={};var _0x77d186={'count':0x0,'rows':[]};return db[_0x2ba8('0x29')]['findOne']({'where':{'id':_0x2ddf4c[_0x2ba8('0x26')]['id']}})[_0x2ba8('0x1a')](handleEntityNotFound(_0x3374fc,null))['then'](function(_0x4d7929){if(_0x4d7929){_0x10e49a[_0x2ba8('0x27')]=_['keys'](db[_0x2ba8('0x38')][_0x2ba8('0x20')]);_0x10e49a[_0x2ba8('0x2a')]=_[_0x2ba8('0x28')](_0x2ddf4c['query']);_0x10e49a[_0x2ba8('0x2b')]=_[_0x2ba8('0x2c')](_0x10e49a[_0x2ba8('0x27')],_0x10e49a[_0x2ba8('0x2a')]);_0x229210['attributes']=_['intersection'](_0x10e49a[_0x2ba8('0x27')],qs[_0x2ba8('0x2d')](_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x2d')]));_0x229210['attributes']=_0x229210[_0x2ba8('0x2e')][_0x2ba8('0x3c')]?_0x229210[_0x2ba8('0x2e')]:_0x10e49a[_0x2ba8('0x27')];if(!_0x2ddf4c['query'][_0x2ba8('0x3d')](_0x2ba8('0x3e'))){_0x229210[_0x2ba8('0x17')]=qs[_0x2ba8('0x17')](_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x17')]);_0x229210[_0x2ba8('0x14')]=qs[_0x2ba8('0x14')](_0x2ddf4c[_0x2ba8('0x2a')]['offset']);}_0x229210[_0x2ba8('0x3f')]=qs['sort'](_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x40')]);_0x229210[_0x2ba8('0x41')]=qs[_0x2ba8('0x2b')](_[_0x2ba8('0x42')](_0x2ddf4c[_0x2ba8('0x2a')],_0x10e49a[_0x2ba8('0x2b')]));_0x229210[_0x2ba8('0x41')][_0x2ba8('0x43')]=_0x4d7929['id'];if(_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x44')]){_0x229210[_0x2ba8('0x41')]=_['merge'](_0x229210['where'],{'$or':_[_0x2ba8('0x1f')](_0x229210[_0x2ba8('0x2e')],function(_0x5a80ed){var _0x110d7={};_0x110d7[_0x5a80ed]={'$like':'%'+_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x44')]+'%'};return _0x110d7;})});}if(_0x2ddf4c['query'][_0x2ba8('0x45')]){var _0x5c9fad=_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x45')][_0x2ba8('0x46')](',');var _0x17e5a7={};_0x17e5a7[_0x5c9fad[0x0]]={'$gte':moment(_0x5c9fad[0x1])['format'](_0x2ba8('0x47'))};_0x229210[_0x2ba8('0x41')]=_[_0x2ba8('0x30')](_0x229210[_0x2ba8('0x41')],_0x17e5a7);}_0x229210=_[_0x2ba8('0x30')]({},_0x229210,_0x2ddf4c[_0x2ba8('0x31')]);return db['MailMessage']['count']({'where':_0x229210[_0x2ba8('0x41')]})[_0x2ba8('0x1a')](function(_0x5b8fa1){_0x77d186[_0x2ba8('0x16')]=_0x5b8fa1;if(_0x2ddf4c['query']['includeAll']){_0x229210[_0x2ba8('0x2f')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x229210);})[_0x2ba8('0x1a')](function(_0x50da6b){if(_0x2ddf4c[_0x2ba8('0x2a')][_0x2ba8('0x48')]===_0x2ba8('0x49')){for(var _0xbb68fe=0x0;_0xbb68fe<_0x50da6b[_0x2ba8('0x3c')];_0xbb68fe++){_0x50da6b[_0xbb68fe][_0x2ba8('0x34')]=juice(_0x50da6b[_0xbb68fe]['body']);}}_0x77d186[_0x2ba8('0x4a')]=_0x50da6b;return _0x77d186;});}})['then'](respondWithFilteredResult(_0x3374fc,_0x229210))[_0x2ba8('0x24')](handleError(_0x3374fc,null));};exports[_0x2ba8('0x4b')]=function(_0x212939,_0x4791e3){return db[_0x2ba8('0x29')][_0x2ba8('0x32')]({'where':{'id':_0x212939['params']['id']}})['then'](handleEntityNotFound(_0x4791e3,null))[_0x2ba8('0x1a')](function(_0x786374){if(_0x786374){return _0x786374[_0x2ba8('0x4c')](_0x212939[_0x2ba8('0x34')][_0x2ba8('0x39')],_['omit'](_0x212939[_0x2ba8('0x34')],[_0x2ba8('0x39'),'id'])||{})[_0x2ba8('0x4d')](function(){return db[_0x2ba8('0x4e')][_0x2ba8('0x4f')]({'attributes':['id','name',_0x2ba8('0x50')],'where':{'id':_0x212939[_0x2ba8('0x34')][_0x2ba8('0x39')]}});})['then'](function(_0x2100c8){socket[_0x2ba8('0x51')]('mailInteractionTags:save',{'id':Number(_0x212939['params']['id']),'tags':_0x2100c8||[]});return{'id':Number(_0x212939[_0x2ba8('0x26')]['id']),'tags':_0x2100c8||[]};});}})[_0x2ba8('0x1a')](respondWithResult(_0x4791e3,null))['catch'](handleError(_0x4791e3,null));};exports[_0x2ba8('0x52')]=function(_0x2a1bf9,_0x503061){return db[_0x2ba8('0x29')][_0x2ba8('0x32')]({'where':{'id':_0x2a1bf9[_0x2ba8('0x26')]['id']}})[_0x2ba8('0x1a')](handleEntityNotFound(_0x503061,null))[_0x2ba8('0x1a')](function(_0x1acb4e){if(_0x1acb4e){return _0x1acb4e[_0x2ba8('0x52')](_0x2a1bf9[_0x2ba8('0x2a')][_0x2ba8('0x39')]);}})['then'](respondWithStatusCode(_0x503061,null))[_0x2ba8('0x24')](handleError(_0x503061,null));};exports[_0x2ba8('0x53')]=function(_0xe7eb3e,_0x10d518){var _0x2d2e81=moment()[_0x2ba8('0x54')]()[_0x2ba8('0x55')]();var _0x29e829=path[_0x2ba8('0x56')](config[_0x2ba8('0x57')],_0x2ba8('0x58'),_0x2ba8('0x59'),_0x2ba8('0x5a'));var _0x1a9f1b=path[_0x2ba8('0x56')](config[_0x2ba8('0x57')],_0x2ba8('0x58'),_0x2ba8('0x59'),_0x2ba8('0x5b'));var _0x4a6662=path[_0x2ba8('0x56')](_0x29e829,_0x2d2e81);var _0x516f08=util[_0x2ba8('0x5c')]('transcript-%d-%s.zip',_0xe7eb3e['params']['id'],_0x2d2e81);var _0x470cdd=path[_0x2ba8('0x56')](_0x29e829,_0x516f08);var _0xe76795=[];if(_0xe7eb3e['query'][_0x2ba8('0x5b')]){_0xe76795['push']({'model':db['Attachment'],'as':_0x2ba8('0x5d'),'raw':!![]});}var _0x23630f=[{'model':db['MailMessage'],'as':_0x2ba8('0x5e'),'attributes':['id','body',_0x2ba8('0x5f'),'to','cc',_0x2ba8('0x60'),_0x2ba8('0x61'),_0x2ba8('0x62')],'where':{'secret':![]},'order':qs[_0x2ba8('0x40')]('id'),'include':_0xe76795}];return db['MailInteraction'][_0x2ba8('0x32')]({'where':{'id':_0xe7eb3e['params']['id']},'include':_0x23630f})['then'](handleEntityNotFound(_0x10d518,null))['then'](function(_0xe7da70){if(_0xe7da70&&_0xe7da70[_0x2ba8('0x5e')]){var _0x29e983=_0xe7da70[_0x2ba8('0x63')]({'plain':!![]});fs[_0x2ba8('0x64')](_0x4a6662);return BPromise[_0x2ba8('0x65')](_0x29e983[_0x2ba8('0x5e')],function(_0x458dd1,_0xf4fe40){var _0x23375f={'from':_0x458dd1[_0x2ba8('0x5f')],'to':_0x458dd1['to']||_0x2ba8('0x66'),'subject':_0x458dd1[_0x2ba8('0x61')],'html':htmlEntities[_0x2ba8('0x67')](_0x458dd1['body']),'headers':{'Date':moment(_0x458dd1[_0x2ba8('0x62')])['format'](_0x2ba8('0x68'))},'attachments':[]};if(_0x458dd1['cc']){_0x23375f[_0x2ba8('0x69')]['Cc']=_0x458dd1['cc'];}if(_0x458dd1[_0x2ba8('0x60')]){_0x23375f[_0x2ba8('0x69')][_0x2ba8('0x6a')]=_0x458dd1[_0x2ba8('0x60')];}return new BPromise(function(_0x206225,_0x959055){if(_0x458dd1['Attachments']){for(var _0x4bbeeb=0x0;_0x4bbeeb<_0x458dd1[_0x2ba8('0x5d')]['length'];_0x4bbeeb++){var _0x29df79=_0x458dd1[_0x2ba8('0x5d')][_0x4bbeeb];var _0x55c464=path[_0x2ba8('0x56')](_0x1a9f1b,_0x29df79[_0x2ba8('0x6b')]);if(fs['existsSync'](_0x55c464)){_0x23375f[_0x2ba8('0x5b')][_0x2ba8('0x6c')]({'name':_0x29df79[_0x2ba8('0x1d')],'contentType':_0x29df79['type'],'data':fs['readFileSync'](_0x55c464)});}}}emlformat[_0x2ba8('0x6d')](_0x23375f,function(_0xe8b2bd,_0x2e82b0){if(_0xe8b2bd)return _0x959055(_0xe8b2bd);fs[_0x2ba8('0x6e')](path[_0x2ba8('0x56')](_0x4a6662,util[_0x2ba8('0x5c')]('message%d.eml',_0xf4fe40)),_0x2e82b0);return _0x206225(_0x2e82b0);});});})[_0x2ba8('0x1a')](function(){return new BPromise(function(_0x203541,_0x377eab){zipdir(_0x4a6662,{'saveTo':_0x470cdd},function(_0x1c42cb,_0x50fa84){if(_0x1c42cb)return _0x377eab(_0x1c42cb);return _0x203541(_0x50fa84);});})['then'](function(){return new BPromise(function(_0x4a70c0,_0x24bf74){rimraf(_0x4a6662,function(_0x3e6d6e){if(_0x3e6d6e)_0x24bf74(_0x3e6d6e);return _0x4a70c0();});});})[_0x2ba8('0x1a')](function(){return _0x10d518[_0x2ba8('0x53')](_0x470cdd,_0x516f08,function(_0x1ee68d){if(!_0x1ee68d)fs[_0x2ba8('0x6f')](_0x470cdd);});});});}else{return _0x10d518['sendStatus'](0xc8);}})['catch'](handleError(_0x10d518,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 39e2fd0..b58c4bd 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 _0x18d1=['catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit'];(function(_0x13b853,_0x409644){var _0xec64c2=function(_0x441774){while(--_0x441774){_0x13b853['push'](_0x13b853['shift']());}};_0xec64c2(++_0x409644);}(_0x18d1,0x18f));var _0x118d=function(_0x7e7985,_0x1e534f){_0x7e7985=_0x7e7985-0x0;var _0x33a480=_0x18d1[_0x7e7985];return _0x33a480;};'use strict';var EventEmitter=require(_0x118d('0x0'));var MailInteraction=require(_0x118d('0x1'))['db'][_0x118d('0x2')];var MailMessage=require(_0x118d('0x1'))['db'][_0x118d('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x118d('0x4')](0x0);var events={'afterCreate':_0x118d('0x5'),'afterUpdate':'update','afterDestroy':_0x118d('0x6')};function emitEvent(_0x27e420){return function(_0x3dae0b,_0x45b28c,_0x56fb88){_0x3dae0b[_0x118d('0x7')]({'attributes':['id'],'raw':!![]})[_0x118d('0x8')](function(_0x5b42b8){_0x3dae0b[_0x118d('0x9')](_0x118d('0xa'),_0x5b42b8['map'](function(_0x12d033){return{'id':_0x12d033['id']};}));return MailMessage[_0x118d('0xb')]({'where':{'MailInteractionId':_0x3dae0b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x118d('0x8')](function(_0x1507d2){_0x3dae0b[_0x118d('0x9')](_0x118d('0xc'),_0x1507d2[_0x118d('0xd')]);MailInteractionEvents[_0x118d('0xe')](_0x27e420+':'+_0x3dae0b['id'],_0x3dae0b);MailInteractionEvents[_0x118d('0xe')](_0x27e420,_0x3dae0b);_0x56fb88(null);})[_0x118d('0xf')](_0x56fb88(null));};}for(var e in events){if(events[_0x118d('0x10')](e)){var event=events[e];MailInteraction[_0x118d('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xc33f=['../../mysqldb','save','update','remove','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','MailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc33f,0x1ee));var _0xfc33=function(_0x1f9773,_0x4365fb){_0x1f9773=_0x1f9773-0x0;var _0x3fc947=_0xc33f[_0x1f9773];return _0x3fc947;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xfc33('0x0')];var MailMessage=require(_0xfc33('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc33('0x2'),'afterUpdate':_0xfc33('0x3'),'afterDestroy':_0xfc33('0x4')};function emitEvent(_0x36847c){return function(_0x35ef85,_0x92c154,_0x19ff0f){_0x35ef85['getUsers']({'attributes':['id'],'raw':!![]})[_0xfc33('0x5')](function(_0x3f6967){_0x35ef85[_0xfc33('0x6')]('Users',_0x3f6967[_0xfc33('0x7')](function(_0x5a7274){return{'id':_0x5a7274['id']};}));return MailMessage[_0xfc33('0x8')]({'where':{'MailInteractionId':_0x35ef85['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfc33('0x5')](function(_0x395639){_0x35ef85[_0xfc33('0x6')](_0xfc33('0x9'),_0x395639['length']);MailInteractionEvents[_0xfc33('0xa')](_0x36847c+':'+_0x35ef85['id'],_0x35ef85);MailInteractionEvents[_0xfc33('0xa')](_0x36847c,_0x35ef85);_0x19ff0f(null);})[_0xfc33('0xb')](_0x19ff0f(null));};}for(var e in events){if(events[_0xfc33('0xc')](e)){var event=events[e];MailInteraction[_0xfc33('0xd')](e,emitEvent(event));}}module[_0xfc33('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 23ae399..5449e8e 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 _0x2bfd=['YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','path','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x2bfd,0x151));var _0xd2bf=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x2bfd[_0x4ffa64];return _0x5da001;};'use strict';var _=require(_0xd2bf('0x0'));var util=require(_0xd2bf('0x1'));var logger=require(_0xd2bf('0x2'))(_0xd2bf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2bf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2bf('0x5'));module[_0xd2bf('0x6')]=function(_0x4ada8b,_0x53ad5b){return _0x4ada8b[_0xd2bf('0x7')](_0xd2bf('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xd2bf('0x9'),'fields':['subject','to'],'type':_0xd2bf('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53e418,_0x301a7d,_0x5a3e9d){if(_0x53e418[_0xd2bf('0xb')]){_0x53e418[_0xd2bf('0xc')]=moment()['format'](_0xd2bf('0xd'));}if(_0x53e418[_0xd2bf('0xe')]){_0x53e418['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5a3e9d(null,_0x301a7d);},'beforeUpdate':function(_0x4c4864,_0x51c043,_0x4c35e5){if(_0x4c4864['changed'](_0xd2bf('0xb'))){_0x4c4864['substatusAt']=_0x4c4864[_0xd2bf('0xb')]?moment()[_0xd2bf('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4c4864[_0xd2bf('0x10')](_0xd2bf('0xe'))){_0x4c4864[_0xd2bf('0x11')]=moment()[_0xd2bf('0xf')](_0xd2bf('0xd'));_0x4c4864[_0xd2bf('0xb')]=null;_0x4c4864[_0xd2bf('0xc')]=null;}_0x4c35e5(null,_0x4c4864);},'afterUpdate':function(_0x4d7562,_0xd4f7fd,_0x276ee4){var _0x2ff9a2=_0x4ada8b[_0xd2bf('0x12')];var _0x248780=_0x4d7562[_0xd2bf('0x13')]({'plain':!![]});if(_0x248780[_0xd2bf('0xe')]){return _0x2ff9a2[_0xd2bf('0x14')][_0xd2bf('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x248780['id']}})[_0xd2bf('0x16')](function(){_0x276ee4();})[_0xd2bf('0x17')](function(_0x1111b6){_0x276ee4(_0x1111b6);});}else{_0x276ee4();}}},'charset':_0xd2bf('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd5e4=['changed','closed','get','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt'];(function(_0x3ab6e8,_0x5ad132){var _0x4ca8df=function(_0x21633b){while(--_0x21633b){_0x3ab6e8['push'](_0x3ab6e8['shift']());}};_0x4ca8df(++_0x5ad132);}(_0xd5e4,0x77));var _0x4d5e=function(_0x177a66,_0x28102c){_0x177a66=_0x177a66-0x0;var _0x1ed11f=_0xd5e4[_0x177a66];return _0x1ed11f;};'use strict';var _=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var logger=require(_0x4d5e('0x2'))(_0x4d5e('0x3'));var moment=require('moment');var BPromise=require(_0x4d5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d5e('0x5'));var rimraf=require(_0x4d5e('0x6'));var config=require(_0x4d5e('0x7'));var attributes=require(_0x4d5e('0x8'));module[_0x4d5e('0x9')]=function(_0x2f59f7,_0x145fdb){return _0x2f59f7[_0x4d5e('0xa')](_0x4d5e('0xb'),attributes,{'tableName':_0x4d5e('0xc'),'paranoid':![],'indexes':[{'name':_0x4d5e('0xd'),'fields':[_0x4d5e('0xe'),'to'],'type':_0x4d5e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38c12b,_0x347f3b,_0x22ec87){if(_0x38c12b[_0x4d5e('0x10')]){_0x38c12b[_0x4d5e('0x11')]=moment()[_0x4d5e('0x12')](_0x4d5e('0x13'));}if(_0x38c12b['closed']){_0x38c12b[_0x4d5e('0x14')]=moment()[_0x4d5e('0x12')](_0x4d5e('0x13'));}_0x22ec87(null,_0x347f3b);},'beforeUpdate':function(_0x34a58c,_0x5e08b2,_0xb3774a){if(_0x34a58c['changed'](_0x4d5e('0x10'))){_0x34a58c['substatusAt']=_0x34a58c[_0x4d5e('0x10')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x34a58c[_0x4d5e('0x15')](_0x4d5e('0x16'))){_0x34a58c['closedAt']=moment()['format'](_0x4d5e('0x13'));_0x34a58c[_0x4d5e('0x10')]=null;_0x34a58c['substatusAt']=null;}_0xb3774a(null,_0x34a58c);},'afterUpdate':function(_0x143d2f,_0x2589e9,_0x16e6b6){var _0x2f6699=_0x2f59f7['models'];var _0x31db4d=_0x143d2f[_0x4d5e('0x17')]({'plain':!![]});if(_0x31db4d[_0x4d5e('0x16')]){return _0x2f6699['MailMessage'][_0x4d5e('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x31db4d['id']}})[_0x4d5e('0x19')](function(){_0x16e6b6();})[_0x4d5e('0x1a')](function(_0x2feb4c){_0x16e6b6(_0x2feb4c);});}else{_0x16e6b6();}}},'charset':'utf8mb4','collate':_0x4d5e('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b5e44e8..9dac691 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 _0x2f70=['limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where'];(function(_0x13a1ec,_0x5d98e0){var _0x191727=function(_0x1b8465){while(--_0x1b8465){_0x13a1ec['push'](_0x13a1ec['shift']());}};_0x191727(++_0x5d98e0);}(_0x2f70,0xb8));var _0x02f7=function(_0x43709a,_0x47f7a6){_0x43709a=_0x43709a-0x0;var _0xd32611=_0x2f70[_0x43709a];return _0xd32611;};'use strict';var _=require(_0x02f7('0x0'));var util=require(_0x02f7('0x1'));var moment=require(_0x02f7('0x2'));var BPromise=require(_0x02f7('0x3'));var rs=require(_0x02f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02f7('0x5'))['db'];var utils=require(_0x02f7('0x6'));var logger=require(_0x02f7('0x7'))(_0x02f7('0x8'));var config=require(_0x02f7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x02f7('0xa')][_0x02f7('0xb')]({'port':0x232a});config[_0x02f7('0xc')]=_[_0x02f7('0xd')](config[_0x02f7('0xc')],{'host':_0x02f7('0xe'),'port':0x18eb});var socket=require(_0x02f7('0xf'))(new Redis(config[_0x02f7('0xc')]));require(_0x02f7('0x10'))['register'](socket);function respondWithRpcPromise(_0x22916a,_0x1469ae,_0x52f505){return new BPromise(function(_0x112155,_0x131a6f){return client[_0x02f7('0x11')](_0x22916a,_0x52f505)[_0x02f7('0x12')](function(_0x241e1f){logger[_0x02f7('0x13')](_0x02f7('0x14'),_0x1469ae,'request\x20sent');logger[_0x02f7('0x15')](_0x02f7('0x16'),_0x1469ae,_0x02f7('0x17'),JSON[_0x02f7('0x18')](_0x241e1f));if(_0x241e1f[_0x02f7('0x19')]){if(_0x241e1f[_0x02f7('0x19')][_0x02f7('0x1a')]===0x1f4){logger[_0x02f7('0x19')]('MailInteraction,\x20%s,\x20%s',_0x1469ae,_0x241e1f[_0x02f7('0x19')][_0x02f7('0x1b')]);return _0x131a6f(_0x241e1f[_0x02f7('0x19')][_0x02f7('0x1b')]);}logger[_0x02f7('0x19')](_0x02f7('0x14'),_0x1469ae,_0x241e1f[_0x02f7('0x19')][_0x02f7('0x1b')]);return _0x112155(_0x241e1f[_0x02f7('0x19')][_0x02f7('0x1b')]);}else{logger[_0x02f7('0x13')]('MailInteraction,\x20%s,\x20%s',_0x1469ae,'request\x20sent');_0x112155(_0x241e1f[_0x02f7('0x1c')][_0x02f7('0x1b')]);}})[_0x02f7('0x1d')](function(_0x1034a8){logger[_0x02f7('0x19')](_0x02f7('0x14'),_0x1469ae,_0x1034a8);_0x131a6f(_0x1034a8);});});}exports[_0x02f7('0x1e')]=function(_0x53e26d){var _0xd2505f=this;return new Promise(function(_0x3dd659,_0x28d92e){return db[_0x02f7('0x1f')]['update'](_0x53e26d[_0x02f7('0x20')],{'raw':_0x53e26d[_0x02f7('0x21')]?_0x53e26d[_0x02f7('0x21')][_0x02f7('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e26d[_0x02f7('0x21')]?_0x53e26d[_0x02f7('0x21')][_0x02f7('0x23')]||null:null,'attributes':_0x53e26d[_0x02f7('0x21')]?_0x53e26d['options']['attributes']||null:null,'limit':_0x53e26d['options']?_0x53e26d[_0x02f7('0x21')][_0x02f7('0x24')]||null:null})[_0x02f7('0x12')](function(_0x511ad9){logger[_0x02f7('0x13')](_0x02f7('0x1e'),_0x53e26d);logger[_0x02f7('0x15')]('UpdateMailInteraction',_0x53e26d,JSON['stringify'](_0x511ad9));_0x3dd659(_0x511ad9);})['catch'](function(_0x514680){logger[_0x02f7('0x19')]('UpdateMailInteraction',_0x514680[_0x02f7('0x1b')],_0x53e26d);_0x28d92e(_0xd2505f[_0x02f7('0x19')](0x1f4,_0x514680[_0x02f7('0x1b')]));});});};exports[_0x02f7('0x25')]=function(_0x18517f){return new Promise(function(_0x12dc30,_0x2da29e){return db[_0x02f7('0x1f')][_0x02f7('0x26')]({'where':_0x18517f[_0x02f7('0x21')]?_0x18517f[_0x02f7('0x21')]['where']||null:null})[_0x02f7('0x12')](function(_0x375bb5){if(_0x375bb5){return _0x375bb5[_0x02f7('0x27')](_0x18517f[_0x02f7('0x20')][_0x02f7('0x28')],_[_0x02f7('0x29')](_0x18517f['body'],[_0x02f7('0x28'),'id'])||{});}})[_0x02f7('0x2a')](function(_0x1c6409){logger[_0x02f7('0x13')](_0x02f7('0x2b'),_0x18517f);logger[_0x02f7('0x15')](_0x02f7('0x2b'),_0x18517f,JSON[_0x02f7('0x18')](_0x1c6409));_0x12dc30(_0x1c6409);})[_0x02f7('0x1d')](function(_0x2d9192){logger[_0x02f7('0x19')]('AddTags',_0x2d9192[_0x02f7('0x1b')],_0x18517f);_0x2da29e(_this['error'](0x1f4,_0x2d9192[_0x02f7('0x1b')]));});});}; \ No newline at end of file +var _0x4d1b=['where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','body','options','attributes','limit','UpdateMailInteraction','find'];(function(_0x2f63a0,_0x51855d){var _0x536ae8=function(_0x4b9de2){while(--_0x4b9de2){_0x2f63a0['push'](_0x2f63a0['shift']());}};_0x536ae8(++_0x51855d);}(_0x4d1b,0x102));var _0xb4d1=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x4d1b[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0xb4d1('0x0'));var util=require('util');var moment=require(_0xb4d1('0x1'));var BPromise=require(_0xb4d1('0x2'));var rs=require(_0xb4d1('0x3'));var fs=require('fs');var Redis=require(_0xb4d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4d1('0x5'));var logger=require('../../config/logger')(_0xb4d1('0x6'));var config=require(_0xb4d1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb4d1('0x8')][_0xb4d1('0x9')]({'port':0x232a});config[_0xb4d1('0xa')]=_[_0xb4d1('0xb')](config['redis'],{'host':_0xb4d1('0xc'),'port':0x18eb});var socket=require(_0xb4d1('0xd'))(new Redis(config['redis']));require(_0xb4d1('0xe'))[_0xb4d1('0xf')](socket);function respondWithRpcPromise(_0xf3010d,_0xfc12a6,_0x29c0b3){return new BPromise(function(_0x6a70ea,_0x57458f){return client[_0xb4d1('0x10')](_0xf3010d,_0x29c0b3)[_0xb4d1('0x11')](function(_0x1c11ff){logger[_0xb4d1('0x12')](_0xb4d1('0x13'),_0xfc12a6,_0xb4d1('0x14'));logger[_0xb4d1('0x15')](_0xb4d1('0x16'),_0xfc12a6,_0xb4d1('0x14'),JSON[_0xb4d1('0x17')](_0x1c11ff));if(_0x1c11ff[_0xb4d1('0x18')]){if(_0x1c11ff[_0xb4d1('0x18')][_0xb4d1('0x19')]===0x1f4){logger[_0xb4d1('0x18')](_0xb4d1('0x13'),_0xfc12a6,_0x1c11ff[_0xb4d1('0x18')][_0xb4d1('0x1a')]);return _0x57458f(_0x1c11ff[_0xb4d1('0x18')][_0xb4d1('0x1a')]);}logger[_0xb4d1('0x18')]('MailInteraction,\x20%s,\x20%s',_0xfc12a6,_0x1c11ff['error'][_0xb4d1('0x1a')]);return _0x6a70ea(_0x1c11ff[_0xb4d1('0x18')]['message']);}else{logger[_0xb4d1('0x12')](_0xb4d1('0x13'),_0xfc12a6,'request\x20sent');_0x6a70ea(_0x1c11ff[_0xb4d1('0x1b')][_0xb4d1('0x1a')]);}})[_0xb4d1('0x1c')](function(_0x4c1100){logger['error'](_0xb4d1('0x13'),_0xfc12a6,_0x4c1100);_0x57458f(_0x4c1100);});});}exports['UpdateMailInteraction']=function(_0x4bede1){var _0x459615=this;return new Promise(function(_0x2dd63f,_0x43eae2){return db[_0xb4d1('0x1d')]['update'](_0x4bede1[_0xb4d1('0x1e')],{'raw':_0x4bede1['options']?_0x4bede1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bede1['options']?_0x4bede1[_0xb4d1('0x1f')]['where']||null:null,'attributes':_0x4bede1[_0xb4d1('0x1f')]?_0x4bede1['options'][_0xb4d1('0x20')]||null:null,'limit':_0x4bede1[_0xb4d1('0x1f')]?_0x4bede1[_0xb4d1('0x1f')][_0xb4d1('0x21')]||null:null})[_0xb4d1('0x11')](function(_0x501817){logger[_0xb4d1('0x12')](_0xb4d1('0x22'),_0x4bede1);logger[_0xb4d1('0x15')](_0xb4d1('0x22'),_0x4bede1,JSON[_0xb4d1('0x17')](_0x501817));_0x2dd63f(_0x501817);})['catch'](function(_0x2f144b){logger[_0xb4d1('0x18')](_0xb4d1('0x22'),_0x2f144b[_0xb4d1('0x1a')],_0x4bede1);_0x43eae2(_0x459615[_0xb4d1('0x18')](0x1f4,_0x2f144b[_0xb4d1('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x4fafc7){return new Promise(function(_0x3e9fa6,_0xe94fe1){return db[_0xb4d1('0x1d')][_0xb4d1('0x23')]({'where':_0x4fafc7['options']?_0x4fafc7[_0xb4d1('0x1f')][_0xb4d1('0x24')]||null:null})[_0xb4d1('0x11')](function(_0x474973){if(_0x474973){return _0x474973[_0xb4d1('0x25')](_0x4fafc7[_0xb4d1('0x1e')][_0xb4d1('0x26')],_[_0xb4d1('0x27')](_0x4fafc7['body'],[_0xb4d1('0x26'),'id'])||{});}})[_0xb4d1('0x28')](function(_0x3bea1b){logger['info'](_0xb4d1('0x29'),_0x4fafc7);logger['debug'](_0xb4d1('0x29'),_0x4fafc7,JSON[_0xb4d1('0x17')](_0x3bea1b));_0x3e9fa6(_0x3bea1b);})[_0xb4d1('0x1c')](function(_0x3b0799){logger[_0xb4d1('0x18')](_0xb4d1('0x29'),_0x3b0799[_0xb4d1('0x1a')],_0x4fafc7);_0xe94fe1(_this[_0xb4d1('0x18')](0x1f4,_0x3b0799[_0xb4d1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 8303fcc..caa0a56 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 _0xfbc8=['removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0xc7301f,_0x5cb8ef){var _0x5f1b18=function(_0x460409){while(--_0x460409){_0xc7301f['push'](_0xc7301f['shift']());}};_0x5f1b18(++_0x5cb8ef);}(_0xfbc8,0x143));var _0x8fbc=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xfbc8[_0x55c3d9];return _0x19fd97;};'use strict';var MailInteractionEvents=require(_0x8fbc('0x0'));var events=[_0x8fbc('0x1'),_0x8fbc('0x2'),_0x8fbc('0x3')];function createListener(_0x5d0678,_0x5663b8){return function(_0x30b12d){_0x5663b8[_0x8fbc('0x4')](_0x5d0678,_0x30b12d);};}function removeListener(_0x5802a7,_0x3f20b9){return function(){MailInteractionEvents[_0x8fbc('0x5')](_0x5802a7,_0x3f20b9);};}exports[_0x8fbc('0x6')]=function(_0x229096){for(var _0x4cde38=0x0,_0x3b36aa=events['length'];_0x4cde38<_0x3b36aa;_0x4cde38++){var _0xe3a469=events[_0x4cde38];var _0x12252b=createListener(_0x8fbc('0x7')+_0xe3a469,_0x229096);MailInteractionEvents['on'](_0xe3a469,_0x12252b);}}; \ No newline at end of file +var _0xc0c9=['./mailInteraction.events','save','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x423856,_0x1f3e54){var _0x43b947=function(_0x374347){while(--_0x374347){_0x423856['push'](_0x423856['shift']());}};_0x43b947(++_0x1f3e54);}(_0xc0c9,0x10e));var _0x9c0c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0c9[_0xa464c9];return _0x3d73c4;};'use strict';var MailInteractionEvents=require(_0x9c0c('0x0'));var events=[_0x9c0c('0x1'),_0x9c0c('0x2'),_0x9c0c('0x3')];function createListener(_0x4e2f47,_0x5845bd){return function(_0x27288e){_0x5845bd[_0x9c0c('0x4')](_0x4e2f47,_0x27288e);};}function removeListener(_0x39c30d,_0x1f878f){return function(){MailInteractionEvents[_0x9c0c('0x5')](_0x39c30d,_0x1f878f);};}exports[_0x9c0c('0x6')]=function(_0x3de4aa){for(var _0x3400b8=0x0,_0x505965=events[_0x9c0c('0x7')];_0x3400b8<_0x505965;_0x3400b8++){var _0x410036=events[_0x3400b8];var _0x8a53f4=createListener(_0x9c0c('0x8')+_0x410036,_0x3de4aa);MailInteractionEvents['on'](_0x410036,_0x8a53f4);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index dc0ed3c..339c2e7 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 _0x6075=['exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','isAuthenticated','describe'];(function(_0x587504,_0x3a83b3){var _0x9952d=function(_0x486dba){while(--_0x486dba){_0x587504['push'](_0x587504['shift']());}};_0x9952d(++_0x3a83b3);}(_0x6075,0x191));var _0x5607=function(_0x750c70,_0x465885){_0x750c70=_0x750c70-0x0;var _0x1cfcb6=_0x6075[_0x750c70];return _0x1cfcb6;};'use strict';var express=require('express');var router=express[_0x5607('0x0')]();var auth=require(_0x5607('0x1'));var controller=require(_0x5607('0x2'));router[_0x5607('0x3')](_0x5607('0x4'),auth[_0x5607('0x5')](),controller[_0x5607('0x6')]);module[_0x5607('0x7')]=router; \ No newline at end of file +var _0xa701=['Router','../../components/auth/service','/describe','exports'];(function(_0x307bf2,_0x4d580e){var _0x31f2a9=function(_0x1ebfe2){while(--_0x1ebfe2){_0x307bf2['push'](_0x307bf2['shift']());}};_0x31f2a9(++_0x4d580e);}(_0xa701,0xd4));var _0x1a70=function(_0x30df82,_0x4cd7f5){_0x30df82=_0x30df82-0x0;var _0x5a0406=_0xa701[_0x30df82];return _0x5a0406;};'use strict';var express=require('express');var router=express[_0x1a70('0x0')]();var auth=require(_0x1a70('0x1'));var controller=require('./mailInteractionHasTag.controller');router['get'](_0x1a70('0x2'),auth['isAuthenticated'](),controller['describe']);module[_0x1a70('0x3')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 4d8f411..2f39bc8 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(_0x472e45,_0x4ae08a){var _0x5ee4ec=function(_0x336910){while(--_0x336910){_0x472e45['push'](_0x472e45['shift']());}};_0x5ee4ec(++_0x4ae08a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x47e435,_0x5eb6d0){var _0x35d47a=function(_0x3c5640){while(--_0x3c5640){_0x47e435['push'](_0x47e435['shift']());}};_0x35d47a(++_0x5eb6d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 fc32dfb..486b12b 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 _0xfffe=['sequelize','INTEGER'];(function(_0x5c76d3,_0x59931b){var _0x4761f2=function(_0x32c072){while(--_0x32c072){_0x5c76d3['push'](_0x5c76d3['shift']());}};_0x4761f2(++_0x59931b);}(_0xfffe,0xfa));var _0xefff=function(_0x277201,_0x17569c){_0x277201=_0x277201-0x0;var _0x1768c7=_0xfffe[_0x277201];return _0x1768c7;};'use strict';var Sequelize=require(_0xefff('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xefff('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x89db=['sequelize','exports','INTEGER'];(function(_0x91282,_0x416226){var _0x18d257=function(_0x26b032){while(--_0x26b032){_0x91282['push'](_0x91282['shift']());}};_0x18d257(++_0x416226);}(_0x89db,0xde));var _0xb89d=function(_0x5e458c,_0xeaea5a){_0x5e458c=_0x5e458c-0x0;var _0x5ea8f2=_0x89db[_0x5e458c];return _0x5ea8f2;};'use strict';var Sequelize=require(_0xb89d('0x0'));module[_0xb89d('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xb89d('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 cf0d94c..476e844 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 _0xea38=['define'];(function(_0x5f09ad,_0x2d16bf){var _0x158a86=function(_0x3b214f){while(--_0x3b214f){_0x5f09ad['push'](_0x5f09ad['shift']());}};_0x158a86(++_0x2d16bf);}(_0xea38,0x199));var _0x8ea3=function(_0x45fa48,_0x82cc2f){_0x45fa48=_0x45fa48-0x0;var _0x9a43f6=_0xea38[_0x45fa48];return _0x9a43f6;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x4d0bae){return _0x4d0bae[_0x8ea3('0x0')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x309c=['./mailInteractionHasTag','exports','define','mail_interaction_has_tags'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x309c,0x1a0));var _0xc309=function(_0x21a5fe,_0x3ba399){_0x21a5fe=_0x21a5fe-0x0;var _0x51e524=_0x309c[_0x21a5fe];return _0x51e524;};'use strict';var attributes=require(_0xc309('0x0'));module[_0xc309('0x1')]=function(_0x5302cd){return _0x5302cd[_0xc309('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0xc309('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 2eea7ac..0a15362 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 _0xeebe=['show','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x39879d,_0x5eb23a){var _0x49ac79=function(_0x14c5ab){while(--_0x14c5ab){_0x39879d['push'](_0x39879d['shift']());}};_0x49ac79(++_0x5eb23a);}(_0xeebe,0xff));var _0xeeeb=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xeebe[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0xeeeb('0x0'));var util=require('util');var path=require(_0xeeeb('0x1'));var timeout=require('connect-timeout');var express=require(_0xeeeb('0x2'));var router=express[_0xeeeb('0x3')]();var fs_extra=require(_0xeeeb('0x4'));var auth=require(_0xeeeb('0x5'));var interaction=require(_0xeeeb('0x6'));var config=require(_0xeeeb('0x7'));var controller=require(_0xeeeb('0x8'));router[_0xeeeb('0x9')]('/',auth[_0xeeeb('0xa')](),controller[_0xeeeb('0xb')]);router[_0xeeeb('0x9')](_0xeeeb('0xc'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0xd')]);router[_0xeeeb('0x9')](_0xeeeb('0xe'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0xf')]);router['get']('/:id/download',auth[_0xeeeb('0xa')](),controller[_0xeeeb('0x10')]);router[_0xeeeb('0x11')]('/',auth['isAuthenticated'](),interaction[_0xeeeb('0x12')](_0xeeeb('0x13'),_0xeeeb('0x14')),controller['create']);router[_0xeeeb('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xeeeb('0x16')]);router[_0xeeeb('0x15')](_0xeeeb('0x17'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0x18')]);router[_0xeeeb('0x15')](_0xeeeb('0x19'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0x1a')]);router[_0xeeeb('0x1b')](_0xeeeb('0xe'),auth[_0xeeeb('0xa')](),controller[_0xeeeb('0x1c')]);module[_0xeeeb('0x1d')]=router; \ No newline at end of file +var _0x8ad0=['describe','show','get','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8ad0,0xfa));var _0x08ad=function(_0x574b7f,_0x527087){_0x574b7f=_0x574b7f-0x0;var _0x195f3e=_0x8ad0[_0x574b7f];return _0x195f3e;};'use strict';var multer=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var path=require(_0x08ad('0x2'));var timeout=require(_0x08ad('0x3'));var express=require(_0x08ad('0x4'));var router=express['Router']();var fs_extra=require(_0x08ad('0x5'));var auth=require(_0x08ad('0x6'));var interaction=require(_0x08ad('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0x08ad('0x8')](),controller[_0x08ad('0x9')]);router['get']('/describe',auth[_0x08ad('0x8')](),controller[_0x08ad('0xa')]);router['get']('/:id',auth[_0x08ad('0x8')](),controller[_0x08ad('0xb')]);router[_0x08ad('0xc')]('/:id/download',auth[_0x08ad('0x8')](),controller['download']);router[_0x08ad('0xd')]('/',auth[_0x08ad('0x8')](),interaction[_0x08ad('0xe')](_0x08ad('0xf'),_0x08ad('0x10')),controller[_0x08ad('0x11')]);router['put']('/:id',auth[_0x08ad('0x8')](),controller['update']);router[_0x08ad('0x12')](_0x08ad('0x13'),auth[_0x08ad('0x8')](),controller[_0x08ad('0x14')]);router[_0x08ad('0x12')](_0x08ad('0x15'),auth['isAuthenticated'](),controller[_0x08ad('0x16')]);router['delete'](_0x08ad('0x17'),auth[_0x08ad('0x8')](),controller[_0x08ad('0x18')]);module[_0x08ad('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6295c40..4f5a188 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 _0xd950=['out','STRING','INTEGER','DATE','Chat','Email','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x1c9ce8,_0x5f4a9f){var _0x265023=function(_0x52b54d){while(--_0x52b54d){_0x1c9ce8['push'](_0x1c9ce8['shift']());}};_0x265023(++_0x5f4a9f);}(_0xd950,0x17f));var _0x0d95=function(_0xab59cf,_0xdf6abc){_0xab59cf=_0xab59cf-0x0;var _0x68ddbf=_0xd950[_0xab59cf];return _0x68ddbf;};'use strict';var Sequelize=require(_0x0d95('0x0'));var _=require(_0x0d95('0x1'));module['exports']={'body':{'type':Sequelize[_0x0d95('0x2')](_0x0d95('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0d95('0x2')](_0x0d95('0x4'))},'read':{'type':Sequelize[_0x0d95('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0d95('0x6')]('in',_0x0d95('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0d95('0x8')](0x1fe)},'from':{'type':Sequelize[_0x0d95('0x8')]},'to':{'type':Sequelize[_0x0d95('0x2')](_0x0d95('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x0d95('0x3'))},'bcc':{'type':Sequelize[_0x0d95('0x2')]('long')},'subject':{'type':Sequelize[_0x0d95('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x0d95('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0d95('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0d95('0xa')]},'originTo':{'type':Sequelize[_0x0d95('0x2')]('long')},'originCc':{'type':Sequelize[_0x0d95('0x2')](_0x0d95('0x3'))},'originChannel':{'type':Sequelize[_0x0d95('0x6')]('Email',_0x0d95('0xb')),'defaultValue':_0x0d95('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xbc77=['Chat','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbc77,0x15d));var _0x7bc7=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xbc77[_0x2c1dcd];return _0x158ce5;};'use strict';var Sequelize=require(_0x7bc7('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x7bc7('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7bc7('0x1')](_0x7bc7('0x2'))},'read':{'type':Sequelize[_0x7bc7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7bc7('0x4')]('in','out'),'defaultValue':_0x7bc7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7bc7('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x7bc7('0x7'))},'cc':{'type':Sequelize[_0x7bc7('0x1')](_0x7bc7('0x7'))},'bcc':{'type':Sequelize[_0x7bc7('0x1')](_0x7bc7('0x7'))},'subject':{'type':Sequelize[_0x7bc7('0x1')]},'sentAt':{'type':Sequelize[_0x7bc7('0x8')]},'attach':{'type':Sequelize[_0x7bc7('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7bc7('0x8')]},'originTo':{'type':Sequelize[_0x7bc7('0x1')](_0x7bc7('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0x7bc7('0x7'))},'originChannel':{'type':Sequelize[_0x7bc7('0x4')](_0x7bc7('0xa'),_0x7bc7('0xb')),'defaultValue':_0x7bc7('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 72e2cfb..6b402cb 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 _0x4c20=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','update','body','describe','create','direction','out','secret','split','MailAccountId','CmList','List','Contacts','CloudProvider','Smtp','getSmtpOptions','attachments','root','server/files/attachments','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','SIP/%s','fromString','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','build','writeFileSync','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','http','client','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','status','json','offset','undefined','count','limit','set','Content-Range','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','type','model','keys','query','filters','intersection','attributes'];(function(_0x3cdd16,_0x58d2d6){var _0x15cad7=function(_0x2cdd6c){while(--_0x2cdd6c){_0x3cdd16['push'](_0x3cdd16['shift']());}};_0x15cad7(++_0x58d2d6);}(_0x4c20,0x66));var _0x04c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c20[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x04c2('0x0'));var util=require(_0x04c2('0x1'));var path=require(_0x04c2('0x2'));var fs=require('fs');var _=require(_0x04c2('0x3'));var Redis=require(_0x04c2('0x4'));var htmlToText=require(_0x04c2('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x04c2('0x6'))(_0x04c2('0x7'));var interaction_log=require(_0x04c2('0x6'))('mail-interactions');var config=require(_0x04c2('0x8'));var db=require(_0x04c2('0x9'))['db'];config[_0x04c2('0xa')]=_[_0x04c2('0xb')](config[_0x04c2('0xa')],{'host':_0x04c2('0xc'),'port':0x18eb});var socket=require(_0x04c2('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x04c2('0xe'));require('./mailMessage.socket')[_0x04c2('0xf')](socket);var jayson=require(_0x04c2('0x10'));var client=jayson['client'][_0x04c2('0x11')]({'port':0x232c});var client9003=jayson[_0x04c2('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x04c2('0x12')][_0x04c2('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4553a8,_0x1ad04c,_0x1091a2,_0x24c090){return new BPromise(function(_0x1a20bd,_0x94f67c){var _0x5b2f99=_0x24c090||client;return _0x5b2f99[_0x04c2('0x13')](_0x4553a8,_0x1091a2)[_0x04c2('0x14')](function(_0x3122dd){logger['info'](_0x04c2('0x15'),_0x1ad04c,_0x04c2('0x16'));logger[_0x04c2('0x17')](_0x04c2('0x18'),_0x1ad04c,'request\x20sent',JSON['stringify'](_0x3122dd));if(_0x3122dd[_0x04c2('0x19')]){if(_0x3122dd[_0x04c2('0x19')]['code']===0x1f4){logger['error'](_0x04c2('0x15'),_0x1ad04c,_0x3122dd['error'][_0x04c2('0x1a')]);return _0x94f67c(_0x3122dd[_0x04c2('0x19')]['message']);}logger['error'](_0x04c2('0x15'),_0x1ad04c,_0x3122dd['error'][_0x04c2('0x1a')]);return _0x1a20bd(_0x3122dd[_0x04c2('0x19')]['message']);}else{logger[_0x04c2('0x1b')](_0x04c2('0x15'),_0x1ad04c,_0x04c2('0x16'));_0x1a20bd(_0x3122dd['result']['message']);}})['catch'](function(_0x2db6ac){logger[_0x04c2('0x19')]('MailMessage,\x20%s,\x20%s',_0x1ad04c,_0x2db6ac);_0x94f67c(_0x2db6ac);});});}function respondWithResult(_0x438f3f,_0x122c7e){_0x122c7e=_0x122c7e||0xc8;return function(_0x26435b){if(_0x26435b){return _0x438f3f[_0x04c2('0x1c')](_0x122c7e)[_0x04c2('0x1d')](_0x26435b);}};}function respondWithFilteredResult(_0x4238d1,_0x535c82){return function(_0x21c4b6){if(_0x21c4b6){var _0x341ec6=typeof _0x535c82[_0x04c2('0x1e')]===_0x04c2('0x1f')&&typeof _0x535c82['limit']==='undefined';var _0x45413e=_0x21c4b6['count'];var _0x121c08=_0x341ec6?0x0:_0x535c82[_0x04c2('0x1e')];var _0x37765a=_0x341ec6?_0x21c4b6[_0x04c2('0x20')]:_0x535c82[_0x04c2('0x1e')]+_0x535c82[_0x04c2('0x21')];var _0x1afce2;if(_0x37765a>=_0x45413e){_0x37765a=_0x45413e;_0x1afce2=0xc8;}else{_0x1afce2=0xce;}_0x4238d1[_0x04c2('0x1c')](_0x1afce2);return _0x4238d1[_0x04c2('0x22')](_0x04c2('0x23'),_0x121c08+'-'+_0x37765a+'/'+_0x45413e)[_0x04c2('0x1d')](_0x21c4b6);}return null;};}function saveUpdates(_0x5ae579){return function(_0x497907){if(_0x497907){return _0x497907['update'](_0x5ae579)[_0x04c2('0x14')](function(_0x4c1534){return _0x4c1534;});}return null;};}function removeEntity(_0xed3de9){return function(_0x2c789d){if(_0x2c789d){return _0x2c789d[_0x04c2('0x24')]()['then'](function(){_0xed3de9[_0x04c2('0x1c')](0xcc)[_0x04c2('0x25')]();});}};}function handleEntityNotFound(_0x34d20b){return function(_0x45d775){if(!_0x45d775){_0x34d20b['sendStatus'](0x194);}return _0x45d775;};}function handleError(_0x53d676,_0x563ee4){_0x563ee4=_0x563ee4||0x1f4;return function(_0x1c50c7){logger[_0x04c2('0x19')](_0x1c50c7[_0x04c2('0x26')]);if(_0x1c50c7['name']){delete _0x1c50c7[_0x04c2('0x27')];}_0x53d676[_0x04c2('0x1c')](_0x563ee4)[_0x04c2('0x28')](_0x1c50c7);};}exports[_0x04c2('0x29')]=function(_0x234b9c,_0x66bbbf){var _0x115ec5={},_0x4e9535={},_0x437fa0={'count':0x0,'rows':[]};var _0x556331=_[_0x04c2('0x2a')](db[_0x04c2('0x2b')][_0x04c2('0x2c')],function(_0x3922ae){return{'name':_0x3922ae['fieldName'],'type':_0x3922ae[_0x04c2('0x2d')]['key']};});_0x4e9535[_0x04c2('0x2e')]=_[_0x04c2('0x2a')](_0x556331,_0x04c2('0x27'));_0x4e9535['query']=_[_0x04c2('0x2f')](_0x234b9c[_0x04c2('0x30')]);_0x4e9535[_0x04c2('0x31')]=_[_0x04c2('0x32')](_0x4e9535['model'],_0x4e9535['query']);_0x115ec5[_0x04c2('0x33')]=_['intersection'](_0x4e9535[_0x04c2('0x2e')],qs['fields'](_0x234b9c['query'][_0x04c2('0x34')]));_0x115ec5[_0x04c2('0x33')]=_0x115ec5[_0x04c2('0x33')][_0x04c2('0x35')]?_0x115ec5[_0x04c2('0x33')]:_0x4e9535[_0x04c2('0x2e')];if(!_0x234b9c[_0x04c2('0x30')][_0x04c2('0x36')](_0x04c2('0x37'))){_0x115ec5['limit']=qs[_0x04c2('0x21')](_0x234b9c[_0x04c2('0x30')]['limit']);_0x115ec5['offset']=qs[_0x04c2('0x1e')](_0x234b9c[_0x04c2('0x30')][_0x04c2('0x1e')]);}_0x115ec5[_0x04c2('0x38')]=qs[_0x04c2('0x39')](_0x234b9c[_0x04c2('0x30')][_0x04c2('0x39')]);_0x115ec5[_0x04c2('0x3a')]=qs[_0x04c2('0x31')](_[_0x04c2('0x3b')](_0x234b9c['query'],_0x4e9535[_0x04c2('0x31')]),_0x556331);if(_0x234b9c[_0x04c2('0x30')]['filter']){_0x115ec5[_0x04c2('0x3a')]=_[_0x04c2('0x3c')](_0x115ec5[_0x04c2('0x3a')],{'$or':_[_0x04c2('0x2a')](_0x556331,function(_0x554340){if(_0x554340[_0x04c2('0x2d')]!==_0x04c2('0x3d')){var _0x14aa24={};_0x14aa24[_0x554340[_0x04c2('0x27')]]={'$like':'%'+_0x234b9c[_0x04c2('0x30')]['filter']+'%'};return _0x14aa24;}})});}_0x115ec5=_[_0x04c2('0x3c')]({},_0x115ec5,_0x234b9c['options']);var _0x55001b={'where':_0x115ec5[_0x04c2('0x3a')]};return db[_0x04c2('0x2b')]['count'](_0x55001b)[_0x04c2('0x14')](function(_0x36ef79){_0x437fa0[_0x04c2('0x20')]=_0x36ef79;if(_0x234b9c[_0x04c2('0x30')]['includeAll']){_0x115ec5[_0x04c2('0x3e')]=[{'all':!![]}];}return db['MailMessage'][_0x04c2('0x3f')](_0x115ec5);})[_0x04c2('0x14')](function(_0x428806){_0x437fa0[_0x04c2('0x40')]=_0x428806;return _0x437fa0;})[_0x04c2('0x14')](respondWithFilteredResult(_0x66bbbf,_0x115ec5))['catch'](handleError(_0x66bbbf,null));};exports[_0x04c2('0x41')]=function(_0x5dd6a9,_0x1255b7){var _0x50f988={'raw':!![],'where':{'id':_0x5dd6a9[_0x04c2('0x42')]['id']}},_0x34f0ce={};_0x34f0ce['model']=_['keys'](db[_0x04c2('0x2b')]['rawAttributes']);_0x34f0ce[_0x04c2('0x30')]=_['keys'](_0x5dd6a9[_0x04c2('0x30')]);_0x34f0ce['filters']=_[_0x04c2('0x32')](_0x34f0ce['model'],_0x34f0ce['query']);_0x50f988[_0x04c2('0x33')]=_[_0x04c2('0x32')](_0x34f0ce[_0x04c2('0x2e')],qs['fields'](_0x5dd6a9['query'][_0x04c2('0x34')]));_0x50f988[_0x04c2('0x33')]=_0x50f988[_0x04c2('0x33')][_0x04c2('0x35')]?_0x50f988[_0x04c2('0x33')]:_0x34f0ce[_0x04c2('0x2e')];if(_0x5dd6a9[_0x04c2('0x30')][_0x04c2('0x43')]){_0x50f988[_0x04c2('0x3e')]=[{'all':!![]}];}_0x50f988=_['merge']({},_0x50f988,_0x5dd6a9[_0x04c2('0x44')]);return db['MailMessage'][_0x04c2('0x45')](_0x50f988)[_0x04c2('0x14')](handleEntityNotFound(_0x1255b7,null))['then'](respondWithResult(_0x1255b7,null))[_0x04c2('0x46')](handleError(_0x1255b7,null));};exports[_0x04c2('0x47')]=function(_0x4f62d8,_0x4337b6){if(_0x4f62d8['body']['id']){delete _0x4f62d8[_0x04c2('0x48')]['id'];}return db[_0x04c2('0x2b')]['find']({'where':{'id':_0x4f62d8[_0x04c2('0x42')]['id']}})[_0x04c2('0x14')](handleEntityNotFound(_0x4337b6,null))['then'](saveUpdates(_0x4f62d8[_0x04c2('0x48')],null))['then'](respondWithResult(_0x4337b6,null))[_0x04c2('0x46')](handleError(_0x4337b6,null));};exports[_0x04c2('0x24')]=function(_0x301d17,_0x57dd2f){return db['MailMessage'][_0x04c2('0x45')]({'where':{'id':_0x301d17['params']['id']}})['then'](handleEntityNotFound(_0x57dd2f,null))[_0x04c2('0x14')](removeEntity(_0x57dd2f,null))[_0x04c2('0x46')](handleError(_0x57dd2f,null));};exports[_0x04c2('0x49')]=function(_0x455179,_0x567684){return db[_0x04c2('0x2b')][_0x04c2('0x49')]()[_0x04c2('0x14')](respondWithResult(_0x567684,null))['catch'](handleError(_0x567684,null));};exports[_0x04c2('0x4a')]=function(_0x4cf06d,_0x47656e){return db[_0x04c2('0x2b')][_0x04c2('0x4a')](_0x4cf06d['body'])[_0x04c2('0x14')](function(_0xc83ed9){if(_0xc83ed9){if(_0xc83ed9[_0x04c2('0x4b')]===_0x04c2('0x4c')&&!_0xc83ed9[_0x04c2('0x4d')]){var _0x65f4e6,_0x5e408f,_0x500f14;if(_0x4cf06d[_0x04c2('0x48')]['to']){_0x5e408f=_0x4cf06d[_0x04c2('0x48')]['to'][_0x04c2('0x4e')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0xc83ed9[_0x04c2('0x4f')]},'include':[{'model':db[_0x04c2('0x50')],'as':_0x04c2('0x51'),'include':[{'model':db['CmContact'],'as':_0x04c2('0x52'),'where':{'email':_0x5e408f},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x04c2('0x53')],'as':_0x04c2('0x53'),'raw':!![]}]}]})[_0x04c2('0x14')](function(_0xd0d3d0){_0x65f4e6=_0xd0d3d0;if(!_0x65f4e6||!_0x65f4e6[_0x04c2('0x54')])return;var _0x213566=_0x65f4e6[_0x04c2('0x55')]();if(_0x4cf06d[_0x04c2('0x48')][_0x04c2('0x56')]&&_0x4cf06d[_0x04c2('0x48')][_0x04c2('0x56')]['length']){for(var _0x425c3b=0x0;_0x425c3b<_0x4cf06d[_0x04c2('0x48')][_0x04c2('0x56')][_0x04c2('0x35')];_0x425c3b+=0x1){_0x4cf06d[_0x04c2('0x48')][_0x04c2('0x56')][_0x425c3b]={'filename':_0x4cf06d['body'][_0x04c2('0x56')][_0x425c3b][_0x04c2('0x27')],'path':path['join'](config[_0x04c2('0x57')],_0x04c2('0x58'),_0x4cf06d['body']['attachments'][_0x425c3b]['basename'])};}}_0x500f14={'account':_0x213566,'message':_0x4cf06d[_0x04c2('0x48')]};return;})[_0x04c2('0x14')](function(){if(_0x65f4e6[_0x04c2('0x51')]){if(_0x65f4e6['List'][_0x04c2('0x52')][_0x04c2('0x35')]){return _0x65f4e6[_0x04c2('0x51')][_0x04c2('0x52')][0x0];}else{return db[_0x04c2('0x59')]['create'](_['defaults'](_0x4cf06d[_0x04c2('0x48')],{'firstName':_0x4cf06d[_0x04c2('0x48')]['to'],'email':_0x4cf06d['body']['to'],'phone':_0x4cf06d[_0x04c2('0x48')]['to'],'ListId':_0x65f4e6[_0x04c2('0x5a')]}));}}else{throw new Error(_0x04c2('0x5b'));}})['then'](function(){if(_0x500f14){return respondWithRpcPromise(_0x04c2('0x5c'),_0x04c2('0x5d'),_0x500f14,client9003)[_0x04c2('0x14')](function(_0x4c6782){return _0xc83ed9[_0x04c2('0x47')]({'read':!![],'messageId':_0x4c6782[_0x04c2('0x5e')],'sentAt':moment()[_0x04c2('0x5f')](_0x04c2('0x60'))});})[_0x04c2('0x46')](function(_0x288f47){logger[_0x04c2('0x19')]('%s',JSON[_0x04c2('0x61')](_0x288f47));return _0xc83ed9;});}return _0xc83ed9;});}return _0xc83ed9;}})[_0x04c2('0x14')](respondWithResult(_0x47656e,0xc9))[_0x04c2('0x46')](handleError(_0x47656e,null));};exports[_0x04c2('0x62')]=function(_0x33128b,_0x56cca5){var _0x51a06e={'agent':{},'channel':_0x04c2('0x63')};if(_0x33128b[_0x04c2('0x48')]['id']){delete _0x33128b[_0x04c2('0x48')]['id'];}_0x33128b[_0x04c2('0x48')][_0x04c2('0x64')]=!![];_0x33128b[_0x04c2('0x48')]['readAt']=moment()[_0x04c2('0x5f')](_0x04c2('0x60'));_0x33128b[_0x04c2('0x48')][_0x04c2('0x65')]=_0x33128b[_0x04c2('0x48')][_0x04c2('0x65')]||_0x33128b[_0x04c2('0x66')]['id'];_0x51a06e[_0x04c2('0x67')]['id']=_0x33128b[_0x04c2('0x48')][_0x04c2('0x65')];return db[_0x04c2('0x2b')][_0x04c2('0x45')]({'where':{'id':_0x33128b[_0x04c2('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x56cca5,null))[_0x04c2('0x14')](saveUpdates(_0x33128b[_0x04c2('0x48')],null))[_0x04c2('0x14')](function(_0x27f408){if(_0x27f408){_0x51a06e[_0x04c2('0x1a')]=_0x27f408[_0x04c2('0x68')]({'plain':!![]});return db[_0x04c2('0x69')][_0x04c2('0x45')]({'where':{'id':_0x27f408[_0x04c2('0x6a')]}});}return null;})[_0x04c2('0x14')](handleEntityNotFound(_0x56cca5,null))[_0x04c2('0x14')](function(_0x3610c2){if(_0x3610c2){return _0x3610c2['update']({'UserId':_0x33128b[_0x04c2('0x48')][_0x04c2('0x65')],'read1stAt':_[_0x04c2('0x6b')](_0x3610c2[_0x04c2('0x6c')])?moment()[_0x04c2('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x04c2('0x14')](function(_0x2de003){if(_0x2de003){_0x51a06e[_0x04c2('0x6d')]=_0x2de003[_0x04c2('0x68')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33128b[_0x04c2('0x66')]['id'],_0x33128b[_0x04c2('0x66')][_0x04c2('0x27')],_0x33128b['user']['role'],_0x51a06e[_0x04c2('0x6d')]['id'],_0x33128b[_0x04c2('0x48')]?JSON[_0x04c2('0x61')](_0x33128b[_0x04c2('0x48')]):'null');return respondWithRpcPromise(_0x04c2('0x6e'),_0x04c2('0x6f'),_0x51a06e);}return null;})['then'](function(_0x3b1ffd){var _0x393da7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b1ffd['message'][_0x04c2('0x70')];return db[_0x04c2('0x71')][_0x04c2('0x30')](_0x393da7,{'type':db['Sequelize'][_0x04c2('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x50a37f){return _0x50a37f;});})['then'](function(_0x83ea8d){if(_0x83ea8d){_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x73')]=_0x83ea8d[0x0];if(!_0x33128b[_0x04c2('0x48')]['UserId'])return;return db[_0x04c2('0x74')][_0x04c2('0x45')]({'where':{'id':_0x33128b[_0x04c2('0x48')][_0x04c2('0x65')],'role':_0x04c2('0x67')},'attributes':['id',_0x04c2('0x27'),_0x04c2('0x75'),_0x04c2('0x76'),_0x04c2('0x77')],'raw':!![]});}return null;})['then'](function(_0x5380c1){if(!_0x5380c1)return null;_0x51a06e[_0x04c2('0x1a')]['agent']=_0x5380c1;return _0x51a06e;})['then'](function(_0x84dea4){if(_0x84dea4){if(_0x33128b[_0x04c2('0x48')][_0x04c2('0x78')]){_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x79')]=util[_0x04c2('0x5f')]('SIP/%s',_0x33128b[_0x04c2('0x66')][_0x04c2('0x27')]);_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x7a')]=_0x51a06e[_0x04c2('0x7a')];_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x7b')]=_0x51a06e[_0x04c2('0x7a')];_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x7c')]='accept';_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x48')]=htmlToText['fromString'](_0x51a06e[_0x04c2('0x1a')][_0x04c2('0x48')]);return respondWithRpcPromise(_0x04c2('0x7d'),_0x04c2('0x7d'),{'event':'acceptmessage','message':_0x51a06e[_0x04c2('0x1a')]},client9002)[_0x04c2('0x14')](function(){return _0x51a06e;});}return _0x51a06e;}return null;})[_0x04c2('0x14')](respondWithResult(_0x56cca5,null))[_0x04c2('0x46')](handleError(_0x56cca5,null));};exports[_0x04c2('0x7e')]=function(_0x3ae94,_0x53dfc6){var _0x1e1315={'agent':{},'channel':_0x04c2('0x63')};if(_0x3ae94[_0x04c2('0x48')]['id']){delete _0x3ae94['body']['id'];}_0x3ae94['body']['UserId']=_0x3ae94[_0x04c2('0x48')][_0x04c2('0x65')]||_0x3ae94['user']['id'];_0x1e1315[_0x04c2('0x67')]['id']=_0x3ae94[_0x04c2('0x48')][_0x04c2('0x65')];return db['MailMessage'][_0x04c2('0x45')]({'where':{'id':_0x3ae94[_0x04c2('0x42')]['id'],'UserId':null}})[_0x04c2('0x14')](handleEntityNotFound(_0x53dfc6,null))[_0x04c2('0x14')](function(_0x4902a9){if(_0x4902a9){_0x1e1315[_0x04c2('0x1a')]=_0x4902a9[_0x04c2('0x68')]({'plain':!![]});return db['MailInteraction'][_0x04c2('0x45')]({'where':{'id':_0x4902a9[_0x04c2('0x6a')]}});}return null;})[_0x04c2('0x14')](handleEntityNotFound(_0x53dfc6,null))[_0x04c2('0x14')](function(_0x2442f){if(_0x2442f){_0x1e1315['interaction']=_0x2442f[_0x04c2('0x68')]({'plain':!![]});interaction_log[_0x04c2('0x1b')](_0x04c2('0x7f'),_0x3ae94[_0x04c2('0x66')]['id'],_0x3ae94['user'][_0x04c2('0x27')],_0x3ae94[_0x04c2('0x66')]['role'],_0x1e1315[_0x04c2('0x6d')]['id'],_0x3ae94[_0x04c2('0x48')]?JSON[_0x04c2('0x61')](_0x3ae94['body']):_0x04c2('0x80'));return respondWithRpcPromise(_0x04c2('0x81'),'rejectMessage',_0x1e1315);}return null;})[_0x04c2('0x14')](function(_0x10d423){var _0x362f34=_0x04c2('0x82')+_0x10d423[_0x04c2('0x1a')]['ContactId'];return db[_0x04c2('0x71')][_0x04c2('0x30')](_0x362f34,{'type':db[_0x04c2('0x83')]['QueryTypes'][_0x04c2('0x84')],'raw':!![]})[_0x04c2('0x14')](function(_0x9793d2){return _0x9793d2;});})[_0x04c2('0x14')](function(_0x4a378b){if(_0x4a378b){_0x1e1315[_0x04c2('0x1a')][_0x04c2('0x73')]=_0x4a378b[0x0];if(!_0x3ae94['body'][_0x04c2('0x65')])return;return db[_0x04c2('0x74')][_0x04c2('0x45')]({'where':{'id':_0x3ae94[_0x04c2('0x48')][_0x04c2('0x65')],'role':_0x04c2('0x67')},'attributes':['id',_0x04c2('0x27'),_0x04c2('0x75'),_0x04c2('0x76'),'internal'],'raw':!![]});}return null;})[_0x04c2('0x14')](function(_0x18ebfe){if(!_0x18ebfe)return null;_0x1e1315[_0x04c2('0x1a')][_0x04c2('0x67')]=_0x18ebfe;return _0x1e1315;})[_0x04c2('0x14')](function(_0x429245){if(_0x429245){_0x429245['message']['interface']=util['format'](_0x04c2('0x85'),_0x3ae94['user'][_0x04c2('0x27')]);_0x429245[_0x04c2('0x1a')][_0x04c2('0x7a')]=_0x1e1315[_0x04c2('0x7a')];_0x429245[_0x04c2('0x1a')][_0x04c2('0x7b')]=_0x1e1315['channel'];_0x429245[_0x04c2('0x1a')][_0x04c2('0x7c')]='reject';_0x429245[_0x04c2('0x1a')]['body']=htmlToText[_0x04c2('0x86')](_0x1e1315[_0x04c2('0x1a')][_0x04c2('0x48')]);respondWithRpcPromise('EventManager',_0x04c2('0x7d'),{'event':_0x04c2('0x87'),'message':_0x429245[_0x04c2('0x1a')]},client9002);return _0x1e1315;}return null;})[_0x04c2('0x14')](respondWithResult(_0x53dfc6,null))['catch'](handleError(_0x53dfc6,null));};exports[_0x04c2('0x88')]=function(_0x31d297,_0x3a811c){var _0x3c96ae=moment()[_0x04c2('0x89')]()[_0x04c2('0x8a')]();var _0x25ada7=path[_0x04c2('0x8b')](config['root'],_0x04c2('0x8c'),_0x04c2('0x8d'),_0x04c2('0x8e'));var _0x281e7a=path[_0x04c2('0x8b')](config[_0x04c2('0x57')],'server','files','attachments');var _0x8cb090=util[_0x04c2('0x5f')](_0x04c2('0x8f'),_0x3c96ae);return db[_0x04c2('0x2b')][_0x04c2('0x45')]({'where':{'id':_0x31d297['params']['id']},'attributes':['id',_0x04c2('0x48'),_0x04c2('0x90'),'to','cc',_0x04c2('0x91'),'subject',_0x04c2('0x92')],'include':_0x31d297[_0x04c2('0x30')]['attachments']?[{'model':db[_0x04c2('0x93')],'as':_0x04c2('0x94')}]:undefined})['then'](handleEntityNotFound(_0x3a811c,null))['then'](function(_0x272951){if(_0x272951){var _0x5d2af4=_0x272951;var _0x3aa4ec={'from':_0x5d2af4['from'],'to':_0x5d2af4['to'],'subject':_0x5d2af4['subject'],'html':htmlEntities['decode'](_0x5d2af4['body']),'headers':{'Date':moment(_0x5d2af4['createdAt'])[_0x04c2('0x5f')](_0x04c2('0x95'))},'attachments':[]};if(_0x272951['cc']){_0x3aa4ec[_0x04c2('0x96')]['Cc']=_0x272951['cc'];}if(_0x272951[_0x04c2('0x91')]){_0x3aa4ec['headers']['Bcc']=_0x272951[_0x04c2('0x91')];}return new BPromise(function(_0x1b4710,_0x19ee86){if(_0x272951['Attachments']){for(var _0x5f5962=0x0;_0x5f5962<_0x272951[_0x04c2('0x94')][_0x04c2('0x35')];_0x5f5962++){var _0x3839d0=_0x272951[_0x04c2('0x94')][_0x5f5962];var _0x5b7217=path['join'](_0x281e7a,_0x3839d0[_0x04c2('0x97')]);if(fs['existsSync'](_0x5b7217)){_0x3aa4ec[_0x04c2('0x56')]['push']({'name':_0x3839d0[_0x04c2('0x27')],'contentType':_0x3839d0[_0x04c2('0x2d')],'data':fs['readFileSync'](_0x5b7217)});}}}emlformat[_0x04c2('0x98')](_0x3aa4ec,function(_0x4cb8a7,_0x1edf54){if(_0x4cb8a7)return _0x19ee86(_0x4cb8a7);fs[_0x04c2('0x99')](path[_0x04c2('0x8b')](_0x25ada7,_0x8cb090),_0x1edf54);return _0x1b4710(_0x1edf54);});});}})[_0x04c2('0x14')](function(_0x26e3bb){if(_0x26e3bb){return _0x3a811c['download'](path[_0x04c2('0x8b')](_0x25ada7,_0x8cb090),_0x8cb090,function(_0xe4d51c){if(!_0xe4d51c)fs['unlinkSync'](path[_0x04c2('0x8b')](_0x25ada7,_0x8cb090));});}})['catch'](handleError(_0x3a811c,null));}; \ No newline at end of file +var _0xd83c=['readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','findAll','rows','params','model','include','update','body','find','describe','create','findOne','MailAccountId','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE: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','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','reject','rejectmessage','download','unix','server','files','tmp','join','from','bcc','subject','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xd83c,0xa3));var _0xcd83=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0xd83c[_0x4d9bb2];return _0x3179fe;};'use strict';var emlformat=require(_0xcd83('0x0'));var moment=require(_0xcd83('0x1'));var BPromise=require(_0xcd83('0x2'));var util=require('util');var path=require(_0xcd83('0x3'));var fs=require('fs');var _=require(_0xcd83('0x4'));var Redis=require(_0xcd83('0x5'));var htmlToText=require(_0xcd83('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xcd83('0x7'))(_0xcd83('0x8'));var interaction_log=require('../../config/logger')(_0xcd83('0x9'));var config=require(_0xcd83('0xa'));var db=require('../../mysqldb')['db'];config[_0xcd83('0xb')]=_[_0xcd83('0xc')](config[_0xcd83('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd83('0xd'))(new Redis(config[_0xcd83('0xb')]));var htmlEntities=require(_0xcd83('0xe'));require('./mailMessage.socket')[_0xcd83('0xf')](socket);var jayson=require(_0xcd83('0x10'));var client=jayson[_0xcd83('0x11')][_0xcd83('0x12')]({'port':0x232c});var client9003=jayson['client'][_0xcd83('0x12')]({'port':0x232b});var client9002=jayson[_0xcd83('0x11')][_0xcd83('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x444a75,_0x3d149e,_0x11abab,_0x1df5a4){return new BPromise(function(_0x34e6c1,_0x3524f9){var _0x17aec4=_0x1df5a4||client;return _0x17aec4[_0xcd83('0x13')](_0x444a75,_0x11abab)[_0xcd83('0x14')](function(_0x45294d){logger[_0xcd83('0x15')]('MailMessage,\x20%s,\x20%s',_0x3d149e,_0xcd83('0x16'));logger[_0xcd83('0x17')](_0xcd83('0x18'),_0x3d149e,_0xcd83('0x16'),JSON[_0xcd83('0x19')](_0x45294d));if(_0x45294d[_0xcd83('0x1a')]){if(_0x45294d[_0xcd83('0x1a')][_0xcd83('0x1b')]===0x1f4){logger[_0xcd83('0x1a')]('MailMessage,\x20%s,\x20%s',_0x3d149e,_0x45294d['error'][_0xcd83('0x1c')]);return _0x3524f9(_0x45294d[_0xcd83('0x1a')][_0xcd83('0x1c')]);}logger[_0xcd83('0x1a')](_0xcd83('0x1d'),_0x3d149e,_0x45294d['error'][_0xcd83('0x1c')]);return _0x34e6c1(_0x45294d[_0xcd83('0x1a')][_0xcd83('0x1c')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x3d149e,'request\x20sent');_0x34e6c1(_0x45294d[_0xcd83('0x1e')]['message']);}})[_0xcd83('0x1f')](function(_0x1854be){logger[_0xcd83('0x1a')](_0xcd83('0x1d'),_0x3d149e,_0x1854be);_0x3524f9(_0x1854be);});});}function respondWithResult(_0xa8b35a,_0x6a16f){_0x6a16f=_0x6a16f||0xc8;return function(_0x30997d){if(_0x30997d){return _0xa8b35a['status'](_0x6a16f)[_0xcd83('0x20')](_0x30997d);}};}function respondWithFilteredResult(_0x2d02c2,_0x52803b){return function(_0x3068d6){if(_0x3068d6){var _0x8539f5=typeof _0x52803b[_0xcd83('0x21')]===_0xcd83('0x22')&&typeof _0x52803b[_0xcd83('0x23')]===_0xcd83('0x22');var _0x313ce6=_0x3068d6[_0xcd83('0x24')];var _0x32ea15=_0x8539f5?0x0:_0x52803b[_0xcd83('0x21')];var _0x525064=_0x8539f5?_0x3068d6[_0xcd83('0x24')]:_0x52803b['offset']+_0x52803b['limit'];var _0x6b8de4;if(_0x525064>=_0x313ce6){_0x525064=_0x313ce6;_0x6b8de4=0xc8;}else{_0x6b8de4=0xce;}_0x2d02c2[_0xcd83('0x25')](_0x6b8de4);return _0x2d02c2[_0xcd83('0x26')](_0xcd83('0x27'),_0x32ea15+'-'+_0x525064+'/'+_0x313ce6)[_0xcd83('0x20')](_0x3068d6);}return null;};}function saveUpdates(_0x4170a2){return function(_0x2d6728){if(_0x2d6728){return _0x2d6728['update'](_0x4170a2)[_0xcd83('0x14')](function(_0x3d7b65){return _0x3d7b65;});}return null;};}function removeEntity(_0x3b81b1){return function(_0x5e8694){if(_0x5e8694){return _0x5e8694[_0xcd83('0x28')]()[_0xcd83('0x14')](function(){_0x3b81b1['status'](0xcc)[_0xcd83('0x29')]();});}};}function handleEntityNotFound(_0x1ac6c5){return function(_0x419e16){if(!_0x419e16){_0x1ac6c5[_0xcd83('0x2a')](0x194);}return _0x419e16;};}function handleError(_0x51781d,_0x3c764a){_0x3c764a=_0x3c764a||0x1f4;return function(_0x4c2640){logger[_0xcd83('0x1a')](_0x4c2640[_0xcd83('0x2b')]);if(_0x4c2640[_0xcd83('0x2c')]){delete _0x4c2640[_0xcd83('0x2c')];}_0x51781d[_0xcd83('0x25')](_0x3c764a)[_0xcd83('0x2d')](_0x4c2640);};}exports['index']=function(_0x104e99,_0x2692d3){var _0x494956={},_0x415205={},_0x1fcd6a={'count':0x0,'rows':[]};var _0x3f194b=_[_0xcd83('0x2e')](db['MailMessage'][_0xcd83('0x2f')],function(_0x3ada8e){return{'name':_0x3ada8e[_0xcd83('0x30')],'type':_0x3ada8e[_0xcd83('0x31')][_0xcd83('0x32')]};});_0x415205['model']=_[_0xcd83('0x2e')](_0x3f194b,_0xcd83('0x2c'));_0x415205[_0xcd83('0x33')]=_[_0xcd83('0x34')](_0x104e99[_0xcd83('0x33')]);_0x415205[_0xcd83('0x35')]=_[_0xcd83('0x36')](_0x415205['model'],_0x415205[_0xcd83('0x33')]);_0x494956[_0xcd83('0x37')]=_[_0xcd83('0x36')](_0x415205['model'],qs[_0xcd83('0x38')](_0x104e99[_0xcd83('0x33')][_0xcd83('0x38')]));_0x494956['attributes']=_0x494956[_0xcd83('0x37')][_0xcd83('0x39')]?_0x494956[_0xcd83('0x37')]:_0x415205['model'];if(!_0x104e99[_0xcd83('0x33')][_0xcd83('0x3a')]('nolimit')){_0x494956[_0xcd83('0x23')]=qs[_0xcd83('0x23')](_0x104e99[_0xcd83('0x33')][_0xcd83('0x23')]);_0x494956['offset']=qs[_0xcd83('0x21')](_0x104e99['query']['offset']);}_0x494956[_0xcd83('0x3b')]=qs[_0xcd83('0x3c')](_0x104e99[_0xcd83('0x33')][_0xcd83('0x3c')]);_0x494956[_0xcd83('0x3d')]=qs[_0xcd83('0x35')](_[_0xcd83('0x3e')](_0x104e99[_0xcd83('0x33')],_0x415205['filters']),_0x3f194b);if(_0x104e99['query'][_0xcd83('0x3f')]){_0x494956['where']=_[_0xcd83('0x40')](_0x494956[_0xcd83('0x3d')],{'$or':_[_0xcd83('0x2e')](_0x3f194b,function(_0xe39d0e){if(_0xe39d0e['type']!==_0xcd83('0x41')){var _0x5b15a2={};_0x5b15a2[_0xe39d0e[_0xcd83('0x2c')]]={'$like':'%'+_0x104e99[_0xcd83('0x33')][_0xcd83('0x3f')]+'%'};return _0x5b15a2;}})});}_0x494956=_['merge']({},_0x494956,_0x104e99[_0xcd83('0x42')]);var _0x2cf91c={'where':_0x494956['where']};return db[_0xcd83('0x43')][_0xcd83('0x24')](_0x2cf91c)[_0xcd83('0x14')](function(_0x273254){_0x1fcd6a[_0xcd83('0x24')]=_0x273254;if(_0x104e99[_0xcd83('0x33')][_0xcd83('0x44')]){_0x494956['include']=[{'all':!![]}];}return db[_0xcd83('0x43')][_0xcd83('0x45')](_0x494956);})['then'](function(_0x1f6c3b){_0x1fcd6a[_0xcd83('0x46')]=_0x1f6c3b;return _0x1fcd6a;})[_0xcd83('0x14')](respondWithFilteredResult(_0x2692d3,_0x494956))[_0xcd83('0x1f')](handleError(_0x2692d3,null));};exports['show']=function(_0x53040a,_0x311850){var _0x308c46={'raw':!![],'where':{'id':_0x53040a[_0xcd83('0x47')]['id']}},_0x4c1edc={};_0x4c1edc[_0xcd83('0x48')]=_[_0xcd83('0x34')](db[_0xcd83('0x43')][_0xcd83('0x2f')]);_0x4c1edc[_0xcd83('0x33')]=_['keys'](_0x53040a['query']);_0x4c1edc['filters']=_['intersection'](_0x4c1edc[_0xcd83('0x48')],_0x4c1edc['query']);_0x308c46['attributes']=_[_0xcd83('0x36')](_0x4c1edc['model'],qs['fields'](_0x53040a['query'][_0xcd83('0x38')]));_0x308c46[_0xcd83('0x37')]=_0x308c46[_0xcd83('0x37')][_0xcd83('0x39')]?_0x308c46['attributes']:_0x4c1edc[_0xcd83('0x48')];if(_0x53040a[_0xcd83('0x33')][_0xcd83('0x44')]){_0x308c46[_0xcd83('0x49')]=[{'all':!![]}];}_0x308c46=_[_0xcd83('0x40')]({},_0x308c46,_0x53040a[_0xcd83('0x42')]);return db['MailMessage']['find'](_0x308c46)['then'](handleEntityNotFound(_0x311850,null))['then'](respondWithResult(_0x311850,null))[_0xcd83('0x1f')](handleError(_0x311850,null));};exports[_0xcd83('0x4a')]=function(_0xb237f8,_0x524f94){if(_0xb237f8[_0xcd83('0x4b')]['id']){delete _0xb237f8['body']['id'];}return db['MailMessage'][_0xcd83('0x4c')]({'where':{'id':_0xb237f8['params']['id']}})[_0xcd83('0x14')](handleEntityNotFound(_0x524f94,null))[_0xcd83('0x14')](saveUpdates(_0xb237f8[_0xcd83('0x4b')],null))[_0xcd83('0x14')](respondWithResult(_0x524f94,null))[_0xcd83('0x1f')](handleError(_0x524f94,null));};exports[_0xcd83('0x28')]=function(_0x2ff690,_0x379728){return db['MailMessage'][_0xcd83('0x4c')]({'where':{'id':_0x2ff690[_0xcd83('0x47')]['id']}})[_0xcd83('0x14')](handleEntityNotFound(_0x379728,null))[_0xcd83('0x14')](removeEntity(_0x379728,null))['catch'](handleError(_0x379728,null));};exports[_0xcd83('0x4d')]=function(_0x4a4ae6,_0x156359){return db[_0xcd83('0x43')][_0xcd83('0x4d')]()['then'](respondWithResult(_0x156359,null))[_0xcd83('0x1f')](handleError(_0x156359,null));};exports[_0xcd83('0x4e')]=function(_0x5dc0ab,_0x1ddb3f){return db[_0xcd83('0x43')][_0xcd83('0x4e')](_0x5dc0ab[_0xcd83('0x4b')])[_0xcd83('0x14')](function(_0x3a364f){if(_0x3a364f){if(_0x3a364f['direction']==='out'&&!_0x3a364f['secret']){var _0x5239ec,_0x4d5179,_0x4e1fd3;if(_0x5dc0ab[_0xcd83('0x4b')]['to']){_0x4d5179=_0x5dc0ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0xcd83('0x4f')]({'where':{'id':_0x3a364f[_0xcd83('0x50')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcd83('0x51')],'as':_0xcd83('0x52'),'where':{'email':_0x4d5179},'limit':0x1,'order':[[_0xcd83('0x53'),_0xcd83('0x54')]]}]},{'model':db[_0xcd83('0x55')],'as':_0xcd83('0x56'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xcd83('0x57'),'raw':!![]}]}]})['then'](function(_0x2ab642){_0x5239ec=_0x2ab642;if(!_0x5239ec||!_0x5239ec[_0xcd83('0x56')])return;var _0x5d0b09=_0x5239ec[_0xcd83('0x58')]();if(_0x5dc0ab['body'][_0xcd83('0x59')]&&_0x5dc0ab['body']['attachments'][_0xcd83('0x39')]){for(var _0x120705=0x0;_0x120705<_0x5dc0ab['body']['attachments'][_0xcd83('0x39')];_0x120705+=0x1){_0x5dc0ab[_0xcd83('0x4b')][_0xcd83('0x59')][_0x120705]={'filename':_0x5dc0ab[_0xcd83('0x4b')][_0xcd83('0x59')][_0x120705][_0xcd83('0x2c')],'path':path['join'](config[_0xcd83('0x5a')],_0xcd83('0x5b'),_0x5dc0ab[_0xcd83('0x4b')][_0xcd83('0x59')][_0x120705][_0xcd83('0x5c')])};}}_0x4e1fd3={'account':_0x5d0b09,'message':_0x5dc0ab[_0xcd83('0x4b')]};return;})['then'](function(){if(_0x5239ec['List']){if(_0x5239ec[_0xcd83('0x5d')]['Contacts']['length']){return _0x5239ec['List'][_0xcd83('0x52')][0x0];}else{return db[_0xcd83('0x51')][_0xcd83('0x4e')](_[_0xcd83('0xc')](_0x5dc0ab['body'],{'firstName':_0x5dc0ab['body']['to'],'email':_0x5dc0ab[_0xcd83('0x4b')]['to'],'phone':_0x5dc0ab[_0xcd83('0x4b')]['to'],'ListId':_0x5239ec[_0xcd83('0x5e')]}));}}else{throw new Error(_0xcd83('0x5f'));}})['then'](function(){if(_0x4e1fd3){return respondWithRpcPromise(_0xcd83('0x60'),_0xcd83('0x61'),_0x4e1fd3,client9003)[_0xcd83('0x14')](function(_0x198d85){return _0x3a364f[_0xcd83('0x4a')]({'read':!![],'messageId':_0x198d85['messageId'],'sentAt':moment()[_0xcd83('0x62')](_0xcd83('0x63'))});})[_0xcd83('0x1f')](function(_0x103f8a){logger[_0xcd83('0x1a')]('%s',JSON['stringify'](_0x103f8a));return _0x3a364f;});}return _0x3a364f;});}return _0x3a364f;}})['then'](respondWithResult(_0x1ddb3f,0xc9))[_0xcd83('0x1f')](handleError(_0x1ddb3f,null));};exports[_0xcd83('0x64')]=function(_0x3f303a,_0x30073f){var _0x1d5f14={'agent':{},'channel':'mail'};if(_0x3f303a[_0xcd83('0x4b')]['id']){delete _0x3f303a[_0xcd83('0x4b')]['id'];}_0x3f303a[_0xcd83('0x4b')][_0xcd83('0x65')]=!![];_0x3f303a[_0xcd83('0x4b')]['readAt']=moment()['format'](_0xcd83('0x63'));_0x3f303a[_0xcd83('0x4b')][_0xcd83('0x66')]=_0x3f303a[_0xcd83('0x4b')][_0xcd83('0x66')]||_0x3f303a['user']['id'];_0x1d5f14[_0xcd83('0x67')]['id']=_0x3f303a[_0xcd83('0x4b')][_0xcd83('0x66')];return db[_0xcd83('0x43')][_0xcd83('0x4c')]({'where':{'id':_0x3f303a[_0xcd83('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30073f,null))[_0xcd83('0x14')](saveUpdates(_0x3f303a[_0xcd83('0x4b')],null))[_0xcd83('0x14')](function(_0x587051){if(_0x587051){_0x1d5f14[_0xcd83('0x1c')]=_0x587051[_0xcd83('0x68')]({'plain':!![]});return db[_0xcd83('0x69')]['find']({'where':{'id':_0x587051[_0xcd83('0x6a')]}});}return null;})[_0xcd83('0x14')](handleEntityNotFound(_0x30073f,null))['then'](function(_0x5bc527){if(_0x5bc527){return _0x5bc527[_0xcd83('0x4a')]({'UserId':_0x3f303a[_0xcd83('0x4b')]['UserId'],'read1stAt':_[_0xcd83('0x6b')](_0x5bc527[_0xcd83('0x6c')])?moment()['format'](_0xcd83('0x63')):undefined});}return null;})[_0xcd83('0x14')](function(_0x4be752){if(_0x4be752){_0x1d5f14['interaction']=_0x4be752[_0xcd83('0x68')]({'plain':!![]});interaction_log[_0xcd83('0x15')](_0xcd83('0x6d'),_0x3f303a[_0xcd83('0x6e')]['id'],_0x3f303a[_0xcd83('0x6e')][_0xcd83('0x2c')],_0x3f303a[_0xcd83('0x6e')][_0xcd83('0x6f')],_0x1d5f14[_0xcd83('0x70')]['id'],_0x3f303a[_0xcd83('0x4b')]?JSON['stringify'](_0x3f303a[_0xcd83('0x4b')]):_0xcd83('0x71'));return respondWithRpcPromise(_0xcd83('0x72'),_0xcd83('0x73'),_0x1d5f14);}return null;})[_0xcd83('0x14')](function(_0x287b39){var _0x5d015e=_0xcd83('0x74')+_0x287b39[_0xcd83('0x1c')][_0xcd83('0x75')];return db[_0xcd83('0x76')][_0xcd83('0x33')](_0x5d015e,{'type':db[_0xcd83('0x77')][_0xcd83('0x78')]['SELECT'],'raw':!![]})['then'](function(_0x3f4758){return _0x3f4758;});})[_0xcd83('0x14')](function(_0x2455cf){if(_0x2455cf){_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x79')]=_0x2455cf[0x0];if(!_0x3f303a[_0xcd83('0x4b')]['UserId'])return;return db[_0xcd83('0x7a')][_0xcd83('0x4c')]({'where':{'id':_0x3f303a[_0xcd83('0x4b')][_0xcd83('0x66')],'role':'agent'},'attributes':['id','name','fullname',_0xcd83('0x7b'),_0xcd83('0x7c')],'raw':!![]});}return null;})[_0xcd83('0x14')](function(_0x2593a3){if(!_0x2593a3)return null;_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x67')]=_0x2593a3;return _0x1d5f14;})[_0xcd83('0x14')](function(_0x233791){if(_0x233791){if(_0x3f303a[_0xcd83('0x4b')][_0xcd83('0x7d')]){_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x7e')]=util['format'](_0xcd83('0x7f'),_0x3f303a['user'][_0xcd83('0x2c')]);_0x1d5f14['message'][_0xcd83('0x80')]=_0x1d5f14[_0xcd83('0x80')];_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x81')]=_0x1d5f14[_0xcd83('0x80')];_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x82')]=_0xcd83('0x64');_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x4b')]=htmlToText[_0xcd83('0x83')](_0x1d5f14[_0xcd83('0x1c')][_0xcd83('0x4b')]);return respondWithRpcPromise(_0xcd83('0x84'),'EventManager',{'event':_0xcd83('0x85'),'message':_0x1d5f14[_0xcd83('0x1c')]},client9002)[_0xcd83('0x14')](function(){return _0x1d5f14;});}return _0x1d5f14;}return null;})['then'](respondWithResult(_0x30073f,null))[_0xcd83('0x1f')](handleError(_0x30073f,null));};exports['reject']=function(_0xda0437,_0x1370d4){var _0x561eca={'agent':{},'channel':_0xcd83('0x86')};if(_0xda0437[_0xcd83('0x4b')]['id']){delete _0xda0437[_0xcd83('0x4b')]['id'];}_0xda0437['body'][_0xcd83('0x66')]=_0xda0437[_0xcd83('0x4b')]['UserId']||_0xda0437[_0xcd83('0x6e')]['id'];_0x561eca[_0xcd83('0x67')]['id']=_0xda0437[_0xcd83('0x4b')][_0xcd83('0x66')];return db[_0xcd83('0x43')]['find']({'where':{'id':_0xda0437['params']['id'],'UserId':null}})[_0xcd83('0x14')](handleEntityNotFound(_0x1370d4,null))[_0xcd83('0x14')](function(_0x53b2d9){if(_0x53b2d9){_0x561eca[_0xcd83('0x1c')]=_0x53b2d9['get']({'plain':!![]});return db[_0xcd83('0x69')][_0xcd83('0x4c')]({'where':{'id':_0x53b2d9['MailInteractionId']}});}return null;})[_0xcd83('0x14')](handleEntityNotFound(_0x1370d4,null))['then'](function(_0x1668ec){if(_0x1668ec){_0x561eca[_0xcd83('0x70')]=_0x1668ec[_0xcd83('0x68')]({'plain':!![]});interaction_log[_0xcd83('0x15')](_0xcd83('0x87'),_0xda0437['user']['id'],_0xda0437[_0xcd83('0x6e')]['name'],_0xda0437[_0xcd83('0x6e')][_0xcd83('0x6f')],_0x561eca[_0xcd83('0x70')]['id'],_0xda0437['body']?JSON[_0xcd83('0x19')](_0xda0437['body']):_0xcd83('0x71'));return respondWithRpcPromise(_0xcd83('0x88'),_0xcd83('0x89'),_0x561eca);}return null;})[_0xcd83('0x14')](function(_0x21d324){var _0x3fdbd0=_0xcd83('0x74')+_0x21d324[_0xcd83('0x1c')][_0xcd83('0x75')];return db['sequelize'][_0xcd83('0x33')](_0x3fdbd0,{'type':db[_0xcd83('0x77')][_0xcd83('0x78')]['SELECT'],'raw':!![]})[_0xcd83('0x14')](function(_0x4a7bd3){return _0x4a7bd3;});})[_0xcd83('0x14')](function(_0x4e54eb){if(_0x4e54eb){_0x561eca[_0xcd83('0x1c')]['contact']=_0x4e54eb[0x0];if(!_0xda0437[_0xcd83('0x4b')][_0xcd83('0x66')])return;return db[_0xcd83('0x7a')]['find']({'where':{'id':_0xda0437[_0xcd83('0x4b')]['UserId'],'role':_0xcd83('0x67')},'attributes':['id','name',_0xcd83('0x8a'),'email',_0xcd83('0x7c')],'raw':!![]});}return null;})[_0xcd83('0x14')](function(_0x4013ef){if(!_0x4013ef)return null;_0x561eca['message'][_0xcd83('0x67')]=_0x4013ef;return _0x561eca;})['then'](function(_0x855ce3){if(_0x855ce3){_0x855ce3[_0xcd83('0x1c')][_0xcd83('0x7e')]=util[_0xcd83('0x62')](_0xcd83('0x7f'),_0xda0437[_0xcd83('0x6e')][_0xcd83('0x2c')]);_0x855ce3[_0xcd83('0x1c')][_0xcd83('0x80')]=_0x561eca[_0xcd83('0x80')];_0x855ce3[_0xcd83('0x1c')][_0xcd83('0x81')]=_0x561eca[_0xcd83('0x80')];_0x855ce3[_0xcd83('0x1c')][_0xcd83('0x82')]=_0xcd83('0x8b');_0x855ce3[_0xcd83('0x1c')][_0xcd83('0x4b')]=htmlToText[_0xcd83('0x83')](_0x561eca['message'][_0xcd83('0x4b')]);respondWithRpcPromise(_0xcd83('0x84'),_0xcd83('0x84'),{'event':_0xcd83('0x8c'),'message':_0x855ce3['message']},client9002);return _0x561eca;}return null;})[_0xcd83('0x14')](respondWithResult(_0x1370d4,null))[_0xcd83('0x1f')](handleError(_0x1370d4,null));};exports[_0xcd83('0x8d')]=function(_0xf9623a,_0x43e3ce){var _0x3278d7=moment()[_0xcd83('0x8e')]()['toString']();var _0x313540=path['join'](config[_0xcd83('0x5a')],_0xcd83('0x8f'),_0xcd83('0x90'),_0xcd83('0x91'));var _0xf232b4=path[_0xcd83('0x92')](config[_0xcd83('0x5a')],_0xcd83('0x8f'),'files',_0xcd83('0x59'));var _0x157fd2=util['format']('message-%s.eml',_0x3278d7);return db['MailMessage']['find']({'where':{'id':_0xf9623a['params']['id']},'attributes':['id',_0xcd83('0x4b'),_0xcd83('0x93'),'to','cc',_0xcd83('0x94'),_0xcd83('0x95'),'createdAt'],'include':_0xf9623a[_0xcd83('0x33')]['attachments']?[{'model':db[_0xcd83('0x96')],'as':_0xcd83('0x97')}]:undefined})['then'](handleEntityNotFound(_0x43e3ce,null))[_0xcd83('0x14')](function(_0x360d45){if(_0x360d45){var _0x5d7c99=_0x360d45;var _0x4eb5b9={'from':_0x5d7c99[_0xcd83('0x93')],'to':_0x5d7c99['to'],'subject':_0x5d7c99['subject'],'html':htmlEntities['decode'](_0x5d7c99['body']),'headers':{'Date':moment(_0x5d7c99['createdAt'])[_0xcd83('0x62')](_0xcd83('0x98'))},'attachments':[]};if(_0x360d45['cc']){_0x4eb5b9[_0xcd83('0x99')]['Cc']=_0x360d45['cc'];}if(_0x360d45[_0xcd83('0x94')]){_0x4eb5b9['headers']['Bcc']=_0x360d45[_0xcd83('0x94')];}return new BPromise(function(_0xb93ef8,_0x3fcc3e){if(_0x360d45[_0xcd83('0x97')]){for(var _0x342134=0x0;_0x342134<_0x360d45[_0xcd83('0x97')][_0xcd83('0x39')];_0x342134++){var _0x230b36=_0x360d45[_0xcd83('0x97')][_0x342134];var _0x57a83b=path[_0xcd83('0x92')](_0xf232b4,_0x230b36[_0xcd83('0x5c')]);if(fs['existsSync'](_0x57a83b)){_0x4eb5b9[_0xcd83('0x59')][_0xcd83('0x9a')]({'name':_0x230b36[_0xcd83('0x2c')],'contentType':_0x230b36[_0xcd83('0x31')],'data':fs[_0xcd83('0x9b')](_0x57a83b)});}}}emlformat[_0xcd83('0x9c')](_0x4eb5b9,function(_0x19f5ca,_0x517140){if(_0x19f5ca)return _0x3fcc3e(_0x19f5ca);fs[_0xcd83('0x9d')](path[_0xcd83('0x92')](_0x313540,_0x157fd2),_0x517140);return _0xb93ef8(_0x517140);});});}})['then'](function(_0xd89aa5){if(_0xd89aa5){return _0x43e3ce[_0xcd83('0x8d')](path['join'](_0x313540,_0x157fd2),_0x157fd2,function(_0x1175cc){if(!_0x1175cc)fs[_0xcd83('0x9e')](path[_0xcd83('0x92')](_0x313540,_0x157fd2));});}})[_0xcd83('0x1f')](handleError(_0x43e3ce,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 511280c..554fbd6 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 _0x3edb=['events','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x44c8be,_0x3fb5a5){var _0x576851=function(_0x4c4ce9){while(--_0x4c4ce9){_0x44c8be['push'](_0x44c8be['shift']());}};_0x576851(++_0x3fb5a5);}(_0x3edb,0x19d));var _0xb3ed=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3edb[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require(_0xb3ed('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb3ed('0x1'),'afterDestroy':_0xb3ed('0x2')};function emitEvent(_0xd87711){return function(_0x68366f,_0x2b7f0a,_0x1450b0){MailMessageEvents[_0xb3ed('0x3')](_0xd87711+':'+_0x68366f['id'],_0x68366f);MailMessageEvents[_0xb3ed('0x3')](_0xd87711,_0x68366f);_0x1450b0(null);};}for(var e in events){if(events[_0xb3ed('0x4')](e)){var event=events[e];MailMessage[_0xb3ed('0x5')](e,emitEvent(event));}}module[_0xb3ed('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x27d2=['update','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x3c0cd6,_0x5ba428){var _0x4381ec=function(_0x2ab4b3){while(--_0x2ab4b3){_0x3c0cd6['push'](_0x3c0cd6['shift']());}};_0x4381ec(++_0x5ba428);}(_0x27d2,0xc1));var _0x227d=function(_0x285732,_0x4b3ce4){_0x285732=_0x285732-0x0;var _0x16f824=_0x27d2[_0x285732];return _0x16f824;};'use strict';var EventEmitter=require(_0x227d('0x0'));var MailMessage=require(_0x227d('0x1'))['db'][_0x227d('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x227d('0x3')](0x0);var events={'afterCreate':_0x227d('0x4'),'afterUpdate':_0x227d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x77c405){return function(_0x525db5,_0x4106b6,_0x257cd1){MailMessageEvents[_0x227d('0x6')](_0x77c405+':'+_0x525db5['id'],_0x525db5);MailMessageEvents[_0x227d('0x6')](_0x77c405,_0x525db5);_0x257cd1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x227d('0x7')](e,emitEvent(event));}}module[_0x227d('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 2b09c2c..e6821f4 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 _0x0aaa=['FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','plainBody','subject'];(function(_0x1f62a4,_0x47437a){var _0x2a99e2=function(_0x233a94){while(--_0x233a94){_0x1f62a4['push'](_0x1f62a4['shift']());}};_0x2a99e2(++_0x47437a);}(_0x0aaa,0x12b));var _0xa0aa=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x0aaa[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var logger=require(_0xa0aa('0x2'))(_0xa0aa('0x3'));var moment=require('moment');var BPromise=require(_0xa0aa('0x4'));var rp=require(_0xa0aa('0x5'));var htmlToText=require(_0xa0aa('0x6'));var fs=require('fs');var path=require(_0xa0aa('0x7'));var rimraf=require(_0xa0aa('0x8'));var config=require(_0xa0aa('0x9'));var attributes=require(_0xa0aa('0xa'));module[_0xa0aa('0xb')]=function(_0x4e2021,_0x5ed684){return _0x4e2021['define']('MailMessage',attributes,{'tableName':_0xa0aa('0xc'),'paranoid':![],'indexes':[{'name':_0xa0aa('0xd'),'fields':[_0xa0aa('0xd')]},{'name':'fti_mail_messages','fields':[_0xa0aa('0xe'),_0xa0aa('0xf')],'type':_0xa0aa('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1aa0d3,_0x1b09ed,_0x12a2ea){if(_0x1aa0d3[_0xa0aa('0x11')]){_0x1aa0d3['plainBody']=htmlToText[_0xa0aa('0x12')](_0x1aa0d3[_0xa0aa('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x12a2ea(null,_0x1b09ed);},'afterCreate':function(_0x33021f,_0x1a1a13,_0x11bf3b){var _0x5cdd3f=_0x4e2021[_0xa0aa('0x13')];var _0xd48ef8=_0x33021f[_0xa0aa('0x14')]({'plain':!![]});if(_0xd48ef8[_0xa0aa('0x15')][_0xa0aa('0x16')]()==='in'||_0xd48ef8[_0xa0aa('0x15')][_0xa0aa('0x16')]()===_0xa0aa('0x17')&&!_0xd48ef8[_0xa0aa('0x18')]&&!_[_0xa0aa('0x19')](_0xd48ef8[_0xa0aa('0x1a')])){_0x5cdd3f[_0xa0aa('0x1b')]['findOne']({'where':{'id':_0xd48ef8[_0xa0aa('0x1c')]}})[_0xa0aa('0x1d')](function(_0x1f1ea7){if(_0x1f1ea7){_0x1f1ea7[_0xa0aa('0x1e')]({'lastMsgAt':_0xd48ef8[_0xa0aa('0x1f')],'lastMsgDirection':_0xd48ef8[_0xa0aa('0x15')][_0xa0aa('0x16')]()});}})[_0xa0aa('0x20')](function(_0x1df9b0){console[_0xa0aa('0x21')](_0x1df9b0);});}_0x11bf3b();}},'charset':'utf8mb4','collate':_0xa0aa('0x22')});}; \ No newline at end of file +var _0x1b6e=['subject','body','get','toLowerCase','direction','isNil','UserId','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','plainBody'];(function(_0x5043fa,_0xfc35b){var _0x1d064f=function(_0x2954c2){while(--_0x2954c2){_0x5043fa['push'](_0x5043fa['shift']());}};_0x1d064f(++_0xfc35b);}(_0x1b6e,0x8b));var _0xe1b6=function(_0x126b9f,_0xb7dec0){_0x126b9f=_0x126b9f-0x0;var _0x2bd0f8=_0x1b6e[_0x126b9f];return _0x2bd0f8;};'use strict';var _=require(_0xe1b6('0x0'));var util=require(_0xe1b6('0x1'));var logger=require(_0xe1b6('0x2'))(_0xe1b6('0x3'));var moment=require(_0xe1b6('0x4'));var BPromise=require(_0xe1b6('0x5'));var rp=require('request-promise');var htmlToText=require(_0xe1b6('0x6'));var fs=require('fs');var path=require(_0xe1b6('0x7'));var rimraf=require(_0xe1b6('0x8'));var config=require(_0xe1b6('0x9'));var attributes=require(_0xe1b6('0xa'));module[_0xe1b6('0xb')]=function(_0x22085f,_0x5a177d){return _0x22085f[_0xe1b6('0xc')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe1b6('0xd'),'fields':[_0xe1b6('0xd')]},{'name':_0xe1b6('0xe'),'fields':[_0xe1b6('0xf'),_0xe1b6('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x365ae2,_0x5ae4ca,_0x502ff3){if(_0x365ae2[_0xe1b6('0x11')]){_0x365ae2[_0xe1b6('0xf')]=htmlToText['fromString'](_0x365ae2[_0xe1b6('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x502ff3(null,_0x5ae4ca);},'afterCreate':function(_0x5c0ef1,_0x16188a,_0x5c87c2){var _0x56d19c=_0x22085f['models'];var _0x35cebf=_0x5c0ef1[_0xe1b6('0x12')]({'plain':!![]});if(_0x35cebf['direction'][_0xe1b6('0x13')]()==='in'||_0x35cebf[_0xe1b6('0x14')][_0xe1b6('0x13')]()==='out'&&!_0x35cebf['secret']&&!_[_0xe1b6('0x15')](_0x35cebf[_0xe1b6('0x16')])){_0x56d19c['MailInteraction'][_0xe1b6('0x17')]({'where':{'id':_0x35cebf[_0xe1b6('0x18')]}})['then'](function(_0x592ea3){if(_0x592ea3){_0x592ea3[_0xe1b6('0x19')]({'lastMsgAt':_0x35cebf[_0xe1b6('0x1a')],'lastMsgDirection':_0x35cebf[_0xe1b6('0x14')][_0xe1b6('0x13')]()});}})[_0xe1b6('0x1b')](function(_0x467472){console[_0xe1b6('0x1c')](_0x467472);});}_0x5c87c2();}},'charset':_0xe1b6('0x1d'),'collate':_0xe1b6('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 90eb4e7..bb6c5f7 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 _0x0972=['message','catch','CreateMailMessage','MailMessage','body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5f27e8,_0xebeec){var _0x5dc1b1=function(_0x1cfb3c){while(--_0x1cfb3c){_0x5f27e8['push'](_0x5f27e8['shift']());}};_0x5dc1b1(++_0xebeec);}(_0x0972,0x64));var _0x2097=function(_0x20ae18,_0x562b61){_0x20ae18=_0x20ae18-0x0;var _0x3d82a6=_0x0972[_0x20ae18];return _0x3d82a6;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});config[_0x2097('0xa')]=_['defaults'](config[_0x2097('0xa')],{'host':_0x2097('0xb'),'port':0x18eb});var socket=require(_0x2097('0xc'))(new Redis(config[_0x2097('0xa')]));require(_0x2097('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e0024,_0x3b8b76,_0x131f06){return new BPromise(function(_0x430754,_0x7baeb3){return client[_0x2097('0xe')](_0x2e0024,_0x131f06)[_0x2097('0xf')](function(_0x1d1166){logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));logger[_0x2097('0x13')](_0x2097('0x14'),_0x3b8b76,_0x2097('0x12'),JSON[_0x2097('0x15')](_0x1d1166));if(_0x1d1166[_0x2097('0x16')]){if(_0x1d1166[_0x2097('0x16')][_0x2097('0x17')]===0x1f4){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x1d1166['error'][_0x2097('0x18')]);return _0x7baeb3(_0x1d1166[_0x2097('0x16')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3b8b76,_0x1d1166[_0x2097('0x16')]['message']);return _0x430754(_0x1d1166[_0x2097('0x16')][_0x2097('0x18')]);}else{logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));_0x430754(_0x1d1166['result'][_0x2097('0x18')]);}})[_0x2097('0x19')](function(_0x451584){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x451584);_0x7baeb3(_0x451584);});});}exports[_0x2097('0x1a')]=function(_0x253f5d){var _0x46b5e0=this;return new Promise(function(_0x5d8b9e,_0x4d957e){return db[_0x2097('0x1b')]['create'](_0x253f5d[_0x2097('0x1c')],{'raw':_0x253f5d[_0x2097('0x1d')]?_0x253f5d['options'][_0x2097('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2e17c8){logger[_0x2097('0x10')](_0x2097('0x1a'),_0x253f5d);logger[_0x2097('0x13')](_0x2097('0x1a'),_0x253f5d,JSON[_0x2097('0x15')](_0x2e17c8));_0x5d8b9e(_0x2e17c8);})['catch'](function(_0xae5f9){logger['error'](_0x2097('0x1a'),_0xae5f9[_0x2097('0x18')],_0x253f5d);_0x4d957e(_0x46b5e0[_0x2097('0x16')](0x1f4,_0xae5f9[_0x2097('0x18')]));});});}; \ No newline at end of file +var _0xd914=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash'];(function(_0x241b5a,_0x5ac06c){var _0x49fff8=function(_0x31f8ec){while(--_0x31f8ec){_0x241b5a['push'](_0x241b5a['shift']());}};_0x49fff8(++_0x5ac06c);}(_0xd914,0x17f));var _0x4d91=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xd914[_0x445101];return _0x3c3d04;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});config[_0x4d91('0xb')]=_[_0x4d91('0xc')](config[_0x4d91('0xb')],{'host':_0x4d91('0xd'),'port':0x18eb});var socket=require(_0x4d91('0xe'))(new Redis(config[_0x4d91('0xb')]));require('./mailMessage.socket')[_0x4d91('0xf')](socket);function respondWithRpcPromise(_0xa4bb25,_0xc07c64,_0x278648){return new BPromise(function(_0xb234d2,_0x266b31){return client['request'](_0xa4bb25,_0x278648)['then'](function(_0x2ccd08){logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));logger[_0x4d91('0x13')](_0x4d91('0x14'),_0xc07c64,'request\x20sent',JSON['stringify'](_0x2ccd08));if(_0x2ccd08[_0x4d91('0x15')]){if(_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x16')]===0x1f4){logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0x266b31(_0x2ccd08['error'][_0x4d91('0x17')]);}logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0xb234d2(_0x2ccd08['error'][_0x4d91('0x17')]);}else{logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));_0xb234d2(_0x2ccd08['result'][_0x4d91('0x17')]);}})[_0x4d91('0x18')](function(_0x13254c){logger['error'](_0x4d91('0x11'),_0xc07c64,_0x13254c);_0x266b31(_0x13254c);});});}exports[_0x4d91('0x19')]=function(_0x351388){var _0xd59fe=this;return new Promise(function(_0x10b767,_0x40cde4){return db[_0x4d91('0x1a')][_0x4d91('0x1b')](_0x351388[_0x4d91('0x1c')],{'raw':_0x351388[_0x4d91('0x1d')]?_0x351388['options'][_0x4d91('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x57913e){logger[_0x4d91('0x10')](_0x4d91('0x19'),_0x351388);logger[_0x4d91('0x13')](_0x4d91('0x19'),_0x351388,JSON[_0x4d91('0x1f')](_0x57913e));_0x10b767(_0x57913e);})[_0x4d91('0x18')](function(_0x100cd4){logger[_0x4d91('0x15')]('CreateMailMessage',_0x100cd4['message'],_0x351388);_0x40cde4(_0xd59fe[_0x4d91('0x15')](0x1f4,_0x100cd4[_0x4d91('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8f4ef97..44a9d21 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 _0x1347=['emit','register','length','mailMessage:','save','remove'];(function(_0xb126fd,_0x5d4512){var _0x3da326=function(_0xcbfd90){while(--_0xcbfd90){_0xb126fd['push'](_0xb126fd['shift']());}};_0x3da326(++_0x5d4512);}(_0x1347,0xd0));var _0x7134=function(_0x2aad02,_0x556ae7){_0x2aad02=_0x2aad02-0x0;var _0x546e5b=_0x1347[_0x2aad02];return _0x546e5b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x7134('0x0'),_0x7134('0x1'),'update'];function createListener(_0x3e2f6d,_0x43e64d){return function(_0x4e034c){_0x43e64d[_0x7134('0x2')](_0x3e2f6d,_0x4e034c);};}function removeListener(_0x40101e,_0x5593c6){return function(){MailMessageEvents['removeListener'](_0x40101e,_0x5593c6);};}exports[_0x7134('0x3')]=function(_0x59ea30){for(var _0x334b27=0x0,_0x264568=events[_0x7134('0x4')];_0x334b27<_0x264568;_0x334b27++){var _0x75a791=events[_0x334b27];var _0x2dcb83=createListener(_0x7134('0x5')+_0x75a791,_0x59ea30);MailMessageEvents['on'](_0x75a791,_0x2dcb83);}}; \ No newline at end of file +var _0xf5d8=['save','removeListener','register','mailMessage:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf5d8,0x9c));var _0x8f5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5d8[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x8f5d('0x0'),'remove','update'];function createListener(_0x5a1e8c,_0x247797){return function(_0x2dbb10){_0x247797['emit'](_0x5a1e8c,_0x2dbb10);};}function removeListener(_0x77d954,_0x37eb9e){return function(){MailMessageEvents[_0x8f5d('0x1')](_0x77d954,_0x37eb9e);};}exports[_0x8f5d('0x2')]=function(_0x100a40){for(var _0x1c07b1=0x0,_0x3f44e2=events['length'];_0x1c07b1<_0x3f44e2;_0x1c07b1++){var _0x21a101=events[_0x1c07b1];var _0x5f09f8=createListener(_0x8f5d('0x3')+_0x21a101,_0x100a40);MailMessageEvents['on'](_0x21a101,_0x5f09f8);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a1071ae..1a85d5f 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 _0xd641=['/:id/users','getAgents','create','addTeams','post','delete','destroy','removeTeams','removeAgents','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd641,0x141));var _0x1d64=function(_0x546f7b,_0x9f64b9){_0x546f7b=_0x546f7b-0x0;var _0x43efe9=_0xd641[_0x546f7b];return _0x43efe9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1d64('0x0'));var express=require(_0x1d64('0x1'));var router=express['Router']();var fs_extra=require(_0x1d64('0x2'));var auth=require(_0x1d64('0x3'));var interaction=require(_0x1d64('0x4'));var config=require('../../config/environment');var controller=require(_0x1d64('0x5'));router[_0x1d64('0x6')]('/',auth[_0x1d64('0x7')](),controller[_0x1d64('0x8')]);router[_0x1d64('0x6')](_0x1d64('0x9'),auth[_0x1d64('0x7')](),controller[_0x1d64('0xa')]);router['get'](_0x1d64('0xb'),auth['isAuthenticated'](),controller[_0x1d64('0xc')]);router[_0x1d64('0x6')](_0x1d64('0xd'),auth[_0x1d64('0x7')](),controller[_0x1d64('0xe')]);router[_0x1d64('0x6')](_0x1d64('0xf'),auth['isAuthenticated'](),controller[_0x1d64('0x10')]);router[_0x1d64('0x6')](_0x1d64('0x11'),auth[_0x1d64('0x7')](),controller[_0x1d64('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d64('0x13')]);router['post']('/:id/teams',auth[_0x1d64('0x7')](),controller[_0x1d64('0x14')]);router[_0x1d64('0x15')](_0x1d64('0x11'),auth[_0x1d64('0x7')](),controller['addAgents']);router['put'](_0x1d64('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1d64('0x16')](_0x1d64('0xb'),auth[_0x1d64('0x7')](),controller[_0x1d64('0x17')]);router[_0x1d64('0x16')](_0x1d64('0xf'),auth[_0x1d64('0x7')](),controller[_0x1d64('0x18')]);router['delete'](_0x1d64('0x11'),auth['isAuthenticated'](),controller[_0x1d64('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbd07=['../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeAgents','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2da5bc,_0x43dd52){var _0x445d91=function(_0xf636a1){while(--_0xf636a1){_0x2da5bc['push'](_0x2da5bc['shift']());}};_0x445d91(++_0x43dd52);}(_0xbd07,0x166));var _0x7bd0=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xbd07[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x7bd0('0x0'));var util=require(_0x7bd0('0x1'));var path=require(_0x7bd0('0x2'));var timeout=require(_0x7bd0('0x3'));var express=require('express');var router=express[_0x7bd0('0x4')]();var fs_extra=require(_0x7bd0('0x5'));var auth=require(_0x7bd0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bd0('0x7'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0x7bd0('0x8')](),controller['index']);router[_0x7bd0('0x9')](_0x7bd0('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7bd0('0x9')](_0x7bd0('0xb'),auth[_0x7bd0('0x8')](),controller[_0x7bd0('0xc')]);router[_0x7bd0('0x9')](_0x7bd0('0xd'),auth[_0x7bd0('0x8')](),controller[_0x7bd0('0xe')]);router[_0x7bd0('0x9')](_0x7bd0('0xf'),auth[_0x7bd0('0x8')](),controller[_0x7bd0('0x10')]);router[_0x7bd0('0x9')](_0x7bd0('0x11'),auth[_0x7bd0('0x8')](),controller['getAgents']);router[_0x7bd0('0x12')]('/',auth[_0x7bd0('0x8')](),controller[_0x7bd0('0x13')]);router[_0x7bd0('0x12')](_0x7bd0('0xf'),auth['isAuthenticated'](),controller[_0x7bd0('0x14')]);router[_0x7bd0('0x12')](_0x7bd0('0x11'),auth['isAuthenticated'](),controller[_0x7bd0('0x15')]);router[_0x7bd0('0x16')](_0x7bd0('0xb'),auth[_0x7bd0('0x8')](),controller[_0x7bd0('0x17')]);router[_0x7bd0('0x18')](_0x7bd0('0xb'),auth[_0x7bd0('0x8')](),controller['destroy']);router[_0x7bd0('0x18')](_0x7bd0('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x7bd0('0x18')](_0x7bd0('0x11'),auth[_0x7bd0('0x8')](),controller[_0x7bd0('0x19')]);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 917b54c..0604b65 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 _0x2956=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x369a18,_0x303e7c){var _0x19f2ae=function(_0x3b547d){while(--_0x3b547d){_0x369a18['push'](_0x369a18['shift']());}};_0x19f2ae(++_0x303e7c);}(_0x2956,0xa2));var _0x6295=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x2956[_0x1dd532];return _0x3732aa;};'use strict';var Sequelize=require(_0x6295('0x0'));module[_0x6295('0x1')]={'name':{'type':Sequelize[_0x6295('0x2')],'unique':_0x6295('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6295('0x2')]},'timeout':{'type':Sequelize[_0x6295('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6295('0x5')](_0x6295('0x6'),'beepall',_0x6295('0x7'))}}; \ No newline at end of file +var _0x7a3b=['roundrobin','sequelize','name','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a3b,0xdd));var _0xb7a3=function(_0x1bf59b,_0x2b8c55){_0x1bf59b=_0x1bf59b-0x0;var _0x46fd25=_0x7a3b[_0x1bf59b];return _0x46fd25;};'use strict';var Sequelize=require(_0xb7a3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb7a3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb7a3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xb7a3('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4513c52..daef2d5 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 _0xee80=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','MailQueues','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','catch','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','length','hasOwnProperty','order','sort','where','pick','MailQueueId','filter','merge','findAndCountAll','UserId','agent','mailPause','updatedAt','rows','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','User','Agents','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','join','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','TeamId','includes','union','compact','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','nolimit','util','lodash'];(function(_0x31ca37,_0x2b814f){var _0x4300cd=function(_0x5a8d09){while(--_0x5a8d09){_0x31ca37['push'](_0x31ca37['shift']());}};_0x4300cd(++_0x2b814f);}(_0xee80,0x157));var _0x0ee8=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xee80[_0x29d915];return _0x160f86;};'use strict';var BPromise=require('bluebird');var util=require(_0x0ee8('0x0'));var _=require(_0x0ee8('0x1'));var squel=require('squel');var Redis=require(_0x0ee8('0x2'));var qs=require(_0x0ee8('0x3'));var logger=require(_0x0ee8('0x4'))(_0x0ee8('0x5'));var config=require(_0x0ee8('0x6'));var db=require(_0x0ee8('0x7'))['db'];config[_0x0ee8('0x8')]=_['defaults'](config[_0x0ee8('0x8')],{'host':_0x0ee8('0x9'),'port':0x18eb});var socket=require(_0x0ee8('0xa'))(new Redis(config['redis']));require(_0x0ee8('0xb'))['register'](socket);function respondWithStatusCode(_0x2606b7,_0xd336f5){_0xd336f5=_0xd336f5||0xcc;return function(_0xe323c4){if(_0xe323c4){return _0x2606b7[_0x0ee8('0xc')](_0xd336f5);}return _0x2606b7['status'](_0xd336f5)[_0x0ee8('0xd')]();};}function respondWithResult(_0x2a9b68,_0x3f49e0){_0x3f49e0=_0x3f49e0||0xc8;return function(_0x1639d6){if(_0x1639d6){return _0x2a9b68[_0x0ee8('0xe')](_0x3f49e0)[_0x0ee8('0xf')](_0x1639d6);}};}function respondWithFilteredResult(_0x189e26,_0x2abbfa){return function(_0x37cf38){if(_0x37cf38){var _0x13f642=typeof _0x2abbfa[_0x0ee8('0x10')]===_0x0ee8('0x11')&&typeof _0x2abbfa[_0x0ee8('0x12')]===_0x0ee8('0x11');var _0x1bab1d=_0x37cf38['count'];var _0x433214=_0x13f642?0x0:_0x2abbfa[_0x0ee8('0x10')];var _0x489d84=_0x13f642?_0x37cf38[_0x0ee8('0x13')]:_0x2abbfa['offset']+_0x2abbfa['limit'];var _0x26f7a1;if(_0x489d84>=_0x1bab1d){_0x489d84=_0x1bab1d;_0x26f7a1=0xc8;}else{_0x26f7a1=0xce;}_0x189e26[_0x0ee8('0xe')](_0x26f7a1);return _0x189e26[_0x0ee8('0x14')]('Content-Range',_0x433214+'-'+_0x489d84+'/'+_0x1bab1d)['json'](_0x37cf38);}return null;};}function saveUpdates(_0x3e1bfc){return function(_0x312951){if(_0x312951){return _0x312951[_0x0ee8('0x15')](_0x3e1bfc)[_0x0ee8('0x16')](function(_0x1251e1){return _0x1251e1;});}return null;};}function removeEntity(_0x36d4ed){return function(_0xbe9706){if(_0xbe9706){return _0xbe9706[_0x0ee8('0x17')]()[_0x0ee8('0x16')](function(){var _0x1973cb=_0xbe9706['get']({'plain':!![]});var _0x15b4ee=_0x0ee8('0x18');return db['UserProfileResource'][_0x0ee8('0x17')]({'where':{'type':_0x15b4ee,'resourceId':_0x1973cb['id']}})['then'](function(){return _0xbe9706;});})[_0x0ee8('0x16')](function(){_0x36d4ed[_0x0ee8('0xe')](0xcc)[_0x0ee8('0xd')]();});}};}function handleEntityNotFound(_0x3862c9){return function(_0x4c8f66){if(!_0x4c8f66){_0x3862c9[_0x0ee8('0xc')](0x194);}return _0x4c8f66;};}function handleError(_0x1dce25,_0x35f051){_0x35f051=_0x35f051||0x1f4;return function(_0xc4f1){logger['error'](_0xc4f1[_0x0ee8('0x19')]);if(_0xc4f1[_0x0ee8('0x1a')]){delete _0xc4f1[_0x0ee8('0x1a')];}_0x1dce25[_0x0ee8('0xe')](_0x35f051)[_0x0ee8('0x1b')](_0xc4f1);};}exports[_0x0ee8('0x1c')]=function(_0xeaca49,_0x5cac3b){var _0x1dcb35={};var _0x55a7e5={'count':0x0,'rows':[]};var _0x5a846c=_[_0x0ee8('0x1d')](db[_0x0ee8('0x1e')][_0x0ee8('0x1f')],function(_0x21e353){return{'name':_0x21e353[_0x0ee8('0x20')],'type':_0x21e353[_0x0ee8('0x21')][_0x0ee8('0x22')]};});_0x1dcb35=qs[_0x0ee8('0x23')](_0x5a846c,_0xeaca49);var _0x168d8d={'where':_0x1dcb35['where']};return db[_0x0ee8('0x1e')][_0x0ee8('0x13')](_0x168d8d)[_0x0ee8('0x16')](function(_0x43c02a){_0x55a7e5[_0x0ee8('0x13')]=_0x43c02a;_0x1dcb35[_0x0ee8('0x24')]=qs[_0x0ee8('0x24')](_0xeaca49['query']);return db['MailQueue'][_0x0ee8('0x25')](_0x1dcb35);})[_0x0ee8('0x16')](function(_0x3ba6f1){_0x55a7e5['rows']=_0x3ba6f1;return _0x55a7e5;})['then'](respondWithFilteredResult(_0x5cac3b,_0x1dcb35))[_0x0ee8('0x26')](handleError(_0x5cac3b,null));};exports['show']=function(_0xa2b389,_0x3c6af5){var _0x5f37e7={'raw':!![],'where':{'id':_0xa2b389[_0x0ee8('0x27')]['id']}},_0x2af11b={};_0x2af11b[_0x0ee8('0x28')]=_[_0x0ee8('0x29')](db[_0x0ee8('0x1e')][_0x0ee8('0x1f')]);_0x2af11b[_0x0ee8('0x2a')]=_['keys'](_0xa2b389['query']);_0x2af11b[_0x0ee8('0x2b')]=_[_0x0ee8('0x2c')](_0x2af11b[_0x0ee8('0x28')],_0x2af11b['query']);_0x5f37e7[_0x0ee8('0x2d')]=_[_0x0ee8('0x2c')](_0x2af11b['model'],qs[_0x0ee8('0x2e')](_0xa2b389['query'][_0x0ee8('0x2e')]));_0x5f37e7[_0x0ee8('0x2d')]=_0x5f37e7[_0x0ee8('0x2d')]['length']?_0x5f37e7['attributes']:_0x2af11b[_0x0ee8('0x28')];if(_0xa2b389[_0x0ee8('0x2a')][_0x0ee8('0x2f')]){_0x5f37e7[_0x0ee8('0x24')]=[{'all':!![]}];}_0x5f37e7=_['merge']({},_0x5f37e7,_0xa2b389[_0x0ee8('0x30')]);return db['MailQueue'][_0x0ee8('0x31')](_0x5f37e7)['then'](handleEntityNotFound(_0x3c6af5,null))[_0x0ee8('0x16')](respondWithResult(_0x3c6af5,null))[_0x0ee8('0x26')](handleError(_0x3c6af5,null));};exports[_0x0ee8('0x32')]=function(_0xe7d496,_0x5980f3){return db['MailQueue']['create'](_0xe7d496[_0x0ee8('0x33')],{})[_0x0ee8('0x16')](function(_0x5a812e){var _0x94f8e2=_0xe7d496[_0x0ee8('0x34')][_0x0ee8('0x35')]({'plain':!![]});if(!_0x94f8e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x94f8e2['role']===_0x0ee8('0x34')){var _0x5b5e56=_0x5a812e[_0x0ee8('0x35')]({'plain':!![]});var _0x583f82='MailQueues';return db[_0x0ee8('0x36')][_0x0ee8('0x31')]({'where':{'name':_0x583f82,'userProfileId':_0x94f8e2[_0x0ee8('0x37')]},'raw':!![]})['then'](function(_0x31b001){if(_0x31b001&&_0x31b001[_0x0ee8('0x38')]===0x0){return db['UserProfileResource'][_0x0ee8('0x32')]({'name':_0x5b5e56[_0x0ee8('0x1a')],'resourceId':_0x5b5e56['id'],'type':_0x31b001[_0x0ee8('0x1a')],'sectionId':_0x31b001['id']},{})['then'](function(){return _0x5a812e;});}else{return _0x5a812e;}})[_0x0ee8('0x26')](function(_0x20c964){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20c964);throw _0x20c964;});}return _0x5a812e;})['then'](respondWithResult(_0x5980f3,0xc9))[_0x0ee8('0x26')](handleError(_0x5980f3,null));};exports[_0x0ee8('0x15')]=function(_0x1657ed,_0x5d5fe1){if(_0x1657ed[_0x0ee8('0x33')]['id']){delete _0x1657ed[_0x0ee8('0x33')]['id'];}return db[_0x0ee8('0x1e')]['find']({'where':{'id':_0x1657ed[_0x0ee8('0x27')]['id']}})['then'](handleEntityNotFound(_0x5d5fe1,null))[_0x0ee8('0x16')](saveUpdates(_0x1657ed[_0x0ee8('0x33')],null))['then'](respondWithResult(_0x5d5fe1,null))[_0x0ee8('0x26')](handleError(_0x5d5fe1,null));};exports[_0x0ee8('0x17')]=function(_0x592da1,_0x406077){return db['MailQueue']['find']({'where':{'id':_0x592da1['params']['id']}})[_0x0ee8('0x16')](handleEntityNotFound(_0x406077,null))[_0x0ee8('0x16')](removeEntity(_0x406077,null))[_0x0ee8('0x26')](handleError(_0x406077,null));};exports['describe']=function(_0x2d8621,_0x1f7b63){return db[_0x0ee8('0x1e')][_0x0ee8('0x39')]()[_0x0ee8('0x16')](respondWithResult(_0x1f7b63,null))[_0x0ee8('0x26')](handleError(_0x1f7b63,null));};exports[_0x0ee8('0x3a')]=function(_0x13e058,_0x4049b9){var _0xfbd76a={'raw':!![],'where':{}},_0x2a47ab={},_0x1807fb;return db['MailQueue'][_0x0ee8('0x3b')]({'where':{'id':_0x13e058['params']['id']}})[_0x0ee8('0x16')](handleEntityNotFound(_0x4049b9,null))[_0x0ee8('0x16')](function(_0x537fa3){if(_0x537fa3){_0x1807fb=_0x537fa3['get']({'plain':!![]});_0x2a47ab[_0x0ee8('0x28')]=_[_0x0ee8('0x29')](db[_0x0ee8('0x3c')][_0x0ee8('0x1f')]);_0x2a47ab[_0x0ee8('0x2a')]=_[_0x0ee8('0x29')](_0x13e058[_0x0ee8('0x2a')]);_0x2a47ab[_0x0ee8('0x2b')]=_['intersection'](_0x2a47ab['model'],_0x2a47ab['query']);_0xfbd76a[_0x0ee8('0x2d')]=_[_0x0ee8('0x2c')](_0x2a47ab['model'],qs[_0x0ee8('0x2e')](_0x13e058['query'][_0x0ee8('0x2e')]));_0xfbd76a[_0x0ee8('0x2d')]=_0xfbd76a[_0x0ee8('0x2d')][_0x0ee8('0x3d')]?_0xfbd76a['attributes']:_0x2a47ab[_0x0ee8('0x28')];if(!_0x13e058[_0x0ee8('0x2a')][_0x0ee8('0x3e')]('nolimit')){_0xfbd76a[_0x0ee8('0x12')]=qs['limit'](_0x13e058['query'][_0x0ee8('0x12')]);_0xfbd76a[_0x0ee8('0x10')]=qs[_0x0ee8('0x10')](_0x13e058[_0x0ee8('0x2a')][_0x0ee8('0x10')]);}_0xfbd76a[_0x0ee8('0x3f')]=qs[_0x0ee8('0x40')](_0x13e058['query'][_0x0ee8('0x40')]);_0xfbd76a[_0x0ee8('0x41')]=qs['filters'](_[_0x0ee8('0x42')](_0x13e058[_0x0ee8('0x2a')],_0x2a47ab[_0x0ee8('0x2b')]));_0xfbd76a['where'][_0x0ee8('0x43')]=_0x537fa3['id'];if(_0x13e058[_0x0ee8('0x2a')][_0x0ee8('0x44')]){_0xfbd76a[_0x0ee8('0x41')]=_[_0x0ee8('0x45')](_0xfbd76a[_0x0ee8('0x41')],{'$or':_[_0x0ee8('0x1d')](_0xfbd76a[_0x0ee8('0x2d')],function(_0x5c266c){var _0x431403={};_0x431403[_0x5c266c]={'$like':'%'+_0x13e058['query'][_0x0ee8('0x44')]+'%'};return _0x431403;})});}_0xfbd76a=_[_0x0ee8('0x45')]({},_0xfbd76a,_0x13e058[_0x0ee8('0x30')]);return db[_0x0ee8('0x3c')][_0x0ee8('0x25')](_0xfbd76a);}})[_0x0ee8('0x16')](function(_0x52c850){if(_0x52c850){return db['User'][_0x0ee8('0x46')]({'where':{'id':_[_0x0ee8('0x1d')](_0x52c850,_0x0ee8('0x47')),'role':_0x0ee8('0x48')},'attributes':['id',_0x0ee8('0x1a'),_0x0ee8('0x49'),_0x0ee8('0x4a'),'createdAt']});}})[_0x0ee8('0x16')](function(_0x211838){if(_0x211838){return{'count':_0x211838[_0x0ee8('0x13')],'rows':_['map'](_0x211838[_0x0ee8('0x4b')],function(_0x47367c){return{'membername':_0x47367c['name'],'UserId':_0x47367c['id'],'queue_name':_0x1807fb['name'],'MailQueueId':_0x1807fb['id'],'interface':util[_0x0ee8('0x4c')](_0x0ee8('0x4d'),'SIP',_0x47367c[_0x0ee8('0x1a')]),'penalty':0x0,'paused':_0x47367c[_0x0ee8('0x49')],'createdAt':_0x47367c[_0x0ee8('0x4e')],'updatedAt':_0x47367c[_0x0ee8('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4049b9,_0xfbd76a))['catch'](handleError(_0x4049b9,null));};exports[_0x0ee8('0x4f')]=function(_0x578283,_0x445063){var _0x57d3e1={};var _0x4c1854={};var _0x3e4eec;var _0x198a81;return db[_0x0ee8('0x1e')][_0x0ee8('0x3b')]({'where':{'id':_0x578283['params']['id']}})[_0x0ee8('0x16')](handleEntityNotFound(_0x445063,null))['then'](function(_0x50d82c){if(_0x50d82c){_0x3e4eec=_0x50d82c;_0x4c1854[_0x0ee8('0x28')]=_[_0x0ee8('0x29')](db[_0x0ee8('0x50')][_0x0ee8('0x1f')]);_0x4c1854[_0x0ee8('0x2a')]=_[_0x0ee8('0x29')](_0x578283[_0x0ee8('0x2a')]);_0x4c1854['filters']=_[_0x0ee8('0x2c')](_0x4c1854[_0x0ee8('0x28')],_0x4c1854['query']);_0x57d3e1['attributes']=_[_0x0ee8('0x2c')](_0x4c1854[_0x0ee8('0x28')],qs[_0x0ee8('0x2e')](_0x578283['query']['fields']));_0x57d3e1['attributes']=_0x57d3e1[_0x0ee8('0x2d')][_0x0ee8('0x3d')]?_0x57d3e1[_0x0ee8('0x2d')]:_0x4c1854[_0x0ee8('0x28')];_0x57d3e1[_0x0ee8('0x3f')]=qs['sort'](_0x578283[_0x0ee8('0x2a')]['sort']);_0x57d3e1[_0x0ee8('0x41')]=qs[_0x0ee8('0x2b')](_['pick'](_0x578283[_0x0ee8('0x2a')],_0x4c1854['filters']));if(_0x578283[_0x0ee8('0x2a')]['filter']){_0x57d3e1[_0x0ee8('0x41')]=_['merge'](_0x57d3e1[_0x0ee8('0x41')],{'$or':_['map'](_0x57d3e1['attributes'],function(_0x5c6264){var _0x2721b5={};_0x2721b5[_0x5c6264]={'$like':'%'+_0x578283[_0x0ee8('0x2a')][_0x0ee8('0x44')]+'%'};return _0x2721b5;})});}_0x57d3e1=_[_0x0ee8('0x45')]({},_0x57d3e1,_0x578283['options']);return _0x3e4eec[_0x0ee8('0x4f')](_0x57d3e1);}})[_0x0ee8('0x16')](function(_0x29fe52){if(_0x29fe52){_0x198a81=_0x29fe52[_0x0ee8('0x3d')];if(!_0x578283['query'][_0x0ee8('0x3e')]('nolimit')){_0x57d3e1['limit']=qs['limit'](_0x578283[_0x0ee8('0x2a')][_0x0ee8('0x12')]);_0x57d3e1[_0x0ee8('0x10')]=qs['offset'](_0x578283[_0x0ee8('0x2a')][_0x0ee8('0x10')]);}return _0x3e4eec[_0x0ee8('0x4f')](_0x57d3e1);}})[_0x0ee8('0x16')](function(_0x1f7807){if(_0x1f7807){return _0x1f7807?{'count':_0x198a81,'rows':_0x1f7807}:null;}})[_0x0ee8('0x16')](respondWithResult(_0x445063,null))[_0x0ee8('0x26')](handleError(_0x445063,null));};exports[_0x0ee8('0x51')]=function(_0x3dca5c,_0x5e5b25){var _0x5cee16=_0x3dca5c[_0x0ee8('0x33')][_0x0ee8('0x52')];return db[_0x0ee8('0x50')][_0x0ee8('0x25')]({'where':{'id':_0x5cee16},'attributes':['id'],'include':[{'model':db[_0x0ee8('0x53')],'as':_0x0ee8('0x54'),'attributes':['id',_0x0ee8('0x1a'),'online','voicePause',_0x0ee8('0x55')],'raw':!![]}]})[_0x0ee8('0x16')](function(_0x4df4ae){if(_0x4df4ae){var _0x31ba9b=_[_0x0ee8('0x56')](_0x4df4ae,function(_0xfb12ca){var _0x5e4893=_0xfb12ca['get']({'plain':!![]});return _0x5e4893['Agents'];});return db[_0x0ee8('0x1e')][_0x0ee8('0x31')]({'where':{'id':_0x3dca5c['params']['id']}})[_0x0ee8('0x16')](function(_0x32ee4e){return db['sequelize'][_0x0ee8('0x57')](function(_0x1cc721){return _0x32ee4e[_0x0ee8('0x51')](_0x5cee16,{'transaction':_0x1cc721})['then'](function(){return BPromise[_0x0ee8('0x58')](_0x31ba9b,function(_0x323bf2){return db[_0x0ee8('0x3c')][_0x0ee8('0x59')]({'where':{'UserId':_0x323bf2['id'],'MailQueueId':_0x3dca5c['params']['id']},'transaction':_0x1cc721});});})[_0x0ee8('0x16')](function(){_0x31ba9b[_0x0ee8('0x5a')](function(_0x36c608){socket[_0x0ee8('0x5b')]('userMailQueue:save',{'UserId':_0x36c608['id'],'MailQueueId':_0x32ee4e['id']});});});});});}})[_0x0ee8('0x16')](respondWithStatusCode(_0x5e5b25,null))[_0x0ee8('0x26')](handleError(_0x5e5b25,null));};exports[_0x0ee8('0x5c')]=function(_0x4f2a33,_0x496135){return db[_0x0ee8('0x50')]['findAll']({'where':{'id':_0x4f2a33[_0x0ee8('0x2a')][_0x0ee8('0x52')]},'attributes':['id'],'include':[{'model':db[_0x0ee8('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x496135,null))[_0x0ee8('0x16')](function(_0x4fff0f){var _0x52e05f=_[_0x0ee8('0x1d')](_0x4fff0f,'id');var _0xb8b394=[];var _0x269b60=[];var _0x419053=squel[_0x0ee8('0x5d')]();_0x419053['field'](_0x0ee8('0x5e'))[_0x0ee8('0x5f')]('team_has_mail_queues','tq')[_0x0ee8('0x60')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0ee8('0x61'),_0x4f2a33['params']['id']);for(var _0x2bfd49=0x0;_0x2bfd49<_0x4fff0f['length'];_0x2bfd49+=0x1){let _0x734364=_0x4fff0f[_0x2bfd49];for(var _0x3fac35=0x0;_0x3fac35<_0x734364[_0x0ee8('0x54')]['length'];_0x3fac35+=0x1){let _0x304872=_0x734364[_0x0ee8('0x54')][_0x3fac35];var _0x2ddee8=_0x419053['clone']();_0x2ddee8[_0x0ee8('0x41')](_0x0ee8('0x62'),_0x304872['id']);_0x269b60['push'](db[_0x0ee8('0x63')]['query'](_0x2ddee8[_0x0ee8('0x64')](),{'type':db[_0x0ee8('0x63')][_0x0ee8('0x65')][_0x0ee8('0x66')]})['then'](function(_0x5bc781){if(_0x5bc781[_0x0ee8('0x3d')]===0x1){return _0x304872['id'];}else{var _0x171c5d=_['every'](_[_0x0ee8('0x1d')](_0x5bc781,_0x0ee8('0x67')),function(_0x54a2ab){return _[_0x0ee8('0x68')](_0x52e05f,_0x54a2ab);});if(_0x171c5d){return _0x304872['id'];}}}));}}return BPromise['all'](_0x269b60)[_0x0ee8('0x16')](function(_0x240777){_0xb8b394=_(_0xb8b394)[_0x0ee8('0x69')](_0x240777)[_0x0ee8('0x6a')]()['value']();return db[_0x0ee8('0x1e')][_0x0ee8('0x31')]({'where':{'id':_0x4f2a33[_0x0ee8('0x27')]['id']}})['then'](function(_0x4735e4){return db[_0x0ee8('0x63')][_0x0ee8('0x57')](function(_0x468521){return _0x4735e4['removeTeams'](_0x4f2a33[_0x0ee8('0x2a')]['ids'],{'transaction':_0x468521})[_0x0ee8('0x16')](function(){if(!_['isEmpty'](_0xb8b394)){return _0x4735e4[_0x0ee8('0x6b')](_0xb8b394,{'transaction':_0x468521});}})[_0x0ee8('0x16')](function(){_0xb8b394[_0x0ee8('0x5a')](function(_0x1fcf88){socket['emit']('userMailQueue:remove',{'UserId':_0x1fcf88,'MailQueueId':_0x4735e4['id']});});});});});});})[_0x0ee8('0x16')](respondWithStatusCode(_0x496135,null))['catch'](handleError(_0x496135,null));};exports[_0x0ee8('0x6c')]=function(_0x299d0f,_0x3b6174){return db[_0x0ee8('0x1e')]['find']({'where':{'id':_0x299d0f['params']['id']}})['then'](handleEntityNotFound(_0x3b6174,null))[_0x0ee8('0x16')](function(_0x3f3b3f){if(_0x3f3b3f){return _0x3f3b3f[_0x0ee8('0x6c')](_0x299d0f['body']['ids'],_[_0x0ee8('0x6d')](_0x299d0f[_0x0ee8('0x33')],[_0x0ee8('0x52'),'id'])||{})[_0x0ee8('0x6e')](function(_0xbf65){for(var _0x41bd22=0x0;_0x41bd22<_0x299d0f[_0x0ee8('0x33')][_0x0ee8('0x52')][_0x0ee8('0x3d')];_0x41bd22+=0x1){socket[_0x0ee8('0x5b')]('userMailQueue:save',{'UserId':Number(_0x299d0f[_0x0ee8('0x33')][_0x0ee8('0x52')][_0x41bd22]),'MailQueueId':Number(_0x299d0f[_0x0ee8('0x27')]['id'])});}return _0xbf65;});}})[_0x0ee8('0x16')](respondWithResult(_0x3b6174,null))['catch'](handleError(_0x3b6174,null));};exports['removeAgents']=function(_0x498117,_0x2689d3){return db['MailQueue'][_0x0ee8('0x31')]({'where':{'id':_0x498117[_0x0ee8('0x27')]['id']}})[_0x0ee8('0x16')](handleEntityNotFound(_0x2689d3,null))[_0x0ee8('0x16')](function(_0x4730ac){if(_0x4730ac){return _0x4730ac['removeAgents'](_0x498117[_0x0ee8('0x2a')][_0x0ee8('0x52')])[_0x0ee8('0x16')](function(){if(_[_0x0ee8('0x6f')](_0x498117[_0x0ee8('0x2a')]['ids'])){for(var _0x5e20dc=0x0;_0x5e20dc<_0x498117[_0x0ee8('0x2a')]['ids']['length'];_0x5e20dc+=0x1){socket[_0x0ee8('0x5b')](_0x0ee8('0x70'),{'UserId':Number(_0x498117[_0x0ee8('0x2a')][_0x0ee8('0x52')][_0x5e20dc]),'MailQueueId':Number(_0x498117['params']['id'])});}}else{socket[_0x0ee8('0x5b')](_0x0ee8('0x70'),{'UserId':Number(_0x498117[_0x0ee8('0x2a')][_0x0ee8('0x52')]),'MailQueueId':Number(_0x498117[_0x0ee8('0x27')]['id'])});}});}})[_0x0ee8('0x16')](respondWithStatusCode(_0x2689d3,null))['catch'](handleError(_0x2689d3,null));};exports[_0x0ee8('0x71')]=function(_0x1fbb6c,_0x2b2bf6){var _0x334219={};var _0x49bfb4={};var _0x306404;var _0x1139a1;return db[_0x0ee8('0x1e')][_0x0ee8('0x3b')]({'where':{'id':_0x1fbb6c[_0x0ee8('0x27')]['id']}})[_0x0ee8('0x16')](handleEntityNotFound(_0x2b2bf6,null))[_0x0ee8('0x16')](function(_0x4d3a18){if(_0x4d3a18){_0x306404=_0x4d3a18;_0x49bfb4[_0x0ee8('0x28')]=_[_0x0ee8('0x29')](db[_0x0ee8('0x53')]['rawAttributes']);_0x49bfb4[_0x0ee8('0x2a')]=_[_0x0ee8('0x29')](_0x1fbb6c[_0x0ee8('0x2a')]);_0x49bfb4[_0x0ee8('0x2b')]=_[_0x0ee8('0x2c')](_0x49bfb4['model'],_0x49bfb4[_0x0ee8('0x2a')]);_0x334219[_0x0ee8('0x2d')]=_[_0x0ee8('0x2c')](_0x49bfb4[_0x0ee8('0x28')],qs['fields'](_0x1fbb6c[_0x0ee8('0x2a')][_0x0ee8('0x2e')]));_0x334219[_0x0ee8('0x2d')]=_0x334219[_0x0ee8('0x2d')][_0x0ee8('0x3d')]?_0x334219[_0x0ee8('0x2d')]:_0x49bfb4[_0x0ee8('0x28')];_0x334219[_0x0ee8('0x3f')]=qs[_0x0ee8('0x40')](_0x1fbb6c[_0x0ee8('0x2a')][_0x0ee8('0x40')]);_0x334219[_0x0ee8('0x41')]=qs[_0x0ee8('0x2b')](_[_0x0ee8('0x42')](_0x1fbb6c[_0x0ee8('0x2a')],_0x49bfb4[_0x0ee8('0x2b')]));if(_0x1fbb6c[_0x0ee8('0x2a')][_0x0ee8('0x44')]){_0x334219[_0x0ee8('0x41')]=_[_0x0ee8('0x45')](_0x334219[_0x0ee8('0x41')],{'$or':_[_0x0ee8('0x1d')](_0x334219['attributes'],function(_0x430f5b){var _0x844340={};_0x844340[_0x430f5b]={'$like':'%'+_0x1fbb6c[_0x0ee8('0x2a')][_0x0ee8('0x44')]+'%'};return _0x844340;})});}_0x334219=_[_0x0ee8('0x45')]({},_0x334219,_0x1fbb6c[_0x0ee8('0x30')]);return _0x306404[_0x0ee8('0x71')](_0x334219);}})[_0x0ee8('0x16')](function(_0x45e830){if(_0x45e830){_0x1139a1=_0x45e830['length'];if(!_0x1fbb6c['query']['hasOwnProperty'](_0x0ee8('0x72'))){_0x334219['limit']=qs[_0x0ee8('0x12')](_0x1fbb6c[_0x0ee8('0x2a')]['limit']);_0x334219[_0x0ee8('0x10')]=qs[_0x0ee8('0x10')](_0x1fbb6c[_0x0ee8('0x2a')][_0x0ee8('0x10')]);}return _0x306404['getAgents'](_0x334219);}})[_0x0ee8('0x16')](function(_0x2a2277){if(_0x2a2277){return _0x2a2277?{'count':_0x1139a1,'rows':_0x2a2277}:null;}})[_0x0ee8('0x16')](respondWithResult(_0x2b2bf6,null))[_0x0ee8('0x26')](handleError(_0x2b2bf6,null));}; \ No newline at end of file +var _0x572f=['TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','omit','spread','getAgents','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','fieldName','type','getOptions','where','include','query','findAll','catch','show','params','model','keys','rawAttributes','intersection','fields','attributes','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserMailQueue','hasOwnProperty','order','sort','MailQueueId','filter','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','filters','length','pick','getTeams','nolimit','addTeams','ids','flatMap','transaction','each','forEach','emit','userMailQueue:save','removeTeams','Agents','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every'];(function(_0x5c107d,_0x155dbe){var _0x3eaf06=function(_0x348dd6){while(--_0x348dd6){_0x5c107d['push'](_0x5c107d['shift']());}};_0x3eaf06(++_0x155dbe);}(_0x572f,0x80));var _0xf572=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x572f[_0xfae23b];return _0x200640;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xf572('0x0'))(_0xf572('0x1'));var config=require(_0xf572('0x2'));var db=require(_0xf572('0x3'))['db'];config[_0xf572('0x4')]=_[_0xf572('0x5')](config[_0xf572('0x4')],{'host':_0xf572('0x6'),'port':0x18eb});var socket=require(_0xf572('0x7'))(new Redis(config[_0xf572('0x4')]));require(_0xf572('0x8'))[_0xf572('0x9')](socket);function respondWithStatusCode(_0x56161e,_0xc8583d){_0xc8583d=_0xc8583d||0xcc;return function(_0x5eff42){if(_0x5eff42){return _0x56161e[_0xf572('0xa')](_0xc8583d);}return _0x56161e[_0xf572('0xb')](_0xc8583d)[_0xf572('0xc')]();};}function respondWithResult(_0x31c053,_0x4bc6bb){_0x4bc6bb=_0x4bc6bb||0xc8;return function(_0x5e78eb){if(_0x5e78eb){return _0x31c053['status'](_0x4bc6bb)[_0xf572('0xd')](_0x5e78eb);}};}function respondWithFilteredResult(_0x49955f,_0x5bb2d6){return function(_0x324679){if(_0x324679){var _0x47435f=typeof _0x5bb2d6['offset']===_0xf572('0xe')&&typeof _0x5bb2d6[_0xf572('0xf')]===_0xf572('0xe');var _0x51185d=_0x324679[_0xf572('0x10')];var _0x225e80=_0x47435f?0x0:_0x5bb2d6[_0xf572('0x11')];var _0x477d04=_0x47435f?_0x324679[_0xf572('0x10')]:_0x5bb2d6[_0xf572('0x11')]+_0x5bb2d6['limit'];var _0x2a2821;if(_0x477d04>=_0x51185d){_0x477d04=_0x51185d;_0x2a2821=0xc8;}else{_0x2a2821=0xce;}_0x49955f[_0xf572('0xb')](_0x2a2821);return _0x49955f[_0xf572('0x12')](_0xf572('0x13'),_0x225e80+'-'+_0x477d04+'/'+_0x51185d)[_0xf572('0xd')](_0x324679);}return null;};}function saveUpdates(_0x4ca943){return function(_0x8cbd98){if(_0x8cbd98){return _0x8cbd98['update'](_0x4ca943)[_0xf572('0x14')](function(_0x3a4e8d){return _0x3a4e8d;});}return null;};}function removeEntity(_0x6c8b16){return function(_0x49444e){if(_0x49444e){return _0x49444e['destroy']()[_0xf572('0x14')](function(){var _0x4deeea=_0x49444e['get']({'plain':!![]});var _0x5b1b8b=_0xf572('0x15');return db[_0xf572('0x16')][_0xf572('0x17')]({'where':{'type':_0x5b1b8b,'resourceId':_0x4deeea['id']}})[_0xf572('0x14')](function(){return _0x49444e;});})[_0xf572('0x14')](function(){_0x6c8b16[_0xf572('0xb')](0xcc)[_0xf572('0xc')]();});}};}function handleEntityNotFound(_0x165787){return function(_0x2e0b30){if(!_0x2e0b30){_0x165787[_0xf572('0xa')](0x194);}return _0x2e0b30;};}function handleError(_0x5b1483,_0x11ca88){_0x11ca88=_0x11ca88||0x1f4;return function(_0x408fa4){logger[_0xf572('0x18')](_0x408fa4[_0xf572('0x19')]);if(_0x408fa4[_0xf572('0x1a')]){delete _0x408fa4[_0xf572('0x1a')];}_0x5b1483[_0xf572('0xb')](_0x11ca88)[_0xf572('0x1b')](_0x408fa4);};}exports[_0xf572('0x1c')]=function(_0x11a266,_0x2aa077){var _0x199018={};var _0x59dcc4={'count':0x0,'rows':[]};var _0x444b7a=_[_0xf572('0x1d')](db[_0xf572('0x1e')]['rawAttributes'],function(_0x3f5f31){return{'name':_0x3f5f31[_0xf572('0x1f')],'type':_0x3f5f31[_0xf572('0x20')]['key']};});_0x199018=qs[_0xf572('0x21')](_0x444b7a,_0x11a266);var _0x32757f={'where':_0x199018[_0xf572('0x22')]};return db['MailQueue'][_0xf572('0x10')](_0x32757f)[_0xf572('0x14')](function(_0x2984c0){_0x59dcc4[_0xf572('0x10')]=_0x2984c0;_0x199018['include']=qs[_0xf572('0x23')](_0x11a266[_0xf572('0x24')]);return db[_0xf572('0x1e')][_0xf572('0x25')](_0x199018);})[_0xf572('0x14')](function(_0x26eb66){_0x59dcc4['rows']=_0x26eb66;return _0x59dcc4;})[_0xf572('0x14')](respondWithFilteredResult(_0x2aa077,_0x199018))[_0xf572('0x26')](handleError(_0x2aa077,null));};exports[_0xf572('0x27')]=function(_0x3628ec,_0x33b223){var _0x511459={'raw':!![],'where':{'id':_0x3628ec[_0xf572('0x28')]['id']}},_0x270d90={};_0x270d90[_0xf572('0x29')]=_[_0xf572('0x2a')](db[_0xf572('0x1e')][_0xf572('0x2b')]);_0x270d90['query']=_[_0xf572('0x2a')](_0x3628ec[_0xf572('0x24')]);_0x270d90['filters']=_[_0xf572('0x2c')](_0x270d90[_0xf572('0x29')],_0x270d90['query']);_0x511459['attributes']=_[_0xf572('0x2c')](_0x270d90[_0xf572('0x29')],qs[_0xf572('0x2d')](_0x3628ec['query'][_0xf572('0x2d')]));_0x511459[_0xf572('0x2e')]=_0x511459[_0xf572('0x2e')]['length']?_0x511459['attributes']:_0x270d90[_0xf572('0x29')];if(_0x3628ec[_0xf572('0x24')]['includeAll']){_0x511459['include']=[{'all':!![]}];}_0x511459=_[_0xf572('0x2f')]({},_0x511459,_0x3628ec[_0xf572('0x30')]);return db['MailQueue']['find'](_0x511459)['then'](handleEntityNotFound(_0x33b223,null))[_0xf572('0x14')](respondWithResult(_0x33b223,null))['catch'](handleError(_0x33b223,null));};exports[_0xf572('0x31')]=function(_0x298dfd,_0x24688e){return db[_0xf572('0x1e')]['create'](_0x298dfd[_0xf572('0x32')],{})[_0xf572('0x14')](function(_0x843477){var _0x27b21f=_0x298dfd['user'][_0xf572('0x33')]({'plain':!![]});if(!_0x27b21f)throw new Error(_0xf572('0x34'));if(_0x27b21f[_0xf572('0x35')]==='user'){var _0x1f0e7f=_0x843477[_0xf572('0x33')]({'plain':!![]});var _0x44ddb6=_0xf572('0x15');return db[_0xf572('0x36')][_0xf572('0x37')]({'where':{'name':_0x44ddb6,'userProfileId':_0x27b21f[_0xf572('0x38')]},'raw':!![]})[_0xf572('0x14')](function(_0x3fc0b2){if(_0x3fc0b2&&_0x3fc0b2[_0xf572('0x39')]===0x0){return db[_0xf572('0x16')][_0xf572('0x31')]({'name':_0x1f0e7f[_0xf572('0x1a')],'resourceId':_0x1f0e7f['id'],'type':_0x3fc0b2[_0xf572('0x1a')],'sectionId':_0x3fc0b2['id']},{})[_0xf572('0x14')](function(){return _0x843477;});}else{return _0x843477;}})[_0xf572('0x26')](function(_0x26b9c0){logger['error'](_0xf572('0x3a'),_0x26b9c0);throw _0x26b9c0;});}return _0x843477;})[_0xf572('0x14')](respondWithResult(_0x24688e,0xc9))[_0xf572('0x26')](handleError(_0x24688e,null));};exports[_0xf572('0x3b')]=function(_0x1fef46,_0x39f15b){if(_0x1fef46[_0xf572('0x32')]['id']){delete _0x1fef46[_0xf572('0x32')]['id'];}return db['MailQueue'][_0xf572('0x37')]({'where':{'id':_0x1fef46['params']['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x39f15b,null))[_0xf572('0x14')](saveUpdates(_0x1fef46[_0xf572('0x32')],null))[_0xf572('0x14')](respondWithResult(_0x39f15b,null))[_0xf572('0x26')](handleError(_0x39f15b,null));};exports[_0xf572('0x17')]=function(_0x47d87f,_0x1b33a0){return db[_0xf572('0x1e')][_0xf572('0x37')]({'where':{'id':_0x47d87f[_0xf572('0x28')]['id']}})['then'](handleEntityNotFound(_0x1b33a0,null))[_0xf572('0x14')](removeEntity(_0x1b33a0,null))['catch'](handleError(_0x1b33a0,null));};exports[_0xf572('0x3c')]=function(_0xa6a601,_0x22d237){return db[_0xf572('0x1e')][_0xf572('0x3c')]()[_0xf572('0x14')](respondWithResult(_0x22d237,null))[_0xf572('0x26')](handleError(_0x22d237,null));};exports['getMembers']=function(_0x5448ac,_0x5c509d){var _0x3804cc={'raw':!![],'where':{}},_0x50a0c7={},_0x53c14f;return db['MailQueue'][_0xf572('0x3d')]({'where':{'id':_0x5448ac[_0xf572('0x28')]['id']}})['then'](handleEntityNotFound(_0x5c509d,null))[_0xf572('0x14')](function(_0xec6df7){if(_0xec6df7){_0x53c14f=_0xec6df7[_0xf572('0x33')]({'plain':!![]});_0x50a0c7['model']=_[_0xf572('0x2a')](db[_0xf572('0x3e')][_0xf572('0x2b')]);_0x50a0c7[_0xf572('0x24')]=_['keys'](_0x5448ac['query']);_0x50a0c7['filters']=_[_0xf572('0x2c')](_0x50a0c7['model'],_0x50a0c7[_0xf572('0x24')]);_0x3804cc['attributes']=_[_0xf572('0x2c')](_0x50a0c7[_0xf572('0x29')],qs[_0xf572('0x2d')](_0x5448ac['query'][_0xf572('0x2d')]));_0x3804cc[_0xf572('0x2e')]=_0x3804cc['attributes']['length']?_0x3804cc[_0xf572('0x2e')]:_0x50a0c7[_0xf572('0x29')];if(!_0x5448ac[_0xf572('0x24')][_0xf572('0x3f')]('nolimit')){_0x3804cc[_0xf572('0xf')]=qs[_0xf572('0xf')](_0x5448ac[_0xf572('0x24')][_0xf572('0xf')]);_0x3804cc[_0xf572('0x11')]=qs[_0xf572('0x11')](_0x5448ac['query']['offset']);}_0x3804cc[_0xf572('0x40')]=qs['sort'](_0x5448ac[_0xf572('0x24')][_0xf572('0x41')]);_0x3804cc[_0xf572('0x22')]=qs['filters'](_['pick'](_0x5448ac[_0xf572('0x24')],_0x50a0c7['filters']));_0x3804cc[_0xf572('0x22')][_0xf572('0x42')]=_0xec6df7['id'];if(_0x5448ac['query'][_0xf572('0x43')]){_0x3804cc['where']=_[_0xf572('0x2f')](_0x3804cc[_0xf572('0x22')],{'$or':_[_0xf572('0x1d')](_0x3804cc[_0xf572('0x2e')],function(_0x19c662){var _0x46b194={};_0x46b194[_0x19c662]={'$like':'%'+_0x5448ac[_0xf572('0x24')][_0xf572('0x43')]+'%'};return _0x46b194;})});}_0x3804cc=_[_0xf572('0x2f')]({},_0x3804cc,_0x5448ac[_0xf572('0x30')]);return db[_0xf572('0x3e')]['findAll'](_0x3804cc);}})['then'](function(_0x442e0a){if(_0x442e0a){return db[_0xf572('0x44')]['findAndCountAll']({'where':{'id':_[_0xf572('0x1d')](_0x442e0a,_0xf572('0x45')),'role':_0xf572('0x46')},'attributes':['id','name',_0xf572('0x47'),_0xf572('0x48'),_0xf572('0x49')]});}})[_0xf572('0x14')](function(_0x1df082){if(_0x1df082){return{'count':_0x1df082[_0xf572('0x10')],'rows':_[_0xf572('0x1d')](_0x1df082['rows'],function(_0x2edc5f){return{'membername':_0x2edc5f[_0xf572('0x1a')],'UserId':_0x2edc5f['id'],'queue_name':_0x53c14f[_0xf572('0x1a')],'MailQueueId':_0x53c14f['id'],'interface':util[_0xf572('0x4a')](_0xf572('0x4b'),_0xf572('0x4c'),_0x2edc5f['name']),'penalty':0x0,'paused':_0x2edc5f[_0xf572('0x47')],'createdAt':_0x2edc5f[_0xf572('0x49')],'updatedAt':_0x2edc5f[_0xf572('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf572('0x14')](respondWithFilteredResult(_0x5c509d,_0x3804cc))['catch'](handleError(_0x5c509d,null));};exports['getTeams']=function(_0x19bce4,_0x30ee87){var _0xe31885={};var _0x424ec7={};var _0x21df03;var _0x39b5eb;return db['MailQueue'][_0xf572('0x3d')]({'where':{'id':_0x19bce4['params']['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x30ee87,null))[_0xf572('0x14')](function(_0x150023){if(_0x150023){_0x21df03=_0x150023;_0x424ec7[_0xf572('0x29')]=_[_0xf572('0x2a')](db[_0xf572('0x4d')][_0xf572('0x2b')]);_0x424ec7[_0xf572('0x24')]=_['keys'](_0x19bce4[_0xf572('0x24')]);_0x424ec7[_0xf572('0x4e')]=_[_0xf572('0x2c')](_0x424ec7['model'],_0x424ec7[_0xf572('0x24')]);_0xe31885[_0xf572('0x2e')]=_[_0xf572('0x2c')](_0x424ec7['model'],qs[_0xf572('0x2d')](_0x19bce4[_0xf572('0x24')][_0xf572('0x2d')]));_0xe31885[_0xf572('0x2e')]=_0xe31885[_0xf572('0x2e')][_0xf572('0x4f')]?_0xe31885[_0xf572('0x2e')]:_0x424ec7['model'];_0xe31885[_0xf572('0x40')]=qs[_0xf572('0x41')](_0x19bce4['query'][_0xf572('0x41')]);_0xe31885[_0xf572('0x22')]=qs[_0xf572('0x4e')](_[_0xf572('0x50')](_0x19bce4[_0xf572('0x24')],_0x424ec7[_0xf572('0x4e')]));if(_0x19bce4[_0xf572('0x24')][_0xf572('0x43')]){_0xe31885[_0xf572('0x22')]=_[_0xf572('0x2f')](_0xe31885[_0xf572('0x22')],{'$or':_[_0xf572('0x1d')](_0xe31885[_0xf572('0x2e')],function(_0x24d3f4){var _0x3ed664={};_0x3ed664[_0x24d3f4]={'$like':'%'+_0x19bce4[_0xf572('0x24')]['filter']+'%'};return _0x3ed664;})});}_0xe31885=_['merge']({},_0xe31885,_0x19bce4['options']);return _0x21df03[_0xf572('0x51')](_0xe31885);}})[_0xf572('0x14')](function(_0x52d682){if(_0x52d682){_0x39b5eb=_0x52d682['length'];if(!_0x19bce4[_0xf572('0x24')][_0xf572('0x3f')](_0xf572('0x52'))){_0xe31885[_0xf572('0xf')]=qs[_0xf572('0xf')](_0x19bce4[_0xf572('0x24')][_0xf572('0xf')]);_0xe31885[_0xf572('0x11')]=qs[_0xf572('0x11')](_0x19bce4[_0xf572('0x24')]['offset']);}return _0x21df03[_0xf572('0x51')](_0xe31885);}})['then'](function(_0x407f21){if(_0x407f21){return _0x407f21?{'count':_0x39b5eb,'rows':_0x407f21}:null;}})['then'](respondWithResult(_0x30ee87,null))[_0xf572('0x26')](handleError(_0x30ee87,null));};exports[_0xf572('0x53')]=function(_0x1a0894,_0x27c0d8){var _0x1ed3fb=_0x1a0894[_0xf572('0x32')][_0xf572('0x54')];return db[_0xf572('0x4d')]['findAll']({'where':{'id':_0x1ed3fb},'attributes':['id'],'include':[{'model':db[_0xf572('0x44')],'as':'Agents','attributes':['id',_0xf572('0x1a'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x46ad14){if(_0x46ad14){var _0x4fd368=_[_0xf572('0x55')](_0x46ad14,function(_0x501d29){var _0x36a345=_0x501d29['get']({'plain':!![]});return _0x36a345['Agents'];});return db[_0xf572('0x1e')][_0xf572('0x37')]({'where':{'id':_0x1a0894[_0xf572('0x28')]['id']}})[_0xf572('0x14')](function(_0x43b9a9){return db['sequelize'][_0xf572('0x56')](function(_0x5486fc){return _0x43b9a9[_0xf572('0x53')](_0x1ed3fb,{'transaction':_0x5486fc})['then'](function(){return BPromise[_0xf572('0x57')](_0x4fd368,function(_0x4d3979){return db[_0xf572('0x3e')]['findOrCreate']({'where':{'UserId':_0x4d3979['id'],'MailQueueId':_0x1a0894[_0xf572('0x28')]['id']},'transaction':_0x5486fc});});})[_0xf572('0x14')](function(){_0x4fd368[_0xf572('0x58')](function(_0x4edb09){socket[_0xf572('0x59')](_0xf572('0x5a'),{'UserId':_0x4edb09['id'],'MailQueueId':_0x43b9a9['id']});});});});});}})[_0xf572('0x14')](respondWithStatusCode(_0x27c0d8,null))['catch'](handleError(_0x27c0d8,null));};exports[_0xf572('0x5b')]=function(_0x388dc2,_0x8413ae){return db[_0xf572('0x4d')]['findAll']({'where':{'id':_0x388dc2['query'][_0xf572('0x54')]},'attributes':['id'],'include':[{'model':db[_0xf572('0x44')],'as':_0xf572('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xf572('0x14')](handleEntityNotFound(_0x8413ae,null))[_0xf572('0x14')](function(_0x549cbd){var _0x5ce187=_[_0xf572('0x1d')](_0x549cbd,'id');var _0x43314b=[];var _0x1cbee5=[];var _0x40a31c=squel['select']();_0x40a31c[_0xf572('0x5d')]('tq.TeamId')[_0xf572('0x5e')](_0xf572('0x5f'),'tq')[_0xf572('0x60')](_0xf572('0x61'),'ut',_0xf572('0x62'))['where']('MailQueueId\x20=\x20?',_0x388dc2[_0xf572('0x28')]['id']);for(var _0x2a2b2c=0x0;_0x2a2b2c<_0x549cbd[_0xf572('0x4f')];_0x2a2b2c+=0x1){let _0x307192=_0x549cbd[_0x2a2b2c];for(var _0x1818ae=0x0;_0x1818ae<_0x307192['Agents'][_0xf572('0x4f')];_0x1818ae+=0x1){let _0x265bab=_0x307192[_0xf572('0x5c')][_0x1818ae];var _0x4509c5=_0x40a31c['clone']();_0x4509c5[_0xf572('0x22')](_0xf572('0x63'),_0x265bab['id']);_0x1cbee5[_0xf572('0x64')](db[_0xf572('0x65')][_0xf572('0x24')](_0x4509c5[_0xf572('0x66')](),{'type':db[_0xf572('0x65')][_0xf572('0x67')][_0xf572('0x68')]})[_0xf572('0x14')](function(_0xf4ebbd){if(_0xf4ebbd['length']===0x1){return _0x265bab['id'];}else{var _0x4403d=_[_0xf572('0x69')](_[_0xf572('0x1d')](_0xf4ebbd,_0xf572('0x6a')),function(_0x5e6b0d){return _['includes'](_0x5ce187,_0x5e6b0d);});if(_0x4403d){return _0x265bab['id'];}}}));}}return BPromise[_0xf572('0x6b')](_0x1cbee5)[_0xf572('0x14')](function(_0x2795cb){_0x43314b=_(_0x43314b)[_0xf572('0x6c')](_0x2795cb)[_0xf572('0x6d')]()[_0xf572('0x6e')]();return db[_0xf572('0x1e')]['find']({'where':{'id':_0x388dc2[_0xf572('0x28')]['id']}})['then'](function(_0x28506a){return db[_0xf572('0x65')][_0xf572('0x56')](function(_0x4ef879){return _0x28506a[_0xf572('0x5b')](_0x388dc2[_0xf572('0x24')][_0xf572('0x54')],{'transaction':_0x4ef879})[_0xf572('0x14')](function(){if(!_[_0xf572('0x6f')](_0x43314b)){return _0x28506a[_0xf572('0x70')](_0x43314b,{'transaction':_0x4ef879});}})[_0xf572('0x14')](function(){_0x43314b[_0xf572('0x58')](function(_0x153bc8){socket[_0xf572('0x59')](_0xf572('0x71'),{'UserId':_0x153bc8,'MailQueueId':_0x28506a['id']});});});});});});})[_0xf572('0x14')](respondWithStatusCode(_0x8413ae,null))['catch'](handleError(_0x8413ae,null));};exports['addAgents']=function(_0xefb733,_0x5908a8){return db[_0xf572('0x1e')][_0xf572('0x37')]({'where':{'id':_0xefb733[_0xf572('0x28')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x5908a8,null))['then'](function(_0x3e471a){if(_0x3e471a){return _0x3e471a['addAgents'](_0xefb733[_0xf572('0x32')][_0xf572('0x54')],_[_0xf572('0x72')](_0xefb733['body'],['ids','id'])||{})[_0xf572('0x73')](function(_0x15e7da){for(var _0xbf09c5=0x0;_0xbf09c5<_0xefb733['body']['ids'][_0xf572('0x4f')];_0xbf09c5+=0x1){socket[_0xf572('0x59')](_0xf572('0x5a'),{'UserId':Number(_0xefb733[_0xf572('0x32')][_0xf572('0x54')][_0xbf09c5]),'MailQueueId':Number(_0xefb733[_0xf572('0x28')]['id'])});}return _0x15e7da;});}})[_0xf572('0x14')](respondWithResult(_0x5908a8,null))['catch'](handleError(_0x5908a8,null));};exports[_0xf572('0x70')]=function(_0x3c4b0f,_0x54039b){return db[_0xf572('0x1e')][_0xf572('0x37')]({'where':{'id':_0x3c4b0f[_0xf572('0x28')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x54039b,null))[_0xf572('0x14')](function(_0x179d57){if(_0x179d57){return _0x179d57[_0xf572('0x70')](_0x3c4b0f[_0xf572('0x24')][_0xf572('0x54')])[_0xf572('0x14')](function(){if(_['isArray'](_0x3c4b0f[_0xf572('0x24')][_0xf572('0x54')])){for(var _0x36d514=0x0;_0x36d514<_0x3c4b0f['query'][_0xf572('0x54')][_0xf572('0x4f')];_0x36d514+=0x1){socket[_0xf572('0x59')](_0xf572('0x71'),{'UserId':Number(_0x3c4b0f['query'][_0xf572('0x54')][_0x36d514]),'MailQueueId':Number(_0x3c4b0f['params']['id'])});}}else{socket[_0xf572('0x59')](_0xf572('0x71'),{'UserId':Number(_0x3c4b0f[_0xf572('0x24')]['ids']),'MailQueueId':Number(_0x3c4b0f[_0xf572('0x28')]['id'])});}});}})[_0xf572('0x14')](respondWithStatusCode(_0x54039b,null))[_0xf572('0x26')](handleError(_0x54039b,null));};exports[_0xf572('0x74')]=function(_0x416e61,_0x53d2aa){var _0x2ee4be={};var _0x37e758={};var _0x54ab06;var _0x5e4dc6;return db[_0xf572('0x1e')][_0xf572('0x3d')]({'where':{'id':_0x416e61[_0xf572('0x28')]['id']}})[_0xf572('0x14')](handleEntityNotFound(_0x53d2aa,null))[_0xf572('0x14')](function(_0x1c804f){if(_0x1c804f){_0x54ab06=_0x1c804f;_0x37e758[_0xf572('0x29')]=_[_0xf572('0x2a')](db[_0xf572('0x44')]['rawAttributes']);_0x37e758[_0xf572('0x24')]=_[_0xf572('0x2a')](_0x416e61[_0xf572('0x24')]);_0x37e758['filters']=_[_0xf572('0x2c')](_0x37e758[_0xf572('0x29')],_0x37e758[_0xf572('0x24')]);_0x2ee4be['attributes']=_[_0xf572('0x2c')](_0x37e758[_0xf572('0x29')],qs[_0xf572('0x2d')](_0x416e61[_0xf572('0x24')][_0xf572('0x2d')]));_0x2ee4be['attributes']=_0x2ee4be[_0xf572('0x2e')][_0xf572('0x4f')]?_0x2ee4be['attributes']:_0x37e758[_0xf572('0x29')];_0x2ee4be['order']=qs[_0xf572('0x41')](_0x416e61[_0xf572('0x24')]['sort']);_0x2ee4be[_0xf572('0x22')]=qs[_0xf572('0x4e')](_[_0xf572('0x50')](_0x416e61[_0xf572('0x24')],_0x37e758[_0xf572('0x4e')]));if(_0x416e61[_0xf572('0x24')][_0xf572('0x43')]){_0x2ee4be['where']=_['merge'](_0x2ee4be['where'],{'$or':_[_0xf572('0x1d')](_0x2ee4be[_0xf572('0x2e')],function(_0x6d2cbf){var _0x3ef134={};_0x3ef134[_0x6d2cbf]={'$like':'%'+_0x416e61[_0xf572('0x24')][_0xf572('0x43')]+'%'};return _0x3ef134;})});}_0x2ee4be=_[_0xf572('0x2f')]({},_0x2ee4be,_0x416e61[_0xf572('0x30')]);return _0x54ab06[_0xf572('0x74')](_0x2ee4be);}})[_0xf572('0x14')](function(_0x43ba5a){if(_0x43ba5a){_0x5e4dc6=_0x43ba5a[_0xf572('0x4f')];if(!_0x416e61['query'][_0xf572('0x3f')](_0xf572('0x52'))){_0x2ee4be['limit']=qs['limit'](_0x416e61[_0xf572('0x24')][_0xf572('0xf')]);_0x2ee4be[_0xf572('0x11')]=qs[_0xf572('0x11')](_0x416e61[_0xf572('0x24')]['offset']);}return _0x54ab06[_0xf572('0x74')](_0x2ee4be);}})[_0xf572('0x14')](function(_0x3ce970){if(_0x3ce970){return _0x3ce970?{'count':_0x5e4dc6,'rows':_0x3ce970}:null;}})[_0xf572('0x14')](respondWithResult(_0x53d2aa,null))[_0xf572('0x26')](handleError(_0x53d2aa,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 86f9633..7c1b1b7 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 _0x7e08=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x219a12,_0x1e70c2){var _0x3a5a0b=function(_0x32ae6e){while(--_0x32ae6e){_0x219a12['push'](_0x219a12['shift']());}};_0x3a5a0b(++_0x1e70c2);}(_0x7e08,0xb3));var _0x87e0=function(_0xed9e57,_0x2d8ac8){_0xed9e57=_0xed9e57-0x0;var _0x4c4190=_0x7e08[_0xed9e57];return _0x4c4190;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x87e0('0x0'))['db'][_0x87e0('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x87e0('0x2')](0x0);var events={'afterCreate':_0x87e0('0x3'),'afterUpdate':_0x87e0('0x4'),'afterDestroy':_0x87e0('0x5')};function emitEvent(_0x50ab34){return function(_0x19560c,_0x28a7a5,_0x30a7dd){MailQueueEvents['emit'](_0x50ab34+':'+_0x19560c['id'],_0x19560c);MailQueueEvents[_0x87e0('0x6')](_0x50ab34,_0x19560c);_0x30a7dd(null);};}for(var e in events){if(events[_0x87e0('0x7')](e)){var event=events[e];MailQueue[_0x87e0('0x8')](e,emitEvent(event));}}module[_0x87e0('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x1c5d=['exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x1c5d,0x88));var _0xd1c5=function(_0x116c38,_0x54b3cc){_0x116c38=_0x116c38-0x0;var _0xebfdc3=_0x1c5d[_0x116c38];return _0xebfdc3;};'use strict';var EventEmitter=require(_0xd1c5('0x0'));var MailQueue=require(_0xd1c5('0x1'))['db'][_0xd1c5('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd1c5('0x3')](0x0);var events={'afterCreate':_0xd1c5('0x4'),'afterUpdate':'update','afterDestroy':_0xd1c5('0x5')};function emitEvent(_0x11ce8d){return function(_0x5652aa,_0x2f01ff,_0x166cd6){MailQueueEvents[_0xd1c5('0x6')](_0x11ce8d+':'+_0x5652aa['id'],_0x5652aa);MailQueueEvents['emit'](_0x11ce8d,_0x5652aa);_0x166cd6(null);};}for(var e in events){if(events[_0xd1c5('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd1c5('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index bf57250..1cc46e7 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 _0x592c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','api','moment'];(function(_0x11b8ae,_0x485fa8){var _0x35a448=function(_0x188a5b){while(--_0x188a5b){_0x11b8ae['push'](_0x11b8ae['shift']());}};_0x35a448(++_0x485fa8);}(_0x592c,0xa6));var _0xc592=function(_0x3e529e,_0x145d98){_0x3e529e=_0x3e529e-0x0;var _0x213f6c=_0x592c[_0x3e529e];return _0x213f6c;};'use strict';var _=require(_0xc592('0x0'));var util=require(_0xc592('0x1'));var logger=require('../../config/logger')(_0xc592('0x2'));var moment=require(_0xc592('0x3'));var BPromise=require(_0xc592('0x4'));var rp=require(_0xc592('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc592('0x6'));var config=require(_0xc592('0x7'));var attributes=require('./mailQueue.attributes');module[_0xc592('0x8')]=function(_0x3c9907,_0x3fb1e3){return _0x3c9907[_0xc592('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75a2=['define','MailQueue','mail_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x55566a,_0x563b07){var _0xaca7cd=function(_0x556a03){while(--_0x556a03){_0x55566a['push'](_0x55566a['shift']());}};_0xaca7cd(++_0x563b07);}(_0x75a2,0x87));var _0x275a=function(_0x343c7e,_0x2dc892){_0x343c7e=_0x343c7e-0x0;var _0x4473a6=_0x75a2[_0x343c7e];return _0x4473a6;};'use strict';var _=require(_0x275a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x275a('0x1'));var moment=require(_0x275a('0x2'));var BPromise=require(_0x275a('0x3'));var rp=require(_0x275a('0x4'));var fs=require('fs');var path=require(_0x275a('0x5'));var rimraf=require(_0x275a('0x6'));var config=require(_0x275a('0x7'));var attributes=require(_0x275a('0x8'));module['exports']=function(_0x370f43,_0x585804){return _0x370f43[_0x275a('0x9')](_0x275a('0xa'),attributes,{'tableName':_0x275a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 25be3e3..28c6b00 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 _0x22c9=['GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x22c9,0x8b));var _0x922c=function(_0x1b8f6f,_0x3dacc0){_0x1b8f6f=_0x1b8f6f-0x0;var _0x15410d=_0x22c9[_0x1b8f6f];return _0x15410d;};'use strict';var _=require(_0x922c('0x0'));var util=require(_0x922c('0x1'));var moment=require(_0x922c('0x2'));var BPromise=require(_0x922c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x922c('0x4'))['db'];var utils=require(_0x922c('0x5'));var logger=require(_0x922c('0x6'))(_0x922c('0x7'));var config=require(_0x922c('0x8'));var jayson=require(_0x922c('0x9'));var client=jayson[_0x922c('0xa')][_0x922c('0xb')]({'port':0x232a});config[_0x922c('0xc')]=_[_0x922c('0xd')](config[_0x922c('0xc')],{'host':_0x922c('0xe'),'port':0x18eb});var socket=require(_0x922c('0xf'))(new Redis(config[_0x922c('0xc')]));require(_0x922c('0x10'))[_0x922c('0x11')](socket);function respondWithRpcPromise(_0x5c30ae,_0x5babe1,_0x51931e){return new BPromise(function(_0x22b029,_0x36ea4b){return client[_0x922c('0x12')](_0x5c30ae,_0x51931e)[_0x922c('0x13')](function(_0x2a8cf7){logger[_0x922c('0x14')](_0x922c('0x15'),_0x5babe1,'request\x20sent');logger[_0x922c('0x16')](_0x922c('0x17'),_0x5babe1,_0x922c('0x18'),JSON['stringify'](_0x2a8cf7));if(_0x2a8cf7['error']){if(_0x2a8cf7['error']['code']===0x1f4){logger['error'](_0x922c('0x15'),_0x5babe1,_0x2a8cf7[_0x922c('0x19')][_0x922c('0x1a')]);return _0x36ea4b(_0x2a8cf7['error'][_0x922c('0x1a')]);}logger['error'](_0x922c('0x15'),_0x5babe1,_0x2a8cf7[_0x922c('0x19')]['message']);return _0x22b029(_0x2a8cf7['error'][_0x922c('0x1a')]);}else{logger['info'](_0x922c('0x15'),_0x5babe1,'request\x20sent');_0x22b029(_0x2a8cf7[_0x922c('0x1b')][_0x922c('0x1a')]);}})[_0x922c('0x1c')](function(_0x3fdee5){logger[_0x922c('0x19')](_0x922c('0x15'),_0x5babe1,_0x3fdee5);_0x36ea4b(_0x3fdee5);});});}exports[_0x922c('0x1d')]=function(_0x405738){var _0x4dd59a=this;return new Promise(function(_0x1b70ff,_0x2f076f){return db[_0x922c('0x1e')][_0x922c('0x1f')]({'raw':_0x405738['options']?_0x405738[_0x922c('0x20')][_0x922c('0x21')]===undefined?!![]:![]:!![],'where':_0x405738[_0x922c('0x20')]?_0x405738[_0x922c('0x20')][_0x922c('0x22')]||null:null,'attributes':_0x405738['options']?_0x405738['options'][_0x922c('0x23')]||null:null,'limit':_0x405738[_0x922c('0x20')]?_0x405738[_0x922c('0x20')][_0x922c('0x24')]||null:null,'include':_0x405738[_0x922c('0x20')]?_0x405738[_0x922c('0x20')][_0x922c('0x25')]?_[_0x922c('0x26')](_0x405738[_0x922c('0x20')][_0x922c('0x25')],function(_0x1b95a0){return{'model':db[_0x1b95a0['model']],'as':_0x1b95a0['as'],'attributes':_0x1b95a0[_0x922c('0x23')],'include':_0x1b95a0[_0x922c('0x25')]?_[_0x922c('0x26')](_0x1b95a0[_0x922c('0x25')],function(_0x1b2b3d){return{'model':db[_0x1b2b3d[_0x922c('0x27')]],'as':_0x1b2b3d['as'],'attributes':_0x1b2b3d['attributes'],'include':_0x1b2b3d['include']?_[_0x922c('0x26')](_0x1b2b3d[_0x922c('0x25')],function(_0x2f9ccb){return{'model':db[_0x2f9ccb[_0x922c('0x27')]],'as':_0x2f9ccb['as'],'attributes':_0x2f9ccb[_0x922c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x922c('0x13')](function(_0x41e4f2){logger[_0x922c('0x14')](_0x922c('0x1d'),_0x405738);logger[_0x922c('0x16')](_0x922c('0x1d'),_0x405738,JSON[_0x922c('0x28')](_0x41e4f2));_0x1b70ff(_0x41e4f2);})[_0x922c('0x1c')](function(_0x22e3e4){logger[_0x922c('0x19')](_0x922c('0x1d'),_0x22e3e4[_0x922c('0x1a')],_0x405738);_0x2f076f(_0x4dd59a[_0x922c('0x19')](0x1f4,_0x22e3e4[_0x922c('0x1a')]));});});};exports[_0x922c('0x29')]=function(_0x275e3a){var _0x20f30b=this;return new Promise(function(_0x12b31c,_0x45ecd4){return db[_0x922c('0x1e')]['find']({'raw':_0x275e3a['options']?_0x275e3a[_0x922c('0x20')][_0x922c('0x21')]===undefined?!![]:![]:!![],'where':_0x275e3a['options']?_0x275e3a[_0x922c('0x20')]['where']||null:null,'attributes':_0x275e3a[_0x922c('0x20')]?_0x275e3a[_0x922c('0x20')]['attributes']||null:null,'include':_0x275e3a['options']?_0x275e3a[_0x922c('0x20')][_0x922c('0x25')]?_[_0x922c('0x26')](_0x275e3a['options']['include'],function(_0x47f49f){return{'model':db[_0x47f49f[_0x922c('0x27')]],'as':_0x47f49f['as'],'attributes':_0x47f49f[_0x922c('0x23')],'include':_0x47f49f[_0x922c('0x25')]?_['map'](_0x47f49f['include'],function(_0x246c81){return{'model':db[_0x246c81[_0x922c('0x27')]],'as':_0x246c81['as'],'attributes':_0x246c81[_0x922c('0x23')],'include':_0x246c81[_0x922c('0x25')]?_[_0x922c('0x26')](_0x246c81[_0x922c('0x25')],function(_0xc4388d){return{'model':db[_0xc4388d[_0x922c('0x27')]],'as':_0xc4388d['as'],'attributes':_0xc4388d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x8328dd){logger[_0x922c('0x14')](_0x922c('0x29'),_0x275e3a);logger['debug']('ShowMailQueue',_0x275e3a,JSON[_0x922c('0x28')](_0x8328dd));_0x12b31c(_0x8328dd);})[_0x922c('0x1c')](function(_0x4aa8a3){logger[_0x922c('0x19')](_0x922c('0x29'),_0x4aa8a3['message'],_0x275e3a);_0x45ecd4(_0x20f30b[_0x922c('0x19')](0x1f4,_0x4aa8a3['message']));});});}; \ No newline at end of file +var _0x83d6=['../../config/environment','jayson/promise','client','http','redis','localhost','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','debug','stringify','catch','ShowMailQueue','MailQueue','find','model','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xe20cbe,_0x1e55f1){var _0x35f01d=function(_0x539a24){while(--_0x539a24){_0xe20cbe['push'](_0xe20cbe['shift']());}};_0x35f01d(++_0x1e55f1);}(_0x83d6,0xe9));var _0x683d=function(_0x371f4e,_0x3b585c){_0x371f4e=_0x371f4e-0x0;var _0xe930fc=_0x83d6[_0x371f4e];return _0xe930fc;};'use strict';var _=require(_0x683d('0x0'));var util=require('util');var moment=require(_0x683d('0x1'));var BPromise=require('bluebird');var rs=require(_0x683d('0x2'));var fs=require('fs');var Redis=require(_0x683d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x683d('0x4'));var logger=require(_0x683d('0x5'))(_0x683d('0x6'));var config=require(_0x683d('0x7'));var jayson=require(_0x683d('0x8'));var client=jayson[_0x683d('0x9')][_0x683d('0xa')]({'port':0x232a});config[_0x683d('0xb')]=_['defaults'](config['redis'],{'host':_0x683d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x683d('0xb')]));require(_0x683d('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d5815,_0x49f858,_0x262fd1){return new BPromise(function(_0x4698d7,_0x18b8ce){return client[_0x683d('0xe')](_0x5d5815,_0x262fd1)[_0x683d('0xf')](function(_0x53f507){logger['info'](_0x683d('0x10'),_0x49f858,_0x683d('0x11'));logger['debug'](_0x683d('0x12'),_0x49f858,_0x683d('0x11'),JSON['stringify'](_0x53f507));if(_0x53f507[_0x683d('0x13')]){if(_0x53f507[_0x683d('0x13')][_0x683d('0x14')]===0x1f4){logger[_0x683d('0x13')](_0x683d('0x10'),_0x49f858,_0x53f507[_0x683d('0x13')][_0x683d('0x15')]);return _0x18b8ce(_0x53f507['error']['message']);}logger[_0x683d('0x13')](_0x683d('0x10'),_0x49f858,_0x53f507['error'][_0x683d('0x15')]);return _0x4698d7(_0x53f507[_0x683d('0x13')][_0x683d('0x15')]);}else{logger[_0x683d('0x16')]('MailQueue,\x20%s,\x20%s',_0x49f858,_0x683d('0x11'));_0x4698d7(_0x53f507[_0x683d('0x17')]['message']);}})['catch'](function(_0x5224c7){logger[_0x683d('0x13')](_0x683d('0x10'),_0x49f858,_0x5224c7);_0x18b8ce(_0x5224c7);});});}exports[_0x683d('0x18')]=function(_0x2c316e){var _0x2ac2ce=this;return new Promise(function(_0x5bd294,_0xcb69e0){return db['MailQueue'][_0x683d('0x19')]({'raw':_0x2c316e[_0x683d('0x1a')]?_0x2c316e['options'][_0x683d('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c316e[_0x683d('0x1a')]?_0x2c316e[_0x683d('0x1a')][_0x683d('0x1c')]||null:null,'attributes':_0x2c316e[_0x683d('0x1a')]?_0x2c316e[_0x683d('0x1a')][_0x683d('0x1d')]||null:null,'limit':_0x2c316e['options']?_0x2c316e[_0x683d('0x1a')][_0x683d('0x1e')]||null:null,'include':_0x2c316e[_0x683d('0x1a')]?_0x2c316e[_0x683d('0x1a')]['include']?_[_0x683d('0x1f')](_0x2c316e['options'][_0x683d('0x20')],function(_0x4fc533){return{'model':db[_0x4fc533['model']],'as':_0x4fc533['as'],'attributes':_0x4fc533[_0x683d('0x1d')],'include':_0x4fc533['include']?_[_0x683d('0x1f')](_0x4fc533[_0x683d('0x20')],function(_0x5d388d){return{'model':db[_0x5d388d['model']],'as':_0x5d388d['as'],'attributes':_0x5d388d['attributes'],'include':_0x5d388d[_0x683d('0x20')]?_['map'](_0x5d388d['include'],function(_0x259ded){return{'model':db[_0x259ded['model']],'as':_0x259ded['as'],'attributes':_0x259ded[_0x683d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x683d('0xf')](function(_0x2e2dac){logger[_0x683d('0x16')](_0x683d('0x18'),_0x2c316e);logger[_0x683d('0x21')](_0x683d('0x18'),_0x2c316e,JSON[_0x683d('0x22')](_0x2e2dac));_0x5bd294(_0x2e2dac);})[_0x683d('0x23')](function(_0x3ee0ff){logger[_0x683d('0x13')]('GetMailQueue',_0x3ee0ff[_0x683d('0x15')],_0x2c316e);_0xcb69e0(_0x2ac2ce[_0x683d('0x13')](0x1f4,_0x3ee0ff[_0x683d('0x15')]));});});};exports[_0x683d('0x24')]=function(_0x4c9584){var _0x12cbd2=this;return new Promise(function(_0x3adeea,_0x4de3a8){return db[_0x683d('0x25')][_0x683d('0x26')]({'raw':_0x4c9584[_0x683d('0x1a')]?_0x4c9584[_0x683d('0x1a')][_0x683d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c9584['options']?_0x4c9584[_0x683d('0x1a')][_0x683d('0x1c')]||null:null,'attributes':_0x4c9584[_0x683d('0x1a')]?_0x4c9584['options'][_0x683d('0x1d')]||null:null,'include':_0x4c9584['options']?_0x4c9584[_0x683d('0x1a')][_0x683d('0x20')]?_[_0x683d('0x1f')](_0x4c9584[_0x683d('0x1a')][_0x683d('0x20')],function(_0x4d71e0){return{'model':db[_0x4d71e0[_0x683d('0x27')]],'as':_0x4d71e0['as'],'attributes':_0x4d71e0[_0x683d('0x1d')],'include':_0x4d71e0[_0x683d('0x20')]?_['map'](_0x4d71e0[_0x683d('0x20')],function(_0x40eb76){return{'model':db[_0x40eb76[_0x683d('0x27')]],'as':_0x40eb76['as'],'attributes':_0x40eb76[_0x683d('0x1d')],'include':_0x40eb76[_0x683d('0x20')]?_[_0x683d('0x1f')](_0x40eb76[_0x683d('0x20')],function(_0x484930){return{'model':db[_0x484930['model']],'as':_0x484930['as'],'attributes':_0x484930[_0x683d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb47d64){logger[_0x683d('0x16')](_0x683d('0x24'),_0x4c9584);logger['debug'](_0x683d('0x24'),_0x4c9584,JSON[_0x683d('0x22')](_0xb47d64));_0x3adeea(_0xb47d64);})[_0x683d('0x23')](function(_0x3ffaf0){logger[_0x683d('0x13')](_0x683d('0x24'),_0x3ffaf0[_0x683d('0x15')],_0x4c9584);_0x4de3a8(_0x12cbd2['error'](0x1f4,_0x3ffaf0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0168c95..2471578 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 _0xa39f=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','emit'];(function(_0x450ec1,_0x4adab9){var _0x261897=function(_0x33aabb){while(--_0x33aabb){_0x450ec1['push'](_0x450ec1['shift']());}};_0x261897(++_0x4adab9);}(_0xa39f,0x1e4));var _0xfa39=function(_0x5305f2,_0x180334){_0x5305f2=_0x5305f2-0x0;var _0x59a8f7=_0xa39f[_0x5305f2];return _0x59a8f7;};'use strict';var MailQueueEvents=require(_0xfa39('0x0'));var events=[_0xfa39('0x1'),_0xfa39('0x2'),'update'];function createListener(_0x19139b,_0x441780){return function(_0x1e7851){_0x441780[_0xfa39('0x3')](_0x19139b,_0x1e7851);};}function removeListener(_0x30e6f3,_0x27be8f){return function(){MailQueueEvents[_0xfa39('0x4')](_0x30e6f3,_0x27be8f);};}exports[_0xfa39('0x5')]=function(_0x47dd92){for(var _0x58fbc4=0x0,_0x3d47cc=events[_0xfa39('0x6')];_0x58fbc4<_0x3d47cc;_0x58fbc4++){var _0x4044bc=events[_0x58fbc4];var _0x1ed1f5=createListener(_0xfa39('0x7')+_0x4044bc,_0x47dd92);MailQueueEvents['on'](_0x4044bc,_0x1ed1f5);}}; \ No newline at end of file +var _0x7d1f=['remove','update','emit','removeListener','register','./mailQueue.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7d1f,0x10f));var _0xf7d1=function(_0x2b4211,_0x2bce51){_0x2b4211=_0x2b4211-0x0;var _0x3d1b9e=_0x7d1f[_0x2b4211];return _0x3d1b9e;};'use strict';var MailQueueEvents=require(_0xf7d1('0x0'));var events=[_0xf7d1('0x1'),_0xf7d1('0x2'),_0xf7d1('0x3')];function createListener(_0x51ec0d,_0x1b6726){return function(_0x54440f){_0x1b6726[_0xf7d1('0x4')](_0x51ec0d,_0x54440f);};}function removeListener(_0x547da2,_0x5bcef6){return function(){MailQueueEvents[_0xf7d1('0x5')](_0x547da2,_0x5bcef6);};}exports[_0xf7d1('0x6')]=function(_0x4ddd66){for(var _0x5edc59=0x0,_0x25ed5=events['length'];_0x5edc59<_0x25ed5;_0x5edc59++){var _0x4e60ab=events[_0x5edc59];var _0x29902d=createListener('mailQueue:'+_0x4e60ab,_0x4ddd66);MailQueueEvents['on'](_0x4e60ab,_0x29902d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d09f7a1..3b75825 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 _0x3132=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0x3132,0x72));var _0x2313=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0x3132[_0x5aa992];return _0x2e2d59;};'use strict';var multer=require(_0x2313('0x0'));var util=require('util');var path=require(_0x2313('0x1'));var timeout=require(_0x2313('0x2'));var express=require(_0x2313('0x3'));var router=express[_0x2313('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2313('0x5'));var interaction=require(_0x2313('0x6'));var config=require(_0x2313('0x7'));var controller=require('./mailQueueReport.controller');router[_0x2313('0x8')]('/',auth['isAuthenticated'](),controller[_0x2313('0x9')]);router['get'](_0x2313('0xa'),auth[_0x2313('0xb')](),controller[_0x2313('0xc')]);router[_0x2313('0x8')](_0x2313('0xd'),auth[_0x2313('0xb')](),controller[_0x2313('0xe')]);router[_0x2313('0xf')]('/',auth[_0x2313('0xb')](),controller[_0x2313('0x10')]);router[_0x2313('0x11')](_0x2313('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2313('0x12')]('/:id',auth[_0x2313('0xb')](),controller['destroy']);module[_0x2313('0x13')]=router; \ No newline at end of file +var _0xf3e3=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x273d86,_0x261254){var _0x3116b5=function(_0x16c347){while(--_0x16c347){_0x273d86['push'](_0x273d86['shift']());}};_0x3116b5(++_0x261254);}(_0xf3e3,0xf5));var _0x3f3e=function(_0x1587cd,_0x3e66c2){_0x1587cd=_0x1587cd-0x0;var _0x4ed6e5=_0xf3e3[_0x1587cd];return _0x4ed6e5;};'use strict';var multer=require(_0x3f3e('0x0'));var util=require(_0x3f3e('0x1'));var path=require('path');var timeout=require(_0x3f3e('0x2'));var express=require('express');var router=express[_0x3f3e('0x3')]();var fs_extra=require(_0x3f3e('0x4'));var auth=require(_0x3f3e('0x5'));var interaction=require(_0x3f3e('0x6'));var config=require(_0x3f3e('0x7'));var controller=require(_0x3f3e('0x8'));router[_0x3f3e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3f3e('0x9')]('/describe',auth[_0x3f3e('0xa')](),controller[_0x3f3e('0xb')]);router[_0x3f3e('0x9')](_0x3f3e('0xc'),auth[_0x3f3e('0xa')](),controller[_0x3f3e('0xd')]);router[_0x3f3e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f3e('0xf')]('/:id',auth[_0x3f3e('0xa')](),controller[_0x3f3e('0x10')]);router[_0x3f3e('0x11')](_0x3f3e('0xc'),auth['isAuthenticated'](),controller[_0x3f3e('0x12')]);module[_0x3f3e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e0a9a4e..786cdaf 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 _0x38f6=['exports','STRING','DATE'];(function(_0x12ab09,_0xc1bf6b){var _0x23e5ac=function(_0x45a545){while(--_0x45a545){_0x12ab09['push'](_0x12ab09['shift']());}};_0x23e5ac(++_0xc1bf6b);}(_0x38f6,0x1b6));var _0x638f=function(_0x345a3,_0x486e3d){_0x345a3=_0x345a3-0x0;var _0x5855c4=_0x38f6[_0x345a3];return _0x5855c4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x638f('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x638f('0x1')]},'joinAt':{'type':Sequelize[_0x638f('0x2')]},'leaveAt':{'type':Sequelize[_0x638f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x638f('0x2')]},'reason':{'type':Sequelize[_0x638f('0x1')]}}; \ No newline at end of file +var _0x7ac8=['DATE','moment','sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7ac8,0xfb));var _0x87ac=function(_0x5380cd,_0x1ea634){_0x5380cd=_0x5380cd-0x0;var _0x25dd61=_0x7ac8[_0x5380cd];return _0x25dd61;};'use strict';var moment=require(_0x87ac('0x0'));var Sequelize=require(_0x87ac('0x1'));module[_0x87ac('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x87ac('0x3')]},'joinAt':{'type':Sequelize[_0x87ac('0x4')]},'leaveAt':{'type':Sequelize[_0x87ac('0x4')]},'acceptAt':{'type':Sequelize[_0x87ac('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x87ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4919846..d18f9fb 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 _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','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0x3432c4,_0x3a710f){var _0xc953f4=function(_0x56feda){while(--_0x56feda){_0x3432c4['push'](_0x3432c4['shift']());}};_0xc953f4(++_0x3a710f);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x41bbe3,_0x58296a){_0x41bbe3=_0x41bbe3-0x0;var _0x2685af=_0xc1c6[_0x41bbe3];return _0x2685af;};'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['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_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['MailQueueReport'][_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['MailQueueReport']['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['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0x0120=['name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x1b4f71,_0x346305){var _0x4b9b12=function(_0x6210c6){while(--_0x6210c6){_0x1b4f71['push'](_0x1b4f71['shift']());}};_0x4b9b12(++_0x346305);}(_0x0120,0x6f));var _0x0012=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0120[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1a')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=typeof _0x1a0c0d['offset']==='undefined'&&typeof _0x1a0c0d[_0x0012('0x1b')]===_0x0012('0x1c');var _0x3948bf=_0x348810[_0x0012('0x1d')];var _0x1d0423=_0x3b8dfc?0x0:_0x1a0c0d[_0x0012('0x1e')];var _0x1e78ee=_0x3b8dfc?_0x348810[_0x0012('0x1d')]:_0x1a0c0d['offset']+_0x1a0c0d[_0x0012('0x1b')];var _0x56b0e1;if(_0x1e78ee>=_0x3948bf){_0x1e78ee=_0x3948bf;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0x24f4ed['status'](_0x56b0e1);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x1d0423+'-'+_0x1e78ee+'/'+_0x3948bf)[_0x0012('0x21')](_0x348810);}return null;};}function patchUpdates(_0x2c837e){return function(_0x53ac2d){try{jsonpatch['apply'](_0x53ac2d,_0x2c837e,!![]);}catch(_0x460d82){return BPromise[_0x0012('0x22')](_0x460d82);}return _0x53ac2d[_0x0012('0x23')]();};}function saveUpdates(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x24')](_0x7177bc)[_0x0012('0x25')](function(_0x57487e){return _0x57487e;});}return null;};}function removeEntity(_0x24674c,_0x24a280){return function(_0x4cf4bd){if(_0x4cf4bd){return _0x4cf4bd[_0x0012('0x26')]()[_0x0012('0x25')](function(){_0x24674c[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x42bcd7,_0x5e820b){return function(_0x351ffd){if(!_0x351ffd){_0x42bcd7[_0x0012('0x28')](0x194);}return _0x351ffd;};}function handleError(_0xbb5b55,_0x2a0302){_0x2a0302=_0x2a0302||0x1f4;return function(_0x173cb3){logger[_0x0012('0x29')](_0x173cb3[_0x0012('0x2a')]);if(_0x173cb3[_0x0012('0x2b')]){delete _0x173cb3[_0x0012('0x2b')];}_0xbb5b55[_0x0012('0x1a')](_0x2a0302)[_0x0012('0x2c')](_0x173cb3);};}exports[_0x0012('0x2d')]=function(_0x45c3ca,_0x3ce788){var _0x1282bb={},_0x276389={},_0x1b676d={'count':0x0,'rows':[]};var _0x1f4a0a=_[_0x0012('0x2e')](db[_0x0012('0x2f')][_0x0012('0x30')],function(_0x4d0998){return{'name':_0x4d0998[_0x0012('0x31')],'type':_0x4d0998[_0x0012('0x32')]['key']};});_0x276389[_0x0012('0x33')]=_[_0x0012('0x2e')](_0x1f4a0a,_0x0012('0x2b'));_0x276389[_0x0012('0x34')]=_[_0x0012('0x35')](_0x45c3ca['query']);_0x276389[_0x0012('0x36')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],_0x276389['query']);_0x1282bb[_0x0012('0x38')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],qs[_0x0012('0x39')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x39')]));_0x1282bb['attributes']=_0x1282bb[_0x0012('0x38')][_0x0012('0x3a')]?_0x1282bb[_0x0012('0x38')]:_0x276389[_0x0012('0x33')];if(!_0x45c3ca['query']['hasOwnProperty'](_0x0012('0x3b'))){_0x1282bb[_0x0012('0x1b')]=qs[_0x0012('0x1b')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x1b')]);_0x1282bb[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x45c3ca['query'][_0x0012('0x1e')]);}_0x1282bb[_0x0012('0x3c')]=qs['sort'](_0x45c3ca[_0x0012('0x34')][_0x0012('0x3d')]);_0x1282bb[_0x0012('0x3e')]=qs[_0x0012('0x36')](_[_0x0012('0x3f')](_0x45c3ca[_0x0012('0x34')],_0x276389[_0x0012('0x36')]),_0x1f4a0a);if(_0x45c3ca['query'][_0x0012('0x40')]){_0x1282bb['where']=_[_0x0012('0x41')](_0x1282bb['where'],{'$or':_['map'](_0x1f4a0a,function(_0x1c35aa){if(_0x1c35aa[_0x0012('0x32')]!==_0x0012('0x42')){var _0x4e4424={};_0x4e4424[_0x1c35aa[_0x0012('0x2b')]]={'$like':'%'+_0x45c3ca[_0x0012('0x34')][_0x0012('0x40')]+'%'};return _0x4e4424;}})});}_0x1282bb=_[_0x0012('0x41')]({},_0x1282bb,_0x45c3ca[_0x0012('0x43')]);var _0x379780={'where':_0x1282bb[_0x0012('0x3e')]};return db[_0x0012('0x2f')]['count'](_0x379780)[_0x0012('0x25')](function(_0x25aff1){_0x1b676d[_0x0012('0x1d')]=_0x25aff1;if(_0x45c3ca[_0x0012('0x34')][_0x0012('0x44')]){_0x1282bb[_0x0012('0x45')]=[{'all':!![]}];}return db[_0x0012('0x2f')]['findAll'](_0x1282bb);})['then'](function(_0x1c54de){_0x1b676d['rows']=_0x1c54de;return _0x1b676d;})[_0x0012('0x25')](respondWithFilteredResult(_0x3ce788,_0x1282bb))[_0x0012('0x46')](handleError(_0x3ce788,null));};exports[_0x0012('0x47')]=function(_0x40f80d,_0x32c1f9){var _0x5348a2={'raw':!![],'where':{'id':_0x40f80d[_0x0012('0x48')]['id']}},_0x1bd93a={};_0x1bd93a['model']=_[_0x0012('0x35')](db[_0x0012('0x2f')][_0x0012('0x30')]);_0x1bd93a[_0x0012('0x34')]=_['keys'](_0x40f80d['query']);_0x1bd93a[_0x0012('0x36')]=_['intersection'](_0x1bd93a[_0x0012('0x33')],_0x1bd93a['query']);_0x5348a2[_0x0012('0x38')]=_[_0x0012('0x37')](_0x1bd93a[_0x0012('0x33')],qs[_0x0012('0x39')](_0x40f80d['query'][_0x0012('0x39')]));_0x5348a2['attributes']=_0x5348a2[_0x0012('0x38')][_0x0012('0x3a')]?_0x5348a2[_0x0012('0x38')]:_0x1bd93a[_0x0012('0x33')];if(_0x40f80d[_0x0012('0x34')][_0x0012('0x44')]){_0x5348a2[_0x0012('0x45')]=[{'all':!![]}];}_0x5348a2=_['merge']({},_0x5348a2,_0x40f80d[_0x0012('0x43')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x5348a2)[_0x0012('0x25')](handleEntityNotFound(_0x32c1f9,null))[_0x0012('0x25')](respondWithResult(_0x32c1f9,null))[_0x0012('0x46')](handleError(_0x32c1f9,null));};exports['create']=function(_0x5894ee,_0x48de64){return db['MailQueueReport'][_0x0012('0x4a')](_0x5894ee[_0x0012('0x4b')],{})[_0x0012('0x25')](respondWithResult(_0x48de64,0xc9))[_0x0012('0x46')](handleError(_0x48de64,null));};exports[_0x0012('0x24')]=function(_0x53d552,_0x44ffaf){if(_0x53d552[_0x0012('0x4b')]['id']){delete _0x53d552[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x53d552[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x44ffaf,null))[_0x0012('0x25')](saveUpdates(_0x53d552[_0x0012('0x4b')],null))[_0x0012('0x25')](respondWithResult(_0x44ffaf,null))[_0x0012('0x46')](handleError(_0x44ffaf,null));};exports['destroy']=function(_0x2389cd,_0x12cb8f){return db[_0x0012('0x2f')]['find']({'where':{'id':_0x2389cd[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x12cb8f,null))[_0x0012('0x25')](removeEntity(_0x12cb8f,null))[_0x0012('0x46')](handleError(_0x12cb8f,null));};exports[_0x0012('0x4c')]=function(_0x5f283f,_0xd11428){return db['MailQueueReport'][_0x0012('0x4c')]()[_0x0012('0x25')](respondWithResult(_0xd11428,null))['catch'](handleError(_0xd11428,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c8f6237..fdf9be8 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 _0x1db6=['MailQueueReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','./mailQueueReport.attributes','exports'];(function(_0x2b9bb1,_0x8b8eed){var _0x4f6c08=function(_0x48a4a1){while(--_0x48a4a1){_0x2b9bb1['push'](_0x2b9bb1['shift']());}};_0x4f6c08(++_0x8b8eed);}(_0x1db6,0xb6));var _0x61db=function(_0x2020eb,_0x4249c1){_0x2020eb=_0x2020eb-0x0;var _0x3825ef=_0x1db6[_0x2020eb];return _0x3825ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x61db('0x0'))(_0x61db('0x1'));var moment=require(_0x61db('0x2'));var BPromise=require(_0x61db('0x3'));var rp=require(_0x61db('0x4'));var fs=require('fs');var path=require(_0x61db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61db('0x6'));module[_0x61db('0x7')]=function(_0x3cdcb0,_0x57de66){return _0x3cdcb0['define'](_0x61db('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x61db('0x9'),'fields':[_0x61db('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfef0=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x4d2cf8,_0x1ce4d5){var _0x13b6b8=function(_0xbb35c6){while(--_0xbb35c6){_0x4d2cf8['push'](_0x4d2cf8['shift']());}};_0x13b6b8(++_0x1ce4d5);}(_0xfef0,0x19a));var _0x0fef=function(_0x217c2b,_0x19e8d7){_0x217c2b=_0x217c2b-0x0;var _0x4fad0e=_0xfef0[_0x217c2b];return _0x4fad0e;};'use strict';var _=require(_0x0fef('0x0'));var util=require(_0x0fef('0x1'));var logger=require(_0x0fef('0x2'))(_0x0fef('0x3'));var moment=require(_0x0fef('0x4'));var BPromise=require(_0x0fef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fef('0x6'));var config=require(_0x0fef('0x7'));var attributes=require(_0x0fef('0x8'));module[_0x0fef('0x9')]=function(_0x1bb0f5,_0x1a7da5){return _0x1bb0f5[_0x0fef('0xa')](_0x0fef('0xb'),attributes,{'tableName':_0x0fef('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0fef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7a84cd3..4448c2d 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x127983,_0x50af8f){var _0x251fbe=function(_0x1f9cbb){while(--_0x1f9cbb){_0x127983['push'](_0x127983['shift']());}};_0x251fbe(++_0x50af8f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _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(_0x52153f,_0x5844f5){var _0x3e6094=function(_0x5ed273){while(--_0x5ed273){_0x52153f['push'](_0x52153f['shift']());}};_0x3e6094(++_0x5844f5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56fc95,_0x1f1e1a){_0x56fc95=_0x56fc95-0x0;var _0x8b3ca0=_0x5f2f[_0x56fc95];return _0x8b3ca0;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f68b564..9e109d5 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5cd300,_0x1b5e93){var _0x104113=function(_0x38b316){while(--_0x38b316){_0x5cd300['push'](_0x5cd300['shift']());}};_0x104113(++_0x1b5e93);}(_0xe706,0xa3));var _0x6e70=function(_0xabbd65,_0x546d99){_0xabbd65=_0xabbd65-0x0;var _0x1d005a=_0xe706[_0xabbd65];return _0x1d005a;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4fd029,_0x2c06bc){var _0x99c365=function(_0x149612){while(--_0x149612){_0x4fd029['push'](_0x4fd029['shift']());}};_0x99c365(++_0x2c06bc);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b05c5,_0x22bc8f){_0x3b05c5=_0x3b05c5-0x0;var _0x35cfe0=_0xedd9[_0x3b05c5];return _0x35cfe0;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 597e9f1..6dc7df4 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 _0xd133=['sequelize','exports','INTEGER','BOOLEAN','STRING','INBOX'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xd133,0x84));var _0x3d13=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0xd133[_0x2baca1];return _0x9aa62a;};'use strict';var Sequelize=require(_0x3d13('0x0'));module[_0x3d13('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3d13('0x2')]},'tls':{'type':Sequelize[_0x3d13('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3d13('0x4')],'defaultValue':_0x3d13('0x5')},'connTimeout':{'type':Sequelize[_0x3d13('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x3d13('0x4')]},'modernAuthentication':{'type':Sequelize[_0x3d13('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xeb71=['INTEGER','exports','STRING','BOOLEAN','INBOX'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xeb71,0x18c));var _0x1eb7=function(_0x4fe32e,_0x43fff3){_0x4fe32e=_0x4fe32e-0x0;var _0x3ca7d1=_0xeb71[_0x4fe32e];return _0x3ca7d1;};'use strict';var Sequelize=require('sequelize');module[_0x1eb7('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1eb7('0x1')]},'authentication':{'type':Sequelize[_0x1eb7('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1eb7('0x1')]},'password':{'type':Sequelize[_0x1eb7('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x1eb7('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1eb7('0x1')],'defaultValue':_0x1eb7('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1eb7('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1eb7('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2146fec..a71ee0c 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 _0x7c10=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x17c688,_0x5231f8){var _0x5addc7=function(_0xaee593){while(--_0xaee593){_0x17c688['push'](_0x17c688['shift']());}};_0x5addc7(++_0x5231f8);}(_0x7c10,0x143));var _0x07c1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7c10[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x07c1('0x0'));var util=require(_0x07c1('0x1'));var logger=require('../../config/logger')(_0x07c1('0x2'));var moment=require(_0x07c1('0x3'));var BPromise=require(_0x07c1('0x4'));var rp=require(_0x07c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07c1('0x6'));var config=require(_0x07c1('0x7'));var attributes=require(_0x07c1('0x8'));module[_0x07c1('0x9')]=function(_0x177996,_0x213146){return _0x177996[_0x07c1('0xa')](_0x07c1('0xb'),attributes,{'tableName':_0x07c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41fd=['../../config/logger','api','moment','request-promise','./mailServerIn.attributes','exports','define','mail_servers_in','util'];(function(_0x20c59f,_0x583d0a){var _0x2b6df8=function(_0x303e11){while(--_0x303e11){_0x20c59f['push'](_0x20c59f['shift']());}};_0x2b6df8(++_0x583d0a);}(_0x41fd,0x6b));var _0xd41f=function(_0x130333,_0x1bec7b){_0x130333=_0x130333-0x0;var _0x999a67=_0x41fd[_0x130333];return _0x999a67;};'use strict';var _=require('lodash');var util=require(_0xd41f('0x0'));var logger=require(_0xd41f('0x1'))(_0xd41f('0x2'));var moment=require(_0xd41f('0x3'));var BPromise=require('bluebird');var rp=require(_0xd41f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd41f('0x5'));module[_0xd41f('0x6')]=function(_0x394108,_0x3304bd){return _0x394108[_0xd41f('0x7')]('MailServerIn',attributes,{'tableName':_0xd41f('0x8'),'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 5640abc..0a1fc23 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 _0x1cbb=['model','map','GetMailServerIn','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','include'];(function(_0xbd707c,_0xbec46a){var _0x1c5485=function(_0x222f41){while(--_0x222f41){_0xbd707c['push'](_0xbd707c['shift']());}};_0x1c5485(++_0xbec46a);}(_0x1cbb,0x18f));var _0xb1cb=function(_0x180283,_0x490f26){_0x180283=_0x180283-0x0;var _0x2ba3a1=_0x1cbb[_0x180283];return _0x2ba3a1;};'use strict';var _=require(_0xb1cb('0x0'));var util=require(_0xb1cb('0x1'));var moment=require('moment');var BPromise=require(_0xb1cb('0x2'));var rs=require(_0xb1cb('0x3'));var fs=require('fs');var Redis=require(_0xb1cb('0x4'));var db=require(_0xb1cb('0x5'))['db'];var utils=require(_0xb1cb('0x6'));var logger=require('../../config/logger')(_0xb1cb('0x7'));var config=require(_0xb1cb('0x8'));var jayson=require(_0xb1cb('0x9'));var client=jayson[_0xb1cb('0xa')][_0xb1cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45f616,_0x405e0e,_0x186d1e){return new BPromise(function(_0x5cab24,_0x530feb){return client[_0xb1cb('0xc')](_0x45f616,_0x186d1e)[_0xb1cb('0xd')](function(_0x3e9606){logger[_0xb1cb('0xe')](_0xb1cb('0xf'),_0x405e0e,_0xb1cb('0x10'));logger[_0xb1cb('0x11')](_0xb1cb('0x12'),_0x405e0e,_0xb1cb('0x10'),JSON[_0xb1cb('0x13')](_0x3e9606));if(_0x3e9606[_0xb1cb('0x14')]){if(_0x3e9606['error'][_0xb1cb('0x15')]===0x1f4){logger[_0xb1cb('0x14')](_0xb1cb('0xf'),_0x405e0e,_0x3e9606['error']['message']);return _0x530feb(_0x3e9606[_0xb1cb('0x14')][_0xb1cb('0x16')]);}logger[_0xb1cb('0x14')](_0xb1cb('0xf'),_0x405e0e,_0x3e9606[_0xb1cb('0x14')][_0xb1cb('0x16')]);return _0x5cab24(_0x3e9606[_0xb1cb('0x14')]['message']);}else{logger[_0xb1cb('0xe')]('MailServerIn,\x20%s,\x20%s',_0x405e0e,_0xb1cb('0x10'));_0x5cab24(_0x3e9606[_0xb1cb('0x17')][_0xb1cb('0x16')]);}})[_0xb1cb('0x18')](function(_0x255ef6){logger[_0xb1cb('0x14')](_0xb1cb('0xf'),_0x405e0e,_0x255ef6);_0x530feb(_0x255ef6);});});}exports['GetMailServerIn']=function(_0x12487f){var _0x1a551e=this;return new Promise(function(_0xc78a83,_0x456a25){return db['MailServerIn'][_0xb1cb('0x19')]({'raw':_0x12487f[_0xb1cb('0x1a')]?_0x12487f[_0xb1cb('0x1a')][_0xb1cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x12487f[_0xb1cb('0x1a')]?_0x12487f['options']['where']||null:null,'attributes':_0x12487f[_0xb1cb('0x1a')]?_0x12487f[_0xb1cb('0x1a')][_0xb1cb('0x1c')]||null:null,'limit':_0x12487f['options']?_0x12487f['options']['limit']||null:null,'include':_0x12487f[_0xb1cb('0x1a')]?_0x12487f['options']['include']?_['map'](_0x12487f['options'][_0xb1cb('0x1d')],function(_0x211526){return{'model':db[_0x211526[_0xb1cb('0x1e')]],'as':_0x211526['as'],'attributes':_0x211526[_0xb1cb('0x1c')],'include':_0x211526[_0xb1cb('0x1d')]?_['map'](_0x211526[_0xb1cb('0x1d')],function(_0xe6e782){return{'model':db[_0xe6e782['model']],'as':_0xe6e782['as'],'attributes':_0xe6e782[_0xb1cb('0x1c')],'include':_0xe6e782[_0xb1cb('0x1d')]?_[_0xb1cb('0x1f')](_0xe6e782[_0xb1cb('0x1d')],function(_0x253d1b){return{'model':db[_0x253d1b['model']],'as':_0x253d1b['as'],'attributes':_0x253d1b['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1cb('0xd')](function(_0x557b3d){logger[_0xb1cb('0xe')](_0xb1cb('0x20'),_0x12487f);logger[_0xb1cb('0x11')]('GetMailServerIn',_0x12487f,JSON[_0xb1cb('0x13')](_0x557b3d));_0xc78a83(_0x557b3d);})[_0xb1cb('0x18')](function(_0xf08c34){logger[_0xb1cb('0x14')](_0xb1cb('0x20'),_0xf08c34[_0xb1cb('0x16')],_0x12487f);_0x456a25(_0x1a551e[_0xb1cb('0x14')](0x1f4,_0xf08c34[_0xb1cb('0x16')]));});});}; \ No newline at end of file +var _0x49e9=['raw','where','attributes','limit','map','model','include','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options'];(function(_0x1cf20d,_0x31044e){var _0xe34ae7=function(_0x3e8277){while(--_0x3e8277){_0x1cf20d['push'](_0x1cf20d['shift']());}};_0xe34ae7(++_0x31044e);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('MailServerIn,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});}exports[_0x949e('0x16')]=function(_0x43498d){var _0x868913=this;return new Promise(function(_0x20333c,_0x5caac9){return db[_0x949e('0x17')][_0x949e('0x18')]({'raw':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1a')]===undefined?!![]:![]:!![],'where':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1b')]||null:null,'attributes':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1c')]||null:null,'limit':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1d')]||null:null,'include':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')]['include']?_[_0x949e('0x1e')](_0x43498d[_0x949e('0x19')]['include'],function(_0x48a1d1){return{'model':db[_0x48a1d1[_0x949e('0x1f')]],'as':_0x48a1d1['as'],'attributes':_0x48a1d1[_0x949e('0x1c')],'include':_0x48a1d1[_0x949e('0x20')]?_[_0x949e('0x1e')](_0x48a1d1[_0x949e('0x20')],function(_0x1185b3){return{'model':db[_0x1185b3[_0x949e('0x1f')]],'as':_0x1185b3['as'],'attributes':_0x1185b3[_0x949e('0x1c')],'include':_0x1185b3[_0x949e('0x20')]?_[_0x949e('0x1e')](_0x1185b3['include'],function(_0x212224){return{'model':db[_0x212224[_0x949e('0x1f')]],'as':_0x212224['as'],'attributes':_0x212224['attributes']};}):[]};}):[]};}):[]:[]})[_0x949e('0xa')](function(_0x20061d){logger['info'](_0x949e('0x16'),_0x43498d);logger[_0x949e('0xd')]('GetMailServerIn',_0x43498d,JSON[_0x949e('0xf')](_0x20061d));_0x20333c(_0x20061d);})['catch'](function(_0x5e6e34){logger[_0x949e('0x10')]('GetMailServerIn',_0x5e6e34['message'],_0x43498d);_0x5caac9(_0x868913[_0x949e('0x10')](0x1f4,_0x5e6e34[_0x949e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ec96204..c1cc622 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0xd41388,_0x4eb3ac){_0xd41388=_0xd41388-0x0;var _0x57e71a=_0x7a54[_0xd41388];return _0x57e71a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0xb23ea1,_0x2b4c2f){_0xb23ea1=_0xb23ea1-0x0;var _0x537ac1=_0x7a54[_0xb23ea1];return _0x537ac1;};'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 8fa69a9..10bde58 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 _0x36ee=['BOOLEAN','STRING','INTEGER'];(function(_0x4605a6,_0x4ee25f){var _0x18bc7a=function(_0x2f1228){while(--_0x2f1228){_0x4605a6['push'](_0x4605a6['shift']());}};_0x18bc7a(++_0x4ee25f);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xe36e('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe36e('0x0')]},'pass':{'type':Sequelize[_0xe36e('0x0')]},'port':{'type':Sequelize[_0xe36e('0x1')]},'secure':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xe36e('0x0')]},'authentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7334=['sequelize','exports','STRING','BOOLEAN'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x7334,0x184));var _0x4733=function(_0x566441,_0x202717){_0x566441=_0x566441-0x0;var _0x27c5b7=_0x7334[_0x566441];return _0x27c5b7;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'description':{'type':Sequelize[_0x4733('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4733('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4733('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x4733('0x2')]},'authentication':{'type':Sequelize[_0x4733('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4733('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 c3751fb..c7703c1 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 _0x3bd1=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','error','stack','name','map','MailServerOut','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','then','includeAll','include','catch','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce'];(function(_0x3288be,_0x4883df){var _0x1808c5=function(_0x196133){while(--_0x196133){_0x3288be['push'](_0x3288be['shift']());}};_0x1808c5(++_0x4883df);}(_0x3bd1,0x14a));var _0x13bd=function(_0x4ec01b,_0x43eaaa){_0x4ec01b=_0x4ec01b-0x0;var _0x5159bf=_0x3bd1[_0x4ec01b];return _0x5159bf;};'use strict';var emlformat=require(_0x13bd('0x0'));var rimraf=require(_0x13bd('0x1'));var zipdir=require(_0x13bd('0x2'));var jsonpatch=require(_0x13bd('0x3'));var rp=require(_0x13bd('0x4'));var moment=require(_0x13bd('0x5'));var BPromise=require(_0x13bd('0x6'));var Mustache=require(_0x13bd('0x7'));var util=require(_0x13bd('0x8'));var path=require(_0x13bd('0x9'));var sox=require(_0x13bd('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13bd('0xb'));var squel=require(_0x13bd('0xc'));var crypto=require(_0x13bd('0xd'));var jsforce=require(_0x13bd('0xe'));var deskjs=require(_0x13bd('0xf'));var toCsv=require(_0x13bd('0x10'));var querystring=require(_0x13bd('0x11'));var Papa=require(_0x13bd('0x12'));var Redis=require(_0x13bd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x13bd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13bd('0x15'))(_0x13bd('0x16'));var utils=require('../../config/utils');var config=require(_0x13bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x13bd('0x18'))['db'];function respondWithStatusCode(_0x6c6f94,_0x364b1c){_0x364b1c=_0x364b1c||0xcc;return function(_0x2e97d2){if(_0x2e97d2){return _0x6c6f94[_0x13bd('0x19')](_0x364b1c);}return _0x6c6f94[_0x13bd('0x1a')](_0x364b1c)[_0x13bd('0x1b')]();};}function respondWithResult(_0x4c82a7,_0x360b5f){_0x360b5f=_0x360b5f||0xc8;return function(_0x4eb4a7){if(_0x4eb4a7){return _0x4c82a7[_0x13bd('0x1a')](_0x360b5f)[_0x13bd('0x1c')](_0x4eb4a7);}};}function respondWithFilteredResult(_0x137e91,_0x3a44a7){return function(_0x425f15){if(_0x425f15){var _0x56b923=typeof _0x3a44a7['offset']==='undefined'&&typeof _0x3a44a7[_0x13bd('0x1d')]===_0x13bd('0x1e');var _0x311b52=_0x425f15[_0x13bd('0x1f')];var _0x5855ee=_0x56b923?0x0:_0x3a44a7[_0x13bd('0x20')];var _0x3cbc93=_0x56b923?_0x425f15[_0x13bd('0x1f')]:_0x3a44a7[_0x13bd('0x20')]+_0x3a44a7[_0x13bd('0x1d')];var _0x19372d;if(_0x3cbc93>=_0x311b52){_0x3cbc93=_0x311b52;_0x19372d=0xc8;}else{_0x19372d=0xce;}_0x137e91[_0x13bd('0x1a')](_0x19372d);return _0x137e91[_0x13bd('0x21')](_0x13bd('0x22'),_0x5855ee+'-'+_0x3cbc93+'/'+_0x311b52)[_0x13bd('0x1c')](_0x425f15);}return null;};}function patchUpdates(_0x29a3d0){return function(_0xef1c15){try{jsonpatch[_0x13bd('0x23')](_0xef1c15,_0x29a3d0,!![]);}catch(_0x3e0c47){return BPromise[_0x13bd('0x24')](_0x3e0c47);}return _0xef1c15[_0x13bd('0x25')]();};}function saveUpdates(_0x51767a,_0x1d2415){return function(_0x35bccd){if(_0x35bccd){return _0x35bccd['update'](_0x51767a)['then'](function(_0x1aa1c1){return _0x1aa1c1;});}return null;};}function removeEntity(_0x1bae79,_0x5ef2a5){return function(_0x65ee28){if(_0x65ee28){return _0x65ee28['destroy']()['then'](function(){_0x1bae79[_0x13bd('0x1a')](0xcc)[_0x13bd('0x1b')]();});}};}function handleEntityNotFound(_0x2ab838,_0x2a8479){return function(_0x4ced8e){if(!_0x4ced8e){_0x2ab838[_0x13bd('0x19')](0x194);}return _0x4ced8e;};}function handleError(_0x2a6292,_0x5a6ee3){_0x5a6ee3=_0x5a6ee3||0x1f4;return function(_0x188806){logger[_0x13bd('0x26')](_0x188806[_0x13bd('0x27')]);if(_0x188806[_0x13bd('0x28')]){delete _0x188806[_0x13bd('0x28')];}_0x2a6292[_0x13bd('0x1a')](_0x5a6ee3)['send'](_0x188806);};}exports['index']=function(_0x367d42,_0x14e66d){var _0x163112={},_0x318400={},_0x5545df={'count':0x0,'rows':[]};var _0x254b81=_[_0x13bd('0x29')](db[_0x13bd('0x2a')][_0x13bd('0x2b')],function(_0x16d881){return{'name':_0x16d881['fieldName'],'type':_0x16d881[_0x13bd('0x2c')]['key']};});_0x318400[_0x13bd('0x2d')]=_[_0x13bd('0x29')](_0x254b81,_0x13bd('0x28'));_0x318400['query']=_['keys'](_0x367d42[_0x13bd('0x2e')]);_0x318400[_0x13bd('0x2f')]=_[_0x13bd('0x30')](_0x318400['model'],_0x318400[_0x13bd('0x2e')]);_0x163112[_0x13bd('0x31')]=_[_0x13bd('0x30')](_0x318400[_0x13bd('0x2d')],qs[_0x13bd('0x32')](_0x367d42[_0x13bd('0x2e')][_0x13bd('0x32')]));_0x163112['attributes']=_0x163112[_0x13bd('0x31')][_0x13bd('0x33')]?_0x163112[_0x13bd('0x31')]:_0x318400[_0x13bd('0x2d')];if(!_0x367d42[_0x13bd('0x2e')][_0x13bd('0x34')]('nolimit')){_0x163112[_0x13bd('0x1d')]=qs[_0x13bd('0x1d')](_0x367d42[_0x13bd('0x2e')][_0x13bd('0x1d')]);_0x163112['offset']=qs[_0x13bd('0x20')](_0x367d42[_0x13bd('0x2e')]['offset']);}_0x163112[_0x13bd('0x35')]=qs[_0x13bd('0x36')](_0x367d42[_0x13bd('0x2e')][_0x13bd('0x36')]);_0x163112[_0x13bd('0x37')]=qs[_0x13bd('0x2f')](_['pick'](_0x367d42[_0x13bd('0x2e')],_0x318400[_0x13bd('0x2f')]),_0x254b81);if(_0x367d42[_0x13bd('0x2e')][_0x13bd('0x38')]){_0x163112[_0x13bd('0x37')]=_[_0x13bd('0x39')](_0x163112[_0x13bd('0x37')],{'$or':_[_0x13bd('0x29')](_0x254b81,function(_0x2c2b3a){if(_0x2c2b3a[_0x13bd('0x2c')]!==_0x13bd('0x3a')){var _0x3de108={};_0x3de108[_0x2c2b3a[_0x13bd('0x28')]]={'$like':'%'+_0x367d42[_0x13bd('0x2e')][_0x13bd('0x38')]+'%'};return _0x3de108;}})});}_0x163112=_['merge']({},_0x163112,_0x367d42['options']);var _0x21b5d9={'where':_0x163112[_0x13bd('0x37')]};return db[_0x13bd('0x2a')][_0x13bd('0x1f')](_0x21b5d9)[_0x13bd('0x3b')](function(_0x3ce0dc){_0x5545df[_0x13bd('0x1f')]=_0x3ce0dc;if(_0x367d42[_0x13bd('0x2e')][_0x13bd('0x3c')]){_0x163112[_0x13bd('0x3d')]=[{'all':!![]}];}return db[_0x13bd('0x2a')]['findAll'](_0x163112);})['then'](function(_0x26b1e6){_0x5545df['rows']=_0x26b1e6;return _0x5545df;})[_0x13bd('0x3b')](respondWithFilteredResult(_0x14e66d,_0x163112))[_0x13bd('0x3e')](handleError(_0x14e66d,null));};exports['show']=function(_0x470779,_0x55cc8c){var _0x551653={'raw':!![],'where':{'id':_0x470779[_0x13bd('0x3f')]['id']}},_0x1abf1b={};_0x1abf1b[_0x13bd('0x2d')]=_[_0x13bd('0x40')](db[_0x13bd('0x2a')][_0x13bd('0x2b')]);_0x1abf1b[_0x13bd('0x2e')]=_[_0x13bd('0x40')](_0x470779[_0x13bd('0x2e')]);_0x1abf1b['filters']=_['intersection'](_0x1abf1b[_0x13bd('0x2d')],_0x1abf1b[_0x13bd('0x2e')]);_0x551653[_0x13bd('0x31')]=_[_0x13bd('0x30')](_0x1abf1b[_0x13bd('0x2d')],qs[_0x13bd('0x32')](_0x470779[_0x13bd('0x2e')][_0x13bd('0x32')]));_0x551653[_0x13bd('0x31')]=_0x551653[_0x13bd('0x31')][_0x13bd('0x33')]?_0x551653[_0x13bd('0x31')]:_0x1abf1b[_0x13bd('0x2d')];if(_0x470779[_0x13bd('0x2e')]['includeAll']){_0x551653[_0x13bd('0x3d')]=[{'all':!![]}];}_0x551653=_[_0x13bd('0x39')]({},_0x551653,_0x470779[_0x13bd('0x41')]);return db[_0x13bd('0x2a')][_0x13bd('0x42')](_0x551653)[_0x13bd('0x3b')](handleEntityNotFound(_0x55cc8c,null))[_0x13bd('0x3b')](respondWithResult(_0x55cc8c,null))['catch'](handleError(_0x55cc8c,null));};exports[_0x13bd('0x43')]=function(_0x75fc23,_0x559f5d){return db['MailServerOut'][_0x13bd('0x43')](_0x75fc23['body'],{})['then'](respondWithResult(_0x559f5d,0xc9))[_0x13bd('0x3e')](handleError(_0x559f5d,null));};exports['update']=function(_0x54210c,_0x2bf547){if(_0x54210c['body']['id']){delete _0x54210c[_0x13bd('0x44')]['id'];}return db[_0x13bd('0x2a')]['find']({'where':{'id':_0x54210c['params']['id']}})[_0x13bd('0x3b')](handleEntityNotFound(_0x2bf547,null))[_0x13bd('0x3b')](saveUpdates(_0x54210c[_0x13bd('0x44')],null))[_0x13bd('0x3b')](respondWithResult(_0x2bf547,null))[_0x13bd('0x3e')](handleError(_0x2bf547,null));};exports['destroy']=function(_0x42d9e9,_0x4f81d6){return db[_0x13bd('0x2a')][_0x13bd('0x42')]({'where':{'id':_0x42d9e9[_0x13bd('0x3f')]['id']}})[_0x13bd('0x3b')](handleEntityNotFound(_0x4f81d6,null))[_0x13bd('0x3b')](removeEntity(_0x4f81d6,null))[_0x13bd('0x3e')](handleError(_0x4f81d6,null));}; \ No newline at end of file +var _0x8267=['show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','MailServerOut','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x4ddfdd,_0x390dc9){var _0x2be25f=function(_0x433412){while(--_0x433412){_0x4ddfdd['push'](_0x4ddfdd['shift']());}};_0x2be25f(++_0x390dc9);}(_0x8267,0x1f0));var _0x7826=function(_0x3930a7,_0x2b5476){_0x3930a7=_0x3930a7-0x0;var _0x19ff0b=_0x8267[_0x3930a7];return _0x19ff0b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7826('0x0'));var zipdir=require(_0x7826('0x1'));var jsonpatch=require(_0x7826('0x2'));var rp=require(_0x7826('0x3'));var moment=require(_0x7826('0x4'));var BPromise=require(_0x7826('0x5'));var Mustache=require('mustache');var util=require(_0x7826('0x6'));var path=require(_0x7826('0x7'));var sox=require(_0x7826('0x8'));var csv=require(_0x7826('0x9'));var ejs=require(_0x7826('0xa'));var fs=require('fs');var fs_extra=require(_0x7826('0xb'));var _=require('lodash');var squel=require(_0x7826('0xc'));var crypto=require('crypto');var jsforce=require(_0x7826('0xd'));var deskjs=require(_0x7826('0xe'));var toCsv=require(_0x7826('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7826('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7826('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7826('0x11'));var config=require(_0x7826('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548956,_0x1eb58f){_0x1eb58f=_0x1eb58f||0xcc;return function(_0x5b2db4){if(_0x5b2db4){return _0x548956[_0x7826('0x13')](_0x1eb58f);}return _0x548956['status'](_0x1eb58f)[_0x7826('0x14')]();};}function respondWithResult(_0x2019c9,_0x48cecc){_0x48cecc=_0x48cecc||0xc8;return function(_0x42c997){if(_0x42c997){return _0x2019c9[_0x7826('0x15')](_0x48cecc)[_0x7826('0x16')](_0x42c997);}};}function respondWithFilteredResult(_0x5f23ff,_0x2a9f11){return function(_0x44dab4){if(_0x44dab4){var _0x491d20=typeof _0x2a9f11[_0x7826('0x17')]==='undefined'&&typeof _0x2a9f11[_0x7826('0x18')]===_0x7826('0x19');var _0x1cfbf1=_0x44dab4[_0x7826('0x1a')];var _0x450bae=_0x491d20?0x0:_0x2a9f11[_0x7826('0x17')];var _0xd5af3f=_0x491d20?_0x44dab4['count']:_0x2a9f11[_0x7826('0x17')]+_0x2a9f11[_0x7826('0x18')];var _0x4b04e2;if(_0xd5af3f>=_0x1cfbf1){_0xd5af3f=_0x1cfbf1;_0x4b04e2=0xc8;}else{_0x4b04e2=0xce;}_0x5f23ff[_0x7826('0x15')](_0x4b04e2);return _0x5f23ff[_0x7826('0x1b')](_0x7826('0x1c'),_0x450bae+'-'+_0xd5af3f+'/'+_0x1cfbf1)[_0x7826('0x16')](_0x44dab4);}return null;};}function patchUpdates(_0x56fc45){return function(_0x1aa3bf){try{jsonpatch['apply'](_0x1aa3bf,_0x56fc45,!![]);}catch(_0x2da00d){return BPromise[_0x7826('0x1d')](_0x2da00d);}return _0x1aa3bf['save']();};}function saveUpdates(_0x5459db,_0x5c5937){return function(_0x25b978){if(_0x25b978){return _0x25b978[_0x7826('0x1e')](_0x5459db)['then'](function(_0x43679c){return _0x43679c;});}return null;};}function removeEntity(_0x175aa1,_0x443abc){return function(_0x172bed){if(_0x172bed){return _0x172bed[_0x7826('0x1f')]()[_0x7826('0x20')](function(){_0x175aa1[_0x7826('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa1b9,_0xc3b009){return function(_0x421221){if(!_0x421221){_0x3fa1b9['sendStatus'](0x194);}return _0x421221;};}function handleError(_0x1e7859,_0x23ed94){_0x23ed94=_0x23ed94||0x1f4;return function(_0x233ee3){logger[_0x7826('0x21')](_0x233ee3[_0x7826('0x22')]);if(_0x233ee3['name']){delete _0x233ee3[_0x7826('0x23')];}_0x1e7859[_0x7826('0x15')](_0x23ed94)[_0x7826('0x24')](_0x233ee3);};}exports[_0x7826('0x25')]=function(_0x448faa,_0x52422b){var _0x33209a={},_0x2782c7={},_0x5e1d66={'count':0x0,'rows':[]};var _0x137c22=_['map'](db[_0x7826('0x26')][_0x7826('0x27')],function(_0x2f0a61){return{'name':_0x2f0a61['fieldName'],'type':_0x2f0a61[_0x7826('0x28')][_0x7826('0x29')]};});_0x2782c7[_0x7826('0x2a')]=_[_0x7826('0x2b')](_0x137c22,_0x7826('0x23'));_0x2782c7[_0x7826('0x2c')]=_['keys'](_0x448faa[_0x7826('0x2c')]);_0x2782c7[_0x7826('0x2d')]=_['intersection'](_0x2782c7[_0x7826('0x2a')],_0x2782c7['query']);_0x33209a[_0x7826('0x2e')]=_[_0x7826('0x2f')](_0x2782c7[_0x7826('0x2a')],qs[_0x7826('0x30')](_0x448faa[_0x7826('0x2c')][_0x7826('0x30')]));_0x33209a['attributes']=_0x33209a[_0x7826('0x2e')][_0x7826('0x31')]?_0x33209a[_0x7826('0x2e')]:_0x2782c7[_0x7826('0x2a')];if(!_0x448faa['query'][_0x7826('0x32')](_0x7826('0x33'))){_0x33209a[_0x7826('0x18')]=qs[_0x7826('0x18')](_0x448faa[_0x7826('0x2c')][_0x7826('0x18')]);_0x33209a[_0x7826('0x17')]=qs[_0x7826('0x17')](_0x448faa[_0x7826('0x2c')][_0x7826('0x17')]);}_0x33209a[_0x7826('0x34')]=qs[_0x7826('0x35')](_0x448faa['query'][_0x7826('0x35')]);_0x33209a['where']=qs['filters'](_[_0x7826('0x36')](_0x448faa[_0x7826('0x2c')],_0x2782c7[_0x7826('0x2d')]),_0x137c22);if(_0x448faa[_0x7826('0x2c')][_0x7826('0x37')]){_0x33209a[_0x7826('0x38')]=_[_0x7826('0x39')](_0x33209a['where'],{'$or':_[_0x7826('0x2b')](_0x137c22,function(_0x363323){if(_0x363323[_0x7826('0x28')]!==_0x7826('0x3a')){var _0x5e13ea={};_0x5e13ea[_0x363323[_0x7826('0x23')]]={'$like':'%'+_0x448faa[_0x7826('0x2c')]['filter']+'%'};return _0x5e13ea;}})});}_0x33209a=_['merge']({},_0x33209a,_0x448faa[_0x7826('0x3b')]);var _0x20f7d3={'where':_0x33209a[_0x7826('0x38')]};return db[_0x7826('0x26')]['count'](_0x20f7d3)[_0x7826('0x20')](function(_0x4e159c){_0x5e1d66[_0x7826('0x1a')]=_0x4e159c;if(_0x448faa[_0x7826('0x2c')][_0x7826('0x3c')]){_0x33209a[_0x7826('0x3d')]=[{'all':!![]}];}return db[_0x7826('0x26')]['findAll'](_0x33209a);})[_0x7826('0x20')](function(_0x3078be){_0x5e1d66[_0x7826('0x3e')]=_0x3078be;return _0x5e1d66;})[_0x7826('0x20')](respondWithFilteredResult(_0x52422b,_0x33209a))[_0x7826('0x3f')](handleError(_0x52422b,null));};exports[_0x7826('0x40')]=function(_0x692f09,_0x1c132f){var _0x13071a={'raw':!![],'where':{'id':_0x692f09['params']['id']}},_0x38cad0={};_0x38cad0[_0x7826('0x2a')]=_[_0x7826('0x41')](db[_0x7826('0x26')]['rawAttributes']);_0x38cad0[_0x7826('0x2c')]=_[_0x7826('0x41')](_0x692f09[_0x7826('0x2c')]);_0x38cad0['filters']=_[_0x7826('0x2f')](_0x38cad0['model'],_0x38cad0[_0x7826('0x2c')]);_0x13071a[_0x7826('0x2e')]=_[_0x7826('0x2f')](_0x38cad0[_0x7826('0x2a')],qs[_0x7826('0x30')](_0x692f09[_0x7826('0x2c')][_0x7826('0x30')]));_0x13071a[_0x7826('0x2e')]=_0x13071a[_0x7826('0x2e')][_0x7826('0x31')]?_0x13071a[_0x7826('0x2e')]:_0x38cad0[_0x7826('0x2a')];if(_0x692f09['query'][_0x7826('0x3c')]){_0x13071a['include']=[{'all':!![]}];}_0x13071a=_[_0x7826('0x39')]({},_0x13071a,_0x692f09[_0x7826('0x3b')]);return db[_0x7826('0x26')][_0x7826('0x42')](_0x13071a)['then'](handleEntityNotFound(_0x1c132f,null))['then'](respondWithResult(_0x1c132f,null))[_0x7826('0x3f')](handleError(_0x1c132f,null));};exports[_0x7826('0x43')]=function(_0x1109d2,_0x1668ba){return db['MailServerOut'][_0x7826('0x43')](_0x1109d2['body'],{})[_0x7826('0x20')](respondWithResult(_0x1668ba,0xc9))[_0x7826('0x3f')](handleError(_0x1668ba,null));};exports[_0x7826('0x1e')]=function(_0xc96499,_0x3f5c7d){if(_0xc96499[_0x7826('0x44')]['id']){delete _0xc96499[_0x7826('0x44')]['id'];}return db[_0x7826('0x26')][_0x7826('0x42')]({'where':{'id':_0xc96499[_0x7826('0x45')]['id']}})[_0x7826('0x20')](handleEntityNotFound(_0x3f5c7d,null))[_0x7826('0x20')](saveUpdates(_0xc96499[_0x7826('0x44')],null))[_0x7826('0x20')](respondWithResult(_0x3f5c7d,null))[_0x7826('0x3f')](handleError(_0x3f5c7d,null));};exports[_0x7826('0x1f')]=function(_0x3a6962,_0x2c8cb0){return db[_0x7826('0x26')][_0x7826('0x42')]({'where':{'id':_0x3a6962['params']['id']}})['then'](handleEntityNotFound(_0x2c8cb0,null))[_0x7826('0x20')](removeEntity(_0x2c8cb0,null))['catch'](handleError(_0x2c8cb0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 30c0100..360b7a9 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 _0xd244=['request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','util','../../config/logger','api','moment'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0xd244,0xbc));var _0x4d24=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xd244[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require('lodash');var util=require(_0x4d24('0x0'));var logger=require(_0x4d24('0x1'))(_0x4d24('0x2'));var moment=require(_0x4d24('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d24('0x4'));var fs=require('fs');var path=require(_0x4d24('0x5'));var rimraf=require(_0x4d24('0x6'));var config=require(_0x4d24('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x4d24('0x8')]=function(_0x590b31,_0x2c3077){return _0x590b31[_0x4d24('0x9')](_0x4d24('0xa'),attributes,{'tableName':_0x4d24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2e4=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','define','mail_servers_out','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd2e4,0x80));var _0x4d2e=function(_0xde1fb9,_0x13adc7){_0xde1fb9=_0xde1fb9-0x0;var _0x215755=_0xd2e4[_0xde1fb9];return _0x215755;};'use strict';var _=require('lodash');var util=require(_0x4d2e('0x0'));var logger=require('../../config/logger')(_0x4d2e('0x1'));var moment=require(_0x4d2e('0x2'));var BPromise=require(_0x4d2e('0x3'));var rp=require(_0x4d2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d2e('0x5'));var config=require(_0x4d2e('0x6'));var attributes=require(_0x4d2e('0x7'));module['exports']=function(_0xfeeee0,_0x1a20fc){return _0xfeeee0[_0x4d2e('0x8')]('MailServerOut',attributes,{'tableName':_0x4d2e('0x9'),'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 9acc3dc..eca4c4d 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a2e49,_0x378079){_0x5a2e49=_0x5a2e49-0x0;var _0xc0de20=_0x2ef3[_0x5a2e49];return _0xc0de20;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3bc82d,_0x59187f){var _0x2cfb3d=function(_0x515ac3){while(--_0x515ac3){_0x3bc82d['push'](_0x3bc82d['shift']());}};_0x2cfb3d(++_0x59187f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ba607,_0x6d4b){_0x4ba607=_0x4ba607-0x0;var _0x54f9ce=_0x2ef3[_0x4ba607];return _0x54f9ce;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 340df77..c69ffd0 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 _0xcc01=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xcc01,0x13a));var _0x1cc0=function(_0x1d6d2a,_0x24362e){_0x1d6d2a=_0x1d6d2a-0x0;var _0x399eb7=_0xcc01[_0x1d6d2a];return _0x399eb7;};'use strict';var multer=require(_0x1cc0('0x0'));var util=require(_0x1cc0('0x1'));var path=require(_0x1cc0('0x2'));var timeout=require(_0x1cc0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1cc0('0x4'));var auth=require(_0x1cc0('0x5'));var interaction=require(_0x1cc0('0x6'));var config=require(_0x1cc0('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x1cc0('0x8')](),controller[_0x1cc0('0x9')]);router[_0x1cc0('0xa')](_0x1cc0('0xb'),auth[_0x1cc0('0x8')](),controller[_0x1cc0('0xc')]);router[_0x1cc0('0xa')]('/:id',auth[_0x1cc0('0x8')](),controller[_0x1cc0('0xd')]);router['post']('/',auth[_0x1cc0('0x8')](),controller[_0x1cc0('0xe')]);router[_0x1cc0('0xf')](_0x1cc0('0x10'),auth[_0x1cc0('0x8')](),controller[_0x1cc0('0x11')]);router[_0x1cc0('0x12')](_0x1cc0('0x10'),auth['isAuthenticated'](),controller[_0x1cc0('0x13')]);module[_0x1cc0('0x14')]=router; \ No newline at end of file +var _0x675c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x675c,0x10f));var _0xc675=function(_0x39a3f3,_0x3e2de1){_0x39a3f3=_0x39a3f3-0x0;var _0x3792c4=_0x675c[_0x39a3f3];return _0x3792c4;};'use strict';var multer=require(_0xc675('0x0'));var util=require(_0xc675('0x1'));var path=require(_0xc675('0x2'));var timeout=require(_0xc675('0x3'));var express=require(_0xc675('0x4'));var router=express[_0xc675('0x5')]();var fs_extra=require(_0xc675('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc675('0x7'));var config=require(_0xc675('0x8'));var controller=require(_0xc675('0x9'));router['get']('/',auth[_0xc675('0xa')](),controller[_0xc675('0xb')]);router[_0xc675('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xc675('0xd')]);router[_0xc675('0xc')](_0xc675('0xe'),auth[_0xc675('0xa')](),controller[_0xc675('0xf')]);router[_0xc675('0x10')]('/',auth[_0xc675('0xa')](),controller[_0xc675('0x11')]);router[_0xc675('0x12')](_0xc675('0xe'),auth[_0xc675('0xa')](),controller[_0xc675('0x13')]);router[_0xc675('0x14')](_0xc675('0xe'),auth[_0xc675('0xa')](),controller[_0xc675('0x15')]);module[_0xc675('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0af141f..190a8c2 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 _0x85d0=['STRING'];(function(_0x2e76eb,_0x4564f5){var _0x21b1ba=function(_0x3a914e){while(--_0x3a914e){_0x2e76eb['push'](_0x2e76eb['shift']());}};_0x21b1ba(++_0x4564f5);}(_0x85d0,0x164));var _0x085d=function(_0x48b5c2,_0x5ebe8b){_0x48b5c2=_0x48b5c2-0x0;var _0x6ea4c5=_0x85d0[_0x48b5c2];return _0x6ea4c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x085d('0x0')]}}; \ No newline at end of file +var _0xb934=['exports','STRING','sequelize'];(function(_0x22f345,_0x310e5b){var _0x391164=function(_0x373ddb){while(--_0x373ddb){_0x22f345['push'](_0x22f345['shift']());}};_0x391164(++_0x310e5b);}(_0xb934,0x92));var _0x4b93=function(_0x1001b8,_0x1844f3){_0x1001b8=_0x1001b8-0x0;var _0x2f5e67=_0xb934[_0x1001b8];return _0x2f5e67;};'use strict';var Sequelize=require(_0x4b93('0x0'));module[_0x4b93('0x1')]={'name':{'type':Sequelize[_0x4b93('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4b93('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 401f729..4d64a61 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 _0xc965=['model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','fieldName','key'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc965,0x18e));var _0x5c96=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0xc965[_0xf237f7];return _0x2c183b;};'use strict';var emlformat=require(_0x5c96('0x0'));var rimraf=require(_0x5c96('0x1'));var zipdir=require(_0x5c96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c96('0x3'));var moment=require('moment');var BPromise=require(_0x5c96('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5c96('0x5'));var sox=require(_0x5c96('0x6'));var csv=require(_0x5c96('0x7'));var ejs=require(_0x5c96('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c96('0x9'));var squel=require(_0x5c96('0xa'));var crypto=require(_0x5c96('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5c96('0xc'));var toCsv=require(_0x5c96('0x7'));var querystring=require(_0x5c96('0xd'));var Papa=require('papaparse');var Redis=require(_0x5c96('0xe'));var authService=require(_0x5c96('0xf'));var qs=require(_0x5c96('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c96('0x11'));var logger=require('../../config/logger')(_0x5c96('0x12'));var utils=require(_0x5c96('0x13'));var config=require(_0x5c96('0x14'));var licenseUtil=require(_0x5c96('0x15'));var db=require(_0x5c96('0x16'))['db'];function respondWithStatusCode(_0x2b8ab9,_0xfe7c4c){_0xfe7c4c=_0xfe7c4c||0xcc;return function(_0x485cb0){if(_0x485cb0){return _0x2b8ab9[_0x5c96('0x17')](_0xfe7c4c);}return _0x2b8ab9[_0x5c96('0x18')](_0xfe7c4c)[_0x5c96('0x19')]();};}function respondWithResult(_0x575e51,_0x1a0886){_0x1a0886=_0x1a0886||0xc8;return function(_0x3cc51f){if(_0x3cc51f){return _0x575e51[_0x5c96('0x18')](_0x1a0886)[_0x5c96('0x1a')](_0x3cc51f);}};}function respondWithFilteredResult(_0x1ce0f2,_0x313cad){return function(_0x1eccb2){if(_0x1eccb2){var _0x1c0a4a=typeof _0x313cad[_0x5c96('0x1b')]===_0x5c96('0x1c')&&typeof _0x313cad[_0x5c96('0x1d')]===_0x5c96('0x1c');var _0x20d289=_0x1eccb2['count'];var _0x249b75=_0x1c0a4a?0x0:_0x313cad[_0x5c96('0x1b')];var _0x4dce5b=_0x1c0a4a?_0x1eccb2[_0x5c96('0x1e')]:_0x313cad[_0x5c96('0x1b')]+_0x313cad[_0x5c96('0x1d')];var _0x587196;if(_0x4dce5b>=_0x20d289){_0x4dce5b=_0x20d289;_0x587196=0xc8;}else{_0x587196=0xce;}_0x1ce0f2[_0x5c96('0x18')](_0x587196);return _0x1ce0f2[_0x5c96('0x1f')]('Content-Range',_0x249b75+'-'+_0x4dce5b+'/'+_0x20d289)[_0x5c96('0x1a')](_0x1eccb2);}return null;};}function patchUpdates(_0x1e9485){return function(_0x2fb71d){try{jsonpatch[_0x5c96('0x20')](_0x2fb71d,_0x1e9485,!![]);}catch(_0x2d6860){return BPromise[_0x5c96('0x21')](_0x2d6860);}return _0x2fb71d[_0x5c96('0x22')]();};}function saveUpdates(_0x591869,_0x2fd5ec){return function(_0x191189){if(_0x191189){return _0x191189[_0x5c96('0x23')](_0x591869)[_0x5c96('0x24')](function(_0x3881f5){return _0x3881f5;});}return null;};}function removeEntity(_0x13a1a8,_0xa9ddca){return function(_0x24402b){if(_0x24402b){return _0x24402b[_0x5c96('0x25')]()[_0x5c96('0x24')](function(){_0x13a1a8['status'](0xcc)[_0x5c96('0x19')]();});}};}function handleEntityNotFound(_0x471644,_0x54adbf){return function(_0x12200e){if(!_0x12200e){_0x471644[_0x5c96('0x17')](0x194);}return _0x12200e;};}function handleError(_0x5b0ec1,_0x2d6f43){_0x2d6f43=_0x2d6f43||0x1f4;return function(_0x32c1d0){logger['error'](_0x32c1d0[_0x5c96('0x26')]);if(_0x32c1d0['name']){delete _0x32c1d0[_0x5c96('0x27')];}_0x5b0ec1['status'](_0x2d6f43)[_0x5c96('0x28')](_0x32c1d0);};}exports[_0x5c96('0x29')]=function(_0x464b46,_0x2cd267){var _0x12d032={},_0x5ee11b={},_0x1f62b1={'count':0x0,'rows':[]};var _0x153fa5=_[_0x5c96('0x2a')](db[_0x5c96('0x2b')]['rawAttributes'],function(_0x131204){return{'name':_0x131204[_0x5c96('0x2c')],'type':_0x131204['type'][_0x5c96('0x2d')]};});_0x5ee11b[_0x5c96('0x2e')]=_['map'](_0x153fa5,_0x5c96('0x27'));_0x5ee11b['query']=_[_0x5c96('0x2f')](_0x464b46[_0x5c96('0x30')]);_0x5ee11b[_0x5c96('0x31')]=_['intersection'](_0x5ee11b[_0x5c96('0x2e')],_0x5ee11b[_0x5c96('0x30')]);_0x12d032[_0x5c96('0x32')]=_[_0x5c96('0x33')](_0x5ee11b[_0x5c96('0x2e')],qs[_0x5c96('0x34')](_0x464b46[_0x5c96('0x30')][_0x5c96('0x34')]));_0x12d032[_0x5c96('0x32')]=_0x12d032[_0x5c96('0x32')][_0x5c96('0x35')]?_0x12d032[_0x5c96('0x32')]:_0x5ee11b['model'];if(!_0x464b46[_0x5c96('0x30')][_0x5c96('0x36')](_0x5c96('0x37'))){_0x12d032[_0x5c96('0x1d')]=qs[_0x5c96('0x1d')](_0x464b46[_0x5c96('0x30')][_0x5c96('0x1d')]);_0x12d032[_0x5c96('0x1b')]=qs['offset'](_0x464b46[_0x5c96('0x30')][_0x5c96('0x1b')]);}_0x12d032[_0x5c96('0x38')]=qs[_0x5c96('0x39')](_0x464b46[_0x5c96('0x30')][_0x5c96('0x39')]);_0x12d032[_0x5c96('0x3a')]=qs[_0x5c96('0x31')](_[_0x5c96('0x3b')](_0x464b46[_0x5c96('0x30')],_0x5ee11b['filters']),_0x153fa5);if(_0x464b46[_0x5c96('0x30')][_0x5c96('0x3c')]){_0x12d032['where']=_['merge'](_0x12d032['where'],{'$or':_['map'](_0x153fa5,function(_0x98e507){if(_0x98e507['type']!=='VIRTUAL'){var _0x247f56={};_0x247f56[_0x98e507[_0x5c96('0x27')]]={'$like':'%'+_0x464b46[_0x5c96('0x30')][_0x5c96('0x3c')]+'%'};return _0x247f56;}})});}_0x12d032=_['merge']({},_0x12d032,_0x464b46[_0x5c96('0x3d')]);var _0x47d011={'where':_0x12d032['where']};return db[_0x5c96('0x2b')][_0x5c96('0x1e')](_0x47d011)[_0x5c96('0x24')](function(_0xd82182){_0x1f62b1[_0x5c96('0x1e')]=_0xd82182;if(_0x464b46['query']['includeAll']){_0x12d032['include']=[{'all':!![]}];}return db[_0x5c96('0x2b')][_0x5c96('0x3e')](_0x12d032);})[_0x5c96('0x24')](function(_0x2b0e6f){_0x1f62b1[_0x5c96('0x3f')]=_0x2b0e6f;return _0x1f62b1;})['then'](respondWithFilteredResult(_0x2cd267,_0x12d032))[_0x5c96('0x40')](handleError(_0x2cd267,null));};exports[_0x5c96('0x41')]=function(_0xbd7210,_0x199e22){var _0x6c7580={'raw':!![],'where':{'id':_0xbd7210['params']['id']}},_0x24532c={};_0x24532c[_0x5c96('0x2e')]=_['keys'](db['MailSubstatus'][_0x5c96('0x42')]);_0x24532c['query']=_[_0x5c96('0x2f')](_0xbd7210[_0x5c96('0x30')]);_0x24532c[_0x5c96('0x31')]=_['intersection'](_0x24532c[_0x5c96('0x2e')],_0x24532c[_0x5c96('0x30')]);_0x6c7580[_0x5c96('0x32')]=_[_0x5c96('0x33')](_0x24532c['model'],qs['fields'](_0xbd7210['query'][_0x5c96('0x34')]));_0x6c7580['attributes']=_0x6c7580[_0x5c96('0x32')][_0x5c96('0x35')]?_0x6c7580[_0x5c96('0x32')]:_0x24532c[_0x5c96('0x2e')];if(_0xbd7210[_0x5c96('0x30')][_0x5c96('0x43')]){_0x6c7580[_0x5c96('0x44')]=[{'all':!![]}];}_0x6c7580=_['merge']({},_0x6c7580,_0xbd7210[_0x5c96('0x3d')]);return db[_0x5c96('0x2b')][_0x5c96('0x45')](_0x6c7580)[_0x5c96('0x24')](handleEntityNotFound(_0x199e22,null))[_0x5c96('0x24')](respondWithResult(_0x199e22,null))[_0x5c96('0x40')](handleError(_0x199e22,null));};exports[_0x5c96('0x46')]=function(_0x3d8464,_0x3dcb5d){return db['MailSubstatus'][_0x5c96('0x46')](_0x3d8464[_0x5c96('0x47')],{})[_0x5c96('0x24')](respondWithResult(_0x3dcb5d,0xc9))[_0x5c96('0x40')](handleError(_0x3dcb5d,null));};exports['update']=function(_0x241091,_0x59b2f6){if(_0x241091[_0x5c96('0x47')]['id']){delete _0x241091['body']['id'];}return db['MailSubstatus'][_0x5c96('0x45')]({'where':{'id':_0x241091['params']['id']}})[_0x5c96('0x24')](handleEntityNotFound(_0x59b2f6,null))[_0x5c96('0x24')](saveUpdates(_0x241091['body'],null))[_0x5c96('0x24')](respondWithResult(_0x59b2f6,null))[_0x5c96('0x40')](handleError(_0x59b2f6,null));};exports[_0x5c96('0x25')]=function(_0x5a4fa4,_0x220a06){return db[_0x5c96('0x2b')]['find']({'where':{'id':_0x5a4fa4[_0x5c96('0x48')]['id']}})[_0x5c96('0x24')](handleEntityNotFound(_0x220a06,null))[_0x5c96('0x24')](removeEntity(_0x220a06,null))[_0x5c96('0x40')](handleError(_0x220a06,null));};exports[_0x5c96('0x49')]=function(_0x239684,_0x2c4131){return db[_0x5c96('0x2b')][_0x5c96('0x49')]()[_0x5c96('0x24')](respondWithResult(_0x2c4131,null))[_0x5c96('0x40')](handleError(_0x2c4131,null));}; \ No newline at end of file +var _0x4388=['options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x54a5f5,_0x4c1855){var _0x1d17d=function(_0x4fefe3){while(--_0x4fefe3){_0x54a5f5['push'](_0x54a5f5['shift']());}};_0x1d17d(++_0x4c1855);}(_0x4388,0x184));var _0x8438=function(_0x5d588c,_0x3232a0){_0x5d588c=_0x5d588c-0x0;var _0x148140=_0x4388[_0x5d588c];return _0x148140;};'use strict';var emlformat=require(_0x8438('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8438('0x1'));var rp=require(_0x8438('0x2'));var moment=require(_0x8438('0x3'));var BPromise=require(_0x8438('0x4'));var Mustache=require('mustache');var util=require(_0x8438('0x5'));var path=require(_0x8438('0x6'));var sox=require(_0x8438('0x7'));var csv=require(_0x8438('0x8'));var ejs=require(_0x8438('0x9'));var fs=require('fs');var fs_extra=require(_0x8438('0xa'));var _=require('lodash');var squel=require(_0x8438('0xb'));var crypto=require(_0x8438('0xc'));var jsforce=require(_0x8438('0xd'));var deskjs=require(_0x8438('0xe'));var toCsv=require(_0x8438('0x8'));var querystring=require('querystring');var Papa=require(_0x8438('0xf'));var Redis=require(_0x8438('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8438('0x11'));var as=require(_0x8438('0x12'));var hardwareService=require(_0x8438('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8438('0x14'));var config=require(_0x8438('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8438('0x16'))['db'];function respondWithStatusCode(_0x379a4c,_0x5240be){_0x5240be=_0x5240be||0xcc;return function(_0x4eb5fd){if(_0x4eb5fd){return _0x379a4c['sendStatus'](_0x5240be);}return _0x379a4c[_0x8438('0x17')](_0x5240be)[_0x8438('0x18')]();};}function respondWithResult(_0x477abb,_0x37b769){_0x37b769=_0x37b769||0xc8;return function(_0x36e005){if(_0x36e005){return _0x477abb[_0x8438('0x17')](_0x37b769)[_0x8438('0x19')](_0x36e005);}};}function respondWithFilteredResult(_0x517fa8,_0xd2d843){return function(_0xb16606){if(_0xb16606){var _0x4c6bfa=typeof _0xd2d843[_0x8438('0x1a')]===_0x8438('0x1b')&&typeof _0xd2d843['limit']===_0x8438('0x1b');var _0x16dba1=_0xb16606[_0x8438('0x1c')];var _0x2d72a9=_0x4c6bfa?0x0:_0xd2d843[_0x8438('0x1a')];var _0x4f4f47=_0x4c6bfa?_0xb16606[_0x8438('0x1c')]:_0xd2d843[_0x8438('0x1a')]+_0xd2d843[_0x8438('0x1d')];var _0x2981d3;if(_0x4f4f47>=_0x16dba1){_0x4f4f47=_0x16dba1;_0x2981d3=0xc8;}else{_0x2981d3=0xce;}_0x517fa8[_0x8438('0x17')](_0x2981d3);return _0x517fa8[_0x8438('0x1e')](_0x8438('0x1f'),_0x2d72a9+'-'+_0x4f4f47+'/'+_0x16dba1)[_0x8438('0x19')](_0xb16606);}return null;};}function patchUpdates(_0x257b3c){return function(_0x2372e2){try{jsonpatch['apply'](_0x2372e2,_0x257b3c,!![]);}catch(_0x5029ce){return BPromise[_0x8438('0x20')](_0x5029ce);}return _0x2372e2[_0x8438('0x21')]();};}function saveUpdates(_0x45c41b,_0x315d52){return function(_0x3ba4a4){if(_0x3ba4a4){return _0x3ba4a4['update'](_0x45c41b)[_0x8438('0x22')](function(_0x1b639e){return _0x1b639e;});}return null;};}function removeEntity(_0x311759,_0x858114){return function(_0x873ce4){if(_0x873ce4){return _0x873ce4[_0x8438('0x23')]()['then'](function(){_0x311759['status'](0xcc)[_0x8438('0x18')]();});}};}function handleEntityNotFound(_0x7c830f,_0x1fce42){return function(_0x2ea1e6){if(!_0x2ea1e6){_0x7c830f[_0x8438('0x24')](0x194);}return _0x2ea1e6;};}function handleError(_0x318240,_0x483d0d){_0x483d0d=_0x483d0d||0x1f4;return function(_0x43ead3){logger['error'](_0x43ead3[_0x8438('0x25')]);if(_0x43ead3[_0x8438('0x26')]){delete _0x43ead3['name'];}_0x318240['status'](_0x483d0d)[_0x8438('0x27')](_0x43ead3);};}exports['index']=function(_0x25b636,_0x48a08c){var _0xce761e={},_0x3bfa43={},_0x13095f={'count':0x0,'rows':[]};var _0x45b5c6=_[_0x8438('0x28')](db[_0x8438('0x29')][_0x8438('0x2a')],function(_0x24e5cb){return{'name':_0x24e5cb[_0x8438('0x2b')],'type':_0x24e5cb[_0x8438('0x2c')][_0x8438('0x2d')]};});_0x3bfa43['model']=_[_0x8438('0x28')](_0x45b5c6,_0x8438('0x26'));_0x3bfa43[_0x8438('0x2e')]=_[_0x8438('0x2f')](_0x25b636['query']);_0x3bfa43[_0x8438('0x30')]=_[_0x8438('0x31')](_0x3bfa43[_0x8438('0x32')],_0x3bfa43[_0x8438('0x2e')]);_0xce761e['attributes']=_[_0x8438('0x31')](_0x3bfa43[_0x8438('0x32')],qs[_0x8438('0x33')](_0x25b636[_0x8438('0x2e')]['fields']));_0xce761e[_0x8438('0x34')]=_0xce761e[_0x8438('0x34')][_0x8438('0x35')]?_0xce761e[_0x8438('0x34')]:_0x3bfa43[_0x8438('0x32')];if(!_0x25b636[_0x8438('0x2e')][_0x8438('0x36')]('nolimit')){_0xce761e[_0x8438('0x1d')]=qs['limit'](_0x25b636[_0x8438('0x2e')]['limit']);_0xce761e[_0x8438('0x1a')]=qs[_0x8438('0x1a')](_0x25b636[_0x8438('0x2e')]['offset']);}_0xce761e[_0x8438('0x37')]=qs[_0x8438('0x38')](_0x25b636[_0x8438('0x2e')][_0x8438('0x38')]);_0xce761e[_0x8438('0x39')]=qs[_0x8438('0x30')](_[_0x8438('0x3a')](_0x25b636[_0x8438('0x2e')],_0x3bfa43['filters']),_0x45b5c6);if(_0x25b636[_0x8438('0x2e')][_0x8438('0x3b')]){_0xce761e['where']=_[_0x8438('0x3c')](_0xce761e[_0x8438('0x39')],{'$or':_[_0x8438('0x28')](_0x45b5c6,function(_0x329306){if(_0x329306[_0x8438('0x2c')]!==_0x8438('0x3d')){var _0x35797f={};_0x35797f[_0x329306[_0x8438('0x26')]]={'$like':'%'+_0x25b636[_0x8438('0x2e')][_0x8438('0x3b')]+'%'};return _0x35797f;}})});}_0xce761e=_[_0x8438('0x3c')]({},_0xce761e,_0x25b636[_0x8438('0x3e')]);var _0x28c0f8={'where':_0xce761e[_0x8438('0x39')]};return db[_0x8438('0x29')][_0x8438('0x1c')](_0x28c0f8)['then'](function(_0x282c8d){_0x13095f[_0x8438('0x1c')]=_0x282c8d;if(_0x25b636[_0x8438('0x2e')][_0x8438('0x3f')]){_0xce761e[_0x8438('0x40')]=[{'all':!![]}];}return db[_0x8438('0x29')][_0x8438('0x41')](_0xce761e);})[_0x8438('0x22')](function(_0x1fbfae){_0x13095f[_0x8438('0x42')]=_0x1fbfae;return _0x13095f;})['then'](respondWithFilteredResult(_0x48a08c,_0xce761e))[_0x8438('0x43')](handleError(_0x48a08c,null));};exports[_0x8438('0x44')]=function(_0x39e6da,_0x32c876){var _0x3d54b5={'raw':!![],'where':{'id':_0x39e6da[_0x8438('0x45')]['id']}},_0x55858d={};_0x55858d[_0x8438('0x32')]=_[_0x8438('0x2f')](db['MailSubstatus'][_0x8438('0x2a')]);_0x55858d[_0x8438('0x2e')]=_['keys'](_0x39e6da['query']);_0x55858d[_0x8438('0x30')]=_[_0x8438('0x31')](_0x55858d[_0x8438('0x32')],_0x55858d['query']);_0x3d54b5['attributes']=_[_0x8438('0x31')](_0x55858d[_0x8438('0x32')],qs['fields'](_0x39e6da[_0x8438('0x2e')][_0x8438('0x33')]));_0x3d54b5[_0x8438('0x34')]=_0x3d54b5[_0x8438('0x34')]['length']?_0x3d54b5['attributes']:_0x55858d[_0x8438('0x32')];if(_0x39e6da[_0x8438('0x2e')][_0x8438('0x3f')]){_0x3d54b5['include']=[{'all':!![]}];}_0x3d54b5=_[_0x8438('0x3c')]({},_0x3d54b5,_0x39e6da[_0x8438('0x3e')]);return db[_0x8438('0x29')]['find'](_0x3d54b5)[_0x8438('0x22')](handleEntityNotFound(_0x32c876,null))['then'](respondWithResult(_0x32c876,null))['catch'](handleError(_0x32c876,null));};exports[_0x8438('0x46')]=function(_0x5f2dda,_0x317b4b){return db[_0x8438('0x29')][_0x8438('0x46')](_0x5f2dda[_0x8438('0x47')],{})[_0x8438('0x22')](respondWithResult(_0x317b4b,0xc9))[_0x8438('0x43')](handleError(_0x317b4b,null));};exports[_0x8438('0x48')]=function(_0x3b8073,_0x283b08){if(_0x3b8073['body']['id']){delete _0x3b8073[_0x8438('0x47')]['id'];}return db['MailSubstatus'][_0x8438('0x49')]({'where':{'id':_0x3b8073['params']['id']}})[_0x8438('0x22')](handleEntityNotFound(_0x283b08,null))[_0x8438('0x22')](saveUpdates(_0x3b8073[_0x8438('0x47')],null))[_0x8438('0x22')](respondWithResult(_0x283b08,null))[_0x8438('0x43')](handleError(_0x283b08,null));};exports['destroy']=function(_0x34af9b,_0x105b4d){return db[_0x8438('0x29')][_0x8438('0x49')]({'where':{'id':_0x34af9b[_0x8438('0x45')]['id']}})[_0x8438('0x22')](handleEntityNotFound(_0x105b4d,null))[_0x8438('0x22')](removeEntity(_0x105b4d,null))[_0x8438('0x43')](handleError(_0x105b4d,null));};exports[_0x8438('0x4a')]=function(_0x6f7fb3,_0x9ae780){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x9ae780,null))[_0x8438('0x43')](handleError(_0x9ae780,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 3490359..39e0ff7 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 _0x8d07=['MailSubstatus','setMaxListeners','update','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xf7a3a9,_0x46e1e4){var _0x565f5b=function(_0x2ca0e5){while(--_0x2ca0e5){_0xf7a3a9['push'](_0xf7a3a9['shift']());}};_0x565f5b(++_0x46e1e4);}(_0x8d07,0x10f));var _0x78d0=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x8d07[_0x36dfbd];return _0x4ecad9;};'use strict';var EventEmitter=require(_0x78d0('0x0'));var MailSubstatus=require(_0x78d0('0x1'))['db'][_0x78d0('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x78d0('0x3')](0x0);var events={'afterUpdate':_0x78d0('0x4')};function emitEvent(_0x39ebf6){return function(_0xeb3080,_0x52d615,_0x2c2a68){MailSubstatusEvents['emit'](_0x39ebf6+':'+_0xeb3080['id'],_0xeb3080);MailSubstatusEvents['emit'](_0x39ebf6,_0xeb3080);_0x2c2a68(null);};}for(var e in events){if(events[_0x78d0('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x78d0('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x0ae1=['setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb','MailSubstatus'];(function(_0xefda82,_0x9ac512){var _0x39cdb1=function(_0x2b9e35){while(--_0x2b9e35){_0xefda82['push'](_0xefda82['shift']());}};_0x39cdb1(++_0x9ac512);}(_0x0ae1,0x1b5));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x10ae('0x0'));var MailSubstatus=require(_0x10ae('0x1'))['db'][_0x10ae('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x10ae('0x3')](0x0);var events={'afterUpdate':_0x10ae('0x4')};function emitEvent(_0x389851){return function(_0xb279bb,_0x5deb84,_0x21ecaa){MailSubstatusEvents[_0x10ae('0x5')](_0x389851+':'+_0xb279bb['id'],_0xb279bb);MailSubstatusEvents[_0x10ae('0x5')](_0x389851,_0xb279bb);_0x21ecaa(null);};}for(var e in events){if(events[_0x10ae('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x10ae('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 24fa8ef..1aafba2 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 _0x954d=['then','catch','exports','MailSubstatus','mail_substatuses','Condition','update','_previousDataValues','name'];(function(_0x2de0d1,_0x2bb5e2){var _0x1c1cae=function(_0x55203e){while(--_0x55203e){_0x2de0d1['push'](_0x2de0d1['shift']());}};_0x1c1cae(++_0x2bb5e2);}(_0x954d,0xd1));var _0xd954=function(_0x40bc01,_0x22a9a9){_0x40bc01=_0x40bc01-0x0;var _0x42365b=_0x954d[_0x40bc01];return _0x42365b;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xd954('0x0')]=function(_0x58434d){var _0x1bd40d=_0x58434d['models'];return _0x58434d['define'](_0xd954('0x1'),attributes,{'tableName':_0xd954('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5dc2ca,_0x373a03,_0x1249b7){return _0x1bd40d[_0xd954('0x3')][_0xd954('0x4')]({'value':_0x5dc2ca['name']},{'where':{'field':'mailSubstatus','value':_0x5dc2ca[_0xd954('0x5')][_0xd954('0x6')]}})[_0xd954('0x7')](function(){_0x1249b7();})[_0xd954('0x8')](function(_0x97ac09){_0x1249b7(_0x97ac09);});}}});}; \ No newline at end of file +var _0xc5f5=['models','define','MailSubstatus','Condition','update','name','_previousDataValues','then','./mailSubstatus.attributes','exports'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xc5f5,0xa8));var _0x5c5f=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xc5f5[_0x3712e2];return _0x1faff4;};'use strict';var attributes=require(_0x5c5f('0x0'));module[_0x5c5f('0x1')]=function(_0xbcf555){var _0x1d8b5c=_0xbcf555[_0x5c5f('0x2')];return _0xbcf555[_0x5c5f('0x3')](_0x5c5f('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4976ed,_0x49f116,_0x284583){return _0x1d8b5c[_0x5c5f('0x5')][_0x5c5f('0x6')]({'value':_0x4976ed[_0x5c5f('0x7')]},{'where':{'field':'mailSubstatus','value':_0x4976ed[_0x5c5f('0x8')][_0x5c5f('0x7')]}})[_0x5c5f('0x9')](function(){_0x284583();})['catch'](function(_0x111e60){_0x284583(_0x111e60);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index fdbcf4b..bf275ab 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 _0x9a5e=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9a5e,0x1e2));var _0xe9a5=function(_0x3cc7ba,_0x2fc1ae){_0x3cc7ba=_0x3cc7ba-0x0;var _0xb25b9b=_0x9a5e[_0x3cc7ba];return _0xb25b9b;};'use strict';var _=require(_0xe9a5('0x0'));var util=require(_0xe9a5('0x1'));var moment=require('moment');var BPromise=require(_0xe9a5('0x2'));var rs=require(_0xe9a5('0x3'));var fs=require('fs');var Redis=require(_0xe9a5('0x4'));var db=require(_0xe9a5('0x5'))['db'];var utils=require(_0xe9a5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe9a5('0x7'));var client=jayson[_0xe9a5('0x8')][_0xe9a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b887d,_0x2d11ac,_0x469874){return new BPromise(function(_0x1bbf24,_0x1f37c7){return client['request'](_0x2b887d,_0x469874)[_0xe9a5('0xa')](function(_0x342af9){logger[_0xe9a5('0xb')](_0xe9a5('0xc'),_0x2d11ac,_0xe9a5('0xd'));logger['debug'](_0xe9a5('0xe'),_0x2d11ac,_0xe9a5('0xd'),JSON[_0xe9a5('0xf')](_0x342af9));if(_0x342af9[_0xe9a5('0x10')]){if(_0x342af9[_0xe9a5('0x10')][_0xe9a5('0x11')]===0x1f4){logger[_0xe9a5('0x10')](_0xe9a5('0xc'),_0x2d11ac,_0x342af9[_0xe9a5('0x10')][_0xe9a5('0x12')]);return _0x1f37c7(_0x342af9[_0xe9a5('0x10')][_0xe9a5('0x12')]);}logger['error'](_0xe9a5('0xc'),_0x2d11ac,_0x342af9[_0xe9a5('0x10')][_0xe9a5('0x12')]);return _0x1bbf24(_0x342af9[_0xe9a5('0x10')]['message']);}else{logger[_0xe9a5('0xb')](_0xe9a5('0xc'),_0x2d11ac,'request\x20sent');_0x1bbf24(_0x342af9[_0xe9a5('0x13')][_0xe9a5('0x12')]);}})[_0xe9a5('0x14')](function(_0x1b7c6e){logger[_0xe9a5('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x2d11ac,_0x1b7c6e);_0x1f37c7(_0x1b7c6e);});});} \ No newline at end of file +var _0x1b63=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x47c635,_0x527895){var _0xb1e191=function(_0x1f129d){while(--_0x1f129d){_0x47c635['push'](_0x47c635['shift']());}};_0xb1e191(++_0x527895);}(_0x1b63,0x90));var _0x31b6=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x1b63[_0x4b91c4];return _0x25cb80;};'use strict';var _=require('lodash');var util=require(_0x31b6('0x0'));var moment=require(_0x31b6('0x1'));var BPromise=require(_0x31b6('0x2'));var rs=require(_0x31b6('0x3'));var fs=require('fs');var Redis=require(_0x31b6('0x4'));var db=require(_0x31b6('0x5'))['db'];var utils=require(_0x31b6('0x6'));var logger=require(_0x31b6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x31b6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdc5d14,_0x59493d,_0x47edd9){return new BPromise(function(_0x30bd48,_0x11b472){return client['request'](_0xdc5d14,_0x47edd9)['then'](function(_0x52592e){logger[_0x31b6('0x9')](_0x31b6('0xa'),_0x59493d,_0x31b6('0xb'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x59493d,'request\x20sent',JSON[_0x31b6('0xc')](_0x52592e));if(_0x52592e[_0x31b6('0xd')]){if(_0x52592e[_0x31b6('0xd')]['code']===0x1f4){logger['error'](_0x31b6('0xa'),_0x59493d,_0x52592e[_0x31b6('0xd')][_0x31b6('0xe')]);return _0x11b472(_0x52592e[_0x31b6('0xd')][_0x31b6('0xe')]);}logger['error'](_0x31b6('0xa'),_0x59493d,_0x52592e[_0x31b6('0xd')][_0x31b6('0xe')]);return _0x30bd48(_0x52592e[_0x31b6('0xd')][_0x31b6('0xe')]);}else{logger['info'](_0x31b6('0xa'),_0x59493d,_0x31b6('0xb'));_0x30bd48(_0x52592e[_0x31b6('0xf')][_0x31b6('0xe')]);}})[_0x31b6('0x10')](function(_0x3ee8e8){logger['error'](_0x31b6('0xa'),_0x59493d,_0x3ee8e8);_0x11b472(_0x3ee8e8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index aa3795d..6b643c6 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 _0x1eee=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x5f4a48,_0x44e5ab){var _0x57f833=function(_0x234cb3){while(--_0x234cb3){_0x5f4a48['push'](_0x5f4a48['shift']());}};_0x57f833(++_0x44e5ab);}(_0x1eee,0x6f));var _0xe1ee=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x1eee[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0xe1ee('0x0'));var util=require(_0xe1ee('0x1'));var path=require(_0xe1ee('0x2'));var timeout=require(_0xe1ee('0x3'));var express=require(_0xe1ee('0x4'));var router=express[_0xe1ee('0x5')]();var fs_extra=require(_0xe1ee('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe1ee('0x7'));router[_0xe1ee('0x8')]('/',auth[_0xe1ee('0x9')](),controller[_0xe1ee('0xa')]);router[_0xe1ee('0x8')](_0xe1ee('0xb'),auth[_0xe1ee('0x9')](),controller[_0xe1ee('0xc')]);router[_0xe1ee('0x8')]('/:id',auth[_0xe1ee('0x9')](),controller[_0xe1ee('0xd')]);router[_0xe1ee('0xe')]('/',auth[_0xe1ee('0x9')](),controller[_0xe1ee('0xf')]);router[_0xe1ee('0x10')](_0xe1ee('0x11'),auth[_0xe1ee('0x9')](),controller[_0xe1ee('0x12')]);router[_0xe1ee('0x13')](_0xe1ee('0x11'),auth[_0xe1ee('0x9')](),controller[_0xe1ee('0x14')]);module['exports']=router; \ No newline at end of file +var _0x43d5=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x30a2ae,_0xfa9d8a){var _0x2f3b0d=function(_0x3d6625){while(--_0x3d6625){_0x30a2ae['push'](_0x30a2ae['shift']());}};_0x2f3b0d(++_0xfa9d8a);}(_0x43d5,0x184));var _0x543d=function(_0x15a2e4,_0x326abf){_0x15a2e4=_0x15a2e4-0x0;var _0xffaa67=_0x43d5[_0x15a2e4];return _0xffaa67;};'use strict';var multer=require(_0x543d('0x0'));var util=require(_0x543d('0x1'));var path=require(_0x543d('0x2'));var timeout=require(_0x543d('0x3'));var express=require(_0x543d('0x4'));var router=express[_0x543d('0x5')]();var fs_extra=require(_0x543d('0x6'));var auth=require(_0x543d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x543d('0x8'));var controller=require(_0x543d('0x9'));router[_0x543d('0xa')]('/',auth[_0x543d('0xb')](),controller['index']);router[_0x543d('0xa')]('/describe',auth[_0x543d('0xb')](),controller[_0x543d('0xc')]);router[_0x543d('0xa')](_0x543d('0xd'),auth[_0x543d('0xb')](),controller['show']);router['post']('/',auth[_0x543d('0xb')](),controller[_0x543d('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x543d('0xf')]);router[_0x543d('0x10')](_0x543d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x543d('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ce7b298..f788830 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x386187,_0x1ad2ac){var _0x4abeaa=function(_0x251f63){while(--_0x251f63){_0x386187['push'](_0x386187['shift']());}};_0x4abeaa(++_0x1ad2ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x40e681,_0x39999a){var _0x8528d2=function(_0x42ba6f){while(--_0x42ba6f){_0x40e681['push'](_0x40e681['shift']());}};_0x8528d2(++_0x39999a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 89b17f2..759f92c 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 _0x1061=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','MailTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x17491f,_0x3e1d71){var _0x315d8d=function(_0x263af0){while(--_0x263af0){_0x17491f['push'](_0x17491f['shift']());}};_0x315d8d(++_0x3e1d71);}(_0x1061,0x1a3));var _0x1106=function(_0x4a6655,_0x4f2ef4){_0x4a6655=_0x4a6655-0x0;var _0x3b60d6=_0x1061[_0x4a6655];return _0x3b60d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1106('0x0'));var zipdir=require(_0x1106('0x1'));var jsonpatch=require(_0x1106('0x2'));var rp=require(_0x1106('0x3'));var moment=require(_0x1106('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1106('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1106('0x6'));var ejs=require(_0x1106('0x7'));var fs=require('fs');var fs_extra=require(_0x1106('0x8'));var _=require(_0x1106('0x9'));var squel=require(_0x1106('0xa'));var crypto=require('crypto');var jsforce=require(_0x1106('0xb'));var deskjs=require(_0x1106('0xc'));var toCsv=require(_0x1106('0x6'));var querystring=require(_0x1106('0xd'));var Papa=require(_0x1106('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1106('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1106('0x10'));var logger=require(_0x1106('0x11'))('api');var utils=require(_0x1106('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1106('0x13'));var db=require(_0x1106('0x14'))['db'];function respondWithStatusCode(_0x1d8820,_0x1cd532){_0x1cd532=_0x1cd532||0xcc;return function(_0x5e57cb){if(_0x5e57cb){return _0x1d8820[_0x1106('0x15')](_0x1cd532);}return _0x1d8820[_0x1106('0x16')](_0x1cd532)[_0x1106('0x17')]();};}function respondWithResult(_0x7358b2,_0x534603){_0x534603=_0x534603||0xc8;return function(_0xde81a0){if(_0xde81a0){return _0x7358b2[_0x1106('0x16')](_0x534603)[_0x1106('0x18')](_0xde81a0);}};}function respondWithFilteredResult(_0x14bd21,_0x4387ac){return function(_0x1d5042){if(_0x1d5042){var _0x561f8d=typeof _0x4387ac[_0x1106('0x19')]===_0x1106('0x1a')&&typeof _0x4387ac[_0x1106('0x1b')]===_0x1106('0x1a');var _0xccacdb=_0x1d5042[_0x1106('0x1c')];var _0x238353=_0x561f8d?0x0:_0x4387ac[_0x1106('0x19')];var _0x26cd06=_0x561f8d?_0x1d5042['count']:_0x4387ac[_0x1106('0x19')]+_0x4387ac[_0x1106('0x1b')];var _0x4f5d03;if(_0x26cd06>=_0xccacdb){_0x26cd06=_0xccacdb;_0x4f5d03=0xc8;}else{_0x4f5d03=0xce;}_0x14bd21[_0x1106('0x16')](_0x4f5d03);return _0x14bd21[_0x1106('0x1d')](_0x1106('0x1e'),_0x238353+'-'+_0x26cd06+'/'+_0xccacdb)[_0x1106('0x18')](_0x1d5042);}return null;};}function patchUpdates(_0x1ed401){return function(_0x2b03a7){try{jsonpatch[_0x1106('0x1f')](_0x2b03a7,_0x1ed401,!![]);}catch(_0x190a29){return BPromise[_0x1106('0x20')](_0x190a29);}return _0x2b03a7['save']();};}function saveUpdates(_0x44dbe6,_0x2fcceb){return function(_0x18732e){if(_0x18732e){return _0x18732e[_0x1106('0x21')](_0x44dbe6)[_0x1106('0x22')](function(_0x590172){return _0x590172;});}return null;};}function removeEntity(_0x5317ac,_0x59b6a1){return function(_0x1d4b04){if(_0x1d4b04){return _0x1d4b04['destroy']()[_0x1106('0x22')](function(){_0x5317ac[_0x1106('0x16')](0xcc)[_0x1106('0x17')]();});}};}function handleEntityNotFound(_0x3af1a4,_0x47afef){return function(_0x1c32fd){if(!_0x1c32fd){_0x3af1a4[_0x1106('0x15')](0x194);}return _0x1c32fd;};}function handleError(_0x25d6ce,_0xb862b8){_0xb862b8=_0xb862b8||0x1f4;return function(_0x3cdb48){logger[_0x1106('0x23')](_0x3cdb48[_0x1106('0x24')]);if(_0x3cdb48[_0x1106('0x25')]){delete _0x3cdb48['name'];}_0x25d6ce[_0x1106('0x16')](_0xb862b8)[_0x1106('0x26')](_0x3cdb48);};}exports['index']=function(_0x4872e6,_0x4b7c33){var _0x1469ee={},_0x42da58={},_0x237364={'count':0x0,'rows':[]};var _0x3edce7=_[_0x1106('0x27')](db[_0x1106('0x28')][_0x1106('0x29')],function(_0x5e6d74){return{'name':_0x5e6d74['fieldName'],'type':_0x5e6d74[_0x1106('0x2a')][_0x1106('0x2b')]};});_0x42da58['model']=_[_0x1106('0x27')](_0x3edce7,_0x1106('0x25'));_0x42da58[_0x1106('0x2c')]=_[_0x1106('0x2d')](_0x4872e6[_0x1106('0x2c')]);_0x42da58[_0x1106('0x2e')]=_[_0x1106('0x2f')](_0x42da58[_0x1106('0x30')],_0x42da58[_0x1106('0x2c')]);_0x1469ee[_0x1106('0x31')]=_[_0x1106('0x2f')](_0x42da58[_0x1106('0x30')],qs['fields'](_0x4872e6[_0x1106('0x2c')][_0x1106('0x32')]));_0x1469ee[_0x1106('0x31')]=_0x1469ee[_0x1106('0x31')][_0x1106('0x33')]?_0x1469ee[_0x1106('0x31')]:_0x42da58[_0x1106('0x30')];if(!_0x4872e6[_0x1106('0x2c')]['hasOwnProperty'](_0x1106('0x34'))){_0x1469ee[_0x1106('0x1b')]=qs[_0x1106('0x1b')](_0x4872e6['query'][_0x1106('0x1b')]);_0x1469ee[_0x1106('0x19')]=qs[_0x1106('0x19')](_0x4872e6['query'][_0x1106('0x19')]);}_0x1469ee[_0x1106('0x35')]=qs[_0x1106('0x36')](_0x4872e6[_0x1106('0x2c')][_0x1106('0x36')]);_0x1469ee[_0x1106('0x37')]=qs[_0x1106('0x2e')](_[_0x1106('0x38')](_0x4872e6[_0x1106('0x2c')],_0x42da58[_0x1106('0x2e')]),_0x3edce7);if(_0x4872e6[_0x1106('0x2c')][_0x1106('0x39')]){_0x1469ee[_0x1106('0x37')]=_[_0x1106('0x3a')](_0x1469ee[_0x1106('0x37')],{'$or':_[_0x1106('0x27')](_0x3edce7,function(_0x52cb88){if(_0x52cb88[_0x1106('0x2a')]!==_0x1106('0x3b')){var _0x4e8960={};_0x4e8960[_0x52cb88[_0x1106('0x25')]]={'$like':'%'+_0x4872e6[_0x1106('0x2c')][_0x1106('0x39')]+'%'};return _0x4e8960;}})});}_0x1469ee=_['merge']({},_0x1469ee,_0x4872e6[_0x1106('0x3c')]);var _0x537fe9={'where':_0x1469ee[_0x1106('0x37')]};return db[_0x1106('0x28')][_0x1106('0x1c')](_0x537fe9)[_0x1106('0x22')](function(_0x1a1ae8){_0x237364[_0x1106('0x1c')]=_0x1a1ae8;if(_0x4872e6[_0x1106('0x2c')][_0x1106('0x3d')]){_0x1469ee[_0x1106('0x3e')]=[{'all':!![]}];}return db[_0x1106('0x28')][_0x1106('0x3f')](_0x1469ee);})['then'](function(_0x4fd4d){_0x237364[_0x1106('0x40')]=_0x4fd4d;return _0x237364;})[_0x1106('0x22')](respondWithFilteredResult(_0x4b7c33,_0x1469ee))['catch'](handleError(_0x4b7c33,null));};exports[_0x1106('0x41')]=function(_0xac44bb,_0x53edf9){var _0x2b7ce1={'raw':!![],'where':{'id':_0xac44bb['params']['id']}},_0xe2cd4c={};_0xe2cd4c[_0x1106('0x30')]=_[_0x1106('0x2d')](db[_0x1106('0x28')][_0x1106('0x29')]);_0xe2cd4c[_0x1106('0x2c')]=_[_0x1106('0x2d')](_0xac44bb[_0x1106('0x2c')]);_0xe2cd4c[_0x1106('0x2e')]=_[_0x1106('0x2f')](_0xe2cd4c[_0x1106('0x30')],_0xe2cd4c[_0x1106('0x2c')]);_0x2b7ce1[_0x1106('0x31')]=_[_0x1106('0x2f')](_0xe2cd4c['model'],qs['fields'](_0xac44bb[_0x1106('0x2c')][_0x1106('0x32')]));_0x2b7ce1['attributes']=_0x2b7ce1[_0x1106('0x31')][_0x1106('0x33')]?_0x2b7ce1['attributes']:_0xe2cd4c[_0x1106('0x30')];if(_0xac44bb[_0x1106('0x2c')][_0x1106('0x3d')]){_0x2b7ce1[_0x1106('0x3e')]=[{'all':!![]}];}_0x2b7ce1=_[_0x1106('0x3a')]({},_0x2b7ce1,_0xac44bb[_0x1106('0x3c')]);return db[_0x1106('0x28')][_0x1106('0x42')](_0x2b7ce1)[_0x1106('0x22')](handleEntityNotFound(_0x53edf9,null))['then'](respondWithResult(_0x53edf9,null))[_0x1106('0x43')](handleError(_0x53edf9,null));};exports[_0x1106('0x44')]=function(_0xe133dd,_0x4b0bb8){return db['MailTransferReport'][_0x1106('0x44')](_0xe133dd['body'],{})[_0x1106('0x22')](respondWithResult(_0x4b0bb8,0xc9))[_0x1106('0x43')](handleError(_0x4b0bb8,null));};exports['update']=function(_0x38bb51,_0x4a2bd2){if(_0x38bb51[_0x1106('0x45')]['id']){delete _0x38bb51[_0x1106('0x45')]['id'];}return db[_0x1106('0x28')][_0x1106('0x42')]({'where':{'id':_0x38bb51[_0x1106('0x46')]['id']}})[_0x1106('0x22')](handleEntityNotFound(_0x4a2bd2,null))[_0x1106('0x22')](saveUpdates(_0x38bb51['body'],null))['then'](respondWithResult(_0x4a2bd2,null))[_0x1106('0x43')](handleError(_0x4a2bd2,null));};exports[_0x1106('0x47')]=function(_0x16a60c,_0x573918){return db['MailTransferReport'][_0x1106('0x42')]({'where':{'id':_0x16a60c['params']['id']}})[_0x1106('0x22')](handleEntityNotFound(_0x573918,null))[_0x1106('0x22')](removeEntity(_0x573918,null))[_0x1106('0x43')](handleError(_0x573918,null));};exports[_0x1106('0x48')]=function(_0x4f7280,_0x64028b){return db[_0x1106('0x28')][_0x1106('0x48')]()[_0x1106('0x22')](respondWithResult(_0x64028b,null))['catch'](handleError(_0x64028b,null));}; \ No newline at end of file +var _0xba53=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','index','map','MailTransferReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','update','body','params','describe','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x338775,_0x18d242){var _0x41394d=function(_0x348bca){while(--_0x348bca){_0x338775['push'](_0x338775['shift']());}};_0x41394d(++_0x18d242);}(_0xba53,0x1a8));var _0x3ba5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xba53[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x3ba5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ba5('0x1'));var BPromise=require(_0x3ba5('0x2'));var Mustache=require(_0x3ba5('0x3'));var util=require(_0x3ba5('0x4'));var path=require(_0x3ba5('0x5'));var sox=require(_0x3ba5('0x6'));var csv=require(_0x3ba5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ba5('0x8'));var _=require(_0x3ba5('0x9'));var squel=require(_0x3ba5('0xa'));var crypto=require('crypto');var jsforce=require(_0x3ba5('0xb'));var deskjs=require(_0x3ba5('0xc'));var toCsv=require(_0x3ba5('0x7'));var querystring=require(_0x3ba5('0xd'));var Papa=require(_0x3ba5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ba5('0xf'));var as=require(_0x3ba5('0x10'));var hardwareService=require(_0x3ba5('0x11'));var logger=require(_0x3ba5('0x12'))(_0x3ba5('0x13'));var utils=require(_0x3ba5('0x14'));var config=require(_0x3ba5('0x15'));var licenseUtil=require(_0x3ba5('0x16'));var db=require(_0x3ba5('0x17'))['db'];function respondWithStatusCode(_0x37b72a,_0x1d31f3){_0x1d31f3=_0x1d31f3||0xcc;return function(_0x20a657){if(_0x20a657){return _0x37b72a[_0x3ba5('0x18')](_0x1d31f3);}return _0x37b72a[_0x3ba5('0x19')](_0x1d31f3)[_0x3ba5('0x1a')]();};}function respondWithResult(_0x2ea504,_0x4e84b1){_0x4e84b1=_0x4e84b1||0xc8;return function(_0x39cce5){if(_0x39cce5){return _0x2ea504[_0x3ba5('0x19')](_0x4e84b1)['json'](_0x39cce5);}};}function respondWithFilteredResult(_0x3c3377,_0x40b4e0){return function(_0x5b3e48){if(_0x5b3e48){var _0x4b0c2b=typeof _0x40b4e0[_0x3ba5('0x1b')]===_0x3ba5('0x1c')&&typeof _0x40b4e0[_0x3ba5('0x1d')]==='undefined';var _0x2ce090=_0x5b3e48[_0x3ba5('0x1e')];var _0x36fddf=_0x4b0c2b?0x0:_0x40b4e0[_0x3ba5('0x1b')];var _0x431430=_0x4b0c2b?_0x5b3e48[_0x3ba5('0x1e')]:_0x40b4e0[_0x3ba5('0x1b')]+_0x40b4e0[_0x3ba5('0x1d')];var _0x183dbb;if(_0x431430>=_0x2ce090){_0x431430=_0x2ce090;_0x183dbb=0xc8;}else{_0x183dbb=0xce;}_0x3c3377[_0x3ba5('0x19')](_0x183dbb);return _0x3c3377[_0x3ba5('0x1f')](_0x3ba5('0x20'),_0x36fddf+'-'+_0x431430+'/'+_0x2ce090)[_0x3ba5('0x21')](_0x5b3e48);}return null;};}function patchUpdates(_0x5dba2e){return function(_0x211627){try{jsonpatch['apply'](_0x211627,_0x5dba2e,!![]);}catch(_0x42d0fc){return BPromise['reject'](_0x42d0fc);}return _0x211627[_0x3ba5('0x22')]();};}function saveUpdates(_0x12a140,_0x40e321){return function(_0x4d755d){if(_0x4d755d){return _0x4d755d['update'](_0x12a140)[_0x3ba5('0x23')](function(_0x2f1ccb){return _0x2f1ccb;});}return null;};}function removeEntity(_0x2e77d7,_0x4234ca){return function(_0x161135){if(_0x161135){return _0x161135[_0x3ba5('0x24')]()['then'](function(){_0x2e77d7[_0x3ba5('0x19')](0xcc)[_0x3ba5('0x1a')]();});}};}function handleEntityNotFound(_0x1a5a24,_0x172f9d){return function(_0x2ff7de){if(!_0x2ff7de){_0x1a5a24[_0x3ba5('0x18')](0x194);}return _0x2ff7de;};}function handleError(_0x1a4cea,_0x47c254){_0x47c254=_0x47c254||0x1f4;return function(_0x469bdd){logger[_0x3ba5('0x25')](_0x469bdd[_0x3ba5('0x26')]);if(_0x469bdd['name']){delete _0x469bdd[_0x3ba5('0x27')];}_0x1a4cea[_0x3ba5('0x19')](_0x47c254)['send'](_0x469bdd);};}exports[_0x3ba5('0x28')]=function(_0x1250fe,_0x516c28){var _0x3491c9={},_0x5f4cfd={},_0x4f2fa6={'count':0x0,'rows':[]};var _0x18e63c=_[_0x3ba5('0x29')](db[_0x3ba5('0x2a')]['rawAttributes'],function(_0x4a633e){return{'name':_0x4a633e[_0x3ba5('0x2b')],'type':_0x4a633e[_0x3ba5('0x2c')][_0x3ba5('0x2d')]};});_0x5f4cfd[_0x3ba5('0x2e')]=_[_0x3ba5('0x29')](_0x18e63c,_0x3ba5('0x27'));_0x5f4cfd['query']=_[_0x3ba5('0x2f')](_0x1250fe[_0x3ba5('0x30')]);_0x5f4cfd['filters']=_[_0x3ba5('0x31')](_0x5f4cfd[_0x3ba5('0x2e')],_0x5f4cfd[_0x3ba5('0x30')]);_0x3491c9['attributes']=_[_0x3ba5('0x31')](_0x5f4cfd[_0x3ba5('0x2e')],qs[_0x3ba5('0x32')](_0x1250fe[_0x3ba5('0x30')][_0x3ba5('0x32')]));_0x3491c9[_0x3ba5('0x33')]=_0x3491c9[_0x3ba5('0x33')][_0x3ba5('0x34')]?_0x3491c9[_0x3ba5('0x33')]:_0x5f4cfd[_0x3ba5('0x2e')];if(!_0x1250fe[_0x3ba5('0x30')][_0x3ba5('0x35')](_0x3ba5('0x36'))){_0x3491c9[_0x3ba5('0x1d')]=qs[_0x3ba5('0x1d')](_0x1250fe['query'][_0x3ba5('0x1d')]);_0x3491c9[_0x3ba5('0x1b')]=qs[_0x3ba5('0x1b')](_0x1250fe[_0x3ba5('0x30')][_0x3ba5('0x1b')]);}_0x3491c9['order']=qs[_0x3ba5('0x37')](_0x1250fe[_0x3ba5('0x30')][_0x3ba5('0x37')]);_0x3491c9[_0x3ba5('0x38')]=qs[_0x3ba5('0x39')](_['pick'](_0x1250fe[_0x3ba5('0x30')],_0x5f4cfd['filters']),_0x18e63c);if(_0x1250fe[_0x3ba5('0x30')][_0x3ba5('0x3a')]){_0x3491c9[_0x3ba5('0x38')]=_[_0x3ba5('0x3b')](_0x3491c9[_0x3ba5('0x38')],{'$or':_[_0x3ba5('0x29')](_0x18e63c,function(_0x310a46){if(_0x310a46['type']!==_0x3ba5('0x3c')){var _0x56aa2e={};_0x56aa2e[_0x310a46[_0x3ba5('0x27')]]={'$like':'%'+_0x1250fe[_0x3ba5('0x30')][_0x3ba5('0x3a')]+'%'};return _0x56aa2e;}})});}_0x3491c9=_[_0x3ba5('0x3b')]({},_0x3491c9,_0x1250fe[_0x3ba5('0x3d')]);var _0x291610={'where':_0x3491c9[_0x3ba5('0x38')]};return db[_0x3ba5('0x2a')][_0x3ba5('0x1e')](_0x291610)[_0x3ba5('0x23')](function(_0x32bf9f){_0x4f2fa6[_0x3ba5('0x1e')]=_0x32bf9f;if(_0x1250fe[_0x3ba5('0x30')]['includeAll']){_0x3491c9[_0x3ba5('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x3ba5('0x3f')](_0x3491c9);})['then'](function(_0x4dd7b3){_0x4f2fa6[_0x3ba5('0x40')]=_0x4dd7b3;return _0x4f2fa6;})['then'](respondWithFilteredResult(_0x516c28,_0x3491c9))['catch'](handleError(_0x516c28,null));};exports[_0x3ba5('0x41')]=function(_0x3e9f78,_0x4234c0){var _0x56bcb8={'raw':!![],'where':{'id':_0x3e9f78['params']['id']}},_0x1eacc8={};_0x1eacc8['model']=_['keys'](db[_0x3ba5('0x2a')][_0x3ba5('0x42')]);_0x1eacc8[_0x3ba5('0x30')]=_[_0x3ba5('0x2f')](_0x3e9f78['query']);_0x1eacc8[_0x3ba5('0x39')]=_[_0x3ba5('0x31')](_0x1eacc8['model'],_0x1eacc8[_0x3ba5('0x30')]);_0x56bcb8[_0x3ba5('0x33')]=_[_0x3ba5('0x31')](_0x1eacc8[_0x3ba5('0x2e')],qs['fields'](_0x3e9f78[_0x3ba5('0x30')][_0x3ba5('0x32')]));_0x56bcb8['attributes']=_0x56bcb8[_0x3ba5('0x33')][_0x3ba5('0x34')]?_0x56bcb8[_0x3ba5('0x33')]:_0x1eacc8[_0x3ba5('0x2e')];if(_0x3e9f78[_0x3ba5('0x30')][_0x3ba5('0x43')]){_0x56bcb8[_0x3ba5('0x3e')]=[{'all':!![]}];}_0x56bcb8=_[_0x3ba5('0x3b')]({},_0x56bcb8,_0x3e9f78[_0x3ba5('0x3d')]);return db['MailTransferReport'][_0x3ba5('0x44')](_0x56bcb8)[_0x3ba5('0x23')](handleEntityNotFound(_0x4234c0,null))[_0x3ba5('0x23')](respondWithResult(_0x4234c0,null))[_0x3ba5('0x45')](handleError(_0x4234c0,null));};exports['create']=function(_0x4a56d3,_0x4ab420){return db['MailTransferReport']['create'](_0x4a56d3['body'],{})['then'](respondWithResult(_0x4ab420,0xc9))[_0x3ba5('0x45')](handleError(_0x4ab420,null));};exports[_0x3ba5('0x46')]=function(_0x44b91f,_0x90e3b0){if(_0x44b91f[_0x3ba5('0x47')]['id']){delete _0x44b91f[_0x3ba5('0x47')]['id'];}return db['MailTransferReport'][_0x3ba5('0x44')]({'where':{'id':_0x44b91f[_0x3ba5('0x48')]['id']}})[_0x3ba5('0x23')](handleEntityNotFound(_0x90e3b0,null))[_0x3ba5('0x23')](saveUpdates(_0x44b91f[_0x3ba5('0x47')],null))[_0x3ba5('0x23')](respondWithResult(_0x90e3b0,null))[_0x3ba5('0x45')](handleError(_0x90e3b0,null));};exports[_0x3ba5('0x24')]=function(_0x23a24d,_0x4025df){return db[_0x3ba5('0x2a')][_0x3ba5('0x44')]({'where':{'id':_0x23a24d[_0x3ba5('0x48')]['id']}})[_0x3ba5('0x23')](handleEntityNotFound(_0x4025df,null))[_0x3ba5('0x23')](removeEntity(_0x4025df,null))[_0x3ba5('0x45')](handleError(_0x4025df,null));};exports[_0x3ba5('0x49')]=function(_0x30cd89,_0x38b4cb){return db[_0x3ba5('0x2a')][_0x3ba5('0x49')]()['then'](respondWithResult(_0x38b4cb,null))[_0x3ba5('0x45')](handleError(_0x38b4cb,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3e23b31..a24939e 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 _0xc300=['../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','moment','bluebird','path','rimraf'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xc300,0x132));var _0x0c30=function(_0x450768,_0x54f53d){_0x450768=_0x450768-0x0;var _0x2d56db=_0xc300[_0x450768];return _0x2d56db;};'use strict';var _=require(_0x0c30('0x0'));var util=require(_0x0c30('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c30('0x2'));var BPromise=require(_0x0c30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c30('0x4'));var rimraf=require(_0x0c30('0x5'));var config=require(_0x0c30('0x6'));var attributes=require(_0x0c30('0x7'));module[_0x0c30('0x8')]=function(_0x99afcb,_0xc8f529){return _0x99afcb[_0x0c30('0x9')]('MailTransferReport',attributes,{'tableName':_0x0c30('0xa'),'paranoid':![],'indexes':[{'name':_0x0c30('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e14=['util','../../config/logger','api','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x513f27,_0x1cbc87){var _0xa316b7=function(_0x3b592d){while(--_0x3b592d){_0x513f27['push'](_0x513f27['shift']());}};_0xa316b7(++_0x1cbc87);}(_0x1e14,0xef));var _0x41e1=function(_0x22e81a,_0xc6f0c1){_0x22e81a=_0x22e81a-0x0;var _0x24272f=_0x1e14[_0x22e81a];return _0x24272f;};'use strict';var _=require(_0x41e1('0x0'));var util=require(_0x41e1('0x1'));var logger=require(_0x41e1('0x2'))(_0x41e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x41e1('0x4'));var rimraf=require('rimraf');var config=require(_0x41e1('0x5'));var attributes=require(_0x41e1('0x6'));module[_0x41e1('0x7')]=function(_0xd3a2bf,_0x362862){return _0xd3a2bf[_0x41e1('0x8')](_0x41e1('0x9'),attributes,{'tableName':_0x41e1('0xa'),'paranoid':![],'indexes':[{'name':_0x41e1('0xb'),'fields':[_0x41e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index d3f7f66..06a1543 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 _0x95d7=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x524e09,_0x5c6cd6){var _0xfd9f3a=function(_0x3fded9){while(--_0x3fded9){_0x524e09['push'](_0x524e09['shift']());}};_0xfd9f3a(++_0x5c6cd6);}(_0x95d7,0xf0));var _0x795d=function(_0x292d83,_0x3c3f1c){_0x292d83=_0x292d83-0x0;var _0x5772f9=_0x95d7[_0x292d83];return _0x5772f9;};'use strict';var _=require(_0x795d('0x0'));var util=require(_0x795d('0x1'));var moment=require('moment');var BPromise=require(_0x795d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x795d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x795d('0x4'));var logger=require('../../config/logger')(_0x795d('0x5'));var config=require(_0x795d('0x6'));var jayson=require(_0x795d('0x7'));var client=jayson[_0x795d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x520262,_0x208f5a,_0x297541){return new BPromise(function(_0x1345d9,_0x2cab00){return client[_0x795d('0x9')](_0x520262,_0x297541)['then'](function(_0x3031e3){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x208f5a,_0x795d('0xa'));logger[_0x795d('0xb')](_0x795d('0xc'),_0x208f5a,_0x795d('0xa'),JSON[_0x795d('0xd')](_0x3031e3));if(_0x3031e3['error']){if(_0x3031e3[_0x795d('0xe')][_0x795d('0xf')]===0x1f4){logger[_0x795d('0xe')](_0x795d('0x10'),_0x208f5a,_0x3031e3[_0x795d('0xe')]['message']);return _0x2cab00(_0x3031e3[_0x795d('0xe')]['message']);}logger[_0x795d('0xe')](_0x795d('0x10'),_0x208f5a,_0x3031e3[_0x795d('0xe')][_0x795d('0x11')]);return _0x1345d9(_0x3031e3[_0x795d('0xe')][_0x795d('0x11')]);}else{logger['info'](_0x795d('0x10'),_0x208f5a,'request\x20sent');_0x1345d9(_0x3031e3[_0x795d('0x12')][_0x795d('0x11')]);}})[_0x795d('0x13')](function(_0x228265){logger[_0x795d('0xe')](_0x795d('0x10'),_0x208f5a,_0x228265);_0x2cab00(_0x228265);});});} \ No newline at end of file +var _0xf3ba=['../../mysqldb','../../config/utils','rpc','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x5e5d25,_0xa5dc58){var _0x34e516=function(_0x2dc233){while(--_0x2dc233){_0x5e5d25['push'](_0x5e5d25['shift']());}};_0x34e516(++_0xa5dc58);}(_0xf3ba,0x1de));var _0xaf3b=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xf3ba[_0x295314];return _0x584b0c;};'use strict';var _=require(_0xaf3b('0x0'));var util=require(_0xaf3b('0x1'));var moment=require(_0xaf3b('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf3b('0x3'));var fs=require('fs');var Redis=require(_0xaf3b('0x4'));var db=require(_0xaf3b('0x5'))['db'];var utils=require(_0xaf3b('0x6'));var logger=require('../../config/logger')(_0xaf3b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf3b('0x8')][_0xaf3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b891c,_0x1dab47,_0x539839){return new BPromise(function(_0x32b68b,_0x225f29){return client[_0xaf3b('0xa')](_0x1b891c,_0x539839)[_0xaf3b('0xb')](function(_0x2d5d1e){logger[_0xaf3b('0xc')](_0xaf3b('0xd'),_0x1dab47,_0xaf3b('0xe'));logger[_0xaf3b('0xf')](_0xaf3b('0x10'),_0x1dab47,_0xaf3b('0xe'),JSON[_0xaf3b('0x11')](_0x2d5d1e));if(_0x2d5d1e[_0xaf3b('0x12')]){if(_0x2d5d1e['error']['code']===0x1f4){logger['error'](_0xaf3b('0xd'),_0x1dab47,_0x2d5d1e[_0xaf3b('0x12')][_0xaf3b('0x13')]);return _0x225f29(_0x2d5d1e[_0xaf3b('0x12')][_0xaf3b('0x13')]);}logger[_0xaf3b('0x12')](_0xaf3b('0xd'),_0x1dab47,_0x2d5d1e[_0xaf3b('0x12')][_0xaf3b('0x13')]);return _0x32b68b(_0x2d5d1e[_0xaf3b('0x12')][_0xaf3b('0x13')]);}else{logger[_0xaf3b('0xc')](_0xaf3b('0xd'),_0x1dab47,_0xaf3b('0xe'));_0x32b68b(_0x2d5d1e[_0xaf3b('0x14')][_0xaf3b('0x13')]);}})['catch'](function(_0x1f37d6){logger[_0xaf3b('0x12')](_0xaf3b('0xd'),_0x1dab47,_0x1f37d6);_0x225f29(_0x1f37d6);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 76dafc2..a526bcc 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 _0x0fbe=['../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','post','create','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5cdae9,_0x5e30a9){var _0x417701=function(_0x3e0142){while(--_0x3e0142){_0x5cdae9['push'](_0x5cdae9['shift']());}};_0x417701(++_0x5e30a9);}(_0x0fbe,0x71));var _0xe0fb=function(_0x53d210,_0x4874c7){_0x53d210=_0x53d210-0x0;var _0x4ea418=_0x0fbe[_0x53d210];return _0x4ea418;};'use strict';var multer=require(_0xe0fb('0x0'));var util=require(_0xe0fb('0x1'));var path=require('path');var timeout=require(_0xe0fb('0x2'));var express=require(_0xe0fb('0x3'));var router=express['Router']();var fs_extra=require(_0xe0fb('0x4'));var auth=require(_0xe0fb('0x5'));var interaction=require(_0xe0fb('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0xe0fb('0x7')](),controller[_0xe0fb('0x8')]);router[_0xe0fb('0x9')](_0xe0fb('0xa'),auth[_0xe0fb('0x7')](),controller[_0xe0fb('0xb')]);router['get'](_0xe0fb('0xc'),auth[_0xe0fb('0x7')](),controller['show']);router[_0xe0fb('0xd')]('/',auth[_0xe0fb('0x7')](),controller[_0xe0fb('0xe')]);router['put'](_0xe0fb('0xc'),auth[_0xe0fb('0x7')](),controller['update']);router['delete']('/:id',auth[_0xe0fb('0x7')](),controller[_0xe0fb('0xf')]);module[_0xe0fb('0x10')]=router; \ No newline at end of file +var _0xab50=['describe','/:id','show','post','create','put','update','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe'];(function(_0x32b98d,_0x584cd7){var _0x329897=function(_0x458599){while(--_0x458599){_0x32b98d['push'](_0x32b98d['shift']());}};_0x329897(++_0x584cd7);}(_0xab50,0xfe));var _0x0ab5=function(_0x427629,_0x66bfce){_0x427629=_0x427629-0x0;var _0x28486f=_0xab50[_0x427629];return _0x28486f;};'use strict';var multer=require(_0x0ab5('0x0'));var util=require(_0x0ab5('0x1'));var path=require(_0x0ab5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0ab5('0x3'));var auth=require(_0x0ab5('0x4'));var interaction=require(_0x0ab5('0x5'));var config=require(_0x0ab5('0x6'));var controller=require(_0x0ab5('0x7'));router[_0x0ab5('0x8')]('/',auth[_0x0ab5('0x9')](),controller[_0x0ab5('0xa')]);router[_0x0ab5('0x8')](_0x0ab5('0xb'),auth[_0x0ab5('0x9')](),controller[_0x0ab5('0xc')]);router[_0x0ab5('0x8')](_0x0ab5('0xd'),auth['isAuthenticated'](),controller[_0x0ab5('0xe')]);router[_0x0ab5('0xf')]('/',auth[_0x0ab5('0x9')](),controller[_0x0ab5('0x10')]);router[_0x0ab5('0x11')](_0x0ab5('0xd'),auth[_0x0ab5('0x9')](),controller[_0x0ab5('0x12')]);router['delete'](_0x0ab5('0xd'),auth[_0x0ab5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a6340cf..13bc8f0 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 _0x3f53=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x3a4e77,_0x3349ba){var _0x35a151=function(_0x3fb70b){while(--_0x3fb70b){_0x3a4e77['push'](_0x3a4e77['shift']());}};_0x35a151(++_0x3349ba);}(_0x3f53,0x181));var _0x33f5=function(_0xbda011,_0x20d7e2){_0xbda011=_0xbda011-0x0;var _0x469a19=_0x3f53[_0xbda011];return _0x469a19;};'use strict';var Sequelize=require(_0x33f5('0x0'));var moment=require(_0x33f5('0x1'));module[_0x33f5('0x2')]={'channel':{'type':Sequelize[_0x33f5('0x3')]},'membername':{'type':Sequelize[_0x33f5('0x3')]},'interface':{'type':Sequelize[_0x33f5('0x3')]},'type':{'type':Sequelize[_0x33f5('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x33f5('0x4')},'duration':{'type':Sequelize[_0x33f5('0x5')]},'enterAt':{'type':Sequelize[_0x33f5('0x6')]},'exitAt':{'type':Sequelize[_0x33f5('0x6')],'set':function(_0x77f95d){var _0x1ea00c=moment(_0x77f95d);var _0x296004=moment(this[_0x33f5('0x7')](_0x33f5('0x8')));var _0x3e06e8=_0x1ea00c[_0x33f5('0x9')](_0x296004,_0x33f5('0xa'));this[_0x33f5('0xb')]('exitAt',_0x77f95d);this[_0x33f5('0xb')](_0x33f5('0xc'),_0x3e06e8>=0x0?_0x3e06e8:null);}},'data1':{'type':Sequelize[_0x33f5('0x3')],'comment':_0x33f5('0xd')},'data2':{'type':Sequelize[_0x33f5('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x33f5('0x3')],'comment':_0x33f5('0xe')},'data4':{'type':Sequelize[_0x33f5('0x3')],'comment':_0x33f5('0xf')},'data5':{'type':Sequelize[_0x33f5('0x3')],'comment':_0x33f5('0x10')},'role':{'type':Sequelize[_0x33f5('0x3')]},'internal':{'type':Sequelize[_0x33f5('0x5')]},'uniqueid':{'type':Sequelize[_0x33f5('0x3')]}}; \ No newline at end of file +var _0xea4f=['diff','seconds','talk:[start]','talk:[destination]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt'];(function(_0x5554da,_0x6cc7fc){var _0x447f56=function(_0x4d95b1){while(--_0x4d95b1){_0x5554da['push'](_0x5554da['shift']());}};_0x447f56(++_0x6cc7fc);}(_0xea4f,0x155));var _0xfea4=function(_0x1afd49,_0x10e919){_0x1afd49=_0x1afd49-0x0;var _0x3dd836=_0xea4f[_0x1afd49];return _0x3dd836;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfea4('0x0')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfea4('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfea4('0x1')],'defaultValue':_0xfea4('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xfea4('0x3')]},'enterAt':{'type':Sequelize[_0xfea4('0x4')]},'exitAt':{'type':Sequelize[_0xfea4('0x4')],'set':function(_0x1410d5){var _0x31b239=moment(_0x1410d5);var _0x1c9337=moment(this[_0xfea4('0x5')](_0xfea4('0x6')));var _0x36a8d0=_0x31b239[_0xfea4('0x7')](_0x1c9337,_0xfea4('0x8'));this['setDataValue']('exitAt',_0x1410d5);this['setDataValue']('duration',_0x36a8d0>=0x0?_0x36a8d0:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xfea4('0x9')},'data3':{'type':Sequelize[_0xfea4('0x1')],'comment':_0xfea4('0xa')},'data4':{'type':Sequelize[_0xfea4('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xfea4('0x1')],'comment':_0xfea4('0xb')},'role':{'type':Sequelize[_0xfea4('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xfea4('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 238f73e..049ee48 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x231bc5,_0x182c85){var _0x5aa049=function(_0x40125d){while(--_0x40125d){_0x231bc5['push'](_0x231bc5['shift']());}};_0x5aa049(++_0x182c85);}(_0x3e74,0x175));var _0x43e7=function(_0x2fa194,_0x167d95){_0x2fa194=_0x2fa194-0x0;var _0x43120a=_0x3e74[_0x2fa194];return _0x43120a;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x546e7d,_0x4c02ed){var _0x3cf967=function(_0x167e4f){while(--_0x167e4f){_0x546e7d['push'](_0x546e7d['shift']());}};_0x3cf967(++_0x4c02ed);}(_0x3e74,0x175));var _0x43e7=function(_0x573666,_0x36f9dd){_0x573666=_0x573666-0x0;var _0x3e8ba2=_0x3e74[_0x573666];return _0x3e8ba2;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d902c7f..222e2f3 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 _0x64e4=['report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport'];(function(_0x4abdb3,_0x2e2e96){var _0x8eafbf=function(_0x48d652){while(--_0x48d652){_0x4abdb3['push'](_0x4abdb3['shift']());}};_0x8eafbf(++_0x2e2e96);}(_0x64e4,0x12a));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x464e('0x0'));var logger=require(_0x464e('0x1'))(_0x464e('0x2'));var moment=require(_0x464e('0x3'));var BPromise=require(_0x464e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x464e('0x5'));var config=require(_0x464e('0x6'));var attributes=require(_0x464e('0x7'));module['exports']=function(_0x2a1d51,_0x3083f7){return _0x2a1d51[_0x464e('0x8')](_0x464e('0x9'),attributes,{'tableName':_0x464e('0xa'),'paranoid':![],'indexes':[{'name':_0x464e('0xb'),'fields':[_0x464e('0xc'),_0x464e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95ba=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','interface','lodash'];(function(_0x8525d8,_0x574c3c){var _0x25d8d5=function(_0x2a1061){while(--_0x2a1061){_0x8525d8['push'](_0x8525d8['shift']());}};_0x25d8d5(++_0x574c3c);}(_0x95ba,0x13a));var _0xa95b=function(_0x57bd48,_0x379563){_0x57bd48=_0x57bd48-0x0;var _0x404856=_0x95ba[_0x57bd48];return _0x404856;};'use strict';var _=require(_0xa95b('0x0'));var util=require(_0xa95b('0x1'));var logger=require(_0xa95b('0x2'))('api');var moment=require(_0xa95b('0x3'));var BPromise=require(_0xa95b('0x4'));var rp=require(_0xa95b('0x5'));var fs=require('fs');var path=require(_0xa95b('0x6'));var rimraf=require(_0xa95b('0x7'));var config=require(_0xa95b('0x8'));var attributes=require(_0xa95b('0x9'));module[_0xa95b('0xa')]=function(_0x17df87,_0x4a8fbd){return _0x17df87[_0xa95b('0xb')](_0xa95b('0xc'),attributes,{'tableName':_0xa95b('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xa95b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index fdd4544..f2e7d9f 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 _0xed08=['info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MemberReport','findAll','options','raw','attributes','limit','map','model','include','GetMemberReport','catch','CreateMemberReport','UpdateMemberReport','update','body','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xcea07d,_0x3934da){var _0x107ae7=function(_0x2cb647){while(--_0x2cb647){_0xcea07d['push'](_0xcea07d['shift']());}};_0x107ae7(++_0x3934da);}(_0xed08,0x67));var _0x8ed0=function(_0xfe4d29,_0x1d213f){_0xfe4d29=_0xfe4d29-0x0;var _0x2aa45a=_0xed08[_0xfe4d29];return _0x2aa45a;};'use strict';var _=require('lodash');var util=require(_0x8ed0('0x0'));var moment=require(_0x8ed0('0x1'));var BPromise=require(_0x8ed0('0x2'));var rs=require(_0x8ed0('0x3'));var fs=require('fs');var Redis=require(_0x8ed0('0x4'));var db=require(_0x8ed0('0x5'))['db'];var utils=require(_0x8ed0('0x6'));var logger=require(_0x8ed0('0x7'))(_0x8ed0('0x8'));var config=require(_0x8ed0('0x9'));var jayson=require(_0x8ed0('0xa'));var client=jayson[_0x8ed0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15f266,_0x2eb70c,_0x1c86e6){return new BPromise(function(_0x39642a,_0x18d07d){return client[_0x8ed0('0xc')](_0x15f266,_0x1c86e6)[_0x8ed0('0xd')](function(_0x4f1083){logger[_0x8ed0('0xe')](_0x8ed0('0xf'),_0x2eb70c,_0x8ed0('0x10'));logger[_0x8ed0('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2eb70c,_0x8ed0('0x10'),JSON[_0x8ed0('0x12')](_0x4f1083));if(_0x4f1083[_0x8ed0('0x13')]){if(_0x4f1083[_0x8ed0('0x13')][_0x8ed0('0x14')]===0x1f4){logger[_0x8ed0('0x13')](_0x8ed0('0xf'),_0x2eb70c,_0x4f1083[_0x8ed0('0x13')][_0x8ed0('0x15')]);return _0x18d07d(_0x4f1083[_0x8ed0('0x13')]['message']);}logger[_0x8ed0('0x13')](_0x8ed0('0xf'),_0x2eb70c,_0x4f1083['error'][_0x8ed0('0x15')]);return _0x39642a(_0x4f1083[_0x8ed0('0x13')]['message']);}else{logger[_0x8ed0('0xe')](_0x8ed0('0xf'),_0x2eb70c,'request\x20sent');_0x39642a(_0x4f1083[_0x8ed0('0x16')][_0x8ed0('0x15')]);}})['catch'](function(_0x2792c8){logger[_0x8ed0('0x13')](_0x8ed0('0xf'),_0x2eb70c,_0x2792c8);_0x18d07d(_0x2792c8);});});}exports['GetMemberReport']=function(_0x55a134){var _0x5ef89c=this;return new Promise(function(_0x12fb2c,_0x77d537){return db[_0x8ed0('0x17')][_0x8ed0('0x18')]({'raw':_0x55a134[_0x8ed0('0x19')]?_0x55a134[_0x8ed0('0x19')][_0x8ed0('0x1a')]===undefined?!![]:![]:!![],'where':_0x55a134[_0x8ed0('0x19')]?_0x55a134[_0x8ed0('0x19')]['where']||null:null,'attributes':_0x55a134['options']?_0x55a134[_0x8ed0('0x19')][_0x8ed0('0x1b')]||null:null,'limit':_0x55a134['options']?_0x55a134[_0x8ed0('0x19')][_0x8ed0('0x1c')]||null:null,'include':_0x55a134[_0x8ed0('0x19')]?_0x55a134[_0x8ed0('0x19')]['include']?_[_0x8ed0('0x1d')](_0x55a134[_0x8ed0('0x19')]['include'],function(_0x1bf9ef){return{'model':db[_0x1bf9ef[_0x8ed0('0x1e')]],'as':_0x1bf9ef['as'],'attributes':_0x1bf9ef[_0x8ed0('0x1b')],'include':_0x1bf9ef[_0x8ed0('0x1f')]?_[_0x8ed0('0x1d')](_0x1bf9ef[_0x8ed0('0x1f')],function(_0x551c91){return{'model':db[_0x551c91['model']],'as':_0x551c91['as'],'attributes':_0x551c91[_0x8ed0('0x1b')],'include':_0x551c91[_0x8ed0('0x1f')]?_[_0x8ed0('0x1d')](_0x551c91[_0x8ed0('0x1f')],function(_0x108f04){return{'model':db[_0x108f04[_0x8ed0('0x1e')]],'as':_0x108f04['as'],'attributes':_0x108f04['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ed0('0xd')](function(_0x436e54){logger['info'](_0x8ed0('0x20'),_0x55a134);logger[_0x8ed0('0x11')](_0x8ed0('0x20'),_0x55a134,JSON[_0x8ed0('0x12')](_0x436e54));_0x12fb2c(_0x436e54);})[_0x8ed0('0x21')](function(_0xec3bd2){logger[_0x8ed0('0x13')]('GetMemberReport',_0xec3bd2['message'],_0x55a134);_0x77d537(_0x5ef89c['error'](0x1f4,_0xec3bd2[_0x8ed0('0x15')]));});});};exports[_0x8ed0('0x22')]=function(_0x59a78a){var _0x3065c4=this;return new Promise(function(_0x53c60c,_0x46eeca){return db[_0x8ed0('0x17')]['create'](_0x59a78a['body'],{'raw':_0x59a78a[_0x8ed0('0x19')]?_0x59a78a[_0x8ed0('0x19')][_0x8ed0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x30aa44){logger['info'](_0x8ed0('0x22'),_0x59a78a);logger[_0x8ed0('0x11')](_0x8ed0('0x22'),_0x59a78a,JSON[_0x8ed0('0x12')](_0x30aa44));_0x53c60c(_0x30aa44);})[_0x8ed0('0x21')](function(_0x4a2fc0){logger[_0x8ed0('0x13')]('CreateMemberReport',_0x4a2fc0[_0x8ed0('0x15')],_0x59a78a);_0x46eeca(_0x3065c4[_0x8ed0('0x13')](0x1f4,_0x4a2fc0[_0x8ed0('0x15')]));});});};exports[_0x8ed0('0x23')]=function(_0x1cfd71){var _0x8fefec=this;return new Promise(function(_0x6207a6,_0x44f82e){return db[_0x8ed0('0x17')][_0x8ed0('0x24')](_0x1cfd71[_0x8ed0('0x25')],{'raw':_0x1cfd71[_0x8ed0('0x19')]?_0x1cfd71[_0x8ed0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cfd71[_0x8ed0('0x19')]?_0x1cfd71['options'][_0x8ed0('0x26')]||null:null,'attributes':_0x1cfd71['options']?_0x1cfd71[_0x8ed0('0x19')][_0x8ed0('0x1b')]||null:null,'limit':_0x1cfd71[_0x8ed0('0x19')]?_0x1cfd71['options'][_0x8ed0('0x1c')]||null:null})[_0x8ed0('0xd')](function(_0x19777e){logger['info']('UpdateMemberReport',_0x1cfd71);logger[_0x8ed0('0x11')](_0x8ed0('0x23'),_0x1cfd71,JSON[_0x8ed0('0x12')](_0x19777e));_0x6207a6(_0x19777e);})[_0x8ed0('0x21')](function(_0x552ce4){logger[_0x8ed0('0x13')]('UpdateMemberReport',_0x552ce4[_0x8ed0('0x15')],_0x1cfd71);_0x44f82e(_0x8fefec[_0x8ed0('0x13')](0x1f4,_0x552ce4['message']));});});}; \ No newline at end of file +var _0xf02c=['then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MemberReport','findAll','options','attributes','limit','include','map','model','GetMemberReport','stringify','CreateMemberReport','create','raw','body','where','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf02c,0x92));var _0xcf02=function(_0xd55570,_0x233b57){_0xd55570=_0xd55570-0x0;var _0x134595=_0xf02c[_0xd55570];return _0x134595;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require(_0xcf02('0x8'))(_0xcf02('0x9'));var config=require(_0xcf02('0xa'));var jayson=require(_0xcf02('0xb'));var client=jayson[_0xcf02('0xc')][_0xcf02('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3569a1,_0x49ad8e,_0x45745e){return new BPromise(function(_0x56c3db,_0x5a255f){return client['request'](_0x3569a1,_0x45745e)[_0xcf02('0xe')](function(_0x2f1633){logger[_0xcf02('0xf')](_0xcf02('0x10'),_0x49ad8e,'request\x20sent');logger[_0xcf02('0x11')](_0xcf02('0x12'),_0x49ad8e,_0xcf02('0x13'),JSON['stringify'](_0x2f1633));if(_0x2f1633['error']){if(_0x2f1633[_0xcf02('0x14')][_0xcf02('0x15')]===0x1f4){logger[_0xcf02('0x14')](_0xcf02('0x10'),_0x49ad8e,_0x2f1633[_0xcf02('0x14')]['message']);return _0x5a255f(_0x2f1633[_0xcf02('0x14')][_0xcf02('0x16')]);}logger[_0xcf02('0x14')](_0xcf02('0x10'),_0x49ad8e,_0x2f1633[_0xcf02('0x14')][_0xcf02('0x16')]);return _0x56c3db(_0x2f1633[_0xcf02('0x14')]['message']);}else{logger[_0xcf02('0xf')](_0xcf02('0x10'),_0x49ad8e,_0xcf02('0x13'));_0x56c3db(_0x2f1633['result'][_0xcf02('0x16')]);}})[_0xcf02('0x17')](function(_0x59f337){logger[_0xcf02('0x14')]('MemberReport,\x20%s,\x20%s',_0x49ad8e,_0x59f337);_0x5a255f(_0x59f337);});});}exports['GetMemberReport']=function(_0x4f3829){var _0x2860fd=this;return new Promise(function(_0x53a97e,_0x29615d){return db[_0xcf02('0x18')][_0xcf02('0x19')]({'raw':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')]['where']||null:null,'attributes':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1b')]||null:null,'limit':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829['options'][_0xcf02('0x1c')]||null:null,'include':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1d')]?_[_0xcf02('0x1e')](_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1d')],function(_0x2926b9){return{'model':db[_0x2926b9['model']],'as':_0x2926b9['as'],'attributes':_0x2926b9['attributes'],'include':_0x2926b9['include']?_[_0xcf02('0x1e')](_0x2926b9[_0xcf02('0x1d')],function(_0x2fd260){return{'model':db[_0x2fd260[_0xcf02('0x1f')]],'as':_0x2fd260['as'],'attributes':_0x2fd260[_0xcf02('0x1b')],'include':_0x2fd260[_0xcf02('0x1d')]?_[_0xcf02('0x1e')](_0x2fd260[_0xcf02('0x1d')],function(_0x4ee2b9){return{'model':db[_0x4ee2b9[_0xcf02('0x1f')]],'as':_0x4ee2b9['as'],'attributes':_0x4ee2b9[_0xcf02('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54716d){logger[_0xcf02('0xf')](_0xcf02('0x20'),_0x4f3829);logger[_0xcf02('0x11')](_0xcf02('0x20'),_0x4f3829,JSON[_0xcf02('0x21')](_0x54716d));_0x53a97e(_0x54716d);})[_0xcf02('0x17')](function(_0x2b8bc6){logger[_0xcf02('0x14')](_0xcf02('0x20'),_0x2b8bc6['message'],_0x4f3829);_0x29615d(_0x2860fd[_0xcf02('0x14')](0x1f4,_0x2b8bc6[_0xcf02('0x16')]));});});};exports[_0xcf02('0x22')]=function(_0x5af4c3){var _0x2bef8e=this;return new Promise(function(_0x320d89,_0x47b633){return db[_0xcf02('0x18')][_0xcf02('0x23')](_0x5af4c3['body'],{'raw':_0x5af4c3[_0xcf02('0x1a')]?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x24')]===undefined?!![]:![]:!![]})[_0xcf02('0xe')](function(_0x474221){logger['info'](_0xcf02('0x22'),_0x5af4c3);logger[_0xcf02('0x11')](_0xcf02('0x22'),_0x5af4c3,JSON[_0xcf02('0x21')](_0x474221));_0x320d89(_0x474221);})[_0xcf02('0x17')](function(_0x5007ae){logger['error'](_0xcf02('0x22'),_0x5007ae[_0xcf02('0x16')],_0x5af4c3);_0x47b633(_0x2bef8e[_0xcf02('0x14')](0x1f4,_0x5007ae['message']));});});};exports['UpdateMemberReport']=function(_0x17e96f){var _0x3c624f=this;return new Promise(function(_0x259577,_0x2775b8){return db[_0xcf02('0x18')]['update'](_0x17e96f[_0xcf02('0x25')],{'raw':_0x17e96f[_0xcf02('0x1a')]?_0x17e96f[_0xcf02('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e96f[_0xcf02('0x1a')]?_0x17e96f[_0xcf02('0x1a')][_0xcf02('0x26')]||null:null,'attributes':_0x17e96f[_0xcf02('0x1a')]?_0x17e96f[_0xcf02('0x1a')]['attributes']||null:null,'limit':_0x17e96f[_0xcf02('0x1a')]?_0x17e96f[_0xcf02('0x1a')]['limit']||null:null})[_0xcf02('0xe')](function(_0x21225f){logger[_0xcf02('0xf')](_0xcf02('0x27'),_0x17e96f);logger['debug'](_0xcf02('0x27'),_0x17e96f,JSON[_0xcf02('0x21')](_0x21225f));_0x259577(_0x21225f);})[_0xcf02('0x17')](function(_0x43af50){logger[_0xcf02('0x14')](_0xcf02('0x27'),_0x43af50['message'],_0x17e96f);_0x2775b8(_0x3c624f[_0xcf02('0x14')](0x1f4,_0x43af50[_0xcf02('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 98f048f..782f017 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 _0x738e=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports'];(function(_0x56ca1a,_0x31d15f){var _0x401490=function(_0x3f7302){while(--_0x3f7302){_0x56ca1a['push'](_0x56ca1a['shift']());}};_0x401490(++_0x31d15f);}(_0x738e,0xbe));var _0xe738=function(_0x4e221e,_0x22329a){_0x4e221e=_0x4e221e-0x0;var _0x2297eb=_0x738e[_0x4e221e];return _0x2297eb;};'use strict';var multer=require('multer');var util=require(_0xe738('0x0'));var path=require(_0xe738('0x1'));var timeout=require('connect-timeout');var express=require(_0xe738('0x2'));var router=express['Router']();var fs_extra=require(_0xe738('0x3'));var auth=require(_0xe738('0x4'));var interaction=require(_0xe738('0x5'));var config=require(_0xe738('0x6'));var controller=require(_0xe738('0x7'));router['get']('/',controller[_0xe738('0x8')]);module[_0xe738('0x9')]=router; \ No newline at end of file +var _0x2b34=['../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3831ed,_0x5e88ce){var _0x5521ce=function(_0x15fef7){while(--_0x15fef7){_0x3831ed['push'](_0x3831ed['shift']());}};_0x5521ce(++_0x5e88ce);}(_0x2b34,0x165));var _0x42b3=function(_0x3e2b67,_0x5eae3c){_0x3e2b67=_0x3e2b67-0x0;var _0x419d32=_0x2b34[_0x3e2b67];return _0x419d32;};'use strict';var multer=require(_0x42b3('0x0'));var util=require(_0x42b3('0x1'));var path=require('path');var timeout=require(_0x42b3('0x2'));var express=require('express');var router=express[_0x42b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x42b3('0x4'));var interaction=require(_0x42b3('0x5'));var config=require(_0x42b3('0x6'));var controller=require(_0x42b3('0x7'));router[_0x42b3('0x8')]('/',controller[_0x42b3('0x9')]);module[_0x42b3('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 f5d51de..c0f9ccd 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 _0x3ea1=['exports','version'];(function(_0x4385fe,_0x38d475){var _0x118e9f=function(_0x4f6235){while(--_0x4f6235){_0x4385fe['push'](_0x4385fe['shift']());}};_0x118e9f(++_0x38d475);}(_0x3ea1,0x16a));var _0x13ea=function(_0x5b157d,_0x3cf94f){_0x5b157d=_0x5b157d-0x0;var _0x4c3288=_0x3ea1[_0x5b157d];return _0x4c3288;};'use strict';var Sequelize=require('sequelize');module[_0x13ea('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x13ea('0x1')}}; \ No newline at end of file +var _0xa1e1=['version','sequelize','exports','STRING'];(function(_0x408b34,_0xb7d872){var _0x1182aa=function(_0x1825c4){while(--_0x1825c4){_0x408b34['push'](_0x408b34['shift']());}};_0x1182aa(++_0xb7d872);}(_0xa1e1,0x1a1));var _0x1a1e=function(_0x980fef,_0x4223c4){_0x980fef=_0x980fef-0x0;var _0x52f662=_0xa1e1[_0x980fef];return _0x52f662;};'use strict';var Sequelize=require(_0x1a1e('0x0'));module[_0x1a1e('0x1')]={'version':{'type':Sequelize[_0x1a1e('0x2')],'unique':_0x1a1e('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a400a8c..5a90156 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 _0x14d9=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Migration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1e16e7,_0x11d381){var _0x1fcd7a=function(_0x544554){while(--_0x544554){_0x1e16e7['push'](_0x1e16e7['shift']());}};_0x1fcd7a(++_0x11d381);}(_0x14d9,0x1a3));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x914d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x914d('0x1'));var rp=require(_0x914d('0x2'));var moment=require(_0x914d('0x3'));var BPromise=require(_0x914d('0x4'));var Mustache=require(_0x914d('0x5'));var util=require(_0x914d('0x6'));var path=require(_0x914d('0x7'));var sox=require(_0x914d('0x8'));var csv=require(_0x914d('0x9'));var ejs=require(_0x914d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x914d('0xb'));var squel=require(_0x914d('0xc'));var crypto=require(_0x914d('0xd'));var jsforce=require(_0x914d('0xe'));var deskjs=require(_0x914d('0xf'));var toCsv=require(_0x914d('0x9'));var querystring=require(_0x914d('0x10'));var Papa=require(_0x914d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x914d('0x12'));var hardwareService=require(_0x914d('0x13'));var logger=require(_0x914d('0x14'))(_0x914d('0x15'));var utils=require(_0x914d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x914d('0x17'));var db=require(_0x914d('0x18'))['db'];function respondWithStatusCode(_0x213ced,_0x41b1d8){_0x41b1d8=_0x41b1d8||0xcc;return function(_0x561103){if(_0x561103){return _0x213ced[_0x914d('0x19')](_0x41b1d8);}return _0x213ced[_0x914d('0x1a')](_0x41b1d8)[_0x914d('0x1b')]();};}function respondWithResult(_0x4931a4,_0x5a5bcc){_0x5a5bcc=_0x5a5bcc||0xc8;return function(_0x5aa8ed){if(_0x5aa8ed){return _0x4931a4[_0x914d('0x1a')](_0x5a5bcc)[_0x914d('0x1c')](_0x5aa8ed);}};}function respondWithFilteredResult(_0x239aea,_0x9e3bb3){return function(_0x287474){if(_0x287474){var _0x44e8fd=typeof _0x9e3bb3[_0x914d('0x1d')]===_0x914d('0x1e')&&typeof _0x9e3bb3[_0x914d('0x1f')]===_0x914d('0x1e');var _0x543523=_0x287474['count'];var _0x682a34=_0x44e8fd?0x0:_0x9e3bb3[_0x914d('0x1d')];var _0xc8271b=_0x44e8fd?_0x287474[_0x914d('0x20')]:_0x9e3bb3[_0x914d('0x1d')]+_0x9e3bb3[_0x914d('0x1f')];var _0x53a819;if(_0xc8271b>=_0x543523){_0xc8271b=_0x543523;_0x53a819=0xc8;}else{_0x53a819=0xce;}_0x239aea[_0x914d('0x1a')](_0x53a819);return _0x239aea[_0x914d('0x21')](_0x914d('0x22'),_0x682a34+'-'+_0xc8271b+'/'+_0x543523)[_0x914d('0x1c')](_0x287474);}return null;};}function patchUpdates(_0x59630c){return function(_0x4ff8a0){try{jsonpatch['apply'](_0x4ff8a0,_0x59630c,!![]);}catch(_0x5c0e34){return BPromise[_0x914d('0x23')](_0x5c0e34);}return _0x4ff8a0['save']();};}function saveUpdates(_0x550cbe,_0x56ff2b){return function(_0x3e65d7){if(_0x3e65d7){return _0x3e65d7[_0x914d('0x24')](_0x550cbe)[_0x914d('0x25')](function(_0x2282e0){return _0x2282e0;});}return null;};}function removeEntity(_0x15e37e,_0xb2b33f){return function(_0x41e798){if(_0x41e798){return _0x41e798[_0x914d('0x26')]()['then'](function(){_0x15e37e[_0x914d('0x1a')](0xcc)[_0x914d('0x1b')]();});}};}function handleEntityNotFound(_0x5257c4,_0x51b820){return function(_0x436a6a){if(!_0x436a6a){_0x5257c4[_0x914d('0x19')](0x194);}return _0x436a6a;};}function handleError(_0x1412a9,_0x5282d0){_0x5282d0=_0x5282d0||0x1f4;return function(_0x3e5aca){logger[_0x914d('0x27')](_0x3e5aca[_0x914d('0x28')]);if(_0x3e5aca[_0x914d('0x29')]){delete _0x3e5aca[_0x914d('0x29')];}_0x1412a9[_0x914d('0x1a')](_0x5282d0)[_0x914d('0x2a')](_0x3e5aca);};}exports[_0x914d('0x2b')]=function(_0x3a81a4,_0x49faa8){var _0x4830cf={},_0x40b940={},_0x22a30e={'count':0x0,'rows':[]};var _0x5e6b6f=_[_0x914d('0x2c')](db[_0x914d('0x2d')]['rawAttributes'],function(_0x25b668){return{'name':_0x25b668[_0x914d('0x2e')],'type':_0x25b668[_0x914d('0x2f')][_0x914d('0x30')]};});_0x40b940[_0x914d('0x31')]=_[_0x914d('0x2c')](_0x5e6b6f,_0x914d('0x29'));_0x40b940[_0x914d('0x32')]=_['keys'](_0x3a81a4[_0x914d('0x32')]);_0x40b940[_0x914d('0x33')]=_[_0x914d('0x34')](_0x40b940[_0x914d('0x31')],_0x40b940['query']);_0x4830cf[_0x914d('0x35')]=_[_0x914d('0x34')](_0x40b940[_0x914d('0x31')],qs[_0x914d('0x36')](_0x3a81a4[_0x914d('0x32')][_0x914d('0x36')]));_0x4830cf[_0x914d('0x35')]=_0x4830cf[_0x914d('0x35')][_0x914d('0x37')]?_0x4830cf['attributes']:_0x40b940[_0x914d('0x31')];if(!_0x3a81a4['query'][_0x914d('0x38')]('nolimit')){_0x4830cf['limit']=qs[_0x914d('0x1f')](_0x3a81a4[_0x914d('0x32')][_0x914d('0x1f')]);_0x4830cf[_0x914d('0x1d')]=qs['offset'](_0x3a81a4['query'][_0x914d('0x1d')]);}_0x4830cf['order']=qs['sort'](_0x3a81a4[_0x914d('0x32')][_0x914d('0x39')]);_0x4830cf[_0x914d('0x3a')]=qs[_0x914d('0x33')](_[_0x914d('0x3b')](_0x3a81a4[_0x914d('0x32')],_0x40b940[_0x914d('0x33')]),_0x5e6b6f);if(_0x3a81a4[_0x914d('0x32')][_0x914d('0x3c')]){_0x4830cf[_0x914d('0x3a')]=_['merge'](_0x4830cf[_0x914d('0x3a')],{'$or':_['map'](_0x5e6b6f,function(_0x58ac29){if(_0x58ac29['type']!==_0x914d('0x3d')){var _0x22becd={};_0x22becd[_0x58ac29[_0x914d('0x29')]]={'$like':'%'+_0x3a81a4[_0x914d('0x32')][_0x914d('0x3c')]+'%'};return _0x22becd;}})});}_0x4830cf=_[_0x914d('0x3e')]({},_0x4830cf,_0x3a81a4[_0x914d('0x3f')]);var _0x3ef706={'where':_0x4830cf[_0x914d('0x3a')]};return db['Migration']['count'](_0x3ef706)['then'](function(_0x4e03a6){_0x22a30e['count']=_0x4e03a6;if(_0x3a81a4[_0x914d('0x32')]['includeAll']){_0x4830cf[_0x914d('0x40')]=[{'all':!![]}];}return db[_0x914d('0x2d')][_0x914d('0x41')](_0x4830cf);})[_0x914d('0x25')](function(_0x44d2f1){_0x22a30e[_0x914d('0x42')]=_0x44d2f1;return _0x22a30e;})['then'](respondWithFilteredResult(_0x49faa8,_0x4830cf))[_0x914d('0x43')](handleError(_0x49faa8,null));}; \ No newline at end of file +var _0x7dc5=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Migration','includeAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy'];(function(_0x581e25,_0x1c5333){var _0x4435bd=function(_0x19ba88){while(--_0x19ba88){_0x581e25['push'](_0x581e25['shift']());}};_0x4435bd(++_0x1c5333);}(_0x7dc5,0xe7));var _0x57dc=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x7dc5[_0x1a21ff];return _0x25afc1;};'use strict';var emlformat=require(_0x57dc('0x0'));var rimraf=require(_0x57dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57dc('0x2'));var rp=require(_0x57dc('0x3'));var moment=require(_0x57dc('0x4'));var BPromise=require(_0x57dc('0x5'));var Mustache=require(_0x57dc('0x6'));var util=require(_0x57dc('0x7'));var path=require(_0x57dc('0x8'));var sox=require(_0x57dc('0x9'));var csv=require(_0x57dc('0xa'));var ejs=require(_0x57dc('0xb'));var fs=require('fs');var fs_extra=require(_0x57dc('0xc'));var _=require(_0x57dc('0xd'));var squel=require(_0x57dc('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57dc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57dc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57dc('0x11'))(_0x57dc('0x12'));var utils=require(_0x57dc('0x13'));var config=require(_0x57dc('0x14'));var licenseUtil=require(_0x57dc('0x15'));var db=require(_0x57dc('0x16'))['db'];function respondWithStatusCode(_0x29c757,_0x1829c6){_0x1829c6=_0x1829c6||0xcc;return function(_0x207b67){if(_0x207b67){return _0x29c757[_0x57dc('0x17')](_0x1829c6);}return _0x29c757['status'](_0x1829c6)[_0x57dc('0x18')]();};}function respondWithResult(_0x4524de,_0x158ec9){_0x158ec9=_0x158ec9||0xc8;return function(_0x582fb2){if(_0x582fb2){return _0x4524de[_0x57dc('0x19')](_0x158ec9)['json'](_0x582fb2);}};}function respondWithFilteredResult(_0x3695eb,_0x1427e2){return function(_0xfe92ac){if(_0xfe92ac){var _0x1aaec9=typeof _0x1427e2[_0x57dc('0x1a')]===_0x57dc('0x1b')&&typeof _0x1427e2['limit']===_0x57dc('0x1b');var _0x1b5007=_0xfe92ac[_0x57dc('0x1c')];var _0x97256f=_0x1aaec9?0x0:_0x1427e2['offset'];var _0x40b1dd=_0x1aaec9?_0xfe92ac[_0x57dc('0x1c')]:_0x1427e2[_0x57dc('0x1a')]+_0x1427e2[_0x57dc('0x1d')];var _0x381aef;if(_0x40b1dd>=_0x1b5007){_0x40b1dd=_0x1b5007;_0x381aef=0xc8;}else{_0x381aef=0xce;}_0x3695eb[_0x57dc('0x19')](_0x381aef);return _0x3695eb[_0x57dc('0x1e')]('Content-Range',_0x97256f+'-'+_0x40b1dd+'/'+_0x1b5007)[_0x57dc('0x1f')](_0xfe92ac);}return null;};}function patchUpdates(_0x59ee3e){return function(_0x4c03df){try{jsonpatch[_0x57dc('0x20')](_0x4c03df,_0x59ee3e,!![]);}catch(_0x3fe148){return BPromise[_0x57dc('0x21')](_0x3fe148);}return _0x4c03df[_0x57dc('0x22')]();};}function saveUpdates(_0x5ded82,_0x3ad4d8){return function(_0x442ba9){if(_0x442ba9){return _0x442ba9['update'](_0x5ded82)[_0x57dc('0x23')](function(_0x1b7074){return _0x1b7074;});}return null;};}function removeEntity(_0x3e9e43,_0x444157){return function(_0x397549){if(_0x397549){return _0x397549[_0x57dc('0x24')]()[_0x57dc('0x23')](function(){_0x3e9e43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bf421,_0x509ca2){return function(_0x4d167a){if(!_0x4d167a){_0x4bf421[_0x57dc('0x17')](0x194);}return _0x4d167a;};}function handleError(_0x18ee89,_0x274ed3){_0x274ed3=_0x274ed3||0x1f4;return function(_0x43700a){logger[_0x57dc('0x25')](_0x43700a[_0x57dc('0x26')]);if(_0x43700a[_0x57dc('0x27')]){delete _0x43700a['name'];}_0x18ee89[_0x57dc('0x19')](_0x274ed3)[_0x57dc('0x28')](_0x43700a);};}exports[_0x57dc('0x29')]=function(_0x10c0dd,_0x52dad8){var _0x154013={},_0x19e014={},_0x4d74ba={'count':0x0,'rows':[]};var _0x3299c9=_[_0x57dc('0x2a')](db['Migration'][_0x57dc('0x2b')],function(_0x5910ca){return{'name':_0x5910ca[_0x57dc('0x2c')],'type':_0x5910ca[_0x57dc('0x2d')][_0x57dc('0x2e')]};});_0x19e014[_0x57dc('0x2f')]=_[_0x57dc('0x2a')](_0x3299c9,_0x57dc('0x27'));_0x19e014[_0x57dc('0x30')]=_['keys'](_0x10c0dd[_0x57dc('0x30')]);_0x19e014['filters']=_[_0x57dc('0x31')](_0x19e014[_0x57dc('0x2f')],_0x19e014['query']);_0x154013[_0x57dc('0x32')]=_['intersection'](_0x19e014[_0x57dc('0x2f')],qs['fields'](_0x10c0dd['query'][_0x57dc('0x33')]));_0x154013[_0x57dc('0x32')]=_0x154013[_0x57dc('0x32')][_0x57dc('0x34')]?_0x154013[_0x57dc('0x32')]:_0x19e014[_0x57dc('0x2f')];if(!_0x10c0dd['query'][_0x57dc('0x35')]('nolimit')){_0x154013[_0x57dc('0x1d')]=qs[_0x57dc('0x1d')](_0x10c0dd['query'][_0x57dc('0x1d')]);_0x154013[_0x57dc('0x1a')]=qs[_0x57dc('0x1a')](_0x10c0dd['query'][_0x57dc('0x1a')]);}_0x154013[_0x57dc('0x36')]=qs[_0x57dc('0x37')](_0x10c0dd[_0x57dc('0x30')]['sort']);_0x154013[_0x57dc('0x38')]=qs['filters'](_[_0x57dc('0x39')](_0x10c0dd[_0x57dc('0x30')],_0x19e014[_0x57dc('0x3a')]),_0x3299c9);if(_0x10c0dd[_0x57dc('0x30')][_0x57dc('0x3b')]){_0x154013['where']=_[_0x57dc('0x3c')](_0x154013[_0x57dc('0x38')],{'$or':_[_0x57dc('0x2a')](_0x3299c9,function(_0x388bc0){if(_0x388bc0[_0x57dc('0x2d')]!==_0x57dc('0x3d')){var _0x1d2197={};_0x1d2197[_0x388bc0['name']]={'$like':'%'+_0x10c0dd[_0x57dc('0x30')]['filter']+'%'};return _0x1d2197;}})});}_0x154013=_[_0x57dc('0x3c')]({},_0x154013,_0x10c0dd[_0x57dc('0x3e')]);var _0x18fc47={'where':_0x154013[_0x57dc('0x38')]};return db[_0x57dc('0x3f')][_0x57dc('0x1c')](_0x18fc47)[_0x57dc('0x23')](function(_0x3f1aa8){_0x4d74ba[_0x57dc('0x1c')]=_0x3f1aa8;if(_0x10c0dd[_0x57dc('0x30')][_0x57dc('0x40')]){_0x154013['include']=[{'all':!![]}];}return db[_0x57dc('0x3f')]['findAll'](_0x154013);})[_0x57dc('0x23')](function(_0x2eeb92){_0x4d74ba[_0x57dc('0x41')]=_0x2eeb92;return _0x4d74ba;})[_0x57dc('0x23')](respondWithFilteredResult(_0x52dad8,_0x154013))[_0x57dc('0x42')](handleError(_0x52dad8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 684d8c0..772367a 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 _0x497b=['rimraf','../../config/environment','./migration.attributes','define','Migration','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x7b63cf,_0x1c1f4e){var _0x5f3751=function(_0x4db56a){while(--_0x4db56a){_0x7b63cf['push'](_0x7b63cf['shift']());}};_0x5f3751(++_0x1c1f4e);}(_0x497b,0x185));var _0xb497=function(_0x2b4137,_0x2626e8){_0x2b4137=_0x2b4137-0x0;var _0x262d9a=_0x497b[_0x2b4137];return _0x262d9a;};'use strict';var _=require(_0xb497('0x0'));var util=require(_0xb497('0x1'));var logger=require('../../config/logger')(_0xb497('0x2'));var moment=require(_0xb497('0x3'));var BPromise=require(_0xb497('0x4'));var rp=require(_0xb497('0x5'));var fs=require('fs');var path=require(_0xb497('0x6'));var rimraf=require(_0xb497('0x7'));var config=require(_0xb497('0x8'));var attributes=require(_0xb497('0x9'));module['exports']=function(_0x3db6f7,_0x194c5d){return _0x3db6f7[_0xb497('0xa')](_0xb497('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb057=['rimraf','./migration.attributes','exports','define','Migration','../../config/logger','api','moment','bluebird','path'];(function(_0x256455,_0x386945){var _0x4b3825=function(_0x1699ea){while(--_0x1699ea){_0x256455['push'](_0x256455['shift']());}};_0x4b3825(++_0x386945);}(_0xb057,0x1e5));var _0x7b05=function(_0x23267c,_0x552594){_0x23267c=_0x23267c-0x0;var _0x43dfac=_0xb057[_0x23267c];return _0x43dfac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b05('0x0'))(_0x7b05('0x1'));var moment=require(_0x7b05('0x2'));var BPromise=require(_0x7b05('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b05('0x4'));var rimraf=require(_0x7b05('0x5'));var config=require('../../config/environment');var attributes=require(_0x7b05('0x6'));module[_0x7b05('0x7')]=function(_0x351617,_0x20b9ec){return _0x351617[_0x7b05('0x8')](_0x7b05('0x9'),attributes,{'tableName':'migrations','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 7b848c8..89ee539 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 _0x6c4b=['../../config/logger','rpc','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6c4b,0x93));var _0xb6c4=function(_0x273be5,_0x4fe892){_0x273be5=_0x273be5-0x0;var _0x29a5be=_0x6c4b[_0x273be5];return _0x29a5be;};'use strict';var _=require(_0xb6c4('0x0'));var util=require(_0xb6c4('0x1'));var moment=require(_0xb6c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb6c4('0x3'));var fs=require('fs');var Redis=require(_0xb6c4('0x4'));var db=require(_0xb6c4('0x5'))['db'];var utils=require(_0xb6c4('0x6'));var logger=require(_0xb6c4('0x7'))(_0xb6c4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb6c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109973,_0x38b222,_0x554935){return new BPromise(function(_0x312141,_0x19c12a){return client[_0xb6c4('0xa')](_0x109973,_0x554935)[_0xb6c4('0xb')](function(_0x131e11){logger[_0xb6c4('0xc')](_0xb6c4('0xd'),_0x38b222,'request\x20sent');logger[_0xb6c4('0xe')](_0xb6c4('0xf'),_0x38b222,_0xb6c4('0x10'),JSON[_0xb6c4('0x11')](_0x131e11));if(_0x131e11['error']){if(_0x131e11[_0xb6c4('0x12')][_0xb6c4('0x13')]===0x1f4){logger[_0xb6c4('0x12')](_0xb6c4('0xd'),_0x38b222,_0x131e11[_0xb6c4('0x12')][_0xb6c4('0x14')]);return _0x19c12a(_0x131e11[_0xb6c4('0x12')][_0xb6c4('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x38b222,_0x131e11[_0xb6c4('0x12')]['message']);return _0x312141(_0x131e11[_0xb6c4('0x12')][_0xb6c4('0x14')]);}else{logger[_0xb6c4('0xc')]('Migration,\x20%s,\x20%s',_0x38b222,_0xb6c4('0x10'));_0x312141(_0x131e11[_0xb6c4('0x15')][_0xb6c4('0x14')]);}})['catch'](function(_0x417e00){logger[_0xb6c4('0x12')](_0xb6c4('0xd'),_0x38b222,_0x417e00);_0x19c12a(_0x417e00);});});} \ No newline at end of file +var _0x69af=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x69af,0x17b));var _0xf69a=function(_0x5704ca,_0x38d30e){_0x5704ca=_0x5704ca-0x0;var _0x37edf3=_0x69af[_0x5704ca];return _0x37edf3;};'use strict';var _=require('lodash');var util=require(_0xf69a('0x0'));var moment=require(_0xf69a('0x1'));var BPromise=require(_0xf69a('0x2'));var rs=require(_0xf69a('0x3'));var fs=require('fs');var Redis=require(_0xf69a('0x4'));var db=require(_0xf69a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf69a('0x6'))(_0xf69a('0x7'));var config=require(_0xf69a('0x8'));var jayson=require(_0xf69a('0x9'));var client=jayson[_0xf69a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c1b0,_0x3669ef,_0xb0233d){return new BPromise(function(_0x4ffe11,_0x4a3496){return client[_0xf69a('0xb')](_0x10c1b0,_0xb0233d)[_0xf69a('0xc')](function(_0x16a06e){logger[_0xf69a('0xd')](_0xf69a('0xe'),_0x3669ef,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x3669ef,_0xf69a('0xf'),JSON[_0xf69a('0x10')](_0x16a06e));if(_0x16a06e[_0xf69a('0x11')]){if(_0x16a06e[_0xf69a('0x11')]['code']===0x1f4){logger[_0xf69a('0x11')](_0xf69a('0xe'),_0x3669ef,_0x16a06e[_0xf69a('0x11')][_0xf69a('0x12')]);return _0x4a3496(_0x16a06e[_0xf69a('0x11')][_0xf69a('0x12')]);}logger[_0xf69a('0x11')](_0xf69a('0xe'),_0x3669ef,_0x16a06e[_0xf69a('0x11')][_0xf69a('0x12')]);return _0x4ffe11(_0x16a06e['error'][_0xf69a('0x12')]);}else{logger[_0xf69a('0xd')](_0xf69a('0xe'),_0x3669ef,_0xf69a('0xf'));_0x4ffe11(_0x16a06e['result'][_0xf69a('0x12')]);}})[_0xf69a('0x13')](function(_0x17660b){logger[_0xf69a('0x11')](_0xf69a('0xe'),_0x3669ef,_0x17660b);_0x4a3496(_0x17660b);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 3f4efcc..3156d70 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 _0x0a2e=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xef5b7e,_0x3a9cbf){var _0x14cf79=function(_0x32d700){while(--_0x32d700){_0xef5b7e['push'](_0xef5b7e['shift']());}};_0x14cf79(++_0x3a9cbf);}(_0x0a2e,0xe1));var _0xe0a2=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x0a2e[_0x4d67b8];return _0x55af3b;};'use strict';var multer=require(_0xe0a2('0x0'));var util=require(_0xe0a2('0x1'));var path=require(_0xe0a2('0x2'));var timeout=require(_0xe0a2('0x3'));var express=require('express');var router=express[_0xe0a2('0x4')]();var fs_extra=require(_0xe0a2('0x5'));var auth=require(_0xe0a2('0x6'));var interaction=require(_0xe0a2('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xe0a2('0x8')]('/',auth[_0xe0a2('0x9')](),controller[_0xe0a2('0xa')]);router[_0xe0a2('0x8')](_0xe0a2('0xb'),auth[_0xe0a2('0x9')](),controller[_0xe0a2('0xc')]);router[_0xe0a2('0xd')]('/',auth[_0xe0a2('0x9')](),controller[_0xe0a2('0xe')]);router[_0xe0a2('0xf')](_0xe0a2('0xb'),auth[_0xe0a2('0x9')](),controller[_0xe0a2('0x10')]);router[_0xe0a2('0x11')](_0xe0a2('0xb'),auth[_0xe0a2('0x9')](),controller[_0xe0a2('0x12')]);module[_0xe0a2('0x13')]=router; \ No newline at end of file +var _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x1261,0x144));var _0x1126=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0x1261[_0x5448a9];return _0x1924af;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0xf')]);router['put'](_0x1126('0x10'),auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router['delete'](_0x1126('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1126('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d6aac57..d366bbf 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 _0xab85=['exports','ENUM','externip','stun','turn','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab85,0xdf));var _0x5ab8=function(_0x265bf9,_0x4169fa){_0x265bf9=_0x265bf9-0x0;var _0x27e489=_0xab85[_0x265bf9];return _0x27e489;};'use strict';var Sequelize=require(_0x5ab8('0x0'));module[_0x5ab8('0x1')]={'type':{'type':Sequelize[_0x5ab8('0x2')]('localnet',_0x5ab8('0x3'),_0x5ab8('0x4'),_0x5ab8('0x5'))},'value':{'type':Sequelize[_0x5ab8('0x6')]},'username':{'type':Sequelize[_0x5ab8('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e3c=['ENUM','localnet','stun','turn','STRING','exports'];(function(_0x4df78b,_0xd7466c){var _0x5abffe=function(_0x3d353d){while(--_0x3d353d){_0x4df78b['push'](_0x4df78b['shift']());}};_0x5abffe(++_0xd7466c);}(_0x4e3c,0x1e5));var _0xc4e3=function(_0xb42da0,_0x5e98b4){_0xb42da0=_0xb42da0-0x0;var _0x4036c7=_0x4e3c[_0xb42da0];return _0x4036c7;};'use strict';var Sequelize=require('sequelize');module[_0xc4e3('0x0')]={'type':{'type':Sequelize[_0xc4e3('0x1')](_0xc4e3('0x2'),'externip',_0xc4e3('0x3'),_0xc4e3('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc4e3('0x5')]},'password':{'type':Sequelize[_0xc4e3('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8a3b4c6..4bb8ef0 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 _0x816a=['sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','/etc/asterisk/stun_xcally.conf','server/files/templates/network.ejs','chan_sip.so','destroy','util','ejs','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','code','error','message','result','status','json','offset','undefined','count','set','Content-Range','end','sendStatus','name','map','Network','rawAttributes','type','key','query','keys','intersection','attributes','length','model','nolimit','limit','order'];(function(_0x10871b,_0x12e6cc){var _0x25ded0=function(_0x4ee1bc){while(--_0x4ee1bc){_0x10871b['push'](_0x10871b['shift']());}};_0x25ded0(++_0x12e6cc);}(_0x816a,0x1cd));var _0xa816=function(_0x3bd8d9,_0x5f3d62){_0x3bd8d9=_0x3bd8d9-0x0;var _0x554339=_0x816a[_0x3bd8d9];return _0x554339;};'use strict';var util=require(_0xa816('0x0'));var path=require('path');var ejs=require(_0xa816('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0xa816('0x2'));var logger=require(_0xa816('0x3'))(_0xa816('0x4'));var config=require('../../config/environment');var db=require(_0xa816('0x5'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa816('0x6')][_0xa816('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28680d,_0x40d314,_0x3fcf18,_0x2b7a52){return new Promise(function(_0x267ab2,_0x414f98){var _0x5c7476=_0x2b7a52||client;return _0x5c7476[_0xa816('0x8')](_0x28680d,_0x3fcf18)[_0xa816('0x9')](function(_0x453fdc){logger[_0xa816('0xa')](_0xa816('0xb'),_0x40d314,_0xa816('0xc'));logger[_0xa816('0xd')](_0xa816('0xe'),_0x40d314,_0xa816('0xc'),JSON['stringify'](_0x453fdc));if(_0x453fdc['error']){if(_0x453fdc['error'][_0xa816('0xf')]===0x1f4){logger[_0xa816('0x10')](_0xa816('0xb'),_0x40d314,_0x453fdc[_0xa816('0x10')][_0xa816('0x11')]);return _0x414f98(_0x453fdc[_0xa816('0x10')][_0xa816('0x11')]);}logger[_0xa816('0x10')](_0xa816('0xb'),_0x40d314,_0x453fdc[_0xa816('0x10')][_0xa816('0x11')]);return _0x267ab2(_0x453fdc[_0xa816('0x10')]['message']);}else{logger[_0xa816('0xa')](_0xa816('0xb'),_0x40d314,_0xa816('0xc'));_0x267ab2(_0x453fdc[_0xa816('0x12')]['message']);}})['catch'](function(_0x3838a0){logger['error'](_0xa816('0xb'),_0x40d314,_0x3838a0);_0x414f98(_0x3838a0);});});}function respondWithResult(_0x30e6e7,_0x447dcf){_0x447dcf=_0x447dcf||0xc8;return function(_0x20d9ba){if(_0x20d9ba){return _0x30e6e7[_0xa816('0x13')](_0x447dcf)[_0xa816('0x14')](_0x20d9ba);}};}function respondWithFilteredResult(_0x4aa183,_0xd8c132){return function(_0x36e603){if(_0x36e603){var _0x3292ff=typeof _0xd8c132[_0xa816('0x15')]===_0xa816('0x16')&&typeof _0xd8c132['limit']===_0xa816('0x16');var _0x4c5c8a=_0x36e603[_0xa816('0x17')];var _0x3ad7e8=_0x3292ff?0x0:_0xd8c132[_0xa816('0x15')];var _0x4d4ccb=_0x3292ff?_0x36e603[_0xa816('0x17')]:_0xd8c132['offset']+_0xd8c132['limit'];var _0xf16d3d;if(_0x4d4ccb>=_0x4c5c8a){_0x4d4ccb=_0x4c5c8a;_0xf16d3d=0xc8;}else{_0xf16d3d=0xce;}_0x4aa183[_0xa816('0x13')](_0xf16d3d);return _0x4aa183[_0xa816('0x18')](_0xa816('0x19'),_0x3ad7e8+'-'+_0x4d4ccb+'/'+_0x4c5c8a)[_0xa816('0x14')](_0x36e603);}return null;};}function saveUpdates(_0x246fbe){return function(_0x5d1e03){if(_0x5d1e03){return _0x5d1e03['update'](_0x246fbe)[_0xa816('0x9')](function(_0x11ed89){return _0x11ed89;});}return null;};}function removeEntity(_0x45125){return function(_0xc38da7){if(_0xc38da7){return _0xc38da7['destroy']()[_0xa816('0x9')](function(){_0x45125[_0xa816('0x13')](0xcc)[_0xa816('0x1a')]();});}};}function handleEntityNotFound(_0x2aeb48){return function(_0x46eeb6){if(!_0x46eeb6){_0x2aeb48[_0xa816('0x1b')](0x194);}return _0x46eeb6;};}function handleError(_0x41bb6b,_0x7e1b45){_0x7e1b45=_0x7e1b45||0x1f4;return function(_0x526d9a){logger[_0xa816('0x10')](_0x526d9a['stack']);if(_0x526d9a[_0xa816('0x1c')]){delete _0x526d9a['name'];}_0x41bb6b['status'](_0x7e1b45)['send'](_0x526d9a);};}exports['index']=function(_0x361247,_0xf2701){var _0x9fec11={},_0x129eda={},_0x5c8b7f={'count':0x0,'rows':[]};var _0x5ceb01=_[_0xa816('0x1d')](db[_0xa816('0x1e')][_0xa816('0x1f')],function(_0xc3533e){return{'name':_0xc3533e['fieldName'],'type':_0xc3533e[_0xa816('0x20')][_0xa816('0x21')]};});_0x129eda['model']=_[_0xa816('0x1d')](_0x5ceb01,'name');_0x129eda[_0xa816('0x22')]=_[_0xa816('0x23')](_0x361247['query']);_0x129eda['filters']=_[_0xa816('0x24')](_0x129eda['model'],_0x129eda['query']);_0x9fec11[_0xa816('0x25')]=_[_0xa816('0x24')](_0x129eda['model'],qs['fields'](_0x361247[_0xa816('0x22')]['fields']));_0x9fec11[_0xa816('0x25')]=_0x9fec11[_0xa816('0x25')][_0xa816('0x26')]?_0x9fec11['attributes']:_0x129eda[_0xa816('0x27')];if(!_0x361247[_0xa816('0x22')]['hasOwnProperty'](_0xa816('0x28'))){_0x9fec11[_0xa816('0x29')]=qs[_0xa816('0x29')](_0x361247[_0xa816('0x22')]['limit']);_0x9fec11['offset']=qs['offset'](_0x361247[_0xa816('0x22')]['offset']);}_0x9fec11[_0xa816('0x2a')]=qs[_0xa816('0x2b')](_0x361247[_0xa816('0x22')][_0xa816('0x2b')]);_0x9fec11['where']=qs[_0xa816('0x2c')](_[_0xa816('0x2d')](_0x361247['query'],_0x129eda['filters']),_0x5ceb01);if(_0x361247[_0xa816('0x22')][_0xa816('0x2e')]){_0x9fec11['where']=_[_0xa816('0x2f')](_0x9fec11[_0xa816('0x30')],{'$or':_['map'](_0x5ceb01,function(_0x1c9bde){if(_0x1c9bde[_0xa816('0x20')]!==_0xa816('0x31')){var _0x456b99={};_0x456b99[_0x1c9bde['name']]={'$like':'%'+_0x361247[_0xa816('0x22')]['filter']+'%'};return _0x456b99;}})});}_0x9fec11=_[_0xa816('0x2f')]({},_0x9fec11,_0x361247[_0xa816('0x32')]);var _0x38eb82={'where':_0x9fec11[_0xa816('0x30')]};return db[_0xa816('0x1e')][_0xa816('0x17')](_0x38eb82)['then'](function(_0x1eddce){_0x5c8b7f[_0xa816('0x17')]=_0x1eddce;if(_0x361247[_0xa816('0x22')][_0xa816('0x33')]){_0x9fec11[_0xa816('0x34')]=[{'all':!![]}];}return db['Network'][_0xa816('0x35')](_0x9fec11);})['then'](function(_0x21533a){_0x5c8b7f[_0xa816('0x36')]=_0x21533a;return _0x5c8b7f;})[_0xa816('0x9')](respondWithFilteredResult(_0xf2701,_0x9fec11))['catch'](handleError(_0xf2701,null));};exports[_0xa816('0x37')]=function(_0x25a1e6,_0x1fb075){var _0x1e51f6={'raw':!![],'where':{'id':_0x25a1e6[_0xa816('0x38')]['id']}},_0x3aa3c3={};_0x3aa3c3[_0xa816('0x27')]=_[_0xa816('0x23')](db[_0xa816('0x1e')][_0xa816('0x1f')]);_0x3aa3c3[_0xa816('0x22')]=_[_0xa816('0x23')](_0x25a1e6['query']);_0x3aa3c3[_0xa816('0x2c')]=_[_0xa816('0x24')](_0x3aa3c3[_0xa816('0x27')],_0x3aa3c3['query']);_0x1e51f6[_0xa816('0x25')]=_[_0xa816('0x24')](_0x3aa3c3[_0xa816('0x27')],qs[_0xa816('0x39')](_0x25a1e6[_0xa816('0x22')]['fields']));_0x1e51f6[_0xa816('0x25')]=_0x1e51f6[_0xa816('0x25')][_0xa816('0x26')]?_0x1e51f6['attributes']:_0x3aa3c3[_0xa816('0x27')];if(_0x25a1e6[_0xa816('0x22')][_0xa816('0x33')]){_0x1e51f6[_0xa816('0x34')]=[{'all':!![]}];}_0x1e51f6=_[_0xa816('0x2f')]({},_0x1e51f6,_0x25a1e6['options']);return db[_0xa816('0x1e')][_0xa816('0x3a')](_0x1e51f6)['then'](handleEntityNotFound(_0x1fb075,null))[_0xa816('0x9')](respondWithResult(_0x1fb075,null))[_0xa816('0x3b')](handleError(_0x1fb075,null));};exports['create']=function(_0x17f2d8,_0x8cf505){var _0x164609;return db[_0xa816('0x1e')][_0xa816('0x3c')](_0x17f2d8['body'],{'raw':!![]})[_0xa816('0x9')](function(_0x56e874){_0x164609=_0x56e874;return db[_0xa816('0x1e')][_0xa816('0x35')]({'where':{'type':_0x17f2d8[_0xa816('0x3d')][_0xa816('0x20')]},'raw':!![]});})['then'](function(_0x2d7e9c){if(_0x164609[_0xa816('0x20')][_0xa816('0x3e')]()==_0xa816('0x3f')){var _0x371af9=fs['readFileSync'](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x42')),_0xa816('0x43'));var _0x4f0780=ejs['render'](_0x371af9,{'networks':_0x2d7e9c||[]});fs[_0xa816('0x44')]('/etc/asterisk/stun_xcally.conf',_0x4f0780);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x3c'),{'module':_0xa816('0x46')});}else if(_0x164609[_0xa816('0x20')][_0xa816('0x3e')]()==_0xa816('0x47')){var _0x4024be=fs['readFileSync'](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x48')),_0xa816('0x43'));var _0x14def7=ejs[_0xa816('0x49')](_0x4024be,{'networks':_0x2d7e9c||[]});fs['writeFileSync'](_0xa816('0x4a'),_0x14def7);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x3c'),{'module':_0xa816('0x46')});}else{var _0x12f351=fs[_0xa816('0x4b')](path['join'](config[_0xa816('0x41')],'server/files/templates/network.ejs'),'utf8');var _0x4b2068=ejs[_0xa816('0x49')](_0x12f351,{'networks':_0x2d7e9c||[]});fs['writeFileSync'](util[_0xa816('0x4c')](_0xa816('0x4d'),_0x17f2d8['body'][_0xa816('0x20')][_0xa816('0x4e')]()),_0x4b2068);return respondWithRpcPromise(_0xa816('0x45'),'create',{'module':'chan_sip.so'});}})[_0xa816('0x9')](function(){return _0x164609;})[_0xa816('0x9')](respondWithResult(_0x8cf505,0xc9))[_0xa816('0x3b')](handleError(_0x8cf505,null));};exports[_0xa816('0x4f')]=function(_0xdf79a3,_0x8e8024){var _0x2e4ff4;return db[_0xa816('0x1e')][_0xa816('0x3a')]({'where':{'id':_0xdf79a3[_0xa816('0x38')]['id']}})[_0xa816('0x9')](handleEntityNotFound(_0x8e8024,null))[_0xa816('0x9')](saveUpdates(_0xdf79a3[_0xa816('0x3d')],null))['then'](function(_0x5a8b66){if(_0x5a8b66){_0x2e4ff4=_0x5a8b66;return db['Network'][_0xa816('0x35')]({'where':{'type':_0x2e4ff4[_0xa816('0x20')]},'raw':!![]});}return null;})[_0xa816('0x9')](function(_0xda6bd5){if(_0x2e4ff4['type']['toUpperCase']()==_0xa816('0x3f')){var _0x13acaf=fs[_0xa816('0x4b')](path[_0xa816('0x40')](config[_0xa816('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x598656=ejs[_0xa816('0x49')](_0x13acaf,{'networks':_0xda6bd5||[]});fs['writeFileSync'](_0xa816('0x50'),_0x598656);return respondWithRpcPromise(_0xa816('0x45'),'update',{'module':_0xa816('0x46')});}else if(_0x2e4ff4[_0xa816('0x20')][_0xa816('0x3e')]()==_0xa816('0x47')){var _0x5c9dff=fs['readFileSync'](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x48')),'utf8');var _0x1e5817=ejs['render'](_0x5c9dff,{'networks':_0xda6bd5||[]});fs[_0xa816('0x44')](_0xa816('0x4a'),_0x1e5817);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x4f'),{'module':_0xa816('0x46')});}else{var _0x401194=fs['readFileSync'](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x51')),_0xa816('0x43'));var _0x2c07be=ejs[_0xa816('0x49')](_0x401194,{'networks':_0xda6bd5||[]});fs[_0xa816('0x44')](util[_0xa816('0x4c')](_0xa816('0x4d'),_0xdf79a3[_0xa816('0x3d')][_0xa816('0x20')][_0xa816('0x4e')]()),_0x2c07be);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x4f'),{'module':_0xa816('0x52')});}})['then'](function(_0x117ff1){if(_0x117ff1){return _0x2e4ff4;}return null;})[_0xa816('0x9')](respondWithResult(_0x8e8024,null))[_0xa816('0x3b')](handleError(_0x8e8024,null));};exports[_0xa816('0x53')]=function(_0x5e141f,_0x274a5a){var _0xbba093;return db[_0xa816('0x1e')][_0xa816('0x3a')]({'where':{'id':_0x5e141f[_0xa816('0x38')]['id']}})[_0xa816('0x9')](function(_0x5de17b){_0xbba093=_0x5de17b;return _0x5de17b;})[_0xa816('0x9')](handleEntityNotFound(_0x274a5a,null))['then'](removeEntity(_0x274a5a,null))[_0xa816('0x9')](function(){if(_0xbba093){return db[_0xa816('0x1e')][_0xa816('0x35')]({'where':{'type':_0xbba093[_0xa816('0x20')]},'raw':!![]});}})['then'](function(_0x33506b){if(_0xbba093[_0xa816('0x20')]['toUpperCase']()=='STUN'){var _0x33f962=fs[_0xa816('0x4b')](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x42')),_0xa816('0x43'));var _0x244fc8=ejs[_0xa816('0x49')](_0x33f962,{'networks':_0x33506b||[]});fs[_0xa816('0x44')](_0xa816('0x50'),_0x244fc8);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x53'),{'module':_0xa816('0x46')});}else if(_0xbba093['type'][_0xa816('0x3e')]()==_0xa816('0x47')){var _0x2e9fbf=fs['readFileSync'](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x48')),_0xa816('0x43'));var _0x2a3b21=ejs['render'](_0x2e9fbf,{'networks':_0x33506b||[]});fs['writeFileSync'](_0xa816('0x4a'),_0x2a3b21);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x53'),{'module':_0xa816('0x46')});}else{var _0x18dbb=fs[_0xa816('0x4b')](path[_0xa816('0x40')](config[_0xa816('0x41')],_0xa816('0x51')),'utf8');var _0x453b96=ejs[_0xa816('0x49')](_0x18dbb,{'networks':_0x33506b||[]});fs[_0xa816('0x44')](util[_0xa816('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0xbba093['type'][_0xa816('0x4e')]()),_0x453b96);return respondWithRpcPromise(_0xa816('0x45'),_0xa816('0x53'),{'module':_0xa816('0x52')});}})['catch'](handleError(_0x274a5a,null));}; \ No newline at end of file +var _0xf920=['rows','show','keys','rawAttributes','include','create','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','find','params','STUN','TURN','path','ejs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','json','offset','limit','undefined','count','status','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','fieldName','type','model','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xf920,0x1b7));var _0x0f92=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0xf920[_0x3cf387];return _0x24425f;};'use strict';var util=require('util');var path=require(_0x0f92('0x0'));var ejs=require(_0x0f92('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x0f92('0x2'))(_0x0f92('0x3'));var config=require(_0x0f92('0x4'));var db=require(_0x0f92('0x5'))['db'];var jayson=require(_0x0f92('0x6'));var client=jayson['client'][_0x0f92('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bb1ef,_0xb2a923,_0x5ef23c,_0x5cdc5d){return new Promise(function(_0x54ebe9,_0x2d1978){var _0x54b9b5=_0x5cdc5d||client;return _0x54b9b5[_0x0f92('0x8')](_0x1bb1ef,_0x5ef23c)[_0x0f92('0x9')](function(_0x1f0f50){logger['info'](_0x0f92('0xa'),_0xb2a923,_0x0f92('0xb'));logger[_0x0f92('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0xb2a923,_0x0f92('0xb'),JSON[_0x0f92('0xd')](_0x1f0f50));if(_0x1f0f50[_0x0f92('0xe')]){if(_0x1f0f50[_0x0f92('0xe')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0xb2a923,_0x1f0f50[_0x0f92('0xe')][_0x0f92('0xf')]);return _0x2d1978(_0x1f0f50[_0x0f92('0xe')][_0x0f92('0xf')]);}logger[_0x0f92('0xe')](_0x0f92('0xa'),_0xb2a923,_0x1f0f50['error'][_0x0f92('0xf')]);return _0x54ebe9(_0x1f0f50[_0x0f92('0xe')][_0x0f92('0xf')]);}else{logger['info'](_0x0f92('0xa'),_0xb2a923,_0x0f92('0xb'));_0x54ebe9(_0x1f0f50[_0x0f92('0x10')][_0x0f92('0xf')]);}})[_0x0f92('0x11')](function(_0xc06e5c){logger[_0x0f92('0xe')](_0x0f92('0xa'),_0xb2a923,_0xc06e5c);_0x2d1978(_0xc06e5c);});});}function respondWithResult(_0x22b1ad,_0x20ff92){_0x20ff92=_0x20ff92||0xc8;return function(_0x4e23d6){if(_0x4e23d6){return _0x22b1ad['status'](_0x20ff92)[_0x0f92('0x12')](_0x4e23d6);}};}function respondWithFilteredResult(_0x203590,_0x25c8e5){return function(_0x126d06){if(_0x126d06){var _0x59e754=typeof _0x25c8e5[_0x0f92('0x13')]==='undefined'&&typeof _0x25c8e5[_0x0f92('0x14')]===_0x0f92('0x15');var _0x5d82e9=_0x126d06[_0x0f92('0x16')];var _0xedcce1=_0x59e754?0x0:_0x25c8e5['offset'];var _0x579596=_0x59e754?_0x126d06['count']:_0x25c8e5[_0x0f92('0x13')]+_0x25c8e5['limit'];var _0x4d4134;if(_0x579596>=_0x5d82e9){_0x579596=_0x5d82e9;_0x4d4134=0xc8;}else{_0x4d4134=0xce;}_0x203590[_0x0f92('0x17')](_0x4d4134);return _0x203590['set'](_0x0f92('0x18'),_0xedcce1+'-'+_0x579596+'/'+_0x5d82e9)[_0x0f92('0x12')](_0x126d06);}return null;};}function saveUpdates(_0x2e5a93){return function(_0x32825b){if(_0x32825b){return _0x32825b[_0x0f92('0x19')](_0x2e5a93)[_0x0f92('0x9')](function(_0x4ca221){return _0x4ca221;});}return null;};}function removeEntity(_0xa58d3e){return function(_0x31623a){if(_0x31623a){return _0x31623a[_0x0f92('0x1a')]()['then'](function(){_0xa58d3e[_0x0f92('0x17')](0xcc)[_0x0f92('0x1b')]();});}};}function handleEntityNotFound(_0x2f771f){return function(_0x3789e0){if(!_0x3789e0){_0x2f771f[_0x0f92('0x1c')](0x194);}return _0x3789e0;};}function handleError(_0x14adae,_0x562afd){_0x562afd=_0x562afd||0x1f4;return function(_0xd086f3){logger['error'](_0xd086f3[_0x0f92('0x1d')]);if(_0xd086f3[_0x0f92('0x1e')]){delete _0xd086f3[_0x0f92('0x1e')];}_0x14adae['status'](_0x562afd)[_0x0f92('0x1f')](_0xd086f3);};}exports[_0x0f92('0x20')]=function(_0x1bf7f4,_0x4ea808){var _0x4361b1={},_0x4d4ccd={},_0x3b8f31={'count':0x0,'rows':[]};var _0x5896c5=_[_0x0f92('0x21')](db[_0x0f92('0x22')]['rawAttributes'],function(_0xf30360){return{'name':_0xf30360[_0x0f92('0x23')],'type':_0xf30360[_0x0f92('0x24')]['key']};});_0x4d4ccd[_0x0f92('0x25')]=_[_0x0f92('0x21')](_0x5896c5,_0x0f92('0x1e'));_0x4d4ccd[_0x0f92('0x26')]=_['keys'](_0x1bf7f4[_0x0f92('0x26')]);_0x4d4ccd[_0x0f92('0x27')]=_['intersection'](_0x4d4ccd[_0x0f92('0x25')],_0x4d4ccd[_0x0f92('0x26')]);_0x4361b1['attributes']=_[_0x0f92('0x28')](_0x4d4ccd['model'],qs[_0x0f92('0x29')](_0x1bf7f4[_0x0f92('0x26')]['fields']));_0x4361b1[_0x0f92('0x2a')]=_0x4361b1[_0x0f92('0x2a')][_0x0f92('0x2b')]?_0x4361b1['attributes']:_0x4d4ccd[_0x0f92('0x25')];if(!_0x1bf7f4[_0x0f92('0x26')]['hasOwnProperty']('nolimit')){_0x4361b1[_0x0f92('0x14')]=qs[_0x0f92('0x14')](_0x1bf7f4['query']['limit']);_0x4361b1[_0x0f92('0x13')]=qs[_0x0f92('0x13')](_0x1bf7f4[_0x0f92('0x26')][_0x0f92('0x13')]);}_0x4361b1[_0x0f92('0x2c')]=qs['sort'](_0x1bf7f4['query'][_0x0f92('0x2d')]);_0x4361b1['where']=qs[_0x0f92('0x27')](_[_0x0f92('0x2e')](_0x1bf7f4[_0x0f92('0x26')],_0x4d4ccd[_0x0f92('0x27')]),_0x5896c5);if(_0x1bf7f4[_0x0f92('0x26')][_0x0f92('0x2f')]){_0x4361b1[_0x0f92('0x30')]=_[_0x0f92('0x31')](_0x4361b1[_0x0f92('0x30')],{'$or':_[_0x0f92('0x21')](_0x5896c5,function(_0x12e40f){if(_0x12e40f[_0x0f92('0x24')]!==_0x0f92('0x32')){var _0xa16bb2={};_0xa16bb2[_0x12e40f[_0x0f92('0x1e')]]={'$like':'%'+_0x1bf7f4[_0x0f92('0x26')][_0x0f92('0x2f')]+'%'};return _0xa16bb2;}})});}_0x4361b1=_[_0x0f92('0x31')]({},_0x4361b1,_0x1bf7f4[_0x0f92('0x33')]);var _0x20b489={'where':_0x4361b1[_0x0f92('0x30')]};return db[_0x0f92('0x22')][_0x0f92('0x16')](_0x20b489)[_0x0f92('0x9')](function(_0x16ce38){_0x3b8f31[_0x0f92('0x16')]=_0x16ce38;if(_0x1bf7f4['query']['includeAll']){_0x4361b1['include']=[{'all':!![]}];}return db['Network'][_0x0f92('0x34')](_0x4361b1);})['then'](function(_0x198e04){_0x3b8f31[_0x0f92('0x35')]=_0x198e04;return _0x3b8f31;})[_0x0f92('0x9')](respondWithFilteredResult(_0x4ea808,_0x4361b1))[_0x0f92('0x11')](handleError(_0x4ea808,null));};exports[_0x0f92('0x36')]=function(_0x17cc0c,_0x21d0da){var _0x19ac55={'raw':!![],'where':{'id':_0x17cc0c['params']['id']}},_0x20313d={};_0x20313d[_0x0f92('0x25')]=_[_0x0f92('0x37')](db[_0x0f92('0x22')][_0x0f92('0x38')]);_0x20313d[_0x0f92('0x26')]=_[_0x0f92('0x37')](_0x17cc0c[_0x0f92('0x26')]);_0x20313d[_0x0f92('0x27')]=_[_0x0f92('0x28')](_0x20313d[_0x0f92('0x25')],_0x20313d[_0x0f92('0x26')]);_0x19ac55[_0x0f92('0x2a')]=_[_0x0f92('0x28')](_0x20313d['model'],qs[_0x0f92('0x29')](_0x17cc0c[_0x0f92('0x26')][_0x0f92('0x29')]));_0x19ac55[_0x0f92('0x2a')]=_0x19ac55[_0x0f92('0x2a')][_0x0f92('0x2b')]?_0x19ac55['attributes']:_0x20313d[_0x0f92('0x25')];if(_0x17cc0c[_0x0f92('0x26')]['includeAll']){_0x19ac55[_0x0f92('0x39')]=[{'all':!![]}];}_0x19ac55=_[_0x0f92('0x31')]({},_0x19ac55,_0x17cc0c[_0x0f92('0x33')]);return db['Network']['find'](_0x19ac55)[_0x0f92('0x9')](handleEntityNotFound(_0x21d0da,null))['then'](respondWithResult(_0x21d0da,null))['catch'](handleError(_0x21d0da,null));};exports[_0x0f92('0x3a')]=function(_0x4e55a5,_0x384f9c){var _0x59e202;return db[_0x0f92('0x22')][_0x0f92('0x3a')](_0x4e55a5['body'],{'raw':!![]})[_0x0f92('0x9')](function(_0x55bb1a){_0x59e202=_0x55bb1a;return db[_0x0f92('0x22')][_0x0f92('0x34')]({'where':{'type':_0x4e55a5['body']['type']},'raw':!![]});})['then'](function(_0x48f508){if(_0x59e202[_0x0f92('0x24')]['toUpperCase']()=='STUN'){var _0x3db479=fs[_0x0f92('0x3b')](path[_0x0f92('0x3c')](config['root'],_0x0f92('0x3d')),_0x0f92('0x3e'));var _0x5a281c=ejs[_0x0f92('0x3f')](_0x3db479,{'networks':_0x48f508||[]});fs[_0x0f92('0x40')](_0x0f92('0x41'),_0x5a281c);return respondWithRpcPromise(_0x0f92('0x42'),_0x0f92('0x3a'),{'module':_0x0f92('0x43')});}else if(_0x59e202[_0x0f92('0x24')][_0x0f92('0x44')]()=='TURN'){var _0x20493e=fs['readFileSync'](path[_0x0f92('0x3c')](config[_0x0f92('0x45')],_0x0f92('0x46')),_0x0f92('0x3e'));var _0xaf7c3e=ejs[_0x0f92('0x3f')](_0x20493e,{'networks':_0x48f508||[]});fs[_0x0f92('0x40')](_0x0f92('0x47'),_0xaf7c3e);return respondWithRpcPromise('Reload',_0x0f92('0x3a'),{'module':_0x0f92('0x43')});}else{var _0xd1c3a0=fs['readFileSync'](path[_0x0f92('0x3c')](config['root'],_0x0f92('0x48')),_0x0f92('0x3e'));var _0x443f5c=ejs['render'](_0xd1c3a0,{'networks':_0x48f508||[]});fs['writeFileSync'](util[_0x0f92('0x49')](_0x0f92('0x4a'),_0x4e55a5[_0x0f92('0x4b')]['type'][_0x0f92('0x4c')]()),_0x443f5c);return respondWithRpcPromise(_0x0f92('0x42'),_0x0f92('0x3a'),{'module':_0x0f92('0x4d')});}})[_0x0f92('0x9')](function(){return _0x59e202;})[_0x0f92('0x9')](respondWithResult(_0x384f9c,0xc9))[_0x0f92('0x11')](handleError(_0x384f9c,null));};exports[_0x0f92('0x19')]=function(_0x368ef4,_0x312441){var _0x27ab00;return db[_0x0f92('0x22')][_0x0f92('0x4e')]({'where':{'id':_0x368ef4[_0x0f92('0x4f')]['id']}})[_0x0f92('0x9')](handleEntityNotFound(_0x312441,null))[_0x0f92('0x9')](saveUpdates(_0x368ef4[_0x0f92('0x4b')],null))[_0x0f92('0x9')](function(_0x3e2562){if(_0x3e2562){_0x27ab00=_0x3e2562;return db[_0x0f92('0x22')][_0x0f92('0x34')]({'where':{'type':_0x27ab00[_0x0f92('0x24')]},'raw':!![]});}return null;})['then'](function(_0x5905fc){if(_0x27ab00[_0x0f92('0x24')][_0x0f92('0x44')]()==_0x0f92('0x50')){var _0x40b82b=fs[_0x0f92('0x3b')](path['join'](config[_0x0f92('0x45')],_0x0f92('0x3d')),_0x0f92('0x3e'));var _0x5138fa=ejs[_0x0f92('0x3f')](_0x40b82b,{'networks':_0x5905fc||[]});fs[_0x0f92('0x40')](_0x0f92('0x41'),_0x5138fa);return respondWithRpcPromise(_0x0f92('0x42'),_0x0f92('0x19'),{'module':_0x0f92('0x43')});}else if(_0x27ab00[_0x0f92('0x24')][_0x0f92('0x44')]()=='TURN'){var _0x4b8a49=fs['readFileSync'](path[_0x0f92('0x3c')](config['root'],_0x0f92('0x46')),_0x0f92('0x3e'));var _0xfd5c11=ejs['render'](_0x4b8a49,{'networks':_0x5905fc||[]});fs[_0x0f92('0x40')](_0x0f92('0x47'),_0xfd5c11);return respondWithRpcPromise('Reload',_0x0f92('0x19'),{'module':_0x0f92('0x43')});}else{var _0x4cdb39=fs['readFileSync'](path[_0x0f92('0x3c')](config[_0x0f92('0x45')],_0x0f92('0x48')),_0x0f92('0x3e'));var _0x1390cb=ejs[_0x0f92('0x3f')](_0x4cdb39,{'networks':_0x5905fc||[]});fs[_0x0f92('0x40')](util[_0x0f92('0x49')](_0x0f92('0x4a'),_0x368ef4['body']['type'][_0x0f92('0x4c')]()),_0x1390cb);return respondWithRpcPromise(_0x0f92('0x42'),_0x0f92('0x19'),{'module':_0x0f92('0x4d')});}})['then'](function(_0x14821f){if(_0x14821f){return _0x27ab00;}return null;})['then'](respondWithResult(_0x312441,null))[_0x0f92('0x11')](handleError(_0x312441,null));};exports[_0x0f92('0x1a')]=function(_0x233560,_0x2b58d0){var _0xba0a10;return db[_0x0f92('0x22')]['find']({'where':{'id':_0x233560[_0x0f92('0x4f')]['id']}})[_0x0f92('0x9')](function(_0x4c5b70){_0xba0a10=_0x4c5b70;return _0x4c5b70;})[_0x0f92('0x9')](handleEntityNotFound(_0x2b58d0,null))['then'](removeEntity(_0x2b58d0,null))[_0x0f92('0x9')](function(){if(_0xba0a10){return db[_0x0f92('0x22')][_0x0f92('0x34')]({'where':{'type':_0xba0a10['type']},'raw':!![]});}})[_0x0f92('0x9')](function(_0x573adf){if(_0xba0a10[_0x0f92('0x24')][_0x0f92('0x44')]()==_0x0f92('0x50')){var _0x364024=fs[_0x0f92('0x3b')](path[_0x0f92('0x3c')](config[_0x0f92('0x45')],_0x0f92('0x3d')),_0x0f92('0x3e'));var _0x17a073=ejs['render'](_0x364024,{'networks':_0x573adf||[]});fs[_0x0f92('0x40')](_0x0f92('0x41'),_0x17a073);return respondWithRpcPromise(_0x0f92('0x42'),'destroy',{'module':_0x0f92('0x43')});}else if(_0xba0a10[_0x0f92('0x24')][_0x0f92('0x44')]()==_0x0f92('0x51')){var _0x46446c=fs[_0x0f92('0x3b')](path[_0x0f92('0x3c')](config[_0x0f92('0x45')],_0x0f92('0x46')),_0x0f92('0x3e'));var _0x356dfd=ejs[_0x0f92('0x3f')](_0x46446c,{'networks':_0x573adf||[]});fs[_0x0f92('0x40')](_0x0f92('0x47'),_0x356dfd);return respondWithRpcPromise(_0x0f92('0x42'),_0x0f92('0x1a'),{'module':_0x0f92('0x43')});}else{var _0x427cf0=fs['readFileSync'](path[_0x0f92('0x3c')](config[_0x0f92('0x45')],'server/files/templates/network.ejs'),_0x0f92('0x3e'));var _0x4fe2d6=ejs[_0x0f92('0x3f')](_0x427cf0,{'networks':_0x573adf||[]});fs[_0x0f92('0x40')](util['format'](_0x0f92('0x4a'),_0xba0a10[_0x0f92('0x24')][_0x0f92('0x4c')]()),_0x4fe2d6);return respondWithRpcPromise(_0x0f92('0x42'),_0x0f92('0x1a'),{'module':_0x0f92('0x4d')});}})[_0x0f92('0x11')](handleError(_0x2b58d0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f625fb0..b6af42c 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 _0xb688=['exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0xa21fd6,_0x18d121){var _0x6fef01=function(_0x464655){while(--_0x464655){_0xa21fd6['push'](_0xa21fd6['shift']());}};_0x6fef01(++_0x18d121);}(_0xb688,0xcf));var _0x8b68=function(_0x1bb53c,_0x401cfd){_0x1bb53c=_0x1bb53c-0x0;var _0x29be6f=_0xb688[_0x1bb53c];return _0x29be6f;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1306=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x5944ff,_0x5a955c){var _0x160ba8=function(_0x19783f){while(--_0x19783f){_0x5944ff['push'](_0x5944ff['shift']());}};_0x160ba8(++_0x5a955c);}(_0x1306,0x17a));var _0x6130=function(_0x528ecf,_0x33c991){_0x528ecf=_0x528ecf-0x0;var _0x5b7922=_0x1306[_0x528ecf];return _0x5b7922;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var logger=require(_0x6130('0x2'))(_0x6130('0x3'));var moment=require(_0x6130('0x4'));var BPromise=require(_0x6130('0x5'));var rp=require(_0x6130('0x6'));var fs=require('fs');var path=require(_0x6130('0x7'));var rimraf=require(_0x6130('0x8'));var config=require(_0x6130('0x9'));var attributes=require(_0x6130('0xa'));module[_0x6130('0xb')]=function(_0x213e6a,_0x2b965d){return _0x213e6a[_0x6130('0xc')](_0x6130('0xd'),attributes,{'tableName':_0x6130('0xe'),'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 6f2c1f4..22a0117 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x3316d8,_0x54f54e){_0x3316d8=_0x3316d8-0x0;var _0x7ea4f2=_0x7a54[_0x3316d8];return _0x7ea4f2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x35ad55,_0x1c206c){_0x35ad55=_0x35ad55-0x0;var _0x12c6d5=_0x7a54[_0x35ad55];return _0x12c6d5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 397ba79..3ea10df 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 _0x0120=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x9f8aa0,_0x291b27){var _0x2e3753=function(_0x1a52a6){while(--_0x1a52a6){_0x9f8aa0['push'](_0x9f8aa0['shift']());}};_0x2e3753(++_0x291b27);}(_0x0120,0x6f));var _0x0012=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x0120[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var fs_extra=require(_0x0012('0x6'));var auth=require(_0x0012('0x7'));var interaction=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var controller=require(_0x0012('0xa'));router[_0x0012('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0xe')]);router[_0x0012('0xb')](_0x0012('0xf'),auth['isAuthenticated'](),controller[_0x0012('0x10')]);router[_0x0012('0xb')](_0x0012('0x11'),auth[_0x0012('0xd')](),controller['getDispositions']);router[_0x0012('0xb')]('/:id/canned_answers',auth[_0x0012('0xd')](),controller[_0x0012('0x12')]);router[_0x0012('0xb')](_0x0012('0x13'),auth[_0x0012('0xd')](),controller['getApplications']);router[_0x0012('0xb')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x0012('0x14'),auth['isAuthenticated'](),controller[_0x0012('0x15')]);router[_0x0012('0x16')]('/',auth['isAuthenticated'](),controller[_0x0012('0x17')]);router[_0x0012('0x16')](_0x0012('0x11'),auth[_0x0012('0xd')](),controller['addDisposition']);router['post'](_0x0012('0x18'),auth[_0x0012('0xd')](),controller[_0x0012('0x19')]);router[_0x0012('0x16')](_0x0012('0x1a'),controller[_0x0012('0x1b')]);router[_0x0012('0x16')](_0x0012('0x13'),auth['isAuthenticated'](),controller[_0x0012('0x1c')]);router[_0x0012('0x16')]('/:id/users',auth[_0x0012('0xd')](),controller[_0x0012('0x1d')]);router[_0x0012('0x16')](_0x0012('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0x0012('0x1f')](_0x0012('0xf'),auth[_0x0012('0xd')](),controller[_0x0012('0x20')]);router[_0x0012('0x21')](_0x0012('0xf'),auth[_0x0012('0xd')](),controller[_0x0012('0x22')]);router['delete'](_0x0012('0x11'),auth[_0x0012('0xd')](),controller['removeDispositions']);router[_0x0012('0x21')](_0x0012('0x18'),auth[_0x0012('0xd')](),controller[_0x0012('0x23')]);router[_0x0012('0x21')]('/:id/users',auth[_0x0012('0xd')](),controller[_0x0012('0x24')]);module[_0x0012('0x25')]=router; \ No newline at end of file +var _0x32b6=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x32b6,0x1d1));var _0x632b=function(_0x34bbdc,_0x9df857){_0x34bbdc=_0x34bbdc-0x0;var _0x4e4477=_0x32b6[_0x34bbdc];return _0x4e4477;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x632b('0x4'));var interaction=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var controller=require(_0x632b('0x7'));router[_0x632b('0x8')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0xa')]);router[_0x632b('0x8')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['describe']);router[_0x632b('0x8')](_0x632b('0xc'),auth[_0x632b('0x9')](),controller[_0x632b('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x632b('0xe')]);router['get'](_0x632b('0xf'),auth[_0x632b('0x9')](),controller[_0x632b('0x10')]);router[_0x632b('0x8')](_0x632b('0x11'),auth[_0x632b('0x9')](),controller[_0x632b('0x12')]);router[_0x632b('0x8')](_0x632b('0x13'),auth['isAuthenticated'](),controller[_0x632b('0x14')]);router[_0x632b('0x8')](_0x632b('0x15'),auth['isAuthenticated'](),controller[_0x632b('0x16')]);router[_0x632b('0x17')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0x18')]);router[_0x632b('0x17')](_0x632b('0x19'),auth['isAuthenticated'](),controller[_0x632b('0x1a')]);router['post']('/:id/canned_answers',auth[_0x632b('0x9')](),controller['addAnswer']);router[_0x632b('0x17')](_0x632b('0x1b'),controller[_0x632b('0x1c')]);router['post'](_0x632b('0x11'),auth[_0x632b('0x9')](),controller[_0x632b('0x1d')]);router[_0x632b('0x17')]('/:id/users',auth[_0x632b('0x9')](),controller[_0x632b('0x1e')]);router['post'](_0x632b('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x632b('0x20')]('/:id',auth[_0x632b('0x9')](),controller[_0x632b('0x21')]);router[_0x632b('0x22')]('/:id',auth[_0x632b('0x9')](),controller[_0x632b('0x23')]);router['delete'](_0x632b('0x19'),auth[_0x632b('0x9')](),controller[_0x632b('0x24')]);router[_0x632b('0x22')](_0x632b('0xf'),auth[_0x632b('0x9')](),controller['removeAnswers']);router['delete'](_0x632b('0x15'),auth['isAuthenticated'](),controller[_0x632b('0x25')]);module[_0x632b('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 68514f4..ad88f53 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 _0xc3b6=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3d7fb5,_0x16eb5c){var _0x3a9642=function(_0x3f5b2a){while(--_0x3f5b2a){_0x3d7fb5['push'](_0x3d7fb5['shift']());}};_0x3a9642(++_0x16eb5c);}(_0xc3b6,0x15e));var _0x6c3b=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0xc3b6[_0x6a0266];return _0x309e00;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6c3b('0x0'));module[_0x6c3b('0x1')]={'name':{'type':Sequelize[_0x6c3b('0x2')],'unique':_0x6c3b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6c3b('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6c3b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6c3b('0x5')],'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[_0x6c3b('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6c3b('0x2')]},'queueTransfer':{'type':Sequelize[_0x6c3b('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c3b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c3b('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c3b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c3b('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6c3b('0x6')],'defaultValue':![],'comment':_0x6c3b('0x8'),'set':function(_0x1a47af){if(!_0x1a47af)this[_0x6c3b('0x9')](_0x6c3b('0xa'),null);this[_0x6c3b('0x9')](_0x6c3b('0xb'),_0x1a47af);}}}; \ No newline at end of file +var _0x7aa5=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x3f92c7,_0x863c8){var _0x2e7f61=function(_0x2aa370){while(--_0x2aa370){_0x3f92c7['push'](_0x3f92c7['shift']());}};_0x2e7f61(++_0x863c8);}(_0x7aa5,0x157));var _0x57aa=function(_0x1ef560,_0x281094){_0x1ef560=_0x1ef560-0x0;var _0xdccd1=_0x7aa5[_0x1ef560];return _0xdccd1;};'use strict';var Sequelize=require(_0x57aa('0x0'));var rs=require(_0x57aa('0x1'));module[_0x57aa('0x2')]={'name':{'type':Sequelize[_0x57aa('0x3')],'unique':_0x57aa('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x57aa('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x57aa('0x5')]();}},'replyUri':{'type':Sequelize[_0x57aa('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x57aa('0x6')],'defaultValue':function(){return _0x57aa('0x7');}},'notificationSound':{'type':Sequelize[_0x57aa('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x57aa('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x57aa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x57aa('0x3')]},'queueTransfer':{'type':Sequelize[_0x57aa('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x57aa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x57aa('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x57aa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x57aa('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x57aa('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b5c41){if(!_0x2b5c41)this['setDataValue'](_0x57aa('0xb'),null);this[_0x57aa('0xc')](_0x57aa('0xd'),_0x2b5c41);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b2f5d60..3355f9a 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 _0x5adb=['stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','params','keys','rawAttributes','fields','options','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','list','applications','orderBy','priority','asc','account','contact','firstName','lastName','OpenchannelInteraction','threadId','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','unshift','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','addAgents','ids','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','get','OpenchannelAccounts','UserProfileResource'];(function(_0x2c0c25,_0x5b0a19){var _0x2d8cf8=function(_0x5be48f){while(--_0x5be48f){_0x2c0c25['push'](_0x2c0c25['shift']());}};_0x2d8cf8(++_0x5b0a19);}(_0x5adb,0x84));var _0xb5ad=function(_0x39e02f,_0x2f4a3c){_0x39e02f=_0x39e02f-0x0;var _0x9cf183=_0x5adb[_0x39e02f];return _0x9cf183;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5ad('0x0'));var zipdir=require(_0xb5ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5ad('0x2'));var moment=require('moment');var BPromise=require(_0xb5ad('0x3'));var Mustache=require(_0xb5ad('0x4'));var util=require(_0xb5ad('0x5'));var path=require('path');var sox=require(_0xb5ad('0x6'));var csv=require(_0xb5ad('0x7'));var ejs=require(_0xb5ad('0x8'));var fs=require('fs');var fs_extra=require(_0xb5ad('0x9'));var _=require('lodash');var squel=require(_0xb5ad('0xa'));var crypto=require(_0xb5ad('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb5ad('0xc'));var toCsv=require(_0xb5ad('0x7'));var querystring=require(_0xb5ad('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb5ad('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb5ad('0xf'));var hardwareService=require(_0xb5ad('0x10'));var logger=require(_0xb5ad('0x11'))(_0xb5ad('0x12'));var utils=require(_0xb5ad('0x13'));var config=require(_0xb5ad('0x14'));var licenseUtil=require(_0xb5ad('0x15'));var db=require('../../mysqldb')['db'];config[_0xb5ad('0x16')]=_[_0xb5ad('0x17')](config[_0xb5ad('0x16')],{'host':_0xb5ad('0x18'),'port':0x18eb});var socket=require(_0xb5ad('0x19'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xb5ad('0x1a'));var client=jayson[_0xb5ad('0x1b')][_0xb5ad('0x1c')]({'port':0x232c});var client9002=jayson[_0xb5ad('0x1b')][_0xb5ad('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x27fbaa,_0x271521,_0x313886,_0x2f13e0){return new BPromise(function(_0x4dfc93,_0xda94c9){var _0x3d37d5=_0x2f13e0||client;return _0x3d37d5[_0xb5ad('0x1d')](_0x27fbaa,_0x313886)['then'](function(_0x362350){logger[_0xb5ad('0x1e')](_0xb5ad('0x1f'),_0x271521,'request\x20sent');logger[_0xb5ad('0x20')](_0xb5ad('0x21'),_0x271521,_0xb5ad('0x22'),JSON[_0xb5ad('0x23')](_0x362350));if(_0x362350[_0xb5ad('0x24')]){if(_0x362350['error'][_0xb5ad('0x25')]===0x1f4){logger[_0xb5ad('0x24')](_0xb5ad('0x1f'),_0x271521,_0x362350[_0xb5ad('0x24')][_0xb5ad('0x26')]);return _0xda94c9(_0x362350[_0xb5ad('0x24')]['message']);}logger['error'](_0xb5ad('0x1f'),_0x271521,_0x362350['error'][_0xb5ad('0x26')]);return _0x4dfc93(_0x362350[_0xb5ad('0x24')][_0xb5ad('0x26')]);}else{logger[_0xb5ad('0x1e')](_0xb5ad('0x1f'),_0x271521,_0xb5ad('0x22'));_0x4dfc93(_0x362350[_0xb5ad('0x27')][_0xb5ad('0x26')]);}})[_0xb5ad('0x28')](function(_0x1dee94){logger[_0xb5ad('0x24')](_0xb5ad('0x1f'),_0x271521,_0x1dee94);_0xda94c9(_0x1dee94);});});}function respondWithStatusCode(_0x3df99f,_0x560215){_0x560215=_0x560215||0xcc;return function(_0x45723b){if(_0x45723b){return _0x3df99f[_0xb5ad('0x29')](_0x560215);}return _0x3df99f['status'](_0x560215)[_0xb5ad('0x2a')]();};}function respondWithResult(_0x5c1e4d,_0x288134){_0x288134=_0x288134||0xc8;return function(_0x3970aa){if(_0x3970aa){return _0x5c1e4d[_0xb5ad('0x2b')](_0x288134)[_0xb5ad('0x2c')](_0x3970aa);}};}function respondWithFilteredResult(_0x5c9829,_0x4bb505){return function(_0x2cdde4){if(_0x2cdde4){var _0x56d948=typeof _0x4bb505['offset']===_0xb5ad('0x2d')&&typeof _0x4bb505[_0xb5ad('0x2e')]===_0xb5ad('0x2d');var _0xef421f=_0x2cdde4[_0xb5ad('0x2f')];var _0x421d85=_0x56d948?0x0:_0x4bb505[_0xb5ad('0x30')];var _0x2a5fea=_0x56d948?_0x2cdde4[_0xb5ad('0x2f')]:_0x4bb505['offset']+_0x4bb505[_0xb5ad('0x2e')];var _0x1812cd;if(_0x2a5fea>=_0xef421f){_0x2a5fea=_0xef421f;_0x1812cd=0xc8;}else{_0x1812cd=0xce;}_0x5c9829['status'](_0x1812cd);return _0x5c9829['set'](_0xb5ad('0x31'),_0x421d85+'-'+_0x2a5fea+'/'+_0xef421f)[_0xb5ad('0x2c')](_0x2cdde4);}return null;};}function patchUpdates(_0x51cdcc){return function(_0x51bf08){try{jsonpatch[_0xb5ad('0x32')](_0x51bf08,_0x51cdcc,!![]);}catch(_0x57aeef){return BPromise[_0xb5ad('0x33')](_0x57aeef);}return _0x51bf08['save']();};}function saveUpdates(_0x8ba88e,_0x1d1e3d){return function(_0x1ef420){if(_0x1ef420){return _0x1ef420[_0xb5ad('0x34')](_0x8ba88e)[_0xb5ad('0x35')](function(_0x1fc1e5){return _0x1fc1e5;});}return null;};}function removeEntity(_0x25023a,_0x505ec8){return function(_0x12e0f8){if(_0x12e0f8){return _0x12e0f8[_0xb5ad('0x36')]()[_0xb5ad('0x35')](function(){var _0x4c31fc=_0x12e0f8[_0xb5ad('0x37')]({'plain':!![]});var _0xc983b=_0xb5ad('0x38');return db[_0xb5ad('0x39')][_0xb5ad('0x36')]({'where':{'type':_0xc983b,'resourceId':_0x4c31fc['id']}})[_0xb5ad('0x35')](function(){return _0x12e0f8;});})[_0xb5ad('0x35')](function(){_0x25023a[_0xb5ad('0x2b')](0xcc)[_0xb5ad('0x2a')]();});}};}function handleEntityNotFound(_0x3b4515,_0x39cb0f){return function(_0xbddf2e){if(!_0xbddf2e){_0x3b4515[_0xb5ad('0x29')](0x194);}return _0xbddf2e;};}function handleError(_0x292ba8,_0x4d68a6){_0x4d68a6=_0x4d68a6||0x1f4;return function(_0x147ef6){logger[_0xb5ad('0x24')](_0x147ef6[_0xb5ad('0x3a')]);if(_0x147ef6[_0xb5ad('0x3b')]){delete _0x147ef6['name'];}_0x292ba8[_0xb5ad('0x2b')](_0x4d68a6)[_0xb5ad('0x3c')](_0x147ef6);};}exports[_0xb5ad('0x3d')]=function(_0x362e13,_0x428e08){var _0x5bcca8={'include':[{'model':db[_0xb5ad('0x3e')],'as':_0xb5ad('0x3f')}]},_0xa33d87={},_0x13bb43={'count':0x0,'rows':[]};var _0x21cdb5=_[_0xb5ad('0x40')](db[_0xb5ad('0x41')]['rawAttributes'],function(_0x46fcf2){return{'name':_0x46fcf2['fieldName'],'type':_0x46fcf2['type'][_0xb5ad('0x42')]};});_0xa33d87['model']=_[_0xb5ad('0x40')](_0x21cdb5,_0xb5ad('0x3b'));_0xa33d87[_0xb5ad('0x43')]=_['keys'](_0x362e13[_0xb5ad('0x43')]);_0xa33d87[_0xb5ad('0x44')]=_[_0xb5ad('0x45')](_0xa33d87[_0xb5ad('0x46')],_0xa33d87[_0xb5ad('0x43')]);_0x5bcca8['attributes']=_['intersection'](_0xa33d87[_0xb5ad('0x46')],qs['fields'](_0x362e13[_0xb5ad('0x43')]['fields']));_0x5bcca8['attributes']=_0x5bcca8[_0xb5ad('0x47')][_0xb5ad('0x48')]?_0x5bcca8[_0xb5ad('0x47')]:_0xa33d87[_0xb5ad('0x46')];if(!_0x362e13[_0xb5ad('0x43')][_0xb5ad('0x49')](_0xb5ad('0x4a'))){_0x5bcca8[_0xb5ad('0x2e')]=qs[_0xb5ad('0x2e')](_0x362e13['query'][_0xb5ad('0x2e')]);_0x5bcca8[_0xb5ad('0x30')]=qs[_0xb5ad('0x30')](_0x362e13[_0xb5ad('0x43')]['offset']);}_0x5bcca8[_0xb5ad('0x4b')]=qs[_0xb5ad('0x4c')](_0x362e13[_0xb5ad('0x43')][_0xb5ad('0x4c')]);_0x5bcca8[_0xb5ad('0x4d')]=qs[_0xb5ad('0x44')](_[_0xb5ad('0x4e')](_0x362e13[_0xb5ad('0x43')],_0xa33d87[_0xb5ad('0x44')]),_0x21cdb5);if(_0x362e13['query']['filter']){_0x5bcca8['where']=_[_0xb5ad('0x4f')](_0x5bcca8[_0xb5ad('0x4d')],{'$or':_['map'](_0x21cdb5,function(_0x322b16){if(_0x322b16[_0xb5ad('0x50')]!==_0xb5ad('0x51')){var _0xd8d39a={};_0xd8d39a[_0x322b16['name']]={'$like':'%'+_0x362e13[_0xb5ad('0x43')][_0xb5ad('0x52')]+'%'};return _0xd8d39a;}})});}_0x5bcca8=_[_0xb5ad('0x4f')]({},_0x5bcca8,_0x362e13['options']);var _0x33327e={'where':_0x5bcca8[_0xb5ad('0x4d')]};return db[_0xb5ad('0x41')]['count'](_0x33327e)[_0xb5ad('0x35')](function(_0x19ee8d){_0x13bb43[_0xb5ad('0x2f')]=_0x19ee8d;if(_0x362e13[_0xb5ad('0x43')][_0xb5ad('0x53')]){_0x5bcca8[_0xb5ad('0x54')]=[{'all':!![]}];}return db[_0xb5ad('0x41')][_0xb5ad('0x55')](_0x5bcca8);})['then'](function(_0x34526c){_0x13bb43[_0xb5ad('0x56')]=_0x34526c;return _0x13bb43;})['then'](respondWithFilteredResult(_0x428e08,_0x5bcca8))[_0xb5ad('0x28')](handleError(_0x428e08,null));};exports['show']=function(_0xbd67d3,_0x1aac6b){var _0x3b89d6={'raw':![],'where':{'id':_0xbd67d3[_0xb5ad('0x57')]['id']},'include':[{'model':db[_0xb5ad('0x3e')],'as':_0xb5ad('0x3f')}]},_0x3d2d82={};_0x3d2d82[_0xb5ad('0x46')]=_[_0xb5ad('0x58')](db['OpenchannelAccount'][_0xb5ad('0x59')]);_0x3d2d82[_0xb5ad('0x43')]=_[_0xb5ad('0x58')](_0xbd67d3[_0xb5ad('0x43')]);_0x3d2d82['filters']=_['intersection'](_0x3d2d82[_0xb5ad('0x46')],_0x3d2d82['query']);_0x3b89d6['attributes']=_[_0xb5ad('0x45')](_0x3d2d82[_0xb5ad('0x46')],qs['fields'](_0xbd67d3['query'][_0xb5ad('0x5a')]));_0x3b89d6[_0xb5ad('0x47')]=_0x3b89d6[_0xb5ad('0x47')][_0xb5ad('0x48')]?_0x3b89d6['attributes']:_0x3d2d82[_0xb5ad('0x46')];if(_0xbd67d3[_0xb5ad('0x43')][_0xb5ad('0x53')]){_0x3b89d6[_0xb5ad('0x54')]=[{'all':!![]}];}_0x3b89d6=_[_0xb5ad('0x4f')]({},_0x3b89d6,_0xbd67d3[_0xb5ad('0x5b')]);return db[_0xb5ad('0x41')][_0xb5ad('0x5c')](_0x3b89d6)[_0xb5ad('0x35')](handleEntityNotFound(_0x1aac6b,null))[_0xb5ad('0x35')](respondWithResult(_0x1aac6b,null))['catch'](handleError(_0x1aac6b,null));};exports['create']=function(_0x39ce8b,_0x41cc79){return db[_0xb5ad('0x41')][_0xb5ad('0x5d')](_0x39ce8b[_0xb5ad('0x5e')],{})[_0xb5ad('0x35')](function(_0x18d439){var _0x367108=_0x39ce8b['user'][_0xb5ad('0x37')]({'plain':!![]});if(!_0x367108)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x367108[_0xb5ad('0x5f')]===_0xb5ad('0x60')){var _0x2fa8fd=_0x18d439[_0xb5ad('0x37')]({'plain':!![]});var _0x393630=_0xb5ad('0x38');return db[_0xb5ad('0x61')][_0xb5ad('0x5c')]({'where':{'name':_0x393630,'userProfileId':_0x367108[_0xb5ad('0x62')]},'raw':!![]})[_0xb5ad('0x35')](function(_0x334f1d){if(_0x334f1d&&_0x334f1d['autoAssociation']===0x0){return db[_0xb5ad('0x39')][_0xb5ad('0x5d')]({'name':_0x2fa8fd[_0xb5ad('0x3b')],'resourceId':_0x2fa8fd['id'],'type':_0x334f1d[_0xb5ad('0x3b')],'sectionId':_0x334f1d['id']},{})[_0xb5ad('0x35')](function(){return _0x18d439;});}else{return _0x18d439;}})['catch'](function(_0x49b957){logger[_0xb5ad('0x24')](_0xb5ad('0x63'),_0x49b957);throw _0x49b957;});}return _0x18d439;})[_0xb5ad('0x35')](respondWithResult(_0x41cc79,0xc9))[_0xb5ad('0x28')](handleError(_0x41cc79,null));};exports[_0xb5ad('0x34')]=function(_0x1f17ca,_0x1ddd35){if(_0x1f17ca[_0xb5ad('0x5e')]['id']){delete _0x1f17ca[_0xb5ad('0x5e')]['id'];}return db[_0xb5ad('0x41')][_0xb5ad('0x5c')]({'where':{'id':_0x1f17ca[_0xb5ad('0x57')]['id']},'include':[{'model':db[_0xb5ad('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xb5ad('0x35')](handleEntityNotFound(_0x1ddd35,null))[_0xb5ad('0x35')](saveUpdates(_0x1f17ca['body'],null))[_0xb5ad('0x35')](respondWithResult(_0x1ddd35,null))[_0xb5ad('0x28')](handleError(_0x1ddd35,null));};exports[_0xb5ad('0x36')]=function(_0x485477,_0x3856ae){return db[_0xb5ad('0x41')]['find']({'where':{'id':_0x485477[_0xb5ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x3856ae,null))[_0xb5ad('0x35')](removeEntity(_0x3856ae,null))['catch'](handleError(_0x3856ae,null));};exports[_0xb5ad('0x64')]=function(_0x362559,_0x34f35c){return db['OpenchannelAccount'][_0xb5ad('0x64')]()[_0xb5ad('0x35')](respondWithResult(_0x34f35c,null))['catch'](handleError(_0x34f35c,null));};exports[_0xb5ad('0x65')]=function(_0x426843,_0x55305e,_0x36b7e0){if(_0x426843[_0xb5ad('0x5e')]['id']){delete _0x426843[_0xb5ad('0x5e')]['id'];}return db['OpenchannelAccount'][_0xb5ad('0x5c')]({'where':{'id':_0x426843[_0xb5ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x55305e,null))[_0xb5ad('0x35')](function(_0x3f8ff5){if(_0x3f8ff5){_0x426843[_0xb5ad('0x5e')][_0xb5ad('0x66')]=_0x3f8ff5['id'];return db[_0xb5ad('0x67')][_0xb5ad('0x5d')](_0x426843[_0xb5ad('0x5e')]);}})[_0xb5ad('0x35')](respondWithResult(_0x55305e,null))['catch'](handleError(_0x55305e,null));};exports[_0xb5ad('0x68')]=function(_0x2d12e5,_0xee9f40,_0x41a6c0){var _0x8848f6={'raw':![],'where':{}};var _0x535b82={};var _0x4ec8d3={'count':0x0,'rows':[]};return db[_0xb5ad('0x41')][_0xb5ad('0x69')]({'where':{'id':_0x2d12e5['params']['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0xee9f40,null))[_0xb5ad('0x35')](function(_0x16155d){if(_0x16155d){_0x535b82[_0xb5ad('0x46')]=_[_0xb5ad('0x58')](db[_0xb5ad('0x67')]['rawAttributes']);_0x535b82[_0xb5ad('0x43')]=_[_0xb5ad('0x58')](_0x2d12e5[_0xb5ad('0x43')]);_0x535b82[_0xb5ad('0x44')]=_['intersection'](_0x535b82[_0xb5ad('0x46')],_0x535b82[_0xb5ad('0x43')]);_0x8848f6[_0xb5ad('0x47')]=_[_0xb5ad('0x45')](_0x535b82[_0xb5ad('0x46')],qs[_0xb5ad('0x5a')](_0x2d12e5[_0xb5ad('0x43')][_0xb5ad('0x5a')]));_0x8848f6['attributes']=_0x8848f6[_0xb5ad('0x47')]['length']?_0x8848f6[_0xb5ad('0x47')]:_0x535b82['model'];if(!_0x2d12e5['query']['hasOwnProperty'](_0xb5ad('0x4a'))){_0x8848f6[_0xb5ad('0x2e')]=qs[_0xb5ad('0x2e')](_0x2d12e5['query'][_0xb5ad('0x2e')]);_0x8848f6[_0xb5ad('0x30')]=qs[_0xb5ad('0x30')](_0x2d12e5[_0xb5ad('0x43')]['offset']);}_0x8848f6[_0xb5ad('0x4b')]=qs['sort'](_0x2d12e5[_0xb5ad('0x43')]['sort']);_0x8848f6['where']=qs[_0xb5ad('0x44')](_['pick'](_0x2d12e5[_0xb5ad('0x43')],_0x535b82[_0xb5ad('0x44')]));_0x8848f6['where'][_0xb5ad('0x66')]=_0x16155d['id'];if(_0x2d12e5[_0xb5ad('0x43')][_0xb5ad('0x52')]){_0x8848f6[_0xb5ad('0x4d')]=_['merge'](_0x8848f6[_0xb5ad('0x4d')],{'$or':_[_0xb5ad('0x40')](_0x8848f6[_0xb5ad('0x47')],function(_0x451876){var _0x1fa095={};_0x1fa095[_0x451876]={'$like':'%'+_0x2d12e5[_0xb5ad('0x43')][_0xb5ad('0x52')]+'%'};return _0x1fa095;})});}_0x8848f6=_[_0xb5ad('0x4f')]({},_0x8848f6,_0x2d12e5[_0xb5ad('0x5b')]);return db[_0xb5ad('0x67')][_0xb5ad('0x2f')]({'where':_0x8848f6['where']})[_0xb5ad('0x35')](function(_0x4182af){_0x4ec8d3[_0xb5ad('0x2f')]=_0x4182af;if(_0x2d12e5[_0xb5ad('0x43')][_0xb5ad('0x53')]){_0x8848f6[_0xb5ad('0x54')]=[{'all':!![]}];}return db[_0xb5ad('0x67')]['findAll'](_0x8848f6);})[_0xb5ad('0x35')](function(_0x58267d){_0x4ec8d3['rows']=_0x58267d;return _0x4ec8d3;});}})['then'](respondWithFilteredResult(_0xee9f40,_0x8848f6))[_0xb5ad('0x28')](handleError(_0xee9f40,null));};exports[_0xb5ad('0x6a')]=function(_0x152e56,_0xe20310,_0x24a48e){return db[_0xb5ad('0x41')][_0xb5ad('0x5c')]({'where':{'id':_0x152e56[_0xb5ad('0x57')]['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0xe20310,null))['then'](function(_0xa67503){if(_0xa67503){return _0xa67503[_0xb5ad('0x6a')](_0x152e56[_0xb5ad('0x43')]['ids']);}})['then'](respondWithStatusCode(_0xe20310,null))[_0xb5ad('0x28')](handleError(_0xe20310,null));};exports[_0xb5ad('0x6b')]=function(_0x23f026,_0x2871b4,_0x1c0c75){if(_0x23f026[_0xb5ad('0x5e')]['id']){delete _0x23f026[_0xb5ad('0x5e')]['id'];}return db[_0xb5ad('0x41')][_0xb5ad('0x5c')]({'where':{'id':_0x23f026[_0xb5ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x2871b4,null))[_0xb5ad('0x35')](function(_0x4b3a0f){if(_0x4b3a0f){_0x23f026[_0xb5ad('0x5e')][_0xb5ad('0x66')]=_0x4b3a0f['id'];return db['CannedAnswer'][_0xb5ad('0x5d')](_0x23f026[_0xb5ad('0x5e')]);}})[_0xb5ad('0x35')](respondWithResult(_0x2871b4,null))[_0xb5ad('0x28')](handleError(_0x2871b4,null));};exports[_0xb5ad('0x6c')]=function(_0x5d8e70,_0x5e0694,_0x611511){var _0x361833={'raw':![],'where':{}};var _0x2a5ea9={};var _0x1c5494={'count':0x0,'rows':[]};return db[_0xb5ad('0x41')][_0xb5ad('0x69')]({'where':{'id':_0x5d8e70[_0xb5ad('0x57')]['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0x5e0694,null))[_0xb5ad('0x35')](function(_0x1c3772){if(_0x1c3772){_0x2a5ea9[_0xb5ad('0x46')]=_[_0xb5ad('0x58')](db[_0xb5ad('0x6d')][_0xb5ad('0x59')]);_0x2a5ea9['query']=_['keys'](_0x5d8e70[_0xb5ad('0x43')]);_0x2a5ea9['filters']=_[_0xb5ad('0x45')](_0x2a5ea9[_0xb5ad('0x46')],_0x2a5ea9[_0xb5ad('0x43')]);_0x361833[_0xb5ad('0x47')]=_[_0xb5ad('0x45')](_0x2a5ea9[_0xb5ad('0x46')],qs[_0xb5ad('0x5a')](_0x5d8e70['query'][_0xb5ad('0x5a')]));_0x361833[_0xb5ad('0x47')]=_0x361833[_0xb5ad('0x47')][_0xb5ad('0x48')]?_0x361833[_0xb5ad('0x47')]:_0x2a5ea9[_0xb5ad('0x46')];if(!_0x5d8e70[_0xb5ad('0x43')][_0xb5ad('0x49')]('nolimit')){_0x361833[_0xb5ad('0x2e')]=qs[_0xb5ad('0x2e')](_0x5d8e70['query']['limit']);_0x361833['offset']=qs[_0xb5ad('0x30')](_0x5d8e70[_0xb5ad('0x43')][_0xb5ad('0x30')]);}_0x361833[_0xb5ad('0x4b')]=qs['sort'](_0x5d8e70[_0xb5ad('0x43')][_0xb5ad('0x4c')]);_0x361833[_0xb5ad('0x4d')]=qs[_0xb5ad('0x44')](_[_0xb5ad('0x4e')](_0x5d8e70['query'],_0x2a5ea9[_0xb5ad('0x44')]));_0x361833[_0xb5ad('0x4d')]['OpenchannelAccountId']=_0x1c3772['id'];if(_0x5d8e70[_0xb5ad('0x43')][_0xb5ad('0x52')]){_0x361833[_0xb5ad('0x4d')]=_['merge'](_0x361833[_0xb5ad('0x4d')],{'$or':_['map'](_0x361833[_0xb5ad('0x47')],function(_0x472417){var _0x2f8dec={};_0x2f8dec[_0x472417]={'$like':'%'+_0x5d8e70[_0xb5ad('0x43')]['filter']+'%'};return _0x2f8dec;})});}_0x361833=_[_0xb5ad('0x4f')]({},_0x361833,_0x5d8e70[_0xb5ad('0x5b')]);return db[_0xb5ad('0x6d')][_0xb5ad('0x2f')]({'where':_0x361833[_0xb5ad('0x4d')]})[_0xb5ad('0x35')](function(_0x3ff97e){_0x1c5494[_0xb5ad('0x2f')]=_0x3ff97e;if(_0x5d8e70[_0xb5ad('0x43')][_0xb5ad('0x53')]){_0x361833[_0xb5ad('0x54')]=[{'all':!![]}];}return db[_0xb5ad('0x6d')]['findAll'](_0x361833);})['then'](function(_0x1550db){_0x1c5494[_0xb5ad('0x56')]=_0x1550db;return _0x1c5494;});}})[_0xb5ad('0x35')](respondWithFilteredResult(_0x5e0694,_0x361833))[_0xb5ad('0x28')](handleError(_0x5e0694,null));};exports['removeAnswers']=function(_0x42e46a,_0x3979c8,_0x271fec){return db[_0xb5ad('0x41')][_0xb5ad('0x5c')]({'where':{'id':_0x42e46a[_0xb5ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x3979c8,null))['then'](function(_0x2ced58){if(_0x2ced58){return _0x2ced58[_0xb5ad('0x6e')](_0x42e46a[_0xb5ad('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x3979c8,null))[_0xb5ad('0x28')](handleError(_0x3979c8,null));};exports[_0xb5ad('0x6f')]=function(_0x23df6c,_0x1330c8,_0x23f632){var _0x7e352c={'body':_0x23df6c[_0xb5ad('0x5e')],'channel':'openchannel'};var _0x1dfaca=[];var _0x15c2e7=[];var _0x3d1416={};var _0x4de484=![];return db[_0xb5ad('0x70')][_0xb5ad('0x64')]()[_0xb5ad('0x35')](function(_0x21711b){if(!_0x21711b){throw new db[(_0xb5ad('0x71'))]['ValidationError'](_0xb5ad('0x72'));}_0x1dfaca=_[_0xb5ad('0x73')](_[_0xb5ad('0x58')](_0x21711b),[_0xb5ad('0x74'),'updatedAt']);_0x15c2e7=_[_0xb5ad('0x73')](_[_0xb5ad('0x58')](_0x21711b),['createdAt',_0xb5ad('0x75'),_0xb5ad('0x76'),_0xb5ad('0x77')]);if(_0x23df6c['body']['id']){delete _0x23df6c['body']['id'];}if(_[_0xb5ad('0x78')](_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x79')])){throw new db[(_0xb5ad('0x71'))][(_0xb5ad('0x7a'))](_0xb5ad('0x7b'));}if(_[_0xb5ad('0x78')](_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x5e')])||_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x5e')]===''){throw new db['Sequelize'][(_0xb5ad('0x7a'))](_0xb5ad('0x7c'));}if(_[_0xb5ad('0x78')](_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x7d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15c2e7);}if(!_[_0xb5ad('0x7e')](_0x15c2e7,_0x23df6c[_0xb5ad('0x5e')]['mapKey'])){throw new db[(_0xb5ad('0x71'))][(_0xb5ad('0x7a'))](_0xb5ad('0x7f')+_0x15c2e7);}_0x3d1416[_0x23df6c[_0xb5ad('0x5e')]['mapKey']]=_0x23df6c[_0xb5ad('0x5e')]['from'];})['then'](function(){return db[_0xb5ad('0x41')]['find']({'where':{'id':_0x23df6c['params']['id']},'include':[{'model':db[_0xb5ad('0x80')],'as':_0xb5ad('0x81'),'include':[{'model':db[_0xb5ad('0x70')],'as':_0xb5ad('0x82'),'where':_0x3d1416,'limit':0x1,'order':[[_0xb5ad('0x75'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xb5ad('0x83')}]});})[_0xb5ad('0x35')](handleEntityNotFound(_0x1330c8,null))[_0xb5ad('0x35')](function(_0x31ff12){if(_0x31ff12&&_0x31ff12[_0xb5ad('0x81')]){_0x7e352c['account']=_0x31ff12;_0x7e352c['applications']=_0x31ff12[_0xb5ad('0x83')];_0x7e352c[_0xb5ad('0x84')]=_0x31ff12[_0xb5ad('0x81')];_0x7e352c[_0xb5ad('0x85')]=_[_0xb5ad('0x86')](_0x7e352c[_0xb5ad('0x85')],[_0xb5ad('0x87')],[_0xb5ad('0x88')]);if(_0x7e352c['account']['Applications']){delete _0x7e352c[_0xb5ad('0x89')]['Applications'];}if(_0x7e352c['account']['List']&&_0x7e352c[_0xb5ad('0x89')][_0xb5ad('0x81')][_0xb5ad('0x82')]['length']){return _0x7e352c[_0xb5ad('0x89')]['List'][_0xb5ad('0x82')][0x0];}var _0x3dee29=_['defaults'](_0x23df6c[_0xb5ad('0x5e')],{'firstName':_0x23df6c['body'][_0xb5ad('0x79')],'ListId':_0x31ff12[_0xb5ad('0x77')]});_0x3dee29[_0x23df6c['body'][_0xb5ad('0x7d')]]=_0x23df6c['body'][_0xb5ad('0x79')];return db['CmContact']['create'](_0x3dee29,{'fields':_0x1dfaca,'raw':!![]});}})[_0xb5ad('0x35')](handleEntityNotFound(_0x1330c8,null))[_0xb5ad('0x35')](function(_0x43a1d7){_0x7e352c[_0xb5ad('0x8a')]=_0x43a1d7;if(_0x43a1d7){var _0x31da3b={'ContactId':_0x43a1d7['id'],'OpenchannelAccountId':_0x23df6c['params']['id'],'from':(_0x43a1d7[_0xb5ad('0x8b')]||'')+'\x20'+(_0x43a1d7[_0xb5ad('0x8c')]||'')};var _0x894d26={'OpenchannelAccountId':_0x23df6c['params']['id'],'closed':![]};if(_0x23df6c['body']['threadId']){_0x894d26['threadId']=_0x23df6c[_0xb5ad('0x5e')]['threadId'];return db[_0xb5ad('0x8d')]['find']({'where':_0x894d26})['then'](function(_0x1638ff){if(_0x1638ff){return[_0x1638ff,![]];}_0x31da3b[_0xb5ad('0x8e')]=_0x23df6c[_0xb5ad('0x5e')]['threadId'];_0x31da3b[_0xb5ad('0x8f')]=_0x23df6c['body']['externalUrl'];return db[_0xb5ad('0x8d')]['create'](_0x31da3b)['then'](function(_0x530525){return[_0x530525,!![]];});});}else{_0x894d26[_0xb5ad('0x8e')]=null;}_0x894d26[_0xb5ad('0x90')]=_0x43a1d7['id'];return db[_0xb5ad('0x8d')][_0xb5ad('0x5c')]({'where':_0x894d26})[_0xb5ad('0x35')](function(_0x56da75){if(_0x56da75){return[_0x56da75,![]];}return db[_0xb5ad('0x8d')]['create'](_0x31da3b)[_0xb5ad('0x35')](function(_0x3b7811){return[_0x3b7811,!![]];});});}})[_0xb5ad('0x91')](function(_0x543734,_0x43dede){if(_0x543734){_0x4de484=_0x43dede;if(!_0x43dede){var _0x3d2bc5={'from':(_0x7e352c[_0xb5ad('0x8a')][_0xb5ad('0x8b')]||'')+'\x20'+(_0x7e352c[_0xb5ad('0x8a')][_0xb5ad('0x8c')]||'')};if(_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x8e')]&&_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x92')]&&_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x8e')]!=_0x23df6c[_0xb5ad('0x5e')]['messageId']){_0x3d2bc5[_0xb5ad('0x8e')]=_0x23df6c['body']['messageId'];}return _0x543734['update'](_0x3d2bc5);}else{return _0x543734;}}})[_0xb5ad('0x35')](function(_0x1db936){_0x7e352c[_0xb5ad('0x93')]=_0x1db936['get']({'plain':!![]});_0x7e352c[_0xb5ad('0x93')]['created']=_0x4de484;if(_0x7e352c['interaction'][_0xb5ad('0x94')]){if(_0x7e352c[_0xb5ad('0x89')]['autoclose']){_0x7e352c[_0xb5ad('0x85')][_0xb5ad('0x95')]({'id':0x0,'priority':_0x7e352c[_0xb5ad('0x85')][_0xb5ad('0x48')]+0x1,'app':_0xb5ad('0x96'),'appdata':_0xb5ad('0x97'),'interval':_0xb5ad('0x98')});}}return db[_0xb5ad('0x99')]['create']({'body':_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x5e')],'OpenchannelAccountId':_0x23df6c[_0xb5ad('0x57')]['id'],'OpenchannelInteractionId':_0x1db936['id'],'direction':'in','ContactId':_0x7e352c[_0xb5ad('0x8a')]['id'],'AttachmentId':_0x23df6c[_0xb5ad('0x5e')][_0xb5ad('0x9a')]});})[_0xb5ad('0x35')](function(_0x3dcce2){_0x7e352c[_0xb5ad('0x26')]=_0x3dcce2;if(!_0x7e352c[_0xb5ad('0x93')]['UserId'])return;return db[_0xb5ad('0x9b')][_0xb5ad('0x5c')]({'attributes':['id','name'],'where':{'id':_0x7e352c[_0xb5ad('0x93')]['UserId']}});})['then'](function(_0x520d1c){if(_0x520d1c){_0x7e352c['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xb5ad('0x9c'),'appdata':_0x520d1c[_0xb5ad('0x3b')]+','+(_0x7e352c[_0xb5ad('0x89')][_0xb5ad('0x9d')]||0xa),'interval':_0xb5ad('0x98')});}if(!_0x7e352c[_0xb5ad('0x93')]['queueId'])return;return db[_0xb5ad('0x9e')][_0xb5ad('0x5c')]({'attributes':['id','name'],'where':{'id':_0x7e352c['interaction'][_0xb5ad('0x9f')]}});})[_0xb5ad('0x35')](function(_0x1f314a){if(_0x1f314a){_0x7e352c[_0xb5ad('0x85')][_0xb5ad('0xa0')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1f314a[_0xb5ad('0x3b')]+','+(_0x7e352c[_0xb5ad('0x89')][_0xb5ad('0xa1')]||0x12c),'interval':_0xb5ad('0x98')});}return respondWithRpcPromise('Start',_0xb5ad('0xa2'),_0x7e352c);})['then'](function(_0x564659){respondWithRpcPromise('EventManager',_0xb5ad('0xa3'),{'event':'notify','message':_0x564659},client9002);return _0x564659;})[_0xb5ad('0x35')](respondWithResult(_0x1330c8,null))[_0xb5ad('0x28')](handleError(_0x1330c8,null));};exports[_0xb5ad('0xa4')]=function(_0xfb8134,_0xb02340){var _0x2d0af0=_0xfb8134[_0xb5ad('0x57')]['id'];var _0x376531=_0xfb8134[_0xb5ad('0x5e')];var _0x51a715=0xc8;var _0x49b883=null;return db['sequelize'][_0xb5ad('0xa5')]({'isolationLevel':db[_0xb5ad('0xa6')]['Transaction'][_0xb5ad('0xa7')][_0xb5ad('0xa8')]},function(_0x52b355){return db[_0xb5ad('0x41')][_0xb5ad('0x69')]({'where':{'id':_0x2d0af0},'transaction':_0x52b355})[_0xb5ad('0x35')](function(_0x51a1a5){if(_0x51a1a5){return db['OpenchannelApplication'][_0xb5ad('0x36')]({'where':{'OpenchannelAccountId':_0x2d0af0},'transaction':_0x52b355})[_0xb5ad('0x35')](function(){var _0x17643e=_[_0xb5ad('0x40')](_0x376531,function(_0x14ea64){_0x14ea64[_0xb5ad('0x66')]=_0x2d0af0;return _0x14ea64;});return db[_0xb5ad('0xa9')]['bulkCreate'](_0x17643e,{'transaction':_0x52b355});});}else{_0x51a715=0x194;_0x49b883=[];}});})[_0xb5ad('0x35')](function(){if(_0x51a715!==0x194){return db[_0xb5ad('0xa9')][_0xb5ad('0xaa')]({'where':{'OpenchannelAccountId':_0x2d0af0},'order':'priority'})[_0xb5ad('0x35')](function(_0xedbf6){_0x49b883=_0xedbf6;});}})[_0xb5ad('0x28')](function(_0x40bdec){_0x51a715=0x1f4;logger['error'](_0x40bdec[_0xb5ad('0x3a')]);if(_0x40bdec[_0xb5ad('0x3b')]){delete _0x40bdec[_0xb5ad('0x3b')];}_0x49b883=_0x40bdec;})['finally'](function(){if(_0x49b883===null){_0xb02340[_0xb5ad('0x29')](_0x51a715);}else{if(_0x51a715===0x1f4){_0xb02340['status'](_0x51a715)[_0xb5ad('0x3c')](_0x49b883);}else{_0xb02340[_0xb5ad('0x2b')](_0x51a715)['json'](_0x49b883);}}});};exports['getApplications']=function(_0x51c82a,_0x30b84b,_0x27f2be){var _0x18c7ee={};var _0x2ec5b8={};var _0x5c8850;var _0xcc4890;return db[_0xb5ad('0x41')][_0xb5ad('0x69')]({'where':{'id':_0x51c82a['params']['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0x30b84b,null))[_0xb5ad('0x35')](function(_0x25cee9){if(_0x25cee9){_0x5c8850=_0x25cee9;_0x2ec5b8[_0xb5ad('0x46')]=_['keys'](db[_0xb5ad('0xa9')][_0xb5ad('0x59')]);_0x2ec5b8['query']=_[_0xb5ad('0x58')](_0x51c82a[_0xb5ad('0x43')]);_0x2ec5b8[_0xb5ad('0x44')]=_[_0xb5ad('0x45')](_0x2ec5b8['model'],_0x2ec5b8[_0xb5ad('0x43')]);_0x18c7ee[_0xb5ad('0x47')]=_[_0xb5ad('0x45')](_0x2ec5b8[_0xb5ad('0x46')],qs[_0xb5ad('0x5a')](_0x51c82a[_0xb5ad('0x43')][_0xb5ad('0x5a')]));_0x18c7ee[_0xb5ad('0x47')]=_0x18c7ee[_0xb5ad('0x47')][_0xb5ad('0x48')]?_0x18c7ee[_0xb5ad('0x47')]:_0x2ec5b8[_0xb5ad('0x46')];_0x18c7ee[_0xb5ad('0x4b')]=qs[_0xb5ad('0x4c')](_0x51c82a[_0xb5ad('0x43')]['sort']);_0x18c7ee['where']=qs[_0xb5ad('0x44')](_['pick'](_0x51c82a[_0xb5ad('0x43')],_0x2ec5b8['filters']));if(_0x51c82a[_0xb5ad('0x43')][_0xb5ad('0x52')]){_0x18c7ee[_0xb5ad('0x4d')]=_[_0xb5ad('0x4f')](_0x18c7ee[_0xb5ad('0x4d')],{'$or':_[_0xb5ad('0x40')](_0x18c7ee[_0xb5ad('0x47')],function(_0x4a4396){var _0x447fe7={};_0x447fe7[_0x4a4396]={'$like':'%'+_0x51c82a[_0xb5ad('0x43')][_0xb5ad('0x52')]+'%'};return _0x447fe7;})});}_0x18c7ee=_[_0xb5ad('0x4f')]({},_0x18c7ee,_0x51c82a[_0xb5ad('0x5b')]);return _0x5c8850[_0xb5ad('0xab')](_0x18c7ee);}})[_0xb5ad('0x35')](function(_0x31c317){if(_0x31c317){_0xcc4890=_0x31c317[_0xb5ad('0x48')];if(!_0x51c82a[_0xb5ad('0x43')]['hasOwnProperty'](_0xb5ad('0x4a'))){_0x18c7ee[_0xb5ad('0x2e')]=qs[_0xb5ad('0x2e')](_0x51c82a[_0xb5ad('0x43')][_0xb5ad('0x2e')]);_0x18c7ee['offset']=qs[_0xb5ad('0x30')](_0x51c82a['query'][_0xb5ad('0x30')]);}return _0x5c8850[_0xb5ad('0xab')](_0x18c7ee);}})[_0xb5ad('0x35')](function(_0x4b9404){if(_0x4b9404){return _0x4b9404?{'count':_0xcc4890,'rows':_0x4b9404}:null;}})[_0xb5ad('0x35')](respondWithResult(_0x30b84b,null))[_0xb5ad('0x28')](handleError(_0x30b84b,null));};exports[_0xb5ad('0xac')]=function(_0x4fa1fd,_0x14662a,_0x4c54cb){var _0x4c3ffb={'raw':![],'where':{}};var _0x59b116={};var _0x2a3ffe={'count':0x0,'rows':[]};return db[_0xb5ad('0x41')][_0xb5ad('0x69')]({'where':{'id':_0x4fa1fd[_0xb5ad('0x57')]['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0x14662a,null))[_0xb5ad('0x35')](function(_0x482672){if(_0x482672){_0x59b116[_0xb5ad('0x46')]=_[_0xb5ad('0x58')](db['OpenchannelInteraction']['rawAttributes']);_0x59b116[_0xb5ad('0x43')]=_['keys'](_0x4fa1fd[_0xb5ad('0x43')]);_0x59b116['filters']=_[_0xb5ad('0x45')](_0x59b116['model'],_0x59b116['query']);_0x4c3ffb[_0xb5ad('0x47')]=_[_0xb5ad('0x45')](_0x59b116[_0xb5ad('0x46')],qs[_0xb5ad('0x5a')](_0x4fa1fd[_0xb5ad('0x43')][_0xb5ad('0x5a')]));_0x4c3ffb[_0xb5ad('0x47')]=_0x4c3ffb[_0xb5ad('0x47')][_0xb5ad('0x48')]?_0x4c3ffb[_0xb5ad('0x47')]:_0x59b116[_0xb5ad('0x46')];if(!_0x4fa1fd[_0xb5ad('0x43')][_0xb5ad('0x49')](_0xb5ad('0x4a'))){_0x4c3ffb[_0xb5ad('0x2e')]=qs['limit'](_0x4fa1fd[_0xb5ad('0x43')][_0xb5ad('0x2e')]);_0x4c3ffb[_0xb5ad('0x30')]=qs[_0xb5ad('0x30')](_0x4fa1fd[_0xb5ad('0x43')][_0xb5ad('0x30')]);}_0x4c3ffb[_0xb5ad('0x4b')]=qs['sort'](_0x4fa1fd['query'][_0xb5ad('0x4c')]);_0x4c3ffb[_0xb5ad('0x4d')]=qs['filters'](_[_0xb5ad('0x4e')](_0x4fa1fd[_0xb5ad('0x43')],_0x59b116[_0xb5ad('0x44')]));_0x4c3ffb[_0xb5ad('0x4d')]['OpenchannelAccountId']=_0x482672['id'];if(_0x4fa1fd[_0xb5ad('0x43')]['filter']){_0x4c3ffb[_0xb5ad('0x4d')]=_['merge'](_0x4c3ffb[_0xb5ad('0x4d')],{'$or':_[_0xb5ad('0x40')](_0x4c3ffb[_0xb5ad('0x47')],function(_0x3987e8){var _0x54a92d={};_0x54a92d[_0x3987e8]={'$like':'%'+_0x4fa1fd[_0xb5ad('0x43')][_0xb5ad('0x52')]+'%'};return _0x54a92d;})});}_0x4c3ffb=_[_0xb5ad('0x4f')]({},_0x4c3ffb,_0x4fa1fd[_0xb5ad('0x5b')]);return db[_0xb5ad('0x8d')][_0xb5ad('0x2f')]({'where':_0x4c3ffb[_0xb5ad('0x4d')]})['then'](function(_0xbcef4d){_0x2a3ffe[_0xb5ad('0x2f')]=_0xbcef4d;if(_0x4fa1fd[_0xb5ad('0x43')][_0xb5ad('0x53')]){_0x4c3ffb[_0xb5ad('0x54')]=[{'model':db[_0xb5ad('0x70')],'as':'Contact','required':![]},{'model':db[_0xb5ad('0x9b')],'as':_0xb5ad('0xad'),'attributes':[_0xb5ad('0x3b'),_0xb5ad('0xae'),'internal'],'required':![]},{'model':db[_0xb5ad('0xaf')],'as':_0xb5ad('0xb0'),'attributes':['id',_0xb5ad('0x3b'),_0xb5ad('0xb1')],'where':_0x4fa1fd['query'][_0xb5ad('0xb2')]?{'id':_0x4fa1fd[_0xb5ad('0x43')]['tag']}:undefined,'required':_0x4fa1fd['query'][_0xb5ad('0xb2')]?!![]:![]}];}return db[_0xb5ad('0x8d')][_0xb5ad('0x55')](_0x4c3ffb);})['then'](function(_0x40f93e){_0x2a3ffe[_0xb5ad('0x56')]=_0x40f93e;return _0x2a3ffe;});}})[_0xb5ad('0x35')](respondWithFilteredResult(_0x14662a,_0x4c3ffb))[_0xb5ad('0x28')](handleError(_0x14662a,null));};exports['addAgents']=function(_0x3c57f0,_0x1b2966,_0x1de148){return db[_0xb5ad('0x41')]['find']({'where':{'id':_0x3c57f0['params']['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0x1b2966,null))[_0xb5ad('0x35')](function(_0x4fc80e){if(_0x4fc80e){return _0x4fc80e[_0xb5ad('0xb3')](_0x3c57f0['body'][_0xb5ad('0xb4')],_['omit'](_0x3c57f0[_0xb5ad('0x5e')],['ids','id'])||{})['spread'](function(_0x12a5d5){for(var _0x594f82=0x0;_0x594f82<_0x3c57f0[_0xb5ad('0x5e')][_0xb5ad('0xb4')][_0xb5ad('0x48')];_0x594f82+=0x1){socket['emit'](_0xb5ad('0xb5'),{'UserId':Number(_0x3c57f0['body'][_0xb5ad('0xb4')][_0x594f82]),'OpenchannelAccountId':Number(_0x3c57f0[_0xb5ad('0x57')]['id'])});}return _0x12a5d5;});}})[_0xb5ad('0x35')](respondWithResult(_0x1b2966,null))[_0xb5ad('0x28')](handleError(_0x1b2966,null));};exports[_0xb5ad('0xb6')]=function(_0x4a2610,_0x30af53,_0x3797b3){return db['OpenchannelAccount'][_0xb5ad('0x5c')]({'where':{'id':_0x4a2610['params']['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0x30af53,null))[_0xb5ad('0x35')](function(_0x2be714){if(_0x2be714){return _0x2be714[_0xb5ad('0xb6')](_0x4a2610[_0xb5ad('0x43')][_0xb5ad('0xb4')])['then'](function(){if(_[_0xb5ad('0xb7')](_0x4a2610[_0xb5ad('0x43')][_0xb5ad('0xb4')])){for(var _0x3b3e2e=0x0;_0x3b3e2e<_0x4a2610[_0xb5ad('0x43')][_0xb5ad('0xb4')][_0xb5ad('0x48')];_0x3b3e2e+=0x1){socket[_0xb5ad('0xb8')](_0xb5ad('0xb9'),{'UserId':Number(_0x4a2610[_0xb5ad('0x43')]['ids'][_0x3b3e2e]),'OpenchannelAccountId':Number(_0x4a2610[_0xb5ad('0x57')]['id'])});}}else{socket[_0xb5ad('0xb8')](_0xb5ad('0xb9'),{'UserId':Number(_0x4a2610[_0xb5ad('0x43')][_0xb5ad('0xb4')]),'OpenchannelAccountId':Number(_0x4a2610[_0xb5ad('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x30af53,null))['catch'](handleError(_0x30af53,null));};exports['getAgents']=function(_0x110e30,_0x3ee1e8,_0x52a536){var _0x19f074={};var _0x5e3c9d={};var _0x2698d0;var _0x4329b0;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x110e30['params']['id']}})[_0xb5ad('0x35')](handleEntityNotFound(_0x3ee1e8,null))[_0xb5ad('0x35')](function(_0x35c880){if(_0x35c880){_0x2698d0=_0x35c880;_0x5e3c9d['model']=_['keys'](db[_0xb5ad('0x9b')][_0xb5ad('0x59')]);_0x5e3c9d[_0xb5ad('0x43')]=_[_0xb5ad('0x58')](_0x110e30[_0xb5ad('0x43')]);_0x5e3c9d[_0xb5ad('0x44')]=_[_0xb5ad('0x45')](_0x5e3c9d[_0xb5ad('0x46')],_0x5e3c9d[_0xb5ad('0x43')]);_0x19f074[_0xb5ad('0x47')]=_[_0xb5ad('0x45')](_0x5e3c9d['model'],qs[_0xb5ad('0x5a')](_0x110e30['query'][_0xb5ad('0x5a')]));_0x19f074[_0xb5ad('0x47')]=_0x19f074['attributes'][_0xb5ad('0x48')]?_0x19f074[_0xb5ad('0x47')]:_0x5e3c9d[_0xb5ad('0x46')];_0x19f074['order']=qs['sort'](_0x110e30[_0xb5ad('0x43')][_0xb5ad('0x4c')]);_0x19f074[_0xb5ad('0x4d')]=qs['filters'](_[_0xb5ad('0x4e')](_0x110e30[_0xb5ad('0x43')],_0x5e3c9d[_0xb5ad('0x44')]));if(_0x110e30[_0xb5ad('0x43')][_0xb5ad('0x52')]){_0x19f074[_0xb5ad('0x4d')]=_[_0xb5ad('0x4f')](_0x19f074[_0xb5ad('0x4d')],{'$or':_[_0xb5ad('0x40')](_0x19f074['attributes'],function(_0x24cd74){var _0x115497={};_0x115497[_0x24cd74]={'$like':'%'+_0x110e30[_0xb5ad('0x43')][_0xb5ad('0x52')]+'%'};return _0x115497;})});}_0x19f074=_[_0xb5ad('0x4f')]({},_0x19f074,_0x110e30[_0xb5ad('0x5b')]);return _0x2698d0[_0xb5ad('0xba')](_0x19f074);}})['then'](function(_0x1d0d45){if(_0x1d0d45){_0x4329b0=_0x1d0d45[_0xb5ad('0x48')];if(!_0x110e30[_0xb5ad('0x43')]['hasOwnProperty']('nolimit')){_0x19f074[_0xb5ad('0x2e')]=qs[_0xb5ad('0x2e')](_0x110e30[_0xb5ad('0x43')][_0xb5ad('0x2e')]);_0x19f074['offset']=qs[_0xb5ad('0x30')](_0x110e30[_0xb5ad('0x43')][_0xb5ad('0x30')]);}return _0x2698d0['getAgents'](_0x19f074);}})[_0xb5ad('0x35')](function(_0x53d432){if(_0x53d432){return _0x53d432?{'count':_0x4329b0,'rows':_0x53d432}:null;}})[_0xb5ad('0x35')](respondWithResult(_0x3ee1e8,null))['catch'](handleError(_0x3ee1e8,null));};exports[_0xb5ad('0x3c')]=function(_0x5f336f,_0x42c128,_0x26a139){var _0x1146ca,_0x9ac50f,_0x5842ad;if(_[_0xb5ad('0x78')](_0x5f336f[_0xb5ad('0x5e')]['body'])||_0x5f336f[_0xb5ad('0x5e')][_0xb5ad('0x5e')]===''){throw new db[(_0xb5ad('0x71'))][(_0xb5ad('0x7a'))](_0xb5ad('0x7c'));}if(_['isNil'](_0x5f336f[_0xb5ad('0x5e')]['to'])){}_0x1146ca=_0x5f336f[_0xb5ad('0x5e')]['to'];return db['OpenchannelAccount'][_0xb5ad('0x69')]({'where':{'id':_0x5f336f[_0xb5ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x42c128,null))[_0xb5ad('0x35')](function(_0x576379){if(_0x576379){return db[_0xb5ad('0x41')]['find']({'where':{'id':_0x576379['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb5ad('0x70')],'as':_0xb5ad('0x82'),'where':{[_0x576379[_0xb5ad('0x7d')]]:_0x1146ca},'limit':0x1,'order':[[_0xb5ad('0x75'),'DESC']]}]}]})[_0xb5ad('0x35')](handleEntityNotFound(_0x42c128,null))[_0xb5ad('0x35')](function(_0x454884){if(_0x454884&&_0x454884[_0xb5ad('0x81')]){_0x9ac50f=_0x454884['get']({'plain':!![]});if(_0x9ac50f[_0xb5ad('0x81')]&&_0x9ac50f['List'][_0xb5ad('0x82')][_0xb5ad('0x48')]){return _0x9ac50f[_0xb5ad('0x81')]['Contacts'][0x0];}return db[_0xb5ad('0x70')][_0xb5ad('0x5d')](_[_0xb5ad('0x17')](_0x5f336f[_0xb5ad('0x5e')],{'firstName':_0x1146ca,[_0x454884[_0xb5ad('0x7d')]]:_0x1146ca,'phone':_0x1146ca,'ListId':_0x9ac50f['ListId']}));}})[_0xb5ad('0x35')](handleEntityNotFound(_0x42c128,null))[_0xb5ad('0x35')](function(_0x7ea038){if(_0x7ea038){_0x5842ad=_0x7ea038;return db[_0xb5ad('0x8d')][_0xb5ad('0x5c')]({'where':{'ContactId':_0x5842ad['id'],'closed':![],'OpenchannelAccountId':_0x9ac50f['id']}})[_0xb5ad('0x35')](function(_0x29c21c){if(_0x29c21c){return[_0x29c21c,![]];}return db[_0xb5ad('0x8d')][_0xb5ad('0x5d')]({'UserId':_0x5f336f[_0xb5ad('0x60')]['id'],'ContactId':_0x5842ad['id'],'OpenchannelAccountId':_0x9ac50f['id'],'lastMsgDirection':_0xb5ad('0xbb'),'firstMsgDirection':'out','Messages':[_[_0xb5ad('0x4f')](_0x5f336f[_0xb5ad('0x5e')],{'read':![],'body':_0x5f336f['body'][_0xb5ad('0x5e')],'OpenchannelAccountId':_0x9ac50f['id'],'UserId':_0x5f336f[_0xb5ad('0x60')]['id'],'ContactId':_0x5842ad['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xb5ad('0xbc')}]})[_0xb5ad('0x35')](function(_0x420133){return[_0x420133,!![]];});});}})[_0xb5ad('0x91')](function(_0xfaf312,_0x339456){if(_0x339456){return _0xfaf312;}return db[_0xb5ad('0x99')]['create'](_['merge'](_0x5f336f[_0xb5ad('0x5e')],{'read':![],'body':_0x5f336f[_0xb5ad('0x5e')]['body'],'OpenchannelAccountId':_0x9ac50f['id'],'OpenchannelInteractionId':_0xfaf312['id'],'UserId':_0x5f336f['user']['id'],'ContactId':_0x5842ad['id']}))[_0xb5ad('0x35')](function(_0x16860c){_0xfaf312[_0xb5ad('0xbd')][_0xb5ad('0xbc')]=[];_0xfaf312[_0xb5ad('0xbd')][_0xb5ad('0xbc')]['push'](_0x16860c['dataValues']);return _0xfaf312;});});}})[_0xb5ad('0x35')](respondWithResult(_0x42c128,null))[_0xb5ad('0x28')](handleError(_0x42c128,null));}; \ No newline at end of file +var _0x421f=['error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','OpenchannelAccounts','destroy','sendStatus','name','send','index','mandatoryDispositionPause','OpenchannelAccount','fieldName','type','model','keys','query','intersection','attributes','length','nolimit','order','sort','filters','pick','where','merge','map','filter','findAll','show','params','rawAttributes','fields','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','Disposition','findOne','hasOwnProperty','OpenchannelAccountId','rows','removeDispositions','ids','CannedAnswer','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','Sequelize','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','contact','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','firstName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','out','OpenchannelMessage','spread','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x39e5e9,_0x24885f){var _0x3bce63=function(_0x4a06e5){while(--_0x4a06e5){_0x39e5e9['push'](_0x39e5e9['shift']());}};_0x3bce63(++_0x24885f);}(_0x421f,0x160));var _0xf421=function(_0xaf114d,_0x2bf02f){_0xaf114d=_0xaf114d-0x0;var _0x3fa697=_0x421f[_0xaf114d];return _0x3fa697;};'use strict';var emlformat=require(_0xf421('0x0'));var rimraf=require(_0xf421('0x1'));var zipdir=require(_0xf421('0x2'));var jsonpatch=require(_0xf421('0x3'));var rp=require(_0xf421('0x4'));var moment=require(_0xf421('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf421('0x6'));var sox=require(_0xf421('0x7'));var csv=require(_0xf421('0x8'));var ejs=require(_0xf421('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf421('0xa'));var squel=require(_0xf421('0xb'));var crypto=require(_0xf421('0xc'));var jsforce=require(_0xf421('0xd'));var deskjs=require(_0xf421('0xe'));var toCsv=require(_0xf421('0x8'));var querystring=require(_0xf421('0xf'));var Papa=require(_0xf421('0x10'));var Redis=require(_0xf421('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf421('0x12'));var as=require(_0xf421('0x13'));var hardwareService=require(_0xf421('0x14'));var logger=require(_0xf421('0x15'))(_0xf421('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf421('0x17'));var db=require(_0xf421('0x18'))['db'];config['redis']=_[_0xf421('0x19')](config[_0xf421('0x1a')],{'host':_0xf421('0x1b'),'port':0x18eb});var socket=require(_0xf421('0x1c'))(new Redis(config[_0xf421('0x1a')]));require('./openchannelAccount.socket')[_0xf421('0x1d')](socket);var jayson=require(_0xf421('0x1e'));var client=jayson[_0xf421('0x1f')][_0xf421('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e784f,_0xb6aad8,_0x3f26e4,_0x4ff565){return new BPromise(function(_0x48b985,_0x13c3ce){var _0x47bf6b=_0x4ff565||client;return _0x47bf6b[_0xf421('0x21')](_0x1e784f,_0x3f26e4)['then'](function(_0x1d6a39){logger[_0xf421('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0xb6aad8,_0xf421('0x23'));logger['debug'](_0xf421('0x24'),_0xb6aad8,_0xf421('0x23'),JSON[_0xf421('0x25')](_0x1d6a39));if(_0x1d6a39[_0xf421('0x26')]){if(_0x1d6a39['error'][_0xf421('0x27')]===0x1f4){logger[_0xf421('0x26')](_0xf421('0x28'),_0xb6aad8,_0x1d6a39[_0xf421('0x26')]['message']);return _0x13c3ce(_0x1d6a39[_0xf421('0x26')]['message']);}logger['error'](_0xf421('0x28'),_0xb6aad8,_0x1d6a39['error']['message']);return _0x48b985(_0x1d6a39[_0xf421('0x26')][_0xf421('0x29')]);}else{logger['info'](_0xf421('0x28'),_0xb6aad8,_0xf421('0x23'));_0x48b985(_0x1d6a39[_0xf421('0x2a')]['message']);}})[_0xf421('0x2b')](function(_0x52fa35){logger[_0xf421('0x26')](_0xf421('0x28'),_0xb6aad8,_0x52fa35);_0x13c3ce(_0x52fa35);});});}function respondWithStatusCode(_0x2f7efc,_0x2e96d3){_0x2e96d3=_0x2e96d3||0xcc;return function(_0x5240b6){if(_0x5240b6){return _0x2f7efc['sendStatus'](_0x2e96d3);}return _0x2f7efc[_0xf421('0x2c')](_0x2e96d3)[_0xf421('0x2d')]();};}function respondWithResult(_0x1ce3e3,_0x2dcccf){_0x2dcccf=_0x2dcccf||0xc8;return function(_0x393ef3){if(_0x393ef3){return _0x1ce3e3[_0xf421('0x2c')](_0x2dcccf)[_0xf421('0x2e')](_0x393ef3);}};}function respondWithFilteredResult(_0x21134f,_0x47f060){return function(_0x307d7f){if(_0x307d7f){var _0x27ae3a=typeof _0x47f060[_0xf421('0x2f')]===_0xf421('0x30')&&typeof _0x47f060[_0xf421('0x31')]===_0xf421('0x30');var _0x50a03f=_0x307d7f[_0xf421('0x32')];var _0x38b1ea=_0x27ae3a?0x0:_0x47f060['offset'];var _0x3fcab8=_0x27ae3a?_0x307d7f['count']:_0x47f060[_0xf421('0x2f')]+_0x47f060[_0xf421('0x31')];var _0x34e758;if(_0x3fcab8>=_0x50a03f){_0x3fcab8=_0x50a03f;_0x34e758=0xc8;}else{_0x34e758=0xce;}_0x21134f[_0xf421('0x2c')](_0x34e758);return _0x21134f['set'](_0xf421('0x33'),_0x38b1ea+'-'+_0x3fcab8+'/'+_0x50a03f)['json'](_0x307d7f);}return null;};}function patchUpdates(_0x421b35){return function(_0x55ae3c){try{jsonpatch[_0xf421('0x34')](_0x55ae3c,_0x421b35,!![]);}catch(_0x40bed3){return BPromise[_0xf421('0x35')](_0x40bed3);}return _0x55ae3c['save']();};}function saveUpdates(_0x567c25,_0x5658c1){return function(_0xa7273c){if(_0xa7273c){return _0xa7273c[_0xf421('0x36')](_0x567c25)[_0xf421('0x37')](function(_0x4791cc){return _0x4791cc;});}return null;};}function removeEntity(_0x2d4a22,_0x553c3e){return function(_0x55fb77){if(_0x55fb77){return _0x55fb77['destroy']()[_0xf421('0x37')](function(){var _0x1fd862=_0x55fb77[_0xf421('0x38')]({'plain':!![]});var _0x438f5b=_0xf421('0x39');return db['UserProfileResource'][_0xf421('0x3a')]({'where':{'type':_0x438f5b,'resourceId':_0x1fd862['id']}})[_0xf421('0x37')](function(){return _0x55fb77;});})[_0xf421('0x37')](function(){_0x2d4a22[_0xf421('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d08ca,_0x328a2b){return function(_0x18bb75){if(!_0x18bb75){_0x9d08ca[_0xf421('0x3b')](0x194);}return _0x18bb75;};}function handleError(_0x4f9281,_0x2fe6b1){_0x2fe6b1=_0x2fe6b1||0x1f4;return function(_0x82d3e1){logger[_0xf421('0x26')](_0x82d3e1['stack']);if(_0x82d3e1[_0xf421('0x3c')]){delete _0x82d3e1[_0xf421('0x3c')];}_0x4f9281[_0xf421('0x2c')](_0x2fe6b1)[_0xf421('0x3d')](_0x82d3e1);};}exports[_0xf421('0x3e')]=function(_0x17a649,_0x576f0d){var _0x46e337={'include':[{'model':db['Pause'],'as':_0xf421('0x3f')}]},_0x2b294e={},_0x4f59db={'count':0x0,'rows':[]};var _0x3827ec=_['map'](db[_0xf421('0x40')]['rawAttributes'],function(_0x143cf8){return{'name':_0x143cf8[_0xf421('0x41')],'type':_0x143cf8[_0xf421('0x42')]['key']};});_0x2b294e[_0xf421('0x43')]=_['map'](_0x3827ec,'name');_0x2b294e['query']=_[_0xf421('0x44')](_0x17a649[_0xf421('0x45')]);_0x2b294e['filters']=_[_0xf421('0x46')](_0x2b294e['model'],_0x2b294e[_0xf421('0x45')]);_0x46e337[_0xf421('0x47')]=_[_0xf421('0x46')](_0x2b294e[_0xf421('0x43')],qs['fields'](_0x17a649[_0xf421('0x45')]['fields']));_0x46e337[_0xf421('0x47')]=_0x46e337['attributes'][_0xf421('0x48')]?_0x46e337['attributes']:_0x2b294e[_0xf421('0x43')];if(!_0x17a649[_0xf421('0x45')]['hasOwnProperty'](_0xf421('0x49'))){_0x46e337['limit']=qs[_0xf421('0x31')](_0x17a649[_0xf421('0x45')][_0xf421('0x31')]);_0x46e337[_0xf421('0x2f')]=qs[_0xf421('0x2f')](_0x17a649[_0xf421('0x45')][_0xf421('0x2f')]);}_0x46e337[_0xf421('0x4a')]=qs[_0xf421('0x4b')](_0x17a649[_0xf421('0x45')]['sort']);_0x46e337['where']=qs[_0xf421('0x4c')](_[_0xf421('0x4d')](_0x17a649[_0xf421('0x45')],_0x2b294e['filters']),_0x3827ec);if(_0x17a649[_0xf421('0x45')]['filter']){_0x46e337[_0xf421('0x4e')]=_[_0xf421('0x4f')](_0x46e337[_0xf421('0x4e')],{'$or':_[_0xf421('0x50')](_0x3827ec,function(_0x28ca49){if(_0x28ca49[_0xf421('0x42')]!=='VIRTUAL'){var _0x3036ba={};_0x3036ba[_0x28ca49[_0xf421('0x3c')]]={'$like':'%'+_0x17a649['query'][_0xf421('0x51')]+'%'};return _0x3036ba;}})});}_0x46e337=_[_0xf421('0x4f')]({},_0x46e337,_0x17a649['options']);var _0x3ca6fa={'where':_0x46e337[_0xf421('0x4e')]};return db['OpenchannelAccount'][_0xf421('0x32')](_0x3ca6fa)[_0xf421('0x37')](function(_0x39be1f){_0x4f59db[_0xf421('0x32')]=_0x39be1f;if(_0x17a649[_0xf421('0x45')]['includeAll']){_0x46e337['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xf421('0x52')](_0x46e337);})[_0xf421('0x37')](function(_0x5df6f6){_0x4f59db['rows']=_0x5df6f6;return _0x4f59db;})['then'](respondWithFilteredResult(_0x576f0d,_0x46e337))[_0xf421('0x2b')](handleError(_0x576f0d,null));};exports[_0xf421('0x53')]=function(_0x35ca06,_0x1d069c){var _0x4cc850={'raw':![],'where':{'id':_0x35ca06[_0xf421('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xf421('0x3f')}]},_0x27279e={};_0x27279e['model']=_[_0xf421('0x44')](db[_0xf421('0x40')][_0xf421('0x55')]);_0x27279e[_0xf421('0x45')]=_['keys'](_0x35ca06[_0xf421('0x45')]);_0x27279e[_0xf421('0x4c')]=_[_0xf421('0x46')](_0x27279e['model'],_0x27279e[_0xf421('0x45')]);_0x4cc850['attributes']=_['intersection'](_0x27279e[_0xf421('0x43')],qs[_0xf421('0x56')](_0x35ca06[_0xf421('0x45')][_0xf421('0x56')]));_0x4cc850[_0xf421('0x47')]=_0x4cc850[_0xf421('0x47')]['length']?_0x4cc850[_0xf421('0x47')]:_0x27279e[_0xf421('0x43')];if(_0x35ca06[_0xf421('0x45')][_0xf421('0x57')]){_0x4cc850[_0xf421('0x58')]=[{'all':!![]}];}_0x4cc850=_[_0xf421('0x4f')]({},_0x4cc850,_0x35ca06[_0xf421('0x59')]);return db[_0xf421('0x40')][_0xf421('0x5a')](_0x4cc850)['then'](handleEntityNotFound(_0x1d069c,null))['then'](respondWithResult(_0x1d069c,null))[_0xf421('0x2b')](handleError(_0x1d069c,null));};exports[_0xf421('0x5b')]=function(_0x4483d5,_0x18b9b6){return db[_0xf421('0x40')][_0xf421('0x5b')](_0x4483d5['body'],{})[_0xf421('0x37')](function(_0x4dbc4c){var _0x357a5f=_0x4483d5[_0xf421('0x5c')][_0xf421('0x38')]({'plain':!![]});if(!_0x357a5f)throw new Error(_0xf421('0x5d'));if(_0x357a5f[_0xf421('0x5e')]===_0xf421('0x5c')){var _0x5cf208=_0x4dbc4c[_0xf421('0x38')]({'plain':!![]});var _0x9de23f=_0xf421('0x39');return db[_0xf421('0x5f')]['find']({'where':{'name':_0x9de23f,'userProfileId':_0x357a5f[_0xf421('0x60')]},'raw':!![]})['then'](function(_0xf1a280){if(_0xf1a280&&_0xf1a280[_0xf421('0x61')]===0x0){return db[_0xf421('0x62')]['create']({'name':_0x5cf208[_0xf421('0x3c')],'resourceId':_0x5cf208['id'],'type':_0xf1a280[_0xf421('0x3c')],'sectionId':_0xf1a280['id']},{})[_0xf421('0x37')](function(){return _0x4dbc4c;});}else{return _0x4dbc4c;}})[_0xf421('0x2b')](function(_0x351c19){logger[_0xf421('0x26')](_0xf421('0x63'),_0x351c19);throw _0x351c19;});}return _0x4dbc4c;})[_0xf421('0x37')](respondWithResult(_0x18b9b6,0xc9))[_0xf421('0x2b')](handleError(_0x18b9b6,null));};exports[_0xf421('0x36')]=function(_0x55c2ab,_0x5a4a6e){if(_0x55c2ab[_0xf421('0x64')]['id']){delete _0x55c2ab['body']['id'];}return db[_0xf421('0x40')][_0xf421('0x5a')]({'where':{'id':_0x55c2ab[_0xf421('0x54')]['id']},'include':[{'model':db[_0xf421('0x65')],'as':_0xf421('0x3f')}]})['then'](handleEntityNotFound(_0x5a4a6e,null))[_0xf421('0x37')](saveUpdates(_0x55c2ab['body'],null))['then'](respondWithResult(_0x5a4a6e,null))[_0xf421('0x2b')](handleError(_0x5a4a6e,null));};exports[_0xf421('0x3a')]=function(_0x5ade40,_0x275bb6){return db['OpenchannelAccount'][_0xf421('0x5a')]({'where':{'id':_0x5ade40[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x275bb6,null))['then'](removeEntity(_0x275bb6,null))['catch'](handleError(_0x275bb6,null));};exports[_0xf421('0x66')]=function(_0x4e0c7f,_0x44cc47){return db[_0xf421('0x40')]['describe']()[_0xf421('0x37')](respondWithResult(_0x44cc47,null))['catch'](handleError(_0x44cc47,null));};exports[_0xf421('0x67')]=function(_0x259f02,_0x3c8b3b,_0x3bd84b){if(_0x259f02['body']['id']){delete _0x259f02[_0xf421('0x64')]['id'];}return db[_0xf421('0x40')]['find']({'where':{'id':_0x259f02[_0xf421('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c8b3b,null))['then'](function(_0x2e14c0){if(_0x2e14c0){_0x259f02[_0xf421('0x64')]['OpenchannelAccountId']=_0x2e14c0['id'];return db[_0xf421('0x68')]['create'](_0x259f02['body']);}})['then'](respondWithResult(_0x3c8b3b,null))[_0xf421('0x2b')](handleError(_0x3c8b3b,null));};exports['getDispositions']=function(_0x4c8ff9,_0x16311a,_0x1264cc){var _0x46c1e1={'raw':![],'where':{}};var _0x5c68d0={};var _0xd5e555={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf421('0x69')]({'where':{'id':_0x4c8ff9[_0xf421('0x54')]['id']}})['then'](handleEntityNotFound(_0x16311a,null))[_0xf421('0x37')](function(_0x3da586){if(_0x3da586){_0x5c68d0[_0xf421('0x43')]=_['keys'](db[_0xf421('0x68')][_0xf421('0x55')]);_0x5c68d0[_0xf421('0x45')]=_[_0xf421('0x44')](_0x4c8ff9[_0xf421('0x45')]);_0x5c68d0['filters']=_[_0xf421('0x46')](_0x5c68d0[_0xf421('0x43')],_0x5c68d0[_0xf421('0x45')]);_0x46c1e1[_0xf421('0x47')]=_['intersection'](_0x5c68d0[_0xf421('0x43')],qs['fields'](_0x4c8ff9[_0xf421('0x45')][_0xf421('0x56')]));_0x46c1e1[_0xf421('0x47')]=_0x46c1e1[_0xf421('0x47')][_0xf421('0x48')]?_0x46c1e1[_0xf421('0x47')]:_0x5c68d0['model'];if(!_0x4c8ff9['query'][_0xf421('0x6a')](_0xf421('0x49'))){_0x46c1e1['limit']=qs[_0xf421('0x31')](_0x4c8ff9['query'][_0xf421('0x31')]);_0x46c1e1[_0xf421('0x2f')]=qs['offset'](_0x4c8ff9['query'][_0xf421('0x2f')]);}_0x46c1e1['order']=qs['sort'](_0x4c8ff9[_0xf421('0x45')][_0xf421('0x4b')]);_0x46c1e1[_0xf421('0x4e')]=qs[_0xf421('0x4c')](_[_0xf421('0x4d')](_0x4c8ff9[_0xf421('0x45')],_0x5c68d0[_0xf421('0x4c')]));_0x46c1e1[_0xf421('0x4e')][_0xf421('0x6b')]=_0x3da586['id'];if(_0x4c8ff9[_0xf421('0x45')]['filter']){_0x46c1e1[_0xf421('0x4e')]=_[_0xf421('0x4f')](_0x46c1e1[_0xf421('0x4e')],{'$or':_[_0xf421('0x50')](_0x46c1e1[_0xf421('0x47')],function(_0x979623){var _0x23684b={};_0x23684b[_0x979623]={'$like':'%'+_0x4c8ff9[_0xf421('0x45')][_0xf421('0x51')]+'%'};return _0x23684b;})});}_0x46c1e1=_['merge']({},_0x46c1e1,_0x4c8ff9[_0xf421('0x59')]);return db[_0xf421('0x68')][_0xf421('0x32')]({'where':_0x46c1e1['where']})[_0xf421('0x37')](function(_0x4f6aaf){_0xd5e555['count']=_0x4f6aaf;if(_0x4c8ff9['query']['includeAll']){_0x46c1e1[_0xf421('0x58')]=[{'all':!![]}];}return db[_0xf421('0x68')][_0xf421('0x52')](_0x46c1e1);})[_0xf421('0x37')](function(_0x2e1851){_0xd5e555[_0xf421('0x6c')]=_0x2e1851;return _0xd5e555;});}})[_0xf421('0x37')](respondWithFilteredResult(_0x16311a,_0x46c1e1))[_0xf421('0x2b')](handleError(_0x16311a,null));};exports[_0xf421('0x6d')]=function(_0x4252a6,_0x5273f9,_0x9e4825){return db['OpenchannelAccount']['find']({'where':{'id':_0x4252a6[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x5273f9,null))[_0xf421('0x37')](function(_0x47bb04){if(_0x47bb04){return _0x47bb04[_0xf421('0x6d')](_0x4252a6['query'][_0xf421('0x6e')]);}})[_0xf421('0x37')](respondWithStatusCode(_0x5273f9,null))[_0xf421('0x2b')](handleError(_0x5273f9,null));};exports['addAnswer']=function(_0x377c8c,_0x380dd4,_0x51ac75){if(_0x377c8c['body']['id']){delete _0x377c8c[_0xf421('0x64')]['id'];}return db[_0xf421('0x40')][_0xf421('0x5a')]({'where':{'id':_0x377c8c[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x380dd4,null))[_0xf421('0x37')](function(_0xb7c391){if(_0xb7c391){_0x377c8c[_0xf421('0x64')][_0xf421('0x6b')]=_0xb7c391['id'];return db[_0xf421('0x6f')][_0xf421('0x5b')](_0x377c8c['body']);}})['then'](respondWithResult(_0x380dd4,null))['catch'](handleError(_0x380dd4,null));};exports['getAnswers']=function(_0x599eb5,_0x324134,_0x4d06f6){var _0x29d63c={'raw':![],'where':{}};var _0xec67f7={};var _0x132665={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf421('0x69')]({'where':{'id':_0x599eb5['params']['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x324134,null))[_0xf421('0x37')](function(_0x10e740){if(_0x10e740){_0xec67f7[_0xf421('0x43')]=_[_0xf421('0x44')](db['CannedAnswer'][_0xf421('0x55')]);_0xec67f7[_0xf421('0x45')]=_[_0xf421('0x44')](_0x599eb5['query']);_0xec67f7[_0xf421('0x4c')]=_[_0xf421('0x46')](_0xec67f7[_0xf421('0x43')],_0xec67f7[_0xf421('0x45')]);_0x29d63c[_0xf421('0x47')]=_[_0xf421('0x46')](_0xec67f7[_0xf421('0x43')],qs[_0xf421('0x56')](_0x599eb5[_0xf421('0x45')]['fields']));_0x29d63c[_0xf421('0x47')]=_0x29d63c[_0xf421('0x47')]['length']?_0x29d63c['attributes']:_0xec67f7['model'];if(!_0x599eb5[_0xf421('0x45')][_0xf421('0x6a')](_0xf421('0x49'))){_0x29d63c[_0xf421('0x31')]=qs[_0xf421('0x31')](_0x599eb5[_0xf421('0x45')]['limit']);_0x29d63c[_0xf421('0x2f')]=qs[_0xf421('0x2f')](_0x599eb5[_0xf421('0x45')]['offset']);}_0x29d63c[_0xf421('0x4a')]=qs[_0xf421('0x4b')](_0x599eb5[_0xf421('0x45')][_0xf421('0x4b')]);_0x29d63c['where']=qs[_0xf421('0x4c')](_['pick'](_0x599eb5['query'],_0xec67f7['filters']));_0x29d63c[_0xf421('0x4e')]['OpenchannelAccountId']=_0x10e740['id'];if(_0x599eb5['query'][_0xf421('0x51')]){_0x29d63c['where']=_[_0xf421('0x4f')](_0x29d63c['where'],{'$or':_['map'](_0x29d63c[_0xf421('0x47')],function(_0x3b5fce){var _0x4f9b59={};_0x4f9b59[_0x3b5fce]={'$like':'%'+_0x599eb5[_0xf421('0x45')]['filter']+'%'};return _0x4f9b59;})});}_0x29d63c=_[_0xf421('0x4f')]({},_0x29d63c,_0x599eb5[_0xf421('0x59')]);return db['CannedAnswer']['count']({'where':_0x29d63c[_0xf421('0x4e')]})[_0xf421('0x37')](function(_0x5dad81){_0x132665['count']=_0x5dad81;if(_0x599eb5['query'][_0xf421('0x57')]){_0x29d63c[_0xf421('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf421('0x52')](_0x29d63c);})['then'](function(_0x4c470b){_0x132665[_0xf421('0x6c')]=_0x4c470b;return _0x132665;});}})[_0xf421('0x37')](respondWithFilteredResult(_0x324134,_0x29d63c))['catch'](handleError(_0x324134,null));};exports[_0xf421('0x70')]=function(_0x4a1cb8,_0x1371ee,_0x304de6){return db[_0xf421('0x40')]['find']({'where':{'id':_0x4a1cb8['params']['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x1371ee,null))[_0xf421('0x37')](function(_0x2d6229){if(_0x2d6229){return _0x2d6229[_0xf421('0x70')](_0x4a1cb8[_0xf421('0x45')]['ids']);}})[_0xf421('0x37')](respondWithStatusCode(_0x1371ee,null))['catch'](handleError(_0x1371ee,null));};exports[_0xf421('0x71')]=function(_0x28a439,_0x13bbd4,_0x5a45b0){var _0x45c137={'body':_0x28a439['body'],'channel':'openchannel'};var _0x41db4d=[];var _0x11d13f=[];var _0x30690c={};var _0x4cc41b=![];return db[_0xf421('0x72')]['describe']()['then'](function(_0x1c506d){if(!_0x1c506d){throw new db['Sequelize'][(_0xf421('0x73'))](_0xf421('0x74'));}_0x41db4d=_[_0xf421('0x75')](_[_0xf421('0x44')](_0x1c506d),['createdAt',_0xf421('0x76')]);_0x11d13f=_[_0xf421('0x75')](_[_0xf421('0x44')](_0x1c506d),['createdAt','updatedAt',_0xf421('0x77'),_0xf421('0x78')]);if(_0x28a439[_0xf421('0x64')]['id']){delete _0x28a439[_0xf421('0x64')]['id'];}if(_['isNil'](_0x28a439[_0xf421('0x64')][_0xf421('0x79')])){throw new db[(_0xf421('0x7a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xf421('0x7b')](_0x28a439['body'][_0xf421('0x64')])||_0x28a439['body']['body']===''){throw new db[(_0xf421('0x7a'))][(_0xf421('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf421('0x7b')](_0x28a439[_0xf421('0x64')][_0xf421('0x7c')])){throw new db['Sequelize'][(_0xf421('0x73'))](_0xf421('0x7d')+_0x11d13f);}if(!_[_0xf421('0x7e')](_0x11d13f,_0x28a439['body'][_0xf421('0x7c')])){throw new db[(_0xf421('0x7a'))][(_0xf421('0x73'))](_0xf421('0x7f')+_0x11d13f);}_0x30690c[_0x28a439[_0xf421('0x64')][_0xf421('0x7c')]]=_0x28a439[_0xf421('0x64')][_0xf421('0x79')];})[_0xf421('0x37')](function(){return db[_0xf421('0x40')]['find']({'where':{'id':_0x28a439['params']['id']},'include':[{'model':db[_0xf421('0x80')],'as':_0xf421('0x81'),'include':[{'model':db[_0xf421('0x72')],'as':_0xf421('0x82'),'where':_0x30690c,'limit':0x1,'order':[[_0xf421('0x76'),_0xf421('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0xf421('0x84')}]});})[_0xf421('0x37')](handleEntityNotFound(_0x13bbd4,null))[_0xf421('0x37')](function(_0x1d06c1){if(_0x1d06c1&&_0x1d06c1[_0xf421('0x81')]){_0x45c137[_0xf421('0x85')]=_0x1d06c1;_0x45c137[_0xf421('0x86')]=_0x1d06c1[_0xf421('0x84')];_0x45c137[_0xf421('0x87')]=_0x1d06c1['List'];_0x45c137[_0xf421('0x86')]=_[_0xf421('0x88')](_0x45c137[_0xf421('0x86')],['priority'],[_0xf421('0x89')]);if(_0x45c137['account'][_0xf421('0x84')]){delete _0x45c137['account']['Applications'];}if(_0x45c137[_0xf421('0x85')][_0xf421('0x81')]&&_0x45c137['account'][_0xf421('0x81')]['Contacts'][_0xf421('0x48')]){return _0x45c137[_0xf421('0x85')][_0xf421('0x81')]['Contacts'][0x0];}var _0x21dc4b=_[_0xf421('0x19')](_0x28a439[_0xf421('0x64')],{'firstName':_0x28a439[_0xf421('0x64')][_0xf421('0x79')],'ListId':_0x1d06c1['ListId']});_0x21dc4b[_0x28a439[_0xf421('0x64')][_0xf421('0x7c')]]=_0x28a439['body']['from'];return db[_0xf421('0x72')]['create'](_0x21dc4b,{'fields':_0x41db4d,'raw':!![]});}})[_0xf421('0x37')](handleEntityNotFound(_0x13bbd4,null))[_0xf421('0x37')](function(_0x57cd5b){_0x45c137[_0xf421('0x8a')]=_0x57cd5b;if(_0x57cd5b){var _0x3e5d68={'ContactId':_0x57cd5b['id'],'OpenchannelAccountId':_0x28a439[_0xf421('0x54')]['id'],'from':(_0x57cd5b['firstName']||'')+'\x20'+(_0x57cd5b[_0xf421('0x8b')]||'')};var _0x50f360={'OpenchannelAccountId':_0x28a439[_0xf421('0x54')]['id'],'closed':![]};if(_0x28a439[_0xf421('0x64')][_0xf421('0x8c')]){_0x50f360[_0xf421('0x8c')]=_0x28a439[_0xf421('0x64')][_0xf421('0x8c')];return db['OpenchannelInteraction'][_0xf421('0x5a')]({'where':_0x50f360})['then'](function(_0x352e27){if(_0x352e27){return[_0x352e27,![]];}_0x3e5d68['threadId']=_0x28a439['body'][_0xf421('0x8c')];_0x3e5d68['externalUrl']=_0x28a439['body'][_0xf421('0x8d')];return db['OpenchannelInteraction']['create'](_0x3e5d68)[_0xf421('0x37')](function(_0x3e1f5e){return[_0x3e1f5e,!![]];});});}else{_0x50f360['threadId']=null;}_0x50f360[_0xf421('0x8e')]=_0x57cd5b['id'];return db[_0xf421('0x8f')][_0xf421('0x5a')]({'where':_0x50f360})[_0xf421('0x37')](function(_0x24cbbb){if(_0x24cbbb){return[_0x24cbbb,![]];}return db[_0xf421('0x8f')][_0xf421('0x5b')](_0x3e5d68)['then'](function(_0x4fb387){return[_0x4fb387,!![]];});});}})['spread'](function(_0x33d259,_0x32f349){if(_0x33d259){_0x4cc41b=_0x32f349;if(!_0x32f349){var _0x5233f8={'from':(_0x45c137[_0xf421('0x8a')][_0xf421('0x90')]||'')+'\x20'+(_0x45c137[_0xf421('0x8a')][_0xf421('0x8b')]||'')};if(_0x28a439['body'][_0xf421('0x8c')]&&_0x28a439['body'][_0xf421('0x91')]&&_0x28a439[_0xf421('0x64')][_0xf421('0x8c')]!=_0x28a439['body']['messageId']){_0x5233f8[_0xf421('0x8c')]=_0x28a439['body']['messageId'];}return _0x33d259['update'](_0x5233f8);}else{return _0x33d259;}}})[_0xf421('0x37')](function(_0x5ff30b){_0x45c137['interaction']=_0x5ff30b[_0xf421('0x38')]({'plain':!![]});_0x45c137[_0xf421('0x92')][_0xf421('0x93')]=_0x4cc41b;if(_0x45c137[_0xf421('0x92')][_0xf421('0x93')]){if(_0x45c137[_0xf421('0x85')][_0xf421('0x94')]){_0x45c137['applications'][_0xf421('0x95')]({'id':0x0,'priority':_0x45c137[_0xf421('0x86')][_0xf421('0x48')]+0x1,'app':'close','appdata':_0xf421('0x96'),'interval':_0xf421('0x97')});}}return db['OpenchannelMessage'][_0xf421('0x5b')]({'body':_0x28a439[_0xf421('0x64')]['body'],'OpenchannelAccountId':_0x28a439[_0xf421('0x54')]['id'],'OpenchannelInteractionId':_0x5ff30b['id'],'direction':'in','ContactId':_0x45c137[_0xf421('0x8a')]['id'],'AttachmentId':_0x28a439[_0xf421('0x64')][_0xf421('0x98')]});})[_0xf421('0x37')](function(_0x3ac17b){_0x45c137[_0xf421('0x29')]=_0x3ac17b;if(!_0x45c137[_0xf421('0x92')][_0xf421('0x99')])return;return db[_0xf421('0x9a')][_0xf421('0x5a')]({'attributes':['id','name'],'where':{'id':_0x45c137[_0xf421('0x92')]['UserId']}});})[_0xf421('0x37')](function(_0x2ea593){if(_0x2ea593){_0x45c137[_0xf421('0x86')][_0xf421('0x9b')]({'id':0x0,'priority':0x0,'app':_0xf421('0x9c'),'appdata':_0x2ea593['name']+','+(_0x45c137[_0xf421('0x85')][_0xf421('0x9d')]||0xa),'interval':_0xf421('0x97')});}if(!_0x45c137['interaction'][_0xf421('0x9e')])return;return db[_0xf421('0x9f')][_0xf421('0x5a')]({'attributes':['id',_0xf421('0x3c')],'where':{'id':_0x45c137[_0xf421('0x92')][_0xf421('0x9e')]}});})['then'](function(_0x1440e9){if(_0x1440e9){_0x45c137['applications'][_0xf421('0x9b')]({'id':0x0,'priority':0x1,'app':_0xf421('0xa0'),'appdata':_0x1440e9[_0xf421('0x3c')]+','+(_0x45c137[_0xf421('0x85')][_0xf421('0xa1')]||0x12c),'interval':_0xf421('0x97')});}return respondWithRpcPromise(_0xf421('0xa2'),_0xf421('0xa3'),_0x45c137);})[_0xf421('0x37')](function(_0x212410){respondWithRpcPromise(_0xf421('0xa4'),'EventManager',{'event':'notify','message':_0x212410},client9002);return _0x212410;})[_0xf421('0x37')](respondWithResult(_0x13bbd4,null))[_0xf421('0x2b')](handleError(_0x13bbd4,null));};exports[_0xf421('0xa5')]=function(_0x457708,_0x22ec71){var _0xdad664=_0x457708[_0xf421('0x54')]['id'];var _0x221808=_0x457708[_0xf421('0x64')];var _0x3fbe0e=0xc8;var _0x429202=null;return db[_0xf421('0xa6')][_0xf421('0xa7')]({'isolationLevel':db[_0xf421('0xa6')][_0xf421('0xa8')][_0xf421('0xa9')][_0xf421('0xaa')]},function(_0x3d0c51){return db[_0xf421('0x40')][_0xf421('0x69')]({'where':{'id':_0xdad664},'transaction':_0x3d0c51})['then'](function(_0x1ce480){if(_0x1ce480){return db[_0xf421('0xab')][_0xf421('0x3a')]({'where':{'OpenchannelAccountId':_0xdad664},'transaction':_0x3d0c51})[_0xf421('0x37')](function(){var _0x18f505=_[_0xf421('0x50')](_0x221808,function(_0x20c048){_0x20c048[_0xf421('0x6b')]=_0xdad664;return _0x20c048;});return db[_0xf421('0xab')][_0xf421('0xac')](_0x18f505,{'transaction':_0x3d0c51});});}else{_0x3fbe0e=0x194;_0x429202=[];}});})[_0xf421('0x37')](function(){if(_0x3fbe0e!==0x194){return db['OpenchannelApplication'][_0xf421('0xad')]({'where':{'OpenchannelAccountId':_0xdad664},'order':_0xf421('0xae')})[_0xf421('0x37')](function(_0x411947){_0x429202=_0x411947;});}})['catch'](function(_0x2ed1d1){_0x3fbe0e=0x1f4;logger['error'](_0x2ed1d1[_0xf421('0xaf')]);if(_0x2ed1d1[_0xf421('0x3c')]){delete _0x2ed1d1[_0xf421('0x3c')];}_0x429202=_0x2ed1d1;})[_0xf421('0xb0')](function(){if(_0x429202===null){_0x22ec71['sendStatus'](_0x3fbe0e);}else{if(_0x3fbe0e===0x1f4){_0x22ec71['status'](_0x3fbe0e)[_0xf421('0x3d')](_0x429202);}else{_0x22ec71[_0xf421('0x2c')](_0x3fbe0e)[_0xf421('0x2e')](_0x429202);}}});};exports[_0xf421('0xb1')]=function(_0x193b0b,_0x1f6ba6,_0x2b5c6e){var _0xb6f1bf={};var _0x546e73={};var _0x4301a0;var _0x2f79b6;return db[_0xf421('0x40')]['findOne']({'where':{'id':_0x193b0b['params']['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x1f6ba6,null))['then'](function(_0x3a8376){if(_0x3a8376){_0x4301a0=_0x3a8376;_0x546e73['model']=_[_0xf421('0x44')](db[_0xf421('0xab')][_0xf421('0x55')]);_0x546e73[_0xf421('0x45')]=_[_0xf421('0x44')](_0x193b0b[_0xf421('0x45')]);_0x546e73[_0xf421('0x4c')]=_['intersection'](_0x546e73[_0xf421('0x43')],_0x546e73[_0xf421('0x45')]);_0xb6f1bf[_0xf421('0x47')]=_['intersection'](_0x546e73['model'],qs[_0xf421('0x56')](_0x193b0b[_0xf421('0x45')]['fields']));_0xb6f1bf[_0xf421('0x47')]=_0xb6f1bf[_0xf421('0x47')][_0xf421('0x48')]?_0xb6f1bf[_0xf421('0x47')]:_0x546e73[_0xf421('0x43')];_0xb6f1bf['order']=qs[_0xf421('0x4b')](_0x193b0b['query']['sort']);_0xb6f1bf[_0xf421('0x4e')]=qs[_0xf421('0x4c')](_[_0xf421('0x4d')](_0x193b0b[_0xf421('0x45')],_0x546e73[_0xf421('0x4c')]));if(_0x193b0b[_0xf421('0x45')]['filter']){_0xb6f1bf[_0xf421('0x4e')]=_[_0xf421('0x4f')](_0xb6f1bf[_0xf421('0x4e')],{'$or':_[_0xf421('0x50')](_0xb6f1bf['attributes'],function(_0x30783f){var _0x22dcae={};_0x22dcae[_0x30783f]={'$like':'%'+_0x193b0b[_0xf421('0x45')][_0xf421('0x51')]+'%'};return _0x22dcae;})});}_0xb6f1bf=_[_0xf421('0x4f')]({},_0xb6f1bf,_0x193b0b[_0xf421('0x59')]);return _0x4301a0['getApplications'](_0xb6f1bf);}})[_0xf421('0x37')](function(_0x281438){if(_0x281438){_0x2f79b6=_0x281438[_0xf421('0x48')];if(!_0x193b0b[_0xf421('0x45')]['hasOwnProperty']('nolimit')){_0xb6f1bf['limit']=qs['limit'](_0x193b0b['query'][_0xf421('0x31')]);_0xb6f1bf[_0xf421('0x2f')]=qs[_0xf421('0x2f')](_0x193b0b[_0xf421('0x45')][_0xf421('0x2f')]);}return _0x4301a0[_0xf421('0xb1')](_0xb6f1bf);}})[_0xf421('0x37')](function(_0x4d3b63){if(_0x4d3b63){return _0x4d3b63?{'count':_0x2f79b6,'rows':_0x4d3b63}:null;}})[_0xf421('0x37')](respondWithResult(_0x1f6ba6,null))[_0xf421('0x2b')](handleError(_0x1f6ba6,null));};exports[_0xf421('0xb2')]=function(_0x2f0b63,_0x2c37a8,_0x44110f){var _0x2e557b={'raw':![],'where':{}};var _0x10e581={};var _0x525927={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf421('0x69')]({'where':{'id':_0x2f0b63['params']['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x2c37a8,null))[_0xf421('0x37')](function(_0x5bdfec){if(_0x5bdfec){_0x10e581[_0xf421('0x43')]=_[_0xf421('0x44')](db[_0xf421('0x8f')][_0xf421('0x55')]);_0x10e581[_0xf421('0x45')]=_['keys'](_0x2f0b63['query']);_0x10e581[_0xf421('0x4c')]=_['intersection'](_0x10e581['model'],_0x10e581['query']);_0x2e557b['attributes']=_['intersection'](_0x10e581[_0xf421('0x43')],qs[_0xf421('0x56')](_0x2f0b63['query']['fields']));_0x2e557b[_0xf421('0x47')]=_0x2e557b['attributes'][_0xf421('0x48')]?_0x2e557b[_0xf421('0x47')]:_0x10e581[_0xf421('0x43')];if(!_0x2f0b63[_0xf421('0x45')]['hasOwnProperty'](_0xf421('0x49'))){_0x2e557b[_0xf421('0x31')]=qs[_0xf421('0x31')](_0x2f0b63['query']['limit']);_0x2e557b['offset']=qs['offset'](_0x2f0b63[_0xf421('0x45')][_0xf421('0x2f')]);}_0x2e557b['order']=qs[_0xf421('0x4b')](_0x2f0b63[_0xf421('0x45')][_0xf421('0x4b')]);_0x2e557b['where']=qs['filters'](_[_0xf421('0x4d')](_0x2f0b63[_0xf421('0x45')],_0x10e581[_0xf421('0x4c')]));_0x2e557b[_0xf421('0x4e')][_0xf421('0x6b')]=_0x5bdfec['id'];if(_0x2f0b63['query'][_0xf421('0x51')]){_0x2e557b['where']=_[_0xf421('0x4f')](_0x2e557b[_0xf421('0x4e')],{'$or':_[_0xf421('0x50')](_0x2e557b[_0xf421('0x47')],function(_0x1d2096){var _0xaa04df={};_0xaa04df[_0x1d2096]={'$like':'%'+_0x2f0b63['query']['filter']+'%'};return _0xaa04df;})});}_0x2e557b=_[_0xf421('0x4f')]({},_0x2e557b,_0x2f0b63[_0xf421('0x59')]);return db[_0xf421('0x8f')]['count']({'where':_0x2e557b[_0xf421('0x4e')]})[_0xf421('0x37')](function(_0x4c7cdf){_0x525927[_0xf421('0x32')]=_0x4c7cdf;if(_0x2f0b63[_0xf421('0x45')]['includeAll']){_0x2e557b[_0xf421('0x58')]=[{'model':db[_0xf421('0x72')],'as':_0xf421('0xb3'),'required':![]},{'model':db['User'],'as':_0xf421('0xb4'),'attributes':[_0xf421('0x3c'),_0xf421('0xb5'),'internal'],'required':![]},{'model':db[_0xf421('0xb6')],'as':_0xf421('0xb7'),'attributes':['id',_0xf421('0x3c'),_0xf421('0xb8')],'where':_0x2f0b63[_0xf421('0x45')][_0xf421('0xb9')]?{'id':_0x2f0b63['query'][_0xf421('0xb9')]}:undefined,'required':_0x2f0b63[_0xf421('0x45')][_0xf421('0xb9')]?!![]:![]}];}return db[_0xf421('0x8f')][_0xf421('0x52')](_0x2e557b);})['then'](function(_0x4dd06f){_0x525927['rows']=_0x4dd06f;return _0x525927;});}})[_0xf421('0x37')](respondWithFilteredResult(_0x2c37a8,_0x2e557b))[_0xf421('0x2b')](handleError(_0x2c37a8,null));};exports['addAgents']=function(_0x52a271,_0x178feb,_0x41b069){return db[_0xf421('0x40')][_0xf421('0x5a')]({'where':{'id':_0x52a271[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x178feb,null))[_0xf421('0x37')](function(_0x161bf1){if(_0x161bf1){return _0x161bf1['addAgents'](_0x52a271[_0xf421('0x64')]['ids'],_['omit'](_0x52a271['body'],[_0xf421('0x6e'),'id'])||{})['spread'](function(_0x50c02a){for(var _0x4b5bdd=0x0;_0x4b5bdd<_0x52a271[_0xf421('0x64')][_0xf421('0x6e')][_0xf421('0x48')];_0x4b5bdd+=0x1){socket[_0xf421('0xba')](_0xf421('0xbb'),{'UserId':Number(_0x52a271[_0xf421('0x64')][_0xf421('0x6e')][_0x4b5bdd]),'OpenchannelAccountId':Number(_0x52a271[_0xf421('0x54')]['id'])});}return _0x50c02a;});}})[_0xf421('0x37')](respondWithResult(_0x178feb,null))['catch'](handleError(_0x178feb,null));};exports['removeAgents']=function(_0x2fe3c0,_0x21c937,_0x2a2598){return db[_0xf421('0x40')]['find']({'where':{'id':_0x2fe3c0[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x21c937,null))[_0xf421('0x37')](function(_0x582185){if(_0x582185){return _0x582185['removeAgents'](_0x2fe3c0[_0xf421('0x45')][_0xf421('0x6e')])[_0xf421('0x37')](function(){if(_[_0xf421('0xbc')](_0x2fe3c0[_0xf421('0x45')][_0xf421('0x6e')])){for(var _0x40a11f=0x0;_0x40a11f<_0x2fe3c0[_0xf421('0x45')][_0xf421('0x6e')]['length'];_0x40a11f+=0x1){socket[_0xf421('0xba')](_0xf421('0xbd'),{'UserId':Number(_0x2fe3c0['query'][_0xf421('0x6e')][_0x40a11f]),'OpenchannelAccountId':Number(_0x2fe3c0['params']['id'])});}}else{socket[_0xf421('0xba')](_0xf421('0xbd'),{'UserId':Number(_0x2fe3c0['query'][_0xf421('0x6e')]),'OpenchannelAccountId':Number(_0x2fe3c0[_0xf421('0x54')]['id'])});}});}})[_0xf421('0x37')](respondWithStatusCode(_0x21c937,null))[_0xf421('0x2b')](handleError(_0x21c937,null));};exports['getAgents']=function(_0x4ecad2,_0x3c3162,_0x29afc6){var _0x58ed1a={};var _0x371169={};var _0x36b63e;var _0x55db50;return db[_0xf421('0x40')][_0xf421('0x69')]({'where':{'id':_0x4ecad2[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0x3c3162,null))[_0xf421('0x37')](function(_0x1c0f3a){if(_0x1c0f3a){_0x36b63e=_0x1c0f3a;_0x371169[_0xf421('0x43')]=_[_0xf421('0x44')](db[_0xf421('0x9a')][_0xf421('0x55')]);_0x371169[_0xf421('0x45')]=_['keys'](_0x4ecad2[_0xf421('0x45')]);_0x371169[_0xf421('0x4c')]=_[_0xf421('0x46')](_0x371169[_0xf421('0x43')],_0x371169[_0xf421('0x45')]);_0x58ed1a['attributes']=_['intersection'](_0x371169[_0xf421('0x43')],qs[_0xf421('0x56')](_0x4ecad2[_0xf421('0x45')]['fields']));_0x58ed1a[_0xf421('0x47')]=_0x58ed1a['attributes'][_0xf421('0x48')]?_0x58ed1a[_0xf421('0x47')]:_0x371169[_0xf421('0x43')];_0x58ed1a[_0xf421('0x4a')]=qs['sort'](_0x4ecad2[_0xf421('0x45')][_0xf421('0x4b')]);_0x58ed1a[_0xf421('0x4e')]=qs[_0xf421('0x4c')](_[_0xf421('0x4d')](_0x4ecad2[_0xf421('0x45')],_0x371169[_0xf421('0x4c')]));if(_0x4ecad2[_0xf421('0x45')][_0xf421('0x51')]){_0x58ed1a[_0xf421('0x4e')]=_[_0xf421('0x4f')](_0x58ed1a[_0xf421('0x4e')],{'$or':_[_0xf421('0x50')](_0x58ed1a[_0xf421('0x47')],function(_0x40bf39){var _0x5805c9={};_0x5805c9[_0x40bf39]={'$like':'%'+_0x4ecad2[_0xf421('0x45')][_0xf421('0x51')]+'%'};return _0x5805c9;})});}_0x58ed1a=_[_0xf421('0x4f')]({},_0x58ed1a,_0x4ecad2[_0xf421('0x59')]);return _0x36b63e['getAgents'](_0x58ed1a);}})[_0xf421('0x37')](function(_0x379b26){if(_0x379b26){_0x55db50=_0x379b26[_0xf421('0x48')];if(!_0x4ecad2['query'][_0xf421('0x6a')](_0xf421('0x49'))){_0x58ed1a[_0xf421('0x31')]=qs[_0xf421('0x31')](_0x4ecad2[_0xf421('0x45')][_0xf421('0x31')]);_0x58ed1a[_0xf421('0x2f')]=qs[_0xf421('0x2f')](_0x4ecad2[_0xf421('0x45')][_0xf421('0x2f')]);}return _0x36b63e['getAgents'](_0x58ed1a);}})[_0xf421('0x37')](function(_0x574a12){if(_0x574a12){return _0x574a12?{'count':_0x55db50,'rows':_0x574a12}:null;}})[_0xf421('0x37')](respondWithResult(_0x3c3162,null))[_0xf421('0x2b')](handleError(_0x3c3162,null));};exports[_0xf421('0x3d')]=function(_0xa2ce8a,_0xbab027,_0x2fa4d7){var _0x43833f,_0x9814f0,_0xd60305;if(_[_0xf421('0x7b')](_0xa2ce8a[_0xf421('0x64')][_0xf421('0x64')])||_0xa2ce8a[_0xf421('0x64')][_0xf421('0x64')]===''){throw new db['Sequelize'][(_0xf421('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf421('0x7b')](_0xa2ce8a[_0xf421('0x64')]['to'])){}_0x43833f=_0xa2ce8a[_0xf421('0x64')]['to'];return db[_0xf421('0x40')][_0xf421('0x69')]({'where':{'id':_0xa2ce8a[_0xf421('0x54')]['id']}})[_0xf421('0x37')](handleEntityNotFound(_0xbab027,null))['then'](function(_0x229fa9){if(_0x229fa9){return db[_0xf421('0x40')][_0xf421('0x5a')]({'where':{'id':_0x229fa9['id']},'include':[{'model':db['CmList'],'as':_0xf421('0x81'),'include':[{'model':db[_0xf421('0x72')],'as':_0xf421('0x82'),'where':{[_0x229fa9['mapKey']]:_0x43833f},'limit':0x1,'order':[[_0xf421('0x76'),_0xf421('0x83')]]}]}]})['then'](handleEntityNotFound(_0xbab027,null))['then'](function(_0x3d30aa){if(_0x3d30aa&&_0x3d30aa['List']){_0x9814f0=_0x3d30aa[_0xf421('0x38')]({'plain':!![]});if(_0x9814f0[_0xf421('0x81')]&&_0x9814f0[_0xf421('0x81')][_0xf421('0x82')][_0xf421('0x48')]){return _0x9814f0[_0xf421('0x81')][_0xf421('0x82')][0x0];}return db[_0xf421('0x72')][_0xf421('0x5b')](_['defaults'](_0xa2ce8a['body'],{'firstName':_0x43833f,[_0x3d30aa[_0xf421('0x7c')]]:_0x43833f,'phone':_0x43833f,'ListId':_0x9814f0['ListId']}));}})[_0xf421('0x37')](handleEntityNotFound(_0xbab027,null))[_0xf421('0x37')](function(_0x10176a){if(_0x10176a){_0xd60305=_0x10176a;return db[_0xf421('0x8f')]['find']({'where':{'ContactId':_0xd60305['id'],'closed':![],'OpenchannelAccountId':_0x9814f0['id']}})[_0xf421('0x37')](function(_0x229be0){if(_0x229be0){return[_0x229be0,![]];}return db[_0xf421('0x8f')]['create']({'UserId':_0xa2ce8a[_0xf421('0x5c')]['id'],'ContactId':_0xd60305['id'],'OpenchannelAccountId':_0x9814f0['id'],'lastMsgDirection':_0xf421('0xbe'),'firstMsgDirection':_0xf421('0xbe'),'Messages':[_[_0xf421('0x4f')](_0xa2ce8a['body'],{'read':![],'body':_0xa2ce8a[_0xf421('0x64')]['body'],'OpenchannelAccountId':_0x9814f0['id'],'UserId':_0xa2ce8a[_0xf421('0x5c')]['id'],'ContactId':_0xd60305['id']})]},{'include':[{'model':db[_0xf421('0xbf')],'as':'Messages'}]})[_0xf421('0x37')](function(_0x5a32d8){return[_0x5a32d8,!![]];});});}})[_0xf421('0xc0')](function(_0x1bfbdb,_0x219d12){if(_0x219d12){return _0x1bfbdb;}return db['OpenchannelMessage'][_0xf421('0x5b')](_[_0xf421('0x4f')](_0xa2ce8a['body'],{'read':![],'body':_0xa2ce8a[_0xf421('0x64')][_0xf421('0x64')],'OpenchannelAccountId':_0x9814f0['id'],'OpenchannelInteractionId':_0x1bfbdb['id'],'UserId':_0xa2ce8a[_0xf421('0x5c')]['id'],'ContactId':_0xd60305['id']}))[_0xf421('0x37')](function(_0x382567){_0x1bfbdb[_0xf421('0xc1')][_0xf421('0xc2')]=[];_0x1bfbdb[_0xf421('0xc1')][_0xf421('0xc2')][_0xf421('0x95')](_0x382567[_0xf421('0xc1')]);return _0x1bfbdb;});});}})[_0xf421('0x37')](respondWithResult(_0xbab027,null))[_0xf421('0x2b')](handleError(_0xbab027,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9168dea..40ce8f3 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x2acfff,_0x59842f){var _0x48511c=function(_0x19013e){while(--_0x19013e){_0x2acfff['push'](_0x2acfff['shift']());}};_0x48511c(++_0x59842f);}(_0x54ef,0x112));var _0xf54e=function(_0x1ebc29,_0x14ae04){_0x1ebc29=_0x1ebc29-0x0;var _0x47077b=_0x54ef[_0x1ebc29];return _0x47077b;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xaa88=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x4b5f93,_0x143032){var _0x224ca1=function(_0x42073a){while(--_0x42073a){_0x4b5f93['push'](_0x4b5f93['shift']());}};_0x224ca1(++_0x143032);}(_0xaa88,0x137));var _0x8aa8=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0xaa88[_0x132d12];return _0x1c3163;};'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 0bf5b7c..1381d1c 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(_0x317f56,_0x1db5af){var _0x265c60=function(_0x3ece5f){while(--_0x3ece5f){_0x317f56['push'](_0x317f56['shift']());}};_0x265c60(++_0x1db5af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x1e5ffe,_0xc3511c){var _0x111793=function(_0x37f425){while(--_0x37f425){_0x1e5ffe['push'](_0x1e5ffe['shift']());}};_0x111793(++_0xc3511c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 f707aef..5029400 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 _0x80df=['OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','error','code'];(function(_0x347993,_0x32d3dd){var _0x53871e=function(_0x5a1455){while(--_0x5a1455){_0x347993['push'](_0x347993['shift']());}};_0x53871e(++_0x32d3dd);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});config[_0xf80d('0xd')]=_['defaults'](config[_0xf80d('0xd')],{'host':_0xf80d('0xe'),'port':0x18eb});var socket=require(_0xf80d('0xf'))(new Redis(config[_0xf80d('0xd')]));require(_0xf80d('0x10'))[_0xf80d('0x11')](socket);function respondWithRpcPromise(_0x41595f,_0x45d290,_0x2fddc2){return new BPromise(function(_0x2ef5d1,_0x30df95){return client[_0xf80d('0x12')](_0x41595f,_0x2fddc2)[_0xf80d('0x13')](function(_0x29bd2c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x45d290,_0xf80d('0x14'));logger[_0xf80d('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45d290,_0xf80d('0x14'),JSON['stringify'](_0x29bd2c));if(_0x29bd2c[_0xf80d('0x16')]){if(_0x29bd2c['error'][_0xf80d('0x17')]===0x1f4){logger['error'](_0xf80d('0x18'),_0x45d290,_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);return _0x30df95(_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);}logger[_0xf80d('0x16')](_0xf80d('0x18'),_0x45d290,_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);return _0x2ef5d1(_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);}else{logger[_0xf80d('0x1a')](_0xf80d('0x18'),_0x45d290,_0xf80d('0x14'));_0x2ef5d1(_0x29bd2c[_0xf80d('0x1b')][_0xf80d('0x19')]);}})[_0xf80d('0x1c')](function(_0x124174){logger[_0xf80d('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x45d290,_0x124174);_0x30df95(_0x124174);});});} \ No newline at end of file +var _0x3495=['../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','redis','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x57ee8c,_0xe42849){var _0x3a2322=function(_0x5ea8b2){while(--_0x5ea8b2){_0x57ee8c['push'](_0x57ee8c['shift']());}};_0x3a2322(++_0xe42849);}(_0x3495,0x1de));var _0x5349=function(_0x2175db,_0x714350){_0x2175db=_0x2175db-0x0;var _0x4a9833=_0x3495[_0x2175db];return _0x4a9833;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});config['redis']=_[_0x5349('0xc')](config['redis'],{'host':_0x5349('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5349('0xe')]));require(_0x5349('0xf'))[_0x5349('0x10')](socket);function respondWithRpcPromise(_0x23a1c7,_0x21bf91,_0x3a416e){return new BPromise(function(_0x35d425,_0x4bf160){return client[_0x5349('0x11')](_0x23a1c7,_0x3a416e)['then'](function(_0x2cbd83){logger[_0x5349('0x12')](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));logger[_0x5349('0x15')](_0x5349('0x16'),_0x21bf91,_0x5349('0x14'),JSON[_0x5349('0x17')](_0x2cbd83));if(_0x2cbd83[_0x5349('0x18')]){if(_0x2cbd83[_0x5349('0x18')]['code']===0x1f4){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x4bf160(_0x2cbd83[_0x5349('0x18')][_0x5349('0x19')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x35d425(_0x2cbd83['error'][_0x5349('0x19')]);}else{logger['info'](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));_0x35d425(_0x2cbd83[_0x5349('0x1a')][_0x5349('0x19')]);}})['catch'](function(_0x22d1ca){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x22d1ca);_0x4bf160(_0x22d1ca);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8c77760..93ad1b5 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 _0x0b96=['./openchannelAccount.events','save','remove','register','length'];(function(_0x5b2b28,_0xfcf44e){var _0x52e491=function(_0xb9faee){while(--_0xb9faee){_0x5b2b28['push'](_0x5b2b28['shift']());}};_0x52e491(++_0xfcf44e);}(_0x0b96,0xa5));var _0x60b9=function(_0x5e961f,_0x410eac){_0x5e961f=_0x5e961f-0x0;var _0x157371=_0x0b96[_0x5e961f];return _0x157371;};'use strict';var OpenchannelAccountEvents=require(_0x60b9('0x0'));var events=[_0x60b9('0x1'),_0x60b9('0x2'),'update'];function createListener(_0xbe4f47,_0x13616a){return function(_0x23a080){_0x13616a['emit'](_0xbe4f47,_0x23a080);};}function removeListener(_0x348b51,_0x3e232a){return function(){OpenchannelAccountEvents['removeListener'](_0x348b51,_0x3e232a);};}exports[_0x60b9('0x3')]=function(_0x443326){for(var _0x40e534=0x0,_0x6f397e=events[_0x60b9('0x4')];_0x40e534<_0x6f397e;_0x40e534++){var _0x28d32f=events[_0x40e534];var _0x1e5cef=createListener('openchannelAccount:'+_0x28d32f,_0x443326);OpenchannelAccountEvents['on'](_0x28d32f,_0x1e5cef);}}; \ No newline at end of file +var _0xcf1c=['openchannelAccount:','./openchannelAccount.events','save','update','removeListener','length'];(function(_0x1a839c,_0x3e2e50){var _0x53f722=function(_0x33be5d){while(--_0x33be5d){_0x1a839c['push'](_0x1a839c['shift']());}};_0x53f722(++_0x3e2e50);}(_0xcf1c,0x18d));var _0xccf1=function(_0x590ef7,_0x175f08){_0x590ef7=_0x590ef7-0x0;var _0x4c2634=_0xcf1c[_0x590ef7];return _0x4c2634;};'use strict';var OpenchannelAccountEvents=require(_0xccf1('0x0'));var events=[_0xccf1('0x1'),'remove',_0xccf1('0x2')];function createListener(_0x3b9acb,_0x1d0b09){return function(_0x2800a8){_0x1d0b09['emit'](_0x3b9acb,_0x2800a8);};}function removeListener(_0x5d3e85,_0x509c8d){return function(){OpenchannelAccountEvents[_0xccf1('0x3')](_0x5d3e85,_0x509c8d);};}exports['register']=function(_0x17e358){for(var _0x2ee316=0x0,_0x2c381f=events[_0xccf1('0x4')];_0x2ee316<_0x2c381f;_0x2ee316++){var _0x1ee241=events[_0x2ee316];var _0x12ca5d=createListener(_0xccf1('0x5')+_0x1ee241,_0x17e358);OpenchannelAccountEvents['on'](_0x1ee241,_0x12ca5d);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4e89c89..c7ae9b6 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 _0x13e6=['../../components/auth/service','./openchannelApplication.controller','isAuthenticated','get','/:id','put','delete','destroy','exports','util','express'];(function(_0x38ccd0,_0x5840bd){var _0x50d181=function(_0x32cdfd){while(--_0x32cdfd){_0x38ccd0['push'](_0x38ccd0['shift']());}};_0x50d181(++_0x5840bd);}(_0x13e6,0xa3));var _0x613e=function(_0x391dcf,_0x3ae1ce){_0x391dcf=_0x391dcf-0x0;var _0x5c304a=_0x13e6[_0x391dcf];return _0x5c304a;};'use strict';var multer=require('multer');var util=require(_0x613e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613e('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x613e('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x613e('0x3'));router['get']('/',auth[_0x613e('0x4')](),controller['index']);router[_0x613e('0x5')](_0x613e('0x6'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x613e('0x4')](),controller['create']);router[_0x613e('0x7')](_0x613e('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x613e('0x8')](_0x613e('0x6'),auth['isAuthenticated'](),controller[_0x613e('0x9')]);module[_0x613e('0xa')]=router; \ No newline at end of file +var _0x3884=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','post','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x21e039,_0x3e9573){var _0x586aba=function(_0x5a8e0f){while(--_0x5a8e0f){_0x21e039['push'](_0x21e039['shift']());}};_0x586aba(++_0x3e9573);}(_0x3884,0x1c6));var _0x4388=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x3884[_0x46f1a6];return _0x38429a;};'use strict';var multer=require(_0x4388('0x0'));var util=require(_0x4388('0x1'));var path=require(_0x4388('0x2'));var timeout=require(_0x4388('0x3'));var express=require(_0x4388('0x4'));var router=express[_0x4388('0x5')]();var fs_extra=require(_0x4388('0x6'));var auth=require(_0x4388('0x7'));var interaction=require(_0x4388('0x8'));var config=require(_0x4388('0x9'));var controller=require(_0x4388('0xa'));router[_0x4388('0xb')]('/',auth['isAuthenticated'](),controller[_0x4388('0xc')]);router[_0x4388('0xb')]('/:id',auth[_0x4388('0xd')](),controller['show']);router[_0x4388('0xe')]('/',auth[_0x4388('0xd')](),controller['create']);router[_0x4388('0xf')]('/:id',auth[_0x4388('0xd')](),controller['update']);router[_0x4388('0x10')](_0x4388('0x11'),auth['isAuthenticated'](),controller[_0x4388('0x12')]);module[_0x4388('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7e86f3c..9fd4551 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 _0x0c98=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x492be5,_0x430854){var _0x1d4c23=function(_0x270a4a){while(--_0x270a4a){_0x492be5['push'](_0x492be5['shift']());}};_0x1d4c23(++_0x430854);}(_0x0c98,0x166));var _0x80c9=function(_0x35e6fe,_0x4fa379){_0x35e6fe=_0x35e6fe-0x0;var _0xf260e7=_0x0c98[_0x35e6fe];return _0xf260e7;};'use strict';var Sequelize=require(_0x80c9('0x0'));module['exports']={'priority':{'type':Sequelize[_0x80c9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x80c9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x80c9('0x3')]()},'description':{'type':Sequelize[_0x80c9('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x80c9('0x4')}}; \ No newline at end of file +var _0xa619=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x718d6d,_0xfeedba){var _0x35322f=function(_0x2c5646){while(--_0x2c5646){_0x718d6d['push'](_0x718d6d['shift']());}};_0x35322f(++_0xfeedba);}(_0xa619,0x1b2));var _0x9a61=function(_0x91342c,_0x1047c8){_0x91342c=_0x91342c-0x0;var _0x46446c=_0xa619[_0x91342c];return _0x46446c;};'use strict';var Sequelize=require(_0x9a61('0x0'));module[_0x9a61('0x1')]={'priority':{'type':Sequelize[_0x9a61('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a61('0x3')],'allowNull':![],'defaultValue':_0x9a61('0x4')},'appdata':{'type':Sequelize[_0x9a61('0x5')]()},'description':{'type':Sequelize[_0x9a61('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9a61('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ca29923..45ca35d 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 _0xd99d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','name','send','OpenchannelApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','body','params','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x4f9239,_0x40cac2){var _0x17bf2f=function(_0x40563a){while(--_0x40563a){_0x4f9239['push'](_0x4f9239['shift']());}};_0x17bf2f(++_0x40cac2);}(_0xd99d,0x112));var _0xdd99=function(_0x23bd91,_0x7440d4){_0x23bd91=_0x23bd91-0x0;var _0x2f846e=_0xd99d[_0x23bd91];return _0x2f846e;};'use strict';var emlformat=require(_0xdd99('0x0'));var rimraf=require(_0xdd99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd99('0x2'));var rp=require(_0xdd99('0x3'));var moment=require(_0xdd99('0x4'));var BPromise=require(_0xdd99('0x5'));var Mustache=require(_0xdd99('0x6'));var util=require(_0xdd99('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd99('0x8'));var fs=require('fs');var fs_extra=require(_0xdd99('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdd99('0xa'));var jsforce=require(_0xdd99('0xb'));var deskjs=require(_0xdd99('0xc'));var toCsv=require(_0xdd99('0xd'));var querystring=require(_0xdd99('0xe'));var Papa=require(_0xdd99('0xf'));var Redis=require(_0xdd99('0x10'));var authService=require(_0xdd99('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdd99('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd99('0x13'))(_0xdd99('0x14'));var utils=require('../../config/utils');var config=require(_0xdd99('0x15'));var licenseUtil=require(_0xdd99('0x16'));var db=require(_0xdd99('0x17'))['db'];function respondWithStatusCode(_0x2c6207,_0x3cb17b){_0x3cb17b=_0x3cb17b||0xcc;return function(_0x1d8937){if(_0x1d8937){return _0x2c6207[_0xdd99('0x18')](_0x3cb17b);}return _0x2c6207[_0xdd99('0x19')](_0x3cb17b)[_0xdd99('0x1a')]();};}function respondWithResult(_0x263f8c,_0x5d3ab){_0x5d3ab=_0x5d3ab||0xc8;return function(_0x172be7){if(_0x172be7){return _0x263f8c[_0xdd99('0x19')](_0x5d3ab)[_0xdd99('0x1b')](_0x172be7);}};}function respondWithFilteredResult(_0x391b6d,_0x2c5fbe){return function(_0xc27b49){if(_0xc27b49){var _0x3d55cf=typeof _0x2c5fbe[_0xdd99('0x1c')]==='undefined'&&typeof _0x2c5fbe[_0xdd99('0x1d')]===_0xdd99('0x1e');var _0x20a1ea=_0xc27b49[_0xdd99('0x1f')];var _0x4718da=_0x3d55cf?0x0:_0x2c5fbe['offset'];var _0xae26d9=_0x3d55cf?_0xc27b49[_0xdd99('0x1f')]:_0x2c5fbe[_0xdd99('0x1c')]+_0x2c5fbe[_0xdd99('0x1d')];var _0x418ec5;if(_0xae26d9>=_0x20a1ea){_0xae26d9=_0x20a1ea;_0x418ec5=0xc8;}else{_0x418ec5=0xce;}_0x391b6d[_0xdd99('0x19')](_0x418ec5);return _0x391b6d[_0xdd99('0x20')]('Content-Range',_0x4718da+'-'+_0xae26d9+'/'+_0x20a1ea)[_0xdd99('0x1b')](_0xc27b49);}return null;};}function patchUpdates(_0xddb20d){return function(_0x2950b7){try{jsonpatch[_0xdd99('0x21')](_0x2950b7,_0xddb20d,!![]);}catch(_0x23c3c3){return BPromise[_0xdd99('0x22')](_0x23c3c3);}return _0x2950b7['save']();};}function saveUpdates(_0x10ca0a,_0xc1ed3e){return function(_0x29f5c0){if(_0x29f5c0){return _0x29f5c0[_0xdd99('0x23')](_0x10ca0a)[_0xdd99('0x24')](function(_0x155e64){return _0x155e64;});}return null;};}function removeEntity(_0x2914d8,_0x5131ca){return function(_0x3a6f81){if(_0x3a6f81){return _0x3a6f81[_0xdd99('0x25')]()[_0xdd99('0x24')](function(){_0x2914d8[_0xdd99('0x19')](0xcc)[_0xdd99('0x1a')]();});}};}function handleEntityNotFound(_0x6131e8,_0x57f2){return function(_0x5f2e93){if(!_0x5f2e93){_0x6131e8[_0xdd99('0x18')](0x194);}return _0x5f2e93;};}function handleError(_0x7286b2,_0x3082b5){_0x3082b5=_0x3082b5||0x1f4;return function(_0x504b7c){logger[_0xdd99('0x26')](_0x504b7c['stack']);if(_0x504b7c[_0xdd99('0x27')]){delete _0x504b7c[_0xdd99('0x27')];}_0x7286b2[_0xdd99('0x19')](_0x3082b5)[_0xdd99('0x28')](_0x504b7c);};}exports['index']=function(_0x308eb2,_0x5ce836){var _0x37097b={},_0x4e5dde={},_0x891e0c={'count':0x0,'rows':[]};var _0x2bc4a3=_['map'](db[_0xdd99('0x29')][_0xdd99('0x2a')],function(_0x389610){return{'name':_0x389610[_0xdd99('0x2b')],'type':_0x389610[_0xdd99('0x2c')]['key']};});_0x4e5dde[_0xdd99('0x2d')]=_[_0xdd99('0x2e')](_0x2bc4a3,_0xdd99('0x27'));_0x4e5dde[_0xdd99('0x2f')]=_[_0xdd99('0x30')](_0x308eb2[_0xdd99('0x2f')]);_0x4e5dde[_0xdd99('0x31')]=_[_0xdd99('0x32')](_0x4e5dde[_0xdd99('0x2d')],_0x4e5dde[_0xdd99('0x2f')]);_0x37097b[_0xdd99('0x33')]=_[_0xdd99('0x32')](_0x4e5dde[_0xdd99('0x2d')],qs[_0xdd99('0x34')](_0x308eb2[_0xdd99('0x2f')][_0xdd99('0x34')]));_0x37097b[_0xdd99('0x33')]=_0x37097b[_0xdd99('0x33')][_0xdd99('0x35')]?_0x37097b[_0xdd99('0x33')]:_0x4e5dde[_0xdd99('0x2d')];if(!_0x308eb2[_0xdd99('0x2f')][_0xdd99('0x36')](_0xdd99('0x37'))){_0x37097b[_0xdd99('0x1d')]=qs[_0xdd99('0x1d')](_0x308eb2[_0xdd99('0x2f')][_0xdd99('0x1d')]);_0x37097b[_0xdd99('0x1c')]=qs['offset'](_0x308eb2[_0xdd99('0x2f')][_0xdd99('0x1c')]);}_0x37097b[_0xdd99('0x38')]=qs[_0xdd99('0x39')](_0x308eb2[_0xdd99('0x2f')][_0xdd99('0x39')]);_0x37097b[_0xdd99('0x3a')]=qs['filters'](_[_0xdd99('0x3b')](_0x308eb2[_0xdd99('0x2f')],_0x4e5dde['filters']),_0x2bc4a3);if(_0x308eb2['query'][_0xdd99('0x3c')]){_0x37097b['where']=_[_0xdd99('0x3d')](_0x37097b['where'],{'$or':_[_0xdd99('0x2e')](_0x2bc4a3,function(_0x1a8390){if(_0x1a8390[_0xdd99('0x2c')]!==_0xdd99('0x3e')){var _0x1d8e60={};_0x1d8e60[_0x1a8390['name']]={'$like':'%'+_0x308eb2['query'][_0xdd99('0x3c')]+'%'};return _0x1d8e60;}})});}_0x37097b=_['merge']({},_0x37097b,_0x308eb2['options']);var _0x504e84={'where':_0x37097b[_0xdd99('0x3a')]};return db[_0xdd99('0x29')][_0xdd99('0x1f')](_0x504e84)['then'](function(_0x6695fd){_0x891e0c[_0xdd99('0x1f')]=_0x6695fd;if(_0x308eb2[_0xdd99('0x2f')][_0xdd99('0x3f')]){_0x37097b[_0xdd99('0x40')]=[{'all':!![]}];}return db[_0xdd99('0x29')][_0xdd99('0x41')](_0x37097b);})[_0xdd99('0x24')](function(_0x1e118d){_0x891e0c[_0xdd99('0x42')]=_0x1e118d;return _0x891e0c;})[_0xdd99('0x24')](respondWithFilteredResult(_0x5ce836,_0x37097b))['catch'](handleError(_0x5ce836,null));};exports[_0xdd99('0x43')]=function(_0x21e4c4,_0x829003){var _0xe8f2f={'raw':!![],'where':{'id':_0x21e4c4['params']['id']}},_0x232b68={};_0x232b68['model']=_[_0xdd99('0x30')](db[_0xdd99('0x29')][_0xdd99('0x2a')]);_0x232b68[_0xdd99('0x2f')]=_[_0xdd99('0x30')](_0x21e4c4[_0xdd99('0x2f')]);_0x232b68[_0xdd99('0x31')]=_[_0xdd99('0x32')](_0x232b68[_0xdd99('0x2d')],_0x232b68[_0xdd99('0x2f')]);_0xe8f2f[_0xdd99('0x33')]=_[_0xdd99('0x32')](_0x232b68[_0xdd99('0x2d')],qs[_0xdd99('0x34')](_0x21e4c4['query'][_0xdd99('0x34')]));_0xe8f2f['attributes']=_0xe8f2f[_0xdd99('0x33')][_0xdd99('0x35')]?_0xe8f2f[_0xdd99('0x33')]:_0x232b68['model'];if(_0x21e4c4[_0xdd99('0x2f')][_0xdd99('0x3f')]){_0xe8f2f['include']=[{'all':!![]}];}_0xe8f2f=_[_0xdd99('0x3d')]({},_0xe8f2f,_0x21e4c4[_0xdd99('0x44')]);return db['OpenchannelApplication']['find'](_0xe8f2f)[_0xdd99('0x24')](handleEntityNotFound(_0x829003,null))[_0xdd99('0x24')](respondWithResult(_0x829003,null))[_0xdd99('0x45')](handleError(_0x829003,null));};exports['create']=function(_0x21e161,_0x5167bf){return db['OpenchannelApplication'][_0xdd99('0x46')](_0x21e161[_0xdd99('0x47')],{})[_0xdd99('0x24')](respondWithResult(_0x5167bf,0xc9))[_0xdd99('0x45')](handleError(_0x5167bf,null));};exports[_0xdd99('0x23')]=function(_0x5ab53f,_0x586504){if(_0x5ab53f[_0xdd99('0x47')]['id']){delete _0x5ab53f[_0xdd99('0x47')]['id'];}return db[_0xdd99('0x29')]['find']({'where':{'id':_0x5ab53f[_0xdd99('0x48')]['id']}})['then'](handleEntityNotFound(_0x586504,null))[_0xdd99('0x24')](saveUpdates(_0x5ab53f['body'],null))['then'](respondWithResult(_0x586504,null))['catch'](handleError(_0x586504,null));};exports[_0xdd99('0x25')]=function(_0xca8341,_0x21d9f6){return db[_0xdd99('0x29')][_0xdd99('0x49')]({'where':{'id':_0xca8341[_0xdd99('0x48')]['id']}})[_0xdd99('0x24')](handleEntityNotFound(_0x21d9f6,null))[_0xdd99('0x24')](removeEntity(_0x21d9f6,null))[_0xdd99('0x45')](handleError(_0x21d9f6,null));}; \ No newline at end of file +var _0xe7fb=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','merge','VIRTUAL','filter','options','OpenchannelApplication','includeAll','include','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x383b68,_0x49ee8e){var _0x44afa4=function(_0x58d4f7){while(--_0x58d4f7){_0x383b68['push'](_0x383b68['shift']());}};_0x44afa4(++_0x49ee8e);}(_0xe7fb,0xc5));var _0xbe7f=function(_0x45f534,_0xa3fa9b){_0x45f534=_0x45f534-0x0;var _0x174592=_0xe7fb[_0x45f534];return _0x174592;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe7f('0x0'));var zipdir=require(_0xbe7f('0x1'));var jsonpatch=require(_0xbe7f('0x2'));var rp=require(_0xbe7f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe7f('0x4'));var util=require(_0xbe7f('0x5'));var path=require(_0xbe7f('0x6'));var sox=require('sox');var csv=require(_0xbe7f('0x7'));var ejs=require(_0xbe7f('0x8'));var fs=require('fs');var fs_extra=require(_0xbe7f('0x9'));var _=require('lodash');var squel=require(_0xbe7f('0xa'));var crypto=require(_0xbe7f('0xb'));var jsforce=require(_0xbe7f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbe7f('0x7'));var querystring=require(_0xbe7f('0xd'));var Papa=require(_0xbe7f('0xe'));var Redis=require(_0xbe7f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbe7f('0x10'));var as=require(_0xbe7f('0x11'));var hardwareService=require(_0xbe7f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbe7f('0x13'));var config=require(_0xbe7f('0x14'));var licenseUtil=require(_0xbe7f('0x15'));var db=require(_0xbe7f('0x16'))['db'];function respondWithStatusCode(_0x44946a,_0x22bdd5){_0x22bdd5=_0x22bdd5||0xcc;return function(_0x3dce78){if(_0x3dce78){return _0x44946a[_0xbe7f('0x17')](_0x22bdd5);}return _0x44946a['status'](_0x22bdd5)[_0xbe7f('0x18')]();};}function respondWithResult(_0x221779,_0x250935){_0x250935=_0x250935||0xc8;return function(_0x5a4528){if(_0x5a4528){return _0x221779[_0xbe7f('0x19')](_0x250935)[_0xbe7f('0x1a')](_0x5a4528);}};}function respondWithFilteredResult(_0x583f82,_0x4feffa){return function(_0x1d3bf8){if(_0x1d3bf8){var _0x1d1cd2=typeof _0x4feffa[_0xbe7f('0x1b')]===_0xbe7f('0x1c')&&typeof _0x4feffa['limit']==='undefined';var _0x5c1f9b=_0x1d3bf8[_0xbe7f('0x1d')];var _0x4dfb38=_0x1d1cd2?0x0:_0x4feffa[_0xbe7f('0x1b')];var _0x49a2bd=_0x1d1cd2?_0x1d3bf8['count']:_0x4feffa[_0xbe7f('0x1b')]+_0x4feffa[_0xbe7f('0x1e')];var _0x45ee38;if(_0x49a2bd>=_0x5c1f9b){_0x49a2bd=_0x5c1f9b;_0x45ee38=0xc8;}else{_0x45ee38=0xce;}_0x583f82[_0xbe7f('0x19')](_0x45ee38);return _0x583f82[_0xbe7f('0x1f')](_0xbe7f('0x20'),_0x4dfb38+'-'+_0x49a2bd+'/'+_0x5c1f9b)[_0xbe7f('0x1a')](_0x1d3bf8);}return null;};}function patchUpdates(_0x44c35f){return function(_0x5290de){try{jsonpatch[_0xbe7f('0x21')](_0x5290de,_0x44c35f,!![]);}catch(_0x236bba){return BPromise[_0xbe7f('0x22')](_0x236bba);}return _0x5290de[_0xbe7f('0x23')]();};}function saveUpdates(_0x12f6ce,_0x14f9a4){return function(_0x59ba21){if(_0x59ba21){return _0x59ba21[_0xbe7f('0x24')](_0x12f6ce)[_0xbe7f('0x25')](function(_0x517da2){return _0x517da2;});}return null;};}function removeEntity(_0x5c8bda,_0xefe25a){return function(_0x3d53b0){if(_0x3d53b0){return _0x3d53b0[_0xbe7f('0x26')]()['then'](function(){_0x5c8bda['status'](0xcc)[_0xbe7f('0x18')]();});}};}function handleEntityNotFound(_0x162edd,_0x8077ba){return function(_0x5d7a77){if(!_0x5d7a77){_0x162edd[_0xbe7f('0x17')](0x194);}return _0x5d7a77;};}function handleError(_0xcbaed2,_0x3a9c25){_0x3a9c25=_0x3a9c25||0x1f4;return function(_0xbed7f4){logger[_0xbe7f('0x27')](_0xbed7f4[_0xbe7f('0x28')]);if(_0xbed7f4[_0xbe7f('0x29')]){delete _0xbed7f4['name'];}_0xcbaed2[_0xbe7f('0x19')](_0x3a9c25)['send'](_0xbed7f4);};}exports[_0xbe7f('0x2a')]=function(_0x1cf11b,_0x193d5d){var _0x261850={},_0x156fea={},_0x14954a={'count':0x0,'rows':[]};var _0x30421e=_[_0xbe7f('0x2b')](db['OpenchannelApplication']['rawAttributes'],function(_0x5057e8){return{'name':_0x5057e8[_0xbe7f('0x2c')],'type':_0x5057e8[_0xbe7f('0x2d')][_0xbe7f('0x2e')]};});_0x156fea['model']=_[_0xbe7f('0x2b')](_0x30421e,_0xbe7f('0x29'));_0x156fea['query']=_[_0xbe7f('0x2f')](_0x1cf11b[_0xbe7f('0x30')]);_0x156fea[_0xbe7f('0x31')]=_[_0xbe7f('0x32')](_0x156fea[_0xbe7f('0x33')],_0x156fea[_0xbe7f('0x30')]);_0x261850[_0xbe7f('0x34')]=_[_0xbe7f('0x32')](_0x156fea[_0xbe7f('0x33')],qs[_0xbe7f('0x35')](_0x1cf11b[_0xbe7f('0x30')]['fields']));_0x261850[_0xbe7f('0x34')]=_0x261850['attributes'][_0xbe7f('0x36')]?_0x261850[_0xbe7f('0x34')]:_0x156fea[_0xbe7f('0x33')];if(!_0x1cf11b[_0xbe7f('0x30')]['hasOwnProperty']('nolimit')){_0x261850['limit']=qs[_0xbe7f('0x1e')](_0x1cf11b[_0xbe7f('0x30')][_0xbe7f('0x1e')]);_0x261850[_0xbe7f('0x1b')]=qs['offset'](_0x1cf11b['query']['offset']);}_0x261850['order']=qs[_0xbe7f('0x37')](_0x1cf11b[_0xbe7f('0x30')][_0xbe7f('0x37')]);_0x261850[_0xbe7f('0x38')]=qs['filters'](_['pick'](_0x1cf11b[_0xbe7f('0x30')],_0x156fea[_0xbe7f('0x31')]),_0x30421e);if(_0x1cf11b['query']['filter']){_0x261850['where']=_[_0xbe7f('0x39')](_0x261850['where'],{'$or':_[_0xbe7f('0x2b')](_0x30421e,function(_0x523da6){if(_0x523da6['type']!==_0xbe7f('0x3a')){var _0x18243d={};_0x18243d[_0x523da6[_0xbe7f('0x29')]]={'$like':'%'+_0x1cf11b[_0xbe7f('0x30')][_0xbe7f('0x3b')]+'%'};return _0x18243d;}})});}_0x261850=_[_0xbe7f('0x39')]({},_0x261850,_0x1cf11b[_0xbe7f('0x3c')]);var _0x3217a1={'where':_0x261850[_0xbe7f('0x38')]};return db[_0xbe7f('0x3d')]['count'](_0x3217a1)[_0xbe7f('0x25')](function(_0x5ac3d5){_0x14954a['count']=_0x5ac3d5;if(_0x1cf11b[_0xbe7f('0x30')][_0xbe7f('0x3e')]){_0x261850[_0xbe7f('0x3f')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x261850);})['then'](function(_0x405a49){_0x14954a[_0xbe7f('0x40')]=_0x405a49;return _0x14954a;})['then'](respondWithFilteredResult(_0x193d5d,_0x261850))[_0xbe7f('0x41')](handleError(_0x193d5d,null));};exports[_0xbe7f('0x42')]=function(_0x5df4b6,_0x275203){var _0x1d4d7a={'raw':!![],'where':{'id':_0x5df4b6[_0xbe7f('0x43')]['id']}},_0x2354fe={};_0x2354fe[_0xbe7f('0x33')]=_[_0xbe7f('0x2f')](db['OpenchannelApplication']['rawAttributes']);_0x2354fe[_0xbe7f('0x30')]=_[_0xbe7f('0x2f')](_0x5df4b6[_0xbe7f('0x30')]);_0x2354fe[_0xbe7f('0x31')]=_[_0xbe7f('0x32')](_0x2354fe[_0xbe7f('0x33')],_0x2354fe[_0xbe7f('0x30')]);_0x1d4d7a[_0xbe7f('0x34')]=_['intersection'](_0x2354fe[_0xbe7f('0x33')],qs[_0xbe7f('0x35')](_0x5df4b6['query'][_0xbe7f('0x35')]));_0x1d4d7a[_0xbe7f('0x34')]=_0x1d4d7a['attributes'][_0xbe7f('0x36')]?_0x1d4d7a[_0xbe7f('0x34')]:_0x2354fe[_0xbe7f('0x33')];if(_0x5df4b6[_0xbe7f('0x30')][_0xbe7f('0x3e')]){_0x1d4d7a[_0xbe7f('0x3f')]=[{'all':!![]}];}_0x1d4d7a=_['merge']({},_0x1d4d7a,_0x5df4b6[_0xbe7f('0x3c')]);return db[_0xbe7f('0x3d')]['find'](_0x1d4d7a)['then'](handleEntityNotFound(_0x275203,null))['then'](respondWithResult(_0x275203,null))[_0xbe7f('0x41')](handleError(_0x275203,null));};exports[_0xbe7f('0x44')]=function(_0xac80c3,_0x2b240f){return db[_0xbe7f('0x3d')][_0xbe7f('0x44')](_0xac80c3[_0xbe7f('0x45')],{})[_0xbe7f('0x25')](respondWithResult(_0x2b240f,0xc9))['catch'](handleError(_0x2b240f,null));};exports[_0xbe7f('0x24')]=function(_0x212244,_0x50e8d7){if(_0x212244[_0xbe7f('0x45')]['id']){delete _0x212244[_0xbe7f('0x45')]['id'];}return db[_0xbe7f('0x3d')][_0xbe7f('0x46')]({'where':{'id':_0x212244['params']['id']}})[_0xbe7f('0x25')](handleEntityNotFound(_0x50e8d7,null))[_0xbe7f('0x25')](saveUpdates(_0x212244[_0xbe7f('0x45')],null))[_0xbe7f('0x25')](respondWithResult(_0x50e8d7,null))[_0xbe7f('0x41')](handleError(_0x50e8d7,null));};exports[_0xbe7f('0x26')]=function(_0x29678c,_0x4bb677){return db[_0xbe7f('0x3d')]['find']({'where':{'id':_0x29678c[_0xbe7f('0x43')]['id']}})[_0xbe7f('0x25')](handleEntityNotFound(_0x4bb677,null))['then'](removeEntity(_0x4bb677,null))['catch'](handleError(_0x4bb677,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 600cae3..ee59af6 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 _0x6ae4=['util','../../config/logger','api','bluebird','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x8c849a,_0x1a2719){var _0x2fe2b4=function(_0x6a640c){while(--_0x6a640c){_0x8c849a['push'](_0x8c849a['shift']());}};_0x2fe2b4(++_0x1a2719);}(_0x6ae4,0xa7));var _0x46ae=function(_0x189474,_0x144878){_0x189474=_0x189474-0x0;var _0x310fc2=_0x6ae4[_0x189474];return _0x310fc2;};'use strict';var _=require(_0x46ae('0x0'));var util=require(_0x46ae('0x1'));var logger=require(_0x46ae('0x2'))(_0x46ae('0x3'));var moment=require('moment');var BPromise=require(_0x46ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46ae('0x5'));var rimraf=require('rimraf');var config=require(_0x46ae('0x6'));var attributes=require(_0x46ae('0x7'));module[_0x46ae('0x8')]=function(_0x426a1e,_0x559cc6){return _0x426a1e[_0x46ae('0x9')](_0x46ae('0xa'),attributes,{'tableName':_0x46ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46ae('0xc'),'collate':_0x46ae('0xd')});}; \ No newline at end of file +var _0x5a18=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x3a9468,_0x2b6266){var _0x1d2345=function(_0x499728){while(--_0x499728){_0x3a9468['push'](_0x3a9468['shift']());}};_0x1d2345(++_0x2b6266);}(_0x5a18,0xdc));var _0x85a1=function(_0x31d853,_0x37b487){_0x31d853=_0x31d853-0x0;var _0xed9235=_0x5a18[_0x31d853];return _0xed9235;};'use strict';var _=require(_0x85a1('0x0'));var util=require('util');var logger=require(_0x85a1('0x1'))(_0x85a1('0x2'));var moment=require(_0x85a1('0x3'));var BPromise=require(_0x85a1('0x4'));var rp=require(_0x85a1('0x5'));var fs=require('fs');var path=require(_0x85a1('0x6'));var rimraf=require(_0x85a1('0x7'));var config=require(_0x85a1('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x85a1('0x9')]=function(_0x4e0ae6,_0x4fc845){return _0x4e0ae6[_0x85a1('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x85a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85a1('0xc'),'collate':_0x85a1('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 04625af..2de41de 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 _0xa991=['message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x29de46,_0x4dc36c){var _0x32ea8d=function(_0x43ad20){while(--_0x43ad20){_0x29de46['push'](_0x29de46['shift']());}};_0x32ea8d(++_0x4dc36c);}(_0xa991,0x166));var _0x1a99=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa991[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x1a99('0x0'));var moment=require(_0x1a99('0x1'));var BPromise=require(_0x1a99('0x2'));var rs=require(_0x1a99('0x3'));var fs=require('fs');var Redis=require(_0x1a99('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a99('0x5'));var logger=require(_0x1a99('0x6'))(_0x1a99('0x7'));var config=require(_0x1a99('0x8'));var jayson=require(_0x1a99('0x9'));var client=jayson['client'][_0x1a99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x322d09,_0x261b1c,_0x443907){return new BPromise(function(_0xda63d4,_0x23887a){return client[_0x1a99('0xb')](_0x322d09,_0x443907)[_0x1a99('0xc')](function(_0xae4d87){logger[_0x1a99('0xd')](_0x1a99('0xe'),_0x261b1c,'request\x20sent');logger[_0x1a99('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x261b1c,'request\x20sent',JSON[_0x1a99('0x10')](_0xae4d87));if(_0xae4d87[_0x1a99('0x11')]){if(_0xae4d87['error'][_0x1a99('0x12')]===0x1f4){logger[_0x1a99('0x11')](_0x1a99('0xe'),_0x261b1c,_0xae4d87[_0x1a99('0x11')][_0x1a99('0x13')]);return _0x23887a(_0xae4d87['error']['message']);}logger[_0x1a99('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x261b1c,_0xae4d87[_0x1a99('0x11')]['message']);return _0xda63d4(_0xae4d87[_0x1a99('0x11')][_0x1a99('0x13')]);}else{logger[_0x1a99('0xd')](_0x1a99('0xe'),_0x261b1c,'request\x20sent');_0xda63d4(_0xae4d87[_0x1a99('0x14')]['message']);}})[_0x1a99('0x15')](function(_0x2615d9){logger[_0x1a99('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x261b1c,_0x2615d9);_0x23887a(_0x2615d9);});});}exports[_0x1a99('0x16')]=function(_0x432228){var _0x6012a6=this;return new Promise(function(_0x459910,_0x9c29a5){return db[_0x1a99('0x17')][_0x1a99('0x18')](_0x432228['body'],{'raw':_0x432228[_0x1a99('0x19')]?_0x432228[_0x1a99('0x19')][_0x1a99('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x432228[_0x1a99('0x19')]?_0x432228['options'][_0x1a99('0x1b')]||null:null,'attributes':_0x432228[_0x1a99('0x19')]?_0x432228[_0x1a99('0x19')][_0x1a99('0x1c')]||null:null,'limit':_0x432228['options']?_0x432228[_0x1a99('0x19')]['limit']||null:null})[_0x1a99('0xc')](function(_0x53a4af){logger[_0x1a99('0xd')]('UpdateOpenchannelApplication',_0x432228);logger[_0x1a99('0xf')](_0x1a99('0x16'),_0x432228,JSON[_0x1a99('0x10')](_0x53a4af));_0x459910(_0x53a4af);})[_0x1a99('0x15')](function(_0x3d3829){logger[_0x1a99('0x11')](_0x1a99('0x16'),_0x3d3829[_0x1a99('0x13')],_0x432228);_0x9c29a5(_0x6012a6[_0x1a99('0x11')](0x1f4,_0x3d3829[_0x1a99('0x13')]));});});}; \ No newline at end of file +var _0x08b4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateOpenchannelApplication','options','where','attributes','debug','stringify','lodash'];(function(_0x524189,_0x4fdf18){var _0x23799c=function(_0x5da82f){while(--_0x5da82f){_0x524189['push'](_0x524189['shift']());}};_0x23799c(++_0x4fdf18);}(_0x08b4,0x67));var _0x408b=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x08b4[_0x5f3905];return _0x2923b1;};'use strict';var _=require(_0x408b('0x0'));var util=require(_0x408b('0x1'));var moment=require(_0x408b('0x2'));var BPromise=require(_0x408b('0x3'));var rs=require(_0x408b('0x4'));var fs=require('fs');var Redis=require(_0x408b('0x5'));var db=require(_0x408b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x408b('0x7'));var config=require(_0x408b('0x8'));var jayson=require(_0x408b('0x9'));var client=jayson['client'][_0x408b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xec8c99,_0x1a2564,_0x9a98bc){return new BPromise(function(_0x341ce3,_0x254c04){return client[_0x408b('0xb')](_0xec8c99,_0x9a98bc)[_0x408b('0xc')](function(_0x58c68b){logger[_0x408b('0xd')](_0x408b('0xe'),_0x1a2564,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1a2564,_0x408b('0xf'),JSON['stringify'](_0x58c68b));if(_0x58c68b[_0x408b('0x10')]){if(_0x58c68b[_0x408b('0x10')][_0x408b('0x11')]===0x1f4){logger[_0x408b('0x10')](_0x408b('0xe'),_0x1a2564,_0x58c68b['error'][_0x408b('0x12')]);return _0x254c04(_0x58c68b['error'][_0x408b('0x12')]);}logger[_0x408b('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x1a2564,_0x58c68b[_0x408b('0x10')]['message']);return _0x341ce3(_0x58c68b[_0x408b('0x10')][_0x408b('0x12')]);}else{logger[_0x408b('0xd')](_0x408b('0xe'),_0x1a2564,_0x408b('0xf'));_0x341ce3(_0x58c68b['result'][_0x408b('0x12')]);}})[_0x408b('0x13')](function(_0x4b0a1c){logger[_0x408b('0x10')](_0x408b('0xe'),_0x1a2564,_0x4b0a1c);_0x254c04(_0x4b0a1c);});});}exports[_0x408b('0x14')]=function(_0xf14152){var _0x454e11=this;return new Promise(function(_0x28e9e5,_0x5aa86d){return db['OpenchannelApplication']['update'](_0xf14152['body'],{'raw':_0xf14152[_0x408b('0x15')]?_0xf14152[_0x408b('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf14152[_0x408b('0x15')]?_0xf14152['options'][_0x408b('0x16')]||null:null,'attributes':_0xf14152[_0x408b('0x15')]?_0xf14152[_0x408b('0x15')][_0x408b('0x17')]||null:null,'limit':_0xf14152[_0x408b('0x15')]?_0xf14152['options']['limit']||null:null})[_0x408b('0xc')](function(_0x250bd3){logger['info'](_0x408b('0x14'),_0xf14152);logger[_0x408b('0x18')](_0x408b('0x14'),_0xf14152,JSON[_0x408b('0x19')](_0x250bd3));_0x28e9e5(_0x250bd3);})[_0x408b('0x13')](function(_0x4d7a97){logger[_0x408b('0x10')](_0x408b('0x14'),_0x4d7a97['message'],_0xf14152);_0x5aa86d(_0x454e11['error'](0x1f4,_0x4d7a97[_0x408b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index cd22ac7..65db5af 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 _0xc1b7=['/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','addMessage'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xc1b7,0x190));var _0x7c1b=function(_0x578e76,_0x2047bb){_0x578e76=_0x578e76-0x0;var _0x26e58b=_0xc1b7[_0x578e76];return _0x26e58b;};'use strict';var multer=require(_0x7c1b('0x0'));var util=require(_0x7c1b('0x1'));var path=require(_0x7c1b('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c1b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7c1b('0x4'));var interaction=require(_0x7c1b('0x5'));var config=require(_0x7c1b('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x7c1b('0x7')]('/',auth[_0x7c1b('0x8')](),controller['index']);router['get']('/describe',auth[_0x7c1b('0x8')](),controller[_0x7c1b('0x9')]);router[_0x7c1b('0x7')](_0x7c1b('0xa'),auth[_0x7c1b('0x8')](),controller[_0x7c1b('0xb')]);router[_0x7c1b('0x7')](_0x7c1b('0xc'),auth[_0x7c1b('0x8')](),controller['getMessages']);router[_0x7c1b('0x7')](_0x7c1b('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x7c1b('0xe')]('/',auth[_0x7c1b('0x8')](),controller['create']);router[_0x7c1b('0xe')](_0x7c1b('0xc'),auth['isAuthenticated'](),controller[_0x7c1b('0xf')]);router['post'](_0x7c1b('0x10'),auth[_0x7c1b('0x8')](),interaction[_0x7c1b('0x11')](_0x7c1b('0x12'),_0x7c1b('0x13')),controller['addTags']);router[_0x7c1b('0x14')](_0x7c1b('0xa'),auth[_0x7c1b('0x8')](),interaction[_0x7c1b('0x11')](_0x7c1b('0x12'),_0x7c1b('0x15')),controller[_0x7c1b('0x16')]);router[_0x7c1b('0x17')](_0x7c1b('0xa'),auth[_0x7c1b('0x8')](),interaction[_0x7c1b('0x11')](_0x7c1b('0x12'),'openchannelinteraction:destroy'),controller[_0x7c1b('0x18')]);router[_0x7c1b('0x17')](_0x7c1b('0x10'),auth[_0x7c1b('0x8')](),controller['removeTags']);module[_0x7c1b('0x19')]=router; \ No newline at end of file +var _0xb5f9=['getMessages','/:id/download','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','/:id','update','delete','tracked','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/messages'];(function(_0x4dfa64,_0x329287){var _0x913d72=function(_0x20a95e){while(--_0x20a95e){_0x4dfa64['push'](_0x4dfa64['shift']());}};_0x913d72(++_0x329287);}(_0xb5f9,0x1a8));var _0x9b5f=function(_0x579e4e,_0x16200e){_0x579e4e=_0x579e4e-0x0;var _0x356670=_0xb5f9[_0x579e4e];return _0x356670;};'use strict';var multer=require(_0x9b5f('0x0'));var util=require(_0x9b5f('0x1'));var path=require(_0x9b5f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9b5f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9b5f('0x4'));var controller=require('./openchannelInteraction.controller');router[_0x9b5f('0x5')]('/',auth[_0x9b5f('0x6')](),controller['index']);router[_0x9b5f('0x5')](_0x9b5f('0x7'),auth[_0x9b5f('0x6')](),controller[_0x9b5f('0x8')]);router[_0x9b5f('0x5')]('/:id',auth[_0x9b5f('0x6')](),controller[_0x9b5f('0x9')]);router['get'](_0x9b5f('0xa'),auth['isAuthenticated'](),controller[_0x9b5f('0xb')]);router[_0x9b5f('0x5')](_0x9b5f('0xc'),auth['isAuthenticated'](),controller[_0x9b5f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9b5f('0xe')]('/:id/messages',auth[_0x9b5f('0x6')](),controller[_0x9b5f('0xf')]);router['post'](_0x9b5f('0x10'),auth['isAuthenticated'](),interaction['tracked'](_0x9b5f('0x11'),_0x9b5f('0x12')),controller[_0x9b5f('0x13')]);router[_0x9b5f('0x14')](_0x9b5f('0x15'),auth[_0x9b5f('0x6')](),interaction['tracked'](_0x9b5f('0x11'),'openchannelinteraction:update'),controller[_0x9b5f('0x16')]);router[_0x9b5f('0x17')](_0x9b5f('0x15'),auth[_0x9b5f('0x6')](),interaction[_0x9b5f('0x18')]('openchannel',_0x9b5f('0x19')),controller[_0x9b5f('0x1a')]);router[_0x9b5f('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0x9b5f('0x1b')]);module[_0x9b5f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d84999e..c4ee357 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 _0xb9e7=['BOOLEAN','DATE','STRING','out','ENUM','exports'];(function(_0x5f54d0,_0x5123ca){var _0x277122=function(_0xc14ec3){while(--_0xc14ec3){_0x5f54d0['push'](_0x5f54d0['shift']());}};_0x277122(++_0x5123ca);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xb9e7[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'closed':{'type':Sequelize[_0x7b9e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b9e('0x2')]},'disposition':{'type':Sequelize[_0x7b9e('0x3')]},'secondDisposition':{'type':Sequelize[_0x7b9e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7b9e('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7b9e('0x2')]},'threadId':{'type':Sequelize[_0x7b9e('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x7b9e('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b9e('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7b9e('0x5')]('in',_0x7b9e('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7b9e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x7b9e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7af2=['INTEGER','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0x7af2,0x119));var _0x27af=function(_0x54d56e,_0x524fbf){_0x54d56e=_0x54d56e-0x0;var _0x457d42=_0x7af2[_0x54d56e];return _0x457d42;};'use strict';var Sequelize=require('sequelize');module[_0x27af('0x0')]={'closed':{'type':Sequelize[_0x27af('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x27af('0x2')]},'disposition':{'type':Sequelize[_0x27af('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x27af('0x3')]},'note':{'type':Sequelize[_0x27af('0x3')]},'read1stAt':{'type':Sequelize[_0x27af('0x2')]},'threadId':{'type':Sequelize[_0x27af('0x3')]},'externalUrl':{'type':Sequelize[_0x27af('0x3')]},'lastMsgAt':{'type':Sequelize[_0x27af('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x27af('0x4')]('in',_0x27af('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x27af('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x27af('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x27af('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x27af('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 65b99c7..eb1f434 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 _0x58b9=['findAll','openchannel','user','catch','show','type','query','from','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','addMessage','OpenchannelMessage','ids','getMessages','filters','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','join','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','read','Owner','get','mkdirSync','Openchannel','Account','toString','closedAt','disposition','threadId','Public','pipe','createWriteStream','basename','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','zip-dir','moment','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','then','sendStatus','stack','name','send','index','map','OpenchannelInteraction','fieldName','key'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x58b9,0x1cb));var _0x958b=function(_0x1555bd,_0x49a485){_0x1555bd=_0x1555bd-0x0;var _0x1dc784=_0x58b9[_0x1555bd];return _0x1dc784;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x958b('0x0'));var moment=require(_0x958b('0x1'));var util=require(_0x958b('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x958b('0x3'));var Redis=require(_0x958b('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x958b('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x958b('0x6'))('api');var config=require(_0x958b('0x7'));var db=require(_0x958b('0x8'))['db'];config['redis']=_[_0x958b('0x9')](config[_0x958b('0xa')],{'host':_0x958b('0xb'),'port':0x18eb});var socket=require(_0x958b('0xc'))(new Redis(config[_0x958b('0xa')]));require(_0x958b('0xd'))['register'](socket);function respondWithStatusCode(_0xb81dbe,_0x29b75a){_0x29b75a=_0x29b75a||0xcc;return function(_0x2156e0){if(_0x2156e0){return _0xb81dbe['sendStatus'](_0x29b75a);}return _0xb81dbe[_0x958b('0xe')](_0x29b75a)[_0x958b('0xf')]();};}function respondWithResult(_0x2ccaf3,_0x5e08dd){_0x5e08dd=_0x5e08dd||0xc8;return function(_0x52cd77){if(_0x52cd77){return _0x2ccaf3[_0x958b('0xe')](_0x5e08dd)['json'](_0x52cd77);}};}function respondWithFilteredResult(_0x4dfc48,_0x93dd64){return function(_0x11ffd4){if(_0x11ffd4){var _0x9b86f6=typeof _0x93dd64[_0x958b('0x10')]===_0x958b('0x11')&&typeof _0x93dd64[_0x958b('0x12')]===_0x958b('0x11');var _0x2b4f7b=_0x11ffd4[_0x958b('0x13')];var _0x1a4c99=_0x9b86f6?0x0:_0x93dd64[_0x958b('0x10')];var _0x3f5c3b=_0x9b86f6?_0x11ffd4[_0x958b('0x13')]:_0x93dd64['offset']+_0x93dd64[_0x958b('0x12')];var _0x588854;if(_0x3f5c3b>=_0x2b4f7b){_0x3f5c3b=_0x2b4f7b;_0x588854=0xc8;}else{_0x588854=0xce;}_0x4dfc48[_0x958b('0xe')](_0x588854);return _0x4dfc48[_0x958b('0x14')](_0x958b('0x15'),_0x1a4c99+'-'+_0x3f5c3b+'/'+_0x2b4f7b)[_0x958b('0x16')](_0x11ffd4);}return null;};}function saveUpdates(_0x235227){return function(_0x3eccc1){if(_0x3eccc1){return _0x3eccc1['update'](_0x235227)[_0x958b('0x17')](function(_0x3dcd6e){return _0x3dcd6e;});}return null;};}function removeEntity(_0x2c8bfd){return function(_0x52c2f9){if(_0x52c2f9){return _0x52c2f9['destroy']()['then'](function(){_0x2c8bfd[_0x958b('0xe')](0xcc)[_0x958b('0xf')]();});}};}function handleEntityNotFound(_0x4365d9){return function(_0x2f5680){if(!_0x2f5680){_0x4365d9[_0x958b('0x18')](0x194);}return _0x2f5680;};}function handleError(_0x186154,_0x34c23b){_0x34c23b=_0x34c23b||0x1f4;return function(_0x102c10){logger['error'](_0x102c10[_0x958b('0x19')]);if(_0x102c10['name']){delete _0x102c10[_0x958b('0x1a')];}_0x186154[_0x958b('0xe')](_0x34c23b)[_0x958b('0x1b')](_0x102c10);};}exports[_0x958b('0x1c')]=function(_0x4ab058,_0x424679){var _0xffd848={};var _0x4362ea=_[_0x958b('0x1d')](db[_0x958b('0x1e')]['rawAttributes'],function(_0xc1005d){return{'name':_0xc1005d[_0x958b('0x1f')],'type':_0xc1005d['type'][_0x958b('0x20')]};});_0xffd848=qs['getOptions'](_0x4362ea,_0x4ab058);return interaction[_0x958b('0x21')](_0x958b('0x22'),_0x4ab058['query'],_0x4ab058[_0x958b('0x23')],_0xffd848,_0x4362ea)['then'](respondWithFilteredResult(_0x424679,_0xffd848))[_0x958b('0x24')](handleError(_0x424679,null));};exports[_0x958b('0x25')]=function(_0x3a617c,_0x136337){var _0x193b30={};if(_0x3a617c['query'][_0x958b('0x26')]&&_0x3a617c[_0x958b('0x27')][_0x958b('0x26')]===_0x958b('0x28')){_0x193b30[_0x958b('0x28')]=_0x3a617c[_0x958b('0x29')]['id'];}else{_0x193b30['id']=_0x3a617c[_0x958b('0x29')]['id'];}var _0x537e12={'raw':![],'where':_0x193b30},_0x59613b={};_0x59613b[_0x958b('0x2a')]=_[_0x958b('0x2b')](db['OpenchannelInteraction'][_0x958b('0x2c')]);_0x59613b[_0x958b('0x27')]=_['keys'](_0x3a617c[_0x958b('0x27')]);_0x59613b['filters']=_[_0x958b('0x2d')](_0x59613b[_0x958b('0x2a')],_0x59613b[_0x958b('0x27')]);_0x537e12[_0x958b('0x2e')]=_[_0x958b('0x2d')](_0x59613b['model'],qs[_0x958b('0x2f')](_0x3a617c['query']['fields']));_0x537e12[_0x958b('0x2e')]=_0x537e12[_0x958b('0x2e')][_0x958b('0x30')]?_0x537e12[_0x958b('0x2e')]:_0x59613b[_0x958b('0x2a')];if(_0x3a617c['query'][_0x958b('0x31')]){_0x537e12[_0x958b('0x32')]=[{'all':!![]}];}_0x537e12=_[_0x958b('0x33')]({},_0x537e12,_0x3a617c[_0x958b('0x34')]);return db[_0x958b('0x1e')][_0x958b('0x35')](_0x537e12)[_0x958b('0x17')](handleEntityNotFound(_0x136337,null))[_0x958b('0x17')](respondWithResult(_0x136337,null))['catch'](handleError(_0x136337,null));};exports[_0x958b('0x36')]=function(_0x19cc77,_0x4125b3){return db[_0x958b('0x1e')][_0x958b('0x36')](_0x19cc77[_0x958b('0x37')],{})[_0x958b('0x17')](respondWithResult(_0x4125b3,0xc9))['catch'](handleError(_0x4125b3,null));};exports[_0x958b('0x38')]=function(_0x3681c8,_0x7e5c29){if(_0x3681c8[_0x958b('0x37')]['id']){delete _0x3681c8[_0x958b('0x37')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x3681c8[_0x958b('0x29')]['id']}})[_0x958b('0x17')](handleEntityNotFound(_0x7e5c29,null))[_0x958b('0x17')](saveUpdates(_0x3681c8[_0x958b('0x37')],null))['then'](respondWithResult(_0x7e5c29,null))['catch'](handleError(_0x7e5c29,null));};exports['destroy']=function(_0x17e845,_0x1380e5){return db[_0x958b('0x1e')][_0x958b('0x35')]({'where':{'id':_0x17e845[_0x958b('0x29')]['id']}})[_0x958b('0x17')](handleEntityNotFound(_0x1380e5,null))['then'](removeEntity(_0x1380e5,null))[_0x958b('0x24')](handleError(_0x1380e5,null));};exports[_0x958b('0x39')]=function(_0x6ff9f0,_0x4d1478){return db['OpenchannelInteraction'][_0x958b('0x39')]()[_0x958b('0x17')](respondWithResult(_0x4d1478,null))[_0x958b('0x24')](handleError(_0x4d1478,null));};exports[_0x958b('0x3a')]=function(_0x182c7a,_0x3fb0ae){return db[_0x958b('0x3b')]['find']({'where':{'id':_0x182c7a[_0x958b('0x29')]['id']}})[_0x958b('0x17')](handleEntityNotFound(_0x3fb0ae,null))[_0x958b('0x17')](function(_0x4b263a){if(_0x4b263a){return _0x4b263a[_0x958b('0x3a')](_0x182c7a['body'][_0x958b('0x3c')],_['omit'](_0x182c7a['body'],[_0x958b('0x3c'),'id'])||{});}})[_0x958b('0x17')](respondWithResult(_0x3fb0ae,null))[_0x958b('0x24')](handleError(_0x3fb0ae,null));};exports[_0x958b('0x3d')]=function(_0x2f8da1,_0x528238){var _0x2981a6={'raw':![],'where':{}};var _0x38043b={};var _0x4abe9b={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x2f8da1[_0x958b('0x29')]['id']}})[_0x958b('0x17')](handleEntityNotFound(_0x528238,null))[_0x958b('0x17')](function(_0x307170){if(_0x307170){_0x38043b['model']=_['keys'](db[_0x958b('0x3b')][_0x958b('0x2c')]);_0x38043b[_0x958b('0x27')]=_[_0x958b('0x2b')](_0x2f8da1[_0x958b('0x27')]);_0x38043b[_0x958b('0x3e')]=_['intersection'](_0x38043b[_0x958b('0x2a')],_0x38043b[_0x958b('0x27')]);_0x2981a6['attributes']=_[_0x958b('0x2d')](_0x38043b[_0x958b('0x2a')],qs['fields'](_0x2f8da1[_0x958b('0x27')]['fields']));_0x2981a6[_0x958b('0x2e')]=_0x2981a6['attributes'][_0x958b('0x30')]?_0x2981a6[_0x958b('0x2e')]:_0x38043b['model'];if(!_0x2f8da1['query'][_0x958b('0x3f')](_0x958b('0x40'))){_0x2981a6['limit']=qs[_0x958b('0x12')](_0x2f8da1[_0x958b('0x27')][_0x958b('0x12')]);_0x2981a6[_0x958b('0x10')]=qs[_0x958b('0x10')](_0x2f8da1[_0x958b('0x27')][_0x958b('0x10')]);}_0x2981a6['order']=qs[_0x958b('0x41')](_0x2f8da1[_0x958b('0x27')][_0x958b('0x41')]);_0x2981a6[_0x958b('0x42')]=qs[_0x958b('0x3e')](_[_0x958b('0x43')](_0x2f8da1[_0x958b('0x27')],_0x38043b[_0x958b('0x3e')]));_0x2981a6['where'][_0x958b('0x44')]=_0x307170['id'];if(_0x2f8da1[_0x958b('0x27')][_0x958b('0x45')]){_0x2981a6[_0x958b('0x42')]=_[_0x958b('0x33')](_0x2981a6[_0x958b('0x42')],{'$or':_[_0x958b('0x1d')](_0x2981a6[_0x958b('0x2e')],function(_0x3c804a){var _0x179324={};_0x179324[_0x3c804a]={'$like':'%'+_0x2f8da1[_0x958b('0x27')]['filter']+'%'};return _0x179324;})});}if(_0x2f8da1[_0x958b('0x27')]['$gte']){var _0x251e17=_0x2f8da1['query'][_0x958b('0x46')][_0x958b('0x47')](',');var _0x1e86c3={};_0x1e86c3[_0x251e17[0x0]]={'$gte':moment(_0x251e17[0x1])['format'](_0x958b('0x48'))};_0x2981a6['where']=_[_0x958b('0x33')](_0x2981a6[_0x958b('0x42')],_0x1e86c3);}_0x2981a6=_[_0x958b('0x33')]({},_0x2981a6,_0x2f8da1['options']);return db['OpenchannelMessage'][_0x958b('0x13')]({'where':_0x2981a6[_0x958b('0x42')]})['then'](function(_0x1664b3){_0x4abe9b[_0x958b('0x13')]=_0x1664b3;if(_0x2f8da1[_0x958b('0x27')][_0x958b('0x31')]){_0x2981a6['include']=[{'all':!![]}];}return db[_0x958b('0x3b')][_0x958b('0x21')](_0x2981a6);})[_0x958b('0x17')](function(_0x1fb390){_0x4abe9b[_0x958b('0x49')]=_0x1fb390;return _0x4abe9b;});}})['then'](respondWithFilteredResult(_0x528238,_0x2981a6))['catch'](handleError(_0x528238,null));};exports[_0x958b('0x4a')]=function(_0x47a467,_0x12bcb9){return db[_0x958b('0x1e')][_0x958b('0x35')]({'where':{'id':_0x47a467['params']['id']}})[_0x958b('0x17')](handleEntityNotFound(_0x12bcb9,null))[_0x958b('0x17')](function(_0x4e182d){if(_0x4e182d){return _0x4e182d['setTags'](_0x47a467[_0x958b('0x37')][_0x958b('0x3c')],_['omit'](_0x47a467[_0x958b('0x37')],[_0x958b('0x3c'),'id'])||{})[_0x958b('0x4b')](function(){return db[_0x958b('0x4c')][_0x958b('0x21')]({'attributes':['id',_0x958b('0x1a'),_0x958b('0x4d')],'where':{'id':_0x47a467['body'][_0x958b('0x3c')]}});})[_0x958b('0x17')](function(_0x9f61f2){socket[_0x958b('0x4e')](_0x958b('0x4f'),{'id':Number(_0x47a467[_0x958b('0x29')]['id']),'tags':_0x9f61f2||[]});return{'id':Number(_0x47a467[_0x958b('0x29')]['id']),'tags':_0x9f61f2||[]};});}})[_0x958b('0x17')](respondWithResult(_0x12bcb9,null))['catch'](handleError(_0x12bcb9,null));};exports[_0x958b('0x50')]=function(_0x325bf8,_0x196a7e){return db[_0x958b('0x1e')][_0x958b('0x35')]({'where':{'id':_0x325bf8[_0x958b('0x29')]['id']}})[_0x958b('0x17')](handleEntityNotFound(_0x196a7e,null))[_0x958b('0x17')](function(_0x1ad515){if(_0x1ad515){return _0x1ad515[_0x958b('0x50')](_0x325bf8['query'][_0x958b('0x3c')]);}})['then'](respondWithStatusCode(_0x196a7e,null))['catch'](handleError(_0x196a7e,null));};exports[_0x958b('0x51')]=function(_0x563cc6,_0x508758){var _0x2381de=moment()[_0x958b('0x52')]()['toString']();var _0x277a30=path['join'](config[_0x958b('0x53')],_0x958b('0x54'),'files','tmp');var _0x5bb13a=path['join'](config[_0x958b('0x53')],_0x958b('0x54'),'files','attachments');var _0x33363f=path[_0x958b('0x55')](_0x277a30,_0x2381de);var _0x5112e6=util[_0x958b('0x56')](_0x958b('0x57'),_0x563cc6[_0x958b('0x29')]['id'],_0x2381de);var _0x5201ab=path[_0x958b('0x55')](_0x277a30,_0x5112e6);var _0x15fadd=[];_0x15fadd[_0x958b('0x58')]({'model':db['User'],'as':_0x958b('0x59'),'attributes':['id',_0x958b('0x5a')],'raw':!![]});_0x15fadd['push']({'model':db['CmContact'],'as':_0x958b('0x5b'),'attributes':['id',_0x958b('0x5c'),'lastName'],'raw':!![]});if(_0x563cc6[_0x958b('0x27')][_0x958b('0x5d')]){_0x15fadd['push']({'model':db[_0x958b('0x5e')],'as':_0x958b('0x5e'),'raw':!![]});}var _0x5de101=[{'model':db[_0x958b('0x3b')],'as':_0x958b('0x5f'),'attributes':['id',_0x958b('0x37'),_0x958b('0x60'),_0x958b('0x61'),_0x958b('0x62'),_0x958b('0x63')],'include':_0x15fadd}];_0x5de101[_0x958b('0x58')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0x958b('0x1a')]});_0x5de101['push']({'model':db[_0x958b('0x59')],'as':_0x958b('0x64'),'attributes':['id',_0x958b('0x5a')]});return db[_0x958b('0x1e')]['find']({'where':{'id':_0x563cc6[_0x958b('0x29')]['id']},'include':_0x5de101})[_0x958b('0x17')](handleEntityNotFound(_0x508758,null))['then'](function(_0xa72bc4){if(_0xa72bc4){var _0x22cb25=_0xa72bc4[_0x958b('0x65')]({'plain':!![]});fs[_0x958b('0x66')](_0x33363f);var _0x525f02={'channel':_0x958b('0x67'),'account':_0x22cb25[_0x958b('0x68')][_0x958b('0x1a')],'agent':_0x22cb25[_0x958b('0x64')]?_0x22cb25['Owner'][_0x958b('0x5a')]:'N.A.','createdAt':moment(_0x22cb25[_0x958b('0x60')])[_0x958b('0x56')](_0x958b('0x48'))[_0x958b('0x69')](),'closedAt':_0x22cb25['closed']?moment(_0x22cb25[_0x958b('0x6a')])[_0x958b('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0x958b('0x69')]():'','disposition':_0x22cb25[_0x958b('0x6b')],'visibility':_0x22cb25[_0x958b('0x6c')]?_0x958b('0x6d'):'Private','messages':_(_0x22cb25[_0x958b('0x5f')])['filter']({'secret':![]})[_0x958b('0x1d')](function(_0x225507){if(_0x225507[_0x958b('0x5e')]){var _0x118b41=path[_0x958b('0x55')](_0x5bb13a,_0x225507[_0x958b('0x5e')]['basename']);if(fs['existsSync'](_0x118b41)){fs['createReadStream'](_0x118b41)[_0x958b('0x6e')](fs[_0x958b('0x6f')](path[_0x958b('0x55')](_0x33363f,_0x225507[_0x958b('0x5e')][_0x958b('0x70')])));}}return{'date':moment(_0x225507[_0x958b('0x60')])[_0x958b('0x56')](_0x958b('0x48'))[_0x958b('0x69')](),'sender':_0x225507[_0x958b('0x61')]===_0x958b('0x71')?_0x225507['User']?_0x225507['User'][_0x958b('0x5a')]:_0x958b('0x72'):_0x225507[_0x958b('0x5b')][_0x958b('0x5c')]+(_0x225507[_0x958b('0x5b')]['lastName']?'\x20'+_0x225507['Contact']['lastName']:''),'body':_0x225507[_0x958b('0x5e')]?_0x225507[_0x958b('0x5e')]['basename']:_0x225507[_0x958b('0x37')],'direction':_0x225507[_0x958b('0x61')]===_0x958b('0x71')?'A':'C','secret':_0x225507['secret'],'read':_0x225507['read'],'attachment':_0x225507[_0x958b('0x5e')]};})[_0x958b('0x73')]()};return ejs[_0x958b('0x74')](path[_0x958b('0x55')](config['root'],_0x958b('0x54'),_0x958b('0x75'),_0x958b('0x76')),{'interaction':_0x525f02})['then'](function(_0x50572e){var _0x45f6be=path['join'](_0x33363f,_0x958b('0x77')+_0x22cb25['id']+'-'+_0x2381de+_0x958b('0x78'));var _0x43c3fd={'path':_0x45f6be,'channel':_0x958b('0x67'),'interactionId':_0x22cb25['id']};return pdf[_0x958b('0x79')](_0x50572e,_0x43c3fd);})[_0x958b('0x17')](function(){return new Promise(function(_0x33d62e,_0x3dac73){zipdir(_0x33363f,{'saveTo':_0x5201ab},function(_0xa55a0b,_0x5bba3f){if(_0xa55a0b)return _0x3dac73(_0xa55a0b);return _0x33d62e(_0x5bba3f);});})[_0x958b('0x17')](function(){return new Promise(function(_0x263ec8,_0x300a7e){rimraf(_0x33363f,function(_0xa5cf5a){if(_0xa5cf5a)_0x300a7e(_0xa5cf5a);return _0x263ec8();});});})[_0x958b('0x17')](function(){return _0x508758[_0x958b('0x51')](_0x5201ab,_0x5112e6,function(_0x3d0880){if(_0x3d0880){logger[_0x958b('0x7a')]('Unable\x20to\x20delete\x20zip\x20file',_0x3d0880);}else{fs['unlinkSync'](_0x5201ab);}});});});}else{return _0x508758[_0x958b('0x18')](0xc8);}})[_0x958b('0x24')](handleError(_0x508758,null));}; \ No newline at end of file +var _0x468c=['lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','Public','basename','existsSync','pipe','createWriteStream','out','System','firstName','Contact','value','renderFile','views','transcript-','createPdfFromHTML','error','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','fields','length','include','merge','find','create','body','describe','addMessage','ids','omit','OpenchannelMessage','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact'];(function(_0x2857f5,_0x181da1){var _0xb5aed6=function(_0x1a0097){while(--_0x1a0097){_0x2857f5['push'](_0x2857f5['shift']());}};_0xb5aed6(++_0x181da1);}(_0x468c,0x19f));var _0xc468=function(_0x5d5c63,_0x5e6b8f){_0x5d5c63=_0x5d5c63-0x0;var _0x28dd3c=_0x468c[_0x5d5c63];return _0x28dd3c;};'use strict';var rimraf=require(_0xc468('0x0'));var zipdir=require('zip-dir');var moment=require(_0xc468('0x1'));var util=require(_0xc468('0x2'));var path=require(_0xc468('0x3'));var ejs=require(_0xc468('0x4'));var fs=require('fs');var _=require(_0xc468('0x5'));var Redis=require(_0xc468('0x6'));var interaction=require(_0xc468('0x7'));var qs=require(_0xc468('0x8'));var pdf=require(_0xc468('0x9'));var logger=require(_0xc468('0xa'))('api');var config=require('../../config/environment');var db=require(_0xc468('0xb'))['db'];config[_0xc468('0xc')]=_[_0xc468('0xd')](config[_0xc468('0xc')],{'host':_0xc468('0xe'),'port':0x18eb});var socket=require(_0xc468('0xf'))(new Redis(config['redis']));require(_0xc468('0x10'))['register'](socket);function respondWithStatusCode(_0x123447,_0x58e58d){_0x58e58d=_0x58e58d||0xcc;return function(_0x4b5245){if(_0x4b5245){return _0x123447[_0xc468('0x11')](_0x58e58d);}return _0x123447['status'](_0x58e58d)[_0xc468('0x12')]();};}function respondWithResult(_0x1961e1,_0x1df40e){_0x1df40e=_0x1df40e||0xc8;return function(_0x330597){if(_0x330597){return _0x1961e1[_0xc468('0x13')](_0x1df40e)[_0xc468('0x14')](_0x330597);}};}function respondWithFilteredResult(_0x36f821,_0x1f91a9){return function(_0x10ee06){if(_0x10ee06){var _0x45e62f=typeof _0x1f91a9[_0xc468('0x15')]===_0xc468('0x16')&&typeof _0x1f91a9[_0xc468('0x17')]===_0xc468('0x16');var _0x51891b=_0x10ee06[_0xc468('0x18')];var _0x266933=_0x45e62f?0x0:_0x1f91a9[_0xc468('0x15')];var _0xbdeedd=_0x45e62f?_0x10ee06['count']:_0x1f91a9[_0xc468('0x15')]+_0x1f91a9[_0xc468('0x17')];var _0x2549bb;if(_0xbdeedd>=_0x51891b){_0xbdeedd=_0x51891b;_0x2549bb=0xc8;}else{_0x2549bb=0xce;}_0x36f821[_0xc468('0x13')](_0x2549bb);return _0x36f821[_0xc468('0x19')](_0xc468('0x1a'),_0x266933+'-'+_0xbdeedd+'/'+_0x51891b)[_0xc468('0x14')](_0x10ee06);}return null;};}function saveUpdates(_0x3f0d88){return function(_0x5c01ef){if(_0x5c01ef){return _0x5c01ef['update'](_0x3f0d88)[_0xc468('0x1b')](function(_0xe7b17b){return _0xe7b17b;});}return null;};}function removeEntity(_0x1de312){return function(_0x4f7edb){if(_0x4f7edb){return _0x4f7edb[_0xc468('0x1c')]()['then'](function(){_0x1de312[_0xc468('0x13')](0xcc)[_0xc468('0x12')]();});}};}function handleEntityNotFound(_0x5ca699){return function(_0x70d478){if(!_0x70d478){_0x5ca699[_0xc468('0x11')](0x194);}return _0x70d478;};}function handleError(_0x15a054,_0x30ae12){_0x30ae12=_0x30ae12||0x1f4;return function(_0x177b41){logger['error'](_0x177b41[_0xc468('0x1d')]);if(_0x177b41['name']){delete _0x177b41[_0xc468('0x1e')];}_0x15a054[_0xc468('0x13')](_0x30ae12)[_0xc468('0x1f')](_0x177b41);};}exports[_0xc468('0x20')]=function(_0x29ea78,_0x36e4ea){var _0x594de3={};var _0x16f14b=_[_0xc468('0x21')](db[_0xc468('0x22')][_0xc468('0x23')],function(_0x551d24){return{'name':_0x551d24[_0xc468('0x24')],'type':_0x551d24[_0xc468('0x25')]['key']};});_0x594de3=qs[_0xc468('0x26')](_0x16f14b,_0x29ea78);return interaction[_0xc468('0x27')](_0xc468('0x28'),_0x29ea78[_0xc468('0x29')],_0x29ea78[_0xc468('0x2a')],_0x594de3,_0x16f14b)[_0xc468('0x1b')](respondWithFilteredResult(_0x36e4ea,_0x594de3))[_0xc468('0x2b')](handleError(_0x36e4ea,null));};exports[_0xc468('0x2c')]=function(_0x559bd5,_0xebf11d){var _0x2ace56={};if(_0x559bd5[_0xc468('0x29')][_0xc468('0x25')]&&_0x559bd5[_0xc468('0x29')]['type']===_0xc468('0x2d')){_0x2ace56[_0xc468('0x2d')]=_0x559bd5[_0xc468('0x2e')]['id'];}else{_0x2ace56['id']=_0x559bd5[_0xc468('0x2e')]['id'];}var _0x1459a5={'raw':![],'where':_0x2ace56},_0x1e7dd8={};_0x1e7dd8[_0xc468('0x2f')]=_['keys'](db['OpenchannelInteraction'][_0xc468('0x23')]);_0x1e7dd8['query']=_[_0xc468('0x30')](_0x559bd5[_0xc468('0x29')]);_0x1e7dd8[_0xc468('0x31')]=_['intersection'](_0x1e7dd8[_0xc468('0x2f')],_0x1e7dd8[_0xc468('0x29')]);_0x1459a5[_0xc468('0x32')]=_[_0xc468('0x33')](_0x1e7dd8[_0xc468('0x2f')],qs[_0xc468('0x34')](_0x559bd5[_0xc468('0x29')][_0xc468('0x34')]));_0x1459a5[_0xc468('0x32')]=_0x1459a5[_0xc468('0x32')][_0xc468('0x35')]?_0x1459a5[_0xc468('0x32')]:_0x1e7dd8[_0xc468('0x2f')];if(_0x559bd5[_0xc468('0x29')]['includeAll']){_0x1459a5[_0xc468('0x36')]=[{'all':!![]}];}_0x1459a5=_[_0xc468('0x37')]({},_0x1459a5,_0x559bd5['options']);return db['OpenchannelInteraction'][_0xc468('0x38')](_0x1459a5)[_0xc468('0x1b')](handleEntityNotFound(_0xebf11d,null))['then'](respondWithResult(_0xebf11d,null))[_0xc468('0x2b')](handleError(_0xebf11d,null));};exports[_0xc468('0x39')]=function(_0x380f41,_0xb2e633){return db[_0xc468('0x22')]['create'](_0x380f41['body'],{})['then'](respondWithResult(_0xb2e633,0xc9))['catch'](handleError(_0xb2e633,null));};exports['update']=function(_0x285109,_0x385d87){if(_0x285109[_0xc468('0x3a')]['id']){delete _0x285109[_0xc468('0x3a')]['id'];}return db[_0xc468('0x22')]['find']({'where':{'id':_0x285109[_0xc468('0x2e')]['id']}})[_0xc468('0x1b')](handleEntityNotFound(_0x385d87,null))[_0xc468('0x1b')](saveUpdates(_0x285109[_0xc468('0x3a')],null))['then'](respondWithResult(_0x385d87,null))['catch'](handleError(_0x385d87,null));};exports[_0xc468('0x1c')]=function(_0xb2d84f,_0x580511){return db['OpenchannelInteraction']['find']({'where':{'id':_0xb2d84f['params']['id']}})[_0xc468('0x1b')](handleEntityNotFound(_0x580511,null))[_0xc468('0x1b')](removeEntity(_0x580511,null))[_0xc468('0x2b')](handleError(_0x580511,null));};exports[_0xc468('0x3b')]=function(_0x5652a1,_0x224dc0){return db[_0xc468('0x22')]['describe']()[_0xc468('0x1b')](respondWithResult(_0x224dc0,null))[_0xc468('0x2b')](handleError(_0x224dc0,null));};exports['addMessage']=function(_0x1da40d,_0x1988d1){return db['OpenchannelMessage'][_0xc468('0x38')]({'where':{'id':_0x1da40d[_0xc468('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1988d1,null))[_0xc468('0x1b')](function(_0x19fce7){if(_0x19fce7){return _0x19fce7[_0xc468('0x3c')](_0x1da40d[_0xc468('0x3a')][_0xc468('0x3d')],_[_0xc468('0x3e')](_0x1da40d[_0xc468('0x3a')],['ids','id'])||{});}})['then'](respondWithResult(_0x1988d1,null))[_0xc468('0x2b')](handleError(_0x1988d1,null));};exports['getMessages']=function(_0x21e1c7,_0x1cc9c3){var _0x11108a={'raw':![],'where':{}};var _0x481a8d={};var _0x37f465={'count':0x0,'rows':[]};return db[_0xc468('0x22')]['findOne']({'where':{'id':_0x21e1c7[_0xc468('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1cc9c3,null))[_0xc468('0x1b')](function(_0x442cb7){if(_0x442cb7){_0x481a8d[_0xc468('0x2f')]=_['keys'](db[_0xc468('0x3f')]['rawAttributes']);_0x481a8d[_0xc468('0x29')]=_['keys'](_0x21e1c7[_0xc468('0x29')]);_0x481a8d[_0xc468('0x31')]=_[_0xc468('0x33')](_0x481a8d[_0xc468('0x2f')],_0x481a8d[_0xc468('0x29')]);_0x11108a[_0xc468('0x32')]=_[_0xc468('0x33')](_0x481a8d[_0xc468('0x2f')],qs[_0xc468('0x34')](_0x21e1c7[_0xc468('0x29')][_0xc468('0x34')]));_0x11108a[_0xc468('0x32')]=_0x11108a['attributes']['length']?_0x11108a[_0xc468('0x32')]:_0x481a8d[_0xc468('0x2f')];if(!_0x21e1c7[_0xc468('0x29')]['hasOwnProperty']('nolimit')){_0x11108a[_0xc468('0x17')]=qs['limit'](_0x21e1c7[_0xc468('0x29')][_0xc468('0x17')]);_0x11108a['offset']=qs[_0xc468('0x15')](_0x21e1c7[_0xc468('0x29')][_0xc468('0x15')]);}_0x11108a[_0xc468('0x40')]=qs['sort'](_0x21e1c7['query'][_0xc468('0x41')]);_0x11108a[_0xc468('0x42')]=qs[_0xc468('0x31')](_[_0xc468('0x43')](_0x21e1c7[_0xc468('0x29')],_0x481a8d[_0xc468('0x31')]));_0x11108a[_0xc468('0x42')][_0xc468('0x44')]=_0x442cb7['id'];if(_0x21e1c7[_0xc468('0x29')]['filter']){_0x11108a[_0xc468('0x42')]=_[_0xc468('0x37')](_0x11108a[_0xc468('0x42')],{'$or':_[_0xc468('0x21')](_0x11108a['attributes'],function(_0x4f5ec0){var _0x11fcf8={};_0x11fcf8[_0x4f5ec0]={'$like':'%'+_0x21e1c7[_0xc468('0x29')][_0xc468('0x45')]+'%'};return _0x11fcf8;})});}if(_0x21e1c7[_0xc468('0x29')][_0xc468('0x46')]){var _0xf1aa70=_0x21e1c7[_0xc468('0x29')][_0xc468('0x46')][_0xc468('0x47')](',');var _0xa19c35={};_0xa19c35[_0xf1aa70[0x0]]={'$gte':moment(_0xf1aa70[0x1])[_0xc468('0x48')](_0xc468('0x49'))};_0x11108a[_0xc468('0x42')]=_[_0xc468('0x37')](_0x11108a[_0xc468('0x42')],_0xa19c35);}_0x11108a=_['merge']({},_0x11108a,_0x21e1c7[_0xc468('0x4a')]);return db['OpenchannelMessage'][_0xc468('0x18')]({'where':_0x11108a[_0xc468('0x42')]})[_0xc468('0x1b')](function(_0x3ea13e){_0x37f465[_0xc468('0x18')]=_0x3ea13e;if(_0x21e1c7[_0xc468('0x29')][_0xc468('0x4b')]){_0x11108a['include']=[{'all':!![]}];}return db[_0xc468('0x3f')][_0xc468('0x27')](_0x11108a);})[_0xc468('0x1b')](function(_0x566cb5){_0x37f465[_0xc468('0x4c')]=_0x566cb5;return _0x37f465;});}})[_0xc468('0x1b')](respondWithFilteredResult(_0x1cc9c3,_0x11108a))[_0xc468('0x2b')](handleError(_0x1cc9c3,null));};exports[_0xc468('0x4d')]=function(_0x33bda8,_0x381e17){return db['OpenchannelInteraction'][_0xc468('0x38')]({'where':{'id':_0x33bda8[_0xc468('0x2e')]['id']}})[_0xc468('0x1b')](handleEntityNotFound(_0x381e17,null))[_0xc468('0x1b')](function(_0x4ca4c9){if(_0x4ca4c9){return _0x4ca4c9['setTags'](_0x33bda8[_0xc468('0x3a')]['ids'],_['omit'](_0x33bda8[_0xc468('0x3a')],[_0xc468('0x3d'),'id'])||{})[_0xc468('0x4e')](function(){return db[_0xc468('0x4f')][_0xc468('0x27')]({'attributes':['id',_0xc468('0x1e'),_0xc468('0x50')],'where':{'id':_0x33bda8[_0xc468('0x3a')][_0xc468('0x3d')]}});})[_0xc468('0x1b')](function(_0x381448){socket[_0xc468('0x51')](_0xc468('0x52'),{'id':Number(_0x33bda8[_0xc468('0x2e')]['id']),'tags':_0x381448||[]});return{'id':Number(_0x33bda8[_0xc468('0x2e')]['id']),'tags':_0x381448||[]};});}})[_0xc468('0x1b')](respondWithResult(_0x381e17,null))['catch'](handleError(_0x381e17,null));};exports[_0xc468('0x53')]=function(_0x452a5c,_0x1582e0){return db[_0xc468('0x22')][_0xc468('0x38')]({'where':{'id':_0x452a5c[_0xc468('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1582e0,null))[_0xc468('0x1b')](function(_0x5a85e9){if(_0x5a85e9){return _0x5a85e9[_0xc468('0x53')](_0x452a5c[_0xc468('0x29')][_0xc468('0x3d')]);}})[_0xc468('0x1b')](respondWithStatusCode(_0x1582e0,null))[_0xc468('0x2b')](handleError(_0x1582e0,null));};exports[_0xc468('0x54')]=function(_0x4928a9,_0x57b985){var _0x2a1983=moment()[_0xc468('0x55')]()[_0xc468('0x56')]();var _0x132059=path['join'](config[_0xc468('0x57')],_0xc468('0x58'),'files',_0xc468('0x59'));var _0x32eaac=path[_0xc468('0x5a')](config[_0xc468('0x57')],_0xc468('0x58'),'files',_0xc468('0x5b'));var _0x394f8a=path[_0xc468('0x5a')](_0x132059,_0x2a1983);var _0x75d6d2=util['format'](_0xc468('0x5c'),_0x4928a9['params']['id'],_0x2a1983);var _0x4e3fa0=path['join'](_0x132059,_0x75d6d2);var _0x51a30e=[];_0x51a30e[_0xc468('0x5d')]({'model':db['User'],'as':_0xc468('0x5e'),'attributes':['id',_0xc468('0x5f')],'raw':!![]});_0x51a30e[_0xc468('0x5d')]({'model':db[_0xc468('0x60')],'as':'Contact','attributes':['id','firstName',_0xc468('0x61')],'raw':!![]});if(_0x4928a9[_0xc468('0x29')][_0xc468('0x5b')]){_0x51a30e[_0xc468('0x5d')]({'model':db[_0xc468('0x62')],'as':'Attachment','raw':!![]});}var _0x4417d4=[{'model':db[_0xc468('0x3f')],'as':_0xc468('0x63'),'attributes':['id','body',_0xc468('0x64'),_0xc468('0x65'),_0xc468('0x66'),_0xc468('0x67')],'include':_0x51a30e}];_0x4417d4[_0xc468('0x5d')]({'model':db[_0xc468('0x68')],'as':_0xc468('0x69'),'attributes':['id',_0xc468('0x1e')]});_0x4417d4['push']({'model':db[_0xc468('0x5e')],'as':_0xc468('0x6a'),'attributes':['id',_0xc468('0x5f')]});return db[_0xc468('0x22')][_0xc468('0x38')]({'where':{'id':_0x4928a9[_0xc468('0x2e')]['id']},'include':_0x4417d4})['then'](handleEntityNotFound(_0x57b985,null))[_0xc468('0x1b')](function(_0xbebef8){if(_0xbebef8){var _0x3e6658=_0xbebef8['get']({'plain':!![]});fs[_0xc468('0x6b')](_0x394f8a);var _0x366cf0={'channel':_0xc468('0x6c'),'account':_0x3e6658[_0xc468('0x69')]['name'],'agent':_0x3e6658[_0xc468('0x6a')]?_0x3e6658['Owner'][_0xc468('0x5f')]:_0xc468('0x6d'),'createdAt':moment(_0x3e6658['createdAt'])[_0xc468('0x48')](_0xc468('0x49'))[_0xc468('0x56')](),'closedAt':_0x3e6658[_0xc468('0x6e')]?moment(_0x3e6658[_0xc468('0x6f')])[_0xc468('0x48')](_0xc468('0x49'))[_0xc468('0x56')]():'','disposition':_0x3e6658['disposition'],'visibility':_0x3e6658['threadId']?_0xc468('0x70'):'Private','messages':_(_0x3e6658[_0xc468('0x63')])[_0xc468('0x45')]({'secret':![]})['map'](function(_0x5e3629){if(_0x5e3629[_0xc468('0x62')]){var _0x497fdb=path[_0xc468('0x5a')](_0x32eaac,_0x5e3629['Attachment'][_0xc468('0x71')]);if(fs[_0xc468('0x72')](_0x497fdb)){fs['createReadStream'](_0x497fdb)[_0xc468('0x73')](fs[_0xc468('0x74')](path['join'](_0x394f8a,_0x5e3629[_0xc468('0x62')][_0xc468('0x71')])));}}return{'date':moment(_0x5e3629['createdAt'])[_0xc468('0x48')](_0xc468('0x49'))[_0xc468('0x56')](),'sender':_0x5e3629[_0xc468('0x65')]===_0xc468('0x75')?_0x5e3629['User']?_0x5e3629[_0xc468('0x5e')][_0xc468('0x5f')]:_0xc468('0x76'):_0x5e3629['Contact'][_0xc468('0x77')]+(_0x5e3629[_0xc468('0x78')]['lastName']?'\x20'+_0x5e3629[_0xc468('0x78')][_0xc468('0x61')]:''),'body':_0x5e3629[_0xc468('0x62')]?_0x5e3629[_0xc468('0x62')][_0xc468('0x71')]:_0x5e3629[_0xc468('0x3a')],'direction':_0x5e3629[_0xc468('0x65')]===_0xc468('0x75')?'A':'C','secret':_0x5e3629['secret'],'read':_0x5e3629[_0xc468('0x67')],'attachment':_0x5e3629[_0xc468('0x62')]};})[_0xc468('0x79')]()};return ejs[_0xc468('0x7a')](path[_0xc468('0x5a')](config[_0xc468('0x57')],_0xc468('0x58'),_0xc468('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x366cf0})[_0xc468('0x1b')](function(_0x159b44){var _0x571e48=path[_0xc468('0x5a')](_0x394f8a,_0xc468('0x7c')+_0x3e6658['id']+'-'+_0x2a1983+'.pdf');var _0x166ea3={'path':_0x571e48,'channel':'Openchannel','interactionId':_0x3e6658['id']};return pdf[_0xc468('0x7d')](_0x159b44,_0x166ea3);})['then'](function(){return new Promise(function(_0x3db3ac,_0x2dc3e8){zipdir(_0x394f8a,{'saveTo':_0x4e3fa0},function(_0x20c917,_0x20ec1b){if(_0x20c917)return _0x2dc3e8(_0x20c917);return _0x3db3ac(_0x20ec1b);});})[_0xc468('0x1b')](function(){return new Promise(function(_0x497269,_0x6c2847){rimraf(_0x394f8a,function(_0x5796b3){if(_0x5796b3)_0x6c2847(_0x5796b3);return _0x497269();});});})['then'](function(){return _0x57b985['download'](_0x4e3fa0,_0x75d6d2,function(_0xa9bde4){if(_0xa9bde4){logger[_0xc468('0x7e')]('Unable\x20to\x20delete\x20zip\x20file',_0xa9bde4);}else{fs[_0xc468('0x7f')](_0x4e3fa0);}});});});}else{return _0x57b985[_0xc468('0x11')](0xc8);}})[_0xc468('0x2b')](handleError(_0x57b985,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 27042a5..f9f3cc4 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 _0x04cf=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x04cf,0x139));var _0xf04c=function(_0x322d2e,_0x2b40bd){_0x322d2e=_0x322d2e-0x0;var _0x37b53f=_0x04cf[_0x322d2e];return _0x37b53f;};'use strict';var EventEmitter=require(_0xf04c('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xf04c('0x1'))['db'][_0xf04c('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf04c('0x3')](0x0);var events={'afterCreate':_0xf04c('0x4'),'afterUpdate':_0xf04c('0x5'),'afterDestroy':_0xf04c('0x6')};function emitEvent(_0x204e96){return function(_0x1a4f66,_0x4e37db,_0x6a64c7){_0x1a4f66[_0xf04c('0x7')]({'attributes':['id'],'raw':!![]})[_0xf04c('0x8')](function(_0x2ac9ef){_0x1a4f66[_0xf04c('0x9')](_0xf04c('0xa'),_0x2ac9ef[_0xf04c('0xb')](function(_0x47216c){return{'id':_0x47216c['id']};}));return OpenchannelMessage[_0xf04c('0xc')]({'where':{'OpenchannelInteractionId':_0x1a4f66['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf04c('0x8')](function(_0x1712e6){_0x1a4f66[_0xf04c('0x9')](_0xf04c('0xd'),_0x1712e6[_0xf04c('0xe')]);OpenchannelInteractionEvents['emit'](_0x204e96+':'+_0x1a4f66['id'],_0x1a4f66);OpenchannelInteractionEvents[_0xf04c('0xf')](_0x204e96,_0x1a4f66);_0x6a64c7(null);})[_0xf04c('0x10')](_0x6a64c7(null));};}for(var e in events){if(events[_0xf04c('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xf04c('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x822b=['findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue','Users'];(function(_0x5c422a,_0x2376e5){var _0x6c5b33=function(_0x3138c0){while(--_0x3138c0){_0x5c422a['push'](_0x5c422a['shift']());}};_0x6c5b33(++_0x2376e5);}(_0x822b,0xab));var _0xb822=function(_0x49fb1c,_0x113891){_0x49fb1c=_0x49fb1c-0x0;var _0x36cc02=_0x822b[_0x49fb1c];return _0x36cc02;};'use strict';var EventEmitter=require(_0xb822('0x0'));var OpenchannelInteraction=require(_0xb822('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xb822('0x1'))['db'][_0xb822('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb822('0x3')](0x0);var events={'afterCreate':_0xb822('0x4'),'afterUpdate':'update','afterDestroy':_0xb822('0x5')};function emitEvent(_0x5cc972){return function(_0x48ba3e,_0x1e79c8,_0x2e80cb){_0x48ba3e['getUsers']({'attributes':['id'],'raw':!![]})[_0xb822('0x6')](function(_0x1a463e){_0x48ba3e[_0xb822('0x7')](_0xb822('0x8'),_0x1a463e['map'](function(_0x33e9da){return{'id':_0x33e9da['id']};}));return OpenchannelMessage[_0xb822('0x9')]({'where':{'OpenchannelInteractionId':_0x48ba3e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb822('0x6')](function(_0x827966){_0x48ba3e[_0xb822('0x7')]('unreadMessages',_0x827966[_0xb822('0xa')]);OpenchannelInteractionEvents[_0xb822('0xb')](_0x5cc972+':'+_0x48ba3e['id'],_0x48ba3e);OpenchannelInteractionEvents[_0xb822('0xb')](_0x5cc972,_0x48ba3e);_0x2e80cb(null);})[_0xb822('0xc')](_0x2e80cb(null));};}for(var e in events){if(events[_0xb822('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb822('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index de24ff7..f100ffb 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 _0x6ab5=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x6ab5,0x7c));var _0x56ab=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6ab5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x56ab('0x0'));var util=require(_0x56ab('0x1'));var logger=require(_0x56ab('0x2'))(_0x56ab('0x3'));var moment=require(_0x56ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x56ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56ab('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x56ab('0x7')]=function(_0x47dac2,_0x266efe){return _0x47dac2[_0x56ab('0x8')](_0x56ab('0x9'),attributes,{'tableName':_0x56ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x56ab('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5cfc4e,_0x5c69dc,_0x5ed2d2){if(_0x5cfc4e[_0x56ab('0xc')](_0x56ab('0xd'))){_0x5cfc4e[_0x56ab('0xe')]=moment()[_0x56ab('0xf')](_0x56ab('0x10'));}_0x5ed2d2(null,_0x5cfc4e);}}});}; \ No newline at end of file +var _0x89e4=['exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0xb74e2c,_0x3c35fc){var _0x345b5b=function(_0x5131c9){while(--_0x5131c9){_0xb74e2c['push'](_0xb74e2c['shift']());}};_0x345b5b(++_0x3c35fc);}(_0x89e4,0x8e));var _0x489e=function(_0x4aecb5,_0x1440a4){_0x4aecb5=_0x4aecb5-0x0;var _0x36df86=_0x89e4[_0x4aecb5];return _0x36df86;};'use strict';var _=require(_0x489e('0x0'));var util=require(_0x489e('0x1'));var logger=require(_0x489e('0x2'))(_0x489e('0x3'));var moment=require(_0x489e('0x4'));var BPromise=require(_0x489e('0x5'));var rp=require(_0x489e('0x6'));var fs=require('fs');var path=require(_0x489e('0x7'));var rimraf=require(_0x489e('0x8'));var config=require(_0x489e('0x9'));var attributes=require(_0x489e('0xa'));module[_0x489e('0xb')]=function(_0xc9dcde,_0x263272){return _0xc9dcde['define'](_0x489e('0xc'),attributes,{'tableName':_0x489e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x489e('0xe'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x448863,_0x4f5f34,_0x12860e){if(_0x448863[_0x489e('0xf')](_0x489e('0x10'))){_0x448863['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x12860e(null,_0x448863);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d419eff..bac9088 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 _0x3987=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','attributes','limit','info','find','addTags','ids','omit','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d2129,_0x344242){var _0x2ef362=function(_0x396280){while(--_0x396280){_0x5d2129['push'](_0x5d2129['shift']());}};_0x2ef362(++_0x344242);}(_0x3987,0x14e));var _0x7398=function(_0x45c8f5,_0x18b017){_0x45c8f5=_0x45c8f5-0x0;var _0x248f5b=_0x3987[_0x45c8f5];return _0x248f5b;};'use strict';var _=require('lodash');var util=require(_0x7398('0x0'));var moment=require(_0x7398('0x1'));var BPromise=require(_0x7398('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7398('0x3'));var db=require(_0x7398('0x4'))['db'];var utils=require(_0x7398('0x5'));var logger=require(_0x7398('0x6'))(_0x7398('0x7'));var config=require(_0x7398('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7398('0x9')]['http']({'port':0x232a});config[_0x7398('0xa')]=_[_0x7398('0xb')](config['redis'],{'host':_0x7398('0xc'),'port':0x18eb});var socket=require(_0x7398('0xd'))(new Redis(config[_0x7398('0xa')]));require(_0x7398('0xe'))['register'](socket);function respondWithRpcPromise(_0x2427ac,_0x1bb530,_0x6ea992){return new BPromise(function(_0x1916b5,_0x1c1f36){return client[_0x7398('0xf')](_0x2427ac,_0x6ea992)[_0x7398('0x10')](function(_0x3c0d56){logger['info'](_0x7398('0x11'),_0x1bb530,_0x7398('0x12'));logger[_0x7398('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x1bb530,_0x7398('0x12'),JSON[_0x7398('0x14')](_0x3c0d56));if(_0x3c0d56[_0x7398('0x15')]){if(_0x3c0d56[_0x7398('0x15')][_0x7398('0x16')]===0x1f4){logger[_0x7398('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1bb530,_0x3c0d56[_0x7398('0x15')][_0x7398('0x17')]);return _0x1c1f36(_0x3c0d56[_0x7398('0x15')]['message']);}logger[_0x7398('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1bb530,_0x3c0d56[_0x7398('0x15')][_0x7398('0x17')]);return _0x1916b5(_0x3c0d56['error'][_0x7398('0x17')]);}else{logger['info'](_0x7398('0x11'),_0x1bb530,_0x7398('0x12'));_0x1916b5(_0x3c0d56['result']['message']);}})[_0x7398('0x18')](function(_0x5848b7){logger[_0x7398('0x15')](_0x7398('0x11'),_0x1bb530,_0x5848b7);_0x1c1f36(_0x5848b7);});});}exports[_0x7398('0x19')]=function(_0x515d64){var _0x1a1621=this;return new Promise(function(_0x15a938,_0x4ac72f){return db[_0x7398('0x1a')][_0x7398('0x1b')](_0x515d64[_0x7398('0x1c')],{'raw':_0x515d64[_0x7398('0x1d')]?_0x515d64[_0x7398('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x515d64[_0x7398('0x1d')]?_0x515d64[_0x7398('0x1d')]['where']||null:null,'attributes':_0x515d64[_0x7398('0x1d')]?_0x515d64[_0x7398('0x1d')][_0x7398('0x1e')]||null:null,'limit':_0x515d64[_0x7398('0x1d')]?_0x515d64[_0x7398('0x1d')][_0x7398('0x1f')]||null:null})[_0x7398('0x10')](function(_0x10fbdf){logger[_0x7398('0x20')](_0x7398('0x19'),_0x515d64);logger[_0x7398('0x13')]('UpdateOpenchannelInteraction',_0x515d64,JSON[_0x7398('0x14')](_0x10fbdf));_0x15a938(_0x10fbdf);})[_0x7398('0x18')](function(_0x26ca40){logger[_0x7398('0x15')](_0x7398('0x19'),_0x26ca40['message'],_0x515d64);_0x4ac72f(_0x1a1621[_0x7398('0x15')](0x1f4,_0x26ca40[_0x7398('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x142fc8){return new Promise(function(_0x5ec26a,_0x3b3096){return db[_0x7398('0x1a')][_0x7398('0x21')]({'where':_0x142fc8[_0x7398('0x1d')]?_0x142fc8[_0x7398('0x1d')]['where']||null:null})[_0x7398('0x10')](function(_0x4ada44){if(_0x4ada44){return _0x4ada44[_0x7398('0x22')](_0x142fc8[_0x7398('0x1c')][_0x7398('0x23')],_[_0x7398('0x24')](_0x142fc8[_0x7398('0x1c')],['ids','id'])||{});}})['spread'](function(_0x3eb4ff){logger[_0x7398('0x20')](_0x7398('0x25'),_0x142fc8);logger['debug'](_0x7398('0x25'),_0x142fc8,JSON[_0x7398('0x14')](_0x3eb4ff));_0x5ec26a(_0x3eb4ff);})['catch'](function(_0xe5ef4a){logger[_0x7398('0x15')]('AddTags',_0xe5ef4a[_0x7398('0x17')],_0x142fc8);_0x3b3096(_this[_0x7398('0x15')](0x1f4,_0xe5ef4a[_0x7398('0x17')]));});});}; \ No newline at end of file +var _0xa097=['AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','limit','catch','AddTagsToOpenchannelInteraction','omit','ids','spread'];(function(_0x3a17b0,_0x32a3b6){var _0xda8c4=function(_0x2e605a){while(--_0x2e605a){_0x3a17b0['push'](_0x3a17b0['shift']());}};_0xda8c4(++_0x32a3b6);}(_0xa097,0x1ef));var _0x7a09=function(_0x31bf4a,_0x51eb5f){_0x31bf4a=_0x31bf4a-0x0;var _0x2265ec=_0xa097[_0x31bf4a];return _0x2265ec;};'use strict';var _=require('lodash');var util=require(_0x7a09('0x0'));var moment=require(_0x7a09('0x1'));var BPromise=require(_0x7a09('0x2'));var rs=require(_0x7a09('0x3'));var fs=require('fs');var Redis=require(_0x7a09('0x4'));var db=require(_0x7a09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a09('0x6'))('rpc');var config=require(_0x7a09('0x7'));var jayson=require(_0x7a09('0x8'));var client=jayson[_0x7a09('0x9')]['http']({'port':0x232a});config[_0x7a09('0xa')]=_[_0x7a09('0xb')](config['redis'],{'host':_0x7a09('0xc'),'port':0x18eb});var socket=require(_0x7a09('0xd'))(new Redis(config[_0x7a09('0xa')]));require('./openchannelInteraction.socket')[_0x7a09('0xe')](socket);function respondWithRpcPromise(_0x5d6931,_0xde40bd,_0x29473f){return new BPromise(function(_0x45f58f,_0x4ea7d8){return client['request'](_0x5d6931,_0x29473f)[_0x7a09('0xf')](function(_0x111ba0){logger[_0x7a09('0x10')](_0x7a09('0x11'),_0xde40bd,_0x7a09('0x12'));logger[_0x7a09('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xde40bd,_0x7a09('0x12'),JSON[_0x7a09('0x14')](_0x111ba0));if(_0x111ba0[_0x7a09('0x15')]){if(_0x111ba0[_0x7a09('0x15')][_0x7a09('0x16')]===0x1f4){logger[_0x7a09('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xde40bd,_0x111ba0[_0x7a09('0x15')][_0x7a09('0x17')]);return _0x4ea7d8(_0x111ba0[_0x7a09('0x15')][_0x7a09('0x17')]);}logger[_0x7a09('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xde40bd,_0x111ba0[_0x7a09('0x15')][_0x7a09('0x17')]);return _0x45f58f(_0x111ba0[_0x7a09('0x15')][_0x7a09('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xde40bd,'request\x20sent');_0x45f58f(_0x111ba0[_0x7a09('0x18')]['message']);}})['catch'](function(_0x3b70f8){logger[_0x7a09('0x15')](_0x7a09('0x11'),_0xde40bd,_0x3b70f8);_0x4ea7d8(_0x3b70f8);});});}exports[_0x7a09('0x19')]=function(_0x1c3c73){var _0x1bc3f1=this;return new Promise(function(_0x31a21b,_0x37d5ae){return db[_0x7a09('0x1a')][_0x7a09('0x1b')](_0x1c3c73[_0x7a09('0x1c')],{'raw':_0x1c3c73['options']?_0x1c3c73['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c3c73[_0x7a09('0x1d')]?_0x1c3c73[_0x7a09('0x1d')][_0x7a09('0x1e')]||null:null,'attributes':_0x1c3c73['options']?_0x1c3c73['options']['attributes']||null:null,'limit':_0x1c3c73[_0x7a09('0x1d')]?_0x1c3c73[_0x7a09('0x1d')][_0x7a09('0x1f')]||null:null})[_0x7a09('0xf')](function(_0x4321fc){logger['info']('UpdateOpenchannelInteraction',_0x1c3c73);logger[_0x7a09('0x13')]('UpdateOpenchannelInteraction',_0x1c3c73,JSON[_0x7a09('0x14')](_0x4321fc));_0x31a21b(_0x4321fc);})[_0x7a09('0x20')](function(_0x34bb0b){logger[_0x7a09('0x15')](_0x7a09('0x19'),_0x34bb0b[_0x7a09('0x17')],_0x1c3c73);_0x37d5ae(_0x1bc3f1[_0x7a09('0x15')](0x1f4,_0x34bb0b[_0x7a09('0x17')]));});});};exports[_0x7a09('0x21')]=function(_0x2b5487){return new Promise(function(_0x231f9e,_0x5ca5b4){return db[_0x7a09('0x1a')]['find']({'where':_0x2b5487[_0x7a09('0x1d')]?_0x2b5487[_0x7a09('0x1d')][_0x7a09('0x1e')]||null:null})[_0x7a09('0xf')](function(_0x20bebb){if(_0x20bebb){return _0x20bebb['addTags'](_0x2b5487[_0x7a09('0x1c')]['ids'],_[_0x7a09('0x22')](_0x2b5487[_0x7a09('0x1c')],[_0x7a09('0x23'),'id'])||{});}})[_0x7a09('0x24')](function(_0x4eb550){logger[_0x7a09('0x10')](_0x7a09('0x25'),_0x2b5487);logger[_0x7a09('0x13')]('AddTags',_0x2b5487,JSON[_0x7a09('0x14')](_0x4eb550));_0x231f9e(_0x4eb550);})[_0x7a09('0x20')](function(_0x2323c5){logger[_0x7a09('0x15')](_0x7a09('0x25'),_0x2323c5[_0x7a09('0x17')],_0x2b5487);_0x5ca5b4(_this['error'](0x1f4,_0x2323c5[_0x7a09('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f554395..c4cee0a 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 _0x44dc=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x1739e3,_0x31f4bf){var _0x238d44=function(_0x4e67f8){while(--_0x4e67f8){_0x1739e3['push'](_0x1739e3['shift']());}};_0x238d44(++_0x31f4bf);}(_0x44dc,0xfe));var _0xc44d=function(_0x235996,_0x370c7f){_0x235996=_0x235996-0x0;var _0x200c7f=_0x44dc[_0x235996];return _0x200c7f;};'use strict';var OpenchannelInteractionEvents=require(_0xc44d('0x0'));var events=['save',_0xc44d('0x1'),_0xc44d('0x2')];function createListener(_0x7bbae4,_0x1f97d7){return function(_0x24b1d0){_0x1f97d7[_0xc44d('0x3')](_0x7bbae4,_0x24b1d0);};}function removeListener(_0x38358c,_0x4f45dc){return function(){OpenchannelInteractionEvents[_0xc44d('0x4')](_0x38358c,_0x4f45dc);};}exports[_0xc44d('0x5')]=function(_0x264305){for(var _0x3295e6=0x0,_0x49231=events[_0xc44d('0x6')];_0x3295e6<_0x49231;_0x3295e6++){var _0x49309a=events[_0x3295e6];var _0xca0a40=createListener(_0xc44d('0x7')+_0x49309a,_0x264305);OpenchannelInteractionEvents['on'](_0x49309a,_0xca0a40);}}; \ No newline at end of file +var _0xccd0=['save','remove','update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0xfd80d5,_0x303f80){var _0xeb957d=function(_0x1c5d12){while(--_0x1c5d12){_0xfd80d5['push'](_0xfd80d5['shift']());}};_0xeb957d(++_0x303f80);}(_0xccd0,0x1bf));var _0x0ccd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccd0[_0x21a9d9];return _0x46adce;};'use strict';var OpenchannelInteractionEvents=require(_0x0ccd('0x0'));var events=[_0x0ccd('0x1'),_0x0ccd('0x2'),_0x0ccd('0x3')];function createListener(_0x4018e3,_0x52edf9){return function(_0x341109){_0x52edf9[_0x0ccd('0x4')](_0x4018e3,_0x341109);};}function removeListener(_0x4b9ec8,_0x1c96d5){return function(){OpenchannelInteractionEvents['removeListener'](_0x4b9ec8,_0x1c96d5);};}exports[_0x0ccd('0x5')]=function(_0x273236){for(var _0x2313a1=0x0,_0x38ac15=events[_0x0ccd('0x6')];_0x2313a1<_0x38ac15;_0x2313a1++){var _0x533781=events[_0x2313a1];var _0x53d37b=createListener(_0x0ccd('0x7')+_0x533781,_0x273236);OpenchannelInteractionEvents['on'](_0x533781,_0x53d37b);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6951e9f..1dcacec 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x179791,_0xd1e02f){var _0x2be9f8=function(_0x252382){while(--_0x252382){_0x179791['push'](_0x179791['shift']());}};_0x2be9f8(++_0xd1e02f);}(_0xe706,0xa3));var _0x6e70=function(_0x34ae76,_0x4cd562){_0x34ae76=_0x34ae76-0x0;var _0x5325eb=_0xe706[_0x34ae76];return _0x5325eb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _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(_0x24d405,_0x59e179){var _0x3c8c57=function(_0x54dcd9){while(--_0x54dcd9){_0x24d405['push'](_0x24d405['shift']());}};_0x3c8c57(++_0x59e179);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 0ac815d..1d54ef6 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 _0x9e63=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x3a2287,_0x377b1a){var _0x1ff91d=function(_0x42d945){while(--_0x42d945){_0x3a2287['push'](_0x3a2287['shift']());}};_0x1ff91d(++_0x377b1a);}(_0x9e63,0x65));var _0x39e6=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x9e63[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x39e6('0x0'));module[_0x39e6('0x1')]={'body':{'type':Sequelize[_0x39e6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x39e6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x39e6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39e6('0x4')]('in',_0x39e6('0x5')),'defaultValue':_0x39e6('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x39e6('0x6')]},'providerName':{'type':Sequelize[_0x39e6('0x7')]},'providerResponse':{'type':Sequelize[_0x39e6('0x2')]}}; \ No newline at end of file +var _0x19e1=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19e1,0x163));var _0x119e=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x19e1[_0x205e5a];return _0x10da58;};'use strict';var Sequelize=require(_0x119e('0x0'));module[_0x119e('0x1')]={'body':{'type':Sequelize[_0x119e('0x2')](_0x119e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x119e('0x4')]('in',_0x119e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x119e('0x6')]},'providerName':{'type':Sequelize[_0x119e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 319994f..de02460 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 _0xe2bc=['UserId','user','agent','OpenchannelInteraction','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','get','OpenchannelInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','motionChannel','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','show','params','include','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format'];(function(_0x56c1e2,_0x1b8136){var _0x35b217=function(_0x1cc400){while(--_0x1cc400){_0x56c1e2['push'](_0x56c1e2['shift']());}};_0x35b217(++_0x1b8136);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xe2bc[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0xce2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce2b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce2b('0x2'));var moment=require(_0xce2b('0x3'));var BPromise=require(_0xce2b('0x4'));var Mustache=require(_0xce2b('0x5'));var util=require(_0xce2b('0x6'));var path=require('path');var sox=require(_0xce2b('0x7'));var csv=require(_0xce2b('0x8'));var ejs=require(_0xce2b('0x9'));var fs=require('fs');var fs_extra=require(_0xce2b('0xa'));var _=require(_0xce2b('0xb'));var squel=require('squel');var crypto=require(_0xce2b('0xc'));var jsforce=require(_0xce2b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce2b('0x8'));var querystring=require(_0xce2b('0xe'));var Papa=require(_0xce2b('0xf'));var Redis=require(_0xce2b('0x10'));var authService=require(_0xce2b('0x11'));var qs=require(_0xce2b('0x12'));var as=require(_0xce2b('0x13'));var hardwareService=require(_0xce2b('0x14'));var logger=require(_0xce2b('0x15'))(_0xce2b('0x16'));var utils=require('../../config/utils');var config=require(_0xce2b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce2b('0x18'))['db'];config[_0xce2b('0x19')]=_[_0xce2b('0x1a')](config[_0xce2b('0x19')],{'host':_0xce2b('0x1b'),'port':0x18eb});var socket=require(_0xce2b('0x1c'))(new Redis(config[_0xce2b('0x19')]));require(_0xce2b('0x1d'))['register'](socket);var jayson=require(_0xce2b('0x1e'));var client=jayson[_0xce2b('0x1f')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x339e5c,_0x42c23a,_0xa163d9,_0x48c489){return new BPromise(function(_0x5558c9,_0x216c48){var _0x405bda=_0x48c489||client;return _0x405bda[_0xce2b('0x20')](_0x339e5c,_0xa163d9)[_0xce2b('0x21')](function(_0x377aa3){logger[_0xce2b('0x22')](_0xce2b('0x23'),_0x42c23a,_0xce2b('0x24'));logger[_0xce2b('0x25')](_0xce2b('0x26'),_0x42c23a,'request\x20sent',JSON[_0xce2b('0x27')](_0x377aa3));if(_0x377aa3[_0xce2b('0x28')]){if(_0x377aa3[_0xce2b('0x28')][_0xce2b('0x29')]===0x1f4){logger[_0xce2b('0x28')](_0xce2b('0x23'),_0x42c23a,_0x377aa3[_0xce2b('0x28')][_0xce2b('0x2a')]);return _0x216c48(_0x377aa3[_0xce2b('0x28')][_0xce2b('0x2a')]);}logger['error'](_0xce2b('0x23'),_0x42c23a,_0x377aa3[_0xce2b('0x28')][_0xce2b('0x2a')]);return _0x5558c9(_0x377aa3[_0xce2b('0x28')][_0xce2b('0x2a')]);}else{logger[_0xce2b('0x22')](_0xce2b('0x23'),_0x42c23a,_0xce2b('0x24'));_0x5558c9(_0x377aa3[_0xce2b('0x2b')][_0xce2b('0x2a')]);}})[_0xce2b('0x2c')](function(_0x56047c){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x42c23a,_0x56047c);_0x216c48(_0x56047c);});});}function respondWithStatusCode(_0x94eb91,_0x4df596){_0x4df596=_0x4df596||0xcc;return function(_0x350637){if(_0x350637){return _0x94eb91[_0xce2b('0x2d')](_0x4df596);}return _0x94eb91['status'](_0x4df596)[_0xce2b('0x2e')]();};}function respondWithResult(_0x217b7e,_0x5e0ab0){_0x5e0ab0=_0x5e0ab0||0xc8;return function(_0x7bebe5){if(_0x7bebe5){return _0x217b7e[_0xce2b('0x2f')](_0x5e0ab0)[_0xce2b('0x30')](_0x7bebe5);}};}function respondWithFilteredResult(_0x50a62f,_0x502fb9){return function(_0x433a89){if(_0x433a89){var _0x113a04=typeof _0x502fb9[_0xce2b('0x31')]==='undefined'&&typeof _0x502fb9['limit']===_0xce2b('0x32');var _0x2b13e5=_0x433a89[_0xce2b('0x33')];var _0x4f9615=_0x113a04?0x0:_0x502fb9[_0xce2b('0x31')];var _0x1b6a82=_0x113a04?_0x433a89[_0xce2b('0x33')]:_0x502fb9[_0xce2b('0x31')]+_0x502fb9[_0xce2b('0x34')];var _0x476d1a;if(_0x1b6a82>=_0x2b13e5){_0x1b6a82=_0x2b13e5;_0x476d1a=0xc8;}else{_0x476d1a=0xce;}_0x50a62f[_0xce2b('0x2f')](_0x476d1a);return _0x50a62f['set'](_0xce2b('0x35'),_0x4f9615+'-'+_0x1b6a82+'/'+_0x2b13e5)['json'](_0x433a89);}return null;};}function patchUpdates(_0x21a813){return function(_0x912fa3){try{jsonpatch[_0xce2b('0x36')](_0x912fa3,_0x21a813,!![]);}catch(_0xe72a6d){return BPromise[_0xce2b('0x37')](_0xe72a6d);}return _0x912fa3['save']();};}function saveUpdates(_0x208a9b,_0x2a2542){return function(_0x46dc2b){if(_0x46dc2b){return _0x46dc2b[_0xce2b('0x38')](_0x208a9b)[_0xce2b('0x21')](function(_0x25b845){return _0x25b845;});}return null;};}function removeEntity(_0x29cba2,_0x1d96a2){return function(_0x24f30e){if(_0x24f30e){return _0x24f30e[_0xce2b('0x39')]()[_0xce2b('0x21')](function(){_0x29cba2[_0xce2b('0x2f')](0xcc)[_0xce2b('0x2e')]();});}};}function handleEntityNotFound(_0x116882,_0x427e7a){return function(_0x160571){if(!_0x160571){_0x116882['sendStatus'](0x194);}return _0x160571;};}function handleError(_0x16b215,_0x48405c){_0x48405c=_0x48405c||0x1f4;return function(_0x20ce6e){logger[_0xce2b('0x28')](_0x20ce6e[_0xce2b('0x3a')]);if(_0x20ce6e[_0xce2b('0x3b')]){delete _0x20ce6e[_0xce2b('0x3b')];}_0x16b215[_0xce2b('0x2f')](_0x48405c)['send'](_0x20ce6e);};}exports[_0xce2b('0x3c')]=function(_0xef673b,_0x1cc3d5){var _0x3408a2={},_0x2c130e={},_0x40d0f8={'count':0x0,'rows':[]};var _0x585de8=_[_0xce2b('0x3d')](db[_0xce2b('0x3e')][_0xce2b('0x3f')],function(_0x30cffb){return{'name':_0x30cffb[_0xce2b('0x40')],'type':_0x30cffb[_0xce2b('0x41')]['key']};});_0x2c130e['model']=_[_0xce2b('0x3d')](_0x585de8,_0xce2b('0x3b'));_0x2c130e[_0xce2b('0x42')]=_[_0xce2b('0x43')](_0xef673b[_0xce2b('0x42')]);_0x2c130e[_0xce2b('0x44')]=_[_0xce2b('0x45')](_0x2c130e[_0xce2b('0x46')],_0x2c130e[_0xce2b('0x42')]);_0x3408a2[_0xce2b('0x47')]=_[_0xce2b('0x45')](_0x2c130e[_0xce2b('0x46')],qs[_0xce2b('0x48')](_0xef673b[_0xce2b('0x42')][_0xce2b('0x48')]));_0x3408a2['attributes']=_0x3408a2[_0xce2b('0x47')][_0xce2b('0x49')]?_0x3408a2['attributes']:_0x2c130e[_0xce2b('0x46')];if(!_0xef673b['query'][_0xce2b('0x4a')](_0xce2b('0x4b'))){_0x3408a2[_0xce2b('0x34')]=qs['limit'](_0xef673b[_0xce2b('0x42')][_0xce2b('0x34')]);_0x3408a2['offset']=qs['offset'](_0xef673b[_0xce2b('0x42')][_0xce2b('0x31')]);}_0x3408a2[_0xce2b('0x4c')]=qs[_0xce2b('0x4d')](_0xef673b[_0xce2b('0x42')]['sort']);_0x3408a2[_0xce2b('0x4e')]=qs[_0xce2b('0x44')](_[_0xce2b('0x4f')](_0xef673b[_0xce2b('0x42')],_0x2c130e[_0xce2b('0x44')]),_0x585de8);if(_0xef673b['query'][_0xce2b('0x50')]){_0x3408a2[_0xce2b('0x4e')]=_[_0xce2b('0x51')](_0x3408a2[_0xce2b('0x4e')],{'$or':_[_0xce2b('0x3d')](_0x585de8,function(_0x30d668){if(_0x30d668[_0xce2b('0x41')]!=='VIRTUAL'){var _0x52909f={};_0x52909f[_0x30d668['name']]={'$like':'%'+_0xef673b[_0xce2b('0x42')][_0xce2b('0x50')]+'%'};return _0x52909f;}})});}_0x3408a2=_[_0xce2b('0x51')]({},_0x3408a2,_0xef673b['options']);var _0x4ea31b={'where':_0x3408a2['where']};return db[_0xce2b('0x3e')][_0xce2b('0x33')](_0x4ea31b)[_0xce2b('0x21')](function(_0x5eced1){_0x40d0f8[_0xce2b('0x33')]=_0x5eced1;if(_0xef673b[_0xce2b('0x42')][_0xce2b('0x52')]){_0x3408a2['include']=[{'all':!![]}];}return db[_0xce2b('0x3e')]['findAll'](_0x3408a2);})[_0xce2b('0x21')](function(_0x39bbfc){_0x40d0f8[_0xce2b('0x53')]=_0x39bbfc;return _0x40d0f8;})['then'](respondWithFilteredResult(_0x1cc3d5,_0x3408a2))[_0xce2b('0x2c')](handleError(_0x1cc3d5,null));};exports[_0xce2b('0x54')]=function(_0xb4257,_0x224861){var _0x592b65={'raw':!![],'where':{'id':_0xb4257[_0xce2b('0x55')]['id']}},_0x32b819={};_0x32b819[_0xce2b('0x46')]=_[_0xce2b('0x43')](db[_0xce2b('0x3e')]['rawAttributes']);_0x32b819[_0xce2b('0x42')]=_[_0xce2b('0x43')](_0xb4257[_0xce2b('0x42')]);_0x32b819[_0xce2b('0x44')]=_[_0xce2b('0x45')](_0x32b819['model'],_0x32b819[_0xce2b('0x42')]);_0x592b65['attributes']=_[_0xce2b('0x45')](_0x32b819[_0xce2b('0x46')],qs['fields'](_0xb4257['query'][_0xce2b('0x48')]));_0x592b65[_0xce2b('0x47')]=_0x592b65[_0xce2b('0x47')]['length']?_0x592b65[_0xce2b('0x47')]:_0x32b819[_0xce2b('0x46')];if(_0xb4257['query'][_0xce2b('0x52')]){_0x592b65[_0xce2b('0x56')]=[{'all':!![]}];}_0x592b65=_[_0xce2b('0x51')]({},_0x592b65,_0xb4257[_0xce2b('0x57')]);return db[_0xce2b('0x3e')][_0xce2b('0x58')](_0x592b65)['then'](handleEntityNotFound(_0x224861,null))[_0xce2b('0x21')](respondWithResult(_0x224861,null))['catch'](handleError(_0x224861,null));};exports[_0xce2b('0x59')]=function(_0x2d1302,_0x2ce9f5){return db[_0xce2b('0x3e')]['create'](_0x2d1302[_0xce2b('0x5a')],{})[_0xce2b('0x21')](respondWithResult(_0x2ce9f5,0xc9))[_0xce2b('0x2c')](handleError(_0x2ce9f5,null));};exports[_0xce2b('0x38')]=function(_0x5391e6,_0x961e87){if(_0x5391e6[_0xce2b('0x5a')]['id']){delete _0x5391e6[_0xce2b('0x5a')]['id'];}return db[_0xce2b('0x3e')][_0xce2b('0x58')]({'where':{'id':_0x5391e6[_0xce2b('0x55')]['id']}})[_0xce2b('0x21')](handleEntityNotFound(_0x961e87,null))['then'](saveUpdates(_0x5391e6[_0xce2b('0x5a')],null))['then'](respondWithResult(_0x961e87,null))[_0xce2b('0x2c')](handleError(_0x961e87,null));};exports[_0xce2b('0x39')]=function(_0x2ae9ae,_0x1546ff){return db[_0xce2b('0x3e')][_0xce2b('0x58')]({'where':{'id':_0x2ae9ae[_0xce2b('0x55')]['id']}})[_0xce2b('0x21')](handleEntityNotFound(_0x1546ff,null))['then'](removeEntity(_0x1546ff,null))[_0xce2b('0x2c')](handleError(_0x1546ff,null));};exports[_0xce2b('0x5b')]=function(_0x230e22,_0x3bffd3){return db[_0xce2b('0x3e')]['describe']()[_0xce2b('0x21')](respondWithResult(_0x3bffd3,null))[_0xce2b('0x2c')](handleError(_0x3bffd3,null));};var interaction_log=require('../../config/logger')(_0xce2b('0x5c'));exports[_0xce2b('0x5d')]=function(_0xd0ed7a,_0x275b98,_0x23f0f0){var _0x893f84={'agent':{},'channel':_0xce2b('0x5e')};if(_0xd0ed7a[_0xce2b('0x5a')]['id']){delete _0xd0ed7a[_0xce2b('0x5a')]['id'];}_0xd0ed7a[_0xce2b('0x5a')][_0xce2b('0x5f')]=!![];_0xd0ed7a[_0xce2b('0x5a')][_0xce2b('0x60')]=moment()[_0xce2b('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0xd0ed7a[_0xce2b('0x5a')][_0xce2b('0x62')]=_0xd0ed7a[_0xce2b('0x5a')]['UserId']||_0xd0ed7a[_0xce2b('0x63')]['id'];_0x893f84[_0xce2b('0x64')]['id']=_0xd0ed7a['body'][_0xce2b('0x62')];return db[_0xce2b('0x3e')]['find']({'where':{'id':_0xd0ed7a[_0xce2b('0x55')]['id'],'UserId':null}})[_0xce2b('0x21')](handleEntityNotFound(_0x275b98,null))[_0xce2b('0x21')](saveUpdates(_0xd0ed7a[_0xce2b('0x5a')],null))[_0xce2b('0x21')](function(_0xdc619d){if(_0xdc619d){_0x893f84[_0xce2b('0x2a')]=_0xdc619d['get']({'plain':!![]});return db[_0xce2b('0x65')][_0xce2b('0x58')]({'where':{'id':_0xdc619d['OpenchannelInteractionId']}});}return null;})[_0xce2b('0x21')](handleEntityNotFound(_0x275b98,null))[_0xce2b('0x21')](function(_0x448521){if(_0x448521){return _0x448521[_0xce2b('0x38')]({'UserId':_0xd0ed7a['body'][_0xce2b('0x62')],'read1stAt':_[_0xce2b('0x66')](_0x448521['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x13cfda){if(_0x13cfda){_0x893f84[_0xce2b('0x67')]=_0x13cfda['get']({'plain':!![]});interaction_log['info'](_0xce2b('0x68'),_0xd0ed7a[_0xce2b('0x63')]['id'],_0xd0ed7a[_0xce2b('0x63')]['name'],_0xd0ed7a[_0xce2b('0x63')][_0xce2b('0x69')],_0x893f84['interaction']['id'],_0xd0ed7a[_0xce2b('0x5a')]?JSON[_0xce2b('0x27')](_0xd0ed7a[_0xce2b('0x5a')]):_0xce2b('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xce2b('0x6b'),_0x893f84);}return null;})[_0xce2b('0x21')](function(_0x542580){var _0x14e188='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x542580['message'][_0xce2b('0x6c')];return db[_0xce2b('0x6d')][_0xce2b('0x42')](_0x14e188,{'type':db[_0xce2b('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0xce2b('0x21')](function(_0x359d48){return _0x359d48;});})[_0xce2b('0x21')](function(_0x28338c){if(_0x28338c){_0x893f84[_0xce2b('0x2a')][_0xce2b('0x6f')]=_0x28338c[0x0];if(!_0xd0ed7a['body'][_0xce2b('0x62')])return;return db[_0xce2b('0x70')][_0xce2b('0x58')]({'where':{'id':_0xd0ed7a[_0xce2b('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xce2b('0x3b'),'fullname',_0xce2b('0x71'),_0xce2b('0x72')],'raw':!![]});}return null;})[_0xce2b('0x21')](function(_0x559aba){if(!_0x559aba)return null;_0x893f84['message'][_0xce2b('0x64')]=_0x559aba;return _0x893f84;})[_0xce2b('0x21')](function(_0x39dc6c){if(_0x39dc6c){if(_0xd0ed7a[_0xce2b('0x5a')][_0xce2b('0x73')]){_0x893f84['message'][_0xce2b('0x74')]=util[_0xce2b('0x61')](_0xce2b('0x75'),_0xd0ed7a[_0xce2b('0x63')][_0xce2b('0x3b')]);_0x893f84[_0xce2b('0x2a')]['channel']=_0x893f84[_0xce2b('0x76')];_0x893f84['message']['motionChannel']=_0x893f84[_0xce2b('0x76')];_0x893f84[_0xce2b('0x2a')][_0xce2b('0x77')]='accept';return respondWithRpcPromise(_0xce2b('0x78'),'EventManager',{'event':_0xce2b('0x79'),'message':_0x893f84['message']},client9002)['then'](function(){return _0x893f84;});}return _0x893f84;}return null;})['then'](respondWithResult(_0x275b98,null))[_0xce2b('0x2c')](handleError(_0x275b98,null));};var interaction_log=require(_0xce2b('0x15'))('openchannel-interactions');exports['reject']=function(_0x513dc3,_0x4d8901,_0x35b9e3){var _0x12313d={'agent':{},'channel':_0xce2b('0x5e')};if(_0x513dc3['body']['id']){delete _0x513dc3[_0xce2b('0x5a')]['id'];}_0x513dc3['body'][_0xce2b('0x62')]=_0x513dc3[_0xce2b('0x5a')][_0xce2b('0x62')]||_0x513dc3['user']['id'];_0x12313d[_0xce2b('0x64')]['id']=_0x513dc3[_0xce2b('0x5a')][_0xce2b('0x62')];return db[_0xce2b('0x3e')][_0xce2b('0x58')]({'where':{'id':_0x513dc3[_0xce2b('0x55')]['id'],'UserId':null}})[_0xce2b('0x21')](handleEntityNotFound(_0x4d8901,null))[_0xce2b('0x21')](function(_0x416bf6){if(_0x416bf6){_0x12313d[_0xce2b('0x2a')]=_0x416bf6[_0xce2b('0x7a')]({'plain':!![]});return db[_0xce2b('0x65')][_0xce2b('0x58')]({'where':{'id':_0x416bf6[_0xce2b('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x4d8901,null))['then'](function(_0x959a0e){if(_0x959a0e){_0x12313d[_0xce2b('0x67')]=_0x959a0e['get']({'plain':!![]});interaction_log[_0xce2b('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x513dc3[_0xce2b('0x63')]['id'],_0x513dc3[_0xce2b('0x63')]['name'],_0x513dc3[_0xce2b('0x63')]['role'],_0x12313d[_0xce2b('0x67')]['id'],_0x513dc3[_0xce2b('0x5a')]?JSON[_0xce2b('0x27')](_0x513dc3['body']):_0xce2b('0x6a'));return respondWithRpcPromise(_0xce2b('0x7c'),_0xce2b('0x7d'),_0x12313d);}return null;})['then'](function(_0xbc41b8){var _0x291590=_0xce2b('0x7e')+_0xbc41b8[_0xce2b('0x2a')][_0xce2b('0x6c')];return db[_0xce2b('0x6d')][_0xce2b('0x42')](_0x291590,{'type':db[_0xce2b('0x6e')]['QueryTypes'][_0xce2b('0x7f')],'raw':!![]})[_0xce2b('0x21')](function(_0x14f794){return _0x14f794;});})[_0xce2b('0x21')](function(_0x472a35){if(_0x472a35){_0x12313d[_0xce2b('0x2a')]['contact']=_0x472a35[0x0];if(!_0x513dc3[_0xce2b('0x5a')][_0xce2b('0x62')])return;return db[_0xce2b('0x70')]['find']({'where':{'id':_0x513dc3[_0xce2b('0x5a')][_0xce2b('0x62')],'role':'agent'},'attributes':['id',_0xce2b('0x3b'),'fullname',_0xce2b('0x71'),_0xce2b('0x72')],'raw':!![]});}return null;})[_0xce2b('0x21')](function(_0x3fc6d3){if(!_0x3fc6d3)return null;_0x12313d[_0xce2b('0x2a')][_0xce2b('0x64')]=_0x3fc6d3;return _0x12313d;})[_0xce2b('0x21')](function(_0x356d55){if(_0x356d55){_0x356d55[_0xce2b('0x2a')][_0xce2b('0x74')]=util['format'](_0xce2b('0x75'),_0x513dc3[_0xce2b('0x63')][_0xce2b('0x3b')]);_0x356d55[_0xce2b('0x2a')]['channel']=_0x12313d[_0xce2b('0x76')];_0x356d55[_0xce2b('0x2a')][_0xce2b('0x80')]=_0x12313d['channel'];_0x356d55[_0xce2b('0x2a')][_0xce2b('0x77')]='reject';respondWithRpcPromise(_0xce2b('0x78'),_0xce2b('0x78'),{'event':_0xce2b('0x81'),'message':_0x356d55['message']},client9002);return _0x12313d;}return null;})[_0xce2b('0x21')](respondWithResult(_0x4d8901,null))['catch'](handleError(_0x4d8901,null));}; \ No newline at end of file +var _0x1365=['User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','openchannel-interactions','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','client','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','OpenchannelMessage,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','save','update','destroy','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','show','params','includeAll','create','body','find','describe','../../config/logger','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact'];(function(_0x103538,_0x16d9df){var _0x13bd35=function(_0x2cac77){while(--_0x2cac77){_0x103538['push'](_0x103538['shift']());}};_0x13bd35(++_0x16d9df);}(_0x1365,0x1a4));var _0x5136=function(_0x484fc9,_0x4598aa){_0x484fc9=_0x484fc9-0x0;var _0x89aa01=_0x1365[_0x484fc9];return _0x89aa01;};'use strict';var emlformat=require(_0x5136('0x0'));var rimraf=require(_0x5136('0x1'));var zipdir=require(_0x5136('0x2'));var jsonpatch=require(_0x5136('0x3'));var rp=require(_0x5136('0x4'));var moment=require(_0x5136('0x5'));var BPromise=require(_0x5136('0x6'));var Mustache=require(_0x5136('0x7'));var util=require(_0x5136('0x8'));var path=require(_0x5136('0x9'));var sox=require('sox');var csv=require(_0x5136('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5136('0xb'));var squel=require('squel');var crypto=require(_0x5136('0xc'));var jsforce=require(_0x5136('0xd'));var deskjs=require(_0x5136('0xe'));var toCsv=require(_0x5136('0xa'));var querystring=require(_0x5136('0xf'));var Papa=require(_0x5136('0x10'));var Redis=require('ioredis');var authService=require(_0x5136('0x11'));var qs=require(_0x5136('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5136('0x13'));var logger=require('../../config/logger')(_0x5136('0x14'));var utils=require(_0x5136('0x15'));var config=require(_0x5136('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5136('0x17'))['db'];config[_0x5136('0x18')]=_[_0x5136('0x19')](config[_0x5136('0x18')],{'host':_0x5136('0x1a'),'port':0x18eb});var socket=require(_0x5136('0x1b'))(new Redis(config[_0x5136('0x18')]));require(_0x5136('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x5136('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49e37e,_0x577772,_0x3ccfa7,_0x293662){return new BPromise(function(_0x1c0873,_0x33bb70){var _0x1f0e19=_0x293662||client;return _0x1f0e19[_0x5136('0x1e')](_0x49e37e,_0x3ccfa7)[_0x5136('0x1f')](function(_0x529be0){logger[_0x5136('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x577772,_0x5136('0x21'));logger[_0x5136('0x22')](_0x5136('0x23'),_0x577772,_0x5136('0x21'),JSON['stringify'](_0x529be0));if(_0x529be0['error']){if(_0x529be0['error'][_0x5136('0x24')]===0x1f4){logger['error'](_0x5136('0x25'),_0x577772,_0x529be0['error']['message']);return _0x33bb70(_0x529be0[_0x5136('0x26')][_0x5136('0x27')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x577772,_0x529be0[_0x5136('0x26')][_0x5136('0x27')]);return _0x1c0873(_0x529be0['error'][_0x5136('0x27')]);}else{logger[_0x5136('0x20')](_0x5136('0x25'),_0x577772,_0x5136('0x21'));_0x1c0873(_0x529be0[_0x5136('0x28')][_0x5136('0x27')]);}})[_0x5136('0x29')](function(_0x5d0e9e){logger[_0x5136('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x577772,_0x5d0e9e);_0x33bb70(_0x5d0e9e);});});}function respondWithStatusCode(_0x1b8300,_0x5187a0){_0x5187a0=_0x5187a0||0xcc;return function(_0x10d5bf){if(_0x10d5bf){return _0x1b8300[_0x5136('0x2a')](_0x5187a0);}return _0x1b8300[_0x5136('0x2b')](_0x5187a0)[_0x5136('0x2c')]();};}function respondWithResult(_0x5109d8,_0x5411db){_0x5411db=_0x5411db||0xc8;return function(_0x1791e4){if(_0x1791e4){return _0x5109d8[_0x5136('0x2b')](_0x5411db)[_0x5136('0x2d')](_0x1791e4);}};}function respondWithFilteredResult(_0x221693,_0x15a8de){return function(_0x3e59ca){if(_0x3e59ca){var _0x3a4f94=typeof _0x15a8de[_0x5136('0x2e')]===_0x5136('0x2f')&&typeof _0x15a8de[_0x5136('0x30')]===_0x5136('0x2f');var _0x4b5ab4=_0x3e59ca['count'];var _0x3119fb=_0x3a4f94?0x0:_0x15a8de['offset'];var _0x51cc15=_0x3a4f94?_0x3e59ca['count']:_0x15a8de[_0x5136('0x2e')]+_0x15a8de[_0x5136('0x30')];var _0xd6af07;if(_0x51cc15>=_0x4b5ab4){_0x51cc15=_0x4b5ab4;_0xd6af07=0xc8;}else{_0xd6af07=0xce;}_0x221693[_0x5136('0x2b')](_0xd6af07);return _0x221693[_0x5136('0x31')]('Content-Range',_0x3119fb+'-'+_0x51cc15+'/'+_0x4b5ab4)['json'](_0x3e59ca);}return null;};}function patchUpdates(_0x539b0c){return function(_0x4763f7){try{jsonpatch['apply'](_0x4763f7,_0x539b0c,!![]);}catch(_0x538970){return BPromise['reject'](_0x538970);}return _0x4763f7[_0x5136('0x32')]();};}function saveUpdates(_0x5a5a22,_0x5d1422){return function(_0x1161cb){if(_0x1161cb){return _0x1161cb[_0x5136('0x33')](_0x5a5a22)[_0x5136('0x1f')](function(_0x5c4a75){return _0x5c4a75;});}return null;};}function removeEntity(_0x17b802,_0x36872d){return function(_0x3dd864){if(_0x3dd864){return _0x3dd864[_0x5136('0x34')]()['then'](function(){_0x17b802[_0x5136('0x2b')](0xcc)[_0x5136('0x2c')]();});}};}function handleEntityNotFound(_0x183a1a,_0x14019b){return function(_0x5e889e){if(!_0x5e889e){_0x183a1a[_0x5136('0x2a')](0x194);}return _0x5e889e;};}function handleError(_0x11c135,_0x1a1878){_0x1a1878=_0x1a1878||0x1f4;return function(_0x8c921e){logger[_0x5136('0x26')](_0x8c921e[_0x5136('0x35')]);if(_0x8c921e[_0x5136('0x36')]){delete _0x8c921e['name'];}_0x11c135[_0x5136('0x2b')](_0x1a1878)['send'](_0x8c921e);};}exports[_0x5136('0x37')]=function(_0x2af2c6,_0x35ad63){var _0x5046ce={},_0x29868d={},_0x286292={'count':0x0,'rows':[]};var _0x3c5ca8=_['map'](db[_0x5136('0x38')][_0x5136('0x39')],function(_0x21656b){return{'name':_0x21656b[_0x5136('0x3a')],'type':_0x21656b[_0x5136('0x3b')][_0x5136('0x3c')]};});_0x29868d[_0x5136('0x3d')]=_[_0x5136('0x3e')](_0x3c5ca8,_0x5136('0x36'));_0x29868d[_0x5136('0x3f')]=_[_0x5136('0x40')](_0x2af2c6['query']);_0x29868d[_0x5136('0x41')]=_[_0x5136('0x42')](_0x29868d['model'],_0x29868d[_0x5136('0x3f')]);_0x5046ce[_0x5136('0x43')]=_['intersection'](_0x29868d[_0x5136('0x3d')],qs[_0x5136('0x44')](_0x2af2c6[_0x5136('0x3f')][_0x5136('0x44')]));_0x5046ce[_0x5136('0x43')]=_0x5046ce[_0x5136('0x43')][_0x5136('0x45')]?_0x5046ce[_0x5136('0x43')]:_0x29868d[_0x5136('0x3d')];if(!_0x2af2c6[_0x5136('0x3f')][_0x5136('0x46')](_0x5136('0x47'))){_0x5046ce[_0x5136('0x30')]=qs['limit'](_0x2af2c6['query']['limit']);_0x5046ce[_0x5136('0x2e')]=qs['offset'](_0x2af2c6[_0x5136('0x3f')]['offset']);}_0x5046ce[_0x5136('0x48')]=qs['sort'](_0x2af2c6[_0x5136('0x3f')][_0x5136('0x49')]);_0x5046ce[_0x5136('0x4a')]=qs[_0x5136('0x41')](_[_0x5136('0x4b')](_0x2af2c6[_0x5136('0x3f')],_0x29868d['filters']),_0x3c5ca8);if(_0x2af2c6[_0x5136('0x3f')][_0x5136('0x4c')]){_0x5046ce[_0x5136('0x4a')]=_['merge'](_0x5046ce[_0x5136('0x4a')],{'$or':_[_0x5136('0x3e')](_0x3c5ca8,function(_0x27ad1c){if(_0x27ad1c['type']!=='VIRTUAL'){var _0x56fc25={};_0x56fc25[_0x27ad1c[_0x5136('0x36')]]={'$like':'%'+_0x2af2c6[_0x5136('0x3f')][_0x5136('0x4c')]+'%'};return _0x56fc25;}})});}_0x5046ce=_[_0x5136('0x4d')]({},_0x5046ce,_0x2af2c6[_0x5136('0x4e')]);var _0x21f58d={'where':_0x5046ce[_0x5136('0x4a')]};return db[_0x5136('0x38')]['count'](_0x21f58d)[_0x5136('0x1f')](function(_0x3375ba){_0x286292[_0x5136('0x4f')]=_0x3375ba;if(_0x2af2c6['query']['includeAll']){_0x5046ce[_0x5136('0x50')]=[{'all':!![]}];}return db[_0x5136('0x38')][_0x5136('0x51')](_0x5046ce);})['then'](function(_0x1e60f7){_0x286292[_0x5136('0x52')]=_0x1e60f7;return _0x286292;})['then'](respondWithFilteredResult(_0x35ad63,_0x5046ce))[_0x5136('0x29')](handleError(_0x35ad63,null));};exports[_0x5136('0x53')]=function(_0x2eb9f8,_0x51d535){var _0xc836fc={'raw':!![],'where':{'id':_0x2eb9f8[_0x5136('0x54')]['id']}},_0x20e16f={};_0x20e16f['model']=_[_0x5136('0x40')](db[_0x5136('0x38')]['rawAttributes']);_0x20e16f['query']=_[_0x5136('0x40')](_0x2eb9f8[_0x5136('0x3f')]);_0x20e16f['filters']=_[_0x5136('0x42')](_0x20e16f['model'],_0x20e16f[_0x5136('0x3f')]);_0xc836fc[_0x5136('0x43')]=_[_0x5136('0x42')](_0x20e16f['model'],qs['fields'](_0x2eb9f8[_0x5136('0x3f')]['fields']));_0xc836fc[_0x5136('0x43')]=_0xc836fc[_0x5136('0x43')][_0x5136('0x45')]?_0xc836fc[_0x5136('0x43')]:_0x20e16f[_0x5136('0x3d')];if(_0x2eb9f8['query'][_0x5136('0x55')]){_0xc836fc[_0x5136('0x50')]=[{'all':!![]}];}_0xc836fc=_[_0x5136('0x4d')]({},_0xc836fc,_0x2eb9f8[_0x5136('0x4e')]);return db[_0x5136('0x38')]['find'](_0xc836fc)[_0x5136('0x1f')](handleEntityNotFound(_0x51d535,null))[_0x5136('0x1f')](respondWithResult(_0x51d535,null))['catch'](handleError(_0x51d535,null));};exports['create']=function(_0x5b180b,_0x1751a0){return db[_0x5136('0x38')][_0x5136('0x56')](_0x5b180b[_0x5136('0x57')],{})[_0x5136('0x1f')](respondWithResult(_0x1751a0,0xc9))['catch'](handleError(_0x1751a0,null));};exports[_0x5136('0x33')]=function(_0x47b8e0,_0x3a811b){if(_0x47b8e0[_0x5136('0x57')]['id']){delete _0x47b8e0['body']['id'];}return db[_0x5136('0x38')][_0x5136('0x58')]({'where':{'id':_0x47b8e0[_0x5136('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a811b,null))['then'](saveUpdates(_0x47b8e0[_0x5136('0x57')],null))[_0x5136('0x1f')](respondWithResult(_0x3a811b,null))[_0x5136('0x29')](handleError(_0x3a811b,null));};exports[_0x5136('0x34')]=function(_0x455678,_0x265955){return db[_0x5136('0x38')][_0x5136('0x58')]({'where':{'id':_0x455678[_0x5136('0x54')]['id']}})[_0x5136('0x1f')](handleEntityNotFound(_0x265955,null))[_0x5136('0x1f')](removeEntity(_0x265955,null))[_0x5136('0x29')](handleError(_0x265955,null));};exports[_0x5136('0x59')]=function(_0x5175cf,_0x197a30){return db[_0x5136('0x38')][_0x5136('0x59')]()['then'](respondWithResult(_0x197a30,null))[_0x5136('0x29')](handleError(_0x197a30,null));};var interaction_log=require(_0x5136('0x5a'))('openchannel-interactions');exports[_0x5136('0x5b')]=function(_0x4021c0,_0x17ec50,_0x1a4f44){var _0x5d16bc={'agent':{},'channel':_0x5136('0x5c')};if(_0x4021c0[_0x5136('0x57')]['id']){delete _0x4021c0[_0x5136('0x57')]['id'];}_0x4021c0[_0x5136('0x57')]['read']=!![];_0x4021c0[_0x5136('0x57')][_0x5136('0x5d')]=moment()['format'](_0x5136('0x5e'));_0x4021c0['body'][_0x5136('0x5f')]=_0x4021c0[_0x5136('0x57')][_0x5136('0x5f')]||_0x4021c0[_0x5136('0x60')]['id'];_0x5d16bc[_0x5136('0x61')]['id']=_0x4021c0[_0x5136('0x57')][_0x5136('0x5f')];return db[_0x5136('0x38')][_0x5136('0x58')]({'where':{'id':_0x4021c0[_0x5136('0x54')]['id'],'UserId':null}})[_0x5136('0x1f')](handleEntityNotFound(_0x17ec50,null))[_0x5136('0x1f')](saveUpdates(_0x4021c0[_0x5136('0x57')],null))[_0x5136('0x1f')](function(_0x9f63c3){if(_0x9f63c3){_0x5d16bc[_0x5136('0x27')]=_0x9f63c3[_0x5136('0x62')]({'plain':!![]});return db[_0x5136('0x63')]['find']({'where':{'id':_0x9f63c3[_0x5136('0x64')]}});}return null;})[_0x5136('0x1f')](handleEntityNotFound(_0x17ec50,null))[_0x5136('0x1f')](function(_0x351fb5){if(_0x351fb5){return _0x351fb5[_0x5136('0x33')]({'UserId':_0x4021c0[_0x5136('0x57')]['UserId'],'read1stAt':_[_0x5136('0x65')](_0x351fb5[_0x5136('0x66')])?moment()[_0x5136('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5136('0x1f')](function(_0x57843a){if(_0x57843a){_0x5d16bc[_0x5136('0x68')]=_0x57843a[_0x5136('0x62')]({'plain':!![]});interaction_log[_0x5136('0x20')](_0x5136('0x69'),_0x4021c0[_0x5136('0x60')]['id'],_0x4021c0[_0x5136('0x60')][_0x5136('0x36')],_0x4021c0[_0x5136('0x60')]['role'],_0x5d16bc[_0x5136('0x68')]['id'],_0x4021c0[_0x5136('0x57')]?JSON[_0x5136('0x6a')](_0x4021c0[_0x5136('0x57')]):_0x5136('0x6b'));return respondWithRpcPromise(_0x5136('0x6c'),_0x5136('0x6d'),_0x5d16bc);}return null;})[_0x5136('0x1f')](function(_0x339a33){var _0x93cdb=_0x5136('0x6e')+_0x339a33['message'][_0x5136('0x6f')];return db['sequelize'][_0x5136('0x3f')](_0x93cdb,{'type':db[_0x5136('0x70')][_0x5136('0x71')][_0x5136('0x72')],'raw':!![]})[_0x5136('0x1f')](function(_0x3e5127){return _0x3e5127;});})['then'](function(_0x1f74ed){if(_0x1f74ed){_0x5d16bc['message'][_0x5136('0x73')]=_0x1f74ed[0x0];if(!_0x4021c0['body'][_0x5136('0x5f')])return;return db[_0x5136('0x74')][_0x5136('0x58')]({'where':{'id':_0x4021c0[_0x5136('0x57')][_0x5136('0x5f')],'role':_0x5136('0x61')},'attributes':['id',_0x5136('0x36'),_0x5136('0x75'),_0x5136('0x76'),_0x5136('0x77')],'raw':!![]});}return null;})[_0x5136('0x1f')](function(_0x5295a8){if(!_0x5295a8)return null;_0x5d16bc[_0x5136('0x27')][_0x5136('0x61')]=_0x5295a8;return _0x5d16bc;})['then'](function(_0x55bf52){if(_0x55bf52){if(_0x4021c0[_0x5136('0x57')][_0x5136('0x78')]){_0x5d16bc[_0x5136('0x27')][_0x5136('0x79')]=util['format']('SIP/%s',_0x4021c0[_0x5136('0x60')][_0x5136('0x36')]);_0x5d16bc[_0x5136('0x27')][_0x5136('0x7a')]=_0x5d16bc['channel'];_0x5d16bc[_0x5136('0x27')][_0x5136('0x7b')]=_0x5d16bc[_0x5136('0x7a')];_0x5d16bc[_0x5136('0x27')]['event']=_0x5136('0x5b');return respondWithRpcPromise(_0x5136('0x7c'),_0x5136('0x7c'),{'event':'acceptmessage','message':_0x5d16bc['message']},client9002)[_0x5136('0x1f')](function(){return _0x5d16bc;});}return _0x5d16bc;}return null;})[_0x5136('0x1f')](respondWithResult(_0x17ec50,null))[_0x5136('0x29')](handleError(_0x17ec50,null));};var interaction_log=require(_0x5136('0x5a'))(_0x5136('0x7d'));exports[_0x5136('0x7e')]=function(_0x41384c,_0xba7be8,_0x4963e0){var _0x179157={'agent':{},'channel':_0x5136('0x5c')};if(_0x41384c['body']['id']){delete _0x41384c['body']['id'];}_0x41384c[_0x5136('0x57')][_0x5136('0x5f')]=_0x41384c[_0x5136('0x57')]['UserId']||_0x41384c[_0x5136('0x60')]['id'];_0x179157[_0x5136('0x61')]['id']=_0x41384c[_0x5136('0x57')][_0x5136('0x5f')];return db[_0x5136('0x38')]['find']({'where':{'id':_0x41384c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xba7be8,null))[_0x5136('0x1f')](function(_0x210c53){if(_0x210c53){_0x179157['message']=_0x210c53[_0x5136('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x5136('0x58')]({'where':{'id':_0x210c53[_0x5136('0x64')]}});}return null;})['then'](handleEntityNotFound(_0xba7be8,null))['then'](function(_0x4f6338){if(_0x4f6338){_0x179157[_0x5136('0x68')]=_0x4f6338[_0x5136('0x62')]({'plain':!![]});interaction_log[_0x5136('0x20')](_0x5136('0x7f'),_0x41384c[_0x5136('0x60')]['id'],_0x41384c[_0x5136('0x60')][_0x5136('0x36')],_0x41384c[_0x5136('0x60')][_0x5136('0x80')],_0x179157[_0x5136('0x68')]['id'],_0x41384c[_0x5136('0x57')]?JSON['stringify'](_0x41384c[_0x5136('0x57')]):'null');return respondWithRpcPromise(_0x5136('0x81'),_0x5136('0x82'),_0x179157);}return null;})[_0x5136('0x1f')](function(_0x846d39){var _0x2f3545=_0x5136('0x6e')+_0x846d39['message'][_0x5136('0x6f')];return db[_0x5136('0x83')]['query'](_0x2f3545,{'type':db[_0x5136('0x70')][_0x5136('0x71')][_0x5136('0x72')],'raw':!![]})[_0x5136('0x1f')](function(_0x5328c9){return _0x5328c9;});})['then'](function(_0x70f9c7){if(_0x70f9c7){_0x179157['message'][_0x5136('0x73')]=_0x70f9c7[0x0];if(!_0x41384c[_0x5136('0x57')][_0x5136('0x5f')])return;return db['User']['find']({'where':{'id':_0x41384c[_0x5136('0x57')][_0x5136('0x5f')],'role':_0x5136('0x61')},'attributes':['id',_0x5136('0x36'),'fullname','email',_0x5136('0x77')],'raw':!![]});}return null;})[_0x5136('0x1f')](function(_0x34f050){if(!_0x34f050)return null;_0x179157[_0x5136('0x27')][_0x5136('0x61')]=_0x34f050;return _0x179157;})['then'](function(_0x3b850f){if(_0x3b850f){_0x3b850f[_0x5136('0x27')][_0x5136('0x79')]=util[_0x5136('0x67')]('SIP/%s',_0x41384c[_0x5136('0x60')][_0x5136('0x36')]);_0x3b850f[_0x5136('0x27')][_0x5136('0x7a')]=_0x179157[_0x5136('0x7a')];_0x3b850f[_0x5136('0x27')][_0x5136('0x7b')]=_0x179157[_0x5136('0x7a')];_0x3b850f[_0x5136('0x27')][_0x5136('0x84')]=_0x5136('0x7e');respondWithRpcPromise(_0x5136('0x7c'),_0x5136('0x7c'),{'event':_0x5136('0x85'),'message':_0x3b850f[_0x5136('0x27')]},client9002);return _0x179157;}return null;})[_0x5136('0x1f')](respondWithResult(_0xba7be8,null))[_0x5136('0x29')](handleError(_0xba7be8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cf89afe..439b970 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 _0x6aa5=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x5ecd78,_0x1da033){var _0x144f9=function(_0x3d0171){while(--_0x3d0171){_0x5ecd78['push'](_0x5ecd78['shift']());}};_0x144f9(++_0x1da033);}(_0x6aa5,0x10d));var _0x56aa=function(_0x45dd73,_0x468f87){_0x45dd73=_0x45dd73-0x0;var _0x4ee0ed=_0x6aa5[_0x45dd73];return _0x4ee0ed;};'use strict';var EventEmitter=require(_0x56aa('0x0'));var OpenchannelMessage=require(_0x56aa('0x1'))['db'][_0x56aa('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x56aa('0x3')](0x0);var events={'afterCreate':_0x56aa('0x4'),'afterUpdate':_0x56aa('0x5'),'afterDestroy':_0x56aa('0x6')};function emitEvent(_0x2b85fb){return function(_0xd75452,_0x20c771,_0x392d12){OpenchannelMessageEvents[_0x56aa('0x7')](_0x2b85fb+':'+_0xd75452['id'],_0xd75452);OpenchannelMessageEvents[_0x56aa('0x7')](_0x2b85fb,_0xd75452);_0x392d12(null);};}for(var e in events){if(events[_0x56aa('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x56aa('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfbe0=['exports','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x3a23d2,_0x8fa0b8){var _0x53cc22=function(_0x16f6e7){while(--_0x16f6e7){_0x3a23d2['push'](_0x3a23d2['shift']());}};_0x53cc22(++_0x8fa0b8);}(_0xfbe0,0x79));var _0x0fbe=function(_0x4581da,_0x25443e){_0x4581da=_0x4581da-0x0;var _0x4fd8f3=_0xfbe0[_0x4581da];return _0x4fd8f3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x0fbe('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0fbe('0x1'),'afterUpdate':'update','afterDestroy':_0x0fbe('0x2')};function emitEvent(_0x3fcceb){return function(_0xee0e8d,_0xa5f77e,_0x1a91de){OpenchannelMessageEvents[_0x0fbe('0x3')](_0x3fcceb+':'+_0xee0e8d['id'],_0xee0e8d);OpenchannelMessageEvents[_0x0fbe('0x3')](_0x3fcceb,_0xee0e8d);_0x1a91de(null);};}for(var e in events){if(events[_0x0fbe('0x4')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0fbe('0x5')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 79c80d7..76aacf9 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 _0xe5b2=['OpenchannelMessage,\x20%s,\x20%s','format','omit','Contact','method','GET','POST','threadId','Interaction','afterCreate','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','secret','describe','find','OpenchannelAccountId','Interactions','keys','replyUri','info'];(function(_0x11b4f6,_0x5abc0b){var _0x18b51d=function(_0x2af6de){while(--_0x2af6de){_0x11b4f6['push'](_0x11b4f6['shift']());}};_0x18b51d(++_0x5abc0b);}(_0xe5b2,0x17c));var _0x2e5b=function(_0x23288c,_0x7bcfcd){_0x23288c=_0x23288c-0x0;var _0x1305a6=_0xe5b2[_0x23288c];return _0x1305a6;};'use strict';var _=require(_0x2e5b('0x0'));var util=require(_0x2e5b('0x1'));var logger=require(_0x2e5b('0x2'))(_0x2e5b('0x3'));var moment=require(_0x2e5b('0x4'));var BPromise=require(_0x2e5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e5b('0x6'));var rimraf=require(_0x2e5b('0x7'));var config=require(_0x2e5b('0x8'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x3008a9,_0x53c104){return _0x3008a9['define'](_0x2e5b('0x9'),attributes,{'tableName':_0x2e5b('0xa'),'paranoid':![],'indexes':[{'name':_0x2e5b('0xb'),'fields':[_0x2e5b('0xc')],'type':_0x2e5b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47e0d8,_0x301d73,_0x85dd22){var _0x5995d2=_0x3008a9[_0x2e5b('0xe')];var _0x295ddf=_0x47e0d8['get']({'plain':!![]});if(_0x295ddf[_0x2e5b('0xf')][_0x2e5b('0x10')]()==='in'||_0x295ddf[_0x2e5b('0xf')][_0x2e5b('0x10')]()===_0x2e5b('0x11')&&!_0x295ddf['secret']&&!_['isNil'](_0x295ddf[_0x2e5b('0x12')])){_0x5995d2[_0x2e5b('0x13')][_0x2e5b('0x14')]({'where':{'id':_0x295ddf[_0x2e5b('0x15')]}})[_0x2e5b('0x16')](function(_0xb42c13){if(_0xb42c13){_0xb42c13[_0x2e5b('0x17')]({'lastMsgAt':_0x295ddf[_0x2e5b('0x18')],'lastMsgDirection':_0x295ddf['direction'][_0x2e5b('0x10')]()});}})[_0x2e5b('0x19')](function(_0x139b35){console['error'](_0x139b35);});}if(_0x295ddf[_0x2e5b('0xf')]==='out'&&!_0x295ddf[_0x2e5b('0x1a')]){var _0x51aadc;_0x5995d2['CmContact'][_0x2e5b('0x1b')]()[_0x2e5b('0x16')](function(_0x53f8bd){return _0x5995d2['OpenchannelAccount'][_0x2e5b('0x1c')]({'where':{'id':_0x295ddf[_0x2e5b('0x1d')]},'include':[{'model':_0x5995d2[_0x2e5b('0x13')],'as':_0x2e5b('0x1e'),'where':{'id':_0x295ddf[_0x2e5b('0x15')]},'limit':0x1,'include':[{'model':_0x5995d2['CmContact'],'as':'Contact','attributes':_[_0x2e5b('0x1f')](_0x53f8bd)}]}]});})[_0x2e5b('0x16')](function(_0x275625){_0x51aadc=_0x275625['get']({'plain':!![]});if(_0x51aadc&&_0x51aadc[_0x2e5b('0x20')]){logger[_0x2e5b('0x21')](_0x2e5b('0x22'),'afterCreate',util[_0x2e5b('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x295ddf['id'],_0x51aadc['replyUri']));if(_0x51aadc[_0x2e5b('0x1e')]&&_0x51aadc['Interactions']['length']){_0x295ddf['Interaction']=_[_0x2e5b('0x24')](_0x51aadc[_0x2e5b('0x1e')][0x0],_0x2e5b('0x25'));_0x295ddf[_0x2e5b('0x25')]=_0x51aadc[_0x2e5b('0x1e')][0x0][_0x2e5b('0x25')];}var _0x301d73={'method':'POST','uri':encodeURI(_0x51aadc[_0x2e5b('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x301d73[_0x2e5b('0x26')]){case _0x2e5b('0x27'):_0x301d73['qs']=_0x295ddf;break;case _0x2e5b('0x28'):_0x301d73['body']=_0x295ddf;break;}return rp(_0x301d73)[_0x2e5b('0x16')](function(_0x33150a){logger[_0x2e5b('0x21')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x2e5b('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x295ddf['id'],_0x51aadc[_0x2e5b('0x20')]));if(_0x33150a[_0x2e5b('0xc')]['threadId']&&_0x33150a['body'][_0x2e5b('0x29')]!=_0x295ddf[_0x2e5b('0x2a')][_0x2e5b('0x29')]){return _0x5995d2['OpenchannelInteraction']['update']({'threadId':_0x33150a['body'][_0x2e5b('0x29')]},{'where':{'id':_0x295ddf[_0x2e5b('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x47e0d8[_0x2e5b('0x17')]({'read':!![]});})[_0x2e5b('0x19')](function(_0x27fe6f){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2e5b('0x2b'),util[_0x2e5b('0x2c')](_0x27fe6f,{'showHidden':![],'depth':null}));_0x85dd22();});}else{_0x85dd22();}})['finally'](function(){_0x85dd22();});}else{_0x85dd22();}}},'charset':'utf8mb4','collate':_0x2e5b('0x2d')});}; \ No newline at end of file +var _0x2b43=['rimraf','../../config/environment','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','error','CmContact','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','afterCreate','inspect','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa7811e,_0x26ec72){var _0x1f8f8c=function(_0x5c296c){while(--_0x5c296c){_0xa7811e['push'](_0xa7811e['shift']());}};_0x1f8f8c(++_0x26ec72);}(_0x2b43,0xc4));var _0x32b4=function(_0x308183,_0x6819f9){_0x308183=_0x308183-0x0;var _0x5308ff=_0x2b43[_0x308183];return _0x5308ff;};'use strict';var _=require(_0x32b4('0x0'));var util=require(_0x32b4('0x1'));var logger=require(_0x32b4('0x2'))(_0x32b4('0x3'));var moment=require(_0x32b4('0x4'));var BPromise=require(_0x32b4('0x5'));var rp=require(_0x32b4('0x6'));var fs=require('fs');var path=require(_0x32b4('0x7'));var rimraf=require(_0x32b4('0x8'));var config=require(_0x32b4('0x9'));var attributes=require('./openchannelMessage.attributes');module[_0x32b4('0xa')]=function(_0x4e73a7,_0x46c103){return _0x4e73a7['define'](_0x32b4('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x32b4('0xc'),'fields':[_0x32b4('0xd')],'type':_0x32b4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e117e,_0xa2f0e1,_0xcd2819){var _0x3c5566=_0x4e73a7[_0x32b4('0xf')];var _0x309cfb=_0x5e117e[_0x32b4('0x10')]({'plain':!![]});if(_0x309cfb['direction'][_0x32b4('0x11')]()==='in'||_0x309cfb[_0x32b4('0x12')][_0x32b4('0x11')]()===_0x32b4('0x13')&&!_0x309cfb[_0x32b4('0x14')]&&!_[_0x32b4('0x15')](_0x309cfb[_0x32b4('0x16')])){_0x3c5566[_0x32b4('0x17')][_0x32b4('0x18')]({'where':{'id':_0x309cfb['OpenchannelInteractionId']}})['then'](function(_0xc9b8e9){if(_0xc9b8e9){_0xc9b8e9[_0x32b4('0x19')]({'lastMsgAt':_0x309cfb[_0x32b4('0x1a')],'lastMsgDirection':_0x309cfb[_0x32b4('0x12')][_0x32b4('0x11')]()});}})['catch'](function(_0x5d301c){console[_0x32b4('0x1b')](_0x5d301c);});}if(_0x309cfb[_0x32b4('0x12')]==='out'&&!_0x309cfb[_0x32b4('0x14')]){var _0x377cb5;_0x3c5566[_0x32b4('0x1c')][_0x32b4('0x1d')]()[_0x32b4('0x1e')](function(_0x26197e){return _0x3c5566[_0x32b4('0x1f')]['find']({'where':{'id':_0x309cfb[_0x32b4('0x20')]},'include':[{'model':_0x3c5566[_0x32b4('0x17')],'as':_0x32b4('0x21'),'where':{'id':_0x309cfb[_0x32b4('0x22')]},'limit':0x1,'include':[{'model':_0x3c5566[_0x32b4('0x1c')],'as':_0x32b4('0x23'),'attributes':_[_0x32b4('0x24')](_0x26197e)}]}]});})['then'](function(_0x38bc48){_0x377cb5=_0x38bc48[_0x32b4('0x10')]({'plain':!![]});if(_0x377cb5&&_0x377cb5[_0x32b4('0x25')]){logger[_0x32b4('0x26')](_0x32b4('0x27'),'afterCreate',util[_0x32b4('0x28')](_0x32b4('0x29'),_0x309cfb['id'],_0x377cb5[_0x32b4('0x25')]));if(_0x377cb5[_0x32b4('0x21')]&&_0x377cb5[_0x32b4('0x21')][_0x32b4('0x2a')]){_0x309cfb['Interaction']=_[_0x32b4('0x2b')](_0x377cb5['Interactions'][0x0],_0x32b4('0x23'));_0x309cfb[_0x32b4('0x23')]=_0x377cb5['Interactions'][0x0][_0x32b4('0x23')];}var _0xa2f0e1={'method':_0x32b4('0x2c'),'uri':encodeURI(_0x377cb5[_0x32b4('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xa2f0e1[_0x32b4('0x2d')]){case'GET':_0xa2f0e1['qs']=_0x309cfb;break;case _0x32b4('0x2c'):_0xa2f0e1[_0x32b4('0xd')]=_0x309cfb;break;}return rp(_0xa2f0e1)[_0x32b4('0x1e')](function(_0x2b2e5f){logger[_0x32b4('0x26')](_0x32b4('0x27'),'afterCreate',util[_0x32b4('0x28')](_0x32b4('0x2e'),_0x309cfb['id'],_0x377cb5[_0x32b4('0x25')]));if(_0x2b2e5f['body'][_0x32b4('0x2f')]&&_0x2b2e5f[_0x32b4('0xd')]['threadId']!=_0x309cfb['Interaction'][_0x32b4('0x2f')]){return _0x3c5566[_0x32b4('0x17')][_0x32b4('0x19')]({'threadId':_0x2b2e5f[_0x32b4('0xd')][_0x32b4('0x2f')]},{'where':{'id':_0x309cfb['Interaction']['id']}});}else{return;}})[_0x32b4('0x1e')](function(){return _0x5e117e[_0x32b4('0x19')]({'read':!![]});})['catch'](function(_0x2bba3f){logger[_0x32b4('0x1b')](_0x32b4('0x27'),_0x32b4('0x30'),util[_0x32b4('0x31')](_0x2bba3f,{'showHidden':![],'depth':null}));_0xcd2819();});}else{_0xcd2819();}})[_0x32b4('0x32')](function(){_0xcd2819();});}else{_0xcd2819();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index adebfc2..e7d0edb 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x41b7cf,_0x451024){var _0x2be28d=function(_0x52c69e){while(--_0x52c69e){_0x41b7cf['push'](_0x41b7cf['shift']());}};_0x2be28d(++_0x451024);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0x0b0e[_0x4283c0];return _0x6b47ab;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x25cae6,_0x8ebfe8){var _0x386010=function(_0x1a6f34){while(--_0x1a6f34){_0x25cae6['push'](_0x25cae6['shift']());}};_0x386010(++_0x8ebfe8);}(_0xadb5,0xad));var _0x5adb=function(_0x4d450c,_0x5de4f3){_0x4d450c=_0x4d450c-0x0;var _0xbf11e=_0xadb5[_0x4d450c];return _0xbf11e;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3e88b51..88b0622 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 _0x2428=['length','save','remove','update','emit','removeListener','register'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2428,0xd3));var _0x8242=function(_0x4c11ac,_0x2153b8){_0x4c11ac=_0x4c11ac-0x0;var _0x36c7f0=_0x2428[_0x4c11ac];return _0x36c7f0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x8242('0x0'),_0x8242('0x1'),_0x8242('0x2')];function createListener(_0x3f0f24,_0x9528a2){return function(_0x3fea1d){_0x9528a2[_0x8242('0x3')](_0x3f0f24,_0x3fea1d);};}function removeListener(_0x29feea,_0x1ee0d4){return function(){OpenchannelMessageEvents[_0x8242('0x4')](_0x29feea,_0x1ee0d4);};}exports[_0x8242('0x5')]=function(_0x484baa){for(var _0x38153d=0x0,_0x11da5f=events[_0x8242('0x6')];_0x38153d<_0x11da5f;_0x38153d++){var _0x3712f3=events[_0x38153d];var _0x1501e8=createListener('openchannelMessage:'+_0x3712f3,_0x484baa);OpenchannelMessageEvents['on'](_0x3712f3,_0x1501e8);}}; \ No newline at end of file +var _0xd45e=['openchannelMessage:','save','remove','emit','removeListener','register','length'];(function(_0x4ce46c,_0x3002e5){var _0x132542=function(_0x3e8d5f){while(--_0x3e8d5f){_0x4ce46c['push'](_0x4ce46c['shift']());}};_0x132542(++_0x3002e5);}(_0xd45e,0x182));var _0xed45=function(_0x552ea5,_0x28c15c){_0x552ea5=_0x552ea5-0x0;var _0x34dc4a=_0xd45e[_0x552ea5];return _0x34dc4a;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xed45('0x0'),_0xed45('0x1'),'update'];function createListener(_0x2d14c4,_0x5591e8){return function(_0x18aa20){_0x5591e8[_0xed45('0x2')](_0x2d14c4,_0x18aa20);};}function removeListener(_0x9c1494,_0x5667ca){return function(){OpenchannelMessageEvents[_0xed45('0x3')](_0x9c1494,_0x5667ca);};}exports[_0xed45('0x4')]=function(_0x5332aa){for(var _0x528ca3=0x0,_0x3185ae=events[_0xed45('0x5')];_0x528ca3<_0x3185ae;_0x528ca3++){var _0x4afe6c=events[_0x528ca3];var _0x380a8=createListener(_0xed45('0x6')+_0x4afe6c,_0x5332aa);OpenchannelMessageEvents['on'](_0x4afe6c,_0x380a8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index cdcbe04..5f0c8cd 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 _0xa32f=['update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','index','/describe','isAuthenticated','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put'];(function(_0x536f4a,_0x360afe){var _0x242497=function(_0x35a7bb){while(--_0x35a7bb){_0x536f4a['push'](_0x536f4a['shift']());}};_0x242497(++_0x360afe);}(_0xa32f,0x81));var _0xfa32=function(_0xca78c8,_0x2a441f){_0xca78c8=_0xca78c8-0x0;var _0x2c0fe5=_0xa32f[_0xca78c8];return _0x2c0fe5;};'use strict';var multer=require(_0xfa32('0x0'));var util=require(_0xfa32('0x1'));var path=require(_0xfa32('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa32('0x3'));var router=express[_0xfa32('0x4')]();var fs_extra=require(_0xfa32('0x5'));var auth=require(_0xfa32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa32('0x7'));var controller=require(_0xfa32('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa32('0x9')]);router['get'](_0xfa32('0xa'),auth[_0xfa32('0xb')](),controller['describe']);router[_0xfa32('0xc')](_0xfa32('0xd'),auth[_0xfa32('0xb')](),controller[_0xfa32('0xe')]);router['get'](_0xfa32('0xf'),auth[_0xfa32('0xb')](),controller[_0xfa32('0x10')]);router[_0xfa32('0xc')](_0xfa32('0x11'),auth[_0xfa32('0xb')](),controller[_0xfa32('0x12')]);router[_0xfa32('0xc')](_0xfa32('0x13'),auth['isAuthenticated'](),controller[_0xfa32('0x14')]);router[_0xfa32('0x15')]('/',auth[_0xfa32('0xb')](),controller[_0xfa32('0x16')]);router[_0xfa32('0x15')](_0xfa32('0x11'),auth[_0xfa32('0xb')](),controller[_0xfa32('0x17')]);router[_0xfa32('0x15')](_0xfa32('0x13'),auth[_0xfa32('0xb')](),controller[_0xfa32('0x18')]);router[_0xfa32('0x19')]('/:id',auth[_0xfa32('0xb')](),controller[_0xfa32('0x1a')]);router['delete']('/:id',auth[_0xfa32('0xb')](),controller[_0xfa32('0x1b')]);router[_0xfa32('0x1c')]('/:id/teams',auth[_0xfa32('0xb')](),controller[_0xfa32('0x1d')]);router[_0xfa32('0x1c')](_0xfa32('0x13'),auth[_0xfa32('0xb')](),controller[_0xfa32('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xc95a=['post','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create'];(function(_0x131883,_0x4e747a){var _0x3c64f2=function(_0x323363){while(--_0x323363){_0x131883['push'](_0x131883['shift']());}};_0x3c64f2(++_0x4e747a);}(_0xc95a,0x85));var _0xac95=function(_0x4dea50,_0x5869ce){_0x4dea50=_0x4dea50-0x0;var _0x29db7c=_0xc95a[_0x4dea50];return _0x29db7c;};'use strict';var multer=require('multer');var util=require(_0xac95('0x0'));var path=require(_0xac95('0x1'));var timeout=require(_0xac95('0x2'));var express=require(_0xac95('0x3'));var router=express[_0xac95('0x4')]();var fs_extra=require(_0xac95('0x5'));var auth=require(_0xac95('0x6'));var interaction=require(_0xac95('0x7'));var config=require(_0xac95('0x8'));var controller=require(_0xac95('0x9'));router[_0xac95('0xa')]('/',auth[_0xac95('0xb')](),controller[_0xac95('0xc')]);router[_0xac95('0xa')](_0xac95('0xd'),auth[_0xac95('0xb')](),controller['describe']);router[_0xac95('0xa')](_0xac95('0xe'),auth['isAuthenticated'](),controller[_0xac95('0xf')]);router[_0xac95('0xa')](_0xac95('0x10'),auth[_0xac95('0xb')](),controller[_0xac95('0x11')]);router[_0xac95('0xa')](_0xac95('0x12'),auth[_0xac95('0xb')](),controller[_0xac95('0x13')]);router[_0xac95('0xa')]('/:id/users',auth[_0xac95('0xb')](),controller[_0xac95('0x14')]);router['post']('/',auth[_0xac95('0xb')](),controller[_0xac95('0x15')]);router['post'](_0xac95('0x12'),auth[_0xac95('0xb')](),controller['addTeams']);router[_0xac95('0x16')](_0xac95('0x17'),auth['isAuthenticated'](),controller[_0xac95('0x18')]);router[_0xac95('0x19')]('/:id',auth[_0xac95('0xb')](),controller[_0xac95('0x1a')]);router[_0xac95('0x1b')](_0xac95('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xac95('0x1b')](_0xac95('0x12'),auth['isAuthenticated'](),controller[_0xac95('0x1c')]);router[_0xac95('0x1b')](_0xac95('0x17'),auth[_0xac95('0xb')](),controller[_0xac95('0x1d')]);module[_0xac95('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 0117d79..8444ba1 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 _0xc0e8=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x24c5d6,_0x47994b){var _0x45efb1=function(_0x1f3653){while(--_0x1f3653){_0x24c5d6['push'](_0x24c5d6['shift']());}};_0x45efb1(++_0x47994b);}(_0xc0e8,0x64));var _0x8c0e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0e8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8c0e('0x0'));module[_0x8c0e('0x1')]={'name':{'type':Sequelize[_0x8c0e('0x2')],'unique':_0x8c0e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8c0e('0x2')]},'timeout':{'type':Sequelize[_0x8c0e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c0e('0x5')](_0x8c0e('0x6'),_0x8c0e('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xcb74=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x5a8b46,_0x5d1e8c){var _0x459fad=function(_0x529340){while(--_0x529340){_0x5a8b46['push'](_0x5a8b46['shift']());}};_0x459fad(++_0x5d1e8c);}(_0xcb74,0xfc));var _0x4cb7=function(_0x2b9633,_0x517eed){_0x2b9633=_0x2b9633-0x0;var _0x438405=_0xcb74[_0x2b9633];return _0x438405;};'use strict';var Sequelize=require(_0x4cb7('0x0'));module[_0x4cb7('0x1')]={'name':{'type':Sequelize[_0x4cb7('0x2')],'unique':_0x4cb7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4cb7('0x2')]},'timeout':{'type':Sequelize[_0x4cb7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4cb7('0x5')](_0x4cb7('0x6'),'beepall',_0x4cb7('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5810b20..6289f1b 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 _0xc552=['OpenchannelQueueId','filter','map','findAndCountAll','UserId','openchannelPause','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','removeTeams','Agents','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','User','order','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','json','update','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','filters'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xc552,0x1ad));var _0x2c55=function(_0x2c699e,_0x5e9d6c){_0x2c699e=_0x2c699e-0x0;var _0x5844e3=_0xc552[_0x2c699e];return _0x5844e3;};'use strict';var BPromise=require(_0x2c55('0x0'));var util=require('util');var _=require(_0x2c55('0x1'));var squel=require('squel');var Redis=require(_0x2c55('0x2'));var qs=require(_0x2c55('0x3'));var logger=require(_0x2c55('0x4'))(_0x2c55('0x5'));var config=require(_0x2c55('0x6'));var db=require('../../mysqldb')['db'];config[_0x2c55('0x7')]=_[_0x2c55('0x8')](config[_0x2c55('0x7')],{'host':_0x2c55('0x9'),'port':0x18eb});var socket=require(_0x2c55('0xa'))(new Redis(config[_0x2c55('0x7')]));require('./openchannelQueue.socket')[_0x2c55('0xb')](socket);function respondWithStatusCode(_0x241c11,_0x181006){_0x181006=_0x181006||0xcc;return function(_0x5b2f1b){if(_0x5b2f1b){return _0x241c11[_0x2c55('0xc')](_0x181006);}return _0x241c11['status'](_0x181006)[_0x2c55('0xd')]();};}function respondWithResult(_0x36e597,_0x29981d){_0x29981d=_0x29981d||0xc8;return function(_0x1b39b6){if(_0x1b39b6){return _0x36e597[_0x2c55('0xe')](_0x29981d)['json'](_0x1b39b6);}};}function respondWithFilteredResult(_0x731362,_0x29dfa3){return function(_0x69c252){if(_0x69c252){var _0x21800c=typeof _0x29dfa3[_0x2c55('0xf')]===_0x2c55('0x10')&&typeof _0x29dfa3[_0x2c55('0x11')]===_0x2c55('0x10');var _0x2f1cf2=_0x69c252['count'];var _0x7fbd76=_0x21800c?0x0:_0x29dfa3[_0x2c55('0xf')];var _0x9555c=_0x21800c?_0x69c252[_0x2c55('0x12')]:_0x29dfa3[_0x2c55('0xf')]+_0x29dfa3[_0x2c55('0x11')];var _0x3379eb;if(_0x9555c>=_0x2f1cf2){_0x9555c=_0x2f1cf2;_0x3379eb=0xc8;}else{_0x3379eb=0xce;}_0x731362[_0x2c55('0xe')](_0x3379eb);return _0x731362['set']('Content-Range',_0x7fbd76+'-'+_0x9555c+'/'+_0x2f1cf2)[_0x2c55('0x13')](_0x69c252);}return null;};}function saveUpdates(_0x3f448d){return function(_0x3f8532){if(_0x3f8532){return _0x3f8532[_0x2c55('0x14')](_0x3f448d)[_0x2c55('0x15')](function(_0x7a4506){return _0x7a4506;});}return null;};}function removeEntity(_0x544cbb){return function(_0x399dd8){if(_0x399dd8){return _0x399dd8['destroy']()[_0x2c55('0x15')](function(){var _0x56fca1=_0x399dd8[_0x2c55('0x16')]({'plain':!![]});var _0x1f7889=_0x2c55('0x17');return db[_0x2c55('0x18')]['destroy']({'where':{'type':_0x1f7889,'resourceId':_0x56fca1['id']}})[_0x2c55('0x15')](function(){return _0x399dd8;});})['then'](function(){_0x544cbb[_0x2c55('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf61ec){return function(_0x44e995){if(!_0x44e995){_0xaf61ec[_0x2c55('0xc')](0x194);}return _0x44e995;};}function handleError(_0xfc2a96,_0x163da1){_0x163da1=_0x163da1||0x1f4;return function(_0x24348e){logger[_0x2c55('0x19')](_0x24348e[_0x2c55('0x1a')]);if(_0x24348e[_0x2c55('0x1b')]){delete _0x24348e[_0x2c55('0x1b')];}_0xfc2a96[_0x2c55('0xe')](_0x163da1)[_0x2c55('0x1c')](_0x24348e);};}exports[_0x2c55('0x1d')]=function(_0x1d19e6,_0x3b7d7){var _0x2e0316={};var _0x79ac39={'count':0x0,'rows':[]};var _0x30c896=_['map'](db[_0x2c55('0x1e')][_0x2c55('0x1f')],function(_0x5a7aba){return{'name':_0x5a7aba['fieldName'],'type':_0x5a7aba[_0x2c55('0x20')][_0x2c55('0x21')]};});_0x2e0316=qs[_0x2c55('0x22')](_0x30c896,_0x1d19e6);var _0x2ff873={'where':_0x2e0316[_0x2c55('0x23')]};return db[_0x2c55('0x1e')]['count'](_0x2ff873)['then'](function(_0x1c5e84){_0x79ac39[_0x2c55('0x12')]=_0x1c5e84;_0x2e0316['include']=qs[_0x2c55('0x24')](_0x1d19e6[_0x2c55('0x25')]);return db[_0x2c55('0x1e')][_0x2c55('0x26')](_0x2e0316);})[_0x2c55('0x15')](function(_0x2d60e0){_0x79ac39[_0x2c55('0x27')]=_0x2d60e0;return _0x79ac39;})[_0x2c55('0x15')](respondWithFilteredResult(_0x3b7d7,_0x2e0316))[_0x2c55('0x28')](handleError(_0x3b7d7,null));};exports[_0x2c55('0x29')]=function(_0x2c6d3e,_0x519b4a){var _0xfed50e={'raw':!![],'where':{'id':_0x2c6d3e[_0x2c55('0x2a')]['id']}},_0x2db967={};_0x2db967[_0x2c55('0x2b')]=_[_0x2c55('0x2c')](db[_0x2c55('0x1e')][_0x2c55('0x1f')]);_0x2db967[_0x2c55('0x25')]=_[_0x2c55('0x2c')](_0x2c6d3e[_0x2c55('0x25')]);_0x2db967['filters']=_[_0x2c55('0x2d')](_0x2db967['model'],_0x2db967[_0x2c55('0x25')]);_0xfed50e[_0x2c55('0x2e')]=_['intersection'](_0x2db967[_0x2c55('0x2b')],qs[_0x2c55('0x2f')](_0x2c6d3e[_0x2c55('0x25')]['fields']));_0xfed50e[_0x2c55('0x2e')]=_0xfed50e[_0x2c55('0x2e')][_0x2c55('0x30')]?_0xfed50e[_0x2c55('0x2e')]:_0x2db967[_0x2c55('0x2b')];if(_0x2c6d3e[_0x2c55('0x25')]['includeAll']){_0xfed50e['include']=[{'all':!![]}];}_0xfed50e=_[_0x2c55('0x31')]({},_0xfed50e,_0x2c6d3e[_0x2c55('0x32')]);return db[_0x2c55('0x1e')][_0x2c55('0x33')](_0xfed50e)[_0x2c55('0x15')](handleEntityNotFound(_0x519b4a,null))[_0x2c55('0x15')](respondWithResult(_0x519b4a,null))[_0x2c55('0x28')](handleError(_0x519b4a,null));};exports['create']=function(_0x3a1d3d,_0x276949){return db['OpenchannelQueue'][_0x2c55('0x34')](_0x3a1d3d[_0x2c55('0x35')],{})[_0x2c55('0x15')](function(_0xd2c5df){var _0x5c3cdc=_0x3a1d3d[_0x2c55('0x36')][_0x2c55('0x16')]({'plain':!![]});if(!_0x5c3cdc)throw new Error(_0x2c55('0x37'));if(_0x5c3cdc[_0x2c55('0x38')]===_0x2c55('0x36')){var _0x2fc575=_0xd2c5df[_0x2c55('0x16')]({'plain':!![]});var _0x31ede8='OpenchannelQueues';return db[_0x2c55('0x39')]['find']({'where':{'name':_0x31ede8,'userProfileId':_0x5c3cdc[_0x2c55('0x3a')]},'raw':!![]})[_0x2c55('0x15')](function(_0xd99ea2){if(_0xd99ea2&&_0xd99ea2[_0x2c55('0x3b')]===0x0){return db[_0x2c55('0x18')][_0x2c55('0x34')]({'name':_0x2fc575['name'],'resourceId':_0x2fc575['id'],'type':_0xd99ea2[_0x2c55('0x1b')],'sectionId':_0xd99ea2['id']},{})[_0x2c55('0x15')](function(){return _0xd2c5df;});}else{return _0xd2c5df;}})[_0x2c55('0x28')](function(_0x17f072){logger[_0x2c55('0x19')](_0x2c55('0x3c'),_0x17f072);throw _0x17f072;});}return _0xd2c5df;})[_0x2c55('0x15')](respondWithResult(_0x276949,0xc9))[_0x2c55('0x28')](handleError(_0x276949,null));};exports[_0x2c55('0x14')]=function(_0x1eb786,_0x18ced8){if(_0x1eb786[_0x2c55('0x35')]['id']){delete _0x1eb786[_0x2c55('0x35')]['id'];}return db['OpenchannelQueue'][_0x2c55('0x33')]({'where':{'id':_0x1eb786[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](handleEntityNotFound(_0x18ced8,null))[_0x2c55('0x15')](saveUpdates(_0x1eb786[_0x2c55('0x35')],null))[_0x2c55('0x15')](respondWithResult(_0x18ced8,null))[_0x2c55('0x28')](handleError(_0x18ced8,null));};exports[_0x2c55('0x3d')]=function(_0x5b20c5,_0x5b7d7c){return db[_0x2c55('0x1e')][_0x2c55('0x33')]({'where':{'id':_0x5b20c5[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](handleEntityNotFound(_0x5b7d7c,null))[_0x2c55('0x15')](removeEntity(_0x5b7d7c,null))[_0x2c55('0x28')](handleError(_0x5b7d7c,null));};exports['describe']=function(_0x477a3f,_0x325b20){return db[_0x2c55('0x1e')][_0x2c55('0x3e')]()[_0x2c55('0x15')](respondWithResult(_0x325b20,null))[_0x2c55('0x28')](handleError(_0x325b20,null));};exports[_0x2c55('0x3f')]=function(_0x4170b0,_0x28eeeb){var _0x1a9f3f={'raw':!![],'where':{}},_0x4fbd6c={},_0x35816a;return db[_0x2c55('0x1e')][_0x2c55('0x40')]({'where':{'id':_0x4170b0[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](handleEntityNotFound(_0x28eeeb,null))[_0x2c55('0x15')](function(_0x58220c){if(_0x58220c){_0x35816a=_0x58220c['get']({'plain':!![]});_0x4fbd6c[_0x2c55('0x2b')]=_[_0x2c55('0x2c')](db[_0x2c55('0x41')]['rawAttributes']);_0x4fbd6c[_0x2c55('0x25')]=_[_0x2c55('0x2c')](_0x4170b0[_0x2c55('0x25')]);_0x4fbd6c['filters']=_[_0x2c55('0x2d')](_0x4fbd6c[_0x2c55('0x2b')],_0x4fbd6c['query']);_0x1a9f3f[_0x2c55('0x2e')]=_[_0x2c55('0x2d')](_0x4fbd6c[_0x2c55('0x2b')],qs[_0x2c55('0x2f')](_0x4170b0['query'][_0x2c55('0x2f')]));_0x1a9f3f['attributes']=_0x1a9f3f[_0x2c55('0x2e')]['length']?_0x1a9f3f['attributes']:_0x4fbd6c['model'];if(!_0x4170b0[_0x2c55('0x25')][_0x2c55('0x42')](_0x2c55('0x43'))){_0x1a9f3f['limit']=qs[_0x2c55('0x11')](_0x4170b0[_0x2c55('0x25')][_0x2c55('0x11')]);_0x1a9f3f[_0x2c55('0xf')]=qs['offset'](_0x4170b0[_0x2c55('0x25')]['offset']);}_0x1a9f3f['order']=qs[_0x2c55('0x44')](_0x4170b0[_0x2c55('0x25')][_0x2c55('0x44')]);_0x1a9f3f['where']=qs['filters'](_[_0x2c55('0x45')](_0x4170b0[_0x2c55('0x25')],_0x4fbd6c[_0x2c55('0x46')]));_0x1a9f3f['where'][_0x2c55('0x47')]=_0x58220c['id'];if(_0x4170b0[_0x2c55('0x25')][_0x2c55('0x48')]){_0x1a9f3f[_0x2c55('0x23')]=_[_0x2c55('0x31')](_0x1a9f3f[_0x2c55('0x23')],{'$or':_[_0x2c55('0x49')](_0x1a9f3f[_0x2c55('0x2e')],function(_0x4234fa){var _0x4abbdc={};_0x4abbdc[_0x4234fa]={'$like':'%'+_0x4170b0[_0x2c55('0x25')][_0x2c55('0x48')]+'%'};return _0x4abbdc;})});}_0x1a9f3f=_[_0x2c55('0x31')]({},_0x1a9f3f,_0x4170b0[_0x2c55('0x32')]);return db['UserOpenchannelQueue'][_0x2c55('0x26')](_0x1a9f3f);}})[_0x2c55('0x15')](function(_0x294b5e){if(_0x294b5e){return db['User'][_0x2c55('0x4a')]({'where':{'id':_[_0x2c55('0x49')](_0x294b5e,_0x2c55('0x4b')),'role':'agent'},'attributes':['id',_0x2c55('0x1b'),_0x2c55('0x4c'),'updatedAt',_0x2c55('0x4d')]});}})[_0x2c55('0x15')](function(_0x36fa60){if(_0x36fa60){return{'count':_0x36fa60[_0x2c55('0x12')],'rows':_[_0x2c55('0x49')](_0x36fa60[_0x2c55('0x27')],function(_0x4f4850){return{'membername':_0x4f4850[_0x2c55('0x1b')],'UserId':_0x4f4850['id'],'queue_name':_0x35816a[_0x2c55('0x1b')],'OpenchannelQueueId':_0x35816a['id'],'interface':util[_0x2c55('0x4e')](_0x2c55('0x4f'),_0x2c55('0x50'),_0x4f4850[_0x2c55('0x1b')]),'penalty':0x0,'paused':_0x4f4850['openchannelPause'],'createdAt':_0x4f4850[_0x2c55('0x4d')],'updatedAt':_0x4f4850['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2c55('0x15')](respondWithFilteredResult(_0x28eeeb,_0x1a9f3f))[_0x2c55('0x28')](handleError(_0x28eeeb,null));};exports[_0x2c55('0x51')]=function(_0x1dbbe8,_0x2065de){var _0x123b7f={};var _0x34bf91={};var _0x4b8c61;var _0x43dacd;return db[_0x2c55('0x1e')][_0x2c55('0x40')]({'where':{'id':_0x1dbbe8['params']['id']}})['then'](handleEntityNotFound(_0x2065de,null))[_0x2c55('0x15')](function(_0xdc88ac){if(_0xdc88ac){_0x4b8c61=_0xdc88ac;_0x34bf91[_0x2c55('0x2b')]=_[_0x2c55('0x2c')](db['Team']['rawAttributes']);_0x34bf91['query']=_[_0x2c55('0x2c')](_0x1dbbe8['query']);_0x34bf91[_0x2c55('0x46')]=_[_0x2c55('0x2d')](_0x34bf91[_0x2c55('0x2b')],_0x34bf91[_0x2c55('0x25')]);_0x123b7f[_0x2c55('0x2e')]=_[_0x2c55('0x2d')](_0x34bf91[_0x2c55('0x2b')],qs['fields'](_0x1dbbe8[_0x2c55('0x25')][_0x2c55('0x2f')]));_0x123b7f[_0x2c55('0x2e')]=_0x123b7f['attributes'][_0x2c55('0x30')]?_0x123b7f[_0x2c55('0x2e')]:_0x34bf91[_0x2c55('0x2b')];_0x123b7f['order']=qs['sort'](_0x1dbbe8['query'][_0x2c55('0x44')]);_0x123b7f['where']=qs[_0x2c55('0x46')](_[_0x2c55('0x45')](_0x1dbbe8['query'],_0x34bf91['filters']));if(_0x1dbbe8[_0x2c55('0x25')][_0x2c55('0x48')]){_0x123b7f['where']=_[_0x2c55('0x31')](_0x123b7f['where'],{'$or':_[_0x2c55('0x49')](_0x123b7f[_0x2c55('0x2e')],function(_0x531944){var _0x2e00d4={};_0x2e00d4[_0x531944]={'$like':'%'+_0x1dbbe8[_0x2c55('0x25')][_0x2c55('0x48')]+'%'};return _0x2e00d4;})});}_0x123b7f=_['merge']({},_0x123b7f,_0x1dbbe8[_0x2c55('0x32')]);return _0x4b8c61[_0x2c55('0x51')](_0x123b7f);}})[_0x2c55('0x15')](function(_0x3c2159){if(_0x3c2159){_0x43dacd=_0x3c2159[_0x2c55('0x30')];if(!_0x1dbbe8[_0x2c55('0x25')]['hasOwnProperty']('nolimit')){_0x123b7f[_0x2c55('0x11')]=qs['limit'](_0x1dbbe8[_0x2c55('0x25')]['limit']);_0x123b7f[_0x2c55('0xf')]=qs[_0x2c55('0xf')](_0x1dbbe8['query'][_0x2c55('0xf')]);}return _0x4b8c61[_0x2c55('0x51')](_0x123b7f);}})[_0x2c55('0x15')](function(_0x5516b1){if(_0x5516b1){return _0x5516b1?{'count':_0x43dacd,'rows':_0x5516b1}:null;}})[_0x2c55('0x15')](respondWithResult(_0x2065de,null))[_0x2c55('0x28')](handleError(_0x2065de,null));};exports[_0x2c55('0x52')]=function(_0x48a096,_0x4f4239){var _0x394d16=_0x48a096[_0x2c55('0x35')][_0x2c55('0x53')];return db[_0x2c55('0x54')][_0x2c55('0x26')]({'where':{'id':_0x394d16},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x2c55('0x1b'),_0x2c55('0x55'),_0x2c55('0x56'),_0x2c55('0x57')],'raw':!![]}]})['then'](function(_0x4d8479){if(_0x4d8479){var _0x533236=_[_0x2c55('0x58')](_0x4d8479,function(_0x4158b0){var _0x511f08=_0x4158b0[_0x2c55('0x16')]({'plain':!![]});return _0x511f08['Agents'];});return db[_0x2c55('0x1e')][_0x2c55('0x33')]({'where':{'id':_0x48a096[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](function(_0x2d0258){return db[_0x2c55('0x59')][_0x2c55('0x5a')](function(_0x31cb63){return _0x2d0258[_0x2c55('0x52')](_0x394d16,{'transaction':_0x31cb63})[_0x2c55('0x15')](function(){return BPromise['each'](_0x533236,function(_0x2f2a6a){return db['UserOpenchannelQueue'][_0x2c55('0x5b')]({'where':{'UserId':_0x2f2a6a['id'],'OpenchannelQueueId':_0x48a096[_0x2c55('0x2a')]['id']},'transaction':_0x31cb63});});})[_0x2c55('0x15')](function(){_0x533236['forEach'](function(_0x130a4d){socket[_0x2c55('0x5c')]('userOpenchannelQueue:save',{'UserId':_0x130a4d['id'],'OpenchannelQueueId':_0x2d0258['id']});});});});});}})[_0x2c55('0x15')](respondWithStatusCode(_0x4f4239,null))[_0x2c55('0x28')](handleError(_0x4f4239,null));};exports[_0x2c55('0x5d')]=function(_0x2cec6c,_0x3674c4){return db[_0x2c55('0x54')][_0x2c55('0x26')]({'where':{'id':_0x2cec6c[_0x2c55('0x25')][_0x2c55('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2c55('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x2c55('0x15')](handleEntityNotFound(_0x3674c4,null))[_0x2c55('0x15')](function(_0x3d2858){var _0x2fb767=_[_0x2c55('0x49')](_0x3d2858,'id');var _0x276455=[];var _0x47cc13=[];var _0x55ff07=squel['select']();_0x55ff07[_0x2c55('0x5f')](_0x2c55('0x60'))[_0x2c55('0x61')]('team_has_openchannel_queues','tq')[_0x2c55('0x62')](_0x2c55('0x63'),'ut',_0x2c55('0x64'))[_0x2c55('0x23')]('OpenchannelQueueId\x20=\x20?',_0x2cec6c[_0x2c55('0x2a')]['id']);for(var _0x31a05e=0x0;_0x31a05e<_0x3d2858[_0x2c55('0x30')];_0x31a05e+=0x1){let _0x1cbb58=_0x3d2858[_0x31a05e];for(var _0x2f092c=0x0;_0x2f092c<_0x1cbb58[_0x2c55('0x5e')]['length'];_0x2f092c+=0x1){let _0x48ca87=_0x1cbb58[_0x2c55('0x5e')][_0x2f092c];var _0x12690c=_0x55ff07[_0x2c55('0x65')]();_0x12690c[_0x2c55('0x23')](_0x2c55('0x66'),_0x48ca87['id']);_0x47cc13[_0x2c55('0x67')](db[_0x2c55('0x59')]['query'](_0x12690c[_0x2c55('0x68')](),{'type':db[_0x2c55('0x59')][_0x2c55('0x69')][_0x2c55('0x6a')]})['then'](function(_0x104f2b){if(_0x104f2b[_0x2c55('0x30')]===0x1){return _0x48ca87['id'];}else{var _0x4dae02=_[_0x2c55('0x6b')](_[_0x2c55('0x49')](_0x104f2b,_0x2c55('0x6c')),function(_0x1948ae){return _[_0x2c55('0x6d')](_0x2fb767,_0x1948ae);});if(_0x4dae02){return _0x48ca87['id'];}}}));}}return BPromise[_0x2c55('0x6e')](_0x47cc13)[_0x2c55('0x15')](function(_0xd3d5a1){_0x276455=_(_0x276455)['union'](_0xd3d5a1)[_0x2c55('0x6f')]()[_0x2c55('0x70')]();return db[_0x2c55('0x1e')][_0x2c55('0x33')]({'where':{'id':_0x2cec6c[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](function(_0x1c8ef4){return db[_0x2c55('0x59')][_0x2c55('0x5a')](function(_0x413e3d){return _0x1c8ef4[_0x2c55('0x5d')](_0x2cec6c[_0x2c55('0x25')][_0x2c55('0x53')],{'transaction':_0x413e3d})['then'](function(){if(!_[_0x2c55('0x71')](_0x276455)){return _0x1c8ef4[_0x2c55('0x72')](_0x276455,{'transaction':_0x413e3d});}})[_0x2c55('0x15')](function(){_0x276455[_0x2c55('0x73')](function(_0x23ae21){socket[_0x2c55('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x23ae21,'OpenchannelQueueId':_0x1c8ef4['id']});});});});});});})[_0x2c55('0x15')](respondWithStatusCode(_0x3674c4,null))[_0x2c55('0x28')](handleError(_0x3674c4,null));};exports[_0x2c55('0x74')]=function(_0x124a9b,_0x1a1574){return db[_0x2c55('0x1e')][_0x2c55('0x33')]({'where':{'id':_0x124a9b[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](handleEntityNotFound(_0x1a1574,null))['then'](function(_0x4b38b0){if(_0x4b38b0){return _0x4b38b0[_0x2c55('0x74')](_0x124a9b[_0x2c55('0x35')]['ids'],_[_0x2c55('0x75')](_0x124a9b[_0x2c55('0x35')],[_0x2c55('0x53'),'id'])||{})[_0x2c55('0x76')](function(_0x9ca558){for(var _0xe73c17=0x0;_0xe73c17<_0x124a9b[_0x2c55('0x35')][_0x2c55('0x53')][_0x2c55('0x30')];_0xe73c17+=0x1){socket['emit'](_0x2c55('0x77'),{'UserId':Number(_0x124a9b[_0x2c55('0x35')][_0x2c55('0x53')][_0xe73c17]),'OpenchannelQueueId':Number(_0x124a9b[_0x2c55('0x2a')]['id'])});}return _0x9ca558;});}})['then'](respondWithResult(_0x1a1574,null))['catch'](handleError(_0x1a1574,null));};exports[_0x2c55('0x72')]=function(_0x338d7e,_0x6c638a){return db[_0x2c55('0x1e')][_0x2c55('0x33')]({'where':{'id':_0x338d7e['params']['id']}})['then'](handleEntityNotFound(_0x6c638a,null))['then'](function(_0x130b80){if(_0x130b80){return _0x130b80[_0x2c55('0x72')](_0x338d7e[_0x2c55('0x25')]['ids'])[_0x2c55('0x15')](function(){if(_[_0x2c55('0x78')](_0x338d7e['query']['ids'])){for(var _0x242bf9=0x0;_0x242bf9<_0x338d7e[_0x2c55('0x25')][_0x2c55('0x53')][_0x2c55('0x30')];_0x242bf9+=0x1){socket[_0x2c55('0x5c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x338d7e[_0x2c55('0x25')][_0x2c55('0x53')][_0x242bf9]),'OpenchannelQueueId':Number(_0x338d7e[_0x2c55('0x2a')]['id'])});}}else{socket[_0x2c55('0x5c')](_0x2c55('0x79'),{'UserId':Number(_0x338d7e[_0x2c55('0x25')]['ids']),'OpenchannelQueueId':Number(_0x338d7e[_0x2c55('0x2a')]['id'])});}});}})[_0x2c55('0x15')](respondWithStatusCode(_0x6c638a,null))[_0x2c55('0x28')](handleError(_0x6c638a,null));};exports['getAgents']=function(_0x55cae3,_0x358069){var _0x57866c={};var _0x2a69df={};var _0x9ac047;var _0x280f07;return db[_0x2c55('0x1e')]['findOne']({'where':{'id':_0x55cae3[_0x2c55('0x2a')]['id']}})[_0x2c55('0x15')](handleEntityNotFound(_0x358069,null))['then'](function(_0x3bc036){if(_0x3bc036){_0x9ac047=_0x3bc036;_0x2a69df[_0x2c55('0x2b')]=_[_0x2c55('0x2c')](db[_0x2c55('0x7a')][_0x2c55('0x1f')]);_0x2a69df[_0x2c55('0x25')]=_[_0x2c55('0x2c')](_0x55cae3[_0x2c55('0x25')]);_0x2a69df['filters']=_[_0x2c55('0x2d')](_0x2a69df[_0x2c55('0x2b')],_0x2a69df[_0x2c55('0x25')]);_0x57866c['attributes']=_['intersection'](_0x2a69df[_0x2c55('0x2b')],qs['fields'](_0x55cae3[_0x2c55('0x25')][_0x2c55('0x2f')]));_0x57866c[_0x2c55('0x2e')]=_0x57866c[_0x2c55('0x2e')]['length']?_0x57866c['attributes']:_0x2a69df[_0x2c55('0x2b')];_0x57866c[_0x2c55('0x7b')]=qs[_0x2c55('0x44')](_0x55cae3[_0x2c55('0x25')][_0x2c55('0x44')]);_0x57866c['where']=qs[_0x2c55('0x46')](_[_0x2c55('0x45')](_0x55cae3[_0x2c55('0x25')],_0x2a69df[_0x2c55('0x46')]));if(_0x55cae3['query'][_0x2c55('0x48')]){_0x57866c[_0x2c55('0x23')]=_[_0x2c55('0x31')](_0x57866c['where'],{'$or':_[_0x2c55('0x49')](_0x57866c['attributes'],function(_0x33d050){var _0x590d39={};_0x590d39[_0x33d050]={'$like':'%'+_0x55cae3[_0x2c55('0x25')][_0x2c55('0x48')]+'%'};return _0x590d39;})});}_0x57866c=_[_0x2c55('0x31')]({},_0x57866c,_0x55cae3['options']);return _0x9ac047[_0x2c55('0x7c')](_0x57866c);}})[_0x2c55('0x15')](function(_0x3b21c9){if(_0x3b21c9){_0x280f07=_0x3b21c9[_0x2c55('0x30')];if(!_0x55cae3[_0x2c55('0x25')]['hasOwnProperty'](_0x2c55('0x43'))){_0x57866c[_0x2c55('0x11')]=qs[_0x2c55('0x11')](_0x55cae3[_0x2c55('0x25')][_0x2c55('0x11')]);_0x57866c[_0x2c55('0xf')]=qs[_0x2c55('0xf')](_0x55cae3['query'][_0x2c55('0xf')]);}return _0x9ac047[_0x2c55('0x7c')](_0x57866c);}})[_0x2c55('0x15')](function(_0x14ef16){if(_0x14ef16){return _0x14ef16?{'count':_0x280f07,'rows':_0x14ef16}:null;}})['then'](respondWithResult(_0x358069,null))[_0x2c55('0x28')](handleError(_0x358069,null));}; \ No newline at end of file +var _0x5a24=['filter','User','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','set','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','fieldName','key','getOptions','where','count','include','query','findAll','rows','catch','params','keys','model','attributes','intersection','fields','length','merge','options','find','create','body','role','user','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','filters','hasOwnProperty','nolimit','limit','sort','OpenchannelQueueId'];(function(_0x5573c0,_0x2ed56d){var _0x5202fd=function(_0xa4cbb4){while(--_0xa4cbb4){_0x5573c0['push'](_0x5573c0['shift']());}};_0x5202fd(++_0x2ed56d);}(_0x5a24,0x193));var _0x45a2=function(_0x30e650,_0x59bcf6){_0x30e650=_0x30e650-0x0;var _0x57ac27=_0x5a24[_0x30e650];return _0x57ac27;};'use strict';var BPromise=require(_0x45a2('0x0'));var util=require('util');var _=require(_0x45a2('0x1'));var squel=require(_0x45a2('0x2'));var Redis=require(_0x45a2('0x3'));var qs=require(_0x45a2('0x4'));var logger=require(_0x45a2('0x5'))(_0x45a2('0x6'));var config=require(_0x45a2('0x7'));var db=require('../../mysqldb')['db'];config[_0x45a2('0x8')]=_[_0x45a2('0x9')](config[_0x45a2('0x8')],{'host':_0x45a2('0xa'),'port':0x18eb});var socket=require(_0x45a2('0xb'))(new Redis(config[_0x45a2('0x8')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x7db24f,_0x1f9242){_0x1f9242=_0x1f9242||0xcc;return function(_0x3452a2){if(_0x3452a2){return _0x7db24f[_0x45a2('0xc')](_0x1f9242);}return _0x7db24f[_0x45a2('0xd')](_0x1f9242)[_0x45a2('0xe')]();};}function respondWithResult(_0x41853b,_0x37472e){_0x37472e=_0x37472e||0xc8;return function(_0x4e8234){if(_0x4e8234){return _0x41853b[_0x45a2('0xd')](_0x37472e)[_0x45a2('0xf')](_0x4e8234);}};}function respondWithFilteredResult(_0x1b0868,_0x350959){return function(_0x5a0935){if(_0x5a0935){var _0x10d532=typeof _0x350959[_0x45a2('0x10')]===_0x45a2('0x11')&&typeof _0x350959['limit']===_0x45a2('0x11');var _0x369843=_0x5a0935['count'];var _0x33ca5b=_0x10d532?0x0:_0x350959[_0x45a2('0x10')];var _0x46859f=_0x10d532?_0x5a0935['count']:_0x350959['offset']+_0x350959['limit'];var _0x467c87;if(_0x46859f>=_0x369843){_0x46859f=_0x369843;_0x467c87=0xc8;}else{_0x467c87=0xce;}_0x1b0868[_0x45a2('0xd')](_0x467c87);return _0x1b0868[_0x45a2('0x12')]('Content-Range',_0x33ca5b+'-'+_0x46859f+'/'+_0x369843)['json'](_0x5a0935);}return null;};}function saveUpdates(_0x5d8312){return function(_0x180d20){if(_0x180d20){return _0x180d20[_0x45a2('0x13')](_0x5d8312)[_0x45a2('0x14')](function(_0x47d1a1){return _0x47d1a1;});}return null;};}function removeEntity(_0x16d3e8){return function(_0x5b94d2){if(_0x5b94d2){return _0x5b94d2[_0x45a2('0x15')]()[_0x45a2('0x14')](function(){var _0x21357b=_0x5b94d2[_0x45a2('0x16')]({'plain':!![]});var _0x28a3a1='OpenchannelQueues';return db[_0x45a2('0x17')][_0x45a2('0x15')]({'where':{'type':_0x28a3a1,'resourceId':_0x21357b['id']}})['then'](function(){return _0x5b94d2;});})[_0x45a2('0x14')](function(){_0x16d3e8['status'](0xcc)[_0x45a2('0xe')]();});}};}function handleEntityNotFound(_0x335805){return function(_0x1feb1c){if(!_0x1feb1c){_0x335805[_0x45a2('0xc')](0x194);}return _0x1feb1c;};}function handleError(_0x187bb9,_0xac5e03){_0xac5e03=_0xac5e03||0x1f4;return function(_0x15ca99){logger['error'](_0x15ca99[_0x45a2('0x18')]);if(_0x15ca99[_0x45a2('0x19')]){delete _0x15ca99['name'];}_0x187bb9[_0x45a2('0xd')](_0xac5e03)[_0x45a2('0x1a')](_0x15ca99);};}exports[_0x45a2('0x1b')]=function(_0x323c16,_0x9c0846){var _0x19203a={};var _0x1fc11c={'count':0x0,'rows':[]};var _0x481a59=_[_0x45a2('0x1c')](db[_0x45a2('0x1d')]['rawAttributes'],function(_0x6bfddb){return{'name':_0x6bfddb[_0x45a2('0x1e')],'type':_0x6bfddb['type'][_0x45a2('0x1f')]};});_0x19203a=qs[_0x45a2('0x20')](_0x481a59,_0x323c16);var _0x43ee70={'where':_0x19203a[_0x45a2('0x21')]};return db[_0x45a2('0x1d')][_0x45a2('0x22')](_0x43ee70)[_0x45a2('0x14')](function(_0x46dfad){_0x1fc11c[_0x45a2('0x22')]=_0x46dfad;_0x19203a[_0x45a2('0x23')]=qs[_0x45a2('0x23')](_0x323c16[_0x45a2('0x24')]);return db['OpenchannelQueue'][_0x45a2('0x25')](_0x19203a);})[_0x45a2('0x14')](function(_0x4940ae){_0x1fc11c[_0x45a2('0x26')]=_0x4940ae;return _0x1fc11c;})[_0x45a2('0x14')](respondWithFilteredResult(_0x9c0846,_0x19203a))[_0x45a2('0x27')](handleError(_0x9c0846,null));};exports['show']=function(_0x54522b,_0x4c17ce){var _0x19403e={'raw':!![],'where':{'id':_0x54522b[_0x45a2('0x28')]['id']}},_0x364797={};_0x364797['model']=_[_0x45a2('0x29')](db[_0x45a2('0x1d')]['rawAttributes']);_0x364797[_0x45a2('0x24')]=_[_0x45a2('0x29')](_0x54522b[_0x45a2('0x24')]);_0x364797['filters']=_['intersection'](_0x364797[_0x45a2('0x2a')],_0x364797['query']);_0x19403e[_0x45a2('0x2b')]=_[_0x45a2('0x2c')](_0x364797[_0x45a2('0x2a')],qs[_0x45a2('0x2d')](_0x54522b['query']['fields']));_0x19403e['attributes']=_0x19403e['attributes'][_0x45a2('0x2e')]?_0x19403e[_0x45a2('0x2b')]:_0x364797[_0x45a2('0x2a')];if(_0x54522b[_0x45a2('0x24')]['includeAll']){_0x19403e[_0x45a2('0x23')]=[{'all':!![]}];}_0x19403e=_[_0x45a2('0x2f')]({},_0x19403e,_0x54522b[_0x45a2('0x30')]);return db[_0x45a2('0x1d')][_0x45a2('0x31')](_0x19403e)[_0x45a2('0x14')](handleEntityNotFound(_0x4c17ce,null))[_0x45a2('0x14')](respondWithResult(_0x4c17ce,null))[_0x45a2('0x27')](handleError(_0x4c17ce,null));};exports[_0x45a2('0x32')]=function(_0x3dfa79,_0x41627e){return db['OpenchannelQueue'][_0x45a2('0x32')](_0x3dfa79[_0x45a2('0x33')],{})[_0x45a2('0x14')](function(_0x3570bc){var _0x3ee52e=_0x3dfa79['user'][_0x45a2('0x16')]({'plain':!![]});if(!_0x3ee52e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee52e[_0x45a2('0x34')]===_0x45a2('0x35')){var _0x54dc32=_0x3570bc[_0x45a2('0x16')]({'plain':!![]});var _0x158651=_0x45a2('0x36');return db[_0x45a2('0x37')][_0x45a2('0x31')]({'where':{'name':_0x158651,'userProfileId':_0x3ee52e['userProfileId']},'raw':!![]})[_0x45a2('0x14')](function(_0x285619){if(_0x285619&&_0x285619[_0x45a2('0x38')]===0x0){return db[_0x45a2('0x17')]['create']({'name':_0x54dc32[_0x45a2('0x19')],'resourceId':_0x54dc32['id'],'type':_0x285619[_0x45a2('0x19')],'sectionId':_0x285619['id']},{})['then'](function(){return _0x3570bc;});}else{return _0x3570bc;}})[_0x45a2('0x27')](function(_0x1a19fd){logger['error'](_0x45a2('0x39'),_0x1a19fd);throw _0x1a19fd;});}return _0x3570bc;})[_0x45a2('0x14')](respondWithResult(_0x41627e,0xc9))[_0x45a2('0x27')](handleError(_0x41627e,null));};exports[_0x45a2('0x13')]=function(_0x8d0a22,_0x1d3c09){if(_0x8d0a22[_0x45a2('0x33')]['id']){delete _0x8d0a22[_0x45a2('0x33')]['id'];}return db[_0x45a2('0x1d')][_0x45a2('0x31')]({'where':{'id':_0x8d0a22[_0x45a2('0x28')]['id']}})[_0x45a2('0x14')](handleEntityNotFound(_0x1d3c09,null))[_0x45a2('0x14')](saveUpdates(_0x8d0a22[_0x45a2('0x33')],null))['then'](respondWithResult(_0x1d3c09,null))[_0x45a2('0x27')](handleError(_0x1d3c09,null));};exports['destroy']=function(_0x4d26b2,_0x1ef2a2){return db['OpenchannelQueue']['find']({'where':{'id':_0x4d26b2[_0x45a2('0x28')]['id']}})[_0x45a2('0x14')](handleEntityNotFound(_0x1ef2a2,null))[_0x45a2('0x14')](removeEntity(_0x1ef2a2,null))[_0x45a2('0x27')](handleError(_0x1ef2a2,null));};exports[_0x45a2('0x3a')]=function(_0x9a0da1,_0x1c6db1){return db[_0x45a2('0x1d')]['describe']()[_0x45a2('0x14')](respondWithResult(_0x1c6db1,null))[_0x45a2('0x27')](handleError(_0x1c6db1,null));};exports[_0x45a2('0x3b')]=function(_0x57397d,_0x454cf8){var _0x44efcd={'raw':!![],'where':{}},_0x3bb680={},_0x528aff;return db[_0x45a2('0x1d')][_0x45a2('0x3c')]({'where':{'id':_0x57397d[_0x45a2('0x28')]['id']}})[_0x45a2('0x14')](handleEntityNotFound(_0x454cf8,null))['then'](function(_0x3a99df){if(_0x3a99df){_0x528aff=_0x3a99df[_0x45a2('0x16')]({'plain':!![]});_0x3bb680[_0x45a2('0x2a')]=_[_0x45a2('0x29')](db[_0x45a2('0x3d')][_0x45a2('0x3e')]);_0x3bb680[_0x45a2('0x24')]=_['keys'](_0x57397d[_0x45a2('0x24')]);_0x3bb680[_0x45a2('0x3f')]=_[_0x45a2('0x2c')](_0x3bb680[_0x45a2('0x2a')],_0x3bb680[_0x45a2('0x24')]);_0x44efcd[_0x45a2('0x2b')]=_[_0x45a2('0x2c')](_0x3bb680[_0x45a2('0x2a')],qs['fields'](_0x57397d[_0x45a2('0x24')]['fields']));_0x44efcd[_0x45a2('0x2b')]=_0x44efcd[_0x45a2('0x2b')]['length']?_0x44efcd[_0x45a2('0x2b')]:_0x3bb680[_0x45a2('0x2a')];if(!_0x57397d[_0x45a2('0x24')][_0x45a2('0x40')](_0x45a2('0x41'))){_0x44efcd[_0x45a2('0x42')]=qs[_0x45a2('0x42')](_0x57397d[_0x45a2('0x24')][_0x45a2('0x42')]);_0x44efcd[_0x45a2('0x10')]=qs['offset'](_0x57397d[_0x45a2('0x24')][_0x45a2('0x10')]);}_0x44efcd['order']=qs[_0x45a2('0x43')](_0x57397d['query'][_0x45a2('0x43')]);_0x44efcd[_0x45a2('0x21')]=qs[_0x45a2('0x3f')](_['pick'](_0x57397d[_0x45a2('0x24')],_0x3bb680[_0x45a2('0x3f')]));_0x44efcd[_0x45a2('0x21')][_0x45a2('0x44')]=_0x3a99df['id'];if(_0x57397d[_0x45a2('0x24')]['filter']){_0x44efcd[_0x45a2('0x21')]=_[_0x45a2('0x2f')](_0x44efcd[_0x45a2('0x21')],{'$or':_['map'](_0x44efcd[_0x45a2('0x2b')],function(_0x19a75a){var _0x27cb03={};_0x27cb03[_0x19a75a]={'$like':'%'+_0x57397d['query'][_0x45a2('0x45')]+'%'};return _0x27cb03;})});}_0x44efcd=_['merge']({},_0x44efcd,_0x57397d['options']);return db[_0x45a2('0x3d')][_0x45a2('0x25')](_0x44efcd);}})[_0x45a2('0x14')](function(_0x112c97){if(_0x112c97){return db[_0x45a2('0x46')]['findAndCountAll']({'where':{'id':_[_0x45a2('0x1c')](_0x112c97,'UserId'),'role':_0x45a2('0x47')},'attributes':['id',_0x45a2('0x19'),_0x45a2('0x48'),_0x45a2('0x49'),_0x45a2('0x4a')]});}})['then'](function(_0x3b5aa4){if(_0x3b5aa4){return{'count':_0x3b5aa4[_0x45a2('0x22')],'rows':_[_0x45a2('0x1c')](_0x3b5aa4[_0x45a2('0x26')],function(_0x9353a3){return{'membername':_0x9353a3[_0x45a2('0x19')],'UserId':_0x9353a3['id'],'queue_name':_0x528aff[_0x45a2('0x19')],'OpenchannelQueueId':_0x528aff['id'],'interface':util[_0x45a2('0x4b')](_0x45a2('0x4c'),_0x45a2('0x4d'),_0x9353a3['name']),'penalty':0x0,'paused':_0x9353a3[_0x45a2('0x48')],'createdAt':_0x9353a3[_0x45a2('0x4a')],'updatedAt':_0x9353a3[_0x45a2('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x454cf8,_0x44efcd))[_0x45a2('0x27')](handleError(_0x454cf8,null));};exports['getTeams']=function(_0x486754,_0x29be8c){var _0x56a638={};var _0x920cf8={};var _0x5d776a;var _0x51ccdd;return db[_0x45a2('0x1d')][_0x45a2('0x3c')]({'where':{'id':_0x486754[_0x45a2('0x28')]['id']}})[_0x45a2('0x14')](handleEntityNotFound(_0x29be8c,null))[_0x45a2('0x14')](function(_0x2c19d6){if(_0x2c19d6){_0x5d776a=_0x2c19d6;_0x920cf8[_0x45a2('0x2a')]=_[_0x45a2('0x29')](db[_0x45a2('0x4e')]['rawAttributes']);_0x920cf8[_0x45a2('0x24')]=_[_0x45a2('0x29')](_0x486754['query']);_0x920cf8[_0x45a2('0x3f')]=_['intersection'](_0x920cf8['model'],_0x920cf8[_0x45a2('0x24')]);_0x56a638[_0x45a2('0x2b')]=_[_0x45a2('0x2c')](_0x920cf8[_0x45a2('0x2a')],qs[_0x45a2('0x2d')](_0x486754[_0x45a2('0x24')][_0x45a2('0x2d')]));_0x56a638[_0x45a2('0x2b')]=_0x56a638['attributes'][_0x45a2('0x2e')]?_0x56a638[_0x45a2('0x2b')]:_0x920cf8[_0x45a2('0x2a')];_0x56a638[_0x45a2('0x4f')]=qs[_0x45a2('0x43')](_0x486754['query']['sort']);_0x56a638[_0x45a2('0x21')]=qs[_0x45a2('0x3f')](_['pick'](_0x486754[_0x45a2('0x24')],_0x920cf8[_0x45a2('0x3f')]));if(_0x486754['query'][_0x45a2('0x45')]){_0x56a638['where']=_[_0x45a2('0x2f')](_0x56a638['where'],{'$or':_[_0x45a2('0x1c')](_0x56a638[_0x45a2('0x2b')],function(_0x2f2954){var _0x4bcd46={};_0x4bcd46[_0x2f2954]={'$like':'%'+_0x486754['query'][_0x45a2('0x45')]+'%'};return _0x4bcd46;})});}_0x56a638=_[_0x45a2('0x2f')]({},_0x56a638,_0x486754[_0x45a2('0x30')]);return _0x5d776a['getTeams'](_0x56a638);}})['then'](function(_0x1255d1){if(_0x1255d1){_0x51ccdd=_0x1255d1['length'];if(!_0x486754[_0x45a2('0x24')]['hasOwnProperty'](_0x45a2('0x41'))){_0x56a638[_0x45a2('0x42')]=qs[_0x45a2('0x42')](_0x486754[_0x45a2('0x24')][_0x45a2('0x42')]);_0x56a638[_0x45a2('0x10')]=qs['offset'](_0x486754['query']['offset']);}return _0x5d776a['getTeams'](_0x56a638);}})[_0x45a2('0x14')](function(_0xc09eae){if(_0xc09eae){return _0xc09eae?{'count':_0x51ccdd,'rows':_0xc09eae}:null;}})['then'](respondWithResult(_0x29be8c,null))[_0x45a2('0x27')](handleError(_0x29be8c,null));};exports[_0x45a2('0x50')]=function(_0x2f160c,_0xf68c46){var _0x472f13=_0x2f160c[_0x45a2('0x33')][_0x45a2('0x51')];return db[_0x45a2('0x4e')][_0x45a2('0x25')]({'where':{'id':_0x472f13},'attributes':['id'],'include':[{'model':db[_0x45a2('0x46')],'as':_0x45a2('0x52'),'attributes':['id',_0x45a2('0x19'),_0x45a2('0x53'),_0x45a2('0x54'),_0x45a2('0x55')],'raw':!![]}]})[_0x45a2('0x14')](function(_0x133256){if(_0x133256){var _0x58caa2=_['flatMap'](_0x133256,function(_0x49611f){var _0x553e9c=_0x49611f[_0x45a2('0x16')]({'plain':!![]});return _0x553e9c[_0x45a2('0x52')];});return db[_0x45a2('0x1d')][_0x45a2('0x31')]({'where':{'id':_0x2f160c[_0x45a2('0x28')]['id']}})[_0x45a2('0x14')](function(_0x2b1896){return db[_0x45a2('0x56')][_0x45a2('0x57')](function(_0x23eee0){return _0x2b1896['addTeams'](_0x472f13,{'transaction':_0x23eee0})[_0x45a2('0x14')](function(){return BPromise[_0x45a2('0x58')](_0x58caa2,function(_0x2649ca){return db[_0x45a2('0x3d')][_0x45a2('0x59')]({'where':{'UserId':_0x2649ca['id'],'OpenchannelQueueId':_0x2f160c[_0x45a2('0x28')]['id']},'transaction':_0x23eee0});});})[_0x45a2('0x14')](function(){_0x58caa2[_0x45a2('0x5a')](function(_0x10c1e0){socket[_0x45a2('0x5b')]('userOpenchannelQueue:save',{'UserId':_0x10c1e0['id'],'OpenchannelQueueId':_0x2b1896['id']});});});});});}})[_0x45a2('0x14')](respondWithStatusCode(_0xf68c46,null))['catch'](handleError(_0xf68c46,null));};exports[_0x45a2('0x5c')]=function(_0x51a9b3,_0x333677){return db[_0x45a2('0x4e')]['findAll']({'where':{'id':_0x51a9b3['query'][_0x45a2('0x51')]},'attributes':['id'],'include':[{'model':db[_0x45a2('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x45a2('0x14')](handleEntityNotFound(_0x333677,null))[_0x45a2('0x14')](function(_0x35f74a){var _0x34379b=_['map'](_0x35f74a,'id');var _0x387d7f=[];var _0x4558d6=[];var _0x36bc35=squel[_0x45a2('0x5d')]();_0x36bc35[_0x45a2('0x5e')](_0x45a2('0x5f'))[_0x45a2('0x60')](_0x45a2('0x61'),'tq')[_0x45a2('0x62')]('user_has_teams','ut',_0x45a2('0x63'))[_0x45a2('0x21')](_0x45a2('0x64'),_0x51a9b3[_0x45a2('0x28')]['id']);for(var _0x46d6a4=0x0;_0x46d6a4<_0x35f74a[_0x45a2('0x2e')];_0x46d6a4+=0x1){let _0x159f6a=_0x35f74a[_0x46d6a4];for(var _0x3b8eb7=0x0;_0x3b8eb7<_0x159f6a[_0x45a2('0x52')][_0x45a2('0x2e')];_0x3b8eb7+=0x1){let _0x52c56b=_0x159f6a['Agents'][_0x3b8eb7];var _0x34bbf2=_0x36bc35[_0x45a2('0x65')]();_0x34bbf2['where'](_0x45a2('0x66'),_0x52c56b['id']);_0x4558d6['push'](db[_0x45a2('0x56')][_0x45a2('0x24')](_0x34bbf2[_0x45a2('0x67')](),{'type':db['sequelize'][_0x45a2('0x68')][_0x45a2('0x69')]})[_0x45a2('0x14')](function(_0x23aeb2){if(_0x23aeb2[_0x45a2('0x2e')]===0x1){return _0x52c56b['id'];}else{var _0x21aebe=_['every'](_[_0x45a2('0x1c')](_0x23aeb2,_0x45a2('0x6a')),function(_0x37fb1a){return _[_0x45a2('0x6b')](_0x34379b,_0x37fb1a);});if(_0x21aebe){return _0x52c56b['id'];}}}));}}return BPromise[_0x45a2('0x6c')](_0x4558d6)[_0x45a2('0x14')](function(_0x54adcf){_0x387d7f=_(_0x387d7f)[_0x45a2('0x6d')](_0x54adcf)[_0x45a2('0x6e')]()['value']();return db[_0x45a2('0x1d')]['find']({'where':{'id':_0x51a9b3[_0x45a2('0x28')]['id']}})[_0x45a2('0x14')](function(_0x332226){return db['sequelize'][_0x45a2('0x57')](function(_0x28e515){return _0x332226[_0x45a2('0x5c')](_0x51a9b3[_0x45a2('0x24')][_0x45a2('0x51')],{'transaction':_0x28e515})[_0x45a2('0x14')](function(){if(!_['isEmpty'](_0x387d7f)){return _0x332226[_0x45a2('0x6f')](_0x387d7f,{'transaction':_0x28e515});}})[_0x45a2('0x14')](function(){_0x387d7f[_0x45a2('0x5a')](function(_0x1f47cd){socket[_0x45a2('0x5b')](_0x45a2('0x70'),{'UserId':_0x1f47cd,'OpenchannelQueueId':_0x332226['id']});});});});});});})[_0x45a2('0x14')](respondWithStatusCode(_0x333677,null))[_0x45a2('0x27')](handleError(_0x333677,null));};exports[_0x45a2('0x71')]=function(_0x50cc65,_0x582ac8){return db[_0x45a2('0x1d')][_0x45a2('0x31')]({'where':{'id':_0x50cc65[_0x45a2('0x28')]['id']}})['then'](handleEntityNotFound(_0x582ac8,null))[_0x45a2('0x14')](function(_0x1d1422){if(_0x1d1422){return _0x1d1422['addAgents'](_0x50cc65[_0x45a2('0x33')]['ids'],_[_0x45a2('0x72')](_0x50cc65[_0x45a2('0x33')],['ids','id'])||{})[_0x45a2('0x73')](function(_0x304e8f){for(var _0x11ac9f=0x0;_0x11ac9f<_0x50cc65[_0x45a2('0x33')][_0x45a2('0x51')][_0x45a2('0x2e')];_0x11ac9f+=0x1){socket[_0x45a2('0x5b')]('userOpenchannelQueue:save',{'UserId':Number(_0x50cc65[_0x45a2('0x33')][_0x45a2('0x51')][_0x11ac9f]),'OpenchannelQueueId':Number(_0x50cc65[_0x45a2('0x28')]['id'])});}return _0x304e8f;});}})['then'](respondWithResult(_0x582ac8,null))['catch'](handleError(_0x582ac8,null));};exports[_0x45a2('0x6f')]=function(_0x50c0ca,_0x20e0de){return db[_0x45a2('0x1d')]['find']({'where':{'id':_0x50c0ca['params']['id']}})[_0x45a2('0x14')](handleEntityNotFound(_0x20e0de,null))[_0x45a2('0x14')](function(_0x20d0da){if(_0x20d0da){return _0x20d0da[_0x45a2('0x6f')](_0x50c0ca[_0x45a2('0x24')]['ids'])[_0x45a2('0x14')](function(){if(_[_0x45a2('0x74')](_0x50c0ca[_0x45a2('0x24')]['ids'])){for(var _0x5d1a84=0x0;_0x5d1a84<_0x50c0ca['query'][_0x45a2('0x51')][_0x45a2('0x2e')];_0x5d1a84+=0x1){socket[_0x45a2('0x5b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x50c0ca[_0x45a2('0x24')][_0x45a2('0x51')][_0x5d1a84]),'OpenchannelQueueId':Number(_0x50c0ca['params']['id'])});}}else{socket['emit'](_0x45a2('0x70'),{'UserId':Number(_0x50c0ca[_0x45a2('0x24')][_0x45a2('0x51')]),'OpenchannelQueueId':Number(_0x50c0ca[_0x45a2('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x20e0de,null))['catch'](handleError(_0x20e0de,null));};exports[_0x45a2('0x75')]=function(_0x1d0f61,_0xfb5ebe){var _0x4cb3d7={};var _0x515585={};var _0x264618;var _0x2fa631;return db['OpenchannelQueue'][_0x45a2('0x3c')]({'where':{'id':_0x1d0f61['params']['id']}})['then'](handleEntityNotFound(_0xfb5ebe,null))[_0x45a2('0x14')](function(_0x4085f5){if(_0x4085f5){_0x264618=_0x4085f5;_0x515585[_0x45a2('0x2a')]=_[_0x45a2('0x29')](db[_0x45a2('0x46')][_0x45a2('0x3e')]);_0x515585['query']=_[_0x45a2('0x29')](_0x1d0f61[_0x45a2('0x24')]);_0x515585['filters']=_['intersection'](_0x515585[_0x45a2('0x2a')],_0x515585[_0x45a2('0x24')]);_0x4cb3d7[_0x45a2('0x2b')]=_[_0x45a2('0x2c')](_0x515585[_0x45a2('0x2a')],qs[_0x45a2('0x2d')](_0x1d0f61['query'][_0x45a2('0x2d')]));_0x4cb3d7['attributes']=_0x4cb3d7['attributes'][_0x45a2('0x2e')]?_0x4cb3d7[_0x45a2('0x2b')]:_0x515585[_0x45a2('0x2a')];_0x4cb3d7[_0x45a2('0x4f')]=qs[_0x45a2('0x43')](_0x1d0f61[_0x45a2('0x24')]['sort']);_0x4cb3d7[_0x45a2('0x21')]=qs[_0x45a2('0x3f')](_['pick'](_0x1d0f61['query'],_0x515585[_0x45a2('0x3f')]));if(_0x1d0f61[_0x45a2('0x24')][_0x45a2('0x45')]){_0x4cb3d7[_0x45a2('0x21')]=_[_0x45a2('0x2f')](_0x4cb3d7[_0x45a2('0x21')],{'$or':_[_0x45a2('0x1c')](_0x4cb3d7[_0x45a2('0x2b')],function(_0xd4bfae){var _0x59858c={};_0x59858c[_0xd4bfae]={'$like':'%'+_0x1d0f61[_0x45a2('0x24')][_0x45a2('0x45')]+'%'};return _0x59858c;})});}_0x4cb3d7=_[_0x45a2('0x2f')]({},_0x4cb3d7,_0x1d0f61[_0x45a2('0x30')]);return _0x264618[_0x45a2('0x75')](_0x4cb3d7);}})[_0x45a2('0x14')](function(_0x94c5d6){if(_0x94c5d6){_0x2fa631=_0x94c5d6[_0x45a2('0x2e')];if(!_0x1d0f61['query'][_0x45a2('0x40')](_0x45a2('0x41'))){_0x4cb3d7['limit']=qs['limit'](_0x1d0f61[_0x45a2('0x24')][_0x45a2('0x42')]);_0x4cb3d7['offset']=qs[_0x45a2('0x10')](_0x1d0f61[_0x45a2('0x24')]['offset']);}return _0x264618[_0x45a2('0x75')](_0x4cb3d7);}})[_0x45a2('0x14')](function(_0x2dc73a){if(_0x2dc73a){return _0x2dc73a?{'count':_0x2fa631,'rows':_0x2dc73a}:null;}})['then'](respondWithResult(_0xfb5ebe,null))[_0x45a2('0x27')](handleError(_0xfb5ebe,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8083d3a..212bf26 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 _0x37d8=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0x37d8,0xc3));var _0x837d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x37d8[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x837d('0x0'));var OpenchannelQueue=require(_0x837d('0x1'))['db'][_0x837d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x837d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x837d('0x4'),'afterDestroy':_0x837d('0x5')};function emitEvent(_0x567d03){return function(_0x29dab1,_0x52de50,_0x4bc466){OpenchannelQueueEvents[_0x837d('0x6')](_0x567d03+':'+_0x29dab1['id'],_0x29dab1);OpenchannelQueueEvents[_0x837d('0x6')](_0x567d03,_0x29dab1);_0x4bc466(null);};}for(var e in events){if(events[_0x837d('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x837d('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1f0d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x56b578,_0xad0e2){var _0x435272=function(_0x204381){while(--_0x204381){_0x56b578['push'](_0x56b578['shift']());}};_0x435272(++_0xad0e2);}(_0x1f0d,0x102));var _0xd1f0=function(_0x3ab523,_0x355cc1){_0x3ab523=_0x3ab523-0x0;var _0x50a5a6=_0x1f0d[_0x3ab523];return _0x50a5a6;};'use strict';var EventEmitter=require(_0xd1f0('0x0'));var OpenchannelQueue=require(_0xd1f0('0x1'))['db'][_0xd1f0('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd1f0('0x3')](0x0);var events={'afterCreate':_0xd1f0('0x4'),'afterUpdate':_0xd1f0('0x5'),'afterDestroy':_0xd1f0('0x6')};function emitEvent(_0x308f7e){return function(_0xe57bbf,_0x1d33f4,_0x1afb5b){OpenchannelQueueEvents[_0xd1f0('0x7')](_0x308f7e+':'+_0xe57bbf['id'],_0xe57bbf);OpenchannelQueueEvents['emit'](_0x308f7e,_0xe57bbf);_0x1afb5b(null);};}for(var e in events){if(events[_0xd1f0('0x8')](e)){var event=events[e];OpenchannelQueue[_0xd1f0('0x9')](e,emitEvent(event));}}module[_0xd1f0('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 59ff558..3373b18 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 _0x9244=['lodash','moment','bluebird','request-promise','path','define','OpenchannelQueue','openchannel_queues'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0x9244,0x120));var _0x4924=function(_0x3fb05b,_0x473ea3){_0x3fb05b=_0x3fb05b-0x0;var _0x36c70b=_0x9244[_0x3fb05b];return _0x36c70b;};'use strict';var _=require(_0x4924('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4924('0x1'));var BPromise=require(_0x4924('0x2'));var rp=require(_0x4924('0x3'));var fs=require('fs');var path=require(_0x4924('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x1da79d,_0x39656a){return _0x1da79d[_0x4924('0x5')](_0x4924('0x6'),attributes,{'tableName':_0x4924('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4455=['api','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','lodash','../../config/logger'];(function(_0x2bdd9b,_0x3df1bc){var _0x103e81=function(_0x26184b){while(--_0x26184b){_0x2bdd9b['push'](_0x2bdd9b['shift']());}};_0x103e81(++_0x3df1bc);}(_0x4455,0xa8));var _0x5445=function(_0x27c6df,_0x4bbe0b){_0x27c6df=_0x27c6df-0x0;var _0xd065cf=_0x4455[_0x27c6df];return _0xd065cf;};'use strict';var _=require(_0x5445('0x0'));var util=require('util');var logger=require(_0x5445('0x1'))(_0x5445('0x2'));var moment=require('moment');var BPromise=require(_0x5445('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5445('0x4'));var rimraf=require(_0x5445('0x5'));var config=require(_0x5445('0x6'));var attributes=require(_0x5445('0x7'));module[_0x5445('0x8')]=function(_0x430f3e,_0x2bf51d){return _0x430f3e[_0x5445('0x9')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 953c027..da0b5c5 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 _0x0a49=['result','catch','OpenchannelQueue','findAll','options','raw','where','limit','model','include','map','attributes','debug','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x0a49,0xdc));var _0x90a4=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x0a49[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0x90a4('0x0'));var util=require(_0x90a4('0x1'));var moment=require(_0x90a4('0x2'));var BPromise=require(_0x90a4('0x3'));var rs=require(_0x90a4('0x4'));var fs=require('fs');var Redis=require(_0x90a4('0x5'));var db=require(_0x90a4('0x6'))['db'];var utils=require(_0x90a4('0x7'));var logger=require(_0x90a4('0x8'))(_0x90a4('0x9'));var config=require('../../config/environment');var jayson=require(_0x90a4('0xa'));var client=jayson['client'][_0x90a4('0xb')]({'port':0x232a});config['redis']=_[_0x90a4('0xc')](config[_0x90a4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x90a4('0xe'))(new Redis(config[_0x90a4('0xd')]));require(_0x90a4('0xf'))[_0x90a4('0x10')](socket);function respondWithRpcPromise(_0x2e82bd,_0x5cc93a,_0x2c9733){return new BPromise(function(_0x3c1316,_0x38af45){return client['request'](_0x2e82bd,_0x2c9733)[_0x90a4('0x11')](function(_0x1bcf6d){logger[_0x90a4('0x12')](_0x90a4('0x13'),_0x5cc93a,_0x90a4('0x14'));logger['debug'](_0x90a4('0x15'),_0x5cc93a,'request\x20sent',JSON[_0x90a4('0x16')](_0x1bcf6d));if(_0x1bcf6d[_0x90a4('0x17')]){if(_0x1bcf6d[_0x90a4('0x17')][_0x90a4('0x18')]===0x1f4){logger[_0x90a4('0x17')](_0x90a4('0x13'),_0x5cc93a,_0x1bcf6d['error'][_0x90a4('0x19')]);return _0x38af45(_0x1bcf6d[_0x90a4('0x17')][_0x90a4('0x19')]);}logger[_0x90a4('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x5cc93a,_0x1bcf6d['error'][_0x90a4('0x19')]);return _0x3c1316(_0x1bcf6d[_0x90a4('0x17')][_0x90a4('0x19')]);}else{logger[_0x90a4('0x12')](_0x90a4('0x13'),_0x5cc93a,_0x90a4('0x14'));_0x3c1316(_0x1bcf6d[_0x90a4('0x1a')][_0x90a4('0x19')]);}})[_0x90a4('0x1b')](function(_0x12f440){logger[_0x90a4('0x17')](_0x90a4('0x13'),_0x5cc93a,_0x12f440);_0x38af45(_0x12f440);});});}exports['GetOpenchannelQueue']=function(_0x24dde8){var _0x12ea7e=this;return new Promise(function(_0x3f3040,_0x237c1d){return db[_0x90a4('0x1c')][_0x90a4('0x1d')]({'raw':_0x24dde8[_0x90a4('0x1e')]?_0x24dde8['options'][_0x90a4('0x1f')]===undefined?!![]:![]:!![],'where':_0x24dde8[_0x90a4('0x1e')]?_0x24dde8[_0x90a4('0x1e')][_0x90a4('0x20')]||null:null,'attributes':_0x24dde8['options']?_0x24dde8[_0x90a4('0x1e')]['attributes']||null:null,'limit':_0x24dde8[_0x90a4('0x1e')]?_0x24dde8['options'][_0x90a4('0x21')]||null:null,'include':_0x24dde8['options']?_0x24dde8[_0x90a4('0x1e')]['include']?_['map'](_0x24dde8['options']['include'],function(_0x2a4f97){return{'model':db[_0x2a4f97[_0x90a4('0x22')]],'as':_0x2a4f97['as'],'attributes':_0x2a4f97['attributes'],'include':_0x2a4f97[_0x90a4('0x23')]?_[_0x90a4('0x24')](_0x2a4f97[_0x90a4('0x23')],function(_0x2f775f){return{'model':db[_0x2f775f['model']],'as':_0x2f775f['as'],'attributes':_0x2f775f[_0x90a4('0x25')],'include':_0x2f775f['include']?_['map'](_0x2f775f[_0x90a4('0x23')],function(_0x2f0aa9){return{'model':db[_0x2f0aa9[_0x90a4('0x22')]],'as':_0x2f0aa9['as'],'attributes':_0x2f0aa9[_0x90a4('0x25')]};}):[]};}):[]};}):[]:[]})[_0x90a4('0x11')](function(_0x521121){logger[_0x90a4('0x12')]('GetOpenchannelQueue',_0x24dde8);logger[_0x90a4('0x26')]('GetOpenchannelQueue',_0x24dde8,JSON[_0x90a4('0x16')](_0x521121));_0x3f3040(_0x521121);})['catch'](function(_0x4abd68){logger[_0x90a4('0x17')]('GetOpenchannelQueue',_0x4abd68[_0x90a4('0x19')],_0x24dde8);_0x237c1d(_0x12ea7e[_0x90a4('0x17')](0x1f4,_0x4abd68['message']));});});};exports[_0x90a4('0x27')]=function(_0x1f6bfd){var _0x407293=this;return new Promise(function(_0x365ced,_0x456f8c){return db[_0x90a4('0x1c')][_0x90a4('0x28')]({'raw':_0x1f6bfd['options']?_0x1f6bfd[_0x90a4('0x1e')][_0x90a4('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f6bfd[_0x90a4('0x1e')]?_0x1f6bfd['options'][_0x90a4('0x20')]||null:null,'attributes':_0x1f6bfd[_0x90a4('0x1e')]?_0x1f6bfd[_0x90a4('0x1e')][_0x90a4('0x25')]||null:null,'include':_0x1f6bfd['options']?_0x1f6bfd[_0x90a4('0x1e')][_0x90a4('0x23')]?_['map'](_0x1f6bfd[_0x90a4('0x1e')]['include'],function(_0x230c5b){return{'model':db[_0x230c5b[_0x90a4('0x22')]],'as':_0x230c5b['as'],'attributes':_0x230c5b['attributes'],'include':_0x230c5b[_0x90a4('0x23')]?_[_0x90a4('0x24')](_0x230c5b['include'],function(_0x1e0958){return{'model':db[_0x1e0958[_0x90a4('0x22')]],'as':_0x1e0958['as'],'attributes':_0x1e0958[_0x90a4('0x25')],'include':_0x1e0958[_0x90a4('0x23')]?_[_0x90a4('0x24')](_0x1e0958[_0x90a4('0x23')],function(_0x89284c){return{'model':db[_0x89284c['model']],'as':_0x89284c['as'],'attributes':_0x89284c[_0x90a4('0x25')]};}):[]};}):[]};}):[]:[]})[_0x90a4('0x11')](function(_0x3f7850){logger[_0x90a4('0x12')]('ShowOpenchannelQueue',_0x1f6bfd);logger[_0x90a4('0x26')](_0x90a4('0x27'),_0x1f6bfd,JSON[_0x90a4('0x16')](_0x3f7850));_0x365ced(_0x3f7850);})[_0x90a4('0x1b')](function(_0x47e226){logger['error']('ShowOpenchannelQueue',_0x47e226[_0x90a4('0x19')],_0x1f6bfd);_0x456f8c(_0x407293[_0x90a4('0x17')](0x1f4,_0x47e226['message']));});});}; \ No newline at end of file +var _0x3553=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','catch','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash'];(function(_0x4fb993,_0x4fd8ef){var _0x348c09=function(_0x38c9da){while(--_0x38c9da){_0x4fb993['push'](_0x4fb993['shift']());}};_0x348c09(++_0x4fd8ef);}(_0x3553,0x1b7));var _0x3355=function(_0x3070ff,_0x32679a){_0x3070ff=_0x3070ff-0x0;var _0x5de313=_0x3553[_0x3070ff];return _0x5de313;};'use strict';var _=require(_0x3355('0x0'));var util=require('util');var moment=require(_0x3355('0x1'));var BPromise=require('bluebird');var rs=require(_0x3355('0x2'));var fs=require('fs');var Redis=require(_0x3355('0x3'));var db=require(_0x3355('0x4'))['db'];var utils=require(_0x3355('0x5'));var logger=require(_0x3355('0x6'))(_0x3355('0x7'));var config=require('../../config/environment');var jayson=require(_0x3355('0x8'));var client=jayson[_0x3355('0x9')][_0x3355('0xa')]({'port':0x232a});config['redis']=_[_0x3355('0xb')](config[_0x3355('0xc')],{'host':_0x3355('0xd'),'port':0x18eb});var socket=require(_0x3355('0xe'))(new Redis(config[_0x3355('0xc')]));require('./openchannelQueue.socket')[_0x3355('0xf')](socket);function respondWithRpcPromise(_0xb4eed,_0x1cf1eb,_0x2dc6ed){return new BPromise(function(_0x40d43d,_0x52ccfb){return client[_0x3355('0x10')](_0xb4eed,_0x2dc6ed)[_0x3355('0x11')](function(_0x4bca28){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x1cf1eb,_0x3355('0x12'));logger[_0x3355('0x13')](_0x3355('0x14'),_0x1cf1eb,_0x3355('0x12'),JSON[_0x3355('0x15')](_0x4bca28));if(_0x4bca28[_0x3355('0x16')]){if(_0x4bca28[_0x3355('0x16')][_0x3355('0x17')]===0x1f4){logger['error'](_0x3355('0x18'),_0x1cf1eb,_0x4bca28[_0x3355('0x16')][_0x3355('0x19')]);return _0x52ccfb(_0x4bca28[_0x3355('0x16')][_0x3355('0x19')]);}logger['error'](_0x3355('0x18'),_0x1cf1eb,_0x4bca28[_0x3355('0x16')]['message']);return _0x40d43d(_0x4bca28['error'][_0x3355('0x19')]);}else{logger[_0x3355('0x1a')](_0x3355('0x18'),_0x1cf1eb,_0x3355('0x12'));_0x40d43d(_0x4bca28['result'][_0x3355('0x19')]);}})[_0x3355('0x1b')](function(_0x5d0964){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x1cf1eb,_0x5d0964);_0x52ccfb(_0x5d0964);});});}exports['GetOpenchannelQueue']=function(_0x30fe55){var _0x10028c=this;return new Promise(function(_0x16fee7,_0xd96bc9){return db[_0x3355('0x1c')]['findAll']({'raw':_0x30fe55[_0x3355('0x1d')]?_0x30fe55['options'][_0x3355('0x1e')]===undefined?!![]:![]:!![],'where':_0x30fe55[_0x3355('0x1d')]?_0x30fe55[_0x3355('0x1d')][_0x3355('0x1f')]||null:null,'attributes':_0x30fe55[_0x3355('0x1d')]?_0x30fe55[_0x3355('0x1d')]['attributes']||null:null,'limit':_0x30fe55[_0x3355('0x1d')]?_0x30fe55[_0x3355('0x1d')][_0x3355('0x20')]||null:null,'include':_0x30fe55[_0x3355('0x1d')]?_0x30fe55['options'][_0x3355('0x21')]?_[_0x3355('0x22')](_0x30fe55[_0x3355('0x1d')][_0x3355('0x21')],function(_0x335705){return{'model':db[_0x335705[_0x3355('0x23')]],'as':_0x335705['as'],'attributes':_0x335705[_0x3355('0x24')],'include':_0x335705[_0x3355('0x21')]?_[_0x3355('0x22')](_0x335705[_0x3355('0x21')],function(_0x4c4207){return{'model':db[_0x4c4207[_0x3355('0x23')]],'as':_0x4c4207['as'],'attributes':_0x4c4207['attributes'],'include':_0x4c4207[_0x3355('0x21')]?_[_0x3355('0x22')](_0x4c4207[_0x3355('0x21')],function(_0x3734e3){return{'model':db[_0x3734e3[_0x3355('0x23')]],'as':_0x3734e3['as'],'attributes':_0x3734e3[_0x3355('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3355('0x11')](function(_0x4a095f){logger['info'](_0x3355('0x25'),_0x30fe55);logger[_0x3355('0x13')]('GetOpenchannelQueue',_0x30fe55,JSON[_0x3355('0x15')](_0x4a095f));_0x16fee7(_0x4a095f);})['catch'](function(_0x5eb68e){logger[_0x3355('0x16')](_0x3355('0x25'),_0x5eb68e[_0x3355('0x19')],_0x30fe55);_0xd96bc9(_0x10028c[_0x3355('0x16')](0x1f4,_0x5eb68e['message']));});});};exports[_0x3355('0x26')]=function(_0x554aa6){var _0x382c95=this;return new Promise(function(_0x67584f,_0x4e2dcc){return db[_0x3355('0x1c')][_0x3355('0x27')]({'raw':_0x554aa6[_0x3355('0x1d')]?_0x554aa6['options'][_0x3355('0x1e')]===undefined?!![]:![]:!![],'where':_0x554aa6[_0x3355('0x1d')]?_0x554aa6[_0x3355('0x1d')]['where']||null:null,'attributes':_0x554aa6[_0x3355('0x1d')]?_0x554aa6['options'][_0x3355('0x24')]||null:null,'include':_0x554aa6[_0x3355('0x1d')]?_0x554aa6['options'][_0x3355('0x21')]?_[_0x3355('0x22')](_0x554aa6['options'][_0x3355('0x21')],function(_0x34f2f3){return{'model':db[_0x34f2f3[_0x3355('0x23')]],'as':_0x34f2f3['as'],'attributes':_0x34f2f3[_0x3355('0x24')],'include':_0x34f2f3[_0x3355('0x21')]?_['map'](_0x34f2f3[_0x3355('0x21')],function(_0x4cd399){return{'model':db[_0x4cd399[_0x3355('0x23')]],'as':_0x4cd399['as'],'attributes':_0x4cd399['attributes'],'include':_0x4cd399[_0x3355('0x21')]?_['map'](_0x4cd399['include'],function(_0x529ad8){return{'model':db[_0x529ad8[_0x3355('0x23')]],'as':_0x529ad8['as'],'attributes':_0x529ad8[_0x3355('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xccfeee){logger[_0x3355('0x1a')](_0x3355('0x26'),_0x554aa6);logger[_0x3355('0x13')](_0x3355('0x26'),_0x554aa6,JSON[_0x3355('0x15')](_0xccfeee));_0x67584f(_0xccfeee);})['catch'](function(_0x4692d1){logger[_0x3355('0x16')](_0x3355('0x26'),_0x4692d1['message'],_0x554aa6);_0x4e2dcc(_0x382c95[_0x3355('0x16')](0x1f4,_0x4692d1[_0x3355('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9f3f907..54e4473 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 _0x4d6a=['removeListener','register','length','openchannelQueue:','update','emit'];(function(_0x4e14be,_0x582681){var _0x411d69=function(_0x7efaf){while(--_0x7efaf){_0x4e14be['push'](_0x4e14be['shift']());}};_0x411d69(++_0x582681);}(_0x4d6a,0xe8));var _0xa4d6=function(_0x565afe,_0x3834a2){_0x565afe=_0x565afe-0x0;var _0x59d87a=_0x4d6a[_0x565afe];return _0x59d87a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0xa4d6('0x0')];function createListener(_0x5dbdc5,_0x1f6364){return function(_0x214083){_0x1f6364[_0xa4d6('0x1')](_0x5dbdc5,_0x214083);};}function removeListener(_0x39ebf2,_0x59dab4){return function(){OpenchannelQueueEvents[_0xa4d6('0x2')](_0x39ebf2,_0x59dab4);};}exports[_0xa4d6('0x3')]=function(_0x14a6f6){for(var _0x2c660b=0x0,_0x2275e0=events[_0xa4d6('0x4')];_0x2c660b<_0x2275e0;_0x2c660b++){var _0x3427e5=events[_0x2c660b];var _0x4d0159=createListener(_0xa4d6('0x5')+_0x3427e5,_0x14a6f6);OpenchannelQueueEvents['on'](_0x3427e5,_0x4d0159);}}; \ No newline at end of file +var _0x8eb0=['remove','update','emit','register','length','save'];(function(_0x37c410,_0x5b072f){var _0x926c00=function(_0x584f5a){while(--_0x584f5a){_0x37c410['push'](_0x37c410['shift']());}};_0x926c00(++_0x5b072f);}(_0x8eb0,0x1a3));var _0x08eb=function(_0x12f4bf,_0x47cc68){_0x12f4bf=_0x12f4bf-0x0;var _0x3f3692=_0x8eb0[_0x12f4bf];return _0x3f3692;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x08eb('0x0'),_0x08eb('0x1'),_0x08eb('0x2')];function createListener(_0x47f081,_0x4162cd){return function(_0x35e41a){_0x4162cd[_0x08eb('0x3')](_0x47f081,_0x35e41a);};}function removeListener(_0x567fa5,_0x46d708){return function(){OpenchannelQueueEvents['removeListener'](_0x567fa5,_0x46d708);};}exports[_0x08eb('0x4')]=function(_0x3942b0){for(var _0x204bfd=0x0,_0xd43cd2=events[_0x08eb('0x5')];_0x204bfd<_0xd43cd2;_0x204bfd++){var _0x3e5b46=events[_0x204bfd];var _0x1ace2b=createListener('openchannelQueue:'+_0x3e5b46,_0x3942b0);OpenchannelQueueEvents['on'](_0x3e5b46,_0x1ace2b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 884d7a7..de240da 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 _0x7c66=['/describe','/:id','show','put','update','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x16fb9f,_0x3b110d){var _0x5adb35=function(_0x3832d9){while(--_0x3832d9){_0x16fb9f['push'](_0x16fb9f['shift']());}};_0x5adb35(++_0x3b110d);}(_0x7c66,0x197));var _0x67c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7c66[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x67c6('0x0'));var path=require(_0x67c6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x67c6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x67c6('0x3'));var config=require(_0x67c6('0x4'));var controller=require(_0x67c6('0x5'));router[_0x67c6('0x6')]('/',auth[_0x67c6('0x7')](),controller[_0x67c6('0x8')]);router[_0x67c6('0x6')](_0x67c6('0x9'),auth[_0x67c6('0x7')](),controller['describe']);router[_0x67c6('0x6')](_0x67c6('0xa'),auth[_0x67c6('0x7')](),controller[_0x67c6('0xb')]);router['post']('/',auth[_0x67c6('0x7')](),controller['create']);router[_0x67c6('0xc')]('/:id',auth[_0x67c6('0x7')](),controller[_0x67c6('0xd')]);router[_0x67c6('0xe')](_0x67c6('0xa'),auth[_0x67c6('0x7')](),controller['destroy']);module[_0x67c6('0xf')]=router; \ No newline at end of file +var _0x66a1=['put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','/describe','get','/:id','show','post'];(function(_0x5b6cd3,_0x2fcf1b){var _0x34f3a6=function(_0x59f523){while(--_0x59f523){_0x5b6cd3['push'](_0x5b6cd3['shift']());}};_0x34f3a6(++_0x2fcf1b);}(_0x66a1,0xc2));var _0x166a=function(_0x39d33d,_0x38eeb4){_0x39d33d=_0x39d33d-0x0;var _0x397fd9=_0x66a1[_0x39d33d];return _0x397fd9;};'use strict';var multer=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var path=require(_0x166a('0x2'));var timeout=require(_0x166a('0x3'));var express=require(_0x166a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x166a('0x5'));var interaction=require(_0x166a('0x6'));var config=require(_0x166a('0x7'));var controller=require(_0x166a('0x8'));router['get']('/',auth[_0x166a('0x9')](),controller['index']);router['get'](_0x166a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x166a('0xb')](_0x166a('0xc'),auth[_0x166a('0x9')](),controller[_0x166a('0xd')]);router[_0x166a('0xe')]('/',auth[_0x166a('0x9')](),controller['create']);router[_0x166a('0xf')]('/:id',auth[_0x166a('0x9')](),controller[_0x166a('0x10')]);router['delete'](_0x166a('0xc'),auth[_0x166a('0x9')](),controller[_0x166a('0x11')]);module[_0x166a('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 955a3a4..98252e3 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 _0xf692=['DATE','sequelize','exports','STRING'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xf692,0x105));var _0x2f69=function(_0x4ae676,_0x1f3d19){_0x4ae676=_0x4ae676-0x0;var _0x2d9a1f=_0xf692[_0x4ae676];return _0x2d9a1f;};'use strict';var moment=require('moment');var Sequelize=require(_0x2f69('0x0'));module[_0x2f69('0x1')]={'uniqueid':{'type':Sequelize[_0x2f69('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2f69('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2f69('0x3')]},'exitAt':{'type':Sequelize[_0x2f69('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3199=['sequelize','exports','STRING','DATE','moment'];(function(_0x403a83,_0x218ba0){var _0xf0fd56=function(_0x3be410){while(--_0x3be410){_0x403a83['push'](_0x403a83['shift']());}};_0xf0fd56(++_0x218ba0);}(_0x3199,0x1bc));var _0x9319=function(_0x3f1230,_0x5a2050){_0x3f1230=_0x3f1230-0x0;var _0x9238e2=_0x3199[_0x3f1230];return _0x9238e2;};'use strict';var moment=require(_0x9319('0x0'));var Sequelize=require(_0x9319('0x1'));module[_0x9319('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9319('0x3')]},'joinAt':{'type':Sequelize[_0x9319('0x4')]},'leaveAt':{'type':Sequelize[_0x9319('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9319('0x4')]},'reason':{'type':Sequelize[_0x9319('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index bf2fd95..3b1cc34 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 _0xda38=['fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','status','set','Content-Range','reject','save','destroy','then','end','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','show','find','catch','create','body','update','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x127a0d,_0x2e020d){var _0x3fe7d5=function(_0x3bd7e5){while(--_0x3bd7e5){_0x127a0d['push'](_0x127a0d['shift']());}};_0x3fe7d5(++_0x2e020d);}(_0xda38,0x11e));var _0x8da3=function(_0x41b62a,_0x13d23e){_0x41b62a=_0x41b62a-0x0;var _0x429f38=_0xda38[_0x41b62a];return _0x429f38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8da3('0x0'));var zipdir=require(_0x8da3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8da3('0x2'));var moment=require(_0x8da3('0x3'));var BPromise=require(_0x8da3('0x4'));var Mustache=require('mustache');var util=require(_0x8da3('0x5'));var path=require(_0x8da3('0x6'));var sox=require(_0x8da3('0x7'));var csv=require(_0x8da3('0x8'));var ejs=require(_0x8da3('0x9'));var fs=require('fs');var fs_extra=require(_0x8da3('0xa'));var _=require(_0x8da3('0xb'));var squel=require(_0x8da3('0xc'));var crypto=require(_0x8da3('0xd'));var jsforce=require(_0x8da3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8da3('0x8'));var querystring=require(_0x8da3('0xf'));var Papa=require('papaparse');var Redis=require(_0x8da3('0x10'));var authService=require(_0x8da3('0x11'));var qs=require(_0x8da3('0x12'));var as=require(_0x8da3('0x13'));var hardwareService=require(_0x8da3('0x14'));var logger=require('../../config/logger')(_0x8da3('0x15'));var utils=require(_0x8da3('0x16'));var config=require(_0x8da3('0x17'));var licenseUtil=require(_0x8da3('0x18'));var db=require(_0x8da3('0x19'))['db'];function respondWithStatusCode(_0x3149d4,_0x1ffce2){_0x1ffce2=_0x1ffce2||0xcc;return function(_0x45aa4e){if(_0x45aa4e){return _0x3149d4[_0x8da3('0x1a')](_0x1ffce2);}return _0x3149d4['status'](_0x1ffce2)['end']();};}function respondWithResult(_0x1c24a8,_0x118069){_0x118069=_0x118069||0xc8;return function(_0x2fa8ad){if(_0x2fa8ad){return _0x1c24a8['status'](_0x118069)['json'](_0x2fa8ad);}};}function respondWithFilteredResult(_0x40d984,_0x419780){return function(_0x2fc447){if(_0x2fc447){var _0x147532=typeof _0x419780[_0x8da3('0x1b')]===_0x8da3('0x1c')&&typeof _0x419780['limit']===_0x8da3('0x1c');var _0x35641f=_0x2fc447[_0x8da3('0x1d')];var _0x3f859b=_0x147532?0x0:_0x419780[_0x8da3('0x1b')];var _0x30c5ca=_0x147532?_0x2fc447[_0x8da3('0x1d')]:_0x419780[_0x8da3('0x1b')]+_0x419780['limit'];var _0x198c4b;if(_0x30c5ca>=_0x35641f){_0x30c5ca=_0x35641f;_0x198c4b=0xc8;}else{_0x198c4b=0xce;}_0x40d984[_0x8da3('0x1e')](_0x198c4b);return _0x40d984[_0x8da3('0x1f')](_0x8da3('0x20'),_0x3f859b+'-'+_0x30c5ca+'/'+_0x35641f)['json'](_0x2fc447);}return null;};}function patchUpdates(_0x5cefed){return function(_0x241b8){try{jsonpatch['apply'](_0x241b8,_0x5cefed,!![]);}catch(_0x2fed4e){return BPromise[_0x8da3('0x21')](_0x2fed4e);}return _0x241b8[_0x8da3('0x22')]();};}function saveUpdates(_0x2bbd9f,_0x123e50){return function(_0x1298ae){if(_0x1298ae){return _0x1298ae['update'](_0x2bbd9f)['then'](function(_0x271642){return _0x271642;});}return null;};}function removeEntity(_0x435dd1,_0x16a339){return function(_0x21b20b){if(_0x21b20b){return _0x21b20b[_0x8da3('0x23')]()[_0x8da3('0x24')](function(){_0x435dd1[_0x8da3('0x1e')](0xcc)[_0x8da3('0x25')]();});}};}function handleEntityNotFound(_0x3103fc,_0x2baf5a){return function(_0x37b96a){if(!_0x37b96a){_0x3103fc[_0x8da3('0x1a')](0x194);}return _0x37b96a;};}function handleError(_0x4f3235,_0x3c4b90){_0x3c4b90=_0x3c4b90||0x1f4;return function(_0x2f3fd6){logger[_0x8da3('0x26')](_0x2f3fd6[_0x8da3('0x27')]);if(_0x2f3fd6['name']){delete _0x2f3fd6[_0x8da3('0x28')];}_0x4f3235[_0x8da3('0x1e')](_0x3c4b90)['send'](_0x2f3fd6);};}exports['index']=function(_0x2b1d25,_0x2d8082){var _0x49207f={},_0x25307c={},_0x90d76={'count':0x0,'rows':[]};var _0x362246=_[_0x8da3('0x29')](db[_0x8da3('0x2a')][_0x8da3('0x2b')],function(_0x21c631){return{'name':_0x21c631[_0x8da3('0x2c')],'type':_0x21c631[_0x8da3('0x2d')][_0x8da3('0x2e')]};});_0x25307c[_0x8da3('0x2f')]=_[_0x8da3('0x29')](_0x362246,_0x8da3('0x28'));_0x25307c[_0x8da3('0x30')]=_[_0x8da3('0x31')](_0x2b1d25[_0x8da3('0x30')]);_0x25307c['filters']=_[_0x8da3('0x32')](_0x25307c['model'],_0x25307c[_0x8da3('0x30')]);_0x49207f[_0x8da3('0x33')]=_['intersection'](_0x25307c['model'],qs[_0x8da3('0x34')](_0x2b1d25[_0x8da3('0x30')][_0x8da3('0x34')]));_0x49207f['attributes']=_0x49207f[_0x8da3('0x33')][_0x8da3('0x35')]?_0x49207f[_0x8da3('0x33')]:_0x25307c[_0x8da3('0x2f')];if(!_0x2b1d25[_0x8da3('0x30')]['hasOwnProperty'](_0x8da3('0x36'))){_0x49207f[_0x8da3('0x37')]=qs[_0x8da3('0x37')](_0x2b1d25[_0x8da3('0x30')][_0x8da3('0x37')]);_0x49207f['offset']=qs[_0x8da3('0x1b')](_0x2b1d25[_0x8da3('0x30')][_0x8da3('0x1b')]);}_0x49207f[_0x8da3('0x38')]=qs['sort'](_0x2b1d25[_0x8da3('0x30')][_0x8da3('0x39')]);_0x49207f[_0x8da3('0x3a')]=qs[_0x8da3('0x3b')](_[_0x8da3('0x3c')](_0x2b1d25[_0x8da3('0x30')],_0x25307c[_0x8da3('0x3b')]),_0x362246);if(_0x2b1d25['query'][_0x8da3('0x3d')]){_0x49207f[_0x8da3('0x3a')]=_[_0x8da3('0x3e')](_0x49207f[_0x8da3('0x3a')],{'$or':_['map'](_0x362246,function(_0x2de0b9){if(_0x2de0b9[_0x8da3('0x2d')]!=='VIRTUAL'){var _0x3dc406={};_0x3dc406[_0x2de0b9[_0x8da3('0x28')]]={'$like':'%'+_0x2b1d25[_0x8da3('0x30')][_0x8da3('0x3d')]+'%'};return _0x3dc406;}})});}_0x49207f=_['merge']({},_0x49207f,_0x2b1d25['options']);var _0xeea811={'where':_0x49207f[_0x8da3('0x3a')]};return db['OpenchannelQueueReport'][_0x8da3('0x1d')](_0xeea811)[_0x8da3('0x24')](function(_0x4cffa5){_0x90d76['count']=_0x4cffa5;if(_0x2b1d25['query'][_0x8da3('0x3f')]){_0x49207f[_0x8da3('0x40')]=[{'all':!![]}];}return db[_0x8da3('0x2a')][_0x8da3('0x41')](_0x49207f);})['then'](function(_0x3f22ff){_0x90d76['rows']=_0x3f22ff;return _0x90d76;})[_0x8da3('0x24')](respondWithFilteredResult(_0x2d8082,_0x49207f))['catch'](handleError(_0x2d8082,null));};exports[_0x8da3('0x42')]=function(_0xe5ab9f,_0x4035ec){var _0x3b4610={'raw':!![],'where':{'id':_0xe5ab9f['params']['id']}},_0x3277f1={};_0x3277f1[_0x8da3('0x2f')]=_[_0x8da3('0x31')](db[_0x8da3('0x2a')]['rawAttributes']);_0x3277f1[_0x8da3('0x30')]=_[_0x8da3('0x31')](_0xe5ab9f[_0x8da3('0x30')]);_0x3277f1[_0x8da3('0x3b')]=_[_0x8da3('0x32')](_0x3277f1[_0x8da3('0x2f')],_0x3277f1[_0x8da3('0x30')]);_0x3b4610['attributes']=_[_0x8da3('0x32')](_0x3277f1[_0x8da3('0x2f')],qs[_0x8da3('0x34')](_0xe5ab9f[_0x8da3('0x30')][_0x8da3('0x34')]));_0x3b4610[_0x8da3('0x33')]=_0x3b4610[_0x8da3('0x33')]['length']?_0x3b4610[_0x8da3('0x33')]:_0x3277f1[_0x8da3('0x2f')];if(_0xe5ab9f[_0x8da3('0x30')][_0x8da3('0x3f')]){_0x3b4610[_0x8da3('0x40')]=[{'all':!![]}];}_0x3b4610=_[_0x8da3('0x3e')]({},_0x3b4610,_0xe5ab9f['options']);return db[_0x8da3('0x2a')][_0x8da3('0x43')](_0x3b4610)[_0x8da3('0x24')](handleEntityNotFound(_0x4035ec,null))['then'](respondWithResult(_0x4035ec,null))[_0x8da3('0x44')](handleError(_0x4035ec,null));};exports['create']=function(_0x5da740,_0x49859f){return db[_0x8da3('0x2a')][_0x8da3('0x45')](_0x5da740[_0x8da3('0x46')],{})[_0x8da3('0x24')](respondWithResult(_0x49859f,0xc9))[_0x8da3('0x44')](handleError(_0x49859f,null));};exports[_0x8da3('0x47')]=function(_0x43cebb,_0x30de4d){if(_0x43cebb['body']['id']){delete _0x43cebb[_0x8da3('0x46')]['id'];}return db[_0x8da3('0x2a')][_0x8da3('0x43')]({'where':{'id':_0x43cebb[_0x8da3('0x48')]['id']}})[_0x8da3('0x24')](handleEntityNotFound(_0x30de4d,null))['then'](saveUpdates(_0x43cebb['body'],null))[_0x8da3('0x24')](respondWithResult(_0x30de4d,null))['catch'](handleError(_0x30de4d,null));};exports['destroy']=function(_0x3397a6,_0x2376df){return db[_0x8da3('0x2a')]['find']({'where':{'id':_0x3397a6[_0x8da3('0x48')]['id']}})['then'](handleEntityNotFound(_0x2376df,null))[_0x8da3('0x24')](removeEntity(_0x2376df,null))[_0x8da3('0x44')](handleError(_0x2376df,null));};exports[_0x8da3('0x49')]=function(_0x501018,_0x3fd133){return db[_0x8da3('0x2a')][_0x8da3('0x49')]()[_0x8da3('0x24')](respondWithResult(_0x3fd133,null))['catch'](handleError(_0x3fd133,null));}; \ No newline at end of file +var _0xba07=['pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','destroy','describe','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0x1dba86,_0x22d58e){var _0x44886e=function(_0x3fd5f1){while(--_0x3fd5f1){_0x1dba86['push'](_0x1dba86['shift']());}};_0x44886e(++_0x22d58e);}(_0xba07,0x1e8));var _0x7ba0=function(_0x2c6559,_0x3a3d99){_0x2c6559=_0x2c6559-0x0;var _0x1a0f7e=_0xba07[_0x2c6559];return _0x1a0f7e;};'use strict';var emlformat=require(_0x7ba0('0x0'));var rimraf=require(_0x7ba0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ba0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7ba0('0x3'));var util=require(_0x7ba0('0x4'));var path=require(_0x7ba0('0x5'));var sox=require(_0x7ba0('0x6'));var csv=require(_0x7ba0('0x7'));var ejs=require(_0x7ba0('0x8'));var fs=require('fs');var fs_extra=require(_0x7ba0('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ba0('0xa'));var jsforce=require(_0x7ba0('0xb'));var deskjs=require(_0x7ba0('0xc'));var toCsv=require(_0x7ba0('0x7'));var querystring=require(_0x7ba0('0xd'));var Papa=require(_0x7ba0('0xe'));var Redis=require('ioredis');var authService=require(_0x7ba0('0xf'));var qs=require(_0x7ba0('0x10'));var as=require(_0x7ba0('0x11'));var hardwareService=require(_0x7ba0('0x12'));var logger=require(_0x7ba0('0x13'))(_0x7ba0('0x14'));var utils=require(_0x7ba0('0x15'));var config=require(_0x7ba0('0x16'));var licenseUtil=require(_0x7ba0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cfbf8,_0xe0e0f4){_0xe0e0f4=_0xe0e0f4||0xcc;return function(_0x12220e){if(_0x12220e){return _0x1cfbf8[_0x7ba0('0x18')](_0xe0e0f4);}return _0x1cfbf8[_0x7ba0('0x19')](_0xe0e0f4)[_0x7ba0('0x1a')]();};}function respondWithResult(_0x2b44f7,_0x38a6e8){_0x38a6e8=_0x38a6e8||0xc8;return function(_0x2f653c){if(_0x2f653c){return _0x2b44f7[_0x7ba0('0x19')](_0x38a6e8)[_0x7ba0('0x1b')](_0x2f653c);}};}function respondWithFilteredResult(_0xc07080,_0x94c8f1){return function(_0x1d156d){if(_0x1d156d){var _0x44f301=typeof _0x94c8f1[_0x7ba0('0x1c')]==='undefined'&&typeof _0x94c8f1[_0x7ba0('0x1d')]===_0x7ba0('0x1e');var _0x14998a=_0x1d156d[_0x7ba0('0x1f')];var _0x4b5b66=_0x44f301?0x0:_0x94c8f1['offset'];var _0x107c34=_0x44f301?_0x1d156d[_0x7ba0('0x1f')]:_0x94c8f1[_0x7ba0('0x1c')]+_0x94c8f1['limit'];var _0x5017f4;if(_0x107c34>=_0x14998a){_0x107c34=_0x14998a;_0x5017f4=0xc8;}else{_0x5017f4=0xce;}_0xc07080['status'](_0x5017f4);return _0xc07080[_0x7ba0('0x20')]('Content-Range',_0x4b5b66+'-'+_0x107c34+'/'+_0x14998a)[_0x7ba0('0x1b')](_0x1d156d);}return null;};}function patchUpdates(_0x311f98){return function(_0x46c5b7){try{jsonpatch[_0x7ba0('0x21')](_0x46c5b7,_0x311f98,!![]);}catch(_0x2e9caf){return BPromise[_0x7ba0('0x22')](_0x2e9caf);}return _0x46c5b7[_0x7ba0('0x23')]();};}function saveUpdates(_0x6cf393,_0x450402){return function(_0x2e9dbf){if(_0x2e9dbf){return _0x2e9dbf[_0x7ba0('0x24')](_0x6cf393)['then'](function(_0x33e79a){return _0x33e79a;});}return null;};}function removeEntity(_0x46a4c0,_0x27f49a){return function(_0x32b579){if(_0x32b579){return _0x32b579['destroy']()[_0x7ba0('0x25')](function(){_0x46a4c0[_0x7ba0('0x19')](0xcc)[_0x7ba0('0x1a')]();});}};}function handleEntityNotFound(_0x2eb627,_0x21977d){return function(_0x4a3be1){if(!_0x4a3be1){_0x2eb627[_0x7ba0('0x18')](0x194);}return _0x4a3be1;};}function handleError(_0x3a8257,_0x1f9337){_0x1f9337=_0x1f9337||0x1f4;return function(_0x1ba069){logger[_0x7ba0('0x26')](_0x1ba069[_0x7ba0('0x27')]);if(_0x1ba069['name']){delete _0x1ba069[_0x7ba0('0x28')];}_0x3a8257['status'](_0x1f9337)[_0x7ba0('0x29')](_0x1ba069);};}exports[_0x7ba0('0x2a')]=function(_0x2cdb7a,_0x534337){var _0x1c08f9={},_0x103f12={},_0x1f3adb={'count':0x0,'rows':[]};var _0x401d7b=_[_0x7ba0('0x2b')](db['OpenchannelQueueReport'][_0x7ba0('0x2c')],function(_0x13be27){return{'name':_0x13be27[_0x7ba0('0x2d')],'type':_0x13be27[_0x7ba0('0x2e')][_0x7ba0('0x2f')]};});_0x103f12[_0x7ba0('0x30')]=_[_0x7ba0('0x2b')](_0x401d7b,_0x7ba0('0x28'));_0x103f12[_0x7ba0('0x31')]=_['keys'](_0x2cdb7a[_0x7ba0('0x31')]);_0x103f12[_0x7ba0('0x32')]=_['intersection'](_0x103f12[_0x7ba0('0x30')],_0x103f12[_0x7ba0('0x31')]);_0x1c08f9['attributes']=_[_0x7ba0('0x33')](_0x103f12[_0x7ba0('0x30')],qs[_0x7ba0('0x34')](_0x2cdb7a[_0x7ba0('0x31')]['fields']));_0x1c08f9['attributes']=_0x1c08f9['attributes']['length']?_0x1c08f9[_0x7ba0('0x35')]:_0x103f12[_0x7ba0('0x30')];if(!_0x2cdb7a[_0x7ba0('0x31')][_0x7ba0('0x36')]('nolimit')){_0x1c08f9[_0x7ba0('0x1d')]=qs['limit'](_0x2cdb7a['query'][_0x7ba0('0x1d')]);_0x1c08f9[_0x7ba0('0x1c')]=qs[_0x7ba0('0x1c')](_0x2cdb7a[_0x7ba0('0x31')][_0x7ba0('0x1c')]);}_0x1c08f9[_0x7ba0('0x37')]=qs[_0x7ba0('0x38')](_0x2cdb7a['query'][_0x7ba0('0x38')]);_0x1c08f9[_0x7ba0('0x39')]=qs[_0x7ba0('0x32')](_[_0x7ba0('0x3a')](_0x2cdb7a['query'],_0x103f12[_0x7ba0('0x32')]),_0x401d7b);if(_0x2cdb7a['query'][_0x7ba0('0x3b')]){_0x1c08f9[_0x7ba0('0x39')]=_[_0x7ba0('0x3c')](_0x1c08f9[_0x7ba0('0x39')],{'$or':_['map'](_0x401d7b,function(_0x1860ec){if(_0x1860ec[_0x7ba0('0x2e')]!==_0x7ba0('0x3d')){var _0x2ea079={};_0x2ea079[_0x1860ec[_0x7ba0('0x28')]]={'$like':'%'+_0x2cdb7a['query'][_0x7ba0('0x3b')]+'%'};return _0x2ea079;}})});}_0x1c08f9=_['merge']({},_0x1c08f9,_0x2cdb7a[_0x7ba0('0x3e')]);var _0xc38f87={'where':_0x1c08f9[_0x7ba0('0x39')]};return db[_0x7ba0('0x3f')]['count'](_0xc38f87)['then'](function(_0xd2ec3b){_0x1f3adb[_0x7ba0('0x1f')]=_0xd2ec3b;if(_0x2cdb7a[_0x7ba0('0x31')][_0x7ba0('0x40')]){_0x1c08f9[_0x7ba0('0x41')]=[{'all':!![]}];}return db[_0x7ba0('0x3f')][_0x7ba0('0x42')](_0x1c08f9);})[_0x7ba0('0x25')](function(_0x421bb0){_0x1f3adb[_0x7ba0('0x43')]=_0x421bb0;return _0x1f3adb;})['then'](respondWithFilteredResult(_0x534337,_0x1c08f9))[_0x7ba0('0x44')](handleError(_0x534337,null));};exports[_0x7ba0('0x45')]=function(_0x1c55e2,_0x19a6ee){var _0x10e053={'raw':!![],'where':{'id':_0x1c55e2['params']['id']}},_0x848a61={};_0x848a61[_0x7ba0('0x30')]=_[_0x7ba0('0x46')](db[_0x7ba0('0x3f')]['rawAttributes']);_0x848a61[_0x7ba0('0x31')]=_[_0x7ba0('0x46')](_0x1c55e2[_0x7ba0('0x31')]);_0x848a61['filters']=_[_0x7ba0('0x33')](_0x848a61[_0x7ba0('0x30')],_0x848a61[_0x7ba0('0x31')]);_0x10e053[_0x7ba0('0x35')]=_[_0x7ba0('0x33')](_0x848a61['model'],qs[_0x7ba0('0x34')](_0x1c55e2[_0x7ba0('0x31')]['fields']));_0x10e053[_0x7ba0('0x35')]=_0x10e053[_0x7ba0('0x35')][_0x7ba0('0x47')]?_0x10e053[_0x7ba0('0x35')]:_0x848a61[_0x7ba0('0x30')];if(_0x1c55e2[_0x7ba0('0x31')][_0x7ba0('0x40')]){_0x10e053[_0x7ba0('0x41')]=[{'all':!![]}];}_0x10e053=_[_0x7ba0('0x3c')]({},_0x10e053,_0x1c55e2[_0x7ba0('0x3e')]);return db[_0x7ba0('0x3f')][_0x7ba0('0x48')](_0x10e053)[_0x7ba0('0x25')](handleEntityNotFound(_0x19a6ee,null))['then'](respondWithResult(_0x19a6ee,null))[_0x7ba0('0x44')](handleError(_0x19a6ee,null));};exports[_0x7ba0('0x49')]=function(_0x5b439,_0x36a528){return db['OpenchannelQueueReport']['create'](_0x5b439['body'],{})[_0x7ba0('0x25')](respondWithResult(_0x36a528,0xc9))[_0x7ba0('0x44')](handleError(_0x36a528,null));};exports[_0x7ba0('0x24')]=function(_0x163682,_0xb423fb){if(_0x163682[_0x7ba0('0x4a')]['id']){delete _0x163682[_0x7ba0('0x4a')]['id'];}return db[_0x7ba0('0x3f')]['find']({'where':{'id':_0x163682[_0x7ba0('0x4b')]['id']}})[_0x7ba0('0x25')](handleEntityNotFound(_0xb423fb,null))['then'](saveUpdates(_0x163682['body'],null))[_0x7ba0('0x25')](respondWithResult(_0xb423fb,null))[_0x7ba0('0x44')](handleError(_0xb423fb,null));};exports[_0x7ba0('0x4c')]=function(_0x4490a5,_0x45d93f){return db[_0x7ba0('0x3f')][_0x7ba0('0x48')]({'where':{'id':_0x4490a5['params']['id']}})[_0x7ba0('0x25')](handleEntityNotFound(_0x45d93f,null))[_0x7ba0('0x25')](removeEntity(_0x45d93f,null))[_0x7ba0('0x44')](handleError(_0x45d93f,null));};exports[_0x7ba0('0x4d')]=function(_0x2773f0,_0x24d020){return db['OpenchannelQueueReport'][_0x7ba0('0x4d')]()[_0x7ba0('0x25')](respondWithResult(_0x24d020,null))[_0x7ba0('0x44')](handleError(_0x24d020,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 69441ce..0c8821d 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x4331ec,_0x46b338){var _0x584582=function(_0x1dfb4a){while(--_0x1dfb4a){_0x4331ec['push'](_0x4331ec['shift']());}};_0x584582(++_0x46b338);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x5af41c,_0x13ca69){var _0x358160=function(_0x349238){while(--_0x349238){_0x5af41c['push'](_0x5af41c['shift']());}};_0x358160(++_0x13ca69);}(_0x1261,0x144));var _0x1126=function(_0x444f91,_0x2a61f2){_0x444f91=_0x444f91-0x0;var _0x3248ab=_0x1261[_0x444f91];return _0x3248ab;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 492a643..758fc57 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 _0x2884=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','attributes','limit','lodash','moment'];(function(_0x491dff,_0x4d4bc2){var _0x3c6c4b=function(_0x594c37){while(--_0x594c37){_0x491dff['push'](_0x491dff['shift']());}};_0x3c6c4b(++_0x4d4bc2);}(_0x2884,0x1eb));var _0x4288=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0x2884[_0x25d4e5];return _0x44d116;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526a07,_0x3a930e,_0x5e4cfc){return new BPromise(function(_0x25023a,_0x237b02){return client['request'](_0x526a07,_0x5e4cfc)[_0x4288('0x9')](function(_0x3c8d6e){logger[_0x4288('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a930e,'request\x20sent');logger[_0x4288('0xb')](_0x4288('0xc'),_0x3a930e,_0x4288('0xd'),JSON[_0x4288('0xe')](_0x3c8d6e));if(_0x3c8d6e[_0x4288('0xf')]){if(_0x3c8d6e[_0x4288('0xf')][_0x4288('0x10')]===0x1f4){logger['error'](_0x4288('0x11'),_0x3a930e,_0x3c8d6e[_0x4288('0xf')][_0x4288('0x12')]);return _0x237b02(_0x3c8d6e[_0x4288('0xf')]['message']);}logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x3c8d6e['error'][_0x4288('0x12')]);return _0x25023a(_0x3c8d6e['error'][_0x4288('0x12')]);}else{logger['info'](_0x4288('0x11'),_0x3a930e,_0x4288('0xd'));_0x25023a(_0x3c8d6e[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0x1db33b){logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x1db33b);_0x237b02(_0x1db33b);});});}exports[_0x4288('0x15')]=function(_0x53fb81){var _0x199919=this;return new Promise(function(_0xde03f4,_0x5e6de1){return db['OpenchannelQueueReport']['create'](_0x53fb81[_0x4288('0x16')],{'raw':_0x53fb81[_0x4288('0x17')]?_0x53fb81['options'][_0x4288('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x865365){logger[_0x4288('0xa')](_0x4288('0x15'),_0x53fb81);logger['debug'](_0x4288('0x15'),_0x53fb81,JSON[_0x4288('0xe')](_0x865365));_0xde03f4(_0x865365);})[_0x4288('0x14')](function(_0x4b9cda){logger['error'](_0x4288('0x15'),_0x4b9cda[_0x4288('0x12')],_0x53fb81);_0x5e6de1(_0x199919[_0x4288('0xf')](0x1f4,_0x4b9cda[_0x4288('0x12')]));});});};exports[_0x4288('0x19')]=function(_0x292e74){var _0x500c1e=this;return new Promise(function(_0x5f0c29,_0x1ff415){return db[_0x4288('0x1a')]['update'](_0x292e74[_0x4288('0x16')],{'raw':_0x292e74['options']?_0x292e74['options'][_0x4288('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')]['where']||null:null,'attributes':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')][_0x4288('0x1b')]||null:null,'limit':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')][_0x4288('0x1c')]||null:null})['then'](function(_0x3a8e3e){logger[_0x4288('0xa')](_0x4288('0x19'),_0x292e74);logger[_0x4288('0xb')](_0x4288('0x19'),_0x292e74,JSON[_0x4288('0xe')](_0x3a8e3e));_0x5f0c29(_0x3a8e3e);})[_0x4288('0x14')](function(_0x5bca41){logger[_0x4288('0xf')](_0x4288('0x19'),_0x5bca41[_0x4288('0x12')],_0x292e74);_0x1ff415(_0x500c1e[_0x4288('0xf')](0x1f4,_0x5bca41[_0x4288('0x12')]));});});}; \ No newline at end of file +var _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0xb79ed5,_0x289390){var _0x5e9fe8=function(_0x43e14c){while(--_0x43e14c){_0xb79ed5['push'](_0xb79ed5['shift']());}};_0x5e9fe8(++_0x289390);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x5e614d,_0x25556d){_0x5e614d=_0x5e614d-0x0;var _0x5da9fe=_0x4f7b[_0x5e614d];return _0x5da9fe;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 890e32e..617d3c3 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 _0x8655=['./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x81769,_0x4f010d){var _0x342ed1=function(_0x377eae){while(--_0x377eae){_0x81769['push'](_0x81769['shift']());}};_0x342ed1(++_0x4f010d);}(_0x8655,0xc9));var _0x5865=function(_0x333d49,_0x5d2e5d){_0x333d49=_0x333d49-0x0;var _0x413e07=_0x8655[_0x333d49];return _0x413e07;};'use strict';var multer=require(_0x5865('0x0'));var util=require(_0x5865('0x1'));var path=require(_0x5865('0x2'));var timeout=require('connect-timeout');var express=require(_0x5865('0x3'));var router=express[_0x5865('0x4')]();var fs_extra=require(_0x5865('0x5'));var auth=require(_0x5865('0x6'));var interaction=require(_0x5865('0x7'));var config=require(_0x5865('0x8'));var controller=require(_0x5865('0x9'));router[_0x5865('0xa')]('/',auth[_0x5865('0xb')](),controller[_0x5865('0xc')]);router[_0x5865('0xa')](_0x5865('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x5865('0xa')](_0x5865('0xe'),auth['isAuthenticated'](),controller[_0x5865('0xf')]);router[_0x5865('0x10')]('/',auth[_0x5865('0xb')](),controller[_0x5865('0x11')]);router[_0x5865('0x12')](_0x5865('0xe'),auth['isAuthenticated'](),controller[_0x5865('0x13')]);router['delete'](_0x5865('0xe'),auth['isAuthenticated'](),controller[_0x5865('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4f37=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports'];(function(_0x10193b,_0x3d839a){var _0x1a271b=function(_0x397aba){while(--_0x397aba){_0x10193b['push'](_0x10193b['shift']());}};_0x1a271b(++_0x3d839a);}(_0x4f37,0xb4));var _0x74f3=function(_0x241b68,_0x1deab3){_0x241b68=_0x241b68-0x0;var _0x43449d=_0x4f37[_0x241b68];return _0x43449d;};'use strict';var multer=require('multer');var util=require(_0x74f3('0x0'));var path=require(_0x74f3('0x1'));var timeout=require(_0x74f3('0x2'));var express=require(_0x74f3('0x3'));var router=express[_0x74f3('0x4')]();var fs_extra=require(_0x74f3('0x5'));var auth=require(_0x74f3('0x6'));var interaction=require(_0x74f3('0x7'));var config=require(_0x74f3('0x8'));var controller=require(_0x74f3('0x9'));router[_0x74f3('0xa')]('/',auth[_0x74f3('0xb')](),controller[_0x74f3('0xc')]);router[_0x74f3('0xa')](_0x74f3('0xd'),auth[_0x74f3('0xb')](),controller['describe']);router['get'](_0x74f3('0xe'),auth[_0x74f3('0xb')](),controller['show']);router[_0x74f3('0xf')]('/',auth['isAuthenticated'](),controller[_0x74f3('0x10')]);router['put'](_0x74f3('0xe'),auth[_0x74f3('0xb')](),controller[_0x74f3('0x11')]);router[_0x74f3('0x12')](_0x74f3('0xe'),auth[_0x74f3('0xb')](),controller['destroy']);module[_0x74f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0dbf659..8e5d64c 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x16512e,_0x3a2ee2){var _0x394f9f=function(_0x39d7fd){while(--_0x39d7fd){_0x16512e['push'](_0x16512e['shift']());}};_0x394f9f(++_0x3a2ee2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xcb91[_0x58a4fe];return _0x697de2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x1bad26,_0xf6f79f){var _0x23b581=function(_0x4040c9){while(--_0x4040c9){_0x1bad26['push'](_0x1bad26['shift']());}};_0x23b581(++_0xf6f79f);}(_0x34e8,0x12c));var _0x834e=function(_0x51e78d,_0x37e329){_0x51e78d=_0x51e78d-0x0;var _0x5594a3=_0x34e8[_0x51e78d];return _0x5594a3;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 48a6fa8..6a5c19a 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 _0xb70f=['bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','stack','index','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','then','includeAll','include','OpenchannelTransferReport','findAll','rows','catch','length','find','create','body','params','describe','rimraf','fast-json-patch','request-promise'];(function(_0x10b5fe,_0x8c1204){var _0x26ed80=function(_0x4b17ae){while(--_0x4b17ae){_0x10b5fe['push'](_0x10b5fe['shift']());}};_0x26ed80(++_0x8c1204);}(_0xb70f,0x87));var _0xfb70=function(_0x5b051c,_0x203b7c){_0x5b051c=_0x5b051c-0x0;var _0x458dfa=_0xb70f[_0x5b051c];return _0x458dfa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb70('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb70('0x1'));var rp=require(_0xfb70('0x2'));var moment=require('moment');var BPromise=require(_0xfb70('0x3'));var Mustache=require(_0xfb70('0x4'));var util=require('util');var path=require(_0xfb70('0x5'));var sox=require(_0xfb70('0x6'));var csv=require(_0xfb70('0x7'));var ejs=require(_0xfb70('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb70('0x9'));var squel=require(_0xfb70('0xa'));var crypto=require(_0xfb70('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfb70('0xc'));var toCsv=require(_0xfb70('0x7'));var querystring=require(_0xfb70('0xd'));var Papa=require('papaparse');var Redis=require(_0xfb70('0xe'));var authService=require(_0xfb70('0xf'));var qs=require(_0xfb70('0x10'));var as=require(_0xfb70('0x11'));var hardwareService=require(_0xfb70('0x12'));var logger=require(_0xfb70('0x13'))('api');var utils=require(_0xfb70('0x14'));var config=require(_0xfb70('0x15'));var licenseUtil=require(_0xfb70('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6a661,_0x3e85d2){_0x3e85d2=_0x3e85d2||0xcc;return function(_0x5655c1){if(_0x5655c1){return _0xe6a661[_0xfb70('0x17')](_0x3e85d2);}return _0xe6a661[_0xfb70('0x18')](_0x3e85d2)[_0xfb70('0x19')]();};}function respondWithResult(_0x2b16dd,_0x589e93){_0x589e93=_0x589e93||0xc8;return function(_0x235d0){if(_0x235d0){return _0x2b16dd['status'](_0x589e93)['json'](_0x235d0);}};}function respondWithFilteredResult(_0x339836,_0x438e2c){return function(_0x15a96a){if(_0x15a96a){var _0x33ae03=typeof _0x438e2c[_0xfb70('0x1a')]===_0xfb70('0x1b')&&typeof _0x438e2c[_0xfb70('0x1c')]===_0xfb70('0x1b');var _0x2611ee=_0x15a96a[_0xfb70('0x1d')];var _0x432c44=_0x33ae03?0x0:_0x438e2c[_0xfb70('0x1a')];var _0x51cc0f=_0x33ae03?_0x15a96a[_0xfb70('0x1d')]:_0x438e2c['offset']+_0x438e2c[_0xfb70('0x1c')];var _0x469d8c;if(_0x51cc0f>=_0x2611ee){_0x51cc0f=_0x2611ee;_0x469d8c=0xc8;}else{_0x469d8c=0xce;}_0x339836['status'](_0x469d8c);return _0x339836['set'](_0xfb70('0x1e'),_0x432c44+'-'+_0x51cc0f+'/'+_0x2611ee)['json'](_0x15a96a);}return null;};}function patchUpdates(_0x4b24e5){return function(_0x265267){try{jsonpatch[_0xfb70('0x1f')](_0x265267,_0x4b24e5,!![]);}catch(_0x53f062){return BPromise[_0xfb70('0x20')](_0x53f062);}return _0x265267['save']();};}function saveUpdates(_0xf0ae7b,_0x4c4012){return function(_0x404916){if(_0x404916){return _0x404916[_0xfb70('0x21')](_0xf0ae7b)['then'](function(_0x2f9778){return _0x2f9778;});}return null;};}function removeEntity(_0x9391c4,_0x2321d5){return function(_0x3f7209){if(_0x3f7209){return _0x3f7209[_0xfb70('0x22')]()['then'](function(){_0x9391c4[_0xfb70('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dd1f7,_0x3c3afb){return function(_0x4eba89){if(!_0x4eba89){_0x3dd1f7['sendStatus'](0x194);}return _0x4eba89;};}function handleError(_0x54894d,_0x52992a){_0x52992a=_0x52992a||0x1f4;return function(_0x4a1852){logger['error'](_0x4a1852[_0xfb70('0x23')]);if(_0x4a1852['name']){delete _0x4a1852['name'];}_0x54894d['status'](_0x52992a)['send'](_0x4a1852);};}exports[_0xfb70('0x24')]=function(_0x245178,_0x18026b){var _0x40b110={},_0x35ee85={},_0x166f4f={'count':0x0,'rows':[]};var _0xba81e9=_['map'](db['OpenchannelTransferReport'][_0xfb70('0x25')],function(_0x281103){return{'name':_0x281103['fieldName'],'type':_0x281103[_0xfb70('0x26')][_0xfb70('0x27')]};});_0x35ee85[_0xfb70('0x28')]=_[_0xfb70('0x29')](_0xba81e9,_0xfb70('0x2a'));_0x35ee85[_0xfb70('0x2b')]=_[_0xfb70('0x2c')](_0x245178[_0xfb70('0x2b')]);_0x35ee85[_0xfb70('0x2d')]=_[_0xfb70('0x2e')](_0x35ee85[_0xfb70('0x28')],_0x35ee85[_0xfb70('0x2b')]);_0x40b110['attributes']=_['intersection'](_0x35ee85[_0xfb70('0x28')],qs[_0xfb70('0x2f')](_0x245178[_0xfb70('0x2b')][_0xfb70('0x2f')]));_0x40b110[_0xfb70('0x30')]=_0x40b110[_0xfb70('0x30')]['length']?_0x40b110[_0xfb70('0x30')]:_0x35ee85['model'];if(!_0x245178[_0xfb70('0x2b')]['hasOwnProperty'](_0xfb70('0x31'))){_0x40b110[_0xfb70('0x1c')]=qs[_0xfb70('0x1c')](_0x245178[_0xfb70('0x2b')]['limit']);_0x40b110['offset']=qs[_0xfb70('0x1a')](_0x245178[_0xfb70('0x2b')][_0xfb70('0x1a')]);}_0x40b110[_0xfb70('0x32')]=qs[_0xfb70('0x33')](_0x245178[_0xfb70('0x2b')][_0xfb70('0x33')]);_0x40b110[_0xfb70('0x34')]=qs['filters'](_['pick'](_0x245178[_0xfb70('0x2b')],_0x35ee85[_0xfb70('0x2d')]),_0xba81e9);if(_0x245178[_0xfb70('0x2b')][_0xfb70('0x35')]){_0x40b110['where']=_['merge'](_0x40b110[_0xfb70('0x34')],{'$or':_[_0xfb70('0x29')](_0xba81e9,function(_0x15cc18){if(_0x15cc18[_0xfb70('0x26')]!=='VIRTUAL'){var _0x4ef4f5={};_0x4ef4f5[_0x15cc18['name']]={'$like':'%'+_0x245178[_0xfb70('0x2b')]['filter']+'%'};return _0x4ef4f5;}})});}_0x40b110=_[_0xfb70('0x36')]({},_0x40b110,_0x245178[_0xfb70('0x37')]);var _0x2be54={'where':_0x40b110[_0xfb70('0x34')]};return db['OpenchannelTransferReport']['count'](_0x2be54)[_0xfb70('0x38')](function(_0x3b800e){_0x166f4f[_0xfb70('0x1d')]=_0x3b800e;if(_0x245178[_0xfb70('0x2b')][_0xfb70('0x39')]){_0x40b110[_0xfb70('0x3a')]=[{'all':!![]}];}return db[_0xfb70('0x3b')][_0xfb70('0x3c')](_0x40b110);})[_0xfb70('0x38')](function(_0x37aa27){_0x166f4f[_0xfb70('0x3d')]=_0x37aa27;return _0x166f4f;})[_0xfb70('0x38')](respondWithFilteredResult(_0x18026b,_0x40b110))[_0xfb70('0x3e')](handleError(_0x18026b,null));};exports['show']=function(_0x590e1e,_0x3b7d50){var _0x58b77b={'raw':!![],'where':{'id':_0x590e1e['params']['id']}},_0x24d137={};_0x24d137[_0xfb70('0x28')]=_[_0xfb70('0x2c')](db[_0xfb70('0x3b')]['rawAttributes']);_0x24d137[_0xfb70('0x2b')]=_[_0xfb70('0x2c')](_0x590e1e[_0xfb70('0x2b')]);_0x24d137[_0xfb70('0x2d')]=_['intersection'](_0x24d137[_0xfb70('0x28')],_0x24d137[_0xfb70('0x2b')]);_0x58b77b['attributes']=_['intersection'](_0x24d137[_0xfb70('0x28')],qs[_0xfb70('0x2f')](_0x590e1e[_0xfb70('0x2b')][_0xfb70('0x2f')]));_0x58b77b['attributes']=_0x58b77b[_0xfb70('0x30')][_0xfb70('0x3f')]?_0x58b77b['attributes']:_0x24d137[_0xfb70('0x28')];if(_0x590e1e[_0xfb70('0x2b')][_0xfb70('0x39')]){_0x58b77b['include']=[{'all':!![]}];}_0x58b77b=_[_0xfb70('0x36')]({},_0x58b77b,_0x590e1e[_0xfb70('0x37')]);return db[_0xfb70('0x3b')][_0xfb70('0x40')](_0x58b77b)['then'](handleEntityNotFound(_0x3b7d50,null))[_0xfb70('0x38')](respondWithResult(_0x3b7d50,null))[_0xfb70('0x3e')](handleError(_0x3b7d50,null));};exports[_0xfb70('0x41')]=function(_0x205041,_0x144fed){return db[_0xfb70('0x3b')][_0xfb70('0x41')](_0x205041['body'],{})[_0xfb70('0x38')](respondWithResult(_0x144fed,0xc9))[_0xfb70('0x3e')](handleError(_0x144fed,null));};exports[_0xfb70('0x21')]=function(_0x2cb5ab,_0x1b38b2){if(_0x2cb5ab[_0xfb70('0x42')]['id']){delete _0x2cb5ab[_0xfb70('0x42')]['id'];}return db[_0xfb70('0x3b')][_0xfb70('0x40')]({'where':{'id':_0x2cb5ab[_0xfb70('0x43')]['id']}})[_0xfb70('0x38')](handleEntityNotFound(_0x1b38b2,null))[_0xfb70('0x38')](saveUpdates(_0x2cb5ab[_0xfb70('0x42')],null))[_0xfb70('0x38')](respondWithResult(_0x1b38b2,null))[_0xfb70('0x3e')](handleError(_0x1b38b2,null));};exports['destroy']=function(_0x3c2469,_0x20e6fa){return db[_0xfb70('0x3b')][_0xfb70('0x40')]({'where':{'id':_0x3c2469[_0xfb70('0x43')]['id']}})[_0xfb70('0x38')](handleEntityNotFound(_0x20e6fa,null))[_0xfb70('0x38')](removeEntity(_0x20e6fa,null))[_0xfb70('0x3e')](handleError(_0x20e6fa,null));};exports['describe']=function(_0x199f8d,_0x1332c3){return db[_0xfb70('0x3b')][_0xfb70('0x44')]()[_0xfb70('0x38')](respondWithResult(_0x1332c3,null))['catch'](handleError(_0x1332c3,null));}; \ No newline at end of file +var _0x0941=['limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','fields','include','find','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','offset'];(function(_0x2d2502,_0x330f0d){var _0x324fb4=function(_0x1e28b8){while(--_0x1e28b8){_0x2d2502['push'](_0x2d2502['shift']());}};_0x324fb4(++_0x330f0d);}(_0x0941,0x71));var _0x1094=function(_0x220386,_0x548620){_0x220386=_0x220386-0x0;var _0x4402c9=_0x0941[_0x220386];return _0x4402c9;};'use strict';var emlformat=require(_0x1094('0x0'));var rimraf=require(_0x1094('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1094('0x2'));var rp=require('request-promise');var moment=require(_0x1094('0x3'));var BPromise=require(_0x1094('0x4'));var Mustache=require('mustache');var util=require(_0x1094('0x5'));var path=require('path');var sox=require(_0x1094('0x6'));var csv=require(_0x1094('0x7'));var ejs=require(_0x1094('0x8'));var fs=require('fs');var fs_extra=require(_0x1094('0x9'));var _=require(_0x1094('0xa'));var squel=require(_0x1094('0xb'));var crypto=require(_0x1094('0xc'));var jsforce=require(_0x1094('0xd'));var deskjs=require(_0x1094('0xe'));var toCsv=require(_0x1094('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1094('0xf'));var authService=require(_0x1094('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1094('0x11'));var hardwareService=require(_0x1094('0x12'));var logger=require(_0x1094('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1094('0x14'))['db'];function respondWithStatusCode(_0x14ce73,_0x94cef7){_0x94cef7=_0x94cef7||0xcc;return function(_0x14779f){if(_0x14779f){return _0x14ce73[_0x1094('0x15')](_0x94cef7);}return _0x14ce73[_0x1094('0x16')](_0x94cef7)[_0x1094('0x17')]();};}function respondWithResult(_0x394a06,_0x2f23c4){_0x2f23c4=_0x2f23c4||0xc8;return function(_0x3ff7c9){if(_0x3ff7c9){return _0x394a06[_0x1094('0x16')](_0x2f23c4)['json'](_0x3ff7c9);}};}function respondWithFilteredResult(_0x294baa,_0xfcaead){return function(_0x4378dc){if(_0x4378dc){var _0x17293a=typeof _0xfcaead[_0x1094('0x18')]==='undefined'&&typeof _0xfcaead[_0x1094('0x19')]==='undefined';var _0x45dcdf=_0x4378dc['count'];var _0x4b80f3=_0x17293a?0x0:_0xfcaead['offset'];var _0x4633a2=_0x17293a?_0x4378dc['count']:_0xfcaead[_0x1094('0x18')]+_0xfcaead[_0x1094('0x19')];var _0x5590ec;if(_0x4633a2>=_0x45dcdf){_0x4633a2=_0x45dcdf;_0x5590ec=0xc8;}else{_0x5590ec=0xce;}_0x294baa[_0x1094('0x16')](_0x5590ec);return _0x294baa[_0x1094('0x1a')](_0x1094('0x1b'),_0x4b80f3+'-'+_0x4633a2+'/'+_0x45dcdf)['json'](_0x4378dc);}return null;};}function patchUpdates(_0xb15524){return function(_0x4bf694){try{jsonpatch[_0x1094('0x1c')](_0x4bf694,_0xb15524,!![]);}catch(_0x141a99){return BPromise['reject'](_0x141a99);}return _0x4bf694['save']();};}function saveUpdates(_0x9d5af3,_0x368ea2){return function(_0x23c82b){if(_0x23c82b){return _0x23c82b[_0x1094('0x1d')](_0x9d5af3)[_0x1094('0x1e')](function(_0x4ea985){return _0x4ea985;});}return null;};}function removeEntity(_0x4da46f,_0x17e5fa){return function(_0x2c67f3){if(_0x2c67f3){return _0x2c67f3[_0x1094('0x1f')]()['then'](function(){_0x4da46f[_0x1094('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7cc3,_0x5a605c){return function(_0xcd3e9c){if(!_0xcd3e9c){_0x5b7cc3[_0x1094('0x15')](0x194);}return _0xcd3e9c;};}function handleError(_0x76c34b,_0x2713d9){_0x2713d9=_0x2713d9||0x1f4;return function(_0xb2531f){logger[_0x1094('0x20')](_0xb2531f[_0x1094('0x21')]);if(_0xb2531f[_0x1094('0x22')]){delete _0xb2531f[_0x1094('0x22')];}_0x76c34b[_0x1094('0x16')](_0x2713d9)[_0x1094('0x23')](_0xb2531f);};}exports[_0x1094('0x24')]=function(_0x2b0716,_0x635e37){var _0x401631={},_0x3d3f4b={},_0x230b50={'count':0x0,'rows':[]};var _0x288fe3=_[_0x1094('0x25')](db[_0x1094('0x26')]['rawAttributes'],function(_0x42b545){return{'name':_0x42b545[_0x1094('0x27')],'type':_0x42b545[_0x1094('0x28')]['key']};});_0x3d3f4b[_0x1094('0x29')]=_[_0x1094('0x25')](_0x288fe3,'name');_0x3d3f4b[_0x1094('0x2a')]=_[_0x1094('0x2b')](_0x2b0716[_0x1094('0x2a')]);_0x3d3f4b['filters']=_['intersection'](_0x3d3f4b['model'],_0x3d3f4b[_0x1094('0x2a')]);_0x401631[_0x1094('0x2c')]=_[_0x1094('0x2d')](_0x3d3f4b[_0x1094('0x29')],qs['fields'](_0x2b0716[_0x1094('0x2a')]['fields']));_0x401631['attributes']=_0x401631[_0x1094('0x2c')][_0x1094('0x2e')]?_0x401631[_0x1094('0x2c')]:_0x3d3f4b[_0x1094('0x29')];if(!_0x2b0716['query'][_0x1094('0x2f')](_0x1094('0x30'))){_0x401631[_0x1094('0x19')]=qs[_0x1094('0x19')](_0x2b0716[_0x1094('0x2a')][_0x1094('0x19')]);_0x401631[_0x1094('0x18')]=qs[_0x1094('0x18')](_0x2b0716[_0x1094('0x2a')]['offset']);}_0x401631[_0x1094('0x31')]=qs[_0x1094('0x32')](_0x2b0716[_0x1094('0x2a')]['sort']);_0x401631['where']=qs[_0x1094('0x33')](_[_0x1094('0x34')](_0x2b0716[_0x1094('0x2a')],_0x3d3f4b[_0x1094('0x33')]),_0x288fe3);if(_0x2b0716[_0x1094('0x2a')][_0x1094('0x35')]){_0x401631[_0x1094('0x36')]=_[_0x1094('0x37')](_0x401631[_0x1094('0x36')],{'$or':_[_0x1094('0x25')](_0x288fe3,function(_0x424e9d){if(_0x424e9d[_0x1094('0x28')]!=='VIRTUAL'){var _0x567391={};_0x567391[_0x424e9d[_0x1094('0x22')]]={'$like':'%'+_0x2b0716['query'][_0x1094('0x35')]+'%'};return _0x567391;}})});}_0x401631=_['merge']({},_0x401631,_0x2b0716[_0x1094('0x38')]);var _0x46d5f8={'where':_0x401631[_0x1094('0x36')]};return db[_0x1094('0x26')][_0x1094('0x39')](_0x46d5f8)[_0x1094('0x1e')](function(_0xf59c9f){_0x230b50[_0x1094('0x39')]=_0xf59c9f;if(_0x2b0716[_0x1094('0x2a')][_0x1094('0x3a')]){_0x401631['include']=[{'all':!![]}];}return db[_0x1094('0x26')][_0x1094('0x3b')](_0x401631);})['then'](function(_0x20c166){_0x230b50[_0x1094('0x3c')]=_0x20c166;return _0x230b50;})[_0x1094('0x1e')](respondWithFilteredResult(_0x635e37,_0x401631))[_0x1094('0x3d')](handleError(_0x635e37,null));};exports[_0x1094('0x3e')]=function(_0x47d33f,_0x338dd6){var _0x383bff={'raw':!![],'where':{'id':_0x47d33f['params']['id']}},_0x541c76={};_0x541c76['model']=_[_0x1094('0x2b')](db[_0x1094('0x26')]['rawAttributes']);_0x541c76[_0x1094('0x2a')]=_[_0x1094('0x2b')](_0x47d33f[_0x1094('0x2a')]);_0x541c76[_0x1094('0x33')]=_[_0x1094('0x2d')](_0x541c76[_0x1094('0x29')],_0x541c76['query']);_0x383bff[_0x1094('0x2c')]=_[_0x1094('0x2d')](_0x541c76[_0x1094('0x29')],qs['fields'](_0x47d33f[_0x1094('0x2a')][_0x1094('0x3f')]));_0x383bff[_0x1094('0x2c')]=_0x383bff[_0x1094('0x2c')][_0x1094('0x2e')]?_0x383bff[_0x1094('0x2c')]:_0x541c76[_0x1094('0x29')];if(_0x47d33f[_0x1094('0x2a')]['includeAll']){_0x383bff[_0x1094('0x40')]=[{'all':!![]}];}_0x383bff=_[_0x1094('0x37')]({},_0x383bff,_0x47d33f['options']);return db['OpenchannelTransferReport'][_0x1094('0x41')](_0x383bff)[_0x1094('0x1e')](handleEntityNotFound(_0x338dd6,null))['then'](respondWithResult(_0x338dd6,null))[_0x1094('0x3d')](handleError(_0x338dd6,null));};exports['create']=function(_0x1e4214,_0x1a1ff2){return db[_0x1094('0x26')]['create'](_0x1e4214['body'],{})['then'](respondWithResult(_0x1a1ff2,0xc9))[_0x1094('0x3d')](handleError(_0x1a1ff2,null));};exports[_0x1094('0x1d')]=function(_0x1464ce,_0x5ef022){if(_0x1464ce[_0x1094('0x42')]['id']){delete _0x1464ce[_0x1094('0x42')]['id'];}return db['OpenchannelTransferReport'][_0x1094('0x41')]({'where':{'id':_0x1464ce[_0x1094('0x43')]['id']}})[_0x1094('0x1e')](handleEntityNotFound(_0x5ef022,null))['then'](saveUpdates(_0x1464ce[_0x1094('0x42')],null))[_0x1094('0x1e')](respondWithResult(_0x5ef022,null))[_0x1094('0x3d')](handleError(_0x5ef022,null));};exports['destroy']=function(_0x455f74,_0x302125){return db[_0x1094('0x26')]['find']({'where':{'id':_0x455f74['params']['id']}})['then'](handleEntityNotFound(_0x302125,null))[_0x1094('0x1e')](removeEntity(_0x302125,null))[_0x1094('0x3d')](handleError(_0x302125,null));};exports[_0x1094('0x44')]=function(_0x1648f0,_0x511eae){return db[_0x1094('0x26')][_0x1094('0x44')]()[_0x1094('0x1e')](respondWithResult(_0x511eae,null))[_0x1094('0x3d')](handleError(_0x511eae,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3fcb255..fc75107 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 _0xe01f=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x226c34,_0x5add93){var _0x14a8f7=function(_0x5e8acb){while(--_0x5e8acb){_0x226c34['push'](_0x226c34['shift']());}};_0x14a8f7(++_0x5add93);}(_0xe01f,0x17d));var _0xfe01=function(_0x5ed2b7,_0x52d6fe){_0x5ed2b7=_0x5ed2b7-0x0;var _0x5f4693=_0xe01f[_0x5ed2b7];return _0x5f4693;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe01('0x0'))(_0xfe01('0x1'));var moment=require(_0xfe01('0x2'));var BPromise=require(_0xfe01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe01('0x4'));var rimraf=require(_0xfe01('0x5'));var config=require(_0xfe01('0x6'));var attributes=require(_0xfe01('0x7'));module[_0xfe01('0x8')]=function(_0x7816,_0x421db5){return _0x7816['define'](_0xfe01('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xfe01('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc33f=['path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3614c5,_0x174847){var _0x258563=function(_0x1beba8){while(--_0x1beba8){_0x3614c5['push'](_0x3614c5['shift']());}};_0x258563(++_0x174847);}(_0xc33f,0x193));var _0xfc33=function(_0x1bb11e,_0x58fd78){_0x1bb11e=_0x1bb11e-0x0;var _0x422492=_0xc33f[_0x1bb11e];return _0x422492;};'use strict';var _=require(_0xfc33('0x0'));var util=require('util');var logger=require(_0xfc33('0x1'))(_0xfc33('0x2'));var moment=require(_0xfc33('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc33('0x4'));var fs=require('fs');var path=require(_0xfc33('0x5'));var rimraf=require(_0xfc33('0x6'));var config=require(_0xfc33('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xfc33('0x8')]=function(_0x3d14c1,_0x3e23eb){return _0x3d14c1[_0xfc33('0x9')](_0xfc33('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xfc33('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 52c1e46..631964a 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 _0xe015=['stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x41f96e,_0x333851){var _0x48a4ac=function(_0xdad934){while(--_0xdad934){_0x41f96e['push'](_0x41f96e['shift']());}};_0x48a4ac(++_0x333851);}(_0xe015,0x13b));var _0x5e01=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe015[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e01('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e01('0x4'));var logger=require(_0x5e01('0x5'))(_0x5e01('0x6'));var config=require(_0x5e01('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5e01('0x8')][_0x5e01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4de678,_0x48b05c,_0x414f73){return new BPromise(function(_0x3aeaef,_0x1420c2){return client[_0x5e01('0xa')](_0x4de678,_0x414f73)[_0x5e01('0xb')](function(_0x36bd7e){logger['info'](_0x5e01('0xc'),_0x48b05c,'request\x20sent');logger[_0x5e01('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x48b05c,_0x5e01('0xe'),JSON[_0x5e01('0xf')](_0x36bd7e));if(_0x36bd7e['error']){if(_0x36bd7e[_0x5e01('0x10')][_0x5e01('0x11')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x48b05c,_0x36bd7e[_0x5e01('0x10')][_0x5e01('0x12')]);return _0x1420c2(_0x36bd7e[_0x5e01('0x10')][_0x5e01('0x12')]);}logger[_0x5e01('0x10')](_0x5e01('0xc'),_0x48b05c,_0x36bd7e['error'][_0x5e01('0x12')]);return _0x3aeaef(_0x36bd7e['error']['message']);}else{logger[_0x5e01('0x13')](_0x5e01('0xc'),_0x48b05c,'request\x20sent');_0x3aeaef(_0x36bd7e[_0x5e01('0x14')]['message']);}})[_0x5e01('0x15')](function(_0x5e4058){logger[_0x5e01('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48b05c,_0x5e4058);_0x1420c2(_0x5e4058);});});} \ No newline at end of file +var _0x2975=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x3259fe,_0x4925fa){var _0xae7b06=function(_0x28dffb){while(--_0x28dffb){_0x3259fe['push'](_0x3259fe['shift']());}};_0xae7b06(++_0x4925fa);}(_0x2975,0x1c5));var _0x5297=function(_0x469263,_0x31b5b2){_0x469263=_0x469263-0x0;var _0x206b2d=_0x2975[_0x469263];return _0x206b2d;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var moment=require(_0x5297('0x1'));var BPromise=require(_0x5297('0x2'));var rs=require(_0x5297('0x3'));var fs=require('fs');var Redis=require(_0x5297('0x4'));var db=require(_0x5297('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5297('0x6'));var jayson=require(_0x5297('0x7'));var client=jayson[_0x5297('0x8')][_0x5297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1d2c,_0x1f6762,_0x1b72a7){return new BPromise(function(_0x4f12b0,_0x2c015c){return client[_0x5297('0xa')](_0x4d1d2c,_0x1b72a7)[_0x5297('0xb')](function(_0x2f3b24){logger[_0x5297('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x5297('0xd'));logger[_0x5297('0xe')](_0x5297('0xf'),_0x1f6762,'request\x20sent',JSON[_0x5297('0x10')](_0x2f3b24));if(_0x2f3b24[_0x5297('0x11')]){if(_0x2f3b24[_0x5297('0x11')]['code']===0x1f4){logger[_0x5297('0x11')](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error']['message']);return _0x2c015c(_0x2f3b24[_0x5297('0x11')][_0x5297('0x13')]);}logger['error'](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error'][_0x5297('0x13')]);return _0x4f12b0(_0x2f3b24[_0x5297('0x11')]['message']);}else{logger[_0x5297('0xc')](_0x5297('0x12'),_0x1f6762,_0x5297('0xd'));_0x4f12b0(_0x2f3b24[_0x5297('0x14')][_0x5297('0x13')]);}})[_0x5297('0x15')](function(_0x1fb138){logger[_0x5297('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x1fb138);_0x2c015c(_0x1fb138);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0d1407f..ba2b33f 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 _0xd5c4=['Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x533b55,_0x56172d){var _0x30149d=function(_0x36ccc6){while(--_0x36ccc6){_0x533b55['push'](_0x533b55['shift']());}};_0x30149d(++_0x56172d);}(_0xd5c4,0x12d));var _0x4d5c=function(_0x2e08a9,_0x5cf397){_0x2e08a9=_0x2e08a9-0x0;var _0x79cbb7=_0xd5c4[_0x2e08a9];return _0x79cbb7;};'use strict';var multer=require(_0x4d5c('0x0'));var util=require(_0x4d5c('0x1'));var path=require(_0x4d5c('0x2'));var timeout=require(_0x4d5c('0x3'));var express=require(_0x4d5c('0x4'));var router=express[_0x4d5c('0x5')]();var fs_extra=require(_0x4d5c('0x6'));var auth=require(_0x4d5c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4d5c('0x8'));var controller=require('./pause.controller');router[_0x4d5c('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d5c('0xa')]);router[_0x4d5c('0x9')](_0x4d5c('0xb'),auth[_0x4d5c('0xc')](),controller['show']);router[_0x4d5c('0xd')]('/',auth[_0x4d5c('0xc')](),controller['create']);router[_0x4d5c('0xe')]('/:id',auth[_0x4d5c('0xc')](),controller[_0x4d5c('0xf')]);router['delete'](_0x4d5c('0xb'),auth['isAuthenticated'](),controller[_0x4d5c('0x10')]);module[_0x4d5c('0x11')]=router; \ No newline at end of file +var _0x953e=['delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','put','update'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x953e,0xb4));var _0xe953=function(_0x203814,_0x1c92a6){_0x203814=_0x203814-0x0;var _0x2aaf64=_0x953e[_0x203814];return _0x2aaf64;};'use strict';var multer=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var path=require('path');var timeout=require(_0xe953('0x2'));var express=require(_0xe953('0x3'));var router=express[_0xe953('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe953('0x5'));var config=require('../../config/environment');var controller=require(_0xe953('0x6'));router[_0xe953('0x7')]('/',auth[_0xe953('0x8')](),controller[_0xe953('0x9')]);router[_0xe953('0x7')]('/:id',auth[_0xe953('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe953('0xa')]('/:id',auth[_0xe953('0x8')](),controller[_0xe953('0xb')]);router[_0xe953('0xc')](_0xe953('0xd'),auth[_0xe953('0x8')](),controller[_0xe953('0xe')]);module[_0xe953('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9dcb104..2136bb6 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 _0x7233=['STRING','name','sequelize','exports'];(function(_0x3d2e35,_0x173330){var _0x50d629=function(_0x26505f){while(--_0x26505f){_0x3d2e35['push'](_0x3d2e35['shift']());}};_0x50d629(++_0x173330);}(_0x7233,0xbe));var _0x3723=function(_0x38a923,_0x4509f7){_0x38a923=_0x38a923-0x0;var _0x444ef9=_0x7233[_0x38a923];return _0x444ef9;};'use strict';var Sequelize=require(_0x3723('0x0'));module[_0x3723('0x1')]={'name':{'type':Sequelize[_0x3723('0x2')],'unique':_0x3723('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3723('0x2')]}}; \ No newline at end of file +var _0x6380=['STRING','sequelize'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x6380,0x11d));var _0x0638=function(_0x4e9158,_0x160de0){_0x4e9158=_0x4e9158-0x0;var _0x3ce7d5=_0x6380[_0x4e9158];return _0x3ce7d5;};'use strict';var Sequelize=require(_0x0638('0x0'));module['exports']={'name':{'type':Sequelize[_0x0638('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0638('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7259895..925322f 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 _0x3737=['status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3737,0x185));var _0x7373=function(_0x4c2ca3,_0x44288a){_0x4c2ca3=_0x4c2ca3-0x0;var _0x1af873=_0x3737[_0x4c2ca3];return _0x1af873;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7373('0x0'));var jsonpatch=require(_0x7373('0x1'));var rp=require(_0x7373('0x2'));var moment=require(_0x7373('0x3'));var BPromise=require(_0x7373('0x4'));var Mustache=require(_0x7373('0x5'));var util=require(_0x7373('0x6'));var path=require(_0x7373('0x7'));var sox=require(_0x7373('0x8'));var csv=require('to-csv');var ejs=require(_0x7373('0x9'));var fs=require('fs');var fs_extra=require(_0x7373('0xa'));var _=require(_0x7373('0xb'));var squel=require(_0x7373('0xc'));var crypto=require(_0x7373('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7373('0xe'));var toCsv=require(_0x7373('0xf'));var querystring=require(_0x7373('0x10'));var Papa=require(_0x7373('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7373('0x12'));var as=require(_0x7373('0x13'));var hardwareService=require(_0x7373('0x14'));var logger=require('../../config/logger')(_0x7373('0x15'));var utils=require(_0x7373('0x16'));var config=require(_0x7373('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7373('0x18'))['db'];function respondWithStatusCode(_0x55e792,_0x53b821){_0x53b821=_0x53b821||0xcc;return function(_0x45d66b){if(_0x45d66b){return _0x55e792['sendStatus'](_0x53b821);}return _0x55e792['status'](_0x53b821)[_0x7373('0x19')]();};}function respondWithResult(_0x1e1652,_0x433c5f){_0x433c5f=_0x433c5f||0xc8;return function(_0x309c5c){if(_0x309c5c){return _0x1e1652[_0x7373('0x1a')](_0x433c5f)['json'](_0x309c5c);}};}function respondWithFilteredResult(_0x3db6ff,_0x45d23a){return function(_0x11e6c1){if(_0x11e6c1){var _0x42dfd1=typeof _0x45d23a[_0x7373('0x1b')]===_0x7373('0x1c')&&typeof _0x45d23a[_0x7373('0x1d')]===_0x7373('0x1c');var _0x59b1e6=_0x11e6c1[_0x7373('0x1e')];var _0x4deb6e=_0x42dfd1?0x0:_0x45d23a[_0x7373('0x1b')];var _0x31a227=_0x42dfd1?_0x11e6c1[_0x7373('0x1e')]:_0x45d23a['offset']+_0x45d23a[_0x7373('0x1d')];var _0x1d3f22;if(_0x31a227>=_0x59b1e6){_0x31a227=_0x59b1e6;_0x1d3f22=0xc8;}else{_0x1d3f22=0xce;}_0x3db6ff[_0x7373('0x1a')](_0x1d3f22);return _0x3db6ff[_0x7373('0x1f')](_0x7373('0x20'),_0x4deb6e+'-'+_0x31a227+'/'+_0x59b1e6)[_0x7373('0x21')](_0x11e6c1);}return null;};}function patchUpdates(_0x185179){return function(_0xc5170a){try{jsonpatch['apply'](_0xc5170a,_0x185179,!![]);}catch(_0x191635){return BPromise[_0x7373('0x22')](_0x191635);}return _0xc5170a[_0x7373('0x23')]();};}function saveUpdates(_0x4901d5,_0x1e9aa4){return function(_0x39c260){if(_0x39c260){return _0x39c260[_0x7373('0x24')](_0x4901d5)[_0x7373('0x25')](function(_0x5bb31b){return _0x5bb31b;});}return null;};}function removeEntity(_0x2d38fd,_0x183fad){return function(_0x2568ac){if(_0x2568ac){return _0x2568ac[_0x7373('0x26')]()['then'](function(){var _0x2cdd10=_0x2568ac['get']({'plain':!![]});var _0x58def2=_0x7373('0x27');return db[_0x7373('0x28')][_0x7373('0x26')]({'where':{'type':_0x58def2,'resourceId':_0x2cdd10['id']}})[_0x7373('0x25')](function(){return _0x2568ac;});})[_0x7373('0x25')](function(){_0x2d38fd[_0x7373('0x1a')](0xcc)[_0x7373('0x19')]();});}};}function handleEntityNotFound(_0x34f8ab,_0x1a48df){return function(_0x3f850e){if(!_0x3f850e){_0x34f8ab[_0x7373('0x29')](0x194);}return _0x3f850e;};}function handleError(_0x223c19,_0x4c9d07){_0x4c9d07=_0x4c9d07||0x1f4;return function(_0x29be91){logger['error'](_0x29be91[_0x7373('0x2a')]);if(_0x29be91['name']){delete _0x29be91[_0x7373('0x2b')];}_0x223c19[_0x7373('0x1a')](_0x4c9d07)[_0x7373('0x2c')](_0x29be91);};}exports[_0x7373('0x2d')]=function(_0x275c27,_0x3621f6){var _0x117af9={},_0x458eed={},_0x3cf2fe={'count':0x0,'rows':[]};var _0x352949=_[_0x7373('0x2e')](db[_0x7373('0x2f')][_0x7373('0x30')],function(_0xae1fb6){return{'name':_0xae1fb6[_0x7373('0x31')],'type':_0xae1fb6[_0x7373('0x32')][_0x7373('0x33')]};});_0x458eed[_0x7373('0x34')]=_[_0x7373('0x2e')](_0x352949,_0x7373('0x2b'));_0x458eed[_0x7373('0x35')]=_[_0x7373('0x36')](_0x275c27['query']);_0x458eed[_0x7373('0x37')]=_[_0x7373('0x38')](_0x458eed[_0x7373('0x34')],_0x458eed[_0x7373('0x35')]);_0x117af9[_0x7373('0x39')]=_[_0x7373('0x38')](_0x458eed[_0x7373('0x34')],qs['fields'](_0x275c27[_0x7373('0x35')][_0x7373('0x3a')]));_0x117af9[_0x7373('0x39')]=_0x117af9[_0x7373('0x39')]['length']?_0x117af9['attributes']:_0x458eed[_0x7373('0x34')];if(!_0x275c27['query'][_0x7373('0x3b')](_0x7373('0x3c'))){_0x117af9[_0x7373('0x1d')]=qs[_0x7373('0x1d')](_0x275c27[_0x7373('0x35')]['limit']);_0x117af9[_0x7373('0x1b')]=qs[_0x7373('0x1b')](_0x275c27[_0x7373('0x35')][_0x7373('0x1b')]);}_0x117af9['order']=qs['sort'](_0x275c27['query']['sort']);_0x117af9[_0x7373('0x3d')]=qs[_0x7373('0x37')](_[_0x7373('0x3e')](_0x275c27[_0x7373('0x35')],_0x458eed[_0x7373('0x37')]),_0x352949);if(_0x275c27[_0x7373('0x35')]['filter']){_0x117af9[_0x7373('0x3d')]=_[_0x7373('0x3f')](_0x117af9[_0x7373('0x3d')],{'$or':_[_0x7373('0x2e')](_0x352949,function(_0xfed083){if(_0xfed083['type']!==_0x7373('0x40')){var _0x1be69a={};_0x1be69a[_0xfed083[_0x7373('0x2b')]]={'$like':'%'+_0x275c27[_0x7373('0x35')]['filter']+'%'};return _0x1be69a;}})});}_0x117af9=_[_0x7373('0x3f')]({},_0x117af9,_0x275c27['options']);var _0x5f3b3a={'where':_0x117af9[_0x7373('0x3d')]};return db[_0x7373('0x2f')]['count'](_0x5f3b3a)[_0x7373('0x25')](function(_0x46c8c8){_0x3cf2fe[_0x7373('0x1e')]=_0x46c8c8;if(_0x275c27[_0x7373('0x35')][_0x7373('0x41')]){_0x117af9[_0x7373('0x42')]=[{'all':!![]}];}return db[_0x7373('0x2f')][_0x7373('0x43')](_0x117af9);})[_0x7373('0x25')](function(_0x5cc4c1){_0x3cf2fe[_0x7373('0x44')]=_0x5cc4c1;return _0x3cf2fe;})[_0x7373('0x25')](respondWithFilteredResult(_0x3621f6,_0x117af9))[_0x7373('0x45')](handleError(_0x3621f6,null));};exports[_0x7373('0x46')]=function(_0x563e4f,_0x55090b){var _0x3ff229={'raw':!![],'where':{'id':_0x563e4f[_0x7373('0x47')]['id']}},_0xef4718={};_0xef4718[_0x7373('0x34')]=_[_0x7373('0x36')](db[_0x7373('0x2f')][_0x7373('0x30')]);_0xef4718['query']=_['keys'](_0x563e4f[_0x7373('0x35')]);_0xef4718[_0x7373('0x37')]=_['intersection'](_0xef4718[_0x7373('0x34')],_0xef4718['query']);_0x3ff229[_0x7373('0x39')]=_['intersection'](_0xef4718[_0x7373('0x34')],qs[_0x7373('0x3a')](_0x563e4f[_0x7373('0x35')][_0x7373('0x3a')]));_0x3ff229['attributes']=_0x3ff229[_0x7373('0x39')][_0x7373('0x48')]?_0x3ff229[_0x7373('0x39')]:_0xef4718['model'];if(_0x563e4f[_0x7373('0x35')][_0x7373('0x41')]){_0x3ff229[_0x7373('0x42')]=[{'all':!![]}];}_0x3ff229=_[_0x7373('0x3f')]({},_0x3ff229,_0x563e4f[_0x7373('0x49')]);return db[_0x7373('0x2f')][_0x7373('0x4a')](_0x3ff229)[_0x7373('0x25')](handleEntityNotFound(_0x55090b,null))[_0x7373('0x25')](respondWithResult(_0x55090b,null))[_0x7373('0x45')](handleError(_0x55090b,null));};exports[_0x7373('0x4b')]=function(_0x4d15f2,_0x10d58f){return db[_0x7373('0x2f')][_0x7373('0x4b')](_0x4d15f2[_0x7373('0x4c')],{})[_0x7373('0x25')](function(_0x45a6c2){var _0x59f90f=_0x4d15f2['user']['get']({'plain':!![]});if(!_0x59f90f)throw new Error(_0x7373('0x4d'));if(_0x59f90f[_0x7373('0x4e')]==='user'){var _0x2b3674=_0x45a6c2[_0x7373('0x4f')]({'plain':!![]});var _0x386062=_0x7373('0x27');return db[_0x7373('0x50')]['find']({'where':{'name':_0x386062,'userProfileId':_0x59f90f[_0x7373('0x51')]},'raw':!![]})[_0x7373('0x25')](function(_0x36939c){if(_0x36939c&&_0x36939c['autoAssociation']===0x0){return db['UserProfileResource'][_0x7373('0x4b')]({'name':_0x2b3674[_0x7373('0x2b')],'resourceId':_0x2b3674['id'],'type':_0x36939c['name'],'sectionId':_0x36939c['id']},{})[_0x7373('0x25')](function(){return _0x45a6c2;});}else{return _0x45a6c2;}})[_0x7373('0x45')](function(_0x42665b){logger[_0x7373('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42665b);throw _0x42665b;});}return _0x45a6c2;})[_0x7373('0x25')](respondWithResult(_0x10d58f,0xc9))[_0x7373('0x45')](handleError(_0x10d58f,null));};exports[_0x7373('0x24')]=function(_0x459986,_0x217872){if(_0x459986['body']['id']){delete _0x459986['body']['id'];}return db[_0x7373('0x2f')][_0x7373('0x4a')]({'where':{'id':_0x459986['params']['id']}})[_0x7373('0x25')](handleEntityNotFound(_0x217872,null))['then'](saveUpdates(_0x459986[_0x7373('0x4c')],null))['then'](respondWithResult(_0x217872,null))[_0x7373('0x45')](handleError(_0x217872,null));};exports[_0x7373('0x26')]=function(_0x29bfac,_0x147ac0){return db['Pause']['find']({'where':{'id':_0x29bfac[_0x7373('0x47')]['id']}})['then'](handleEntityNotFound(_0x147ac0,null))['then'](removeEntity(_0x147ac0,null))[_0x7373('0x45')](handleError(_0x147ac0,null));}; \ No newline at end of file +var _0xf727=['query','attributes','fields','model','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','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','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','keys','filters','intersection'];(function(_0x4d5c12,_0x2015fe){var _0x54ac8b=function(_0x5e84cc){while(--_0x5e84cc){_0x4d5c12['push'](_0x4d5c12['shift']());}};_0x54ac8b(++_0x2015fe);}(_0xf727,0x1bb));var _0x7f72=function(_0x45d26b,_0xe9d33f){_0x45d26b=_0x45d26b-0x0;var _0x261fb2=_0xf727[_0x45d26b];return _0x261fb2;};'use strict';var emlformat=require(_0x7f72('0x0'));var rimraf=require(_0x7f72('0x1'));var zipdir=require(_0x7f72('0x2'));var jsonpatch=require(_0x7f72('0x3'));var rp=require(_0x7f72('0x4'));var moment=require(_0x7f72('0x5'));var BPromise=require(_0x7f72('0x6'));var Mustache=require(_0x7f72('0x7'));var util=require(_0x7f72('0x8'));var path=require(_0x7f72('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f72('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f72('0xb'));var squel=require('squel');var crypto=require(_0x7f72('0xc'));var jsforce=require(_0x7f72('0xd'));var deskjs=require(_0x7f72('0xe'));var toCsv=require(_0x7f72('0xf'));var querystring=require(_0x7f72('0x10'));var Papa=require(_0x7f72('0x11'));var Redis=require('ioredis');var authService=require(_0x7f72('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f72('0x13'));var hardwareService=require(_0x7f72('0x14'));var logger=require(_0x7f72('0x15'))(_0x7f72('0x16'));var utils=require(_0x7f72('0x17'));var config=require(_0x7f72('0x18'));var licenseUtil=require(_0x7f72('0x19'));var db=require(_0x7f72('0x1a'))['db'];function respondWithStatusCode(_0x4d7714,_0x1e0a5e){_0x1e0a5e=_0x1e0a5e||0xcc;return function(_0x438b3f){if(_0x438b3f){return _0x4d7714[_0x7f72('0x1b')](_0x1e0a5e);}return _0x4d7714['status'](_0x1e0a5e)[_0x7f72('0x1c')]();};}function respondWithResult(_0x28f592,_0x194070){_0x194070=_0x194070||0xc8;return function(_0x5844c2){if(_0x5844c2){return _0x28f592[_0x7f72('0x1d')](_0x194070)[_0x7f72('0x1e')](_0x5844c2);}};}function respondWithFilteredResult(_0x5845b4,_0x56a307){return function(_0x4abc16){if(_0x4abc16){var _0x342a1b=typeof _0x56a307[_0x7f72('0x1f')]===_0x7f72('0x20')&&typeof _0x56a307[_0x7f72('0x21')]===_0x7f72('0x20');var _0x2c37cb=_0x4abc16['count'];var _0xfa80af=_0x342a1b?0x0:_0x56a307[_0x7f72('0x1f')];var _0x3a1cd4=_0x342a1b?_0x4abc16[_0x7f72('0x22')]:_0x56a307[_0x7f72('0x1f')]+_0x56a307['limit'];var _0x53eb2f;if(_0x3a1cd4>=_0x2c37cb){_0x3a1cd4=_0x2c37cb;_0x53eb2f=0xc8;}else{_0x53eb2f=0xce;}_0x5845b4[_0x7f72('0x1d')](_0x53eb2f);return _0x5845b4[_0x7f72('0x23')]('Content-Range',_0xfa80af+'-'+_0x3a1cd4+'/'+_0x2c37cb)[_0x7f72('0x1e')](_0x4abc16);}return null;};}function patchUpdates(_0x2a40d3){return function(_0x519f09){try{jsonpatch[_0x7f72('0x24')](_0x519f09,_0x2a40d3,!![]);}catch(_0x56743b){return BPromise[_0x7f72('0x25')](_0x56743b);}return _0x519f09[_0x7f72('0x26')]();};}function saveUpdates(_0x48f4a6,_0x42739e){return function(_0x15fdc2){if(_0x15fdc2){return _0x15fdc2[_0x7f72('0x27')](_0x48f4a6)['then'](function(_0x1f2165){return _0x1f2165;});}return null;};}function removeEntity(_0x3088d9,_0x5e48ba){return function(_0x2d0fcf){if(_0x2d0fcf){return _0x2d0fcf[_0x7f72('0x28')]()[_0x7f72('0x29')](function(){var _0x1f84bb=_0x2d0fcf['get']({'plain':!![]});var _0xf8caef=_0x7f72('0x2a');return db[_0x7f72('0x2b')][_0x7f72('0x28')]({'where':{'type':_0xf8caef,'resourceId':_0x1f84bb['id']}})[_0x7f72('0x29')](function(){return _0x2d0fcf;});})['then'](function(){_0x3088d9[_0x7f72('0x1d')](0xcc)[_0x7f72('0x1c')]();});}};}function handleEntityNotFound(_0xbf29c8,_0x2e53c7){return function(_0x2e1814){if(!_0x2e1814){_0xbf29c8['sendStatus'](0x194);}return _0x2e1814;};}function handleError(_0x2ed67d,_0x5ce309){_0x5ce309=_0x5ce309||0x1f4;return function(_0x55ca34){logger[_0x7f72('0x2c')](_0x55ca34[_0x7f72('0x2d')]);if(_0x55ca34['name']){delete _0x55ca34[_0x7f72('0x2e')];}_0x2ed67d['status'](_0x5ce309)[_0x7f72('0x2f')](_0x55ca34);};}exports[_0x7f72('0x30')]=function(_0x270ca0,_0x57003d){var _0x51411c={},_0x316aee={},_0x18b577={'count':0x0,'rows':[]};var _0x21673b=_[_0x7f72('0x31')](db[_0x7f72('0x32')][_0x7f72('0x33')],function(_0x240282){return{'name':_0x240282['fieldName'],'type':_0x240282['type']['key']};});_0x316aee['model']=_[_0x7f72('0x31')](_0x21673b,_0x7f72('0x2e'));_0x316aee['query']=_[_0x7f72('0x34')](_0x270ca0['query']);_0x316aee[_0x7f72('0x35')]=_[_0x7f72('0x36')](_0x316aee['model'],_0x316aee[_0x7f72('0x37')]);_0x51411c[_0x7f72('0x38')]=_[_0x7f72('0x36')](_0x316aee['model'],qs[_0x7f72('0x39')](_0x270ca0[_0x7f72('0x37')][_0x7f72('0x39')]));_0x51411c[_0x7f72('0x38')]=_0x51411c[_0x7f72('0x38')]['length']?_0x51411c['attributes']:_0x316aee[_0x7f72('0x3a')];if(!_0x270ca0['query']['hasOwnProperty']('nolimit')){_0x51411c['limit']=qs['limit'](_0x270ca0[_0x7f72('0x37')][_0x7f72('0x21')]);_0x51411c[_0x7f72('0x1f')]=qs['offset'](_0x270ca0['query'][_0x7f72('0x1f')]);}_0x51411c[_0x7f72('0x3b')]=qs[_0x7f72('0x3c')](_0x270ca0[_0x7f72('0x37')]['sort']);_0x51411c[_0x7f72('0x3d')]=qs[_0x7f72('0x35')](_['pick'](_0x270ca0[_0x7f72('0x37')],_0x316aee['filters']),_0x21673b);if(_0x270ca0[_0x7f72('0x37')]['filter']){_0x51411c[_0x7f72('0x3d')]=_[_0x7f72('0x3e')](_0x51411c[_0x7f72('0x3d')],{'$or':_['map'](_0x21673b,function(_0x212464){if(_0x212464['type']!==_0x7f72('0x3f')){var _0x1c6123={};_0x1c6123[_0x212464['name']]={'$like':'%'+_0x270ca0[_0x7f72('0x37')][_0x7f72('0x40')]+'%'};return _0x1c6123;}})});}_0x51411c=_[_0x7f72('0x3e')]({},_0x51411c,_0x270ca0['options']);var _0x383847={'where':_0x51411c[_0x7f72('0x3d')]};return db[_0x7f72('0x32')][_0x7f72('0x22')](_0x383847)['then'](function(_0x2fd395){_0x18b577[_0x7f72('0x22')]=_0x2fd395;if(_0x270ca0[_0x7f72('0x37')][_0x7f72('0x41')]){_0x51411c[_0x7f72('0x42')]=[{'all':!![]}];}return db[_0x7f72('0x32')][_0x7f72('0x43')](_0x51411c);})[_0x7f72('0x29')](function(_0x10d72a){_0x18b577[_0x7f72('0x44')]=_0x10d72a;return _0x18b577;})['then'](respondWithFilteredResult(_0x57003d,_0x51411c))[_0x7f72('0x45')](handleError(_0x57003d,null));};exports[_0x7f72('0x46')]=function(_0x32e8a0,_0x5280d8){var _0x15039d={'raw':!![],'where':{'id':_0x32e8a0[_0x7f72('0x47')]['id']}},_0x362eb0={};_0x362eb0[_0x7f72('0x3a')]=_['keys'](db['Pause']['rawAttributes']);_0x362eb0[_0x7f72('0x37')]=_[_0x7f72('0x34')](_0x32e8a0[_0x7f72('0x37')]);_0x362eb0[_0x7f72('0x35')]=_[_0x7f72('0x36')](_0x362eb0[_0x7f72('0x3a')],_0x362eb0[_0x7f72('0x37')]);_0x15039d[_0x7f72('0x38')]=_[_0x7f72('0x36')](_0x362eb0[_0x7f72('0x3a')],qs[_0x7f72('0x39')](_0x32e8a0[_0x7f72('0x37')]['fields']));_0x15039d[_0x7f72('0x38')]=_0x15039d[_0x7f72('0x38')][_0x7f72('0x48')]?_0x15039d[_0x7f72('0x38')]:_0x362eb0[_0x7f72('0x3a')];if(_0x32e8a0['query'][_0x7f72('0x41')]){_0x15039d[_0x7f72('0x42')]=[{'all':!![]}];}_0x15039d=_[_0x7f72('0x3e')]({},_0x15039d,_0x32e8a0[_0x7f72('0x49')]);return db[_0x7f72('0x32')][_0x7f72('0x4a')](_0x15039d)[_0x7f72('0x29')](handleEntityNotFound(_0x5280d8,null))[_0x7f72('0x29')](respondWithResult(_0x5280d8,null))[_0x7f72('0x45')](handleError(_0x5280d8,null));};exports[_0x7f72('0x4b')]=function(_0x4d5372,_0x49eea7){return db['Pause'][_0x7f72('0x4b')](_0x4d5372[_0x7f72('0x4c')],{})['then'](function(_0x45a8cb){var _0x1a83fd=_0x4d5372[_0x7f72('0x4d')]['get']({'plain':!![]});if(!_0x1a83fd)throw new Error(_0x7f72('0x4e'));if(_0x1a83fd[_0x7f72('0x4f')]==='user'){var _0x4911a4=_0x45a8cb['get']({'plain':!![]});var _0x3922f7=_0x7f72('0x2a');return db[_0x7f72('0x50')][_0x7f72('0x4a')]({'where':{'name':_0x3922f7,'userProfileId':_0x1a83fd[_0x7f72('0x51')]},'raw':!![]})['then'](function(_0x590b4f){if(_0x590b4f&&_0x590b4f['autoAssociation']===0x0){return db[_0x7f72('0x2b')][_0x7f72('0x4b')]({'name':_0x4911a4['name'],'resourceId':_0x4911a4['id'],'type':_0x590b4f[_0x7f72('0x2e')],'sectionId':_0x590b4f['id']},{})[_0x7f72('0x29')](function(){return _0x45a8cb;});}else{return _0x45a8cb;}})[_0x7f72('0x45')](function(_0x40c2e1){logger[_0x7f72('0x2c')](_0x7f72('0x52'),_0x40c2e1);throw _0x40c2e1;});}return _0x45a8cb;})[_0x7f72('0x29')](respondWithResult(_0x49eea7,0xc9))[_0x7f72('0x45')](handleError(_0x49eea7,null));};exports[_0x7f72('0x27')]=function(_0x16665c,_0x423056){if(_0x16665c[_0x7f72('0x4c')]['id']){delete _0x16665c[_0x7f72('0x4c')]['id'];}return db[_0x7f72('0x32')][_0x7f72('0x4a')]({'where':{'id':_0x16665c['params']['id']}})[_0x7f72('0x29')](handleEntityNotFound(_0x423056,null))['then'](saveUpdates(_0x16665c[_0x7f72('0x4c')],null))[_0x7f72('0x29')](respondWithResult(_0x423056,null))[_0x7f72('0x45')](handleError(_0x423056,null));};exports[_0x7f72('0x28')]=function(_0x135588,_0x232266){return db[_0x7f72('0x32')][_0x7f72('0x4a')]({'where':{'id':_0x135588[_0x7f72('0x47')]['id']}})[_0x7f72('0x29')](handleEntityNotFound(_0x232266,null))[_0x7f72('0x29')](removeEntity(_0x232266,null))[_0x7f72('0x45')](handleError(_0x232266,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 76fdc9c..ab3333d 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ced14,_0x542b32){_0x1ced14=_0x1ced14-0x0;var _0x48038a=_0x6aa7[_0x1ced14];return _0x48038a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x30d845,_0x15784d){var _0x2b3919=function(_0x3b6d18){while(--_0x3b6d18){_0x30d845['push'](_0x30d845['shift']());}};_0x2b3919(++_0x15784d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x52efd4,_0x2d5faa){_0x52efd4=_0x52efd4-0x0;var _0x3abc57=_0x1cb9[_0x52efd4];return _0x3abc57;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5819965..ef8a379 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5067fa,_0x429c2b){var _0x4284f7=function(_0x199d7e){while(--_0x199d7e){_0x5067fa['push'](_0x5067fa['shift']());}};_0x4284f7(++_0x429c2b);}(_0x7a54,0x106));var _0x47a5=function(_0x21cab5,_0x21e6c1){_0x21cab5=_0x21cab5-0x0;var _0x14ebb3=_0x7a54[_0x21cab5];return _0x14ebb3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x30304b,_0x3c4e82){var _0x14cebf=function(_0xb0a766){while(--_0xb0a766){_0x30304b['push'](_0x30304b['shift']());}};_0x14cebf(++_0x3c4e82);}(_0xb10b,0x12a));var _0xbb10=function(_0x484e74,_0x4e62bd){_0x484e74=_0x484e74-0x0;var _0x2874fa=_0xb10b[_0x484e74];return _0x2874fa;};'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 d0a8ec4..0c3bd88 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 _0x303a=['show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook'];(function(_0x157b85,_0x299ecf){var _0x343e99=function(_0x202c94){while(--_0x202c94){_0x157b85['push'](_0x157b85['shift']());}};_0x343e99(++_0x299ecf);}(_0x303a,0x1a0));var _0xa303=function(_0x1df956,_0x2944cd){_0x1df956=_0x1df956-0x0;var _0x2eadc7=_0x303a[_0x1df956];return _0x2eadc7;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),controller['webhookGet']);router['get']('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0xd')]);router['get'](_0xa303('0xe'),auth['isAuthenticated'](),controller[_0xa303('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29cd60,_0x17dfcd,_0x382cfd){_0x382cfd(null,path[_0xa303('0x10')](config['root'],_0xa303('0x11')));},'filename':function(_0x4c0169,_0xf5df1e,_0x43a054){_0xf5df1e[_0xa303('0x12')]=_0xf5df1e['originalname'][_0xa303('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43a054(null,util[_0xa303('0x14')](_0xa303('0x15'),path[_0xa303('0x16')](_0xf5df1e[_0xa303('0x12')],path[_0xa303('0x17')](_0xf5df1e[_0xa303('0x12')])),Date[_0xa303('0x18')](),path['extname'](_0xf5df1e[_0xa303('0x12')])));}})});router[_0xa303('0x19')]('/',upload[_0xa303('0x1a')](_0xa303('0x1b')),controller[_0xa303('0x1c')]);router[_0xa303('0x19')]('/webhook',controller[_0xa303('0x1d')]);router['put'](_0xa303('0x1e'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);router['delete'](_0xa303('0x1e'),auth[_0xa303('0xa')](),controller[_0xa303('0x20')]);module['exports']=router; \ No newline at end of file +var _0xd2ea=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','diskStorage','root','server/files/plugins','originalname','replace','extname','now','post','single','file','upload','webhookPost','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c3afd,_0x3e7a45){var _0x4e2ef3=function(_0x426053){while(--_0x426053){_0x4c3afd['push'](_0x4c3afd['shift']());}};_0x4e2ef3(++_0x3e7a45);}(_0xd2ea,0x15f));var _0xad2e=function(_0x59904f,_0x4bc36d){_0x59904f=_0x59904f-0x0;var _0x16d547=_0xd2ea[_0x59904f];return _0x16d547;};'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'),controller[_0xad2e('0xd')]);router['get'](_0xad2e('0xe'),auth[_0xad2e('0xb')](),controller['show']);router[_0xad2e('0xa')]('/:id/download',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);var upload=multer({'storage':multer[_0xad2e('0x10')]({'destination':function(_0x24c5da,_0x489f25,_0x7df3c6){_0x7df3c6(null,path['join'](config[_0xad2e('0x11')],_0xad2e('0x12')));},'filename':function(_0x433696,_0x42e2f2,_0x59a342){_0x42e2f2[_0xad2e('0x13')]=_0x42e2f2['originalname'][_0xad2e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59a342(null,util['format']('%s-%s%s',path['basename'](_0x42e2f2['originalname'],path[_0xad2e('0x15')](_0x42e2f2[_0xad2e('0x13')])),Date[_0xad2e('0x16')](),path[_0xad2e('0x15')](_0x42e2f2[_0xad2e('0x13')])));}})});router[_0xad2e('0x17')]('/',upload[_0xad2e('0x18')](_0xad2e('0x19')),controller[_0xad2e('0x1a')]);router[_0xad2e('0x17')](_0xad2e('0xc'),controller[_0xad2e('0x1b')]);router[_0xad2e('0x1c')](_0xad2e('0xe'),auth[_0xad2e('0xb')](),controller['update']);router[_0xad2e('0x1d')](_0xad2e('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 63dffc7..e101a1e 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 _0x2e89=['TEXT','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','ENUM','script'];(function(_0x3a6d6f,_0x5ce916){var _0x358c07=function(_0x4282c2){while(--_0x4282c2){_0x3a6d6f['push'](_0x3a6d6f['shift']());}};_0x358c07(++_0x5ce916);}(_0x2e89,0x19f));var _0x92e8=function(_0x313b92,_0x48c2b5){_0x313b92=_0x313b92-0x0;var _0x421fd8=_0x2e89[_0x313b92];return _0x421fd8;};'use strict';var Sequelize=require(_0x92e8('0x0'));module[_0x92e8('0x1')]={'name':{'type':Sequelize[_0x92e8('0x2')]},'type':{'type':Sequelize[_0x92e8('0x3')]('html',_0x92e8('0x4'))},'description':{'type':Sequelize[_0x92e8('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x92e8('0x6')},'sidebar':{'type':Sequelize[_0x92e8('0x3')](_0x92e8('0x7'),_0x92e8('0x8'),_0x92e8('0x9'),_0x92e8('0xa')),'defaultValue':_0x92e8('0x9'),'comment':_0x92e8('0xb')},'icon':{'type':Sequelize[_0x92e8('0x2')]},'adminUrl':{'type':Sequelize[_0x92e8('0x2')]},'agentUrl':{'type':Sequelize[_0x92e8('0x2')]},'scriptName':{'type':Sequelize[_0x92e8('0x2')]},'scriptPath':{'type':Sequelize[_0x92e8('0x2')]}}; \ No newline at end of file +var _0xaab5=['exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x265813,_0x5ac4bc){var _0x113954=function(_0x9f7990){while(--_0x9f7990){_0x265813['push'](_0x265813['shift']());}};_0x113954(++_0x5ac4bc);}(_0xaab5,0x150));var _0x5aab=function(_0x34a690,_0x388bc9){_0x34a690=_0x34a690-0x0;var _0x3a96f2=_0xaab5[_0x34a690];return _0x3a96f2;};'use strict';var Sequelize=require('sequelize');module[_0x5aab('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5aab('0x1')](_0x5aab('0x2'),_0x5aab('0x3'))},'description':{'type':Sequelize[_0x5aab('0x4')]},'version':{'type':Sequelize[_0x5aab('0x4')]},'path':{'type':Sequelize[_0x5aab('0x5')],'comment':_0x5aab('0x6')},'active':{'type':Sequelize[_0x5aab('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5aab('0x1')](_0x5aab('0x8'),_0x5aab('0x9'),_0x5aab('0xa'),'never'),'defaultValue':'always','comment':_0x5aab('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x5aab('0x5')]},'agentUrl':{'type':Sequelize[_0x5aab('0x5')]},'scriptName':{'type':Sequelize[_0x5aab('0x5')]},'scriptPath':{'type':Sequelize[_0x5aab('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ed66d53..b8789db 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 _0xcdd2=['squel','jsforce','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./plugin.socket','register','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','get','Plugins','UserProfileResource','end','error','name','index','map','Plugin','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','includeAll','catch','download','find','params','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','manifest.json','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x1cff42,_0x2d0ba0){var _0x5ee0a8=function(_0x1d35db){while(--_0x1d35db){_0x1cff42['push'](_0x1cff42['shift']());}};_0x5ee0a8(++_0x2d0ba0);}(_0xcdd2,0x98));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2cdd('0x0'));var rimraf=require(_0x2cdd('0x1'));var zipdir=require(_0x2cdd('0x2'));var jsonpatch=require(_0x2cdd('0x3'));var rp=require(_0x2cdd('0x4'));var moment=require(_0x2cdd('0x5'));var BPromise=require(_0x2cdd('0x6'));var Mustache=require(_0x2cdd('0x7'));var util=require(_0x2cdd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2cdd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2cdd('0xa'));var crypto=require('crypto');var jsforce=require(_0x2cdd('0xb'));var deskjs=require(_0x2cdd('0xc'));var toCsv=require(_0x2cdd('0x9'));var querystring=require('querystring');var Papa=require(_0x2cdd('0xd'));var extract=require(_0x2cdd('0xe'));var rimraf=require(_0x2cdd('0x1'));var archiver=require(_0x2cdd('0xf'));var Redis=require('ioredis');var authService=require(_0x2cdd('0x10'));var qs=require(_0x2cdd('0x11'));var as=require(_0x2cdd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2cdd('0x13'));var utils=require(_0x2cdd('0x14'));var config=require(_0x2cdd('0x15'));var licenseUtil=require(_0x2cdd('0x16'));var db=require(_0x2cdd('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x2cdd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cdd('0x19')]));require(_0x2cdd('0x1a'))[_0x2cdd('0x1b')](socket);function respondWithStatusCode(_0x5bf1a2,_0x41041d){_0x41041d=_0x41041d||0xcc;return function(_0x176e46){if(_0x176e46){return _0x5bf1a2[_0x2cdd('0x1c')](_0x41041d);}return _0x5bf1a2[_0x2cdd('0x1d')](_0x41041d)['end']();};}function respondWithResult(_0xfb0f13,_0x16c982){_0x16c982=_0x16c982||0xc8;return function(_0x42c5c8){if(_0x42c5c8){return _0xfb0f13[_0x2cdd('0x1d')](_0x16c982)['json'](_0x42c5c8);}};}function respondWithFilteredResult(_0x264af9,_0x130c6f){return function(_0x2f6041){if(_0x2f6041){var _0x7e1960=typeof _0x130c6f['offset']==='undefined'&&typeof _0x130c6f[_0x2cdd('0x1e')]===_0x2cdd('0x1f');var _0x37b2e8=_0x2f6041[_0x2cdd('0x20')];var _0x4f5a93=_0x7e1960?0x0:_0x130c6f[_0x2cdd('0x21')];var _0x2fc5d9=_0x7e1960?_0x2f6041[_0x2cdd('0x20')]:_0x130c6f[_0x2cdd('0x21')]+_0x130c6f['limit'];var _0x26e1c9;if(_0x2fc5d9>=_0x37b2e8){_0x2fc5d9=_0x37b2e8;_0x26e1c9=0xc8;}else{_0x26e1c9=0xce;}_0x264af9[_0x2cdd('0x1d')](_0x26e1c9);return _0x264af9[_0x2cdd('0x22')](_0x2cdd('0x23'),_0x4f5a93+'-'+_0x2fc5d9+'/'+_0x37b2e8)[_0x2cdd('0x24')](_0x2f6041);}return null;};}function patchUpdates(_0x44858a){return function(_0x43adbd){try{jsonpatch[_0x2cdd('0x25')](_0x43adbd,_0x44858a,!![]);}catch(_0x251ce5){return BPromise[_0x2cdd('0x26')](_0x251ce5);}return _0x43adbd[_0x2cdd('0x27')]();};}function saveUpdates(_0x330785,_0x7e4c89){return function(_0x46600b){if(_0x46600b){return _0x46600b['update'](_0x330785)['then'](function(_0x1dab0b){return _0x1dab0b;});}return null;};}function removeEntity(_0x1ef7e5,_0x292386){return function(_0x20de90){if(_0x20de90){return _0x20de90[_0x2cdd('0x28')]()[_0x2cdd('0x29')](function(){var _0x90a1d3=_0x20de90[_0x2cdd('0x2a')]({'plain':!![]});var _0x3828c1=_0x2cdd('0x2b');return db[_0x2cdd('0x2c')][_0x2cdd('0x28')]({'where':{'type':_0x3828c1,'resourceId':_0x90a1d3['id']}})[_0x2cdd('0x29')](function(){return _0x20de90;});})[_0x2cdd('0x29')](function(){_0x1ef7e5[_0x2cdd('0x1d')](0xcc)[_0x2cdd('0x2d')]();});}};}function handleEntityNotFound(_0x5b9efe,_0x5df35f){return function(_0x1f5ccf){if(!_0x1f5ccf){_0x5b9efe[_0x2cdd('0x1c')](0x194);}return _0x1f5ccf;};}function handleError(_0x451cb2,_0x996b67){_0x996b67=_0x996b67||0x1f4;return function(_0x552682){logger[_0x2cdd('0x2e')](_0x552682['stack']);if(_0x552682[_0x2cdd('0x2f')]){delete _0x552682[_0x2cdd('0x2f')];}_0x451cb2[_0x2cdd('0x1d')](_0x996b67)['send'](_0x552682);};}exports[_0x2cdd('0x30')]=function(_0x4362ee,_0x3df8e6){var _0x96992c={},_0x110cd8={},_0x141018={'count':0x0,'rows':[]};var _0x28e3c9=_[_0x2cdd('0x31')](db[_0x2cdd('0x32')][_0x2cdd('0x33')],function(_0x2ea0c0){return{'name':_0x2ea0c0['fieldName'],'type':_0x2ea0c0['type'][_0x2cdd('0x34')]};});_0x110cd8['model']=_[_0x2cdd('0x31')](_0x28e3c9,_0x2cdd('0x2f'));_0x110cd8['query']=_[_0x2cdd('0x35')](_0x4362ee[_0x2cdd('0x36')]);_0x110cd8[_0x2cdd('0x37')]=_['intersection'](_0x110cd8[_0x2cdd('0x38')],_0x110cd8[_0x2cdd('0x36')]);_0x96992c[_0x2cdd('0x39')]=_[_0x2cdd('0x3a')](_0x110cd8[_0x2cdd('0x38')],qs[_0x2cdd('0x3b')](_0x4362ee[_0x2cdd('0x36')][_0x2cdd('0x3b')]));_0x96992c[_0x2cdd('0x39')]=_0x96992c['attributes'][_0x2cdd('0x3c')]?_0x96992c[_0x2cdd('0x39')]:_0x110cd8[_0x2cdd('0x38')];if(!_0x4362ee['query']['hasOwnProperty'](_0x2cdd('0x3d'))){_0x96992c['limit']=qs[_0x2cdd('0x1e')](_0x4362ee[_0x2cdd('0x36')][_0x2cdd('0x1e')]);_0x96992c[_0x2cdd('0x21')]=qs[_0x2cdd('0x21')](_0x4362ee[_0x2cdd('0x36')][_0x2cdd('0x21')]);}_0x96992c['order']=qs[_0x2cdd('0x3e')](_0x4362ee[_0x2cdd('0x36')][_0x2cdd('0x3e')]);_0x96992c[_0x2cdd('0x3f')]=qs[_0x2cdd('0x37')](_['pick'](_0x4362ee[_0x2cdd('0x36')],_0x110cd8[_0x2cdd('0x37')]),_0x28e3c9);if(_0x4362ee['query'][_0x2cdd('0x40')]){_0x96992c['where']=_[_0x2cdd('0x41')](_0x96992c[_0x2cdd('0x3f')],{'$or':_[_0x2cdd('0x31')](_0x28e3c9,function(_0x158cf6){if(_0x158cf6[_0x2cdd('0x42')]!==_0x2cdd('0x43')){var _0x488c0b={};_0x488c0b[_0x158cf6[_0x2cdd('0x2f')]]={'$like':'%'+_0x4362ee[_0x2cdd('0x36')][_0x2cdd('0x40')]+'%'};return _0x488c0b;}})});}_0x96992c=_[_0x2cdd('0x41')]({},_0x96992c,_0x4362ee[_0x2cdd('0x44')]);var _0x3c9571={'where':_0x96992c['where']};return db[_0x2cdd('0x32')]['count'](_0x3c9571)[_0x2cdd('0x29')](function(_0x3db700){_0x141018[_0x2cdd('0x20')]=_0x3db700;if(_0x4362ee['query']['includeAll']){_0x96992c[_0x2cdd('0x45')]=[{'all':!![]}];}return db[_0x2cdd('0x32')][_0x2cdd('0x46')](_0x96992c);})[_0x2cdd('0x29')](function(_0xbb8137){_0x141018[_0x2cdd('0x47')]=_0xbb8137;return _0x141018;})['then'](respondWithFilteredResult(_0x3df8e6,_0x96992c))['catch'](handleError(_0x3df8e6,null));};exports['show']=function(_0x17897b,_0x434b02){var _0x51c21c={'raw':!![],'where':{'id':_0x17897b['params']['id']}},_0x3ace47={};_0x3ace47[_0x2cdd('0x38')]=_[_0x2cdd('0x35')](db[_0x2cdd('0x32')][_0x2cdd('0x33')]);_0x3ace47[_0x2cdd('0x36')]=_['keys'](_0x17897b['query']);_0x3ace47[_0x2cdd('0x37')]=_[_0x2cdd('0x3a')](_0x3ace47[_0x2cdd('0x38')],_0x3ace47['query']);_0x51c21c['attributes']=_[_0x2cdd('0x3a')](_0x3ace47[_0x2cdd('0x38')],qs['fields'](_0x17897b[_0x2cdd('0x36')][_0x2cdd('0x3b')]));_0x51c21c[_0x2cdd('0x39')]=_0x51c21c[_0x2cdd('0x39')][_0x2cdd('0x3c')]?_0x51c21c[_0x2cdd('0x39')]:_0x3ace47[_0x2cdd('0x38')];if(_0x17897b[_0x2cdd('0x36')][_0x2cdd('0x48')]){_0x51c21c[_0x2cdd('0x45')]=[{'all':!![]}];}_0x51c21c=_['merge']({},_0x51c21c,_0x17897b[_0x2cdd('0x44')]);return db[_0x2cdd('0x32')]['find'](_0x51c21c)[_0x2cdd('0x29')](handleEntityNotFound(_0x434b02,null))['then'](respondWithResult(_0x434b02,null))[_0x2cdd('0x49')](handleError(_0x434b02,null));};exports[_0x2cdd('0x4a')]=function(_0x1104e3,_0x394583,_0x3179b4){return db[_0x2cdd('0x32')][_0x2cdd('0x4b')]({'where':{'id':_0x1104e3[_0x2cdd('0x4c')]['id']},'attributes':[_0x2cdd('0x2f'),_0x2cdd('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x394583,null))[_0x2cdd('0x29')](function(_0x1717d2){if(_0x1717d2){var _0x2b71f9=path[_0x2cdd('0x4e')](config[_0x2cdd('0x4f')],_0x2cdd('0x50'),util[_0x2cdd('0x51')](_0x2cdd('0x52'),path[_0x2cdd('0x53')](_0x1717d2[_0x2cdd('0x4d')])));var _0x51b6e1=fs[_0x2cdd('0x54')](_0x2b71f9);var _0x2d5423=archiver(_0x2cdd('0x55'),{'zlib':{'level':0x9}});_0x2d5423['on'](_0x2cdd('0x56'),function(_0x56a599){if(_0x56a599['code']==='ENOENT'){logger[_0x2cdd('0x2e')](_0x56a599);}else{throw new db[(_0x2cdd('0x57'))][(_0x2cdd('0x58'))](_0x2cdd('0x59'));}});_0x2d5423['on'](_0x2cdd('0x2e'),function(_0xd6e27f){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2d5423['pipe'](_0x51b6e1);_0x2d5423['glob']('**/*',{'cwd':path[_0x2cdd('0x4e')](config[_0x2cdd('0x4f')],_0x2cdd('0x50'),path['dirname'](_0x1717d2[_0x2cdd('0x4d')])),'ignore':[path[_0x2cdd('0x4e')](path['basename'](_0x1717d2[_0x2cdd('0x4d')]),_0x2cdd('0x5a')),path[_0x2cdd('0x4e')](path['basename'](_0x1717d2[_0x2cdd('0x4d')]),'attachments/**/*')],'nodir':!![]})[_0x2cdd('0x5b')]();_0x51b6e1['on']('close',function(){if(!fs[_0x2cdd('0x5c')](_0x2b71f9)){throw new db[(_0x2cdd('0x57'))][(_0x2cdd('0x58'))](_0x2cdd('0x5d'));}return _0x394583[_0x2cdd('0x4a')](_0x2b71f9,util[_0x2cdd('0x51')](_0x2cdd('0x52'),path[_0x2cdd('0x53')](_0x1717d2[_0x2cdd('0x4d')])),function(_0x3a741c){if(_0x3a741c){throw new db[(_0x2cdd('0x57'))][(_0x2cdd('0x58'))](_0x2cdd('0x5e'));}fs['unlinkSync'](_0x2b71f9);logger[_0x2cdd('0x5f')](_0x2cdd('0x60'));logger['info'](_0x2cdd('0x61'));});});}return null;})[_0x2cdd('0x49')](handleError(_0x394583,null));};exports[_0x2cdd('0x62')]=function(_0x47d7db,_0x4f05fc,_0x4f1e10){var _0x5d58b9=path[_0x2cdd('0x53')](_0x47d7db[_0x2cdd('0x63')]['filename'],path['extname'](_0x47d7db[_0x2cdd('0x63')][_0x2cdd('0x64')]));var _0x45099e=path[_0x2cdd('0x4e')](config['root'],_0x2cdd('0x50'),_0x47d7db[_0x2cdd('0x63')][_0x2cdd('0x64')]);var _0x25c773=path[_0x2cdd('0x4e')](config['root'],_0x2cdd('0x50'),_0x5d58b9);logger[_0x2cdd('0x5f')]('Plugin\x20upload\x20filepath:\x20%s',_0x45099e);logger[_0x2cdd('0x5f')](_0x2cdd('0x65'),_0x25c773);try{fs['chmodSync'](_0x45099e,parseInt('0777',0x8));extract(_0x45099e,{'dir':_0x25c773},function(_0x3666c8){if(_0x3666c8){logger['error'](_0x3666c8);handleError(_0x3666c8,!![]);};var _0x5e78a1=fs['readdirSync'](_0x25c773);if(_0x5e78a1[_0x2cdd('0x3c')]>0x1){removeReferences(_0x45099e,_0x25c773);logger[_0x2cdd('0x2e')](_0x2cdd('0x66'));return _0x4f1e10(new Error('Invalid\x20plugin\x20structure'));}var _0x2dfa03=fs['lstatSync'](path[_0x2cdd('0x4e')](_0x25c773,_0x5e78a1[0x0]));if(_0x2dfa03[_0x2cdd('0x67')]()){removeReferences(_0x45099e,_0x25c773);logger[_0x2cdd('0x2e')](_0x2cdd('0x66'));return _0x4f1e10(new Error(_0x2cdd('0x66')));}if(_0x2dfa03[_0x2cdd('0x68')]()){var _0x40cf41=fs[_0x2cdd('0x69')](path[_0x2cdd('0x4e')](_0x25c773,_0x5e78a1[0x0]));if(_0x40cf41[_0x2cdd('0x3c')]===0x0){removeReferences(_0x45099e,_0x25c773);logger[_0x2cdd('0x2e')]('Invalid\x20plugin\x20structure');return _0x4f1e10(new Error('Invalid\x20plugin\x20structure'));}var _0x475906=_0x40cf41['some'](function(_0x503eb0){return _0x503eb0===_0x2cdd('0x6a');});if(!_0x475906){return _0x4f1e10(new Error('Plugin\x20manifest\x20missing'));}var _0x35d0e0=fs['readFileSync'](path[_0x2cdd('0x4e')](_0x25c773,_0x5e78a1[0x0],_0x2cdd('0x6a')));var _0x70863a=JSON['parse'](_0x35d0e0);if(_0x2cdd('0x1f')==typeof _0x70863a[_0x2cdd('0x2f')]){return _0x4f1e10(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x70863a['type']){return _0x4f1e10(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x2cdd('0x1f')==typeof _0x70863a[_0x2cdd('0x6b')]){return _0x4f1e10(new Error(_0x2cdd('0x6c')));}if(_0x2cdd('0x1f')==typeof _0x70863a['parameters']){return _0x4f1e10(new Error(_0x2cdd('0x6d')));}if(_0x70863a[_0x2cdd('0x42')]===_0x2cdd('0x6e')){if('undefined'==typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')]){return _0x4f1e10(new Error(_0x2cdd('0x71')));}if(_0x2cdd('0x1f')==typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')]['admin']&&'undefined'==typeof _0x70863a[_0x2cdd('0x6f')]['views'][_0x2cdd('0x72')]){return _0x4f1e10(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x70863a['type']===_0x2cdd('0x73')){if(_0x2cdd('0x1f')==typeof _0x70863a[_0x2cdd('0x6f')]['scriptName']){return _0x4f1e10(new Error(_0x2cdd('0x74')));}if(_0x2cdd('0x1f')==typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x75')]){return _0x4f1e10(new Error(_0x2cdd('0x76')));}}else{return _0x4f1e10(new Error(_0x2cdd('0x77')));}var _0x28ba92=_0x70863a[_0x2cdd('0x2f')];var _0x41c525=_0x70863a[_0x2cdd('0x78')];var _0x4acc42=_0x70863a[_0x2cdd('0x42')];var _0x35ec07=_0x70863a['sidebar']?_0x70863a[_0x2cdd('0x79')]:_0x2cdd('0x7a');var _0x2cf8b1=_0x70863a[_0x2cdd('0x7b')]?_0x70863a[_0x2cdd('0x7b')]:_0x2cdd('0x7c');var _0x3af737='';var _0x1fd39e='';var _0x57cffb='';var _0x517955='';var _0x5c44b4=_0x70863a[_0x2cdd('0x6b')];if(_0x4acc42===_0x2cdd('0x6e')){if('undefined'!=typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')][_0x2cdd('0x7d')]){var _0x2d01cd=_0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x2cdd('0x7e')](_0x2d01cd)){_0x3af737=path[_0x2cdd('0x4e')](_0x2cdd('0x7f'),_0x5d58b9,_0x5e78a1[0x0],_0x2d01cd);}else{_0x3af737=_0x2d01cd;}}else{logger[_0x2cdd('0x5f')](_0x2cdd('0x80'));}if(_0x2cdd('0x1f')!=typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')]['agent']){var _0x2b4ad1=_0x70863a['parameters'][_0x2cdd('0x70')][_0x2cdd('0x72')];if(!/^(f|ht)tps?:\/\//i[_0x2cdd('0x7e')](_0x2b4ad1)){_0x1fd39e=path[_0x2cdd('0x4e')](_0x2cdd('0x7f'),_0x5d58b9,_0x5e78a1[0x0],_0x2b4ad1);}else{_0x1fd39e=_0x2b4ad1;}}else{logger[_0x2cdd('0x5f')](_0x2cdd('0x81'));}}else if(_0x4acc42===_0x2cdd('0x73')){_0x57cffb=_0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x82')];_0x517955=_0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x75')];if(_0x2cdd('0x1f')!=typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')]){if(_0x2cdd('0x1f')!=typeof _0x70863a['parameters'][_0x2cdd('0x70')][_0x2cdd('0x7d')]){var _0x2d01cd=_0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')][_0x2cdd('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x2cdd('0x7e')](_0x2d01cd)){_0x3af737=path['join'](_0x2cdd('0x7f'),_0x5d58b9,_0x5e78a1[0x0],_0x2d01cd);}else{_0x3af737=_0x2d01cd;}}if('undefined'!=typeof _0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')][_0x2cdd('0x72')]){var _0x2b4ad1=_0x70863a[_0x2cdd('0x6f')][_0x2cdd('0x70')][_0x2cdd('0x72')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2b4ad1)){_0x1fd39e=path[_0x2cdd('0x4e')](_0x2cdd('0x7f'),_0x5d58b9,_0x5e78a1[0x0],_0x2b4ad1);}else{_0x1fd39e=_0x2b4ad1;}}}}var _0x45d01e={'name':_0x28ba92,'description':_0x41c525,'path':path[_0x2cdd('0x4e')](_0x5d58b9,_0x5e78a1[0x0]),'type':_0x4acc42,'sidebar':_0x35ec07,'icon':_0x2cf8b1,'adminUrl':_0x3af737,'agentUrl':_0x1fd39e,'scriptName':_0x57cffb,'scriptPath':_0x517955,'version':_0x5c44b4};removeReferences(_0x45099e,null);return db['Plugin'][_0x2cdd('0x83')](_0x45d01e)[_0x2cdd('0x29')](function(_0x48b05a){var _0x418a24={'role':_0x47d7db[_0x2cdd('0x84')][_0x2cdd('0x85')],'userProfileId':_0x47d7db[_0x2cdd('0x84')]['userProfileId']};if(!_0x418a24)throw new Error(_0x2cdd('0x86'));if(_0x418a24[_0x2cdd('0x85')]===_0x2cdd('0x87')){var _0xeb1d6c=_0x48b05a[_0x2cdd('0x2a')]({'plain':!![]});return db[_0x2cdd('0x88')][_0x2cdd('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x418a24[_0x2cdd('0x89')]},'raw':!![]})[_0x2cdd('0x29')](function(_0x134a7f){if(_0x134a7f&&_0x134a7f[_0x2cdd('0x8a')]===0x0){return db['UserProfileResource']['create']({'name':_0xeb1d6c[_0x2cdd('0x2f')],'resourceId':_0xeb1d6c['id'],'type':_0x134a7f[_0x2cdd('0x2f')],'sectionId':_0x134a7f['id']},{})[_0x2cdd('0x29')](function(){return _0x48b05a;});}else{return _0x48b05a;}})[_0x2cdd('0x49')](function(_0x3a460f){logger[_0x2cdd('0x2e')](_0x2cdd('0x8b'),_0x3a460f);throw _0x3a460f;});}return _0x48b05a;})[_0x2cdd('0x29')](respondWithResult(_0x4f05fc,null))[_0x2cdd('0x49')](handleError(_0x4f05fc,null));}});}catch(_0x5baa63){_0x4f05fc[_0x2cdd('0x1d')](0x1f4)[_0x2cdd('0x8c')](_0x5baa63);}};function removeReferences(_0x500e48,_0xd4cf28){try{if(_0x500e48){fs[_0x2cdd('0x8d')](_0x500e48);logger[_0x2cdd('0x5f')](_0x2cdd('0x8e'));}if(_0xd4cf28){rimraf(_0xd4cf28,function(){});logger[_0x2cdd('0x5f')](_0x2cdd('0x8f'));}}catch(_0x3f661a){logger['error'](_0x3f661a);}}exports[_0x2cdd('0x90')]=function(_0x77324d,_0x3623e0,_0x11878b){return db[_0x2cdd('0x32')][_0x2cdd('0x4b')]({'where':{'id':_0x77324d[_0x2cdd('0x4c')]['id']}})[_0x2cdd('0x29')](handleEntityNotFound(_0x3623e0,null))[_0x2cdd('0x29')](saveUpdates(_0x77324d['body'],null))[_0x2cdd('0x29')](respondWithResult(_0x3623e0,null))['catch'](handleError(_0x3623e0,null));};exports['delete']=function(_0x47b8ad,_0x45fae6,_0x22137d){return db[_0x2cdd('0x32')][_0x2cdd('0x4b')]({'where':{'id':_0x47b8ad[_0x2cdd('0x4c')]['id']}})[_0x2cdd('0x29')](function(_0x4c2978){if(_0x4c2978){return _0x4c2978[_0x2cdd('0x28')]();}})['then'](function(_0x58d4d5){rimraf(path[_0x2cdd('0x4e')](config[_0x2cdd('0x4f')],'server/files/plugins',path[_0x2cdd('0x91')](_0x58d4d5['path'])),function(){});return _0x58d4d5;})[_0x2cdd('0x29')](handleEntityNotFound(_0x45fae6,null))[_0x2cdd('0x29')](respondWithStatusCode(_0x45fae6,null))['catch'](handleError(_0x45fae6,null));};exports[_0x2cdd('0x92')]=function(_0x3e363f,_0x4c97a8,_0x3f165b){return BPromise['resolve']()[_0x2cdd('0x29')](function(){if(!_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x4d')]){throw new Error(_0x2cdd('0x93'));}if(!_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x94')]){throw new Error(_0x2cdd('0x95'));}var _0x907da8=_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x96')]?_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x96')]+':'+_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x94')]:_0x2cdd('0x97')+_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x94')];var _0x29ac9b=_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x24')]?_0x3e363f[_0x2cdd('0x36')]['json']:!![];var _0x4c9816=_0x3e363f['query'][_0x2cdd('0x98')]?_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x98')]:null;var _0x5d1b2a={'method':_0x3e363f[_0x2cdd('0x99')],'uri':util[_0x2cdd('0x51')]('%s%s',_0x907da8,_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x4d')]),'json':_0x29ac9b,'resolveWithFullResponse':!![],'encoding':_0x4c9816,'qs':_0x3e363f[_0x2cdd('0x36')]};if(_0x3e363f['headers']){_0x5d1b2a['headers']=_0x3e363f[_0x2cdd('0x9a')];if(_0x5d1b2a[_0x2cdd('0x9a')][_0x2cdd('0x9b')]){delete _0x5d1b2a[_0x2cdd('0x9a')][_0x2cdd('0x9b')];}}if(_0x5d1b2a[_0x2cdd('0x9a')][_0x2cdd('0x9c')]){delete _0x5d1b2a[_0x2cdd('0x9a')]['content-type'];}return rp(_0x5d1b2a);})['then'](function(_0x367639){if(_0x367639){_0x4c97a8[_0x2cdd('0x22')](_0x367639[_0x2cdd('0x9a')]);logger['info'](_0x367639['body']);if(_[_0x2cdd('0x9d')](_0x3e363f[_0x2cdd('0x36')][_0x2cdd('0x4d')],_0x2cdd('0x4a'))&&_0x367639[_0x2cdd('0x9e')]==0x1f4){return _0x4c97a8['sendStatus'](_0x367639[_0x2cdd('0x9e')]);}else{return _0x4c97a8[_0x2cdd('0x1d')](_0x367639[_0x2cdd('0x9e')])[_0x2cdd('0x8c')](_0x367639[_0x2cdd('0x84')]);}}else{return _0x4c97a8[_0x2cdd('0x1c')](0xc8);}})[_0x2cdd('0x49')](handleError(_0x4c97a8,null));};exports[_0x2cdd('0x9f')]=function(_0x4d962a,_0x39070d,_0x1fac3c){return BPromise[_0x2cdd('0xa0')]()['then'](function(){if(!_0x4d962a[_0x2cdd('0x36')]['path']){throw new Error(_0x2cdd('0x93'));}if(!_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x94')]){throw new Error(_0x2cdd('0x95'));}var _0xcf46c=_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x96')]?_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x96')]+':'+_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x94')]:_0x2cdd('0x97')+_0x4d962a[_0x2cdd('0x36')]['port'];var _0x12b53d=_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x24')]?_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x24')]:!![];var _0x5ac738=_0x4d962a[_0x2cdd('0x36')]['encoding']?_0x4d962a[_0x2cdd('0x36')][_0x2cdd('0x98')]:null;var _0x426de5={'method':_0x4d962a['method'],'uri':util[_0x2cdd('0x51')](_0x2cdd('0xa1'),_0xcf46c,_0x4d962a['query'][_0x2cdd('0x4d')]),'json':_0x12b53d,'resolveWithFullResponse':!![],'encoding':_0x5ac738,'body':_0x4d962a[_0x2cdd('0x84')]};if(_0x4d962a['headers']){_0x426de5['headers']=_0x4d962a[_0x2cdd('0x9a')];if(_0x426de5[_0x2cdd('0x9a')][_0x2cdd('0x9b')]){delete _0x426de5[_0x2cdd('0x9a')][_0x2cdd('0x9b')];}}if(_0x426de5[_0x2cdd('0x9a')][_0x2cdd('0x9c')]){delete _0x426de5[_0x2cdd('0x9a')]['content-type'];}return rp(_0x426de5);})[_0x2cdd('0x29')](function(_0x4f4986){if(_0x4f4986){_0x39070d['set'](_0x4f4986[_0x2cdd('0x9a')]);logger[_0x2cdd('0x5f')](_0x4f4986[_0x2cdd('0x84')]);return _0x39070d[_0x2cdd('0x1d')](_0x4f4986[_0x2cdd('0x9e')])[_0x2cdd('0x8c')](_0x4f4986[_0x2cdd('0x84')]);}else{return _0x39070d[_0x2cdd('0x1c')](0xc8);}})[_0x2cdd('0x49')](handleError(_0x39070d,null));}; \ No newline at end of file +var _0xbff1=['root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','port','json','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','name','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Plugin','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','download','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbff1,0x108));var _0x1bff=function(_0xdee7ec,_0x29d552){_0xdee7ec=_0xdee7ec-0x0;var _0x1879b6=_0xbff1[_0xdee7ec];return _0x1879b6;};'use strict';var emlformat=require(_0x1bff('0x0'));var rimraf=require(_0x1bff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bff('0x2'));var rp=require(_0x1bff('0x3'));var moment=require(_0x1bff('0x4'));var BPromise=require(_0x1bff('0x5'));var Mustache=require(_0x1bff('0x6'));var util=require(_0x1bff('0x7'));var path=require(_0x1bff('0x8'));var sox=require(_0x1bff('0x9'));var csv=require(_0x1bff('0xa'));var ejs=require(_0x1bff('0xb'));var fs=require('fs');var fs_extra=require(_0x1bff('0xc'));var _=require(_0x1bff('0xd'));var squel=require(_0x1bff('0xe'));var crypto=require(_0x1bff('0xf'));var jsforce=require(_0x1bff('0x10'));var deskjs=require(_0x1bff('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1bff('0x12'));var Papa=require(_0x1bff('0x13'));var extract=require('extract-zip');var rimraf=require(_0x1bff('0x1'));var archiver=require(_0x1bff('0x14'));var Redis=require(_0x1bff('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1bff('0x16'));var logger=require(_0x1bff('0x17'))(_0x1bff('0x18'));var utils=require(_0x1bff('0x19'));var config=require(_0x1bff('0x1a'));var licenseUtil=require(_0x1bff('0x1b'));var db=require(_0x1bff('0x1c'))['db'];config['redis']=_['defaults'](config[_0x1bff('0x1d')],{'host':_0x1bff('0x1e'),'port':0x18eb});var socket=require(_0x1bff('0x1f'))(new Redis(config['redis']));require(_0x1bff('0x20'))[_0x1bff('0x21')](socket);function respondWithStatusCode(_0x58e6f9,_0x558567){_0x558567=_0x558567||0xcc;return function(_0x1055be){if(_0x1055be){return _0x58e6f9[_0x1bff('0x22')](_0x558567);}return _0x58e6f9[_0x1bff('0x23')](_0x558567)[_0x1bff('0x24')]();};}function respondWithResult(_0x54c63,_0x56eb5e){_0x56eb5e=_0x56eb5e||0xc8;return function(_0x48896b){if(_0x48896b){return _0x54c63[_0x1bff('0x23')](_0x56eb5e)['json'](_0x48896b);}};}function respondWithFilteredResult(_0xc48ecc,_0x1a25be){return function(_0x280cf1){if(_0x280cf1){var _0x261830=typeof _0x1a25be[_0x1bff('0x25')]===_0x1bff('0x26')&&typeof _0x1a25be[_0x1bff('0x27')]===_0x1bff('0x26');var _0x3c9086=_0x280cf1[_0x1bff('0x28')];var _0x443b04=_0x261830?0x0:_0x1a25be[_0x1bff('0x25')];var _0x28135b=_0x261830?_0x280cf1[_0x1bff('0x28')]:_0x1a25be[_0x1bff('0x25')]+_0x1a25be[_0x1bff('0x27')];var _0x3dd3c0;if(_0x28135b>=_0x3c9086){_0x28135b=_0x3c9086;_0x3dd3c0=0xc8;}else{_0x3dd3c0=0xce;}_0xc48ecc[_0x1bff('0x23')](_0x3dd3c0);return _0xc48ecc[_0x1bff('0x29')](_0x1bff('0x2a'),_0x443b04+'-'+_0x28135b+'/'+_0x3c9086)['json'](_0x280cf1);}return null;};}function patchUpdates(_0x541eb2){return function(_0x1f1842){try{jsonpatch[_0x1bff('0x2b')](_0x1f1842,_0x541eb2,!![]);}catch(_0x3dfc55){return BPromise[_0x1bff('0x2c')](_0x3dfc55);}return _0x1f1842['save']();};}function saveUpdates(_0x5aa6e5,_0xcd9514){return function(_0x43cada){if(_0x43cada){return _0x43cada[_0x1bff('0x2d')](_0x5aa6e5)[_0x1bff('0x2e')](function(_0x22f7e0){return _0x22f7e0;});}return null;};}function removeEntity(_0x884117,_0x5cef88){return function(_0x31233c){if(_0x31233c){return _0x31233c[_0x1bff('0x2f')]()['then'](function(){var _0x1c3208=_0x31233c[_0x1bff('0x30')]({'plain':!![]});var _0x463e59=_0x1bff('0x31');return db[_0x1bff('0x32')][_0x1bff('0x2f')]({'where':{'type':_0x463e59,'resourceId':_0x1c3208['id']}})[_0x1bff('0x2e')](function(){return _0x31233c;});})[_0x1bff('0x2e')](function(){_0x884117['status'](0xcc)[_0x1bff('0x24')]();});}};}function handleEntityNotFound(_0x5d1430,_0x492375){return function(_0x524d1f){if(!_0x524d1f){_0x5d1430[_0x1bff('0x22')](0x194);}return _0x524d1f;};}function handleError(_0x4664ba,_0x1e55a7){_0x1e55a7=_0x1e55a7||0x1f4;return function(_0x1d5918){logger['error'](_0x1d5918['stack']);if(_0x1d5918[_0x1bff('0x33')]){delete _0x1d5918[_0x1bff('0x33')];}_0x4664ba[_0x1bff('0x23')](_0x1e55a7)['send'](_0x1d5918);};}exports[_0x1bff('0x34')]=function(_0x250153,_0x108ae9){var _0x252066={},_0x3af14c={},_0x390c27={'count':0x0,'rows':[]};var _0x1df273=_['map'](db['Plugin']['rawAttributes'],function(_0x52f7f5){return{'name':_0x52f7f5[_0x1bff('0x35')],'type':_0x52f7f5[_0x1bff('0x36')]['key']};});_0x3af14c[_0x1bff('0x37')]=_[_0x1bff('0x38')](_0x1df273,_0x1bff('0x33'));_0x3af14c[_0x1bff('0x39')]=_['keys'](_0x250153[_0x1bff('0x39')]);_0x3af14c[_0x1bff('0x3a')]=_[_0x1bff('0x3b')](_0x3af14c[_0x1bff('0x37')],_0x3af14c[_0x1bff('0x39')]);_0x252066[_0x1bff('0x3c')]=_[_0x1bff('0x3b')](_0x3af14c[_0x1bff('0x37')],qs[_0x1bff('0x3d')](_0x250153['query'][_0x1bff('0x3d')]));_0x252066[_0x1bff('0x3c')]=_0x252066['attributes'][_0x1bff('0x3e')]?_0x252066[_0x1bff('0x3c')]:_0x3af14c[_0x1bff('0x37')];if(!_0x250153['query'][_0x1bff('0x3f')](_0x1bff('0x40'))){_0x252066['limit']=qs[_0x1bff('0x27')](_0x250153[_0x1bff('0x39')][_0x1bff('0x27')]);_0x252066['offset']=qs[_0x1bff('0x25')](_0x250153[_0x1bff('0x39')]['offset']);}_0x252066[_0x1bff('0x41')]=qs[_0x1bff('0x42')](_0x250153[_0x1bff('0x39')][_0x1bff('0x42')]);_0x252066[_0x1bff('0x43')]=qs['filters'](_[_0x1bff('0x44')](_0x250153['query'],_0x3af14c[_0x1bff('0x3a')]),_0x1df273);if(_0x250153[_0x1bff('0x39')][_0x1bff('0x45')]){_0x252066[_0x1bff('0x43')]=_[_0x1bff('0x46')](_0x252066[_0x1bff('0x43')],{'$or':_[_0x1bff('0x38')](_0x1df273,function(_0x2860f6){if(_0x2860f6[_0x1bff('0x36')]!=='VIRTUAL'){var _0x2e3ad0={};_0x2e3ad0[_0x2860f6[_0x1bff('0x33')]]={'$like':'%'+_0x250153[_0x1bff('0x39')][_0x1bff('0x45')]+'%'};return _0x2e3ad0;}})});}_0x252066=_['merge']({},_0x252066,_0x250153['options']);var _0x44f121={'where':_0x252066['where']};return db[_0x1bff('0x47')][_0x1bff('0x28')](_0x44f121)[_0x1bff('0x2e')](function(_0x57b4c5){_0x390c27[_0x1bff('0x28')]=_0x57b4c5;if(_0x250153['query'][_0x1bff('0x48')]){_0x252066[_0x1bff('0x49')]=[{'all':!![]}];}return db[_0x1bff('0x47')][_0x1bff('0x4a')](_0x252066);})[_0x1bff('0x2e')](function(_0x458534){_0x390c27[_0x1bff('0x4b')]=_0x458534;return _0x390c27;})[_0x1bff('0x2e')](respondWithFilteredResult(_0x108ae9,_0x252066))[_0x1bff('0x4c')](handleError(_0x108ae9,null));};exports[_0x1bff('0x4d')]=function(_0x43edca,_0x6b063d){var _0x55bd5f={'raw':!![],'where':{'id':_0x43edca[_0x1bff('0x4e')]['id']}},_0x3cdbc9={};_0x3cdbc9[_0x1bff('0x37')]=_[_0x1bff('0x4f')](db[_0x1bff('0x47')][_0x1bff('0x50')]);_0x3cdbc9[_0x1bff('0x39')]=_[_0x1bff('0x4f')](_0x43edca['query']);_0x3cdbc9['filters']=_[_0x1bff('0x3b')](_0x3cdbc9[_0x1bff('0x37')],_0x3cdbc9[_0x1bff('0x39')]);_0x55bd5f[_0x1bff('0x3c')]=_[_0x1bff('0x3b')](_0x3cdbc9['model'],qs[_0x1bff('0x3d')](_0x43edca[_0x1bff('0x39')][_0x1bff('0x3d')]));_0x55bd5f['attributes']=_0x55bd5f[_0x1bff('0x3c')][_0x1bff('0x3e')]?_0x55bd5f[_0x1bff('0x3c')]:_0x3cdbc9[_0x1bff('0x37')];if(_0x43edca['query'][_0x1bff('0x48')]){_0x55bd5f['include']=[{'all':!![]}];}_0x55bd5f=_[_0x1bff('0x46')]({},_0x55bd5f,_0x43edca['options']);return db[_0x1bff('0x47')][_0x1bff('0x51')](_0x55bd5f)[_0x1bff('0x2e')](handleEntityNotFound(_0x6b063d,null))[_0x1bff('0x2e')](respondWithResult(_0x6b063d,null))['catch'](handleError(_0x6b063d,null));};exports[_0x1bff('0x52')]=function(_0x28524e,_0xecacb3,_0x5245d5){return db[_0x1bff('0x47')][_0x1bff('0x51')]({'where':{'id':_0x28524e[_0x1bff('0x4e')]['id']},'attributes':['name',_0x1bff('0x8')],'raw':!![]})[_0x1bff('0x2e')](handleEntityNotFound(_0xecacb3,null))[_0x1bff('0x2e')](function(_0x342d7f){if(_0x342d7f){var _0x192653=path[_0x1bff('0x53')](config[_0x1bff('0x54')],_0x1bff('0x55'),util[_0x1bff('0x56')](_0x1bff('0x57'),path[_0x1bff('0x58')](_0x342d7f[_0x1bff('0x8')])));var _0x4e01c4=fs[_0x1bff('0x59')](_0x192653);var _0x45b31a=archiver(_0x1bff('0x5a'),{'zlib':{'level':0x9}});_0x45b31a['on'](_0x1bff('0x5b'),function(_0xe9494a){if(_0xe9494a[_0x1bff('0x5c')]===_0x1bff('0x5d')){logger[_0x1bff('0x5e')](_0xe9494a);}else{throw new db['Sequelize'][(_0x1bff('0x5f'))](_0x1bff('0x60'));}});_0x45b31a['on'](_0x1bff('0x5e'),function(_0x9efc72){throw new db[(_0x1bff('0x61'))]['Error'](_0x1bff('0x60'));});_0x45b31a[_0x1bff('0x62')](_0x4e01c4);_0x45b31a[_0x1bff('0x63')](_0x1bff('0x64'),{'cwd':path['join'](config[_0x1bff('0x54')],_0x1bff('0x55'),path[_0x1bff('0x65')](_0x342d7f[_0x1bff('0x8')])),'ignore':[path[_0x1bff('0x53')](path[_0x1bff('0x58')](_0x342d7f['path']),_0x1bff('0x66')),path[_0x1bff('0x53')](path['basename'](_0x342d7f[_0x1bff('0x8')]),_0x1bff('0x67'))],'nodir':!![]})['finalize']();_0x4e01c4['on'](_0x1bff('0x68'),function(){if(!fs[_0x1bff('0x69')](_0x192653)){throw new db[(_0x1bff('0x61'))]['Error'](_0x1bff('0x6a'));}return _0xecacb3[_0x1bff('0x52')](_0x192653,util[_0x1bff('0x56')](_0x1bff('0x57'),path[_0x1bff('0x58')](_0x342d7f['path'])),function(_0x508936){if(_0x508936){throw new db[(_0x1bff('0x61'))][(_0x1bff('0x5f'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x192653);logger[_0x1bff('0x6b')](_0x1bff('0x6c'));logger[_0x1bff('0x6b')](_0x1bff('0x6d'));});});}return null;})[_0x1bff('0x4c')](handleError(_0xecacb3,null));};exports[_0x1bff('0x6e')]=function(_0x5a52d1,_0x4eb2cf,_0x379efd){var _0x48de97=path[_0x1bff('0x58')](_0x5a52d1['file'][_0x1bff('0x6f')],path[_0x1bff('0x70')](_0x5a52d1[_0x1bff('0x71')][_0x1bff('0x6f')]));var _0x3a1ee0=path['join'](config[_0x1bff('0x54')],_0x1bff('0x55'),_0x5a52d1['file'][_0x1bff('0x6f')]);var _0x589aee=path[_0x1bff('0x53')](config[_0x1bff('0x54')],_0x1bff('0x55'),_0x48de97);logger[_0x1bff('0x6b')](_0x1bff('0x72'),_0x3a1ee0);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x589aee);try{fs['chmodSync'](_0x3a1ee0,parseInt(_0x1bff('0x73'),0x8));extract(_0x3a1ee0,{'dir':_0x589aee},function(_0x2df50f){if(_0x2df50f){logger[_0x1bff('0x5e')](_0x2df50f);handleError(_0x2df50f,!![]);};var _0x17b48c=fs['readdirSync'](_0x589aee);if(_0x17b48c[_0x1bff('0x3e')]>0x1){removeReferences(_0x3a1ee0,_0x589aee);logger[_0x1bff('0x5e')](_0x1bff('0x74'));return _0x379efd(new Error(_0x1bff('0x74')));}var _0x1e1e99=fs[_0x1bff('0x75')](path['join'](_0x589aee,_0x17b48c[0x0]));if(_0x1e1e99[_0x1bff('0x76')]()){removeReferences(_0x3a1ee0,_0x589aee);logger[_0x1bff('0x5e')](_0x1bff('0x74'));return _0x379efd(new Error('Invalid\x20plugin\x20structure'));}if(_0x1e1e99[_0x1bff('0x77')]()){var _0x4b88db=fs['readdirSync'](path[_0x1bff('0x53')](_0x589aee,_0x17b48c[0x0]));if(_0x4b88db[_0x1bff('0x3e')]===0x0){removeReferences(_0x3a1ee0,_0x589aee);logger[_0x1bff('0x5e')](_0x1bff('0x74'));return _0x379efd(new Error(_0x1bff('0x74')));}var _0x34e4e5=_0x4b88db[_0x1bff('0x78')](function(_0xd2f24d){return _0xd2f24d===_0x1bff('0x79');});if(!_0x34e4e5){return _0x379efd(new Error(_0x1bff('0x7a')));}var _0x524e72=fs[_0x1bff('0x7b')](path[_0x1bff('0x53')](_0x589aee,_0x17b48c[0x0],_0x1bff('0x79')));var _0xc54e2=JSON[_0x1bff('0x7c')](_0x524e72);if(_0x1bff('0x26')==typeof _0xc54e2[_0x1bff('0x33')]){return _0x379efd(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x1bff('0x26')==typeof _0xc54e2[_0x1bff('0x36')]){return _0x379efd(new Error(_0x1bff('0x7d')));}if(_0x1bff('0x26')==typeof _0xc54e2[_0x1bff('0x7e')]){return _0x379efd(new Error(_0x1bff('0x7f')));}if(_0x1bff('0x26')==typeof _0xc54e2[_0x1bff('0x80')]){return _0x379efd(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xc54e2[_0x1bff('0x36')]===_0x1bff('0x81')){if('undefined'==typeof _0xc54e2[_0x1bff('0x80')]['views']){return _0x379efd(new Error(_0x1bff('0x82')));}if(_0x1bff('0x26')==typeof _0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')][_0x1bff('0x84')]&&_0x1bff('0x26')==typeof _0xc54e2[_0x1bff('0x80')]['views'][_0x1bff('0x85')]){return _0x379efd(new Error(_0x1bff('0x86')));}}else if(_0xc54e2[_0x1bff('0x36')]===_0x1bff('0x87')){if(_0x1bff('0x26')==typeof _0xc54e2['parameters']['scriptName']){return _0x379efd(new Error(_0x1bff('0x88')));}if(_0x1bff('0x26')==typeof _0xc54e2['parameters'][_0x1bff('0x89')]){return _0x379efd(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x379efd(new Error(_0x1bff('0x8a')));}var _0x2967a3=_0xc54e2[_0x1bff('0x33')];var _0xd9a855=_0xc54e2[_0x1bff('0x8b')];var _0x3e487f=_0xc54e2[_0x1bff('0x36')];var _0x326d75=_0xc54e2['sidebar']?_0xc54e2['sidebar']:'always';var _0xff5524=_0xc54e2['icon']?_0xc54e2[_0x1bff('0x8c')]:_0x1bff('0x8d');var _0x44a077='';var _0x33b9f0='';var _0x1775ec='';var _0x39524e='';var _0x3176e3=_0xc54e2[_0x1bff('0x7e')];if(_0x3e487f==='html'){if(_0x1bff('0x26')!=typeof _0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')]['admin']){var _0xaa86f8=_0xc54e2['parameters'][_0x1bff('0x83')][_0x1bff('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x1bff('0x8e')](_0xaa86f8)){_0x44a077=path[_0x1bff('0x53')]('plugins',_0x48de97,_0x17b48c[0x0],_0xaa86f8);}else{_0x44a077=_0xaa86f8;}}else{logger['info'](_0x1bff('0x8f'));}if(_0x1bff('0x26')!=typeof _0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')][_0x1bff('0x85')]){var _0x1927fe=_0xc54e2['parameters'][_0x1bff('0x83')][_0x1bff('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x1bff('0x8e')](_0x1927fe)){_0x33b9f0=path[_0x1bff('0x53')](_0x1bff('0x90'),_0x48de97,_0x17b48c[0x0],_0x1927fe);}else{_0x33b9f0=_0x1927fe;}}else{logger[_0x1bff('0x6b')](_0x1bff('0x91'));}}else if(_0x3e487f===_0x1bff('0x87')){_0x1775ec=_0xc54e2[_0x1bff('0x80')]['scriptName'];_0x39524e=_0xc54e2['parameters'][_0x1bff('0x89')];if(_0x1bff('0x26')!=typeof _0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')]){if(_0x1bff('0x26')!=typeof _0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')][_0x1bff('0x84')]){var _0xaa86f8=_0xc54e2[_0x1bff('0x80')]['views'][_0x1bff('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x1bff('0x8e')](_0xaa86f8)){_0x44a077=path[_0x1bff('0x53')]('plugins',_0x48de97,_0x17b48c[0x0],_0xaa86f8);}else{_0x44a077=_0xaa86f8;}}if(_0x1bff('0x26')!=typeof _0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')][_0x1bff('0x85')]){var _0x1927fe=_0xc54e2[_0x1bff('0x80')][_0x1bff('0x83')][_0x1bff('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x1bff('0x8e')](_0x1927fe)){_0x33b9f0=path['join'](_0x1bff('0x90'),_0x48de97,_0x17b48c[0x0],_0x1927fe);}else{_0x33b9f0=_0x1927fe;}}}}var _0xf871a7={'name':_0x2967a3,'description':_0xd9a855,'path':path[_0x1bff('0x53')](_0x48de97,_0x17b48c[0x0]),'type':_0x3e487f,'sidebar':_0x326d75,'icon':_0xff5524,'adminUrl':_0x44a077,'agentUrl':_0x33b9f0,'scriptName':_0x1775ec,'scriptPath':_0x39524e,'version':_0x3176e3};removeReferences(_0x3a1ee0,null);return db['Plugin'][_0x1bff('0x92')](_0xf871a7)['then'](function(_0x28ccaf){var _0x5ad640={'role':_0x5a52d1[_0x1bff('0x93')][_0x1bff('0x94')],'userProfileId':_0x5a52d1[_0x1bff('0x93')][_0x1bff('0x95')]};if(!_0x5ad640)throw new Error(_0x1bff('0x96'));if(_0x5ad640[_0x1bff('0x94')]===_0x1bff('0x97')){var _0x24256a=_0x28ccaf[_0x1bff('0x30')]({'plain':!![]});return db[_0x1bff('0x98')][_0x1bff('0x51')]({'where':{'name':_0x1bff('0x31'),'userProfileId':_0x5ad640[_0x1bff('0x95')]},'raw':!![]})['then'](function(_0x4233a6){if(_0x4233a6&&_0x4233a6['autoAssociation']===0x0){return db[_0x1bff('0x32')][_0x1bff('0x92')]({'name':_0x24256a[_0x1bff('0x33')],'resourceId':_0x24256a['id'],'type':_0x4233a6[_0x1bff('0x33')],'sectionId':_0x4233a6['id']},{})['then'](function(){return _0x28ccaf;});}else{return _0x28ccaf;}})[_0x1bff('0x4c')](function(_0x35292a){logger[_0x1bff('0x5e')](_0x1bff('0x99'),_0x35292a);throw _0x35292a;});}return _0x28ccaf;})['then'](respondWithResult(_0x4eb2cf,null))[_0x1bff('0x4c')](handleError(_0x4eb2cf,null));}});}catch(_0x3bf38c){_0x4eb2cf[_0x1bff('0x23')](0x1f4)[_0x1bff('0x9a')](_0x3bf38c);}};function removeReferences(_0x593664,_0x57f270){try{if(_0x593664){fs['unlinkSync'](_0x593664);logger[_0x1bff('0x6b')](_0x1bff('0x9b'));}if(_0x57f270){rimraf(_0x57f270,function(){});logger['info'](_0x1bff('0x9c'));}}catch(_0x434228){logger[_0x1bff('0x5e')](_0x434228);}}exports[_0x1bff('0x2d')]=function(_0x2253bf,_0x458206,_0x45a157){return db[_0x1bff('0x47')][_0x1bff('0x51')]({'where':{'id':_0x2253bf['params']['id']}})['then'](handleEntityNotFound(_0x458206,null))[_0x1bff('0x2e')](saveUpdates(_0x2253bf['body'],null))[_0x1bff('0x2e')](respondWithResult(_0x458206,null))[_0x1bff('0x4c')](handleError(_0x458206,null));};exports[_0x1bff('0x9d')]=function(_0x21b3ec,_0x54e909,_0x346f0f){return db[_0x1bff('0x47')][_0x1bff('0x51')]({'where':{'id':_0x21b3ec[_0x1bff('0x4e')]['id']}})[_0x1bff('0x2e')](function(_0x5ad809){if(_0x5ad809){return _0x5ad809[_0x1bff('0x2f')]();}})[_0x1bff('0x2e')](function(_0x5d2e74){rimraf(path['join'](config[_0x1bff('0x54')],_0x1bff('0x55'),path['dirname'](_0x5d2e74['path'])),function(){});return _0x5d2e74;})[_0x1bff('0x2e')](handleEntityNotFound(_0x54e909,null))[_0x1bff('0x2e')](respondWithStatusCode(_0x54e909,null))[_0x1bff('0x4c')](handleError(_0x54e909,null));};exports[_0x1bff('0x9e')]=function(_0x541544,_0x230265,_0x7fcd12){return BPromise[_0x1bff('0x9f')]()[_0x1bff('0x2e')](function(){if(!_0x541544[_0x1bff('0x39')][_0x1bff('0x8')]){throw new Error(_0x1bff('0xa0'));}if(!_0x541544[_0x1bff('0x39')]['port']){throw new Error(_0x1bff('0xa1'));}var _0x1d067c=_0x541544[_0x1bff('0x39')][_0x1bff('0xa2')]?_0x541544[_0x1bff('0x39')][_0x1bff('0xa2')]+':'+_0x541544[_0x1bff('0x39')]['port']:_0x1bff('0xa3')+_0x541544['query']['port'];var _0x445a92=_0x541544['query']['json']?_0x541544[_0x1bff('0x39')]['json']:!![];var _0x521dce=_0x541544[_0x1bff('0x39')][_0x1bff('0xa4')]?_0x541544['query'][_0x1bff('0xa4')]:null;var _0x1a704a={'method':_0x541544[_0x1bff('0xa5')],'uri':util[_0x1bff('0x56')](_0x1bff('0xa6'),_0x1d067c,_0x541544[_0x1bff('0x39')][_0x1bff('0x8')]),'json':_0x445a92,'resolveWithFullResponse':!![],'encoding':_0x521dce,'qs':_0x541544[_0x1bff('0x39')]};if(_0x541544['headers']){_0x1a704a[_0x1bff('0xa7')]=_0x541544[_0x1bff('0xa7')];if(_0x1a704a[_0x1bff('0xa7')][_0x1bff('0xa8')]){delete _0x1a704a[_0x1bff('0xa7')][_0x1bff('0xa8')];}}if(_0x1a704a['headers']['content-type']){delete _0x1a704a['headers'][_0x1bff('0xa9')];}return rp(_0x1a704a);})[_0x1bff('0x2e')](function(_0x4e000a){if(_0x4e000a){_0x230265[_0x1bff('0x29')](_0x4e000a[_0x1bff('0xa7')]);logger[_0x1bff('0x6b')](_0x4e000a[_0x1bff('0x93')]);if(_[_0x1bff('0xaa')](_0x541544['query'][_0x1bff('0x8')],'download')&&_0x4e000a[_0x1bff('0xab')]==0x1f4){return _0x230265[_0x1bff('0x22')](_0x4e000a[_0x1bff('0xab')]);}else{return _0x230265[_0x1bff('0x23')](_0x4e000a[_0x1bff('0xab')])[_0x1bff('0x9a')](_0x4e000a['body']);}}else{return _0x230265[_0x1bff('0x22')](0xc8);}})['catch'](handleError(_0x230265,null));};exports['webhookPost']=function(_0x1e9367,_0x492be1,_0x4f35f2){return BPromise['resolve']()[_0x1bff('0x2e')](function(){if(!_0x1e9367[_0x1bff('0x39')][_0x1bff('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1e9367[_0x1bff('0x39')][_0x1bff('0xac')]){throw new Error(_0x1bff('0xa1'));}var _0x4f0522=_0x1e9367['query'][_0x1bff('0xa2')]?_0x1e9367[_0x1bff('0x39')][_0x1bff('0xa2')]+':'+_0x1e9367[_0x1bff('0x39')]['port']:_0x1bff('0xa3')+_0x1e9367[_0x1bff('0x39')][_0x1bff('0xac')];var _0x20ffc9=_0x1e9367[_0x1bff('0x39')][_0x1bff('0xad')]?_0x1e9367[_0x1bff('0x39')][_0x1bff('0xad')]:!![];var _0x2178fe=_0x1e9367['query']['encoding']?_0x1e9367['query'][_0x1bff('0xa4')]:null;var _0x3bd7d8={'method':_0x1e9367[_0x1bff('0xa5')],'uri':util['format'](_0x1bff('0xa6'),_0x4f0522,_0x1e9367[_0x1bff('0x39')][_0x1bff('0x8')]),'json':_0x20ffc9,'resolveWithFullResponse':!![],'encoding':_0x2178fe,'body':_0x1e9367['body']};if(_0x1e9367[_0x1bff('0xa7')]){_0x3bd7d8[_0x1bff('0xa7')]=_0x1e9367['headers'];if(_0x3bd7d8[_0x1bff('0xa7')][_0x1bff('0xa8')]){delete _0x3bd7d8[_0x1bff('0xa7')]['content-length'];}}if(_0x3bd7d8['headers'][_0x1bff('0xa9')]){delete _0x3bd7d8[_0x1bff('0xa7')]['content-type'];}return rp(_0x3bd7d8);})[_0x1bff('0x2e')](function(_0x2d0c38){if(_0x2d0c38){_0x492be1[_0x1bff('0x29')](_0x2d0c38['headers']);logger['info'](_0x2d0c38[_0x1bff('0x93')]);return _0x492be1[_0x1bff('0x23')](_0x2d0c38[_0x1bff('0xab')])[_0x1bff('0x9a')](_0x2d0c38[_0x1bff('0x93')]);}else{return _0x492be1[_0x1bff('0x22')](0xc8);}})[_0x1bff('0x4c')](handleError(_0x492be1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c2802ac..a05face 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 _0x0cfe=['hasOwnProperty','hook','exports','events','Plugin','setMaxListeners','save','remove','emit'];(function(_0x5eab39,_0x1cc937){var _0x31311b=function(_0xd603a4){while(--_0xd603a4){_0x5eab39['push'](_0x5eab39['shift']());}};_0x31311b(++_0x1cc937);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x5f2f5d,_0x4ea309){_0x5f2f5d=_0x5f2f5d-0x0;var _0x54ed28=_0x0cfe[_0x5f2f5d];return _0x54ed28;};'use strict';var EventEmitter=require(_0xe0cf('0x0'));var Plugin=require('../../mysqldb')['db'][_0xe0cf('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xe0cf('0x2')](0x0);var events={'afterCreate':_0xe0cf('0x3'),'afterUpdate':'update','afterDestroy':_0xe0cf('0x4')};function emitEvent(_0x4999d4){return function(_0x37e782,_0x156fe0,_0x373bbf){PluginEvents[_0xe0cf('0x5')](_0x4999d4+':'+_0x37e782['id'],_0x37e782);PluginEvents['emit'](_0x4999d4,_0x37e782);_0x373bbf(null);};}for(var e in events){if(events[_0xe0cf('0x6')](e)){var event=events[e];Plugin[_0xe0cf('0x7')](e,emitEvent(event));}}module[_0xe0cf('0x8')]=PluginEvents; \ No newline at end of file +var _0xa49e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x57f7d6,_0xcfe129){var _0x362237=function(_0x490429){while(--_0x490429){_0x57f7d6['push'](_0x57f7d6['shift']());}};_0x362237(++_0xcfe129);}(_0xa49e,0x1de));var _0xea49=function(_0x31d866,_0x1e1e3b){_0x31d866=_0x31d866-0x0;var _0x399948=_0xa49e[_0x31d866];return _0x399948;};'use strict';var EventEmitter=require(_0xea49('0x0'));var Plugin=require(_0xea49('0x1'))['db'][_0xea49('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xea49('0x3')](0x0);var events={'afterCreate':_0xea49('0x4'),'afterUpdate':_0xea49('0x5'),'afterDestroy':_0xea49('0x6')};function emitEvent(_0x228052){return function(_0x5e12d0,_0x2ef1ec,_0x439b3d){PluginEvents[_0xea49('0x7')](_0x228052+':'+_0x5e12d0['id'],_0x5e12d0);PluginEvents['emit'](_0x228052,_0x5e12d0);_0x439b3d(null);};}for(var e in events){if(events[_0xea49('0x8')](e)){var event=events[e];Plugin[_0xea49('0x9')](e,emitEvent(event));}}module[_0xea49('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 7b1dad9..a0c8175 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 _0x5870=['./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x14b9d4,_0x45e9ef){var _0x4d42c6=function(_0x5b99b7){while(--_0x5b99b7){_0x14b9d4['push'](_0x14b9d4['shift']());}};_0x4d42c6(++_0x45e9ef);}(_0x5870,0x88));var _0x0587=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x5870[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x0587('0x0'));var util=require(_0x0587('0x1'));var logger=require(_0x0587('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0587('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0587('0x4'));var rimraf=require(_0x0587('0x5'));var config=require(_0x0587('0x6'));var attributes=require(_0x0587('0x7'));module['exports']=function(_0x5c5ff0,_0x1b4dde){return _0x5c5ff0[_0x0587('0x8')](_0x0587('0x9'),attributes,{'tableName':_0x0587('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2e0=['plugins','lodash','util','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin'];(function(_0x3b987d,_0x4fa471){var _0x3b6de9=function(_0x50211a){while(--_0x50211a){_0x3b987d['push'](_0x3b987d['shift']());}};_0x3b6de9(++_0x4fa471);}(_0xd2e0,0x85));var _0x0d2e=function(_0x1f4d44,_0x349422){_0x1f4d44=_0x1f4d44-0x0;var _0x22da83=_0xd2e0[_0x1f4d44];return _0x22da83;};'use strict';var _=require(_0x0d2e('0x0'));var util=require(_0x0d2e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0d2e('0x2'));var BPromise=require(_0x0d2e('0x3'));var rp=require(_0x0d2e('0x4'));var fs=require('fs');var path=require(_0x0d2e('0x5'));var rimraf=require(_0x0d2e('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d2e('0x7'));module[_0x0d2e('0x8')]=function(_0x3f3d13,_0x45011e){return _0x3f3d13[_0x0d2e('0x9')](_0x0d2e('0xa'),attributes,{'tableName':_0x0d2e('0xb'),'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 53176b3..024f71f 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 _0xbea2=['error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','options','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x1915e2,_0x51f382){var _0x550ab2=function(_0x42bc80){while(--_0x42bc80){_0x1915e2['push'](_0x1915e2['shift']());}};_0x550ab2(++_0x51f382);}(_0xbea2,0x153));var _0x2bea=function(_0x350256,_0x29e0dd){_0x350256=_0x350256-0x0;var _0x3edccf=_0xbea2[_0x350256];return _0x3edccf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2bea('0x0'));var BPromise=require(_0x2bea('0x1'));var rs=require(_0x2bea('0x2'));var fs=require('fs');var Redis=require(_0x2bea('0x3'));var db=require(_0x2bea('0x4'))['db'];var utils=require(_0x2bea('0x5'));var logger=require(_0x2bea('0x6'))(_0x2bea('0x7'));var config=require('../../config/environment');var jayson=require(_0x2bea('0x8'));var client=jayson[_0x2bea('0x9')][_0x2bea('0xa')]({'port':0x232a});config[_0x2bea('0xb')]=_[_0x2bea('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2bea('0xd'))(new Redis(config[_0x2bea('0xb')]));require(_0x2bea('0xe'))[_0x2bea('0xf')](socket);function respondWithRpcPromise(_0x3a5e0e,_0x3a66db,_0x3bfb93){return new BPromise(function(_0x246e5f,_0x3a6b68){return client[_0x2bea('0x10')](_0x3a5e0e,_0x3bfb93)[_0x2bea('0x11')](function(_0x2e15a6){logger['info']('Plugin,\x20%s,\x20%s',_0x3a66db,_0x2bea('0x12'));logger[_0x2bea('0x13')](_0x2bea('0x14'),_0x3a66db,_0x2bea('0x12'),JSON['stringify'](_0x2e15a6));if(_0x2e15a6[_0x2bea('0x15')]){if(_0x2e15a6[_0x2bea('0x15')][_0x2bea('0x16')]===0x1f4){logger['error'](_0x2bea('0x17'),_0x3a66db,_0x2e15a6[_0x2bea('0x15')][_0x2bea('0x18')]);return _0x3a6b68(_0x2e15a6[_0x2bea('0x15')][_0x2bea('0x18')]);}logger[_0x2bea('0x15')](_0x2bea('0x17'),_0x3a66db,_0x2e15a6[_0x2bea('0x15')][_0x2bea('0x18')]);return _0x246e5f(_0x2e15a6['error'][_0x2bea('0x18')]);}else{logger[_0x2bea('0x19')](_0x2bea('0x17'),_0x3a66db,'request\x20sent');_0x246e5f(_0x2e15a6[_0x2bea('0x1a')][_0x2bea('0x18')]);}})[_0x2bea('0x1b')](function(_0x126e83){logger['error'](_0x2bea('0x17'),_0x3a66db,_0x126e83);_0x3a6b68(_0x126e83);});});}exports[_0x2bea('0x1c')]=function(_0x2b06c4){var _0x197e9e=this;return new Promise(function(_0x30c811,_0x5bb087){return db['Plugin']['create'](_0x2b06c4['body'],{'raw':_0x2b06c4[_0x2bea('0x1d')]?_0x2b06c4[_0x2bea('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x2bea('0x11')](function(_0x42eafb){logger['info'](_0x2bea('0x1c'),_0x2b06c4);logger['debug'](_0x2bea('0x1c'),_0x2b06c4,JSON['stringify'](_0x42eafb));_0x30c811(_0x42eafb);})[_0x2bea('0x1b')](function(_0xc5dee9){logger[_0x2bea('0x15')](_0x2bea('0x1c'),_0xc5dee9['message'],_0x2b06c4);_0x5bb087(_0x197e9e[_0x2bea('0x15')](0x1f4,_0xc5dee9[_0x2bea('0x18')]));});});}; \ No newline at end of file +var _0x4874=['raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','create','body','options'];(function(_0x3e6af2,_0xb78903){var _0x1261ba=function(_0x46a31c){while(--_0x46a31c){_0x3e6af2['push'](_0x3e6af2['shift']());}};_0x1261ba(++_0xb78903);}(_0x4874,0x12a));var _0x4487=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4874[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4487('0x0'));var BPromise=require(_0x4487('0x1'));var rs=require(_0x4487('0x2'));var fs=require('fs');var Redis=require(_0x4487('0x3'));var db=require(_0x4487('0x4'))['db'];var utils=require(_0x4487('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4487('0x6'));var jayson=require(_0x4487('0x7'));var client=jayson[_0x4487('0x8')][_0x4487('0x9')]({'port':0x232a});config['redis']=_[_0x4487('0xa')](config[_0x4487('0xb')],{'host':_0x4487('0xc'),'port':0x18eb});var socket=require(_0x4487('0xd'))(new Redis(config[_0x4487('0xb')]));require(_0x4487('0xe'))[_0x4487('0xf')](socket);function respondWithRpcPromise(_0x34d035,_0x17121f,_0x307e71){return new BPromise(function(_0x69e8d,_0x2d2842){return client[_0x4487('0x10')](_0x34d035,_0x307e71)[_0x4487('0x11')](function(_0x58ce1c){logger[_0x4487('0x12')](_0x4487('0x13'),_0x17121f,_0x4487('0x14'));logger[_0x4487('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x17121f,_0x4487('0x14'),JSON[_0x4487('0x16')](_0x58ce1c));if(_0x58ce1c['error']){if(_0x58ce1c[_0x4487('0x17')][_0x4487('0x18')]===0x1f4){logger['error'](_0x4487('0x13'),_0x17121f,_0x58ce1c[_0x4487('0x17')][_0x4487('0x19')]);return _0x2d2842(_0x58ce1c[_0x4487('0x17')]['message']);}logger[_0x4487('0x17')](_0x4487('0x13'),_0x17121f,_0x58ce1c[_0x4487('0x17')][_0x4487('0x19')]);return _0x69e8d(_0x58ce1c['error'][_0x4487('0x19')]);}else{logger[_0x4487('0x12')]('Plugin,\x20%s,\x20%s',_0x17121f,_0x4487('0x14'));_0x69e8d(_0x58ce1c[_0x4487('0x1a')][_0x4487('0x19')]);}})[_0x4487('0x1b')](function(_0x420bc9){logger[_0x4487('0x17')](_0x4487('0x13'),_0x17121f,_0x420bc9);_0x2d2842(_0x420bc9);});});}exports[_0x4487('0x1c')]=function(_0x3e770d){var _0x2e4e03=this;return new Promise(function(_0x286fb5,_0x19eae6){return db['Plugin'][_0x4487('0x1d')](_0x3e770d[_0x4487('0x1e')],{'raw':_0x3e770d[_0x4487('0x1f')]?_0x3e770d[_0x4487('0x1f')][_0x4487('0x20')]===undefined?!![]:![]:!![]})[_0x4487('0x11')](function(_0x28c279){logger[_0x4487('0x12')](_0x4487('0x1c'),_0x3e770d);logger[_0x4487('0x15')]('CreatePlugin',_0x3e770d,JSON[_0x4487('0x16')](_0x28c279));_0x286fb5(_0x28c279);})[_0x4487('0x1b')](function(_0x4be912){logger[_0x4487('0x17')]('CreatePlugin',_0x4be912[_0x4487('0x19')],_0x3e770d);_0x19eae6(_0x2e4e03[_0x4487('0x17')](0x1f4,_0x4be912[_0x4487('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 272f7c5..f83692a 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 _0xca0c=['plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x58981f,_0x29a796){var _0x381d75=function(_0x1f8208){while(--_0x1f8208){_0x58981f['push'](_0x58981f['shift']());}};_0x381d75(++_0x29a796);}(_0xca0c,0xd3));var _0xcca0=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xca0c[_0x2aec52];return _0x3b8835;};'use strict';var PluginEvents=require(_0xcca0('0x0'));var events=[_0xcca0('0x1'),_0xcca0('0x2'),_0xcca0('0x3')];function createListener(_0x48b9e4,_0x17862e){return function(_0x38831c){_0x17862e[_0xcca0('0x4')](_0x48b9e4,_0x38831c);};}function removeListener(_0x2ed2dd,_0x1b2fbc){return function(){PluginEvents[_0xcca0('0x5')](_0x2ed2dd,_0x1b2fbc);};}exports['register']=function(_0x5259c2){for(var _0x4bb807=0x0,_0x1714ab=events['length'];_0x4bb807<_0x1714ab;_0x4bb807++){var _0x2e94be=events[_0x4bb807];var _0x1fe253=createListener(_0xcca0('0x6')+_0x2e94be,_0x5259c2);PluginEvents['on'](_0x2e94be,_0x1fe253);}}; \ No newline at end of file +var _0xef10=['emit','removeListener','length','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef10,0x8e));var _0x0ef1=function(_0xc76cd7,_0x330143){_0xc76cd7=_0xc76cd7-0x0;var _0x109cbd=_0xef10[_0xc76cd7];return _0x109cbd;};'use strict';var PluginEvents=require(_0x0ef1('0x0'));var events=[_0x0ef1('0x1'),'remove','update'];function createListener(_0x1f8711,_0x3ea701){return function(_0x2274a9){_0x3ea701[_0x0ef1('0x2')](_0x1f8711,_0x2274a9);};}function removeListener(_0x4c301a,_0x4f5725){return function(){PluginEvents[_0x0ef1('0x3')](_0x4c301a,_0x4f5725);};}exports['register']=function(_0x32ce80){for(var _0x4b93f6=0x0,_0x1dad8f=events[_0x0ef1('0x4')];_0x4b93f6<_0x1dad8f;_0x4b93f6++){var _0x367126=events[_0x4b93f6];var _0x2ea0f0=createListener(_0x0ef1('0x5')+_0x367126,_0x32ce80);PluginEvents['on'](_0x367126,_0x2ea0f0);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index beb1e63..093e424 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(_0x4f54dc,_0x267c9a){var _0x23331b=function(_0x17588a){while(--_0x17588a){_0x4f54dc['push'](_0x4f54dc['shift']());}};_0x23331b(++_0x267c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x4b484b,_0x31d03a){var _0x4517dc=function(_0x540392){while(--_0x540392){_0x4b484b['push'](_0x4b484b['shift']());}};_0x4517dc(++_0x31d03a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 f9a2f0a..a473ff5 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 _0xc368=['update','restart','Unknown\x20status','destroy','delete','dump','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','send','npm\x20install','info','index','list','then','reject','name','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path'];(function(_0x186ea1,_0x37b5f7){var _0xd256ff=function(_0x4e4b7b){while(--_0x4e4b7b){_0x186ea1['push'](_0x186ea1['shift']());}};_0xd256ff(++_0x37b5f7);}(_0xc368,0x7b));var _0x8c36=function(_0x539ca9,_0x492c15){_0x539ca9=_0x539ca9-0x0;var _0x449b23=_0xc368[_0x539ca9];return _0x449b23;};'use strict';var _=require('lodash');var pm2=require(_0x8c36('0x0'));var logger=require('../../config/logger')(_0x8c36('0x1'));var path=require(_0x8c36('0x2'));var exec=require(_0x8c36('0x3'))[_0x8c36('0x4')];var BPromise=require(_0x8c36('0x5'));function handleEntityNotFound(_0x5d3b27,_0x3e9034){return function(_0x3bb30e){if(!_0x3bb30e){_0x5d3b27[_0x8c36('0x6')](0x194);;}return _0x3bb30e;};}function respondWithResult(_0x1d3660,_0x5ebfc1){_0x5ebfc1=_0x5ebfc1||0xc8;return function(_0x554022){if(_0x554022){return _0x1d3660[_0x8c36('0x7')](_0x5ebfc1)[_0x8c36('0x8')](_0x554022);}return null;};}function handleError(_0x3e76be,_0x26bad1){_0x26bad1=_0x26bad1||0x1f4;return function(_0x3af839){logger[_0x8c36('0x9')](_0x3af839['stack']);if(_0x3af839['name']){delete _0x3af839['name'];}_0x3e76be[_0x8c36('0x7')](_0x26bad1)[_0x8c36('0xa')](_0x3af839);};}function execChildProcess(){return new BPromise(function(_0x5132f6,_0x36cb13){exec(_0x8c36('0xb'),function(_0x1d5c61,_0xe7857e,_0x2a8e73){logger[_0x8c36('0xc')](_0xe7857e);logger[_0x8c36('0xc')](_0x2a8e73);if(_0x1d5c61){logger[_0x8c36('0x9')](_0x1d5c61);return _0x36cb13(_0x1d5c61);}return _0x5132f6(_0xe7857e);});});}exports[_0x8c36('0xd')]=function(_0x11f8fa,_0x43736d){return pm2[_0x8c36('0xe')]()[_0x8c36('0xf')](function(_0x220f18){if(_0x220f18){var _0x5dfcd5=_[_0x8c36('0x10')](_0x220f18,function(_0x5e32ad){return _0x5e32ad[_0x8c36('0x11')]===_0x8c36('0x12')||_0x5e32ad[_0x8c36('0x11')]===_0x8c36('0x13');});return{'rows':_0x5dfcd5,'count':_0x5dfcd5[_0x8c36('0x14')]};}return null;})[_0x8c36('0xf')](respondWithResult(_0x43736d,null))[_0x8c36('0x15')](handleError(_0x43736d,null));};exports[_0x8c36('0x16')]=function(_0x30229e,_0x49cafe){return pm2[_0x8c36('0x17')](_0x30229e[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](respondWithResult(_0x49cafe,null))[_0x8c36('0xf')](handleEntityNotFound(_0x49cafe,null))[_0x8c36('0x15')](handleError(_0x49cafe,null));};exports['create']=function(_0x15100f,_0x409de0){if(_0x15100f[_0x8c36('0x19')][_0x8c36('0x11')]&&_0x15100f[_0x8c36('0x19')][_0x8c36('0x1a')]){var _0xfb9763=path[_0x8c36('0x1b')](__dirname,_0x8c36('0x1c'),_0x15100f[_0x8c36('0x19')][_0x8c36('0x1a')]);var _0x14ee6b=process[_0x8c36('0x1d')]();process['chdir'](path['dirname'](_0xfb9763));return execChildProcess()['then'](function(_0x55b844){process[_0x8c36('0x1e')](_0x14ee6b);return pm2[_0x8c36('0x1f')]({'name':_0x15100f[_0x8c36('0x19')][_0x8c36('0x11')],'script':_0xfb9763});})[_0x8c36('0xf')](function(_0x27c0df){pm2['dump']();return _0x27c0df[0x0];})[_0x8c36('0xf')](respondWithResult(_0x409de0,0xc9))['catch'](handleError(_0x409de0,null));}else{return _0x409de0[_0x8c36('0x7')](0x1f4)['send']({'message':_0x8c36('0x20')});}};exports[_0x8c36('0x21')]=function(_0x271ec4,_0x1010c8){if(_0x271ec4['body']['id']){delete _0x271ec4['body']['id'];}var _0x7e7e56={'online':_0x8c36('0x22'),'stopped':'stop'};if(_0x7e7e56['hasOwnProperty'](_0x271ec4[_0x8c36('0x19')][_0x8c36('0x7')])){return pm2[_0x7e7e56[_0x271ec4['body'][_0x8c36('0x7')]]](_0x271ec4[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](respondWithResult(_0x1010c8,0xc8))['catch'](handleError(_0x1010c8,null));}else{return _0x1010c8['status'](0x1f4)[_0x8c36('0xa')]({'message':_0x8c36('0x23')});}};exports[_0x8c36('0x24')]=function(_0x192ce3,_0x3ae970){if(_0x192ce3[_0x8c36('0x19')]['id']){delete _0x192ce3[_0x8c36('0x19')]['id'];}if(_0x192ce3[_0x8c36('0x18')]['id']){return pm2[_0x8c36('0x25')](_0x192ce3[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](function(_0x36648e){pm2[_0x8c36('0x26')]();return _0x36648e[0x0];})[_0x8c36('0xf')](respondWithResult(_0x3ae970,null))[_0x8c36('0x15')](handleError(_0x3ae970,null));}else{return _0x3ae970[_0x8c36('0x7')](0x1f4)[_0x8c36('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x0fd9=['error','index','list','reject','express','then','catch','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','hasOwnProperty','Unknown\x20status','params','Unknown\x20id','../../config/pm2','../../config/logger','api','path','bluebird','sendStatus','status','stack','name','send','npm\x20install','info'];(function(_0x1f26f8,_0x3abc8b){var _0x6773e6=function(_0x34d41f){while(--_0x34d41f){_0x1f26f8['push'](_0x1f26f8['shift']());}};_0x6773e6(++_0x3abc8b);}(_0x0fd9,0xa3));var _0x90fd=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x0fd9[_0x11deef];return _0xe9ba85;};'use strict';var _=require('lodash');var pm2=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var path=require(_0x90fd('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0x90fd('0x4'));function handleEntityNotFound(_0x2a5f76,_0xb7cf6){return function(_0x37a8be){if(!_0x37a8be){_0x2a5f76[_0x90fd('0x5')](0x194);;}return _0x37a8be;};}function respondWithResult(_0x23e11b,_0x5e2107){_0x5e2107=_0x5e2107||0xc8;return function(_0x4ff2d4){if(_0x4ff2d4){return _0x23e11b[_0x90fd('0x6')](_0x5e2107)['json'](_0x4ff2d4);}return null;};}function handleError(_0x5a604a,_0x2acef7){_0x2acef7=_0x2acef7||0x1f4;return function(_0x1becf2){logger['error'](_0x1becf2[_0x90fd('0x7')]);if(_0x1becf2[_0x90fd('0x8')]){delete _0x1becf2[_0x90fd('0x8')];}_0x5a604a[_0x90fd('0x6')](_0x2acef7)[_0x90fd('0x9')](_0x1becf2);};}function execChildProcess(){return new BPromise(function(_0x3be346,_0x2aae77){exec(_0x90fd('0xa'),function(_0x3c541e,_0x48943e,_0x23c417){logger[_0x90fd('0xb')](_0x48943e);logger['info'](_0x23c417);if(_0x3c541e){logger[_0x90fd('0xc')](_0x3c541e);return _0x2aae77(_0x3c541e);}return _0x3be346(_0x48943e);});});}exports[_0x90fd('0xd')]=function(_0x19a594,_0x5f28ab){return pm2[_0x90fd('0xe')]()['then'](function(_0x1cae40){if(_0x1cae40){var _0xb402d9=_[_0x90fd('0xf')](_0x1cae40,function(_0x1b3f3b){return _0x1b3f3b[_0x90fd('0x8')]===_0x90fd('0x10')||_0x1b3f3b[_0x90fd('0x8')]==='motion2';});return{'rows':_0xb402d9,'count':_0xb402d9['length']};}return null;})[_0x90fd('0x11')](respondWithResult(_0x5f28ab,null))[_0x90fd('0x12')](handleError(_0x5f28ab,null));};exports['show']=function(_0x130489,_0x13a694){return pm2[_0x90fd('0x13')](_0x130489['params']['id'])[_0x90fd('0x11')](respondWithResult(_0x13a694,null))[_0x90fd('0x11')](handleEntityNotFound(_0x13a694,null))[_0x90fd('0x12')](handleError(_0x13a694,null));};exports[_0x90fd('0x14')]=function(_0x251957,_0x58866f){if(_0x251957[_0x90fd('0x15')][_0x90fd('0x8')]&&_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]){var _0x19e79b=path[_0x90fd('0x17')](__dirname,_0x90fd('0x18'),_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]);var _0x493c26=process[_0x90fd('0x19')]();process[_0x90fd('0x1a')](path[_0x90fd('0x1b')](_0x19e79b));return execChildProcess()[_0x90fd('0x11')](function(_0x411a6a){process[_0x90fd('0x1a')](_0x493c26);return pm2[_0x90fd('0x1c')]({'name':_0x251957[_0x90fd('0x15')]['name'],'script':_0x19e79b});})[_0x90fd('0x11')](function(_0x52b066){pm2[_0x90fd('0x1d')]();return _0x52b066[0x0];})[_0x90fd('0x11')](respondWithResult(_0x58866f,0xc9))[_0x90fd('0x12')](handleError(_0x58866f,null));}else{return _0x58866f[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x90fd('0x1e')]=function(_0xe333f0,_0x2fffe6){if(_0xe333f0[_0x90fd('0x15')]['id']){delete _0xe333f0[_0x90fd('0x15')]['id'];}var _0x428bc2={'online':'restart','stopped':'stop'};if(_0x428bc2[_0x90fd('0x1f')](_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')])){return pm2[_0x428bc2[_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')]]](_0xe333f0['params']['id'])['then'](respondWithResult(_0x2fffe6,0xc8))[_0x90fd('0x12')](handleError(_0x2fffe6,null));}else{return _0x2fffe6[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x20')});}};exports['destroy']=function(_0x59aede,_0x12dea4){if(_0x59aede[_0x90fd('0x15')]['id']){delete _0x59aede[_0x90fd('0x15')]['id'];}if(_0x59aede[_0x90fd('0x21')]['id']){return pm2['delete'](_0x59aede[_0x90fd('0x21')]['id'])[_0x90fd('0x11')](function(_0x7fb8bc){pm2[_0x90fd('0x1d')]();return _0x7fb8bc[0x0];})[_0x90fd('0x11')](respondWithResult(_0x12dea4,null))[_0x90fd('0x12')](handleError(_0x12dea4,null));}else{return _0x12dea4[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 86ee32a..353c7d3 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 _0x3536=['exports','express','./realtime.controller','get','isAuthenticated','getAgents','/queues'];(function(_0x4af373,_0x5e5b87){var _0x15df31=function(_0x4da41d){while(--_0x4da41d){_0x4af373['push'](_0x4af373['shift']());}};_0x15df31(++_0x5e5b87);}(_0x3536,0xf6));var _0x6353=function(_0x538bc6,_0x195110){_0x538bc6=_0x538bc6-0x0;var _0x3e9676=_0x3536[_0x538bc6];return _0x3e9676;};'use strict';var express=require(_0x6353('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x6353('0x1'));router[_0x6353('0x2')]('/agents',auth[_0x6353('0x3')](),controller[_0x6353('0x4')]);router[_0x6353('0x2')](_0x6353('0x5'),auth[_0x6353('0x3')](),controller['getQueues']);module[_0x6353('0x6')]=router; \ No newline at end of file +var _0xa448=['express','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','get','/queues','getQueues','exports'];(function(_0x4b7468,_0x1a5bbc){var _0x97d592=function(_0x1f7cfb){while(--_0x1f7cfb){_0x4b7468['push'](_0x4b7468['shift']());}};_0x97d592(++_0x1a5bbc);}(_0xa448,0x168));var _0x8a44=function(_0x803a42,_0x4bab6f){_0x803a42=_0x803a42-0x0;var _0x58cfa7=_0xa448[_0x803a42];return _0x58cfa7;};'use strict';var express=require(_0x8a44('0x0'));var router=express['Router']();var auth=require(_0x8a44('0x1'));var controller=require(_0x8a44('0x2'));router['get'](_0x8a44('0x3'),auth[_0x8a44('0x4')](),controller['getAgents']);router[_0x8a44('0x5')](_0x8a44('0x6'),auth[_0x8a44('0x4')](),controller[_0x8a44('0x7')]);module[_0x8a44('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index d79bbd9..f0977f3 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 _0xa8e9=['talking','voiceStatus','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','resolve','startCase','Queue','rawAttributes','name','outbound','dialActive','filter','assign','getRealtimeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','query','globalQueueFilter','pauseTypeFilter','pause','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','where','merge','role','user','userProfileId','Agents','agent','UserProfile','getResources','findAndCountAll','find','voice'];(function(_0x45c536,_0x52a556){var _0x10e06d=function(_0x3fcca0){while(--_0x3fcca0){_0x45c536['push'](_0x45c536['shift']());}};_0x10e06d(++_0x52a556);}(_0xa8e9,0x106));var _0x9a8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa8e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9a8e('0x0'));var util=require('util');var rta=require(_0x9a8e('0x1'));var rtq=require(_0x9a8e('0x2'));var qs=require(_0x9a8e('0x3'));var utils=require(_0x9a8e('0x4'));var db=require(_0x9a8e('0x5'))['db'];var APIBadRequestError=require(_0x9a8e('0x6'))[_0x9a8e('0x7')];var APIHandleError=require('../../errors/api')[_0x9a8e('0x8')];function respondWithFilteredResult(_0x583bbb,_0x117336){return function(_0x46ecf3){if(_0x46ecf3){var _0x1254f6=typeof _0x117336[_0x9a8e('0x9')]==='undefined'&&typeof _0x117336[_0x9a8e('0xa')]===_0x9a8e('0xb');var _0x5077e6=_0x46ecf3[_0x9a8e('0xc')];var _0x5a58f8=_0x1254f6?0x0:_0x117336[_0x9a8e('0x9')];var _0x1afd5c=_0x1254f6?_0x46ecf3[_0x9a8e('0xc')]:_0x117336['offset']+_0x117336[_0x9a8e('0xa')];var _0x112a15;if(_0x1afd5c>=_0x5077e6){_0x1afd5c=_0x5077e6;_0x112a15=0xc8;}else{_0x112a15=0xce;}_0x583bbb[_0x9a8e('0xd')](_0x112a15);return _0x583bbb[_0x9a8e('0xe')](_0x9a8e('0xf'),_0x5a58f8+'-'+_0x1afd5c+'/'+_0x5077e6)[_0x9a8e('0x10')](_0x46ecf3);}return null;};}exports[_0x9a8e('0x11')]=function(_0x13b8e6,_0x5e0ee4){var _0x5057ec={'count':0x0,'rows':[]};var _0x8b8174={};var _0x217030;var _0x14e1eb=utils['getChannels']();var _0x256141;var _0x2b8f29;var _0x264748=_0x13b8e6[_0x9a8e('0x12')][_0x9a8e('0x13')];var _0x53ba36=_0x13b8e6[_0x9a8e('0x12')]['globalStatusFilter'];var _0x415df6=_0x13b8e6[_0x9a8e('0x12')][_0x9a8e('0x14')];var _0x4da605=_0x53ba36===_0x9a8e('0x15')||_0x53ba36==='*pause'?!![]:![];var _0x5d2add=[];var _0x562543;var _0x1916f9;Promise['resolve']()[_0x9a8e('0x16')](function(){if(_0x13b8e6[_0x9a8e('0x12')]['channel']){if(!utils[_0x9a8e('0x17')](_0x13b8e6[_0x9a8e('0x12')][_0x9a8e('0x18')])){throw new APIBadRequestError(util[_0x9a8e('0x19')](_0x9a8e('0x1a'),_0x13b8e6[_0x9a8e('0x12')]['channel']));}_0x217030=_0x13b8e6[_0x9a8e('0x12')]['channel']['toLowerCase']();}if(!_0x13b8e6['query'][_0x9a8e('0x1b')]||!_0x13b8e6[_0x9a8e('0x12')]['sort'][_0x9a8e('0x1c')](_0x9a8e('0x1d'))){_0x13b8e6[_0x9a8e('0x12')]['sort']=rta[_0x9a8e('0x1e')](_0x13b8e6[_0x9a8e('0x12')][_0x9a8e('0x1b')]);return;}var _0x32a482=rta['getUpdatedSortOptions'](_0x13b8e6[_0x9a8e('0x12')][_0x9a8e('0x1b')]);_0x13b8e6['query']['sort']=_0x32a482[_0x9a8e('0x1f')][_0x9a8e('0x20')](',');_0x562543=_0x32a482[_0x9a8e('0x21')];})[_0x9a8e('0x16')](function(){if(!_0x264748){return[];}return rta[_0x9a8e('0x22')](_0x264748,_0x217030);})[_0x9a8e('0x16')](function(_0x3a34c6){_0x5d2add=_0x3a34c6;return rta[_0x9a8e('0x23')]();})[_0x9a8e('0x16')](function(_0x8a279){_0x2b8f29=_0x8a279[_0x9a8e('0x24')];if((!_0x53ba36||_0x4da605)&&!_0x562543){return _0x5d2add;}if(_0x562543&&!_0x53ba36){return rta[_0x9a8e('0x25')](_0x2b8f29,_0x5d2add,_0x562543);}else{return rta[_0x9a8e('0x26')](_0x2b8f29,_0x5d2add,_0x53ba36);}})[_0x9a8e('0x16')](function(_0x4fbea3){_0x5d2add=_0x4fbea3;var _0x3efb7e=![];if(_0x5d2add[_0x9a8e('0x27')]===0x0){if(_0x264748||_0x53ba36){_0x3efb7e=!![];}if(_0x4da605){_0x3efb7e=![];}}if(_0x3efb7e){return _0x5057ec;}var _0x381a95=_[_0x9a8e('0x28')](db[_0x9a8e('0x29')]['rawAttributes'],function(_0xdefc7b){return{'name':_0xdefc7b[_0x9a8e('0x2a')],'type':_0xdefc7b[_0x9a8e('0x2b')][_0x9a8e('0x2c')]};});_0x13b8e6[_0x9a8e('0x12')]['role']='agent';_0x8b8174=qs[_0x9a8e('0x2d')](_0x381a95,_0x13b8e6);_0x8b8174[_0x9a8e('0x2e')]=!![];var _0x5e8aad=[];if(_0x5d2add[_0x9a8e('0x27')]>0x0){_0x5e8aad[_0x9a8e('0x2f')]({'id':{'$in':_0x5d2add}});if(_0x562543&&!_0x53ba36){_0x1916f9=[db[_0x9a8e('0x30')][_0x9a8e('0x31')](_0x9a8e('0x32')+_0x5d2add+')')];_0x8b8174[_0x9a8e('0x21')]=_0x1916f9;}}if(_0x4da605){_0x14e1eb[_0x9a8e('0x33')](function(_0x23a285){var _0x5bbeef=!![];if(_0x53ba36===_0x9a8e('0x34')&&_0x217030!==_0x23a285){_0x5bbeef=![];}_0x5e8aad[_0x9a8e('0x2f')]({[_0x23a285+_0x9a8e('0x35')]:_0x5bbeef});});if(_0x415df6){_0x5e8aad['push']({'pauseType':_0x415df6});}}else if(_0x53ba36){_0x14e1eb['forEach'](function(_0x3ef484){_0x5e8aad['push']({[_0x3ef484+_0x9a8e('0x35')]:![]});});}_0x8b8174[_0x9a8e('0x36')]=_[_0x9a8e('0x37')](_0x8b8174['where'],{'$and':_0x5e8aad});if(_0x13b8e6['user'][_0x9a8e('0x38')]==='user'){var _0x4936be={'params':{'id':_0x13b8e6[_0x9a8e('0x39')][_0x9a8e('0x3a')]},'query':{'section':_0x9a8e('0x3b'),'role':_0x9a8e('0x3c'),'raw':!![],'ids':_0x5d2add,'customSorting':_0x1916f9}};if(_0x13b8e6[_0x9a8e('0x12')]['online']){_0x4936be[_0x9a8e('0x12')]['online']=!![];}if(_0x4da605){_0x4936be[_0x9a8e('0x12')]['extraQueryConditions']=_0x5e8aad;}_0x4936be[_0x9a8e('0x12')]=Object['assign'](_0x4936be[_0x9a8e('0x12')],_['omit'](_0x13b8e6[_0x9a8e('0x12')],'id'));return db[_0x9a8e('0x3d')][_0x9a8e('0x3e')](_0x4936be);}return db[_0x9a8e('0x29')][_0x9a8e('0x3f')](_0x8b8174);})[_0x9a8e('0x16')](function(_0x16c2b4){_0x5057ec[_0x9a8e('0xc')]=_0x16c2b4[_0x9a8e('0xc')];_0x256141=_0x16c2b4['rows'];return _0x256141[_0x9a8e('0x28')](function(_0x3ece71){var _0x15d9d4=_[_0x9a8e('0x40')](_0x2b8f29,['id',_0x3ece71['id']]);if(_0x15d9d4){var _0x218d23=rta['filterAgentAttributes'](_0x15d9d4);_[_0x9a8e('0x37')](_0x3ece71,_0x218d23);}_0x3ece71[_0x9a8e('0x1d')]=rta['getAgentStatus'](_0x3ece71);if(_0x3ece71[_0x9a8e('0x1d')][_0x9a8e('0x1c')](_0x9a8e('0x15'))){_0x14e1eb['forEach'](function(_0x23c6ee){if(_0x3ece71[_0x23c6ee+_0x9a8e('0x35')]){if(_0x23c6ee===_0x9a8e('0x41')){if(_0x3ece71['voiceStatus']!==_0x9a8e('0x42')){_0x3ece71[_0x9a8e('0x43')]='pause';}}else{_0x3ece71[_0x23c6ee+'Status']=_0x9a8e('0x15');}}});}return _0x3ece71;});})[_0x9a8e('0x16')](function(_0x35ffcf){if(!_0x562543||_0x1916f9){return _0x35ffcf;}return rta[_0x9a8e('0x44')](_0x35ffcf,_0x562543);})[_0x9a8e('0x16')](function(_0x5de1c2){var _0x4ea80b=rta[_0x9a8e('0x45')]();_0x5057ec['rows']=_0x5de1c2[_0x9a8e('0x28')](function(_0x3dc481){return _['pick'](_0x3dc481,_0x4ea80b);});return _0x5057ec;})[_0x9a8e('0x16')](respondWithFilteredResult(_0x5e0ee4,_0x8b8174))[_0x9a8e('0x46')](APIHandleError(_0x5e0ee4));};exports[_0x9a8e('0x47')]=function(_0x546f01,_0x20ee0e){var _0x2f2c9b={'count':0x0,'rows':[]};var _0x328f7f={};var _0x39f860;var _0x1776d1;var _0x1bf186;Promise[_0x9a8e('0x48')]()[_0x9a8e('0x16')](function(){if(_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x18')]){if(!utils[_0x9a8e('0x17')](_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x18')])){throw new APIBadRequestError(util['format'](_0x9a8e('0x1a'),_0x546f01[_0x9a8e('0x12')]['channel']));}_0x39f860=_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x18')]['toLowerCase']();}var _0x5171da=_[_0x9a8e('0x49')](_0x39f860)+_0x9a8e('0x4a');var _0x21000a=_[_0x9a8e('0x28')](db[_0x5171da][_0x9a8e('0x4b')],function(_0x1cba27){return{'name':_0x1cba27['fieldName'],'type':_0x1cba27['type'][_0x9a8e('0x2c')]};});if(!_0x546f01[_0x9a8e('0x12')]['fields']){var _0x3c1229=['id',_0x9a8e('0x4c')];if(_0x39f860===_0x9a8e('0x41')){_0x3c1229[_0x9a8e('0x2f')](_0x9a8e('0x2b'));if(_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x2b')]===_0x9a8e('0x4d')){_0x3c1229['push']([_0x9a8e('0x4e'),'dialMethod']);}}_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x1f')]=_0x3c1229[_0x9a8e('0x20')](',');}_0x328f7f=qs[_0x9a8e('0x2d')](_0x21000a,_0x546f01);if(_0x546f01[_0x9a8e('0x39')]['role']===_0x9a8e('0x39')){var _0x1d2eb7={'params':{'id':_0x546f01['user'][_0x9a8e('0x3a')]},'query':{'section':_0x39f860===_0x9a8e('0x41')&&_0x546f01['query'][_0x9a8e('0x2b')]==='outbound'?'QueueCampaigns':_[_0x9a8e('0x49')](_0x39f860)+'Queues','type':_0x546f01[_0x9a8e('0x12')]['type'],'nolimit':!![],'sort':_0x9a8e('0x4c'),'filter':_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x4f')]}};_0x1d2eb7[_0x9a8e('0x12')]=Object[_0x9a8e('0x50')](_0x1d2eb7[_0x9a8e('0x12')],_0x546f01[_0x9a8e('0x12')]);delete _0x1d2eb7['query']['id'];return db[_0x9a8e('0x3d')][_0x9a8e('0x3e')](_0x1d2eb7);}return db[_0x5171da][_0x9a8e('0x3f')](_0x328f7f);})[_0x9a8e('0x16')](function(_0x5abd64){_0x2f2c9b[_0x9a8e('0xc')]=_0x5abd64[_0x9a8e('0xc')];_0x1776d1=_0x5abd64['rows'];return rtq[_0x9a8e('0x51')](_0x546f01,_0x39f860);})[_0x9a8e('0x16')](function(_0x238367){_0x1bf186=_0x238367['rows'];return rtq['initializeQueues'](_0x1776d1,_0x1bf186,_0x39f860,_0x546f01[_0x9a8e('0x12')][_0x9a8e('0x2b')]);})[_0x9a8e('0x16')](function(_0x4deb66){_0x2f2c9b[_0x9a8e('0x24')]=_0x4deb66;return _0x2f2c9b;})['then'](respondWithFilteredResult(_0x20ee0e,_0x328f7f))[_0x9a8e('0x46')](APIHandleError(_0x20ee0e));}; \ No newline at end of file +var _0x1cb7=['getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','Agents','online','extraQueryConditions','omit','UserProfile','getResources','findAndCountAll','filterAgentAttributes','merge','includes','voice','voiceStatus','pause','Status','getRealtimeAgentsQueryFields','pick','catch','startCase','Queue','name','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','assign','getRealtimeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','set','Content-Range','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','then','channel','isValidChannel','format','toLowerCase','sort','globalStatus'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x1cb7,0x17f));var _0x71cb=function(_0xa83db6,_0x2ec358){_0xa83db6=_0xa83db6-0x0;var _0x5d6e5f=_0x1cb7[_0xa83db6];return _0x5d6e5f;};'use strict';var _=require(_0x71cb('0x0'));var util=require(_0x71cb('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x71cb('0x2'));var qs=require(_0x71cb('0x3'));var utils=require(_0x71cb('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x71cb('0x5'))[_0x71cb('0x6')];var APIHandleError=require(_0x71cb('0x5'))[_0x71cb('0x7')];function respondWithFilteredResult(_0x24c566,_0x573985){return function(_0x298762){if(_0x298762){var _0x1387fd=typeof _0x573985[_0x71cb('0x8')]===_0x71cb('0x9')&&typeof _0x573985['limit']===_0x71cb('0x9');var _0x38c05b=_0x298762[_0x71cb('0xa')];var _0x211ff7=_0x1387fd?0x0:_0x573985[_0x71cb('0x8')];var _0x57e7ec=_0x1387fd?_0x298762[_0x71cb('0xa')]:_0x573985[_0x71cb('0x8')]+_0x573985['limit'];var _0x32c202;if(_0x57e7ec>=_0x38c05b){_0x57e7ec=_0x38c05b;_0x32c202=0xc8;}else{_0x32c202=0xce;}_0x24c566['status'](_0x32c202);return _0x24c566[_0x71cb('0xb')](_0x71cb('0xc'),_0x211ff7+'-'+_0x57e7ec+'/'+_0x38c05b)['json'](_0x298762);}return null;};}exports[_0x71cb('0xd')]=function(_0x377efb,_0x1a5c82){var _0x22ee04={'count':0x0,'rows':[]};var _0xb834f6={};var _0x2dac4a;var _0x16c49a=utils['getChannels']();var _0x38ece1;var _0x2d7e98;var _0x14b685=_0x377efb[_0x71cb('0xe')][_0x71cb('0xf')];var _0xd8d854=_0x377efb[_0x71cb('0xe')][_0x71cb('0x10')];var _0x15acef=_0x377efb['query'][_0x71cb('0x11')];var _0xa1027a=_0xd8d854==='pause'||_0xd8d854===_0x71cb('0x12')?!![]:![];var _0x32ff17=[];var _0x33838e;var _0x9a56a7;Promise[_0x71cb('0x13')]()[_0x71cb('0x14')](function(){if(_0x377efb[_0x71cb('0xe')][_0x71cb('0x15')]){if(!utils[_0x71cb('0x16')](_0x377efb[_0x71cb('0xe')][_0x71cb('0x15')])){throw new APIBadRequestError(util[_0x71cb('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x377efb[_0x71cb('0xe')]['channel']));}_0x2dac4a=_0x377efb['query']['channel'][_0x71cb('0x18')]();}if(!_0x377efb[_0x71cb('0xe')][_0x71cb('0x19')]||!_0x377efb[_0x71cb('0xe')][_0x71cb('0x19')]['includes'](_0x71cb('0x1a'))){_0x377efb[_0x71cb('0xe')]['sort']=rta['validateSortParameter'](_0x377efb[_0x71cb('0xe')][_0x71cb('0x19')]);return;}var _0x43d35d=rta[_0x71cb('0x1b')](_0x377efb['query'][_0x71cb('0x19')]);_0x377efb['query'][_0x71cb('0x19')]=_0x43d35d[_0x71cb('0x1c')][_0x71cb('0x1d')](',');_0x33838e=_0x43d35d[_0x71cb('0x1e')];})[_0x71cb('0x14')](function(){if(!_0x14b685){return[];}return rta[_0x71cb('0x1f')](_0x14b685,_0x2dac4a);})[_0x71cb('0x14')](function(_0x415940){_0x32ff17=_0x415940;return rta[_0x71cb('0x20')]();})[_0x71cb('0x14')](function(_0x46f821){_0x2d7e98=_0x46f821[_0x71cb('0x21')];if((!_0xd8d854||_0xa1027a)&&!_0x33838e){return _0x32ff17;}if(_0x33838e&&!_0xd8d854){return rta[_0x71cb('0x22')](_0x2d7e98,_0x32ff17,_0x33838e);}else{return rta[_0x71cb('0x23')](_0x2d7e98,_0x32ff17,_0xd8d854);}})[_0x71cb('0x14')](function(_0x4adfb0){_0x32ff17=_0x4adfb0;var _0x25ce0c=![];if(_0x32ff17[_0x71cb('0x24')]===0x0){if(_0x14b685||_0xd8d854){_0x25ce0c=!![];}if(_0xa1027a){_0x25ce0c=![];}}if(_0x25ce0c){return _0x22ee04;}var _0x5f2500=_[_0x71cb('0x25')](db[_0x71cb('0x26')][_0x71cb('0x27')],function(_0x509c99){return{'name':_0x509c99[_0x71cb('0x28')],'type':_0x509c99[_0x71cb('0x29')][_0x71cb('0x2a')]};});_0x377efb[_0x71cb('0xe')][_0x71cb('0x2b')]=_0x71cb('0x2c');_0xb834f6=qs[_0x71cb('0x2d')](_0x5f2500,_0x377efb);_0xb834f6['raw']=!![];var _0x1007a4=[];if(_0x32ff17[_0x71cb('0x24')]>0x0){_0x1007a4[_0x71cb('0x2e')]({'id':{'$in':_0x32ff17}});if(_0x33838e&&!_0xd8d854){_0x9a56a7=[db[_0x71cb('0x2f')][_0x71cb('0x30')](_0x71cb('0x31')+_0x32ff17+')')];_0xb834f6[_0x71cb('0x1e')]=_0x9a56a7;}}if(_0xa1027a){_0x16c49a[_0x71cb('0x32')](function(_0x3e633f){var _0x1b4f18=!![];if(_0xd8d854===_0x71cb('0x12')&&_0x2dac4a!==_0x3e633f){_0x1b4f18=![];}_0x1007a4[_0x71cb('0x2e')]({[_0x3e633f+_0x71cb('0x33')]:_0x1b4f18});});if(_0x15acef){_0x1007a4[_0x71cb('0x2e')]({'pauseType':_0x15acef});}}else if(_0xd8d854){_0x16c49a['forEach'](function(_0x460e2e){_0x1007a4['push']({[_0x460e2e+_0x71cb('0x33')]:![]});});}_0xb834f6[_0x71cb('0x34')]=_['merge'](_0xb834f6['where'],{'$and':_0x1007a4});if(_0x377efb[_0x71cb('0x35')][_0x71cb('0x2b')]===_0x71cb('0x35')){var _0x3f40b7={'params':{'id':_0x377efb[_0x71cb('0x35')]['userProfileId']},'query':{'section':_0x71cb('0x36'),'role':_0x71cb('0x2c'),'raw':!![],'ids':_0x32ff17,'customSorting':_0x9a56a7}};if(_0x377efb[_0x71cb('0xe')][_0x71cb('0x37')]){_0x3f40b7[_0x71cb('0xe')][_0x71cb('0x37')]=!![];}if(_0xa1027a){_0x3f40b7['query'][_0x71cb('0x38')]=_0x1007a4;}_0x3f40b7[_0x71cb('0xe')]=Object['assign'](_0x3f40b7[_0x71cb('0xe')],_[_0x71cb('0x39')](_0x377efb[_0x71cb('0xe')],'id'));return db[_0x71cb('0x3a')][_0x71cb('0x3b')](_0x3f40b7);}return db['User'][_0x71cb('0x3c')](_0xb834f6);})[_0x71cb('0x14')](function(_0x27934f){_0x22ee04[_0x71cb('0xa')]=_0x27934f['count'];_0x38ece1=_0x27934f[_0x71cb('0x21')];return _0x38ece1[_0x71cb('0x25')](function(_0x4bf627){var _0x37bfb1=_['find'](_0x2d7e98,['id',_0x4bf627['id']]);if(_0x37bfb1){var _0x5cd7dd=rta[_0x71cb('0x3d')](_0x37bfb1);_[_0x71cb('0x3e')](_0x4bf627,_0x5cd7dd);}_0x4bf627['globalStatus']=rta['getAgentStatus'](_0x4bf627);if(_0x4bf627[_0x71cb('0x1a')][_0x71cb('0x3f')]('pause')){_0x16c49a[_0x71cb('0x32')](function(_0x2e432a){if(_0x4bf627[_0x2e432a+'Pause']){if(_0x2e432a===_0x71cb('0x40')){if(_0x4bf627['voiceStatus']!=='talking'){_0x4bf627[_0x71cb('0x41')]=_0x71cb('0x42');}}else{_0x4bf627[_0x2e432a+_0x71cb('0x43')]='pause';}}});}return _0x4bf627;});})[_0x71cb('0x14')](function(_0xaf069d){if(!_0x33838e||_0x9a56a7){return _0xaf069d;}return rta['sortAgentsByStatus'](_0xaf069d,_0x33838e);})['then'](function(_0x1a6592){var _0x1bbf1c=rta[_0x71cb('0x44')]();_0x22ee04[_0x71cb('0x21')]=_0x1a6592['map'](function(_0x3bf85a){return _[_0x71cb('0x45')](_0x3bf85a,_0x1bbf1c);});return _0x22ee04;})[_0x71cb('0x14')](respondWithFilteredResult(_0x1a5c82,_0xb834f6))[_0x71cb('0x46')](APIHandleError(_0x1a5c82));};exports['getQueues']=function(_0x371253,_0x19f47f){var _0xf15897={'count':0x0,'rows':[]};var _0x1e7310={};var _0x38518a;var _0x1a8638;var _0x5843ca;Promise['resolve']()['then'](function(){if(_0x371253['query'][_0x71cb('0x15')]){if(!utils[_0x71cb('0x16')](_0x371253[_0x71cb('0xe')][_0x71cb('0x15')])){throw new APIBadRequestError(util[_0x71cb('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x371253['query'][_0x71cb('0x15')]));}_0x38518a=_0x371253[_0x71cb('0xe')][_0x71cb('0x15')]['toLowerCase']();}var _0x13c158=_[_0x71cb('0x47')](_0x38518a)+_0x71cb('0x48');var _0x268a01=_[_0x71cb('0x25')](db[_0x13c158][_0x71cb('0x27')],function(_0x1c7641){return{'name':_0x1c7641['fieldName'],'type':_0x1c7641[_0x71cb('0x29')][_0x71cb('0x2a')]};});if(!_0x371253[_0x71cb('0xe')]['fields']){var _0x4fefd5=['id',_0x71cb('0x49')];if(_0x38518a===_0x71cb('0x40')){_0x4fefd5[_0x71cb('0x2e')](_0x71cb('0x29'));if(_0x371253[_0x71cb('0xe')]['type']===_0x71cb('0x4a')){_0x4fefd5[_0x71cb('0x2e')]([_0x71cb('0x4b'),_0x71cb('0x4c')]);}}_0x371253[_0x71cb('0xe')]['fields']=_0x4fefd5['join'](',');}_0x1e7310=qs[_0x71cb('0x2d')](_0x268a01,_0x371253);if(_0x371253[_0x71cb('0x35')][_0x71cb('0x2b')]===_0x71cb('0x35')){var _0x14a931={'params':{'id':_0x371253['user']['userProfileId']},'query':{'section':_0x38518a===_0x71cb('0x40')&&_0x371253[_0x71cb('0xe')][_0x71cb('0x29')]===_0x71cb('0x4a')?_0x71cb('0x4d'):_[_0x71cb('0x47')](_0x38518a)+_0x71cb('0x4e'),'type':_0x371253[_0x71cb('0xe')][_0x71cb('0x29')],'nolimit':!![],'sort':_0x71cb('0x49'),'filter':_0x371253[_0x71cb('0xe')][_0x71cb('0x4f')]}};_0x14a931[_0x71cb('0xe')]=Object[_0x71cb('0x50')](_0x14a931[_0x71cb('0xe')],_0x371253[_0x71cb('0xe')]);delete _0x14a931[_0x71cb('0xe')]['id'];return db['UserProfile']['getResources'](_0x14a931);}return db[_0x13c158]['findAndCountAll'](_0x1e7310);})['then'](function(_0x4b52b3){_0xf15897[_0x71cb('0xa')]=_0x4b52b3[_0x71cb('0xa')];_0x1a8638=_0x4b52b3['rows'];return rtq[_0x71cb('0x51')](_0x371253,_0x38518a);})[_0x71cb('0x14')](function(_0x22e799){_0x5843ca=_0x22e799['rows'];return rtq['initializeQueues'](_0x1a8638,_0x5843ca,_0x38518a,_0x371253['query'][_0x71cb('0x29')]);})[_0x71cb('0x14')](function(_0x4247e1){_0xf15897['rows']=_0x4247e1;return _0xf15897;})['then'](respondWithFilteredResult(_0x19f47f,_0x1e7310))[_0x71cb('0x46')](APIHandleError(_0x19f47f));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 25a1f04..3c21c48 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x258706,_0x42184f){var _0x3b5979=function(_0x1cee4b){while(--_0x1cee4b){_0x258706['push'](_0x258706['shift']());}};_0x3b5979(++_0x42184f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ba844,_0x525ef5){_0x4ba844=_0x4ba844-0x0;var _0x9429d1=_0xedd9[_0x4ba844];return _0x9429d1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x11d97f,_0x3a1caa){var _0x70c245=function(_0x36f801){while(--_0x36f801){_0x11d97f['push'](_0x11d97f['shift']());}};_0x70c245(++_0x3a1caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 07d1d4a..14e7c86 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 _0x4af9=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x52db35,_0x133dad){var _0x3a6b97=function(_0x667d05){while(--_0x667d05){_0x52db35['push'](_0x52db35['shift']());}};_0x3a6b97(++_0x133dad);}(_0x4af9,0x12c));var _0x94af=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4af9[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x94af('0x0'));module[_0x94af('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x94af('0x2')]},'uniqueid':{'type':Sequelize[_0x94af('0x3')]},'starttime':{'type':Sequelize[_0x94af('0x2')]},'responsetime':{'type':Sequelize[_0x94af('0x2')]},'ringtime':{'type':Sequelize[_0x94af('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x94af('0x3')]},'campaigntype':{'type':Sequelize[_0x94af('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed54=['exports','INTEGER','STRING','DATE'];(function(_0x2d6533,_0x4b34b0){var _0x398c10=function(_0x37a4e8){while(--_0x37a4e8){_0x2d6533['push'](_0x2d6533['shift']());}};_0x398c10(++_0x4b34b0);}(_0xed54,0xfc));var _0x4ed5=function(_0x3b64a1,_0x25e298){_0x3b64a1=_0x3b64a1-0x0;var _0x3de574=_0xed54[_0x3b64a1];return _0x3de574;};'use strict';var Sequelize=require('sequelize');module[_0x4ed5('0x0')]={'state':{'type':Sequelize[_0x4ed5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4ed5('0x2')]},'scheduledat':{'type':Sequelize[_0x4ed5('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4ed5('0x3')]},'responsetime':{'type':Sequelize[_0x4ed5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4ed5('0x2')]},'membername':{'type':Sequelize[_0x4ed5('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0421891..9fe7a9c 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 _0x9eb5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x3a4ceb,_0x2ee2e5){var _0x289903=function(_0x303012){while(--_0x303012){_0x3a4ceb['push'](_0x3a4ceb['shift']());}};_0x289903(++_0x2ee2e5);}(_0x9eb5,0xa3));var _0x59eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9eb5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x59eb('0x0'));var util=require(_0x59eb('0x1'));var logger=require(_0x59eb('0x2'))(_0x59eb('0x3'));var moment=require(_0x59eb('0x4'));var BPromise=require(_0x59eb('0x5'));var rp=require(_0x59eb('0x6'));var fs=require('fs');var path=require(_0x59eb('0x7'));var rimraf=require(_0x59eb('0x8'));var config=require(_0x59eb('0x9'));var attributes=require(_0x59eb('0xa'));module[_0x59eb('0xb')]=function(_0x521f27,_0x5c2f19){return _0x521f27[_0x59eb('0xc')](_0x59eb('0xd'),attributes,{'tableName':_0x59eb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x360f=['util','api','moment','request-promise','path','rimraf','../../config/environment','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x360f,0x135));var _0xf360=function(_0x20e18e,_0x4fc621){_0x20e18e=_0x20e18e-0x0;var _0x234a0e=_0x360f[_0x20e18e];return _0x234a0e;};'use strict';var _=require(_0xf360('0x0'));var util=require(_0xf360('0x1'));var logger=require('../../config/logger')(_0xf360('0x2'));var moment=require(_0xf360('0x3'));var BPromise=require('bluebird');var rp=require(_0xf360('0x4'));var fs=require('fs');var path=require(_0xf360('0x5'));var rimraf=require(_0xf360('0x6'));var config=require(_0xf360('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x1f5586,_0x4f4204){return _0x1f5586['define'](_0xf360('0x8'),attributes,{'tableName':_0xf360('0x9'),'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 3b0a263..121b3fa 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 _0x10d5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x10d5,0x14b));var _0x510d=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x10d5[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require(_0x510d('0x0'));var util=require('util');var moment=require(_0x510d('0x1'));var BPromise=require(_0x510d('0x2'));var rs=require(_0x510d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x510d('0x4'))['db'];var utils=require(_0x510d('0x5'));var logger=require(_0x510d('0x6'))(_0x510d('0x7'));var config=require(_0x510d('0x8'));var jayson=require(_0x510d('0x9'));var client=jayson['client'][_0x510d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1af875,_0x2223e0,_0x3e8523){return new BPromise(function(_0x2167d7,_0x28f8bc){return client[_0x510d('0xb')](_0x1af875,_0x3e8523)['then'](function(_0x5bfc2a){logger[_0x510d('0xc')](_0x510d('0xd'),_0x2223e0,_0x510d('0xe'));logger[_0x510d('0xf')](_0x510d('0x10'),_0x2223e0,_0x510d('0xe'),JSON[_0x510d('0x11')](_0x5bfc2a));if(_0x5bfc2a['error']){if(_0x5bfc2a[_0x510d('0x12')][_0x510d('0x13')]===0x1f4){logger[_0x510d('0x12')](_0x510d('0xd'),_0x2223e0,_0x5bfc2a[_0x510d('0x12')]['message']);return _0x28f8bc(_0x5bfc2a['error']['message']);}logger[_0x510d('0x12')](_0x510d('0xd'),_0x2223e0,_0x5bfc2a[_0x510d('0x12')][_0x510d('0x14')]);return _0x2167d7(_0x5bfc2a[_0x510d('0x12')][_0x510d('0x14')]);}else{logger[_0x510d('0xc')](_0x510d('0xd'),_0x2223e0,_0x510d('0xe'));_0x2167d7(_0x5bfc2a[_0x510d('0x15')][_0x510d('0x14')]);}})[_0x510d('0x16')](function(_0x333ed1){logger[_0x510d('0x12')](_0x510d('0xd'),_0x2223e0,_0x333ed1);_0x28f8bc(_0x333ed1);});});}exports[_0x510d('0x17')]=function(_0x3e1cc7){var _0x2bd1c3=this;return new Promise(function(_0x2a1c24,_0x39262a){return db[_0x510d('0x18')][_0x510d('0x19')](_0x3e1cc7[_0x510d('0x1a')],{'raw':_0x3e1cc7[_0x510d('0x1b')]?_0x3e1cc7['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a9dac){logger['info'](_0x510d('0x17'),_0x3e1cc7);logger[_0x510d('0xf')](_0x510d('0x17'),_0x3e1cc7,JSON['stringify'](_0x1a9dac));_0x2a1c24(_0x1a9dac);})[_0x510d('0x16')](function(_0x3b33d7){logger[_0x510d('0x12')](_0x510d('0x17'),_0x3b33d7[_0x510d('0x14')],_0x3e1cc7);_0x39262a(_0x2bd1c3['error'](0x1f4,_0x3b33d7['message']));});});}; \ No newline at end of file +var _0x0553=['catch','CreateReportAgentPreview','body','options','raw','info','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0553,0x88));var _0x3055=function(_0x51dada,_0x4ddb59){_0x51dada=_0x51dada-0x0;var _0x209d74=_0x0553[_0x51dada];return _0x209d74;};'use strict';var _=require(_0x3055('0x0'));var util=require(_0x3055('0x1'));var moment=require(_0x3055('0x2'));var BPromise=require('bluebird');var rs=require(_0x3055('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3055('0x4'));var logger=require(_0x3055('0x5'))(_0x3055('0x6'));var config=require(_0x3055('0x7'));var jayson=require(_0x3055('0x8'));var client=jayson[_0x3055('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cd895,_0x2c5354,_0x1bc96a){return new BPromise(function(_0x548159,_0xbedf2d){return client['request'](_0x3cd895,_0x1bc96a)[_0x3055('0xa')](function(_0x2de26b){logger['info'](_0x3055('0xb'),_0x2c5354,_0x3055('0xc'));logger[_0x3055('0xd')](_0x3055('0xe'),_0x2c5354,_0x3055('0xc'),JSON[_0x3055('0xf')](_0x2de26b));if(_0x2de26b['error']){if(_0x2de26b[_0x3055('0x10')][_0x3055('0x11')]===0x1f4){logger['error'](_0x3055('0xb'),_0x2c5354,_0x2de26b[_0x3055('0x10')][_0x3055('0x12')]);return _0xbedf2d(_0x2de26b['error']['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2c5354,_0x2de26b[_0x3055('0x10')][_0x3055('0x12')]);return _0x548159(_0x2de26b[_0x3055('0x10')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x2c5354,'request\x20sent');_0x548159(_0x2de26b[_0x3055('0x13')][_0x3055('0x12')]);}})[_0x3055('0x14')](function(_0x46a729){logger['error'](_0x3055('0xb'),_0x2c5354,_0x46a729);_0xbedf2d(_0x46a729);});});}exports[_0x3055('0x15')]=function(_0x56c6ee){var _0x579858=this;return new Promise(function(_0x3d5a3c,_0x10bd51){return db['ReportAgentPreview']['create'](_0x56c6ee[_0x3055('0x16')],{'raw':_0x56c6ee['options']?_0x56c6ee[_0x3055('0x17')][_0x3055('0x18')]===undefined?!![]:![]:!![]})[_0x3055('0xa')](function(_0x5df379){logger[_0x3055('0x19')]('CreateReportAgentPreview',_0x56c6ee);logger[_0x3055('0xd')](_0x3055('0x15'),_0x56c6ee,JSON[_0x3055('0xf')](_0x5df379));_0x3d5a3c(_0x5df379);})[_0x3055('0x14')](function(_0x14e419){logger['error'](_0x3055('0x15'),_0x14e419[_0x3055('0x12')],_0x56c6ee);_0x10bd51(_0x579858[_0x3055('0x10')](0x1f4,_0x14e419[_0x3055('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 5057c1d..da04080 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 _0x153c=['/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','/openchannel/queues','/sms/queues'];(function(_0x3f8ae3,_0x60d330){var _0x36ce85=function(_0x546d9b){while(--_0x546d9b){_0x3f8ae3['push'](_0x3f8ae3['shift']());}};_0x36ce85(++_0x60d330);}(_0x153c,0x8c));var _0xc153=function(_0x2d1103,_0xaf32b2){_0x2d1103=_0x2d1103-0x0;var _0x18d4c5=_0x153c[_0x2d1103];return _0x18d4c5;};'use strict';var multer=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var path=require(_0xc153('0x2'));var express=require(_0xc153('0x3'));var router=express['Router']();var auth=require(_0xc153('0x4'));var controller=require(_0xc153('0x5'));router[_0xc153('0x6')](_0xc153('0x7'),auth[_0xc153('0x8')](),controller[_0xc153('0x9')]);router[_0xc153('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xc153('0x8')](),controller[_0xc153('0xa')]);router[_0xc153('0x6')](_0xc153('0xb'),auth[_0xc153('0x8')](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0xc153('0x8')](),controller[_0xc153('0xc')]);router[_0xc153('0x6')](_0xc153('0xd'),auth[_0xc153('0x8')](),controller['chatQueues']);router['get'](_0xc153('0xe'),auth[_0xc153('0x8')](),controller['mailQueues']);router[_0xc153('0x6')](_0xc153('0xf'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xc153('0x6')](_0xc153('0x10'),auth[_0xc153('0x8')](),controller['openchannelQueues']);router[_0xc153('0x6')](_0xc153('0x11'),auth[_0xc153('0x8')](),controller['smsQueues']);router[_0xc153('0x6')](_0xc153('0x12'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xc153('0x6')](_0xc153('0x13'),auth[_0xc153('0x8')](),controller[_0xc153('0x14')]);router[_0xc153('0x6')](_0xc153('0x15'),auth[_0xc153('0x8')](),controller[_0xc153('0x16')]);router['get'](_0xc153('0x17'),auth[_0xc153('0x8')](),controller[_0xc153('0x18')]);router['get'](_0xc153('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xc153('0x6')](_0xc153('0x1a'),auth[_0xc153('0x8')](),controller[_0xc153('0x1b')]);router[_0xc153('0x6')](_0xc153('0x1c'),auth['isAuthenticated'](),controller[_0xc153('0x1d')]);router['get'](_0xc153('0x1e'),auth[_0xc153('0x8')](),controller[_0xc153('0x1f')]);router[_0xc153('0x20')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xc153('0x21')]);router['get'](_0xc153('0x22'),auth[_0xc153('0x8')](),controller[_0xc153('0x23')]);router[_0xc153('0x6')]('/outbound/channels',auth[_0xc153('0x8')](),controller[_0xc153('0x24')]);router[_0xc153('0x6')](_0xc153('0x25'),auth[_0xc153('0x8')](),controller[_0xc153('0x26')]);router['put'](_0xc153('0x27'),auth['isAuthenticated'](),controller[_0xc153('0x28')]);router[_0xc153('0x6')]('/telephones',auth[_0xc153('0x8')](),controller[_0xc153('0x29')]);router['get'](_0xc153('0x2a'),auth[_0xc153('0x8')](),controller[_0xc153('0x2b')]);router['get'](_0xc153('0x2c'),auth[_0xc153('0x8')](),controller[_0xc153('0x2d')]);router['get'](_0xc153('0x2e'),auth[_0xc153('0x8')](),controller[_0xc153('0x2f')]);router[_0xc153('0x6')]('/chat/queues/waitinginteractions',auth[_0xc153('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xc153('0x6')]('/mail/queues/waitinginteractions',auth[_0xc153('0x8')](),controller[_0xc153('0x30')]);router['get'](_0xc153('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xc153('0x6')](_0xc153('0x32'),auth[_0xc153('0x8')](),controller[_0xc153('0x33')]);router[_0xc153('0x6')]('/sms/queues/waitinginteractions',auth[_0xc153('0x8')](),controller[_0xc153('0x34')]);router[_0xc153('0x6')](_0xc153('0x35'),auth[_0xc153('0x8')](),controller[_0xc153('0x36')]);router[_0xc153('0x6')](_0xc153('0x37'),auth[_0xc153('0x8')](),controller[_0xc153('0x38')]);router['post']('/mail/queues/:id/notify',auth[_0xc153('0x8')](),controller['queueNotify'](_0xc153('0x39')));router[_0xc153('0x6')](_0xc153('0x3a'),auth['isAuthenticated'](),controller[_0xc153('0x3b')]);router[_0xc153('0x3c')](_0xc153('0x3d'),auth[_0xc153('0x8')](),controller[_0xc153('0x3e')](_0xc153('0x3f')));router[_0xc153('0x6')](_0xc153('0x40'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0xc153('0x3c')](_0xc153('0x41'),auth[_0xc153('0x8')](),controller[_0xc153('0x3e')](_0xc153('0x42')));router[_0xc153('0x6')]('/fax/queues/:id',auth[_0xc153('0x8')](),controller[_0xc153('0x43')]);router[_0xc153('0x3c')]('/openchannel/queues/:id/notify',auth[_0xc153('0x8')](),controller[_0xc153('0x3e')](_0xc153('0x44')));router['get']('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0xc153('0x45'),auth['isAuthenticated'](),controller[_0xc153('0x3e')](_0xc153('0x46')));router[_0xc153('0x3c')](_0xc153('0x47'),auth[_0xc153('0x8')](),controller[_0xc153('0x3e')](_0xc153('0x48')));router[_0xc153('0x6')](_0xc153('0x49'),auth[_0xc153('0x8')](),controller[_0xc153('0x4a')]);router[_0xc153('0x6')](_0xc153('0x4b'),auth['isAuthenticated'](),controller[_0xc153('0x4c')]);router[_0xc153('0x3c')](_0xc153('0x4d'),auth[_0xc153('0x8')](),controller[_0xc153('0x4e')]);module['exports']=router; \ No newline at end of file +var _0x76ad=['/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','put','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','queueNotify','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x76ad,0x9a));var _0xd76a=function(_0xb011d6,_0x74d4eb){_0xb011d6=_0xb011d6-0x0;var _0x1e30f1=_0x76ad[_0xb011d6];return _0x1e30f1;};'use strict';var multer=require(_0xd76a('0x0'));var util=require(_0xd76a('0x1'));var path=require(_0xd76a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd76a('0x3'));var controller=require('./rpc.controller');router[_0xd76a('0x4')](_0xd76a('0x5'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x7')]);router[_0xd76a('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xd76a('0x8')]);router[_0xd76a('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xd76a('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xd76a('0x4')]('/voice/queues',auth['isAuthenticated'](),controller[_0xd76a('0x9')]);router['get'](_0xd76a('0xa'),auth[_0xd76a('0x6')](),controller[_0xd76a('0xb')]);router[_0xd76a('0x4')]('/mail/queues',auth[_0xd76a('0x6')](),controller[_0xd76a('0xc')]);router[_0xd76a('0x4')](_0xd76a('0xd'),auth[_0xd76a('0x6')](),controller[_0xd76a('0xe')]);router['get']('/openchannel/queues',auth[_0xd76a('0x6')](),controller['openchannelQueues']);router[_0xd76a('0x4')](_0xd76a('0xf'),auth['isAuthenticated'](),controller[_0xd76a('0x10')]);router['get']('/whatsapp/queues',auth[_0xd76a('0x6')](),controller['whatsappQueues']);router[_0xd76a('0x4')](_0xd76a('0x11'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x12')]);router['get'](_0xd76a('0x13'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x14')]);router['get'](_0xd76a('0x15'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x16')]);router[_0xd76a('0x4')](_0xd76a('0x17'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x18')]);router['get'](_0xd76a('0x19'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x1a')]);router[_0xd76a('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xd76a('0x6')](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth[_0xd76a('0x6')](),controller['showVoiceQueues']);router[_0xd76a('0x1b')](_0xd76a('0x1c'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get'](_0xd76a('0x1d'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x1e')]);router[_0xd76a('0x4')]('/outbound/channels',auth[_0xd76a('0x6')](),controller[_0xd76a('0x1f')]);router[_0xd76a('0x4')](_0xd76a('0x20'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x21')]);router[_0xd76a('0x1b')](_0xd76a('0x22'),auth['isAuthenticated'](),controller[_0xd76a('0x23')]);router[_0xd76a('0x4')](_0xd76a('0x24'),auth['isAuthenticated'](),controller[_0xd76a('0x25')]);router['get'](_0xd76a('0x26'),auth[_0xd76a('0x6')](),controller['trunks']);router[_0xd76a('0x4')](_0xd76a('0x27'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x28')]);router['get'](_0xd76a('0x29'),auth['isAuthenticated'](),controller[_0xd76a('0x2a')]);router['get'](_0xd76a('0x2b'),auth['isAuthenticated'](),controller[_0xd76a('0x2c')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xd76a('0x2d')]);router['get'](_0xd76a('0x2e'),auth['isAuthenticated'](),controller[_0xd76a('0x2f')]);router[_0xd76a('0x4')](_0xd76a('0x30'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xd76a('0x4')]('/sms/queues/waitinginteractions',auth[_0xd76a('0x6')](),controller[_0xd76a('0x31')]);router[_0xd76a('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0xd76a('0x6')](),controller[_0xd76a('0x32')]);router[_0xd76a('0x4')](_0xd76a('0x33'),auth['isAuthenticated'](),controller[_0xd76a('0x34')]);router['post'](_0xd76a('0x35'),auth['isAuthenticated'](),controller['queueNotify'](_0xd76a('0x36')));router['get'](_0xd76a('0x37'),auth['isAuthenticated'](),controller[_0xd76a('0x38')]);router['post']('/chat/queues/:id/notify',auth[_0xd76a('0x6')](),controller['queueNotify'](_0xd76a('0x39')));router[_0xd76a('0x4')](_0xd76a('0x3a'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x3b')]);router[_0xd76a('0x3c')](_0xd76a('0x3d'),auth[_0xd76a('0x6')](),controller['queueNotify'](_0xd76a('0x3e')));router[_0xd76a('0x4')](_0xd76a('0x3f'),auth['isAuthenticated'](),controller[_0xd76a('0x40')]);router[_0xd76a('0x3c')]('/openchannel/queues/:id/notify',auth[_0xd76a('0x6')](),controller[_0xd76a('0x41')]('openchannel'));router['get'](_0xd76a('0x42'),auth[_0xd76a('0x6')](),controller['showOpenchannelQueues']);router['post'](_0xd76a('0x43'),auth[_0xd76a('0x6')](),controller['queueNotify']('sms'));router[_0xd76a('0x3c')](_0xd76a('0x44'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x41')]('whatsapp'));router['get'](_0xd76a('0x45'),auth['isAuthenticated'](),controller[_0xd76a('0x46')]);router[_0xd76a('0x4')](_0xd76a('0x47'),auth[_0xd76a('0x6')](),controller[_0xd76a('0x48')]);router[_0xd76a('0x3c')]('/agents/:id/notify',auth[_0xd76a('0x6')](),controller[_0xd76a('0x49')]);module[_0xd76a('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 58f1009..33f7c36 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x226d85,_0xab59f9){var _0x581612=function(_0x52f61e){while(--_0x52f61e){_0x226d85['push'](_0x226d85['shift']());}};_0x581612(++_0xab59f9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3e9da70..f43781c 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 _0x7fcf=['show','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x7fcf,0x1a3));var _0xf7fc=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7fcf[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require('multer');var util=require(_0xf7fc('0x0'));var path=require(_0xf7fc('0x1'));var timeout=require(_0xf7fc('0x2'));var express=require(_0xf7fc('0x3'));var router=express[_0xf7fc('0x4')]();var fs_extra=require(_0xf7fc('0x5'));var auth=require(_0xf7fc('0x6'));var interaction=require(_0xf7fc('0x7'));var config=require(_0xf7fc('0x8'));var controller=require(_0xf7fc('0x9'));router[_0xf7fc('0xa')]('/',auth[_0xf7fc('0xb')](),controller[_0xf7fc('0xc')]);router['get']('/:id',auth[_0xf7fc('0xb')](),controller[_0xf7fc('0xd')]);router[_0xf7fc('0xa')](_0xf7fc('0xe'),auth[_0xf7fc('0xb')](),controller[_0xf7fc('0xf')]);router[_0xf7fc('0x10')]('/',auth[_0xf7fc('0xb')](),controller[_0xf7fc('0x11')]);router[_0xf7fc('0x12')](_0xf7fc('0x13'),auth[_0xf7fc('0xb')](),controller[_0xf7fc('0x14')]);router[_0xf7fc('0x15')]('/:id',auth[_0xf7fc('0xb')](),controller[_0xf7fc('0x16')]);module[_0xf7fc('0x17')]=router; \ No newline at end of file +var _0xccd2=['../../config/environment','get','isAuthenticated','index','/:id','show','run','post','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5608b0,_0x5d0a5f){var _0x265d25=function(_0x2f0822){while(--_0x2f0822){_0x5608b0['push'](_0x5608b0['shift']());}};_0x265d25(++_0x5d0a5f);}(_0xccd2,0x116));var _0x2ccd=function(_0x48e2f2,_0x1a92f1){_0x48e2f2=_0x48e2f2-0x0;var _0xe32dbb=_0xccd2[_0x48e2f2];return _0xe32dbb;};'use strict';var multer=require(_0x2ccd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ccd('0x1'));var express=require(_0x2ccd('0x2'));var router=express[_0x2ccd('0x3')]();var fs_extra=require(_0x2ccd('0x4'));var auth=require(_0x2ccd('0x5'));var interaction=require(_0x2ccd('0x6'));var config=require(_0x2ccd('0x7'));var controller=require('./schedule.controller');router[_0x2ccd('0x8')]('/',auth[_0x2ccd('0x9')](),controller[_0x2ccd('0xa')]);router[_0x2ccd('0x8')](_0x2ccd('0xb'),auth[_0x2ccd('0x9')](),controller[_0x2ccd('0xc')]);router[_0x2ccd('0x8')]('/:id/run',auth[_0x2ccd('0x9')](),controller[_0x2ccd('0xd')]);router[_0x2ccd('0xe')]('/',auth[_0x2ccd('0x9')](),controller['create']);router[_0x2ccd('0xf')](_0x2ccd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2ccd('0x10')]('/:id',auth[_0x2ccd('0x9')](),controller[_0x2ccd('0x11')]);module[_0x2ccd('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 83c63d8..75ffaec 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 _0xe003=['weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0xe003,0x1ea));var _0x3e00=function(_0x3c02fb,_0x1f55ff){_0x3c02fb=_0x3c02fb-0x0;var _0x14a55f=_0xe003[_0x3c02fb];return _0x14a55f;};'use strict';var Sequelize=require(_0x3e00('0x0'));module[_0x3e00('0x1')]={'name':{'type':Sequelize[_0x3e00('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3e00('0x2')]},'active':{'type':Sequelize[_0x3e00('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3e00('0x2')],'allowNull':![],'defaultValue':_0x3e00('0x4')},'startAt':{'type':Sequelize[_0x3e00('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3e00('0x6')](_0x3e00('0x7'),_0x3e00('0x8'),_0x3e00('0x9'),_0x3e00('0xa'),_0x3e00('0xb'),_0x3e00('0xc'),_0x3e00('0xd')),'allowNull':![],'defaultValue':_0x3e00('0xb')},'output':{'type':Sequelize[_0x3e00('0x6')](_0x3e00('0xe'),_0x3e00('0xf'),_0x3e00('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x3e00('0x6')](_0x3e00('0x11'),_0x3e00('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x3e00('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3e00('0x13')]},'bcc':{'type':Sequelize[_0x3e00('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xecc2=['default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','weeks','days','minutes','csv','xlsx','custom'];(function(_0xcc05ed,_0x44eb83){var _0x24a2f5=function(_0x37b8ea){while(--_0x37b8ea){_0xcc05ed['push'](_0xcc05ed['shift']());}};_0x24a2f5(++_0x44eb83);}(_0xecc2,0xe0));var _0x2ecc=function(_0x21065c,_0x23839c){_0x21065c=_0x21065c-0x0;var _0x3500c0=_0xecc2[_0x21065c];return _0x3500c0;};'use strict';var Sequelize=require(_0x2ecc('0x0'));module[_0x2ecc('0x1')]={'name':{'type':Sequelize[_0x2ecc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2ecc('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2ecc('0x2')],'allowNull':![],'defaultValue':_0x2ecc('0x3')},'startAt':{'type':Sequelize[_0x2ecc('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2ecc('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2ecc('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2ecc('0x6')](_0x2ecc('0x7'),'quarters','months',_0x2ecc('0x8'),_0x2ecc('0x9'),'hours',_0x2ecc('0xa')),'allowNull':![],'defaultValue':_0x2ecc('0x9')},'output':{'type':Sequelize[_0x2ecc('0x6')](_0x2ecc('0xb'),'pdf',_0x2ecc('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x2ecc('0xd'),_0x2ecc('0xe')),'allowNull':![],'defaultValue':_0x2ecc('0xd')},'sendMail':{'type':Sequelize[_0x2ecc('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0x2ecc('0x2')]},'cc':{'type':Sequelize[_0x2ecc('0x10')]},'bcc':{'type':Sequelize[_0x2ecc('0x10')]},'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 3a29b97..6015cdb 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 _0x94cb=['count','status','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','send','index','map','Schedule','rawAttributes','fieldName','type','name','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','find','run','../../config/schedule','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','offset','undefined','limit'];(function(_0x116309,_0x5bd0f4){var _0x2ac01f=function(_0x29c3f9){while(--_0x29c3f9){_0x116309['push'](_0x116309['shift']());}};_0x2ac01f(++_0x5bd0f4);}(_0x94cb,0x86));var _0xb94c=function(_0x5001a4,_0x40c316){_0x5001a4=_0x5001a4-0x0;var _0x58aa97=_0x94cb[_0x5001a4];return _0x58aa97;};'use strict';var emlformat=require(_0xb94c('0x0'));var rimraf=require(_0xb94c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb94c('0x2'));var rp=require('request-promise');var moment=require(_0xb94c('0x3'));var BPromise=require(_0xb94c('0x4'));var Mustache=require(_0xb94c('0x5'));var util=require(_0xb94c('0x6'));var path=require(_0xb94c('0x7'));var sox=require(_0xb94c('0x8'));var csv=require(_0xb94c('0x9'));var ejs=require(_0xb94c('0xa'));var fs=require('fs');var fs_extra=require(_0xb94c('0xb'));var _=require(_0xb94c('0xc'));var squel=require(_0xb94c('0xd'));var crypto=require('crypto');var jsforce=require(_0xb94c('0xe'));var deskjs=require(_0xb94c('0xf'));var toCsv=require(_0xb94c('0x9'));var querystring=require('querystring');var Papa=require(_0xb94c('0x10'));var Redis=require('ioredis');var authService=require(_0xb94c('0x11'));var qs=require(_0xb94c('0x12'));var as=require(_0xb94c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb94c('0x14'))(_0xb94c('0x15'));var utils=require(_0xb94c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xde3881,_0x48750b){_0x48750b=_0x48750b||0xcc;return function(_0x48d794){if(_0x48d794){return _0xde3881[_0xb94c('0x17')](_0x48750b);}return _0xde3881['status'](_0x48750b)[_0xb94c('0x18')]();};}function respondWithResult(_0x22e373,_0x39697d){_0x39697d=_0x39697d||0xc8;return function(_0x5d4a44){if(_0x5d4a44){return _0x22e373['status'](_0x39697d)['json'](_0x5d4a44);}};}function respondWithFilteredResult(_0x501b69,_0x185d2a){return function(_0x37f8e5){if(_0x37f8e5){var _0x206fc7=typeof _0x185d2a[_0xb94c('0x19')]===_0xb94c('0x1a')&&typeof _0x185d2a[_0xb94c('0x1b')]===_0xb94c('0x1a');var _0x16f4e4=_0x37f8e5['count'];var _0x48f48b=_0x206fc7?0x0:_0x185d2a[_0xb94c('0x19')];var _0x304827=_0x206fc7?_0x37f8e5[_0xb94c('0x1c')]:_0x185d2a[_0xb94c('0x19')]+_0x185d2a[_0xb94c('0x1b')];var _0xd4c522;if(_0x304827>=_0x16f4e4){_0x304827=_0x16f4e4;_0xd4c522=0xc8;}else{_0xd4c522=0xce;}_0x501b69[_0xb94c('0x1d')](_0xd4c522);return _0x501b69['set'](_0xb94c('0x1e'),_0x48f48b+'-'+_0x304827+'/'+_0x16f4e4)['json'](_0x37f8e5);}return null;};}function patchUpdates(_0x230616){return function(_0xa2289f){try{jsonpatch[_0xb94c('0x1f')](_0xa2289f,_0x230616,!![]);}catch(_0x1a5162){return BPromise[_0xb94c('0x20')](_0x1a5162);}return _0xa2289f[_0xb94c('0x21')]();};}function saveUpdates(_0x1021ce,_0x5350da){return function(_0x193266){if(_0x193266){return _0x193266[_0xb94c('0x22')](_0x1021ce)[_0xb94c('0x23')](function(_0x2c5c76){return _0x2c5c76;});}return null;};}function removeEntity(_0x306010,_0xb5793d){return function(_0x392ea8){if(_0x392ea8){return _0x392ea8[_0xb94c('0x24')]()['then'](function(){var _0x48b1fe=_0x392ea8[_0xb94c('0x25')]({'plain':!![]});var _0xc6e652=_0xb94c('0x26');return db[_0xb94c('0x27')]['destroy']({'where':{'type':_0xc6e652,'resourceId':_0x48b1fe['id']}})[_0xb94c('0x23')](function(){return _0x392ea8;});})[_0xb94c('0x23')](function(){_0x306010[_0xb94c('0x1d')](0xcc)[_0xb94c('0x18')]();});}};}function handleEntityNotFound(_0x3e11cd,_0xb95b32){return function(_0x3e4ae7){if(!_0x3e4ae7){_0x3e11cd[_0xb94c('0x17')](0x194);}return _0x3e4ae7;};}function handleError(_0x1a8329,_0x1d919b){_0x1d919b=_0x1d919b||0x1f4;return function(_0xcb1a4b){logger[_0xb94c('0x28')](_0xcb1a4b[_0xb94c('0x29')]);if(_0xcb1a4b['name']){delete _0xcb1a4b['name'];}_0x1a8329[_0xb94c('0x1d')](_0x1d919b)[_0xb94c('0x2a')](_0xcb1a4b);};}exports[_0xb94c('0x2b')]=function(_0x4cd501,_0x370398){var _0x3cf8ea={},_0x161bad={},_0x18462e={'count':0x0,'rows':[]};var _0x164f3f=_[_0xb94c('0x2c')](db[_0xb94c('0x2d')][_0xb94c('0x2e')],function(_0x129445){return{'name':_0x129445[_0xb94c('0x2f')],'type':_0x129445[_0xb94c('0x30')]['key']};});_0x161bad['model']=_['map'](_0x164f3f,_0xb94c('0x31'));_0x161bad[_0xb94c('0x32')]=_[_0xb94c('0x33')](_0x4cd501[_0xb94c('0x32')]);_0x161bad['filters']=_[_0xb94c('0x34')](_0x161bad[_0xb94c('0x35')],_0x161bad[_0xb94c('0x32')]);_0x3cf8ea[_0xb94c('0x36')]=_[_0xb94c('0x34')](_0x161bad[_0xb94c('0x35')],qs[_0xb94c('0x37')](_0x4cd501[_0xb94c('0x32')][_0xb94c('0x37')]));_0x3cf8ea[_0xb94c('0x36')]=_0x3cf8ea[_0xb94c('0x36')][_0xb94c('0x38')]?_0x3cf8ea['attributes']:_0x161bad[_0xb94c('0x35')];if(!_0x4cd501[_0xb94c('0x32')]['hasOwnProperty']('nolimit')){_0x3cf8ea[_0xb94c('0x1b')]=qs[_0xb94c('0x1b')](_0x4cd501[_0xb94c('0x32')][_0xb94c('0x1b')]);_0x3cf8ea['offset']=qs[_0xb94c('0x19')](_0x4cd501['query'][_0xb94c('0x19')]);}_0x3cf8ea[_0xb94c('0x39')]=qs['sort'](_0x4cd501[_0xb94c('0x32')][_0xb94c('0x3a')]);_0x3cf8ea[_0xb94c('0x3b')]=qs[_0xb94c('0x3c')](_[_0xb94c('0x3d')](_0x4cd501['query'],_0x161bad[_0xb94c('0x3c')]),_0x164f3f);if(_0x4cd501['query'][_0xb94c('0x3e')]){_0x3cf8ea[_0xb94c('0x3b')]=_['merge'](_0x3cf8ea[_0xb94c('0x3b')],{'$or':_['map'](_0x164f3f,function(_0x1abc48){if(_0x1abc48[_0xb94c('0x30')]!=='VIRTUAL'){var _0x78c195={};_0x78c195[_0x1abc48[_0xb94c('0x31')]]={'$like':'%'+_0x4cd501['query'][_0xb94c('0x3e')]+'%'};return _0x78c195;}})});}_0x3cf8ea=_[_0xb94c('0x3f')]({},_0x3cf8ea,_0x4cd501[_0xb94c('0x40')]);var _0x59d613={'where':_0x3cf8ea['where']};return db[_0xb94c('0x2d')][_0xb94c('0x1c')](_0x59d613)[_0xb94c('0x23')](function(_0x3d91db){_0x18462e[_0xb94c('0x1c')]=_0x3d91db;if(_0x4cd501['query'][_0xb94c('0x41')]){_0x3cf8ea[_0xb94c('0x42')]=[{'all':!![]}];}return db[_0xb94c('0x2d')]['findAll'](_0x3cf8ea);})[_0xb94c('0x23')](function(_0x5de6b3){_0x18462e[_0xb94c('0x43')]=_0x5de6b3;return _0x18462e;})['then'](respondWithFilteredResult(_0x370398,_0x3cf8ea))[_0xb94c('0x44')](handleError(_0x370398,null));};exports[_0xb94c('0x45')]=function(_0x2ab049,_0x2c1ece){var _0x3a7b18={'raw':![],'where':{'id':_0x2ab049[_0xb94c('0x46')]['id']}},_0x4639bf={};_0x4639bf[_0xb94c('0x35')]=_[_0xb94c('0x33')](db[_0xb94c('0x2d')][_0xb94c('0x2e')]);_0x4639bf['query']=_[_0xb94c('0x33')](_0x2ab049[_0xb94c('0x32')]);_0x4639bf[_0xb94c('0x3c')]=_[_0xb94c('0x34')](_0x4639bf['model'],_0x4639bf[_0xb94c('0x32')]);_0x3a7b18['attributes']=_[_0xb94c('0x34')](_0x4639bf['model'],qs[_0xb94c('0x37')](_0x2ab049[_0xb94c('0x32')][_0xb94c('0x37')]));_0x3a7b18[_0xb94c('0x36')]=_0x3a7b18[_0xb94c('0x36')][_0xb94c('0x38')]?_0x3a7b18[_0xb94c('0x36')]:_0x4639bf['model'];if(_0x2ab049[_0xb94c('0x32')]['includeAll']){_0x3a7b18[_0xb94c('0x42')]=[{'all':!![]}];}_0x3a7b18=_['merge']({},_0x3a7b18,_0x2ab049['options']);return db[_0xb94c('0x2d')]['find'](_0x3a7b18)[_0xb94c('0x23')](handleEntityNotFound(_0x2c1ece,null))['then'](respondWithResult(_0x2c1ece,null))[_0xb94c('0x44')](handleError(_0x2c1ece,null));};exports[_0xb94c('0x47')]=function(_0xc014fa,_0x2bc986){return db['Schedule'][_0xb94c('0x47')](_0xc014fa[_0xb94c('0x48')],{})[_0xb94c('0x23')](function(_0x481b0f){var _0xbe0c71=_0xc014fa[_0xb94c('0x49')][_0xb94c('0x25')]({'plain':!![]});if(!_0xbe0c71)throw new Error(_0xb94c('0x4a'));if(_0xbe0c71[_0xb94c('0x4b')]==='user'){var _0x205b86=_0x481b0f['get']({'plain':!![]});var _0x63c71c=_0xb94c('0x26');return db[_0xb94c('0x4c')]['find']({'where':{'name':_0x63c71c,'userProfileId':_0xbe0c71['userProfileId']},'raw':!![]})[_0xb94c('0x23')](function(_0x36964d){if(_0x36964d&&_0x36964d[_0xb94c('0x4d')]===0x0){return db[_0xb94c('0x27')][_0xb94c('0x47')]({'name':_0x205b86[_0xb94c('0x31')],'resourceId':_0x205b86['id'],'type':_0x36964d[_0xb94c('0x31')],'sectionId':_0x36964d['id']},{})['then'](function(){return _0x481b0f;});}else{return _0x481b0f;}})[_0xb94c('0x44')](function(_0x4f966a){logger[_0xb94c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f966a);throw _0x4f966a;});}return _0x481b0f;})[_0xb94c('0x23')](respondWithResult(_0x2bc986,0xc9))['catch'](handleError(_0x2bc986,null));};exports[_0xb94c('0x22')]=function(_0x45bf01,_0x1a35cb){if(_0x45bf01['body']['id']){delete _0x45bf01[_0xb94c('0x48')]['id'];}return db['Schedule'][_0xb94c('0x4e')]({'where':{'id':_0x45bf01[_0xb94c('0x46')]['id']}})[_0xb94c('0x23')](handleEntityNotFound(_0x1a35cb,null))[_0xb94c('0x23')](saveUpdates(_0x45bf01[_0xb94c('0x48')],null))[_0xb94c('0x23')](respondWithResult(_0x1a35cb,null))[_0xb94c('0x44')](handleError(_0x1a35cb,null));};exports[_0xb94c('0x24')]=function(_0x198d90,_0x5ece23){return db['Schedule'][_0xb94c('0x4e')]({'where':{'id':_0x198d90[_0xb94c('0x46')]['id']}})[_0xb94c('0x23')](handleEntityNotFound(_0x5ece23,null))[_0xb94c('0x23')](removeEntity(_0x5ece23,null))['catch'](handleError(_0x5ece23,null));};exports[_0xb94c('0x4f')]=function(_0x4c2cc5,_0x385df9,_0x533a24){var _0x110f59=require(_0xb94c('0x50'));return db[_0xb94c('0x2d')]['find']({'where':{'id':_0x4c2cc5[_0xb94c('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x385df9,null))[_0xb94c('0x23')](function(){_0x110f59['run'](_0x4c2cc5['params']['id']);})[_0xb94c('0x23')](respondWithStatusCode(_0x385df9,null))[_0xb94c('0x44')](handleError(_0x385df9,null));}; \ No newline at end of file +var _0x045b=['undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','Schedule','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x045b,0x95));var _0xb045=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x045b[_0x55c00d];return _0x254a8f;};'use strict';var emlformat=require(_0xb045('0x0'));var rimraf=require(_0xb045('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb045('0x2'));var BPromise=require(_0xb045('0x3'));var Mustache=require(_0xb045('0x4'));var util=require(_0xb045('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb045('0x6'));var ejs=require(_0xb045('0x7'));var fs=require('fs');var fs_extra=require(_0xb045('0x8'));var _=require(_0xb045('0x9'));var squel=require(_0xb045('0xa'));var crypto=require(_0xb045('0xb'));var jsforce=require(_0xb045('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb045('0x6'));var querystring=require(_0xb045('0xd'));var Papa=require(_0xb045('0xe'));var Redis=require(_0xb045('0xf'));var authService=require(_0xb045('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb045('0x11'));var hardwareService=require(_0xb045('0x12'));var logger=require(_0xb045('0x13'))(_0xb045('0x14'));var utils=require(_0xb045('0x15'));var config=require(_0xb045('0x16'));var licenseUtil=require(_0xb045('0x17'));var db=require(_0xb045('0x18'))['db'];function respondWithStatusCode(_0x1a8a5a,_0x5b22de){_0x5b22de=_0x5b22de||0xcc;return function(_0x208ca9){if(_0x208ca9){return _0x1a8a5a[_0xb045('0x19')](_0x5b22de);}return _0x1a8a5a[_0xb045('0x1a')](_0x5b22de)['end']();};}function respondWithResult(_0xe7ed32,_0x451841){_0x451841=_0x451841||0xc8;return function(_0xa8e1c2){if(_0xa8e1c2){return _0xe7ed32[_0xb045('0x1a')](_0x451841)['json'](_0xa8e1c2);}};}function respondWithFilteredResult(_0x4eb6d0,_0x487627){return function(_0x2e70f6){if(_0x2e70f6){var _0x3451e9=typeof _0x487627['offset']===_0xb045('0x1b')&&typeof _0x487627[_0xb045('0x1c')]===_0xb045('0x1b');var _0x5b28f3=_0x2e70f6[_0xb045('0x1d')];var _0x4a1b22=_0x3451e9?0x0:_0x487627[_0xb045('0x1e')];var _0x39856b=_0x3451e9?_0x2e70f6['count']:_0x487627[_0xb045('0x1e')]+_0x487627[_0xb045('0x1c')];var _0x5df044;if(_0x39856b>=_0x5b28f3){_0x39856b=_0x5b28f3;_0x5df044=0xc8;}else{_0x5df044=0xce;}_0x4eb6d0[_0xb045('0x1a')](_0x5df044);return _0x4eb6d0[_0xb045('0x1f')](_0xb045('0x20'),_0x4a1b22+'-'+_0x39856b+'/'+_0x5b28f3)[_0xb045('0x21')](_0x2e70f6);}return null;};}function patchUpdates(_0x1f1d0b){return function(_0x32d955){try{jsonpatch[_0xb045('0x22')](_0x32d955,_0x1f1d0b,!![]);}catch(_0x34d9bd){return BPromise['reject'](_0x34d9bd);}return _0x32d955[_0xb045('0x23')]();};}function saveUpdates(_0x3ae598,_0x514712){return function(_0x30cc92){if(_0x30cc92){return _0x30cc92[_0xb045('0x24')](_0x3ae598)['then'](function(_0x119c08){return _0x119c08;});}return null;};}function removeEntity(_0x2615d2,_0x9fb9a0){return function(_0x3a6b09){if(_0x3a6b09){return _0x3a6b09['destroy']()[_0xb045('0x25')](function(){var _0x53e398=_0x3a6b09[_0xb045('0x26')]({'plain':!![]});var _0x4adf43='Scheduler';return db[_0xb045('0x27')][_0xb045('0x28')]({'where':{'type':_0x4adf43,'resourceId':_0x53e398['id']}})[_0xb045('0x25')](function(){return _0x3a6b09;});})[_0xb045('0x25')](function(){_0x2615d2[_0xb045('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3da1,_0x56e4b6){return function(_0x4501c0){if(!_0x4501c0){_0x3c3da1[_0xb045('0x19')](0x194);}return _0x4501c0;};}function handleError(_0x1b711f,_0x1fdd94){_0x1fdd94=_0x1fdd94||0x1f4;return function(_0x296278){logger[_0xb045('0x29')](_0x296278['stack']);if(_0x296278[_0xb045('0x2a')]){delete _0x296278[_0xb045('0x2a')];}_0x1b711f[_0xb045('0x1a')](_0x1fdd94)[_0xb045('0x2b')](_0x296278);};}exports[_0xb045('0x2c')]=function(_0x253aad,_0x225ac4){var _0x323e49={},_0xfabd8b={},_0x301ebd={'count':0x0,'rows':[]};var _0x1fb7f1=_[_0xb045('0x2d')](db['Schedule'][_0xb045('0x2e')],function(_0x5095c4){return{'name':_0x5095c4[_0xb045('0x2f')],'type':_0x5095c4[_0xb045('0x30')][_0xb045('0x31')]};});_0xfabd8b[_0xb045('0x32')]=_[_0xb045('0x2d')](_0x1fb7f1,'name');_0xfabd8b[_0xb045('0x33')]=_[_0xb045('0x34')](_0x253aad[_0xb045('0x33')]);_0xfabd8b['filters']=_[_0xb045('0x35')](_0xfabd8b[_0xb045('0x32')],_0xfabd8b[_0xb045('0x33')]);_0x323e49[_0xb045('0x36')]=_[_0xb045('0x35')](_0xfabd8b[_0xb045('0x32')],qs['fields'](_0x253aad[_0xb045('0x33')][_0xb045('0x37')]));_0x323e49['attributes']=_0x323e49[_0xb045('0x36')]['length']?_0x323e49['attributes']:_0xfabd8b['model'];if(!_0x253aad[_0xb045('0x33')][_0xb045('0x38')](_0xb045('0x39'))){_0x323e49['limit']=qs[_0xb045('0x1c')](_0x253aad[_0xb045('0x33')]['limit']);_0x323e49[_0xb045('0x1e')]=qs['offset'](_0x253aad[_0xb045('0x33')][_0xb045('0x1e')]);}_0x323e49[_0xb045('0x3a')]=qs[_0xb045('0x3b')](_0x253aad[_0xb045('0x33')][_0xb045('0x3b')]);_0x323e49['where']=qs['filters'](_[_0xb045('0x3c')](_0x253aad[_0xb045('0x33')],_0xfabd8b[_0xb045('0x3d')]),_0x1fb7f1);if(_0x253aad['query'][_0xb045('0x3e')]){_0x323e49['where']=_[_0xb045('0x3f')](_0x323e49[_0xb045('0x40')],{'$or':_[_0xb045('0x2d')](_0x1fb7f1,function(_0x2ea78b){if(_0x2ea78b[_0xb045('0x30')]!==_0xb045('0x41')){var _0x414e70={};_0x414e70[_0x2ea78b[_0xb045('0x2a')]]={'$like':'%'+_0x253aad[_0xb045('0x33')]['filter']+'%'};return _0x414e70;}})});}_0x323e49=_[_0xb045('0x3f')]({},_0x323e49,_0x253aad[_0xb045('0x42')]);var _0x4d5c68={'where':_0x323e49['where']};return db[_0xb045('0x43')][_0xb045('0x1d')](_0x4d5c68)[_0xb045('0x25')](function(_0x3c5831){_0x301ebd[_0xb045('0x1d')]=_0x3c5831;if(_0x253aad['query'][_0xb045('0x44')]){_0x323e49[_0xb045('0x45')]=[{'all':!![]}];}return db['Schedule'][_0xb045('0x46')](_0x323e49);})[_0xb045('0x25')](function(_0x565993){_0x301ebd[_0xb045('0x47')]=_0x565993;return _0x301ebd;})[_0xb045('0x25')](respondWithFilteredResult(_0x225ac4,_0x323e49))[_0xb045('0x48')](handleError(_0x225ac4,null));};exports[_0xb045('0x49')]=function(_0x315824,_0x4a52f9){var _0x3bf1ac={'raw':![],'where':{'id':_0x315824[_0xb045('0x4a')]['id']}},_0x15034e={};_0x15034e['model']=_[_0xb045('0x34')](db['Schedule']['rawAttributes']);_0x15034e[_0xb045('0x33')]=_[_0xb045('0x34')](_0x315824[_0xb045('0x33')]);_0x15034e['filters']=_[_0xb045('0x35')](_0x15034e[_0xb045('0x32')],_0x15034e[_0xb045('0x33')]);_0x3bf1ac[_0xb045('0x36')]=_[_0xb045('0x35')](_0x15034e[_0xb045('0x32')],qs[_0xb045('0x37')](_0x315824[_0xb045('0x33')][_0xb045('0x37')]));_0x3bf1ac[_0xb045('0x36')]=_0x3bf1ac[_0xb045('0x36')][_0xb045('0x4b')]?_0x3bf1ac[_0xb045('0x36')]:_0x15034e[_0xb045('0x32')];if(_0x315824[_0xb045('0x33')][_0xb045('0x44')]){_0x3bf1ac[_0xb045('0x45')]=[{'all':!![]}];}_0x3bf1ac=_[_0xb045('0x3f')]({},_0x3bf1ac,_0x315824[_0xb045('0x42')]);return db[_0xb045('0x43')][_0xb045('0x4c')](_0x3bf1ac)[_0xb045('0x25')](handleEntityNotFound(_0x4a52f9,null))[_0xb045('0x25')](respondWithResult(_0x4a52f9,null))[_0xb045('0x48')](handleError(_0x4a52f9,null));};exports['create']=function(_0x568b46,_0x542bd9){return db[_0xb045('0x43')][_0xb045('0x4d')](_0x568b46[_0xb045('0x4e')],{})['then'](function(_0x5ac261){var _0x1492a6=_0x568b46['user'][_0xb045('0x26')]({'plain':!![]});if(!_0x1492a6)throw new Error(_0xb045('0x4f'));if(_0x1492a6['role']===_0xb045('0x50')){var _0x51d53e=_0x5ac261[_0xb045('0x26')]({'plain':!![]});var _0x14d464=_0xb045('0x51');return db[_0xb045('0x52')][_0xb045('0x4c')]({'where':{'name':_0x14d464,'userProfileId':_0x1492a6[_0xb045('0x53')]},'raw':!![]})[_0xb045('0x25')](function(_0x286f62){if(_0x286f62&&_0x286f62[_0xb045('0x54')]===0x0){return db['UserProfileResource'][_0xb045('0x4d')]({'name':_0x51d53e[_0xb045('0x2a')],'resourceId':_0x51d53e['id'],'type':_0x286f62[_0xb045('0x2a')],'sectionId':_0x286f62['id']},{})['then'](function(){return _0x5ac261;});}else{return _0x5ac261;}})[_0xb045('0x48')](function(_0x1a36b5){logger[_0xb045('0x29')](_0xb045('0x55'),_0x1a36b5);throw _0x1a36b5;});}return _0x5ac261;})[_0xb045('0x25')](respondWithResult(_0x542bd9,0xc9))[_0xb045('0x48')](handleError(_0x542bd9,null));};exports[_0xb045('0x24')]=function(_0x328e0f,_0x53f733){if(_0x328e0f['body']['id']){delete _0x328e0f[_0xb045('0x4e')]['id'];}return db['Schedule'][_0xb045('0x4c')]({'where':{'id':_0x328e0f[_0xb045('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53f733,null))['then'](saveUpdates(_0x328e0f[_0xb045('0x4e')],null))[_0xb045('0x25')](respondWithResult(_0x53f733,null))[_0xb045('0x48')](handleError(_0x53f733,null));};exports[_0xb045('0x28')]=function(_0x172da9,_0x1a791d){return db['Schedule'][_0xb045('0x4c')]({'where':{'id':_0x172da9[_0xb045('0x4a')]['id']}})[_0xb045('0x25')](handleEntityNotFound(_0x1a791d,null))[_0xb045('0x25')](removeEntity(_0x1a791d,null))[_0xb045('0x48')](handleError(_0x1a791d,null));};exports[_0xb045('0x56')]=function(_0x2481b7,_0x2626ce,_0x5d10f7){var _0xfc3d51=require(_0xb045('0x57'));return db[_0xb045('0x43')]['find']({'where':{'id':_0x2481b7['params']['id']},'raw':!![]})[_0xb045('0x25')](handleEntityNotFound(_0x2626ce,null))[_0xb045('0x25')](function(){_0xfc3d51['run'](_0x2481b7[_0xb045('0x4a')]['id']);})[_0xb045('0x25')](respondWithStatusCode(_0x2626ce,null))['catch'](handleError(_0x2626ce,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 636bec4..d0d8bfc 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 _0x72c9=['path','./schedule.attributes','exports','define','Schedule','lodash','util','request-promise'];(function(_0x43b849,_0x1fccf4){var _0x5e4d44=function(_0x2f3c76){while(--_0x2f3c76){_0x43b849['push'](_0x43b849['shift']());}};_0x5e4d44(++_0x1fccf4);}(_0x72c9,0x6d));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x972c('0x0'));var util=require(_0x972c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x972c('0x2'));var fs=require('fs');var path=require(_0x972c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x972c('0x4'));module[_0x972c('0x5')]=function(_0xa1b6cc,_0x56abc2){return _0xa1b6cc[_0x972c('0x6')](_0x972c('0x7'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0c2=['../../config/environment','exports','Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xc0c2,0x9e));var _0x2c0c=function(_0x1d0d23,_0x43e210){_0x1d0d23=_0x1d0d23-0x0;var _0x2d295b=_0xc0c2[_0x1d0d23];return _0x2d295b;};'use strict';var _=require(_0x2c0c('0x0'));var util=require('util');var logger=require(_0x2c0c('0x1'))(_0x2c0c('0x2'));var moment=require(_0x2c0c('0x3'));var BPromise=require(_0x2c0c('0x4'));var rp=require(_0x2c0c('0x5'));var fs=require('fs');var path=require(_0x2c0c('0x6'));var rimraf=require('rimraf');var config=require(_0x2c0c('0x7'));var attributes=require('./schedule.attributes');module[_0x2c0c('0x8')]=function(_0x34539b,_0x30fc2){return _0x34539b['define'](_0x2c0c('0x9'),attributes,{'tableName':_0x2c0c('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 91b4cae..92b4f72 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 _0x121b=['../../config/logger','rpc','jayson/promise','http','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0x121b,0x8d));var _0xb121=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x121b[_0x30a31e];return _0x170879;};'use strict';var _=require(_0xb121('0x0'));var util=require(_0xb121('0x1'));var moment=require('moment');var BPromise=require(_0xb121('0x2'));var rs=require(_0xb121('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb121('0x4'))['db'];var utils=require(_0xb121('0x5'));var logger=require(_0xb121('0x6'))(_0xb121('0x7'));var config=require('../../config/environment');var jayson=require(_0xb121('0x8'));var client=jayson['client'][_0xb121('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf842,_0x1d6427,_0x4316b3){return new BPromise(function(_0xff7e63,_0x5e76ed){return client['request'](_0x3bf842,_0x4316b3)['then'](function(_0x54315b){logger['info']('Schedule,\x20%s,\x20%s',_0x1d6427,_0xb121('0xa'));logger[_0xb121('0xb')](_0xb121('0xc'),_0x1d6427,'request\x20sent',JSON[_0xb121('0xd')](_0x54315b));if(_0x54315b[_0xb121('0xe')]){if(_0x54315b[_0xb121('0xe')][_0xb121('0xf')]===0x1f4){logger[_0xb121('0xe')](_0xb121('0x10'),_0x1d6427,_0x54315b['error'][_0xb121('0x11')]);return _0x5e76ed(_0x54315b['error'][_0xb121('0x11')]);}logger[_0xb121('0xe')](_0xb121('0x10'),_0x1d6427,_0x54315b['error'][_0xb121('0x11')]);return _0xff7e63(_0x54315b[_0xb121('0xe')][_0xb121('0x11')]);}else{logger[_0xb121('0x12')](_0xb121('0x10'),_0x1d6427,'request\x20sent');_0xff7e63(_0x54315b[_0xb121('0x13')]['message']);}})[_0xb121('0x14')](function(_0x243c3f){logger[_0xb121('0xe')](_0xb121('0x10'),_0x1d6427,_0x243c3f);_0x5e76ed(_0x243c3f);});});} \ No newline at end of file +var _0x4dca=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x4dca,0x1ef));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4dc('0x0'));var BPromise=require(_0xa4dc('0x1'));var rs=require(_0xa4dc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4dc('0x3'))['db'];var utils=require(_0xa4dc('0x4'));var logger=require('../../config/logger')(_0xa4dc('0x5'));var config=require(_0xa4dc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa4dc('0x7')][_0xa4dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1ddb,_0x384b3e,_0x599318){return new BPromise(function(_0x114711,_0x1d8c05){return client['request'](_0x5d1ddb,_0x599318)[_0xa4dc('0x9')](function(_0xa84ea7){logger[_0xa4dc('0xa')](_0xa4dc('0xb'),_0x384b3e,_0xa4dc('0xc'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x384b3e,_0xa4dc('0xc'),JSON[_0xa4dc('0xd')](_0xa84ea7));if(_0xa84ea7[_0xa4dc('0xe')]){if(_0xa84ea7[_0xa4dc('0xe')][_0xa4dc('0xf')]===0x1f4){logger[_0xa4dc('0xe')](_0xa4dc('0xb'),_0x384b3e,_0xa84ea7[_0xa4dc('0xe')][_0xa4dc('0x10')]);return _0x1d8c05(_0xa84ea7[_0xa4dc('0xe')][_0xa4dc('0x10')]);}logger[_0xa4dc('0xe')](_0xa4dc('0xb'),_0x384b3e,_0xa84ea7['error'][_0xa4dc('0x10')]);return _0x114711(_0xa84ea7[_0xa4dc('0xe')][_0xa4dc('0x10')]);}else{logger['info'](_0xa4dc('0xb'),_0x384b3e,_0xa4dc('0xc'));_0x114711(_0xa84ea7[_0xa4dc('0x11')][_0xa4dc('0x10')]);}})[_0xa4dc('0x12')](function(_0x2d83c7){logger[_0xa4dc('0xe')](_0xa4dc('0xb'),_0x384b3e,_0x2d83c7);_0x1d8c05(_0x2d83c7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0168b81..08ad4fd 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 _0x072e=['show','/:id/download','download','post','create','put','update','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','index','get','describe','isAuthenticated'];(function(_0x4a5642,_0x18c3f9){var _0x4ecc72=function(_0x589939){while(--_0x589939){_0x4a5642['push'](_0x4a5642['shift']());}};_0x4ecc72(++_0x18c3f9);}(_0x072e,0x1c4));var _0xe072=function(_0x4a3dfd,_0x503f71){_0x4a3dfd=_0x4a3dfd-0x0;var _0xe85690=_0x072e[_0x4a3dfd];return _0xe85690;};'use strict';var multer=require(_0xe072('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe072('0x1'));var express=require(_0xe072('0x2'));var router=express[_0xe072('0x3')]();var fs_extra=require(_0xe072('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe072('0x5'));var controller=require('./screenRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe072('0x6')]);router[_0xe072('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xe072('0x8')]);router[_0xe072('0x7')]('/:id',auth[_0xe072('0x9')](),controller[_0xe072('0xa')]);router[_0xe072('0x7')](_0xe072('0xb'),auth[_0xe072('0x9')](),controller[_0xe072('0xc')]);router[_0xe072('0xd')]('/',auth[_0xe072('0x9')](),controller[_0xe072('0xe')]);router[_0xe072('0xf')]('/:id',auth[_0xe072('0x9')](),controller[_0xe072('0x10')]);router[_0xe072('0x11')](_0xe072('0x12'),auth[_0xe072('0x9')](),controller[_0xe072('0x13')]);module[_0xe072('0x14')]=router; \ No newline at end of file +var _0x87dc=['put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','describe','get','/:id','/:id/download','download','post','create'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x87dc,0xc2));var _0xc87d=function(_0x386492,_0x2d3405){_0x386492=_0x386492-0x0;var _0x1d4f58=_0x87dc[_0x386492];return _0x1d4f58;};'use strict';var multer=require('multer');var util=require(_0xc87d('0x0'));var path=require(_0xc87d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc87d('0x2'));var router=express[_0xc87d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc87d('0x4'));var interaction=require(_0xc87d('0x5'));var config=require('../../config/environment');var controller=require(_0xc87d('0x6'));router['get']('/',auth[_0xc87d('0x7')](),controller['index']);router['get']('/describe',auth[_0xc87d('0x7')](),controller[_0xc87d('0x8')]);router[_0xc87d('0x9')](_0xc87d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc87d('0x9')](_0xc87d('0xb'),auth[_0xc87d('0x7')](),controller[_0xc87d('0xc')]);router[_0xc87d('0xd')]('/',auth[_0xc87d('0x7')](),controller[_0xc87d('0xe')]);router[_0xc87d('0xf')](_0xc87d('0xa'),auth[_0xc87d('0x7')](),controller['update']);router[_0xc87d('0x10')](_0xc87d('0xa'),auth[_0xc87d('0x7')](),controller[_0xc87d('0x11')]);module[_0xc87d('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5548951..135357c 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 _0xd232=['setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','STRING','replace','value','INTEGER'];(function(_0x5edce3,_0x58b01b){var _0x255295=function(_0x5c3ad8){while(--_0x5c3ad8){_0x5edce3['push'](_0x5edce3['shift']());}};_0x255295(++_0x58b01b);}(_0xd232,0x74));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2d23('0x0'));var moment=require('moment');var path=require(_0x2d23('0x1'));var config=require(_0x2d23('0x2'));module[_0x2d23('0x3')]={'format':{'type':Sequelize[_0x2d23('0x4')],'get':function(){return this[_0x2d23('0x5')]('value')?path['extname'](this[_0x2d23('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2d23('0x6')]},'value':{'type':Sequelize[_0x2d23('0x6')],'set':function(_0x15c735){var _0x53ac18=_0x15c735[_0x2d23('0x7')](/\\/g,'/');this['setDataValue'](_0x2d23('0x8'),_0x53ac18);}},'rating':{'type':Sequelize[_0x2d23('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2d23('0x9')],'set':function(_0x7847cb){this[_0x2d23('0xa')](_0x2d23('0xb'),moment()[_0x2d23('0xc')](_0x7847cb,'ms'));this['setDataValue'](_0x2d23('0xd'),moment());this[_0x2d23('0xa')](_0x2d23('0xe'),_0x7847cb);}},'startedAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this[_0x2d23('0x5')](_0x2d23('0xb')))[_0x2d23('0x10')](_0x2d23('0x11'))[_0x2d23('0x12')]();}},'closedAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this[_0x2d23('0x5')](_0x2d23('0xd')))['format'](_0x2d23('0x11'))[_0x2d23('0x12')]();}},'createdAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this[_0x2d23('0x5')](_0x2d23('0x13')))['format'](_0x2d23('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this['getDataValue'](_0x2d23('0x14')))[_0x2d23('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xafcd=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','toString','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value'];(function(_0x1ea300,_0x128218){var _0x894b27=function(_0x184afb){while(--_0x184afb){_0x1ea300['push'](_0x1ea300['shift']());}};_0x894b27(++_0x128218);}(_0xafcd,0x157));var _0xdafc=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0xafcd[_0x28fbbf];return _0x543af6;};'use strict';var Sequelize=require(_0xdafc('0x0'));var moment=require(_0xdafc('0x1'));var path=require(_0xdafc('0x2'));var config=require(_0xdafc('0x3'));module[_0xdafc('0x4')]={'format':{'type':Sequelize[_0xdafc('0x5')],'get':function(){return this[_0xdafc('0x6')]('value')?path[_0xdafc('0x7')](this[_0xdafc('0x6')](_0xdafc('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdafc('0x9')]},'value':{'type':Sequelize[_0xdafc('0x9')],'set':function(_0x33adc9){var _0x52872c=_0x33adc9[_0xdafc('0xa')](/\\/g,'/');this[_0xdafc('0xb')](_0xdafc('0x8'),_0x52872c);}},'rating':{'type':Sequelize[_0xdafc('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdafc('0xc')],'set':function(_0x241787){this[_0xdafc('0xb')](_0xdafc('0xd'),moment()[_0xdafc('0xe')](_0x241787,'ms'));this[_0xdafc('0xb')](_0xdafc('0xf'),moment());this['setDataValue']('duration',_0x241787);}},'startedAt':{'type':Sequelize[_0xdafc('0x10')],'get':function(){return moment(this[_0xdafc('0x6')](_0xdafc('0xd')))[_0xdafc('0x11')](_0xdafc('0x12'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xdafc('0xf')))['format'](_0xdafc('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0xdafc('0x10')],'get':function(){return moment(this[_0xdafc('0x6')](_0xdafc('0x13')))[_0xdafc('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xdafc('0x10')],'get':function(){return moment(this[_0xdafc('0x6')](_0xdafc('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0xdafc('0x15')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 542fca1..dd312f0 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 _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x340fb2,_0x528c2f){var _0x4624e2=function(_0x2a9fd6){while(--_0x2a9fd6){_0x340fb2['push'](_0x340fb2['shift']());}};_0x4624e2(++_0x528c2f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1d88db,_0x26213f){_0x1d88db=_0x1d88db-0x0;var _0x1df256=_0xe5b3[_0x1d88db];return _0x1df256;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file +var _0x032e=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','model','differenceBy','map','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ScreenRecording','rows','catch','show','find','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x1590fe,_0x3341b8){var _0x624709=function(_0x449134){while(--_0x449134){_0x1590fe['push'](_0x1590fe['shift']());}};_0x624709(++_0x3341b8);}(_0x032e,0x124));var _0xe032=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x032e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['index']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={},_0x469290={},_0xae116e={'count':0x0,'rows':[]};var _0x4e8b72=_['map'](db['ScreenRecording'][_0xe032('0x2b')],function(_0x1dd34f){return{'name':_0x1dd34f[_0xe032('0x2c')],'type':_0x1dd34f[_0xe032('0x2d')]['key']};});_0x469290[_0xe032('0x2e')]=_[_0xe032('0x2f')](_[_0xe032('0x30')](_0x4e8b72,_0xe032('0x29')),[_0xe032('0x31')]);_0x469290['query']=_[_0xe032('0x32')](_0x5573e4[_0xe032('0x33')]);_0x469290[_0xe032('0x34')]=_[_0xe032('0x35')](_0x469290['model'],_0x469290[_0xe032('0x33')]);_0x38e7ea['attributes']=_[_0xe032('0x35')](_0x469290['model'],qs[_0xe032('0x36')](_0x5573e4['query'][_0xe032('0x36')]));_0x38e7ea['attributes']=_0x38e7ea[_0xe032('0x37')][_0xe032('0x38')]?_0x38e7ea['attributes']:_0x469290[_0xe032('0x2e')];if(!_0x5573e4[_0xe032('0x33')][_0xe032('0x39')](_0xe032('0x3a'))){_0x38e7ea['limit']=qs[_0xe032('0x21')](_0x5573e4['query'][_0xe032('0x21')]);_0x38e7ea[_0xe032('0x1f')]=qs['offset'](_0x5573e4[_0xe032('0x33')][_0xe032('0x1f')]);}_0x38e7ea['order']=qs[_0xe032('0x3b')](_0x5573e4[_0xe032('0x33')][_0xe032('0x3b')]);_0x38e7ea[_0xe032('0x3c')]=qs[_0xe032('0x34')](_[_0xe032('0x3d')](_0x5573e4[_0xe032('0x33')],_0x469290[_0xe032('0x34')]),_0x4e8b72);if(_0x5573e4[_0xe032('0x33')][_0xe032('0x3e')]){_0x38e7ea[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x38e7ea[_0xe032('0x3c')],{'$or':_[_0xe032('0x30')](_0x4e8b72,function(_0x39af44){if(_0x39af44[_0xe032('0x2d')]!==_0xe032('0x40')){var _0x555914={};_0x555914[_0x39af44[_0xe032('0x29')]]={'$like':'%'+_0x5573e4['query'][_0xe032('0x3e')]+'%'};return _0x555914;}})});}_0x38e7ea=_[_0xe032('0x3f')]({},_0x38e7ea,_0x5573e4[_0xe032('0x41')]);var _0x119790={'where':_0x38e7ea[_0xe032('0x3c')]};return db['ScreenRecording'][_0xe032('0x22')](_0x119790)['then'](function(_0x46ea84){_0xae116e['count']=_0x46ea84;if(_0x5573e4[_0xe032('0x33')][_0xe032('0x42')]){_0x38e7ea[_0xe032('0x43')]=[{'all':!![]}];}return db[_0xe032('0x44')]['findAll'](_0x38e7ea);})[_0xe032('0x27')](function(_0x5a6450){_0xae116e[_0xe032('0x45')]=_0x5a6450;return _0xae116e;})[_0xe032('0x27')](respondWithFilteredResult(_0x3e2575,_0x38e7ea))[_0xe032('0x46')](handleError(_0x3e2575,null));};exports[_0xe032('0x47')]=function(_0x4b58eb,_0x513b0c){var _0x45345d={'raw':![],'where':{'id':_0x4b58eb['params']['id']}},_0x203021={};_0x203021[_0xe032('0x2e')]=_[_0xe032('0x32')](db[_0xe032('0x44')][_0xe032('0x2b')]);_0x203021[_0xe032('0x33')]=_['keys'](_0x4b58eb[_0xe032('0x33')]);_0x203021[_0xe032('0x34')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],_0x203021[_0xe032('0x33')]);_0x45345d[_0xe032('0x37')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],qs['fields'](_0x4b58eb['query'][_0xe032('0x36')]));_0x45345d['attributes']=_0x45345d[_0xe032('0x37')][_0xe032('0x38')]?_0x45345d[_0xe032('0x37')]:_0x203021[_0xe032('0x2e')];if(_0x4b58eb[_0xe032('0x33')][_0xe032('0x42')]){_0x45345d[_0xe032('0x43')]=[{'all':!![]}];}_0x45345d=_[_0xe032('0x3f')]({},_0x45345d,_0x4b58eb[_0xe032('0x41')]);return db['ScreenRecording'][_0xe032('0x48')](_0x45345d)['then'](handleEntityNotFound(_0x513b0c,null))['then'](respondWithResult(_0x513b0c,null))[_0xe032('0x46')](handleError(_0x513b0c,null));};exports[_0xe032('0x49')]=function(_0x62bfc8,_0x1e54d3){return db['ScreenRecording'][_0xe032('0x49')](_0x62bfc8[_0xe032('0x4a')],{})[_0xe032('0x27')](respondWithResult(_0x1e54d3,0xc9))[_0xe032('0x46')](handleError(_0x1e54d3,null));};exports[_0xe032('0x26')]=function(_0x233d9e,_0x3774bc){if(_0x233d9e['body']['id']){delete _0x233d9e[_0xe032('0x4a')]['id'];}delete _0x233d9e[_0xe032('0x4a')]['duration'];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4b')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4c')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4d')];return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x233d9e[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x3774bc,null))[_0xe032('0x27')](saveUpdates(_0x233d9e[_0xe032('0x4a')],null))[_0xe032('0x27')](respondWithResult(_0x3774bc,null))[_0xe032('0x46')](handleError(_0x3774bc,null));};exports['describe']=function(_0x1c8b32,_0x53c8b2){return db[_0xe032('0x44')][_0xe032('0x4f')]()[_0xe032('0x27')](respondWithResult(_0x53c8b2,null))[_0xe032('0x46')](handleError(_0x53c8b2,null));};exports[_0xe032('0x50')]=function(_0x1b7a91,_0x2e29d3,_0xa98ee6){var _0x16c91e=require(_0xe032('0x51'));var _0x1b9012=![];var _0x564fe0={};if(_0x1b7a91[_0xe032('0x33')][_0xe032('0x2d')]&&_0x1b7a91['query'][_0xe032('0x2d')]==='uniqueid'){_0x564fe0[_0xe032('0x52')]=_0x1b7a91[_0xe032('0x4e')]['id'];}else{_0x564fe0['id']=_0x1b7a91[_0xe032('0x4e')]['id'];}return db[_0xe032('0x44')][_0xe032('0x48')]({'where':_0x564fe0,'attributes':['id','value'],'raw':!![]})[_0xe032('0x27')](handleEntityNotFound(_0x2e29d3,null))[_0xe032('0x27')](function(_0x1e1277){if(_0x1e1277){var _0x21a32f=path[_0xe032('0x53')](config[_0xe032('0x54')],_0xe032('0x55'),_0x1e1277['value']);var _0x3f46c0=util[_0xe032('0x31')](_0xe032('0x56'),_0x21a32f);if(fs[_0xe032('0x57')](_0x3f46c0)){_0x1b9012=!![];return _0x16c91e[_0xe032('0x58')](_0x3f46c0,_0x21a32f,config[_0xe032('0x59')][_0xe032('0x5a')])[_0xe032('0x27')](function(){return _0x1e1277;});}return _0x1e1277;}})[_0xe032('0x27')](function(_0x54c0b0){if(_0x54c0b0){var _0x795a58=path[_0xe032('0x53')](config[_0xe032('0x54')],'server/files/screen_recordings',_0x54c0b0[_0xe032('0x4d')]);if(!fs[_0xe032('0x57')](_0x795a58)){throw new db['Sequelize'][(_0xe032('0x5b'))](_0xe032('0x5c'));}if(_0x54c0b0[_0xe032('0x5d')]){return _0x2e29d3[_0xe032('0x50')](_0x795a58,_0x54c0b0[_0xe032('0x5d')]+path[_0xe032('0x5e')](_0x795a58),function(){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}else{return _0x2e29d3[_0xe032('0x50')](_0x795a58,function(_0x1aa18e){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}}})[_0xe032('0x46')](function(_0x505986){if(_0x505986[_0xe032('0x60')]===_0xe032('0x5c')){_0x2e29d3[_0xe032('0x1d')](0x194)[_0xe032('0x2a')](_0xe032('0x61'));}else{return handleError(_0x2e29d3,null);}});};exports['destroy']=function(_0x2b6ef8,_0x55e6b0){return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x2b6ef8[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](function(_0x3c5eb8){if(_[_0xe032('0x62')](_0x3c5eb8)){throw new ReferenceError(_0xe032('0x63'));}return _0x3c5eb8;})[_0xe032('0x27')](function(_0x22fd01){var _0x536510=path['join'](config['root'],_0xe032('0x55'),_0x22fd01[_0xe032('0x4d')]);logger[_0xe032('0x64')](_0xe032('0x65'),_0x536510);if(!_[_0xe032('0x62')](_0x22fd01[_0xe032('0x4d')])&&fs['existsSync'](_0x536510)){logger[_0xe032('0x64')](_0xe032('0x66')+_0x536510+_0xe032('0x67'));fs['unlinkSync'](_0x536510);}_0x536510=_0x536510+_0xe032('0x68');if(!_['isNil'](_0x22fd01[_0xe032('0x4d')])&&fs[_0xe032('0x57')](_0x536510)){logger['info']('File:\x20\x22'+_0x536510+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe032('0x69')](_0x536510);}return _0x22fd01;})['then'](function(_0x5157f7){if(!_0x5157f7)throw new InternalError();return _0x5157f7[_0xe032('0x6a')]();})[_0xe032('0x27')](function(){_0x55e6b0[_0xe032('0x1d')](0xcc)['end']();})[_0xe032('0x46')](handleError(_0x55e6b0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 127a36d..6ac97cd 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 _0x0954=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x45346a,_0x3cb093){var _0x3536bb=function(_0x31c9ef){while(--_0x31c9ef){_0x45346a['push'](_0x45346a['shift']());}};_0x3536bb(++_0x3cb093);}(_0x0954,0xdd));var _0x4095=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x0954[_0x1a72b8];return _0x39f72d;};'use strict';var _=require(_0x4095('0x0'));var util=require(_0x4095('0x1'));var logger=require(_0x4095('0x2'))(_0x4095('0x3'));var moment=require(_0x4095('0x4'));var BPromise=require(_0x4095('0x5'));var rp=require(_0x4095('0x6'));var fs=require('fs');var path=require(_0x4095('0x7'));var rimraf=require(_0x4095('0x8'));var config=require(_0x4095('0x9'));var attributes=require('./screenRecording.attributes');module[_0x4095('0xa')]=function(_0x523284,_0x90228f){return _0x523284[_0x4095('0xb')](_0x4095('0xc'),attributes,{'tableName':_0x4095('0xd'),'paranoid':![],'indexes':[{'name':_0x4095('0xe'),'fields':[_0x4095('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce44=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x3cafef,_0x54f23b){var _0x250f55=function(_0x30490f){while(--_0x30490f){_0x3cafef['push'](_0x3cafef['shift']());}};_0x250f55(++_0x54f23b);}(_0xce44,0x1b6));var _0x4ce4=function(_0x2bf848,_0x1425af){_0x2bf848=_0x2bf848-0x0;var _0x28d43e=_0xce44[_0x2bf848];return _0x28d43e;};'use strict';var _=require(_0x4ce4('0x0'));var util=require(_0x4ce4('0x1'));var logger=require(_0x4ce4('0x2'))(_0x4ce4('0x3'));var moment=require(_0x4ce4('0x4'));var BPromise=require(_0x4ce4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ce4('0x6'));var rimraf=require(_0x4ce4('0x7'));var config=require(_0x4ce4('0x8'));var attributes=require(_0x4ce4('0x9'));module[_0x4ce4('0xa')]=function(_0x1c637d,_0x5ea654){return _0x1c637d[_0x4ce4('0xb')](_0x4ce4('0xc'),attributes,{'tableName':_0x4ce4('0xd'),'paranoid':![],'indexes':[{'name':_0x4ce4('0xe'),'fields':[_0x4ce4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7f690f6..0d856ee 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 _0x803e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4fbaf9,_0x3b8190){var _0x1d89a0=function(_0x3b650b){while(--_0x3b650b){_0x4fbaf9['push'](_0x4fbaf9['shift']());}};_0x1d89a0(++_0x3b8190);}(_0x803e,0x17d));var _0xe803=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x803e[_0x4147ff];return _0x1e71e6;};'use strict';var _=require(_0xe803('0x0'));var util=require(_0xe803('0x1'));var moment=require(_0xe803('0x2'));var BPromise=require(_0xe803('0x3'));var rs=require(_0xe803('0x4'));var fs=require('fs');var Redis=require(_0xe803('0x5'));var db=require(_0xe803('0x6'))['db'];var utils=require(_0xe803('0x7'));var logger=require('../../config/logger')(_0xe803('0x8'));var config=require(_0xe803('0x9'));var jayson=require(_0xe803('0xa'));var client=jayson[_0xe803('0xb')][_0xe803('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e8f2d,_0x1db591,_0x4420a1){return new BPromise(function(_0x3761e6,_0x2454c3){return client['request'](_0x2e8f2d,_0x4420a1)['then'](function(_0x5c9e17){logger[_0xe803('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x1db591,_0xe803('0xe'));logger[_0xe803('0xf')](_0xe803('0x10'),_0x1db591,_0xe803('0xe'),JSON[_0xe803('0x11')](_0x5c9e17));if(_0x5c9e17[_0xe803('0x12')]){if(_0x5c9e17[_0xe803('0x12')][_0xe803('0x13')]===0x1f4){logger['error'](_0xe803('0x14'),_0x1db591,_0x5c9e17[_0xe803('0x12')][_0xe803('0x15')]);return _0x2454c3(_0x5c9e17[_0xe803('0x12')][_0xe803('0x15')]);}logger[_0xe803('0x12')](_0xe803('0x14'),_0x1db591,_0x5c9e17[_0xe803('0x12')]['message']);return _0x3761e6(_0x5c9e17[_0xe803('0x12')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1db591,_0xe803('0xe'));_0x3761e6(_0x5c9e17[_0xe803('0x16')]['message']);}})[_0xe803('0x17')](function(_0x5e3c93){logger['error'](_0xe803('0x14'),_0x1db591,_0x5e3c93);_0x2454c3(_0x5e3c93);});});} \ No newline at end of file +var _0xffa0=['message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ad55e,_0x1c9b31){var _0x815e9a=function(_0x304a88){while(--_0x304a88){_0x5ad55e['push'](_0x5ad55e['shift']());}};_0x815e9a(++_0x1c9b31);}(_0xffa0,0x74));var _0x0ffa=function(_0x502038,_0x79292){_0x502038=_0x502038-0x0;var _0x2c71a9=_0xffa0[_0x502038];return _0x2c71a9;};'use strict';var _=require('lodash');var util=require(_0x0ffa('0x0'));var moment=require(_0x0ffa('0x1'));var BPromise=require('bluebird');var rs=require(_0x0ffa('0x2'));var fs=require('fs');var Redis=require(_0x0ffa('0x3'));var db=require(_0x0ffa('0x4'))['db'];var utils=require(_0x0ffa('0x5'));var logger=require(_0x0ffa('0x6'))(_0x0ffa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ffa('0x8')][_0x0ffa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41527b,_0xd62165,_0x50ab6c){return new BPromise(function(_0x104734,_0xce2c6f){return client[_0x0ffa('0xa')](_0x41527b,_0x50ab6c)[_0x0ffa('0xb')](function(_0x2251d1){logger[_0x0ffa('0xc')](_0x0ffa('0xd'),_0xd62165,_0x0ffa('0xe'));logger['debug'](_0x0ffa('0xf'),_0xd62165,_0x0ffa('0xe'),JSON['stringify'](_0x2251d1));if(_0x2251d1[_0x0ffa('0x10')]){if(_0x2251d1[_0x0ffa('0x10')]['code']===0x1f4){logger[_0x0ffa('0x10')](_0x0ffa('0xd'),_0xd62165,_0x2251d1[_0x0ffa('0x10')][_0x0ffa('0x11')]);return _0xce2c6f(_0x2251d1['error'][_0x0ffa('0x11')]);}logger['error'](_0x0ffa('0xd'),_0xd62165,_0x2251d1['error'][_0x0ffa('0x11')]);return _0x104734(_0x2251d1[_0x0ffa('0x10')][_0x0ffa('0x11')]);}else{logger[_0x0ffa('0xc')](_0x0ffa('0xd'),_0xd62165,_0x0ffa('0xe'));_0x104734(_0x2251d1[_0x0ffa('0x12')][_0x0ffa('0x11')]);}})['catch'](function(_0x1e9e3d){logger[_0x0ffa('0x10')](_0x0ffa('0xd'),_0xd62165,_0x1e9e3d);_0xce2c6f(_0x1e9e3d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8b1f9e5..5a63901 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 _0x6d16=['addLogo','diskStorage','%s%s','logologin','post','addLogoLogin','root','preferred','/:id/preferred','addPreferred','favicon','extname','addFavicon','put','isAuthenticated','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','join','server/files/images/logos/','format','logo','originalname','single','file'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d16,0x1a5));var _0x66d1=function(_0x26c178,_0x2dd96e){_0x26c178=_0x26c178-0x0;var _0x35a015=_0x6d16[_0x26c178];return _0x35a015;};'use strict';var multer=require(_0x66d1('0x0'));var util=require(_0x66d1('0x1'));var path=require(_0x66d1('0x2'));var timeout=require(_0x66d1('0x3'));var express=require(_0x66d1('0x4'));var router=express['Router']();var fs_extra=require(_0x66d1('0x5'));var auth=require(_0x66d1('0x6'));var interaction=require(_0x66d1('0x7'));var config=require(_0x66d1('0x8'));var controller=require(_0x66d1('0x9'));router[_0x66d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x66d1('0xb')]);router[_0x66d1('0xa')](_0x66d1('0xc'),controller[_0x66d1('0xd')]);router[_0x66d1('0xa')](_0x66d1('0xe'),controller[_0x66d1('0xf')]);router['get'](_0x66d1('0x10'),controller[_0x66d1('0x11')]);router['get'](_0x66d1('0x12'),controller['getLogoLogin']);router[_0x66d1('0xa')](_0x66d1('0x13'),controller[_0x66d1('0x14')]);router[_0x66d1('0xa')]('/:id/preferred',controller[_0x66d1('0x15')]);router[_0x66d1('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37630c,_0xb05036,_0x364980){_0x364980(null,path[_0x66d1('0x16')](config['root'],_0x66d1('0x17')));},'filename':function(_0x181054,_0x3dda10,_0x20026e){_0x20026e(null,util[_0x66d1('0x18')]('%s%s',_0x66d1('0x19'),path['extname'](_0x3dda10[_0x66d1('0x1a')])));}})});router['post'](_0x66d1('0x10'),upload[_0x66d1('0x1b')](_0x66d1('0x1c')),controller[_0x66d1('0x1d')]);var upload=multer({'storage':multer[_0x66d1('0x1e')]({'destination':function(_0x3bbc12,_0x4f8396,_0x50bf22){_0x50bf22(null,path[_0x66d1('0x16')](config['root'],_0x66d1('0x17')));},'filename':function(_0x28c911,_0x37cf6f,_0x3ec117){_0x3ec117(null,util[_0x66d1('0x18')](_0x66d1('0x1f'),_0x66d1('0x20'),path['extname'](_0x37cf6f[_0x66d1('0x1a')])));}})});router[_0x66d1('0x21')](_0x66d1('0x12'),upload[_0x66d1('0x1b')](_0x66d1('0x1c')),controller[_0x66d1('0x22')]);var upload=multer({'storage':multer[_0x66d1('0x1e')]({'destination':function(_0x431180,_0x39fd61,_0x4ea91e){_0x4ea91e(null,path[_0x66d1('0x16')](config[_0x66d1('0x23')],'server/files/images/logos/'));},'filename':function(_0x2a2013,_0x5ac3ae,_0x324c81){_0x324c81(null,util[_0x66d1('0x18')](_0x66d1('0x1f'),_0x66d1('0x24'),path['extname'](_0x5ac3ae[_0x66d1('0x1a')])));}})});router[_0x66d1('0x21')](_0x66d1('0x25'),upload[_0x66d1('0x1b')](_0x66d1('0x1c')),controller[_0x66d1('0x26')]);var upload=multer({'storage':multer[_0x66d1('0x1e')]({'destination':function(_0x665ad1,_0x2b3526,_0x1ee10d){_0x1ee10d(null,path[_0x66d1('0x16')](config[_0x66d1('0x23')],'server/files/images/logos/'));},'filename':function(_0x38a43a,_0x12ec1b,_0x715599){_0x715599(null,util[_0x66d1('0x18')]('%s%s',_0x66d1('0x27'),path[_0x66d1('0x28')](_0x12ec1b[_0x66d1('0x1a')])));}})});router['post']('/:id/favicon',upload[_0x66d1('0x1b')]('file'),controller[_0x66d1('0x29')]);router[_0x66d1('0x2a')](_0x66d1('0xe'),auth[_0x66d1('0x2b')](),controller[_0x66d1('0x2c')]);module['exports']=router; \ No newline at end of file +var _0xb5ac=['getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','post','/:id/logo','file','addLogo','join','logologin','addLogoLogin','preferred','single','addPreferred','favicon','originalname','addFavicon','put','update','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','getDate','/:id','show','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb5ac,0x189));var _0xcb5a=function(_0x374d35,_0x1ea694){_0x374d35=_0x374d35-0x0;var _0x102652=_0xb5ac[_0x374d35];return _0x102652;};'use strict';var multer=require(_0xcb5a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb5a('0x1'));var express=require('express');var router=express[_0xcb5a('0x2')]();var fs_extra=require(_0xcb5a('0x3'));var auth=require(_0xcb5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcb5a('0x5'));var controller=require('./setting.controller');router[_0xcb5a('0x6')]('/',auth[_0xcb5a('0x7')](),controller[_0xcb5a('0x8')]);router[_0xcb5a('0x6')]('/now',controller[_0xcb5a('0x9')]);router['get'](_0xcb5a('0xa'),controller[_0xcb5a('0xb')]);router[_0xcb5a('0x6')]('/:id/logo',controller['getLogo']);router['get'](_0xcb5a('0xc'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller[_0xcb5a('0xd')]);router[_0xcb5a('0x6')](_0xcb5a('0xe'),controller[_0xcb5a('0xf')]);router['get'](_0xcb5a('0x10'),controller[_0xcb5a('0x11')]);var upload=multer({'storage':multer[_0xcb5a('0x12')]({'destination':function(_0x5e8d,_0x2cc987,_0x3acd0e){_0x3acd0e(null,path['join'](config[_0xcb5a('0x13')],_0xcb5a('0x14')));},'filename':function(_0x4d7c05,_0x4eb1ce,_0x1049fa){_0x1049fa(null,util[_0xcb5a('0x15')](_0xcb5a('0x16'),_0xcb5a('0x17'),path[_0xcb5a('0x18')](_0x4eb1ce['originalname'])));}})});router[_0xcb5a('0x19')](_0xcb5a('0x1a'),upload['single'](_0xcb5a('0x1b')),controller[_0xcb5a('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x383fea,_0x523521,_0x1d5a7c){_0x1d5a7c(null,path[_0xcb5a('0x1d')](config['root'],_0xcb5a('0x14')));},'filename':function(_0x3e36b4,_0x45f112,_0x1c85be){_0x1c85be(null,util[_0xcb5a('0x15')]('%s%s',_0xcb5a('0x1e'),path[_0xcb5a('0x18')](_0x45f112['originalname'])));}})});router['post'](_0xcb5a('0xc'),upload['single'](_0xcb5a('0x1b')),controller[_0xcb5a('0x1f')]);var upload=multer({'storage':multer[_0xcb5a('0x12')]({'destination':function(_0x15fec2,_0x167bb8,_0x47f12b){_0x47f12b(null,path[_0xcb5a('0x1d')](config['root'],_0xcb5a('0x14')));},'filename':function(_0x482992,_0x8d7037,_0x60da59){_0x60da59(null,util['format']('%s%s',_0xcb5a('0x20'),path['extname'](_0x8d7037['originalname'])));}})});router[_0xcb5a('0x19')]('/:id/preferred',upload[_0xcb5a('0x21')]('file'),controller[_0xcb5a('0x22')]);var upload=multer({'storage':multer[_0xcb5a('0x12')]({'destination':function(_0x1153fc,_0x15b5f6,_0x2ed181){_0x2ed181(null,path[_0xcb5a('0x1d')](config[_0xcb5a('0x13')],_0xcb5a('0x14')));},'filename':function(_0x392aa4,_0x3d27b4,_0x42ca33){_0x42ca33(null,util[_0xcb5a('0x15')](_0xcb5a('0x16'),_0xcb5a('0x23'),path[_0xcb5a('0x18')](_0x3d27b4[_0xcb5a('0x24')])));}})});router['post'](_0xcb5a('0x10'),upload[_0xcb5a('0x21')](_0xcb5a('0x1b')),controller[_0xcb5a('0x25')]);router[_0xcb5a('0x26')](_0xcb5a('0xa'),auth['isAuthenticated'](),controller[_0xcb5a('0x27')]);module[_0xcb5a('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 15cea10..b64ee87 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 _0x5f08=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0xa6f19d,_0x1b7c4d){var _0x2627f3=function(_0x4b80cf){while(--_0x4b80cf){_0xa6f19d['push'](_0xa6f19d['shift']());}};_0x2627f3(++_0x1b7c4d);}(_0x5f08,0x155));var _0x85f0=function(_0x1539ea,_0x539bdd){_0x1539ea=_0x1539ea-0x0;var _0x4aaad6=_0x5f08[_0x1539ea];return _0x4aaad6;};'use strict';var Sequelize=require(_0x85f0('0x0'));module[_0x85f0('0x1')]={'min_internal':{'type':Sequelize[_0x85f0('0x2')](0xb),'unique':_0x85f0('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x85f0('0x2')](0xb),'unique':_0x85f0('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x85f0('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x85f0('0x5')],'defaultValue':_0x85f0('0x6')},'logo':{'type':Sequelize[_0x85f0('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x85f0('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x85f0('0x5')]},'turnaddr':{'type':Sequelize[_0x85f0('0x5')]},'turnusername':{'type':Sequelize[_0x85f0('0x5')]},'turnpassword':{'type':Sequelize[_0x85f0('0x5')]},'pageTitle':{'type':Sequelize[_0x85f0('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x85f0('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x85f0('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x85f0('0x5')],'defaultValue':_0x85f0('0x9')},'chatTimeout':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x85f0('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x85f0('0x5')]},'defaultFavicon':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x85f0('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x85f0('0x2')]},'sentimentRegion':{'type':Sequelize[_0x85f0('0x5')]},'language':{'type':Sequelize[_0x85f0('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x85f0('0x2')](0x2)[_0x85f0('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x85f0('0x2')](0x2)[_0x85f0('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x85f0('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x85f0('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x258e=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','min_internal','INTEGER','min_mailbox','STRING'];(function(_0x452cc0,_0x18f9ce){var _0x3b22f4=function(_0x34b729){while(--_0x34b729){_0x452cc0['push'](_0x452cc0['shift']());}};_0x3b22f4(++_0x18f9ce);}(_0x258e,0x186));var _0xe258=function(_0x14b64f,_0x16a6bd){_0x14b64f=_0x14b64f-0x0;var _0x58dbb2=_0x258e[_0x14b64f];return _0x58dbb2;};'use strict';var Sequelize=require(_0xe258('0x0'));module[_0xe258('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xe258('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe258('0x3')](0xb),'unique':_0xe258('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe258('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe258('0x5')],'defaultValue':_0xe258('0x6')},'logo':{'type':Sequelize[_0xe258('0x5')]},'defaultLogo':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe258('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe258('0x5')]},'turnaddr':{'type':Sequelize[_0xe258('0x5')]},'turnusername':{'type':Sequelize[_0xe258('0x5')]},'turnpassword':{'type':Sequelize[_0xe258('0x5')]},'pageTitle':{'type':Sequelize[_0xe258('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe258('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xe258('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe258('0x5')],'defaultValue':_0xe258('0x9')},'chatTimeout':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe258('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe258('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe258('0x5')]},'defaultFavicon':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xe258('0x3')]},'transcribeRegion':{'type':Sequelize[_0xe258('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe258('0x3')]},'sentimentRegion':{'type':Sequelize[_0xe258('0x5')]},'language':{'type':Sequelize[_0xe258('0x5')]},'bucket':{'type':Sequelize[_0xe258('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xe258('0x3')](0x2)[_0xe258('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xe258('0x3')](0x2)[_0xe258('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe258('0x3')](0x2)[_0xe258('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xe258('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xe258('0x3')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xe258('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c67e751..7541d37 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 _0x9374=['type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','includeAll','include','findAll','rows','show','rawAttributes','options','find','body','addLogo','file','filename','logo','params','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','Sequelize','\x20not\x20found','download','default_loginLogo.svg','default','gdpr','securePassword','getPreferred','default_preferred.png','ValidationError','getFavicon','defaultLoginLogo','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','name','send','map','Setting'];(function(_0x338d6b,_0x21ceb5){var _0x20bf75=function(_0x7f8e3d){while(--_0x7f8e3d){_0x338d6b['push'](_0x338d6b['shift']());}};_0x20bf75(++_0x21ceb5);}(_0x9374,0x1ac));var _0x4937=function(_0x57b501,_0x5b583d){_0x57b501=_0x57b501-0x0;var _0x261cb1=_0x9374[_0x57b501];return _0x261cb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4937('0x0'));var zipdir=require(_0x4937('0x1'));var jsonpatch=require(_0x4937('0x2'));var rp=require('request-promise');var moment=require(_0x4937('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4937('0x4'));var util=require(_0x4937('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4937('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4937('0x7'));var _=require(_0x4937('0x8'));var squel=require(_0x4937('0x9'));var crypto=require(_0x4937('0xa'));var jsforce=require(_0x4937('0xb'));var deskjs=require(_0x4937('0xc'));var toCsv=require(_0x4937('0x6'));var querystring=require(_0x4937('0xd'));var Papa=require(_0x4937('0xe'));var Redis=require(_0x4937('0xf'));var authService=require(_0x4937('0x10'));var qs=require(_0x4937('0x11'));var as=require(_0x4937('0x12'));var hardwareService=require(_0x4937('0x13'));var logger=require('../../config/logger')(_0x4937('0x14'));var utils=require(_0x4937('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4937('0x16'));var db=require(_0x4937('0x17'))['db'];var jayson=require(_0x4937('0x18'));var client=jayson[_0x4937('0x19')][_0x4937('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5c952c,_0xc300b5,_0x26f6e2,_0x4df872){return new BPromise(function(_0x408d51,_0x35b91c){var _0x3dc234=_0x4df872||client;return _0x3dc234[_0x4937('0x1b')](_0x5c952c,_0x26f6e2)['then'](function(_0x142c46){logger[_0x4937('0x1c')](_0x4937('0x1d'),_0xc300b5,'request\x20sent');logger[_0x4937('0x1e')](_0x4937('0x1f'),_0xc300b5,_0x4937('0x20'),JSON[_0x4937('0x21')](_0x142c46));if(_0x142c46['error']){if(_0x142c46['error']['code']===0x1f4){logger[_0x4937('0x22')](_0x4937('0x1d'),_0xc300b5,_0x142c46[_0x4937('0x22')][_0x4937('0x23')]);return _0x35b91c(_0x142c46[_0x4937('0x22')][_0x4937('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0xc300b5,_0x142c46[_0x4937('0x22')]['message']);return _0x408d51(_0x142c46['error'][_0x4937('0x23')]);}else{logger[_0x4937('0x1c')](_0x4937('0x1d'),_0xc300b5,'request\x20sent');_0x408d51(_0x142c46[_0x4937('0x24')]['message']);}})[_0x4937('0x25')](function(_0xc49f14){logger[_0x4937('0x22')](_0x4937('0x1d'),_0xc300b5,_0xc49f14);_0x35b91c(_0xc49f14);});});}function respondWithStatusCode(_0x2927ed,_0x2df48c){_0x2df48c=_0x2df48c||0xcc;return function(_0x59899a){if(_0x59899a){return _0x2927ed[_0x4937('0x26')](_0x2df48c);}return _0x2927ed[_0x4937('0x27')](_0x2df48c)[_0x4937('0x28')]();};}function respondWithResult(_0x334896,_0x807e61){_0x807e61=_0x807e61||0xc8;return function(_0x441046){if(_0x441046){return _0x334896[_0x4937('0x27')](_0x807e61)[_0x4937('0x29')](_0x441046);}};}function respondWithFilteredResult(_0x4cbdf0,_0x37dea6){return function(_0x356ab5){if(_0x356ab5){var _0x122c8f=typeof _0x37dea6[_0x4937('0x2a')]===_0x4937('0x2b')&&typeof _0x37dea6[_0x4937('0x2c')]===_0x4937('0x2b');var _0x46c3db=_0x356ab5['count'];var _0x24b95d=_0x122c8f?0x0:_0x37dea6['offset'];var _0x50dafc=_0x122c8f?_0x356ab5[_0x4937('0x2d')]:_0x37dea6['offset']+_0x37dea6[_0x4937('0x2c')];var _0x3e64c4;if(_0x50dafc>=_0x46c3db){_0x50dafc=_0x46c3db;_0x3e64c4=0xc8;}else{_0x3e64c4=0xce;}_0x4cbdf0[_0x4937('0x27')](_0x3e64c4);return _0x4cbdf0[_0x4937('0x2e')](_0x4937('0x2f'),_0x24b95d+'-'+_0x50dafc+'/'+_0x46c3db)['json'](_0x356ab5);}return null;};}function patchUpdates(_0x92b6fd){return function(_0x2e7753){try{jsonpatch['apply'](_0x2e7753,_0x92b6fd,!![]);}catch(_0x2959a0){return BPromise['reject'](_0x2959a0);}return _0x2e7753[_0x4937('0x30')]();};}function saveUpdates(_0x23a622,_0x5491f5){return function(_0x201b43){if(_0x201b43){return _0x201b43[_0x4937('0x31')](_0x23a622)['then'](function(_0x42b847){return _0x42b847;});}return null;};}function removeEntity(_0x55eee1,_0x5a1597){return function(_0x3bb1c1){if(_0x3bb1c1){return _0x3bb1c1[_0x4937('0x32')]()[_0x4937('0x33')](function(){_0x55eee1[_0x4937('0x27')](0xcc)[_0x4937('0x28')]();});}};}function handleEntityNotFound(_0xb687b,_0x1efddf){return function(_0x2d8568){if(!_0x2d8568){_0xb687b[_0x4937('0x26')](0x194);}return _0x2d8568;};}function handleError(_0x436b1b,_0x991399){_0x991399=_0x991399||0x1f4;return function(_0x5999b5){logger[_0x4937('0x22')](_0x5999b5['stack']);if(_0x5999b5[_0x4937('0x34')]){delete _0x5999b5[_0x4937('0x34')];}_0x436b1b['status'](_0x991399)[_0x4937('0x35')](_0x5999b5);};}exports['index']=function(_0x53f7bb,_0x759309){var _0x1313cd={},_0x57e01f={},_0x58fba={'count':0x0,'rows':[]};var _0x3c85e0=_[_0x4937('0x36')](db[_0x4937('0x37')]['rawAttributes'],function(_0x2d8271){return{'name':_0x2d8271['fieldName'],'type':_0x2d8271[_0x4937('0x38')][_0x4937('0x39')]};});_0x57e01f['model']=_[_0x4937('0x36')](_0x3c85e0,_0x4937('0x34'));_0x57e01f[_0x4937('0x3a')]=_[_0x4937('0x3b')](_0x53f7bb[_0x4937('0x3a')]);_0x57e01f['filters']=_[_0x4937('0x3c')](_0x57e01f[_0x4937('0x3d')],_0x57e01f[_0x4937('0x3a')]);_0x1313cd[_0x4937('0x3e')]=_[_0x4937('0x3c')](_0x57e01f[_0x4937('0x3d')],qs[_0x4937('0x3f')](_0x53f7bb[_0x4937('0x3a')][_0x4937('0x3f')]));_0x1313cd[_0x4937('0x3e')]=_0x1313cd[_0x4937('0x3e')][_0x4937('0x40')]?_0x1313cd[_0x4937('0x3e')]:_0x57e01f[_0x4937('0x3d')];if(!_0x53f7bb[_0x4937('0x3a')][_0x4937('0x41')](_0x4937('0x42'))){_0x1313cd[_0x4937('0x2c')]=qs['limit'](_0x53f7bb[_0x4937('0x3a')][_0x4937('0x2c')]);_0x1313cd['offset']=qs[_0x4937('0x2a')](_0x53f7bb['query'][_0x4937('0x2a')]);}_0x1313cd['order']=qs['sort'](_0x53f7bb[_0x4937('0x3a')][_0x4937('0x43')]);_0x1313cd['where']=qs[_0x4937('0x44')](_['pick'](_0x53f7bb['query'],_0x57e01f['filters']),_0x3c85e0);if(_0x53f7bb[_0x4937('0x3a')][_0x4937('0x45')]){_0x1313cd[_0x4937('0x46')]=_['merge'](_0x1313cd[_0x4937('0x46')],{'$or':_['map'](_0x3c85e0,function(_0x690095){if(_0x690095['type']!=='VIRTUAL'){var _0x3a6598={};_0x3a6598[_0x690095['name']]={'$like':'%'+_0x53f7bb['query']['filter']+'%'};return _0x3a6598;}})});}_0x1313cd=_[_0x4937('0x47')]({},_0x1313cd,_0x53f7bb['options']);var _0x56b0f7={'where':_0x1313cd['where']};return db[_0x4937('0x37')][_0x4937('0x2d')](_0x56b0f7)[_0x4937('0x33')](function(_0x367f4b){_0x58fba[_0x4937('0x2d')]=_0x367f4b;if(_0x53f7bb['query'][_0x4937('0x48')]){_0x1313cd[_0x4937('0x49')]=[{'all':!![]}];}return db[_0x4937('0x37')][_0x4937('0x4a')](_0x1313cd);})[_0x4937('0x33')](function(_0x507171){_0x58fba[_0x4937('0x4b')]=_0x507171;return _0x58fba;})[_0x4937('0x33')](respondWithFilteredResult(_0x759309,_0x1313cd))[_0x4937('0x25')](handleError(_0x759309,null));};exports[_0x4937('0x4c')]=function(_0x8e7ded,_0x59e50f){var _0x46feb1={'raw':![],'where':{'id':_0x8e7ded['params']['id']}},_0x5d40c8={};_0x5d40c8[_0x4937('0x3d')]=_['keys'](db[_0x4937('0x37')][_0x4937('0x4d')]);_0x5d40c8[_0x4937('0x3a')]=_[_0x4937('0x3b')](_0x8e7ded[_0x4937('0x3a')]);_0x5d40c8[_0x4937('0x44')]=_[_0x4937('0x3c')](_0x5d40c8[_0x4937('0x3d')],_0x5d40c8[_0x4937('0x3a')]);_0x46feb1['attributes']=_[_0x4937('0x3c')](_0x5d40c8[_0x4937('0x3d')],qs[_0x4937('0x3f')](_0x8e7ded['query'][_0x4937('0x3f')]));_0x46feb1[_0x4937('0x3e')]=_0x46feb1[_0x4937('0x3e')]['length']?_0x46feb1[_0x4937('0x3e')]:_0x5d40c8[_0x4937('0x3d')];if(_0x8e7ded[_0x4937('0x3a')]['includeAll']){_0x46feb1[_0x4937('0x49')]=[{'all':!![]}];}_0x46feb1=_[_0x4937('0x47')]({},_0x46feb1,_0x8e7ded[_0x4937('0x4e')]);return db[_0x4937('0x37')][_0x4937('0x4f')](_0x46feb1)[_0x4937('0x33')](handleEntityNotFound(_0x59e50f,null))[_0x4937('0x33')](respondWithResult(_0x59e50f,null))[_0x4937('0x25')](handleError(_0x59e50f,null));};exports[_0x4937('0x31')]=function(_0x2b07e2,_0x6291ce){if(_0x2b07e2[_0x4937('0x50')]['id']){delete _0x2b07e2['body']['id'];}return db[_0x4937('0x37')][_0x4937('0x4f')]({'where':{'id':_0x2b07e2['params']['id']}})[_0x4937('0x33')](handleEntityNotFound(_0x6291ce,null))['then'](saveUpdates(_0x2b07e2[_0x4937('0x50')],null))[_0x4937('0x33')](respondWithResult(_0x6291ce,null))[_0x4937('0x25')](handleError(_0x6291ce,null));};exports[_0x4937('0x51')]=function(_0x327be2,_0x2b2a61,_0x15e782){if(_0x327be2['file']&&_0x327be2[_0x4937('0x52')][_0x4937('0x53')]){_0x327be2[_0x4937('0x50')][_0x4937('0x54')]=_0x327be2[_0x4937('0x52')]['filename'];}return db[_0x4937('0x37')][_0x4937('0x4f')]({'where':{'id':_0x327be2[_0x4937('0x55')]['id']}})[_0x4937('0x33')](handleEntityNotFound(_0x2b2a61,null))[_0x4937('0x33')](saveUpdates(_0x327be2[_0x4937('0x50')],null))['then'](respondWithResult(_0x2b2a61,null))[_0x4937('0x25')](handleError(_0x2b2a61,null));};exports[_0x4937('0x56')]=function(_0x15a1d8,_0x46a859,_0x31438e){if(_0x15a1d8[_0x4937('0x52')]&&_0x15a1d8['file']['filename']){_0x15a1d8['body']['loginLogo']=_0x15a1d8[_0x4937('0x52')][_0x4937('0x53')];}return db[_0x4937('0x37')]['find']({'where':{'id':_0x15a1d8[_0x4937('0x55')]['id']}})[_0x4937('0x33')](handleEntityNotFound(_0x46a859,null))[_0x4937('0x33')](saveUpdates(_0x15a1d8[_0x4937('0x50')],null))['then'](respondWithResult(_0x46a859,null))[_0x4937('0x25')](handleError(_0x46a859,null));};var utilLicense=require(_0x4937('0x16'));exports[_0x4937('0x57')]=function(_0xacdb67,_0x50c48a,_0x5a8899){var _0x57e412=_0x4937('0x58');var _0x410b59={'custom':![]};return utilLicense[_0x4937('0x59')]()['then'](function(_0x28e1f6){if(_0x28e1f6){_0x410b59=_0x28e1f6;}return db[_0x4937('0x37')][_0x4937('0x4f')]({'where':{'id':_0xacdb67['params']['id']},'attributes':['logo',_0x4937('0x5a'),_0x4937('0x5b'),_0x4937('0x5c'),_0x4937('0x5d'),'defaultLoginLogo',_0x4937('0x5e'),_0x4937('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x50c48a,null))[_0x4937('0x33')](function(_0xeb2c2b){if(_0xeb2c2b){var _0x3eebda=_0xeb2c2b[_0x4937('0x54')]&&fs[_0x4937('0x60')](path[_0x4937('0x61')](config[_0x4937('0x62')],_0x57e412,_[_0x4937('0x63')](_0xeb2c2b[_0x4937('0x54')])))?path['join'](config[_0x4937('0x62')],_0x57e412,_[_0x4937('0x63')](_0xeb2c2b[_0x4937('0x54')])):path[_0x4937('0x61')](config[_0x4937('0x62')],_0x57e412,_[_0x4937('0x63')]('default_logo.svg'));var _0x4101f7='default'+_[_0x4937('0x64')]('logo');if(_0xeb2c2b[_0x4101f7]||!_0x410b59[_0x4937('0x65')]){_0x3eebda=path[_0x4937('0x61')](config['root'],_0x57e412,_['toLower'](_0x4937('0x66')));}if(!fs[_0x4937('0x60')](_0x3eebda)){throw new db[(_0x4937('0x67'))]['ValidationError'](_[_0x4937('0x64')](_0x4937('0x54'))+_0x4937('0x68'));}return _0x50c48a[_0x4937('0x69')](_0x3eebda);}})[_0x4937('0x25')](handleError(_0x50c48a,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0xa94698,_0x1c6d05,_0x3db932){var _0x51782c=_0x4937('0x58');var _0x313c20={'custom':![]};return utilLicense['getLicense']()[_0x4937('0x33')](function(_0x300127){if(_0x300127){_0x313c20=_0x300127;}return db[_0x4937('0x37')][_0x4937('0x4f')]({'where':{'id':_0xa94698[_0x4937('0x55')]['id']},'attributes':[_0x4937('0x54'),_0x4937('0x5a'),'preferred',_0x4937('0x5c'),_0x4937('0x5d'),'defaultLoginLogo',_0x4937('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x4937('0x33')](handleEntityNotFound(_0x1c6d05,null))['then'](function(_0x4e13bd){if(_0x4e13bd){var _0x5d0418=_0x4e13bd['loginLogo']&&fs[_0x4937('0x60')](path['join'](config[_0x4937('0x62')],_0x51782c,_[_0x4937('0x63')](_0x4e13bd[_0x4937('0x5a')])))?path[_0x4937('0x61')](config[_0x4937('0x62')],_0x51782c,_[_0x4937('0x63')](_0x4e13bd[_0x4937('0x5a')])):path['join'](config[_0x4937('0x62')],_0x51782c,_[_0x4937('0x63')](_0x4937('0x6a')));var _0x46d15d=_0x4937('0x6b')+_[_0x4937('0x64')]('loginLogo');if(_0x4e13bd[_0x46d15d]||!_0x313c20[_0x4937('0x65')]){_0x5d0418=path[_0x4937('0x61')](config[_0x4937('0x62')],_0x51782c,_[_0x4937('0x63')](_0x4937('0x6a')));}if(!fs[_0x4937('0x60')](_0x5d0418)){throw new db[(_0x4937('0x67'))]['ValidationError'](_[_0x4937('0x64')](_0x4937('0x5a'))+_0x4937('0x68'));}return _0x1c6d05[_0x4937('0x69')](_0x5d0418);}})[_0x4937('0x25')](handleError(_0x1c6d05,null));};exports[_0x4937('0x6c')]=function(_0x2b25a1,_0x2f20fe){return db[_0x4937('0x37')][_0x4937('0x4f')]({'where':{'id':_0x2b25a1['params']['id']},'attributes':[_0x4937('0x6d')]})[_0x4937('0x33')](respondWithResult(_0x2f20fe,null))[_0x4937('0x25')](handleError(_0x2f20fe,null));};exports['addPreferred']=function(_0x22958a,_0x112cd3,_0x5a9126){if(_0x22958a[_0x4937('0x52')]&&_0x22958a[_0x4937('0x52')][_0x4937('0x53')]){_0x22958a[_0x4937('0x50')]['preferred']=_0x22958a['file'][_0x4937('0x53')];}return db[_0x4937('0x37')][_0x4937('0x4f')]({'where':{'id':_0x22958a[_0x4937('0x55')]['id']}})[_0x4937('0x33')](handleEntityNotFound(_0x112cd3,null))['then'](saveUpdates(_0x22958a[_0x4937('0x50')],null))[_0x4937('0x33')](respondWithResult(_0x112cd3,null))[_0x4937('0x25')](handleError(_0x112cd3,null));};var utilLicense=require('../../config/license/util');exports[_0x4937('0x6e')]=function(_0x77e931,_0x52be05,_0x20e33f){var _0x52c65a=_0x4937('0x58');var _0x612d15={'custom':![]};return utilLicense[_0x4937('0x59')]()['then'](function(_0x4c2e1a){if(_0x4c2e1a){_0x612d15=_0x4c2e1a;}return db['Setting'][_0x4937('0x4f')]({'where':{'id':_0x77e931[_0x4937('0x55')]['id']},'attributes':[_0x4937('0x54'),'loginLogo',_0x4937('0x5b'),_0x4937('0x5c'),_0x4937('0x5d'),'defaultLoginLogo',_0x4937('0x5e'),_0x4937('0x5f')],'raw':!![]});})[_0x4937('0x33')](handleEntityNotFound(_0x52be05,null))[_0x4937('0x33')](function(_0x3f0b52){if(_0x3f0b52){var _0x1ee706=_0x3f0b52[_0x4937('0x5b')]&&fs['existsSync'](path[_0x4937('0x61')](config[_0x4937('0x62')],_0x52c65a,_[_0x4937('0x63')](_0x3f0b52[_0x4937('0x5b')])))?path[_0x4937('0x61')](config[_0x4937('0x62')],_0x52c65a,_['toLower'](_0x3f0b52[_0x4937('0x5b')])):path['join'](config[_0x4937('0x62')],_0x52c65a,_['toLower'](_0x4937('0x6f')));var _0x158e9b='default'+_[_0x4937('0x64')]('preferred');if(_0x3f0b52[_0x158e9b]||!_0x612d15['custom']||!_0x612d15['preferred']){_0x1ee706=path[_0x4937('0x61')](config[_0x4937('0x62')],_0x52c65a,_[_0x4937('0x63')](_0x4937('0x6f')));}if(!fs['existsSync'](_0x1ee706)){throw new db[(_0x4937('0x67'))][(_0x4937('0x70'))](_[_0x4937('0x64')](_0x4937('0x5b'))+_0x4937('0x68'));}return _0x52be05[_0x4937('0x69')](_0x1ee706);}})[_0x4937('0x25')](handleError(_0x52be05,null));};exports['addFavicon']=function(_0x1ea417,_0x347e3c,_0x565cab){if(_0x1ea417[_0x4937('0x52')]&&_0x1ea417[_0x4937('0x52')][_0x4937('0x53')]){_0x1ea417[_0x4937('0x50')][_0x4937('0x5c')]=_0x1ea417[_0x4937('0x52')]['filename'];}return db[_0x4937('0x37')]['find']({'where':{'id':_0x1ea417[_0x4937('0x55')]['id']}})[_0x4937('0x33')](handleEntityNotFound(_0x347e3c,null))[_0x4937('0x33')](saveUpdates(_0x1ea417[_0x4937('0x50')],null))[_0x4937('0x33')](respondWithResult(_0x347e3c,null))[_0x4937('0x25')](handleError(_0x347e3c,null));};var utilLicense=require(_0x4937('0x16'));exports[_0x4937('0x71')]=function(_0x73243e,_0x5800b0,_0x4b2b53){var _0x2e6487=_0x4937('0x58');var _0x2380f7={'custom':![]};return utilLicense['getLicense']()[_0x4937('0x33')](function(_0x5398ee){if(_0x5398ee){_0x2380f7=_0x5398ee;}return db['Setting'][_0x4937('0x4f')]({'where':{'id':_0x73243e[_0x4937('0x55')]['id']},'attributes':['logo',_0x4937('0x5a'),_0x4937('0x5b'),_0x4937('0x5c'),'defaultLogo',_0x4937('0x72'),_0x4937('0x5e'),_0x4937('0x5f')],'raw':!![]});})[_0x4937('0x33')](handleEntityNotFound(_0x5800b0,null))['then'](function(_0x1c1f64){if(_0x1c1f64){var _0x3886a0=_0x1c1f64[_0x4937('0x5c')]&&fs[_0x4937('0x60')](path[_0x4937('0x61')](config[_0x4937('0x62')],_0x2e6487,_[_0x4937('0x63')](_0x1c1f64['favicon'])))?path[_0x4937('0x61')](config[_0x4937('0x62')],_0x2e6487,_[_0x4937('0x63')](_0x1c1f64[_0x4937('0x5c')])):path[_0x4937('0x61')](config[_0x4937('0x62')],_0x2e6487,_[_0x4937('0x63')](_0x4937('0x73')));var _0x2ada94=_0x4937('0x6b')+_[_0x4937('0x64')](_0x4937('0x5c'));if(_0x1c1f64[_0x2ada94]||!_0x2380f7[_0x4937('0x65')]){_0x3886a0=path[_0x4937('0x61')](config['root'],_0x2e6487,_[_0x4937('0x63')](_0x4937('0x73')));}if(!fs[_0x4937('0x60')](_0x3886a0)){throw new db[(_0x4937('0x67'))]['ValidationError'](_['upperFirst'](_0x4937('0x5c'))+_0x4937('0x68'));}return _0x5800b0[_0x4937('0x69')](_0x3886a0);}})[_0x4937('0x25')](handleError(_0x5800b0,null));};exports[_0x4937('0x74')]=function(_0x43fc90,_0x2205af){var _0x21a9fa={'offset':moment()[_0x4937('0x75')]()};_0x21a9fa[_0x4937('0x76')]=moment()['utcOffset'](_0x21a9fa[_0x4937('0x2a')])[_0x4937('0x77')](_0x4937('0x78'));return _0x2205af['status'](0xc8)[_0x4937('0x35')](_0x21a9fa);}; \ No newline at end of file +var _0x0048=['name','send','index','map','Setting','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','upperFirst','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','defaultLogo','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','getPreferred','default','default_preferred.png','getFavicon','getDate','now','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','stack'];(function(_0x597b3b,_0x3febc1){var _0x2bf1db=function(_0x99d339){while(--_0x99d339){_0x597b3b['push'](_0x597b3b['shift']());}};_0x2bf1db(++_0x3febc1);}(_0x0048,0x129));var _0x8004=function(_0x2a0ad3,_0x3e5795){_0x2a0ad3=_0x2a0ad3-0x0;var _0x1e501b=_0x0048[_0x2a0ad3];return _0x1e501b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8004('0x0'));var zipdir=require(_0x8004('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8004('0x2'));var moment=require(_0x8004('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8004('0x4'));var util=require(_0x8004('0x5'));var path=require(_0x8004('0x6'));var sox=require(_0x8004('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8004('0x8'));var _=require(_0x8004('0x9'));var squel=require(_0x8004('0xa'));var crypto=require('crypto');var jsforce=require(_0x8004('0xb'));var deskjs=require(_0x8004('0xc'));var toCsv=require(_0x8004('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8004('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8004('0xf'));var logger=require(_0x8004('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x8004('0x11'));var licenseUtil=require(_0x8004('0x12'));var db=require(_0x8004('0x13'))['db'];var jayson=require(_0x8004('0x14'));var client=jayson[_0x8004('0x15')][_0x8004('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x39a752,_0x5d9972,_0x26dde8,_0x3bb941){return new BPromise(function(_0x2fc21a,_0xeaeac3){var _0x235819=_0x3bb941||client;return _0x235819[_0x8004('0x17')](_0x39a752,_0x26dde8)[_0x8004('0x18')](function(_0x65f71e){logger[_0x8004('0x19')](_0x8004('0x1a'),_0x5d9972,_0x8004('0x1b'));logger[_0x8004('0x1c')](_0x8004('0x1d'),_0x5d9972,_0x8004('0x1b'),JSON[_0x8004('0x1e')](_0x65f71e));if(_0x65f71e[_0x8004('0x1f')]){if(_0x65f71e[_0x8004('0x1f')][_0x8004('0x20')]===0x1f4){logger[_0x8004('0x1f')]('Setting,\x20%s,\x20%s',_0x5d9972,_0x65f71e[_0x8004('0x1f')][_0x8004('0x21')]);return _0xeaeac3(_0x65f71e['error'][_0x8004('0x21')]);}logger[_0x8004('0x1f')](_0x8004('0x1a'),_0x5d9972,_0x65f71e[_0x8004('0x1f')][_0x8004('0x21')]);return _0x2fc21a(_0x65f71e[_0x8004('0x1f')][_0x8004('0x21')]);}else{logger[_0x8004('0x19')](_0x8004('0x1a'),_0x5d9972,_0x8004('0x1b'));_0x2fc21a(_0x65f71e['result']['message']);}})['catch'](function(_0x2006f5){logger[_0x8004('0x1f')]('Setting,\x20%s,\x20%s',_0x5d9972,_0x2006f5);_0xeaeac3(_0x2006f5);});});}function respondWithStatusCode(_0x4325f9,_0x1a4410){_0x1a4410=_0x1a4410||0xcc;return function(_0x81b386){if(_0x81b386){return _0x4325f9[_0x8004('0x22')](_0x1a4410);}return _0x4325f9[_0x8004('0x23')](_0x1a4410)[_0x8004('0x24')]();};}function respondWithResult(_0x567c3e,_0x108089){_0x108089=_0x108089||0xc8;return function(_0x43b3d6){if(_0x43b3d6){return _0x567c3e['status'](_0x108089)[_0x8004('0x25')](_0x43b3d6);}};}function respondWithFilteredResult(_0x7f96a8,_0xbf2fe7){return function(_0x1102c2){if(_0x1102c2){var _0x5dc5d4=typeof _0xbf2fe7['offset']===_0x8004('0x26')&&typeof _0xbf2fe7[_0x8004('0x27')]==='undefined';var _0x278b8c=_0x1102c2[_0x8004('0x28')];var _0x3be2f9=_0x5dc5d4?0x0:_0xbf2fe7[_0x8004('0x29')];var _0x78d1d2=_0x5dc5d4?_0x1102c2['count']:_0xbf2fe7[_0x8004('0x29')]+_0xbf2fe7['limit'];var _0x28b6c8;if(_0x78d1d2>=_0x278b8c){_0x78d1d2=_0x278b8c;_0x28b6c8=0xc8;}else{_0x28b6c8=0xce;}_0x7f96a8['status'](_0x28b6c8);return _0x7f96a8['set']('Content-Range',_0x3be2f9+'-'+_0x78d1d2+'/'+_0x278b8c)[_0x8004('0x25')](_0x1102c2);}return null;};}function patchUpdates(_0x3dff63){return function(_0x53c21a){try{jsonpatch[_0x8004('0x2a')](_0x53c21a,_0x3dff63,!![]);}catch(_0xd3f82e){return BPromise[_0x8004('0x2b')](_0xd3f82e);}return _0x53c21a[_0x8004('0x2c')]();};}function saveUpdates(_0x26877e,_0xd1da3f){return function(_0x2eeb55){if(_0x2eeb55){return _0x2eeb55[_0x8004('0x2d')](_0x26877e)['then'](function(_0x542d92){return _0x542d92;});}return null;};}function removeEntity(_0x5c015b,_0x4859f6){return function(_0x378394){if(_0x378394){return _0x378394[_0x8004('0x2e')]()[_0x8004('0x18')](function(){_0x5c015b[_0x8004('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a138,_0x5edf96){return function(_0x376276){if(!_0x376276){_0x21a138[_0x8004('0x22')](0x194);}return _0x376276;};}function handleError(_0x2dbf14,_0x5bcd0d){_0x5bcd0d=_0x5bcd0d||0x1f4;return function(_0x46dc66){logger[_0x8004('0x1f')](_0x46dc66[_0x8004('0x2f')]);if(_0x46dc66[_0x8004('0x30')]){delete _0x46dc66[_0x8004('0x30')];}_0x2dbf14[_0x8004('0x23')](_0x5bcd0d)[_0x8004('0x31')](_0x46dc66);};}exports[_0x8004('0x32')]=function(_0x5a8190,_0xad3eb3){var _0x2b0568={},_0x19c376={},_0x9c012d={'count':0x0,'rows':[]};var _0x529fb3=_[_0x8004('0x33')](db[_0x8004('0x34')]['rawAttributes'],function(_0x37841d){return{'name':_0x37841d['fieldName'],'type':_0x37841d[_0x8004('0x35')]['key']};});_0x19c376['model']=_[_0x8004('0x33')](_0x529fb3,_0x8004('0x30'));_0x19c376[_0x8004('0x36')]=_[_0x8004('0x37')](_0x5a8190[_0x8004('0x36')]);_0x19c376['filters']=_[_0x8004('0x38')](_0x19c376[_0x8004('0x39')],_0x19c376[_0x8004('0x36')]);_0x2b0568[_0x8004('0x3a')]=_['intersection'](_0x19c376[_0x8004('0x39')],qs[_0x8004('0x3b')](_0x5a8190['query'][_0x8004('0x3b')]));_0x2b0568[_0x8004('0x3a')]=_0x2b0568[_0x8004('0x3a')]['length']?_0x2b0568[_0x8004('0x3a')]:_0x19c376['model'];if(!_0x5a8190[_0x8004('0x36')][_0x8004('0x3c')](_0x8004('0x3d'))){_0x2b0568['limit']=qs['limit'](_0x5a8190['query']['limit']);_0x2b0568[_0x8004('0x29')]=qs[_0x8004('0x29')](_0x5a8190['query'][_0x8004('0x29')]);}_0x2b0568[_0x8004('0x3e')]=qs['sort'](_0x5a8190[_0x8004('0x36')][_0x8004('0x3f')]);_0x2b0568[_0x8004('0x40')]=qs['filters'](_[_0x8004('0x41')](_0x5a8190['query'],_0x19c376[_0x8004('0x42')]),_0x529fb3);if(_0x5a8190['query'][_0x8004('0x43')]){_0x2b0568[_0x8004('0x40')]=_['merge'](_0x2b0568[_0x8004('0x40')],{'$or':_[_0x8004('0x33')](_0x529fb3,function(_0x33dfaf){if(_0x33dfaf['type']!=='VIRTUAL'){var _0x1bf929={};_0x1bf929[_0x33dfaf[_0x8004('0x30')]]={'$like':'%'+_0x5a8190[_0x8004('0x36')][_0x8004('0x43')]+'%'};return _0x1bf929;}})});}_0x2b0568=_['merge']({},_0x2b0568,_0x5a8190[_0x8004('0x44')]);var _0x106811={'where':_0x2b0568[_0x8004('0x40')]};return db[_0x8004('0x34')][_0x8004('0x28')](_0x106811)['then'](function(_0x552962){_0x9c012d[_0x8004('0x28')]=_0x552962;if(_0x5a8190[_0x8004('0x36')][_0x8004('0x45')]){_0x2b0568[_0x8004('0x46')]=[{'all':!![]}];}return db[_0x8004('0x34')][_0x8004('0x47')](_0x2b0568);})[_0x8004('0x18')](function(_0x113203){_0x9c012d[_0x8004('0x48')]=_0x113203;return _0x9c012d;})[_0x8004('0x18')](respondWithFilteredResult(_0xad3eb3,_0x2b0568))[_0x8004('0x49')](handleError(_0xad3eb3,null));};exports[_0x8004('0x4a')]=function(_0x3f5148,_0x49cdef){var _0x164f9d={'raw':![],'where':{'id':_0x3f5148[_0x8004('0x4b')]['id']}},_0x11dbbe={};_0x11dbbe[_0x8004('0x39')]=_['keys'](db['Setting'][_0x8004('0x4c')]);_0x11dbbe[_0x8004('0x36')]=_['keys'](_0x3f5148[_0x8004('0x36')]);_0x11dbbe[_0x8004('0x42')]=_['intersection'](_0x11dbbe['model'],_0x11dbbe['query']);_0x164f9d[_0x8004('0x3a')]=_[_0x8004('0x38')](_0x11dbbe[_0x8004('0x39')],qs[_0x8004('0x3b')](_0x3f5148[_0x8004('0x36')][_0x8004('0x3b')]));_0x164f9d[_0x8004('0x3a')]=_0x164f9d['attributes'][_0x8004('0x4d')]?_0x164f9d[_0x8004('0x3a')]:_0x11dbbe[_0x8004('0x39')];if(_0x3f5148[_0x8004('0x36')]['includeAll']){_0x164f9d[_0x8004('0x46')]=[{'all':!![]}];}_0x164f9d=_['merge']({},_0x164f9d,_0x3f5148['options']);return db[_0x8004('0x34')][_0x8004('0x4e')](_0x164f9d)[_0x8004('0x18')](handleEntityNotFound(_0x49cdef,null))[_0x8004('0x18')](respondWithResult(_0x49cdef,null))['catch'](handleError(_0x49cdef,null));};exports[_0x8004('0x2d')]=function(_0x581875,_0x101b0c){if(_0x581875[_0x8004('0x4f')]['id']){delete _0x581875[_0x8004('0x4f')]['id'];}return db[_0x8004('0x34')][_0x8004('0x4e')]({'where':{'id':_0x581875[_0x8004('0x4b')]['id']}})[_0x8004('0x18')](handleEntityNotFound(_0x101b0c,null))[_0x8004('0x18')](saveUpdates(_0x581875['body'],null))[_0x8004('0x18')](respondWithResult(_0x101b0c,null))[_0x8004('0x49')](handleError(_0x101b0c,null));};exports['addLogo']=function(_0x4f369d,_0x33e112,_0x23f343){if(_0x4f369d[_0x8004('0x50')]&&_0x4f369d[_0x8004('0x50')][_0x8004('0x51')]){_0x4f369d[_0x8004('0x4f')][_0x8004('0x52')]=_0x4f369d['file'][_0x8004('0x51')];}return db['Setting'][_0x8004('0x4e')]({'where':{'id':_0x4f369d[_0x8004('0x4b')]['id']}})[_0x8004('0x18')](handleEntityNotFound(_0x33e112,null))[_0x8004('0x18')](saveUpdates(_0x4f369d['body'],null))[_0x8004('0x18')](respondWithResult(_0x33e112,null))[_0x8004('0x49')](handleError(_0x33e112,null));};exports[_0x8004('0x53')]=function(_0x74211e,_0x41efdf,_0x533dc4){if(_0x74211e[_0x8004('0x50')]&&_0x74211e[_0x8004('0x50')][_0x8004('0x51')]){_0x74211e[_0x8004('0x4f')][_0x8004('0x54')]=_0x74211e[_0x8004('0x50')][_0x8004('0x51')];}return db[_0x8004('0x34')][_0x8004('0x4e')]({'where':{'id':_0x74211e['params']['id']}})[_0x8004('0x18')](handleEntityNotFound(_0x41efdf,null))['then'](saveUpdates(_0x74211e[_0x8004('0x4f')],null))[_0x8004('0x18')](respondWithResult(_0x41efdf,null))['catch'](handleError(_0x41efdf,null));};var utilLicense=require(_0x8004('0x12'));exports[_0x8004('0x55')]=function(_0x2548fb,_0xa4abfa,_0xdfa80f){var _0x2c1e1a=_0x8004('0x56');var _0xc7d853={'custom':![]};return utilLicense[_0x8004('0x57')]()['then'](function(_0x2e9c45){if(_0x2e9c45){_0xc7d853=_0x2e9c45;}return db[_0x8004('0x34')]['find']({'where':{'id':_0x2548fb[_0x8004('0x4b')]['id']},'attributes':['logo',_0x8004('0x54'),_0x8004('0x58'),_0x8004('0x59'),'defaultLogo',_0x8004('0x5a'),_0x8004('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x8004('0x18')](handleEntityNotFound(_0xa4abfa,null))[_0x8004('0x18')](function(_0x476c2){if(_0x476c2){var _0x43e1bb=_0x476c2[_0x8004('0x52')]&&fs[_0x8004('0x5c')](path['join'](config[_0x8004('0x5d')],_0x2c1e1a,_[_0x8004('0x5e')](_0x476c2[_0x8004('0x52')])))?path['join'](config[_0x8004('0x5d')],_0x2c1e1a,_[_0x8004('0x5e')](_0x476c2['logo'])):path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x2c1e1a,_[_0x8004('0x5e')]('default_logo.svg'));var _0x40b00f='default'+_[_0x8004('0x60')](_0x8004('0x52'));if(_0x476c2[_0x40b00f]||!_0xc7d853['custom']){_0x43e1bb=path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x2c1e1a,_[_0x8004('0x5e')](_0x8004('0x61')));}if(!fs[_0x8004('0x5c')](_0x43e1bb)){throw new db[(_0x8004('0x62'))][(_0x8004('0x63'))](_[_0x8004('0x60')](_0x8004('0x52'))+_0x8004('0x64'));}return _0xa4abfa[_0x8004('0x65')](_0x43e1bb);}})[_0x8004('0x49')](handleError(_0xa4abfa,null));};var utilLicense=require(_0x8004('0x12'));exports['getLogoLogin']=function(_0x5e0d26,_0x327554,_0x4aabb9){var _0x4f7b94=_0x8004('0x56');var _0xd4e168={'custom':![]};return utilLicense[_0x8004('0x57')]()[_0x8004('0x18')](function(_0x3557a1){if(_0x3557a1){_0xd4e168=_0x3557a1;}return db[_0x8004('0x34')][_0x8004('0x4e')]({'where':{'id':_0x5e0d26[_0x8004('0x4b')]['id']},'attributes':[_0x8004('0x52'),_0x8004('0x54'),_0x8004('0x58'),_0x8004('0x59'),_0x8004('0x66'),_0x8004('0x5a'),_0x8004('0x5b'),_0x8004('0x67')],'raw':!![]});})[_0x8004('0x18')](handleEntityNotFound(_0x327554,null))[_0x8004('0x18')](function(_0x4e9485){if(_0x4e9485){var _0x1a4a52=_0x4e9485[_0x8004('0x54')]&&fs[_0x8004('0x5c')](path['join'](config[_0x8004('0x5d')],_0x4f7b94,_[_0x8004('0x5e')](_0x4e9485[_0x8004('0x54')])))?path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x4f7b94,_['toLower'](_0x4e9485['loginLogo'])):path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x4f7b94,_[_0x8004('0x5e')](_0x8004('0x68')));var _0x55d158='default'+_[_0x8004('0x60')](_0x8004('0x54'));if(_0x4e9485[_0x55d158]||!_0xd4e168[_0x8004('0x69')]){_0x1a4a52=path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x4f7b94,_[_0x8004('0x5e')](_0x8004('0x68')));}if(!fs[_0x8004('0x5c')](_0x1a4a52)){throw new db['Sequelize']['ValidationError'](_[_0x8004('0x60')](_0x8004('0x54'))+_0x8004('0x64'));}return _0x327554[_0x8004('0x65')](_0x1a4a52);}})['catch'](handleError(_0x327554,null));};exports[_0x8004('0x6a')]=function(_0x34bc38,_0x450e57){return db['Setting'][_0x8004('0x4e')]({'where':{'id':_0x34bc38['params']['id']},'attributes':[_0x8004('0x6b')]})[_0x8004('0x18')](respondWithResult(_0x450e57,null))[_0x8004('0x49')](handleError(_0x450e57,null));};exports['addPreferred']=function(_0x177e55,_0x3e101b,_0x1e844c){if(_0x177e55['file']&&_0x177e55[_0x8004('0x50')][_0x8004('0x51')]){_0x177e55['body']['preferred']=_0x177e55[_0x8004('0x50')][_0x8004('0x51')];}return db[_0x8004('0x34')][_0x8004('0x4e')]({'where':{'id':_0x177e55[_0x8004('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e101b,null))[_0x8004('0x18')](saveUpdates(_0x177e55[_0x8004('0x4f')],null))[_0x8004('0x18')](respondWithResult(_0x3e101b,null))[_0x8004('0x49')](handleError(_0x3e101b,null));};var utilLicense=require(_0x8004('0x12'));exports[_0x8004('0x6c')]=function(_0xc431db,_0x2360b2,_0x26e9d3){var _0x4a557f=_0x8004('0x56');var _0x354f4c={'custom':![]};return utilLicense[_0x8004('0x57')]()[_0x8004('0x18')](function(_0x5dcb8a){if(_0x5dcb8a){_0x354f4c=_0x5dcb8a;}return db[_0x8004('0x34')][_0x8004('0x4e')]({'where':{'id':_0xc431db[_0x8004('0x4b')]['id']},'attributes':['logo',_0x8004('0x54'),_0x8004('0x58'),_0x8004('0x59'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x8004('0x67')],'raw':!![]});})[_0x8004('0x18')](handleEntityNotFound(_0x2360b2,null))[_0x8004('0x18')](function(_0x16d887){if(_0x16d887){var _0x3e7da5=_0x16d887[_0x8004('0x58')]&&fs[_0x8004('0x5c')](path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x4a557f,_['toLower'](_0x16d887[_0x8004('0x58')])))?path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x4a557f,_[_0x8004('0x5e')](_0x16d887[_0x8004('0x58')])):path['join'](config[_0x8004('0x5d')],_0x4a557f,_[_0x8004('0x5e')]('default_preferred.png'));var _0x3726b6=_0x8004('0x6d')+_[_0x8004('0x60')](_0x8004('0x58'));if(_0x16d887[_0x3726b6]||!_0x354f4c[_0x8004('0x69')]||!_0x354f4c[_0x8004('0x58')]){_0x3e7da5=path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x4a557f,_[_0x8004('0x5e')](_0x8004('0x6e')));}if(!fs[_0x8004('0x5c')](_0x3e7da5)){throw new db[(_0x8004('0x62'))][(_0x8004('0x63'))](_[_0x8004('0x60')](_0x8004('0x58'))+_0x8004('0x64'));}return _0x2360b2['download'](_0x3e7da5);}})[_0x8004('0x49')](handleError(_0x2360b2,null));};exports['addFavicon']=function(_0x2f5325,_0x4a8cb2,_0x43895f){if(_0x2f5325[_0x8004('0x50')]&&_0x2f5325[_0x8004('0x50')]['filename']){_0x2f5325[_0x8004('0x4f')]['favicon']=_0x2f5325['file'][_0x8004('0x51')];}return db['Setting'][_0x8004('0x4e')]({'where':{'id':_0x2f5325[_0x8004('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a8cb2,null))[_0x8004('0x18')](saveUpdates(_0x2f5325[_0x8004('0x4f')],null))[_0x8004('0x18')](respondWithResult(_0x4a8cb2,null))[_0x8004('0x49')](handleError(_0x4a8cb2,null));};var utilLicense=require(_0x8004('0x12'));exports[_0x8004('0x6f')]=function(_0x6675cb,_0x5b6bd0,_0x3e32d8){var _0x3a68d5=_0x8004('0x56');var _0x5cba80={'custom':![]};return utilLicense['getLicense']()[_0x8004('0x18')](function(_0x3104c5){if(_0x3104c5){_0x5cba80=_0x3104c5;}return db[_0x8004('0x34')][_0x8004('0x4e')]({'where':{'id':_0x6675cb[_0x8004('0x4b')]['id']},'attributes':[_0x8004('0x52'),_0x8004('0x54'),_0x8004('0x58'),_0x8004('0x59'),_0x8004('0x66'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5b6bd0,null))[_0x8004('0x18')](function(_0x27a10a){if(_0x27a10a){var _0x4fef50=_0x27a10a[_0x8004('0x59')]&&fs['existsSync'](path['join'](config[_0x8004('0x5d')],_0x3a68d5,_['toLower'](_0x27a10a['favicon'])))?path[_0x8004('0x5f')](config['root'],_0x3a68d5,_[_0x8004('0x5e')](_0x27a10a[_0x8004('0x59')])):path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x3a68d5,_['toLower']('default_favicon.ico'));var _0x39f6a3=_0x8004('0x6d')+_[_0x8004('0x60')](_0x8004('0x59'));if(_0x27a10a[_0x39f6a3]||!_0x5cba80[_0x8004('0x69')]){_0x4fef50=path[_0x8004('0x5f')](config[_0x8004('0x5d')],_0x3a68d5,_['toLower']('default_favicon.ico'));}if(!fs[_0x8004('0x5c')](_0x4fef50)){throw new db['Sequelize'][(_0x8004('0x63'))](_[_0x8004('0x60')]('favicon')+_0x8004('0x64'));}return _0x5b6bd0[_0x8004('0x65')](_0x4fef50);}})['catch'](handleError(_0x5b6bd0,null));};exports[_0x8004('0x70')]=function(_0x247e2b,_0x59204f){var _0x5eb893={'offset':moment()['utcOffset']()};_0x5eb893[_0x8004('0x71')]=moment()['utcOffset'](_0x5eb893[_0x8004('0x29')])['format'](_0x8004('0x72'));return _0x59204f[_0x8004('0x23')](0xc8)[_0x8004('0x31')](_0x5eb893);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e526245..b3f1e1e 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x55ca,0x126));var _0xa55c=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x55ca[_0x70fd53];return _0x4b71c5;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x1f6951,_0x14a366){var _0x4b2190=function(_0x406481){while(--_0x406481){_0x1f6951['push'](_0x1f6951['shift']());}};_0x4b2190(++_0x14a366);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ddb58,_0x214379){_0x4ddb58=_0x4ddb58-0x0;var _0x1382ad=_0xedd9[_0x4ddb58];return _0x1382ad;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 536d8f3..55f666e 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 _0x69df=['ShowSetting','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','find','options','raw','attributes','include','map','model'];(function(_0x47da41,_0x27fa34){var _0x52cdc=function(_0x5d14f7){while(--_0x5d14f7){_0x47da41['push'](_0x47da41['shift']());}};_0x52cdc(++_0x27fa34);}(_0x69df,0xc8));var _0xf69d=function(_0x35a240,_0x5a8c71){_0x35a240=_0x35a240-0x0;var _0x3e8a29=_0x69df[_0x35a240];return _0x3e8a29;};'use strict';var _=require('lodash');var util=require(_0xf69d('0x0'));var moment=require(_0xf69d('0x1'));var BPromise=require('bluebird');var rs=require(_0xf69d('0x2'));var fs=require('fs');var Redis=require(_0xf69d('0x3'));var db=require(_0xf69d('0x4'))['db'];var utils=require(_0xf69d('0x5'));var logger=require(_0xf69d('0x6'))(_0xf69d('0x7'));var config=require(_0xf69d('0x8'));var jayson=require(_0xf69d('0x9'));var client=jayson[_0xf69d('0xa')][_0xf69d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aa001,_0xa0ab49,_0x5badbf){return new BPromise(function(_0x101880,_0x469728){return client[_0xf69d('0xc')](_0x5aa001,_0x5badbf)[_0xf69d('0xd')](function(_0x5d2031){logger['info']('Setting,\x20%s,\x20%s',_0xa0ab49,_0xf69d('0xe'));logger[_0xf69d('0xf')](_0xf69d('0x10'),_0xa0ab49,_0xf69d('0xe'),JSON['stringify'](_0x5d2031));if(_0x5d2031[_0xf69d('0x11')]){if(_0x5d2031[_0xf69d('0x11')][_0xf69d('0x12')]===0x1f4){logger[_0xf69d('0x11')](_0xf69d('0x13'),_0xa0ab49,_0x5d2031[_0xf69d('0x11')][_0xf69d('0x14')]);return _0x469728(_0x5d2031['error'][_0xf69d('0x14')]);}logger[_0xf69d('0x11')](_0xf69d('0x13'),_0xa0ab49,_0x5d2031[_0xf69d('0x11')][_0xf69d('0x14')]);return _0x101880(_0x5d2031[_0xf69d('0x11')][_0xf69d('0x14')]);}else{logger[_0xf69d('0x15')](_0xf69d('0x13'),_0xa0ab49,'request\x20sent');_0x101880(_0x5d2031[_0xf69d('0x16')][_0xf69d('0x14')]);}})[_0xf69d('0x17')](function(_0x3422a1){logger[_0xf69d('0x11')](_0xf69d('0x13'),_0xa0ab49,_0x3422a1);_0x469728(_0x3422a1);});});}exports['ShowSetting']=function(_0x297877){var _0x1bf339=this;return new Promise(function(_0x404673,_0x186381){return db['Setting'][_0xf69d('0x18')]({'raw':_0x297877['options']?_0x297877[_0xf69d('0x19')][_0xf69d('0x1a')]===undefined?!![]:![]:!![],'where':_0x297877['options']?_0x297877[_0xf69d('0x19')]['where']||null:null,'attributes':_0x297877['options']?_0x297877[_0xf69d('0x19')][_0xf69d('0x1b')]||null:null,'include':_0x297877[_0xf69d('0x19')]?_0x297877[_0xf69d('0x19')][_0xf69d('0x1c')]?_[_0xf69d('0x1d')](_0x297877[_0xf69d('0x19')][_0xf69d('0x1c')],function(_0x510d52){return{'model':db[_0x510d52[_0xf69d('0x1e')]],'as':_0x510d52['as'],'attributes':_0x510d52[_0xf69d('0x1b')],'include':_0x510d52[_0xf69d('0x1c')]?_[_0xf69d('0x1d')](_0x510d52['include'],function(_0x19687c){return{'model':db[_0x19687c[_0xf69d('0x1e')]],'as':_0x19687c['as'],'attributes':_0x19687c[_0xf69d('0x1b')],'include':_0x19687c[_0xf69d('0x1c')]?_[_0xf69d('0x1d')](_0x19687c[_0xf69d('0x1c')],function(_0x56f332){return{'model':db[_0x56f332['model']],'as':_0x56f332['as'],'attributes':_0x56f332[_0xf69d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf69d('0xd')](function(_0x3f1c10){logger['info'](_0xf69d('0x1f'),_0x297877);logger['debug'](_0xf69d('0x1f'),_0x297877,JSON[_0xf69d('0x20')](_0x3f1c10));_0x404673(_0x3f1c10);})[_0xf69d('0x17')](function(_0x30e4b4){logger[_0xf69d('0x11')](_0xf69d('0x1f'),_0x30e4b4[_0xf69d('0x14')],_0x297877);_0x186381(_0x1bf339[_0xf69d('0x11')](0x1f4,_0x30e4b4[_0xf69d('0x14')]));});});}; \ No newline at end of file +var _0x13c0=['find','options','raw','where','attributes','include','map','model','info','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ShowSetting','Setting'];(function(_0x496d3c,_0x3eab1e){var _0x3700b8=function(_0x4c271c){while(--_0x4c271c){_0x496d3c['push'](_0x496d3c['shift']());}};_0x3700b8(++_0x3eab1e);}(_0x13c0,0x166));var _0x013c=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x13c0[_0x2fff83];return _0xa2a722;};'use strict';var _=require('lodash');var util=require(_0x013c('0x0'));var moment=require(_0x013c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x013c('0x2'));var db=require(_0x013c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x013c('0x4'))(_0x013c('0x5'));var config=require(_0x013c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x013c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400450,_0x3006de,_0x1d7d94){return new BPromise(function(_0x517bba,_0x11b332){return client[_0x013c('0x8')](_0x400450,_0x1d7d94)[_0x013c('0x9')](function(_0x2e1fe5){logger['info'](_0x013c('0xa'),_0x3006de,_0x013c('0xb'));logger[_0x013c('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x3006de,_0x013c('0xb'),JSON[_0x013c('0xd')](_0x2e1fe5));if(_0x2e1fe5[_0x013c('0xe')]){if(_0x2e1fe5[_0x013c('0xe')]['code']===0x1f4){logger[_0x013c('0xe')]('Setting,\x20%s,\x20%s',_0x3006de,_0x2e1fe5[_0x013c('0xe')][_0x013c('0xf')]);return _0x11b332(_0x2e1fe5[_0x013c('0xe')][_0x013c('0xf')]);}logger[_0x013c('0xe')](_0x013c('0xa'),_0x3006de,_0x2e1fe5['error'][_0x013c('0xf')]);return _0x517bba(_0x2e1fe5[_0x013c('0xe')][_0x013c('0xf')]);}else{logger['info'](_0x013c('0xa'),_0x3006de,_0x013c('0xb'));_0x517bba(_0x2e1fe5[_0x013c('0x10')][_0x013c('0xf')]);}})['catch'](function(_0x5dc24e){logger[_0x013c('0xe')](_0x013c('0xa'),_0x3006de,_0x5dc24e);_0x11b332(_0x5dc24e);});});}exports[_0x013c('0x11')]=function(_0x1d10d8){var _0x20e7b9=this;return new Promise(function(_0xe4a7b9,_0x4cd3ba){return db[_0x013c('0x12')][_0x013c('0x13')]({'raw':_0x1d10d8[_0x013c('0x14')]?_0x1d10d8['options'][_0x013c('0x15')]===undefined?!![]:![]:!![],'where':_0x1d10d8[_0x013c('0x14')]?_0x1d10d8[_0x013c('0x14')][_0x013c('0x16')]||null:null,'attributes':_0x1d10d8[_0x013c('0x14')]?_0x1d10d8['options'][_0x013c('0x17')]||null:null,'include':_0x1d10d8[_0x013c('0x14')]?_0x1d10d8[_0x013c('0x14')][_0x013c('0x18')]?_[_0x013c('0x19')](_0x1d10d8['options'][_0x013c('0x18')],function(_0x33a48f){return{'model':db[_0x33a48f[_0x013c('0x1a')]],'as':_0x33a48f['as'],'attributes':_0x33a48f[_0x013c('0x17')],'include':_0x33a48f[_0x013c('0x18')]?_[_0x013c('0x19')](_0x33a48f[_0x013c('0x18')],function(_0x97678){return{'model':db[_0x97678[_0x013c('0x1a')]],'as':_0x97678['as'],'attributes':_0x97678[_0x013c('0x17')],'include':_0x97678[_0x013c('0x18')]?_[_0x013c('0x19')](_0x97678[_0x013c('0x18')],function(_0x3226fb){return{'model':db[_0x3226fb['model']],'as':_0x3226fb['as'],'attributes':_0x3226fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x013c('0x9')](function(_0xf661bb){logger[_0x013c('0x1b')](_0x013c('0x11'),_0x1d10d8);logger[_0x013c('0xc')]('ShowSetting',_0x1d10d8,JSON['stringify'](_0xf661bb));_0xe4a7b9(_0xf661bb);})[_0x013c('0x1c')](function(_0x212699){logger['error'](_0x013c('0x11'),_0x212699['message'],_0x1d10d8);_0x4cd3ba(_0x20e7b9['error'](0x1f4,_0x212699[_0x013c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 08ea7bc..5f1cf8b 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(_0xecf14c,_0x25eb68){var _0x328c11=function(_0x5e4eae){while(--_0x5e4eae){_0xecf14c['push'](_0xecf14c['shift']());}};_0x328c11(++_0x25eb68);}(_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',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(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index dc60854..95077b3 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 _0x65c4=['skebby','connectel','clicksend','plivo','bandwidth','csc','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x65c4,0x9c));var _0x465c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x65c4[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x465c('0x0'));module[_0x465c('0x1')]={'name':{'type':Sequelize[_0x465c('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x465c('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x465c('0x2')],'defaultValue':function(){return rs[_0x465c('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x465c('0x4'),_0x465c('0x5'),_0x465c('0x6'),_0x465c('0x7'),'clickatell',_0x465c('0x8'),_0x465c('0x9'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x465c('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x465c('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x465c('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x465c('0x2')]},'accountId':{'type':Sequelize[_0x465c('0x2')]},'senderString':{'type':Sequelize[_0x465c('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x465c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x465c('0xb')],'defaultValue':function(){return _0x465c('0xc');}},'notificationSound':{'type':Sequelize[_0x465c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x465c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x465c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x465c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x465c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x465c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x465c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x465c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x465c('0xe')],'comment':_0x465c('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x465c('0xd')],'defaultValue':![],'comment':_0x465c('0x10'),'set':function(_0x572203){if(!_0x572203)this[_0x465c('0x11')](_0x465c('0x12'),null);this['setDataValue'](_0x465c('0x13'),_0x572203);}}}; \ No newline at end of file +var _0xc979=['clicksend','plivo','clickatell','bandwidth','csc','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','STRING','name','ENUM','twilio','skebby','connectel'];(function(_0x3e26bd,_0x1f46d2){var _0x3da8c0=function(_0x198e31){while(--_0x198e31){_0x3e26bd['push'](_0x3e26bd['shift']());}};_0x3da8c0(++_0x1f46d2);}(_0xc979,0x1bb));var _0x9c97=function(_0x3bce5f,_0xb551ef){_0x3bce5f=_0x3bce5f-0x0;var _0xa8c448=_0xc979[_0x3bce5f];return _0xa8c448;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9c97('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c97('0x1')],'unique':_0x9c97('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9c97('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x9c97('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x9c97('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9c97('0x1')]},'type':{'type':Sequelize[_0x9c97('0x3')](_0x9c97('0x4'),_0x9c97('0x5'),_0x9c97('0x6'),_0x9c97('0x7'),_0x9c97('0x8'),_0x9c97('0x9'),_0x9c97('0xa'),_0x9c97('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x9c97('0x1')]},'authId':{'type':Sequelize[_0x9c97('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x9c97('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9c97('0x1')]},'password':{'type':Sequelize[_0x9c97('0x1')]},'apiKey':{'type':Sequelize[_0x9c97('0x1')]},'applicationId':{'type':Sequelize[_0x9c97('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x9c97('0x1')]},'deliveryReport':{'type':Sequelize[_0x9c97('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x9c97('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9c97('0xd')],'defaultValue':function(){return _0x9c97('0xe');}},'notificationSound':{'type':Sequelize[_0x9c97('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c97('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9c97('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c97('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c97('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9c97('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c97('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9c97('0xc')],'defaultValue':![],'comment':_0x9c97('0x10'),'set':function(_0x5f5435){if(!_0x5f5435)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9c97('0x11')]('mandatoryDisposition',_0x5f5435);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0fb2ddd..aae397f 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 _0x9220=['SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName','redif','clicksend','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','intersection','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','messageId','skebby','text','connectel','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','bandwidth','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found'];(function(_0x4b3806,_0x444766){var _0x188174=function(_0x3d71ca){while(--_0x3d71ca){_0x4b3806['push'](_0x4b3806['shift']());}};_0x188174(++_0x444766);}(_0x9220,0x124));var _0x0922=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x9220[_0x35da42];return _0x370035;};'use strict';var emlformat=require(_0x0922('0x0'));var rimraf=require(_0x0922('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0922('0x2'));var moment=require(_0x0922('0x3'));var BPromise=require(_0x0922('0x4'));var Mustache=require(_0x0922('0x5'));var util=require(_0x0922('0x6'));var path=require(_0x0922('0x7'));var sox=require(_0x0922('0x8'));var csv=require(_0x0922('0x9'));var ejs=require(_0x0922('0xa'));var fs=require('fs');var fs_extra=require(_0x0922('0xb'));var _=require(_0x0922('0xc'));var squel=require(_0x0922('0xd'));var crypto=require(_0x0922('0xe'));var jsforce=require(_0x0922('0xf'));var deskjs=require(_0x0922('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0922('0x11'));var Papa=require(_0x0922('0x12'));var Redis=require('ioredis');var authService=require(_0x0922('0x13'));var qs=require(_0x0922('0x14'));var as=require(_0x0922('0x15'));var hardwareService=require(_0x0922('0x16'));var logger=require(_0x0922('0x17'))(_0x0922('0x18'));var utils=require(_0x0922('0x19'));var config=require(_0x0922('0x1a'));var licenseUtil=require(_0x0922('0x1b'));var db=require(_0x0922('0x1c'))['db'];config[_0x0922('0x1d')]=_[_0x0922('0x1e')](config['redis'],{'host':_0x0922('0x1f'),'port':0x18eb});var socket=require(_0x0922('0x20'))(new Redis(config[_0x0922('0x1d')]));require('./smsAccount.socket')[_0x0922('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0922('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x446fa8,_0x3666dc,_0x1b2ac4,_0xbbd8b){return new BPromise(function(_0x3af627,_0x375cab){var _0x1ba1a4=_0xbbd8b||client;return _0x1ba1a4[_0x0922('0x23')](_0x446fa8,_0x1b2ac4)['then'](function(_0x1b0113){logger[_0x0922('0x24')]('SmsAccount,\x20%s,\x20%s',_0x3666dc,'request\x20sent');logger[_0x0922('0x25')](_0x0922('0x26'),_0x3666dc,'request\x20sent',JSON['stringify'](_0x1b0113));if(_0x1b0113[_0x0922('0x27')]){if(_0x1b0113[_0x0922('0x27')][_0x0922('0x28')]===0x1f4){logger[_0x0922('0x27')](_0x0922('0x29'),_0x3666dc,_0x1b0113[_0x0922('0x27')][_0x0922('0x2a')]);return _0x375cab(_0x1b0113[_0x0922('0x27')]['message']);}logger[_0x0922('0x27')](_0x0922('0x29'),_0x3666dc,_0x1b0113['error'][_0x0922('0x2a')]);return _0x3af627(_0x1b0113[_0x0922('0x27')][_0x0922('0x2a')]);}else{logger[_0x0922('0x24')](_0x0922('0x29'),_0x3666dc,'request\x20sent');_0x3af627(_0x1b0113[_0x0922('0x2b')][_0x0922('0x2a')]);}})[_0x0922('0x2c')](function(_0x163d9e){logger[_0x0922('0x27')](_0x0922('0x29'),_0x3666dc,_0x163d9e);_0x375cab(_0x163d9e);});});}function respondWithStatusCode(_0x255e4d,_0x4f7bdb){_0x4f7bdb=_0x4f7bdb||0xcc;return function(_0x50d137){if(_0x50d137){return _0x255e4d[_0x0922('0x2d')](_0x4f7bdb);}return _0x255e4d['status'](_0x4f7bdb)[_0x0922('0x2e')]();};}function respondWithResult(_0x336fb7,_0x361f14){_0x361f14=_0x361f14||0xc8;return function(_0x167d16){if(_0x167d16){return _0x336fb7['status'](_0x361f14)[_0x0922('0x2f')](_0x167d16);}};}function respondWithFilteredResult(_0x47a8d4,_0x50ae98){return function(_0x5a1e95){if(_0x5a1e95){var _0x4b20a4=typeof _0x50ae98[_0x0922('0x30')]===_0x0922('0x31')&&typeof _0x50ae98[_0x0922('0x32')]===_0x0922('0x31');var _0xdc2811=_0x5a1e95['count'];var _0x5752f0=_0x4b20a4?0x0:_0x50ae98[_0x0922('0x30')];var _0x35e646=_0x4b20a4?_0x5a1e95[_0x0922('0x33')]:_0x50ae98[_0x0922('0x30')]+_0x50ae98['limit'];var _0x5b091d;if(_0x35e646>=_0xdc2811){_0x35e646=_0xdc2811;_0x5b091d=0xc8;}else{_0x5b091d=0xce;}_0x47a8d4[_0x0922('0x34')](_0x5b091d);return _0x47a8d4['set'](_0x0922('0x35'),_0x5752f0+'-'+_0x35e646+'/'+_0xdc2811)[_0x0922('0x2f')](_0x5a1e95);}return null;};}function patchUpdates(_0x280eb8){return function(_0x20f95d){try{jsonpatch[_0x0922('0x36')](_0x20f95d,_0x280eb8,!![]);}catch(_0x30ed09){return BPromise[_0x0922('0x37')](_0x30ed09);}return _0x20f95d['save']();};}function saveUpdates(_0x5847f6,_0x1b602e){return function(_0x2f3fd8){if(_0x2f3fd8){return _0x2f3fd8[_0x0922('0x38')](_0x5847f6)[_0x0922('0x39')](function(_0xfd6edd){return _0xfd6edd;});}return null;};}function removeEntity(_0x3f8302,_0x498505){return function(_0x5791ae){if(_0x5791ae){return _0x5791ae[_0x0922('0x3a')]()[_0x0922('0x39')](function(){var _0xa26003=_0x5791ae[_0x0922('0x3b')]({'plain':!![]});var _0x54ee15=_0x0922('0x3c');return db[_0x0922('0x3d')][_0x0922('0x3a')]({'where':{'type':_0x54ee15,'resourceId':_0xa26003['id']}})[_0x0922('0x39')](function(){return _0x5791ae;});})[_0x0922('0x39')](function(){_0x3f8302[_0x0922('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x233910,_0x256f5a){return function(_0x42e6ba){if(!_0x42e6ba){_0x233910[_0x0922('0x2d')](0x194);}return _0x42e6ba;};}function handleError(_0x366a41,_0x377529){_0x377529=_0x377529||0x1f4;return function(_0x3ed00b){logger[_0x0922('0x27')](_0x3ed00b['stack']);if(_0x3ed00b['name']){delete _0x3ed00b[_0x0922('0x3e')];}_0x366a41[_0x0922('0x34')](_0x377529)[_0x0922('0x3f')](_0x3ed00b);};}exports[_0x0922('0x40')]=function(_0x4074df,_0x2ab91f){var _0x5b5243={'include':[{'model':db[_0x0922('0x41')],'as':'mandatoryDispositionPause'}]},_0x53f3ff={},_0x97e649={'count':0x0,'rows':[]};var _0x5ac36d=_['map'](db[_0x0922('0x42')][_0x0922('0x43')],function(_0x5aa14c){return{'name':_0x5aa14c[_0x0922('0x44')],'type':_0x5aa14c[_0x0922('0x45')][_0x0922('0x46')]};});_0x53f3ff['model']=_[_0x0922('0x47')](_0x5ac36d,_0x0922('0x3e'));_0x53f3ff[_0x0922('0x48')]=_[_0x0922('0x49')](_0x4074df['query']);_0x53f3ff[_0x0922('0x4a')]=_['intersection'](_0x53f3ff[_0x0922('0x4b')],_0x53f3ff['query']);_0x5b5243[_0x0922('0x4c')]=_['intersection'](_0x53f3ff['model'],qs['fields'](_0x4074df['query'][_0x0922('0x4d')]));_0x5b5243['attributes']=_0x5b5243[_0x0922('0x4c')][_0x0922('0x4e')]?_0x5b5243['attributes']:_0x53f3ff[_0x0922('0x4b')];if(!_0x4074df[_0x0922('0x48')][_0x0922('0x4f')]('nolimit')){_0x5b5243[_0x0922('0x32')]=qs[_0x0922('0x32')](_0x4074df[_0x0922('0x48')][_0x0922('0x32')]);_0x5b5243[_0x0922('0x30')]=qs[_0x0922('0x30')](_0x4074df['query']['offset']);}_0x5b5243[_0x0922('0x50')]=qs[_0x0922('0x51')](_0x4074df[_0x0922('0x48')][_0x0922('0x51')]);_0x5b5243['where']=qs[_0x0922('0x4a')](_[_0x0922('0x52')](_0x4074df['query'],_0x53f3ff[_0x0922('0x4a')]),_0x5ac36d);if(_0x4074df[_0x0922('0x48')][_0x0922('0x53')]){_0x5b5243[_0x0922('0x54')]=_['merge'](_0x5b5243[_0x0922('0x54')],{'$or':_[_0x0922('0x47')](_0x5ac36d,function(_0x817f49){if(_0x817f49[_0x0922('0x45')]!==_0x0922('0x55')){var _0x149f64={};_0x149f64[_0x817f49[_0x0922('0x3e')]]={'$like':'%'+_0x4074df[_0x0922('0x48')]['filter']+'%'};return _0x149f64;}})});}_0x5b5243=_[_0x0922('0x56')]({},_0x5b5243,_0x4074df[_0x0922('0x57')]);var _0xc4744c={'where':_0x5b5243['where']};return db[_0x0922('0x42')][_0x0922('0x33')](_0xc4744c)[_0x0922('0x39')](function(_0x4061fc){_0x97e649['count']=_0x4061fc;if(_0x4074df[_0x0922('0x48')][_0x0922('0x58')]){_0x5b5243[_0x0922('0x59')]=[{'all':!![]}];}return db[_0x0922('0x42')][_0x0922('0x5a')](_0x5b5243);})[_0x0922('0x39')](function(_0x544692){_0x97e649[_0x0922('0x5b')]=_0x544692;return _0x97e649;})['then'](respondWithFilteredResult(_0x2ab91f,_0x5b5243))['catch'](handleError(_0x2ab91f,null));};exports[_0x0922('0x5c')]=function(_0x22c0b1,_0x4256c7){var _0xf356e={'raw':![],'where':{'id':_0x22c0b1[_0x0922('0x5d')]['id']},'include':[{'model':db[_0x0922('0x41')],'as':_0x0922('0x5e')}]},_0x23ea63={};_0x23ea63[_0x0922('0x4b')]=_['keys'](db[_0x0922('0x42')][_0x0922('0x43')]);_0x23ea63[_0x0922('0x48')]=_[_0x0922('0x49')](_0x22c0b1[_0x0922('0x48')]);_0x23ea63[_0x0922('0x4a')]=_[_0x0922('0x5f')](_0x23ea63[_0x0922('0x4b')],_0x23ea63[_0x0922('0x48')]);_0xf356e[_0x0922('0x4c')]=_[_0x0922('0x5f')](_0x23ea63['model'],qs[_0x0922('0x4d')](_0x22c0b1[_0x0922('0x48')]['fields']));_0xf356e['attributes']=_0xf356e[_0x0922('0x4c')]['length']?_0xf356e[_0x0922('0x4c')]:_0x23ea63[_0x0922('0x4b')];if(_0x22c0b1[_0x0922('0x48')][_0x0922('0x58')]){_0xf356e['include']=[{'all':!![]}];}_0xf356e=_[_0x0922('0x56')]({},_0xf356e,_0x22c0b1['options']);return db[_0x0922('0x42')][_0x0922('0x60')](_0xf356e)[_0x0922('0x39')](handleEntityNotFound(_0x4256c7,null))[_0x0922('0x39')](respondWithResult(_0x4256c7,null))[_0x0922('0x2c')](handleError(_0x4256c7,null));};exports[_0x0922('0x61')]=function(_0x46ff2d,_0xb6cd60){return db[_0x0922('0x42')][_0x0922('0x61')](_0x46ff2d[_0x0922('0x62')],{})['then'](function(_0x5e24d7){var _0x2858d5=_0x46ff2d[_0x0922('0x63')][_0x0922('0x3b')]({'plain':!![]});if(!_0x2858d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2858d5[_0x0922('0x64')]===_0x0922('0x63')){var _0x157cc5=_0x5e24d7['get']({'plain':!![]});var _0x3f43ad=_0x0922('0x3c');return db[_0x0922('0x65')][_0x0922('0x60')]({'where':{'name':_0x3f43ad,'userProfileId':_0x2858d5[_0x0922('0x66')]},'raw':!![]})['then'](function(_0x59ca70){if(_0x59ca70&&_0x59ca70['autoAssociation']===0x0){return db[_0x0922('0x3d')][_0x0922('0x61')]({'name':_0x157cc5[_0x0922('0x3e')],'resourceId':_0x157cc5['id'],'type':_0x59ca70['name'],'sectionId':_0x59ca70['id']},{})['then'](function(){return _0x5e24d7;});}else{return _0x5e24d7;}})['catch'](function(_0x20deb4){logger[_0x0922('0x27')](_0x0922('0x67'),_0x20deb4);throw _0x20deb4;});}return _0x5e24d7;})[_0x0922('0x39')](respondWithResult(_0xb6cd60,0xc9))[_0x0922('0x2c')](handleError(_0xb6cd60,null));};exports[_0x0922('0x38')]=function(_0x5096f4,_0x149abe){if(_0x5096f4[_0x0922('0x62')]['id']){delete _0x5096f4[_0x0922('0x62')]['id'];}return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x5096f4[_0x0922('0x5d')]['id']},'include':[{'model':db[_0x0922('0x41')],'as':_0x0922('0x5e')}]})[_0x0922('0x39')](handleEntityNotFound(_0x149abe,null))[_0x0922('0x39')](saveUpdates(_0x5096f4[_0x0922('0x62')],null))[_0x0922('0x39')](respondWithResult(_0x149abe,null))[_0x0922('0x2c')](handleError(_0x149abe,null));};exports[_0x0922('0x3a')]=function(_0x43231c,_0x112ba1){return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x43231c['params']['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x112ba1,null))['then'](removeEntity(_0x112ba1,null))[_0x0922('0x2c')](handleError(_0x112ba1,null));};exports[_0x0922('0x68')]=function(_0x5dc6b6,_0xb90f39){return db[_0x0922('0x42')][_0x0922('0x68')]()[_0x0922('0x39')](respondWithResult(_0xb90f39,null))[_0x0922('0x2c')](handleError(_0xb90f39,null));};exports[_0x0922('0x69')]=function(_0x2b1318,_0x39a6dc,_0xbc4000){if(_0x2b1318[_0x0922('0x62')]['id']){delete _0x2b1318[_0x0922('0x62')]['id'];}return db[_0x0922('0x42')]['find']({'where':{'id':_0x2b1318[_0x0922('0x5d')]['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x39a6dc,null))[_0x0922('0x39')](function(_0x3a4f4b){if(_0x3a4f4b){_0x2b1318[_0x0922('0x62')][_0x0922('0x6a')]=_0x3a4f4b['id'];return db[_0x0922('0x6b')]['create'](_0x2b1318[_0x0922('0x62')]);}})[_0x0922('0x39')](respondWithResult(_0x39a6dc,null))[_0x0922('0x2c')](handleError(_0x39a6dc,null));};exports[_0x0922('0x6c')]=function(_0x3a5ac4,_0x52d7db,_0x3dadb7){var _0x56fefc={'raw':![],'where':{}};var _0x239441={};var _0x46b8dc={'count':0x0,'rows':[]};return db[_0x0922('0x42')][_0x0922('0x6d')]({'where':{'id':_0x3a5ac4[_0x0922('0x5d')]['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x52d7db,null))[_0x0922('0x39')](function(_0x36ad7a){if(_0x36ad7a){_0x239441[_0x0922('0x4b')]=_['keys'](db[_0x0922('0x6b')][_0x0922('0x43')]);_0x239441['query']=_[_0x0922('0x49')](_0x3a5ac4[_0x0922('0x48')]);_0x239441['filters']=_[_0x0922('0x5f')](_0x239441[_0x0922('0x4b')],_0x239441['query']);_0x56fefc[_0x0922('0x4c')]=_['intersection'](_0x239441[_0x0922('0x4b')],qs[_0x0922('0x4d')](_0x3a5ac4['query'][_0x0922('0x4d')]));_0x56fefc['attributes']=_0x56fefc['attributes'][_0x0922('0x4e')]?_0x56fefc[_0x0922('0x4c')]:_0x239441['model'];if(!_0x3a5ac4[_0x0922('0x48')][_0x0922('0x4f')](_0x0922('0x6e'))){_0x56fefc[_0x0922('0x32')]=qs[_0x0922('0x32')](_0x3a5ac4[_0x0922('0x48')][_0x0922('0x32')]);_0x56fefc[_0x0922('0x30')]=qs[_0x0922('0x30')](_0x3a5ac4['query'][_0x0922('0x30')]);}_0x56fefc['order']=qs[_0x0922('0x51')](_0x3a5ac4[_0x0922('0x48')][_0x0922('0x51')]);_0x56fefc[_0x0922('0x54')]=qs[_0x0922('0x4a')](_[_0x0922('0x52')](_0x3a5ac4[_0x0922('0x48')],_0x239441[_0x0922('0x4a')]));_0x56fefc[_0x0922('0x54')][_0x0922('0x6a')]=_0x36ad7a['id'];if(_0x3a5ac4['query'][_0x0922('0x53')]){_0x56fefc['where']=_[_0x0922('0x56')](_0x56fefc[_0x0922('0x54')],{'$or':_[_0x0922('0x47')](_0x56fefc['attributes'],function(_0x1b1612){var _0x2272ba={};_0x2272ba[_0x1b1612]={'$like':'%'+_0x3a5ac4[_0x0922('0x48')][_0x0922('0x53')]+'%'};return _0x2272ba;})});}_0x56fefc=_[_0x0922('0x56')]({},_0x56fefc,_0x3a5ac4[_0x0922('0x57')]);return db['Disposition'][_0x0922('0x33')]({'where':_0x56fefc['where']})[_0x0922('0x39')](function(_0x5484ac){_0x46b8dc[_0x0922('0x33')]=_0x5484ac;if(_0x3a5ac4[_0x0922('0x48')][_0x0922('0x58')]){_0x56fefc[_0x0922('0x59')]=[{'all':!![]}];}return db[_0x0922('0x6b')][_0x0922('0x5a')](_0x56fefc);})[_0x0922('0x39')](function(_0x337df3){_0x46b8dc['rows']=_0x337df3;return _0x46b8dc;});}})[_0x0922('0x39')](respondWithFilteredResult(_0x52d7db,_0x56fefc))['catch'](handleError(_0x52d7db,null));};exports[_0x0922('0x6f')]=function(_0x4f7ab1,_0x3991e3,_0x4b3e3c){return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x4f7ab1['params']['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x3991e3,null))[_0x0922('0x39')](function(_0x3eb308){if(_0x3eb308){return _0x3eb308[_0x0922('0x6f')](_0x4f7ab1[_0x0922('0x48')]['ids']);}})[_0x0922('0x39')](respondWithStatusCode(_0x3991e3,null))['catch'](handleError(_0x3991e3,null));};exports[_0x0922('0x70')]=function(_0x4859d1,_0x2ce3d5,_0x2a9239){if(_0x4859d1[_0x0922('0x62')]['id']){delete _0x4859d1[_0x0922('0x62')]['id'];}return db[_0x0922('0x42')]['find']({'where':{'id':_0x4859d1['params']['id']}})['then'](handleEntityNotFound(_0x2ce3d5,null))[_0x0922('0x39')](function(_0x4a2625){if(_0x4a2625){_0x4859d1[_0x0922('0x62')][_0x0922('0x6a')]=_0x4a2625['id'];return db['CannedAnswer'][_0x0922('0x61')](_0x4859d1['body']);}})['then'](respondWithResult(_0x2ce3d5,null))['catch'](handleError(_0x2ce3d5,null));};exports[_0x0922('0x71')]=function(_0x72e312,_0x489378,_0x221aa9){var _0x541bad={'raw':![],'where':{}};var _0x23324e={};var _0x2659e3={'count':0x0,'rows':[]};return db[_0x0922('0x42')][_0x0922('0x6d')]({'where':{'id':_0x72e312['params']['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x489378,null))[_0x0922('0x39')](function(_0x513fa4){if(_0x513fa4){_0x23324e[_0x0922('0x4b')]=_[_0x0922('0x49')](db['CannedAnswer'][_0x0922('0x43')]);_0x23324e[_0x0922('0x48')]=_[_0x0922('0x49')](_0x72e312[_0x0922('0x48')]);_0x23324e[_0x0922('0x4a')]=_[_0x0922('0x5f')](_0x23324e[_0x0922('0x4b')],_0x23324e[_0x0922('0x48')]);_0x541bad[_0x0922('0x4c')]=_[_0x0922('0x5f')](_0x23324e[_0x0922('0x4b')],qs['fields'](_0x72e312['query'][_0x0922('0x4d')]));_0x541bad[_0x0922('0x4c')]=_0x541bad[_0x0922('0x4c')][_0x0922('0x4e')]?_0x541bad[_0x0922('0x4c')]:_0x23324e[_0x0922('0x4b')];if(!_0x72e312[_0x0922('0x48')]['hasOwnProperty'](_0x0922('0x6e'))){_0x541bad['limit']=qs[_0x0922('0x32')](_0x72e312[_0x0922('0x48')][_0x0922('0x32')]);_0x541bad[_0x0922('0x30')]=qs[_0x0922('0x30')](_0x72e312['query']['offset']);}_0x541bad['order']=qs['sort'](_0x72e312[_0x0922('0x48')]['sort']);_0x541bad[_0x0922('0x54')]=qs[_0x0922('0x4a')](_[_0x0922('0x52')](_0x72e312[_0x0922('0x48')],_0x23324e[_0x0922('0x4a')]));_0x541bad[_0x0922('0x54')][_0x0922('0x6a')]=_0x513fa4['id'];if(_0x72e312[_0x0922('0x48')][_0x0922('0x53')]){_0x541bad[_0x0922('0x54')]=_['merge'](_0x541bad[_0x0922('0x54')],{'$or':_['map'](_0x541bad[_0x0922('0x4c')],function(_0x17109d){var _0x407325={};_0x407325[_0x17109d]={'$like':'%'+_0x72e312[_0x0922('0x48')]['filter']+'%'};return _0x407325;})});}_0x541bad=_['merge']({},_0x541bad,_0x72e312['options']);return db[_0x0922('0x72')][_0x0922('0x33')]({'where':_0x541bad[_0x0922('0x54')]})['then'](function(_0x1cd2f5){_0x2659e3['count']=_0x1cd2f5;if(_0x72e312['query'][_0x0922('0x58')]){_0x541bad[_0x0922('0x59')]=[{'all':!![]}];}return db[_0x0922('0x72')][_0x0922('0x5a')](_0x541bad);})[_0x0922('0x39')](function(_0x50d9eb){_0x2659e3[_0x0922('0x5b')]=_0x50d9eb;return _0x2659e3;});}})[_0x0922('0x39')](respondWithFilteredResult(_0x489378,_0x541bad))[_0x0922('0x2c')](handleError(_0x489378,null));};exports[_0x0922('0x73')]=function(_0x3e0dbe,_0xb40727,_0x50be0b){return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x3e0dbe['params']['id']}})[_0x0922('0x39')](handleEntityNotFound(_0xb40727,null))[_0x0922('0x39')](function(_0x20a5c9){if(_0x20a5c9){return _0x20a5c9[_0x0922('0x73')](_0x3e0dbe[_0x0922('0x48')][_0x0922('0x74')]);}})[_0x0922('0x39')](respondWithStatusCode(_0xb40727,null))['catch'](handleError(_0xb40727,null));};exports[_0x0922('0x75')]=function(_0x206da7,_0x251850,_0x44e412){var _0x2ea9b7={'channel':_0x0922('0x76')};var _0x59911a=[];var _0x37341f=[];var _0x533588={};return db['SmsAccount'][_0x0922('0x60')]({'where':{'id':_0x206da7[_0x0922('0x5d')]['id']},'include':[{'model':db[_0x0922('0x77')],'as':_0x0922('0x78')}]})[_0x0922('0x39')](handleEntityNotFound(_0x251850,null))['then'](function(_0x23247c){_0x2ea9b7[_0x0922('0x79')]=_0x23247c;_0x2ea9b7[_0x0922('0x7a')]=_[_0x0922('0x7b')](_0x23247c['Applications'],[_0x0922('0x7c')],[_0x0922('0x7d')]);if(_0x2ea9b7[_0x0922('0x79')][_0x0922('0x78')]){delete _0x2ea9b7[_0x0922('0x79')][_0x0922('0x78')];}return db[_0x0922('0x7e')][_0x0922('0x68')]();})[_0x0922('0x39')](function(_0xf3d2a4){if(!_0xf3d2a4){throw new db[(_0x0922('0x7f'))]['ValidationError'](_0x0922('0x80'));}_0x59911a=_[_0x0922('0x81')](_[_0x0922('0x49')](_0xf3d2a4),[_0x0922('0x82'),_0x0922('0x83')]);_0x37341f=_[_0x0922('0x81')](_[_0x0922('0x49')](_0xf3d2a4),[_0x0922('0x82'),_0x0922('0x83'),_0x0922('0x84'),'ListId']);_0x2ea9b7[_0x0922('0x62')]={'mapKey':_0x0922('0x85')};if(_0x2ea9b7[_0x0922('0x79')]['type']){switch(_0x2ea9b7[_0x0922('0x79')][_0x0922('0x45')]){case _0x0922('0x86'):_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')]=_0x206da7[_0x0922('0x62')][_0x0922('0x88')];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')]=_0x206da7[_0x0922('0x62')][_0x0922('0x89')];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x8a')]=_0x206da7[_0x0922('0x62')]['MessageSid'];break;case _0x0922('0x8b'):_0x2ea9b7[_0x0922('0x62')]['from']='+'+_0x206da7[_0x0922('0x62')]['sender'];_0x2ea9b7['body'][_0x0922('0x62')]=_0x206da7[_0x0922('0x62')][_0x0922('0x8c')];break;case _0x0922('0x8d'):_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')]=_0x206da7[_0x0922('0x62')][_0x0922('0x87')];_0x2ea9b7[_0x0922('0x62')]['body']=_0x206da7['body']['message'];break;case'clicksend':_0x2ea9b7['body']['from']=_0x206da7[_0x0922('0x62')][_0x0922('0x87')];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')]=_0x206da7[_0x0922('0x62')]['body'];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x8a')]=_0x206da7[_0x0922('0x62')][_0x0922('0x8e')];break;case _0x0922('0x8f'):_0x2ea9b7[_0x0922('0x62')]['from']=_0x206da7[_0x0922('0x62')]['From'];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')]=_0x206da7[_0x0922('0x62')][_0x0922('0x90')];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x8a')]=_0x206da7[_0x0922('0x62')][_0x0922('0x91')];break;case'infobip':_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')]='+'+_0x206da7[_0x0922('0x62')][_0x0922('0x92')][0x0]['from'];_0x2ea9b7['body']['body']=_0x206da7[_0x0922('0x62')]['results'][0x0][_0x0922('0x8c')];_0x2ea9b7[_0x0922('0x62')]['messageId']=_0x206da7[_0x0922('0x62')]['results'][0x0][_0x0922('0x8a')];break;case _0x0922('0x93'):_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')]=_0x206da7[_0x0922('0x62')][_0x0922('0x94')];_0x2ea9b7[_0x0922('0x62')]['body']=_0x206da7['body']['segmentedMessage'][_0x0922('0x2a')];break;case _0x0922('0x95'):_0x2ea9b7[_0x0922('0x62')]['from']=_0x206da7[_0x0922('0x62')][_0x0922('0x96')];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')]=_0x206da7['body'][_0x0922('0x8c')];_0x2ea9b7[_0x0922('0x62')]['messageId']=_0x206da7[_0x0922('0x62')]['replyMessageId'];break;case _0x0922('0x97'):_0x2ea9b7['body'][_0x0922('0x8a')]=_0x206da7[_0x0922('0x62')][0x0][_0x0922('0x2a')]['id'];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')]=_0x206da7[_0x0922('0x62')][0x0][_0x0922('0x2a')][_0x0922('0x87')];_0x2ea9b7['body'][_0x0922('0x62')]=_0x206da7[_0x0922('0x62')][0x0][_0x0922('0x2a')][_0x0922('0x8c')];break;case _0x0922('0x98'):_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')]=_0x206da7[_0x0922('0x62')]['from'];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')]=_0x206da7[_0x0922('0x62')][_0x0922('0x2a')];_0x2ea9b7[_0x0922('0x62')][_0x0922('0x8a')]=_0x206da7['body']['refid'];break;}}if(_0x2ea9b7[_0x0922('0x62')]['id']){delete _0x2ea9b7[_0x0922('0x62')]['id'];}if(_[_0x0922('0x99')](_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')])){throw new db[(_0x0922('0x7f'))][(_0x0922('0x9a'))](_0x0922('0x9b'));}if(_[_0x0922('0x99')](_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')])||_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')]===''){throw new db[(_0x0922('0x7f'))][(_0x0922('0x9a'))](_0x0922('0x9c'));}if(_[_0x0922('0x99')](_0x2ea9b7[_0x0922('0x62')][_0x0922('0x9d')])){throw new db[(_0x0922('0x7f'))][(_0x0922('0x9a'))](_0x0922('0x9e')+_0x37341f);}if(!_['includes'](_0x37341f,_0x2ea9b7[_0x0922('0x62')][_0x0922('0x9d')])){throw new db['Sequelize'][(_0x0922('0x9a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37341f);}_0x533588[_0x2ea9b7[_0x0922('0x62')][_0x0922('0x9d')]]=_0x2ea9b7['body']['from'];return db[_0x0922('0x9f')][_0x0922('0x60')]({'where':{'id':_0x2ea9b7['account'][_0x0922('0xa0')]},'include':[{'model':db[_0x0922('0x7e')],'as':_0x0922('0xa1'),'where':_0x533588,'limit':0x1,'order':[[_0x0922('0x83'),_0x0922('0xa2')]]}]});})[_0x0922('0x39')](handleEntityNotFound(_0x251850,null))[_0x0922('0x39')](function(_0x7ca63){if(_0x7ca63){_0x2ea9b7[_0x0922('0xa3')]=_[_0x0922('0xa4')](_0x7ca63,['Contacts']);if(_0x7ca63[_0x0922('0xa1')]['length']){return _0x7ca63[_0x0922('0xa1')][0x0];}var _0x2493e2=_[_0x0922('0x1e')](_0x2ea9b7[_0x0922('0x62')],{'firstName':_0x2ea9b7[_0x0922('0x62')]['from'],'ListId':_0x7ca63['id']});_0x2493e2[_0x2ea9b7[_0x0922('0x62')][_0x0922('0x9d')]]=_0x2ea9b7['body']['from'];return db['CmContact']['create'](_0x2493e2,{'fields':_0x59911a,'raw':!![]});}})['then'](handleEntityNotFound(_0x251850,null))[_0x0922('0x39')](function(_0x1e5792){if(_0x1e5792){_0x2ea9b7[_0x0922('0xa5')]=_0x1e5792;var _0x1eccff={'ContactId':_0x1e5792['id'],'phone':_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')],'SmsAccountId':_0x206da7[_0x0922('0x5d')]['id']};var _0x309e3c={'ContactId':_0x1e5792['id'],'SmsAccountId':_0x206da7['params']['id'],'closed':![]};return db['SmsInteraction'][_0x0922('0x60')]({'where':_0x309e3c})['then'](function(_0x48f646){if(_0x48f646){return[_0x48f646,![]];}return db[_0x0922('0xa6')][_0x0922('0x61')](_0x1eccff)[_0x0922('0x39')](function(_0x51b80b){return[_0x51b80b,!![]];});});}})[_0x0922('0xa7')](function(_0x52e671,_0x45d8bb){_0x2ea9b7[_0x0922('0xa8')]=_0x52e671[_0x0922('0x3b')]({'plain':!![]});_0x2ea9b7[_0x0922('0xa8')]['created']=![];if(_0x45d8bb){if(_0x2ea9b7[_0x0922('0x79')][_0x0922('0xa9')]){_0x2ea9b7['applications'][_0x0922('0xaa')]({'id':0x0,'priority':_0x2ea9b7[_0x0922('0x7a')][_0x0922('0x4e')]+0x1,'app':_0x0922('0xab'),'appdata':_0x0922('0xac'),'interval':_0x0922('0xad')});}_0x2ea9b7[_0x0922('0xa8')][_0x0922('0xae')]=!![];}return db[_0x0922('0xaf')][_0x0922('0x61')]({'phone':_0x2ea9b7[_0x0922('0x62')][_0x0922('0x87')],'messageId':_0x2ea9b7[_0x0922('0x62')][_0x0922('0x8a')],'body':_0x2ea9b7[_0x0922('0x62')][_0x0922('0x62')],'SmsAccountId':_0x206da7['params']['id'],'SmsInteractionId':_0x52e671['id'],'direction':'in','ContactId':_0x52e671['ContactId'],'AttachmentId':_0x2ea9b7[_0x0922('0x62')][_0x0922('0xb0')]});})['then'](function(_0x5f50c1){_0x2ea9b7['message']=_0x5f50c1;if(!_0x2ea9b7[_0x0922('0xa8')]['UserId'])return;return db['User']['find']({'attributes':['id',_0x0922('0x3e')],'where':{'id':_0x2ea9b7[_0x0922('0xa8')][_0x0922('0xb1')]}});})['then'](function(_0x480f4){if(_0x480f4){_0x2ea9b7[_0x0922('0x7a')][_0x0922('0xb2')]({'id':0x0,'priority':0x0,'app':_0x0922('0xb3'),'appdata':_0x480f4['name']+','+(_0x2ea9b7[_0x0922('0x79')][_0x0922('0xb4')]||0xa),'interval':'*,*,*,*'});}if(!_0x2ea9b7['interaction'][_0x0922('0xb5')])return;return db['SmsQueue'][_0x0922('0x60')]({'attributes':['id','name'],'where':{'id':_0x2ea9b7[_0x0922('0xa8')]['queueId']}});})[_0x0922('0x39')](function(_0x260e70){if(_0x260e70){_0x2ea9b7[_0x0922('0x7a')][_0x0922('0xb2')]({'id':0x0,'priority':0x1,'app':_0x0922('0xb6'),'appdata':_0x260e70[_0x0922('0x3e')]+','+(_0x2ea9b7[_0x0922('0x79')][_0x0922('0xb7')]||0x12c),'interval':_0x0922('0xad')});}return respondWithRpcPromise(_0x0922('0xb8'),_0x0922('0xb9'),_0x2ea9b7);})[_0x0922('0x39')](function(_0x4e03b9){if(_0x4e03b9){var _0x162c87=0xc8;var _0x44bd9a=_0x0922('0xba');logger[_0x0922('0x24')](_0x0922('0x26'),_0x44bd9a,_0x162c87,_0x0922('0xbb'));logger['debug'](_0x0922('0xbc'),_0x44bd9a,_0x162c87,_0x0922('0xbb'),JSON['stringify'](_0x4e03b9));if(_0x2ea9b7['account'][_0x0922('0x45')]===_0x0922('0x86')){return _0x251850[_0x0922('0x34')](_0x162c87)[_0x0922('0xbd')](_0x0922('0xbe'),_0x0922('0xbf'))[_0x0922('0x3f')](_0x0922('0xc0'));}else{return _0x251850[_0x0922('0x34')](_0x162c87)[_0x0922('0x2f')](_0x4e03b9);}}})[_0x0922('0x2c')](handleError(_0x251850,null));};exports['addApplications']=function(_0x34463a,_0x136046){var _0x79212c=_0x34463a[_0x0922('0x5d')]['id'];var _0x336b9e=_0x34463a[_0x0922('0x62')];var _0x48bbfc=0xc8;var _0x2dd921=null;return db[_0x0922('0xc1')]['transaction']({'isolationLevel':db[_0x0922('0xc1')][_0x0922('0xc2')][_0x0922('0xc3')][_0x0922('0xc4')]},function(_0x435a5b){return db['SmsAccount']['findOne']({'where':{'id':_0x79212c},'transaction':_0x435a5b})[_0x0922('0x39')](function(_0x16bdc2){if(_0x16bdc2){return db[_0x0922('0x77')][_0x0922('0x3a')]({'where':{'SmsAccountId':_0x79212c},'transaction':_0x435a5b})[_0x0922('0x39')](function(){var _0x57811f=_[_0x0922('0x47')](_0x336b9e,function(_0x419072){_0x419072[_0x0922('0x6a')]=_0x79212c;return _0x419072;});return db[_0x0922('0x77')]['bulkCreate'](_0x57811f,{'transaction':_0x435a5b});});}else{_0x48bbfc=0x194;_0x2dd921=[];}});})[_0x0922('0x39')](function(){if(_0x48bbfc!==0x194){return db['SmsApplication'][_0x0922('0xc5')]({'where':{'SmsAccountId':_0x79212c},'order':_0x0922('0x7c')})[_0x0922('0x39')](function(_0x48db43){_0x2dd921=_0x48db43;});}})['catch'](function(_0x184728){_0x48bbfc=0x1f4;logger[_0x0922('0x27')](_0x184728[_0x0922('0xc6')]);if(_0x184728[_0x0922('0x3e')]){delete _0x184728[_0x0922('0x3e')];}_0x2dd921=_0x184728;})[_0x0922('0xc7')](function(){if(_0x2dd921===null){_0x136046['sendStatus'](_0x48bbfc);}else{if(_0x48bbfc===0x1f4){_0x136046[_0x0922('0x34')](_0x48bbfc)[_0x0922('0x3f')](_0x2dd921);}else{_0x136046[_0x0922('0x34')](_0x48bbfc)['json'](_0x2dd921);}}});};exports[_0x0922('0xc8')]=function(_0x561d9b,_0x543836,_0x491900){var _0x1eedc0={};var _0x1853f4={};var _0xed30aa;var _0x54b892;return db['SmsAccount'][_0x0922('0x6d')]({'where':{'id':_0x561d9b[_0x0922('0x5d')]['id']}})['then'](handleEntityNotFound(_0x543836,null))[_0x0922('0x39')](function(_0x6bd4f5){if(_0x6bd4f5){_0xed30aa=_0x6bd4f5;_0x1853f4[_0x0922('0x4b')]=_[_0x0922('0x49')](db[_0x0922('0x77')][_0x0922('0x43')]);_0x1853f4[_0x0922('0x48')]=_[_0x0922('0x49')](_0x561d9b[_0x0922('0x48')]);_0x1853f4['filters']=_['intersection'](_0x1853f4['model'],_0x1853f4['query']);_0x1eedc0[_0x0922('0x4c')]=_[_0x0922('0x5f')](_0x1853f4[_0x0922('0x4b')],qs[_0x0922('0x4d')](_0x561d9b[_0x0922('0x48')][_0x0922('0x4d')]));_0x1eedc0[_0x0922('0x4c')]=_0x1eedc0[_0x0922('0x4c')]['length']?_0x1eedc0['attributes']:_0x1853f4[_0x0922('0x4b')];_0x1eedc0[_0x0922('0x50')]=qs[_0x0922('0x51')](_0x561d9b[_0x0922('0x48')][_0x0922('0x51')]);_0x1eedc0[_0x0922('0x54')]=qs[_0x0922('0x4a')](_[_0x0922('0x52')](_0x561d9b[_0x0922('0x48')],_0x1853f4['filters']));if(_0x561d9b[_0x0922('0x48')][_0x0922('0x53')]){_0x1eedc0[_0x0922('0x54')]=_[_0x0922('0x56')](_0x1eedc0[_0x0922('0x54')],{'$or':_['map'](_0x1eedc0[_0x0922('0x4c')],function(_0x33f1bd){var _0x156040={};_0x156040[_0x33f1bd]={'$like':'%'+_0x561d9b[_0x0922('0x48')][_0x0922('0x53')]+'%'};return _0x156040;})});}_0x1eedc0=_[_0x0922('0x56')]({},_0x1eedc0,_0x561d9b[_0x0922('0x57')]);return _0xed30aa[_0x0922('0xc8')](_0x1eedc0);}})[_0x0922('0x39')](function(_0x536a91){if(_0x536a91){_0x54b892=_0x536a91[_0x0922('0x4e')];if(!_0x561d9b['query'][_0x0922('0x4f')](_0x0922('0x6e'))){_0x1eedc0['limit']=qs['limit'](_0x561d9b[_0x0922('0x48')]['limit']);_0x1eedc0[_0x0922('0x30')]=qs[_0x0922('0x30')](_0x561d9b[_0x0922('0x48')][_0x0922('0x30')]);}return _0xed30aa['getApplications'](_0x1eedc0);}})[_0x0922('0x39')](function(_0x1cf11f){if(_0x1cf11f){return _0x1cf11f?{'count':_0x54b892,'rows':_0x1cf11f}:null;}})['then'](respondWithResult(_0x543836,null))['catch'](handleError(_0x543836,null));};exports['getInteractions']=function(_0x461387,_0x233cc2,_0x7f355a){var _0x4e2c5c={'raw':![],'where':{}};var _0x366a7b={};var _0x36f2e5={'count':0x0,'rows':[]};return db[_0x0922('0x42')][_0x0922('0x6d')]({'where':{'id':_0x461387[_0x0922('0x5d')]['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x233cc2,null))[_0x0922('0x39')](function(_0x5be180){if(_0x5be180){_0x366a7b[_0x0922('0x4b')]=_['keys'](db[_0x0922('0xa6')][_0x0922('0x43')]);_0x366a7b[_0x0922('0x48')]=_[_0x0922('0x49')](_0x461387[_0x0922('0x48')]);_0x366a7b[_0x0922('0x4a')]=_[_0x0922('0x5f')](_0x366a7b['model'],_0x366a7b['query']);_0x4e2c5c[_0x0922('0x4c')]=_[_0x0922('0x5f')](_0x366a7b[_0x0922('0x4b')],qs[_0x0922('0x4d')](_0x461387[_0x0922('0x48')][_0x0922('0x4d')]));_0x4e2c5c[_0x0922('0x4c')]=_0x4e2c5c[_0x0922('0x4c')][_0x0922('0x4e')]?_0x4e2c5c['attributes']:_0x366a7b[_0x0922('0x4b')];if(!_0x461387['query']['hasOwnProperty']('nolimit')){_0x4e2c5c[_0x0922('0x32')]=qs['limit'](_0x461387[_0x0922('0x48')]['limit']);_0x4e2c5c[_0x0922('0x30')]=qs[_0x0922('0x30')](_0x461387[_0x0922('0x48')][_0x0922('0x30')]);}_0x4e2c5c[_0x0922('0x50')]=qs[_0x0922('0x51')](_0x461387[_0x0922('0x48')]['sort']);_0x4e2c5c['where']=qs['filters'](_[_0x0922('0x52')](_0x461387['query'],_0x366a7b[_0x0922('0x4a')]));_0x4e2c5c[_0x0922('0x54')][_0x0922('0x6a')]=_0x5be180['id'];if(_0x461387[_0x0922('0x48')]['filter']){_0x4e2c5c['where']=_[_0x0922('0x56')](_0x4e2c5c[_0x0922('0x54')],{'$or':_[_0x0922('0x47')](_0x4e2c5c['attributes'],function(_0x367d0b){var _0x4ed7ed={};_0x4ed7ed[_0x367d0b]={'$like':'%'+_0x461387[_0x0922('0x48')][_0x0922('0x53')]+'%'};return _0x4ed7ed;})});}_0x4e2c5c=_['merge']({},_0x4e2c5c,_0x461387[_0x0922('0x57')]);return db[_0x0922('0xa6')][_0x0922('0x33')]({'where':_0x4e2c5c[_0x0922('0x54')]})[_0x0922('0x39')](function(_0x441e59){_0x36f2e5['count']=_0x441e59;if(_0x461387['query'][_0x0922('0x58')]){_0x4e2c5c[_0x0922('0x59')]=[{'model':db[_0x0922('0x7e')],'as':_0x0922('0xc9'),'required':![]},{'model':db['User'],'as':_0x0922('0xca'),'attributes':[_0x0922('0x3e'),_0x0922('0xcb'),'internal'],'required':![]},{'model':db[_0x0922('0xcc')],'as':_0x0922('0xcd'),'attributes':['id',_0x0922('0x3e'),_0x0922('0xce')],'where':_0x461387[_0x0922('0x48')][_0x0922('0xcf')]?{'id':_0x461387['query']['tag']}:undefined,'required':_0x461387[_0x0922('0x48')][_0x0922('0xcf')]?!![]:![]}];}return db[_0x0922('0xa6')][_0x0922('0x5a')](_0x4e2c5c);})[_0x0922('0x39')](function(_0x5d8dba){_0x36f2e5['rows']=_0x5d8dba;return _0x36f2e5;});}})[_0x0922('0x39')](respondWithFilteredResult(_0x233cc2,_0x4e2c5c))[_0x0922('0x2c')](handleError(_0x233cc2,null));};exports['send']=function(_0x5d5900,_0x631fbf,_0x32ac64){var _0x535b11,_0x27e907,_0x48c6c7;if(_[_0x0922('0x99')](_0x5d5900['body'][_0x0922('0x62')])||_0x5d5900[_0x0922('0x62')][_0x0922('0x62')]===''){throw new db[(_0x0922('0x7f'))]['ValidationError'](_0x0922('0x9c'));}if(_[_0x0922('0x99')](_0x5d5900[_0x0922('0x62')]['to'])){throw new db[(_0x0922('0x7f'))][(_0x0922('0x9a'))](_0x0922('0xd0'));}_0x535b11=_0x5d5900[_0x0922('0x62')]['to'];return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x5d5900[_0x0922('0x5d')]['id']},'include':[{'model':db[_0x0922('0x9f')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x535b11},'limit':0x1,'order':[[_0x0922('0x83'),_0x0922('0xa2')]]}]}]})[_0x0922('0x39')](handleEntityNotFound(_0x631fbf,null))[_0x0922('0x39')](function(_0x14bd2f){if(_0x14bd2f&&_0x14bd2f[_0x0922('0xd1')]){_0x27e907=_0x14bd2f[_0x0922('0x3b')]({'plain':!![]});if(_0x27e907[_0x0922('0xd1')]&&_0x27e907[_0x0922('0xd1')][_0x0922('0xa1')]['length']){return _0x27e907[_0x0922('0xd1')][_0x0922('0xa1')][0x0];}return db['CmContact'][_0x0922('0x61')](_['defaults'](_0x5d5900[_0x0922('0x62')],{'firstName':_0x535b11,'mobile':_0x535b11,'phone':_0x535b11,'ListId':_0x27e907['ListId']}));}})[_0x0922('0x39')](handleEntityNotFound(_0x631fbf,null))[_0x0922('0x39')](function(_0x371c35){if(_0x371c35){_0x48c6c7=_0x371c35;return db['SmsInteraction'][_0x0922('0x60')]({'where':{'ContactId':_0x48c6c7['id'],'closed':![],'SmsAccountId':_0x27e907['id']}})[_0x0922('0x39')](function(_0x3681cb){if(_0x3681cb){return[_0x3681cb,![]];}return db[_0x0922('0xa6')]['create']({'UserId':_0x5d5900['user']['id'],'ContactId':_0x48c6c7['id'],'SmsAccountId':_0x27e907['id'],'phone':_0x535b11,'firstMsgDirection':_0x0922('0xd2'),'Messages':[_[_0x0922('0x56')](_0x5d5900[_0x0922('0x62')],{'read':![],'body':_0x5d5900[_0x0922('0x62')][_0x0922('0x62')],'phone':_0x535b11,'SmsAccountId':_0x27e907['id'],'UserId':_0x5d5900[_0x0922('0x63')]['id'],'ContactId':_0x48c6c7['id']})]},{'include':[{'model':db[_0x0922('0xaf')],'as':_0x0922('0xd3')}]})[_0x0922('0x39')](function(_0x498ea7){return[_0x498ea7,!![]];});});}})[_0x0922('0xa7')](function(_0x3c0a88,_0x25c681){if(_0x25c681){return _0x3c0a88;}return db['SmsMessage'][_0x0922('0x61')](_[_0x0922('0x56')](_0x5d5900['body'],{'read':![],'body':_0x5d5900[_0x0922('0x62')][_0x0922('0x62')],'phone':_0x535b11,'SmsAccountId':_0x27e907['id'],'SmsInteractionId':_0x3c0a88['id'],'UserId':_0x5d5900[_0x0922('0x63')]['id'],'ContactId':_0x48c6c7['id']}))[_0x0922('0x39')](function(_0x990076){_0x3c0a88[_0x0922('0xd4')][_0x0922('0xd3')]=[];_0x3c0a88[_0x0922('0xd4')]['Messages'][_0x0922('0xaa')](_0x990076[_0x0922('0xd4')]);return _0x3c0a88;});})[_0x0922('0x39')](respondWithResult(_0x631fbf,null))[_0x0922('0x2c')](handleError(_0x631fbf,null));};exports[_0x0922('0x34')]=function(_0x21b7f4,_0x4f3038,_0x572741){if(_0x21b7f4[_0x0922('0x62')]['id']){delete _0x21b7f4[_0x0922('0x62')]['id'];}var _0x3873fa,_0x5ce19f,_0x3b1368;return db[_0x0922('0x42')]['find']({'where':{'id':_0x21b7f4[_0x0922('0x5d')]['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x4f3038,null))[_0x0922('0x39')](function(_0x5207f9){if(_0x5207f9){_0x3b1368=_0x5207f9;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0922('0x34'),'received\x20delivery\x20report\x20from',_0x5207f9[_0x0922('0x45')],util[_0x0922('0xd5')](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));switch(_0x5207f9[_0x0922('0x45')]){case _0x0922('0x8b'):if(_0x21b7f4['body'][_0x0922('0xd6')]&&_0x21b7f4[_0x0922('0x62')]['status']){_0x5ce19f=_0x21b7f4[_0x0922('0x62')][_0x0922('0x34')];return db['SmsMessage'][_0x0922('0x60')]({'where':{'messageId':_0x21b7f4[_0x0922('0x62')][_0x0922('0xd6')]}});}break;case _0x0922('0x8d'):if(_0x21b7f4[_0x0922('0x62')]['requestid']&&_0x21b7f4[_0x0922('0x62')][_0x0922('0xd7')]){_0x5ce19f=_0x21b7f4[_0x0922('0x62')]['statusInt'];return db[_0x0922('0xaf')][_0x0922('0x60')]({'where':{'messageId':_0x21b7f4['body'][_0x0922('0xd8')]}});}break;case'clicksend':if(_0x21b7f4[_0x0922('0x62')]['message_id']&&_0x21b7f4['body'][_0x0922('0xd9')]){_0x5ce19f=_0x21b7f4[_0x0922('0x62')][_0x0922('0xd9')];return db[_0x0922('0xaf')][_0x0922('0x60')]({'where':{'messageId':_0x21b7f4['body'][_0x0922('0x8e')]}});}break;case _0x0922('0xda'):var _0xbcf60=_0x21b7f4[_0x0922('0x62')]['results'][0x0];if(_0xbcf60['messageId']&&_0xbcf60[_0x0922('0x34')][_0x0922('0xdb')]==='DELIVERED'){_0x5ce19f=_0xbcf60[_0x0922('0x34')][_0x0922('0xdb')];return db['SmsMessage'][_0x0922('0x60')]({'where':{'messageId':_0xbcf60['messageId']}});}break;case _0x0922('0x95'):if(_0x21b7f4[_0x0922('0x62')][_0x0922('0x8a')]&&_0x21b7f4[_0x0922('0x62')][_0x0922('0x34')]){_0x5ce19f=_0x21b7f4[_0x0922('0x62')]['status'];return db[_0x0922('0xaf')][_0x0922('0x60')]({'where':{'messageId':_0x21b7f4[_0x0922('0x62')][_0x0922('0x8a')]}});}break;case _0x0922('0x97'):if(_0x21b7f4[_0x0922('0x62')][0x0][_0x0922('0x2a')]['id']){_0x5ce19f=_0x21b7f4[_0x0922('0x62')][0x0][_0x0922('0x45')];return db['SmsMessage'][_0x0922('0x60')]({'where':{'messageId':_0x21b7f4['body'][0x0][_0x0922('0x2a')]['id']}});}break;case _0x0922('0x98'):if(_0x21b7f4[_0x0922('0x62')]['redif']&&_0x21b7f4[_0x0922('0x62')][_0x0922('0x34')]){_0x5ce19f=_0x21b7f4['body']['status'];return db[_0x0922('0xaf')]['find']({'where':{'messageId':_0x21b7f4[_0x0922('0x62')][_0x0922('0xdc')]}});}break;}}})[_0x0922('0x39')](handleEntityNotFound(_0x4f3038,null))[_0x0922('0x39')](function(_0x4e451a){if(_0x4e451a){_0x3873fa=_0x4e451a;switch(_0x3b1368[_0x0922('0x45')]){case _0x0922('0x8b'):if(_0x5ce19f==='DELIVERED'){return _0x3873fa[_0x0922('0x38')]({'read':!![]});}else{logger[_0x0922('0x27')](_0x0922('0x26'),_0x0922('0x34'),_0x0922('0x8b'),util[_0x0922('0xd5')](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;case _0x0922('0x8d'):if(_0x5ce19f==='1'){return _0x3873fa[_0x0922('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0922('0x8b'),util[_0x0922('0xd5')](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;case _0x0922('0xdd'):if(!_0x21b7f4[_0x0922('0x62')][_0x0922('0xde')]&&_0x5ce19f>=0xc8&&_0x5ce19f<=0xce){return _0x3873fa[_0x0922('0x38')]({'read':!![]});}else{logger[_0x0922('0x27')](_0x0922('0x26'),'status',_0x0922('0xdd'),util[_0x0922('0xd5')](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;case _0x0922('0xda'):var _0x287eda=_0x21b7f4[_0x0922('0x62')]['results'][0x0];if(_0x287eda[_0x0922('0x34')][_0x0922('0xdb')]===_0x0922('0xdf')){return _0x3873fa['update']({'read':!![]});}else{logger[_0x0922('0x27')](_0x0922('0x26'),_0x0922('0x34'),'infobip',util['inspect'](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;case _0x0922('0x95'):if(_0x5ce19f==_0x0922('0xe0')||_0x5ce19f==_0x0922('0xe1')){return _0x3873fa['update']({'read':!![]});}else{logger[_0x0922('0x27')](_0x0922('0x26'),'status',_0x0922('0x95'),util['inspect'](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;case _0x0922('0x97'):if(_0x5ce19f==_0x0922('0xe2')){return _0x3873fa[_0x0922('0x38')]({'read':!![]});}else{logger['error'](_0x0922('0x26'),_0x0922('0x34'),_0x0922('0x97'),util[_0x0922('0xd5')](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;case _0x0922('0x98'):if(_0x5ce19f===_0x0922('0xe3')||_0x5ce19f===_0x0922('0xe4')){return _0x3873fa[_0x0922('0x38')]({'read':!![]});}else{logger[_0x0922('0x27')](_0x0922('0x26'),_0x0922('0x34'),_0x0922('0x98'),util[_0x0922('0xd5')](_0x21b7f4[_0x0922('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x3873fa;}})[_0x0922('0x39')](respondWithResult(_0x4f3038,null))[_0x0922('0x2c')](handleError(_0x4f3038,null));};exports[_0x0922('0xe5')]=function(_0x476014,_0x4341c6,_0x31179f){var _0x357fdc,_0xa7593b,_0x197a22;return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x476014[_0x0922('0x5d')]['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x4341c6,null))['then'](function(_0x350c09){if(_0x350c09){_0x197a22=_0x350c09;logger[_0x0922('0x25')](_0x0922('0x26'),_0x0922('0x34'),'received\x20delivery\x20report\x20from',_0x350c09[_0x0922('0x45')],util[_0x0922('0xd5')](_0x476014['query'],{'showHidden':![],'depth':null}));switch(_0x350c09[_0x0922('0x45')]){case _0x0922('0x93'):if(_0x476014[_0x0922('0x48')][_0x0922('0xe6')]&&_0x476014[_0x0922('0x48')][_0x0922('0xe7')]){_0xa7593b=_0x476014[_0x0922('0x48')][_0x0922('0xe7')];return db[_0x0922('0xaf')][_0x0922('0x60')]({'where':{'messageId':_0x476014[_0x0922('0x48')][_0x0922('0xe6')]}});}break;}}})[_0x0922('0x39')](handleEntityNotFound(_0x4341c6,null))[_0x0922('0x39')](function(_0x5010cb){if(_0x5010cb){_0x357fdc=_0x5010cb;switch(_0x197a22['type']){case _0x0922('0x93'):if(_0xa7593b==='2'||_0xa7593b==='6'){return _0x357fdc[_0x0922('0x38')]({'read':!![]});}else{logger[_0x0922('0x27')](_0x0922('0x26'),_0x0922('0x34'),_0x0922('0x93'),util[_0x0922('0xd5')](_0x476014['query'],{'showHidden':![],'depth':null}));};break;}return _0x357fdc;}})['then'](respondWithResult(_0x4341c6,null))[_0x0922('0x2c')](handleError(_0x4341c6,null));};exports['addAgents']=function(_0x58c43f,_0x4fb818,_0x217cba){return db['SmsAccount']['find']({'where':{'id':_0x58c43f[_0x0922('0x5d')]['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x4fb818,null))[_0x0922('0x39')](function(_0x50fd96){if(_0x50fd96){return _0x50fd96[_0x0922('0xe8')](_0x58c43f[_0x0922('0x62')]['ids'],_[_0x0922('0xa4')](_0x58c43f[_0x0922('0x62')],[_0x0922('0x74'),'id'])||{})[_0x0922('0xa7')](function(_0x5e531c){for(var _0x2e8ede=0x0;_0x2e8ede<_0x58c43f[_0x0922('0x62')]['ids'][_0x0922('0x4e')];_0x2e8ede+=0x1){socket[_0x0922('0xe9')](_0x0922('0xea'),{'UserId':Number(_0x58c43f[_0x0922('0x62')][_0x0922('0x74')][_0x2e8ede]),'SmsAccountId':Number(_0x58c43f['params']['id'])});}return _0x5e531c;});}})[_0x0922('0x39')](respondWithResult(_0x4fb818,null))[_0x0922('0x2c')](handleError(_0x4fb818,null));};exports[_0x0922('0xeb')]=function(_0x5059fd,_0x5e32a9,_0xec7712){return db[_0x0922('0x42')][_0x0922('0x60')]({'where':{'id':_0x5059fd['params']['id']}})['then'](handleEntityNotFound(_0x5e32a9,null))[_0x0922('0x39')](function(_0x1aeabe){if(_0x1aeabe){return _0x1aeabe[_0x0922('0xeb')](_0x5059fd[_0x0922('0x48')][_0x0922('0x74')])[_0x0922('0x39')](function(){if(_[_0x0922('0xec')](_0x5059fd[_0x0922('0x48')][_0x0922('0x74')])){for(var _0x19ed64=0x0;_0x19ed64<_0x5059fd[_0x0922('0x48')][_0x0922('0x74')][_0x0922('0x4e')];_0x19ed64+=0x1){socket[_0x0922('0xe9')]('userSmsAccount:remove',{'UserId':Number(_0x5059fd['query'][_0x0922('0x74')][_0x19ed64]),'SmsAccountId':Number(_0x5059fd['params']['id'])});}}else{socket[_0x0922('0xe9')](_0x0922('0xed'),{'UserId':Number(_0x5059fd[_0x0922('0x48')][_0x0922('0x74')]),'SmsAccountId':Number(_0x5059fd[_0x0922('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e32a9,null))[_0x0922('0x2c')](handleError(_0x5e32a9,null));};exports[_0x0922('0xee')]=function(_0x13f793,_0x324190,_0x39f463){var _0x4c2677={};var _0x4cccc8={};var _0x20dadd;var _0x3a807b;return db[_0x0922('0x42')][_0x0922('0x6d')]({'where':{'id':_0x13f793['params']['id']}})[_0x0922('0x39')](handleEntityNotFound(_0x324190,null))[_0x0922('0x39')](function(_0x3ce505){if(_0x3ce505){_0x20dadd=_0x3ce505;_0x4cccc8[_0x0922('0x4b')]=_[_0x0922('0x49')](db[_0x0922('0xef')][_0x0922('0x43')]);_0x4cccc8['query']=_[_0x0922('0x49')](_0x13f793[_0x0922('0x48')]);_0x4cccc8['filters']=_[_0x0922('0x5f')](_0x4cccc8[_0x0922('0x4b')],_0x4cccc8[_0x0922('0x48')]);_0x4c2677['attributes']=_[_0x0922('0x5f')](_0x4cccc8['model'],qs[_0x0922('0x4d')](_0x13f793[_0x0922('0x48')][_0x0922('0x4d')]));_0x4c2677[_0x0922('0x4c')]=_0x4c2677[_0x0922('0x4c')]['length']?_0x4c2677[_0x0922('0x4c')]:_0x4cccc8[_0x0922('0x4b')];_0x4c2677['order']=qs[_0x0922('0x51')](_0x13f793[_0x0922('0x48')]['sort']);_0x4c2677['where']=qs[_0x0922('0x4a')](_['pick'](_0x13f793[_0x0922('0x48')],_0x4cccc8[_0x0922('0x4a')]));if(_0x13f793[_0x0922('0x48')]['filter']){_0x4c2677[_0x0922('0x54')]=_[_0x0922('0x56')](_0x4c2677[_0x0922('0x54')],{'$or':_[_0x0922('0x47')](_0x4c2677['attributes'],function(_0xa63baf){var _0x5667ba={};_0x5667ba[_0xa63baf]={'$like':'%'+_0x13f793[_0x0922('0x48')][_0x0922('0x53')]+'%'};return _0x5667ba;})});}_0x4c2677=_[_0x0922('0x56')]({},_0x4c2677,_0x13f793[_0x0922('0x57')]);return _0x20dadd[_0x0922('0xee')](_0x4c2677);}})[_0x0922('0x39')](function(_0x3d28cf){if(_0x3d28cf){_0x3a807b=_0x3d28cf[_0x0922('0x4e')];if(!_0x13f793['query'][_0x0922('0x4f')]('nolimit')){_0x4c2677['limit']=qs['limit'](_0x13f793[_0x0922('0x48')][_0x0922('0x32')]);_0x4c2677['offset']=qs[_0x0922('0x30')](_0x13f793[_0x0922('0x48')][_0x0922('0x30')]);}return _0x20dadd[_0x0922('0xee')](_0x4c2677);}})[_0x0922('0x39')](function(_0xa1644f){if(_0xa1644f){return _0xa1644f?{'count':_0x3a807b,'rows':_0xa1644f}:null;}})['then'](respondWithResult(_0x324190,null))[_0x0922('0x2c')](handleError(_0x324190,null));}; \ No newline at end of file +var _0xbf64=['filters','merge','VIRTUAL','findAll','includeAll','include','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','SmsAccountId','Disposition','findOne','pick','filter','rows','removeDispositions','ids','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','Body','MessageSid','skebby','from','sender','text','connectel','clicksend','messageId','message_id','plivo','From','Text','infobip','results','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','SmsInteraction','spread','interaction','created','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','redif','error_code','clickatell','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','fs-extra','lodash','squel','crypto','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','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5463c2,_0x22c4cc){var _0x5a7da7=function(_0x4c16b5){while(--_0x4c16b5){_0x5463c2['push'](_0x5463c2['shift']());}};_0x5a7da7(++_0x22c4cc);}(_0xbf64,0x97));var _0x4bf6=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xbf64[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0x4bf6('0x0'));var rimraf=require(_0x4bf6('0x1'));var zipdir=require(_0x4bf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bf6('0x3'));var moment=require(_0x4bf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4bf6('0x5'));var sox=require(_0x4bf6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bf6('0x7'));var _=require(_0x4bf6('0x8'));var squel=require(_0x4bf6('0x9'));var crypto=require(_0x4bf6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4bf6('0xb'));var querystring=require(_0x4bf6('0xc'));var Papa=require(_0x4bf6('0xd'));var Redis=require(_0x4bf6('0xe'));var authService=require(_0x4bf6('0xf'));var qs=require(_0x4bf6('0x10'));var as=require(_0x4bf6('0x11'));var hardwareService=require(_0x4bf6('0x12'));var logger=require(_0x4bf6('0x13'))('api');var utils=require(_0x4bf6('0x14'));var config=require(_0x4bf6('0x15'));var licenseUtil=require(_0x4bf6('0x16'));var db=require(_0x4bf6('0x17'))['db'];config[_0x4bf6('0x18')]=_[_0x4bf6('0x19')](config[_0x4bf6('0x18')],{'host':_0x4bf6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4bf6('0x18')]));require(_0x4bf6('0x1b'))[_0x4bf6('0x1c')](socket);var jayson=require(_0x4bf6('0x1d'));var client=jayson[_0x4bf6('0x1e')][_0x4bf6('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2cea97,_0x3ac17a,_0x16f777,_0x325715){return new BPromise(function(_0x2f44b5,_0x535aef){var _0x452a43=_0x325715||client;return _0x452a43[_0x4bf6('0x20')](_0x2cea97,_0x16f777)[_0x4bf6('0x21')](function(_0x34a9e7){logger[_0x4bf6('0x22')](_0x4bf6('0x23'),_0x3ac17a,_0x4bf6('0x24'));logger['debug'](_0x4bf6('0x25'),_0x3ac17a,'request\x20sent',JSON[_0x4bf6('0x26')](_0x34a9e7));if(_0x34a9e7[_0x4bf6('0x27')]){if(_0x34a9e7['error'][_0x4bf6('0x28')]===0x1f4){logger['error'](_0x4bf6('0x23'),_0x3ac17a,_0x34a9e7[_0x4bf6('0x27')]['message']);return _0x535aef(_0x34a9e7[_0x4bf6('0x27')][_0x4bf6('0x29')]);}logger[_0x4bf6('0x27')](_0x4bf6('0x23'),_0x3ac17a,_0x34a9e7['error']['message']);return _0x2f44b5(_0x34a9e7[_0x4bf6('0x27')]['message']);}else{logger[_0x4bf6('0x22')](_0x4bf6('0x23'),_0x3ac17a,_0x4bf6('0x24'));_0x2f44b5(_0x34a9e7['result'][_0x4bf6('0x29')]);}})['catch'](function(_0x1e080f){logger[_0x4bf6('0x27')](_0x4bf6('0x23'),_0x3ac17a,_0x1e080f);_0x535aef(_0x1e080f);});});}function respondWithStatusCode(_0x3185d1,_0x37dc1f){_0x37dc1f=_0x37dc1f||0xcc;return function(_0x2ebaa1){if(_0x2ebaa1){return _0x3185d1[_0x4bf6('0x2a')](_0x37dc1f);}return _0x3185d1[_0x4bf6('0x2b')](_0x37dc1f)[_0x4bf6('0x2c')]();};}function respondWithResult(_0x4b10a5,_0x5c21a7){_0x5c21a7=_0x5c21a7||0xc8;return function(_0xb75f9){if(_0xb75f9){return _0x4b10a5[_0x4bf6('0x2b')](_0x5c21a7)[_0x4bf6('0x2d')](_0xb75f9);}};}function respondWithFilteredResult(_0x1c1c0c,_0x300a7a){return function(_0x4f6ca3){if(_0x4f6ca3){var _0x3136b8=typeof _0x300a7a[_0x4bf6('0x2e')]===_0x4bf6('0x2f')&&typeof _0x300a7a[_0x4bf6('0x30')]===_0x4bf6('0x2f');var _0x4b9f2a=_0x4f6ca3[_0x4bf6('0x31')];var _0x24ab7e=_0x3136b8?0x0:_0x300a7a[_0x4bf6('0x2e')];var _0x240a3d=_0x3136b8?_0x4f6ca3['count']:_0x300a7a[_0x4bf6('0x2e')]+_0x300a7a['limit'];var _0x2d3f9b;if(_0x240a3d>=_0x4b9f2a){_0x240a3d=_0x4b9f2a;_0x2d3f9b=0xc8;}else{_0x2d3f9b=0xce;}_0x1c1c0c[_0x4bf6('0x2b')](_0x2d3f9b);return _0x1c1c0c['set'](_0x4bf6('0x32'),_0x24ab7e+'-'+_0x240a3d+'/'+_0x4b9f2a)[_0x4bf6('0x2d')](_0x4f6ca3);}return null;};}function patchUpdates(_0x5366eb){return function(_0x40e116){try{jsonpatch[_0x4bf6('0x33')](_0x40e116,_0x5366eb,!![]);}catch(_0x388f71){return BPromise[_0x4bf6('0x34')](_0x388f71);}return _0x40e116[_0x4bf6('0x35')]();};}function saveUpdates(_0x385447,_0x4b539e){return function(_0x56c235){if(_0x56c235){return _0x56c235['update'](_0x385447)[_0x4bf6('0x21')](function(_0xe4d2a7){return _0xe4d2a7;});}return null;};}function removeEntity(_0x5a910b,_0x20e9f1){return function(_0x4d3745){if(_0x4d3745){return _0x4d3745[_0x4bf6('0x36')]()[_0x4bf6('0x21')](function(){var _0x1d1f0a=_0x4d3745[_0x4bf6('0x37')]({'plain':!![]});var _0x324a0f=_0x4bf6('0x38');return db[_0x4bf6('0x39')][_0x4bf6('0x36')]({'where':{'type':_0x324a0f,'resourceId':_0x1d1f0a['id']}})[_0x4bf6('0x21')](function(){return _0x4d3745;});})['then'](function(){_0x5a910b[_0x4bf6('0x2b')](0xcc)[_0x4bf6('0x2c')]();});}};}function handleEntityNotFound(_0x1b2cab,_0x216a5d){return function(_0xa76fc8){if(!_0xa76fc8){_0x1b2cab['sendStatus'](0x194);}return _0xa76fc8;};}function handleError(_0x34bee1,_0x340c6e){_0x340c6e=_0x340c6e||0x1f4;return function(_0x54994f){logger['error'](_0x54994f['stack']);if(_0x54994f['name']){delete _0x54994f[_0x4bf6('0x3a')];}_0x34bee1[_0x4bf6('0x2b')](_0x340c6e)[_0x4bf6('0x3b')](_0x54994f);};}exports[_0x4bf6('0x3c')]=function(_0x1ff541,_0x10fc82){var _0x593685={'include':[{'model':db[_0x4bf6('0x3d')],'as':_0x4bf6('0x3e')}]},_0x1523cd={},_0x47ffb1={'count':0x0,'rows':[]};var _0x4b8d51=_[_0x4bf6('0x3f')](db[_0x4bf6('0x40')][_0x4bf6('0x41')],function(_0x581f23){return{'name':_0x581f23['fieldName'],'type':_0x581f23[_0x4bf6('0x42')][_0x4bf6('0x43')]};});_0x1523cd['model']=_[_0x4bf6('0x3f')](_0x4b8d51,_0x4bf6('0x3a'));_0x1523cd['query']=_[_0x4bf6('0x44')](_0x1ff541[_0x4bf6('0x45')]);_0x1523cd['filters']=_[_0x4bf6('0x46')](_0x1523cd[_0x4bf6('0x47')],_0x1523cd['query']);_0x593685[_0x4bf6('0x48')]=_[_0x4bf6('0x46')](_0x1523cd[_0x4bf6('0x47')],qs[_0x4bf6('0x49')](_0x1ff541[_0x4bf6('0x45')]['fields']));_0x593685[_0x4bf6('0x48')]=_0x593685[_0x4bf6('0x48')][_0x4bf6('0x4a')]?_0x593685[_0x4bf6('0x48')]:_0x1523cd['model'];if(!_0x1ff541[_0x4bf6('0x45')][_0x4bf6('0x4b')](_0x4bf6('0x4c'))){_0x593685[_0x4bf6('0x30')]=qs[_0x4bf6('0x30')](_0x1ff541['query'][_0x4bf6('0x30')]);_0x593685[_0x4bf6('0x2e')]=qs[_0x4bf6('0x2e')](_0x1ff541[_0x4bf6('0x45')][_0x4bf6('0x2e')]);}_0x593685[_0x4bf6('0x4d')]=qs[_0x4bf6('0x4e')](_0x1ff541[_0x4bf6('0x45')][_0x4bf6('0x4e')]);_0x593685[_0x4bf6('0x4f')]=qs[_0x4bf6('0x50')](_['pick'](_0x1ff541[_0x4bf6('0x45')],_0x1523cd['filters']),_0x4b8d51);if(_0x1ff541[_0x4bf6('0x45')]['filter']){_0x593685['where']=_[_0x4bf6('0x51')](_0x593685[_0x4bf6('0x4f')],{'$or':_[_0x4bf6('0x3f')](_0x4b8d51,function(_0x5857f1){if(_0x5857f1[_0x4bf6('0x42')]!==_0x4bf6('0x52')){var _0x19ec53={};_0x19ec53[_0x5857f1[_0x4bf6('0x3a')]]={'$like':'%'+_0x1ff541[_0x4bf6('0x45')]['filter']+'%'};return _0x19ec53;}})});}_0x593685=_[_0x4bf6('0x51')]({},_0x593685,_0x1ff541['options']);var _0x59aaf3={'where':_0x593685[_0x4bf6('0x4f')]};return db[_0x4bf6('0x40')][_0x4bf6('0x31')](_0x59aaf3)[_0x4bf6('0x21')](function(_0x16dc51){_0x47ffb1[_0x4bf6('0x31')]=_0x16dc51;if(_0x1ff541[_0x4bf6('0x45')]['includeAll']){_0x593685['include']=[{'all':!![]}];}return db[_0x4bf6('0x40')][_0x4bf6('0x53')](_0x593685);})['then'](function(_0x220993){_0x47ffb1['rows']=_0x220993;return _0x47ffb1;})[_0x4bf6('0x21')](respondWithFilteredResult(_0x10fc82,_0x593685))['catch'](handleError(_0x10fc82,null));};exports['show']=function(_0x582768,_0x4fc7cf){var _0x77455d={'raw':![],'where':{'id':_0x582768['params']['id']},'include':[{'model':db[_0x4bf6('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2a4b0b={};_0x2a4b0b['model']=_[_0x4bf6('0x44')](db[_0x4bf6('0x40')][_0x4bf6('0x41')]);_0x2a4b0b[_0x4bf6('0x45')]=_[_0x4bf6('0x44')](_0x582768[_0x4bf6('0x45')]);_0x2a4b0b[_0x4bf6('0x50')]=_[_0x4bf6('0x46')](_0x2a4b0b[_0x4bf6('0x47')],_0x2a4b0b[_0x4bf6('0x45')]);_0x77455d[_0x4bf6('0x48')]=_['intersection'](_0x2a4b0b[_0x4bf6('0x47')],qs[_0x4bf6('0x49')](_0x582768[_0x4bf6('0x45')][_0x4bf6('0x49')]));_0x77455d[_0x4bf6('0x48')]=_0x77455d[_0x4bf6('0x48')][_0x4bf6('0x4a')]?_0x77455d['attributes']:_0x2a4b0b['model'];if(_0x582768['query'][_0x4bf6('0x54')]){_0x77455d[_0x4bf6('0x55')]=[{'all':!![]}];}_0x77455d=_['merge']({},_0x77455d,_0x582768[_0x4bf6('0x56')]);return db[_0x4bf6('0x40')][_0x4bf6('0x57')](_0x77455d)[_0x4bf6('0x21')](handleEntityNotFound(_0x4fc7cf,null))[_0x4bf6('0x21')](respondWithResult(_0x4fc7cf,null))[_0x4bf6('0x58')](handleError(_0x4fc7cf,null));};exports[_0x4bf6('0x59')]=function(_0x5572b1,_0x1672c8){return db['SmsAccount'][_0x4bf6('0x59')](_0x5572b1['body'],{})['then'](function(_0x5dd0d9){var _0x3b597f=_0x5572b1['user'][_0x4bf6('0x37')]({'plain':!![]});if(!_0x3b597f)throw new Error(_0x4bf6('0x5a'));if(_0x3b597f[_0x4bf6('0x5b')]===_0x4bf6('0x5c')){var _0xef62f7=_0x5dd0d9['get']({'plain':!![]});var _0x46aa09=_0x4bf6('0x38');return db[_0x4bf6('0x5d')][_0x4bf6('0x57')]({'where':{'name':_0x46aa09,'userProfileId':_0x3b597f['userProfileId']},'raw':!![]})[_0x4bf6('0x21')](function(_0x256125){if(_0x256125&&_0x256125[_0x4bf6('0x5e')]===0x0){return db[_0x4bf6('0x39')][_0x4bf6('0x59')]({'name':_0xef62f7[_0x4bf6('0x3a')],'resourceId':_0xef62f7['id'],'type':_0x256125[_0x4bf6('0x3a')],'sectionId':_0x256125['id']},{})[_0x4bf6('0x21')](function(){return _0x5dd0d9;});}else{return _0x5dd0d9;}})[_0x4bf6('0x58')](function(_0x34d872){logger[_0x4bf6('0x27')](_0x4bf6('0x5f'),_0x34d872);throw _0x34d872;});}return _0x5dd0d9;})[_0x4bf6('0x21')](respondWithResult(_0x1672c8,0xc9))[_0x4bf6('0x58')](handleError(_0x1672c8,null));};exports[_0x4bf6('0x60')]=function(_0x3218d0,_0xab2020){if(_0x3218d0[_0x4bf6('0x61')]['id']){delete _0x3218d0['body']['id'];}return db[_0x4bf6('0x40')]['find']({'where':{'id':_0x3218d0[_0x4bf6('0x62')]['id']},'include':[{'model':db[_0x4bf6('0x3d')],'as':_0x4bf6('0x3e')}]})[_0x4bf6('0x21')](handleEntityNotFound(_0xab2020,null))[_0x4bf6('0x21')](saveUpdates(_0x3218d0[_0x4bf6('0x61')],null))[_0x4bf6('0x21')](respondWithResult(_0xab2020,null))[_0x4bf6('0x58')](handleError(_0xab2020,null));};exports[_0x4bf6('0x36')]=function(_0x5756a7,_0x5e4c12){return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x5756a7[_0x4bf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x5e4c12,null))['then'](removeEntity(_0x5e4c12,null))[_0x4bf6('0x58')](handleError(_0x5e4c12,null));};exports[_0x4bf6('0x63')]=function(_0x35f95b,_0x57025f){return db[_0x4bf6('0x40')][_0x4bf6('0x63')]()[_0x4bf6('0x21')](respondWithResult(_0x57025f,null))[_0x4bf6('0x58')](handleError(_0x57025f,null));};exports['addDisposition']=function(_0x58374d,_0x330a55,_0x4b3fee){if(_0x58374d[_0x4bf6('0x61')]['id']){delete _0x58374d[_0x4bf6('0x61')]['id'];}return db['SmsAccount'][_0x4bf6('0x57')]({'where':{'id':_0x58374d['params']['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x330a55,null))[_0x4bf6('0x21')](function(_0x40bfc8){if(_0x40bfc8){_0x58374d[_0x4bf6('0x61')][_0x4bf6('0x64')]=_0x40bfc8['id'];return db[_0x4bf6('0x65')][_0x4bf6('0x59')](_0x58374d['body']);}})[_0x4bf6('0x21')](respondWithResult(_0x330a55,null))[_0x4bf6('0x58')](handleError(_0x330a55,null));};exports['getDispositions']=function(_0x406c28,_0x9756a8,_0x4c8339){var _0x3ac6c8={'raw':![],'where':{}};var _0x23b12e={};var _0x1d4860={'count':0x0,'rows':[]};return db[_0x4bf6('0x40')][_0x4bf6('0x66')]({'where':{'id':_0x406c28[_0x4bf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x9756a8,null))['then'](function(_0x4347eb){if(_0x4347eb){_0x23b12e[_0x4bf6('0x47')]=_[_0x4bf6('0x44')](db['Disposition'][_0x4bf6('0x41')]);_0x23b12e[_0x4bf6('0x45')]=_[_0x4bf6('0x44')](_0x406c28[_0x4bf6('0x45')]);_0x23b12e[_0x4bf6('0x50')]=_[_0x4bf6('0x46')](_0x23b12e[_0x4bf6('0x47')],_0x23b12e[_0x4bf6('0x45')]);_0x3ac6c8[_0x4bf6('0x48')]=_[_0x4bf6('0x46')](_0x23b12e['model'],qs[_0x4bf6('0x49')](_0x406c28[_0x4bf6('0x45')][_0x4bf6('0x49')]));_0x3ac6c8['attributes']=_0x3ac6c8[_0x4bf6('0x48')][_0x4bf6('0x4a')]?_0x3ac6c8[_0x4bf6('0x48')]:_0x23b12e[_0x4bf6('0x47')];if(!_0x406c28[_0x4bf6('0x45')][_0x4bf6('0x4b')](_0x4bf6('0x4c'))){_0x3ac6c8[_0x4bf6('0x30')]=qs[_0x4bf6('0x30')](_0x406c28[_0x4bf6('0x45')][_0x4bf6('0x30')]);_0x3ac6c8[_0x4bf6('0x2e')]=qs[_0x4bf6('0x2e')](_0x406c28[_0x4bf6('0x45')]['offset']);}_0x3ac6c8[_0x4bf6('0x4d')]=qs['sort'](_0x406c28[_0x4bf6('0x45')][_0x4bf6('0x4e')]);_0x3ac6c8[_0x4bf6('0x4f')]=qs[_0x4bf6('0x50')](_[_0x4bf6('0x67')](_0x406c28[_0x4bf6('0x45')],_0x23b12e[_0x4bf6('0x50')]));_0x3ac6c8[_0x4bf6('0x4f')]['SmsAccountId']=_0x4347eb['id'];if(_0x406c28[_0x4bf6('0x45')][_0x4bf6('0x68')]){_0x3ac6c8['where']=_['merge'](_0x3ac6c8['where'],{'$or':_[_0x4bf6('0x3f')](_0x3ac6c8[_0x4bf6('0x48')],function(_0x293056){var _0x324a75={};_0x324a75[_0x293056]={'$like':'%'+_0x406c28[_0x4bf6('0x45')]['filter']+'%'};return _0x324a75;})});}_0x3ac6c8=_[_0x4bf6('0x51')]({},_0x3ac6c8,_0x406c28[_0x4bf6('0x56')]);return db['Disposition'][_0x4bf6('0x31')]({'where':_0x3ac6c8[_0x4bf6('0x4f')]})[_0x4bf6('0x21')](function(_0x532102){_0x1d4860[_0x4bf6('0x31')]=_0x532102;if(_0x406c28[_0x4bf6('0x45')]['includeAll']){_0x3ac6c8[_0x4bf6('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x4bf6('0x53')](_0x3ac6c8);})[_0x4bf6('0x21')](function(_0xd8056c){_0x1d4860[_0x4bf6('0x69')]=_0xd8056c;return _0x1d4860;});}})[_0x4bf6('0x21')](respondWithFilteredResult(_0x9756a8,_0x3ac6c8))[_0x4bf6('0x58')](handleError(_0x9756a8,null));};exports['removeDispositions']=function(_0x48bb6c,_0x497310,_0x4330d2){return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x48bb6c['params']['id']}})['then'](handleEntityNotFound(_0x497310,null))[_0x4bf6('0x21')](function(_0x28db7c){if(_0x28db7c){return _0x28db7c[_0x4bf6('0x6a')](_0x48bb6c[_0x4bf6('0x45')][_0x4bf6('0x6b')]);}})['then'](respondWithStatusCode(_0x497310,null))[_0x4bf6('0x58')](handleError(_0x497310,null));};exports['addAnswer']=function(_0x1f8bac,_0x497bf7,_0x4f4c3f){if(_0x1f8bac['body']['id']){delete _0x1f8bac[_0x4bf6('0x61')]['id'];}return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x1f8bac['params']['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x497bf7,null))[_0x4bf6('0x21')](function(_0x5b0d99){if(_0x5b0d99){_0x1f8bac[_0x4bf6('0x61')]['SmsAccountId']=_0x5b0d99['id'];return db[_0x4bf6('0x6c')][_0x4bf6('0x59')](_0x1f8bac[_0x4bf6('0x61')]);}})['then'](respondWithResult(_0x497bf7,null))[_0x4bf6('0x58')](handleError(_0x497bf7,null));};exports['getAnswers']=function(_0x346174,_0x240da5,_0x33532e){var _0x305307={'raw':![],'where':{}};var _0x3e49b3={};var _0x27811b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4bf6('0x66')]({'where':{'id':_0x346174[_0x4bf6('0x62')]['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x240da5,null))[_0x4bf6('0x21')](function(_0x4eebf6){if(_0x4eebf6){_0x3e49b3['model']=_[_0x4bf6('0x44')](db[_0x4bf6('0x6c')]['rawAttributes']);_0x3e49b3[_0x4bf6('0x45')]=_[_0x4bf6('0x44')](_0x346174[_0x4bf6('0x45')]);_0x3e49b3[_0x4bf6('0x50')]=_['intersection'](_0x3e49b3[_0x4bf6('0x47')],_0x3e49b3['query']);_0x305307[_0x4bf6('0x48')]=_['intersection'](_0x3e49b3['model'],qs[_0x4bf6('0x49')](_0x346174[_0x4bf6('0x45')][_0x4bf6('0x49')]));_0x305307[_0x4bf6('0x48')]=_0x305307[_0x4bf6('0x48')]['length']?_0x305307[_0x4bf6('0x48')]:_0x3e49b3[_0x4bf6('0x47')];if(!_0x346174[_0x4bf6('0x45')][_0x4bf6('0x4b')](_0x4bf6('0x4c'))){_0x305307[_0x4bf6('0x30')]=qs[_0x4bf6('0x30')](_0x346174[_0x4bf6('0x45')][_0x4bf6('0x30')]);_0x305307[_0x4bf6('0x2e')]=qs[_0x4bf6('0x2e')](_0x346174[_0x4bf6('0x45')]['offset']);}_0x305307['order']=qs['sort'](_0x346174[_0x4bf6('0x45')][_0x4bf6('0x4e')]);_0x305307[_0x4bf6('0x4f')]=qs[_0x4bf6('0x50')](_[_0x4bf6('0x67')](_0x346174[_0x4bf6('0x45')],_0x3e49b3[_0x4bf6('0x50')]));_0x305307[_0x4bf6('0x4f')]['SmsAccountId']=_0x4eebf6['id'];if(_0x346174[_0x4bf6('0x45')][_0x4bf6('0x68')]){_0x305307[_0x4bf6('0x4f')]=_[_0x4bf6('0x51')](_0x305307[_0x4bf6('0x4f')],{'$or':_[_0x4bf6('0x3f')](_0x305307[_0x4bf6('0x48')],function(_0x3e9805){var _0x540f7a={};_0x540f7a[_0x3e9805]={'$like':'%'+_0x346174[_0x4bf6('0x45')][_0x4bf6('0x68')]+'%'};return _0x540f7a;})});}_0x305307=_[_0x4bf6('0x51')]({},_0x305307,_0x346174[_0x4bf6('0x56')]);return db[_0x4bf6('0x6c')][_0x4bf6('0x31')]({'where':_0x305307['where']})[_0x4bf6('0x21')](function(_0x1368eb){_0x27811b[_0x4bf6('0x31')]=_0x1368eb;if(_0x346174[_0x4bf6('0x45')][_0x4bf6('0x54')]){_0x305307[_0x4bf6('0x55')]=[{'all':!![]}];}return db[_0x4bf6('0x6c')][_0x4bf6('0x53')](_0x305307);})[_0x4bf6('0x21')](function(_0x1c765e){_0x27811b[_0x4bf6('0x69')]=_0x1c765e;return _0x27811b;});}})[_0x4bf6('0x21')](respondWithFilteredResult(_0x240da5,_0x305307))[_0x4bf6('0x58')](handleError(_0x240da5,null));};exports[_0x4bf6('0x6d')]=function(_0x1a24eb,_0x3190be,_0xb4b008){return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x1a24eb[_0x4bf6('0x62')]['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x3190be,null))[_0x4bf6('0x21')](function(_0x5c37ee){if(_0x5c37ee){return _0x5c37ee[_0x4bf6('0x6d')](_0x1a24eb['query'][_0x4bf6('0x6b')]);}})[_0x4bf6('0x21')](respondWithStatusCode(_0x3190be,null))[_0x4bf6('0x58')](handleError(_0x3190be,null));};exports['notify']=function(_0x23301e,_0x19dc44,_0x2fb830){var _0x515d2b={'channel':_0x4bf6('0x6e')};var _0x132c32=[];var _0x25c485=[];var _0x237935={};return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x23301e[_0x4bf6('0x62')]['id']},'include':[{'model':db[_0x4bf6('0x6f')],'as':_0x4bf6('0x70')}]})['then'](handleEntityNotFound(_0x19dc44,null))[_0x4bf6('0x21')](function(_0x2fc1fd){_0x515d2b[_0x4bf6('0x71')]=_0x2fc1fd;_0x515d2b[_0x4bf6('0x72')]=_[_0x4bf6('0x73')](_0x2fc1fd['Applications'],[_0x4bf6('0x74')],[_0x4bf6('0x75')]);if(_0x515d2b[_0x4bf6('0x71')]['Applications']){delete _0x515d2b[_0x4bf6('0x71')][_0x4bf6('0x70')];}return db[_0x4bf6('0x76')]['describe']();})[_0x4bf6('0x21')](function(_0x467ebf){if(!_0x467ebf){throw new db[(_0x4bf6('0x77'))][(_0x4bf6('0x78'))]('no\x20available\x20attributes');}_0x132c32=_['difference'](_[_0x4bf6('0x44')](_0x467ebf),[_0x4bf6('0x79'),_0x4bf6('0x7a')]);_0x25c485=_[_0x4bf6('0x7b')](_['keys'](_0x467ebf),[_0x4bf6('0x79'),_0x4bf6('0x7a'),_0x4bf6('0x7c'),_0x4bf6('0x7d')]);_0x515d2b[_0x4bf6('0x61')]={'mapKey':_0x4bf6('0x7e')};if(_0x515d2b['account']['type']){switch(_0x515d2b['account'][_0x4bf6('0x42')]){case _0x4bf6('0x7f'):_0x515d2b['body']['from']=_0x23301e['body']['From'];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x80')];_0x515d2b[_0x4bf6('0x61')]['messageId']=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x81')];break;case _0x4bf6('0x82'):_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]='+'+_0x23301e['body'][_0x4bf6('0x84')];_0x515d2b[_0x4bf6('0x61')]['body']=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x85')];break;case _0x4bf6('0x86'):_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]=_0x23301e['body'][_0x4bf6('0x83')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x29')];break;case _0x4bf6('0x87'):_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x83')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e[_0x4bf6('0x61')]['body'];_0x515d2b['body'][_0x4bf6('0x88')]=_0x23301e['body'][_0x4bf6('0x89')];break;case _0x4bf6('0x8a'):_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]=_0x23301e['body'][_0x4bf6('0x8b')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x8c')];_0x515d2b[_0x4bf6('0x61')]['messageId']=_0x23301e[_0x4bf6('0x61')]['MessageUUID'];break;case _0x4bf6('0x8d'):_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]='+'+_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x8e')][0x0][_0x4bf6('0x83')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e['body'][_0x4bf6('0x8e')][0x0]['text'];_0x515d2b['body'][_0x4bf6('0x88')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x8e')][0x0][_0x4bf6('0x88')];break;case'csc':_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x8f')];_0x515d2b[_0x4bf6('0x61')]['body']=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x90')][_0x4bf6('0x29')];break;case'clickatell':_0x515d2b['body'][_0x4bf6('0x83')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x91')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e['body'][_0x4bf6('0x85')];_0x515d2b[_0x4bf6('0x61')]['messageId']=_0x23301e['body'][_0x4bf6('0x92')];break;case _0x4bf6('0x93'):_0x515d2b[_0x4bf6('0x61')]['messageId']=_0x23301e[_0x4bf6('0x61')][0x0][_0x4bf6('0x29')]['id'];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')]=_0x23301e['body'][0x0][_0x4bf6('0x29')][_0x4bf6('0x83')];_0x515d2b['body'][_0x4bf6('0x61')]=_0x23301e[_0x4bf6('0x61')][0x0][_0x4bf6('0x29')]['text'];break;case _0x4bf6('0x94'):_0x515d2b['body']['from']=_0x23301e['body'][_0x4bf6('0x83')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x29')];_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x88')]=_0x23301e[_0x4bf6('0x61')][_0x4bf6('0x95')];break;}}if(_0x515d2b[_0x4bf6('0x61')]['id']){delete _0x515d2b[_0x4bf6('0x61')]['id'];}if(_['isNil'](_0x515d2b['body'][_0x4bf6('0x83')])){throw new db[(_0x4bf6('0x77'))]['ValidationError'](_0x4bf6('0x96'));}if(_[_0x4bf6('0x97')](_0x515d2b['body'][_0x4bf6('0x61')])||_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x61')]===''){throw new db[(_0x4bf6('0x77'))][(_0x4bf6('0x78'))](_0x4bf6('0x98'));}if(_[_0x4bf6('0x97')](_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x99')])){throw new db[(_0x4bf6('0x77'))]['ValidationError'](_0x4bf6('0x9a')+_0x25c485);}if(!_[_0x4bf6('0x9b')](_0x25c485,_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x99')])){throw new db[(_0x4bf6('0x77'))][(_0x4bf6('0x78'))](_0x4bf6('0x9c')+_0x25c485);}_0x237935[_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x99')]]=_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')];return db[_0x4bf6('0x9d')]['find']({'where':{'id':_0x515d2b[_0x4bf6('0x71')][_0x4bf6('0x7d')]},'include':[{'model':db[_0x4bf6('0x76')],'as':_0x4bf6('0x9e'),'where':_0x237935,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x4bf6('0x21')](handleEntityNotFound(_0x19dc44,null))[_0x4bf6('0x21')](function(_0x67afcb){if(_0x67afcb){_0x515d2b[_0x4bf6('0x9f')]=_[_0x4bf6('0xa0')](_0x67afcb,[_0x4bf6('0x9e')]);if(_0x67afcb[_0x4bf6('0x9e')]['length']){return _0x67afcb[_0x4bf6('0x9e')][0x0];}var _0x2935ea=_[_0x4bf6('0x19')](_0x515d2b[_0x4bf6('0x61')],{'firstName':_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')],'ListId':_0x67afcb['id']});_0x2935ea[_0x515d2b['body'][_0x4bf6('0x99')]]=_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')];return db[_0x4bf6('0x76')][_0x4bf6('0x59')](_0x2935ea,{'fields':_0x132c32,'raw':!![]});}})['then'](handleEntityNotFound(_0x19dc44,null))['then'](function(_0x347c0c){if(_0x347c0c){_0x515d2b['contact']=_0x347c0c;var _0x25cbaa={'ContactId':_0x347c0c['id'],'phone':_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')],'SmsAccountId':_0x23301e[_0x4bf6('0x62')]['id']};var _0x4c2acf={'ContactId':_0x347c0c['id'],'SmsAccountId':_0x23301e[_0x4bf6('0x62')]['id'],'closed':![]};return db[_0x4bf6('0xa1')][_0x4bf6('0x57')]({'where':_0x4c2acf})[_0x4bf6('0x21')](function(_0x1b2bd8){if(_0x1b2bd8){return[_0x1b2bd8,![]];}return db['SmsInteraction'][_0x4bf6('0x59')](_0x25cbaa)[_0x4bf6('0x21')](function(_0x11ba78){return[_0x11ba78,!![]];});});}})[_0x4bf6('0xa2')](function(_0x5e48a4,_0x4b64b7){_0x515d2b[_0x4bf6('0xa3')]=_0x5e48a4['get']({'plain':!![]});_0x515d2b[_0x4bf6('0xa3')][_0x4bf6('0xa4')]=![];if(_0x4b64b7){if(_0x515d2b['account']['autoclose']){_0x515d2b[_0x4bf6('0x72')][_0x4bf6('0xa5')]({'id':0x0,'priority':_0x515d2b['applications'][_0x4bf6('0x4a')]+0x1,'app':_0x4bf6('0xa6'),'appdata':'unmanaged','interval':_0x4bf6('0xa7')});}_0x515d2b[_0x4bf6('0xa3')][_0x4bf6('0xa4')]=!![];}return db['SmsMessage'][_0x4bf6('0x59')]({'phone':_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x83')],'messageId':_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0x88')],'body':_0x515d2b['body']['body'],'SmsAccountId':_0x23301e[_0x4bf6('0x62')]['id'],'SmsInteractionId':_0x5e48a4['id'],'direction':'in','ContactId':_0x5e48a4[_0x4bf6('0xa8')],'AttachmentId':_0x515d2b[_0x4bf6('0x61')][_0x4bf6('0xa9')]});})[_0x4bf6('0x21')](function(_0x3fdae6){_0x515d2b[_0x4bf6('0x29')]=_0x3fdae6;if(!_0x515d2b['interaction'][_0x4bf6('0xaa')])return;return db['User'][_0x4bf6('0x57')]({'attributes':['id','name'],'where':{'id':_0x515d2b['interaction'][_0x4bf6('0xaa')]}});})[_0x4bf6('0x21')](function(_0x58bc01){if(_0x58bc01){_0x515d2b[_0x4bf6('0x72')][_0x4bf6('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x58bc01['name']+','+(_0x515d2b['account'][_0x4bf6('0xac')]||0xa),'interval':_0x4bf6('0xa7')});}if(!_0x515d2b[_0x4bf6('0xa3')][_0x4bf6('0xad')])return;return db['SmsQueue'][_0x4bf6('0x57')]({'attributes':['id',_0x4bf6('0x3a')],'where':{'id':_0x515d2b[_0x4bf6('0xa3')]['queueId']}});})['then'](function(_0x26597f){if(_0x26597f){_0x515d2b[_0x4bf6('0x72')][_0x4bf6('0xab')]({'id':0x0,'priority':0x1,'app':_0x4bf6('0xae'),'appdata':_0x26597f['name']+','+(_0x515d2b[_0x4bf6('0x71')][_0x4bf6('0xaf')]||0x12c),'interval':_0x4bf6('0xa7')});}return respondWithRpcPromise('Start','startRouting',_0x515d2b);})['then'](function(_0x5e6ba8){if(_0x5e6ba8){var _0x569b24=0xc8;var _0xa6c048=_0x4bf6('0xb0');logger[_0x4bf6('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa6c048,_0x569b24,_0x4bf6('0xb1'));logger[_0x4bf6('0xb2')](_0x4bf6('0xb3'),_0xa6c048,_0x569b24,_0x4bf6('0xb1'),JSON['stringify'](_0x5e6ba8));if(_0x515d2b[_0x4bf6('0x71')][_0x4bf6('0x42')]==='twilio'){return _0x19dc44[_0x4bf6('0x2b')](_0x569b24)['set']('Content-Type',_0x4bf6('0xb4'))[_0x4bf6('0x3b')](_0x4bf6('0xb5'));}else{return _0x19dc44[_0x4bf6('0x2b')](_0x569b24)[_0x4bf6('0x2d')](_0x5e6ba8);}}})[_0x4bf6('0x58')](handleError(_0x19dc44,null));};exports[_0x4bf6('0xb6')]=function(_0x31f32c,_0x2e2169){var _0x4eb066=_0x31f32c[_0x4bf6('0x62')]['id'];var _0x489fcc=_0x31f32c[_0x4bf6('0x61')];var _0x2a5e5d=0xc8;var _0x4be136=null;return db[_0x4bf6('0xb7')][_0x4bf6('0xb8')]({'isolationLevel':db[_0x4bf6('0xb7')][_0x4bf6('0xb9')][_0x4bf6('0xba')]['READ_COMMITTED']},function(_0xc88bd3){return db['SmsAccount']['findOne']({'where':{'id':_0x4eb066},'transaction':_0xc88bd3})[_0x4bf6('0x21')](function(_0x4247a3){if(_0x4247a3){return db['SmsApplication'][_0x4bf6('0x36')]({'where':{'SmsAccountId':_0x4eb066},'transaction':_0xc88bd3})['then'](function(){var _0x2716e5=_[_0x4bf6('0x3f')](_0x489fcc,function(_0x4eec00){_0x4eec00[_0x4bf6('0x64')]=_0x4eb066;return _0x4eec00;});return db[_0x4bf6('0x6f')][_0x4bf6('0xbb')](_0x2716e5,{'transaction':_0xc88bd3});});}else{_0x2a5e5d=0x194;_0x4be136=[];}});})[_0x4bf6('0x21')](function(){if(_0x2a5e5d!==0x194){return db[_0x4bf6('0x6f')][_0x4bf6('0xbc')]({'where':{'SmsAccountId':_0x4eb066},'order':_0x4bf6('0x74')})['then'](function(_0x2b7136){_0x4be136=_0x2b7136;});}})[_0x4bf6('0x58')](function(_0x2a3f68){_0x2a5e5d=0x1f4;logger[_0x4bf6('0x27')](_0x2a3f68[_0x4bf6('0xbd')]);if(_0x2a3f68[_0x4bf6('0x3a')]){delete _0x2a3f68['name'];}_0x4be136=_0x2a3f68;})[_0x4bf6('0xbe')](function(){if(_0x4be136===null){_0x2e2169['sendStatus'](_0x2a5e5d);}else{if(_0x2a5e5d===0x1f4){_0x2e2169[_0x4bf6('0x2b')](_0x2a5e5d)[_0x4bf6('0x3b')](_0x4be136);}else{_0x2e2169[_0x4bf6('0x2b')](_0x2a5e5d)[_0x4bf6('0x2d')](_0x4be136);}}});};exports[_0x4bf6('0xbf')]=function(_0x59f281,_0x6136f4,_0x5305d1){var _0x21eb01={};var _0x2990d7={};var _0x3bcc35;var _0x2cfb09;return db[_0x4bf6('0x40')][_0x4bf6('0x66')]({'where':{'id':_0x59f281[_0x4bf6('0x62')]['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x6136f4,null))[_0x4bf6('0x21')](function(_0x488477){if(_0x488477){_0x3bcc35=_0x488477;_0x2990d7['model']=_['keys'](db[_0x4bf6('0x6f')][_0x4bf6('0x41')]);_0x2990d7[_0x4bf6('0x45')]=_[_0x4bf6('0x44')](_0x59f281[_0x4bf6('0x45')]);_0x2990d7[_0x4bf6('0x50')]=_['intersection'](_0x2990d7[_0x4bf6('0x47')],_0x2990d7[_0x4bf6('0x45')]);_0x21eb01[_0x4bf6('0x48')]=_[_0x4bf6('0x46')](_0x2990d7[_0x4bf6('0x47')],qs['fields'](_0x59f281[_0x4bf6('0x45')][_0x4bf6('0x49')]));_0x21eb01[_0x4bf6('0x48')]=_0x21eb01['attributes'][_0x4bf6('0x4a')]?_0x21eb01['attributes']:_0x2990d7[_0x4bf6('0x47')];_0x21eb01[_0x4bf6('0x4d')]=qs[_0x4bf6('0x4e')](_0x59f281['query'][_0x4bf6('0x4e')]);_0x21eb01['where']=qs['filters'](_[_0x4bf6('0x67')](_0x59f281[_0x4bf6('0x45')],_0x2990d7[_0x4bf6('0x50')]));if(_0x59f281[_0x4bf6('0x45')][_0x4bf6('0x68')]){_0x21eb01[_0x4bf6('0x4f')]=_['merge'](_0x21eb01[_0x4bf6('0x4f')],{'$or':_['map'](_0x21eb01[_0x4bf6('0x48')],function(_0x5b79c9){var _0x40a4dd={};_0x40a4dd[_0x5b79c9]={'$like':'%'+_0x59f281[_0x4bf6('0x45')]['filter']+'%'};return _0x40a4dd;})});}_0x21eb01=_['merge']({},_0x21eb01,_0x59f281[_0x4bf6('0x56')]);return _0x3bcc35['getApplications'](_0x21eb01);}})[_0x4bf6('0x21')](function(_0x5166e3){if(_0x5166e3){_0x2cfb09=_0x5166e3['length'];if(!_0x59f281[_0x4bf6('0x45')][_0x4bf6('0x4b')]('nolimit')){_0x21eb01[_0x4bf6('0x30')]=qs['limit'](_0x59f281[_0x4bf6('0x45')][_0x4bf6('0x30')]);_0x21eb01[_0x4bf6('0x2e')]=qs[_0x4bf6('0x2e')](_0x59f281['query']['offset']);}return _0x3bcc35[_0x4bf6('0xbf')](_0x21eb01);}})[_0x4bf6('0x21')](function(_0xa0bcd6){if(_0xa0bcd6){return _0xa0bcd6?{'count':_0x2cfb09,'rows':_0xa0bcd6}:null;}})[_0x4bf6('0x21')](respondWithResult(_0x6136f4,null))['catch'](handleError(_0x6136f4,null));};exports[_0x4bf6('0xc0')]=function(_0x3c0fdd,_0x530cb3,_0x5847fd){var _0x22495b={'raw':![],'where':{}};var _0x501ebf={};var _0x565e84={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4bf6('0x66')]({'where':{'id':_0x3c0fdd[_0x4bf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x530cb3,null))[_0x4bf6('0x21')](function(_0x534e2b){if(_0x534e2b){_0x501ebf[_0x4bf6('0x47')]=_[_0x4bf6('0x44')](db[_0x4bf6('0xa1')]['rawAttributes']);_0x501ebf[_0x4bf6('0x45')]=_['keys'](_0x3c0fdd['query']);_0x501ebf[_0x4bf6('0x50')]=_[_0x4bf6('0x46')](_0x501ebf[_0x4bf6('0x47')],_0x501ebf[_0x4bf6('0x45')]);_0x22495b['attributes']=_['intersection'](_0x501ebf['model'],qs['fields'](_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0x49')]));_0x22495b[_0x4bf6('0x48')]=_0x22495b[_0x4bf6('0x48')][_0x4bf6('0x4a')]?_0x22495b[_0x4bf6('0x48')]:_0x501ebf[_0x4bf6('0x47')];if(!_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0x4b')](_0x4bf6('0x4c'))){_0x22495b[_0x4bf6('0x30')]=qs['limit'](_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0x30')]);_0x22495b[_0x4bf6('0x2e')]=qs[_0x4bf6('0x2e')](_0x3c0fdd['query']['offset']);}_0x22495b[_0x4bf6('0x4d')]=qs[_0x4bf6('0x4e')](_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0x4e')]);_0x22495b[_0x4bf6('0x4f')]=qs[_0x4bf6('0x50')](_[_0x4bf6('0x67')](_0x3c0fdd[_0x4bf6('0x45')],_0x501ebf[_0x4bf6('0x50')]));_0x22495b[_0x4bf6('0x4f')]['SmsAccountId']=_0x534e2b['id'];if(_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0x68')]){_0x22495b[_0x4bf6('0x4f')]=_[_0x4bf6('0x51')](_0x22495b[_0x4bf6('0x4f')],{'$or':_[_0x4bf6('0x3f')](_0x22495b[_0x4bf6('0x48')],function(_0x5d7217){var _0x7347={};_0x7347[_0x5d7217]={'$like':'%'+_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0x68')]+'%'};return _0x7347;})});}_0x22495b=_[_0x4bf6('0x51')]({},_0x22495b,_0x3c0fdd[_0x4bf6('0x56')]);return db[_0x4bf6('0xa1')][_0x4bf6('0x31')]({'where':_0x22495b[_0x4bf6('0x4f')]})[_0x4bf6('0x21')](function(_0x102260){_0x565e84['count']=_0x102260;if(_0x3c0fdd[_0x4bf6('0x45')]['includeAll']){_0x22495b['include']=[{'model':db['CmContact'],'as':_0x4bf6('0xc1'),'required':![]},{'model':db[_0x4bf6('0xc2')],'as':'Owner','attributes':[_0x4bf6('0x3a'),_0x4bf6('0xc3'),_0x4bf6('0xc4')],'required':![]},{'model':db[_0x4bf6('0xc5')],'as':'Tags','attributes':['id',_0x4bf6('0x3a'),_0x4bf6('0xc6')],'where':_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0xc7')]?{'id':_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0xc7')]}:undefined,'required':_0x3c0fdd[_0x4bf6('0x45')][_0x4bf6('0xc7')]?!![]:![]}];}return db[_0x4bf6('0xa1')][_0x4bf6('0x53')](_0x22495b);})[_0x4bf6('0x21')](function(_0x550267){_0x565e84['rows']=_0x550267;return _0x565e84;});}})[_0x4bf6('0x21')](respondWithFilteredResult(_0x530cb3,_0x22495b))[_0x4bf6('0x58')](handleError(_0x530cb3,null));};exports[_0x4bf6('0x3b')]=function(_0x36653a,_0x2defb2,_0x523fdc){var _0x4a63e5,_0xb4241c,_0x50bf9a;if(_[_0x4bf6('0x97')](_0x36653a[_0x4bf6('0x61')][_0x4bf6('0x61')])||_0x36653a[_0x4bf6('0x61')][_0x4bf6('0x61')]===''){throw new db[(_0x4bf6('0x77'))][(_0x4bf6('0x78'))](_0x4bf6('0x98'));}if(_[_0x4bf6('0x97')](_0x36653a[_0x4bf6('0x61')]['to'])){throw new db[(_0x4bf6('0x77'))][(_0x4bf6('0x78'))](_0x4bf6('0xc8'));}_0x4a63e5=_0x36653a[_0x4bf6('0x61')]['to'];return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x36653a['params']['id']},'include':[{'model':db[_0x4bf6('0x9d')],'as':_0x4bf6('0xc9'),'include':[{'model':db['CmContact'],'as':_0x4bf6('0x9e'),'where':{'mobile':_0x4a63e5},'limit':0x1,'order':[[_0x4bf6('0x7a'),_0x4bf6('0xca')]]}]}]})[_0x4bf6('0x21')](handleEntityNotFound(_0x2defb2,null))[_0x4bf6('0x21')](function(_0x446620){if(_0x446620&&_0x446620['List']){_0xb4241c=_0x446620[_0x4bf6('0x37')]({'plain':!![]});if(_0xb4241c[_0x4bf6('0xc9')]&&_0xb4241c[_0x4bf6('0xc9')]['Contacts'][_0x4bf6('0x4a')]){return _0xb4241c[_0x4bf6('0xc9')][_0x4bf6('0x9e')][0x0];}return db[_0x4bf6('0x76')]['create'](_[_0x4bf6('0x19')](_0x36653a[_0x4bf6('0x61')],{'firstName':_0x4a63e5,'mobile':_0x4a63e5,'phone':_0x4a63e5,'ListId':_0xb4241c['ListId']}));}})[_0x4bf6('0x21')](handleEntityNotFound(_0x2defb2,null))[_0x4bf6('0x21')](function(_0x97d6d2){if(_0x97d6d2){_0x50bf9a=_0x97d6d2;return db['SmsInteraction'][_0x4bf6('0x57')]({'where':{'ContactId':_0x50bf9a['id'],'closed':![],'SmsAccountId':_0xb4241c['id']}})['then'](function(_0x534346){if(_0x534346){return[_0x534346,![]];}return db['SmsInteraction'][_0x4bf6('0x59')]({'UserId':_0x36653a[_0x4bf6('0x5c')]['id'],'ContactId':_0x50bf9a['id'],'SmsAccountId':_0xb4241c['id'],'phone':_0x4a63e5,'firstMsgDirection':_0x4bf6('0xcb'),'Messages':[_[_0x4bf6('0x51')](_0x36653a[_0x4bf6('0x61')],{'read':![],'body':_0x36653a['body'][_0x4bf6('0x61')],'phone':_0x4a63e5,'SmsAccountId':_0xb4241c['id'],'UserId':_0x36653a[_0x4bf6('0x5c')]['id'],'ContactId':_0x50bf9a['id']})]},{'include':[{'model':db[_0x4bf6('0xcc')],'as':_0x4bf6('0xcd')}]})[_0x4bf6('0x21')](function(_0x5de87b){return[_0x5de87b,!![]];});});}})[_0x4bf6('0xa2')](function(_0x43b4d6,_0x10f71a){if(_0x10f71a){return _0x43b4d6;}return db[_0x4bf6('0xcc')][_0x4bf6('0x59')](_[_0x4bf6('0x51')](_0x36653a['body'],{'read':![],'body':_0x36653a[_0x4bf6('0x61')][_0x4bf6('0x61')],'phone':_0x4a63e5,'SmsAccountId':_0xb4241c['id'],'SmsInteractionId':_0x43b4d6['id'],'UserId':_0x36653a[_0x4bf6('0x5c')]['id'],'ContactId':_0x50bf9a['id']}))['then'](function(_0x133469){_0x43b4d6[_0x4bf6('0xce')][_0x4bf6('0xcd')]=[];_0x43b4d6[_0x4bf6('0xce')][_0x4bf6('0xcd')][_0x4bf6('0xa5')](_0x133469[_0x4bf6('0xce')]);return _0x43b4d6;});})['then'](respondWithResult(_0x2defb2,null))[_0x4bf6('0x58')](handleError(_0x2defb2,null));};exports[_0x4bf6('0x2b')]=function(_0x2b3dfc,_0xd50517,_0x3277cb){if(_0x2b3dfc[_0x4bf6('0x61')]['id']){delete _0x2b3dfc[_0x4bf6('0x61')]['id'];}var _0x2b35bc,_0x54a1d6,_0x258dc0;return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x2b3dfc[_0x4bf6('0x62')]['id']}})['then'](handleEntityNotFound(_0xd50517,null))[_0x4bf6('0x21')](function(_0x2d7b06){if(_0x2d7b06){_0x258dc0=_0x2d7b06;logger[_0x4bf6('0xb2')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4bf6('0x2b'),_0x4bf6('0xcf'),_0x2d7b06[_0x4bf6('0x42')],util[_0x4bf6('0xd0')](_0x2b3dfc['body'],{'showHidden':![],'depth':null}));switch(_0x2d7b06[_0x4bf6('0x42')]){case'skebby':if(_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0xd1')]&&_0x2b3dfc[_0x4bf6('0x61')]['status']){_0x54a1d6=_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0x2b')];return db[_0x4bf6('0xcc')][_0x4bf6('0x57')]({'where':{'messageId':_0x2b3dfc['body'][_0x4bf6('0xd1')]}});}break;case'connectel':if(_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0xd2')]&&_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0xd3')]){_0x54a1d6=_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0xd3')];return db[_0x4bf6('0xcc')][_0x4bf6('0x57')]({'where':{'messageId':_0x2b3dfc['body'][_0x4bf6('0xd2')]}});}break;case _0x4bf6('0x87'):if(_0x2b3dfc[_0x4bf6('0x61')]['message_id']&&_0x2b3dfc[_0x4bf6('0x61')]['status_code']){_0x54a1d6=_0x2b3dfc[_0x4bf6('0x61')]['status_code'];return db['SmsMessage'][_0x4bf6('0x57')]({'where':{'messageId':_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0x89')]}});}break;case _0x4bf6('0x8d'):var _0x4f54a7=_0x2b3dfc[_0x4bf6('0x61')]['results'][0x0];if(_0x4f54a7[_0x4bf6('0x88')]&&_0x4f54a7[_0x4bf6('0x2b')][_0x4bf6('0xd4')]===_0x4bf6('0xd5')){_0x54a1d6=_0x4f54a7['status'][_0x4bf6('0xd4')];return db[_0x4bf6('0xcc')]['find']({'where':{'messageId':_0x4f54a7[_0x4bf6('0x88')]}});}break;case'clickatell':if(_0x2b3dfc[_0x4bf6('0x61')]['messageId']&&_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0x2b')]){_0x54a1d6=_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0x2b')];return db[_0x4bf6('0xcc')][_0x4bf6('0x57')]({'where':{'messageId':_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0x88')]}});}break;case _0x4bf6('0x93'):if(_0x2b3dfc[_0x4bf6('0x61')][0x0][_0x4bf6('0x29')]['id']){_0x54a1d6=_0x2b3dfc[_0x4bf6('0x61')][0x0][_0x4bf6('0x42')];return db[_0x4bf6('0xcc')][_0x4bf6('0x57')]({'where':{'messageId':_0x2b3dfc[_0x4bf6('0x61')][0x0][_0x4bf6('0x29')]['id']}});}break;case _0x4bf6('0x94'):if(_0x2b3dfc[_0x4bf6('0x61')]['redif']&&_0x2b3dfc['body'][_0x4bf6('0x2b')]){_0x54a1d6=_0x2b3dfc['body']['status'];return db[_0x4bf6('0xcc')]['find']({'where':{'messageId':_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0xd6')]}});}break;}}})[_0x4bf6('0x21')](handleEntityNotFound(_0xd50517,null))[_0x4bf6('0x21')](function(_0xe64c19){if(_0xe64c19){_0x2b35bc=_0xe64c19;switch(_0x258dc0[_0x4bf6('0x42')]){case _0x4bf6('0x82'):if(_0x54a1d6===_0x4bf6('0xd5')){return _0x2b35bc['update']({'read':!![]});}else{logger[_0x4bf6('0x27')](_0x4bf6('0x25'),_0x4bf6('0x2b'),'skebby',util[_0x4bf6('0xd0')](_0x2b3dfc[_0x4bf6('0x61')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x54a1d6==='1'){return _0x2b35bc[_0x4bf6('0x60')]({'read':!![]});}else{logger[_0x4bf6('0x27')](_0x4bf6('0x25'),_0x4bf6('0x2b'),_0x4bf6('0x82'),util[_0x4bf6('0xd0')](_0x2b3dfc[_0x4bf6('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0xd7')]&&_0x54a1d6>=0xc8&&_0x54a1d6<=0xce){return _0x2b35bc[_0x4bf6('0x60')]({'read':!![]});}else{logger[_0x4bf6('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4bf6('0x2b'),_0x4bf6('0x87'),util['inspect'](_0x2b3dfc[_0x4bf6('0x61')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x40fde7=_0x2b3dfc[_0x4bf6('0x61')][_0x4bf6('0x8e')][0x0];if(_0x40fde7['status'][_0x4bf6('0xd4')]===_0x4bf6('0xd5')){return _0x2b35bc[_0x4bf6('0x60')]({'read':!![]});}else{logger[_0x4bf6('0x27')](_0x4bf6('0x25'),_0x4bf6('0x2b'),'infobip',util['inspect'](_0x2b3dfc[_0x4bf6('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4bf6('0xd8'):if(_0x54a1d6=='DELIVERED_TO_GATEWAY'||_0x54a1d6==_0x4bf6('0xd9')){return _0x2b35bc['update']({'read':!![]});}else{logger[_0x4bf6('0x27')](_0x4bf6('0x25'),'status',_0x4bf6('0xd8'),util[_0x4bf6('0xd0')](_0x2b3dfc[_0x4bf6('0x61')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x54a1d6==_0x4bf6('0xda')){return _0x2b35bc['update']({'read':!![]});}else{logger[_0x4bf6('0x27')](_0x4bf6('0x25'),_0x4bf6('0x2b'),'bandwidth',util['inspect'](_0x2b3dfc[_0x4bf6('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4bf6('0x94'):if(_0x54a1d6==='DELIVRD'||_0x54a1d6===_0x4bf6('0xdb')){return _0x2b35bc[_0x4bf6('0x60')]({'read':!![]});}else{logger['error'](_0x4bf6('0x25'),_0x4bf6('0x2b'),_0x4bf6('0x94'),util[_0x4bf6('0xd0')](_0x2b3dfc['body'],{'showHidden':![],'depth':null}));}break;}return _0x2b35bc;}})[_0x4bf6('0x21')](respondWithResult(_0xd50517,null))['catch'](handleError(_0xd50517,null));};exports[_0x4bf6('0xdc')]=function(_0x407e1b,_0x409334,_0x121ad0){var _0x11a10b,_0x51b43c,_0x2badda;return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x407e1b[_0x4bf6('0x62')]['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x409334,null))[_0x4bf6('0x21')](function(_0x3a4f6e){if(_0x3a4f6e){_0x2badda=_0x3a4f6e;logger['debug'](_0x4bf6('0x25'),_0x4bf6('0x2b'),'received\x20delivery\x20report\x20from',_0x3a4f6e[_0x4bf6('0x42')],util['inspect'](_0x407e1b[_0x4bf6('0x45')],{'showHidden':![],'depth':null}));switch(_0x3a4f6e['type']){case _0x4bf6('0xdd'):if(_0x407e1b['query'][_0x4bf6('0xde')]&&_0x407e1b['query']['state']){_0x51b43c=_0x407e1b[_0x4bf6('0x45')][_0x4bf6('0xdf')];return db[_0x4bf6('0xcc')][_0x4bf6('0x57')]({'where':{'messageId':_0x407e1b[_0x4bf6('0x45')][_0x4bf6('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x409334,null))[_0x4bf6('0x21')](function(_0x2e3e32){if(_0x2e3e32){_0x11a10b=_0x2e3e32;switch(_0x2badda['type']){case _0x4bf6('0xdd'):if(_0x51b43c==='2'||_0x51b43c==='6'){return _0x11a10b[_0x4bf6('0x60')]({'read':!![]});}else{logger[_0x4bf6('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4bf6('0x2b'),_0x4bf6('0xdd'),util[_0x4bf6('0xd0')](_0x407e1b[_0x4bf6('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x11a10b;}})[_0x4bf6('0x21')](respondWithResult(_0x409334,null))[_0x4bf6('0x58')](handleError(_0x409334,null));};exports[_0x4bf6('0xe0')]=function(_0x18204d,_0x20f4e9,_0x1704df){return db[_0x4bf6('0x40')]['find']({'where':{'id':_0x18204d[_0x4bf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x20f4e9,null))['then'](function(_0x4ea147){if(_0x4ea147){return _0x4ea147[_0x4bf6('0xe0')](_0x18204d[_0x4bf6('0x61')][_0x4bf6('0x6b')],_[_0x4bf6('0xa0')](_0x18204d['body'],[_0x4bf6('0x6b'),'id'])||{})[_0x4bf6('0xa2')](function(_0x3ea1f0){for(var _0x2cbc79=0x0;_0x2cbc79<_0x18204d['body']['ids'][_0x4bf6('0x4a')];_0x2cbc79+=0x1){socket[_0x4bf6('0xe1')](_0x4bf6('0xe2'),{'UserId':Number(_0x18204d[_0x4bf6('0x61')][_0x4bf6('0x6b')][_0x2cbc79]),'SmsAccountId':Number(_0x18204d[_0x4bf6('0x62')]['id'])});}return _0x3ea1f0;});}})['then'](respondWithResult(_0x20f4e9,null))[_0x4bf6('0x58')](handleError(_0x20f4e9,null));};exports[_0x4bf6('0xe3')]=function(_0x5009f2,_0x1fe80a,_0x393a3c){return db[_0x4bf6('0x40')][_0x4bf6('0x57')]({'where':{'id':_0x5009f2['params']['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x1fe80a,null))['then'](function(_0xc19e12){if(_0xc19e12){return _0xc19e12[_0x4bf6('0xe3')](_0x5009f2[_0x4bf6('0x45')][_0x4bf6('0x6b')])['then'](function(){if(_[_0x4bf6('0xe4')](_0x5009f2[_0x4bf6('0x45')][_0x4bf6('0x6b')])){for(var _0x455847=0x0;_0x455847<_0x5009f2['query']['ids'][_0x4bf6('0x4a')];_0x455847+=0x1){socket[_0x4bf6('0xe1')](_0x4bf6('0xe5'),{'UserId':Number(_0x5009f2[_0x4bf6('0x45')]['ids'][_0x455847]),'SmsAccountId':Number(_0x5009f2['params']['id'])});}}else{socket[_0x4bf6('0xe1')](_0x4bf6('0xe5'),{'UserId':Number(_0x5009f2[_0x4bf6('0x45')][_0x4bf6('0x6b')]),'SmsAccountId':Number(_0x5009f2[_0x4bf6('0x62')]['id'])});}});}})[_0x4bf6('0x21')](respondWithStatusCode(_0x1fe80a,null))[_0x4bf6('0x58')](handleError(_0x1fe80a,null));};exports[_0x4bf6('0xe6')]=function(_0x447f18,_0x31070d,_0x3bf2b9){var _0x564e8d={};var _0x3a7f50={};var _0x23e755;var _0x163668;return db[_0x4bf6('0x40')]['findOne']({'where':{'id':_0x447f18[_0x4bf6('0x62')]['id']}})[_0x4bf6('0x21')](handleEntityNotFound(_0x31070d,null))['then'](function(_0x396636){if(_0x396636){_0x23e755=_0x396636;_0x3a7f50['model']=_[_0x4bf6('0x44')](db[_0x4bf6('0xc2')][_0x4bf6('0x41')]);_0x3a7f50['query']=_[_0x4bf6('0x44')](_0x447f18['query']);_0x3a7f50['filters']=_['intersection'](_0x3a7f50['model'],_0x3a7f50[_0x4bf6('0x45')]);_0x564e8d['attributes']=_[_0x4bf6('0x46')](_0x3a7f50[_0x4bf6('0x47')],qs[_0x4bf6('0x49')](_0x447f18[_0x4bf6('0x45')][_0x4bf6('0x49')]));_0x564e8d[_0x4bf6('0x48')]=_0x564e8d['attributes'][_0x4bf6('0x4a')]?_0x564e8d[_0x4bf6('0x48')]:_0x3a7f50[_0x4bf6('0x47')];_0x564e8d[_0x4bf6('0x4d')]=qs[_0x4bf6('0x4e')](_0x447f18[_0x4bf6('0x45')]['sort']);_0x564e8d['where']=qs['filters'](_[_0x4bf6('0x67')](_0x447f18['query'],_0x3a7f50[_0x4bf6('0x50')]));if(_0x447f18['query'][_0x4bf6('0x68')]){_0x564e8d[_0x4bf6('0x4f')]=_['merge'](_0x564e8d[_0x4bf6('0x4f')],{'$or':_['map'](_0x564e8d[_0x4bf6('0x48')],function(_0x105708){var _0x40ddeb={};_0x40ddeb[_0x105708]={'$like':'%'+_0x447f18['query']['filter']+'%'};return _0x40ddeb;})});}_0x564e8d=_[_0x4bf6('0x51')]({},_0x564e8d,_0x447f18[_0x4bf6('0x56')]);return _0x23e755[_0x4bf6('0xe6')](_0x564e8d);}})[_0x4bf6('0x21')](function(_0x5e4562){if(_0x5e4562){_0x163668=_0x5e4562['length'];if(!_0x447f18[_0x4bf6('0x45')][_0x4bf6('0x4b')](_0x4bf6('0x4c'))){_0x564e8d['limit']=qs[_0x4bf6('0x30')](_0x447f18[_0x4bf6('0x45')][_0x4bf6('0x30')]);_0x564e8d[_0x4bf6('0x2e')]=qs['offset'](_0x447f18[_0x4bf6('0x45')][_0x4bf6('0x2e')]);}return _0x23e755[_0x4bf6('0xe6')](_0x564e8d);}})[_0x4bf6('0x21')](function(_0x56569){if(_0x56569){return _0x56569?{'count':_0x163668,'rows':_0x56569}:null;}})[_0x4bf6('0x21')](respondWithResult(_0x31070d,null))[_0x4bf6('0x58')](handleError(_0x31070d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 535a20f..2b684fa 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 _0xa099=['exports','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x39c012,_0x397c30){var _0x139ce5=function(_0x1e0759){while(--_0x1e0759){_0x39c012['push'](_0x39c012['shift']());}};_0x139ce5(++_0x397c30);}(_0xa099,0x69));var _0x9a09=function(_0x2b6c6d,_0x419c5c){_0x2b6c6d=_0x2b6c6d-0x0;var _0x3c889f=_0xa099[_0x2b6c6d];return _0x3c889f;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9a09('0x0')](0x0);var events={'afterCreate':_0x9a09('0x1'),'afterUpdate':_0x9a09('0x2'),'afterDestroy':_0x9a09('0x3')};function emitEvent(_0x38c674){return function(_0x31f6e2,_0x36aed9,_0x4796e6){SmsAccountEvents[_0x9a09('0x4')](_0x38c674+':'+_0x31f6e2['id'],_0x31f6e2);SmsAccountEvents[_0x9a09('0x4')](_0x38c674,_0x31f6e2);_0x4796e6(null);};}for(var e in events){if(events[_0x9a09('0x5')](e)){var event=events[e];SmsAccount[_0x9a09('0x6')](e,emitEvent(event));}}module[_0x9a09('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xa43d=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xa43d,0xb5));var _0xda43=function(_0x4c67b8,_0x571e13){_0x4c67b8=_0x4c67b8-0x0;var _0xbc26e=_0xa43d[_0x4c67b8];return _0xbc26e;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xda43('0x0'))['db'][_0xda43('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xda43('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xda43('0x3')};function emitEvent(_0x994e7d){return function(_0x11385d,_0x27d2ab,_0x22f063){SmsAccountEvents[_0xda43('0x4')](_0x994e7d+':'+_0x11385d['id'],_0x11385d);SmsAccountEvents[_0xda43('0x4')](_0x994e7d,_0x11385d);_0x22f063(null);};}for(var e in events){if(events[_0xda43('0x5')](e)){var event=events[e];SmsAccount[_0xda43('0x6')](e,emitEvent(event));}}module[_0xda43('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 88dba01..0a2fe9e 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 _0x2c10=['exports','sms_accounts','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c10,0xc8));var _0x02c1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2c10[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02c1('0x0'))(_0x02c1('0x1'));var moment=require('moment');var BPromise=require(_0x02c1('0x2'));var rp=require(_0x02c1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02c1('0x4'));var config=require(_0x02c1('0x5'));var attributes=require(_0x02c1('0x6'));module[_0x02c1('0x7')]=function(_0x255086,_0x16f9a3){return _0x255086['define']('SmsAccount',attributes,{'tableName':_0x02c1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd44f=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x1d3c43,_0x1a6225){var _0x4791d3=function(_0x3ba0d4){while(--_0x3ba0d4){_0x1d3c43['push'](_0x1d3c43['shift']());}};_0x4791d3(++_0x1a6225);}(_0xd44f,0x18c));var _0xfd44=function(_0x1d2d4c,_0x340107){_0x1d2d4c=_0x1d2d4c-0x0;var _0x58ed56=_0xd44f[_0x1d2d4c];return _0x58ed56;};'use strict';var _=require(_0xfd44('0x0'));var util=require(_0xfd44('0x1'));var logger=require('../../config/logger')(_0xfd44('0x2'));var moment=require(_0xfd44('0x3'));var BPromise=require(_0xfd44('0x4'));var rp=require(_0xfd44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd44('0x6'));var config=require(_0xfd44('0x7'));var attributes=require(_0xfd44('0x8'));module[_0xfd44('0x9')]=function(_0x1c126a,_0x5dff8a){return _0x1c126a[_0xfd44('0xa')](_0xfd44('0xb'),attributes,{'tableName':_0xfd44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 8b35f03..b9c987c 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 _0x2621=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','attributes','include','map','model','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket'];(function(_0x336119,_0x500c63){var _0x1b3399=function(_0x1a9d31){while(--_0x1a9d31){_0x336119['push'](_0x336119['shift']());}};_0x1b3399(++_0x500c63);}(_0x2621,0xa1));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1262('0x0'));var moment=require('moment');var BPromise=require(_0x1262('0x1'));var rs=require(_0x1262('0x2'));var fs=require('fs');var Redis=require(_0x1262('0x3'));var db=require(_0x1262('0x4'))['db'];var utils=require(_0x1262('0x5'));var logger=require(_0x1262('0x6'))(_0x1262('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1262('0x8')][_0x1262('0x9')]({'port':0x232a});config[_0x1262('0xa')]=_[_0x1262('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1262('0xc'))(new Redis(config[_0x1262('0xa')]));require(_0x1262('0xd'))['register'](socket);function respondWithRpcPromise(_0x78c8fe,_0x3ad6ac,_0x1c2fa9){return new BPromise(function(_0x34b7fa,_0x2f5fb0){return client['request'](_0x78c8fe,_0x1c2fa9)['then'](function(_0x32689b){logger[_0x1262('0xe')](_0x1262('0xf'),_0x3ad6ac,_0x1262('0x10'));logger[_0x1262('0x11')](_0x1262('0x12'),_0x3ad6ac,_0x1262('0x10'),JSON[_0x1262('0x13')](_0x32689b));if(_0x32689b['error']){if(_0x32689b[_0x1262('0x14')][_0x1262('0x15')]===0x1f4){logger[_0x1262('0x14')]('SmsAccount,\x20%s,\x20%s',_0x3ad6ac,_0x32689b[_0x1262('0x14')][_0x1262('0x16')]);return _0x2f5fb0(_0x32689b[_0x1262('0x14')][_0x1262('0x16')]);}logger['error'](_0x1262('0xf'),_0x3ad6ac,_0x32689b['error']['message']);return _0x34b7fa(_0x32689b[_0x1262('0x14')][_0x1262('0x16')]);}else{logger[_0x1262('0xe')](_0x1262('0xf'),_0x3ad6ac,'request\x20sent');_0x34b7fa(_0x32689b[_0x1262('0x17')][_0x1262('0x16')]);}})[_0x1262('0x18')](function(_0x2ff146){logger[_0x1262('0x14')](_0x1262('0xf'),_0x3ad6ac,_0x2ff146);_0x2f5fb0(_0x2ff146);});});}exports[_0x1262('0x19')]=function(_0xac9547){var _0x3573f4=this;return new Promise(function(_0x4d9ce5,_0x30af4e){return db[_0x1262('0x1a')][_0x1262('0x1b')]({'raw':_0xac9547['options']?_0xac9547['options'][_0x1262('0x1c')]===undefined?!![]:![]:!![],'where':_0xac9547['options']?_0xac9547['options']['where']||null:null,'attributes':_0xac9547[_0x1262('0x1d')]?_0xac9547[_0x1262('0x1d')][_0x1262('0x1e')]||null:null,'include':_0xac9547[_0x1262('0x1d')]?_0xac9547[_0x1262('0x1d')][_0x1262('0x1f')]?_[_0x1262('0x20')](_0xac9547[_0x1262('0x1d')][_0x1262('0x1f')],function(_0x328dd4){return{'model':db[_0x328dd4[_0x1262('0x21')]],'as':_0x328dd4['as'],'attributes':_0x328dd4[_0x1262('0x1e')],'include':_0x328dd4[_0x1262('0x1f')]?_[_0x1262('0x20')](_0x328dd4[_0x1262('0x1f')],function(_0x24a381){return{'model':db[_0x24a381[_0x1262('0x21')]],'as':_0x24a381['as'],'attributes':_0x24a381[_0x1262('0x1e')],'include':_0x24a381[_0x1262('0x1f')]?_[_0x1262('0x20')](_0x24a381[_0x1262('0x1f')],function(_0x4c32ba){return{'model':db[_0x4c32ba['model']],'as':_0x4c32ba['as'],'attributes':_0x4c32ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x1262('0x22')](function(_0x296099){logger[_0x1262('0xe')]('ShowSmsAccount',_0xac9547);logger[_0x1262('0x11')](_0x1262('0x19'),_0xac9547,JSON[_0x1262('0x13')](_0x296099));_0x4d9ce5(_0x296099);})[_0x1262('0x18')](function(_0x1e433f){logger[_0x1262('0x14')](_0x1262('0x19'),_0x1e433f['message'],_0xac9547);_0x30af4e(_0x3573f4['error'](0x1f4,_0x1e433f[_0x1262('0x16')]));});});}; \ No newline at end of file +var _0x81ea=['request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','attributes','map','include','model','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./smsAccount.socket','register'];(function(_0x1a2d42,_0x3ba183){var _0x5429ff=function(_0x4afede){while(--_0x4afede){_0x1a2d42['push'](_0x1a2d42['shift']());}};_0x5429ff(++_0x3ba183);}(_0x81ea,0x17c));var _0xa81e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x81ea[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa81e('0x0'));var util=require('util');var moment=require(_0xa81e('0x1'));var BPromise=require(_0xa81e('0x2'));var rs=require(_0xa81e('0x3'));var fs=require('fs');var Redis=require(_0xa81e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa81e('0x5'));var logger=require(_0xa81e('0x6'))(_0xa81e('0x7'));var config=require(_0xa81e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa81e('0x9')][_0xa81e('0xa')]({'port':0x232a});config['redis']=_[_0xa81e('0xb')](config[_0xa81e('0xc')],{'host':_0xa81e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa81e('0xc')]));require(_0xa81e('0xe'))[_0xa81e('0xf')](socket);function respondWithRpcPromise(_0x5590af,_0x5d74ba,_0xddf692){return new BPromise(function(_0x4f6f80,_0x2fba28){return client[_0xa81e('0x10')](_0x5590af,_0xddf692)[_0xa81e('0x11')](function(_0x58b517){logger[_0xa81e('0x12')](_0xa81e('0x13'),_0x5d74ba,_0xa81e('0x14'));logger[_0xa81e('0x15')](_0xa81e('0x16'),_0x5d74ba,_0xa81e('0x14'),JSON[_0xa81e('0x17')](_0x58b517));if(_0x58b517['error']){if(_0x58b517[_0xa81e('0x18')][_0xa81e('0x19')]===0x1f4){logger[_0xa81e('0x18')]('SmsAccount,\x20%s,\x20%s',_0x5d74ba,_0x58b517[_0xa81e('0x18')]['message']);return _0x2fba28(_0x58b517[_0xa81e('0x18')][_0xa81e('0x1a')]);}logger[_0xa81e('0x18')](_0xa81e('0x13'),_0x5d74ba,_0x58b517['error']['message']);return _0x4f6f80(_0x58b517[_0xa81e('0x18')][_0xa81e('0x1a')]);}else{logger[_0xa81e('0x12')]('SmsAccount,\x20%s,\x20%s',_0x5d74ba,_0xa81e('0x14'));_0x4f6f80(_0x58b517[_0xa81e('0x1b')][_0xa81e('0x1a')]);}})['catch'](function(_0xf01a5f){logger[_0xa81e('0x18')](_0xa81e('0x13'),_0x5d74ba,_0xf01a5f);_0x2fba28(_0xf01a5f);});});}exports['ShowSmsAccount']=function(_0x28e11c){var _0x189d7c=this;return new Promise(function(_0x21cbd4,_0x12963c){return db['SmsAccount']['find']({'raw':_0x28e11c[_0xa81e('0x1c')]?_0x28e11c[_0xa81e('0x1c')][_0xa81e('0x1d')]===undefined?!![]:![]:!![],'where':_0x28e11c[_0xa81e('0x1c')]?_0x28e11c[_0xa81e('0x1c')]['where']||null:null,'attributes':_0x28e11c[_0xa81e('0x1c')]?_0x28e11c[_0xa81e('0x1c')][_0xa81e('0x1e')]||null:null,'include':_0x28e11c['options']?_0x28e11c[_0xa81e('0x1c')]['include']?_[_0xa81e('0x1f')](_0x28e11c['options'][_0xa81e('0x20')],function(_0x51caaf){return{'model':db[_0x51caaf[_0xa81e('0x21')]],'as':_0x51caaf['as'],'attributes':_0x51caaf[_0xa81e('0x1e')],'include':_0x51caaf[_0xa81e('0x20')]?_[_0xa81e('0x1f')](_0x51caaf[_0xa81e('0x20')],function(_0xd47887){return{'model':db[_0xd47887[_0xa81e('0x21')]],'as':_0xd47887['as'],'attributes':_0xd47887[_0xa81e('0x1e')],'include':_0xd47887[_0xa81e('0x20')]?_[_0xa81e('0x1f')](_0xd47887['include'],function(_0x58991c){return{'model':db[_0x58991c[_0xa81e('0x21')]],'as':_0x58991c['as'],'attributes':_0x58991c[_0xa81e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa81e('0x11')](function(_0x2f88f7){logger[_0xa81e('0x12')](_0xa81e('0x22'),_0x28e11c);logger[_0xa81e('0x15')](_0xa81e('0x22'),_0x28e11c,JSON['stringify'](_0x2f88f7));_0x21cbd4(_0x2f88f7);})[_0xa81e('0x23')](function(_0x3c8e64){logger['error'](_0xa81e('0x22'),_0x3c8e64[_0xa81e('0x1a')],_0x28e11c);_0x12963c(_0x189d7c[_0xa81e('0x18')](0x1f4,_0x3c8e64[_0xa81e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index cbcc55a..beac655 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 33c47ce..33f099b 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x5e6a45,_0x1ef926){var _0x9ab3de=function(_0x528e50){while(--_0x528e50){_0x5e6a45['push'](_0x5e6a45['shift']());}};_0x9ab3de(++_0x1ef926);}(_0x008c,0x188));var _0xc008=function(_0x1146f7,_0x475356){_0x1146f7=_0x1146f7-0x0;var _0x2e5725=_0x008c[_0x1146f7];return _0x2e5725;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5b7d5b,_0x5055d9){var _0x3c9abe=function(_0xc864a2){while(--_0xc864a2){_0x5b7d5b['push'](_0x5b7d5b['shift']());}};_0x3c9abe(++_0x5055d9);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index eb75a9a..10c1a60 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 _0x1d31=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1d31,0x94));var _0x11d3=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x1d31[_0x1c34e7];return _0x378cb1;};'use strict';var Sequelize=require(_0x11d3('0x0'));module[_0x11d3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x11d3('0x2')],'allowNull':![],'defaultValue':_0x11d3('0x3')},'appdata':{'type':Sequelize[_0x11d3('0x4')]()},'description':{'type':Sequelize[_0x11d3('0x2')]},'interval':{'type':Sequelize[_0x11d3('0x2')],'defaultValue':_0x11d3('0x5')}}; \ No newline at end of file +var _0x6ae1=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x59e1a5,_0x16d072){var _0x57adb4=function(_0x1c631b){while(--_0x1c631b){_0x59e1a5['push'](_0x59e1a5['shift']());}};_0x57adb4(++_0x16d072);}(_0x6ae1,0x10f));var _0x16ae=function(_0x9b5467,_0x1d245e){_0x9b5467=_0x9b5467-0x0;var _0x3e940c=_0x6ae1[_0x9b5467];return _0x3e940c;};'use strict';var Sequelize=require(_0x16ae('0x0'));module[_0x16ae('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x16ae('0x2')],'allowNull':![],'defaultValue':_0x16ae('0x3')},'appdata':{'type':Sequelize[_0x16ae('0x4')]()},'description':{'type':Sequelize[_0x16ae('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x16ae('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4d6fa8b..1522c32 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 _0x5892=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','sendStatus','name','send','index','map','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','SmsApplication','includeAll','include','rows','show','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5892,0x7c));var _0x2589=function(_0x10a1d1,_0x295159){_0x10a1d1=_0x10a1d1-0x0;var _0x10b75f=_0x5892[_0x10a1d1];return _0x10b75f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2589('0x0'));var zipdir=require(_0x2589('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2589('0x2'));var moment=require(_0x2589('0x3'));var BPromise=require(_0x2589('0x4'));var Mustache=require(_0x2589('0x5'));var util=require('util');var path=require(_0x2589('0x6'));var sox=require('sox');var csv=require(_0x2589('0x7'));var ejs=require(_0x2589('0x8'));var fs=require('fs');var fs_extra=require(_0x2589('0x9'));var _=require(_0x2589('0xa'));var squel=require('squel');var crypto=require(_0x2589('0xb'));var jsforce=require(_0x2589('0xc'));var deskjs=require(_0x2589('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2589('0xe'));var Redis=require(_0x2589('0xf'));var authService=require(_0x2589('0x10'));var qs=require(_0x2589('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2589('0x12'));var logger=require(_0x2589('0x13'))(_0x2589('0x14'));var utils=require(_0x2589('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2589('0x16'))['db'];function respondWithStatusCode(_0x4d1d61,_0xf9c4ca){_0xf9c4ca=_0xf9c4ca||0xcc;return function(_0x5416b1){if(_0x5416b1){return _0x4d1d61['sendStatus'](_0xf9c4ca);}return _0x4d1d61[_0x2589('0x17')](_0xf9c4ca)[_0x2589('0x18')]();};}function respondWithResult(_0x2d156a,_0x406aed){_0x406aed=_0x406aed||0xc8;return function(_0x1053d5){if(_0x1053d5){return _0x2d156a['status'](_0x406aed)[_0x2589('0x19')](_0x1053d5);}};}function respondWithFilteredResult(_0x1fdea6,_0x27eb26){return function(_0x5a5bc6){if(_0x5a5bc6){var _0x1cc1e7=typeof _0x27eb26[_0x2589('0x1a')]===_0x2589('0x1b')&&typeof _0x27eb26[_0x2589('0x1c')]===_0x2589('0x1b');var _0x3c2d37=_0x5a5bc6[_0x2589('0x1d')];var _0x1211f6=_0x1cc1e7?0x0:_0x27eb26[_0x2589('0x1a')];var _0x508a3f=_0x1cc1e7?_0x5a5bc6['count']:_0x27eb26[_0x2589('0x1a')]+_0x27eb26[_0x2589('0x1c')];var _0x1f6b8a;if(_0x508a3f>=_0x3c2d37){_0x508a3f=_0x3c2d37;_0x1f6b8a=0xc8;}else{_0x1f6b8a=0xce;}_0x1fdea6[_0x2589('0x17')](_0x1f6b8a);return _0x1fdea6[_0x2589('0x1e')](_0x2589('0x1f'),_0x1211f6+'-'+_0x508a3f+'/'+_0x3c2d37)[_0x2589('0x19')](_0x5a5bc6);}return null;};}function patchUpdates(_0x595f8c){return function(_0x2634aa){try{jsonpatch['apply'](_0x2634aa,_0x595f8c,!![]);}catch(_0x4e4c99){return BPromise['reject'](_0x4e4c99);}return _0x2634aa[_0x2589('0x20')]();};}function saveUpdates(_0x3f8ec1,_0x1eae53){return function(_0x40fa39){if(_0x40fa39){return _0x40fa39['update'](_0x3f8ec1)['then'](function(_0x541b82){return _0x541b82;});}return null;};}function removeEntity(_0xce93dc,_0x212bb0){return function(_0x5568c2){if(_0x5568c2){return _0x5568c2[_0x2589('0x21')]()[_0x2589('0x22')](function(){_0xce93dc[_0x2589('0x17')](0xcc)[_0x2589('0x18')]();});}};}function handleEntityNotFound(_0xbea667,_0xd5e669){return function(_0x4785cb){if(!_0x4785cb){_0xbea667[_0x2589('0x23')](0x194);}return _0x4785cb;};}function handleError(_0x4a3e14,_0x41506a){_0x41506a=_0x41506a||0x1f4;return function(_0x1bd8d6){logger['error'](_0x1bd8d6['stack']);if(_0x1bd8d6[_0x2589('0x24')]){delete _0x1bd8d6[_0x2589('0x24')];}_0x4a3e14[_0x2589('0x17')](_0x41506a)[_0x2589('0x25')](_0x1bd8d6);};}exports[_0x2589('0x26')]=function(_0x176486,_0x14d67b){var _0x4b57de={},_0x9fd714={},_0x7c4b09={'count':0x0,'rows':[]};var _0x5bc981=_[_0x2589('0x27')](db['SmsApplication'][_0x2589('0x28')],function(_0x170fab){return{'name':_0x170fab[_0x2589('0x29')],'type':_0x170fab['type'][_0x2589('0x2a')]};});_0x9fd714['model']=_[_0x2589('0x27')](_0x5bc981,'name');_0x9fd714[_0x2589('0x2b')]=_[_0x2589('0x2c')](_0x176486[_0x2589('0x2b')]);_0x9fd714['filters']=_['intersection'](_0x9fd714[_0x2589('0x2d')],_0x9fd714[_0x2589('0x2b')]);_0x4b57de[_0x2589('0x2e')]=_[_0x2589('0x2f')](_0x9fd714[_0x2589('0x2d')],qs[_0x2589('0x30')](_0x176486[_0x2589('0x2b')][_0x2589('0x30')]));_0x4b57de['attributes']=_0x4b57de['attributes'][_0x2589('0x31')]?_0x4b57de[_0x2589('0x2e')]:_0x9fd714[_0x2589('0x2d')];if(!_0x176486[_0x2589('0x2b')][_0x2589('0x32')](_0x2589('0x33'))){_0x4b57de['limit']=qs[_0x2589('0x1c')](_0x176486[_0x2589('0x2b')][_0x2589('0x1c')]);_0x4b57de[_0x2589('0x1a')]=qs[_0x2589('0x1a')](_0x176486[_0x2589('0x2b')][_0x2589('0x1a')]);}_0x4b57de['order']=qs[_0x2589('0x34')](_0x176486[_0x2589('0x2b')][_0x2589('0x34')]);_0x4b57de[_0x2589('0x35')]=qs[_0x2589('0x36')](_[_0x2589('0x37')](_0x176486[_0x2589('0x2b')],_0x9fd714[_0x2589('0x36')]),_0x5bc981);if(_0x176486[_0x2589('0x2b')][_0x2589('0x38')]){_0x4b57de[_0x2589('0x35')]=_[_0x2589('0x39')](_0x4b57de['where'],{'$or':_[_0x2589('0x27')](_0x5bc981,function(_0xa0836a){if(_0xa0836a[_0x2589('0x3a')]!==_0x2589('0x3b')){var _0x5922af={};_0x5922af[_0xa0836a['name']]={'$like':'%'+_0x176486[_0x2589('0x2b')][_0x2589('0x38')]+'%'};return _0x5922af;}})});}_0x4b57de=_[_0x2589('0x39')]({},_0x4b57de,_0x176486['options']);var _0x1017ca={'where':_0x4b57de[_0x2589('0x35')]};return db[_0x2589('0x3c')][_0x2589('0x1d')](_0x1017ca)[_0x2589('0x22')](function(_0x3269e0){_0x7c4b09['count']=_0x3269e0;if(_0x176486[_0x2589('0x2b')][_0x2589('0x3d')]){_0x4b57de[_0x2589('0x3e')]=[{'all':!![]}];}return db[_0x2589('0x3c')]['findAll'](_0x4b57de);})[_0x2589('0x22')](function(_0x4be4b9){_0x7c4b09[_0x2589('0x3f')]=_0x4be4b9;return _0x7c4b09;})[_0x2589('0x22')](respondWithFilteredResult(_0x14d67b,_0x4b57de))['catch'](handleError(_0x14d67b,null));};exports[_0x2589('0x40')]=function(_0x214212,_0x2bb1d6){var _0x2a916b={'raw':!![],'where':{'id':_0x214212[_0x2589('0x41')]['id']}},_0x3f9b39={};_0x3f9b39['model']=_[_0x2589('0x2c')](db['SmsApplication'][_0x2589('0x28')]);_0x3f9b39[_0x2589('0x2b')]=_['keys'](_0x214212[_0x2589('0x2b')]);_0x3f9b39['filters']=_[_0x2589('0x2f')](_0x3f9b39[_0x2589('0x2d')],_0x3f9b39[_0x2589('0x2b')]);_0x2a916b[_0x2589('0x2e')]=_['intersection'](_0x3f9b39[_0x2589('0x2d')],qs[_0x2589('0x30')](_0x214212[_0x2589('0x2b')][_0x2589('0x30')]));_0x2a916b[_0x2589('0x2e')]=_0x2a916b[_0x2589('0x2e')][_0x2589('0x31')]?_0x2a916b[_0x2589('0x2e')]:_0x3f9b39[_0x2589('0x2d')];if(_0x214212[_0x2589('0x2b')][_0x2589('0x3d')]){_0x2a916b[_0x2589('0x3e')]=[{'all':!![]}];}_0x2a916b=_[_0x2589('0x39')]({},_0x2a916b,_0x214212['options']);return db[_0x2589('0x3c')][_0x2589('0x42')](_0x2a916b)['then'](handleEntityNotFound(_0x2bb1d6,null))[_0x2589('0x22')](respondWithResult(_0x2bb1d6,null))[_0x2589('0x43')](handleError(_0x2bb1d6,null));};exports[_0x2589('0x44')]=function(_0x350c6d,_0xca5902){return db['SmsApplication'][_0x2589('0x44')](_0x350c6d[_0x2589('0x45')],{})[_0x2589('0x22')](respondWithResult(_0xca5902,0xc9))[_0x2589('0x43')](handleError(_0xca5902,null));};exports['update']=function(_0x2667f6,_0x2a1416){if(_0x2667f6[_0x2589('0x45')]['id']){delete _0x2667f6[_0x2589('0x45')]['id'];}return db[_0x2589('0x3c')][_0x2589('0x42')]({'where':{'id':_0x2667f6[_0x2589('0x41')]['id']}})[_0x2589('0x22')](handleEntityNotFound(_0x2a1416,null))['then'](saveUpdates(_0x2667f6[_0x2589('0x45')],null))['then'](respondWithResult(_0x2a1416,null))[_0x2589('0x43')](handleError(_0x2a1416,null));};exports[_0x2589('0x21')]=function(_0x3fa3db,_0x4961a9){return db[_0x2589('0x3c')][_0x2589('0x42')]({'where':{'id':_0x3fa3db[_0x2589('0x41')]['id']}})[_0x2589('0x22')](handleEntityNotFound(_0x4961a9,null))['then'](removeEntity(_0x4961a9,null))[_0x2589('0x43')](handleError(_0x4961a9,null));}; \ No newline at end of file +var _0xdab1=['show','params','find','create','body','eml-format','rimraf','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','SmsApplication','findAll','rows','catch'];(function(_0x505dd9,_0x227339){var _0x4f2b64=function(_0x1f6ae8){while(--_0x1f6ae8){_0x505dd9['push'](_0x505dd9['shift']());}};_0x4f2b64(++_0x227339);}(_0xdab1,0x1c1));var _0x1dab=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xdab1[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0x1dab('0x0'));var rimraf=require(_0x1dab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1dab('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1dab('0x3'));var util=require(_0x1dab('0x4'));var path=require(_0x1dab('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1dab('0x6'));var fs=require('fs');var fs_extra=require(_0x1dab('0x7'));var _=require(_0x1dab('0x8'));var squel=require(_0x1dab('0x9'));var crypto=require(_0x1dab('0xa'));var jsforce=require(_0x1dab('0xb'));var deskjs=require(_0x1dab('0xc'));var toCsv=require(_0x1dab('0xd'));var querystring=require('querystring');var Papa=require(_0x1dab('0xe'));var Redis=require(_0x1dab('0xf'));var authService=require(_0x1dab('0x10'));var qs=require(_0x1dab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dab('0x12'))(_0x1dab('0x13'));var utils=require(_0x1dab('0x14'));var config=require(_0x1dab('0x15'));var licenseUtil=require(_0x1dab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c75ce,_0x4b2a29){_0x4b2a29=_0x4b2a29||0xcc;return function(_0x43d1dd){if(_0x43d1dd){return _0x4c75ce[_0x1dab('0x17')](_0x4b2a29);}return _0x4c75ce[_0x1dab('0x18')](_0x4b2a29)[_0x1dab('0x19')]();};}function respondWithResult(_0x21274c,_0x5efc70){_0x5efc70=_0x5efc70||0xc8;return function(_0x5f318d){if(_0x5f318d){return _0x21274c[_0x1dab('0x18')](_0x5efc70)[_0x1dab('0x1a')](_0x5f318d);}};}function respondWithFilteredResult(_0x438d88,_0x233eb9){return function(_0x51822b){if(_0x51822b){var _0x272c61=typeof _0x233eb9[_0x1dab('0x1b')]===_0x1dab('0x1c')&&typeof _0x233eb9[_0x1dab('0x1d')]===_0x1dab('0x1c');var _0x4f503d=_0x51822b[_0x1dab('0x1e')];var _0x4184b7=_0x272c61?0x0:_0x233eb9[_0x1dab('0x1b')];var _0x4672e9=_0x272c61?_0x51822b[_0x1dab('0x1e')]:_0x233eb9[_0x1dab('0x1b')]+_0x233eb9[_0x1dab('0x1d')];var _0x5338aa;if(_0x4672e9>=_0x4f503d){_0x4672e9=_0x4f503d;_0x5338aa=0xc8;}else{_0x5338aa=0xce;}_0x438d88['status'](_0x5338aa);return _0x438d88['set'](_0x1dab('0x1f'),_0x4184b7+'-'+_0x4672e9+'/'+_0x4f503d)[_0x1dab('0x1a')](_0x51822b);}return null;};}function patchUpdates(_0x5e4f0e){return function(_0x471ac3){try{jsonpatch[_0x1dab('0x20')](_0x471ac3,_0x5e4f0e,!![]);}catch(_0x5a7525){return BPromise[_0x1dab('0x21')](_0x5a7525);}return _0x471ac3['save']();};}function saveUpdates(_0xd684f5,_0xa6310c){return function(_0x24ba5c){if(_0x24ba5c){return _0x24ba5c[_0x1dab('0x22')](_0xd684f5)[_0x1dab('0x23')](function(_0x38b239){return _0x38b239;});}return null;};}function removeEntity(_0x9cc36d,_0x48ae5e){return function(_0x2e74c6){if(_0x2e74c6){return _0x2e74c6['destroy']()[_0x1dab('0x23')](function(){_0x9cc36d[_0x1dab('0x18')](0xcc)[_0x1dab('0x19')]();});}};}function handleEntityNotFound(_0x46856a,_0x2d0a4d){return function(_0xcc1335){if(!_0xcc1335){_0x46856a[_0x1dab('0x17')](0x194);}return _0xcc1335;};}function handleError(_0x491db7,_0x39e86b){_0x39e86b=_0x39e86b||0x1f4;return function(_0xb3acdf){logger[_0x1dab('0x24')](_0xb3acdf[_0x1dab('0x25')]);if(_0xb3acdf[_0x1dab('0x26')]){delete _0xb3acdf[_0x1dab('0x26')];}_0x491db7['status'](_0x39e86b)[_0x1dab('0x27')](_0xb3acdf);};}exports[_0x1dab('0x28')]=function(_0x5b2ac9,_0x4f0827){var _0x392302={},_0x33c7bc={},_0x1c56ee={'count':0x0,'rows':[]};var _0x2ee1f5=_['map'](db['SmsApplication'][_0x1dab('0x29')],function(_0x2f2312){return{'name':_0x2f2312[_0x1dab('0x2a')],'type':_0x2f2312[_0x1dab('0x2b')][_0x1dab('0x2c')]};});_0x33c7bc['model']=_['map'](_0x2ee1f5,_0x1dab('0x26'));_0x33c7bc['query']=_[_0x1dab('0x2d')](_0x5b2ac9[_0x1dab('0x2e')]);_0x33c7bc['filters']=_[_0x1dab('0x2f')](_0x33c7bc[_0x1dab('0x30')],_0x33c7bc[_0x1dab('0x2e')]);_0x392302[_0x1dab('0x31')]=_[_0x1dab('0x2f')](_0x33c7bc['model'],qs[_0x1dab('0x32')](_0x5b2ac9[_0x1dab('0x2e')][_0x1dab('0x32')]));_0x392302[_0x1dab('0x31')]=_0x392302['attributes'][_0x1dab('0x33')]?_0x392302[_0x1dab('0x31')]:_0x33c7bc[_0x1dab('0x30')];if(!_0x5b2ac9[_0x1dab('0x2e')][_0x1dab('0x34')]('nolimit')){_0x392302['limit']=qs['limit'](_0x5b2ac9[_0x1dab('0x2e')][_0x1dab('0x1d')]);_0x392302[_0x1dab('0x1b')]=qs['offset'](_0x5b2ac9[_0x1dab('0x2e')][_0x1dab('0x1b')]);}_0x392302[_0x1dab('0x35')]=qs[_0x1dab('0x36')](_0x5b2ac9[_0x1dab('0x2e')]['sort']);_0x392302['where']=qs[_0x1dab('0x37')](_[_0x1dab('0x38')](_0x5b2ac9['query'],_0x33c7bc[_0x1dab('0x37')]),_0x2ee1f5);if(_0x5b2ac9[_0x1dab('0x2e')][_0x1dab('0x39')]){_0x392302[_0x1dab('0x3a')]=_[_0x1dab('0x3b')](_0x392302[_0x1dab('0x3a')],{'$or':_[_0x1dab('0x3c')](_0x2ee1f5,function(_0x1a1f77){if(_0x1a1f77[_0x1dab('0x2b')]!==_0x1dab('0x3d')){var _0x48c7dd={};_0x48c7dd[_0x1a1f77[_0x1dab('0x26')]]={'$like':'%'+_0x5b2ac9[_0x1dab('0x2e')]['filter']+'%'};return _0x48c7dd;}})});}_0x392302=_[_0x1dab('0x3b')]({},_0x392302,_0x5b2ac9[_0x1dab('0x3e')]);var _0x5dc181={'where':_0x392302[_0x1dab('0x3a')]};return db['SmsApplication'][_0x1dab('0x1e')](_0x5dc181)[_0x1dab('0x23')](function(_0x3b6bf9){_0x1c56ee['count']=_0x3b6bf9;if(_0x5b2ac9[_0x1dab('0x2e')][_0x1dab('0x3f')]){_0x392302[_0x1dab('0x40')]=[{'all':!![]}];}return db[_0x1dab('0x41')][_0x1dab('0x42')](_0x392302);})['then'](function(_0x186108){_0x1c56ee[_0x1dab('0x43')]=_0x186108;return _0x1c56ee;})[_0x1dab('0x23')](respondWithFilteredResult(_0x4f0827,_0x392302))[_0x1dab('0x44')](handleError(_0x4f0827,null));};exports[_0x1dab('0x45')]=function(_0x3be0c7,_0x144806){var _0x4f9a21={'raw':!![],'where':{'id':_0x3be0c7[_0x1dab('0x46')]['id']}},_0x53bff5={};_0x53bff5[_0x1dab('0x30')]=_[_0x1dab('0x2d')](db[_0x1dab('0x41')][_0x1dab('0x29')]);_0x53bff5['query']=_[_0x1dab('0x2d')](_0x3be0c7[_0x1dab('0x2e')]);_0x53bff5[_0x1dab('0x37')]=_[_0x1dab('0x2f')](_0x53bff5[_0x1dab('0x30')],_0x53bff5[_0x1dab('0x2e')]);_0x4f9a21['attributes']=_[_0x1dab('0x2f')](_0x53bff5[_0x1dab('0x30')],qs[_0x1dab('0x32')](_0x3be0c7['query']['fields']));_0x4f9a21['attributes']=_0x4f9a21[_0x1dab('0x31')][_0x1dab('0x33')]?_0x4f9a21[_0x1dab('0x31')]:_0x53bff5['model'];if(_0x3be0c7[_0x1dab('0x2e')][_0x1dab('0x3f')]){_0x4f9a21[_0x1dab('0x40')]=[{'all':!![]}];}_0x4f9a21=_[_0x1dab('0x3b')]({},_0x4f9a21,_0x3be0c7[_0x1dab('0x3e')]);return db['SmsApplication'][_0x1dab('0x47')](_0x4f9a21)[_0x1dab('0x23')](handleEntityNotFound(_0x144806,null))[_0x1dab('0x23')](respondWithResult(_0x144806,null))[_0x1dab('0x44')](handleError(_0x144806,null));};exports[_0x1dab('0x48')]=function(_0x52a2a3,_0x4f37cf){return db[_0x1dab('0x41')]['create'](_0x52a2a3[_0x1dab('0x49')],{})[_0x1dab('0x23')](respondWithResult(_0x4f37cf,0xc9))[_0x1dab('0x44')](handleError(_0x4f37cf,null));};exports[_0x1dab('0x22')]=function(_0x59daf2,_0x22055e){if(_0x59daf2[_0x1dab('0x49')]['id']){delete _0x59daf2[_0x1dab('0x49')]['id'];}return db[_0x1dab('0x41')][_0x1dab('0x47')]({'where':{'id':_0x59daf2[_0x1dab('0x46')]['id']}})[_0x1dab('0x23')](handleEntityNotFound(_0x22055e,null))[_0x1dab('0x23')](saveUpdates(_0x59daf2[_0x1dab('0x49')],null))[_0x1dab('0x23')](respondWithResult(_0x22055e,null))[_0x1dab('0x44')](handleError(_0x22055e,null));};exports['destroy']=function(_0x5cd391,_0x526294){return db[_0x1dab('0x41')]['find']({'where':{'id':_0x5cd391['params']['id']}})[_0x1dab('0x23')](handleEntityNotFound(_0x526294,null))['then'](removeEntity(_0x526294,null))[_0x1dab('0x44')](handleError(_0x526294,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b2232d2..2896254 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 _0xe362=['bluebird','request-promise','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xe362,0x194));var _0x2e36=function(_0x1af8a0,_0x2a705d){_0x1af8a0=_0x1af8a0-0x0;var _0x2d5046=_0xe362[_0x1af8a0];return _0x2d5046;};'use strict';var _=require(_0x2e36('0x0'));var util=require('util');var logger=require(_0x2e36('0x1'))(_0x2e36('0x2'));var moment=require('moment');var BPromise=require(_0x2e36('0x3'));var rp=require(_0x2e36('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e36('0x5'));module[_0x2e36('0x6')]=function(_0xd73be1,_0x23db8b){return _0xd73be1[_0x2e36('0x7')](_0x2e36('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e36('0x9'),'collate':_0x2e36('0xa')});}; \ No newline at end of file +var _0xb45e=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x514fc0,_0x1032a0){var _0x26f8ee=function(_0x3bd0da){while(--_0x3bd0da){_0x514fc0['push'](_0x514fc0['shift']());}};_0x26f8ee(++_0x1032a0);}(_0xb45e,0x90));var _0xeb45=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0xb45e[_0x44c768];return _0x55daf5;};'use strict';var _=require(_0xeb45('0x0'));var util=require('util');var logger=require(_0xeb45('0x1'))(_0xeb45('0x2'));var moment=require(_0xeb45('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb45('0x5'));var config=require(_0xeb45('0x6'));var attributes=require('./smsApplication.attributes');module[_0xeb45('0x7')]=function(_0x26c885,_0x4c6dac){return _0x26c885[_0xeb45('0x8')](_0xeb45('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb45('0xa'),'collate':_0xeb45('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7a692a2..3f5ba64 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 _0xd786=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5ebcfc,_0x2c1394){var _0x17c562=function(_0x134110){while(--_0x134110){_0x5ebcfc['push'](_0x5ebcfc['shift']());}};_0x17c562(++_0x2c1394);}(_0xd786,0x1dc));var _0x6d78=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd786[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d78('0x4'));var db=require(_0x6d78('0x5'))['db'];var utils=require(_0x6d78('0x6'));var logger=require(_0x6d78('0x7'))(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require(_0x6d78('0xa'));var client=jayson['client'][_0x6d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e9e5,_0x5c3f38,_0x44db98){return new BPromise(function(_0x33b85e,_0x10f58a){return client[_0x6d78('0xc')](_0x30e9e5,_0x44db98)['then'](function(_0x3198b6){logger[_0x6d78('0xd')](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');logger[_0x6d78('0xf')](_0x6d78('0x10'),_0x5c3f38,_0x6d78('0x11'),JSON[_0x6d78('0x12')](_0x3198b6));if(_0x3198b6[_0x6d78('0x13')]){if(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x14')]===0x1f4){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x10f58a(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x15')]);}logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x33b85e(_0x3198b6['error'][_0x6d78('0x15')]);}else{logger['info'](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');_0x33b85e(_0x3198b6[_0x6d78('0x16')]['message']);}})[_0x6d78('0x17')](function(_0x378c59){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x378c59);_0x10f58a(_0x378c59);});});} \ No newline at end of file +var _0xa809=['error','message','info','result','catch','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x483c7f,_0x33722e){var _0x4abf79=function(_0x3f136f){while(--_0x3f136f){_0x483c7f['push'](_0x483c7f['shift']());}};_0x4abf79(++_0x33722e);}(_0xa809,0x1f3));var _0x9a80=function(_0x19a814,_0x103c9f){_0x19a814=_0x19a814-0x0;var _0x5a6aab=_0xa809[_0x19a814];return _0x5a6aab;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a80('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var config=require(_0x9a80('0x4'));var jayson=require(_0x9a80('0x5'));var client=jayson['client'][_0x9a80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x504ba8,_0x17b704,_0x286ac5){return new BPromise(function(_0x4ea507,_0x1ef67a){return client[_0x9a80('0x7')](_0x504ba8,_0x286ac5)[_0x9a80('0x8')](function(_0x269ee2){logger['info'](_0x9a80('0x9'),_0x17b704,_0x9a80('0xa'));logger[_0x9a80('0xb')](_0x9a80('0xc'),_0x17b704,_0x9a80('0xa'),JSON[_0x9a80('0xd')](_0x269ee2));if(_0x269ee2[_0x9a80('0xe')]){if(_0x269ee2[_0x9a80('0xe')]['code']===0x1f4){logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);return _0x1ef67a(_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);}logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2['error'][_0x9a80('0xf')]);return _0x4ea507(_0x269ee2['error'][_0x9a80('0xf')]);}else{logger[_0x9a80('0x10')](_0x9a80('0x9'),_0x17b704,'request\x20sent');_0x4ea507(_0x269ee2[_0x9a80('0x11')][_0x9a80('0xf')]);}})[_0x9a80('0x12')](function(_0x12ecee){logger[_0x9a80('0xe')]('SmsApplication,\x20%s,\x20%s',_0x17b704,_0x12ecee);_0x1ef67a(_0x12ecee);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 906e533..6ca3f7a 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 _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0xd584f6,_0x34cfe6){var _0x5ec250=function(_0x331e17){while(--_0x331e17){_0xd584f6['push'](_0xd584f6['shift']());}};_0x5ec250(++_0x34cfe6);}(_0x7708,0x188));var _0x8770=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x7708[_0x545a3a];return _0x5a5493;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x5c94d2,_0x5ab94b){var _0x59d81e=function(_0x4c2aa8){while(--_0x4c2aa8){_0x5c94d2['push'](_0x5c94d2['shift']());}};_0x59d81e(++_0x5ab94b);}(_0x7708,0x188));var _0x8770=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x7708[_0x99868f];return _0x27a71b;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d9fe9fd..b083d75 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 _0x8710=['sequelize','moment','BOOLEAN','DATE','STRING','out','ENUM','INTEGER'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8710,0x68));var _0x0871=function(_0x500458,_0x562944){_0x500458=_0x500458-0x0;var _0x3c4e96=_0x8710[_0x500458];return _0x3c4e96;};'use strict';var Sequelize=require(_0x0871('0x0'));var moment=require(_0x0871('0x1'));module['exports']={'closed':{'type':Sequelize[_0x0871('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0871('0x3')]},'disposition':{'type':Sequelize[_0x0871('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0871('0x4')]},'note':{'type':Sequelize[_0x0871('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0871('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x0871('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0871('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0871('0x6')]('in',_0x0871('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0871('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0871('0x7')]}}; \ No newline at end of file +var _0xfd7b=['INTEGER','sequelize','moment','exports','DATE','STRING','out','BOOLEAN'];(function(_0x10d39e,_0x260735){var _0x27a17d=function(_0x1d445b){while(--_0x1d445b){_0x10d39e['push'](_0x10d39e['shift']());}};_0x27a17d(++_0x260735);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xfd7b[_0x52e363];return _0x3fc2b5;};'use strict';var Sequelize=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));module[_0xbfd7('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbfd7('0x3')]},'disposition':{'type':Sequelize[_0xbfd7('0x4')]},'secondDisposition':{'type':Sequelize[_0xbfd7('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbfd7('0x4')]},'phone':{'type':Sequelize[_0xbfd7('0x4')]},'read1stAt':{'type':Sequelize[_0xbfd7('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbfd7('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbfd7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbfd7('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbfd7('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xbfd7('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b2815bc..03c8e45 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 _0xc3fc=['SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','files','transcript-%d-%s.zip','push','User','Contact','lastName','direction','read','SmsAccount','Account','Owner','fullname','mkdirSync','Sms','N.A.','createdAt','closedAt','disposition','Messages','System','firstName','out','secret','value','renderFile','server','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./smsInteraction.socket','end','status','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','model','keys','fields','attributes','length','include','merge','options','SmsInteraction','find','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','filters','nolimit','order','pick','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3fc,0x123));var _0xcc3f=function(_0x4865ce,_0x1e4225){_0x4865ce=_0x4865ce-0x0;var _0x3eceb5=_0xc3fc[_0x4865ce];return _0x3eceb5;};'use strict';var rimraf=require(_0xcc3f('0x0'));var zipdir=require(_0xcc3f('0x1'));var moment=require(_0xcc3f('0x2'));var BPromise=require(_0xcc3f('0x3'));var util=require(_0xcc3f('0x4'));var path=require(_0xcc3f('0x5'));var ejs=require(_0xcc3f('0x6'));var fs=require('fs');var _=require(_0xcc3f('0x7'));var Redis=require('ioredis');var interaction=require(_0xcc3f('0x8'));var qs=require(_0xcc3f('0x9'));var pdf=require(_0xcc3f('0xa'));var logger=require(_0xcc3f('0xb'))(_0xcc3f('0xc'));var config=require(_0xcc3f('0xd'));var db=require(_0xcc3f('0xe'))['db'];config['redis']=_[_0xcc3f('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcc3f('0x10'))(new Redis(config[_0xcc3f('0x11')]));require(_0xcc3f('0x12'))['register'](socket);function respondWithStatusCode(_0x2f4fdc,_0x524ccc){_0x524ccc=_0x524ccc||0xcc;return function(_0x37b2d2){if(_0x37b2d2){return _0x2f4fdc['sendStatus'](_0x524ccc);}return _0x2f4fdc['status'](_0x524ccc)[_0xcc3f('0x13')]();};}function respondWithResult(_0x208f4c,_0x88a296){_0x88a296=_0x88a296||0xc8;return function(_0x498bf1){if(_0x498bf1){return _0x208f4c[_0xcc3f('0x14')](_0x88a296)[_0xcc3f('0x15')](_0x498bf1);}};}function respondWithFilteredResult(_0x225926,_0x32e2fb){return function(_0xe208c1){if(_0xe208c1){var _0x5ca66a=typeof _0x32e2fb[_0xcc3f('0x16')]===_0xcc3f('0x17')&&typeof _0x32e2fb[_0xcc3f('0x18')]===_0xcc3f('0x17');var _0x5e3868=_0xe208c1[_0xcc3f('0x19')];var _0x46bea5=_0x5ca66a?0x0:_0x32e2fb['offset'];var _0x174faf=_0x5ca66a?_0xe208c1[_0xcc3f('0x19')]:_0x32e2fb[_0xcc3f('0x16')]+_0x32e2fb['limit'];var _0x590bb0;if(_0x174faf>=_0x5e3868){_0x174faf=_0x5e3868;_0x590bb0=0xc8;}else{_0x590bb0=0xce;}_0x225926[_0xcc3f('0x14')](_0x590bb0);return _0x225926[_0xcc3f('0x1a')]('Content-Range',_0x46bea5+'-'+_0x174faf+'/'+_0x5e3868)[_0xcc3f('0x15')](_0xe208c1);}return null;};}function saveUpdates(_0x2a10b9){return function(_0x386f2d){if(_0x386f2d){return _0x386f2d[_0xcc3f('0x1b')](_0x2a10b9)[_0xcc3f('0x1c')](function(_0x5de793){return _0x5de793;});}return null;};}function removeEntity(_0xf15e53){return function(_0x36f808){if(_0x36f808){return _0x36f808[_0xcc3f('0x1d')]()[_0xcc3f('0x1c')](function(){_0xf15e53[_0xcc3f('0x14')](0xcc)[_0xcc3f('0x13')]();});}};}function handleEntityNotFound(_0xe70cc7){return function(_0x1f2a88){if(!_0x1f2a88){_0xe70cc7[_0xcc3f('0x1e')](0x194);}return _0x1f2a88;};}function handleError(_0x5f14e6,_0x584770){_0x584770=_0x584770||0x1f4;return function(_0x3d8713){logger[_0xcc3f('0x1f')](_0x3d8713[_0xcc3f('0x20')]);if(_0x3d8713[_0xcc3f('0x21')]){delete _0x3d8713[_0xcc3f('0x21')];}_0x5f14e6[_0xcc3f('0x14')](_0x584770)[_0xcc3f('0x22')](_0x3d8713);};}exports[_0xcc3f('0x23')]=function(_0x38be46,_0x47a14c){var _0x20b99a={};var _0x37ee6f=_[_0xcc3f('0x24')](db['SmsInteraction'][_0xcc3f('0x25')],function(_0x41478f){return{'name':_0x41478f[_0xcc3f('0x26')],'type':_0x41478f[_0xcc3f('0x27')][_0xcc3f('0x28')]};});_0x20b99a=qs[_0xcc3f('0x29')](_0x37ee6f,_0x38be46);return interaction[_0xcc3f('0x2a')](_0xcc3f('0x2b'),_0x38be46[_0xcc3f('0x2c')],_0x38be46[_0xcc3f('0x2d')],_0x20b99a,_0x37ee6f)['then'](respondWithFilteredResult(_0x47a14c,_0x20b99a))[_0xcc3f('0x2e')](handleError(_0x47a14c,null));};exports[_0xcc3f('0x2f')]=function(_0x172ba0,_0x45827c){var _0x500dd4={'raw':![],'where':{'id':_0x172ba0['params']['id']}},_0x3edfee={};_0x3edfee[_0xcc3f('0x30')]=_[_0xcc3f('0x31')](db['SmsInteraction'][_0xcc3f('0x25')]);_0x3edfee[_0xcc3f('0x2c')]=_['keys'](_0x172ba0[_0xcc3f('0x2c')]);_0x3edfee['filters']=_['intersection'](_0x3edfee[_0xcc3f('0x30')],_0x3edfee[_0xcc3f('0x2c')]);_0x500dd4['attributes']=_['intersection'](_0x3edfee[_0xcc3f('0x30')],qs['fields'](_0x172ba0['query'][_0xcc3f('0x32')]));_0x500dd4[_0xcc3f('0x33')]=_0x500dd4[_0xcc3f('0x33')][_0xcc3f('0x34')]?_0x500dd4['attributes']:_0x3edfee[_0xcc3f('0x30')];if(_0x172ba0[_0xcc3f('0x2c')]['includeAll']){_0x500dd4[_0xcc3f('0x35')]=[{'all':!![]}];}_0x500dd4=_[_0xcc3f('0x36')]({},_0x500dd4,_0x172ba0[_0xcc3f('0x37')]);return db[_0xcc3f('0x38')][_0xcc3f('0x39')](_0x500dd4)[_0xcc3f('0x1c')](handleEntityNotFound(_0x45827c,null))['then'](respondWithResult(_0x45827c,null))[_0xcc3f('0x2e')](handleError(_0x45827c,null));};exports[_0xcc3f('0x3a')]=function(_0x2d1393,_0x1d89b8){return db[_0xcc3f('0x38')][_0xcc3f('0x3a')](_0x2d1393[_0xcc3f('0x3b')],{})['then'](respondWithResult(_0x1d89b8,0xc9))[_0xcc3f('0x2e')](handleError(_0x1d89b8,null));};exports[_0xcc3f('0x1b')]=function(_0xff35a9,_0x39db03){if(_0xff35a9[_0xcc3f('0x3b')]['id']){delete _0xff35a9['body']['id'];}return db[_0xcc3f('0x38')][_0xcc3f('0x39')]({'where':{'id':_0xff35a9[_0xcc3f('0x3c')]['id']}})[_0xcc3f('0x1c')](handleEntityNotFound(_0x39db03,null))['then'](saveUpdates(_0xff35a9[_0xcc3f('0x3b')],null))[_0xcc3f('0x1c')](respondWithResult(_0x39db03,null))[_0xcc3f('0x2e')](handleError(_0x39db03,null));};exports['destroy']=function(_0xade93d,_0x53b0a9){return db[_0xcc3f('0x38')]['find']({'where':{'id':_0xade93d[_0xcc3f('0x3c')]['id']}})[_0xcc3f('0x1c')](handleEntityNotFound(_0x53b0a9,null))['then'](removeEntity(_0x53b0a9,null))['catch'](handleError(_0x53b0a9,null));};exports[_0xcc3f('0x3d')]=function(_0x427671,_0x186ee8){return db[_0xcc3f('0x38')][_0xcc3f('0x3d')]()[_0xcc3f('0x1c')](respondWithResult(_0x186ee8,null))[_0xcc3f('0x2e')](handleError(_0x186ee8,null));};exports[_0xcc3f('0x3e')]=function(_0x32bac0,_0x4afccb){return db[_0xcc3f('0x3f')][_0xcc3f('0x39')]({'where':{'id':_0x32bac0['params']['id']}})[_0xcc3f('0x1c')](handleEntityNotFound(_0x4afccb,null))[_0xcc3f('0x1c')](function(_0x164f5c){if(_0x164f5c){return _0x164f5c[_0xcc3f('0x3e')](_0x32bac0[_0xcc3f('0x3b')][_0xcc3f('0x40')],_[_0xcc3f('0x41')](_0x32bac0[_0xcc3f('0x3b')],[_0xcc3f('0x40'),'id'])||{});}})[_0xcc3f('0x1c')](respondWithResult(_0x4afccb,null))[_0xcc3f('0x2e')](handleError(_0x4afccb,null));};exports[_0xcc3f('0x42')]=function(_0x1ffe06,_0x4458dd){var _0x299bfb={'raw':![],'where':{}};var _0x589fb7={};var _0x354020={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1ffe06['params']['id']}})['then'](handleEntityNotFound(_0x4458dd,null))[_0xcc3f('0x1c')](function(_0x5a1072){if(_0x5a1072){_0x589fb7[_0xcc3f('0x30')]=_['keys'](db[_0xcc3f('0x3f')][_0xcc3f('0x25')]);_0x589fb7[_0xcc3f('0x2c')]=_[_0xcc3f('0x31')](_0x1ffe06[_0xcc3f('0x2c')]);_0x589fb7[_0xcc3f('0x43')]=_['intersection'](_0x589fb7[_0xcc3f('0x30')],_0x589fb7[_0xcc3f('0x2c')]);_0x299bfb[_0xcc3f('0x33')]=_['intersection'](_0x589fb7[_0xcc3f('0x30')],qs[_0xcc3f('0x32')](_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x32')]));_0x299bfb[_0xcc3f('0x33')]=_0x299bfb[_0xcc3f('0x33')][_0xcc3f('0x34')]?_0x299bfb[_0xcc3f('0x33')]:_0x589fb7[_0xcc3f('0x30')];if(!_0x1ffe06[_0xcc3f('0x2c')]['hasOwnProperty'](_0xcc3f('0x44'))){_0x299bfb[_0xcc3f('0x18')]=qs['limit'](_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x18')]);_0x299bfb[_0xcc3f('0x16')]=qs['offset'](_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x16')]);}_0x299bfb[_0xcc3f('0x45')]=qs['sort'](_0x1ffe06['query']['sort']);_0x299bfb['where']=qs[_0xcc3f('0x43')](_[_0xcc3f('0x46')](_0x1ffe06[_0xcc3f('0x2c')],_0x589fb7[_0xcc3f('0x43')]));_0x299bfb[_0xcc3f('0x47')][_0xcc3f('0x48')]=_0x5a1072['id'];if(_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x49')]){_0x299bfb[_0xcc3f('0x47')]=_['merge'](_0x299bfb[_0xcc3f('0x47')],{'$or':_[_0xcc3f('0x24')](_0x299bfb['attributes'],function(_0x212e5f){var _0x597207={};_0x597207[_0x212e5f]={'$like':'%'+_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x49')]+'%'};return _0x597207;})});}if(_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x4a')]){var _0x1cd569=_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x4a')]['split'](',');var _0x267faf={};_0x267faf[_0x1cd569[0x0]]={'$gte':moment(_0x1cd569[0x1])[_0xcc3f('0x4b')](_0xcc3f('0x4c'))};_0x299bfb[_0xcc3f('0x47')]=_[_0xcc3f('0x36')](_0x299bfb['where'],_0x267faf);}_0x299bfb=_[_0xcc3f('0x36')]({},_0x299bfb,_0x1ffe06[_0xcc3f('0x37')]);return db['SmsMessage']['count']({'where':_0x299bfb[_0xcc3f('0x47')]})[_0xcc3f('0x1c')](function(_0x24c34d){_0x354020[_0xcc3f('0x19')]=_0x24c34d;if(_0x1ffe06[_0xcc3f('0x2c')][_0xcc3f('0x4d')]){_0x299bfb[_0xcc3f('0x35')]=[{'all':!![]}];}return db['SmsMessage'][_0xcc3f('0x2a')](_0x299bfb);})[_0xcc3f('0x1c')](function(_0x4aba18){_0x354020[_0xcc3f('0x4e')]=_0x4aba18;return _0x354020;});}})['then'](respondWithFilteredResult(_0x4458dd,_0x299bfb))[_0xcc3f('0x2e')](handleError(_0x4458dd,null));};exports['addTags']=function(_0x53d86d,_0x3b0811){return db[_0xcc3f('0x38')][_0xcc3f('0x39')]({'where':{'id':_0x53d86d[_0xcc3f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3b0811,null))[_0xcc3f('0x1c')](function(_0x1849ac){if(_0x1849ac){return _0x1849ac[_0xcc3f('0x4f')](_0x53d86d['body'][_0xcc3f('0x40')],_[_0xcc3f('0x41')](_0x53d86d[_0xcc3f('0x3b')],[_0xcc3f('0x40'),'id'])||{})[_0xcc3f('0x50')](function(){return db[_0xcc3f('0x51')][_0xcc3f('0x2a')]({'attributes':['id',_0xcc3f('0x21'),_0xcc3f('0x52')],'where':{'id':_0x53d86d[_0xcc3f('0x3b')][_0xcc3f('0x40')]}});})[_0xcc3f('0x1c')](function(_0x274775){socket[_0xcc3f('0x53')]('smsInteractionTags:save',{'id':Number(_0x53d86d[_0xcc3f('0x3c')]['id']),'tags':_0x274775||[]});return{'id':Number(_0x53d86d[_0xcc3f('0x3c')]['id']),'tags':_0x274775||[]};});}})[_0xcc3f('0x1c')](respondWithResult(_0x3b0811,null))[_0xcc3f('0x2e')](handleError(_0x3b0811,null));};exports['removeTags']=function(_0x3908be,_0x2165ac){return db[_0xcc3f('0x38')]['find']({'where':{'id':_0x3908be[_0xcc3f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2165ac,null))[_0xcc3f('0x1c')](function(_0x41bf69){if(_0x41bf69){return _0x41bf69[_0xcc3f('0x54')](_0x3908be[_0xcc3f('0x2c')]['ids']);}})['then'](respondWithStatusCode(_0x2165ac,null))[_0xcc3f('0x2e')](handleError(_0x2165ac,null));};exports[_0xcc3f('0x55')]=function(_0x287658,_0x90c979){var _0x115795=moment()[_0xcc3f('0x56')]()[_0xcc3f('0x57')]();var _0x2008e8=path[_0xcc3f('0x58')](config[_0xcc3f('0x59')],'server',_0xcc3f('0x5a'),'tmp');var _0x19c9d9=path[_0xcc3f('0x58')](_0x2008e8,_0x115795);var _0x1e30d9=util['format'](_0xcc3f('0x5b'),_0x287658['params']['id'],_0x115795);var _0x3a2041=path[_0xcc3f('0x58')](_0x2008e8,_0x1e30d9);var _0x5aa947=[];_0x5aa947[_0xcc3f('0x5c')]({'model':db[_0xcc3f('0x5d')],'as':_0xcc3f('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x5aa947[_0xcc3f('0x5c')]({'model':db['CmContact'],'as':_0xcc3f('0x5e'),'attributes':['id','firstName',_0xcc3f('0x5f')],'raw':!![]});var _0x30f9ba=[{'model':db[_0xcc3f('0x3f')],'as':'Messages','attributes':['id',_0xcc3f('0x3b'),'createdAt',_0xcc3f('0x60'),'secret',_0xcc3f('0x61')],'include':_0x5aa947}];_0x30f9ba[_0xcc3f('0x5c')]({'model':db[_0xcc3f('0x62')],'as':_0xcc3f('0x63'),'attributes':['id',_0xcc3f('0x21')]});_0x30f9ba['push']({'model':db['User'],'as':_0xcc3f('0x64'),'attributes':['id',_0xcc3f('0x65')]});return db[_0xcc3f('0x38')][_0xcc3f('0x39')]({'where':{'id':_0x287658[_0xcc3f('0x3c')]['id']},'include':_0x30f9ba})[_0xcc3f('0x1c')](handleEntityNotFound(_0x90c979,null))['then'](function(_0x18a46a){if(_0x18a46a){var _0x5326f6=_0x18a46a['get']({'plain':!![]});fs[_0xcc3f('0x66')](_0x19c9d9);var _0xf93676={'channel':_0xcc3f('0x67'),'account':_0x5326f6[_0xcc3f('0x63')][_0xcc3f('0x21')],'agent':_0x5326f6['Owner']?_0x5326f6[_0xcc3f('0x64')][_0xcc3f('0x65')]:_0xcc3f('0x68'),'createdAt':moment(_0x5326f6[_0xcc3f('0x69')])[_0xcc3f('0x4b')](_0xcc3f('0x4c'))[_0xcc3f('0x57')](),'closedAt':_0x5326f6['closed']?moment(_0x5326f6[_0xcc3f('0x6a')])[_0xcc3f('0x4b')](_0xcc3f('0x4c'))[_0xcc3f('0x57')]():'','disposition':_0x5326f6[_0xcc3f('0x6b')],'messages':_(_0x5326f6[_0xcc3f('0x6c')])[_0xcc3f('0x49')]({'secret':![]})['map'](function(_0x560ad6){return{'date':moment(_0x560ad6['createdAt'])[_0xcc3f('0x4b')](_0xcc3f('0x4c'))[_0xcc3f('0x57')](),'sender':_0x560ad6[_0xcc3f('0x60')]==='out'?_0x560ad6[_0xcc3f('0x5d')]?_0x560ad6[_0xcc3f('0x5d')][_0xcc3f('0x65')]:_0xcc3f('0x6d'):_0x560ad6[_0xcc3f('0x5e')][_0xcc3f('0x6e')]+(_0x560ad6['Contact'][_0xcc3f('0x5f')]?'\x20'+_0x560ad6[_0xcc3f('0x5e')][_0xcc3f('0x5f')]:''),'body':_0x560ad6[_0xcc3f('0x3b')],'direction':_0x560ad6[_0xcc3f('0x60')]===_0xcc3f('0x6f')?'A':'C','secret':_0x560ad6[_0xcc3f('0x70')],'read':_0x560ad6['read']};})[_0xcc3f('0x71')]()};return ejs[_0xcc3f('0x72')](path[_0xcc3f('0x58')](config['root'],_0xcc3f('0x73'),'views','downloadInteraction.ejs'),{'interaction':_0xf93676})[_0xcc3f('0x1c')](function(_0x518df1){var _0x24fed6=path[_0xcc3f('0x58')](_0x19c9d9,_0xcc3f('0x74')+_0x5326f6['id']+'-'+_0x115795+_0xcc3f('0x75'));var _0x5285ec={'path':_0x24fed6,'channel':_0xcc3f('0x67'),'interactionId':_0x5326f6['id']};return pdf[_0xcc3f('0x76')](_0x518df1,_0x5285ec);})[_0xcc3f('0x1c')](function(){return new BPromise(function(_0x6bc886,_0x4d7eb2){zipdir(_0x19c9d9,{'saveTo':_0x3a2041},function(_0x37eff9,_0x55a5f5){if(_0x37eff9)return _0x4d7eb2(_0x37eff9);return _0x6bc886(_0x55a5f5);});})[_0xcc3f('0x1c')](function(){return new BPromise(function(_0x13e92c,_0x56acbb){rimraf(_0x19c9d9,function(_0x1da0bc){if(_0x1da0bc)_0x56acbb(_0x1da0bc);return _0x13e92c();});});})[_0xcc3f('0x1c')](function(){return _0x90c979[_0xcc3f('0x55')](_0x3a2041,_0x1e30d9,function(_0x11fa06){if(_0x11fa06){console[_0xcc3f('0x77')]('err',_0x11fa06);}else{fs[_0xcc3f('0x78')](_0x3a2041);}});});});}else{return _0x90c979[_0xcc3f('0x1e')](0xc8);}})[_0xcc3f('0x2e')](handleError(_0x90c979,null));}; \ No newline at end of file +var _0x0048=['pick','SmsInteractionId','filter','where','merge','$gte','split','format','includeAll','findAll','rows','addTags','setTags','omit','spread','Tag','color','smsInteractionTags:save','removeTags','toString','root','server','files','tmp','join','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','push','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','Contact','value','downloadInteraction.ejs','.pdf','download','log','err','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','SmsInteraction','fieldName','type','key','sms','query','catch','show','model','keys','filters','intersection','attributes','fields','length','include','options','find','create','body','params','describe','SmsMessage','ids','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','sort'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x0048,0x129));var _0x8004=function(_0x4e0d05,_0x1252ef){_0x4e0d05=_0x4e0d05-0x0;var _0x568b50=_0x0048[_0x4e0d05];return _0x568b50;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x8004('0x0'));var moment=require(_0x8004('0x1'));var BPromise=require('bluebird');var util=require(_0x8004('0x2'));var path=require(_0x8004('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8004('0x4'));var Redis=require(_0x8004('0x5'));var interaction=require(_0x8004('0x6'));var qs=require(_0x8004('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x8004('0x8'));var config=require(_0x8004('0x9'));var db=require(_0x8004('0xa'))['db'];config['redis']=_[_0x8004('0xb')](config[_0x8004('0xc')],{'host':_0x8004('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x8004('0xe')](socket);function respondWithStatusCode(_0x4ae5a4,_0x59ea76){_0x59ea76=_0x59ea76||0xcc;return function(_0x12e67b){if(_0x12e67b){return _0x4ae5a4[_0x8004('0xf')](_0x59ea76);}return _0x4ae5a4['status'](_0x59ea76)['end']();};}function respondWithResult(_0x1a261e,_0x75a8a6){_0x75a8a6=_0x75a8a6||0xc8;return function(_0x42dafb){if(_0x42dafb){return _0x1a261e[_0x8004('0x10')](_0x75a8a6)[_0x8004('0x11')](_0x42dafb);}};}function respondWithFilteredResult(_0x368720,_0x39a752){return function(_0x5d9972){if(_0x5d9972){var _0x26dde8=typeof _0x39a752[_0x8004('0x12')]===_0x8004('0x13')&&typeof _0x39a752[_0x8004('0x14')]===_0x8004('0x13');var _0xc47c27=_0x5d9972[_0x8004('0x15')];var _0x65f71e=_0x26dde8?0x0:_0x39a752[_0x8004('0x12')];var _0x3cebc4=_0x26dde8?_0x5d9972[_0x8004('0x15')]:_0x39a752[_0x8004('0x12')]+_0x39a752[_0x8004('0x14')];var _0x36a0c9;if(_0x3cebc4>=_0xc47c27){_0x3cebc4=_0xc47c27;_0x36a0c9=0xc8;}else{_0x36a0c9=0xce;}_0x368720[_0x8004('0x10')](_0x36a0c9);return _0x368720[_0x8004('0x16')](_0x8004('0x17'),_0x65f71e+'-'+_0x3cebc4+'/'+_0xc47c27)[_0x8004('0x11')](_0x5d9972);}return null;};}function saveUpdates(_0x75f97d){return function(_0x4b0a9b){if(_0x4b0a9b){return _0x4b0a9b[_0x8004('0x18')](_0x75f97d)[_0x8004('0x19')](function(_0x502eed){return _0x502eed;});}return null;};}function removeEntity(_0x17b715){return function(_0x44222d){if(_0x44222d){return _0x44222d[_0x8004('0x1a')]()[_0x8004('0x19')](function(){_0x17b715[_0x8004('0x10')](0xcc)[_0x8004('0x1b')]();});}};}function handleEntityNotFound(_0x93be01){return function(_0x1ffeef){if(!_0x1ffeef){_0x93be01[_0x8004('0xf')](0x194);}return _0x1ffeef;};}function handleError(_0x15e146,_0x5a4608){_0x5a4608=_0x5a4608||0x1f4;return function(_0x57370e){logger['error'](_0x57370e[_0x8004('0x1c')]);if(_0x57370e[_0x8004('0x1d')]){delete _0x57370e['name'];}_0x15e146[_0x8004('0x10')](_0x5a4608)[_0x8004('0x1e')](_0x57370e);};}exports[_0x8004('0x1f')]=function(_0x36bf15,_0x1b3340){var _0x2d3313={};var _0x567c3e=_[_0x8004('0x20')](db[_0x8004('0x21')]['rawAttributes'],function(_0x3bddfc){return{'name':_0x3bddfc[_0x8004('0x22')],'type':_0x3bddfc[_0x8004('0x23')][_0x8004('0x24')]};});_0x2d3313=qs['getOptions'](_0x567c3e,_0x36bf15);return interaction['findAll'](_0x8004('0x25'),_0x36bf15[_0x8004('0x26')],_0x36bf15['user'],_0x2d3313,_0x567c3e)[_0x8004('0x19')](respondWithFilteredResult(_0x1b3340,_0x2d3313))[_0x8004('0x27')](handleError(_0x1b3340,null));};exports[_0x8004('0x28')]=function(_0x2afc36,_0x78d1d2){var _0x5d24f8={'raw':![],'where':{'id':_0x2afc36['params']['id']}},_0x27902e={};_0x27902e[_0x8004('0x29')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x27902e[_0x8004('0x26')]=_[_0x8004('0x2a')](_0x2afc36['query']);_0x27902e[_0x8004('0x2b')]=_[_0x8004('0x2c')](_0x27902e[_0x8004('0x29')],_0x27902e[_0x8004('0x26')]);_0x5d24f8[_0x8004('0x2d')]=_[_0x8004('0x2c')](_0x27902e[_0x8004('0x29')],qs[_0x8004('0x2e')](_0x2afc36['query']['fields']));_0x5d24f8['attributes']=_0x5d24f8['attributes'][_0x8004('0x2f')]?_0x5d24f8[_0x8004('0x2d')]:_0x27902e[_0x8004('0x29')];if(_0x2afc36[_0x8004('0x26')]['includeAll']){_0x5d24f8[_0x8004('0x30')]=[{'all':!![]}];}_0x5d24f8=_['merge']({},_0x5d24f8,_0x2afc36[_0x8004('0x31')]);return db[_0x8004('0x21')][_0x8004('0x32')](_0x5d24f8)['then'](handleEntityNotFound(_0x78d1d2,null))[_0x8004('0x19')](respondWithResult(_0x78d1d2,null))[_0x8004('0x27')](handleError(_0x78d1d2,null));};exports[_0x8004('0x33')]=function(_0x1eea2d,_0x1ebac1){return db[_0x8004('0x21')][_0x8004('0x33')](_0x1eea2d[_0x8004('0x34')],{})['then'](respondWithResult(_0x1ebac1,0xc9))[_0x8004('0x27')](handleError(_0x1ebac1,null));};exports[_0x8004('0x18')]=function(_0x19c376,_0x9c012d){if(_0x19c376['body']['id']){delete _0x19c376[_0x8004('0x34')]['id'];}return db[_0x8004('0x21')]['find']({'where':{'id':_0x19c376[_0x8004('0x35')]['id']}})['then'](handleEntityNotFound(_0x9c012d,null))[_0x8004('0x19')](saveUpdates(_0x19c376['body'],null))['then'](respondWithResult(_0x9c012d,null))[_0x8004('0x27')](handleError(_0x9c012d,null));};exports[_0x8004('0x1a')]=function(_0x3e7413,_0x351941){return db[_0x8004('0x21')]['find']({'where':{'id':_0x3e7413[_0x8004('0x35')]['id']}})[_0x8004('0x19')](handleEntityNotFound(_0x351941,null))[_0x8004('0x19')](removeEntity(_0x351941,null))[_0x8004('0x27')](handleError(_0x351941,null));};exports['describe']=function(_0x16c078,_0x14469c){return db['SmsInteraction'][_0x8004('0x36')]()[_0x8004('0x19')](respondWithResult(_0x14469c,null))[_0x8004('0x27')](handleError(_0x14469c,null));};exports['addMessage']=function(_0x3ba4e4,_0x511885){return db[_0x8004('0x37')][_0x8004('0x32')]({'where':{'id':_0x3ba4e4[_0x8004('0x35')]['id']}})['then'](handleEntityNotFound(_0x511885,null))['then'](function(_0x5ac54b){if(_0x5ac54b){return _0x5ac54b['addMessage'](_0x3ba4e4[_0x8004('0x34')][_0x8004('0x38')],_['omit'](_0x3ba4e4[_0x8004('0x34')],[_0x8004('0x38'),'id'])||{});}})['then'](respondWithResult(_0x511885,null))[_0x8004('0x27')](handleError(_0x511885,null));};exports[_0x8004('0x39')]=function(_0x167e26,_0x511cfa){var _0x462988={'raw':![],'where':{}};var _0x59b1df={};var _0x3fb197={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8004('0x3a')]({'where':{'id':_0x167e26[_0x8004('0x35')]['id']}})['then'](handleEntityNotFound(_0x511cfa,null))[_0x8004('0x19')](function(_0xea8da3){if(_0xea8da3){_0x59b1df[_0x8004('0x29')]=_['keys'](db['SmsMessage'][_0x8004('0x3b')]);_0x59b1df[_0x8004('0x26')]=_[_0x8004('0x2a')](_0x167e26[_0x8004('0x26')]);_0x59b1df['filters']=_[_0x8004('0x2c')](_0x59b1df[_0x8004('0x29')],_0x59b1df[_0x8004('0x26')]);_0x462988[_0x8004('0x2d')]=_[_0x8004('0x2c')](_0x59b1df['model'],qs['fields'](_0x167e26[_0x8004('0x26')][_0x8004('0x2e')]));_0x462988[_0x8004('0x2d')]=_0x462988[_0x8004('0x2d')][_0x8004('0x2f')]?_0x462988[_0x8004('0x2d')]:_0x59b1df[_0x8004('0x29')];if(!_0x167e26[_0x8004('0x26')][_0x8004('0x3c')](_0x8004('0x3d'))){_0x462988[_0x8004('0x14')]=qs[_0x8004('0x14')](_0x167e26[_0x8004('0x26')]['limit']);_0x462988[_0x8004('0x12')]=qs[_0x8004('0x12')](_0x167e26[_0x8004('0x26')][_0x8004('0x12')]);}_0x462988['order']=qs['sort'](_0x167e26[_0x8004('0x26')][_0x8004('0x3e')]);_0x462988['where']=qs[_0x8004('0x2b')](_[_0x8004('0x3f')](_0x167e26['query'],_0x59b1df['filters']));_0x462988['where'][_0x8004('0x40')]=_0xea8da3['id'];if(_0x167e26[_0x8004('0x26')][_0x8004('0x41')]){_0x462988[_0x8004('0x42')]=_[_0x8004('0x43')](_0x462988[_0x8004('0x42')],{'$or':_[_0x8004('0x20')](_0x462988['attributes'],function(_0x2a3600){var _0x2b1001={};_0x2b1001[_0x2a3600]={'$like':'%'+_0x167e26[_0x8004('0x26')][_0x8004('0x41')]+'%'};return _0x2b1001;})});}if(_0x167e26['query'][_0x8004('0x44')]){var _0x521723=_0x167e26['query'][_0x8004('0x44')][_0x8004('0x45')](',');var _0x3d801d={};_0x3d801d[_0x521723[0x0]]={'$gte':moment(_0x521723[0x1])[_0x8004('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x462988[_0x8004('0x42')]=_['merge'](_0x462988[_0x8004('0x42')],_0x3d801d);}_0x462988=_[_0x8004('0x43')]({},_0x462988,_0x167e26[_0x8004('0x31')]);return db[_0x8004('0x37')][_0x8004('0x15')]({'where':_0x462988[_0x8004('0x42')]})[_0x8004('0x19')](function(_0x3ebd70){_0x3fb197['count']=_0x3ebd70;if(_0x167e26[_0x8004('0x26')][_0x8004('0x47')]){_0x462988['include']=[{'all':!![]}];}return db['SmsMessage'][_0x8004('0x48')](_0x462988);})[_0x8004('0x19')](function(_0xa581f7){_0x3fb197[_0x8004('0x49')]=_0xa581f7;return _0x3fb197;});}})[_0x8004('0x19')](respondWithFilteredResult(_0x511cfa,_0x462988))[_0x8004('0x27')](handleError(_0x511cfa,null));};exports[_0x8004('0x4a')]=function(_0x4d09e5,_0x15ccf3){return db['SmsInteraction'][_0x8004('0x32')]({'where':{'id':_0x4d09e5[_0x8004('0x35')]['id']}})[_0x8004('0x19')](handleEntityNotFound(_0x15ccf3,null))[_0x8004('0x19')](function(_0x5e5c97){if(_0x5e5c97){return _0x5e5c97[_0x8004('0x4b')](_0x4d09e5[_0x8004('0x34')][_0x8004('0x38')],_[_0x8004('0x4c')](_0x4d09e5[_0x8004('0x34')],['ids','id'])||{})[_0x8004('0x4d')](function(){return db[_0x8004('0x4e')][_0x8004('0x48')]({'attributes':['id',_0x8004('0x1d'),_0x8004('0x4f')],'where':{'id':_0x4d09e5[_0x8004('0x34')][_0x8004('0x38')]}});})[_0x8004('0x19')](function(_0x25b05c){socket['emit'](_0x8004('0x50'),{'id':Number(_0x4d09e5['params']['id']),'tags':_0x25b05c||[]});return{'id':Number(_0x4d09e5[_0x8004('0x35')]['id']),'tags':_0x25b05c||[]};});}})[_0x8004('0x19')](respondWithResult(_0x15ccf3,null))['catch'](handleError(_0x15ccf3,null));};exports[_0x8004('0x51')]=function(_0x1e1a98,_0x2548fb){return db[_0x8004('0x21')][_0x8004('0x32')]({'where':{'id':_0x1e1a98[_0x8004('0x35')]['id']}})[_0x8004('0x19')](handleEntityNotFound(_0x2548fb,null))[_0x8004('0x19')](function(_0x17338e){if(_0x17338e){return _0x17338e['removeTags'](_0x1e1a98[_0x8004('0x26')][_0x8004('0x38')]);}})['then'](respondWithStatusCode(_0x2548fb,null))[_0x8004('0x27')](handleError(_0x2548fb,null));};exports['download']=function(_0x458901,_0x9efec5){var _0x1b9bf6=moment()['unix']()[_0x8004('0x52')]();var _0x42c6e4=path['join'](config[_0x8004('0x53')],_0x8004('0x54'),_0x8004('0x55'),_0x8004('0x56'));var _0x2c8ef2=path[_0x8004('0x57')](_0x42c6e4,_0x1b9bf6);var _0x4aec51=util[_0x8004('0x46')](_0x8004('0x58'),_0x458901[_0x8004('0x35')]['id'],_0x1b9bf6);var _0x50092d=path[_0x8004('0x57')](_0x42c6e4,_0x4aec51);var _0x15eb85=[];_0x15eb85['push']({'model':db[_0x8004('0x59')],'as':_0x8004('0x59'),'attributes':['id',_0x8004('0x5a')],'raw':!![]});_0x15eb85['push']({'model':db[_0x8004('0x5b')],'as':'Contact','attributes':['id',_0x8004('0x5c'),_0x8004('0x5d')],'raw':!![]});var _0x494462=[{'model':db[_0x8004('0x37')],'as':_0x8004('0x5e'),'attributes':['id',_0x8004('0x34'),_0x8004('0x5f'),_0x8004('0x60'),_0x8004('0x61'),_0x8004('0x62')],'include':_0x15eb85}];_0x494462[_0x8004('0x63')]({'model':db[_0x8004('0x64')],'as':_0x8004('0x65'),'attributes':['id',_0x8004('0x1d')]});_0x494462[_0x8004('0x63')]({'model':db[_0x8004('0x59')],'as':'Owner','attributes':['id','fullname']});return db[_0x8004('0x21')]['find']({'where':{'id':_0x458901['params']['id']},'include':_0x494462})[_0x8004('0x19')](handleEntityNotFound(_0x9efec5,null))[_0x8004('0x19')](function(_0x45ee53){if(_0x45ee53){var _0x25e03a=_0x45ee53[_0x8004('0x66')]({'plain':!![]});fs[_0x8004('0x67')](_0x2c8ef2);var _0x132e66={'channel':_0x8004('0x68'),'account':_0x25e03a[_0x8004('0x65')][_0x8004('0x1d')],'agent':_0x25e03a[_0x8004('0x69')]?_0x25e03a[_0x8004('0x69')][_0x8004('0x5a')]:_0x8004('0x6a'),'createdAt':moment(_0x25e03a[_0x8004('0x5f')])[_0x8004('0x46')](_0x8004('0x6b'))[_0x8004('0x52')](),'closedAt':_0x25e03a['closed']?moment(_0x25e03a[_0x8004('0x6c')])[_0x8004('0x46')](_0x8004('0x6b'))['toString']():'','disposition':_0x25e03a[_0x8004('0x6d')],'messages':_(_0x25e03a[_0x8004('0x5e')])[_0x8004('0x41')]({'secret':![]})[_0x8004('0x20')](function(_0xa8583){return{'date':moment(_0xa8583['createdAt'])['format'](_0x8004('0x6b'))[_0x8004('0x52')](),'sender':_0xa8583[_0x8004('0x60')]===_0x8004('0x6e')?_0xa8583['User']?_0xa8583['User'][_0x8004('0x5a')]:_0x8004('0x6f'):_0xa8583[_0x8004('0x70')][_0x8004('0x5c')]+(_0xa8583[_0x8004('0x70')][_0x8004('0x5d')]?'\x20'+_0xa8583[_0x8004('0x70')][_0x8004('0x5d')]:''),'body':_0xa8583['body'],'direction':_0xa8583['direction']===_0x8004('0x6e')?'A':'C','secret':_0xa8583[_0x8004('0x61')],'read':_0xa8583[_0x8004('0x62')]};})[_0x8004('0x71')]()};return ejs['renderFile'](path[_0x8004('0x57')](config[_0x8004('0x53')],_0x8004('0x54'),'views',_0x8004('0x72')),{'interaction':_0x132e66})['then'](function(_0x196703){var _0x26d2c4=path[_0x8004('0x57')](_0x2c8ef2,'transcript-'+_0x25e03a['id']+'-'+_0x1b9bf6+_0x8004('0x73'));var _0x3e101b={'path':_0x26d2c4,'channel':_0x8004('0x68'),'interactionId':_0x25e03a['id']};return pdf['createPdfFromHTML'](_0x196703,_0x3e101b);})[_0x8004('0x19')](function(){return new BPromise(function(_0xc84e3,_0x4c6387){zipdir(_0x2c8ef2,{'saveTo':_0x50092d},function(_0x54e5f5,_0x2b0a86){if(_0x54e5f5)return _0x4c6387(_0x54e5f5);return _0xc84e3(_0x2b0a86);});})[_0x8004('0x19')](function(){return new BPromise(function(_0x2fb7f7,_0x1167a2){rimraf(_0x2c8ef2,function(_0x21f226){if(_0x21f226)_0x1167a2(_0x21f226);return _0x2fb7f7();});});})['then'](function(){return _0x9efec5[_0x8004('0x74')](_0x50092d,_0x4aec51,function(_0x3af652){if(_0x3af652){console[_0x8004('0x75')](_0x8004('0x76'),_0x3af652);}else{fs[_0x8004('0x77')](_0x50092d);}});});});}else{return _0x9efec5[_0x8004('0xf')](0xc8);}})[_0x8004('0x27')](handleError(_0x9efec5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 238c3de..941113e 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 _0xab40=['remove','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x386f6b,_0xc1fa64){var _0x814a0d=function(_0x1b27ca){while(--_0x1b27ca){_0x386f6b['push'](_0x386f6b['shift']());}};_0x814a0d(++_0xc1fa64);}(_0xab40,0xcd));var _0x0ab4=function(_0x4dc069,_0x1774bb){_0x4dc069=_0x4dc069-0x0;var _0x328093=_0xab40[_0x4dc069];return _0x328093;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var SmsInteraction=require(_0x0ab4('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0ab4('0x2')](0x0);var events={'afterCreate':_0x0ab4('0x3'),'afterUpdate':_0x0ab4('0x4'),'afterDestroy':_0x0ab4('0x5')};function emitEvent(_0x14634a){return function(_0x57fac1,_0x5f01aa,_0x28b17a){_0x57fac1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x46d16a){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x46d16a['map'](function(_0x55263d){return{'id':_0x55263d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x57fac1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x30e726){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x9'),_0x30e726[_0x0ab4('0xa')]);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a+':'+_0x57fac1['id'],_0x57fac1);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a,_0x57fac1);_0x28b17a(null);})[_0x0ab4('0xc')](_0x28b17a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0ab4('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0xd7d1=['SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x233b67,_0x3a93e6){var _0x285bd7=function(_0x166484){while(--_0x166484){_0x233b67['push'](_0x233b67['shift']());}};_0x285bd7(++_0x3a93e6);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x12c4b2,_0x530cad){_0x12c4b2=_0x12c4b2-0x0;var _0x3b7746=_0xd7d1[_0x12c4b2];return _0x3b7746;};'use strict';var EventEmitter=require(_0x1d7d('0x0'));var SmsInteraction=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x2')];var SmsMessage=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1d7d('0x4')](0x0);var events={'afterCreate':_0x1d7d('0x5'),'afterUpdate':_0x1d7d('0x6'),'afterDestroy':_0x1d7d('0x7')};function emitEvent(_0x1adb6b){return function(_0x3c0839,_0x1a2564,_0x14b2b9){_0x3c0839['getUsers']({'attributes':['id'],'raw':!![]})[_0x1d7d('0x8')](function(_0x1aa456){_0x3c0839[_0x1d7d('0x9')](_0x1d7d('0xa'),_0x1aa456[_0x1d7d('0xb')](function(_0x268732){return{'id':_0x268732['id']};}));return SmsMessage[_0x1d7d('0xc')]({'where':{'SmsInteractionId':_0x3c0839['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1d7d('0x8')](function(_0x1ad06f){_0x3c0839[_0x1d7d('0x9')](_0x1d7d('0xd'),_0x1ad06f['length']);SmsInteractionEvents[_0x1d7d('0xe')](_0x1adb6b+':'+_0x3c0839['id'],_0x3c0839);SmsInteractionEvents['emit'](_0x1adb6b,_0x3c0839);_0x14b2b9(null);})[_0x1d7d('0xf')](_0x14b2b9(null));};}for(var e in events){if(events[_0x1d7d('0x10')](e)){var event=events[e];SmsInteraction[_0x1d7d('0x11')](e,emitEvent(event));}}module[_0x1d7d('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b6a34f5..0953c74 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 _0x52ef=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x52ef,0xde));var _0xf52e=function(_0x186a56,_0x42f472){_0x186a56=_0x186a56-0x0;var _0x516e86=_0x52ef[_0x186a56];return _0x516e86;};'use strict';var _=require(_0xf52e('0x0'));var util=require(_0xf52e('0x1'));var logger=require(_0xf52e('0x2'))(_0xf52e('0x3'));var moment=require(_0xf52e('0x4'));var BPromise=require(_0xf52e('0x5'));var rp=require(_0xf52e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf52e('0x7'));var attributes=require(_0xf52e('0x8'));module['exports']=function(_0x2ddb22,_0x4f07e2){return _0x2ddb22['define'](_0xf52e('0x9'),attributes,{'tableName':_0xf52e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14a45a,_0x250998,_0x325736){if(_0x14a45a[_0xf52e('0xb')]('closed')){_0x14a45a[_0xf52e('0xc')]=moment()['format'](_0xf52e('0xd'));}_0x325736(null,_0x14a45a);}}});}; \ No newline at end of file +var _0x0660=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x4e30fd,_0x3bad15){var _0x2f1c1e=function(_0x1dcce){while(--_0x1dcce){_0x4e30fd['push'](_0x4e30fd['shift']());}};_0x2f1c1e(++_0x3bad15);}(_0x0660,0x6d));var _0x0066=function(_0x1db41a,_0x4e31a3){_0x1db41a=_0x1db41a-0x0;var _0x1c49e1=_0x0660[_0x1db41a];return _0x1c49e1;};'use strict';var _=require(_0x0066('0x0'));var util=require(_0x0066('0x1'));var logger=require('../../config/logger')(_0x0066('0x2'));var moment=require(_0x0066('0x3'));var BPromise=require(_0x0066('0x4'));var rp=require(_0x0066('0x5'));var fs=require('fs');var path=require(_0x0066('0x6'));var rimraf=require(_0x0066('0x7'));var config=require(_0x0066('0x8'));var attributes=require(_0x0066('0x9'));module[_0x0066('0xa')]=function(_0x15d534,_0x35bfbc){return _0x15d534['define']('SmsInteraction',attributes,{'tableName':_0x0066('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb1410f,_0x30c1f2,_0x339de6){if(_0xb1410f[_0x0066('0xc')](_0x0066('0xd'))){_0xb1410f[_0x0066('0xe')]=moment()['format'](_0x0066('0xf'));}_0x339de6(null,_0xb1410f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3128abf..671f380 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 _0x2974=['message','info','catch','SmsInteraction','update','options','raw','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2974,0x6a));var _0x4297=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x2974[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0x4297('0x0'));var util=require(_0x4297('0x1'));var moment=require(_0x4297('0x2'));var BPromise=require(_0x4297('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4297('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4297('0x5'));var logger=require(_0x4297('0x6'))(_0x4297('0x7'));var config=require(_0x4297('0x8'));var jayson=require(_0x4297('0x9'));var client=jayson[_0x4297('0xa')][_0x4297('0xb')]({'port':0x232a});config['redis']=_[_0x4297('0xc')](config[_0x4297('0xd')],{'host':_0x4297('0xe'),'port':0x18eb});var socket=require(_0x4297('0xf'))(new Redis(config['redis']));require(_0x4297('0x10'))['register'](socket);function respondWithRpcPromise(_0x999382,_0x2ab4cf,_0x4d3db6){return new BPromise(function(_0x37b084,_0x4f7a40){return client['request'](_0x999382,_0x4d3db6)['then'](function(_0x29b04d){logger['info'](_0x4297('0x11'),_0x2ab4cf,_0x4297('0x12'));logger[_0x4297('0x13')](_0x4297('0x14'),_0x2ab4cf,_0x4297('0x12'),JSON[_0x4297('0x15')](_0x29b04d));if(_0x29b04d[_0x4297('0x16')]){if(_0x29b04d[_0x4297('0x16')]['code']===0x1f4){logger[_0x4297('0x16')](_0x4297('0x11'),_0x2ab4cf,_0x29b04d[_0x4297('0x16')][_0x4297('0x17')]);return _0x4f7a40(_0x29b04d['error'][_0x4297('0x17')]);}logger[_0x4297('0x16')](_0x4297('0x11'),_0x2ab4cf,_0x29b04d[_0x4297('0x16')][_0x4297('0x17')]);return _0x37b084(_0x29b04d[_0x4297('0x16')][_0x4297('0x17')]);}else{logger[_0x4297('0x18')](_0x4297('0x11'),_0x2ab4cf,_0x4297('0x12'));_0x37b084(_0x29b04d['result'][_0x4297('0x17')]);}})[_0x4297('0x19')](function(_0x3ee8d7){logger['error'](_0x4297('0x11'),_0x2ab4cf,_0x3ee8d7);_0x4f7a40(_0x3ee8d7);});});}exports['UpdateSmsInteraction']=function(_0x4d7b1c){var _0x3aa3b0=this;return new Promise(function(_0x35d6f8,_0x51a3f0){return db[_0x4297('0x1a')][_0x4297('0x1b')](_0x4d7b1c['body'],{'raw':_0x4d7b1c[_0x4297('0x1c')]?_0x4d7b1c[_0x4297('0x1c')][_0x4297('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d7b1c[_0x4297('0x1c')]?_0x4d7b1c[_0x4297('0x1c')]['where']||null:null,'attributes':_0x4d7b1c[_0x4297('0x1c')]?_0x4d7b1c[_0x4297('0x1c')][_0x4297('0x1e')]||null:null,'limit':_0x4d7b1c['options']?_0x4d7b1c['options'][_0x4297('0x1f')]||null:null})[_0x4297('0x20')](function(_0x5d3dce){logger['info'](_0x4297('0x21'),_0x4d7b1c);logger[_0x4297('0x13')](_0x4297('0x21'),_0x4d7b1c,JSON['stringify'](_0x5d3dce));_0x35d6f8(_0x5d3dce);})['catch'](function(_0x381858){logger[_0x4297('0x16')]('UpdateSmsInteraction',_0x381858[_0x4297('0x17')],_0x4d7b1c);_0x51a3f0(_0x3aa3b0[_0x4297('0x16')](0x1f4,_0x381858[_0x4297('0x17')]));});});};exports[_0x4297('0x22')]=function(_0x47c0fb){return new Promise(function(_0x1bedd6,_0xaa2a){return db['SmsInteraction'][_0x4297('0x23')]({'where':_0x47c0fb[_0x4297('0x1c')]?_0x47c0fb[_0x4297('0x1c')][_0x4297('0x24')]||null:null})[_0x4297('0x20')](function(_0x396bce){if(_0x396bce){return _0x396bce[_0x4297('0x25')](_0x47c0fb['body'][_0x4297('0x26')],_[_0x4297('0x27')](_0x47c0fb[_0x4297('0x28')],[_0x4297('0x26'),'id'])||{});}})[_0x4297('0x29')](function(_0x5275ae){logger[_0x4297('0x18')](_0x4297('0x2a'),_0x47c0fb);logger[_0x4297('0x13')](_0x4297('0x2a'),_0x47c0fb,JSON[_0x4297('0x15')](_0x5275ae));_0x1bedd6(_0x5275ae);})[_0x4297('0x19')](function(_0x6c6fd9){logger[_0x4297('0x16')]('AddTags',_0x6c6fd9[_0x4297('0x17')],_0x47c0fb);_0xaa2a(_this['error'](0x1f4,_0x6c6fd9[_0x4297('0x17')]));});});}; \ No newline at end of file +var _0x23fe=['localhost','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','raw','options','where','attributes','limit','stringify','AddTagsToSmsInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4f91a0,_0x44e433){var _0x5b3608=function(_0x277071){while(--_0x277071){_0x4f91a0['push'](_0x4f91a0['shift']());}};_0x5b3608(++_0x44e433);}(_0x23fe,0x1ab));var _0xe23f=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x23fe[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xe23f('0x0'));var util=require(_0xe23f('0x1'));var moment=require(_0xe23f('0x2'));var BPromise=require(_0xe23f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe23f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe23f('0x5'));var logger=require(_0xe23f('0x6'))(_0xe23f('0x7'));var config=require(_0xe23f('0x8'));var jayson=require(_0xe23f('0x9'));var client=jayson[_0xe23f('0xa')][_0xe23f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe23f('0xc')],{'host':_0xe23f('0xd'),'port':0x18eb});var socket=require(_0xe23f('0xe'))(new Redis(config[_0xe23f('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xeed7a4,_0x50fb6c,_0x53bce2){return new BPromise(function(_0x23f805,_0x157569){return client[_0xe23f('0xf')](_0xeed7a4,_0x53bce2)[_0xe23f('0x10')](function(_0x343b32){logger[_0xe23f('0x11')](_0xe23f('0x12'),_0x50fb6c,_0xe23f('0x13'));logger[_0xe23f('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x50fb6c,_0xe23f('0x13'),JSON['stringify'](_0x343b32));if(_0x343b32['error']){if(_0x343b32[_0xe23f('0x15')]['code']===0x1f4){logger[_0xe23f('0x15')](_0xe23f('0x12'),_0x50fb6c,_0x343b32[_0xe23f('0x15')][_0xe23f('0x16')]);return _0x157569(_0x343b32['error']['message']);}logger[_0xe23f('0x15')](_0xe23f('0x12'),_0x50fb6c,_0x343b32['error'][_0xe23f('0x16')]);return _0x23f805(_0x343b32['error'][_0xe23f('0x16')]);}else{logger[_0xe23f('0x11')](_0xe23f('0x12'),_0x50fb6c,'request\x20sent');_0x23f805(_0x343b32[_0xe23f('0x17')]['message']);}})[_0xe23f('0x18')](function(_0x2180c8){logger[_0xe23f('0x15')](_0xe23f('0x12'),_0x50fb6c,_0x2180c8);_0x157569(_0x2180c8);});});}exports[_0xe23f('0x19')]=function(_0x30dbdb){var _0x23f538=this;return new Promise(function(_0x10d60f,_0x2d1308){return db[_0xe23f('0x1a')]['update'](_0x30dbdb[_0xe23f('0x1b')],{'raw':_0x30dbdb['options']?_0x30dbdb['options'][_0xe23f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30dbdb[_0xe23f('0x1d')]?_0x30dbdb[_0xe23f('0x1d')][_0xe23f('0x1e')]||null:null,'attributes':_0x30dbdb[_0xe23f('0x1d')]?_0x30dbdb[_0xe23f('0x1d')][_0xe23f('0x1f')]||null:null,'limit':_0x30dbdb[_0xe23f('0x1d')]?_0x30dbdb[_0xe23f('0x1d')][_0xe23f('0x20')]||null:null})[_0xe23f('0x10')](function(_0x18e305){logger[_0xe23f('0x11')]('UpdateSmsInteraction',_0x30dbdb);logger[_0xe23f('0x14')](_0xe23f('0x19'),_0x30dbdb,JSON[_0xe23f('0x21')](_0x18e305));_0x10d60f(_0x18e305);})['catch'](function(_0xd3c560){logger[_0xe23f('0x15')](_0xe23f('0x19'),_0xd3c560[_0xe23f('0x16')],_0x30dbdb);_0x2d1308(_0x23f538[_0xe23f('0x15')](0x1f4,_0xd3c560[_0xe23f('0x16')]));});});};exports[_0xe23f('0x22')]=function(_0x120bca){return new Promise(function(_0x4d60d9,_0x1ffd06){return db['SmsInteraction'][_0xe23f('0x23')]({'where':_0x120bca[_0xe23f('0x1d')]?_0x120bca[_0xe23f('0x1d')][_0xe23f('0x1e')]||null:null})['then'](function(_0x4d42f7){if(_0x4d42f7){return _0x4d42f7[_0xe23f('0x24')](_0x120bca[_0xe23f('0x1b')]['ids'],_[_0xe23f('0x25')](_0x120bca['body'],[_0xe23f('0x26'),'id'])||{});}})['spread'](function(_0x1a0c74){logger['info'](_0xe23f('0x27'),_0x120bca);logger[_0xe23f('0x14')](_0xe23f('0x27'),_0x120bca,JSON[_0xe23f('0x21')](_0x1a0c74));_0x4d60d9(_0x1a0c74);})[_0xe23f('0x18')](function(_0x38d21b){logger[_0xe23f('0x15')]('AddTags',_0x38d21b[_0xe23f('0x16')],_0x120bca);_0x1ffd06(_this[_0xe23f('0x15')](0x1f4,_0x38d21b[_0xe23f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e165c2c..e9cb559 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 _0x317c=['remove','emit','removeListener','register','smsInteraction:','./smsInteraction.events','save'];(function(_0x5dc97a,_0x53c33e){var _0x1e6e05=function(_0x46c0d9){while(--_0x46c0d9){_0x5dc97a['push'](_0x5dc97a['shift']());}};_0x1e6e05(++_0x53c33e);}(_0x317c,0x1a9));var _0xc317=function(_0x3fb9d0,_0x1b4a64){_0x3fb9d0=_0x3fb9d0-0x0;var _0x395a61=_0x317c[_0x3fb9d0];return _0x395a61;};'use strict';var SmsInteractionEvents=require(_0xc317('0x0'));var events=[_0xc317('0x1'),_0xc317('0x2'),'update'];function createListener(_0x40d941,_0x40736b){return function(_0x157b61){_0x40736b[_0xc317('0x3')](_0x40d941,_0x157b61);};}function removeListener(_0x5f55d5,_0x2468a4){return function(){SmsInteractionEvents[_0xc317('0x4')](_0x5f55d5,_0x2468a4);};}exports[_0xc317('0x5')]=function(_0x1444e9){for(var _0x5ea979=0x0,_0x107e67=events['length'];_0x5ea979<_0x107e67;_0x5ea979++){var _0x3ee30a=events[_0x5ea979];var _0x1b4acf=createListener(_0xc317('0x6')+_0x3ee30a,_0x1444e9);SmsInteractionEvents['on'](_0x3ee30a,_0x1b4acf);}}; \ No newline at end of file +var _0x0c05=['length','smsInteraction:','./smsInteraction.events','remove','update','register'];(function(_0x3046a2,_0x2d8157){var _0x17d280=function(_0x549be1){while(--_0x549be1){_0x3046a2['push'](_0x3046a2['shift']());}};_0x17d280(++_0x2d8157);}(_0x0c05,0xe0));var _0x50c0=function(_0x3c24c3,_0x39888b){_0x3c24c3=_0x3c24c3-0x0;var _0x23e5e0=_0x0c05[_0x3c24c3];return _0x23e5e0;};'use strict';var SmsInteractionEvents=require(_0x50c0('0x0'));var events=['save',_0x50c0('0x1'),_0x50c0('0x2')];function createListener(_0x34ef58,_0x5f3759){return function(_0x51ba45){_0x5f3759['emit'](_0x34ef58,_0x51ba45);};}function removeListener(_0x17b982,_0x1ebeeb){return function(){SmsInteractionEvents['removeListener'](_0x17b982,_0x1ebeeb);};}exports[_0x50c0('0x3')]=function(_0x54b636){for(var _0x2c40b5=0x0,_0x3ff58d=events[_0x50c0('0x4')];_0x2c40b5<_0x3ff58d;_0x2c40b5++){var _0x18a57c=events[_0x2c40b5];var _0x1ec9f0=createListener(_0x50c0('0x5')+_0x18a57c,_0x54b636);SmsInteractionEvents['on'](_0x18a57c,_0x1ec9f0);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d908830..f5fbf43 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 _0xeb83=['sms','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked'];(function(_0x3daec5,_0x36b941){var _0x357bf3=function(_0x556a77){while(--_0x556a77){_0x3daec5['push'](_0x3daec5['shift']());}};_0x357bf3(++_0x36b941);}(_0xeb83,0xad));var _0x3eb8=function(_0x4f69b5,_0x170d14){_0x4f69b5=_0x4f69b5-0x0;var _0x299181=_0xeb83[_0x4f69b5];return _0x299181;};'use strict';var multer=require(_0x3eb8('0x0'));var util=require(_0x3eb8('0x1'));var path=require(_0x3eb8('0x2'));var timeout=require(_0x3eb8('0x3'));var express=require('express');var router=express[_0x3eb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3eb8('0x5'));var interaction=require(_0x3eb8('0x6'));var config=require(_0x3eb8('0x7'));var controller=require(_0x3eb8('0x8'));router[_0x3eb8('0x9')]('/',auth[_0x3eb8('0xa')](),controller[_0x3eb8('0xb')]);router[_0x3eb8('0x9')]('/describe',auth[_0x3eb8('0xa')](),controller[_0x3eb8('0xc')]);router[_0x3eb8('0x9')](_0x3eb8('0xd'),auth[_0x3eb8('0xa')](),controller['show']);router[_0x3eb8('0xe')]('/',auth[_0x3eb8('0xa')](),interaction[_0x3eb8('0xf')](_0x3eb8('0x10'),_0x3eb8('0x11')),controller[_0x3eb8('0x12')]);router[_0x3eb8('0xe')]('/:id/status',controller[_0x3eb8('0x13')]);router[_0x3eb8('0x14')](_0x3eb8('0xd'),auth[_0x3eb8('0xa')](),controller[_0x3eb8('0x15')]);router[_0x3eb8('0x14')](_0x3eb8('0x16'),auth[_0x3eb8('0xa')](),controller[_0x3eb8('0x17')]);router[_0x3eb8('0x14')](_0x3eb8('0x18'),auth['isAuthenticated'](),controller[_0x3eb8('0x19')]);router['delete'](_0x3eb8('0xd'),auth['isAuthenticated'](),controller[_0x3eb8('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x5e3b=['tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x1c6866,_0x5db355){var _0x4193ee=function(_0x554494){while(--_0x554494){_0x1c6866['push'](_0x1c6866['shift']());}};_0x4193ee(++_0x5db355);}(_0x5e3b,0x79));var _0xb5e3=function(_0x44deb0,_0x36cdc4){_0x44deb0=_0x44deb0-0x0;var _0x859d5c=_0x5e3b[_0x44deb0];return _0x859d5c;};'use strict';var multer=require(_0xb5e3('0x0'));var util=require(_0xb5e3('0x1'));var path=require(_0xb5e3('0x2'));var timeout=require(_0xb5e3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb5e3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5e3('0x5'));var controller=require(_0xb5e3('0x6'));router[_0xb5e3('0x7')]('/',auth[_0xb5e3('0x8')](),controller[_0xb5e3('0x9')]);router[_0xb5e3('0x7')](_0xb5e3('0xa'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0xb')]);router['get'](_0xb5e3('0xc'),auth[_0xb5e3('0x8')](),controller['show']);router[_0xb5e3('0xd')]('/',auth[_0xb5e3('0x8')](),interaction[_0xb5e3('0xe')](_0xb5e3('0xf'),_0xb5e3('0x10')),controller[_0xb5e3('0x11')]);router['post'](_0xb5e3('0x12'),controller[_0xb5e3('0x13')]);router[_0xb5e3('0x14')](_0xb5e3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb5e3('0x14')](_0xb5e3('0x15'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0x16')]);router[_0xb5e3('0x14')](_0xb5e3('0x17'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0x18')]);router[_0xb5e3('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xb5e3('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e255ba3..9f6d93b 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 _0xa03c=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x37539d,_0x1b2924){var _0x1bc044=function(_0x1370c5){while(--_0x1370c5){_0x37539d['push'](_0x37539d['shift']());}};_0x1bc044(++_0x1b2924);}(_0xa03c,0x16a));var _0xca03=function(_0x4b128a,_0x5c2588){_0x4b128a=_0x4b128a-0x0;var _0x382d3c=_0xa03c[_0x4b128a];return _0x382d3c;};'use strict';var Sequelize=require('sequelize');module[_0xca03('0x0')]={'body':{'type':Sequelize[_0xca03('0x1')](_0xca03('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xca03('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xca03('0x4')]('in',_0xca03('0x5')),'defaultValue':_0xca03('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xca03('0x6')](0xbe)},'phone':{'type':Sequelize[_0xca03('0x6')]},'readAt':{'type':Sequelize[_0xca03('0x7')]},'secret':{'type':Sequelize[_0xca03('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xca03('0x1')]}}; \ No newline at end of file +var _0xaf79=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x22cc89,_0x111fc1){var _0x556a2c=function(_0x4fec95){while(--_0x4fec95){_0x22cc89['push'](_0x22cc89['shift']());}};_0x556a2c(++_0x111fc1);}(_0xaf79,0x82));var _0x9af7=function(_0x7baac8,_0x481055){_0x7baac8=_0x7baac8-0x0;var _0x572f4e=_0xaf79[_0x7baac8];return _0x572f4e;};'use strict';var Sequelize=require('sequelize');module[_0x9af7('0x0')]={'body':{'type':Sequelize[_0x9af7('0x1')](_0x9af7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9af7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9af7('0x4')]('in',_0x9af7('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9af7('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9af7('0x6')]},'readAt':{'type':Sequelize[_0x9af7('0x7')]},'secret':{'type':Sequelize[_0x9af7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 336ca3d..b11a305 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 _0xfa94=['Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SmsMessage','findAll','show','params','rawAttributes','body','find','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','SmsInteraction','SmsInteractionId','read1stAt','interaction','get','[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','ContactId','sequelize','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SELECT','reject','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','DELIVERED','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count'];(function(_0x1d7466,_0x161771){var _0x3ebbb6=function(_0x2044f6){while(--_0x2044f6){_0x1d7466['push'](_0x1d7466['shift']());}};_0x3ebbb6(++_0x161771);}(_0xfa94,0xef));var _0x4fa9=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0xfa94[_0x51b80a];return _0x22fdf0;};'use strict';var emlformat=require(_0x4fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x2'));var moment=require(_0x4fa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fa9('0x4'));var util=require(_0x4fa9('0x5'));var path=require(_0x4fa9('0x6'));var sox=require(_0x4fa9('0x7'));var csv=require(_0x4fa9('0x8'));var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa9('0xa'));var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x8'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fa9('0x11'))(_0x4fa9('0x12'));var utils=require('../../config/utils');var config=require(_0x4fa9('0x13'));var licenseUtil=require(_0x4fa9('0x14'));var db=require(_0x4fa9('0x15'))['db'];config['redis']=_[_0x4fa9('0x16')](config['redis'],{'host':_0x4fa9('0x17'),'port':0x18eb});var socket=require(_0x4fa9('0x18'))(new Redis(config['redis']));require(_0x4fa9('0x19'))[_0x4fa9('0x1a')](socket);var jayson=require(_0x4fa9('0x1b'));var client=jayson[_0x4fa9('0x1c')][_0x4fa9('0x1d')]({'port':0x232c});var client9002=jayson[_0x4fa9('0x1c')][_0x4fa9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c28be,_0x328770,_0x4ef6d8,_0x19ea1b){return new BPromise(function(_0x1a1117,_0x4c164f){var _0x56cf7d=_0x19ea1b||client;return _0x56cf7d[_0x4fa9('0x1e')](_0x2c28be,_0x4ef6d8)['then'](function(_0x2fe920){logger[_0x4fa9('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x328770,_0x4fa9('0x20'));logger['debug'](_0x4fa9('0x21'),_0x328770,_0x4fa9('0x20'),JSON[_0x4fa9('0x22')](_0x2fe920));if(_0x2fe920[_0x4fa9('0x23')]){if(_0x2fe920[_0x4fa9('0x23')]['code']===0x1f4){logger[_0x4fa9('0x23')](_0x4fa9('0x24'),_0x328770,_0x2fe920[_0x4fa9('0x23')]['message']);return _0x4c164f(_0x2fe920[_0x4fa9('0x23')][_0x4fa9('0x25')]);}logger[_0x4fa9('0x23')](_0x4fa9('0x24'),_0x328770,_0x2fe920[_0x4fa9('0x23')][_0x4fa9('0x25')]);return _0x1a1117(_0x2fe920[_0x4fa9('0x23')][_0x4fa9('0x25')]);}else{logger[_0x4fa9('0x1f')](_0x4fa9('0x24'),_0x328770,_0x4fa9('0x20'));_0x1a1117(_0x2fe920[_0x4fa9('0x26')][_0x4fa9('0x25')]);}})[_0x4fa9('0x27')](function(_0x1d00c9){logger[_0x4fa9('0x23')](_0x4fa9('0x24'),_0x328770,_0x1d00c9);_0x4c164f(_0x1d00c9);});});}function respondWithStatusCode(_0x1e5836,_0x1fe8ba){_0x1fe8ba=_0x1fe8ba||0xcc;return function(_0x31a3fb){if(_0x31a3fb){return _0x1e5836['sendStatus'](_0x1fe8ba);}return _0x1e5836[_0x4fa9('0x28')](_0x1fe8ba)[_0x4fa9('0x29')]();};}function respondWithResult(_0x12f169,_0xdeffbf){_0xdeffbf=_0xdeffbf||0xc8;return function(_0x9bc956){if(_0x9bc956){return _0x12f169[_0x4fa9('0x28')](_0xdeffbf)[_0x4fa9('0x2a')](_0x9bc956);}};}function respondWithFilteredResult(_0x5545b9,_0x384d4e){return function(_0x1185df){if(_0x1185df){var _0x13cf76=typeof _0x384d4e[_0x4fa9('0x2b')]===_0x4fa9('0x2c')&&typeof _0x384d4e[_0x4fa9('0x2d')]===_0x4fa9('0x2c');var _0x2f7d40=_0x1185df[_0x4fa9('0x2e')];var _0x472173=_0x13cf76?0x0:_0x384d4e[_0x4fa9('0x2b')];var _0x8aae26=_0x13cf76?_0x1185df[_0x4fa9('0x2e')]:_0x384d4e[_0x4fa9('0x2b')]+_0x384d4e[_0x4fa9('0x2d')];var _0x1fa94e;if(_0x8aae26>=_0x2f7d40){_0x8aae26=_0x2f7d40;_0x1fa94e=0xc8;}else{_0x1fa94e=0xce;}_0x5545b9[_0x4fa9('0x28')](_0x1fa94e);return _0x5545b9['set'](_0x4fa9('0x2f'),_0x472173+'-'+_0x8aae26+'/'+_0x2f7d40)[_0x4fa9('0x2a')](_0x1185df);}return null;};}function patchUpdates(_0x224297){return function(_0x96945){try{jsonpatch[_0x4fa9('0x30')](_0x96945,_0x224297,!![]);}catch(_0x357bd3){return BPromise['reject'](_0x357bd3);}return _0x96945[_0x4fa9('0x31')]();};}function saveUpdates(_0x2fe7d3,_0x3f8846){return function(_0x515ba3){if(_0x515ba3){return _0x515ba3[_0x4fa9('0x32')](_0x2fe7d3)['then'](function(_0x5813be){return _0x5813be;});}return null;};}function removeEntity(_0xa8e93e,_0x591844){return function(_0x3d5739){if(_0x3d5739){return _0x3d5739[_0x4fa9('0x33')]()[_0x4fa9('0x34')](function(){_0xa8e93e[_0x4fa9('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0533f,_0x3449bb){return function(_0x3e1e6a){if(!_0x3e1e6a){_0xa0533f['sendStatus'](0x194);}return _0x3e1e6a;};}function handleError(_0xb56ddd,_0x450f06){_0x450f06=_0x450f06||0x1f4;return function(_0x30557e){logger[_0x4fa9('0x23')](_0x30557e[_0x4fa9('0x35')]);if(_0x30557e[_0x4fa9('0x36')]){delete _0x30557e[_0x4fa9('0x36')];}_0xb56ddd[_0x4fa9('0x28')](_0x450f06)[_0x4fa9('0x37')](_0x30557e);};}exports[_0x4fa9('0x38')]=function(_0x2781d5,_0x828dc1){var _0x581aaa={},_0x4022fd={},_0x4cf490={'count':0x0,'rows':[]};var _0x5c89c5=_[_0x4fa9('0x39')](db['SmsMessage']['rawAttributes'],function(_0x4b05a6){return{'name':_0x4b05a6[_0x4fa9('0x3a')],'type':_0x4b05a6[_0x4fa9('0x3b')]['key']};});_0x4022fd[_0x4fa9('0x3c')]=_['map'](_0x5c89c5,'name');_0x4022fd[_0x4fa9('0x3d')]=_[_0x4fa9('0x3e')](_0x2781d5[_0x4fa9('0x3d')]);_0x4022fd[_0x4fa9('0x3f')]=_[_0x4fa9('0x40')](_0x4022fd[_0x4fa9('0x3c')],_0x4022fd[_0x4fa9('0x3d')]);_0x581aaa['attributes']=_['intersection'](_0x4022fd[_0x4fa9('0x3c')],qs['fields'](_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x41')]));_0x581aaa[_0x4fa9('0x42')]=_0x581aaa[_0x4fa9('0x42')]['length']?_0x581aaa[_0x4fa9('0x42')]:_0x4022fd['model'];if(!_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x43')](_0x4fa9('0x44'))){_0x581aaa[_0x4fa9('0x2d')]=qs[_0x4fa9('0x2d')](_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x2d')]);_0x581aaa[_0x4fa9('0x2b')]=qs['offset'](_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x2b')]);}_0x581aaa[_0x4fa9('0x45')]=qs['sort'](_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x46')]);_0x581aaa[_0x4fa9('0x47')]=qs[_0x4fa9('0x3f')](_[_0x4fa9('0x48')](_0x2781d5[_0x4fa9('0x3d')],_0x4022fd[_0x4fa9('0x3f')]),_0x5c89c5);if(_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x49')]){_0x581aaa[_0x4fa9('0x47')]=_[_0x4fa9('0x4a')](_0x581aaa[_0x4fa9('0x47')],{'$or':_['map'](_0x5c89c5,function(_0x7addd3){if(_0x7addd3[_0x4fa9('0x3b')]!==_0x4fa9('0x4b')){var _0x168da7={};_0x168da7[_0x7addd3[_0x4fa9('0x36')]]={'$like':'%'+_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x49')]+'%'};return _0x168da7;}})});}_0x581aaa=_[_0x4fa9('0x4a')]({},_0x581aaa,_0x2781d5[_0x4fa9('0x4c')]);var _0x1261e9={'where':_0x581aaa[_0x4fa9('0x47')]};return db['SmsMessage']['count'](_0x1261e9)[_0x4fa9('0x34')](function(_0x53113e){_0x4cf490[_0x4fa9('0x2e')]=_0x53113e;if(_0x2781d5[_0x4fa9('0x3d')][_0x4fa9('0x4d')]){_0x581aaa[_0x4fa9('0x4e')]=[{'all':!![]}];}return db[_0x4fa9('0x4f')][_0x4fa9('0x50')](_0x581aaa);})['then'](function(_0x569123){_0x4cf490['rows']=_0x569123;return _0x4cf490;})[_0x4fa9('0x34')](respondWithFilteredResult(_0x828dc1,_0x581aaa))['catch'](handleError(_0x828dc1,null));};exports[_0x4fa9('0x51')]=function(_0x374c4b,_0x2cc580){var _0x12a746={'raw':!![],'where':{'id':_0x374c4b[_0x4fa9('0x52')]['id']}},_0x5c1b21={};_0x5c1b21[_0x4fa9('0x3c')]=_['keys'](db[_0x4fa9('0x4f')][_0x4fa9('0x53')]);_0x5c1b21[_0x4fa9('0x3d')]=_[_0x4fa9('0x3e')](_0x374c4b[_0x4fa9('0x3d')]);_0x5c1b21[_0x4fa9('0x3f')]=_['intersection'](_0x5c1b21['model'],_0x5c1b21[_0x4fa9('0x3d')]);_0x12a746['attributes']=_[_0x4fa9('0x40')](_0x5c1b21[_0x4fa9('0x3c')],qs[_0x4fa9('0x41')](_0x374c4b[_0x4fa9('0x3d')][_0x4fa9('0x41')]));_0x12a746[_0x4fa9('0x42')]=_0x12a746[_0x4fa9('0x42')]['length']?_0x12a746[_0x4fa9('0x42')]:_0x5c1b21['model'];if(_0x374c4b[_0x4fa9('0x3d')][_0x4fa9('0x4d')]){_0x12a746[_0x4fa9('0x4e')]=[{'all':!![]}];}_0x12a746=_[_0x4fa9('0x4a')]({},_0x12a746,_0x374c4b[_0x4fa9('0x4c')]);return db[_0x4fa9('0x4f')]['find'](_0x12a746)['then'](handleEntityNotFound(_0x2cc580,null))['then'](respondWithResult(_0x2cc580,null))[_0x4fa9('0x27')](handleError(_0x2cc580,null));};exports['create']=function(_0x153776,_0x7aaf3c){return db[_0x4fa9('0x4f')]['create'](_0x153776['body'],{})['then'](respondWithResult(_0x7aaf3c,0xc9))['catch'](handleError(_0x7aaf3c,null));};exports[_0x4fa9('0x32')]=function(_0x4e75d3,_0xfbf320){if(_0x4e75d3['body']['id']){delete _0x4e75d3[_0x4fa9('0x54')]['id'];}return db[_0x4fa9('0x4f')][_0x4fa9('0x55')]({'where':{'id':_0x4e75d3[_0x4fa9('0x52')]['id']}})[_0x4fa9('0x34')](handleEntityNotFound(_0xfbf320,null))[_0x4fa9('0x34')](saveUpdates(_0x4e75d3[_0x4fa9('0x54')],null))[_0x4fa9('0x34')](respondWithResult(_0xfbf320,null))[_0x4fa9('0x27')](handleError(_0xfbf320,null));};exports[_0x4fa9('0x33')]=function(_0x366f69,_0x304a69){return db['SmsMessage'][_0x4fa9('0x55')]({'where':{'id':_0x366f69[_0x4fa9('0x52')]['id']}})[_0x4fa9('0x34')](handleEntityNotFound(_0x304a69,null))[_0x4fa9('0x34')](removeEntity(_0x304a69,null))[_0x4fa9('0x27')](handleError(_0x304a69,null));};exports['describe']=function(_0x55bf91,_0x108bdc){return db[_0x4fa9('0x4f')][_0x4fa9('0x56')]()[_0x4fa9('0x34')](respondWithResult(_0x108bdc,null))[_0x4fa9('0x27')](handleError(_0x108bdc,null));};var interaction_log=require(_0x4fa9('0x11'))('sms-interactions');exports[_0x4fa9('0x57')]=function(_0x22a1f3,_0x41466f,_0x9e8bc0){var _0x3512a4={'agent':{},'channel':'sms'};if(_0x22a1f3[_0x4fa9('0x54')]['id']){delete _0x22a1f3[_0x4fa9('0x54')]['id'];}_0x22a1f3[_0x4fa9('0x54')][_0x4fa9('0x58')]=!![];_0x22a1f3['body'][_0x4fa9('0x59')]=moment()[_0x4fa9('0x5a')](_0x4fa9('0x5b'));_0x22a1f3[_0x4fa9('0x54')][_0x4fa9('0x5c')]=_0x22a1f3[_0x4fa9('0x54')]['UserId']||_0x22a1f3[_0x4fa9('0x5d')]['id'];_0x3512a4['agent']['id']=_0x22a1f3[_0x4fa9('0x54')][_0x4fa9('0x5c')];return db[_0x4fa9('0x4f')][_0x4fa9('0x55')]({'where':{'id':_0x22a1f3['params']['id'],'UserId':null}})[_0x4fa9('0x34')](handleEntityNotFound(_0x41466f,null))[_0x4fa9('0x34')](saveUpdates(_0x22a1f3[_0x4fa9('0x54')],null))[_0x4fa9('0x34')](function(_0x58158e){if(_0x58158e){_0x3512a4[_0x4fa9('0x25')]=_0x58158e['get']({'plain':!![]});return db[_0x4fa9('0x5e')][_0x4fa9('0x55')]({'where':{'id':_0x58158e[_0x4fa9('0x5f')]}});}return null;})[_0x4fa9('0x34')](handleEntityNotFound(_0x41466f,null))[_0x4fa9('0x34')](function(_0x121d50){if(_0x121d50){return _0x121d50[_0x4fa9('0x32')]({'UserId':_0x22a1f3[_0x4fa9('0x54')][_0x4fa9('0x5c')],'read1stAt':_['isNil'](_0x121d50[_0x4fa9('0x60')])?moment()['format'](_0x4fa9('0x5b')):undefined});}return null;})['then'](function(_0x277b27){if(_0x277b27){_0x3512a4[_0x4fa9('0x61')]=_0x277b27[_0x4fa9('0x62')]({'plain':!![]});interaction_log[_0x4fa9('0x1f')](_0x4fa9('0x63'),_0x22a1f3[_0x4fa9('0x5d')]['id'],_0x22a1f3[_0x4fa9('0x5d')][_0x4fa9('0x36')],_0x22a1f3[_0x4fa9('0x5d')][_0x4fa9('0x64')],_0x3512a4[_0x4fa9('0x61')]['id'],_0x22a1f3[_0x4fa9('0x54')]?JSON[_0x4fa9('0x22')](_0x22a1f3[_0x4fa9('0x54')]):_0x4fa9('0x65'));return respondWithRpcPromise(_0x4fa9('0x66'),_0x4fa9('0x67'),_0x3512a4);}return null;})[_0x4fa9('0x34')](function(_0x2c7b7){var _0x105d74=_0x4fa9('0x68')+_0x2c7b7[_0x4fa9('0x25')][_0x4fa9('0x69')];return db[_0x4fa9('0x6a')][_0x4fa9('0x3d')](_0x105d74,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x5bdfbf){return _0x5bdfbf;});})['then'](function(_0x444039){if(_0x444039){_0x3512a4[_0x4fa9('0x25')][_0x4fa9('0x6b')]=_0x444039[0x0];if(!_0x22a1f3[_0x4fa9('0x54')]['UserId'])return;return db[_0x4fa9('0x6c')][_0x4fa9('0x55')]({'where':{'id':_0x22a1f3[_0x4fa9('0x54')]['UserId'],'role':_0x4fa9('0x6d')},'attributes':['id',_0x4fa9('0x36'),_0x4fa9('0x6e'),_0x4fa9('0x6f'),_0x4fa9('0x70')],'raw':!![]});}return null;})[_0x4fa9('0x34')](function(_0x47bd03){if(!_0x47bd03)return null;_0x3512a4[_0x4fa9('0x25')]['agent']=_0x47bd03;return _0x3512a4;})[_0x4fa9('0x34')](function(_0x1817a8){if(_0x1817a8){if(_0x22a1f3['body'][_0x4fa9('0x71')]){_0x3512a4[_0x4fa9('0x25')][_0x4fa9('0x72')]=util['format']('SIP/%s',_0x22a1f3[_0x4fa9('0x5d')][_0x4fa9('0x36')]);_0x3512a4[_0x4fa9('0x25')][_0x4fa9('0x73')]=_0x3512a4['channel'];_0x3512a4[_0x4fa9('0x25')][_0x4fa9('0x74')]=_0x3512a4[_0x4fa9('0x73')];_0x3512a4['message'][_0x4fa9('0x75')]=_0x4fa9('0x57');return respondWithRpcPromise(_0x4fa9('0x76'),'EventManager',{'event':_0x4fa9('0x77'),'message':_0x3512a4['message']},client9002)[_0x4fa9('0x34')](function(){return _0x3512a4;});}return _0x3512a4;}return null;})[_0x4fa9('0x34')](respondWithResult(_0x41466f,null))[_0x4fa9('0x27')](handleError(_0x41466f,null));};var interaction_log=require(_0x4fa9('0x11'))(_0x4fa9('0x78'));exports['reject']=function(_0x5c9806,_0x45f169,_0x3cae67){var _0xaf03dc={'agent':{},'channel':_0x4fa9('0x79')};if(_0x5c9806[_0x4fa9('0x54')]['id']){delete _0x5c9806['body']['id'];}_0x5c9806['body'][_0x4fa9('0x5c')]=_0x5c9806[_0x4fa9('0x54')][_0x4fa9('0x5c')]||_0x5c9806[_0x4fa9('0x5d')]['id'];_0xaf03dc[_0x4fa9('0x6d')]['id']=_0x5c9806[_0x4fa9('0x54')]['UserId'];return db[_0x4fa9('0x4f')][_0x4fa9('0x55')]({'where':{'id':_0x5c9806[_0x4fa9('0x52')]['id'],'UserId':null}})[_0x4fa9('0x34')](handleEntityNotFound(_0x45f169,null))[_0x4fa9('0x34')](function(_0x1ffa0b){if(_0x1ffa0b){_0xaf03dc[_0x4fa9('0x25')]=_0x1ffa0b[_0x4fa9('0x62')]({'plain':!![]});return db[_0x4fa9('0x5e')][_0x4fa9('0x55')]({'where':{'id':_0x1ffa0b[_0x4fa9('0x5f')]}});}return null;})[_0x4fa9('0x34')](handleEntityNotFound(_0x45f169,null))[_0x4fa9('0x34')](function(_0x2713db){if(_0x2713db){_0xaf03dc[_0x4fa9('0x61')]=_0x2713db[_0x4fa9('0x62')]({'plain':!![]});interaction_log[_0x4fa9('0x1f')](_0x4fa9('0x7a'),_0x5c9806['user']['id'],_0x5c9806['user'][_0x4fa9('0x36')],_0x5c9806[_0x4fa9('0x5d')][_0x4fa9('0x64')],_0xaf03dc[_0x4fa9('0x61')]['id'],_0x5c9806[_0x4fa9('0x54')]?JSON[_0x4fa9('0x22')](_0x5c9806[_0x4fa9('0x54')]):_0x4fa9('0x65'));return respondWithRpcPromise(_0x4fa9('0x7b'),_0x4fa9('0x7c'),_0xaf03dc);}return null;})[_0x4fa9('0x34')](function(_0x424f7a){var _0x124c5e=_0x4fa9('0x68')+_0x424f7a['message'][_0x4fa9('0x69')];return db[_0x4fa9('0x6a')][_0x4fa9('0x3d')](_0x124c5e,{'type':db[_0x4fa9('0x7d')]['QueryTypes'][_0x4fa9('0x7e')],'raw':!![]})[_0x4fa9('0x34')](function(_0x21e41d){return _0x21e41d;});})[_0x4fa9('0x34')](function(_0x4135c6){if(_0x4135c6){_0xaf03dc[_0x4fa9('0x25')][_0x4fa9('0x6b')]=_0x4135c6[0x0];if(!_0x5c9806[_0x4fa9('0x54')]['UserId'])return;return db[_0x4fa9('0x6c')]['find']({'where':{'id':_0x5c9806[_0x4fa9('0x54')][_0x4fa9('0x5c')],'role':_0x4fa9('0x6d')},'attributes':['id',_0x4fa9('0x36'),_0x4fa9('0x6e'),_0x4fa9('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3d5b2c){if(!_0x3d5b2c)return null;_0xaf03dc[_0x4fa9('0x25')][_0x4fa9('0x6d')]=_0x3d5b2c;return _0xaf03dc;})[_0x4fa9('0x34')](function(_0x554154){if(_0x554154){_0x554154[_0x4fa9('0x25')][_0x4fa9('0x72')]=util[_0x4fa9('0x5a')]('SIP/%s',_0x5c9806[_0x4fa9('0x5d')][_0x4fa9('0x36')]);_0x554154[_0x4fa9('0x25')][_0x4fa9('0x73')]=_0xaf03dc['channel'];_0x554154[_0x4fa9('0x25')]['motionChannel']=_0xaf03dc['channel'];_0x554154[_0x4fa9('0x25')][_0x4fa9('0x75')]=_0x4fa9('0x7f');respondWithRpcPromise('EventManager',_0x4fa9('0x76'),{'event':_0x4fa9('0x80'),'message':_0x554154[_0x4fa9('0x25')]},client9002);return _0xaf03dc;}return null;})[_0x4fa9('0x34')](respondWithResult(_0x45f169,null))[_0x4fa9('0x27')](handleError(_0x45f169,null));};exports[_0x4fa9('0x28')]=function(_0x3e7e5c,_0x9a59be,_0x5f445c){if(_0x3e7e5c[_0x4fa9('0x54')]['id']){delete _0x3e7e5c[_0x4fa9('0x54')]['id'];}var _0x3867c0;return db[_0x4fa9('0x4f')]['find']({'where':{'id':_0x3e7e5c[_0x4fa9('0x52')]['id']}})['then'](handleEntityNotFound(_0x9a59be,null))[_0x4fa9('0x34')](function(_0x18e6f6){if(_0x18e6f6){_0x3867c0=_0x18e6f6;return db['SmsAccount'][_0x4fa9('0x55')]({'where':{'id':_0x18e6f6[_0x4fa9('0x81')]}});}})[_0x4fa9('0x34')](handleEntityNotFound(_0x9a59be,null))['then'](function(_0x44015d){if(_0x44015d){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fa9('0x28'),'received\x20delivery\x20report\x20from',_0x44015d[_0x4fa9('0x3b')],util[_0x4fa9('0x82')](_0x3e7e5c[_0x4fa9('0x54')],{'showHidden':![],'depth':null}));switch(_0x44015d[_0x4fa9('0x3b')]){case _0x4fa9('0x83'):if(_0x3e7e5c[_0x4fa9('0x54')][_0x4fa9('0x84')]&&_0x3e7e5c[_0x4fa9('0x54')][_0x4fa9('0x84')]===_0x3867c0[_0x4fa9('0x85')]){return _0x3867c0[_0x4fa9('0x32')]({'read':!![]});}else{logger[_0x4fa9('0x23')](_0x4fa9('0x86'),_0x4fa9('0x28'),_0x4fa9('0x83'),util[_0x4fa9('0x82')](_0x3e7e5c['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3e7e5c[_0x4fa9('0x54')][_0x4fa9('0x87')]&&_0x3e7e5c[_0x4fa9('0x54')][_0x4fa9('0x87')]===_0x3867c0[_0x4fa9('0x85')]&&_[_0x4fa9('0x88')]([_0x4fa9('0x89'),_0x4fa9('0x8a')],_0x3e7e5c[_0x4fa9('0x54')][_0x4fa9('0x8b')])>=0x0){return _0x3867c0[_0x4fa9('0x32')]({'read':!![]});}else{logger[_0x4fa9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4fa9('0x8c'),util[_0x4fa9('0x82')](_0x3e7e5c[_0x4fa9('0x54')],{'showHidden':![],'depth':null}));}break;case _0x4fa9('0x8d'):var _0x381361=_0x3e7e5c[_0x4fa9('0x54')]['results'][0x0];if(_0x381361[_0x4fa9('0x28')]['groupName']===_0x4fa9('0x8e')){return _0x3867c0[_0x4fa9('0x32')]({'read':!![]});}else{logger[_0x4fa9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fa9('0x28'),'infobip',util[_0x4fa9('0x82')](_0x3e7e5c[_0x4fa9('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x3867c0;}})[_0x4fa9('0x34')](respondWithResult(_0x9a59be,null))[_0x4fa9('0x27')](handleError(_0x9a59be,null));}; \ No newline at end of file +var _0xa486=['nolimit','sort','where','filters','type','filter','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','sequelize','Sequelize','SELECT','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','infobip','groupName','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x58e92d,_0x1181bd){var _0x45d179=function(_0xf162a4){while(--_0xf162a4){_0x58e92d['push'](_0x58e92d['shift']());}};_0x45d179(++_0x1181bd);}(_0xa486,0x17d));var _0x6a48=function(_0x843839,_0x1f1a63){_0x843839=_0x843839-0x0;var _0x3373d7=_0xa486[_0x843839];return _0x3373d7;};'use strict';var emlformat=require(_0x6a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a48('0x2'));var moment=require('moment');var BPromise=require(_0x6a48('0x3'));var Mustache=require(_0x6a48('0x4'));var util=require(_0x6a48('0x5'));var path=require(_0x6a48('0x6'));var sox=require(_0x6a48('0x7'));var csv=require(_0x6a48('0x8'));var ejs=require(_0x6a48('0x9'));var fs=require('fs');var fs_extra=require(_0x6a48('0xa'));var _=require(_0x6a48('0xb'));var squel=require(_0x6a48('0xc'));var crypto=require(_0x6a48('0xd'));var jsforce=require(_0x6a48('0xe'));var deskjs=require(_0x6a48('0xf'));var toCsv=require(_0x6a48('0x8'));var querystring=require(_0x6a48('0x10'));var Papa=require(_0x6a48('0x11'));var Redis=require('ioredis');var authService=require(_0x6a48('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))(_0x6a48('0x16'));var utils=require(_0x6a48('0x17'));var config=require(_0x6a48('0x18'));var licenseUtil=require(_0x6a48('0x19'));var db=require(_0x6a48('0x1a'))['db'];config[_0x6a48('0x1b')]=_[_0x6a48('0x1c')](config[_0x6a48('0x1b')],{'host':_0x6a48('0x1d'),'port':0x18eb});var socket=require(_0x6a48('0x1e'))(new Redis(config[_0x6a48('0x1b')]));require(_0x6a48('0x1f'))[_0x6a48('0x20')](socket);var jayson=require(_0x6a48('0x21'));var client=jayson[_0x6a48('0x22')][_0x6a48('0x23')]({'port':0x232c});var client9002=jayson[_0x6a48('0x22')][_0x6a48('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x10867e,_0x231930,_0xaf303c,_0xad96d0){return new BPromise(function(_0x2ca540,_0x41218a){var _0x20cab5=_0xad96d0||client;return _0x20cab5['request'](_0x10867e,_0xaf303c)[_0x6a48('0x24')](function(_0x23a1fe){logger[_0x6a48('0x25')](_0x6a48('0x26'),_0x231930,'request\x20sent');logger[_0x6a48('0x27')](_0x6a48('0x28'),_0x231930,_0x6a48('0x29'),JSON['stringify'](_0x23a1fe));if(_0x23a1fe[_0x6a48('0x2a')]){if(_0x23a1fe[_0x6a48('0x2a')][_0x6a48('0x2b')]===0x1f4){logger['error'](_0x6a48('0x26'),_0x231930,_0x23a1fe[_0x6a48('0x2a')][_0x6a48('0x2c')]);return _0x41218a(_0x23a1fe[_0x6a48('0x2a')]['message']);}logger[_0x6a48('0x2a')](_0x6a48('0x26'),_0x231930,_0x23a1fe['error']['message']);return _0x2ca540(_0x23a1fe[_0x6a48('0x2a')][_0x6a48('0x2c')]);}else{logger['info'](_0x6a48('0x26'),_0x231930,'request\x20sent');_0x2ca540(_0x23a1fe['result']['message']);}})['catch'](function(_0x2a14d5){logger['error'](_0x6a48('0x26'),_0x231930,_0x2a14d5);_0x41218a(_0x2a14d5);});});}function respondWithStatusCode(_0x52de7c,_0x5b1331){_0x5b1331=_0x5b1331||0xcc;return function(_0x483278){if(_0x483278){return _0x52de7c['sendStatus'](_0x5b1331);}return _0x52de7c[_0x6a48('0x2d')](_0x5b1331)[_0x6a48('0x2e')]();};}function respondWithResult(_0x2cb60e,_0x20ecb0){_0x20ecb0=_0x20ecb0||0xc8;return function(_0x4c53cc){if(_0x4c53cc){return _0x2cb60e[_0x6a48('0x2d')](_0x20ecb0)[_0x6a48('0x2f')](_0x4c53cc);}};}function respondWithFilteredResult(_0xf450b,_0x13fe57){return function(_0x5188e8){if(_0x5188e8){var _0x57522a=typeof _0x13fe57[_0x6a48('0x30')]===_0x6a48('0x31')&&typeof _0x13fe57[_0x6a48('0x32')]===_0x6a48('0x31');var _0x437622=_0x5188e8['count'];var _0x16982f=_0x57522a?0x0:_0x13fe57['offset'];var _0x50e0e8=_0x57522a?_0x5188e8[_0x6a48('0x33')]:_0x13fe57[_0x6a48('0x30')]+_0x13fe57[_0x6a48('0x32')];var _0xd53693;if(_0x50e0e8>=_0x437622){_0x50e0e8=_0x437622;_0xd53693=0xc8;}else{_0xd53693=0xce;}_0xf450b[_0x6a48('0x2d')](_0xd53693);return _0xf450b[_0x6a48('0x34')](_0x6a48('0x35'),_0x16982f+'-'+_0x50e0e8+'/'+_0x437622)[_0x6a48('0x2f')](_0x5188e8);}return null;};}function patchUpdates(_0x1372ef){return function(_0x27504a){try{jsonpatch[_0x6a48('0x36')](_0x27504a,_0x1372ef,!![]);}catch(_0x28ebfc){return BPromise['reject'](_0x28ebfc);}return _0x27504a[_0x6a48('0x37')]();};}function saveUpdates(_0x32a90b,_0x53e85b){return function(_0x5502bb){if(_0x5502bb){return _0x5502bb[_0x6a48('0x38')](_0x32a90b)['then'](function(_0x13d303){return _0x13d303;});}return null;};}function removeEntity(_0x4ba7f8,_0x42cd76){return function(_0x259cab){if(_0x259cab){return _0x259cab[_0x6a48('0x39')]()['then'](function(){_0x4ba7f8[_0x6a48('0x2d')](0xcc)[_0x6a48('0x2e')]();});}};}function handleEntityNotFound(_0x51703a,_0x53004c){return function(_0x2e6472){if(!_0x2e6472){_0x51703a[_0x6a48('0x3a')](0x194);}return _0x2e6472;};}function handleError(_0x4f3ec1,_0x5bf085){_0x5bf085=_0x5bf085||0x1f4;return function(_0xd33ad9){logger[_0x6a48('0x2a')](_0xd33ad9[_0x6a48('0x3b')]);if(_0xd33ad9[_0x6a48('0x3c')]){delete _0xd33ad9['name'];}_0x4f3ec1[_0x6a48('0x2d')](_0x5bf085)[_0x6a48('0x3d')](_0xd33ad9);};}exports[_0x6a48('0x3e')]=function(_0x2b236b,_0x228297){var _0x434f53={},_0x2e085c={},_0x399e13={'count':0x0,'rows':[]};var _0x2b5773=_[_0x6a48('0x3f')](db[_0x6a48('0x40')][_0x6a48('0x41')],function(_0x19244f){return{'name':_0x19244f[_0x6a48('0x42')],'type':_0x19244f['type'][_0x6a48('0x43')]};});_0x2e085c[_0x6a48('0x44')]=_['map'](_0x2b5773,_0x6a48('0x3c'));_0x2e085c[_0x6a48('0x45')]=_[_0x6a48('0x46')](_0x2b236b[_0x6a48('0x45')]);_0x2e085c['filters']=_[_0x6a48('0x47')](_0x2e085c[_0x6a48('0x44')],_0x2e085c[_0x6a48('0x45')]);_0x434f53[_0x6a48('0x48')]=_[_0x6a48('0x47')](_0x2e085c[_0x6a48('0x44')],qs[_0x6a48('0x49')](_0x2b236b['query']['fields']));_0x434f53[_0x6a48('0x48')]=_0x434f53[_0x6a48('0x48')]['length']?_0x434f53[_0x6a48('0x48')]:_0x2e085c[_0x6a48('0x44')];if(!_0x2b236b['query'][_0x6a48('0x4a')](_0x6a48('0x4b'))){_0x434f53[_0x6a48('0x32')]=qs[_0x6a48('0x32')](_0x2b236b[_0x6a48('0x45')]['limit']);_0x434f53[_0x6a48('0x30')]=qs['offset'](_0x2b236b['query'][_0x6a48('0x30')]);}_0x434f53['order']=qs[_0x6a48('0x4c')](_0x2b236b['query'][_0x6a48('0x4c')]);_0x434f53[_0x6a48('0x4d')]=qs[_0x6a48('0x4e')](_['pick'](_0x2b236b[_0x6a48('0x45')],_0x2e085c['filters']),_0x2b5773);if(_0x2b236b['query']['filter']){_0x434f53[_0x6a48('0x4d')]=_['merge'](_0x434f53[_0x6a48('0x4d')],{'$or':_[_0x6a48('0x3f')](_0x2b5773,function(_0x277950){if(_0x277950[_0x6a48('0x4f')]!=='VIRTUAL'){var _0xa57759={};_0xa57759[_0x277950['name']]={'$like':'%'+_0x2b236b[_0x6a48('0x45')][_0x6a48('0x50')]+'%'};return _0xa57759;}})});}_0x434f53=_['merge']({},_0x434f53,_0x2b236b['options']);var _0x1b942b={'where':_0x434f53[_0x6a48('0x4d')]};return db['SmsMessage'][_0x6a48('0x33')](_0x1b942b)[_0x6a48('0x24')](function(_0x11c34d){_0x399e13[_0x6a48('0x33')]=_0x11c34d;if(_0x2b236b[_0x6a48('0x45')][_0x6a48('0x51')]){_0x434f53[_0x6a48('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x6a48('0x53')](_0x434f53);})[_0x6a48('0x24')](function(_0x4dbbad){_0x399e13[_0x6a48('0x54')]=_0x4dbbad;return _0x399e13;})[_0x6a48('0x24')](respondWithFilteredResult(_0x228297,_0x434f53))[_0x6a48('0x55')](handleError(_0x228297,null));};exports[_0x6a48('0x56')]=function(_0x375358,_0x58b400){var _0xf58971={'raw':!![],'where':{'id':_0x375358[_0x6a48('0x57')]['id']}},_0x1ce605={};_0x1ce605[_0x6a48('0x44')]=_[_0x6a48('0x46')](db['SmsMessage']['rawAttributes']);_0x1ce605[_0x6a48('0x45')]=_[_0x6a48('0x46')](_0x375358[_0x6a48('0x45')]);_0x1ce605['filters']=_[_0x6a48('0x47')](_0x1ce605['model'],_0x1ce605[_0x6a48('0x45')]);_0xf58971[_0x6a48('0x48')]=_['intersection'](_0x1ce605[_0x6a48('0x44')],qs[_0x6a48('0x49')](_0x375358[_0x6a48('0x45')][_0x6a48('0x49')]));_0xf58971[_0x6a48('0x48')]=_0xf58971[_0x6a48('0x48')][_0x6a48('0x58')]?_0xf58971['attributes']:_0x1ce605[_0x6a48('0x44')];if(_0x375358[_0x6a48('0x45')]['includeAll']){_0xf58971['include']=[{'all':!![]}];}_0xf58971=_[_0x6a48('0x59')]({},_0xf58971,_0x375358['options']);return db['SmsMessage'][_0x6a48('0x5a')](_0xf58971)['then'](handleEntityNotFound(_0x58b400,null))[_0x6a48('0x24')](respondWithResult(_0x58b400,null))[_0x6a48('0x55')](handleError(_0x58b400,null));};exports[_0x6a48('0x5b')]=function(_0x564afa,_0x104fc2){return db[_0x6a48('0x40')][_0x6a48('0x5b')](_0x564afa[_0x6a48('0x5c')],{})[_0x6a48('0x24')](respondWithResult(_0x104fc2,0xc9))[_0x6a48('0x55')](handleError(_0x104fc2,null));};exports['update']=function(_0x116359,_0x2d138e){if(_0x116359[_0x6a48('0x5c')]['id']){delete _0x116359['body']['id'];}return db[_0x6a48('0x40')]['find']({'where':{'id':_0x116359['params']['id']}})[_0x6a48('0x24')](handleEntityNotFound(_0x2d138e,null))[_0x6a48('0x24')](saveUpdates(_0x116359[_0x6a48('0x5c')],null))['then'](respondWithResult(_0x2d138e,null))['catch'](handleError(_0x2d138e,null));};exports[_0x6a48('0x39')]=function(_0x1e16e5,_0x133494){return db['SmsMessage'][_0x6a48('0x5a')]({'where':{'id':_0x1e16e5[_0x6a48('0x57')]['id']}})['then'](handleEntityNotFound(_0x133494,null))[_0x6a48('0x24')](removeEntity(_0x133494,null))['catch'](handleError(_0x133494,null));};exports[_0x6a48('0x5d')]=function(_0x70b605,_0x276f1e){return db[_0x6a48('0x40')][_0x6a48('0x5d')]()[_0x6a48('0x24')](respondWithResult(_0x276f1e,null))[_0x6a48('0x55')](handleError(_0x276f1e,null));};var interaction_log=require('../../config/logger')(_0x6a48('0x5e'));exports[_0x6a48('0x5f')]=function(_0x676264,_0x238590,_0x2e9891){var _0x382bb5={'agent':{},'channel':_0x6a48('0x60')};if(_0x676264[_0x6a48('0x5c')]['id']){delete _0x676264[_0x6a48('0x5c')]['id'];}_0x676264[_0x6a48('0x5c')][_0x6a48('0x61')]=!![];_0x676264['body'][_0x6a48('0x62')]=moment()[_0x6a48('0x63')](_0x6a48('0x64'));_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')]=_0x676264[_0x6a48('0x5c')]['UserId']||_0x676264['user']['id'];_0x382bb5['agent']['id']=_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')];return db[_0x6a48('0x40')][_0x6a48('0x5a')]({'where':{'id':_0x676264['params']['id'],'UserId':null}})[_0x6a48('0x24')](handleEntityNotFound(_0x238590,null))['then'](saveUpdates(_0x676264[_0x6a48('0x5c')],null))[_0x6a48('0x24')](function(_0x2edba7){if(_0x2edba7){_0x382bb5[_0x6a48('0x2c')]=_0x2edba7['get']({'plain':!![]});return db[_0x6a48('0x66')][_0x6a48('0x5a')]({'where':{'id':_0x2edba7[_0x6a48('0x67')]}});}return null;})[_0x6a48('0x24')](handleEntityNotFound(_0x238590,null))[_0x6a48('0x24')](function(_0x1635fa){if(_0x1635fa){return _0x1635fa[_0x6a48('0x38')]({'UserId':_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')],'read1stAt':_[_0x6a48('0x68')](_0x1635fa[_0x6a48('0x69')])?moment()[_0x6a48('0x63')](_0x6a48('0x64')):undefined});}return null;})[_0x6a48('0x24')](function(_0xec7a63){if(_0xec7a63){_0x382bb5[_0x6a48('0x6a')]=_0xec7a63[_0x6a48('0x6b')]({'plain':!![]});interaction_log[_0x6a48('0x25')](_0x6a48('0x6c'),_0x676264[_0x6a48('0x6d')]['id'],_0x676264[_0x6a48('0x6d')][_0x6a48('0x3c')],_0x676264[_0x6a48('0x6d')][_0x6a48('0x6e')],_0x382bb5['interaction']['id'],_0x676264[_0x6a48('0x5c')]?JSON['stringify'](_0x676264[_0x6a48('0x5c')]):_0x6a48('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x6a48('0x70'),_0x382bb5);}return null;})[_0x6a48('0x24')](function(_0x5acda6){var _0x2ddc74='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5acda6[_0x6a48('0x2c')]['ContactId'];return db[_0x6a48('0x71')][_0x6a48('0x45')](_0x2ddc74,{'type':db[_0x6a48('0x72')]['QueryTypes'][_0x6a48('0x73')],'raw':!![]})[_0x6a48('0x24')](function(_0x48042a){return _0x48042a;});})['then'](function(_0x27129b){if(_0x27129b){_0x382bb5['message']['contact']=_0x27129b[0x0];if(!_0x676264['body'][_0x6a48('0x65')])return;return db[_0x6a48('0x74')][_0x6a48('0x5a')]({'where':{'id':_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')],'role':'agent'},'attributes':['id',_0x6a48('0x3c'),_0x6a48('0x75'),_0x6a48('0x76'),_0x6a48('0x77')],'raw':!![]});}return null;})[_0x6a48('0x24')](function(_0x3c7fc5){if(!_0x3c7fc5)return null;_0x382bb5[_0x6a48('0x2c')][_0x6a48('0x78')]=_0x3c7fc5;return _0x382bb5;})[_0x6a48('0x24')](function(_0x5454b9){if(_0x5454b9){if(_0x676264[_0x6a48('0x5c')][_0x6a48('0x79')]){_0x382bb5[_0x6a48('0x2c')][_0x6a48('0x7a')]=util['format'](_0x6a48('0x7b'),_0x676264[_0x6a48('0x6d')][_0x6a48('0x3c')]);_0x382bb5[_0x6a48('0x2c')]['channel']=_0x382bb5[_0x6a48('0x7c')];_0x382bb5['message'][_0x6a48('0x7d')]=_0x382bb5[_0x6a48('0x7c')];_0x382bb5['message'][_0x6a48('0x7e')]=_0x6a48('0x5f');return respondWithRpcPromise(_0x6a48('0x7f'),'EventManager',{'event':_0x6a48('0x80'),'message':_0x382bb5[_0x6a48('0x2c')]},client9002)[_0x6a48('0x24')](function(){return _0x382bb5;});}return _0x382bb5;}return null;})[_0x6a48('0x24')](respondWithResult(_0x238590,null))[_0x6a48('0x55')](handleError(_0x238590,null));};var interaction_log=require(_0x6a48('0x15'))(_0x6a48('0x5e'));exports[_0x6a48('0x81')]=function(_0xc3fcfe,_0x4fd0e5,_0x17f9b5){var _0x25ba98={'agent':{},'channel':'sms'};if(_0xc3fcfe[_0x6a48('0x5c')]['id']){delete _0xc3fcfe['body']['id'];}_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')]=_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')]||_0xc3fcfe[_0x6a48('0x6d')]['id'];_0x25ba98[_0x6a48('0x78')]['id']=_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')];return db[_0x6a48('0x40')][_0x6a48('0x5a')]({'where':{'id':_0xc3fcfe['params']['id'],'UserId':null}})[_0x6a48('0x24')](handleEntityNotFound(_0x4fd0e5,null))[_0x6a48('0x24')](function(_0x2b1ad4){if(_0x2b1ad4){_0x25ba98[_0x6a48('0x2c')]=_0x2b1ad4[_0x6a48('0x6b')]({'plain':!![]});return db[_0x6a48('0x66')][_0x6a48('0x5a')]({'where':{'id':_0x2b1ad4['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4fd0e5,null))[_0x6a48('0x24')](function(_0x2695d1){if(_0x2695d1){_0x25ba98['interaction']=_0x2695d1['get']({'plain':!![]});interaction_log[_0x6a48('0x25')](_0x6a48('0x82'),_0xc3fcfe[_0x6a48('0x6d')]['id'],_0xc3fcfe[_0x6a48('0x6d')][_0x6a48('0x3c')],_0xc3fcfe['user'][_0x6a48('0x6e')],_0x25ba98['interaction']['id'],_0xc3fcfe[_0x6a48('0x5c')]?JSON[_0x6a48('0x83')](_0xc3fcfe[_0x6a48('0x5c')]):_0x6a48('0x6f'));return respondWithRpcPromise(_0x6a48('0x84'),_0x6a48('0x85'),_0x25ba98);}return null;})[_0x6a48('0x24')](function(_0x590adc){var _0xbd3fb1=_0x6a48('0x86')+_0x590adc[_0x6a48('0x2c')]['ContactId'];return db[_0x6a48('0x71')][_0x6a48('0x45')](_0xbd3fb1,{'type':db[_0x6a48('0x72')][_0x6a48('0x87')][_0x6a48('0x73')],'raw':!![]})['then'](function(_0x5555d5){return _0x5555d5;});})[_0x6a48('0x24')](function(_0x5ba0db){if(_0x5ba0db){_0x25ba98[_0x6a48('0x2c')][_0x6a48('0x88')]=_0x5ba0db[0x0];if(!_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')])return;return db[_0x6a48('0x74')]['find']({'where':{'id':_0xc3fcfe['body'][_0x6a48('0x65')],'role':'agent'},'attributes':['id',_0x6a48('0x3c'),'fullname',_0x6a48('0x76'),_0x6a48('0x77')],'raw':!![]});}return null;})[_0x6a48('0x24')](function(_0x208bae){if(!_0x208bae)return null;_0x25ba98['message'][_0x6a48('0x78')]=_0x208bae;return _0x25ba98;})[_0x6a48('0x24')](function(_0x16131a){if(_0x16131a){_0x16131a['message'][_0x6a48('0x7a')]=util[_0x6a48('0x63')]('SIP/%s',_0xc3fcfe['user'][_0x6a48('0x3c')]);_0x16131a[_0x6a48('0x2c')]['channel']=_0x25ba98['channel'];_0x16131a[_0x6a48('0x2c')]['motionChannel']=_0x25ba98[_0x6a48('0x7c')];_0x16131a[_0x6a48('0x2c')][_0x6a48('0x7e')]=_0x6a48('0x81');respondWithRpcPromise(_0x6a48('0x7f'),_0x6a48('0x7f'),{'event':_0x6a48('0x89'),'message':_0x16131a[_0x6a48('0x2c')]},client9002);return _0x25ba98;}return null;})[_0x6a48('0x24')](respondWithResult(_0x4fd0e5,null))['catch'](handleError(_0x4fd0e5,null));};exports['status']=function(_0xa9fdfa,_0x49d4db,_0x3d890d){if(_0xa9fdfa[_0x6a48('0x5c')]['id']){delete _0xa9fdfa[_0x6a48('0x5c')]['id'];}var _0x8fb163;return db[_0x6a48('0x40')][_0x6a48('0x5a')]({'where':{'id':_0xa9fdfa[_0x6a48('0x57')]['id']}})[_0x6a48('0x24')](handleEntityNotFound(_0x49d4db,null))['then'](function(_0x2d181a){if(_0x2d181a){_0x8fb163=_0x2d181a;return db[_0x6a48('0x8a')][_0x6a48('0x5a')]({'where':{'id':_0x2d181a[_0x6a48('0x8b')]}});}})['then'](handleEntityNotFound(_0x49d4db,null))[_0x6a48('0x24')](function(_0x413e4c){if(_0x413e4c){logger[_0x6a48('0x27')](_0x6a48('0x28'),_0x6a48('0x2d'),'received\x20delivery\x20report\x20from',_0x413e4c[_0x6a48('0x4f')],util[_0x6a48('0x8c')](_0xa9fdfa['body'],{'showHidden':![],'depth':null}));switch(_0x413e4c[_0x6a48('0x4f')]){case _0x6a48('0x8d'):if(_0xa9fdfa[_0x6a48('0x5c')][_0x6a48('0x8e')]&&_0xa9fdfa[_0x6a48('0x5c')][_0x6a48('0x8e')]===_0x8fb163[_0x6a48('0x8f')]){return _0x8fb163['update']({'read':!![]});}else{logger[_0x6a48('0x2a')](_0x6a48('0x90'),_0x6a48('0x2d'),_0x6a48('0x8d'),util['inspect'](_0xa9fdfa[_0x6a48('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6a48('0x91'):if(_0xa9fdfa[_0x6a48('0x5c')][_0x6a48('0x92')]&&_0xa9fdfa['body']['MessageUUID']===_0x8fb163[_0x6a48('0x8f')]&&_[_0x6a48('0x93')]([_0x6a48('0x94'),'delivered'],_0xa9fdfa['body'][_0x6a48('0x95')])>=0x0){return _0x8fb163[_0x6a48('0x38')]({'read':!![]});}else{logger[_0x6a48('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6a48('0x2d'),'plivio',util[_0x6a48('0x8c')](_0xa9fdfa[_0x6a48('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6a48('0x96'):var _0x54d72b=_0xa9fdfa[_0x6a48('0x5c')]['results'][0x0];if(_0x54d72b['status'][_0x6a48('0x97')]==='DELIVERED'){return _0x8fb163[_0x6a48('0x38')]({'read':!![]});}else{logger[_0x6a48('0x2a')](_0x6a48('0x90'),_0x6a48('0x2d'),_0x6a48('0x96'),util[_0x6a48('0x8c')](_0xa9fdfa[_0x6a48('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x8fb163;}})[_0x6a48('0x24')](respondWithResult(_0x49d4db,null))['catch'](handleError(_0x49d4db,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index b906a19..4e1ea5c 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 _0xf2ac=['update','emit','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xf2ac,0x1bb));var _0xcf2a=function(_0x1008cf,_0x123a27){_0x1008cf=_0x1008cf-0x0;var _0x490202=_0xf2ac[_0x1008cf];return _0x490202;};'use strict';var EventEmitter=require(_0xcf2a('0x0'));var SmsMessage=require(_0xcf2a('0x1'))['db'][_0xcf2a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xcf2a('0x3')](0x0);var events={'afterCreate':_0xcf2a('0x4'),'afterUpdate':_0xcf2a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2f5d96){return function(_0x2943c4,_0x52993e,_0x5bc810){SmsMessageEvents[_0xcf2a('0x6')](_0x2f5d96+':'+_0x2943c4['id'],_0x2943c4);SmsMessageEvents[_0xcf2a('0x6')](_0x2f5d96,_0x2943c4);_0x5bc810(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xcf2a('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x8708=['emit','hasOwnProperty','hook','exports','events','SmsMessage','save','update'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x8708,0x7c));var _0x8870=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8708[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0x8870('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x8870('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8870('0x2'),'afterUpdate':_0x8870('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4dad40){return function(_0x2be7e3,_0x4bb23a,_0x44f158){SmsMessageEvents[_0x8870('0x4')](_0x4dad40+':'+_0x2be7e3['id'],_0x2be7e3);SmsMessageEvents[_0x8870('0x4')](_0x4dad40,_0x2be7e3);_0x44f158(null);};}for(var e in events){if(events[_0x8870('0x5')](e)){var event=events[e];SmsMessage[_0x8870('0x6')](e,emitEvent(event));}}module[_0x8870('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 6cc75c4..733b667 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 _0x603d=['message_uuid','baseUrl','/auth/1/session','application/json','messages','infobip','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','sender','text','sort','createHash','md5','digest','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','bandwidth','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','out','secret','UserId','isNil','SmsInteractionId','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','phone','accountSid','authToken','remote','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','error','connectel','senderString','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/'];(function(_0x3309f8,_0x13fedc){var _0x27c632=function(_0x27d982){while(--_0x27d982){_0x3309f8['push'](_0x3309f8['shift']());}};_0x27c632(++_0x13fedc);}(_0x603d,0x17c));var _0xd603=function(_0x496943,_0x1f1af6){_0x496943=_0x496943-0x0;var _0x75a62f=_0x603d[_0x496943];return _0x75a62f;};'use strict';var _=require(_0xd603('0x0'));var util=require(_0xd603('0x1'));var logger=require(_0xd603('0x2'))(_0xd603('0x3'));var moment=require(_0xd603('0x4'));var BPromise=require(_0xd603('0x5'));var rp=require(_0xd603('0x6'));var fs=require('fs');var path=require(_0xd603('0x7'));var rimraf=require(_0xd603('0x8'));var config=require(_0xd603('0x9'));var attributes=require('./smsMessage.attributes');module[_0xd603('0xa')]=function(_0x5c98fb,_0x597ac7){return _0x5c98fb[_0xd603('0xb')](_0xd603('0xc'),attributes,{'tableName':_0xd603('0xd'),'paranoid':![],'indexes':[{'name':_0xd603('0xe'),'fields':[_0xd603('0xe')]},{'name':_0xd603('0xf'),'fields':[_0xd603('0x10')],'type':_0xd603('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x340a12,_0x37b1cd,_0x26489c){var _0x4d30f8=_0x5c98fb[_0xd603('0x12')];var _0x710e2a=_0x340a12['get']({'plain':!![]});if(_0x710e2a[_0xd603('0x13')]['toLowerCase']()==='in'||_0x710e2a[_0xd603('0x13')]['toLowerCase']()===_0xd603('0x14')&&!_0x710e2a[_0xd603('0x15')]&&!_['isNil'](_0x710e2a[_0xd603('0x16')])&&!_[_0xd603('0x17')](_0x710e2a['SmsInteractionId'])){_0x4d30f8['SmsInteraction']['findOne']({'where':{'id':_0x710e2a[_0xd603('0x18')]}})[_0xd603('0x19')](function(_0x1bb839){if(_0x1bb839){_0x1bb839[_0xd603('0x1a')]({'lastMsgAt':_0x710e2a[_0xd603('0x1b')],'lastMsgDirection':_0x710e2a[_0xd603('0x13')]['toLowerCase']()});}})[_0xd603('0x1c')](function(_0x423901){console['error'](_0x423901);});}if(_0x710e2a['direction']===_0xd603('0x14')&&!_0x710e2a['secret']){var _0x31925a;_0x4d30f8[_0xd603('0x1d')][_0xd603('0x1e')]({'where':{'id':_0x710e2a[_0xd603('0x1f')]},'raw':!![]})[_0xd603('0x19')](function(_0x143d89){_0x31925a=_0x143d89;if(_0x31925a&&_0x31925a[_0xd603('0x20')]){switch(_0x31925a['type']){case _0xd603('0x21'):var _0x28929a=require(_0xd603('0x21'));if(_0x31925a['accountSid']&&_0x31925a['authToken']&&_0x31925a[_0xd603('0x22')]){var _0x45aa6d=new _0x28929a(_0x31925a[_0xd603('0x23')],_0x31925a[_0xd603('0x24')]);_0x45aa6d['messages']['create']({'body':_0x710e2a['body'],'to':_0x710e2a[_0xd603('0x22')],'from':_0x31925a['phone'],'statusCallback':_0x31925a[_0xd603('0x25')]+'/api/sms/messages/'+_0x710e2a['id']+_0xd603('0x26')+_0x31925a[_0xd603('0x27')]})[_0xd603('0x19')](function(_0x55faec){if(_0x55faec[_0xd603('0x28')]){return _0x340a12[_0xd603('0x1a')]({'messageId':_0x55faec['sid']});}})[_0xd603('0x1c')](function(_0xfd4e1){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd603('0x29'),_0xd603('0x21'),util[_0xd603('0x2a')](_0xfd4e1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x21'),_0xd603('0x2c'));}break;case _0xd603('0x2d'):var _0x2ba7d8=_0xd603('0x2e');if(_0x31925a[_0xd603('0x2f')]&&_0x31925a[_0xd603('0x30')]){var _0x30dfc3={'recipient':[_0x710e2a[_0xd603('0x22')]],'message':_0x710e2a[_0xd603('0x10')],'message_type':_0x31925a['smsMethod']};if(_0x31925a['smsMethod']&&_0x31925a[_0xd603('0x31')]!=='SI'){_0x30dfc3['sender']=_0x31925a[_0xd603('0x22')];}var _0x332fca={'url':_0x2ba7d8+_0xd603('0x32')+_0x31925a[_0xd603('0x2f')]+_0xd603('0x33')+_0x31925a['password'],'method':'GET'};rp(_0x332fca)['then'](function(_0x17d6ba){var _0x2d0254=_0x17d6ba[_0xd603('0x34')](';');var _0x360bc3={'user_key':_0x2d0254[0x0],'session_key':_0x2d0254[0x1]};_0x332fca={'url':_0x2ba7d8+'sms','method':_0xd603('0x35'),'headers':{'user_key':_0x360bc3[_0xd603('0x36')],'Session_key':_0x360bc3[_0xd603('0x37')]},'json':!![],'body':_0x30dfc3};return rp(_0x332fca);})['then'](function(_0x50efea){if(_0x50efea[_0xd603('0x38')]>=0x1){var _0x375e49={'messageId':_0x50efea[_0xd603('0x39')]};if(_0x31925a[_0xd603('0x31')]!=='GP'||!_0x31925a[_0xd603('0x3a')]){_0x375e49[_0xd603('0x3b')]=!![];}return _0x340a12[_0xd603('0x1a')](_0x375e49);}else{return logger['error'](_0xd603('0x2b'),'afterCreate',_0xd603('0x2d'),util[_0xd603('0x2a')](_0x50efea,{'showHidden':![],'depth':null}));}})[_0xd603('0x1c')](function(_0x69796d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd603('0x29'),_0xd603('0x2d'),util[_0xd603('0x2a')](_0x69796d,{'showHidden':![],'depth':null}));});}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xd603('0x3d'):if(_0x31925a['authToken']){var _0x1da9e6={'recipient':_0x710e2a['phone'],'message':_0x710e2a['body'],'sender':_0x31925a[_0xd603('0x3e')]||_0x31925a[_0xd603('0x22')],'authorization':_0x31925a['authToken']};var _0x37b1cd={'method':_0xd603('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1da9e6,'json':!![]};rp(_0x37b1cd)['then'](function(_0x3613d8){var _0xa409a9={'messageId':_0x3613d8['requestid']};if(!_0x31925a[_0xd603('0x3a')]){_0xa409a9['read']=!![];}return _0x340a12[_0xd603('0x1a')](_0xa409a9);})['catch'](function(_0x7a586c){logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x3d'),util[_0xd603('0x2a')](_0x7a586c,{'showHidden':![],'depth':null}));});}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x3d'),_0xd603('0x3f'));}break;case'clicksend':if(_0x31925a[_0xd603('0x2f')]&&_0x31925a[_0xd603('0x30')]){var _0x1da9e6={'messages':[{'source':_0xd603('0x40'),'to':_0x710e2a[_0xd603('0x22')],'body':_0x710e2a[_0xd603('0x10')],'from':_0x31925a[_0xd603('0x3e')]||_0x31925a[_0xd603('0x22')]}]};var _0x20f602=util[_0xd603('0x41')](_0xd603('0x42'),_0x31925a['username'],_0x31925a[_0xd603('0x30')]);var _0x37b1cd={'method':_0xd603('0x35'),'uri':_0xd603('0x43'),'body':_0x1da9e6,'headers':{'Authorization':util['format'](_0xd603('0x44'),new Buffer(_0x20f602)[_0xd603('0x45')](_0xd603('0x46')))},'json':!![]};rp(_0x37b1cd)['then'](function(_0x19fd47){if(_0x19fd47['http_code']>=0xc8&&_0x19fd47[_0xd603('0x47')]<=0xce){if(_0x19fd47[_0xd603('0x48')]&&_0x19fd47['data'][_0xd603('0x49')]>0x0){var _0x228cbc=_[_0xd603('0x4a')](_0x19fd47[_0xd603('0x48')]['messages']);var _0x2d0b42={'messageId':_0x228cbc[_0xd603('0x4b')]};if(!_0x31925a[_0xd603('0x3a')]){_0x2d0b42[_0xd603('0x3b')]=!![];}return _0x340a12['update'](_0x2d0b42);}else{logger[_0xd603('0x3c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd603('0x4c'),util['inspect'](_0x19fd47,{'showHidden':![],'depth':null}));}}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x4c'),util['inspect'](_0x19fd47,{'showHidden':![],'depth':null}));}})[_0xd603('0x1c')](function(_0x3e0f10){logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x4c'),util['inspect'](_0x3e0f10,{'showHidden':![],'depth':null}));});}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xd603('0x4d'):if(_0x31925a[_0xd603('0x4e')]&&_0x31925a[_0xd603('0x24')]){var _0x1da9e6={'dst':_0x710e2a[_0xd603('0x22')],'text':_0x710e2a[_0xd603('0x10')],'src':_0x31925a[_0xd603('0x3e')]||_0x31925a[_0xd603('0x22')],'url':_0x31925a[_0xd603('0x25')]+_0xd603('0x4f')+_0x710e2a['id']+_0xd603('0x26')+_0x31925a['token']};var _0x20f602=util[_0xd603('0x41')](_0xd603('0x42'),_0x31925a[_0xd603('0x4e')],_0x31925a[_0xd603('0x24')]);var _0x37b1cd={'method':_0xd603('0x35'),'uri':util[_0xd603('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x31925a[_0xd603('0x4e')]),'body':_0x1da9e6,'headers':{'Authorization':util[_0xd603('0x41')]('Basic\x20%s',new Buffer(_0x20f602)[_0xd603('0x45')]('base64'))},'json':!![]};rp(_0x37b1cd)[_0xd603('0x19')](function(_0x2b2e5b){var _0x19eda1={'messageId':_0x2b2e5b[_0xd603('0x50')][0x0]};return _0x340a12[_0xd603('0x1a')](_0x19eda1);})[_0xd603('0x1c')](function(_0xc1e226){logger[_0xd603('0x3c')](_0xd603('0x2b'),'afterCreate','plivo',util['inspect'](_0xc1e226,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd603('0x2b'),'afterCreate',_0xd603('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x31925a[_0xd603('0x2f')]&&_0x31925a['password']){if(_0x31925a['baseUrl']){var _0x2ca169={'method':_0xd603('0x35'),'uri':_0x31925a[_0xd603('0x51')]+_0xd603('0x52'),'body':{'username':_0x31925a['username'],'password':_0x31925a[_0xd603('0x30')]},'json':!![]};return rp(_0x2ca169)[_0xd603('0x19')](function(_0x2f3ec9){var _0x30c9e0={'method':_0xd603('0x35'),'uri':_0x31925a[_0xd603('0x51')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x31925a['phone'],'destinations':[{'to':_0x710e2a[_0xd603('0x22')]}],'text':_0x710e2a[_0xd603('0x10')],'notifyUrl':_0x31925a[_0xd603('0x25')]+'/api/sms/messages/'+_0x710e2a['id']+'/status?token='+_0x31925a[_0xd603('0x27')],'notifyContentType':_0xd603('0x53'),'callbackData':_0x31925a[_0xd603('0x22')]+';'+_0x710e2a['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x2f3ec9[_0xd603('0x27')]},'json':!![]};return rp(_0x30c9e0)[_0xd603('0x19')](function(_0x223bc3){if(_0x223bc3[_0xd603('0x54')]){var _0x2432c1={'messageId':_0x223bc3[_0xd603('0x54')][0x0][_0xd603('0xe')]};if(!_0x31925a[_0xd603('0x3a')]){_0x2432c1['read']=!![];}return _0x340a12[_0xd603('0x1a')](_0x2432c1);}else{return logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x55'),util[_0xd603('0x2a')](_0x223bc3,{'showHidden':![],'depth':null}));}});})[_0xd603('0x1c')](function(_0x4ed226){return logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x55'),util[_0xd603('0x2a')](_0x4ed226,{'showHidden':![],'depth':null}));});}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x55'),_0xd603('0x56'));}break;case _0xd603('0x57'):var _0x36ad81=require(_0xd603('0x58'));if(_0x31925a[_0xd603('0x59')]){var _0x1ddbc8={};_0x1ddbc8['login']=_0x31925a[_0xd603('0x2f')];_0x1ddbc8[_0xd603('0x22')]=_0x710e2a['phone'];_0x1ddbc8[_0xd603('0x5a')]=_0x31925a[_0xd603('0x22')];_0x1ddbc8[_0xd603('0x5b')]=_0x710e2a[_0xd603('0x10')];_0x1ddbc8['timestamp']=+new Date();var _0x4f4ee6='';var _0x48f0f4='';var _0x3d750e=Object['keys'](_0x1ddbc8);_0x3d750e[_0xd603('0x5c')]();for(var _0x32de82=0x0;_0x32de82<_0x3d750e['length'];_0x32de82++){if(_0x4f4ee6!=''){_0x4f4ee6+='&';}_0x4f4ee6+=_0x3d750e[_0x32de82]+'='+encodeURIComponent(_0x1ddbc8[_0x3d750e[_0x32de82]]);_0x48f0f4+=_0x1ddbc8[_0x3d750e[_0x32de82]];}_0x48f0f4+=_0x31925a[_0xd603('0x59')];_0x48f0f4=_0x36ad81[_0xd603('0x5d')](_0xd603('0x5e'))[_0xd603('0x1a')](_0x48f0f4)[_0xd603('0x5f')]('hex');if(_0x4f4ee6!==''){_0x4f4ee6+='&';}_0x4f4ee6+=_0xd603('0x60')+_0x48f0f4;var _0x332fca={'method':'GET','uri':_0x31925a[_0xd603('0x51')]+_0xd603('0x61')+_0x4f4ee6,'json':!![]};return rp(_0x332fca)[_0xd603('0x19')](function(_0x13369e){var _0x5d34c4=Object[_0xd603('0x62')](_0x13369e);if(_0x13369e[_0x5d34c4[0x0]][_0xd603('0x3c')]&&parseInt(_0x13369e[_0x5d34c4[0x0]]['error'])===0x0){var _0x16d4e8={'messageId':_0x13369e[_0x5d34c4[0x0]][_0xd603('0x63')]};if(!_0x31925a[_0xd603('0x3a')]){_0x16d4e8['read']=!![];}return _0x340a12[_0xd603('0x1a')](_0x16d4e8);}else{return logger['error'](_0xd603('0x2b'),'afterCreate',_0xd603('0x57'),util[_0xd603('0x2a')](_0x13369e[_0xd603('0x3c')],{'showHidden':![],'depth':null}));}})[_0xd603('0x1c')](function(_0x35c1c7){return logger['error'](_0xd603('0x2b'),_0xd603('0x29'),'csc',util[_0xd603('0x2a')](_0x35c1c7,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd603('0x57'),_0xd603('0x64'));}break;case _0xd603('0x65'):if(_0x31925a['apiKey']){var _0x12e589={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x31925a[_0xd603('0x59')]},'body':{'content':_0x710e2a[_0xd603('0x10')],'to':[_0x710e2a['phone']],'from':_0x31925a[_0xd603('0x22')],'binary':![],'clientMessageId':'uuid','charset':_0xd603('0x66')},'json':!![]};rp(_0x12e589)['then'](function(_0x2801e7){if(!_0x2801e7[_0xd603('0x3c')]){var _0x587edf={'messageId':_0x2801e7[_0xd603('0x54')][0x0]['apiMessageId']};if(!_0x31925a['deliveryReport']){_0x587edf[_0xd603('0x3b')]=!![];}return _0x340a12[_0xd603('0x1a')](_0x587edf);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd603('0x29'),'clickatell',util[_0xd603('0x2a')](_0x2801e7[_0xd603('0x3c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d7528){return logger['error'](_0xd603('0x2b'),_0xd603('0x29'),'clickatell',util[_0xd603('0x2a')](_0x3d7528,{'showHidden':![],'depth':null}));});}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),'afterCreate',_0xd603('0x65'),_0xd603('0x64'));}break;case _0xd603('0x67'):if(_0x31925a[_0xd603('0x2f')]&&_0x31925a[_0xd603('0x30')]){var _0x20f602=util[_0xd603('0x41')](_0xd603('0x42'),_0x31925a[_0xd603('0x2f')],_0x31925a['password']);var _0x37b1cd={'method':_0xd603('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x31925a['accountId']+_0xd603('0x68'),'body':{'to':[_0x710e2a[_0xd603('0x22')]],'text':_0x710e2a[_0xd603('0x10')],'from':_0x31925a['phone'],'applicationId':_0x31925a[_0xd603('0x69')]},'headers':{'Authorization':util[_0xd603('0x41')](_0xd603('0x44'),new Buffer(_0x20f602)[_0xd603('0x45')](_0xd603('0x46')))},'json':!![]};rp(_0x37b1cd)['then'](function(_0x57c1c2){if(_0x57c1c2['id']){var _0x1fa384={'messageId':_0x57c1c2['id']};return _0x340a12[_0xd603('0x1a')](_0x1fa384);}else{logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),'bandwidth',util[_0xd603('0x2a')](_0x57c1c2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2c28e9){logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x67'),util[_0xd603('0x2a')](_0x2c28e9,{'showHidden':![],'depth':null}));});}else{logger[_0xd603('0x3c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd603('0x29'),_0xd603('0x67'),_0xd603('0x56'));}break;case _0xd603('0x6a'):if(_0x31925a[_0xd603('0x59')]){var _0x3662ca={};var _0x332fca={'method':_0xd603('0x35'),'uri':_0xd603('0x6b'),'headers':{'Authorization':_0xd603('0x6c')+_0x31925a[_0xd603('0x59')],'Content-Type':'application/json'},'body':{'from':_0x31925a['phone'],'to':_0x710e2a[_0xd603('0x22')],'text':_0x710e2a['body']},'json':!![]};return rp(_0x332fca)[_0xd603('0x19')](function(_0x5def62){if(_0x5def62[_0xd603('0x6d')]==0xca){_0x3662ca[_0xd603('0x6e')]=_0x5def62;var _0x32d7e0={'method':'POST','uri':_0xd603('0x6f'),'headers':{'Authorization':_0xd603('0x6c')+_0x31925a['apiKey'],'Content-Type':_0xd603('0x53')},'body':{'refid':_0x3662ca['message'][_0xd603('0x70')]},'json':!![]};return rp(_0x32d7e0)[_0xd603('0x19')](function(_0x86fd67){_0x3662ca[_0xd603('0x71')]=_0x86fd67;var _0x2505f3={'messageId':_0x3662ca['message'][_0xd603('0x70')],'read':!![]};return _0x340a12[_0xd603('0x1a')](_0x2505f3);});}else{return logger[_0xd603('0x3c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd603('0x29'),'intelepeer',util[_0xd603('0x2a')](_0x5def62,{'showHidden':![],'depth':null}));}})[_0xd603('0x1c')](function(_0x23bf1a){return logger[_0xd603('0x3c')](_0xd603('0x2b'),_0xd603('0x29'),_0xd603('0x6a'),util[_0xd603('0x2a')](_0x23bf1a,{'showHidden':![],'depth':null}));});}else{return logger[_0xd603('0x3c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd603('0x6a'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x26489c();});}else{_0x26489c();}}},'charset':_0xd603('0x72'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe80a=['Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/api/sms/messages/','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','sender','text','timestamp','keys','sort','md5','digest','hex','GET','csc','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','apiMessageId','bandwidth','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','status','refid','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','createdAt','catch','error','SmsAccount','SmsAccountId','accountSid','authToken','phone','messages','/status?token=','token','then','sid','afterCreate','twilio','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','split','sms','user_key','session_key','deliveryReport','read','update','inspect','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','clicksend','xCALLY\x20Motion','format','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend'];(function(_0x27fc94,_0x1041e7){var _0x151e73=function(_0x8dce68){while(--_0x8dce68){_0x27fc94['push'](_0x27fc94['shift']());}};_0x151e73(++_0x1041e7);}(_0xe80a,0x17d));var _0xae80=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xe80a[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xae80('0x0'));var util=require('util');var logger=require(_0xae80('0x1'))(_0xae80('0x2'));var moment=require(_0xae80('0x3'));var BPromise=require(_0xae80('0x4'));var rp=require(_0xae80('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae80('0x6'));var config=require(_0xae80('0x7'));var attributes=require(_0xae80('0x8'));module['exports']=function(_0x389cf9,_0x56614d){return _0x389cf9[_0xae80('0x9')]('SmsMessage',attributes,{'tableName':_0xae80('0xa'),'paranoid':![],'indexes':[{'name':_0xae80('0xb'),'fields':[_0xae80('0xb')]},{'name':_0xae80('0xc'),'fields':[_0xae80('0xd')],'type':_0xae80('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c4db9,_0x1e0937,_0xc4d010){var _0x991d80=_0x389cf9[_0xae80('0xf')];var _0x44f4a9=_0x3c4db9['get']({'plain':!![]});if(_0x44f4a9[_0xae80('0x10')][_0xae80('0x11')]()==='in'||_0x44f4a9[_0xae80('0x10')][_0xae80('0x11')]()===_0xae80('0x12')&&!_0x44f4a9[_0xae80('0x13')]&&!_['isNil'](_0x44f4a9[_0xae80('0x14')])&&!_[_0xae80('0x15')](_0x44f4a9['SmsInteractionId'])){_0x991d80[_0xae80('0x16')][_0xae80('0x17')]({'where':{'id':_0x44f4a9[_0xae80('0x18')]}})['then'](function(_0x49e428){if(_0x49e428){_0x49e428['update']({'lastMsgAt':_0x44f4a9[_0xae80('0x19')],'lastMsgDirection':_0x44f4a9[_0xae80('0x10')]['toLowerCase']()});}})[_0xae80('0x1a')](function(_0xa1632){console[_0xae80('0x1b')](_0xa1632);});}if(_0x44f4a9['direction']==='out'&&!_0x44f4a9[_0xae80('0x13')]){var _0x444f63;_0x991d80[_0xae80('0x1c')]['find']({'where':{'id':_0x44f4a9[_0xae80('0x1d')]},'raw':!![]})['then'](function(_0x1390ba){_0x444f63=_0x1390ba;if(_0x444f63&&_0x444f63['type']){switch(_0x444f63['type']){case'twilio':var _0x76b705=require('twilio');if(_0x444f63[_0xae80('0x1e')]&&_0x444f63[_0xae80('0x1f')]&&_0x444f63[_0xae80('0x20')]){var _0x1ce6ac=new _0x76b705(_0x444f63[_0xae80('0x1e')],_0x444f63[_0xae80('0x1f')]);_0x1ce6ac[_0xae80('0x21')]['create']({'body':_0x44f4a9[_0xae80('0xd')],'to':_0x44f4a9['phone'],'from':_0x444f63[_0xae80('0x20')],'statusCallback':_0x444f63['remote']+'/api/sms/messages/'+_0x44f4a9['id']+_0xae80('0x22')+_0x444f63[_0xae80('0x23')]})[_0xae80('0x24')](function(_0xcca717){if(_0xcca717[_0xae80('0x25')]){return _0x3c4db9['update']({'messageId':_0xcca717[_0xae80('0x25')]});}})[_0xae80('0x1a')](function(_0x22da3b){logger[_0xae80('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae80('0x26'),_0xae80('0x27'),util['inspect'](_0x22da3b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x27'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xae80('0x29'):var _0x220997=_0xae80('0x2a');if(_0x444f63[_0xae80('0x2b')]&&_0x444f63['password']){var _0x55c21f={'recipient':[_0x44f4a9[_0xae80('0x20')]],'message':_0x44f4a9['body'],'message_type':_0x444f63['smsMethod']};if(_0x444f63[_0xae80('0x2c')]&&_0x444f63[_0xae80('0x2c')]!=='SI'){_0x55c21f['sender']=_0x444f63[_0xae80('0x20')];}var _0x5e370e={'url':_0x220997+_0xae80('0x2d')+_0x444f63[_0xae80('0x2b')]+_0xae80('0x2e')+_0x444f63[_0xae80('0x2f')],'method':'GET'};rp(_0x5e370e)[_0xae80('0x24')](function(_0x17aa57){var _0x2cf85a=_0x17aa57[_0xae80('0x30')](';');var _0x53fc31={'user_key':_0x2cf85a[0x0],'session_key':_0x2cf85a[0x1]};_0x5e370e={'url':_0x220997+_0xae80('0x31'),'method':'POST','headers':{'user_key':_0x53fc31[_0xae80('0x32')],'Session_key':_0x53fc31[_0xae80('0x33')]},'json':!![],'body':_0x55c21f};return rp(_0x5e370e);})[_0xae80('0x24')](function(_0x28867d){if(_0x28867d['total_sent']>=0x1){var _0x4f16ae={'messageId':_0x28867d['internal_order_id']};if(_0x444f63[_0xae80('0x2c')]!=='GP'||!_0x444f63[_0xae80('0x34')]){_0x4f16ae[_0xae80('0x35')]=!![];}return _0x3c4db9[_0xae80('0x36')](_0x4f16ae);}else{return logger[_0xae80('0x1b')](_0xae80('0x28'),'afterCreate',_0xae80('0x29'),util[_0xae80('0x37')](_0x28867d,{'showHidden':![],'depth':null}));}})[_0xae80('0x1a')](function(_0x4a8d2a){return logger['error'](_0xae80('0x28'),_0xae80('0x26'),'skebby',util[_0xae80('0x37')](_0x4a8d2a,{'showHidden':![],'depth':null}));});}else{logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xae80('0x38'):if(_0x444f63[_0xae80('0x1f')]){var _0x13b772={'recipient':_0x44f4a9[_0xae80('0x20')],'message':_0x44f4a9[_0xae80('0xd')],'sender':_0x444f63[_0xae80('0x39')]||_0x444f63[_0xae80('0x20')],'authorization':_0x444f63[_0xae80('0x1f')]};var _0x1e0937={'method':_0xae80('0x3a'),'uri':_0xae80('0x3b'),'body':_0x13b772,'json':!![]};rp(_0x1e0937)['then'](function(_0x4c89f3){var _0x974cee={'messageId':_0x4c89f3['requestid']};if(!_0x444f63['deliveryReport']){_0x974cee['read']=!![];}return _0x3c4db9[_0xae80('0x36')](_0x974cee);})[_0xae80('0x1a')](function(_0x3ff9ee){logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x38'),util[_0xae80('0x37')](_0x3ff9ee,{'showHidden':![],'depth':null}));});}else{logger[_0xae80('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae80('0x26'),_0xae80('0x38'),'Missing\x20parameters:\x20authToken');}break;case _0xae80('0x3c'):if(_0x444f63['username']&&_0x444f63[_0xae80('0x2f')]){var _0x13b772={'messages':[{'source':_0xae80('0x3d'),'to':_0x44f4a9[_0xae80('0x20')],'body':_0x44f4a9['body'],'from':_0x444f63[_0xae80('0x39')]||_0x444f63[_0xae80('0x20')]}]};var _0xbc7698=util['format']('%s:%s',_0x444f63[_0xae80('0x2b')],_0x444f63[_0xae80('0x2f')]);var _0x1e0937={'method':_0xae80('0x3a'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x13b772,'headers':{'Authorization':util[_0xae80('0x3e')](_0xae80('0x3f'),new Buffer(_0xbc7698)['toString'](_0xae80('0x40')))},'json':!![]};rp(_0x1e0937)[_0xae80('0x24')](function(_0x1aa573){if(_0x1aa573[_0xae80('0x41')]>=0xc8&&_0x1aa573['http_code']<=0xce){if(_0x1aa573[_0xae80('0x42')]&&_0x1aa573[_0xae80('0x42')][_0xae80('0x43')]>0x0){var _0x5591cb=_[_0xae80('0x44')](_0x1aa573[_0xae80('0x42')][_0xae80('0x21')]);var _0x27eefb={'messageId':_0x5591cb[_0xae80('0x45')]};if(!_0x444f63[_0xae80('0x34')]){_0x27eefb['read']=!![];}return _0x3c4db9[_0xae80('0x36')](_0x27eefb);}else{logger[_0xae80('0x1b')](_0xae80('0x28'),'afterCreate','clickSend',util[_0xae80('0x37')](_0x1aa573,{'showHidden':![],'depth':null}));}}else{logger[_0xae80('0x1b')](_0xae80('0x28'),'afterCreate',_0xae80('0x46'),util[_0xae80('0x37')](_0x1aa573,{'showHidden':![],'depth':null}));}})[_0xae80('0x1a')](function(_0x19679d){logger['error'](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x46'),util[_0xae80('0x37')](_0x19679d,{'showHidden':![],'depth':null}));});}else{logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x46'),_0xae80('0x47'));}break;case _0xae80('0x48'):if(_0x444f63[_0xae80('0x49')]&&_0x444f63[_0xae80('0x1f')]){var _0x13b772={'dst':_0x44f4a9[_0xae80('0x20')],'text':_0x44f4a9[_0xae80('0xd')],'src':_0x444f63['senderString']||_0x444f63[_0xae80('0x20')],'url':_0x444f63[_0xae80('0x4a')]+'/api/sms/messages/'+_0x44f4a9['id']+_0xae80('0x22')+_0x444f63[_0xae80('0x23')]};var _0xbc7698=util[_0xae80('0x3e')]('%s:%s',_0x444f63['authId'],_0x444f63[_0xae80('0x1f')]);var _0x1e0937={'method':_0xae80('0x3a'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x444f63[_0xae80('0x49')]),'body':_0x13b772,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xbc7698)['toString'](_0xae80('0x40')))},'json':!![]};rp(_0x1e0937)[_0xae80('0x24')](function(_0x245f8e){var _0x425381={'messageId':_0x245f8e['message_uuid'][0x0]};return _0x3c4db9[_0xae80('0x36')](_0x425381);})[_0xae80('0x1a')](function(_0x113361){logger[_0xae80('0x1b')](_0xae80('0x28'),'afterCreate','plivo',util[_0xae80('0x37')](_0x113361,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x48'),_0xae80('0x4b'));}break;case _0xae80('0x4c'):if(_0x444f63[_0xae80('0x2b')]&&_0x444f63[_0xae80('0x2f')]){if(_0x444f63[_0xae80('0x4d')]){var _0x7e0b39={'method':'POST','uri':_0x444f63[_0xae80('0x4d')]+_0xae80('0x4e'),'body':{'username':_0x444f63[_0xae80('0x2b')],'password':_0x444f63[_0xae80('0x2f')]},'json':!![]};return rp(_0x7e0b39)[_0xae80('0x24')](function(_0x5b8067){var _0x130530={'method':_0xae80('0x3a'),'uri':_0x444f63[_0xae80('0x4d')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x444f63[_0xae80('0x20')],'destinations':[{'to':_0x44f4a9['phone']}],'text':_0x44f4a9['body'],'notifyUrl':_0x444f63['remote']+_0xae80('0x4f')+_0x44f4a9['id']+_0xae80('0x22')+_0x444f63[_0xae80('0x23')],'notifyContentType':'application/json','callbackData':_0x444f63[_0xae80('0x20')]+';'+_0x44f4a9['body']}]},'headers':{'Authorization':_0xae80('0x50')+_0x5b8067[_0xae80('0x23')]},'json':!![]};return rp(_0x130530)[_0xae80('0x24')](function(_0x1b8aa9){if(_0x1b8aa9['messages']){var _0x246fb3={'messageId':_0x1b8aa9['messages'][0x0]['messageId']};if(!_0x444f63[_0xae80('0x34')]){_0x246fb3[_0xae80('0x35')]=!![];}return _0x3c4db9[_0xae80('0x36')](_0x246fb3);}else{return logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x4c'),util['inspect'](_0x1b8aa9,{'showHidden':![],'depth':null}));}});})[_0xae80('0x1a')](function(_0x5a028d){return logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x4c'),util[_0xae80('0x37')](_0x5a028d,{'showHidden':![],'depth':null}));});}else{logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),'infobip',_0xae80('0x51'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae80('0x26'),_0xae80('0x4c'),_0xae80('0x47'));}break;case'csc':var _0x250bf0=require(_0xae80('0x52'));if(_0x444f63[_0xae80('0x53')]){var _0x4d0877={};_0x4d0877['login']=_0x444f63[_0xae80('0x2b')];_0x4d0877[_0xae80('0x20')]=_0x44f4a9[_0xae80('0x20')];_0x4d0877[_0xae80('0x54')]=_0x444f63[_0xae80('0x20')];_0x4d0877[_0xae80('0x55')]=_0x44f4a9[_0xae80('0xd')];_0x4d0877[_0xae80('0x56')]=+new Date();var _0x4002ef='';var _0x2e984b='';var _0x31a9f2=Object[_0xae80('0x57')](_0x4d0877);_0x31a9f2[_0xae80('0x58')]();for(var _0x4a6c3b=0x0;_0x4a6c3b<_0x31a9f2['length'];_0x4a6c3b++){if(_0x4002ef!=''){_0x4002ef+='&';}_0x4002ef+=_0x31a9f2[_0x4a6c3b]+'='+encodeURIComponent(_0x4d0877[_0x31a9f2[_0x4a6c3b]]);_0x2e984b+=_0x4d0877[_0x31a9f2[_0x4a6c3b]];}_0x2e984b+=_0x444f63[_0xae80('0x53')];_0x2e984b=_0x250bf0['createHash'](_0xae80('0x59'))[_0xae80('0x36')](_0x2e984b)[_0xae80('0x5a')](_0xae80('0x5b'));if(_0x4002ef!==''){_0x4002ef+='&';}_0x4002ef+='signature='+_0x2e984b;var _0x5e370e={'method':_0xae80('0x5c'),'uri':_0x444f63['baseUrl']+'/external/get/send.php?'+_0x4002ef,'json':!![]};return rp(_0x5e370e)['then'](function(_0x405bf5){var _0x2bd7f9=Object[_0xae80('0x57')](_0x405bf5);if(_0x405bf5[_0x2bd7f9[0x0]]['error']&&parseInt(_0x405bf5[_0x2bd7f9[0x0]][_0xae80('0x1b')])===0x0){var _0x103ec7={'messageId':_0x405bf5[_0x2bd7f9[0x0]]['id_sms']};if(!_0x444f63['deliveryReport']){_0x103ec7[_0xae80('0x35')]=!![];}return _0x3c4db9['update'](_0x103ec7);}else{return logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x5d'),util[_0xae80('0x37')](_0x405bf5['error'],{'showHidden':![],'depth':null}));}})[_0xae80('0x1a')](function(_0x3dce5d){return logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),'csc',util[_0xae80('0x37')](_0x3dce5d,{'showHidden':![],'depth':null}));});}else{logger[_0xae80('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae80('0x26'),_0xae80('0x5d'),_0xae80('0x5e'));}break;case _0xae80('0x5f'):if(_0x444f63['apiKey']){var _0x111d1e={'method':_0xae80('0x3a'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x444f63['apiKey']},'body':{'content':_0x44f4a9[_0xae80('0xd')],'to':[_0x44f4a9[_0xae80('0x20')]],'from':_0x444f63[_0xae80('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0xae80('0x60')},'json':!![]};rp(_0x111d1e)[_0xae80('0x24')](function(_0x4f953e){if(!_0x4f953e[_0xae80('0x1b')]){var _0x14c7b7={'messageId':_0x4f953e[_0xae80('0x21')][0x0][_0xae80('0x61')]};if(!_0x444f63[_0xae80('0x34')]){_0x14c7b7[_0xae80('0x35')]=!![];}return _0x3c4db9[_0xae80('0x36')](_0x14c7b7);}else{return logger[_0xae80('0x1b')](_0xae80('0x28'),'afterCreate',_0xae80('0x5f'),util[_0xae80('0x37')](_0x4f953e[_0xae80('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x123eac){return logger['error'](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x5f'),util[_0xae80('0x37')](_0x123eac,{'showHidden':![],'depth':null}));});}else{logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0xae80('0x62'):if(_0x444f63[_0xae80('0x2b')]&&_0x444f63[_0xae80('0x2f')]){var _0xbc7698=util['format']('%s:%s',_0x444f63[_0xae80('0x2b')],_0x444f63[_0xae80('0x2f')]);var _0x1e0937={'method':_0xae80('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x444f63[_0xae80('0x63')]+'/messages','body':{'to':[_0x44f4a9[_0xae80('0x20')]],'text':_0x44f4a9[_0xae80('0xd')],'from':_0x444f63['phone'],'applicationId':_0x444f63[_0xae80('0x64')]},'headers':{'Authorization':util[_0xae80('0x3e')](_0xae80('0x3f'),new Buffer(_0xbc7698)['toString']('base64'))},'json':!![]};rp(_0x1e0937)['then'](function(_0x12dc68){if(_0x12dc68['id']){var _0x41d5b1={'messageId':_0x12dc68['id']};return _0x3c4db9[_0xae80('0x36')](_0x41d5b1);}else{logger[_0xae80('0x1b')](_0xae80('0x28'),'afterCreate',_0xae80('0x62'),util[_0xae80('0x37')](_0x12dc68,{'showHidden':![],'depth':null}));}})[_0xae80('0x1a')](function(_0x251989){logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x62'),util[_0xae80('0x37')](_0x251989,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae80('0x26'),'bandwidth',_0xae80('0x47'));}break;case _0xae80('0x65'):if(_0x444f63[_0xae80('0x53')]){var _0x3123ab={};var _0x5e370e={'method':_0xae80('0x3a'),'uri':_0xae80('0x66'),'headers':{'Authorization':_0xae80('0x67')+_0x444f63[_0xae80('0x53')],'Content-Type':'application/json'},'body':{'from':_0x444f63['phone'],'to':_0x44f4a9[_0xae80('0x20')],'text':_0x44f4a9['body']},'json':!![]};return rp(_0x5e370e)[_0xae80('0x24')](function(_0x335b26){if(_0x335b26[_0xae80('0x68')]==0xca){_0x3123ab[_0xae80('0x69')]=_0x335b26;var _0x1cfd10={'method':_0xae80('0x3a'),'uri':_0xae80('0x6a'),'headers':{'Authorization':_0xae80('0x67')+_0x444f63[_0xae80('0x53')],'Content-Type':_0xae80('0x6b')},'body':{'refid':_0x3123ab[_0xae80('0x69')]['refid']},'json':!![]};return rp(_0x1cfd10)[_0xae80('0x24')](function(_0x41796e){_0x3123ab[_0xae80('0x6c')]=_0x41796e;var _0x38f627={'messageId':_0x3123ab[_0xae80('0x69')][_0xae80('0x6d')],'read':!![]};return _0x3c4db9[_0xae80('0x36')](_0x38f627);});}else{return logger[_0xae80('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xae80('0x65'),util[_0xae80('0x37')](_0x335b26,{'showHidden':![],'depth':null}));}})['catch'](function(_0x406bc7){return logger['error'](_0xae80('0x28'),_0xae80('0x26'),'intelepeer',util['inspect'](_0x406bc7,{'showHidden':![],'depth':null}));});}else{return logger[_0xae80('0x1b')](_0xae80('0x28'),_0xae80('0x26'),_0xae80('0x65'),_0xae80('0x6e'));}break;}}})[_0xae80('0x6f')](function(){_0xc4d010();});}else{_0xc4d010();}}},'charset':_0xae80('0x70'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 32a98e1..aa1604b 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 _0x51ab=['SmsMessage','create','body','options','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsMessage'];(function(_0x5e6238,_0x5eeccd){var _0x1dfd46=function(_0x5ce5f7){while(--_0x5ce5f7){_0x5e6238['push'](_0x5e6238['shift']());}};_0x1dfd46(++_0x5eeccd);}(_0x51ab,0x1d6));var _0xb51a=function(_0x43225e,_0x630e6c){_0x43225e=_0x43225e-0x0;var _0x519bc8=_0x51ab[_0x43225e];return _0x519bc8;};'use strict';var _=require('lodash');var util=require(_0xb51a('0x0'));var moment=require('moment');var BPromise=require(_0xb51a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb51a('0x2'));var db=require(_0xb51a('0x3'))['db'];var utils=require(_0xb51a('0x4'));var logger=require(_0xb51a('0x5'))(_0xb51a('0x6'));var config=require(_0xb51a('0x7'));var jayson=require(_0xb51a('0x8'));var client=jayson[_0xb51a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xb51a('0xa')](config[_0xb51a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb51a('0xb')]));require(_0xb51a('0xc'))['register'](socket);function respondWithRpcPromise(_0x1f9552,_0x55c725,_0x2a06f5){return new BPromise(function(_0x455e71,_0x375d0d){return client[_0xb51a('0xd')](_0x1f9552,_0x2a06f5)['then'](function(_0xd4f8dc){logger[_0xb51a('0xe')](_0xb51a('0xf'),_0x55c725,_0xb51a('0x10'));logger[_0xb51a('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55c725,_0xb51a('0x10'),JSON[_0xb51a('0x12')](_0xd4f8dc));if(_0xd4f8dc[_0xb51a('0x13')]){if(_0xd4f8dc[_0xb51a('0x13')]['code']===0x1f4){logger[_0xb51a('0x13')](_0xb51a('0xf'),_0x55c725,_0xd4f8dc[_0xb51a('0x13')][_0xb51a('0x14')]);return _0x375d0d(_0xd4f8dc[_0xb51a('0x13')][_0xb51a('0x14')]);}logger['error'](_0xb51a('0xf'),_0x55c725,_0xd4f8dc['error'][_0xb51a('0x14')]);return _0x455e71(_0xd4f8dc[_0xb51a('0x13')][_0xb51a('0x14')]);}else{logger[_0xb51a('0xe')](_0xb51a('0xf'),_0x55c725,_0xb51a('0x10'));_0x455e71(_0xd4f8dc[_0xb51a('0x15')][_0xb51a('0x14')]);}})['catch'](function(_0x5917ce){logger['error'](_0xb51a('0xf'),_0x55c725,_0x5917ce);_0x375d0d(_0x5917ce);});});}exports[_0xb51a('0x16')]=function(_0x2af6bb){var _0x2820b8=this;return new Promise(function(_0x43301e,_0x563b94){return db[_0xb51a('0x17')][_0xb51a('0x18')](_0x2af6bb[_0xb51a('0x19')],{'raw':_0x2af6bb['options']?_0x2af6bb[_0xb51a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb51a('0x1b')](function(_0x4c4a60){logger['info'](_0xb51a('0x16'),_0x2af6bb);logger['debug'](_0xb51a('0x16'),_0x2af6bb,JSON[_0xb51a('0x12')](_0x4c4a60));_0x43301e(_0x4c4a60);})[_0xb51a('0x1c')](function(_0x3b6de7){logger[_0xb51a('0x13')]('CreateSmsMessage',_0x3b6de7[_0xb51a('0x14')],_0x2af6bb);_0x563b94(_0x2820b8['error'](0x1f4,_0x3b6de7[_0xb51a('0x14')]));});});}; \ No newline at end of file +var _0x3387=['stringify','error','code','message','info','result','catch','body','options','raw','CreateSmsMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','redis','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x192eea,_0x5f4fd3){var _0x161666=function(_0x3fa845){while(--_0x3fa845){_0x192eea['push'](_0x192eea['shift']());}};_0x161666(++_0x5f4fd3);}(_0x3387,0x97));var _0x7338=function(_0x104e56,_0xb9cc75){_0x104e56=_0x104e56-0x0;var _0x403b84=_0x3387[_0x104e56];return _0x403b84;};'use strict';var _=require(_0x7338('0x0'));var util=require('util');var moment=require(_0x7338('0x1'));var BPromise=require(_0x7338('0x2'));var rs=require(_0x7338('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7338('0x4'))['db'];var utils=require(_0x7338('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7338('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7338('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7338('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7338('0x9'))(new Redis(config[_0x7338('0x8')]));require(_0x7338('0xa'))['register'](socket);function respondWithRpcPromise(_0x306de5,_0x21ab33,_0x45f284){return new BPromise(function(_0x28947a,_0x3ac12f){return client[_0x7338('0xb')](_0x306de5,_0x45f284)[_0x7338('0xc')](function(_0x3851b4){logger['info'](_0x7338('0xd'),_0x21ab33,_0x7338('0xe'));logger[_0x7338('0xf')](_0x7338('0x10'),_0x21ab33,_0x7338('0xe'),JSON[_0x7338('0x11')](_0x3851b4));if(_0x3851b4[_0x7338('0x12')]){if(_0x3851b4[_0x7338('0x12')][_0x7338('0x13')]===0x1f4){logger[_0x7338('0x12')](_0x7338('0xd'),_0x21ab33,_0x3851b4[_0x7338('0x12')][_0x7338('0x14')]);return _0x3ac12f(_0x3851b4[_0x7338('0x12')][_0x7338('0x14')]);}logger[_0x7338('0x12')](_0x7338('0xd'),_0x21ab33,_0x3851b4[_0x7338('0x12')][_0x7338('0x14')]);return _0x28947a(_0x3851b4[_0x7338('0x12')]['message']);}else{logger[_0x7338('0x15')]('SmsMessage,\x20%s,\x20%s',_0x21ab33,_0x7338('0xe'));_0x28947a(_0x3851b4[_0x7338('0x16')]['message']);}})[_0x7338('0x17')](function(_0x135a97){logger[_0x7338('0x12')]('SmsMessage,\x20%s,\x20%s',_0x21ab33,_0x135a97);_0x3ac12f(_0x135a97);});});}exports['CreateSmsMessage']=function(_0x1ad519){var _0x4ffb74=this;return new Promise(function(_0x1231bc,_0x1ee2e1){return db['SmsMessage']['create'](_0x1ad519[_0x7338('0x18')],{'raw':_0x1ad519[_0x7338('0x19')]?_0x1ad519[_0x7338('0x19')][_0x7338('0x1a')]===undefined?!![]:![]:!![]})[_0x7338('0xc')](function(_0x33b6be){logger[_0x7338('0x15')](_0x7338('0x1b'),_0x1ad519);logger[_0x7338('0xf')](_0x7338('0x1b'),_0x1ad519,JSON[_0x7338('0x11')](_0x33b6be));_0x1231bc(_0x33b6be);})[_0x7338('0x17')](function(_0x4fa26d){logger['error'](_0x7338('0x1b'),_0x4fa26d[_0x7338('0x14')],_0x1ad519);_0x1ee2e1(_0x4ffb74['error'](0x1f4,_0x4fa26d[_0x7338('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ed8b1a8..ff99d57 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 _0xba9d=['removeListener','register','./smsMessage.events','save','remove','update','emit'];(function(_0x18405f,_0x3ed101){var _0x3a86da=function(_0x6abead){while(--_0x6abead){_0x18405f['push'](_0x18405f['shift']());}};_0x3a86da(++_0x3ed101);}(_0xba9d,0x17c));var _0xdba9=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xba9d[_0x4792c8];return _0x35edb1;};'use strict';var SmsMessageEvents=require(_0xdba9('0x0'));var events=[_0xdba9('0x1'),_0xdba9('0x2'),_0xdba9('0x3')];function createListener(_0x5c0305,_0x2854e4){return function(_0x1dca2b){_0x2854e4[_0xdba9('0x4')](_0x5c0305,_0x1dca2b);};}function removeListener(_0x1f2b25,_0x39c222){return function(){SmsMessageEvents[_0xdba9('0x5')](_0x1f2b25,_0x39c222);};}exports[_0xdba9('0x6')]=function(_0x2f9752){for(var _0x57af0b=0x0,_0x4dc88e=events['length'];_0x57af0b<_0x4dc88e;_0x57af0b++){var _0x4afd65=events[_0x57af0b];var _0x3d34c2=createListener('smsMessage:'+_0x4afd65,_0x2f9752);SmsMessageEvents['on'](_0x4afd65,_0x3d34c2);}}; \ No newline at end of file +var _0x27f3=['remove','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x55c76f,_0x13b7f4){var _0x1571ff=function(_0x4082ce){while(--_0x4082ce){_0x55c76f['push'](_0x55c76f['shift']());}};_0x1571ff(++_0x13b7f4);}(_0x27f3,0x178));var _0x327f=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x27f3[_0x4c7b20];return _0x4872bd;};'use strict';var SmsMessageEvents=require(_0x327f('0x0'));var events=[_0x327f('0x1'),_0x327f('0x2'),_0x327f('0x3')];function createListener(_0x550b3f,_0x46a1b6){return function(_0x45202f){_0x46a1b6[_0x327f('0x4')](_0x550b3f,_0x45202f);};}function removeListener(_0x26c4aa,_0x578fef){return function(){SmsMessageEvents[_0x327f('0x5')](_0x26c4aa,_0x578fef);};}exports[_0x327f('0x6')]=function(_0x4cc130){for(var _0x295796=0x0,_0x39b5fc=events[_0x327f('0x7')];_0x295796<_0x39b5fc;_0x295796++){var _0x3b1626=events[_0x295796];var _0x525910=createListener(_0x327f('0x8')+_0x3b1626,_0x4cc130);SmsMessageEvents['on'](_0x3b1626,_0x525910);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a9bcfbe..eb5d13d 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 _0x1088=['destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','/:id'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x1088,0x1f4));var _0x8108=function(_0x5eb70f,_0x15e9ee){_0x5eb70f=_0x5eb70f-0x0;var _0x14090c=_0x1088[_0x5eb70f];return _0x14090c;};'use strict';var multer=require(_0x8108('0x0'));var util=require(_0x8108('0x1'));var path=require(_0x8108('0x2'));var timeout=require(_0x8108('0x3'));var express=require(_0x8108('0x4'));var router=express[_0x8108('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8108('0x6'));var interaction=require(_0x8108('0x7'));var config=require(_0x8108('0x8'));var controller=require(_0x8108('0x9'));router[_0x8108('0xa')]('/',auth['isAuthenticated'](),controller[_0x8108('0xb')]);router[_0x8108('0xa')](_0x8108('0xc'),auth[_0x8108('0xd')](),controller[_0x8108('0xe')]);router[_0x8108('0xa')]('/:id',auth[_0x8108('0xd')](),controller['show']);router[_0x8108('0xa')](_0x8108('0xf'),auth[_0x8108('0xd')](),controller['getMembers']);router[_0x8108('0xa')]('/:id/teams',auth[_0x8108('0xd')](),controller['getTeams']);router[_0x8108('0xa')](_0x8108('0x10'),auth[_0x8108('0xd')](),controller[_0x8108('0x11')]);router[_0x8108('0x12')]('/',auth[_0x8108('0xd')](),controller[_0x8108('0x13')]);router[_0x8108('0x12')](_0x8108('0x14'),auth['isAuthenticated'](),controller[_0x8108('0x15')]);router['post']('/:id/users',auth[_0x8108('0xd')](),controller[_0x8108('0x16')]);router[_0x8108('0x17')]('/:id',auth[_0x8108('0xd')](),controller[_0x8108('0x18')]);router[_0x8108('0x19')](_0x8108('0x1a'),auth['isAuthenticated'](),controller[_0x8108('0x1b')]);router[_0x8108('0x19')](_0x8108('0x14'),auth['isAuthenticated'](),controller[_0x8108('0x1c')]);router[_0x8108('0x19')]('/:id/users',auth[_0x8108('0xd')](),controller[_0x8108('0x1d')]);module[_0x8108('0x1e')]=router; \ No newline at end of file +var _0xeaa1=['/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated'];(function(_0x7dc91c,_0xc59628){var _0x25f614=function(_0x261f75){while(--_0x261f75){_0x7dc91c['push'](_0x7dc91c['shift']());}};_0x25f614(++_0xc59628);}(_0xeaa1,0x163));var _0x1eaa=function(_0x394114,_0x49ea1a){_0x394114=_0x394114-0x0;var _0x20c1bc=_0xeaa1[_0x394114];return _0x20c1bc;};'use strict';var multer=require('multer');var util=require(_0x1eaa('0x0'));var path=require(_0x1eaa('0x1'));var timeout=require(_0x1eaa('0x2'));var express=require(_0x1eaa('0x3'));var router=express[_0x1eaa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1eaa('0x5'));var config=require('../../config/environment');var controller=require(_0x1eaa('0x6'));router[_0x1eaa('0x7')]('/',auth[_0x1eaa('0x8')](),controller['index']);router['get']('/describe',auth[_0x1eaa('0x8')](),controller['describe']);router['get'](_0x1eaa('0x9'),auth[_0x1eaa('0x8')](),controller[_0x1eaa('0xa')]);router['get'](_0x1eaa('0xb'),auth[_0x1eaa('0x8')](),controller[_0x1eaa('0xc')]);router[_0x1eaa('0x7')](_0x1eaa('0xd'),auth[_0x1eaa('0x8')](),controller['getTeams']);router[_0x1eaa('0x7')](_0x1eaa('0xe'),auth['isAuthenticated'](),controller[_0x1eaa('0xf')]);router[_0x1eaa('0x10')]('/',auth[_0x1eaa('0x8')](),controller['create']);router[_0x1eaa('0x10')](_0x1eaa('0xd'),auth['isAuthenticated'](),controller[_0x1eaa('0x11')]);router[_0x1eaa('0x10')](_0x1eaa('0xe'),auth['isAuthenticated'](),controller[_0x1eaa('0x12')]);router[_0x1eaa('0x13')](_0x1eaa('0x9'),auth[_0x1eaa('0x8')](),controller[_0x1eaa('0x14')]);router[_0x1eaa('0x15')]('/:id',auth[_0x1eaa('0x8')](),controller[_0x1eaa('0x16')]);router[_0x1eaa('0x15')]('/:id/teams',auth[_0x1eaa('0x8')](),controller[_0x1eaa('0x17')]);router['delete'](_0x1eaa('0xe'),auth[_0x1eaa('0x8')](),controller[_0x1eaa('0x18')]);module[_0x1eaa('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f79a3f3..e717d4e 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 _0x0362=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x0362,0xfa));var _0x2036=function(_0x57bda0,_0x66c699){_0x57bda0=_0x57bda0-0x0;var _0x199f64=_0x0362[_0x57bda0];return _0x199f64;};'use strict';var Sequelize=require(_0x2036('0x0'));module[_0x2036('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2036('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2036('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2036('0x4')](_0x2036('0x5'),_0x2036('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xd234=['beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x276fae,_0x1424c1){var _0x132c7e=function(_0x4bf08a){while(--_0x4bf08a){_0x276fae['push'](_0x276fae['shift']());}};_0x132c7e(++_0x1424c1);}(_0xd234,0x1e8));var _0x4d23=function(_0x220dbe,_0xe23c15){_0x220dbe=_0x220dbe-0x0;var _0x311879=_0xd234[_0x220dbe];return _0x311879;};'use strict';var Sequelize=require('sequelize');module[_0x4d23('0x0')]={'name':{'type':Sequelize[_0x4d23('0x1')],'unique':_0x4d23('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4d23('0x1')]},'timeout':{'type':Sequelize[_0x4d23('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x4d23('0x4'),_0x4d23('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ced056d..a1f9144 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0xadb5,0xad));var _0x5adb=function(_0x116fdf,_0x780dd8){_0x116fdf=_0x116fdf-0x0;var _0x4e45b9=_0xadb5[_0x116fdf];return _0x4e45b9;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x2032,0xd9));var _0x2203=function(_0x3460cb,_0x53cf99){_0x3460cb=_0x3460cb-0x0;var _0x10ebd1=_0x2032[_0x3460cb];return _0x10ebd1;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a64a833..bab49fc 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 _0x1531=['emit','hasOwnProperty','events','../../mysqldb','SmsQueue','setMaxListeners','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1531,0x92));var _0x1153=function(_0x199896,_0x2aeb21){_0x199896=_0x199896-0x0;var _0x15faa3=_0x1531[_0x199896];return _0x15faa3;};'use strict';var EventEmitter=require(_0x1153('0x0'));var SmsQueue=require(_0x1153('0x1'))['db'][_0x1153('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1153('0x3')](0x0);var events={'afterCreate':_0x1153('0x4'),'afterUpdate':'update','afterDestroy':_0x1153('0x5')};function emitEvent(_0x72c04c){return function(_0x53b9ae,_0x1a9046,_0x3862f8){SmsQueueEvents['emit'](_0x72c04c+':'+_0x53b9ae['id'],_0x53b9ae);SmsQueueEvents[_0x1153('0x6')](_0x72c04c,_0x53b9ae);_0x3862f8(null);};}for(var e in events){if(events[_0x1153('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xff3f=['update','emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save'];(function(_0x1e8bcb,_0x474a81){var _0x212080=function(_0x57a1f5){while(--_0x57a1f5){_0x1e8bcb['push'](_0x1e8bcb['shift']());}};_0x212080(++_0x474a81);}(_0xff3f,0xdd));var _0xfff3=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xff3f[_0x1a9204];return _0x17ca68;};'use strict';var EventEmitter=require(_0xfff3('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xfff3('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfff3('0x2')](0x0);var events={'afterCreate':_0xfff3('0x3'),'afterUpdate':_0xfff3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x11094b){return function(_0x218154,_0x5cf25b,_0x2f030f){SmsQueueEvents[_0xfff3('0x5')](_0x11094b+':'+_0x218154['id'],_0x218154);SmsQueueEvents['emit'](_0x11094b,_0x218154);_0x2f030f(null);};}for(var e in events){if(events[_0xfff3('0x6')](e)){var event=events[e];SmsQueue[_0xfff3('0x7')](e,emitEvent(event));}}module[_0xfff3('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index d2d4f26..8958a01 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 _0x865a=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x3b3971,_0x3a62d7){var _0xbcd3dc=function(_0x2ee7fc){while(--_0x2ee7fc){_0x3b3971['push'](_0x3b3971['shift']());}};_0xbcd3dc(++_0x3a62d7);}(_0x865a,0x16d));var _0xa865=function(_0x1c3785,_0x28d73c){_0x1c3785=_0x1c3785-0x0;var _0x2aedbe=_0x865a[_0x1c3785];return _0x2aedbe;};'use strict';var _=require(_0xa865('0x0'));var util=require(_0xa865('0x1'));var logger=require('../../config/logger')(_0xa865('0x2'));var moment=require(_0xa865('0x3'));var BPromise=require(_0xa865('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa865('0x5'));var rimraf=require(_0xa865('0x6'));var config=require('../../config/environment');var attributes=require(_0xa865('0x7'));module[_0xa865('0x8')]=function(_0x2c1e41,_0xf3a283){return _0x2c1e41[_0xa865('0x9')](_0xa865('0xa'),attributes,{'tableName':_0xa865('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc633=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0xc633,0x107));var _0x3c63=function(_0x2a7379,_0x33cc90){_0x2a7379=_0x2a7379-0x0;var _0x438974=_0xc633[_0x2a7379];return _0x438974;};'use strict';var _=require('lodash');var util=require(_0x3c63('0x0'));var logger=require(_0x3c63('0x1'))(_0x3c63('0x2'));var moment=require('moment');var BPromise=require(_0x3c63('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c63('0x4'));var rimraf=require(_0x3c63('0x5'));var config=require(_0x3c63('0x6'));var attributes=require(_0x3c63('0x7'));module[_0x3c63('0x8')]=function(_0x402abe,_0x481972){return _0x402abe[_0x3c63('0x9')](_0x3c63('0xa'),attributes,{'tableName':_0x3c63('0xb'),'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 bf83d61..7f7a7fe 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 _0x50e7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','raw','options','attributes','limit','map','include','model','info','GetSmsQueue','ShowSmsQueue','SmsQueue','find','where','lodash','util','moment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x50e7,0xf3));var _0x750e=function(_0x4253b1,_0x29d93f){_0x4253b1=_0x4253b1-0x0;var _0x57870f=_0x50e7[_0x4253b1];return _0x57870f;};'use strict';var _=require(_0x750e('0x0'));var util=require(_0x750e('0x1'));var moment=require(_0x750e('0x2'));var BPromise=require(_0x750e('0x3'));var rs=require(_0x750e('0x4'));var fs=require('fs');var Redis=require(_0x750e('0x5'));var db=require(_0x750e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x750e('0x7'))(_0x750e('0x8'));var config=require(_0x750e('0x9'));var jayson=require(_0x750e('0xa'));var client=jayson['client'][_0x750e('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x750e('0xc')],{'host':_0x750e('0xd'),'port':0x18eb});var socket=require(_0x750e('0xe'))(new Redis(config[_0x750e('0xc')]));require(_0x750e('0xf'))['register'](socket);function respondWithRpcPromise(_0x950226,_0x265218,_0x13c556){return new BPromise(function(_0x14e3e9,_0x3399b7){return client[_0x750e('0x10')](_0x950226,_0x13c556)[_0x750e('0x11')](function(_0x5750f2){logger['info']('SmsQueue,\x20%s,\x20%s',_0x265218,'request\x20sent');logger[_0x750e('0x12')](_0x750e('0x13'),_0x265218,'request\x20sent',JSON[_0x750e('0x14')](_0x5750f2));if(_0x5750f2[_0x750e('0x15')]){if(_0x5750f2[_0x750e('0x15')][_0x750e('0x16')]===0x1f4){logger[_0x750e('0x15')](_0x750e('0x17'),_0x265218,_0x5750f2[_0x750e('0x15')]['message']);return _0x3399b7(_0x5750f2[_0x750e('0x15')][_0x750e('0x18')]);}logger['error'](_0x750e('0x17'),_0x265218,_0x5750f2['error'][_0x750e('0x18')]);return _0x14e3e9(_0x5750f2[_0x750e('0x15')][_0x750e('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x265218,_0x750e('0x19'));_0x14e3e9(_0x5750f2[_0x750e('0x1a')][_0x750e('0x18')]);}})[_0x750e('0x1b')](function(_0x4c6032){logger[_0x750e('0x15')](_0x750e('0x17'),_0x265218,_0x4c6032);_0x3399b7(_0x4c6032);});});}exports['GetSmsQueue']=function(_0x1ef3fd){var _0x163563=this;return new Promise(function(_0x2e9c30,_0x2cddea){return db['SmsQueue']['findAll']({'raw':_0x1ef3fd['options']?_0x1ef3fd['options'][_0x750e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ef3fd[_0x750e('0x1d')]?_0x1ef3fd[_0x750e('0x1d')]['where']||null:null,'attributes':_0x1ef3fd[_0x750e('0x1d')]?_0x1ef3fd[_0x750e('0x1d')][_0x750e('0x1e')]||null:null,'limit':_0x1ef3fd[_0x750e('0x1d')]?_0x1ef3fd[_0x750e('0x1d')][_0x750e('0x1f')]||null:null,'include':_0x1ef3fd[_0x750e('0x1d')]?_0x1ef3fd['options']['include']?_[_0x750e('0x20')](_0x1ef3fd[_0x750e('0x1d')][_0x750e('0x21')],function(_0x476296){return{'model':db[_0x476296[_0x750e('0x22')]],'as':_0x476296['as'],'attributes':_0x476296[_0x750e('0x1e')],'include':_0x476296[_0x750e('0x21')]?_[_0x750e('0x20')](_0x476296['include'],function(_0x677fa3){return{'model':db[_0x677fa3[_0x750e('0x22')]],'as':_0x677fa3['as'],'attributes':_0x677fa3['attributes'],'include':_0x677fa3['include']?_[_0x750e('0x20')](_0x677fa3[_0x750e('0x21')],function(_0x5f3a78){return{'model':db[_0x5f3a78[_0x750e('0x22')]],'as':_0x5f3a78['as'],'attributes':_0x5f3a78[_0x750e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x750e('0x11')](function(_0x5ac614){logger[_0x750e('0x23')](_0x750e('0x24'),_0x1ef3fd);logger[_0x750e('0x12')](_0x750e('0x24'),_0x1ef3fd,JSON[_0x750e('0x14')](_0x5ac614));_0x2e9c30(_0x5ac614);})['catch'](function(_0x4b88b9){logger[_0x750e('0x15')](_0x750e('0x24'),_0x4b88b9[_0x750e('0x18')],_0x1ef3fd);_0x2cddea(_0x163563[_0x750e('0x15')](0x1f4,_0x4b88b9['message']));});});};exports[_0x750e('0x25')]=function(_0x208b5f){var _0x496096=this;return new Promise(function(_0x3d1ae3,_0x1941c0){return db[_0x750e('0x26')][_0x750e('0x27')]({'raw':_0x208b5f[_0x750e('0x1d')]?_0x208b5f[_0x750e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x208b5f['options']?_0x208b5f[_0x750e('0x1d')][_0x750e('0x28')]||null:null,'attributes':_0x208b5f[_0x750e('0x1d')]?_0x208b5f[_0x750e('0x1d')][_0x750e('0x1e')]||null:null,'include':_0x208b5f['options']?_0x208b5f[_0x750e('0x1d')]['include']?_['map'](_0x208b5f[_0x750e('0x1d')][_0x750e('0x21')],function(_0x171be9){return{'model':db[_0x171be9['model']],'as':_0x171be9['as'],'attributes':_0x171be9[_0x750e('0x1e')],'include':_0x171be9[_0x750e('0x21')]?_[_0x750e('0x20')](_0x171be9['include'],function(_0x1512a8){return{'model':db[_0x1512a8[_0x750e('0x22')]],'as':_0x1512a8['as'],'attributes':_0x1512a8[_0x750e('0x1e')],'include':_0x1512a8[_0x750e('0x21')]?_[_0x750e('0x20')](_0x1512a8[_0x750e('0x21')],function(_0x5ee9ec){return{'model':db[_0x5ee9ec['model']],'as':_0x5ee9ec['as'],'attributes':_0x5ee9ec[_0x750e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x750e('0x11')](function(_0x3a216a){logger[_0x750e('0x23')](_0x750e('0x25'),_0x208b5f);logger[_0x750e('0x12')]('ShowSmsQueue',_0x208b5f,JSON[_0x750e('0x14')](_0x3a216a));_0x3d1ae3(_0x3a216a);})[_0x750e('0x1b')](function(_0x1de27a){logger[_0x750e('0x15')](_0x750e('0x25'),_0x1de27a[_0x750e('0x18')],_0x208b5f);_0x1941c0(_0x496096[_0x750e('0x15')](0x1f4,_0x1de27a['message']));});});}; \ No newline at end of file +var _0x70ba=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','findAll','raw','options','where','attributes','limit','include','map','model','then','SmsQueue','find','ShowSmsQueue','lodash'];(function(_0x8b156d,_0x31f312){var _0x4c06ed=function(_0x503c70){while(--_0x503c70){_0x8b156d['push'](_0x8b156d['shift']());}};_0x4c06ed(++_0x31f312);}(_0x70ba,0x109));var _0xa70b=function(_0x4b071c,_0x3bbb51){_0x4b071c=_0x4b071c-0x0;var _0x2f1757=_0x70ba[_0x4b071c];return _0x2f1757;};'use strict';var _=require(_0xa70b('0x0'));var util=require(_0xa70b('0x1'));var moment=require(_0xa70b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa70b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa70b('0x4'));var logger=require(_0xa70b('0x5'))(_0xa70b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa70b('0x7')]['http']({'port':0x232a});config[_0xa70b('0x8')]=_[_0xa70b('0x9')](config[_0xa70b('0x8')],{'host':_0xa70b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa70b('0x8')]));require(_0xa70b('0xb'))[_0xa70b('0xc')](socket);function respondWithRpcPromise(_0x238671,_0x4341cd,_0x142281){return new BPromise(function(_0x93d4f6,_0x29900b){return client[_0xa70b('0xd')](_0x238671,_0x142281)['then'](function(_0x10788b){logger[_0xa70b('0xe')](_0xa70b('0xf'),_0x4341cd,_0xa70b('0x10'));logger[_0xa70b('0x11')](_0xa70b('0x12'),_0x4341cd,_0xa70b('0x10'),JSON[_0xa70b('0x13')](_0x10788b));if(_0x10788b['error']){if(_0x10788b[_0xa70b('0x14')][_0xa70b('0x15')]===0x1f4){logger[_0xa70b('0x14')](_0xa70b('0xf'),_0x4341cd,_0x10788b[_0xa70b('0x14')][_0xa70b('0x16')]);return _0x29900b(_0x10788b['error'][_0xa70b('0x16')]);}logger[_0xa70b('0x14')]('SmsQueue,\x20%s,\x20%s',_0x4341cd,_0x10788b[_0xa70b('0x14')][_0xa70b('0x16')]);return _0x93d4f6(_0x10788b[_0xa70b('0x14')][_0xa70b('0x16')]);}else{logger[_0xa70b('0xe')](_0xa70b('0xf'),_0x4341cd,_0xa70b('0x10'));_0x93d4f6(_0x10788b['result'][_0xa70b('0x16')]);}})[_0xa70b('0x17')](function(_0x4fca5e){logger['error'](_0xa70b('0xf'),_0x4341cd,_0x4fca5e);_0x29900b(_0x4fca5e);});});}exports[_0xa70b('0x18')]=function(_0x567a36){var _0x3da19c=this;return new Promise(function(_0x47ec3d,_0x4859b2){return db['SmsQueue'][_0xa70b('0x19')]({'raw':_0x567a36['options']?_0x567a36['options'][_0xa70b('0x1a')]===undefined?!![]:![]:!![],'where':_0x567a36['options']?_0x567a36[_0xa70b('0x1b')][_0xa70b('0x1c')]||null:null,'attributes':_0x567a36[_0xa70b('0x1b')]?_0x567a36['options'][_0xa70b('0x1d')]||null:null,'limit':_0x567a36[_0xa70b('0x1b')]?_0x567a36[_0xa70b('0x1b')][_0xa70b('0x1e')]||null:null,'include':_0x567a36[_0xa70b('0x1b')]?_0x567a36[_0xa70b('0x1b')][_0xa70b('0x1f')]?_[_0xa70b('0x20')](_0x567a36[_0xa70b('0x1b')][_0xa70b('0x1f')],function(_0x503a95){return{'model':db[_0x503a95[_0xa70b('0x21')]],'as':_0x503a95['as'],'attributes':_0x503a95[_0xa70b('0x1d')],'include':_0x503a95[_0xa70b('0x1f')]?_[_0xa70b('0x20')](_0x503a95[_0xa70b('0x1f')],function(_0x92a337){return{'model':db[_0x92a337['model']],'as':_0x92a337['as'],'attributes':_0x92a337['attributes'],'include':_0x92a337[_0xa70b('0x1f')]?_[_0xa70b('0x20')](_0x92a337[_0xa70b('0x1f')],function(_0x2017ee){return{'model':db[_0x2017ee[_0xa70b('0x21')]],'as':_0x2017ee['as'],'attributes':_0x2017ee[_0xa70b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa70b('0x22')](function(_0x574cf9){logger['info']('GetSmsQueue',_0x567a36);logger['debug'](_0xa70b('0x18'),_0x567a36,JSON[_0xa70b('0x13')](_0x574cf9));_0x47ec3d(_0x574cf9);})[_0xa70b('0x17')](function(_0x41ba81){logger[_0xa70b('0x14')](_0xa70b('0x18'),_0x41ba81[_0xa70b('0x16')],_0x567a36);_0x4859b2(_0x3da19c['error'](0x1f4,_0x41ba81[_0xa70b('0x16')]));});});};exports['ShowSmsQueue']=function(_0x1f3271){var _0x38c040=this;return new Promise(function(_0x252b95,_0xa837c8){return db[_0xa70b('0x23')][_0xa70b('0x24')]({'raw':_0x1f3271[_0xa70b('0x1b')]?_0x1f3271['options'][_0xa70b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f3271['options']?_0x1f3271['options'][_0xa70b('0x1c')]||null:null,'attributes':_0x1f3271[_0xa70b('0x1b')]?_0x1f3271[_0xa70b('0x1b')][_0xa70b('0x1d')]||null:null,'include':_0x1f3271['options']?_0x1f3271[_0xa70b('0x1b')][_0xa70b('0x1f')]?_['map'](_0x1f3271['options'][_0xa70b('0x1f')],function(_0xd4965e){return{'model':db[_0xd4965e[_0xa70b('0x21')]],'as':_0xd4965e['as'],'attributes':_0xd4965e[_0xa70b('0x1d')],'include':_0xd4965e['include']?_['map'](_0xd4965e['include'],function(_0x1371a7){return{'model':db[_0x1371a7[_0xa70b('0x21')]],'as':_0x1371a7['as'],'attributes':_0x1371a7[_0xa70b('0x1d')],'include':_0x1371a7['include']?_[_0xa70b('0x20')](_0x1371a7[_0xa70b('0x1f')],function(_0x56db47){return{'model':db[_0x56db47[_0xa70b('0x21')]],'as':_0x56db47['as'],'attributes':_0x56db47['attributes']};}):[]};}):[]};}):[]:[]})[_0xa70b('0x22')](function(_0x261d77){logger[_0xa70b('0xe')](_0xa70b('0x25'),_0x1f3271);logger['debug'](_0xa70b('0x25'),_0x1f3271,JSON['stringify'](_0x261d77));_0x252b95(_0x261d77);})[_0xa70b('0x17')](function(_0x1015e8){logger['error'](_0xa70b('0x25'),_0x1015e8[_0xa70b('0x16')],_0x1f3271);_0xa837c8(_0x38c040[_0xa70b('0x14')](0x1f4,_0x1015e8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f3681cf..8b0b7b0 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 _0x5cc4=['./smsQueue.events','save','emit','removeListener','length'];(function(_0x2c8e0f,_0x40a015){var _0x2095b0=function(_0x5a40a7){while(--_0x5a40a7){_0x2c8e0f['push'](_0x2c8e0f['shift']());}};_0x2095b0(++_0x40a015);}(_0x5cc4,0x109));var _0x45cc=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0x5cc4[_0xa28b1a];return _0x4c9b78;};'use strict';var SmsQueueEvents=require(_0x45cc('0x0'));var events=[_0x45cc('0x1'),'remove','update'];function createListener(_0x2885b6,_0x4081f8){return function(_0x151597){_0x4081f8[_0x45cc('0x2')](_0x2885b6,_0x151597);};}function removeListener(_0x3a53b3,_0x758897){return function(){SmsQueueEvents[_0x45cc('0x3')](_0x3a53b3,_0x758897);};}exports['register']=function(_0x243b1a){for(var _0x557bbe=0x0,_0x4170f1=events[_0x45cc('0x4')];_0x557bbe<_0x4170f1;_0x557bbe++){var _0x2fcebe=events[_0x557bbe];var _0x4475b1=createListener('smsQueue:'+_0x2fcebe,_0x243b1a);SmsQueueEvents['on'](_0x2fcebe,_0x4475b1);}}; \ No newline at end of file +var _0xfdd2=['./smsQueue.events','remove','emit','register','length'];(function(_0x566862,_0x49a760){var _0x1ebc27=function(_0x126d7a){while(--_0x126d7a){_0x566862['push'](_0x566862['shift']());}};_0x1ebc27(++_0x49a760);}(_0xfdd2,0xf0));var _0x2fdd=function(_0x146907,_0x541dcb){_0x146907=_0x146907-0x0;var _0x47e370=_0xfdd2[_0x146907];return _0x47e370;};'use strict';var SmsQueueEvents=require(_0x2fdd('0x0'));var events=['save',_0x2fdd('0x1'),'update'];function createListener(_0x3ebbaf,_0x355b1f){return function(_0x3e52ff){_0x355b1f[_0x2fdd('0x2')](_0x3ebbaf,_0x3e52ff);};}function removeListener(_0x34c070,_0x54635c){return function(){SmsQueueEvents['removeListener'](_0x34c070,_0x54635c);};}exports[_0x2fdd('0x3')]=function(_0x2be61d){for(var _0x15d602=0x0,_0x2ed0f4=events[_0x2fdd('0x4')];_0x15d602<_0x2ed0f4;_0x15d602++){var _0x7bbdd2=events[_0x15d602];var _0x1346ba=createListener('smsQueue:'+_0x7bbdd2,_0x2be61d);SmsQueueEvents['on'](_0x7bbdd2,_0x1346ba);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 759b02b..276681a 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 _0xbf16=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','destroy'];(function(_0x272fa1,_0x51f993){var _0x34c959=function(_0x1609db){while(--_0x1609db){_0x272fa1['push'](_0x272fa1['shift']());}};_0x34c959(++_0x51f993);}(_0xbf16,0x73));var _0x6bf1=function(_0x734df4,_0x3fc92a){_0x734df4=_0x734df4-0x0;var _0x16a855=_0xbf16[_0x734df4];return _0x16a855;};'use strict';var multer=require(_0x6bf1('0x0'));var util=require(_0x6bf1('0x1'));var path=require(_0x6bf1('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bf1('0x3'));var router=express['Router']();var fs_extra=require(_0x6bf1('0x4'));var auth=require(_0x6bf1('0x5'));var interaction=require(_0x6bf1('0x6'));var config=require(_0x6bf1('0x7'));var controller=require(_0x6bf1('0x8'));router['get']('/',auth[_0x6bf1('0x9')](),controller[_0x6bf1('0xa')]);router[_0x6bf1('0xb')](_0x6bf1('0xc'),auth[_0x6bf1('0x9')](),controller['describe']);router[_0x6bf1('0xb')](_0x6bf1('0xd'),auth[_0x6bf1('0x9')](),controller[_0x6bf1('0xe')]);router[_0x6bf1('0xf')]('/',auth[_0x6bf1('0x9')](),controller[_0x6bf1('0x10')]);router['put'](_0x6bf1('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6bf1('0xd'),auth[_0x6bf1('0x9')](),controller[_0x6bf1('0x11')]);module[_0x6bf1('0x12')]=router; \ No newline at end of file +var _0x83b3=['describe','/:id','show','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x83b3,0x147));var _0x383b=function(_0x2fd9ea,_0x1a99d9){_0x2fd9ea=_0x2fd9ea-0x0;var _0x4ba133=_0x83b3[_0x2fd9ea];return _0x4ba133;};'use strict';var multer=require(_0x383b('0x0'));var util=require(_0x383b('0x1'));var path=require(_0x383b('0x2'));var timeout=require(_0x383b('0x3'));var express=require(_0x383b('0x4'));var router=express[_0x383b('0x5')]();var fs_extra=require(_0x383b('0x6'));var auth=require(_0x383b('0x7'));var interaction=require(_0x383b('0x8'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x383b('0x9')]('/',auth[_0x383b('0xa')](),controller[_0x383b('0xb')]);router[_0x383b('0x9')](_0x383b('0xc'),auth[_0x383b('0xa')](),controller[_0x383b('0xd')]);router[_0x383b('0x9')](_0x383b('0xe'),auth[_0x383b('0xa')](),controller[_0x383b('0xf')]);router['post']('/',auth[_0x383b('0xa')](),controller[_0x383b('0x10')]);router[_0x383b('0x11')](_0x383b('0xe'),auth[_0x383b('0xa')](),controller['update']);router[_0x383b('0x12')]('/:id',auth[_0x383b('0xa')](),controller['destroy']);module[_0x383b('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 42eed98..180a641 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 _0x7c53=['DATE','moment','STRING'];(function(_0x5f02bf,_0x2b4ad7){var _0x52a087=function(_0x1f61e4){while(--_0x1f61e4){_0x5f02bf['push'](_0x5f02bf['shift']());}};_0x52a087(++_0x2b4ad7);}(_0x7c53,0xbb));var _0x37c5=function(_0x5d0340,_0x52fa09){_0x5d0340=_0x5d0340-0x0;var _0x26a959=_0x7c53[_0x5d0340];return _0x26a959;};'use strict';var moment=require(_0x37c5('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x37c5('0x1')]},'joinAt':{'type':Sequelize[_0x37c5('0x2')]},'leaveAt':{'type':Sequelize[_0x37c5('0x2')]},'acceptAt':{'type':Sequelize[_0x37c5('0x2')]},'exitAt':{'type':Sequelize[_0x37c5('0x2')]},'reason':{'type':Sequelize[_0x37c5('0x1')]}}; \ No newline at end of file +var _0xe86b=['STRING','DATE','moment','sequelize','exports'];(function(_0x5259e1,_0xcd97fd){var _0x319c87=function(_0x4eea4d){while(--_0x4eea4d){_0x5259e1['push'](_0x5259e1['shift']());}};_0x319c87(++_0xcd97fd);}(_0xe86b,0x1c9));var _0xbe86=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe86b[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0xbe86('0x0'));var Sequelize=require(_0xbe86('0x1'));module[_0xbe86('0x2')]={'uniqueid':{'type':Sequelize[_0xbe86('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbe86('0x3')]},'joinAt':{'type':Sequelize[_0xbe86('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbe86('0x4')]},'exitAt':{'type':Sequelize[_0xbe86('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 277df77..b70e143 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 _0x14dc=['rows','catch','show','params','intersection','fields','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','SmsQueueReport','findAll'];(function(_0x4a9880,_0x5a7b64){var _0x216eea=function(_0x2b0c6f){while(--_0x2b0c6f){_0x4a9880['push'](_0x4a9880['shift']());}};_0x216eea(++_0x5a7b64);}(_0x14dc,0x9e));var _0xc14d=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x14dc[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc14d('0x0'));var zipdir=require(_0xc14d('0x1'));var jsonpatch=require(_0xc14d('0x2'));var rp=require(_0xc14d('0x3'));var moment=require(_0xc14d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc14d('0x5'));var util=require(_0xc14d('0x6'));var path=require(_0xc14d('0x7'));var sox=require(_0xc14d('0x8'));var csv=require('to-csv');var ejs=require(_0xc14d('0x9'));var fs=require('fs');var fs_extra=require(_0xc14d('0xa'));var _=require(_0xc14d('0xb'));var squel=require('squel');var crypto=require(_0xc14d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc14d('0xd'));var toCsv=require(_0xc14d('0xe'));var querystring=require(_0xc14d('0xf'));var Papa=require(_0xc14d('0x10'));var Redis=require(_0xc14d('0x11'));var authService=require(_0xc14d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc14d('0x13'));var hardwareService=require(_0xc14d('0x14'));var logger=require(_0xc14d('0x15'))(_0xc14d('0x16'));var utils=require('../../config/utils');var config=require(_0xc14d('0x17'));var licenseUtil=require(_0xc14d('0x18'));var db=require(_0xc14d('0x19'))['db'];function respondWithStatusCode(_0x2bef60,_0x28720f){_0x28720f=_0x28720f||0xcc;return function(_0x2ed5b9){if(_0x2ed5b9){return _0x2bef60[_0xc14d('0x1a')](_0x28720f);}return _0x2bef60['status'](_0x28720f)[_0xc14d('0x1b')]();};}function respondWithResult(_0x4da34d,_0x1bfb3a){_0x1bfb3a=_0x1bfb3a||0xc8;return function(_0x357d9){if(_0x357d9){return _0x4da34d[_0xc14d('0x1c')](_0x1bfb3a)['json'](_0x357d9);}};}function respondWithFilteredResult(_0x47f651,_0x158695){return function(_0x5524e2){if(_0x5524e2){var _0x134c5c=typeof _0x158695['offset']===_0xc14d('0x1d')&&typeof _0x158695['limit']===_0xc14d('0x1d');var _0x437464=_0x5524e2[_0xc14d('0x1e')];var _0x237c7f=_0x134c5c?0x0:_0x158695[_0xc14d('0x1f')];var _0x5d279c=_0x134c5c?_0x5524e2[_0xc14d('0x1e')]:_0x158695[_0xc14d('0x1f')]+_0x158695[_0xc14d('0x20')];var _0x4ca91b;if(_0x5d279c>=_0x437464){_0x5d279c=_0x437464;_0x4ca91b=0xc8;}else{_0x4ca91b=0xce;}_0x47f651[_0xc14d('0x1c')](_0x4ca91b);return _0x47f651[_0xc14d('0x21')](_0xc14d('0x22'),_0x237c7f+'-'+_0x5d279c+'/'+_0x437464)['json'](_0x5524e2);}return null;};}function patchUpdates(_0x204511){return function(_0x14726b){try{jsonpatch['apply'](_0x14726b,_0x204511,!![]);}catch(_0x44b8a3){return BPromise[_0xc14d('0x23')](_0x44b8a3);}return _0x14726b[_0xc14d('0x24')]();};}function saveUpdates(_0x24c2ff,_0x34e787){return function(_0x54b6f7){if(_0x54b6f7){return _0x54b6f7['update'](_0x24c2ff)[_0xc14d('0x25')](function(_0x3cee55){return _0x3cee55;});}return null;};}function removeEntity(_0x508072,_0x2e389a){return function(_0xe20fc1){if(_0xe20fc1){return _0xe20fc1['destroy']()[_0xc14d('0x25')](function(){_0x508072[_0xc14d('0x1c')](0xcc)[_0xc14d('0x1b')]();});}};}function handleEntityNotFound(_0x5900a6,_0x4621af){return function(_0x406c1f){if(!_0x406c1f){_0x5900a6['sendStatus'](0x194);}return _0x406c1f;};}function handleError(_0x470303,_0x2a2548){_0x2a2548=_0x2a2548||0x1f4;return function(_0xf9ce4a){logger[_0xc14d('0x26')](_0xf9ce4a['stack']);if(_0xf9ce4a[_0xc14d('0x27')]){delete _0xf9ce4a[_0xc14d('0x27')];}_0x470303['status'](_0x2a2548)[_0xc14d('0x28')](_0xf9ce4a);};}exports[_0xc14d('0x29')]=function(_0x157a79,_0xfc3e8e){var _0x3527de={},_0x16cd06={},_0x28dc21={'count':0x0,'rows':[]};var _0x5062b7=_[_0xc14d('0x2a')](db['SmsQueueReport'][_0xc14d('0x2b')],function(_0x1bd772){return{'name':_0x1bd772[_0xc14d('0x2c')],'type':_0x1bd772[_0xc14d('0x2d')][_0xc14d('0x2e')]};});_0x16cd06['model']=_['map'](_0x5062b7,'name');_0x16cd06[_0xc14d('0x2f')]=_[_0xc14d('0x30')](_0x157a79[_0xc14d('0x2f')]);_0x16cd06[_0xc14d('0x31')]=_['intersection'](_0x16cd06[_0xc14d('0x32')],_0x16cd06[_0xc14d('0x2f')]);_0x3527de[_0xc14d('0x33')]=_['intersection'](_0x16cd06['model'],qs['fields'](_0x157a79['query']['fields']));_0x3527de[_0xc14d('0x33')]=_0x3527de['attributes'][_0xc14d('0x34')]?_0x3527de[_0xc14d('0x33')]:_0x16cd06['model'];if(!_0x157a79['query']['hasOwnProperty'](_0xc14d('0x35'))){_0x3527de[_0xc14d('0x20')]=qs[_0xc14d('0x20')](_0x157a79[_0xc14d('0x2f')]['limit']);_0x3527de[_0xc14d('0x1f')]=qs[_0xc14d('0x1f')](_0x157a79[_0xc14d('0x2f')]['offset']);}_0x3527de['order']=qs[_0xc14d('0x36')](_0x157a79[_0xc14d('0x2f')][_0xc14d('0x36')]);_0x3527de[_0xc14d('0x37')]=qs[_0xc14d('0x31')](_['pick'](_0x157a79[_0xc14d('0x2f')],_0x16cd06[_0xc14d('0x31')]),_0x5062b7);if(_0x157a79[_0xc14d('0x2f')]['filter']){_0x3527de['where']=_[_0xc14d('0x38')](_0x3527de[_0xc14d('0x37')],{'$or':_[_0xc14d('0x2a')](_0x5062b7,function(_0x1cc365){if(_0x1cc365['type']!==_0xc14d('0x39')){var _0x2c12e8={};_0x2c12e8[_0x1cc365[_0xc14d('0x27')]]={'$like':'%'+_0x157a79[_0xc14d('0x2f')][_0xc14d('0x3a')]+'%'};return _0x2c12e8;}})});}_0x3527de=_[_0xc14d('0x38')]({},_0x3527de,_0x157a79[_0xc14d('0x3b')]);var _0x5ec3ce={'where':_0x3527de[_0xc14d('0x37')]};return db['SmsQueueReport'][_0xc14d('0x1e')](_0x5ec3ce)[_0xc14d('0x25')](function(_0x372f97){_0x28dc21[_0xc14d('0x1e')]=_0x372f97;if(_0x157a79['query'][_0xc14d('0x3c')]){_0x3527de[_0xc14d('0x3d')]=[{'all':!![]}];}return db[_0xc14d('0x3e')][_0xc14d('0x3f')](_0x3527de);})[_0xc14d('0x25')](function(_0x342533){_0x28dc21[_0xc14d('0x40')]=_0x342533;return _0x28dc21;})['then'](respondWithFilteredResult(_0xfc3e8e,_0x3527de))[_0xc14d('0x41')](handleError(_0xfc3e8e,null));};exports[_0xc14d('0x42')]=function(_0x39c2c0,_0x51b4d4){var _0x54d08d={'raw':!![],'where':{'id':_0x39c2c0[_0xc14d('0x43')]['id']}},_0x4a7cbd={};_0x4a7cbd[_0xc14d('0x32')]=_[_0xc14d('0x30')](db['SmsQueueReport'][_0xc14d('0x2b')]);_0x4a7cbd[_0xc14d('0x2f')]=_[_0xc14d('0x30')](_0x39c2c0['query']);_0x4a7cbd[_0xc14d('0x31')]=_['intersection'](_0x4a7cbd[_0xc14d('0x32')],_0x4a7cbd[_0xc14d('0x2f')]);_0x54d08d[_0xc14d('0x33')]=_[_0xc14d('0x44')](_0x4a7cbd['model'],qs['fields'](_0x39c2c0[_0xc14d('0x2f')][_0xc14d('0x45')]));_0x54d08d[_0xc14d('0x33')]=_0x54d08d[_0xc14d('0x33')][_0xc14d('0x34')]?_0x54d08d['attributes']:_0x4a7cbd[_0xc14d('0x32')];if(_0x39c2c0[_0xc14d('0x2f')]['includeAll']){_0x54d08d[_0xc14d('0x3d')]=[{'all':!![]}];}_0x54d08d=_[_0xc14d('0x38')]({},_0x54d08d,_0x39c2c0[_0xc14d('0x3b')]);return db['SmsQueueReport'][_0xc14d('0x46')](_0x54d08d)[_0xc14d('0x25')](handleEntityNotFound(_0x51b4d4,null))[_0xc14d('0x25')](respondWithResult(_0x51b4d4,null))[_0xc14d('0x41')](handleError(_0x51b4d4,null));};exports[_0xc14d('0x47')]=function(_0xc967d,_0x44a58b){return db['SmsQueueReport'][_0xc14d('0x47')](_0xc967d['body'],{})[_0xc14d('0x25')](respondWithResult(_0x44a58b,0xc9))[_0xc14d('0x41')](handleError(_0x44a58b,null));};exports['update']=function(_0x20b5c6,_0x6b5961){if(_0x20b5c6[_0xc14d('0x48')]['id']){delete _0x20b5c6['body']['id'];}return db[_0xc14d('0x3e')][_0xc14d('0x46')]({'where':{'id':_0x20b5c6[_0xc14d('0x43')]['id']}})[_0xc14d('0x25')](handleEntityNotFound(_0x6b5961,null))[_0xc14d('0x25')](saveUpdates(_0x20b5c6[_0xc14d('0x48')],null))['then'](respondWithResult(_0x6b5961,null))[_0xc14d('0x41')](handleError(_0x6b5961,null));};exports['destroy']=function(_0x25cf46,_0x6815f2){return db[_0xc14d('0x3e')][_0xc14d('0x46')]({'where':{'id':_0x25cf46[_0xc14d('0x43')]['id']}})[_0xc14d('0x25')](handleEntityNotFound(_0x6815f2,null))['then'](removeEntity(_0x6815f2,null))['catch'](handleError(_0x6815f2,null));};exports['describe']=function(_0x446829,_0x8c2d5){return db[_0xc14d('0x3e')][_0xc14d('0x49')]()[_0xc14d('0x25')](respondWithResult(_0x8c2d5,null))[_0xc14d('0x41')](handleError(_0x8c2d5,null));}; \ No newline at end of file +var _0xc1fe=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','save','then','status','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','SmsQueueReport','findAll','rows','catch','show','find','create','body','params','describe','eml-format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc1fe,0x9d));var _0xec1f=function(_0x2f8dac,_0x1050ba){_0x2f8dac=_0x2f8dac-0x0;var _0x3d4222=_0xc1fe[_0x2f8dac];return _0x3d4222;};'use strict';var emlformat=require(_0xec1f('0x0'));var rimraf=require(_0xec1f('0x1'));var zipdir=require(_0xec1f('0x2'));var jsonpatch=require(_0xec1f('0x3'));var rp=require(_0xec1f('0x4'));var moment=require(_0xec1f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xec1f('0x6'));var util=require('util');var path=require(_0xec1f('0x7'));var sox=require(_0xec1f('0x8'));var csv=require(_0xec1f('0x9'));var ejs=require(_0xec1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec1f('0xb'));var squel=require(_0xec1f('0xc'));var crypto=require(_0xec1f('0xd'));var jsforce=require(_0xec1f('0xe'));var deskjs=require(_0xec1f('0xf'));var toCsv=require(_0xec1f('0x9'));var querystring=require(_0xec1f('0x10'));var Papa=require(_0xec1f('0x11'));var Redis=require('ioredis');var authService=require(_0xec1f('0x12'));var qs=require(_0xec1f('0x13'));var as=require(_0xec1f('0x14'));var hardwareService=require(_0xec1f('0x15'));var logger=require(_0xec1f('0x16'))('api');var utils=require(_0xec1f('0x17'));var config=require(_0xec1f('0x18'));var licenseUtil=require(_0xec1f('0x19'));var db=require(_0xec1f('0x1a'))['db'];function respondWithStatusCode(_0x1f17d7,_0x446e82){_0x446e82=_0x446e82||0xcc;return function(_0x31990d){if(_0x31990d){return _0x1f17d7[_0xec1f('0x1b')](_0x446e82);}return _0x1f17d7['status'](_0x446e82)['end']();};}function respondWithResult(_0x5a67c,_0x581738){_0x581738=_0x581738||0xc8;return function(_0x3cb285){if(_0x3cb285){return _0x5a67c['status'](_0x581738)[_0xec1f('0x1c')](_0x3cb285);}};}function respondWithFilteredResult(_0x23b4df,_0x1bb6df){return function(_0xef84e1){if(_0xef84e1){var _0x32636d=typeof _0x1bb6df[_0xec1f('0x1d')]===_0xec1f('0x1e')&&typeof _0x1bb6df[_0xec1f('0x1f')]===_0xec1f('0x1e');var _0x29479b=_0xef84e1[_0xec1f('0x20')];var _0x10a85d=_0x32636d?0x0:_0x1bb6df['offset'];var _0x2ebf0e=_0x32636d?_0xef84e1['count']:_0x1bb6df[_0xec1f('0x1d')]+_0x1bb6df['limit'];var _0x5eae05;if(_0x2ebf0e>=_0x29479b){_0x2ebf0e=_0x29479b;_0x5eae05=0xc8;}else{_0x5eae05=0xce;}_0x23b4df['status'](_0x5eae05);return _0x23b4df[_0xec1f('0x21')](_0xec1f('0x22'),_0x10a85d+'-'+_0x2ebf0e+'/'+_0x29479b)[_0xec1f('0x1c')](_0xef84e1);}return null;};}function patchUpdates(_0x59fa9e){return function(_0x3cf455){try{jsonpatch['apply'](_0x3cf455,_0x59fa9e,!![]);}catch(_0x58f180){return BPromise['reject'](_0x58f180);}return _0x3cf455[_0xec1f('0x23')]();};}function saveUpdates(_0x3691e8,_0x1e969a){return function(_0x586002){if(_0x586002){return _0x586002['update'](_0x3691e8)['then'](function(_0x4e65a5){return _0x4e65a5;});}return null;};}function removeEntity(_0x41913f,_0x25d09d){return function(_0x3bd84c){if(_0x3bd84c){return _0x3bd84c['destroy']()[_0xec1f('0x24')](function(){_0x41913f[_0xec1f('0x25')](0xcc)[_0xec1f('0x26')]();});}};}function handleEntityNotFound(_0x35478b,_0x898b8e){return function(_0x423cbe){if(!_0x423cbe){_0x35478b['sendStatus'](0x194);}return _0x423cbe;};}function handleError(_0x576e52,_0x415c20){_0x415c20=_0x415c20||0x1f4;return function(_0x51e93b){logger[_0xec1f('0x27')](_0x51e93b[_0xec1f('0x28')]);if(_0x51e93b[_0xec1f('0x29')]){delete _0x51e93b['name'];}_0x576e52['status'](_0x415c20)[_0xec1f('0x2a')](_0x51e93b);};}exports[_0xec1f('0x2b')]=function(_0x43c5c3,_0x19cec3){var _0x22d219={},_0x2180bf={},_0x19c171={'count':0x0,'rows':[]};var _0x3a750d=_[_0xec1f('0x2c')](db['SmsQueueReport'][_0xec1f('0x2d')],function(_0x15c1c4){return{'name':_0x15c1c4[_0xec1f('0x2e')],'type':_0x15c1c4['type'][_0xec1f('0x2f')]};});_0x2180bf[_0xec1f('0x30')]=_['map'](_0x3a750d,_0xec1f('0x29'));_0x2180bf['query']=_[_0xec1f('0x31')](_0x43c5c3['query']);_0x2180bf['filters']=_[_0xec1f('0x32')](_0x2180bf[_0xec1f('0x30')],_0x2180bf[_0xec1f('0x33')]);_0x22d219[_0xec1f('0x34')]=_[_0xec1f('0x32')](_0x2180bf[_0xec1f('0x30')],qs[_0xec1f('0x35')](_0x43c5c3[_0xec1f('0x33')][_0xec1f('0x35')]));_0x22d219[_0xec1f('0x34')]=_0x22d219[_0xec1f('0x34')][_0xec1f('0x36')]?_0x22d219[_0xec1f('0x34')]:_0x2180bf[_0xec1f('0x30')];if(!_0x43c5c3[_0xec1f('0x33')][_0xec1f('0x37')](_0xec1f('0x38'))){_0x22d219[_0xec1f('0x1f')]=qs[_0xec1f('0x1f')](_0x43c5c3[_0xec1f('0x33')][_0xec1f('0x1f')]);_0x22d219[_0xec1f('0x1d')]=qs['offset'](_0x43c5c3[_0xec1f('0x33')][_0xec1f('0x1d')]);}_0x22d219[_0xec1f('0x39')]=qs[_0xec1f('0x3a')](_0x43c5c3[_0xec1f('0x33')][_0xec1f('0x3a')]);_0x22d219['where']=qs[_0xec1f('0x3b')](_[_0xec1f('0x3c')](_0x43c5c3['query'],_0x2180bf['filters']),_0x3a750d);if(_0x43c5c3['query'][_0xec1f('0x3d')]){_0x22d219[_0xec1f('0x3e')]=_[_0xec1f('0x3f')](_0x22d219[_0xec1f('0x3e')],{'$or':_[_0xec1f('0x2c')](_0x3a750d,function(_0x51b69d){if(_0x51b69d[_0xec1f('0x40')]!==_0xec1f('0x41')){var _0x19cf48={};_0x19cf48[_0x51b69d[_0xec1f('0x29')]]={'$like':'%'+_0x43c5c3[_0xec1f('0x33')]['filter']+'%'};return _0x19cf48;}})});}_0x22d219=_['merge']({},_0x22d219,_0x43c5c3[_0xec1f('0x42')]);var _0x3d1cc4={'where':_0x22d219[_0xec1f('0x3e')]};return db['SmsQueueReport'][_0xec1f('0x20')](_0x3d1cc4)[_0xec1f('0x24')](function(_0x3795f2){_0x19c171['count']=_0x3795f2;if(_0x43c5c3[_0xec1f('0x33')][_0xec1f('0x43')]){_0x22d219[_0xec1f('0x44')]=[{'all':!![]}];}return db[_0xec1f('0x45')][_0xec1f('0x46')](_0x22d219);})[_0xec1f('0x24')](function(_0x39aa05){_0x19c171[_0xec1f('0x47')]=_0x39aa05;return _0x19c171;})['then'](respondWithFilteredResult(_0x19cec3,_0x22d219))[_0xec1f('0x48')](handleError(_0x19cec3,null));};exports[_0xec1f('0x49')]=function(_0x4467a8,_0x58c3b5){var _0x44d4c5={'raw':!![],'where':{'id':_0x4467a8['params']['id']}},_0x9c04a3={};_0x9c04a3[_0xec1f('0x30')]=_[_0xec1f('0x31')](db[_0xec1f('0x45')][_0xec1f('0x2d')]);_0x9c04a3['query']=_[_0xec1f('0x31')](_0x4467a8[_0xec1f('0x33')]);_0x9c04a3['filters']=_[_0xec1f('0x32')](_0x9c04a3[_0xec1f('0x30')],_0x9c04a3[_0xec1f('0x33')]);_0x44d4c5['attributes']=_['intersection'](_0x9c04a3[_0xec1f('0x30')],qs[_0xec1f('0x35')](_0x4467a8[_0xec1f('0x33')]['fields']));_0x44d4c5[_0xec1f('0x34')]=_0x44d4c5[_0xec1f('0x34')]['length']?_0x44d4c5[_0xec1f('0x34')]:_0x9c04a3[_0xec1f('0x30')];if(_0x4467a8['query'][_0xec1f('0x43')]){_0x44d4c5[_0xec1f('0x44')]=[{'all':!![]}];}_0x44d4c5=_[_0xec1f('0x3f')]({},_0x44d4c5,_0x4467a8[_0xec1f('0x42')]);return db[_0xec1f('0x45')][_0xec1f('0x4a')](_0x44d4c5)[_0xec1f('0x24')](handleEntityNotFound(_0x58c3b5,null))[_0xec1f('0x24')](respondWithResult(_0x58c3b5,null))['catch'](handleError(_0x58c3b5,null));};exports[_0xec1f('0x4b')]=function(_0x179671,_0x3257ef){return db['SmsQueueReport'][_0xec1f('0x4b')](_0x179671[_0xec1f('0x4c')],{})[_0xec1f('0x24')](respondWithResult(_0x3257ef,0xc9))[_0xec1f('0x48')](handleError(_0x3257ef,null));};exports['update']=function(_0x30c6d9,_0x562d8a){if(_0x30c6d9[_0xec1f('0x4c')]['id']){delete _0x30c6d9[_0xec1f('0x4c')]['id'];}return db[_0xec1f('0x45')]['find']({'where':{'id':_0x30c6d9[_0xec1f('0x4d')]['id']}})[_0xec1f('0x24')](handleEntityNotFound(_0x562d8a,null))['then'](saveUpdates(_0x30c6d9[_0xec1f('0x4c')],null))['then'](respondWithResult(_0x562d8a,null))[_0xec1f('0x48')](handleError(_0x562d8a,null));};exports['destroy']=function(_0x289f4e,_0x280640){return db[_0xec1f('0x45')][_0xec1f('0x4a')]({'where':{'id':_0x289f4e[_0xec1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x280640,null))[_0xec1f('0x24')](removeEntity(_0x280640,null))[_0xec1f('0x48')](handleError(_0x280640,null));};exports[_0xec1f('0x4e')]=function(_0x4fb6a8,_0x46bd1e){return db[_0xec1f('0x45')][_0xec1f('0x4e')]()[_0xec1f('0x24')](respondWithResult(_0x46bd1e,null))[_0xec1f('0x48')](handleError(_0x46bd1e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d7b476b..51f0b3f 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x8de8c7,_0x344a2b){var _0x2046aa=function(_0x27d755){while(--_0x27d755){_0x8de8c7['push'](_0x8de8c7['shift']());}};_0x2046aa(++_0x344a2b);}(_0x70e0,0x17b));var _0x070e=function(_0x14f3b1,_0xf8babf){_0x14f3b1=_0x14f3b1-0x0;var _0x5c660e=_0x70e0[_0x14f3b1];return _0x5c660e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 19486fb..9c356d3 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 _0x8acd=['../../config/environment','jayson/promise','http','request','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','CreateSmsQueueReport','create','body','options','raw','then','catch','UpdateSmsQueueReport','SmsQueueReport','update','attributes','debug','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x8acd,0x16e));var _0xd8ac=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x8acd[_0x3ff4a3];return _0x38676f;};'use strict';var _=require('lodash');var util=require(_0xd8ac('0x0'));var moment=require(_0xd8ac('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8ac('0x2'))['db'];var utils=require(_0xd8ac('0x3'));var logger=require(_0xd8ac('0x4'))(_0xd8ac('0x5'));var config=require(_0xd8ac('0x6'));var jayson=require(_0xd8ac('0x7'));var client=jayson['client'][_0xd8ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d0226,_0x5ccdf9,_0x4cd5a0){return new BPromise(function(_0x54de8d,_0x4d907c){return client[_0xd8ac('0x9')](_0x3d0226,_0x4cd5a0)['then'](function(_0x6f5b60){logger[_0xd8ac('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x5ccdf9,_0xd8ac('0xb'));logger['debug'](_0xd8ac('0xc'),_0x5ccdf9,'request\x20sent',JSON[_0xd8ac('0xd')](_0x6f5b60));if(_0x6f5b60[_0xd8ac('0xe')]){if(_0x6f5b60[_0xd8ac('0xe')][_0xd8ac('0xf')]===0x1f4){logger[_0xd8ac('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x5ccdf9,_0x6f5b60[_0xd8ac('0xe')][_0xd8ac('0x10')]);return _0x4d907c(_0x6f5b60[_0xd8ac('0xe')][_0xd8ac('0x10')]);}logger[_0xd8ac('0xe')](_0xd8ac('0x11'),_0x5ccdf9,_0x6f5b60[_0xd8ac('0xe')]['message']);return _0x54de8d(_0x6f5b60[_0xd8ac('0xe')][_0xd8ac('0x10')]);}else{logger['info'](_0xd8ac('0x11'),_0x5ccdf9,_0xd8ac('0xb'));_0x54de8d(_0x6f5b60[_0xd8ac('0x12')][_0xd8ac('0x10')]);}})['catch'](function(_0x611f59){logger[_0xd8ac('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x5ccdf9,_0x611f59);_0x4d907c(_0x611f59);});});}exports[_0xd8ac('0x13')]=function(_0x47c9b6){var _0x448992=this;return new Promise(function(_0x2fec0f,_0xc59788){return db['SmsQueueReport'][_0xd8ac('0x14')](_0x47c9b6[_0xd8ac('0x15')],{'raw':_0x47c9b6[_0xd8ac('0x16')]?_0x47c9b6['options'][_0xd8ac('0x17')]===undefined?!![]:![]:!![]})[_0xd8ac('0x18')](function(_0x17b049){logger[_0xd8ac('0xa')]('CreateSmsQueueReport',_0x47c9b6);logger['debug']('CreateSmsQueueReport',_0x47c9b6,JSON['stringify'](_0x17b049));_0x2fec0f(_0x17b049);})[_0xd8ac('0x19')](function(_0xff2591){logger[_0xd8ac('0xe')](_0xd8ac('0x13'),_0xff2591[_0xd8ac('0x10')],_0x47c9b6);_0xc59788(_0x448992[_0xd8ac('0xe')](0x1f4,_0xff2591[_0xd8ac('0x10')]));});});};exports[_0xd8ac('0x1a')]=function(_0x109806){var _0x11e74a=this;return new Promise(function(_0x25ceae,_0x4d09f6){return db[_0xd8ac('0x1b')][_0xd8ac('0x1c')](_0x109806[_0xd8ac('0x15')],{'raw':_0x109806[_0xd8ac('0x16')]?_0x109806[_0xd8ac('0x16')][_0xd8ac('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109806[_0xd8ac('0x16')]?_0x109806['options']['where']||null:null,'attributes':_0x109806[_0xd8ac('0x16')]?_0x109806[_0xd8ac('0x16')][_0xd8ac('0x1d')]||null:null,'limit':_0x109806['options']?_0x109806['options']['limit']||null:null})[_0xd8ac('0x18')](function(_0x5a1d8b){logger[_0xd8ac('0xa')](_0xd8ac('0x1a'),_0x109806);logger[_0xd8ac('0x1e')](_0xd8ac('0x1a'),_0x109806,JSON[_0xd8ac('0xd')](_0x5a1d8b));_0x25ceae(_0x5a1d8b);})[_0xd8ac('0x19')](function(_0x28abe6){logger[_0xd8ac('0xe')](_0xd8ac('0x1a'),_0x28abe6['message'],_0x109806);_0x4d09f6(_0x11e74a[_0xd8ac('0xe')](0x1f4,_0x28abe6[_0xd8ac('0x10')]));});});}; \ No newline at end of file +var _0x1ed8=['error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b3233,_0x40a866){var _0x16df0a=function(_0x45779a){while(--_0x45779a){_0x2b3233['push'](_0x2b3233['shift']());}};_0x16df0a(++_0x40a866);}(_0x1ed8,0x1d6));var _0x81ed=function(_0x4d7530,_0xdee31){_0x4d7530=_0x4d7530-0x0;var _0x1afc9e=_0x1ed8[_0x4d7530];return _0x1afc9e;};'use strict';var _=require('lodash');var util=require(_0x81ed('0x0'));var moment=require(_0x81ed('0x1'));var BPromise=require(_0x81ed('0x2'));var rs=require(_0x81ed('0x3'));var fs=require('fs');var Redis=require(_0x81ed('0x4'));var db=require(_0x81ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x81ed('0x6'))(_0x81ed('0x7'));var config=require(_0x81ed('0x8'));var jayson=require(_0x81ed('0x9'));var client=jayson[_0x81ed('0xa')][_0x81ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb42548,_0xa3a05d,_0x1ce72c){return new BPromise(function(_0x242001,_0x12c599){return client[_0x81ed('0xc')](_0xb42548,_0x1ce72c)[_0x81ed('0xd')](function(_0x5cf6f4){logger[_0x81ed('0xe')](_0x81ed('0xf'),_0xa3a05d,_0x81ed('0x10'));logger[_0x81ed('0x11')](_0x81ed('0x12'),_0xa3a05d,_0x81ed('0x10'),JSON[_0x81ed('0x13')](_0x5cf6f4));if(_0x5cf6f4['error']){if(_0x5cf6f4['error']['code']===0x1f4){logger[_0x81ed('0x14')](_0x81ed('0xf'),_0xa3a05d,_0x5cf6f4[_0x81ed('0x14')][_0x81ed('0x15')]);return _0x12c599(_0x5cf6f4[_0x81ed('0x14')]['message']);}logger[_0x81ed('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0xa3a05d,_0x5cf6f4[_0x81ed('0x14')][_0x81ed('0x15')]);return _0x242001(_0x5cf6f4['error'][_0x81ed('0x15')]);}else{logger[_0x81ed('0xe')](_0x81ed('0xf'),_0xa3a05d,_0x81ed('0x10'));_0x242001(_0x5cf6f4[_0x81ed('0x16')][_0x81ed('0x15')]);}})['catch'](function(_0x6179a){logger[_0x81ed('0x14')](_0x81ed('0xf'),_0xa3a05d,_0x6179a);_0x12c599(_0x6179a);});});}exports[_0x81ed('0x17')]=function(_0x1f61a5){var _0x2e0995=this;return new Promise(function(_0x2610f8,_0x42c0fd){return db[_0x81ed('0x18')][_0x81ed('0x19')](_0x1f61a5[_0x81ed('0x1a')],{'raw':_0x1f61a5[_0x81ed('0x1b')]?_0x1f61a5[_0x81ed('0x1b')][_0x81ed('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xa97c72){logger[_0x81ed('0xe')](_0x81ed('0x17'),_0x1f61a5);logger['debug'](_0x81ed('0x17'),_0x1f61a5,JSON['stringify'](_0xa97c72));_0x2610f8(_0xa97c72);})[_0x81ed('0x1d')](function(_0x29cf32){logger[_0x81ed('0x14')](_0x81ed('0x17'),_0x29cf32[_0x81ed('0x15')],_0x1f61a5);_0x42c0fd(_0x2e0995[_0x81ed('0x14')](0x1f4,_0x29cf32[_0x81ed('0x15')]));});});};exports[_0x81ed('0x1e')]=function(_0x23cc91){var _0x3f26bd=this;return new Promise(function(_0x2302d3,_0x294bef){return db[_0x81ed('0x18')][_0x81ed('0x1f')](_0x23cc91[_0x81ed('0x1a')],{'raw':_0x23cc91[_0x81ed('0x1b')]?_0x23cc91[_0x81ed('0x1b')][_0x81ed('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23cc91['options']?_0x23cc91[_0x81ed('0x1b')][_0x81ed('0x20')]||null:null,'attributes':_0x23cc91[_0x81ed('0x1b')]?_0x23cc91['options'][_0x81ed('0x21')]||null:null,'limit':_0x23cc91[_0x81ed('0x1b')]?_0x23cc91[_0x81ed('0x1b')][_0x81ed('0x22')]||null:null})['then'](function(_0xad7cd7){logger[_0x81ed('0xe')](_0x81ed('0x1e'),_0x23cc91);logger[_0x81ed('0x11')]('UpdateSmsQueueReport',_0x23cc91,JSON[_0x81ed('0x13')](_0xad7cd7));_0x2302d3(_0xad7cd7);})[_0x81ed('0x1d')](function(_0xd4ae0a){logger[_0x81ed('0x14')](_0x81ed('0x1e'),_0xd4ae0a['message'],_0x23cc91);_0x294bef(_0x3f26bd['error'](0x1f4,_0xd4ae0a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 462f583..c845d15 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 _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','describe'];(function(_0x5383cc,_0x469277){var _0x3d375b=function(_0x53cc57){while(--_0x53cc57){_0x5383cc['push'](_0x5383cc['shift']());}};_0x3d375b(++_0x469277);}(_0x5fc3,0xa8));var _0x35fc=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x5fc3[_0x41ee16];return _0x1f60de;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4f17=['put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','post','create'];(function(_0x429378,_0x2433e9){var _0x13cc16=function(_0x723b3){while(--_0x723b3){_0x429378['push'](_0x429378['shift']());}};_0x13cc16(++_0x2433e9);}(_0x4f17,0x9e));var _0x74f1=function(_0x4ee386,_0x1a9032){_0x4ee386=_0x4ee386-0x0;var _0x42450c=_0x4f17[_0x4ee386];return _0x42450c;};'use strict';var multer=require(_0x74f1('0x0'));var util=require('util');var path=require(_0x74f1('0x1'));var timeout=require(_0x74f1('0x2'));var express=require('express');var router=express[_0x74f1('0x3')]();var fs_extra=require(_0x74f1('0x4'));var auth=require(_0x74f1('0x5'));var interaction=require(_0x74f1('0x6'));var config=require(_0x74f1('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x74f1('0x8')](),controller['index']);router[_0x74f1('0x9')]('/describe',auth[_0x74f1('0x8')](),controller[_0x74f1('0xa')]);router[_0x74f1('0x9')]('/:id',auth[_0x74f1('0x8')](),controller['show']);router[_0x74f1('0xb')]('/',auth['isAuthenticated'](),controller[_0x74f1('0xc')]);router[_0x74f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x74f1('0xe')]);router[_0x74f1('0xf')](_0x74f1('0x10'),auth[_0x74f1('0x8')](),controller[_0x74f1('0x11')]);module[_0x74f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6c0de9b..2172b29 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(_0x11ae05,_0xb34f47){var _0x239c2f=function(_0xd35c61){while(--_0xd35c61){_0x11ae05['push'](_0x11ae05['shift']());}};_0x239c2f(++_0xb34f47);}(_0x008c,0x188));var _0xc008=function(_0x44ace6,_0x448496){_0x44ace6=_0x44ace6-0x0;var _0x1b5359=_0x008c[_0x44ace6];return _0x1b5359;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xa6d9a8,_0x118f4c){var _0x410c24=function(_0x466fbe){while(--_0x466fbe){_0xa6d9a8['push'](_0xa6d9a8['shift']());}};_0x410c24(++_0x118f4c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0xf3cd[_0x1a89ca];return _0x29cbb2;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index eb51fad..d3b3c0c 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 _0xbb6c=['hasOwnProperty','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','SmsTransferReport','findAll','catch','show','keys','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','query','filters','attributes','model','fields','length'];(function(_0x32cc05,_0x2c95a8){var _0x2a45b0=function(_0x1c3075){while(--_0x1c3075){_0x32cc05['push'](_0x32cc05['shift']());}};_0x2a45b0(++_0x2c95a8);}(_0xbb6c,0x17d));var _0xcbb6=function(_0x154a0a,_0x96977b){_0x154a0a=_0x154a0a-0x0;var _0x550392=_0xbb6c[_0x154a0a];return _0x550392;};'use strict';var emlformat=require(_0xcbb6('0x0'));var rimraf=require(_0xcbb6('0x1'));var zipdir=require(_0xcbb6('0x2'));var jsonpatch=require(_0xcbb6('0x3'));var rp=require(_0xcbb6('0x4'));var moment=require('moment');var BPromise=require(_0xcbb6('0x5'));var Mustache=require(_0xcbb6('0x6'));var util=require(_0xcbb6('0x7'));var path=require(_0xcbb6('0x8'));var sox=require('sox');var csv=require(_0xcbb6('0x9'));var ejs=require(_0xcbb6('0xa'));var fs=require('fs');var fs_extra=require(_0xcbb6('0xb'));var _=require('lodash');var squel=require(_0xcbb6('0xc'));var crypto=require(_0xcbb6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcbb6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcbb6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcbb6('0x10'));var as=require(_0xcbb6('0x11'));var hardwareService=require(_0xcbb6('0x12'));var logger=require('../../config/logger')(_0xcbb6('0x13'));var utils=require(_0xcbb6('0x14'));var config=require(_0xcbb6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbb6('0x16'))['db'];function respondWithStatusCode(_0x364153,_0x414126){_0x414126=_0x414126||0xcc;return function(_0x47edf0){if(_0x47edf0){return _0x364153[_0xcbb6('0x17')](_0x414126);}return _0x364153[_0xcbb6('0x18')](_0x414126)[_0xcbb6('0x19')]();};}function respondWithResult(_0x14ae3e,_0x2b4666){_0x2b4666=_0x2b4666||0xc8;return function(_0x141606){if(_0x141606){return _0x14ae3e[_0xcbb6('0x18')](_0x2b4666)['json'](_0x141606);}};}function respondWithFilteredResult(_0x5dc6aa,_0x5dc3c2){return function(_0x36a1b6){if(_0x36a1b6){var _0x5a4a98=typeof _0x5dc3c2[_0xcbb6('0x1a')]===_0xcbb6('0x1b')&&typeof _0x5dc3c2[_0xcbb6('0x1c')]==='undefined';var _0x4b83db=_0x36a1b6[_0xcbb6('0x1d')];var _0x2530b2=_0x5a4a98?0x0:_0x5dc3c2[_0xcbb6('0x1a')];var _0x26b5b6=_0x5a4a98?_0x36a1b6[_0xcbb6('0x1d')]:_0x5dc3c2[_0xcbb6('0x1a')]+_0x5dc3c2[_0xcbb6('0x1c')];var _0x213333;if(_0x26b5b6>=_0x4b83db){_0x26b5b6=_0x4b83db;_0x213333=0xc8;}else{_0x213333=0xce;}_0x5dc6aa[_0xcbb6('0x18')](_0x213333);return _0x5dc6aa[_0xcbb6('0x1e')](_0xcbb6('0x1f'),_0x2530b2+'-'+_0x26b5b6+'/'+_0x4b83db)[_0xcbb6('0x20')](_0x36a1b6);}return null;};}function patchUpdates(_0x333e48){return function(_0x48a5ed){try{jsonpatch[_0xcbb6('0x21')](_0x48a5ed,_0x333e48,!![]);}catch(_0x53ab13){return BPromise[_0xcbb6('0x22')](_0x53ab13);}return _0x48a5ed[_0xcbb6('0x23')]();};}function saveUpdates(_0x1ea7eb,_0x1dbdfc){return function(_0x13d205){if(_0x13d205){return _0x13d205[_0xcbb6('0x24')](_0x1ea7eb)[_0xcbb6('0x25')](function(_0x8599f9){return _0x8599f9;});}return null;};}function removeEntity(_0x513bfe,_0x583b82){return function(_0x3d9a1f){if(_0x3d9a1f){return _0x3d9a1f[_0xcbb6('0x26')]()[_0xcbb6('0x25')](function(){_0x513bfe[_0xcbb6('0x18')](0xcc)[_0xcbb6('0x19')]();});}};}function handleEntityNotFound(_0x27d25a,_0x395400){return function(_0x38ccaf){if(!_0x38ccaf){_0x27d25a[_0xcbb6('0x17')](0x194);}return _0x38ccaf;};}function handleError(_0x1282fd,_0x94ab0d){_0x94ab0d=_0x94ab0d||0x1f4;return function(_0x2c86c6){logger['error'](_0x2c86c6['stack']);if(_0x2c86c6['name']){delete _0x2c86c6[_0xcbb6('0x27')];}_0x1282fd[_0xcbb6('0x18')](_0x94ab0d)[_0xcbb6('0x28')](_0x2c86c6);};}exports[_0xcbb6('0x29')]=function(_0x376f1f,_0x3f048a){var _0x1c87be={},_0x4fec99={},_0x45dca5={'count':0x0,'rows':[]};var _0x36cc04=_[_0xcbb6('0x2a')](db['SmsTransferReport'][_0xcbb6('0x2b')],function(_0x2dc487){return{'name':_0x2dc487[_0xcbb6('0x2c')],'type':_0x2dc487['type']['key']};});_0x4fec99['model']=_[_0xcbb6('0x2a')](_0x36cc04,'name');_0x4fec99[_0xcbb6('0x2d')]=_['keys'](_0x376f1f[_0xcbb6('0x2d')]);_0x4fec99[_0xcbb6('0x2e')]=_['intersection'](_0x4fec99['model'],_0x4fec99['query']);_0x1c87be[_0xcbb6('0x2f')]=_['intersection'](_0x4fec99[_0xcbb6('0x30')],qs[_0xcbb6('0x31')](_0x376f1f['query']['fields']));_0x1c87be['attributes']=_0x1c87be['attributes'][_0xcbb6('0x32')]?_0x1c87be['attributes']:_0x4fec99[_0xcbb6('0x30')];if(!_0x376f1f[_0xcbb6('0x2d')][_0xcbb6('0x33')]('nolimit')){_0x1c87be[_0xcbb6('0x1c')]=qs[_0xcbb6('0x1c')](_0x376f1f[_0xcbb6('0x2d')]['limit']);_0x1c87be[_0xcbb6('0x1a')]=qs[_0xcbb6('0x1a')](_0x376f1f[_0xcbb6('0x2d')][_0xcbb6('0x1a')]);}_0x1c87be[_0xcbb6('0x34')]=qs[_0xcbb6('0x35')](_0x376f1f['query'][_0xcbb6('0x35')]);_0x1c87be[_0xcbb6('0x36')]=qs['filters'](_['pick'](_0x376f1f[_0xcbb6('0x2d')],_0x4fec99[_0xcbb6('0x2e')]),_0x36cc04);if(_0x376f1f[_0xcbb6('0x2d')]['filter']){_0x1c87be[_0xcbb6('0x36')]=_['merge'](_0x1c87be[_0xcbb6('0x36')],{'$or':_['map'](_0x36cc04,function(_0xd77529){if(_0xd77529[_0xcbb6('0x37')]!==_0xcbb6('0x38')){var _0x250922={};_0x250922[_0xd77529['name']]={'$like':'%'+_0x376f1f[_0xcbb6('0x2d')][_0xcbb6('0x39')]+'%'};return _0x250922;}})});}_0x1c87be=_[_0xcbb6('0x3a')]({},_0x1c87be,_0x376f1f[_0xcbb6('0x3b')]);var _0xd24d8c={'where':_0x1c87be[_0xcbb6('0x36')]};return db['SmsTransferReport']['count'](_0xd24d8c)[_0xcbb6('0x25')](function(_0x3ac4d8){_0x45dca5[_0xcbb6('0x1d')]=_0x3ac4d8;if(_0x376f1f['query'][_0xcbb6('0x3c')]){_0x1c87be[_0xcbb6('0x3d')]=[{'all':!![]}];}return db[_0xcbb6('0x3e')][_0xcbb6('0x3f')](_0x1c87be);})[_0xcbb6('0x25')](function(_0x348f35){_0x45dca5['rows']=_0x348f35;return _0x45dca5;})[_0xcbb6('0x25')](respondWithFilteredResult(_0x3f048a,_0x1c87be))[_0xcbb6('0x40')](handleError(_0x3f048a,null));};exports[_0xcbb6('0x41')]=function(_0x1f74c2,_0x20decb){var _0x57a73b={'raw':!![],'where':{'id':_0x1f74c2['params']['id']}},_0x539fce={};_0x539fce[_0xcbb6('0x30')]=_[_0xcbb6('0x42')](db['SmsTransferReport'][_0xcbb6('0x2b')]);_0x539fce[_0xcbb6('0x2d')]=_[_0xcbb6('0x42')](_0x1f74c2[_0xcbb6('0x2d')]);_0x539fce[_0xcbb6('0x2e')]=_[_0xcbb6('0x43')](_0x539fce[_0xcbb6('0x30')],_0x539fce[_0xcbb6('0x2d')]);_0x57a73b['attributes']=_[_0xcbb6('0x43')](_0x539fce[_0xcbb6('0x30')],qs[_0xcbb6('0x31')](_0x1f74c2['query'][_0xcbb6('0x31')]));_0x57a73b[_0xcbb6('0x2f')]=_0x57a73b[_0xcbb6('0x2f')][_0xcbb6('0x32')]?_0x57a73b[_0xcbb6('0x2f')]:_0x539fce[_0xcbb6('0x30')];if(_0x1f74c2[_0xcbb6('0x2d')]['includeAll']){_0x57a73b[_0xcbb6('0x3d')]=[{'all':!![]}];}_0x57a73b=_['merge']({},_0x57a73b,_0x1f74c2[_0xcbb6('0x3b')]);return db[_0xcbb6('0x3e')][_0xcbb6('0x44')](_0x57a73b)[_0xcbb6('0x25')](handleEntityNotFound(_0x20decb,null))[_0xcbb6('0x25')](respondWithResult(_0x20decb,null))['catch'](handleError(_0x20decb,null));};exports[_0xcbb6('0x45')]=function(_0x4277d5,_0xb8de23){return db['SmsTransferReport'][_0xcbb6('0x45')](_0x4277d5[_0xcbb6('0x46')],{})[_0xcbb6('0x25')](respondWithResult(_0xb8de23,0xc9))['catch'](handleError(_0xb8de23,null));};exports[_0xcbb6('0x24')]=function(_0x29f856,_0x44e5c9){if(_0x29f856[_0xcbb6('0x46')]['id']){delete _0x29f856[_0xcbb6('0x46')]['id'];}return db['SmsTransferReport'][_0xcbb6('0x44')]({'where':{'id':_0x29f856['params']['id']}})[_0xcbb6('0x25')](handleEntityNotFound(_0x44e5c9,null))[_0xcbb6('0x25')](saveUpdates(_0x29f856[_0xcbb6('0x46')],null))[_0xcbb6('0x25')](respondWithResult(_0x44e5c9,null))[_0xcbb6('0x40')](handleError(_0x44e5c9,null));};exports['destroy']=function(_0x1984ab,_0x1c9880){return db['SmsTransferReport']['find']({'where':{'id':_0x1984ab['params']['id']}})[_0xcbb6('0x25')](handleEntityNotFound(_0x1c9880,null))[_0xcbb6('0x25')](removeEntity(_0x1c9880,null))['catch'](handleError(_0x1c9880,null));};exports[_0xcbb6('0x47')]=function(_0x4e75bd,_0x33983f){return db[_0xcbb6('0x3e')][_0xcbb6('0x47')]()['then'](respondWithResult(_0x33983f,null))[_0xcbb6('0x40')](handleError(_0x33983f,null));}; \ No newline at end of file +var _0x544a=['count','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','include','find','create','body','update','params','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544a,0x15b));var _0xa544=function(_0x589510,_0x13e0e5){_0x589510=_0x589510-0x0;var _0x38339d=_0x544a[_0x589510];return _0x38339d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa544('0x0'));var zipdir=require(_0xa544('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa544('0x2'));var moment=require(_0xa544('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa544('0x4'));var util=require(_0xa544('0x5'));var path=require(_0xa544('0x6'));var sox=require(_0xa544('0x7'));var csv=require(_0xa544('0x8'));var ejs=require(_0xa544('0x9'));var fs=require('fs');var fs_extra=require(_0xa544('0xa'));var _=require(_0xa544('0xb'));var squel=require(_0xa544('0xc'));var crypto=require(_0xa544('0xd'));var jsforce=require(_0xa544('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa544('0x8'));var querystring=require(_0xa544('0xf'));var Papa=require(_0xa544('0x10'));var Redis=require(_0xa544('0x11'));var authService=require(_0xa544('0x12'));var qs=require(_0xa544('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa544('0x14'));var logger=require(_0xa544('0x15'))(_0xa544('0x16'));var utils=require(_0xa544('0x17'));var config=require(_0xa544('0x18'));var licenseUtil=require(_0xa544('0x19'));var db=require(_0xa544('0x1a'))['db'];function respondWithStatusCode(_0x29e8f7,_0x4b4df0){_0x4b4df0=_0x4b4df0||0xcc;return function(_0x571ea0){if(_0x571ea0){return _0x29e8f7['sendStatus'](_0x4b4df0);}return _0x29e8f7[_0xa544('0x1b')](_0x4b4df0)[_0xa544('0x1c')]();};}function respondWithResult(_0x230283,_0x276bd6){_0x276bd6=_0x276bd6||0xc8;return function(_0x2c78dc){if(_0x2c78dc){return _0x230283[_0xa544('0x1b')](_0x276bd6)[_0xa544('0x1d')](_0x2c78dc);}};}function respondWithFilteredResult(_0x35b0c2,_0x281cdd){return function(_0x13614a){if(_0x13614a){var _0x4a2257=typeof _0x281cdd[_0xa544('0x1e')]===_0xa544('0x1f')&&typeof _0x281cdd[_0xa544('0x20')]==='undefined';var _0x4ad1a5=_0x13614a[_0xa544('0x21')];var _0x240394=_0x4a2257?0x0:_0x281cdd[_0xa544('0x1e')];var _0x5a4ea7=_0x4a2257?_0x13614a['count']:_0x281cdd['offset']+_0x281cdd[_0xa544('0x20')];var _0x506190;if(_0x5a4ea7>=_0x4ad1a5){_0x5a4ea7=_0x4ad1a5;_0x506190=0xc8;}else{_0x506190=0xce;}_0x35b0c2[_0xa544('0x1b')](_0x506190);return _0x35b0c2['set']('Content-Range',_0x240394+'-'+_0x5a4ea7+'/'+_0x4ad1a5)['json'](_0x13614a);}return null;};}function patchUpdates(_0x212d07){return function(_0xa99b0d){try{jsonpatch[_0xa544('0x22')](_0xa99b0d,_0x212d07,!![]);}catch(_0x584f7b){return BPromise[_0xa544('0x23')](_0x584f7b);}return _0xa99b0d['save']();};}function saveUpdates(_0x228596,_0x233297){return function(_0x4ed838){if(_0x4ed838){return _0x4ed838['update'](_0x228596)[_0xa544('0x24')](function(_0x492f78){return _0x492f78;});}return null;};}function removeEntity(_0x41f464,_0x3be184){return function(_0x1be567){if(_0x1be567){return _0x1be567[_0xa544('0x25')]()[_0xa544('0x24')](function(){_0x41f464['status'](0xcc)[_0xa544('0x1c')]();});}};}function handleEntityNotFound(_0x357abe,_0x1ca6a0){return function(_0xf73214){if(!_0xf73214){_0x357abe[_0xa544('0x26')](0x194);}return _0xf73214;};}function handleError(_0x2aabf5,_0x178c5a){_0x178c5a=_0x178c5a||0x1f4;return function(_0x4f99db){logger[_0xa544('0x27')](_0x4f99db[_0xa544('0x28')]);if(_0x4f99db[_0xa544('0x29')]){delete _0x4f99db['name'];}_0x2aabf5[_0xa544('0x1b')](_0x178c5a)[_0xa544('0x2a')](_0x4f99db);};}exports[_0xa544('0x2b')]=function(_0x1ead48,_0x42dde9){var _0x15cb3d={},_0x4288cd={},_0x229b96={'count':0x0,'rows':[]};var _0x57fa95=_[_0xa544('0x2c')](db[_0xa544('0x2d')][_0xa544('0x2e')],function(_0x282eaf){return{'name':_0x282eaf[_0xa544('0x2f')],'type':_0x282eaf[_0xa544('0x30')]['key']};});_0x4288cd['model']=_[_0xa544('0x2c')](_0x57fa95,_0xa544('0x29'));_0x4288cd[_0xa544('0x31')]=_[_0xa544('0x32')](_0x1ead48[_0xa544('0x31')]);_0x4288cd[_0xa544('0x33')]=_[_0xa544('0x34')](_0x4288cd[_0xa544('0x35')],_0x4288cd['query']);_0x15cb3d[_0xa544('0x36')]=_['intersection'](_0x4288cd[_0xa544('0x35')],qs['fields'](_0x1ead48['query'][_0xa544('0x37')]));_0x15cb3d[_0xa544('0x36')]=_0x15cb3d[_0xa544('0x36')][_0xa544('0x38')]?_0x15cb3d[_0xa544('0x36')]:_0x4288cd['model'];if(!_0x1ead48[_0xa544('0x31')]['hasOwnProperty'](_0xa544('0x39'))){_0x15cb3d[_0xa544('0x20')]=qs[_0xa544('0x20')](_0x1ead48['query'][_0xa544('0x20')]);_0x15cb3d[_0xa544('0x1e')]=qs[_0xa544('0x1e')](_0x1ead48[_0xa544('0x31')][_0xa544('0x1e')]);}_0x15cb3d[_0xa544('0x3a')]=qs[_0xa544('0x3b')](_0x1ead48[_0xa544('0x31')][_0xa544('0x3b')]);_0x15cb3d['where']=qs[_0xa544('0x33')](_[_0xa544('0x3c')](_0x1ead48[_0xa544('0x31')],_0x4288cd[_0xa544('0x33')]),_0x57fa95);if(_0x1ead48[_0xa544('0x31')][_0xa544('0x3d')]){_0x15cb3d[_0xa544('0x3e')]=_[_0xa544('0x3f')](_0x15cb3d[_0xa544('0x3e')],{'$or':_[_0xa544('0x2c')](_0x57fa95,function(_0x3641c7){if(_0x3641c7[_0xa544('0x30')]!=='VIRTUAL'){var _0x5e864e={};_0x5e864e[_0x3641c7[_0xa544('0x29')]]={'$like':'%'+_0x1ead48[_0xa544('0x31')][_0xa544('0x3d')]+'%'};return _0x5e864e;}})});}_0x15cb3d=_[_0xa544('0x3f')]({},_0x15cb3d,_0x1ead48[_0xa544('0x40')]);var _0x284162={'where':_0x15cb3d[_0xa544('0x3e')]};return db[_0xa544('0x2d')]['count'](_0x284162)['then'](function(_0x3a39b0){_0x229b96[_0xa544('0x21')]=_0x3a39b0;if(_0x1ead48['query'][_0xa544('0x41')]){_0x15cb3d['include']=[{'all':!![]}];}return db[_0xa544('0x2d')][_0xa544('0x42')](_0x15cb3d);})[_0xa544('0x24')](function(_0x4d860e){_0x229b96[_0xa544('0x43')]=_0x4d860e;return _0x229b96;})[_0xa544('0x24')](respondWithFilteredResult(_0x42dde9,_0x15cb3d))[_0xa544('0x44')](handleError(_0x42dde9,null));};exports['show']=function(_0x57b4f1,_0x587e9f){var _0x3d0432={'raw':!![],'where':{'id':_0x57b4f1['params']['id']}},_0x630c44={};_0x630c44[_0xa544('0x35')]=_['keys'](db[_0xa544('0x2d')][_0xa544('0x2e')]);_0x630c44[_0xa544('0x31')]=_[_0xa544('0x32')](_0x57b4f1[_0xa544('0x31')]);_0x630c44[_0xa544('0x33')]=_[_0xa544('0x34')](_0x630c44['model'],_0x630c44['query']);_0x3d0432[_0xa544('0x36')]=_[_0xa544('0x34')](_0x630c44['model'],qs[_0xa544('0x37')](_0x57b4f1['query'][_0xa544('0x37')]));_0x3d0432['attributes']=_0x3d0432[_0xa544('0x36')][_0xa544('0x38')]?_0x3d0432['attributes']:_0x630c44['model'];if(_0x57b4f1[_0xa544('0x31')]['includeAll']){_0x3d0432[_0xa544('0x45')]=[{'all':!![]}];}_0x3d0432=_[_0xa544('0x3f')]({},_0x3d0432,_0x57b4f1[_0xa544('0x40')]);return db[_0xa544('0x2d')][_0xa544('0x46')](_0x3d0432)[_0xa544('0x24')](handleEntityNotFound(_0x587e9f,null))[_0xa544('0x24')](respondWithResult(_0x587e9f,null))['catch'](handleError(_0x587e9f,null));};exports[_0xa544('0x47')]=function(_0x593abd,_0x501315){return db[_0xa544('0x2d')][_0xa544('0x47')](_0x593abd[_0xa544('0x48')],{})['then'](respondWithResult(_0x501315,0xc9))[_0xa544('0x44')](handleError(_0x501315,null));};exports[_0xa544('0x49')]=function(_0x3133d5,_0x307fa9){if(_0x3133d5[_0xa544('0x48')]['id']){delete _0x3133d5[_0xa544('0x48')]['id'];}return db[_0xa544('0x2d')][_0xa544('0x46')]({'where':{'id':_0x3133d5[_0xa544('0x4a')]['id']}})[_0xa544('0x24')](handleEntityNotFound(_0x307fa9,null))[_0xa544('0x24')](saveUpdates(_0x3133d5[_0xa544('0x48')],null))[_0xa544('0x24')](respondWithResult(_0x307fa9,null))['catch'](handleError(_0x307fa9,null));};exports[_0xa544('0x25')]=function(_0x1126d4,_0x515f9c){return db[_0xa544('0x2d')][_0xa544('0x46')]({'where':{'id':_0x1126d4[_0xa544('0x4a')]['id']}})[_0xa544('0x24')](handleEntityNotFound(_0x515f9c,null))[_0xa544('0x24')](removeEntity(_0x515f9c,null))[_0xa544('0x44')](handleError(_0x515f9c,null));};exports[_0xa544('0x4b')]=function(_0xfb9b4f,_0x2e4dff){return db[_0xa544('0x2d')]['describe']()[_0xa544('0x24')](respondWithResult(_0x2e4dff,null))['catch'](handleError(_0x2e4dff,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index bdb87b2..6973824 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 _0x209f=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer'];(function(_0x5aa129,_0x12f873){var _0x72a385=function(_0x1bc9d4){while(--_0x1bc9d4){_0x5aa129['push'](_0x5aa129['shift']());}};_0x72a385(++_0x12f873);}(_0x209f,0x199));var _0xf209=function(_0x4328eb,_0x4a9f29){_0x4328eb=_0x4328eb-0x0;var _0x475aa9=_0x209f[_0x4328eb];return _0x475aa9;};'use strict';var _=require(_0xf209('0x0'));var util=require('util');var logger=require(_0xf209('0x1'))(_0xf209('0x2'));var moment=require('moment');var BPromise=require(_0xf209('0x3'));var rp=require(_0xf209('0x4'));var fs=require('fs');var path=require(_0xf209('0x5'));var rimraf=require('rimraf');var config=require(_0xf209('0x6'));var attributes=require(_0xf209('0x7'));module[_0xf209('0x8')]=function(_0x24b4e2,_0x46c481){return _0x24b4e2['define'](_0xf209('0x9'),attributes,{'tableName':_0xf209('0xa'),'paranoid':![],'indexes':[{'name':_0xf209('0xb'),'fields':[_0xf209('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46df=['lodash','api','moment','bluebird','rimraf','define','report_sms_transfer','uniqueid'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0x46df,0x1e0));var _0xf46d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x46df[_0x432682];return _0x463d05;};'use strict';var _=require(_0xf46d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf46d('0x1'));var moment=require(_0xf46d('0x2'));var BPromise=require(_0xf46d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf46d('0x4'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x53f537,_0x579510){return _0x53f537[_0xf46d('0x5')]('SmsTransferReport',attributes,{'tableName':_0xf46d('0x6'),'paranoid':![],'indexes':[{'name':_0xf46d('0x7'),'fields':[_0xf46d('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6a70257..bd1461a 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 _0xab29=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x418b73,_0x56c3b3){var _0xbafcc0=function(_0x44cc54){while(--_0x44cc54){_0x418b73['push'](_0x418b73['shift']());}};_0xbafcc0(++_0x56c3b3);}(_0xab29,0x145));var _0x9ab2=function(_0x5dae66,_0x1c27b4){_0x5dae66=_0x5dae66-0x0;var _0x26a36c=_0xab29[_0x5dae66];return _0x26a36c;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ab2('0x5'));var logger=require(_0x9ab2('0x6'))(_0x9ab2('0x7'));var config=require(_0x9ab2('0x8'));var jayson=require(_0x9ab2('0x9'));var client=jayson['client'][_0x9ab2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3739c8,_0x42d544,_0x3c73e5){return new BPromise(function(_0x3a3553,_0x564109){return client[_0x9ab2('0xb')](_0x3739c8,_0x3c73e5)[_0x9ab2('0xc')](function(_0x398547){logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));logger[_0x9ab2('0x10')](_0x9ab2('0x11'),_0x42d544,_0x9ab2('0xf'),JSON['stringify'](_0x398547));if(_0x398547[_0x9ab2('0x12')]){if(_0x398547[_0x9ab2('0x12')]['code']===0x1f4){logger['error'](_0x9ab2('0xe'),_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x564109(_0x398547['error'][_0x9ab2('0x13')]);}logger[_0x9ab2('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x3a3553(_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);}else{logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));_0x3a3553(_0x398547[_0x9ab2('0x14')]['message']);}})[_0x9ab2('0x15')](function(_0x273e07){logger[_0x9ab2('0x12')](_0x9ab2('0xe'),_0x42d544,_0x273e07);_0x564109(_0x273e07);});});} \ No newline at end of file +var _0x0fc8=['catch','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result'];(function(_0xdf8663,_0x4d0715){var _0x2ebaeb=function(_0x5d24c6){while(--_0x5d24c6){_0xdf8663['push'](_0xdf8663['shift']());}};_0x2ebaeb(++_0x4d0715);}(_0x0fc8,0x145));var _0x80fc=function(_0x5cf736,_0x73de61){_0x5cf736=_0x5cf736-0x0;var _0x42067e=_0x0fc8[_0x5cf736];return _0x42067e;};'use strict';var _=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80fc('0x2'));var db=require(_0x80fc('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80fc('0x4'));var config=require('../../config/environment');var jayson=require(_0x80fc('0x5'));var client=jayson[_0x80fc('0x6')][_0x80fc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x116a2e,_0x1f64ab,_0x5cb645){return new BPromise(function(_0x14a3c4,_0x36e45f){return client['request'](_0x116a2e,_0x5cb645)[_0x80fc('0x8')](function(_0x43eb28){logger[_0x80fc('0x9')]('SmsTransferReport,\x20%s,\x20%s',_0x1f64ab,_0x80fc('0xa'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1f64ab,_0x80fc('0xa'),JSON[_0x80fc('0xb')](_0x43eb28));if(_0x43eb28[_0x80fc('0xc')]){if(_0x43eb28[_0x80fc('0xc')][_0x80fc('0xd')]===0x1f4){logger[_0x80fc('0xc')](_0x80fc('0xe'),_0x1f64ab,_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);return _0x36e45f(_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);}logger[_0x80fc('0xc')](_0x80fc('0xe'),_0x1f64ab,_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);return _0x14a3c4(_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);}else{logger['info'](_0x80fc('0xe'),_0x1f64ab,'request\x20sent');_0x14a3c4(_0x43eb28[_0x80fc('0x10')][_0x80fc('0xf')]);}})[_0x80fc('0x11')](function(_0x5d105c){logger[_0x80fc('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x1f64ab,_0x5d105c);_0x36e45f(_0x5d105c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b2cb6ae..b89d77e 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 _0xc7dd=['basename','extname','post','single','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format'];(function(_0x3f61c8,_0x2efc30){var _0x585252=function(_0x446021){while(--_0x446021){_0x3f61c8['push'](_0x3f61c8['shift']());}};_0x585252(++_0x2efc30);}(_0xc7dd,0x7c));var _0xdc7d=function(_0x108db1,_0x89896d){_0x108db1=_0x108db1-0x0;var _0x16848d=_0xc7dd[_0x108db1];return _0x16848d;};'use strict';var multer=require(_0xdc7d('0x0'));var util=require(_0xdc7d('0x1'));var path=require(_0xdc7d('0x2'));var timeout=require(_0xdc7d('0x3'));var express=require('express');var router=express[_0xdc7d('0x4')]();var fs_extra=require(_0xdc7d('0x5'));var auth=require(_0xdc7d('0x6'));var interaction=require(_0xdc7d('0x7'));var config=require(_0xdc7d('0x8'));var controller=require(_0xdc7d('0x9'));router[_0xdc7d('0xa')]('/',auth[_0xdc7d('0xb')](),controller[_0xdc7d('0xc')]);router[_0xdc7d('0xa')]('/:id',auth[_0xdc7d('0xb')](),controller[_0xdc7d('0xd')]);router[_0xdc7d('0xa')]('/:id/download',auth[_0xdc7d('0xb')](),controller['download']);var upload=multer({'storage':multer[_0xdc7d('0xe')]({'destination':function(_0x330aa7,_0x316292,_0x1646c9){_0x1646c9(null,path[_0xdc7d('0xf')](config[_0xdc7d('0x10')],_0xdc7d('0x11')));},'filename':function(_0xd15631,_0x40af19,_0x35c75a){_0x40af19[_0xdc7d('0x12')]=_0x40af19['originalname'][_0xdc7d('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x35c75a(null,util[_0xdc7d('0x14')]('%s-%s%s',path[_0xdc7d('0x15')](_0x40af19[_0xdc7d('0x12')],path[_0xdc7d('0x16')](_0x40af19['originalname'])),Date['now'](),path['extname'](_0x40af19['originalname'])));}})});router[_0xdc7d('0x17')]('/',upload[_0xdc7d('0x18')]('file'),controller['create']);router['put'](_0xdc7d('0x19'),auth[_0xdc7d('0xb')](),controller[_0xdc7d('0x1a')]);router['delete'](_0xdc7d('0x19'),auth[_0xdc7d('0xb')](),controller[_0xdc7d('0x1b')]);module[_0xdc7d('0x1c')]=router; \ No newline at end of file +var _0x9466=['index','/:id/download','download','diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','post','single','file','put','/:id','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated'];(function(_0x877f61,_0x5882fc){var _0x333e34=function(_0x20641c){while(--_0x20641c){_0x877f61['push'](_0x877f61['shift']());}};_0x333e34(++_0x5882fc);}(_0x9466,0x199));var _0x6946=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9466[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0x6946('0x0'));var util=require(_0x6946('0x1'));var path=require('path');var timeout=require(_0x6946('0x2'));var express=require(_0x6946('0x3'));var router=express['Router']();var fs_extra=require(_0x6946('0x4'));var auth=require(_0x6946('0x5'));var interaction=require(_0x6946('0x6'));var config=require(_0x6946('0x7'));var controller=require(_0x6946('0x8'));router[_0x6946('0x9')]('/',auth[_0x6946('0xa')](),controller[_0x6946('0xb')]);router[_0x6946('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6946('0x9')](_0x6946('0xc'),auth[_0x6946('0xa')](),controller[_0x6946('0xd')]);var upload=multer({'storage':multer[_0x6946('0xe')]({'destination':function(_0x292e2f,_0x3da11a,_0x1f4f9b){_0x1f4f9b(null,path[_0x6946('0xf')](config[_0x6946('0x10')],'server/files/sounds/original/'));},'filename':function(_0x41b427,_0x3bfcac,_0x1a4229){_0x3bfcac[_0x6946('0x11')]=_0x3bfcac['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a4229(null,util[_0x6946('0x12')](_0x6946('0x13'),path[_0x6946('0x14')](_0x3bfcac[_0x6946('0x11')],path['extname'](_0x3bfcac['originalname'])),Date['now'](),path[_0x6946('0x15')](_0x3bfcac['originalname'])));}})});router[_0x6946('0x16')]('/',upload[_0x6946('0x17')](_0x6946('0x18')),controller['create']);router[_0x6946('0x19')](_0x6946('0x1a'),auth[_0x6946('0xa')](),controller['update']);router[_0x6946('0x1b')]('/:id',auth[_0x6946('0xa')](),controller[_0x6946('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 86dc434..9f74afd 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 _0xc7dd=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0xf74631,_0x4df45e){var _0x52d1bc=function(_0xad4e03){while(--_0xad4e03){_0xf74631['push'](_0xf74631['shift']());}};_0x52d1bc(++_0x4df45e);}(_0xc7dd,0x1e6));var _0xdc7d=function(_0x279841,_0x4e9e3b){_0x279841=_0x279841-0x0;var _0x4d3a9f=_0xc7dd[_0x279841];return _0x4d3a9f;};'use strict';var Sequelize=require(_0xdc7d('0x0'));module[_0xdc7d('0x1')]={'name':{'type':Sequelize[_0xdc7d('0x2')],'unique':_0xdc7d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xdc7d('0x2')]},'display_name':{'type':Sequelize[_0xdc7d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xdc7d('0x2')]},'original_format':{'type':Sequelize[_0xdc7d('0x2')]},'original_duration':{'type':Sequelize[_0xdc7d('0x4')]},'original_sampleCount':{'type':Sequelize[_0xdc7d('0x5')]},'original_channelCount':{'type':Sequelize[_0xdc7d('0x6')]},'original_bitRate':{'type':Sequelize[_0xdc7d('0x5')]},'original_sampleRate':{'type':Sequelize[_0xdc7d('0x6')]},'converted_format':{'type':Sequelize[_0xdc7d('0x2')]},'converted_duration':{'type':Sequelize[_0xdc7d('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xdc7d('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xdc7d('0x6')]}}; \ No newline at end of file +var _0x8431=['STRING','INTEGER','BIGINT','exports'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0x8431,0x1ef));var _0x1843=function(_0x541bf7,_0x2008b4){_0x541bf7=_0x541bf7-0x0;var _0x3f8d3d=_0x8431[_0x541bf7];return _0x3f8d3d;};'use strict';var Sequelize=require('sequelize');module[_0x1843('0x0')]={'name':{'type':Sequelize[_0x1843('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1843('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1843('0x1')]},'original_format':{'type':Sequelize[_0x1843('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x1843('0x2')]},'original_bitRate':{'type':Sequelize[_0x1843('0x3')]},'original_sampleRate':{'type':Sequelize[_0x1843('0x2')]},'converted_format':{'type':Sequelize[_0x1843('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x1843('0x3')]},'converted_channelCount':{'type':Sequelize[_0x1843('0x2')]},'converted_bitRate':{'type':Sequelize[_0x1843('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x1843('0x2')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 41cf58f..aabeb99 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 _0xecad=['index','Sound','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','download','format','save_name','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','error','start','description','delete','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','update','then','destroy','Sounds','UserProfileResource','stack','name','send'];(function(_0x51e516,_0x5a0fc0){var _0xa0e42=function(_0x55f619){while(--_0x55f619){_0x51e516['push'](_0x51e516['shift']());}};_0xa0e42(++_0x5a0fc0);}(_0xecad,0x1d7));var _0xdeca=function(_0x28b930,_0x19b05f){_0x28b930=_0x28b930-0x0;var _0x112256=_0xecad[_0x28b930];return _0x112256;};'use strict';var emlformat=require(_0xdeca('0x0'));var rimraf=require(_0xdeca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdeca('0x2'));var rp=require(_0xdeca('0x3'));var moment=require(_0xdeca('0x4'));var BPromise=require(_0xdeca('0x5'));var Mustache=require(_0xdeca('0x6'));var util=require(_0xdeca('0x7'));var path=require(_0xdeca('0x8'));var sox=require(_0xdeca('0x9'));var csv=require(_0xdeca('0xa'));var ejs=require(_0xdeca('0xb'));var fs=require('fs');var fs_extra=require(_0xdeca('0xc'));var _=require(_0xdeca('0xd'));var squel=require(_0xdeca('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdeca('0xf'));var toCsv=require(_0xdeca('0xa'));var querystring=require(_0xdeca('0x10'));var Papa=require(_0xdeca('0x11'));var Redis=require(_0xdeca('0x12'));var authService=require(_0xdeca('0x13'));var qs=require(_0xdeca('0x14'));var as=require(_0xdeca('0x15'));var hardwareService=require(_0xdeca('0x16'));var logger=require('../../config/logger')(_0xdeca('0x17'));var utils=require(_0xdeca('0x18'));var config=require(_0xdeca('0x19'));var licenseUtil=require(_0xdeca('0x1a'));var db=require(_0xdeca('0x1b'))['db'];function respondWithStatusCode(_0x4c88fe,_0x38ef01){_0x38ef01=_0x38ef01||0xcc;return function(_0x3c9a70){if(_0x3c9a70){return _0x4c88fe[_0xdeca('0x1c')](_0x38ef01);}return _0x4c88fe[_0xdeca('0x1d')](_0x38ef01)[_0xdeca('0x1e')]();};}function respondWithResult(_0x20bc47,_0x38a9eb){_0x38a9eb=_0x38a9eb||0xc8;return function(_0x4c94b2){if(_0x4c94b2){return _0x20bc47[_0xdeca('0x1d')](_0x38a9eb)[_0xdeca('0x1f')](_0x4c94b2);}};}function respondWithFilteredResult(_0x14a1cf,_0x2cea37){return function(_0x2c86b8){if(_0x2c86b8){var _0x1da331=typeof _0x2cea37[_0xdeca('0x20')]===_0xdeca('0x21')&&typeof _0x2cea37['limit']===_0xdeca('0x21');var _0x473a0b=_0x2c86b8[_0xdeca('0x22')];var _0x258285=_0x1da331?0x0:_0x2cea37['offset'];var _0x49be8a=_0x1da331?_0x2c86b8[_0xdeca('0x22')]:_0x2cea37[_0xdeca('0x20')]+_0x2cea37['limit'];var _0x255b43;if(_0x49be8a>=_0x473a0b){_0x49be8a=_0x473a0b;_0x255b43=0xc8;}else{_0x255b43=0xce;}_0x14a1cf[_0xdeca('0x1d')](_0x255b43);return _0x14a1cf['set'](_0xdeca('0x23'),_0x258285+'-'+_0x49be8a+'/'+_0x473a0b)[_0xdeca('0x1f')](_0x2c86b8);}return null;};}function patchUpdates(_0x21c95f){return function(_0x2b9409){try{jsonpatch['apply'](_0x2b9409,_0x21c95f,!![]);}catch(_0x57c5c3){return BPromise[_0xdeca('0x24')](_0x57c5c3);}return _0x2b9409['save']();};}function saveUpdates(_0x5c07ed,_0x296398){return function(_0x32d8b6){if(_0x32d8b6){return _0x32d8b6[_0xdeca('0x25')](_0x5c07ed)[_0xdeca('0x26')](function(_0x586cff){return _0x586cff;});}return null;};}function removeEntity(_0x2dcf45,_0x4247ac){return function(_0x5ac832){if(_0x5ac832){return _0x5ac832[_0xdeca('0x27')]()['then'](function(){var _0xbab6e6=_0x5ac832['get']({'plain':!![]});var _0x4fe497=_0xdeca('0x28');return db[_0xdeca('0x29')][_0xdeca('0x27')]({'where':{'type':_0x4fe497,'resourceId':_0xbab6e6['id']}})[_0xdeca('0x26')](function(){return _0x5ac832;});})['then'](function(){_0x2dcf45[_0xdeca('0x1d')](0xcc)[_0xdeca('0x1e')]();});}};}function handleEntityNotFound(_0x16a57f,_0x29006f){return function(_0x2b413e){if(!_0x2b413e){_0x16a57f[_0xdeca('0x1c')](0x194);}return _0x2b413e;};}function handleError(_0x22f9a8,_0x317c70){_0x317c70=_0x317c70||0x1f4;return function(_0x1915d2){logger['error'](_0x1915d2[_0xdeca('0x2a')]);if(_0x1915d2[_0xdeca('0x2b')]){delete _0x1915d2['name'];}_0x22f9a8['status'](_0x317c70)[_0xdeca('0x2c')](_0x1915d2);};}exports[_0xdeca('0x2d')]=function(_0xbfe910,_0x4dc0a6){var _0xe74bd2={},_0x370fda={},_0x26a3af={'count':0x0,'rows':[]};var _0x2d04e3=_['map'](db[_0xdeca('0x2e')]['rawAttributes'],function(_0x11ba03){return{'name':_0x11ba03[_0xdeca('0x2f')],'type':_0x11ba03['type'][_0xdeca('0x30')]};});_0x370fda[_0xdeca('0x31')]=_['map'](_0x2d04e3,_0xdeca('0x2b'));_0x370fda[_0xdeca('0x32')]=_[_0xdeca('0x33')](_0xbfe910[_0xdeca('0x32')]);_0x370fda[_0xdeca('0x34')]=_[_0xdeca('0x35')](_0x370fda[_0xdeca('0x31')],_0x370fda[_0xdeca('0x32')]);_0xe74bd2[_0xdeca('0x36')]=_[_0xdeca('0x35')](_0x370fda[_0xdeca('0x31')],qs[_0xdeca('0x37')](_0xbfe910['query'][_0xdeca('0x37')]));_0xe74bd2[_0xdeca('0x36')]=_0xe74bd2['attributes'][_0xdeca('0x38')]?_0xe74bd2[_0xdeca('0x36')]:_0x370fda[_0xdeca('0x31')];if(!_0xbfe910[_0xdeca('0x32')][_0xdeca('0x39')](_0xdeca('0x3a'))){_0xe74bd2[_0xdeca('0x3b')]=qs[_0xdeca('0x3b')](_0xbfe910[_0xdeca('0x32')][_0xdeca('0x3b')]);_0xe74bd2['offset']=qs[_0xdeca('0x20')](_0xbfe910[_0xdeca('0x32')]['offset']);}_0xe74bd2[_0xdeca('0x3c')]=qs[_0xdeca('0x3d')](_0xbfe910[_0xdeca('0x32')][_0xdeca('0x3d')]);_0xe74bd2[_0xdeca('0x3e')]=qs['filters'](_[_0xdeca('0x3f')](_0xbfe910[_0xdeca('0x32')],_0x370fda['filters']),_0x2d04e3);if(_0xbfe910[_0xdeca('0x32')][_0xdeca('0x40')]){_0xe74bd2[_0xdeca('0x3e')]=_[_0xdeca('0x41')](_0xe74bd2[_0xdeca('0x3e')],{'$or':_[_0xdeca('0x42')](_0x2d04e3,function(_0x5f4516){if(_0x5f4516[_0xdeca('0x43')]!==_0xdeca('0x44')){var _0x238051={};_0x238051[_0x5f4516[_0xdeca('0x2b')]]={'$like':'%'+_0xbfe910[_0xdeca('0x32')][_0xdeca('0x40')]+'%'};return _0x238051;}})});}_0xe74bd2=_[_0xdeca('0x41')]({},_0xe74bd2,_0xbfe910['options']);var _0x2b39f7={'where':_0xe74bd2[_0xdeca('0x3e')]};return db[_0xdeca('0x2e')]['count'](_0x2b39f7)['then'](function(_0x5c9eb2){_0x26a3af['count']=_0x5c9eb2;if(_0xbfe910[_0xdeca('0x32')][_0xdeca('0x45')]){_0xe74bd2['include']=[{'all':!![]}];}return db[_0xdeca('0x2e')][_0xdeca('0x46')](_0xe74bd2);})[_0xdeca('0x26')](function(_0x4773ba){_0x26a3af['rows']=_0x4773ba;return _0x26a3af;})[_0xdeca('0x26')](respondWithFilteredResult(_0x4dc0a6,_0xe74bd2))[_0xdeca('0x47')](handleError(_0x4dc0a6,null));};exports[_0xdeca('0x48')]=function(_0x58ee25,_0x56f8a4){var _0x21600f={'raw':!![],'where':{'id':_0x58ee25[_0xdeca('0x49')]['id']}},_0x21e522={};_0x21e522[_0xdeca('0x31')]=_[_0xdeca('0x33')](db['Sound'][_0xdeca('0x4a')]);_0x21e522['query']=_[_0xdeca('0x33')](_0x58ee25['query']);_0x21e522[_0xdeca('0x34')]=_['intersection'](_0x21e522['model'],_0x21e522[_0xdeca('0x32')]);_0x21600f[_0xdeca('0x36')]=_['intersection'](_0x21e522[_0xdeca('0x31')],qs[_0xdeca('0x37')](_0x58ee25['query']['fields']));_0x21600f[_0xdeca('0x36')]=_0x21600f[_0xdeca('0x36')][_0xdeca('0x38')]?_0x21600f['attributes']:_0x21e522[_0xdeca('0x31')];if(_0x58ee25[_0xdeca('0x32')][_0xdeca('0x45')]){_0x21600f[_0xdeca('0x4b')]=[{'all':!![]}];}_0x21600f=_['merge']({},_0x21600f,_0x58ee25[_0xdeca('0x4c')]);return db[_0xdeca('0x2e')][_0xdeca('0x4d')](_0x21600f)[_0xdeca('0x26')](handleEntityNotFound(_0x56f8a4,null))[_0xdeca('0x26')](respondWithResult(_0x56f8a4,null))[_0xdeca('0x47')](handleError(_0x56f8a4,null));};exports['download']=function(_0x476f01,_0x15ab5b,_0x17d653){return db['Sound'][_0xdeca('0x4d')]({'where':{'id':_0x476f01['params']['id']},'attributes':[_0xdeca('0x2b'),'save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x15ab5b,null))[_0xdeca('0x26')](function(_0x5882ec){if(_0x5882ec){if(!fs[_0xdeca('0x4e')](path[_0xdeca('0x4f')](config[_0xdeca('0x50')],_0xdeca('0x51'),_0x5882ec['save_name']+'.'+_0x5882ec[_0xdeca('0x52')]))){throw new db['Sequelize'][(_0xdeca('0x53'))](_0xdeca('0x54'));}return _0x15ab5b[_0xdeca('0x55')](path['join'](config['root'],'server/files/sounds/converted',util[_0xdeca('0x56')]('%s.%s',_0x5882ec[_0xdeca('0x57')],_0x5882ec[_0xdeca('0x52')])),util[_0xdeca('0x56')]('%s.%s',_0x5882ec[_0xdeca('0x2b')],_0x5882ec[_0xdeca('0x52')]));}return null;})['catch'](handleError(_0x15ab5b,null));};exports[_0xdeca('0x58')]=function(_0x5abfce,_0x57a8d3,_0x5c1c4d){var _0x354291={'name':path[_0xdeca('0x59')](_0x5abfce[_0xdeca('0x5a')]['originalname'],path['extname'](_0x5abfce['file'][_0xdeca('0x5b')])),'save_name':path['basename'](_0x5abfce[_0xdeca('0x5a')][_0xdeca('0x5c')],path[_0xdeca('0x5d')](_0x5abfce[_0xdeca('0x5a')][_0xdeca('0x5c')])),'original_format':path[_0xdeca('0x5d')](_0x5abfce[_0xdeca('0x5a')][_0xdeca('0x5b')])[_0xdeca('0x5e')](0x1),'converted_format':_0xdeca('0x5f')};var _0x2d889f=path[_0xdeca('0x4f')](config[_0xdeca('0x50')],_0xdeca('0x60'),_0x5abfce[_0xdeca('0x5a')]['filename']);var _0x242033=path['join'](config[_0xdeca('0x50')],_0xdeca('0x51'),util[_0xdeca('0x56')](_0xdeca('0x61'),path['basename'](_0x5abfce[_0xdeca('0x5a')]['filename'],path[_0xdeca('0x5d')](_0x5abfce['file']['filename'])),_0x354291[_0xdeca('0x52')]));logger[_0xdeca('0x62')](_0xdeca('0x63'),_0x2d889f);logger[_0xdeca('0x62')]('Sound\x20upload\x20destination:\x20%s',_0x242033);try{fs[_0xdeca('0x64')](_0x2d889f,parseInt('0777',0x8));var _0x52b1fe=sox[_0xdeca('0x65')](_0x2d889f,_0x242033,{'sampleRate':0x1f40,'format':_0xdeca('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52b1fe['on']('error',function(_0x5cb02c){fs['unlinkSync'](_0x2d889f);_0x57a8d3[_0xdeca('0x1d')](0x1f4)[_0xdeca('0x2c')](_0x5cb02c);});_0x52b1fe['on'](_0xdeca('0x66'),function(_0x172f49){_0x354291[_0xdeca('0x67')]=isNaN(_0x172f49['duration'])?null:_0x172f49[_0xdeca('0x68')]*0x3e8;_0x354291[_0xdeca('0x69')]=isNaN(_0x172f49[_0xdeca('0x6a')])?null:_0x172f49[_0xdeca('0x6a')];_0x354291[_0xdeca('0x6b')]=isNaN(_0x172f49[_0xdeca('0x6c')])?null:_0x172f49[_0xdeca('0x6c')];_0x354291[_0xdeca('0x6d')]=isNaN(_0x172f49[_0xdeca('0x6e')])?null:_0x172f49[_0xdeca('0x6e')];_0x354291[_0xdeca('0x6f')]=isNaN(_0x172f49[_0xdeca('0x70')])?null:_0x172f49[_0xdeca('0x70')];});_0x52b1fe['on']('dest',function(_0x19040f){_0x354291[_0xdeca('0x71')]=isNaN(_0x19040f[_0xdeca('0x68')])?null:_0x19040f['duration']*0x3e8;_0x354291[_0xdeca('0x72')]=isNaN(_0x19040f[_0xdeca('0x6a')])?null:_0x19040f['sampleCount'];_0x354291['converted_channelCount']=isNaN(_0x19040f[_0xdeca('0x6c')])?null:_0x19040f[_0xdeca('0x6c')];_0x354291[_0xdeca('0x73')]=isNaN(_0x19040f[_0xdeca('0x6e')])?null:_0x19040f[_0xdeca('0x6e')];_0x354291[_0xdeca('0x74')]=isNaN(_0x19040f[_0xdeca('0x70')])?null:_0x19040f[_0xdeca('0x70')];});_0x52b1fe['on']('end',function(){fs[_0xdeca('0x64')](_0x242033,parseInt(_0xdeca('0x75'),0x8));return db[_0xdeca('0x2e')][_0xdeca('0x58')](_0x354291)['then'](function(_0x4b5f6e){var _0x14b4f5={'role':_0x5abfce[_0xdeca('0x76')][_0xdeca('0x77')],'userProfileId':_0x5abfce[_0xdeca('0x76')][_0xdeca('0x78')]};if(!_0x14b4f5)throw new Error(_0xdeca('0x79'));if(_0x14b4f5[_0xdeca('0x77')]==='user'){var _0x4e9075=_0x4b5f6e[_0xdeca('0x7a')]({'plain':!![]});return db[_0xdeca('0x7b')][_0xdeca('0x4d')]({'where':{'name':'Sounds','userProfileId':_0x14b4f5[_0xdeca('0x78')]},'raw':!![]})[_0xdeca('0x26')](function(_0xb5db5c){if(_0xb5db5c&&_0xb5db5c['autoAssociation']===0x0){return db[_0xdeca('0x29')][_0xdeca('0x58')]({'name':_0x4e9075[_0xdeca('0x2b')],'resourceId':_0x4e9075['id'],'type':_0xb5db5c['name'],'sectionId':_0xb5db5c['id']},{})[_0xdeca('0x26')](function(){return _0x4b5f6e;});}else{return _0x4b5f6e;}})[_0xdeca('0x47')](function(_0x1880b1){logger[_0xdeca('0x7c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1880b1);throw _0x1880b1;});}return _0x4b5f6e;})['then'](respondWithResult(_0x57a8d3,null))[_0xdeca('0x47')](handleError(_0x57a8d3,null));});_0x52b1fe[_0xdeca('0x7d')]();}catch(_0x12108a){_0x57a8d3[_0xdeca('0x1d')](0x1f4)[_0xdeca('0x2c')](_0x12108a);}};exports[_0xdeca('0x25')]=function(_0x5d03eb,_0x47865b,_0x39af76){return db[_0xdeca('0x2e')][_0xdeca('0x4d')]({'where':{'id':_0x5d03eb['params']['id']}})['then'](handleEntityNotFound(_0x47865b,null))[_0xdeca('0x26')](saveUpdates(_[_0xdeca('0x3f')](_0x5d03eb[_0xdeca('0x76')],[_0xdeca('0x2b'),_0xdeca('0x7e')]),null))[_0xdeca('0x26')](respondWithResult(_0x47865b,null))[_0xdeca('0x47')](handleError(_0x47865b,null));};exports[_0xdeca('0x7f')]=function(_0x11d811,_0x346356,_0x59282c){return db[_0xdeca('0x2e')][_0xdeca('0x4d')]({'where':{'id':_0x11d811['params']['id']}})[_0xdeca('0x26')](function(_0x2df8fd){if(_0x2df8fd){return _0x2df8fd['destroy']();}})[_0xdeca('0x26')](function(_0x2a0920){var _0x224221=path[_0xdeca('0x4f')](config[_0xdeca('0x50')],'server/files/sounds/original',util[_0xdeca('0x56')](_0xdeca('0x61'),_0x2a0920['save_name'],_0x2a0920['original_format']));var _0x48ecd3=path[_0xdeca('0x4f')](config['root'],_0xdeca('0x51'),util[_0xdeca('0x56')]('%s.%s',_0x2a0920['save_name'],_0x2a0920[_0xdeca('0x52')]));fs['unlinkSync'](_0x224221);fs[_0xdeca('0x80')](_0x48ecd3);return _0x2a0920;})[_0xdeca('0x26')](function(_0x2d6304){if(_0x2d6304){return _0x346356['status'](0xcc)[_0xdeca('0x1e')]();}})['then'](handleEntityNotFound(_0x346356,null))['catch'](handleError(_0x346356,null));}; \ No newline at end of file +var _0xa1c7=['path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','UserProfileResource','error','stack','name','index','Sound','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','download','params','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','basename','originalname','extname','file','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x185d52,_0x18909b){var _0x5292a1=function(_0x3ea6e7){while(--_0x3ea6e7){_0x185d52['push'](_0x185d52['shift']());}};_0x5292a1(++_0x18909b);}(_0xa1c7,0xec));var _0x7a1c=function(_0x32c27d,_0x404c34){_0x32c27d=_0x32c27d-0x0;var _0xe640d8=_0xa1c7[_0x32c27d];return _0xe640d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a1c('0x0'));var rp=require(_0x7a1c('0x1'));var moment=require(_0x7a1c('0x2'));var BPromise=require(_0x7a1c('0x3'));var Mustache=require(_0x7a1c('0x4'));var util=require(_0x7a1c('0x5'));var path=require(_0x7a1c('0x6'));var sox=require(_0x7a1c('0x7'));var csv=require(_0x7a1c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a1c('0x9'));var _=require(_0x7a1c('0xa'));var squel=require('squel');var crypto=require(_0x7a1c('0xb'));var jsforce=require(_0x7a1c('0xc'));var deskjs=require(_0x7a1c('0xd'));var toCsv=require(_0x7a1c('0x8'));var querystring=require(_0x7a1c('0xe'));var Papa=require(_0x7a1c('0xf'));var Redis=require(_0x7a1c('0x10'));var authService=require(_0x7a1c('0x11'));var qs=require(_0x7a1c('0x12'));var as=require(_0x7a1c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a1c('0x14'))(_0x7a1c('0x15'));var utils=require(_0x7a1c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7a1c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aea68,_0x338225){_0x338225=_0x338225||0xcc;return function(_0x472519){if(_0x472519){return _0x5aea68[_0x7a1c('0x18')](_0x338225);}return _0x5aea68[_0x7a1c('0x19')](_0x338225)[_0x7a1c('0x1a')]();};}function respondWithResult(_0x49e419,_0x460ebc){_0x460ebc=_0x460ebc||0xc8;return function(_0x128858){if(_0x128858){return _0x49e419['status'](_0x460ebc)['json'](_0x128858);}};}function respondWithFilteredResult(_0x5e0cb7,_0x54379a){return function(_0x5da407){if(_0x5da407){var _0x1df54d=typeof _0x54379a[_0x7a1c('0x1b')]===_0x7a1c('0x1c')&&typeof _0x54379a[_0x7a1c('0x1d')]===_0x7a1c('0x1c');var _0x1eacf7=_0x5da407['count'];var _0x58231e=_0x1df54d?0x0:_0x54379a[_0x7a1c('0x1b')];var _0x864e7f=_0x1df54d?_0x5da407[_0x7a1c('0x1e')]:_0x54379a[_0x7a1c('0x1b')]+_0x54379a['limit'];var _0x2309ac;if(_0x864e7f>=_0x1eacf7){_0x864e7f=_0x1eacf7;_0x2309ac=0xc8;}else{_0x2309ac=0xce;}_0x5e0cb7[_0x7a1c('0x19')](_0x2309ac);return _0x5e0cb7[_0x7a1c('0x1f')](_0x7a1c('0x20'),_0x58231e+'-'+_0x864e7f+'/'+_0x1eacf7)['json'](_0x5da407);}return null;};}function patchUpdates(_0x24b332){return function(_0x11fcad){try{jsonpatch[_0x7a1c('0x21')](_0x11fcad,_0x24b332,!![]);}catch(_0x27462b){return BPromise['reject'](_0x27462b);}return _0x11fcad['save']();};}function saveUpdates(_0xc0f7c6,_0x1815ff){return function(_0x462b52){if(_0x462b52){return _0x462b52['update'](_0xc0f7c6)[_0x7a1c('0x22')](function(_0x52c308){return _0x52c308;});}return null;};}function removeEntity(_0x52585c,_0x5869dc){return function(_0x599a7c){if(_0x599a7c){return _0x599a7c[_0x7a1c('0x23')]()[_0x7a1c('0x22')](function(){var _0x2a3750=_0x599a7c[_0x7a1c('0x24')]({'plain':!![]});var _0x438c03='Sounds';return db[_0x7a1c('0x25')]['destroy']({'where':{'type':_0x438c03,'resourceId':_0x2a3750['id']}})['then'](function(){return _0x599a7c;});})[_0x7a1c('0x22')](function(){_0x52585c[_0x7a1c('0x19')](0xcc)[_0x7a1c('0x1a')]();});}};}function handleEntityNotFound(_0x3b5167,_0xb95ff9){return function(_0x21ad53){if(!_0x21ad53){_0x3b5167[_0x7a1c('0x18')](0x194);}return _0x21ad53;};}function handleError(_0x2f4506,_0x4153e6){_0x4153e6=_0x4153e6||0x1f4;return function(_0x57fae5){logger[_0x7a1c('0x26')](_0x57fae5[_0x7a1c('0x27')]);if(_0x57fae5[_0x7a1c('0x28')]){delete _0x57fae5[_0x7a1c('0x28')];}_0x2f4506[_0x7a1c('0x19')](_0x4153e6)['send'](_0x57fae5);};}exports[_0x7a1c('0x29')]=function(_0x2f49ea,_0x7346dc){var _0x30daa6={},_0x4994ab={},_0x648351={'count':0x0,'rows':[]};var _0x3f4376=_['map'](db[_0x7a1c('0x2a')]['rawAttributes'],function(_0x48b669){return{'name':_0x48b669['fieldName'],'type':_0x48b669['type'][_0x7a1c('0x2b')]};});_0x4994ab[_0x7a1c('0x2c')]=_[_0x7a1c('0x2d')](_0x3f4376,_0x7a1c('0x28'));_0x4994ab[_0x7a1c('0x2e')]=_[_0x7a1c('0x2f')](_0x2f49ea[_0x7a1c('0x2e')]);_0x4994ab['filters']=_[_0x7a1c('0x30')](_0x4994ab[_0x7a1c('0x2c')],_0x4994ab[_0x7a1c('0x2e')]);_0x30daa6[_0x7a1c('0x31')]=_[_0x7a1c('0x30')](_0x4994ab['model'],qs[_0x7a1c('0x32')](_0x2f49ea['query'][_0x7a1c('0x32')]));_0x30daa6[_0x7a1c('0x31')]=_0x30daa6['attributes']['length']?_0x30daa6[_0x7a1c('0x31')]:_0x4994ab[_0x7a1c('0x2c')];if(!_0x2f49ea[_0x7a1c('0x2e')][_0x7a1c('0x33')](_0x7a1c('0x34'))){_0x30daa6[_0x7a1c('0x1d')]=qs[_0x7a1c('0x1d')](_0x2f49ea[_0x7a1c('0x2e')][_0x7a1c('0x1d')]);_0x30daa6[_0x7a1c('0x1b')]=qs[_0x7a1c('0x1b')](_0x2f49ea[_0x7a1c('0x2e')][_0x7a1c('0x1b')]);}_0x30daa6[_0x7a1c('0x35')]=qs['sort'](_0x2f49ea[_0x7a1c('0x2e')][_0x7a1c('0x36')]);_0x30daa6[_0x7a1c('0x37')]=qs[_0x7a1c('0x38')](_[_0x7a1c('0x39')](_0x2f49ea[_0x7a1c('0x2e')],_0x4994ab['filters']),_0x3f4376);if(_0x2f49ea[_0x7a1c('0x2e')][_0x7a1c('0x3a')]){_0x30daa6['where']=_[_0x7a1c('0x3b')](_0x30daa6[_0x7a1c('0x37')],{'$or':_[_0x7a1c('0x2d')](_0x3f4376,function(_0xfd097){if(_0xfd097[_0x7a1c('0x3c')]!==_0x7a1c('0x3d')){var _0x35a14f={};_0x35a14f[_0xfd097[_0x7a1c('0x28')]]={'$like':'%'+_0x2f49ea[_0x7a1c('0x2e')]['filter']+'%'};return _0x35a14f;}})});}_0x30daa6=_[_0x7a1c('0x3b')]({},_0x30daa6,_0x2f49ea['options']);var _0x1bda73={'where':_0x30daa6[_0x7a1c('0x37')]};return db[_0x7a1c('0x2a')]['count'](_0x1bda73)[_0x7a1c('0x22')](function(_0x22709c){_0x648351[_0x7a1c('0x1e')]=_0x22709c;if(_0x2f49ea['query'][_0x7a1c('0x3e')]){_0x30daa6[_0x7a1c('0x3f')]=[{'all':!![]}];}return db[_0x7a1c('0x2a')][_0x7a1c('0x40')](_0x30daa6);})['then'](function(_0x431cd9){_0x648351[_0x7a1c('0x41')]=_0x431cd9;return _0x648351;})[_0x7a1c('0x22')](respondWithFilteredResult(_0x7346dc,_0x30daa6))[_0x7a1c('0x42')](handleError(_0x7346dc,null));};exports[_0x7a1c('0x43')]=function(_0x271735,_0x18b437){var _0x12ffa3={'raw':!![],'where':{'id':_0x271735['params']['id']}},_0x198a67={};_0x198a67[_0x7a1c('0x2c')]=_['keys'](db[_0x7a1c('0x2a')][_0x7a1c('0x44')]);_0x198a67[_0x7a1c('0x2e')]=_['keys'](_0x271735[_0x7a1c('0x2e')]);_0x198a67[_0x7a1c('0x38')]=_[_0x7a1c('0x30')](_0x198a67[_0x7a1c('0x2c')],_0x198a67[_0x7a1c('0x2e')]);_0x12ffa3['attributes']=_['intersection'](_0x198a67[_0x7a1c('0x2c')],qs[_0x7a1c('0x32')](_0x271735[_0x7a1c('0x2e')]['fields']));_0x12ffa3['attributes']=_0x12ffa3[_0x7a1c('0x31')]['length']?_0x12ffa3[_0x7a1c('0x31')]:_0x198a67[_0x7a1c('0x2c')];if(_0x271735[_0x7a1c('0x2e')][_0x7a1c('0x3e')]){_0x12ffa3[_0x7a1c('0x3f')]=[{'all':!![]}];}_0x12ffa3=_['merge']({},_0x12ffa3,_0x271735[_0x7a1c('0x45')]);return db[_0x7a1c('0x2a')][_0x7a1c('0x46')](_0x12ffa3)[_0x7a1c('0x22')](handleEntityNotFound(_0x18b437,null))[_0x7a1c('0x22')](respondWithResult(_0x18b437,null))[_0x7a1c('0x42')](handleError(_0x18b437,null));};exports[_0x7a1c('0x47')]=function(_0x2ecbb1,_0x3e8400,_0x3e2438){return db[_0x7a1c('0x2a')][_0x7a1c('0x46')]({'where':{'id':_0x2ecbb1[_0x7a1c('0x48')]['id']},'attributes':[_0x7a1c('0x28'),_0x7a1c('0x49'),_0x7a1c('0x4a')],'raw':!![]})[_0x7a1c('0x22')](handleEntityNotFound(_0x3e8400,null))['then'](function(_0x476ced){if(_0x476ced){if(!fs['existsSync'](path[_0x7a1c('0x4b')](config[_0x7a1c('0x4c')],_0x7a1c('0x4d'),_0x476ced['save_name']+'.'+_0x476ced[_0x7a1c('0x4a')]))){throw new db[(_0x7a1c('0x4e'))][(_0x7a1c('0x4f'))]('Sound\x20not\x20found');}return _0x3e8400[_0x7a1c('0x47')](path[_0x7a1c('0x4b')](config[_0x7a1c('0x4c')],_0x7a1c('0x4d'),util['format']('%s.%s',_0x476ced[_0x7a1c('0x49')],_0x476ced[_0x7a1c('0x4a')])),util[_0x7a1c('0x50')](_0x7a1c('0x51'),_0x476ced['name'],_0x476ced[_0x7a1c('0x4a')]));}return null;})[_0x7a1c('0x42')](handleError(_0x3e8400,null));};exports[_0x7a1c('0x52')]=function(_0x1bab92,_0x6f5728,_0x9e8a5){var _0x1373df={'name':path[_0x7a1c('0x53')](_0x1bab92['file'][_0x7a1c('0x54')],path[_0x7a1c('0x55')](_0x1bab92[_0x7a1c('0x56')]['originalname'])),'save_name':path[_0x7a1c('0x53')](_0x1bab92[_0x7a1c('0x56')][_0x7a1c('0x57')],path['extname'](_0x1bab92[_0x7a1c('0x56')][_0x7a1c('0x57')])),'original_format':path[_0x7a1c('0x55')](_0x1bab92[_0x7a1c('0x56')][_0x7a1c('0x54')])['substring'](0x1),'converted_format':_0x7a1c('0x58')};var _0x322d13=path[_0x7a1c('0x4b')](config[_0x7a1c('0x4c')],_0x7a1c('0x59'),_0x1bab92[_0x7a1c('0x56')][_0x7a1c('0x57')]);var _0x389f35=path[_0x7a1c('0x4b')](config['root'],_0x7a1c('0x4d'),util[_0x7a1c('0x50')]('%s.%s',path[_0x7a1c('0x53')](_0x1bab92[_0x7a1c('0x56')][_0x7a1c('0x57')],path[_0x7a1c('0x55')](_0x1bab92[_0x7a1c('0x56')][_0x7a1c('0x57')])),_0x1373df['converted_format']));logger[_0x7a1c('0x5a')](_0x7a1c('0x5b'),_0x322d13);logger[_0x7a1c('0x5a')](_0x7a1c('0x5c'),_0x389f35);try{fs[_0x7a1c('0x5d')](_0x322d13,parseInt(_0x7a1c('0x5e'),0x8));var _0x473943=sox[_0x7a1c('0x5f')](_0x322d13,_0x389f35,{'sampleRate':0x1f40,'format':_0x7a1c('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x473943['on'](_0x7a1c('0x26'),function(_0x3e419f){fs[_0x7a1c('0x60')](_0x322d13);_0x6f5728[_0x7a1c('0x19')](0x1f4)[_0x7a1c('0x61')](_0x3e419f);});_0x473943['on'](_0x7a1c('0x62'),function(_0x186cf1){_0x1373df['original_duration']=isNaN(_0x186cf1[_0x7a1c('0x63')])?null:_0x186cf1[_0x7a1c('0x63')]*0x3e8;_0x1373df[_0x7a1c('0x64')]=isNaN(_0x186cf1[_0x7a1c('0x65')])?null:_0x186cf1[_0x7a1c('0x65')];_0x1373df['original_channelCount']=isNaN(_0x186cf1['channelCount'])?null:_0x186cf1[_0x7a1c('0x66')];_0x1373df[_0x7a1c('0x67')]=isNaN(_0x186cf1['bitRate'])?null:_0x186cf1[_0x7a1c('0x68')];_0x1373df[_0x7a1c('0x69')]=isNaN(_0x186cf1[_0x7a1c('0x6a')])?null:_0x186cf1['sampleRate'];});_0x473943['on'](_0x7a1c('0x6b'),function(_0x1dd744){_0x1373df[_0x7a1c('0x6c')]=isNaN(_0x1dd744[_0x7a1c('0x63')])?null:_0x1dd744[_0x7a1c('0x63')]*0x3e8;_0x1373df['converted_sampleCount']=isNaN(_0x1dd744[_0x7a1c('0x65')])?null:_0x1dd744[_0x7a1c('0x65')];_0x1373df[_0x7a1c('0x6d')]=isNaN(_0x1dd744[_0x7a1c('0x66')])?null:_0x1dd744[_0x7a1c('0x66')];_0x1373df[_0x7a1c('0x6e')]=isNaN(_0x1dd744[_0x7a1c('0x68')])?null:_0x1dd744['bitRate'];_0x1373df[_0x7a1c('0x6f')]=isNaN(_0x1dd744['sampleRate'])?null:_0x1dd744[_0x7a1c('0x6a')];});_0x473943['on'](_0x7a1c('0x1a'),function(){fs['chmodSync'](_0x389f35,parseInt(_0x7a1c('0x5e'),0x8));return db[_0x7a1c('0x2a')][_0x7a1c('0x52')](_0x1373df)['then'](function(_0x2c347d){var _0x293ab2={'role':_0x1bab92[_0x7a1c('0x70')][_0x7a1c('0x71')],'userProfileId':_0x1bab92[_0x7a1c('0x70')][_0x7a1c('0x72')]};if(!_0x293ab2)throw new Error(_0x7a1c('0x73'));if(_0x293ab2[_0x7a1c('0x71')]==='user'){var _0x214998=_0x2c347d[_0x7a1c('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x7a1c('0x46')]({'where':{'name':_0x7a1c('0x74'),'userProfileId':_0x293ab2[_0x7a1c('0x72')]},'raw':!![]})[_0x7a1c('0x22')](function(_0x33bbf9){if(_0x33bbf9&&_0x33bbf9[_0x7a1c('0x75')]===0x0){return db[_0x7a1c('0x25')][_0x7a1c('0x52')]({'name':_0x214998[_0x7a1c('0x28')],'resourceId':_0x214998['id'],'type':_0x33bbf9[_0x7a1c('0x28')],'sectionId':_0x33bbf9['id']},{})[_0x7a1c('0x22')](function(){return _0x2c347d;});}else{return _0x2c347d;}})[_0x7a1c('0x42')](function(_0x139e71){logger[_0x7a1c('0x26')](_0x7a1c('0x76'),_0x139e71);throw _0x139e71;});}return _0x2c347d;})[_0x7a1c('0x22')](respondWithResult(_0x6f5728,null))[_0x7a1c('0x42')](handleError(_0x6f5728,null));});_0x473943[_0x7a1c('0x77')]();}catch(_0xeed3d4){_0x6f5728[_0x7a1c('0x19')](0x1f4)[_0x7a1c('0x61')](_0xeed3d4);}};exports['update']=function(_0x242b71,_0x3bacf7,_0x151a1a){return db['Sound']['find']({'where':{'id':_0x242b71['params']['id']}})[_0x7a1c('0x22')](handleEntityNotFound(_0x3bacf7,null))[_0x7a1c('0x22')](saveUpdates(_[_0x7a1c('0x39')](_0x242b71[_0x7a1c('0x70')],[_0x7a1c('0x28'),_0x7a1c('0x78')]),null))[_0x7a1c('0x22')](respondWithResult(_0x3bacf7,null))[_0x7a1c('0x42')](handleError(_0x3bacf7,null));};exports['delete']=function(_0x3f0d95,_0x48d3ff,_0x46eb95){return db[_0x7a1c('0x2a')]['find']({'where':{'id':_0x3f0d95[_0x7a1c('0x48')]['id']}})[_0x7a1c('0x22')](function(_0x445e52){if(_0x445e52){return _0x445e52['destroy']();}})[_0x7a1c('0x22')](function(_0x48f13f){var _0x435847=path[_0x7a1c('0x4b')](config['root'],_0x7a1c('0x59'),util[_0x7a1c('0x50')]('%s.%s',_0x48f13f['save_name'],_0x48f13f['original_format']));var _0x18ee62=path['join'](config['root'],_0x7a1c('0x4d'),util[_0x7a1c('0x50')](_0x7a1c('0x51'),_0x48f13f[_0x7a1c('0x49')],_0x48f13f[_0x7a1c('0x4a')]));fs[_0x7a1c('0x60')](_0x435847);fs[_0x7a1c('0x60')](_0x18ee62);return _0x48f13f;})[_0x7a1c('0x22')](function(_0x1aa3f4){if(_0x1aa3f4){return _0x48d3ff[_0x7a1c('0x19')](0xcc)['end']();}})[_0x7a1c('0x22')](handleEntityNotFound(_0x48d3ff,null))[_0x7a1c('0x42')](handleError(_0x48d3ff,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 795ef16..c7ed2e4 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 _0x8868=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8868,0x174));var _0x8886=function(_0x9c79ac,_0x258be5){_0x9c79ac=_0x9c79ac-0x0;var _0x22351d=_0x8868[_0x9c79ac];return _0x22351d;};'use strict';var _=require(_0x8886('0x0'));var util=require('util');var logger=require(_0x8886('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8886('0x2'));var rp=require(_0x8886('0x3'));var fs=require('fs');var path=require(_0x8886('0x4'));var rimraf=require(_0x8886('0x5'));var config=require(_0x8886('0x6'));var attributes=require(_0x8886('0x7'));module[_0x8886('0x8')]=function(_0x1744d0,_0x57e36a){return _0x1744d0[_0x8886('0x9')](_0x8886('0xa'),attributes,{'tableName':_0x8886('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ce=['util','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x5e00c8,_0x21f9e1){var _0x41c430=function(_0x303e26){while(--_0x303e26){_0x5e00c8['push'](_0x5e00c8['shift']());}};_0x41c430(++_0x21f9e1);}(_0xd4ce,0xc0));var _0xed4c=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xd4ce[_0x45e98e];return _0x374dba;};'use strict';var _=require('lodash');var util=require(_0xed4c('0x0'));var logger=require('../../config/logger')(_0xed4c('0x1'));var moment=require(_0xed4c('0x2'));var BPromise=require('bluebird');var rp=require(_0xed4c('0x3'));var fs=require('fs');var path=require(_0xed4c('0x4'));var rimraf=require(_0xed4c('0x5'));var config=require(_0xed4c('0x6'));var attributes=require(_0xed4c('0x7'));module[_0xed4c('0x8')]=function(_0x48a831,_0x2a2558){return _0x48a831[_0xed4c('0x9')](_0xed4c('0xa'),attributes,{'tableName':_0xed4c('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 6f30d60..e4cde33 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 _0x4194=['message','result','catch','ShowSound','Sound','find','options','where','attributes','include','model','map','then','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s'];(function(_0x2a09e8,_0x26113a){var _0x26a215=function(_0x296a31){while(--_0x296a31){_0x2a09e8['push'](_0x2a09e8['shift']());}};_0x26a215(++_0x26113a);}(_0x4194,0x1c0));var _0x4419=function(_0x43cf8f,_0x1c436c){_0x43cf8f=_0x43cf8f-0x0;var _0x928a69=_0x4194[_0x43cf8f];return _0x928a69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4419('0x0'));var BPromise=require('bluebird');var rs=require(_0x4419('0x1'));var fs=require('fs');var Redis=require(_0x4419('0x2'));var db=require(_0x4419('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4419('0x4'))('rpc');var config=require(_0x4419('0x5'));var jayson=require(_0x4419('0x6'));var client=jayson[_0x4419('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7ded,_0x53be1e,_0x43b9f9){return new BPromise(function(_0x4e9e1f,_0x14645a){return client[_0x4419('0x8')](_0x1a7ded,_0x43b9f9)['then'](function(_0x398f2c){logger[_0x4419('0x9')]('Sound,\x20%s,\x20%s',_0x53be1e,_0x4419('0xa'));logger[_0x4419('0xb')]('Sound,\x20%s,\x20%s,\x20%s',_0x53be1e,_0x4419('0xa'),JSON[_0x4419('0xc')](_0x398f2c));if(_0x398f2c[_0x4419('0xd')]){if(_0x398f2c[_0x4419('0xd')][_0x4419('0xe')]===0x1f4){logger[_0x4419('0xd')](_0x4419('0xf'),_0x53be1e,_0x398f2c[_0x4419('0xd')][_0x4419('0x10')]);return _0x14645a(_0x398f2c[_0x4419('0xd')]['message']);}logger[_0x4419('0xd')](_0x4419('0xf'),_0x53be1e,_0x398f2c[_0x4419('0xd')][_0x4419('0x10')]);return _0x4e9e1f(_0x398f2c[_0x4419('0xd')][_0x4419('0x10')]);}else{logger[_0x4419('0x9')](_0x4419('0xf'),_0x53be1e,_0x4419('0xa'));_0x4e9e1f(_0x398f2c[_0x4419('0x11')][_0x4419('0x10')]);}})[_0x4419('0x12')](function(_0x29badb){logger[_0x4419('0xd')](_0x4419('0xf'),_0x53be1e,_0x29badb);_0x14645a(_0x29badb);});});}exports[_0x4419('0x13')]=function(_0x1e7314){var _0x10a15b=this;return new Promise(function(_0x1f4fe2,_0x341ec1){return db[_0x4419('0x14')][_0x4419('0x15')]({'raw':_0x1e7314[_0x4419('0x16')]?_0x1e7314[_0x4419('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1e7314[_0x4419('0x16')]?_0x1e7314['options'][_0x4419('0x17')]||null:null,'attributes':_0x1e7314['options']?_0x1e7314[_0x4419('0x16')][_0x4419('0x18')]||null:null,'include':_0x1e7314['options']?_0x1e7314[_0x4419('0x16')][_0x4419('0x19')]?_['map'](_0x1e7314['options'][_0x4419('0x19')],function(_0x4a6e7f){return{'model':db[_0x4a6e7f[_0x4419('0x1a')]],'as':_0x4a6e7f['as'],'attributes':_0x4a6e7f[_0x4419('0x18')],'include':_0x4a6e7f[_0x4419('0x19')]?_[_0x4419('0x1b')](_0x4a6e7f[_0x4419('0x19')],function(_0x38bc03){return{'model':db[_0x38bc03[_0x4419('0x1a')]],'as':_0x38bc03['as'],'attributes':_0x38bc03[_0x4419('0x18')],'include':_0x38bc03['include']?_[_0x4419('0x1b')](_0x38bc03['include'],function(_0x557db3){return{'model':db[_0x557db3[_0x4419('0x1a')]],'as':_0x557db3['as'],'attributes':_0x557db3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4419('0x1c')](function(_0x58c353){logger[_0x4419('0x9')](_0x4419('0x13'),_0x1e7314);logger[_0x4419('0xb')](_0x4419('0x13'),_0x1e7314,JSON['stringify'](_0x58c353));_0x1f4fe2(_0x58c353);})[_0x4419('0x12')](function(_0xa2c1e4){logger['error'](_0x4419('0x13'),_0xa2c1e4[_0x4419('0x10')],_0x1e7314);_0x341ec1(_0x10a15b[_0x4419('0xd')](0x1f4,_0xa2c1e4[_0x4419('0x10')]));});});}; \ No newline at end of file +var _0x0c7c=['ShowSound','Sound','find','options','raw','where','include','map','model','attributes','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x525445,_0x4f8f42){var _0x48b600=function(_0x561bc1){while(--_0x561bc1){_0x525445['push'](_0x525445['shift']());}};_0x48b600(++_0x4f8f42);}(_0x0c7c,0xc5));var _0xc0c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c7c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc0c7('0x0'));var moment=require('moment');var BPromise=require(_0xc0c7('0x1'));var rs=require(_0xc0c7('0x2'));var fs=require('fs');var Redis=require(_0xc0c7('0x3'));var db=require(_0xc0c7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0c7('0x5'))(_0xc0c7('0x6'));var config=require(_0xc0c7('0x7'));var jayson=require(_0xc0c7('0x8'));var client=jayson[_0xc0c7('0x9')][_0xc0c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bf52c,_0x39711f,_0x26d8b8){return new BPromise(function(_0x2d7059,_0x1233e1){return client['request'](_0x3bf52c,_0x26d8b8)[_0xc0c7('0xb')](function(_0x3d371b){logger[_0xc0c7('0xc')](_0xc0c7('0xd'),_0x39711f,_0xc0c7('0xe'));logger[_0xc0c7('0xf')](_0xc0c7('0x10'),_0x39711f,'request\x20sent',JSON['stringify'](_0x3d371b));if(_0x3d371b[_0xc0c7('0x11')]){if(_0x3d371b['error']['code']===0x1f4){logger[_0xc0c7('0x11')](_0xc0c7('0xd'),_0x39711f,_0x3d371b[_0xc0c7('0x11')][_0xc0c7('0x12')]);return _0x1233e1(_0x3d371b[_0xc0c7('0x11')][_0xc0c7('0x12')]);}logger['error']('Sound,\x20%s,\x20%s',_0x39711f,_0x3d371b[_0xc0c7('0x11')][_0xc0c7('0x12')]);return _0x2d7059(_0x3d371b[_0xc0c7('0x11')][_0xc0c7('0x12')]);}else{logger['info'](_0xc0c7('0xd'),_0x39711f,_0xc0c7('0xe'));_0x2d7059(_0x3d371b[_0xc0c7('0x13')][_0xc0c7('0x12')]);}})['catch'](function(_0x414577){logger[_0xc0c7('0x11')](_0xc0c7('0xd'),_0x39711f,_0x414577);_0x1233e1(_0x414577);});});}exports[_0xc0c7('0x14')]=function(_0x147835){var _0x348ad6=this;return new Promise(function(_0x511f98,_0x59fdd6){return db[_0xc0c7('0x15')][_0xc0c7('0x16')]({'raw':_0x147835[_0xc0c7('0x17')]?_0x147835['options'][_0xc0c7('0x18')]===undefined?!![]:![]:!![],'where':_0x147835['options']?_0x147835[_0xc0c7('0x17')][_0xc0c7('0x19')]||null:null,'attributes':_0x147835[_0xc0c7('0x17')]?_0x147835[_0xc0c7('0x17')]['attributes']||null:null,'include':_0x147835[_0xc0c7('0x17')]?_0x147835[_0xc0c7('0x17')][_0xc0c7('0x1a')]?_[_0xc0c7('0x1b')](_0x147835[_0xc0c7('0x17')][_0xc0c7('0x1a')],function(_0x32e754){return{'model':db[_0x32e754[_0xc0c7('0x1c')]],'as':_0x32e754['as'],'attributes':_0x32e754[_0xc0c7('0x1d')],'include':_0x32e754[_0xc0c7('0x1a')]?_[_0xc0c7('0x1b')](_0x32e754[_0xc0c7('0x1a')],function(_0x287565){return{'model':db[_0x287565[_0xc0c7('0x1c')]],'as':_0x287565['as'],'attributes':_0x287565[_0xc0c7('0x1d')],'include':_0x287565[_0xc0c7('0x1a')]?_[_0xc0c7('0x1b')](_0x287565[_0xc0c7('0x1a')],function(_0x414994){return{'model':db[_0x414994[_0xc0c7('0x1c')]],'as':_0x414994['as'],'attributes':_0x414994[_0xc0c7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x451fa2){logger[_0xc0c7('0xc')](_0xc0c7('0x14'),_0x147835);logger['debug'](_0xc0c7('0x14'),_0x147835,JSON[_0xc0c7('0x1e')](_0x451fa2));_0x511f98(_0x451fa2);})['catch'](function(_0x19e588){logger['error']('ShowSound',_0x19e588[_0xc0c7('0x12')],_0x147835);_0x59fdd6(_0x348ad6[_0xc0c7('0x11')](0x1f4,_0x19e588['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7da3a93..0c3b851 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0xfc48f7,_0x31e67f){var _0x2a07ae=function(_0x58a489){while(--_0x58a489){_0xfc48f7['push'](_0xfc48f7['shift']());}};_0x2a07ae(++_0x31e67f);}(_0x5eb8,0xb0));var _0x85eb=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0x5eb8[_0x398d85];return _0x33c2bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbdd99f,_0x2a07b2){var _0xfc2ebe=function(_0x1774be){while(--_0x1774be){_0xbdd99f['push'](_0xbdd99f['shift']());}};_0xfc2ebe(++_0x2a07b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x357979,_0x56feef){_0x357979=_0x357979-0x0;var _0xabb42f=_0xb10b[_0x357979];return _0xabb42f;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);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 cde3bb0..ace9f52 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 _0xeba8=['ENUM','out','STRING','TEXT','sequelize','medium'];(function(_0x14e1e1,_0x3ea41a){var _0x394310=function(_0x3959c9){while(--_0x3959c9){_0x14e1e1['push'](_0x14e1e1['shift']());}};_0x394310(++_0x3ea41a);}(_0xeba8,0x196));var _0x8eba=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xeba8[_0x479509];return _0x382da8;};'use strict';var Sequelize=require(_0x8eba('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x8eba('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x8eba('0x2')]('in',_0x8eba('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8eba('0x4')]},'providerResponse':{'type':Sequelize[_0x8eba('0x5')]}}; \ No newline at end of file +var _0x1c19=['sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1c19,0x1c8));var _0x91c1=function(_0x4e46fd,_0x5993bb){_0x4e46fd=_0x4e46fd-0x0;var _0x4dc5cf=_0x1c19[_0x4e46fd];return _0x4dc5cf;};'use strict';var Sequelize=require(_0x91c1('0x0'));module[_0x91c1('0x1')]={'uniqueid':{'type':Sequelize[_0x91c1('0x2')]},'body':{'type':Sequelize[_0x91c1('0x3')](_0x91c1('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x91c1('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x91c1('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0530377..be2ce1c 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 _0x66ce=['params','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x66ce,0x96));var _0xe66c=function(_0x2aacba,_0x46b6f0){_0x2aacba=_0x2aacba-0x0;var _0x3e2814=_0x66ce[_0x2aacba];return _0x3e2814;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe66c('0x0'));var zipdir=require(_0xe66c('0x1'));var jsonpatch=require(_0xe66c('0x2'));var rp=require('request-promise');var moment=require(_0xe66c('0x3'));var BPromise=require(_0xe66c('0x4'));var Mustache=require('mustache');var util=require(_0xe66c('0x5'));var path=require(_0xe66c('0x6'));var sox=require(_0xe66c('0x7'));var csv=require(_0xe66c('0x8'));var ejs=require(_0xe66c('0x9'));var fs=require('fs');var fs_extra=require(_0xe66c('0xa'));var _=require(_0xe66c('0xb'));var squel=require(_0xe66c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe66c('0xd'));var toCsv=require(_0xe66c('0x8'));var querystring=require(_0xe66c('0xe'));var Papa=require(_0xe66c('0xf'));var Redis=require('ioredis');var authService=require(_0xe66c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe66c('0x11'));var logger=require(_0xe66c('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe66c('0x13'));var licenseUtil=require(_0xe66c('0x14'));var db=require(_0xe66c('0x15'))['db'];function respondWithStatusCode(_0x5d40ca,_0x1cb726){_0x1cb726=_0x1cb726||0xcc;return function(_0x3a2113){if(_0x3a2113){return _0x5d40ca[_0xe66c('0x16')](_0x1cb726);}return _0x5d40ca[_0xe66c('0x17')](_0x1cb726)[_0xe66c('0x18')]();};}function respondWithResult(_0x280669,_0x51bc64){_0x51bc64=_0x51bc64||0xc8;return function(_0x351649){if(_0x351649){return _0x280669[_0xe66c('0x17')](_0x51bc64)[_0xe66c('0x19')](_0x351649);}};}function respondWithFilteredResult(_0x4e0b08,_0x14d9a3){return function(_0x35b169){if(_0x35b169){var _0x3fbf45=typeof _0x14d9a3[_0xe66c('0x1a')]===_0xe66c('0x1b')&&typeof _0x14d9a3['limit']===_0xe66c('0x1b');var _0x3b274b=_0x35b169[_0xe66c('0x1c')];var _0x577e6e=_0x3fbf45?0x0:_0x14d9a3[_0xe66c('0x1a')];var _0x5dfaab=_0x3fbf45?_0x35b169['count']:_0x14d9a3[_0xe66c('0x1a')]+_0x14d9a3[_0xe66c('0x1d')];var _0x2d81ea;if(_0x5dfaab>=_0x3b274b){_0x5dfaab=_0x3b274b;_0x2d81ea=0xc8;}else{_0x2d81ea=0xce;}_0x4e0b08['status'](_0x2d81ea);return _0x4e0b08[_0xe66c('0x1e')](_0xe66c('0x1f'),_0x577e6e+'-'+_0x5dfaab+'/'+_0x3b274b)['json'](_0x35b169);}return null;};}function patchUpdates(_0x343762){return function(_0x335dcb){try{jsonpatch[_0xe66c('0x20')](_0x335dcb,_0x343762,!![]);}catch(_0x1babaa){return BPromise[_0xe66c('0x21')](_0x1babaa);}return _0x335dcb[_0xe66c('0x22')]();};}function saveUpdates(_0x48c54d,_0x59634e){return function(_0x29bbe8){if(_0x29bbe8){return _0x29bbe8[_0xe66c('0x23')](_0x48c54d)['then'](function(_0x1b2603){return _0x1b2603;});}return null;};}function removeEntity(_0x150e18,_0x1e0f23){return function(_0x253060){if(_0x253060){return _0x253060['destroy']()[_0xe66c('0x24')](function(){_0x150e18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4452f4,_0x2ee35c){return function(_0x165474){if(!_0x165474){_0x4452f4[_0xe66c('0x16')](0x194);}return _0x165474;};}function handleError(_0x59cb0f,_0x2342bb){_0x2342bb=_0x2342bb||0x1f4;return function(_0x170d21){logger['error'](_0x170d21[_0xe66c('0x25')]);if(_0x170d21['name']){delete _0x170d21[_0xe66c('0x26')];}_0x59cb0f[_0xe66c('0x17')](_0x2342bb)[_0xe66c('0x27')](_0x170d21);};}exports['index']=function(_0x22122d,_0x1f1199){var _0x5cffe2={},_0x3927ba={},_0x4c5c4b={'count':0x0,'rows':[]};var _0x57d58a=_[_0xe66c('0x28')](db[_0xe66c('0x29')][_0xe66c('0x2a')],function(_0x5555fe){return{'name':_0x5555fe[_0xe66c('0x2b')],'type':_0x5555fe[_0xe66c('0x2c')][_0xe66c('0x2d')]};});_0x3927ba['model']=_[_0xe66c('0x28')](_0x57d58a,_0xe66c('0x26'));_0x3927ba[_0xe66c('0x2e')]=_[_0xe66c('0x2f')](_0x22122d[_0xe66c('0x2e')]);_0x3927ba[_0xe66c('0x30')]=_[_0xe66c('0x31')](_0x3927ba[_0xe66c('0x32')],_0x3927ba['query']);_0x5cffe2[_0xe66c('0x33')]=_[_0xe66c('0x31')](_0x3927ba[_0xe66c('0x32')],qs[_0xe66c('0x34')](_0x22122d[_0xe66c('0x2e')][_0xe66c('0x34')]));_0x5cffe2[_0xe66c('0x33')]=_0x5cffe2['attributes'][_0xe66c('0x35')]?_0x5cffe2['attributes']:_0x3927ba[_0xe66c('0x32')];if(!_0x22122d[_0xe66c('0x2e')][_0xe66c('0x36')]('nolimit')){_0x5cffe2[_0xe66c('0x1d')]=qs['limit'](_0x22122d[_0xe66c('0x2e')][_0xe66c('0x1d')]);_0x5cffe2['offset']=qs[_0xe66c('0x1a')](_0x22122d[_0xe66c('0x2e')]['offset']);}_0x5cffe2[_0xe66c('0x37')]=qs[_0xe66c('0x38')](_0x22122d[_0xe66c('0x2e')][_0xe66c('0x38')]);_0x5cffe2['where']=qs[_0xe66c('0x30')](_[_0xe66c('0x39')](_0x22122d[_0xe66c('0x2e')],_0x3927ba['filters']),_0x57d58a);if(_0x22122d[_0xe66c('0x2e')][_0xe66c('0x3a')]){_0x5cffe2['where']=_[_0xe66c('0x3b')](_0x5cffe2[_0xe66c('0x3c')],{'$or':_[_0xe66c('0x28')](_0x57d58a,function(_0x57566c){if(_0x57566c[_0xe66c('0x2c')]!==_0xe66c('0x3d')){var _0xce972b={};_0xce972b[_0x57566c[_0xe66c('0x26')]]={'$like':'%'+_0x22122d[_0xe66c('0x2e')][_0xe66c('0x3a')]+'%'};return _0xce972b;}})});}_0x5cffe2=_[_0xe66c('0x3b')]({},_0x5cffe2,_0x22122d[_0xe66c('0x3e')]);var _0x451a2e={'where':_0x5cffe2[_0xe66c('0x3c')]};return db[_0xe66c('0x29')]['count'](_0x451a2e)[_0xe66c('0x24')](function(_0x11efa9){_0x4c5c4b[_0xe66c('0x1c')]=_0x11efa9;if(_0x22122d[_0xe66c('0x2e')][_0xe66c('0x3f')]){_0x5cffe2[_0xe66c('0x40')]=[{'all':!![]}];}return db[_0xe66c('0x29')][_0xe66c('0x41')](_0x5cffe2);})[_0xe66c('0x24')](function(_0x551735){_0x4c5c4b[_0xe66c('0x42')]=_0x551735;return _0x4c5c4b;})[_0xe66c('0x24')](respondWithFilteredResult(_0x1f1199,_0x5cffe2))['catch'](handleError(_0x1f1199,null));};exports[_0xe66c('0x43')]=function(_0x1193c8,_0x4ba8c3){var _0x1c0eca={'raw':!![],'where':{'id':_0x1193c8['params']['id']}},_0xb5acd0={};_0xb5acd0['model']=_[_0xe66c('0x2f')](db[_0xe66c('0x29')][_0xe66c('0x2a')]);_0xb5acd0[_0xe66c('0x2e')]=_['keys'](_0x1193c8[_0xe66c('0x2e')]);_0xb5acd0[_0xe66c('0x30')]=_[_0xe66c('0x31')](_0xb5acd0[_0xe66c('0x32')],_0xb5acd0[_0xe66c('0x2e')]);_0x1c0eca[_0xe66c('0x33')]=_[_0xe66c('0x31')](_0xb5acd0[_0xe66c('0x32')],qs[_0xe66c('0x34')](_0x1193c8[_0xe66c('0x2e')][_0xe66c('0x34')]));_0x1c0eca['attributes']=_0x1c0eca[_0xe66c('0x33')]['length']?_0x1c0eca['attributes']:_0xb5acd0[_0xe66c('0x32')];if(_0x1193c8[_0xe66c('0x2e')][_0xe66c('0x3f')]){_0x1c0eca['include']=[{'all':!![]}];}_0x1c0eca=_['merge']({},_0x1c0eca,_0x1193c8['options']);return db['SquareMessage'][_0xe66c('0x44')](_0x1c0eca)[_0xe66c('0x24')](handleEntityNotFound(_0x4ba8c3,null))['then'](respondWithResult(_0x4ba8c3,null))[_0xe66c('0x45')](handleError(_0x4ba8c3,null));};exports[_0xe66c('0x46')]=function(_0x1ab6ad,_0x4d779d){return db[_0xe66c('0x29')][_0xe66c('0x46')](_0x1ab6ad[_0xe66c('0x47')],{})['then'](respondWithResult(_0x4d779d,0xc9))[_0xe66c('0x45')](handleError(_0x4d779d,null));};exports['update']=function(_0x56fb2c,_0xa23c86){if(_0x56fb2c['body']['id']){delete _0x56fb2c[_0xe66c('0x47')]['id'];}return db['SquareMessage'][_0xe66c('0x44')]({'where':{'id':_0x56fb2c[_0xe66c('0x48')]['id']}})[_0xe66c('0x24')](handleEntityNotFound(_0xa23c86,null))[_0xe66c('0x24')](saveUpdates(_0x56fb2c[_0xe66c('0x47')],null))[_0xe66c('0x24')](respondWithResult(_0xa23c86,null))[_0xe66c('0x45')](handleError(_0xa23c86,null));};exports[_0xe66c('0x49')]=function(_0x36365c,_0x12ee86){return db[_0xe66c('0x29')][_0xe66c('0x44')]({'where':{'id':_0x36365c[_0xe66c('0x48')]['id']}})[_0xe66c('0x24')](handleEntityNotFound(_0x12ee86,null))[_0xe66c('0x24')](removeEntity(_0x12ee86,null))[_0xe66c('0x45')](handleError(_0x12ee86,null));}; \ No newline at end of file +var _0x99d0=['intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','type','filter','merge','count','findAll','catch','show','params','keys','length','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SquareMessage','rawAttributes','key','model','query'];(function(_0x3e591a,_0xb0bed2){var _0x5b4f27=function(_0x61a77e){while(--_0x61a77e){_0x3e591a['push'](_0x3e591a['shift']());}};_0x5b4f27(++_0xb0bed2);}(_0x99d0,0xa8));var _0x099d=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x99d0[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x099d('0x0'));var zipdir=require(_0x099d('0x1'));var jsonpatch=require(_0x099d('0x2'));var rp=require(_0x099d('0x3'));var moment=require('moment');var BPromise=require(_0x099d('0x4'));var Mustache=require('mustache');var util=require(_0x099d('0x5'));var path=require(_0x099d('0x6'));var sox=require(_0x099d('0x7'));var csv=require(_0x099d('0x8'));var ejs=require(_0x099d('0x9'));var fs=require('fs');var fs_extra=require(_0x099d('0xa'));var _=require(_0x099d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x099d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x099d('0x8'));var querystring=require('querystring');var Papa=require(_0x099d('0xd'));var Redis=require(_0x099d('0xe'));var authService=require(_0x099d('0xf'));var qs=require(_0x099d('0x10'));var as=require(_0x099d('0x11'));var hardwareService=require(_0x099d('0x12'));var logger=require(_0x099d('0x13'))('api');var utils=require(_0x099d('0x14'));var config=require(_0x099d('0x15'));var licenseUtil=require(_0x099d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f3fa8,_0x27c769){_0x27c769=_0x27c769||0xcc;return function(_0xcf985f){if(_0xcf985f){return _0x3f3fa8[_0x099d('0x17')](_0x27c769);}return _0x3f3fa8[_0x099d('0x18')](_0x27c769)[_0x099d('0x19')]();};}function respondWithResult(_0x5ba901,_0x2d67cd){_0x2d67cd=_0x2d67cd||0xc8;return function(_0x4bc9d1){if(_0x4bc9d1){return _0x5ba901[_0x099d('0x18')](_0x2d67cd)[_0x099d('0x1a')](_0x4bc9d1);}};}function respondWithFilteredResult(_0x42398d,_0x2689b7){return function(_0x4b9f01){if(_0x4b9f01){var _0x11d638=typeof _0x2689b7[_0x099d('0x1b')]===_0x099d('0x1c')&&typeof _0x2689b7[_0x099d('0x1d')]==='undefined';var _0x4042d8=_0x4b9f01['count'];var _0xb6635c=_0x11d638?0x0:_0x2689b7[_0x099d('0x1b')];var _0x29f7b3=_0x11d638?_0x4b9f01['count']:_0x2689b7[_0x099d('0x1b')]+_0x2689b7[_0x099d('0x1d')];var _0x121c5b;if(_0x29f7b3>=_0x4042d8){_0x29f7b3=_0x4042d8;_0x121c5b=0xc8;}else{_0x121c5b=0xce;}_0x42398d[_0x099d('0x18')](_0x121c5b);return _0x42398d[_0x099d('0x1e')](_0x099d('0x1f'),_0xb6635c+'-'+_0x29f7b3+'/'+_0x4042d8)['json'](_0x4b9f01);}return null;};}function patchUpdates(_0x2d43ee){return function(_0x108223){try{jsonpatch[_0x099d('0x20')](_0x108223,_0x2d43ee,!![]);}catch(_0x1dcf66){return BPromise[_0x099d('0x21')](_0x1dcf66);}return _0x108223[_0x099d('0x22')]();};}function saveUpdates(_0x1ec7bb,_0x3cd8e7){return function(_0x1f12bc){if(_0x1f12bc){return _0x1f12bc[_0x099d('0x23')](_0x1ec7bb)['then'](function(_0x5a66aa){return _0x5a66aa;});}return null;};}function removeEntity(_0x4384b2,_0x388d2c){return function(_0x8db89b){if(_0x8db89b){return _0x8db89b[_0x099d('0x24')]()[_0x099d('0x25')](function(){_0x4384b2[_0x099d('0x18')](0xcc)[_0x099d('0x19')]();});}};}function handleEntityNotFound(_0x1e9217,_0xe11c0){return function(_0x2170d5){if(!_0x2170d5){_0x1e9217['sendStatus'](0x194);}return _0x2170d5;};}function handleError(_0x1be986,_0x40fdd0){_0x40fdd0=_0x40fdd0||0x1f4;return function(_0x40787f){logger[_0x099d('0x26')](_0x40787f[_0x099d('0x27')]);if(_0x40787f[_0x099d('0x28')]){delete _0x40787f[_0x099d('0x28')];}_0x1be986['status'](_0x40fdd0)[_0x099d('0x29')](_0x40787f);};}exports['index']=function(_0x159602,_0x28b620){var _0x47ea22={},_0x4e190f={},_0x10d542={'count':0x0,'rows':[]};var _0x53c5c8=_[_0x099d('0x2a')](db[_0x099d('0x2b')][_0x099d('0x2c')],function(_0x3dd708){return{'name':_0x3dd708['fieldName'],'type':_0x3dd708['type'][_0x099d('0x2d')]};});_0x4e190f[_0x099d('0x2e')]=_[_0x099d('0x2a')](_0x53c5c8,_0x099d('0x28'));_0x4e190f['query']=_['keys'](_0x159602[_0x099d('0x2f')]);_0x4e190f['filters']=_[_0x099d('0x30')](_0x4e190f[_0x099d('0x2e')],_0x4e190f['query']);_0x47ea22[_0x099d('0x31')]=_[_0x099d('0x30')](_0x4e190f[_0x099d('0x2e')],qs['fields'](_0x159602[_0x099d('0x2f')][_0x099d('0x32')]));_0x47ea22[_0x099d('0x31')]=_0x47ea22['attributes']['length']?_0x47ea22[_0x099d('0x31')]:_0x4e190f[_0x099d('0x2e')];if(!_0x159602[_0x099d('0x2f')][_0x099d('0x33')]('nolimit')){_0x47ea22[_0x099d('0x1d')]=qs[_0x099d('0x1d')](_0x159602[_0x099d('0x2f')][_0x099d('0x1d')]);_0x47ea22[_0x099d('0x1b')]=qs[_0x099d('0x1b')](_0x159602[_0x099d('0x2f')][_0x099d('0x1b')]);}_0x47ea22[_0x099d('0x34')]=qs[_0x099d('0x35')](_0x159602['query'][_0x099d('0x35')]);_0x47ea22['where']=qs[_0x099d('0x36')](_[_0x099d('0x37')](_0x159602[_0x099d('0x2f')],_0x4e190f[_0x099d('0x36')]),_0x53c5c8);if(_0x159602[_0x099d('0x2f')]['filter']){_0x47ea22['where']=_['merge'](_0x47ea22[_0x099d('0x38')],{'$or':_[_0x099d('0x2a')](_0x53c5c8,function(_0x459b9a){if(_0x459b9a[_0x099d('0x39')]!=='VIRTUAL'){var _0x3c18af={};_0x3c18af[_0x459b9a['name']]={'$like':'%'+_0x159602[_0x099d('0x2f')][_0x099d('0x3a')]+'%'};return _0x3c18af;}})});}_0x47ea22=_[_0x099d('0x3b')]({},_0x47ea22,_0x159602['options']);var _0x4eba27={'where':_0x47ea22[_0x099d('0x38')]};return db['SquareMessage'][_0x099d('0x3c')](_0x4eba27)[_0x099d('0x25')](function(_0x41e755){_0x10d542[_0x099d('0x3c')]=_0x41e755;if(_0x159602[_0x099d('0x2f')]['includeAll']){_0x47ea22['include']=[{'all':!![]}];}return db[_0x099d('0x2b')][_0x099d('0x3d')](_0x47ea22);})['then'](function(_0x19fef1){_0x10d542['rows']=_0x19fef1;return _0x10d542;})[_0x099d('0x25')](respondWithFilteredResult(_0x28b620,_0x47ea22))[_0x099d('0x3e')](handleError(_0x28b620,null));};exports[_0x099d('0x3f')]=function(_0x5d4aaf,_0x5773da){var _0x18d1ff={'raw':!![],'where':{'id':_0x5d4aaf[_0x099d('0x40')]['id']}},_0x34ee05={};_0x34ee05[_0x099d('0x2e')]=_[_0x099d('0x41')](db['SquareMessage'][_0x099d('0x2c')]);_0x34ee05[_0x099d('0x2f')]=_[_0x099d('0x41')](_0x5d4aaf[_0x099d('0x2f')]);_0x34ee05['filters']=_[_0x099d('0x30')](_0x34ee05[_0x099d('0x2e')],_0x34ee05['query']);_0x18d1ff[_0x099d('0x31')]=_['intersection'](_0x34ee05['model'],qs[_0x099d('0x32')](_0x5d4aaf[_0x099d('0x2f')][_0x099d('0x32')]));_0x18d1ff[_0x099d('0x31')]=_0x18d1ff[_0x099d('0x31')][_0x099d('0x42')]?_0x18d1ff[_0x099d('0x31')]:_0x34ee05[_0x099d('0x2e')];if(_0x5d4aaf[_0x099d('0x2f')][_0x099d('0x43')]){_0x18d1ff['include']=[{'all':!![]}];}_0x18d1ff=_['merge']({},_0x18d1ff,_0x5d4aaf[_0x099d('0x44')]);return db['SquareMessage'][_0x099d('0x45')](_0x18d1ff)[_0x099d('0x25')](handleEntityNotFound(_0x5773da,null))['then'](respondWithResult(_0x5773da,null))['catch'](handleError(_0x5773da,null));};exports[_0x099d('0x46')]=function(_0x460a61,_0x2b20fa){return db[_0x099d('0x2b')][_0x099d('0x46')](_0x460a61['body'],{})[_0x099d('0x25')](respondWithResult(_0x2b20fa,0xc9))['catch'](handleError(_0x2b20fa,null));};exports[_0x099d('0x23')]=function(_0x1b80d6,_0xe47a27){if(_0x1b80d6[_0x099d('0x47')]['id']){delete _0x1b80d6[_0x099d('0x47')]['id'];}return db[_0x099d('0x2b')][_0x099d('0x45')]({'where':{'id':_0x1b80d6[_0x099d('0x40')]['id']}})['then'](handleEntityNotFound(_0xe47a27,null))[_0x099d('0x25')](saveUpdates(_0x1b80d6[_0x099d('0x47')],null))[_0x099d('0x25')](respondWithResult(_0xe47a27,null))[_0x099d('0x3e')](handleError(_0xe47a27,null));};exports['destroy']=function(_0x46b2bc,_0x48c458){return db[_0x099d('0x2b')][_0x099d('0x45')]({'where':{'id':_0x46b2bc[_0x099d('0x40')]['id']}})[_0x099d('0x25')](handleEntityNotFound(_0x48c458,null))[_0x099d('0x25')](removeEntity(_0x48c458,null))[_0x099d('0x3e')](handleError(_0x48c458,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6756293..a858de8 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 _0xb4f0=['./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x554f96,_0x2c4b24){var _0x324056=function(_0x33802c){while(--_0x33802c){_0x554f96['push'](_0x554f96['shift']());}};_0x324056(++_0x2c4b24);}(_0xb4f0,0xf3));var _0x0b4f=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0xb4f0[_0x4fa166];return _0x5dd974;};'use strict';var _=require(_0x0b4f('0x0'));var util=require(_0x0b4f('0x1'));var logger=require(_0x0b4f('0x2'))('api');var moment=require(_0x0b4f('0x3'));var BPromise=require(_0x0b4f('0x4'));var rp=require(_0x0b4f('0x5'));var fs=require('fs');var path=require(_0x0b4f('0x6'));var rimraf=require(_0x0b4f('0x7'));var config=require(_0x0b4f('0x8'));var attributes=require(_0x0b4f('0x9'));module['exports']=function(_0x110330,_0x45c420){return _0x110330['define'](_0x0b4f('0xa'),attributes,{'tableName':_0x0b4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x204a=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x204a,0x6e));var _0xa204=function(_0x791adf,_0x332f5c){_0x791adf=_0x791adf-0x0;var _0x4ff1e4=_0x204a[_0x791adf];return _0x4ff1e4;};'use strict';var _=require(_0xa204('0x0'));var util=require(_0xa204('0x1'));var logger=require(_0xa204('0x2'))(_0xa204('0x3'));var moment=require(_0xa204('0x4'));var BPromise=require(_0xa204('0x5'));var rp=require(_0xa204('0x6'));var fs=require('fs');var path=require(_0xa204('0x7'));var rimraf=require(_0xa204('0x8'));var config=require(_0xa204('0x9'));var attributes=require(_0xa204('0xa'));module[_0xa204('0xb')]=function(_0x8d9961,_0x56ab9d){return _0x8d9961[_0xa204('0xc')](_0xa204('0xd'),attributes,{'tableName':_0xa204('0xe'),'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 4b23b9d..59042da 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 _0x7126=['then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2b698c,_0x5bbdd5){var _0x535317=function(_0x2e76c0){while(--_0x2e76c0){_0x2b698c['push'](_0x2b698c['shift']());}};_0x535317(++_0x5bbdd5);}(_0x7126,0x139));var _0x6712=function(_0x119b7b,_0xfb6fef){_0x119b7b=_0x119b7b-0x0;var _0x2ef385=_0x7126[_0x119b7b];return _0x2ef385;};'use strict';var _=require(_0x6712('0x0'));var util=require('util');var moment=require(_0x6712('0x1'));var BPromise=require(_0x6712('0x2'));var rs=require(_0x6712('0x3'));var fs=require('fs');var Redis=require(_0x6712('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6712('0x5'));var logger=require(_0x6712('0x6'))(_0x6712('0x7'));var config=require('../../config/environment');var jayson=require(_0x6712('0x8'));var client=jayson[_0x6712('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58173f,_0x5c2da0,_0x250ff7){return new BPromise(function(_0xf37823,_0x43c108){return client[_0x6712('0xa')](_0x58173f,_0x250ff7)[_0x6712('0xb')](function(_0x1f4d6e){logger[_0x6712('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5c2da0,'request\x20sent');logger[_0x6712('0xd')](_0x6712('0xe'),_0x5c2da0,'request\x20sent',JSON['stringify'](_0x1f4d6e));if(_0x1f4d6e['error']){if(_0x1f4d6e[_0x6712('0xf')]['code']===0x1f4){logger[_0x6712('0xf')](_0x6712('0x10'),_0x5c2da0,_0x1f4d6e[_0x6712('0xf')][_0x6712('0x11')]);return _0x43c108(_0x1f4d6e[_0x6712('0xf')][_0x6712('0x11')]);}logger['error'](_0x6712('0x10'),_0x5c2da0,_0x1f4d6e[_0x6712('0xf')][_0x6712('0x11')]);return _0xf37823(_0x1f4d6e[_0x6712('0xf')][_0x6712('0x11')]);}else{logger['info'](_0x6712('0x10'),_0x5c2da0,_0x6712('0x12'));_0xf37823(_0x1f4d6e[_0x6712('0x13')][_0x6712('0x11')]);}})[_0x6712('0x14')](function(_0x256965){logger[_0x6712('0xf')]('SquareMessage,\x20%s,\x20%s',_0x5c2da0,_0x256965);_0x43c108(_0x256965);});});}exports[_0x6712('0x15')]=function(_0x5d502c){var _0x96f26a=this;return new Promise(function(_0x4bbe67,_0x416cb9){return db[_0x6712('0x16')]['create'](_0x5d502c[_0x6712('0x17')],{'raw':_0x5d502c['options']?_0x5d502c[_0x6712('0x18')][_0x6712('0x19')]===undefined?!![]:![]:!![]})[_0x6712('0xb')](function(_0x3f1c8d){logger[_0x6712('0xc')](_0x6712('0x15'),_0x5d502c);logger[_0x6712('0xd')](_0x6712('0x15'),_0x5d502c,JSON[_0x6712('0x1a')](_0x3f1c8d));_0x4bbe67(_0x3f1c8d);})['catch'](function(_0x2bf31a){logger['error'](_0x6712('0x15'),_0x2bf31a[_0x6712('0x11')],_0x5d502c);_0x416cb9(_0x96f26a[_0x6712('0xf')](0x1f4,_0x2bf31a['message']));});});}; \ No newline at end of file +var _0x619f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','moment','randomstring'];(function(_0x47e18e,_0x5a6ead){var _0x2232f3=function(_0x1961d0){while(--_0x1961d0){_0x47e18e['push'](_0x47e18e['shift']());}};_0x2232f3(++_0x5a6ead);}(_0x619f,0x1b7));var _0xf619=function(_0xae9462,_0x3fe448){_0xae9462=_0xae9462-0x0;var _0x3aa977=_0x619f[_0xae9462];return _0x3aa977;};'use strict';var _=require(_0xf619('0x0'));var util=require('util');var moment=require(_0xf619('0x1'));var BPromise=require('bluebird');var rs=require(_0xf619('0x2'));var fs=require('fs');var Redis=require(_0xf619('0x3'));var db=require(_0xf619('0x4'))['db'];var utils=require(_0xf619('0x5'));var logger=require('../../config/logger')(_0xf619('0x6'));var config=require(_0xf619('0x7'));var jayson=require(_0xf619('0x8'));var client=jayson[_0xf619('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49d72c,_0x36b06a,_0x2ddfda){return new BPromise(function(_0x9e5919,_0x57b425){return client[_0xf619('0xa')](_0x49d72c,_0x2ddfda)[_0xf619('0xb')](function(_0x377c86){logger[_0xf619('0xc')](_0xf619('0xd'),_0x36b06a,_0xf619('0xe'));logger[_0xf619('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x36b06a,'request\x20sent',JSON[_0xf619('0x10')](_0x377c86));if(_0x377c86['error']){if(_0x377c86[_0xf619('0x11')][_0xf619('0x12')]===0x1f4){logger[_0xf619('0x11')](_0xf619('0xd'),_0x36b06a,_0x377c86[_0xf619('0x11')][_0xf619('0x13')]);return _0x57b425(_0x377c86['error'][_0xf619('0x13')]);}logger[_0xf619('0x11')](_0xf619('0xd'),_0x36b06a,_0x377c86['error'][_0xf619('0x13')]);return _0x9e5919(_0x377c86[_0xf619('0x11')][_0xf619('0x13')]);}else{logger[_0xf619('0xc')]('SquareMessage,\x20%s,\x20%s',_0x36b06a,_0xf619('0xe'));_0x9e5919(_0x377c86['result'][_0xf619('0x13')]);}})[_0xf619('0x14')](function(_0x445452){logger[_0xf619('0x11')](_0xf619('0xd'),_0x36b06a,_0x445452);_0x57b425(_0x445452);});});}exports[_0xf619('0x15')]=function(_0x114caa){var _0x319bd5=this;return new Promise(function(_0x77e55d,_0x52457e){return db[_0xf619('0x16')][_0xf619('0x17')](_0x114caa[_0xf619('0x18')],{'raw':_0x114caa[_0xf619('0x19')]?_0x114caa[_0xf619('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf619('0xb')](function(_0x561f09){logger[_0xf619('0xc')](_0xf619('0x15'),_0x114caa);logger['debug'](_0xf619('0x15'),_0x114caa,JSON[_0xf619('0x10')](_0x561f09));_0x77e55d(_0x561f09);})[_0xf619('0x14')](function(_0x540992){logger[_0xf619('0x11')](_0xf619('0x15'),_0x540992['message'],_0x114caa);_0x52457e(_0x319bd5[_0xf619('0x11')](0x1f4,_0x540992[_0xf619('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index d44a500..a731438 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 _0xdc00=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xdc00,0x76));var _0x0dc0=function(_0x342e46,_0x228c84){_0x342e46=_0x342e46-0x0;var _0x38f4e6=_0xdc00[_0x342e46];return _0x38f4e6;};'use strict';var multer=require(_0x0dc0('0x0'));var util=require(_0x0dc0('0x1'));var path=require(_0x0dc0('0x2'));var timeout=require(_0x0dc0('0x3'));var express=require(_0x0dc0('0x4'));var router=express[_0x0dc0('0x5')]();var fs_extra=require(_0x0dc0('0x6'));var auth=require(_0x0dc0('0x7'));var interaction=require(_0x0dc0('0x8'));var config=require(_0x0dc0('0x9'));var controller=require(_0x0dc0('0xa'));router[_0x0dc0('0xb')]('/',auth[_0x0dc0('0xc')](),controller[_0x0dc0('0xd')]);router['get'](_0x0dc0('0xe'),auth[_0x0dc0('0xc')](),controller[_0x0dc0('0xf')]);router[_0x0dc0('0xb')]('/:id/test',auth[_0x0dc0('0xc')](),timeout(_0x0dc0('0x10')),controller[_0x0dc0('0x11')]);router[_0x0dc0('0x12')]('/',auth[_0x0dc0('0xc')](),controller[_0x0dc0('0x13')]);router[_0x0dc0('0x14')](_0x0dc0('0xe'),auth[_0x0dc0('0xc')](),controller['update']);router[_0x0dc0('0x15')]('/:id',auth[_0x0dc0('0xc')](),controller[_0x0dc0('0x16')]);module[_0x0dc0('0x17')]=router; \ No newline at end of file +var _0xcf41=['post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','/:id','isAuthenticated','/:id/test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf41,0x15c));var _0x1cf4=function(_0x5756c2,_0xa04087){_0x5756c2=_0x5756c2-0x0;var _0xb2ae91=_0xcf41[_0x5756c2];return _0xb2ae91;};'use strict';var multer=require(_0x1cf4('0x0'));var util=require('util');var path=require(_0x1cf4('0x1'));var timeout=require(_0x1cf4('0x2'));var express=require('express');var router=express[_0x1cf4('0x3')]();var fs_extra=require(_0x1cf4('0x4'));var auth=require(_0x1cf4('0x5'));var interaction=require(_0x1cf4('0x6'));var config=require('../../config/environment');var controller=require(_0x1cf4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1cf4('0x8')](_0x1cf4('0x9'),auth[_0x1cf4('0xa')](),controller['show']);router[_0x1cf4('0x8')](_0x1cf4('0xb'),auth[_0x1cf4('0xa')](),timeout('15s'),controller['test']);router[_0x1cf4('0xc')]('/',auth[_0x1cf4('0xa')](),controller[_0x1cf4('0xd')]);router[_0x1cf4('0xe')](_0x1cf4('0x9'),auth[_0x1cf4('0xa')](),controller[_0x1cf4('0xf')]);router[_0x1cf4('0x10')](_0x1cf4('0x9'),auth[_0x1cf4('0xa')](),controller[_0x1cf4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d3390b1..7f24a33 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 _0xe30a=['exports','STRING','name','sequelize'];(function(_0x2c3e87,_0x2fe07b){var _0x1f7070=function(_0x1e1736){while(--_0x1e1736){_0x2c3e87['push'](_0x2c3e87['shift']());}};_0x1f7070(++_0x2fe07b);}(_0xe30a,0x1af));var _0xae30=function(_0x5975f2,_0x1f8a8c){_0x5975f2=_0x5975f2-0x0;var _0x5cc65f=_0xe30a[_0x5975f2];return _0x5cc65f;};'use strict';var Sequelize=require(_0xae30('0x0'));module[_0xae30('0x1')]={'name':{'type':Sequelize[_0xae30('0x2')],'unique':_0xae30('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae30('0x2')]}}; \ No newline at end of file +var _0x817b=['name','STRING'];(function(_0x4b473d,_0x26561){var _0x1e1b73=function(_0x311ddd){while(--_0x311ddd){_0x4b473d['push'](_0x4b473d['shift']());}};_0x1e1b73(++_0x26561);}(_0x817b,0x1df));var _0xb817=function(_0x12dd1e,_0x28962a){_0x12dd1e=_0x12dd1e-0x0;var _0x383061=_0x817b[_0x12dd1e];return _0x383061;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb817('0x0')],'unique':_0xb817('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb817('0x0')]},'description':{'type':Sequelize[_0xb817('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1bdb6e1..ca63ff0 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 _0xa7b4=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','get','ODBC','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','SquareOdbc','includeAll','findAll','rows','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','test','odbc','openSync','dsn','closeSync','eml-format','zip-dir'];(function(_0x17e3c7,_0x1cfc59){var _0x4e0af9=function(_0x19ae5b){while(--_0x19ae5b){_0x17e3c7['push'](_0x17e3c7['shift']());}};_0x4e0af9(++_0x1cfc59);}(_0xa7b4,0x10c));var _0x4a7b=function(_0x2d7484,_0x1b8083){_0x2d7484=_0x2d7484-0x0;var _0x8d13bc=_0xa7b4[_0x2d7484];return _0x8d13bc;};'use strict';var emlformat=require(_0x4a7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a7b('0x1'));var jsonpatch=require(_0x4a7b('0x2'));var rp=require(_0x4a7b('0x3'));var moment=require(_0x4a7b('0x4'));var BPromise=require(_0x4a7b('0x5'));var Mustache=require(_0x4a7b('0x6'));var util=require(_0x4a7b('0x7'));var path=require(_0x4a7b('0x8'));var sox=require(_0x4a7b('0x9'));var csv=require(_0x4a7b('0xa'));var ejs=require(_0x4a7b('0xb'));var fs=require('fs');var fs_extra=require(_0x4a7b('0xc'));var _=require(_0x4a7b('0xd'));var squel=require(_0x4a7b('0xe'));var crypto=require(_0x4a7b('0xf'));var jsforce=require(_0x4a7b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4a7b('0xa'));var querystring=require(_0x4a7b('0x11'));var Papa=require('papaparse');var Redis=require(_0x4a7b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4a7b('0x13'));var as=require(_0x4a7b('0x14'));var hardwareService=require(_0x4a7b('0x15'));var logger=require('../../config/logger')(_0x4a7b('0x16'));var utils=require('../../config/utils');var config=require(_0x4a7b('0x17'));var licenseUtil=require(_0x4a7b('0x18'));var db=require(_0x4a7b('0x19'))['db'];function respondWithStatusCode(_0x529f97,_0x3a2a52){_0x3a2a52=_0x3a2a52||0xcc;return function(_0x4738ba){if(_0x4738ba){return _0x529f97[_0x4a7b('0x1a')](_0x3a2a52);}return _0x529f97[_0x4a7b('0x1b')](_0x3a2a52)['end']();};}function respondWithResult(_0x128753,_0x81a051){_0x81a051=_0x81a051||0xc8;return function(_0x517702){if(_0x517702){return _0x128753[_0x4a7b('0x1b')](_0x81a051)[_0x4a7b('0x1c')](_0x517702);}};}function respondWithFilteredResult(_0x5f3c6e,_0x458831){return function(_0x32d3e6){if(_0x32d3e6){var _0x1928ab=typeof _0x458831[_0x4a7b('0x1d')]==='undefined'&&typeof _0x458831['limit']===_0x4a7b('0x1e');var _0x553a75=_0x32d3e6[_0x4a7b('0x1f')];var _0x5c3d45=_0x1928ab?0x0:_0x458831[_0x4a7b('0x1d')];var _0x5097f7=_0x1928ab?_0x32d3e6[_0x4a7b('0x1f')]:_0x458831[_0x4a7b('0x1d')]+_0x458831[_0x4a7b('0x20')];var _0xc5d5e6;if(_0x5097f7>=_0x553a75){_0x5097f7=_0x553a75;_0xc5d5e6=0xc8;}else{_0xc5d5e6=0xce;}_0x5f3c6e[_0x4a7b('0x1b')](_0xc5d5e6);return _0x5f3c6e[_0x4a7b('0x21')](_0x4a7b('0x22'),_0x5c3d45+'-'+_0x5097f7+'/'+_0x553a75)[_0x4a7b('0x1c')](_0x32d3e6);}return null;};}function patchUpdates(_0x5b233c){return function(_0x2d589c){try{jsonpatch['apply'](_0x2d589c,_0x5b233c,!![]);}catch(_0x3f70ee){return BPromise[_0x4a7b('0x23')](_0x3f70ee);}return _0x2d589c['save']();};}function saveUpdates(_0x6ce7bc,_0x523a69){return function(_0x626ec3){if(_0x626ec3){return _0x626ec3['update'](_0x6ce7bc)[_0x4a7b('0x24')](function(_0x1b6dc1){return _0x1b6dc1;});}return null;};}function removeEntity(_0x42e507,_0x1ffa01){return function(_0x53ca5c){if(_0x53ca5c){return _0x53ca5c[_0x4a7b('0x25')]()[_0x4a7b('0x24')](function(){var _0x3a8836=_0x53ca5c[_0x4a7b('0x26')]({'plain':!![]});var _0x20d5ff=_0x4a7b('0x27');return db['UserProfileResource'][_0x4a7b('0x25')]({'where':{'type':_0x20d5ff,'resourceId':_0x3a8836['id']}})['then'](function(){return _0x53ca5c;});})[_0x4a7b('0x24')](function(){_0x42e507['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x328d1f,_0x1ad572){return function(_0x552e1e){if(!_0x552e1e){_0x328d1f['sendStatus'](0x194);}return _0x552e1e;};}function handleError(_0x53a00,_0xd5e37e){_0xd5e37e=_0xd5e37e||0x1f4;return function(_0x1dc66a){logger[_0x4a7b('0x28')](_0x1dc66a[_0x4a7b('0x29')]);if(_0x1dc66a['name']){delete _0x1dc66a[_0x4a7b('0x2a')];}_0x53a00[_0x4a7b('0x1b')](_0xd5e37e)[_0x4a7b('0x2b')](_0x1dc66a);};}exports[_0x4a7b('0x2c')]=function(_0x5b49f8,_0x12e136){var _0x493f60={},_0x544ede={},_0x179321={'count':0x0,'rows':[]};var _0x449298=_['map'](db['SquareOdbc'][_0x4a7b('0x2d')],function(_0x30cacb){return{'name':_0x30cacb['fieldName'],'type':_0x30cacb[_0x4a7b('0x2e')][_0x4a7b('0x2f')]};});_0x544ede[_0x4a7b('0x30')]=_[_0x4a7b('0x31')](_0x449298,_0x4a7b('0x2a'));_0x544ede[_0x4a7b('0x32')]=_[_0x4a7b('0x33')](_0x5b49f8[_0x4a7b('0x32')]);_0x544ede['filters']=_[_0x4a7b('0x34')](_0x544ede[_0x4a7b('0x30')],_0x544ede[_0x4a7b('0x32')]);_0x493f60[_0x4a7b('0x35')]=_[_0x4a7b('0x34')](_0x544ede[_0x4a7b('0x30')],qs[_0x4a7b('0x36')](_0x5b49f8[_0x4a7b('0x32')][_0x4a7b('0x36')]));_0x493f60[_0x4a7b('0x35')]=_0x493f60[_0x4a7b('0x35')][_0x4a7b('0x37')]?_0x493f60[_0x4a7b('0x35')]:_0x544ede[_0x4a7b('0x30')];if(!_0x5b49f8['query'][_0x4a7b('0x38')](_0x4a7b('0x39'))){_0x493f60['limit']=qs[_0x4a7b('0x20')](_0x5b49f8['query'][_0x4a7b('0x20')]);_0x493f60[_0x4a7b('0x1d')]=qs[_0x4a7b('0x1d')](_0x5b49f8[_0x4a7b('0x32')][_0x4a7b('0x1d')]);}_0x493f60['order']=qs[_0x4a7b('0x3a')](_0x5b49f8[_0x4a7b('0x32')][_0x4a7b('0x3a')]);_0x493f60[_0x4a7b('0x3b')]=qs[_0x4a7b('0x3c')](_[_0x4a7b('0x3d')](_0x5b49f8['query'],_0x544ede[_0x4a7b('0x3c')]),_0x449298);if(_0x5b49f8[_0x4a7b('0x32')][_0x4a7b('0x3e')]){_0x493f60['where']=_['merge'](_0x493f60[_0x4a7b('0x3b')],{'$or':_[_0x4a7b('0x31')](_0x449298,function(_0xb54420){if(_0xb54420['type']!==_0x4a7b('0x3f')){var _0x14a0f7={};_0x14a0f7[_0xb54420[_0x4a7b('0x2a')]]={'$like':'%'+_0x5b49f8[_0x4a7b('0x32')]['filter']+'%'};return _0x14a0f7;}})});}_0x493f60=_[_0x4a7b('0x40')]({},_0x493f60,_0x5b49f8[_0x4a7b('0x41')]);var _0x5cd6f6={'where':_0x493f60['where']};return db[_0x4a7b('0x42')][_0x4a7b('0x1f')](_0x5cd6f6)[_0x4a7b('0x24')](function(_0x3e30c2){_0x179321['count']=_0x3e30c2;if(_0x5b49f8[_0x4a7b('0x32')][_0x4a7b('0x43')]){_0x493f60['include']=[{'all':!![]}];}return db[_0x4a7b('0x42')][_0x4a7b('0x44')](_0x493f60);})[_0x4a7b('0x24')](function(_0x59760e){_0x179321[_0x4a7b('0x45')]=_0x59760e;return _0x179321;})[_0x4a7b('0x24')](respondWithFilteredResult(_0x12e136,_0x493f60))[_0x4a7b('0x46')](handleError(_0x12e136,null));};exports[_0x4a7b('0x47')]=function(_0x142dcf,_0x151621){var _0xa4b87b={'raw':!![],'where':{'id':_0x142dcf[_0x4a7b('0x48')]['id']}},_0x323878={};_0x323878[_0x4a7b('0x30')]=_[_0x4a7b('0x33')](db[_0x4a7b('0x42')][_0x4a7b('0x2d')]);_0x323878[_0x4a7b('0x32')]=_['keys'](_0x142dcf['query']);_0x323878[_0x4a7b('0x3c')]=_[_0x4a7b('0x34')](_0x323878['model'],_0x323878[_0x4a7b('0x32')]);_0xa4b87b[_0x4a7b('0x35')]=_[_0x4a7b('0x34')](_0x323878[_0x4a7b('0x30')],qs[_0x4a7b('0x36')](_0x142dcf[_0x4a7b('0x32')][_0x4a7b('0x36')]));_0xa4b87b[_0x4a7b('0x35')]=_0xa4b87b[_0x4a7b('0x35')][_0x4a7b('0x37')]?_0xa4b87b[_0x4a7b('0x35')]:_0x323878[_0x4a7b('0x30')];if(_0x142dcf[_0x4a7b('0x32')]['includeAll']){_0xa4b87b[_0x4a7b('0x49')]=[{'all':!![]}];}_0xa4b87b=_[_0x4a7b('0x40')]({},_0xa4b87b,_0x142dcf['options']);return db['SquareOdbc']['find'](_0xa4b87b)[_0x4a7b('0x24')](handleEntityNotFound(_0x151621,null))[_0x4a7b('0x24')](respondWithResult(_0x151621,null))[_0x4a7b('0x46')](handleError(_0x151621,null));};exports['create']=function(_0x337b62,_0x4b98cb){return db['SquareOdbc'][_0x4a7b('0x4a')](_0x337b62['body'],{})[_0x4a7b('0x24')](function(_0x58986e){var _0x79a813=_0x337b62[_0x4a7b('0x4b')]['get']({'plain':!![]});if(!_0x79a813)throw new Error(_0x4a7b('0x4c'));if(_0x79a813[_0x4a7b('0x4d')]===_0x4a7b('0x4b')){var _0x179e8c=_0x58986e[_0x4a7b('0x26')]({'plain':!![]});var _0xa370c4=_0x4a7b('0x27');return db[_0x4a7b('0x4e')]['find']({'where':{'name':_0xa370c4,'userProfileId':_0x79a813[_0x4a7b('0x4f')]},'raw':!![]})[_0x4a7b('0x24')](function(_0x13ff12){if(_0x13ff12&&_0x13ff12[_0x4a7b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x179e8c[_0x4a7b('0x2a')],'resourceId':_0x179e8c['id'],'type':_0x13ff12['name'],'sectionId':_0x13ff12['id']},{})[_0x4a7b('0x24')](function(){return _0x58986e;});}else{return _0x58986e;}})[_0x4a7b('0x46')](function(_0x5263cb){logger['error'](_0x4a7b('0x51'),_0x5263cb);throw _0x5263cb;});}return _0x58986e;})[_0x4a7b('0x24')](respondWithResult(_0x4b98cb,0xc9))['catch'](handleError(_0x4b98cb,null));};exports[_0x4a7b('0x52')]=function(_0x1aa1c5,_0x2218a7){if(_0x1aa1c5[_0x4a7b('0x53')]['id']){delete _0x1aa1c5[_0x4a7b('0x53')]['id'];}return db['SquareOdbc'][_0x4a7b('0x54')]({'where':{'id':_0x1aa1c5[_0x4a7b('0x48')]['id']}})[_0x4a7b('0x24')](handleEntityNotFound(_0x2218a7,null))[_0x4a7b('0x24')](saveUpdates(_0x1aa1c5[_0x4a7b('0x53')],null))['then'](respondWithResult(_0x2218a7,null))[_0x4a7b('0x46')](handleError(_0x2218a7,null));};exports[_0x4a7b('0x25')]=function(_0x2b215b,_0x54d2f7){return db['SquareOdbc'][_0x4a7b('0x54')]({'where':{'id':_0x2b215b[_0x4a7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x54d2f7,null))['then'](removeEntity(_0x54d2f7,null))[_0x4a7b('0x46')](handleError(_0x54d2f7,null));};exports[_0x4a7b('0x55')]=function(_0x95f81e,_0x47053d,_0x40b4e6){var _0x232df9;return db[_0x4a7b('0x42')][_0x4a7b('0x54')]({'where':{'id':_0x95f81e[_0x4a7b('0x48')]['id']},'attributes':['id','dsn']})[_0x4a7b('0x24')](handleEntityNotFound(_0x47053d,null))[_0x4a7b('0x24')](function(_0x12eedc){if(_0x12eedc){var _0x3c2a42=require(_0x4a7b('0x56'))();_0x3c2a42[_0x4a7b('0x57')](_0x12eedc[_0x4a7b('0x58')]);_0x3c2a42[_0x4a7b('0x59')]();return _0x12eedc;}})[_0x4a7b('0x24')](respondWithResult(_0x47053d,null))[_0x4a7b('0x46')](handleError(_0x47053d,null));}; \ No newline at end of file +var _0x65c8=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','sendStatus','error','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','openSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x1a43ec,_0x4a9482){var _0x15b555=function(_0x1915a9){while(--_0x1915a9){_0x1a43ec['push'](_0x1a43ec['shift']());}};_0x15b555(++_0x4a9482);}(_0x65c8,0x93));var _0x865c=function(_0x54a8af,_0x17d6bb){_0x54a8af=_0x54a8af-0x0;var _0x1c6284=_0x65c8[_0x54a8af];return _0x1c6284;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x865c('0x0'));var zipdir=require(_0x865c('0x1'));var jsonpatch=require(_0x865c('0x2'));var rp=require(_0x865c('0x3'));var moment=require(_0x865c('0x4'));var BPromise=require(_0x865c('0x5'));var Mustache=require(_0x865c('0x6'));var util=require(_0x865c('0x7'));var path=require(_0x865c('0x8'));var sox=require(_0x865c('0x9'));var csv=require(_0x865c('0xa'));var ejs=require(_0x865c('0xb'));var fs=require('fs');var fs_extra=require(_0x865c('0xc'));var _=require(_0x865c('0xd'));var squel=require(_0x865c('0xe'));var crypto=require(_0x865c('0xf'));var jsforce=require(_0x865c('0x10'));var deskjs=require(_0x865c('0x11'));var toCsv=require(_0x865c('0xa'));var querystring=require(_0x865c('0x12'));var Papa=require('papaparse');var Redis=require(_0x865c('0x13'));var authService=require(_0x865c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x865c('0x15'));var hardwareService=require(_0x865c('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x865c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x865c('0x18'));var db=require(_0x865c('0x19'))['db'];function respondWithStatusCode(_0x4b9418,_0x3c0408){_0x3c0408=_0x3c0408||0xcc;return function(_0x1cf36b){if(_0x1cf36b){return _0x4b9418['sendStatus'](_0x3c0408);}return _0x4b9418[_0x865c('0x1a')](_0x3c0408)[_0x865c('0x1b')]();};}function respondWithResult(_0x366682,_0x5966b5){_0x5966b5=_0x5966b5||0xc8;return function(_0x594c86){if(_0x594c86){return _0x366682[_0x865c('0x1a')](_0x5966b5)[_0x865c('0x1c')](_0x594c86);}};}function respondWithFilteredResult(_0x186bf2,_0x1e9c45){return function(_0x2dcd37){if(_0x2dcd37){var _0xc2b593=typeof _0x1e9c45[_0x865c('0x1d')]===_0x865c('0x1e')&&typeof _0x1e9c45[_0x865c('0x1f')]==='undefined';var _0x18d0e8=_0x2dcd37[_0x865c('0x20')];var _0x4a4527=_0xc2b593?0x0:_0x1e9c45[_0x865c('0x1d')];var _0x5360d5=_0xc2b593?_0x2dcd37[_0x865c('0x20')]:_0x1e9c45[_0x865c('0x1d')]+_0x1e9c45['limit'];var _0x4ab666;if(_0x5360d5>=_0x18d0e8){_0x5360d5=_0x18d0e8;_0x4ab666=0xc8;}else{_0x4ab666=0xce;}_0x186bf2[_0x865c('0x1a')](_0x4ab666);return _0x186bf2['set'](_0x865c('0x21'),_0x4a4527+'-'+_0x5360d5+'/'+_0x18d0e8)['json'](_0x2dcd37);}return null;};}function patchUpdates(_0x4a39d3){return function(_0x17f070){try{jsonpatch[_0x865c('0x22')](_0x17f070,_0x4a39d3,!![]);}catch(_0x2c49be){return BPromise[_0x865c('0x23')](_0x2c49be);}return _0x17f070[_0x865c('0x24')]();};}function saveUpdates(_0x27d25a,_0x26e65a){return function(_0x123d1e){if(_0x123d1e){return _0x123d1e[_0x865c('0x25')](_0x27d25a)[_0x865c('0x26')](function(_0x25be09){return _0x25be09;});}return null;};}function removeEntity(_0xcfbd6c,_0x287a46){return function(_0x296b15){if(_0x296b15){return _0x296b15[_0x865c('0x27')]()['then'](function(){var _0x4e572f=_0x296b15['get']({'plain':!![]});var _0x2d5cc0=_0x865c('0x28');return db[_0x865c('0x29')][_0x865c('0x27')]({'where':{'type':_0x2d5cc0,'resourceId':_0x4e572f['id']}})[_0x865c('0x26')](function(){return _0x296b15;});})[_0x865c('0x26')](function(){_0xcfbd6c[_0x865c('0x1a')](0xcc)[_0x865c('0x1b')]();});}};}function handleEntityNotFound(_0xe806f9,_0x72823b){return function(_0x11c532){if(!_0x11c532){_0xe806f9[_0x865c('0x2a')](0x194);}return _0x11c532;};}function handleError(_0x3b2e93,_0x117169){_0x117169=_0x117169||0x1f4;return function(_0x1b1d91){logger[_0x865c('0x2b')](_0x1b1d91['stack']);if(_0x1b1d91[_0x865c('0x2c')]){delete _0x1b1d91[_0x865c('0x2c')];}_0x3b2e93[_0x865c('0x1a')](_0x117169)['send'](_0x1b1d91);};}exports[_0x865c('0x2d')]=function(_0x390ddd,_0x1fc5b8){var _0x16aca5={},_0x103334={},_0x4b1fb9={'count':0x0,'rows':[]};var _0x531b8c=_[_0x865c('0x2e')](db[_0x865c('0x2f')][_0x865c('0x30')],function(_0x100d03){return{'name':_0x100d03[_0x865c('0x31')],'type':_0x100d03[_0x865c('0x32')]['key']};});_0x103334[_0x865c('0x33')]=_['map'](_0x531b8c,'name');_0x103334['query']=_[_0x865c('0x34')](_0x390ddd[_0x865c('0x35')]);_0x103334['filters']=_['intersection'](_0x103334[_0x865c('0x33')],_0x103334[_0x865c('0x35')]);_0x16aca5['attributes']=_['intersection'](_0x103334[_0x865c('0x33')],qs[_0x865c('0x36')](_0x390ddd[_0x865c('0x35')][_0x865c('0x36')]));_0x16aca5['attributes']=_0x16aca5[_0x865c('0x37')][_0x865c('0x38')]?_0x16aca5[_0x865c('0x37')]:_0x103334['model'];if(!_0x390ddd['query'][_0x865c('0x39')](_0x865c('0x3a'))){_0x16aca5[_0x865c('0x1f')]=qs['limit'](_0x390ddd[_0x865c('0x35')][_0x865c('0x1f')]);_0x16aca5[_0x865c('0x1d')]=qs[_0x865c('0x1d')](_0x390ddd[_0x865c('0x35')]['offset']);}_0x16aca5['order']=qs[_0x865c('0x3b')](_0x390ddd[_0x865c('0x35')][_0x865c('0x3b')]);_0x16aca5['where']=qs[_0x865c('0x3c')](_[_0x865c('0x3d')](_0x390ddd['query'],_0x103334['filters']),_0x531b8c);if(_0x390ddd[_0x865c('0x35')][_0x865c('0x3e')]){_0x16aca5[_0x865c('0x3f')]=_['merge'](_0x16aca5[_0x865c('0x3f')],{'$or':_[_0x865c('0x2e')](_0x531b8c,function(_0x2d4c03){if(_0x2d4c03['type']!==_0x865c('0x40')){var _0x5be3dd={};_0x5be3dd[_0x2d4c03['name']]={'$like':'%'+_0x390ddd[_0x865c('0x35')][_0x865c('0x3e')]+'%'};return _0x5be3dd;}})});}_0x16aca5=_[_0x865c('0x41')]({},_0x16aca5,_0x390ddd[_0x865c('0x42')]);var _0x50d405={'where':_0x16aca5[_0x865c('0x3f')]};return db[_0x865c('0x2f')][_0x865c('0x20')](_0x50d405)[_0x865c('0x26')](function(_0x34bcae){_0x4b1fb9[_0x865c('0x20')]=_0x34bcae;if(_0x390ddd[_0x865c('0x35')][_0x865c('0x43')]){_0x16aca5[_0x865c('0x44')]=[{'all':!![]}];}return db[_0x865c('0x2f')][_0x865c('0x45')](_0x16aca5);})[_0x865c('0x26')](function(_0x280bc){_0x4b1fb9[_0x865c('0x46')]=_0x280bc;return _0x4b1fb9;})[_0x865c('0x26')](respondWithFilteredResult(_0x1fc5b8,_0x16aca5))[_0x865c('0x47')](handleError(_0x1fc5b8,null));};exports[_0x865c('0x48')]=function(_0x1c9ef9,_0x2a8860){var _0x46cbd6={'raw':!![],'where':{'id':_0x1c9ef9['params']['id']}},_0x5c3a85={};_0x5c3a85[_0x865c('0x33')]=_[_0x865c('0x34')](db[_0x865c('0x2f')][_0x865c('0x30')]);_0x5c3a85[_0x865c('0x35')]=_[_0x865c('0x34')](_0x1c9ef9[_0x865c('0x35')]);_0x5c3a85[_0x865c('0x3c')]=_[_0x865c('0x49')](_0x5c3a85[_0x865c('0x33')],_0x5c3a85[_0x865c('0x35')]);_0x46cbd6[_0x865c('0x37')]=_['intersection'](_0x5c3a85[_0x865c('0x33')],qs[_0x865c('0x36')](_0x1c9ef9[_0x865c('0x35')][_0x865c('0x36')]));_0x46cbd6[_0x865c('0x37')]=_0x46cbd6[_0x865c('0x37')][_0x865c('0x38')]?_0x46cbd6[_0x865c('0x37')]:_0x5c3a85[_0x865c('0x33')];if(_0x1c9ef9[_0x865c('0x35')][_0x865c('0x43')]){_0x46cbd6['include']=[{'all':!![]}];}_0x46cbd6=_[_0x865c('0x41')]({},_0x46cbd6,_0x1c9ef9[_0x865c('0x42')]);return db[_0x865c('0x2f')][_0x865c('0x4a')](_0x46cbd6)[_0x865c('0x26')](handleEntityNotFound(_0x2a8860,null))[_0x865c('0x26')](respondWithResult(_0x2a8860,null))['catch'](handleError(_0x2a8860,null));};exports[_0x865c('0x4b')]=function(_0x653a5c,_0x4aee1a){return db['SquareOdbc'][_0x865c('0x4b')](_0x653a5c['body'],{})[_0x865c('0x26')](function(_0x43998d){var _0x371834=_0x653a5c[_0x865c('0x4c')]['get']({'plain':!![]});if(!_0x371834)throw new Error(_0x865c('0x4d'));if(_0x371834[_0x865c('0x4e')]===_0x865c('0x4c')){var _0x4530b1=_0x43998d['get']({'plain':!![]});var _0x1ce3c9='ODBC';return db[_0x865c('0x4f')]['find']({'where':{'name':_0x1ce3c9,'userProfileId':_0x371834['userProfileId']},'raw':!![]})['then'](function(_0x3e500a){if(_0x3e500a&&_0x3e500a['autoAssociation']===0x0){return db[_0x865c('0x29')]['create']({'name':_0x4530b1[_0x865c('0x2c')],'resourceId':_0x4530b1['id'],'type':_0x3e500a[_0x865c('0x2c')],'sectionId':_0x3e500a['id']},{})[_0x865c('0x26')](function(){return _0x43998d;});}else{return _0x43998d;}})[_0x865c('0x47')](function(_0xe63d17){logger[_0x865c('0x2b')](_0x865c('0x50'),_0xe63d17);throw _0xe63d17;});}return _0x43998d;})[_0x865c('0x26')](respondWithResult(_0x4aee1a,0xc9))['catch'](handleError(_0x4aee1a,null));};exports[_0x865c('0x25')]=function(_0x2ece00,_0x14bc37){if(_0x2ece00[_0x865c('0x51')]['id']){delete _0x2ece00[_0x865c('0x51')]['id'];}return db[_0x865c('0x2f')][_0x865c('0x4a')]({'where':{'id':_0x2ece00[_0x865c('0x52')]['id']}})[_0x865c('0x26')](handleEntityNotFound(_0x14bc37,null))[_0x865c('0x26')](saveUpdates(_0x2ece00[_0x865c('0x51')],null))[_0x865c('0x26')](respondWithResult(_0x14bc37,null))[_0x865c('0x47')](handleError(_0x14bc37,null));};exports['destroy']=function(_0x5d0b8b,_0x42c179){return db[_0x865c('0x2f')]['find']({'where':{'id':_0x5d0b8b['params']['id']}})['then'](handleEntityNotFound(_0x42c179,null))[_0x865c('0x26')](removeEntity(_0x42c179,null))[_0x865c('0x47')](handleError(_0x42c179,null));};exports[_0x865c('0x53')]=function(_0x2fa675,_0x1398a8,_0x295cbe){var _0x1c50a0;return db[_0x865c('0x2f')][_0x865c('0x4a')]({'where':{'id':_0x2fa675['params']['id']},'attributes':['id',_0x865c('0x54')]})[_0x865c('0x26')](handleEntityNotFound(_0x1398a8,null))[_0x865c('0x26')](function(_0x480a18){if(_0x480a18){var _0x1c3d63=require(_0x865c('0x55'))();_0x1c3d63[_0x865c('0x56')](_0x480a18[_0x865c('0x54')]);_0x1c3d63['closeSync']();return _0x480a18;}})[_0x865c('0x26')](respondWithResult(_0x1398a8,null))['catch'](handleError(_0x1398a8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1ad326d..fe08739 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 _0x2ad4=['lodash','util','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc'];(function(_0x3031a2,_0x4acf71){var _0x457f96=function(_0x1003f1){while(--_0x1003f1){_0x3031a2['push'](_0x3031a2['shift']());}};_0x457f96(++_0x4acf71);}(_0x2ad4,0xbd));var _0x42ad=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x2ad4[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x42ad('0x2'));var fs=require('fs');var path=require(_0x42ad('0x3'));var rimraf=require(_0x42ad('0x4'));var config=require(_0x42ad('0x5'));var attributes=require(_0x42ad('0x6'));module['exports']=function(_0x247410,_0x1c30c8){return _0x247410[_0x42ad('0x7')](_0x42ad('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9437=['moment','bluebird','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x1d664f,_0x55c9c4){var _0x5663f9=function(_0x47737a){while(--_0x47737a){_0x1d664f['push'](_0x1d664f['shift']());}};_0x5663f9(++_0x55c9c4);}(_0x9437,0xb8));var _0x7943=function(_0xfdd097,_0x4158ae){_0xfdd097=_0xfdd097-0x0;var _0x15234=_0x9437[_0xfdd097];return _0x15234;};'use strict';var _=require(_0x7943('0x0'));var util=require(_0x7943('0x1'));var logger=require(_0x7943('0x2'))('api');var moment=require(_0x7943('0x3'));var BPromise=require(_0x7943('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7943('0x5'));var attributes=require(_0x7943('0x6'));module[_0x7943('0x7')]=function(_0x452047,_0x4298b5){return _0x452047[_0x7943('0x8')](_0x7943('0x9'),attributes,{'tableName':_0x7943('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 060be5c..c2f6a52 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 _0x1f0d=['ioredis','../../mysqldb','../../config/logger','jayson/promise','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring'];(function(_0xace3cd,_0x4a514f){var _0x1829ff=function(_0xe46cf2){while(--_0xe46cf2){_0xace3cd['push'](_0xace3cd['shift']());}};_0x1829ff(++_0x4a514f);}(_0x1f0d,0xb5));var _0xd1f0=function(_0x1ad958,_0x1f7646){_0x1ad958=_0x1ad958-0x0;var _0x35be80=_0x1f0d[_0x1ad958];return _0x35be80;};'use strict';var _=require(_0xd1f0('0x0'));var util=require(_0xd1f0('0x1'));var moment=require(_0xd1f0('0x2'));var BPromise=require(_0xd1f0('0x3'));var rs=require(_0xd1f0('0x4'));var fs=require('fs');var Redis=require(_0xd1f0('0x5'));var db=require(_0xd1f0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1f0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd1f0('0x8'));var client=jayson['client'][_0xd1f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3536c9,_0x13fe11,_0x34f36c){return new BPromise(function(_0x5c5514,_0x5a3f96){return client['request'](_0x3536c9,_0x34f36c)[_0xd1f0('0xa')](function(_0x73d22d){logger[_0xd1f0('0xb')](_0xd1f0('0xc'),_0x13fe11,_0xd1f0('0xd'));logger[_0xd1f0('0xe')](_0xd1f0('0xf'),_0x13fe11,_0xd1f0('0xd'),JSON[_0xd1f0('0x10')](_0x73d22d));if(_0x73d22d['error']){if(_0x73d22d[_0xd1f0('0x11')][_0xd1f0('0x12')]===0x1f4){logger['error'](_0xd1f0('0xc'),_0x13fe11,_0x73d22d[_0xd1f0('0x11')]['message']);return _0x5a3f96(_0x73d22d[_0xd1f0('0x11')][_0xd1f0('0x13')]);}logger[_0xd1f0('0x11')](_0xd1f0('0xc'),_0x13fe11,_0x73d22d['error'][_0xd1f0('0x13')]);return _0x5c5514(_0x73d22d['error'][_0xd1f0('0x13')]);}else{logger[_0xd1f0('0xb')](_0xd1f0('0xc'),_0x13fe11,'request\x20sent');_0x5c5514(_0x73d22d[_0xd1f0('0x14')]['message']);}})[_0xd1f0('0x15')](function(_0x1821e4){logger[_0xd1f0('0x11')](_0xd1f0('0xc'),_0x13fe11,_0x1821e4);_0x5a3f96(_0x1821e4);});});}exports[_0xd1f0('0x16')]=function(_0xc2b9bc){var _0x2c58f4=this;return new Promise(function(_0x4611c6,_0x4b1f58){return db['SquareOdbc'][_0xd1f0('0x17')]({'raw':_0xc2b9bc[_0xd1f0('0x18')]?_0xc2b9bc['options'][_0xd1f0('0x19')]===undefined?!![]:![]:!![],'where':_0xc2b9bc[_0xd1f0('0x18')]?_0xc2b9bc['options'][_0xd1f0('0x1a')]||null:null,'attributes':_0xc2b9bc[_0xd1f0('0x18')]?_0xc2b9bc[_0xd1f0('0x18')]['attributes']||null:null,'include':_0xc2b9bc[_0xd1f0('0x18')]?_0xc2b9bc[_0xd1f0('0x18')][_0xd1f0('0x1b')]?_[_0xd1f0('0x1c')](_0xc2b9bc[_0xd1f0('0x18')]['include'],function(_0x4065df){return{'model':db[_0x4065df[_0xd1f0('0x1d')]],'as':_0x4065df['as'],'attributes':_0x4065df[_0xd1f0('0x1e')],'include':_0x4065df[_0xd1f0('0x1b')]?_[_0xd1f0('0x1c')](_0x4065df[_0xd1f0('0x1b')],function(_0x4b058e){return{'model':db[_0x4b058e[_0xd1f0('0x1d')]],'as':_0x4b058e['as'],'attributes':_0x4b058e[_0xd1f0('0x1e')],'include':_0x4b058e['include']?_[_0xd1f0('0x1c')](_0x4b058e['include'],function(_0xb33ab9){return{'model':db[_0xb33ab9['model']],'as':_0xb33ab9['as'],'attributes':_0xb33ab9[_0xd1f0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd1f0('0xa')](function(_0x5c45b1){logger['info'](_0xd1f0('0x16'),_0xc2b9bc);logger[_0xd1f0('0xe')]('ShowSquareOdbc',_0xc2b9bc,JSON[_0xd1f0('0x10')](_0x5c45b1));_0x4611c6(_0x5c45b1);})[_0xd1f0('0x15')](function(_0x56b1f3){logger[_0xd1f0('0x11')]('ShowSquareOdbc',_0x56b1f3[_0xd1f0('0x13')],_0xc2b9bc);_0x4b1f58(_0x2c58f4[_0xd1f0('0x11')](0x1f4,_0x56b1f3['message']));});});}; \ No newline at end of file +var _0x72e8=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x72e8,0x188));var _0x872e=function(_0x3225e3,_0x4573ed){_0x3225e3=_0x3225e3-0x0;var _0x5c45d6=_0x72e8[_0x3225e3];return _0x5c45d6;};'use strict';var _=require('lodash');var util=require(_0x872e('0x0'));var moment=require(_0x872e('0x1'));var BPromise=require(_0x872e('0x2'));var rs=require(_0x872e('0x3'));var fs=require('fs');var Redis=require(_0x872e('0x4'));var db=require(_0x872e('0x5'))['db'];var utils=require(_0x872e('0x6'));var logger=require(_0x872e('0x7'))(_0x872e('0x8'));var config=require(_0x872e('0x9'));var jayson=require(_0x872e('0xa'));var client=jayson[_0x872e('0xb')][_0x872e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b4752,_0x4e7c0f,_0x2265d4){return new BPromise(function(_0x359624,_0x5f5a69){return client['request'](_0x4b4752,_0x2265d4)[_0x872e('0xd')](function(_0x3ff4f3){logger[_0x872e('0xe')](_0x872e('0xf'),_0x4e7c0f,_0x872e('0x10'));logger[_0x872e('0x11')](_0x872e('0x12'),_0x4e7c0f,_0x872e('0x10'),JSON[_0x872e('0x13')](_0x3ff4f3));if(_0x3ff4f3['error']){if(_0x3ff4f3[_0x872e('0x14')]['code']===0x1f4){logger[_0x872e('0x14')](_0x872e('0xf'),_0x4e7c0f,_0x3ff4f3[_0x872e('0x14')][_0x872e('0x15')]);return _0x5f5a69(_0x3ff4f3[_0x872e('0x14')]['message']);}logger[_0x872e('0x14')](_0x872e('0xf'),_0x4e7c0f,_0x3ff4f3[_0x872e('0x14')]['message']);return _0x359624(_0x3ff4f3[_0x872e('0x14')][_0x872e('0x15')]);}else{logger[_0x872e('0xe')](_0x872e('0xf'),_0x4e7c0f,_0x872e('0x10'));_0x359624(_0x3ff4f3[_0x872e('0x16')]['message']);}})['catch'](function(_0x3673d5){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x4e7c0f,_0x3673d5);_0x5f5a69(_0x3673d5);});});}exports[_0x872e('0x17')]=function(_0x4c4e04){var _0x37617e=this;return new Promise(function(_0x531842,_0x2b450d){return db[_0x872e('0x18')][_0x872e('0x19')]({'raw':_0x4c4e04[_0x872e('0x1a')]?_0x4c4e04[_0x872e('0x1a')][_0x872e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c4e04[_0x872e('0x1a')]?_0x4c4e04[_0x872e('0x1a')][_0x872e('0x1c')]||null:null,'attributes':_0x4c4e04[_0x872e('0x1a')]?_0x4c4e04[_0x872e('0x1a')]['attributes']||null:null,'include':_0x4c4e04[_0x872e('0x1a')]?_0x4c4e04[_0x872e('0x1a')][_0x872e('0x1d')]?_[_0x872e('0x1e')](_0x4c4e04[_0x872e('0x1a')][_0x872e('0x1d')],function(_0x423797){return{'model':db[_0x423797[_0x872e('0x1f')]],'as':_0x423797['as'],'attributes':_0x423797[_0x872e('0x20')],'include':_0x423797[_0x872e('0x1d')]?_['map'](_0x423797[_0x872e('0x1d')],function(_0x3a1303){return{'model':db[_0x3a1303[_0x872e('0x1f')]],'as':_0x3a1303['as'],'attributes':_0x3a1303[_0x872e('0x20')],'include':_0x3a1303[_0x872e('0x1d')]?_[_0x872e('0x1e')](_0x3a1303[_0x872e('0x1d')],function(_0x13a6fa){return{'model':db[_0x13a6fa['model']],'as':_0x13a6fa['as'],'attributes':_0x13a6fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x872e('0xd')](function(_0x4dc1ed){logger[_0x872e('0xe')](_0x872e('0x17'),_0x4c4e04);logger[_0x872e('0x11')](_0x872e('0x17'),_0x4c4e04,JSON[_0x872e('0x13')](_0x4dc1ed));_0x531842(_0x4dc1ed);})[_0x872e('0x21')](function(_0x22f0c7){logger[_0x872e('0x14')]('ShowSquareOdbc',_0x22f0c7[_0x872e('0x15')],_0x4c4e04);_0x2b450d(_0x37617e[_0x872e('0x14')](0x1f4,_0x22f0c7[_0x872e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a3e2792..8bd755b 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 _0xa76f=['update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id'];(function(_0xab1438,_0x200d4e){var _0x56cf49=function(_0x5e5ed1){while(--_0x5e5ed1){_0xab1438['push'](_0xab1438['shift']());}};_0x56cf49(++_0x200d4e);}(_0xa76f,0x179));var _0xfa76=function(_0x5db291,_0x436956){_0x5db291=_0x5db291-0x0;var _0x54a80e=_0xa76f[_0x5db291];return _0x54a80e;};'use strict';var multer=require('multer');var util=require(_0xfa76('0x0'));var path=require(_0xfa76('0x1'));var timeout=require(_0xfa76('0x2'));var express=require(_0xfa76('0x3'));var router=express[_0xfa76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfa76('0x5'));var interaction=require(_0xfa76('0x6'));var config=require(_0xfa76('0x7'));var controller=require('./squareProject.controller');router[_0xfa76('0x8')]('/',auth[_0xfa76('0x9')](),controller['index']);router[_0xfa76('0x8')]('/:id',auth[_0xfa76('0x9')](),controller[_0xfa76('0xa')]);router['post']('/',auth[_0xfa76('0x9')](),controller[_0xfa76('0xb')]);router[_0xfa76('0xc')](_0xfa76('0xd'),auth['isAuthenticated'](),controller[_0xfa76('0xe')]);router[_0xfa76('0xf')](_0xfa76('0xd'),auth[_0xfa76('0x9')](),controller['destroy']);module[_0xfa76('0x10')]=router; \ No newline at end of file +var _0x9e21=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareProject.controller','index','isAuthenticated','show','post','create','put','delete','exports'];(function(_0x40a62c,_0xe876f4){var _0x23970e=function(_0x29d52c){while(--_0x29d52c){_0x40a62c['push'](_0x40a62c['shift']());}};_0x23970e(++_0xe876f4);}(_0x9e21,0x1d0));var _0x19e2=function(_0x381c49,_0x12595b){_0x381c49=_0x381c49-0x0;var _0x42db9e=_0x9e21[_0x381c49];return _0x42db9e;};'use strict';var multer=require(_0x19e2('0x0'));var util=require('util');var path=require(_0x19e2('0x1'));var timeout=require(_0x19e2('0x2'));var express=require(_0x19e2('0x3'));var router=express[_0x19e2('0x4')]();var fs_extra=require(_0x19e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x19e2('0x6'));var config=require('../../config/environment');var controller=require(_0x19e2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x19e2('0x8')]);router['get']('/:id',auth[_0x19e2('0x9')](),controller[_0x19e2('0xa')]);router[_0x19e2('0xb')]('/',auth['isAuthenticated'](),controller[_0x19e2('0xc')]);router[_0x19e2('0xd')]('/:id',auth[_0x19e2('0x9')](),controller['update']);router[_0x19e2('0xe')]('/:id',auth[_0x19e2('0x9')](),controller['destroy']);module[_0x19e2('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 29a87d4..a091f4b 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 _0xa707=['STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports'];(function(_0x549d16,_0x4d069a){var _0x344ccc=function(_0x1d992a){while(--_0x1d992a){_0x549d16['push'](_0x549d16['shift']());}};_0x344ccc(++_0x4d069a);}(_0xa707,0x136));var _0x7a70=function(_0x3f2e37,_0x2cc862){_0x3f2e37=_0x3f2e37-0x0;var _0x417930=_0xa707[_0x3f2e37];return _0x417930;};'use strict';var Sequelize=require(_0x7a70('0x0'));module[_0x7a70('0x1')]={'name':{'type':Sequelize[_0x7a70('0x2')],'unique':_0x7a70('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7a70('0x2')]},'notes':{'type':Sequelize[_0x7a70('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x7a70('0x5')),'get':function(){if(this[_0x7a70('0x6')](_0x7a70('0x7'))){return this[_0x7a70('0x6')](_0x7a70('0x7'))[_0x7a70('0x8')](_0x7a70('0x9'));}}},'production':{'type':Sequelize[_0x7a70('0xa')]('long'),'get':function(){if(this[_0x7a70('0x6')](_0x7a70('0xb'))){return this['getDataValue'](_0x7a70('0xb'))[_0x7a70('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x7a70('0xc')]},'publishedAt':{'type':Sequelize[_0x7a70('0xc')]}}; \ No newline at end of file +var _0x5e89=['utf8','production','DATE','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x41958d,_0x3ee800){var _0x521c70=function(_0x80135d){while(--_0x80135d){_0x41958d['push'](_0x41958d['shift']());}};_0x521c70(++_0x3ee800);}(_0x5e89,0x19d));var _0x95e8=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x5e89[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x95e8('0x0')]},'notes':{'type':Sequelize[_0x95e8('0x1')]},'preproduction':{'type':Sequelize[_0x95e8('0x2')](_0x95e8('0x3')),'get':function(){if(this[_0x95e8('0x4')]('preproduction')){return this['getDataValue'](_0x95e8('0x5'))[_0x95e8('0x6')](_0x95e8('0x7'));}}},'production':{'type':Sequelize[_0x95e8('0x2')]('long'),'get':function(){if(this[_0x95e8('0x4')](_0x95e8('0x8'))){return this['getDataValue'](_0x95e8('0x8'))[_0x95e8('0x6')](_0x95e8('0x7'));}}},'savedAt':{'type':Sequelize[_0x95e8('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 3a366a2..c021bea 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 _0x9fb0=['length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','production','lodash','ioredis','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','stack','name','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5d29ad,_0xfcd534){var _0x4c29e8=function(_0x17ad30){while(--_0x17ad30){_0x5d29ad['push'](_0x5d29ad['shift']());}};_0x4c29e8(++_0xfcd534);}(_0x9fb0,0x1b9));var _0x09fb=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x9fb0[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x09fb('0x0'));var Redis=require(_0x09fb('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x09fb('0x2'))('api');var config=require(_0x09fb('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x09fb('0x4')](config[_0x09fb('0x5')],{'host':_0x09fb('0x6'),'port':0x18eb});var socket=require(_0x09fb('0x7'))(new Redis(config[_0x09fb('0x5')]));require(_0x09fb('0x8'))[_0x09fb('0x9')](socket);function respondWithResult(_0x5e078e,_0x4c26b3){_0x4c26b3=_0x4c26b3||0xc8;return function(_0x3c0b27){if(_0x3c0b27){return _0x5e078e[_0x09fb('0xa')](_0x4c26b3)[_0x09fb('0xb')](_0x3c0b27);}};}function respondWithFilteredResult(_0x327a0e,_0x399ccc){return function(_0x526641){if(_0x526641){var _0x5d4595=typeof _0x399ccc['offset']===_0x09fb('0xc')&&typeof _0x399ccc[_0x09fb('0xd')]==='undefined';var _0x327e17=_0x526641['count'];var _0x4861af=_0x5d4595?0x0:_0x399ccc['offset'];var _0x1c920e=_0x5d4595?_0x526641[_0x09fb('0xe')]:_0x399ccc[_0x09fb('0xf')]+_0x399ccc[_0x09fb('0xd')];var _0x5bc658;if(_0x1c920e>=_0x327e17){_0x1c920e=_0x327e17;_0x5bc658=0xc8;}else{_0x5bc658=0xce;}_0x327a0e[_0x09fb('0xa')](_0x5bc658);return _0x327a0e[_0x09fb('0x10')](_0x09fb('0x11'),_0x4861af+'-'+_0x1c920e+'/'+_0x327e17)[_0x09fb('0xb')](_0x526641);}return null;};}function saveUpdates(_0x18d347){return function(_0x5ded37){if(_0x5ded37){return _0x5ded37['update'](_0x18d347)[_0x09fb('0x12')](function(_0x310fb1){return _0x310fb1;});}return null;};}function removeEntity(_0x3eb28d){return function(_0x20b882){if(_0x20b882){return _0x20b882[_0x09fb('0x13')]()['then'](function(){var _0x27aace=_0x20b882[_0x09fb('0x14')]({'plain':!![]});var _0x4f57fc=_0x09fb('0x15');return db[_0x09fb('0x16')]['destroy']({'where':{'type':_0x4f57fc,'resourceId':_0x27aace['id']}})['then'](function(){return _0x20b882;});})[_0x09fb('0x12')](function(){var _0x4dc078=new Redis(config[_0x09fb('0x5')]);_0x4dc078[_0x09fb('0x17')](_0x09fb('0x18'),JSON[_0x09fb('0x19')]({'id':_0x20b882['id'],'deleted':!![]}));})[_0x09fb('0x12')](function(){_0x3eb28d['status'](0xcc)[_0x09fb('0x1a')]();});}};}function handleEntityNotFound(_0x389a94){return function(_0x280138){if(!_0x280138){_0x389a94['sendStatus'](0x194);}return _0x280138;};}function handleError(_0x1bd567,_0x19fe81){_0x19fe81=_0x19fe81||0x1f4;return function(_0x4a5277){logger['error'](_0x4a5277[_0x09fb('0x1b')]);if(_0x4a5277[_0x09fb('0x1c')]){delete _0x4a5277[_0x09fb('0x1c')];}_0x1bd567['status'](_0x19fe81)['send'](_0x4a5277);};}exports[_0x09fb('0x1d')]=function(_0x163f9e,_0x4370f4){var _0xb7110c={},_0x4c5579={},_0x116513={'count':0x0,'rows':[]};var _0x5dd217=_[_0x09fb('0x1e')](db[_0x09fb('0x1f')][_0x09fb('0x20')],function(_0x3a2b61){return{'name':_0x3a2b61['fieldName'],'type':_0x3a2b61[_0x09fb('0x21')][_0x09fb('0x22')]};});_0x4c5579[_0x09fb('0x23')]=_[_0x09fb('0x1e')](_0x5dd217,_0x09fb('0x1c'));_0x4c5579[_0x09fb('0x24')]=_[_0x09fb('0x25')](_0x163f9e['query']);_0x4c5579[_0x09fb('0x26')]=_[_0x09fb('0x27')](_0x4c5579[_0x09fb('0x23')],_0x4c5579['query']);_0xb7110c[_0x09fb('0x28')]=_[_0x09fb('0x27')](_0x4c5579['model'],qs[_0x09fb('0x29')](_0x163f9e['query'][_0x09fb('0x29')]));_0xb7110c[_0x09fb('0x28')]=_0xb7110c[_0x09fb('0x28')][_0x09fb('0x2a')]?_0xb7110c[_0x09fb('0x28')]:_0x4c5579[_0x09fb('0x23')];if(!_0x163f9e[_0x09fb('0x24')]['hasOwnProperty'](_0x09fb('0x2b'))){_0xb7110c[_0x09fb('0xd')]=qs[_0x09fb('0xd')](_0x163f9e[_0x09fb('0x24')]['limit']);_0xb7110c[_0x09fb('0xf')]=qs[_0x09fb('0xf')](_0x163f9e[_0x09fb('0x24')]['offset']);}_0xb7110c['order']=qs[_0x09fb('0x2c')](_0x163f9e[_0x09fb('0x24')]['sort']);_0xb7110c[_0x09fb('0x2d')]=qs[_0x09fb('0x26')](_[_0x09fb('0x2e')](_0x163f9e['query'],_0x4c5579[_0x09fb('0x26')]),_0x5dd217);if(_0x163f9e[_0x09fb('0x24')][_0x09fb('0x2f')]){_0xb7110c[_0x09fb('0x2d')]=_[_0x09fb('0x30')](_0xb7110c['where'],{'$or':_[_0x09fb('0x1e')](_0x5dd217,function(_0x16dfb9){if(_0x16dfb9[_0x09fb('0x21')]!==_0x09fb('0x31')){var _0x310f6d={};_0x310f6d[_0x16dfb9[_0x09fb('0x1c')]]={'$like':'%'+_0x163f9e[_0x09fb('0x24')]['filter']+'%'};return _0x310f6d;}})});}_0xb7110c=_[_0x09fb('0x30')]({},_0xb7110c,_0x163f9e[_0x09fb('0x32')]);var _0x1c5210={'where':_0xb7110c[_0x09fb('0x2d')]};return db[_0x09fb('0x1f')][_0x09fb('0xe')](_0x1c5210)[_0x09fb('0x12')](function(_0xff3102){_0x116513[_0x09fb('0xe')]=_0xff3102;if(_0x163f9e[_0x09fb('0x24')][_0x09fb('0x33')]){_0xb7110c[_0x09fb('0x34')]=[{'all':!![]}];}return db[_0x09fb('0x1f')][_0x09fb('0x35')](_0xb7110c);})[_0x09fb('0x12')](function(_0x37f328){_0x116513[_0x09fb('0x36')]=_0x37f328;return _0x116513;})[_0x09fb('0x12')](respondWithFilteredResult(_0x4370f4,_0xb7110c))[_0x09fb('0x37')](handleError(_0x4370f4,null));};exports[_0x09fb('0x38')]=function(_0x11aaf4,_0x53fa4a){var _0x183b11={'raw':![],'where':{'id':_0x11aaf4[_0x09fb('0x39')]['id']}},_0x53b883={};_0x53b883[_0x09fb('0x23')]=_[_0x09fb('0x25')](db[_0x09fb('0x1f')][_0x09fb('0x20')]);_0x53b883[_0x09fb('0x24')]=_['keys'](_0x11aaf4[_0x09fb('0x24')]);_0x53b883[_0x09fb('0x26')]=_[_0x09fb('0x27')](_0x53b883['model'],_0x53b883[_0x09fb('0x24')]);_0x183b11['attributes']=_[_0x09fb('0x27')](_0x53b883[_0x09fb('0x23')],qs[_0x09fb('0x29')](_0x11aaf4[_0x09fb('0x24')][_0x09fb('0x29')]));_0x183b11['attributes']=_0x183b11[_0x09fb('0x28')][_0x09fb('0x2a')]?_0x183b11['attributes']:_0x53b883[_0x09fb('0x23')];if(_0x11aaf4['query'][_0x09fb('0x33')]){_0x183b11[_0x09fb('0x34')]=[{'all':!![]}];}_0x183b11=_[_0x09fb('0x30')]({},_0x183b11,_0x11aaf4['options']);return db[_0x09fb('0x1f')][_0x09fb('0x3a')](_0x183b11)['then'](handleEntityNotFound(_0x53fa4a,null))[_0x09fb('0x12')](respondWithResult(_0x53fa4a,null))[_0x09fb('0x37')](handleError(_0x53fa4a,null));};exports[_0x09fb('0x3b')]=function(_0x83251,_0x1eae11){return db[_0x09fb('0x1f')][_0x09fb('0x3b')](_0x83251[_0x09fb('0x3c')],{})['then'](function(_0x155592){var _0x1ad15d=_0x83251[_0x09fb('0x3d')][_0x09fb('0x14')]({'plain':!![]});if(!_0x1ad15d)throw new Error(_0x09fb('0x3e'));if(_0x1ad15d['role']===_0x09fb('0x3d')){var _0x1b975a=_0x155592[_0x09fb('0x14')]({'plain':!![]});var _0x347288=_0x09fb('0x15');return db[_0x09fb('0x3f')][_0x09fb('0x3a')]({'where':{'name':_0x347288,'userProfileId':_0x1ad15d[_0x09fb('0x40')]},'raw':!![]})[_0x09fb('0x12')](function(_0x150ddd){if(_0x150ddd&&_0x150ddd[_0x09fb('0x41')]===0x0){return db[_0x09fb('0x16')][_0x09fb('0x3b')]({'name':_0x1b975a['name'],'resourceId':_0x1b975a['id'],'type':_0x150ddd[_0x09fb('0x1c')],'sectionId':_0x150ddd['id']},{})[_0x09fb('0x12')](function(){return _0x155592;});}else{return _0x155592;}})['catch'](function(_0x3054ff){logger['error'](_0x09fb('0x42'),_0x3054ff);throw _0x3054ff;});}return _0x155592;})[_0x09fb('0x12')](respondWithResult(_0x1eae11,0xc9))[_0x09fb('0x37')](handleError(_0x1eae11,null));};exports[_0x09fb('0x43')]=function(_0x4564ca,_0x271701){if(_0x4564ca[_0x09fb('0x3c')]['id']){delete _0x4564ca[_0x09fb('0x3c')]['id'];}return db[_0x09fb('0x1f')][_0x09fb('0x3a')]({'where':{'id':_0x4564ca['params']['id']}})[_0x09fb('0x12')](handleEntityNotFound(_0x271701,null))['then'](saveUpdates(_0x4564ca[_0x09fb('0x3c')],null))[_0x09fb('0x12')](function(_0x356794){if(!_0x356794)return;var _0x1334eb=_0x356794['get']({'plain':!![]});return _0x1334eb;})[_0x09fb('0x12')](function(_0x586554){var _0x6b4753=new Redis(config[_0x09fb('0x5')]);_0x6b4753[_0x09fb('0x17')]('agi',JSON[_0x09fb('0x19')](_['pick'](_0x586554,['id',_0x09fb('0x1c'),_0x09fb('0x44')])));return _0x586554;})[_0x09fb('0x12')](respondWithResult(_0x271701,null))['catch'](handleError(_0x271701,null));};exports[_0x09fb('0x13')]=function(_0x54a51a,_0x126043){return db[_0x09fb('0x1f')][_0x09fb('0x3a')]({'where':{'id':_0x54a51a[_0x09fb('0x39')]['id']}})['then'](handleEntityNotFound(_0x126043,null))[_0x09fb('0x12')](removeEntity(_0x126043,null))['catch'](handleError(_0x126043,null));}; \ No newline at end of file +var _0x6010=['limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','production','ioredis','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','undefined','count','offset','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x5958a2,_0x41fd51){var _0x1a563d=function(_0x35ec01){while(--_0x35ec01){_0x5958a2['push'](_0x5958a2['shift']());}};_0x1a563d(++_0x41fd51);}(_0x6010,0x1ee));var _0x0601=function(_0xb736c0,_0x14d462){_0xb736c0=_0xb736c0-0x0;var _0x31d446=_0x6010[_0xb736c0];return _0x31d446;};'use strict';var _=require('lodash');var Redis=require(_0x0601('0x0'));var qs=require(_0x0601('0x1'));var logger=require('../../config/logger')(_0x0601('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0601('0x3')]=_['defaults'](config[_0x0601('0x3')],{'host':_0x0601('0x4'),'port':0x18eb});var socket=require(_0x0601('0x5'))(new Redis(config[_0x0601('0x3')]));require(_0x0601('0x6'))[_0x0601('0x7')](socket);function respondWithResult(_0x26cbce,_0x5b5628){_0x5b5628=_0x5b5628||0xc8;return function(_0x20ec38){if(_0x20ec38){return _0x26cbce[_0x0601('0x8')](_0x5b5628)['json'](_0x20ec38);}};}function respondWithFilteredResult(_0x106d3c,_0x18c89f){return function(_0xfacd50){if(_0xfacd50){var _0x55df8f=typeof _0x18c89f['offset']===_0x0601('0x9')&&typeof _0x18c89f['limit']===_0x0601('0x9');var _0x528a4b=_0xfacd50[_0x0601('0xa')];var _0x3f22c0=_0x55df8f?0x0:_0x18c89f[_0x0601('0xb')];var _0x39b81a=_0x55df8f?_0xfacd50[_0x0601('0xa')]:_0x18c89f[_0x0601('0xb')]+_0x18c89f['limit'];var _0x993a62;if(_0x39b81a>=_0x528a4b){_0x39b81a=_0x528a4b;_0x993a62=0xc8;}else{_0x993a62=0xce;}_0x106d3c[_0x0601('0x8')](_0x993a62);return _0x106d3c[_0x0601('0xc')](_0x0601('0xd'),_0x3f22c0+'-'+_0x39b81a+'/'+_0x528a4b)[_0x0601('0xe')](_0xfacd50);}return null;};}function saveUpdates(_0x11b743){return function(_0x44c7a8){if(_0x44c7a8){return _0x44c7a8[_0x0601('0xf')](_0x11b743)[_0x0601('0x10')](function(_0x128ec3){return _0x128ec3;});}return null;};}function removeEntity(_0x2727ad){return function(_0x41e614){if(_0x41e614){return _0x41e614[_0x0601('0x11')]()[_0x0601('0x10')](function(){var _0x36188e=_0x41e614[_0x0601('0x12')]({'plain':!![]});var _0x11d46c=_0x0601('0x13');return db[_0x0601('0x14')][_0x0601('0x11')]({'where':{'type':_0x11d46c,'resourceId':_0x36188e['id']}})[_0x0601('0x10')](function(){return _0x41e614;});})['then'](function(){var _0x2f1089=new Redis(config[_0x0601('0x3')]);_0x2f1089[_0x0601('0x15')](_0x0601('0x16'),JSON['stringify']({'id':_0x41e614['id'],'deleted':!![]}));})[_0x0601('0x10')](function(){_0x2727ad[_0x0601('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10f7f8){return function(_0x26af88){if(!_0x26af88){_0x10f7f8[_0x0601('0x17')](0x194);}return _0x26af88;};}function handleError(_0x4288be,_0x3045da){_0x3045da=_0x3045da||0x1f4;return function(_0x2a67ff){logger[_0x0601('0x18')](_0x2a67ff[_0x0601('0x19')]);if(_0x2a67ff[_0x0601('0x1a')]){delete _0x2a67ff[_0x0601('0x1a')];}_0x4288be[_0x0601('0x8')](_0x3045da)[_0x0601('0x1b')](_0x2a67ff);};}exports['index']=function(_0x515e2f,_0x18d23e){var _0x45fcc0={},_0x540e3c={},_0x48a3ea={'count':0x0,'rows':[]};var _0x489104=_[_0x0601('0x1c')](db[_0x0601('0x1d')][_0x0601('0x1e')],function(_0x4123df){return{'name':_0x4123df[_0x0601('0x1f')],'type':_0x4123df[_0x0601('0x20')]['key']};});_0x540e3c[_0x0601('0x21')]=_['map'](_0x489104,_0x0601('0x1a'));_0x540e3c[_0x0601('0x22')]=_['keys'](_0x515e2f[_0x0601('0x22')]);_0x540e3c[_0x0601('0x23')]=_[_0x0601('0x24')](_0x540e3c['model'],_0x540e3c[_0x0601('0x22')]);_0x45fcc0['attributes']=_[_0x0601('0x24')](_0x540e3c[_0x0601('0x21')],qs[_0x0601('0x25')](_0x515e2f[_0x0601('0x22')][_0x0601('0x25')]));_0x45fcc0[_0x0601('0x26')]=_0x45fcc0[_0x0601('0x26')][_0x0601('0x27')]?_0x45fcc0[_0x0601('0x26')]:_0x540e3c[_0x0601('0x21')];if(!_0x515e2f[_0x0601('0x22')][_0x0601('0x28')](_0x0601('0x29'))){_0x45fcc0['limit']=qs[_0x0601('0x2a')](_0x515e2f[_0x0601('0x22')][_0x0601('0x2a')]);_0x45fcc0[_0x0601('0xb')]=qs[_0x0601('0xb')](_0x515e2f[_0x0601('0x22')][_0x0601('0xb')]);}_0x45fcc0[_0x0601('0x2b')]=qs[_0x0601('0x2c')](_0x515e2f['query'][_0x0601('0x2c')]);_0x45fcc0['where']=qs['filters'](_[_0x0601('0x2d')](_0x515e2f[_0x0601('0x22')],_0x540e3c['filters']),_0x489104);if(_0x515e2f[_0x0601('0x22')][_0x0601('0x2e')]){_0x45fcc0[_0x0601('0x2f')]=_['merge'](_0x45fcc0[_0x0601('0x2f')],{'$or':_['map'](_0x489104,function(_0x45d1f9){if(_0x45d1f9[_0x0601('0x20')]!==_0x0601('0x30')){var _0x814175={};_0x814175[_0x45d1f9['name']]={'$like':'%'+_0x515e2f[_0x0601('0x22')][_0x0601('0x2e')]+'%'};return _0x814175;}})});}_0x45fcc0=_[_0x0601('0x31')]({},_0x45fcc0,_0x515e2f[_0x0601('0x32')]);var _0x381fc6={'where':_0x45fcc0[_0x0601('0x2f')]};return db[_0x0601('0x1d')][_0x0601('0xa')](_0x381fc6)[_0x0601('0x10')](function(_0x250c77){_0x48a3ea[_0x0601('0xa')]=_0x250c77;if(_0x515e2f[_0x0601('0x22')]['includeAll']){_0x45fcc0[_0x0601('0x33')]=[{'all':!![]}];}return db[_0x0601('0x1d')][_0x0601('0x34')](_0x45fcc0);})[_0x0601('0x10')](function(_0x1c9cbd){_0x48a3ea['rows']=_0x1c9cbd;return _0x48a3ea;})[_0x0601('0x10')](respondWithFilteredResult(_0x18d23e,_0x45fcc0))[_0x0601('0x35')](handleError(_0x18d23e,null));};exports['show']=function(_0x55e1c8,_0x5ab8f8){var _0x515b1a={'raw':![],'where':{'id':_0x55e1c8[_0x0601('0x36')]['id']}},_0x11fa9f={};_0x11fa9f['model']=_[_0x0601('0x37')](db[_0x0601('0x1d')]['rawAttributes']);_0x11fa9f[_0x0601('0x22')]=_[_0x0601('0x37')](_0x55e1c8[_0x0601('0x22')]);_0x11fa9f['filters']=_[_0x0601('0x24')](_0x11fa9f[_0x0601('0x21')],_0x11fa9f['query']);_0x515b1a[_0x0601('0x26')]=_[_0x0601('0x24')](_0x11fa9f[_0x0601('0x21')],qs[_0x0601('0x25')](_0x55e1c8[_0x0601('0x22')][_0x0601('0x25')]));_0x515b1a[_0x0601('0x26')]=_0x515b1a[_0x0601('0x26')][_0x0601('0x27')]?_0x515b1a[_0x0601('0x26')]:_0x11fa9f[_0x0601('0x21')];if(_0x55e1c8[_0x0601('0x22')][_0x0601('0x38')]){_0x515b1a[_0x0601('0x33')]=[{'all':!![]}];}_0x515b1a=_[_0x0601('0x31')]({},_0x515b1a,_0x55e1c8[_0x0601('0x32')]);return db['SquareProject']['find'](_0x515b1a)['then'](handleEntityNotFound(_0x5ab8f8,null))[_0x0601('0x10')](respondWithResult(_0x5ab8f8,null))[_0x0601('0x35')](handleError(_0x5ab8f8,null));};exports[_0x0601('0x39')]=function(_0x7fc3f,_0x2d30bc){return db[_0x0601('0x1d')]['create'](_0x7fc3f[_0x0601('0x3a')],{})[_0x0601('0x10')](function(_0x27f41e){var _0x55ae50=_0x7fc3f[_0x0601('0x3b')][_0x0601('0x12')]({'plain':!![]});if(!_0x55ae50)throw new Error(_0x0601('0x3c'));if(_0x55ae50[_0x0601('0x3d')]===_0x0601('0x3b')){var _0x15a6eb=_0x27f41e[_0x0601('0x12')]({'plain':!![]});var _0x1ef607=_0x0601('0x13');return db[_0x0601('0x3e')][_0x0601('0x3f')]({'where':{'name':_0x1ef607,'userProfileId':_0x55ae50[_0x0601('0x40')]},'raw':!![]})['then'](function(_0x577544){if(_0x577544&&_0x577544[_0x0601('0x41')]===0x0){return db[_0x0601('0x14')]['create']({'name':_0x15a6eb[_0x0601('0x1a')],'resourceId':_0x15a6eb['id'],'type':_0x577544[_0x0601('0x1a')],'sectionId':_0x577544['id']},{})[_0x0601('0x10')](function(){return _0x27f41e;});}else{return _0x27f41e;}})[_0x0601('0x35')](function(_0x1b49e5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b49e5);throw _0x1b49e5;});}return _0x27f41e;})[_0x0601('0x10')](respondWithResult(_0x2d30bc,0xc9))['catch'](handleError(_0x2d30bc,null));};exports[_0x0601('0xf')]=function(_0x37ed7d,_0x5045d7){if(_0x37ed7d['body']['id']){delete _0x37ed7d[_0x0601('0x3a')]['id'];}return db[_0x0601('0x1d')][_0x0601('0x3f')]({'where':{'id':_0x37ed7d['params']['id']}})[_0x0601('0x10')](handleEntityNotFound(_0x5045d7,null))[_0x0601('0x10')](saveUpdates(_0x37ed7d['body'],null))['then'](function(_0x3375e3){if(!_0x3375e3)return;var _0x390ac7=_0x3375e3[_0x0601('0x12')]({'plain':!![]});return _0x390ac7;})['then'](function(_0x3b3fa3){var _0x25d462=new Redis(config[_0x0601('0x3')]);_0x25d462[_0x0601('0x15')](_0x0601('0x16'),JSON['stringify'](_[_0x0601('0x2d')](_0x3b3fa3,['id',_0x0601('0x1a'),_0x0601('0x42')])));return _0x3b3fa3;})[_0x0601('0x10')](respondWithResult(_0x5045d7,null))[_0x0601('0x35')](handleError(_0x5045d7,null));};exports[_0x0601('0x11')]=function(_0x19a331,_0x34afb2){return db[_0x0601('0x1d')][_0x0601('0x3f')]({'where':{'id':_0x19a331[_0x0601('0x36')]['id']}})['then'](handleEntityNotFound(_0x34afb2,null))[_0x0601('0x10')](removeEntity(_0x34afb2,null))['catch'](handleError(_0x34afb2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1eed1b6..9079cb7 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 _0xc1fc=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1fc,0x164));var _0xcc1f=function(_0x3d83f4,_0x4e5b3d){_0x3d83f4=_0x3d83f4-0x0;var _0x687304=_0xc1fc[_0x3d83f4];return _0x687304;};'use strict';var EventEmitter=require(_0xcc1f('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xcc1f('0x1')](0x0);var events={'afterCreate':_0xcc1f('0x2'),'afterUpdate':'update','afterDestroy':_0xcc1f('0x3')};function emitEvent(_0x79bdfe){return function(_0x2cb6c7,_0x230a33,_0x5879eb){SquareProjectEvents['emit'](_0x79bdfe+':'+_0x2cb6c7['id'],_0x2cb6c7);SquareProjectEvents[_0xcc1f('0x4')](_0x79bdfe,_0x2cb6c7);_0x5879eb(null);};}for(var e in events){if(events[_0xcc1f('0x5')](e)){var event=events[e];SquareProject[_0xcc1f('0x6')](e,emitEvent(event));}}module[_0xcc1f('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xff07=['exports','events','../../mysqldb','SquareProject','save','remove','emit','hasOwnProperty','hook'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xff07,0x1cc));var _0x7ff0=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0xff07[_0x1bb6aa];return _0x2ef28e;};'use strict';var EventEmitter=require(_0x7ff0('0x0'));var SquareProject=require(_0x7ff0('0x1'))['db'][_0x7ff0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ff0('0x3'),'afterUpdate':'update','afterDestroy':_0x7ff0('0x4')};function emitEvent(_0x28517b){return function(_0x585eab,_0x3f86b5,_0x577bdc){SquareProjectEvents[_0x7ff0('0x5')](_0x28517b+':'+_0x585eab['id'],_0x585eab);SquareProjectEvents[_0x7ff0('0x5')](_0x28517b,_0x585eab);_0x577bdc(null);};}for(var e in events){if(events[_0x7ff0('0x6')](e)){var event=events[e];SquareProject[_0x7ff0('0x7')](e,emitEvent(event));}}module[_0x7ff0('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b1b5594..44b5472 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 _0xd480=['../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','production','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cdcdc,_0x34eac7){var _0x4704ce=function(_0x1de4ed){while(--_0x1de4ed){_0x4cdcdc['push'](_0x4cdcdc['shift']());}};_0x4704ce(++_0x34eac7);}(_0xd480,0x114));var _0x0d48=function(_0x16ef3f,_0x539505){_0x16ef3f=_0x16ef3f-0x0;var _0x294ff2=_0xd480[_0x16ef3f];return _0x294ff2;};'use strict';var _=require(_0x0d48('0x0'));var util=require(_0x0d48('0x1'));var logger=require(_0x0d48('0x2'))(_0x0d48('0x3'));var moment=require(_0x0d48('0x4'));var BPromise=require(_0x0d48('0x5'));var rp=require(_0x0d48('0x6'));var fs=require('fs');var path=require(_0x0d48('0x7'));var rimraf=require(_0x0d48('0x8'));var config=require(_0x0d48('0x9'));var attributes=require(_0x0d48('0xa'));module['exports']=function(_0x3ea92c,_0x1996f7){return _0x3ea92c[_0x0d48('0xb')](_0x0d48('0xc'),attributes,{'tableName':_0x0d48('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b3cf0,_0x2654e9,_0x4b5c07){if(_0x3b3cf0[_0x0d48('0xe')](_0x0d48('0xf'))){_0x3b3cf0[_0x0d48('0x10')]=moment()[_0x0d48('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3b3cf0[_0x0d48('0xe')](_0x0d48('0x12'))){_0x3b3cf0['publishedAt']=moment()[_0x0d48('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b5c07(null,_0x3b3cf0);}}});}; \ No newline at end of file +var _0x0021=['exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0021,0xee));var _0x1002=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x0021[_0x31991b];return _0x307304;};'use strict';var _=require(_0x1002('0x0'));var util=require(_0x1002('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1002('0x2'));var BPromise=require(_0x1002('0x3'));var rp=require(_0x1002('0x4'));var fs=require('fs');var path=require(_0x1002('0x5'));var rimraf=require(_0x1002('0x6'));var config=require(_0x1002('0x7'));var attributes=require(_0x1002('0x8'));module[_0x1002('0x9')]=function(_0x33c45b,_0x6e669e){return _0x33c45b[_0x1002('0xa')](_0x1002('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xca66b8,_0xedf5b4,_0x37e528){if(_0xca66b8[_0x1002('0xc')](_0x1002('0xd'))){_0xca66b8[_0x1002('0xe')]=moment()[_0x1002('0xf')](_0x1002('0x10'));}if(_0xca66b8[_0x1002('0xc')](_0x1002('0x11'))){_0xca66b8[_0x1002('0x12')]=moment()[_0x1002('0xf')](_0x1002('0x10'));}_0x37e528(null,_0xca66b8);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 094c6ca..544eec3 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 _0xa6c8=['ShowSquareProject','then','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message'];(function(_0x3a0685,_0x248c35){var _0x2edf3d=function(_0x3fb7c6){while(--_0x3fb7c6){_0x3a0685['push'](_0x3a0685['shift']());}};_0x2edf3d(++_0x248c35);}(_0xa6c8,0x15e));var _0x8a6c=function(_0x19e74d,_0x4d08b4){_0x19e74d=_0x19e74d-0x0;var _0x5e1b8a=_0xa6c8[_0x19e74d];return _0x5e1b8a;};'use strict';var _=require('lodash');var Redis=require(_0x8a6c('0x0'));var db=require(_0x8a6c('0x1'))['db'];var logger=require(_0x8a6c('0x2'))(_0x8a6c('0x3'));var config=require('../../config/environment');config[_0x8a6c('0x4')]=_[_0x8a6c('0x5')](config[_0x8a6c('0x4')],{'host':_0x8a6c('0x6'),'port':0x18eb});var socket=require(_0x8a6c('0x7'))(new Redis(config[_0x8a6c('0x4')]));require(_0x8a6c('0x8'))[_0x8a6c('0x9')](socket);exports[_0x8a6c('0xa')]=function(_0x30cbbf){var _0x42dfb3=this;return new Promise(function(_0xe95825,_0x19eccb){return db[_0x8a6c('0xb')][_0x8a6c('0xc')]({'raw':_0x30cbbf[_0x8a6c('0xd')]?_0x30cbbf[_0x8a6c('0xd')][_0x8a6c('0xe')]===undefined?!![]:![]:!![],'where':_0x30cbbf['options']?_0x30cbbf['options'][_0x8a6c('0xf')]||null:null,'attributes':_0x30cbbf[_0x8a6c('0xd')]?_0x30cbbf[_0x8a6c('0xd')][_0x8a6c('0x10')]||null:null,'limit':_0x30cbbf[_0x8a6c('0xd')]?_0x30cbbf[_0x8a6c('0xd')][_0x8a6c('0x11')]||null:null,'include':_0x30cbbf['options']?_0x30cbbf[_0x8a6c('0xd')][_0x8a6c('0x12')]?_[_0x8a6c('0x13')](_0x30cbbf['options'][_0x8a6c('0x12')],function(_0x2138a7){return{'model':db[_0x2138a7[_0x8a6c('0x14')]],'as':_0x2138a7['as'],'attributes':_0x2138a7[_0x8a6c('0x10')],'include':_0x2138a7[_0x8a6c('0x12')]?_[_0x8a6c('0x13')](_0x2138a7[_0x8a6c('0x12')],function(_0x1e6e9c){return{'model':db[_0x1e6e9c[_0x8a6c('0x14')]],'as':_0x1e6e9c['as'],'attributes':_0x1e6e9c[_0x8a6c('0x10')],'include':_0x1e6e9c[_0x8a6c('0x12')]?_[_0x8a6c('0x13')](_0x1e6e9c[_0x8a6c('0x12')],function(_0xf116d8){return{'model':db[_0xf116d8[_0x8a6c('0x14')]],'as':_0xf116d8['as'],'attributes':_0xf116d8[_0x8a6c('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdc9f62){logger[_0x8a6c('0x15')](_0x8a6c('0xa'),_0x30cbbf);logger[_0x8a6c('0x16')](_0x8a6c('0xa'),_0x30cbbf,JSON[_0x8a6c('0x17')](_0xdc9f62));_0xe95825(_0xdc9f62);})[_0x8a6c('0x18')](function(_0x3ec9cf){logger[_0x8a6c('0x19')](_0x8a6c('0xa'),_0x3ec9cf[_0x8a6c('0x1a')],_0x30cbbf);_0x19eccb(_0x42dfb3[_0x8a6c('0x19')](0x1f4,_0x3ec9cf[_0x8a6c('0x1a')]));});});};exports[_0x8a6c('0x1b')]=function(_0x2356ba){var _0x14c804=this;return new Promise(function(_0x43c7b1,_0x232c67){return db[_0x8a6c('0xb')]['find']({'raw':_0x2356ba['options']?_0x2356ba['options'][_0x8a6c('0xe')]===undefined?!![]:![]:!![],'where':_0x2356ba[_0x8a6c('0xd')]?_0x2356ba['options']['where']||null:null,'attributes':_0x2356ba[_0x8a6c('0xd')]?_0x2356ba[_0x8a6c('0xd')][_0x8a6c('0x10')]||null:null,'include':_0x2356ba[_0x8a6c('0xd')]?_0x2356ba['options']['include']?_[_0x8a6c('0x13')](_0x2356ba[_0x8a6c('0xd')][_0x8a6c('0x12')],function(_0x54d8d1){return{'model':db[_0x54d8d1[_0x8a6c('0x14')]],'as':_0x54d8d1['as'],'attributes':_0x54d8d1[_0x8a6c('0x10')],'include':_0x54d8d1[_0x8a6c('0x12')]?_[_0x8a6c('0x13')](_0x54d8d1['include'],function(_0x205d3c){return{'model':db[_0x205d3c[_0x8a6c('0x14')]],'as':_0x205d3c['as'],'attributes':_0x205d3c[_0x8a6c('0x10')],'include':_0x205d3c[_0x8a6c('0x12')]?_[_0x8a6c('0x13')](_0x205d3c['include'],function(_0x451898){return{'model':db[_0x451898[_0x8a6c('0x14')]],'as':_0x451898['as'],'attributes':_0x451898[_0x8a6c('0x10')]};}):[]};}):[]};}):[]:[]})[_0x8a6c('0x1c')](function(_0x588fe0){logger[_0x8a6c('0x15')](_0x8a6c('0x1b'),_0x2356ba);logger[_0x8a6c('0x16')](_0x8a6c('0x1b'),_0x2356ba,JSON[_0x8a6c('0x17')](_0x588fe0));_0x43c7b1(_0x588fe0);})['catch'](function(_0x5288aa){logger[_0x8a6c('0x19')](_0x8a6c('0x1b'),_0x5288aa[_0x8a6c('0x1a')],_0x2356ba);_0x232c67(_0x14c804[_0x8a6c('0x19')](0x1f4,_0x5288aa[_0x8a6c('0x1a')]));});});}; \ No newline at end of file +var _0xd2ab=['error','ShowSquareProject','find','where','stringify','lodash','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','map','include','model','then','info','debug','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd2ab,0x1f2));var _0xbd2a=function(_0xb350c8,_0x35544c){_0xb350c8=_0xb350c8-0x0;var _0x59153b=_0xd2ab[_0xb350c8];return _0x59153b;};'use strict';var _=require(_0xbd2a('0x0'));var Redis=require('ioredis');var db=require(_0xbd2a('0x1'))['db'];var logger=require(_0xbd2a('0x2'))('rpc');var config=require(_0xbd2a('0x3'));config[_0xbd2a('0x4')]=_[_0xbd2a('0x5')](config['redis'],{'host':_0xbd2a('0x6'),'port':0x18eb});var socket=require(_0xbd2a('0x7'))(new Redis(config[_0xbd2a('0x4')]));require(_0xbd2a('0x8'))[_0xbd2a('0x9')](socket);exports[_0xbd2a('0xa')]=function(_0x3502e1){var _0x5f4e8d=this;return new Promise(function(_0x3e1bd4,_0x4bde85){return db[_0xbd2a('0xb')][_0xbd2a('0xc')]({'raw':_0x3502e1[_0xbd2a('0xd')]?_0x3502e1[_0xbd2a('0xd')][_0xbd2a('0xe')]===undefined?!![]:![]:!![],'where':_0x3502e1[_0xbd2a('0xd')]?_0x3502e1[_0xbd2a('0xd')]['where']||null:null,'attributes':_0x3502e1[_0xbd2a('0xd')]?_0x3502e1[_0xbd2a('0xd')][_0xbd2a('0xf')]||null:null,'limit':_0x3502e1['options']?_0x3502e1['options'][_0xbd2a('0x10')]||null:null,'include':_0x3502e1[_0xbd2a('0xd')]?_0x3502e1[_0xbd2a('0xd')]['include']?_[_0xbd2a('0x11')](_0x3502e1[_0xbd2a('0xd')][_0xbd2a('0x12')],function(_0x579638){return{'model':db[_0x579638[_0xbd2a('0x13')]],'as':_0x579638['as'],'attributes':_0x579638['attributes'],'include':_0x579638[_0xbd2a('0x12')]?_[_0xbd2a('0x11')](_0x579638[_0xbd2a('0x12')],function(_0x5e6543){return{'model':db[_0x5e6543[_0xbd2a('0x13')]],'as':_0x5e6543['as'],'attributes':_0x5e6543[_0xbd2a('0xf')],'include':_0x5e6543[_0xbd2a('0x12')]?_[_0xbd2a('0x11')](_0x5e6543[_0xbd2a('0x12')],function(_0xf4de36){return{'model':db[_0xf4de36['model']],'as':_0xf4de36['as'],'attributes':_0xf4de36[_0xbd2a('0xf')]};}):[]};}):[]};}):[]:[]})[_0xbd2a('0x14')](function(_0x54761c){logger[_0xbd2a('0x15')](_0xbd2a('0xa'),_0x3502e1);logger[_0xbd2a('0x16')](_0xbd2a('0xa'),_0x3502e1,JSON['stringify'](_0x54761c));_0x3e1bd4(_0x54761c);})['catch'](function(_0x3d563d){logger['error'](_0xbd2a('0xa'),_0x3d563d[_0xbd2a('0x17')],_0x3502e1);_0x4bde85(_0x5f4e8d[_0xbd2a('0x18')](0x1f4,_0x3d563d['message']));});});};exports[_0xbd2a('0x19')]=function(_0x2892f3){var _0x284c86=this;return new Promise(function(_0x26d547,_0x5ee7b8){return db[_0xbd2a('0xb')][_0xbd2a('0x1a')]({'raw':_0x2892f3[_0xbd2a('0xd')]?_0x2892f3[_0xbd2a('0xd')][_0xbd2a('0xe')]===undefined?!![]:![]:!![],'where':_0x2892f3[_0xbd2a('0xd')]?_0x2892f3[_0xbd2a('0xd')][_0xbd2a('0x1b')]||null:null,'attributes':_0x2892f3[_0xbd2a('0xd')]?_0x2892f3[_0xbd2a('0xd')][_0xbd2a('0xf')]||null:null,'include':_0x2892f3[_0xbd2a('0xd')]?_0x2892f3[_0xbd2a('0xd')][_0xbd2a('0x12')]?_['map'](_0x2892f3['options'][_0xbd2a('0x12')],function(_0x3b77a6){return{'model':db[_0x3b77a6[_0xbd2a('0x13')]],'as':_0x3b77a6['as'],'attributes':_0x3b77a6[_0xbd2a('0xf')],'include':_0x3b77a6[_0xbd2a('0x12')]?_[_0xbd2a('0x11')](_0x3b77a6[_0xbd2a('0x12')],function(_0x29bb45){return{'model':db[_0x29bb45['model']],'as':_0x29bb45['as'],'attributes':_0x29bb45[_0xbd2a('0xf')],'include':_0x29bb45[_0xbd2a('0x12')]?_[_0xbd2a('0x11')](_0x29bb45[_0xbd2a('0x12')],function(_0x2ada2c){return{'model':db[_0x2ada2c[_0xbd2a('0x13')]],'as':_0x2ada2c['as'],'attributes':_0x2ada2c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd7b4){logger['info']('ShowSquareProject',_0x2892f3);logger['debug'](_0xbd2a('0x19'),_0x2892f3,JSON[_0xbd2a('0x1c')](_0x5cd7b4));_0x26d547(_0x5cd7b4);})['catch'](function(_0x45a802){logger[_0xbd2a('0x18')]('ShowSquareProject',_0x45a802[_0xbd2a('0x17')],_0x2892f3);_0x5ee7b8(_0x284c86[_0xbd2a('0x18')](0x1f4,_0x45a802[_0xbd2a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fd4f665..a33eb36 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 _0x1d9d=['emit','removeListener','register','length','./squareProject.events','save','remove','update'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1d9d,0x7c));var _0xd1d9=function(_0x380f7d,_0x524122){_0x380f7d=_0x380f7d-0x0;var _0xcb1a7b=_0x1d9d[_0x380f7d];return _0xcb1a7b;};'use strict';var SquareProjectEvents=require(_0xd1d9('0x0'));var events=[_0xd1d9('0x1'),_0xd1d9('0x2'),_0xd1d9('0x3')];function createListener(_0x498f41,_0x4993a2){return function(_0x3c4747){_0x4993a2[_0xd1d9('0x4')](_0x498f41,_0x3c4747);};}function removeListener(_0x3fdd64,_0x1b41ed){return function(){SquareProjectEvents[_0xd1d9('0x5')](_0x3fdd64,_0x1b41ed);};}exports[_0xd1d9('0x6')]=function(_0x2d227f){for(var _0x1240a1=0x0,_0x316350=events[_0xd1d9('0x7')];_0x1240a1<_0x316350;_0x1240a1++){var _0x260d29=events[_0x1240a1];var _0x37c8e1=createListener('squareProject:'+_0x260d29,_0x2d227f);SquareProjectEvents['on'](_0x260d29,_0x37c8e1);}}; \ No newline at end of file +var _0x4d93=['remove','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x5c4868,_0x192f68){var _0x3a9323=function(_0x408d26){while(--_0x408d26){_0x5c4868['push'](_0x5c4868['shift']());}};_0x3a9323(++_0x192f68);}(_0x4d93,0x13d));var _0x34d9=function(_0x47f136,_0x5cfe8e){_0x47f136=_0x47f136-0x0;var _0x25a34b=_0x4d93[_0x47f136];return _0x25a34b;};'use strict';var SquareProjectEvents=require(_0x34d9('0x0'));var events=['save',_0x34d9('0x1'),'update'];function createListener(_0x685fe3,_0x983264){return function(_0x140d04){_0x983264['emit'](_0x685fe3,_0x140d04);};}function removeListener(_0x42f4c5,_0x35eaea){return function(){SquareProjectEvents[_0x34d9('0x2')](_0x42f4c5,_0x35eaea);};}exports[_0x34d9('0x3')]=function(_0x1f52ed){for(var _0x27e949=0x0,_0x4d05bf=events[_0x34d9('0x4')];_0x27e949<_0x4d05bf;_0x27e949++){var _0x1ab81c=events[_0x27e949];var _0x52305a=createListener(_0x34d9('0x5')+_0x1ab81c,_0x1f52ed);SquareProjectEvents['on'](_0x1ab81c,_0x52305a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e29217e..f1422b9 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x27e850,_0x43ce4d){var _0x4f89a7=function(_0x518a47){while(--_0x518a47){_0x27e850['push'](_0x27e850['shift']());}};_0x4f89a7(++_0x43ce4d);}(_0x4975,0x86));var _0x5497=function(_0x39158,_0x2b13c3){_0x39158=_0x39158-0x0;var _0x56cebd=_0x4975[_0x39158];return _0x56cebd;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x22120c,_0x136b37){var _0x319735=function(_0x24e971){while(--_0x24e971){_0x22120c['push'](_0x22120c['shift']());}};_0x319735(++_0x136b37);}(_0x1cb9,0x14e));var _0x91cb=function(_0x106169,_0x5561ec){_0x106169=_0x106169-0x0;var _0x3d58b5=_0x1cb9[_0x106169];return _0x3d58b5;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 51bf667..2f461f3 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 _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x3a1eb6,_0x2f8574){var _0x5e886d=function(_0x46b98a){while(--_0x46b98a){_0x3a1eb6['push'](_0x3a1eb6['shift']());}};_0x5e886d(++_0x2f8574);}(_0x5fd1,0x155));var _0x15fd=function(_0x2a2e1e,_0x36d23e){_0x2a2e1e=_0x2a2e1e-0x0;var _0x2cf50a=_0x5fd1[_0x2a2e1e];return _0x2cf50a;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file +var _0xe14b=['VIRTUAL','lastIndexOf','sequelize','exports','STRING'];(function(_0x1a856a,_0x3d2c5d){var _0x3d61f4=function(_0x3bc2b2){while(--_0x3bc2b2){_0x1a856a['push'](_0x1a856a['shift']());}};_0x3d61f4(++_0x3d2c5d);}(_0xe14b,0x93));var _0xbe14=function(_0x1027c8,_0x54ec2){_0x1027c8=_0x1027c8-0x0;var _0x266bc2=_0xe14b[_0x1027c8];return _0x266bc2;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe14('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbe14('0x2')]},'saveName':{'type':Sequelize[_0xbe14('0x2')]},'filename':{'type':Sequelize[_0xbe14('0x2')]},'savePath':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){var _0x39387e='';var _0x196fca=this['getDataValue']('savePath');if(_0x196fca){_0x39387e=_0x196fca['substring'](_0x196fca[_0xbe14('0x4')]('.'));}return _0x39387e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8a853b1..4fcdd40 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 _0xd121=['Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','recording','ValidationError','unlink','message','SquareRecording\x20not\x20found'];(function(_0x57bbd7,_0x5ada0d){var _0x476213=function(_0x416a01){while(--_0x416a01){_0x57bbd7['push'](_0x57bbd7['shift']());}};_0x476213(++_0x5ada0d);}(_0xd121,0x1ed));var _0x1d12=function(_0x171a70,_0x583c66){_0x171a70=_0x171a70-0x0;var _0x31026c=_0xd121[_0x171a70];return _0x31026c;};'use strict';var emlformat=require(_0x1d12('0x0'));var rimraf=require(_0x1d12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d12('0x2'));var rp=require(_0x1d12('0x3'));var moment=require(_0x1d12('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d12('0x5'));var util=require(_0x1d12('0x6'));var path=require(_0x1d12('0x7'));var sox=require(_0x1d12('0x8'));var csv=require(_0x1d12('0x9'));var ejs=require(_0x1d12('0xa'));var fs=require('fs');var fs_extra=require(_0x1d12('0xb'));var _=require(_0x1d12('0xc'));var squel=require(_0x1d12('0xd'));var crypto=require(_0x1d12('0xe'));var jsforce=require(_0x1d12('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1d12('0x9'));var querystring=require(_0x1d12('0x10'));var Papa=require(_0x1d12('0x11'));var Redis=require(_0x1d12('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1d12('0x13'));var as=require(_0x1d12('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d12('0x15'))(_0x1d12('0x16'));var utils=require('../../config/utils');var config=require(_0x1d12('0x17'));var licenseUtil=require(_0x1d12('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3b95,_0x316df3){_0x316df3=_0x316df3||0xcc;return function(_0x156ec1){if(_0x156ec1){return _0x5b3b95['sendStatus'](_0x316df3);}return _0x5b3b95[_0x1d12('0x19')](_0x316df3)['end']();};}function respondWithResult(_0x3a99ec,_0x40f34d){_0x40f34d=_0x40f34d||0xc8;return function(_0x4e2f35){if(_0x4e2f35){return _0x3a99ec['status'](_0x40f34d)['json'](_0x4e2f35);}};}function respondWithFilteredResult(_0x365fed,_0x3ea8b3){return function(_0x13e6c1){if(_0x13e6c1){var _0x1c3759=typeof _0x3ea8b3[_0x1d12('0x1a')]===_0x1d12('0x1b')&&typeof _0x3ea8b3[_0x1d12('0x1c')]==='undefined';var _0x31e338=_0x13e6c1[_0x1d12('0x1d')];var _0x5e4db6=_0x1c3759?0x0:_0x3ea8b3[_0x1d12('0x1a')];var _0x31c2f4=_0x1c3759?_0x13e6c1[_0x1d12('0x1d')]:_0x3ea8b3[_0x1d12('0x1a')]+_0x3ea8b3['limit'];var _0x275a43;if(_0x31c2f4>=_0x31e338){_0x31c2f4=_0x31e338;_0x275a43=0xc8;}else{_0x275a43=0xce;}_0x365fed[_0x1d12('0x19')](_0x275a43);return _0x365fed[_0x1d12('0x1e')]('Content-Range',_0x5e4db6+'-'+_0x31c2f4+'/'+_0x31e338)[_0x1d12('0x1f')](_0x13e6c1);}return null;};}function patchUpdates(_0x2480ff){return function(_0x559f76){try{jsonpatch[_0x1d12('0x20')](_0x559f76,_0x2480ff,!![]);}catch(_0x159e0e){return BPromise[_0x1d12('0x21')](_0x159e0e);}return _0x559f76[_0x1d12('0x22')]();};}function saveUpdates(_0x39dfe5,_0x326c7a){return function(_0x2a158a){if(_0x2a158a){return _0x2a158a[_0x1d12('0x23')](_0x39dfe5)['then'](function(_0x26b720){return _0x26b720;});}return null;};}function removeEntity(_0x1ce01c,_0x411d06){return function(_0x5d1eb5){if(_0x5d1eb5){return _0x5d1eb5[_0x1d12('0x24')]()[_0x1d12('0x25')](function(){_0x1ce01c[_0x1d12('0x19')](0xcc)[_0x1d12('0x26')]();});}};}function handleEntityNotFound(_0x19673b,_0x49f423){return function(_0x5413da){if(!_0x5413da){_0x19673b[_0x1d12('0x27')](0x194);}return _0x5413da;};}function handleError(_0x2b6a13,_0x19c011){_0x19c011=_0x19c011||0x1f4;return function(_0x48dbf9){logger[_0x1d12('0x28')](_0x48dbf9[_0x1d12('0x29')]);if(_0x48dbf9[_0x1d12('0x2a')]){delete _0x48dbf9[_0x1d12('0x2a')];}_0x2b6a13[_0x1d12('0x19')](_0x19c011)[_0x1d12('0x2b')](_0x48dbf9);};}exports[_0x1d12('0x2c')]=function(_0x1cbaf6,_0x523c93){var _0x372c96={},_0x2b1dbf={},_0x59e98a={'count':0x0,'rows':[]};var _0x14cd14=_[_0x1d12('0x2d')](db[_0x1d12('0x2e')][_0x1d12('0x2f')],function(_0x6884bd){return{'name':_0x6884bd['fieldName'],'type':_0x6884bd[_0x1d12('0x30')][_0x1d12('0x31')]};});_0x2b1dbf[_0x1d12('0x32')]=_[_0x1d12('0x2d')](_0x14cd14,_0x1d12('0x2a'));_0x2b1dbf['query']=_[_0x1d12('0x33')](_0x1cbaf6[_0x1d12('0x34')]);_0x2b1dbf[_0x1d12('0x35')]=_['intersection'](_0x2b1dbf[_0x1d12('0x32')],_0x2b1dbf['query']);_0x372c96[_0x1d12('0x36')]=_[_0x1d12('0x37')](_0x2b1dbf[_0x1d12('0x32')],qs[_0x1d12('0x38')](_0x1cbaf6['query'][_0x1d12('0x38')]));_0x372c96[_0x1d12('0x36')]=_0x372c96[_0x1d12('0x36')][_0x1d12('0x39')]?_0x372c96[_0x1d12('0x36')]:_0x2b1dbf[_0x1d12('0x32')];if(!_0x1cbaf6[_0x1d12('0x34')][_0x1d12('0x3a')](_0x1d12('0x3b'))){_0x372c96[_0x1d12('0x1c')]=qs[_0x1d12('0x1c')](_0x1cbaf6[_0x1d12('0x34')][_0x1d12('0x1c')]);_0x372c96[_0x1d12('0x1a')]=qs[_0x1d12('0x1a')](_0x1cbaf6['query']['offset']);}_0x372c96['order']=qs[_0x1d12('0x3c')](_0x1cbaf6[_0x1d12('0x34')]['sort']);_0x372c96['where']=qs['filters'](_[_0x1d12('0x3d')](_0x1cbaf6[_0x1d12('0x34')],_0x2b1dbf[_0x1d12('0x35')]),_0x14cd14);if(_0x1cbaf6[_0x1d12('0x34')][_0x1d12('0x3e')]){_0x372c96['where']=_[_0x1d12('0x3f')](_0x372c96['where'],{'$or':_[_0x1d12('0x2d')](_0x14cd14,function(_0x250eb7){if(_0x250eb7[_0x1d12('0x30')]!==_0x1d12('0x40')){var _0x433430={};_0x433430[_0x250eb7[_0x1d12('0x2a')]]={'$like':'%'+_0x1cbaf6['query']['filter']+'%'};return _0x433430;}})});}_0x372c96=_[_0x1d12('0x3f')]({},_0x372c96,_0x1cbaf6[_0x1d12('0x41')]);var _0x28989d={'where':_0x372c96['where']};return db[_0x1d12('0x2e')][_0x1d12('0x1d')](_0x28989d)[_0x1d12('0x25')](function(_0x5ee4ed){_0x59e98a[_0x1d12('0x1d')]=_0x5ee4ed;if(_0x1cbaf6[_0x1d12('0x34')]['includeAll']){_0x372c96['include']=[{'all':!![]}];}return db[_0x1d12('0x2e')][_0x1d12('0x42')](_0x372c96);})[_0x1d12('0x25')](function(_0x3bb99e){_0x59e98a[_0x1d12('0x43')]=_0x3bb99e;return _0x59e98a;})['then'](respondWithFilteredResult(_0x523c93,_0x372c96))['catch'](handleError(_0x523c93,null));};exports[_0x1d12('0x44')]=function(_0x46dae0,_0xe8dedd){var _0xce988={'raw':!![],'where':{'id':_0x46dae0[_0x1d12('0x45')]['id']}},_0x185be0={};_0x185be0[_0x1d12('0x32')]=_[_0x1d12('0x33')](db[_0x1d12('0x2e')][_0x1d12('0x2f')]);_0x185be0[_0x1d12('0x34')]=_[_0x1d12('0x33')](_0x46dae0[_0x1d12('0x34')]);_0x185be0[_0x1d12('0x35')]=_[_0x1d12('0x37')](_0x185be0[_0x1d12('0x32')],_0x185be0[_0x1d12('0x34')]);_0xce988[_0x1d12('0x36')]=_[_0x1d12('0x37')](_0x185be0[_0x1d12('0x32')],qs[_0x1d12('0x38')](_0x46dae0[_0x1d12('0x34')][_0x1d12('0x38')]));_0xce988['attributes']=_0xce988[_0x1d12('0x36')][_0x1d12('0x39')]?_0xce988[_0x1d12('0x36')]:_0x185be0[_0x1d12('0x32')];if(_0x46dae0[_0x1d12('0x34')][_0x1d12('0x46')]){_0xce988[_0x1d12('0x47')]=[{'all':!![]}];}_0xce988=_[_0x1d12('0x3f')]({},_0xce988,_0x46dae0[_0x1d12('0x41')]);return db[_0x1d12('0x2e')][_0x1d12('0x48')](_0xce988)[_0x1d12('0x25')](handleEntityNotFound(_0xe8dedd,null))['then'](respondWithResult(_0xe8dedd,null))[_0x1d12('0x49')](handleError(_0xe8dedd,null));};exports[_0x1d12('0x4a')]=function(_0x350ea8,_0x549cd7){return db['SquareRecording']['create'](_0x350ea8[_0x1d12('0x4b')],{})[_0x1d12('0x25')](respondWithResult(_0x549cd7,0xc9))['catch'](handleError(_0x549cd7,null));};exports[_0x1d12('0x23')]=function(_0x444ec1,_0x2049da){if(_0x444ec1[_0x1d12('0x4b')]['id']){delete _0x444ec1[_0x1d12('0x4b')]['id'];}return db[_0x1d12('0x2e')]['find']({'where':{'id':_0x444ec1[_0x1d12('0x45')]['id']}})['then'](handleEntityNotFound(_0x2049da,null))[_0x1d12('0x25')](saveUpdates(_0x444ec1[_0x1d12('0x4b')],null))[_0x1d12('0x25')](respondWithResult(_0x2049da,null))[_0x1d12('0x49')](handleError(_0x2049da,null));};exports[_0x1d12('0x4c')]=function(_0x212e47,_0xe4ede7,_0x5ae930){var _0x599f0d=require(_0x1d12('0x4d'));var _0x4cfec7=![];var _0x2627bf={};if(_0x212e47[_0x1d12('0x34')][_0x1d12('0x30')]&&_0x212e47['query']['type']===_0x1d12('0x4e')){_0x2627bf['uniqueid']=_0x212e47['params']['id'];}else{_0x2627bf['id']=_0x212e47[_0x1d12('0x45')]['id'];}return db['SquareRecording'][_0x1d12('0x48')]({'where':_0x2627bf,'attributes':['id',_0x1d12('0x4f'),_0x1d12('0x50')],'raw':!![]})[_0x1d12('0x25')](handleEntityNotFound(_0xe4ede7,null))['then'](function(_0x5516b4){if(_0x5516b4){var _0x12c134=_0x5516b4[_0x1d12('0x4f')];var _0x55a070=util[_0x1d12('0x51')](_0x1d12('0x52'),_0x12c134);if(fs[_0x1d12('0x53')](_0x55a070)){_0x4cfec7=!![];return _0x599f0d['decryptFile'](_0x55a070,_0x12c134,config['secrets'][_0x1d12('0x54')])['then'](function(){return _0x5516b4;});}return _0x5516b4;}})['then'](function(_0x5b2c15){if(_0x5b2c15){var _0x1470b8=_0x5b2c15[_0x1d12('0x4f')];if(!fs[_0x1d12('0x53')](_0x1470b8)){throw new db['Sequelize'][(_0x1d12('0x55'))]('SquareRecording\x20not\x20found');}if(_0x5b2c15['filename']){return _0xe4ede7[_0x1d12('0x4c')](_0x1470b8,_0x5b2c15[_0x1d12('0x50')]+path['extname'](_0x1470b8),function(){if(_0x4cfec7){fs[_0x1d12('0x56')](_0x1470b8);}});}else{return _0xe4ede7[_0x1d12('0x4c')](_0x1470b8,function(_0x38c605){if(_0x4cfec7){fs[_0x1d12('0x56')](_0x1470b8);}});}}})[_0x1d12('0x49')](function(_0x16243b){if(_0x16243b[_0x1d12('0x57')]===_0x1d12('0x58')){_0xe4ede7[_0x1d12('0x19')](0x194)['send'](_0x1d12('0x59'));}else{return handleError(_0xe4ede7,null);}});};exports['destroy']=function(_0x569dc1,_0x48845b){return db['SquareRecording']['find']({'where':{'id':_0x569dc1[_0x1d12('0x45')]['id']}})[_0x1d12('0x25')](function(_0x82a70f){if(_[_0x1d12('0x5a')](_0x82a70f)){throw new ReferenceError(_0x1d12('0x5b'));}return _0x82a70f;})[_0x1d12('0x25')](function(_0xb7b9a4){var _0xf135d2=_0xb7b9a4['savePath'];logger['info'](_0x1d12('0x5c'),_0xf135d2);if(!_[_0x1d12('0x5a')](_0xb7b9a4[_0x1d12('0x4f')])&&fs[_0x1d12('0x53')](_0xf135d2)){logger[_0x1d12('0x5d')](_0x1d12('0x5e')+_0xf135d2+_0x1d12('0x5f'));fs['unlinkSync'](_0xf135d2);}_0xf135d2=_0xf135d2+'.cypher';if(!_[_0x1d12('0x5a')](_0xb7b9a4[_0x1d12('0x4f')])&&fs[_0x1d12('0x53')](_0xf135d2)){logger[_0x1d12('0x5d')](_0x1d12('0x5e')+_0xf135d2+_0x1d12('0x5f'));fs[_0x1d12('0x60')](_0xf135d2);}return _0xb7b9a4;})[_0x1d12('0x25')](function(_0x6fafad){if(!_0x6fafad)throw new InternalError();return _0x6fafad['destroy']();})[_0x1d12('0x25')](function(){_0x48845b[_0x1d12('0x19')](0xcc)[_0x1d12('0x26')]();})[_0x1d12('0x49')](handleError(_0x48845b,null));}; \ No newline at end of file +var _0xa68c=['catch','show','params','rawAttributes','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','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','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','name','send','index','map','SquareRecording','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xa68c,0x87));var _0xca68=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa68c[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0xca68('0x0'));var rimraf=require(_0xca68('0x1'));var zipdir=require(_0xca68('0x2'));var jsonpatch=require(_0xca68('0x3'));var rp=require(_0xca68('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca68('0x5'));var util=require(_0xca68('0x6'));var path=require(_0xca68('0x7'));var sox=require(_0xca68('0x8'));var csv=require('to-csv');var ejs=require(_0xca68('0x9'));var fs=require('fs');var fs_extra=require(_0xca68('0xa'));var _=require(_0xca68('0xb'));var squel=require(_0xca68('0xc'));var crypto=require(_0xca68('0xd'));var jsforce=require(_0xca68('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xca68('0xf'));var querystring=require(_0xca68('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xca68('0x11'));var qs=require(_0xca68('0x12'));var as=require(_0xca68('0x13'));var hardwareService=require(_0xca68('0x14'));var logger=require(_0xca68('0x15'))(_0xca68('0x16'));var utils=require(_0xca68('0x17'));var config=require(_0xca68('0x18'));var licenseUtil=require(_0xca68('0x19'));var db=require(_0xca68('0x1a'))['db'];function respondWithStatusCode(_0x56cf54,_0x1592d1){_0x1592d1=_0x1592d1||0xcc;return function(_0x390b1f){if(_0x390b1f){return _0x56cf54[_0xca68('0x1b')](_0x1592d1);}return _0x56cf54[_0xca68('0x1c')](_0x1592d1)[_0xca68('0x1d')]();};}function respondWithResult(_0x15c790,_0x323d18){_0x323d18=_0x323d18||0xc8;return function(_0x15d533){if(_0x15d533){return _0x15c790[_0xca68('0x1c')](_0x323d18)['json'](_0x15d533);}};}function respondWithFilteredResult(_0x56380e,_0x5b41cf){return function(_0x374976){if(_0x374976){var _0x6fb824=typeof _0x5b41cf['offset']===_0xca68('0x1e')&&typeof _0x5b41cf[_0xca68('0x1f')]==='undefined';var _0x4d3997=_0x374976[_0xca68('0x20')];var _0x1cc3cc=_0x6fb824?0x0:_0x5b41cf[_0xca68('0x21')];var _0x9e17d1=_0x6fb824?_0x374976['count']:_0x5b41cf['offset']+_0x5b41cf['limit'];var _0x1f92ff;if(_0x9e17d1>=_0x4d3997){_0x9e17d1=_0x4d3997;_0x1f92ff=0xc8;}else{_0x1f92ff=0xce;}_0x56380e['status'](_0x1f92ff);return _0x56380e['set'](_0xca68('0x22'),_0x1cc3cc+'-'+_0x9e17d1+'/'+_0x4d3997)['json'](_0x374976);}return null;};}function patchUpdates(_0x453373){return function(_0x11d978){try{jsonpatch['apply'](_0x11d978,_0x453373,!![]);}catch(_0x40de7e){return BPromise[_0xca68('0x23')](_0x40de7e);}return _0x11d978[_0xca68('0x24')]();};}function saveUpdates(_0x4cd891,_0x3ee0fd){return function(_0x3a08ed){if(_0x3a08ed){return _0x3a08ed['update'](_0x4cd891)[_0xca68('0x25')](function(_0x24b2f6){return _0x24b2f6;});}return null;};}function removeEntity(_0x286ab9,_0x247568){return function(_0x36e176){if(_0x36e176){return _0x36e176[_0xca68('0x26')]()[_0xca68('0x25')](function(){_0x286ab9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x115958,_0x516f12){return function(_0x317401){if(!_0x317401){_0x115958[_0xca68('0x1b')](0x194);}return _0x317401;};}function handleError(_0x14fdaf,_0x5b1283){_0x5b1283=_0x5b1283||0x1f4;return function(_0x277029){logger['error'](_0x277029['stack']);if(_0x277029[_0xca68('0x27')]){delete _0x277029[_0xca68('0x27')];}_0x14fdaf[_0xca68('0x1c')](_0x5b1283)[_0xca68('0x28')](_0x277029);};}exports[_0xca68('0x29')]=function(_0x12ed03,_0x364780){var _0xe7c68f={},_0x333eff={},_0x549c24={'count':0x0,'rows':[]};var _0x1fb73c=_[_0xca68('0x2a')](db[_0xca68('0x2b')]['rawAttributes'],function(_0x4ef3f0){return{'name':_0x4ef3f0[_0xca68('0x2c')],'type':_0x4ef3f0['type'][_0xca68('0x2d')]};});_0x333eff[_0xca68('0x2e')]=_[_0xca68('0x2a')](_0x1fb73c,_0xca68('0x27'));_0x333eff[_0xca68('0x2f')]=_[_0xca68('0x30')](_0x12ed03[_0xca68('0x2f')]);_0x333eff['filters']=_['intersection'](_0x333eff[_0xca68('0x2e')],_0x333eff['query']);_0xe7c68f[_0xca68('0x31')]=_[_0xca68('0x32')](_0x333eff['model'],qs[_0xca68('0x33')](_0x12ed03[_0xca68('0x2f')][_0xca68('0x33')]));_0xe7c68f[_0xca68('0x31')]=_0xe7c68f[_0xca68('0x31')][_0xca68('0x34')]?_0xe7c68f['attributes']:_0x333eff[_0xca68('0x2e')];if(!_0x12ed03['query'][_0xca68('0x35')](_0xca68('0x36'))){_0xe7c68f[_0xca68('0x1f')]=qs['limit'](_0x12ed03[_0xca68('0x2f')][_0xca68('0x1f')]);_0xe7c68f[_0xca68('0x21')]=qs[_0xca68('0x21')](_0x12ed03[_0xca68('0x2f')][_0xca68('0x21')]);}_0xe7c68f['order']=qs[_0xca68('0x37')](_0x12ed03[_0xca68('0x2f')][_0xca68('0x37')]);_0xe7c68f['where']=qs[_0xca68('0x38')](_['pick'](_0x12ed03[_0xca68('0x2f')],_0x333eff[_0xca68('0x38')]),_0x1fb73c);if(_0x12ed03[_0xca68('0x2f')][_0xca68('0x39')]){_0xe7c68f[_0xca68('0x3a')]=_['merge'](_0xe7c68f[_0xca68('0x3a')],{'$or':_['map'](_0x1fb73c,function(_0x2a0948){if(_0x2a0948[_0xca68('0x3b')]!==_0xca68('0x3c')){var _0x15d80a={};_0x15d80a[_0x2a0948[_0xca68('0x27')]]={'$like':'%'+_0x12ed03[_0xca68('0x2f')][_0xca68('0x39')]+'%'};return _0x15d80a;}})});}_0xe7c68f=_[_0xca68('0x3d')]({},_0xe7c68f,_0x12ed03[_0xca68('0x3e')]);var _0x4edb92={'where':_0xe7c68f[_0xca68('0x3a')]};return db['SquareRecording'][_0xca68('0x20')](_0x4edb92)[_0xca68('0x25')](function(_0x59a525){_0x549c24[_0xca68('0x20')]=_0x59a525;if(_0x12ed03[_0xca68('0x2f')][_0xca68('0x3f')]){_0xe7c68f[_0xca68('0x40')]=[{'all':!![]}];}return db['SquareRecording'][_0xca68('0x41')](_0xe7c68f);})[_0xca68('0x25')](function(_0x38e503){_0x549c24[_0xca68('0x42')]=_0x38e503;return _0x549c24;})['then'](respondWithFilteredResult(_0x364780,_0xe7c68f))[_0xca68('0x43')](handleError(_0x364780,null));};exports[_0xca68('0x44')]=function(_0x181b94,_0x3ce93d){var _0x4ea533={'raw':!![],'where':{'id':_0x181b94[_0xca68('0x45')]['id']}},_0x392c8b={};_0x392c8b[_0xca68('0x2e')]=_['keys'](db['SquareRecording'][_0xca68('0x46')]);_0x392c8b[_0xca68('0x2f')]=_['keys'](_0x181b94[_0xca68('0x2f')]);_0x392c8b[_0xca68('0x38')]=_[_0xca68('0x32')](_0x392c8b[_0xca68('0x2e')],_0x392c8b['query']);_0x4ea533[_0xca68('0x31')]=_[_0xca68('0x32')](_0x392c8b[_0xca68('0x2e')],qs['fields'](_0x181b94['query'][_0xca68('0x33')]));_0x4ea533['attributes']=_0x4ea533[_0xca68('0x31')][_0xca68('0x34')]?_0x4ea533[_0xca68('0x31')]:_0x392c8b['model'];if(_0x181b94['query'][_0xca68('0x3f')]){_0x4ea533[_0xca68('0x40')]=[{'all':!![]}];}_0x4ea533=_[_0xca68('0x3d')]({},_0x4ea533,_0x181b94['options']);return db['SquareRecording'][_0xca68('0x47')](_0x4ea533)[_0xca68('0x25')](handleEntityNotFound(_0x3ce93d,null))['then'](respondWithResult(_0x3ce93d,null))[_0xca68('0x43')](handleError(_0x3ce93d,null));};exports[_0xca68('0x48')]=function(_0x29d0fc,_0x37811e){return db[_0xca68('0x2b')][_0xca68('0x48')](_0x29d0fc[_0xca68('0x49')],{})[_0xca68('0x25')](respondWithResult(_0x37811e,0xc9))[_0xca68('0x43')](handleError(_0x37811e,null));};exports[_0xca68('0x4a')]=function(_0x304048,_0x41ddd0){if(_0x304048[_0xca68('0x49')]['id']){delete _0x304048[_0xca68('0x49')]['id'];}return db[_0xca68('0x2b')]['find']({'where':{'id':_0x304048[_0xca68('0x45')]['id']}})[_0xca68('0x25')](handleEntityNotFound(_0x41ddd0,null))['then'](saveUpdates(_0x304048[_0xca68('0x49')],null))[_0xca68('0x25')](respondWithResult(_0x41ddd0,null))['catch'](handleError(_0x41ddd0,null));};exports[_0xca68('0x4b')]=function(_0xebb294,_0x3e06e8,_0x33bf2f){var _0x416744=require(_0xca68('0x4c'));var _0x2a2a97=![];var _0x244484={};if(_0xebb294[_0xca68('0x2f')][_0xca68('0x3b')]&&_0xebb294[_0xca68('0x2f')][_0xca68('0x3b')]===_0xca68('0x4d')){_0x244484[_0xca68('0x4d')]=_0xebb294['params']['id'];}else{_0x244484['id']=_0xebb294['params']['id'];}return db[_0xca68('0x2b')][_0xca68('0x47')]({'where':_0x244484,'attributes':['id',_0xca68('0x4e'),_0xca68('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x3e06e8,null))['then'](function(_0x429e7c){if(_0x429e7c){var _0x2a08e9=_0x429e7c[_0xca68('0x4e')];var _0x3fbdb7=util[_0xca68('0x50')](_0xca68('0x51'),_0x2a08e9);if(fs[_0xca68('0x52')](_0x3fbdb7)){_0x2a2a97=!![];return _0x416744[_0xca68('0x53')](_0x3fbdb7,_0x2a08e9,config[_0xca68('0x54')][_0xca68('0x55')])[_0xca68('0x25')](function(){return _0x429e7c;});}return _0x429e7c;}})[_0xca68('0x25')](function(_0x43a73f){if(_0x43a73f){var _0x3e1dbe=_0x43a73f['savePath'];if(!fs[_0xca68('0x52')](_0x3e1dbe)){throw new db[(_0xca68('0x56'))][(_0xca68('0x57'))](_0xca68('0x58'));}if(_0x43a73f[_0xca68('0x4f')]){return _0x3e06e8['download'](_0x3e1dbe,_0x43a73f[_0xca68('0x4f')]+path[_0xca68('0x59')](_0x3e1dbe),function(){if(_0x2a2a97){fs[_0xca68('0x5a')](_0x3e1dbe);}});}else{return _0x3e06e8[_0xca68('0x4b')](_0x3e1dbe,function(_0x5c8f20){if(_0x2a2a97){fs[_0xca68('0x5a')](_0x3e1dbe);}});}}})[_0xca68('0x43')](function(_0x39b0bd){if(_0x39b0bd[_0xca68('0x5b')]==='SquareRecording\x20not\x20found'){_0x3e06e8['status'](0x194)[_0xca68('0x28')](_0xca68('0x5c'));}else{return handleError(_0x3e06e8,null);}});};exports[_0xca68('0x26')]=function(_0xd7f61d,_0x3be7a4){return db[_0xca68('0x2b')][_0xca68('0x47')]({'where':{'id':_0xd7f61d[_0xca68('0x45')]['id']}})[_0xca68('0x25')](function(_0x53d90a){if(_[_0xca68('0x5d')](_0x53d90a)){throw new ReferenceError(_0xca68('0x5e'));}return _0x53d90a;})[_0xca68('0x25')](function(_0x324857){var _0x4877cd=_0x324857[_0xca68('0x4e')];logger[_0xca68('0x5f')](_0xca68('0x60'),_0x4877cd);if(!_[_0xca68('0x5d')](_0x324857[_0xca68('0x4e')])&&fs[_0xca68('0x52')](_0x4877cd)){logger[_0xca68('0x5f')](_0xca68('0x61')+_0x4877cd+_0xca68('0x62'));fs[_0xca68('0x63')](_0x4877cd);}_0x4877cd=_0x4877cd+_0xca68('0x64');if(!_['isNil'](_0x324857[_0xca68('0x4e')])&&fs[_0xca68('0x52')](_0x4877cd)){logger[_0xca68('0x5f')](_0xca68('0x61')+_0x4877cd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xca68('0x63')](_0x4877cd);}return _0x324857;})[_0xca68('0x25')](function(_0x4b2c1c){if(!_0x4b2c1c)throw new InternalError();return _0x4b2c1c[_0xca68('0x26')]();})[_0xca68('0x25')](function(){_0x3be7a4[_0xca68('0x1c')](0xcc)[_0xca68('0x1d')]();})['catch'](handleError(_0x3be7a4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2354251..f716fbf 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 _0x3d04=['../../config/environment','./squareRecording.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7292=['api','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x7292,0x6d));var _0x2729=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x7292[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var logger=require(_0x2729('0x2'))(_0x2729('0x3'));var moment=require(_0x2729('0x4'));var BPromise=require(_0x2729('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2729('0x6'));var rimraf=require(_0x2729('0x7'));var config=require(_0x2729('0x8'));var attributes=require(_0x2729('0x9'));module[_0x2729('0xa')]=function(_0x4db88a,_0x119935){return _0x4db88a[_0x2729('0xb')](_0x2729('0xc'),attributes,{'tableName':_0x2729('0xd'),'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 9e76fee..51dc619 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 _0x67f8=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3f04e5,_0x4457eb){var _0x261e65=function(_0x30764c){while(--_0x30764c){_0x3f04e5['push'](_0x3f04e5['shift']());}};_0x261e65(++_0x4457eb);}(_0x67f8,0x88));var _0x867f=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x67f8[_0x1098db];return _0x14f090;};'use strict';var _=require(_0x867f('0x0'));var util=require(_0x867f('0x1'));var moment=require('moment');var BPromise=require(_0x867f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x867f('0x3'));var db=require(_0x867f('0x4'))['db'];var utils=require(_0x867f('0x5'));var logger=require('../../config/logger')(_0x867f('0x6'));var config=require(_0x867f('0x7'));var jayson=require(_0x867f('0x8'));var client=jayson[_0x867f('0x9')][_0x867f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef311,_0x2af7eb,_0x4b3d10){return new BPromise(function(_0x2f6cec,_0x24071d){return client[_0x867f('0xb')](_0x3ef311,_0x4b3d10)[_0x867f('0xc')](function(_0x482c69){logger[_0x867f('0xd')](_0x867f('0xe'),_0x2af7eb,_0x867f('0xf'));logger[_0x867f('0x10')](_0x867f('0x11'),_0x2af7eb,_0x867f('0xf'),JSON['stringify'](_0x482c69));if(_0x482c69[_0x867f('0x12')]){if(_0x482c69['error'][_0x867f('0x13')]===0x1f4){logger[_0x867f('0x12')](_0x867f('0xe'),_0x2af7eb,_0x482c69[_0x867f('0x12')][_0x867f('0x14')]);return _0x24071d(_0x482c69[_0x867f('0x12')][_0x867f('0x14')]);}logger[_0x867f('0x12')](_0x867f('0xe'),_0x2af7eb,_0x482c69['error'][_0x867f('0x14')]);return _0x2f6cec(_0x482c69[_0x867f('0x12')][_0x867f('0x14')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x2af7eb,_0x867f('0xf'));_0x2f6cec(_0x482c69[_0x867f('0x15')][_0x867f('0x14')]);}})[_0x867f('0x16')](function(_0x1b808f){logger['error'](_0x867f('0xe'),_0x2af7eb,_0x1b808f);_0x24071d(_0x1b808f);});});}exports[_0x867f('0x17')]=function(_0x9e22b4){var _0xd0b0b5=this;return new Promise(function(_0x115a9d,_0x377f16){return db[_0x867f('0x18')][_0x867f('0x19')](_0x9e22b4[_0x867f('0x1a')],{'raw':_0x9e22b4[_0x867f('0x1b')]?_0x9e22b4[_0x867f('0x1b')][_0x867f('0x1c')]===undefined?!![]:![]:!![]})[_0x867f('0xc')](function(_0x26a144){logger['info'](_0x867f('0x17'),_0x9e22b4);logger[_0x867f('0x10')](_0x867f('0x17'),_0x9e22b4,JSON[_0x867f('0x1d')](_0x26a144));_0x115a9d(_0x26a144);})[_0x867f('0x16')](function(_0x23f07a){logger[_0x867f('0x12')](_0x867f('0x17'),_0x23f07a[_0x867f('0x14')],_0x9e22b4);_0x377f16(_0xd0b0b5[_0x867f('0x12')](0x1f4,_0x23f07a['message']));});});}; \ No newline at end of file +var _0x3439=['stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x3439,0xd3));var _0x9343=function(_0x207c6a,_0x2a257b){_0x207c6a=_0x207c6a-0x0;var _0x4a5dc0=_0x3439[_0x207c6a];return _0x4a5dc0;};'use strict';var _=require(_0x9343('0x0'));var util=require('util');var moment=require(_0x9343('0x1'));var BPromise=require(_0x9343('0x2'));var rs=require(_0x9343('0x3'));var fs=require('fs');var Redis=require(_0x9343('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9343('0x5'));var logger=require(_0x9343('0x6'))(_0x9343('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9343('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5260b2,_0x1371b8,_0x2ae163){return new BPromise(function(_0x2aead7,_0x2730e0){return client['request'](_0x5260b2,_0x2ae163)['then'](function(_0x44d87b){logger[_0x9343('0x9')](_0x9343('0xa'),_0x1371b8,_0x9343('0xb'));logger[_0x9343('0xc')](_0x9343('0xd'),_0x1371b8,_0x9343('0xb'),JSON[_0x9343('0xe')](_0x44d87b));if(_0x44d87b[_0x9343('0xf')]){if(_0x44d87b[_0x9343('0xf')][_0x9343('0x10')]===0x1f4){logger[_0x9343('0xf')]('SquareRecording,\x20%s,\x20%s',_0x1371b8,_0x44d87b['error']['message']);return _0x2730e0(_0x44d87b['error'][_0x9343('0x11')]);}logger[_0x9343('0xf')](_0x9343('0xa'),_0x1371b8,_0x44d87b[_0x9343('0xf')][_0x9343('0x11')]);return _0x2aead7(_0x44d87b[_0x9343('0xf')][_0x9343('0x11')]);}else{logger[_0x9343('0x9')](_0x9343('0xa'),_0x1371b8,_0x9343('0xb'));_0x2aead7(_0x44d87b[_0x9343('0x12')][_0x9343('0x11')]);}})[_0x9343('0x13')](function(_0x3f5ca2){logger[_0x9343('0xf')]('SquareRecording,\x20%s,\x20%s',_0x1371b8,_0x3f5ca2);_0x2730e0(_0x3f5ca2);});});}exports[_0x9343('0x14')]=function(_0x31e205){var _0xce5f74=this;return new Promise(function(_0x2fb402,_0x500408){return db[_0x9343('0x15')][_0x9343('0x16')](_0x31e205['body'],{'raw':_0x31e205[_0x9343('0x17')]?_0x31e205[_0x9343('0x17')][_0x9343('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1adc9a){logger['info']('CreateSquareRecording',_0x31e205);logger[_0x9343('0xc')]('CreateSquareRecording',_0x31e205,JSON[_0x9343('0xe')](_0x1adc9a));_0x2fb402(_0x1adc9a);})['catch'](function(_0x137c62){logger['error'](_0x9343('0x14'),_0x137c62[_0x9343('0x11')],_0x31e205);_0x500408(_0xce5f74[_0x9343('0xf')](0x1f4,_0x137c62[_0x9343('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 543b99f..d264015 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x5266b9,_0x30e19d){var _0x5afd8c=function(_0x2d91f7){while(--_0x2d91f7){_0x5266b9['push'](_0x5266b9['shift']());}};_0x5afd8c(++_0x30e19d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a341c90..5c38dee 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 _0x6054=['BOOLEAN','sequelize','STRING'];(function(_0x2612fa,_0x5e9828){var _0x4aef66=function(_0x1c6ad3){while(--_0x1c6ad3){_0x2612fa['push'](_0x2612fa['shift']());}};_0x4aef66(++_0x5e9828);}(_0x6054,0x127));var _0x4605=function(_0xbbbeae,_0x4a414a){_0xbbbeae=_0xbbbeae-0x0;var _0x1cb9c9=_0x6054[_0xbbbeae];return _0x1cb9c9;};'use strict';var Sequelize=require(_0x4605('0x0'));module['exports']={'network':{'type':Sequelize[_0x4605('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4605('0x1')]},'channel':{'type':Sequelize[_0x4605('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4605('0x1')]},'version':{'type':Sequelize[_0x4605('0x1')]},'callerid':{'type':Sequelize[_0x4605('0x1')]},'calleridname':{'type':Sequelize[_0x4605('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4605('0x1')]},'callington':{'type':Sequelize[_0x4605('0x1')]},'callingtns':{'type':Sequelize[_0x4605('0x1')]},'dnid':{'type':Sequelize[_0x4605('0x1')]},'rdnis':{'type':Sequelize[_0x4605('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4605('0x1')]},'priority':{'type':Sequelize[_0x4605('0x1')]},'enhanced':{'type':Sequelize[_0x4605('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x4605('0x1')]},'project_name':{'type':Sequelize[_0x4605('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x4605('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f1e=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2473cb,_0x3149dd){var _0x53c48f=function(_0x13d8c3){while(--_0x13d8c3){_0x2473cb['push'](_0x2473cb['shift']());}};_0x53c48f(++_0x3149dd);}(_0x4f1e,0x168));var _0xe4f1=function(_0x1fdd56,_0x16807b){_0x1fdd56=_0x1fdd56-0x0;var _0x38c03f=_0x4f1e[_0x1fdd56];return _0x38c03f;};'use strict';var Sequelize=require(_0xe4f1('0x0'));module[_0xe4f1('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe4f1('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe4f1('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe4f1('0x2')]},'calleridname':{'type':Sequelize[_0xe4f1('0x2')]},'callingpres':{'type':Sequelize[_0xe4f1('0x2')]},'callingani2':{'type':Sequelize[_0xe4f1('0x2')]},'callington':{'type':Sequelize[_0xe4f1('0x2')]},'callingtns':{'type':Sequelize[_0xe4f1('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe4f1('0x2')]},'extension':{'type':Sequelize[_0xe4f1('0x2')]},'priority':{'type':Sequelize[_0xe4f1('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe4f1('0x2')]},'threadid':{'type':Sequelize[_0xe4f1('0x2')]},'project_name':{'type':Sequelize[_0xe4f1('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe4f1('0x3')]},'bot':{'type':Sequelize[_0xe4f1('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 7b7035b..fa249a6 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 _0xb600=['includeAll','include','findAll','rows','catch','show','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','apply','reject','then','destroy','end','error','stack','name','send','index','SquareReport','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options'];(function(_0x31ac1e,_0x1fadac){var _0x279cae=function(_0x34d637){while(--_0x34d637){_0x31ac1e['push'](_0x31ac1e['shift']());}};_0x279cae(++_0x1fadac);}(_0xb600,0x1ce));var _0x0b60=function(_0x23c550,_0x7e41c4){_0x23c550=_0x23c550-0x0;var _0x5635b1=_0xb600[_0x23c550];return _0x5635b1;};'use strict';var emlformat=require(_0x0b60('0x0'));var rimraf=require(_0x0b60('0x1'));var zipdir=require(_0x0b60('0x2'));var jsonpatch=require(_0x0b60('0x3'));var rp=require(_0x0b60('0x4'));var moment=require(_0x0b60('0x5'));var BPromise=require(_0x0b60('0x6'));var Mustache=require(_0x0b60('0x7'));var util=require('util');var path=require(_0x0b60('0x8'));var sox=require(_0x0b60('0x9'));var csv=require('to-csv');var ejs=require(_0x0b60('0xa'));var fs=require('fs');var fs_extra=require(_0x0b60('0xb'));var _=require('lodash');var squel=require(_0x0b60('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b60('0xd'));var toCsv=require(_0x0b60('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0b60('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0b60('0x10'));var as=require(_0x0b60('0x11'));var hardwareService=require(_0x0b60('0x12'));var logger=require(_0x0b60('0x13'))(_0x0b60('0x14'));var utils=require('../../config/utils');var config=require(_0x0b60('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b60('0x16'))['db'];function respondWithStatusCode(_0x5d87fe,_0x1f3dd4){_0x1f3dd4=_0x1f3dd4||0xcc;return function(_0x1f120e){if(_0x1f120e){return _0x5d87fe[_0x0b60('0x17')](_0x1f3dd4);}return _0x5d87fe['status'](_0x1f3dd4)['end']();};}function respondWithResult(_0x1ddfae,_0x2a785f){_0x2a785f=_0x2a785f||0xc8;return function(_0x595451){if(_0x595451){return _0x1ddfae['status'](_0x2a785f)[_0x0b60('0x18')](_0x595451);}};}function respondWithFilteredResult(_0x4d2cec,_0x50d217){return function(_0x3c90d7){if(_0x3c90d7){var _0x2393e4=typeof _0x50d217['offset']===_0x0b60('0x19')&&typeof _0x50d217[_0x0b60('0x1a')]===_0x0b60('0x19');var _0x74e8ad=_0x3c90d7[_0x0b60('0x1b')];var _0x1f7dae=_0x2393e4?0x0:_0x50d217[_0x0b60('0x1c')];var _0x861bbf=_0x2393e4?_0x3c90d7['count']:_0x50d217[_0x0b60('0x1c')]+_0x50d217[_0x0b60('0x1a')];var _0x3d5524;if(_0x861bbf>=_0x74e8ad){_0x861bbf=_0x74e8ad;_0x3d5524=0xc8;}else{_0x3d5524=0xce;}_0x4d2cec[_0x0b60('0x1d')](_0x3d5524);return _0x4d2cec[_0x0b60('0x1e')]('Content-Range',_0x1f7dae+'-'+_0x861bbf+'/'+_0x74e8ad)[_0x0b60('0x18')](_0x3c90d7);}return null;};}function patchUpdates(_0x139c1f){return function(_0xe16567){try{jsonpatch[_0x0b60('0x1f')](_0xe16567,_0x139c1f,!![]);}catch(_0x3db8c9){return BPromise[_0x0b60('0x20')](_0x3db8c9);}return _0xe16567['save']();};}function saveUpdates(_0x30b89a,_0x2f0fbc){return function(_0x145984){if(_0x145984){return _0x145984['update'](_0x30b89a)[_0x0b60('0x21')](function(_0x48663c){return _0x48663c;});}return null;};}function removeEntity(_0x23ec37,_0x15a773){return function(_0x2d56ee){if(_0x2d56ee){return _0x2d56ee[_0x0b60('0x22')]()['then'](function(){_0x23ec37['status'](0xcc)[_0x0b60('0x23')]();});}};}function handleEntityNotFound(_0x555c51,_0x2d4542){return function(_0x433b87){if(!_0x433b87){_0x555c51[_0x0b60('0x17')](0x194);}return _0x433b87;};}function handleError(_0x39c417,_0x3dfff1){_0x3dfff1=_0x3dfff1||0x1f4;return function(_0x5447f6){logger[_0x0b60('0x24')](_0x5447f6[_0x0b60('0x25')]);if(_0x5447f6['name']){delete _0x5447f6[_0x0b60('0x26')];}_0x39c417[_0x0b60('0x1d')](_0x3dfff1)[_0x0b60('0x27')](_0x5447f6);};}exports[_0x0b60('0x28')]=function(_0x3acb2b,_0x636ec4){var _0x1447b6={},_0x5ed987={},_0x1c9c21={'count':0x0,'rows':[]};var _0x2d52f5=_['map'](db[_0x0b60('0x29')][_0x0b60('0x2a')],function(_0x4f68b6){return{'name':_0x4f68b6['fieldName'],'type':_0x4f68b6[_0x0b60('0x2b')][_0x0b60('0x2c')]};});_0x5ed987[_0x0b60('0x2d')]=_[_0x0b60('0x2e')](_0x2d52f5,_0x0b60('0x26'));_0x5ed987[_0x0b60('0x2f')]=_[_0x0b60('0x30')](_0x3acb2b['query']);_0x5ed987['filters']=_['intersection'](_0x5ed987['model'],_0x5ed987[_0x0b60('0x2f')]);_0x1447b6[_0x0b60('0x31')]=_[_0x0b60('0x32')](_0x5ed987[_0x0b60('0x2d')],qs['fields'](_0x3acb2b[_0x0b60('0x2f')][_0x0b60('0x33')]));_0x1447b6['attributes']=_0x1447b6[_0x0b60('0x31')][_0x0b60('0x34')]?_0x1447b6[_0x0b60('0x31')]:_0x5ed987[_0x0b60('0x2d')];if(!_0x3acb2b['query'][_0x0b60('0x35')](_0x0b60('0x36'))){_0x1447b6[_0x0b60('0x1a')]=qs['limit'](_0x3acb2b['query']['limit']);_0x1447b6[_0x0b60('0x1c')]=qs[_0x0b60('0x1c')](_0x3acb2b[_0x0b60('0x2f')][_0x0b60('0x1c')]);}_0x1447b6[_0x0b60('0x37')]=qs[_0x0b60('0x38')](_0x3acb2b[_0x0b60('0x2f')][_0x0b60('0x38')]);_0x1447b6[_0x0b60('0x39')]=qs[_0x0b60('0x3a')](_[_0x0b60('0x3b')](_0x3acb2b[_0x0b60('0x2f')],_0x5ed987[_0x0b60('0x3a')]),_0x2d52f5);if(_0x3acb2b[_0x0b60('0x2f')]['filter']){_0x1447b6[_0x0b60('0x39')]=_[_0x0b60('0x3c')](_0x1447b6[_0x0b60('0x39')],{'$or':_['map'](_0x2d52f5,function(_0x495ec6){if(_0x495ec6[_0x0b60('0x2b')]!==_0x0b60('0x3d')){var _0x329595={};_0x329595[_0x495ec6[_0x0b60('0x26')]]={'$like':'%'+_0x3acb2b[_0x0b60('0x2f')]['filter']+'%'};return _0x329595;}})});}_0x1447b6=_[_0x0b60('0x3c')]({},_0x1447b6,_0x3acb2b[_0x0b60('0x3e')]);var _0x2637d0={'where':_0x1447b6['where']};return db['SquareReport']['count'](_0x2637d0)[_0x0b60('0x21')](function(_0x44e3a6){_0x1c9c21['count']=_0x44e3a6;if(_0x3acb2b[_0x0b60('0x2f')][_0x0b60('0x3f')]){_0x1447b6[_0x0b60('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0x0b60('0x41')](_0x1447b6);})['then'](function(_0x2c9291){_0x1c9c21[_0x0b60('0x42')]=_0x2c9291;return _0x1c9c21;})[_0x0b60('0x21')](respondWithFilteredResult(_0x636ec4,_0x1447b6))[_0x0b60('0x43')](handleError(_0x636ec4,null));};exports[_0x0b60('0x44')]=function(_0x510dae,_0x3424a8){var _0x3a06c5={'raw':!![],'where':{'id':_0x510dae['params']['id']}},_0x14c541={};_0x14c541[_0x0b60('0x2d')]=_[_0x0b60('0x30')](db['SquareReport'][_0x0b60('0x2a')]);_0x14c541[_0x0b60('0x2f')]=_[_0x0b60('0x30')](_0x510dae[_0x0b60('0x2f')]);_0x14c541[_0x0b60('0x3a')]=_[_0x0b60('0x32')](_0x14c541[_0x0b60('0x2d')],_0x14c541[_0x0b60('0x2f')]);_0x3a06c5[_0x0b60('0x31')]=_['intersection'](_0x14c541[_0x0b60('0x2d')],qs[_0x0b60('0x33')](_0x510dae[_0x0b60('0x2f')][_0x0b60('0x33')]));_0x3a06c5[_0x0b60('0x31')]=_0x3a06c5[_0x0b60('0x31')][_0x0b60('0x34')]?_0x3a06c5[_0x0b60('0x31')]:_0x14c541[_0x0b60('0x2d')];if(_0x510dae[_0x0b60('0x2f')][_0x0b60('0x3f')]){_0x3a06c5[_0x0b60('0x40')]=[{'all':!![]}];}_0x3a06c5=_[_0x0b60('0x3c')]({},_0x3a06c5,_0x510dae[_0x0b60('0x3e')]);return db[_0x0b60('0x29')]['find'](_0x3a06c5)['then'](handleEntityNotFound(_0x3424a8,null))['then'](respondWithResult(_0x3424a8,null))['catch'](handleError(_0x3424a8,null));};exports[_0x0b60('0x45')]=function(_0x549101,_0x4a1a01){return db[_0x0b60('0x29')]['create'](_0x549101['body'],{})[_0x0b60('0x21')](respondWithResult(_0x4a1a01,0xc9))[_0x0b60('0x43')](handleError(_0x4a1a01,null));};exports[_0x0b60('0x46')]=function(_0x43e2f1,_0x485b27){if(_0x43e2f1[_0x0b60('0x47')]['id']){delete _0x43e2f1[_0x0b60('0x47')]['id'];}return db[_0x0b60('0x29')][_0x0b60('0x48')]({'where':{'id':_0x43e2f1['params']['id']}})['then'](handleEntityNotFound(_0x485b27,null))[_0x0b60('0x21')](saveUpdates(_0x43e2f1[_0x0b60('0x47')],null))[_0x0b60('0x21')](respondWithResult(_0x485b27,null))[_0x0b60('0x43')](handleError(_0x485b27,null));};exports[_0x0b60('0x22')]=function(_0x485218,_0x583c39){return db[_0x0b60('0x29')][_0x0b60('0x48')]({'where':{'id':_0x485218[_0x0b60('0x49')]['id']}})[_0x0b60('0x21')](handleEntityNotFound(_0x583c39,null))['then'](removeEntity(_0x583c39,null))[_0x0b60('0x43')](handleError(_0x583c39,null));};exports['describe']=function(_0x4dc54d,_0x5d028d){return db['SquareReport'][_0x0b60('0x4a')]()['then'](respondWithResult(_0x5d028d,null))[_0x0b60('0x43')](handleError(_0x5d028d,null));}; \ No newline at end of file +var _0xfe69=['length','nolimit','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','fields','options','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','send','index','map','SquareReport','fieldName','key','query','keys','filters','attributes','intersection','model'];(function(_0xe8adac,_0x2e258f){var _0x3bf258=function(_0x2336d9){while(--_0x2336d9){_0xe8adac['push'](_0xe8adac['shift']());}};_0x3bf258(++_0x2e258f);}(_0xfe69,0x12b));var _0x9fe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe69[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9fe6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9fe6('0x1'));var rp=require(_0x9fe6('0x2'));var moment=require(_0x9fe6('0x3'));var BPromise=require(_0x9fe6('0x4'));var Mustache=require(_0x9fe6('0x5'));var util=require(_0x9fe6('0x6'));var path=require(_0x9fe6('0x7'));var sox=require('sox');var csv=require(_0x9fe6('0x8'));var ejs=require(_0x9fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x9fe6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fe6('0xb'));var jsforce=require(_0x9fe6('0xc'));var deskjs=require(_0x9fe6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9fe6('0xe'));var Papa=require(_0x9fe6('0xf'));var Redis=require(_0x9fe6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9fe6('0x11'));var as=require(_0x9fe6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fe6('0x13'))(_0x9fe6('0x14'));var utils=require('../../config/utils');var config=require(_0x9fe6('0x15'));var licenseUtil=require(_0x9fe6('0x16'));var db=require(_0x9fe6('0x17'))['db'];function respondWithStatusCode(_0x4cb82f,_0x35c4e3){_0x35c4e3=_0x35c4e3||0xcc;return function(_0x392dcd){if(_0x392dcd){return _0x4cb82f[_0x9fe6('0x18')](_0x35c4e3);}return _0x4cb82f[_0x9fe6('0x19')](_0x35c4e3)[_0x9fe6('0x1a')]();};}function respondWithResult(_0x2ca5a3,_0x547ba2){_0x547ba2=_0x547ba2||0xc8;return function(_0x51709f){if(_0x51709f){return _0x2ca5a3['status'](_0x547ba2)[_0x9fe6('0x1b')](_0x51709f);}};}function respondWithFilteredResult(_0x18d286,_0x35b847){return function(_0x2252d4){if(_0x2252d4){var _0x13ea85=typeof _0x35b847['offset']===_0x9fe6('0x1c')&&typeof _0x35b847[_0x9fe6('0x1d')]===_0x9fe6('0x1c');var _0x1a9592=_0x2252d4[_0x9fe6('0x1e')];var _0x110e4f=_0x13ea85?0x0:_0x35b847[_0x9fe6('0x1f')];var _0x32ceec=_0x13ea85?_0x2252d4[_0x9fe6('0x1e')]:_0x35b847[_0x9fe6('0x1f')]+_0x35b847[_0x9fe6('0x1d')];var _0x2ddc14;if(_0x32ceec>=_0x1a9592){_0x32ceec=_0x1a9592;_0x2ddc14=0xc8;}else{_0x2ddc14=0xce;}_0x18d286['status'](_0x2ddc14);return _0x18d286[_0x9fe6('0x20')](_0x9fe6('0x21'),_0x110e4f+'-'+_0x32ceec+'/'+_0x1a9592)[_0x9fe6('0x1b')](_0x2252d4);}return null;};}function patchUpdates(_0x427ba2){return function(_0x5a8922){try{jsonpatch['apply'](_0x5a8922,_0x427ba2,!![]);}catch(_0xd4813c){return BPromise['reject'](_0xd4813c);}return _0x5a8922['save']();};}function saveUpdates(_0x1e06bf,_0x5be909){return function(_0x16e843){if(_0x16e843){return _0x16e843[_0x9fe6('0x22')](_0x1e06bf)['then'](function(_0xb44f73){return _0xb44f73;});}return null;};}function removeEntity(_0x14d548,_0x39e386){return function(_0x3dd9ed){if(_0x3dd9ed){return _0x3dd9ed['destroy']()[_0x9fe6('0x23')](function(){_0x14d548[_0x9fe6('0x19')](0xcc)[_0x9fe6('0x1a')]();});}};}function handleEntityNotFound(_0x3c6e4e,_0x1fed5e){return function(_0x920ae1){if(!_0x920ae1){_0x3c6e4e[_0x9fe6('0x18')](0x194);}return _0x920ae1;};}function handleError(_0x206d85,_0x18cc86){_0x18cc86=_0x18cc86||0x1f4;return function(_0x374837){logger[_0x9fe6('0x24')](_0x374837[_0x9fe6('0x25')]);if(_0x374837[_0x9fe6('0x26')]){delete _0x374837[_0x9fe6('0x26')];}_0x206d85[_0x9fe6('0x19')](_0x18cc86)[_0x9fe6('0x27')](_0x374837);};}exports[_0x9fe6('0x28')]=function(_0x3e9fdc,_0x258d90){var _0x491d63={},_0x4c70c0={},_0x32c615={'count':0x0,'rows':[]};var _0x439163=_[_0x9fe6('0x29')](db[_0x9fe6('0x2a')]['rawAttributes'],function(_0x162c93){return{'name':_0x162c93[_0x9fe6('0x2b')],'type':_0x162c93['type'][_0x9fe6('0x2c')]};});_0x4c70c0['model']=_[_0x9fe6('0x29')](_0x439163,'name');_0x4c70c0[_0x9fe6('0x2d')]=_[_0x9fe6('0x2e')](_0x3e9fdc[_0x9fe6('0x2d')]);_0x4c70c0[_0x9fe6('0x2f')]=_['intersection'](_0x4c70c0['model'],_0x4c70c0[_0x9fe6('0x2d')]);_0x491d63[_0x9fe6('0x30')]=_[_0x9fe6('0x31')](_0x4c70c0[_0x9fe6('0x32')],qs['fields'](_0x3e9fdc['query']['fields']));_0x491d63['attributes']=_0x491d63[_0x9fe6('0x30')][_0x9fe6('0x33')]?_0x491d63['attributes']:_0x4c70c0['model'];if(!_0x3e9fdc[_0x9fe6('0x2d')]['hasOwnProperty'](_0x9fe6('0x34'))){_0x491d63[_0x9fe6('0x1d')]=qs[_0x9fe6('0x1d')](_0x3e9fdc['query'][_0x9fe6('0x1d')]);_0x491d63[_0x9fe6('0x1f')]=qs[_0x9fe6('0x1f')](_0x3e9fdc['query'][_0x9fe6('0x1f')]);}_0x491d63['order']=qs[_0x9fe6('0x35')](_0x3e9fdc['query'][_0x9fe6('0x35')]);_0x491d63[_0x9fe6('0x36')]=qs[_0x9fe6('0x2f')](_['pick'](_0x3e9fdc[_0x9fe6('0x2d')],_0x4c70c0[_0x9fe6('0x2f')]),_0x439163);if(_0x3e9fdc[_0x9fe6('0x2d')][_0x9fe6('0x37')]){_0x491d63[_0x9fe6('0x36')]=_[_0x9fe6('0x38')](_0x491d63[_0x9fe6('0x36')],{'$or':_[_0x9fe6('0x29')](_0x439163,function(_0x174fce){if(_0x174fce['type']!=='VIRTUAL'){var _0x1075bc={};_0x1075bc[_0x174fce[_0x9fe6('0x26')]]={'$like':'%'+_0x3e9fdc[_0x9fe6('0x2d')]['filter']+'%'};return _0x1075bc;}})});}_0x491d63=_[_0x9fe6('0x38')]({},_0x491d63,_0x3e9fdc['options']);var _0x204b36={'where':_0x491d63['where']};return db[_0x9fe6('0x2a')][_0x9fe6('0x1e')](_0x204b36)['then'](function(_0x2dff5d){_0x32c615[_0x9fe6('0x1e')]=_0x2dff5d;if(_0x3e9fdc['query'][_0x9fe6('0x39')]){_0x491d63[_0x9fe6('0x3a')]=[{'all':!![]}];}return db[_0x9fe6('0x2a')][_0x9fe6('0x3b')](_0x491d63);})[_0x9fe6('0x23')](function(_0x1ec64f){_0x32c615[_0x9fe6('0x3c')]=_0x1ec64f;return _0x32c615;})[_0x9fe6('0x23')](respondWithFilteredResult(_0x258d90,_0x491d63))[_0x9fe6('0x3d')](handleError(_0x258d90,null));};exports['show']=function(_0x588009,_0x133304){var _0x4fdd4f={'raw':!![],'where':{'id':_0x588009[_0x9fe6('0x3e')]['id']}},_0x1ff690={};_0x1ff690[_0x9fe6('0x32')]=_[_0x9fe6('0x2e')](db[_0x9fe6('0x2a')]['rawAttributes']);_0x1ff690['query']=_[_0x9fe6('0x2e')](_0x588009['query']);_0x1ff690[_0x9fe6('0x2f')]=_[_0x9fe6('0x31')](_0x1ff690[_0x9fe6('0x32')],_0x1ff690['query']);_0x4fdd4f[_0x9fe6('0x30')]=_['intersection'](_0x1ff690['model'],qs[_0x9fe6('0x3f')](_0x588009['query']['fields']));_0x4fdd4f[_0x9fe6('0x30')]=_0x4fdd4f[_0x9fe6('0x30')]['length']?_0x4fdd4f[_0x9fe6('0x30')]:_0x1ff690[_0x9fe6('0x32')];if(_0x588009['query'][_0x9fe6('0x39')]){_0x4fdd4f['include']=[{'all':!![]}];}_0x4fdd4f=_[_0x9fe6('0x38')]({},_0x4fdd4f,_0x588009[_0x9fe6('0x40')]);return db[_0x9fe6('0x2a')][_0x9fe6('0x41')](_0x4fdd4f)[_0x9fe6('0x23')](handleEntityNotFound(_0x133304,null))[_0x9fe6('0x23')](respondWithResult(_0x133304,null))[_0x9fe6('0x3d')](handleError(_0x133304,null));};exports[_0x9fe6('0x42')]=function(_0x45c327,_0x3cdcf1){return db['SquareReport'][_0x9fe6('0x42')](_0x45c327[_0x9fe6('0x43')],{})['then'](respondWithResult(_0x3cdcf1,0xc9))[_0x9fe6('0x3d')](handleError(_0x3cdcf1,null));};exports[_0x9fe6('0x22')]=function(_0x1ba7e9,_0x3f02f7){if(_0x1ba7e9[_0x9fe6('0x43')]['id']){delete _0x1ba7e9['body']['id'];}return db[_0x9fe6('0x2a')][_0x9fe6('0x41')]({'where':{'id':_0x1ba7e9[_0x9fe6('0x3e')]['id']}})[_0x9fe6('0x23')](handleEntityNotFound(_0x3f02f7,null))[_0x9fe6('0x23')](saveUpdates(_0x1ba7e9[_0x9fe6('0x43')],null))['then'](respondWithResult(_0x3f02f7,null))[_0x9fe6('0x3d')](handleError(_0x3f02f7,null));};exports[_0x9fe6('0x44')]=function(_0x490f29,_0x3d60b0){return db[_0x9fe6('0x2a')][_0x9fe6('0x41')]({'where':{'id':_0x490f29[_0x9fe6('0x3e')]['id']}})[_0x9fe6('0x23')](handleEntityNotFound(_0x3d60b0,null))[_0x9fe6('0x23')](removeEntity(_0x3d60b0,null))[_0x9fe6('0x3d')](handleError(_0x3d60b0,null));};exports[_0x9fe6('0x45')]=function(_0x580338,_0x4ca9b6){return db['SquareReport'][_0x9fe6('0x45')]()[_0x9fe6('0x23')](respondWithResult(_0x4ca9b6,null))[_0x9fe6('0x3d')](handleError(_0x4ca9b6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index fdf91a1..2206b45 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 _0xafae=['leaveAt','lodash','../../config/logger','api','moment','../../config/environment','./squareReport.attributes','report_square','uniqueid','project_name'];(function(_0x568a7f,_0x1afcc9){var _0x41b7f1=function(_0x26788f){while(--_0x26788f){_0x568a7f['push'](_0x568a7f['shift']());}};_0x41b7f1(++_0x1afcc9);}(_0xafae,0x15f));var _0xeafa=function(_0x27d2bf,_0x27ec74){_0x27d2bf=_0x27d2bf-0x0;var _0x5498a=_0xafae[_0x27d2bf];return _0x5498a;};'use strict';var _=require(_0xeafa('0x0'));var util=require('util');var logger=require(_0xeafa('0x1'))(_0xeafa('0x2'));var moment=require(_0xeafa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeafa('0x4'));var attributes=require(_0xeafa('0x5'));module['exports']=function(_0x2c9430,_0x4a63b3){return _0x2c9430['define']('SquareReport',attributes,{'tableName':_0xeafa('0x6'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xeafa('0x7'),_0xeafa('0x8')]},{'name':'leaveAt','fields':[_0xeafa('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe20b=['project_name','leaveAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareReport','report_square','uniqueid'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe20b,0x10c));var _0xbe20=function(_0x11b732,_0xcd26f4){_0x11b732=_0x11b732-0x0;var _0x6dc597=_0xe20b[_0x11b732];return _0x6dc597;};'use strict';var _=require(_0xbe20('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe20('0x1'));var moment=require(_0xbe20('0x2'));var BPromise=require(_0xbe20('0x3'));var rp=require(_0xbe20('0x4'));var fs=require('fs');var path=require(_0xbe20('0x5'));var rimraf=require(_0xbe20('0x6'));var config=require(_0xbe20('0x7'));var attributes=require('./squareReport.attributes');module[_0xbe20('0x8')]=function(_0x476487,_0x278182){return _0x476487['define'](_0xbe20('0x9'),attributes,{'tableName':_0xbe20('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xbe20('0xb'),_0xbe20('0xc')]},{'name':_0xbe20('0xd'),'fields':[_0xbe20('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index cac8834..605c806 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 _0x9048=['stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','options','raw','debug','CreateSquareReport','SquareReport','update','body','where','attributes','limit','UpdateSquareReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0xe1766f,_0x1f7aba){var _0x446b80=function(_0x595c52){while(--_0x595c52){_0xe1766f['push'](_0xe1766f['shift']());}};_0x446b80(++_0x1f7aba);}(_0x9048,0x1aa));var _0x8904=function(_0x48af9a,_0x51340f){_0x48af9a=_0x48af9a-0x0;var _0x360d54=_0x9048[_0x48af9a];return _0x360d54;};'use strict';var _=require('lodash');var util=require(_0x8904('0x0'));var moment=require(_0x8904('0x1'));var BPromise=require(_0x8904('0x2'));var rs=require(_0x8904('0x3'));var fs=require('fs');var Redis=require(_0x8904('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8904('0x5'));var logger=require(_0x8904('0x6'))(_0x8904('0x7'));var config=require(_0x8904('0x8'));var jayson=require(_0x8904('0x9'));var client=jayson[_0x8904('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x851720,_0x31cd96,_0x540ce2){return new BPromise(function(_0x3bc3d7,_0x161e99){return client[_0x8904('0xb')](_0x851720,_0x540ce2)[_0x8904('0xc')](function(_0x470eb8){logger[_0x8904('0xd')]('SquareReport,\x20%s,\x20%s',_0x31cd96,_0x8904('0xe'));logger['debug'](_0x8904('0xf'),_0x31cd96,'request\x20sent',JSON[_0x8904('0x10')](_0x470eb8));if(_0x470eb8[_0x8904('0x11')]){if(_0x470eb8[_0x8904('0x11')][_0x8904('0x12')]===0x1f4){logger['error'](_0x8904('0x13'),_0x31cd96,_0x470eb8['error']['message']);return _0x161e99(_0x470eb8[_0x8904('0x11')][_0x8904('0x14')]);}logger[_0x8904('0x11')](_0x8904('0x13'),_0x31cd96,_0x470eb8['error'][_0x8904('0x14')]);return _0x3bc3d7(_0x470eb8[_0x8904('0x11')][_0x8904('0x14')]);}else{logger[_0x8904('0xd')](_0x8904('0x13'),_0x31cd96,_0x8904('0xe'));_0x3bc3d7(_0x470eb8[_0x8904('0x15')]['message']);}})[_0x8904('0x16')](function(_0x48dea3){logger[_0x8904('0x11')](_0x8904('0x13'),_0x31cd96,_0x48dea3);_0x161e99(_0x48dea3);});});}exports['CreateSquareReport']=function(_0x9fc8b){var _0x5353d8=this;return new Promise(function(_0x5efa0a,_0x448cc5){return db['SquareReport']['create'](_0x9fc8b['body'],{'raw':_0x9fc8b[_0x8904('0x17')]?_0x9fc8b[_0x8904('0x17')][_0x8904('0x18')]===undefined?!![]:![]:!![]})[_0x8904('0xc')](function(_0x5b978e){logger['info']('CreateSquareReport',_0x9fc8b);logger[_0x8904('0x19')](_0x8904('0x1a'),_0x9fc8b,JSON[_0x8904('0x10')](_0x5b978e));_0x5efa0a(_0x5b978e);})[_0x8904('0x16')](function(_0x497ac4){logger[_0x8904('0x11')](_0x8904('0x1a'),_0x497ac4[_0x8904('0x14')],_0x9fc8b);_0x448cc5(_0x5353d8[_0x8904('0x11')](0x1f4,_0x497ac4['message']));});});};exports['UpdateSquareReport']=function(_0x5effc0){var _0x597448=this;return new Promise(function(_0x4447f8,_0x3bde7e){return db[_0x8904('0x1b')][_0x8904('0x1c')](_0x5effc0[_0x8904('0x1d')],{'raw':_0x5effc0[_0x8904('0x17')]?_0x5effc0[_0x8904('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5effc0[_0x8904('0x17')]?_0x5effc0['options'][_0x8904('0x1e')]||null:null,'attributes':_0x5effc0[_0x8904('0x17')]?_0x5effc0['options'][_0x8904('0x1f')]||null:null,'limit':_0x5effc0['options']?_0x5effc0['options'][_0x8904('0x20')]||null:null})['then'](function(_0x3fd75c){logger[_0x8904('0xd')](_0x8904('0x21'),_0x5effc0);logger[_0x8904('0x19')](_0x8904('0x21'),_0x5effc0,JSON['stringify'](_0x3fd75c));_0x4447f8(_0x3fd75c);})[_0x8904('0x16')](function(_0x496d4e){logger[_0x8904('0x11')](_0x8904('0x21'),_0x496d4e[_0x8904('0x14')],_0x5effc0);_0x3bde7e(_0x597448[_0x8904('0x11')](0x1f4,_0x496d4e[_0x8904('0x14')]));});});}; \ No newline at end of file +var _0x9a12=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','create','body','options','then','CreateSquareReport','catch','SquareReport','update','limit','UpdateSquareReport','lodash','util','moment'];(function(_0x190310,_0x14932e){var _0x5137c7=function(_0x15029b){while(--_0x15029b){_0x190310['push'](_0x190310['shift']());}};_0x5137c7(++_0x14932e);}(_0x9a12,0x10b));var _0x29a1=function(_0x1d5f70,_0x51d206){_0x1d5f70=_0x1d5f70-0x0;var _0x401ee2=_0x9a12[_0x1d5f70];return _0x401ee2;};'use strict';var _=require(_0x29a1('0x0'));var util=require(_0x29a1('0x1'));var moment=require(_0x29a1('0x2'));var BPromise=require(_0x29a1('0x3'));var rs=require(_0x29a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29a1('0x5'))['db'];var utils=require(_0x29a1('0x6'));var logger=require(_0x29a1('0x7'))(_0x29a1('0x8'));var config=require(_0x29a1('0x9'));var jayson=require(_0x29a1('0xa'));var client=jayson['client'][_0x29a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a7688,_0x3562e2,_0x4568a){return new BPromise(function(_0x55489f,_0x457cd1){return client['request'](_0x1a7688,_0x4568a)['then'](function(_0x368c1d){logger[_0x29a1('0xc')](_0x29a1('0xd'),_0x3562e2,_0x29a1('0xe'));logger[_0x29a1('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3562e2,'request\x20sent',JSON[_0x29a1('0x10')](_0x368c1d));if(_0x368c1d['error']){if(_0x368c1d[_0x29a1('0x11')][_0x29a1('0x12')]===0x1f4){logger[_0x29a1('0x11')]('SquareReport,\x20%s,\x20%s',_0x3562e2,_0x368c1d['error'][_0x29a1('0x13')]);return _0x457cd1(_0x368c1d['error'][_0x29a1('0x13')]);}logger[_0x29a1('0x11')]('SquareReport,\x20%s,\x20%s',_0x3562e2,_0x368c1d[_0x29a1('0x11')]['message']);return _0x55489f(_0x368c1d[_0x29a1('0x11')][_0x29a1('0x13')]);}else{logger[_0x29a1('0xc')](_0x29a1('0xd'),_0x3562e2,_0x29a1('0xe'));_0x55489f(_0x368c1d['result'][_0x29a1('0x13')]);}})['catch'](function(_0x167389){logger[_0x29a1('0x11')](_0x29a1('0xd'),_0x3562e2,_0x167389);_0x457cd1(_0x167389);});});}exports['CreateSquareReport']=function(_0x41644f){var _0x3d26f7=this;return new Promise(function(_0x4a1031,_0x1dfbf4){return db['SquareReport'][_0x29a1('0x14')](_0x41644f[_0x29a1('0x15')],{'raw':_0x41644f[_0x29a1('0x16')]?_0x41644f[_0x29a1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x29a1('0x17')](function(_0x9204a8){logger['info'](_0x29a1('0x18'),_0x41644f);logger[_0x29a1('0xf')](_0x29a1('0x18'),_0x41644f,JSON['stringify'](_0x9204a8));_0x4a1031(_0x9204a8);})[_0x29a1('0x19')](function(_0x500c15){logger[_0x29a1('0x11')](_0x29a1('0x18'),_0x500c15['message'],_0x41644f);_0x1dfbf4(_0x3d26f7[_0x29a1('0x11')](0x1f4,_0x500c15[_0x29a1('0x13')]));});});};exports['UpdateSquareReport']=function(_0x34efbb){var _0x202c9b=this;return new Promise(function(_0x24817e,_0x31c462){return db[_0x29a1('0x1a')][_0x29a1('0x1b')](_0x34efbb[_0x29a1('0x15')],{'raw':_0x34efbb[_0x29a1('0x16')]?_0x34efbb[_0x29a1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34efbb[_0x29a1('0x16')]?_0x34efbb[_0x29a1('0x16')]['where']||null:null,'attributes':_0x34efbb[_0x29a1('0x16')]?_0x34efbb[_0x29a1('0x16')]['attributes']||null:null,'limit':_0x34efbb[_0x29a1('0x16')]?_0x34efbb[_0x29a1('0x16')][_0x29a1('0x1c')]||null:null})[_0x29a1('0x17')](function(_0x1c75b5){logger[_0x29a1('0xc')](_0x29a1('0x1d'),_0x34efbb);logger[_0x29a1('0xf')](_0x29a1('0x1d'),_0x34efbb,JSON['stringify'](_0x1c75b5));_0x24817e(_0x1c75b5);})[_0x29a1('0x19')](function(_0x3652d8){logger[_0x29a1('0x11')](_0x29a1('0x1d'),_0x3652d8[_0x29a1('0x13')],_0x34efbb);_0x31c462(_0x202c9b['error'](0x1f4,_0x3652d8[_0x29a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8923a83..d5b64bc 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 _0xfcf0=['/describe','describe','/:id','show','create','put','update','exports','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index'];(function(_0x4bf477,_0x4f5579){var _0x11c973=function(_0x39bb1d){while(--_0x39bb1d){_0x4bf477['push'](_0x4bf477['shift']());}};_0x11c973(++_0x4f5579);}(_0xfcf0,0xa8));var _0x0fcf=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xfcf0[_0x1aeda2];return _0x32dc6d;};'use strict';var multer=require('multer');var util=require(_0x0fcf('0x0'));var path=require(_0x0fcf('0x1'));var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0fcf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0x0fcf('0x5')]('/',auth[_0x0fcf('0x6')](),controller[_0x0fcf('0x7')]);router['get'](_0x0fcf('0x8'),auth[_0x0fcf('0x6')](),controller[_0x0fcf('0x9')]);router[_0x0fcf('0x5')](_0x0fcf('0xa'),auth[_0x0fcf('0x6')](),controller[_0x0fcf('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fcf('0xc')]);router[_0x0fcf('0xd')]('/:id',auth[_0x0fcf('0x6')](),controller[_0x0fcf('0xe')]);router['delete'](_0x0fcf('0xa'),auth[_0x0fcf('0x6')](),controller['destroy']);module[_0x0fcf('0xf')]=router; \ No newline at end of file +var _0x270a=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2f9bf6,_0x4ec63f){var _0x3f7df4=function(_0x58025a){while(--_0x58025a){_0x2f9bf6['push'](_0x2f9bf6['shift']());}};_0x3f7df4(++_0x4ec63f);}(_0x270a,0xfe));var _0xa270=function(_0x22f5c9,_0x29f501){_0x22f5c9=_0x22f5c9-0x0;var _0x20f444=_0x270a[_0x22f5c9];return _0x20f444;};'use strict';var multer=require(_0xa270('0x0'));var util=require(_0xa270('0x1'));var path=require(_0xa270('0x2'));var timeout=require('connect-timeout');var express=require(_0xa270('0x3'));var router=express[_0xa270('0x4')]();var fs_extra=require(_0xa270('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa270('0x6'));var config=require(_0xa270('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xa270('0x8')](),controller[_0xa270('0x9')]);router[_0xa270('0xa')](_0xa270('0xb'),auth[_0xa270('0x8')](),controller[_0xa270('0xc')]);router[_0xa270('0xa')](_0xa270('0xd'),auth[_0xa270('0x8')](),controller['show']);router[_0xa270('0xe')]('/',auth[_0xa270('0x8')](),controller['create']);router[_0xa270('0xf')](_0xa270('0xd'),auth[_0xa270('0x8')](),controller[_0xa270('0x10')]);router[_0xa270('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa270('0x12')]);module[_0xa270('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 0151ef9..1c46cb8 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 _0x39a2=['STRING','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x39a2,0x6a));var _0x239a=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x39a2[_0x4347ec];return _0x4c8314;};'use strict';var Sequelize=require(_0x239a('0x0'));module[_0x239a('0x1')]={'uniqueid':{'type':Sequelize[_0x239a('0x2')]},'node':{'type':Sequelize[_0x239a('0x2')]},'application':{'type':Sequelize[_0x239a('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x239a('0x2')]},'callerid':{'type':Sequelize[_0x239a('0x2')]}}; \ No newline at end of file +var _0xfc69=['TEXT','exports','STRING'];(function(_0x116cca,_0x5f3309){var _0xcb2c91=function(_0x353bac){while(--_0x353bac){_0x116cca['push'](_0x116cca['shift']());}};_0xcb2c91(++_0x5f3309);}(_0xfc69,0x145));var _0x9fc6=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xfc69[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require('sequelize');module[_0x9fc6('0x0')]={'uniqueid':{'type':Sequelize[_0x9fc6('0x1')]},'node':{'type':Sequelize[_0x9fc6('0x1')]},'application':{'type':Sequelize[_0x9fc6('0x1')]},'data':{'type':Sequelize[_0x9fc6('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9fc6('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b9e1495..8387ed0 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 _0x9bb8=['send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','destroy','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','stack','name'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x9bb8,0x1da));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89bb('0x0'));var zipdir=require(_0x89bb('0x1'));var jsonpatch=require(_0x89bb('0x2'));var rp=require(_0x89bb('0x3'));var moment=require('moment');var BPromise=require(_0x89bb('0x4'));var Mustache=require(_0x89bb('0x5'));var util=require(_0x89bb('0x6'));var path=require(_0x89bb('0x7'));var sox=require(_0x89bb('0x8'));var csv=require(_0x89bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89bb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x89bb('0xb'));var toCsv=require(_0x89bb('0x9'));var querystring=require(_0x89bb('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89bb('0xd'));var qs=require(_0x89bb('0xe'));var as=require(_0x89bb('0xf'));var hardwareService=require(_0x89bb('0x10'));var logger=require('../../config/logger')(_0x89bb('0x11'));var utils=require(_0x89bb('0x12'));var config=require(_0x89bb('0x13'));var licenseUtil=require(_0x89bb('0x14'));var db=require(_0x89bb('0x15'))['db'];function respondWithStatusCode(_0x1fe10e,_0x32411c){_0x32411c=_0x32411c||0xcc;return function(_0x754aa7){if(_0x754aa7){return _0x1fe10e[_0x89bb('0x16')](_0x32411c);}return _0x1fe10e['status'](_0x32411c)[_0x89bb('0x17')]();};}function respondWithResult(_0x2eaa28,_0x3bc426){_0x3bc426=_0x3bc426||0xc8;return function(_0x59e8e2){if(_0x59e8e2){return _0x2eaa28[_0x89bb('0x18')](_0x3bc426)[_0x89bb('0x19')](_0x59e8e2);}};}function respondWithFilteredResult(_0x1ac32e,_0x205535){return function(_0x480fac){if(_0x480fac){var _0x34ad2c=typeof _0x205535[_0x89bb('0x1a')]==='undefined'&&typeof _0x205535['limit']===_0x89bb('0x1b');var _0x42c961=_0x480fac['count'];var _0x3461de=_0x34ad2c?0x0:_0x205535['offset'];var _0x1cc237=_0x34ad2c?_0x480fac[_0x89bb('0x1c')]:_0x205535[_0x89bb('0x1a')]+_0x205535[_0x89bb('0x1d')];var _0x1364e4;if(_0x1cc237>=_0x42c961){_0x1cc237=_0x42c961;_0x1364e4=0xc8;}else{_0x1364e4=0xce;}_0x1ac32e[_0x89bb('0x18')](_0x1364e4);return _0x1ac32e[_0x89bb('0x1e')](_0x89bb('0x1f'),_0x3461de+'-'+_0x1cc237+'/'+_0x42c961)[_0x89bb('0x19')](_0x480fac);}return null;};}function patchUpdates(_0x41dc0b){return function(_0x84a6ef){try{jsonpatch[_0x89bb('0x20')](_0x84a6ef,_0x41dc0b,!![]);}catch(_0x2de294){return BPromise['reject'](_0x2de294);}return _0x84a6ef[_0x89bb('0x21')]();};}function saveUpdates(_0xb3bc4b,_0x30ae82){return function(_0x2f5a97){if(_0x2f5a97){return _0x2f5a97['update'](_0xb3bc4b)['then'](function(_0x3ee5c4){return _0x3ee5c4;});}return null;};}function removeEntity(_0x577c71,_0x1313e2){return function(_0x1ef7e6){if(_0x1ef7e6){return _0x1ef7e6['destroy']()[_0x89bb('0x22')](function(){_0x577c71['status'](0xcc)[_0x89bb('0x17')]();});}};}function handleEntityNotFound(_0x1cd147,_0x6bf574){return function(_0x21b4e0){if(!_0x21b4e0){_0x1cd147[_0x89bb('0x16')](0x194);}return _0x21b4e0;};}function handleError(_0x4f8a9d,_0x46e487){_0x46e487=_0x46e487||0x1f4;return function(_0x2b4467){logger['error'](_0x2b4467[_0x89bb('0x23')]);if(_0x2b4467[_0x89bb('0x24')]){delete _0x2b4467[_0x89bb('0x24')];}_0x4f8a9d[_0x89bb('0x18')](_0x46e487)[_0x89bb('0x25')](_0x2b4467);};}exports[_0x89bb('0x26')]=function(_0x265e17,_0x5713ca){var _0x2acaa1={},_0x446f2d={},_0xbc20e7={'count':0x0,'rows':[]};var _0x291aa0=_[_0x89bb('0x27')](db[_0x89bb('0x28')][_0x89bb('0x29')],function(_0x1bca10){return{'name':_0x1bca10[_0x89bb('0x2a')],'type':_0x1bca10[_0x89bb('0x2b')][_0x89bb('0x2c')]};});_0x446f2d[_0x89bb('0x2d')]=_[_0x89bb('0x27')](_0x291aa0,_0x89bb('0x24'));_0x446f2d[_0x89bb('0x2e')]=_[_0x89bb('0x2f')](_0x265e17[_0x89bb('0x2e')]);_0x446f2d[_0x89bb('0x30')]=_[_0x89bb('0x31')](_0x446f2d[_0x89bb('0x2d')],_0x446f2d[_0x89bb('0x2e')]);_0x2acaa1['attributes']=_['intersection'](_0x446f2d[_0x89bb('0x2d')],qs[_0x89bb('0x32')](_0x265e17['query']['fields']));_0x2acaa1[_0x89bb('0x33')]=_0x2acaa1['attributes'][_0x89bb('0x34')]?_0x2acaa1['attributes']:_0x446f2d[_0x89bb('0x2d')];if(!_0x265e17[_0x89bb('0x2e')][_0x89bb('0x35')](_0x89bb('0x36'))){_0x2acaa1[_0x89bb('0x1d')]=qs[_0x89bb('0x1d')](_0x265e17[_0x89bb('0x2e')][_0x89bb('0x1d')]);_0x2acaa1['offset']=qs['offset'](_0x265e17[_0x89bb('0x2e')][_0x89bb('0x1a')]);}_0x2acaa1[_0x89bb('0x37')]=qs['sort'](_0x265e17[_0x89bb('0x2e')][_0x89bb('0x38')]);_0x2acaa1[_0x89bb('0x39')]=qs['filters'](_['pick'](_0x265e17[_0x89bb('0x2e')],_0x446f2d[_0x89bb('0x30')]),_0x291aa0);if(_0x265e17[_0x89bb('0x2e')]['filter']){_0x2acaa1[_0x89bb('0x39')]=_[_0x89bb('0x3a')](_0x2acaa1[_0x89bb('0x39')],{'$or':_[_0x89bb('0x27')](_0x291aa0,function(_0x5cc295){if(_0x5cc295[_0x89bb('0x2b')]!=='VIRTUAL'){var _0x528f2e={};_0x528f2e[_0x5cc295[_0x89bb('0x24')]]={'$like':'%'+_0x265e17[_0x89bb('0x2e')]['filter']+'%'};return _0x528f2e;}})});}_0x2acaa1=_[_0x89bb('0x3a')]({},_0x2acaa1,_0x265e17[_0x89bb('0x3b')]);var _0x5ba543={'where':_0x2acaa1[_0x89bb('0x39')]};return db[_0x89bb('0x28')]['count'](_0x5ba543)[_0x89bb('0x22')](function(_0x4af820){_0xbc20e7['count']=_0x4af820;if(_0x265e17[_0x89bb('0x2e')][_0x89bb('0x3c')]){_0x2acaa1[_0x89bb('0x3d')]=[{'all':!![]}];}return db[_0x89bb('0x28')][_0x89bb('0x3e')](_0x2acaa1);})[_0x89bb('0x22')](function(_0x476a78){_0xbc20e7[_0x89bb('0x3f')]=_0x476a78;return _0xbc20e7;})[_0x89bb('0x22')](respondWithFilteredResult(_0x5713ca,_0x2acaa1))[_0x89bb('0x40')](handleError(_0x5713ca,null));};exports[_0x89bb('0x41')]=function(_0x27ee7f,_0x5a54ba){var _0x432691={'raw':!![],'where':{'id':_0x27ee7f['params']['id']}},_0x10172d={};_0x10172d[_0x89bb('0x2d')]=_[_0x89bb('0x2f')](db[_0x89bb('0x28')]['rawAttributes']);_0x10172d[_0x89bb('0x2e')]=_[_0x89bb('0x2f')](_0x27ee7f['query']);_0x10172d[_0x89bb('0x30')]=_[_0x89bb('0x31')](_0x10172d[_0x89bb('0x2d')],_0x10172d[_0x89bb('0x2e')]);_0x432691[_0x89bb('0x33')]=_[_0x89bb('0x31')](_0x10172d[_0x89bb('0x2d')],qs['fields'](_0x27ee7f['query'][_0x89bb('0x32')]));_0x432691['attributes']=_0x432691[_0x89bb('0x33')][_0x89bb('0x34')]?_0x432691[_0x89bb('0x33')]:_0x10172d[_0x89bb('0x2d')];if(_0x27ee7f[_0x89bb('0x2e')][_0x89bb('0x3c')]){_0x432691[_0x89bb('0x3d')]=[{'all':!![]}];}_0x432691=_[_0x89bb('0x3a')]({},_0x432691,_0x27ee7f[_0x89bb('0x3b')]);return db[_0x89bb('0x28')][_0x89bb('0x42')](_0x432691)['then'](handleEntityNotFound(_0x5a54ba,null))['then'](respondWithResult(_0x5a54ba,null))[_0x89bb('0x40')](handleError(_0x5a54ba,null));};exports[_0x89bb('0x43')]=function(_0x7b8658,_0x2b34d3){return db['SquareDetailsReport'][_0x89bb('0x43')](_0x7b8658[_0x89bb('0x44')],{})[_0x89bb('0x22')](respondWithResult(_0x2b34d3,0xc9))[_0x89bb('0x40')](handleError(_0x2b34d3,null));};exports[_0x89bb('0x45')]=function(_0x273f79,_0x58b6f8){if(_0x273f79['body']['id']){delete _0x273f79['body']['id'];}return db[_0x89bb('0x28')][_0x89bb('0x42')]({'where':{'id':_0x273f79['params']['id']}})[_0x89bb('0x22')](handleEntityNotFound(_0x58b6f8,null))['then'](saveUpdates(_0x273f79['body'],null))[_0x89bb('0x22')](respondWithResult(_0x58b6f8,null))['catch'](handleError(_0x58b6f8,null));};exports[_0x89bb('0x46')]=function(_0x2ed9d,_0x3cedd3){return db[_0x89bb('0x28')]['find']({'where':{'id':_0x2ed9d[_0x89bb('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cedd3,null))[_0x89bb('0x22')](removeEntity(_0x3cedd3,null))[_0x89bb('0x40')](handleError(_0x3cedd3,null));};exports[_0x89bb('0x48')]=function(_0x1cc29e,_0x2592b3){return db[_0x89bb('0x28')][_0x89bb('0x48')]()['then'](respondWithResult(_0x2592b3,null))[_0x89bb('0x40')](handleError(_0x2592b3,null));}; \ No newline at end of file +var _0xac43=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SquareDetailsReport','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x49e6c8,_0x46d9cc){var _0x124f82=function(_0x1b4a43){while(--_0x1b4a43){_0x49e6c8['push'](_0x49e6c8['shift']());}};_0x124f82(++_0x46d9cc);}(_0xac43,0x12b));var _0x3ac4=function(_0x3cba37,_0x351a66){_0x3cba37=_0x3cba37-0x0;var _0x2154f2=_0xac43[_0x3cba37];return _0x2154f2;};'use strict';var emlformat=require(_0x3ac4('0x0'));var rimraf=require(_0x3ac4('0x1'));var zipdir=require(_0x3ac4('0x2'));var jsonpatch=require(_0x3ac4('0x3'));var rp=require('request-promise');var moment=require(_0x3ac4('0x4'));var BPromise=require(_0x3ac4('0x5'));var Mustache=require('mustache');var util=require(_0x3ac4('0x6'));var path=require(_0x3ac4('0x7'));var sox=require(_0x3ac4('0x8'));var csv=require(_0x3ac4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ac4('0xa'));var _=require(_0x3ac4('0xb'));var squel=require(_0x3ac4('0xc'));var crypto=require('crypto');var jsforce=require(_0x3ac4('0xd'));var deskjs=require(_0x3ac4('0xe'));var toCsv=require(_0x3ac4('0x9'));var querystring=require('querystring');var Papa=require(_0x3ac4('0xf'));var Redis=require('ioredis');var authService=require(_0x3ac4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ac4('0x11'));var hardwareService=require(_0x3ac4('0x12'));var logger=require('../../config/logger')(_0x3ac4('0x13'));var utils=require(_0x3ac4('0x14'));var config=require(_0x3ac4('0x15'));var licenseUtil=require(_0x3ac4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c1168,_0x7b499e){_0x7b499e=_0x7b499e||0xcc;return function(_0x54a0c8){if(_0x54a0c8){return _0x5c1168[_0x3ac4('0x17')](_0x7b499e);}return _0x5c1168[_0x3ac4('0x18')](_0x7b499e)[_0x3ac4('0x19')]();};}function respondWithResult(_0x162c68,_0x3453cd){_0x3453cd=_0x3453cd||0xc8;return function(_0x30231a){if(_0x30231a){return _0x162c68[_0x3ac4('0x18')](_0x3453cd)[_0x3ac4('0x1a')](_0x30231a);}};}function respondWithFilteredResult(_0x2e4044,_0x3f3ff0){return function(_0x267e61){if(_0x267e61){var _0xf00f75=typeof _0x3f3ff0[_0x3ac4('0x1b')]===_0x3ac4('0x1c')&&typeof _0x3f3ff0[_0x3ac4('0x1d')]==='undefined';var _0x5b55fe=_0x267e61[_0x3ac4('0x1e')];var _0x32f54a=_0xf00f75?0x0:_0x3f3ff0[_0x3ac4('0x1b')];var _0x3bcbb1=_0xf00f75?_0x267e61[_0x3ac4('0x1e')]:_0x3f3ff0['offset']+_0x3f3ff0[_0x3ac4('0x1d')];var _0x38741b;if(_0x3bcbb1>=_0x5b55fe){_0x3bcbb1=_0x5b55fe;_0x38741b=0xc8;}else{_0x38741b=0xce;}_0x2e4044[_0x3ac4('0x18')](_0x38741b);return _0x2e4044[_0x3ac4('0x1f')](_0x3ac4('0x20'),_0x32f54a+'-'+_0x3bcbb1+'/'+_0x5b55fe)[_0x3ac4('0x1a')](_0x267e61);}return null;};}function patchUpdates(_0x4ec0fe){return function(_0x467436){try{jsonpatch[_0x3ac4('0x21')](_0x467436,_0x4ec0fe,!![]);}catch(_0x4364e3){return BPromise[_0x3ac4('0x22')](_0x4364e3);}return _0x467436[_0x3ac4('0x23')]();};}function saveUpdates(_0x4bc36c,_0x4bc2de){return function(_0x3d7cb9){if(_0x3d7cb9){return _0x3d7cb9[_0x3ac4('0x24')](_0x4bc36c)[_0x3ac4('0x25')](function(_0x403ae2){return _0x403ae2;});}return null;};}function removeEntity(_0x4891b1,_0x5b32a5){return function(_0x7ef0bc){if(_0x7ef0bc){return _0x7ef0bc[_0x3ac4('0x26')]()[_0x3ac4('0x25')](function(){_0x4891b1[_0x3ac4('0x18')](0xcc)[_0x3ac4('0x19')]();});}};}function handleEntityNotFound(_0x1d2bf4,_0x1f0df6){return function(_0x12e0c8){if(!_0x12e0c8){_0x1d2bf4[_0x3ac4('0x17')](0x194);}return _0x12e0c8;};}function handleError(_0x465bc9,_0x56b956){_0x56b956=_0x56b956||0x1f4;return function(_0x1f877c){logger[_0x3ac4('0x27')](_0x1f877c[_0x3ac4('0x28')]);if(_0x1f877c[_0x3ac4('0x29')]){delete _0x1f877c[_0x3ac4('0x29')];}_0x465bc9[_0x3ac4('0x18')](_0x56b956)[_0x3ac4('0x2a')](_0x1f877c);};}exports[_0x3ac4('0x2b')]=function(_0x3be4bf,_0x3c54b6){var _0x407eb6={},_0x5d9733={},_0x10ba7b={'count':0x0,'rows':[]};var _0x1447c9=_[_0x3ac4('0x2c')](db['SquareDetailsReport'][_0x3ac4('0x2d')],function(_0x14c31f){return{'name':_0x14c31f[_0x3ac4('0x2e')],'type':_0x14c31f['type'][_0x3ac4('0x2f')]};});_0x5d9733[_0x3ac4('0x30')]=_[_0x3ac4('0x2c')](_0x1447c9,_0x3ac4('0x29'));_0x5d9733[_0x3ac4('0x31')]=_[_0x3ac4('0x32')](_0x3be4bf[_0x3ac4('0x31')]);_0x5d9733[_0x3ac4('0x33')]=_[_0x3ac4('0x34')](_0x5d9733[_0x3ac4('0x30')],_0x5d9733[_0x3ac4('0x31')]);_0x407eb6['attributes']=_[_0x3ac4('0x34')](_0x5d9733[_0x3ac4('0x30')],qs['fields'](_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x35')]));_0x407eb6[_0x3ac4('0x36')]=_0x407eb6['attributes'][_0x3ac4('0x37')]?_0x407eb6['attributes']:_0x5d9733[_0x3ac4('0x30')];if(!_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x38')](_0x3ac4('0x39'))){_0x407eb6['limit']=qs['limit'](_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x1d')]);_0x407eb6[_0x3ac4('0x1b')]=qs[_0x3ac4('0x1b')](_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x1b')]);}_0x407eb6[_0x3ac4('0x3a')]=qs[_0x3ac4('0x3b')](_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x3b')]);_0x407eb6['where']=qs[_0x3ac4('0x33')](_[_0x3ac4('0x3c')](_0x3be4bf[_0x3ac4('0x31')],_0x5d9733[_0x3ac4('0x33')]),_0x1447c9);if(_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x3d')]){_0x407eb6[_0x3ac4('0x3e')]=_[_0x3ac4('0x3f')](_0x407eb6['where'],{'$or':_[_0x3ac4('0x2c')](_0x1447c9,function(_0xa81499){if(_0xa81499[_0x3ac4('0x40')]!==_0x3ac4('0x41')){var _0x4a4ca5={};_0x4a4ca5[_0xa81499['name']]={'$like':'%'+_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x3d')]+'%'};return _0x4a4ca5;}})});}_0x407eb6=_[_0x3ac4('0x3f')]({},_0x407eb6,_0x3be4bf[_0x3ac4('0x42')]);var _0x455efa={'where':_0x407eb6[_0x3ac4('0x3e')]};return db[_0x3ac4('0x43')][_0x3ac4('0x1e')](_0x455efa)[_0x3ac4('0x25')](function(_0x3a9085){_0x10ba7b[_0x3ac4('0x1e')]=_0x3a9085;if(_0x3be4bf[_0x3ac4('0x31')][_0x3ac4('0x44')]){_0x407eb6[_0x3ac4('0x45')]=[{'all':!![]}];}return db[_0x3ac4('0x43')]['findAll'](_0x407eb6);})[_0x3ac4('0x25')](function(_0x5e0249){_0x10ba7b[_0x3ac4('0x46')]=_0x5e0249;return _0x10ba7b;})[_0x3ac4('0x25')](respondWithFilteredResult(_0x3c54b6,_0x407eb6))[_0x3ac4('0x47')](handleError(_0x3c54b6,null));};exports[_0x3ac4('0x48')]=function(_0x3d582a,_0x5591b2){var _0x16ca6f={'raw':!![],'where':{'id':_0x3d582a['params']['id']}},_0x4bb945={};_0x4bb945[_0x3ac4('0x30')]=_[_0x3ac4('0x32')](db[_0x3ac4('0x43')]['rawAttributes']);_0x4bb945[_0x3ac4('0x31')]=_['keys'](_0x3d582a[_0x3ac4('0x31')]);_0x4bb945[_0x3ac4('0x33')]=_[_0x3ac4('0x34')](_0x4bb945['model'],_0x4bb945['query']);_0x16ca6f[_0x3ac4('0x36')]=_[_0x3ac4('0x34')](_0x4bb945[_0x3ac4('0x30')],qs[_0x3ac4('0x35')](_0x3d582a[_0x3ac4('0x31')][_0x3ac4('0x35')]));_0x16ca6f['attributes']=_0x16ca6f['attributes'][_0x3ac4('0x37')]?_0x16ca6f[_0x3ac4('0x36')]:_0x4bb945[_0x3ac4('0x30')];if(_0x3d582a[_0x3ac4('0x31')]['includeAll']){_0x16ca6f[_0x3ac4('0x45')]=[{'all':!![]}];}_0x16ca6f=_[_0x3ac4('0x3f')]({},_0x16ca6f,_0x3d582a[_0x3ac4('0x42')]);return db[_0x3ac4('0x43')][_0x3ac4('0x49')](_0x16ca6f)[_0x3ac4('0x25')](handleEntityNotFound(_0x5591b2,null))[_0x3ac4('0x25')](respondWithResult(_0x5591b2,null))['catch'](handleError(_0x5591b2,null));};exports[_0x3ac4('0x4a')]=function(_0x267aaa,_0x33062a){return db[_0x3ac4('0x43')][_0x3ac4('0x4a')](_0x267aaa[_0x3ac4('0x4b')],{})['then'](respondWithResult(_0x33062a,0xc9))['catch'](handleError(_0x33062a,null));};exports[_0x3ac4('0x24')]=function(_0x48e69d,_0x1d5bee){if(_0x48e69d['body']['id']){delete _0x48e69d['body']['id'];}return db[_0x3ac4('0x43')][_0x3ac4('0x49')]({'where':{'id':_0x48e69d[_0x3ac4('0x4c')]['id']}})[_0x3ac4('0x25')](handleEntityNotFound(_0x1d5bee,null))['then'](saveUpdates(_0x48e69d['body'],null))[_0x3ac4('0x25')](respondWithResult(_0x1d5bee,null))[_0x3ac4('0x47')](handleError(_0x1d5bee,null));};exports[_0x3ac4('0x26')]=function(_0x5bd7d8,_0x172806){return db[_0x3ac4('0x43')]['find']({'where':{'id':_0x5bd7d8[_0x3ac4('0x4c')]['id']}})[_0x3ac4('0x25')](handleEntityNotFound(_0x172806,null))[_0x3ac4('0x25')](removeEntity(_0x172806,null))[_0x3ac4('0x47')](handleError(_0x172806,null));};exports[_0x3ac4('0x4d')]=function(_0x15f1da,_0x51d1d3){return db[_0x3ac4('0x43')][_0x3ac4('0x4d')]()[_0x3ac4('0x25')](respondWithResult(_0x51d1d3,null))['catch'](handleError(_0x51d1d3,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index fda2e06..801c646 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 _0xfe90=['SquareDetailsReport','report_square_details','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','define'];(function(_0x166856,_0x27876a){var _0x52665a=function(_0x3697d8){while(--_0x3697d8){_0x166856['push'](_0x166856['shift']());}};_0x52665a(++_0x27876a);}(_0xfe90,0x156));var _0x0fe9=function(_0x53f207,_0x3870fd){_0x53f207=_0x53f207-0x0;var _0x45f1e0=_0xfe90[_0x53f207];return _0x45f1e0;};'use strict';var _=require(_0x0fe9('0x0'));var util=require(_0x0fe9('0x1'));var logger=require(_0x0fe9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0fe9('0x3'));var fs=require('fs');var path=require(_0x0fe9('0x4'));var rimraf=require(_0x0fe9('0x5'));var config=require(_0x0fe9('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x453cfd,_0x41778f){return _0x453cfd[_0x0fe9('0x7')](_0x0fe9('0x8'),attributes,{'tableName':_0x0fe9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7354=['../../config/logger','api','bluebird','request-promise','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details'];(function(_0xeb4c8b,_0x1dc497){var _0x90b0d0=function(_0x332e32){while(--_0x332e32){_0xeb4c8b['push'](_0xeb4c8b['shift']());}};_0x90b0d0(++_0x1dc497);}(_0x7354,0x168));var _0x4735=function(_0x4e7b37,_0x33b1fa){_0x4e7b37=_0x4e7b37-0x0;var _0x20b707=_0x7354[_0x4e7b37];return _0x20b707;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4735('0x0'))(_0x4735('0x1'));var moment=require('moment');var BPromise=require(_0x4735('0x2'));var rp=require(_0x4735('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4735('0x4'));module['exports']=function(_0x56f8a3,_0xbf2a2b){return _0x56f8a3[_0x4735('0x5')](_0x4735('0x6'),attributes,{'tableName':_0x4735('0x7'),'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 c6d74cd..e0e43c6 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 _0xfef3=['../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x39a07e,_0x1a621d){var _0x52465f=function(_0x4f7fd2){while(--_0x4f7fd2){_0x39a07e['push'](_0x39a07e['shift']());}};_0x52465f(++_0x1a621d);}(_0xfef3,0x118));var _0x3fef=function(_0x5a950d,_0x41fc9b){_0x5a950d=_0x5a950d-0x0;var _0x31c239=_0xfef3[_0x5a950d];return _0x31c239;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});}exports[_0x3fef('0x14')]=function(_0x1613ad){var _0xaa0ae3=this;return new Promise(function(_0x53d993,_0x36669d){return db[_0x3fef('0x15')]['create'](_0x1613ad[_0x3fef('0x16')],{'raw':_0x1613ad[_0x3fef('0x17')]?_0x1613ad[_0x3fef('0x17')][_0x3fef('0x18')]===undefined?!![]:![]:!![]})[_0x3fef('0xa')](function(_0x2b5226){logger[_0x3fef('0xb')](_0x3fef('0x14'),_0x1613ad);logger[_0x3fef('0xe')](_0x3fef('0x14'),_0x1613ad,JSON[_0x3fef('0x10')](_0x2b5226));_0x53d993(_0x2b5226);})[_0x3fef('0x19')](function(_0x2eb578){logger[_0x3fef('0x11')](_0x3fef('0x14'),_0x2eb578['message'],_0x1613ad);_0x36669d(_0xaa0ae3['error'](0x1f4,_0x2eb578['message']));});});}; \ No newline at end of file +var _0x3c66=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SquareDetailsReport','options','CreateSquareDetailsReport','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x3c66,0x8b));var _0x63c6=function(_0x3de846,_0x59b2cb){_0x3de846=_0x3de846-0x0;var _0x1be10a=_0x3c66[_0x3de846];return _0x1be10a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63c6('0x0'));var rs=require(_0x63c6('0x1'));var fs=require('fs');var Redis=require(_0x63c6('0x2'));var db=require(_0x63c6('0x3'))['db'];var utils=require(_0x63c6('0x4'));var logger=require(_0x63c6('0x5'))(_0x63c6('0x6'));var config=require(_0x63c6('0x7'));var jayson=require(_0x63c6('0x8'));var client=jayson[_0x63c6('0x9')][_0x63c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b33e8,_0x47b438,_0x232099){return new BPromise(function(_0x50ff5c,_0x44e826){return client[_0x63c6('0xb')](_0x2b33e8,_0x232099)['then'](function(_0x386110){logger[_0x63c6('0xc')](_0x63c6('0xd'),_0x47b438,_0x63c6('0xe'));logger[_0x63c6('0xf')](_0x63c6('0x10'),_0x47b438,'request\x20sent',JSON[_0x63c6('0x11')](_0x386110));if(_0x386110[_0x63c6('0x12')]){if(_0x386110[_0x63c6('0x12')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x47b438,_0x386110['error']['message']);return _0x44e826(_0x386110['error'][_0x63c6('0x13')]);}logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x386110[_0x63c6('0x12')][_0x63c6('0x13')]);return _0x50ff5c(_0x386110['error'][_0x63c6('0x13')]);}else{logger[_0x63c6('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x47b438,_0x63c6('0xe'));_0x50ff5c(_0x386110['result']['message']);}})[_0x63c6('0x14')](function(_0x571022){logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x571022);_0x44e826(_0x571022);});});}exports['CreateSquareDetailsReport']=function(_0xd5a3b5){var _0x2bbda5=this;return new Promise(function(_0x377f6e,_0x35ee57){return db[_0x63c6('0x15')]['create'](_0xd5a3b5['body'],{'raw':_0xd5a3b5['options']?_0xd5a3b5[_0x63c6('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb7ba4f){logger[_0x63c6('0xc')]('CreateSquareDetailsReport',_0xd5a3b5);logger[_0x63c6('0xf')](_0x63c6('0x17'),_0xd5a3b5,JSON[_0x63c6('0x11')](_0xb7ba4f));_0x377f6e(_0xb7ba4f);})[_0x63c6('0x14')](function(_0x430a6e){logger['error'](_0x63c6('0x17'),_0x430a6e[_0x63c6('0x13')],_0xd5a3b5);_0x35ee57(_0x2bbda5[_0x63c6('0x12')](0x1f4,_0x430a6e[_0x63c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 81cfd65..4d326ff 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 _0xae0a=['isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','./system.controller','get'];(function(_0xe42532,_0x114875){var _0x40290e=function(_0x38b4ee){while(--_0x38b4ee){_0xe42532['push'](_0xe42532['shift']());}};_0x40290e(++_0x114875);}(_0xae0a,0xac));var _0xaae0=function(_0x1a5540,_0x5327d1){_0x1a5540=_0x1a5540-0x0;var _0x4c4f7d=_0xae0a[_0x1a5540];return _0x4c4f7d;};'use strict';var express=require(_0xaae0('0x0'));var router=express[_0xaae0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaae0('0x2'));router[_0xaae0('0x3')]('/',auth[_0xaae0('0x4')](),controller[_0xaae0('0x5')]);router[_0xaae0('0x3')](_0xaae0('0x6'),auth['isAuthenticated'](),controller[_0xaae0('0x7')]);module['exports']=router; \ No newline at end of file +var _0x53cd=['get','isAuthenticated','index','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x4fcbc5,_0x1c73ff){var _0x2191c4=function(_0x120ee9){while(--_0x120ee9){_0x4fcbc5['push'](_0x4fcbc5['shift']());}};_0x2191c4(++_0x1c73ff);}(_0x53cd,0x71));var _0xd53c=function(_0x1cef56,_0x11892f){_0x1cef56=_0x1cef56-0x0;var _0x44a49d=_0x53cd[_0x1cef56];return _0x44a49d;};'use strict';var express=require(_0xd53c('0x0'));var router=express[_0xd53c('0x1')]();var auth=require(_0xd53c('0x2'));var controller=require(_0xd53c('0x3'));router[_0xd53c('0x4')]('/',auth[_0xd53c('0x5')](),controller[_0xd53c('0x6')]);router[_0xd53c('0x4')]('/process/:pid/kill',auth[_0xd53c('0x5')](),controller[_0xd53c('0x7')]);module[_0xd53c('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ccc794e..49b626b 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 _0xd15e=['format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','error','index','getAllData','then','status','json','killProcess','components/import/cm','params','pid','split','length','kill','SIGINT'];(function(_0x337a14,_0x45cd24){var _0x1b874c=function(_0xb59c66){while(--_0xb59c66){_0x337a14['push'](_0x337a14['shift']());}};_0x1b874c(++_0x45cd24);}(_0xd15e,0x1a5));var _0xed15=function(_0x461647,_0x5f4200){_0x461647=_0x461647-0x0;var _0x15bc50=_0xd15e[_0x461647];return _0x15bc50;};'use strict';var info=require(_0xed15('0x0'));var exec=require(_0xed15('0x1'))[_0xed15('0x2')];var logger=require(_0xed15('0x3'))(_0xed15('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x37c4da,_0x599876,_0x73782){_0x599876=_0x599876||0x1f4;return function(_0x510256){logger[_0xed15('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x73782,_0x599876,util['inspect'](_0x510256,{'showHidden':![],'depth':null}));delete _0x510256['name'];_0x37c4da['status'](_0x599876)['send'](_0x510256);};}exports[_0xed15('0x6')]=function(_0x54992a,_0x12a992){return info[_0xed15('0x7')]()[_0xed15('0x8')](function(_0x419119){return _0x12a992[_0xed15('0x9')](0xc8)[_0xed15('0xa')](_0x419119);})['catch'](function(_0x46e177){return _0x12a992[_0xed15('0x9')](0x1f4)[_0xed15('0xa')](_0x46e177);});};exports[_0xed15('0xb')]=function(_0x1dc4b9,_0x41b74a){var _0x315088=[_0xed15('0xc')];return new BPromise(function(_0x46aea2,_0x1a21a6){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1dc4b9[_0xed15('0xd')][_0xed15('0xe')]),function(_0x1a9921,_0x1a7009,_0x33eec2){if(_0x1a9921){return _0x1a21a6(_0x1a9921);}return _0x46aea2(_0x1a7009);});})[_0xed15('0x8')](function(_0x11070f){var _0x44f206=![];var _0x1427b2=_0x11070f[_0xed15('0xf')](/\n/);for(var _0x4ff3ca=0x0,_0x989510=_0x315088[_0xed15('0x10')];_0x4ff3ca<_0x989510,_0x44f206===![];_0x4ff3ca+=0x1){if(_0x11070f['indexOf'](_0x315088[_0x4ff3ca])>=0x0){_0x44f206=!![];}}if(!_0x44f206){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1dc4b9[_0xed15('0xd')][_0xed15('0xe')]));}process[_0xed15('0x11')](_0x1dc4b9[_0xed15('0xd')][_0xed15('0xe')],_0xed15('0x12'));return _0x41b74a[_0xed15('0x9')](0xc8)[_0xed15('0xa')]({'message':util[_0xed15('0x13')](_0xed15('0x14'),_0x1dc4b9[_0xed15('0xd')][_0xed15('0xe')])});})[_0xed15('0x15')](handleError(_0x41b74a,null,_0xed15('0xb')));}; \ No newline at end of file +var _0x359f=['params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','index','getAllData','then','status','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x3273e3,_0x2a5256){var _0xfbd07c=function(_0x58a4a7){while(--_0x58a4a7){_0x3273e3['push'](_0x3273e3['shift']());}};_0xfbd07c(++_0x2a5256);}(_0x359f,0x71));var _0xf359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x359f[_0x20a584];return _0x4b41a8;};'use strict';var info=require(_0xf359('0x0'));var exec=require(_0xf359('0x1'))[_0xf359('0x2')];var logger=require('../../config/logger')(_0xf359('0x3'));var util=require(_0xf359('0x4'));var BPromise=require(_0xf359('0x5'));var _=require(_0xf359('0x6'));function handleError(_0x1281a0,_0x4428f4,_0x30d2f6){_0x4428f4=_0x4428f4||0x1f4;return function(_0x5a0f5f){logger[_0xf359('0x7')](_0xf359('0x8'),_0x30d2f6,_0x4428f4,util['inspect'](_0x5a0f5f,{'showHidden':![],'depth':null}));delete _0x5a0f5f[_0xf359('0x9')];_0x1281a0['status'](_0x4428f4)['send'](_0x5a0f5f);};}exports[_0xf359('0xa')]=function(_0xda7686,_0x5079a1){return info[_0xf359('0xb')]()[_0xf359('0xc')](function(_0x4dd441){return _0x5079a1[_0xf359('0xd')](0xc8)['json'](_0x4dd441);})['catch'](function(_0x7cdcb6){return _0x5079a1[_0xf359('0xd')](0x1f4)[_0xf359('0xe')](_0x7cdcb6);});};exports['killProcess']=function(_0x27b7c2,_0x5d89e0){var _0x4b01aa=['components/import/cm'];return new BPromise(function(_0x3f8e92,_0x2dae8b){return exec(util[_0xf359('0xf')](_0xf359('0x10'),_0x27b7c2[_0xf359('0x11')][_0xf359('0x12')]),function(_0x2d6383,_0x29aaff,_0xe19539){if(_0x2d6383){return _0x2dae8b(_0x2d6383);}return _0x3f8e92(_0x29aaff);});})[_0xf359('0xc')](function(_0x18f932){var _0x19a866=![];var _0x37d863=_0x18f932['split'](/\n/);for(var _0x5b1bb5=0x0,_0x363f18=_0x4b01aa[_0xf359('0x13')];_0x5b1bb5<_0x363f18,_0x19a866===![];_0x5b1bb5+=0x1){if(_0x18f932[_0xf359('0x14')](_0x4b01aa[_0x5b1bb5])>=0x0){_0x19a866=!![];}}if(!_0x19a866){throw new Error(util[_0xf359('0xf')](_0xf359('0x15'),_0x27b7c2[_0xf359('0x11')]['pid']));}process['kill'](_0x27b7c2[_0xf359('0x11')][_0xf359('0x12')],_0xf359('0x16'));return _0x5d89e0[_0xf359('0xd')](0xc8)[_0xf359('0xe')]({'message':util[_0xf359('0xf')](_0xf359('0x17'),_0x27b7c2[_0xf359('0x11')]['pid'])});})[_0xf359('0x18')](handleError(_0x5d89e0,null,_0xf359('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 821f60c..a517372 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(_0x8ea3c3,_0xe3fffc){var _0x149898=function(_0xad569e){while(--_0xad569e){_0x8ea3c3['push'](_0x8ea3c3['shift']());}};_0x149898(++_0xe3fffc);}(_0xd2ea,0x15f));var _0xad2e=function(_0x561199,_0x112512){_0x561199=_0x561199-0x0;var _0x3fbe3c=_0xd2ea[_0x561199];return _0x3fbe3c;};'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 _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x46f7f0,_0x4ef418){var _0x783786=function(_0x1ad786){while(--_0x1ad786){_0x46f7f0['push'](_0x46f7f0['shift']());}};_0x783786(++_0x4ef418);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x4b84[_0x3c4f1f];return _0x19cb69;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./tag.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('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 3ae5b15..1ea8608 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 _0xe511=['#0091EA','STRING','sequelize','exports','name'];(function(_0x385799,_0x2be19b){var _0x3734fc=function(_0x4e50f9){while(--_0x4e50f9){_0x385799['push'](_0x385799['shift']());}};_0x3734fc(++_0x2be19b);}(_0xe511,0x16f));var _0x1e51=function(_0x34d703,_0xb42f05){_0x34d703=_0x34d703-0x0;var _0x39f780=_0xe511[_0x34d703];return _0x39f780;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e51('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x1e51('0x3')},'description':{'type':Sequelize[_0x1e51('0x4')]}}; \ No newline at end of file +var _0x688a=['STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x688a,0x124));var _0xa688=function(_0x426370,_0x17ecbc){_0x426370=_0x426370-0x0;var _0x3de4e2=_0x688a[_0x426370];return _0x3de4e2;};'use strict';var Sequelize=require(_0xa688('0x0'));module[_0xa688('0x1')]={'name':{'type':Sequelize[_0xa688('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa688('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa688('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 63d42ca..bd49d97 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 _0x120e=['limit','count','reject','save','update','then','get','Tags','UserProfileResource','destroy','end','name','index','map','Tag','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x3779eb,_0xc19002){var _0x50423a=function(_0x16e841){while(--_0x16e841){_0x3779eb['push'](_0x3779eb['shift']());}};_0x50423a(++_0xc19002);}(_0x120e,0x17a));var _0xe120=function(_0x594a64,_0x1e24be){_0x594a64=_0x594a64-0x0;var _0x370f84=_0x120e[_0x594a64];return _0x370f84;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe120('0x0'));var jsonpatch=require(_0xe120('0x1'));var rp=require('request-promise');var moment=require(_0xe120('0x2'));var BPromise=require(_0xe120('0x3'));var Mustache=require(_0xe120('0x4'));var util=require(_0xe120('0x5'));var path=require(_0xe120('0x6'));var sox=require(_0xe120('0x7'));var csv=require(_0xe120('0x8'));var ejs=require(_0xe120('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe120('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe120('0xb'));var deskjs=require(_0xe120('0xc'));var toCsv=require(_0xe120('0x8'));var querystring=require(_0xe120('0xd'));var Papa=require('papaparse');var Redis=require(_0xe120('0xe'));var authService=require(_0xe120('0xf'));var qs=require(_0xe120('0x10'));var as=require(_0xe120('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe120('0x12'))(_0xe120('0x13'));var utils=require('../../config/utils');var config=require(_0xe120('0x14'));var licenseUtil=require(_0xe120('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x427f58,_0x2957ba){_0x2957ba=_0x2957ba||0xcc;return function(_0x2a98ab){if(_0x2a98ab){return _0x427f58[_0xe120('0x16')](_0x2957ba);}return _0x427f58[_0xe120('0x17')](_0x2957ba)['end']();};}function respondWithResult(_0x134b28,_0x2eb234){_0x2eb234=_0x2eb234||0xc8;return function(_0x2e4041){if(_0x2e4041){return _0x134b28[_0xe120('0x17')](_0x2eb234)[_0xe120('0x18')](_0x2e4041);}};}function respondWithFilteredResult(_0x103627,_0x1ca44c){return function(_0x360141){if(_0x360141){var _0x318093=typeof _0x1ca44c[_0xe120('0x19')]===_0xe120('0x1a')&&typeof _0x1ca44c[_0xe120('0x1b')]==='undefined';var _0x53d0a1=_0x360141[_0xe120('0x1c')];var _0x3eb48c=_0x318093?0x0:_0x1ca44c[_0xe120('0x19')];var _0x415517=_0x318093?_0x360141[_0xe120('0x1c')]:_0x1ca44c[_0xe120('0x19')]+_0x1ca44c[_0xe120('0x1b')];var _0x546e4d;if(_0x415517>=_0x53d0a1){_0x415517=_0x53d0a1;_0x546e4d=0xc8;}else{_0x546e4d=0xce;}_0x103627[_0xe120('0x17')](_0x546e4d);return _0x103627['set']('Content-Range',_0x3eb48c+'-'+_0x415517+'/'+_0x53d0a1)[_0xe120('0x18')](_0x360141);}return null;};}function patchUpdates(_0x8d61b6){return function(_0x2b1756){try{jsonpatch['apply'](_0x2b1756,_0x8d61b6,!![]);}catch(_0x23d7e5){return BPromise[_0xe120('0x1d')](_0x23d7e5);}return _0x2b1756[_0xe120('0x1e')]();};}function saveUpdates(_0x159c08,_0x1de4ab){return function(_0x3f7d5e){if(_0x3f7d5e){return _0x3f7d5e[_0xe120('0x1f')](_0x159c08)[_0xe120('0x20')](function(_0xcefc57){return _0xcefc57;});}return null;};}function removeEntity(_0x7993a1,_0x46cb7b){return function(_0x2e38f3){if(_0x2e38f3){return _0x2e38f3['destroy']()['then'](function(){var _0x5707f0=_0x2e38f3[_0xe120('0x21')]({'plain':!![]});var _0x279dd1=_0xe120('0x22');return db[_0xe120('0x23')][_0xe120('0x24')]({'where':{'type':_0x279dd1,'resourceId':_0x5707f0['id']}})[_0xe120('0x20')](function(){return _0x2e38f3;});})[_0xe120('0x20')](function(){_0x7993a1[_0xe120('0x17')](0xcc)[_0xe120('0x25')]();});}};}function handleEntityNotFound(_0x831228,_0x4aa1e5){return function(_0x2eab49){if(!_0x2eab49){_0x831228[_0xe120('0x16')](0x194);}return _0x2eab49;};}function handleError(_0x1ec5e0,_0x1c3265){_0x1c3265=_0x1c3265||0x1f4;return function(_0x13b101){logger['error'](_0x13b101['stack']);if(_0x13b101[_0xe120('0x26')]){delete _0x13b101[_0xe120('0x26')];}_0x1ec5e0[_0xe120('0x17')](_0x1c3265)['send'](_0x13b101);};}exports[_0xe120('0x27')]=function(_0x220406,_0x3088bb){var _0x164fa4={},_0x56471f={},_0x336ce={'count':0x0,'rows':[]};var _0x334b45=_[_0xe120('0x28')](db[_0xe120('0x29')]['rawAttributes'],function(_0x1d5b90){return{'name':_0x1d5b90[_0xe120('0x2a')],'type':_0x1d5b90['type'][_0xe120('0x2b')]};});_0x56471f[_0xe120('0x2c')]=_[_0xe120('0x28')](_0x334b45,_0xe120('0x26'));_0x56471f[_0xe120('0x2d')]=_['keys'](_0x220406[_0xe120('0x2d')]);_0x56471f[_0xe120('0x2e')]=_[_0xe120('0x2f')](_0x56471f[_0xe120('0x2c')],_0x56471f[_0xe120('0x2d')]);_0x164fa4[_0xe120('0x30')]=_[_0xe120('0x2f')](_0x56471f['model'],qs[_0xe120('0x31')](_0x220406[_0xe120('0x2d')][_0xe120('0x31')]));_0x164fa4[_0xe120('0x30')]=_0x164fa4[_0xe120('0x30')]['length']?_0x164fa4['attributes']:_0x56471f[_0xe120('0x2c')];if(!_0x220406[_0xe120('0x2d')][_0xe120('0x32')](_0xe120('0x33'))){_0x164fa4[_0xe120('0x1b')]=qs['limit'](_0x220406[_0xe120('0x2d')][_0xe120('0x1b')]);_0x164fa4['offset']=qs['offset'](_0x220406['query'][_0xe120('0x19')]);}_0x164fa4[_0xe120('0x34')]=qs[_0xe120('0x35')](_0x220406[_0xe120('0x2d')][_0xe120('0x35')]);_0x164fa4[_0xe120('0x36')]=qs[_0xe120('0x2e')](_[_0xe120('0x37')](_0x220406[_0xe120('0x2d')],_0x56471f[_0xe120('0x2e')]),_0x334b45);if(_0x220406[_0xe120('0x2d')][_0xe120('0x38')]){_0x164fa4[_0xe120('0x36')]=_[_0xe120('0x39')](_0x164fa4[_0xe120('0x36')],{'$or':_['map'](_0x334b45,function(_0x108327){if(_0x108327[_0xe120('0x3a')]!==_0xe120('0x3b')){var _0x591d5f={};_0x591d5f[_0x108327[_0xe120('0x26')]]={'$like':'%'+_0x220406[_0xe120('0x2d')]['filter']+'%'};return _0x591d5f;}})});}_0x164fa4=_['merge']({},_0x164fa4,_0x220406['options']);var _0x27a00e={'where':_0x164fa4[_0xe120('0x36')]};return db[_0xe120('0x29')]['count'](_0x27a00e)[_0xe120('0x20')](function(_0x2bc224){_0x336ce[_0xe120('0x1c')]=_0x2bc224;if(_0x220406[_0xe120('0x2d')][_0xe120('0x3c')]){_0x164fa4[_0xe120('0x3d')]=[{'all':!![]}];}return db[_0xe120('0x29')][_0xe120('0x3e')](_0x164fa4);})['then'](function(_0x42ee54){_0x336ce[_0xe120('0x3f')]=_0x42ee54;return _0x336ce;})[_0xe120('0x20')](respondWithFilteredResult(_0x3088bb,_0x164fa4))[_0xe120('0x40')](handleError(_0x3088bb,null));};exports['show']=function(_0x5cbd02,_0x40e1f8){var _0x33dc9f={'raw':!![],'where':{'id':_0x5cbd02[_0xe120('0x41')]['id']}},_0x4adaa0={};_0x4adaa0[_0xe120('0x2c')]=_[_0xe120('0x42')](db[_0xe120('0x29')][_0xe120('0x43')]);_0x4adaa0[_0xe120('0x2d')]=_[_0xe120('0x42')](_0x5cbd02[_0xe120('0x2d')]);_0x4adaa0[_0xe120('0x2e')]=_[_0xe120('0x2f')](_0x4adaa0[_0xe120('0x2c')],_0x4adaa0[_0xe120('0x2d')]);_0x33dc9f[_0xe120('0x30')]=_[_0xe120('0x2f')](_0x4adaa0[_0xe120('0x2c')],qs[_0xe120('0x31')](_0x5cbd02['query']['fields']));_0x33dc9f[_0xe120('0x30')]=_0x33dc9f['attributes'][_0xe120('0x44')]?_0x33dc9f[_0xe120('0x30')]:_0x4adaa0[_0xe120('0x2c')];if(_0x5cbd02[_0xe120('0x2d')]['includeAll']){_0x33dc9f[_0xe120('0x3d')]=[{'all':!![]}];}_0x33dc9f=_[_0xe120('0x39')]({},_0x33dc9f,_0x5cbd02[_0xe120('0x45')]);return db[_0xe120('0x29')][_0xe120('0x46')](_0x33dc9f)[_0xe120('0x20')](handleEntityNotFound(_0x40e1f8,null))[_0xe120('0x20')](respondWithResult(_0x40e1f8,null))[_0xe120('0x40')](handleError(_0x40e1f8,null));};exports['create']=function(_0x50761c,_0x40a7a4){return db[_0xe120('0x29')][_0xe120('0x47')](_0x50761c['body'],{})['then'](function(_0x37fa0c){var _0x538135=_0x50761c[_0xe120('0x48')][_0xe120('0x21')]({'plain':!![]});if(!_0x538135)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x538135[_0xe120('0x49')]===_0xe120('0x48')){var _0xddfe0d=_0x37fa0c[_0xe120('0x21')]({'plain':!![]});var _0x13d387=_0xe120('0x22');return db[_0xe120('0x4a')][_0xe120('0x46')]({'where':{'name':_0x13d387,'userProfileId':_0x538135[_0xe120('0x4b')]},'raw':!![]})[_0xe120('0x20')](function(_0x5e3820){if(_0x5e3820&&_0x5e3820[_0xe120('0x4c')]===0x0){return db[_0xe120('0x23')][_0xe120('0x47')]({'name':_0xddfe0d['name'],'resourceId':_0xddfe0d['id'],'type':_0x5e3820[_0xe120('0x26')],'sectionId':_0x5e3820['id']},{})[_0xe120('0x20')](function(){return _0x37fa0c;});}else{return _0x37fa0c;}})[_0xe120('0x40')](function(_0x34ff32){logger[_0xe120('0x4d')](_0xe120('0x4e'),_0x34ff32);throw _0x34ff32;});}return _0x37fa0c;})['then'](respondWithResult(_0x40a7a4,0xc9))['catch'](handleError(_0x40a7a4,null));};exports[_0xe120('0x1f')]=function(_0x2549bb,_0x22d5a1){if(_0x2549bb['body']['id']){delete _0x2549bb[_0xe120('0x4f')]['id'];}return db['Tag'][_0xe120('0x46')]({'where':{'id':_0x2549bb[_0xe120('0x41')]['id']}})[_0xe120('0x20')](handleEntityNotFound(_0x22d5a1,null))[_0xe120('0x20')](saveUpdates(_0x2549bb['body'],null))[_0xe120('0x20')](respondWithResult(_0x22d5a1,null))['catch'](handleError(_0x22d5a1,null));};exports[_0xe120('0x24')]=function(_0x43805f,_0x198cc3){return db['Tag'][_0xe120('0x46')]({'where':{'id':_0x43805f['params']['id']}})[_0xe120('0x20')](handleEntityNotFound(_0x198cc3,null))['then'](removeEntity(_0x198cc3,null))[_0xe120('0x40')](handleError(_0x198cc3,null));};exports[_0xe120('0x50')]=function(_0x14330e,_0x5844ba){return db[_0xe120('0x29')][_0xe120('0x50')]()[_0xe120('0x20')](respondWithResult(_0x5844ba,null))[_0xe120('0x40')](handleError(_0x5844ba,null));}; \ No newline at end of file +var _0x4fd8=['status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','UserProfileResource','stack','name','send','index','Tag','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','moment','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x1aa39e,_0x47f38d){var _0x1780d=function(_0x4c5c2a){while(--_0x4c5c2a){_0x1aa39e['push'](_0x1aa39e['shift']());}};_0x1780d(++_0x47f38d);}(_0x4fd8,0x129));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x84fd('0x0'));var rimraf=require(_0x84fd('0x1'));var zipdir=require(_0x84fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84fd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x84fd('0x4'));var csv=require(_0x84fd('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84fd('0x6'));var _=require('lodash');var squel=require(_0x84fd('0x7'));var crypto=require(_0x84fd('0x8'));var jsforce=require(_0x84fd('0x9'));var deskjs=require(_0x84fd('0xa'));var toCsv=require('to-csv');var querystring=require(_0x84fd('0xb'));var Papa=require(_0x84fd('0xc'));var Redis=require(_0x84fd('0xd'));var authService=require(_0x84fd('0xe'));var qs=require(_0x84fd('0xf'));var as=require(_0x84fd('0x10'));var hardwareService=require(_0x84fd('0x11'));var logger=require(_0x84fd('0x12'))('api');var utils=require(_0x84fd('0x13'));var config=require(_0x84fd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x84fd('0x15'))['db'];function respondWithStatusCode(_0x3d65a1,_0x250947){_0x250947=_0x250947||0xcc;return function(_0x466830){if(_0x466830){return _0x3d65a1[_0x84fd('0x16')](_0x250947);}return _0x3d65a1[_0x84fd('0x17')](_0x250947)[_0x84fd('0x18')]();};}function respondWithResult(_0x5b2798,_0x28f41b){_0x28f41b=_0x28f41b||0xc8;return function(_0x4d9106){if(_0x4d9106){return _0x5b2798[_0x84fd('0x17')](_0x28f41b)[_0x84fd('0x19')](_0x4d9106);}};}function respondWithFilteredResult(_0x24c0a9,_0x2be640){return function(_0x5a7830){if(_0x5a7830){var _0x130a8e=typeof _0x2be640[_0x84fd('0x1a')]==='undefined'&&typeof _0x2be640['limit']===_0x84fd('0x1b');var _0x363aa1=_0x5a7830['count'];var _0x514445=_0x130a8e?0x0:_0x2be640[_0x84fd('0x1a')];var _0x517a05=_0x130a8e?_0x5a7830[_0x84fd('0x1c')]:_0x2be640[_0x84fd('0x1a')]+_0x2be640[_0x84fd('0x1d')];var _0x1ba9f5;if(_0x517a05>=_0x363aa1){_0x517a05=_0x363aa1;_0x1ba9f5=0xc8;}else{_0x1ba9f5=0xce;}_0x24c0a9['status'](_0x1ba9f5);return _0x24c0a9['set'](_0x84fd('0x1e'),_0x514445+'-'+_0x517a05+'/'+_0x363aa1)[_0x84fd('0x19')](_0x5a7830);}return null;};}function patchUpdates(_0x4a178d){return function(_0x39e829){try{jsonpatch[_0x84fd('0x1f')](_0x39e829,_0x4a178d,!![]);}catch(_0x5c170b){return BPromise[_0x84fd('0x20')](_0x5c170b);}return _0x39e829['save']();};}function saveUpdates(_0xe660c6,_0x1b0c30){return function(_0x7611bb){if(_0x7611bb){return _0x7611bb[_0x84fd('0x21')](_0xe660c6)[_0x84fd('0x22')](function(_0x1564b5){return _0x1564b5;});}return null;};}function removeEntity(_0x17005d,_0x1b64e8){return function(_0x2d7a1b){if(_0x2d7a1b){return _0x2d7a1b[_0x84fd('0x23')]()[_0x84fd('0x22')](function(){var _0xa6f2f4=_0x2d7a1b['get']({'plain':!![]});var _0x116728='Tags';return db[_0x84fd('0x24')][_0x84fd('0x23')]({'where':{'type':_0x116728,'resourceId':_0xa6f2f4['id']}})[_0x84fd('0x22')](function(){return _0x2d7a1b;});})[_0x84fd('0x22')](function(){_0x17005d[_0x84fd('0x17')](0xcc)[_0x84fd('0x18')]();});}};}function handleEntityNotFound(_0x49a818,_0xbeae3c){return function(_0x3293fe){if(!_0x3293fe){_0x49a818[_0x84fd('0x16')](0x194);}return _0x3293fe;};}function handleError(_0xf38411,_0x573be7){_0x573be7=_0x573be7||0x1f4;return function(_0x40ef13){logger['error'](_0x40ef13[_0x84fd('0x25')]);if(_0x40ef13[_0x84fd('0x26')]){delete _0x40ef13[_0x84fd('0x26')];}_0xf38411[_0x84fd('0x17')](_0x573be7)[_0x84fd('0x27')](_0x40ef13);};}exports[_0x84fd('0x28')]=function(_0x36c9e7,_0x1d38ba){var _0x57275b={},_0x290de5={},_0x1a2810={'count':0x0,'rows':[]};var _0x1aaa65=_['map'](db[_0x84fd('0x29')]['rawAttributes'],function(_0x3fc736){return{'name':_0x3fc736['fieldName'],'type':_0x3fc736[_0x84fd('0x2a')][_0x84fd('0x2b')]};});_0x290de5[_0x84fd('0x2c')]=_[_0x84fd('0x2d')](_0x1aaa65,_0x84fd('0x26'));_0x290de5['query']=_[_0x84fd('0x2e')](_0x36c9e7[_0x84fd('0x2f')]);_0x290de5[_0x84fd('0x30')]=_[_0x84fd('0x31')](_0x290de5[_0x84fd('0x2c')],_0x290de5[_0x84fd('0x2f')]);_0x57275b[_0x84fd('0x32')]=_[_0x84fd('0x31')](_0x290de5[_0x84fd('0x2c')],qs[_0x84fd('0x33')](_0x36c9e7['query'][_0x84fd('0x33')]));_0x57275b[_0x84fd('0x32')]=_0x57275b['attributes'][_0x84fd('0x34')]?_0x57275b[_0x84fd('0x32')]:_0x290de5[_0x84fd('0x2c')];if(!_0x36c9e7[_0x84fd('0x2f')][_0x84fd('0x35')]('nolimit')){_0x57275b['limit']=qs[_0x84fd('0x1d')](_0x36c9e7[_0x84fd('0x2f')]['limit']);_0x57275b[_0x84fd('0x1a')]=qs[_0x84fd('0x1a')](_0x36c9e7[_0x84fd('0x2f')][_0x84fd('0x1a')]);}_0x57275b[_0x84fd('0x36')]=qs[_0x84fd('0x37')](_0x36c9e7[_0x84fd('0x2f')]['sort']);_0x57275b[_0x84fd('0x38')]=qs[_0x84fd('0x30')](_[_0x84fd('0x39')](_0x36c9e7[_0x84fd('0x2f')],_0x290de5['filters']),_0x1aaa65);if(_0x36c9e7[_0x84fd('0x2f')][_0x84fd('0x3a')]){_0x57275b[_0x84fd('0x38')]=_[_0x84fd('0x3b')](_0x57275b['where'],{'$or':_['map'](_0x1aaa65,function(_0x216c82){if(_0x216c82[_0x84fd('0x2a')]!==_0x84fd('0x3c')){var _0x533ac5={};_0x533ac5[_0x216c82[_0x84fd('0x26')]]={'$like':'%'+_0x36c9e7[_0x84fd('0x2f')][_0x84fd('0x3a')]+'%'};return _0x533ac5;}})});}_0x57275b=_[_0x84fd('0x3b')]({},_0x57275b,_0x36c9e7['options']);var _0x1ca3c4={'where':_0x57275b[_0x84fd('0x38')]};return db[_0x84fd('0x29')]['count'](_0x1ca3c4)[_0x84fd('0x22')](function(_0x19e353){_0x1a2810[_0x84fd('0x1c')]=_0x19e353;if(_0x36c9e7[_0x84fd('0x2f')][_0x84fd('0x3d')]){_0x57275b[_0x84fd('0x3e')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x57275b);})[_0x84fd('0x22')](function(_0x537a76){_0x1a2810[_0x84fd('0x3f')]=_0x537a76;return _0x1a2810;})[_0x84fd('0x22')](respondWithFilteredResult(_0x1d38ba,_0x57275b))[_0x84fd('0x40')](handleError(_0x1d38ba,null));};exports[_0x84fd('0x41')]=function(_0x56b693,_0xf2f85f){var _0x10de3f={'raw':!![],'where':{'id':_0x56b693[_0x84fd('0x42')]['id']}},_0x516461={};_0x516461[_0x84fd('0x2c')]=_[_0x84fd('0x2e')](db[_0x84fd('0x29')]['rawAttributes']);_0x516461[_0x84fd('0x2f')]=_[_0x84fd('0x2e')](_0x56b693['query']);_0x516461[_0x84fd('0x30')]=_[_0x84fd('0x31')](_0x516461[_0x84fd('0x2c')],_0x516461[_0x84fd('0x2f')]);_0x10de3f['attributes']=_['intersection'](_0x516461['model'],qs['fields'](_0x56b693[_0x84fd('0x2f')]['fields']));_0x10de3f[_0x84fd('0x32')]=_0x10de3f[_0x84fd('0x32')][_0x84fd('0x34')]?_0x10de3f[_0x84fd('0x32')]:_0x516461[_0x84fd('0x2c')];if(_0x56b693[_0x84fd('0x2f')][_0x84fd('0x3d')]){_0x10de3f[_0x84fd('0x3e')]=[{'all':!![]}];}_0x10de3f=_[_0x84fd('0x3b')]({},_0x10de3f,_0x56b693[_0x84fd('0x43')]);return db[_0x84fd('0x29')][_0x84fd('0x44')](_0x10de3f)[_0x84fd('0x22')](handleEntityNotFound(_0xf2f85f,null))[_0x84fd('0x22')](respondWithResult(_0xf2f85f,null))[_0x84fd('0x40')](handleError(_0xf2f85f,null));};exports[_0x84fd('0x45')]=function(_0xbfbef2,_0x1a59ca){return db[_0x84fd('0x29')]['create'](_0xbfbef2[_0x84fd('0x46')],{})[_0x84fd('0x22')](function(_0x1a664a){var _0x22d773=_0xbfbef2['user'][_0x84fd('0x47')]({'plain':!![]});if(!_0x22d773)throw new Error(_0x84fd('0x48'));if(_0x22d773[_0x84fd('0x49')]==='user'){var _0x1e3cdc=_0x1a664a['get']({'plain':!![]});var _0x513c99=_0x84fd('0x4a');return db[_0x84fd('0x4b')][_0x84fd('0x44')]({'where':{'name':_0x513c99,'userProfileId':_0x22d773['userProfileId']},'raw':!![]})['then'](function(_0x292465){if(_0x292465&&_0x292465[_0x84fd('0x4c')]===0x0){return db[_0x84fd('0x24')][_0x84fd('0x45')]({'name':_0x1e3cdc[_0x84fd('0x26')],'resourceId':_0x1e3cdc['id'],'type':_0x292465[_0x84fd('0x26')],'sectionId':_0x292465['id']},{})[_0x84fd('0x22')](function(){return _0x1a664a;});}else{return _0x1a664a;}})[_0x84fd('0x40')](function(_0x171292){logger[_0x84fd('0x4d')](_0x84fd('0x4e'),_0x171292);throw _0x171292;});}return _0x1a664a;})['then'](respondWithResult(_0x1a59ca,0xc9))[_0x84fd('0x40')](handleError(_0x1a59ca,null));};exports['update']=function(_0x2ff2c0,_0x29eb91){if(_0x2ff2c0[_0x84fd('0x46')]['id']){delete _0x2ff2c0[_0x84fd('0x46')]['id'];}return db[_0x84fd('0x29')][_0x84fd('0x44')]({'where':{'id':_0x2ff2c0[_0x84fd('0x42')]['id']}})[_0x84fd('0x22')](handleEntityNotFound(_0x29eb91,null))['then'](saveUpdates(_0x2ff2c0[_0x84fd('0x46')],null))[_0x84fd('0x22')](respondWithResult(_0x29eb91,null))[_0x84fd('0x40')](handleError(_0x29eb91,null));};exports[_0x84fd('0x23')]=function(_0x34fce3,_0x988506){return db['Tag'][_0x84fd('0x44')]({'where':{'id':_0x34fce3[_0x84fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x988506,null))[_0x84fd('0x22')](removeEntity(_0x988506,null))[_0x84fd('0x40')](handleError(_0x988506,null));};exports[_0x84fd('0x4f')]=function(_0x37f1c0,_0x48e0f9){return db['Tag'][_0x84fd('0x4f')]()[_0x84fd('0x22')](respondWithResult(_0x48e0f9,null))[_0x84fd('0x40')](handleError(_0x48e0f9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5e25304..9762a7b 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 _0xbac4=['../../config/environment','exports','define','tools_tags','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x1b73b2,_0x5c9a9a){var _0x494fbf=function(_0x8d7c88){while(--_0x8d7c88){_0x1b73b2['push'](_0x1b73b2['shift']());}};_0x494fbf(++_0x5c9a9a);}(_0xbac4,0x1b2));var _0x4bac=function(_0x34dc1a,_0x41a261){_0x34dc1a=_0x34dc1a-0x0;var _0x217a76=_0xbac4[_0x34dc1a];return _0x217a76;};'use strict';var _=require(_0x4bac('0x0'));var util=require(_0x4bac('0x1'));var logger=require(_0x4bac('0x2'))(_0x4bac('0x3'));var moment=require(_0x4bac('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4bac('0x5'));var config=require(_0x4bac('0x6'));var attributes=require('./tag.attributes');module[_0x4bac('0x7')]=function(_0x5b0b4b,_0x464a38){return _0x5b0b4b[_0x4bac('0x8')]('Tag',attributes,{'tableName':_0x4bac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x095f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x3fc120,_0x10cf63){var _0x268d5f=function(_0x4f8329){while(--_0x4f8329){_0x3fc120['push'](_0x3fc120['shift']());}};_0x268d5f(++_0x10cf63);}(_0x095f,0x8c));var _0xf095=function(_0xf4a0d,_0x5d28b7){_0xf4a0d=_0xf4a0d-0x0;var _0x1fce82=_0x095f[_0xf4a0d];return _0x1fce82;};'use strict';var _=require(_0xf095('0x0'));var util=require(_0xf095('0x1'));var logger=require(_0xf095('0x2'))(_0xf095('0x3'));var moment=require(_0xf095('0x4'));var BPromise=require(_0xf095('0x5'));var rp=require(_0xf095('0x6'));var fs=require('fs');var path=require(_0xf095('0x7'));var rimraf=require(_0xf095('0x8'));var config=require(_0xf095('0x9'));var attributes=require(_0xf095('0xa'));module['exports']=function(_0x52aa40,_0x28c17e){return _0x52aa40['define'](_0xf095('0xb'),attributes,{'tableName':_0xf095('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 38b79b0..474aefe 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 _0x4ea3=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('Tag,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0x5089=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x5089,0x1bb));var _0x9508=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x5089[_0x25c326];return _0x762452;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var moment=require('moment');var BPromise=require(_0x9508('0x2'));var rs=require(_0x9508('0x3'));var fs=require('fs');var Redis=require(_0x9508('0x4'));var db=require(_0x9508('0x5'))['db'];var utils=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var jayson=require(_0x9508('0x8'));var client=jayson[_0x9508('0x9')][_0x9508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3c6,_0x1dc04c,_0x42d13a){return new BPromise(function(_0x55a5de,_0x14dae7){return client[_0x9508('0xb')](_0x4ab3c6,_0x42d13a)['then'](function(_0x342ddd){logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));logger[_0x9508('0xe')](_0x9508('0xf'),_0x1dc04c,_0x9508('0xd'),JSON[_0x9508('0x10')](_0x342ddd));if(_0x342ddd['error']){if(_0x342ddd[_0x9508('0x11')]['code']===0x1f4){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x342ddd['error'][_0x9508('0x12')]);return _0x14dae7(_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);}logger[_0x9508('0x11')]('Tag,\x20%s,\x20%s',_0x1dc04c,_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);return _0x55a5de(_0x342ddd['error'][_0x9508('0x12')]);}else{logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));_0x55a5de(_0x342ddd[_0x9508('0x13')][_0x9508('0x12')]);}})[_0x9508('0x14')](function(_0x343802){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x343802);_0x14dae7(_0x343802);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index bf49e8c..decce08 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 18707d4..bbfc402 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x194e13,_0x7e3ff3){var _0x480a25=function(_0x87b03e){while(--_0x87b03e){_0x194e13['push'](_0x194e13['shift']());}};_0x480a25(++_0x7e3ff3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c207b,_0x59f530){_0x4c207b=_0x4c207b-0x0;var _0x560c4f=_0xb10b[_0x4c207b];return _0x560c4f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4555998..2af9b4c 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 _0xb8b1=['request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Team','then','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','end','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','through','penalty','defaults','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','UserVoicePrefix','spread','removeAgents','QueueId','VoicePrefixId','getAgents','filter','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x33fa2a,_0x245c7e){var _0x5ba0b6=function(_0x5a768d){while(--_0x5a768d){_0x33fa2a['push'](_0x33fa2a['shift']());}};_0x5ba0b6(++_0x245c7e);}(_0xb8b1,0x1ca));var _0x1b8b=function(_0x355e8e,_0x4313f0){_0x355e8e=_0x355e8e-0x0;var _0x52cb43=_0xb8b1[_0x355e8e];return _0x52cb43;};'use strict';var emlformat=require(_0x1b8b('0x0'));var rimraf=require(_0x1b8b('0x1'));var zipdir=require(_0x1b8b('0x2'));var jsonpatch=require(_0x1b8b('0x3'));var rp=require(_0x1b8b('0x4'));var moment=require(_0x1b8b('0x5'));var BPromise=require(_0x1b8b('0x6'));var Mustache=require(_0x1b8b('0x7'));var util=require('util');var path=require(_0x1b8b('0x8'));var sox=require('sox');var csv=require(_0x1b8b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b8b('0xa'));var _=require(_0x1b8b('0xb'));var squel=require(_0x1b8b('0xc'));var crypto=require(_0x1b8b('0xd'));var jsforce=require(_0x1b8b('0xe'));var deskjs=require(_0x1b8b('0xf'));var toCsv=require(_0x1b8b('0x9'));var querystring=require(_0x1b8b('0x10'));var Papa=require(_0x1b8b('0x11'));var Redis=require(_0x1b8b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1b8b('0x13'));var as=require(_0x1b8b('0x14'));var hardwareService=require(_0x1b8b('0x15'));var logger=require(_0x1b8b('0x16'))('api');var utils=require(_0x1b8b('0x17'));var config=require(_0x1b8b('0x18'));var licenseUtil=require(_0x1b8b('0x19'));var db=require(_0x1b8b('0x1a'))['db'];config[_0x1b8b('0x1b')]=_['defaults'](config[_0x1b8b('0x1b')],{'host':_0x1b8b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b8b('0x1b')]));require(_0x1b8b('0x1d'))['register'](socket);function respondWithStatusCode(_0x34b3fd,_0x6214ba){_0x6214ba=_0x6214ba||0xcc;return function(_0x57fa5d){if(_0x57fa5d){return _0x34b3fd[_0x1b8b('0x1e')](_0x6214ba);}return _0x34b3fd[_0x1b8b('0x1f')](_0x6214ba)['end']();};}function respondWithResult(_0x1072b1,_0xf7b7ab){_0xf7b7ab=_0xf7b7ab||0xc8;return function(_0x4bfff7){if(_0x4bfff7){return _0x1072b1[_0x1b8b('0x1f')](_0xf7b7ab)[_0x1b8b('0x20')](_0x4bfff7);}};}function respondWithFilteredResult(_0x5a4877,_0xe7cee){return function(_0x1d4abb){if(_0x1d4abb){var _0x4a17ae=typeof _0xe7cee[_0x1b8b('0x21')]==='undefined'&&typeof _0xe7cee[_0x1b8b('0x22')]==='undefined';var _0x29c3e2=_0x1d4abb[_0x1b8b('0x23')];var _0x56f3f8=_0x4a17ae?0x0:_0xe7cee[_0x1b8b('0x21')];var _0xcdd02f=_0x4a17ae?_0x1d4abb[_0x1b8b('0x23')]:_0xe7cee[_0x1b8b('0x21')]+_0xe7cee[_0x1b8b('0x22')];var _0x33dc4a;if(_0xcdd02f>=_0x29c3e2){_0xcdd02f=_0x29c3e2;_0x33dc4a=0xc8;}else{_0x33dc4a=0xce;}_0x5a4877[_0x1b8b('0x1f')](_0x33dc4a);return _0x5a4877[_0x1b8b('0x24')]('Content-Range',_0x56f3f8+'-'+_0xcdd02f+'/'+_0x29c3e2)[_0x1b8b('0x20')](_0x1d4abb);}return null;};}function patchUpdates(_0x1b6d50){return function(_0x1f6f19){try{jsonpatch[_0x1b8b('0x25')](_0x1f6f19,_0x1b6d50,!![]);}catch(_0x5edd64){return BPromise[_0x1b8b('0x26')](_0x5edd64);}return _0x1f6f19[_0x1b8b('0x27')]();};}function saveUpdates(_0x52d9dd,_0xc2e8ba){return function(_0x45648e){if(_0x45648e){return _0x45648e[_0x1b8b('0x28')](_0x52d9dd)['then'](function(_0x299981){return _0x299981;});}return null;};}function handleEntityNotFound(_0x115d68,_0x2e4c8e){return function(_0x43bb4a){if(!_0x43bb4a){_0x115d68[_0x1b8b('0x1e')](0x194);}return _0x43bb4a;};}function handleError(_0x24a761,_0x5cb7f8){_0x5cb7f8=_0x5cb7f8||0x1f4;return function(_0x31f762){logger[_0x1b8b('0x29')](_0x31f762[_0x1b8b('0x2a')]);if(_0x31f762[_0x1b8b('0x2b')]){delete _0x31f762['name'];}_0x24a761[_0x1b8b('0x1f')](_0x5cb7f8)['send'](_0x31f762);};}exports[_0x1b8b('0x2c')]=function(_0x232530,_0x41bb0d){var _0x115760={},_0x4a3072={},_0x505119={'count':0x0,'rows':[]};var _0x5a8e34=_[_0x1b8b('0x2d')](db['Team'][_0x1b8b('0x2e')],function(_0x3ebf6e){return{'name':_0x3ebf6e['fieldName'],'type':_0x3ebf6e[_0x1b8b('0x2f')][_0x1b8b('0x30')]};});_0x4a3072[_0x1b8b('0x31')]=_['map'](_0x5a8e34,'name');_0x4a3072['query']=_['keys'](_0x232530[_0x1b8b('0x32')]);_0x4a3072[_0x1b8b('0x33')]=_[_0x1b8b('0x34')](_0x4a3072[_0x1b8b('0x31')],_0x4a3072[_0x1b8b('0x32')]);_0x115760[_0x1b8b('0x35')]=_[_0x1b8b('0x34')](_0x4a3072[_0x1b8b('0x31')],qs['fields'](_0x232530['query'][_0x1b8b('0x36')]));_0x115760['attributes']=_0x115760[_0x1b8b('0x35')][_0x1b8b('0x37')]?_0x115760[_0x1b8b('0x35')]:_0x4a3072[_0x1b8b('0x31')];if(!_0x232530[_0x1b8b('0x32')][_0x1b8b('0x38')](_0x1b8b('0x39'))){_0x115760['limit']=qs[_0x1b8b('0x22')](_0x232530[_0x1b8b('0x32')]['limit']);_0x115760['offset']=qs[_0x1b8b('0x21')](_0x232530[_0x1b8b('0x32')][_0x1b8b('0x21')]);}_0x115760[_0x1b8b('0x3a')]=qs[_0x1b8b('0x3b')](_0x232530[_0x1b8b('0x32')][_0x1b8b('0x3b')]);_0x115760[_0x1b8b('0x3c')]=qs[_0x1b8b('0x33')](_[_0x1b8b('0x3d')](_0x232530[_0x1b8b('0x32')],_0x4a3072[_0x1b8b('0x33')]),_0x5a8e34);if(_0x232530[_0x1b8b('0x32')]['filter']){_0x115760[_0x1b8b('0x3c')]=_[_0x1b8b('0x3e')](_0x115760[_0x1b8b('0x3c')],{'$or':_[_0x1b8b('0x2d')](_0x5a8e34,function(_0x3a6a6d){if(_0x3a6a6d[_0x1b8b('0x2f')]!==_0x1b8b('0x3f')){var _0x2c612e={};_0x2c612e[_0x3a6a6d[_0x1b8b('0x2b')]]={'$like':'%'+_0x232530['query']['filter']+'%'};return _0x2c612e;}})});}_0x115760=_[_0x1b8b('0x3e')]({},_0x115760,_0x232530['options']);var _0x19443d={'where':_0x115760['where']};return db[_0x1b8b('0x40')]['count'](_0x19443d)[_0x1b8b('0x41')](function(_0x5dbf2c){_0x505119['count']=_0x5dbf2c;if(_0x232530[_0x1b8b('0x32')][_0x1b8b('0x42')]){_0x115760[_0x1b8b('0x43')]=[{'all':!![]}];}return db[_0x1b8b('0x40')]['findAll'](_0x115760);})[_0x1b8b('0x41')](function(_0x3ec53c){_0x505119[_0x1b8b('0x44')]=_0x3ec53c;return _0x505119;})[_0x1b8b('0x41')](respondWithFilteredResult(_0x41bb0d,_0x115760))[_0x1b8b('0x45')](handleError(_0x41bb0d,null));};exports[_0x1b8b('0x46')]=function(_0x10ae07,_0x22bd80){var _0x1cfc05={'raw':![],'where':{'id':_0x10ae07[_0x1b8b('0x47')]['id']}},_0x1a2a36={};_0x1a2a36[_0x1b8b('0x31')]=_[_0x1b8b('0x48')](db['Team']['rawAttributes']);_0x1a2a36[_0x1b8b('0x32')]=_[_0x1b8b('0x48')](_0x10ae07[_0x1b8b('0x32')]);_0x1a2a36['filters']=_[_0x1b8b('0x34')](_0x1a2a36[_0x1b8b('0x31')],_0x1a2a36[_0x1b8b('0x32')]);_0x1cfc05[_0x1b8b('0x35')]=_[_0x1b8b('0x34')](_0x1a2a36['model'],qs[_0x1b8b('0x36')](_0x10ae07[_0x1b8b('0x32')]['fields']));_0x1cfc05['attributes']=_0x1cfc05[_0x1b8b('0x35')][_0x1b8b('0x37')]?_0x1cfc05[_0x1b8b('0x35')]:_0x1a2a36[_0x1b8b('0x31')];if(_0x10ae07[_0x1b8b('0x32')][_0x1b8b('0x42')]){_0x1cfc05[_0x1b8b('0x43')]=[{'all':!![]}];}_0x1cfc05=_[_0x1b8b('0x3e')]({},_0x1cfc05,_0x10ae07[_0x1b8b('0x49')]);return db[_0x1b8b('0x40')][_0x1b8b('0x4a')](_0x1cfc05)[_0x1b8b('0x41')](handleEntityNotFound(_0x22bd80,null))[_0x1b8b('0x41')](respondWithResult(_0x22bd80,null))[_0x1b8b('0x45')](handleError(_0x22bd80,null));};exports[_0x1b8b('0x4b')]=function(_0x3ecfb7,_0x259237){return db['Team'][_0x1b8b('0x4b')](_0x3ecfb7[_0x1b8b('0x4c')],{})['then'](function(_0x4582bc){var _0x495335=_0x3ecfb7[_0x1b8b('0x4d')]['get']({'plain':!![]});if(!_0x495335)throw new Error(_0x1b8b('0x4e'));if(_0x495335[_0x1b8b('0x4f')]===_0x1b8b('0x4d')){var _0x3b416b=_0x4582bc[_0x1b8b('0x50')]({'plain':!![]});var _0x539b32=_0x1b8b('0x51');return db['UserProfileSection'][_0x1b8b('0x4a')]({'where':{'name':_0x539b32,'userProfileId':_0x495335[_0x1b8b('0x52')]},'raw':!![]})[_0x1b8b('0x41')](function(_0x5cbac7){if(_0x5cbac7&&_0x5cbac7[_0x1b8b('0x53')]===0x0){return db[_0x1b8b('0x54')]['create']({'name':_0x3b416b[_0x1b8b('0x2b')],'resourceId':_0x3b416b['id'],'type':_0x5cbac7['name'],'sectionId':_0x5cbac7['id']},{})[_0x1b8b('0x41')](function(){return _0x4582bc;});}else{return _0x4582bc;}})['catch'](function(_0x17f0d5){logger[_0x1b8b('0x29')](_0x1b8b('0x55'),_0x17f0d5);throw _0x17f0d5;});}return _0x4582bc;})[_0x1b8b('0x41')](respondWithResult(_0x259237,0xc9))[_0x1b8b('0x45')](handleError(_0x259237,null));};exports[_0x1b8b('0x28')]=function(_0x508910,_0x360154){if(_0x508910[_0x1b8b('0x4c')]['id']){delete _0x508910[_0x1b8b('0x4c')]['id'];}return db[_0x1b8b('0x40')][_0x1b8b('0x4a')]({'where':{'id':_0x508910['params']['id']}})[_0x1b8b('0x41')](handleEntityNotFound(_0x360154,null))[_0x1b8b('0x41')](saveUpdates(_0x508910[_0x1b8b('0x4c')],null))['then'](respondWithResult(_0x360154,null))[_0x1b8b('0x45')](handleError(_0x360154,null));};exports['destroy']=function(_0x18d641,_0x1842a1){var _0xfd94a0=_0x18d641[_0x1b8b('0x47')]['id'];var _0x529e99=[];return db['sequelize'][_0x1b8b('0x56')](function(_0x10bf40){var _0x56fbd6=_0x1b8b('0x57')+_0xfd94a0;return db[_0x1b8b('0x58')]['query'](_0x56fbd6,{'type':db[_0x1b8b('0x59')][_0x1b8b('0x5a')][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40})[_0x1b8b('0x41')](function(_0x469bab){_0x529e99=_[_0x1b8b('0x2d')](_0x469bab,function(_0x5c6697){return Number(_0x5c6697['UserId']);});})['then'](function(){var _0x152d73=_0x1b8b('0x5c')+_0xfd94a0;return db[_0x1b8b('0x58')][_0x1b8b('0x32')](_0x152d73,{'type':db[_0x1b8b('0x59')][_0x1b8b('0x5a')][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(_0x5ebe35){var _0x3b5a1c=_['map'](_0x5ebe35,function(_0xcb83f0){return Number(_0xcb83f0[_0x1b8b('0x5d')]);});return db['UserVoiceQueue'][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'VoiceQueueId':{'$in':_0x3b5a1c}},'transaction':_0x10bf40});})['then'](function(){var _0x3f713e=_0x1b8b('0x5f')+_0xfd94a0;return db[_0x1b8b('0x58')][_0x1b8b('0x32')](_0x3f713e,{'type':db[_0x1b8b('0x59')][_0x1b8b('0x5a')][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(_0x3757e9){var _0xff3d2a=_['map'](_0x3757e9,function(_0x49a3b0){return Number(_0x49a3b0[_0x1b8b('0x60')]);});return db[_0x1b8b('0x61')][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'MailQueueId':{'$in':_0xff3d2a}},'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(){var _0x38cc18='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xfd94a0;return db['sequelize']['query'](_0x38cc18,{'type':db['Sequelize'][_0x1b8b('0x5a')][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40});})['then'](function(_0x4e6435){var _0x48970b=_[_0x1b8b('0x2d')](_0x4e6435,function(_0x549340){return Number(_0x549340['SmsQueueId']);});return db[_0x1b8b('0x62')][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'SmsQueueId':{'$in':_0x48970b}},'transaction':_0x10bf40});})['then'](function(){var _0x23682f=_0x1b8b('0x63')+_0xfd94a0;return db[_0x1b8b('0x58')][_0x1b8b('0x32')](_0x23682f,{'type':db[_0x1b8b('0x59')][_0x1b8b('0x5a')]['SELECT'],'raw':!![],'transaction':_0x10bf40});})['then'](function(_0x5acfb5){var _0x811a11=_[_0x1b8b('0x2d')](_0x5acfb5,function(_0x254140){return Number(_0x254140['ChatQueueId']);});return db['UserChatQueue'][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'ChatQueueId':{'$in':_0x811a11}},'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(){var _0x5a5e52=_0x1b8b('0x64')+_0xfd94a0;return db[_0x1b8b('0x58')]['query'](_0x5a5e52,{'type':db['Sequelize']['QueryTypes'][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(_0x1672fb){var _0x1695c3=_['map'](_0x1672fb,function(_0x1de9b1){return Number(_0x1de9b1['FaxQueueId']);});return db[_0x1b8b('0x65')][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'FaxQueueId':{'$in':_0x1695c3}},'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(){var _0x286c96=_0x1b8b('0x66')+_0xfd94a0;return db[_0x1b8b('0x58')][_0x1b8b('0x32')](_0x286c96,{'type':db[_0x1b8b('0x59')][_0x1b8b('0x5a')][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(_0x3e9b00){var _0x317ce3=_[_0x1b8b('0x2d')](_0x3e9b00,function(_0x56c703){return Number(_0x56c703[_0x1b8b('0x67')]);});return db[_0x1b8b('0x68')]['destroy']({'where':{'UserId':{'$in':_0x529e99},'OpenchannelQueueId':{'$in':_0x317ce3}},'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(){var _0x36e67c='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xfd94a0;return db[_0x1b8b('0x58')][_0x1b8b('0x32')](_0x36e67c,{'type':db['Sequelize'][_0x1b8b('0x5a')][_0x1b8b('0x5b')],'raw':!![],'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(_0x22c795){var _0x249301=_['map'](_0x22c795,function(_0x3243b2){return Number(_0x3243b2[_0x1b8b('0x69')]);});return db[_0x1b8b('0x6a')][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'WhatsappQueueId':{'$in':_0x249301}},'transaction':_0x10bf40});})['then'](function(){return db[_0x1b8b('0x6b')][_0x1b8b('0x4a')]({'where':{'TeamId':_0xfd94a0}});})[_0x1b8b('0x41')](function(_0x584a21){if(_0x584a21===null){return;}return db['UserVoicePrefix'][_0x1b8b('0x5e')]({'where':{'UserId':{'$in':_0x529e99},'VoicePrefixId':_0x584a21['VoicePrefixId']},'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(){return db[_0x1b8b('0x40')][_0x1b8b('0x5e')]({'where':{'id':_0xfd94a0},'cascade':!![],'transaction':_0x10bf40});})[_0x1b8b('0x41')](function(_0x462b4d){if(_0x462b4d===0x0){_0x1842a1[_0x1b8b('0x1e')](0x194);}else{return db[_0x1b8b('0x54')][_0x1b8b('0x5e')]({'where':{'type':'Teams','resourceId':_0xfd94a0},'cascade':!![],'transaction':_0x10bf40})[_0x1b8b('0x41')](function(){_0x1842a1[_0x1b8b('0x1f')](0xcc)[_0x1b8b('0x6c')]();});}})[_0x1b8b('0x45')](function(_0x1c6474){_0x1842a1[_0x1b8b('0x1f')](0x1f4)[_0x1b8b('0x6d')](_0x1c6474);});});};exports[_0x1b8b('0x6e')]=function(_0x3fece7,_0x445312,_0x4875ad){return db[_0x1b8b('0x40')][_0x1b8b('0x6f')]({'where':{'id':_0x3fece7[_0x1b8b('0x47')]['id']}})[_0x1b8b('0x41')](handleEntityNotFound(_0x445312,null))['then'](function(_0x492cf2){if(!_0x3fece7[_0x1b8b('0x32')][_0x1b8b('0x70')]||!utils[_0x1b8b('0x71')](_0x3fece7[_0x1b8b('0x32')]['channel'])){throw new db[(_0x1b8b('0x59'))][(_0x1b8b('0x72'))](_0x1b8b('0x73'));}var _0x55e2ad={};var _0x10e92f={};_0x10e92f[_0x1b8b('0x31')]=_[_0x1b8b('0x48')](db[_[_0x1b8b('0x74')](_0x3fece7[_0x1b8b('0x32')][_0x1b8b('0x70')][_0x1b8b('0x75')]())+_0x1b8b('0x76')][_0x1b8b('0x2e')]);_0x10e92f[_0x1b8b('0x32')]=_[_0x1b8b('0x48')](_0x3fece7[_0x1b8b('0x32')]);_0x10e92f[_0x1b8b('0x33')]=_[_0x1b8b('0x34')](_0x10e92f['model'],_0x10e92f[_0x1b8b('0x32')]);_0x55e2ad['attributes']=_[_0x1b8b('0x34')](_0x10e92f[_0x1b8b('0x31')],qs[_0x1b8b('0x36')](_0x3fece7[_0x1b8b('0x32')]['fields']));_0x55e2ad[_0x1b8b('0x35')]=_0x55e2ad['attributes'][_0x1b8b('0x37')]?_0x55e2ad[_0x1b8b('0x35')]:_0x10e92f[_0x1b8b('0x31')];_0x55e2ad[_0x1b8b('0x22')]=qs[_0x1b8b('0x22')](_0x3fece7['query'][_0x1b8b('0x22')]);_0x55e2ad[_0x1b8b('0x21')]=qs[_0x1b8b('0x21')](_0x3fece7['query'][_0x1b8b('0x21')]);_0x55e2ad[_0x1b8b('0x3a')]=qs['sort'](_0x3fece7[_0x1b8b('0x32')]['sort']);_0x55e2ad[_0x1b8b('0x3c')]=qs[_0x1b8b('0x33')](_[_0x1b8b('0x3d')](_0x3fece7['query'],_0x10e92f[_0x1b8b('0x33')]));_0x55e2ad=_[_0x1b8b('0x3e')]({},_0x55e2ad,_0x3fece7[_0x1b8b('0x49')]);return _0x492cf2['get'+_['capitalize'](_0x3fece7[_0x1b8b('0x32')][_0x1b8b('0x70')][_0x1b8b('0x75')]())+_0x1b8b('0x77')](_0x55e2ad);})['then'](respondWithResult(_0x445312,null))['catch'](handleError(_0x445312,null));};exports['addQueues']=function(_0x23f22b,_0x4b48ad,_0x4f9b00){return db[_0x1b8b('0x40')][_0x1b8b('0x6f')]({'where':{'id':_0x23f22b[_0x1b8b('0x47')]['id']}})[_0x1b8b('0x41')](function(_0x21a5d6){if(_0x21a5d6){if(!_0x23f22b[_0x1b8b('0x4c')]['channel']||!utils[_0x1b8b('0x71')](_0x23f22b[_0x1b8b('0x4c')][_0x1b8b('0x70')])){throw new db[(_0x1b8b('0x59'))]['ValidationError'](_0x1b8b('0x73'));}return _0x21a5d6[_0x1b8b('0x78')+_['capitalize'](_0x23f22b[_0x1b8b('0x4c')][_0x1b8b('0x70')][_0x1b8b('0x75')]())+_0x1b8b('0x77')](_0x23f22b['body'][_0x1b8b('0x79')]);}return null;})['then'](handleEntityNotFound(_0x4b48ad,null))['then'](respondWithStatusCode(_0x4b48ad,null))[_0x1b8b('0x45')](handleError(_0x4b48ad,null));};exports[_0x1b8b('0x7a')]=function(_0x37d6ae,_0x312972,_0x50657d){return db['Team'][_0x1b8b('0x6f')]({'where':{'id':_0x37d6ae['params']['id']}})[_0x1b8b('0x41')](function(_0x465deb){if(_0x465deb){if(!_0x37d6ae[_0x1b8b('0x32')][_0x1b8b('0x70')]||!utils['isValidChannel'](_0x37d6ae[_0x1b8b('0x32')][_0x1b8b('0x70')])){throw new db['Sequelize']['ValidationError'](_0x1b8b('0x73'));}return _0x465deb['remove'+_[_0x1b8b('0x74')](_0x37d6ae[_0x1b8b('0x32')][_0x1b8b('0x70')][_0x1b8b('0x75')]())+'Queues'](_0x37d6ae['query'][_0x1b8b('0x79')]);}return null;})[_0x1b8b('0x41')](handleEntityNotFound(_0x312972,null))[_0x1b8b('0x41')](respondWithStatusCode(_0x312972,null))['catch'](handleError(_0x312972,null));};exports[_0x1b8b('0x7b')]=function(_0x25cbb8,_0x34bb82){var _0x2e3a3b=_[_0x1b8b('0x7c')](_0x25cbb8[_0x1b8b('0x4c')][_0x1b8b('0x79')])?_0x25cbb8[_0x1b8b('0x4c')][_0x1b8b('0x79')]:[_0x25cbb8[_0x1b8b('0x4c')]['ids']];var _0x360a25=_0x25cbb8['params']['id'];return db[_0x1b8b('0x40')][_0x1b8b('0x4a')]({'where':{'id':_0x360a25}})['then'](handleEntityNotFound(_0x34bb82,null))[_0x1b8b('0x41')](function(_0xdb046e){if(_0xdb046e){var _0x18c010=[_0x1b8b('0x7d'),_0x1b8b('0x7e'),'Mail',_0x1b8b('0x7f'),_0x1b8b('0x80'),_0x1b8b('0x81'),_0x1b8b('0x82')];return db['sequelize'][_0x1b8b('0x56')](function(_0x478833){var _0x50bce9=_[_0x1b8b('0x2d')](_0x18c010,function(_0x45a1f2){var _0x48cfcd={'attributes':['id','name']};if(_0x45a1f2===_0x1b8b('0x7d')){_0x48cfcd[_0x1b8b('0x83')]={'attributes':[_0x1b8b('0x84')]};}return _0xdb046e[_0x1b8b('0x50')+_0x45a1f2+_0x1b8b('0x77')](_0x48cfcd)[_0x1b8b('0x41')](function(_0x39ab06){var _0x35de06=_[_0x1b8b('0x2d')](_0x39ab06,function(_0x276e82){var _0x44945f=_['map'](_0x2e3a3b,function(_0x59fbbd){var _0x41d464={'where':{'UserId':_0x59fbbd,[_0x45a1f2+'QueueId']:_0x276e82['id']},'transaction':_0x478833};if(_0x45a1f2===_0x1b8b('0x7d')){_0x41d464[_0x1b8b('0x85')]={'penalty':_0x276e82['TeamVoiceQueue'][_0x1b8b('0x84')]};}return db[_0x1b8b('0x86')+_0x45a1f2+_0x1b8b('0x76')][_0x1b8b('0x87')](_0x41d464)[_0x1b8b('0x41')](function(){socket[_0x1b8b('0x88')](_0x1b8b('0x4d')+_0x45a1f2+_0x1b8b('0x89'),{'UserId':_0x59fbbd,[_0x45a1f2+'QueueId']:_0x276e82['id']});if(_0x45a1f2!==_0x1b8b('0x7d')){return;}return db[_0x1b8b('0x86')]['findAll']({'where':{'id':_0x2e3a3b,'online':0x1},'attributes':['id',_0x1b8b('0x2b'),'online',_0x1b8b('0x8a'),_0x1b8b('0x8b')],'raw':!![]})[_0x1b8b('0x41')](function(_0x5629b6){var _0x43d06b=_[_0x1b8b('0x2d')](_0x5629b6,function(_0x442607){return db[_0x1b8b('0x8c')][_0x1b8b('0x8d')]({'membername':_0x442607[_0x1b8b('0x2b')],'UserId':_0x442607['id'],'queue_name':_0x276e82[_0x1b8b('0x2b')],'VoiceQueueId':_0x276e82['id'],'interface':_[_0x1b8b('0x8e')](_0x442607[_0x1b8b('0x8b')])?util[_0x1b8b('0x8f')](_0x1b8b('0x90'),_0x442607[_0x1b8b('0x2b')]):_0x442607[_0x1b8b('0x8b')],'paused':_0x442607[_0x1b8b('0x8a')]||![],'penalty':_0x276e82[_0x1b8b('0x91')][_0x1b8b('0x84')]},{'transaction':_0x478833});});return Promise[_0x1b8b('0x92')](_0x43d06b);});});});return Promise[_0x1b8b('0x92')](_0x44945f);});return Promise[_0x1b8b('0x92')](_0x35de06);})[_0x1b8b('0x41')](function(){return db[_0x1b8b('0x6b')][_0x1b8b('0x6f')]({'where':{'teamId':_0x360a25}})[_0x1b8b('0x41')](function(_0x471648){if(_0x471648){var _0x2c3666=_[_0x1b8b('0x2d')](_0x2e3a3b,function(_0x16d6ab){db[_0x1b8b('0x93')]['upsert']({'UserId':_0x16d6ab,'VoicePrefixId':_0x471648['VoicePrefixId']});});return Promise[_0x1b8b('0x92')](_0x2c3666);}});});});return Promise[_0x1b8b('0x92')](_0x50bce9)[_0x1b8b('0x41')](function(){return _0xdb046e[_0x1b8b('0x7b')](_0x2e3a3b,{'transaction':_0x478833})[_0x1b8b('0x94')](function(_0x154251){return _0x154251;});});});}})[_0x1b8b('0x41')](respondWithResult(_0x34bb82,null))[_0x1b8b('0x45')](handleError(_0x34bb82,null));};exports[_0x1b8b('0x95')]=function(_0x3a30e8,_0x45b067){var _0x1cb3f3=_[_0x1b8b('0x7c')](_0x3a30e8['query'][_0x1b8b('0x79')])?_0x3a30e8[_0x1b8b('0x32')][_0x1b8b('0x79')]:[_0x3a30e8[_0x1b8b('0x32')][_0x1b8b('0x79')]];var _0x3adc22=_0x3a30e8['params']['id'];return db['Team'][_0x1b8b('0x4a')]({'where':{'id':_0x3adc22}})['then'](handleEntityNotFound(_0x45b067,null))[_0x1b8b('0x41')](function(_0x3abfd8){if(_0x3abfd8){var _0x4d10e6=[_0x1b8b('0x7d'),_0x1b8b('0x7e'),'Mail',_0x1b8b('0x7f'),'Fax',_0x1b8b('0x81'),_0x1b8b('0x82')];return db[_0x1b8b('0x58')][_0x1b8b('0x56')](function(_0x593b27){var _0x2ef657=_[_0x1b8b('0x2d')](_0x4d10e6,function(_0x415a3e){var _0x26455f={'attributes':['id',_0x1b8b('0x2b')]};return _0x3abfd8['get'+_0x415a3e+_0x1b8b('0x77')](_0x26455f)[_0x1b8b('0x41')](function(_0x561cad){var _0x11ae2c=_[_0x1b8b('0x2d')](_0x561cad,function(_0x16abca){return _0x16abca[_0x1b8b('0x95')](_0x1cb3f3,{'transaction':_0x593b27})[_0x1b8b('0x41')](function(){var _0x460e44=_[_0x1b8b('0x2d')](_0x1cb3f3,function(_0x2a23cc){socket['emit']('user'+_0x415a3e+'Queue:remove',{'UserId':Number(_0x2a23cc),[_0x415a3e+_0x1b8b('0x96')]:_0x16abca['id']});if(_0x415a3e!==_0x1b8b('0x7d')){return;}return db[_0x1b8b('0x8c')][_0x1b8b('0x5e')]({'where':{'VoiceQueueId':_0x16abca['id'],'UserId':_0x2a23cc},'transaction':_0x593b27});});return Promise['all'](_0x460e44);});});return Promise['all'](_0x11ae2c);});});return Promise[_0x1b8b('0x92')](_0x2ef657)[_0x1b8b('0x41')](function(){return _0x3abfd8[_0x1b8b('0x95')](_0x1cb3f3,{'transaction':_0x593b27});})['then'](function(){return db[_0x1b8b('0x6b')][_0x1b8b('0x6f')]({'where':{'teamId':_0x3adc22}})['then'](function(_0x4fdebc){if(_0x4fdebc){var _0x148f92=_['map'](_0x1cb3f3,function(_0x138bf4){db[_0x1b8b('0x93')][_0x1b8b('0x5e')]({'where':{'UserId':_0x138bf4,'VoicePrefixId':_0x4fdebc[_0x1b8b('0x97')]}});});return Promise['all'](_0x148f92);}});});});}})[_0x1b8b('0x41')](respondWithStatusCode(_0x45b067,null))['catch'](handleError(_0x45b067,null));};exports[_0x1b8b('0x98')]=function(_0x17692a,_0x15521d,_0x49e8e){var _0x1b0c48={};var _0x58a42c={};var _0x39640d;var _0x5ef1db;return db[_0x1b8b('0x40')][_0x1b8b('0x6f')]({'where':{'id':_0x17692a[_0x1b8b('0x47')]['id']}})[_0x1b8b('0x41')](handleEntityNotFound(_0x15521d,null))['then'](function(_0x5e6bb0){if(_0x5e6bb0){_0x39640d=_0x5e6bb0;_0x58a42c[_0x1b8b('0x31')]=_[_0x1b8b('0x48')](db[_0x1b8b('0x86')][_0x1b8b('0x2e')]);_0x58a42c[_0x1b8b('0x32')]=_['keys'](_0x17692a[_0x1b8b('0x32')]);_0x58a42c['filters']=_[_0x1b8b('0x34')](_0x58a42c[_0x1b8b('0x31')],_0x58a42c[_0x1b8b('0x32')]);_0x1b0c48[_0x1b8b('0x35')]=_['intersection'](_0x58a42c[_0x1b8b('0x31')],qs['fields'](_0x17692a[_0x1b8b('0x32')][_0x1b8b('0x36')]));_0x1b0c48[_0x1b8b('0x35')]=_0x1b0c48[_0x1b8b('0x35')][_0x1b8b('0x37')]?_0x1b0c48[_0x1b8b('0x35')]:_0x58a42c[_0x1b8b('0x31')];_0x1b0c48[_0x1b8b('0x3a')]=qs[_0x1b8b('0x3b')](_0x17692a['query'][_0x1b8b('0x3b')]);_0x1b0c48[_0x1b8b('0x3c')]=qs[_0x1b8b('0x33')](_['pick'](_0x17692a[_0x1b8b('0x32')],_0x58a42c['filters']));if(_0x17692a[_0x1b8b('0x32')][_0x1b8b('0x99')]){_0x1b0c48['where']=_[_0x1b8b('0x3e')](_0x1b0c48[_0x1b8b('0x3c')],{'$or':_[_0x1b8b('0x2d')](_0x1b0c48[_0x1b8b('0x35')],function(_0x9ef952){var _0x3f19bf={};_0x3f19bf[_0x9ef952]={'$like':'%'+_0x17692a[_0x1b8b('0x32')]['filter']+'%'};return _0x3f19bf;})});}_0x1b0c48=_[_0x1b8b('0x3e')]({},_0x1b0c48,_0x17692a[_0x1b8b('0x49')]);return _0x39640d[_0x1b8b('0x98')](_0x1b0c48);}})[_0x1b8b('0x41')](function(_0x479f1e){if(_0x479f1e){_0x5ef1db=_0x479f1e['length'];if(!_0x17692a['query']['hasOwnProperty'](_0x1b8b('0x39'))){_0x1b0c48[_0x1b8b('0x22')]=qs[_0x1b8b('0x22')](_0x17692a[_0x1b8b('0x32')][_0x1b8b('0x22')]);_0x1b0c48['offset']=qs[_0x1b8b('0x21')](_0x17692a[_0x1b8b('0x32')][_0x1b8b('0x21')]);}return _0x39640d[_0x1b8b('0x98')](_0x1b0c48);}})[_0x1b8b('0x41')](function(_0xb6798){if(_0xb6798){return _0xb6798?{'count':_0x5ef1db,'rows':_0xb6798}:null;}})[_0x1b8b('0x41')](respondWithResult(_0x15521d,null))['catch'](handleError(_0x15521d,null));}; \ No newline at end of file +var _0xdc86=['request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','includeAll','find','create','user','get','role','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','QueryTypes','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','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','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','transaction','through','penalty','defaults','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','upsert','isNil','interface','format','all','spread','removeAgents','Queue:remove','QueueId','UserVoiceQueueRt','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0xdc86,0x1d1));var _0x6dc8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xdc86[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x6dc8('0x0'));var rimraf=require(_0x6dc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dc8('0x2'));var rp=require(_0x6dc8('0x3'));var moment=require(_0x6dc8('0x4'));var BPromise=require(_0x6dc8('0x5'));var Mustache=require(_0x6dc8('0x6'));var util=require(_0x6dc8('0x7'));var path=require('path');var sox=require(_0x6dc8('0x8'));var csv=require(_0x6dc8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dc8('0xa'));var _=require(_0x6dc8('0xb'));var squel=require(_0x6dc8('0xc'));var crypto=require('crypto');var jsforce=require(_0x6dc8('0xd'));var deskjs=require(_0x6dc8('0xe'));var toCsv=require(_0x6dc8('0x9'));var querystring=require('querystring');var Papa=require(_0x6dc8('0xf'));var Redis=require('ioredis');var authService=require(_0x6dc8('0x10'));var qs=require(_0x6dc8('0x11'));var as=require(_0x6dc8('0x12'));var hardwareService=require(_0x6dc8('0x13'));var logger=require(_0x6dc8('0x14'))(_0x6dc8('0x15'));var utils=require(_0x6dc8('0x16'));var config=require(_0x6dc8('0x17'));var licenseUtil=require(_0x6dc8('0x18'));var db=require(_0x6dc8('0x19'))['db'];config[_0x6dc8('0x1a')]=_['defaults'](config['redis'],{'host':_0x6dc8('0x1b'),'port':0x18eb});var socket=require(_0x6dc8('0x1c'))(new Redis(config['redis']));require(_0x6dc8('0x1d'))[_0x6dc8('0x1e')](socket);function respondWithStatusCode(_0x5afdf0,_0x2d6411){_0x2d6411=_0x2d6411||0xcc;return function(_0x33ebf0){if(_0x33ebf0){return _0x5afdf0['sendStatus'](_0x2d6411);}return _0x5afdf0[_0x6dc8('0x1f')](_0x2d6411)[_0x6dc8('0x20')]();};}function respondWithResult(_0x5c1990,_0x46d983){_0x46d983=_0x46d983||0xc8;return function(_0x1155e2){if(_0x1155e2){return _0x5c1990['status'](_0x46d983)[_0x6dc8('0x21')](_0x1155e2);}};}function respondWithFilteredResult(_0x4fc8a5,_0x8de3e5){return function(_0x39b544){if(_0x39b544){var _0x1146ea=typeof _0x8de3e5[_0x6dc8('0x22')]===_0x6dc8('0x23')&&typeof _0x8de3e5[_0x6dc8('0x24')]===_0x6dc8('0x23');var _0x1bebe8=_0x39b544[_0x6dc8('0x25')];var _0x446105=_0x1146ea?0x0:_0x8de3e5['offset'];var _0x341481=_0x1146ea?_0x39b544[_0x6dc8('0x25')]:_0x8de3e5['offset']+_0x8de3e5['limit'];var _0x30df8b;if(_0x341481>=_0x1bebe8){_0x341481=_0x1bebe8;_0x30df8b=0xc8;}else{_0x30df8b=0xce;}_0x4fc8a5['status'](_0x30df8b);return _0x4fc8a5[_0x6dc8('0x26')](_0x6dc8('0x27'),_0x446105+'-'+_0x341481+'/'+_0x1bebe8)[_0x6dc8('0x21')](_0x39b544);}return null;};}function patchUpdates(_0x4173da){return function(_0x48877c){try{jsonpatch[_0x6dc8('0x28')](_0x48877c,_0x4173da,!![]);}catch(_0x2c37c8){return BPromise[_0x6dc8('0x29')](_0x2c37c8);}return _0x48877c[_0x6dc8('0x2a')]();};}function saveUpdates(_0x37dd9f,_0x264cfd){return function(_0x23024c){if(_0x23024c){return _0x23024c[_0x6dc8('0x2b')](_0x37dd9f)[_0x6dc8('0x2c')](function(_0x4034d3){return _0x4034d3;});}return null;};}function handleEntityNotFound(_0x1165c1,_0x162a6a){return function(_0x2a76c3){if(!_0x2a76c3){_0x1165c1[_0x6dc8('0x2d')](0x194);}return _0x2a76c3;};}function handleError(_0x29d1ef,_0x309e49){_0x309e49=_0x309e49||0x1f4;return function(_0x27f345){logger[_0x6dc8('0x2e')](_0x27f345[_0x6dc8('0x2f')]);if(_0x27f345[_0x6dc8('0x30')]){delete _0x27f345[_0x6dc8('0x30')];}_0x29d1ef[_0x6dc8('0x1f')](_0x309e49)[_0x6dc8('0x31')](_0x27f345);};}exports['index']=function(_0x3b21c0,_0x45fb7f){var _0x6dfeda={},_0x5d9cb9={},_0x468c57={'count':0x0,'rows':[]};var _0x29cc5d=_[_0x6dc8('0x32')](db[_0x6dc8('0x33')][_0x6dc8('0x34')],function(_0x1f06e6){return{'name':_0x1f06e6[_0x6dc8('0x35')],'type':_0x1f06e6[_0x6dc8('0x36')][_0x6dc8('0x37')]};});_0x5d9cb9[_0x6dc8('0x38')]=_[_0x6dc8('0x32')](_0x29cc5d,_0x6dc8('0x30'));_0x5d9cb9[_0x6dc8('0x39')]=_[_0x6dc8('0x3a')](_0x3b21c0[_0x6dc8('0x39')]);_0x5d9cb9[_0x6dc8('0x3b')]=_[_0x6dc8('0x3c')](_0x5d9cb9[_0x6dc8('0x38')],_0x5d9cb9[_0x6dc8('0x39')]);_0x6dfeda['attributes']=_['intersection'](_0x5d9cb9[_0x6dc8('0x38')],qs[_0x6dc8('0x3d')](_0x3b21c0['query']['fields']));_0x6dfeda['attributes']=_0x6dfeda[_0x6dc8('0x3e')][_0x6dc8('0x3f')]?_0x6dfeda[_0x6dc8('0x3e')]:_0x5d9cb9['model'];if(!_0x3b21c0[_0x6dc8('0x39')]['hasOwnProperty'](_0x6dc8('0x40'))){_0x6dfeda['limit']=qs[_0x6dc8('0x24')](_0x3b21c0[_0x6dc8('0x39')][_0x6dc8('0x24')]);_0x6dfeda[_0x6dc8('0x22')]=qs['offset'](_0x3b21c0[_0x6dc8('0x39')][_0x6dc8('0x22')]);}_0x6dfeda[_0x6dc8('0x41')]=qs[_0x6dc8('0x42')](_0x3b21c0[_0x6dc8('0x39')]['sort']);_0x6dfeda[_0x6dc8('0x43')]=qs['filters'](_['pick'](_0x3b21c0['query'],_0x5d9cb9[_0x6dc8('0x3b')]),_0x29cc5d);if(_0x3b21c0[_0x6dc8('0x39')]['filter']){_0x6dfeda['where']=_[_0x6dc8('0x44')](_0x6dfeda['where'],{'$or':_[_0x6dc8('0x32')](_0x29cc5d,function(_0x212859){if(_0x212859[_0x6dc8('0x36')]!==_0x6dc8('0x45')){var _0x2eeb9f={};_0x2eeb9f[_0x212859['name']]={'$like':'%'+_0x3b21c0[_0x6dc8('0x39')][_0x6dc8('0x46')]+'%'};return _0x2eeb9f;}})});}_0x6dfeda=_['merge']({},_0x6dfeda,_0x3b21c0[_0x6dc8('0x47')]);var _0x39105c={'where':_0x6dfeda['where']};return db[_0x6dc8('0x33')]['count'](_0x39105c)[_0x6dc8('0x2c')](function(_0x46d6a6){_0x468c57[_0x6dc8('0x25')]=_0x46d6a6;if(_0x3b21c0[_0x6dc8('0x39')]['includeAll']){_0x6dfeda[_0x6dc8('0x48')]=[{'all':!![]}];}return db[_0x6dc8('0x33')][_0x6dc8('0x49')](_0x6dfeda);})['then'](function(_0x57a03f){_0x468c57[_0x6dc8('0x4a')]=_0x57a03f;return _0x468c57;})[_0x6dc8('0x2c')](respondWithFilteredResult(_0x45fb7f,_0x6dfeda))[_0x6dc8('0x4b')](handleError(_0x45fb7f,null));};exports['show']=function(_0xa695dc,_0x126bc8){var _0x451440={'raw':![],'where':{'id':_0xa695dc[_0x6dc8('0x4c')]['id']}},_0x196559={};_0x196559[_0x6dc8('0x38')]=_[_0x6dc8('0x3a')](db[_0x6dc8('0x33')][_0x6dc8('0x34')]);_0x196559[_0x6dc8('0x39')]=_[_0x6dc8('0x3a')](_0xa695dc[_0x6dc8('0x39')]);_0x196559[_0x6dc8('0x3b')]=_[_0x6dc8('0x3c')](_0x196559[_0x6dc8('0x38')],_0x196559[_0x6dc8('0x39')]);_0x451440[_0x6dc8('0x3e')]=_['intersection'](_0x196559[_0x6dc8('0x38')],qs[_0x6dc8('0x3d')](_0xa695dc['query']['fields']));_0x451440['attributes']=_0x451440[_0x6dc8('0x3e')]['length']?_0x451440[_0x6dc8('0x3e')]:_0x196559[_0x6dc8('0x38')];if(_0xa695dc[_0x6dc8('0x39')][_0x6dc8('0x4d')]){_0x451440[_0x6dc8('0x48')]=[{'all':!![]}];}_0x451440=_['merge']({},_0x451440,_0xa695dc[_0x6dc8('0x47')]);return db['Team'][_0x6dc8('0x4e')](_0x451440)[_0x6dc8('0x2c')](handleEntityNotFound(_0x126bc8,null))[_0x6dc8('0x2c')](respondWithResult(_0x126bc8,null))[_0x6dc8('0x4b')](handleError(_0x126bc8,null));};exports[_0x6dc8('0x4f')]=function(_0x14fa39,_0xb7daf5){return db[_0x6dc8('0x33')][_0x6dc8('0x4f')](_0x14fa39['body'],{})['then'](function(_0x3aac02){var _0x20a4de=_0x14fa39[_0x6dc8('0x50')][_0x6dc8('0x51')]({'plain':!![]});if(!_0x20a4de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20a4de[_0x6dc8('0x52')]===_0x6dc8('0x50')){var _0x5cea1c=_0x3aac02['get']({'plain':!![]});var _0x101e22=_0x6dc8('0x53');return db[_0x6dc8('0x54')][_0x6dc8('0x4e')]({'where':{'name':_0x101e22,'userProfileId':_0x20a4de[_0x6dc8('0x55')]},'raw':!![]})['then'](function(_0x2d8726){if(_0x2d8726&&_0x2d8726['autoAssociation']===0x0){return db[_0x6dc8('0x56')][_0x6dc8('0x4f')]({'name':_0x5cea1c['name'],'resourceId':_0x5cea1c['id'],'type':_0x2d8726['name'],'sectionId':_0x2d8726['id']},{})[_0x6dc8('0x2c')](function(){return _0x3aac02;});}else{return _0x3aac02;}})['catch'](function(_0x3ee5ad){logger['error'](_0x6dc8('0x57'),_0x3ee5ad);throw _0x3ee5ad;});}return _0x3aac02;})['then'](respondWithResult(_0xb7daf5,0xc9))[_0x6dc8('0x4b')](handleError(_0xb7daf5,null));};exports['update']=function(_0x2c2fbd,_0x1ff7f8){if(_0x2c2fbd[_0x6dc8('0x58')]['id']){delete _0x2c2fbd['body']['id'];}return db[_0x6dc8('0x33')]['find']({'where':{'id':_0x2c2fbd[_0x6dc8('0x4c')]['id']}})[_0x6dc8('0x2c')](handleEntityNotFound(_0x1ff7f8,null))[_0x6dc8('0x2c')](saveUpdates(_0x2c2fbd[_0x6dc8('0x58')],null))[_0x6dc8('0x2c')](respondWithResult(_0x1ff7f8,null))[_0x6dc8('0x4b')](handleError(_0x1ff7f8,null));};exports[_0x6dc8('0x59')]=function(_0x5421e6,_0x3b5137){var _0x2befa9=_0x5421e6[_0x6dc8('0x4c')]['id'];var _0x44e044=[];return db[_0x6dc8('0x5a')]['transaction'](function(_0x3ec882){var _0x44d6fb=_0x6dc8('0x5b')+_0x2befa9;return db[_0x6dc8('0x5a')][_0x6dc8('0x39')](_0x44d6fb,{'type':db[_0x6dc8('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3ec882})[_0x6dc8('0x2c')](function(_0x12c446){_0x44e044=_['map'](_0x12c446,function(_0x5601ff){return Number(_0x5601ff[_0x6dc8('0x5d')]);});})[_0x6dc8('0x2c')](function(){var _0x5f0c93='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2befa9;return db[_0x6dc8('0x5a')][_0x6dc8('0x39')](_0x5f0c93,{'type':db['Sequelize'][_0x6dc8('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x1c505b){var _0x21b8dc=_[_0x6dc8('0x32')](_0x1c505b,function(_0x1fc33b){return Number(_0x1fc33b['VoiceQueueId']);});return db['UserVoiceQueue'][_0x6dc8('0x59')]({'where':{'UserId':{'$in':_0x44e044},'VoiceQueueId':{'$in':_0x21b8dc}},'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(){var _0x364699=_0x6dc8('0x5f')+_0x2befa9;return db['sequelize'][_0x6dc8('0x39')](_0x364699,{'type':db['Sequelize'][_0x6dc8('0x5e')][_0x6dc8('0x60')],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x99bb85){var _0x4c20c0=_[_0x6dc8('0x32')](_0x99bb85,function(_0xe67dc3){return Number(_0xe67dc3[_0x6dc8('0x61')]);});return db[_0x6dc8('0x62')]['destroy']({'where':{'UserId':{'$in':_0x44e044},'MailQueueId':{'$in':_0x4c20c0}},'transaction':_0x3ec882});})['then'](function(){var _0x4386b9=_0x6dc8('0x63')+_0x2befa9;return db[_0x6dc8('0x5a')][_0x6dc8('0x39')](_0x4386b9,{'type':db['Sequelize'][_0x6dc8('0x5e')][_0x6dc8('0x60')],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x2c8282){var _0x472ebe=_[_0x6dc8('0x32')](_0x2c8282,function(_0x2b61cb){return Number(_0x2b61cb['SmsQueueId']);});return db[_0x6dc8('0x64')]['destroy']({'where':{'UserId':{'$in':_0x44e044},'SmsQueueId':{'$in':_0x472ebe}},'transaction':_0x3ec882});})['then'](function(){var _0x42bd26=_0x6dc8('0x65')+_0x2befa9;return db[_0x6dc8('0x5a')][_0x6dc8('0x39')](_0x42bd26,{'type':db[_0x6dc8('0x5c')][_0x6dc8('0x5e')][_0x6dc8('0x60')],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x501ee8){var _0x1cfb4d=_[_0x6dc8('0x32')](_0x501ee8,function(_0x21fe2c){return Number(_0x21fe2c[_0x6dc8('0x66')]);});return db[_0x6dc8('0x67')][_0x6dc8('0x59')]({'where':{'UserId':{'$in':_0x44e044},'ChatQueueId':{'$in':_0x1cfb4d}},'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(){var _0x2a747a=_0x6dc8('0x68')+_0x2befa9;return db[_0x6dc8('0x5a')][_0x6dc8('0x39')](_0x2a747a,{'type':db[_0x6dc8('0x5c')]['QueryTypes'][_0x6dc8('0x60')],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x3b062a){var _0x2e1a5a=_[_0x6dc8('0x32')](_0x3b062a,function(_0x2e949e){return Number(_0x2e949e[_0x6dc8('0x69')]);});return db['UserFaxQueue'][_0x6dc8('0x59')]({'where':{'UserId':{'$in':_0x44e044},'FaxQueueId':{'$in':_0x2e1a5a}},'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(){var _0x36b07e=_0x6dc8('0x6a')+_0x2befa9;return db[_0x6dc8('0x5a')][_0x6dc8('0x39')](_0x36b07e,{'type':db[_0x6dc8('0x5c')][_0x6dc8('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0xa5668f){var _0xa0d4cc=_[_0x6dc8('0x32')](_0xa5668f,function(_0x18e94f){return Number(_0x18e94f['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x6dc8('0x59')]({'where':{'UserId':{'$in':_0x44e044},'OpenchannelQueueId':{'$in':_0xa0d4cc}},'transaction':_0x3ec882});})['then'](function(){var _0x165db8='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2befa9;return db['sequelize']['query'](_0x165db8,{'type':db['Sequelize'][_0x6dc8('0x5e')][_0x6dc8('0x60')],'raw':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x36c85c){var _0x52a2b9=_[_0x6dc8('0x32')](_0x36c85c,function(_0x447ee4){return Number(_0x447ee4[_0x6dc8('0x6b')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x44e044},'WhatsappQueueId':{'$in':_0x52a2b9}},'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(){return db[_0x6dc8('0x6c')][_0x6dc8('0x4e')]({'where':{'TeamId':_0x2befa9}});})[_0x6dc8('0x2c')](function(_0x3360e1){if(_0x3360e1===null){return;}return db[_0x6dc8('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x44e044},'VoicePrefixId':_0x3360e1[_0x6dc8('0x6e')]},'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(){return db[_0x6dc8('0x33')][_0x6dc8('0x59')]({'where':{'id':_0x2befa9},'cascade':!![],'transaction':_0x3ec882});})[_0x6dc8('0x2c')](function(_0x2d94ea){if(_0x2d94ea===0x0){_0x3b5137[_0x6dc8('0x2d')](0x194);}else{return db[_0x6dc8('0x56')][_0x6dc8('0x59')]({'where':{'type':'Teams','resourceId':_0x2befa9},'cascade':!![],'transaction':_0x3ec882})['then'](function(){_0x3b5137[_0x6dc8('0x1f')](0xcc)['end']();});}})[_0x6dc8('0x4b')](function(_0x23eb8f){_0x3b5137[_0x6dc8('0x1f')](0x1f4)[_0x6dc8('0x31')](_0x23eb8f);});});};exports[_0x6dc8('0x6f')]=function(_0x5e2953,_0x97bc04,_0x35af34){return db[_0x6dc8('0x33')]['findOne']({'where':{'id':_0x5e2953[_0x6dc8('0x4c')]['id']}})[_0x6dc8('0x2c')](handleEntityNotFound(_0x97bc04,null))[_0x6dc8('0x2c')](function(_0x50ca14){if(!_0x5e2953['query'][_0x6dc8('0x70')]||!utils[_0x6dc8('0x71')](_0x5e2953[_0x6dc8('0x39')][_0x6dc8('0x70')])){throw new db['Sequelize'][(_0x6dc8('0x72'))](_0x6dc8('0x73'));}var _0x3691dd={};var _0x140939={};_0x140939[_0x6dc8('0x38')]=_[_0x6dc8('0x3a')](db[_[_0x6dc8('0x74')](_0x5e2953['query']['channel'][_0x6dc8('0x75')]())+_0x6dc8('0x76')]['rawAttributes']);_0x140939['query']=_[_0x6dc8('0x3a')](_0x5e2953['query']);_0x140939[_0x6dc8('0x3b')]=_[_0x6dc8('0x3c')](_0x140939[_0x6dc8('0x38')],_0x140939['query']);_0x3691dd[_0x6dc8('0x3e')]=_[_0x6dc8('0x3c')](_0x140939[_0x6dc8('0x38')],qs[_0x6dc8('0x3d')](_0x5e2953[_0x6dc8('0x39')][_0x6dc8('0x3d')]));_0x3691dd[_0x6dc8('0x3e')]=_0x3691dd[_0x6dc8('0x3e')][_0x6dc8('0x3f')]?_0x3691dd[_0x6dc8('0x3e')]:_0x140939['model'];_0x3691dd[_0x6dc8('0x24')]=qs[_0x6dc8('0x24')](_0x5e2953['query'][_0x6dc8('0x24')]);_0x3691dd[_0x6dc8('0x22')]=qs[_0x6dc8('0x22')](_0x5e2953[_0x6dc8('0x39')]['offset']);_0x3691dd[_0x6dc8('0x41')]=qs['sort'](_0x5e2953['query']['sort']);_0x3691dd[_0x6dc8('0x43')]=qs['filters'](_[_0x6dc8('0x77')](_0x5e2953[_0x6dc8('0x39')],_0x140939[_0x6dc8('0x3b')]));_0x3691dd=_[_0x6dc8('0x44')]({},_0x3691dd,_0x5e2953[_0x6dc8('0x47')]);return _0x50ca14[_0x6dc8('0x51')+_['capitalize'](_0x5e2953[_0x6dc8('0x39')][_0x6dc8('0x70')][_0x6dc8('0x75')]())+_0x6dc8('0x78')](_0x3691dd);})[_0x6dc8('0x2c')](respondWithResult(_0x97bc04,null))['catch'](handleError(_0x97bc04,null));};exports[_0x6dc8('0x79')]=function(_0x1f18fc,_0x25a5da,_0x5b10b9){return db['Team'][_0x6dc8('0x7a')]({'where':{'id':_0x1f18fc[_0x6dc8('0x4c')]['id']}})['then'](function(_0x52a239){if(_0x52a239){if(!_0x1f18fc[_0x6dc8('0x58')][_0x6dc8('0x70')]||!utils['isValidChannel'](_0x1f18fc[_0x6dc8('0x58')][_0x6dc8('0x70')])){throw new db[(_0x6dc8('0x5c'))][(_0x6dc8('0x72'))]('Unknown\x20channel');}return _0x52a239[_0x6dc8('0x7b')+_[_0x6dc8('0x74')](_0x1f18fc[_0x6dc8('0x58')][_0x6dc8('0x70')][_0x6dc8('0x75')]())+_0x6dc8('0x78')](_0x1f18fc[_0x6dc8('0x58')][_0x6dc8('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x25a5da,null))[_0x6dc8('0x2c')](respondWithStatusCode(_0x25a5da,null))[_0x6dc8('0x4b')](handleError(_0x25a5da,null));};exports[_0x6dc8('0x7d')]=function(_0x27bf1c,_0x1ba201,_0x3cc571){return db[_0x6dc8('0x33')][_0x6dc8('0x7a')]({'where':{'id':_0x27bf1c[_0x6dc8('0x4c')]['id']}})['then'](function(_0x1d072d){if(_0x1d072d){if(!_0x27bf1c[_0x6dc8('0x39')][_0x6dc8('0x70')]||!utils[_0x6dc8('0x71')](_0x27bf1c[_0x6dc8('0x39')]['channel'])){throw new db[(_0x6dc8('0x5c'))][(_0x6dc8('0x72'))](_0x6dc8('0x73'));}return _0x1d072d['remove'+_[_0x6dc8('0x74')](_0x27bf1c[_0x6dc8('0x39')][_0x6dc8('0x70')]['toLowerCase']())+_0x6dc8('0x78')](_0x27bf1c[_0x6dc8('0x39')][_0x6dc8('0x7c')]);}return null;})[_0x6dc8('0x2c')](handleEntityNotFound(_0x1ba201,null))[_0x6dc8('0x2c')](respondWithStatusCode(_0x1ba201,null))['catch'](handleError(_0x1ba201,null));};exports[_0x6dc8('0x7e')]=function(_0x2990d5,_0x3e9c15){var _0xd490da=_[_0x6dc8('0x7f')](_0x2990d5[_0x6dc8('0x58')][_0x6dc8('0x7c')])?_0x2990d5[_0x6dc8('0x58')]['ids']:[_0x2990d5['body'][_0x6dc8('0x7c')]];var _0x5d2210=_0x2990d5['params']['id'];return db[_0x6dc8('0x33')][_0x6dc8('0x4e')]({'where':{'id':_0x5d2210}})[_0x6dc8('0x2c')](handleEntityNotFound(_0x3e9c15,null))[_0x6dc8('0x2c')](function(_0x5c1595){if(_0x5c1595){var _0x4f7ca0=[_0x6dc8('0x80'),_0x6dc8('0x81'),_0x6dc8('0x82'),_0x6dc8('0x83'),_0x6dc8('0x84'),_0x6dc8('0x85'),'Whatsapp'];return db[_0x6dc8('0x5a')][_0x6dc8('0x86')](function(_0x5432b3){var _0x47c927=_[_0x6dc8('0x32')](_0x4f7ca0,function(_0x2e957b){var _0x1a51ec={'attributes':['id',_0x6dc8('0x30')]};if(_0x2e957b===_0x6dc8('0x80')){_0x1a51ec[_0x6dc8('0x87')]={'attributes':[_0x6dc8('0x88')]};}return _0x5c1595[_0x6dc8('0x51')+_0x2e957b+_0x6dc8('0x78')](_0x1a51ec)['then'](function(_0x4062d3){var _0x26c0c7=_[_0x6dc8('0x32')](_0x4062d3,function(_0x3de0d1){var _0x47130b=_[_0x6dc8('0x32')](_0xd490da,function(_0x4107ec){var _0x49d503={'where':{'UserId':_0x4107ec,[_0x2e957b+'QueueId']:_0x3de0d1['id']},'transaction':_0x5432b3};if(_0x2e957b===_0x6dc8('0x80')){_0x49d503[_0x6dc8('0x89')]={'penalty':_0x3de0d1[_0x6dc8('0x8a')][_0x6dc8('0x88')]};}return db[_0x6dc8('0x8b')+_0x2e957b+'Queue'][_0x6dc8('0x8c')](_0x49d503)[_0x6dc8('0x2c')](function(){socket['emit']('user'+_0x2e957b+_0x6dc8('0x8d'),{'UserId':_0x4107ec,[_0x2e957b+'QueueId']:_0x3de0d1['id']});if(_0x2e957b!==_0x6dc8('0x80')){return;}return db['User'][_0x6dc8('0x49')]({'where':{'id':_0xd490da,'online':0x1},'attributes':['id','name',_0x6dc8('0x8e'),_0x6dc8('0x8f'),'interface'],'raw':!![]})[_0x6dc8('0x2c')](function(_0x300b85){var _0x4b886c=_[_0x6dc8('0x32')](_0x300b85,function(_0x5f0f8c){return db['UserVoiceQueueRt'][_0x6dc8('0x90')]({'membername':_0x5f0f8c[_0x6dc8('0x30')],'UserId':_0x5f0f8c['id'],'queue_name':_0x3de0d1['name'],'VoiceQueueId':_0x3de0d1['id'],'interface':_[_0x6dc8('0x91')](_0x5f0f8c[_0x6dc8('0x92')])?util[_0x6dc8('0x93')]('SIP/%s',_0x5f0f8c[_0x6dc8('0x30')]):_0x5f0f8c[_0x6dc8('0x92')],'paused':_0x5f0f8c['voicePause']||![],'penalty':_0x3de0d1[_0x6dc8('0x8a')][_0x6dc8('0x88')]},{'transaction':_0x5432b3});});return Promise[_0x6dc8('0x94')](_0x4b886c);});});});return Promise[_0x6dc8('0x94')](_0x47130b);});return Promise[_0x6dc8('0x94')](_0x26c0c7);})[_0x6dc8('0x2c')](function(){return db['TeamVoicePrefix'][_0x6dc8('0x7a')]({'where':{'teamId':_0x5d2210}})['then'](function(_0x1f3237){if(_0x1f3237){var _0x1a1428=_[_0x6dc8('0x32')](_0xd490da,function(_0x23ed66){db[_0x6dc8('0x6d')][_0x6dc8('0x90')]({'UserId':_0x23ed66,'VoicePrefixId':_0x1f3237[_0x6dc8('0x6e')]});});return Promise['all'](_0x1a1428);}});});});return Promise['all'](_0x47c927)[_0x6dc8('0x2c')](function(){return _0x5c1595[_0x6dc8('0x7e')](_0xd490da,{'transaction':_0x5432b3})[_0x6dc8('0x95')](function(_0x45de5c){return _0x45de5c;});});});}})[_0x6dc8('0x2c')](respondWithResult(_0x3e9c15,null))[_0x6dc8('0x4b')](handleError(_0x3e9c15,null));};exports[_0x6dc8('0x96')]=function(_0x5d4735,_0x2ba65b){var _0x5973a2=_[_0x6dc8('0x7f')](_0x5d4735[_0x6dc8('0x39')][_0x6dc8('0x7c')])?_0x5d4735[_0x6dc8('0x39')][_0x6dc8('0x7c')]:[_0x5d4735[_0x6dc8('0x39')][_0x6dc8('0x7c')]];var _0x27f4b9=_0x5d4735[_0x6dc8('0x4c')]['id'];return db[_0x6dc8('0x33')]['find']({'where':{'id':_0x27f4b9}})[_0x6dc8('0x2c')](handleEntityNotFound(_0x2ba65b,null))['then'](function(_0x5b2675){if(_0x5b2675){var _0x371c54=['Voice',_0x6dc8('0x81'),'Mail',_0x6dc8('0x83'),_0x6dc8('0x84'),_0x6dc8('0x85'),'Whatsapp'];return db[_0x6dc8('0x5a')][_0x6dc8('0x86')](function(_0x325d0a){var _0x100d32=_[_0x6dc8('0x32')](_0x371c54,function(_0x46955a){var _0x5cd5b4={'attributes':['id','name']};return _0x5b2675[_0x6dc8('0x51')+_0x46955a+_0x6dc8('0x78')](_0x5cd5b4)[_0x6dc8('0x2c')](function(_0x38e1e1){var _0x4f8c92=_['map'](_0x38e1e1,function(_0x16f476){return _0x16f476[_0x6dc8('0x96')](_0x5973a2,{'transaction':_0x325d0a})['then'](function(){var _0x4e1b9d=_[_0x6dc8('0x32')](_0x5973a2,function(_0x34d362){socket['emit'](_0x6dc8('0x50')+_0x46955a+_0x6dc8('0x97'),{'UserId':Number(_0x34d362),[_0x46955a+_0x6dc8('0x98')]:_0x16f476['id']});if(_0x46955a!==_0x6dc8('0x80')){return;}return db[_0x6dc8('0x99')][_0x6dc8('0x59')]({'where':{'VoiceQueueId':_0x16f476['id'],'UserId':_0x34d362},'transaction':_0x325d0a});});return Promise[_0x6dc8('0x94')](_0x4e1b9d);});});return Promise[_0x6dc8('0x94')](_0x4f8c92);});});return Promise[_0x6dc8('0x94')](_0x100d32)[_0x6dc8('0x2c')](function(){return _0x5b2675[_0x6dc8('0x96')](_0x5973a2,{'transaction':_0x325d0a});})[_0x6dc8('0x2c')](function(){return db[_0x6dc8('0x6c')][_0x6dc8('0x7a')]({'where':{'teamId':_0x27f4b9}})[_0x6dc8('0x2c')](function(_0x4d8019){if(_0x4d8019){var _0x4ac3f5=_[_0x6dc8('0x32')](_0x5973a2,function(_0x169392){db[_0x6dc8('0x6d')][_0x6dc8('0x59')]({'where':{'UserId':_0x169392,'VoicePrefixId':_0x4d8019['VoicePrefixId']}});});return Promise[_0x6dc8('0x94')](_0x4ac3f5);}});});});}})[_0x6dc8('0x2c')](respondWithStatusCode(_0x2ba65b,null))[_0x6dc8('0x4b')](handleError(_0x2ba65b,null));};exports[_0x6dc8('0x9a')]=function(_0x119115,_0x2365f3,_0x551ae0){var _0x1d1929={};var _0xb71b95={};var _0x2e07e5;var _0x330b50;return db['Team']['findOne']({'where':{'id':_0x119115['params']['id']}})[_0x6dc8('0x2c')](handleEntityNotFound(_0x2365f3,null))[_0x6dc8('0x2c')](function(_0x82b5ce){if(_0x82b5ce){_0x2e07e5=_0x82b5ce;_0xb71b95[_0x6dc8('0x38')]=_['keys'](db[_0x6dc8('0x8b')][_0x6dc8('0x34')]);_0xb71b95[_0x6dc8('0x39')]=_[_0x6dc8('0x3a')](_0x119115[_0x6dc8('0x39')]);_0xb71b95[_0x6dc8('0x3b')]=_[_0x6dc8('0x3c')](_0xb71b95['model'],_0xb71b95[_0x6dc8('0x39')]);_0x1d1929['attributes']=_['intersection'](_0xb71b95[_0x6dc8('0x38')],qs['fields'](_0x119115[_0x6dc8('0x39')][_0x6dc8('0x3d')]));_0x1d1929[_0x6dc8('0x3e')]=_0x1d1929['attributes'][_0x6dc8('0x3f')]?_0x1d1929[_0x6dc8('0x3e')]:_0xb71b95[_0x6dc8('0x38')];_0x1d1929[_0x6dc8('0x41')]=qs[_0x6dc8('0x42')](_0x119115[_0x6dc8('0x39')][_0x6dc8('0x42')]);_0x1d1929['where']=qs[_0x6dc8('0x3b')](_['pick'](_0x119115['query'],_0xb71b95[_0x6dc8('0x3b')]));if(_0x119115[_0x6dc8('0x39')][_0x6dc8('0x46')]){_0x1d1929[_0x6dc8('0x43')]=_['merge'](_0x1d1929[_0x6dc8('0x43')],{'$or':_[_0x6dc8('0x32')](_0x1d1929['attributes'],function(_0x1f49cc){var _0x31d33e={};_0x31d33e[_0x1f49cc]={'$like':'%'+_0x119115[_0x6dc8('0x39')][_0x6dc8('0x46')]+'%'};return _0x31d33e;})});}_0x1d1929=_['merge']({},_0x1d1929,_0x119115[_0x6dc8('0x47')]);return _0x2e07e5[_0x6dc8('0x9a')](_0x1d1929);}})[_0x6dc8('0x2c')](function(_0x236f76){if(_0x236f76){_0x330b50=_0x236f76[_0x6dc8('0x3f')];if(!_0x119115[_0x6dc8('0x39')][_0x6dc8('0x9b')]('nolimit')){_0x1d1929['limit']=qs[_0x6dc8('0x24')](_0x119115['query'][_0x6dc8('0x24')]);_0x1d1929[_0x6dc8('0x22')]=qs['offset'](_0x119115[_0x6dc8('0x39')][_0x6dc8('0x22')]);}return _0x2e07e5[_0x6dc8('0x9a')](_0x1d1929);}})[_0x6dc8('0x2c')](function(_0x2af597){if(_0x2af597){return _0x2af597?{'count':_0x330b50,'rows':_0x2af597}:null;}})[_0x6dc8('0x2c')](respondWithResult(_0x2365f3,null))['catch'](handleError(_0x2365f3,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c432ba0..8f05932 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 _0x7270=['hook','events','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x595581,_0x350e03){var _0x1a57d0=function(_0x35d6e0){while(--_0x35d6e0){_0x595581['push'](_0x595581['shift']());}};_0x1a57d0(++_0x350e03);}(_0x7270,0xb5));var _0x0727=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x7270[_0x19dd7a];return _0x3feb6a;};'use strict';var EventEmitter=require(_0x0727('0x0'));var Team=require(_0x0727('0x1'))['db'][_0x0727('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0727('0x3')](0x0);var events={'afterCreate':_0x0727('0x4'),'afterUpdate':'update','afterDestroy':_0x0727('0x5')};function emitEvent(_0x2ce81d){return function(_0x3d42fa,_0x44c8a9,_0x4c0a33){TeamEvents[_0x0727('0x6')](_0x2ce81d+':'+_0x3d42fa['id'],_0x3d42fa);TeamEvents[_0x0727('0x6')](_0x2ce81d,_0x3d42fa);_0x4c0a33(null);};}for(var e in events){if(events[_0x0727('0x7')](e)){var event=events[e];Team[_0x0727('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xfd27=['hook','exports','events','../../mysqldb','Team','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x237849,_0x2a106f){var _0x257e3e=function(_0x5d415e){while(--_0x5d415e){_0x237849['push'](_0x237849['shift']());}};_0x257e3e(++_0x2a106f);}(_0xfd27,0x84));var _0x7fd2=function(_0x15e5b2,_0x45ff39){_0x15e5b2=_0x15e5b2-0x0;var _0x764f50=_0xfd27[_0x15e5b2];return _0x764f50;};'use strict';var EventEmitter=require(_0x7fd2('0x0'));var Team=require(_0x7fd2('0x1'))['db'][_0x7fd2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x7fd2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7fd2('0x4'),'afterDestroy':_0x7fd2('0x5')};function emitEvent(_0xd139c0){return function(_0x3efdaa,_0x40a66d,_0x3dcb2e){TeamEvents[_0x7fd2('0x6')](_0xd139c0+':'+_0x3efdaa['id'],_0x3efdaa);TeamEvents['emit'](_0xd139c0,_0x3efdaa);_0x3dcb2e(null);};}for(var e in events){if(events[_0x7fd2('0x7')](e)){var event=events[e];Team[_0x7fd2('0x8')](e,emitEvent(event));}}module[_0x7fd2('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 3e4baef..5ad3a13 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 _0x82bd=['Voice','Whatsapp','resolve','all','lodash','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team','teams','Fax','Mail','Openchannel','Sms'];(function(_0x1dc3eb,_0x2106a5){var _0x3ed430=function(_0x43fa70){while(--_0x43fa70){_0x1dc3eb['push'](_0x1dc3eb['shift']());}};_0x3ed430(++_0x2106a5);}(_0x82bd,0x108));var _0xd82b=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x82bd[_0x452968];return _0xb6f9ae;};'use strict';var _=require(_0xd82b('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x307976,_0x1cc3c5){var _0x512b40=_0xd82b('0x1')+_0x1cc3c5+_0xd82b('0x2');return _0x307976[_0x512b40]()[_0xd82b('0x3')](function(_0x2c698e){return _[_0xd82b('0x4')](_0x2c698e,function(_0x36b5e){_0x36b5e[_0xd82b('0x5')](_0xd82b('0x6'),_0x1cc3c5);return _0x36b5e;});})[_0xd82b('0x7')](function(_0x1fa0ea){throw _0x1fa0ea;});}module[_0xd82b('0x8')]=function(_0x23edae){return _0x23edae[_0xd82b('0x9')](_0xd82b('0xa'),attributes,{'tableName':_0xd82b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x26a692=this;var _0x15d94f=['Chat',_0xd82b('0xc'),_0xd82b('0xd'),_0xd82b('0xe'),_0xd82b('0xf'),_0xd82b('0x10'),_0xd82b('0x11')];return Promise[_0xd82b('0x12')]()[_0xd82b('0x3')](function(){var _0x5b132f=_[_0xd82b('0x4')](_0x15d94f,function(_0x230a26){return getQueuesByChannel(_0x26a692,_0x230a26);});return Promise[_0xd82b('0x13')](_0x5b132f);})['catch'](function(_0x4986a6){throw _0x4986a6;});}}});}; \ No newline at end of file +var _0x2b9e=['Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','catch','lodash','map','setDataValue','channel','exports','define','teams'];(function(_0x59560f,_0x11f222){var _0x435293=function(_0x4a2794){while(--_0x4a2794){_0x59560f['push'](_0x59560f['shift']());}};_0x435293(++_0x11f222);}(_0x2b9e,0xf9));var _0xe2b9=function(_0x37a174,_0x1f3cbd){_0x37a174=_0x37a174-0x0;var _0x4f6328=_0x2b9e[_0x37a174];return _0x4f6328;};'use strict';var _=require(_0xe2b9('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x50b2a2,_0x5819f3){var _0x5aa773='get'+_0x5819f3+'Queues';return _0x50b2a2[_0x5aa773]()['then'](function(_0x5c9178){return _[_0xe2b9('0x1')](_0x5c9178,function(_0x5098c6){_0x5098c6[_0xe2b9('0x2')](_0xe2b9('0x3'),_0x5819f3);return _0x5098c6;});})['catch'](function(_0x1ed22e){throw _0x1ed22e;});}module[_0xe2b9('0x4')]=function(_0x3408c1){return _0x3408c1[_0xe2b9('0x5')]('Team',attributes,{'tableName':_0xe2b9('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5e0b04=this;var _0xca90e0=[_0xe2b9('0x7'),_0xe2b9('0x8'),_0xe2b9('0x9'),_0xe2b9('0xa'),_0xe2b9('0xb'),_0xe2b9('0xc'),'Whatsapp'];return Promise[_0xe2b9('0xd')]()['then'](function(){var _0xbbb0a8=_[_0xe2b9('0x1')](_0xca90e0,function(_0x5b320b){return getQueuesByChannel(_0x5e0b04,_0x5b320b);});return Promise[_0xe2b9('0xe')](_0xbbb0a8);})[_0xe2b9('0xf')](function(_0x197350){throw _0x197350;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 265e295..ffd3e82 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 _0x4aa3=['socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4aa3,0x185));var _0x34aa=function(_0x4e4c7d,_0x552f7a){_0x4e4c7d=_0x4e4c7d-0x0;var _0x19488d=_0x4aa3[_0x4e4c7d];return _0x19488d;};'use strict';var _=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var moment=require(_0x34aa('0x2'));var BPromise=require(_0x34aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34aa('0x4'));var db=require(_0x34aa('0x5'))['db'];var utils=require(_0x34aa('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34aa('0x7'));var client=jayson[_0x34aa('0x8')][_0x34aa('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x34aa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34aa('0xb'))(new Redis(config[_0x34aa('0xa')]));require(_0x34aa('0xc'))['register'](socket);function respondWithRpcPromise(_0x5183fc,_0x457194,_0x158a6f){return new BPromise(function(_0x277e0d,_0xae910c){return client[_0x34aa('0xd')](_0x5183fc,_0x158a6f)[_0x34aa('0xe')](function(_0x2ea6bf){logger[_0x34aa('0xf')](_0x34aa('0x10'),_0x457194,_0x34aa('0x11'));logger[_0x34aa('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x457194,_0x34aa('0x11'),JSON[_0x34aa('0x13')](_0x2ea6bf));if(_0x2ea6bf[_0x34aa('0x14')]){if(_0x2ea6bf[_0x34aa('0x14')][_0x34aa('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x457194,_0x2ea6bf[_0x34aa('0x14')]['message']);return _0xae910c(_0x2ea6bf[_0x34aa('0x14')]['message']);}logger[_0x34aa('0x14')](_0x34aa('0x10'),_0x457194,_0x2ea6bf[_0x34aa('0x14')]['message']);return _0x277e0d(_0x2ea6bf[_0x34aa('0x14')][_0x34aa('0x16')]);}else{logger[_0x34aa('0xf')]('Team,\x20%s,\x20%s',_0x457194,_0x34aa('0x11'));_0x277e0d(_0x2ea6bf[_0x34aa('0x17')][_0x34aa('0x16')]);}})[_0x34aa('0x18')](function(_0x2db00c){logger[_0x34aa('0x14')](_0x34aa('0x10'),_0x457194,_0x2db00c);_0xae910c(_0x2db00c);});});} \ No newline at end of file +var _0x7d0e=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','catch'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x7d0e,0xc8));var _0xe7d0=function(_0x47177d,_0x5b11ff){_0x47177d=_0x47177d-0x0;var _0x402995=_0x7d0e[_0x47177d];return _0x402995;};'use strict';var _=require(_0xe7d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe7d0('0x1'));var rs=require(_0xe7d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7d0('0x3'))['db'];var utils=require(_0xe7d0('0x4'));var logger=require(_0xe7d0('0x5'))(_0xe7d0('0x6'));var config=require(_0xe7d0('0x7'));var jayson=require(_0xe7d0('0x8'));var client=jayson['client'][_0xe7d0('0x9')]({'port':0x232a});config['redis']=_[_0xe7d0('0xa')](config['redis'],{'host':_0xe7d0('0xb'),'port':0x18eb});var socket=require(_0xe7d0('0xc'))(new Redis(config['redis']));require('./team.socket')[_0xe7d0('0xd')](socket);function respondWithRpcPromise(_0x260757,_0x5f2ff9,_0x4649f5){return new BPromise(function(_0x30253f,_0x39eeb1){return client[_0xe7d0('0xe')](_0x260757,_0x4649f5)[_0xe7d0('0xf')](function(_0x542e22){logger[_0xe7d0('0x10')]('Team,\x20%s,\x20%s',_0x5f2ff9,_0xe7d0('0x11'));logger[_0xe7d0('0x12')](_0xe7d0('0x13'),_0x5f2ff9,_0xe7d0('0x11'),JSON['stringify'](_0x542e22));if(_0x542e22[_0xe7d0('0x14')]){if(_0x542e22[_0xe7d0('0x14')][_0xe7d0('0x15')]===0x1f4){logger[_0xe7d0('0x14')](_0xe7d0('0x16'),_0x5f2ff9,_0x542e22[_0xe7d0('0x14')][_0xe7d0('0x17')]);return _0x39eeb1(_0x542e22[_0xe7d0('0x14')][_0xe7d0('0x17')]);}logger[_0xe7d0('0x14')](_0xe7d0('0x16'),_0x5f2ff9,_0x542e22[_0xe7d0('0x14')][_0xe7d0('0x17')]);return _0x30253f(_0x542e22[_0xe7d0('0x14')]['message']);}else{logger[_0xe7d0('0x10')](_0xe7d0('0x16'),_0x5f2ff9,_0xe7d0('0x11'));_0x30253f(_0x542e22['result']['message']);}})[_0xe7d0('0x18')](function(_0x1d8838){logger[_0xe7d0('0x14')]('Team,\x20%s,\x20%s',_0x5f2ff9,_0x1d8838);_0x39eeb1(_0x1d8838);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8e7f636..0c21df6 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 _0xa4ec=['update','removeListener','register','./team.events','remove'];(function(_0x3bafe6,_0x3432b7){var _0x30bc43=function(_0x1e8389){while(--_0x1e8389){_0x3bafe6['push'](_0x3bafe6['shift']());}};_0x30bc43(++_0x3432b7);}(_0xa4ec,0x193));var _0xca4e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa4ec[_0x4bfac3];return _0x15f0f2;};'use strict';var TeamEvents=require(_0xca4e('0x0'));var events=['save',_0xca4e('0x1'),_0xca4e('0x2')];function createListener(_0x458ecd,_0x2b6fc1){return function(_0x247d55){_0x2b6fc1['emit'](_0x458ecd,_0x247d55);};}function removeListener(_0x53e88e,_0xbaccbf){return function(){TeamEvents[_0xca4e('0x3')](_0x53e88e,_0xbaccbf);};}exports[_0xca4e('0x4')]=function(_0x5887c7){for(var _0x38a60c=0x0,_0x51e53b=events['length'];_0x38a60c<_0x51e53b;_0x38a60c++){var _0x3ed096=events[_0x38a60c];var _0x2cf874=createListener('team:'+_0x3ed096,_0x5887c7);TeamEvents['on'](_0x3ed096,_0x2cf874);}}; \ No newline at end of file +var _0xfa91=['team:','save','update','emit','register','length'];(function(_0xb1b08c,_0x1961a6){var _0x608518=function(_0x405997){while(--_0x405997){_0xb1b08c['push'](_0xb1b08c['shift']());}};_0x608518(++_0x1961a6);}(_0xfa91,0x11b));var _0x1fa9=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xfa91[_0xd0b415];return _0x2bdf2c;};'use strict';var TeamEvents=require('./team.events');var events=[_0x1fa9('0x0'),'remove',_0x1fa9('0x1')];function createListener(_0x542b29,_0x25a850){return function(_0x25877f){_0x25a850[_0x1fa9('0x2')](_0x542b29,_0x25877f);};}function removeListener(_0x4a65c9,_0xc2cd7e){return function(){TeamEvents['removeListener'](_0x4a65c9,_0xc2cd7e);};}exports[_0x1fa9('0x3')]=function(_0xe45dcf){for(var _0x3434d7=0x0,_0x1ff290=events[_0x1fa9('0x4')];_0x3434d7<_0x1ff290;_0x3434d7++){var _0x4f4c71=events[_0x3434d7];var _0x36c070=createListener(_0x1fa9('0x5')+_0x4f4c71,_0xe45dcf);TeamEvents['on'](_0x4f4c71,_0x36c070);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4f74790..0d938bf 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 _0x5044=['exports','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5044,0xc8));var _0x4504=function(_0x57e1ab,_0x4d8553){_0x57e1ab=_0x57e1ab-0x0;var _0x5bde0e=_0x5044[_0x57e1ab];return _0x5bde0e;};'use strict';var Sequelize=require('sequelize');module[_0x4504('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4504('0x1')]}}; \ No newline at end of file +var _0x3526=['INTEGER','exports'];(function(_0x54feb3,_0x1a342d){var _0x479c1b=function(_0x6af747){while(--_0x6af747){_0x54feb3['push'](_0x54feb3['shift']());}};_0x479c1b(++_0x1a342d);}(_0x3526,0x1db));var _0x6352=function(_0x2867e5,_0x8c540c){_0x2867e5=_0x2867e5-0x0;var _0x12a39f=_0x3526[_0x2867e5];return _0x12a39f;};'use strict';var Sequelize=require('sequelize');module[_0x6352('0x0')]={'TeamId':{'type':Sequelize[_0x6352('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6352('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 6d59f3a..36677f4 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 _0x02f7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x02f7,0x1d3));var _0x702f=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x02f7[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var logger=require(_0x702f('0x2'))('api');var moment=require(_0x702f('0x3'));var BPromise=require(_0x702f('0x4'));var rp=require(_0x702f('0x5'));var fs=require('fs');var path=require(_0x702f('0x6'));var rimraf=require(_0x702f('0x7'));var config=require(_0x702f('0x8'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x449ba1,_0x4ff1d2){return _0x449ba1[_0x702f('0x9')](_0x702f('0xa'),attributes,{'tableName':_0x702f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c8a=['team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','define'];(function(_0x30fc17,_0x43b50f){var _0x38ec11=function(_0x2e5079){while(--_0x2e5079){_0x30fc17['push'](_0x30fc17['shift']());}};_0x38ec11(++_0x43b50f);}(_0x1c8a,0x140));var _0xa1c8=function(_0x528283,_0xf28f92){_0x528283=_0x528283-0x0;var _0x479fef=_0x1c8a[_0x528283];return _0x479fef;};'use strict';var _=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var logger=require(_0xa1c8('0x2'))(_0xa1c8('0x3'));var moment=require(_0xa1c8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c8('0x6'));var config=require(_0xa1c8('0x7'));var attributes=require(_0xa1c8('0x8'));module['exports']=function(_0x331282,_0x14b85c){return _0x331282[_0xa1c8('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0xa1c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d96af69..2c3cb28 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x179742,_0xf9f6f5){var _0x5cfd2e=function(_0x589a66){while(--_0x589a66){_0x179742['push'](_0x179742['shift']());}};_0x5cfd2e(++_0xf9f6f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xcb91[_0x257a28];return _0x13bccc;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1a3db4,_0x5b02bf){var _0x4b3eb5=function(_0x49f0ee){while(--_0x49f0ee){_0x1a3db4['push'](_0x1a3db4['shift']());}};_0x4b3eb5(++_0x5b02bf);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index fa16404..3f8dd88 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 _0x4509=['exports','INTEGER','sequelize'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x4509,0xd7));var _0x9450=function(_0x222a7f,_0x4a2e7c){_0x222a7f=_0x222a7f-0x0;var _0x4caf1e=_0x4509[_0x222a7f];return _0x4caf1e;};'use strict';var Sequelize=require(_0x9450('0x0'));module[_0x9450('0x1')]={'penalty':{'type':Sequelize[_0x9450('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb26=['sequelize','exports','INTEGER'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xcb26,0xf6));var _0x6cb2=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xcb26[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x6cb2('0x0'));module[_0x6cb2('0x1')]={'penalty':{'type':Sequelize[_0x6cb2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 9e9372b..4ffddf9 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 _0x4f88=['team_has_voice_queues','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue'];(function(_0x128106,_0x496835){var _0x18246f=function(_0x12ddf1){while(--_0x12ddf1){_0x128106['push'](_0x128106['shift']());}};_0x18246f(++_0x496835);}(_0x4f88,0xf3));var _0x84f8=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0x4f88[_0xf363f0];return _0x55a386;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require('../../config/logger')(_0x84f8('0x2'));var moment=require(_0x84f8('0x3'));var BPromise=require(_0x84f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x84f8('0x5'));var config=require(_0x84f8('0x6'));var attributes=require(_0x84f8('0x7'));module[_0x84f8('0x8')]=function(_0x79dcec,_0x1ac0c8){return _0x79dcec['define'](_0x84f8('0x9'),attributes,{'tableName':_0x84f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26cf=['../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','util'];(function(_0x337216,_0x4184e2){var _0x113fdb=function(_0x34e656){while(--_0x34e656){_0x337216['push'](_0x337216['shift']());}};_0x113fdb(++_0x4184e2);}(_0x26cf,0x135));var _0xf26c=function(_0x272608,_0x182cfa){_0x272608=_0x272608-0x0;var _0x4fd28a=_0x26cf[_0x272608];return _0x4fd28a;};'use strict';var _=require('lodash');var util=require(_0xf26c('0x0'));var logger=require(_0xf26c('0x1'))('api');var moment=require(_0xf26c('0x2'));var BPromise=require('bluebird');var rp=require(_0xf26c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf26c('0x4'));var config=require(_0xf26c('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0xf26c('0x6')]=function(_0x10638a,_0x32d4ef){return _0x10638a[_0xf26c('0x7')](_0xf26c('0x8'),attributes,{'tableName':_0xf26c('0x9'),'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 35cf753..27121be 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 _0x0194=['message','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x14438a,_0x53d627){var _0x1d16a5=function(_0xaae2bf){while(--_0xaae2bf){_0x14438a['push'](_0x14438a['shift']());}};_0x1d16a5(++_0x53d627);}(_0x0194,0xf1));var _0x4019=function(_0x56bb87,_0x294440){_0x56bb87=_0x56bb87-0x0;var _0xb7431c=_0x0194[_0x56bb87];return _0xb7431c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4019('0x0'));var BPromise=require(_0x4019('0x1'));var rs=require(_0x4019('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4019('0x3'))['db'];var utils=require(_0x4019('0x4'));var logger=require(_0x4019('0x5'))(_0x4019('0x6'));var config=require(_0x4019('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4019('0x8')][_0x4019('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b47b6,_0x45b6d8,_0x5c4015){return new BPromise(function(_0x173f77,_0x598c33){return client[_0x4019('0xa')](_0x3b47b6,_0x5c4015)[_0x4019('0xb')](function(_0x2e09be){logger[_0x4019('0xc')](_0x4019('0xd'),_0x45b6d8,'request\x20sent');logger['debug'](_0x4019('0xe'),_0x45b6d8,_0x4019('0xf'),JSON[_0x4019('0x10')](_0x2e09be));if(_0x2e09be['error']){if(_0x2e09be['error'][_0x4019('0x11')]===0x1f4){logger[_0x4019('0x12')](_0x4019('0xd'),_0x45b6d8,_0x2e09be['error'][_0x4019('0x13')]);return _0x598c33(_0x2e09be[_0x4019('0x12')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x45b6d8,_0x2e09be[_0x4019('0x12')][_0x4019('0x13')]);return _0x173f77(_0x2e09be[_0x4019('0x12')]['message']);}else{logger[_0x4019('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x45b6d8,_0x4019('0xf'));_0x173f77(_0x2e09be['result']['message']);}})['catch'](function(_0x5f0371){logger[_0x4019('0x12')](_0x4019('0xd'),_0x45b6d8,_0x5f0371);_0x598c33(_0x5f0371);});});} \ No newline at end of file +var _0x2feb=['error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19a6b7,_0x44e5fe){var _0x4b1297=function(_0x1c7ea1){while(--_0x1c7ea1){_0x19a6b7['push'](_0x19a6b7['shift']());}};_0x4b1297(++_0x44e5fe);}(_0x2feb,0x10c));var _0xb2fe=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0x2feb[_0x307d2b];return _0xe82587;};'use strict';var _=require(_0xb2fe('0x0'));var util=require('util');var moment=require(_0xb2fe('0x1'));var BPromise=require(_0xb2fe('0x2'));var rs=require(_0xb2fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2fe('0x4'));var logger=require(_0xb2fe('0x5'))(_0xb2fe('0x6'));var config=require(_0xb2fe('0x7'));var jayson=require(_0xb2fe('0x8'));var client=jayson[_0xb2fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221a4a,_0x415212,_0x23b747){return new BPromise(function(_0x320766,_0x1afd30){return client[_0xb2fe('0xa')](_0x221a4a,_0x23b747)[_0xb2fe('0xb')](function(_0x2d0260){logger[_0xb2fe('0xc')](_0xb2fe('0xd'),_0x415212,_0xb2fe('0xe'));logger[_0xb2fe('0xf')](_0xb2fe('0x10'),_0x415212,_0xb2fe('0xe'),JSON[_0xb2fe('0x11')](_0x2d0260));if(_0x2d0260[_0xb2fe('0x12')]){if(_0x2d0260[_0xb2fe('0x12')][_0xb2fe('0x13')]===0x1f4){logger[_0xb2fe('0x12')](_0xb2fe('0xd'),_0x415212,_0x2d0260[_0xb2fe('0x12')][_0xb2fe('0x14')]);return _0x1afd30(_0x2d0260['error'][_0xb2fe('0x14')]);}logger['error'](_0xb2fe('0xd'),_0x415212,_0x2d0260[_0xb2fe('0x12')][_0xb2fe('0x14')]);return _0x320766(_0x2d0260[_0xb2fe('0x12')][_0xb2fe('0x14')]);}else{logger[_0xb2fe('0xc')](_0xb2fe('0xd'),_0x415212,'request\x20sent');_0x320766(_0x2d0260['result'][_0xb2fe('0x14')]);}})[_0xb2fe('0x15')](function(_0x1aee80){logger[_0xb2fe('0x12')](_0xb2fe('0xd'),_0x415212,_0x1aee80);_0x1afd30(_0x1aee80);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 996764b..5001c56 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 _0xde1a=['show','post','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x285f48,_0x47e06c){var _0x5d6380=function(_0x55f799){while(--_0x55f799){_0x285f48['push'](_0x285f48['shift']());}};_0x5d6380(++_0x47e06c);}(_0xde1a,0xfd));var _0xade1=function(_0x5a7f2f,_0x34a31f){_0x5a7f2f=_0x5a7f2f-0x0;var _0xdf5f38=_0xde1a[_0x5a7f2f];return _0xdf5f38;};'use strict';var multer=require('multer');var util=require(_0xade1('0x0'));var path=require(_0xade1('0x1'));var timeout=require(_0xade1('0x2'));var express=require(_0xade1('0x3'));var router=express[_0xade1('0x4')]();var fs_extra=require(_0xade1('0x5'));var auth=require(_0xade1('0x6'));var interaction=require(_0xade1('0x7'));var config=require('../../config/environment');var controller=require(_0xade1('0x8'));router[_0xade1('0x9')]('/',auth[_0xade1('0xa')](),controller[_0xade1('0xb')]);router[_0xade1('0x9')](_0xade1('0xc'),auth['isAuthenticated'](),controller[_0xade1('0xd')]);router[_0xade1('0xe')]('/',auth[_0xade1('0xa')](),controller[_0xade1('0xf')]);router[_0xade1('0x10')](_0xade1('0xc'),auth[_0xade1('0xa')](),controller[_0xade1('0x11')]);router['delete'](_0xade1('0xc'),auth[_0xade1('0xa')](),controller['destroy']);module[_0xade1('0x12')]=router; \ No newline at end of file +var _0xf61e=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','isAuthenticated','show','post','put'];(function(_0x4e46ec,_0x10d0ae){var _0x96e5e7=function(_0x3c3f40){while(--_0x3c3f40){_0x4e46ec['push'](_0x4e46ec['shift']());}};_0x96e5e7(++_0x10d0ae);}(_0xf61e,0x191));var _0xef61=function(_0x483609,_0xb93779){_0x483609=_0x483609-0x0;var _0x5007fb=_0xf61e[_0x483609];return _0x5007fb;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/:id',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef61('0x10')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x12')]);router[_0xef61('0x13')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);module[_0xef61('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8e4f194..1ed736d 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 _0x3f30=['STRING','exports'];(function(_0x452e51,_0x13043b){var _0x537a6f=function(_0x1ea36b){while(--_0x1ea36b){_0x452e51['push'](_0x452e51['shift']());}};_0x537a6f(++_0x13043b);}(_0x3f30,0x1c7));var _0x03f3=function(_0x5d8a5d,_0x16a8e2){_0x5d8a5d=_0x5d8a5d-0x0;var _0x38df6b=_0x3f30[_0x5d8a5d];return _0x38df6b;};'use strict';var Sequelize=require('sequelize');module[_0x03f3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x03f3('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4ba8=['sequelize','exports','STRING','TEXT'];(function(_0x50388b,_0x276225){var _0x6037b=function(_0x584277){while(--_0x584277){_0x50388b['push'](_0x50388b['shift']());}};_0x6037b(++_0x276225);}(_0x4ba8,0xa4));var _0x84ba=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4ba8[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x84ba('0x0'));module[_0x84ba('0x1')]={'name':{'type':Sequelize[_0x84ba('0x2')]},'description':{'type':Sequelize[_0x84ba('0x2')]},'html':{'type':Sequelize[_0x84ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6afab69..858afb3 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 _0x9d67=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','name','send','index','map','Template','type','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0x9d67,0x1c3));var _0x79d6=function(_0x977279,_0x143359){_0x977279=_0x977279-0x0;var _0x455979=_0x9d67[_0x977279];return _0x455979;};'use strict';var emlformat=require(_0x79d6('0x0'));var rimraf=require(_0x79d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79d6('0x2'));var rp=require(_0x79d6('0x3'));var moment=require('moment');var BPromise=require(_0x79d6('0x4'));var Mustache=require(_0x79d6('0x5'));var util=require(_0x79d6('0x6'));var path=require(_0x79d6('0x7'));var sox=require(_0x79d6('0x8'));var csv=require(_0x79d6('0x9'));var ejs=require(_0x79d6('0xa'));var fs=require('fs');var fs_extra=require(_0x79d6('0xb'));var _=require(_0x79d6('0xc'));var squel=require(_0x79d6('0xd'));var crypto=require(_0x79d6('0xe'));var jsforce=require(_0x79d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x79d6('0x9'));var querystring=require('querystring');var Papa=require(_0x79d6('0x10'));var Redis=require(_0x79d6('0x11'));var authService=require(_0x79d6('0x12'));var qs=require(_0x79d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79d6('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x79d6('0x15'));var licenseUtil=require(_0x79d6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e18dc,_0x40dfc4){_0x40dfc4=_0x40dfc4||0xcc;return function(_0x31d18b){if(_0x31d18b){return _0x3e18dc[_0x79d6('0x17')](_0x40dfc4);}return _0x3e18dc[_0x79d6('0x18')](_0x40dfc4)['end']();};}function respondWithResult(_0x5a4a16,_0x424861){_0x424861=_0x424861||0xc8;return function(_0x26bd96){if(_0x26bd96){return _0x5a4a16[_0x79d6('0x18')](_0x424861)['json'](_0x26bd96);}};}function respondWithFilteredResult(_0x544f12,_0x409e35){return function(_0x2880dc){if(_0x2880dc){var _0x113024=typeof _0x409e35[_0x79d6('0x19')]==='undefined'&&typeof _0x409e35[_0x79d6('0x1a')]==='undefined';var _0x291dbc=_0x2880dc[_0x79d6('0x1b')];var _0x243d45=_0x113024?0x0:_0x409e35[_0x79d6('0x19')];var _0x48b016=_0x113024?_0x2880dc[_0x79d6('0x1b')]:_0x409e35['offset']+_0x409e35[_0x79d6('0x1a')];var _0x255951;if(_0x48b016>=_0x291dbc){_0x48b016=_0x291dbc;_0x255951=0xc8;}else{_0x255951=0xce;}_0x544f12['status'](_0x255951);return _0x544f12[_0x79d6('0x1c')](_0x79d6('0x1d'),_0x243d45+'-'+_0x48b016+'/'+_0x291dbc)[_0x79d6('0x1e')](_0x2880dc);}return null;};}function patchUpdates(_0x25f5d1){return function(_0x36ae29){try{jsonpatch['apply'](_0x36ae29,_0x25f5d1,!![]);}catch(_0x1043e8){return BPromise[_0x79d6('0x1f')](_0x1043e8);}return _0x36ae29[_0x79d6('0x20')]();};}function saveUpdates(_0x4d1b0a,_0x122ac2){return function(_0x2ee1c4){if(_0x2ee1c4){return _0x2ee1c4[_0x79d6('0x21')](_0x4d1b0a)[_0x79d6('0x22')](function(_0xe0628){return _0xe0628;});}return null;};}function removeEntity(_0x414950,_0x3ec428){return function(_0x53d7b8){if(_0x53d7b8){return _0x53d7b8['destroy']()[_0x79d6('0x22')](function(){var _0x46be31=_0x53d7b8[_0x79d6('0x23')]({'plain':!![]});var _0x107de4=_0x79d6('0x24');return db[_0x79d6('0x25')][_0x79d6('0x26')]({'where':{'type':_0x107de4,'resourceId':_0x46be31['id']}})[_0x79d6('0x22')](function(){return _0x53d7b8;});})[_0x79d6('0x22')](function(){_0x414950[_0x79d6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11dafd,_0x2a593e){return function(_0x36837f){if(!_0x36837f){_0x11dafd[_0x79d6('0x17')](0x194);}return _0x36837f;};}function handleError(_0x2a5119,_0x38dd44){_0x38dd44=_0x38dd44||0x1f4;return function(_0x5a949c){logger[_0x79d6('0x27')](_0x5a949c['stack']);if(_0x5a949c['name']){delete _0x5a949c[_0x79d6('0x28')];}_0x2a5119[_0x79d6('0x18')](_0x38dd44)[_0x79d6('0x29')](_0x5a949c);};}exports[_0x79d6('0x2a')]=function(_0x5d3e23,_0x541936){var _0x118b39={},_0x503207={},_0x4015f3={'count':0x0,'rows':[]};var _0x198ccc=_[_0x79d6('0x2b')](db[_0x79d6('0x2c')]['rawAttributes'],function(_0x200fa7){return{'name':_0x200fa7['fieldName'],'type':_0x200fa7[_0x79d6('0x2d')]['key']};});_0x503207['model']=_[_0x79d6('0x2b')](_0x198ccc,_0x79d6('0x28'));_0x503207[_0x79d6('0x2e')]=_[_0x79d6('0x2f')](_0x5d3e23[_0x79d6('0x2e')]);_0x503207[_0x79d6('0x30')]=_[_0x79d6('0x31')](_0x503207['model'],_0x503207['query']);_0x118b39[_0x79d6('0x32')]=_['intersection'](_0x503207['model'],qs['fields'](_0x5d3e23[_0x79d6('0x2e')][_0x79d6('0x33')]));_0x118b39[_0x79d6('0x32')]=_0x118b39['attributes'][_0x79d6('0x34')]?_0x118b39[_0x79d6('0x32')]:_0x503207[_0x79d6('0x35')];if(!_0x5d3e23['query']['hasOwnProperty'](_0x79d6('0x36'))){_0x118b39[_0x79d6('0x1a')]=qs[_0x79d6('0x1a')](_0x5d3e23[_0x79d6('0x2e')][_0x79d6('0x1a')]);_0x118b39[_0x79d6('0x19')]=qs['offset'](_0x5d3e23[_0x79d6('0x2e')][_0x79d6('0x19')]);}_0x118b39[_0x79d6('0x37')]=qs['sort'](_0x5d3e23['query'][_0x79d6('0x38')]);_0x118b39[_0x79d6('0x39')]=qs[_0x79d6('0x30')](_[_0x79d6('0x3a')](_0x5d3e23[_0x79d6('0x2e')],_0x503207['filters']),_0x198ccc);if(_0x5d3e23[_0x79d6('0x2e')][_0x79d6('0x3b')]){_0x118b39['where']=_['merge'](_0x118b39[_0x79d6('0x39')],{'$or':_[_0x79d6('0x2b')](_0x198ccc,function(_0x469c60){if(_0x469c60['type']!=='VIRTUAL'){var _0x23950b={};_0x23950b[_0x469c60[_0x79d6('0x28')]]={'$like':'%'+_0x5d3e23['query']['filter']+'%'};return _0x23950b;}})});}_0x118b39=_[_0x79d6('0x3c')]({},_0x118b39,_0x5d3e23[_0x79d6('0x3d')]);var _0x483e72={'where':_0x118b39[_0x79d6('0x39')]};return db[_0x79d6('0x2c')][_0x79d6('0x1b')](_0x483e72)[_0x79d6('0x22')](function(_0x3c447d){_0x4015f3[_0x79d6('0x1b')]=_0x3c447d;if(_0x5d3e23[_0x79d6('0x2e')][_0x79d6('0x3e')]){_0x118b39[_0x79d6('0x3f')]=[{'all':!![]}];}return db[_0x79d6('0x2c')][_0x79d6('0x40')](_0x118b39);})[_0x79d6('0x22')](function(_0x1ea1a1){_0x4015f3[_0x79d6('0x41')]=_0x1ea1a1;return _0x4015f3;})['then'](respondWithFilteredResult(_0x541936,_0x118b39))[_0x79d6('0x42')](handleError(_0x541936,null));};exports[_0x79d6('0x43')]=function(_0x42a828,_0x14e021){var _0x5a3f9c={'raw':!![],'where':{'id':_0x42a828['params']['id']}},_0x1c4ab3={};_0x1c4ab3[_0x79d6('0x35')]=_[_0x79d6('0x2f')](db['Template'][_0x79d6('0x44')]);_0x1c4ab3[_0x79d6('0x2e')]=_['keys'](_0x42a828['query']);_0x1c4ab3[_0x79d6('0x30')]=_['intersection'](_0x1c4ab3[_0x79d6('0x35')],_0x1c4ab3['query']);_0x5a3f9c[_0x79d6('0x32')]=_[_0x79d6('0x31')](_0x1c4ab3[_0x79d6('0x35')],qs[_0x79d6('0x33')](_0x42a828['query'][_0x79d6('0x33')]));_0x5a3f9c['attributes']=_0x5a3f9c[_0x79d6('0x32')][_0x79d6('0x34')]?_0x5a3f9c[_0x79d6('0x32')]:_0x1c4ab3[_0x79d6('0x35')];if(_0x42a828[_0x79d6('0x2e')][_0x79d6('0x3e')]){_0x5a3f9c['include']=[{'all':!![]}];}_0x5a3f9c=_[_0x79d6('0x3c')]({},_0x5a3f9c,_0x42a828[_0x79d6('0x3d')]);return db[_0x79d6('0x2c')][_0x79d6('0x45')](_0x5a3f9c)['then'](handleEntityNotFound(_0x14e021,null))[_0x79d6('0x22')](respondWithResult(_0x14e021,null))[_0x79d6('0x42')](handleError(_0x14e021,null));};exports[_0x79d6('0x46')]=function(_0xd54c3a,_0x2b5cc6){return db['Template']['create'](_0xd54c3a[_0x79d6('0x47')],{})[_0x79d6('0x22')](function(_0x4b00f0){var _0x4adcd3=_0xd54c3a[_0x79d6('0x48')][_0x79d6('0x23')]({'plain':!![]});if(!_0x4adcd3)throw new Error(_0x79d6('0x49'));if(_0x4adcd3['role']==='user'){var _0x29989b=_0x4b00f0[_0x79d6('0x23')]({'plain':!![]});var _0x3e84a6='Templates';return db[_0x79d6('0x4a')][_0x79d6('0x45')]({'where':{'name':_0x3e84a6,'userProfileId':_0x4adcd3[_0x79d6('0x4b')]},'raw':!![]})[_0x79d6('0x22')](function(_0x3ff558){if(_0x3ff558&&_0x3ff558[_0x79d6('0x4c')]===0x0){return db['UserProfileResource'][_0x79d6('0x46')]({'name':_0x29989b['name'],'resourceId':_0x29989b['id'],'type':_0x3ff558[_0x79d6('0x28')],'sectionId':_0x3ff558['id']},{})[_0x79d6('0x22')](function(){return _0x4b00f0;});}else{return _0x4b00f0;}})['catch'](function(_0x3dca3e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dca3e);throw _0x3dca3e;});}return _0x4b00f0;})['then'](respondWithResult(_0x2b5cc6,0xc9))[_0x79d6('0x42')](handleError(_0x2b5cc6,null));};exports[_0x79d6('0x21')]=function(_0x42ea77,_0x5c08a5){if(_0x42ea77[_0x79d6('0x47')]['id']){delete _0x42ea77['body']['id'];}return db['Template']['find']({'where':{'id':_0x42ea77[_0x79d6('0x4d')]['id']}})[_0x79d6('0x22')](handleEntityNotFound(_0x5c08a5,null))['then'](saveUpdates(_0x42ea77[_0x79d6('0x47')],null))['then'](respondWithResult(_0x5c08a5,null))[_0x79d6('0x42')](handleError(_0x5c08a5,null));};exports[_0x79d6('0x26')]=function(_0x41a144,_0xb48cdc){return db[_0x79d6('0x2c')][_0x79d6('0x45')]({'where':{'id':_0x41a144['params']['id']}})['then'](handleEntityNotFound(_0xb48cdc,null))['then'](removeEntity(_0xb48cdc,null))[_0x79d6('0x42')](handleError(_0xb48cdc,null));}; \ No newline at end of file +var _0x0fea=['Template','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','end','error','stack','name','send','index'];(function(_0x3b4889,_0x3868f6){var _0x4fb5e6=function(_0x681a0){while(--_0x681a0){_0x3b4889['push'](_0x3b4889['shift']());}};_0x4fb5e6(++_0x3868f6);}(_0x0fea,0x80));var _0xa0fe=function(_0x53080e,_0x252127){_0x53080e=_0x53080e-0x0;var _0x1a0c14=_0x0fea[_0x53080e];return _0x1a0c14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0fe('0x0'));var zipdir=require(_0xa0fe('0x1'));var jsonpatch=require(_0xa0fe('0x2'));var rp=require(_0xa0fe('0x3'));var moment=require(_0xa0fe('0x4'));var BPromise=require(_0xa0fe('0x5'));var Mustache=require(_0xa0fe('0x6'));var util=require(_0xa0fe('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0fe('0x8'));var ejs=require(_0xa0fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0fe('0xa'));var squel=require(_0xa0fe('0xb'));var crypto=require(_0xa0fe('0xc'));var jsforce=require(_0xa0fe('0xd'));var deskjs=require(_0xa0fe('0xe'));var toCsv=require(_0xa0fe('0x8'));var querystring=require(_0xa0fe('0xf'));var Papa=require(_0xa0fe('0x10'));var Redis=require('ioredis');var authService=require(_0xa0fe('0x11'));var qs=require(_0xa0fe('0x12'));var as=require(_0xa0fe('0x13'));var hardwareService=require(_0xa0fe('0x14'));var logger=require(_0xa0fe('0x15'))(_0xa0fe('0x16'));var utils=require(_0xa0fe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa0fe('0x18'));var db=require(_0xa0fe('0x19'))['db'];function respondWithStatusCode(_0x2232c9,_0x5bf51a){_0x5bf51a=_0x5bf51a||0xcc;return function(_0x22e11e){if(_0x22e11e){return _0x2232c9[_0xa0fe('0x1a')](_0x5bf51a);}return _0x2232c9[_0xa0fe('0x1b')](_0x5bf51a)['end']();};}function respondWithResult(_0x10935d,_0x1b6916){_0x1b6916=_0x1b6916||0xc8;return function(_0x38e0d0){if(_0x38e0d0){return _0x10935d[_0xa0fe('0x1b')](_0x1b6916)[_0xa0fe('0x1c')](_0x38e0d0);}};}function respondWithFilteredResult(_0x3c217f,_0x54cd31){return function(_0x1f64ea){if(_0x1f64ea){var _0x4022d5=typeof _0x54cd31[_0xa0fe('0x1d')]===_0xa0fe('0x1e')&&typeof _0x54cd31['limit']===_0xa0fe('0x1e');var _0x19076a=_0x1f64ea['count'];var _0x2ac92e=_0x4022d5?0x0:_0x54cd31[_0xa0fe('0x1d')];var _0x260e3f=_0x4022d5?_0x1f64ea[_0xa0fe('0x1f')]:_0x54cd31[_0xa0fe('0x1d')]+_0x54cd31['limit'];var _0x5500a3;if(_0x260e3f>=_0x19076a){_0x260e3f=_0x19076a;_0x5500a3=0xc8;}else{_0x5500a3=0xce;}_0x3c217f[_0xa0fe('0x1b')](_0x5500a3);return _0x3c217f[_0xa0fe('0x20')](_0xa0fe('0x21'),_0x2ac92e+'-'+_0x260e3f+'/'+_0x19076a)[_0xa0fe('0x1c')](_0x1f64ea);}return null;};}function patchUpdates(_0x185f03){return function(_0x2156d2){try{jsonpatch[_0xa0fe('0x22')](_0x2156d2,_0x185f03,!![]);}catch(_0xb0ec32){return BPromise[_0xa0fe('0x23')](_0xb0ec32);}return _0x2156d2[_0xa0fe('0x24')]();};}function saveUpdates(_0x2f45df,_0x4241d5){return function(_0x5eddd3){if(_0x5eddd3){return _0x5eddd3[_0xa0fe('0x25')](_0x2f45df)[_0xa0fe('0x26')](function(_0x11fc3f){return _0x11fc3f;});}return null;};}function removeEntity(_0x34c594,_0x49a23b){return function(_0x593257){if(_0x593257){return _0x593257[_0xa0fe('0x27')]()[_0xa0fe('0x26')](function(){var _0x2d66c8=_0x593257[_0xa0fe('0x28')]({'plain':!![]});var _0x2807a5=_0xa0fe('0x29');return db['UserProfileResource'][_0xa0fe('0x27')]({'where':{'type':_0x2807a5,'resourceId':_0x2d66c8['id']}})['then'](function(){return _0x593257;});})[_0xa0fe('0x26')](function(){_0x34c594[_0xa0fe('0x1b')](0xcc)[_0xa0fe('0x2a')]();});}};}function handleEntityNotFound(_0x48d476,_0x522a6f){return function(_0x4934e5){if(!_0x4934e5){_0x48d476[_0xa0fe('0x1a')](0x194);}return _0x4934e5;};}function handleError(_0x3aafd2,_0xb65b40){_0xb65b40=_0xb65b40||0x1f4;return function(_0x200235){logger[_0xa0fe('0x2b')](_0x200235[_0xa0fe('0x2c')]);if(_0x200235[_0xa0fe('0x2d')]){delete _0x200235['name'];}_0x3aafd2[_0xa0fe('0x1b')](_0xb65b40)[_0xa0fe('0x2e')](_0x200235);};}exports[_0xa0fe('0x2f')]=function(_0x42c659,_0x3ef0ad){var _0xa3bc6e={},_0x112615={},_0x5c7762={'count':0x0,'rows':[]};var _0x146798=_['map'](db[_0xa0fe('0x30')]['rawAttributes'],function(_0x24ca60){return{'name':_0x24ca60[_0xa0fe('0x31')],'type':_0x24ca60[_0xa0fe('0x32')][_0xa0fe('0x33')]};});_0x112615[_0xa0fe('0x34')]=_[_0xa0fe('0x35')](_0x146798,_0xa0fe('0x2d'));_0x112615[_0xa0fe('0x36')]=_['keys'](_0x42c659['query']);_0x112615[_0xa0fe('0x37')]=_[_0xa0fe('0x38')](_0x112615[_0xa0fe('0x34')],_0x112615[_0xa0fe('0x36')]);_0xa3bc6e[_0xa0fe('0x39')]=_[_0xa0fe('0x38')](_0x112615[_0xa0fe('0x34')],qs[_0xa0fe('0x3a')](_0x42c659[_0xa0fe('0x36')]['fields']));_0xa3bc6e[_0xa0fe('0x39')]=_0xa3bc6e[_0xa0fe('0x39')][_0xa0fe('0x3b')]?_0xa3bc6e[_0xa0fe('0x39')]:_0x112615[_0xa0fe('0x34')];if(!_0x42c659[_0xa0fe('0x36')][_0xa0fe('0x3c')]('nolimit')){_0xa3bc6e[_0xa0fe('0x3d')]=qs[_0xa0fe('0x3d')](_0x42c659[_0xa0fe('0x36')][_0xa0fe('0x3d')]);_0xa3bc6e[_0xa0fe('0x1d')]=qs[_0xa0fe('0x1d')](_0x42c659[_0xa0fe('0x36')][_0xa0fe('0x1d')]);}_0xa3bc6e['order']=qs['sort'](_0x42c659['query'][_0xa0fe('0x3e')]);_0xa3bc6e[_0xa0fe('0x3f')]=qs[_0xa0fe('0x37')](_[_0xa0fe('0x40')](_0x42c659[_0xa0fe('0x36')],_0x112615[_0xa0fe('0x37')]),_0x146798);if(_0x42c659[_0xa0fe('0x36')][_0xa0fe('0x41')]){_0xa3bc6e[_0xa0fe('0x3f')]=_['merge'](_0xa3bc6e[_0xa0fe('0x3f')],{'$or':_['map'](_0x146798,function(_0xc5c74c){if(_0xc5c74c[_0xa0fe('0x32')]!==_0xa0fe('0x42')){var _0x1a601f={};_0x1a601f[_0xc5c74c[_0xa0fe('0x2d')]]={'$like':'%'+_0x42c659[_0xa0fe('0x36')][_0xa0fe('0x41')]+'%'};return _0x1a601f;}})});}_0xa3bc6e=_['merge']({},_0xa3bc6e,_0x42c659[_0xa0fe('0x43')]);var _0x5afe74={'where':_0xa3bc6e[_0xa0fe('0x3f')]};return db[_0xa0fe('0x30')][_0xa0fe('0x1f')](_0x5afe74)[_0xa0fe('0x26')](function(_0x18693){_0x5c7762['count']=_0x18693;if(_0x42c659[_0xa0fe('0x36')]['includeAll']){_0xa3bc6e[_0xa0fe('0x44')]=[{'all':!![]}];}return db[_0xa0fe('0x30')][_0xa0fe('0x45')](_0xa3bc6e);})[_0xa0fe('0x26')](function(_0x36a768){_0x5c7762[_0xa0fe('0x46')]=_0x36a768;return _0x5c7762;})[_0xa0fe('0x26')](respondWithFilteredResult(_0x3ef0ad,_0xa3bc6e))[_0xa0fe('0x47')](handleError(_0x3ef0ad,null));};exports[_0xa0fe('0x48')]=function(_0x204d5f,_0x17cc44){var _0x7ad738={'raw':!![],'where':{'id':_0x204d5f[_0xa0fe('0x49')]['id']}},_0x3cdf51={};_0x3cdf51['model']=_[_0xa0fe('0x4a')](db[_0xa0fe('0x30')][_0xa0fe('0x4b')]);_0x3cdf51[_0xa0fe('0x36')]=_[_0xa0fe('0x4a')](_0x204d5f[_0xa0fe('0x36')]);_0x3cdf51[_0xa0fe('0x37')]=_[_0xa0fe('0x38')](_0x3cdf51['model'],_0x3cdf51[_0xa0fe('0x36')]);_0x7ad738[_0xa0fe('0x39')]=_[_0xa0fe('0x38')](_0x3cdf51[_0xa0fe('0x34')],qs[_0xa0fe('0x3a')](_0x204d5f[_0xa0fe('0x36')][_0xa0fe('0x3a')]));_0x7ad738[_0xa0fe('0x39')]=_0x7ad738[_0xa0fe('0x39')]['length']?_0x7ad738[_0xa0fe('0x39')]:_0x3cdf51[_0xa0fe('0x34')];if(_0x204d5f[_0xa0fe('0x36')][_0xa0fe('0x4c')]){_0x7ad738[_0xa0fe('0x44')]=[{'all':!![]}];}_0x7ad738=_['merge']({},_0x7ad738,_0x204d5f[_0xa0fe('0x43')]);return db[_0xa0fe('0x30')][_0xa0fe('0x4d')](_0x7ad738)[_0xa0fe('0x26')](handleEntityNotFound(_0x17cc44,null))['then'](respondWithResult(_0x17cc44,null))[_0xa0fe('0x47')](handleError(_0x17cc44,null));};exports[_0xa0fe('0x4e')]=function(_0x5d24c9,_0x5020f1){return db[_0xa0fe('0x30')][_0xa0fe('0x4e')](_0x5d24c9['body'],{})[_0xa0fe('0x26')](function(_0x3e14cd){var _0x31bf28=_0x5d24c9[_0xa0fe('0x4f')][_0xa0fe('0x28')]({'plain':!![]});if(!_0x31bf28)throw new Error(_0xa0fe('0x50'));if(_0x31bf28[_0xa0fe('0x51')]===_0xa0fe('0x4f')){var _0xdf7c60=_0x3e14cd[_0xa0fe('0x28')]({'plain':!![]});var _0x5d85d3=_0xa0fe('0x29');return db[_0xa0fe('0x52')][_0xa0fe('0x4d')]({'where':{'name':_0x5d85d3,'userProfileId':_0x31bf28[_0xa0fe('0x53')]},'raw':!![]})[_0xa0fe('0x26')](function(_0x22a28e){if(_0x22a28e&&_0x22a28e[_0xa0fe('0x54')]===0x0){return db[_0xa0fe('0x55')][_0xa0fe('0x4e')]({'name':_0xdf7c60[_0xa0fe('0x2d')],'resourceId':_0xdf7c60['id'],'type':_0x22a28e['name'],'sectionId':_0x22a28e['id']},{})[_0xa0fe('0x26')](function(){return _0x3e14cd;});}else{return _0x3e14cd;}})[_0xa0fe('0x47')](function(_0xe38f53){logger[_0xa0fe('0x2b')](_0xa0fe('0x56'),_0xe38f53);throw _0xe38f53;});}return _0x3e14cd;})[_0xa0fe('0x26')](respondWithResult(_0x5020f1,0xc9))[_0xa0fe('0x47')](handleError(_0x5020f1,null));};exports['update']=function(_0x3c6fd2,_0x16b602){if(_0x3c6fd2[_0xa0fe('0x57')]['id']){delete _0x3c6fd2[_0xa0fe('0x57')]['id'];}return db[_0xa0fe('0x30')]['find']({'where':{'id':_0x3c6fd2[_0xa0fe('0x49')]['id']}})[_0xa0fe('0x26')](handleEntityNotFound(_0x16b602,null))[_0xa0fe('0x26')](saveUpdates(_0x3c6fd2['body'],null))['then'](respondWithResult(_0x16b602,null))[_0xa0fe('0x47')](handleError(_0x16b602,null));};exports[_0xa0fe('0x27')]=function(_0x5b7955,_0x5b07e4){return db['Template'][_0xa0fe('0x4d')]({'where':{'id':_0x5b7955[_0xa0fe('0x49')]['id']}})[_0xa0fe('0x26')](handleEntityNotFound(_0x5b07e4,null))[_0xa0fe('0x26')](removeEntity(_0x5b07e4,null))['catch'](handleError(_0x5b07e4,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 1e11c59..ad7f592 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 _0x5efa=['exports','define','Template','lodash','util','api','bluebird','rimraf','../../config/environment','./template.attributes'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5efa,0x1c5));var _0xa5ef=function(_0x3f5dba,_0x49e23d){_0x3f5dba=_0x3f5dba-0x0;var _0x273d14=_0x5efa[_0x3f5dba];return _0x273d14;};'use strict';var _=require(_0xa5ef('0x0'));var util=require(_0xa5ef('0x1'));var logger=require('../../config/logger')(_0xa5ef('0x2'));var moment=require('moment');var BPromise=require(_0xa5ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa5ef('0x4'));var config=require(_0xa5ef('0x5'));var attributes=require(_0xa5ef('0x6'));module[_0xa5ef('0x7')]=function(_0x35896f,_0x4f50c9){return _0x35896f[_0xa5ef('0x8')](_0xa5ef('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcba=['path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','moment','bluebird','request-promise'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xbcba,0x19e));var _0xabcb=function(_0x3e5d54,_0x4db75c){_0x3e5d54=_0x3e5d54-0x0;var _0xed47ac=_0xbcba[_0x3e5d54];return _0xed47ac;};'use strict';var _=require(_0xabcb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xabcb('0x1'));var BPromise=require(_0xabcb('0x2'));var rp=require(_0xabcb('0x3'));var fs=require('fs');var path=require(_0xabcb('0x4'));var rimraf=require(_0xabcb('0x5'));var config=require(_0xabcb('0x6'));var attributes=require(_0xabcb('0x7'));module[_0xabcb('0x8')]=function(_0x29b0d6,_0x2fc075){return _0x29b0d6['define'](_0xabcb('0x9'),attributes,{'tableName':_0xabcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 9181a1a..36ba1b4 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 _0x5047=['message','Template','findAll','options','raw','where','attributes','limit','include','model','map','then','GetTemplate','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s'];(function(_0x39157f,_0x3d8c1e){var _0x1ae4e2=function(_0x3429af){while(--_0x3429af){_0x39157f['push'](_0x39157f['shift']());}};_0x1ae4e2(++_0x3d8c1e);}(_0x5047,0xe0));var _0x7504=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x5047[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x7504('0x0'));var util=require(_0x7504('0x1'));var moment=require(_0x7504('0x2'));var BPromise=require(_0x7504('0x3'));var rs=require(_0x7504('0x4'));var fs=require('fs');var Redis=require(_0x7504('0x5'));var db=require(_0x7504('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7504('0x7'))(_0x7504('0x8'));var config=require(_0x7504('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7504('0xa')][_0x7504('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27e9c6,_0x3ca695,_0x239cbc){return new BPromise(function(_0xc165a5,_0x2c1591){return client[_0x7504('0xc')](_0x27e9c6,_0x239cbc)['then'](function(_0x276f6b){logger[_0x7504('0xd')]('Template,\x20%s,\x20%s',_0x3ca695,_0x7504('0xe'));logger[_0x7504('0xf')](_0x7504('0x10'),_0x3ca695,_0x7504('0xe'),JSON[_0x7504('0x11')](_0x276f6b));if(_0x276f6b[_0x7504('0x12')]){if(_0x276f6b[_0x7504('0x12')][_0x7504('0x13')]===0x1f4){logger[_0x7504('0x12')](_0x7504('0x14'),_0x3ca695,_0x276f6b[_0x7504('0x12')]['message']);return _0x2c1591(_0x276f6b[_0x7504('0x12')][_0x7504('0x15')]);}logger[_0x7504('0x12')](_0x7504('0x14'),_0x3ca695,_0x276f6b['error'][_0x7504('0x15')]);return _0xc165a5(_0x276f6b[_0x7504('0x12')][_0x7504('0x15')]);}else{logger[_0x7504('0xd')]('Template,\x20%s,\x20%s',_0x3ca695,_0x7504('0xe'));_0xc165a5(_0x276f6b['result']['message']);}})['catch'](function(_0x2665b4){logger[_0x7504('0x12')]('Template,\x20%s,\x20%s',_0x3ca695,_0x2665b4);_0x2c1591(_0x2665b4);});});}exports['GetTemplate']=function(_0x5f886f){var _0x1408a0=this;return new Promise(function(_0x1b211b,_0x3a8eb0){return db[_0x7504('0x16')][_0x7504('0x17')]({'raw':_0x5f886f[_0x7504('0x18')]?_0x5f886f[_0x7504('0x18')][_0x7504('0x19')]===undefined?!![]:![]:!![],'where':_0x5f886f[_0x7504('0x18')]?_0x5f886f[_0x7504('0x18')][_0x7504('0x1a')]||null:null,'attributes':_0x5f886f[_0x7504('0x18')]?_0x5f886f[_0x7504('0x18')][_0x7504('0x1b')]||null:null,'limit':_0x5f886f[_0x7504('0x18')]?_0x5f886f['options'][_0x7504('0x1c')]||null:null,'include':_0x5f886f[_0x7504('0x18')]?_0x5f886f[_0x7504('0x18')][_0x7504('0x1d')]?_['map'](_0x5f886f[_0x7504('0x18')][_0x7504('0x1d')],function(_0x2b587f){return{'model':db[_0x2b587f[_0x7504('0x1e')]],'as':_0x2b587f['as'],'attributes':_0x2b587f[_0x7504('0x1b')],'include':_0x2b587f[_0x7504('0x1d')]?_[_0x7504('0x1f')](_0x2b587f[_0x7504('0x1d')],function(_0x5ec420){return{'model':db[_0x5ec420[_0x7504('0x1e')]],'as':_0x5ec420['as'],'attributes':_0x5ec420[_0x7504('0x1b')],'include':_0x5ec420['include']?_[_0x7504('0x1f')](_0x5ec420[_0x7504('0x1d')],function(_0x37c083){return{'model':db[_0x37c083['model']],'as':_0x37c083['as'],'attributes':_0x37c083['attributes']};}):[]};}):[]};}):[]:[]})[_0x7504('0x20')](function(_0x3265e7){logger['info'](_0x7504('0x21'),_0x5f886f);logger['debug'](_0x7504('0x21'),_0x5f886f,JSON[_0x7504('0x11')](_0x3265e7));_0x1b211b(_0x3265e7);})[_0x7504('0x22')](function(_0x373af4){logger['error'](_0x7504('0x21'),_0x373af4[_0x7504('0x15')],_0x5f886f);_0x3a8eb0(_0x1408a0['error'](0x1f4,_0x373af4[_0x7504('0x15')]));});});}; \ No newline at end of file +var _0x9299=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','options','attributes','include','map','model','lodash','bluebird','randomstring'];(function(_0x5760ce,_0x36e4a3){var _0xd87900=function(_0x33b3bb){while(--_0x33b3bb){_0x5760ce['push'](_0x5760ce['shift']());}};_0xd87900(++_0x36e4a3);}(_0x9299,0x1dd));var _0x9929=function(_0x111c81,_0x43ef17){_0x111c81=_0x111c81-0x0;var _0x547792=_0x9299[_0x111c81];return _0x547792;};'use strict';var _=require(_0x9929('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9929('0x1'));var rs=require(_0x9929('0x2'));var fs=require('fs');var Redis=require(_0x9929('0x3'));var db=require(_0x9929('0x4'))['db'];var utils=require(_0x9929('0x5'));var logger=require(_0x9929('0x6'))(_0x9929('0x7'));var config=require(_0x9929('0x8'));var jayson=require(_0x9929('0x9'));var client=jayson[_0x9929('0xa')][_0x9929('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12b4e2,_0x130e40,_0x31a930){return new BPromise(function(_0x55e70e,_0x1261ee){return client[_0x9929('0xc')](_0x12b4e2,_0x31a930)[_0x9929('0xd')](function(_0x216625){logger[_0x9929('0xe')]('Template,\x20%s,\x20%s',_0x130e40,_0x9929('0xf'));logger[_0x9929('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x130e40,_0x9929('0xf'),JSON[_0x9929('0x11')](_0x216625));if(_0x216625[_0x9929('0x12')]){if(_0x216625[_0x9929('0x12')][_0x9929('0x13')]===0x1f4){logger[_0x9929('0x12')](_0x9929('0x14'),_0x130e40,_0x216625[_0x9929('0x12')][_0x9929('0x15')]);return _0x1261ee(_0x216625[_0x9929('0x12')][_0x9929('0x15')]);}logger[_0x9929('0x12')](_0x9929('0x14'),_0x130e40,_0x216625['error']['message']);return _0x55e70e(_0x216625[_0x9929('0x12')][_0x9929('0x15')]);}else{logger[_0x9929('0xe')](_0x9929('0x14'),_0x130e40,_0x9929('0xf'));_0x55e70e(_0x216625[_0x9929('0x16')][_0x9929('0x15')]);}})[_0x9929('0x17')](function(_0x584838){logger[_0x9929('0x12')](_0x9929('0x14'),_0x130e40,_0x584838);_0x1261ee(_0x584838);});});}exports[_0x9929('0x18')]=function(_0x114998){var _0xc973ca=this;return new Promise(function(_0x2c34c3,_0x45d992){return db['Template']['findAll']({'raw':_0x114998[_0x9929('0x19')]?_0x114998[_0x9929('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x114998[_0x9929('0x19')]?_0x114998[_0x9929('0x19')]['where']||null:null,'attributes':_0x114998[_0x9929('0x19')]?_0x114998[_0x9929('0x19')][_0x9929('0x1a')]||null:null,'limit':_0x114998[_0x9929('0x19')]?_0x114998[_0x9929('0x19')]['limit']||null:null,'include':_0x114998[_0x9929('0x19')]?_0x114998[_0x9929('0x19')][_0x9929('0x1b')]?_[_0x9929('0x1c')](_0x114998[_0x9929('0x19')][_0x9929('0x1b')],function(_0x111ecd){return{'model':db[_0x111ecd[_0x9929('0x1d')]],'as':_0x111ecd['as'],'attributes':_0x111ecd[_0x9929('0x1a')],'include':_0x111ecd[_0x9929('0x1b')]?_['map'](_0x111ecd[_0x9929('0x1b')],function(_0x46f43f){return{'model':db[_0x46f43f['model']],'as':_0x46f43f['as'],'attributes':_0x46f43f[_0x9929('0x1a')],'include':_0x46f43f[_0x9929('0x1b')]?_[_0x9929('0x1c')](_0x46f43f['include'],function(_0xf4cb6b){return{'model':db[_0xf4cb6b[_0x9929('0x1d')]],'as':_0xf4cb6b['as'],'attributes':_0xf4cb6b[_0x9929('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9929('0xd')](function(_0xc37f56){logger[_0x9929('0xe')](_0x9929('0x18'),_0x114998);logger['debug']('GetTemplate',_0x114998,JSON[_0x9929('0x11')](_0xc37f56));_0x2c34c3(_0xc37f56);})[_0x9929('0x17')](function(_0x683bbb){logger[_0x9929('0x12')](_0x9929('0x18'),_0x683bbb['message'],_0x114998);_0x45d992(_0xc973ca[_0x9929('0x12')](0x1f4,_0x683bbb[_0x9929('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 43be9f2..49c04c5 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 _0xc20c=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','put'];(function(_0x3a8d06,_0xc5596f){var _0x3c1015=function(_0x1888a5){while(--_0x1888a5){_0x3a8d06['push'](_0x3a8d06['shift']());}};_0x3c1015(++_0xc5596f);}(_0xc20c,0x139));var _0xcc20=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xc20c[_0x2e0443];return _0x52d450;};'use strict';var multer=require(_0xcc20('0x0'));var util=require(_0xcc20('0x1'));var path=require(_0xcc20('0x2'));var timeout=require(_0xcc20('0x3'));var express=require(_0xcc20('0x4'));var router=express[_0xcc20('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcc20('0x7'));var controller=require('./trigger.controller');router[_0xcc20('0x8')]('/',auth[_0xcc20('0x9')](),controller[_0xcc20('0xa')]);router[_0xcc20('0x8')]('/:id',auth[_0xcc20('0x9')](),controller[_0xcc20('0xb')]);router[_0xcc20('0x8')]('/:id/all_conditions',auth[_0xcc20('0x9')](),controller['getAllConditions']);router[_0xcc20('0x8')](_0xcc20('0xc'),auth[_0xcc20('0x9')](),controller[_0xcc20('0xd')]);router['get']('/:id/actions',auth[_0xcc20('0x9')](),controller[_0xcc20('0xe')]);router[_0xcc20('0xf')]('/',auth[_0xcc20('0x9')](),controller[_0xcc20('0x10')]);router[_0xcc20('0xf')](_0xcc20('0x11'),auth['isAuthenticated'](),controller[_0xcc20('0x12')]);router[_0xcc20('0xf')]('/:id/any_conditions',auth[_0xcc20('0x9')](),controller[_0xcc20('0x13')]);router[_0xcc20('0xf')](_0xcc20('0x14'),auth[_0xcc20('0x9')](),controller[_0xcc20('0x15')]);router[_0xcc20('0x16')](_0xcc20('0x17'),auth[_0xcc20('0x9')](),controller[_0xcc20('0x18')]);router[_0xcc20('0x19')](_0xcc20('0x17'),auth[_0xcc20('0x9')](),controller[_0xcc20('0x1a')]);module[_0xcc20('0x1b')]=router; \ No newline at end of file +var _0xa5bf=['express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x5d208b,_0x2615e6){var _0x3d4ef7=function(_0x412e01){while(--_0x412e01){_0x5d208b['push'](_0x5d208b['shift']());}};_0x3d4ef7(++_0x2615e6);}(_0xa5bf,0x101));var _0xfa5b=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xa5bf[_0x2dea24];return _0x309d58;};'use strict';var multer=require(_0xfa5b('0x0'));var util=require('util');var path=require(_0xfa5b('0x1'));var timeout=require(_0xfa5b('0x2'));var express=require(_0xfa5b('0x3'));var router=express[_0xfa5b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfa5b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa5b('0x6'));var controller=require(_0xfa5b('0x7'));router[_0xfa5b('0x8')]('/',auth[_0xfa5b('0x9')](),controller[_0xfa5b('0xa')]);router['get']('/:id',auth[_0xfa5b('0x9')](),controller['show']);router[_0xfa5b('0x8')](_0xfa5b('0xb'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0xfa5b('0x8')](_0xfa5b('0xc'),auth['isAuthenticated'](),controller[_0xfa5b('0xd')]);router['get'](_0xfa5b('0xe'),auth['isAuthenticated'](),controller['getActions']);router[_0xfa5b('0xf')]('/',auth['isAuthenticated'](),controller[_0xfa5b('0x10')]);router['post'](_0xfa5b('0xb'),auth[_0xfa5b('0x9')](),controller[_0xfa5b('0x11')]);router[_0xfa5b('0xf')]('/:id/any_conditions',auth[_0xfa5b('0x9')](),controller[_0xfa5b('0x12')]);router['post'](_0xfa5b('0xe'),auth[_0xfa5b('0x9')](),controller[_0xfa5b('0x13')]);router[_0xfa5b('0x14')](_0xfa5b('0x15'),auth[_0xfa5b('0x9')](),controller[_0xfa5b('0x16')]);router[_0xfa5b('0x17')](_0xfa5b('0x15'),auth[_0xfa5b('0x9')](),controller[_0xfa5b('0x18')]);module[_0xfa5b('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e79cee7..359aa52 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 _0x2ffc=['STRING','BOOLEAN'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x2ffc,0xc4));var _0xc2ff=function(_0x199906,_0x4b2987){_0x199906=_0x199906-0x0;var _0x10722c=_0x2ffc[_0x199906];return _0x10722c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc2ff('0x0')]},'channel':{'type':Sequelize[_0xc2ff('0x0')]},'description':{'type':Sequelize[_0xc2ff('0x0')]},'status':{'type':Sequelize[_0xc2ff('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xc7b2=['STRING','BOOLEAN','exports'];(function(_0x5a9a42,_0x559062){var _0x1eade8=function(_0x5caffc){while(--_0x5caffc){_0x5a9a42['push'](_0x5a9a42['shift']());}};_0x1eade8(++_0x559062);}(_0xc7b2,0x68));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2c7b('0x0')]={'name':{'type':Sequelize[_0x2c7b('0x1')]},'channel':{'type':Sequelize[_0x2c7b('0x1')]},'description':{'type':Sequelize[_0x2c7b('0x1')]},'status':{'type':Sequelize[_0x2c7b('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 a383411..c10eb54 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 _0xb56c=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','map','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Trigger','findAll','rows','catch','show','params','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','findOne','options','getAllConditions','rawAttributes','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format'];(function(_0x347862,_0x339566){var _0x2ec88b=function(_0x290bdc){while(--_0x290bdc){_0x347862['push'](_0x347862['shift']());}};_0x2ec88b(++_0x339566);}(_0xb56c,0x18b));var _0xcb56=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xb56c[_0x119280];return _0x481797;};'use strict';var emlformat=require(_0xcb56('0x0'));var rimraf=require(_0xcb56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb56('0x2'));var rp=require(_0xcb56('0x3'));var moment=require(_0xcb56('0x4'));var BPromise=require(_0xcb56('0x5'));var Mustache=require(_0xcb56('0x6'));var util=require(_0xcb56('0x7'));var path=require(_0xcb56('0x8'));var sox=require(_0xcb56('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb56('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb56('0xb'));var jsforce=require(_0xcb56('0xc'));var deskjs=require(_0xcb56('0xd'));var toCsv=require(_0xcb56('0xe'));var querystring=require(_0xcb56('0xf'));var Papa=require(_0xcb56('0x10'));var Redis=require(_0xcb56('0x11'));var authService=require(_0xcb56('0x12'));var qs=require(_0xcb56('0x13'));var as=require(_0xcb56('0x14'));var hardwareService=require(_0xcb56('0x15'));var logger=require(_0xcb56('0x16'))(_0xcb56('0x17'));var utils=require(_0xcb56('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcb56('0x19'));var db=require(_0xcb56('0x1a'))['db'];function respondWithStatusCode(_0x34768a,_0x5d38b8){_0x5d38b8=_0x5d38b8||0xcc;return function(_0x204c2e){if(_0x204c2e){return _0x34768a[_0xcb56('0x1b')](_0x5d38b8);}return _0x34768a[_0xcb56('0x1c')](_0x5d38b8)[_0xcb56('0x1d')]();};}function respondWithResult(_0x5af1c9,_0x4ea246){_0x4ea246=_0x4ea246||0xc8;return function(_0x4daee8){if(_0x4daee8){return _0x5af1c9[_0xcb56('0x1c')](_0x4ea246)['json'](_0x4daee8);}};}function respondWithFilteredResult(_0x402491,_0x44fedb){return function(_0x59fd86){if(_0x59fd86){var _0x78e4ad=typeof _0x44fedb[_0xcb56('0x1e')]===_0xcb56('0x1f')&&typeof _0x44fedb['limit']===_0xcb56('0x1f');var _0x233a5e=_0x59fd86[_0xcb56('0x20')];var _0x5f55f0=_0x78e4ad?0x0:_0x44fedb[_0xcb56('0x1e')];var _0x2c8f5d=_0x78e4ad?_0x59fd86[_0xcb56('0x20')]:_0x44fedb[_0xcb56('0x1e')]+_0x44fedb[_0xcb56('0x21')];var _0x5eedf4;if(_0x2c8f5d>=_0x233a5e){_0x2c8f5d=_0x233a5e;_0x5eedf4=0xc8;}else{_0x5eedf4=0xce;}_0x402491[_0xcb56('0x1c')](_0x5eedf4);return _0x402491[_0xcb56('0x22')](_0xcb56('0x23'),_0x5f55f0+'-'+_0x2c8f5d+'/'+_0x233a5e)[_0xcb56('0x24')](_0x59fd86);}return null;};}function patchUpdates(_0x251941){return function(_0x4518ba){try{jsonpatch[_0xcb56('0x25')](_0x4518ba,_0x251941,!![]);}catch(_0x247799){return BPromise[_0xcb56('0x26')](_0x247799);}return _0x4518ba['save']();};}function saveUpdates(_0x424930,_0x1675f9){return function(_0x3d6237){if(_0x3d6237){return _0x3d6237[_0xcb56('0x27')](_0x424930)[_0xcb56('0x28')](function(_0x3324f5){return _0x3324f5;});}return null;};}function removeEntity(_0x4e79a1,_0x5b04cf){return function(_0x29de6f){if(_0x29de6f){return _0x29de6f[_0xcb56('0x29')]()[_0xcb56('0x28')](function(){var _0x41eada=_0x29de6f[_0xcb56('0x2a')]({'plain':!![]});var _0x48655c=_0xcb56('0x2b');return db[_0xcb56('0x2c')][_0xcb56('0x29')]({'where':{'type':_0x48655c,'resourceId':_0x41eada['id']}})[_0xcb56('0x28')](function(){return _0x29de6f;});})[_0xcb56('0x28')](function(){_0x4e79a1['status'](0xcc)[_0xcb56('0x1d')]();});}};}function handleEntityNotFound(_0x504955,_0x103b12){return function(_0x281b8c){if(!_0x281b8c){_0x504955[_0xcb56('0x1b')](0x194);}return _0x281b8c;};}function handleError(_0x40d5e7,_0xfadf99){_0xfadf99=_0xfadf99||0x1f4;return function(_0x4b572a){logger[_0xcb56('0x2d')](_0x4b572a[_0xcb56('0x2e')]);if(_0x4b572a[_0xcb56('0x2f')]){delete _0x4b572a[_0xcb56('0x2f')];}_0x40d5e7[_0xcb56('0x1c')](_0xfadf99)['send'](_0x4b572a);};}exports['index']=function(_0xe22b79,_0x300ae3){var _0x1efce3={},_0x381e8e={},_0x440be9={'count':0x0,'rows':[]};var _0x5652d6=_[_0xcb56('0x30')](db['Trigger']['rawAttributes'],function(_0x2b17c7){return{'name':_0x2b17c7[_0xcb56('0x31')],'type':_0x2b17c7[_0xcb56('0x32')][_0xcb56('0x33')]};});_0x381e8e['model']=_[_0xcb56('0x30')](_0x5652d6,'name');_0x381e8e['query']=_[_0xcb56('0x34')](_0xe22b79[_0xcb56('0x35')]);_0x381e8e[_0xcb56('0x36')]=_[_0xcb56('0x37')](_0x381e8e[_0xcb56('0x38')],_0x381e8e[_0xcb56('0x35')]);_0x1efce3['attributes']=_[_0xcb56('0x37')](_0x381e8e[_0xcb56('0x38')],qs['fields'](_0xe22b79[_0xcb56('0x35')][_0xcb56('0x39')]));_0x1efce3[_0xcb56('0x3a')]=_0x1efce3[_0xcb56('0x3a')][_0xcb56('0x3b')]?_0x1efce3['attributes']:_0x381e8e[_0xcb56('0x38')];if(!_0xe22b79[_0xcb56('0x35')][_0xcb56('0x3c')](_0xcb56('0x3d'))){_0x1efce3[_0xcb56('0x21')]=qs[_0xcb56('0x21')](_0xe22b79[_0xcb56('0x35')][_0xcb56('0x21')]);_0x1efce3['offset']=qs[_0xcb56('0x1e')](_0xe22b79[_0xcb56('0x35')][_0xcb56('0x1e')]);}_0x1efce3[_0xcb56('0x3e')]=qs[_0xcb56('0x3f')](_0xe22b79['query'][_0xcb56('0x3f')]);_0x1efce3[_0xcb56('0x40')]=qs[_0xcb56('0x36')](_[_0xcb56('0x41')](_0xe22b79[_0xcb56('0x35')],_0x381e8e[_0xcb56('0x36')]),_0x5652d6);if(_0xe22b79['query'][_0xcb56('0x42')]){_0x1efce3[_0xcb56('0x40')]=_[_0xcb56('0x43')](_0x1efce3[_0xcb56('0x40')],{'$or':_[_0xcb56('0x30')](_0x5652d6,function(_0x387bad){if(_0x387bad[_0xcb56('0x32')]!==_0xcb56('0x44')){var _0x16f12f={};_0x16f12f[_0x387bad[_0xcb56('0x2f')]]={'$like':'%'+_0xe22b79['query'][_0xcb56('0x42')]+'%'};return _0x16f12f;}})});}_0x1efce3=_[_0xcb56('0x43')]({},_0x1efce3,_0xe22b79['options']);var _0x3eee2b={'where':_0x1efce3[_0xcb56('0x40')]};return db[_0xcb56('0x45')][_0xcb56('0x20')](_0x3eee2b)['then'](function(_0x568735){_0x440be9[_0xcb56('0x20')]=_0x568735;if(_0xe22b79[_0xcb56('0x35')]['includeAll']){_0x1efce3['include']=[{'all':!![]}];}return db['Trigger'][_0xcb56('0x46')](_0x1efce3);})[_0xcb56('0x28')](function(_0x5a10b6){_0x440be9[_0xcb56('0x47')]=_0x5a10b6;return _0x440be9;})['then'](respondWithFilteredResult(_0x300ae3,_0x1efce3))[_0xcb56('0x48')](handleError(_0x300ae3,null));};exports[_0xcb56('0x49')]=function(_0xa81008,_0x17912c){var _0x2f5daa={'raw':![],'where':{'id':_0xa81008[_0xcb56('0x4a')]['id']}},_0x21b479={};_0x21b479[_0xcb56('0x38')]=_[_0xcb56('0x34')](db[_0xcb56('0x45')]['rawAttributes']);_0x21b479[_0xcb56('0x35')]=_[_0xcb56('0x34')](_0xa81008['query']);_0x21b479['filters']=_[_0xcb56('0x37')](_0x21b479['model'],_0x21b479['query']);_0x2f5daa['attributes']=_['intersection'](_0x21b479['model'],qs[_0xcb56('0x39')](_0xa81008[_0xcb56('0x35')]['fields']));_0x2f5daa[_0xcb56('0x3a')]=_0x2f5daa[_0xcb56('0x3a')][_0xcb56('0x3b')]?_0x2f5daa[_0xcb56('0x3a')]:_0x21b479[_0xcb56('0x38')];if(_0xa81008[_0xcb56('0x35')][_0xcb56('0x4b')]){_0x2f5daa[_0xcb56('0x4c')]=[{'all':!![]}];}_0x2f5daa=_[_0xcb56('0x43')]({},_0x2f5daa,_0xa81008['options']);return db[_0xcb56('0x45')]['find'](_0x2f5daa)[_0xcb56('0x28')](handleEntityNotFound(_0x17912c,null))[_0xcb56('0x28')](respondWithResult(_0x17912c,null))[_0xcb56('0x48')](handleError(_0x17912c,null));};exports[_0xcb56('0x4d')]=function(_0x229b9f,_0x49494c){return db[_0xcb56('0x45')]['create'](_0x229b9f['body'],{})[_0xcb56('0x28')](function(_0x228faf){var _0x20057b=_0x229b9f[_0xcb56('0x4e')][_0xcb56('0x2a')]({'plain':!![]});if(!_0x20057b)throw new Error(_0xcb56('0x4f'));if(_0x20057b[_0xcb56('0x50')]===_0xcb56('0x4e')){var _0x43dff5=_0x228faf[_0xcb56('0x2a')]({'plain':!![]});var _0x567a5b=_0xcb56('0x2b');return db[_0xcb56('0x51')][_0xcb56('0x52')]({'where':{'name':_0x567a5b,'userProfileId':_0x20057b[_0xcb56('0x53')]},'raw':!![]})[_0xcb56('0x28')](function(_0x47935b){if(_0x47935b&&_0x47935b[_0xcb56('0x54')]===0x0){return db[_0xcb56('0x2c')]['create']({'name':_0x43dff5['name'],'resourceId':_0x43dff5['id'],'type':_0x47935b['name'],'sectionId':_0x47935b['id']},{})[_0xcb56('0x28')](function(){return _0x228faf;});}else{return _0x228faf;}})[_0xcb56('0x48')](function(_0x263a24){logger['error'](_0xcb56('0x55'),_0x263a24);throw _0x263a24;});}return _0x228faf;})[_0xcb56('0x28')](respondWithResult(_0x49494c,0xc9))[_0xcb56('0x48')](handleError(_0x49494c,null));};exports[_0xcb56('0x27')]=function(_0x3436af,_0x27caf4){if(_0x3436af[_0xcb56('0x56')]['id']){delete _0x3436af[_0xcb56('0x56')]['id'];}return db[_0xcb56('0x45')][_0xcb56('0x52')]({'where':{'id':_0x3436af['params']['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0x27caf4,null))['then'](saveUpdates(_0x3436af[_0xcb56('0x56')],null))[_0xcb56('0x28')](respondWithResult(_0x27caf4,null))[_0xcb56('0x48')](handleError(_0x27caf4,null));};exports['destroy']=function(_0x407233,_0x3b6c16){return db[_0xcb56('0x45')]['find']({'where':{'id':_0x407233[_0xcb56('0x4a')]['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0x3b6c16,null))['then'](removeEntity(_0x3b6c16,null))[_0xcb56('0x48')](handleError(_0x3b6c16,null));};exports[_0xcb56('0x57')]=function(_0x5d0a38,_0xa71eac,_0x8c5cbf){if(_0x5d0a38[_0xcb56('0x56')]['id']){delete _0x5d0a38[_0xcb56('0x56')]['id'];}return db[_0xcb56('0x45')][_0xcb56('0x52')]({'where':{'id':_0x5d0a38[_0xcb56('0x4a')]['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0xa71eac,null))[_0xcb56('0x28')](function(_0x524474){if(_0x524474){_0x5d0a38['body'][_0xcb56('0x58')]=_0x524474['id'];return db[_0xcb56('0x59')][_0xcb56('0x4d')](_0x5d0a38[_0xcb56('0x56')]);}})[_0xcb56('0x28')](respondWithResult(_0xa71eac,null))['catch'](handleError(_0xa71eac,null));};exports['addAnyCondition']=function(_0x199f37,_0x206ed3,_0x384bdd){if(_0x199f37[_0xcb56('0x56')]['id']){delete _0x199f37[_0xcb56('0x56')]['id'];}return db[_0xcb56('0x45')]['find']({'where':{'id':_0x199f37[_0xcb56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x206ed3,null))[_0xcb56('0x28')](function(_0x1f1798){if(_0x1f1798){_0x199f37[_0xcb56('0x56')]['TriggerAnyId']=_0x1f1798['id'];return db['Condition'][_0xcb56('0x4d')](_0x199f37[_0xcb56('0x56')]);}})[_0xcb56('0x28')](respondWithResult(_0x206ed3,null))[_0xcb56('0x48')](handleError(_0x206ed3,null));};exports['getAllConditions']=function(_0x4404b1,_0x44cd94,_0x25a234){var _0x27306a={};var _0x48e580={};var _0x4486c9;var _0x439679;return db[_0xcb56('0x45')][_0xcb56('0x5a')]({'where':{'id':_0x4404b1[_0xcb56('0x4a')]['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0x44cd94,null))[_0xcb56('0x28')](function(_0x3a5cb9){if(_0x3a5cb9){_0x4486c9=_0x3a5cb9;_0x48e580[_0xcb56('0x38')]=_[_0xcb56('0x34')](db['Condition']['rawAttributes']);_0x48e580['query']=_[_0xcb56('0x34')](_0x4404b1[_0xcb56('0x35')]);_0x48e580[_0xcb56('0x36')]=_[_0xcb56('0x37')](_0x48e580[_0xcb56('0x38')],_0x48e580[_0xcb56('0x35')]);_0x27306a['attributes']=_[_0xcb56('0x37')](_0x48e580[_0xcb56('0x38')],qs[_0xcb56('0x39')](_0x4404b1[_0xcb56('0x35')][_0xcb56('0x39')]));_0x27306a[_0xcb56('0x3a')]=_0x27306a[_0xcb56('0x3a')][_0xcb56('0x3b')]?_0x27306a['attributes']:_0x48e580['model'];_0x27306a['order']=qs[_0xcb56('0x3f')](_0x4404b1[_0xcb56('0x35')]['sort']);_0x27306a[_0xcb56('0x40')]=qs[_0xcb56('0x36')](_[_0xcb56('0x41')](_0x4404b1[_0xcb56('0x35')],_0x48e580[_0xcb56('0x36')]));if(_0x4404b1[_0xcb56('0x35')][_0xcb56('0x42')]){_0x27306a[_0xcb56('0x40')]=_['merge'](_0x27306a[_0xcb56('0x40')],{'$or':_['map'](_0x27306a[_0xcb56('0x3a')],function(_0x2fa01c){var _0x5e70a1={};_0x5e70a1[_0x2fa01c]={'$like':'%'+_0x4404b1[_0xcb56('0x35')][_0xcb56('0x42')]+'%'};return _0x5e70a1;})});}_0x27306a=_[_0xcb56('0x43')]({},_0x27306a,_0x4404b1[_0xcb56('0x5b')]);return _0x4486c9[_0xcb56('0x5c')](_0x27306a);}})['then'](function(_0x4ecb10){if(_0x4ecb10){_0x439679=_0x4ecb10['length'];if(!_0x4404b1[_0xcb56('0x35')][_0xcb56('0x3c')]('nolimit')){_0x27306a[_0xcb56('0x21')]=qs['limit'](_0x4404b1['query'][_0xcb56('0x21')]);_0x27306a['offset']=qs[_0xcb56('0x1e')](_0x4404b1[_0xcb56('0x35')][_0xcb56('0x1e')]);}return _0x4486c9[_0xcb56('0x5c')](_0x27306a);}})[_0xcb56('0x28')](function(_0x4c20b0){if(_0x4c20b0){return _0x4c20b0?{'count':_0x439679,'rows':_0x4c20b0}:null;}})[_0xcb56('0x28')](respondWithResult(_0x44cd94,null))['catch'](handleError(_0x44cd94,null));};exports['getAnyConditions']=function(_0x75ba52,_0x32c6ed,_0x29f8b3){var _0xcc96d7={};var _0x4014db={};var _0x1482a4;var _0x537633;return db[_0xcb56('0x45')][_0xcb56('0x5a')]({'where':{'id':_0x75ba52[_0xcb56('0x4a')]['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0x32c6ed,null))[_0xcb56('0x28')](function(_0x2c92b8){if(_0x2c92b8){_0x1482a4=_0x2c92b8;_0x4014db[_0xcb56('0x38')]=_[_0xcb56('0x34')](db[_0xcb56('0x59')][_0xcb56('0x5d')]);_0x4014db[_0xcb56('0x35')]=_[_0xcb56('0x34')](_0x75ba52[_0xcb56('0x35')]);_0x4014db[_0xcb56('0x36')]=_['intersection'](_0x4014db[_0xcb56('0x38')],_0x4014db['query']);_0xcc96d7[_0xcb56('0x3a')]=_['intersection'](_0x4014db['model'],qs[_0xcb56('0x39')](_0x75ba52[_0xcb56('0x35')]['fields']));_0xcc96d7['attributes']=_0xcc96d7['attributes'][_0xcb56('0x3b')]?_0xcc96d7[_0xcb56('0x3a')]:_0x4014db[_0xcb56('0x38')];_0xcc96d7[_0xcb56('0x3e')]=qs[_0xcb56('0x3f')](_0x75ba52['query'][_0xcb56('0x3f')]);_0xcc96d7[_0xcb56('0x40')]=qs[_0xcb56('0x36')](_[_0xcb56('0x41')](_0x75ba52[_0xcb56('0x35')],_0x4014db[_0xcb56('0x36')]));if(_0x75ba52[_0xcb56('0x35')]['filter']){_0xcc96d7['where']=_['merge'](_0xcc96d7[_0xcb56('0x40')],{'$or':_['map'](_0xcc96d7[_0xcb56('0x3a')],function(_0x17b767){var _0x7fb64a={};_0x7fb64a[_0x17b767]={'$like':'%'+_0x75ba52[_0xcb56('0x35')][_0xcb56('0x42')]+'%'};return _0x7fb64a;})});}_0xcc96d7=_[_0xcb56('0x43')]({},_0xcc96d7,_0x75ba52[_0xcb56('0x5b')]);return _0x1482a4[_0xcb56('0x5e')](_0xcc96d7);}})[_0xcb56('0x28')](function(_0x526742){if(_0x526742){_0x537633=_0x526742[_0xcb56('0x3b')];if(!_0x75ba52[_0xcb56('0x35')][_0xcb56('0x3c')]('nolimit')){_0xcc96d7[_0xcb56('0x21')]=qs[_0xcb56('0x21')](_0x75ba52[_0xcb56('0x35')]['limit']);_0xcc96d7[_0xcb56('0x1e')]=qs[_0xcb56('0x1e')](_0x75ba52[_0xcb56('0x35')][_0xcb56('0x1e')]);}return _0x1482a4[_0xcb56('0x5e')](_0xcc96d7);}})['then'](function(_0x201235){if(_0x201235){return _0x201235?{'count':_0x537633,'rows':_0x201235}:null;}})[_0xcb56('0x28')](respondWithResult(_0x32c6ed,null))['catch'](handleError(_0x32c6ed,null));};exports[_0xcb56('0x5f')]=function(_0x359038,_0x4703e2,_0x392d40){if(_0x359038[_0xcb56('0x56')]['id']){delete _0x359038[_0xcb56('0x56')]['id'];}return db[_0xcb56('0x45')][_0xcb56('0x52')]({'where':{'id':_0x359038[_0xcb56('0x4a')]['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0x4703e2,null))[_0xcb56('0x28')](function(_0x21e87f){if(_0x21e87f){_0x359038[_0xcb56('0x56')][_0xcb56('0x60')]=_0x21e87f['id'];return db[_0xcb56('0x61')][_0xcb56('0x4d')](_0x359038[_0xcb56('0x56')]);}})['then'](respondWithResult(_0x4703e2,null))[_0xcb56('0x48')](handleError(_0x4703e2,null));};exports['getActions']=function(_0x3d93c2,_0x4752bd,_0x45ba50){var _0x4f0fb4={};var _0x167141={};var _0x4f1527;var _0x455f10;return db[_0xcb56('0x45')]['findOne']({'where':{'id':_0x3d93c2[_0xcb56('0x4a')]['id']}})[_0xcb56('0x28')](handleEntityNotFound(_0x4752bd,null))[_0xcb56('0x28')](function(_0x7b3dbb){if(_0x7b3dbb){_0x4f1527=_0x7b3dbb;_0x167141[_0xcb56('0x38')]=_[_0xcb56('0x34')](db[_0xcb56('0x61')][_0xcb56('0x5d')]);_0x167141[_0xcb56('0x35')]=_[_0xcb56('0x34')](_0x3d93c2['query']);_0x167141[_0xcb56('0x36')]=_[_0xcb56('0x37')](_0x167141[_0xcb56('0x38')],_0x167141[_0xcb56('0x35')]);_0x4f0fb4[_0xcb56('0x3a')]=_[_0xcb56('0x37')](_0x167141[_0xcb56('0x38')],qs[_0xcb56('0x39')](_0x3d93c2[_0xcb56('0x35')][_0xcb56('0x39')]));_0x4f0fb4[_0xcb56('0x3a')]=_0x4f0fb4['attributes']['length']?_0x4f0fb4[_0xcb56('0x3a')]:_0x167141['model'];_0x4f0fb4[_0xcb56('0x3e')]=qs[_0xcb56('0x3f')](_0x3d93c2['query'][_0xcb56('0x3f')]);_0x4f0fb4['where']=qs[_0xcb56('0x36')](_[_0xcb56('0x41')](_0x3d93c2[_0xcb56('0x35')],_0x167141[_0xcb56('0x36')]));if(_0x3d93c2[_0xcb56('0x35')][_0xcb56('0x42')]){_0x4f0fb4['where']=_[_0xcb56('0x43')](_0x4f0fb4[_0xcb56('0x40')],{'$or':_[_0xcb56('0x30')](_0x4f0fb4['attributes'],function(_0x981e88){var _0x4a7041={};_0x4a7041[_0x981e88]={'$like':'%'+_0x3d93c2[_0xcb56('0x35')][_0xcb56('0x42')]+'%'};return _0x4a7041;})});}_0x4f0fb4=_[_0xcb56('0x43')]({},_0x4f0fb4,_0x3d93c2[_0xcb56('0x5b')]);return _0x4f1527['getActions'](_0x4f0fb4);}})[_0xcb56('0x28')](function(_0x39ce6f){if(_0x39ce6f){_0x455f10=_0x39ce6f[_0xcb56('0x3b')];if(!_0x3d93c2[_0xcb56('0x35')]['hasOwnProperty'](_0xcb56('0x3d'))){_0x4f0fb4[_0xcb56('0x21')]=qs[_0xcb56('0x21')](_0x3d93c2[_0xcb56('0x35')][_0xcb56('0x21')]);_0x4f0fb4['offset']=qs[_0xcb56('0x1e')](_0x3d93c2[_0xcb56('0x35')][_0xcb56('0x1e')]);}return _0x4f1527[_0xcb56('0x62')](_0x4f0fb4);}})[_0xcb56('0x28')](function(_0x9e93ee){if(_0x9e93ee){return _0x9e93ee?{'count':_0x455f10,'rows':_0x9e93ee}:null;}})['then'](respondWithResult(_0x4752bd,null))[_0xcb56('0x48')](handleError(_0x4752bd,null));}; \ No newline at end of file +var _0x65f6=['Content-Range','apply','reject','save','update','then','Triggers','UserProfileResource','destroy','error','stack','name','index','Trigger','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','map','filter','options','include','findAll','rows','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','params','TriggerAllId','Condition','getAllConditions','pick','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x3104e0,_0x3661c8){var _0x3715fa=function(_0x554d96){while(--_0x554d96){_0x3104e0['push'](_0x3104e0['shift']());}};_0x3715fa(++_0x3661c8);}(_0x65f6,0xf3));var _0x665f=function(_0x191918,_0x3f8a57){_0x191918=_0x191918-0x0;var _0x37ba44=_0x65f6[_0x191918];return _0x37ba44;};'use strict';var emlformat=require(_0x665f('0x0'));var rimraf=require(_0x665f('0x1'));var zipdir=require(_0x665f('0x2'));var jsonpatch=require(_0x665f('0x3'));var rp=require(_0x665f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x665f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x665f('0x6'));var csv=require(_0x665f('0x7'));var ejs=require(_0x665f('0x8'));var fs=require('fs');var fs_extra=require(_0x665f('0x9'));var _=require(_0x665f('0xa'));var squel=require(_0x665f('0xb'));var crypto=require(_0x665f('0xc'));var jsforce=require(_0x665f('0xd'));var deskjs=require(_0x665f('0xe'));var toCsv=require(_0x665f('0x7'));var querystring=require('querystring');var Papa=require(_0x665f('0xf'));var Redis=require('ioredis');var authService=require(_0x665f('0x10'));var qs=require(_0x665f('0x11'));var as=require(_0x665f('0x12'));var hardwareService=require(_0x665f('0x13'));var logger=require(_0x665f('0x14'))(_0x665f('0x15'));var utils=require(_0x665f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x665f('0x17'))['db'];function respondWithStatusCode(_0x32e52d,_0x3c10c6){_0x3c10c6=_0x3c10c6||0xcc;return function(_0x31616c){if(_0x31616c){return _0x32e52d[_0x665f('0x18')](_0x3c10c6);}return _0x32e52d[_0x665f('0x19')](_0x3c10c6)[_0x665f('0x1a')]();};}function respondWithResult(_0x3cff25,_0x430851){_0x430851=_0x430851||0xc8;return function(_0x20b140){if(_0x20b140){return _0x3cff25[_0x665f('0x19')](_0x430851)[_0x665f('0x1b')](_0x20b140);}};}function respondWithFilteredResult(_0x2c3f50,_0x197e49){return function(_0x4dcb64){if(_0x4dcb64){var _0x3e3002=typeof _0x197e49[_0x665f('0x1c')]===_0x665f('0x1d')&&typeof _0x197e49[_0x665f('0x1e')]==='undefined';var _0x27c727=_0x4dcb64[_0x665f('0x1f')];var _0x1590e1=_0x3e3002?0x0:_0x197e49[_0x665f('0x1c')];var _0x57f5c1=_0x3e3002?_0x4dcb64['count']:_0x197e49[_0x665f('0x1c')]+_0x197e49[_0x665f('0x1e')];var _0x111c76;if(_0x57f5c1>=_0x27c727){_0x57f5c1=_0x27c727;_0x111c76=0xc8;}else{_0x111c76=0xce;}_0x2c3f50['status'](_0x111c76);return _0x2c3f50[_0x665f('0x20')](_0x665f('0x21'),_0x1590e1+'-'+_0x57f5c1+'/'+_0x27c727)[_0x665f('0x1b')](_0x4dcb64);}return null;};}function patchUpdates(_0x522b62){return function(_0x5796e5){try{jsonpatch[_0x665f('0x22')](_0x5796e5,_0x522b62,!![]);}catch(_0x52f399){return BPromise[_0x665f('0x23')](_0x52f399);}return _0x5796e5[_0x665f('0x24')]();};}function saveUpdates(_0x57e0af,_0x32e592){return function(_0x54b18f){if(_0x54b18f){return _0x54b18f[_0x665f('0x25')](_0x57e0af)[_0x665f('0x26')](function(_0x14ae3e){return _0x14ae3e;});}return null;};}function removeEntity(_0x49463c,_0x23f174){return function(_0x13e9f8){if(_0x13e9f8){return _0x13e9f8['destroy']()[_0x665f('0x26')](function(){var _0x1fd46e=_0x13e9f8['get']({'plain':!![]});var _0x5d3cbe=_0x665f('0x27');return db[_0x665f('0x28')][_0x665f('0x29')]({'where':{'type':_0x5d3cbe,'resourceId':_0x1fd46e['id']}})['then'](function(){return _0x13e9f8;});})[_0x665f('0x26')](function(){_0x49463c[_0x665f('0x19')](0xcc)[_0x665f('0x1a')]();});}};}function handleEntityNotFound(_0x162201,_0x390c41){return function(_0x4af77c){if(!_0x4af77c){_0x162201[_0x665f('0x18')](0x194);}return _0x4af77c;};}function handleError(_0x12be8d,_0x11251a){_0x11251a=_0x11251a||0x1f4;return function(_0xe6edd2){logger[_0x665f('0x2a')](_0xe6edd2[_0x665f('0x2b')]);if(_0xe6edd2[_0x665f('0x2c')]){delete _0xe6edd2['name'];}_0x12be8d[_0x665f('0x19')](_0x11251a)['send'](_0xe6edd2);};}exports[_0x665f('0x2d')]=function(_0x28761d,_0x2e8f12){var _0x439e9b={},_0x5ab00f={},_0x2a1067={'count':0x0,'rows':[]};var _0x2525c8=_['map'](db[_0x665f('0x2e')][_0x665f('0x2f')],function(_0x4939a4){return{'name':_0x4939a4['fieldName'],'type':_0x4939a4[_0x665f('0x30')][_0x665f('0x31')]};});_0x5ab00f['model']=_['map'](_0x2525c8,_0x665f('0x2c'));_0x5ab00f[_0x665f('0x32')]=_[_0x665f('0x33')](_0x28761d[_0x665f('0x32')]);_0x5ab00f['filters']=_['intersection'](_0x5ab00f[_0x665f('0x34')],_0x5ab00f[_0x665f('0x32')]);_0x439e9b[_0x665f('0x35')]=_[_0x665f('0x36')](_0x5ab00f[_0x665f('0x34')],qs[_0x665f('0x37')](_0x28761d[_0x665f('0x32')][_0x665f('0x37')]));_0x439e9b[_0x665f('0x35')]=_0x439e9b[_0x665f('0x35')][_0x665f('0x38')]?_0x439e9b[_0x665f('0x35')]:_0x5ab00f['model'];if(!_0x28761d[_0x665f('0x32')][_0x665f('0x39')](_0x665f('0x3a'))){_0x439e9b[_0x665f('0x1e')]=qs[_0x665f('0x1e')](_0x28761d[_0x665f('0x32')][_0x665f('0x1e')]);_0x439e9b['offset']=qs[_0x665f('0x1c')](_0x28761d[_0x665f('0x32')][_0x665f('0x1c')]);}_0x439e9b[_0x665f('0x3b')]=qs[_0x665f('0x3c')](_0x28761d[_0x665f('0x32')][_0x665f('0x3c')]);_0x439e9b[_0x665f('0x3d')]=qs[_0x665f('0x3e')](_['pick'](_0x28761d['query'],_0x5ab00f[_0x665f('0x3e')]),_0x2525c8);if(_0x28761d[_0x665f('0x32')]['filter']){_0x439e9b[_0x665f('0x3d')]=_[_0x665f('0x3f')](_0x439e9b[_0x665f('0x3d')],{'$or':_[_0x665f('0x40')](_0x2525c8,function(_0x5628c2){if(_0x5628c2['type']!=='VIRTUAL'){var _0x27f5aa={};_0x27f5aa[_0x5628c2['name']]={'$like':'%'+_0x28761d[_0x665f('0x32')][_0x665f('0x41')]+'%'};return _0x27f5aa;}})});}_0x439e9b=_[_0x665f('0x3f')]({},_0x439e9b,_0x28761d[_0x665f('0x42')]);var _0x297505={'where':_0x439e9b[_0x665f('0x3d')]};return db[_0x665f('0x2e')][_0x665f('0x1f')](_0x297505)[_0x665f('0x26')](function(_0x21b5b2){_0x2a1067[_0x665f('0x1f')]=_0x21b5b2;if(_0x28761d[_0x665f('0x32')]['includeAll']){_0x439e9b[_0x665f('0x43')]=[{'all':!![]}];}return db[_0x665f('0x2e')][_0x665f('0x44')](_0x439e9b);})[_0x665f('0x26')](function(_0x272206){_0x2a1067[_0x665f('0x45')]=_0x272206;return _0x2a1067;})['then'](respondWithFilteredResult(_0x2e8f12,_0x439e9b))['catch'](handleError(_0x2e8f12,null));};exports['show']=function(_0x5c3b81,_0x5f0aba){var _0xae5513={'raw':![],'where':{'id':_0x5c3b81['params']['id']}},_0x4eb519={};_0x4eb519[_0x665f('0x34')]=_[_0x665f('0x33')](db[_0x665f('0x2e')][_0x665f('0x2f')]);_0x4eb519[_0x665f('0x32')]=_['keys'](_0x5c3b81[_0x665f('0x32')]);_0x4eb519['filters']=_[_0x665f('0x36')](_0x4eb519['model'],_0x4eb519['query']);_0xae5513[_0x665f('0x35')]=_[_0x665f('0x36')](_0x4eb519[_0x665f('0x34')],qs[_0x665f('0x37')](_0x5c3b81['query'][_0x665f('0x37')]));_0xae5513['attributes']=_0xae5513[_0x665f('0x35')]['length']?_0xae5513[_0x665f('0x35')]:_0x4eb519['model'];if(_0x5c3b81[_0x665f('0x32')]['includeAll']){_0xae5513[_0x665f('0x43')]=[{'all':!![]}];}_0xae5513=_['merge']({},_0xae5513,_0x5c3b81['options']);return db[_0x665f('0x2e')]['find'](_0xae5513)['then'](handleEntityNotFound(_0x5f0aba,null))[_0x665f('0x26')](respondWithResult(_0x5f0aba,null))['catch'](handleError(_0x5f0aba,null));};exports['create']=function(_0x52255d,_0x15c8ec){return db[_0x665f('0x2e')]['create'](_0x52255d['body'],{})['then'](function(_0x171695){var _0x38a68a=_0x52255d[_0x665f('0x46')]['get']({'plain':!![]});if(!_0x38a68a)throw new Error(_0x665f('0x47'));if(_0x38a68a['role']===_0x665f('0x46')){var _0xbd947c=_0x171695[_0x665f('0x48')]({'plain':!![]});var _0x37e41f='Triggers';return db[_0x665f('0x49')][_0x665f('0x4a')]({'where':{'name':_0x37e41f,'userProfileId':_0x38a68a[_0x665f('0x4b')]},'raw':!![]})[_0x665f('0x26')](function(_0x3a0df6){if(_0x3a0df6&&_0x3a0df6['autoAssociation']===0x0){return db[_0x665f('0x28')][_0x665f('0x4c')]({'name':_0xbd947c[_0x665f('0x2c')],'resourceId':_0xbd947c['id'],'type':_0x3a0df6[_0x665f('0x2c')],'sectionId':_0x3a0df6['id']},{})[_0x665f('0x26')](function(){return _0x171695;});}else{return _0x171695;}})[_0x665f('0x4d')](function(_0x2cb5b0){logger[_0x665f('0x2a')](_0x665f('0x4e'),_0x2cb5b0);throw _0x2cb5b0;});}return _0x171695;})[_0x665f('0x26')](respondWithResult(_0x15c8ec,0xc9))[_0x665f('0x4d')](handleError(_0x15c8ec,null));};exports[_0x665f('0x25')]=function(_0x35f70c,_0x29d356){if(_0x35f70c['body']['id']){delete _0x35f70c[_0x665f('0x4f')]['id'];}return db[_0x665f('0x2e')][_0x665f('0x4a')]({'where':{'id':_0x35f70c['params']['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x29d356,null))[_0x665f('0x26')](saveUpdates(_0x35f70c['body'],null))[_0x665f('0x26')](respondWithResult(_0x29d356,null))[_0x665f('0x4d')](handleError(_0x29d356,null));};exports[_0x665f('0x29')]=function(_0x397c8c,_0x1e882e){return db[_0x665f('0x2e')]['find']({'where':{'id':_0x397c8c['params']['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x1e882e,null))['then'](removeEntity(_0x1e882e,null))['catch'](handleError(_0x1e882e,null));};exports[_0x665f('0x50')]=function(_0x61de03,_0x38d125,_0x51d22f){if(_0x61de03['body']['id']){delete _0x61de03[_0x665f('0x4f')]['id'];}return db['Trigger'][_0x665f('0x4a')]({'where':{'id':_0x61de03[_0x665f('0x51')]['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x38d125,null))[_0x665f('0x26')](function(_0x288ba0){if(_0x288ba0){_0x61de03['body'][_0x665f('0x52')]=_0x288ba0['id'];return db[_0x665f('0x53')][_0x665f('0x4c')](_0x61de03[_0x665f('0x4f')]);}})[_0x665f('0x26')](respondWithResult(_0x38d125,null))[_0x665f('0x4d')](handleError(_0x38d125,null));};exports['addAnyCondition']=function(_0x31cb65,_0x2d3fb9,_0x16f960){if(_0x31cb65[_0x665f('0x4f')]['id']){delete _0x31cb65[_0x665f('0x4f')]['id'];}return db[_0x665f('0x2e')][_0x665f('0x4a')]({'where':{'id':_0x31cb65[_0x665f('0x51')]['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x2d3fb9,null))[_0x665f('0x26')](function(_0x38fb93){if(_0x38fb93){_0x31cb65[_0x665f('0x4f')]['TriggerAnyId']=_0x38fb93['id'];return db[_0x665f('0x53')][_0x665f('0x4c')](_0x31cb65[_0x665f('0x4f')]);}})['then'](respondWithResult(_0x2d3fb9,null))[_0x665f('0x4d')](handleError(_0x2d3fb9,null));};exports[_0x665f('0x54')]=function(_0x2df1e7,_0x4d9ffa,_0x5d803b){var _0x317fe9={};var _0x3441f5={};var _0x3507c5;var _0xc6c0bf;return db['Trigger']['findOne']({'where':{'id':_0x2df1e7[_0x665f('0x51')]['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x4d9ffa,null))[_0x665f('0x26')](function(_0x33a3dd){if(_0x33a3dd){_0x3507c5=_0x33a3dd;_0x3441f5['model']=_[_0x665f('0x33')](db[_0x665f('0x53')][_0x665f('0x2f')]);_0x3441f5[_0x665f('0x32')]=_[_0x665f('0x33')](_0x2df1e7[_0x665f('0x32')]);_0x3441f5['filters']=_['intersection'](_0x3441f5[_0x665f('0x34')],_0x3441f5[_0x665f('0x32')]);_0x317fe9['attributes']=_[_0x665f('0x36')](_0x3441f5[_0x665f('0x34')],qs['fields'](_0x2df1e7[_0x665f('0x32')][_0x665f('0x37')]));_0x317fe9[_0x665f('0x35')]=_0x317fe9['attributes'][_0x665f('0x38')]?_0x317fe9[_0x665f('0x35')]:_0x3441f5[_0x665f('0x34')];_0x317fe9[_0x665f('0x3b')]=qs['sort'](_0x2df1e7[_0x665f('0x32')][_0x665f('0x3c')]);_0x317fe9[_0x665f('0x3d')]=qs[_0x665f('0x3e')](_[_0x665f('0x55')](_0x2df1e7[_0x665f('0x32')],_0x3441f5[_0x665f('0x3e')]));if(_0x2df1e7[_0x665f('0x32')][_0x665f('0x41')]){_0x317fe9[_0x665f('0x3d')]=_[_0x665f('0x3f')](_0x317fe9[_0x665f('0x3d')],{'$or':_['map'](_0x317fe9[_0x665f('0x35')],function(_0x183b8c){var _0x2a804a={};_0x2a804a[_0x183b8c]={'$like':'%'+_0x2df1e7[_0x665f('0x32')]['filter']+'%'};return _0x2a804a;})});}_0x317fe9=_[_0x665f('0x3f')]({},_0x317fe9,_0x2df1e7[_0x665f('0x42')]);return _0x3507c5['getAllConditions'](_0x317fe9);}})[_0x665f('0x26')](function(_0x349a97){if(_0x349a97){_0xc6c0bf=_0x349a97[_0x665f('0x38')];if(!_0x2df1e7[_0x665f('0x32')][_0x665f('0x39')](_0x665f('0x3a'))){_0x317fe9[_0x665f('0x1e')]=qs[_0x665f('0x1e')](_0x2df1e7[_0x665f('0x32')][_0x665f('0x1e')]);_0x317fe9[_0x665f('0x1c')]=qs[_0x665f('0x1c')](_0x2df1e7[_0x665f('0x32')][_0x665f('0x1c')]);}return _0x3507c5[_0x665f('0x54')](_0x317fe9);}})[_0x665f('0x26')](function(_0x354969){if(_0x354969){return _0x354969?{'count':_0xc6c0bf,'rows':_0x354969}:null;}})['then'](respondWithResult(_0x4d9ffa,null))['catch'](handleError(_0x4d9ffa,null));};exports['getAnyConditions']=function(_0x5da3c1,_0x5266b1,_0x54d20c){var _0x33a80d={};var _0x353238={};var _0x209394;var _0xde2e09;return db['Trigger'][_0x665f('0x56')]({'where':{'id':_0x5da3c1['params']['id']}})['then'](handleEntityNotFound(_0x5266b1,null))['then'](function(_0x190087){if(_0x190087){_0x209394=_0x190087;_0x353238[_0x665f('0x34')]=_[_0x665f('0x33')](db['Condition']['rawAttributes']);_0x353238[_0x665f('0x32')]=_[_0x665f('0x33')](_0x5da3c1[_0x665f('0x32')]);_0x353238[_0x665f('0x3e')]=_[_0x665f('0x36')](_0x353238[_0x665f('0x34')],_0x353238[_0x665f('0x32')]);_0x33a80d[_0x665f('0x35')]=_[_0x665f('0x36')](_0x353238['model'],qs[_0x665f('0x37')](_0x5da3c1[_0x665f('0x32')]['fields']));_0x33a80d['attributes']=_0x33a80d['attributes']['length']?_0x33a80d['attributes']:_0x353238[_0x665f('0x34')];_0x33a80d['order']=qs['sort'](_0x5da3c1[_0x665f('0x32')][_0x665f('0x3c')]);_0x33a80d['where']=qs[_0x665f('0x3e')](_[_0x665f('0x55')](_0x5da3c1[_0x665f('0x32')],_0x353238[_0x665f('0x3e')]));if(_0x5da3c1[_0x665f('0x32')][_0x665f('0x41')]){_0x33a80d['where']=_['merge'](_0x33a80d[_0x665f('0x3d')],{'$or':_[_0x665f('0x40')](_0x33a80d[_0x665f('0x35')],function(_0x381a74){var _0x24deac={};_0x24deac[_0x381a74]={'$like':'%'+_0x5da3c1[_0x665f('0x32')][_0x665f('0x41')]+'%'};return _0x24deac;})});}_0x33a80d=_['merge']({},_0x33a80d,_0x5da3c1[_0x665f('0x42')]);return _0x209394[_0x665f('0x57')](_0x33a80d);}})[_0x665f('0x26')](function(_0x42a750){if(_0x42a750){_0xde2e09=_0x42a750[_0x665f('0x38')];if(!_0x5da3c1[_0x665f('0x32')][_0x665f('0x39')]('nolimit')){_0x33a80d['limit']=qs[_0x665f('0x1e')](_0x5da3c1[_0x665f('0x32')][_0x665f('0x1e')]);_0x33a80d[_0x665f('0x1c')]=qs[_0x665f('0x1c')](_0x5da3c1[_0x665f('0x32')][_0x665f('0x1c')]);}return _0x209394['getAnyConditions'](_0x33a80d);}})[_0x665f('0x26')](function(_0x503554){if(_0x503554){return _0x503554?{'count':_0xde2e09,'rows':_0x503554}:null;}})['then'](respondWithResult(_0x5266b1,null))[_0x665f('0x4d')](handleError(_0x5266b1,null));};exports[_0x665f('0x58')]=function(_0x4e66a3,_0x2a3911,_0x1da6d3){if(_0x4e66a3[_0x665f('0x4f')]['id']){delete _0x4e66a3['body']['id'];}return db[_0x665f('0x2e')][_0x665f('0x4a')]({'where':{'id':_0x4e66a3[_0x665f('0x51')]['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x2a3911,null))['then'](function(_0x3fd9c5){if(_0x3fd9c5){_0x4e66a3[_0x665f('0x4f')][_0x665f('0x59')]=_0x3fd9c5['id'];return db['Action'][_0x665f('0x4c')](_0x4e66a3[_0x665f('0x4f')]);}})[_0x665f('0x26')](respondWithResult(_0x2a3911,null))[_0x665f('0x4d')](handleError(_0x2a3911,null));};exports[_0x665f('0x5a')]=function(_0x47d434,_0x110139,_0x5284cc){var _0x4604a9={};var _0x1b8a03={};var _0x200b2e;var _0x58562d;return db[_0x665f('0x2e')][_0x665f('0x56')]({'where':{'id':_0x47d434[_0x665f('0x51')]['id']}})[_0x665f('0x26')](handleEntityNotFound(_0x110139,null))[_0x665f('0x26')](function(_0x672b4c){if(_0x672b4c){_0x200b2e=_0x672b4c;_0x1b8a03[_0x665f('0x34')]=_[_0x665f('0x33')](db[_0x665f('0x5b')][_0x665f('0x2f')]);_0x1b8a03[_0x665f('0x32')]=_[_0x665f('0x33')](_0x47d434[_0x665f('0x32')]);_0x1b8a03[_0x665f('0x3e')]=_[_0x665f('0x36')](_0x1b8a03['model'],_0x1b8a03['query']);_0x4604a9[_0x665f('0x35')]=_['intersection'](_0x1b8a03[_0x665f('0x34')],qs[_0x665f('0x37')](_0x47d434[_0x665f('0x32')][_0x665f('0x37')]));_0x4604a9[_0x665f('0x35')]=_0x4604a9['attributes'][_0x665f('0x38')]?_0x4604a9['attributes']:_0x1b8a03[_0x665f('0x34')];_0x4604a9[_0x665f('0x3b')]=qs[_0x665f('0x3c')](_0x47d434[_0x665f('0x32')][_0x665f('0x3c')]);_0x4604a9['where']=qs[_0x665f('0x3e')](_['pick'](_0x47d434['query'],_0x1b8a03[_0x665f('0x3e')]));if(_0x47d434['query'][_0x665f('0x41')]){_0x4604a9['where']=_[_0x665f('0x3f')](_0x4604a9[_0x665f('0x3d')],{'$or':_[_0x665f('0x40')](_0x4604a9[_0x665f('0x35')],function(_0xcf004f){var _0x350c11={};_0x350c11[_0xcf004f]={'$like':'%'+_0x47d434[_0x665f('0x32')][_0x665f('0x41')]+'%'};return _0x350c11;})});}_0x4604a9=_['merge']({},_0x4604a9,_0x47d434[_0x665f('0x42')]);return _0x200b2e['getActions'](_0x4604a9);}})[_0x665f('0x26')](function(_0x56b5be){if(_0x56b5be){_0x58562d=_0x56b5be['length'];if(!_0x47d434[_0x665f('0x32')][_0x665f('0x39')]('nolimit')){_0x4604a9[_0x665f('0x1e')]=qs[_0x665f('0x1e')](_0x47d434[_0x665f('0x32')][_0x665f('0x1e')]);_0x4604a9['offset']=qs[_0x665f('0x1c')](_0x47d434[_0x665f('0x32')]['offset']);}return _0x200b2e[_0x665f('0x5a')](_0x4604a9);}})[_0x665f('0x26')](function(_0x5e6a63){if(_0x5e6a63){return _0x5e6a63?{'count':_0x58562d,'rows':_0x5e6a63}:null;}})['then'](respondWithResult(_0x110139,null))[_0x665f('0x4d')](handleError(_0x110139,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f2d1f17..c55ae96 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 _0x62da=['moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api'];(function(_0x4b1643,_0x270da2){var _0x412a67=function(_0xb36e99){while(--_0xb36e99){_0x4b1643['push'](_0x4b1643['shift']());}};_0x412a67(++_0x270da2);}(_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 +var _0x7c8e=['exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x2b2489,_0x289ae2){var _0x387771=function(_0x5d8fe0){while(--_0x5d8fe0){_0x2b2489['push'](_0x2b2489['shift']());}};_0x387771(++_0x289ae2);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0x7c8e[_0x4a77e4];return _0x1c68d8;};'use strict';var _=require('lodash');var util=require(_0xe7c8('0x0'));var logger=require(_0xe7c8('0x1'))(_0xe7c8('0x2'));var moment=require(_0xe7c8('0x3'));var BPromise=require(_0xe7c8('0x4'));var rp=require(_0xe7c8('0x5'));var fs=require('fs');var path=require(_0xe7c8('0x6'));var rimraf=require(_0xe7c8('0x7'));var config=require(_0xe7c8('0x8'));var attributes=require(_0xe7c8('0x9'));module[_0xe7c8('0xa')]=function(_0x1f0a65,_0x293383){return _0x1f0a65[_0xe7c8('0xb')](_0xe7c8('0xc'),attributes,{'tableName':_0xe7c8('0xd'),'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 459f6eb..dd48517 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 _0x9af2=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x9af2,0x84));var _0x29af=function(_0x4fe2c6,_0x27be92){_0x4fe2c6=_0x4fe2c6-0x0;var _0x5c574a=_0x9af2[_0x4fe2c6];return _0x5c574a;};'use strict';var _=require(_0x29af('0x0'));var util=require(_0x29af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29af('0x2'));var fs=require('fs');var Redis=require(_0x29af('0x3'));var db=require(_0x29af('0x4'))['db'];var utils=require(_0x29af('0x5'));var logger=require(_0x29af('0x6'))('rpc');var config=require(_0x29af('0x7'));var jayson=require(_0x29af('0x8'));var client=jayson[_0x29af('0x9')][_0x29af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa2c6d8,_0x5c3d25,_0x1a6a6c){return new BPromise(function(_0x266d9,_0x51c6f1){return client[_0x29af('0xb')](_0xa2c6d8,_0x1a6a6c)[_0x29af('0xc')](function(_0x3bd8d4){logger[_0x29af('0xd')](_0x29af('0xe'),_0x5c3d25,'request\x20sent');logger[_0x29af('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x5c3d25,'request\x20sent',JSON[_0x29af('0x10')](_0x3bd8d4));if(_0x3bd8d4['error']){if(_0x3bd8d4[_0x29af('0x11')]['code']===0x1f4){logger[_0x29af('0x11')]('Trigger,\x20%s,\x20%s',_0x5c3d25,_0x3bd8d4['error'][_0x29af('0x12')]);return _0x51c6f1(_0x3bd8d4[_0x29af('0x11')][_0x29af('0x12')]);}logger[_0x29af('0x11')]('Trigger,\x20%s,\x20%s',_0x5c3d25,_0x3bd8d4[_0x29af('0x11')]['message']);return _0x266d9(_0x3bd8d4[_0x29af('0x11')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x5c3d25,_0x29af('0x13'));_0x266d9(_0x3bd8d4[_0x29af('0x14')][_0x29af('0x12')]);}})[_0x29af('0x15')](function(_0x47a347){logger[_0x29af('0x11')](_0x29af('0xe'),_0x5c3d25,_0x47a347);_0x51c6f1(_0x47a347);});});}exports[_0x29af('0x16')]=function(_0x1d712e){var _0x23dd6e=this;return new Promise(function(_0x5815b4,_0x1a3894){return db[_0x29af('0x17')][_0x29af('0x18')]({'raw':_0x1d712e[_0x29af('0x19')]?_0x1d712e[_0x29af('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d712e[_0x29af('0x19')]?_0x1d712e[_0x29af('0x19')][_0x29af('0x1a')]||null:null,'attributes':_0x1d712e['options']?_0x1d712e[_0x29af('0x19')][_0x29af('0x1b')]||null:null,'limit':_0x1d712e['options']?_0x1d712e['options'][_0x29af('0x1c')]||null:null,'include':_0x1d712e['options']?_0x1d712e[_0x29af('0x19')][_0x29af('0x1d')]?_[_0x29af('0x1e')](_0x1d712e[_0x29af('0x19')]['include'],function(_0x62f089){return{'model':db[_0x62f089[_0x29af('0x1f')]],'as':_0x62f089['as'],'attributes':_0x62f089['attributes'],'include':_0x62f089[_0x29af('0x1d')]?_['map'](_0x62f089[_0x29af('0x1d')],function(_0x11c65f){return{'model':db[_0x11c65f[_0x29af('0x1f')]],'as':_0x11c65f['as'],'attributes':_0x11c65f[_0x29af('0x1b')],'include':_0x11c65f['include']?_[_0x29af('0x1e')](_0x11c65f['include'],function(_0x3b64e7){return{'model':db[_0x3b64e7[_0x29af('0x1f')]],'as':_0x3b64e7['as'],'attributes':_0x3b64e7[_0x29af('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x29af('0xc')](function(_0x29bffd){logger['info'](_0x29af('0x16'),_0x1d712e);logger[_0x29af('0xf')](_0x29af('0x16'),_0x1d712e,JSON[_0x29af('0x10')](_0x29bffd));_0x5815b4(_0x29bffd);})[_0x29af('0x15')](function(_0x475fe5){logger[_0x29af('0x11')](_0x29af('0x16'),_0x475fe5['message'],_0x1d712e);_0x1a3894(_0x23dd6e['error'](0x1f4,_0x475fe5['message']));});});};exports[_0x29af('0x20')]=function(_0x27f793){var _0xdd68ee=this;return new Promise(function(_0x582368,_0x466dea){return db[_0x29af('0x17')]['find']({'raw':_0x27f793[_0x29af('0x19')]?_0x27f793[_0x29af('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x27f793['options']?_0x27f793[_0x29af('0x19')][_0x29af('0x1a')]||null:null,'attributes':_0x27f793[_0x29af('0x19')]?_0x27f793['options']['attributes']||null:null,'include':_0x27f793[_0x29af('0x19')]?_0x27f793[_0x29af('0x19')]['include']?_[_0x29af('0x1e')](_0x27f793['options'][_0x29af('0x1d')],function(_0x1b246f){return{'model':db[_0x1b246f[_0x29af('0x1f')]],'as':_0x1b246f['as'],'attributes':_0x1b246f['attributes'],'include':_0x1b246f['include']?_[_0x29af('0x1e')](_0x1b246f['include'],function(_0x38dbc9){return{'model':db[_0x38dbc9['model']],'as':_0x38dbc9['as'],'attributes':_0x38dbc9['attributes'],'include':_0x38dbc9[_0x29af('0x1d')]?_[_0x29af('0x1e')](_0x38dbc9[_0x29af('0x1d')],function(_0x3d9400){return{'model':db[_0x3d9400[_0x29af('0x1f')]],'as':_0x3d9400['as'],'attributes':_0x3d9400[_0x29af('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x29af('0xc')](function(_0x3aeb38){logger['info'](_0x29af('0x20'),_0x27f793);logger[_0x29af('0xf')](_0x29af('0x20'),_0x27f793,JSON[_0x29af('0x10')](_0x3aeb38));_0x582368(_0x3aeb38);})[_0x29af('0x15')](function(_0x28a4af){logger[_0x29af('0x11')]('ShowTrigger',_0x28a4af[_0x29af('0x12')],_0x27f793);_0x466dea(_0xdd68ee[_0x29af('0x11')](0x1f4,_0x28a4af[_0x29af('0x12')]));});});}; \ No newline at end of file +var _0xd3c3=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','map','include','model','find','ShowTrigger','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x3e9f54,_0x3ec08d){var _0x2333bb=function(_0x4942f5){while(--_0x4942f5){_0x3e9f54['push'](_0x3e9f54['shift']());}};_0x2333bb(++_0x3ec08d);}(_0xd3c3,0x18a));var _0x3d3c=function(_0x2fdcf5,_0x3b72d6){_0x2fdcf5=_0x2fdcf5-0x0;var _0x516336=_0xd3c3[_0x2fdcf5];return _0x516336;};'use strict';var _=require(_0x3d3c('0x0'));var util=require(_0x3d3c('0x1'));var moment=require(_0x3d3c('0x2'));var BPromise=require(_0x3d3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d3c('0x4'));var logger=require(_0x3d3c('0x5'))(_0x3d3c('0x6'));var config=require(_0x3d3c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3d3c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a1ff0,_0xc7f71b,_0x249110){return new BPromise(function(_0x79bf51,_0x40b761){return client[_0x3d3c('0x9')](_0x2a1ff0,_0x249110)[_0x3d3c('0xa')](function(_0x23adca){logger[_0x3d3c('0xb')](_0x3d3c('0xc'),_0xc7f71b,_0x3d3c('0xd'));logger[_0x3d3c('0xe')](_0x3d3c('0xf'),_0xc7f71b,_0x3d3c('0xd'),JSON[_0x3d3c('0x10')](_0x23adca));if(_0x23adca[_0x3d3c('0x11')]){if(_0x23adca['error'][_0x3d3c('0x12')]===0x1f4){logger['error'](_0x3d3c('0xc'),_0xc7f71b,_0x23adca[_0x3d3c('0x11')][_0x3d3c('0x13')]);return _0x40b761(_0x23adca['error'][_0x3d3c('0x13')]);}logger['error']('Trigger,\x20%s,\x20%s',_0xc7f71b,_0x23adca[_0x3d3c('0x11')][_0x3d3c('0x13')]);return _0x79bf51(_0x23adca[_0x3d3c('0x11')][_0x3d3c('0x13')]);}else{logger[_0x3d3c('0xb')](_0x3d3c('0xc'),_0xc7f71b,'request\x20sent');_0x79bf51(_0x23adca[_0x3d3c('0x14')][_0x3d3c('0x13')]);}})[_0x3d3c('0x15')](function(_0xa3d8f){logger[_0x3d3c('0x11')](_0x3d3c('0xc'),_0xc7f71b,_0xa3d8f);_0x40b761(_0xa3d8f);});});}exports[_0x3d3c('0x16')]=function(_0x4141bd){var _0x13a677=this;return new Promise(function(_0x4db41a,_0x262b4f){return db[_0x3d3c('0x17')][_0x3d3c('0x18')]({'raw':_0x4141bd[_0x3d3c('0x19')]?_0x4141bd['options'][_0x3d3c('0x1a')]===undefined?!![]:![]:!![],'where':_0x4141bd[_0x3d3c('0x19')]?_0x4141bd[_0x3d3c('0x19')][_0x3d3c('0x1b')]||null:null,'attributes':_0x4141bd[_0x3d3c('0x19')]?_0x4141bd['options'][_0x3d3c('0x1c')]||null:null,'limit':_0x4141bd[_0x3d3c('0x19')]?_0x4141bd[_0x3d3c('0x19')]['limit']||null:null,'include':_0x4141bd[_0x3d3c('0x19')]?_0x4141bd[_0x3d3c('0x19')]['include']?_[_0x3d3c('0x1d')](_0x4141bd[_0x3d3c('0x19')][_0x3d3c('0x1e')],function(_0x275d04){return{'model':db[_0x275d04[_0x3d3c('0x1f')]],'as':_0x275d04['as'],'attributes':_0x275d04[_0x3d3c('0x1c')],'include':_0x275d04['include']?_[_0x3d3c('0x1d')](_0x275d04[_0x3d3c('0x1e')],function(_0x54e74a){return{'model':db[_0x54e74a[_0x3d3c('0x1f')]],'as':_0x54e74a['as'],'attributes':_0x54e74a[_0x3d3c('0x1c')],'include':_0x54e74a[_0x3d3c('0x1e')]?_[_0x3d3c('0x1d')](_0x54e74a['include'],function(_0x5f4f16){return{'model':db[_0x5f4f16[_0x3d3c('0x1f')]],'as':_0x5f4f16['as'],'attributes':_0x5f4f16[_0x3d3c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3d3c('0xa')](function(_0x2119d3){logger[_0x3d3c('0xb')](_0x3d3c('0x16'),_0x4141bd);logger[_0x3d3c('0xe')](_0x3d3c('0x16'),_0x4141bd,JSON['stringify'](_0x2119d3));_0x4db41a(_0x2119d3);})['catch'](function(_0x2e9055){logger['error'](_0x3d3c('0x16'),_0x2e9055[_0x3d3c('0x13')],_0x4141bd);_0x262b4f(_0x13a677[_0x3d3c('0x11')](0x1f4,_0x2e9055[_0x3d3c('0x13')]));});});};exports['ShowTrigger']=function(_0x480c9e){var _0x44e255=this;return new Promise(function(_0x15fbb2,_0x59be80){return db[_0x3d3c('0x17')][_0x3d3c('0x20')]({'raw':_0x480c9e[_0x3d3c('0x19')]?_0x480c9e[_0x3d3c('0x19')][_0x3d3c('0x1a')]===undefined?!![]:![]:!![],'where':_0x480c9e[_0x3d3c('0x19')]?_0x480c9e['options']['where']||null:null,'attributes':_0x480c9e[_0x3d3c('0x19')]?_0x480c9e[_0x3d3c('0x19')][_0x3d3c('0x1c')]||null:null,'include':_0x480c9e[_0x3d3c('0x19')]?_0x480c9e['options']['include']?_[_0x3d3c('0x1d')](_0x480c9e[_0x3d3c('0x19')][_0x3d3c('0x1e')],function(_0x199a1e){return{'model':db[_0x199a1e[_0x3d3c('0x1f')]],'as':_0x199a1e['as'],'attributes':_0x199a1e[_0x3d3c('0x1c')],'include':_0x199a1e[_0x3d3c('0x1e')]?_['map'](_0x199a1e[_0x3d3c('0x1e')],function(_0x1edbea){return{'model':db[_0x1edbea[_0x3d3c('0x1f')]],'as':_0x1edbea['as'],'attributes':_0x1edbea['attributes'],'include':_0x1edbea[_0x3d3c('0x1e')]?_[_0x3d3c('0x1d')](_0x1edbea['include'],function(_0x1986a4){return{'model':db[_0x1986a4[_0x3d3c('0x1f')]],'as':_0x1986a4['as'],'attributes':_0x1986a4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d3c('0xa')](function(_0xb02cea){logger[_0x3d3c('0xb')]('ShowTrigger',_0x480c9e);logger[_0x3d3c('0xe')](_0x3d3c('0x21'),_0x480c9e,JSON[_0x3d3c('0x10')](_0xb02cea));_0x15fbb2(_0xb02cea);})[_0x3d3c('0x15')](function(_0x358ec6){logger[_0x3d3c('0x11')]('ShowTrigger',_0x358ec6[_0x3d3c('0x13')],_0x480c9e);_0x59be80(_0x44e255[_0x3d3c('0x11')](0x1f4,_0x358ec6['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 230201a..5798fb6 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 _0xe371=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','/:id/clone','clone','put','update','destroy','util'];(function(_0x293521,_0x452878){var _0x2db60d=function(_0x11c55c){while(--_0x11c55c){_0x293521['push'](_0x293521['shift']());}};_0x2db60d(++_0x452878);}(_0xe371,0xff));var _0x1e37=function(_0x25fa9c,_0x872939){_0x25fa9c=_0x25fa9c-0x0;var _0x4a3cb6=_0xe371[_0x25fa9c];return _0x4a3cb6;};'use strict';var multer=require('multer');var util=require(_0x1e37('0x0'));var path=require('path');var timeout=require(_0x1e37('0x1'));var express=require(_0x1e37('0x2'));var router=express[_0x1e37('0x3')]();var fs_extra=require(_0x1e37('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e37('0x5'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x1e37('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e37('0x6')](_0x1e37('0x7'),auth[_0x1e37('0x8')](),controller[_0x1e37('0x9')]);router[_0x1e37('0xa')](_0x1e37('0xb'),auth[_0x1e37('0x8')](),controller[_0x1e37('0xc')]);router[_0x1e37('0xa')]('/',auth[_0x1e37('0x8')](),controller['create']);router[_0x1e37('0xd')]('/:id',auth[_0x1e37('0x8')](),controller[_0x1e37('0xe')]);router['delete']('/:id',auth[_0x1e37('0x8')](),controller[_0x1e37('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5218=['clone','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x33f273,_0x5a5ec9){var _0x279d56=function(_0x3ba124){while(--_0x3ba124){_0x33f273['push'](_0x33f273['shift']());}};_0x279d56(++_0x5a5ec9);}(_0x5218,0x1be));var _0x8521=function(_0x317088,_0x11f3de){_0x317088=_0x317088-0x0;var _0x4007dd=_0x5218[_0x317088];return _0x4007dd;};'use strict';var multer=require(_0x8521('0x0'));var util=require(_0x8521('0x1'));var path=require(_0x8521('0x2'));var timeout=require(_0x8521('0x3'));var express=require(_0x8521('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(_0x8521('0x5'));var controller=require(_0x8521('0x6'));router[_0x8521('0x7')]('/',auth[_0x8521('0x8')](),controller[_0x8521('0x9')]);router[_0x8521('0x7')](_0x8521('0xa'),auth['isAuthenticated'](),controller[_0x8521('0xb')]);router[_0x8521('0xc')](_0x8521('0xd'),auth[_0x8521('0x8')](),controller[_0x8521('0xe')]);router[_0x8521('0xc')]('/',auth[_0x8521('0x8')](),controller[_0x8521('0xf')]);router[_0x8521('0x10')](_0x8521('0xa'),auth[_0x8521('0x8')](),controller[_0x8521('0x11')]);router[_0x8521('0x12')](_0x8521('0xa'),auth[_0x8521('0x8')](),controller[_0x8521('0x13')]);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 73baef6..bcd2a11 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 _0x20a3=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','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','port,invite','insecure'];(function(_0x4987e3,_0x516cf9){var _0x2985ef=function(_0x22ee54){while(--_0x22ee54){_0x4987e3['push'](_0x4987e3['shift']());}};_0x2985ef(++_0x516cf9);}(_0x20a3,0xeb));var _0x320a=function(_0x19415f,_0x3bc6a1){_0x19415f=_0x19415f-0x0;var _0x1d8c10=_0x20a3[_0x19415f];return _0x1d8c10;};'use strict';var Sequelize=require('sequelize');module[_0x320a('0x0')]={'name':{'type':Sequelize[_0x320a('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x3'),_0x320a('0x4'),_0x320a('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x320a('0x1')],'allowNull':![],'defaultValue':_0x320a('0x6')},'callingpres':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x7'),_0x320a('0x8'),'ALLOWED_FAILED_SCREEN',_0x320a('0x9'),_0x320a('0xa'),_0x320a('0xb'),_0x320a('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x320a('0x1')]},'secret':{'type':Sequelize[_0x320a('0x1')]},'md5secret':{'type':Sequelize[_0x320a('0x1')]},'remotesecret':{'type':Sequelize[_0x320a('0x1')]},'transport':{'type':Sequelize[_0x320a('0x1')],'defaultValue':_0x320a('0xd'),'set':function(_0xe3df19){this[_0x320a('0xe')](_0x320a('0xf'),_0xe3df19?_0xe3df19[_0x320a('0x10')](','):null);},'get':function(){return this[_0x320a('0x11')](_0x320a('0xf'))?this[_0x320a('0x11')](_0x320a('0xf'))[_0x320a('0x12')](','):null;},'comment':_0x320a('0x13')},'dtmfmode':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x14'),_0x320a('0x15'),_0x320a('0x16'),'inband',_0x320a('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no','nonat',_0x320a('0x19'),_0x320a('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x320a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x320a('0x1b'),'set':function(_0x16b33e){this[_0x320a('0xe')](_0x320a('0x1c'),_0x16b33e?_0x16b33e[_0x320a('0x10')](','):null);},'get':function(){return this[_0x320a('0x11')]('nat')?this['getDataValue']('nat')[_0x320a('0x12')](','):null;},'comment':_0x320a('0x1d')},'callgroup':{'type':Sequelize[_0x320a('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x320a('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x320a('0x1')]},'language':{'type':Sequelize[_0x320a('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x320a('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x320a('0x1')],'defaultValue':_0x320a('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x320a('0x1f'),'set':function(_0x270a04){this[_0x320a('0xe')]('allow',_0x270a04?_0x270a04[_0x320a('0x10')](';'):_0x320a('0x1f'));},'get':function(){return this['getDataValue'](_0x320a('0x20'))?this[_0x320a('0x11')](_0x320a('0x20'))[_0x320a('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'insecure':{'type':Sequelize[_0x320a('0x1')],'defaultValue':_0x320a('0x21'),'set':function(_0x16bbbb){this[_0x320a('0xe')](_0x320a('0x22'),_0x16bbbb?_0x16bbbb[_0x320a('0x10')](','):null);},'get':function(){return this[_0x320a('0x11')](_0x320a('0x22'))?this['getDataValue'](_0x320a('0x22'))[_0x320a('0x12')](','):null;},'comment':_0x320a('0x23')},'trustrpid':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x320a('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no',_0x320a('0x24'))},'promiscredir':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x320a('0x1')]},'callerid':{'type':Sequelize[_0x320a('0x1')],'defaultValue':_0x320a('0x25')},'amaflags':{'type':Sequelize[_0x320a('0x1')]},'callcounter':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x320a('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x320a('0x1')]},'template':{'type':Sequelize[_0x320a('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x320a('0x18'),'no',_0x320a('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x320a('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x320a('0x1')]},'session_timers':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x28'),_0x320a('0x29'),_0x320a('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x320a('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x2b'),_0x320a('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x320a('0x1')]},'regexten':{'type':Sequelize[_0x320a('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x320a('0x1')]},'port':{'type':Sequelize[_0x320a('0x26')](0x5)},'qualify':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no'),'defaultValue':_0x320a('0x18')},'keepalive':{'type':Sequelize[_0x320a('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x320a('0x1')]},'defaultuser':{'type':Sequelize[_0x320a('0x1')]},'rtptimeout':{'type':Sequelize[_0x320a('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x320a('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no',_0x320a('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x320a('0x1')]},'callbackextension':{'type':Sequelize[_0x320a('0x1')]},'timert1':{'type':Sequelize[_0x320a('0x26')](0xb)},'timerb':{'type':Sequelize[_0x320a('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x320a('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x320a('0x1')]},'contactdeny':{'type':Sequelize[_0x320a('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x320a('0x1')]},'use_q850_reason':{'type':Sequelize[_0x320a('0x1')]},'maxforwards':{'type':Sequelize[_0x320a('0x26')](0xb)},'encryption':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x320a('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x320a('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x320a('0x18'),'no',_0x320a('0x2e'),_0x320a('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x320a('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x320a('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x320a('0x1')]},'dtlscafile':{'type':Sequelize[_0x320a('0x1')]},'dtlscapath':{'type':Sequelize[_0x320a('0x1')]},'dtlssetup':{'type':Sequelize[_0x320a('0x2')]('active',_0x320a('0x30'),_0x320a('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x320a('0x1')]},'usereqphone':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x320a('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x320a('0x1')]},'mohinterpret':{'type':Sequelize[_0x320a('0x1')]},'mohsuggest':{'type':Sequelize[_0x320a('0x1')]},'parkinglot':{'type':Sequelize[_0x320a('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x320a('0x1')],'defaultValue':_0x320a('0x32')},'canreinvite':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x18'),'no',_0x320a('0x33'),_0x320a('0x19'),_0x320a('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x320a('0x1')]},'otherFields':{'type':Sequelize[_0x320a('0x1')]},'active':{'type':Sequelize[_0x320a('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x320a('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe6fe=['rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','shortinfo'];(function(_0x388347,_0x111683){var _0x1f06b4=function(_0xd2027d){while(--_0xd2027d){_0x388347['push'](_0x388347['shift']());}};_0x1f06b4(++_0x111683);}(_0xe6fe,0xdf));var _0xee6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe6fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xee6f('0x0')]={'name':{'type':Sequelize[_0xee6f('0x1')],'allowNull':![],'unique':_0xee6f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x4'),'user',_0xee6f('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xee6f('0x1')],'allowNull':![],'defaultValue':_0xee6f('0x6')},'callingpres':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x7'),_0xee6f('0x8'),_0xee6f('0x9'),_0xee6f('0xa'),_0xee6f('0xb'),_0xee6f('0xc'),_0xee6f('0xd'),_0xee6f('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xee6f('0x1')]},'remotesecret':{'type':Sequelize[_0xee6f('0x1')]},'transport':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':_0xee6f('0xf'),'set':function(_0x4b07f2){this[_0xee6f('0x10')](_0xee6f('0x11'),_0x4b07f2?_0x4b07f2[_0xee6f('0x12')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xee6f('0x13')](_0xee6f('0x11'))[_0xee6f('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xee6f('0x3')]('rfc2833','info',_0xee6f('0x15'),'inband','auto'),'defaultValue':_0xee6f('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no',_0xee6f('0x18'),_0xee6f('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xee6f('0x1')]},'directmediadeny':{'type':Sequelize[_0xee6f('0x1')]},'nat':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':_0xee6f('0x1a'),'set':function(_0x4d049d){this[_0xee6f('0x10')](_0xee6f('0x1b'),_0x4d049d?_0x4d049d[_0xee6f('0x12')](','):null);},'get':function(){return this[_0xee6f('0x13')](_0xee6f('0x1b'))?this['getDataValue'](_0xee6f('0x1b'))[_0xee6f('0x14')](','):null;},'comment':_0xee6f('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xee6f('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xee6f('0x1')]},'language':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xee6f('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':_0xee6f('0x1d')},'allow':{'type':Sequelize[_0xee6f('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xcd82f6){this[_0xee6f('0x10')](_0xee6f('0x1e'),_0xcd82f6?_0xcd82f6['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xee6f('0x13')](_0xee6f('0x1e'))?this['getDataValue']('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'insecure':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':'port,invite','set':function(_0x215166){this[_0xee6f('0x10')](_0xee6f('0x1f'),_0x215166?_0x215166[_0xee6f('0x12')](','):null);},'get':function(){return this[_0xee6f('0x13')]('insecure')?this['getDataValue'](_0xee6f('0x1f'))['split'](','):null;},'comment':_0xee6f('0x20')},'trustrpid':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no',_0xee6f('0x21'))},'promiscredir':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no')},'accountcode':{'type':Sequelize[_0xee6f('0x22')](0xb)},'setvar':{'type':Sequelize[_0xee6f('0x1')]},'callerid':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':_0xee6f('0x23')},'amaflags':{'type':Sequelize[_0xee6f('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no'),'defaultValue':_0xee6f('0x17')},'busylevel':{'type':Sequelize[_0xee6f('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xee6f('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xee6f('0x1')]},'template':{'type':Sequelize[_0xee6f('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no',_0xee6f('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xee6f('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no')},'mailbox':{'type':Sequelize[_0xee6f('0x1')]},'session_timers':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x25'),'refuse',_0xee6f('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xee6f('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x27'),_0xee6f('0x28')),'defaultValue':_0xee6f('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xee6f('0x1')]},'regexten':{'type':Sequelize[_0xee6f('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xee6f('0x1')]},'port':{'type':Sequelize[_0xee6f('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xee6f('0x1')]},'defaultuser':{'type':Sequelize[_0xee6f('0x1')]},'rtptimeout':{'type':Sequelize[_0xee6f('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xee6f('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no',_0xee6f('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xee6f('0x22')](0xb)},'timerb':{'type':Sequelize[_0xee6f('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xee6f('0x1')]},'contactdeny':{'type':Sequelize[_0xee6f('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xee6f('0x1')]},'use_q850_reason':{'type':Sequelize[_0xee6f('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xee6f('0x17'),'no',_0xee6f('0x2a'),_0xee6f('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xee6f('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xee6f('0x1')]},'dtlscipher':{'type':Sequelize[_0xee6f('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x2c'),_0xee6f('0x2d'),_0xee6f('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xee6f('0x1')]},'usereqphone':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xee6f('0x1')]},'recordofffeature':{'type':Sequelize[_0xee6f('0x1')]},'call_limit':{'type':Sequelize[_0xee6f('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xee6f('0x1')]},'parkinglot':{'type':Sequelize[_0xee6f('0x1')]},'description':{'type':Sequelize[_0xee6f('0x1')]},'host':{'type':Sequelize[_0xee6f('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xee6f('0x3')](_0xee6f('0x17'),'no',_0xee6f('0x18'),_0xee6f('0x19'),_0xee6f('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xee6f('0x1')]},'otherFields':{'type':Sequelize[_0xee6f('0x1')]},'active':{'type':Sequelize[_0xee6f('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xee6f('0x1')],'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 d9dec26..92f9057 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x224c38,_0x4eb599){var _0xe297ac=function(_0x284d15){while(--_0x284d15){_0x224c38['push'](_0x224c38['shift']());}};_0xe297ac(++_0x4eb599);}(_0x54ef,0x112));var _0xf54e=function(_0x275363,_0x3c51ba){_0x275363=_0x275363-0x0;var _0x5e23a2=_0x54ef[_0x275363];return _0x5e23a2;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x24c613,_0x1a0f9e){var _0x4b6160=function(_0x4fbdfa){while(--_0x4fbdfa){_0x24c613['push'](_0x24c613['shift']());}};_0x4b6160(++_0x1a0f9e);}(_0x9a19,0x114));var _0x99a1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9a19[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 50c69df..eea7668 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 _0x0b0a=['../../config/environment','./trunk.attributes','Trunk','tools_trunks','lodash','../../config/logger','moment','rimraf'];(function(_0x353f08,_0x1510ac){var _0x2b90bd=function(_0x4ac5a8){while(--_0x4ac5a8){_0x353f08['push'](_0x353f08['shift']());}};_0x2b90bd(++_0x1510ac);}(_0x0b0a,0x15c));var _0xa0b0=function(_0x1ed4ee,_0x5f0730){_0x1ed4ee=_0x1ed4ee-0x0;var _0x4eabc9=_0x0b0a[_0x1ed4ee];return _0x4eabc9;};'use strict';var _=require(_0xa0b0('0x0'));var util=require('util');var logger=require(_0xa0b0('0x1'))('api');var moment=require(_0xa0b0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa0b0('0x3'));var config=require(_0xa0b0('0x4'));var attributes=require(_0xa0b0('0x5'));module['exports']=function(_0xc64588,_0x51d012){return _0xc64588['define'](_0xa0b0('0x6'),attributes,{'tableName':_0xa0b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e75=['tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','./trunk.attributes','define'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5e75,0x160));var _0x55e7=function(_0x3492c1,_0x27805d){_0x3492c1=_0x3492c1-0x0;var _0xa8b640=_0x5e75[_0x3492c1];return _0xa8b640;};'use strict';var _=require('lodash');var util=require(_0x55e7('0x0'));var logger=require(_0x55e7('0x1'))(_0x55e7('0x2'));var moment=require(_0x55e7('0x3'));var BPromise=require(_0x55e7('0x4'));var rp=require(_0x55e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x55e7('0x6'));module['exports']=function(_0x493b8b,_0x529f91){return _0x493b8b[_0x55e7('0x7')]('Trunk',attributes,{'tableName':_0x55e7('0x8'),'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 bdebe05..d725ba0 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 _0x7710=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','model','attributes','map','find','ShowTrunk','util','bluebird'];(function(_0x9293db,_0xf7671){var _0x2adc2f=function(_0x1a2fdc){while(--_0x1a2fdc){_0x9293db['push'](_0x9293db['shift']());}};_0x2adc2f(++_0xf7671);}(_0x7710,0x130));var _0x0771=function(_0x5a905e,_0x31aa4a){_0x5a905e=_0x5a905e-0x0;var _0x4124d6=_0x7710[_0x5a905e];return _0x4124d6;};'use strict';var _=require('lodash');var util=require(_0x0771('0x0'));var moment=require('moment');var BPromise=require(_0x0771('0x1'));var rs=require(_0x0771('0x2'));var fs=require('fs');var Redis=require(_0x0771('0x3'));var db=require(_0x0771('0x4'))['db'];var utils=require(_0x0771('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0771('0x6'));var client=jayson[_0x0771('0x7')][_0x0771('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x589f48,_0x457220,_0x498827){return new BPromise(function(_0x2d3745,_0x2e2a90){return client[_0x0771('0x9')](_0x589f48,_0x498827)[_0x0771('0xa')](function(_0x2ac9be){logger['info'](_0x0771('0xb'),_0x457220,_0x0771('0xc'));logger[_0x0771('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x457220,_0x0771('0xc'),JSON[_0x0771('0xe')](_0x2ac9be));if(_0x2ac9be[_0x0771('0xf')]){if(_0x2ac9be[_0x0771('0xf')][_0x0771('0x10')]===0x1f4){logger['error'](_0x0771('0xb'),_0x457220,_0x2ac9be[_0x0771('0xf')][_0x0771('0x11')]);return _0x2e2a90(_0x2ac9be['error'][_0x0771('0x11')]);}logger[_0x0771('0xf')](_0x0771('0xb'),_0x457220,_0x2ac9be[_0x0771('0xf')][_0x0771('0x11')]);return _0x2d3745(_0x2ac9be[_0x0771('0xf')][_0x0771('0x11')]);}else{logger[_0x0771('0x12')](_0x0771('0xb'),_0x457220,_0x0771('0xc'));_0x2d3745(_0x2ac9be[_0x0771('0x13')]['message']);}})[_0x0771('0x14')](function(_0x4dae8a){logger['error'](_0x0771('0xb'),_0x457220,_0x4dae8a);_0x2e2a90(_0x4dae8a);});});}exports[_0x0771('0x15')]=function(_0x2527e6){var _0x2c58da=this;return new Promise(function(_0x59b1eb,_0x1eef5b){return db[_0x0771('0x16')][_0x0771('0x17')]({'raw':_0x2527e6[_0x0771('0x18')]?_0x2527e6[_0x0771('0x18')][_0x0771('0x19')]===undefined?!![]:![]:!![],'where':_0x2527e6[_0x0771('0x18')]?_0x2527e6[_0x0771('0x18')][_0x0771('0x1a')]||null:null,'attributes':_0x2527e6[_0x0771('0x18')]?_0x2527e6[_0x0771('0x18')]['attributes']||null:null,'limit':_0x2527e6['options']?_0x2527e6['options'][_0x0771('0x1b')]||null:null,'include':_0x2527e6[_0x0771('0x18')]?_0x2527e6[_0x0771('0x18')]['include']?_['map'](_0x2527e6['options'][_0x0771('0x1c')],function(_0x1b813a){return{'model':db[_0x1b813a[_0x0771('0x1d')]],'as':_0x1b813a['as'],'attributes':_0x1b813a[_0x0771('0x1e')],'include':_0x1b813a[_0x0771('0x1c')]?_[_0x0771('0x1f')](_0x1b813a[_0x0771('0x1c')],function(_0x21f1a3){return{'model':db[_0x21f1a3[_0x0771('0x1d')]],'as':_0x21f1a3['as'],'attributes':_0x21f1a3['attributes'],'include':_0x21f1a3[_0x0771('0x1c')]?_[_0x0771('0x1f')](_0x21f1a3[_0x0771('0x1c')],function(_0xd17279){return{'model':db[_0xd17279[_0x0771('0x1d')]],'as':_0xd17279['as'],'attributes':_0xd17279['attributes']};}):[]};}):[]};}):[]:[]})[_0x0771('0xa')](function(_0x144e97){logger[_0x0771('0x12')](_0x0771('0x15'),_0x2527e6);logger[_0x0771('0xd')](_0x0771('0x15'),_0x2527e6,JSON['stringify'](_0x144e97));_0x59b1eb(_0x144e97);})[_0x0771('0x14')](function(_0x5da54f){logger['error']('GetTrunk',_0x5da54f[_0x0771('0x11')],_0x2527e6);_0x1eef5b(_0x2c58da[_0x0771('0xf')](0x1f4,_0x5da54f[_0x0771('0x11')]));});});};exports['ShowTrunk']=function(_0x28e358){var _0x286524=this;return new Promise(function(_0x483f8b,_0x48239c){return db[_0x0771('0x16')][_0x0771('0x20')]({'raw':_0x28e358[_0x0771('0x18')]?_0x28e358[_0x0771('0x18')][_0x0771('0x19')]===undefined?!![]:![]:!![],'where':_0x28e358['options']?_0x28e358[_0x0771('0x18')][_0x0771('0x1a')]||null:null,'attributes':_0x28e358[_0x0771('0x18')]?_0x28e358['options'][_0x0771('0x1e')]||null:null,'include':_0x28e358['options']?_0x28e358[_0x0771('0x18')][_0x0771('0x1c')]?_[_0x0771('0x1f')](_0x28e358[_0x0771('0x18')]['include'],function(_0xe940c3){return{'model':db[_0xe940c3[_0x0771('0x1d')]],'as':_0xe940c3['as'],'attributes':_0xe940c3[_0x0771('0x1e')],'include':_0xe940c3[_0x0771('0x1c')]?_['map'](_0xe940c3[_0x0771('0x1c')],function(_0x1499ee){return{'model':db[_0x1499ee[_0x0771('0x1d')]],'as':_0x1499ee['as'],'attributes':_0x1499ee[_0x0771('0x1e')],'include':_0x1499ee['include']?_[_0x0771('0x1f')](_0x1499ee['include'],function(_0x474357){return{'model':db[_0x474357[_0x0771('0x1d')]],'as':_0x474357['as'],'attributes':_0x474357['attributes']};}):[]};}):[]};}):[]:[]})[_0x0771('0xa')](function(_0x2819b9){logger[_0x0771('0x12')](_0x0771('0x21'),_0x28e358);logger['debug'](_0x0771('0x21'),_0x28e358,JSON[_0x0771('0xe')](_0x2819b9));_0x483f8b(_0x2819b9);})['catch'](function(_0x122c4b){logger[_0x0771('0xf')]('ShowTrunk',_0x122c4b[_0x0771('0x11')],_0x28e358);_0x48239c(_0x286524[_0x0771('0xf')](0x1f4,_0x122c4b[_0x0771('0x11')]));});});}; \ No newline at end of file +var _0x149f=['code','message','result','GetTrunk','Trunk','findAll','options','limit','include','map','model','attributes','catch','ShowTrunk','where','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x149f,0xa8));var _0xf149=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x149f[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xf149('0x0'));var util=require(_0xf149('0x1'));var moment=require(_0xf149('0x2'));var BPromise=require(_0xf149('0x3'));var rs=require(_0xf149('0x4'));var fs=require('fs');var Redis=require(_0xf149('0x5'));var db=require(_0xf149('0x6'))['db'];var utils=require(_0xf149('0x7'));var logger=require(_0xf149('0x8'))(_0xf149('0x9'));var config=require(_0xf149('0xa'));var jayson=require(_0xf149('0xb'));var client=jayson[_0xf149('0xc')][_0xf149('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdc579,_0x516db7,_0xdb321a){return new BPromise(function(_0x4b21d7,_0x5a068e){return client[_0xf149('0xe')](_0xdc579,_0xdb321a)[_0xf149('0xf')](function(_0x5cdf1e){logger[_0xf149('0x10')](_0xf149('0x11'),_0x516db7,'request\x20sent');logger['debug'](_0xf149('0x12'),_0x516db7,_0xf149('0x13'),JSON[_0xf149('0x14')](_0x5cdf1e));if(_0x5cdf1e[_0xf149('0x15')]){if(_0x5cdf1e[_0xf149('0x15')][_0xf149('0x16')]===0x1f4){logger[_0xf149('0x15')](_0xf149('0x11'),_0x516db7,_0x5cdf1e[_0xf149('0x15')][_0xf149('0x17')]);return _0x5a068e(_0x5cdf1e[_0xf149('0x15')][_0xf149('0x17')]);}logger[_0xf149('0x15')](_0xf149('0x11'),_0x516db7,_0x5cdf1e[_0xf149('0x15')][_0xf149('0x17')]);return _0x4b21d7(_0x5cdf1e[_0xf149('0x15')][_0xf149('0x17')]);}else{logger[_0xf149('0x10')](_0xf149('0x11'),_0x516db7,_0xf149('0x13'));_0x4b21d7(_0x5cdf1e[_0xf149('0x18')]['message']);}})['catch'](function(_0x362391){logger['error'](_0xf149('0x11'),_0x516db7,_0x362391);_0x5a068e(_0x362391);});});}exports[_0xf149('0x19')]=function(_0x3e8d35){var _0xcfe8a7=this;return new Promise(function(_0x1178d2,_0xd217cb){return db[_0xf149('0x1a')][_0xf149('0x1b')]({'raw':_0x3e8d35[_0xf149('0x1c')]?_0x3e8d35[_0xf149('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3e8d35[_0xf149('0x1c')]?_0x3e8d35[_0xf149('0x1c')]['where']||null:null,'attributes':_0x3e8d35[_0xf149('0x1c')]?_0x3e8d35[_0xf149('0x1c')]['attributes']||null:null,'limit':_0x3e8d35[_0xf149('0x1c')]?_0x3e8d35['options'][_0xf149('0x1d')]||null:null,'include':_0x3e8d35[_0xf149('0x1c')]?_0x3e8d35['options'][_0xf149('0x1e')]?_[_0xf149('0x1f')](_0x3e8d35[_0xf149('0x1c')][_0xf149('0x1e')],function(_0x9bd06f){return{'model':db[_0x9bd06f[_0xf149('0x20')]],'as':_0x9bd06f['as'],'attributes':_0x9bd06f[_0xf149('0x21')],'include':_0x9bd06f[_0xf149('0x1e')]?_[_0xf149('0x1f')](_0x9bd06f[_0xf149('0x1e')],function(_0x1a6c08){return{'model':db[_0x1a6c08['model']],'as':_0x1a6c08['as'],'attributes':_0x1a6c08['attributes'],'include':_0x1a6c08[_0xf149('0x1e')]?_[_0xf149('0x1f')](_0x1a6c08[_0xf149('0x1e')],function(_0x381bc0){return{'model':db[_0x381bc0[_0xf149('0x20')]],'as':_0x381bc0['as'],'attributes':_0x381bc0[_0xf149('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x495377){logger[_0xf149('0x10')]('GetTrunk',_0x3e8d35);logger['debug']('GetTrunk',_0x3e8d35,JSON[_0xf149('0x14')](_0x495377));_0x1178d2(_0x495377);})[_0xf149('0x22')](function(_0x246a95){logger['error'](_0xf149('0x19'),_0x246a95[_0xf149('0x17')],_0x3e8d35);_0xd217cb(_0xcfe8a7[_0xf149('0x15')](0x1f4,_0x246a95[_0xf149('0x17')]));});});};exports[_0xf149('0x23')]=function(_0x57516a){var _0x53f662=this;return new Promise(function(_0x8e42cf,_0x36b336){return db[_0xf149('0x1a')]['find']({'raw':_0x57516a[_0xf149('0x1c')]?_0x57516a['options']['raw']===undefined?!![]:![]:!![],'where':_0x57516a[_0xf149('0x1c')]?_0x57516a['options'][_0xf149('0x24')]||null:null,'attributes':_0x57516a['options']?_0x57516a[_0xf149('0x1c')][_0xf149('0x21')]||null:null,'include':_0x57516a[_0xf149('0x1c')]?_0x57516a[_0xf149('0x1c')][_0xf149('0x1e')]?_[_0xf149('0x1f')](_0x57516a[_0xf149('0x1c')][_0xf149('0x1e')],function(_0x4395c2){return{'model':db[_0x4395c2[_0xf149('0x20')]],'as':_0x4395c2['as'],'attributes':_0x4395c2[_0xf149('0x21')],'include':_0x4395c2['include']?_['map'](_0x4395c2[_0xf149('0x1e')],function(_0x2ac99e){return{'model':db[_0x2ac99e['model']],'as':_0x2ac99e['as'],'attributes':_0x2ac99e['attributes'],'include':_0x2ac99e[_0xf149('0x1e')]?_[_0xf149('0x1f')](_0x2ac99e[_0xf149('0x1e')],function(_0x1126f2){return{'model':db[_0x1126f2[_0xf149('0x20')]],'as':_0x1126f2['as'],'attributes':_0x1126f2[_0xf149('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf149('0xf')](function(_0x11e2b9){logger[_0xf149('0x10')](_0xf149('0x23'),_0x57516a);logger[_0xf149('0x25')](_0xf149('0x23'),_0x57516a,JSON[_0xf149('0x14')](_0x11e2b9));_0x8e42cf(_0x11e2b9);})[_0xf149('0x22')](function(_0x101029){logger['error']('ShowTrunk',_0x101029['message'],_0x57516a);_0x36b336(_0x53f662['error'](0x1f4,_0x101029[_0xf149('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 76a62af..b3342e9 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 _0x6dda=['./user-setting.controller','put','isAuthenticated','exports','../../components/auth/service'];(function(_0x44d287,_0x4e69da){var _0x442554=function(_0x5c0951){while(--_0x5c0951){_0x44d287['push'](_0x44d287['shift']());}};_0x442554(++_0x4e69da);}(_0x6dda,0x10d));var _0xa6dd=function(_0x11d5d7,_0xc0e94d){_0x11d5d7=_0x11d5d7-0x0;var _0x3731aa=_0x6dda[_0x11d5d7];return _0x3731aa;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa6dd('0x0'));var controller=require(_0xa6dd('0x1'));router[_0xa6dd('0x2')]('/:id',auth[_0xa6dd('0x3')](),controller['update']);module[_0xa6dd('0x4')]=router; \ No newline at end of file +var _0x9fdd=['exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x5d5373,_0x10cd97){var _0x360a4a=function(_0x59f281){while(--_0x59f281){_0x5d5373['push'](_0x5d5373['shift']());}};_0x360a4a(++_0x10cd97);}(_0x9fdd,0x121));var _0xd9fd=function(_0x168630,_0x3dc280){_0x168630=_0x168630-0x0;var _0x1cdc51=_0x9fdd[_0x168630];return _0x1cdc51;};'use strict';var express=require(_0xd9fd('0x0'));var router=express[_0xd9fd('0x1')]();var auth=require(_0xd9fd('0x2'));var controller=require(_0xd9fd('0x3'));router['put'](_0xd9fd('0x4'),auth[_0xd9fd('0x5')](),controller[_0xd9fd('0x6')]);module[_0xd9fd('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 14d8878..0205e72 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 _0xfc04=['sequelize','warning','info','debug','exports','ENUM','error','BOOLEAN','TEXT','INTEGER','UserId'];(function(_0x533d50,_0xc01bcd){var _0x249aba=function(_0x1dc9c8){while(--_0x1dc9c8){_0x533d50['push'](_0x533d50['shift']());}};_0x249aba(++_0xc01bcd);}(_0xfc04,0x6e));var _0x4fc0=function(_0x8a2f13,_0x37bad0){_0x8a2f13=_0x8a2f13-0x0;var _0x2243ea=_0xfc04[_0x8a2f13];return _0x2243ea;};'use strict';var Sequelize=require(_0x4fc0('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x4fc0('0x1'),_0x4fc0('0x2'),_0x4fc0('0x3')];module[_0x4fc0('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x4fc0('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4fc0('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4fc0('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x4fc0('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x4fc0('0x9')],'unique':_0x4fc0('0xa')}}; \ No newline at end of file +var _0x6bf9=['ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','debug','exports'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x6bf9,0xff));var _0x96bf=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x6bf9[_0x15942a];return _0x36a9fb;};'use strict';var Sequelize=require(_0x96bf('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x96bf('0x1'),_0x96bf('0x2'),'info',_0x96bf('0x3')];module[_0x96bf('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x96bf('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x96bf('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x96bf('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x96bf('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x96bf('0x8')],'unique':_0x96bf('0x9')}}; \ 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 1f50b75..aba5cc1 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 _0xcea5=['name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','then','sendStatus','stack'];(function(_0x4c667c,_0x26e15d){var _0x19a2df=function(_0xd3d6c2){while(--_0xd3d6c2){_0x4c667c['push'](_0x4c667c['shift']());}};_0x19a2df(++_0x26e15d);}(_0xcea5,0xed));var _0x5cea=function(_0x11ae7f,_0x44ea49){_0x11ae7f=_0x11ae7f-0x0;var _0x588113=_0xcea5[_0x11ae7f];return _0x588113;};'use strict';var _=require(_0x5cea('0x0'));var Redis=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var config=require(_0x5cea('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x5cea('0x5'))(new Redis(config[_0x5cea('0x6')]));require(_0x5cea('0x7'))[_0x5cea('0x8')](socket);config['redis']=_[_0x5cea('0x9')](config[_0x5cea('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x49db13,_0x59f337){_0x59f337=_0x59f337||0xc8;return function(_0x502d95){if(_0x502d95){return _0x49db13[_0x5cea('0xa')](_0x59f337)[_0x5cea('0xb')](_0x502d95);}};}function saveUpdates(_0x4dd30e){return function(_0x429558){if(_0x429558){return _0x429558['update'](_0x4dd30e)[_0x5cea('0xc')](function(_0x177986){return _0x177986;});}return null;};}function handleEntityNotFound(_0x1c9e9f){return function(_0x23b85f){if(!_0x23b85f){_0x1c9e9f[_0x5cea('0xd')](0x194);}return _0x23b85f;};}function handleError(_0x130ed3,_0x21ecc9){_0x21ecc9=_0x21ecc9||0x1f4;return function(_0x9f846){logger['error'](_0x9f846[_0x5cea('0xe')]);if(_0x9f846[_0x5cea('0xf')]){delete _0x9f846[_0x5cea('0xf')];}_0x130ed3[_0x5cea('0xa')](_0x21ecc9)[_0x5cea('0x10')](_0x9f846);};}exports[_0x5cea('0x11')]=function(_0x2d0965,_0x349ca8){if(_0x2d0965[_0x5cea('0x12')][_0x5cea('0x13')]!==_0x5cea('0x14'))throw new Error(_0x5cea('0x15'));if(isNaN(Number(_0x2d0965[_0x5cea('0x16')]['id'])))throw new Error(_0x5cea('0x17'));return db[_0x5cea('0x18')][_0x5cea('0x19')]({'where':{'id':_0x2d0965[_0x5cea('0x16')]['id']}})[_0x5cea('0xc')](handleEntityNotFound(_0x349ca8,null))[_0x5cea('0xc')](saveUpdates(_0x2d0965[_0x5cea('0x1a')],null))[_0x5cea('0xc')](respondWithResult(_0x349ca8,null))[_0x5cea('0x1b')](handleError(_0x349ca8,null));}; \ No newline at end of file +var _0xe14f=['defaults','localhost','status','json','update','sendStatus','error','name','send','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','then','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket'];(function(_0xff72e8,_0x5dca7c){var _0x39e303=function(_0xc39f90){while(--_0xc39f90){_0xff72e8['push'](_0xff72e8['shift']());}};_0x39e303(++_0x5dca7c);}(_0xe14f,0xea));var _0xfe14=function(_0x563678,_0x594017){_0x563678=_0x563678-0x0;var _0x2abae1=_0xe14f[_0x563678];return _0x2abae1;};'use strict';var _=require(_0xfe14('0x0'));var Redis=require(_0xfe14('0x1'));var logger=require(_0xfe14('0x2'))(_0xfe14('0x3'));var config=require(_0xfe14('0x4'));var db=require(_0xfe14('0x5'))['db'];var socket=require(_0xfe14('0x6'))(new Redis(config[_0xfe14('0x7')]));require(_0xfe14('0x8'))['register'](socket);config['redis']=_[_0xfe14('0x9')](config['redis'],{'host':_0xfe14('0xa'),'port':0x18eb});function respondWithResult(_0x174635,_0x14e1c8){_0x14e1c8=_0x14e1c8||0xc8;return function(_0x350c85){if(_0x350c85){return _0x174635[_0xfe14('0xb')](_0x14e1c8)[_0xfe14('0xc')](_0x350c85);}};}function saveUpdates(_0x2f92e4){return function(_0x396b63){if(_0x396b63){return _0x396b63[_0xfe14('0xd')](_0x2f92e4)['then'](function(_0x2a85b0){return _0x2a85b0;});}return null;};}function handleEntityNotFound(_0x3a8713){return function(_0x2bc525){if(!_0x2bc525){_0x3a8713[_0xfe14('0xe')](0x194);}return _0x2bc525;};}function handleError(_0x32f55d,_0x618719){_0x618719=_0x618719||0x1f4;return function(_0x4ae9a6){logger[_0xfe14('0xf')](_0x4ae9a6['stack']);if(_0x4ae9a6[_0xfe14('0x10')]){delete _0x4ae9a6[_0xfe14('0x10')];}_0x32f55d[_0xfe14('0xb')](_0x618719)[_0xfe14('0x11')](_0x4ae9a6);};}exports[_0xfe14('0xd')]=function(_0x390736,_0x56ad1f){if(_0x390736['user'][_0xfe14('0x12')]!==_0xfe14('0x13'))throw new Error(_0xfe14('0x14'));if(isNaN(Number(_0x390736['params']['id'])))throw new Error(_0xfe14('0x15'));return db['UserSetting'][_0xfe14('0x16')]({'where':{'id':_0x390736[_0xfe14('0x17')]['id']}})[_0xfe14('0x18')](handleEntityNotFound(_0x56ad1f,null))[_0xfe14('0x18')](saveUpdates(_0x390736[_0xfe14('0x19')],null))[_0xfe14('0x18')](respondWithResult(_0x56ad1f,null))[_0xfe14('0x1a')](handleError(_0x56ad1f,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 1e02454..4ebec3a 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 _0x95bd=['events','../../mysqldb','UserSetting','setMaxListeners','remove','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95bd,0xf0));var _0xd95b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95bd[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xd95b('0x0'));var UserSetting=require(_0xd95b('0x1'))['db'][_0xd95b('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xd95b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd95b('0x4')};function emitEvent(_0x312e50){return function(_0x3656f3,_0x87474d,_0xa16347){UserSettingEvents[_0xd95b('0x5')](_0x312e50+':'+_0x3656f3['id'],_0x3656f3);UserSettingEvents[_0xd95b('0x5')](_0x312e50,_0x3656f3);_0xa16347(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xd95b('0x6')](e,emitEvent(event));}}module[_0xd95b('0x7')]=UserSettingEvents; \ No newline at end of file +var _0xbf3e=['setMaxListeners','save','update','remove','hook','events','../../mysqldb'];(function(_0x126a29,_0x260c22){var _0x2e3ecd=function(_0x4ed343){while(--_0x4ed343){_0x126a29['push'](_0x126a29['shift']());}};_0x2e3ecd(++_0x260c22);}(_0xbf3e,0x194));var _0xebf3=function(_0x373b5c,_0xfd7e30){_0x373b5c=_0x373b5c-0x0;var _0x21c50f=_0xbf3e[_0x373b5c];return _0x21c50f;};'use strict';var EventEmitter=require(_0xebf3('0x0'));var UserSetting=require(_0xebf3('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xebf3('0x2')](0x0);var events={'afterCreate':_0xebf3('0x3'),'afterUpdate':_0xebf3('0x4'),'afterDestroy':_0xebf3('0x5')};function emitEvent(_0x3edd29){return function(_0x1c1137,_0x5d69bd,_0x34b771){UserSettingEvents['emit'](_0x3edd29+':'+_0x1c1137['id'],_0x1c1137);UserSettingEvents['emit'](_0x3edd29,_0x1c1137);_0x34b771(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xebf3('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 757a9de..b52d4d5 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 _0x38d0=['define','user_settings','clientSideLoggingEnabledSince','exports'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x38d0,0x123));var _0x038d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x38d0[_0x1694f5];return _0x5b4321;};'use strict';var attributes=require('./user-setting.attributes');module[_0x038d('0x0')]=function(_0x327d9d){return _0x327d9d[_0x038d('0x1')]('UserSetting',attributes,{'tableName':_0x038d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27db0a){if(!_0x27db0a['clientSideLoggingEnabled'])_0x27db0a['clientSideLoggingEnabledSince']=null;else if(_0x27db0a[_0x038d('0x3')]===null)_0x27db0a['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x9c2c=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x98ff8,_0x1abf9e){var _0x13a724=function(_0x31e03e){while(--_0x31e03e){_0x98ff8['push'](_0x98ff8['shift']());}};_0x13a724(++_0x1abf9e);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xc9c2('0x0'));module[_0xc9c2('0x1')]=function(_0x4ac695){return _0x4ac695['define']('UserSetting',attributes,{'tableName':_0xc9c2('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ac3bb){if(!_0x4ac3bb[_0xc9c2('0x3')])_0x4ac3bb[_0xc9c2('0x4')]=null;else if(_0x4ac3bb['clientSideLoggingEnabledSince']===null)_0x4ac3bb['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index b57cf1b..72e950a 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 _0xb945=['register','user-setting:','./user-setting.events','save','remove','UserId'];(function(_0x15f30f,_0x2fcb37){var _0x5717ed=function(_0x28437e){while(--_0x28437e){_0x15f30f['push'](_0x15f30f['shift']());}};_0x5717ed(++_0x2fcb37);}(_0xb945,0x1ca));var _0x5b94=function(_0x31de34,_0x3a0e9d){_0x31de34=_0x31de34-0x0;var _0x24722d=_0xb945[_0x31de34];return _0x24722d;};'use strict';var UserSettingEvents=require(_0x5b94('0x0'));var events=[_0x5b94('0x1'),_0x5b94('0x2'),'update'];function createListener(_0x26e87c,_0x4c7cf3){return function(_0x3ba98b){_0x4c7cf3['emit'](_0x26e87c,_0x3ba98b);if(_0x26e87c==='user-setting:update'){_0x4c7cf3['emit']('user-setting:update:user-'+_0x3ba98b[_0x5b94('0x3')],_0x3ba98b);}};}exports[_0x5b94('0x4')]=function(_0x2ed8c8){for(var _0x3dc8da=0x0,_0x2779a3=events['length'];_0x3dc8da<_0x2779a3;_0x3dc8da++){var _0x48bb89=events[_0x3dc8da];var _0x501f1f=createListener(_0x5b94('0x5')+_0x48bb89,_0x2ed8c8);UserSettingEvents['on'](_0x48bb89,_0x501f1f);}}; \ No newline at end of file +var _0xf88f=['./user-setting.events','save','remove','emit','user-setting:update','UserId','register','length','user-setting:'];(function(_0x4751ac,_0x4d31b8){var _0x50fc01=function(_0x570e5b){while(--_0x570e5b){_0x4751ac['push'](_0x4751ac['shift']());}};_0x50fc01(++_0x4d31b8);}(_0xf88f,0xb4));var _0xff88=function(_0xa755e,_0x54633b){_0xa755e=_0xa755e-0x0;var _0x307c66=_0xf88f[_0xa755e];return _0x307c66;};'use strict';var UserSettingEvents=require(_0xff88('0x0'));var events=[_0xff88('0x1'),_0xff88('0x2'),'update'];function createListener(_0x2d3522,_0x81e486){return function(_0x3245fb){_0x81e486[_0xff88('0x3')](_0x2d3522,_0x3245fb);if(_0x2d3522===_0xff88('0x4')){_0x81e486[_0xff88('0x3')]('user-setting:update:user-'+_0x3245fb[_0xff88('0x5')],_0x3245fb);}};}exports[_0xff88('0x6')]=function(_0x432bfd){for(var _0x54b4df=0x0,_0x519605=events[_0xff88('0x7')];_0x54b4df<_0x519605;_0x54b4df++){var _0x4fa9a3=events[_0x54b4df];var _0x1bfffd=createListener(_0xff88('0x8')+_0x4fa9a3,_0x432bfd);UserSettingEvents['on'](_0x4fa9a3,_0x1bfffd);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0051f3d..f5c3c9e 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 _0xb24d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','post','addContacts','create','/create_many','bulkCreate','addQueues','join','root','format','%s-%s','now','originalname','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','path','connect-timeout','express'];(function(_0x5482f1,_0x8d7cac){var _0x1847bf=function(_0x4a7e1d){while(--_0x4a7e1d){_0x5482f1['push'](_0x5482f1['shift']());}};_0x1847bf(++_0x8d7cac);}(_0xb24d,0x1b4));var _0xdb24=function(_0x5e2803,_0x289436){_0x5e2803=_0x5e2803-0x0;var _0xb63d7c=_0xb24d[_0x5e2803];return _0xb63d7c;};'use strict';var multer=require('multer');var util=require(_0xdb24('0x0'));var path=require(_0xdb24('0x1'));var timeout=require(_0xdb24('0x2'));var express=require(_0xdb24('0x3'));var router=express['Router']();var fs_extra=require(_0xdb24('0x4'));var auth=require(_0xdb24('0x5'));var interaction=require(_0xdb24('0x6'));var config=require(_0xdb24('0x7'));var controller=require(_0xdb24('0x8'));router[_0xdb24('0x9')]('/',auth[_0xdb24('0xa')](),controller[_0xdb24('0xb')]);router[_0xdb24('0x9')](_0xdb24('0xc'),auth[_0xdb24('0xa')](),controller['describe']);router[_0xdb24('0x9')](_0xdb24('0xd'),auth[_0xdb24('0xa')](),controller['whoami']);router[_0xdb24('0x9')](_0xdb24('0xe'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xdb24('0xf'),auth['isAuthenticated'](),controller[_0xdb24('0x10')]);router['get'](_0xdb24('0x11'),controller[_0xdb24('0x12')]);router['get'](_0xdb24('0x13'),auth['isAuthenticated'](),controller['getOpenTabs']);router['get'](_0xdb24('0x14'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x15')]);router[_0xdb24('0x9')](_0xdb24('0x16'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x17')]);router[_0xdb24('0x9')](_0xdb24('0x18'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x19')]);router['get'](_0xdb24('0x1a'),auth['isAuthenticated'](),controller[_0xdb24('0x1b')]);router[_0xdb24('0x9')]('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router[_0xdb24('0x9')]('/:id/screen_recordings',auth[_0xdb24('0xa')](),controller[_0xdb24('0x1c')]);router[_0xdb24('0x9')](_0xdb24('0x1d'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x1e')]);router[_0xdb24('0x9')](_0xdb24('0x1f'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x20')]);router['get'](_0xdb24('0x21'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x22')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xdb24('0x9')]('/:id/fax/interactions',auth[_0xdb24('0xa')](),controller[_0xdb24('0x23')]);router['get'](_0xdb24('0x24'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x25')]);router[_0xdb24('0x9')](_0xdb24('0x26'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x27')]);router[_0xdb24('0x9')]('/:id/lists',auth[_0xdb24('0xa')](),controller[_0xdb24('0x28')]);router['get'](_0xdb24('0x29'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x2a')]);router['get'](_0xdb24('0x2b'),auth['isAuthenticated'](),controller[_0xdb24('0x2c')]);router['get'](_0xdb24('0x2d'),auth[_0xdb24('0xa')](),controller['getFaxAccounts']);router['get'](_0xdb24('0x2e'),auth[_0xdb24('0xa')](),controller['getMailAccounts']);router['get'](_0xdb24('0x2f'),auth['isAuthenticated'](),controller[_0xdb24('0x30')]);router[_0xdb24('0x9')](_0xdb24('0x31'),auth[_0xdb24('0xa')](),controller['getSmsAccounts']);router[_0xdb24('0x9')](_0xdb24('0x32'),auth[_0xdb24('0xa')](),controller['getChatWebsites']);router['get'](_0xdb24('0x33'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x34')]);router[_0xdb24('0x9')](_0xdb24('0x35'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xdb24('0x9')]('/:id/api_key',auth[_0xdb24('0xa')](),controller['getApiKey']);router[_0xdb24('0x36')](_0xdb24('0x14'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x37')]);router['post']('/',auth[_0xdb24('0xa')](),controller[_0xdb24('0x38')]);router[_0xdb24('0x36')](_0xdb24('0x39'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x3a')]);router['post'](_0xdb24('0x16'),auth['isAuthenticated'](),controller[_0xdb24('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ac0fc,_0x31dca9,_0x346232){_0x346232(null,path[_0xdb24('0x3c')](config[_0xdb24('0x3d')],'server/files/images/'));},'filename':function(_0x1f8b47,_0x44e7ff,_0x2d069e){_0x2d069e(null,util[_0xdb24('0x3e')](_0xdb24('0x3f'),Date[_0xdb24('0x40')](),_0x44e7ff[_0xdb24('0x41')]));}})});router[_0xdb24('0x36')](_0xdb24('0x11'),upload['single']('file'),controller[_0xdb24('0x42')]);router['post'](_0xdb24('0x43'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x44')]);router[_0xdb24('0x36')]('/:id/logout',auth[_0xdb24('0xa')](),controller[_0xdb24('0x45')]);router[_0xdb24('0x36')]('/:id/pause',auth[_0xdb24('0xa')](),controller[_0xdb24('0x46')]);router[_0xdb24('0x36')](_0xdb24('0x47'),auth['isAuthenticated'](),controller[_0xdb24('0x48')]);router[_0xdb24('0x36')](_0xdb24('0x26'),auth['isAuthenticated'](),controller['addTeams']);router[_0xdb24('0x36')](_0xdb24('0x49'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x4a')]);router[_0xdb24('0x36')](_0xdb24('0x4b'),auth['isAuthenticated'](),controller[_0xdb24('0x4c')]);router['post']('/:id/fax_interactions',auth[_0xdb24('0xa')](),controller[_0xdb24('0x4d')]);router[_0xdb24('0x36')](_0xdb24('0x4e'),auth['isAuthenticated'](),controller[_0xdb24('0x4f')]);router['post']('/:id/openchannel_interactions',auth[_0xdb24('0xa')](),controller['addOpenchannelInteractions']);router[_0xdb24('0x36')](_0xdb24('0x50'),auth['isAuthenticated'](),controller[_0xdb24('0x51')]);router[_0xdb24('0x36')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xdb24('0x52')]);router[_0xdb24('0x36')](_0xdb24('0x2e'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x53')]);router[_0xdb24('0x36')](_0xdb24('0x2f'),auth[_0xdb24('0xa')](),controller['addOpenchannelAccounts']);router[_0xdb24('0x36')](_0xdb24('0x31'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x54')]);router[_0xdb24('0x36')]('/:id/chat_websites',auth[_0xdb24('0xa')](),controller[_0xdb24('0x55')]);router[_0xdb24('0x36')](_0xdb24('0x33'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x56')]);router['post'](_0xdb24('0x57'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x58')]);router[_0xdb24('0x59')](_0xdb24('0xf'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x5a')]);router[_0xdb24('0x59')](_0xdb24('0x5b'),auth['isAuthenticated'](),controller[_0xdb24('0x5c')]);router[_0xdb24('0x5d')]('/:id/queues',auth[_0xdb24('0xa')](),controller['removeQueues']);router[_0xdb24('0x5d')](_0xdb24('0x26'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x5e')]);router[_0xdb24('0x5d')]('/:id',auth[_0xdb24('0xa')](),controller['destroy']);router[_0xdb24('0x5d')](_0xdb24('0x49'),auth['isAuthenticated'](),controller[_0xdb24('0x5f')]);router[_0xdb24('0x5d')](_0xdb24('0x4b'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x60')]);router[_0xdb24('0x5d')](_0xdb24('0x61'),auth[_0xdb24('0xa')](),controller['removeFaxInteractions']);router['delete'](_0xdb24('0x4e'),auth['isAuthenticated'](),controller[_0xdb24('0x62')]);router[_0xdb24('0x5d')](_0xdb24('0x63'),auth[_0xdb24('0xa')](),controller['removeOpenchannelInteractions']);router[_0xdb24('0x5d')](_0xdb24('0x50'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x64')]);router[_0xdb24('0x5d')](_0xdb24('0x2d'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x65')]);router[_0xdb24('0x5d')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xdb24('0x66')]);router[_0xdb24('0x5d')](_0xdb24('0x2f'),auth[_0xdb24('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xdb24('0xa')](),controller[_0xdb24('0x67')]);router[_0xdb24('0x5d')](_0xdb24('0x32'),auth[_0xdb24('0xa')](),controller[_0xdb24('0x68')]);router[_0xdb24('0x5d')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xdb24('0x69')]);router[_0xdb24('0x5d')]('/:id/api_key',auth[_0xdb24('0xa')](),controller[_0xdb24('0x6a')]);router[_0xdb24('0x36')](_0xdb24('0x6b'),auth['isAuthenticated'](),controller[_0xdb24('0x6c')]);module[_0xdb24('0x6d')]=router; \ No newline at end of file +var _0xc0d7=['addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','removeQueues','removeTeams','delete','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','/whoami','whoami','/presence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/chat_websites','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','addQueues','diskStorage','join','server/files/images/','format','originalname','single','addAvatar','/:id/logout','/:id/pause','pause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts'];(function(_0x8dec24,_0x903de0){var _0x381de1=function(_0x1aceb4){while(--_0x1aceb4){_0x8dec24['push'](_0x8dec24['shift']());}};_0x381de1(++_0x903de0);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x1b2012,_0x578fcd){_0x1b2012=_0x1b2012-0x0;var _0x4ce18a=_0xc0d7[_0x1b2012];return _0x4ce18a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7c0d('0x0'));var express=require(_0x7c0d('0x1'));var router=express[_0x7c0d('0x2')]();var fs_extra=require(_0x7c0d('0x3'));var auth=require(_0x7c0d('0x4'));var interaction=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var controller=require(_0x7c0d('0x7'));router[_0x7c0d('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c0d('0x9')]);router[_0x7c0d('0x8')](_0x7c0d('0xa'),auth[_0x7c0d('0xb')](),controller['describe']);router[_0x7c0d('0x8')](_0x7c0d('0xc'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0xd')]);router['get'](_0x7c0d('0xe'),auth[_0x7c0d('0xb')](),controller['getPresence']);router['get'](_0x7c0d('0xf'),auth[_0x7c0d('0xb')](),controller['show']);router[_0x7c0d('0x8')](_0x7c0d('0x10'),controller[_0x7c0d('0x11')]);router[_0x7c0d('0x8')](_0x7c0d('0x12'),auth[_0x7c0d('0xb')](),controller['getOpenTabs']);router[_0x7c0d('0x8')](_0x7c0d('0x13'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x14')]);router[_0x7c0d('0x8')](_0x7c0d('0x15'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x16')]);router['get'](_0x7c0d('0x17'),auth['isAuthenticated'](),controller[_0x7c0d('0x18')]);router['get'](_0x7c0d('0x19'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x1a')]);router[_0x7c0d('0x8')](_0x7c0d('0x1b'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x1c')]);router[_0x7c0d('0x8')](_0x7c0d('0x1d'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x1e')]);router[_0x7c0d('0x8')](_0x7c0d('0x1f'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x20')]);router[_0x7c0d('0x8')](_0x7c0d('0x21'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x22')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0x7c0d('0x23'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x24')]);router[_0x7c0d('0x8')](_0x7c0d('0x25'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x26')]);router['get'](_0x7c0d('0x27'),auth[_0x7c0d('0xb')](),controller['getWhatsappInteractions']);router['get'](_0x7c0d('0x28'),auth['isAuthenticated'](),controller[_0x7c0d('0x29')]);router[_0x7c0d('0x8')](_0x7c0d('0x2a'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x2b')]);router['get'](_0x7c0d('0x2c'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x2d')]);router[_0x7c0d('0x8')](_0x7c0d('0x2e'),auth['isAuthenticated'](),controller[_0x7c0d('0x2f')]);router['get'](_0x7c0d('0x30'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x31')]);router[_0x7c0d('0x8')](_0x7c0d('0x32'),auth[_0x7c0d('0xb')](),controller['getMailAccounts']);router[_0x7c0d('0x8')]('/:id/openchannel_accounts',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x33')]);router['get']('/:id/sms_accounts',auth[_0x7c0d('0xb')](),controller['getSmsAccounts']);router[_0x7c0d('0x8')](_0x7c0d('0x34'),auth['isAuthenticated'](),controller['getChatWebsites']);router['get']('/:id/whatsapp_accounts',auth[_0x7c0d('0xb')](),controller['getWhatsappAccounts']);router[_0x7c0d('0x8')](_0x7c0d('0x35'),auth['isAuthenticated'](),controller[_0x7c0d('0x36')]);router[_0x7c0d('0x8')](_0x7c0d('0x37'),auth[_0x7c0d('0xb')](),controller['getApiKey']);router[_0x7c0d('0x38')](_0x7c0d('0x13'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x39')]);router[_0x7c0d('0x38')]('/',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x3a')]);router[_0x7c0d('0x38')](_0x7c0d('0x3b'),auth[_0x7c0d('0xb')](),controller['bulkCreate']);router[_0x7c0d('0x38')](_0x7c0d('0x15'),auth['isAuthenticated'](),controller[_0x7c0d('0x3c')]);var upload=multer({'storage':multer[_0x7c0d('0x3d')]({'destination':function(_0x35f3c3,_0x1b723b,_0x304606){_0x304606(null,path[_0x7c0d('0x3e')](config['root'],_0x7c0d('0x3f')));},'filename':function(_0x169eff,_0x309f6b,_0xf06cef){_0xf06cef(null,util[_0x7c0d('0x40')]('%s-%s',Date['now'](),_0x309f6b[_0x7c0d('0x41')]));}})});router[_0x7c0d('0x38')]('/:id/avatar',upload[_0x7c0d('0x42')]('file'),controller[_0x7c0d('0x43')]);router[_0x7c0d('0x38')]('/:id/login',auth[_0x7c0d('0xb')](),controller['login']);router[_0x7c0d('0x38')](_0x7c0d('0x44'),auth['isAuthenticated'](),controller['logout']);router['post'](_0x7c0d('0x45'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x46')]);router[_0x7c0d('0x38')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x7c0d('0x47')]);router['post']('/:id/teams',auth[_0x7c0d('0xb')](),controller['addTeams']);router[_0x7c0d('0x38')](_0x7c0d('0x48'),auth['isAuthenticated'](),controller[_0x7c0d('0x49')]);router[_0x7c0d('0x38')](_0x7c0d('0x4a'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x4b')]);router['post'](_0x7c0d('0x4c'),auth[_0x7c0d('0xb')](),controller['addFaxInteractions']);router[_0x7c0d('0x38')](_0x7c0d('0x4d'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x4e')]);router['post'](_0x7c0d('0x4f'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x50')]);router[_0x7c0d('0x38')](_0x7c0d('0x51'),auth['isAuthenticated'](),controller[_0x7c0d('0x52')]);router['post'](_0x7c0d('0x30'),auth['isAuthenticated'](),controller[_0x7c0d('0x53')]);router[_0x7c0d('0x38')](_0x7c0d('0x32'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x54')]);router['post'](_0x7c0d('0x55'),auth['isAuthenticated'](),controller[_0x7c0d('0x56')]);router[_0x7c0d('0x38')](_0x7c0d('0x57'),auth['isAuthenticated'](),controller[_0x7c0d('0x58')]);router['post']('/:id/chat_websites',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x59')]);router[_0x7c0d('0x38')]('/:id/whatsapp_accounts',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x5a')]);router[_0x7c0d('0x38')]('/:id/api_key',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x5b')]);router[_0x7c0d('0x5c')](_0x7c0d('0xf'),auth[_0x7c0d('0xb')](),controller['update']);router['put'](_0x7c0d('0x5d'),auth[_0x7c0d('0xb')](),controller['changePassword']);router['delete'](_0x7c0d('0x15'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x5e')]);router['delete'](_0x7c0d('0x28'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x5f')]);router[_0x7c0d('0x60')](_0x7c0d('0xf'),auth[_0x7c0d('0xb')](),controller['destroy']);router['delete'](_0x7c0d('0x48'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x61')]);router['delete'](_0x7c0d('0x4a'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x62')]);router[_0x7c0d('0x60')]('/:id/fax_interactions',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x63')]);router[_0x7c0d('0x60')](_0x7c0d('0x4d'),auth[_0x7c0d('0xb')](),controller['removeSmsInteractions']);router['delete'](_0x7c0d('0x4f'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x64')]);router[_0x7c0d('0x60')](_0x7c0d('0x51'),auth['isAuthenticated'](),controller[_0x7c0d('0x65')]);router[_0x7c0d('0x60')](_0x7c0d('0x30'),auth['isAuthenticated'](),controller[_0x7c0d('0x66')]);router[_0x7c0d('0x60')]('/:id/mail_accounts',auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x67')]);router[_0x7c0d('0x60')](_0x7c0d('0x55'),auth[_0x7c0d('0xb')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0x7c0d('0xb')](),controller['removeSmsAccounts']);router[_0x7c0d('0x60')](_0x7c0d('0x34'),auth[_0x7c0d('0xb')](),controller['removeChatWebsites']);router[_0x7c0d('0x60')](_0x7c0d('0x68'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x69')]);router['delete'](_0x7c0d('0x37'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x6a')]);router[_0x7c0d('0x38')](_0x7c0d('0x6b'),auth[_0x7c0d('0xb')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 56a53e4..ebf72ea 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 _0x3ec6=['The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','ENUM','admin','agent','telephone','local','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','udp','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','exports','STRING','name','setDataValue','defaultuser'];(function(_0x5436ac,_0x320210){var _0x314b37=function(_0x3e85fd){while(--_0x3e85fd){_0x5436ac['push'](_0x5436ac['shift']());}};_0x314b37(++_0x320210);}(_0x3ec6,0xb3));var _0x63ec=function(_0x1a5f33,_0x3ea978){_0x1a5f33=_0x1a5f33-0x0;var _0xf552c2=_0x3ec6[_0x1a5f33];return _0xf552c2;};'use strict';var Sequelize=require(_0x63ec('0x0'));var moment=require(_0x63ec('0x1'));var util=require('util');var _=require('lodash');module[_0x63ec('0x2')]={'name':{'type':Sequelize[_0x63ec('0x3')],'allowNull':![],'unique':_0x63ec('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2246f6){this[_0x63ec('0x5')]('name',_0x2246f6);this[_0x63ec('0x5')](_0x63ec('0x6'),_0x2246f6);},'comment':_0x63ec('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3acef2){this['setDataValue'](_0x63ec('0x8'),_0x3acef2);this['setDataValue'](_0x63ec('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x3acef2,this[_0x63ec('0xa')](_0x63ec('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x63ec('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x51ddda){if(_0x51ddda){this[_0x63ec('0x5')](_0x63ec('0xc'),_0x51ddda['toLowerCase']());}}},'role':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0xe'),'user',_0x63ec('0xf'),_0x63ec('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x63ec('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x63ec('0x3')],'defaultValue':_0x63ec('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x63ec('0xb'),'set':function(_0x57348b){this['setDataValue'](_0x63ec('0xb'),_0x57348b);this['setDataValue'](_0x63ec('0x12'),_0x57348b);this['setDataValue'](_0x63ec('0x9'),util[_0x63ec('0x13')](_0x63ec('0x14'),this['getDataValue'](_0x63ec('0x8')),_0x57348b));}},'salt':{'type':Sequelize[_0x63ec('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x63ec('0x3')]},'address':{'type':Sequelize[_0x63ec('0x3')]},'zipcode':{'type':Sequelize[_0x63ec('0x3')]},'userpic':{'type':Sequelize[_0x63ec('0x3')]},'city':{'type':Sequelize[_0x63ec('0x3')]},'country':{'type':Sequelize[_0x63ec('0x3')]},'online':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x63ec('0x16')]},'voicePause':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x63ec('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x63ec('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x63ec('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![],'defaultValue':_0x63ec('0x19')},'ipaddr':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x63ec('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x63ec('0xd')]('friend',_0x63ec('0x1a'),_0x63ec('0x1b')),'allowNull':!![],'defaultValue':_0x63ec('0x1c')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x1d'),_0x63ec('0x1e'),_0x63ec('0x1f'),'ALLOWED',_0x63ec('0x20'),'PROHIB_PASSED_SCREEN',_0x63ec('0x21'),_0x63ec('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x53cf56){this[_0x63ec('0x5')](_0x63ec('0x23'),_0x53cf56?_0x53cf56[_0x63ec('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x63ec('0x23'))?this[_0x63ec('0xa')](_0x63ec('0x23'))[_0x63ec('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x63ec('0x26'),_0x63ec('0x27'),_0x63ec('0x28'),_0x63ec('0x29'),_0x63ec('0x2a')),'allowNull':!![],'defaultValue':_0x63ec('0x26')},'directmedia':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no',_0x63ec('0x2c'),'update',_0x63ec('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![],'defaultValue':_0x63ec('0x2e'),'set':function(_0x3addcc){this[_0x63ec('0x5')](_0x63ec('0x2f'),_0x3addcc?_0x3addcc[_0x63ec('0x24')](','):null);},'get':function(){return this[_0x63ec('0xa')]('nat')?this[_0x63ec('0xa')]('nat')[_0x63ec('0x25')](','):null;},'comment':_0x63ec('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x63ec('0x3')]},'pickupgroup':{'type':Sequelize[_0x63ec('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x63ec('0x3')]},'language':{'type':Sequelize[_0x63ec('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x63ec('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x63ec('0x31')},'allow':{'type':Sequelize[_0x63ec('0x3')],'allowNull':![],'defaultValue':_0x63ec('0x32'),'set':function(_0x3f9ea0){this[_0x63ec('0x5')](_0x63ec('0x33'),_0x3f9ea0?_0x3f9ea0[_0x63ec('0x24')](';'):_0x63ec('0x32'));},'get':function(){return this[_0x63ec('0xa')](_0x63ec('0x33'))?this[_0x63ec('0xa')](_0x63ec('0x33'))['split'](';'):null;},'comment':_0x63ec('0x34')},'autoframing':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![],'set':function(_0x372ec1){this[_0x63ec('0x5')]('insecure',_0x372ec1?_0x372ec1[_0x63ec('0x24')](','):null);},'get':function(){return this[_0x63ec('0xa')](_0x63ec('0x35'))?this[_0x63ec('0xa')](_0x63ec('0x35'))[_0x63ec('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x63ec('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x63ec('0xd')]('yes','no',_0x63ec('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x63ec('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x63ec('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x63ec('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x63ec('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x63ec('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no',_0x63ec('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x63ec('0xd')]('accept',_0x63ec('0x39'),_0x63ec('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x3b'),_0x63ec('0x3c')),'allowNull':!![],'defaultValue':_0x63ec('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x63ec('0x2b')},'keepalive':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x63ec('0xd')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no',_0x63ec('0x3d'),_0x63ec('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x3f'),_0x63ec('0x40'),_0x63ec('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x63ec('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x63ec('0xd')](_0x63ec('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x63ec('0x2b'),'no',_0x63ec('0x2c'),_0x63ec('0x42'),_0x63ec('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x63ec('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x63ec('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x63ec('0x44')]},'showWebBar':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0,'set':function(_0x4db64a){this[_0x63ec('0x5')](_0x63ec('0x45'),_0x4db64a);var _0x4fc200=this[_0x63ec('0x46')]({'plain':!![]});switch(_0x4db64a){case 0x0:case 0x1:var _0x3a6029=_0x4fc200[_0x63ec('0x23')]?_[_0x63ec('0x47')](_0x4fc200[_0x63ec('0x23')])?_0x4fc200[_0x63ec('0x23')][_0x63ec('0x24')]():_0x4fc200[_0x63ec('0x23')]:_0x63ec('0x48');if(_0x3a6029==='wss'){_0x3a6029=_0x63ec('0x48');}this[_0x63ec('0x5')](_0x63ec('0x23'),_0x3a6029);this['setDataValue'](_0x63ec('0x49'),'no');this['setDataValue']('avpf',null);this[_0x63ec('0x5')](_0x63ec('0x4a'),null);this[_0x63ec('0x5')](_0x63ec('0x4b'),null);this[_0x63ec('0x5')](_0x63ec('0x4c'),null);this[_0x63ec('0x5')](_0x63ec('0x4d'),null);this[_0x63ec('0x5')](_0x63ec('0x4e'),null);this[_0x63ec('0x5')](_0x63ec('0x4f'),null);this[_0x63ec('0x5')](_0x63ec('0x50'),null);this['setDataValue'](_0x63ec('0x51'),'no');break;case 0x2:this[_0x63ec('0x5')](_0x63ec('0x23'),'wss');this['setDataValue']('encryption',_0x63ec('0x2b'));this[_0x63ec('0x5')]('avpf',_0x63ec('0x2b'));this['setDataValue'](_0x63ec('0x4a'),_0x63ec('0x2b'));this[_0x63ec('0x5')](_0x63ec('0x4b'),_0x63ec('0x2b'));this[_0x63ec('0x5')]('dtlsenable',_0x63ec('0x2b'));this['setDataValue'](_0x63ec('0x4d'),'no');this[_0x63ec('0x5')](_0x63ec('0x4e'),_0x63ec('0x41'));this[_0x63ec('0x5')](_0x63ec('0x4f'),_0x4fc200[_0x63ec('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x63ec('0x5')]('dtlsprivatekey',_0x4fc200[_0x63ec('0x50')]||'/etc/pki/tls/private/motion.key');this[_0x63ec('0x5')](_0x63ec('0x51'),_0x63ec('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x63ec('0x44')],'set':function(_0x510d42){this[_0x63ec('0x5')](_0x63ec('0x52'),_0x510d42?_0x510d42[_0x63ec('0x24')](','):[]);},'get':function(){return this[_0x63ec('0xa')](_0x63ec('0x52'))?_[_0x63ec('0x53')](this['getDataValue'](_0x63ec('0x52'))['split'](','),function(_0x2fb2b0){return parseInt(_0x2fb2b0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x63ec('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x63ec('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x63ec('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x63ec('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x63ec('0xa')](_0x63ec('0x54'))?this[_0x63ec('0xa')](_0x63ec('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x63ec('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![],'set':function(_0x57f87d){if(typeof _0x57f87d===_0x63ec('0x55')){var _0x441abd=_0x57f87d==='1'?!![]:_0x57f87d==='0'?![]:_0x57f87d===_0x63ec('0x56')?!![]:_0x57f87d===_0x63ec('0x57')?![]:![];this[_0x63ec('0x5')](_0x63ec('0x58'),_0x441abd);}else{this['setDataValue'](_0x63ec('0x58'),_0x57f87d);}}},'blocked':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![],'set':function(_0x12db77){this['setDataValue'](_0x63ec('0x59'),_0x12db77);if(_0x12db77===!![]){this[_0x63ec('0x5')]('blockedAt',moment());this[_0x63ec('0x5')](_0x63ec('0x5a'),0x0);}else{this[_0x63ec('0x5')](_0x63ec('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x63ec('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x63ec('0x18')](0x5)[_0x63ec('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x63ec('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x63ec('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x3b08=['force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','always','accept','refuse','originate','uas','fingerprint','certificate','active','nonat','update','update,nonat','TEXT','get','isArray','udp','wss','encryption','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','actpass','/etc/pki/tls/certs/motion.crt','map','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','exports','STRING','setDataValue','The\x20name\x20of\x20the\x20user','fullname','format','getDataValue','email','toLowerCase','ENUM','admin','user','telephone','INTEGER','internal','accountcode','callerid','\x22%s\x22\x20<%s>','DATE','BOOLEAN','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','outgoing'];(function(_0x5da59e,_0x16baf8){var _0x5d2d3a=function(_0x57328f){while(--_0x57328f){_0x5da59e['push'](_0x5da59e['shift']());}};_0x5d2d3a(++_0x16baf8);}(_0x3b08,0xdc));var _0x83b0=function(_0x4a2da0,_0x4df496){_0x4a2da0=_0x4a2da0-0x0;var _0x1a8642=_0x3b08[_0x4a2da0];return _0x1a8642;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x83b0('0x0'));var util=require(_0x83b0('0x1'));var _=require(_0x83b0('0x2'));module[_0x83b0('0x3')]={'name':{'type':Sequelize[_0x83b0('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x860d60){this[_0x83b0('0x5')]('name',_0x860d60);this[_0x83b0('0x5')]('defaultuser',_0x860d60);},'comment':_0x83b0('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5d0479){this['setDataValue'](_0x83b0('0x7'),_0x5d0479);this[_0x83b0('0x5')]('callerid',util[_0x83b0('0x8')]('\x22%s\x22\x20<%s>',_0x5d0479,this[_0x83b0('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x83b0('0x4')]},'email':{'type':Sequelize[_0x83b0('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x41d8a1){if(_0x41d8a1){this['setDataValue'](_0x83b0('0xa'),_0x41d8a1[_0x83b0('0xb')]());}}},'role':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0xd'),_0x83b0('0xe'),'agent',_0x83b0('0xf')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x83b0('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':![],'unique':_0x83b0('0x11'),'set':function(_0x3fa5d4){this[_0x83b0('0x5')]('internal',_0x3fa5d4);this['setDataValue'](_0x83b0('0x12'),_0x3fa5d4);this[_0x83b0('0x5')](_0x83b0('0x13'),util[_0x83b0('0x8')](_0x83b0('0x14'),this[_0x83b0('0x9')](_0x83b0('0x7')),_0x3fa5d4));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x83b0('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x83b0('0x4')]},'zipcode':{'type':Sequelize[_0x83b0('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x83b0('0x4')]},'country':{'type':Sequelize[_0x83b0('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x83b0('0x15')]},'voicePause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x83b0('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x83b0('0x15')]},'chatCapacity':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x83b0('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x83b0('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x83b0('0x17'),_0x83b0('0xe'),_0x83b0('0x18')),'allowNull':!![],'defaultValue':_0x83b0('0x17')},'context':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![],'defaultValue':_0x83b0('0x19')},'callingpres':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x1a'),_0x83b0('0x1b'),_0x83b0('0x1c'),_0x83b0('0x1d'),'PROHIB_NOT_SCREENED',_0x83b0('0x1e'),_0x83b0('0x1f'),_0x83b0('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3086d4){this['setDataValue'](_0x83b0('0x21'),_0x3086d4?_0x3086d4[_0x83b0('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x83b0('0x21'))?this[_0x83b0('0x9')](_0x83b0('0x21'))[_0x83b0('0x23')](','):null;},'comment':_0x83b0('0x24')},'dtmfmode':{'type':Sequelize['ENUM'](_0x83b0('0x25'),_0x83b0('0x26'),_0x83b0('0x27'),_0x83b0('0x28'),_0x83b0('0x29')),'allowNull':!![],'defaultValue':_0x83b0('0x25')},'directmedia':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no','nonat','update',_0x83b0('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x83b0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![],'defaultValue':_0x83b0('0x2c'),'set':function(_0xc61ab3){this[_0x83b0('0x5')]('nat',_0xc61ab3?_0xc61ab3[_0x83b0('0x22')](','):null);},'get':function(){return this[_0x83b0('0x9')](_0x83b0('0x2d'))?this[_0x83b0('0x9')]('nat')['split'](','):null;},'comment':_0x83b0('0x2e')},'callgroup':{'type':Sequelize[_0x83b0('0x4')]},'namedcallgroup':{'type':Sequelize[_0x83b0('0x4')]},'pickupgroup':{'type':Sequelize[_0x83b0('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x83b0('0x4')]},'language':{'type':Sequelize[_0x83b0('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x83b0('0x4')]},'disallow':{'type':Sequelize[_0x83b0('0x4')],'allowNull':![],'defaultValue':_0x83b0('0x2f')},'allow':{'type':Sequelize[_0x83b0('0x4')],'allowNull':![],'defaultValue':_0x83b0('0x30'),'set':function(_0x5731bb){this[_0x83b0('0x5')](_0x83b0('0x31'),_0x5731bb?_0x5731bb[_0x83b0('0x22')](';'):_0x83b0('0x30'));},'get':function(){return this[_0x83b0('0x9')](_0x83b0('0x31'))?this['getDataValue'](_0x83b0('0x31'))[_0x83b0('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![],'set':function(_0x456ddb){this[_0x83b0('0x5')](_0x83b0('0x32'),_0x456ddb?_0x456ddb['join'](','):null);},'get':function(){return this[_0x83b0('0x9')](_0x83b0('0x32'))?this[_0x83b0('0x9')](_0x83b0('0x32'))[_0x83b0('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x83b0('0xc')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![],'defaultValue':_0x83b0('0x2a')},'busylevel':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x83b0('0xc')]('yes','no',_0x83b0('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x34'),_0x83b0('0x35'),_0x83b0('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x83b0('0xc')]('uac',_0x83b0('0x37')),'allowNull':!![],'defaultValue':_0x83b0('0x37')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![],'defaultValue':_0x83b0('0x2a')},'keepalive':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x83b0('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x83b0('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no',_0x83b0('0x38'),_0x83b0('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x3a'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x83b0('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x83b0('0xc')](_0x83b0('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x83b0('0xc')]('yes','no',_0x83b0('0x3b'),_0x83b0('0x3c'),_0x83b0('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x83b0('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x83b0('0x15')]},'passwordResetAt':{'type':Sequelize[_0x83b0('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x83b0('0x3e')]},'showWebBar':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0,'set':function(_0x4b14ea){this['setDataValue']('showWebBar',_0x4b14ea);var _0x179e48=this[_0x83b0('0x3f')]({'plain':!![]});switch(_0x4b14ea){case 0x0:case 0x1:var _0x514479=_0x179e48[_0x83b0('0x21')]?_[_0x83b0('0x40')](_0x179e48[_0x83b0('0x21')])?_0x179e48[_0x83b0('0x21')][_0x83b0('0x22')]():_0x179e48[_0x83b0('0x21')]:_0x83b0('0x41');if(_0x514479===_0x83b0('0x42')){_0x514479=_0x83b0('0x41');}this[_0x83b0('0x5')](_0x83b0('0x21'),_0x514479);this[_0x83b0('0x5')](_0x83b0('0x43'),'no');this[_0x83b0('0x5')]('avpf',null);this[_0x83b0('0x5')]('force_avp',null);this[_0x83b0('0x5')](_0x83b0('0x44'),null);this[_0x83b0('0x5')](_0x83b0('0x45'),null);this['setDataValue'](_0x83b0('0x46'),null);this[_0x83b0('0x5')](_0x83b0('0x47'),null);this[_0x83b0('0x5')](_0x83b0('0x48'),null);this[_0x83b0('0x5')](_0x83b0('0x49'),null);this[_0x83b0('0x5')](_0x83b0('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x83b0('0x21'),_0x83b0('0x42'));this['setDataValue'](_0x83b0('0x43'),_0x83b0('0x2a'));this[_0x83b0('0x5')]('avpf','yes');this[_0x83b0('0x5')](_0x83b0('0x4b'),_0x83b0('0x2a'));this['setDataValue']('icesupport',_0x83b0('0x2a'));this[_0x83b0('0x5')](_0x83b0('0x45'),_0x83b0('0x2a'));this[_0x83b0('0x5')](_0x83b0('0x46'),'no');this[_0x83b0('0x5')]('dtlssetup',_0x83b0('0x4c'));this['setDataValue'](_0x83b0('0x48'),_0x179e48[_0x83b0('0x48')]||_0x83b0('0x4d'));this[_0x83b0('0x5')](_0x83b0('0x49'),_0x179e48[_0x83b0('0x49')]||'/etc/pki/tls/private/motion.key');this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x569edb){this['setDataValue']('permissions',_0x569edb?_0x569edb[_0x83b0('0x22')](','):[]);},'get':function(){return this[_0x83b0('0x9')]('permissions')?_[_0x83b0('0x4e')](this[_0x83b0('0x9')](_0x83b0('0x4f'))[_0x83b0('0x23')](','),function(_0x132f08){return parseInt(_0x132f08,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x83b0('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x83b0('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x83b0('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x83b0('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x83b0('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x83b0('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x83b0('0x50')],'get':function(){return this['getDataValue'](_0x83b0('0x51'))?this[_0x83b0('0x9')](_0x83b0('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x83b0('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x21f320){if(typeof _0x21f320==='string'){var _0x3fc8ef=_0x21f320==='1'?!![]:_0x21f320==='0'?![]:_0x21f320==='true'?!![]:_0x21f320===_0x83b0('0x52')?![]:![];this[_0x83b0('0x5')](_0x83b0('0x53'),_0x3fc8ef);}else{this[_0x83b0('0x5')]('screenrecording',_0x21f320);}}},'blocked':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![],'set':function(_0x48c00f){this[_0x83b0('0x5')](_0x83b0('0x54'),_0x48c00f);if(_0x48c00f===!![]){this[_0x83b0('0x5')](_0x83b0('0x55'),moment());this[_0x83b0('0x5')](_0x83b0('0x56'),0x0);}else{this[_0x83b0('0x5')](_0x83b0('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x83b0('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x83b0('0x10')](0x5)[_0x83b0('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x83b0('0x10')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x83b0('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0a64d80..0cd24d1 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 _0x0801=['intrf','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','isMiddleware','logout','pause','online','QueuePause','PAUSE','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','transaction','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','iat','nonce','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','idle','unknown','ringing','queues','inbound','flatten','toString','lower','col','asc','substring','getRealtimeAgents','offline','unavailable','voiceStatus','busy','slice','toUpperCase','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','util','path','lodash','squel','ioredis','jayson/promise','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','client','http','status','end','json','offset','undefined','limit','count','set','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','update','role','emit','get','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','find','name','UserProfileResource','sendStatus','stack','User','fieldName','type','key','password','salt','previousPasswords','resetPasswordExpires','md5secret','includeAll','include','query','true','attributes','push','findAll','rows','openTabs','length','chat','dataValues','fax','mail','openchannel','whatsapp','all','show','params','getOptions','userSetting','UserSetting','merge','options','body','describe','addContacts','ids','omit','catch','internal','findById','securePassword','validatePasswordPattern','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','permissions','101','102','103','110','104','105','106','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','loginInPause','voicePause','interface','Unknown\x20channel','add','Queues','spread','capitalize','toLowerCase','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','isValidChannel','isArray','Queue:remove','destroy','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','sms','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tags','tag','getQueues','model','keys','rawAttributes','filters','intersection','fields','order','sort','where','pick','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','mobile','LOCAL/%s@from-sip/n'];(function(_0x5aada8,_0x460a35){var _0xf5247e=function(_0x507709){while(--_0x507709){_0x5aada8['push'](_0x5aada8['shift']());}};_0xf5247e(++_0x460a35);}(_0x0801,0xa6));var _0x1080=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0801[_0x1035c1];return _0x308d67;};'use strict';var moment=require('moment');var util=require(_0x1080('0x0'));var path=require(_0x1080('0x1'));var fs=require('fs');var _=require(_0x1080('0x2'));var squel=require(_0x1080('0x3'));var Redis=require(_0x1080('0x4'));var jayson=require(_0x1080('0x5'));var authService=require('../../components/auth/service');var contacts=require(_0x1080('0x6'));var qs=require(_0x1080('0x7'));var rta=require(_0x1080('0x8'));var logger=require('../../config/logger')(_0x1080('0x9'));var utils=require(_0x1080('0xa'));var config=require('../../config/environment');var licenseUtil=require(_0x1080('0xb'));var APIBadRequestError=require(_0x1080('0xc'))[_0x1080('0xd')];var APINotFoundError=require(_0x1080('0xc'))[_0x1080('0xe')];var APIForbiddenError=require(_0x1080('0xc'))['APIForbiddenrror'];var APIHandleError=require(_0x1080('0xc'))[_0x1080('0xf')];var db=require(_0x1080('0x10'))['db'];var socket=require(_0x1080('0x11'))(new Redis(config['redis']));require(_0x1080('0x12'))[_0x1080('0x13')](socket);config[_0x1080('0x14')]=_[_0x1080('0x15')](config[_0x1080('0x14')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0x1080('0x16')][_0x1080('0x17')]({'port':0x232a});var values;function respondWithStatusCode(_0x56260a,_0x24abbd){_0x24abbd=_0x24abbd||0xcc;return function(_0x2e4c70){if(_0x2e4c70){return _0x56260a['sendStatus'](_0x24abbd);}return _0x56260a[_0x1080('0x18')](_0x24abbd)[_0x1080('0x19')]();};}function respondWithResult(_0x23b136,_0x4e5245){_0x4e5245=_0x4e5245||0xc8;return function(_0xbcd89e){if(_0xbcd89e){return _0x23b136[_0x1080('0x18')](_0x4e5245)[_0x1080('0x1a')](_0xbcd89e);}};}function respondWithFilteredResult(_0x4ebc31,_0x1e7f65){return function(_0x214593){if(_0x214593){var _0x204adc=typeof _0x1e7f65[_0x1080('0x1b')]===_0x1080('0x1c')&&typeof _0x1e7f65[_0x1080('0x1d')]===_0x1080('0x1c');var _0x47eb95=_0x214593['count'];var _0x3f9993=_0x204adc?0x0:_0x1e7f65[_0x1080('0x1b')];var _0x72d454=_0x204adc?_0x214593[_0x1080('0x1e')]:_0x1e7f65[_0x1080('0x1b')]+_0x1e7f65[_0x1080('0x1d')];var _0x45afef;if(_0x72d454>=_0x47eb95){_0x72d454=_0x47eb95;_0x45afef=0xc8;}else{_0x45afef=0xce;}_0x4ebc31['status'](_0x45afef);return _0x4ebc31[_0x1080('0x1f')]('Content-Range',_0x3f9993+'-'+_0x72d454+'/'+_0x47eb95)['json'](_0x214593);}return null;};}function respondWithRpcPromise(_0x56b137,_0x27287d,_0x1f9be1,_0x1bb1be){return new Promise(function(_0x2301a9,_0x17ce37){var _0x271e15=_0x1bb1be||amiClient;return _0x271e15['request'](_0x56b137,_0x1f9be1)[_0x1080('0x20')](function(_0x2d3e83){logger[_0x1080('0x21')]('User,\x20%s,\x20%s',_0x27287d,_0x1080('0x22'));logger['debug'](_0x1080('0x23'),_0x27287d,'request\x20sent',JSON[_0x1080('0x24')](_0x2d3e83));if(_0x2d3e83[_0x1080('0x25')]){if(_0x2d3e83[_0x1080('0x25')]['code']===0x1f4){logger[_0x1080('0x25')](_0x1080('0x26'),_0x27287d,_0x2d3e83[_0x1080('0x25')][_0x1080('0x27')]);return _0x17ce37(_0x2d3e83[_0x1080('0x25')]['message']);}logger['error'](_0x1080('0x26'),_0x27287d,_0x2d3e83['error'][_0x1080('0x27')]);return _0x2301a9(_0x2d3e83[_0x1080('0x25')][_0x1080('0x27')]);}else{logger['info'](_0x1080('0x26'),_0x27287d,_0x1080('0x22'));_0x2301a9(_0x2d3e83[_0x1080('0x28')][_0x1080('0x27')]);}})['catch'](function(_0x199353){logger[_0x1080('0x25')](_0x1080('0x26'),_0x27287d,_0x199353);_0x17ce37(_0x199353);});});}function saveUpdates(_0xd1b9c5){return function(_0x207306){if(_0x207306){return _0x207306[_0x1080('0x29')](_0xd1b9c5)[_0x1080('0x20')](function(_0xf087b){if(_0xf087b[_0x1080('0x2a')]==='agent'){socket[_0x1080('0x2b')]('userNotification:recalc:'+_0xf087b['id'],_0xf087b);}return _0xf087b;});}return null;};}function removeEntity(_0x2948c6,_0x47d94e){return function(_0x4a81a6){if(_0x4a81a6){return _0x4a81a6['destroy']({'transaction':_0x47d94e})[_0x1080('0x20')](function(){var _0x3f7382=_0x4a81a6[_0x1080('0x2c')]({'plain':!![]});if(_0x3f7382[_0x1080('0x2a')]==='admin')return;var _0x21f2ea=[{'name':_0x1080('0x2d'),'value':_0x1080('0x2e'),'ignore':!![]},{'name':_0x1080('0x2f'),'value':_0x1080('0x30'),'ignore':![]},{'name':_0x1080('0x31'),'value':'telephone','ignore':![]}];var _0x16e025=_(_0x21f2ea)[_0x1080('0x32')](_0x1080('0x33'))[_0x1080('0x34')](_0x1080('0x35'))[_0x1080('0x35')]();if(_[_0x1080('0x36')](_0x16e025,_0x3f7382['role'])){return;}var _0x5b0282=_[_0x1080('0x37')](_0x21f2ea,[_0x1080('0x35'),_0x3f7382[_0x1080('0x2a')]])[_0x1080('0x38')];return db[_0x1080('0x39')]['destroy']({'where':{'type':_0x5b0282,'resourceId':_0x3f7382['id']},'transaction':_0x47d94e})[_0x1080('0x20')](function(){return _0x4a81a6;});})[_0x1080('0x20')](function(){_0x2948c6[_0x1080('0x18')](0xcc)[_0x1080('0x19')]();});}};}function handleEntityNotFound(_0x163d4b){return function(_0x5ee9bf){if(!_0x5ee9bf){_0x163d4b[_0x1080('0x3a')](0x194);}return _0x5ee9bf;};}function handleError(_0x494b35,_0x3e0e75){_0x3e0e75=_0x3e0e75||0x1f4;return function(_0x57c74c){logger[_0x1080('0x25')](_0x57c74c[_0x1080('0x3b')]);if(_0x57c74c['name']){delete _0x57c74c[_0x1080('0x38')];}_0x494b35[_0x1080('0x18')](_0x3e0e75)['send'](_0x57c74c);};}function getUserAttributes(){return _(db[_0x1080('0x3c')]['rawAttributes'])['map'](function(_0x1481da){return{'name':_0x1481da[_0x1080('0x3d')],'type':_0x1481da[_0x1080('0x3e')][_0x1080('0x3f')]};})['filter'](function(_0x3d440f){return![_0x1080('0x40'),_0x1080('0x41'),_0x1080('0x42'),'resetPasswordToken',_0x1080('0x43'),_0x1080('0x44')][_0x1080('0x36')](_0x3d440f['name']);})[_0x1080('0x35')]();}exports['index']=function(_0x1a5603,_0x945370){var _0x4b5552={},_0xcc8221={'count':0x0,'rows':[]};var _0x4e2357=getUserAttributes();_0x4b5552=qs['getOptions'](_0x4e2357,_0x1a5603);var _0x1b33c1={'where':_0x4b5552['where']};return db[_0x1080('0x3c')][_0x1080('0x1e')](_0x1b33c1)['then'](function(_0xc385bc){_0xcc8221[_0x1080('0x1e')]=_0xc385bc;if(_0x1a5603['query'][_0x1080('0x45')]){_0x4b5552[_0x1080('0x46')]=[{'all':!![]}];}if(_0x1a5603[_0x1080('0x47')]['userSetting']===_0x1080('0x48')){_0x4b5552[_0x1080('0x46')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x1080('0x36')](_0x4b5552[_0x1080('0x49')],'id')){_0x4b5552[_0x1080('0x49')][_0x1080('0x4a')]('id');}return db[_0x1080('0x3c')][_0x1080('0x4b')](_0x4b5552);})[_0x1080('0x20')](function(_0x48ce99){_0xcc8221[_0x1080('0x4c')]=_0x48ce99;if(_0x1a5603[_0x1080('0x47')][_0x1080('0x4d')]===_0x1080('0x48')){var _0x168316=[];for(var _0x125196=0x0;_0x125196<_0xcc8221['rows'][_0x1080('0x4e')];_0x125196++){_0x168316[_0x1080('0x4a')](get_open_tabs(_0x1080('0x4f'),_0xcc8221[_0x1080('0x4c')][_0x125196][_0x1080('0x50')]));_0x168316[_0x1080('0x4a')](get_open_tabs('sms',_0xcc8221[_0x1080('0x4c')][_0x125196][_0x1080('0x50')]));_0x168316[_0x1080('0x4a')](get_open_tabs(_0x1080('0x51'),_0xcc8221[_0x1080('0x4c')][_0x125196][_0x1080('0x50')]));_0x168316['push'](get_open_tabs(_0x1080('0x52'),_0xcc8221['rows'][_0x125196][_0x1080('0x50')]));_0x168316[_0x1080('0x4a')](get_open_tabs(_0x1080('0x53'),_0xcc8221[_0x1080('0x4c')][_0x125196]['dataValues']));_0x168316[_0x1080('0x4a')](get_open_tabs(_0x1080('0x54'),_0xcc8221['rows'][_0x125196][_0x1080('0x50')]));}return Promise[_0x1080('0x55')](_0x168316)[_0x1080('0x20')](function(){return _0xcc8221;});}else{return _0xcc8221;}})[_0x1080('0x20')](respondWithFilteredResult(_0x945370,_0x4b5552))['catch'](handleError(_0x945370,null));};exports[_0x1080('0x56')]=function(_0x3ba042,_0x4f03da){var _0x2b4e56=getUserAttributes();_0x3ba042['query']['id']=_0x3ba042[_0x1080('0x57')]['id'];var _0x591af8=qs[_0x1080('0x58')](_0x2b4e56,_0x3ba042);if(_0x3ba042[_0x1080('0x47')][_0x1080('0x45')]){_0x591af8[_0x1080('0x46')]=[{'all':!![]}];}if(_0x3ba042[_0x1080('0x47')][_0x1080('0x59')]==='true'){_0x591af8['include']=[{'model':db[_0x1080('0x5a')],'as':_0x1080('0x59')}];}_0x591af8=_[_0x1080('0x5b')]({},_0x591af8,_0x3ba042[_0x1080('0x5c')]);if(!_['includes'](_0x591af8[_0x1080('0x49')],'id')){_0x591af8['attributes'][_0x1080('0x4a')]('id');}return db[_0x1080('0x3c')]['find'](_0x591af8)[_0x1080('0x20')](handleEntityNotFound(_0x4f03da,null))[_0x1080('0x20')](function(_0x38c991){var _0x573962=[];values=_0x38c991;if(_0x3ba042['query'][_0x1080('0x4d')]===_0x1080('0x48')){_0x573962[_0x1080('0x4a')](get_open_tabs('chat',_0x38c991['dataValues']));_0x573962[_0x1080('0x4a')](get_open_tabs('sms',_0x38c991['dataValues']));_0x573962[_0x1080('0x4a')](get_open_tabs(_0x1080('0x53'),_0x38c991['dataValues']));_0x573962[_0x1080('0x4a')](get_open_tabs(_0x1080('0x54'),_0x38c991[_0x1080('0x50')]));_0x573962['push'](get_open_tabs('fax',_0x38c991[_0x1080('0x50')]));_0x573962['push'](get_open_tabs(_0x1080('0x52'),_0x38c991[_0x1080('0x50')]));return Promise[_0x1080('0x55')](_0x573962);}else{return values;}})[_0x1080('0x20')](function(){return values;})[_0x1080('0x20')](respondWithResult(_0x4f03da,null))['catch'](handleError(_0x4f03da,null));};exports['update']=function(_0x6d4918,_0x55f105){if(_0x6d4918['body']['id']){delete _0x6d4918[_0x1080('0x5d')]['id'];}delete _0x6d4918[_0x1080('0x5d')][_0x1080('0x2a')];return db[_0x1080('0x3c')][_0x1080('0x37')]({'where':{'id':_0x6d4918[_0x1080('0x57')]['id']}})['then'](handleEntityNotFound(_0x55f105,null))[_0x1080('0x20')](saveUpdates(_0x6d4918[_0x1080('0x5d')],null))[_0x1080('0x20')](respondWithResult(_0x55f105,null))['catch'](handleError(_0x55f105,null));};exports[_0x1080('0x5e')]=function(_0x139293,_0x1c2c78){return db['User'][_0x1080('0x5e')]()[_0x1080('0x20')](respondWithResult(_0x1c2c78,null))['catch'](handleError(_0x1c2c78,null));};exports[_0x1080('0x5f')]=function(_0x340bf2,_0x3d6adc){return db[_0x1080('0x3c')]['find']({'where':{'id':_0x340bf2['params']['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x3d6adc,null))[_0x1080('0x20')](function(_0x54da32){if(_0x54da32){return _0x54da32['addContacts'](_0x340bf2[_0x1080('0x5d')][_0x1080('0x60')],_[_0x1080('0x61')](_0x340bf2[_0x1080('0x5d')],['ids','id'])||{});}})[_0x1080('0x20')](respondWithResult(_0x3d6adc,null))[_0x1080('0x62')](handleError(_0x3d6adc,null));};function validateUser(_0x44a3d7){return new Promise(function(_0x36b859,_0x3fe610){if(_0x44a3d7[_0x1080('0x63')])return _0x36b859(_0x44a3d7);return db['Setting'][_0x1080('0x64')](0x1)['then'](function(_0x3dc72e){if(_0x3dc72e[_0x1080('0x65')])authService[_0x1080('0x66')](_0x44a3d7[_0x1080('0x40')]);db['User']['max']('internal')['then'](function(_0x6253e6){if(_[_0x1080('0x67')](_0x6253e6)){_0x44a3d7[_0x1080('0x63')]=_0x3dc72e['min_internal']||0x1;return;}if(_[_0x1080('0x67')](_0x3dc72e[_0x1080('0x68')])||_0x3dc72e[_0x1080('0x68')]===_0x6253e6){_0x44a3d7[_0x1080('0x63')]=_0x6253e6+0x1;return;}if(_0x3dc72e[_0x1080('0x68')]>_0x6253e6){_0x44a3d7[_0x1080('0x63')]=_0x3dc72e['min_internal'];return;}return db['sequelize'][_0x1080('0x47')](_0x1080('0x69'),{'type':db[_0x1080('0x6a')][_0x1080('0x6b')][_0x1080('0x6c')]})[_0x1080('0x20')](function(_0x2ec141){if(_0x2ec141&&_0x2ec141[_0x1080('0x4e')]){for(var _0x30c280=0x0,_0x142cff=_0x2ec141['length'];_0x30c280<_0x142cff&&_[_0x1080('0x67')](_0x44a3d7[_0x1080('0x63')]);_0x30c280++){if(_0x3dc72e[_0x1080('0x68')]<=_0x2ec141[_0x30c280][_0x1080('0x6d')]){_0x44a3d7[_0x1080('0x63')]=_0x2ec141[_0x30c280][_0x1080('0x6d')];}else if(_0x3dc72e[_0x1080('0x68')]>_0x2ec141[_0x30c280]['from']&&_0x3dc72e[_0x1080('0x68')]<=_0x2ec141[_0x30c280]['to']){_0x44a3d7[_0x1080('0x63')]=_0x3dc72e[_0x1080('0x68')];}}}if(_[_0x1080('0x67')](_0x44a3d7[_0x1080('0x63')])){_0x44a3d7[_0x1080('0x63')]=_0x6253e6+0x1;}return _0x36b859(_0x44a3d7);});});})[_0x1080('0x62')](function(_0x555ba5){_0x3fe610(_0x555ba5);});});}function updateUser(_0x999f99){return new Promise(function(_0x9bdfb0,_0x2cd541){try{if(_0x999f99[_0x1080('0x6e')]){_0x999f99[_0x1080('0x6f')]=_0x999f99[_0x1080('0x63')];_0x999f99[_0x1080('0x70')]={'mailbox':_0x999f99[_0x1080('0x63')],'password':_0x999f99[_0x1080('0x40')],'fullname':_0x999f99['fullname'],'email':_0x999f99['email']};}if(_0x999f99['role']===_0x1080('0x30')){if(!_0x999f99[_0x1080('0x71')])_0x999f99['permissions']=[_0x1080('0x72'),_0x1080('0x73'),_0x1080('0x74'),'113',_0x1080('0x75'),_0x1080('0x76'),_0x1080('0x77'),_0x1080('0x78'),_0x1080('0x79'),_0x1080('0x7a'),_0x1080('0x7b'),_0x1080('0x7c'),_0x1080('0x7d'),_0x1080('0x7e'),_0x1080('0x7f')];}_0x9bdfb0(_0x999f99);}catch(_0x595c8b){_0x2cd541(_0x595c8b);}});}exports[_0x1080('0x80')]=function(_0x3e4d00,_0x325625){if(_0x3e4d00['user'][_0x1080('0x2a')]==='agent')throw new Error(_0x1080('0x81'));if(_0x3e4d00[_0x1080('0x5d')][_0x1080('0x2a')]===_0x1080('0x2e')&&_0x3e4d00[_0x1080('0x2e')]['role']!=='admin'){throw new Error(_0x1080('0x82'));}if(_0x3e4d00['body'][_0x1080('0x2a')]==='admin'&&_0x3e4d00[_0x1080('0x2e')][_0x1080('0x2a')]!==_0x1080('0x83')){throw new Error(_0x1080('0x84'));}return licenseUtil[_0x1080('0x85')]([_0x3e4d00[_0x1080('0x5d')]])[_0x1080('0x20')](function(){return validateUser(_0x3e4d00[_0x1080('0x5d')]);})[_0x1080('0x20')](function(_0x583df8){return updateUser(_0x583df8)['then'](function(_0x4f8de6){if(_0x4f8de6['role']==='admin'){_0x4f8de6['settingsEnabled']=_0x3e4d00[_0x1080('0x2e')][_0x1080('0x86')];delete _0x4f8de6[_0x1080('0x87')];}return _0x4f8de6;});})[_0x1080('0x20')](function(_0x1b424e){return db[_0x1080('0x3c')][_0x1080('0x80')](_0x1b424e,{'include':[{'model':db[_0x1080('0x70')],'as':'VoiceMail'}]});})[_0x1080('0x20')](function(_0x4bc3d9){if(_0x3e4d00[_0x1080('0x5d')][_0x1080('0x2a')]===_0x1080('0x2e'))return _0x4bc3d9;if(_0x3e4d00[_0x1080('0x2e')]['role']!==_0x1080('0x2e'))return _0x4bc3d9;return db[_0x1080('0x88')][_0x1080('0x37')]({'where':{'name':_0x4bc3d9[_0x1080('0x2a')]==='agent'?_0x1080('0x2f'):_0x1080('0x31'),'userProfileId':_0x3e4d00[_0x1080('0x2e')][_0x1080('0x87')]},'raw':!![]})[_0x1080('0x20')](function(_0x432cca){if(!_0x432cca||_0x432cca[_0x1080('0x89')]!=0x0)return _0x4bc3d9;return db[_0x1080('0x39')]['create']({'name':_0x4bc3d9[_0x1080('0x38')],'resourceId':_0x4bc3d9['id'],'type':_0x432cca[_0x1080('0x38')],'sectionId':_0x432cca['id']},{})['then'](function(){return _0x4bc3d9;});})['catch'](function(_0xc88ee){logger[_0x1080('0x25')](_0x1080('0x8a'),_0xc88ee);throw _0xc88ee;});})['then'](respondWithResult(_0x325625,0xc9))[_0x1080('0x62')](handleError(_0x325625,null));};exports[_0x1080('0x8b')]=function(_0x32df7c,_0x1ca0c7){var _0x1b0841=_0x32df7c[_0x1080('0x5d')];var _0x2bf67=[];if(_0x32df7c[_0x1080('0x2e')]['role']===_0x1080('0x30'))throw new Error(_0x1080('0x81'));if(_[_0x1080('0x8c')](_0x1b0841,[_0x1080('0x2a'),_0x1080('0x2e')])&&_0x32df7c[_0x1080('0x2e')][_0x1080('0x2a')]!==_0x1080('0x83')){throw new Error(_0x1080('0x82'));}if(_[_0x1080('0x8c')](_0x1b0841,[_0x1080('0x2a'),_0x1080('0x83')])&&_0x32df7c[_0x1080('0x2e')]['role']!=='admin'){throw new Error(_0x1080('0x8d'));}return licenseUtil['checkUserLimits'](_0x1b0841)[_0x1080('0x20')](function(){return validateUser(_0x1b0841[0x0]);})[_0x1080('0x20')](function(){for(var _0x5185b0=0x1;_0x5185b0<_0x1b0841['length'];_0x5185b0++){var _0xa2c434=_0x1b0841[_0x5185b0-0x1][_0x1080('0x63')];if(!_0x1b0841[_0x5185b0][_0x1080('0x63')])_0x1b0841[_0x5185b0]['internal']=_0xa2c434+0x1;_0x2bf67[_0x1080('0x4a')](validateUser(_0x1b0841[_0x5185b0]));}return Promise['all'](_0x2bf67);})[_0x1080('0x20')](function(){_0x2bf67=[];for(var _0x559229=0x0;_0x559229<_0x1b0841[_0x1080('0x4e')];_0x559229++){_0x2bf67['push'](updateUser(_0x1b0841[_0x559229]));}return Promise[_0x1080('0x55')](_0x2bf67);})[_0x1080('0x20')](function(){_0x2bf67=_0x1b0841[_0x1080('0x34')](function(_0x19fb4f){return db[_0x1080('0x3c')]['create'](_0x19fb4f,{'include':[{'model':db[_0x1080('0x70')],'as':_0x1080('0x70')}]})['then'](function(_0x53f664){_0x19fb4f['id']=_0x53f664['id'];return _0x19fb4f;});});return Promise['all'](_0x2bf67);})[_0x1080('0x20')](function(_0x5af789){if(_0x32df7c['body']['role']===_0x1080('0x2e'))return _0x5af789;if(_0x32df7c[_0x1080('0x2e')][_0x1080('0x2a')]!==_0x1080('0x2e'))return _0x5af789;var _0xface21=_['some'](_0x5af789,function(_0x24836e){return _0x24836e['role']===_0x1080('0x30')||_0x24836e[_0x1080('0x2a')]===_0x1080('0x8e');});if(!_0xface21)return _0x5af789;return db[_0x1080('0x88')][_0x1080('0x4b')]({'where':{'name':{'$or':[_0x1080('0x2f'),'Telephones']},'userProfileId':_0x32df7c[_0x1080('0x2e')]['userProfileId']},'raw':!![]})[_0x1080('0x20')](function(_0x13c7ee){if(_[_0x1080('0x8f')](_0x13c7ee)||!_[_0x1080('0x8c')](_0x13c7ee,['autoAssociation',0x0]))return _0x5af789;_0x2bf67=[];var _0x2fa933=_(_0x13c7ee)[_0x1080('0x34')](function(_0x556a6b){if(_0x556a6b[_0x1080('0x89')]===0x1)return;return _0x556a6b[_0x1080('0x38')]==='Agents'?'agent':_0x1080('0x8e');})['compact']()['value']();for(var _0x143949=0x0;_0x143949<_0x5af789['length'];_0x143949++){if(!_['includes'](_0x2fa933,_0x5af789[_0x143949][_0x1080('0x2a')]))return;var _0xfbacef=_0x5af789[_0x143949][_0x1080('0x2a')]===_0x1080('0x30')?_0x1080('0x2f'):_0x1080('0x31');_0x2bf67[_0x1080('0x4a')](db[_0x1080('0x39')][_0x1080('0x80')]({'name':_0x5af789[_0x143949][_0x1080('0x38')],'resourceId':_0x5af789[_0x143949]['id'],'type':_0xfbacef,'sectionId':_['find'](_0x13c7ee,[_0x1080('0x38'),_0xfbacef])['id']},{}));}return Promise[_0x1080('0x55')](_0x2bf67);});})['then'](respondWithResult(_0x1ca0c7,0xc9))[_0x1080('0x62')](handleError(_0x1ca0c7,null));};exports[_0x1080('0x90')]=function(_0x1ff8b2,_0x4a6eab){if(_0x1ff8b2['body']['id']){delete _0x1ff8b2[_0x1080('0x5d')]['id'];}return db[_0x1080('0x3c')]['find']({'where':{'id':_0x1ff8b2['params']['id']}})[_0x1080('0x20')](function(_0xbae2ea){if(!_0xbae2ea)return null;if(_0xbae2ea['id']===_0x1ff8b2[_0x1080('0x2e')]['id']){if(!_0x1ff8b2['body'][_0x1080('0x91')]||!_0x1ff8b2['body'][_0x1080('0x92')]){throw new db[(_0x1080('0x93'))]['ValidationError'](_0x1080('0x94'));}if(!_0xbae2ea['authenticate'](_0x1ff8b2[_0x1080('0x5d')][_0x1080('0x91')])){throw new db[(_0x1080('0x93'))][(_0x1080('0x95'))](_0x1080('0x96'));}if(_0x1ff8b2[_0x1080('0x5d')][_0x1080('0x91')]===_0x1ff8b2['body']['newPassword']){throw new db['Sequelize'][(_0x1080('0x95'))](_0x1080('0x97'));}}else if(_0x1ff8b2['user'][_0x1080('0x2a')]===_0x1080('0x83')){if(!_0x1ff8b2[_0x1080('0x5d')]['newPassword']){throw new db[(_0x1080('0x93'))][(_0x1080('0x95'))](_0x1080('0x98'));}}else if(_0x1ff8b2[_0x1080('0x2e')][_0x1080('0x2a')]===_0x1080('0x2e')){if(!_0x1ff8b2[_0x1080('0x5d')][_0x1080('0x92')]){throw new db['Sequelize'][(_0x1080('0x95'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0xbae2ea[_0x1080('0x2a')]!=='agent'){throw new db[(_0x1080('0x93'))][(_0x1080('0x95'))](_0x1080('0x81'));}}else{throw new db[(_0x1080('0x93'))]['ValidationError'](_0x1080('0x81'));}return _0xbae2ea;})[_0x1080('0x20')](handleEntityNotFound(_0x4a6eab,null))['then'](function(_0x5b546a){return db[_0x1080('0x99')][_0x1080('0x9a')]({'attributes':['id',_0x1080('0x65'),_0x1080('0x9b'),_0x1080('0x9c')]})[_0x1080('0x20')](function(_0x1a2b3a){if(_0x1a2b3a[_0x1080('0x65')])authService[_0x1080('0x66')](_0x1ff8b2[_0x1080('0x5d')]['newPassword']);if(!_0x1a2b3a['enforcePasswordHistory']||!_0x5b546a[_0x1080('0x42')])return _0x5b546a;authService[_0x1080('0x9d')](_0x1ff8b2['body'][_0x1080('0x92')],_0x5b546a[_0x1080('0x42')],_0x1a2b3a['passwordHistoryLimit']);return _0x5b546a;})[_0x1080('0x20')](saveUpdates({'password':_0x1ff8b2[_0x1080('0x5d')][_0x1080('0x92')],'passwordResetAt':_0x1ff8b2[_0x1080('0x2e')]['id']==_0x1ff8b2[_0x1080('0x57')]['id']?moment():null,'previousPasswords':authService[_0x1080('0x9e')](_0x1ff8b2[_0x1080('0x5d')]['newPassword'],_0x5b546a[_0x1080('0x42')])},null));})[_0x1080('0x20')](respondWithResult(_0x4a6eab,null))['catch'](handleError(_0x4a6eab,null));};exports[_0x1080('0x9f')]=function(_0x23b2e8,_0x189f30){var _0x1b6b9f=_0x23b2e8['body']['channel'];return db[_0x1080('0x3c')][_0x1080('0x37')]({'where':{'id':_0x23b2e8['params']['id']},'attributes':['id','name',_0x1080('0x2a'),'online',_0x1080('0xa0'),_0x1080('0xa1'),_0x1080('0xa2')]})[_0x1080('0x20')](handleEntityNotFound(_0x189f30,null))[_0x1080('0x20')](function(_0x47366a){if(_0x47366a){if(!utils['isValidChannel'](_0x1b6b9f)){throw new db['Sequelize'][(_0x1080('0x95'))](_0x1080('0xa3'));}return _0x47366a[_0x1080('0xa4')+_['capitalize'](_0x1b6b9f['toLowerCase']())+_0x1080('0xa5')](_0x23b2e8['body'][_0x1080('0x60')],{'penalty':_0x23b2e8[_0x1080('0x5d')]['penalty']||0x0})[_0x1080('0xa6')](function(_0x1eabf8){for(var _0x320e3f=0x0;_0x320e3f<_0x23b2e8[_0x1080('0x5d')][_0x1080('0x60')]['length'];_0x320e3f+=0x1){var _0x106d43={'UserId':Number(_0x23b2e8[_0x1080('0x57')]['id'])};_0x106d43[_[_0x1080('0xa7')](_0x1b6b9f[_0x1080('0xa8')]())+_0x1080('0xa9')]=Number(_0x23b2e8[_0x1080('0x5d')][_0x1080('0x60')][_0x320e3f]);socket[_0x1080('0x2b')]('user'+_[_0x1080('0xa7')](_0x1b6b9f[_0x1080('0xa8')]())+_0x1080('0xaa'),_0x106d43);}return _0x1eabf8;})[_0x1080('0x20')](function(){if(_0x1b6b9f===_0x1080('0xab')){return db[_0x1080('0xac')][_0x1080('0x4b')]({'where':{'id':_0x23b2e8[_0x1080('0x5d')][_0x1080('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x1080('0x20')](function(_0x5d41df){var _0x406a45=_0x47366a['get']({'plain':!![]});var _0x27cdbb=[];if(_0x1b6b9f===_0x1080('0xab')&&_0x406a45[_0x1080('0x2a')]===_0x1080('0x30')&&_0x406a45['online']){for(let _0xe37bbe=0x0;_0xe37bbe<_0x5d41df[_0x1080('0x4e')];_0xe37bbe+=0x1){_0x27cdbb[_0x1080('0x4a')]({'membername':_0x406a45[_0x1080('0x38')],'UserId':_0x406a45['id'],'queue_name':_0x5d41df[_0xe37bbe][_0x1080('0x38')],'VoiceQueueId':_0x5d41df[_0xe37bbe]['id'],'interface':_[_0x1080('0x67')](_0x406a45[_0x1080('0xa2')])?util[_0x1080('0xad')](_0x1080('0xae'),_0x406a45['name']):_0x406a45[_0x1080('0xa2')],'paused':_0x406a45[_0x1080('0xa1')]||![],'penalty':_0x23b2e8[_0x1080('0x5d')]['penalty']||0x0});}return Promise['all'](_0x27cdbb[_0x1080('0x34')](function(_0x4730cb){return db[_0x1080('0xaf')][_0x1080('0xb0')](_0x4730cb);}));}return _0x47366a;});}})[_0x1080('0x20')](respondWithStatusCode(_0x189f30,null))[_0x1080('0x62')](handleError(_0x189f30,null));};exports[_0x1080('0xb1')]=function(_0x40d72a,_0x40ea0c){var _0x2011bf,_0x425973;return db[_0x1080('0x3c')][_0x1080('0x37')]({'where':{'id':_0x40d72a[_0x1080('0x57')]['id']},'attributes':['id','name',_0x1080('0x2a')]})[_0x1080('0x20')](handleEntityNotFound(_0x40ea0c,null))['then'](function(_0x26a509){if(_0x26a509){_0x2011bf=_0x26a509;if(!_0x40d72a[_0x1080('0x47')][_0x1080('0xb2')]||!utils[_0x1080('0xb3')](_0x40d72a[_0x1080('0x47')]['channel'])){throw new db[(_0x1080('0x93'))][(_0x1080('0x95'))](_0x1080('0xa3'));}return _0x26a509['remove'+_[_0x1080('0xa7')](_0x40d72a['query'][_0x1080('0xb2')]['toLowerCase']())+'Queues'](_0x40d72a[_0x1080('0x47')][_0x1080('0x60')]);}})[_0x1080('0x20')](function(_0x1ddfae){if(_[_0x1080('0xb4')](_0x40d72a[_0x1080('0x47')][_0x1080('0x60')])){for(var _0x193b22=0x0;_0x193b22<_0x40d72a[_0x1080('0x47')]['ids'][_0x1080('0x4e')];_0x193b22+=0x1){_0x425973={'UserId':Number(_0x40d72a[_0x1080('0x57')]['id'])};_0x425973[_[_0x1080('0xa7')](_0x40d72a[_0x1080('0x47')][_0x1080('0xb2')][_0x1080('0xa8')]())+_0x1080('0xa9')]=Number(_0x40d72a[_0x1080('0x47')][_0x1080('0x60')][_0x193b22]);socket[_0x1080('0x2b')](_0x1080('0x2e')+_[_0x1080('0xa7')](_0x40d72a[_0x1080('0x47')]['channel'][_0x1080('0xa8')]())+'Queue:remove',_0x425973);}}else{_0x425973={'UserId':Number(_0x40d72a[_0x1080('0x57')]['id'])};_0x425973[_['capitalize'](_0x40d72a[_0x1080('0x47')]['channel'][_0x1080('0xa8')]())+'QueueId']=Number(_0x40d72a['query'][_0x1080('0x60')]);socket[_0x1080('0x2b')](_0x1080('0x2e')+_[_0x1080('0xa7')](_0x40d72a[_0x1080('0x47')]['channel']['toLowerCase']())+_0x1080('0xb5'),_0x425973);}return _0x1ddfae;})[_0x1080('0x20')](function(){if(_0x40d72a[_0x1080('0x47')][_0x1080('0xb2')]==='voice'){return db['UserVoiceQueueRt'][_0x1080('0xb6')]({'where':{'UserId':_0x40d72a['params']['id'],'VoiceQueueId':_0x40d72a[_0x1080('0x47')]['ids']},'individualHooks':!![]})[_0x1080('0x20')](function(){return _0x2011bf;});}return _0x2011bf;})['then'](respondWithStatusCode(_0x40ea0c,null))['catch'](handleError(_0x40ea0c,null));};exports['addAvatar']=function(_0x443318,_0x4920cd){_0x443318['body'][_0x1080('0xb7')]=_0x443318[_0x1080('0xb8')][_0x1080('0xb9')];return db['User']['find']({'where':{'id':_0x443318[_0x1080('0x57')]['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x4920cd,null))[_0x1080('0x20')](saveUpdates(_0x443318[_0x1080('0x5d')],null))[_0x1080('0x20')](respondWithResult(_0x4920cd,null))['catch'](handleError(_0x4920cd,null));};exports[_0x1080('0xba')]=function(_0x21ba70,_0x1ec91a){var _0x44cb75=path[_0x1080('0xbb')](config[_0x1080('0xbc')],_0x1080('0xbd'));return db[_0x1080('0x3c')][_0x1080('0x37')]({'where':{'id':_0x21ba70[_0x1080('0x57')]['id']},'attributes':['id',_0x1080('0xb7')],'raw':!![]})['then'](handleEntityNotFound(_0x1ec91a,null))['then'](function(_0x493376){if(_0x493376){if(_[_0x1080('0x67')](_0x493376[_0x1080('0xb7')])){return _0x1ec91a['download'](_0x44cb75);}else{if(!fs['existsSync'](path['join'](config['root'],'server/files/images/',_0x493376[_0x1080('0xb7')]))){return _0x1ec91a[_0x1080('0xbe')](_0x44cb75);}return _0x1ec91a[_0x1080('0xbe')](path['join'](config[_0x1080('0xbc')],_0x1080('0xbf'),_0x493376[_0x1080('0xb7')]));}}})[_0x1080('0x62')](handleError(_0x1ec91a,null));};exports[_0x1080('0xc0')]=function(_0x1ef604,_0x2cb5b6){return db[_0x1080('0x3c')]['find']({'where':{'id':_0x1ef604['params']['id']},'attributes':['id']})[_0x1080('0x20')](handleEntityNotFound(_0x2cb5b6,null))['then'](function(_0xfed3f8){var _0xf2427e=[];values=_0xfed3f8['dataValues'];_0xf2427e[_0x1080('0x4a')](get_open_tabs('chat',_0xfed3f8['dataValues']));_0xf2427e[_0x1080('0x4a')](get_open_tabs(_0x1080('0xc1'),_0xfed3f8['dataValues']));_0xf2427e['push'](get_open_tabs(_0x1080('0x53'),_0xfed3f8[_0x1080('0x50')]));_0xf2427e[_0x1080('0x4a')](get_open_tabs(_0x1080('0x54'),_0xfed3f8[_0x1080('0x50')]));_0xf2427e[_0x1080('0x4a')](get_open_tabs(_0x1080('0x51'),_0xfed3f8[_0x1080('0x50')]));_0xf2427e[_0x1080('0x4a')](get_open_tabs('mail',_0xfed3f8['dataValues']));return Promise[_0x1080('0x55')](_0xf2427e);})[_0x1080('0x20')](function(_0x3d4a11){if(_0x3d4a11){var _0x32ea2b=_[_0x1080('0x34')](values['ChatOpenTabs'],function(_0x5b722f){return{'channel':_0x1080('0xc2'),'id':_0x5b722f['id'],'createdAt':_0x5b722f[_0x1080('0xc3')]};});var _0x183653=_[_0x1080('0x34')](values[_0x1080('0xc4')],function(_0x54bd14){return{'channel':'FAX','id':_0x54bd14['id'],'createdAt':_0x54bd14[_0x1080('0xc3')]};});var _0x43c352=_['map'](values[_0x1080('0xc5')],function(_0x24a1b3){return{'channel':_0x1080('0xc6'),'id':_0x24a1b3['id'],'createdAt':_0x24a1b3[_0x1080('0xc3')]};});var _0x12f68c=_[_0x1080('0x34')](values[_0x1080('0xc7')],function(_0x45b57a){return{'channel':_0x1080('0xc8'),'id':_0x45b57a['id'],'createdAt':_0x45b57a[_0x1080('0xc3')]};});var _0x5aedff=_[_0x1080('0x34')](values[_0x1080('0xc9')],function(_0x4f5be4){return{'channel':_0x1080('0xca'),'id':_0x4f5be4['id'],'createdAt':_0x4f5be4['createdAt']};});var _0x31b4cf=_[_0x1080('0x34')](values['WhatsappOpenTabs'],function(_0x22e291){return{'channel':_0x1080('0xcb'),'id':_0x22e291['id'],'createdAt':_0x22e291['createdAt']};});var _0x8bc41a=_[_0x1080('0xcc')](_0x32ea2b,_0x183653,_0x43c352,_0x12f68c,_0x5aedff,_0x31b4cf);var _0x173cf8={'count':_0x8bc41a['length'],'rows':_0x8bc41a};return _0x173cf8;}else return null;})['then'](respondWithResult(_0x2cb5b6,null))[_0x1080('0x62')](handleError(_0x2cb5b6,null));};exports[_0x1080('0xcd')]=function(_0x29b718,_0xced221){var _0x419423={};return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x29b718[_0x1080('0x57')]['id']}})['then'](function(_0x264b5b){if(!_0x264b5b){throw new APINotFoundError(util[_0x1080('0xad')](_0x1080('0xce'),_0x29b718['params']['id']));}return contacts[_0x1080('0x5e')]();})[_0x1080('0x20')](function(_0x3e3f6f){_0x29b718['query'][_0x1080('0x3c')]=_0x29b718['params']['id'];_0x419423=qs['getOptions'](_0x3e3f6f,_0x29b718);if(_0x29b718[_0x1080('0x47')][_0x1080('0xcf')](_0x1080('0x45'))){_0x419423[_0x1080('0x46')]=[{'model':db[_0x1080('0xd0')],'as':_0x1080('0xd1'),'required':![]},{'model':db['Tag'],'as':_0x1080('0xd2'),'attributes':['id','name','color'],'where':_0x29b718[_0x1080('0x47')]['tag']?{'id':_0x29b718['query'][_0x1080('0xd3')]}:undefined,'required':_0x29b718[_0x1080('0x47')][_0x1080('0xd3')]?!![]:![]}];}return contacts['findAll'](_0x29b718['query'],_0x29b718[_0x1080('0x2e')],_0x419423,_0x3e3f6f);})[_0x1080('0x20')](respondWithFilteredResult(_0xced221,_0x419423))[_0x1080('0x62')](APIHandleError(_0xced221));};exports[_0x1080('0xd4')]=function(_0x42159d,_0x5ced4f){var _0x503d99;var _0x2946b6={};var _0x3940f0;return db[_0x1080('0x3c')]['findOne']({'where':{'id':_0x42159d['params']['id']},'attributes':['id',_0x1080('0x38'),_0x1080('0x2a')]})['then'](handleEntityNotFound(_0x5ced4f,null))[_0x1080('0x20')](function(_0x1a1554){if(!utils['isValidChannel'](_0x42159d[_0x1080('0x47')][_0x1080('0xb2')])){throw new db[(_0x1080('0x93'))][(_0x1080('0x95'))](_0x1080('0xa3'));}_0x503d99=_0x1a1554;var _0x497c4a={};_0x497c4a[_0x1080('0xd5')]=_[_0x1080('0xd6')](db[_['capitalize'](_0x42159d['query'][_0x1080('0xb2')])+'Queue'][_0x1080('0xd7')]);_0x497c4a[_0x1080('0x47')]=_['keys'](_0x42159d[_0x1080('0x47')]);_0x497c4a[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x497c4a[_0x1080('0xd5')],_0x497c4a[_0x1080('0x47')]);_0x2946b6[_0x1080('0x49')]=_['intersection'](_0x497c4a[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x42159d['query'][_0x1080('0xda')]));_0x2946b6[_0x1080('0x49')]=_0x2946b6['attributes'][_0x1080('0x4e')]?_0x2946b6[_0x1080('0x49')]:_0x497c4a[_0x1080('0xd5')];_0x2946b6[_0x1080('0xdb')]=qs[_0x1080('0xdc')](_0x42159d[_0x1080('0x47')]['sort']);_0x2946b6[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x42159d[_0x1080('0x47')],_0x497c4a['filters']));if(_0x42159d[_0x1080('0x47')][_0x1080('0x32')]){_0x2946b6[_0x1080('0xdd')]=_[_0x1080('0x5b')](_0x2946b6[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x2946b6['attributes'],function(_0x2febe4){var _0x458c5c={};_0x458c5c[_0x2febe4]={'$like':'%'+_0x42159d['query'][_0x1080('0x32')]+'%'};return _0x458c5c;})});}_0x2946b6=_['merge']({},_0x2946b6,_0x42159d[_0x1080('0x5c')]);switch(_0x503d99[_0x1080('0x2a')]){case _0x1080('0x83'):return db[_[_0x1080('0xa7')](_0x42159d[_0x1080('0x47')][_0x1080('0xb2')])+_0x1080('0xdf')][_0x1080('0x4b')](_0x2946b6);case'user':case'agent':return _0x503d99['get'+_['capitalize'](_0x42159d['query'][_0x1080('0xb2')])+_0x1080('0xa5')](_0x2946b6);default:throw new db['Sequelize'][(_0x1080('0x95'))](_0x1080('0xe0'));}})[_0x1080('0x20')](function(_0x33801b){_0x3940f0=_0x33801b[_0x1080('0x4e')];if(!_0x42159d['query'][_0x1080('0xcf')](_0x1080('0xe1'))){_0x2946b6['limit']=qs['limit'](_0x42159d['query'][_0x1080('0x1d')]);_0x2946b6[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x42159d['query']['offset']);}switch(_0x503d99['role']){case'admin':return db[_['capitalize'](_0x42159d[_0x1080('0x47')][_0x1080('0xb2')])+_0x1080('0xdf')][_0x1080('0x4b')](_0x2946b6);case'user':case _0x1080('0x30'):return _0x503d99['get'+_['capitalize'](_0x42159d[_0x1080('0x47')][_0x1080('0xb2')])+_0x1080('0xa5')](_0x2946b6);}})[_0x1080('0x20')](function(_0x25d05a){return{'count':_0x3940f0,'rows':_0x25d05a};})[_0x1080('0x20')](respondWithResult(_0x5ced4f,null))['catch'](handleError(_0x5ced4f,null));};exports[_0x1080('0xe2')]=function(_0x366cf4,_0x5bae82){var _0x183634={};var _0x321b5e={};var _0x1f6b87;var _0x4639aa;return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x366cf4[_0x1080('0x57')]['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x5bae82,null))[_0x1080('0x20')](function(_0x1330f1){if(_0x1330f1){_0x1f6b87=_0x1330f1;_0x321b5e['model']=_[_0x1080('0xd6')](db['UserVoiceQueueRt'][_0x1080('0xd7')]);_0x321b5e['query']=_[_0x1080('0xd6')](_0x366cf4[_0x1080('0x47')]);_0x321b5e[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x321b5e[_0x1080('0xd5')],_0x321b5e[_0x1080('0x47')]);_0x183634[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x321b5e[_0x1080('0xd5')],qs['fields'](_0x366cf4[_0x1080('0x47')][_0x1080('0xda')]));_0x183634[_0x1080('0x49')]=_0x183634[_0x1080('0x49')][_0x1080('0x4e')]?_0x183634['attributes']:_0x321b5e[_0x1080('0xd5')];_0x183634[_0x1080('0xdb')]=qs[_0x1080('0xdc')](_0x366cf4['query']['sort']);_0x183634[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x366cf4[_0x1080('0x47')],_0x321b5e[_0x1080('0xd8')]));if(_0x366cf4[_0x1080('0x47')][_0x1080('0x32')]){_0x183634[_0x1080('0xdd')]=_['merge'](_0x183634['where'],{'$or':_[_0x1080('0x34')](_0x183634[_0x1080('0x49')],function(_0x59b33e){var _0xac2934={};_0xac2934[_0x59b33e]={'$like':'%'+_0x366cf4[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0xac2934;})});}_0x183634=_[_0x1080('0x5b')]({},_0x183634,_0x366cf4['options']);return _0x1f6b87['getVoiceQueuesRt'](_0x183634);}})[_0x1080('0x20')](function(_0x5db82c){if(_0x5db82c){_0x4639aa=_0x5db82c[_0x1080('0x4e')];if(!_0x366cf4[_0x1080('0x47')][_0x1080('0xcf')]('nolimit')){_0x183634[_0x1080('0x1d')]=qs[_0x1080('0x1d')](_0x366cf4['query'][_0x1080('0x1d')]);_0x183634['offset']=qs[_0x1080('0x1b')](_0x366cf4[_0x1080('0x47')][_0x1080('0x1b')]);}return _0x1f6b87[_0x1080('0xe2')](_0x183634);}})['then'](function(_0x539e00){if(_0x539e00){return _0x539e00?{'count':_0x4639aa,'rows':_0x539e00}:null;}})[_0x1080('0x20')](respondWithResult(_0x5bae82,null))[_0x1080('0x62')](handleError(_0x5bae82,null));};exports['getGroups']=function(_0x3c4808,_0x5e74b9){var _0x53f83d={};var _0x2f9747={};var _0x31f6c5;var _0x21d988;return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x3c4808[_0x1080('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e74b9,null))[_0x1080('0x20')](function(_0x185c9b){if(_0x185c9b){_0x31f6c5=_0x185c9b;_0x2f9747[_0x1080('0xd5')]=_[_0x1080('0xd6')](db['ChatGroup'][_0x1080('0xd7')]);_0x2f9747[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x3c4808[_0x1080('0x47')]);_0x2f9747[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x2f9747[_0x1080('0xd5')],_0x2f9747[_0x1080('0x47')]);_0x53f83d[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x2f9747[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x3c4808[_0x1080('0x47')][_0x1080('0xda')]));_0x53f83d[_0x1080('0x49')]=_0x53f83d[_0x1080('0x49')][_0x1080('0x4e')]?_0x53f83d[_0x1080('0x49')]:_0x2f9747['model'];_0x53f83d[_0x1080('0xdb')]=qs['sort'](_0x3c4808[_0x1080('0x47')][_0x1080('0xdc')]);_0x53f83d[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x3c4808['query'],_0x2f9747[_0x1080('0xd8')]));if(_0x3c4808[_0x1080('0x47')][_0x1080('0x32')]){_0x53f83d['where']=_[_0x1080('0x5b')](_0x53f83d[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x53f83d[_0x1080('0x49')],function(_0x28751b){var _0x1d9a4f={};_0x1d9a4f[_0x28751b]={'$like':'%'+_0x3c4808['query'][_0x1080('0x32')]+'%'};return _0x1d9a4f;})});}_0x53f83d=_[_0x1080('0x5b')]({},_0x53f83d,_0x3c4808['options']);return _0x31f6c5[_0x1080('0xe3')](_0x53f83d);}})[_0x1080('0x20')](function(_0x4eabf3){if(_0x4eabf3){_0x21d988=_0x4eabf3['length'];if(!_0x3c4808[_0x1080('0x47')][_0x1080('0xcf')](_0x1080('0xe1'))){_0x53f83d['limit']=qs[_0x1080('0x1d')](_0x3c4808[_0x1080('0x47')][_0x1080('0x1d')]);_0x53f83d[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x3c4808[_0x1080('0x47')][_0x1080('0x1b')]);}return _0x31f6c5['getGroups'](_0x53f83d);}})[_0x1080('0x20')](function(_0x1d0064){if(_0x1d0064){return _0x1d0064?{'count':_0x21d988,'rows':_0x1d0064}:null;}})[_0x1080('0x20')](respondWithResult(_0x5e74b9,null))['catch'](handleError(_0x5e74b9,null));};exports['getRecordings']=function(_0x59a1d5,_0x33f7d7){var _0x173ae8={'raw':!![],'where':{}};var _0x12c25b={};var _0x4f6869={'count':0x0,'rows':[]};return db[_0x1080('0x3c')]['findOne']({'where':{'id':_0x59a1d5[_0x1080('0x57')]['id']}})['then'](handleEntityNotFound(_0x33f7d7,null))['then'](function(_0x34301a){if(_0x34301a){_0x12c25b[_0x1080('0xd5')]=_[_0x1080('0xd6')](db[_0x1080('0xe4')]['rawAttributes']);_0x12c25b[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x59a1d5[_0x1080('0x47')]);_0x12c25b['filters']=_[_0x1080('0xd9')](_0x12c25b[_0x1080('0xd5')],_0x12c25b['query']);_0x173ae8['attributes']=_[_0x1080('0xd9')](_0x12c25b[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x59a1d5[_0x1080('0x47')][_0x1080('0xda')]));_0x173ae8['attributes']=_0x173ae8[_0x1080('0x49')][_0x1080('0x4e')]?_0x173ae8[_0x1080('0x49')]:_0x12c25b[_0x1080('0xd5')];if(!_0x59a1d5[_0x1080('0x47')][_0x1080('0xcf')]('nolimit')){_0x173ae8['limit']=qs['limit'](_0x59a1d5[_0x1080('0x47')][_0x1080('0x1d')]);_0x173ae8[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x59a1d5[_0x1080('0x47')][_0x1080('0x1b')]);}_0x173ae8[_0x1080('0xdb')]=qs[_0x1080('0xdc')](_0x59a1d5['query'][_0x1080('0xdc')]);_0x173ae8[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x59a1d5[_0x1080('0x47')],_0x12c25b[_0x1080('0xd8')]));_0x173ae8[_0x1080('0xdd')][_0x1080('0xe5')]=_0x34301a['id'];if(_0x59a1d5[_0x1080('0x47')][_0x1080('0x32')]){_0x173ae8[_0x1080('0xdd')]=_['merge'](_0x173ae8[_0x1080('0xdd')],{'$or':_['map'](_0x173ae8['attributes'],function(_0x5e3ce9){var _0x397615={};_0x397615[_0x5e3ce9]={'$like':'%'+_0x59a1d5[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0x397615;})});}_0x173ae8=_[_0x1080('0x5b')]({},_0x173ae8,_0x59a1d5['options']);return db[_0x1080('0xe4')]['count']({'where':_0x173ae8[_0x1080('0xdd')]})[_0x1080('0x20')](function(_0x64d40f){_0x4f6869[_0x1080('0x1e')]=_0x64d40f;if(_0x59a1d5[_0x1080('0x47')]['includeAll']){_0x173ae8[_0x1080('0x46')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x173ae8);})[_0x1080('0x20')](function(_0x59e57f){_0x4f6869[_0x1080('0x4c')]=_0x59e57f;return _0x4f6869;});}})[_0x1080('0x20')](respondWithFilteredResult(_0x33f7d7,_0x173ae8))[_0x1080('0x62')](handleError(_0x33f7d7,null));};exports[_0x1080('0xe6')]=function(_0x5034d4,_0x30e5e8){var _0x25cd23={'raw':!![],'where':{}};var _0x353d20={};var _0x63b7d2={'count':0x0,'rows':[]};return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x5034d4[_0x1080('0x57')]['id']}})['then'](handleEntityNotFound(_0x30e5e8,null))['then'](function(_0x4ffe53){if(_0x4ffe53){_0x353d20[_0x1080('0xd5')]=_[_0x1080('0xd6')](db[_0x1080('0xe7')][_0x1080('0xd7')]);_0x353d20['query']=_[_0x1080('0xd6')](_0x5034d4[_0x1080('0x47')]);_0x353d20['filters']=_[_0x1080('0xd9')](_0x353d20[_0x1080('0xd5')],_0x353d20[_0x1080('0x47')]);_0x25cd23[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x353d20[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x5034d4[_0x1080('0x47')]['fields']));_0x25cd23[_0x1080('0x49')]=_0x25cd23[_0x1080('0x49')][_0x1080('0x4e')]?_0x25cd23['attributes']:_0x353d20['model'];if(!_0x5034d4[_0x1080('0x47')][_0x1080('0xcf')]('nolimit')){_0x25cd23['limit']=qs[_0x1080('0x1d')](_0x5034d4[_0x1080('0x47')][_0x1080('0x1d')]);_0x25cd23[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x5034d4[_0x1080('0x47')]['offset']);}_0x25cd23['order']=qs[_0x1080('0xdc')](_0x5034d4['query']['sort']);_0x25cd23[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x5034d4[_0x1080('0x47')],_0x353d20['filters']));_0x25cd23[_0x1080('0xdd')][_0x1080('0xe5')]=_0x4ffe53['id'];if(_0x5034d4[_0x1080('0x47')][_0x1080('0x32')]){_0x25cd23[_0x1080('0xdd')]=_[_0x1080('0x5b')](_0x25cd23[_0x1080('0xdd')],{'$or':_['map'](_0x25cd23[_0x1080('0x49')],function(_0x408f44){var _0x4cdd1d={};_0x4cdd1d[_0x408f44]={'$like':'%'+_0x5034d4[_0x1080('0x47')]['filter']+'%'};return _0x4cdd1d;})});}_0x25cd23=_['merge']({},_0x25cd23,_0x5034d4[_0x1080('0x5c')]);return db['ScreenRecording']['count']({'where':_0x25cd23['where']})[_0x1080('0x20')](function(_0x58ffdd){_0x63b7d2[_0x1080('0x1e')]=_0x58ffdd;if(_0x5034d4[_0x1080('0x47')][_0x1080('0x45')]){_0x25cd23[_0x1080('0x46')]=[{'all':!![]}];}return db[_0x1080('0xe7')]['findAll'](_0x25cd23);})[_0x1080('0x20')](function(_0x5b6b1a){_0x63b7d2['rows']=_0x5b6b1a;return _0x63b7d2;});}})[_0x1080('0x20')](respondWithFilteredResult(_0x30e5e8,_0x25cd23))[_0x1080('0x62')](handleError(_0x30e5e8,null));};exports[_0x1080('0xe8')]=function(_0x2c9583,_0x3d0cfc){var _0x5d2247={};var _0x347df6={};var _0x4e8d2a;var _0x2320f5;return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x2c9583[_0x1080('0x57')]['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x3d0cfc,null))[_0x1080('0x20')](function(_0x5cffe0){if(_0x5cffe0){_0x4e8d2a=_0x5cffe0;_0x347df6['model']=_[_0x1080('0xd6')](db[_0x1080('0xe9')][_0x1080('0xd7')]);_0x347df6[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x2c9583[_0x1080('0x47')]);_0x347df6[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x347df6[_0x1080('0xd5')],_0x347df6['query']);_0x5d2247['attributes']=_[_0x1080('0xd9')](_0x347df6[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x2c9583[_0x1080('0x47')][_0x1080('0xda')]));_0x5d2247['attributes']=_0x5d2247[_0x1080('0x49')]['length']?_0x5d2247[_0x1080('0x49')]:_0x347df6[_0x1080('0xd5')];_0x5d2247[_0x1080('0xdb')]=qs[_0x1080('0xdc')](_0x2c9583[_0x1080('0x47')][_0x1080('0xdc')]);_0x5d2247[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_['pick'](_0x2c9583[_0x1080('0x47')],_0x347df6[_0x1080('0xd8')]));if(_0x2c9583['query'][_0x1080('0x32')]){_0x5d2247[_0x1080('0xdd')]=_['merge'](_0x5d2247[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x5d2247['attributes'],function(_0x4ff76d){var _0x9bee51={};_0x9bee51[_0x4ff76d]={'$like':'%'+_0x2c9583[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0x9bee51;})});}_0x5d2247=_['merge']({},_0x5d2247,_0x2c9583['options']);return _0x4e8d2a[_0x1080('0xe8')](_0x5d2247);}})['then'](function(_0x5342aa){if(_0x5342aa){_0x2320f5=_0x5342aa[_0x1080('0x4e')];if(!_0x2c9583[_0x1080('0x47')][_0x1080('0xcf')]('nolimit')){_0x5d2247[_0x1080('0x1d')]=qs[_0x1080('0x1d')](_0x2c9583[_0x1080('0x47')]['limit']);_0x5d2247[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x2c9583[_0x1080('0x47')]['offset']);}return _0x4e8d2a[_0x1080('0xe8')](_0x5d2247);}})['then'](function(_0xa81d6e){if(_0xa81d6e){return _0xa81d6e?{'count':_0x2320f5,'rows':_0xa81d6e}:null;}})[_0x1080('0x20')](respondWithResult(_0x3d0cfc,null))['catch'](handleError(_0x3d0cfc,null));};exports[_0x1080('0xea')]=function(_0x495fa3,_0x8a1436){var _0x8b61d4={};var _0x17e6f3={};var _0xe4ce9b;var _0x5112fb;return db['User'][_0x1080('0x9a')]({'where':{'id':_0x495fa3['params']['id']}})['then'](handleEntityNotFound(_0x8a1436,null))['then'](function(_0x5a0d53){if(_0x5a0d53){_0xe4ce9b=_0x5a0d53;_0x17e6f3[_0x1080('0xd5')]=_[_0x1080('0xd6')](db['OpenchannelInteraction'][_0x1080('0xd7')]);_0x17e6f3[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x495fa3[_0x1080('0x47')]);_0x17e6f3['filters']=_[_0x1080('0xd9')](_0x17e6f3['model'],_0x17e6f3[_0x1080('0x47')]);_0x8b61d4['attributes']=_['intersection'](_0x17e6f3[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x495fa3['query'][_0x1080('0xda')]));_0x8b61d4[_0x1080('0x49')]=_0x8b61d4[_0x1080('0x49')]['length']?_0x8b61d4[_0x1080('0x49')]:_0x17e6f3[_0x1080('0xd5')];_0x8b61d4[_0x1080('0xdb')]=qs[_0x1080('0xdc')](_0x495fa3[_0x1080('0x47')][_0x1080('0xdc')]);_0x8b61d4[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_['pick'](_0x495fa3[_0x1080('0x47')],_0x17e6f3[_0x1080('0xd8')]));if(_0x495fa3[_0x1080('0x47')]['filter']){_0x8b61d4[_0x1080('0xdd')]=_[_0x1080('0x5b')](_0x8b61d4['where'],{'$or':_[_0x1080('0x34')](_0x8b61d4[_0x1080('0x49')],function(_0x8a69){var _0x2f55f8={};_0x2f55f8[_0x8a69]={'$like':'%'+_0x495fa3[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0x2f55f8;})});}_0x8b61d4=_[_0x1080('0x5b')]({},_0x8b61d4,_0x495fa3[_0x1080('0x5c')]);return _0xe4ce9b[_0x1080('0xea')](_0x8b61d4);}})['then'](function(_0x139bde){if(_0x139bde){_0x5112fb=_0x139bde[_0x1080('0x4e')];if(!_0x495fa3[_0x1080('0x47')]['hasOwnProperty'](_0x1080('0xe1'))){_0x8b61d4['limit']=qs['limit'](_0x495fa3['query'][_0x1080('0x1d')]);_0x8b61d4[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x495fa3[_0x1080('0x47')][_0x1080('0x1b')]);}return _0xe4ce9b[_0x1080('0xea')](_0x8b61d4);}})[_0x1080('0x20')](function(_0x2e0d06){if(_0x2e0d06){return _0x2e0d06?{'count':_0x5112fb,'rows':_0x2e0d06}:null;}})['then'](respondWithResult(_0x8a1436,null))['catch'](handleError(_0x8a1436,null));};exports[_0x1080('0xeb')]=function(_0x44b669,_0x5c9139){var _0x226fb3={'raw':!![],'where':{}};var _0x292f91={};var _0x3d98de={'count':0x0,'rows':[]};return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x44b669['params']['id']}})['then'](handleEntityNotFound(_0x5c9139,null))[_0x1080('0x20')](function(_0x11cf7a){if(_0x11cf7a){_0x292f91[_0x1080('0xd5')]=_[_0x1080('0xd6')](db['MailInteraction'][_0x1080('0xd7')]);_0x292f91[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x44b669['query']);_0x292f91[_0x1080('0xd8')]=_['intersection'](_0x292f91['model'],_0x292f91['query']);_0x226fb3[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x292f91['model'],qs[_0x1080('0xda')](_0x44b669[_0x1080('0x47')]['fields']));_0x226fb3[_0x1080('0x49')]=_0x226fb3[_0x1080('0x49')][_0x1080('0x4e')]?_0x226fb3['attributes']:_0x292f91[_0x1080('0xd5')];if(!_0x44b669[_0x1080('0x47')]['hasOwnProperty']('nolimit')){_0x226fb3['limit']=qs['limit'](_0x44b669[_0x1080('0x47')]['limit']);_0x226fb3[_0x1080('0x1b')]=qs['offset'](_0x44b669['query'][_0x1080('0x1b')]);}_0x226fb3[_0x1080('0xdb')]=qs['sort'](_0x44b669[_0x1080('0x47')][_0x1080('0xdc')]);_0x226fb3['where']=qs['filters'](_['pick'](_0x44b669[_0x1080('0x47')],_0x292f91[_0x1080('0xd8')]));_0x226fb3[_0x1080('0xdd')][_0x1080('0xe5')]=_0x11cf7a['id'];if(_0x44b669[_0x1080('0x47')][_0x1080('0x32')]){_0x226fb3[_0x1080('0xdd')]=_[_0x1080('0x5b')](_0x226fb3[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x226fb3['attributes'],function(_0x4a8ab7){var _0x1f7b02={};_0x1f7b02[_0x4a8ab7]={'$like':'%'+_0x44b669[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0x1f7b02;})});}_0x226fb3=_[_0x1080('0x5b')]({},_0x226fb3,_0x44b669['options']);return db[_0x1080('0xec')]['count']({'where':_0x226fb3[_0x1080('0xdd')]})['then'](function(_0x43e875){_0x3d98de[_0x1080('0x1e')]=_0x43e875;if(_0x44b669[_0x1080('0x47')]['includeAll']){_0x226fb3[_0x1080('0x46')]=[{'all':!![]}];}return db[_0x1080('0xec')][_0x1080('0x4b')](_0x226fb3);})[_0x1080('0x20')](function(_0x5bf0c4){_0x3d98de[_0x1080('0x4c')]=_0x5bf0c4;return _0x3d98de;});}})['then'](respondWithFilteredResult(_0x5c9139,_0x226fb3))[_0x1080('0x62')](handleError(_0x5c9139,null));};exports[_0x1080('0xed')]=function(_0x2249da,_0x116bbf){var _0x8fc6cc={};var _0x3bd0a2={};var _0x529801;var _0x52b4b2;return db['User'][_0x1080('0x9a')]({'where':{'id':_0x2249da[_0x1080('0x57')]['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x116bbf,null))[_0x1080('0x20')](function(_0x2e317e){if(_0x2e317e){_0x529801=_0x2e317e;_0x3bd0a2[_0x1080('0xd5')]=_[_0x1080('0xd6')](db['SmsInteraction']['rawAttributes']);_0x3bd0a2['query']=_[_0x1080('0xd6')](_0x2249da[_0x1080('0x47')]);_0x3bd0a2[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x3bd0a2[_0x1080('0xd5')],_0x3bd0a2[_0x1080('0x47')]);_0x8fc6cc[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x3bd0a2['model'],qs[_0x1080('0xda')](_0x2249da[_0x1080('0x47')][_0x1080('0xda')]));_0x8fc6cc[_0x1080('0x49')]=_0x8fc6cc[_0x1080('0x49')]['length']?_0x8fc6cc[_0x1080('0x49')]:_0x3bd0a2[_0x1080('0xd5')];_0x8fc6cc[_0x1080('0xdb')]=qs['sort'](_0x2249da[_0x1080('0x47')][_0x1080('0xdc')]);_0x8fc6cc[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_['pick'](_0x2249da[_0x1080('0x47')],_0x3bd0a2[_0x1080('0xd8')]));if(_0x2249da[_0x1080('0x47')][_0x1080('0x32')]){_0x8fc6cc[_0x1080('0xdd')]=_[_0x1080('0x5b')](_0x8fc6cc[_0x1080('0xdd')],{'$or':_['map'](_0x8fc6cc[_0x1080('0x49')],function(_0x5db64b){var _0xe1819a={};_0xe1819a[_0x5db64b]={'$like':'%'+_0x2249da[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0xe1819a;})});}_0x8fc6cc=_[_0x1080('0x5b')]({},_0x8fc6cc,_0x2249da[_0x1080('0x5c')]);return _0x529801[_0x1080('0xed')](_0x8fc6cc);}})[_0x1080('0x20')](function(_0x4adc0d){if(_0x4adc0d){_0x52b4b2=_0x4adc0d[_0x1080('0x4e')];if(!_0x2249da[_0x1080('0x47')][_0x1080('0xcf')](_0x1080('0xe1'))){_0x8fc6cc[_0x1080('0x1d')]=qs[_0x1080('0x1d')](_0x2249da[_0x1080('0x47')][_0x1080('0x1d')]);_0x8fc6cc[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x2249da['query'][_0x1080('0x1b')]);}return _0x529801[_0x1080('0xed')](_0x8fc6cc);}})[_0x1080('0x20')](function(_0x4351a9){if(_0x4351a9){return _0x4351a9?{'count':_0x52b4b2,'rows':_0x4351a9}:null;}})[_0x1080('0x20')](respondWithResult(_0x116bbf,null))[_0x1080('0x62')](handleError(_0x116bbf,null));};exports[_0x1080('0xee')]=function(_0x25ac61,_0x380b12){var _0x5ae161={};var _0x48d7a8={};var _0x5a2811;var _0x4275f5;return db['User'][_0x1080('0x9a')]({'where':{'id':_0x25ac61['params']['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x380b12,null))[_0x1080('0x20')](function(_0x4eeec8){if(_0x4eeec8){_0x5a2811=_0x4eeec8;_0x48d7a8[_0x1080('0xd5')]=_[_0x1080('0xd6')](db['FaxInteraction'][_0x1080('0xd7')]);_0x48d7a8[_0x1080('0x47')]=_['keys'](_0x25ac61[_0x1080('0x47')]);_0x48d7a8[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x48d7a8['model'],_0x48d7a8[_0x1080('0x47')]);_0x5ae161['attributes']=_['intersection'](_0x48d7a8[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x25ac61[_0x1080('0x47')]['fields']));_0x5ae161[_0x1080('0x49')]=_0x5ae161[_0x1080('0x49')][_0x1080('0x4e')]?_0x5ae161[_0x1080('0x49')]:_0x48d7a8[_0x1080('0xd5')];_0x5ae161['order']=qs[_0x1080('0xdc')](_0x25ac61['query']['sort']);_0x5ae161['where']=qs[_0x1080('0xd8')](_['pick'](_0x25ac61[_0x1080('0x47')],_0x48d7a8[_0x1080('0xd8')]));if(_0x25ac61['query'][_0x1080('0x32')]){_0x5ae161[_0x1080('0xdd')]=_[_0x1080('0x5b')](_0x5ae161[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x5ae161['attributes'],function(_0x1b517e){var _0xcdc60b={};_0xcdc60b[_0x1b517e]={'$like':'%'+_0x25ac61['query'][_0x1080('0x32')]+'%'};return _0xcdc60b;})});}_0x5ae161=_[_0x1080('0x5b')]({},_0x5ae161,_0x25ac61[_0x1080('0x5c')]);return _0x5a2811[_0x1080('0xee')](_0x5ae161);}})[_0x1080('0x20')](function(_0x5801a0){if(_0x5801a0){_0x4275f5=_0x5801a0[_0x1080('0x4e')];if(!_0x25ac61[_0x1080('0x47')][_0x1080('0xcf')](_0x1080('0xe1'))){_0x5ae161[_0x1080('0x1d')]=qs[_0x1080('0x1d')](_0x25ac61[_0x1080('0x47')]['limit']);_0x5ae161['offset']=qs[_0x1080('0x1b')](_0x25ac61['query'][_0x1080('0x1b')]);}return _0x5a2811['getFaxInteractions'](_0x5ae161);}})[_0x1080('0x20')](function(_0x12e324){if(_0x12e324){return _0x12e324?{'count':_0x4275f5,'rows':_0x12e324}:null;}})[_0x1080('0x20')](respondWithResult(_0x380b12,null))[_0x1080('0x62')](handleError(_0x380b12,null));};exports[_0x1080('0xef')]=function(_0x1938c8,_0xc06486){var _0x48358c={};var _0x4a06a3={};var _0x18d3ed;var _0x381653;return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x1938c8[_0x1080('0x57')]['id']}})[_0x1080('0x20')](handleEntityNotFound(_0xc06486,null))['then'](function(_0x41a797){if(_0x41a797){_0x18d3ed=_0x41a797;_0x4a06a3[_0x1080('0xd5')]=_['keys'](db[_0x1080('0xf0')][_0x1080('0xd7')]);_0x4a06a3[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x1938c8[_0x1080('0x47')]);_0x4a06a3[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x4a06a3[_0x1080('0xd5')],_0x4a06a3['query']);_0x48358c[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x4a06a3[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x1938c8['query'][_0x1080('0xda')]));_0x48358c['attributes']=_0x48358c[_0x1080('0x49')]['length']?_0x48358c[_0x1080('0x49')]:_0x4a06a3[_0x1080('0xd5')];_0x48358c['order']=qs[_0x1080('0xdc')](_0x1938c8[_0x1080('0x47')][_0x1080('0xdc')]);_0x48358c[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x1938c8['query'],_0x4a06a3[_0x1080('0xd8')]));if(_0x1938c8['query']['filter']){_0x48358c[_0x1080('0xdd')]=_['merge'](_0x48358c['where'],{'$or':_[_0x1080('0x34')](_0x48358c[_0x1080('0x49')],function(_0xf77e81){var _0x73f569={};_0x73f569[_0xf77e81]={'$like':'%'+_0x1938c8['query'][_0x1080('0x32')]+'%'};return _0x73f569;})});}_0x48358c=_['merge']({},_0x48358c,_0x1938c8['options']);return _0x18d3ed[_0x1080('0xef')](_0x48358c);}})[_0x1080('0x20')](function(_0x39d4ab){if(_0x39d4ab){_0x381653=_0x39d4ab[_0x1080('0x4e')];if(!_0x1938c8[_0x1080('0x47')][_0x1080('0xcf')](_0x1080('0xe1'))){_0x48358c[_0x1080('0x1d')]=qs['limit'](_0x1938c8[_0x1080('0x47')]['limit']);_0x48358c[_0x1080('0x1b')]=qs[_0x1080('0x1b')](_0x1938c8[_0x1080('0x47')]['offset']);}return _0x18d3ed[_0x1080('0xef')](_0x48358c);}})[_0x1080('0x20')](function(_0x54734a){if(_0x54734a){return _0x54734a?{'count':_0x381653,'rows':_0x54734a}:null;}})[_0x1080('0x20')](respondWithResult(_0xc06486,null))[_0x1080('0x62')](handleError(_0xc06486,null));};exports['login']=function(_0x2b27ce,_0xbe091a,_0x1f44a9){var _0x342206;var _0x5ac30a;var _0x5cb575;var _0xea9360=!_['isNil'](_0x2b27ce[_0x1080('0x57')]['id'])?_0x2b27ce[_0x1080('0x57')]['id']:!_[_0x1080('0x67')](_0x2b27ce['user']['id'])?_0x2b27ce[_0x1080('0x2e')]['id']:null;return db[_0x1080('0x3c')][_0x1080('0x37')]({'where':{'id':_0xea9360,'role':{'$or':['admin',_0x1080('0x2e'),_0x1080('0x30')]}},'attributes':['id',_0x1080('0x38'),'phone',_0x1080('0xf1'),_0x1080('0x2a'),_0x1080('0x63'),'loginInPause']})[_0x1080('0x20')](function(_0x7e773e){if(_0x7e773e){if(_0x7e773e['role']===_0x1080('0x30')){_0x342206=_0x7e773e;if(_0x2b27ce[_0x1080('0x5d')][_0x1080('0xa2')]){_0x5cb575=util[_0x1080('0xad')](_0x1080('0xf2'),_0x342206[_0x2b27ce[_0x1080('0x5d')][_0x1080('0xa2')]]);}else if(_0x2b27ce[_0x1080('0x5d')]['intrf']){_0x5cb575=util['format'](_0x1080('0xae'),_0x2b27ce['body'][_0x1080('0xf3')]);}else{_0x5cb575=util[_0x1080('0xad')](_0x1080('0xae'),_0x342206['name']);}socket['to'](util['format']('user:%s',_0x342206[_0x1080('0x38')]))[_0x1080('0x2b')]('user:forcelogout',{'user':{'id':_0x342206['id'],'name':_0x342206[_0x1080('0x38')]},'ip':_0x2b27ce[_0x1080('0xf4')][_0x1080('0xf5')]||_0x2b27ce[_0x1080('0xf6')][_0x1080('0xf7')]||_0x2b27ce[_0x1080('0xf8')]['remoteAddress']||_0x2b27ce[_0x1080('0xf6')]['socket'][_0x1080('0xf7')]});return db[_0x1080('0xaf')][_0x1080('0xb6')]({'where':{'membername':_0x342206[_0x1080('0x38')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x1080('0xf9'));}})['then'](function(){if(_0x342206){return _0x342206[_0x1080('0xfa')]({'raw':!![]});}})[_0x1080('0x20')](function(_0x2de81b){if(_0x342206){if(_0x2de81b){_0x5ac30a=_0x2de81b;if(_0x5ac30a[_0x1080('0x4e')]){var _0x439581=_0x5ac30a[_0x1080('0x34')](function(_0xd5e571){var _0xffcd8e={'membername':_0x342206[_0x1080('0x38')],'UserId':_0x342206['id'],'queue_name':_0xd5e571[_0x1080('0x38')],'VoiceQueueId':_0xd5e571['id'],'interface':_0x5cb575,'paused':_0x342206[_0x1080('0xa0')]||![],'penalty':_0xd5e571['UserVoiceQueue.penalty']||0x0};return db[_0x1080('0xaf')][_0x1080('0xb0')](_0xffcd8e);});return Promise[_0x1080('0x55')](_0x439581);}}}})[_0x1080('0x20')](function(){if(_0x342206){return db[_0x1080('0xfb')][_0x1080('0x4b')]({'where':{'membername':_0x342206['name'],'exitAt':null}});}})[_0x1080('0x20')](function(_0xd0a1d3){if(_0x342206){var _0x5b8193=[];_0xd0a1d3[_0x1080('0xfc')](function(_0xccd8d8){_0x5b8193[_0x1080('0x4a')](_0xccd8d8[_0x1080('0x29')]({'exitAt':moment()['format'](_0x1080('0xfd'))}));});return Promise[_0x1080('0x55')](_0x5b8193);}})[_0x1080('0x20')](function(){if(_0x342206){var _0x12671e=[];var _0x1fb166=[];var _0x2a7b00=utils[_0x1080('0xfe')]();var _0x30abd4={'membername':_0x342206[_0x1080('0x38')],'interface':_0x5cb575,'enterAt':moment()['format'](_0x1080('0xfd')),'role':_0x342206[_0x1080('0x2a')],'internal':_0x342206[_0x1080('0x63')]};_0x2a7b00[_0x1080('0xfc')](function(_0x2a3aec){_0x12671e['push'](_[_0x1080('0x5b')]({'channel':_0x2a3aec,'type':_0x1080('0xff'),'data1':_0x2b27ce[_0x1080('0x5d')][_0x1080('0x100')],'data2':_0x5cb575},_0x30abd4));if(_0x342206['loginInPause']){_0x1fb166[_0x1080('0x4a')](_[_0x1080('0x5b')]({'channel':_0x2a3aec,'type':'PAUSE','data1':'LOGININPAUSE'},_0x30abd4));}});return db[_0x1080('0xfb')][_0x1080('0x8b')](_0x12671e[_0x1080('0xcc')](_0x1fb166),{'individualHooks':!![]});}})[_0x1080('0x20')](function(){if(_0x342206){return _0x342206['update']({'online':!![],'lastLoginAt':moment()[_0x1080('0xad')](_0x1080('0xfd')),'voicePause':_0x342206[_0x1080('0xa0')]||![],'mailPause':_0x342206['loginInPause']||![],'chatPause':_0x342206[_0x1080('0xa0')]||![],'faxPause':_0x342206[_0x1080('0xa0')]||![],'smsPause':_0x342206[_0x1080('0xa0')]||![],'openchannelPause':_0x342206[_0x1080('0xa0')]||![],'whatsappPause':_0x342206[_0x1080('0xa0')]||![],'pauseType':_0x342206[_0x1080('0xa0')]?_0x1080('0x101'):null,'interface':_0x5cb575,'lastPauseAt':moment()[_0x1080('0xad')](_0x1080('0xfd'))});}})['then'](function(_0x42939e){if(_0x2b27ce[_0x1080('0x102')]){return _0x1f44a9();}else{return Promise['resolve'](_0x42939e)[_0x1080('0x20')](respondWithResult(_0xbe091a,null));}})[_0x1080('0x62')](handleError(_0xbe091a,null));};exports[_0x1080('0x103')]=function(_0xbd7101,_0x5d902c){var _0x3a651e;return db[_0x1080('0x3c')]['find']({'where':{'id':_0xbd7101['params']['id'],'role':_0x1080('0x30')},'attributes':['id','name',_0x1080('0x2a')]})['then'](handleEntityNotFound(_0x5d902c,null))[_0x1080('0x20')](function(_0x42c29b){if(_0x42c29b){_0x3a651e=_0x42c29b;return db['UserVoiceQueueRt'][_0x1080('0xb6')]({'where':{'membername':_0x3a651e[_0x1080('0x38')]},'individualHooks':!![]});}})[_0x1080('0x20')](function(){return db[_0x1080('0xfb')][_0x1080('0x4b')]({'where':{'membername':_0x3a651e[_0x1080('0x38')],'exitAt':null}});})[_0x1080('0x20')](function(_0xcd8bc0){var _0x3e92bd=[];_0xcd8bc0[_0x1080('0xfc')](function(_0x2ad79d){_0x3e92bd[_0x1080('0x4a')](_0x2ad79d['update']({'exitAt':moment()[_0x1080('0xad')](_0x1080('0xfd'))}));});return Promise[_0x1080('0x55')](_0x3e92bd);})[_0x1080('0x20')](function(){return _0x3a651e[_0x1080('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1080('0x20')](respondWithResult(_0x5d902c,null))[_0x1080('0x62')](handleError(_0x5d902c,null));};exports[_0x1080('0x104')]=function(_0x55ade2,_0x5537b5){var _0x5c2c14;return db[_0x1080('0xaf')][_0x1080('0x29')]({'paused':0x1},{'where':{'UserId':_0x55ade2[_0x1080('0x57')]['id']},'individualHooks':!![]})[_0x1080('0x20')](function(){return db[_0x1080('0x3c')][_0x1080('0x37')]({'where':{'id':_0x55ade2[_0x1080('0x57')]['id'],'role':_0x1080('0x30')},'attributes':['id',_0x1080('0x38'),'role',_0x1080('0x63'),_0x1080('0xa2'),_0x1080('0x105')]});})['then'](handleEntityNotFound(_0x5537b5,null))[_0x1080('0x20')](function(_0x410467){if(_0x410467){_0x5c2c14=_0x410467;return respondWithRpcPromise(_0x1080('0x106'),_0x1080('0x104'),{'id':_0x5c2c14['id'],'name':_0x5c2c14['name'],'pause':!![]});}})['then'](function(){if(_0x5c2c14){return db[_0x1080('0xfb')][_0x1080('0x4b')]({'where':{'membername':_0x5c2c14[_0x1080('0x38')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x453fa5){if(_0x453fa5[_0x1080('0x4e')]){var _0x189cb9=moment()[_0x1080('0xad')](_0x1080('0xfd'));for(var _0x5acfc8=0x0,_0xa29a00=_0x453fa5['length'];_0x5acfc8<_0xa29a00;_0x5acfc8++){_0x453fa5[_0x5acfc8]['updateAttributes']({'exitAt':_0x189cb9});}}})[_0x1080('0x20')](function(){var _0x364bf6=[];var _0x1e6536=utils[_0x1080('0xfe')]();_0x1e6536['forEach'](function(_0x28cdad){_0x364bf6[_0x1080('0x4a')]({'channel':_0x28cdad,'membername':_0x5c2c14[_0x1080('0x38')],'interface':_[_0x1080('0x67')](_0x5c2c14['interface'])?util[_0x1080('0xad')](_0x1080('0xae'),_0x5c2c14[_0x1080('0x38')]):_0x5c2c14['interface'],'type':_0x1080('0x107'),'enterAt':moment()[_0x1080('0xad')](_0x1080('0xfd')),'data1':_0x55ade2[_0x1080('0x5d')]['type']||_0x1080('0x108'),'role':_0x5c2c14['role'],'internal':_0x5c2c14[_0x1080('0x63')]});});return db[_0x1080('0xfb')][_0x1080('0x8b')](_0x364bf6,{'individualHooks':!![]});})[_0x1080('0x20')](function(){return _0x5c2c14[_0x1080('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x55ade2[_0x1080('0x5d')][_0x1080('0x3e')]||_0x1080('0x108'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x5537b5,null))[_0x1080('0x62')](handleError(_0x5537b5,null));};exports[_0x1080('0x109')]=function(_0xe92178,_0x10c1bc){if(_0xe92178[_0x1080('0x5d')][_0x1080('0xb2')]&&!utils[_0x1080('0xb3')](_0xe92178['body']['channel'])){throw new APIBadRequestError(util[_0x1080('0xad')](_0x1080('0x10a'),_0xe92178[_0x1080('0x5d')][_0x1080('0xb2')]));}return db[_0x1080('0x3c')]['find']({'where':{'id':_0xe92178[_0x1080('0x57')]['id']},'attributes':['id',_0x1080('0x38'),_0x1080('0x2a'),_0x1080('0x63'),_0x1080('0xa2'),_0x1080('0x105'),_0x1080('0xa1'),_0x1080('0x10b'),_0x1080('0x10c'),_0x1080('0x10d'),_0x1080('0x10e'),_0x1080('0x10f'),_0x1080('0x110'),_0x1080('0x111'),_0x1080('0x112')]})[_0x1080('0x20')](function(_0x1afb06){if(!_0x1afb06){throw new APINotFoundError(util[_0x1080('0xad')](_0x1080('0xce'),_0xe92178[_0x1080('0x57')]['id']));}return _0x1afb06['unpause'](_0xe92178[_0x1080('0x5d')][_0x1080('0xb2')]);})['then'](respondWithResult(_0x10c1bc,null))[_0x1080('0x62')](APIHandleError(_0x10c1bc));};exports[_0x1080('0x113')]=function(_0x19cf62,_0x197315){var _0x3929f5={};var _0x33100c={};var _0x42be3e;var _0x582e86;return db['User'][_0x1080('0x9a')]({'where':{'id':_0x19cf62[_0x1080('0x57')]['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x197315,null))[_0x1080('0x20')](function(_0x3b5783){if(_0x3b5783){_0x42be3e=_0x3b5783;_0x33100c[_0x1080('0xd5')]=_[_0x1080('0xd6')](db[_0x1080('0x114')][_0x1080('0xd7')]);_0x33100c['query']=_[_0x1080('0xd6')](_0x19cf62[_0x1080('0x47')]);_0x33100c[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x33100c[_0x1080('0xd5')],_0x33100c[_0x1080('0x47')]);_0x3929f5['attributes']=_[_0x1080('0xd9')](_0x33100c[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x19cf62['query'][_0x1080('0xda')]));_0x3929f5[_0x1080('0x49')]=_0x3929f5['attributes'][_0x1080('0x4e')]?_0x3929f5[_0x1080('0x49')]:_0x33100c[_0x1080('0xd5')];_0x3929f5['order']=qs[_0x1080('0xdc')](_0x19cf62[_0x1080('0x47')][_0x1080('0xdc')]);_0x3929f5[_0x1080('0xdd')]=qs[_0x1080('0xd8')](_[_0x1080('0xde')](_0x19cf62[_0x1080('0x47')],_0x33100c[_0x1080('0xd8')]));if(_0x19cf62[_0x1080('0x47')][_0x1080('0x32')]){_0x3929f5['where']=_['merge'](_0x3929f5['where'],{'$or':_[_0x1080('0x34')](_0x3929f5[_0x1080('0x49')],function(_0x267239){var _0x5012f4={};_0x5012f4[_0x267239]={'$like':'%'+_0x19cf62['query'][_0x1080('0x32')]+'%'};return _0x5012f4;})});}_0x3929f5=_[_0x1080('0x5b')]({},_0x3929f5,_0x19cf62[_0x1080('0x5c')]);return _0x42be3e[_0x1080('0x113')](_0x3929f5);}})[_0x1080('0x20')](function(_0x25bf30){if(_0x25bf30){_0x582e86=_0x25bf30['length'];if(!_0x19cf62[_0x1080('0x47')]['hasOwnProperty']('nolimit')){_0x3929f5[_0x1080('0x1d')]=qs[_0x1080('0x1d')](_0x19cf62[_0x1080('0x47')][_0x1080('0x1d')]);_0x3929f5['offset']=qs[_0x1080('0x1b')](_0x19cf62['query'][_0x1080('0x1b')]);}return _0x42be3e['getTeams'](_0x3929f5);}})[_0x1080('0x20')](function(_0x2a3034){if(_0x2a3034){return _0x2a3034?{'count':_0x582e86,'rows':_0x2a3034}:null;}})[_0x1080('0x20')](respondWithResult(_0x197315,null))[_0x1080('0x62')](handleError(_0x197315,null));};exports[_0x1080('0x115')]=function(_0x2acb46,_0x5cc5d0){var _0x2ea890=_0x2acb46['params']['id'];var _0x3752e2=_0x2acb46['body']?_0x2acb46['body'][_0x1080('0x60')]:null;var _0xcbe835=[];return Promise[_0x1080('0x116')]()[_0x1080('0x20')](function(){if(!_0x3752e2)throw new APIBadRequestError(_0x1080('0x117'));})['then'](function(){return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x2ea890}});})['then'](function(_0x5e5756){if(!_0x5e5756)throw new APINotFoundError(util[_0x1080('0xad')](_0x1080('0xce'),_0x2acb46[_0x1080('0x57')]['id']));return db['sequelize']['transaction'](function(_0x12861f){return _0x5e5756['addTeams'](_0x3752e2,{'transaction':_0x12861f})[_0x1080('0x20')](function(){return db[_0x1080('0x114')][_0x1080('0x4b')]({'where':{'id':{'$in':_0x3752e2}}});})[_0x1080('0x20')](function(_0x518c93){var _0x4dddbb=_[_0x1080('0x34')](_0x518c93,function(_0x30fe7f){return _0x30fe7f[_0x1080('0x118')]();});return Promise[_0x1080('0x55')](_0x4dddbb);})[_0x1080('0x20')](function(_0x454687){_0xcbe835=_[_0x1080('0x119')](_0x454687);var _0x1b8bc4=_['map'](_0xcbe835,function(_0x4564e2){return _0x4564e2[_0x1080('0x11a')](_0x5e5756['id'],{'transaction':_0x12861f});});return Promise['all'](_0x1b8bc4);})[_0x1080('0x20')](function(){if(!_0x5e5756['online'])return;var _0x247174=_[_0x1080('0x32')](_0xcbe835,function(_0x2ec200){return _0x2ec200[_0x1080('0x11b')]('channel')===_0x1080('0x11c');});var _0x2bfe71=_[_0x1080('0x34')](_0x247174,function(_0x200b1b){return db['UserVoiceQueueRt'][_0x1080('0xb0')]({'membername':_0x5e5756[_0x1080('0x38')],'UserId':_0x5e5756['id'],'queue_name':_0x200b1b[_0x1080('0x38')],'VoiceQueueId':_0x200b1b['id'],'interface':_['isNil'](_0x5e5756[_0x1080('0xa2')])?util[_0x1080('0xad')](_0x1080('0xae'),_0x5e5756['name']):_0x5e5756[_0x1080('0xa2')],'paused':_0x5e5756['voicePause']||![],'penalty':_0x5e5756['penalty']},{'transaction':_0x12861f});});return Promise[_0x1080('0x55')](_0x2bfe71);})['then'](function(){return db[_0x1080('0x11d')][_0x1080('0x4b')]({'where':{'teamId':{'$in':_0x3752e2}}});})[_0x1080('0x20')](function(_0x1169b2){var _0x44649c=_[_0x1080('0x34')](_0x1169b2,function(_0xfc4ebc){return db['UserVoicePrefix'][_0x1080('0x80')]({'UserId':_0x5e5756['id'],'VoicePrefixId':_0xfc4ebc[_0x1080('0x11e')]},{'transaction':_0x12861f});});return Promise[_0x1080('0x55')](_0x44649c);});});})[_0x1080('0x20')](function(){for(var _0x549bb0=0x0;_0x549bb0<_0xcbe835[_0x1080('0x4e')];_0x549bb0++){var _0x235b70=_0xcbe835[_0x549bb0]['getDataValue'](_0x1080('0xb2'));var _0x1131c2=_0x235b70+_0x1080('0xa9');socket['emit'](_0x1080('0x2e')+_0x235b70+_0x1080('0xaa'),{'UserId':_0x2ea890,['queueField']:_0xcbe835[_0x549bb0]['id']});}})[_0x1080('0x20')](respondWithStatusCode(_0x5cc5d0,null))[_0x1080('0x62')](APIHandleError(_0x5cc5d0));};exports[_0x1080('0x11f')]=function(_0x43067e,_0x288fc1){var _0x31847a=_0x43067e[_0x1080('0x57')]['id'];var _0x1387f8=null;if(_0x43067e['query'][_0x1080('0x60')]){_0x1387f8=_[_0x1080('0xb4')](_0x43067e['query'][_0x1080('0x60')])?_0x43067e[_0x1080('0x47')]['ids']:[_0x43067e[_0x1080('0x47')][_0x1080('0x60')]];}var _0x5118bd=[];return Promise[_0x1080('0x116')]()[_0x1080('0x20')](function(){if(!_0x1387f8)throw new APIBadRequestError(_0x1080('0x120'));})[_0x1080('0x20')](function(){return db[_0x1080('0x3c')][_0x1080('0x9a')]({'where':{'id':_0x31847a}});})['then'](function(_0x510772){if(!_0x510772)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x43067e[_0x1080('0x57')]['id']));return db['sequelize']['transaction'](function(_0x1022c0){return _0x510772[_0x1080('0x11f')](_0x1387f8,{'transaction':_0x1022c0})[_0x1080('0x20')](function(){return db[_0x1080('0x114')][_0x1080('0x4b')]({'where':{'id':{'$in':_0x1387f8}}});})[_0x1080('0x20')](function(_0x34d7c6){var _0x57ea41=_[_0x1080('0x34')](_0x34d7c6,function(_0x46c62e){return _0x46c62e[_0x1080('0x118')]();});return Promise[_0x1080('0x55')](_0x57ea41);})[_0x1080('0x20')](function(_0x409a45){_0x5118bd=_['flattenDeep'](_0x409a45);var _0x23dd94=_['map'](_0x5118bd,function(_0x5bad2f){return _0x5bad2f[_0x1080('0x121')](_0x510772['id'],{'transaction':_0x1022c0});});return Promise['all'](_0x23dd94);})[_0x1080('0x20')](function(){if(!_0x510772['online'])return;var _0xc3c62c=_[_0x1080('0x32')](_0x5118bd,function(_0x595492){return _0x595492['getDataValue'](_0x1080('0xb2'))===_0x1080('0x11c');});var _0x4b7b2e=_[_0x1080('0x34')](_0xc3c62c,function(_0x30c8eb){return db[_0x1080('0xaf')]['destroy']({'where':{'VoiceQueueId':_0x30c8eb['id'],'UserId':_0x510772['id']},'transaction':_0x1022c0});});return Promise['all'](_0x4b7b2e);})[_0x1080('0x20')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x1387f8}}});})['then'](function(_0x49019d){var _0x8ac51=_[_0x1080('0x34')](_0x49019d,function(_0x4aedf0){return db[_0x1080('0x122')][_0x1080('0xb6')]({'where':{'UserId':_0x510772['id'],'VoicePrefixId':_0x4aedf0[_0x1080('0x11e')]}},{'transaction':_0x1022c0});});return Promise[_0x1080('0x55')](_0x8ac51);});});})[_0x1080('0x20')](function(){for(var _0x199766=0x0;_0x199766<_0x5118bd['length'];_0x199766++){var _0x131ddb=_0x5118bd[_0x199766][_0x1080('0x11b')](_0x1080('0xb2'));var _0x1ccb0e=_0x131ddb+_0x1080('0xa9');socket[_0x1080('0x2b')](_0x1080('0x2e')+_0x131ddb+_0x1080('0xb5'),{'UserId':_0x31847a,['queueField']:_0x5118bd[_0x199766]['id']});}})[_0x1080('0x20')](respondWithStatusCode(_0x288fc1,null))['catch'](APIHandleError(_0x288fc1));};exports[_0x1080('0x123')]=function(_0x55b152,_0x22301b){var _0x2e5030={};var _0x4fae65={};var _0x61ecf7;var _0x230ed7;return db['User'][_0x1080('0x9a')]({'where':{'id':_0x55b152[_0x1080('0x57')]['id']}})['then'](handleEntityNotFound(_0x22301b,null))['then'](function(_0x18c9a7){if(_0x18c9a7){_0x61ecf7=_0x18c9a7;_0x4fae65[_0x1080('0xd5')]=_[_0x1080('0xd6')](db[_0x1080('0xd0')][_0x1080('0xd7')]);_0x4fae65['query']=_[_0x1080('0xd6')](_0x55b152['query']);_0x4fae65[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x4fae65[_0x1080('0xd5')],_0x4fae65[_0x1080('0x47')]);_0x2e5030[_0x1080('0x49')]=_[_0x1080('0xd9')](_0x4fae65[_0x1080('0xd5')],qs['fields'](_0x55b152[_0x1080('0x47')][_0x1080('0xda')]));_0x2e5030[_0x1080('0x49')]=_0x2e5030[_0x1080('0x49')][_0x1080('0x4e')]?_0x2e5030[_0x1080('0x49')]:_0x4fae65[_0x1080('0xd5')];_0x2e5030[_0x1080('0xdb')]=qs['sort'](_0x55b152[_0x1080('0x47')][_0x1080('0xdc')]);_0x2e5030['where']=qs['filters'](_[_0x1080('0xde')](_0x55b152[_0x1080('0x47')],_0x4fae65[_0x1080('0xd8')]));if(_0x55b152[_0x1080('0x47')][_0x1080('0x32')]){_0x2e5030[_0x1080('0xdd')]=_['merge'](_0x2e5030[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x2e5030[_0x1080('0x49')],function(_0x548a46){var _0x207d31={};_0x207d31[_0x548a46]={'$like':'%'+_0x55b152[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0x207d31;})});}_0x2e5030=_[_0x1080('0x5b')]({},_0x2e5030,_0x55b152['options']);return _0x61ecf7[_0x1080('0x123')](_0x2e5030);}})[_0x1080('0x20')](function(_0x4538e7){if(_0x4538e7){_0x230ed7=_0x4538e7[_0x1080('0x4e')];if(!_0x55b152[_0x1080('0x47')][_0x1080('0xcf')](_0x1080('0xe1'))){_0x2e5030[_0x1080('0x1d')]=qs[_0x1080('0x1d')](_0x55b152[_0x1080('0x47')][_0x1080('0x1d')]);_0x2e5030['offset']=qs[_0x1080('0x1b')](_0x55b152['query'][_0x1080('0x1b')]);}return _0x61ecf7['getLists'](_0x2e5030);}})['then'](function(_0xbd679e){if(_0xbd679e){return _0xbd679e?{'count':_0x230ed7,'rows':_0xbd679e}:null;}})[_0x1080('0x20')](respondWithResult(_0x22301b,null))[_0x1080('0x62')](handleError(_0x22301b,null));};exports[_0x1080('0x124')]=function(_0x5e9801,_0x1de242){var _0x45ad44={};var _0x211484={};var _0x359c7d;return db['User'][_0x1080('0x9a')]({'where':{'id':_0x5e9801['params']['id']}})[_0x1080('0x20')](handleEntityNotFound(_0x1de242,null))[_0x1080('0x20')](function(_0x517a4f){if(_0x517a4f){_0x359c7d=_0x517a4f;_0x211484[_0x1080('0xd5')]=_[_0x1080('0xd6')](db[_0x1080('0x3c')][_0x1080('0xd7')]);_0x211484[_0x1080('0x47')]=_[_0x1080('0xd6')](_0x5e9801[_0x1080('0x47')]);_0x211484[_0x1080('0xd8')]=_[_0x1080('0xd9')](_0x211484['model'],_0x211484[_0x1080('0x47')]);_0x45ad44['attributes']=_[_0x1080('0xd9')](_0x211484[_0x1080('0xd5')],qs[_0x1080('0xda')](_0x5e9801['query'][_0x1080('0xda')]));_0x45ad44[_0x1080('0x49')]=_0x45ad44[_0x1080('0x49')][_0x1080('0x4e')]?_0x45ad44[_0x1080('0x49')]:_0x211484[_0x1080('0xd5')];_0x45ad44[_0x1080('0xdb')]=qs[_0x1080('0xdc')](_0x5e9801['query'][_0x1080('0xdc')]);_0x45ad44['where']=qs[_0x1080('0xd8')](_['pick'](_0x5e9801['query'],_0x211484[_0x1080('0xd8')]));if(_0x5e9801['query'][_0x1080('0x32')]){_0x45ad44[_0x1080('0xdd')]=_['merge'](_0x45ad44[_0x1080('0xdd')],{'$or':_[_0x1080('0x34')](_0x45ad44['attributes'],function(_0x44bcce){var _0x31f292={};_0x31f292[_0x44bcce]={'$like':'%'+_0x5e9801[_0x1080('0x47')][_0x1080('0x32')]+'%'};return _0x31f292;})});}_0x45ad44[_0x1080('0xd5')]=db[_0x1080('0x3c')];_0x45ad44['as']=_0x1080('0x2f');_0x45ad44=_[_0x1080('0x5b')]({},_0x45ad44,_0x5e9801[_0x1080('0x5c')]);return _0x359c7d['getVoiceQueues']({'include':[_0x45ad44]});}})[_0x1080('0x20')](function(_0x2a4ee5){if(_0x2a4ee5){var _0x2c8199={},_0x339be8=[];for(var _0x5ae308=0x0;_0x5ae308<_0x2a4ee5[_0x1080('0x4e')];_0x5ae308+=0x1){for(var _0x2af400=0x0,_0x1d9f60;_0x2af400<_0x2a4ee5[_0x5ae308]['Agents'][_0x1080('0x4e')];_0x2af400+=0x1){_0x1d9f60=_0x2a4ee5[_0x5ae308][_0x1080('0x2f')][_0x2af400][_0x1080('0x2c')]({'plain':!![]});_0x2c8199[_0x1d9f60['id']]=_0x1d9f60;}}_0x2c8199=_[_0x1080('0x125')](_0x2c8199);for(var _0x17b011=qs[_0x1080('0x1b')](_0x5e9801['query'][_0x1080('0x1b')]);_0x17b011<_0x2c8199[_0x1080('0x4e')]&&_0x339be8['length']=_0x4e5d44){_0x5d7eec=_0x4e5d44;_0x989b20=0xc8;}else{_0x989b20=0xce;}_0x19b1c6[_0x7e30('0x19')](_0x989b20);return _0x19b1c6[_0x7e30('0x1f')](_0x7e30('0x20'),_0xeed1a0+'-'+_0x5d7eec+'/'+_0x4e5d44)[_0x7e30('0x1a')](_0x7a1c6f);}return null;};}function respondWithRpcPromise(_0x2837ac,_0x1b4fb3,_0x16911d,_0x432a01){return new Promise(function(_0x224aac,_0x3d882e){var _0xca8eb1=_0x432a01||amiClient;return _0xca8eb1[_0x7e30('0x21')](_0x2837ac,_0x16911d)[_0x7e30('0x22')](function(_0x4d4afa){logger['info'](_0x7e30('0x23'),_0x1b4fb3,_0x7e30('0x24'));logger[_0x7e30('0x25')](_0x7e30('0x26'),_0x1b4fb3,_0x7e30('0x24'),JSON[_0x7e30('0x27')](_0x4d4afa));if(_0x4d4afa[_0x7e30('0x28')]){if(_0x4d4afa[_0x7e30('0x28')]['code']===0x1f4){logger[_0x7e30('0x28')]('User,\x20%s,\x20%s',_0x1b4fb3,_0x4d4afa['error'][_0x7e30('0x29')]);return _0x3d882e(_0x4d4afa['error'][_0x7e30('0x29')]);}logger[_0x7e30('0x28')](_0x7e30('0x23'),_0x1b4fb3,_0x4d4afa[_0x7e30('0x28')]['message']);return _0x224aac(_0x4d4afa['error'][_0x7e30('0x29')]);}else{logger['info'](_0x7e30('0x23'),_0x1b4fb3,_0x7e30('0x24'));_0x224aac(_0x4d4afa[_0x7e30('0x2a')]['message']);}})[_0x7e30('0x2b')](function(_0x2c6151){logger[_0x7e30('0x28')](_0x7e30('0x23'),_0x1b4fb3,_0x2c6151);_0x3d882e(_0x2c6151);});});}function saveUpdates(_0x223eeb){return function(_0x165cd3){if(_0x165cd3){return _0x165cd3[_0x7e30('0x2c')](_0x223eeb)[_0x7e30('0x22')](function(_0x807e3e){if(_0x807e3e[_0x7e30('0x2d')]===_0x7e30('0x2e')){socket[_0x7e30('0x2f')](_0x7e30('0x30')+_0x807e3e['id'],_0x807e3e);}return _0x807e3e;});}return null;};}function removeEntity(_0x587547,_0x3667df){return function(_0x4c6c41){if(_0x4c6c41){return _0x4c6c41['destroy']({'transaction':_0x3667df})[_0x7e30('0x22')](function(){var _0x314e58=_0x4c6c41['get']({'plain':!![]});if(_0x314e58[_0x7e30('0x2d')]==='admin')return;var _0x265c55=[{'name':_0x7e30('0x31'),'value':_0x7e30('0x32'),'ignore':!![]},{'name':_0x7e30('0x33'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x7e30('0x34'),'ignore':![]}];var _0x3dc965=_(_0x265c55)['filter'](_0x7e30('0x35'))['map'](_0x7e30('0x36'))[_0x7e30('0x36')]();if(_['includes'](_0x3dc965,_0x314e58['role'])){return;}var _0x4110ff=_['find'](_0x265c55,[_0x7e30('0x36'),_0x314e58[_0x7e30('0x2d')]])[_0x7e30('0x37')];return db['UserProfileResource'][_0x7e30('0x38')]({'where':{'type':_0x4110ff,'resourceId':_0x314e58['id']},'transaction':_0x3667df})['then'](function(){return _0x4c6c41;});})[_0x7e30('0x22')](function(){_0x587547[_0x7e30('0x19')](0xcc)[_0x7e30('0x18')]();});}};}function handleEntityNotFound(_0x28b0a7){return function(_0x132111){if(!_0x132111){_0x28b0a7[_0x7e30('0x17')](0x194);}return _0x132111;};}function handleError(_0x29f757,_0x3b6883){_0x3b6883=_0x3b6883||0x1f4;return function(_0xbe7a06){logger['error'](_0xbe7a06[_0x7e30('0x39')]);if(_0xbe7a06[_0x7e30('0x37')]){delete _0xbe7a06[_0x7e30('0x37')];}_0x29f757[_0x7e30('0x19')](_0x3b6883)['send'](_0xbe7a06);};}function getUserAttributes(){return _(db['User'][_0x7e30('0x3a')])[_0x7e30('0x3b')](function(_0x42c34a){return{'name':_0x42c34a[_0x7e30('0x3c')],'type':_0x42c34a[_0x7e30('0x3d')]['key']};})[_0x7e30('0x3e')](function(_0x54da){return![_0x7e30('0x3f'),'salt',_0x7e30('0x40'),_0x7e30('0x41'),_0x7e30('0x42'),_0x7e30('0x43')][_0x7e30('0x44')](_0x54da[_0x7e30('0x37')]);})['value']();}exports[_0x7e30('0x45')]=function(_0x46f497,_0xda6613){var _0x4cefd4={},_0x4daad3={'count':0x0,'rows':[]};var _0x44e234=getUserAttributes();_0x4cefd4=qs['getOptions'](_0x44e234,_0x46f497);var _0x36edef={'where':_0x4cefd4[_0x7e30('0x46')]};return db[_0x7e30('0x47')][_0x7e30('0x1e')](_0x36edef)[_0x7e30('0x22')](function(_0x47b24a){_0x4daad3[_0x7e30('0x1e')]=_0x47b24a;if(_0x46f497[_0x7e30('0x48')][_0x7e30('0x49')]){_0x4cefd4[_0x7e30('0x4a')]=[{'all':!![]}];}if(_0x46f497[_0x7e30('0x48')][_0x7e30('0x4b')]===_0x7e30('0x4c')){_0x4cefd4[_0x7e30('0x4a')]=[{'model':db[_0x7e30('0x4d')],'as':_0x7e30('0x4b')}];}if(!_['includes'](_0x4cefd4['attributes'],'id')){_0x4cefd4['attributes'][_0x7e30('0x4e')]('id');}return db[_0x7e30('0x47')][_0x7e30('0x4f')](_0x4cefd4);})[_0x7e30('0x22')](function(_0x582282){_0x4daad3[_0x7e30('0x50')]=_0x582282;if(_0x46f497[_0x7e30('0x48')][_0x7e30('0x51')]===_0x7e30('0x4c')){var _0x2842ad=[];for(var _0x1e0a60=0x0;_0x1e0a60<_0x4daad3[_0x7e30('0x50')][_0x7e30('0x52')];_0x1e0a60++){_0x2842ad[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x53'),_0x4daad3['rows'][_0x1e0a60]['dataValues']));_0x2842ad[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x54'),_0x4daad3[_0x7e30('0x50')][_0x1e0a60][_0x7e30('0x55')]));_0x2842ad[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x56'),_0x4daad3[_0x7e30('0x50')][_0x1e0a60][_0x7e30('0x55')]));_0x2842ad[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x57'),_0x4daad3[_0x7e30('0x50')][_0x1e0a60][_0x7e30('0x55')]));_0x2842ad[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x58'),_0x4daad3[_0x7e30('0x50')][_0x1e0a60][_0x7e30('0x55')]));_0x2842ad['push'](get_open_tabs(_0x7e30('0x59'),_0x4daad3['rows'][_0x1e0a60][_0x7e30('0x55')]));}return Promise[_0x7e30('0x5a')](_0x2842ad)['then'](function(){return _0x4daad3;});}else{return _0x4daad3;}})[_0x7e30('0x22')](respondWithFilteredResult(_0xda6613,_0x4cefd4))[_0x7e30('0x2b')](handleError(_0xda6613,null));};exports['show']=function(_0x3d0223,_0x3cc096){var _0x38e5a8=getUserAttributes();_0x3d0223[_0x7e30('0x48')]['id']=_0x3d0223[_0x7e30('0x5b')]['id'];var _0x5e0427=qs[_0x7e30('0x5c')](_0x38e5a8,_0x3d0223);if(_0x3d0223[_0x7e30('0x48')][_0x7e30('0x49')]){_0x5e0427[_0x7e30('0x4a')]=[{'all':!![]}];}if(_0x3d0223['query'][_0x7e30('0x4b')]===_0x7e30('0x4c')){_0x5e0427[_0x7e30('0x4a')]=[{'model':db[_0x7e30('0x4d')],'as':_0x7e30('0x4b')}];}_0x5e0427=_[_0x7e30('0x5d')]({},_0x5e0427,_0x3d0223[_0x7e30('0x5e')]);if(!_['includes'](_0x5e0427['attributes'],'id')){_0x5e0427[_0x7e30('0x5f')][_0x7e30('0x4e')]('id');}return db[_0x7e30('0x47')]['find'](_0x5e0427)[_0x7e30('0x22')](handleEntityNotFound(_0x3cc096,null))[_0x7e30('0x22')](function(_0x4966c2){var _0x292c42=[];values=_0x4966c2;if(_0x3d0223['query'][_0x7e30('0x51')]===_0x7e30('0x4c')){_0x292c42[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x53'),_0x4966c2[_0x7e30('0x55')]));_0x292c42[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x54'),_0x4966c2[_0x7e30('0x55')]));_0x292c42[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x58'),_0x4966c2[_0x7e30('0x55')]));_0x292c42[_0x7e30('0x4e')](get_open_tabs('whatsapp',_0x4966c2[_0x7e30('0x55')]));_0x292c42['push'](get_open_tabs(_0x7e30('0x56'),_0x4966c2[_0x7e30('0x55')]));_0x292c42[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x57'),_0x4966c2[_0x7e30('0x55')]));return Promise['all'](_0x292c42);}else{return values;}})[_0x7e30('0x22')](function(){return values;})['then'](respondWithResult(_0x3cc096,null))['catch'](handleError(_0x3cc096,null));};exports[_0x7e30('0x2c')]=function(_0x5e7950,_0x57e219){if(_0x5e7950[_0x7e30('0x60')]['id']){delete _0x5e7950[_0x7e30('0x60')]['id'];}delete _0x5e7950[_0x7e30('0x60')][_0x7e30('0x2d')];return db[_0x7e30('0x47')]['find']({'where':{'id':_0x5e7950[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x57e219,null))[_0x7e30('0x22')](saveUpdates(_0x5e7950[_0x7e30('0x60')],null))[_0x7e30('0x22')](respondWithResult(_0x57e219,null))[_0x7e30('0x2b')](handleError(_0x57e219,null));};exports[_0x7e30('0x61')]=function(_0x292332,_0x4fff1b){return db[_0x7e30('0x47')][_0x7e30('0x61')]()[_0x7e30('0x22')](respondWithResult(_0x4fff1b,null))[_0x7e30('0x2b')](handleError(_0x4fff1b,null));};exports[_0x7e30('0x62')]=function(_0x5951b4,_0x4c181f){return db[_0x7e30('0x47')]['find']({'where':{'id':_0x5951b4[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x4c181f,null))['then'](function(_0x1a708d){if(_0x1a708d){return _0x1a708d['addContacts'](_0x5951b4[_0x7e30('0x60')][_0x7e30('0x63')],_['omit'](_0x5951b4[_0x7e30('0x60')],[_0x7e30('0x63'),'id'])||{});}})[_0x7e30('0x22')](respondWithResult(_0x4c181f,null))['catch'](handleError(_0x4c181f,null));};function validateUser(_0x3634c5){return new Promise(function(_0x1e86f3,_0x3283dd){if(_0x3634c5['internal'])return _0x1e86f3(_0x3634c5);return db[_0x7e30('0x64')][_0x7e30('0x65')](0x1)[_0x7e30('0x22')](function(_0x19834a){if(_0x19834a[_0x7e30('0x66')])authService[_0x7e30('0x67')](_0x3634c5[_0x7e30('0x3f')]);db['User'][_0x7e30('0x68')](_0x7e30('0x69'))['then'](function(_0x5a6068){if(_[_0x7e30('0x6a')](_0x5a6068)){_0x3634c5[_0x7e30('0x69')]=_0x19834a[_0x7e30('0x6b')]||0x1;return;}if(_[_0x7e30('0x6a')](_0x19834a['min_internal'])||_0x19834a[_0x7e30('0x6b')]===_0x5a6068){_0x3634c5[_0x7e30('0x69')]=_0x5a6068+0x1;return;}if(_0x19834a[_0x7e30('0x6b')]>_0x5a6068){_0x3634c5[_0x7e30('0x69')]=_0x19834a[_0x7e30('0x6b')];return;}return db[_0x7e30('0x6c')][_0x7e30('0x48')](_0x7e30('0x6d'),{'type':db[_0x7e30('0x6c')]['QueryTypes']['SELECT']})[_0x7e30('0x22')](function(_0x21344b){if(_0x21344b&&_0x21344b[_0x7e30('0x52')]){for(var _0x158fe=0x0,_0x4fb1da=_0x21344b[_0x7e30('0x52')];_0x158fe<_0x4fb1da&&_['isNil'](_0x3634c5['internal']);_0x158fe++){if(_0x19834a['min_internal']<=_0x21344b[_0x158fe][_0x7e30('0x6e')]){_0x3634c5[_0x7e30('0x69')]=_0x21344b[_0x158fe]['from'];}else if(_0x19834a[_0x7e30('0x6b')]>_0x21344b[_0x158fe][_0x7e30('0x6e')]&&_0x19834a['min_internal']<=_0x21344b[_0x158fe]['to']){_0x3634c5[_0x7e30('0x69')]=_0x19834a[_0x7e30('0x6b')];}}}if(_[_0x7e30('0x6a')](_0x3634c5[_0x7e30('0x69')])){_0x3634c5[_0x7e30('0x69')]=_0x5a6068+0x1;}return _0x1e86f3(_0x3634c5);});});})[_0x7e30('0x2b')](function(_0x158cf2){_0x3283dd(_0x158cf2);});});}function updateUser(_0x33abff){return new Promise(function(_0x4bbcb9,_0x526c4b){try{if(_0x33abff[_0x7e30('0x6f')]){_0x33abff[_0x7e30('0x70')]=_0x33abff[_0x7e30('0x69')];_0x33abff['VoiceMail']={'mailbox':_0x33abff['internal'],'password':_0x33abff[_0x7e30('0x3f')],'fullname':_0x33abff[_0x7e30('0x71')],'email':_0x33abff['email']};}if(_0x33abff[_0x7e30('0x2d')]===_0x7e30('0x2e')){if(!_0x33abff[_0x7e30('0x72')])_0x33abff[_0x7e30('0x72')]=[_0x7e30('0x73'),_0x7e30('0x74'),'103',_0x7e30('0x75'),_0x7e30('0x76'),_0x7e30('0x77'),_0x7e30('0x78'),_0x7e30('0x79'),'107','108',_0x7e30('0x7a'),'100',_0x7e30('0x7b'),_0x7e30('0x7c'),_0x7e30('0x7d')];}_0x4bbcb9(_0x33abff);}catch(_0x98e195){_0x526c4b(_0x98e195);}});}exports['create']=function(_0x8a8a41,_0x35d4c1){if(_0x8a8a41['user']['role']==='agent')throw new Error('Unauthorized');if(_0x8a8a41['body'][_0x7e30('0x2d')]===_0x7e30('0x32')&&_0x8a8a41[_0x7e30('0x32')][_0x7e30('0x2d')]!==_0x7e30('0x7e')){throw new Error(_0x7e30('0x7f'));}if(_0x8a8a41['body'][_0x7e30('0x2d')]===_0x7e30('0x7e')&&_0x8a8a41[_0x7e30('0x32')]['role']!=='admin'){throw new Error(_0x7e30('0x80'));}return licenseUtil['checkUserLimits']([_0x8a8a41[_0x7e30('0x60')]])['then'](function(){return validateUser(_0x8a8a41[_0x7e30('0x60')]);})[_0x7e30('0x22')](function(_0x4d5f18){return updateUser(_0x4d5f18)['then'](function(_0x32e526){if(_0x32e526[_0x7e30('0x2d')]===_0x7e30('0x7e')){_0x32e526[_0x7e30('0x81')]=_0x8a8a41[_0x7e30('0x32')][_0x7e30('0x81')];delete _0x32e526['userProfileId'];}return _0x32e526;});})[_0x7e30('0x22')](function(_0x22dba8){return db[_0x7e30('0x47')][_0x7e30('0x82')](_0x22dba8,{'include':[{'model':db[_0x7e30('0x83')],'as':_0x7e30('0x83')}]});})['then'](function(_0x3718f0){if(_0x8a8a41[_0x7e30('0x60')]['role']===_0x7e30('0x32'))return _0x3718f0;if(_0x8a8a41[_0x7e30('0x32')][_0x7e30('0x2d')]!==_0x7e30('0x32'))return _0x3718f0;return db['UserProfileSection'][_0x7e30('0x84')]({'where':{'name':_0x3718f0[_0x7e30('0x2d')]===_0x7e30('0x2e')?'Agents':_0x7e30('0x85'),'userProfileId':_0x8a8a41['user'][_0x7e30('0x86')]},'raw':!![]})[_0x7e30('0x22')](function(_0x4a39e8){if(!_0x4a39e8||_0x4a39e8['autoAssociation']!=0x0)return _0x3718f0;return db[_0x7e30('0x87')]['create']({'name':_0x3718f0['name'],'resourceId':_0x3718f0['id'],'type':_0x4a39e8[_0x7e30('0x37')],'sectionId':_0x4a39e8['id']},{})[_0x7e30('0x22')](function(){return _0x3718f0;});})[_0x7e30('0x2b')](function(_0x50895e){logger[_0x7e30('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50895e);throw _0x50895e;});})[_0x7e30('0x22')](respondWithResult(_0x35d4c1,0xc9))[_0x7e30('0x2b')](handleError(_0x35d4c1,null));};exports[_0x7e30('0x88')]=function(_0x38dd46,_0x1fe2e6){var _0x24d59b=_0x38dd46[_0x7e30('0x60')];var _0x1d025e=[];if(_0x38dd46[_0x7e30('0x32')][_0x7e30('0x2d')]===_0x7e30('0x2e'))throw new Error('Unauthorized');if(_['some'](_0x24d59b,[_0x7e30('0x2d'),_0x7e30('0x32')])&&_0x38dd46[_0x7e30('0x32')][_0x7e30('0x2d')]!==_0x7e30('0x7e')){throw new Error(_0x7e30('0x7f'));}if(_[_0x7e30('0x89')](_0x24d59b,[_0x7e30('0x2d'),_0x7e30('0x7e')])&&_0x38dd46['user']['role']!=='admin'){throw new Error(_0x7e30('0x8a'));}return licenseUtil[_0x7e30('0x8b')](_0x24d59b)['then'](function(){return validateUser(_0x24d59b[0x0]);})['then'](function(){for(var _0x557aba=0x1;_0x557aba<_0x24d59b[_0x7e30('0x52')];_0x557aba++){var _0x41664e=_0x24d59b[_0x557aba-0x1][_0x7e30('0x69')];if(!_0x24d59b[_0x557aba][_0x7e30('0x69')])_0x24d59b[_0x557aba][_0x7e30('0x69')]=_0x41664e+0x1;_0x1d025e['push'](validateUser(_0x24d59b[_0x557aba]));}return Promise[_0x7e30('0x5a')](_0x1d025e);})[_0x7e30('0x22')](function(){_0x1d025e=[];for(var _0x52e092=0x0;_0x52e092<_0x24d59b[_0x7e30('0x52')];_0x52e092++){_0x1d025e[_0x7e30('0x4e')](updateUser(_0x24d59b[_0x52e092]));}return Promise[_0x7e30('0x5a')](_0x1d025e);})[_0x7e30('0x22')](function(){_0x1d025e=_0x24d59b['map'](function(_0x5f43f5){return db[_0x7e30('0x47')][_0x7e30('0x82')](_0x5f43f5,{'include':[{'model':db['VoiceMail'],'as':_0x7e30('0x83')}]})[_0x7e30('0x22')](function(_0x849209){_0x5f43f5['id']=_0x849209['id'];return _0x5f43f5;});});return Promise[_0x7e30('0x5a')](_0x1d025e);})[_0x7e30('0x22')](function(_0xcbac67){if(_0x38dd46['body'][_0x7e30('0x2d')]===_0x7e30('0x32'))return _0xcbac67;if(_0x38dd46['user']['role']!=='user')return _0xcbac67;var _0x3c7a90=_[_0x7e30('0x89')](_0xcbac67,function(_0x4112a2){return _0x4112a2['role']===_0x7e30('0x2e')||_0x4112a2[_0x7e30('0x2d')]==='telephone';});if(!_0x3c7a90)return _0xcbac67;return db[_0x7e30('0x8c')]['findAll']({'where':{'name':{'$or':[_0x7e30('0x33'),_0x7e30('0x85')]},'userProfileId':_0x38dd46[_0x7e30('0x32')][_0x7e30('0x86')]},'raw':!![]})[_0x7e30('0x22')](function(_0x921f3d){if(_[_0x7e30('0x8d')](_0x921f3d)||!_['some'](_0x921f3d,[_0x7e30('0x8e'),0x0]))return _0xcbac67;_0x1d025e=[];var _0x33238f=_(_0x921f3d)['map'](function(_0x9ea506){if(_0x9ea506[_0x7e30('0x8e')]===0x1)return;return _0x9ea506[_0x7e30('0x37')]===_0x7e30('0x33')?_0x7e30('0x2e'):_0x7e30('0x34');})[_0x7e30('0x8f')]()[_0x7e30('0x36')]();for(var _0x21ee95=0x0;_0x21ee95<_0xcbac67['length'];_0x21ee95++){if(!_[_0x7e30('0x44')](_0x33238f,_0xcbac67[_0x21ee95][_0x7e30('0x2d')]))return;var _0x515d86=_0xcbac67[_0x21ee95][_0x7e30('0x2d')]===_0x7e30('0x2e')?_0x7e30('0x33'):_0x7e30('0x85');_0x1d025e[_0x7e30('0x4e')](db[_0x7e30('0x87')][_0x7e30('0x82')]({'name':_0xcbac67[_0x21ee95][_0x7e30('0x37')],'resourceId':_0xcbac67[_0x21ee95]['id'],'type':_0x515d86,'sectionId':_[_0x7e30('0x84')](_0x921f3d,[_0x7e30('0x37'),_0x515d86])['id']},{}));}return Promise['all'](_0x1d025e);});})[_0x7e30('0x22')](respondWithResult(_0x1fe2e6,0xc9))[_0x7e30('0x2b')](handleError(_0x1fe2e6,null));};exports['changePassword']=function(_0x2d0ef4,_0xa2e1b3){if(_0x2d0ef4[_0x7e30('0x60')]['id']){delete _0x2d0ef4[_0x7e30('0x60')]['id'];}return db['User'][_0x7e30('0x84')]({'where':{'id':_0x2d0ef4[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](function(_0x1133c3){if(!_0x1133c3)return null;if(_0x1133c3['id']===_0x2d0ef4[_0x7e30('0x32')]['id']){if(!_0x2d0ef4[_0x7e30('0x60')]['oldPassword']||!_0x2d0ef4[_0x7e30('0x60')]['newPassword']){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1133c3[_0x7e30('0x92')](_0x2d0ef4[_0x7e30('0x60')]['oldPassword'])){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))]('Wrong\x20credentials');}if(_0x2d0ef4['body'][_0x7e30('0x93')]===_0x2d0ef4[_0x7e30('0x60')][_0x7e30('0x94')]){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))](_0x7e30('0x95'));}}else if(_0x2d0ef4[_0x7e30('0x32')][_0x7e30('0x2d')]===_0x7e30('0x7e')){if(!_0x2d0ef4[_0x7e30('0x60')][_0x7e30('0x94')]){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))](_0x7e30('0x96'));}}else if(_0x2d0ef4[_0x7e30('0x32')][_0x7e30('0x2d')]==='user'){if(!_0x2d0ef4[_0x7e30('0x60')][_0x7e30('0x94')]){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1133c3['role']!==_0x7e30('0x2e')){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))](_0x7e30('0x97'));}}else{throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))]('Unauthorized');}return _0x1133c3;})['then'](handleEntityNotFound(_0xa2e1b3,null))['then'](function(_0x392fc2){return db[_0x7e30('0x64')][_0x7e30('0x98')]({'attributes':['id',_0x7e30('0x66'),_0x7e30('0x99'),'passwordHistoryLimit']})[_0x7e30('0x22')](function(_0x16e1b7){if(_0x16e1b7['securePassword'])authService[_0x7e30('0x67')](_0x2d0ef4[_0x7e30('0x60')][_0x7e30('0x94')]);if(!_0x16e1b7[_0x7e30('0x99')]||!_0x392fc2['previousPasswords'])return _0x392fc2;authService['validatePasswordHistory'](_0x2d0ef4[_0x7e30('0x60')][_0x7e30('0x94')],_0x392fc2[_0x7e30('0x40')],_0x16e1b7['passwordHistoryLimit']);return _0x392fc2;})['then'](saveUpdates({'password':_0x2d0ef4['body']['newPassword'],'passwordResetAt':_0x2d0ef4[_0x7e30('0x32')]['id']==_0x2d0ef4[_0x7e30('0x5b')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2d0ef4['body'][_0x7e30('0x94')],_0x392fc2[_0x7e30('0x40')])},null));})[_0x7e30('0x22')](respondWithResult(_0xa2e1b3,null))[_0x7e30('0x2b')](handleError(_0xa2e1b3,null));};exports[_0x7e30('0x9a')]=function(_0x458be3,_0x2fb9e6){var _0x24b2a8=_0x458be3[_0x7e30('0x60')]['channel'];return db[_0x7e30('0x47')][_0x7e30('0x84')]({'where':{'id':_0x458be3[_0x7e30('0x5b')]['id']},'attributes':['id',_0x7e30('0x37'),'role','online','loginInPause','voicePause',_0x7e30('0x9b')]})[_0x7e30('0x22')](handleEntityNotFound(_0x2fb9e6,null))[_0x7e30('0x22')](function(_0x2f8fe8){if(_0x2f8fe8){if(!utils[_0x7e30('0x9c')](_0x24b2a8)){throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))](_0x7e30('0x9d'));}return _0x2f8fe8[_0x7e30('0x9e')+_[_0x7e30('0x9f')](_0x24b2a8[_0x7e30('0xa0')]())+_0x7e30('0xa1')](_0x458be3[_0x7e30('0x60')][_0x7e30('0x63')],{'penalty':_0x458be3[_0x7e30('0x60')][_0x7e30('0xa2')]||0x0})['spread'](function(_0x3321a7){for(var _0x15f122=0x0;_0x15f122<_0x458be3[_0x7e30('0x60')][_0x7e30('0x63')]['length'];_0x15f122+=0x1){var _0x581452={'UserId':Number(_0x458be3[_0x7e30('0x5b')]['id'])};_0x581452[_['capitalize'](_0x24b2a8['toLowerCase']())+'QueueId']=Number(_0x458be3[_0x7e30('0x60')][_0x7e30('0x63')][_0x15f122]);socket[_0x7e30('0x2f')](_0x7e30('0x32')+_[_0x7e30('0x9f')](_0x24b2a8[_0x7e30('0xa0')]())+'Queue:save',_0x581452);}return _0x3321a7;})[_0x7e30('0x22')](function(){if(_0x24b2a8===_0x7e30('0xa3')){return db[_0x7e30('0xa4')][_0x7e30('0x4f')]({'where':{'id':_0x458be3[_0x7e30('0x60')][_0x7e30('0x63')]||[]},'raw':!![],'attributes':['id',_0x7e30('0x37')]});}})['then'](function(_0x18f473){var _0x26fbbc=_0x2f8fe8['get']({'plain':!![]});var _0x1a028c=[];if(_0x24b2a8===_0x7e30('0xa3')&&_0x26fbbc['role']===_0x7e30('0x2e')&&_0x26fbbc[_0x7e30('0xa5')]){for(let _0x200bb5=0x0;_0x200bb5<_0x18f473['length'];_0x200bb5+=0x1){_0x1a028c[_0x7e30('0x4e')]({'membername':_0x26fbbc[_0x7e30('0x37')],'UserId':_0x26fbbc['id'],'queue_name':_0x18f473[_0x200bb5]['name'],'VoiceQueueId':_0x18f473[_0x200bb5]['id'],'interface':_[_0x7e30('0x6a')](_0x26fbbc[_0x7e30('0x9b')])?util[_0x7e30('0xa6')](_0x7e30('0xa7'),_0x26fbbc[_0x7e30('0x37')]):_0x26fbbc[_0x7e30('0x9b')],'paused':_0x26fbbc[_0x7e30('0xa8')]||![],'penalty':_0x458be3[_0x7e30('0x60')][_0x7e30('0xa2')]||0x0});}return Promise[_0x7e30('0x5a')](_0x1a028c[_0x7e30('0x3b')](function(_0x3ea16f){return db['UserVoiceQueueRt'][_0x7e30('0xa9')](_0x3ea16f);}));}return _0x2f8fe8;});}})[_0x7e30('0x22')](respondWithStatusCode(_0x2fb9e6,null))['catch'](handleError(_0x2fb9e6,null));};exports[_0x7e30('0xaa')]=function(_0x22c471,_0x5c5f1a){var _0x4887c8,_0x5e0cd8;return db['User'][_0x7e30('0x84')]({'where':{'id':_0x22c471[_0x7e30('0x5b')]['id']},'attributes':['id',_0x7e30('0x37'),_0x7e30('0x2d')]})[_0x7e30('0x22')](handleEntityNotFound(_0x5c5f1a,null))[_0x7e30('0x22')](function(_0x14ba47){if(_0x14ba47){_0x4887c8=_0x14ba47;if(!_0x22c471[_0x7e30('0x48')][_0x7e30('0xab')]||!utils[_0x7e30('0x9c')](_0x22c471[_0x7e30('0x48')][_0x7e30('0xab')])){throw new db['Sequelize'][(_0x7e30('0x91'))](_0x7e30('0x9d'));}return _0x14ba47[_0x7e30('0xac')+_[_0x7e30('0x9f')](_0x22c471[_0x7e30('0x48')][_0x7e30('0xab')][_0x7e30('0xa0')]())+_0x7e30('0xa1')](_0x22c471[_0x7e30('0x48')][_0x7e30('0x63')]);}})[_0x7e30('0x22')](function(_0x26f195){if(_['isArray'](_0x22c471[_0x7e30('0x48')][_0x7e30('0x63')])){for(var _0x302728=0x0;_0x302728<_0x22c471[_0x7e30('0x48')]['ids'][_0x7e30('0x52')];_0x302728+=0x1){_0x5e0cd8={'UserId':Number(_0x22c471[_0x7e30('0x5b')]['id'])};_0x5e0cd8[_[_0x7e30('0x9f')](_0x22c471[_0x7e30('0x48')][_0x7e30('0xab')][_0x7e30('0xa0')]())+_0x7e30('0xad')]=Number(_0x22c471[_0x7e30('0x48')][_0x7e30('0x63')][_0x302728]);socket[_0x7e30('0x2f')](_0x7e30('0x32')+_[_0x7e30('0x9f')](_0x22c471[_0x7e30('0x48')][_0x7e30('0xab')][_0x7e30('0xa0')]())+'Queue:remove',_0x5e0cd8);}}else{_0x5e0cd8={'UserId':Number(_0x22c471['params']['id'])};_0x5e0cd8[_[_0x7e30('0x9f')](_0x22c471[_0x7e30('0x48')]['channel']['toLowerCase']())+_0x7e30('0xad')]=Number(_0x22c471[_0x7e30('0x48')][_0x7e30('0x63')]);socket[_0x7e30('0x2f')](_0x7e30('0x32')+_[_0x7e30('0x9f')](_0x22c471['query']['channel'][_0x7e30('0xa0')]())+_0x7e30('0xae'),_0x5e0cd8);}return _0x26f195;})[_0x7e30('0x22')](function(){if(_0x22c471['query'][_0x7e30('0xab')]===_0x7e30('0xa3')){return db[_0x7e30('0xaf')][_0x7e30('0x38')]({'where':{'UserId':_0x22c471[_0x7e30('0x5b')]['id'],'VoiceQueueId':_0x22c471[_0x7e30('0x48')][_0x7e30('0x63')]},'individualHooks':!![]})['then'](function(){return _0x4887c8;});}return _0x4887c8;})[_0x7e30('0x22')](respondWithStatusCode(_0x5c5f1a,null))[_0x7e30('0x2b')](handleError(_0x5c5f1a,null));};exports[_0x7e30('0xb0')]=function(_0xeaf8dc,_0x1e219b){_0xeaf8dc[_0x7e30('0x60')][_0x7e30('0xb1')]=_0xeaf8dc['file']['filename'];return db[_0x7e30('0x47')][_0x7e30('0x84')]({'where':{'id':_0xeaf8dc['params']['id']}})['then'](handleEntityNotFound(_0x1e219b,null))[_0x7e30('0x22')](saveUpdates(_0xeaf8dc[_0x7e30('0x60')],null))[_0x7e30('0x22')](respondWithResult(_0x1e219b,null))[_0x7e30('0x2b')](handleError(_0x1e219b,null));};exports[_0x7e30('0xb2')]=function(_0x30ba32,_0x24a4f0){var _0x24b62d=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x7e30('0x47')]['find']({'where':{'id':_0x30ba32[_0x7e30('0x5b')]['id']},'attributes':['id',_0x7e30('0xb1')],'raw':!![]})['then'](handleEntityNotFound(_0x24a4f0,null))[_0x7e30('0x22')](function(_0x283ffe){if(_0x283ffe){if(_[_0x7e30('0x6a')](_0x283ffe[_0x7e30('0xb1')])){return _0x24a4f0['download'](_0x24b62d);}else{if(!fs['existsSync'](path['join'](config[_0x7e30('0xb3')],_0x7e30('0xb4'),_0x283ffe[_0x7e30('0xb1')]))){return _0x24a4f0['download'](_0x24b62d);}return _0x24a4f0[_0x7e30('0xb5')](path['join'](config[_0x7e30('0xb3')],_0x7e30('0xb4'),_0x283ffe['userpic']));}}})[_0x7e30('0x2b')](handleError(_0x24a4f0,null));};exports[_0x7e30('0xb6')]=function(_0x4fad75,_0x563e8f){return db['User'][_0x7e30('0x84')]({'where':{'id':_0x4fad75[_0x7e30('0x5b')]['id']},'attributes':['id']})[_0x7e30('0x22')](handleEntityNotFound(_0x563e8f,null))[_0x7e30('0x22')](function(_0x347bab){var _0x42fdcf=[];values=_0x347bab[_0x7e30('0x55')];_0x42fdcf[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x53'),_0x347bab[_0x7e30('0x55')]));_0x42fdcf[_0x7e30('0x4e')](get_open_tabs('sms',_0x347bab[_0x7e30('0x55')]));_0x42fdcf[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x58'),_0x347bab[_0x7e30('0x55')]));_0x42fdcf['push'](get_open_tabs(_0x7e30('0x59'),_0x347bab[_0x7e30('0x55')]));_0x42fdcf[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x56'),_0x347bab['dataValues']));_0x42fdcf[_0x7e30('0x4e')](get_open_tabs(_0x7e30('0x57'),_0x347bab[_0x7e30('0x55')]));return Promise[_0x7e30('0x5a')](_0x42fdcf);})['then'](function(_0x34dd4f){if(_0x34dd4f){var _0x45e60a=_['map'](values[_0x7e30('0xb7')],function(_0x511e0f){return{'channel':_0x7e30('0xb8'),'id':_0x511e0f['id'],'createdAt':_0x511e0f[_0x7e30('0xb9')]};});var _0x653449=_[_0x7e30('0x3b')](values[_0x7e30('0xba')],function(_0x4d1d9b){return{'channel':'FAX','id':_0x4d1d9b['id'],'createdAt':_0x4d1d9b[_0x7e30('0xb9')]};});var _0x2bb946=_[_0x7e30('0x3b')](values[_0x7e30('0xbb')],function(_0x1e6ba0){return{'channel':_0x7e30('0xbc'),'id':_0x1e6ba0['id'],'createdAt':_0x1e6ba0['createdAt']};});var _0x347fd2=_[_0x7e30('0x3b')](values[_0x7e30('0xbd')],function(_0x527314){return{'channel':_0x7e30('0xbe'),'id':_0x527314['id'],'createdAt':_0x527314[_0x7e30('0xb9')]};});var _0x600b60=_[_0x7e30('0x3b')](values[_0x7e30('0xbf')],function(_0x1b8a0f){return{'channel':_0x7e30('0xc0'),'id':_0x1b8a0f['id'],'createdAt':_0x1b8a0f[_0x7e30('0xb9')]};});var _0x2c2c7d=_[_0x7e30('0x3b')](values[_0x7e30('0xc1')],function(_0x30974a){return{'channel':'WHATSAPP','id':_0x30974a['id'],'createdAt':_0x30974a['createdAt']};});var _0x19280a=_[_0x7e30('0xc2')](_0x45e60a,_0x653449,_0x2bb946,_0x347fd2,_0x600b60,_0x2c2c7d);var _0x533127={'count':_0x19280a['length'],'rows':_0x19280a};return _0x533127;}else return null;})[_0x7e30('0x22')](respondWithResult(_0x563e8f,null))[_0x7e30('0x2b')](handleError(_0x563e8f,null));};exports[_0x7e30('0xc3')]=function(_0x4f7038,_0x4baf21){var _0x16bb17={};return db['User'][_0x7e30('0x98')]({'where':{'id':_0x4f7038[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](function(_0x574a36){if(!_0x574a36){throw new APINotFoundError(util[_0x7e30('0xa6')](_0x7e30('0xc4'),_0x4f7038[_0x7e30('0x5b')]['id']));}return contacts[_0x7e30('0x61')]();})['then'](function(_0x5b44b9){_0x4f7038[_0x7e30('0x48')][_0x7e30('0x47')]=_0x4f7038['params']['id'];_0x16bb17=qs[_0x7e30('0x5c')](_0x5b44b9,_0x4f7038);if(_0x4f7038[_0x7e30('0x48')][_0x7e30('0xc5')](_0x7e30('0x49'))){_0x16bb17[_0x7e30('0x4a')]=[{'model':db[_0x7e30('0xc6')],'as':_0x7e30('0xc7'),'required':![]},{'model':db[_0x7e30('0xc8')],'as':'Tags','attributes':['id',_0x7e30('0x37'),_0x7e30('0xc9')],'where':_0x4f7038[_0x7e30('0x48')][_0x7e30('0xca')]?{'id':_0x4f7038['query'][_0x7e30('0xca')]}:undefined,'required':_0x4f7038['query'][_0x7e30('0xca')]?!![]:![]}];}return contacts[_0x7e30('0x4f')](_0x4f7038[_0x7e30('0x48')],_0x4f7038[_0x7e30('0x32')],_0x16bb17,_0x5b44b9);})[_0x7e30('0x22')](respondWithFilteredResult(_0x4baf21,_0x16bb17))[_0x7e30('0x2b')](APIHandleError(_0x4baf21));};exports[_0x7e30('0xcb')]=function(_0x4e729f,_0x3ded63){var _0x3b00c1;var _0x45d98b={};var _0x3aa03f;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x4e729f[_0x7e30('0x5b')]['id']},'attributes':['id',_0x7e30('0x37'),_0x7e30('0x2d')]})[_0x7e30('0x22')](handleEntityNotFound(_0x3ded63,null))[_0x7e30('0x22')](function(_0x21d8ff){if(!utils[_0x7e30('0x9c')](_0x4e729f[_0x7e30('0x48')][_0x7e30('0xab')])){throw new db['Sequelize'][(_0x7e30('0x91'))](_0x7e30('0x9d'));}_0x3b00c1=_0x21d8ff;var _0x46550e={};_0x46550e[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_[_0x7e30('0x9f')](_0x4e729f['query']['channel'])+_0x7e30('0xce')][_0x7e30('0x3a')]);_0x46550e['query']=_[_0x7e30('0xcd')](_0x4e729f[_0x7e30('0x48')]);_0x46550e[_0x7e30('0xcf')]=_['intersection'](_0x46550e[_0x7e30('0xcc')],_0x46550e[_0x7e30('0x48')]);_0x45d98b[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x46550e[_0x7e30('0xcc')],qs[_0x7e30('0xd1')](_0x4e729f['query'][_0x7e30('0xd1')]));_0x45d98b[_0x7e30('0x5f')]=_0x45d98b['attributes'][_0x7e30('0x52')]?_0x45d98b[_0x7e30('0x5f')]:_0x46550e[_0x7e30('0xcc')];_0x45d98b[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x4e729f[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x45d98b['where']=qs[_0x7e30('0xcf')](_[_0x7e30('0xd4')](_0x4e729f[_0x7e30('0x48')],_0x46550e[_0x7e30('0xcf')]));if(_0x4e729f['query'][_0x7e30('0x3e')]){_0x45d98b[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x45d98b['where'],{'$or':_['map'](_0x45d98b[_0x7e30('0x5f')],function(_0x383b49){var _0x5079e8={};_0x5079e8[_0x383b49]={'$like':'%'+_0x4e729f['query'][_0x7e30('0x3e')]+'%'};return _0x5079e8;})});}_0x45d98b=_['merge']({},_0x45d98b,_0x4e729f[_0x7e30('0x5e')]);switch(_0x3b00c1['role']){case _0x7e30('0x7e'):return db[_[_0x7e30('0x9f')](_0x4e729f['query']['channel'])+'Queue'][_0x7e30('0x4f')](_0x45d98b);case _0x7e30('0x32'):case _0x7e30('0x2e'):return _0x3b00c1[_0x7e30('0xd5')+_[_0x7e30('0x9f')](_0x4e729f[_0x7e30('0x48')][_0x7e30('0xab')])+_0x7e30('0xa1')](_0x45d98b);default:throw new db[(_0x7e30('0x90'))]['ValidationError']('Unknown\x20role');}})[_0x7e30('0x22')](function(_0x563615){_0x3aa03f=_0x563615[_0x7e30('0x52')];if(!_0x4e729f['query'][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x45d98b[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x4e729f[_0x7e30('0x48')]['limit']);_0x45d98b['offset']=qs[_0x7e30('0x1b')](_0x4e729f['query']['offset']);}switch(_0x3b00c1['role']){case'admin':return db[_[_0x7e30('0x9f')](_0x4e729f[_0x7e30('0x48')][_0x7e30('0xab')])+_0x7e30('0xce')][_0x7e30('0x4f')](_0x45d98b);case _0x7e30('0x32'):case _0x7e30('0x2e'):return _0x3b00c1[_0x7e30('0xd5')+_[_0x7e30('0x9f')](_0x4e729f['query'][_0x7e30('0xab')])+_0x7e30('0xa1')](_0x45d98b);}})['then'](function(_0x21cdc0){return{'count':_0x3aa03f,'rows':_0x21cdc0};})[_0x7e30('0x22')](respondWithResult(_0x3ded63,null))[_0x7e30('0x2b')](handleError(_0x3ded63,null));};exports[_0x7e30('0xd7')]=function(_0x476979,_0x12b699){var _0x33627b={};var _0x3d19fc={};var _0x4c42dd;var _0x5a59aa;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x476979[_0x7e30('0x5b')]['id']}})['then'](handleEntityNotFound(_0x12b699,null))['then'](function(_0x41ecca){if(_0x41ecca){_0x4c42dd=_0x41ecca;_0x3d19fc[_0x7e30('0xcc')]=_['keys'](db[_0x7e30('0xaf')][_0x7e30('0x3a')]);_0x3d19fc[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x476979[_0x7e30('0x48')]);_0x3d19fc[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x3d19fc[_0x7e30('0xcc')],_0x3d19fc['query']);_0x33627b[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x3d19fc[_0x7e30('0xcc')],qs[_0x7e30('0xd1')](_0x476979[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x33627b[_0x7e30('0x5f')]=_0x33627b[_0x7e30('0x5f')]['length']?_0x33627b['attributes']:_0x3d19fc[_0x7e30('0xcc')];_0x33627b[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x476979[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x33627b[_0x7e30('0x46')]=qs[_0x7e30('0xcf')](_[_0x7e30('0xd4')](_0x476979[_0x7e30('0x48')],_0x3d19fc[_0x7e30('0xcf')]));if(_0x476979[_0x7e30('0x48')]['filter']){_0x33627b[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x33627b['where'],{'$or':_['map'](_0x33627b[_0x7e30('0x5f')],function(_0x9c62af){var _0x4076af={};_0x4076af[_0x9c62af]={'$like':'%'+_0x476979[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x4076af;})});}_0x33627b=_[_0x7e30('0x5d')]({},_0x33627b,_0x476979['options']);return _0x4c42dd[_0x7e30('0xd7')](_0x33627b);}})[_0x7e30('0x22')](function(_0x180cc6){if(_0x180cc6){_0x5a59aa=_0x180cc6[_0x7e30('0x52')];if(!_0x476979[_0x7e30('0x48')][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x33627b[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x476979[_0x7e30('0x48')][_0x7e30('0x1d')]);_0x33627b[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0x476979[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0x4c42dd['getVoiceQueuesRt'](_0x33627b);}})['then'](function(_0x160c43){if(_0x160c43){return _0x160c43?{'count':_0x5a59aa,'rows':_0x160c43}:null;}})[_0x7e30('0x22')](respondWithResult(_0x12b699,null))[_0x7e30('0x2b')](handleError(_0x12b699,null));};exports[_0x7e30('0xd8')]=function(_0x354345,_0xbb3629){var _0x22d490={};var _0x3e30ec={};var _0x4337aa;var _0x4f7d39;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x354345[_0x7e30('0x5b')]['id']}})['then'](handleEntityNotFound(_0xbb3629,null))['then'](function(_0x108155){if(_0x108155){_0x4337aa=_0x108155;_0x3e30ec[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db['ChatGroup'][_0x7e30('0x3a')]);_0x3e30ec[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x354345[_0x7e30('0x48')]);_0x3e30ec[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x3e30ec[_0x7e30('0xcc')],_0x3e30ec[_0x7e30('0x48')]);_0x22d490[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x3e30ec[_0x7e30('0xcc')],qs[_0x7e30('0xd1')](_0x354345[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x22d490[_0x7e30('0x5f')]=_0x22d490[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x22d490[_0x7e30('0x5f')]:_0x3e30ec[_0x7e30('0xcc')];_0x22d490[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x354345[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x22d490[_0x7e30('0x46')]=qs['filters'](_[_0x7e30('0xd4')](_0x354345['query'],_0x3e30ec[_0x7e30('0xcf')]));if(_0x354345[_0x7e30('0x48')][_0x7e30('0x3e')]){_0x22d490['where']=_[_0x7e30('0x5d')](_0x22d490[_0x7e30('0x46')],{'$or':_['map'](_0x22d490['attributes'],function(_0x40d5d1){var _0x472c8e={};_0x472c8e[_0x40d5d1]={'$like':'%'+_0x354345[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x472c8e;})});}_0x22d490=_[_0x7e30('0x5d')]({},_0x22d490,_0x354345['options']);return _0x4337aa['getGroups'](_0x22d490);}})[_0x7e30('0x22')](function(_0x41bf69){if(_0x41bf69){_0x4f7d39=_0x41bf69['length'];if(!_0x354345[_0x7e30('0x48')][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x22d490[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x354345[_0x7e30('0x48')]['limit']);_0x22d490[_0x7e30('0x1b')]=qs['offset'](_0x354345[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0x4337aa[_0x7e30('0xd8')](_0x22d490);}})[_0x7e30('0x22')](function(_0x229d13){if(_0x229d13){return _0x229d13?{'count':_0x4f7d39,'rows':_0x229d13}:null;}})[_0x7e30('0x22')](respondWithResult(_0xbb3629,null))[_0x7e30('0x2b')](handleError(_0xbb3629,null));};exports['getRecordings']=function(_0x14e9e4,_0x26a602){var _0xc62bf1={'raw':!![],'where':{}};var _0x4abe04={};var _0x37fab9={'count':0x0,'rows':[]};return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x14e9e4['params']['id']}})['then'](handleEntityNotFound(_0x26a602,null))[_0x7e30('0x22')](function(_0x207856){if(_0x207856){_0x4abe04[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_0x7e30('0xd9')][_0x7e30('0x3a')]);_0x4abe04[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x14e9e4['query']);_0x4abe04['filters']=_[_0x7e30('0xd0')](_0x4abe04[_0x7e30('0xcc')],_0x4abe04[_0x7e30('0x48')]);_0xc62bf1[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x4abe04['model'],qs[_0x7e30('0xd1')](_0x14e9e4[_0x7e30('0x48')][_0x7e30('0xd1')]));_0xc62bf1['attributes']=_0xc62bf1[_0x7e30('0x5f')][_0x7e30('0x52')]?_0xc62bf1[_0x7e30('0x5f')]:_0x4abe04[_0x7e30('0xcc')];if(!_0x14e9e4['query'][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0xc62bf1[_0x7e30('0x1d')]=qs['limit'](_0x14e9e4['query'][_0x7e30('0x1d')]);_0xc62bf1[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0x14e9e4[_0x7e30('0x48')][_0x7e30('0x1b')]);}_0xc62bf1['order']=qs[_0x7e30('0xd3')](_0x14e9e4[_0x7e30('0x48')][_0x7e30('0xd3')]);_0xc62bf1['where']=qs[_0x7e30('0xcf')](_['pick'](_0x14e9e4[_0x7e30('0x48')],_0x4abe04[_0x7e30('0xcf')]));_0xc62bf1[_0x7e30('0x46')][_0x7e30('0xda')]=_0x207856['id'];if(_0x14e9e4[_0x7e30('0x48')][_0x7e30('0x3e')]){_0xc62bf1[_0x7e30('0x46')]=_['merge'](_0xc62bf1[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0xc62bf1[_0x7e30('0x5f')],function(_0x26d6f5){var _0x35fc84={};_0x35fc84[_0x26d6f5]={'$like':'%'+_0x14e9e4[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x35fc84;})});}_0xc62bf1=_[_0x7e30('0x5d')]({},_0xc62bf1,_0x14e9e4[_0x7e30('0x5e')]);return db[_0x7e30('0xd9')]['count']({'where':_0xc62bf1[_0x7e30('0x46')]})['then'](function(_0x152563){_0x37fab9[_0x7e30('0x1e')]=_0x152563;if(_0x14e9e4[_0x7e30('0x48')][_0x7e30('0x49')]){_0xc62bf1['include']=[{'all':!![]}];}return db[_0x7e30('0xd9')][_0x7e30('0x4f')](_0xc62bf1);})[_0x7e30('0x22')](function(_0x3283d2){_0x37fab9[_0x7e30('0x50')]=_0x3283d2;return _0x37fab9;});}})['then'](respondWithFilteredResult(_0x26a602,_0xc62bf1))[_0x7e30('0x2b')](handleError(_0x26a602,null));};exports[_0x7e30('0xdb')]=function(_0x3a14b3,_0x57c899){var _0x246639={'raw':!![],'where':{}};var _0x41cc6e={};var _0x659ec4={'count':0x0,'rows':[]};return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x3a14b3[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x57c899,null))[_0x7e30('0x22')](function(_0x2e9e03){if(_0x2e9e03){_0x41cc6e[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_0x7e30('0xdc')][_0x7e30('0x3a')]);_0x41cc6e[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x3a14b3['query']);_0x41cc6e[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x41cc6e[_0x7e30('0xcc')],_0x41cc6e[_0x7e30('0x48')]);_0x246639[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x41cc6e['model'],qs[_0x7e30('0xd1')](_0x3a14b3[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x246639[_0x7e30('0x5f')]=_0x246639[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x246639[_0x7e30('0x5f')]:_0x41cc6e['model'];if(!_0x3a14b3['query']['hasOwnProperty'](_0x7e30('0xd6'))){_0x246639[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x3a14b3[_0x7e30('0x48')][_0x7e30('0x1d')]);_0x246639[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0x3a14b3[_0x7e30('0x48')][_0x7e30('0x1b')]);}_0x246639['order']=qs[_0x7e30('0xd3')](_0x3a14b3[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x246639[_0x7e30('0x46')]=qs['filters'](_[_0x7e30('0xd4')](_0x3a14b3[_0x7e30('0x48')],_0x41cc6e[_0x7e30('0xcf')]));_0x246639[_0x7e30('0x46')][_0x7e30('0xda')]=_0x2e9e03['id'];if(_0x3a14b3[_0x7e30('0x48')][_0x7e30('0x3e')]){_0x246639[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x246639[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x246639[_0x7e30('0x5f')],function(_0x24d660){var _0x2daa7b={};_0x2daa7b[_0x24d660]={'$like':'%'+_0x3a14b3['query']['filter']+'%'};return _0x2daa7b;})});}_0x246639=_[_0x7e30('0x5d')]({},_0x246639,_0x3a14b3[_0x7e30('0x5e')]);return db[_0x7e30('0xdc')][_0x7e30('0x1e')]({'where':_0x246639[_0x7e30('0x46')]})[_0x7e30('0x22')](function(_0x29b7ac){_0x659ec4['count']=_0x29b7ac;if(_0x3a14b3['query'][_0x7e30('0x49')]){_0x246639[_0x7e30('0x4a')]=[{'all':!![]}];}return db[_0x7e30('0xdc')][_0x7e30('0x4f')](_0x246639);})[_0x7e30('0x22')](function(_0x17d28a){_0x659ec4['rows']=_0x17d28a;return _0x659ec4;});}})[_0x7e30('0x22')](respondWithFilteredResult(_0x57c899,_0x246639))['catch'](handleError(_0x57c899,null));};exports['getChatInteractions']=function(_0x4c6802,_0x270840){var _0x3ad062={};var _0x571e0c={};var _0x11a5b6;var _0x47824a;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x4c6802[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x270840,null))[_0x7e30('0x22')](function(_0x41d6a7){if(_0x41d6a7){_0x11a5b6=_0x41d6a7;_0x571e0c['model']=_['keys'](db[_0x7e30('0xdd')][_0x7e30('0x3a')]);_0x571e0c[_0x7e30('0x48')]=_['keys'](_0x4c6802[_0x7e30('0x48')]);_0x571e0c[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x571e0c[_0x7e30('0xcc')],_0x571e0c['query']);_0x3ad062[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x571e0c[_0x7e30('0xcc')],qs[_0x7e30('0xd1')](_0x4c6802['query']['fields']));_0x3ad062[_0x7e30('0x5f')]=_0x3ad062[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x3ad062[_0x7e30('0x5f')]:_0x571e0c[_0x7e30('0xcc')];_0x3ad062[_0x7e30('0xd2')]=qs['sort'](_0x4c6802['query'][_0x7e30('0xd3')]);_0x3ad062[_0x7e30('0x46')]=qs[_0x7e30('0xcf')](_[_0x7e30('0xd4')](_0x4c6802[_0x7e30('0x48')],_0x571e0c['filters']));if(_0x4c6802[_0x7e30('0x48')][_0x7e30('0x3e')]){_0x3ad062[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x3ad062[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x3ad062['attributes'],function(_0x306c02){var _0x56fc77={};_0x56fc77[_0x306c02]={'$like':'%'+_0x4c6802[_0x7e30('0x48')]['filter']+'%'};return _0x56fc77;})});}_0x3ad062=_[_0x7e30('0x5d')]({},_0x3ad062,_0x4c6802[_0x7e30('0x5e')]);return _0x11a5b6[_0x7e30('0xde')](_0x3ad062);}})[_0x7e30('0x22')](function(_0x3d0c9a){if(_0x3d0c9a){_0x47824a=_0x3d0c9a['length'];if(!_0x4c6802[_0x7e30('0x48')][_0x7e30('0xc5')]('nolimit')){_0x3ad062['limit']=qs[_0x7e30('0x1d')](_0x4c6802['query']['limit']);_0x3ad062[_0x7e30('0x1b')]=qs['offset'](_0x4c6802[_0x7e30('0x48')]['offset']);}return _0x11a5b6[_0x7e30('0xde')](_0x3ad062);}})[_0x7e30('0x22')](function(_0x4f2c1f){if(_0x4f2c1f){return _0x4f2c1f?{'count':_0x47824a,'rows':_0x4f2c1f}:null;}})['then'](respondWithResult(_0x270840,null))[_0x7e30('0x2b')](handleError(_0x270840,null));};exports[_0x7e30('0xdf')]=function(_0x7450a6,_0x155dc5){var _0x11621e={};var _0x2549cd={};var _0x2aa16f;var _0x4c0e57;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x7450a6[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x155dc5,null))[_0x7e30('0x22')](function(_0x32e487){if(_0x32e487){_0x2aa16f=_0x32e487;_0x2549cd[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db['OpenchannelInteraction'][_0x7e30('0x3a')]);_0x2549cd[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x7450a6['query']);_0x2549cd[_0x7e30('0xcf')]=_['intersection'](_0x2549cd[_0x7e30('0xcc')],_0x2549cd['query']);_0x11621e['attributes']=_[_0x7e30('0xd0')](_0x2549cd[_0x7e30('0xcc')],qs[_0x7e30('0xd1')](_0x7450a6[_0x7e30('0x48')]['fields']));_0x11621e[_0x7e30('0x5f')]=_0x11621e[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x11621e['attributes']:_0x2549cd[_0x7e30('0xcc')];_0x11621e['order']=qs[_0x7e30('0xd3')](_0x7450a6[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x11621e['where']=qs[_0x7e30('0xcf')](_['pick'](_0x7450a6[_0x7e30('0x48')],_0x2549cd[_0x7e30('0xcf')]));if(_0x7450a6[_0x7e30('0x48')]['filter']){_0x11621e[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x11621e[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x11621e[_0x7e30('0x5f')],function(_0x53895f){var _0x10d133={};_0x10d133[_0x53895f]={'$like':'%'+_0x7450a6[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x10d133;})});}_0x11621e=_[_0x7e30('0x5d')]({},_0x11621e,_0x7450a6[_0x7e30('0x5e')]);return _0x2aa16f['getOpenchannelInteractions'](_0x11621e);}})[_0x7e30('0x22')](function(_0x499864){if(_0x499864){_0x4c0e57=_0x499864[_0x7e30('0x52')];if(!_0x7450a6['query'][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x11621e[_0x7e30('0x1d')]=qs['limit'](_0x7450a6[_0x7e30('0x48')]['limit']);_0x11621e['offset']=qs['offset'](_0x7450a6[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0x2aa16f[_0x7e30('0xdf')](_0x11621e);}})[_0x7e30('0x22')](function(_0x2c6424){if(_0x2c6424){return _0x2c6424?{'count':_0x4c0e57,'rows':_0x2c6424}:null;}})['then'](respondWithResult(_0x155dc5,null))[_0x7e30('0x2b')](handleError(_0x155dc5,null));};exports[_0x7e30('0xe0')]=function(_0x5b3a14,_0x13c4d1){var _0x10a249={'raw':!![],'where':{}};var _0x6ee6a6={};var _0xcdcef={'count':0x0,'rows':[]};return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x5b3a14[_0x7e30('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13c4d1,null))[_0x7e30('0x22')](function(_0x50dd46){if(_0x50dd46){_0x6ee6a6['model']=_[_0x7e30('0xcd')](db[_0x7e30('0xe1')][_0x7e30('0x3a')]);_0x6ee6a6[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x5b3a14[_0x7e30('0x48')]);_0x6ee6a6[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x6ee6a6[_0x7e30('0xcc')],_0x6ee6a6[_0x7e30('0x48')]);_0x10a249[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x6ee6a6['model'],qs[_0x7e30('0xd1')](_0x5b3a14['query'][_0x7e30('0xd1')]));_0x10a249[_0x7e30('0x5f')]=_0x10a249[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x10a249['attributes']:_0x6ee6a6[_0x7e30('0xcc')];if(!_0x5b3a14[_0x7e30('0x48')][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x10a249[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x5b3a14[_0x7e30('0x48')][_0x7e30('0x1d')]);_0x10a249[_0x7e30('0x1b')]=qs['offset'](_0x5b3a14['query'][_0x7e30('0x1b')]);}_0x10a249['order']=qs[_0x7e30('0xd3')](_0x5b3a14[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x10a249[_0x7e30('0x46')]=qs['filters'](_[_0x7e30('0xd4')](_0x5b3a14[_0x7e30('0x48')],_0x6ee6a6[_0x7e30('0xcf')]));_0x10a249[_0x7e30('0x46')][_0x7e30('0xda')]=_0x50dd46['id'];if(_0x5b3a14[_0x7e30('0x48')][_0x7e30('0x3e')]){_0x10a249[_0x7e30('0x46')]=_['merge'](_0x10a249[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x10a249[_0x7e30('0x5f')],function(_0x4b216f){var _0x36b5e2={};_0x36b5e2[_0x4b216f]={'$like':'%'+_0x5b3a14[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x36b5e2;})});}_0x10a249=_[_0x7e30('0x5d')]({},_0x10a249,_0x5b3a14[_0x7e30('0x5e')]);return db['MailInteraction'][_0x7e30('0x1e')]({'where':_0x10a249['where']})[_0x7e30('0x22')](function(_0xa44dd4){_0xcdcef[_0x7e30('0x1e')]=_0xa44dd4;if(_0x5b3a14[_0x7e30('0x48')][_0x7e30('0x49')]){_0x10a249['include']=[{'all':!![]}];}return db['MailInteraction'][_0x7e30('0x4f')](_0x10a249);})[_0x7e30('0x22')](function(_0x5d19a5){_0xcdcef[_0x7e30('0x50')]=_0x5d19a5;return _0xcdcef;});}})[_0x7e30('0x22')](respondWithFilteredResult(_0x13c4d1,_0x10a249))[_0x7e30('0x2b')](handleError(_0x13c4d1,null));};exports[_0x7e30('0xe2')]=function(_0x5294a9,_0x5d3c8f){var _0x18c68b={};var _0x3e083a={};var _0x284c73;var _0x22d573;return db['User']['findOne']({'where':{'id':_0x5294a9['params']['id']}})['then'](handleEntityNotFound(_0x5d3c8f,null))[_0x7e30('0x22')](function(_0xfb5167){if(_0xfb5167){_0x284c73=_0xfb5167;_0x3e083a[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_0x7e30('0xe3')][_0x7e30('0x3a')]);_0x3e083a[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x5294a9['query']);_0x3e083a[_0x7e30('0xcf')]=_['intersection'](_0x3e083a[_0x7e30('0xcc')],_0x3e083a[_0x7e30('0x48')]);_0x18c68b[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x3e083a['model'],qs[_0x7e30('0xd1')](_0x5294a9[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x18c68b['attributes']=_0x18c68b[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x18c68b[_0x7e30('0x5f')]:_0x3e083a[_0x7e30('0xcc')];_0x18c68b['order']=qs[_0x7e30('0xd3')](_0x5294a9[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x18c68b[_0x7e30('0x46')]=qs['filters'](_[_0x7e30('0xd4')](_0x5294a9['query'],_0x3e083a[_0x7e30('0xcf')]));if(_0x5294a9['query']['filter']){_0x18c68b['where']=_['merge'](_0x18c68b[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x18c68b[_0x7e30('0x5f')],function(_0x5301ee){var _0x19a173={};_0x19a173[_0x5301ee]={'$like':'%'+_0x5294a9[_0x7e30('0x48')]['filter']+'%'};return _0x19a173;})});}_0x18c68b=_[_0x7e30('0x5d')]({},_0x18c68b,_0x5294a9['options']);return _0x284c73[_0x7e30('0xe2')](_0x18c68b);}})[_0x7e30('0x22')](function(_0x200f47){if(_0x200f47){_0x22d573=_0x200f47[_0x7e30('0x52')];if(!_0x5294a9['query']['hasOwnProperty'](_0x7e30('0xd6'))){_0x18c68b[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x5294a9['query'][_0x7e30('0x1d')]);_0x18c68b[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0x5294a9[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0x284c73['getSmsInteractions'](_0x18c68b);}})[_0x7e30('0x22')](function(_0xa5ad9b){if(_0xa5ad9b){return _0xa5ad9b?{'count':_0x22d573,'rows':_0xa5ad9b}:null;}})[_0x7e30('0x22')](respondWithResult(_0x5d3c8f,null))['catch'](handleError(_0x5d3c8f,null));};exports[_0x7e30('0xe4')]=function(_0x3ce023,_0x3a940f){var _0x2cf81f={};var _0x546bfa={};var _0xd8e7dd;var _0x3a4875;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x3ce023['params']['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x3a940f,null))[_0x7e30('0x22')](function(_0x49e59e){if(_0x49e59e){_0xd8e7dd=_0x49e59e;_0x546bfa[_0x7e30('0xcc')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x546bfa[_0x7e30('0x48')]=_['keys'](_0x3ce023['query']);_0x546bfa[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x546bfa[_0x7e30('0xcc')],_0x546bfa[_0x7e30('0x48')]);_0x2cf81f[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x546bfa[_0x7e30('0xcc')],qs['fields'](_0x3ce023[_0x7e30('0x48')]['fields']));_0x2cf81f[_0x7e30('0x5f')]=_0x2cf81f[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x2cf81f[_0x7e30('0x5f')]:_0x546bfa[_0x7e30('0xcc')];_0x2cf81f[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x3ce023['query'][_0x7e30('0xd3')]);_0x2cf81f[_0x7e30('0x46')]=qs[_0x7e30('0xcf')](_[_0x7e30('0xd4')](_0x3ce023['query'],_0x546bfa[_0x7e30('0xcf')]));if(_0x3ce023['query']['filter']){_0x2cf81f['where']=_[_0x7e30('0x5d')](_0x2cf81f['where'],{'$or':_[_0x7e30('0x3b')](_0x2cf81f[_0x7e30('0x5f')],function(_0x38430){var _0x3a01bc={};_0x3a01bc[_0x38430]={'$like':'%'+_0x3ce023['query'][_0x7e30('0x3e')]+'%'};return _0x3a01bc;})});}_0x2cf81f=_[_0x7e30('0x5d')]({},_0x2cf81f,_0x3ce023[_0x7e30('0x5e')]);return _0xd8e7dd['getFaxInteractions'](_0x2cf81f);}})[_0x7e30('0x22')](function(_0x599bb5){if(_0x599bb5){_0x3a4875=_0x599bb5[_0x7e30('0x52')];if(!_0x3ce023[_0x7e30('0x48')]['hasOwnProperty'](_0x7e30('0xd6'))){_0x2cf81f[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x3ce023[_0x7e30('0x48')][_0x7e30('0x1d')]);_0x2cf81f[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0x3ce023[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0xd8e7dd[_0x7e30('0xe4')](_0x2cf81f);}})['then'](function(_0x4700c2){if(_0x4700c2){return _0x4700c2?{'count':_0x3a4875,'rows':_0x4700c2}:null;}})[_0x7e30('0x22')](respondWithResult(_0x3a940f,null))['catch'](handleError(_0x3a940f,null));};exports[_0x7e30('0xe5')]=function(_0x5049ba,_0x16d3cc){var _0x14856d={};var _0x14dacf={};var _0x3bbaeb;var _0x434bcc;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x5049ba[_0x7e30('0x5b')]['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x16d3cc,null))[_0x7e30('0x22')](function(_0x277a04){if(_0x277a04){_0x3bbaeb=_0x277a04;_0x14dacf[_0x7e30('0xcc')]=_['keys'](db['WhatsappInteraction'][_0x7e30('0x3a')]);_0x14dacf[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x5049ba['query']);_0x14dacf[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x14dacf[_0x7e30('0xcc')],_0x14dacf[_0x7e30('0x48')]);_0x14856d['attributes']=_[_0x7e30('0xd0')](_0x14dacf['model'],qs['fields'](_0x5049ba[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x14856d[_0x7e30('0x5f')]=_0x14856d[_0x7e30('0x5f')]['length']?_0x14856d['attributes']:_0x14dacf[_0x7e30('0xcc')];_0x14856d[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x5049ba[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x14856d[_0x7e30('0x46')]=qs['filters'](_[_0x7e30('0xd4')](_0x5049ba[_0x7e30('0x48')],_0x14dacf[_0x7e30('0xcf')]));if(_0x5049ba[_0x7e30('0x48')]['filter']){_0x14856d[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x14856d[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x14856d['attributes'],function(_0x5418a8){var _0xd1245b={};_0xd1245b[_0x5418a8]={'$like':'%'+_0x5049ba[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0xd1245b;})});}_0x14856d=_[_0x7e30('0x5d')]({},_0x14856d,_0x5049ba[_0x7e30('0x5e')]);return _0x3bbaeb[_0x7e30('0xe5')](_0x14856d);}})['then'](function(_0x203bf7){if(_0x203bf7){_0x434bcc=_0x203bf7[_0x7e30('0x52')];if(!_0x5049ba[_0x7e30('0x48')][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x14856d[_0x7e30('0x1d')]=qs[_0x7e30('0x1d')](_0x5049ba[_0x7e30('0x48')][_0x7e30('0x1d')]);_0x14856d[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0x5049ba[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0x3bbaeb['getWhatsappInteractions'](_0x14856d);}})[_0x7e30('0x22')](function(_0x523e86){if(_0x523e86){return _0x523e86?{'count':_0x434bcc,'rows':_0x523e86}:null;}})[_0x7e30('0x22')](respondWithResult(_0x16d3cc,null))[_0x7e30('0x2b')](handleError(_0x16d3cc,null));};exports[_0x7e30('0xe6')]=function(_0x20a413,_0x34cda7,_0x1fd63e){var _0x55adec;var _0x361994;var _0x18a132;var _0x502472=!_[_0x7e30('0x6a')](_0x20a413[_0x7e30('0x5b')]['id'])?_0x20a413[_0x7e30('0x5b')]['id']:!_[_0x7e30('0x6a')](_0x20a413[_0x7e30('0x32')]['id'])?_0x20a413[_0x7e30('0x32')]['id']:null;return db[_0x7e30('0x47')][_0x7e30('0x84')]({'where':{'id':_0x502472,'role':{'$or':[_0x7e30('0x7e'),'user',_0x7e30('0x2e')]}},'attributes':['id',_0x7e30('0x37'),'phone','mobile',_0x7e30('0x2d'),_0x7e30('0x69'),'loginInPause']})[_0x7e30('0x22')](function(_0x162b79){if(_0x162b79){if(_0x162b79['role']===_0x7e30('0x2e')){_0x55adec=_0x162b79;if(_0x20a413['body'][_0x7e30('0x9b')]){_0x18a132=util[_0x7e30('0xa6')](_0x7e30('0xe7'),_0x55adec[_0x20a413[_0x7e30('0x60')][_0x7e30('0x9b')]]);}else if(_0x20a413[_0x7e30('0x60')][_0x7e30('0xe8')]){_0x18a132=util[_0x7e30('0xa6')](_0x7e30('0xa7'),_0x20a413[_0x7e30('0x60')][_0x7e30('0xe8')]);}else{_0x18a132=util[_0x7e30('0xa6')]('SIP/%s',_0x55adec[_0x7e30('0x37')]);}socket['to'](util[_0x7e30('0xa6')](_0x7e30('0xe9'),_0x55adec[_0x7e30('0x37')]))[_0x7e30('0x2f')](_0x7e30('0xea'),{'user':{'id':_0x55adec['id'],'name':_0x55adec[_0x7e30('0x37')]},'ip':_0x20a413[_0x7e30('0xeb')][_0x7e30('0xec')]||_0x20a413[_0x7e30('0xed')][_0x7e30('0xee')]||_0x20a413[_0x7e30('0xef')][_0x7e30('0xee')]||_0x20a413[_0x7e30('0xed')][_0x7e30('0xef')][_0x7e30('0xee')]});return db[_0x7e30('0xaf')]['destroy']({'where':{'membername':_0x55adec[_0x7e30('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x7e30('0x90'))][(_0x7e30('0x91'))](_0x7e30('0xf0'));}})[_0x7e30('0x22')](function(){if(_0x55adec){return _0x55adec[_0x7e30('0xf1')]({'raw':!![]});}})['then'](function(_0x1ad8a7){if(_0x55adec){if(_0x1ad8a7){_0x361994=_0x1ad8a7;if(_0x361994[_0x7e30('0x52')]){var _0x2c180c=_0x361994[_0x7e30('0x3b')](function(_0x58db55){var _0x202226={'membername':_0x55adec[_0x7e30('0x37')],'UserId':_0x55adec['id'],'queue_name':_0x58db55[_0x7e30('0x37')],'VoiceQueueId':_0x58db55['id'],'interface':_0x18a132,'paused':_0x55adec[_0x7e30('0xf2')]||![],'penalty':_0x58db55['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x7e30('0xa9')](_0x202226);});return Promise[_0x7e30('0x5a')](_0x2c180c);}}}})[_0x7e30('0x22')](function(){if(_0x55adec){return db[_0x7e30('0xf3')][_0x7e30('0x4f')]({'where':{'membername':_0x55adec[_0x7e30('0x37')],'exitAt':null}});}})['then'](function(_0x10ab55){if(_0x55adec){var _0x3b8148=[];_0x10ab55['forEach'](function(_0x550c04){_0x3b8148['push'](_0x550c04['update']({'exitAt':moment()[_0x7e30('0xa6')](_0x7e30('0xf4'))}));});return Promise[_0x7e30('0x5a')](_0x3b8148);}})[_0x7e30('0x22')](function(){if(_0x55adec){var _0x44a8b1=[];var _0x511267=[];var _0x1e694a=utils[_0x7e30('0xf5')]();var _0x1b25e6={'membername':_0x55adec[_0x7e30('0x37')],'interface':_0x18a132,'enterAt':moment()[_0x7e30('0xa6')](_0x7e30('0xf4')),'role':_0x55adec[_0x7e30('0x2d')],'internal':_0x55adec[_0x7e30('0x69')]};_0x1e694a[_0x7e30('0xf6')](function(_0x588b4b){_0x44a8b1[_0x7e30('0x4e')](_['merge']({'channel':_0x588b4b,'type':_0x7e30('0xf7'),'data1':_0x20a413[_0x7e30('0x60')]['device'],'data2':_0x18a132},_0x1b25e6));if(_0x55adec[_0x7e30('0xf2')]){_0x511267['push'](_[_0x7e30('0x5d')]({'channel':_0x588b4b,'type':_0x7e30('0xf8'),'data1':'LOGININPAUSE'},_0x1b25e6));}});return db['MemberReport'][_0x7e30('0x88')](_0x44a8b1[_0x7e30('0xc2')](_0x511267),{'individualHooks':!![]});}})['then'](function(){if(_0x55adec){return _0x55adec[_0x7e30('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x7e30('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x55adec['loginInPause']||![],'mailPause':_0x55adec[_0x7e30('0xf2')]||![],'chatPause':_0x55adec[_0x7e30('0xf2')]||![],'faxPause':_0x55adec[_0x7e30('0xf2')]||![],'smsPause':_0x55adec[_0x7e30('0xf2')]||![],'openchannelPause':_0x55adec[_0x7e30('0xf2')]||![],'whatsappPause':_0x55adec[_0x7e30('0xf2')]||![],'pauseType':_0x55adec[_0x7e30('0xf2')]?_0x7e30('0xf9'):null,'interface':_0x18a132,'lastPauseAt':moment()[_0x7e30('0xa6')](_0x7e30('0xf4'))});}})[_0x7e30('0x22')](function(_0x803ee8){if(_0x20a413[_0x7e30('0xfa')]){return _0x1fd63e();}else{return Promise[_0x7e30('0xfb')](_0x803ee8)['then'](respondWithResult(_0x34cda7,null));}})['catch'](handleError(_0x34cda7,null));};exports['logout']=function(_0x141aa5,_0x3b14f4){var _0x3117fa;return db[_0x7e30('0x47')]['find']({'where':{'id':_0x141aa5[_0x7e30('0x5b')]['id'],'role':_0x7e30('0x2e')},'attributes':['id',_0x7e30('0x37'),_0x7e30('0x2d')]})['then'](handleEntityNotFound(_0x3b14f4,null))[_0x7e30('0x22')](function(_0x17195b){if(_0x17195b){_0x3117fa=_0x17195b;return db[_0x7e30('0xaf')][_0x7e30('0x38')]({'where':{'membername':_0x3117fa[_0x7e30('0x37')]},'individualHooks':!![]});}})[_0x7e30('0x22')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x3117fa[_0x7e30('0x37')],'exitAt':null}});})[_0x7e30('0x22')](function(_0x380dad){var _0x113f1c=[];_0x380dad['forEach'](function(_0xca460c){_0x113f1c[_0x7e30('0x4e')](_0xca460c[_0x7e30('0x2c')]({'exitAt':moment()['format'](_0x7e30('0xf4'))}));});return Promise[_0x7e30('0x5a')](_0x113f1c);})['then'](function(){return _0x3117fa[_0x7e30('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7e30('0x22')](respondWithResult(_0x3b14f4,null))[_0x7e30('0x2b')](handleError(_0x3b14f4,null));};exports['pause']=function(_0x1cfa7b,_0x1e541d){var _0x352b8e;return db[_0x7e30('0xaf')][_0x7e30('0x2c')]({'paused':0x1},{'where':{'UserId':_0x1cfa7b[_0x7e30('0x5b')]['id']},'individualHooks':!![]})[_0x7e30('0x22')](function(){return db[_0x7e30('0x47')][_0x7e30('0x84')]({'where':{'id':_0x1cfa7b[_0x7e30('0x5b')]['id'],'role':_0x7e30('0x2e')},'attributes':['id',_0x7e30('0x37'),_0x7e30('0x2d'),_0x7e30('0x69'),'interface',_0x7e30('0xa5')]});})['then'](handleEntityNotFound(_0x1e541d,null))[_0x7e30('0x22')](function(_0x476def){if(_0x476def){_0x352b8e=_0x476def;return respondWithRpcPromise('QueuePause',_0x7e30('0xfc'),{'id':_0x352b8e['id'],'name':_0x352b8e[_0x7e30('0x37')],'pause':!![]});}})[_0x7e30('0x22')](function(){if(_0x352b8e){return db[_0x7e30('0xf3')]['findAll']({'where':{'membername':_0x352b8e[_0x7e30('0x37')],'type':'PAUSE','exitAt':null}});}})[_0x7e30('0x22')](function(_0x5b2683){if(_0x5b2683[_0x7e30('0x52')]){var _0x210da3=moment()[_0x7e30('0xa6')](_0x7e30('0xf4'));for(var _0x508543=0x0,_0x171317=_0x5b2683[_0x7e30('0x52')];_0x508543<_0x171317;_0x508543++){_0x5b2683[_0x508543][_0x7e30('0xfd')]({'exitAt':_0x210da3});}}})['then'](function(){var _0x369ae1=[];var _0x2e1ad9=utils[_0x7e30('0xf5')]();_0x2e1ad9[_0x7e30('0xf6')](function(_0x523bc3){_0x369ae1['push']({'channel':_0x523bc3,'membername':_0x352b8e[_0x7e30('0x37')],'interface':_[_0x7e30('0x6a')](_0x352b8e[_0x7e30('0x9b')])?util[_0x7e30('0xa6')](_0x7e30('0xa7'),_0x352b8e[_0x7e30('0x37')]):_0x352b8e[_0x7e30('0x9b')],'type':_0x7e30('0xf8'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1cfa7b[_0x7e30('0x60')][_0x7e30('0x3d')]||_0x7e30('0xfe'),'role':_0x352b8e[_0x7e30('0x2d')],'internal':_0x352b8e[_0x7e30('0x69')]});});return db[_0x7e30('0xf3')][_0x7e30('0x88')](_0x369ae1,{'individualHooks':!![]});})[_0x7e30('0x22')](function(){return _0x352b8e[_0x7e30('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1cfa7b[_0x7e30('0x60')]['type']||_0x7e30('0xfe'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7e30('0x22')](respondWithResult(_0x1e541d,null))[_0x7e30('0x2b')](handleError(_0x1e541d,null));};exports[_0x7e30('0xff')]=function(_0x59c539,_0x4a0225){if(_0x59c539[_0x7e30('0x60')]['channel']&&!utils['isValidChannel'](_0x59c539[_0x7e30('0x60')][_0x7e30('0xab')])){throw new APIBadRequestError(util[_0x7e30('0xa6')](_0x7e30('0x100'),_0x59c539['body'][_0x7e30('0xab')]));}return db[_0x7e30('0x47')][_0x7e30('0x84')]({'where':{'id':_0x59c539['params']['id']},'attributes':['id','name',_0x7e30('0x2d'),'internal',_0x7e30('0x9b'),_0x7e30('0xa5'),'voicePause',_0x7e30('0x101'),'chatPause',_0x7e30('0x102'),_0x7e30('0x103'),_0x7e30('0x104'),_0x7e30('0x105'),'pauseType',_0x7e30('0x106')]})[_0x7e30('0x22')](function(_0x4efc4d){if(!_0x4efc4d){throw new APINotFoundError(util[_0x7e30('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x59c539[_0x7e30('0x5b')]['id']));}return _0x4efc4d[_0x7e30('0xff')](_0x59c539[_0x7e30('0x60')][_0x7e30('0xab')]);})[_0x7e30('0x22')](respondWithResult(_0x4a0225,null))[_0x7e30('0x2b')](APIHandleError(_0x4a0225));};exports[_0x7e30('0x107')]=function(_0xd1994c,_0x30d5d1){var _0x3ffab3={};var _0x54c382={};var _0x4c9dc5;var _0x41570e;return db['User'][_0x7e30('0x98')]({'where':{'id':_0xd1994c['params']['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x30d5d1,null))[_0x7e30('0x22')](function(_0x3ca0b1){if(_0x3ca0b1){_0x4c9dc5=_0x3ca0b1;_0x54c382[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_0x7e30('0x108')][_0x7e30('0x3a')]);_0x54c382[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0xd1994c[_0x7e30('0x48')]);_0x54c382[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x54c382[_0x7e30('0xcc')],_0x54c382[_0x7e30('0x48')]);_0x3ffab3[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x54c382[_0x7e30('0xcc')],qs['fields'](_0xd1994c[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x3ffab3[_0x7e30('0x5f')]=_0x3ffab3[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x3ffab3[_0x7e30('0x5f')]:_0x54c382[_0x7e30('0xcc')];_0x3ffab3[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0xd1994c[_0x7e30('0x48')][_0x7e30('0xd3')]);_0x3ffab3['where']=qs[_0x7e30('0xcf')](_['pick'](_0xd1994c[_0x7e30('0x48')],_0x54c382[_0x7e30('0xcf')]));if(_0xd1994c[_0x7e30('0x48')]['filter']){_0x3ffab3['where']=_[_0x7e30('0x5d')](_0x3ffab3[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x3ffab3['attributes'],function(_0x5664f0){var _0x35cf65={};_0x35cf65[_0x5664f0]={'$like':'%'+_0xd1994c[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x35cf65;})});}_0x3ffab3=_[_0x7e30('0x5d')]({},_0x3ffab3,_0xd1994c[_0x7e30('0x5e')]);return _0x4c9dc5[_0x7e30('0x107')](_0x3ffab3);}})[_0x7e30('0x22')](function(_0x4f4a94){if(_0x4f4a94){_0x41570e=_0x4f4a94['length'];if(!_0xd1994c[_0x7e30('0x48')][_0x7e30('0xc5')](_0x7e30('0xd6'))){_0x3ffab3[_0x7e30('0x1d')]=qs['limit'](_0xd1994c['query']['limit']);_0x3ffab3[_0x7e30('0x1b')]=qs[_0x7e30('0x1b')](_0xd1994c[_0x7e30('0x48')]['offset']);}return _0x4c9dc5[_0x7e30('0x107')](_0x3ffab3);}})[_0x7e30('0x22')](function(_0x2bd8a9){if(_0x2bd8a9){return _0x2bd8a9?{'count':_0x41570e,'rows':_0x2bd8a9}:null;}})[_0x7e30('0x22')](respondWithResult(_0x30d5d1,null))[_0x7e30('0x2b')](handleError(_0x30d5d1,null));};exports[_0x7e30('0x109')]=function(_0x349554,_0xebc910){var _0x2faf11=_0x349554[_0x7e30('0x5b')]['id'];var _0x34b4b9=_0x349554[_0x7e30('0x60')]?_0x349554['body']['ids']:null;var _0x4b2673=[];return Promise['resolve']()[_0x7e30('0x22')](function(){if(!_0x34b4b9)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x7e30('0x22')](function(){return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x2faf11}});})[_0x7e30('0x22')](function(_0xd8ebbd){if(!_0xd8ebbd)throw new APINotFoundError(util[_0x7e30('0xa6')](_0x7e30('0xc4'),_0x349554[_0x7e30('0x5b')]['id']));return db[_0x7e30('0x6c')][_0x7e30('0x10a')](function(_0x5ed6ca){return _0xd8ebbd['addTeams'](_0x34b4b9,{'transaction':_0x5ed6ca})[_0x7e30('0x22')](function(){return db[_0x7e30('0x108')]['findAll']({'where':{'id':{'$in':_0x34b4b9}}});})[_0x7e30('0x22')](function(_0x546cc8){var _0x11357f=_['map'](_0x546cc8,function(_0x50dd98){return _0x50dd98['getAssociatedQueues']();});return Promise['all'](_0x11357f);})[_0x7e30('0x22')](function(_0x23785d){_0x4b2673=_[_0x7e30('0x10b')](_0x23785d);var _0x3b830a=_[_0x7e30('0x3b')](_0x4b2673,function(_0x45e6ff){return _0x45e6ff[_0x7e30('0x10c')](_0xd8ebbd['id'],{'transaction':_0x5ed6ca});});return Promise[_0x7e30('0x5a')](_0x3b830a);})[_0x7e30('0x22')](function(){if(!_0xd8ebbd[_0x7e30('0xa5')])return;var _0x47cc14=_[_0x7e30('0x3e')](_0x4b2673,function(_0xd935c6){return _0xd935c6[_0x7e30('0x10d')]('channel')===_0x7e30('0x10e');});var _0x41b52b=_['map'](_0x47cc14,function(_0x527cf5){return db[_0x7e30('0xaf')][_0x7e30('0xa9')]({'membername':_0xd8ebbd[_0x7e30('0x37')],'UserId':_0xd8ebbd['id'],'queue_name':_0x527cf5[_0x7e30('0x37')],'VoiceQueueId':_0x527cf5['id'],'interface':_[_0x7e30('0x6a')](_0xd8ebbd[_0x7e30('0x9b')])?util[_0x7e30('0xa6')](_0x7e30('0xa7'),_0xd8ebbd[_0x7e30('0x37')]):_0xd8ebbd[_0x7e30('0x9b')],'paused':_0xd8ebbd[_0x7e30('0xa8')]||![],'penalty':_0xd8ebbd[_0x7e30('0xa2')]},{'transaction':_0x5ed6ca});});return Promise[_0x7e30('0x5a')](_0x41b52b);})[_0x7e30('0x22')](function(){return db['TeamVoicePrefix'][_0x7e30('0x4f')]({'where':{'teamId':{'$in':_0x34b4b9}}});})[_0x7e30('0x22')](function(_0x7a4e7d){var _0x67089c=_[_0x7e30('0x3b')](_0x7a4e7d,function(_0x49bfb5){return db[_0x7e30('0x10f')]['create']({'UserId':_0xd8ebbd['id'],'VoicePrefixId':_0x49bfb5[_0x7e30('0x110')]},{'transaction':_0x5ed6ca});});return Promise[_0x7e30('0x5a')](_0x67089c);});});})[_0x7e30('0x22')](function(){for(var _0x4d1687=0x0;_0x4d1687<_0x4b2673['length'];_0x4d1687++){var _0x2df059=_0x4b2673[_0x4d1687]['getDataValue']('channel');var _0x326542=_0x2df059+'QueueId';socket['emit'](_0x7e30('0x32')+_0x2df059+_0x7e30('0x111'),{'UserId':_0x2faf11,['queueField']:_0x4b2673[_0x4d1687]['id']});}})[_0x7e30('0x22')](respondWithStatusCode(_0xebc910,null))[_0x7e30('0x2b')](APIHandleError(_0xebc910));};exports['removeTeams']=function(_0xe86f9e,_0x15919b){var _0x422389=_0xe86f9e[_0x7e30('0x5b')]['id'];var _0x5c9450=null;if(_0xe86f9e['query'][_0x7e30('0x63')]){_0x5c9450=_[_0x7e30('0x112')](_0xe86f9e['query'][_0x7e30('0x63')])?_0xe86f9e[_0x7e30('0x48')]['ids']:[_0xe86f9e[_0x7e30('0x48')]['ids']];}var _0x3a0e75=[];return Promise['resolve']()[_0x7e30('0x22')](function(){if(!_0x5c9450)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x7e30('0x22')](function(){return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x422389}});})[_0x7e30('0x22')](function(_0x36e1aa){if(!_0x36e1aa)throw new APINotFoundError(util[_0x7e30('0xa6')](_0x7e30('0xc4'),_0xe86f9e['params']['id']));return db[_0x7e30('0x6c')][_0x7e30('0x10a')](function(_0x57705d){return _0x36e1aa['removeTeams'](_0x5c9450,{'transaction':_0x57705d})[_0x7e30('0x22')](function(){return db['Team'][_0x7e30('0x4f')]({'where':{'id':{'$in':_0x5c9450}}});})[_0x7e30('0x22')](function(_0x450776){var _0x4b9a5a=_[_0x7e30('0x3b')](_0x450776,function(_0x359259){return _0x359259[_0x7e30('0x113')]();});return Promise[_0x7e30('0x5a')](_0x4b9a5a);})[_0x7e30('0x22')](function(_0x134647){_0x3a0e75=_[_0x7e30('0x10b')](_0x134647);var _0x11e457=_[_0x7e30('0x3b')](_0x3a0e75,function(_0x3ef700){return _0x3ef700[_0x7e30('0x114')](_0x36e1aa['id'],{'transaction':_0x57705d});});return Promise[_0x7e30('0x5a')](_0x11e457);})[_0x7e30('0x22')](function(){if(!_0x36e1aa[_0x7e30('0xa5')])return;var _0x1512ad=_[_0x7e30('0x3e')](_0x3a0e75,function(_0x27dcbf){return _0x27dcbf[_0x7e30('0x10d')](_0x7e30('0xab'))==='Voice';});var _0xc1d092=_[_0x7e30('0x3b')](_0x1512ad,function(_0x5705c5){return db[_0x7e30('0xaf')][_0x7e30('0x38')]({'where':{'VoiceQueueId':_0x5705c5['id'],'UserId':_0x36e1aa['id']},'transaction':_0x57705d});});return Promise[_0x7e30('0x5a')](_0xc1d092);})['then'](function(){return db[_0x7e30('0x115')][_0x7e30('0x4f')]({'where':{'teamId':{'$in':_0x5c9450}}});})['then'](function(_0x4c3183){var _0xa3f85f=_[_0x7e30('0x3b')](_0x4c3183,function(_0x2553d9){return db[_0x7e30('0x10f')][_0x7e30('0x38')]({'where':{'UserId':_0x36e1aa['id'],'VoicePrefixId':_0x2553d9[_0x7e30('0x110')]}},{'transaction':_0x57705d});});return Promise['all'](_0xa3f85f);});});})[_0x7e30('0x22')](function(){for(var _0x10f5a4=0x0;_0x10f5a4<_0x3a0e75[_0x7e30('0x52')];_0x10f5a4++){var _0x319786=_0x3a0e75[_0x10f5a4][_0x7e30('0x10d')](_0x7e30('0xab'));var _0x571f4e=_0x319786+'QueueId';socket['emit'](_0x7e30('0x32')+_0x319786+_0x7e30('0xae'),{'UserId':_0x422389,['queueField']:_0x3a0e75[_0x10f5a4]['id']});}})['then'](respondWithStatusCode(_0x15919b,null))[_0x7e30('0x2b')](APIHandleError(_0x15919b));};exports['getLists']=function(_0x9c8f08,_0xf3148f){var _0x4df2c0={};var _0x36d187={};var _0x274718;var _0x2855c4;return db[_0x7e30('0x47')][_0x7e30('0x98')]({'where':{'id':_0x9c8f08['params']['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0xf3148f,null))[_0x7e30('0x22')](function(_0x25b8f0){if(_0x25b8f0){_0x274718=_0x25b8f0;_0x36d187[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_0x7e30('0xc6')][_0x7e30('0x3a')]);_0x36d187[_0x7e30('0x48')]=_[_0x7e30('0xcd')](_0x9c8f08[_0x7e30('0x48')]);_0x36d187[_0x7e30('0xcf')]=_[_0x7e30('0xd0')](_0x36d187[_0x7e30('0xcc')],_0x36d187[_0x7e30('0x48')]);_0x4df2c0[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x36d187['model'],qs[_0x7e30('0xd1')](_0x9c8f08[_0x7e30('0x48')][_0x7e30('0xd1')]));_0x4df2c0[_0x7e30('0x5f')]=_0x4df2c0[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x4df2c0[_0x7e30('0x5f')]:_0x36d187[_0x7e30('0xcc')];_0x4df2c0[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x9c8f08['query'][_0x7e30('0xd3')]);_0x4df2c0[_0x7e30('0x46')]=qs[_0x7e30('0xcf')](_['pick'](_0x9c8f08[_0x7e30('0x48')],_0x36d187[_0x7e30('0xcf')]));if(_0x9c8f08['query'][_0x7e30('0x3e')]){_0x4df2c0[_0x7e30('0x46')]=_[_0x7e30('0x5d')](_0x4df2c0[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x4df2c0[_0x7e30('0x5f')],function(_0x163f0c){var _0x199cec={};_0x199cec[_0x163f0c]={'$like':'%'+_0x9c8f08[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x199cec;})});}_0x4df2c0=_[_0x7e30('0x5d')]({},_0x4df2c0,_0x9c8f08[_0x7e30('0x5e')]);return _0x274718[_0x7e30('0x116')](_0x4df2c0);}})[_0x7e30('0x22')](function(_0x555ef1){if(_0x555ef1){_0x2855c4=_0x555ef1['length'];if(!_0x9c8f08['query']['hasOwnProperty'](_0x7e30('0xd6'))){_0x4df2c0['limit']=qs[_0x7e30('0x1d')](_0x9c8f08[_0x7e30('0x48')][_0x7e30('0x1d')]);_0x4df2c0[_0x7e30('0x1b')]=qs['offset'](_0x9c8f08[_0x7e30('0x48')][_0x7e30('0x1b')]);}return _0x274718[_0x7e30('0x116')](_0x4df2c0);}})['then'](function(_0x34c61f){if(_0x34c61f){return _0x34c61f?{'count':_0x2855c4,'rows':_0x34c61f}:null;}})[_0x7e30('0x22')](respondWithResult(_0xf3148f,null))[_0x7e30('0x2b')](handleError(_0xf3148f,null));};exports[_0x7e30('0x117')]=function(_0x44c073,_0x6c7ac4){var _0x34cb89={};var _0x4c3d1c={};var _0x2555be;return db['User'][_0x7e30('0x98')]({'where':{'id':_0x44c073['params']['id']}})[_0x7e30('0x22')](handleEntityNotFound(_0x6c7ac4,null))[_0x7e30('0x22')](function(_0xce827b){if(_0xce827b){_0x2555be=_0xce827b;_0x4c3d1c[_0x7e30('0xcc')]=_[_0x7e30('0xcd')](db[_0x7e30('0x47')][_0x7e30('0x3a')]);_0x4c3d1c[_0x7e30('0x48')]=_['keys'](_0x44c073[_0x7e30('0x48')]);_0x4c3d1c['filters']=_[_0x7e30('0xd0')](_0x4c3d1c[_0x7e30('0xcc')],_0x4c3d1c[_0x7e30('0x48')]);_0x34cb89[_0x7e30('0x5f')]=_[_0x7e30('0xd0')](_0x4c3d1c[_0x7e30('0xcc')],qs[_0x7e30('0xd1')](_0x44c073['query'][_0x7e30('0xd1')]));_0x34cb89[_0x7e30('0x5f')]=_0x34cb89[_0x7e30('0x5f')][_0x7e30('0x52')]?_0x34cb89[_0x7e30('0x5f')]:_0x4c3d1c[_0x7e30('0xcc')];_0x34cb89[_0x7e30('0xd2')]=qs[_0x7e30('0xd3')](_0x44c073[_0x7e30('0x48')]['sort']);_0x34cb89['where']=qs[_0x7e30('0xcf')](_[_0x7e30('0xd4')](_0x44c073[_0x7e30('0x48')],_0x4c3d1c[_0x7e30('0xcf')]));if(_0x44c073[_0x7e30('0x48')][_0x7e30('0x3e')]){_0x34cb89['where']=_[_0x7e30('0x5d')](_0x34cb89[_0x7e30('0x46')],{'$or':_[_0x7e30('0x3b')](_0x34cb89[_0x7e30('0x5f')],function(_0x2e621f){var _0x30777d={};_0x30777d[_0x2e621f]={'$like':'%'+_0x44c073[_0x7e30('0x48')][_0x7e30('0x3e')]+'%'};return _0x30777d;})});}_0x34cb89[_0x7e30('0xcc')]=db[_0x7e30('0x47')];_0x34cb89['as']=_0x7e30('0x33');_0x34cb89=_[_0x7e30('0x5d')]({},_0x34cb89,_0x44c073[_0x7e30('0x5e')]);return _0x2555be[_0x7e30('0xf1')]({'include':[_0x34cb89]});}})[_0x7e30('0x22')](function(_0x501321){if(_0x501321){var _0x226060={},_0x33dc1a=[];for(var _0x1621fe=0x0;_0x1621fe<_0x501321[_0x7e30('0x52')];_0x1621fe+=0x1){for(var _0x183b7c=0x0,_0x354e47;_0x183b7c<_0x501321[_0x1621fe][_0x7e30('0x33')]['length'];_0x183b7c+=0x1){_0x354e47=_0x501321[_0x1621fe][_0x7e30('0x33')][_0x183b7c][_0x7e30('0xd5')]({'plain':!![]});_0x226060[_0x354e47['id']]=_0x354e47;}}_0x226060=_[_0x7e30('0x118')](_0x226060);for(var _0x377576=qs['offset'](_0x44c073[_0x7e30('0x48')]['offset']);_0x377576<_0x226060[_0x7e30('0x52')]&&_0x33dc1a[_0x7e30('0x52')]=_0xa19e86['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x082a('0x14')](function(){if(_0x521854){return db[_0x082a('0x25')][_0x082a('0x45')]({'where':{'membername':_0x521854[_0x082a('0x1f')]},'individualHooks':!![]});}})[_0x082a('0x14')](function(){if(_0x521854){return _0x521854['getVoiceQueues']({'raw':!![]});}})[_0x082a('0x14')](function(_0x365121){if(_0x521854){if(_0x365121){var _0x50b30a=[];_0x5dbc6b=_0x365121;if(_0x5dbc6b[_0x082a('0x28')]){for(var _0x547e09=0x0;_0x547e09<_0x5dbc6b['length'];_0x547e09++){_0x50b30a[_0x082a('0x2c')](db['UserVoiceQueueRt'][_0x082a('0x4d')]({'membername':_0x521854[_0x082a('0x1f')],'UserId':_0x521854['id'],'queue_name':_0x5dbc6b[_0x547e09]['name'],'VoiceQueueId':_0x5dbc6b[_0x547e09]['id'],'interface':_0x47a5e6,'paused':_0x521854[_0x082a('0x49')]||![],'penalty':_0x5dbc6b[_0x547e09][_0x082a('0x4e')]||0x0}));}return BPromise['all'](_0x50b30a);}}}})['then'](function(){if(_0x521854){return db['MemberReport']['findAll']({'where':{'membername':_0x521854[_0x082a('0x1f')],'exitAt':null}});}})[_0x082a('0x14')](function(_0x2763a4){if(_0x521854){if(_0x2763a4&&_0x2763a4[_0x082a('0x28')]){var _0x4accc4=[];_0x2763a4[_0x082a('0x2b')](function(_0x1dd129){_0x4accc4[_0x082a('0x2c')](_0x1dd129[_0x082a('0x33')]({'exitAt':moment()[_0x082a('0x22')](_0x082a('0x2f'))}));});return BPromise['all'](_0x4accc4);}}})[_0x082a('0x14')](function(){if(_0x521854){var _0x429ab8=[];var _0x3a1d8a=[];var _0x75b942=utils['getChannels']();var _0x34fab3={'membername':_0x521854['name'],'interface':_0x47a5e6,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x521854[_0x082a('0x31')],'internal':_0x521854[_0x082a('0x20')]};_0x75b942[_0x082a('0x2b')](function(_0x512902){_0x429ab8[_0x082a('0x2c')](_[_0x082a('0x4f')]({'channel':_0x512902,'type':_0x082a('0x50'),'data1':'callysquare','data2':_0x47a5e6},_0x34fab3));if(_0x521854[_0x082a('0x49')]){_0x3a1d8a[_0x082a('0x2c')](_[_0x082a('0x4f')]({'channel':_0x512902,'type':_0x082a('0x27'),'data1':'LOGININPAUSE'},_0x34fab3));}});return db[_0x082a('0x26')]['bulkCreate'](_0x429ab8['concat'](_0x3a1d8a),{'individualHooks':!![]});}})[_0x082a('0x14')](function(){if(_0x521854){return _0x521854[_0x082a('0x33')]({'online':!![],'lastLoginAt':moment()['format'](_0x082a('0x2f')),'voicePause':_0x521854['loginInPause']||![],'mailPause':_0x521854[_0x082a('0x49')]||![],'chatPause':_0x521854[_0x082a('0x49')]||![],'faxPause':_0x521854[_0x082a('0x49')]||![],'smsPause':_0x521854['loginInPause']||![],'openchannelPause':_0x521854[_0x082a('0x49')]||![],'pauseType':_0x521854['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x082a('0x22')](_0x082a('0x2f')),'interface':_0x47a5e6});}})[_0x082a('0x14')](function(_0x38704c){_0x421fe7(_0x38704c);})[_0x082a('0x19')](function(_0x611e2f){_0x48389f(_0x5b70a6[_0x082a('0x1b')](0x1f4,_0x611e2f[_0x082a('0x1a')]));});});}; \ No newline at end of file +var _0x6e1c=['openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','SIP/%s','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','options','raw','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowUser','find','PauseUser','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','forEach','push','isNil','PAUSE','DEFAULT\x20PAUSE','body','uniqueid','bulkCreate','type','UnpauseUser','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','role','online','mailPause','chatPause','faxPause'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x6e1c,0x1e1));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e1('0x0'));var util=require(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var Redis=require(_0xc6e1('0x4'));var db=require(_0xc6e1('0x5'))['db'];var utils=require(_0xc6e1('0x6'));var logger=require(_0xc6e1('0x7'))('rpc');var config=require('../../config/environment');config[_0xc6e1('0x8')]=_[_0xc6e1('0x9')](config[_0xc6e1('0x8')],{'host':_0xc6e1('0xa'),'port':0x18eb});var socket=require(_0xc6e1('0xb'))(new Redis(config[_0xc6e1('0x8')]));require(_0xc6e1('0xc'))[_0xc6e1('0xd')](socket);exports[_0xc6e1('0xe')]=function(_0xc5a8f0){var _0x3e96db=this;return new Promise(function(_0x11073a,_0x5c207a){return db[_0xc6e1('0xf')]['findAll']({'raw':_0xc5a8f0[_0xc6e1('0x10')]?_0xc5a8f0[_0xc6e1('0x10')][_0xc6e1('0x11')]===undefined?!![]:![]:!![],'where':_0xc5a8f0[_0xc6e1('0x10')]?_0xc5a8f0[_0xc6e1('0x10')][_0xc6e1('0x12')]||null:null,'attributes':_0xc5a8f0[_0xc6e1('0x10')]?_0xc5a8f0[_0xc6e1('0x10')][_0xc6e1('0x13')]||null:null,'limit':_0xc5a8f0[_0xc6e1('0x10')]?_0xc5a8f0['options']['limit']||null:null,'include':_0xc5a8f0[_0xc6e1('0x10')]?_0xc5a8f0[_0xc6e1('0x10')][_0xc6e1('0x14')]?_['map'](_0xc5a8f0[_0xc6e1('0x10')][_0xc6e1('0x14')],function(_0x439634){return{'model':db[_0x439634['model']],'as':_0x439634['as'],'attributes':_0x439634[_0xc6e1('0x13')],'include':_0x439634[_0xc6e1('0x14')]?_[_0xc6e1('0x15')](_0x439634[_0xc6e1('0x14')],function(_0x4b3bf0){return{'model':db[_0x4b3bf0[_0xc6e1('0x16')]],'as':_0x4b3bf0['as'],'attributes':_0x4b3bf0[_0xc6e1('0x13')],'include':_0x4b3bf0['include']?_['map'](_0x4b3bf0[_0xc6e1('0x14')],function(_0x3bfc5b){return{'model':db[_0x3bfc5b[_0xc6e1('0x16')]],'as':_0x3bfc5b['as'],'attributes':_0x3bfc5b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6e1('0x17')](function(_0x47235b){logger[_0xc6e1('0x18')](_0xc6e1('0xe'),_0xc5a8f0);logger[_0xc6e1('0x19')](_0xc6e1('0xe'),_0xc5a8f0,JSON[_0xc6e1('0x1a')](_0x47235b));_0x11073a(_0x47235b);})[_0xc6e1('0x1b')](function(_0x328b19){logger[_0xc6e1('0x1c')](_0xc6e1('0xe'),_0x328b19[_0xc6e1('0x1d')],_0xc5a8f0);_0x5c207a(_0x3e96db[_0xc6e1('0x1c')](0x1f4,_0x328b19[_0xc6e1('0x1d')]));});});};exports[_0xc6e1('0x1e')]=function(_0x3640fe){var _0x40f99e=this;return new Promise(function(_0x4b654d,_0x5404e5){return db['User'][_0xc6e1('0x1f')]({'raw':_0x3640fe[_0xc6e1('0x10')]?_0x3640fe['options'][_0xc6e1('0x11')]===undefined?!![]:![]:!![],'where':_0x3640fe['options']?_0x3640fe['options'][_0xc6e1('0x12')]||null:null,'attributes':_0x3640fe[_0xc6e1('0x10')]?_0x3640fe[_0xc6e1('0x10')][_0xc6e1('0x13')]||null:null,'include':_0x3640fe['options']?_0x3640fe[_0xc6e1('0x10')]['include']?_[_0xc6e1('0x15')](_0x3640fe[_0xc6e1('0x10')][_0xc6e1('0x14')],function(_0x3727e5){return{'model':db[_0x3727e5['model']],'as':_0x3727e5['as'],'attributes':_0x3727e5[_0xc6e1('0x13')],'include':_0x3727e5[_0xc6e1('0x14')]?_[_0xc6e1('0x15')](_0x3727e5['include'],function(_0x1eadf9){return{'model':db[_0x1eadf9[_0xc6e1('0x16')]],'as':_0x1eadf9['as'],'attributes':_0x1eadf9[_0xc6e1('0x13')],'include':_0x1eadf9[_0xc6e1('0x14')]?_[_0xc6e1('0x15')](_0x1eadf9[_0xc6e1('0x14')],function(_0x29ccda){return{'model':db[_0x29ccda[_0xc6e1('0x16')]],'as':_0x29ccda['as'],'attributes':_0x29ccda['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e6891){logger[_0xc6e1('0x18')](_0xc6e1('0x1e'),_0x3640fe);logger[_0xc6e1('0x19')](_0xc6e1('0x1e'),_0x3640fe,JSON[_0xc6e1('0x1a')](_0x2e6891));_0x4b654d(_0x2e6891);})[_0xc6e1('0x1b')](function(_0x48f87b){logger[_0xc6e1('0x1c')](_0xc6e1('0x1e'),_0x48f87b['message'],_0x3640fe);_0x5404e5(_0x40f99e[_0xc6e1('0x1c')](0x1f4,_0x48f87b[_0xc6e1('0x1d')]));});});};exports[_0xc6e1('0x20')]=function(_0x273fae){var _0x277558;return db[_0xc6e1('0xf')][_0xc6e1('0x1f')]({'where':_0x273fae[_0xc6e1('0x10')][_0xc6e1('0x12')]||{},'attributes':['id',_0xc6e1('0x21'),'role',_0xc6e1('0x22'),_0xc6e1('0x23')]})[_0xc6e1('0x17')](function(_0x142378){if(!_0x142378){throw new Error(util[_0xc6e1('0x24')](_0xc6e1('0x25'),_0x273fae[_0xc6e1('0x26')]['id']));}_0x277558=_0x142378;return db[_0xc6e1('0x27')][_0xc6e1('0x28')]({'paused':0x1},{'where':{'UserId':_0x277558['id']},'individualHooks':!![]});})[_0xc6e1('0x17')](function(){return db[_0xc6e1('0x29')][_0xc6e1('0x2a')]({'where':{'membername':_0x277558['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0xdaa413){if(_0xdaa413&&_0xdaa413[_0xc6e1('0x2b')]){var _0x963ae0=moment()[_0xc6e1('0x24')](_0xc6e1('0x2c'));for(var _0x39f081=0x0,_0x383a55=_0xdaa413['length'];_0x39f081<_0x383a55;_0x39f081++){_0xdaa413[_0x39f081]['updateAttributes']({'exitAt':_0x963ae0});}}})[_0xc6e1('0x17')](function(){var _0x3857ea=[];var _0x42d097=utils['getChannels']();_0x42d097[_0xc6e1('0x2d')](function(_0x1d595d){_0x3857ea[_0xc6e1('0x2e')]({'channel':_0x1d595d,'membername':_0x277558['name'],'interface':_[_0xc6e1('0x2f')](_0x277558[_0xc6e1('0x23')])?util[_0xc6e1('0x24')]('SIP/%s',_0x277558[_0xc6e1('0x21')]):_0x277558[_0xc6e1('0x23')],'type':_0xc6e1('0x30'),'enterAt':moment()[_0xc6e1('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x273fae['body']['type']||_0xc6e1('0x31'),'role':_0x277558['role'],'internal':_0x277558[_0xc6e1('0x22')],'uniqueid':_0x273fae[_0xc6e1('0x32')][_0xc6e1('0x33')]||null});});return db[_0xc6e1('0x29')][_0xc6e1('0x34')](_0x3857ea,{'individualHooks':!![]});})[_0xc6e1('0x17')](function(){return _0x277558[_0xc6e1('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x273fae[_0xc6e1('0x32')][_0xc6e1('0x35')]||_0xc6e1('0x31'),'lastPauseAt':moment()['format'](_0xc6e1('0x2c'))});})[_0xc6e1('0x1b')](function(_0x1c48af){throw _0x1c48af;});};exports[_0xc6e1('0x36')]=function(_0x3f895c){return Promise[_0xc6e1('0x37')]()['then'](function(){if(_0x3f895c[_0xc6e1('0x32')]['channel']&&!utils[_0xc6e1('0x38')](_0x3f895c['body'][_0xc6e1('0x39')])){throw new Error(util[_0xc6e1('0x24')](_0xc6e1('0x3a'),_0x3f895c[_0xc6e1('0x32')][_0xc6e1('0x39')]));}return db[_0xc6e1('0xf')][_0xc6e1('0x3b')]({'where':_0x3f895c['options'][_0xc6e1('0x12')]||{},'attributes':['id',_0xc6e1('0x21'),_0xc6e1('0x3c'),_0xc6e1('0x22'),_0xc6e1('0x23'),_0xc6e1('0x3d'),'voicePause',_0xc6e1('0x3e'),_0xc6e1('0x3f'),_0xc6e1('0x40'),_0xc6e1('0x41'),_0xc6e1('0x42'),_0xc6e1('0x43'),_0xc6e1('0x44'),_0xc6e1('0x45')]});})[_0xc6e1('0x17')](function(_0x440fad){if(!_0x440fad){throw new Error(util[_0xc6e1('0x24')](_0xc6e1('0x25'),_0x3f895c[_0xc6e1('0x26')]['id']));}return _0x440fad['unpause'](_0x3f895c[_0xc6e1('0x32')][_0xc6e1('0x39')],'system');})[_0xc6e1('0x1b')](function(_0x27a9bc){throw _0x27a9bc;});};exports[_0xc6e1('0x46')]=function(_0x27ca23){var _0x31485b=this;return new Promise(function(_0x3d98e9,_0x41272b){var _0x54a3fd;return db[_0xc6e1('0xf')]['findOne']({'where':_0x27ca23[_0xc6e1('0x10')][_0xc6e1('0x12')]||{},'attributes':['id',_0xc6e1('0x21')]})['then'](function(_0x31916c){if(_0x31916c){_0x54a3fd=_0x31916c;return db[_0xc6e1('0x27')][_0xc6e1('0x47')]({'where':{'membername':_0x54a3fd[_0xc6e1('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x54a3fd){return db[_0xc6e1('0x29')][_0xc6e1('0x2a')]({'where':{'membername':_0x54a3fd[_0xc6e1('0x21')],'exitAt':null}});}})['then'](function(_0x2dfd34){if(_0x54a3fd){if(_0x2dfd34&&_0x2dfd34['length']){var _0x44a2b3=[];_0x2dfd34[_0xc6e1('0x2d')](function(_0x2140c2){_0x44a2b3[_0xc6e1('0x2e')](_0x2140c2[_0xc6e1('0x28')]({'exitAt':moment()[_0xc6e1('0x24')](_0xc6e1('0x2c'))}));});return BPromise[_0xc6e1('0x48')](_0x44a2b3);}}})['then'](function(){if(_0x54a3fd){return _0x54a3fd[_0xc6e1('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc6e1('0x17')](function(_0x5a5fc9){_0x3d98e9(_0x5a5fc9);})['catch'](function(_0x350d6d){_0x41272b(_0x31485b['error'](0x1f4,_0x350d6d[_0xc6e1('0x1d')]));});});};exports[_0xc6e1('0x49')]=function(_0x31c0dd){var _0x1ccb5c=this;return new Promise(function(_0x357094,_0x55d6b6){var _0x312057;var _0x4ec3d8;var _0x169bb7;var _0x50f24a;return db[_0xc6e1('0xf')][_0xc6e1('0x3b')]({'where':_0x31c0dd['options'][_0xc6e1('0x12')]||{},'attributes':['id',_0xc6e1('0x21'),_0xc6e1('0x3c'),_0xc6e1('0x4a'),_0xc6e1('0x4b'),_0xc6e1('0x22'),_0xc6e1('0x4c'),_0xc6e1('0x23')]})[_0xc6e1('0x17')](function(_0x26c259){if(_0x26c259){_0x312057=_0x26c259;_0x50f24a=_0x31c0dd[_0xc6e1('0x32')][_0xc6e1('0x23')]?_0x31c0dd[_0xc6e1('0x32')][_0xc6e1('0x23')]:util['format'](_0xc6e1('0x4d'),_0x312057[_0xc6e1('0x21')]);return db['User'][_0xc6e1('0x4e')]({'where':{'role':_0xc6e1('0x4f'),'online':!![],'id':{'$ne':_0x312057['id']}}});}})[_0xc6e1('0x17')](function(_0x294582){if(_0x294582){_0x169bb7=_0x294582;return require('../../config/license/util')[_0xc6e1('0x50')]();}})[_0xc6e1('0x17')](function(_0x142152){if(_0x142152&&_0x142152[_0xc6e1('0x51')]&&_0x169bb7>=_0x142152[_0xc6e1('0x51')]){throw new Error(_0xc6e1('0x52'));}})[_0xc6e1('0x17')](function(){if(_0x312057){return db[_0xc6e1('0x27')][_0xc6e1('0x47')]({'where':{'membername':_0x312057['name']},'individualHooks':!![]});}})[_0xc6e1('0x17')](function(){if(_0x312057){return _0x312057[_0xc6e1('0x53')]({'raw':!![]});}})[_0xc6e1('0x17')](function(_0x126cf2){if(_0x312057){if(_0x126cf2){var _0x481900=[];_0x4ec3d8=_0x126cf2;if(_0x4ec3d8[_0xc6e1('0x2b')]){for(var _0x515886=0x0;_0x515886<_0x4ec3d8[_0xc6e1('0x2b')];_0x515886++){_0x481900[_0xc6e1('0x2e')](db[_0xc6e1('0x27')][_0xc6e1('0x54')]({'membername':_0x312057[_0xc6e1('0x21')],'UserId':_0x312057['id'],'queue_name':_0x4ec3d8[_0x515886][_0xc6e1('0x21')],'VoiceQueueId':_0x4ec3d8[_0x515886]['id'],'interface':_0x50f24a,'paused':_0x312057[_0xc6e1('0x4c')]||![],'penalty':_0x4ec3d8[_0x515886][_0xc6e1('0x55')]||0x0}));}return BPromise[_0xc6e1('0x48')](_0x481900);}}}})['then'](function(){if(_0x312057){return db[_0xc6e1('0x29')]['findAll']({'where':{'membername':_0x312057[_0xc6e1('0x21')],'exitAt':null}});}})['then'](function(_0x1848a2){if(_0x312057){if(_0x1848a2&&_0x1848a2[_0xc6e1('0x2b')]){var _0x389fc3=[];_0x1848a2[_0xc6e1('0x2d')](function(_0x29019e){_0x389fc3['push'](_0x29019e[_0xc6e1('0x28')]({'exitAt':moment()[_0xc6e1('0x24')](_0xc6e1('0x2c'))}));});return BPromise[_0xc6e1('0x48')](_0x389fc3);}}})[_0xc6e1('0x17')](function(){if(_0x312057){var _0x15587e=[];var _0x63e06b=[];var _0x1caf93=utils['getChannels']();var _0x4708c1={'membername':_0x312057[_0xc6e1('0x21')],'interface':_0x50f24a,'enterAt':moment()[_0xc6e1('0x24')](_0xc6e1('0x2c')),'role':_0x312057[_0xc6e1('0x3c')],'internal':_0x312057[_0xc6e1('0x22')]};_0x1caf93[_0xc6e1('0x2d')](function(_0x1c6ac1){_0x15587e['push'](_[_0xc6e1('0x56')]({'channel':_0x1c6ac1,'type':_0xc6e1('0x57'),'data1':_0xc6e1('0x58'),'data2':_0x50f24a},_0x4708c1));if(_0x312057[_0xc6e1('0x4c')]){_0x63e06b[_0xc6e1('0x2e')](_[_0xc6e1('0x56')]({'channel':_0x1c6ac1,'type':_0xc6e1('0x30'),'data1':'LOGININPAUSE'},_0x4708c1));}});return db[_0xc6e1('0x29')][_0xc6e1('0x34')](_0x15587e[_0xc6e1('0x59')](_0x63e06b),{'individualHooks':!![]});}})['then'](function(){if(_0x312057){return _0x312057['update']({'online':!![],'lastLoginAt':moment()[_0xc6e1('0x24')](_0xc6e1('0x2c')),'voicePause':_0x312057[_0xc6e1('0x4c')]||![],'mailPause':_0x312057[_0xc6e1('0x4c')]||![],'chatPause':_0x312057[_0xc6e1('0x4c')]||![],'faxPause':_0x312057[_0xc6e1('0x4c')]||![],'smsPause':_0x312057[_0xc6e1('0x4c')]||![],'openchannelPause':_0x312057[_0xc6e1('0x4c')]||![],'pauseType':_0x312057[_0xc6e1('0x4c')]?_0xc6e1('0x5a'):null,'lastPauseAt':moment()[_0xc6e1('0x24')](_0xc6e1('0x2c')),'interface':_0x50f24a});}})[_0xc6e1('0x17')](function(_0x4fe500){_0x357094(_0x4fe500);})['catch'](function(_0xf5fd7c){_0x55d6b6(_0x1ccb5c['error'](0x1f4,_0xf5fd7c[_0xc6e1('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a35a556..953712e 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 _0x6fa5=['remove','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6fa5,0x1e6));var _0x56fa=function(_0x1cb030,_0x1da8bd){_0x1cb030=_0x1cb030-0x0;var _0x580b58=_0x6fa5[_0x1cb030];return _0x580b58;};'use strict';var UserEvents=require(_0x56fa('0x0'));var events=[_0x56fa('0x1'),_0x56fa('0x2'),'update'];function createListener(_0x23b8df,_0x294bac){return function(_0x4fc0a9){_0x294bac[_0x56fa('0x3')](_0x23b8df,_0x4fc0a9);};}function removeListener(_0x247457,_0x20ff82){return function(){UserEvents[_0x56fa('0x4')](_0x247457,_0x20ff82);};}exports[_0x56fa('0x5')]=function(_0xf1e92){for(var _0x598434=0x0,_0x13ef51=events[_0x56fa('0x6')];_0x598434<_0x13ef51;_0x598434++){var _0xf76f05=events[_0x598434];var _0x2c30a9=createListener(_0x56fa('0x7')+_0xf76f05,_0xf1e92);UserEvents['on'](_0xf76f05,_0x2c30a9);}}; \ No newline at end of file +var _0x9dd8=['save','remove','update','emit','removeListener','user:','./user.events'];(function(_0x224b2f,_0x192fc7){var _0x3e5ed4=function(_0x2a069e){while(--_0x2a069e){_0x224b2f['push'](_0x224b2f['shift']());}};_0x3e5ed4(++_0x192fc7);}(_0x9dd8,0x15d));var _0x89dd=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x9dd8[_0x1deb03];return _0x189fe7;};'use strict';var UserEvents=require(_0x89dd('0x0'));var events=[_0x89dd('0x1'),_0x89dd('0x2'),_0x89dd('0x3')];function createListener(_0x2e78e2,_0x4a61fc){return function(_0x26ed06){_0x4a61fc[_0x89dd('0x4')](_0x2e78e2,_0x26ed06);};}function removeListener(_0x32b6de,_0x54efde){return function(){UserEvents[_0x89dd('0x5')](_0x32b6de,_0x54efde);};}exports['register']=function(_0x47efd4){for(var _0x29a56c=0x0,_0x50cebc=events['length'];_0x29a56c<_0x50cebc;_0x29a56c++){var _0x3da62a=events[_0x29a56c];var _0x5095c8=createListener(_0x89dd('0x6')+_0x3da62a,_0x47efd4);UserEvents['on'](_0x3da62a,_0x5095c8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 970a959..c240774 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x48e7ae,_0x3f5e94){var _0x3814ee=function(_0x1030e3){while(--_0x1030e3){_0x48e7ae['push'](_0x48e7ae['shift']());}};_0x3814ee(++_0x3f5e94);}(_0x70e0,0x17b));var _0x070e=function(_0x296e4f,_0x51e184){_0x296e4f=_0x296e4f-0x0;var _0x1f3d17=_0x70e0[_0x296e4f];return _0x1f3d17;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x232f9c,_0x3ae9df){var _0x24bb71=function(_0x4fb958){while(--_0x4fb958){_0x232f9c['push'](_0x232f9c['shift']());}};_0x24bb71(++_0x3ae9df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 54b6465..9a8602e 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 _0x15d2=['exports'];(function(_0x3a05c4,_0x4cf0dd){var _0x4060f4=function(_0x4bc467){while(--_0x4bc467){_0x3a05c4['push'](_0x3a05c4['shift']());}};_0x4060f4(++_0x4cf0dd);}(_0x15d2,0x163));var _0x215d=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x15d2[_0x4c9380];return _0x49a523;};'use strict';var Sequelize=require('sequelize');module[_0x215d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcfa6=['sequelize','INTEGER'];(function(_0x11b648,_0x110359){var _0x4ad9af=function(_0x2cc9cd){while(--_0x2cc9cd){_0x11b648['push'](_0x11b648['shift']());}};_0x4ad9af(++_0x110359);}(_0xcfa6,0x168));var _0x6cfa=function(_0x28cd2c,_0x1ce656){_0x28cd2c=_0x28cd2c-0x0;var _0x162980=_0xcfa6[_0x28cd2c];return _0x162980;};'use strict';var Sequelize=require(_0x6cfa('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6cfa('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 b76e1f3..e0fff20 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 _0xadb5=['./userChatQueue.attributes','define','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x32a516,_0x2ed82f){var _0x4aab13=function(_0x622480){while(--_0x622480){_0x32a516['push'](_0x32a516['shift']());}};_0x4aab13(++_0x2ed82f);}(_0xadb5,0x8e));var _0x5adb=function(_0x4087a8,_0x279380){_0x4087a8=_0x4087a8-0x0;var _0x3da8d9=_0xadb5[_0x4087a8];return _0x3da8d9;};'use strict';var _=require(_0x5adb('0x0'));var util=require(_0x5adb('0x1'));var logger=require('../../config/logger')(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require(_0x5adb('0x4'));var rp=require(_0x5adb('0x5'));var fs=require('fs');var path=require(_0x5adb('0x6'));var rimraf=require('rimraf');var config=require(_0x5adb('0x7'));var attributes=require(_0x5adb('0x8'));module['exports']=function(_0x13f32f,_0xe8786){return _0x13f32f[_0x5adb('0x9')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1e6=['define','UserChatQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x28367c,_0x4ab687){var _0x32be1d=function(_0x572e63){while(--_0x572e63){_0x28367c['push'](_0x28367c['shift']());}};_0x32be1d(++_0x4ab687);}(_0xd1e6,0xce));var _0x6d1e=function(_0x33f3fe,_0x332a8b){_0x33f3fe=_0x33f3fe-0x0;var _0x10075c=_0xd1e6[_0x33f3fe];return _0x10075c;};'use strict';var _=require(_0x6d1e('0x0'));var util=require(_0x6d1e('0x1'));var logger=require(_0x6d1e('0x2'))('api');var moment=require(_0x6d1e('0x3'));var BPromise=require(_0x6d1e('0x4'));var rp=require(_0x6d1e('0x5'));var fs=require('fs');var path=require(_0x6d1e('0x6'));var rimraf=require(_0x6d1e('0x7'));var config=require(_0x6d1e('0x8'));var attributes=require('./userChatQueue.attributes');module[_0x6d1e('0x9')]=function(_0x4382e8,_0x450dd0){return _0x4382e8[_0x6d1e('0xa')](_0x6d1e('0xb'),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 3a41314..1c536c9 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 _0x9384=['request\x20sent','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message'];(function(_0x327322,_0x585e5e){var _0x1b6f8f=function(_0x449855){while(--_0x449855){_0x327322['push'](_0x327322['shift']());}};_0x1b6f8f(++_0x585e5e);}(_0x9384,0x16a));var _0x4938=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x9384[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x4938('0x0'));var util=require(_0x4938('0x1'));var moment=require(_0x4938('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4938('0x3'));var db=require(_0x4938('0x4'))['db'];var utils=require(_0x4938('0x5'));var logger=require(_0x4938('0x6'))(_0x4938('0x7'));var config=require(_0x4938('0x8'));var jayson=require(_0x4938('0x9'));var client=jayson[_0x4938('0xa')][_0x4938('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b5c7f,_0x3b5d2c,_0x43c37a){return new BPromise(function(_0x19797b,_0x37c54a){return client[_0x4938('0xc')](_0x4b5c7f,_0x43c37a)[_0x4938('0xd')](function(_0x3823aa){logger[_0x4938('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x3b5d2c,'request\x20sent');logger[_0x4938('0xf')](_0x4938('0x10'),_0x3b5d2c,'request\x20sent',JSON[_0x4938('0x11')](_0x3823aa));if(_0x3823aa[_0x4938('0x12')]){if(_0x3823aa['error'][_0x4938('0x13')]===0x1f4){logger[_0x4938('0x12')](_0x4938('0x14'),_0x3b5d2c,_0x3823aa[_0x4938('0x12')][_0x4938('0x15')]);return _0x37c54a(_0x3823aa[_0x4938('0x12')][_0x4938('0x15')]);}logger[_0x4938('0x12')](_0x4938('0x14'),_0x3b5d2c,_0x3823aa['error'][_0x4938('0x15')]);return _0x19797b(_0x3823aa[_0x4938('0x12')][_0x4938('0x15')]);}else{logger[_0x4938('0xe')](_0x4938('0x14'),_0x3b5d2c,_0x4938('0x16'));_0x19797b(_0x3823aa['result']['message']);}})[_0x4938('0x17')](function(_0x3f2469){logger[_0x4938('0x12')](_0x4938('0x14'),_0x3b5d2c,_0x3f2469);_0x37c54a(_0x3f2469);});});} \ No newline at end of file +var _0x17c3=['client','http','request','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x41e507,_0x17d6b9){var _0x407024=function(_0x3753e1){while(--_0x3753e1){_0x41e507['push'](_0x41e507['shift']());}};_0x407024(++_0x17d6b9);}(_0x17c3,0x1d0));var _0x317c=function(_0x196757,_0x45ff9e){_0x196757=_0x196757-0x0;var _0x561d69=_0x17c3[_0x196757];return _0x561d69;};'use strict';var _=require(_0x317c('0x0'));var util=require(_0x317c('0x1'));var moment=require(_0x317c('0x2'));var BPromise=require(_0x317c('0x3'));var rs=require(_0x317c('0x4'));var fs=require('fs');var Redis=require(_0x317c('0x5'));var db=require(_0x317c('0x6'))['db'];var utils=require(_0x317c('0x7'));var logger=require(_0x317c('0x8'))(_0x317c('0x9'));var config=require('../../config/environment');var jayson=require(_0x317c('0xa'));var client=jayson[_0x317c('0xb')][_0x317c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x548863,_0x652986,_0x33dbde){return new BPromise(function(_0x1f0cb2,_0x3e57e5){return client[_0x317c('0xd')](_0x548863,_0x33dbde)[_0x317c('0xe')](function(_0x15d723){logger[_0x317c('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x652986,'request\x20sent');logger[_0x317c('0x10')](_0x317c('0x11'),_0x652986,_0x317c('0x12'),JSON[_0x317c('0x13')](_0x15d723));if(_0x15d723[_0x317c('0x14')]){if(_0x15d723[_0x317c('0x14')][_0x317c('0x15')]===0x1f4){logger[_0x317c('0x14')](_0x317c('0x16'),_0x652986,_0x15d723['error'][_0x317c('0x17')]);return _0x3e57e5(_0x15d723[_0x317c('0x14')]['message']);}logger[_0x317c('0x14')](_0x317c('0x16'),_0x652986,_0x15d723[_0x317c('0x14')][_0x317c('0x17')]);return _0x1f0cb2(_0x15d723[_0x317c('0x14')]['message']);}else{logger[_0x317c('0xf')](_0x317c('0x16'),_0x652986,_0x317c('0x12'));_0x1f0cb2(_0x15d723[_0x317c('0x18')]['message']);}})['catch'](function(_0x757916){logger[_0x317c('0x14')](_0x317c('0x16'),_0x652986,_0x757916);_0x3e57e5(_0x757916);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 596d688..4017d35 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4b73cc,_0x5a9372){var _0x3cf5aa=function(_0x210b39){while(--_0x210b39){_0x4b73cc['push'](_0x4b73cc['shift']());}};_0x3cf5aa(++_0x5a9372);}(_0xedd9,0xfc));var _0x9edd=function(_0x17dac0,_0x182df7){_0x17dac0=_0x17dac0-0x0;var _0x497770=_0xedd9[_0x17dac0];return _0x497770;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x17558f,_0x42f9f5){var _0x4a81a5=function(_0x14ec0a){while(--_0x14ec0a){_0x17558f['push'](_0x17558f['shift']());}};_0x4a81a5(++_0x42f9f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 1b1c61a..548f264 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 _0x70a2=['exports','INTEGER','STRING','sequelize'];(function(_0x4301c7,_0x34373b){var _0x167782=function(_0x5e9ede){while(--_0x5e9ede){_0x4301c7['push'](_0x4301c7['shift']());}};_0x167782(++_0x34373b);}(_0x70a2,0xc3));var _0x270a=function(_0x32ee35,_0x1c6db0){_0x32ee35=_0x32ee35-0x0;var _0x395daa=_0x70a2[_0x32ee35];return _0x395daa;};'use strict';var Sequelize=require(_0x270a('0x0'));module[_0x270a('0x1')]={'penalty':{'type':Sequelize[_0x270a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x270a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x270a('0x3')]}}; \ No newline at end of file +var _0xf6a6=['STRING','sequelize','INTEGER'];(function(_0x183b13,_0x5bea3b){var _0x268216=function(_0x51f96c){while(--_0x51f96c){_0x183b13['push'](_0x183b13['shift']());}};_0x268216(++_0x5bea3b);}(_0xf6a6,0xbe));var _0x6f6a=function(_0x21b68b,_0x47cde3){_0x21b68b=_0x21b68b-0x0;var _0xb469fd=_0xf6a6[_0x21b68b];return _0xb469fd;};'use strict';var Sequelize=require(_0x6f6a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6f6a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6f6a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6f6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 90db6a8..937d4a8 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 _0x06a5=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userFaxQueue.attributes','exports','user_has_fax_queues','lodash'];(function(_0x3f463f,_0x1be0db){var _0xb342b2=function(_0x1ca7b5){while(--_0x1ca7b5){_0x3f463f['push'](_0x3f463f['shift']());}};_0xb342b2(++_0x1be0db);}(_0x06a5,0xdb));var _0x506a=function(_0x220268,_0x4da70e){_0x220268=_0x220268-0x0;var _0x4f6e56=_0x06a5[_0x220268];return _0x4f6e56;};'use strict';var _=require(_0x506a('0x0'));var util=require(_0x506a('0x1'));var logger=require(_0x506a('0x2'))(_0x506a('0x3'));var moment=require(_0x506a('0x4'));var BPromise=require(_0x506a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x506a('0x6'));var config=require(_0x506a('0x7'));var attributes=require(_0x506a('0x8'));module[_0x506a('0x9')]=function(_0x56f21c,_0x1b6779){return _0x56f21c['define']('UserFaxQueue',attributes,{'tableName':_0x506a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb447=['util','../../config/logger','api','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x43a432,_0x35dcec){var _0xe858b0=function(_0x5443af){while(--_0x5443af){_0x43a432['push'](_0x43a432['shift']());}};_0xe858b0(++_0x35dcec);}(_0xb447,0xf1));var _0x7b44=function(_0x358237,_0x496b7d){_0x358237=_0x358237-0x0;var _0x4ad711=_0xb447[_0x358237];return _0x4ad711;};'use strict';var _=require(_0x7b44('0x0'));var util=require(_0x7b44('0x1'));var logger=require(_0x7b44('0x2'))(_0x7b44('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7b44('0x4'));var config=require(_0x7b44('0x5'));var attributes=require(_0x7b44('0x6'));module[_0x7b44('0x7')]=function(_0x4426ac,_0x995fdd){return _0x4426ac[_0x7b44('0x8')](_0x7b44('0x9'),attributes,{'tableName':_0x7b44('0xa'),'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 1baea2d..58c370b 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 _0xb0aa=['error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xb0aa,0x9d));var _0xab0a=function(_0x358b00,_0x2ee0fc){_0x358b00=_0x358b00-0x0;var _0x44799b=_0xb0aa[_0x358b00];return _0x44799b;};'use strict';var _=require(_0xab0a('0x0'));var util=require(_0xab0a('0x1'));var moment=require(_0xab0a('0x2'));var BPromise=require('bluebird');var rs=require(_0xab0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab0a('0x4'));var logger=require('../../config/logger')(_0xab0a('0x5'));var config=require(_0xab0a('0x6'));var jayson=require(_0xab0a('0x7'));var client=jayson['client'][_0xab0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cb285,_0x5e1a90,_0x233a47){return new BPromise(function(_0x40bcaa,_0x5ab879){return client[_0xab0a('0x9')](_0x4cb285,_0x233a47)['then'](function(_0x337c0d){logger[_0xab0a('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x5e1a90,'request\x20sent');logger['debug'](_0xab0a('0xb'),_0x5e1a90,_0xab0a('0xc'),JSON[_0xab0a('0xd')](_0x337c0d));if(_0x337c0d[_0xab0a('0xe')]){if(_0x337c0d[_0xab0a('0xe')]['code']===0x1f4){logger[_0xab0a('0xe')](_0xab0a('0xf'),_0x5e1a90,_0x337c0d['error']['message']);return _0x5ab879(_0x337c0d['error'][_0xab0a('0x10')]);}logger[_0xab0a('0xe')](_0xab0a('0xf'),_0x5e1a90,_0x337c0d[_0xab0a('0xe')][_0xab0a('0x10')]);return _0x40bcaa(_0x337c0d['error'][_0xab0a('0x10')]);}else{logger[_0xab0a('0xa')](_0xab0a('0xf'),_0x5e1a90,'request\x20sent');_0x40bcaa(_0x337c0d[_0xab0a('0x11')][_0xab0a('0x10')]);}})[_0xab0a('0x12')](function(_0x20a79f){logger[_0xab0a('0xe')](_0xab0a('0xf'),_0x5e1a90,_0x20a79f);_0x5ab879(_0x20a79f);});});} \ No newline at end of file +var _0x1717=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x593534,_0x471e0b){var _0x12b346=function(_0x1cdf12){while(--_0x1cdf12){_0x593534['push'](_0x593534['shift']());}};_0x12b346(++_0x471e0b);}(_0x1717,0xfb));var _0x7171=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x1717[_0x514c15];return _0x16283e;};'use strict';var _=require(_0x7171('0x0'));var util=require(_0x7171('0x1'));var moment=require(_0x7171('0x2'));var BPromise=require(_0x7171('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7171('0x4'));var db=require(_0x7171('0x5'))['db'];var utils=require(_0x7171('0x6'));var logger=require('../../config/logger')(_0x7171('0x7'));var config=require(_0x7171('0x8'));var jayson=require(_0x7171('0x9'));var client=jayson[_0x7171('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cd4c5,_0x446db8,_0x39e494){return new BPromise(function(_0x4b4e,_0x4a20f9){return client['request'](_0x3cd4c5,_0x39e494)[_0x7171('0xb')](function(_0x46ede4){logger[_0x7171('0xc')](_0x7171('0xd'),_0x446db8,_0x7171('0xe'));logger['debug'](_0x7171('0xf'),_0x446db8,'request\x20sent',JSON[_0x7171('0x10')](_0x46ede4));if(_0x46ede4[_0x7171('0x11')]){if(_0x46ede4[_0x7171('0x11')][_0x7171('0x12')]===0x1f4){logger[_0x7171('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x446db8,_0x46ede4[_0x7171('0x11')][_0x7171('0x13')]);return _0x4a20f9(_0x46ede4[_0x7171('0x11')][_0x7171('0x13')]);}logger[_0x7171('0x11')](_0x7171('0xd'),_0x446db8,_0x46ede4[_0x7171('0x11')][_0x7171('0x13')]);return _0x4b4e(_0x46ede4[_0x7171('0x11')][_0x7171('0x13')]);}else{logger['info'](_0x7171('0xd'),_0x446db8,_0x7171('0xe'));_0x4b4e(_0x46ede4[_0x7171('0x14')][_0x7171('0x13')]);}})['catch'](function(_0x5517d4){logger[_0x7171('0x11')](_0x7171('0xd'),_0x446db8,_0x5517d4);_0x4a20f9(_0x5517d4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c3bec06..8362527 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2df609,_0x4d07a0){var _0x3140a6=function(_0x304b1b){while(--_0x304b1b){_0x2df609['push'](_0x2df609['shift']());}};_0x3140a6(++_0x4d07a0);}(_0x70e0,0x17b));var _0x070e=function(_0x54d81a,_0x37d25b){_0x54d81a=_0x54d81a-0x0;var _0xa468be=_0x70e0[_0x54d81a];return _0xa468be;};'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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index dd53e69..9898799 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 _0xc1bf=['INTEGER','sequelize','exports'];(function(_0x20e227,_0x1b74c7){var _0xc62185=function(_0x14df33){while(--_0x14df33){_0x20e227['push'](_0x20e227['shift']());}};_0xc62185(++_0x1b74c7);}(_0xc1bf,0x79));var _0xfc1b=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xc1bf[_0x2ca9d4];return _0x258956;};'use strict';var Sequelize=require(_0xfc1b('0x0'));module[_0xfc1b('0x1')]={'penalty':{'type':Sequelize[_0xfc1b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x63af=['exports','INTEGER','sequelize'];(function(_0x1f3154,_0x12d04d){var _0x4f2dfd=function(_0x37d882){while(--_0x37d882){_0x1f3154['push'](_0x1f3154['shift']());}};_0x4f2dfd(++_0x12d04d);}(_0x63af,0x68));var _0xf63a=function(_0x1256cd,_0x8939b9){_0x1256cd=_0x1256cd-0x0;var _0x4a310f=_0x63af[_0x1256cd];return _0x4a310f;};'use strict';var Sequelize=require(_0xf63a('0x0'));module[_0xf63a('0x1')]={'penalty':{'type':Sequelize[_0xf63a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index d66e8f3..56f8719 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 _0x324c=['user_has_mail_queues','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','UserMailQueue'];(function(_0x46a099,_0x4aa8e2){var _0x5a2b30=function(_0x3c0e79){while(--_0x3c0e79){_0x46a099['push'](_0x46a099['shift']());}};_0x5a2b30(++_0x4aa8e2);}(_0x324c,0x1ae));var _0xc324=function(_0x55bae5,_0x1a55f0){_0x55bae5=_0x55bae5-0x0;var _0x274fc3=_0x324c[_0x55bae5];return _0x274fc3;};'use strict';var _=require(_0xc324('0x0'));var util=require(_0xc324('0x1'));var logger=require(_0xc324('0x2'))('api');var moment=require(_0xc324('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc324('0x4'));var rimraf=require(_0xc324('0x5'));var config=require(_0xc324('0x6'));var attributes=require('./userMailQueue.attributes');module[_0xc324('0x7')]=function(_0x4e1976,_0x37ba6a){return _0x4e1976[_0xc324('0x8')](_0xc324('0x9'),attributes,{'tableName':_0xc324('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc182=['user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x41a93b,_0x2fc19d){var _0x220a7e=function(_0x5ecb05){while(--_0x5ecb05){_0x41a93b['push'](_0x41a93b['shift']());}};_0x220a7e(++_0x2fc19d);}(_0xc182,0xe5));var _0x2c18=function(_0x476677,_0x3feb45){_0x476677=_0x476677-0x0;var _0x4c0a56=_0xc182[_0x476677];return _0x4c0a56;};'use strict';var _=require(_0x2c18('0x0'));var util=require(_0x2c18('0x1'));var logger=require(_0x2c18('0x2'))('api');var moment=require(_0x2c18('0x3'));var BPromise=require(_0x2c18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c18('0x5'));var rimraf=require(_0x2c18('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c18('0x7'));module[_0x2c18('0x8')]=function(_0x2fbe95,_0x2efc73){return _0x2fbe95[_0x2c18('0x9')](_0x2c18('0xa'),attributes,{'tableName':_0x2c18('0xb'),'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 3950b30..000ea7d 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4d585e,_0x31afc5){var _0x1a3b23=function(_0x4816e0){while(--_0x4816e0){_0x4d585e['push'](_0x4d585e['shift']());}};_0x1a3b23(++_0x31afc5);}(_0x34e8,0x12c));var _0x834e=function(_0x15b628,_0x2ee992){_0x15b628=_0x15b628-0x0;var _0x23f8a2=_0x34e8[_0x15b628];return _0x23f8a2;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x183d50,_0xa36bc8){var _0x2587fa=function(_0xc59727){while(--_0xc59727){_0x183d50['push'](_0x183d50['shift']());}};_0x2587fa(++_0xa36bc8);}(_0xe14b,0x93));var _0xbe14=function(_0x3274b0,_0x1cb7db){_0x3274b0=_0x3274b0-0x0;var _0x110dae=_0xe14b[_0x3274b0];return _0x110dae;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3f5e48f..6848ff3 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 _0x8dc6=['util','path','express','Router','fs-extra','../../config/environment','./userNotification.controller','isAuthenticated','exports','multer'];(function(_0x1eb5da,_0x1974ec){var _0x579a2f=function(_0x502c14){while(--_0x502c14){_0x1eb5da['push'](_0x1eb5da['shift']());}};_0x579a2f(++_0x1974ec);}(_0x8dc6,0x1ad));var _0x68dc=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x8dc6[_0x237546];return _0x233e29;};'use strict';var multer=require(_0x68dc('0x0'));var util=require(_0x68dc('0x1'));var path=require(_0x68dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x68dc('0x3'));var router=express[_0x68dc('0x4')]();var fs_extra=require(_0x68dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x68dc('0x6'));var controller=require(_0x68dc('0x7'));router['post']('/',auth[_0x68dc('0x8')](),controller['sendUserNotification']);module[_0x68dc('0x9')]=router; \ No newline at end of file +var _0x02de=['fs-extra','../../components/auth/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','Router'];(function(_0x4b587b,_0x4ee2bc){var _0x2caa4d=function(_0x287932){while(--_0x287932){_0x4b587b['push'](_0x4b587b['shift']());}};_0x2caa4d(++_0x4ee2bc);}(_0x02de,0x1db));var _0xe02d=function(_0x5563fd,_0x1f8c42){_0x5563fd=_0x5563fd-0x0;var _0x329495=_0x02de[_0x5563fd];return _0x329495;};'use strict';var multer=require(_0xe02d('0x0'));var util=require(_0xe02d('0x1'));var path=require('path');var timeout=require(_0xe02d('0x2'));var express=require(_0xe02d('0x3'));var router=express[_0xe02d('0x4')]();var fs_extra=require(_0xe02d('0x5'));var auth=require(_0xe02d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe02d('0x7'));var controller=require('./userNotification.controller');router[_0xe02d('0x8')]('/',auth[_0xe02d('0x9')](),controller[_0xe02d('0xa')]);module[_0xe02d('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 0f6aa66..dbb496e 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 _0x8176=['STRING','BOOLEAN','TEXT'];(function(_0x1691d8,_0x596352){var _0xd1d4f=function(_0x4af084){while(--_0x4af084){_0x1691d8['push'](_0x1691d8['shift']());}};_0xd1d4f(++_0x596352);}(_0x8176,0xb0));var _0x6817=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8176[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x6817('0x0')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x6817('0x0')]},'recipientsDescription':{'type':Sequelize[_0x6817('0x1')]},'beep':{'type':Sequelize[_0x6817('0x2')]}}; \ No newline at end of file +var _0x95b5=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x389fb1,_0x431673){var _0x3d3520=function(_0x2dcab7){while(--_0x2dcab7){_0x389fb1['push'](_0x389fb1['shift']());}};_0x3d3520(++_0x431673);}(_0x95b5,0x75));var _0x595b=function(_0x26d701,_0x95f242){_0x26d701=_0x26d701-0x0;var _0x25bb5d=_0x95b5[_0x26d701];return _0x25bb5d;};'use strict';var Sequelize=require(_0x595b('0x0'));module[_0x595b('0x1')]={'body':{'type':Sequelize[_0x595b('0x2')]},'senderName':{'type':Sequelize[_0x595b('0x3')]},'recipientsId':{'type':Sequelize[_0x595b('0x2')]},'recipientsDescription':{'type':Sequelize[_0x595b('0x3')]},'beep':{'type':Sequelize[_0x595b('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a311768..e93ce7a 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 _0xcd1d=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','model','User','union','ids','replace','queue','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xcd1d,0x177));var _0xdcd1=function(_0x10a367,_0x3adb87){_0x10a367=_0x10a367-0x0;var _0x16cb49=_0xcd1d[_0x10a367];return _0x16cb49;};'use strict';var emlformat=require(_0xdcd1('0x0'));var rimraf=require(_0xdcd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcd1('0x2'));var rp=require(_0xdcd1('0x3'));var moment=require('moment');var BPromise=require(_0xdcd1('0x4'));var Mustache=require(_0xdcd1('0x5'));var util=require(_0xdcd1('0x6'));var path=require(_0xdcd1('0x7'));var sox=require(_0xdcd1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcd1('0x9'));var _=require(_0xdcd1('0xa'));var squel=require('squel');var crypto=require(_0xdcd1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdcd1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdcd1('0xd'));var Papa=require(_0xdcd1('0xe'));var Redis=require(_0xdcd1('0xf'));var authService=require(_0xdcd1('0x10'));var qs=require(_0xdcd1('0x11'));var as=require(_0xdcd1('0x12'));var hardwareService=require(_0xdcd1('0x13'));var logger=require(_0xdcd1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdcd1('0x15'));var licenseUtil=require(_0xdcd1('0x16'));var db=require(_0xdcd1('0x17'))['db'];config[_0xdcd1('0x18')]=_[_0xdcd1('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdcd1('0x1a'))(new Redis(config['redis']));require(_0xdcd1('0x1b'))[_0xdcd1('0x1c')](socket);function respondWithStatusCode(_0xc565d5,_0x5d28e8){_0x5d28e8=_0x5d28e8||0xcc;return function(_0x418691){if(_0x418691){return _0xc565d5['sendStatus'](_0x5d28e8);}return _0xc565d5[_0xdcd1('0x1d')](_0x5d28e8)[_0xdcd1('0x1e')]();};}function respondWithResult(_0x8e3aa1,_0x225b2f){_0x225b2f=_0x225b2f||0xc8;return function(_0x5b3cc6){if(_0x5b3cc6){return _0x8e3aa1[_0xdcd1('0x1d')](_0x225b2f)[_0xdcd1('0x1f')](_0x5b3cc6);}};}function respondWithFilteredResult(_0x58b808,_0x8d4616){return function(_0x2f7202){if(_0x2f7202){var _0x42bd0e=typeof _0x8d4616['offset']===_0xdcd1('0x20')&&typeof _0x8d4616[_0xdcd1('0x21')]==='undefined';var _0x3e16d9=_0x2f7202['count'];var _0x3d8ad8=_0x42bd0e?0x0:_0x8d4616[_0xdcd1('0x22')];var _0x26456b=_0x42bd0e?_0x2f7202['count']:_0x8d4616['offset']+_0x8d4616[_0xdcd1('0x21')];var _0x519597;if(_0x26456b>=_0x3e16d9){_0x26456b=_0x3e16d9;_0x519597=0xc8;}else{_0x519597=0xce;}_0x58b808[_0xdcd1('0x1d')](_0x519597);return _0x58b808[_0xdcd1('0x23')](_0xdcd1('0x24'),_0x3d8ad8+'-'+_0x26456b+'/'+_0x3e16d9)[_0xdcd1('0x1f')](_0x2f7202);}return null;};}function patchUpdates(_0x4612c9){return function(_0x200102){try{jsonpatch[_0xdcd1('0x25')](_0x200102,_0x4612c9,!![]);}catch(_0x2f2520){return BPromise[_0xdcd1('0x26')](_0x2f2520);}return _0x200102[_0xdcd1('0x27')]();};}function saveUpdates(_0x1c3ed4,_0x47cfc3){return function(_0x1c2028){if(_0x1c2028){return _0x1c2028[_0xdcd1('0x28')](_0x1c3ed4)[_0xdcd1('0x29')](function(_0x35507a){return _0x35507a;});}return null;};}function removeEntity(_0x5d7b94,_0x2b7471){return function(_0x213422){if(_0x213422){return _0x213422['destroy']()['then'](function(){_0x5d7b94[_0xdcd1('0x1d')](0xcc)[_0xdcd1('0x1e')]();});}};}function handleEntityNotFound(_0x10514d,_0x439219){return function(_0x5f5ad2){if(!_0x5f5ad2){_0x10514d['sendStatus'](0x194);}return _0x5f5ad2;};}function handleError(_0x24dbde,_0x32d341){_0x32d341=_0x32d341||0x1f4;return function(_0xde73f8){logger[_0xdcd1('0x2a')](_0xde73f8[_0xdcd1('0x2b')]);if(_0xde73f8[_0xdcd1('0x2c')]){delete _0xde73f8['name'];}_0x24dbde[_0xdcd1('0x1d')](_0x32d341)['send'](_0xde73f8);};}exports[_0xdcd1('0x2d')]=function(_0x17a761,_0x3c9b95,_0x3b7eb6){if(!_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x2f')]('text')&&!_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x2f')](_0xdcd1('0x30'))){throw new db[(_0xdcd1('0x31'))][(_0xdcd1('0x32'))](_0xdcd1('0x33'));}else{if(_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x2f')]('TemplateId')&&!_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x2f')](_0xdcd1('0x34'))){throw new db[(_0xdcd1('0x31'))][(_0xdcd1('0x32'))](_0xdcd1('0x35'));}if(!_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x2f')]('recipients')){throw new db[(_0xdcd1('0x31'))][(_0xdcd1('0x32'))](_0xdcd1('0x36'));}else{try{var _0x4a21ff=JSON[_0xdcd1('0x37')](_0x17a761[_0xdcd1('0x2e')]['recipients']);}catch(_0x258e9c){logger[_0xdcd1('0x2a')](_0x258e9c);throw new db[(_0xdcd1('0x31'))]['ValidationError'](_0xdcd1('0x38'));}var _0x5d4cb5=[_0xdcd1('0x39'),_0xdcd1('0x3a'),'mailqueue',_0xdcd1('0x3b'),_0xdcd1('0x3c'),_0xdcd1('0x3d'),_0xdcd1('0x3e'),'team',_0xdcd1('0x3f')];if(_[_0xdcd1('0x40')](_0x4a21ff,function(_0x2e7766){return!_[_0xdcd1('0x41')](_0x5d4cb5,_0x2e7766['model'][_0xdcd1('0x42')]());})){throw new db['Sequelize'][(_0xdcd1('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x348ee1={};_0x348ee1[_0xdcd1('0x43')]=_0x17a761['body'][_0xdcd1('0x2f')](_0xdcd1('0x43'))?_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x43')]:_0x17a761['user'][_0xdcd1('0x44')];_0x348ee1[_0xdcd1('0x45')]=_[_0xdcd1('0x46')](_0x17a761['body']['recipientsDescription'])?null:_0x17a761[_0xdcd1('0x2e')]['recipientsDescription'];_0x348ee1[_0xdcd1('0x47')]=_0x17a761[_0xdcd1('0x2e')][_0xdcd1('0x47')]||![];_0x348ee1[_0xdcd1('0x48')]=_0x17a761[_0xdcd1('0x3f')]['id'];return getContent(_0x17a761[_0xdcd1('0x2e')])[_0xdcd1('0x29')](function(_0x4f83d2){_0x348ee1[_0xdcd1('0x2e')]=_0x4f83d2;return getRecipients(_0x4a21ff);})['then'](function(_0x456dc6){_0x348ee1[_0xdcd1('0x49')]=_['sortBy'](_0x456dc6)[_0xdcd1('0x4a')](',');return db[_0xdcd1('0x4b')]['transaction'](function(_0x23f925){return db['UserNotification'][_0xdcd1('0x4c')](_0x348ee1,{'raw':!![],'transaction':_0x23f925})[_0xdcd1('0x29')](function(_0xf17bd6){var _0x4a992f={'sender':_0x348ee1[_0xdcd1('0x43')],'description':_0x348ee1[_0xdcd1('0x45')],'content':_0x348ee1[_0xdcd1('0x2e')],'beep':_0x348ee1[_0xdcd1('0x47')]};_0x456dc6[_0xdcd1('0x4d')](function(_0x45cf2a){_0x4a992f[_0xdcd1('0x4e')]=_0x45cf2a;socket[_0xdcd1('0x4f')](_0xdcd1('0x50'),_0x4a992f);});return _0xf17bd6;});});})[_0xdcd1('0x29')](respondWithResult(_0x3c9b95,0xc9))[_0xdcd1('0x51')](handleError(_0x3c9b95,null));};function getContent(_0x3f33b0){return new BPromise(function(_0xb56304,_0x563844){if(_0x3f33b0[_0xdcd1('0x52')]){_0xb56304(_0x3f33b0[_0xdcd1('0x52')]);return;}return db[_0xdcd1('0x53')][_0xdcd1('0x54')]({'attributes':[_0xdcd1('0x55')],'where':{'id':_0x3f33b0[_0xdcd1('0x30')]},'raw':!![]})[_0xdcd1('0x29')](function(_0x24468d){if(!_0x24468d)throw new db['Sequelize'][(_0xdcd1('0x32'))](_0xdcd1('0x56'));var _0x13f4a4=Mustache['render'](_0x24468d[_0xdcd1('0x55')],_0x3f33b0['view']);_0xb56304(_0x13f4a4);})[_0xdcd1('0x51')](function(_0x2d2314){_0x563844(_0x2d2314);});});}function getRecipients(_0x46af07){return new BPromise(function(_0x5742b7,_0x3bcef5){var _0x3a9f31=[];var _0x2bf808=[];_0x46af07[_0xdcd1('0x4d')](function(_0x5c093f){var _0x342f0d=_['startCase'](_0x5c093f[_0xdcd1('0x57')][_0xdcd1('0x42')]());if(_0x342f0d===_0xdcd1('0x58')){_0x3a9f31=_[_0xdcd1('0x59')](_0x3a9f31,_0x5c093f[_0xdcd1('0x5a')]);}else{if(_['includes'](_0x342f0d,'queue'))_0x342f0d=_0x342f0d[_0xdcd1('0x5b')](_0xdcd1('0x5c'),_0xdcd1('0x5d'));_0x5c093f[_0xdcd1('0x5a')][_0xdcd1('0x4d')](function(_0x182184){_0x2bf808[_0xdcd1('0x5e')](getAgents(_0x342f0d,_0x182184));});}});return BPromise[_0xdcd1('0x5f')](_0x2bf808)[_0xdcd1('0x29')](function(_0x5db89f){_0x3a9f31=_[_0xdcd1('0x59')](_0x3a9f31,_[_0xdcd1('0x60')](_0x5db89f));_0x5742b7(_0x3a9f31);})[_0xdcd1('0x51')](function(_0x3d7b28){_0x3bcef5(_0x3d7b28);});});}function getAgents(_0x12b68a,_0x1a4682){return new BPromise(function(_0x26e5f2,_0x5ec3ce){return db[_0x12b68a][_0xdcd1('0x54')]({'where':{'id':_0x1a4682}})[_0xdcd1('0x29')](function(_0x43f6bf){return _0x43f6bf[_0xdcd1('0x61')]({'attributes':['id'],'raw':!![]})[_0xdcd1('0x29')](function(_0x3e84de){var _0x3e4b1d=_[_0xdcd1('0x62')](_0x3e84de,'id');_0x26e5f2(_0x3e4b1d);});})[_0xdcd1('0x51')](function(_0x50905f){_0x5ec3ce(_0x50905f);});});} \ No newline at end of file +var _0xce57=['html','render','User','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','./userNotification.socket','register','sendStatus','end','status','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','ValidationError','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','recipient','emit','catch','findOne'];(function(_0xf8e45b,_0x336e08){var _0xb38c41=function(_0x51f9d8){while(--_0x51f9d8){_0xf8e45b['push'](_0xf8e45b['shift']());}};_0xb38c41(++_0x336e08);}(_0xce57,0x6e));var _0x7ce5=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0xce57[_0x3c6ae2];return _0x4edda;};'use strict';var emlformat=require(_0x7ce5('0x0'));var rimraf=require(_0x7ce5('0x1'));var zipdir=require(_0x7ce5('0x2'));var jsonpatch=require(_0x7ce5('0x3'));var rp=require(_0x7ce5('0x4'));var moment=require(_0x7ce5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7ce5('0x6'));var util=require(_0x7ce5('0x7'));var path=require('path');var sox=require(_0x7ce5('0x8'));var csv=require(_0x7ce5('0x9'));var ejs=require(_0x7ce5('0xa'));var fs=require('fs');var fs_extra=require(_0x7ce5('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ce5('0xc'));var jsforce=require(_0x7ce5('0xd'));var deskjs=require(_0x7ce5('0xe'));var toCsv=require(_0x7ce5('0x9'));var querystring=require(_0x7ce5('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ce5('0x10'));var authService=require(_0x7ce5('0x11'));var qs=require(_0x7ce5('0x12'));var as=require(_0x7ce5('0x13'));var hardwareService=require(_0x7ce5('0x14'));var logger=require(_0x7ce5('0x15'))(_0x7ce5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ce5('0x17'));var db=require(_0x7ce5('0x18'))['db'];config['redis']=_[_0x7ce5('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7ce5('0x1a'))[_0x7ce5('0x1b')](socket);function respondWithStatusCode(_0x2257fb,_0x275624){_0x275624=_0x275624||0xcc;return function(_0x462c35){if(_0x462c35){return _0x2257fb[_0x7ce5('0x1c')](_0x275624);}return _0x2257fb['status'](_0x275624)[_0x7ce5('0x1d')]();};}function respondWithResult(_0x4600b1,_0x30c39e){_0x30c39e=_0x30c39e||0xc8;return function(_0x194d62){if(_0x194d62){return _0x4600b1[_0x7ce5('0x1e')](_0x30c39e)['json'](_0x194d62);}};}function respondWithFilteredResult(_0x180883,_0x3304f7){return function(_0x35ba74){if(_0x35ba74){var _0x4e6177=typeof _0x3304f7[_0x7ce5('0x1f')]===_0x7ce5('0x20')&&typeof _0x3304f7[_0x7ce5('0x21')]===_0x7ce5('0x20');var _0x39e1ea=_0x35ba74[_0x7ce5('0x22')];var _0x43f3c0=_0x4e6177?0x0:_0x3304f7['offset'];var _0x240527=_0x4e6177?_0x35ba74['count']:_0x3304f7['offset']+_0x3304f7[_0x7ce5('0x21')];var _0x107ad3;if(_0x240527>=_0x39e1ea){_0x240527=_0x39e1ea;_0x107ad3=0xc8;}else{_0x107ad3=0xce;}_0x180883[_0x7ce5('0x1e')](_0x107ad3);return _0x180883['set']('Content-Range',_0x43f3c0+'-'+_0x240527+'/'+_0x39e1ea)['json'](_0x35ba74);}return null;};}function patchUpdates(_0x1c3710){return function(_0x3c3338){try{jsonpatch[_0x7ce5('0x23')](_0x3c3338,_0x1c3710,!![]);}catch(_0x1c6eeb){return BPromise[_0x7ce5('0x24')](_0x1c6eeb);}return _0x3c3338[_0x7ce5('0x25')]();};}function saveUpdates(_0x4033be,_0x4b573c){return function(_0x3dabfa){if(_0x3dabfa){return _0x3dabfa[_0x7ce5('0x26')](_0x4033be)[_0x7ce5('0x27')](function(_0x25e2e4){return _0x25e2e4;});}return null;};}function removeEntity(_0x6c72d1,_0x112b66){return function(_0x1fca0e){if(_0x1fca0e){return _0x1fca0e[_0x7ce5('0x28')]()[_0x7ce5('0x27')](function(){_0x6c72d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xec9615,_0xd5cf85){return function(_0x2761ae){if(!_0x2761ae){_0xec9615[_0x7ce5('0x1c')](0x194);}return _0x2761ae;};}function handleError(_0x40c2a5,_0x278e74){_0x278e74=_0x278e74||0x1f4;return function(_0xb3ddde){logger[_0x7ce5('0x29')](_0xb3ddde[_0x7ce5('0x2a')]);if(_0xb3ddde[_0x7ce5('0x2b')]){delete _0xb3ddde[_0x7ce5('0x2b')];}_0x40c2a5['status'](_0x278e74)['send'](_0xb3ddde);};}exports[_0x7ce5('0x2c')]=function(_0x5e1236,_0x281116,_0x396140){if(!_0x5e1236[_0x7ce5('0x2d')][_0x7ce5('0x2e')](_0x7ce5('0x2f'))&&!_0x5e1236['body'][_0x7ce5('0x2e')](_0x7ce5('0x30'))){throw new db[(_0x7ce5('0x31'))]['ValidationError'](_0x7ce5('0x32'));}else{if(_0x5e1236['body'][_0x7ce5('0x2e')](_0x7ce5('0x30'))&&!_0x5e1236[_0x7ce5('0x2d')][_0x7ce5('0x2e')](_0x7ce5('0x33'))){throw new db[(_0x7ce5('0x31'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x5e1236[_0x7ce5('0x2d')][_0x7ce5('0x2e')](_0x7ce5('0x34'))){throw new db[(_0x7ce5('0x31'))]['ValidationError'](_0x7ce5('0x35'));}else{try{var _0x137818=JSON[_0x7ce5('0x36')](_0x5e1236['body'][_0x7ce5('0x34')]);}catch(_0x37ce72){logger[_0x7ce5('0x29')](_0x37ce72);throw new db[(_0x7ce5('0x31'))][(_0x7ce5('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xc071b7=[_0x7ce5('0x38'),_0x7ce5('0x39'),_0x7ce5('0x3a'),_0x7ce5('0x3b'),_0x7ce5('0x3c'),_0x7ce5('0x3d'),_0x7ce5('0x3e'),_0x7ce5('0x3f'),'user'];if(_[_0x7ce5('0x40')](_0x137818,function(_0x438cf2){return!_[_0x7ce5('0x41')](_0xc071b7,_0x438cf2[_0x7ce5('0x42')][_0x7ce5('0x43')]());})){throw new db[(_0x7ce5('0x31'))][(_0x7ce5('0x37'))](_0x7ce5('0x44'));}}}var _0x2f6415={};_0x2f6415[_0x7ce5('0x45')]=_0x5e1236[_0x7ce5('0x2d')][_0x7ce5('0x2e')]('senderName')?_0x5e1236['body'][_0x7ce5('0x45')]:_0x5e1236[_0x7ce5('0x46')][_0x7ce5('0x47')];_0x2f6415[_0x7ce5('0x48')]=_[_0x7ce5('0x49')](_0x5e1236[_0x7ce5('0x2d')][_0x7ce5('0x48')])?null:_0x5e1236[_0x7ce5('0x2d')]['recipientsDescription'];_0x2f6415['beep']=_0x5e1236['body'][_0x7ce5('0x4a')]||![];_0x2f6415[_0x7ce5('0x4b')]=_0x5e1236['user']['id'];return getContent(_0x5e1236[_0x7ce5('0x2d')])['then'](function(_0xe62263){_0x2f6415['body']=_0xe62263;return getRecipients(_0x137818);})[_0x7ce5('0x27')](function(_0x49e521){_0x2f6415[_0x7ce5('0x4c')]=_['sortBy'](_0x49e521)[_0x7ce5('0x4d')](',');return db[_0x7ce5('0x4e')][_0x7ce5('0x4f')](function(_0x3f8604){return db['UserNotification'][_0x7ce5('0x50')](_0x2f6415,{'raw':!![],'transaction':_0x3f8604})[_0x7ce5('0x27')](function(_0x1cdea6){var _0x1e8c10={'sender':_0x2f6415['senderName'],'description':_0x2f6415[_0x7ce5('0x48')],'content':_0x2f6415[_0x7ce5('0x2d')],'beep':_0x2f6415[_0x7ce5('0x4a')]};_0x49e521[_0x7ce5('0x51')](function(_0x1f4967){_0x1e8c10[_0x7ce5('0x52')]=_0x1f4967;socket[_0x7ce5('0x53')]('userNotification:send',_0x1e8c10);});return _0x1cdea6;});});})[_0x7ce5('0x27')](respondWithResult(_0x281116,0xc9))[_0x7ce5('0x54')](handleError(_0x281116,null));};function getContent(_0x37d73f){return new BPromise(function(_0x3cf967,_0x148a15){if(_0x37d73f[_0x7ce5('0x2f')]){_0x3cf967(_0x37d73f['text']);return;}return db['Template'][_0x7ce5('0x55')]({'attributes':[_0x7ce5('0x56')],'where':{'id':_0x37d73f[_0x7ce5('0x30')]},'raw':!![]})['then'](function(_0x257e6f){if(!_0x257e6f)throw new db[(_0x7ce5('0x31'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x14d0e7=Mustache[_0x7ce5('0x57')](_0x257e6f[_0x7ce5('0x56')],_0x37d73f[_0x7ce5('0x33')]);_0x3cf967(_0x14d0e7);})[_0x7ce5('0x54')](function(_0x23b91d){_0x148a15(_0x23b91d);});});}function getRecipients(_0x240cd6){return new BPromise(function(_0x323a85,_0x173eb0){var _0x5441b3=[];var _0x2d0387=[];_0x240cd6[_0x7ce5('0x51')](function(_0xd6db0b){var _0x47b5df=_['startCase'](_0xd6db0b['model'][_0x7ce5('0x43')]());if(_0x47b5df===_0x7ce5('0x58')){_0x5441b3=_[_0x7ce5('0x59')](_0x5441b3,_0xd6db0b[_0x7ce5('0x5a')]);}else{if(_[_0x7ce5('0x41')](_0x47b5df,_0x7ce5('0x5b')))_0x47b5df=_0x47b5df[_0x7ce5('0x5c')](_0x7ce5('0x5b'),_0x7ce5('0x5d'));_0xd6db0b['ids'][_0x7ce5('0x51')](function(_0x26ffc8){_0x2d0387[_0x7ce5('0x5e')](getAgents(_0x47b5df,_0x26ffc8));});}});return BPromise[_0x7ce5('0x5f')](_0x2d0387)['then'](function(_0x48271d){_0x5441b3=_[_0x7ce5('0x59')](_0x5441b3,_['flatten'](_0x48271d));_0x323a85(_0x5441b3);})[_0x7ce5('0x54')](function(_0x44e510){_0x173eb0(_0x44e510);});});}function getAgents(_0x3ff2e2,_0x2a24da){return new BPromise(function(_0x57bdd6,_0x272127){return db[_0x3ff2e2][_0x7ce5('0x55')]({'where':{'id':_0x2a24da}})[_0x7ce5('0x27')](function(_0x405dc3){return _0x405dc3[_0x7ce5('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x197b4f){var _0x552bc0=_[_0x7ce5('0x61')](_0x197b4f,'id');_0x57bdd6(_0x552bc0);});})['catch'](function(_0x1b3d6e){_0x272127(_0x1b3d6e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9b05a95..dcd113c 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 _0xe26b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0x56250d,_0x25a6b8){var _0x13e85e=function(_0x1664fd){while(--_0x1664fd){_0x56250d['push'](_0x56250d['shift']());}};_0x13e85e(++_0x25a6b8);}(_0xe26b,0x11f));var _0xbe26=function(_0x9b993d,_0x16efcc){_0x9b993d=_0x9b993d-0x0;var _0x2c30fb=_0xe26b[_0x9b993d];return _0x2c30fb;};'use strict';var EventEmitter=require(_0xbe26('0x0'));var UserNotification=require(_0xbe26('0x1'))['db'][_0xbe26('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbe26('0x3')](0x0);var events={'afterCreate':_0xbe26('0x4'),'afterUpdate':_0xbe26('0x5'),'afterDestroy':_0xbe26('0x6')};function emitEvent(_0x374308){return function(_0x41e944,_0x4213e5,_0x181f70){UserNotificationEvents[_0xbe26('0x7')](_0x374308+':'+_0x41e944['id'],_0x41e944);UserNotificationEvents[_0xbe26('0x7')](_0x374308,_0x41e944);_0x181f70(null);};}for(var e in events){if(events[_0xbe26('0x8')](e)){var event=events[e];UserNotification[_0xbe26('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xdda3=['hook','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3d7436,_0x5e1e82){var _0x18133f=function(_0x173f40){while(--_0x173f40){_0x3d7436['push'](_0x3d7436['shift']());}};_0x18133f(++_0x5e1e82);}(_0xdda3,0x1b1));var _0x3dda=function(_0x56e984,_0x57363d){_0x56e984=_0x56e984-0x0;var _0x4cb323=_0xdda3[_0x56e984];return _0x4cb323;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3dda('0x0'))['db'][_0x3dda('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3dda('0x2')](0x0);var events={'afterCreate':_0x3dda('0x3'),'afterUpdate':_0x3dda('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21e2a5){return function(_0xd3b58,_0xaad3b8,_0x4cf5cb){UserNotificationEvents[_0x3dda('0x5')](_0x21e2a5+':'+_0xd3b58['id'],_0xd3b58);UserNotificationEvents[_0x3dda('0x5')](_0x21e2a5,_0xd3b58);_0x4cf5cb(null);};}for(var e in events){if(events[_0x3dda('0x6')](e)){var event=events[e];UserNotification[_0x3dda('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index c16d2a4..2582fdc 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 _0xa612=['UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa612,0x10d));var _0x2a61=function(_0x2b5147,_0xedb2dd){_0x2b5147=_0x2b5147-0x0;var _0x58eff5=_0xa612[_0x2b5147];return _0x58eff5;};'use strict';var _=require('lodash');var util=require(_0x2a61('0x0'));var logger=require(_0x2a61('0x1'))(_0x2a61('0x2'));var moment=require(_0x2a61('0x3'));var BPromise=require(_0x2a61('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a61('0x5'));var rimraf=require(_0x2a61('0x6'));var config=require(_0x2a61('0x7'));var attributes=require(_0x2a61('0x8'));module[_0x2a61('0x9')]=function(_0x5827cf,_0x515c13){return _0x5827cf[_0x2a61('0xa')](_0x2a61('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a61('0xc'),'collate':_0x2a61('0xd')});}; \ No newline at end of file +var _0xb3a2=['../../config/logger','moment','bluebird','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','util'];(function(_0x4b6da2,_0x195570){var _0x2503dc=function(_0x382e90){while(--_0x382e90){_0x4b6da2['push'](_0x4b6da2['shift']());}};_0x2503dc(++_0x195570);}(_0xb3a2,0x77));var _0x2b3a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb3a2[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0x2b3a('0x0'));var logger=require(_0x2b3a('0x1'))('api');var moment=require(_0x2b3a('0x2'));var BPromise=require(_0x2b3a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b3a('0x4'));var rimraf=require('rimraf');var config=require(_0x2b3a('0x5'));var attributes=require(_0x2b3a('0x6'));module[_0x2b3a('0x7')]=function(_0xe66051,_0x3cd48b){return _0xe66051[_0x2b3a('0x8')](_0x2b3a('0x9'),attributes,{'tableName':_0x2b3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2b3a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8cc1f30..44efdc3 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 _0xb7e9=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result'];(function(_0x33517d,_0x291343){var _0x1d0964=function(_0x52c10c){while(--_0x52c10c){_0x33517d['push'](_0x33517d['shift']());}};_0x1d0964(++_0x291343);}(_0xb7e9,0x1dd));var _0x9b7e=function(_0x5a6e7b,_0x3dabdc){_0x5a6e7b=_0x5a6e7b-0x0;var _0x5bef75=_0xb7e9[_0x5a6e7b];return _0x5bef75;};'use strict';var _=require(_0x9b7e('0x0'));var util=require(_0x9b7e('0x1'));var moment=require(_0x9b7e('0x2'));var BPromise=require(_0x9b7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b7e('0x4'));var db=require(_0x9b7e('0x5'))['db'];var utils=require(_0x9b7e('0x6'));var logger=require(_0x9b7e('0x7'))(_0x9b7e('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b7e('0x9'));var client=jayson['client'][_0x9b7e('0xa')]({'port':0x232a});config['redis']=_[_0x9b7e('0xb')](config[_0x9b7e('0xc')],{'host':_0x9b7e('0xd'),'port':0x18eb});var socket=require(_0x9b7e('0xe'))(new Redis(config[_0x9b7e('0xc')]));require(_0x9b7e('0xf'))[_0x9b7e('0x10')](socket);function respondWithRpcPromise(_0x68dc74,_0x2c5b17,_0x5ab7d9){return new BPromise(function(_0x537ae9,_0x446e04){return client[_0x9b7e('0x11')](_0x68dc74,_0x5ab7d9)['then'](function(_0x6e4388){logger[_0x9b7e('0x12')]('UserNotification,\x20%s,\x20%s',_0x2c5b17,_0x9b7e('0x13'));logger[_0x9b7e('0x14')](_0x9b7e('0x15'),_0x2c5b17,'request\x20sent',JSON['stringify'](_0x6e4388));if(_0x6e4388[_0x9b7e('0x16')]){if(_0x6e4388[_0x9b7e('0x16')][_0x9b7e('0x17')]===0x1f4){logger[_0x9b7e('0x16')](_0x9b7e('0x18'),_0x2c5b17,_0x6e4388['error'][_0x9b7e('0x19')]);return _0x446e04(_0x6e4388[_0x9b7e('0x16')]['message']);}logger[_0x9b7e('0x16')](_0x9b7e('0x18'),_0x2c5b17,_0x6e4388['error'][_0x9b7e('0x19')]);return _0x537ae9(_0x6e4388[_0x9b7e('0x16')][_0x9b7e('0x19')]);}else{logger[_0x9b7e('0x12')](_0x9b7e('0x18'),_0x2c5b17,'request\x20sent');_0x537ae9(_0x6e4388[_0x9b7e('0x1a')]['message']);}})[_0x9b7e('0x1b')](function(_0x40cb5b){logger[_0x9b7e('0x16')](_0x9b7e('0x18'),_0x2c5b17,_0x40cb5b);_0x446e04(_0x40cb5b);});});} \ No newline at end of file +var _0x5871=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e5419,_0x511dc5){var _0x5e1400=function(_0x241cdb){while(--_0x241cdb){_0x1e5419['push'](_0x1e5419['shift']());}};_0x5e1400(++_0x511dc5);}(_0x5871,0x9f));var _0x1587=function(_0x1ca13a,_0x244264){_0x1ca13a=_0x1ca13a-0x0;var _0x52728b=_0x5871[_0x1ca13a];return _0x52728b;};'use strict';var _=require(_0x1587('0x0'));var util=require(_0x1587('0x1'));var moment=require(_0x1587('0x2'));var BPromise=require(_0x1587('0x3'));var rs=require(_0x1587('0x4'));var fs=require('fs');var Redis=require(_0x1587('0x5'));var db=require(_0x1587('0x6'))['db'];var utils=require(_0x1587('0x7'));var logger=require(_0x1587('0x8'))(_0x1587('0x9'));var config=require('../../config/environment');var jayson=require(_0x1587('0xa'));var client=jayson[_0x1587('0xb')][_0x1587('0xc')]({'port':0x232a});config[_0x1587('0xd')]=_['defaults'](config[_0x1587('0xd')],{'host':_0x1587('0xe'),'port':0x18eb});var socket=require(_0x1587('0xf'))(new Redis(config[_0x1587('0xd')]));require(_0x1587('0x10'))[_0x1587('0x11')](socket);function respondWithRpcPromise(_0x2b2c18,_0x5b1e22,_0x31e60c){return new BPromise(function(_0xb14314,_0x5c037f){return client[_0x1587('0x12')](_0x2b2c18,_0x31e60c)[_0x1587('0x13')](function(_0xed6b45){logger[_0x1587('0x14')](_0x1587('0x15'),_0x5b1e22,_0x1587('0x16'));logger[_0x1587('0x17')](_0x1587('0x18'),_0x5b1e22,_0x1587('0x16'),JSON[_0x1587('0x19')](_0xed6b45));if(_0xed6b45['error']){if(_0xed6b45[_0x1587('0x1a')][_0x1587('0x1b')]===0x1f4){logger[_0x1587('0x1a')]('UserNotification,\x20%s,\x20%s',_0x5b1e22,_0xed6b45[_0x1587('0x1a')][_0x1587('0x1c')]);return _0x5c037f(_0xed6b45['error'][_0x1587('0x1c')]);}logger[_0x1587('0x1a')]('UserNotification,\x20%s,\x20%s',_0x5b1e22,_0xed6b45[_0x1587('0x1a')][_0x1587('0x1c')]);return _0xb14314(_0xed6b45[_0x1587('0x1a')][_0x1587('0x1c')]);}else{logger['info'](_0x1587('0x15'),_0x5b1e22,_0x1587('0x16'));_0xb14314(_0xed6b45[_0x1587('0x1d')][_0x1587('0x1c')]);}})[_0x1587('0x1e')](function(_0x2f627c){logger[_0x1587('0x1a')](_0x1587('0x15'),_0x5b1e22,_0x2f627c);_0x5c037f(_0x2f627c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 917a760..94b78be 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 _0xcef3=['remove','update','removeListener','length','userNotification:','./userNotification.events'];(function(_0x280820,_0xce9bc7){var _0x474787=function(_0x3d224e){while(--_0x3d224e){_0x280820['push'](_0x280820['shift']());}};_0x474787(++_0xce9bc7);}(_0xcef3,0xd7));var _0x3cef=function(_0x220ef3,_0x409fe4){_0x220ef3=_0x220ef3-0x0;var _0x4c6ab9=_0xcef3[_0x220ef3];return _0x4c6ab9;};'use strict';var UserNotificationEvents=require(_0x3cef('0x0'));var events=['save',_0x3cef('0x1'),_0x3cef('0x2')];function createListener(_0x5d0b97,_0x3c7782){return function(_0x38fa86){_0x3c7782['emit'](_0x5d0b97,_0x38fa86);};}function removeListener(_0x2d4fb6,_0x499420){return function(){UserNotificationEvents[_0x3cef('0x3')](_0x2d4fb6,_0x499420);};}exports['register']=function(_0x38c241){for(var _0x5aede7=0x0,_0x3fa124=events[_0x3cef('0x4')];_0x5aede7<_0x3fa124;_0x5aede7++){var _0x451a5d=events[_0x5aede7];var _0x4f7dad=createListener(_0x3cef('0x5')+_0x451a5d,_0x38c241);UserNotificationEvents['on'](_0x451a5d,_0x4f7dad);}}; \ No newline at end of file +var _0x9757=['emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove','update'];(function(_0x5d4684,_0x21ff2a){var _0x5b4dce=function(_0x186465){while(--_0x186465){_0x5d4684['push'](_0x5d4684['shift']());}};_0x5b4dce(++_0x21ff2a);}(_0x9757,0x95));var _0x7975=function(_0x32bcca,_0x13f0ca){_0x32bcca=_0x32bcca-0x0;var _0x5c6302=_0x9757[_0x32bcca];return _0x5c6302;};'use strict';var UserNotificationEvents=require(_0x7975('0x0'));var events=[_0x7975('0x1'),_0x7975('0x2'),_0x7975('0x3')];function createListener(_0x5484b3,_0x1ecded){return function(_0x4ef9f0){_0x1ecded[_0x7975('0x4')](_0x5484b3,_0x4ef9f0);};}function removeListener(_0x375f4a,_0x9443dc){return function(){UserNotificationEvents[_0x7975('0x5')](_0x375f4a,_0x9443dc);};}exports[_0x7975('0x6')]=function(_0xa72b8){for(var _0x3e3f80=0x0,_0x223ee0=events[_0x7975('0x7')];_0x3e3f80<_0x223ee0;_0x3e3f80++){var _0x3d37cc=events[_0x3e3f80];var _0x1d5843=createListener(_0x7975('0x8')+_0x3d37cc,_0xa72b8);UserNotificationEvents['on'](_0x3d37cc,_0x1d5843);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a2c1d42..d8302c0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1e35a9,_0x312ec6){var _0x1298af=function(_0xa497f5){while(--_0xa497f5){_0x1e35a9['push'](_0x1e35a9['shift']());}};_0x1298af(++_0x312ec6);}(_0x70e0,0x17b));var _0x070e=function(_0x1a5c7f,_0x41dcc2){_0x1a5c7f=_0x1a5c7f-0x0;var _0x2823d6=_0x70e0[_0x1a5c7f];return _0x2823d6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x266187,_0x414e08){var _0x26eb92=function(_0x4f9d36){while(--_0x4f9d36){_0x266187['push'](_0x266187['shift']());}};_0x26eb92(++_0x414e08);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 39c3944..497142a 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 _0xc986=['exports','INTEGER','sequelize'];(function(_0x179351,_0x5b98c8){var _0x429dba=function(_0x4863da){while(--_0x4863da){_0x179351['push'](_0x179351['shift']());}};_0x429dba(++_0x5b98c8);}(_0xc986,0xce));var _0x6c98=function(_0x2bfe4a,_0x56489a){_0x2bfe4a=_0x2bfe4a-0x0;var _0x4ce1ed=_0xc986[_0x2bfe4a];return _0x4ce1ed;};'use strict';var Sequelize=require(_0x6c98('0x0'));module[_0x6c98('0x1')]={'penalty':{'type':Sequelize[_0x6c98('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8107=['exports'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x8107,0x1f1));var _0x7810=function(_0x44497f,_0x528bdc){_0x44497f=_0x44497f-0x0;var _0x37a190=_0x8107[_0x44497f];return _0x37a190;};'use strict';var Sequelize=require('sequelize');module[_0x7810('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index c0a3933..fafdc4a 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 _0xf23b=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4ace4c,_0x164078){var _0x40a84e=function(_0x398ba6){while(--_0x398ba6){_0x4ace4c['push'](_0x4ace4c['shift']());}};_0x40a84e(++_0x164078);}(_0xf23b,0x19a));var _0xbf23=function(_0x52afd3,_0x318610){_0x52afd3=_0x52afd3-0x0;var _0x3c4920=_0xf23b[_0x52afd3];return _0x3c4920;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require('../../config/logger')(_0xbf23('0x2'));var moment=require(_0xbf23('0x3'));var BPromise=require(_0xbf23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf23('0x5'));var rimraf=require(_0xbf23('0x6'));var config=require(_0xbf23('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x389336,_0x237a8a){return _0x389336[_0xbf23('0x8')](_0xbf23('0x9'),attributes,{'tableName':_0xbf23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f79=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1cdabe,_0x286194){var _0x3dcc9c=function(_0x5aa9c7){while(--_0x5aa9c7){_0x1cdabe['push'](_0x1cdabe['shift']());}};_0x3dcc9c(++_0x286194);}(_0x5f79,0x14a));var _0x95f7=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x5f79[_0x1af5b2];return _0xf1aa2d;};'use strict';var _=require('lodash');var util=require(_0x95f7('0x0'));var logger=require(_0x95f7('0x1'))(_0x95f7('0x2'));var moment=require(_0x95f7('0x3'));var BPromise=require(_0x95f7('0x4'));var rp=require(_0x95f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95f7('0x6'));var config=require(_0x95f7('0x7'));var attributes=require(_0x95f7('0x8'));module[_0x95f7('0x9')]=function(_0x562af3,_0x531227){return _0x562af3[_0x95f7('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x95f7('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 ff91c22..5f74782 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 _0xd6a7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xd6a7,0x1b1));var _0x7d6a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd6a7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x7d6a('0x0'));var moment=require(_0x7d6a('0x1'));var BPromise=require(_0x7d6a('0x2'));var rs=require(_0x7d6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d6a('0x4'))['db'];var utils=require(_0x7d6a('0x5'));var logger=require(_0x7d6a('0x6'))(_0x7d6a('0x7'));var config=require(_0x7d6a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d6a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57697b,_0x62c66a,_0x4364db){return new BPromise(function(_0x32da03,_0x40d37b){return client['request'](_0x57697b,_0x4364db)['then'](function(_0x2a079a){logger['info'](_0x7d6a('0xa'),_0x62c66a,_0x7d6a('0xb'));logger[_0x7d6a('0xc')](_0x7d6a('0xd'),_0x62c66a,_0x7d6a('0xb'),JSON[_0x7d6a('0xe')](_0x2a079a));if(_0x2a079a[_0x7d6a('0xf')]){if(_0x2a079a[_0x7d6a('0xf')][_0x7d6a('0x10')]===0x1f4){logger[_0x7d6a('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x62c66a,_0x2a079a[_0x7d6a('0xf')][_0x7d6a('0x11')]);return _0x40d37b(_0x2a079a[_0x7d6a('0xf')][_0x7d6a('0x11')]);}logger['error'](_0x7d6a('0xa'),_0x62c66a,_0x2a079a[_0x7d6a('0xf')][_0x7d6a('0x11')]);return _0x32da03(_0x2a079a[_0x7d6a('0xf')][_0x7d6a('0x11')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x62c66a,_0x7d6a('0xb'));_0x32da03(_0x2a079a[_0x7d6a('0x12')][_0x7d6a('0x11')]);}})['catch'](function(_0x1af6da){logger['error'](_0x7d6a('0xa'),_0x62c66a,_0x1af6da);_0x40d37b(_0x1af6da);});});} \ No newline at end of file +var _0x4080=['catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2e0993,_0x39ac5a){var _0x3c7a28=function(_0x3e0643){while(--_0x3e0643){_0x2e0993['push'](_0x2e0993['shift']());}};_0x3c7a28(++_0x39ac5a);}(_0x4080,0x133));var _0x0408=function(_0x4b1012,_0x1415eb){_0x4b1012=_0x4b1012-0x0;var _0x23d715=_0x4080[_0x4b1012];return _0x23d715;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0408('0x0'));var rs=require(_0x0408('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0408('0x2'))['db'];var utils=require(_0x0408('0x3'));var logger=require(_0x0408('0x4'))('rpc');var config=require(_0x0408('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0408('0x6')][_0x0408('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e54cb,_0x336707,_0x239a04){return new BPromise(function(_0x509357,_0x46c9d7){return client['request'](_0x1e54cb,_0x239a04)['then'](function(_0x3d7955){logger[_0x0408('0x8')](_0x0408('0x9'),_0x336707,_0x0408('0xa'));logger['debug'](_0x0408('0xb'),_0x336707,'request\x20sent',JSON[_0x0408('0xc')](_0x3d7955));if(_0x3d7955[_0x0408('0xd')]){if(_0x3d7955[_0x0408('0xd')][_0x0408('0xe')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x336707,_0x3d7955[_0x0408('0xd')][_0x0408('0xf')]);return _0x46c9d7(_0x3d7955['error']['message']);}logger[_0x0408('0xd')](_0x0408('0x9'),_0x336707,_0x3d7955[_0x0408('0xd')][_0x0408('0xf')]);return _0x509357(_0x3d7955[_0x0408('0xd')][_0x0408('0xf')]);}else{logger[_0x0408('0x8')](_0x0408('0x9'),_0x336707,'request\x20sent');_0x509357(_0x3d7955[_0x0408('0x10')][_0x0408('0xf')]);}})[_0x0408('0x11')](function(_0x36e100){logger['error'](_0x0408('0x9'),_0x336707,_0x36e100);_0x46c9d7(_0x36e100);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0704525..4e4f238 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 _0x655d=['show','getSections','/:id/resources','getResources','post','create','/:id/clone','/:id/sections','addResources','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x5a92ad,_0x2219a6){var _0x2466f8=function(_0x4ad04e){while(--_0x4ad04e){_0x5a92ad['push'](_0x5a92ad['shift']());}};_0x2466f8(++_0x2219a6);}(_0x655d,0x13b));var _0xd655=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x655d[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var path=require(_0xd655('0x2'));var timeout=require(_0xd655('0x3'));var express=require(_0xd655('0x4'));var router=express[_0xd655('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd655('0x6'));var interaction=require(_0xd655('0x7'));var config=require('../../config/environment');var controller=require(_0xd655('0x8'));router['get']('/',auth[_0xd655('0x9')](),controller[_0xd655('0xa')]);router[_0xd655('0xb')](_0xd655('0xc'),auth[_0xd655('0x9')](),controller[_0xd655('0xd')]);router[_0xd655('0xb')](_0xd655('0xe'),auth[_0xd655('0x9')](),controller[_0xd655('0xf')]);router[_0xd655('0xb')]('/:id/sections',auth[_0xd655('0x9')](),controller[_0xd655('0x10')]);router[_0xd655('0xb')](_0xd655('0x11'),auth['isAuthenticated'](),controller[_0xd655('0x12')]);router[_0xd655('0x13')]('/',auth[_0xd655('0x9')](),controller[_0xd655('0x14')]);router[_0xd655('0x13')](_0xd655('0x15'),auth['isAuthenticated'](),controller['clone']);router['post'](_0xd655('0x16'),auth[_0xd655('0x9')](),controller['addSections']);router[_0xd655('0x13')]('/:id/resources',auth[_0xd655('0x9')](),controller[_0xd655('0x17')]);router[_0xd655('0x18')](_0xd655('0xe'),auth[_0xd655('0x9')](),controller[_0xd655('0x19')]);router[_0xd655('0x1a')]('/:id',auth[_0xd655('0x9')](),controller[_0xd655('0x1b')]);router[_0xd655('0x1a')](_0xd655('0x16'),auth[_0xd655('0x9')](),controller[_0xd655('0x1c')]);router['delete'](_0xd655('0x11'),auth[_0xd655('0x9')](),controller['removeResources']);module[_0xd655('0x1d')]=router; \ No newline at end of file +var _0x1ff9=['isAuthenticated','index','describe','/:id','show','getSections','/:id/resources','getResources','create','post','/:id/clone','/:id/sections','put','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get'];(function(_0x17b9e9,_0x3deffc){var _0x276627=function(_0x49be87){while(--_0x49be87){_0x17b9e9['push'](_0x17b9e9['shift']());}};_0x276627(++_0x3deffc);}(_0x1ff9,0x81));var _0x91ff=function(_0x481015,_0x5b3e2e){_0x481015=_0x481015-0x0;var _0x24a6c5=_0x1ff9[_0x481015];return _0x24a6c5;};'use strict';var multer=require(_0x91ff('0x0'));var util=require(_0x91ff('0x1'));var path=require(_0x91ff('0x2'));var timeout=require(_0x91ff('0x3'));var express=require(_0x91ff('0x4'));var router=express[_0x91ff('0x5')]();var fs_extra=require(_0x91ff('0x6'));var auth=require(_0x91ff('0x7'));var interaction=require(_0x91ff('0x8'));var config=require('../../config/environment');var controller=require(_0x91ff('0x9'));router[_0x91ff('0xa')]('/',auth[_0x91ff('0xb')](),controller[_0x91ff('0xc')]);router['get']('/describe',auth[_0x91ff('0xb')](),controller[_0x91ff('0xd')]);router[_0x91ff('0xa')](_0x91ff('0xe'),auth['isAuthenticated'](),controller[_0x91ff('0xf')]);router[_0x91ff('0xa')]('/:id/sections',auth[_0x91ff('0xb')](),controller[_0x91ff('0x10')]);router[_0x91ff('0xa')](_0x91ff('0x11'),auth[_0x91ff('0xb')](),controller[_0x91ff('0x12')]);router['post']('/',auth[_0x91ff('0xb')](),controller[_0x91ff('0x13')]);router[_0x91ff('0x14')](_0x91ff('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0x91ff('0x14')](_0x91ff('0x16'),auth['isAuthenticated'](),controller['addSections']);router[_0x91ff('0x14')](_0x91ff('0x11'),auth[_0x91ff('0xb')](),controller['addResources']);router[_0x91ff('0x17')](_0x91ff('0xe'),auth[_0x91ff('0xb')](),controller['update']);router[_0x91ff('0x18')](_0x91ff('0xe'),auth[_0x91ff('0xb')](),controller[_0x91ff('0x19')]);router[_0x91ff('0x18')](_0x91ff('0x16'),auth[_0x91ff('0xb')](),controller[_0x91ff('0x1a')]);router[_0x91ff('0x18')]('/:id/resources',auth[_0x91ff('0xb')](),controller['removeResources']);module[_0x91ff('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 941136e..8788157 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 _0x6e5e=['split','BOOLEAN','sequelize','exports','setDataValue','crudPermissions','join','getDataValue'];(function(_0x1195f4,_0x1750d1){var _0x400a33=function(_0x1fd0ed){while(--_0x1fd0ed){_0x1195f4['push'](_0x1195f4['shift']());}};_0x400a33(++_0x1750d1);}(_0x6e5e,0xca));var _0xe6e5=function(_0x5ee4f4,_0x58b6a3){_0x5ee4f4=_0x5ee4f4-0x0;var _0x18b866=_0x6e5e[_0x5ee4f4];return _0x18b866;};'use strict';var Sequelize=require(_0xe6e5('0x0'));module[_0xe6e5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5797bf){this[_0xe6e5('0x2')](_0xe6e5('0x3'),_0x5797bf?_0x5797bf[_0xe6e5('0x4')](''):[]);},'get':function(){return this[_0xe6e5('0x5')](_0xe6e5('0x3'))?this['getDataValue']('crudPermissions')[_0xe6e5('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe6e5('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x787c=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','crudPermissions'];(function(_0x3b9149,_0x2f93ab){var _0x2067f4=function(_0x5a78ce){while(--_0x5a78ce){_0x3b9149['push'](_0x3b9149['shift']());}};_0x2067f4(++_0x2f93ab);}(_0x787c,0x6b));var _0xc787=function(_0x17ea08,_0x2fe2fc){_0x17ea08=_0x17ea08-0x0;var _0x1dc85c=_0x787c[_0x17ea08];return _0x1dc85c;};'use strict';var Sequelize=require(_0xc787('0x0'));module[_0xc787('0x1')]={'name':{'type':Sequelize[_0xc787('0x2')],'allowNull':![],'unique':_0xc787('0x3')},'crudPermissions':{'type':Sequelize[_0xc787('0x2')],'set':function(_0x184cae){this['setDataValue'](_0xc787('0x4'),_0x184cae?_0x184cae['join'](''):[]);},'get':function(){return this[_0xc787('0x5')]('crudPermissions')?this[_0xc787('0x5')](_0xc787('0x4'))[_0xc787('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc787('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc787('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc787('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc787('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc787('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc787('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc787('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc787('0x7')],'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 e4072af..ff6c1a0 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 _0x0fcf=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','Resources','update','describe','userProfileId','push','removeSections','ids','enabled','includes','isEmpty','subsections','concat','autoAssociation','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3b8d0f,_0x8545c0){var _0xc167c0=function(_0x8da2c5){while(--_0x8da2c5){_0x3b8d0f['push'](_0x3b8d0f['shift']());}};_0xc167c0(++_0x8545c0);}(_0x0fcf,0xdb));var _0xf0fc=function(_0x20151a,_0x165aee){_0x20151a=_0x20151a-0x0;var _0x174b1e=_0x0fcf[_0x20151a];return _0x174b1e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0fc('0x0'));var jsonpatch=require(_0xf0fc('0x1'));var rp=require(_0xf0fc('0x2'));var moment=require(_0xf0fc('0x3'));var BPromise=require(_0xf0fc('0x4'));var Mustache=require('mustache');var util=require(_0xf0fc('0x5'));var path=require(_0xf0fc('0x6'));var sox=require(_0xf0fc('0x7'));var csv=require('to-csv');var ejs=require(_0xf0fc('0x8'));var fs=require('fs');var fs_extra=require(_0xf0fc('0x9'));var _=require(_0xf0fc('0xa'));var squel=require(_0xf0fc('0xb'));var crypto=require(_0xf0fc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf0fc('0xd'));var toCsv=require(_0xf0fc('0xe'));var querystring=require(_0xf0fc('0xf'));var Papa=require(_0xf0fc('0x10'));var Redis=require(_0xf0fc('0x11'));var authService=require(_0xf0fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf0fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0fc('0x14'))(_0xf0fc('0x15'));var utils=require(_0xf0fc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf0fc('0x17'));var db=require(_0xf0fc('0x18'))['db'];config[_0xf0fc('0x19')]=_[_0xf0fc('0x1a')](config['redis'],{'host':_0xf0fc('0x1b'),'port':0x18eb});var socket=require(_0xf0fc('0x1c'))(new Redis(config[_0xf0fc('0x19')]));require(_0xf0fc('0x1d'))[_0xf0fc('0x1e')](socket);function respondWithStatusCode(_0x955f62,_0x30f671){_0x30f671=_0x30f671||0xcc;return function(_0x222a9a){if(_0x222a9a){return _0x955f62[_0xf0fc('0x1f')](_0x30f671);}return _0x955f62[_0xf0fc('0x20')](_0x30f671)[_0xf0fc('0x21')]();};}function respondWithResult(_0x564f4d,_0x167d6c){_0x167d6c=_0x167d6c||0xc8;return function(_0x3170ad){if(_0x3170ad){return _0x564f4d[_0xf0fc('0x20')](_0x167d6c)[_0xf0fc('0x22')](_0x3170ad);}};}function respondWithFilteredResult(_0x5871bb,_0x42501d){return function(_0xb462c){if(_0xb462c){var _0x5bd474=typeof _0x42501d[_0xf0fc('0x23')]===_0xf0fc('0x24')&&typeof _0x42501d[_0xf0fc('0x25')]===_0xf0fc('0x24');var _0x55dc6c=_0xb462c['count'];var _0x33dd25=_0x5bd474?0x0:_0x42501d['offset'];var _0x2e98b9=_0x5bd474?_0xb462c['count']:_0x42501d[_0xf0fc('0x23')]+_0x42501d[_0xf0fc('0x25')];var _0x9f559a;if(_0x2e98b9>=_0x55dc6c){_0x2e98b9=_0x55dc6c;_0x9f559a=0xc8;}else{_0x9f559a=0xce;}_0x5871bb['status'](_0x9f559a);return _0x5871bb[_0xf0fc('0x26')]('Content-Range',_0x33dd25+'-'+_0x2e98b9+'/'+_0x55dc6c)[_0xf0fc('0x22')](_0xb462c);}return null;};}function patchUpdates(_0x340e77){return function(_0x114f41){try{jsonpatch['apply'](_0x114f41,_0x340e77,!![]);}catch(_0x1939d7){return BPromise[_0xf0fc('0x27')](_0x1939d7);}return _0x114f41[_0xf0fc('0x28')]();};}function saveUpdates(_0x31feae,_0x2fadfb){return function(_0x1549d6){if(_0x1549d6){return _0x1549d6['update'](_0x31feae)[_0xf0fc('0x29')](function(_0x2d1508){return _0x2d1508;});}return null;};}function removeEntity(_0x5b6bdb,_0x5a6ffb){return function(_0x2bfaf9){if(_0x2bfaf9){return _0x2bfaf9[_0xf0fc('0x2a')]()['then'](function(){_0x5b6bdb['status'](0xcc)[_0xf0fc('0x21')]();});}};}function handleEntityNotFound(_0x18485c,_0x189bd4){return function(_0x5a2465){if(!_0x5a2465){_0x18485c[_0xf0fc('0x1f')](0x194);}return _0x5a2465;};}function handleError(_0x58bacc,_0x129ca5){_0x129ca5=_0x129ca5||0x1f4;return function(_0x4489f9){logger[_0xf0fc('0x2b')](_0x4489f9[_0xf0fc('0x2c')]);if(_0x4489f9[_0xf0fc('0x2d')]){delete _0x4489f9[_0xf0fc('0x2d')];}_0x58bacc[_0xf0fc('0x20')](_0x129ca5)[_0xf0fc('0x2e')](_0x4489f9);};}exports[_0xf0fc('0x2f')]=function(_0x232fe4,_0x23434e){var _0x224df4={},_0x2d46d3={},_0x39f1cf={'count':0x0,'rows':[]};var _0x5e0005=_[_0xf0fc('0x30')](db[_0xf0fc('0x31')][_0xf0fc('0x32')],function(_0x6afd5a){return{'name':_0x6afd5a['fieldName'],'type':_0x6afd5a[_0xf0fc('0x33')][_0xf0fc('0x34')]};});_0x2d46d3[_0xf0fc('0x35')]=_['map'](_0x5e0005,_0xf0fc('0x2d'));_0x2d46d3['query']=_[_0xf0fc('0x36')](_0x232fe4['query']);_0x2d46d3[_0xf0fc('0x37')]=_[_0xf0fc('0x38')](_0x2d46d3[_0xf0fc('0x35')],_0x2d46d3[_0xf0fc('0x39')]);_0x224df4[_0xf0fc('0x3a')]=_[_0xf0fc('0x38')](_0x2d46d3['model'],qs[_0xf0fc('0x3b')](_0x232fe4[_0xf0fc('0x39')][_0xf0fc('0x3b')]));_0x224df4[_0xf0fc('0x3a')]=_0x224df4[_0xf0fc('0x3a')][_0xf0fc('0x3c')]?_0x224df4['attributes']:_0x2d46d3[_0xf0fc('0x35')];if(!_0x232fe4[_0xf0fc('0x39')][_0xf0fc('0x3d')](_0xf0fc('0x3e'))){_0x224df4[_0xf0fc('0x25')]=qs[_0xf0fc('0x25')](_0x232fe4[_0xf0fc('0x39')]['limit']);_0x224df4[_0xf0fc('0x23')]=qs[_0xf0fc('0x23')](_0x232fe4['query']['offset']);}_0x224df4['order']=qs['sort'](_0x232fe4[_0xf0fc('0x39')][_0xf0fc('0x3f')]);_0x224df4[_0xf0fc('0x40')]=qs['filters'](_[_0xf0fc('0x41')](_0x232fe4[_0xf0fc('0x39')],_0x2d46d3['filters']),_0x5e0005);if(_0x232fe4[_0xf0fc('0x39')][_0xf0fc('0x42')]){_0x224df4[_0xf0fc('0x40')]=_[_0xf0fc('0x43')](_0x224df4[_0xf0fc('0x40')],{'$or':_[_0xf0fc('0x30')](_0x5e0005,function(_0x1b870d){if(_0x1b870d[_0xf0fc('0x33')]!==_0xf0fc('0x44')){var _0x80cb2c={};_0x80cb2c[_0x1b870d['name']]={'$like':'%'+_0x232fe4[_0xf0fc('0x39')][_0xf0fc('0x42')]+'%'};return _0x80cb2c;}})});}_0x224df4=_[_0xf0fc('0x43')]({},_0x224df4,_0x232fe4[_0xf0fc('0x45')]);var _0xffd5bf={'where':_0x224df4[_0xf0fc('0x40')]};return db['UserProfile'][_0xf0fc('0x46')](_0xffd5bf)[_0xf0fc('0x29')](function(_0x5c2beb){_0x39f1cf[_0xf0fc('0x46')]=_0x5c2beb;if(_0x232fe4['query'][_0xf0fc('0x47')]){_0x224df4[_0xf0fc('0x48')]=[{'all':!![]}];}return db['UserProfile'][_0xf0fc('0x49')](_0x224df4);})[_0xf0fc('0x29')](function(_0xeaa1d4){_0x39f1cf[_0xf0fc('0x4a')]=_0xeaa1d4;return _0x39f1cf;})[_0xf0fc('0x29')](respondWithFilteredResult(_0x23434e,_0x224df4))['catch'](handleError(_0x23434e,null));};exports[_0xf0fc('0x4b')]=function(_0x418798,_0x32d8cf){var _0x1ad8ee={'raw':![],'where':{'id':_0x418798[_0xf0fc('0x4c')]['id']}},_0x5f291c={};_0x5f291c[_0xf0fc('0x35')]=_['keys'](db[_0xf0fc('0x31')][_0xf0fc('0x32')]);_0x5f291c[_0xf0fc('0x39')]=_[_0xf0fc('0x36')](_0x418798[_0xf0fc('0x39')]);_0x5f291c[_0xf0fc('0x37')]=_[_0xf0fc('0x38')](_0x5f291c[_0xf0fc('0x35')],_0x5f291c['query']);_0x1ad8ee[_0xf0fc('0x3a')]=_[_0xf0fc('0x38')](_0x5f291c[_0xf0fc('0x35')],qs['fields'](_0x418798[_0xf0fc('0x39')][_0xf0fc('0x3b')]));_0x1ad8ee[_0xf0fc('0x3a')]=_0x1ad8ee[_0xf0fc('0x3a')][_0xf0fc('0x3c')]?_0x1ad8ee[_0xf0fc('0x3a')]:_0x5f291c[_0xf0fc('0x35')];if(_0x418798[_0xf0fc('0x39')]['includeAll']){_0x1ad8ee[_0xf0fc('0x48')]=[{'all':!![]}];}_0x1ad8ee=_[_0xf0fc('0x43')]({},_0x1ad8ee,_0x418798[_0xf0fc('0x45')]);return db[_0xf0fc('0x31')]['find'](_0x1ad8ee)[_0xf0fc('0x29')](handleEntityNotFound(_0x32d8cf,null))['then'](respondWithResult(_0x32d8cf,null))[_0xf0fc('0x4d')](handleError(_0x32d8cf,null));};exports[_0xf0fc('0x4e')]=function(_0x1367f1,_0x433ee6){return db[_0xf0fc('0x31')][_0xf0fc('0x4e')](_0x1367f1[_0xf0fc('0x4f')],{})['then'](respondWithResult(_0x433ee6,0xc9))[_0xf0fc('0x4d')](handleError(_0x433ee6,null));};exports[_0xf0fc('0x50')]=function(_0x5341ad,_0x140597){var _0x1f24f9={'where':{'id':_0x5341ad[_0xf0fc('0x4c')]['id']}},_0x1125d2={};_0x1125d2['model']=_['keys'](db[_0xf0fc('0x31')][_0xf0fc('0x32')]);_0x1f24f9[_0xf0fc('0x3a')]=_['intersection'](_0x1125d2['model'],qs[_0xf0fc('0x3b')](_0x5341ad[_0xf0fc('0x39')][_0xf0fc('0x3b')]));_0x1f24f9[_0xf0fc('0x3a')]=_0x1f24f9[_0xf0fc('0x3a')]['length']?_0x1f24f9[_0xf0fc('0x3a')]:_0x1125d2['model'];if(_0x5341ad['query'][_0xf0fc('0x47')]){_0x1f24f9[_0xf0fc('0x48')]=[{'all':!![]}];}_0x1f24f9=_[_0xf0fc('0x43')]({},_0x1f24f9,_0x5341ad[_0xf0fc('0x45')]);return db['UserProfile'][_0xf0fc('0x51')](_0x1f24f9)[_0xf0fc('0x29')](handleEntityNotFound(_0x140597,null))[_0xf0fc('0x29')](function(_0x16c4dc){if(_0x16c4dc){var _0x3c3600=_0x16c4dc[_0xf0fc('0x52')]({'plain':!![]});_0x3c3600=qs[_0xf0fc('0x53')](_0x3c3600,['id',_0xf0fc('0x54'),_0xf0fc('0x55'),_0xf0fc('0x56')]);_0x5341ad[_0xf0fc('0x4f')]=_['omit'](_0x5341ad[_0xf0fc('0x4f')],['id',_0xf0fc('0x54'),_0xf0fc('0x55')]);return db[_0xf0fc('0x57')][_0xf0fc('0x58')](function(_0x306c19){return db[_0xf0fc('0x31')][_0xf0fc('0x4e')](_['merge'](_0x3c3600,_0x5341ad[_0xf0fc('0x4f')]),{'include':_0x5341ad['query'][_0xf0fc('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x306c19})[_0xf0fc('0x29')](function(_0x1f7566){var _0x48c11a=_0x1f7566['get']({'plain':!![]});return db[_0xf0fc('0x59')][_0xf0fc('0x49')]({'where':{'userProfileId':_0x5341ad[_0xf0fc('0x4c')]['id']},'raw':!![]})['then'](function(_0x17bd28){if(_0x17bd28){return BPromise[_0xf0fc('0x5a')](_0x17bd28,function(_0x3be9d7){return new BPromise(function(_0x8316a8,_0x3c4d09){if(_0x3be9d7['autoAssociation']===null||_0x3be9d7['autoAssociation']===0x1)_0x8316a8(null);return db[_0xf0fc('0x5b')]['findAll']({'where':{'sectionId':_0x3be9d7['id']},'raw':!![]})[_0xf0fc('0x29')](function(_0x166935){var _0x5a0b5e=_[_0xf0fc('0x30')](_0x166935,function(_0x494b85){return qs[_0xf0fc('0x53')](_0x494b85,['id','createdAt','updatedAt',_0xf0fc('0x5c')]);});_0x8316a8(_0x5a0b5e);})[_0xf0fc('0x4d')](function(_0x1f5985){_0x3c4d09(_0x1f5985);});})[_0xf0fc('0x29')](function(_0x9cd7f0){var _0x2aab21=qs[_0xf0fc('0x53')](_0x3be9d7,['id',_0xf0fc('0x54'),_0xf0fc('0x55')]);_0x2aab21['userProfileId']=_0x48c11a['id'];if(_0x9cd7f0)_0x2aab21['Resources']=_0x9cd7f0;return _0x2aab21;})['then'](function(_0x1f78d8){return db[_0xf0fc('0x59')]['create'](_0x1f78d8,{'include':[{'model':db[_0xf0fc('0x5b')],'as':_0xf0fc('0x5d')}],'raw':!![],'transaction':_0x306c19});});})[_0xf0fc('0x29')](function(){return _0x48c11a;});}});});});}})[_0xf0fc('0x29')](respondWithResult(_0x140597,0xc9))['catch'](handleError(_0x140597,null));};exports[_0xf0fc('0x5e')]=function(_0xa951c3,_0x42a96f){if(_0xa951c3[_0xf0fc('0x4f')]['id']){delete _0xa951c3[_0xf0fc('0x4f')]['id'];}return db[_0xf0fc('0x31')][_0xf0fc('0x51')]({'where':{'id':_0xa951c3[_0xf0fc('0x4c')]['id']}})[_0xf0fc('0x29')](handleEntityNotFound(_0x42a96f,null))['then'](saveUpdates(_0xa951c3[_0xf0fc('0x4f')],null))['then'](respondWithResult(_0x42a96f,null))[_0xf0fc('0x4d')](handleError(_0x42a96f,null));};exports[_0xf0fc('0x2a')]=function(_0xbbad,_0x4821e1){return db[_0xf0fc('0x31')]['find']({'where':{'id':_0xbbad[_0xf0fc('0x4c')]['id']}})[_0xf0fc('0x29')](handleEntityNotFound(_0x4821e1,null))['then'](removeEntity(_0x4821e1,null))[_0xf0fc('0x4d')](handleError(_0x4821e1,null));};exports['describe']=function(_0x2d42a4,_0x4a21bf){return db[_0xf0fc('0x31')][_0xf0fc('0x5f')]()[_0xf0fc('0x29')](respondWithResult(_0x4a21bf,null))['catch'](handleError(_0x4a21bf,null));};exports['addSections']=function(_0x461f13,_0x4f35ec){var _0x21e5ed=_0x461f13['body'];return db[_0xf0fc('0x31')][_0xf0fc('0x51')]({'where':{'id':_0x461f13[_0xf0fc('0x4c')]['id']}})[_0xf0fc('0x29')](handleEntityNotFound(_0x4f35ec,null))[_0xf0fc('0x29')](function(_0x171197){if(_0x171197){return db[_0xf0fc('0x57')][_0xf0fc('0x58')](function(_0x39c6bd){return db['UserProfileSection'][_0xf0fc('0x2a')]({'where':{'userProfileId':_0x461f13[_0xf0fc('0x4c')]['id'],'sectionId':_['map'](_0x21e5ed,function(_0x5a5690){return _0x5a5690['sectionId'];})},'transaction':_0x39c6bd})[_0xf0fc('0x29')](function(){var _0x370254=_[_0xf0fc('0x30')](_0x21e5ed,function(_0x1992e7){_0x1992e7[_0xf0fc('0x60')]=_0x461f13[_0xf0fc('0x4c')]['id'];return _0x1992e7;});var _0x506832=[];return BPromise['each'](_0x370254,function(_0x168653){return db[_0xf0fc('0x59')][_0xf0fc('0x4e')](_0x168653,{'include':[{'model':db['UserProfileResource'],'as':_0xf0fc('0x5d')}],'raw':!![],'transaction':_0x39c6bd})[_0xf0fc('0x29')](function(_0x40dc89){_0x506832[_0xf0fc('0x61')](_0x40dc89[_0xf0fc('0x52')]({'plain':!![]}));});})[_0xf0fc('0x29')](function(){return _0x506832;});});});}})[_0xf0fc('0x29')](function(_0x5cafb8){return _0x5cafb8;})[_0xf0fc('0x29')](respondWithResult(_0x4f35ec,null))[_0xf0fc('0x4d')](handleError(_0x4f35ec,null));};exports[_0xf0fc('0x62')]=function(_0x50da94,_0x34495a){var _0x5c8fe7;return db[_0xf0fc('0x31')][_0xf0fc('0x51')]({'where':{'id':_0x50da94['params']['id']},'attributes':['id','name']})[_0xf0fc('0x29')](handleEntityNotFound(_0x34495a,null))[_0xf0fc('0x29')](function(_0x5bce9e){if(_0x5bce9e){_0x5c8fe7=_0x5bce9e;return db['UserProfileSection'][_0xf0fc('0x2a')]({'where':{'userProfileId':_0x50da94[_0xf0fc('0x4c')]['id'],'sectionId':_0x50da94[_0xf0fc('0x39')][_0xf0fc('0x63')]}});}})['then'](function(){return _0x5c8fe7;})[_0xf0fc('0x29')](respondWithStatusCode(_0x34495a,null))[_0xf0fc('0x4d')](handleError(_0x34495a,null));};exports['getSections']=function(_0x3edd4e,_0x41ae74){var _0x253be4=[];var _0x1503a5=[];return db[_0xf0fc('0x59')]['findAll']({'where':{'userProfileId':_0x3edd4e[_0xf0fc('0x4c')]['id']},'raw':!![]})['then'](function(_0x1fe929){_0x253be4=_[_0xf0fc('0x42')](_0x1fe929,function(_0x3091aa){return _0x3091aa[_0xf0fc('0x64')]===0x1||_[_0xf0fc('0x65')]([0x3eb,0x709],_0x3091aa[_0xf0fc('0x5c')]);});if(!_[_0xf0fc('0x66')](_0x253be4)){return _[_0xf0fc('0x30')](_0x253be4,function(_0x52d44f){return _0x52d44f['sectionId'];});}else{return;}})[_0xf0fc('0x29')](function(_0x3e0bd6){if(_0x3e0bd6)_0x1503a5=_0x3e0bd6;if(_[_0xf0fc('0x65')](_0x1503a5,0x64)){var _0x51d964=_['find'](_0x253be4,{'sectionId':0x64});return hasDefaultDashboard(_0x51d964)[_0xf0fc('0x29')](function(_0x45e92a){return _[_0xf0fc('0x30')](_0x253be4,function(_0xb803d5){if(_0xb803d5[_0xf0fc('0x5c')]===0x64){_0xb803d5[_0xf0fc('0x67')]=_0x45e92a;}return _0xb803d5;});});}else{return;}})['then'](function(_0x41ba76){if(_0x41ba76)_0x253be4=_0x41ba76;if(_[_0xf0fc('0x65')](_0x1503a5,0x3eb)){var _0x473afb=_['find'](_0x253be4,{'sectionId':0x3eb});return getCustomDashboards(_0x473afb)[_0xf0fc('0x29')](function(_0x4938d3){return _[_0xf0fc('0x30')](_0x253be4,function(_0x156bac){if(_0x473afb['enabled']){if(_0x156bac[_0xf0fc('0x5c')]===0x3eb){_0x156bac[_0xf0fc('0x67')]=_0x4938d3;}}else{if(_0x156bac[_0xf0fc('0x5c')]===0x64){if(!_0x156bac['subsections']){_0x156bac[_0xf0fc('0x67')]=[];}_0x156bac[_0xf0fc('0x67')]=_0x156bac['subsections'][_0xf0fc('0x68')](_0x4938d3);}}return _0x156bac;});});}else{return;}})[_0xf0fc('0x29')](function(_0x516110){if(_0x516110)_0x253be4=_0x516110;if(_[_0xf0fc('0x65')](_0x1503a5,0x709)){var _0x2e1802=_[_0xf0fc('0x51')](_0x253be4,{'sectionId':0x709});return getPlugins(_0x2e1802)[_0xf0fc('0x29')](function(_0x51a82c){if(_0x2e1802[_0xf0fc('0x64')]){return _['map'](_0x253be4,function(_0x1eae9d){if(_0x1eae9d[_0xf0fc('0x5c')]===0x709){_0x1eae9d[_0xf0fc('0x67')]=_0x51a82c;}return _0x1eae9d;});}else{var _0xe95e4b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x51a82c};var _0x8b7fdf=_[_0xf0fc('0x30')](_0x253be4);_0x8b7fdf[_0xf0fc('0x61')](_0xe95e4b);return _0x8b7fdf;}});}else{return;}})[_0xf0fc('0x29')](function(_0x347944){if(_0x347944)_0x253be4=_0x347944;return _['filter'](_0x253be4,[_0xf0fc('0x64'),0x1]);})[_0xf0fc('0x29')](respondWithResult(_0x41ae74,null))[_0xf0fc('0x4d')](handleError(_0x41ae74,null));};function hasDefaultDashboard(_0x2b833f){var _0x31ca7c=[0x65];return new BPromise(function(_0x57472d,_0x23ef1f){try{if(_0x2b833f['autoAssociation']){_0x57472d(_0x31ca7c);}else{return db[_0xf0fc('0x5b')]['findOne']({'where':{'sectionId':_0x2b833f['id']},'raw':!![]})[_0xf0fc('0x29')](function(_0x286474){_0x286474?_0x57472d(_0x31ca7c):_0x57472d();});}}catch(_0x2879e1){_0x23ef1f(_0x2879e1);}});}function getCustomDashboards(_0x54288e){var _0x1ce4e1=[];return new BPromise(function(_0x49b3da,_0x2ae10c){try{if(_0x54288e[_0xf0fc('0x69')]){return db[_0xf0fc('0x6a')][_0xf0fc('0x49')]({'raw':!![]})['then'](function(_0xe1010f){_0xe1010f['forEach'](function(_0xd684d){_0x1ce4e1[_0xf0fc('0x61')](_0xd684d['id']+0x1869f);});_0x49b3da(_0x1ce4e1);});}else{return db[_0xf0fc('0x5b')]['findAll']({'where':{'sectionId':_0x54288e['id']},'raw':!![]})[_0xf0fc('0x29')](function(_0x57b088){_0x57b088[_0xf0fc('0x6b')](function(_0x5c8e56){_0x1ce4e1['push'](_0x5c8e56['resourceId']+0x1869f);});_0x49b3da(_0x1ce4e1);});}}catch(_0x1dbe52){_0x2ae10c(_0x1dbe52);}});}function getPlugins(_0x2cf611){var _0x2e5aa1=[];return new BPromise(function(_0x51ea73,_0x270661){try{if(_0x2cf611[_0xf0fc('0x69')]){return db[_0xf0fc('0x6c')]['findAll']({'raw':!![]})['then'](function(_0x53c936){_0x53c936[_0xf0fc('0x6b')](function(_0x1290b8){_0x2e5aa1[_0xf0fc('0x61')](_0x1290b8['id']+0x15b38);});_0x51ea73(_0x2e5aa1);});}else{return db[_0xf0fc('0x5b')][_0xf0fc('0x49')]({'where':{'sectionId':_0x2cf611['id']},'raw':!![]})[_0xf0fc('0x29')](function(_0x55c118){_0x55c118[_0xf0fc('0x6b')](function(_0xe01592){_0x2e5aa1[_0xf0fc('0x61')](_0xe01592[_0xf0fc('0x6d')]+0x15b38);});_0x51ea73(_0x2e5aa1);});}}catch(_0x52ec20){_0x270661(_0x52ec20);}});}exports['addResources']=function(_0x551138,_0x5e625d){return db[_0xf0fc('0x31')][_0xf0fc('0x51')]({'where':{'id':_0x551138['params']['id']}})['then'](handleEntityNotFound(_0x5e625d,null))[_0xf0fc('0x29')](function(_0x5f27d2){if(_0x5f27d2){return db[_0xf0fc('0x57')][_0xf0fc('0x58')](function(_0x2038c8){return db[_0xf0fc('0x59')][_0xf0fc('0x49')]({'where':{'userProfileId':_0x551138[_0xf0fc('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x10be82){if(_0x10be82){return db[_0xf0fc('0x59')][_0xf0fc('0x2a')]({'where':{'userProfileId':_0x551138[_0xf0fc('0x4c')]['id'],'id':_[_0xf0fc('0x30')](_0x10be82,function(_0x2532eb){return _0x2532eb['id'];})},'transaction':_0x2038c8});}})[_0xf0fc('0x29')](function(_0x181ec9){var _0x3a9921=_['map'](_0x551138[_0xf0fc('0x4f')],function(_0x4a6c51){_0x4a6c51[_0xf0fc('0x60')]=_0x551138['params']['id'];return _0x4a6c51;});return db['UserProfileSection'][_0xf0fc('0x6e')](_0x3a9921,{'raw':!![],'transaction':_0x2038c8});})[_0xf0fc('0x29')](function(_0x3debfb){var _0x2e2265=_[_0xf0fc('0x42')](_[_0xf0fc('0x30')](_0x3debfb,function(_0x26bab6){return _0x26bab6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2e2265){return db[_0xf0fc('0x59')][_0xf0fc('0x49')]({'where':{'userProfileId':_0x551138['params']['id'],'sectionId':_[_0xf0fc('0x30')](_0x2e2265,function(_0x6ed236){return _0x6ed236['sectionId'];})},'attributes':['id',_0xf0fc('0x5c')],'raw':!![]})['then'](function(_0x40e302){var _0x21273c=_[_0xf0fc('0x30')](_0x551138[_0xf0fc('0x4f')],function(_0x1dcc3b){_0x1dcc3b[_0xf0fc('0x60')]=_0x551138['params']['id'];return _0x1dcc3b;});return db[_0xf0fc('0x5b')]['bulkCreate'](_0x21273c,{'raw':!![],'transaction':_0x2038c8});});}})[_0xf0fc('0x4d')](handleError(_0x5e625d,null));});}})[_0xf0fc('0x29')](function(_0x177558){var _0x2a526c=_[_0xf0fc('0x30')](_0x177558,function(_0x38ca73){return _0x38ca73[_0xf0fc('0x52')]({'plain':!![]});});})[_0xf0fc('0x29')](respondWithResult(_0x5e625d,null))['catch'](handleError(_0x5e625d,null));};exports[_0xf0fc('0x6f')]=function(_0x2104c9,_0x1fbd7f,_0x4d5dd1){return db[_0xf0fc('0x31')]['find']({'where':{'id':_0x2104c9[_0xf0fc('0x4c')]['id']}})[_0xf0fc('0x29')](handleEntityNotFound(_0x1fbd7f,null))[_0xf0fc('0x29')](function(_0x1f76fe){if(_0x1f76fe){return _0x1f76fe['removeResources'](_0x2104c9[_0xf0fc('0x39')][_0xf0fc('0x63')]);}})[_0xf0fc('0x29')](respondWithStatusCode(_0x1fbd7f,null))[_0xf0fc('0x4d')](handleError(_0x1fbd7f,null));};exports[_0xf0fc('0x70')]=function(_0x300937,_0x1c6897){var _0x37931e={};if(!_0x300937[_0xf0fc('0x39')][_0xf0fc('0x71')])throw new Error(_0xf0fc('0x72'));if(!_0x300937[_0xf0fc('0x39')][_0xf0fc('0x3d')](_0xf0fc('0x3e'))){_0x37931e[_0xf0fc('0x25')]=qs['limit'](_0x300937[_0xf0fc('0x39')]['limit']);_0x37931e[_0xf0fc('0x23')]=qs[_0xf0fc('0x23')](_0x300937[_0xf0fc('0x39')]['offset']);}return db['UserProfile']['find']({'where':{'id':_0x300937['params']['id']}})[_0xf0fc('0x29')](function(_0x1c9c39){if(!_0x1c9c39)throw new Error(_0xf0fc('0x73')+_0x300937[_0xf0fc('0x4c')]['id']);return db[_0xf0fc('0x31')]['getResources'](_0x300937);})[_0xf0fc('0x29')](respondWithFilteredResult(_0x1c6897,_0x37931e))[_0xf0fc('0x4d')](handleError(_0x1c6897,null));}; \ No newline at end of file +var _0x560e=['redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','UserProfile','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','clone','length','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','describe','push','removeSections','ids','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2d633a,_0x26ca68){var _0x116160=function(_0x3305f2){while(--_0x3305f2){_0x2d633a['push'](_0x2d633a['shift']());}};_0x116160(++_0x26ca68);}(_0x560e,0x1cc));var _0xe560=function(_0x2e607e,_0xf29383){_0x2e607e=_0x2e607e-0x0;var _0x379353=_0x560e[_0x2e607e];return _0x379353;};'use strict';var emlformat=require(_0xe560('0x0'));var rimraf=require(_0xe560('0x1'));var zipdir=require(_0xe560('0x2'));var jsonpatch=require(_0xe560('0x3'));var rp=require(_0xe560('0x4'));var moment=require(_0xe560('0x5'));var BPromise=require(_0xe560('0x6'));var Mustache=require(_0xe560('0x7'));var util=require(_0xe560('0x8'));var path=require('path');var sox=require(_0xe560('0x9'));var csv=require(_0xe560('0xa'));var ejs=require(_0xe560('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe560('0xc'));var squel=require(_0xe560('0xd'));var crypto=require('crypto');var jsforce=require(_0xe560('0xe'));var deskjs=require(_0xe560('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe560('0x10'));var Papa=require(_0xe560('0x11'));var Redis=require(_0xe560('0x12'));var authService=require(_0xe560('0x13'));var qs=require(_0xe560('0x14'));var as=require(_0xe560('0x15'));var hardwareService=require(_0xe560('0x16'));var logger=require(_0xe560('0x17'))(_0xe560('0x18'));var utils=require(_0xe560('0x19'));var config=require(_0xe560('0x1a'));var licenseUtil=require(_0xe560('0x1b'));var db=require('../../mysqldb')['db'];config[_0xe560('0x1c')]=_[_0xe560('0x1d')](config[_0xe560('0x1c')],{'host':_0xe560('0x1e'),'port':0x18eb});var socket=require(_0xe560('0x1f'))(new Redis(config[_0xe560('0x1c')]));require(_0xe560('0x20'))[_0xe560('0x21')](socket);function respondWithStatusCode(_0x1d81e7,_0x3130b6){_0x3130b6=_0x3130b6||0xcc;return function(_0x239b74){if(_0x239b74){return _0x1d81e7[_0xe560('0x22')](_0x3130b6);}return _0x1d81e7[_0xe560('0x23')](_0x3130b6)['end']();};}function respondWithResult(_0x27febe,_0x267621){_0x267621=_0x267621||0xc8;return function(_0x2ca1a6){if(_0x2ca1a6){return _0x27febe[_0xe560('0x23')](_0x267621)['json'](_0x2ca1a6);}};}function respondWithFilteredResult(_0x65d0bc,_0x2e6d88){return function(_0x449f7a){if(_0x449f7a){var _0x574240=typeof _0x2e6d88[_0xe560('0x24')]==='undefined'&&typeof _0x2e6d88[_0xe560('0x25')]===_0xe560('0x26');var _0x169ab0=_0x449f7a[_0xe560('0x27')];var _0x5498f0=_0x574240?0x0:_0x2e6d88[_0xe560('0x24')];var _0x289b2a=_0x574240?_0x449f7a[_0xe560('0x27')]:_0x2e6d88[_0xe560('0x24')]+_0x2e6d88['limit'];var _0x4bfd1a;if(_0x289b2a>=_0x169ab0){_0x289b2a=_0x169ab0;_0x4bfd1a=0xc8;}else{_0x4bfd1a=0xce;}_0x65d0bc[_0xe560('0x23')](_0x4bfd1a);return _0x65d0bc[_0xe560('0x28')](_0xe560('0x29'),_0x5498f0+'-'+_0x289b2a+'/'+_0x169ab0)[_0xe560('0x2a')](_0x449f7a);}return null;};}function patchUpdates(_0x56b9e5){return function(_0x3579af){try{jsonpatch[_0xe560('0x2b')](_0x3579af,_0x56b9e5,!![]);}catch(_0x5bf975){return BPromise[_0xe560('0x2c')](_0x5bf975);}return _0x3579af[_0xe560('0x2d')]();};}function saveUpdates(_0x2b9820,_0x1b94ac){return function(_0x5cf93a){if(_0x5cf93a){return _0x5cf93a[_0xe560('0x2e')](_0x2b9820)[_0xe560('0x2f')](function(_0x22f8aa){return _0x22f8aa;});}return null;};}function removeEntity(_0x61b00b,_0x231332){return function(_0x555f44){if(_0x555f44){return _0x555f44[_0xe560('0x30')]()['then'](function(){_0x61b00b[_0xe560('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ffc,_0x494712){return function(_0x115f8d){if(!_0x115f8d){_0x258ffc[_0xe560('0x22')](0x194);}return _0x115f8d;};}function handleError(_0x4d8b2a,_0x2085f0){_0x2085f0=_0x2085f0||0x1f4;return function(_0x20c621){logger[_0xe560('0x31')](_0x20c621[_0xe560('0x32')]);if(_0x20c621['name']){delete _0x20c621[_0xe560('0x33')];}_0x4d8b2a[_0xe560('0x23')](_0x2085f0)['send'](_0x20c621);};}exports[_0xe560('0x34')]=function(_0xe51945,_0x5b37e5){var _0x3240b4={},_0x57604c={},_0xaad87={'count':0x0,'rows':[]};var _0x53c6cd=_['map'](db[_0xe560('0x35')][_0xe560('0x36')],function(_0x4ca80a){return{'name':_0x4ca80a[_0xe560('0x37')],'type':_0x4ca80a['type'][_0xe560('0x38')]};});_0x57604c['model']=_[_0xe560('0x39')](_0x53c6cd,_0xe560('0x33'));_0x57604c[_0xe560('0x3a')]=_['keys'](_0xe51945[_0xe560('0x3a')]);_0x57604c[_0xe560('0x3b')]=_[_0xe560('0x3c')](_0x57604c['model'],_0x57604c[_0xe560('0x3a')]);_0x3240b4['attributes']=_['intersection'](_0x57604c[_0xe560('0x3d')],qs[_0xe560('0x3e')](_0xe51945[_0xe560('0x3a')][_0xe560('0x3e')]));_0x3240b4[_0xe560('0x3f')]=_0x3240b4['attributes']['length']?_0x3240b4[_0xe560('0x3f')]:_0x57604c['model'];if(!_0xe51945['query']['hasOwnProperty'](_0xe560('0x40'))){_0x3240b4['limit']=qs[_0xe560('0x25')](_0xe51945['query'][_0xe560('0x25')]);_0x3240b4[_0xe560('0x24')]=qs[_0xe560('0x24')](_0xe51945[_0xe560('0x3a')][_0xe560('0x24')]);}_0x3240b4[_0xe560('0x41')]=qs[_0xe560('0x42')](_0xe51945[_0xe560('0x3a')]['sort']);_0x3240b4[_0xe560('0x43')]=qs['filters'](_[_0xe560('0x44')](_0xe51945[_0xe560('0x3a')],_0x57604c[_0xe560('0x3b')]),_0x53c6cd);if(_0xe51945[_0xe560('0x3a')][_0xe560('0x45')]){_0x3240b4[_0xe560('0x43')]=_[_0xe560('0x46')](_0x3240b4[_0xe560('0x43')],{'$or':_['map'](_0x53c6cd,function(_0x5ca378){if(_0x5ca378[_0xe560('0x47')]!==_0xe560('0x48')){var _0x18acd5={};_0x18acd5[_0x5ca378[_0xe560('0x33')]]={'$like':'%'+_0xe51945['query'][_0xe560('0x45')]+'%'};return _0x18acd5;}})});}_0x3240b4=_[_0xe560('0x46')]({},_0x3240b4,_0xe51945[_0xe560('0x49')]);var _0x370a0e={'where':_0x3240b4[_0xe560('0x43')]};return db[_0xe560('0x35')]['count'](_0x370a0e)[_0xe560('0x2f')](function(_0x2860bb){_0xaad87[_0xe560('0x27')]=_0x2860bb;if(_0xe51945[_0xe560('0x3a')][_0xe560('0x4a')]){_0x3240b4[_0xe560('0x4b')]=[{'all':!![]}];}return db[_0xe560('0x35')]['findAll'](_0x3240b4);})[_0xe560('0x2f')](function(_0x13c2da){_0xaad87[_0xe560('0x4c')]=_0x13c2da;return _0xaad87;})[_0xe560('0x2f')](respondWithFilteredResult(_0x5b37e5,_0x3240b4))[_0xe560('0x4d')](handleError(_0x5b37e5,null));};exports[_0xe560('0x4e')]=function(_0x1e1cff,_0x2debab){var _0x5f33b3={'raw':![],'where':{'id':_0x1e1cff[_0xe560('0x4f')]['id']}},_0x1dc65b={};_0x1dc65b[_0xe560('0x3d')]=_[_0xe560('0x50')](db[_0xe560('0x35')][_0xe560('0x36')]);_0x1dc65b[_0xe560('0x3a')]=_[_0xe560('0x50')](_0x1e1cff[_0xe560('0x3a')]);_0x1dc65b[_0xe560('0x3b')]=_[_0xe560('0x3c')](_0x1dc65b['model'],_0x1dc65b[_0xe560('0x3a')]);_0x5f33b3[_0xe560('0x3f')]=_[_0xe560('0x3c')](_0x1dc65b[_0xe560('0x3d')],qs[_0xe560('0x3e')](_0x1e1cff['query']['fields']));_0x5f33b3['attributes']=_0x5f33b3[_0xe560('0x3f')]['length']?_0x5f33b3[_0xe560('0x3f')]:_0x1dc65b['model'];if(_0x1e1cff[_0xe560('0x3a')][_0xe560('0x4a')]){_0x5f33b3[_0xe560('0x4b')]=[{'all':!![]}];}_0x5f33b3=_[_0xe560('0x46')]({},_0x5f33b3,_0x1e1cff[_0xe560('0x49')]);return db['UserProfile'][_0xe560('0x51')](_0x5f33b3)[_0xe560('0x2f')](handleEntityNotFound(_0x2debab,null))[_0xe560('0x2f')](respondWithResult(_0x2debab,null))[_0xe560('0x4d')](handleError(_0x2debab,null));};exports[_0xe560('0x52')]=function(_0x5174ec,_0xd4d38e){return db[_0xe560('0x35')][_0xe560('0x52')](_0x5174ec['body'],{})[_0xe560('0x2f')](respondWithResult(_0xd4d38e,0xc9))[_0xe560('0x4d')](handleError(_0xd4d38e,null));};exports[_0xe560('0x53')]=function(_0x39ea95,_0x168afd){var _0xc05c94={'where':{'id':_0x39ea95[_0xe560('0x4f')]['id']}},_0x164a0b={};_0x164a0b[_0xe560('0x3d')]=_[_0xe560('0x50')](db[_0xe560('0x35')][_0xe560('0x36')]);_0xc05c94[_0xe560('0x3f')]=_['intersection'](_0x164a0b[_0xe560('0x3d')],qs['fields'](_0x39ea95[_0xe560('0x3a')][_0xe560('0x3e')]));_0xc05c94[_0xe560('0x3f')]=_0xc05c94[_0xe560('0x3f')][_0xe560('0x54')]?_0xc05c94['attributes']:_0x164a0b[_0xe560('0x3d')];if(_0x39ea95[_0xe560('0x3a')][_0xe560('0x4a')]){_0xc05c94[_0xe560('0x4b')]=[{'all':!![]}];}_0xc05c94=_[_0xe560('0x46')]({},_0xc05c94,_0x39ea95[_0xe560('0x49')]);return db[_0xe560('0x35')][_0xe560('0x51')](_0xc05c94)[_0xe560('0x2f')](handleEntityNotFound(_0x168afd,null))[_0xe560('0x2f')](function(_0x4db1d6){if(_0x4db1d6){var _0x52f0ae=_0x4db1d6[_0xe560('0x55')]({'plain':!![]});_0x52f0ae=qs[_0xe560('0x56')](_0x52f0ae,['id',_0xe560('0x57'),_0xe560('0x58'),_0xe560('0x59')]);_0x39ea95[_0xe560('0x5a')]=_[_0xe560('0x56')](_0x39ea95['body'],['id',_0xe560('0x57'),'updatedAt']);return db[_0xe560('0x5b')][_0xe560('0x5c')](function(_0x36b52a){return db['UserProfile'][_0xe560('0x52')](_[_0xe560('0x46')](_0x52f0ae,_0x39ea95['body']),{'include':_0x39ea95[_0xe560('0x3a')][_0xe560('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x36b52a})[_0xe560('0x2f')](function(_0x3d8d3d){var _0x27dbbd=_0x3d8d3d['get']({'plain':!![]});return db[_0xe560('0x5d')]['findAll']({'where':{'userProfileId':_0x39ea95['params']['id']},'raw':!![]})['then'](function(_0x8ee679){if(_0x8ee679){return BPromise[_0xe560('0x5e')](_0x8ee679,function(_0x5709c6){return new BPromise(function(_0x4e1a99,_0x2b1b98){if(_0x5709c6[_0xe560('0x5f')]===null||_0x5709c6[_0xe560('0x5f')]===0x1)_0x4e1a99(null);return db[_0xe560('0x60')][_0xe560('0x61')]({'where':{'sectionId':_0x5709c6['id']},'raw':!![]})[_0xe560('0x2f')](function(_0x9c1462){var _0x1aa87e=_[_0xe560('0x39')](_0x9c1462,function(_0x4a6032){return qs['omit'](_0x4a6032,['id',_0xe560('0x57'),_0xe560('0x58'),_0xe560('0x62')]);});_0x4e1a99(_0x1aa87e);})[_0xe560('0x4d')](function(_0x23caab){_0x2b1b98(_0x23caab);});})[_0xe560('0x2f')](function(_0x47f21f){var _0x147102=qs[_0xe560('0x56')](_0x5709c6,['id','createdAt',_0xe560('0x58')]);_0x147102[_0xe560('0x63')]=_0x27dbbd['id'];if(_0x47f21f)_0x147102[_0xe560('0x64')]=_0x47f21f;return _0x147102;})[_0xe560('0x2f')](function(_0x24cc78){return db[_0xe560('0x5d')]['create'](_0x24cc78,{'include':[{'model':db['UserProfileResource'],'as':_0xe560('0x64')}],'raw':!![],'transaction':_0x36b52a});});})['then'](function(){return _0x27dbbd;});}});});});}})[_0xe560('0x2f')](respondWithResult(_0x168afd,0xc9))[_0xe560('0x4d')](handleError(_0x168afd,null));};exports[_0xe560('0x2e')]=function(_0x4d7208,_0x598c75){if(_0x4d7208[_0xe560('0x5a')]['id']){delete _0x4d7208[_0xe560('0x5a')]['id'];}return db[_0xe560('0x35')][_0xe560('0x51')]({'where':{'id':_0x4d7208[_0xe560('0x4f')]['id']}})[_0xe560('0x2f')](handleEntityNotFound(_0x598c75,null))[_0xe560('0x2f')](saveUpdates(_0x4d7208['body'],null))['then'](respondWithResult(_0x598c75,null))['catch'](handleError(_0x598c75,null));};exports[_0xe560('0x30')]=function(_0xbf0c0d,_0x3a19a0){return db[_0xe560('0x35')][_0xe560('0x51')]({'where':{'id':_0xbf0c0d[_0xe560('0x4f')]['id']}})[_0xe560('0x2f')](handleEntityNotFound(_0x3a19a0,null))['then'](removeEntity(_0x3a19a0,null))[_0xe560('0x4d')](handleError(_0x3a19a0,null));};exports['describe']=function(_0x304caf,_0x1eae33){return db[_0xe560('0x35')][_0xe560('0x65')]()[_0xe560('0x2f')](respondWithResult(_0x1eae33,null))[_0xe560('0x4d')](handleError(_0x1eae33,null));};exports['addSections']=function(_0x139899,_0x1a6125){var _0xc07f1f=_0x139899[_0xe560('0x5a')];return db[_0xe560('0x35')][_0xe560('0x51')]({'where':{'id':_0x139899['params']['id']}})[_0xe560('0x2f')](handleEntityNotFound(_0x1a6125,null))[_0xe560('0x2f')](function(_0x360a29){if(_0x360a29){return db[_0xe560('0x5b')]['transaction'](function(_0x4f21ef){return db['UserProfileSection'][_0xe560('0x30')]({'where':{'userProfileId':_0x139899[_0xe560('0x4f')]['id'],'sectionId':_['map'](_0xc07f1f,function(_0x3f95ca){return _0x3f95ca[_0xe560('0x62')];})},'transaction':_0x4f21ef})[_0xe560('0x2f')](function(){var _0x2780fb=_[_0xe560('0x39')](_0xc07f1f,function(_0x46215f){_0x46215f[_0xe560('0x63')]=_0x139899[_0xe560('0x4f')]['id'];return _0x46215f;});var _0x265533=[];return BPromise[_0xe560('0x5e')](_0x2780fb,function(_0x4bfd88){return db['UserProfileSection'][_0xe560('0x52')](_0x4bfd88,{'include':[{'model':db[_0xe560('0x60')],'as':_0xe560('0x64')}],'raw':!![],'transaction':_0x4f21ef})[_0xe560('0x2f')](function(_0x2b712b){_0x265533[_0xe560('0x66')](_0x2b712b[_0xe560('0x55')]({'plain':!![]}));});})[_0xe560('0x2f')](function(){return _0x265533;});});});}})[_0xe560('0x2f')](function(_0x226165){return _0x226165;})[_0xe560('0x2f')](respondWithResult(_0x1a6125,null))[_0xe560('0x4d')](handleError(_0x1a6125,null));};exports[_0xe560('0x67')]=function(_0x1d8e78,_0x20ad36){var _0x5814e9;return db[_0xe560('0x35')]['find']({'where':{'id':_0x1d8e78[_0xe560('0x4f')]['id']},'attributes':['id',_0xe560('0x33')]})[_0xe560('0x2f')](handleEntityNotFound(_0x20ad36,null))['then'](function(_0x513eee){if(_0x513eee){_0x5814e9=_0x513eee;return db['UserProfileSection'][_0xe560('0x30')]({'where':{'userProfileId':_0x1d8e78[_0xe560('0x4f')]['id'],'sectionId':_0x1d8e78[_0xe560('0x3a')][_0xe560('0x68')]}});}})['then'](function(){return _0x5814e9;})['then'](respondWithStatusCode(_0x20ad36,null))[_0xe560('0x4d')](handleError(_0x20ad36,null));};exports['getSections']=function(_0x3213f8,_0x4bfec3){var _0x1b5ccc=[];var _0x55c5de=[];return db[_0xe560('0x5d')]['findAll']({'where':{'userProfileId':_0x3213f8[_0xe560('0x4f')]['id']},'raw':!![]})['then'](function(_0x3fd532){_0x1b5ccc=_[_0xe560('0x45')](_0x3fd532,function(_0xce6928){return _0xce6928[_0xe560('0x69')]===0x1||_[_0xe560('0x6a')]([0x3eb,0x709],_0xce6928['sectionId']);});if(!_[_0xe560('0x6b')](_0x1b5ccc)){return _[_0xe560('0x39')](_0x1b5ccc,function(_0x19f2b2){return _0x19f2b2['sectionId'];});}else{return;}})[_0xe560('0x2f')](function(_0x116398){if(_0x116398)_0x55c5de=_0x116398;if(_[_0xe560('0x6a')](_0x55c5de,0x64)){var _0x481f24=_['find'](_0x1b5ccc,{'sectionId':0x64});return hasDefaultDashboard(_0x481f24)[_0xe560('0x2f')](function(_0x2f3798){return _[_0xe560('0x39')](_0x1b5ccc,function(_0x4603fa){if(_0x4603fa[_0xe560('0x62')]===0x64){_0x4603fa['subsections']=_0x2f3798;}return _0x4603fa;});});}else{return;}})[_0xe560('0x2f')](function(_0x358dc2){if(_0x358dc2)_0x1b5ccc=_0x358dc2;if(_[_0xe560('0x6a')](_0x55c5de,0x3eb)){var _0x42df83=_[_0xe560('0x51')](_0x1b5ccc,{'sectionId':0x3eb});return getCustomDashboards(_0x42df83)[_0xe560('0x2f')](function(_0x3cfd0c){return _[_0xe560('0x39')](_0x1b5ccc,function(_0x25e519){if(_0x42df83['enabled']){if(_0x25e519[_0xe560('0x62')]===0x3eb){_0x25e519['subsections']=_0x3cfd0c;}}else{if(_0x25e519[_0xe560('0x62')]===0x64){if(!_0x25e519[_0xe560('0x6c')]){_0x25e519[_0xe560('0x6c')]=[];}_0x25e519[_0xe560('0x6c')]=_0x25e519[_0xe560('0x6c')][_0xe560('0x6d')](_0x3cfd0c);}}return _0x25e519;});});}else{return;}})[_0xe560('0x2f')](function(_0x2dfff9){if(_0x2dfff9)_0x1b5ccc=_0x2dfff9;if(_['includes'](_0x55c5de,0x709)){var _0x44181c=_[_0xe560('0x51')](_0x1b5ccc,{'sectionId':0x709});return getPlugins(_0x44181c)[_0xe560('0x2f')](function(_0x52a875){if(_0x44181c[_0xe560('0x69')]){return _[_0xe560('0x39')](_0x1b5ccc,function(_0x1c6f0e){if(_0x1c6f0e[_0xe560('0x62')]===0x709){_0x1c6f0e[_0xe560('0x6c')]=_0x52a875;}return _0x1c6f0e;});}else{var _0x4e2a76={'sectionId':0x76c,'enabled':0x1,'subsections':_0x52a875};var _0x41777c=_['map'](_0x1b5ccc);_0x41777c[_0xe560('0x66')](_0x4e2a76);return _0x41777c;}});}else{return;}})['then'](function(_0x1edba4){if(_0x1edba4)_0x1b5ccc=_0x1edba4;return _[_0xe560('0x45')](_0x1b5ccc,['enabled',0x1]);})[_0xe560('0x2f')](respondWithResult(_0x4bfec3,null))[_0xe560('0x4d')](handleError(_0x4bfec3,null));};function hasDefaultDashboard(_0x54795e){var _0x226239=[0x65];return new BPromise(function(_0x14ea24,_0x2ed90e){try{if(_0x54795e[_0xe560('0x5f')]){_0x14ea24(_0x226239);}else{return db[_0xe560('0x60')][_0xe560('0x6e')]({'where':{'sectionId':_0x54795e['id']},'raw':!![]})[_0xe560('0x2f')](function(_0x11888e){_0x11888e?_0x14ea24(_0x226239):_0x14ea24();});}}catch(_0x1b2984){_0x2ed90e(_0x1b2984);}});}function getCustomDashboards(_0x43e78e){var _0x4f8c9a=[];return new BPromise(function(_0x20c00d,_0x528a88){try{if(_0x43e78e[_0xe560('0x5f')]){return db[_0xe560('0x6f')]['findAll']({'raw':!![]})['then'](function(_0xf5bb33){_0xf5bb33[_0xe560('0x70')](function(_0x47994e){_0x4f8c9a['push'](_0x47994e['id']+0x1869f);});_0x20c00d(_0x4f8c9a);});}else{return db[_0xe560('0x60')][_0xe560('0x61')]({'where':{'sectionId':_0x43e78e['id']},'raw':!![]})[_0xe560('0x2f')](function(_0x192df3){_0x192df3['forEach'](function(_0x39b3e6){_0x4f8c9a[_0xe560('0x66')](_0x39b3e6['resourceId']+0x1869f);});_0x20c00d(_0x4f8c9a);});}}catch(_0x241990){_0x528a88(_0x241990);}});}function getPlugins(_0x49ce66){var _0x32baa7=[];return new BPromise(function(_0x1d400d,_0x98bf8c){try{if(_0x49ce66['autoAssociation']){return db[_0xe560('0x71')]['findAll']({'raw':!![]})[_0xe560('0x2f')](function(_0x1c4d99){_0x1c4d99['forEach'](function(_0xe7c0bf){_0x32baa7[_0xe560('0x66')](_0xe7c0bf['id']+0x15b38);});_0x1d400d(_0x32baa7);});}else{return db[_0xe560('0x60')][_0xe560('0x61')]({'where':{'sectionId':_0x49ce66['id']},'raw':!![]})[_0xe560('0x2f')](function(_0x419200){_0x419200['forEach'](function(_0x568c75){_0x32baa7[_0xe560('0x66')](_0x568c75[_0xe560('0x72')]+0x15b38);});_0x1d400d(_0x32baa7);});}}catch(_0x304c49){_0x98bf8c(_0x304c49);}});}exports['addResources']=function(_0xd3ebad,_0x33b5ec){return db[_0xe560('0x35')][_0xe560('0x51')]({'where':{'id':_0xd3ebad['params']['id']}})['then'](handleEntityNotFound(_0x33b5ec,null))[_0xe560('0x2f')](function(_0x37da69){if(_0x37da69){return db[_0xe560('0x5b')][_0xe560('0x5c')](function(_0x42d1a8){return db['UserProfileSection'][_0xe560('0x61')]({'where':{'userProfileId':_0xd3ebad['params']['id']},'attributes':['id'],'raw':!![]})[_0xe560('0x2f')](function(_0x5931c3){if(_0x5931c3){return db[_0xe560('0x5d')][_0xe560('0x30')]({'where':{'userProfileId':_0xd3ebad['params']['id'],'id':_[_0xe560('0x39')](_0x5931c3,function(_0x1f89c3){return _0x1f89c3['id'];})},'transaction':_0x42d1a8});}})[_0xe560('0x2f')](function(_0x3d7c90){var _0x1e778f=_[_0xe560('0x39')](_0xd3ebad[_0xe560('0x5a')],function(_0x1a2376){_0x1a2376['userProfileId']=_0xd3ebad[_0xe560('0x4f')]['id'];return _0x1a2376;});return db[_0xe560('0x5d')][_0xe560('0x73')](_0x1e778f,{'raw':!![],'transaction':_0x42d1a8});})[_0xe560('0x2f')](function(_0x51eeec){var _0x1e0d9a=_[_0xe560('0x45')](_[_0xe560('0x39')](_0x51eeec,function(_0x5d9fba){return _0x5d9fba[_0xe560('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x1e0d9a){return db['UserProfileSection'][_0xe560('0x61')]({'where':{'userProfileId':_0xd3ebad['params']['id'],'sectionId':_[_0xe560('0x39')](_0x1e0d9a,function(_0x32d8d8){return _0x32d8d8['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xe560('0x2f')](function(_0x365842){var _0x500806=_[_0xe560('0x39')](_0xd3ebad[_0xe560('0x5a')],function(_0x462dd8){_0x462dd8[_0xe560('0x63')]=_0xd3ebad[_0xe560('0x4f')]['id'];return _0x462dd8;});return db[_0xe560('0x60')][_0xe560('0x73')](_0x500806,{'raw':!![],'transaction':_0x42d1a8});});}})['catch'](handleError(_0x33b5ec,null));});}})[_0xe560('0x2f')](function(_0x30ee6b){var _0x380798=_[_0xe560('0x39')](_0x30ee6b,function(_0x360ccc){return _0x360ccc[_0xe560('0x55')]({'plain':!![]});});})[_0xe560('0x2f')](respondWithResult(_0x33b5ec,null))[_0xe560('0x4d')](handleError(_0x33b5ec,null));};exports['removeResources']=function(_0x1426a,_0x16e6d1,_0x3af59f){return db['UserProfile'][_0xe560('0x51')]({'where':{'id':_0x1426a[_0xe560('0x4f')]['id']}})[_0xe560('0x2f')](handleEntityNotFound(_0x16e6d1,null))['then'](function(_0x2c73ef){if(_0x2c73ef){return _0x2c73ef[_0xe560('0x74')](_0x1426a[_0xe560('0x3a')][_0xe560('0x68')]);}})['then'](respondWithStatusCode(_0x16e6d1,null))['catch'](handleError(_0x16e6d1,null));};exports[_0xe560('0x75')]=function(_0x26e556,_0x8451c9){var _0x3253ed={};if(!_0x26e556[_0xe560('0x3a')][_0xe560('0x76')])throw new Error(_0xe560('0x77'));if(!_0x26e556[_0xe560('0x3a')][_0xe560('0x78')](_0xe560('0x40'))){_0x3253ed[_0xe560('0x25')]=qs['limit'](_0x26e556['query'][_0xe560('0x25')]);_0x3253ed['offset']=qs['offset'](_0x26e556[_0xe560('0x3a')][_0xe560('0x24')]);}return db[_0xe560('0x35')][_0xe560('0x51')]({'where':{'id':_0x26e556[_0xe560('0x4f')]['id']}})['then'](function(_0x58bbb2){if(!_0x58bbb2)throw new Error(_0xe560('0x79')+_0x26e556[_0xe560('0x4f')]['id']);return db[_0xe560('0x35')][_0xe560('0x75')](_0x26e556);})[_0xe560('0x2f')](respondWithFilteredResult(_0x8451c9,_0x3253ed))[_0xe560('0x4d')](handleError(_0x8451c9,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5ba9f27..5160c57 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 _0xa064=['hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','emit'];(function(_0x4fdddd,_0xab3dbe){var _0x3883f2=function(_0x390de7){while(--_0x390de7){_0x4fdddd['push'](_0x4fdddd['shift']());}};_0x3883f2(++_0xab3dbe);}(_0xa064,0x192));var _0x4a06=function(_0x45af22,_0x15e0c7){_0x45af22=_0x45af22-0x0;var _0x2dc472=_0xa064[_0x45af22];return _0x2dc472;};'use strict';var EventEmitter=require(_0x4a06('0x0'));var UserProfile=require(_0x4a06('0x1'))['db'][_0x4a06('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4a06('0x3')](0x0);var events={'afterCreate':_0x4a06('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e300a){return function(_0x4add79,_0x390fdc,_0x475a0d){UserProfileEvents['emit'](_0x2e300a+':'+_0x4add79['id'],_0x4add79);UserProfileEvents[_0x4a06('0x5')](_0x2e300a,_0x4add79);_0x475a0d(null);};}for(var e in events){if(events[_0x4a06('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4a06('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x7c1a=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x47dc1c,_0x4bd160){var _0x52a6f0=function(_0x2fe6f0){while(--_0x2fe6f0){_0x47dc1c['push'](_0x47dc1c['shift']());}};_0x52a6f0(++_0x4bd160);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1aaa00,_0x245138){_0x1aaa00=_0x1aaa00-0x0;var _0x4be822=_0x7c1a[_0x1aaa00];return _0x4be822;};'use strict';var EventEmitter=require(_0xa7c1('0x0'));var UserProfile=require(_0xa7c1('0x1'))['db'][_0xa7c1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa7c1('0x3')](0x0);var events={'afterCreate':_0xa7c1('0x4'),'afterUpdate':_0xa7c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd434f){return function(_0x132b08,_0x506858,_0x135ae7){UserProfileEvents['emit'](_0xd434f+':'+_0x132b08['id'],_0x132b08);UserProfileEvents[_0xa7c1('0x6')](_0xd434f,_0x132b08);_0x135ae7(null);};}for(var e in events){if(events[_0xa7c1('0x7')](e)){var event=events[e];UserProfile[_0xa7c1('0x8')](e,emitEvent(event));}}module[_0xa7c1('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 299fac9..179399d 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 _0xdb2b=['all','ignore','union','push','autoAssociation','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','merge','VIRTUAL','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','ids','customSorting','extraQueryConditions','count','include','Tags','color','tag','rows','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','model','findAll','name','catch','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','childModel','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','contexts','voicemails','voicerecordings','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','type','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','voicequeues','QueueCampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','zohoaccounts','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','find','params'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xdb2b,0xea));var _0xbdb2=function(_0x239f2e,_0x4c5c60){_0x239f2e=_0x239f2e-0x0;var _0x17dcf6=_0xdb2b[_0x239f2e];return _0x17dcf6;};'use strict';var _=require('lodash');var attributes=require(_0xbdb2('0x0'));var squel=require(_0xbdb2('0x1'));module[_0xbdb2('0x2')]=function(_0xca3a05){var _0x555c4f=_0xca3a05[_0xbdb2('0x3')];function _0x5e111f(_0x2ef3aa,_0x5abdf7){return new Promise(function(_0x4715f5,_0x1097a6){if(!_0x5abdf7)return _0x4715f5(null);var _0x1d479d=_0x5abdf7[_0xbdb2('0x4')]?{[_0x5abdf7[_0xbdb2('0x4')][_0xbdb2('0x5')]]:_0x5abdf7[_0xbdb2('0x4')][_0xbdb2('0x6')]}:undefined;return _0x555c4f[_0x2ef3aa]['findAll']({'where':_0x1d479d,'raw':!![]})[_0xbdb2('0x7')](function(_0x2dc225){_0x5abdf7[_0xbdb2('0x8')]=_[_0xbdb2('0x9')](_0x2dc225,'id');_0x4715f5(_0x5abdf7);})['catch'](function(_0x4a85d4){_0x1097a6(_0x4a85d4);});});}function _0x4453e4(_0x542f0a,_0x38afac){return new Promise(function(_0x4f017e,_0x1c2528){var _0x5c444e=_0x542f0a[_0xbdb2('0x4')]?{[_0x542f0a[_0xbdb2('0x4')][_0xbdb2('0x5')]]:_0x542f0a['filter'][_0xbdb2('0x6')]}:undefined;return _0x555c4f[_0x542f0a[_0xbdb2('0xa')]][_0xbdb2('0xb')]({'where':_0x5c444e,'raw':!![]})[_0xbdb2('0x7')](function(_0x5a12d1){_0x38afac[_0xbdb2('0x8')]=_[_0xbdb2('0x9')](_0x5a12d1,function(_0x2eaf4d){return _0x2eaf4d[_0xbdb2('0xc')];});_0x4f017e(_0x38afac);})[_0xbdb2('0xd')](function(_0x111693){_0x1c2528(_0x111693);});});}function _0x346a15(_0x353117,_0x356147,_0x5bd483){if(!_0x356147)return Promise[_0xbdb2('0xe')](null);return new Promise(function(_0x4826b8,_0x37fa8e){return _0x555c4f['UserProfileResource'][_0xbdb2('0xb')]({'where':{'sectionId':_0x356147['id']},'raw':!![]})['then'](function(_0x37cc42){if(_0x353117['field']&&_0x353117[_0xbdb2('0x5')]!=='id'){_0x356147[_0xbdb2('0x8')]=_[_0xbdb2('0x9')](_0x37cc42,function(_0x13a885){return _0x13a885[_0x353117[_0xbdb2('0x5')]];});}else{if(_0x5bd483===_0xbdb2('0xf')){_0x356147[_0xbdb2('0x8')]=_[_0xbdb2('0x9')](_0x37cc42,function(_0x23ce42){return{'id':_0x23ce42[_0xbdb2('0x10')],'type':_0x23ce42['type']};});}else{_0x356147[_0xbdb2('0x8')]=_[_0xbdb2('0x9')](_0x37cc42,function(_0xb4668c){return _0xb4668c['resourceId'];});}}_0x4826b8(_0x356147);})['catch'](function(_0x492998){_0x37fa8e(_0x492998);});});}function _0x38342b(_0x54f3aa,_0x98d6e2){var _0x5e9bb8={'parentSections':[]};switch(_0x54f3aa[_0xbdb2('0x11')]()){case _0xbdb2('0x12'):_0x5e9bb8['childModel']=_0xbdb2('0x13');break;case'odbc':_0x5e9bb8[_0xbdb2('0x14')]='SquareOdbc';break;case _0xbdb2('0x15'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x16');_0x5e9bb8[_0xbdb2('0x17')]=[{'name':_0xbdb2('0x18'),'field':_0xbdb2('0xc'),'foreignKey':_0xbdb2('0x19')}];break;case'projects':_0x5e9bb8['childModel']=_0xbdb2('0x1a');break;case _0xbdb2('0x1b'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x1c');_0x5e9bb8[_0xbdb2('0x17')]=[{'name':_0xbdb2('0x1d'),'field':'id','foreignKey':_0xbdb2('0x1e')}];break;case'lists':_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x1f');break;case'companies':_0x5e9bb8['childModel']=_0xbdb2('0x20');break;case _0xbdb2('0x21'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x22');break;case _0xbdb2('0x23'):_0x5e9bb8[_0xbdb2('0x14')]='ChatQueue';break;case _0xbdb2('0x24'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x25');break;case'faxqueues':_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x26');break;case _0xbdb2('0x27'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x28');break;case _0xbdb2('0x29'):case'internalroutes':case _0xbdb2('0x2a'):_0x5e9bb8[_0xbdb2('0x14')]='VoiceExtension';break;case _0xbdb2('0x2b'):_0x5e9bb8['childModel']='VoiceContext';break;case _0xbdb2('0x2c'):_0x5e9bb8['childModel']='VoiceMail';break;case _0xbdb2('0x2d'):_0x5e9bb8['childModel']='VoiceRecording';_0x5e9bb8['parentSections']=[{'name':'Agents','field':_0xbdb2('0xc'),'foreignKey':_0xbdb2('0x2e'),'model':'User','filter':{'field':_0xbdb2('0x2f'),'value':[_0xbdb2('0x30')]}},{'name':_0xbdb2('0x31'),'field':'name','foreignKey':'membername','model':_0xbdb2('0x32'),'filter':{'field':_0xbdb2('0x2f'),'value':[_0xbdb2('0x33')]}},{'name':_0xbdb2('0x34'),'field':_0xbdb2('0xc'),'foreignKey':_0xbdb2('0x35'),'model':_0xbdb2('0x36'),'filter':{'field':'type','value':[_0xbdb2('0x37')]}},{'name':'QueueCampaigns','field':_0xbdb2('0xc'),'foreignKey':_0xbdb2('0x35'),'model':_0xbdb2('0x36'),'filter':{'field':_0xbdb2('0x38'),'value':['outbound']}}];break;case _0xbdb2('0x39'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x3a');break;case'chanspies':_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x3b');break;case _0xbdb2('0x3c'):_0x5e9bb8[_0xbdb2('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x5e9bb8['childModel']=_0xbdb2('0x3d');break;case _0xbdb2('0x3e'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x3f');break;case _0xbdb2('0x40'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x41');break;case _0xbdb2('0x42'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x43');break;case _0xbdb2('0x44'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x45');break;case _0xbdb2('0x46'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x47');break;case _0xbdb2('0x48'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x49');break;case _0xbdb2('0x4a'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x4b');break;case'whatsappqueues':_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x4c');break;case _0xbdb2('0x4d'):_0x5e9bb8[_0xbdb2('0x14')]='WhatsappAccount';break;case _0xbdb2('0x4e'):_0x5e9bb8[_0xbdb2('0x14')]='Team';break;case _0xbdb2('0x4f'):case'queuecampaigns':_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x36');if(_0x98d6e2){_0x5e9bb8[_0xbdb2('0x17')]=[{'name':'VoiceQueues'},{'name':_0xbdb2('0x50')}];}break;case _0xbdb2('0x51'):case _0xbdb2('0x52'):case _0xbdb2('0x53'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x32');if(_0x98d6e2){_0x5e9bb8[_0xbdb2('0x17')]=[{'name':_0xbdb2('0x54'),'filter':{'field':'role','value':[_0xbdb2('0x55'),_0xbdb2('0x56')]},'ignore':!![]},{'name':_0xbdb2('0x57')},{'name':_0xbdb2('0x31')}];}break;case _0xbdb2('0x58'):_0x5e9bb8['childModel']='ZendeskAccount';break;case _0xbdb2('0x59'):_0x5e9bb8['childModel']=_0xbdb2('0x5a');break;case _0xbdb2('0x5b'):_0x5e9bb8['childModel']=_0xbdb2('0x5c');break;case _0xbdb2('0x5d'):_0x5e9bb8[_0xbdb2('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0x5e9bb8[_0xbdb2('0x14')]='DeskAccount';break;case _0xbdb2('0x5e'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x5f');break;case'vtigeraccounts':_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x32');break;case _0xbdb2('0x60'):_0x5e9bb8[_0xbdb2('0x14')]='CannedAnswer';break;case _0xbdb2('0x61'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x62');break;case _0xbdb2('0x63'):_0x5e9bb8[_0xbdb2('0x14')]='Dashboard';break;case _0xbdb2('0x64'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x65');break;case _0xbdb2('0x66'):_0x5e9bb8['childModel']=_0xbdb2('0x67');break;case _0xbdb2('0x68'):_0x5e9bb8['childModel']=_0xbdb2('0x69');break;case _0xbdb2('0x6a'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x6b');break;case _0xbdb2('0x6c'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x6d');break;case _0xbdb2('0x6e'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x6f');break;case _0xbdb2('0x70'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x71');break;case _0xbdb2('0x72'):_0x5e9bb8['childModel']='Trunk';break;case _0xbdb2('0x73'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x74');break;case _0xbdb2('0x75'):_0x5e9bb8[_0xbdb2('0x14')]=_0xbdb2('0x76');break;case _0xbdb2('0x77'):_0x5e9bb8[_0xbdb2('0x14')]='AnalyticExtractedReport';_0x5e9bb8[_0xbdb2('0x17')]=[{'name':_0xbdb2('0x78'),'field':'id','foreignKey':_0xbdb2('0x79')}];break;case'metrics':_0x5e9bb8['childModel']='AnalyticMetric';break;}return _0x5e9bb8;}function _0x58fbad(_0x5a6944,_0x55428f){var _0x948e52=_0x5a6944[_0xbdb2('0x7a')](0x0)[_0xbdb2('0x7b')]()+_0x5a6944[_0xbdb2('0x7c')](0x1);var _0x2e2027={'type':_0x555c4f[_0xbdb2('0x7d')]['QueryTypes'][_0xbdb2('0x7e')],'raw':!![]};return new Promise(function(_0x31c15b,_0x42ba31){var _0x3b3c5b=squel[_0xbdb2('0x7f')]()[_0xbdb2('0x5')](_0xbdb2('0x80')+_0x948e52+_0xbdb2('0x81'),'id')[_0xbdb2('0x5')](_0xbdb2('0x82'))[_0xbdb2('0x83')](_0xbdb2('0x84')+_0x5a6944+_0xbdb2('0x85'),'ui')[_0xbdb2('0x86')]('ui.UserId\x20=\x20?',_0x55428f['id']);return _0x555c4f[_0xbdb2('0x87')][_0xbdb2('0x88')](_0x3b3c5b[_0xbdb2('0x89')](),_0x2e2027)['then'](function(_0x530d84){_0x55428f[_0x948e52+'OpenTabs']=_0x530d84;_0x31c15b(_0x530d84);})[_0xbdb2('0xd')](function(_0xb3d62){_0x42ba31(_0xb3d62);});});}return _0xca3a05[_0xbdb2('0x8a')](_0xbdb2('0x8b'),attributes,{'tableName':_0xbdb2('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x43e263){var _0x566661=require('../../components/parsers/qs');var _0x5ae803={'raw':_0x43e263[_0xbdb2('0x88')][_0xbdb2('0x8d')],'where':{}};var _0x26a159={};var _0x5865e8={'count':0x0,'rows':[]};var _0x4a31b0=_0x43e263[_0xbdb2('0x88')][_0xbdb2('0x8e')];var _0x5640c2=_0x43e263[_0xbdb2('0x88')][_0xbdb2('0x8f')]||![];var _0x1fe71b=_0x38342b(_0x4a31b0,_0x5640c2);if(!_0x1fe71b['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x4a31b0+'\x27');var _0x5a6657=[{'name':_0x4a31b0}];if(!_[_0xbdb2('0x90')](_0x1fe71b[_0xbdb2('0x17')]))_0x5a6657=_0x1fe71b[_0xbdb2('0x17')];var _0x532a04=[];for(var _0x39cb1f=0x0;_0x39cb1f<_0x5a6657[_0xbdb2('0x91')];_0x39cb1f++){_0x532a04['push'](_0x555c4f['UserProfileSection'][_0xbdb2('0x92')]({'where':{'userProfileId':_0x43e263[_0xbdb2('0x93')]['id'],'name':_0x5a6657[_0x39cb1f]['name']},'raw':!![]}));}return Promise[_0xbdb2('0x94')](_0x532a04)['then'](function(_0x4ba005){var _0x450d8e=_['filter'](_0x4ba005,function(_0x191c99){return _0x191c99?_0x191c99:undefined;});var _0x2c6301=_['filter'](_0x5a6657,[_0xbdb2('0x95'),!![]]);var _0x4c8679=_[_0xbdb2('0x90')](_0x450d8e)&&_[_0xbdb2('0x90')](_0x2c6301)?null:_[_0xbdb2('0x96')](_0x2c6301,_0x450d8e);if(!_0x4c8679)return null;var _0x36677d=[];for(var _0x5d1fea=0x0;_0x5d1fea<_0x4c8679[_0xbdb2('0x91')];_0x5d1fea++){var _0x3d8882=_['find'](_0x5a6657,function(_0x451dce){return _0x4c8679[_0x5d1fea]?_0x451dce[_0xbdb2('0xc')]===_0x4c8679[_0x5d1fea][_0xbdb2('0xc')]:null;});if(_0x3d8882){if(_0x4c8679[_0x5d1fea][_0xbdb2('0x95')]){_0x36677d[_0xbdb2('0x97')](_0x5e111f(_0x1fe71b[_0xbdb2('0x14')],_0x4c8679[_0x5d1fea]));}else{if(!_0x4c8679[_0x5d1fea][_0xbdb2('0x98')]){_0x36677d[_0xbdb2('0x97')](_0x346a15(_0x3d8882,_0x4c8679[_0x5d1fea],_0x1fe71b['childModel']));}else{if(_0x3d8882[_0xbdb2('0xa')]){_0x36677d[_0xbdb2('0x97')](_0x4453e4(_0x3d8882,_0x4c8679[_0x5d1fea]));}}}}}return Promise['all'](_0x36677d);})[_0xbdb2('0x7')](function(_0x4d3a9b){var _0x1984b2=_0x4d3a9b;var _0x1e66d7=null;if(_0x1984b2){_0x1e66d7=_0x1984b2['length']===0x1?_0x1984b2[0x0]:null;}if(!_0x1e66d7&&!_0x1984b2)return _0x5865e8;var _0xbfae84=_0x555c4f[_0x1fe71b[_0xbdb2('0x14')]]['rawAttributes'];_0x26a159[_0xbdb2('0xa')]=_[_0xbdb2('0x99')](_0xbfae84);_0x26a159[_0xbdb2('0x88')]=_[_0xbdb2('0x99')](_0x43e263[_0xbdb2('0x88')]);_0x26a159['filters']=_[_0xbdb2('0x9a')](_0x26a159[_0xbdb2('0xa')],_0x26a159[_0xbdb2('0x88')]);_0x5ae803[_0xbdb2('0x9b')]=_['intersection'](_0x26a159[_0xbdb2('0xa')],_0x566661[_0xbdb2('0x9c')](_0x43e263[_0xbdb2('0x88')][_0xbdb2('0x9c')]));_0x5ae803['attributes']=_0x5ae803['attributes']['length']?_0x5ae803[_0xbdb2('0x9b')]:_0x26a159[_0xbdb2('0xa')];if(!_0x43e263[_0xbdb2('0x88')][_0xbdb2('0x9d')](_0xbdb2('0x9e'))){_0x5ae803[_0xbdb2('0x9f')]=_0x566661[_0xbdb2('0x9f')](_0x43e263['query']['limit']);_0x5ae803['offset']=_0x566661[_0xbdb2('0xa0')](_0x43e263[_0xbdb2('0x88')]['offset']);}_0x5ae803[_0xbdb2('0xa1')]=_0x566661[_0xbdb2('0xa2')](_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xa2')]);_0x5ae803[_0xbdb2('0x86')]=_0x566661[_0xbdb2('0xa3')](_['pick'](_0x43e263['query'],_0x26a159['filters']));if(_0x43e263[_0xbdb2('0x88')][_0xbdb2('0x4')]){_0x5ae803[_0xbdb2('0x86')]=_[_0xbdb2('0xa4')](_0x5ae803[_0xbdb2('0x86')],{'$or':_[_0xbdb2('0x9')](_0xbfae84,function(_0x23105c){if(_0x23105c[_0xbdb2('0x38')]['key']!==_0xbdb2('0xa5')){var _0x3d660d={};_0x3d660d[_0x23105c[_0xbdb2('0x5')]]={'$like':'%'+_0x43e263[_0xbdb2('0x88')]['filter']+'%'};return _0x3d660d;}})});}var _0x570777=[];var _0x15a622=null;var _0x43fde9={};if(_0x1e66d7){_0x15a622=_[_0xbdb2('0x92')](_0x5a6657,[_0xbdb2('0xc'),_0x1e66d7['name']]);if(_0x15a622[_0xbdb2('0x5')]){_0x43fde9={};if(_0x1fe71b['childModel']===_0xbdb2('0xf')){_0x43fde9[_0x15a622[_0xbdb2('0xa6')]]=_[_0xbdb2('0x9')](_0x1e66d7[_0xbdb2('0x8')],'id');}else{_0x43fde9[_0x15a622[_0xbdb2('0xa6')]]=_0x1e66d7['associatedResources'];}_0x570777['push'](_0x43fde9);}else{_0x5ae803[_0xbdb2('0x86')]['id']=_0x1e66d7[_0xbdb2('0x8')];}}else{for(var _0x34f629=0x0;_0x34f629<_0x1984b2[_0xbdb2('0x91')];_0x34f629++){_0x15a622=_[_0xbdb2('0x92')](_0x5a6657,[_0xbdb2('0xc'),_0x1984b2[_0x34f629][_0xbdb2('0xc')]]);if(_0x15a622[_0xbdb2('0x5')]){_0x43fde9={};_0x43fde9[_0x15a622[_0xbdb2('0xa6')]]=_0x1984b2[_0x34f629][_0xbdb2('0x8')];_0x570777[_0xbdb2('0x97')](_0x43fde9);}else{if(!_0x5ae803[_0xbdb2('0x86')]['id'])_0x5ae803[_0xbdb2('0x86')]['id']=[];_0x1984b2[_0x34f629][_0xbdb2('0x8')][_0xbdb2('0xa7')](function(_0x25e405){_0x5ae803[_0xbdb2('0x86')]['id'][_0xbdb2('0x97')](_0x25e405);});}}}if(!_[_0xbdb2('0x90')](_0x570777)){_0x5ae803['where']=_['merge'](_0x5ae803['where'],{'$and':{'$or':_0x570777}});}_0x5ae803=_[_0xbdb2('0xa4')]({},_0x5ae803,_0x43e263[_0xbdb2('0xa8')]);if(_0x1e66d7&&!_0x1e66d7[_0xbdb2('0x98')]&&_0x1fe71b[_0xbdb2('0x14')]===_0xbdb2('0xf')){if(_0x43e263[_0xbdb2('0x88')]['includeAll']){_0x5ae803['include']=[{'all':!![]}];}return _0x555c4f[_0x1fe71b[_0xbdb2('0x14')]][_0xbdb2('0xb')](_0x5ae803)[_0xbdb2('0x7')](function(_0x1491b3){var _0x370caf=[];_0x1491b3['forEach'](function(_0x41f4b3){var _0x414910;switch(_0x41f4b3[_0xbdb2('0xa9')]){case _0xbdb2('0xaa'):_0x414910=_['find'](_0x1e66d7[_0xbdb2('0x8')],function(_0xcafa84){return _0xcafa84['id']===_0x41f4b3[_0xbdb2('0x79')]&&_0xcafa84['type']===_0xbdb2('0xab');});break;case _0xbdb2('0xac'):_0x414910=_[_0xbdb2('0x92')](_0x1e66d7['associatedResources'],function(_0x331a0d){return _0x331a0d['id']===_0x41f4b3[_0xbdb2('0x79')]&&_0x331a0d[_0xbdb2('0x38')]===_0xbdb2('0xad');});break;}if(_0x414910)_0x370caf['push'](_0x41f4b3);});_0x5865e8['count']=_0x370caf[_0xbdb2('0x91')];_0x5865e8['rows']=_0x370caf;return _0x5865e8;});}else{if(!_[_0xbdb2('0x90')](_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xae')])){_0x5ae803[_0xbdb2('0x86')]['id']=_0x5ae803[_0xbdb2('0x86')]['id']?_[_0xbdb2('0x9a')](_0x5ae803['where']['id'],_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xae')]):_0x43e263['query']['ids'];if(_0x43e263['query'][_0xbdb2('0xaf')]){_0x5ae803[_0xbdb2('0xa1')]=_0x43e263[_0xbdb2('0x88')]['customSorting'];}}if(_0x43e263[_0xbdb2('0x88')]['extraQueryConditions']){_0x5ae803[_0xbdb2('0x86')]=_[_0xbdb2('0xa4')](_0x5ae803[_0xbdb2('0x86')],{'$and':_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xb0')]});}return _0x555c4f[_0x1fe71b[_0xbdb2('0x14')]][_0xbdb2('0xb1')]({'where':_0x5ae803['where']})['then'](function(_0x2095dd){_0x5865e8['count']=_0x2095dd;if(_0x43e263['query']['includeAll']){if(_0x1fe71b['childModel']===_0xbdb2('0x1c')){_0x5ae803[_0xbdb2('0xb2')]=[{'model':_0x555c4f[_0xbdb2('0x6d')],'as':_0xbdb2('0xb3'),'attributes':['id',_0xbdb2('0xc'),_0xbdb2('0xb4')],'required':_0x43e263['query'][_0xbdb2('0xb5')]?!![]:![]},{'model':_0x555c4f[_0xbdb2('0x6d')],'as':'ThroughTags','attributes':['id',_0xbdb2('0xc'),_0xbdb2('0xb4')],'through':_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xb5')]?{'attributes':[],'where':{'TagId':_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xb5')]||undefined}}:{},'required':_0x43e263[_0xbdb2('0x88')]['tag']?!![]:![]}];}else{_0x5ae803[_0xbdb2('0xb2')]=[{'all':!![]}];}}return _0x555c4f[_0x1fe71b[_0xbdb2('0x14')]]['findAll'](_0x5ae803);})[_0xbdb2('0x7')](function(_0x3905ec){_0x5865e8[_0xbdb2('0xb6')]=_0x3905ec;if(_0x4a31b0===_0xbdb2('0x57')&&_0x43e263[_0xbdb2('0x88')][_0xbdb2('0xb7')]===_0xbdb2('0xb8')){var _0x70f40e=[];for(var _0x2a1f8b=0x0;_0x2a1f8b<_0x5865e8[_0xbdb2('0xb6')][_0xbdb2('0x91')];_0x2a1f8b++){_0x70f40e[_0xbdb2('0x97')](_0x58fbad(_0xbdb2('0xb9'),_0x5865e8[_0xbdb2('0xb6')][_0x2a1f8b]['dataValues']));_0x70f40e[_0xbdb2('0x97')](_0x58fbad('sms',_0x5865e8[_0xbdb2('0xb6')][_0x2a1f8b][_0xbdb2('0xba')]));_0x70f40e[_0xbdb2('0x97')](_0x58fbad(_0xbdb2('0xbb'),_0x5865e8[_0xbdb2('0xb6')][_0x2a1f8b]['dataValues']));_0x70f40e[_0xbdb2('0x97')](_0x58fbad(_0xbdb2('0xbc'),_0x5865e8['rows'][_0x2a1f8b][_0xbdb2('0xba')]));_0x70f40e[_0xbdb2('0x97')](_0x58fbad(_0xbdb2('0xbd'),_0x5865e8[_0xbdb2('0xb6')][_0x2a1f8b][_0xbdb2('0xba')]));_0x70f40e[_0xbdb2('0x97')](_0x58fbad(_0xbdb2('0xbe'),_0x5865e8[_0xbdb2('0xb6')][_0x2a1f8b]['dataValues']));}return Promise[_0xbdb2('0x94')](_0x70f40e)[_0xbdb2('0x7')](function(){return _0x5865e8;});}return _0x5865e8;});}});}}});}; \ No newline at end of file +var _0x04b3=['FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','union','find','ignore','push','autoAssociation','all','keys','filters','attributes','fields','nolimit','limit','offset','sort','where','merge','key','foreignKey','forEach','options','includeAll','include','default','DefaultReports','custom','CustomReports','count','intersection','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','rows','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','value','findAll','then','associatedResources','map','model','name','catch','UserProfileResource','field','AnalyticExtractedReport','resourceId','squareprojects','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x04b3,0x1e2));var _0x304b=function(_0x4bff76,_0x571516){_0x4bff76=_0x4bff76-0x0;var _0x32bc68=_0x04b3[_0x4bff76];return _0x32bc68;};'use strict';var _=require(_0x304b('0x0'));var attributes=require(_0x304b('0x1'));var squel=require(_0x304b('0x2'));module[_0x304b('0x3')]=function(_0x2ed0b1){var _0x1e70b9=_0x2ed0b1[_0x304b('0x4')];function _0x31fa14(_0x1a6340,_0x41b8c0){return new Promise(function(_0x431ef1,_0x50de66){if(!_0x41b8c0)return _0x431ef1(null);var _0x1e9f79=_0x41b8c0[_0x304b('0x5')]?{[_0x41b8c0[_0x304b('0x5')]['field']]:_0x41b8c0[_0x304b('0x5')][_0x304b('0x6')]}:undefined;return _0x1e70b9[_0x1a6340][_0x304b('0x7')]({'where':_0x1e9f79,'raw':!![]})[_0x304b('0x8')](function(_0x18a242){_0x41b8c0[_0x304b('0x9')]=_[_0x304b('0xa')](_0x18a242,'id');_0x431ef1(_0x41b8c0);})['catch'](function(_0x108f99){_0x50de66(_0x108f99);});});}function _0xdc1c69(_0x846e2,_0x3cc98f){return new Promise(function(_0x818011,_0x13cdeb){var _0x29f159=_0x846e2['filter']?{[_0x846e2[_0x304b('0x5')]['field']]:_0x846e2[_0x304b('0x5')][_0x304b('0x6')]}:undefined;return _0x1e70b9[_0x846e2[_0x304b('0xb')]]['findAll']({'where':_0x29f159,'raw':!![]})['then'](function(_0x111b7f){_0x3cc98f['associatedResources']=_[_0x304b('0xa')](_0x111b7f,function(_0x4a6d97){return _0x4a6d97[_0x304b('0xc')];});_0x818011(_0x3cc98f);})[_0x304b('0xd')](function(_0x2a730e){_0x13cdeb(_0x2a730e);});});}function _0x4a50b7(_0x574f8b,_0x24eb7c,_0x54d720){if(!_0x24eb7c)return Promise['resolve'](null);return new Promise(function(_0x133fd8,_0x241cc0){return _0x1e70b9[_0x304b('0xe')][_0x304b('0x7')]({'where':{'sectionId':_0x24eb7c['id']},'raw':!![]})[_0x304b('0x8')](function(_0x1b60bc){if(_0x574f8b[_0x304b('0xf')]&&_0x574f8b[_0x304b('0xf')]!=='id'){_0x24eb7c[_0x304b('0x9')]=_['map'](_0x1b60bc,function(_0x6cf823){return _0x6cf823[_0x574f8b[_0x304b('0xf')]];});}else{if(_0x54d720===_0x304b('0x10')){_0x24eb7c[_0x304b('0x9')]=_['map'](_0x1b60bc,function(_0x2ba773){return{'id':_0x2ba773[_0x304b('0x11')],'type':_0x2ba773['type']};});}else{_0x24eb7c['associatedResources']=_[_0x304b('0xa')](_0x1b60bc,function(_0xf1e38d){return _0xf1e38d[_0x304b('0x11')];});}}_0x133fd8(_0x24eb7c);})['catch'](function(_0x1c88c0){_0x241cc0(_0x1c88c0);});});}function _0x595059(_0x1c2360,_0x6de022){var _0x1c2ddb={'parentSections':[]};switch(_0x1c2360['toLowerCase']()){case _0x304b('0x12'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x14');break;case'odbc':_0x1c2ddb['childModel']='SquareOdbc';break;case _0x304b('0x15'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x16');_0x1c2ddb[_0x304b('0x17')]=[{'name':_0x304b('0x18'),'field':_0x304b('0xc'),'foreignKey':_0x304b('0x19')}];break;case'projects':_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x1a');break;case'contacts':_0x1c2ddb['childModel']=_0x304b('0x1b');_0x1c2ddb[_0x304b('0x17')]=[{'name':_0x304b('0x1c'),'field':'id','foreignKey':_0x304b('0x1d')}];break;case'lists':_0x1c2ddb['childModel']=_0x304b('0x1e');break;case _0x304b('0x1f'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x20');break;case _0x304b('0x21'):_0x1c2ddb[_0x304b('0x13')]='CmCustomField';break;case _0x304b('0x22'):_0x1c2ddb['childModel']=_0x304b('0x23');break;case'chatwebsites':_0x1c2ddb['childModel']='ChatWebsite';break;case _0x304b('0x24'):_0x1c2ddb['childModel']=_0x304b('0x25');break;case _0x304b('0x26'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x27');break;case'inboundroutes':case'internalroutes':case _0x304b('0x28'):_0x1c2ddb[_0x304b('0x13')]='VoiceExtension';break;case _0x304b('0x29'):_0x1c2ddb[_0x304b('0x13')]='VoiceContext';break;case _0x304b('0x2a'):_0x1c2ddb['childModel']=_0x304b('0x2b');break;case _0x304b('0x2c'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x2d');_0x1c2ddb['parentSections']=[{'name':_0x304b('0x2e'),'field':_0x304b('0xc'),'foreignKey':_0x304b('0x2f'),'model':_0x304b('0x30'),'filter':{'field':_0x304b('0x31'),'value':[_0x304b('0x32')]}},{'name':_0x304b('0x33'),'field':_0x304b('0xc'),'foreignKey':_0x304b('0x2f'),'model':'User','filter':{'field':_0x304b('0x31'),'value':[_0x304b('0x34')]}},{'name':_0x304b('0x35'),'field':_0x304b('0xc'),'foreignKey':_0x304b('0x36'),'model':_0x304b('0x37'),'filter':{'field':_0x304b('0x38'),'value':[_0x304b('0x39')]}},{'name':_0x304b('0x3a'),'field':_0x304b('0xc'),'foreignKey':'queue','model':_0x304b('0x37'),'filter':{'field':'type','value':[_0x304b('0x3b')]}}];break;case'musiconholds':_0x1c2ddb[_0x304b('0x13')]='VoiceMusicOnHold';break;case _0x304b('0x3c'):_0x1c2ddb[_0x304b('0x13')]='VoiceChanSpy';break;case _0x304b('0x3d'):_0x1c2ddb['childModel']='VoicePrefix';break;case _0x304b('0x3e'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x3f');break;case _0x304b('0x40'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x41');break;case _0x304b('0x42'):_0x1c2ddb['childModel']='MailAccount';break;case _0x304b('0x43'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x44');break;case _0x304b('0x45'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x46');break;case _0x304b('0x47'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x48');break;case _0x304b('0x49'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x4a');break;case'smsaccounts':_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x4b');break;case _0x304b('0x4c'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x4d');break;case _0x304b('0x4e'):_0x1c2ddb['childModel']=_0x304b('0x4f');break;case _0x304b('0x50'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x51');break;case _0x304b('0x52'):case'queuecampaigns':_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x37');if(_0x6de022){_0x1c2ddb[_0x304b('0x17')]=[{'name':_0x304b('0x35')},{'name':_0x304b('0x3a')}];}break;case _0x304b('0x53'):case _0x304b('0x54'):case _0x304b('0x55'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x30');if(_0x6de022){_0x1c2ddb[_0x304b('0x17')]=[{'name':'Users','filter':{'field':_0x304b('0x31'),'value':['admin','user']},'ignore':!![]},{'name':_0x304b('0x2e')},{'name':_0x304b('0x33')}];}break;case _0x304b('0x56'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x57');break;case _0x304b('0x58'):_0x1c2ddb['childModel']=_0x304b('0x59');break;case _0x304b('0x5a'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x5b');break;case'sugarcrmaccounts':_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x5c');break;case _0x304b('0x5d'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x5e');break;case _0x304b('0x5f'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x60');break;case _0x304b('0x61'):_0x1c2ddb[_0x304b('0x13')]='User';break;case _0x304b('0x62'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x63');break;case _0x304b('0x64'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x65');break;case'customdashboards':_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x66');break;case _0x304b('0x67'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x68');break;case'pauses':_0x1c2ddb['childModel']=_0x304b('0x69');break;case _0x304b('0x6a'):_0x1c2ddb['childModel']=_0x304b('0x6b');break;case'sounds':_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x6c');break;case _0x304b('0x6d'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x6e');break;case _0x304b('0x6f'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x70');break;case _0x304b('0x71'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x72');break;case _0x304b('0x73'):_0x1c2ddb['childModel']=_0x304b('0x74');break;case _0x304b('0x75'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x76');break;case _0x304b('0x77'):_0x1c2ddb[_0x304b('0x13')]='Plugin';break;case _0x304b('0x78'):_0x1c2ddb[_0x304b('0x13')]=_0x304b('0x10');_0x1c2ddb[_0x304b('0x17')]=[{'name':'Reports','field':'id','foreignKey':_0x304b('0x79')}];break;case'metrics':_0x1c2ddb['childModel']=_0x304b('0x7a');break;}return _0x1c2ddb;}function _0x4b91f1(_0x1f0190,_0x12acbb){var _0x86bd17=_0x1f0190[_0x304b('0x7b')](0x0)[_0x304b('0x7c')]()+_0x1f0190['slice'](0x1);var _0x278e4e={'type':_0x1e70b9[_0x304b('0x7d')][_0x304b('0x7e')]['SELECT'],'raw':!![]};return new Promise(function(_0x5e7afd,_0x18c173){var _0x26fbd9=squel[_0x304b('0x7f')]()['field']('ui.'+_0x86bd17+_0x304b('0x80'),'id')[_0x304b('0xf')]('ui.createdAt')[_0x304b('0x81')](_0x304b('0x82')+_0x1f0190+_0x304b('0x83'),'ui')['where'](_0x304b('0x84'),_0x12acbb['id']);return _0x1e70b9[_0x304b('0x85')][_0x304b('0x86')](_0x26fbd9[_0x304b('0x87')](),_0x278e4e)[_0x304b('0x8')](function(_0x1448e6){_0x12acbb[_0x86bd17+_0x304b('0x88')]=_0x1448e6;_0x5e7afd(_0x1448e6);})[_0x304b('0xd')](function(_0x447e5f){_0x18c173(_0x447e5f);});});}return _0x2ed0b1['define'](_0x304b('0x89'),attributes,{'tableName':_0x304b('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3cd80c){var _0x204c41=require(_0x304b('0x8b'));var _0x38ad85={'raw':_0x3cd80c[_0x304b('0x86')][_0x304b('0x8c')],'where':{}};var _0xe2a7d2={};var _0x5c4dea={'count':0x0,'rows':[]};var _0x20911a=_0x3cd80c[_0x304b('0x86')][_0x304b('0x8d')];var _0x2976b4=_0x3cd80c[_0x304b('0x86')][_0x304b('0x8e')]||![];var _0x138ba0=_0x595059(_0x20911a,_0x2976b4);if(!_0x138ba0['childModel'])throw new Error(_0x304b('0x8f')+_0x20911a+'\x27');var _0xb48064=[{'name':_0x20911a}];if(!_[_0x304b('0x90')](_0x138ba0[_0x304b('0x17')]))_0xb48064=_0x138ba0['parentSections'];var _0x4565f2=[];for(var _0x121f61=0x0;_0x121f61<_0xb48064[_0x304b('0x91')];_0x121f61++){_0x4565f2['push'](_0x1e70b9[_0x304b('0x92')]['find']({'where':{'userProfileId':_0x3cd80c['params']['id'],'name':_0xb48064[_0x121f61][_0x304b('0xc')]},'raw':!![]}));}return Promise['all'](_0x4565f2)[_0x304b('0x8')](function(_0x58a1d6){var _0x36637f=_['filter'](_0x58a1d6,function(_0x4cf9fd){return _0x4cf9fd?_0x4cf9fd:undefined;});var _0x2b6ff9=_[_0x304b('0x5')](_0xb48064,['ignore',!![]]);var _0x3469b0=_[_0x304b('0x90')](_0x36637f)&&_[_0x304b('0x90')](_0x2b6ff9)?null:_[_0x304b('0x93')](_0x2b6ff9,_0x36637f);if(!_0x3469b0)return null;var _0x4bbfa1=[];for(var _0x39cc1c=0x0;_0x39cc1c<_0x3469b0[_0x304b('0x91')];_0x39cc1c++){var _0x5bf414=_[_0x304b('0x94')](_0xb48064,function(_0x4f2ace){return _0x3469b0[_0x39cc1c]?_0x4f2ace[_0x304b('0xc')]===_0x3469b0[_0x39cc1c][_0x304b('0xc')]:null;});if(_0x5bf414){if(_0x3469b0[_0x39cc1c][_0x304b('0x95')]){_0x4bbfa1[_0x304b('0x96')](_0x31fa14(_0x138ba0['childModel'],_0x3469b0[_0x39cc1c]));}else{if(!_0x3469b0[_0x39cc1c][_0x304b('0x97')]){_0x4bbfa1[_0x304b('0x96')](_0x4a50b7(_0x5bf414,_0x3469b0[_0x39cc1c],_0x138ba0['childModel']));}else{if(_0x5bf414[_0x304b('0xb')]){_0x4bbfa1[_0x304b('0x96')](_0xdc1c69(_0x5bf414,_0x3469b0[_0x39cc1c]));}}}}}return Promise[_0x304b('0x98')](_0x4bbfa1);})['then'](function(_0x2a1dec){var _0x42ad3b=_0x2a1dec;var _0x200ab0=null;if(_0x42ad3b){_0x200ab0=_0x42ad3b[_0x304b('0x91')]===0x1?_0x42ad3b[0x0]:null;}if(!_0x200ab0&&!_0x42ad3b)return _0x5c4dea;var _0x4986c9=_0x1e70b9[_0x138ba0[_0x304b('0x13')]]['rawAttributes'];_0xe2a7d2[_0x304b('0xb')]=_[_0x304b('0x99')](_0x4986c9);_0xe2a7d2[_0x304b('0x86')]=_[_0x304b('0x99')](_0x3cd80c['query']);_0xe2a7d2[_0x304b('0x9a')]=_['intersection'](_0xe2a7d2[_0x304b('0xb')],_0xe2a7d2[_0x304b('0x86')]);_0x38ad85[_0x304b('0x9b')]=_['intersection'](_0xe2a7d2['model'],_0x204c41['fields'](_0x3cd80c[_0x304b('0x86')][_0x304b('0x9c')]));_0x38ad85[_0x304b('0x9b')]=_0x38ad85[_0x304b('0x9b')]['length']?_0x38ad85[_0x304b('0x9b')]:_0xe2a7d2['model'];if(!_0x3cd80c[_0x304b('0x86')]['hasOwnProperty'](_0x304b('0x9d'))){_0x38ad85[_0x304b('0x9e')]=_0x204c41[_0x304b('0x9e')](_0x3cd80c[_0x304b('0x86')][_0x304b('0x9e')]);_0x38ad85[_0x304b('0x9f')]=_0x204c41[_0x304b('0x9f')](_0x3cd80c['query'][_0x304b('0x9f')]);}_0x38ad85['order']=_0x204c41['sort'](_0x3cd80c[_0x304b('0x86')][_0x304b('0xa0')]);_0x38ad85[_0x304b('0xa1')]=_0x204c41[_0x304b('0x9a')](_['pick'](_0x3cd80c['query'],_0xe2a7d2[_0x304b('0x9a')]));if(_0x3cd80c[_0x304b('0x86')][_0x304b('0x5')]){_0x38ad85[_0x304b('0xa1')]=_[_0x304b('0xa2')](_0x38ad85[_0x304b('0xa1')],{'$or':_['map'](_0x4986c9,function(_0x5036ef){if(_0x5036ef[_0x304b('0x38')][_0x304b('0xa3')]!=='VIRTUAL'){var _0x2590c4={};_0x2590c4[_0x5036ef['field']]={'$like':'%'+_0x3cd80c[_0x304b('0x86')]['filter']+'%'};return _0x2590c4;}})});}var _0x16d380=[];var _0x3ec70e=null;var _0x4c1492={};if(_0x200ab0){_0x3ec70e=_[_0x304b('0x94')](_0xb48064,['name',_0x200ab0[_0x304b('0xc')]]);if(_0x3ec70e[_0x304b('0xf')]){_0x4c1492={};if(_0x138ba0[_0x304b('0x13')]===_0x304b('0x10')){_0x4c1492[_0x3ec70e[_0x304b('0xa4')]]=_['map'](_0x200ab0[_0x304b('0x9')],'id');}else{_0x4c1492[_0x3ec70e[_0x304b('0xa4')]]=_0x200ab0[_0x304b('0x9')];}_0x16d380[_0x304b('0x96')](_0x4c1492);}else{_0x38ad85[_0x304b('0xa1')]['id']=_0x200ab0[_0x304b('0x9')];}}else{for(var _0x5a96ea=0x0;_0x5a96ea<_0x42ad3b[_0x304b('0x91')];_0x5a96ea++){_0x3ec70e=_[_0x304b('0x94')](_0xb48064,['name',_0x42ad3b[_0x5a96ea][_0x304b('0xc')]]);if(_0x3ec70e[_0x304b('0xf')]){_0x4c1492={};_0x4c1492[_0x3ec70e[_0x304b('0xa4')]]=_0x42ad3b[_0x5a96ea]['associatedResources'];_0x16d380['push'](_0x4c1492);}else{if(!_0x38ad85[_0x304b('0xa1')]['id'])_0x38ad85[_0x304b('0xa1')]['id']=[];_0x42ad3b[_0x5a96ea]['associatedResources'][_0x304b('0xa5')](function(_0x4b2313){_0x38ad85[_0x304b('0xa1')]['id'][_0x304b('0x96')](_0x4b2313);});}}}if(!_[_0x304b('0x90')](_0x16d380)){_0x38ad85['where']=_[_0x304b('0xa2')](_0x38ad85['where'],{'$and':{'$or':_0x16d380}});}_0x38ad85=_[_0x304b('0xa2')]({},_0x38ad85,_0x3cd80c[_0x304b('0xa6')]);if(_0x200ab0&&!_0x200ab0[_0x304b('0x97')]&&_0x138ba0[_0x304b('0x13')]===_0x304b('0x10')){if(_0x3cd80c[_0x304b('0x86')][_0x304b('0xa7')]){_0x38ad85[_0x304b('0xa8')]=[{'all':!![]}];}return _0x1e70b9[_0x138ba0[_0x304b('0x13')]]['findAll'](_0x38ad85)[_0x304b('0x8')](function(_0x38c4ac){var _0xe0c1b=[];_0x38c4ac[_0x304b('0xa5')](function(_0x217e4a){var _0x4298f5;switch(_0x217e4a['reportType']){case _0x304b('0xa9'):_0x4298f5=_[_0x304b('0x94')](_0x200ab0['associatedResources'],function(_0x333a60){return _0x333a60['id']===_0x217e4a[_0x304b('0x79')]&&_0x333a60[_0x304b('0x38')]===_0x304b('0xaa');});break;case _0x304b('0xab'):_0x4298f5=_[_0x304b('0x94')](_0x200ab0[_0x304b('0x9')],function(_0x1078bd){return _0x1078bd['id']===_0x217e4a[_0x304b('0x79')]&&_0x1078bd['type']===_0x304b('0xac');});break;}if(_0x4298f5)_0xe0c1b[_0x304b('0x96')](_0x217e4a);});_0x5c4dea[_0x304b('0xad')]=_0xe0c1b['length'];_0x5c4dea['rows']=_0xe0c1b;return _0x5c4dea;});}else{if(!_[_0x304b('0x90')](_0x3cd80c[_0x304b('0x86')]['ids'])){_0x38ad85[_0x304b('0xa1')]['id']=_0x38ad85[_0x304b('0xa1')]['id']?_[_0x304b('0xae')](_0x38ad85[_0x304b('0xa1')]['id'],_0x3cd80c[_0x304b('0x86')][_0x304b('0xaf')]):_0x3cd80c[_0x304b('0x86')][_0x304b('0xaf')];if(_0x3cd80c[_0x304b('0x86')][_0x304b('0xb0')]){_0x38ad85['order']=_0x3cd80c[_0x304b('0x86')][_0x304b('0xb0')];}}if(_0x3cd80c[_0x304b('0x86')][_0x304b('0xb1')]){_0x38ad85[_0x304b('0xa1')]=_[_0x304b('0xa2')](_0x38ad85['where'],{'$and':_0x3cd80c['query']['extraQueryConditions']});}return _0x1e70b9[_0x138ba0['childModel']][_0x304b('0xad')]({'where':_0x38ad85[_0x304b('0xa1')]})[_0x304b('0x8')](function(_0x35a2fa){_0x5c4dea['count']=_0x35a2fa;if(_0x3cd80c['query'][_0x304b('0xa7')]){if(_0x138ba0[_0x304b('0x13')]==='CmContact'){_0x38ad85['include']=[{'model':_0x1e70b9[_0x304b('0x6e')],'as':_0x304b('0xb2'),'attributes':['id',_0x304b('0xc'),_0x304b('0xb3')],'required':_0x3cd80c['query'][_0x304b('0xb4')]?!![]:![]},{'model':_0x1e70b9[_0x304b('0x6e')],'as':_0x304b('0xb5'),'attributes':['id',_0x304b('0xc'),_0x304b('0xb3')],'through':_0x3cd80c[_0x304b('0x86')][_0x304b('0xb4')]?{'attributes':[],'where':{'TagId':_0x3cd80c['query'][_0x304b('0xb4')]||undefined}}:{},'required':_0x3cd80c[_0x304b('0x86')]['tag']?!![]:![]}];}else{_0x38ad85[_0x304b('0xa8')]=[{'all':!![]}];}}return _0x1e70b9[_0x138ba0[_0x304b('0x13')]][_0x304b('0x7')](_0x38ad85);})[_0x304b('0x8')](function(_0x131c13){_0x5c4dea[_0x304b('0xb6')]=_0x131c13;if(_0x20911a===_0x304b('0x2e')&&_0x3cd80c[_0x304b('0x86')]['openTabs']===_0x304b('0xb7')){var _0x4adeaa=[];for(var _0x3378f3=0x0;_0x3378f3<_0x5c4dea[_0x304b('0xb6')][_0x304b('0x91')];_0x3378f3++){_0x4adeaa[_0x304b('0x96')](_0x4b91f1(_0x304b('0xb8'),_0x5c4dea[_0x304b('0xb6')][_0x3378f3][_0x304b('0xb9')]));_0x4adeaa[_0x304b('0x96')](_0x4b91f1(_0x304b('0xba'),_0x5c4dea[_0x304b('0xb6')][_0x3378f3][_0x304b('0xb9')]));_0x4adeaa[_0x304b('0x96')](_0x4b91f1(_0x304b('0xbb'),_0x5c4dea[_0x304b('0xb6')][_0x3378f3][_0x304b('0xb9')]));_0x4adeaa[_0x304b('0x96')](_0x4b91f1(_0x304b('0xbc'),_0x5c4dea[_0x304b('0xb6')][_0x3378f3][_0x304b('0xb9')]));_0x4adeaa[_0x304b('0x96')](_0x4b91f1(_0x304b('0xbd'),_0x5c4dea[_0x304b('0xb6')][_0x3378f3]['dataValues']));_0x4adeaa['push'](_0x4b91f1(_0x304b('0xbe'),_0x5c4dea['rows'][_0x3378f3][_0x304b('0xb9')]));}return Promise[_0x304b('0x98')](_0x4adeaa)[_0x304b('0x8')](function(){return _0x5c4dea;});}return _0x5c4dea;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 4256dff..f31b595 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 _0xfba8=['error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x424cca,_0x54d428){var _0xabe8fa=function(_0x102290){while(--_0x102290){_0x424cca['push'](_0x424cca['shift']());}};_0xabe8fa(++_0x54d428);}(_0xfba8,0x1d6));var _0x8fba=function(_0x461c30,_0x2e809a){_0x461c30=_0x461c30-0x0;var _0x40ab1c=_0xfba8[_0x461c30];return _0x40ab1c;};'use strict';var _=require(_0x8fba('0x0'));var util=require(_0x8fba('0x1'));var moment=require(_0x8fba('0x2'));var BPromise=require(_0x8fba('0x3'));var rs=require(_0x8fba('0x4'));var fs=require('fs');var Redis=require(_0x8fba('0x5'));var db=require(_0x8fba('0x6'))['db'];var utils=require(_0x8fba('0x7'));var logger=require(_0x8fba('0x8'))('rpc');var config=require(_0x8fba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8fba('0xa')][_0x8fba('0xb')]({'port':0x232a});config[_0x8fba('0xc')]=_[_0x8fba('0xd')](config[_0x8fba('0xc')],{'host':_0x8fba('0xe'),'port':0x18eb});var socket=require(_0x8fba('0xf'))(new Redis(config['redis']));require(_0x8fba('0x10'))['register'](socket);function respondWithRpcPromise(_0x352eda,_0x228103,_0x3816fc){return new BPromise(function(_0x139921,_0x47dda0){return client[_0x8fba('0x11')](_0x352eda,_0x3816fc)[_0x8fba('0x12')](function(_0x526513){logger[_0x8fba('0x13')](_0x8fba('0x14'),_0x228103,'request\x20sent');logger['debug'](_0x8fba('0x15'),_0x228103,'request\x20sent',JSON[_0x8fba('0x16')](_0x526513));if(_0x526513[_0x8fba('0x17')]){if(_0x526513[_0x8fba('0x17')][_0x8fba('0x18')]===0x1f4){logger[_0x8fba('0x17')](_0x8fba('0x14'),_0x228103,_0x526513['error']['message']);return _0x47dda0(_0x526513[_0x8fba('0x17')][_0x8fba('0x19')]);}logger[_0x8fba('0x17')](_0x8fba('0x14'),_0x228103,_0x526513[_0x8fba('0x17')][_0x8fba('0x19')]);return _0x139921(_0x526513['error'][_0x8fba('0x19')]);}else{logger[_0x8fba('0x13')](_0x8fba('0x14'),_0x228103,_0x8fba('0x1a'));_0x139921(_0x526513[_0x8fba('0x1b')][_0x8fba('0x19')]);}})[_0x8fba('0x1c')](function(_0x1e9cf9){logger['error'](_0x8fba('0x14'),_0x228103,_0x1e9cf9);_0x47dda0(_0x1e9cf9);});});} \ No newline at end of file +var _0xf02c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4d2c26,_0x2701f9){var _0x5bf9b4=function(_0x52edc6){while(--_0x52edc6){_0x4d2c26['push'](_0x4d2c26['shift']());}};_0x5bf9b4(++_0x2701f9);}(_0xf02c,0x92));var _0xcf02=function(_0x9cb814,_0x1b1165){_0x9cb814=_0x9cb814-0x0;var _0x504348=_0xf02c[_0x9cb814];return _0x504348;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require(_0xcf02('0x8'))(_0xcf02('0x9'));var config=require(_0xcf02('0xa'));var jayson=require(_0xcf02('0xb'));var client=jayson[_0xcf02('0xc')][_0xcf02('0xd')]({'port':0x232a});config[_0xcf02('0xe')]=_['defaults'](config[_0xcf02('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf02('0xf'))[_0xcf02('0x10')](socket);function respondWithRpcPromise(_0x1411e5,_0x1c9cda,_0x5bd27c){return new BPromise(function(_0x70fe11,_0x2c0978){return client[_0xcf02('0x11')](_0x1411e5,_0x5bd27c)['then'](function(_0x48c0d8){logger[_0xcf02('0x12')](_0xcf02('0x13'),_0x1c9cda,_0xcf02('0x14'));logger[_0xcf02('0x15')](_0xcf02('0x16'),_0x1c9cda,'request\x20sent',JSON[_0xcf02('0x17')](_0x48c0d8));if(_0x48c0d8[_0xcf02('0x18')]){if(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x19')]===0x1f4){logger[_0xcf02('0x18')](_0xcf02('0x13'),_0x1c9cda,_0x48c0d8[_0xcf02('0x18')]['message']);return _0x2c0978(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);}logger[_0xcf02('0x18')]('UserProfile,\x20%s,\x20%s',_0x1c9cda,_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);return _0x70fe11(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x1c9cda,'request\x20sent');_0x70fe11(_0x48c0d8[_0xcf02('0x1b')]['message']);}})[_0xcf02('0x1c')](function(_0x1cac37){logger[_0xcf02('0x18')](_0xcf02('0x13'),_0x1c9cda,_0x1cac37);_0x2c0978(_0x1cac37);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 81ee685..33cc3e2 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 _0x3187=['emit','removeListener','register','length','./userProfile.events','save','remove'];(function(_0xdfc87d,_0x28e1a5){var _0x4e2a5e=function(_0x55f2f7){while(--_0x55f2f7){_0xdfc87d['push'](_0xdfc87d['shift']());}};_0x4e2a5e(++_0x28e1a5);}(_0x3187,0x1c4));var _0x7318=function(_0x5a08ef,_0x9caee2){_0x5a08ef=_0x5a08ef-0x0;var _0x37ed82=_0x3187[_0x5a08ef];return _0x37ed82;};'use strict';var UserProfileEvents=require(_0x7318('0x0'));var events=[_0x7318('0x1'),_0x7318('0x2'),'update'];function createListener(_0x111fd8,_0xc70fe0){return function(_0x4c63e4){_0xc70fe0[_0x7318('0x3')](_0x111fd8,_0x4c63e4);};}function removeListener(_0x49f1da,_0x13d8f6){return function(){UserProfileEvents[_0x7318('0x4')](_0x49f1da,_0x13d8f6);};}exports[_0x7318('0x5')]=function(_0xd0e0da){for(var _0x428019=0x0,_0x153acb=events[_0x7318('0x6')];_0x428019<_0x153acb;_0x428019++){var _0x5ba41c=events[_0x428019];var _0x4765fd=createListener('userProfile:'+_0x5ba41c,_0xd0e0da);UserProfileEvents['on'](_0x5ba41c,_0x4765fd);}}; \ No newline at end of file +var _0xa8b3=['save','remove','update','removeListener','register','userProfile:','./userProfile.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8b3,0x1d4));var _0x3a8b=function(_0x53d3b0,_0x62aa42){_0x53d3b0=_0x53d3b0-0x0;var _0x44f608=_0xa8b3[_0x53d3b0];return _0x44f608;};'use strict';var UserProfileEvents=require(_0x3a8b('0x0'));var events=[_0x3a8b('0x1'),_0x3a8b('0x2'),_0x3a8b('0x3')];function createListener(_0x591bf0,_0x426953){return function(_0x56f042){_0x426953['emit'](_0x591bf0,_0x56f042);};}function removeListener(_0x2a483c,_0xbad3bf){return function(){UserProfileEvents[_0x3a8b('0x4')](_0x2a483c,_0xbad3bf);};}exports[_0x3a8b('0x5')]=function(_0x2585fc){for(var _0x377654=0x0,_0x1da3e3=events['length'];_0x377654<_0x1da3e3;_0x377654++){var _0x461616=events[_0x377654];var _0x49333f=createListener(_0x3a8b('0x6')+_0x461616,_0x2585fc);UserProfileEvents['on'](_0x461616,_0x49333f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c8de2ab..6273194 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 _0x31fb=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x31fb,0x1cf));var _0xb31f=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x31fb[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xb31f('0x0'));var util=require(_0xb31f('0x1'));var path=require(_0xb31f('0x2'));var timeout=require(_0xb31f('0x3'));var express=require(_0xb31f('0x4'));var router=express[_0xb31f('0x5')]();var fs_extra=require(_0xb31f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb31f('0x7'));var config=require(_0xb31f('0x8'));var controller=require(_0xb31f('0x9'));router['get']('/',auth[_0xb31f('0xa')](),controller[_0xb31f('0xb')]);router[_0xb31f('0xc')](_0xb31f('0xd'),auth[_0xb31f('0xa')](),controller[_0xb31f('0xe')]);router[_0xb31f('0xc')](_0xb31f('0xf'),auth[_0xb31f('0xa')](),controller[_0xb31f('0x10')]);router[_0xb31f('0x11')]('/',auth[_0xb31f('0xa')](),controller[_0xb31f('0x12')]);router[_0xb31f('0x13')](_0xb31f('0xf'),auth['isAuthenticated'](),controller[_0xb31f('0x14')]);router[_0xb31f('0x15')](_0xb31f('0xf'),auth[_0xb31f('0xa')](),controller[_0xb31f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2b67=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x1b1100,_0x45e5c2){var _0x3e5e16=function(_0x1d4370){while(--_0x1d4370){_0x1b1100['push'](_0x1b1100['shift']());}};_0x3e5e16(++_0x45e5c2);}(_0x2b67,0x13e));var _0x72b6=function(_0x291583,_0x36ad03){_0x291583=_0x291583-0x0;var _0x5665ed=_0x2b67[_0x291583];return _0x5665ed;};'use strict';var multer=require(_0x72b6('0x0'));var util=require('util');var path=require(_0x72b6('0x1'));var timeout=require(_0x72b6('0x2'));var express=require(_0x72b6('0x3'));var router=express[_0x72b6('0x4')]();var fs_extra=require(_0x72b6('0x5'));var auth=require(_0x72b6('0x6'));var interaction=require(_0x72b6('0x7'));var config=require(_0x72b6('0x8'));var controller=require(_0x72b6('0x9'));router[_0x72b6('0xa')]('/',auth[_0x72b6('0xb')](),controller['index']);router['get'](_0x72b6('0xc'),auth['isAuthenticated'](),controller[_0x72b6('0xd')]);router[_0x72b6('0xa')](_0x72b6('0xe'),auth[_0x72b6('0xb')](),controller[_0x72b6('0xf')]);router[_0x72b6('0x10')]('/',auth['isAuthenticated'](),controller[_0x72b6('0x11')]);router['put'](_0x72b6('0xe'),auth[_0x72b6('0xb')](),controller[_0x72b6('0x12')]);router['delete'](_0x72b6('0xe'),auth[_0x72b6('0xb')](),controller[_0x72b6('0x13')]);module[_0x72b6('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 11e6143..0d64b76 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 _0x6967=['sequelize','exports','STRING'];(function(_0x1bd73b,_0x3de91e){var _0x15490=function(_0x5bce5d){while(--_0x5bce5d){_0x1bd73b['push'](_0x1bd73b['shift']());}};_0x15490(++_0x3de91e);}(_0x6967,0x78));var _0x7696=function(_0x1d0bc5,_0x2f6d77){_0x1d0bc5=_0x1d0bc5-0x0;var _0x2124cc=_0x6967[_0x1d0bc5];return _0x2124cc;};'use strict';var Sequelize=require(_0x7696('0x0'));module[_0x7696('0x1')]={'name':{'type':Sequelize[_0x7696('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x7696('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfe34=['sequelize','exports','STRING'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xfe34,0xb4));var _0x4fe3=function(_0x84b79c,_0xb11dd4){_0x84b79c=_0x84b79c-0x0;var _0x3a09a1=_0xfe34[_0x84b79c];return _0x3a09a1;};'use strict';var Sequelize=require(_0x4fe3('0x0'));module[_0x4fe3('0x1')]={'name':{'type':Sequelize[_0x4fe3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x4fe3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c37bab0..a31f0f3 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x140fd6,_0x5d8037){var _0x16a6ad=function(_0x5adbf7){while(--_0x5adbf7){_0x140fd6['push'](_0x140fd6['shift']());}};_0x16a6ad(++_0x5d8037);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2053f1,_0x46e45d){_0x2053f1=_0x2053f1-0x0;var _0x4d80d2=_0x5f2f[_0x2053f1];return _0x4d80d2;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +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(_0xfde719,_0x128ccf){var _0x51fa79=function(_0x208141){while(--_0x208141){_0xfde719['push'](_0xfde719['shift']());}};_0x51fa79(++_0x128ccf);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3360e9,_0xa46861){_0x3360e9=_0x3360e9-0x0;var _0x53f022=_0xc1c6[_0x3360e9];return _0x53f022;};'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 diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1dff911..87e1fa1 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 _0xc7ec=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x2cc3ba,_0x348627){var _0x48b125=function(_0x7f409){while(--_0x7f409){_0x2cc3ba['push'](_0x2cc3ba['shift']());}};_0x48b125(++_0x348627);}(_0xc7ec,0x1b6));var _0xcc7e=function(_0x484e74,_0x4e62bd){_0x484e74=_0x484e74-0x0;var _0x2874fa=_0xc7ec[_0x484e74];return _0x2874fa;};'use strict';var _=require(_0xcc7e('0x0'));var util=require(_0xcc7e('0x1'));var logger=require('../../config/logger')(_0xcc7e('0x2'));var moment=require('moment');var BPromise=require(_0xcc7e('0x3'));var rp=require(_0xcc7e('0x4'));var fs=require('fs');var path=require(_0xcc7e('0x5'));var rimraf=require(_0xcc7e('0x6'));var config=require(_0xcc7e('0x7'));var attributes=require(_0xcc7e('0x8'));module[_0xcc7e('0x9')]=function(_0x406f10,_0x198c71){return _0x406f10[_0xcc7e('0xa')](_0xcc7e('0xb'),attributes,{'tableName':_0xcc7e('0xc'),'paranoid':![],'indexes':[{'name':_0xcc7e('0xd'),'fields':[_0xcc7e('0xe'),_0xcc7e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ed2=['request-promise','path','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','bluebird'];(function(_0x5bad56,_0x146f81){var _0x17abe3=function(_0x496d33){while(--_0x496d33){_0x5bad56['push'](_0x5bad56['shift']());}};_0x17abe3(++_0x146f81);}(_0x7ed2,0x192));var _0x27ed=function(_0x4e0fd6,_0x16bc28){_0x4e0fd6=_0x4e0fd6-0x0;var _0x50a6ef=_0x7ed2[_0x4e0fd6];return _0x50a6ef;};'use strict';var _=require(_0x27ed('0x0'));var util=require(_0x27ed('0x1'));var logger=require(_0x27ed('0x2'))('api');var moment=require('moment');var BPromise=require(_0x27ed('0x3'));var rp=require(_0x27ed('0x4'));var fs=require('fs');var path=require(_0x27ed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x27ed('0x6'));module[_0x27ed('0x7')]=function(_0x204f22,_0x3e6f0c){return _0x204f22[_0x27ed('0x8')](_0x27ed('0x9'),attributes,{'tableName':_0x27ed('0xa'),'paranoid':![],'indexes':[{'name':_0x27ed('0xb'),'fields':[_0x27ed('0xc'),_0x27ed('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 d47f057..86cb698 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 _0x6079=['request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','UserProfileResource,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6079,0x181));var _0x9607=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x6079[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x9607('0x0'));var util=require(_0x9607('0x1'));var moment=require(_0x9607('0x2'));var BPromise=require(_0x9607('0x3'));var rs=require(_0x9607('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9607('0x5'))['db'];var utils=require(_0x9607('0x6'));var logger=require('../../config/logger')(_0x9607('0x7'));var config=require(_0x9607('0x8'));var jayson=require(_0x9607('0x9'));var client=jayson[_0x9607('0xa')][_0x9607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5f69,_0x513676,_0x23b04a){return new BPromise(function(_0x5d07ea,_0x51739a){return client[_0x9607('0xc')](_0x4f5f69,_0x23b04a)['then'](function(_0x314d7a){logger['info'](_0x9607('0xd'),_0x513676,_0x9607('0xe'));logger[_0x9607('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x513676,_0x9607('0xe'),JSON[_0x9607('0x10')](_0x314d7a));if(_0x314d7a[_0x9607('0x11')]){if(_0x314d7a[_0x9607('0x11')]['code']===0x1f4){logger[_0x9607('0x11')](_0x9607('0xd'),_0x513676,_0x314d7a['error'][_0x9607('0x12')]);return _0x51739a(_0x314d7a[_0x9607('0x11')][_0x9607('0x12')]);}logger[_0x9607('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x513676,_0x314d7a[_0x9607('0x11')]['message']);return _0x5d07ea(_0x314d7a[_0x9607('0x11')][_0x9607('0x12')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x513676,'request\x20sent');_0x5d07ea(_0x314d7a['result'][_0x9607('0x12')]);}})['catch'](function(_0x376a9e){logger[_0x9607('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x513676,_0x376a9e);_0x51739a(_0x376a9e);});});} \ No newline at end of file +var _0xefcd=['rpc','../../config/environment','client','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xefcd,0x9a));var _0xdefc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xefcd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xdefc('0x0'));var util=require('util');var moment=require(_0xdefc('0x1'));var BPromise=require('bluebird');var rs=require(_0xdefc('0x2'));var fs=require('fs');var Redis=require(_0xdefc('0x3'));var db=require(_0xdefc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdefc('0x5'))(_0xdefc('0x6'));var config=require(_0xdefc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdefc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56082a,_0x445343,_0x230355){return new BPromise(function(_0x5eb66f,_0x3a15b6){return client['request'](_0x56082a,_0x230355)[_0xdefc('0x9')](function(_0x3369d){logger[_0xdefc('0xa')](_0xdefc('0xb'),_0x445343,'request\x20sent');logger[_0xdefc('0xc')](_0xdefc('0xd'),_0x445343,_0xdefc('0xe'),JSON[_0xdefc('0xf')](_0x3369d));if(_0x3369d[_0xdefc('0x10')]){if(_0x3369d[_0xdefc('0x10')]['code']===0x1f4){logger[_0xdefc('0x10')](_0xdefc('0xb'),_0x445343,_0x3369d[_0xdefc('0x10')]['message']);return _0x3a15b6(_0x3369d[_0xdefc('0x10')][_0xdefc('0x11')]);}logger[_0xdefc('0x10')](_0xdefc('0xb'),_0x445343,_0x3369d['error'][_0xdefc('0x11')]);return _0x5eb66f(_0x3369d[_0xdefc('0x10')][_0xdefc('0x11')]);}else{logger[_0xdefc('0xa')](_0xdefc('0xb'),_0x445343,_0xdefc('0xe'));_0x5eb66f(_0x3369d[_0xdefc('0x12')][_0xdefc('0x11')]);}})[_0xdefc('0x13')](function(_0x135be1){logger[_0xdefc('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x445343,_0x135be1);_0x3a15b6(_0x135be1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6f22ef3..b472709 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 _0x3feb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x13023b,_0x51328e){var _0x458326=function(_0x24d4cf){while(--_0x24d4cf){_0x13023b['push'](_0x13023b['shift']());}};_0x458326(++_0x51328e);}(_0x3feb,0x19f));var _0xb3fe=function(_0x1432d3,_0x5f1988){_0x1432d3=_0x1432d3-0x0;var _0x582360=_0x3feb[_0x1432d3];return _0x582360;};'use strict';var multer=require(_0xb3fe('0x0'));var util=require(_0xb3fe('0x1'));var path=require(_0xb3fe('0x2'));var timeout=require(_0xb3fe('0x3'));var express=require(_0xb3fe('0x4'));var router=express[_0xb3fe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb3fe('0x6'));var interaction=require(_0xb3fe('0x7'));var config=require(_0xb3fe('0x8'));var controller=require(_0xb3fe('0x9'));router[_0xb3fe('0xa')]('/',auth[_0xb3fe('0xb')](),controller[_0xb3fe('0xc')]);router[_0xb3fe('0xa')](_0xb3fe('0xd'),auth[_0xb3fe('0xb')](),controller['describe']);router[_0xb3fe('0xa')](_0xb3fe('0xe'),auth[_0xb3fe('0xb')](),controller[_0xb3fe('0xf')]);router[_0xb3fe('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3fe('0x11')]('/:id',auth[_0xb3fe('0xb')](),controller[_0xb3fe('0x12')]);router['delete'](_0xb3fe('0xe'),auth[_0xb3fe('0xb')](),controller[_0xb3fe('0x13')]);module[_0xb3fe('0x14')]=router; \ No newline at end of file +var _0xed45=['create','delete','destroy','exports','path','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed45,0x1d4));var _0x5ed4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xed45[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ed4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ed4('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x5ed4('0x2'));var config=require(_0x5ed4('0x3'));var controller=require(_0x5ed4('0x4'));router[_0x5ed4('0x5')]('/',auth[_0x5ed4('0x6')](),controller[_0x5ed4('0x7')]);router[_0x5ed4('0x5')](_0x5ed4('0x8'),auth[_0x5ed4('0x6')](),controller[_0x5ed4('0x9')]);router[_0x5ed4('0x5')](_0x5ed4('0xa'),auth['isAuthenticated'](),controller[_0x5ed4('0xb')]);router['post']('/',auth[_0x5ed4('0x6')](),controller[_0x5ed4('0xc')]);router['put'](_0x5ed4('0xa'),auth[_0x5ed4('0x6')](),controller['update']);router[_0x5ed4('0xd')]('/:id',auth[_0x5ed4('0x6')](),controller[_0x5ed4('0xe')]);module[_0x5ed4('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5f4001f..3110d1b 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 _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x403b2b,_0x3e9c25){var _0x5ef7ff=function(_0xe865b8){while(--_0xe865b8){_0x403b2b['push'](_0x403b2b['shift']());}};_0x5ef7ff(++_0x3e9c25);}(_0xe605,0x92));var _0x5e60=function(_0x579be2,_0x31f3e8){_0x579be2=_0x579be2-0x0;var _0x2a81fd=_0xe605[_0x579be2];return _0x2a81fd;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x43192f,_0x45e191){var _0x227deb=function(_0x58a9c4){while(--_0x58a9c4){_0x43192f['push'](_0x43192f['shift']());}};_0x227deb(++_0x45e191);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4aa922,_0x3d9780){_0x4aa922=_0x4aa922-0x0;var _0xe786ac=_0x9ffd[_0x4aa922];return _0xe786ac;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 21a0873..ce0728e 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 _0xdb86=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','options','where','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb86,0xd3));var _0x6db8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb86[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6db8('0x0'));var rimraf=require(_0x6db8('0x1'));var zipdir=require(_0x6db8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db8('0x3'));var moment=require(_0x6db8('0x4'));var BPromise=require(_0x6db8('0x5'));var Mustache=require('mustache');var util=require(_0x6db8('0x6'));var path=require(_0x6db8('0x7'));var sox=require(_0x6db8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6db8('0x9'));var _=require(_0x6db8('0xa'));var squel=require(_0x6db8('0xb'));var crypto=require(_0x6db8('0xc'));var jsforce=require(_0x6db8('0xd'));var deskjs=require(_0x6db8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6db8('0xf'));var Papa=require(_0x6db8('0x10'));var Redis=require(_0x6db8('0x11'));var authService=require(_0x6db8('0x12'));var qs=require(_0x6db8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6db8('0x14'));var logger=require(_0x6db8('0x15'))(_0x6db8('0x16'));var utils=require(_0x6db8('0x17'));var config=require(_0x6db8('0x18'));var licenseUtil=require(_0x6db8('0x19'));var db=require(_0x6db8('0x1a'))['db'];function respondWithStatusCode(_0x123559,_0x548587){_0x548587=_0x548587||0xcc;return function(_0x1f63e0){if(_0x1f63e0){return _0x123559[_0x6db8('0x1b')](_0x548587);}return _0x123559['status'](_0x548587)[_0x6db8('0x1c')]();};}function respondWithResult(_0x416c96,_0x2c6683){_0x2c6683=_0x2c6683||0xc8;return function(_0x2203ef){if(_0x2203ef){return _0x416c96['status'](_0x2c6683)['json'](_0x2203ef);}};}function respondWithFilteredResult(_0x2b0ba9,_0x2c8cc4){return function(_0x3805b6){if(_0x3805b6){var _0x37b53b=typeof _0x2c8cc4[_0x6db8('0x1d')]===_0x6db8('0x1e')&&typeof _0x2c8cc4[_0x6db8('0x1f')]==='undefined';var _0x55a0c2=_0x3805b6[_0x6db8('0x20')];var _0x5837c5=_0x37b53b?0x0:_0x2c8cc4[_0x6db8('0x1d')];var _0x42530f=_0x37b53b?_0x3805b6[_0x6db8('0x20')]:_0x2c8cc4[_0x6db8('0x1d')]+_0x2c8cc4[_0x6db8('0x1f')];var _0x5c2085;if(_0x42530f>=_0x55a0c2){_0x42530f=_0x55a0c2;_0x5c2085=0xc8;}else{_0x5c2085=0xce;}_0x2b0ba9[_0x6db8('0x21')](_0x5c2085);return _0x2b0ba9[_0x6db8('0x22')]('Content-Range',_0x5837c5+'-'+_0x42530f+'/'+_0x55a0c2)[_0x6db8('0x23')](_0x3805b6);}return null;};}function patchUpdates(_0x98b343){return function(_0x5e83b0){try{jsonpatch[_0x6db8('0x24')](_0x5e83b0,_0x98b343,!![]);}catch(_0x2b02ef){return BPromise[_0x6db8('0x25')](_0x2b02ef);}return _0x5e83b0[_0x6db8('0x26')]();};}function saveUpdates(_0x1aad43,_0xb8f86b){return function(_0x57dcff){if(_0x57dcff){return _0x57dcff[_0x6db8('0x27')](_0x1aad43)[_0x6db8('0x28')](function(_0xccbce8){return _0xccbce8;});}return null;};}function removeEntity(_0x19a434,_0x24d72a){return function(_0x49259c){if(_0x49259c){return _0x49259c[_0x6db8('0x29')]()[_0x6db8('0x28')](function(){_0x19a434['status'](0xcc)[_0x6db8('0x1c')]();});}};}function handleEntityNotFound(_0x335f4f,_0x187cdc){return function(_0x3687dc){if(!_0x3687dc){_0x335f4f[_0x6db8('0x1b')](0x194);}return _0x3687dc;};}function handleError(_0x77d05b,_0x40d661){_0x40d661=_0x40d661||0x1f4;return function(_0xf3031f){logger[_0x6db8('0x2a')](_0xf3031f[_0x6db8('0x2b')]);if(_0xf3031f[_0x6db8('0x2c')]){delete _0xf3031f['name'];}_0x77d05b[_0x6db8('0x21')](_0x40d661)[_0x6db8('0x2d')](_0xf3031f);};}exports[_0x6db8('0x2e')]=function(_0x48bf90,_0x2b6a0d){var _0x4b7419={},_0x271613={},_0x157819={'count':0x0,'rows':[]};var _0x48c54f=_[_0x6db8('0x2f')](db[_0x6db8('0x30')][_0x6db8('0x31')],function(_0xd5b27c){return{'name':_0xd5b27c['fieldName'],'type':_0xd5b27c['type'][_0x6db8('0x32')]};});_0x271613['model']=_['map'](_0x48c54f,'name');_0x271613[_0x6db8('0x33')]=_['keys'](_0x48bf90[_0x6db8('0x33')]);_0x271613[_0x6db8('0x34')]=_[_0x6db8('0x35')](_0x271613[_0x6db8('0x36')],_0x271613[_0x6db8('0x33')]);_0x4b7419[_0x6db8('0x37')]=_['intersection'](_0x271613[_0x6db8('0x36')],qs[_0x6db8('0x38')](_0x48bf90[_0x6db8('0x33')][_0x6db8('0x38')]));_0x4b7419[_0x6db8('0x37')]=_0x4b7419[_0x6db8('0x37')][_0x6db8('0x39')]?_0x4b7419[_0x6db8('0x37')]:_0x271613['model'];if(!_0x48bf90[_0x6db8('0x33')][_0x6db8('0x3a')](_0x6db8('0x3b'))){_0x4b7419[_0x6db8('0x1f')]=qs[_0x6db8('0x1f')](_0x48bf90[_0x6db8('0x33')]['limit']);_0x4b7419[_0x6db8('0x1d')]=qs[_0x6db8('0x1d')](_0x48bf90[_0x6db8('0x33')][_0x6db8('0x1d')]);}_0x4b7419['order']=qs[_0x6db8('0x3c')](_0x48bf90[_0x6db8('0x33')][_0x6db8('0x3c')]);_0x4b7419['where']=qs[_0x6db8('0x34')](_[_0x6db8('0x3d')](_0x48bf90[_0x6db8('0x33')],_0x271613[_0x6db8('0x34')]),_0x48c54f);if(_0x48bf90[_0x6db8('0x33')][_0x6db8('0x3e')]){_0x4b7419['where']=_[_0x6db8('0x3f')](_0x4b7419['where'],{'$or':_[_0x6db8('0x2f')](_0x48c54f,function(_0x4aea01){if(_0x4aea01[_0x6db8('0x40')]!=='VIRTUAL'){var _0x39df76={};_0x39df76[_0x4aea01[_0x6db8('0x2c')]]={'$like':'%'+_0x48bf90[_0x6db8('0x33')][_0x6db8('0x3e')]+'%'};return _0x39df76;}})});}_0x4b7419=_[_0x6db8('0x3f')]({},_0x4b7419,_0x48bf90[_0x6db8('0x41')]);var _0x2572f5={'where':_0x4b7419[_0x6db8('0x42')]};return db[_0x6db8('0x30')]['count'](_0x2572f5)[_0x6db8('0x28')](function(_0x3c1d3a){_0x157819[_0x6db8('0x20')]=_0x3c1d3a;if(_0x48bf90[_0x6db8('0x33')][_0x6db8('0x43')]){_0x4b7419[_0x6db8('0x44')]=[{'all':!![]}];}return db[_0x6db8('0x30')]['findAll'](_0x4b7419);})[_0x6db8('0x28')](function(_0x2b32ad){_0x157819[_0x6db8('0x45')]=_0x2b32ad;return _0x157819;})[_0x6db8('0x28')](respondWithFilteredResult(_0x2b6a0d,_0x4b7419))[_0x6db8('0x46')](handleError(_0x2b6a0d,null));};exports[_0x6db8('0x47')]=function(_0x37a47f,_0x44c6cf){var _0x4793c1={'raw':![],'where':{'id':_0x37a47f[_0x6db8('0x48')]['id']}},_0x19eda3={};_0x19eda3[_0x6db8('0x36')]=_['keys'](db[_0x6db8('0x30')][_0x6db8('0x31')]);_0x19eda3[_0x6db8('0x33')]=_[_0x6db8('0x49')](_0x37a47f[_0x6db8('0x33')]);_0x19eda3[_0x6db8('0x34')]=_[_0x6db8('0x35')](_0x19eda3[_0x6db8('0x36')],_0x19eda3[_0x6db8('0x33')]);_0x4793c1['attributes']=_['intersection'](_0x19eda3[_0x6db8('0x36')],qs[_0x6db8('0x38')](_0x37a47f[_0x6db8('0x33')][_0x6db8('0x38')]));_0x4793c1[_0x6db8('0x37')]=_0x4793c1[_0x6db8('0x37')][_0x6db8('0x39')]?_0x4793c1[_0x6db8('0x37')]:_0x19eda3[_0x6db8('0x36')];if(_0x37a47f[_0x6db8('0x33')]['includeAll']){_0x4793c1[_0x6db8('0x44')]=[{'all':!![]}];}_0x4793c1=_['merge']({},_0x4793c1,_0x37a47f[_0x6db8('0x41')]);return db['UserProfileSection'][_0x6db8('0x4a')](_0x4793c1)[_0x6db8('0x28')](handleEntityNotFound(_0x44c6cf,null))[_0x6db8('0x28')](respondWithResult(_0x44c6cf,null))[_0x6db8('0x46')](handleError(_0x44c6cf,null));};exports[_0x6db8('0x4b')]=function(_0x31c584,_0x1921d4){return db[_0x6db8('0x30')][_0x6db8('0x4b')](_0x31c584[_0x6db8('0x4c')],{})[_0x6db8('0x28')](respondWithResult(_0x1921d4,0xc9))[_0x6db8('0x46')](handleError(_0x1921d4,null));};exports['update']=function(_0x45280f,_0xdc709e){if(_0x45280f['body']['id']){delete _0x45280f[_0x6db8('0x4c')]['id'];}return db[_0x6db8('0x30')][_0x6db8('0x4a')]({'where':{'id':_0x45280f[_0x6db8('0x48')]['id']}})[_0x6db8('0x28')](handleEntityNotFound(_0xdc709e,null))[_0x6db8('0x28')](saveUpdates(_0x45280f[_0x6db8('0x4c')],null))['then'](respondWithResult(_0xdc709e,null))[_0x6db8('0x46')](handleError(_0xdc709e,null));};exports[_0x6db8('0x29')]=function(_0x36f205,_0x28eb55){return db[_0x6db8('0x30')][_0x6db8('0x4a')]({'where':{'id':_0x36f205['params']['id']}})['then'](handleEntityNotFound(_0x28eb55,null))[_0x6db8('0x28')](removeEntity(_0x28eb55,null))[_0x6db8('0x46')](handleError(_0x28eb55,null));};exports[_0x6db8('0x4d')]=function(_0x677fd0,_0x4f3c57){return db[_0x6db8('0x30')]['describe']()[_0x6db8('0x28')](respondWithResult(_0x4f3c57,null))[_0x6db8('0x46')](handleError(_0x4f3c57,null));}; \ No newline at end of file +var _0xb69b=['filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','map','UserProfileSection','rawAttributes','type','key','query','keys'];(function(_0x5e3665,_0x369ac8){var _0x187299=function(_0x5c37f8){while(--_0x5c37f8){_0x5e3665['push'](_0x5e3665['shift']());}};_0x187299(++_0x369ac8);}(_0xb69b,0xa8));var _0xbb69=function(_0x5b85c5,_0x3f42b6){_0x5b85c5=_0x5b85c5-0x0;var _0x6d8010=_0xb69b[_0x5b85c5];return _0x6d8010;};'use strict';var emlformat=require(_0xbb69('0x0'));var rimraf=require(_0xbb69('0x1'));var zipdir=require(_0xbb69('0x2'));var jsonpatch=require(_0xbb69('0x3'));var rp=require(_0xbb69('0x4'));var moment=require(_0xbb69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb69('0x6'));var util=require(_0xbb69('0x7'));var path=require(_0xbb69('0x8'));var sox=require(_0xbb69('0x9'));var csv=require(_0xbb69('0xa'));var ejs=require(_0xbb69('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb69('0xc'));var squel=require('squel');var crypto=require(_0xbb69('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbb69('0xe'));var toCsv=require(_0xbb69('0xa'));var querystring=require(_0xbb69('0xf'));var Papa=require('papaparse');var Redis=require(_0xbb69('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb69('0x11'));var as=require(_0xbb69('0x12'));var hardwareService=require(_0xbb69('0x13'));var logger=require(_0xbb69('0x14'))(_0xbb69('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbb69('0x16'));var db=require(_0xbb69('0x17'))['db'];function respondWithStatusCode(_0x56315c,_0x3021d3){_0x3021d3=_0x3021d3||0xcc;return function(_0x547694){if(_0x547694){return _0x56315c[_0xbb69('0x18')](_0x3021d3);}return _0x56315c[_0xbb69('0x19')](_0x3021d3)[_0xbb69('0x1a')]();};}function respondWithResult(_0x567cff,_0x39b434){_0x39b434=_0x39b434||0xc8;return function(_0x43cd4e){if(_0x43cd4e){return _0x567cff['status'](_0x39b434)[_0xbb69('0x1b')](_0x43cd4e);}};}function respondWithFilteredResult(_0x5c7c21,_0x4d01e8){return function(_0x3e9d9a){if(_0x3e9d9a){var _0x1e21fb=typeof _0x4d01e8[_0xbb69('0x1c')]===_0xbb69('0x1d')&&typeof _0x4d01e8[_0xbb69('0x1e')]===_0xbb69('0x1d');var _0x2ac774=_0x3e9d9a[_0xbb69('0x1f')];var _0x57406c=_0x1e21fb?0x0:_0x4d01e8[_0xbb69('0x1c')];var _0x3fb920=_0x1e21fb?_0x3e9d9a['count']:_0x4d01e8[_0xbb69('0x1c')]+_0x4d01e8[_0xbb69('0x1e')];var _0x22e549;if(_0x3fb920>=_0x2ac774){_0x3fb920=_0x2ac774;_0x22e549=0xc8;}else{_0x22e549=0xce;}_0x5c7c21['status'](_0x22e549);return _0x5c7c21[_0xbb69('0x20')]('Content-Range',_0x57406c+'-'+_0x3fb920+'/'+_0x2ac774)[_0xbb69('0x1b')](_0x3e9d9a);}return null;};}function patchUpdates(_0x2c80c7){return function(_0x41478b){try{jsonpatch[_0xbb69('0x21')](_0x41478b,_0x2c80c7,!![]);}catch(_0x178d13){return BPromise['reject'](_0x178d13);}return _0x41478b[_0xbb69('0x22')]();};}function saveUpdates(_0x31f3e0,_0x54f99f){return function(_0x3f69ac){if(_0x3f69ac){return _0x3f69ac[_0xbb69('0x23')](_0x31f3e0)[_0xbb69('0x24')](function(_0x5e915a){return _0x5e915a;});}return null;};}function removeEntity(_0xb64f7c,_0x240ed8){return function(_0x57bde1){if(_0x57bde1){return _0x57bde1[_0xbb69('0x25')]()['then'](function(){_0xb64f7c[_0xbb69('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb919,_0x241831){return function(_0x171edc){if(!_0x171edc){_0x1eb919[_0xbb69('0x18')](0x194);}return _0x171edc;};}function handleError(_0x42a691,_0x5ab2c4){_0x5ab2c4=_0x5ab2c4||0x1f4;return function(_0x59ec5c){logger['error'](_0x59ec5c[_0xbb69('0x26')]);if(_0x59ec5c['name']){delete _0x59ec5c[_0xbb69('0x27')];}_0x42a691[_0xbb69('0x19')](_0x5ab2c4)[_0xbb69('0x28')](_0x59ec5c);};}exports['index']=function(_0x1227c7,_0x1a7001){var _0x2b36d8={},_0x1780ec={},_0x178327={'count':0x0,'rows':[]};var _0x381129=_[_0xbb69('0x29')](db[_0xbb69('0x2a')][_0xbb69('0x2b')],function(_0x1bfda3){return{'name':_0x1bfda3['fieldName'],'type':_0x1bfda3[_0xbb69('0x2c')][_0xbb69('0x2d')]};});_0x1780ec['model']=_['map'](_0x381129,_0xbb69('0x27'));_0x1780ec[_0xbb69('0x2e')]=_[_0xbb69('0x2f')](_0x1227c7['query']);_0x1780ec[_0xbb69('0x30')]=_[_0xbb69('0x31')](_0x1780ec[_0xbb69('0x32')],_0x1780ec[_0xbb69('0x2e')]);_0x2b36d8[_0xbb69('0x33')]=_[_0xbb69('0x31')](_0x1780ec[_0xbb69('0x32')],qs[_0xbb69('0x34')](_0x1227c7[_0xbb69('0x2e')]['fields']));_0x2b36d8[_0xbb69('0x33')]=_0x2b36d8['attributes'][_0xbb69('0x35')]?_0x2b36d8[_0xbb69('0x33')]:_0x1780ec[_0xbb69('0x32')];if(!_0x1227c7[_0xbb69('0x2e')][_0xbb69('0x36')]('nolimit')){_0x2b36d8[_0xbb69('0x1e')]=qs[_0xbb69('0x1e')](_0x1227c7[_0xbb69('0x2e')]['limit']);_0x2b36d8['offset']=qs[_0xbb69('0x1c')](_0x1227c7[_0xbb69('0x2e')]['offset']);}_0x2b36d8[_0xbb69('0x37')]=qs[_0xbb69('0x38')](_0x1227c7[_0xbb69('0x2e')]['sort']);_0x2b36d8[_0xbb69('0x39')]=qs[_0xbb69('0x30')](_[_0xbb69('0x3a')](_0x1227c7[_0xbb69('0x2e')],_0x1780ec['filters']),_0x381129);if(_0x1227c7[_0xbb69('0x2e')][_0xbb69('0x3b')]){_0x2b36d8[_0xbb69('0x39')]=_[_0xbb69('0x3c')](_0x2b36d8[_0xbb69('0x39')],{'$or':_[_0xbb69('0x29')](_0x381129,function(_0x472832){if(_0x472832['type']!==_0xbb69('0x3d')){var _0x58aeb1={};_0x58aeb1[_0x472832['name']]={'$like':'%'+_0x1227c7['query'][_0xbb69('0x3b')]+'%'};return _0x58aeb1;}})});}_0x2b36d8=_[_0xbb69('0x3c')]({},_0x2b36d8,_0x1227c7[_0xbb69('0x3e')]);var _0x482c5b={'where':_0x2b36d8[_0xbb69('0x39')]};return db['UserProfileSection'][_0xbb69('0x1f')](_0x482c5b)['then'](function(_0x15b97d){_0x178327[_0xbb69('0x1f')]=_0x15b97d;if(_0x1227c7['query'][_0xbb69('0x3f')]){_0x2b36d8['include']=[{'all':!![]}];}return db[_0xbb69('0x2a')]['findAll'](_0x2b36d8);})[_0xbb69('0x24')](function(_0x176789){_0x178327[_0xbb69('0x40')]=_0x176789;return _0x178327;})['then'](respondWithFilteredResult(_0x1a7001,_0x2b36d8))['catch'](handleError(_0x1a7001,null));};exports[_0xbb69('0x41')]=function(_0x4d0ea4,_0x28d60d){var _0x27b422={'raw':![],'where':{'id':_0x4d0ea4[_0xbb69('0x42')]['id']}},_0x24da14={};_0x24da14[_0xbb69('0x32')]=_['keys'](db[_0xbb69('0x2a')][_0xbb69('0x2b')]);_0x24da14['query']=_['keys'](_0x4d0ea4['query']);_0x24da14[_0xbb69('0x30')]=_[_0xbb69('0x31')](_0x24da14['model'],_0x24da14[_0xbb69('0x2e')]);_0x27b422[_0xbb69('0x33')]=_['intersection'](_0x24da14[_0xbb69('0x32')],qs[_0xbb69('0x34')](_0x4d0ea4[_0xbb69('0x2e')]['fields']));_0x27b422[_0xbb69('0x33')]=_0x27b422[_0xbb69('0x33')][_0xbb69('0x35')]?_0x27b422[_0xbb69('0x33')]:_0x24da14[_0xbb69('0x32')];if(_0x4d0ea4[_0xbb69('0x2e')][_0xbb69('0x3f')]){_0x27b422['include']=[{'all':!![]}];}_0x27b422=_[_0xbb69('0x3c')]({},_0x27b422,_0x4d0ea4['options']);return db['UserProfileSection'][_0xbb69('0x43')](_0x27b422)[_0xbb69('0x24')](handleEntityNotFound(_0x28d60d,null))['then'](respondWithResult(_0x28d60d,null))[_0xbb69('0x44')](handleError(_0x28d60d,null));};exports[_0xbb69('0x45')]=function(_0xf08761,_0x3d5f1f){return db[_0xbb69('0x2a')]['create'](_0xf08761['body'],{})[_0xbb69('0x24')](respondWithResult(_0x3d5f1f,0xc9))[_0xbb69('0x44')](handleError(_0x3d5f1f,null));};exports[_0xbb69('0x23')]=function(_0x5c9f92,_0x2d4d84){if(_0x5c9f92[_0xbb69('0x46')]['id']){delete _0x5c9f92[_0xbb69('0x46')]['id'];}return db[_0xbb69('0x2a')][_0xbb69('0x43')]({'where':{'id':_0x5c9f92[_0xbb69('0x42')]['id']}})[_0xbb69('0x24')](handleEntityNotFound(_0x2d4d84,null))[_0xbb69('0x24')](saveUpdates(_0x5c9f92['body'],null))[_0xbb69('0x24')](respondWithResult(_0x2d4d84,null))[_0xbb69('0x44')](handleError(_0x2d4d84,null));};exports[_0xbb69('0x25')]=function(_0x26c84f,_0x4cf21c){return db[_0xbb69('0x2a')][_0xbb69('0x43')]({'where':{'id':_0x26c84f[_0xbb69('0x42')]['id']}})[_0xbb69('0x24')](handleEntityNotFound(_0x4cf21c,null))['then'](removeEntity(_0x4cf21c,null))[_0xbb69('0x44')](handleError(_0x4cf21c,null));};exports[_0xbb69('0x47')]=function(_0x29d331,_0x3494f4){return db[_0xbb69('0x2a')][_0xbb69('0x47')]()[_0xbb69('0x24')](respondWithResult(_0x3494f4,null))[_0xbb69('0x44')](handleError(_0x3494f4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 89616cf..a6e7fa0 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 _0x8f80=['userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x8f80,0xa6));var _0x08f8=function(_0x54485b,_0x8f1d43){_0x54485b=_0x54485b-0x0;var _0x284ba9=_0x8f80[_0x54485b];return _0x284ba9;};'use strict';var _=require(_0x08f8('0x0'));var util=require(_0x08f8('0x1'));var logger=require(_0x08f8('0x2'))(_0x08f8('0x3'));var moment=require('moment');var BPromise=require(_0x08f8('0x4'));var rp=require(_0x08f8('0x5'));var fs=require('fs');var path=require(_0x08f8('0x6'));var rimraf=require(_0x08f8('0x7'));var config=require('../../config/environment');var attributes=require(_0x08f8('0x8'));module[_0x08f8('0x9')]=function(_0x5a23c5,_0x53f829){return _0x5a23c5[_0x08f8('0xa')](_0x08f8('0xb'),attributes,{'tableName':_0x08f8('0xc'),'paranoid':![],'indexes':[{'name':_0x08f8('0xd'),'fields':['sectionId',_0x08f8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe146=['util','api','moment','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','userProfileId'];(function(_0x45f6c9,_0x154bea){var _0x3d5f8f=function(_0x488515){while(--_0x488515){_0x45f6c9['push'](_0x45f6c9['shift']());}};_0x3d5f8f(++_0x154bea);}(_0xe146,0x1d4));var _0x6e14=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0xe146[_0x26721d];return _0x1035c5;};'use strict';var _=require('lodash');var util=require(_0x6e14('0x0'));var logger=require('../../config/logger')(_0x6e14('0x1'));var moment=require(_0x6e14('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e14('0x3'));var rimraf=require(_0x6e14('0x4'));var config=require(_0x6e14('0x5'));var attributes=require(_0x6e14('0x6'));module[_0x6e14('0x7')]=function(_0x489d15,_0x1975b7){return _0x489d15['define'](_0x6e14('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x6e14('0x9'),'fields':[_0x6e14('0xa'),_0x6e14('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 9602d81..26df795 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 _0xfa9e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xfa9e,0xad));var _0xefa9=function(_0xfef374,_0x35bf34){_0xfef374=_0xfef374-0x0;var _0xa0ef74=_0xfa9e[_0xfef374];return _0xa0ef74;};'use strict';var _=require(_0xefa9('0x0'));var util=require('util');var moment=require(_0xefa9('0x1'));var BPromise=require('bluebird');var rs=require(_0xefa9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xefa9('0x3'));var logger=require(_0xefa9('0x4'))(_0xefa9('0x5'));var config=require(_0xefa9('0x6'));var jayson=require(_0xefa9('0x7'));var client=jayson[_0xefa9('0x8')][_0xefa9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xae770c,_0x4e941e,_0x3b555a){return new BPromise(function(_0x5a5583,_0x59b36e){return client[_0xefa9('0xa')](_0xae770c,_0x3b555a)[_0xefa9('0xb')](function(_0x9b9586){logger[_0xefa9('0xc')](_0xefa9('0xd'),_0x4e941e,_0xefa9('0xe'));logger[_0xefa9('0xf')](_0xefa9('0x10'),_0x4e941e,_0xefa9('0xe'),JSON[_0xefa9('0x11')](_0x9b9586));if(_0x9b9586[_0xefa9('0x12')]){if(_0x9b9586[_0xefa9('0x12')][_0xefa9('0x13')]===0x1f4){logger[_0xefa9('0x12')](_0xefa9('0xd'),_0x4e941e,_0x9b9586[_0xefa9('0x12')][_0xefa9('0x14')]);return _0x59b36e(_0x9b9586['error'][_0xefa9('0x14')]);}logger[_0xefa9('0x12')](_0xefa9('0xd'),_0x4e941e,_0x9b9586[_0xefa9('0x12')]['message']);return _0x5a5583(_0x9b9586['error'][_0xefa9('0x14')]);}else{logger['info'](_0xefa9('0xd'),_0x4e941e,_0xefa9('0xe'));_0x5a5583(_0x9b9586['result'][_0xefa9('0x14')]);}})[_0xefa9('0x15')](function(_0x1f50dd){logger[_0xefa9('0x12')](_0xefa9('0xd'),_0x4e941e,_0x1f50dd);_0x59b36e(_0x1f50dd);});});} \ No newline at end of file +var _0xbc74=['then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x3c2192,_0x46089f){var _0x594d92=function(_0x936eba){while(--_0x936eba){_0x3c2192['push'](_0x3c2192['shift']());}};_0x594d92(++_0x46089f);}(_0xbc74,0x1c3));var _0x4bc7=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xbc74[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x4bc7('0x0'));var util=require(_0x4bc7('0x1'));var moment=require(_0x4bc7('0x2'));var BPromise=require('bluebird');var rs=require(_0x4bc7('0x3'));var fs=require('fs');var Redis=require(_0x4bc7('0x4'));var db=require(_0x4bc7('0x5'))['db'];var utils=require(_0x4bc7('0x6'));var logger=require('../../config/logger')(_0x4bc7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4bc7('0x8')][_0x4bc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2db5b3,_0xc435eb,_0x10d3cc){return new BPromise(function(_0x148e37,_0x2e55b5){return client[_0x4bc7('0xa')](_0x2db5b3,_0x10d3cc)[_0x4bc7('0xb')](function(_0x52c711){logger['info'](_0x4bc7('0xc'),_0xc435eb,_0x4bc7('0xd'));logger[_0x4bc7('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xc435eb,_0x4bc7('0xd'),JSON['stringify'](_0x52c711));if(_0x52c711[_0x4bc7('0xf')]){if(_0x52c711['error'][_0x4bc7('0x10')]===0x1f4){logger[_0x4bc7('0xf')]('UserProfileSection,\x20%s,\x20%s',_0xc435eb,_0x52c711[_0x4bc7('0xf')][_0x4bc7('0x11')]);return _0x2e55b5(_0x52c711[_0x4bc7('0xf')][_0x4bc7('0x11')]);}logger[_0x4bc7('0xf')]('UserProfileSection,\x20%s,\x20%s',_0xc435eb,_0x52c711['error'][_0x4bc7('0x11')]);return _0x148e37(_0x52c711[_0x4bc7('0xf')][_0x4bc7('0x11')]);}else{logger[_0x4bc7('0x12')](_0x4bc7('0xc'),_0xc435eb,'request\x20sent');_0x148e37(_0x52c711[_0x4bc7('0x13')][_0x4bc7('0x11')]);}})[_0x4bc7('0x14')](function(_0x35469b){logger[_0x4bc7('0xf')](_0x4bc7('0xc'),_0xc435eb,_0x35469b);_0x2e55b5(_0x35469b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2cfe267..6c072c3 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x143620,_0x2738da){var _0x24fcec=function(_0x4ce62c){while(--_0x4ce62c){_0x143620['push'](_0x143620['shift']());}};_0x24fcec(++_0x2738da);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5544e1,_0x32afaf){var _0x233c4c=function(_0x228720){while(--_0x228720){_0x5544e1['push'](_0x5544e1['shift']());}};_0x233c4c(++_0x32afaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index aa8c952..8eded3f 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 _0xf9f4=['exports','INTEGER','sequelize'];(function(_0x525c62,_0x5a5412){var _0x37d701=function(_0x21675d){while(--_0x21675d){_0x525c62['push'](_0x525c62['shift']());}};_0x37d701(++_0x5a5412);}(_0xf9f4,0x1be));var _0x4f9f=function(_0xff22ad,_0x1a5193){_0xff22ad=_0xff22ad-0x0;var _0x2d7273=_0xf9f4[_0xff22ad];return _0x2d7273;};'use strict';var Sequelize=require(_0x4f9f('0x0'));module[_0x4f9f('0x1')]={'penalty':{'type':Sequelize[_0x4f9f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb91a=['sequelize','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb91a,0x112));var _0xab91=function(_0x3cdd4b,_0x333117){_0x3cdd4b=_0x3cdd4b-0x0;var _0xd0d75a=_0xb91a[_0x3cdd4b];return _0xd0d75a;};'use strict';var Sequelize=require(_0xab91('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xab91('0x1')],'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 a81cb96..aa7e262 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 _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x9a6637,_0x44a610){var _0x3f91da=function(_0x268ca9){while(--_0x268ca9){_0x9a6637['push'](_0x9a6637['shift']());}};_0x3f91da(++_0x44a610);}(_0x4bd3,0x174));var _0x34bd=function(_0x4eb3ef,_0x2f2b2d){_0x4eb3ef=_0x4eb3ef-0x0;var _0x5949d1=_0x4bd3[_0x4eb3ef];return _0x5949d1;};'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('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee3c=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0xee3c,0x14a));var _0xcee3=function(_0x4a34b3,_0x579a92){_0x4a34b3=_0x4a34b3-0x0;var _0x44f7bc=_0xee3c[_0x4a34b3];return _0x44f7bc;};'use strict';var _=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var logger=require(_0xcee3('0x2'))(_0xcee3('0x3'));var moment=require(_0xcee3('0x4'));var BPromise=require(_0xcee3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var attributes=require(_0xcee3('0x8'));module[_0xcee3('0x9')]=function(_0x9350f3,_0x44e46f){return _0x9350f3[_0xcee3('0xa')](_0xcee3('0xb'),attributes,{'tableName':_0xcee3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 44f1f64..bc17af6 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 _0x80d9=['jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x459392,_0x3dd5dc){var _0x445bc9=function(_0x4b577c){while(--_0x4b577c){_0x459392['push'](_0x459392['shift']());}};_0x445bc9(++_0x3dd5dc);}(_0x80d9,0x108));var _0x980d=function(_0x1a171,_0x11e700){_0x1a171=_0x1a171-0x0;var _0x1ce9ec=_0x80d9[_0x1a171];return _0x1ce9ec;};'use strict';var _=require('lodash');var util=require(_0x980d('0x0'));var moment=require(_0x980d('0x1'));var BPromise=require(_0x980d('0x2'));var rs=require(_0x980d('0x3'));var fs=require('fs');var Redis=require(_0x980d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x980d('0x5'));var logger=require(_0x980d('0x6'))(_0x980d('0x7'));var config=require(_0x980d('0x8'));var jayson=require(_0x980d('0x9'));var client=jayson['client'][_0x980d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42f13e,_0x1b6d25,_0x3b6b20){return new BPromise(function(_0x245343,_0x1c842d){return client['request'](_0x42f13e,_0x3b6b20)['then'](function(_0x363d29){logger[_0x980d('0xb')](_0x980d('0xc'),_0x1b6d25,_0x980d('0xd'));logger[_0x980d('0xe')](_0x980d('0xf'),_0x1b6d25,_0x980d('0xd'),JSON['stringify'](_0x363d29));if(_0x363d29['error']){if(_0x363d29[_0x980d('0x10')][_0x980d('0x11')]===0x1f4){logger[_0x980d('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x1b6d25,_0x363d29['error']['message']);return _0x1c842d(_0x363d29[_0x980d('0x10')]['message']);}logger[_0x980d('0x10')](_0x980d('0xc'),_0x1b6d25,_0x363d29[_0x980d('0x10')][_0x980d('0x12')]);return _0x245343(_0x363d29[_0x980d('0x10')]['message']);}else{logger[_0x980d('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x1b6d25,_0x980d('0xd'));_0x245343(_0x363d29[_0x980d('0x13')]['message']);}})[_0x980d('0x14')](function(_0x44c0ab){logger[_0x980d('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x1b6d25,_0x44c0ab);_0x1c842d(_0x44c0ab);});});} \ No newline at end of file +var _0xe624=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x307100,_0xbbc3a3){var _0xcdc7d5=function(_0x591f64){while(--_0x591f64){_0x307100['push'](_0x307100['shift']());}};_0xcdc7d5(++_0xbbc3a3);}(_0xe624,0x1b1));var _0x4e62=function(_0x3d86f5,_0x257914){_0x3d86f5=_0x3d86f5-0x0;var _0x2d6881=_0xe624[_0x3d86f5];return _0x2d6881;};'use strict';var _=require(_0x4e62('0x0'));var util=require(_0x4e62('0x1'));var moment=require(_0x4e62('0x2'));var BPromise=require(_0x4e62('0x3'));var rs=require(_0x4e62('0x4'));var fs=require('fs');var Redis=require(_0x4e62('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e62('0x6'))(_0x4e62('0x7'));var config=require(_0x4e62('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42cdcd,_0x287ac0,_0x2c80a6){return new BPromise(function(_0x14aa1b,_0x119c9f){return client[_0x4e62('0xa')](_0x42cdcd,_0x2c80a6)[_0x4e62('0xb')](function(_0x243d30){logger[_0x4e62('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x287ac0,_0x4e62('0xd'));logger[_0x4e62('0xe')](_0x4e62('0xf'),_0x287ac0,_0x4e62('0xd'),JSON[_0x4e62('0x10')](_0x243d30));if(_0x243d30[_0x4e62('0x11')]){if(_0x243d30['error'][_0x4e62('0x12')]===0x1f4){logger[_0x4e62('0x11')](_0x4e62('0x13'),_0x287ac0,_0x243d30[_0x4e62('0x11')]['message']);return _0x119c9f(_0x243d30[_0x4e62('0x11')][_0x4e62('0x14')]);}logger[_0x4e62('0x11')](_0x4e62('0x13'),_0x287ac0,_0x243d30[_0x4e62('0x11')][_0x4e62('0x14')]);return _0x14aa1b(_0x243d30['error'][_0x4e62('0x14')]);}else{logger[_0x4e62('0xc')](_0x4e62('0x13'),_0x287ac0,'request\x20sent');_0x14aa1b(_0x243d30[_0x4e62('0x15')][_0x4e62('0x14')]);}})['catch'](function(_0x27dd40){logger['error'](_0x4e62('0x13'),_0x287ac0,_0x27dd40);_0x119c9f(_0x27dd40);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5e3c609..9cedcdb 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 _0xf58b=['INTEGER','exports'];(function(_0x1c431d,_0xc80c68){var _0x5a80f7=function(_0x3a54e0){while(--_0x3a54e0){_0x1c431d['push'](_0x1c431d['shift']());}};_0x5a80f7(++_0xc80c68);}(_0xf58b,0xd5));var _0xbf58=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0xf58b[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require('sequelize');module[_0xbf58('0x0')]={'UserId':{'type':Sequelize[_0xbf58('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xbf58('0x1')]}}; \ No newline at end of file +var _0x6ba4=['exports','INTEGER'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6ba4,0x11e));var _0x46ba=function(_0x421e23,_0x260176){_0x421e23=_0x421e23-0x0;var _0x1c6bac=_0x6ba4[_0x421e23];return _0x1c6bac;};'use strict';var Sequelize=require('sequelize');module[_0x46ba('0x0')]={'UserId':{'type':Sequelize[_0x46ba('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ef614df..a96c4c2 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(_0x428f4e,_0x383b66){var _0x1a6607=function(_0x38d1ce){while(--_0x38d1ce){_0x428f4e['push'](_0x428f4e['shift']());}};_0x1a6607(++_0x383b66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x134eed,_0x2859d7){var _0x21f18e=function(_0x477483){while(--_0x477483){_0x134eed['push'](_0x134eed['shift']());}};_0x21f18e(++_0x2859d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 1dce587..2a68e23 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(_0x1fb78e,_0x57d489){var _0x43a1cd=function(_0x5cbb2b){while(--_0x5cbb2b){_0x1fb78e['push'](_0x1fb78e['shift']());}};_0x43a1cd(++_0x57d489);}(_0x70e0,0x17b));var _0x070e=function(_0x132765,_0xe507c3){_0x132765=_0x132765-0x0;var _0x1d02a5=_0x70e0[_0x132765];return _0x1d02a5;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5c315d,_0x3b3245){var _0x3273e8=function(_0x5aab2a){while(--_0x5aab2a){_0x5c315d['push'](_0x5c315d['shift']());}};_0x3273e8(++_0x3b3245);}(_0x70e0,0x17b));var _0x070e=function(_0x5f349a,_0x32a22d){_0x5f349a=_0x5f349a-0x0;var _0x4cd4a9=_0x70e0[_0x5f349a];return _0x4cd4a9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 533552e..ebd5295 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 _0x46e1=['exports','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x46e1,0x155));var _0x146e=function(_0x307f3f,_0x58ac30){_0x307f3f=_0x307f3f-0x0;var _0x5dc183=_0x46e1[_0x307f3f];return _0x5dc183;};'use strict';var Sequelize=require(_0x146e('0x0'));module[_0x146e('0x1')]={'penalty':{'type':Sequelize[_0x146e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6785=['INTEGER','sequelize','exports'];(function(_0x33d2ad,_0x23b818){var _0x3856d8=function(_0x2f095c){while(--_0x2f095c){_0x33d2ad['push'](_0x33d2ad['shift']());}};_0x3856d8(++_0x23b818);}(_0x6785,0xa0));var _0x5678=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x6785[_0x424a9a];return _0xa7831c;};'use strict';var Sequelize=require(_0x5678('0x0'));module[_0x5678('0x1')]={'penalty':{'type':Sequelize[_0x5678('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 1c57342..1f9976b 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 _0x2d19=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x4ca949,_0x4299be){var _0x1d0352=function(_0x34cc89){while(--_0x34cc89){_0x4ca949['push'](_0x4ca949['shift']());}};_0x1d0352(++_0x4299be);}(_0x2d19,0x110));var _0x92d1=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2d19[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x92d1('0x0'));var util=require(_0x92d1('0x1'));var logger=require(_0x92d1('0x2'))(_0x92d1('0x3'));var moment=require('moment');var BPromise=require(_0x92d1('0x4'));var rp=require(_0x92d1('0x5'));var fs=require('fs');var path=require(_0x92d1('0x6'));var rimraf=require(_0x92d1('0x7'));var config=require(_0x92d1('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x92d1('0x9')]=function(_0x247f4a,_0x42bcb7){return _0x247f4a[_0x92d1('0xa')](_0x92d1('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x587d=['../../config/logger','moment','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','util'];(function(_0x576c1e,_0x49c1d6){var _0x33a3c3=function(_0x5b56fa){while(--_0x5b56fa){_0x576c1e['push'](_0x576c1e['shift']());}};_0x33a3c3(++_0x49c1d6);}(_0x587d,0x134));var _0xd587=function(_0x59bd64,_0x237f2b){_0x59bd64=_0x59bd64-0x0;var _0x378c0e=_0x587d[_0x59bd64];return _0x378c0e;};'use strict';var _=require(_0xd587('0x0'));var util=require(_0xd587('0x1'));var logger=require(_0xd587('0x2'))('api');var moment=require(_0xd587('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd587('0x4'));var rimraf=require(_0xd587('0x5'));var config=require(_0xd587('0x6'));var attributes=require(_0xd587('0x7'));module[_0xd587('0x8')]=function(_0x71b568,_0x270e3e){return _0x71b568['define'](_0xd587('0x9'),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 9814238..385850b 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 _0xd8eb=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0xd8eb,0xe5));var _0xbd8e=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xd8eb[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require(_0xbd8e('0x0'));var util=require(_0xbd8e('0x1'));var moment=require(_0xbd8e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd8e('0x3'));var db=require(_0xbd8e('0x4'))['db'];var utils=require(_0xbd8e('0x5'));var logger=require(_0xbd8e('0x6'))(_0xbd8e('0x7'));var config=require(_0xbd8e('0x8'));var jayson=require(_0xbd8e('0x9'));var client=jayson[_0xbd8e('0xa')][_0xbd8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121df1,_0x1d74ab,_0x597fdf){return new BPromise(function(_0x40acfb,_0x46b391){return client['request'](_0x121df1,_0x597fdf)[_0xbd8e('0xc')](function(_0x5197ae){logger[_0xbd8e('0xd')](_0xbd8e('0xe'),_0x1d74ab,'request\x20sent');logger[_0xbd8e('0xf')](_0xbd8e('0x10'),_0x1d74ab,'request\x20sent',JSON[_0xbd8e('0x11')](_0x5197ae));if(_0x5197ae['error']){if(_0x5197ae[_0xbd8e('0x12')]['code']===0x1f4){logger[_0xbd8e('0x12')](_0xbd8e('0xe'),_0x1d74ab,_0x5197ae[_0xbd8e('0x12')][_0xbd8e('0x13')]);return _0x46b391(_0x5197ae[_0xbd8e('0x12')][_0xbd8e('0x13')]);}logger[_0xbd8e('0x12')](_0xbd8e('0xe'),_0x1d74ab,_0x5197ae[_0xbd8e('0x12')][_0xbd8e('0x13')]);return _0x40acfb(_0x5197ae[_0xbd8e('0x12')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x1d74ab,'request\x20sent');_0x40acfb(_0x5197ae[_0xbd8e('0x14')]['message']);}})['catch'](function(_0x510b52){logger[_0xbd8e('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x1d74ab,_0x510b52);_0x46b391(_0x510b52);});});} \ No newline at end of file +var _0x5684=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x53136b,_0x64d196){var _0x572292=function(_0xee850e){while(--_0xee850e){_0x53136b['push'](_0x53136b['shift']());}};_0x572292(++_0x64d196);}(_0x5684,0xb6));var _0x4568=function(_0x5d6523,_0x22842b){_0x5d6523=_0x5d6523-0x0;var _0x4c481d=_0x5684[_0x5d6523];return _0x4c481d;};'use strict';var _=require(_0x4568('0x0'));var util=require(_0x4568('0x1'));var moment=require(_0x4568('0x2'));var BPromise=require(_0x4568('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4568('0x4'));var db=require(_0x4568('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4568('0x6'))('rpc');var config=require(_0x4568('0x7'));var jayson=require(_0x4568('0x8'));var client=jayson[_0x4568('0x9')][_0x4568('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x566736,_0x288f3c,_0x326b8b){return new BPromise(function(_0x3000d7,_0x5420a1){return client[_0x4568('0xb')](_0x566736,_0x326b8b)[_0x4568('0xc')](function(_0x24265e){logger['info'](_0x4568('0xd'),_0x288f3c,_0x4568('0xe'));logger[_0x4568('0xf')](_0x4568('0x10'),_0x288f3c,'request\x20sent',JSON[_0x4568('0x11')](_0x24265e));if(_0x24265e[_0x4568('0x12')]){if(_0x24265e[_0x4568('0x12')][_0x4568('0x13')]===0x1f4){logger[_0x4568('0x12')](_0x4568('0xd'),_0x288f3c,_0x24265e[_0x4568('0x12')][_0x4568('0x14')]);return _0x5420a1(_0x24265e[_0x4568('0x12')][_0x4568('0x14')]);}logger[_0x4568('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x288f3c,_0x24265e['error']['message']);return _0x3000d7(_0x24265e[_0x4568('0x12')][_0x4568('0x14')]);}else{logger['info'](_0x4568('0xd'),_0x288f3c,'request\x20sent');_0x3000d7(_0x24265e[_0x4568('0x15')][_0x4568('0x14')]);}})[_0x4568('0x16')](function(_0x31a075){logger['error'](_0x4568('0xd'),_0x288f3c,_0x31a075);_0x5420a1(_0x31a075);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 88d7b3a..fdfd0a4 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x272f04,_0x2506f8){var _0x4ffc59=function(_0x5454b2){while(--_0x5454b2){_0x272f04['push'](_0x272f04['shift']());}};_0x4ffc59(++_0x2506f8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5b17b4,_0x5a3221){var _0x55af79=function(_0x888225){while(--_0x888225){_0x5b17b4['push'](_0x5b17b4['shift']());}};_0x55af79(++_0x5a3221);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 885eb4b..cb72c2e 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 _0x108d=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x1b7e6d,_0x3a7c68){var _0x422553=function(_0x14ce0e){while(--_0x14ce0e){_0x1b7e6d['push'](_0x1b7e6d['shift']());}};_0x422553(++_0x3a7c68);}(_0x108d,0x7e));var _0xd108=function(_0x5ae720,_0x3cc0a7){_0x5ae720=_0x5ae720-0x0;var _0x39a46d=_0x108d[_0x5ae720];return _0x39a46d;};'use strict';var Sequelize=require(_0xd108('0x0'));module[_0xd108('0x1')]={'uniqueid':{'type':Sequelize[_0xd108('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd108('0x3')},'membername':{'type':Sequelize[_0xd108('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xd108('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xd108('0x4')],'allowNull':![],'unique':_0xd108('0x5'),'comment':_0xd108('0x3')},'VoiceQueueId':{'type':Sequelize[_0xd108('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd108('0x5'),'comment':_0xd108('0x3')},'penalty':{'type':Sequelize[_0xd108('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xd108('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x3daf=['STRING','INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0x3daf,0x195));var _0xf3da=function(_0x508198,_0x8c0cee){_0x508198=_0x508198-0x0;var _0xc7fe1a=_0x3daf[_0x508198];return _0xc7fe1a;};'use strict';var Sequelize=require(_0xf3da('0x0'));module[_0xf3da('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf3da('0x2')},'membername':{'type':Sequelize[_0xf3da('0x3')],'allowNull':![],'comment':_0xf3da('0x2')},'UserId':{'type':Sequelize[_0xf3da('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf3da('0x3')],'allowNull':![],'unique':_0xf3da('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xf3da('0x3')],'allowNull':![],'unique':_0xf3da('0x5'),'comment':_0xf3da('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf3da('0x2')},'paused':{'type':Sequelize[_0xf3da('0x4')](0xb),'defaultValue':0x0,'comment':_0xf3da('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 63f6f93..8a68733 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 _0xaf24=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1ac562,_0x270a2d){var _0x483610=function(_0x1eb389){while(--_0x1eb389){_0x1ac562['push'](_0x1ac562['shift']());}};_0x483610(++_0x270a2d);}(_0xaf24,0x1ca));var _0x4af2=function(_0x408649,_0x41c48e){_0x408649=_0x408649-0x0;var _0x4144aa=_0xaf24[_0x408649];return _0x4144aa;};'use strict';var EventEmitter=require(_0x4af2('0x0'));var UserVoiceQueueRt=require(_0x4af2('0x1'))['db'][_0x4af2('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4af2('0x3')](0x0);var events={'afterCreate':_0x4af2('0x4'),'afterUpdate':_0x4af2('0x5'),'afterDestroy':_0x4af2('0x6')};function emitEvent(_0x2275b8){return function(_0x2b85ca,_0x11c2cd,_0x3e3a53){UserVoiceQueueRtEvents[_0x4af2('0x7')](_0x2275b8+':'+_0x2b85ca['id'],_0x2b85ca);UserVoiceQueueRtEvents[_0x4af2('0x7')](_0x2275b8,_0x2b85ca);_0x3e3a53(null);};}for(var e in events){if(events[_0x4af2('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x4af2('0x9')](e,emitEvent(event));}}module[_0x4af2('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xbfb7=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xbfb7,0x146));var _0x7bfb=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xbfb7[_0x2fbcf6];return _0x3e7265;};'use strict';var EventEmitter=require(_0x7bfb('0x0'));var UserVoiceQueueRt=require(_0x7bfb('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7bfb('0x2'),'afterUpdate':_0x7bfb('0x3'),'afterDestroy':_0x7bfb('0x4')};function emitEvent(_0x5c7237){return function(_0x23e66b,_0x180ea8,_0x3d57e3){UserVoiceQueueRtEvents[_0x7bfb('0x5')](_0x5c7237+':'+_0x23e66b['id'],_0x23e66b);UserVoiceQueueRtEvents[_0x7bfb('0x5')](_0x5c7237,_0x23e66b);_0x3d57e3(null);};}for(var e in events){if(events[_0x7bfb('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7bfb('0x7')](e,emitEvent(event));}}module[_0x7bfb('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index b20e780..b93ecb3 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 _0x0681=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','api'];(function(_0x173eff,_0x55a7d0){var _0x119fbd=function(_0x31a223){while(--_0x31a223){_0x173eff['push'](_0x173eff['shift']());}};_0x119fbd(++_0x55a7d0);}(_0x0681,0x175));var _0x1068=function(_0x1a3447,_0x3fddfd){_0x1a3447=_0x1a3447-0x0;var _0x33cff5=_0x0681[_0x1a3447];return _0x33cff5;};'use strict';var _=require(_0x1068('0x0'));var util=require(_0x1068('0x1'));var logger=require(_0x1068('0x2'))(_0x1068('0x3'));var moment=require('moment');var BPromise=require(_0x1068('0x4'));var rp=require(_0x1068('0x5'));var fs=require('fs');var path=require(_0x1068('0x6'));var rimraf=require(_0x1068('0x7'));var config=require(_0x1068('0x8'));var attributes=require(_0x1068('0x9'));module[_0x1068('0xa')]=function(_0x367152,_0xb6f248){return _0x367152[_0x1068('0xb')](_0x1068('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81b9=['api','moment','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x81b9,0x15c));var _0x981b=function(_0x4c37d7,_0x7134a3){_0x4c37d7=_0x4c37d7-0x0;var _0x5ea63b=_0x81b9[_0x4c37d7];return _0x5ea63b;};'use strict';var _=require(_0x981b('0x0'));var util=require(_0x981b('0x1'));var logger=require('../../config/logger')(_0x981b('0x2'));var moment=require(_0x981b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x981b('0x4'));var config=require(_0x981b('0x5'));var attributes=require(_0x981b('0x6'));module[_0x981b('0x7')]=function(_0x3aaafa,_0x1c31aa){return _0x3aaafa[_0x981b('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0x981b('0x9'),'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 5f287aa..8a13430 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 _0xa4c5=['redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x59a50f,_0xdf3d4a){var _0x25192e=function(_0x21e656){while(--_0x21e656){_0x59a50f['push'](_0x59a50f['shift']());}};_0x25192e(++_0xdf3d4a);}(_0xa4c5,0x114));var _0x5a4c=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa4c5[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x5a4c('0x0'));var util=require(_0x5a4c('0x1'));var moment=require(_0x5a4c('0x2'));var BPromise=require(_0x5a4c('0x3'));var rs=require(_0x5a4c('0x4'));var fs=require('fs');var Redis=require(_0x5a4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5a4c('0x6'))('rpc');var config=require(_0x5a4c('0x7'));var jayson=require(_0x5a4c('0x8'));var client=jayson[_0x5a4c('0x9')][_0x5a4c('0xa')]({'port':0x232a});config['redis']=_[_0x5a4c('0xb')](config[_0x5a4c('0xc')],{'host':_0x5a4c('0xd'),'port':0x18eb});var socket=require(_0x5a4c('0xe'))(new Redis(config['redis']));require(_0x5a4c('0xf'))['register'](socket);function respondWithRpcPromise(_0x43ffd0,_0x5a0cb1,_0x20aef){return new BPromise(function(_0x12fa6c,_0x303843){return client['request'](_0x43ffd0,_0x20aef)[_0x5a4c('0x10')](function(_0xb9b0d6){logger[_0x5a4c('0x11')](_0x5a4c('0x12'),_0x5a0cb1,_0x5a4c('0x13'));logger[_0x5a4c('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5a0cb1,_0x5a4c('0x13'),JSON[_0x5a4c('0x15')](_0xb9b0d6));if(_0xb9b0d6[_0x5a4c('0x16')]){if(_0xb9b0d6['error'][_0x5a4c('0x17')]===0x1f4){logger[_0x5a4c('0x16')](_0x5a4c('0x12'),_0x5a0cb1,_0xb9b0d6[_0x5a4c('0x16')][_0x5a4c('0x18')]);return _0x303843(_0xb9b0d6[_0x5a4c('0x16')][_0x5a4c('0x18')]);}logger[_0x5a4c('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5a0cb1,_0xb9b0d6[_0x5a4c('0x16')][_0x5a4c('0x18')]);return _0x12fa6c(_0xb9b0d6[_0x5a4c('0x16')][_0x5a4c('0x18')]);}else{logger[_0x5a4c('0x11')](_0x5a4c('0x12'),_0x5a0cb1,_0x5a4c('0x13'));_0x12fa6c(_0xb9b0d6[_0x5a4c('0x19')][_0x5a4c('0x18')]);}})['catch'](function(_0x62a6bc){logger['error'](_0x5a4c('0x12'),_0x5a0cb1,_0x62a6bc);_0x303843(_0x62a6bc);});});}exports[_0x5a4c('0x1a')]=function(_0x33a138){var _0x784023=this;return new Promise(function(_0x12a01d,_0x3b1c10){return db[_0x5a4c('0x1b')]['findAll']({'raw':_0x33a138[_0x5a4c('0x1c')]?_0x33a138[_0x5a4c('0x1c')][_0x5a4c('0x1d')]===undefined?!![]:![]:!![],'where':_0x33a138[_0x5a4c('0x1c')]?_0x33a138[_0x5a4c('0x1c')]['where']||null:null,'attributes':[[db[_0x5a4c('0x1e')]['fn'](_0x5a4c('0x1f'),db[_0x5a4c('0x1e')]['fn']('IF',db[_0x5a4c('0x1e')][_0x5a4c('0x20')](_0x5a4c('0x21')))),_0x5a4c('0x22')]]})[_0x5a4c('0x10')](function(_0x2ced7a){logger[_0x5a4c('0x11')](_0x5a4c('0x1a'),_0x33a138);logger[_0x5a4c('0x14')](_0x5a4c('0x1a'),_0x33a138,JSON['stringify'](_0x2ced7a));_0x12a01d(_0x2ced7a);})[_0x5a4c('0x23')](function(_0x55ac7f){logger[_0x5a4c('0x16')](_0x5a4c('0x1a'),_0x55ac7f[_0x5a4c('0x18')],_0x33a138);_0x3b1c10(_0x784023['error'](0x1f4,_0x55ac7f[_0x5a4c('0x18')]));});});}; \ No newline at end of file +var _0xaffd=['request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','GetVoiceQueueRtPauses','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x4a7435,_0x4d796c){var _0x38ca88=function(_0x25d2ab){while(--_0x25d2ab){_0x4a7435['push'](_0x4a7435['shift']());}};_0x38ca88(++_0x4d796c);}(_0xaffd,0x74));var _0xdaff=function(_0x1404e8,_0x50100e){_0x1404e8=_0x1404e8-0x0;var _0xe8f727=_0xaffd[_0x1404e8];return _0xe8f727;};'use strict';var _=require('lodash');var util=require(_0xdaff('0x0'));var moment=require('moment');var BPromise=require(_0xdaff('0x1'));var rs=require(_0xdaff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdaff('0x3'));var logger=require('../../config/logger')(_0xdaff('0x4'));var config=require('../../config/environment');var jayson=require(_0xdaff('0x5'));var client=jayson[_0xdaff('0x6')]['http']({'port':0x232a});config[_0xdaff('0x7')]=_[_0xdaff('0x8')](config[_0xdaff('0x7')],{'host':_0xdaff('0x9'),'port':0x18eb});var socket=require(_0xdaff('0xa'))(new Redis(config[_0xdaff('0x7')]));require('./userVoiceQueueRt.socket')[_0xdaff('0xb')](socket);function respondWithRpcPromise(_0x104d8a,_0x568c87,_0x726304){return new BPromise(function(_0x377ada,_0x5aa2d8){return client[_0xdaff('0xc')](_0x104d8a,_0x726304)['then'](function(_0x5e690c){logger[_0xdaff('0xd')](_0xdaff('0xe'),_0x568c87,'request\x20sent');logger[_0xdaff('0xf')](_0xdaff('0x10'),_0x568c87,_0xdaff('0x11'),JSON['stringify'](_0x5e690c));if(_0x5e690c[_0xdaff('0x12')]){if(_0x5e690c[_0xdaff('0x12')][_0xdaff('0x13')]===0x1f4){logger[_0xdaff('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x568c87,_0x5e690c[_0xdaff('0x12')][_0xdaff('0x14')]);return _0x5aa2d8(_0x5e690c[_0xdaff('0x12')][_0xdaff('0x14')]);}logger[_0xdaff('0x12')](_0xdaff('0xe'),_0x568c87,_0x5e690c[_0xdaff('0x12')][_0xdaff('0x14')]);return _0x377ada(_0x5e690c[_0xdaff('0x12')][_0xdaff('0x14')]);}else{logger[_0xdaff('0xd')](_0xdaff('0xe'),_0x568c87,'request\x20sent');_0x377ada(_0x5e690c['result']['message']);}})[_0xdaff('0x15')](function(_0x266385){logger[_0xdaff('0x12')](_0xdaff('0xe'),_0x568c87,_0x266385);_0x5aa2d8(_0x266385);});});}exports['GetVoiceQueueRtPauses']=function(_0x358de0){var _0x4b68e3=this;return new Promise(function(_0xd85b59,_0x7883bf){return db['UserVoiceQueueRt']['findAll']({'raw':_0x358de0[_0xdaff('0x16')]?_0x358de0[_0xdaff('0x16')][_0xdaff('0x17')]===undefined?!![]:![]:!![],'where':_0x358de0[_0xdaff('0x16')]?_0x358de0[_0xdaff('0x16')]['where']||null:null,'attributes':[[db[_0xdaff('0x18')]['fn'](_0xdaff('0x19'),db[_0xdaff('0x18')]['fn']('IF',db[_0xdaff('0x18')][_0xdaff('0x1a')](_0xdaff('0x1b')))),_0xdaff('0x1c')]]})[_0xdaff('0x1d')](function(_0x16a7f2){logger['info']('GetVoiceQueueRtPauses',_0x358de0);logger[_0xdaff('0xf')]('GetVoiceQueueRtPauses',_0x358de0,JSON[_0xdaff('0x1e')](_0x16a7f2));_0xd85b59(_0x16a7f2);})[_0xdaff('0x15')](function(_0x5b9256){logger[_0xdaff('0x12')](_0xdaff('0x1f'),_0x5b9256[_0xdaff('0x14')],_0x358de0);_0x7883bf(_0x4b68e3['error'](0x1f4,_0x5b9256['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5d190b0..62f60d1 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 _0x66c7=['remove','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4e2111,_0x1d5493){var _0x1b4556=function(_0x2bd9ee){while(--_0x2bd9ee){_0x4e2111['push'](_0x4e2111['shift']());}};_0x1b4556(++_0x1d5493);}(_0x66c7,0x15c));var _0x766c=function(_0x47da96,_0x2ab4ff){_0x47da96=_0x47da96-0x0;var _0x4a8b27=_0x66c7[_0x47da96];return _0x4a8b27;};'use strict';var UserVoiceQueueRtEvents=require(_0x766c('0x0'));var events=[_0x766c('0x1'),_0x766c('0x2'),'update'];function createListener(_0x507a68,_0x47351a){return function(_0x23b678){_0x47351a[_0x766c('0x3')](_0x507a68,_0x23b678);};}function removeListener(_0x1b2a8e,_0x2b4c75){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1b2a8e,_0x2b4c75);};}exports[_0x766c('0x4')]=function(_0x80d91d){for(var _0x6f94c3=0x0,_0xb0b5f7=events[_0x766c('0x5')];_0x6f94c3<_0xb0b5f7;_0x6f94c3++){var _0x3c4683=events[_0x6f94c3];var _0x22a524=createListener(_0x766c('0x6')+_0x3c4683,_0x80d91d);UserVoiceQueueRtEvents['on'](_0x3c4683,_0x22a524);}}; \ No newline at end of file +var _0x287e=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x4d8fc6,_0x48d079){var _0x4a3a1a=function(_0x2f1058){while(--_0x2f1058){_0x4d8fc6['push'](_0x4d8fc6['shift']());}};_0x4a3a1a(++_0x48d079);}(_0x287e,0x1e3));var _0xe287=function(_0x18425a,_0x395567){_0x18425a=_0x18425a-0x0;var _0x1c680b=_0x287e[_0x18425a];return _0x1c680b;};'use strict';var UserVoiceQueueRtEvents=require(_0xe287('0x0'));var events=[_0xe287('0x1'),_0xe287('0x2'),_0xe287('0x3')];function createListener(_0x43ac68,_0xf00cd7){return function(_0x33e26a){_0xf00cd7[_0xe287('0x4')](_0x43ac68,_0x33e26a);};}function removeListener(_0x16d2d7,_0x5f34d6){return function(){UserVoiceQueueRtEvents[_0xe287('0x5')](_0x16d2d7,_0x5f34d6);};}exports[_0xe287('0x6')]=function(_0x5af7ce){for(var _0x4b3807=0x0,_0x38bd18=events['length'];_0x4b3807<_0x38bd18;_0x4b3807++){var _0x4f3cf1=events[_0x4b3807];var _0x4cd1f4=createListener(_0xe287('0x7')+_0x4f3cf1,_0x5af7ce);UserVoiceQueueRtEvents['on'](_0x4f3cf1,_0x4cd1f4);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0bb3e4b..e9c64b8 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x570e92,_0x55cebd){var _0x3298ff=function(_0x37f59c){while(--_0x37f59c){_0x570e92['push'](_0x570e92['shift']());}};_0x3298ff(++_0x55cebd);}(_0xe706,0xa3));var _0x6e70=function(_0x114e6a,_0x3dc9d2){_0x114e6a=_0x114e6a-0x0;var _0x423189=_0xe706[_0x114e6a];return _0x423189;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x253f2f,_0x105fe9){var _0x253912=function(_0x25bfd4){while(--_0x25bfd4){_0x253f2f['push'](_0x253f2f['shift']());}};_0x253912(++_0x105fe9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 46f53e9..43d7346 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 _0x0a5c=['INTEGER','sequelize'];(function(_0x283ec2,_0x4d1c02){var _0xdc5b57=function(_0x4f812c){while(--_0x4f812c){_0x283ec2['push'](_0x283ec2['shift']());}};_0xdc5b57(++_0x4d1c02);}(_0x0a5c,0x97));var _0xc0a5=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x0a5c[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0xc0a5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc0a5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe38c=['INTEGER','sequelize'];(function(_0x3c86dc,_0x5d22fc){var _0x4aeb79=function(_0x29d7c8){while(--_0x29d7c8){_0x3c86dc['push'](_0x3c86dc['shift']());}};_0x4aeb79(++_0x5d22fc);}(_0xe38c,0xbb));var _0xce38=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe38c[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xce38('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xce38('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 249fdd7..cc83da5 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 _0xb12b=['UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0x179ec1,_0x1d7f3f){var _0x27e3e4=function(_0x22924a){while(--_0x22924a){_0x179ec1['push'](_0x179ec1['shift']());}};_0x27e3e4(++_0x1d7f3f);}(_0xb12b,0x176));var _0xbb12=function(_0x321b0a,_0xf1e0f7){_0x321b0a=_0x321b0a-0x0;var _0x4bd989=_0xb12b[_0x321b0a];return _0x4bd989;};'use strict';var _=require('lodash');var util=require(_0xbb12('0x0'));var logger=require('../../config/logger')(_0xbb12('0x1'));var moment=require(_0xbb12('0x2'));var BPromise=require(_0xbb12('0x3'));var rp=require(_0xbb12('0x4'));var fs=require('fs');var path=require(_0xbb12('0x5'));var rimraf=require(_0xbb12('0x6'));var config=require(_0xbb12('0x7'));var attributes=require(_0xbb12('0x8'));module['exports']=function(_0x2b6056,_0xf3df86){return _0x2b6056[_0xbb12('0x9')](_0xbb12('0xa'),attributes,{'tableName':_0xbb12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7315=['bluebird','request-promise','path','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x2e5038,_0x19cf2d){var _0x2b84d2=function(_0x4cfb8e){while(--_0x4cfb8e){_0x2e5038['push'](_0x2e5038['shift']());}};_0x2b84d2(++_0x19cf2d);}(_0x7315,0x17e));var _0x5731=function(_0x3e5db0,_0x369dc2){_0x3e5db0=_0x3e5db0-0x0;var _0x3864d8=_0x7315[_0x3e5db0];return _0x3864d8;};'use strict';var _=require(_0x5731('0x0'));var util=require(_0x5731('0x1'));var logger=require(_0x5731('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5731('0x3'));var rp=require(_0x5731('0x4'));var fs=require('fs');var path=require(_0x5731('0x5'));var rimraf=require('rimraf');var config=require(_0x5731('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x5731('0x7')]=function(_0x2b97a4,_0x121de1){return _0x2b97a4[_0x5731('0x8')](_0x5731('0x9'),attributes,{'tableName':_0x5731('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1d5ef43..cc5f29c 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 _0xd735=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x10d7b3,_0x2cbf68){var _0x5744da=function(_0x3464c9){while(--_0x3464c9){_0x10d7b3['push'](_0x10d7b3['shift']());}};_0x5744da(++_0x2cbf68);}(_0xd735,0x7a));var _0x5d73=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd735[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x5d73('0x0'));var util=require(_0x5d73('0x1'));var moment=require(_0x5d73('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d73('0x3'));var fs=require('fs');var Redis=require(_0x5d73('0x4'));var db=require(_0x5d73('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d73('0x6'))('rpc');var config=require(_0x5d73('0x7'));var jayson=require(_0x5d73('0x8'));var client=jayson[_0x5d73('0x9')][_0x5d73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54cd4c,_0x54c7ef,_0x55e082){return new BPromise(function(_0x583f2f,_0x4fa15a){return client[_0x5d73('0xb')](_0x54cd4c,_0x55e082)['then'](function(_0x5b4800){logger[_0x5d73('0xc')](_0x5d73('0xd'),_0x54c7ef,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x54c7ef,_0x5d73('0xe'),JSON[_0x5d73('0xf')](_0x5b4800));if(_0x5b4800['error']){if(_0x5b4800[_0x5d73('0x10')][_0x5d73('0x11')]===0x1f4){logger[_0x5d73('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54c7ef,_0x5b4800[_0x5d73('0x10')][_0x5d73('0x12')]);return _0x4fa15a(_0x5b4800[_0x5d73('0x10')]['message']);}logger['error'](_0x5d73('0xd'),_0x54c7ef,_0x5b4800['error'][_0x5d73('0x12')]);return _0x583f2f(_0x5b4800[_0x5d73('0x10')][_0x5d73('0x12')]);}else{logger[_0x5d73('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54c7ef,_0x5d73('0xe'));_0x583f2f(_0x5b4800['result']['message']);}})[_0x5d73('0x13')](function(_0x3cf970){logger[_0x5d73('0x10')](_0x5d73('0xd'),_0x54c7ef,_0x3cf970);_0x4fa15a(_0x3cf970);});});} \ No newline at end of file +var _0x4294=['util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x59a784,_0x39a9e1){var _0x219cfe=function(_0x2ae8b3){while(--_0x2ae8b3){_0x59a784['push'](_0x59a784['shift']());}};_0x219cfe(++_0x39a9e1);}(_0x4294,0xaa));var _0x4429=function(_0x2e22b4,_0x18a987){_0x2e22b4=_0x2e22b4-0x0;var _0x45f55a=_0x4294[_0x2e22b4];return _0x45f55a;};'use strict';var _=require(_0x4429('0x0'));var util=require(_0x4429('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4429('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4429('0x3'));var logger=require(_0x4429('0x4'))(_0x4429('0x5'));var config=require(_0x4429('0x6'));var jayson=require(_0x4429('0x7'));var client=jayson[_0x4429('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef81e,_0x1f81b9,_0x51ca82){return new BPromise(function(_0x5ca5c7,_0x5bfc3d){return client['request'](_0x5ef81e,_0x51ca82)[_0x4429('0x9')](function(_0x27b8c4){logger[_0x4429('0xa')](_0x4429('0xb'),_0x1f81b9,_0x4429('0xc'));logger[_0x4429('0xd')](_0x4429('0xe'),_0x1f81b9,'request\x20sent',JSON['stringify'](_0x27b8c4));if(_0x27b8c4[_0x4429('0xf')]){if(_0x27b8c4['error'][_0x4429('0x10')]===0x1f4){logger[_0x4429('0xf')](_0x4429('0xb'),_0x1f81b9,_0x27b8c4[_0x4429('0xf')][_0x4429('0x11')]);return _0x5bfc3d(_0x27b8c4[_0x4429('0xf')][_0x4429('0x11')]);}logger[_0x4429('0xf')](_0x4429('0xb'),_0x1f81b9,_0x27b8c4[_0x4429('0xf')][_0x4429('0x11')]);return _0x5ca5c7(_0x27b8c4[_0x4429('0xf')][_0x4429('0x11')]);}else{logger[_0x4429('0xa')](_0x4429('0xb'),_0x1f81b9,_0x4429('0xc'));_0x5ca5c7(_0x27b8c4[_0x4429('0x12')][_0x4429('0x11')]);}})['catch'](function(_0x3e02d4){logger[_0x4429('0xf')](_0x4429('0xb'),_0x1f81b9,_0x3e02d4);_0x5bfc3d(_0x3e02d4);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 61eddb2..14a205e 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 _0xc737=['get','/:id','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x26a798,_0x21e0e8){var _0x57f332=function(_0x4ef5dc){while(--_0x4ef5dc){_0x26a798['push'](_0x26a798['shift']());}};_0x57f332(++_0x21e0e8);}(_0xc737,0x8e));var _0x7c73=function(_0x4bbdb5,_0x2f09d1){_0x4bbdb5=_0x4bbdb5-0x0;var _0x1916b7=_0xc737[_0x4bbdb5];return _0x1916b7;};'use strict';var multer=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var path=require('path');var timeout=require(_0x7c73('0x2'));var express=require(_0x7c73('0x3'));var router=express[_0x7c73('0x4')]();var fs_extra=require(_0x7c73('0x5'));var auth=require(_0x7c73('0x6'));var interaction=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var controller=require('./variable.controller');router['get']('/',auth[_0x7c73('0x9')](),controller[_0x7c73('0xa')]);router[_0x7c73('0xb')](_0x7c73('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7c73('0xd')](_0x7c73('0xc'),auth[_0x7c73('0x9')](),controller[_0x7c73('0xe')]);router['delete'](_0x7c73('0xc'),auth['isAuthenticated'](),controller[_0x7c73('0xf')]);module[_0x7c73('0x10')]=router; \ No newline at end of file +var _0x1d5b=['../../config/environment','isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x43bb44,_0x938528){var _0x54a567=function(_0x4887da){while(--_0x4887da){_0x43bb44['push'](_0x43bb44['shift']());}};_0x54a567(++_0x938528);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x54b7f4,_0x595418){_0x54b7f4=_0x54b7f4-0x0;var _0x3f1342=_0x1d5b[_0x54b7f4];return _0x3f1342;};'use strict';var multer=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var path=require(_0xb1d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d5('0x3'));var router=express['Router']();var fs_extra=require(_0xb1d5('0x4'));var auth=require(_0xb1d5('0x5'));var interaction=require(_0xb1d5('0x6'));var config=require(_0xb1d5('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0xb1d5('0x8')](),controller[_0xb1d5('0x9')]);router[_0xb1d5('0xa')](_0xb1d5('0xb'),auth[_0xb1d5('0x8')](),controller[_0xb1d5('0xc')]);router[_0xb1d5('0xd')]('/',auth[_0xb1d5('0x8')](),controller['create']);router[_0xb1d5('0xe')](_0xb1d5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb1d5('0xf')](_0xb1d5('0xb'),auth[_0xb1d5('0x8')](),controller['destroy']);module[_0xb1d5('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c84f25e..8079225 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 _0xabc7=['exports','STRING','name','sequelize'];(function(_0x5c054b,_0x5b1324){var _0x3f0093=function(_0x302092){while(--_0x302092){_0x5c054b['push'](_0x5c054b['shift']());}};_0x3f0093(++_0x5b1324);}(_0xabc7,0x77));var _0x7abc=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xabc7[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x7abc('0x0'));module[_0x7abc('0x1')]={'name':{'type':Sequelize[_0x7abc('0x2')],'unique':_0x7abc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7abc('0x2')]}}; \ No newline at end of file +var _0xff39=['exports','STRING','name'];(function(_0x26e040,_0xd91c1a){var _0x47894b=function(_0xccc38b){while(--_0xccc38b){_0x26e040['push'](_0x26e040['shift']());}};_0x47894b(++_0xd91c1a);}(_0xff39,0xba));var _0x9ff3=function(_0x8f6a2c,_0x435996){_0x8f6a2c=_0x8f6a2c-0x0;var _0x42a718=_0xff39[_0x8f6a2c];return _0x42a718;};'use strict';var Sequelize=require('sequelize');module[_0x9ff3('0x0')]={'name':{'type':Sequelize[_0x9ff3('0x1')],'unique':_0x9ff3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9ff3('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c702788..0918213 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 _0x4c8f=['type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','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','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes'];(function(_0x32d7f8,_0x462797){var _0x59c636=function(_0x392668){while(--_0x392668){_0x32d7f8['push'](_0x32d7f8['shift']());}};_0x59c636(++_0x462797);}(_0x4c8f,0x11e));var _0xf4c8=function(_0x5df87c,_0x509bb1){_0x5df87c=_0x5df87c-0x0;var _0x59eba6=_0x4c8f[_0x5df87c];return _0x59eba6;};'use strict';var emlformat=require(_0xf4c8('0x0'));var rimraf=require(_0xf4c8('0x1'));var zipdir=require(_0xf4c8('0x2'));var jsonpatch=require(_0xf4c8('0x3'));var rp=require(_0xf4c8('0x4'));var moment=require(_0xf4c8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4c8('0x6'));var path=require(_0xf4c8('0x7'));var sox=require(_0xf4c8('0x8'));var csv=require('to-csv');var ejs=require(_0xf4c8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4c8('0xa'));var squel=require(_0xf4c8('0xb'));var crypto=require(_0xf4c8('0xc'));var jsforce=require(_0xf4c8('0xd'));var deskjs=require(_0xf4c8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4c8('0xf'));var Redis=require(_0xf4c8('0x10'));var authService=require(_0xf4c8('0x11'));var qs=require(_0xf4c8('0x12'));var as=require(_0xf4c8('0x13'));var hardwareService=require(_0xf4c8('0x14'));var logger=require(_0xf4c8('0x15'))(_0xf4c8('0x16'));var utils=require('../../config/utils');var config=require(_0xf4c8('0x17'));var licenseUtil=require(_0xf4c8('0x18'));var db=require(_0xf4c8('0x19'))['db'];function respondWithStatusCode(_0xf6a0ca,_0x40f34d){_0x40f34d=_0x40f34d||0xcc;return function(_0x82152b){if(_0x82152b){return _0xf6a0ca[_0xf4c8('0x1a')](_0x40f34d);}return _0xf6a0ca[_0xf4c8('0x1b')](_0x40f34d)[_0xf4c8('0x1c')]();};}function respondWithResult(_0x41ef7b,_0x3233f7){_0x3233f7=_0x3233f7||0xc8;return function(_0x44a373){if(_0x44a373){return _0x41ef7b[_0xf4c8('0x1b')](_0x3233f7)[_0xf4c8('0x1d')](_0x44a373);}};}function respondWithFilteredResult(_0x46fbd4,_0x2a8ef6){return function(_0x316276){if(_0x316276){var _0xb33eab=typeof _0x2a8ef6[_0xf4c8('0x1e')]===_0xf4c8('0x1f')&&typeof _0x2a8ef6['limit']===_0xf4c8('0x1f');var _0x3cf41e=_0x316276[_0xf4c8('0x20')];var _0x4172d9=_0xb33eab?0x0:_0x2a8ef6[_0xf4c8('0x1e')];var _0x5496ea=_0xb33eab?_0x316276[_0xf4c8('0x20')]:_0x2a8ef6[_0xf4c8('0x1e')]+_0x2a8ef6['limit'];var _0x37954c;if(_0x5496ea>=_0x3cf41e){_0x5496ea=_0x3cf41e;_0x37954c=0xc8;}else{_0x37954c=0xce;}_0x46fbd4[_0xf4c8('0x1b')](_0x37954c);return _0x46fbd4[_0xf4c8('0x21')](_0xf4c8('0x22'),_0x4172d9+'-'+_0x5496ea+'/'+_0x3cf41e)[_0xf4c8('0x1d')](_0x316276);}return null;};}function patchUpdates(_0x114e5b){return function(_0xa62939){try{jsonpatch[_0xf4c8('0x23')](_0xa62939,_0x114e5b,!![]);}catch(_0x2acf53){return BPromise['reject'](_0x2acf53);}return _0xa62939[_0xf4c8('0x24')]();};}function saveUpdates(_0x511772,_0x4fadfa){return function(_0x490c18){if(_0x490c18){return _0x490c18[_0xf4c8('0x25')](_0x511772)[_0xf4c8('0x26')](function(_0xe71125){return _0xe71125;});}return null;};}function removeEntity(_0x4140db,_0x27172d){return function(_0x12d797){if(_0x12d797){return _0x12d797[_0xf4c8('0x27')]()['then'](function(){var _0x5de3ed=_0x12d797[_0xf4c8('0x28')]({'plain':!![]});var _0x3c327f=_0xf4c8('0x29');return db[_0xf4c8('0x2a')]['destroy']({'where':{'type':_0x3c327f,'resourceId':_0x5de3ed['id']}})['then'](function(){return _0x12d797;});})[_0xf4c8('0x26')](function(){_0x4140db[_0xf4c8('0x1b')](0xcc)[_0xf4c8('0x1c')]();});}};}function handleEntityNotFound(_0x4ab853,_0x4f5c93){return function(_0x2afbcc){if(!_0x2afbcc){_0x4ab853[_0xf4c8('0x1a')](0x194);}return _0x2afbcc;};}function handleError(_0x17b2dd,_0x56c541){_0x56c541=_0x56c541||0x1f4;return function(_0x1ee595){logger['error'](_0x1ee595[_0xf4c8('0x2b')]);if(_0x1ee595['name']){delete _0x1ee595[_0xf4c8('0x2c')];}_0x17b2dd[_0xf4c8('0x1b')](_0x56c541)[_0xf4c8('0x2d')](_0x1ee595);};}exports[_0xf4c8('0x2e')]=function(_0x4916a0,_0xd013ed){var _0x40f32e={},_0x239187={},_0x497f9d={'count':0x0,'rows':[]};var _0x21b2ca=_[_0xf4c8('0x2f')](db[_0xf4c8('0x30')][_0xf4c8('0x31')],function(_0xd6dcc9){return{'name':_0xd6dcc9['fieldName'],'type':_0xd6dcc9[_0xf4c8('0x32')]['key']};});_0x239187[_0xf4c8('0x33')]=_[_0xf4c8('0x2f')](_0x21b2ca,_0xf4c8('0x2c'));_0x239187[_0xf4c8('0x34')]=_['keys'](_0x4916a0[_0xf4c8('0x34')]);_0x239187[_0xf4c8('0x35')]=_['intersection'](_0x239187[_0xf4c8('0x33')],_0x239187[_0xf4c8('0x34')]);_0x40f32e[_0xf4c8('0x36')]=_[_0xf4c8('0x37')](_0x239187[_0xf4c8('0x33')],qs[_0xf4c8('0x38')](_0x4916a0['query'][_0xf4c8('0x38')]));_0x40f32e[_0xf4c8('0x36')]=_0x40f32e[_0xf4c8('0x36')][_0xf4c8('0x39')]?_0x40f32e[_0xf4c8('0x36')]:_0x239187[_0xf4c8('0x33')];if(!_0x4916a0[_0xf4c8('0x34')][_0xf4c8('0x3a')]('nolimit')){_0x40f32e[_0xf4c8('0x3b')]=qs[_0xf4c8('0x3b')](_0x4916a0[_0xf4c8('0x34')]['limit']);_0x40f32e[_0xf4c8('0x1e')]=qs[_0xf4c8('0x1e')](_0x4916a0[_0xf4c8('0x34')][_0xf4c8('0x1e')]);}_0x40f32e['order']=qs[_0xf4c8('0x3c')](_0x4916a0[_0xf4c8('0x34')]['sort']);_0x40f32e['where']=qs['filters'](_['pick'](_0x4916a0[_0xf4c8('0x34')],_0x239187[_0xf4c8('0x35')]),_0x21b2ca);if(_0x4916a0[_0xf4c8('0x34')][_0xf4c8('0x3d')]){_0x40f32e[_0xf4c8('0x3e')]=_[_0xf4c8('0x3f')](_0x40f32e[_0xf4c8('0x3e')],{'$or':_['map'](_0x21b2ca,function(_0x14bc3f){if(_0x14bc3f[_0xf4c8('0x32')]!==_0xf4c8('0x40')){var _0x5d099e={};_0x5d099e[_0x14bc3f[_0xf4c8('0x2c')]]={'$like':'%'+_0x4916a0[_0xf4c8('0x34')][_0xf4c8('0x3d')]+'%'};return _0x5d099e;}})});}_0x40f32e=_[_0xf4c8('0x3f')]({},_0x40f32e,_0x4916a0[_0xf4c8('0x41')]);var _0xbe2d3e={'where':_0x40f32e[_0xf4c8('0x3e')]};return db[_0xf4c8('0x30')][_0xf4c8('0x20')](_0xbe2d3e)[_0xf4c8('0x26')](function(_0x529c8e){_0x497f9d['count']=_0x529c8e;if(_0x4916a0[_0xf4c8('0x34')]['includeAll']){_0x40f32e['include']=[{'all':!![]}];}return db[_0xf4c8('0x30')][_0xf4c8('0x42')](_0x40f32e);})[_0xf4c8('0x26')](function(_0xccb5bc){_0x497f9d[_0xf4c8('0x43')]=_0xccb5bc;return _0x497f9d;})['then'](respondWithFilteredResult(_0xd013ed,_0x40f32e))['catch'](handleError(_0xd013ed,null));};exports[_0xf4c8('0x44')]=function(_0x4342ff,_0x14f87e){var _0x47a323={'raw':!![],'where':{'id':_0x4342ff[_0xf4c8('0x45')]['id']}},_0x2d942d={};_0x2d942d[_0xf4c8('0x33')]=_[_0xf4c8('0x46')](db['Variable'][_0xf4c8('0x31')]);_0x2d942d['query']=_[_0xf4c8('0x46')](_0x4342ff[_0xf4c8('0x34')]);_0x2d942d[_0xf4c8('0x35')]=_[_0xf4c8('0x37')](_0x2d942d['model'],_0x2d942d[_0xf4c8('0x34')]);_0x47a323['attributes']=_['intersection'](_0x2d942d[_0xf4c8('0x33')],qs[_0xf4c8('0x38')](_0x4342ff[_0xf4c8('0x34')][_0xf4c8('0x38')]));_0x47a323[_0xf4c8('0x36')]=_0x47a323[_0xf4c8('0x36')][_0xf4c8('0x39')]?_0x47a323[_0xf4c8('0x36')]:_0x2d942d[_0xf4c8('0x33')];if(_0x4342ff['query']['includeAll']){_0x47a323[_0xf4c8('0x47')]=[{'all':!![]}];}_0x47a323=_[_0xf4c8('0x3f')]({},_0x47a323,_0x4342ff[_0xf4c8('0x41')]);return db[_0xf4c8('0x30')][_0xf4c8('0x48')](_0x47a323)[_0xf4c8('0x26')](handleEntityNotFound(_0x14f87e,null))[_0xf4c8('0x26')](respondWithResult(_0x14f87e,null))[_0xf4c8('0x49')](handleError(_0x14f87e,null));};exports[_0xf4c8('0x4a')]=function(_0x5f4afe,_0x2cc1da){return db[_0xf4c8('0x30')][_0xf4c8('0x4a')](_0x5f4afe[_0xf4c8('0x4b')],{})['then'](function(_0x14ab5b){var _0x5620ed=_0x5f4afe[_0xf4c8('0x4c')]['get']({'plain':!![]});if(!_0x5620ed)throw new Error(_0xf4c8('0x4d'));if(_0x5620ed[_0xf4c8('0x4e')]===_0xf4c8('0x4c')){var _0x23430e=_0x14ab5b[_0xf4c8('0x28')]({'plain':!![]});var _0xe4b7a8=_0xf4c8('0x29');return db[_0xf4c8('0x4f')]['find']({'where':{'name':_0xe4b7a8,'userProfileId':_0x5620ed[_0xf4c8('0x50')]},'raw':!![]})['then'](function(_0x59b9ee){if(_0x59b9ee&&_0x59b9ee[_0xf4c8('0x51')]===0x0){return db[_0xf4c8('0x2a')][_0xf4c8('0x4a')]({'name':_0x23430e[_0xf4c8('0x2c')],'resourceId':_0x23430e['id'],'type':_0x59b9ee[_0xf4c8('0x2c')],'sectionId':_0x59b9ee['id']},{})[_0xf4c8('0x26')](function(){return _0x14ab5b;});}else{return _0x14ab5b;}})[_0xf4c8('0x49')](function(_0x6007ca){logger[_0xf4c8('0x52')](_0xf4c8('0x53'),_0x6007ca);throw _0x6007ca;});}return _0x14ab5b;})[_0xf4c8('0x26')](respondWithResult(_0x2cc1da,0xc9))['catch'](handleError(_0x2cc1da,null));};exports[_0xf4c8('0x25')]=function(_0x10000b,_0x547434){if(_0x10000b[_0xf4c8('0x4b')]['id']){delete _0x10000b['body']['id'];}return db['Variable'][_0xf4c8('0x48')]({'where':{'id':_0x10000b[_0xf4c8('0x45')]['id']}})[_0xf4c8('0x26')](handleEntityNotFound(_0x547434,null))[_0xf4c8('0x26')](saveUpdates(_0x10000b['body'],null))[_0xf4c8('0x26')](respondWithResult(_0x547434,null))['catch'](handleError(_0x547434,null));};exports['destroy']=function(_0x3332ee,_0x209206){return db[_0xf4c8('0x30')][_0xf4c8('0x48')]({'where':{'id':_0x3332ee[_0xf4c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x209206,null))['then'](removeEntity(_0x209206,null))[_0xf4c8('0x49')](handleError(_0x209206,null));}; \ No newline at end of file +var _0xb130=['length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','update','then','Variables','destroy','end','error','stack','name','send','index','map','Variable','fieldName','key','model','query','keys','intersection','fields','attributes'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb130,0x1cd));var _0x0b13=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xb130[_0x1acc2d];return _0xabfa6d;};'use strict';var emlformat=require(_0x0b13('0x0'));var rimraf=require(_0x0b13('0x1'));var zipdir=require(_0x0b13('0x2'));var jsonpatch=require(_0x0b13('0x3'));var rp=require(_0x0b13('0x4'));var moment=require('moment');var BPromise=require(_0x0b13('0x5'));var Mustache=require(_0x0b13('0x6'));var util=require(_0x0b13('0x7'));var path=require('path');var sox=require(_0x0b13('0x8'));var csv=require(_0x0b13('0x9'));var ejs=require(_0x0b13('0xa'));var fs=require('fs');var fs_extra=require(_0x0b13('0xb'));var _=require('lodash');var squel=require(_0x0b13('0xc'));var crypto=require(_0x0b13('0xd'));var jsforce=require(_0x0b13('0xe'));var deskjs=require(_0x0b13('0xf'));var toCsv=require(_0x0b13('0x9'));var querystring=require(_0x0b13('0x10'));var Papa=require('papaparse');var Redis=require(_0x0b13('0x11'));var authService=require(_0x0b13('0x12'));var qs=require(_0x0b13('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b13('0x14'))(_0x0b13('0x15'));var utils=require(_0x0b13('0x16'));var config=require(_0x0b13('0x17'));var licenseUtil=require(_0x0b13('0x18'));var db=require(_0x0b13('0x19'))['db'];function respondWithStatusCode(_0x4e3f78,_0x5223df){_0x5223df=_0x5223df||0xcc;return function(_0x287873){if(_0x287873){return _0x4e3f78[_0x0b13('0x1a')](_0x5223df);}return _0x4e3f78[_0x0b13('0x1b')](_0x5223df)['end']();};}function respondWithResult(_0x12615d,_0x198180){_0x198180=_0x198180||0xc8;return function(_0x4375a5){if(_0x4375a5){return _0x12615d[_0x0b13('0x1b')](_0x198180)['json'](_0x4375a5);}};}function respondWithFilteredResult(_0x1fb7d9,_0x5d1af7){return function(_0x498f62){if(_0x498f62){var _0x378c01=typeof _0x5d1af7[_0x0b13('0x1c')]===_0x0b13('0x1d')&&typeof _0x5d1af7[_0x0b13('0x1e')]===_0x0b13('0x1d');var _0x26189b=_0x498f62[_0x0b13('0x1f')];var _0x35c34f=_0x378c01?0x0:_0x5d1af7['offset'];var _0x3e2340=_0x378c01?_0x498f62['count']:_0x5d1af7[_0x0b13('0x1c')]+_0x5d1af7['limit'];var _0x33b2bf;if(_0x3e2340>=_0x26189b){_0x3e2340=_0x26189b;_0x33b2bf=0xc8;}else{_0x33b2bf=0xce;}_0x1fb7d9['status'](_0x33b2bf);return _0x1fb7d9[_0x0b13('0x20')](_0x0b13('0x21'),_0x35c34f+'-'+_0x3e2340+'/'+_0x26189b)['json'](_0x498f62);}return null;};}function patchUpdates(_0x17b925){return function(_0x5980fe){try{jsonpatch[_0x0b13('0x22')](_0x5980fe,_0x17b925,!![]);}catch(_0x45cb53){return BPromise['reject'](_0x45cb53);}return _0x5980fe['save']();};}function saveUpdates(_0x451710,_0x57e0ce){return function(_0x58548f){if(_0x58548f){return _0x58548f[_0x0b13('0x23')](_0x451710)[_0x0b13('0x24')](function(_0x34cd1d){return _0x34cd1d;});}return null;};}function removeEntity(_0x3bdc9e,_0x503ddf){return function(_0x34fd7d){if(_0x34fd7d){return _0x34fd7d['destroy']()[_0x0b13('0x24')](function(){var _0xbbd4ea=_0x34fd7d['get']({'plain':!![]});var _0x3c2aee=_0x0b13('0x25');return db['UserProfileResource'][_0x0b13('0x26')]({'where':{'type':_0x3c2aee,'resourceId':_0xbbd4ea['id']}})[_0x0b13('0x24')](function(){return _0x34fd7d;});})['then'](function(){_0x3bdc9e[_0x0b13('0x1b')](0xcc)[_0x0b13('0x27')]();});}};}function handleEntityNotFound(_0x47f431,_0x2eac26){return function(_0x2f8a44){if(!_0x2f8a44){_0x47f431[_0x0b13('0x1a')](0x194);}return _0x2f8a44;};}function handleError(_0x537050,_0x2beaac){_0x2beaac=_0x2beaac||0x1f4;return function(_0x4b2f0e){logger[_0x0b13('0x28')](_0x4b2f0e[_0x0b13('0x29')]);if(_0x4b2f0e[_0x0b13('0x2a')]){delete _0x4b2f0e['name'];}_0x537050[_0x0b13('0x1b')](_0x2beaac)[_0x0b13('0x2b')](_0x4b2f0e);};}exports[_0x0b13('0x2c')]=function(_0xf6f282,_0x21de99){var _0x1451d9={},_0xed3a8e={},_0x225f0d={'count':0x0,'rows':[]};var _0x14b238=_[_0x0b13('0x2d')](db[_0x0b13('0x2e')]['rawAttributes'],function(_0x3770b2){return{'name':_0x3770b2[_0x0b13('0x2f')],'type':_0x3770b2['type'][_0x0b13('0x30')]};});_0xed3a8e[_0x0b13('0x31')]=_['map'](_0x14b238,_0x0b13('0x2a'));_0xed3a8e[_0x0b13('0x32')]=_[_0x0b13('0x33')](_0xf6f282[_0x0b13('0x32')]);_0xed3a8e['filters']=_['intersection'](_0xed3a8e[_0x0b13('0x31')],_0xed3a8e[_0x0b13('0x32')]);_0x1451d9['attributes']=_[_0x0b13('0x34')](_0xed3a8e[_0x0b13('0x31')],qs['fields'](_0xf6f282[_0x0b13('0x32')][_0x0b13('0x35')]));_0x1451d9[_0x0b13('0x36')]=_0x1451d9[_0x0b13('0x36')][_0x0b13('0x37')]?_0x1451d9[_0x0b13('0x36')]:_0xed3a8e[_0x0b13('0x31')];if(!_0xf6f282[_0x0b13('0x32')]['hasOwnProperty'](_0x0b13('0x38'))){_0x1451d9[_0x0b13('0x1e')]=qs['limit'](_0xf6f282['query'][_0x0b13('0x1e')]);_0x1451d9[_0x0b13('0x1c')]=qs['offset'](_0xf6f282[_0x0b13('0x32')][_0x0b13('0x1c')]);}_0x1451d9[_0x0b13('0x39')]=qs[_0x0b13('0x3a')](_0xf6f282[_0x0b13('0x32')][_0x0b13('0x3a')]);_0x1451d9[_0x0b13('0x3b')]=qs[_0x0b13('0x3c')](_[_0x0b13('0x3d')](_0xf6f282[_0x0b13('0x32')],_0xed3a8e[_0x0b13('0x3c')]),_0x14b238);if(_0xf6f282['query'][_0x0b13('0x3e')]){_0x1451d9['where']=_[_0x0b13('0x3f')](_0x1451d9[_0x0b13('0x3b')],{'$or':_[_0x0b13('0x2d')](_0x14b238,function(_0x50fd41){if(_0x50fd41[_0x0b13('0x40')]!==_0x0b13('0x41')){var _0x2f7952={};_0x2f7952[_0x50fd41[_0x0b13('0x2a')]]={'$like':'%'+_0xf6f282['query']['filter']+'%'};return _0x2f7952;}})});}_0x1451d9=_[_0x0b13('0x3f')]({},_0x1451d9,_0xf6f282[_0x0b13('0x42')]);var _0x44fa10={'where':_0x1451d9[_0x0b13('0x3b')]};return db[_0x0b13('0x2e')][_0x0b13('0x1f')](_0x44fa10)[_0x0b13('0x24')](function(_0x4eb8fd){_0x225f0d[_0x0b13('0x1f')]=_0x4eb8fd;if(_0xf6f282[_0x0b13('0x32')]['includeAll']){_0x1451d9['include']=[{'all':!![]}];}return db['Variable'][_0x0b13('0x43')](_0x1451d9);})[_0x0b13('0x24')](function(_0x5e2645){_0x225f0d[_0x0b13('0x44')]=_0x5e2645;return _0x225f0d;})[_0x0b13('0x24')](respondWithFilteredResult(_0x21de99,_0x1451d9))[_0x0b13('0x45')](handleError(_0x21de99,null));};exports[_0x0b13('0x46')]=function(_0x119330,_0xf45ab0){var _0x3c1ce3={'raw':!![],'where':{'id':_0x119330['params']['id']}},_0xa482cd={};_0xa482cd[_0x0b13('0x31')]=_[_0x0b13('0x33')](db[_0x0b13('0x2e')][_0x0b13('0x47')]);_0xa482cd[_0x0b13('0x32')]=_['keys'](_0x119330[_0x0b13('0x32')]);_0xa482cd[_0x0b13('0x3c')]=_[_0x0b13('0x34')](_0xa482cd[_0x0b13('0x31')],_0xa482cd['query']);_0x3c1ce3[_0x0b13('0x36')]=_[_0x0b13('0x34')](_0xa482cd[_0x0b13('0x31')],qs['fields'](_0x119330[_0x0b13('0x32')][_0x0b13('0x35')]));_0x3c1ce3[_0x0b13('0x36')]=_0x3c1ce3[_0x0b13('0x36')]['length']?_0x3c1ce3[_0x0b13('0x36')]:_0xa482cd[_0x0b13('0x31')];if(_0x119330[_0x0b13('0x32')][_0x0b13('0x48')]){_0x3c1ce3['include']=[{'all':!![]}];}_0x3c1ce3=_['merge']({},_0x3c1ce3,_0x119330[_0x0b13('0x42')]);return db[_0x0b13('0x2e')][_0x0b13('0x49')](_0x3c1ce3)['then'](handleEntityNotFound(_0xf45ab0,null))[_0x0b13('0x24')](respondWithResult(_0xf45ab0,null))[_0x0b13('0x45')](handleError(_0xf45ab0,null));};exports[_0x0b13('0x4a')]=function(_0x3cf3b8,_0x36e99f){return db['Variable'][_0x0b13('0x4a')](_0x3cf3b8['body'],{})[_0x0b13('0x24')](function(_0x3c6a3f){var _0xe9a010=_0x3cf3b8['user'][_0x0b13('0x4b')]({'plain':!![]});if(!_0xe9a010)throw new Error(_0x0b13('0x4c'));if(_0xe9a010[_0x0b13('0x4d')]===_0x0b13('0x4e')){var _0x5341e8=_0x3c6a3f[_0x0b13('0x4b')]({'plain':!![]});var _0x2c10a5=_0x0b13('0x25');return db[_0x0b13('0x4f')][_0x0b13('0x49')]({'where':{'name':_0x2c10a5,'userProfileId':_0xe9a010[_0x0b13('0x50')]},'raw':!![]})[_0x0b13('0x24')](function(_0x5ac080){if(_0x5ac080&&_0x5ac080[_0x0b13('0x51')]===0x0){return db[_0x0b13('0x52')][_0x0b13('0x4a')]({'name':_0x5341e8['name'],'resourceId':_0x5341e8['id'],'type':_0x5ac080[_0x0b13('0x2a')],'sectionId':_0x5ac080['id']},{})[_0x0b13('0x24')](function(){return _0x3c6a3f;});}else{return _0x3c6a3f;}})[_0x0b13('0x45')](function(_0x5e9706){logger['error'](_0x0b13('0x53'),_0x5e9706);throw _0x5e9706;});}return _0x3c6a3f;})[_0x0b13('0x24')](respondWithResult(_0x36e99f,0xc9))[_0x0b13('0x45')](handleError(_0x36e99f,null));};exports[_0x0b13('0x23')]=function(_0x251db3,_0x6f5459){if(_0x251db3[_0x0b13('0x54')]['id']){delete _0x251db3[_0x0b13('0x54')]['id'];}return db[_0x0b13('0x2e')][_0x0b13('0x49')]({'where':{'id':_0x251db3[_0x0b13('0x55')]['id']}})[_0x0b13('0x24')](handleEntityNotFound(_0x6f5459,null))[_0x0b13('0x24')](saveUpdates(_0x251db3[_0x0b13('0x54')],null))[_0x0b13('0x24')](respondWithResult(_0x6f5459,null))[_0x0b13('0x45')](handleError(_0x6f5459,null));};exports[_0x0b13('0x26')]=function(_0x4daa09,_0x4502e8){return db[_0x0b13('0x2e')][_0x0b13('0x49')]({'where':{'id':_0x4daa09[_0x0b13('0x55')]['id']}})[_0x0b13('0x24')](handleEntityNotFound(_0x4502e8,null))[_0x0b13('0x24')](removeEntity(_0x4502e8,null))[_0x0b13('0x45')](handleError(_0x4502e8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d4a1407..3a6e727 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 _0xa4a3=['lodash','util','bluebird','request-promise','../../config/environment'];(function(_0x2e307f,_0x4a3d95){var _0x15a267=function(_0x431c64){while(--_0x431c64){_0x2e307f['push'](_0x2e307f['shift']());}};_0x15a267(++_0x4a3d95);}(_0xa4a3,0xf5));var _0x3a4a=function(_0x4427a0,_0x39edb4){_0x4427a0=_0x4427a0-0x0;var _0x2a9ccf=_0xa4a3[_0x4427a0];return _0x2a9ccf;};'use strict';var _=require(_0x3a4a('0x0'));var util=require(_0x3a4a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3a4a('0x2'));var rp=require(_0x3a4a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a4a('0x4'));var attributes=require('./variable.attributes');module['exports']=function(_0x4f3f9e,_0x4e9313){return _0x4f3f9e['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3562=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./variable.attributes'];(function(_0x49266a,_0x3ccec1){var _0x3cc155=function(_0xb4da3f){while(--_0xb4da3f){_0x49266a['push'](_0x49266a['shift']());}};_0x3cc155(++_0x3ccec1);}(_0x3562,0x88));var _0x2356=function(_0x3cff6c,_0x107a6c){_0x3cff6c=_0x3cff6c-0x0;var _0x442fb7=_0x3562[_0x3cff6c];return _0x442fb7;};'use strict';var _=require(_0x2356('0x0'));var util=require(_0x2356('0x1'));var logger=require(_0x2356('0x2'))('api');var moment=require(_0x2356('0x3'));var BPromise=require(_0x2356('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2356('0x5'));var rimraf=require('rimraf');var config=require(_0x2356('0x6'));var attributes=require(_0x2356('0x7'));module[_0x2356('0x8')]=function(_0x2fde68,_0x22b253){return _0x2fde68[_0x2356('0x9')](_0x2356('0xa'),attributes,{'tableName':_0x2356('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 6919e14..38f78e1 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 _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(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xa41a,0x6b));var _0xaa41=function(_0x5b58df,_0x1dcb97){_0x5b58df=_0x5b58df-0x0;var _0x6015ee=_0xa41a[_0x5b58df];return _0x6015ee;};'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 +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x4b5f91,_0x26c295){var _0x3c3a04=function(_0x25dbb6){while(--_0x25dbb6){_0x4b5f91['push'](_0x4b5f91['shift']());}};_0x3c3a04(++_0x26c295);}(_0xe14b,0x93));var _0xbe14=function(_0xffd105,_0x2d565a){_0xffd105=_0xffd105-0x0;var _0x34a9a7=_0xe14b[_0xffd105];return _0x34a9a7;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 2fbf7a1..25e801d 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 _0xd05e=['migrations','exports','express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','/migrations'];(function(_0x4a045c,_0xc59fba){var _0x23fb5b=function(_0x89b1e7){while(--_0x89b1e7){_0x4a045c['push'](_0x4a045c['shift']());}};_0x23fb5b(++_0xc59fba);}(_0xd05e,0xa2));var _0xed05=function(_0x145e54,_0x2571b5){_0x145e54=_0x145e54-0x0;var _0x3c4c42=_0xd05e[_0x145e54];return _0x3c4c42;};'use strict';var express=require(_0xed05('0x0'));var router=express[_0xed05('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xed05('0x2'));router[_0xed05('0x3')]('/',controller[_0xed05('0x4')]);router['get'](_0xed05('0x5'),auth[_0xed05('0x6')](),auth[_0xed05('0x7')](),controller['fetch']);router['get'](_0xed05('0x8'),auth[_0xed05('0x6')](),auth[_0xed05('0x7')](),controller[_0xed05('0x9')]);router[_0xed05('0x3')](_0xed05('0xa'),auth[_0xed05('0x6')](),auth[_0xed05('0x7')](),controller[_0xed05('0xb')]);router[_0xed05('0x3')](_0xed05('0xc'),auth[_0xed05('0x6')](),controller['restart']);router['get'](_0xed05('0xd'),controller[_0xed05('0xe')]);module[_0xed05('0xf')]=router; \ No newline at end of file +var _0x18e8=['restart','/migrations','migrations','express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','/pull','pull'];(function(_0x44ef27,_0xee6206){var _0x3a954c=function(_0x49dd9c){while(--_0x49dd9c){_0x44ef27['push'](_0x44ef27['shift']());}};_0x3a954c(++_0xee6206);}(_0x18e8,0x145));var _0x818e=function(_0x5681b8,_0x4caf5d){_0x5681b8=_0x5681b8-0x0;var _0x2205db=_0x18e8[_0x5681b8];return _0x2205db;};'use strict';var express=require(_0x818e('0x0'));var router=express[_0x818e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x818e('0x2'));router[_0x818e('0x3')]('/',controller[_0x818e('0x4')]);router[_0x818e('0x3')](_0x818e('0x5'),auth[_0x818e('0x6')](),auth[_0x818e('0x7')](),controller['fetch']);router[_0x818e('0x3')](_0x818e('0x8'),auth[_0x818e('0x6')](),auth[_0x818e('0x7')](),controller['reset']);router[_0x818e('0x3')](_0x818e('0x9'),auth[_0x818e('0x6')](),auth[_0x818e('0x7')](),controller[_0x818e('0xa')]);router[_0x818e('0x3')]('/restart',auth[_0x818e('0x6')](),controller[_0x818e('0xb')]);router[_0x818e('0x3')](_0x818e('0xc'),controller[_0x818e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 442d32a..a8c6fe8 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 _0x7d2c=['FETCH_HEAD','error','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','.js','push','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','version','query','fetch','tags','latest','2.0.0','status','origin','master','json','info','git\x20fetch','reset','--hard'];(function(_0x405c97,_0x3a9aeb){var _0x4bba8f=function(_0x354926){while(--_0x354926){_0x405c97['push'](_0x405c97['shift']());}};_0x4bba8f(++_0x3a9aeb);}(_0x7d2c,0x82));var _0xc7d2=function(_0x1e2a97,_0x156023){_0x1e2a97=_0x1e2a97-0x0;var _0xd6dcf0=_0x7d2c[_0x1e2a97];return _0xd6dcf0;};'use strict';var Umzug=require(_0xc7d2('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc7d2('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xc7d2('0x2'))[_0xc7d2('0x3')];var db=require(_0xc7d2('0x4'))['db'];var config=require(_0xc7d2('0x5'));var pm2=require(_0xc7d2('0x6'));var logger=require(_0xc7d2('0x7'))(_0xc7d2('0x8'));var git=require(_0xc7d2('0x9'))(config[_0xc7d2('0xa')]);exports['index']=function(_0x318690,_0x5609f0){var _0x1d4f45={'current':module[_0xc7d2('0xb')][_0xc7d2('0xc')],'phonebar':0x2};if(_0x318690[_0xc7d2('0xd')]&&_0x318690['query']['latest']){return git[_0xc7d2('0xe')]()[_0xc7d2('0xf')](function(_0xc49532,_0x372972){_0x1d4f45['latest']=(_0xc49532?module[_0xc7d2('0xb')][_0xc7d2('0xc')]:_0x372972[_0xc7d2('0x10')])||_0xc7d2('0x11');return _0x5609f0[_0xc7d2('0x12')](0xc8)['json'](_0x1d4f45);});}else{return _0x5609f0[_0xc7d2('0x12')](0xc8)['json'](_0x1d4f45);}};exports[_0xc7d2('0xe')]=function(_0xf5a90a,_0x1b4bd5){return git[_0xc7d2('0xe')]([_0xc7d2('0x13'),_0xc7d2('0x14')],function(_0x46ccb6){if(_0x46ccb6){logger['error'](_0x46ccb6);return _0x1b4bd5[_0xc7d2('0x12')](0x1f4)[_0xc7d2('0x15')](_0x46ccb6);}logger[_0xc7d2('0x16')](_0xc7d2('0x17'));return _0x1b4bd5[_0xc7d2('0x12')](0xc8)[_0xc7d2('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x3135ee,_0x1fa2b0){return git[_0xc7d2('0x18')]([_0xc7d2('0x19'),_0xc7d2('0x1a')],function(_0x18582a){if(_0x18582a){logger[_0xc7d2('0x1b')](_0x18582a);return _0x1fa2b0[_0xc7d2('0x12')](0x1f4)[_0xc7d2('0x15')](_0x18582a);}logger[_0xc7d2('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1fa2b0['status'](0xc8)[_0xc7d2('0x15')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x280ec4,_0x67dea3){exec('npm\x20install\x20--production',function(_0x5889eb,_0x5975f4,_0x133e1a){logger[_0xc7d2('0x16')](_0x5975f4);logger[_0xc7d2('0x16')](_0x133e1a);if(_0x5889eb){logger[_0xc7d2('0x1b')](_0x5889eb);return _0x67dea3[_0xc7d2('0x12')](0x1f4)[_0xc7d2('0x15')](_0x5889eb);}return _0x67dea3[_0xc7d2('0x12')](0xc8)[_0xc7d2('0x15')]({'output':_0x5975f4});});};exports[_0xc7d2('0x1c')]=function(_0xf26c0,_0x213898){return pm2[_0xc7d2('0x1c')](_0xc7d2('0x1d'))[_0xc7d2('0x1e')](function(_0x828596){logger['info'](_0xc7d2('0x1f'),_0x828596);return _0x213898['status'](0xc8)[_0xc7d2('0x15')]({'output':_0xc7d2('0x20')});})[_0xc7d2('0x21')](function(_0x378efe){logger[_0xc7d2('0x1b')](_0x378efe);return _0x213898[_0xc7d2('0x12')](0x1f4)[_0xc7d2('0x15')](_0x378efe);});};exports['migrations']=function(_0xb4cfa2,_0x42a540){var _0x26c729=fs[_0xc7d2('0x22')](path[_0xc7d2('0x23')](config[_0xc7d2('0xa')],_0xc7d2('0x24'),_0xc7d2('0x25')));var _0x41a60b=[];for(var _0x5f3ebc=0x0;_0x5f3ebc<_0x26c729['length'];_0x5f3ebc++){var _0x3e68a6=_0x26c729[_0x5f3ebc]['replace'](_0xc7d2('0x26'),'');if(compareVersions(module['exports'][_0xc7d2('0xc')],_0x3e68a6)===-0x1){_0x41a60b[_0xc7d2('0x27')](_0x3e68a6);}}if(_0x41a60b[_0xc7d2('0x28')]){var _0x300606=_0x41a60b[_0xc7d2('0x29')](compareVersions);var _0x58e723=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xc7d2('0x2a')],'modelName':_0xc7d2('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0xc7d2('0x2b')][_0xc7d2('0x2c')](),db[_0xc7d2('0x2b')][_0xc7d2('0x2d')],function(){throw new Error(_0xc7d2('0x2e'));}],'path':path['join'](config[_0xc7d2('0xa')],'server',_0xc7d2('0x25')),'pattern':/\.js$/}});_0x58e723['up']({'migrations':_['map'](_0x300606,function(_0x211ed7){return _0x211ed7+_0xc7d2('0x26');})})[_0xc7d2('0x1e')](function(){return _0x42a540[_0xc7d2('0x12')](0xc8)[_0xc7d2('0x15')]({'output':_0xc7d2('0x2f')+module[_0xc7d2('0xb')][_0xc7d2('0xc')]+_0xc7d2('0x30')+_[_0xc7d2('0x31')](_0x300606),'migrations':_[_0xc7d2('0x23')](_0x300606)});})['catch'](function(_0x259645){if(_0x259645 instanceof db[_0xc7d2('0x2b')][_0xc7d2('0x32')]){return _0x42a540[_0xc7d2('0x12')](0xc8)['json']({'output':_0xc7d2('0x33')});}else{return _0x42a540['status'](0x1f4)[_0xc7d2('0x15')](_0x259645);}});}else{return _0x42a540[_0xc7d2('0x12')](0xc8)[_0xc7d2('0x15')]({'output':_0xc7d2('0x33')});}}; \ No newline at end of file +var _0xdd4f=['master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','root','server','migrations','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','last','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','index','exports','query','tags','latest','2.0.0','status','json','fetch','origin'];(function(_0x19b8a1,_0x349bbb){var _0x2b9fe3=function(_0x3affdb){while(--_0x3affdb){_0x19b8a1['push'](_0x19b8a1['shift']());}};_0x2b9fe3(++_0x349bbb);}(_0xdd4f,0xc9));var _0xfdd4=function(_0x5f3b8a,_0x2f1fdb){_0x5f3b8a=_0x5f3b8a-0x0;var _0xc81a91=_0xdd4f[_0x5f3b8a];return _0xc81a91;};'use strict';var Umzug=require(_0xfdd4('0x0'));var path=require(_0xfdd4('0x1'));var fs=require('fs');var _=require(_0xfdd4('0x2'));var pkginfo=require(_0xfdd4('0x3'))(module,_0xfdd4('0x4'));var compareVersions=require(_0xfdd4('0x5'));var exec=require(_0xfdd4('0x6'))[_0xfdd4('0x7')];var db=require(_0xfdd4('0x8'))['db'];var config=require(_0xfdd4('0x9'));var pm2=require(_0xfdd4('0xa'));var logger=require(_0xfdd4('0xb'))(_0xfdd4('0xc'));var git=require('simple-git')(config['root']);exports[_0xfdd4('0xd')]=function(_0x48f969,_0x17d9e6){var _0x435dfb={'current':module[_0xfdd4('0xe')]['version'],'phonebar':0x2};if(_0x48f969[_0xfdd4('0xf')]&&_0x48f969[_0xfdd4('0xf')]['latest']){return git['fetch']()[_0xfdd4('0x10')](function(_0x197792,_0x242333){_0x435dfb[_0xfdd4('0x11')]=(_0x197792?module['exports']['version']:_0x242333[_0xfdd4('0x11')])||_0xfdd4('0x12');return _0x17d9e6[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')](_0x435dfb);});}else{return _0x17d9e6[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')](_0x435dfb);}};exports[_0xfdd4('0x15')]=function(_0x58d858,_0x36139a){return git['fetch']([_0xfdd4('0x16'),_0xfdd4('0x17')],function(_0xe204a6){if(_0xe204a6){logger[_0xfdd4('0x18')](_0xe204a6);return _0x36139a[_0xfdd4('0x13')](0x1f4)[_0xfdd4('0x14')](_0xe204a6);}logger[_0xfdd4('0x19')](_0xfdd4('0x1a'));return _0x36139a[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')]({'output':_0xfdd4('0x1b')});});};exports[_0xfdd4('0x1c')]=function(_0x32ee42,_0x37916a){return git[_0xfdd4('0x1c')](['--hard',_0xfdd4('0x1d')],function(_0x5cd12a){if(_0x5cd12a){logger['error'](_0x5cd12a);return _0x37916a[_0xfdd4('0x13')](0x1f4)[_0xfdd4('0x14')](_0x5cd12a);}logger[_0xfdd4('0x19')](_0xfdd4('0x1e'));return _0x37916a[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')]({'output':_0xfdd4('0x1f')});});};exports[_0xfdd4('0x20')]=function(_0x5e18d7,_0x308825){exec(_0xfdd4('0x21'),function(_0x424b62,_0x3a198b,_0x265f08){logger[_0xfdd4('0x19')](_0x3a198b);logger[_0xfdd4('0x19')](_0x265f08);if(_0x424b62){logger[_0xfdd4('0x18')](_0x424b62);return _0x308825['status'](0x1f4)[_0xfdd4('0x14')](_0x424b62);}return _0x308825[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')]({'output':_0x3a198b});});};exports[_0xfdd4('0x22')]=function(_0x4884fd,_0x43afef){return pm2[_0xfdd4('0x22')](_0xfdd4('0x23'))[_0xfdd4('0x24')](function(_0x4fc10e){logger['info'](_0xfdd4('0x25'),_0x4fc10e);return _0x43afef[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')]({'output':_0xfdd4('0x26')});})[_0xfdd4('0x27')](function(_0xb60878){logger[_0xfdd4('0x18')](_0xb60878);return _0x43afef['status'](0x1f4)[_0xfdd4('0x14')](_0xb60878);});};exports['migrations']=function(_0x4f6518,_0x257d21){var _0x528f4a=fs[_0xfdd4('0x28')](path[_0xfdd4('0x29')](config[_0xfdd4('0x2a')],_0xfdd4('0x2b'),_0xfdd4('0x2c')));var _0x37af47=[];for(var _0x17a461=0x0;_0x17a461<_0x528f4a[_0xfdd4('0x2d')];_0x17a461++){var _0x206510=_0x528f4a[_0x17a461][_0xfdd4('0x2e')](_0xfdd4('0x2f'),'');if(compareVersions(module['exports']['version'],_0x206510)===-0x1){_0x37af47[_0xfdd4('0x30')](_0x206510);}}if(_0x37af47[_0xfdd4('0x2d')]){var _0x1f926c=_0x37af47[_0xfdd4('0x31')](compareVersions);var _0x114fd6=new Umzug({'storage':_0xfdd4('0x32'),'storageOptions':{'model':db[_0xfdd4('0x33')],'modelName':_0xfdd4('0x33'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xfdd4('0x34')](),db[_0xfdd4('0x32')][_0xfdd4('0x35')],function(){throw new Error(_0xfdd4('0x36'));}],'path':path[_0xfdd4('0x29')](config['root'],_0xfdd4('0x2b'),_0xfdd4('0x2c')),'pattern':/\.js$/}});_0x114fd6['up']({'migrations':_['map'](_0x1f926c,function(_0x1dee02){return _0x1dee02+_0xfdd4('0x2f');})})['then'](function(){return _0x257d21[_0xfdd4('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xfdd4('0x4')]+'\x20to\x20'+_[_0xfdd4('0x37')](_0x1f926c),'migrations':_[_0xfdd4('0x29')](_0x1f926c)});})[_0xfdd4('0x27')](function(_0x1086f3){if(_0x1086f3 instanceof db['sequelize']['UniqueConstraintError']){return _0x257d21[_0xfdd4('0x13')](0xc8)[_0xfdd4('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x257d21['status'](0x1f4)[_0xfdd4('0x14')](_0x1086f3);}});}else{return _0x257d21['status'](0xc8)[_0xfdd4('0x14')]({'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 70fa860..3c5d364 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 _0xe218=['show','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe218,0xef));var _0x8e21=function(_0x4552ea,_0x5c6323){_0x4552ea=_0x4552ea-0x0;var _0x45499a=_0xe218[_0x4552ea];return _0x45499a;};'use strict';var multer=require(_0x8e21('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e21('0x1'));var express=require(_0x8e21('0x2'));var router=express[_0x8e21('0x3')]();var fs_extra=require(_0x8e21('0x4'));var auth=require(_0x8e21('0x5'));var interaction=require(_0x8e21('0x6'));var config=require('../../config/environment');var controller=require(_0x8e21('0x7'));router[_0x8e21('0x8')]('/',auth[_0x8e21('0x9')](),controller[_0x8e21('0xa')]);router[_0x8e21('0x8')](_0x8e21('0xb'),auth[_0x8e21('0x9')](),controller[_0x8e21('0xc')]);router[_0x8e21('0x8')]('/:id',auth[_0x8e21('0x9')](),controller[_0x8e21('0xd')]);router[_0x8e21('0xe')]('/',auth[_0x8e21('0x9')](),controller['create']);router[_0x8e21('0xf')](_0x8e21('0x10'),auth[_0x8e21('0x9')](),controller[_0x8e21('0x11')]);router[_0x8e21('0x12')]('/:id',auth[_0x8e21('0x9')](),controller[_0x8e21('0x13')]);module[_0x8e21('0x14')]=router; \ No newline at end of file +var _0x3a50=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a50,0x138));var _0x03a5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3a50[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x03a5('0x0'));var util=require(_0x03a5('0x1'));var path=require(_0x03a5('0x2'));var timeout=require(_0x03a5('0x3'));var express=require(_0x03a5('0x4'));var router=express[_0x03a5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x03a5('0x6'));var interaction=require(_0x03a5('0x7'));var config=require(_0x03a5('0x8'));var controller=require(_0x03a5('0x9'));router[_0x03a5('0xa')]('/',auth['isAuthenticated'](),controller[_0x03a5('0xb')]);router[_0x03a5('0xa')](_0x03a5('0xc'),auth[_0x03a5('0xd')](),controller[_0x03a5('0xe')]);router[_0x03a5('0xa')](_0x03a5('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x03a5('0x10')]);router[_0x03a5('0x11')]('/:id',auth[_0x03a5('0xd')](),controller[_0x03a5('0x12')]);router[_0x03a5('0x13')](_0x03a5('0xf'),auth[_0x03a5('0xd')](),controller['destroy']);module[_0x03a5('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 4f361fb..11e57cd 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 _0x753c=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0x753c,0x96));var _0xc753=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x753c[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xc753('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc753('0x1')]},'calleridnum':{'type':Sequelize[_0xc753('0x1')]},'calleridname':{'type':Sequelize[_0xc753('0x1')]},'queue':{'type':Sequelize[_0xc753('0x1')]},'interface':{'type':Sequelize[_0xc753('0x1')]},'membername':{'type':Sequelize[_0xc753('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc753('0x2')]},'agentconnectAt':{'type':Sequelize[_0xc753('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xc753('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xc753('0x2')]},'agentdumpAt':{'type':Sequelize[_0xc753('0x2')]},'holdtime':{'type':Sequelize[_0xc753('0x3')]},'agentcomplete':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc753('0x3')]},'agentacw':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc753('0x3')]},'reason':{'type':Sequelize[_0xc753('0x1')]},'lastevent':{'type':Sequelize[_0xc753('0x1')]},'channel':{'type':Sequelize[_0xc753('0x1')]},'channelstate':{'type':Sequelize[_0xc753('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc753('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc753('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc753('0x1')]},'accountcode':{'type':Sequelize[_0xc753('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc753('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc753('0x1')]},'destchannelstate':{'type':Sequelize[_0xc753('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc753('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc753('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc753('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc753('0x1')]},'destcontext':{'type':Sequelize[_0xc753('0x1')]},'destexten':{'type':Sequelize[_0xc753('0x1')]},'destpriority':{'type':Sequelize[_0xc753('0x1')]},'destuniqueid':{'type':Sequelize[_0xc753('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc753('0x1')]},'transfer':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc753('0x1')],'comment':_0xc753('0x5')},'transferexten':{'type':Sequelize[_0xc753('0x1')]},'transferuniqueid':{'type':Sequelize[_0xc753('0x1')]},'agententerreason':{'type':Sequelize[_0xc753('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x69d4=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x69d4,0x83));var _0x469d=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x69d4[_0x310a1b];return _0xdea206;};'use strict';var Sequelize=require(_0x469d('0x0'));module[_0x469d('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x469d('0x2')]},'calleridnum':{'type':Sequelize[_0x469d('0x2')]},'calleridname':{'type':Sequelize[_0x469d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x469d('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x469d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x469d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x469d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x469d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x469d('0x3')]},'holdtime':{'type':Sequelize[_0x469d('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x469d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x469d('0x4')]},'agentacw':{'type':Sequelize[_0x469d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x469d('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x469d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x469d('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x469d('0x2')]},'language':{'type':Sequelize[_0x469d('0x2')]},'accountcode':{'type':Sequelize[_0x469d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x469d('0x2')]},'destchannelstate':{'type':Sequelize[_0x469d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x469d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x469d('0x2')]},'destcalleridname':{'type':Sequelize[_0x469d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x469d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x469d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x469d('0x2')]},'destcontext':{'type':Sequelize[_0x469d('0x2')]},'destexten':{'type':Sequelize[_0x469d('0x2')]},'destpriority':{'type':Sequelize[_0x469d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x469d('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x469d('0x2')]},'transfer':{'type':Sequelize[_0x469d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x469d('0x6')},'transferexten':{'type':Sequelize[_0x469d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x469d('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 5ed9602..832d60f 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(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 113fda8..c1ea6c4 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 _0x097c=['bluebird','request-promise','path','../../config/environment','exports','define','report_agent','lodash','util','../../config/logger','moment'];(function(_0x74fb6b,_0x4a5e61){var _0x2520da=function(_0x5c63f7){while(--_0x5c63f7){_0x74fb6b['push'](_0x74fb6b['shift']());}};_0x2520da(++_0x4a5e61);}(_0x097c,0x1d5));var _0xc097=function(_0x1b92e9,_0x53f2e1){_0x1b92e9=_0x1b92e9-0x0;var _0x3eb03d=_0x097c[_0x1b92e9];return _0x3eb03d;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var logger=require(_0xc097('0x2'))('api');var moment=require(_0xc097('0x3'));var BPromise=require(_0xc097('0x4'));var rp=require(_0xc097('0x5'));var fs=require('fs');var path=require(_0xc097('0x6'));var rimraf=require('rimraf');var config=require(_0xc097('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0xc097('0x8')]=function(_0x3c9603,_0x31bc9a){return _0x3c9603[_0xc097('0x9')]('VoiceAgentReport',attributes,{'tableName':_0xc097('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x39c7=['destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','define','uniqueid'];(function(_0x50ce6a,_0xcedfc){var _0x2d4d3e=function(_0x4492cf){while(--_0x4492cf){_0x50ce6a['push'](_0x50ce6a['shift']());}};_0x2d4d3e(++_0xcedfc);}(_0x39c7,0x85));var _0x739c=function(_0x56ccb9,_0x1873b1){_0x56ccb9=_0x56ccb9-0x0;var _0x476c22=_0x39c7[_0x56ccb9];return _0x476c22;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var logger=require(_0x739c('0x1'))(_0x739c('0x2'));var moment=require(_0x739c('0x3'));var BPromise=require(_0x739c('0x4'));var rp=require(_0x739c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x739c('0x6'));var config=require(_0x739c('0x7'));var attributes=require(_0x739c('0x8'));module['exports']=function(_0x4c5030,_0x1923d9){return _0x4c5030[_0x739c('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x739c('0xa'),_0x739c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1515fe0..0994b2c 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 _0x9f0d=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','UpdateVoiceAgentReport','options','raw','where','limit','then'];(function(_0x35e84b,_0x454479){var _0x4fb29e=function(_0x551707){while(--_0x551707){_0x35e84b['push'](_0x35e84b['shift']());}};_0x4fb29e(++_0x454479);}(_0x9f0d,0x186));var _0xd9f0=function(_0x2557ad,_0x825cdb){_0x2557ad=_0x2557ad-0x0;var _0x45b8c6=_0x9f0d[_0x2557ad];return _0x45b8c6;};'use strict';var _=require(_0xd9f0('0x0'));var util=require(_0xd9f0('0x1'));var moment=require(_0xd9f0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9f0('0x3'))['db'];var utils=require(_0xd9f0('0x4'));var logger=require(_0xd9f0('0x5'))(_0xd9f0('0x6'));var config=require(_0xd9f0('0x7'));var jayson=require(_0xd9f0('0x8'));var client=jayson['client'][_0xd9f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d3bb1,_0x4ed1a9,_0x5e54ee){return new BPromise(function(_0x35123c,_0x24ea7d){return client[_0xd9f0('0xa')](_0x2d3bb1,_0x5e54ee)['then'](function(_0x34fc9c){logger[_0xd9f0('0xb')](_0xd9f0('0xc'),_0x4ed1a9,_0xd9f0('0xd'));logger[_0xd9f0('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4ed1a9,'request\x20sent',JSON[_0xd9f0('0xf')](_0x34fc9c));if(_0x34fc9c['error']){if(_0x34fc9c['error'][_0xd9f0('0x10')]===0x1f4){logger[_0xd9f0('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ed1a9,_0x34fc9c['error'][_0xd9f0('0x12')]);return _0x24ea7d(_0x34fc9c[_0xd9f0('0x11')]['message']);}logger['error'](_0xd9f0('0xc'),_0x4ed1a9,_0x34fc9c[_0xd9f0('0x11')][_0xd9f0('0x12')]);return _0x35123c(_0x34fc9c[_0xd9f0('0x11')]['message']);}else{logger[_0xd9f0('0xb')](_0xd9f0('0xc'),_0x4ed1a9,_0xd9f0('0xd'));_0x35123c(_0x34fc9c['result'][_0xd9f0('0x12')]);}})[_0xd9f0('0x13')](function(_0x81c688){logger[_0xd9f0('0x11')](_0xd9f0('0xc'),_0x4ed1a9,_0x81c688);_0x24ea7d(_0x81c688);});});}exports[_0xd9f0('0x14')]=function(_0x54e41d){var _0x17e574=this;return new Promise(function(_0x214948,_0x2d0da1){return db[_0xd9f0('0x15')][_0xd9f0('0x16')](_0x54e41d[_0xd9f0('0x17')],{'raw':_0x54e41d['options']?_0x54e41d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x56e85c){logger[_0xd9f0('0xb')](_0xd9f0('0x14'),_0x54e41d);logger['debug'](_0xd9f0('0x14'),_0x54e41d,JSON[_0xd9f0('0xf')](_0x56e85c));_0x214948(_0x56e85c);})[_0xd9f0('0x13')](function(_0x15c994){logger[_0xd9f0('0x11')](_0xd9f0('0x14'),_0x15c994[_0xd9f0('0x12')],_0x54e41d);_0x2d0da1(_0x17e574[_0xd9f0('0x11')](0x1f4,_0x15c994[_0xd9f0('0x12')]));});});};exports[_0xd9f0('0x18')]=function(_0xcc99a6){var _0x627bd9=this;return new Promise(function(_0x126fef,_0xa6c0f2){return db[_0xd9f0('0x15')]['update'](_0xcc99a6[_0xd9f0('0x17')],{'raw':_0xcc99a6[_0xd9f0('0x19')]?_0xcc99a6[_0xd9f0('0x19')][_0xd9f0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcc99a6[_0xd9f0('0x19')]?_0xcc99a6[_0xd9f0('0x19')][_0xd9f0('0x1b')]||null:null,'attributes':_0xcc99a6[_0xd9f0('0x19')]?_0xcc99a6[_0xd9f0('0x19')]['attributes']||null:null,'limit':_0xcc99a6[_0xd9f0('0x19')]?_0xcc99a6[_0xd9f0('0x19')][_0xd9f0('0x1c')]||null:null})[_0xd9f0('0x1d')](function(_0x122ff0){logger[_0xd9f0('0xb')](_0xd9f0('0x18'),_0xcc99a6);logger[_0xd9f0('0xe')](_0xd9f0('0x18'),_0xcc99a6,JSON[_0xd9f0('0xf')](_0x122ff0));_0x126fef(_0x122ff0);})[_0xd9f0('0x13')](function(_0x55b871){logger[_0xd9f0('0x11')](_0xd9f0('0x18'),_0x55b871['message'],_0xcc99a6);_0xa6c0f2(_0x627bd9[_0xd9f0('0x11')](0x1f4,_0x55b871[_0xd9f0('0x12')]));});});}; \ No newline at end of file +var _0x2b36=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','body','options','CreateVoiceAgentReport','VoiceAgentReport','raw','attributes'];(function(_0x23ed08,_0x12b212){var _0x1d3f96=function(_0x50abb1){while(--_0x50abb1){_0x23ed08['push'](_0x23ed08['shift']());}};_0x1d3f96(++_0x12b212);}(_0x2b36,0x7d));var _0x62b3=function(_0x1e0beb,_0x37b5a7){_0x1e0beb=_0x1e0beb-0x0;var _0x488b38=_0x2b36[_0x1e0beb];return _0x488b38;};'use strict';var _=require(_0x62b3('0x0'));var util=require(_0x62b3('0x1'));var moment=require(_0x62b3('0x2'));var BPromise=require(_0x62b3('0x3'));var rs=require(_0x62b3('0x4'));var fs=require('fs');var Redis=require(_0x62b3('0x5'));var db=require(_0x62b3('0x6'))['db'];var utils=require(_0x62b3('0x7'));var logger=require(_0x62b3('0x8'))('rpc');var config=require(_0x62b3('0x9'));var jayson=require(_0x62b3('0xa'));var client=jayson[_0x62b3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a7aa,_0xe6e322,_0x4f7052){return new BPromise(function(_0x1b32e,_0x2b9273){return client['request'](_0x12a7aa,_0x4f7052)[_0x62b3('0xc')](function(_0x28193d){logger[_0x62b3('0xd')](_0x62b3('0xe'),_0xe6e322,'request\x20sent');logger[_0x62b3('0xf')](_0x62b3('0x10'),_0xe6e322,_0x62b3('0x11'),JSON['stringify'](_0x28193d));if(_0x28193d[_0x62b3('0x12')]){if(_0x28193d[_0x62b3('0x12')][_0x62b3('0x13')]===0x1f4){logger[_0x62b3('0x12')](_0x62b3('0xe'),_0xe6e322,_0x28193d[_0x62b3('0x12')][_0x62b3('0x14')]);return _0x2b9273(_0x28193d['error'][_0x62b3('0x14')]);}logger[_0x62b3('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0xe6e322,_0x28193d[_0x62b3('0x12')]['message']);return _0x1b32e(_0x28193d[_0x62b3('0x12')]['message']);}else{logger[_0x62b3('0xd')](_0x62b3('0xe'),_0xe6e322,_0x62b3('0x11'));_0x1b32e(_0x28193d[_0x62b3('0x15')][_0x62b3('0x14')]);}})[_0x62b3('0x16')](function(_0x21f7bc){logger['error'](_0x62b3('0xe'),_0xe6e322,_0x21f7bc);_0x2b9273(_0x21f7bc);});});}exports['CreateVoiceAgentReport']=function(_0x5f0f76){var _0x1c7359=this;return new Promise(function(_0x227aa9,_0x4a9620){return db['VoiceAgentReport'][_0x62b3('0x17')](_0x5f0f76[_0x62b3('0x18')],{'raw':_0x5f0f76[_0x62b3('0x19')]?_0x5f0f76['options']['raw']===undefined?!![]:![]:!![]})[_0x62b3('0xc')](function(_0x48e92a){logger['info']('CreateVoiceAgentReport',_0x5f0f76);logger[_0x62b3('0xf')](_0x62b3('0x1a'),_0x5f0f76,JSON['stringify'](_0x48e92a));_0x227aa9(_0x48e92a);})['catch'](function(_0x3f244c){logger[_0x62b3('0x12')](_0x62b3('0x1a'),_0x3f244c[_0x62b3('0x14')],_0x5f0f76);_0x4a9620(_0x1c7359['error'](0x1f4,_0x3f244c[_0x62b3('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3d48dc){var _0x133c9c=this;return new Promise(function(_0x181fc4,_0x4b784c){return db[_0x62b3('0x1b')]['update'](_0x3d48dc['body'],{'raw':_0x3d48dc[_0x62b3('0x19')]?_0x3d48dc[_0x62b3('0x19')][_0x62b3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d48dc[_0x62b3('0x19')]?_0x3d48dc[_0x62b3('0x19')]['where']||null:null,'attributes':_0x3d48dc[_0x62b3('0x19')]?_0x3d48dc[_0x62b3('0x19')][_0x62b3('0x1d')]||null:null,'limit':_0x3d48dc[_0x62b3('0x19')]?_0x3d48dc[_0x62b3('0x19')]['limit']||null:null})[_0x62b3('0xc')](function(_0x4f9c9c){logger['info']('UpdateVoiceAgentReport',_0x3d48dc);logger[_0x62b3('0xf')]('UpdateVoiceAgentReport',_0x3d48dc,JSON[_0x62b3('0x1e')](_0x4f9c9c));_0x181fc4(_0x4f9c9c);})[_0x62b3('0x16')](function(_0x308ab8){logger['error']('UpdateVoiceAgentReport',_0x308ab8['message'],_0x3d48dc);_0x4b784c(_0x133c9c[_0x62b3('0x12')](0x1f4,_0x308ab8[_0x62b3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f96264b..a88a2b5 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 _0x06a8=['/:id','show','post','create','put','update','updateWithRetry','destroy','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x33603a,_0x1a717a){var _0x4cf0ad=function(_0x2232f6){while(--_0x2232f6){_0x33603a['push'](_0x33603a['shift']());}};_0x4cf0ad(++_0x1a717a);}(_0x06a8,0x1a8));var _0x806a=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x06a8[_0x616290];return _0x453879;};'use strict';var express=require(_0x806a('0x0'));var router=express[_0x806a('0x1')]();var auth=require(_0x806a('0x2'));var controller=require(_0x806a('0x3'));router[_0x806a('0x4')]('/',auth[_0x806a('0x5')](),controller[_0x806a('0x6')]);router[_0x806a('0x4')](_0x806a('0x7'),auth[_0x806a('0x5')](),controller['describe']);router['get'](_0x806a('0x8'),auth['isAuthenticated'](),controller[_0x806a('0x9')]);router[_0x806a('0xa')]('/',auth['isAuthenticated'](),controller[_0x806a('0xb')]);router[_0x806a('0xc')](_0x806a('0x8'),auth[_0x806a('0x5')](),controller[_0x806a('0xd')]);router[_0x806a('0xc')]('/with-retry/:id',auth[_0x806a('0x5')](),controller[_0x806a('0xe')]);router['delete'](_0x806a('0x8'),auth[_0x806a('0x5')](),controller[_0x806a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4db2=['index','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','express','../../components/auth/service','./voiceCallReport.controller'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x4db2,0xb3));var _0x24db=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0x4db2[_0x57e18a];return _0x1181c7;};'use strict';var express=require(_0x24db('0x0'));var router=express['Router']();var auth=require(_0x24db('0x1'));var controller=require(_0x24db('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x24db('0x3')]);router[_0x24db('0x4')]('/describe',auth[_0x24db('0x5')](),controller['describe']);router[_0x24db('0x4')](_0x24db('0x6'),auth[_0x24db('0x5')](),controller[_0x24db('0x7')]);router[_0x24db('0x8')]('/',auth[_0x24db('0x5')](),controller['create']);router[_0x24db('0x9')]('/:id',auth[_0x24db('0x5')](),controller[_0x24db('0xa')]);router[_0x24db('0x9')]('/with-retry/:id',auth['isAuthenticated'](),controller['updateWithRetry']);router[_0x24db('0xb')](_0x24db('0x6'),auth[_0x24db('0x5')](),controller[_0x24db('0xc')]);module[_0x24db('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c8a55a7..cdd4ee2 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 _0x4255=['dialer','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4255,0x1bb));var _0x5425=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x4255[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0x5425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5425('0x1')]},'type':{'type':Sequelize[_0x5425('0x2')](_0x5425('0x3'),_0x5425('0x4'),'outbound',_0x5425('0x5'),_0x5425('0x6'),_0x5425('0x7'))},'tag':{'type':Sequelize[_0x5425('0x1')]},'accountcode':{'type':Sequelize[_0x5425('0x1')]},'source':{'type':Sequelize[_0x5425('0x1')]},'destination':{'type':Sequelize[_0x5425('0x1')]},'destinationcontext':{'type':Sequelize[_0x5425('0x1')]},'callerid':{'type':Sequelize[_0x5425('0x1')]},'channel':{'type':Sequelize[_0x5425('0x1')]},'destinationchannel':{'type':Sequelize[_0x5425('0x1')]},'lastapplication':{'type':Sequelize[_0x5425('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x5425('0x8')]},'systemanswertime':{'type':Sequelize[_0x5425('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5425('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5425('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x5425('0x1')]},'userfield':{'type':Sequelize[_0x5425('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x5425('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5425('0x1')]},'prefix':{'type':Sequelize[_0x5425('0x1')]},'routeid':{'type':Sequelize[_0x5425('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f76=['inbound','outbound','inbound-fax','outbound-fax','STRING','DATE','INTEGER','sequelize','ENUM'];(function(_0x1f41e8,_0x236f10){var _0x30fc4d=function(_0x5332fe){while(--_0x5332fe){_0x1f41e8['push'](_0x1f41e8['shift']());}};_0x30fc4d(++_0x236f10);}(_0x5f76,0x8e));var _0x65f7=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x5f76[_0x34bc6c];return _0x168820;};'use strict';var Sequelize=require(_0x65f7('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x65f7('0x1')](_0x65f7('0x2'),'internal',_0x65f7('0x3'),_0x65f7('0x4'),_0x65f7('0x5'),'dialer')},'tag':{'type':Sequelize[_0x65f7('0x6')]},'accountcode':{'type':Sequelize[_0x65f7('0x6')]},'source':{'type':Sequelize[_0x65f7('0x6')]},'destination':{'type':Sequelize[_0x65f7('0x6')]},'destinationcontext':{'type':Sequelize[_0x65f7('0x6')]},'callerid':{'type':Sequelize[_0x65f7('0x6')]},'channel':{'type':Sequelize[_0x65f7('0x6')]},'destinationchannel':{'type':Sequelize[_0x65f7('0x6')]},'lastapplication':{'type':Sequelize[_0x65f7('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x65f7('0x7')]},'systemanswertime':{'type':Sequelize[_0x65f7('0x7')]},'answertime':{'type':Sequelize[_0x65f7('0x7')]},'endtime':{'type':Sequelize[_0x65f7('0x7')]},'duration':{'type':Sequelize[_0x65f7('0x8')]},'billableseconds':{'type':Sequelize[_0x65f7('0x8')]},'mohtime':{'type':Sequelize[_0x65f7('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x65f7('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x65f7('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x65f7('0x6')]},'note':{'type':Sequelize[_0x65f7('0x6')]},'prefix':{'type':Sequelize[_0x65f7('0x6')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x65f7('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5314aae..ebfc114 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 _0xf864=['findAll','rows','catch','show','params','options','find','create','body','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','api','../../mysqldb','promise-retry','status','offset','undefined','count','limit','set','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceCallReport','includeAll','include','User'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xf864,0x1de));var _0x4f86=function(_0x5728a7,_0x176a7f){_0x5728a7=_0x5728a7-0x0;var _0x19f897=_0xf864[_0x5728a7];return _0x19f897;};'use strict';var _=require('lodash');var qs=require(_0x4f86('0x0'));var logger=require('../../config/logger')(_0x4f86('0x1'));var db=require(_0x4f86('0x2'))['db'];const promiseRetry=require(_0x4f86('0x3'));function respondWithResult(_0x31e2c9,_0x39d168){_0x39d168=_0x39d168||0xc8;return function(_0x420eb3){if(_0x420eb3){return _0x31e2c9[_0x4f86('0x4')](_0x39d168)['json'](_0x420eb3);}};}function respondWithFilteredResult(_0x2977ce,_0x3facfb){return function(_0x43207f){if(_0x43207f){var _0x2bdfe1=typeof _0x3facfb[_0x4f86('0x5')]==='undefined'&&typeof _0x3facfb['limit']===_0x4f86('0x6');var _0x5db98d=_0x43207f['count'];var _0x5ebbf9=_0x2bdfe1?0x0:_0x3facfb[_0x4f86('0x5')];var _0x49005f=_0x2bdfe1?_0x43207f[_0x4f86('0x7')]:_0x3facfb[_0x4f86('0x5')]+_0x3facfb[_0x4f86('0x8')];var _0x413064;if(_0x49005f>=_0x5db98d){_0x49005f=_0x5db98d;_0x413064=0xc8;}else{_0x413064=0xce;}_0x2977ce['status'](_0x413064);return _0x2977ce[_0x4f86('0x9')]('Content-Range',_0x5ebbf9+'-'+_0x49005f+'/'+_0x5db98d)[_0x4f86('0xa')](_0x43207f);}return null;};}function saveUpdates(_0x396ca1){return function(_0x479013){if(_0x479013){return _0x479013[_0x4f86('0xb')](_0x396ca1)[_0x4f86('0xc')](function(_0x41d2c9){return _0x41d2c9;});}return null;};}function removeEntity(_0x3ee474){return function(_0x58dd77){if(_0x58dd77){return _0x58dd77[_0x4f86('0xd')]()[_0x4f86('0xc')](function(){_0x3ee474[_0x4f86('0x4')](0xcc)[_0x4f86('0xe')]();});}};}function handleEntityNotFound(_0x1be485){return function(_0x1f788){if(!_0x1f788){_0x1be485[_0x4f86('0xf')](0x194);}return _0x1f788;};}function handleError(_0x2c2c1b,_0x435253){_0x435253=_0x435253||0x1f4;return function(_0x4714d6){logger[_0x4f86('0x10')](_0x4714d6[_0x4f86('0x11')]);if(_0x4714d6['name']){delete _0x4714d6[_0x4f86('0x12')];}_0x2c2c1b[_0x4f86('0x4')](_0x435253)[_0x4f86('0x13')](_0x4714d6);};}exports[_0x4f86('0x14')]=function(_0x287988,_0x4006b0){var _0x13377c={},_0x1141a4={},_0x1be46e={'count':0x0,'rows':[]};var _0x2457c4=_[_0x4f86('0x15')](db['VoiceCallReport'][_0x4f86('0x16')],function(_0x4396c9){return{'name':_0x4396c9['fieldName'],'type':_0x4396c9['type'][_0x4f86('0x17')]};});_0x1141a4['model']=_[_0x4f86('0x15')](_0x2457c4,_0x4f86('0x12'));_0x1141a4[_0x4f86('0x18')]=_[_0x4f86('0x19')](_0x287988[_0x4f86('0x18')]);_0x1141a4[_0x4f86('0x1a')]=_['intersection'](_0x1141a4[_0x4f86('0x1b')],_0x1141a4[_0x4f86('0x18')]);_0x13377c[_0x4f86('0x1c')]=_[_0x4f86('0x1d')](_0x1141a4[_0x4f86('0x1b')],qs[_0x4f86('0x1e')](_0x287988['query'][_0x4f86('0x1e')]));_0x13377c[_0x4f86('0x1c')]=_0x13377c['attributes'][_0x4f86('0x1f')]?_0x13377c[_0x4f86('0x1c')]:_0x1141a4[_0x4f86('0x1b')];if(!_0x287988[_0x4f86('0x18')][_0x4f86('0x20')](_0x4f86('0x21'))){_0x13377c[_0x4f86('0x8')]=qs['limit'](_0x287988[_0x4f86('0x18')][_0x4f86('0x8')]);_0x13377c[_0x4f86('0x5')]=qs[_0x4f86('0x5')](_0x287988['query'][_0x4f86('0x5')]);}_0x13377c[_0x4f86('0x22')]=qs[_0x4f86('0x23')](_0x287988[_0x4f86('0x18')][_0x4f86('0x23')]);_0x13377c[_0x4f86('0x24')]=qs[_0x4f86('0x1a')](_['pick'](_0x287988[_0x4f86('0x18')],_0x1141a4[_0x4f86('0x1a')]),_0x2457c4);if(_0x287988['query'][_0x4f86('0x25')]){_0x13377c['where']=_[_0x4f86('0x26')](_0x13377c[_0x4f86('0x24')],{'$or':_['map'](_0x2457c4,function(_0x50551f){if(_0x50551f['type']!==_0x4f86('0x27')){var _0x5a3f61={};_0x5a3f61[_0x50551f[_0x4f86('0x12')]]={'$like':'%'+_0x287988[_0x4f86('0x18')][_0x4f86('0x25')]+'%'};return _0x5a3f61;}})});}_0x13377c=_[_0x4f86('0x26')]({},_0x13377c,_0x287988['options']);var _0x5cc0e3={'where':_0x13377c['where']};return db[_0x4f86('0x28')][_0x4f86('0x7')](_0x5cc0e3)[_0x4f86('0xc')](function(_0x30e32c){_0x1be46e['count']=_0x30e32c;if(_0x287988[_0x4f86('0x18')][_0x4f86('0x29')]){_0x13377c[_0x4f86('0x2a')]=[{'attributes':['id',_0x4f86('0x12'),'fullname','alias'],'model':db[_0x4f86('0x2b')],'as':_0x4f86('0x2b')}];}return db[_0x4f86('0x28')][_0x4f86('0x2c')](_0x13377c);})[_0x4f86('0xc')](function(_0x133e78){_0x1be46e[_0x4f86('0x2d')]=_0x133e78;return _0x1be46e;})[_0x4f86('0xc')](respondWithFilteredResult(_0x4006b0,_0x13377c))[_0x4f86('0x2e')](handleError(_0x4006b0,null));};exports[_0x4f86('0x2f')]=function(_0x2024f2,_0x27aecf){var _0x2fc4dd={'raw':!![],'where':{'id':_0x2024f2[_0x4f86('0x30')]['id']}},_0x286da8={};_0x286da8[_0x4f86('0x1b')]=_[_0x4f86('0x19')](db[_0x4f86('0x28')][_0x4f86('0x16')]);_0x286da8[_0x4f86('0x18')]=_[_0x4f86('0x19')](_0x2024f2[_0x4f86('0x18')]);_0x286da8[_0x4f86('0x1a')]=_[_0x4f86('0x1d')](_0x286da8[_0x4f86('0x1b')],_0x286da8[_0x4f86('0x18')]);_0x2fc4dd['attributes']=_[_0x4f86('0x1d')](_0x286da8[_0x4f86('0x1b')],qs[_0x4f86('0x1e')](_0x2024f2[_0x4f86('0x18')]['fields']));_0x2fc4dd['attributes']=_0x2fc4dd[_0x4f86('0x1c')][_0x4f86('0x1f')]?_0x2fc4dd[_0x4f86('0x1c')]:_0x286da8[_0x4f86('0x1b')];if(_0x2024f2[_0x4f86('0x18')][_0x4f86('0x29')]){_0x2fc4dd[_0x4f86('0x2a')]=[{'all':!![]}];}_0x2fc4dd=_[_0x4f86('0x26')]({},_0x2fc4dd,_0x2024f2[_0x4f86('0x31')]);return db['VoiceCallReport'][_0x4f86('0x32')](_0x2fc4dd)['then'](handleEntityNotFound(_0x27aecf,null))[_0x4f86('0xc')](respondWithResult(_0x27aecf,null))[_0x4f86('0x2e')](handleError(_0x27aecf,null));};exports[_0x4f86('0x33')]=function(_0x2b0e3d,_0x1e103e){return db[_0x4f86('0x28')][_0x4f86('0x33')](_0x2b0e3d[_0x4f86('0x34')],{})[_0x4f86('0xc')](respondWithResult(_0x1e103e,0xc9))[_0x4f86('0x2e')](handleError(_0x1e103e,null));};exports[_0x4f86('0xd')]=function(_0x12d90b,_0x431b83){return db[_0x4f86('0x28')][_0x4f86('0x32')]({'where':{'id':_0x12d90b[_0x4f86('0x30')]['id']}})[_0x4f86('0xc')](handleEntityNotFound(_0x431b83,null))[_0x4f86('0xc')](removeEntity(_0x431b83,null))['catch'](handleError(_0x431b83,null));};exports['describe']=function(_0x2905b8,_0x53cecc){return db['VoiceCallReport'][_0x4f86('0x35')]()[_0x4f86('0xc')](respondWithResult(_0x53cecc,null))[_0x4f86('0x2e')](handleError(_0x53cecc,null));};function findForUpdate(_0x18e4a0){return db[_0x4f86('0x28')][_0x4f86('0x32')]({'where':{'uniqueid':_0x18e4a0['params']['id'],'UserId':{'$or':[null,_0x18e4a0[_0x4f86('0x36')]['id']]}}});}exports['update']=function(_0x22c62b,_0x341147){if(_0x22c62b[_0x4f86('0x34')][_0x4f86('0x37')]){delete _0x22c62b[_0x4f86('0x34')]['uniqueid'];}return findForUpdate(_0x22c62b)[_0x4f86('0xc')](handleEntityNotFound(_0x341147,null))[_0x4f86('0xc')](saveUpdates(_0x22c62b[_0x4f86('0x34')],null))['then'](respondWithResult(_0x341147,null))[_0x4f86('0x2e')](handleError(_0x341147,null));};exports[_0x4f86('0x38')]=function(_0x41fca2,_0x2848c2){if(_0x41fca2[_0x4f86('0x34')][_0x4f86('0x37')]){delete _0x41fca2[_0x4f86('0x34')]['uniqueid'];}promiseRetry(function(_0x537576){return findForUpdate(_0x41fca2)['then'](function(_0xbeb93c){if(_0xbeb93c!==null){return _0xbeb93c;}else{_0x537576(new Error(_0x4f86('0x39')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x4f86('0xc')](function(_0x336e57){return _0x336e57[_0x4f86('0xb')](_0x41fca2['body'])[_0x4f86('0xc')](function(_0x28513a){return respondWithResult(_0x2848c2)(_0x28513a);});},handleEntityNotFound(_0x2848c2));}; \ No newline at end of file +var _0xebd5=['model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','promise-retry','status','json','undefined','limit','count','offset','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key'];(function(_0x2812c2,_0x2b382d){var _0x218ac9=function(_0x2fe4c4){while(--_0x2fe4c4){_0x2812c2['push'](_0x2812c2['shift']());}};_0x218ac9(++_0x2b382d);}(_0xebd5,0xcf));var _0x5ebd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xebd5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5ebd('0x0'));var qs=require(_0x5ebd('0x1'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x5ebd('0x2'));function respondWithResult(_0x16c530,_0xf1a56d){_0xf1a56d=_0xf1a56d||0xc8;return function(_0xe1e48){if(_0xe1e48){return _0x16c530[_0x5ebd('0x3')](_0xf1a56d)[_0x5ebd('0x4')](_0xe1e48);}};}function respondWithFilteredResult(_0x1bfa42,_0x30e9d6){return function(_0x4afd45){if(_0x4afd45){var _0x317018=typeof _0x30e9d6['offset']===_0x5ebd('0x5')&&typeof _0x30e9d6[_0x5ebd('0x6')]===_0x5ebd('0x5');var _0x36d809=_0x4afd45[_0x5ebd('0x7')];var _0x4e6607=_0x317018?0x0:_0x30e9d6[_0x5ebd('0x8')];var _0x3c518a=_0x317018?_0x4afd45[_0x5ebd('0x7')]:_0x30e9d6[_0x5ebd('0x8')]+_0x30e9d6[_0x5ebd('0x6')];var _0x4085ca;if(_0x3c518a>=_0x36d809){_0x3c518a=_0x36d809;_0x4085ca=0xc8;}else{_0x4085ca=0xce;}_0x1bfa42[_0x5ebd('0x3')](_0x4085ca);return _0x1bfa42['set'](_0x5ebd('0x9'),_0x4e6607+'-'+_0x3c518a+'/'+_0x36d809)[_0x5ebd('0x4')](_0x4afd45);}return null;};}function saveUpdates(_0x31cb81){return function(_0x32ae36){if(_0x32ae36){return _0x32ae36[_0x5ebd('0xa')](_0x31cb81)[_0x5ebd('0xb')](function(_0x1ed8fe){return _0x1ed8fe;});}return null;};}function removeEntity(_0x28ed66){return function(_0x3d6415){if(_0x3d6415){return _0x3d6415['destroy']()[_0x5ebd('0xb')](function(){_0x28ed66['status'](0xcc)[_0x5ebd('0xc')]();});}};}function handleEntityNotFound(_0x15b354){return function(_0x30f279){if(!_0x30f279){_0x15b354[_0x5ebd('0xd')](0x194);}return _0x30f279;};}function handleError(_0x502c19,_0x265c56){_0x265c56=_0x265c56||0x1f4;return function(_0x57a741){logger[_0x5ebd('0xe')](_0x57a741[_0x5ebd('0xf')]);if(_0x57a741[_0x5ebd('0x10')]){delete _0x57a741[_0x5ebd('0x10')];}_0x502c19[_0x5ebd('0x3')](_0x265c56)[_0x5ebd('0x11')](_0x57a741);};}exports[_0x5ebd('0x12')]=function(_0xf1a342,_0x763a8a){var _0x30843e={},_0x3cb861={},_0x46dd88={'count':0x0,'rows':[]};var _0x37a7ce=_[_0x5ebd('0x13')](db[_0x5ebd('0x14')][_0x5ebd('0x15')],function(_0x12b223){return{'name':_0x12b223[_0x5ebd('0x16')],'type':_0x12b223[_0x5ebd('0x17')][_0x5ebd('0x18')]};});_0x3cb861[_0x5ebd('0x19')]=_['map'](_0x37a7ce,_0x5ebd('0x10'));_0x3cb861['query']=_[_0x5ebd('0x1a')](_0xf1a342[_0x5ebd('0x1b')]);_0x3cb861['filters']=_[_0x5ebd('0x1c')](_0x3cb861[_0x5ebd('0x19')],_0x3cb861[_0x5ebd('0x1b')]);_0x30843e['attributes']=_[_0x5ebd('0x1c')](_0x3cb861[_0x5ebd('0x19')],qs[_0x5ebd('0x1d')](_0xf1a342[_0x5ebd('0x1b')][_0x5ebd('0x1d')]));_0x30843e[_0x5ebd('0x1e')]=_0x30843e[_0x5ebd('0x1e')][_0x5ebd('0x1f')]?_0x30843e[_0x5ebd('0x1e')]:_0x3cb861[_0x5ebd('0x19')];if(!_0xf1a342[_0x5ebd('0x1b')][_0x5ebd('0x20')](_0x5ebd('0x21'))){_0x30843e[_0x5ebd('0x6')]=qs['limit'](_0xf1a342[_0x5ebd('0x1b')]['limit']);_0x30843e[_0x5ebd('0x8')]=qs[_0x5ebd('0x8')](_0xf1a342['query'][_0x5ebd('0x8')]);}_0x30843e['order']=qs['sort'](_0xf1a342[_0x5ebd('0x1b')]['sort']);_0x30843e[_0x5ebd('0x22')]=qs[_0x5ebd('0x23')](_[_0x5ebd('0x24')](_0xf1a342['query'],_0x3cb861[_0x5ebd('0x23')]),_0x37a7ce);if(_0xf1a342[_0x5ebd('0x1b')]['filter']){_0x30843e[_0x5ebd('0x22')]=_[_0x5ebd('0x25')](_0x30843e[_0x5ebd('0x22')],{'$or':_['map'](_0x37a7ce,function(_0x257916){if(_0x257916[_0x5ebd('0x17')]!==_0x5ebd('0x26')){var _0x57598e={};_0x57598e[_0x257916[_0x5ebd('0x10')]]={'$like':'%'+_0xf1a342['query'][_0x5ebd('0x27')]+'%'};return _0x57598e;}})});}_0x30843e=_['merge']({},_0x30843e,_0xf1a342[_0x5ebd('0x28')]);var _0x188530={'where':_0x30843e[_0x5ebd('0x22')]};return db['VoiceCallReport'][_0x5ebd('0x7')](_0x188530)['then'](function(_0x5f086f){_0x46dd88['count']=_0x5f086f;if(_0xf1a342[_0x5ebd('0x1b')][_0x5ebd('0x29')]){_0x30843e[_0x5ebd('0x2a')]=[{'attributes':['id',_0x5ebd('0x10'),_0x5ebd('0x2b'),_0x5ebd('0x2c')],'model':db[_0x5ebd('0x2d')],'as':_0x5ebd('0x2d')}];}return db['VoiceCallReport'][_0x5ebd('0x2e')](_0x30843e);})[_0x5ebd('0xb')](function(_0x458c5a){_0x46dd88[_0x5ebd('0x2f')]=_0x458c5a;return _0x46dd88;})['then'](respondWithFilteredResult(_0x763a8a,_0x30843e))[_0x5ebd('0x30')](handleError(_0x763a8a,null));};exports[_0x5ebd('0x31')]=function(_0x2fd878,_0x5ca9fc){var _0x18d82f={'raw':!![],'where':{'id':_0x2fd878[_0x5ebd('0x32')]['id']}},_0xf2626f={};_0xf2626f[_0x5ebd('0x19')]=_[_0x5ebd('0x1a')](db[_0x5ebd('0x14')][_0x5ebd('0x15')]);_0xf2626f['query']=_[_0x5ebd('0x1a')](_0x2fd878[_0x5ebd('0x1b')]);_0xf2626f[_0x5ebd('0x23')]=_[_0x5ebd('0x1c')](_0xf2626f[_0x5ebd('0x19')],_0xf2626f[_0x5ebd('0x1b')]);_0x18d82f[_0x5ebd('0x1e')]=_[_0x5ebd('0x1c')](_0xf2626f[_0x5ebd('0x19')],qs['fields'](_0x2fd878[_0x5ebd('0x1b')][_0x5ebd('0x1d')]));_0x18d82f[_0x5ebd('0x1e')]=_0x18d82f[_0x5ebd('0x1e')][_0x5ebd('0x1f')]?_0x18d82f['attributes']:_0xf2626f[_0x5ebd('0x19')];if(_0x2fd878['query']['includeAll']){_0x18d82f[_0x5ebd('0x2a')]=[{'all':!![]}];}_0x18d82f=_[_0x5ebd('0x25')]({},_0x18d82f,_0x2fd878[_0x5ebd('0x28')]);return db['VoiceCallReport'][_0x5ebd('0x33')](_0x18d82f)['then'](handleEntityNotFound(_0x5ca9fc,null))[_0x5ebd('0xb')](respondWithResult(_0x5ca9fc,null))[_0x5ebd('0x30')](handleError(_0x5ca9fc,null));};exports[_0x5ebd('0x34')]=function(_0x22bd5a,_0x1d627e){return db[_0x5ebd('0x14')][_0x5ebd('0x34')](_0x22bd5a[_0x5ebd('0x35')],{})['then'](respondWithResult(_0x1d627e,0xc9))['catch'](handleError(_0x1d627e,null));};exports['destroy']=function(_0xb1fa5c,_0x34fdc7){return db[_0x5ebd('0x14')]['find']({'where':{'id':_0xb1fa5c[_0x5ebd('0x32')]['id']}})[_0x5ebd('0xb')](handleEntityNotFound(_0x34fdc7,null))[_0x5ebd('0xb')](removeEntity(_0x34fdc7,null))[_0x5ebd('0x30')](handleError(_0x34fdc7,null));};exports[_0x5ebd('0x36')]=function(_0x5f3212,_0x5265fb){return db[_0x5ebd('0x14')][_0x5ebd('0x36')]()[_0x5ebd('0xb')](respondWithResult(_0x5265fb,null))[_0x5ebd('0x30')](handleError(_0x5265fb,null));};function findForUpdate(_0x529cae){return db[_0x5ebd('0x14')]['find']({'where':{'uniqueid':_0x529cae[_0x5ebd('0x32')]['id'],'UserId':{'$or':[null,_0x529cae['user']['id']]}}});}exports[_0x5ebd('0xa')]=function(_0x269664,_0x29bd44){if(_0x269664[_0x5ebd('0x35')][_0x5ebd('0x37')]){delete _0x269664['body']['uniqueid'];}return findForUpdate(_0x269664)[_0x5ebd('0xb')](handleEntityNotFound(_0x29bd44,null))[_0x5ebd('0xb')](saveUpdates(_0x269664[_0x5ebd('0x35')],null))['then'](respondWithResult(_0x29bd44,null))[_0x5ebd('0x30')](handleError(_0x29bd44,null));};exports[_0x5ebd('0x38')]=function(_0x431aab,_0x2162af){if(_0x431aab[_0x5ebd('0x35')]['uniqueid']){delete _0x431aab[_0x5ebd('0x35')][_0x5ebd('0x37')];}promiseRetry(function(_0x5571bd){return findForUpdate(_0x431aab)[_0x5ebd('0xb')](function(_0x187f40){if(_0x187f40!==null){return _0x187f40;}else{_0x5571bd(new Error(_0x5ebd('0x39')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x5ebd('0xb')](function(_0x283017){return _0x283017[_0x5ebd('0xa')](_0x431aab['body'])[_0x5ebd('0xb')](function(_0x117e2c){return respondWithResult(_0x2162af)(_0x117e2c);});},handleEntityNotFound(_0x2162af));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e2ed7d2..482bcab 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 _0x3351=['uniqueid','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3351,0x175));var _0x1335=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x3351[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1335('0x0'));var util=require(_0x1335('0x1'));var logger=require(_0x1335('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1335('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1335('0x4'));var config=require(_0x1335('0x5'));var attributes=require(_0x1335('0x6'));module[_0x1335('0x7')]=function(_0x426763,_0x79f9e8){return _0x426763[_0x1335('0x8')](_0x1335('0x9'),attributes,{'tableName':_0x1335('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1335('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ed7=['bluebird','request-promise','path','rimraf','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0x7ed7,0x98));var _0x77ed=function(_0x5891c,_0x26c3ab){_0x5891c=_0x5891c-0x0;var _0x82a0a7=_0x7ed7[_0x5891c];return _0x82a0a7;};'use strict';var _=require(_0x77ed('0x0'));var util=require('util');var logger=require(_0x77ed('0x1'))(_0x77ed('0x2'));var moment=require(_0x77ed('0x3'));var BPromise=require(_0x77ed('0x4'));var rp=require(_0x77ed('0x5'));var fs=require('fs');var path=require(_0x77ed('0x6'));var rimraf=require(_0x77ed('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x77ed('0x8')]=function(_0x3c42c5,_0x39d907){return _0x3c42c5[_0x77ed('0x9')](_0x77ed('0xa'),attributes,{'tableName':_0x77ed('0xb'),'paranoid':![],'indexes':[{'fields':[_0x77ed('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index be8747b..cb82281 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 _0x5c5f=['options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll'];(function(_0x55f1a1,_0xd540c4){var _0x5f3028=function(_0x5b20a9){while(--_0x5b20a9){_0x55f1a1['push'](_0x55f1a1['shift']());}};_0x5f3028(++_0xd540c4);}(_0x5c5f,0xa6));var _0xf5c5=function(_0x188d60,_0x40f3e1){_0x188d60=_0x188d60-0x0;var _0x4ca0da=_0x5c5f[_0x188d60];return _0x4ca0da;};'use strict';var _=require(_0xf5c5('0x0'));var util=require(_0xf5c5('0x1'));var moment=require('moment');var BPromise=require(_0xf5c5('0x2'));var rs=require(_0xf5c5('0x3'));var fs=require('fs');var Redis=require(_0xf5c5('0x4'));var db=require(_0xf5c5('0x5'))['db'];var utils=require(_0xf5c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5c5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5c5('0x8')][_0xf5c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ee169,_0x60022,_0x42cd27){return new BPromise(function(_0x129f7c,_0x7b8b80){return client[_0xf5c5('0xa')](_0x4ee169,_0x42cd27)[_0xf5c5('0xb')](function(_0x39750d){logger[_0xf5c5('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x60022,'request\x20sent');logger[_0xf5c5('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x60022,_0xf5c5('0xe'),JSON[_0xf5c5('0xf')](_0x39750d));if(_0x39750d[_0xf5c5('0x10')]){if(_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x11')]===0x1f4){logger['error'](_0xf5c5('0x12'),_0x60022,_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x13')]);return _0x7b8b80(_0x39750d[_0xf5c5('0x10')]['message']);}logger[_0xf5c5('0x10')](_0xf5c5('0x12'),_0x60022,_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x13')]);return _0x129f7c(_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x13')]);}else{logger[_0xf5c5('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x60022,_0xf5c5('0xe'));_0x129f7c(_0x39750d[_0xf5c5('0x14')][_0xf5c5('0x13')]);}})[_0xf5c5('0x15')](function(_0x2cb7f8){logger[_0xf5c5('0x10')](_0xf5c5('0x12'),_0x60022,_0x2cb7f8);_0x7b8b80(_0x2cb7f8);});});}exports['GetVoiceCallReport']=function(_0x420128){var _0x5b82de=this;return new Promise(function(_0x158592,_0x54e900){return db[_0xf5c5('0x16')][_0xf5c5('0x17')]({'raw':_0x420128[_0xf5c5('0x18')]?_0x420128[_0xf5c5('0x18')][_0xf5c5('0x19')]===undefined?!![]:![]:!![],'where':_0x420128[_0xf5c5('0x18')]?_0x420128['options'][_0xf5c5('0x1a')]||null:null,'attributes':_0x420128[_0xf5c5('0x18')]?_0x420128[_0xf5c5('0x18')][_0xf5c5('0x1b')]||null:null,'limit':_0x420128[_0xf5c5('0x18')]?_0x420128['options'][_0xf5c5('0x1c')]||null:null,'include':_0x420128[_0xf5c5('0x18')]?_0x420128[_0xf5c5('0x18')]['include']?_['map'](_0x420128['options'][_0xf5c5('0x1d')],function(_0x740b9f){return{'model':db[_0x740b9f['model']],'as':_0x740b9f['as'],'attributes':_0x740b9f[_0xf5c5('0x1b')],'include':_0x740b9f[_0xf5c5('0x1d')]?_[_0xf5c5('0x1e')](_0x740b9f['include'],function(_0x511af6){return{'model':db[_0x511af6[_0xf5c5('0x1f')]],'as':_0x511af6['as'],'attributes':_0x511af6[_0xf5c5('0x1b')],'include':_0x511af6['include']?_[_0xf5c5('0x1e')](_0x511af6[_0xf5c5('0x1d')],function(_0x2f18da){return{'model':db[_0x2f18da[_0xf5c5('0x1f')]],'as':_0x2f18da['as'],'attributes':_0x2f18da[_0xf5c5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x100a1e){logger['info'](_0xf5c5('0x20'),_0x420128);logger[_0xf5c5('0xd')](_0xf5c5('0x20'),_0x420128,JSON['stringify'](_0x100a1e));_0x158592(_0x100a1e);})['catch'](function(_0x192e09){logger['error'](_0xf5c5('0x20'),_0x192e09[_0xf5c5('0x13')],_0x420128);_0x54e900(_0x5b82de['error'](0x1f4,_0x192e09[_0xf5c5('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x52eda8){var _0x4702fe=this;return new Promise(function(_0x84036,_0x213daf){return db['VoiceCallReport'][_0xf5c5('0x21')](_0x52eda8[_0xf5c5('0x22')],{'raw':_0x52eda8[_0xf5c5('0x18')]?_0x52eda8[_0xf5c5('0x18')][_0xf5c5('0x19')]===undefined?!![]:![]:!![]})[_0xf5c5('0xb')](function(_0x2db201){logger[_0xf5c5('0xc')](_0xf5c5('0x23'),_0x52eda8);logger[_0xf5c5('0xd')](_0xf5c5('0x23'),_0x52eda8,JSON[_0xf5c5('0xf')](_0x2db201));_0x84036(_0x2db201);})['catch'](function(_0x55415b){logger[_0xf5c5('0x10')]('CreateVoiceCallReport',_0x55415b[_0xf5c5('0x13')],_0x52eda8);_0x213daf(_0x4702fe[_0xf5c5('0x10')](0x1f4,_0x55415b['message']));});});};exports[_0xf5c5('0x24')]=function(_0x3e9f8f){var _0x691c9e=this;return new Promise(function(_0xc66617,_0x4a404c){return db[_0xf5c5('0x16')][_0xf5c5('0x25')](_0x3e9f8f[_0xf5c5('0x22')],{'raw':_0x3e9f8f['options']?_0x3e9f8f[_0xf5c5('0x18')][_0xf5c5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e9f8f['options']?_0x3e9f8f[_0xf5c5('0x18')]['where']||null:null,'attributes':_0x3e9f8f['options']?_0x3e9f8f[_0xf5c5('0x18')]['attributes']||null:null,'limit':_0x3e9f8f['options']?_0x3e9f8f[_0xf5c5('0x18')]['limit']||null:null})['then'](function(_0x308f4e){logger['info'](_0xf5c5('0x24'),_0x3e9f8f);logger[_0xf5c5('0xd')](_0xf5c5('0x24'),_0x3e9f8f,JSON[_0xf5c5('0xf')](_0x308f4e));_0xc66617(_0x308f4e);})[_0xf5c5('0x15')](function(_0x5c4511){logger[_0xf5c5('0x10')]('UpdateVoiceCallReport',_0x5c4511[_0xf5c5('0x13')],_0x3e9f8f);_0x4a404c(_0x691c9e[_0xf5c5('0x10')](0x1f4,_0x5c4511[_0xf5c5('0x13')]));});});}; \ No newline at end of file +var _0x7e84=['CreateVoiceCallReport','UpdateVoiceCallReport','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceCallReport','raw','options','where','attributes','include','map','model','GetVoiceCallReport','debug','create','body'];(function(_0x43c415,_0x348779){var _0x4c2c7a=function(_0x5df388){while(--_0x5df388){_0x43c415['push'](_0x43c415['shift']());}};_0x4c2c7a(++_0x348779);}(_0x7e84,0x72));var _0x47e8=function(_0x2f093e,_0x37bfd7){_0x2f093e=_0x2f093e-0x0;var _0x11f2d3=_0x7e84[_0x2f093e];return _0x11f2d3;};'use strict';var _=require(_0x47e8('0x0'));var util=require('util');var moment=require(_0x47e8('0x1'));var BPromise=require(_0x47e8('0x2'));var rs=require(_0x47e8('0x3'));var fs=require('fs');var Redis=require(_0x47e8('0x4'));var db=require(_0x47e8('0x5'))['db'];var utils=require(_0x47e8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x47e8('0x7'));var client=jayson[_0x47e8('0x8')][_0x47e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f939c,_0x3d4645,_0x2e2dfc){return new BPromise(function(_0x4e42a0,_0xeb40ea){return client[_0x47e8('0xa')](_0x3f939c,_0x2e2dfc)[_0x47e8('0xb')](function(_0x2996eb){logger[_0x47e8('0xc')](_0x47e8('0xd'),_0x3d4645,_0x47e8('0xe'));logger['debug'](_0x47e8('0xf'),_0x3d4645,_0x47e8('0xe'),JSON[_0x47e8('0x10')](_0x2996eb));if(_0x2996eb[_0x47e8('0x11')]){if(_0x2996eb[_0x47e8('0x11')][_0x47e8('0x12')]===0x1f4){logger[_0x47e8('0x11')](_0x47e8('0xd'),_0x3d4645,_0x2996eb[_0x47e8('0x11')][_0x47e8('0x13')]);return _0xeb40ea(_0x2996eb['error']['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3d4645,_0x2996eb[_0x47e8('0x11')][_0x47e8('0x13')]);return _0x4e42a0(_0x2996eb[_0x47e8('0x11')][_0x47e8('0x13')]);}else{logger[_0x47e8('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3d4645,_0x47e8('0xe'));_0x4e42a0(_0x2996eb[_0x47e8('0x14')][_0x47e8('0x13')]);}})[_0x47e8('0x15')](function(_0x27fb8e){logger[_0x47e8('0x11')](_0x47e8('0xd'),_0x3d4645,_0x27fb8e);_0xeb40ea(_0x27fb8e);});});}exports['GetVoiceCallReport']=function(_0x30dee1){var _0x2c1519=this;return new Promise(function(_0x37d282,_0x53cdf9){return db[_0x47e8('0x16')]['findAll']({'raw':_0x30dee1['options']?_0x30dee1['options'][_0x47e8('0x17')]===undefined?!![]:![]:!![],'where':_0x30dee1[_0x47e8('0x18')]?_0x30dee1[_0x47e8('0x18')][_0x47e8('0x19')]||null:null,'attributes':_0x30dee1['options']?_0x30dee1[_0x47e8('0x18')][_0x47e8('0x1a')]||null:null,'limit':_0x30dee1[_0x47e8('0x18')]?_0x30dee1[_0x47e8('0x18')]['limit']||null:null,'include':_0x30dee1['options']?_0x30dee1[_0x47e8('0x18')][_0x47e8('0x1b')]?_[_0x47e8('0x1c')](_0x30dee1[_0x47e8('0x18')]['include'],function(_0x387b9a){return{'model':db[_0x387b9a[_0x47e8('0x1d')]],'as':_0x387b9a['as'],'attributes':_0x387b9a['attributes'],'include':_0x387b9a[_0x47e8('0x1b')]?_['map'](_0x387b9a[_0x47e8('0x1b')],function(_0x831dd6){return{'model':db[_0x831dd6[_0x47e8('0x1d')]],'as':_0x831dd6['as'],'attributes':_0x831dd6[_0x47e8('0x1a')],'include':_0x831dd6[_0x47e8('0x1b')]?_[_0x47e8('0x1c')](_0x831dd6['include'],function(_0x411ddd){return{'model':db[_0x411ddd['model']],'as':_0x411ddd['as'],'attributes':_0x411ddd['attributes']};}):[]};}):[]};}):[]:[]})[_0x47e8('0xb')](function(_0x2f7d27){logger['info'](_0x47e8('0x1e'),_0x30dee1);logger[_0x47e8('0x1f')](_0x47e8('0x1e'),_0x30dee1,JSON['stringify'](_0x2f7d27));_0x37d282(_0x2f7d27);})[_0x47e8('0x15')](function(_0x1d626a){logger[_0x47e8('0x11')](_0x47e8('0x1e'),_0x1d626a[_0x47e8('0x13')],_0x30dee1);_0x53cdf9(_0x2c1519[_0x47e8('0x11')](0x1f4,_0x1d626a[_0x47e8('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x116ed2){var _0x18d4d6=this;return new Promise(function(_0x4cac34,_0x3df8c7){return db[_0x47e8('0x16')][_0x47e8('0x20')](_0x116ed2[_0x47e8('0x21')],{'raw':_0x116ed2[_0x47e8('0x18')]?_0x116ed2[_0x47e8('0x18')][_0x47e8('0x17')]===undefined?!![]:![]:!![]})[_0x47e8('0xb')](function(_0x41502e){logger[_0x47e8('0xc')]('CreateVoiceCallReport',_0x116ed2);logger['debug'](_0x47e8('0x22'),_0x116ed2,JSON['stringify'](_0x41502e));_0x4cac34(_0x41502e);})[_0x47e8('0x15')](function(_0x3cae59){logger['error'](_0x47e8('0x22'),_0x3cae59[_0x47e8('0x13')],_0x116ed2);_0x3df8c7(_0x18d4d6[_0x47e8('0x11')](0x1f4,_0x3cae59[_0x47e8('0x13')]));});});};exports[_0x47e8('0x23')]=function(_0x1773be){var _0x599dc8=this;return new Promise(function(_0x31ccc8,_0x6b1e24){return db[_0x47e8('0x16')]['update'](_0x1773be['body'],{'raw':_0x1773be[_0x47e8('0x18')]?_0x1773be[_0x47e8('0x18')][_0x47e8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1773be[_0x47e8('0x18')]?_0x1773be[_0x47e8('0x18')][_0x47e8('0x19')]||null:null,'attributes':_0x1773be[_0x47e8('0x18')]?_0x1773be['options'][_0x47e8('0x1a')]||null:null,'limit':_0x1773be[_0x47e8('0x18')]?_0x1773be[_0x47e8('0x18')][_0x47e8('0x24')]||null:null})[_0x47e8('0xb')](function(_0x3897e9){logger['info'](_0x47e8('0x23'),_0x1773be);logger[_0x47e8('0x1f')](_0x47e8('0x23'),_0x1773be,JSON[_0x47e8('0x10')](_0x3897e9));_0x31ccc8(_0x3897e9);})[_0x47e8('0x15')](function(_0x1f0366){logger['error'](_0x47e8('0x23'),_0x1f0366[_0x47e8('0x13')],_0x1773be);_0x6b1e24(_0x599dc8[_0x47e8('0x11')](0x1f4,_0x1f0366[_0x47e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5107b7d..923ccac 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 _0x35b5=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x29fb7c,_0xbc227e){var _0x26c29b=function(_0x1b9907){while(--_0x1b9907){_0x29fb7c['push'](_0x29fb7c['shift']());}};_0x26c29b(++_0xbc227e);}(_0x35b5,0x15f));var _0x535b=function(_0x86fbc6,_0x31d9d3){_0x86fbc6=_0x86fbc6-0x0;var _0x48487b=_0x35b5[_0x86fbc6];return _0x48487b;};'use strict';var multer=require(_0x535b('0x0'));var util=require('util');var path=require(_0x535b('0x1'));var timeout=require(_0x535b('0x2'));var express=require(_0x535b('0x3'));var router=express['Router']();var fs_extra=require(_0x535b('0x4'));var auth=require(_0x535b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x535b('0x6'));var controller=require(_0x535b('0x7'));router[_0x535b('0x8')]('/',auth[_0x535b('0x9')](),controller[_0x535b('0xa')]);router[_0x535b('0x8')](_0x535b('0xb'),auth[_0x535b('0x9')](),controller[_0x535b('0xc')]);router[_0x535b('0xd')]('/',auth[_0x535b('0x9')](),controller[_0x535b('0xe')]);router[_0x535b('0xf')](_0x535b('0xb'),auth[_0x535b('0x9')](),controller[_0x535b('0x10')]);router[_0x535b('0x11')](_0x535b('0xb'),auth['isAuthenticated'](),controller[_0x535b('0x12')]);module[_0x535b('0x13')]=router; \ No newline at end of file +var _0xdfd5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3eb64f,_0x3e8dda){var _0x587f3b=function(_0x5de43e){while(--_0x5de43e){_0x3eb64f['push'](_0x3eb64f['shift']());}};_0x587f3b(++_0x3e8dda);}(_0xdfd5,0x1b0));var _0x5dfd=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xdfd5[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x5dfd('0x0'));var util=require(_0x5dfd('0x1'));var path=require(_0x5dfd('0x2'));var timeout=require(_0x5dfd('0x3'));var express=require(_0x5dfd('0x4'));var router=express[_0x5dfd('0x5')]();var fs_extra=require(_0x5dfd('0x6'));var auth=require(_0x5dfd('0x7'));var interaction=require(_0x5dfd('0x8'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x5dfd('0x9')]('/',auth[_0x5dfd('0xa')](),controller['index']);router['get'](_0x5dfd('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5dfd('0xc')]('/',auth[_0x5dfd('0xa')](),controller[_0x5dfd('0xd')]);router[_0x5dfd('0xe')](_0x5dfd('0xb'),auth[_0x5dfd('0xa')](),controller[_0x5dfd('0xf')]);router[_0x5dfd('0x10')](_0x5dfd('0xb'),auth[_0x5dfd('0xa')](),controller[_0x5dfd('0x11')]);module[_0x5dfd('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e9bd531..8b236a8 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 _0x8eb3=['join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','options'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x8eb3,0x1c6));var _0x38eb=function(_0x174008,_0x567386){_0x174008=_0x174008-0x0;var _0x120e15=_0x8eb3[_0x174008];return _0x120e15;};'use strict';var Sequelize=require('sequelize');module[_0x38eb('0x0')]={'name':{'type':Sequelize[_0x38eb('0x1')]},'prefix':{'type':Sequelize[_0x38eb('0x1')],'unique':_0x38eb('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x38eb('0x1')],'set':function(_0x33d0d2){this[_0x38eb('0x3')](_0x38eb('0x4'),_0x33d0d2?_0x33d0d2[_0x38eb('0x5')](''):[]);},'get':function(){return this[_0x38eb('0x6')](_0x38eb('0x4'))?this[_0x38eb('0x6')](_0x38eb('0x4'))[_0x38eb('0x7')](''):[];}},'auth':{'type':Sequelize[_0x38eb('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x38eb('0x1')]},'record':{'type':Sequelize[_0x38eb('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x38eb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf2db=['exports','STRING','name','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x414d0a,_0x5be40e){var _0x42a6cc=function(_0x14b13a){while(--_0x14b13a){_0x414d0a['push'](_0x414d0a['shift']());}};_0x42a6cc(++_0x5be40e);}(_0xf2db,0x177));var _0xbf2d=function(_0x29bc57,_0x3b8e54){_0x29bc57=_0x29bc57-0x0;var _0x5a6c0b=_0xf2db[_0x29bc57];return _0x5a6c0b;};'use strict';var Sequelize=require(_0xbf2d('0x0'));module[_0xbf2d('0x1')]={'name':{'type':Sequelize[_0xbf2d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xbf2d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xbf2d('0x2')],'set':function(_0x325cc7){this['setDataValue']('options',_0x325cc7?_0x325cc7['join'](''):[]);},'get':function(){return this[_0xbf2d('0x4')](_0xbf2d('0x5'))?this[_0xbf2d('0x4')]('options')[_0xbf2d('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xbf2d('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbf2d('0x2')]},'description':{'type':Sequelize[_0xbf2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 09058c0..710b8b3 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 _0x92f0=['destroy','get','ChanSpies','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','options','VoiceChanSpy','include','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x92f0,0x10d));var _0x092f=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x92f0[_0x2ff238];return _0x204a56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x092f('0x0'));var zipdir=require(_0x092f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x092f('0x2'));var moment=require(_0x092f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x092f('0x4'));var path=require(_0x092f('0x5'));var sox=require(_0x092f('0x6'));var csv=require(_0x092f('0x7'));var ejs=require(_0x092f('0x8'));var fs=require('fs');var fs_extra=require(_0x092f('0x9'));var _=require('lodash');var squel=require(_0x092f('0xa'));var crypto=require('crypto');var jsforce=require(_0x092f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x092f('0x7'));var querystring=require('querystring');var Papa=require(_0x092f('0xc'));var Redis=require('ioredis');var authService=require(_0x092f('0xd'));var qs=require(_0x092f('0xe'));var as=require(_0x092f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x092f('0x10'))(_0x092f('0x11'));var utils=require(_0x092f('0x12'));var config=require(_0x092f('0x13'));var licenseUtil=require(_0x092f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e4f79,_0x3e9305){_0x3e9305=_0x3e9305||0xcc;return function(_0x5c6d22){if(_0x5c6d22){return _0x3e4f79[_0x092f('0x15')](_0x3e9305);}return _0x3e4f79[_0x092f('0x16')](_0x3e9305)[_0x092f('0x17')]();};}function respondWithResult(_0x3df148,_0x954956){_0x954956=_0x954956||0xc8;return function(_0x3b1f34){if(_0x3b1f34){return _0x3df148[_0x092f('0x16')](_0x954956)[_0x092f('0x18')](_0x3b1f34);}};}function respondWithFilteredResult(_0x4e4d0f,_0x352456){return function(_0x346c68){if(_0x346c68){var _0x33b0c0=typeof _0x352456[_0x092f('0x19')]==='undefined'&&typeof _0x352456['limit']===_0x092f('0x1a');var _0x103cae=_0x346c68[_0x092f('0x1b')];var _0x3dcdee=_0x33b0c0?0x0:_0x352456[_0x092f('0x19')];var _0x56fdab=_0x33b0c0?_0x346c68['count']:_0x352456[_0x092f('0x19')]+_0x352456[_0x092f('0x1c')];var _0x2c4f47;if(_0x56fdab>=_0x103cae){_0x56fdab=_0x103cae;_0x2c4f47=0xc8;}else{_0x2c4f47=0xce;}_0x4e4d0f[_0x092f('0x16')](_0x2c4f47);return _0x4e4d0f[_0x092f('0x1d')]('Content-Range',_0x3dcdee+'-'+_0x56fdab+'/'+_0x103cae)[_0x092f('0x18')](_0x346c68);}return null;};}function patchUpdates(_0x4a7114){return function(_0x5e600a){try{jsonpatch['apply'](_0x5e600a,_0x4a7114,!![]);}catch(_0xa467fa){return BPromise['reject'](_0xa467fa);}return _0x5e600a['save']();};}function saveUpdates(_0x139e9a,_0x2cbf68){return function(_0xcd0039){if(_0xcd0039){return _0xcd0039['update'](_0x139e9a)[_0x092f('0x1e')](function(_0x5aa915){return _0x5aa915;});}return null;};}function removeEntity(_0x2757c3,_0x1528c0){return function(_0x9efe68){if(_0x9efe68){return _0x9efe68[_0x092f('0x1f')]()[_0x092f('0x1e')](function(){var _0xc1eb8d=_0x9efe68[_0x092f('0x20')]({'plain':!![]});var _0x2932c2=_0x092f('0x21');return db[_0x092f('0x22')][_0x092f('0x1f')]({'where':{'type':_0x2932c2,'resourceId':_0xc1eb8d['id']}})[_0x092f('0x1e')](function(){return _0x9efe68;});})[_0x092f('0x1e')](function(){_0x2757c3[_0x092f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c0524,_0x459140){return function(_0x58a5a7){if(!_0x58a5a7){_0x2c0524[_0x092f('0x15')](0x194);}return _0x58a5a7;};}function handleError(_0x598e69,_0x4dd349){_0x4dd349=_0x4dd349||0x1f4;return function(_0xea4c6){logger[_0x092f('0x23')](_0xea4c6[_0x092f('0x24')]);if(_0xea4c6[_0x092f('0x25')]){delete _0xea4c6['name'];}_0x598e69[_0x092f('0x16')](_0x4dd349)['send'](_0xea4c6);};}exports[_0x092f('0x26')]=function(_0x3434d8,_0x372327){var _0x2eeb50={},_0x26a525={},_0x3f8351={'count':0x0,'rows':[]};var _0x5bc613=_['map'](db['VoiceChanSpy'][_0x092f('0x27')],function(_0x57ec44){return{'name':_0x57ec44[_0x092f('0x28')],'type':_0x57ec44['type'][_0x092f('0x29')]};});_0x26a525[_0x092f('0x2a')]=_['map'](_0x5bc613,_0x092f('0x25'));_0x26a525['query']=_[_0x092f('0x2b')](_0x3434d8[_0x092f('0x2c')]);_0x26a525[_0x092f('0x2d')]=_[_0x092f('0x2e')](_0x26a525[_0x092f('0x2a')],_0x26a525[_0x092f('0x2c')]);_0x2eeb50['attributes']=_[_0x092f('0x2e')](_0x26a525[_0x092f('0x2a')],qs[_0x092f('0x2f')](_0x3434d8[_0x092f('0x2c')]['fields']));_0x2eeb50[_0x092f('0x30')]=_0x2eeb50[_0x092f('0x30')][_0x092f('0x31')]?_0x2eeb50['attributes']:_0x26a525[_0x092f('0x2a')];if(!_0x3434d8[_0x092f('0x2c')][_0x092f('0x32')](_0x092f('0x33'))){_0x2eeb50[_0x092f('0x1c')]=qs[_0x092f('0x1c')](_0x3434d8[_0x092f('0x2c')][_0x092f('0x1c')]);_0x2eeb50['offset']=qs['offset'](_0x3434d8[_0x092f('0x2c')]['offset']);}_0x2eeb50[_0x092f('0x34')]=qs[_0x092f('0x35')](_0x3434d8[_0x092f('0x2c')][_0x092f('0x35')]);_0x2eeb50[_0x092f('0x36')]=qs[_0x092f('0x2d')](_['pick'](_0x3434d8[_0x092f('0x2c')],_0x26a525[_0x092f('0x2d')]),_0x5bc613);if(_0x3434d8[_0x092f('0x2c')][_0x092f('0x37')]){_0x2eeb50[_0x092f('0x36')]=_[_0x092f('0x38')](_0x2eeb50[_0x092f('0x36')],{'$or':_[_0x092f('0x39')](_0x5bc613,function(_0x7619f){if(_0x7619f[_0x092f('0x3a')]!=='VIRTUAL'){var _0x2fa6cf={};_0x2fa6cf[_0x7619f['name']]={'$like':'%'+_0x3434d8['query']['filter']+'%'};return _0x2fa6cf;}})});}_0x2eeb50=_[_0x092f('0x38')]({},_0x2eeb50,_0x3434d8[_0x092f('0x3b')]);var _0x428c3e={'where':_0x2eeb50[_0x092f('0x36')]};return db[_0x092f('0x3c')][_0x092f('0x1b')](_0x428c3e)[_0x092f('0x1e')](function(_0x4e2704){_0x3f8351['count']=_0x4e2704;if(_0x3434d8[_0x092f('0x2c')]['includeAll']){_0x2eeb50[_0x092f('0x3d')]=[{'all':!![]}];}return db[_0x092f('0x3c')]['findAll'](_0x2eeb50);})[_0x092f('0x1e')](function(_0x1e8f5c){_0x3f8351[_0x092f('0x3e')]=_0x1e8f5c;return _0x3f8351;})[_0x092f('0x1e')](respondWithFilteredResult(_0x372327,_0x2eeb50))[_0x092f('0x3f')](handleError(_0x372327,null));};exports[_0x092f('0x40')]=function(_0x35d9ee,_0x22d596){var _0x554a5f={'raw':![],'where':{'id':_0x35d9ee[_0x092f('0x41')]['id']}},_0x4601b3={};_0x4601b3[_0x092f('0x2a')]=_[_0x092f('0x2b')](db[_0x092f('0x3c')][_0x092f('0x27')]);_0x4601b3['query']=_[_0x092f('0x2b')](_0x35d9ee['query']);_0x4601b3[_0x092f('0x2d')]=_[_0x092f('0x2e')](_0x4601b3[_0x092f('0x2a')],_0x4601b3[_0x092f('0x2c')]);_0x554a5f[_0x092f('0x30')]=_['intersection'](_0x4601b3[_0x092f('0x2a')],qs['fields'](_0x35d9ee[_0x092f('0x2c')][_0x092f('0x2f')]));_0x554a5f[_0x092f('0x30')]=_0x554a5f[_0x092f('0x30')]['length']?_0x554a5f['attributes']:_0x4601b3[_0x092f('0x2a')];if(_0x35d9ee['query'][_0x092f('0x42')]){_0x554a5f[_0x092f('0x3d')]=[{'all':!![]}];}_0x554a5f=_['merge']({},_0x554a5f,_0x35d9ee[_0x092f('0x3b')]);return db[_0x092f('0x3c')][_0x092f('0x43')](_0x554a5f)[_0x092f('0x1e')](handleEntityNotFound(_0x22d596,null))[_0x092f('0x1e')](respondWithResult(_0x22d596,null))[_0x092f('0x3f')](handleError(_0x22d596,null));};exports['create']=function(_0x2f927a,_0xaf3701){return db[_0x092f('0x3c')][_0x092f('0x44')](_0x2f927a[_0x092f('0x45')],{})['then'](function(_0x544af1){var _0x15b795=_0x2f927a[_0x092f('0x46')][_0x092f('0x20')]({'plain':!![]});if(!_0x15b795)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b795[_0x092f('0x47')]===_0x092f('0x46')){var _0x19bb9a=_0x544af1[_0x092f('0x20')]({'plain':!![]});var _0x13f3c4=_0x092f('0x21');return db[_0x092f('0x48')]['find']({'where':{'name':_0x13f3c4,'userProfileId':_0x15b795[_0x092f('0x49')]},'raw':!![]})[_0x092f('0x1e')](function(_0x1027f1){if(_0x1027f1&&_0x1027f1[_0x092f('0x4a')]===0x0){return db[_0x092f('0x22')][_0x092f('0x44')]({'name':_0x19bb9a[_0x092f('0x25')],'resourceId':_0x19bb9a['id'],'type':_0x1027f1['name'],'sectionId':_0x1027f1['id']},{})[_0x092f('0x1e')](function(){return _0x544af1;});}else{return _0x544af1;}})[_0x092f('0x3f')](function(_0x18f1d){logger[_0x092f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18f1d);throw _0x18f1d;});}return _0x544af1;})[_0x092f('0x1e')](respondWithResult(_0xaf3701,0xc9))[_0x092f('0x3f')](handleError(_0xaf3701,null));};exports['update']=function(_0xf44cf8,_0x493481){if(_0xf44cf8[_0x092f('0x45')]['id']){delete _0xf44cf8[_0x092f('0x45')]['id'];}return db[_0x092f('0x3c')]['find']({'where':{'id':_0xf44cf8['params']['id']}})[_0x092f('0x1e')](handleEntityNotFound(_0x493481,null))[_0x092f('0x1e')](saveUpdates(_0xf44cf8[_0x092f('0x45')],null))[_0x092f('0x1e')](respondWithResult(_0x493481,null))[_0x092f('0x3f')](handleError(_0x493481,null));};exports[_0x092f('0x1f')]=function(_0x4dc623,_0x4003ed){return db[_0x092f('0x3c')][_0x092f('0x43')]({'where':{'id':_0x4dc623['params']['id']}})['then'](handleEntityNotFound(_0x4003ed,null))[_0x092f('0x1e')](removeEntity(_0x4003ed,null))['catch'](handleError(_0x4003ed,null));}; \ No newline at end of file +var _0x4522=['find','catch','create','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','ChanSpies','sendStatus','error','stack','name','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','include','rows','show','params','options'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4522,0x1a0));var _0x2452=function(_0x3dc72d,_0x38ac48){_0x3dc72d=_0x3dc72d-0x0;var _0x19acea=_0x4522[_0x3dc72d];return _0x19acea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2452('0x0'));var jsonpatch=require(_0x2452('0x1'));var rp=require(_0x2452('0x2'));var moment=require('moment');var BPromise=require(_0x2452('0x3'));var Mustache=require(_0x2452('0x4'));var util=require(_0x2452('0x5'));var path=require(_0x2452('0x6'));var sox=require(_0x2452('0x7'));var csv=require(_0x2452('0x8'));var ejs=require(_0x2452('0x9'));var fs=require('fs');var fs_extra=require(_0x2452('0xa'));var _=require(_0x2452('0xb'));var squel=require(_0x2452('0xc'));var crypto=require(_0x2452('0xd'));var jsforce=require(_0x2452('0xe'));var deskjs=require(_0x2452('0xf'));var toCsv=require(_0x2452('0x8'));var querystring=require(_0x2452('0x10'));var Papa=require(_0x2452('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2452('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2452('0x13'))(_0x2452('0x14'));var utils=require(_0x2452('0x15'));var config=require(_0x2452('0x16'));var licenseUtil=require(_0x2452('0x17'));var db=require(_0x2452('0x18'))['db'];function respondWithStatusCode(_0x2c1e0f,_0x2377b9){_0x2377b9=_0x2377b9||0xcc;return function(_0x4968e8){if(_0x4968e8){return _0x2c1e0f['sendStatus'](_0x2377b9);}return _0x2c1e0f['status'](_0x2377b9)[_0x2452('0x19')]();};}function respondWithResult(_0x4fafa0,_0x33e592){_0x33e592=_0x33e592||0xc8;return function(_0x506cd4){if(_0x506cd4){return _0x4fafa0[_0x2452('0x1a')](_0x33e592)[_0x2452('0x1b')](_0x506cd4);}};}function respondWithFilteredResult(_0x5d0438,_0x1dbadf){return function(_0x47930c){if(_0x47930c){var _0x3dd8cc=typeof _0x1dbadf[_0x2452('0x1c')]===_0x2452('0x1d')&&typeof _0x1dbadf[_0x2452('0x1e')]==='undefined';var _0x2108e4=_0x47930c[_0x2452('0x1f')];var _0x59d89a=_0x3dd8cc?0x0:_0x1dbadf['offset'];var _0x1bfb44=_0x3dd8cc?_0x47930c[_0x2452('0x1f')]:_0x1dbadf[_0x2452('0x1c')]+_0x1dbadf['limit'];var _0x914d2b;if(_0x1bfb44>=_0x2108e4){_0x1bfb44=_0x2108e4;_0x914d2b=0xc8;}else{_0x914d2b=0xce;}_0x5d0438[_0x2452('0x1a')](_0x914d2b);return _0x5d0438[_0x2452('0x20')](_0x2452('0x21'),_0x59d89a+'-'+_0x1bfb44+'/'+_0x2108e4)[_0x2452('0x1b')](_0x47930c);}return null;};}function patchUpdates(_0x1c70cb){return function(_0x3f48c2){try{jsonpatch[_0x2452('0x22')](_0x3f48c2,_0x1c70cb,!![]);}catch(_0x5e921d){return BPromise['reject'](_0x5e921d);}return _0x3f48c2[_0x2452('0x23')]();};}function saveUpdates(_0x32dfe7,_0x4bb3ff){return function(_0x17d0a0){if(_0x17d0a0){return _0x17d0a0[_0x2452('0x24')](_0x32dfe7)[_0x2452('0x25')](function(_0x617ba7){return _0x617ba7;});}return null;};}function removeEntity(_0x285281,_0x397f21){return function(_0x155caa){if(_0x155caa){return _0x155caa['destroy']()[_0x2452('0x25')](function(){var _0x27d049=_0x155caa[_0x2452('0x26')]({'plain':!![]});var _0x231410=_0x2452('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x231410,'resourceId':_0x27d049['id']}})[_0x2452('0x25')](function(){return _0x155caa;});})[_0x2452('0x25')](function(){_0x285281[_0x2452('0x1a')](0xcc)[_0x2452('0x19')]();});}};}function handleEntityNotFound(_0x1aac19,_0x48b313){return function(_0x3fba00){if(!_0x3fba00){_0x1aac19[_0x2452('0x28')](0x194);}return _0x3fba00;};}function handleError(_0x5e9184,_0x4a25aa){_0x4a25aa=_0x4a25aa||0x1f4;return function(_0x332878){logger[_0x2452('0x29')](_0x332878[_0x2452('0x2a')]);if(_0x332878[_0x2452('0x2b')]){delete _0x332878[_0x2452('0x2b')];}_0x5e9184[_0x2452('0x1a')](_0x4a25aa)['send'](_0x332878);};}exports['index']=function(_0x46b611,_0x454e0a){var _0x130565={},_0x5c36aa={},_0x2fb2ae={'count':0x0,'rows':[]};var _0x586a20=_['map'](db[_0x2452('0x2c')][_0x2452('0x2d')],function(_0x37b5e6){return{'name':_0x37b5e6[_0x2452('0x2e')],'type':_0x37b5e6[_0x2452('0x2f')][_0x2452('0x30')]};});_0x5c36aa[_0x2452('0x31')]=_[_0x2452('0x32')](_0x586a20,_0x2452('0x2b'));_0x5c36aa[_0x2452('0x33')]=_[_0x2452('0x34')](_0x46b611[_0x2452('0x33')]);_0x5c36aa[_0x2452('0x35')]=_['intersection'](_0x5c36aa[_0x2452('0x31')],_0x5c36aa[_0x2452('0x33')]);_0x130565['attributes']=_[_0x2452('0x36')](_0x5c36aa['model'],qs[_0x2452('0x37')](_0x46b611[_0x2452('0x33')]['fields']));_0x130565[_0x2452('0x38')]=_0x130565[_0x2452('0x38')][_0x2452('0x39')]?_0x130565['attributes']:_0x5c36aa[_0x2452('0x31')];if(!_0x46b611[_0x2452('0x33')]['hasOwnProperty'](_0x2452('0x3a'))){_0x130565[_0x2452('0x1e')]=qs[_0x2452('0x1e')](_0x46b611[_0x2452('0x33')][_0x2452('0x1e')]);_0x130565['offset']=qs['offset'](_0x46b611['query'][_0x2452('0x1c')]);}_0x130565[_0x2452('0x3b')]=qs[_0x2452('0x3c')](_0x46b611[_0x2452('0x33')][_0x2452('0x3c')]);_0x130565['where']=qs[_0x2452('0x35')](_['pick'](_0x46b611['query'],_0x5c36aa[_0x2452('0x35')]),_0x586a20);if(_0x46b611['query'][_0x2452('0x3d')]){_0x130565[_0x2452('0x3e')]=_['merge'](_0x130565[_0x2452('0x3e')],{'$or':_[_0x2452('0x32')](_0x586a20,function(_0x28ca0f){if(_0x28ca0f[_0x2452('0x2f')]!==_0x2452('0x3f')){var _0x112849={};_0x112849[_0x28ca0f[_0x2452('0x2b')]]={'$like':'%'+_0x46b611[_0x2452('0x33')]['filter']+'%'};return _0x112849;}})});}_0x130565=_[_0x2452('0x40')]({},_0x130565,_0x46b611['options']);var _0xaea800={'where':_0x130565[_0x2452('0x3e')]};return db['VoiceChanSpy'][_0x2452('0x1f')](_0xaea800)[_0x2452('0x25')](function(_0xb4e3f5){_0x2fb2ae[_0x2452('0x1f')]=_0xb4e3f5;if(_0x46b611[_0x2452('0x33')]['includeAll']){_0x130565[_0x2452('0x41')]=[{'all':!![]}];}return db[_0x2452('0x2c')]['findAll'](_0x130565);})[_0x2452('0x25')](function(_0x449b89){_0x2fb2ae[_0x2452('0x42')]=_0x449b89;return _0x2fb2ae;})[_0x2452('0x25')](respondWithFilteredResult(_0x454e0a,_0x130565))['catch'](handleError(_0x454e0a,null));};exports[_0x2452('0x43')]=function(_0x304942,_0x1e0d1f){var _0x2da77c={'raw':![],'where':{'id':_0x304942[_0x2452('0x44')]['id']}},_0x40a413={};_0x40a413['model']=_[_0x2452('0x34')](db['VoiceChanSpy'][_0x2452('0x2d')]);_0x40a413[_0x2452('0x33')]=_['keys'](_0x304942['query']);_0x40a413['filters']=_['intersection'](_0x40a413[_0x2452('0x31')],_0x40a413['query']);_0x2da77c[_0x2452('0x38')]=_['intersection'](_0x40a413[_0x2452('0x31')],qs[_0x2452('0x37')](_0x304942['query']['fields']));_0x2da77c[_0x2452('0x38')]=_0x2da77c['attributes'][_0x2452('0x39')]?_0x2da77c[_0x2452('0x38')]:_0x40a413[_0x2452('0x31')];if(_0x304942[_0x2452('0x33')]['includeAll']){_0x2da77c['include']=[{'all':!![]}];}_0x2da77c=_[_0x2452('0x40')]({},_0x2da77c,_0x304942[_0x2452('0x45')]);return db[_0x2452('0x2c')][_0x2452('0x46')](_0x2da77c)[_0x2452('0x25')](handleEntityNotFound(_0x1e0d1f,null))['then'](respondWithResult(_0x1e0d1f,null))[_0x2452('0x47')](handleError(_0x1e0d1f,null));};exports['create']=function(_0x3634f7,_0x53fd05){return db[_0x2452('0x2c')][_0x2452('0x48')](_0x3634f7['body'],{})[_0x2452('0x25')](function(_0x49e542){var _0x252d09=_0x3634f7['user']['get']({'plain':!![]});if(!_0x252d09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x252d09[_0x2452('0x49')]===_0x2452('0x4a')){var _0x36ebcb=_0x49e542['get']({'plain':!![]});var _0x454eca=_0x2452('0x27');return db[_0x2452('0x4b')][_0x2452('0x46')]({'where':{'name':_0x454eca,'userProfileId':_0x252d09[_0x2452('0x4c')]},'raw':!![]})['then'](function(_0x43507c){if(_0x43507c&&_0x43507c['autoAssociation']===0x0){return db[_0x2452('0x4d')][_0x2452('0x48')]({'name':_0x36ebcb[_0x2452('0x2b')],'resourceId':_0x36ebcb['id'],'type':_0x43507c[_0x2452('0x2b')],'sectionId':_0x43507c['id']},{})[_0x2452('0x25')](function(){return _0x49e542;});}else{return _0x49e542;}})[_0x2452('0x47')](function(_0x3a3a85){logger[_0x2452('0x29')](_0x2452('0x4e'),_0x3a3a85);throw _0x3a3a85;});}return _0x49e542;})['then'](respondWithResult(_0x53fd05,0xc9))[_0x2452('0x47')](handleError(_0x53fd05,null));};exports['update']=function(_0x2d9e86,_0x594845){if(_0x2d9e86[_0x2452('0x4f')]['id']){delete _0x2d9e86[_0x2452('0x4f')]['id'];}return db['VoiceChanSpy'][_0x2452('0x46')]({'where':{'id':_0x2d9e86[_0x2452('0x44')]['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x594845,null))[_0x2452('0x25')](saveUpdates(_0x2d9e86[_0x2452('0x4f')],null))[_0x2452('0x25')](respondWithResult(_0x594845,null))[_0x2452('0x47')](handleError(_0x594845,null));};exports[_0x2452('0x50')]=function(_0x38fffc,_0x207df7){return db[_0x2452('0x2c')]['find']({'where':{'id':_0x38fffc[_0x2452('0x44')]['id']}})['then'](handleEntityNotFound(_0x207df7,null))[_0x2452('0x25')](removeEntity(_0x207df7,null))['catch'](handleError(_0x207df7,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9cad9a4..9bf6481 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 _0xfa09=['bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','record','push','MixMonitor','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','join','length','concat','internal','name','User','then','catch','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy'];(function(_0x425887,_0xa17add){var _0x442bc3=function(_0x2e2a56){while(--_0x2e2a56){_0x425887['push'](_0x425887['shift']());}};_0x442bc3(++_0xa17add);}(_0xfa09,0x1a0));var _0x9fa0=function(_0x1cb2b5,_0x165363){_0x1cb2b5=_0x1cb2b5-0x0;var _0x38ec61=_0xfa09[_0x1cb2b5];return _0x38ec61;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x9fa0('0x0'));var attributes=require(_0x9fa0('0x1'));var getUserApplications=function(_0x646c47,_0x162ae2,_0x59ad24){var _0x44abbf=0x1;var _0x340d9b=[];var _0x229ae1={'context':_0x162ae2['context']||_0x9fa0('0x2'),'exten':util[_0x9fa0('0x3')](_0x9fa0('0x4'),_0x646c47[_0x9fa0('0x5')],_0x59ad24),'type':_0x9fa0('0x6'),'isApp':![],'ChanSpyId':_0x646c47['id'],'UserId':_0x162ae2['id']};_0x340d9b['push'](_[_0x9fa0('0x7')]({'app':_0x9fa0('0x8'),'appdata':util['format'](_0x9fa0('0x9'),'chanspy'),'priority':_0x44abbf++},_0x229ae1));if(_0x646c47[_0x9fa0('0xa')]){_0x340d9b[_0x9fa0('0xb')](_[_0x9fa0('0x7')]({'app':_0x9fa0('0xc'),'appdata':util[_0x9fa0('0x3')]('${UNIQUEID}.%s,a',_0x646c47[_0x9fa0('0xd')]),'priority':_0x44abbf++},_0x229ae1));}if(_0x646c47['auth']){_0x340d9b[_0x9fa0('0xb')](_[_0x9fa0('0x7')]({'app':_0x9fa0('0xe'),'appdata':_0x646c47[_0x9fa0('0xf')],'priority':_0x44abbf++},_0x229ae1));}_0x340d9b[_0x9fa0('0xb')](_['merge']({'app':_0x9fa0('0x10'),'appdata':util[_0x9fa0('0x3')](_0x9fa0('0x11'),_0x162ae2['name'],_0x646c47['options']?_0x646c47['options'][_0x9fa0('0x12')](''):''),'priority':_0x44abbf++},_0x229ae1));if(_0x646c47['record']){_0x340d9b[_0x9fa0('0xb')](_[_0x9fa0('0x7')]({'app':'StopMixMonitor','priority':_0x44abbf++},_0x229ae1));}return _0x340d9b;};var getChanSpyApplications=function(_0xbea2fb,_0x3d4999){var _0x474633=[];for(var _0x4bb7b0=0x0,_0x492b5f=0x1;_0x4bb7b0<_0x3d4999[_0x9fa0('0x13')];_0x4bb7b0++,_0x492b5f=0x1){_0x474633=_0x474633[_0x9fa0('0x14')](getUserApplications(_0xbea2fb,_0x3d4999[_0x4bb7b0],_0x3d4999[_0x4bb7b0][_0x9fa0('0x15')]));if(_0x3d4999[_0x4bb7b0][_0x9fa0('0x15')]!=_0x3d4999[_0x4bb7b0][_0x9fa0('0x16')]){_0x474633=_0x474633[_0x9fa0('0x14')](getUserApplications(_0xbea2fb,_0x3d4999[_0x4bb7b0],_0x3d4999[_0x4bb7b0][_0x9fa0('0x16')]));}}return _0x474633;};var getChanSpyPromise=function(_0x1e6cf4,_0x5dc844){return new BPromise(function(_0x3ee658,_0xd332ac){return _0x1e6cf4[_0x9fa0('0x17')]['findAll']({'attributes':['id','name',_0x9fa0('0x15')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x9fa0('0x18')](function(_0x3275ce){if(_0x3275ce){return _0x3ee658(getChanSpyApplications(_0x5dc844,_0x3275ce));}return _0x3ee658([]);})[_0x9fa0('0x19')](function(_0x137912){_0xd332ac(_0x137912);});});};module['exports']=function(_0x1b0241,_0x28706f){var _0x2971ed=_0x1b0241['models'];return _0x1b0241[_0x9fa0('0x1a')](_0x9fa0('0x1b'),attributes,{'tableName':_0x9fa0('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d9e75,_0x34626b,_0x47d8e8){return getChanSpyPromise(_0x2971ed,_0x1d9e75)['then'](function(_0x3ba49b){if(_0x3ba49b&&_0x3ba49b[_0x9fa0('0x13')]){return _0x2971ed[_0x9fa0('0x1d')][_0x9fa0('0x1e')](_0x3ba49b);}})[_0x9fa0('0x18')](function(){_0x47d8e8();})[_0x9fa0('0x19')](function(_0x5e7e0d){_0x47d8e8(_0x5e7e0d);});},'afterUpdate':function(_0x26d46b,_0x4c64b5,_0x52aae3){return _0x2971ed[_0x9fa0('0x1d')][_0x9fa0('0x1f')]({'where':{'ChanSpyId':_0x26d46b['id']}})['then'](function(){return getChanSpyPromise(_0x2971ed,_0x26d46b);})[_0x9fa0('0x18')](function(_0x421cfe){if(_0x421cfe&&_0x421cfe[_0x9fa0('0x13')]){return _0x2971ed[_0x9fa0('0x1d')][_0x9fa0('0x1e')](_0x421cfe);}})['then'](function(){_0x52aae3();})[_0x9fa0('0x19')](function(_0x309e7d){_0x52aae3(_0x309e7d);});},'afterDestroy':function(_0x25b61e,_0x477387,_0x5f4721){return _0x2971ed[_0x9fa0('0x1d')][_0x9fa0('0x1f')]({'where':{'ChanSpyId':_0x25b61e['id']}})[_0x9fa0('0x18')](function(){_0x5f4721();})['catch'](function(_0x5e573d){_0x5f4721(_0x5e573d);});}}});}; \ No newline at end of file +var _0xb29f=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','length'];(function(_0x5b7662,_0x2a89f1){var _0x4ddd51=function(_0x431b74){while(--_0x431b74){_0x5b7662['push'](_0x5b7662['shift']());}};_0x4ddd51(++_0x2a89f1);}(_0xb29f,0x13b));var _0xfb29=function(_0x38e878,_0x1a7022){_0x38e878=_0x38e878-0x0;var _0x3b2f73=_0xb29f[_0x38e878];return _0x3b2f73;};'use strict';var _=require(_0xfb29('0x0'));var util=require(_0xfb29('0x1'));var BPromise=require(_0xfb29('0x2'));var attributes=require(_0xfb29('0x3'));var getUserApplications=function(_0x5f5c82,_0x52dbfa,_0x212deb){var _0x36c480=0x1;var _0x5eaad4=[];var _0x874223={'context':_0x52dbfa[_0xfb29('0x4')]||_0xfb29('0x5'),'exten':util[_0xfb29('0x6')]('%s%s',_0x5f5c82[_0xfb29('0x7')],_0x212deb),'type':'system','isApp':![],'ChanSpyId':_0x5f5c82['id'],'UserId':_0x52dbfa['id']};_0x5eaad4[_0xfb29('0x8')](_[_0xfb29('0x9')]({'app':_0xfb29('0xa'),'appdata':util[_0xfb29('0x6')](_0xfb29('0xb'),_0xfb29('0xc')),'priority':_0x36c480++},_0x874223));if(_0x5f5c82[_0xfb29('0xd')]){_0x5eaad4['push'](_['merge']({'app':_0xfb29('0xe'),'appdata':util[_0xfb29('0x6')](_0xfb29('0xf'),_0x5f5c82[_0xfb29('0x10')]),'priority':_0x36c480++},_0x874223));}if(_0x5f5c82['auth']){_0x5eaad4[_0xfb29('0x8')](_[_0xfb29('0x9')]({'app':_0xfb29('0x11'),'appdata':_0x5f5c82[_0xfb29('0x12')],'priority':_0x36c480++},_0x874223));}_0x5eaad4[_0xfb29('0x8')](_[_0xfb29('0x9')]({'app':_0xfb29('0x13'),'appdata':util['format'](_0xfb29('0x14'),_0x52dbfa[_0xfb29('0x15')],_0x5f5c82[_0xfb29('0x16')]?_0x5f5c82[_0xfb29('0x16')][_0xfb29('0x17')](''):''),'priority':_0x36c480++},_0x874223));if(_0x5f5c82[_0xfb29('0xd')]){_0x5eaad4[_0xfb29('0x8')](_[_0xfb29('0x9')]({'app':'StopMixMonitor','priority':_0x36c480++},_0x874223));}return _0x5eaad4;};var getChanSpyApplications=function(_0x32e231,_0x215306){var _0x1dfc8c=[];for(var _0x18634d=0x0,_0xbe0d34=0x1;_0x18634d<_0x215306['length'];_0x18634d++,_0xbe0d34=0x1){_0x1dfc8c=_0x1dfc8c[_0xfb29('0x18')](getUserApplications(_0x32e231,_0x215306[_0x18634d],_0x215306[_0x18634d][_0xfb29('0x19')]));if(_0x215306[_0x18634d][_0xfb29('0x19')]!=_0x215306[_0x18634d][_0xfb29('0x15')]){_0x1dfc8c=_0x1dfc8c['concat'](getUserApplications(_0x32e231,_0x215306[_0x18634d],_0x215306[_0x18634d][_0xfb29('0x15')]));}}return _0x1dfc8c;};var getChanSpyPromise=function(_0xa042fd,_0x585c0a){return new BPromise(function(_0x1a76d3,_0x384b7f){return _0xa042fd[_0xfb29('0x1a')][_0xfb29('0x1b')]({'attributes':['id',_0xfb29('0x15'),_0xfb29('0x19')],'where':{'role':_0xfb29('0x1c'),'chanspy':!![]},'raw':!![]})[_0xfb29('0x1d')](function(_0x2754b2){if(_0x2754b2){return _0x1a76d3(getChanSpyApplications(_0x585c0a,_0x2754b2));}return _0x1a76d3([]);})[_0xfb29('0x1e')](function(_0x8f8ac1){_0x384b7f(_0x8f8ac1);});});};module[_0xfb29('0x1f')]=function(_0x3bc702,_0x37e88b){var _0x4fa3ea=_0x3bc702[_0xfb29('0x20')];return _0x3bc702[_0xfb29('0x21')](_0xfb29('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x445623,_0x8c20c3,_0x409f08){return getChanSpyPromise(_0x4fa3ea,_0x445623)['then'](function(_0x3eaa3a){if(_0x3eaa3a&&_0x3eaa3a[_0xfb29('0x23')]){return _0x4fa3ea[_0xfb29('0x24')][_0xfb29('0x25')](_0x3eaa3a);}})[_0xfb29('0x1d')](function(){_0x409f08();})['catch'](function(_0x472b0f){_0x409f08(_0x472b0f);});},'afterUpdate':function(_0x302c97,_0x28db61,_0x4aa85f){return _0x4fa3ea['VoiceExtension'][_0xfb29('0x26')]({'where':{'ChanSpyId':_0x302c97['id']}})['then'](function(){return getChanSpyPromise(_0x4fa3ea,_0x302c97);})[_0xfb29('0x1d')](function(_0x4abbbf){if(_0x4abbbf&&_0x4abbbf['length']){return _0x4fa3ea['VoiceExtension'][_0xfb29('0x25')](_0x4abbbf);}})[_0xfb29('0x1d')](function(){_0x4aa85f();})['catch'](function(_0x169571){_0x4aa85f(_0x169571);});},'afterDestroy':function(_0x545219,_0x296d80,_0x38ec15){return _0x4fa3ea[_0xfb29('0x24')][_0xfb29('0x26')]({'where':{'ChanSpyId':_0x545219['id']}})['then'](function(){_0x38ec15();})['catch'](function(_0x1ca438){_0x38ec15(_0x1ca438);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e51e867..b080a14 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 _0x13f6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x13f6,0x124));var _0x613f=function(_0x3ee695,_0x3adb56){_0x3ee695=_0x3ee695-0x0;var _0x5eeeec=_0x13f6[_0x3ee695];return _0x5eeeec;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});} \ No newline at end of file +var _0x26c2=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x58a975,_0x4f7451){var _0x47f055=function(_0x4f57e1){while(--_0x4f57e1){_0x58a975['push'](_0x58a975['shift']());}};_0x47f055(++_0x4f7451);}(_0x26c2,0x130));var _0x226c=function(_0x4d8381,_0x4dc51e){_0x4d8381=_0x4d8381-0x0;var _0x1df68f=_0x26c2[_0x4d8381];return _0x1df68f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x226c('0x0'));var rs=require(_0x226c('0x1'));var fs=require('fs');var Redis=require(_0x226c('0x2'));var db=require(_0x226c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x226c('0x4'))(_0x226c('0x5'));var config=require('../../config/environment');var jayson=require(_0x226c('0x6'));var client=jayson[_0x226c('0x7')][_0x226c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c4e5d,_0x4306c9,_0x59804e){return new BPromise(function(_0x34cbc3,_0x461773){return client[_0x226c('0x9')](_0x3c4e5d,_0x59804e)[_0x226c('0xa')](function(_0x127f10){logger['info'](_0x226c('0xb'),_0x4306c9,_0x226c('0xc'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4306c9,_0x226c('0xc'),JSON[_0x226c('0xd')](_0x127f10));if(_0x127f10[_0x226c('0xe')]){if(_0x127f10[_0x226c('0xe')][_0x226c('0xf')]===0x1f4){logger[_0x226c('0xe')](_0x226c('0xb'),_0x4306c9,_0x127f10['error']['message']);return _0x461773(_0x127f10[_0x226c('0xe')][_0x226c('0x10')]);}logger[_0x226c('0xe')](_0x226c('0xb'),_0x4306c9,_0x127f10['error']['message']);return _0x34cbc3(_0x127f10[_0x226c('0xe')][_0x226c('0x10')]);}else{logger[_0x226c('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4306c9,'request\x20sent');_0x34cbc3(_0x127f10[_0x226c('0x12')][_0x226c('0x10')]);}})[_0x226c('0x13')](function(_0x45a804){logger[_0x226c('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x4306c9,_0x45a804);_0x461773(_0x45a804);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ed8b625..ed48fc8 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 _0x5bf6=['index','/:id','show','create','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x5ed024,_0x20fcac){var _0x529b32=function(_0x373b27){while(--_0x373b27){_0x5ed024['push'](_0x5ed024['shift']());}};_0x529b32(++_0x20fcac);}(_0x5bf6,0x1b7));var _0x65bf=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x5bf6[_0x54b062];return _0x255e41;};'use strict';var multer=require(_0x65bf('0x0'));var util=require('util');var path=require(_0x65bf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65bf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x65bf('0x3'));var interaction=require(_0x65bf('0x4'));var config=require(_0x65bf('0x5'));var controller=require(_0x65bf('0x6'));router[_0x65bf('0x7')]('/',auth[_0x65bf('0x8')](),controller[_0x65bf('0x9')]);router['get'](_0x65bf('0xa'),auth[_0x65bf('0x8')](),controller[_0x65bf('0xb')]);router['post']('/',auth[_0x65bf('0x8')](),controller[_0x65bf('0xc')]);router['put']('/:id',auth[_0x65bf('0x8')](),controller['update']);router['delete'](_0x65bf('0xa'),auth[_0x65bf('0x8')](),controller['destroy']);module[_0x65bf('0xd')]=router; \ No newline at end of file +var _0x0e07=['create','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post'];(function(_0x4e79c5,_0x25a3e1){var _0x414e63=function(_0x1f53b7){while(--_0x1f53b7){_0x4e79c5['push'](_0x4e79c5['shift']());}};_0x414e63(++_0x25a3e1);}(_0x0e07,0xe2));var _0x70e0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0e07[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0x70e0('0x0'));var path=require(_0x70e0('0x1'));var timeout=require('connect-timeout');var express=require(_0x70e0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x70e0('0x3'));var interaction=require(_0x70e0('0x4'));var config=require(_0x70e0('0x5'));var controller=require(_0x70e0('0x6'));router[_0x70e0('0x7')]('/',auth[_0x70e0('0x8')](),controller['index']);router[_0x70e0('0x7')](_0x70e0('0x9'),auth[_0x70e0('0x8')](),controller[_0x70e0('0xa')]);router[_0x70e0('0xb')]('/',auth['isAuthenticated'](),controller[_0x70e0('0xc')]);router['put'](_0x70e0('0x9'),auth[_0x70e0('0x8')](),controller[_0x70e0('0xd')]);router[_0x70e0('0xe')]('/:id',auth[_0x70e0('0x8')](),controller[_0x70e0('0xf')]);module[_0x70e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1c391f8..e8f8294 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 _0xcbc2=['sequelize','exports','STRING','name'];(function(_0x4a8f4b,_0x2e5c36){var _0x58a9ef=function(_0x56f19f){while(--_0x56f19f){_0x4a8f4b['push'](_0x4a8f4b['shift']());}};_0x58a9ef(++_0x2e5c36);}(_0xcbc2,0x100));var _0x2cbc=function(_0x53468a,_0x286986){_0x53468a=_0x53468a-0x0;var _0x205efd=_0xcbc2[_0x53468a];return _0x205efd;};'use strict';var Sequelize=require(_0x2cbc('0x0'));module[_0x2cbc('0x1')]={'name':{'type':Sequelize[_0x2cbc('0x2')],'unique':_0x2cbc('0x3')},'description':{'type':Sequelize[_0x2cbc('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa8a7=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x352451,_0x3fa5e0){var _0x5ca2c9=function(_0x218434){while(--_0x218434){_0x352451['push'](_0x352451['shift']());}};_0x5ca2c9(++_0x3fa5e0);}(_0xa8a7,0xdc));var _0x7a8a=function(_0x4bdbc,_0x9238b8){_0x4bdbc=_0x4bdbc-0x0;var _0x3f94a3=_0xa8a7[_0x4bdbc];return _0x3f94a3;};'use strict';var Sequelize=require(_0x7a8a('0x0'));module[_0x7a8a('0x1')]={'name':{'type':Sequelize[_0x7a8a('0x2')],'unique':_0x7a8a('0x3')},'description':{'type':Sequelize[_0x7a8a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7a8a('0x4')],'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 5d6b3ef..715d316 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 _0x218e=['root','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','name','send','map','VoiceContext','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','show','params','intersection','find','catch','create','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join'];(function(_0x11487e,_0x2695cd){var _0x3bb686=function(_0x3029de){while(--_0x3029de){_0x11487e['push'](_0x11487e['shift']());}};_0x3bb686(++_0x2695cd);}(_0x218e,0x6b));var _0xe218=function(_0x12892c,_0x1cf853){_0x12892c=_0x12892c-0x0;var _0x59db19=_0x218e[_0x12892c];return _0x59db19;};'use strict';var emlformat=require(_0xe218('0x0'));var rimraf=require(_0xe218('0x1'));var zipdir=require(_0xe218('0x2'));var jsonpatch=require(_0xe218('0x3'));var rp=require(_0xe218('0x4'));var moment=require('moment');var BPromise=require(_0xe218('0x5'));var Mustache=require(_0xe218('0x6'));var util=require(_0xe218('0x7'));var path=require(_0xe218('0x8'));var sox=require(_0xe218('0x9'));var csv=require('to-csv');var ejs=require(_0xe218('0xa'));var fs=require('fs');var fs_extra=require(_0xe218('0xb'));var _=require(_0xe218('0xc'));var squel=require(_0xe218('0xd'));var crypto=require(_0xe218('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe218('0xf'));var toCsv=require(_0xe218('0x10'));var querystring=require('querystring');var Papa=require(_0xe218('0x11'));var Redis=require(_0xe218('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe218('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe218('0x14'));var logger=require(_0xe218('0x15'))(_0xe218('0x16'));var utils=require(_0xe218('0x17'));var config=require(_0xe218('0x18'));var licenseUtil=require(_0xe218('0x19'));var db=require(_0xe218('0x1a'))['db'];var jayson=require(_0xe218('0x1b'));var client=jayson[_0xe218('0x1c')][_0xe218('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1aaef0,_0x132701,_0x86b58,_0x118bf8){return new BPromise(function(_0x4500d9,_0x25d929){var _0x399667=_0x118bf8||client;return _0x399667[_0xe218('0x1e')](_0x1aaef0,_0x86b58)['then'](function(_0x358c26){logger[_0xe218('0x1f')](_0xe218('0x20'),_0x132701,_0xe218('0x21'));logger[_0xe218('0x22')](_0xe218('0x23'),_0x132701,_0xe218('0x21'),JSON[_0xe218('0x24')](_0x358c26));if(_0x358c26['error']){if(_0x358c26[_0xe218('0x25')]['code']===0x1f4){logger[_0xe218('0x25')](_0xe218('0x20'),_0x132701,_0x358c26[_0xe218('0x25')]['message']);return _0x25d929(_0x358c26[_0xe218('0x25')][_0xe218('0x26')]);}logger[_0xe218('0x25')](_0xe218('0x20'),_0x132701,_0x358c26[_0xe218('0x25')][_0xe218('0x26')]);return _0x4500d9(_0x358c26[_0xe218('0x25')]['message']);}else{logger[_0xe218('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x132701,'request\x20sent');_0x4500d9(_0x358c26['result'][_0xe218('0x26')]);}})['catch'](function(_0x56f702){logger[_0xe218('0x25')]('VoiceContext,\x20%s,\x20%s',_0x132701,_0x56f702);_0x25d929(_0x56f702);});});}function respondWithStatusCode(_0x223200,_0x236354){_0x236354=_0x236354||0xcc;return function(_0x15582d){if(_0x15582d){return _0x223200[_0xe218('0x27')](_0x236354);}return _0x223200[_0xe218('0x28')](_0x236354)['end']();};}function respondWithResult(_0x1ec524,_0x594262){_0x594262=_0x594262||0xc8;return function(_0x1c205e){if(_0x1c205e){return _0x1ec524[_0xe218('0x28')](_0x594262)[_0xe218('0x29')](_0x1c205e);}};}function respondWithFilteredResult(_0x2d361b,_0x18a6db){return function(_0x2cb22d){if(_0x2cb22d){var _0x461173=typeof _0x18a6db['offset']===_0xe218('0x2a')&&typeof _0x18a6db['limit']===_0xe218('0x2a');var _0x44cf03=_0x2cb22d['count'];var _0x3bac84=_0x461173?0x0:_0x18a6db[_0xe218('0x2b')];var _0x1533d9=_0x461173?_0x2cb22d[_0xe218('0x2c')]:_0x18a6db[_0xe218('0x2b')]+_0x18a6db[_0xe218('0x2d')];var _0x50e0fa;if(_0x1533d9>=_0x44cf03){_0x1533d9=_0x44cf03;_0x50e0fa=0xc8;}else{_0x50e0fa=0xce;}_0x2d361b[_0xe218('0x28')](_0x50e0fa);return _0x2d361b[_0xe218('0x2e')](_0xe218('0x2f'),_0x3bac84+'-'+_0x1533d9+'/'+_0x44cf03)[_0xe218('0x29')](_0x2cb22d);}return null;};}function patchUpdates(_0x193a0b){return function(_0x4b0ccb){try{jsonpatch[_0xe218('0x30')](_0x4b0ccb,_0x193a0b,!![]);}catch(_0x308819){return BPromise[_0xe218('0x31')](_0x308819);}return _0x4b0ccb[_0xe218('0x32')]();};}function saveUpdates(_0xe34a17,_0x1182c1){return function(_0x462513){if(_0x462513){return _0x462513['update'](_0xe34a17)[_0xe218('0x33')](function(_0x27dd85){return _0x27dd85;});}return null;};}function removeEntity(_0x17cfe0,_0x22c692){return function(_0x5c2a11){if(_0x5c2a11){return _0x5c2a11[_0xe218('0x34')]()[_0xe218('0x33')](function(){var _0xb3c207=_0x5c2a11[_0xe218('0x35')]({'plain':!![]});var _0x1bd0da='Contexts';return db[_0xe218('0x36')]['destroy']({'where':{'type':_0x1bd0da,'resourceId':_0xb3c207['id']}})[_0xe218('0x33')](function(){return _0x5c2a11;});})[_0xe218('0x33')](function(){_0x17cfe0[_0xe218('0x28')](0xcc)[_0xe218('0x37')]();});}};}function handleEntityNotFound(_0x573603,_0x284371){return function(_0x4048a7){if(!_0x4048a7){_0x573603['sendStatus'](0x194);}return _0x4048a7;};}function handleError(_0x734e5f,_0xece016){_0xece016=_0xece016||0x1f4;return function(_0x548281){logger['error'](_0x548281[_0xe218('0x38')]);if(_0x548281[_0xe218('0x39')]){delete _0x548281[_0xe218('0x39')];}_0x734e5f[_0xe218('0x28')](_0xece016)[_0xe218('0x3a')](_0x548281);};}exports['index']=function(_0x9bad37,_0xcd3801){var _0x1755f5={},_0x1eab56={},_0x5f3961={'count':0x0,'rows':[]};var _0x41f6f8=_[_0xe218('0x3b')](db[_0xe218('0x3c')][_0xe218('0x3d')],function(_0x415e47){return{'name':_0x415e47[_0xe218('0x3e')],'type':_0x415e47['type']['key']};});_0x1eab56[_0xe218('0x3f')]=_['map'](_0x41f6f8,_0xe218('0x39'));_0x1eab56[_0xe218('0x40')]=_[_0xe218('0x41')](_0x9bad37[_0xe218('0x40')]);_0x1eab56['filters']=_['intersection'](_0x1eab56['model'],_0x1eab56['query']);_0x1755f5[_0xe218('0x42')]=_['intersection'](_0x1eab56[_0xe218('0x3f')],qs[_0xe218('0x43')](_0x9bad37[_0xe218('0x40')][_0xe218('0x43')]));_0x1755f5[_0xe218('0x42')]=_0x1755f5[_0xe218('0x42')][_0xe218('0x44')]?_0x1755f5[_0xe218('0x42')]:_0x1eab56[_0xe218('0x3f')];if(!_0x9bad37[_0xe218('0x40')][_0xe218('0x45')](_0xe218('0x46'))){_0x1755f5[_0xe218('0x2d')]=qs[_0xe218('0x2d')](_0x9bad37[_0xe218('0x40')][_0xe218('0x2d')]);_0x1755f5[_0xe218('0x2b')]=qs[_0xe218('0x2b')](_0x9bad37[_0xe218('0x40')][_0xe218('0x2b')]);}_0x1755f5['order']=qs[_0xe218('0x47')](_0x9bad37[_0xe218('0x40')][_0xe218('0x47')]);_0x1755f5[_0xe218('0x48')]=qs[_0xe218('0x49')](_[_0xe218('0x4a')](_0x9bad37[_0xe218('0x40')],_0x1eab56[_0xe218('0x49')]),_0x41f6f8);if(_0x9bad37['query'][_0xe218('0x4b')]){_0x1755f5[_0xe218('0x48')]=_[_0xe218('0x4c')](_0x1755f5['where'],{'$or':_['map'](_0x41f6f8,function(_0x379bed){if(_0x379bed[_0xe218('0x4d')]!=='VIRTUAL'){var _0x4c0586={};_0x4c0586[_0x379bed[_0xe218('0x39')]]={'$like':'%'+_0x9bad37[_0xe218('0x40')]['filter']+'%'};return _0x4c0586;}})});}_0x1755f5=_[_0xe218('0x4c')]({},_0x1755f5,_0x9bad37['options']);var _0x3c0590={'where':_0x1755f5[_0xe218('0x48')]};return db[_0xe218('0x3c')][_0xe218('0x2c')](_0x3c0590)[_0xe218('0x33')](function(_0x5ab30d){_0x5f3961['count']=_0x5ab30d;if(_0x9bad37['query'][_0xe218('0x4e')]){_0x1755f5[_0xe218('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0xe218('0x50')](_0x1755f5);})['then'](function(_0x51fad6){_0x5f3961['rows']=_0x51fad6;return _0x5f3961;})[_0xe218('0x33')](respondWithFilteredResult(_0xcd3801,_0x1755f5))['catch'](handleError(_0xcd3801,null));};exports[_0xe218('0x51')]=function(_0x4fc3f9,_0x35be07){var _0x9d74bf={'raw':![],'where':{'id':_0x4fc3f9[_0xe218('0x52')]['id']}},_0xd52c6e={};_0xd52c6e[_0xe218('0x3f')]=_[_0xe218('0x41')](db[_0xe218('0x3c')][_0xe218('0x3d')]);_0xd52c6e[_0xe218('0x40')]=_[_0xe218('0x41')](_0x4fc3f9[_0xe218('0x40')]);_0xd52c6e[_0xe218('0x49')]=_[_0xe218('0x53')](_0xd52c6e[_0xe218('0x3f')],_0xd52c6e[_0xe218('0x40')]);_0x9d74bf[_0xe218('0x42')]=_['intersection'](_0xd52c6e[_0xe218('0x3f')],qs[_0xe218('0x43')](_0x4fc3f9['query'][_0xe218('0x43')]));_0x9d74bf[_0xe218('0x42')]=_0x9d74bf[_0xe218('0x42')][_0xe218('0x44')]?_0x9d74bf[_0xe218('0x42')]:_0xd52c6e[_0xe218('0x3f')];if(_0x4fc3f9[_0xe218('0x40')][_0xe218('0x4e')]){_0x9d74bf['include']=[{'all':!![]}];}_0x9d74bf=_[_0xe218('0x4c')]({},_0x9d74bf,_0x4fc3f9['options']);return db['VoiceContext'][_0xe218('0x54')](_0x9d74bf)['then'](handleEntityNotFound(_0x35be07,null))[_0xe218('0x33')](respondWithResult(_0x35be07,null))[_0xe218('0x55')](handleError(_0x35be07,null));};exports[_0xe218('0x56')]=function(_0x232020,_0x3d78e7,_0x263aa7){var _0x56000d;return db['VoiceContext'][_0xe218('0x56')](_0x232020['body'],{'raw':!![]})['then'](function(_0x5be7c4){_0x56000d=_0x5be7c4;return db['VoiceContext'][_0xe218('0x50')]({'raw':!![]});})[_0xe218('0x33')](function(_0x56c2b5){var _0x25184d=fs['readFileSync'](path['join'](config['root'],_0xe218('0x57')),_0xe218('0x58'));var _0xe84a40=ejs[_0xe218('0x59')](_0x25184d,{'contexts':_0x56c2b5||[]});fs[_0xe218('0x5a')](_0xe218('0x5b'),_0xe84a40);})[_0xe218('0x33')](function(){return respondWithRpcPromise(_0xe218('0x5c'),_0xe218('0x56'),{'module':_0xe218('0x5d')});})[_0xe218('0x33')](function(){var _0x2bb64b=_0x232020[_0xe218('0x5e')][_0xe218('0x35')]({'plain':!![]});if(!_0x2bb64b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bb64b['role']===_0xe218('0x5e')){var _0x449534=_0x56000d['get']({'plain':!![]});return db[_0xe218('0x5f')][_0xe218('0x54')]({'where':{'name':_0xe218('0x60'),'userProfileId':_0x2bb64b[_0xe218('0x61')]},'raw':!![]})['then'](function(_0x5ef5c8){if(_0x5ef5c8&&_0x5ef5c8[_0xe218('0x62')]===0x0){return db['UserProfileResource'][_0xe218('0x56')]({'name':_0x449534[_0xe218('0x39')],'resourceId':_0x449534['id'],'type':_0x5ef5c8[_0xe218('0x39')],'sectionId':_0x5ef5c8['id']},{})['then'](function(){return _0x56000d;});}else{return _0x56000d;}})['catch'](function(_0x47778f){logger[_0xe218('0x25')](_0xe218('0x63'),_0x47778f);throw _0x47778f;});}return _0x56000d;})['then'](respondWithResult(_0x3d78e7,0xc9))[_0xe218('0x55')](handleError(_0x3d78e7,null));};exports[_0xe218('0x64')]=function(_0x5de711,_0x53de91,_0x278212){var _0xdbd90a;return db[_0xe218('0x3c')][_0xe218('0x54')]({'where':{'id':_0x5de711[_0xe218('0x52')]['id']}})[_0xe218('0x33')](handleEntityNotFound(_0x53de91,null))[_0xe218('0x33')](saveUpdates(_0x5de711[_0xe218('0x65')],null))['then'](function(_0x1c7046){if(_0x1c7046){_0xdbd90a=_0x1c7046;return db[_0xe218('0x3c')][_0xe218('0x50')]({'raw':!![]});}})[_0xe218('0x33')](function(_0x2995d3){var _0x5d20e4=fs['readFileSync'](path[_0xe218('0x66')](config[_0xe218('0x67')],'server/files/templates/context.ejs'),_0xe218('0x58'));var _0x19eaeb=ejs['render'](_0x5d20e4,{'contexts':_0x2995d3||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x19eaeb);})['then'](function(){return respondWithRpcPromise('Reload',_0xe218('0x64'),{'module':_0xe218('0x5d')});})[_0xe218('0x33')](function(){return _0xdbd90a;})['then'](respondWithResult(_0x53de91,null))['catch'](handleError(_0x53de91,null));};exports[_0xe218('0x34')]=function(_0x418b7a,_0x2abc88,_0xe3706f){var _0x36ef67;return db[_0xe218('0x3c')][_0xe218('0x54')]({'where':{'id':_0x418b7a[_0xe218('0x52')]['id']}})[_0xe218('0x33')](handleEntityNotFound(_0x2abc88,null))[_0xe218('0x33')](removeEntity(_0x2abc88,null))[_0xe218('0x33')](function(){return db[_0xe218('0x3c')][_0xe218('0x50')]({'raw':!![]});})[_0xe218('0x33')](function(_0x49f2ac){var _0x2bbb1d=fs[_0xe218('0x68')](path[_0xe218('0x66')](config[_0xe218('0x67')],'server/files/templates/context.ejs'),_0xe218('0x58'));var _0x1d9d13=ejs[_0xe218('0x59')](_0x2bbb1d,{'contexts':_0x49f2ac});fs[_0xe218('0x5a')](_0xe218('0x5b'),_0x1d9d13);return respondWithRpcPromise('Reload',_0xe218('0x34'),{'module':'chan_sip.so'});})[_0xe218('0x55')](handleError(_0x2abc88,null));}; \ No newline at end of file +var _0x1fb0=['apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','rows','find','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Contexts','userProfileId','autoAssociation','params','readFileSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x6f2530,_0x1e05bb){var _0xc1292e=function(_0x24b4fd){while(--_0x24b4fd){_0x6f2530['push'](_0x6f2530['shift']());}};_0xc1292e(++_0x1e05bb);}(_0x1fb0,0xa2));var _0x01fb=function(_0x187c30,_0x238119){_0x187c30=_0x187c30-0x0;var _0x391824=_0x1fb0[_0x187c30];return _0x391824;};'use strict';var emlformat=require(_0x01fb('0x0'));var rimraf=require(_0x01fb('0x1'));var zipdir=require(_0x01fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01fb('0x3'));var moment=require(_0x01fb('0x4'));var BPromise=require(_0x01fb('0x5'));var Mustache=require(_0x01fb('0x6'));var util=require(_0x01fb('0x7'));var path=require(_0x01fb('0x8'));var sox=require(_0x01fb('0x9'));var csv=require(_0x01fb('0xa'));var ejs=require(_0x01fb('0xb'));var fs=require('fs');var fs_extra=require(_0x01fb('0xc'));var _=require(_0x01fb('0xd'));var squel=require(_0x01fb('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01fb('0xf'));var toCsv=require(_0x01fb('0xa'));var querystring=require(_0x01fb('0x10'));var Papa=require(_0x01fb('0x11'));var Redis=require(_0x01fb('0x12'));var authService=require(_0x01fb('0x13'));var qs=require(_0x01fb('0x14'));var as=require(_0x01fb('0x15'));var hardwareService=require(_0x01fb('0x16'));var logger=require(_0x01fb('0x17'))('api');var utils=require(_0x01fb('0x18'));var config=require(_0x01fb('0x19'));var licenseUtil=require(_0x01fb('0x1a'));var db=require(_0x01fb('0x1b'))['db'];var jayson=require(_0x01fb('0x1c'));var client=jayson[_0x01fb('0x1d')][_0x01fb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x586bfb,_0x5c7b2d,_0x1c5500,_0x5825af){return new BPromise(function(_0x3c7131,_0xb45cf3){var _0x25f96c=_0x5825af||client;return _0x25f96c[_0x01fb('0x1f')](_0x586bfb,_0x1c5500)['then'](function(_0x2561d1){logger[_0x01fb('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5c7b2d,_0x01fb('0x21'));logger['debug'](_0x01fb('0x22'),_0x5c7b2d,_0x01fb('0x21'),JSON['stringify'](_0x2561d1));if(_0x2561d1['error']){if(_0x2561d1[_0x01fb('0x23')]['code']===0x1f4){logger[_0x01fb('0x23')](_0x01fb('0x24'),_0x5c7b2d,_0x2561d1[_0x01fb('0x23')][_0x01fb('0x25')]);return _0xb45cf3(_0x2561d1['error']['message']);}logger[_0x01fb('0x23')](_0x01fb('0x24'),_0x5c7b2d,_0x2561d1['error'][_0x01fb('0x25')]);return _0x3c7131(_0x2561d1['error'][_0x01fb('0x25')]);}else{logger[_0x01fb('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5c7b2d,_0x01fb('0x21'));_0x3c7131(_0x2561d1[_0x01fb('0x26')][_0x01fb('0x25')]);}})[_0x01fb('0x27')](function(_0x44df9d){logger[_0x01fb('0x23')]('VoiceContext,\x20%s,\x20%s',_0x5c7b2d,_0x44df9d);_0xb45cf3(_0x44df9d);});});}function respondWithStatusCode(_0x4ef5bf,_0x2608cd){_0x2608cd=_0x2608cd||0xcc;return function(_0x57e4c5){if(_0x57e4c5){return _0x4ef5bf[_0x01fb('0x28')](_0x2608cd);}return _0x4ef5bf['status'](_0x2608cd)[_0x01fb('0x29')]();};}function respondWithResult(_0x51d883,_0x29fa){_0x29fa=_0x29fa||0xc8;return function(_0x5c7e11){if(_0x5c7e11){return _0x51d883[_0x01fb('0x2a')](_0x29fa)[_0x01fb('0x2b')](_0x5c7e11);}};}function respondWithFilteredResult(_0x352e91,_0x48a520){return function(_0x41e42a){if(_0x41e42a){var _0x199c7b=typeof _0x48a520[_0x01fb('0x2c')]===_0x01fb('0x2d')&&typeof _0x48a520[_0x01fb('0x2e')]==='undefined';var _0x525232=_0x41e42a[_0x01fb('0x2f')];var _0x24739d=_0x199c7b?0x0:_0x48a520[_0x01fb('0x2c')];var _0x1e6de7=_0x199c7b?_0x41e42a[_0x01fb('0x2f')]:_0x48a520['offset']+_0x48a520[_0x01fb('0x2e')];var _0x56ad51;if(_0x1e6de7>=_0x525232){_0x1e6de7=_0x525232;_0x56ad51=0xc8;}else{_0x56ad51=0xce;}_0x352e91[_0x01fb('0x2a')](_0x56ad51);return _0x352e91[_0x01fb('0x30')](_0x01fb('0x31'),_0x24739d+'-'+_0x1e6de7+'/'+_0x525232)[_0x01fb('0x2b')](_0x41e42a);}return null;};}function patchUpdates(_0x501f06){return function(_0x396911){try{jsonpatch[_0x01fb('0x32')](_0x396911,_0x501f06,!![]);}catch(_0x32ba70){return BPromise[_0x01fb('0x33')](_0x32ba70);}return _0x396911[_0x01fb('0x34')]();};}function saveUpdates(_0x39cfd4,_0x15a9d7){return function(_0x220ab1){if(_0x220ab1){return _0x220ab1[_0x01fb('0x35')](_0x39cfd4)[_0x01fb('0x36')](function(_0x3da65b){return _0x3da65b;});}return null;};}function removeEntity(_0x4627f9,_0x52633a){return function(_0x1fc312){if(_0x1fc312){return _0x1fc312[_0x01fb('0x37')]()[_0x01fb('0x36')](function(){var _0x4f24b4=_0x1fc312['get']({'plain':!![]});var _0x1484b9='Contexts';return db[_0x01fb('0x38')][_0x01fb('0x37')]({'where':{'type':_0x1484b9,'resourceId':_0x4f24b4['id']}})[_0x01fb('0x36')](function(){return _0x1fc312;});})[_0x01fb('0x36')](function(){_0x4627f9[_0x01fb('0x2a')](0xcc)[_0x01fb('0x29')]();});}};}function handleEntityNotFound(_0x5baee2,_0x3961e9){return function(_0x3883a8){if(!_0x3883a8){_0x5baee2[_0x01fb('0x28')](0x194);}return _0x3883a8;};}function handleError(_0x547354,_0x331353){_0x331353=_0x331353||0x1f4;return function(_0x414b29){logger[_0x01fb('0x23')](_0x414b29[_0x01fb('0x39')]);if(_0x414b29[_0x01fb('0x3a')]){delete _0x414b29[_0x01fb('0x3a')];}_0x547354[_0x01fb('0x2a')](_0x331353)[_0x01fb('0x3b')](_0x414b29);};}exports['index']=function(_0x56b0d7,_0x2c3aef){var _0x497b81={},_0x2af33b={},_0x30b431={'count':0x0,'rows':[]};var _0x66fafc=_[_0x01fb('0x3c')](db['VoiceContext'][_0x01fb('0x3d')],function(_0x114eb2){return{'name':_0x114eb2[_0x01fb('0x3e')],'type':_0x114eb2['type']['key']};});_0x2af33b[_0x01fb('0x3f')]=_[_0x01fb('0x3c')](_0x66fafc,_0x01fb('0x3a'));_0x2af33b['query']=_[_0x01fb('0x40')](_0x56b0d7[_0x01fb('0x41')]);_0x2af33b[_0x01fb('0x42')]=_[_0x01fb('0x43')](_0x2af33b[_0x01fb('0x3f')],_0x2af33b[_0x01fb('0x41')]);_0x497b81['attributes']=_['intersection'](_0x2af33b[_0x01fb('0x3f')],qs[_0x01fb('0x44')](_0x56b0d7[_0x01fb('0x41')][_0x01fb('0x44')]));_0x497b81[_0x01fb('0x45')]=_0x497b81[_0x01fb('0x45')][_0x01fb('0x46')]?_0x497b81[_0x01fb('0x45')]:_0x2af33b['model'];if(!_0x56b0d7[_0x01fb('0x41')][_0x01fb('0x47')](_0x01fb('0x48'))){_0x497b81[_0x01fb('0x2e')]=qs[_0x01fb('0x2e')](_0x56b0d7['query']['limit']);_0x497b81['offset']=qs['offset'](_0x56b0d7['query'][_0x01fb('0x2c')]);}_0x497b81['order']=qs[_0x01fb('0x49')](_0x56b0d7[_0x01fb('0x41')][_0x01fb('0x49')]);_0x497b81[_0x01fb('0x4a')]=qs[_0x01fb('0x42')](_[_0x01fb('0x4b')](_0x56b0d7[_0x01fb('0x41')],_0x2af33b['filters']),_0x66fafc);if(_0x56b0d7[_0x01fb('0x41')][_0x01fb('0x4c')]){_0x497b81[_0x01fb('0x4a')]=_[_0x01fb('0x4d')](_0x497b81['where'],{'$or':_['map'](_0x66fafc,function(_0x3fc131){if(_0x3fc131['type']!=='VIRTUAL'){var _0x3dc3bc={};_0x3dc3bc[_0x3fc131['name']]={'$like':'%'+_0x56b0d7[_0x01fb('0x41')]['filter']+'%'};return _0x3dc3bc;}})});}_0x497b81=_[_0x01fb('0x4d')]({},_0x497b81,_0x56b0d7[_0x01fb('0x4e')]);var _0x4c74df={'where':_0x497b81['where']};return db[_0x01fb('0x4f')][_0x01fb('0x2f')](_0x4c74df)[_0x01fb('0x36')](function(_0x1979b8){_0x30b431[_0x01fb('0x2f')]=_0x1979b8;if(_0x56b0d7['query'][_0x01fb('0x50')]){_0x497b81[_0x01fb('0x51')]=[{'all':!![]}];}return db[_0x01fb('0x4f')][_0x01fb('0x52')](_0x497b81);})[_0x01fb('0x36')](function(_0x5e3eef){_0x30b431[_0x01fb('0x53')]=_0x5e3eef;return _0x30b431;})[_0x01fb('0x36')](respondWithFilteredResult(_0x2c3aef,_0x497b81))[_0x01fb('0x27')](handleError(_0x2c3aef,null));};exports['show']=function(_0x2df844,_0x2d3172){var _0x3d17b3={'raw':![],'where':{'id':_0x2df844['params']['id']}},_0x3800db={};_0x3800db[_0x01fb('0x3f')]=_[_0x01fb('0x40')](db[_0x01fb('0x4f')][_0x01fb('0x3d')]);_0x3800db[_0x01fb('0x41')]=_[_0x01fb('0x40')](_0x2df844['query']);_0x3800db[_0x01fb('0x42')]=_[_0x01fb('0x43')](_0x3800db['model'],_0x3800db[_0x01fb('0x41')]);_0x3d17b3[_0x01fb('0x45')]=_['intersection'](_0x3800db[_0x01fb('0x3f')],qs[_0x01fb('0x44')](_0x2df844[_0x01fb('0x41')][_0x01fb('0x44')]));_0x3d17b3[_0x01fb('0x45')]=_0x3d17b3['attributes'][_0x01fb('0x46')]?_0x3d17b3[_0x01fb('0x45')]:_0x3800db[_0x01fb('0x3f')];if(_0x2df844[_0x01fb('0x41')][_0x01fb('0x50')]){_0x3d17b3['include']=[{'all':!![]}];}_0x3d17b3=_['merge']({},_0x3d17b3,_0x2df844['options']);return db[_0x01fb('0x4f')][_0x01fb('0x54')](_0x3d17b3)[_0x01fb('0x36')](handleEntityNotFound(_0x2d3172,null))[_0x01fb('0x36')](respondWithResult(_0x2d3172,null))[_0x01fb('0x27')](handleError(_0x2d3172,null));};exports[_0x01fb('0x55')]=function(_0x4664f2,_0x592fd6,_0x339c79){var _0x57da83;return db[_0x01fb('0x4f')][_0x01fb('0x55')](_0x4664f2[_0x01fb('0x56')],{'raw':!![]})[_0x01fb('0x36')](function(_0x2934d9){_0x57da83=_0x2934d9;return db[_0x01fb('0x4f')][_0x01fb('0x52')]({'raw':!![]});})['then'](function(_0x1d008b){var _0x2546b1=fs['readFileSync'](path[_0x01fb('0x57')](config[_0x01fb('0x58')],_0x01fb('0x59')),_0x01fb('0x5a'));var _0x591d7b=ejs[_0x01fb('0x5b')](_0x2546b1,{'contexts':_0x1d008b||[]});fs[_0x01fb('0x5c')](_0x01fb('0x5d'),_0x591d7b);})[_0x01fb('0x36')](function(){return respondWithRpcPromise(_0x01fb('0x5e'),_0x01fb('0x55'),{'module':_0x01fb('0x5f')});})[_0x01fb('0x36')](function(){var _0x452be6=_0x4664f2[_0x01fb('0x60')]['get']({'plain':!![]});if(!_0x452be6)throw new Error(_0x01fb('0x61'));if(_0x452be6[_0x01fb('0x62')]===_0x01fb('0x60')){var _0x5f12f6=_0x57da83[_0x01fb('0x63')]({'plain':!![]});return db[_0x01fb('0x64')][_0x01fb('0x54')]({'where':{'name':_0x01fb('0x65'),'userProfileId':_0x452be6[_0x01fb('0x66')]},'raw':!![]})[_0x01fb('0x36')](function(_0x51f42e){if(_0x51f42e&&_0x51f42e[_0x01fb('0x67')]===0x0){return db[_0x01fb('0x38')][_0x01fb('0x55')]({'name':_0x5f12f6[_0x01fb('0x3a')],'resourceId':_0x5f12f6['id'],'type':_0x51f42e[_0x01fb('0x3a')],'sectionId':_0x51f42e['id']},{})[_0x01fb('0x36')](function(){return _0x57da83;});}else{return _0x57da83;}})[_0x01fb('0x27')](function(_0xf0e185){logger[_0x01fb('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf0e185);throw _0xf0e185;});}return _0x57da83;})[_0x01fb('0x36')](respondWithResult(_0x592fd6,0xc9))[_0x01fb('0x27')](handleError(_0x592fd6,null));};exports[_0x01fb('0x35')]=function(_0x274ed1,_0x507880,_0x1235f3){var _0x41ae33;return db[_0x01fb('0x4f')]['find']({'where':{'id':_0x274ed1[_0x01fb('0x68')]['id']}})[_0x01fb('0x36')](handleEntityNotFound(_0x507880,null))[_0x01fb('0x36')](saveUpdates(_0x274ed1[_0x01fb('0x56')],null))[_0x01fb('0x36')](function(_0x4da2d9){if(_0x4da2d9){_0x41ae33=_0x4da2d9;return db['VoiceContext'][_0x01fb('0x52')]({'raw':!![]});}})[_0x01fb('0x36')](function(_0x1f7cbb){var _0x475170=fs[_0x01fb('0x69')](path[_0x01fb('0x57')](config[_0x01fb('0x58')],_0x01fb('0x59')),_0x01fb('0x5a'));var _0x51da15=ejs[_0x01fb('0x5b')](_0x475170,{'contexts':_0x1f7cbb||[]});fs[_0x01fb('0x5c')](_0x01fb('0x5d'),_0x51da15);})[_0x01fb('0x36')](function(){return respondWithRpcPromise(_0x01fb('0x5e'),_0x01fb('0x35'),{'module':_0x01fb('0x5f')});})[_0x01fb('0x36')](function(){return _0x41ae33;})[_0x01fb('0x36')](respondWithResult(_0x507880,null))['catch'](handleError(_0x507880,null));};exports['destroy']=function(_0x4da9c3,_0x3ed10e,_0x3355ee){var _0x3b00ed;return db[_0x01fb('0x4f')][_0x01fb('0x54')]({'where':{'id':_0x4da9c3[_0x01fb('0x68')]['id']}})[_0x01fb('0x36')](handleEntityNotFound(_0x3ed10e,null))[_0x01fb('0x36')](removeEntity(_0x3ed10e,null))[_0x01fb('0x36')](function(){return db['VoiceContext'][_0x01fb('0x52')]({'raw':!![]});})[_0x01fb('0x36')](function(_0x1bc257){var _0x55afcb=fs['readFileSync'](path[_0x01fb('0x57')](config[_0x01fb('0x58')],_0x01fb('0x59')),_0x01fb('0x5a'));var _0x53ba23=ejs[_0x01fb('0x5b')](_0x55afcb,{'contexts':_0x1bc257});fs[_0x01fb('0x5c')](_0x01fb('0x5d'),_0x53ba23);return respondWithRpcPromise(_0x01fb('0x5e'),_0x01fb('0x37'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3ed10e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b5507cd..070a813 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 _0x3f71=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','lodash','util','../../config/logger','api'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3f71,0x10d));var _0x13f7=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x3f71[_0x3b231a];return _0x18d67a;};'use strict';var _=require(_0x13f7('0x0'));var util=require(_0x13f7('0x1'));var logger=require(_0x13f7('0x2'))(_0x13f7('0x3'));var moment=require(_0x13f7('0x4'));var BPromise=require(_0x13f7('0x5'));var rp=require(_0x13f7('0x6'));var fs=require('fs');var path=require(_0x13f7('0x7'));var rimraf=require(_0x13f7('0x8'));var config=require(_0x13f7('0x9'));var attributes=require('./voiceContext.attributes');module[_0x13f7('0xa')]=function(_0x534379,_0x1aa89f){return _0x534379[_0x13f7('0xb')](_0x13f7('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa61=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x505674,_0xeb641a){var _0x21a5e2=function(_0x5b9b0e){while(--_0x5b9b0e){_0x505674['push'](_0x505674['shift']());}};_0x21a5e2(++_0xeb641a);}(_0xaa61,0x1cc));var _0x1aa6=function(_0xebdb6f,_0x7f60f9){_0xebdb6f=_0xebdb6f-0x0;var _0x5b2ac1=_0xaa61[_0xebdb6f];return _0x5b2ac1;};'use strict';var _=require(_0x1aa6('0x0'));var util=require(_0x1aa6('0x1'));var logger=require(_0x1aa6('0x2'))(_0x1aa6('0x3'));var moment=require('moment');var BPromise=require(_0x1aa6('0x4'));var rp=require(_0x1aa6('0x5'));var fs=require('fs');var path=require(_0x1aa6('0x6'));var rimraf=require(_0x1aa6('0x7'));var config=require(_0x1aa6('0x8'));var attributes=require(_0x1aa6('0x9'));module[_0x1aa6('0xa')]=function(_0x1adbcc,_0x263bd4){return _0x1adbcc[_0x1aa6('0xb')](_0x1aa6('0xc'),attributes,{'tableName':_0x1aa6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index f0b2358..67a0b1d 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 _0xd757=['VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xd757,0x1e5));var _0x7d75=function(_0x223ee2,_0x161d58){_0x223ee2=_0x223ee2-0x0;var _0xf60060=_0xd757[_0x223ee2];return _0xf60060;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var moment=require(_0x7d75('0x2'));var BPromise=require(_0x7d75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require('../../config/logger')(_0x7d75('0x6'));var config=require(_0x7d75('0x7'));var jayson=require(_0x7d75('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x108c0d,_0x3fde33,_0x1cf272){return new BPromise(function(_0x276fb0,_0x4030ee){return client[_0x7d75('0x9')](_0x108c0d,_0x1cf272)[_0x7d75('0xa')](function(_0x3720c7){logger[_0x7d75('0xb')](_0x7d75('0xc'),_0x3fde33,_0x7d75('0xd'));logger[_0x7d75('0xe')](_0x7d75('0xf'),_0x3fde33,'request\x20sent',JSON['stringify'](_0x3720c7));if(_0x3720c7[_0x7d75('0x10')]){if(_0x3720c7[_0x7d75('0x10')][_0x7d75('0x11')]===0x1f4){logger['error'](_0x7d75('0xc'),_0x3fde33,_0x3720c7[_0x7d75('0x10')]['message']);return _0x4030ee(_0x3720c7[_0x7d75('0x10')][_0x7d75('0x12')]);}logger[_0x7d75('0x10')](_0x7d75('0xc'),_0x3fde33,_0x3720c7[_0x7d75('0x10')][_0x7d75('0x12')]);return _0x276fb0(_0x3720c7['error'][_0x7d75('0x12')]);}else{logger[_0x7d75('0xb')](_0x7d75('0xc'),_0x3fde33,_0x7d75('0xd'));_0x276fb0(_0x3720c7[_0x7d75('0x13')][_0x7d75('0x12')]);}})['catch'](function(_0x15ba5f){logger['error'](_0x7d75('0xc'),_0x3fde33,_0x15ba5f);_0x4030ee(_0x15ba5f);});});} \ No newline at end of file +var _0x9c00=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x113696,_0x1843cc){var _0x1fb234=function(_0x5f1185){while(--_0x5f1185){_0x113696['push'](_0x113696['shift']());}};_0x1fb234(++_0x1843cc);}(_0x9c00,0x1a0));var _0x09c0=function(_0xc6379f,_0x5d0315){_0xc6379f=_0xc6379f-0x0;var _0x437fe8=_0x9c00[_0xc6379f];return _0x437fe8;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e2d466a..de71a3a 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 _0x2645=['get','show','post','create','put','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','describe'];(function(_0x2ed80c,_0x5d31a0){var _0x5d3ac6=function(_0x5f080d){while(--_0x5f080d){_0x2ed80c['push'](_0x2ed80c['shift']());}};_0x5d3ac6(++_0x5d31a0);}(_0x2645,0x1c1));var _0x5264=function(_0x52a9b5,_0xc7c7b2){_0x52a9b5=_0x52a9b5-0x0;var _0x441cfc=_0x2645[_0x52a9b5];return _0x441cfc;};'use strict';var multer=require('multer');var util=require(_0x5264('0x0'));var path=require(_0x5264('0x1'));var timeout=require(_0x5264('0x2'));var express=require(_0x5264('0x3'));var router=express[_0x5264('0x4')]();var fs_extra=require(_0x5264('0x5'));var auth=require(_0x5264('0x6'));var interaction=require(_0x5264('0x7'));var config=require(_0x5264('0x8'));var controller=require(_0x5264('0x9'));router['get']('/',auth[_0x5264('0xa')](),controller[_0x5264('0xb')]);router['get']('/describe',auth[_0x5264('0xa')](),controller[_0x5264('0xc')]);router[_0x5264('0xd')]('/:id',auth[_0x5264('0xa')](),controller[_0x5264('0xe')]);router[_0x5264('0xf')]('/',auth['isAuthenticated'](),controller[_0x5264('0x10')]);router[_0x5264('0x11')]('/:id',auth[_0x5264('0xa')](),controller[_0x5264('0x12')]);router[_0x5264('0x13')](_0x5264('0x14'),auth['isAuthenticated'](),controller[_0x5264('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0d47=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','destroy','exports','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d47,0x1b9));var _0x70d4=function(_0x4e0f41,_0x337fd2){_0x4e0f41=_0x4e0f41-0x0;var _0x2a19fd=_0x0d47[_0x4e0f41];return _0x2a19fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x70d4('0x0'));var timeout=require(_0x70d4('0x1'));var express=require(_0x70d4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x70d4('0x3'));var interaction=require(_0x70d4('0x4'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x70d4('0x5')]('/',auth['isAuthenticated'](),controller[_0x70d4('0x6')]);router['get'](_0x70d4('0x7'),auth[_0x70d4('0x8')](),controller[_0x70d4('0x9')]);router['get']('/:id',auth[_0x70d4('0x8')](),controller[_0x70d4('0xa')]);router[_0x70d4('0xb')]('/',auth[_0x70d4('0x8')](),controller[_0x70d4('0xc')]);router[_0x70d4('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x70d4('0xe'),auth[_0x70d4('0x8')](),controller[_0x70d4('0xf')]);module[_0x70d4('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 48b1b89..3e18d52 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 _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x55d905,_0x59fe89){var _0x2e504b=function(_0x238758){while(--_0x238758){_0x55d905['push'](_0x55d905['shift']());}};_0x2e504b(++_0x59fe89);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x382cfb,_0x235f8a){_0x382cfb=_0x382cfb-0x0;var _0x11303d=_0x6f0d[_0x382cfb];return _0x11303d;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file +var _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x50f12f,_0x4f5f82){var _0x275b99=function(_0x5bfa98){while(--_0x5bfa98){_0x50f12f['push'](_0x50f12f['shift']());}};_0x275b99(++_0x4f5f82);}(_0x4b84,0x1cc));var _0x44b8=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x4b84[_0x47d6dc];return _0x1a1c93;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 647ce1a..b76607d 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 _0xd207=['model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceDialReport','findAll','rows','catch','show','fields','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','error','stack','name','rawAttributes','key'];(function(_0x18b890,_0x216f8b){var _0x4d2ebb=function(_0x5870fa){while(--_0x5870fa){_0x18b890['push'](_0x18b890['shift']());}};_0x4d2ebb(++_0x216f8b);}(_0xd207,0x6d));var _0x7d20=function(_0x5a4633,_0xb8ff54){_0x5a4633=_0x5a4633-0x0;var _0x2c6173=_0xd207[_0x5a4633];return _0x2c6173;};'use strict';var emlformat=require(_0x7d20('0x0'));var rimraf=require(_0x7d20('0x1'));var zipdir=require(_0x7d20('0x2'));var jsonpatch=require(_0x7d20('0x3'));var rp=require('request-promise');var moment=require(_0x7d20('0x4'));var BPromise=require(_0x7d20('0x5'));var Mustache=require(_0x7d20('0x6'));var util=require(_0x7d20('0x7'));var path=require(_0x7d20('0x8'));var sox=require(_0x7d20('0x9'));var csv=require(_0x7d20('0xa'));var ejs=require(_0x7d20('0xb'));var fs=require('fs');var fs_extra=require(_0x7d20('0xc'));var _=require(_0x7d20('0xd'));var squel=require(_0x7d20('0xe'));var crypto=require(_0x7d20('0xf'));var jsforce=require(_0x7d20('0x10'));var deskjs=require(_0x7d20('0x11'));var toCsv=require(_0x7d20('0xa'));var querystring=require(_0x7d20('0x12'));var Papa=require(_0x7d20('0x13'));var Redis=require('ioredis');var authService=require(_0x7d20('0x14'));var qs=require(_0x7d20('0x15'));var as=require(_0x7d20('0x16'));var hardwareService=require(_0x7d20('0x17'));var logger=require(_0x7d20('0x18'))(_0x7d20('0x19'));var utils=require(_0x7d20('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x7d20('0x1b'));var db=require(_0x7d20('0x1c'))['db'];function respondWithStatusCode(_0x5f36c5,_0x1456f1){_0x1456f1=_0x1456f1||0xcc;return function(_0xd2dad){if(_0xd2dad){return _0x5f36c5[_0x7d20('0x1d')](_0x1456f1);}return _0x5f36c5[_0x7d20('0x1e')](_0x1456f1)[_0x7d20('0x1f')]();};}function respondWithResult(_0x1ec2ea,_0x108c61){_0x108c61=_0x108c61||0xc8;return function(_0x5299e3){if(_0x5299e3){return _0x1ec2ea[_0x7d20('0x1e')](_0x108c61)[_0x7d20('0x20')](_0x5299e3);}};}function respondWithFilteredResult(_0x75b5ee,_0x28a69f){return function(_0xc0b142){if(_0xc0b142){var _0x5aacf3=typeof _0x28a69f[_0x7d20('0x21')]==='undefined'&&typeof _0x28a69f[_0x7d20('0x22')]===_0x7d20('0x23');var _0xda0e85=_0xc0b142[_0x7d20('0x24')];var _0x40560f=_0x5aacf3?0x0:_0x28a69f[_0x7d20('0x21')];var _0x3898b9=_0x5aacf3?_0xc0b142[_0x7d20('0x24')]:_0x28a69f['offset']+_0x28a69f['limit'];var _0x309356;if(_0x3898b9>=_0xda0e85){_0x3898b9=_0xda0e85;_0x309356=0xc8;}else{_0x309356=0xce;}_0x75b5ee[_0x7d20('0x1e')](_0x309356);return _0x75b5ee[_0x7d20('0x25')]('Content-Range',_0x40560f+'-'+_0x3898b9+'/'+_0xda0e85)[_0x7d20('0x20')](_0xc0b142);}return null;};}function patchUpdates(_0x48eae8){return function(_0x40895a){try{jsonpatch[_0x7d20('0x26')](_0x40895a,_0x48eae8,!![]);}catch(_0x2beaa1){return BPromise[_0x7d20('0x27')](_0x2beaa1);}return _0x40895a['save']();};}function saveUpdates(_0x383096,_0x508d90){return function(_0x2fd221){if(_0x2fd221){return _0x2fd221['update'](_0x383096)[_0x7d20('0x28')](function(_0xf523ff){return _0xf523ff;});}return null;};}function removeEntity(_0x369b19,_0x4b892c){return function(_0x1487fa){if(_0x1487fa){return _0x1487fa[_0x7d20('0x29')]()[_0x7d20('0x28')](function(){_0x369b19[_0x7d20('0x1e')](0xcc)[_0x7d20('0x1f')]();});}};}function handleEntityNotFound(_0x1d2d94,_0x4e7335){return function(_0x2c43cb){if(!_0x2c43cb){_0x1d2d94[_0x7d20('0x1d')](0x194);}return _0x2c43cb;};}function handleError(_0x50a74d,_0x2e451f){_0x2e451f=_0x2e451f||0x1f4;return function(_0x37a101){logger[_0x7d20('0x2a')](_0x37a101[_0x7d20('0x2b')]);if(_0x37a101[_0x7d20('0x2c')]){delete _0x37a101[_0x7d20('0x2c')];}_0x50a74d[_0x7d20('0x1e')](_0x2e451f)['send'](_0x37a101);};}exports['index']=function(_0x419ca3,_0x945dfd){var _0xfda16a={},_0x37661f={},_0x36f645={'count':0x0,'rows':[]};var _0x1c3d79=_['map'](db['VoiceDialReport'][_0x7d20('0x2d')],function(_0x277c66){return{'name':_0x277c66['fieldName'],'type':_0x277c66['type'][_0x7d20('0x2e')]};});_0x37661f[_0x7d20('0x2f')]=_[_0x7d20('0x30')](_0x1c3d79,'name');_0x37661f[_0x7d20('0x31')]=_[_0x7d20('0x32')](_0x419ca3['query']);_0x37661f[_0x7d20('0x33')]=_[_0x7d20('0x34')](_0x37661f[_0x7d20('0x2f')],_0x37661f[_0x7d20('0x31')]);_0xfda16a[_0x7d20('0x35')]=_[_0x7d20('0x34')](_0x37661f[_0x7d20('0x2f')],qs['fields'](_0x419ca3[_0x7d20('0x31')]['fields']));_0xfda16a[_0x7d20('0x35')]=_0xfda16a[_0x7d20('0x35')][_0x7d20('0x36')]?_0xfda16a[_0x7d20('0x35')]:_0x37661f[_0x7d20('0x2f')];if(!_0x419ca3[_0x7d20('0x31')][_0x7d20('0x37')](_0x7d20('0x38'))){_0xfda16a['limit']=qs[_0x7d20('0x22')](_0x419ca3[_0x7d20('0x31')][_0x7d20('0x22')]);_0xfda16a[_0x7d20('0x21')]=qs[_0x7d20('0x21')](_0x419ca3[_0x7d20('0x31')]['offset']);}_0xfda16a[_0x7d20('0x39')]=qs[_0x7d20('0x3a')](_0x419ca3[_0x7d20('0x31')]['sort']);_0xfda16a[_0x7d20('0x3b')]=qs[_0x7d20('0x33')](_[_0x7d20('0x3c')](_0x419ca3[_0x7d20('0x31')],_0x37661f[_0x7d20('0x33')]),_0x1c3d79);if(_0x419ca3[_0x7d20('0x31')][_0x7d20('0x3d')]){_0xfda16a[_0x7d20('0x3b')]=_[_0x7d20('0x3e')](_0xfda16a[_0x7d20('0x3b')],{'$or':_[_0x7d20('0x30')](_0x1c3d79,function(_0x54d2b9){if(_0x54d2b9[_0x7d20('0x3f')]!==_0x7d20('0x40')){var _0x9250c2={};_0x9250c2[_0x54d2b9[_0x7d20('0x2c')]]={'$like':'%'+_0x419ca3[_0x7d20('0x31')]['filter']+'%'};return _0x9250c2;}})});}_0xfda16a=_['merge']({},_0xfda16a,_0x419ca3[_0x7d20('0x41')]);var _0x1cdb81={'where':_0xfda16a[_0x7d20('0x3b')]};return db[_0x7d20('0x42')][_0x7d20('0x24')](_0x1cdb81)[_0x7d20('0x28')](function(_0x3dbeca){_0x36f645[_0x7d20('0x24')]=_0x3dbeca;if(_0x419ca3[_0x7d20('0x31')]['includeAll']){_0xfda16a['include']=[{'all':!![]}];}return db[_0x7d20('0x42')][_0x7d20('0x43')](_0xfda16a);})[_0x7d20('0x28')](function(_0x1a776d){_0x36f645[_0x7d20('0x44')]=_0x1a776d;return _0x36f645;})['then'](respondWithFilteredResult(_0x945dfd,_0xfda16a))[_0x7d20('0x45')](handleError(_0x945dfd,null));};exports[_0x7d20('0x46')]=function(_0x3b3528,_0x1226d3){var _0x34c684={'raw':!![],'where':{'id':_0x3b3528['params']['id']}},_0x32c193={};_0x32c193['model']=_['keys'](db[_0x7d20('0x42')][_0x7d20('0x2d')]);_0x32c193[_0x7d20('0x31')]=_['keys'](_0x3b3528[_0x7d20('0x31')]);_0x32c193[_0x7d20('0x33')]=_['intersection'](_0x32c193[_0x7d20('0x2f')],_0x32c193[_0x7d20('0x31')]);_0x34c684[_0x7d20('0x35')]=_['intersection'](_0x32c193[_0x7d20('0x2f')],qs[_0x7d20('0x47')](_0x3b3528['query']['fields']));_0x34c684[_0x7d20('0x35')]=_0x34c684['attributes'][_0x7d20('0x36')]?_0x34c684['attributes']:_0x32c193['model'];if(_0x3b3528['query']['includeAll']){_0x34c684[_0x7d20('0x48')]=[{'all':!![]}];}_0x34c684=_[_0x7d20('0x3e')]({},_0x34c684,_0x3b3528[_0x7d20('0x41')]);return db[_0x7d20('0x42')]['find'](_0x34c684)[_0x7d20('0x28')](handleEntityNotFound(_0x1226d3,null))[_0x7d20('0x28')](respondWithResult(_0x1226d3,null))['catch'](handleError(_0x1226d3,null));};exports[_0x7d20('0x49')]=function(_0x2874fd,_0x2a3d6f){return db[_0x7d20('0x42')]['create'](_0x2874fd[_0x7d20('0x4a')],{})[_0x7d20('0x28')](respondWithResult(_0x2a3d6f,0xc9))[_0x7d20('0x45')](handleError(_0x2a3d6f,null));};exports['update']=function(_0x405c1c,_0x246eca){if(_0x405c1c[_0x7d20('0x4a')]['id']){delete _0x405c1c[_0x7d20('0x4a')]['id'];}return db[_0x7d20('0x42')]['find']({'where':{'id':_0x405c1c['params']['id']}})[_0x7d20('0x28')](handleEntityNotFound(_0x246eca,null))['then'](saveUpdates(_0x405c1c['body'],null))[_0x7d20('0x28')](respondWithResult(_0x246eca,null))[_0x7d20('0x45')](handleError(_0x246eca,null));};exports[_0x7d20('0x29')]=function(_0x14571c,_0x1305ae){return db[_0x7d20('0x42')][_0x7d20('0x4b')]({'where':{'id':_0x14571c[_0x7d20('0x4c')]['id']}})[_0x7d20('0x28')](handleEntityNotFound(_0x1305ae,null))[_0x7d20('0x28')](removeEntity(_0x1305ae,null))[_0x7d20('0x45')](handleError(_0x1305ae,null));};exports[_0x7d20('0x4d')]=function(_0x5a4b25,_0x168017){return db[_0x7d20('0x42')]['describe']()[_0x7d20('0x28')](respondWithResult(_0x168017,null))['catch'](handleError(_0x168017,null));}; \ No newline at end of file +var _0xd382=['stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','filter','merge','options','VoiceDialReport','findAll','rows','catch','show','rawAttributes','fields','length','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','update','then','end','sendStatus','error'];(function(_0x535a55,_0x4c7bf8){var _0x1e5aeb=function(_0x286c72){while(--_0x286c72){_0x535a55['push'](_0x535a55['shift']());}};_0x1e5aeb(++_0x4c7bf8);}(_0xd382,0x1ea));var _0x2d38=function(_0x2c590a,_0x19d6d3){_0x2c590a=_0x2c590a-0x0;var _0x2382e4=_0xd382[_0x2c590a];return _0x2382e4;};'use strict';var emlformat=require(_0x2d38('0x0'));var rimraf=require(_0x2d38('0x1'));var zipdir=require(_0x2d38('0x2'));var jsonpatch=require(_0x2d38('0x3'));var rp=require(_0x2d38('0x4'));var moment=require(_0x2d38('0x5'));var BPromise=require(_0x2d38('0x6'));var Mustache=require('mustache');var util=require(_0x2d38('0x7'));var path=require(_0x2d38('0x8'));var sox=require(_0x2d38('0x9'));var csv=require(_0x2d38('0xa'));var ejs=require(_0x2d38('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d38('0xc'));var squel=require(_0x2d38('0xd'));var crypto=require(_0x2d38('0xe'));var jsforce=require(_0x2d38('0xf'));var deskjs=require(_0x2d38('0x10'));var toCsv=require(_0x2d38('0xa'));var querystring=require(_0x2d38('0x11'));var Papa=require('papaparse');var Redis=require(_0x2d38('0x12'));var authService=require(_0x2d38('0x13'));var qs=require(_0x2d38('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d38('0x15'));var logger=require(_0x2d38('0x16'))(_0x2d38('0x17'));var utils=require(_0x2d38('0x18'));var config=require(_0x2d38('0x19'));var licenseUtil=require(_0x2d38('0x1a'));var db=require(_0x2d38('0x1b'))['db'];function respondWithStatusCode(_0x954294,_0x39bd32){_0x39bd32=_0x39bd32||0xcc;return function(_0x5b559b){if(_0x5b559b){return _0x954294['sendStatus'](_0x39bd32);}return _0x954294[_0x2d38('0x1c')](_0x39bd32)['end']();};}function respondWithResult(_0x18df31,_0x3e1fd8){_0x3e1fd8=_0x3e1fd8||0xc8;return function(_0x531191){if(_0x531191){return _0x18df31[_0x2d38('0x1c')](_0x3e1fd8)[_0x2d38('0x1d')](_0x531191);}};}function respondWithFilteredResult(_0x5c557a,_0x1888db){return function(_0x5d2219){if(_0x5d2219){var _0x2c9175=typeof _0x1888db['offset']===_0x2d38('0x1e')&&typeof _0x1888db[_0x2d38('0x1f')]==='undefined';var _0x3d3e26=_0x5d2219['count'];var _0x2ae803=_0x2c9175?0x0:_0x1888db[_0x2d38('0x20')];var _0x47e52b=_0x2c9175?_0x5d2219[_0x2d38('0x21')]:_0x1888db[_0x2d38('0x20')]+_0x1888db[_0x2d38('0x1f')];var _0x17e76d;if(_0x47e52b>=_0x3d3e26){_0x47e52b=_0x3d3e26;_0x17e76d=0xc8;}else{_0x17e76d=0xce;}_0x5c557a['status'](_0x17e76d);return _0x5c557a[_0x2d38('0x22')]('Content-Range',_0x2ae803+'-'+_0x47e52b+'/'+_0x3d3e26)[_0x2d38('0x1d')](_0x5d2219);}return null;};}function patchUpdates(_0xf079dd){return function(_0x14b915){try{jsonpatch[_0x2d38('0x23')](_0x14b915,_0xf079dd,!![]);}catch(_0x40e61b){return BPromise[_0x2d38('0x24')](_0x40e61b);}return _0x14b915['save']();};}function saveUpdates(_0x5440ec,_0x343e0e){return function(_0x157fcb){if(_0x157fcb){return _0x157fcb[_0x2d38('0x25')](_0x5440ec)[_0x2d38('0x26')](function(_0x5c84bf){return _0x5c84bf;});}return null;};}function removeEntity(_0x1b2228,_0x4f7623){return function(_0x22f66f){if(_0x22f66f){return _0x22f66f['destroy']()[_0x2d38('0x26')](function(){_0x1b2228[_0x2d38('0x1c')](0xcc)[_0x2d38('0x27')]();});}};}function handleEntityNotFound(_0xcd83f9,_0x7e3723){return function(_0x260d44){if(!_0x260d44){_0xcd83f9[_0x2d38('0x28')](0x194);}return _0x260d44;};}function handleError(_0x55ed11,_0x468509){_0x468509=_0x468509||0x1f4;return function(_0x549f3e){logger[_0x2d38('0x29')](_0x549f3e[_0x2d38('0x2a')]);if(_0x549f3e[_0x2d38('0x2b')]){delete _0x549f3e[_0x2d38('0x2b')];}_0x55ed11['status'](_0x468509)[_0x2d38('0x2c')](_0x549f3e);};}exports[_0x2d38('0x2d')]=function(_0x37ebb9,_0x37e832){var _0x18e623={},_0x5a82f1={},_0x23457b={'count':0x0,'rows':[]};var _0x22dd2b=_[_0x2d38('0x2e')](db['VoiceDialReport']['rawAttributes'],function(_0x4b4f8f){return{'name':_0x4b4f8f[_0x2d38('0x2f')],'type':_0x4b4f8f[_0x2d38('0x30')][_0x2d38('0x31')]};});_0x5a82f1[_0x2d38('0x32')]=_[_0x2d38('0x2e')](_0x22dd2b,'name');_0x5a82f1[_0x2d38('0x33')]=_[_0x2d38('0x34')](_0x37ebb9['query']);_0x5a82f1[_0x2d38('0x35')]=_[_0x2d38('0x36')](_0x5a82f1['model'],_0x5a82f1['query']);_0x18e623[_0x2d38('0x37')]=_['intersection'](_0x5a82f1[_0x2d38('0x32')],qs['fields'](_0x37ebb9['query']['fields']));_0x18e623[_0x2d38('0x37')]=_0x18e623['attributes']['length']?_0x18e623[_0x2d38('0x37')]:_0x5a82f1[_0x2d38('0x32')];if(!_0x37ebb9[_0x2d38('0x33')]['hasOwnProperty'](_0x2d38('0x38'))){_0x18e623[_0x2d38('0x1f')]=qs['limit'](_0x37ebb9[_0x2d38('0x33')][_0x2d38('0x1f')]);_0x18e623['offset']=qs[_0x2d38('0x20')](_0x37ebb9[_0x2d38('0x33')]['offset']);}_0x18e623['order']=qs[_0x2d38('0x39')](_0x37ebb9['query']['sort']);_0x18e623[_0x2d38('0x3a')]=qs[_0x2d38('0x35')](_[_0x2d38('0x3b')](_0x37ebb9['query'],_0x5a82f1[_0x2d38('0x35')]),_0x22dd2b);if(_0x37ebb9[_0x2d38('0x33')][_0x2d38('0x3c')]){_0x18e623[_0x2d38('0x3a')]=_[_0x2d38('0x3d')](_0x18e623[_0x2d38('0x3a')],{'$or':_[_0x2d38('0x2e')](_0x22dd2b,function(_0x2995ff){if(_0x2995ff[_0x2d38('0x30')]!=='VIRTUAL'){var _0x128914={};_0x128914[_0x2995ff['name']]={'$like':'%'+_0x37ebb9[_0x2d38('0x33')][_0x2d38('0x3c')]+'%'};return _0x128914;}})});}_0x18e623=_[_0x2d38('0x3d')]({},_0x18e623,_0x37ebb9[_0x2d38('0x3e')]);var _0x40a901={'where':_0x18e623[_0x2d38('0x3a')]};return db[_0x2d38('0x3f')]['count'](_0x40a901)[_0x2d38('0x26')](function(_0x55ff72){_0x23457b[_0x2d38('0x21')]=_0x55ff72;if(_0x37ebb9[_0x2d38('0x33')]['includeAll']){_0x18e623['include']=[{'all':!![]}];}return db[_0x2d38('0x3f')][_0x2d38('0x40')](_0x18e623);})[_0x2d38('0x26')](function(_0x437b58){_0x23457b[_0x2d38('0x41')]=_0x437b58;return _0x23457b;})[_0x2d38('0x26')](respondWithFilteredResult(_0x37e832,_0x18e623))[_0x2d38('0x42')](handleError(_0x37e832,null));};exports[_0x2d38('0x43')]=function(_0x3d8176,_0x52b0aa){var _0x49ec99={'raw':!![],'where':{'id':_0x3d8176['params']['id']}},_0xc83d8d={};_0xc83d8d['model']=_['keys'](db[_0x2d38('0x3f')][_0x2d38('0x44')]);_0xc83d8d[_0x2d38('0x33')]=_['keys'](_0x3d8176['query']);_0xc83d8d[_0x2d38('0x35')]=_[_0x2d38('0x36')](_0xc83d8d[_0x2d38('0x32')],_0xc83d8d[_0x2d38('0x33')]);_0x49ec99['attributes']=_['intersection'](_0xc83d8d['model'],qs[_0x2d38('0x45')](_0x3d8176['query'][_0x2d38('0x45')]));_0x49ec99['attributes']=_0x49ec99[_0x2d38('0x37')][_0x2d38('0x46')]?_0x49ec99[_0x2d38('0x37')]:_0xc83d8d[_0x2d38('0x32')];if(_0x3d8176[_0x2d38('0x33')][_0x2d38('0x47')]){_0x49ec99[_0x2d38('0x48')]=[{'all':!![]}];}_0x49ec99=_['merge']({},_0x49ec99,_0x3d8176['options']);return db[_0x2d38('0x3f')][_0x2d38('0x49')](_0x49ec99)['then'](handleEntityNotFound(_0x52b0aa,null))['then'](respondWithResult(_0x52b0aa,null))['catch'](handleError(_0x52b0aa,null));};exports[_0x2d38('0x4a')]=function(_0x49f684,_0x418e1c){return db[_0x2d38('0x3f')]['create'](_0x49f684['body'],{})[_0x2d38('0x26')](respondWithResult(_0x418e1c,0xc9))[_0x2d38('0x42')](handleError(_0x418e1c,null));};exports[_0x2d38('0x25')]=function(_0x4b49d5,_0x332757){if(_0x4b49d5['body']['id']){delete _0x4b49d5[_0x2d38('0x4b')]['id'];}return db[_0x2d38('0x3f')][_0x2d38('0x49')]({'where':{'id':_0x4b49d5['params']['id']}})[_0x2d38('0x26')](handleEntityNotFound(_0x332757,null))[_0x2d38('0x26')](saveUpdates(_0x4b49d5[_0x2d38('0x4b')],null))['then'](respondWithResult(_0x332757,null))[_0x2d38('0x42')](handleError(_0x332757,null));};exports['destroy']=function(_0x1ad999,_0x2c8547){return db['VoiceDialReport'][_0x2d38('0x49')]({'where':{'id':_0x1ad999['params']['id']}})[_0x2d38('0x26')](handleEntityNotFound(_0x2c8547,null))['then'](removeEntity(_0x2c8547,null))[_0x2d38('0x42')](handleError(_0x2c8547,null));};exports['describe']=function(_0x34fae4,_0x5f4d6e){return db['VoiceDialReport']['describe']()[_0x2d38('0x26')](respondWithResult(_0x5f4d6e,null))['catch'](handleError(_0x5f4d6e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 4bc5801..d3fd51b 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 _0xf7fd=['../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment','request-promise','path'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0xf7fd,0xe2));var _0xdf7f=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xf7fd[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xdf7f('0x0'));var util=require('util');var logger=require(_0xdf7f('0x1'))('api');var moment=require(_0xdf7f('0x2'));var BPromise=require('bluebird');var rp=require(_0xdf7f('0x3'));var fs=require('fs');var path=require(_0xdf7f('0x4'));var rimraf=require('rimraf');var config=require(_0xdf7f('0x5'));var attributes=require(_0xdf7f('0x6'));module[_0xdf7f('0x7')]=function(_0x33e8f5,_0x1e3955){return _0x33e8f5['define'](_0xdf7f('0x8'),attributes,{'tableName':_0xdf7f('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdf7f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6317=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x6317,0x11a));var _0x7631=function(_0x13c308,_0x5d6285){_0x13c308=_0x13c308-0x0;var _0x5d3080=_0x6317[_0x13c308];return _0x5d3080;};'use strict';var _=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var logger=require(_0x7631('0x2'))(_0x7631('0x3'));var moment=require(_0x7631('0x4'));var BPromise=require(_0x7631('0x5'));var rp=require(_0x7631('0x6'));var fs=require('fs');var path=require(_0x7631('0x7'));var rimraf=require(_0x7631('0x8'));var config=require(_0x7631('0x9'));var attributes=require(_0x7631('0xa'));module[_0x7631('0xb')]=function(_0x50fd37,_0x4870ae){return _0x50fd37[_0x7631('0xc')](_0x7631('0xd'),attributes,{'tableName':_0x7631('0xe'),'paranoid':![],'indexes':[{'fields':[_0x7631('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0618fdc..55410d3 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 _0x5d49=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','VoiceDialReport','update','where','attributes','UpdateVoiceDialReport'];(function(_0x3b9bb5,_0x2e7fd7){var _0x4a5343=function(_0x28976f){while(--_0x28976f){_0x3b9bb5['push'](_0x3b9bb5['shift']());}};_0x4a5343(++_0x2e7fd7);}(_0x5d49,0x1e0));var _0x95d4=function(_0x3242f1,_0x32eaf8){_0x3242f1=_0x3242f1-0x0;var _0xd4be32=_0x5d49[_0x3242f1];return _0xd4be32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x95d4('0x0'));var BPromise=require(_0x95d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95d4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x95d4('0x3'));var logger=require(_0x95d4('0x4'))(_0x95d4('0x5'));var config=require(_0x95d4('0x6'));var jayson=require(_0x95d4('0x7'));var client=jayson[_0x95d4('0x8')][_0x95d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26867e,_0x359088,_0xd5d769){return new BPromise(function(_0x17a78a,_0x2894dd){return client[_0x95d4('0xa')](_0x26867e,_0xd5d769)[_0x95d4('0xb')](function(_0x1bb0e9){logger[_0x95d4('0xc')](_0x95d4('0xd'),_0x359088,_0x95d4('0xe'));logger[_0x95d4('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x359088,_0x95d4('0xe'),JSON[_0x95d4('0x10')](_0x1bb0e9));if(_0x1bb0e9[_0x95d4('0x11')]){if(_0x1bb0e9[_0x95d4('0x11')][_0x95d4('0x12')]===0x1f4){logger[_0x95d4('0x11')](_0x95d4('0xd'),_0x359088,_0x1bb0e9[_0x95d4('0x11')][_0x95d4('0x13')]);return _0x2894dd(_0x1bb0e9[_0x95d4('0x11')][_0x95d4('0x13')]);}logger[_0x95d4('0x11')](_0x95d4('0xd'),_0x359088,_0x1bb0e9['error']['message']);return _0x17a78a(_0x1bb0e9[_0x95d4('0x11')][_0x95d4('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x359088,_0x95d4('0xe'));_0x17a78a(_0x1bb0e9[_0x95d4('0x14')][_0x95d4('0x13')]);}})[_0x95d4('0x15')](function(_0x292e51){logger[_0x95d4('0x11')](_0x95d4('0xd'),_0x359088,_0x292e51);_0x2894dd(_0x292e51);});});}exports[_0x95d4('0x16')]=function(_0x3740f6){var _0x4f4a51=this;return new Promise(function(_0x4eeccd,_0xf0f4d9){return db['VoiceDialReport'][_0x95d4('0x17')](_0x3740f6[_0x95d4('0x18')],{'raw':_0x3740f6[_0x95d4('0x19')]?_0x3740f6[_0x95d4('0x19')][_0x95d4('0x1a')]===undefined?!![]:![]:!![]})[_0x95d4('0xb')](function(_0x469bc3){logger['info']('CreateVoiceDialReport',_0x3740f6);logger[_0x95d4('0xf')]('CreateVoiceDialReport',_0x3740f6,JSON[_0x95d4('0x10')](_0x469bc3));_0x4eeccd(_0x469bc3);})[_0x95d4('0x15')](function(_0x392ff9){logger[_0x95d4('0x11')](_0x95d4('0x16'),_0x392ff9[_0x95d4('0x13')],_0x3740f6);_0xf0f4d9(_0x4f4a51[_0x95d4('0x11')](0x1f4,_0x392ff9['message']));});});};exports['UpdateVoiceDialReport']=function(_0x8e19cb){var _0x3447ae=this;return new Promise(function(_0x35dc8d,_0x17d66c){return db[_0x95d4('0x1b')][_0x95d4('0x1c')](_0x8e19cb[_0x95d4('0x18')],{'raw':_0x8e19cb[_0x95d4('0x19')]?_0x8e19cb[_0x95d4('0x19')][_0x95d4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e19cb[_0x95d4('0x19')]?_0x8e19cb[_0x95d4('0x19')][_0x95d4('0x1d')]||null:null,'attributes':_0x8e19cb[_0x95d4('0x19')]?_0x8e19cb[_0x95d4('0x19')][_0x95d4('0x1e')]||null:null,'limit':_0x8e19cb[_0x95d4('0x19')]?_0x8e19cb[_0x95d4('0x19')]['limit']||null:null})[_0x95d4('0xb')](function(_0x5b1b14){logger['info'](_0x95d4('0x1f'),_0x8e19cb);logger[_0x95d4('0xf')]('UpdateVoiceDialReport',_0x8e19cb,JSON['stringify'](_0x5b1b14));_0x35dc8d(_0x5b1b14);})['catch'](function(_0x21633f){logger['error'](_0x95d4('0x1f'),_0x21633f[_0x95d4('0x13')],_0x8e19cb);_0x17d66c(_0x3447ae[_0x95d4('0x11')](0x1f4,_0x21633f[_0x95d4('0x13')]));});});}; \ No newline at end of file +var _0x598b=['debug','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw'];(function(_0xdc7003,_0x570d3b){var _0x4fa246=function(_0x4f6057){while(--_0x4f6057){_0xdc7003['push'](_0xdc7003['shift']());}};_0x4fa246(++_0x570d3b);}(_0x598b,0x12f));var _0xb598=function(_0x48f061,_0x7d83fc){_0x48f061=_0x48f061-0x0;var _0x3e16c2=_0x598b[_0x48f061];return _0x3e16c2;};'use strict';var _=require(_0xb598('0x0'));var util=require(_0xb598('0x1'));var moment=require('moment');var BPromise=require(_0xb598('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb598('0x3'));var db=require(_0xb598('0x4'))['db'];var utils=require(_0xb598('0x5'));var logger=require(_0xb598('0x6'))(_0xb598('0x7'));var config=require(_0xb598('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb598('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170b6a,_0x4d42bd,_0x1c6eed){return new BPromise(function(_0x2a6089,_0x306245){return client[_0xb598('0xa')](_0x170b6a,_0x1c6eed)[_0xb598('0xb')](function(_0x160317){logger[_0xb598('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x4d42bd,'request\x20sent');logger['debug'](_0xb598('0xd'),_0x4d42bd,_0xb598('0xe'),JSON[_0xb598('0xf')](_0x160317));if(_0x160317[_0xb598('0x10')]){if(_0x160317[_0xb598('0x10')]['code']===0x1f4){logger[_0xb598('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x4d42bd,_0x160317['error'][_0xb598('0x11')]);return _0x306245(_0x160317[_0xb598('0x10')][_0xb598('0x11')]);}logger[_0xb598('0x10')](_0xb598('0x12'),_0x4d42bd,_0x160317['error'][_0xb598('0x11')]);return _0x2a6089(_0x160317[_0xb598('0x10')][_0xb598('0x11')]);}else{logger[_0xb598('0xc')](_0xb598('0x12'),_0x4d42bd,'request\x20sent');_0x2a6089(_0x160317[_0xb598('0x13')][_0xb598('0x11')]);}})[_0xb598('0x14')](function(_0x20f36b){logger['error'](_0xb598('0x12'),_0x4d42bd,_0x20f36b);_0x306245(_0x20f36b);});});}exports[_0xb598('0x15')]=function(_0x3c97a4){var _0x287511=this;return new Promise(function(_0x5661b3,_0xb1a78a){return db[_0xb598('0x16')][_0xb598('0x17')](_0x3c97a4[_0xb598('0x18')],{'raw':_0x3c97a4['options']?_0x3c97a4[_0xb598('0x19')][_0xb598('0x1a')]===undefined?!![]:![]:!![]})[_0xb598('0xb')](function(_0x5764c9){logger[_0xb598('0xc')](_0xb598('0x15'),_0x3c97a4);logger[_0xb598('0x1b')]('CreateVoiceDialReport',_0x3c97a4,JSON['stringify'](_0x5764c9));_0x5661b3(_0x5764c9);})[_0xb598('0x14')](function(_0x5aa7b8){logger[_0xb598('0x10')](_0xb598('0x15'),_0x5aa7b8['message'],_0x3c97a4);_0xb1a78a(_0x287511[_0xb598('0x10')](0x1f4,_0x5aa7b8[_0xb598('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x5beb5c){var _0x8dc788=this;return new Promise(function(_0x3c3944,_0x306140){return db[_0xb598('0x16')][_0xb598('0x1c')](_0x5beb5c[_0xb598('0x18')],{'raw':_0x5beb5c[_0xb598('0x19')]?_0x5beb5c[_0xb598('0x19')][_0xb598('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5beb5c[_0xb598('0x19')]?_0x5beb5c[_0xb598('0x19')][_0xb598('0x1d')]||null:null,'attributes':_0x5beb5c[_0xb598('0x19')]?_0x5beb5c[_0xb598('0x19')][_0xb598('0x1e')]||null:null,'limit':_0x5beb5c['options']?_0x5beb5c[_0xb598('0x19')][_0xb598('0x1f')]||null:null})[_0xb598('0xb')](function(_0x295fda){logger['info']('UpdateVoiceDialReport',_0x5beb5c);logger[_0xb598('0x1b')](_0xb598('0x20'),_0x5beb5c,JSON[_0xb598('0xf')](_0x295fda));_0x3c3944(_0x295fda);})['catch'](function(_0x8d081){logger[_0xb598('0x10')](_0xb598('0x20'),_0x8d081[_0xb598('0x11')],_0x5beb5c);_0x306140(_0x8dc788['error'](0x1f4,_0x8d081[_0xb598('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7239da5..d1b7db1 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 _0x4f6a=['destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','./voiceExtension.controller','index','/:id','isAuthenticated','show','post','create','/:id/applications','update','delete'];(function(_0x3980dc,_0x58fe92){var _0x40c85a=function(_0x5187cc){while(--_0x5187cc){_0x3980dc['push'](_0x3980dc['shift']());}};_0x40c85a(++_0x58fe92);}(_0x4f6a,0x1f2));var _0xa4f6=function(_0x5285a2,_0x1949c0){_0x5285a2=_0x5285a2-0x0;var _0x4222dc=_0x4f6a[_0x5285a2];return _0x4222dc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa4f6('0x0'));var express=require(_0xa4f6('0x1'));var router=express['Router']();var fs_extra=require(_0xa4f6('0x2'));var auth=require(_0xa4f6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4f6('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xa4f6('0x5')]);router['get'](_0xa4f6('0x6'),auth[_0xa4f6('0x7')](),controller[_0xa4f6('0x8')]);router[_0xa4f6('0x9')]('/',auth['isAuthenticated'](),controller[_0xa4f6('0xa')]);router[_0xa4f6('0x9')](_0xa4f6('0xb'),auth[_0xa4f6('0x7')](),controller['addApplications']);router['put'](_0xa4f6('0x6'),auth['isAuthenticated'](),controller[_0xa4f6('0xc')]);router[_0xa4f6('0xd')]('/:id',auth[_0xa4f6('0x7')](),controller[_0xa4f6('0xe')]);module[_0xa4f6('0xf')]=router; \ No newline at end of file +var _0x7bc8=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','post','/:id/applications','addApplications','put','update','destroy','exports','multer','util','path'];(function(_0x22cf4c,_0x2e805c){var _0x338cc2=function(_0x3b0a45){while(--_0x3b0a45){_0x22cf4c['push'](_0x22cf4c['shift']());}};_0x338cc2(++_0x2e805c);}(_0x7bc8,0x189));var _0x87bc=function(_0x3aaf69,_0x318ff9){_0x3aaf69=_0x3aaf69-0x0;var _0x4542c6=_0x7bc8[_0x3aaf69];return _0x4542c6;};'use strict';var multer=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var path=require(_0x87bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x87bc('0x3'));var router=express[_0x87bc('0x4')]();var fs_extra=require(_0x87bc('0x5'));var auth=require(_0x87bc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x87bc('0x7')]('/',auth[_0x87bc('0x8')](),controller[_0x87bc('0x9')]);router['get'](_0x87bc('0xa'),auth[_0x87bc('0x8')](),controller['show']);router[_0x87bc('0xb')]('/',auth[_0x87bc('0x8')](),controller['create']);router['post'](_0x87bc('0xc'),auth[_0x87bc('0x8')](),controller[_0x87bc('0xd')]);router[_0x87bc('0xe')](_0x87bc('0xa'),auth[_0x87bc('0x8')](),controller[_0x87bc('0xf')]);router['delete'](_0x87bc('0xa'),auth[_0x87bc('0x8')](),controller[_0x87bc('0x10')]);module[_0x87bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 6a86c22..86ccc05 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x43244c,_0xa2a77f){var _0x34babb=function(_0x4f7818){while(--_0x4f7818){_0x43244c['push'](_0x43244c['shift']());}};_0x34babb(++_0xa2a77f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 76e706b..2026aa6 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 _0x88fd=['then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','stack','index','VoiceExtension','rawAttributes','fieldName','key','query','intersection','model','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','catch','keys','options','params','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy'];(function(_0x5bd4fc,_0x2f9cdf){var _0x4aa866=function(_0x5dc561){while(--_0x5dc561){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x4aa866(++_0x2f9cdf);}(_0x88fd,0x1b6));var _0xd88f=function(_0x3d1f75,_0x22e887){_0x3d1f75=_0x3d1f75-0x0;var _0x36b5d1=_0x88fd[_0x3d1f75];return _0x36b5d1;};'use strict';var _=require(_0xd88f('0x0'));var Redis=require(_0xd88f('0x1'));var qs=require(_0xd88f('0x2'));var logger=require(_0xd88f('0x3'))(_0xd88f('0x4'));var config=require(_0xd88f('0x5'));var db=require(_0xd88f('0x6'))['db'];config[_0xd88f('0x7')]=_[_0xd88f('0x8')](config[_0xd88f('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd88f('0x9'))(new Redis(config[_0xd88f('0x7')]));require(_0xd88f('0xa'))[_0xd88f('0xb')](socket);function respondWithStatusCode(_0x3932c1,_0x972f3d){_0x972f3d=_0x972f3d||0xcc;return function(_0x3ecd8f){if(_0x3ecd8f){return _0x3932c1['sendStatus'](_0x972f3d);}return _0x3932c1[_0xd88f('0xc')](_0x972f3d)[_0xd88f('0xd')]();};}function respondWithResult(_0x216fae,_0x18ae98){_0x18ae98=_0x18ae98||0xc8;return function(_0x244822){if(_0x244822){return _0x216fae['status'](_0x18ae98)[_0xd88f('0xe')](_0x244822);}};}function respondWithFilteredResult(_0x562be8,_0x500051){return function(_0x39dc90){if(_0x39dc90){var _0x2c6771=typeof _0x500051['offset']===_0xd88f('0xf')&&typeof _0x500051[_0xd88f('0x10')]==='undefined';var _0x3bc682=_0x39dc90['count'];var _0x5b1510=_0x2c6771?0x0:_0x500051['offset'];var _0x5e2ec6=_0x2c6771?_0x39dc90[_0xd88f('0x11')]:_0x500051[_0xd88f('0x12')]+_0x500051['limit'];var _0x115c88;if(_0x5e2ec6>=_0x3bc682){_0x5e2ec6=_0x3bc682;_0x115c88=0xc8;}else{_0x115c88=0xce;}_0x562be8['status'](_0x115c88);return _0x562be8[_0xd88f('0x13')](_0xd88f('0x14'),_0x5b1510+'-'+_0x5e2ec6+'/'+_0x3bc682)[_0xd88f('0xe')](_0x39dc90);}return null;};}function removeEntity(_0x10c84f){return function(_0x3cf624){if(_0x3cf624){return _0x3cf624[_0xd88f('0x15')]()[_0xd88f('0x16')](function(){var _0x4b8f52=_0x3cf624[_0xd88f('0x17')]({'plain':!![]});var _0x29a3c9=[{'name':_0xd88f('0x18'),'value':_0xd88f('0x19'),'ignore':![]},{'name':_0xd88f('0x1a'),'value':'outbound','ignore':![]},{'name':_0xd88f('0x1b'),'value':_0xd88f('0x1c'),'ignore':![]}];var _0x6dd838=_(_0x29a3c9)[_0xd88f('0x1d')](_0xd88f('0x1e'))[_0xd88f('0x1f')](_0xd88f('0x20'))[_0xd88f('0x20')]();if(_[_0xd88f('0x21')](_0x6dd838,_0x4b8f52[_0xd88f('0x22')])){return;}var _0x3527ba=_[_0xd88f('0x23')](_0x29a3c9,[_0xd88f('0x20'),_0x4b8f52['type']])[_0xd88f('0x24')];return db[_0xd88f('0x25')][_0xd88f('0x15')]({'where':{'type':_0x3527ba,'resourceId':_0x4b8f52['id']}})[_0xd88f('0x16')](function(){return _0x3cf624;});})['then'](function(){_0x10c84f[_0xd88f('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25504f){return function(_0x4ec074){if(!_0x4ec074){_0x25504f[_0xd88f('0x26')](0x194);}return _0x4ec074;};}function handleError(_0x3e1598,_0x3ef369){_0x3ef369=_0x3ef369||0x1f4;return function(_0xc77a23){logger['error'](_0xc77a23[_0xd88f('0x27')]);if(_0xc77a23[_0xd88f('0x24')]){delete _0xc77a23[_0xd88f('0x24')];}_0x3e1598[_0xd88f('0xc')](_0x3ef369)['send'](_0xc77a23);};}exports[_0xd88f('0x28')]=function(_0x29bbca,_0x3ee53b){var _0x4f0b9f={},_0x3a3fa6={},_0x545e46={'count':0x0,'rows':[]};var _0x41eafd=_[_0xd88f('0x1f')](db[_0xd88f('0x29')][_0xd88f('0x2a')],function(_0x403730){return{'name':_0x403730[_0xd88f('0x2b')],'type':_0x403730['type'][_0xd88f('0x2c')]};});_0x3a3fa6['model']=_[_0xd88f('0x1f')](_0x41eafd,_0xd88f('0x24'));_0x3a3fa6[_0xd88f('0x2d')]=_['keys'](_0x29bbca[_0xd88f('0x2d')]);_0x3a3fa6['filters']=_[_0xd88f('0x2e')](_0x3a3fa6[_0xd88f('0x2f')],_0x3a3fa6[_0xd88f('0x2d')]);_0x4f0b9f['attributes']=_[_0xd88f('0x2e')](_0x3a3fa6[_0xd88f('0x2f')],qs[_0xd88f('0x30')](_0x29bbca[_0xd88f('0x2d')]['fields']));_0x4f0b9f[_0xd88f('0x31')]=_0x4f0b9f[_0xd88f('0x31')][_0xd88f('0x32')]?_0x4f0b9f[_0xd88f('0x31')]:_0x3a3fa6[_0xd88f('0x2f')];if(!_0x29bbca[_0xd88f('0x2d')]['hasOwnProperty']('nolimit')){_0x4f0b9f[_0xd88f('0x10')]=qs[_0xd88f('0x10')](_0x29bbca[_0xd88f('0x2d')][_0xd88f('0x10')]);_0x4f0b9f[_0xd88f('0x12')]=qs['offset'](_0x29bbca[_0xd88f('0x2d')][_0xd88f('0x12')]);}_0x4f0b9f[_0xd88f('0x33')]=qs[_0xd88f('0x34')](_0x29bbca['query'][_0xd88f('0x34')]);_0x4f0b9f[_0xd88f('0x35')]=qs[_0xd88f('0x36')](_[_0xd88f('0x37')](_0x29bbca['query'],_0x3a3fa6[_0xd88f('0x36')]),_0x41eafd);if(_0x29bbca['query'][_0xd88f('0x1d')]){_0x4f0b9f[_0xd88f('0x35')]=_[_0xd88f('0x38')](_0x4f0b9f[_0xd88f('0x35')],{'$or':_[_0xd88f('0x1f')](_0x41eafd,function(_0x5a11ba){if(_0x5a11ba['type']!==_0xd88f('0x39')){var _0x18f2db={};_0x18f2db[_0x5a11ba[_0xd88f('0x24')]]={'$like':'%'+_0x29bbca[_0xd88f('0x2d')][_0xd88f('0x1d')]+'%'};return _0x18f2db;}})});}_0x4f0b9f=_['merge']({},_0x4f0b9f,_0x29bbca['options']);var _0x4ef0b2={'where':_0x4f0b9f['where']};return db[_0xd88f('0x29')][_0xd88f('0x11')](_0x4ef0b2)['then'](function(_0x3c76db){_0x545e46['count']=_0x3c76db;if(_0x29bbca[_0xd88f('0x2d')][_0xd88f('0x3a')]){_0x4f0b9f[_0xd88f('0x3b')]=[{'all':!![]}];}return db[_0xd88f('0x29')][_0xd88f('0x3c')](_0x4f0b9f);})['then'](function(_0x315951){_0x545e46['rows']=_0x315951;return _0x545e46;})[_0xd88f('0x16')](respondWithFilteredResult(_0x3ee53b,_0x4f0b9f))[_0xd88f('0x3d')](handleError(_0x3ee53b,null));};exports['show']=function(_0x2212aa,_0x5bc092){var _0x5e0816={'raw':![],'where':{'id':_0x2212aa['params']['id']}},_0x2ed9fc={};_0x2ed9fc[_0xd88f('0x2f')]=_[_0xd88f('0x3e')](db[_0xd88f('0x29')]['rawAttributes']);_0x2ed9fc[_0xd88f('0x2d')]=_['keys'](_0x2212aa[_0xd88f('0x2d')]);_0x2ed9fc['filters']=_[_0xd88f('0x2e')](_0x2ed9fc[_0xd88f('0x2f')],_0x2ed9fc['query']);_0x5e0816[_0xd88f('0x31')]=_['intersection'](_0x2ed9fc[_0xd88f('0x2f')],qs[_0xd88f('0x30')](_0x2212aa[_0xd88f('0x2d')][_0xd88f('0x30')]));_0x5e0816['attributes']=_0x5e0816[_0xd88f('0x31')][_0xd88f('0x32')]?_0x5e0816[_0xd88f('0x31')]:_0x2ed9fc['model'];if(_0x2212aa[_0xd88f('0x2d')]['includeAll']){_0x5e0816[_0xd88f('0x3b')]=[{'all':!![]}];}_0x5e0816=_['merge']({},_0x5e0816,_0x2212aa[_0xd88f('0x3f')]);return db[_0xd88f('0x29')]['find'](_0x5e0816)[_0xd88f('0x16')](handleEntityNotFound(_0x5bc092,null))[_0xd88f('0x16')](respondWithResult(_0x5bc092,null))[_0xd88f('0x3d')](handleError(_0x5bc092,null));};exports[_0xd88f('0x15')]=function(_0x4c460e,_0x33110f){return db[_0xd88f('0x29')]['find']({'where':{'id':_0x4c460e[_0xd88f('0x40')]['id']}})[_0xd88f('0x16')](handleEntityNotFound(_0x33110f,null))[_0xd88f('0x16')](removeEntity(_0x33110f,null))['catch'](handleError(_0x33110f,null));};exports['create']=function(_0x5ee081,_0x3f25ff){if(_0x5ee081[_0xd88f('0x41')][_0xd88f('0x22')]==='outbound'&&!_[_0xd88f('0x42')](_0x5ee081['body'][_0xd88f('0x43')],'_')){_0x5ee081['body']['exten']='_'[_0xd88f('0x44')](_0x5ee081['body'][_0xd88f('0x43')]);}return db[_0xd88f('0x29')][_0xd88f('0x45')](_0x5ee081[_0xd88f('0x41')],{'raw':![]})[_0xd88f('0x16')](function(_0x43330a){var _0x42b97a=_0x5ee081[_0xd88f('0x46')][_0xd88f('0x17')]({'plain':!![]});if(!_0x42b97a)throw new Error(_0xd88f('0x47'));if(_0x42b97a[_0xd88f('0x48')]==='user'){var _0x4fa603=_0x43330a['get']({'plain':!![]});var _0x3ea30d=[{'name':_0xd88f('0x18'),'value':'inbound'},{'name':_0xd88f('0x1a'),'value':'outbound'},{'name':_0xd88f('0x1b'),'value':_0xd88f('0x1c')}];var _0x2517d3=_[_0xd88f('0x23')](_0x3ea30d,[_0xd88f('0x20'),_0x4fa603['type']])[_0xd88f('0x24')];return db[_0xd88f('0x49')][_0xd88f('0x23')]({'where':{'name':_0x2517d3,'userProfileId':_0x42b97a[_0xd88f('0x4a')]},'raw':!![]})[_0xd88f('0x16')](function(_0x4daed5){if(_0x4daed5&&_0x4daed5[_0xd88f('0x4b')]===0x0){return db['UserProfileResource'][_0xd88f('0x45')]({'name':_0x4fa603[_0xd88f('0x24')],'resourceId':_0x4fa603['id'],'type':_0x4daed5['name'],'sectionId':_0x4daed5['id']},{})['then'](function(){return _0x43330a;});}else{return _0x43330a;}})[_0xd88f('0x3d')](function(_0x31f762){logger[_0xd88f('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31f762);throw _0x31f762;});}return _0x43330a;})[_0xd88f('0x16')](respondWithResult(_0x3f25ff,0xc9))['catch'](handleError(_0x3f25ff,null));};exports['update']=function(_0x256ea7,_0x3ac0af){if(_0x256ea7['body']['id']){delete _0x256ea7[_0xd88f('0x41')]['id'];}return db[_0xd88f('0x29')]['find']({'where':{'id':_0x256ea7[_0xd88f('0x40')]['id']}})[_0xd88f('0x16')](handleEntityNotFound(_0x3ac0af,null))[_0xd88f('0x16')](function(_0x69027){if(_0x69027){return db[_0xd88f('0x29')][_0xd88f('0x4d')](_[_0xd88f('0x37')](_0x256ea7['body'],[_0xd88f('0x43'),_0xd88f('0x4e'),'description',_0xd88f('0x4f'),'cutdigits',_0xd88f('0x50'),_0xd88f('0x51')]),{'where':{'context':_0x69027[_0xd88f('0x4e')],'exten':_0x69027[_0xd88f('0x43')]},'individualHooks':!![]})[_0xd88f('0x16')](function(_0x60ce0e){return _0x60ce0e;});}return null;})[_0xd88f('0x16')](respondWithStatusCode(_0x3ac0af,null))['catch'](handleError(_0x3ac0af,null));};exports[_0xd88f('0x52')]=function(_0x5b110f,_0x568189){var _0x54778d=_0x5b110f['params']['id'];var _0x3fadd7=_0x5b110f[_0xd88f('0x41')];var _0x3ffa9f=0xc8;var _0x3358d6=null;return db[_0xd88f('0x53')]['transaction']({'isolationLevel':db[_0xd88f('0x53')][_0xd88f('0x54')][_0xd88f('0x55')]['READ_COMMITTED']},function(_0x571c6f){return db['VoiceExtension'][_0xd88f('0x56')]({'where':{'id':_0x54778d},'transaction':_0x571c6f})[_0xd88f('0x16')](function(_0x590664){if(_0x590664){return db[_0xd88f('0x29')]['destroy']({'where':{'VoiceExtensionId':_0x54778d},'transaction':_0x571c6f})[_0xd88f('0x16')](function(){var _0x5050a4=_[_0xd88f('0x1f')](_0x3fadd7,function(_0x48b6dc){_0x48b6dc['VoiceExtensionId']=_0x54778d;_0x48b6dc[_0xd88f('0x57')]=!![];return _0x48b6dc;});return _0x590664['createRouting'](_0x5050a4);})[_0xd88f('0x16')](function(_0x343a02){return db[_0xd88f('0x29')]['bulkCreate'](_0x343a02,{'transaction':_0x571c6f});});}else{_0x3ffa9f=0x194;_0x3358d6=[];}});})[_0xd88f('0x16')](function(){if(_0x3ffa9f!==0x194){return db['VoiceExtension'][_0xd88f('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x54778d},'order':_0xd88f('0x59')})[_0xd88f('0x16')](function(_0x427a77){_0x3358d6=_0x427a77;});}})[_0xd88f('0x3d')](function(_0x5c54d2){_0x3ffa9f=0x1f4;logger[_0xd88f('0x4c')](_0x5c54d2[_0xd88f('0x27')]);if(_0x5c54d2[_0xd88f('0x24')]){delete _0x5c54d2[_0xd88f('0x24')];}_0x3358d6=_0x5c54d2;})[_0xd88f('0x5a')](function(){if(_0x3358d6===null){_0x568189['sendStatus'](_0x3ffa9f);}else{if(_0x3ffa9f===0x1f4){_0x568189[_0xd88f('0xc')](_0x3ffa9f)[_0xd88f('0x5b')](_0x3358d6);}else{_0x568189[_0xd88f('0xc')](_0x3ffa9f)['json'](_0x3358d6);}}});}; \ No newline at end of file +var _0x608f=['findAll','rows','catch','show','params','keys','find','body','outbound','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','InboundRoutes','InternalRoutes','internal','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','mandatoryDisposition','alias','context','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','destroy','then','inbound','OutboundRoutes','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x608f,0x137));var _0xf608=function(_0x1ffd30,_0x74e65c){_0x1ffd30=_0x1ffd30-0x0;var _0xf06205=_0x608f[_0x1ffd30];return _0xf06205;};'use strict';var _=require('lodash');var Redis=require(_0xf608('0x0'));var qs=require(_0xf608('0x1'));var logger=require(_0xf608('0x2'))('api');var config=require(_0xf608('0x3'));var db=require('../../mysqldb')['db'];config[_0xf608('0x4')]=_[_0xf608('0x5')](config[_0xf608('0x4')],{'host':_0xf608('0x6'),'port':0x18eb});var socket=require(_0xf608('0x7'))(new Redis(config['redis']));require(_0xf608('0x8'))[_0xf608('0x9')](socket);function respondWithStatusCode(_0x3b47dd,_0x1ee944){_0x1ee944=_0x1ee944||0xcc;return function(_0x457cb0){if(_0x457cb0){return _0x3b47dd[_0xf608('0xa')](_0x1ee944);}return _0x3b47dd[_0xf608('0xb')](_0x1ee944)['end']();};}function respondWithResult(_0x2f6896,_0x3ca217){_0x3ca217=_0x3ca217||0xc8;return function(_0x312506){if(_0x312506){return _0x2f6896[_0xf608('0xb')](_0x3ca217)[_0xf608('0xc')](_0x312506);}};}function respondWithFilteredResult(_0x81c63e,_0x1e701b){return function(_0x3837ff){if(_0x3837ff){var _0x432670=typeof _0x1e701b[_0xf608('0xd')]===_0xf608('0xe')&&typeof _0x1e701b['limit']===_0xf608('0xe');var _0x3b7b32=_0x3837ff['count'];var _0x4937f3=_0x432670?0x0:_0x1e701b[_0xf608('0xd')];var _0x39e366=_0x432670?_0x3837ff[_0xf608('0xf')]:_0x1e701b[_0xf608('0xd')]+_0x1e701b['limit'];var _0x442d2c;if(_0x39e366>=_0x3b7b32){_0x39e366=_0x3b7b32;_0x442d2c=0xc8;}else{_0x442d2c=0xce;}_0x81c63e[_0xf608('0xb')](_0x442d2c);return _0x81c63e[_0xf608('0x10')](_0xf608('0x11'),_0x4937f3+'-'+_0x39e366+'/'+_0x3b7b32)[_0xf608('0xc')](_0x3837ff);}return null;};}function removeEntity(_0x1e75ff){return function(_0x1956ad){if(_0x1956ad){return _0x1956ad[_0xf608('0x12')]()[_0xf608('0x13')](function(){var _0x14cea1=_0x1956ad['get']({'plain':!![]});var _0x2bc33b=[{'name':'InboundRoutes','value':_0xf608('0x14'),'ignore':![]},{'name':_0xf608('0x15'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x59b8d9=_(_0x2bc33b)['filter']('ignore')[_0xf608('0x16')](_0xf608('0x17'))['value']();if(_[_0xf608('0x18')](_0x59b8d9,_0x14cea1[_0xf608('0x19')])){return;}var _0x1a68d8=_['find'](_0x2bc33b,[_0xf608('0x17'),_0x14cea1[_0xf608('0x19')]])[_0xf608('0x1a')];return db[_0xf608('0x1b')][_0xf608('0x12')]({'where':{'type':_0x1a68d8,'resourceId':_0x14cea1['id']}})[_0xf608('0x13')](function(){return _0x1956ad;});})['then'](function(){_0x1e75ff[_0xf608('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471e0d){return function(_0x200577){if(!_0x200577){_0x471e0d[_0xf608('0xa')](0x194);}return _0x200577;};}function handleError(_0x22a795,_0x4c26b2){_0x4c26b2=_0x4c26b2||0x1f4;return function(_0x39ee0e){logger[_0xf608('0x1c')](_0x39ee0e['stack']);if(_0x39ee0e[_0xf608('0x1a')]){delete _0x39ee0e[_0xf608('0x1a')];}_0x22a795['status'](_0x4c26b2)[_0xf608('0x1d')](_0x39ee0e);};}exports[_0xf608('0x1e')]=function(_0x3a7ee3,_0x2dd06c){var _0x2f5846={},_0x168876={},_0x2b03d7={'count':0x0,'rows':[]};var _0x43dbad=_[_0xf608('0x16')](db[_0xf608('0x1f')][_0xf608('0x20')],function(_0x88bcf6){return{'name':_0x88bcf6[_0xf608('0x21')],'type':_0x88bcf6[_0xf608('0x19')][_0xf608('0x22')]};});_0x168876[_0xf608('0x23')]=_['map'](_0x43dbad,_0xf608('0x1a'));_0x168876[_0xf608('0x24')]=_['keys'](_0x3a7ee3[_0xf608('0x24')]);_0x168876['filters']=_[_0xf608('0x25')](_0x168876[_0xf608('0x23')],_0x168876['query']);_0x2f5846[_0xf608('0x26')]=_[_0xf608('0x25')](_0x168876[_0xf608('0x23')],qs[_0xf608('0x27')](_0x3a7ee3[_0xf608('0x24')][_0xf608('0x27')]));_0x2f5846[_0xf608('0x26')]=_0x2f5846[_0xf608('0x26')]['length']?_0x2f5846['attributes']:_0x168876[_0xf608('0x23')];if(!_0x3a7ee3[_0xf608('0x24')]['hasOwnProperty'](_0xf608('0x28'))){_0x2f5846['limit']=qs[_0xf608('0x29')](_0x3a7ee3[_0xf608('0x24')][_0xf608('0x29')]);_0x2f5846[_0xf608('0xd')]=qs['offset'](_0x3a7ee3['query']['offset']);}_0x2f5846[_0xf608('0x2a')]=qs[_0xf608('0x2b')](_0x3a7ee3['query'][_0xf608('0x2b')]);_0x2f5846['where']=qs[_0xf608('0x2c')](_[_0xf608('0x2d')](_0x3a7ee3[_0xf608('0x24')],_0x168876[_0xf608('0x2c')]),_0x43dbad);if(_0x3a7ee3[_0xf608('0x24')][_0xf608('0x2e')]){_0x2f5846[_0xf608('0x2f')]=_[_0xf608('0x30')](_0x2f5846[_0xf608('0x2f')],{'$or':_[_0xf608('0x16')](_0x43dbad,function(_0x573ede){if(_0x573ede['type']!==_0xf608('0x31')){var _0x19df67={};_0x19df67[_0x573ede['name']]={'$like':'%'+_0x3a7ee3[_0xf608('0x24')]['filter']+'%'};return _0x19df67;}})});}_0x2f5846=_[_0xf608('0x30')]({},_0x2f5846,_0x3a7ee3[_0xf608('0x32')]);var _0x5f4265={'where':_0x2f5846[_0xf608('0x2f')]};return db[_0xf608('0x1f')][_0xf608('0xf')](_0x5f4265)['then'](function(_0x19bb95){_0x2b03d7[_0xf608('0xf')]=_0x19bb95;if(_0x3a7ee3[_0xf608('0x24')][_0xf608('0x33')]){_0x2f5846[_0xf608('0x34')]=[{'all':!![]}];}return db[_0xf608('0x1f')][_0xf608('0x35')](_0x2f5846);})[_0xf608('0x13')](function(_0x3d79f9){_0x2b03d7[_0xf608('0x36')]=_0x3d79f9;return _0x2b03d7;})[_0xf608('0x13')](respondWithFilteredResult(_0x2dd06c,_0x2f5846))[_0xf608('0x37')](handleError(_0x2dd06c,null));};exports[_0xf608('0x38')]=function(_0x3a1042,_0x18ca23){var _0x195d69={'raw':![],'where':{'id':_0x3a1042[_0xf608('0x39')]['id']}},_0x1b1c09={};_0x1b1c09[_0xf608('0x23')]=_['keys'](db['VoiceExtension'][_0xf608('0x20')]);_0x1b1c09[_0xf608('0x24')]=_[_0xf608('0x3a')](_0x3a1042[_0xf608('0x24')]);_0x1b1c09[_0xf608('0x2c')]=_[_0xf608('0x25')](_0x1b1c09[_0xf608('0x23')],_0x1b1c09[_0xf608('0x24')]);_0x195d69[_0xf608('0x26')]=_['intersection'](_0x1b1c09[_0xf608('0x23')],qs[_0xf608('0x27')](_0x3a1042[_0xf608('0x24')][_0xf608('0x27')]));_0x195d69[_0xf608('0x26')]=_0x195d69[_0xf608('0x26')]['length']?_0x195d69[_0xf608('0x26')]:_0x1b1c09[_0xf608('0x23')];if(_0x3a1042[_0xf608('0x24')][_0xf608('0x33')]){_0x195d69[_0xf608('0x34')]=[{'all':!![]}];}_0x195d69=_[_0xf608('0x30')]({},_0x195d69,_0x3a1042[_0xf608('0x32')]);return db[_0xf608('0x1f')][_0xf608('0x3b')](_0x195d69)['then'](handleEntityNotFound(_0x18ca23,null))[_0xf608('0x13')](respondWithResult(_0x18ca23,null))['catch'](handleError(_0x18ca23,null));};exports[_0xf608('0x12')]=function(_0x3f5c7f,_0x1881c6){return db['VoiceExtension']['find']({'where':{'id':_0x3f5c7f[_0xf608('0x39')]['id']}})[_0xf608('0x13')](handleEntityNotFound(_0x1881c6,null))[_0xf608('0x13')](removeEntity(_0x1881c6,null))['catch'](handleError(_0x1881c6,null));};exports['create']=function(_0x1594f2,_0x1c8d31){if(_0x1594f2[_0xf608('0x3c')]['type']===_0xf608('0x3d')&&!_['startsWith'](_0x1594f2[_0xf608('0x3c')][_0xf608('0x3e')],'_')){_0x1594f2['body'][_0xf608('0x3e')]='_'[_0xf608('0x3f')](_0x1594f2['body'][_0xf608('0x3e')]);}return db['VoiceExtension'][_0xf608('0x40')](_0x1594f2[_0xf608('0x3c')],{'raw':![]})['then'](function(_0x41ae94){var _0x4996c8=_0x1594f2[_0xf608('0x41')]['get']({'plain':!![]});if(!_0x4996c8)throw new Error(_0xf608('0x42'));if(_0x4996c8['role']===_0xf608('0x41')){var _0x3a8b5d=_0x41ae94[_0xf608('0x43')]({'plain':!![]});var _0x28ce78=[{'name':_0xf608('0x44'),'value':_0xf608('0x14')},{'name':_0xf608('0x15'),'value':_0xf608('0x3d')},{'name':_0xf608('0x45'),'value':_0xf608('0x46')}];var _0x10c717=_[_0xf608('0x3b')](_0x28ce78,[_0xf608('0x17'),_0x3a8b5d[_0xf608('0x19')]])[_0xf608('0x1a')];return db[_0xf608('0x47')]['find']({'where':{'name':_0x10c717,'userProfileId':_0x4996c8[_0xf608('0x48')]},'raw':!![]})[_0xf608('0x13')](function(_0x2fd96b){if(_0x2fd96b&&_0x2fd96b['autoAssociation']===0x0){return db[_0xf608('0x1b')][_0xf608('0x40')]({'name':_0x3a8b5d[_0xf608('0x1a')],'resourceId':_0x3a8b5d['id'],'type':_0x2fd96b[_0xf608('0x1a')],'sectionId':_0x2fd96b['id']},{})[_0xf608('0x13')](function(){return _0x41ae94;});}else{return _0x41ae94;}})['catch'](function(_0x1549a3){logger[_0xf608('0x1c')](_0xf608('0x49'),_0x1549a3);throw _0x1549a3;});}return _0x41ae94;})[_0xf608('0x13')](respondWithResult(_0x1c8d31,0xc9))[_0xf608('0x37')](handleError(_0x1c8d31,null));};exports[_0xf608('0x4a')]=function(_0x1f83b4,_0xefa10a){if(_0x1f83b4[_0xf608('0x3c')]['id']){delete _0x1f83b4[_0xf608('0x3c')]['id'];}return db[_0xf608('0x1f')][_0xf608('0x3b')]({'where':{'id':_0x1f83b4[_0xf608('0x39')]['id']}})['then'](handleEntityNotFound(_0xefa10a,null))[_0xf608('0x13')](function(_0x55c8b5){if(_0x55c8b5){return db['VoiceExtension'][_0xf608('0x4a')](_['pick'](_0x1f83b4[_0xf608('0x3c')],[_0xf608('0x3e'),'context','description',_0xf608('0x4b'),'cutdigits',_0xf608('0x4c'),_0xf608('0x4d')]),{'where':{'context':_0x55c8b5[_0xf608('0x4e')],'exten':_0x55c8b5[_0xf608('0x3e')]},'individualHooks':!![]})['then'](function(_0x411e98){return _0x411e98;});}return null;})[_0xf608('0x13')](respondWithStatusCode(_0xefa10a,null))[_0xf608('0x37')](handleError(_0xefa10a,null));};exports[_0xf608('0x4f')]=function(_0x5e088f,_0x106b3e){var _0x166a37=_0x5e088f['params']['id'];var _0x5a7457=_0x5e088f[_0xf608('0x3c')];var _0x2e1c10=0xc8;var _0xee933d=null;return db[_0xf608('0x50')]['transaction']({'isolationLevel':db[_0xf608('0x50')]['Transaction'][_0xf608('0x51')][_0xf608('0x52')]},function(_0xf3ff35){return db[_0xf608('0x1f')][_0xf608('0x53')]({'where':{'id':_0x166a37},'transaction':_0xf3ff35})[_0xf608('0x13')](function(_0x14fe10){if(_0x14fe10){return db[_0xf608('0x1f')][_0xf608('0x12')]({'where':{'VoiceExtensionId':_0x166a37},'transaction':_0xf3ff35})[_0xf608('0x13')](function(){var _0x29b88f=_['map'](_0x5a7457,function(_0x288119){_0x288119[_0xf608('0x54')]=_0x166a37;_0x288119[_0xf608('0x55')]=!![];return _0x288119;});return _0x14fe10[_0xf608('0x56')](_0x29b88f);})[_0xf608('0x13')](function(_0x4fa528){return db[_0xf608('0x1f')][_0xf608('0x57')](_0x4fa528,{'transaction':_0xf3ff35});});}else{_0x2e1c10=0x194;_0xee933d=[];}});})['then'](function(){if(_0x2e1c10!==0x194){return db[_0xf608('0x1f')][_0xf608('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x166a37},'order':_0xf608('0x59')})[_0xf608('0x13')](function(_0x374f4c){_0xee933d=_0x374f4c;});}})[_0xf608('0x37')](function(_0x35fab5){_0x2e1c10=0x1f4;logger[_0xf608('0x1c')](_0x35fab5['stack']);if(_0x35fab5[_0xf608('0x1a')]){delete _0x35fab5[_0xf608('0x1a')];}_0xee933d=_0x35fab5;})[_0xf608('0x5a')](function(){if(_0xee933d===null){_0x106b3e[_0xf608('0xa')](_0x2e1c10);}else{if(_0x2e1c10===0x1f4){_0x106b3e[_0xf608('0xb')](_0x2e1c10)['send'](_0xee933d);}else{_0x106b3e['status'](_0x2e1c10)[_0xf608('0xc')](_0xee933d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6288061..447c70b 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 _0x79d4=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2093e1,_0x9ecd1d){var _0x5a8f2b=function(_0x4b7d99){while(--_0x4b7d99){_0x2093e1['push'](_0x2093e1['shift']());}};_0x5a8f2b(++_0x9ecd1d);}(_0x79d4,0xd0));var _0x479d=function(_0x2a2ef3,_0x25cbea){_0x2a2ef3=_0x2a2ef3-0x0;var _0x50c9e4=_0x79d4[_0x2a2ef3];return _0x50c9e4;};'use strict';var EventEmitter=require(_0x479d('0x0'));var VoiceExtension=require(_0x479d('0x1'))['db'][_0x479d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x479d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x479d('0x4'),'afterDestroy':_0x479d('0x5')};function emitEvent(_0x379571){return function(_0x52372d,_0x25a9c5,_0xff5a6a){VoiceExtensionEvents['emit'](_0x379571+':'+_0x52372d['id'],_0x52372d);VoiceExtensionEvents[_0x479d('0x6')](_0x379571,_0x52372d);_0xff5a6a(null);};}for(var e in events){if(events[_0x479d('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x479d('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0c7d=['hook','exports','events','../../mysqldb','VoiceExtension','save','update','remove','emit'];(function(_0x2d542a,_0x2c9762){var _0xc6e54b=function(_0xaba0a8){while(--_0xaba0a8){_0x2d542a['push'](_0x2d542a['shift']());}};_0xc6e54b(++_0x2c9762);}(_0x0c7d,0xf5));var _0xd0c7=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0x0c7d[_0x49f67f];return _0x4779a1;};'use strict';var EventEmitter=require(_0xd0c7('0x0'));var VoiceExtension=require(_0xd0c7('0x1'))['db'][_0xd0c7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd0c7('0x3'),'afterUpdate':_0xd0c7('0x4'),'afterDestroy':_0xd0c7('0x5')};function emitEvent(_0x12fb3f){return function(_0x500a32,_0x54ecc3,_0xe524d3){VoiceExtensionEvents['emit'](_0x12fb3f+':'+_0x500a32['id'],_0x500a32);VoiceExtensionEvents[_0xd0c7('0x6')](_0x12fb3f,_0x500a32);_0xe524d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xd0c7('0x7')](e,emitEvent(event));}}module[_0xd0c7('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b524a1e..39810e8 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 _0x4d40=['options','url','split','length','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId','then','interval','map','filter','tag','toLowerCase','CDR(tag)=','intervals','Set(CALLERID(all)=','callerID','answer','playback','includes','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','priority','concat','last','catch','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4d40,0x7a));var _0x04d4=function(_0x21c80a,_0x275d41){_0x21c80a=_0x21c80a-0x0;var _0x4a7719=_0x4d40[_0x21c80a];return _0x4a7719;};'use strict';var _=require(_0x04d4('0x0'));var attributes=require(_0x04d4('0x1'));module[_0x04d4('0x2')]=function(_0x24a549){var _0x2d62d6=_0x24a549[_0x04d4('0x3')];function _0x435b13(_0x11bb01){var _0x4f0cae=0x2;var _0x16d338=[{'type':_0x11bb01[_0x04d4('0x4')],'app':_0x04d4('0x5'),'appdata':'CDR(type)='+_0x11bb01[_0x04d4('0x4')],'context':_0x11bb01[_0x04d4('0x6')],'exten':_0x11bb01['exten'],'priority':_0x4f0cae++,'VoiceExtensionId':_0x11bb01['id']}];if(_0x11bb01[_0x04d4('0x4')]===_0x04d4('0x7')){_0x16d338[_0x04d4('0x8')]({'type':_0x04d4('0x7'),'app':'Set','appdata':_0x04d4('0x9')+_0x11bb01['id'],'context':_0x11bb01[_0x04d4('0x6')],'exten':_0x11bb01[_0x04d4('0xa')],'priority':_0x4f0cae++,'VoiceExtensionId':_0x11bb01['id']});}_0x16d338['push']({'type':_0x11bb01[_0x04d4('0x4')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x11bb01['context'],'exten':_0x11bb01[_0x04d4('0xa')],'priority':_0x4f0cae++,'VoiceExtensionId':_0x11bb01['id']},{'type':_0x11bb01[_0x04d4('0x4')],'app':_0x04d4('0x5'),'appdata':_0x04d4('0xb'),'context':_0x11bb01['context'],'exten':_0x11bb01[_0x04d4('0xa')],'priority':_0x4f0cae++,'VoiceExtensionId':_0x11bb01['id']},{'type':_0x11bb01['type'],'app':_0x04d4('0x5'),'appdata':_0x04d4('0xc'),'context':_0x11bb01['context'],'exten':_0x11bb01[_0x04d4('0xa')],'priority':_0x4f0cae++,'VoiceExtensionId':_0x11bb01['id']});return _0x16d338;}function _0x5d65dd(_0x487b05){var _0x2e017c=0x2;var _0x29537d=[{'type':_0x04d4('0xd'),'app':_0x04d4('0x5'),'appdata':_0x04d4('0xe'),'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05['exten'],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':_0x04d4('0xd'),'app':_0x04d4('0x5'),'appdata':_0x04d4('0xf')+(_0x487b05[_0x04d4('0x10')]?_0x04d4('0x11')+_0x487b05[_0x04d4('0x10')]+'}':_0x04d4('0x12')),'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':'outbound','app':'Set','appdata':_0x04d4('0x9')+_0x487b05['id'],'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':_0x04d4('0xd'),'app':_0x04d4('0x13'),'appdata':_0x04d4('0x14')+(_0x2e017c+0x2)+_0x04d4('0x15')+(_0x2e017c+0x1)+')','context':_0x487b05['context'],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':_0x04d4('0xd'),'app':_0x04d4('0x5'),'appdata':_0x487b05[_0x04d4('0x10')]?_0x04d4('0x16')+_0x487b05[_0x04d4('0x10')]+'}':_0x04d4('0x17'),'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':'outbound','app':_0x04d4('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x487b05['context'],'exten':_0x487b05['exten'],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':'outbound','app':_0x04d4('0x5'),'appdata':_0x04d4('0xb'),'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05['exten'],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':'outbound','app':_0x04d4('0x5'),'appdata':_0x04d4('0xc'),'context':_0x487b05['context'],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':_0x04d4('0xd'),'app':_0x04d4('0x5'),'appdata':'outboundrouteid='+_0x487b05['id'],'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']}];if(_0x487b05[_0x04d4('0x18')]('recordingFormat')&&_0x487b05[_0x04d4('0x19')]!==_0x04d4('0x1a')){_0x29537d[_0x04d4('0x8')]({'type':_0x04d4('0xd'),'app':'Set','appdata':_0x04d4('0x1b'),'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05[_0x04d4('0xa')],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']},{'type':'outbound','app':_0x04d4('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x487b05[_0x04d4('0x19')]||_0x04d4('0x1c'),'context':_0x487b05[_0x04d4('0x6')],'exten':_0x487b05['exten'],'priority':_0x2e017c++,'VoiceExtensionId':_0x487b05['id']});}return _0x29537d;}function _0x33355e(_0x32cbdc,_0x17a4c6){var _0x3c6b6a=[{'name':_0x04d4('0x1d'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x04d4('0x1e'),'param':0x2},{'name':_0x04d4('0x1f'),'param':0x3}];var _0x22c969={};var _0xc17e4f=_0x17a4c6[_0x04d4('0x20')](',');var _0x182ea4=[];for(var _0x83e474=0x0;_0x83e474<_0x3c6b6a[_0x04d4('0x21')];_0x83e474++){switch(_0x3c6b6a[_0x83e474]['name']){case'trunk':_0x22c969[_0x04d4('0x1d')]=_0xc17e4f[_0x3c6b6a[_0x83e474][_0x04d4('0x22')]][_0x04d4('0x20')]('/')[0x1];_0x22c969[_0x04d4('0x23')]=_0xc17e4f[_0x3c6b6a[_0x83e474][_0x04d4('0x22')]][_0x04d4('0x20')]('/')[0x2];_0x22c969[_0x04d4('0x24')]=_0x22c969[_0x04d4('0x23')]?_0x22c969['phone']['split']('$')[0x0]:undefined;_0x22c969[_0x04d4('0x23')]=_0x32cbdc[_0x04d4('0x10')]?(_0x22c969[_0x04d4('0x24')]||'')+'${EXTEN:'+_0x32cbdc[_0x04d4('0x10')]+'}':(_0x22c969[_0x04d4('0x24')]||'')+_0x04d4('0x12');_0x182ea4[_0x3c6b6a[_0x83e474]['param']]=['SIP',_0x22c969[_0x04d4('0x1d')],_0x22c969[_0x04d4('0x23')]][_0x04d4('0x25')]('/');break;case _0x04d4('0x1e'):_0x22c969[_0x04d4('0x1e')]=_0xc17e4f[_0x3c6b6a[_0x83e474]['param']];if(_0x32cbdc[_0x04d4('0x19')]!==_0x04d4('0x1a')){if(_0x22c969['options'][_0x04d4('0x26')]('U(xcally-mixmonitor-context)')<0x0){_0x22c969[_0x04d4('0x1e')]+=_0x04d4('0x27');}}else{_0x22c969[_0x04d4('0x1e')]=_0x22c969[_0x04d4('0x1e')][_0x04d4('0x28')]('U(xcally-mixmonitor-context)','');}_0x182ea4[_0x3c6b6a[_0x83e474][_0x04d4('0x22')]]=_0x22c969[_0x04d4('0x1e')];break;default:_0x182ea4[_0x3c6b6a[_0x83e474][_0x04d4('0x22')]]=_0xc17e4f[_0x3c6b6a[_0x83e474][_0x04d4('0x22')]];}}return _0x182ea4['join'](',');}function _0x253612(_0x3ca25a,_0x27f38f,_0x48f50f){return new Promise(function(_0x481083,_0x1fed6d){var _0x4d5d7d=[];if(_[_0x04d4('0x29')](_0x27f38f))return _0x481083(_0x4d5d7d);_0x2d62d6[_0x04d4('0x2a')][_0x04d4('0x2b')]({'attributes':['id','interval',_0x04d4('0x2c')],'raw':!![]})[_0x04d4('0x2d')](function(_0x47a55a){for(var _0x11f0a2=0x0,_0x3ca28f=0x0;_0x11f0a2<_0x27f38f[_0x04d4('0x21')];_0x11f0a2++,_0x3ca28f=0x0){var _0x1309bc=_0x27f38f[_0x11f0a2];var _0xca2a4f=[];var _0x234df1=[];delete _0x1309bc['id'];if(_0x1309bc[_0x04d4('0x2e')]!=='*,*,*,*'){_0x1309bc['intervals']=[_0x1309bc[_0x04d4('0x2e')]];}else{_0x1309bc['intervals']=_0x1309bc[_0x04d4('0x2c')]?_[_0x04d4('0x2f')](_[_0x04d4('0x30')](_0x47a55a,{'IntervalId':_0x1309bc[_0x04d4('0x2c')]}),_0x04d4('0x2e')):[];}_0x1309bc[_0x04d4('0x6')]=_0x3ca25a[_0x04d4('0x6')];_0x1309bc[_0x04d4('0xa')]=_0x3ca25a[_0x04d4('0xa')];if(_0x1309bc[_0x04d4('0x4')])_0x1309bc[_0x04d4('0x4')]=_0x1309bc[_0x04d4('0x4')]['toLowerCase']();if(_0x3ca25a['type']===_0x04d4('0xd')){if(_0x1309bc[_0x04d4('0x18')](_0x04d4('0x31'))&&_0x1309bc[_0x04d4('0x31')]&&_0x1309bc[_0x04d4('0x31')]!=='--'){_0xca2a4f[_0x04d4('0x8')]({'type':_0x1309bc[_0x04d4('0x4')][_0x04d4('0x32')](),'app':_0x04d4('0x5'),'appdata':_0x04d4('0x33')+_0x1309bc[_0x04d4('0x31')],'context':_0x3ca25a['context'],'exten':_0x3ca25a['exten'],'priority':_0x1309bc[_0x04d4('0x34')][_0x04d4('0x21')]+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});}_0xca2a4f[_0x04d4('0x8')]({'type':_0x1309bc[_0x04d4('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1309bc['callerID']?_0x04d4('0x35')+_0x1309bc[_0x04d4('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x3ca25a[_0x04d4('0x6')],'exten':_0x3ca25a['exten'],'priority':_0x1309bc[_0x04d4('0x34')][_0x04d4('0x21')]+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});}else{if(_0x1309bc['hasOwnProperty'](_0x04d4('0x37'))){if(['queue',_0x04d4('0x38')][_0x04d4('0x39')](_0x1309bc['app']['toLowerCase']())&&_0x1309bc['appType']!=='custom'){if(_0x1309bc[_0x04d4('0x37')]){_0xca2a4f[_0x04d4('0x8')]({'type':_0x1309bc[_0x04d4('0x4')][_0x04d4('0x32')](),'app':_0x04d4('0x13'),'appdata':_0x04d4('0x3a'),'context':_0x3ca25a[_0x04d4('0x6')],'exten':_0x3ca25a[_0x04d4('0xa')],'priority':_0x1309bc[_0x04d4('0x34')][_0x04d4('0x21')]+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});_0xca2a4f[_0x04d4('0x8')]({'type':_0x1309bc[_0x04d4('0x4')][_0x04d4('0x32')](),'app':_0x04d4('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3ca25a[_0x04d4('0x6')],'exten':_0x3ca25a['exten'],'priority':_0x1309bc[_0x04d4('0x34')]['length']+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});}else{_0xca2a4f[_0x04d4('0x8')]({'type':_0x1309bc[_0x04d4('0x4')][_0x04d4('0x32')](),'app':_0x04d4('0x13'),'appdata':_0x04d4('0x3b'),'context':_0x3ca25a[_0x04d4('0x6')],'exten':_0x3ca25a[_0x04d4('0xa')],'priority':_0x1309bc[_0x04d4('0x34')]['length']+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});_0xca2a4f[_0x04d4('0x8')]({'type':_0x1309bc[_0x04d4('0x4')][_0x04d4('0x32')](),'app':_0x04d4('0x5'),'appdata':_0x04d4('0x3c'),'context':_0x3ca25a[_0x04d4('0x6')],'exten':_0x3ca25a['exten'],'priority':_0x1309bc[_0x04d4('0x34')]['length']+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});}}}}for(var _0x10e1ed=0x0;_0x10e1ed<_0x1309bc[_0x04d4('0x34')][_0x04d4('0x21')];_0x10e1ed++){var _0x5df35f=_0x48f50f+_0x1309bc[_0x04d4('0x34')]['length'];var _0x38a56c=_0x10e1ed===_0x1309bc[_0x04d4('0x34')][_0x04d4('0x21')]-0x1?_0x48f50f+_0xca2a4f[_0x04d4('0x21')]+_0x234df1['length']+0x2:_0x48f50f+_0x10e1ed+0x1;_0xca2a4f[_0x04d4('0x3d')](_0x10e1ed,0x0,{'type':_0x3ca25a[_0x04d4('0x4')],'app':_0x04d4('0x3e'),'appdata':_0x1309bc['intervals'][_0x10e1ed]+'?'+_0x3ca25a['context']+',${EXTEN},'+_0x5df35f+':'+_0x3ca25a[_0x04d4('0x6')]+_0x04d4('0x3f')+_0x38a56c,'exten':_0x3ca25a[_0x04d4('0xa')],'context':_0x3ca25a[_0x04d4('0x6')],'priority':_0x48f50f+_0x10e1ed,'VoiceExtensionId':_0x3ca25a['id']});}if(_0x1309bc[_0x04d4('0x40')]===_0x04d4('0x41')){_0x1309bc[_0x04d4('0x42')]=_0x33355e(_0x3ca25a,_0x1309bc[_0x04d4('0x42')]);}if(_0x1309bc[_0x04d4('0x40')]===_0x04d4('0x43')){_0xca2a4f['push']({'type':_0x1309bc['type'][_0x04d4('0x32')](),'app':_0x04d4('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x3ca25a[_0x04d4('0x6')],'exten':_0x3ca25a[_0x04d4('0xa')],'priority':_0x1309bc[_0x04d4('0x34')]['length']+_0x48f50f+_0x3ca28f++,'VoiceExtensionId':_0x3ca25a['id']});}_0x1309bc[_0x04d4('0x44')]=_0xca2a4f[_0x04d4('0x21')]?_['last'](_0xca2a4f)[_0x04d4('0x44')]+0x1:_0x48f50f;_0x4d5d7d=_[_0x04d4('0x45')](_0x4d5d7d,_0xca2a4f,[_0x1309bc],_0x234df1);_0x48f50f=_[_0x04d4('0x46')](_0x4d5d7d)[_0x04d4('0x44')]+0x1;}return _0x481083(_0x4d5d7d);})[_0x04d4('0x47')](function(_0x353882){_0x1fed6d(_0x353882);});});}return _0x24a549[_0x04d4('0x48')](_0x04d4('0x49'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x422c4e){var _0x454a06=this[_0x04d4('0x4a')]({'plain':!![]});var _0x4750e5=_0x454a06[_0x04d4('0x4')]===_0x04d4('0xd')?_0x5d65dd(_0x454a06):_0x435b13(_0x454a06);return _0x253612(_0x454a06,_0x422c4e,_[_0x04d4('0x46')](_0x4750e5)[_0x04d4('0x44')]+0x1)[_0x04d4('0x2d')](function(_0x55d16c){var _0x278d43=_[_0x04d4('0x45')](_0x4750e5,_0x55d16c);_0x278d43['push']({'type':_0x454a06['type'],'app':_0x04d4('0x4b'),'exten':_0x454a06[_0x04d4('0xa')],'context':_0x454a06[_0x04d4('0x6')],'priority':_['last'](_0x278d43)[_0x04d4('0x44')]+0x1,'VoiceExtensionId':_0x454a06['id']});return _0x278d43;});}}});}; \ No newline at end of file +var _0xed2e=['split','length','trunk','param','phone','prefix','${EXTEN:','SIP','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','last','priority','catch','define','VoiceExtension','voice_extensions','get','then','lodash','./voiceExtension.attributes','type','CDR(type)=','context','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xed2e,0xc1));var _0xeed2=function(_0x459cdd,_0xec7db){_0x459cdd=_0x459cdd-0x0;var _0x1979b2=_0xed2e[_0x459cdd];return _0x1979b2;};'use strict';var _=require(_0xeed2('0x0'));var attributes=require(_0xeed2('0x1'));module['exports']=function(_0x1fab2d){var _0x179c4f=_0x1fab2d['models'];function _0x30776f(_0x27bf5c){var _0x5328f0=0x2;var _0x1457c6=[{'type':_0x27bf5c[_0xeed2('0x2')],'app':'Set','appdata':_0xeed2('0x3')+_0x27bf5c[_0xeed2('0x2')],'context':_0x27bf5c[_0xeed2('0x4')],'exten':_0x27bf5c[_0xeed2('0x5')],'priority':_0x5328f0++,'VoiceExtensionId':_0x27bf5c['id']}];if(_0x27bf5c['type']===_0xeed2('0x6')){_0x1457c6[_0xeed2('0x7')]({'type':'inbound','app':_0xeed2('0x8'),'appdata':_0xeed2('0x9')+_0x27bf5c['id'],'context':_0x27bf5c[_0xeed2('0x4')],'exten':_0x27bf5c['exten'],'priority':_0x5328f0++,'VoiceExtensionId':_0x27bf5c['id']});}_0x1457c6['push']({'type':_0x27bf5c[_0xeed2('0x2')],'app':_0xeed2('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x27bf5c['context'],'exten':_0x27bf5c[_0xeed2('0x5')],'priority':_0x5328f0++,'VoiceExtensionId':_0x27bf5c['id']},{'type':_0x27bf5c['type'],'app':'Set','appdata':_0xeed2('0xa'),'context':_0x27bf5c[_0xeed2('0x4')],'exten':_0x27bf5c[_0xeed2('0x5')],'priority':_0x5328f0++,'VoiceExtensionId':_0x27bf5c['id']},{'type':_0x27bf5c[_0xeed2('0x2')],'app':'Set','appdata':_0xeed2('0xb'),'context':_0x27bf5c['context'],'exten':_0x27bf5c[_0xeed2('0x5')],'priority':_0x5328f0++,'VoiceExtensionId':_0x27bf5c['id']});return _0x1457c6;}function _0x517a71(_0x504d05){var _0x473f5a=0x2;var _0x394656=[{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':_0xeed2('0xd'),'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05['exten'],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':'Set','appdata':_0xeed2('0xe')+(_0x504d05[_0xeed2('0xf')]?'${EXTEN:'+_0x504d05[_0xeed2('0xf')]+'}':_0xeed2('0x10')),'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05['exten'],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':'Set','appdata':_0xeed2('0x9')+_0x504d05['id'],'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05[_0xeed2('0x5')],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':'ExecIf','appdata':_0xeed2('0x11')+(_0x473f5a+0x2)+_0xeed2('0x12')+(_0x473f5a+0x1)+')','context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05[_0xeed2('0x5')],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':_0x504d05[_0xeed2('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0x504d05[_0xeed2('0xf')]+'}':_0xeed2('0x13'),'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05[_0xeed2('0x5')],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05['exten'],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':_0xeed2('0xa'),'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05['exten'],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':_0xeed2('0xb'),'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05[_0xeed2('0x5')],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':_0xeed2('0x14')+_0x504d05['id'],'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05[_0xeed2('0x5')],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']}];if(_0x504d05[_0xeed2('0x15')](_0xeed2('0x16'))&&_0x504d05[_0xeed2('0x16')]!==_0xeed2('0x17')){_0x394656['push']({'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05[_0xeed2('0x5')],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']},{'type':_0xeed2('0xc'),'app':_0xeed2('0x8'),'appdata':_0xeed2('0x18')+_0x504d05[_0xeed2('0x16')]||_0xeed2('0x19'),'context':_0x504d05[_0xeed2('0x4')],'exten':_0x504d05['exten'],'priority':_0x473f5a++,'VoiceExtensionId':_0x504d05['id']});}return _0x394656;}function _0x6745d9(_0x229840,_0x590494){var _0x5ad4f8=[{'name':'trunk','param':0x0},{'name':_0xeed2('0x1a'),'param':0x1},{'name':_0xeed2('0x1b'),'param':0x2},{'name':_0xeed2('0x1c'),'param':0x3}];var _0xe977a4={};var _0x317ef9=_0x590494[_0xeed2('0x1d')](',');var _0x2d50d2=[];for(var _0x4e40b6=0x0;_0x4e40b6<_0x5ad4f8[_0xeed2('0x1e')];_0x4e40b6++){switch(_0x5ad4f8[_0x4e40b6]['name']){case _0xeed2('0x1f'):_0xe977a4[_0xeed2('0x1f')]=_0x317ef9[_0x5ad4f8[_0x4e40b6][_0xeed2('0x20')]][_0xeed2('0x1d')]('/')[0x1];_0xe977a4[_0xeed2('0x21')]=_0x317ef9[_0x5ad4f8[_0x4e40b6][_0xeed2('0x20')]][_0xeed2('0x1d')]('/')[0x2];_0xe977a4[_0xeed2('0x22')]=_0xe977a4[_0xeed2('0x21')]?_0xe977a4[_0xeed2('0x21')][_0xeed2('0x1d')]('$')[0x0]:undefined;_0xe977a4['phone']=_0x229840[_0xeed2('0xf')]?(_0xe977a4['prefix']||'')+_0xeed2('0x23')+_0x229840[_0xeed2('0xf')]+'}':(_0xe977a4[_0xeed2('0x22')]||'')+_0xeed2('0x10');_0x2d50d2[_0x5ad4f8[_0x4e40b6][_0xeed2('0x20')]]=[_0xeed2('0x24'),_0xe977a4[_0xeed2('0x1f')],_0xe977a4['phone']]['join']('/');break;case _0xeed2('0x1b'):_0xe977a4[_0xeed2('0x1b')]=_0x317ef9[_0x5ad4f8[_0x4e40b6][_0xeed2('0x20')]];if(_0x229840['recordingFormat']!==_0xeed2('0x17')){if(_0xe977a4['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0xe977a4[_0xeed2('0x1b')]+=_0xeed2('0x25');}}else{_0xe977a4[_0xeed2('0x1b')]=_0xe977a4['options'][_0xeed2('0x26')](_0xeed2('0x25'),'');}_0x2d50d2[_0x5ad4f8[_0x4e40b6][_0xeed2('0x20')]]=_0xe977a4[_0xeed2('0x1b')];break;default:_0x2d50d2[_0x5ad4f8[_0x4e40b6]['param']]=_0x317ef9[_0x5ad4f8[_0x4e40b6][_0xeed2('0x20')]];}}return _0x2d50d2[_0xeed2('0x27')](',');}function _0x1c865c(_0x42deba,_0x4d00c6,_0x608011){return new Promise(function(_0x37c9a4,_0x56d176){var _0x49a1c3=[];if(_[_0xeed2('0x28')](_0x4d00c6))return _0x37c9a4(_0x49a1c3);_0x179c4f[_0xeed2('0x29')][_0xeed2('0x2a')]({'attributes':['id',_0xeed2('0x2b'),_0xeed2('0x2c')],'raw':!![]})['then'](function(_0x532e85){for(var _0x2eff8f=0x0,_0x3a7474=0x0;_0x2eff8f<_0x4d00c6['length'];_0x2eff8f++,_0x3a7474=0x0){var _0x370915=_0x4d00c6[_0x2eff8f];var _0x37ac1b=[];var _0x1bf986=[];delete _0x370915['id'];if(_0x370915[_0xeed2('0x2b')]!==_0xeed2('0x2d')){_0x370915['intervals']=[_0x370915[_0xeed2('0x2b')]];}else{_0x370915[_0xeed2('0x2e')]=_0x370915[_0xeed2('0x2c')]?_[_0xeed2('0x2f')](_['filter'](_0x532e85,{'IntervalId':_0x370915[_0xeed2('0x2c')]}),_0xeed2('0x2b')):[];}_0x370915[_0xeed2('0x4')]=_0x42deba[_0xeed2('0x4')];_0x370915['exten']=_0x42deba[_0xeed2('0x5')];if(_0x370915[_0xeed2('0x2')])_0x370915[_0xeed2('0x2')]=_0x370915[_0xeed2('0x2')][_0xeed2('0x30')]();if(_0x42deba[_0xeed2('0x2')]===_0xeed2('0xc')){if(_0x370915[_0xeed2('0x15')]('tag')&&_0x370915[_0xeed2('0x31')]&&_0x370915[_0xeed2('0x31')]!=='--'){_0x37ac1b[_0xeed2('0x7')]({'type':_0x370915[_0xeed2('0x2')][_0xeed2('0x30')](),'app':'Set','appdata':_0xeed2('0x32')+_0x370915['tag'],'context':_0x42deba[_0xeed2('0x4')],'exten':_0x42deba['exten'],'priority':_0x370915['intervals'][_0xeed2('0x1e')]+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});}_0x37ac1b[_0xeed2('0x7')]({'type':_0x370915[_0xeed2('0x2')][_0xeed2('0x30')](),'app':_0xeed2('0x33'),'appdata':_0xeed2('0x34')+(_0x370915[_0xeed2('0x35')]?'Set(CALLERID(all)='+_0x370915['callerID']+')':_0xeed2('0x36')),'context':_0x42deba[_0xeed2('0x4')],'exten':_0x42deba[_0xeed2('0x5')],'priority':_0x370915[_0xeed2('0x2e')][_0xeed2('0x1e')]+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});}else{if(_0x370915[_0xeed2('0x15')](_0xeed2('0x37'))){if([_0xeed2('0x38'),'playback'][_0xeed2('0x39')](_0x370915[_0xeed2('0x3a')][_0xeed2('0x30')]())&&_0x370915[_0xeed2('0x3b')]!==_0xeed2('0x3c')){if(_0x370915[_0xeed2('0x37')]){_0x37ac1b[_0xeed2('0x7')]({'type':_0x370915[_0xeed2('0x2')][_0xeed2('0x30')](),'app':_0xeed2('0x33'),'appdata':_0xeed2('0x3d'),'context':_0x42deba['context'],'exten':_0x42deba[_0xeed2('0x5')],'priority':_0x370915[_0xeed2('0x2e')]['length']+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});_0x37ac1b[_0xeed2('0x7')]({'type':_0x370915[_0xeed2('0x2')]['toLowerCase'](),'app':'Set','appdata':_0xeed2('0x3e'),'context':_0x42deba['context'],'exten':_0x42deba['exten'],'priority':_0x370915['intervals'][_0xeed2('0x1e')]+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});}else{_0x37ac1b['push']({'type':_0x370915[_0xeed2('0x2')][_0xeed2('0x30')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x42deba[_0xeed2('0x4')],'exten':_0x42deba['exten'],'priority':_0x370915[_0xeed2('0x2e')][_0xeed2('0x1e')]+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});_0x37ac1b[_0xeed2('0x7')]({'type':_0x370915[_0xeed2('0x2')][_0xeed2('0x30')](),'app':_0xeed2('0x8'),'appdata':_0xeed2('0x3f'),'context':_0x42deba[_0xeed2('0x4')],'exten':_0x42deba[_0xeed2('0x5')],'priority':_0x370915[_0xeed2('0x2e')][_0xeed2('0x1e')]+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});}}}}for(var _0x55b1d3=0x0;_0x55b1d3<_0x370915[_0xeed2('0x2e')][_0xeed2('0x1e')];_0x55b1d3++){var _0x270798=_0x608011+_0x370915[_0xeed2('0x2e')]['length'];var _0x5854c5=_0x55b1d3===_0x370915[_0xeed2('0x2e')]['length']-0x1?_0x608011+_0x37ac1b[_0xeed2('0x1e')]+_0x1bf986['length']+0x2:_0x608011+_0x55b1d3+0x1;_0x37ac1b['splice'](_0x55b1d3,0x0,{'type':_0x42deba['type'],'app':'GotoIfTime','appdata':_0x370915[_0xeed2('0x2e')][_0x55b1d3]+'?'+_0x42deba['context']+',${EXTEN},'+_0x270798+':'+_0x42deba[_0xeed2('0x4')]+_0xeed2('0x40')+_0x5854c5,'exten':_0x42deba['exten'],'context':_0x42deba['context'],'priority':_0x608011+_0x55b1d3,'VoiceExtensionId':_0x42deba['id']});}if(_0x370915[_0xeed2('0x3b')]===_0xeed2('0x41')){_0x370915['appdata']=_0x6745d9(_0x42deba,_0x370915['appdata']);}if(_0x370915['appType']==='agi'){_0x37ac1b[_0xeed2('0x7')]({'type':_0x370915['type']['toLowerCase'](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x42deba[_0xeed2('0x4')],'exten':_0x42deba[_0xeed2('0x5')],'priority':_0x370915[_0xeed2('0x2e')][_0xeed2('0x1e')]+_0x608011+_0x3a7474++,'VoiceExtensionId':_0x42deba['id']});}_0x370915['priority']=_0x37ac1b[_0xeed2('0x1e')]?_[_0xeed2('0x42')](_0x37ac1b)[_0xeed2('0x43')]+0x1:_0x608011;_0x49a1c3=_['concat'](_0x49a1c3,_0x37ac1b,[_0x370915],_0x1bf986);_0x608011=_[_0xeed2('0x42')](_0x49a1c3)['priority']+0x1;}return _0x37c9a4(_0x49a1c3);})[_0xeed2('0x44')](function(_0x1c5432){_0x56d176(_0x1c5432);});});}return _0x1fab2d[_0xeed2('0x45')](_0xeed2('0x46'),attributes,{'tableName':_0xeed2('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3c7139){var _0x1391d3=this[_0xeed2('0x48')]({'plain':!![]});var _0x5e26e1=_0x1391d3[_0xeed2('0x2')]===_0xeed2('0xc')?_0x517a71(_0x1391d3):_0x30776f(_0x1391d3);return _0x1c865c(_0x1391d3,_0x3c7139,_[_0xeed2('0x42')](_0x5e26e1)[_0xeed2('0x43')]+0x1)[_0xeed2('0x49')](function(_0x3f4924){var _0x44df1a=_['concat'](_0x5e26e1,_0x3f4924);_0x44df1a['push']({'type':_0x1391d3['type'],'app':'Hangup','exten':_0x1391d3[_0xeed2('0x5')],'context':_0x1391d3[_0xeed2('0x4')],'priority':_[_0xeed2('0x42')](_0x44df1a)[_0xeed2('0x43')]+0x1,'VoiceExtensionId':_0x1391d3['id']});return _0x44df1a;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ebe5294..ac58220 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 _0x9973=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','model','map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','./voiceExtension.socket','register','request','then','info'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x9973,0x157));var _0x3997=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9973[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var moment=require(_0x3997('0x1'));var BPromise=require('bluebird');var rs=require(_0x3997('0x2'));var fs=require('fs');var Redis=require(_0x3997('0x3'));var db=require(_0x3997('0x4'))['db'];var utils=require(_0x3997('0x5'));var logger=require(_0x3997('0x6'))(_0x3997('0x7'));var config=require(_0x3997('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3997('0x9')]({'port':0x232a});config[_0x3997('0xa')]=_[_0x3997('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3997('0xa')]));require(_0x3997('0xc'))[_0x3997('0xd')](socket);function respondWithRpcPromise(_0xaa5f42,_0x96da4b,_0x2290df){return new BPromise(function(_0x6ec837,_0x1d166e){return client[_0x3997('0xe')](_0xaa5f42,_0x2290df)[_0x3997('0xf')](function(_0x140b13){logger[_0x3997('0x10')](_0x3997('0x11'),_0x96da4b,_0x3997('0x12'));logger[_0x3997('0x13')](_0x3997('0x14'),_0x96da4b,_0x3997('0x12'),JSON[_0x3997('0x15')](_0x140b13));if(_0x140b13[_0x3997('0x16')]){if(_0x140b13[_0x3997('0x16')][_0x3997('0x17')]===0x1f4){logger[_0x3997('0x16')](_0x3997('0x11'),_0x96da4b,_0x140b13['error'][_0x3997('0x18')]);return _0x1d166e(_0x140b13[_0x3997('0x16')][_0x3997('0x18')]);}logger[_0x3997('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x96da4b,_0x140b13[_0x3997('0x16')][_0x3997('0x18')]);return _0x6ec837(_0x140b13['error']['message']);}else{logger[_0x3997('0x10')](_0x3997('0x11'),_0x96da4b,'request\x20sent');_0x6ec837(_0x140b13[_0x3997('0x19')][_0x3997('0x18')]);}})[_0x3997('0x1a')](function(_0x122130){logger[_0x3997('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x96da4b,_0x122130);_0x1d166e(_0x122130);});});}exports[_0x3997('0x1b')]=function(_0x3631ef){var _0x16cb82=this;return new Promise(function(_0x541832,_0x20caab){return db[_0x3997('0x1c')]['findAll']({'raw':_0x3631ef[_0x3997('0x1d')]?_0x3631ef[_0x3997('0x1d')][_0x3997('0x1e')]===undefined?!![]:![]:!![],'where':_0x3631ef['options']?_0x3631ef['options'][_0x3997('0x1f')]||null:null,'attributes':_0x3631ef[_0x3997('0x1d')]?_0x3631ef[_0x3997('0x1d')][_0x3997('0x20')]||null:null,'limit':_0x3631ef['options']?_0x3631ef[_0x3997('0x1d')]['limit']||null:null,'include':_0x3631ef['options']?_0x3631ef[_0x3997('0x1d')][_0x3997('0x21')]?_['map'](_0x3631ef['options'][_0x3997('0x21')],function(_0xe3e7b6){return{'model':db[_0xe3e7b6[_0x3997('0x22')]],'as':_0xe3e7b6['as'],'attributes':_0xe3e7b6['attributes'],'include':_0xe3e7b6['include']?_['map'](_0xe3e7b6[_0x3997('0x21')],function(_0x124022){return{'model':db[_0x124022[_0x3997('0x22')]],'as':_0x124022['as'],'attributes':_0x124022[_0x3997('0x20')],'include':_0x124022[_0x3997('0x21')]?_[_0x3997('0x23')](_0x124022['include'],function(_0x5ad688){return{'model':db[_0x5ad688[_0x3997('0x22')]],'as':_0x5ad688['as'],'attributes':_0x5ad688[_0x3997('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cec57){logger[_0x3997('0x10')](_0x3997('0x1b'),_0x3631ef);logger[_0x3997('0x13')](_0x3997('0x1b'),_0x3631ef,JSON[_0x3997('0x15')](_0x2cec57));_0x541832(_0x2cec57);})['catch'](function(_0x24fdf2){logger[_0x3997('0x16')](_0x3997('0x1b'),_0x24fdf2[_0x3997('0x18')],_0x3631ef);_0x20caab(_0x16cb82[_0x3997('0x16')](0x1f4,_0x24fdf2['message']));});});}; \ No newline at end of file +var _0x1354=['stringify','error','message','catch','GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x41554c,_0x406f58){var _0x920839=function(_0x3d3ca7){while(--_0x3d3ca7){_0x41554c['push'](_0x41554c['shift']());}};_0x920839(++_0x406f58);}(_0x1354,0x95));var _0x4135=function(_0x3caeb5,_0x219363){_0x3caeb5=_0x3caeb5-0x0;var _0x5eca7e=_0x1354[_0x3caeb5];return _0x5eca7e;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});config['redis']=_[_0x4135('0xc')](config[_0x4135('0xd')],{'host':_0x4135('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4135('0xd')]));require('./voiceExtension.socket')[_0x4135('0xf')](socket);function respondWithRpcPromise(_0x1d0cc6,_0x4447c8,_0x39822e){return new BPromise(function(_0x5dd78a,_0x35d576){return client['request'](_0x1d0cc6,_0x39822e)['then'](function(_0x73c55f){logger[_0x4135('0x10')](_0x4135('0x11'),_0x4447c8,'request\x20sent');logger[_0x4135('0x12')](_0x4135('0x13'),_0x4447c8,_0x4135('0x14'),JSON[_0x4135('0x15')](_0x73c55f));if(_0x73c55f[_0x4135('0x16')]){if(_0x73c55f[_0x4135('0x16')]['code']===0x1f4){logger['error'](_0x4135('0x11'),_0x4447c8,_0x73c55f[_0x4135('0x16')][_0x4135('0x17')]);return _0x35d576(_0x73c55f[_0x4135('0x16')]['message']);}logger[_0x4135('0x16')](_0x4135('0x11'),_0x4447c8,_0x73c55f['error']['message']);return _0x5dd78a(_0x73c55f[_0x4135('0x16')]['message']);}else{logger[_0x4135('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x4447c8,'request\x20sent');_0x5dd78a(_0x73c55f['result']['message']);}})[_0x4135('0x18')](function(_0x55adba){logger[_0x4135('0x16')](_0x4135('0x11'),_0x4447c8,_0x55adba);_0x35d576(_0x55adba);});});}exports[_0x4135('0x19')]=function(_0x5eddcc){var _0x3f7e85=this;return new Promise(function(_0x3dae32,_0x398294){return db['VoiceExtension'][_0x4135('0x1a')]({'raw':_0x5eddcc['options']?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')]['where']||null:null,'attributes':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1d')]||null:null,'limit':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1e')]||null:null,'include':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1f')]?_[_0x4135('0x20')](_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1f')],function(_0x212228){return{'model':db[_0x212228[_0x4135('0x21')]],'as':_0x212228['as'],'attributes':_0x212228['attributes'],'include':_0x212228[_0x4135('0x1f')]?_[_0x4135('0x20')](_0x212228[_0x4135('0x1f')],function(_0x36b9e3){return{'model':db[_0x36b9e3[_0x4135('0x21')]],'as':_0x36b9e3['as'],'attributes':_0x36b9e3[_0x4135('0x1d')],'include':_0x36b9e3['include']?_[_0x4135('0x20')](_0x36b9e3[_0x4135('0x1f')],function(_0x31b508){return{'model':db[_0x31b508[_0x4135('0x21')]],'as':_0x31b508['as'],'attributes':_0x31b508[_0x4135('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411ee0){logger[_0x4135('0x10')]('GetVoiceExtension',_0x5eddcc);logger[_0x4135('0x12')]('GetVoiceExtension',_0x5eddcc,JSON[_0x4135('0x15')](_0x411ee0));_0x3dae32(_0x411ee0);})[_0x4135('0x18')](function(_0x25a672){logger[_0x4135('0x16')]('GetVoiceExtension',_0x25a672[_0x4135('0x17')],_0x5eddcc);_0x398294(_0x3f7e85[_0x4135('0x16')](0x1f4,_0x25a672[_0x4135('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 47f3d12..1b9f128 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x51593c,_0x5780bf){var _0x5b8a5a=function(_0x3db017){while(--_0x3db017){_0x51593c['push'](_0x51593c['shift']());}};_0x5b8a5a(++_0x5780bf);}(_0xf494,0x1c6));var _0x4f49=function(_0x574c8d,_0xfb6ce0){_0x574c8d=_0x574c8d-0x0;var _0x5a263f=_0xf494[_0x574c8d];return _0x5a263f;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x915bb8,_0x3b1f3d){var _0x55eac3=function(_0x1c5c23){while(--_0x1c5c23){_0x915bb8['push'](_0x915bb8['shift']());}};_0x55eac3(++_0x3b1f3d);}(_0x1261,0x144));var _0x1126=function(_0x3d6d05,_0x16c8b8){_0x3d6d05=_0x3d6d05-0x0;var _0x288baf=_0x1261[_0x3d6d05];return _0x288baf;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index de024a3..13b89ee 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 _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0x29f82c,_0x5a6380){var _0x58a330=function(_0x1a4e82){while(--_0x1a4e82){_0x29f82c['push'](_0x29f82c['shift']());}};_0x58a330(++_0x5a6380);}(_0x6a55,0xdb));var _0x56a5=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x6a55[_0x14490c];return _0x2f6825;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file +var _0x8aad=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','show','/:id/messages','post','create','put','/:id','update'];(function(_0x4986da,_0x15991c){var _0x489483=function(_0x583bdc){while(--_0x583bdc){_0x4986da['push'](_0x4986da['shift']());}};_0x489483(++_0x15991c);}(_0x8aad,0x146));var _0xd8aa=function(_0x4b1a49,_0x2cf1eb){_0x4b1a49=_0x4b1a49-0x0;var _0x2f69d1=_0x8aad[_0x4b1a49];return _0x2f69d1;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/:id',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['getMessages']);router[_0xd8aa('0xb')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0xd')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);module[_0xd8aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 18d4fff..df179fe 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 _0x32a9=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','string','trim','central','yes'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x32a9,0x9d));var _0x932a=function(_0xabbfc7,_0x33d449){_0xabbfc7=_0xabbfc7-0x0;var _0x2a2a62=_0x32a9[_0xabbfc7];return _0x2a2a62;};'use strict';var Sequelize=require('sequelize');module[_0x932a('0x0')]={'customer_id':{'type':Sequelize[_0x932a('0x1')]},'context':{'type':Sequelize[_0x932a('0x1')],'defaultValue':_0x932a('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x932a('0x1')],'defaultValue':'','allowNull':![],'unique':_0x932a('0x3')},'password':{'type':Sequelize[_0x932a('0x1')]},'fullname':{'type':Sequelize[_0x932a('0x1')]},'email':{'type':Sequelize[_0x932a('0x1')],'validate':{'isEmail':!![]},'set':function(_0x8ddd55){this['setDataValue']('email',typeof _0x8ddd55===_0x932a('0x4')&&_0x8ddd55[_0x932a('0x5')]()?_0x8ddd55[_0x932a('0x5')]():null);}},'pager':{'type':Sequelize[_0x932a('0x1')]},'tz':{'type':Sequelize[_0x932a('0x1')],'defaultValue':_0x932a('0x6')},'attach':{'type':Sequelize['ENUM'](_0x932a('0x7'),'no'),'defaultValue':_0x932a('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':_0x932a('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x932a('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x932a('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':_0x932a('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x932a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x932a('0x8')](_0x932a('0x7'),'no'),'defaultValue':_0x932a('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x932a('0x1')]},'emailbody':{'type':Sequelize[_0x932a('0x1')]},'maxsecs':{'type':Sequelize[_0x932a('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x932a('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x932a('0xb')],'get':function(){return this['getDataValue'](_0x932a('0xc'))+'\x20-\x20'+this[_0x932a('0xd')](_0x932a('0xe'));}}}; \ No newline at end of file +var _0xe130=['contest_mailbox','setDataValue','email','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','getDataValue','mailbox','exports','STRING','from-voicemail'];(function(_0x3bd4db,_0xaefa60){var _0x5ab35e=function(_0x5681c5){while(--_0x5681c5){_0x3bd4db['push'](_0x3bd4db['shift']());}};_0x5ab35e(++_0xaefa60);}(_0xe130,0xb8));var _0x0e13=function(_0x256afb,_0x366986){_0x256afb=_0x256afb-0x0;var _0x40711a=_0xe130[_0x256afb];return _0x40711a;};'use strict';var Sequelize=require('sequelize');module[_0x0e13('0x0')]={'customer_id':{'type':Sequelize[_0x0e13('0x1')]},'context':{'type':Sequelize[_0x0e13('0x1')],'defaultValue':_0x0e13('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x0e13('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0e13('0x1')]},'email':{'type':Sequelize[_0x0e13('0x1')],'validate':{'isEmail':!![]},'set':function(_0x163715){this[_0x0e13('0x4')](_0x0e13('0x5'),typeof _0x163715==='string'&&_0x163715[_0x0e13('0x6')]()?_0x163715[_0x0e13('0x6')]():null);}},'pager':{'type':Sequelize[_0x0e13('0x1')]},'tz':{'type':Sequelize[_0x0e13('0x1')],'defaultValue':_0x0e13('0x7')},'attach':{'type':Sequelize['ENUM'](_0x0e13('0x8'),'no'),'defaultValue':_0x0e13('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x0e13('0x1')]},'callback':{'type':Sequelize[_0x0e13('0x1')]},'review':{'type':Sequelize['ENUM'](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0e13('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0e13('0x9')](_0x0e13('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x0e13('0x8'),'no'),'defaultValue':_0x0e13('0x8'),'allowNull':![]},'stamp':{'type':_0x0e13('0xb')},'emailsubject':{'type':Sequelize[_0x0e13('0x1')]},'emailbody':{'type':Sequelize[_0x0e13('0x1')]},'maxsecs':{'type':Sequelize[_0x0e13('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0e13('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0e13('0xd')],'get':function(){return this['getDataValue']('fullname')+_0x0e13('0xe')+this[_0x0e13('0xf')](_0x0e13('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1605acb..fae196f 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 _0x1be1=['set','Content-Range','apply','reject','save','update','then','get','Voicemails','destroy','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','length','mailbox','findAndCountAll','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count'];(function(_0x338859,_0x2f4d49){var _0x5583a7=function(_0xd7cf15){while(--_0xd7cf15){_0x338859['push'](_0x338859['shift']());}};_0x5583a7(++_0x2f4d49);}(_0x1be1,0x192));var _0x11be=function(_0x386906,_0x44268d){_0x386906=_0x386906-0x0;var _0x537f09=_0x1be1[_0x386906];return _0x537f09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['VoiceMail'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));};exports['getMessages']=function(_0x568f20,_0x5aa6bf,_0x1a43df){return db[_0x11be('0x2d')][_0x11be('0x51')]({'where':{'id':_0x568f20[_0x11be('0x50')]['id']}})[_0x11be('0x22')](handleEntityNotFound(_0x5aa6bf,null))[_0x11be('0x22')](function(_0xb97604){var _0x55e79d;var _0x54e52a={},_0x7c1ee5={};_0x7c1ee5[_0x11be('0x31')]=_[_0x11be('0x33')](db[_0x11be('0x52')][_0x11be('0x2e')]);_0x7c1ee5[_0x11be('0x32')]=_[_0x11be('0x33')](_0x568f20[_0x11be('0x32')]);_0x7c1ee5[_0x11be('0x34')]=_['intersection'](_0x7c1ee5[_0x11be('0x31')],_0x7c1ee5[_0x11be('0x32')]);_0x54e52a[_0x11be('0x36')]=_['intersection'](_0x7c1ee5[_0x11be('0x31')],qs[_0x11be('0x37')](_0x568f20['query']['fields']));_0x54e52a[_0x11be('0x36')]=_0x54e52a[_0x11be('0x36')][_0x11be('0x53')]?_0x54e52a[_0x11be('0x36')]:_0x7c1ee5['model'];if(!_0x568f20[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x54e52a[_0x11be('0x1a')]=qs[_0x11be('0x1a')](_0x568f20[_0x11be('0x32')][_0x11be('0x1a')]);_0x54e52a[_0x11be('0x18')]=qs[_0x11be('0x18')](_0x568f20['query']['offset']);}_0x54e52a[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x568f20['query'][_0x11be('0x3b')]);_0x54e52a[_0x11be('0x3e')]=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x568f20[_0x11be('0x32')],_0x7c1ee5[_0x11be('0x34')]));if(_0x568f20[_0x11be('0x32')]['filter']){_0x54e52a['where']=_[_0x11be('0x3f')](_0x54e52a[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x54e52a['attributes'],function(_0x82c02c){var _0x422696={};_0x422696[_0x82c02c]={'$like':'%'+_0x568f20[_0x11be('0x32')][_0x11be('0x3d')]+'%'};return _0x422696;})});}_0x54e52a[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x54e52a[_0x11be('0x3e')],{'mailboxuser':_0xb97604[_0x11be('0x54')]});_0x54e52a=_[_0x11be('0x3f')]({},_0x54e52a,_0x568f20[_0x11be('0x45')]);return db[_0x11be('0x52')][_0x11be('0x55')](_0x54e52a)[_0x11be('0x22')](respondWithFilteredResult(_0x5aa6bf,_0x54e52a));})[_0x11be('0x47')](handleError(_0x5aa6bf,null));}; \ No newline at end of file +var _0x4483=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Voicemails','UserProfileResource','error','name','index','VoiceMail','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','find','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3b37d0,_0x5e3d41){var _0x4987b6=function(_0xd63e1c){while(--_0xd63e1c){_0x3b37d0['push'](_0x3b37d0['shift']());}};_0x4987b6(++_0x5e3d41);}(_0x4483,0x1a3));var _0x3448=function(_0x1ed67b,_0x4dd24c){_0x1ed67b=_0x1ed67b-0x0;var _0x5ec1a6=_0x4483[_0x1ed67b];return _0x5ec1a6;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){var _0x566ff5=_0x22ad5c[_0x3448('0x29')]({'plain':!![]});var _0x1b5c49=_0x3448('0x2a');return db[_0x3448('0x2b')][_0x3448('0x27')]({'where':{'type':_0x1b5c49,'resourceId':_0x566ff5['id']}})['then'](function(){return _0x22ad5c;});})[_0x3448('0x28')](function(){_0x2dcd40[_0x3448('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a479,_0x12c22d){return function(_0x310912){if(!_0x310912){_0x19a479[_0x3448('0x1b')](0x194);}return _0x310912;};}function handleError(_0x38fab2,_0x35f026){_0x35f026=_0x35f026||0x1f4;return function(_0x31be64){logger[_0x3448('0x2c')](_0x31be64['stack']);if(_0x31be64[_0x3448('0x2d')]){delete _0x31be64[_0x3448('0x2d')];}_0x38fab2[_0x3448('0x1c')](_0x35f026)['send'](_0x31be64);};}exports[_0x3448('0x2e')]=function(_0x5dfdf7,_0x486f2c){var _0x493898={},_0x52fb48={},_0xff6513={'count':0x0,'rows':[]};var _0x5e96f0=_['map'](db[_0x3448('0x2f')][_0x3448('0x30')],function(_0x32121c){return{'name':_0x32121c[_0x3448('0x31')],'type':_0x32121c['type'][_0x3448('0x32')]};});_0x52fb48[_0x3448('0x33')]=_[_0x3448('0x34')](_0x5e96f0,'name');_0x52fb48[_0x3448('0x35')]=_[_0x3448('0x36')](_0x5dfdf7['query']);_0x52fb48['filters']=_[_0x3448('0x37')](_0x52fb48[_0x3448('0x33')],_0x52fb48[_0x3448('0x35')]);_0x493898[_0x3448('0x38')]=_['intersection'](_0x52fb48[_0x3448('0x33')],qs[_0x3448('0x39')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x39')]));_0x493898['attributes']=_0x493898[_0x3448('0x38')][_0x3448('0x3a')]?_0x493898['attributes']:_0x52fb48[_0x3448('0x33')];if(!_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3b')](_0x3448('0x3c'))){_0x493898[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x21')]);_0x493898[_0x3448('0x1f')]=qs['offset'](_0x5dfdf7['query'][_0x3448('0x1f')]);}_0x493898['order']=qs[_0x3448('0x3d')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3d')]);_0x493898[_0x3448('0x3e')]=qs['filters'](_[_0x3448('0x3f')](_0x5dfdf7[_0x3448('0x35')],_0x52fb48[_0x3448('0x40')]),_0x5e96f0);if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x41')]){_0x493898[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x493898[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x5e96f0,function(_0x5a58c5){if(_0x5a58c5[_0x3448('0x43')]!==_0x3448('0x44')){var _0x322b46={};_0x322b46[_0x5a58c5[_0x3448('0x2d')]]={'$like':'%'+_0x5dfdf7[_0x3448('0x35')]['filter']+'%'};return _0x322b46;}})});}_0x493898=_[_0x3448('0x42')]({},_0x493898,_0x5dfdf7[_0x3448('0x45')]);var _0x4a6e5={'where':_0x493898[_0x3448('0x3e')]};return db[_0x3448('0x2f')][_0x3448('0x22')](_0x4a6e5)[_0x3448('0x28')](function(_0x3db5f1){_0xff6513['count']=_0x3db5f1;if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x46')]){_0x493898[_0x3448('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x3448('0x48')](_0x493898);})[_0x3448('0x28')](function(_0x21f989){_0xff6513[_0x3448('0x49')]=_0x21f989;return _0xff6513;})[_0x3448('0x28')](respondWithFilteredResult(_0x486f2c,_0x493898))[_0x3448('0x4a')](handleError(_0x486f2c,null));};exports[_0x3448('0x4b')]=function(_0x4f54e7,_0x2165c7){var _0x46b172={'raw':!![],'where':{'id':_0x4f54e7[_0x3448('0x4c')]['id']}},_0x1e7fb7={};_0x1e7fb7[_0x3448('0x33')]=_[_0x3448('0x36')](db['VoiceMail'][_0x3448('0x30')]);_0x1e7fb7['query']=_['keys'](_0x4f54e7[_0x3448('0x35')]);_0x1e7fb7[_0x3448('0x40')]=_['intersection'](_0x1e7fb7[_0x3448('0x33')],_0x1e7fb7[_0x3448('0x35')]);_0x46b172['attributes']=_[_0x3448('0x37')](_0x1e7fb7[_0x3448('0x33')],qs['fields'](_0x4f54e7[_0x3448('0x35')][_0x3448('0x39')]));_0x46b172[_0x3448('0x38')]=_0x46b172[_0x3448('0x38')][_0x3448('0x3a')]?_0x46b172[_0x3448('0x38')]:_0x1e7fb7[_0x3448('0x33')];if(_0x4f54e7['query']['includeAll']){_0x46b172[_0x3448('0x47')]=[{'all':!![]}];}_0x46b172=_[_0x3448('0x42')]({},_0x46b172,_0x4f54e7[_0x3448('0x45')]);return db[_0x3448('0x2f')]['find'](_0x46b172)[_0x3448('0x28')](handleEntityNotFound(_0x2165c7,null))[_0x3448('0x28')](respondWithResult(_0x2165c7,null))[_0x3448('0x4a')](handleError(_0x2165c7,null));};exports[_0x3448('0x4d')]=function(_0x363374,_0x5d942b){return db[_0x3448('0x2f')]['create'](_0x363374[_0x3448('0x4e')],{})[_0x3448('0x28')](function(_0x5c8e42){var _0x479b79=_0x363374[_0x3448('0x4f')][_0x3448('0x29')]({'plain':!![]});if(!_0x479b79)throw new Error(_0x3448('0x50'));if(_0x479b79[_0x3448('0x51')]===_0x3448('0x4f')){var _0xc769e1=_0x5c8e42['get']({'plain':!![]});var _0x23dbda=_0x3448('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x23dbda,'userProfileId':_0x479b79[_0x3448('0x52')]},'raw':!![]})[_0x3448('0x28')](function(_0x4d20ba){if(_0x4d20ba&&_0x4d20ba['autoAssociation']===0x0){return db[_0x3448('0x2b')][_0x3448('0x4d')]({'name':_0xc769e1[_0x3448('0x2d')],'resourceId':_0xc769e1['id'],'type':_0x4d20ba[_0x3448('0x2d')],'sectionId':_0x4d20ba['id']},{})[_0x3448('0x28')](function(){return _0x5c8e42;});}else{return _0x5c8e42;}})[_0x3448('0x4a')](function(_0x2aea70){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aea70);throw _0x2aea70;});}return _0x5c8e42;})['then'](respondWithResult(_0x5d942b,0xc9))[_0x3448('0x4a')](handleError(_0x5d942b,null));};exports[_0x3448('0x26')]=function(_0x5cf3fe,_0x35ce1d){if(_0x5cf3fe[_0x3448('0x4e')]['id']){delete _0x5cf3fe['body']['id'];}return db[_0x3448('0x2f')][_0x3448('0x53')]({'where':{'id':_0x5cf3fe['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x35ce1d,null))[_0x3448('0x28')](saveUpdates(_0x5cf3fe[_0x3448('0x4e')],null))[_0x3448('0x28')](respondWithResult(_0x35ce1d,null))[_0x3448('0x4a')](handleError(_0x35ce1d,null));};exports[_0x3448('0x27')]=function(_0xeda861,_0x1b7d87){return db[_0x3448('0x2f')]['find']({'where':{'id':_0xeda861[_0x3448('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b7d87,null))[_0x3448('0x28')](removeEntity(_0x1b7d87,null))[_0x3448('0x4a')](handleError(_0x1b7d87,null));};exports[_0x3448('0x54')]=function(_0x58422,_0x1cbeae,_0x332e02){return db['VoiceMail'][_0x3448('0x55')]({'where':{'id':_0x58422['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x1cbeae,null))[_0x3448('0x28')](function(_0x3bf4d2){var _0x5c9320;var _0x3ead11={},_0x4e381f={};_0x4e381f['model']=_[_0x3448('0x36')](db[_0x3448('0x56')][_0x3448('0x30')]);_0x4e381f['query']=_[_0x3448('0x36')](_0x58422[_0x3448('0x35')]);_0x4e381f[_0x3448('0x40')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],_0x4e381f[_0x3448('0x35')]);_0x3ead11[_0x3448('0x38')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],qs[_0x3448('0x39')](_0x58422[_0x3448('0x35')][_0x3448('0x39')]));_0x3ead11[_0x3448('0x38')]=_0x3ead11[_0x3448('0x38')][_0x3448('0x3a')]?_0x3ead11[_0x3448('0x38')]:_0x4e381f[_0x3448('0x33')];if(!_0x58422[_0x3448('0x35')]['hasOwnProperty'](_0x3448('0x3c'))){_0x3ead11['limit']=qs[_0x3448('0x21')](_0x58422['query'][_0x3448('0x21')]);_0x3ead11[_0x3448('0x1f')]=qs['offset'](_0x58422[_0x3448('0x35')][_0x3448('0x1f')]);}_0x3ead11['order']=qs['sort'](_0x58422[_0x3448('0x35')]['sort']);_0x3ead11['where']=qs[_0x3448('0x40')](_[_0x3448('0x3f')](_0x58422['query'],_0x4e381f['filters']));if(_0x58422[_0x3448('0x35')][_0x3448('0x41')]){_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x3ead11[_0x3448('0x38')],function(_0x10749d){var _0x2cf3ef={};_0x2cf3ef[_0x10749d]={'$like':'%'+_0x58422[_0x3448('0x35')][_0x3448('0x41')]+'%'};return _0x2cf3ef;})});}_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'mailboxuser':_0x3bf4d2['mailbox']});_0x3ead11=_[_0x3448('0x42')]({},_0x3ead11,_0x58422[_0x3448('0x45')]);return db['VoiceMailMessage'][_0x3448('0x57')](_0x3ead11)[_0x3448('0x28')](respondWithFilteredResult(_0x1cbeae,_0x3ead11));})['catch'](handleError(_0x1cbeae,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a9af431..c51430e 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 _0xc612=['voice_voicemail','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4776cf,_0x3321b0){var _0x42eaa7=function(_0x45dadc){while(--_0x45dadc){_0x4776cf['push'](_0x4776cf['shift']());}};_0x42eaa7(++_0x3321b0);}(_0xc612,0x1e2));var _0x2c61=function(_0x1e2a75,_0x43f28d){_0x1e2a75=_0x1e2a75-0x0;var _0x509036=_0xc612[_0x1e2a75];return _0x509036;};'use strict';var _=require(_0x2c61('0x0'));var util=require(_0x2c61('0x1'));var logger=require(_0x2c61('0x2'))(_0x2c61('0x3'));var moment=require(_0x2c61('0x4'));var BPromise=require(_0x2c61('0x5'));var rp=require(_0x2c61('0x6'));var fs=require('fs');var path=require(_0x2c61('0x7'));var rimraf=require(_0x2c61('0x8'));var config=require(_0x2c61('0x9'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x4ac43a,_0x5a4bca){return _0x4ac43a['define']('VoiceMail',attributes,{'tableName':_0x2c61('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x2c61('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7d8=['mailbox_context','mailbox','context','lodash','../../config/logger','moment','bluebird','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0xc7d8,0xf1));var _0x8c7d=function(_0x31700a,_0xbef47){_0x31700a=_0x31700a-0x0;var _0x48014c=_0xc7d8[_0x31700a];return _0x48014c;};'use strict';var _=require(_0x8c7d('0x0'));var util=require('util');var logger=require(_0x8c7d('0x1'))('api');var moment=require(_0x8c7d('0x2'));var BPromise=require(_0x8c7d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c7d('0x4'));var rimraf=require(_0x8c7d('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c7d('0x6'));module[_0x8c7d('0x7')]=function(_0xfb1cf,_0x1d6d4b){return _0xfb1cf[_0x8c7d('0x8')](_0x8c7d('0x9'),attributes,{'tableName':_0x8c7d('0xa'),'paranoid':![],'indexes':[{'name':_0x8c7d('0xb'),'fields':[_0x8c7d('0xc'),_0x8c7d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index be2b7a2..34b753a 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 _0x173e=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2d96e2,_0x5a5ada){var _0x547a05=function(_0x227e5a){while(--_0x227e5a){_0x2d96e2['push'](_0x2d96e2['shift']());}};_0x547a05(++_0x5a5ada);}(_0x173e,0xae));var _0xe173=function(_0x1b9200,_0x1ba6bf){_0x1b9200=_0x1b9200-0x0;var _0x15d841=_0x173e[_0x1b9200];return _0x15d841;};'use strict';var _=require('lodash');var util=require(_0xe173('0x0'));var moment=require(_0xe173('0x1'));var BPromise=require(_0xe173('0x2'));var rs=require(_0xe173('0x3'));var fs=require('fs');var Redis=require(_0xe173('0x4'));var db=require(_0xe173('0x5'))['db'];var utils=require(_0xe173('0x6'));var logger=require(_0xe173('0x7'))(_0xe173('0x8'));var config=require(_0xe173('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ddc13,_0x5d8d51,_0xcde3e9){return new BPromise(function(_0x108643,_0xfb9434){return client['request'](_0x1ddc13,_0xcde3e9)['then'](function(_0x3146d0){logger['info'](_0xe173('0xa'),_0x5d8d51,_0xe173('0xb'));logger[_0xe173('0xc')](_0xe173('0xd'),_0x5d8d51,_0xe173('0xb'),JSON[_0xe173('0xe')](_0x3146d0));if(_0x3146d0[_0xe173('0xf')]){if(_0x3146d0[_0xe173('0xf')][_0xe173('0x10')]===0x1f4){logger[_0xe173('0xf')](_0xe173('0xa'),_0x5d8d51,_0x3146d0[_0xe173('0xf')][_0xe173('0x11')]);return _0xfb9434(_0x3146d0[_0xe173('0xf')]['message']);}logger[_0xe173('0xf')]('VoiceMail,\x20%s,\x20%s',_0x5d8d51,_0x3146d0[_0xe173('0xf')][_0xe173('0x11')]);return _0x108643(_0x3146d0[_0xe173('0xf')][_0xe173('0x11')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x5d8d51,_0xe173('0xb'));_0x108643(_0x3146d0['result'][_0xe173('0x11')]);}})[_0xe173('0x12')](function(_0x1e9b25){logger[_0xe173('0xf')](_0xe173('0xa'),_0x5d8d51,_0x1e9b25);_0xfb9434(_0x1e9b25);});});} \ No newline at end of file +var _0x912a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x501838,_0x1e77fc){var _0x1b7fe9=function(_0x264e21){while(--_0x264e21){_0x501838['push'](_0x501838['shift']());}};_0x1b7fe9(++_0x1e77fc);}(_0x912a,0xf7));var _0xa912=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x912a[_0x44cb92];return _0x56b9e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa912('0x0'));var BPromise=require(_0xa912('0x1'));var rs=require(_0xa912('0x2'));var fs=require('fs');var Redis=require(_0xa912('0x3'));var db=require(_0xa912('0x4'))['db'];var utils=require(_0xa912('0x5'));var logger=require(_0xa912('0x6'))(_0xa912('0x7'));var config=require(_0xa912('0x8'));var jayson=require(_0xa912('0x9'));var client=jayson[_0xa912('0xa')][_0xa912('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ef3fc,_0x30c7c9,_0x50820d){return new BPromise(function(_0x3aff13,_0x1a925d){return client[_0xa912('0xc')](_0x4ef3fc,_0x50820d)['then'](function(_0x5a6f2f){logger[_0xa912('0xd')](_0xa912('0xe'),_0x30c7c9,'request\x20sent');logger[_0xa912('0xf')](_0xa912('0x10'),_0x30c7c9,_0xa912('0x11'),JSON[_0xa912('0x12')](_0x5a6f2f));if(_0x5a6f2f[_0xa912('0x13')]){if(_0x5a6f2f[_0xa912('0x13')][_0xa912('0x14')]===0x1f4){logger['error'](_0xa912('0xe'),_0x30c7c9,_0x5a6f2f[_0xa912('0x13')][_0xa912('0x15')]);return _0x1a925d(_0x5a6f2f[_0xa912('0x13')]['message']);}logger[_0xa912('0x13')]('VoiceMail,\x20%s,\x20%s',_0x30c7c9,_0x5a6f2f[_0xa912('0x13')][_0xa912('0x15')]);return _0x3aff13(_0x5a6f2f[_0xa912('0x13')]['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x30c7c9,_0xa912('0x11'));_0x3aff13(_0x5a6f2f[_0xa912('0x16')]['message']);}})['catch'](function(_0x4c0b45){logger[_0xa912('0x13')](_0xa912('0xe'),_0x30c7c9,_0x4c0b45);_0x1a925d(_0x4c0b45);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2fd48ea..09686e4 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 _0x6c1b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','path','connect-timeout','express','Router'];(function(_0x5bd6ac,_0x1a1eac){var _0x5b8e82=function(_0x59bcbd){while(--_0x59bcbd){_0x5bd6ac['push'](_0x5bd6ac['shift']());}};_0x5b8e82(++_0x1a1eac);}(_0x6c1b,0x152));var _0xb6c1=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x6c1b[_0x21ecc8];return _0x510c1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb6c1('0x0'));var timeout=require(_0xb6c1('0x1'));var express=require(_0xb6c1('0x2'));var router=express[_0xb6c1('0x3')]();var fs_extra=require(_0xb6c1('0x4'));var auth=require(_0xb6c1('0x5'));var interaction=require(_0xb6c1('0x6'));var config=require(_0xb6c1('0x7'));var controller=require('./voiceMailMessage.controller');router[_0xb6c1('0x8')]('/',auth[_0xb6c1('0x9')](),controller['index']);router[_0xb6c1('0x8')](_0xb6c1('0xa'),auth[_0xb6c1('0x9')](),controller[_0xb6c1('0xb')]);router[_0xb6c1('0x8')](_0xb6c1('0xc'),auth['isAuthenticated'](),controller[_0xb6c1('0xd')]);router[_0xb6c1('0xe')]('/',auth[_0xb6c1('0x9')](),controller[_0xb6c1('0xf')]);router[_0xb6c1('0x10')]('/:id',auth[_0xb6c1('0x9')](),controller[_0xb6c1('0x11')]);router[_0xb6c1('0x12')](_0xb6c1('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1ffd=['/:id','show','download','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x45a8f7,_0x24b581){var _0x42c318=function(_0xdc01e0){while(--_0xdc01e0){_0x45a8f7['push'](_0x45a8f7['shift']());}};_0x42c318(++_0x24b581);}(_0x1ffd,0x1ed));var _0xd1ff=function(_0x2ac58c,_0x2489be){_0x2ac58c=_0x2ac58c-0x0;var _0x459dd8=_0x1ffd[_0x2ac58c];return _0x459dd8;};'use strict';var multer=require(_0xd1ff('0x0'));var util=require('util');var path=require(_0xd1ff('0x1'));var timeout=require(_0xd1ff('0x2'));var express=require(_0xd1ff('0x3'));var router=express[_0xd1ff('0x4')]();var fs_extra=require(_0xd1ff('0x5'));var auth=require(_0xd1ff('0x6'));var interaction=require(_0xd1ff('0x7'));var config=require(_0xd1ff('0x8'));var controller=require(_0xd1ff('0x9'));router[_0xd1ff('0xa')]('/',auth[_0xd1ff('0xb')](),controller[_0xd1ff('0xc')]);router[_0xd1ff('0xa')](_0xd1ff('0xd'),auth[_0xd1ff('0xb')](),controller[_0xd1ff('0xe')]);router['get']('/:id/download',auth[_0xd1ff('0xb')](),controller[_0xd1ff('0xf')]);router['post']('/',auth[_0xd1ff('0xb')](),controller[_0xd1ff('0x10')]);router[_0xd1ff('0x11')](_0xd1ff('0xd'),auth['isAuthenticated'](),controller[_0xd1ff('0x12')]);router[_0xd1ff('0x13')](_0xd1ff('0xd'),auth['isAuthenticated'](),controller[_0xd1ff('0x14')]);module[_0xd1ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 236a283..f6b7fff 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 _0x8915=['BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8915,0xdc));var _0x5891=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x8915[_0x52f1e6];return _0x21f104;};'use strict';var Sequelize=require(_0x5891('0x0'));module['exports']={'name':{'type':Sequelize[_0x5891('0x1')],'get':function(_0x1054b0){return this[_0x5891('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5891('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5891('0x5')](_0x5891('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5891('0x4')],'defaultValue':''},'stamp':{'type':_0x5891('0x7'),'defaultValue':Sequelize['literal'](_0x5891('0x8'))}}; \ No newline at end of file +var _0x0941=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0941,0x81));var _0x1094=function(_0x35d3bd,_0x4d9b60){_0x35d3bd=_0x35d3bd-0x0;var _0x59feda=_0x0941[_0x35d3bd];return _0x59feda;};'use strict';var Sequelize=require(_0x1094('0x0'));module[_0x1094('0x1')]={'name':{'type':Sequelize[_0x1094('0x2')],'get':function(_0x46c863){return this[_0x1094('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x1094('0x5')](_0x1094('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x1094('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x1094('0x7'),'defaultValue':Sequelize[_0x1094('0x8')](_0x1094('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3835038..794d260 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 _0x7732=['key','model','differenceBy','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','recording','msg_id','Sequelize','ValidationError','audio/wav','Content-Disposition','.wav\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','VoiceMailMessage','fieldName','type'];(function(_0x2d4c66,_0x92b73b){var _0x8eeedf=function(_0x1c2000){while(--_0x1c2000){_0x2d4c66['push'](_0x2d4c66['shift']());}};_0x8eeedf(++_0x92b73b);}(_0x7732,0x11d));var _0x2773=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x7732[_0x59b439];return _0x521ea3;};'use strict';var emlformat=require(_0x2773('0x0'));var rimraf=require(_0x2773('0x1'));var zipdir=require(_0x2773('0x2'));var jsonpatch=require(_0x2773('0x3'));var rp=require('request-promise');var moment=require(_0x2773('0x4'));var BPromise=require(_0x2773('0x5'));var Mustache=require('mustache');var util=require(_0x2773('0x6'));var path=require(_0x2773('0x7'));var sox=require(_0x2773('0x8'));var csv=require(_0x2773('0x9'));var ejs=require(_0x2773('0xa'));var fs=require('fs');var fs_extra=require(_0x2773('0xb'));var _=require(_0x2773('0xc'));var squel=require(_0x2773('0xd'));var crypto=require(_0x2773('0xe'));var jsforce=require(_0x2773('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2773('0x9'));var querystring=require(_0x2773('0x10'));var Papa=require(_0x2773('0x11'));var Redis=require(_0x2773('0x12'));var authService=require(_0x2773('0x13'));var qs=require(_0x2773('0x14'));var as=require(_0x2773('0x15'));var hardwareService=require(_0x2773('0x16'));var logger=require('../../config/logger')(_0x2773('0x17'));var utils=require(_0x2773('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2773('0x19'));var db=require(_0x2773('0x1a'))['db'];function respondWithStatusCode(_0xf54503,_0x371e6b){_0x371e6b=_0x371e6b||0xcc;return function(_0x2a66f7){if(_0x2a66f7){return _0xf54503['sendStatus'](_0x371e6b);}return _0xf54503['status'](_0x371e6b)['end']();};}function respondWithResult(_0x1541f9,_0x383e58){_0x383e58=_0x383e58||0xc8;return function(_0xcbc5a8){if(_0xcbc5a8){return _0x1541f9[_0x2773('0x1b')](_0x383e58)[_0x2773('0x1c')](_0xcbc5a8);}};}function respondWithFilteredResult(_0x1770a7,_0x23c5b0){return function(_0x4dae7f){if(_0x4dae7f){var _0x37159a=typeof _0x23c5b0['offset']===_0x2773('0x1d')&&typeof _0x23c5b0[_0x2773('0x1e')]==='undefined';var _0x2778b6=_0x4dae7f['count'];var _0xb43b07=_0x37159a?0x0:_0x23c5b0['offset'];var _0x11a1ec=_0x37159a?_0x4dae7f[_0x2773('0x1f')]:_0x23c5b0[_0x2773('0x20')]+_0x23c5b0[_0x2773('0x1e')];var _0x3d4aff;if(_0x11a1ec>=_0x2778b6){_0x11a1ec=_0x2778b6;_0x3d4aff=0xc8;}else{_0x3d4aff=0xce;}_0x1770a7[_0x2773('0x1b')](_0x3d4aff);return _0x1770a7['set'](_0x2773('0x21'),_0xb43b07+'-'+_0x11a1ec+'/'+_0x2778b6)['json'](_0x4dae7f);}return null;};}function patchUpdates(_0x1b3500){return function(_0x337f3c){try{jsonpatch[_0x2773('0x22')](_0x337f3c,_0x1b3500,!![]);}catch(_0x5688a5){return BPromise['reject'](_0x5688a5);}return _0x337f3c[_0x2773('0x23')]();};}function saveUpdates(_0x289928,_0x30d33a){return function(_0x3f9a90){if(_0x3f9a90){return _0x3f9a90[_0x2773('0x24')](_0x289928)['then'](function(_0x23346f){return _0x23346f;});}return null;};}function removeEntity(_0xd0954f,_0xcd31e2){return function(_0x48899e){if(_0x48899e){return _0x48899e[_0x2773('0x25')]()[_0x2773('0x26')](function(){_0xd0954f['status'](0xcc)[_0x2773('0x27')]();});}};}function handleEntityNotFound(_0x28876a,_0x5aa853){return function(_0x344160){if(!_0x344160){_0x28876a[_0x2773('0x28')](0x194);}return _0x344160;};}function handleError(_0x47e027,_0x3ca669){_0x3ca669=_0x3ca669||0x1f4;return function(_0x6f9a96){logger[_0x2773('0x29')](_0x6f9a96[_0x2773('0x2a')]);if(_0x6f9a96[_0x2773('0x2b')]){delete _0x6f9a96[_0x2773('0x2b')];}_0x47e027[_0x2773('0x1b')](_0x3ca669)['send'](_0x6f9a96);};}exports['index']=function(_0x1c2325,_0x18bda4){var _0x45a2dc={},_0x53aeae={},_0x109b9d={'count':0x0,'rows':[]};var _0x10348e=_['map'](db[_0x2773('0x2c')]['rawAttributes'],function(_0x152433){return{'name':_0x152433[_0x2773('0x2d')],'type':_0x152433[_0x2773('0x2e')][_0x2773('0x2f')]};});_0x53aeae[_0x2773('0x30')]=_[_0x2773('0x31')](_[_0x2773('0x32')](_0x10348e,_0x2773('0x2b')),[_0x2773('0x2b')]);_0x53aeae[_0x2773('0x33')]=_['keys'](_0x1c2325[_0x2773('0x33')]);_0x53aeae[_0x2773('0x34')]=_[_0x2773('0x35')](_0x53aeae[_0x2773('0x30')],_0x53aeae[_0x2773('0x33')]);_0x45a2dc[_0x2773('0x36')]=_[_0x2773('0x35')](_0x53aeae[_0x2773('0x30')],qs['fields'](_0x1c2325[_0x2773('0x33')]['fields']));_0x45a2dc[_0x2773('0x36')]=_0x45a2dc[_0x2773('0x36')][_0x2773('0x37')]?_0x45a2dc[_0x2773('0x36')]:_0x53aeae[_0x2773('0x30')];if(!_0x1c2325[_0x2773('0x33')][_0x2773('0x38')](_0x2773('0x39'))){_0x45a2dc[_0x2773('0x1e')]=qs['limit'](_0x1c2325[_0x2773('0x33')][_0x2773('0x1e')]);_0x45a2dc[_0x2773('0x20')]=qs[_0x2773('0x20')](_0x1c2325[_0x2773('0x33')][_0x2773('0x20')]);}_0x45a2dc[_0x2773('0x3a')]=qs[_0x2773('0x3b')](_0x1c2325['query'][_0x2773('0x3b')]);_0x45a2dc['where']=qs['filters'](_['pick'](_0x1c2325[_0x2773('0x33')],_0x53aeae['filters']),_0x10348e);if(_0x1c2325[_0x2773('0x33')]['filter']){_0x45a2dc[_0x2773('0x3c')]=_[_0x2773('0x3d')](_0x45a2dc['where'],{'$or':_[_0x2773('0x32')](_0x10348e,function(_0x24ba88){if(_0x24ba88['type']!==_0x2773('0x3e')){var _0x41352f={};_0x41352f[_0x24ba88[_0x2773('0x2b')]]={'$like':'%'+_0x1c2325[_0x2773('0x33')]['filter']+'%'};return _0x41352f;}})});}_0x45a2dc=_[_0x2773('0x3d')]({},_0x45a2dc,_0x1c2325[_0x2773('0x3f')]);var _0xc8db64={'where':_0x45a2dc[_0x2773('0x3c')]};return db['VoiceMailMessage']['count'](_0xc8db64)[_0x2773('0x26')](function(_0x4f021e){_0x109b9d[_0x2773('0x1f')]=_0x4f021e;if(_0x1c2325[_0x2773('0x33')][_0x2773('0x40')]){_0x45a2dc[_0x2773('0x41')]=[{'all':!![]}];}return db[_0x2773('0x2c')][_0x2773('0x42')](_0x45a2dc);})[_0x2773('0x26')](function(_0x4f6459){_0x109b9d['rows']=_0x4f6459;return _0x109b9d;})[_0x2773('0x26')](respondWithFilteredResult(_0x18bda4,_0x45a2dc))[_0x2773('0x43')](handleError(_0x18bda4,null));};exports['show']=function(_0x274f46,_0x5d5436){var _0x667ad7={'raw':!![],'where':{'id':_0x274f46[_0x2773('0x44')]['id']}},_0x368751={};_0x368751[_0x2773('0x30')]=_[_0x2773('0x45')](db[_0x2773('0x2c')][_0x2773('0x46')]);_0x368751['query']=_[_0x2773('0x45')](_0x274f46[_0x2773('0x33')]);_0x368751[_0x2773('0x34')]=_[_0x2773('0x35')](_0x368751[_0x2773('0x30')],_0x368751[_0x2773('0x33')]);_0x667ad7[_0x2773('0x36')]=_['intersection'](_0x368751[_0x2773('0x30')],qs['fields'](_0x274f46[_0x2773('0x33')]['fields']));_0x667ad7[_0x2773('0x36')]=_0x667ad7[_0x2773('0x36')]['length']?_0x667ad7[_0x2773('0x36')]:_0x368751[_0x2773('0x30')];if(_0x274f46[_0x2773('0x33')][_0x2773('0x40')]){_0x667ad7['include']=[{'all':!![]}];}_0x667ad7=_[_0x2773('0x3d')]({},_0x667ad7,_0x274f46[_0x2773('0x3f')]);return db[_0x2773('0x2c')][_0x2773('0x47')](_0x667ad7)[_0x2773('0x26')](handleEntityNotFound(_0x5d5436,null))[_0x2773('0x26')](respondWithResult(_0x5d5436,null))[_0x2773('0x43')](handleError(_0x5d5436,null));};exports[_0x2773('0x48')]=function(_0x297dc4,_0x58bcb6){return db['VoiceMailMessage']['create'](_0x297dc4[_0x2773('0x49')],{})[_0x2773('0x26')](respondWithResult(_0x58bcb6,0xc9))['catch'](handleError(_0x58bcb6,null));};exports[_0x2773('0x24')]=function(_0x1af667,_0x3d65fd){if(_0x1af667[_0x2773('0x49')]['id']){delete _0x1af667[_0x2773('0x49')]['id'];}return db[_0x2773('0x2c')][_0x2773('0x47')]({'where':{'id':_0x1af667[_0x2773('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d65fd,null))[_0x2773('0x26')](saveUpdates(_0x1af667[_0x2773('0x49')],null))[_0x2773('0x26')](respondWithResult(_0x3d65fd,null))[_0x2773('0x43')](handleError(_0x3d65fd,null));};exports[_0x2773('0x25')]=function(_0x64829c,_0x4e6410){return db['VoiceMailMessage'][_0x2773('0x47')]({'where':{'id':_0x64829c[_0x2773('0x44')]['id']}})[_0x2773('0x26')](handleEntityNotFound(_0x4e6410,null))[_0x2773('0x26')](removeEntity(_0x4e6410,null))[_0x2773('0x43')](handleError(_0x4e6410,null));};exports['download']=function(_0x2776aa,_0x2dbbd3,_0x50075d){return db[_0x2773('0x2c')]['find']({'where':{'id':_0x2776aa[_0x2773('0x44')]['id']},'attributes':['id',_0x2773('0x4a'),_0x2773('0x4b')]})[_0x2773('0x26')](handleEntityNotFound(_0x2dbbd3,null))['then'](function(_0x29f879){if(_0x29f879){if(!_0x29f879[_0x2773('0x4a')]){throw new db[(_0x2773('0x4c'))][(_0x2773('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x1dd1cf={'Content-Type':_0x2773('0x4e'),'Content-Disposition':'attachment'};if(_0x29f879[_0x2773('0x4b')]){_0x1dd1cf[_0x2773('0x4f')]='attachment;\x20filename=\x22'+_0x29f879[_0x2773('0x4b')]+_0x2773('0x50');}_0x2dbbd3[_0x2773('0x51')](_0x1dd1cf);return _0x2dbbd3[_0x2773('0x52')](new Buffer(_0x29f879[_0x2773('0x4a')]));}})[_0x2773('0x43')](handleError(_0x2dbbd3,null));}; \ No newline at end of file +var _0xbdc8=['status','set','apply','reject','update','then','destroy','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count'];(function(_0x2dec4d,_0x535d6b){var _0x4cdffa=function(_0x5da5cf){while(--_0x5da5cf){_0x2dec4d['push'](_0x2dec4d['shift']());}};_0x4cdffa(++_0x535d6b);}(_0xbdc8,0x88));var _0x8bdc=function(_0x38ceeb,_0x30bc58){_0x38ceeb=_0x38ceeb-0x0;var _0x4ae0a2=_0xbdc8[_0x38ceeb];return _0x4ae0a2;};'use strict';var emlformat=require(_0x8bdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bdc('0x1'));var jsonpatch=require(_0x8bdc('0x2'));var rp=require(_0x8bdc('0x3'));var moment=require(_0x8bdc('0x4'));var BPromise=require(_0x8bdc('0x5'));var Mustache=require('mustache');var util=require(_0x8bdc('0x6'));var path=require(_0x8bdc('0x7'));var sox=require(_0x8bdc('0x8'));var csv=require(_0x8bdc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bdc('0xa'));var _=require(_0x8bdc('0xb'));var squel=require(_0x8bdc('0xc'));var crypto=require(_0x8bdc('0xd'));var jsforce=require(_0x8bdc('0xe'));var deskjs=require(_0x8bdc('0xf'));var toCsv=require(_0x8bdc('0x9'));var querystring=require(_0x8bdc('0x10'));var Papa=require(_0x8bdc('0x11'));var Redis=require(_0x8bdc('0x12'));var authService=require(_0x8bdc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8bdc('0x14'));var hardwareService=require(_0x8bdc('0x15'));var logger=require(_0x8bdc('0x16'))(_0x8bdc('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8bdc('0x18'))['db'];function respondWithStatusCode(_0x3e7dbf,_0x21af62){_0x21af62=_0x21af62||0xcc;return function(_0x290561){if(_0x290561){return _0x3e7dbf[_0x8bdc('0x19')](_0x21af62);}return _0x3e7dbf['status'](_0x21af62)[_0x8bdc('0x1a')]();};}function respondWithResult(_0x5e3160,_0x43837d){_0x43837d=_0x43837d||0xc8;return function(_0x26d0aa){if(_0x26d0aa){return _0x5e3160['status'](_0x43837d)[_0x8bdc('0x1b')](_0x26d0aa);}};}function respondWithFilteredResult(_0x2aa1f5,_0x244740){return function(_0x5f26c8){if(_0x5f26c8){var _0x268a40=typeof _0x244740[_0x8bdc('0x1c')]===_0x8bdc('0x1d')&&typeof _0x244740[_0x8bdc('0x1e')]==='undefined';var _0x33fb9d=_0x5f26c8[_0x8bdc('0x1f')];var _0x516552=_0x268a40?0x0:_0x244740[_0x8bdc('0x1c')];var _0x45c929=_0x268a40?_0x5f26c8[_0x8bdc('0x1f')]:_0x244740[_0x8bdc('0x1c')]+_0x244740[_0x8bdc('0x1e')];var _0xd93f1b;if(_0x45c929>=_0x33fb9d){_0x45c929=_0x33fb9d;_0xd93f1b=0xc8;}else{_0xd93f1b=0xce;}_0x2aa1f5[_0x8bdc('0x20')](_0xd93f1b);return _0x2aa1f5[_0x8bdc('0x21')]('Content-Range',_0x516552+'-'+_0x45c929+'/'+_0x33fb9d)['json'](_0x5f26c8);}return null;};}function patchUpdates(_0x43c055){return function(_0x33d726){try{jsonpatch[_0x8bdc('0x22')](_0x33d726,_0x43c055,!![]);}catch(_0x2fc9ab){return BPromise[_0x8bdc('0x23')](_0x2fc9ab);}return _0x33d726['save']();};}function saveUpdates(_0x42e216,_0x38dfb9){return function(_0x270654){if(_0x270654){return _0x270654[_0x8bdc('0x24')](_0x42e216)[_0x8bdc('0x25')](function(_0x3dccc7){return _0x3dccc7;});}return null;};}function removeEntity(_0x390ed4,_0x5e47fc){return function(_0x3d8bcd){if(_0x3d8bcd){return _0x3d8bcd[_0x8bdc('0x26')]()['then'](function(){_0x390ed4[_0x8bdc('0x20')](0xcc)[_0x8bdc('0x1a')]();});}};}function handleEntityNotFound(_0x49f55b,_0x399b25){return function(_0x4e0ad1){if(!_0x4e0ad1){_0x49f55b['sendStatus'](0x194);}return _0x4e0ad1;};}function handleError(_0x4d84bf,_0x349e0a){_0x349e0a=_0x349e0a||0x1f4;return function(_0x82832c){logger[_0x8bdc('0x27')](_0x82832c['stack']);if(_0x82832c[_0x8bdc('0x28')]){delete _0x82832c[_0x8bdc('0x28')];}_0x4d84bf[_0x8bdc('0x20')](_0x349e0a)[_0x8bdc('0x29')](_0x82832c);};}exports[_0x8bdc('0x2a')]=function(_0xfed695,_0x593687){var _0x763b84={},_0x52bccb={},_0x15db01={'count':0x0,'rows':[]};var _0x425af4=_[_0x8bdc('0x2b')](db[_0x8bdc('0x2c')][_0x8bdc('0x2d')],function(_0x4afc22){return{'name':_0x4afc22[_0x8bdc('0x2e')],'type':_0x4afc22[_0x8bdc('0x2f')][_0x8bdc('0x30')]};});_0x52bccb['model']=_[_0x8bdc('0x31')](_['map'](_0x425af4,'name'),[_0x8bdc('0x28')]);_0x52bccb[_0x8bdc('0x32')]=_['keys'](_0xfed695[_0x8bdc('0x32')]);_0x52bccb[_0x8bdc('0x33')]=_[_0x8bdc('0x34')](_0x52bccb[_0x8bdc('0x35')],_0x52bccb[_0x8bdc('0x32')]);_0x763b84['attributes']=_['intersection'](_0x52bccb['model'],qs[_0x8bdc('0x36')](_0xfed695[_0x8bdc('0x32')]['fields']));_0x763b84['attributes']=_0x763b84[_0x8bdc('0x37')][_0x8bdc('0x38')]?_0x763b84[_0x8bdc('0x37')]:_0x52bccb[_0x8bdc('0x35')];if(!_0xfed695['query'][_0x8bdc('0x39')](_0x8bdc('0x3a'))){_0x763b84['limit']=qs['limit'](_0xfed695[_0x8bdc('0x32')]['limit']);_0x763b84[_0x8bdc('0x1c')]=qs[_0x8bdc('0x1c')](_0xfed695[_0x8bdc('0x32')][_0x8bdc('0x1c')]);}_0x763b84[_0x8bdc('0x3b')]=qs['sort'](_0xfed695[_0x8bdc('0x32')][_0x8bdc('0x3c')]);_0x763b84[_0x8bdc('0x3d')]=qs[_0x8bdc('0x33')](_['pick'](_0xfed695[_0x8bdc('0x32')],_0x52bccb[_0x8bdc('0x33')]),_0x425af4);if(_0xfed695[_0x8bdc('0x32')]['filter']){_0x763b84['where']=_[_0x8bdc('0x3e')](_0x763b84['where'],{'$or':_['map'](_0x425af4,function(_0x4f997b){if(_0x4f997b[_0x8bdc('0x2f')]!==_0x8bdc('0x3f')){var _0x555c8d={};_0x555c8d[_0x4f997b['name']]={'$like':'%'+_0xfed695[_0x8bdc('0x32')][_0x8bdc('0x40')]+'%'};return _0x555c8d;}})});}_0x763b84=_[_0x8bdc('0x3e')]({},_0x763b84,_0xfed695['options']);var _0xe14a79={'where':_0x763b84[_0x8bdc('0x3d')]};return db[_0x8bdc('0x2c')][_0x8bdc('0x1f')](_0xe14a79)[_0x8bdc('0x25')](function(_0x8ae0bd){_0x15db01[_0x8bdc('0x1f')]=_0x8ae0bd;if(_0xfed695[_0x8bdc('0x32')][_0x8bdc('0x41')]){_0x763b84[_0x8bdc('0x42')]=[{'all':!![]}];}return db[_0x8bdc('0x2c')][_0x8bdc('0x43')](_0x763b84);})[_0x8bdc('0x25')](function(_0x37c71d){_0x15db01[_0x8bdc('0x44')]=_0x37c71d;return _0x15db01;})[_0x8bdc('0x25')](respondWithFilteredResult(_0x593687,_0x763b84))[_0x8bdc('0x45')](handleError(_0x593687,null));};exports[_0x8bdc('0x46')]=function(_0x4b8543,_0x440b79){var _0x15a1f5={'raw':!![],'where':{'id':_0x4b8543[_0x8bdc('0x47')]['id']}},_0x21bcd6={};_0x21bcd6[_0x8bdc('0x35')]=_[_0x8bdc('0x48')](db['VoiceMailMessage'][_0x8bdc('0x2d')]);_0x21bcd6[_0x8bdc('0x32')]=_[_0x8bdc('0x48')](_0x4b8543[_0x8bdc('0x32')]);_0x21bcd6[_0x8bdc('0x33')]=_[_0x8bdc('0x34')](_0x21bcd6['model'],_0x21bcd6['query']);_0x15a1f5[_0x8bdc('0x37')]=_[_0x8bdc('0x34')](_0x21bcd6['model'],qs[_0x8bdc('0x36')](_0x4b8543[_0x8bdc('0x32')]['fields']));_0x15a1f5[_0x8bdc('0x37')]=_0x15a1f5[_0x8bdc('0x37')][_0x8bdc('0x38')]?_0x15a1f5['attributes']:_0x21bcd6['model'];if(_0x4b8543['query'][_0x8bdc('0x41')]){_0x15a1f5['include']=[{'all':!![]}];}_0x15a1f5=_[_0x8bdc('0x3e')]({},_0x15a1f5,_0x4b8543[_0x8bdc('0x49')]);return db[_0x8bdc('0x2c')][_0x8bdc('0x4a')](_0x15a1f5)[_0x8bdc('0x25')](handleEntityNotFound(_0x440b79,null))[_0x8bdc('0x25')](respondWithResult(_0x440b79,null))['catch'](handleError(_0x440b79,null));};exports[_0x8bdc('0x4b')]=function(_0x337488,_0x3edf0a){return db[_0x8bdc('0x2c')][_0x8bdc('0x4b')](_0x337488[_0x8bdc('0x4c')],{})[_0x8bdc('0x25')](respondWithResult(_0x3edf0a,0xc9))[_0x8bdc('0x45')](handleError(_0x3edf0a,null));};exports[_0x8bdc('0x24')]=function(_0x318f2b,_0x3470){if(_0x318f2b[_0x8bdc('0x4c')]['id']){delete _0x318f2b[_0x8bdc('0x4c')]['id'];}return db[_0x8bdc('0x2c')]['find']({'where':{'id':_0x318f2b['params']['id']}})[_0x8bdc('0x25')](handleEntityNotFound(_0x3470,null))[_0x8bdc('0x25')](saveUpdates(_0x318f2b[_0x8bdc('0x4c')],null))['then'](respondWithResult(_0x3470,null))['catch'](handleError(_0x3470,null));};exports[_0x8bdc('0x26')]=function(_0x48709d,_0x2a3b44){return db[_0x8bdc('0x2c')][_0x8bdc('0x4a')]({'where':{'id':_0x48709d[_0x8bdc('0x47')]['id']}})[_0x8bdc('0x25')](handleEntityNotFound(_0x2a3b44,null))[_0x8bdc('0x25')](removeEntity(_0x2a3b44,null))[_0x8bdc('0x45')](handleError(_0x2a3b44,null));};exports['download']=function(_0x57b3f3,_0x41a176,_0x556d05){return db[_0x8bdc('0x2c')][_0x8bdc('0x4a')]({'where':{'id':_0x57b3f3[_0x8bdc('0x47')]['id']},'attributes':['id',_0x8bdc('0x4d'),_0x8bdc('0x4e')]})[_0x8bdc('0x25')](handleEntityNotFound(_0x41a176,null))['then'](function(_0x35b44b){if(_0x35b44b){if(!_0x35b44b[_0x8bdc('0x4d')]){throw new db[(_0x8bdc('0x4f'))][(_0x8bdc('0x50'))](_0x8bdc('0x51'));}var _0x1c5b18={'Content-Type':_0x8bdc('0x52'),'Content-Disposition':'attachment'};if(_0x35b44b[_0x8bdc('0x4e')]){_0x1c5b18['Content-Disposition']=_0x8bdc('0x53')+_0x35b44b[_0x8bdc('0x4e')]+'.wav\x22';}_0x41a176['set'](_0x1c5b18);return _0x41a176[_0x8bdc('0x29')](new Buffer(_0x35b44b['recording']));}})['catch'](handleError(_0x41a176,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e10602b..e2fee50 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 _0x0881=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x59e62a,_0x24befb){var _0x283057=function(_0x30166d){while(--_0x30166d){_0x59e62a['push'](_0x59e62a['shift']());}};_0x283057(++_0x24befb);}(_0x0881,0xe9));var _0x1088=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0x0881[_0xd13171];return _0x452bd0;};'use strict';var _=require(_0x1088('0x0'));var util=require('util');var logger=require(_0x1088('0x1'))(_0x1088('0x2'));var moment=require('moment');var BPromise=require(_0x1088('0x3'));var rp=require(_0x1088('0x4'));var fs=require('fs');var path=require(_0x1088('0x5'));var rimraf=require(_0x1088('0x6'));var config=require(_0x1088('0x7'));var attributes=require(_0x1088('0x8'));module['exports']=function(_0x397546,_0x522c64){return _0x397546[_0x1088('0x9')](_0x1088('0xa'),attributes,{'tableName':_0x1088('0xb'),'paranoid':![],'indexes':[{'name':_0x1088('0xc'),'fields':[_0x1088('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x70b0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment'];(function(_0x497ca1,_0xa6ad28){var _0x2dde19=function(_0x22f89c){while(--_0x22f89c){_0x497ca1['push'](_0x497ca1['shift']());}};_0x2dde19(++_0xa6ad28);}(_0x70b0,0xd4));var _0x070b=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x70b0[_0x1bc013];return _0x55df36;};'use strict';var _=require(_0x070b('0x0'));var util=require('util');var logger=require(_0x070b('0x1'))(_0x070b('0x2'));var moment=require(_0x070b('0x3'));var BPromise=require(_0x070b('0x4'));var rp=require(_0x070b('0x5'));var fs=require('fs');var path=require(_0x070b('0x6'));var rimraf=require(_0x070b('0x7'));var config=require(_0x070b('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x070b('0x9')]=function(_0x13b6dd,_0xf44d72){return _0x13b6dd['define']('VoiceMailMessage',attributes,{'tableName':_0x070b('0xa'),'paranoid':![],'indexes':[{'name':_0x070b('0xb'),'fields':[_0x070b('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7d5fd95..298d774 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 _0x9fbc=['stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x9fbc,0x12d));var _0xc9fb=function(_0x46b057,_0x25aa56){_0x46b057=_0x46b057-0x0;var _0x25cf84=_0x9fbc[_0x46b057];return _0x25cf84;};'use strict';var _=require(_0xc9fb('0x0'));var util=require(_0xc9fb('0x1'));var moment=require(_0xc9fb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9fb('0x4'));var logger=require(_0xc9fb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9fb('0x6'));var client=jayson[_0xc9fb('0x7')][_0xc9fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1247b6,_0x24fd46,_0x15b1bd){return new BPromise(function(_0x3fdb51,_0x37c0f2){return client[_0xc9fb('0x9')](_0x1247b6,_0x15b1bd)['then'](function(_0x2702c1){logger['info'](_0xc9fb('0xa'),_0x24fd46,_0xc9fb('0xb'));logger[_0xc9fb('0xc')](_0xc9fb('0xd'),_0x24fd46,_0xc9fb('0xb'),JSON[_0xc9fb('0xe')](_0x2702c1));if(_0x2702c1['error']){if(_0x2702c1[_0xc9fb('0xf')][_0xc9fb('0x10')]===0x1f4){logger[_0xc9fb('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x24fd46,_0x2702c1[_0xc9fb('0xf')]['message']);return _0x37c0f2(_0x2702c1['error'][_0xc9fb('0x11')]);}logger[_0xc9fb('0xf')](_0xc9fb('0xa'),_0x24fd46,_0x2702c1[_0xc9fb('0xf')][_0xc9fb('0x11')]);return _0x3fdb51(_0x2702c1[_0xc9fb('0xf')][_0xc9fb('0x11')]);}else{logger[_0xc9fb('0x12')](_0xc9fb('0xa'),_0x24fd46,_0xc9fb('0xb'));_0x3fdb51(_0x2702c1[_0xc9fb('0x13')][_0xc9fb('0x11')]);}})[_0xc9fb('0x14')](function(_0x32cefc){logger[_0xc9fb('0xf')](_0xc9fb('0xa'),_0x24fd46,_0x32cefc);_0x37c0f2(_0x32cefc);});});} \ No newline at end of file +var _0x688e=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x688e,0xa3));var _0xe688=function(_0x578850,_0xf59859){_0x578850=_0x578850-0x0;var _0x223ed0=_0x688e[_0x578850];return _0x223ed0;};'use strict';var _=require(_0xe688('0x0'));var util=require(_0xe688('0x1'));var moment=require(_0xe688('0x2'));var BPromise=require('bluebird');var rs=require(_0xe688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe688('0x4'))['db'];var utils=require(_0xe688('0x5'));var logger=require(_0xe688('0x6'))(_0xe688('0x7'));var config=require(_0xe688('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe688('0x9')][_0xe688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35648e,_0x3ac2a1,_0x34c565){return new BPromise(function(_0x144e76,_0x134422){return client[_0xe688('0xb')](_0x35648e,_0x34c565)[_0xe688('0xc')](function(_0x128a91){logger[_0xe688('0xd')](_0xe688('0xe'),_0x3ac2a1,_0xe688('0xf'));logger[_0xe688('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3ac2a1,'request\x20sent',JSON[_0xe688('0x11')](_0x128a91));if(_0x128a91['error']){if(_0x128a91[_0xe688('0x12')][_0xe688('0x13')]===0x1f4){logger[_0xe688('0x12')](_0xe688('0xe'),_0x3ac2a1,_0x128a91[_0xe688('0x12')][_0xe688('0x14')]);return _0x134422(_0x128a91[_0xe688('0x12')][_0xe688('0x14')]);}logger[_0xe688('0x12')](_0xe688('0xe'),_0x3ac2a1,_0x128a91[_0xe688('0x12')][_0xe688('0x14')]);return _0x144e76(_0x128a91['error'][_0xe688('0x14')]);}else{logger['info'](_0xe688('0xe'),_0x3ac2a1,_0xe688('0xf'));_0x144e76(_0x128a91['result'][_0xe688('0x14')]);}})['catch'](function(_0x5ac4fb){logger[_0xe688('0x12')](_0xe688('0xe'),_0x3ac2a1,_0x5ac4fb);_0x134422(_0x5ac4fb);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9af8f1e..31c993e 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 _0xc713=['put','update','delete','destroy','removeSound','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create'];(function(_0x430448,_0x4345ca){var _0x34b552=function(_0xda7823){while(--_0xda7823){_0x430448['push'](_0x430448['shift']());}};_0x34b552(++_0x4345ca);}(_0xc713,0xd4));var _0x3c71=function(_0xbf3852,_0x4077dc){_0xbf3852=_0xbf3852-0x0;var _0x3000c5=_0xc713[_0xbf3852];return _0x3000c5;};'use strict';var multer=require(_0x3c71('0x0'));var util=require(_0x3c71('0x1'));var path=require(_0x3c71('0x2'));var timeout=require(_0x3c71('0x3'));var express=require('express');var router=express[_0x3c71('0x4')]();var fs_extra=require(_0x3c71('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3c71('0x6'));var config=require(_0x3c71('0x7'));var controller=require(_0x3c71('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3c71('0x9')]);router[_0x3c71('0xa')](_0x3c71('0xb'),auth[_0x3c71('0xc')](),controller[_0x3c71('0xd')]);router[_0x3c71('0xa')](_0x3c71('0xe'),auth[_0x3c71('0xc')](),controller[_0x3c71('0xf')]);router[_0x3c71('0x10')]('/',auth[_0x3c71('0xc')](),controller[_0x3c71('0x11')]);router[_0x3c71('0x10')](_0x3c71('0xe'),auth[_0x3c71('0xc')](),controller['addSound']);router[_0x3c71('0x12')](_0x3c71('0xb'),auth[_0x3c71('0xc')](),controller[_0x3c71('0x13')]);router[_0x3c71('0x14')](_0x3c71('0xb'),auth['isAuthenticated'](),controller[_0x3c71('0x15')]);router['delete']('/:id/sounds/:id2',auth[_0x3c71('0xc')](),controller[_0x3c71('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3670=['index','get','show','getSounds','post','create','put','/:id','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated'];(function(_0x270afc,_0x5117c4){var _0x1f4ede=function(_0x3d779a){while(--_0x3d779a){_0x270afc['push'](_0x270afc['shift']());}};_0x1f4ede(++_0x5117c4);}(_0x3670,0x16d));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0367('0x0'));var util=require(_0x0367('0x1'));var path=require('path');var timeout=require(_0x0367('0x2'));var express=require(_0x0367('0x3'));var router=express[_0x0367('0x4')]();var fs_extra=require(_0x0367('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0367('0x6'));var config=require('../../config/environment');var controller=require(_0x0367('0x7'));router['get']('/',auth[_0x0367('0x8')](),controller[_0x0367('0x9')]);router[_0x0367('0xa')]('/:id',auth[_0x0367('0x8')](),controller[_0x0367('0xb')]);router['get']('/:id/sounds',auth[_0x0367('0x8')](),controller[_0x0367('0xc')]);router[_0x0367('0xd')]('/',auth[_0x0367('0x8')](),controller[_0x0367('0xe')]);router[_0x0367('0xd')]('/:id/sounds',auth[_0x0367('0x8')](),controller['addSound']);router[_0x0367('0xf')](_0x0367('0x10'),auth[_0x0367('0x8')](),controller[_0x0367('0x11')]);router[_0x0367('0x12')](_0x0367('0x10'),auth['isAuthenticated'](),controller[_0x0367('0x13')]);router[_0x0367('0x12')](_0x0367('0x14'),auth[_0x0367('0x8')](),controller['removeSound']);module[_0x0367('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 17cfb4e..51173c4 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 _0x74e4=['exports','STRING','ENUM','custom','quietmp3nb','quietmp3','files','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x2c60f4,_0x17f87a){var _0x374f5a=function(_0x36ce83){while(--_0x36ce83){_0x2c60f4['push'](_0x2c60f4['shift']());}};_0x374f5a(++_0x17f87a);}(_0x74e4,0xe5));var _0x474e=function(_0x1205e5,_0x520f20){_0x1205e5=_0x1205e5-0x0;var _0x31a342=_0x74e4[_0x1205e5];return _0x31a342;};'use strict';var Sequelize=require(_0x474e('0x0'));module[_0x474e('0x1')]={'name':{'type':Sequelize[_0x474e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x474e('0x3')](_0x474e('0x4'),'files','mp3nb',_0x474e('0x5'),_0x474e('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x474e('0x7')},'directory':{'type':Sequelize[_0x474e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x474e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x474e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x474e('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x474e('0x2')],'allowNull':!![]},'stamp':{'type':_0x474e('0x8')},'defaultEntry':{'type':Sequelize[_0x474e('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x73e5=['mp3','TIMESTAMP','BOOLEAN','sequelize','STRING','ENUM','files','mp3nb','quietmp3nb'];(function(_0x36f0c7,_0x3d5317){var _0x393f26=function(_0x206c09){while(--_0x206c09){_0x36f0c7['push'](_0x36f0c7['shift']());}};_0x393f26(++_0x3d5317);}(_0x73e5,0x174));var _0x573e=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x73e5[_0x1fb1c1];return _0x1622df;};'use strict';var Sequelize=require(_0x573e('0x0'));module['exports']={'name':{'type':Sequelize[_0x573e('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x573e('0x2')]('custom',_0x573e('0x3'),_0x573e('0x4'),_0x573e('0x5'),'quietmp3',_0x573e('0x6')),'allowNull':!![],'defaultValue':_0x573e('0x3')},'directory':{'type':Sequelize[_0x573e('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x573e('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x573e('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x573e('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x573e('0x7')},'defaultEntry':{'type':Sequelize[_0x573e('0x8')],'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 f05b9aa..2e16b45 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 _0xf6b3=['update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','VoiceMusicOnHold','findAll','rows','find','catch','body','params','sequelize','directory','server/files/moh','create','files','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','basename','join','ValidationError','removeSound','%s.%s','getSounds','filter','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x355c03,_0x1cf673){var _0x4833ac=function(_0x4300e1){while(--_0x4300e1){_0x355c03['push'](_0x355c03['shift']());}};_0x4833ac(++_0x1cf673);}(_0xf6b3,0xba));var _0x3f6b=function(_0x233724,_0x563069){_0x233724=_0x233724-0x0;var _0x498a3d=_0xf6b3[_0x233724];return _0x498a3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f6b('0x0'));var zipdir=require(_0x3f6b('0x1'));var jsonpatch=require(_0x3f6b('0x2'));var rp=require(_0x3f6b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f6b('0x4'));var util=require(_0x3f6b('0x5'));var path=require('path');var sox=require(_0x3f6b('0x6'));var csv=require('to-csv');var ejs=require(_0x3f6b('0x7'));var fs=require('fs');var fs_extra=require(_0x3f6b('0x8'));var _=require(_0x3f6b('0x9'));var squel=require(_0x3f6b('0xa'));var crypto=require(_0x3f6b('0xb'));var jsforce=require(_0x3f6b('0xc'));var deskjs=require(_0x3f6b('0xd'));var toCsv=require(_0x3f6b('0xe'));var querystring=require(_0x3f6b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3f6b('0x10'));var qs=require(_0x3f6b('0x11'));var as=require(_0x3f6b('0x12'));var hardwareService=require(_0x3f6b('0x13'));var logger=require(_0x3f6b('0x14'))(_0x3f6b('0x15'));var utils=require('../../config/utils');var config=require(_0x3f6b('0x16'));var licenseUtil=require(_0x3f6b('0x17'));var db=require(_0x3f6b('0x18'))['db'];function respondWithStatusCode(_0x5ccb95,_0x170726){_0x170726=_0x170726||0xcc;return function(_0x4d2066){if(_0x4d2066){return _0x5ccb95[_0x3f6b('0x19')](_0x170726);}return _0x5ccb95[_0x3f6b('0x1a')](_0x170726)['end']();};}function respondWithResult(_0x401c70,_0x32fa67){_0x32fa67=_0x32fa67||0xc8;return function(_0x1aac03){if(_0x1aac03){return _0x401c70[_0x3f6b('0x1a')](_0x32fa67)[_0x3f6b('0x1b')](_0x1aac03);}};}function respondWithFilteredResult(_0x37a1e8,_0x10dfbd){return function(_0x429d3c){if(_0x429d3c){var _0x265232=typeof _0x10dfbd[_0x3f6b('0x1c')]===_0x3f6b('0x1d')&&typeof _0x10dfbd[_0x3f6b('0x1e')]==='undefined';var _0x3d34d9=_0x429d3c[_0x3f6b('0x1f')];var _0x503426=_0x265232?0x0:_0x10dfbd[_0x3f6b('0x1c')];var _0x1c0c0c=_0x265232?_0x429d3c[_0x3f6b('0x1f')]:_0x10dfbd[_0x3f6b('0x1c')]+_0x10dfbd[_0x3f6b('0x1e')];var _0x3715a7;if(_0x1c0c0c>=_0x3d34d9){_0x1c0c0c=_0x3d34d9;_0x3715a7=0xc8;}else{_0x3715a7=0xce;}_0x37a1e8[_0x3f6b('0x1a')](_0x3715a7);return _0x37a1e8[_0x3f6b('0x20')](_0x3f6b('0x21'),_0x503426+'-'+_0x1c0c0c+'/'+_0x3d34d9)[_0x3f6b('0x1b')](_0x429d3c);}return null;};}function patchUpdates(_0x52fb71){return function(_0x186807){try{jsonpatch[_0x3f6b('0x22')](_0x186807,_0x52fb71,!![]);}catch(_0x5c54fe){return BPromise[_0x3f6b('0x23')](_0x5c54fe);}return _0x186807['save']();};}function saveUpdates(_0x29f44d,_0x510613){return function(_0x573d33){if(_0x573d33){return _0x573d33[_0x3f6b('0x24')](_0x29f44d)[_0x3f6b('0x25')](function(_0x8123c8){return _0x8123c8;});}return null;};}function removeEntity(_0x5aa567,_0x9bbf08){return function(_0x5c3f32){if(_0x5c3f32){return _0x5c3f32[_0x3f6b('0x26')]()[_0x3f6b('0x25')](function(){var _0x263793=_0x5c3f32[_0x3f6b('0x27')]({'plain':!![]});var _0x5ea1d9='MusicOnHolds';return db[_0x3f6b('0x28')][_0x3f6b('0x26')]({'where':{'type':_0x5ea1d9,'resourceId':_0x263793['id']}})[_0x3f6b('0x25')](function(){return _0x5c3f32;});})['then'](function(){_0x5aa567[_0x3f6b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58996a,_0x3ce365){return function(_0x1736e2){if(!_0x1736e2){_0x58996a[_0x3f6b('0x19')](0x194);}return _0x1736e2;};}function handleError(_0x751fb4,_0x519922){_0x519922=_0x519922||0x1f4;return function(_0x391ac9){logger[_0x3f6b('0x29')](_0x391ac9[_0x3f6b('0x2a')]);if(_0x391ac9[_0x3f6b('0x2b')]){delete _0x391ac9[_0x3f6b('0x2b')];}_0x751fb4[_0x3f6b('0x1a')](_0x519922)[_0x3f6b('0x2c')](_0x391ac9);};}exports[_0x3f6b('0x2d')]=function(_0x4b42c4,_0x4770e1){var _0x56ce53={},_0x29ec62={},_0x560c0d={'count':0x0,'rows':[]};var _0x4c05dd=_[_0x3f6b('0x2e')](db['VoiceMusicOnHold'][_0x3f6b('0x2f')],function(_0x59195c){return{'name':_0x59195c[_0x3f6b('0x30')],'type':_0x59195c['type']['key']};});_0x29ec62[_0x3f6b('0x31')]=_['map'](_0x4c05dd,'name');_0x29ec62[_0x3f6b('0x32')]=_[_0x3f6b('0x33')](_0x4b42c4[_0x3f6b('0x32')]);_0x29ec62[_0x3f6b('0x34')]=_[_0x3f6b('0x35')](_0x29ec62[_0x3f6b('0x31')],_0x29ec62[_0x3f6b('0x32')]);_0x56ce53[_0x3f6b('0x36')]=_[_0x3f6b('0x35')](_0x29ec62[_0x3f6b('0x31')],qs['fields'](_0x4b42c4[_0x3f6b('0x32')][_0x3f6b('0x37')]));_0x56ce53[_0x3f6b('0x36')]=_0x56ce53['attributes'][_0x3f6b('0x38')]?_0x56ce53[_0x3f6b('0x36')]:_0x29ec62['model'];if(!_0x4b42c4['query'][_0x3f6b('0x39')](_0x3f6b('0x3a'))){_0x56ce53[_0x3f6b('0x1e')]=qs[_0x3f6b('0x1e')](_0x4b42c4[_0x3f6b('0x32')]['limit']);_0x56ce53[_0x3f6b('0x1c')]=qs['offset'](_0x4b42c4[_0x3f6b('0x32')][_0x3f6b('0x1c')]);}_0x56ce53[_0x3f6b('0x3b')]=qs['sort'](_0x4b42c4[_0x3f6b('0x32')][_0x3f6b('0x3c')]);delete _0x4b42c4[_0x3f6b('0x32')][_0x3f6b('0x3c')];_0x56ce53[_0x3f6b('0x3d')]=qs[_0x3f6b('0x34')](_['pick'](_0x4b42c4[_0x3f6b('0x32')],_0x29ec62[_0x3f6b('0x34')]),_0x4c05dd);if(_0x4b42c4[_0x3f6b('0x32')]['filter']){_0x56ce53[_0x3f6b('0x3d')]=_['merge'](_0x56ce53[_0x3f6b('0x3d')],{'$or':_[_0x3f6b('0x2e')](_0x4c05dd,function(_0x10e683){if(_0x10e683[_0x3f6b('0x3e')]!==_0x3f6b('0x3f')){var _0x4d41f1={};_0x4d41f1[_0x10e683['name']]={'$like':'%'+_0x4b42c4[_0x3f6b('0x32')]['filter']+'%'};return _0x4d41f1;}})});}_0x56ce53=_[_0x3f6b('0x40')]({},_0x56ce53,_0x4b42c4[_0x3f6b('0x41')]);var _0x4ca3da={'where':_0x56ce53[_0x3f6b('0x3d')]};return db['VoiceMusicOnHold'][_0x3f6b('0x1f')](_0x4ca3da)[_0x3f6b('0x25')](function(_0x2e75aa){_0x560c0d[_0x3f6b('0x1f')]=_0x2e75aa;if(_0x4b42c4[_0x3f6b('0x32')][_0x3f6b('0x42')]){_0x56ce53[_0x3f6b('0x43')]=[{'all':!![]}];}return db[_0x3f6b('0x44')][_0x3f6b('0x45')](_0x56ce53);})[_0x3f6b('0x25')](function(_0x112cc6){_0x560c0d[_0x3f6b('0x46')]=_0x112cc6;return _0x560c0d;})[_0x3f6b('0x25')](respondWithFilteredResult(_0x4770e1,_0x56ce53))['catch'](handleError(_0x4770e1,null));};exports['show']=function(_0x3f2e8d,_0x32353f){var _0x27384b={'raw':![],'where':{'id':_0x3f2e8d['params']['id']}},_0x3fe584={};_0x3fe584[_0x3f6b('0x31')]=_[_0x3f6b('0x33')](db[_0x3f6b('0x44')][_0x3f6b('0x2f')]);_0x3fe584[_0x3f6b('0x32')]=_[_0x3f6b('0x33')](_0x3f2e8d[_0x3f6b('0x32')]);_0x3fe584[_0x3f6b('0x34')]=_[_0x3f6b('0x35')](_0x3fe584[_0x3f6b('0x31')],_0x3fe584[_0x3f6b('0x32')]);_0x27384b['attributes']=_[_0x3f6b('0x35')](_0x3fe584[_0x3f6b('0x31')],qs[_0x3f6b('0x37')](_0x3f2e8d['query'][_0x3f6b('0x37')]));_0x27384b[_0x3f6b('0x36')]=_0x27384b['attributes'][_0x3f6b('0x38')]?_0x27384b[_0x3f6b('0x36')]:_0x3fe584[_0x3f6b('0x31')];if(_0x3f2e8d[_0x3f6b('0x32')][_0x3f6b('0x42')]){_0x27384b[_0x3f6b('0x43')]=[{'all':!![]}];}_0x27384b=_[_0x3f6b('0x40')]({},_0x27384b,_0x3f2e8d[_0x3f6b('0x41')]);return db[_0x3f6b('0x44')][_0x3f6b('0x47')](_0x27384b)[_0x3f6b('0x25')](handleEntityNotFound(_0x32353f,null))[_0x3f6b('0x25')](respondWithResult(_0x32353f,null))[_0x3f6b('0x48')](handleError(_0x32353f,null));};exports['update']=function(_0x3a161f,_0x39e83f){if(_0x3a161f[_0x3f6b('0x49')]['id']){delete _0x3a161f[_0x3f6b('0x49')]['id'];}return db[_0x3f6b('0x44')][_0x3f6b('0x47')]({'where':{'id':_0x3a161f[_0x3f6b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39e83f,null))[_0x3f6b('0x25')](saveUpdates(_0x3a161f['body'],null))['then'](respondWithResult(_0x39e83f,null))[_0x3f6b('0x48')](handleError(_0x39e83f,null));};exports['create']=function(_0x118175,_0x2d157c,_0x36a99d){return db[_0x3f6b('0x4b')]['transaction'](function(_0xaa8eef){if(_0x118175['body']['mode']==='files'){_0x118175[_0x3f6b('0x49')][_0x3f6b('0x4c')]=path['join'](config['root'],_0x3f6b('0x4d'),_0x118175[_0x3f6b('0x49')]['name']);}return db[_0x3f6b('0x44')][_0x3f6b('0x4e')](_0x118175['body'],{'transaction':_0xaa8eef})[_0x3f6b('0x25')](function(_0x2ab220){if(_0x118175['body']['mode']===_0x3f6b('0x4f')){fs['mkdirSync'](_0x2ab220[_0x3f6b('0x4c')],parseInt(_0x3f6b('0x50'),0x8));}var _0x22a626=_0x118175['user'][_0x3f6b('0x27')]({'plain':!![]});if(!_0x22a626)throw new Error(_0x3f6b('0x51'));if(_0x22a626[_0x3f6b('0x52')]===_0x3f6b('0x53')){var _0x199f90=_0x2ab220[_0x3f6b('0x27')]({'plain':!![]});return db[_0x3f6b('0x54')]['find']({'where':{'name':_0x3f6b('0x55'),'userProfileId':_0x22a626['userProfileId']},'raw':!![]})['then'](function(_0x21fe0b){if(_0x21fe0b&&_0x21fe0b[_0x3f6b('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x199f90[_0x3f6b('0x2b')],'resourceId':_0x199f90['id'],'type':_0x21fe0b[_0x3f6b('0x2b')],'sectionId':_0x21fe0b['id']},{})[_0x3f6b('0x25')](function(){return _0x2ab220;});}else{return _0x2ab220;}})['catch'](function(_0x3b9ec3){logger[_0x3f6b('0x29')](_0x3f6b('0x57'),_0x3b9ec3);});}return _0x2ab220;});})['then'](respondWithResult(_0x2d157c,0xc9))['catch'](handleError(_0x2d157c,null));};exports[_0x3f6b('0x26')]=function(_0x36b6f5,_0x326942,_0x2c503c){var _0x3623a5;return db[_0x3f6b('0x44')][_0x3f6b('0x47')]({'where':{'id':_0x36b6f5[_0x3f6b('0x4a')]['id']}})[_0x3f6b('0x25')](function(_0x108435){if(_0x108435){return db[_0x3f6b('0x4b')][_0x3f6b('0x58')](function(_0x5442d4){return _0x108435[_0x3f6b('0x26')]({'transaction':_0x5442d4,'raw':!![]})[_0x3f6b('0x25')](function(_0x3b60cd){if(_0x3b60cd['directory']){fs[_0x3f6b('0x59')](_0x3b60cd[_0x3f6b('0x4c')])[_0x3f6b('0x5a')](function(_0x4c54b7){fs[_0x3f6b('0x5b')](path['join'](_0x3b60cd[_0x3f6b('0x4c')],_0x4c54b7));});fs[_0x3f6b('0x5c')](_0x3b60cd['directory']);}return _0x3b60cd;});})['catch'](function(_0x4aa8a6){throw new db[(_0x3f6b('0x5d'))]['ValidationError'](_0x4aa8a6[_0x3f6b('0x5e')]);});}})[_0x3f6b('0x25')](handleEntityNotFound(_0x326942,null))['then'](removeEntity(_0x326942,null))[_0x3f6b('0x48')](handleError(_0x326942,null));};exports[_0x3f6b('0x5f')]=function(_0x1f3fc1,_0x4ccd6d,_0x4ee66c){return db['sequelize'][_0x3f6b('0x58')](function(_0x431273){var _0x4a4440;return db[_0x3f6b('0x44')][_0x3f6b('0x47')]({'where':{'id':_0x1f3fc1['params']['id']}})[_0x3f6b('0x25')](function(_0x5a89ab){if(_0x5a89ab){_0x4a4440=_0x5a89ab;return _0x5a89ab[_0x3f6b('0x5f')](_0x1f3fc1['body']['id'],{'transaction':_0x431273});}})[_0x3f6b('0x25')](function(_0x1cb4f8){if(_0x1cb4f8){return db[_0x3f6b('0x60')][_0x3f6b('0x61')]({'where':{'id':_0x1f3fc1[_0x3f6b('0x49')]['id']},'attributes':['id',_0x3f6b('0x2b'),_0x3f6b('0x62'),_0x3f6b('0x63'),_0x3f6b('0x64')],'raw':!![]});}})[_0x3f6b('0x25')](function(_0x4f64b3){if(_0x4f64b3){var _0xe941ff=path['join'](config[_0x3f6b('0x65')],_0x3f6b('0x66'),util[_0x3f6b('0x67')]('%s.%s',path[_0x3f6b('0x68')](_0x4f64b3[_0x3f6b('0x62')],path['extname'](_0x4f64b3[_0x3f6b('0x62')])),_0x4f64b3[_0x3f6b('0x63')]));var _0x52bb3d=path[_0x3f6b('0x69')](config['root'],_0x3f6b('0x4d'),_0x4a4440['name'],util[_0x3f6b('0x67')]('%s.%s',_0x4f64b3[_0x3f6b('0x2b')],_0x4f64b3[_0x3f6b('0x63')]));fs['symlinkSync'](_0xe941ff,_0x52bb3d);return _0x4f64b3;}})[_0x3f6b('0x48')](function(_0x12cbbb){throw new db[(_0x3f6b('0x5d'))][(_0x3f6b('0x6a'))](_0x12cbbb[_0x3f6b('0x5e')]);});})[_0x3f6b('0x25')](handleEntityNotFound(_0x4ccd6d,null))[_0x3f6b('0x25')](respondWithResult(_0x4ccd6d,0xc9))[_0x3f6b('0x48')](handleError(_0x4ccd6d,null));};exports[_0x3f6b('0x6b')]=function(_0x3b3d1f,_0x4fdeb7,_0x16ebd9){return db[_0x3f6b('0x4b')]['transaction'](function(_0x100fef){var _0xd646cf;return db[_0x3f6b('0x44')]['findOne']({'where':{'id':_0x3b3d1f['params']['id']}})[_0x3f6b('0x25')](handleEntityNotFound(_0x4fdeb7,null))[_0x3f6b('0x25')](function(_0x44effb){if(_0x44effb){_0xd646cf=_0x44effb;return _0x44effb['removeSound'](_0x3b3d1f[_0x3f6b('0x4a')]['id2']);}})[_0x3f6b('0x25')](function(_0x22b438){if(_0x22b438){return db[_0x3f6b('0x60')][_0x3f6b('0x61')]({'where':{'id':_0x3b3d1f[_0x3f6b('0x4a')]['id2']},'attributes':['id','name',_0x3f6b('0x62'),_0x3f6b('0x63'),_0x3f6b('0x64')],'raw':!![]});}})[_0x3f6b('0x25')](function(_0x26005c){if(_0x26005c){fs[_0x3f6b('0x5b')](path[_0x3f6b('0x69')](_0xd646cf[_0x3f6b('0x4c')],util[_0x3f6b('0x67')](_0x3f6b('0x6c'),_0x26005c[_0x3f6b('0x2b')],_0x26005c[_0x3f6b('0x63')])));return _0x26005c;}})[_0x3f6b('0x48')](function(_0x3b522d){throw new db[(_0x3f6b('0x5d'))][(_0x3f6b('0x6a'))](_0x3b522d['message']);});})[_0x3f6b('0x25')](handleEntityNotFound(_0x4fdeb7,null))['then'](respondWithStatusCode(_0x4fdeb7,0xcc))[_0x3f6b('0x48')](handleError(_0x4fdeb7,null));};exports[_0x3f6b('0x6d')]=function(_0x1ed20d,_0x4b2b46,_0xff06d0){var _0x2b50c3={};var _0x24dd26={};var _0x13dd1c;var _0x50a58e;return db[_0x3f6b('0x44')][_0x3f6b('0x61')]({'where':{'id':_0x1ed20d['params']['id']}})[_0x3f6b('0x25')](handleEntityNotFound(_0x4b2b46,null))[_0x3f6b('0x25')](function(_0x42c0f6){if(_0x42c0f6){_0x13dd1c=_0x42c0f6;_0x24dd26[_0x3f6b('0x31')]=_[_0x3f6b('0x33')](db[_0x3f6b('0x60')][_0x3f6b('0x2f')]);_0x24dd26['query']=_[_0x3f6b('0x33')](_0x1ed20d[_0x3f6b('0x32')]);_0x24dd26['filters']=_['intersection'](_0x24dd26[_0x3f6b('0x31')],_0x24dd26['query']);_0x2b50c3[_0x3f6b('0x36')]=_['intersection'](_0x24dd26['model'],qs[_0x3f6b('0x37')](_0x1ed20d[_0x3f6b('0x32')][_0x3f6b('0x37')]));_0x2b50c3[_0x3f6b('0x36')]=_0x2b50c3[_0x3f6b('0x36')][_0x3f6b('0x38')]?_0x2b50c3[_0x3f6b('0x36')]:_0x24dd26['model'];_0x2b50c3[_0x3f6b('0x3b')]=qs[_0x3f6b('0x3c')](_0x1ed20d[_0x3f6b('0x32')][_0x3f6b('0x3c')]);_0x2b50c3['where']=qs[_0x3f6b('0x34')](_['pick'](_0x1ed20d['query'],_0x24dd26[_0x3f6b('0x34')]));if(_0x1ed20d[_0x3f6b('0x32')][_0x3f6b('0x6e')]){_0x2b50c3[_0x3f6b('0x3d')]=_[_0x3f6b('0x40')](_0x2b50c3[_0x3f6b('0x3d')],{'$or':_['map'](_0x2b50c3[_0x3f6b('0x36')],function(_0x198ddb){var _0x5b0ccd={};_0x5b0ccd[_0x198ddb]={'$like':'%'+_0x1ed20d['query']['filter']+'%'};return _0x5b0ccd;})});}_0x2b50c3=_[_0x3f6b('0x40')]({},_0x2b50c3,_0x1ed20d[_0x3f6b('0x41')]);return _0x13dd1c['getSounds'](_0x2b50c3);}})[_0x3f6b('0x25')](function(_0x184196){if(_0x184196){_0x50a58e=_0x184196[_0x3f6b('0x38')];if(!_0x1ed20d[_0x3f6b('0x32')]['hasOwnProperty']('nolimit')){_0x2b50c3[_0x3f6b('0x1e')]=qs[_0x3f6b('0x1e')](_0x1ed20d[_0x3f6b('0x32')][_0x3f6b('0x1e')]);_0x2b50c3['offset']=qs['offset'](_0x1ed20d[_0x3f6b('0x32')][_0x3f6b('0x1c')]);}return _0x13dd1c['getSounds'](_0x2b50c3);}})[_0x3f6b('0x25')](function(_0x338527){if(_0x338527){return _0x338527?{'count':_0x50a58e,'rows':_0x338527}:null;}})['then'](respondWithResult(_0x4b2b46,null))[_0x3f6b('0x48')](handleError(_0x4b2b46,null));}; \ No newline at end of file +var _0x6fa2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','index','VoiceMusicOnHold','fieldName','type','key','model','map','keys','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','params','rawAttributes','includeAll','include','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','transaction','readdirSync','rmdirSync','ValidationError','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','symlinkSync','Sequelize','message','findOne','removeSound','id2','getSounds','nolimit','rimraf'];(function(_0x4a60be,_0x26d952){var _0x74041c=function(_0x1a988d){while(--_0x1a988d){_0x4a60be['push'](_0x4a60be['shift']());}};_0x74041c(++_0x26d952);}(_0x6fa2,0xdb));var _0x26fa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6fa2[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26fa('0x0'));var zipdir=require(_0x26fa('0x1'));var jsonpatch=require(_0x26fa('0x2'));var rp=require(_0x26fa('0x3'));var moment=require(_0x26fa('0x4'));var BPromise=require(_0x26fa('0x5'));var Mustache=require(_0x26fa('0x6'));var util=require(_0x26fa('0x7'));var path=require(_0x26fa('0x8'));var sox=require(_0x26fa('0x9'));var csv=require(_0x26fa('0xa'));var ejs=require(_0x26fa('0xb'));var fs=require('fs');var fs_extra=require(_0x26fa('0xc'));var _=require(_0x26fa('0xd'));var squel=require(_0x26fa('0xe'));var crypto=require('crypto');var jsforce=require(_0x26fa('0xf'));var deskjs=require(_0x26fa('0x10'));var toCsv=require(_0x26fa('0xa'));var querystring=require('querystring');var Papa=require(_0x26fa('0x11'));var Redis=require(_0x26fa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x26fa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26fa('0x14'));var utils=require(_0x26fa('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x26fa('0x16'));var db=require(_0x26fa('0x17'))['db'];function respondWithStatusCode(_0x5f46e9,_0x59f7ce){_0x59f7ce=_0x59f7ce||0xcc;return function(_0x2d5e76){if(_0x2d5e76){return _0x5f46e9[_0x26fa('0x18')](_0x59f7ce);}return _0x5f46e9[_0x26fa('0x19')](_0x59f7ce)[_0x26fa('0x1a')]();};}function respondWithResult(_0x1873f4,_0x490875){_0x490875=_0x490875||0xc8;return function(_0x42e5db){if(_0x42e5db){return _0x1873f4['status'](_0x490875)[_0x26fa('0x1b')](_0x42e5db);}};}function respondWithFilteredResult(_0x4e5015,_0x31ee79){return function(_0x1c68cf){if(_0x1c68cf){var _0x62ed05=typeof _0x31ee79['offset']===_0x26fa('0x1c')&&typeof _0x31ee79[_0x26fa('0x1d')]==='undefined';var _0x5222d8=_0x1c68cf[_0x26fa('0x1e')];var _0x2af6ea=_0x62ed05?0x0:_0x31ee79['offset'];var _0x13e371=_0x62ed05?_0x1c68cf[_0x26fa('0x1e')]:_0x31ee79[_0x26fa('0x1f')]+_0x31ee79[_0x26fa('0x1d')];var _0x5f3089;if(_0x13e371>=_0x5222d8){_0x13e371=_0x5222d8;_0x5f3089=0xc8;}else{_0x5f3089=0xce;}_0x4e5015['status'](_0x5f3089);return _0x4e5015[_0x26fa('0x20')]('Content-Range',_0x2af6ea+'-'+_0x13e371+'/'+_0x5222d8)['json'](_0x1c68cf);}return null;};}function patchUpdates(_0x4ee009){return function(_0x22155a){try{jsonpatch[_0x26fa('0x21')](_0x22155a,_0x4ee009,!![]);}catch(_0x3d0026){return BPromise['reject'](_0x3d0026);}return _0x22155a[_0x26fa('0x22')]();};}function saveUpdates(_0x1b8735,_0x47dca1){return function(_0x16b1be){if(_0x16b1be){return _0x16b1be[_0x26fa('0x23')](_0x1b8735)[_0x26fa('0x24')](function(_0x2bd074){return _0x2bd074;});}return null;};}function removeEntity(_0x471e2f,_0x1d4a86){return function(_0x12ef07){if(_0x12ef07){return _0x12ef07[_0x26fa('0x25')]()[_0x26fa('0x24')](function(){var _0x3173b0=_0x12ef07[_0x26fa('0x26')]({'plain':!![]});var _0x12e758=_0x26fa('0x27');return db[_0x26fa('0x28')][_0x26fa('0x25')]({'where':{'type':_0x12e758,'resourceId':_0x3173b0['id']}})[_0x26fa('0x24')](function(){return _0x12ef07;});})[_0x26fa('0x24')](function(){_0x471e2f[_0x26fa('0x19')](0xcc)[_0x26fa('0x1a')]();});}};}function handleEntityNotFound(_0x42e04f,_0x5de792){return function(_0xa7ae31){if(!_0xa7ae31){_0x42e04f[_0x26fa('0x18')](0x194);}return _0xa7ae31;};}function handleError(_0x5a9b18,_0x5ce930){_0x5ce930=_0x5ce930||0x1f4;return function(_0x154af8){logger[_0x26fa('0x29')](_0x154af8['stack']);if(_0x154af8[_0x26fa('0x2a')]){delete _0x154af8[_0x26fa('0x2a')];}_0x5a9b18['status'](_0x5ce930)[_0x26fa('0x2b')](_0x154af8);};}exports[_0x26fa('0x2c')]=function(_0x4ac537,_0x1b7e84){var _0x23d2d6={},_0x2c6ab1={},_0x256983={'count':0x0,'rows':[]};var _0xee9f26=_['map'](db[_0x26fa('0x2d')]['rawAttributes'],function(_0x23e826){return{'name':_0x23e826[_0x26fa('0x2e')],'type':_0x23e826[_0x26fa('0x2f')][_0x26fa('0x30')]};});_0x2c6ab1[_0x26fa('0x31')]=_[_0x26fa('0x32')](_0xee9f26,_0x26fa('0x2a'));_0x2c6ab1['query']=_[_0x26fa('0x33')](_0x4ac537['query']);_0x2c6ab1['filters']=_[_0x26fa('0x34')](_0x2c6ab1[_0x26fa('0x31')],_0x2c6ab1['query']);_0x23d2d6[_0x26fa('0x35')]=_[_0x26fa('0x34')](_0x2c6ab1[_0x26fa('0x31')],qs[_0x26fa('0x36')](_0x4ac537[_0x26fa('0x37')][_0x26fa('0x36')]));_0x23d2d6[_0x26fa('0x35')]=_0x23d2d6[_0x26fa('0x35')][_0x26fa('0x38')]?_0x23d2d6['attributes']:_0x2c6ab1[_0x26fa('0x31')];if(!_0x4ac537[_0x26fa('0x37')][_0x26fa('0x39')]('nolimit')){_0x23d2d6[_0x26fa('0x1d')]=qs[_0x26fa('0x1d')](_0x4ac537[_0x26fa('0x37')]['limit']);_0x23d2d6['offset']=qs[_0x26fa('0x1f')](_0x4ac537[_0x26fa('0x37')]['offset']);}_0x23d2d6[_0x26fa('0x3a')]=qs[_0x26fa('0x3b')](_0x4ac537[_0x26fa('0x37')][_0x26fa('0x3b')]);delete _0x4ac537[_0x26fa('0x37')]['sort'];_0x23d2d6[_0x26fa('0x3c')]=qs[_0x26fa('0x3d')](_[_0x26fa('0x3e')](_0x4ac537['query'],_0x2c6ab1['filters']),_0xee9f26);if(_0x4ac537[_0x26fa('0x37')][_0x26fa('0x3f')]){_0x23d2d6[_0x26fa('0x3c')]=_[_0x26fa('0x40')](_0x23d2d6[_0x26fa('0x3c')],{'$or':_[_0x26fa('0x32')](_0xee9f26,function(_0x562645){if(_0x562645[_0x26fa('0x2f')]!==_0x26fa('0x41')){var _0x40208a={};_0x40208a[_0x562645['name']]={'$like':'%'+_0x4ac537[_0x26fa('0x37')]['filter']+'%'};return _0x40208a;}})});}_0x23d2d6=_['merge']({},_0x23d2d6,_0x4ac537[_0x26fa('0x42')]);var _0x1f4c23={'where':_0x23d2d6['where']};return db['VoiceMusicOnHold'][_0x26fa('0x1e')](_0x1f4c23)['then'](function(_0x5bc1d8){_0x256983['count']=_0x5bc1d8;if(_0x4ac537[_0x26fa('0x37')]['includeAll']){_0x23d2d6['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x23d2d6);})[_0x26fa('0x24')](function(_0x2e4826){_0x256983[_0x26fa('0x43')]=_0x2e4826;return _0x256983;})[_0x26fa('0x24')](respondWithFilteredResult(_0x1b7e84,_0x23d2d6))[_0x26fa('0x44')](handleError(_0x1b7e84,null));};exports['show']=function(_0x5255aa,_0x3c90eb){var _0x161f8e={'raw':![],'where':{'id':_0x5255aa[_0x26fa('0x45')]['id']}},_0x206ed5={};_0x206ed5['model']=_[_0x26fa('0x33')](db[_0x26fa('0x2d')][_0x26fa('0x46')]);_0x206ed5[_0x26fa('0x37')]=_[_0x26fa('0x33')](_0x5255aa[_0x26fa('0x37')]);_0x206ed5['filters']=_[_0x26fa('0x34')](_0x206ed5['model'],_0x206ed5[_0x26fa('0x37')]);_0x161f8e[_0x26fa('0x35')]=_[_0x26fa('0x34')](_0x206ed5['model'],qs[_0x26fa('0x36')](_0x5255aa['query']['fields']));_0x161f8e['attributes']=_0x161f8e[_0x26fa('0x35')]['length']?_0x161f8e[_0x26fa('0x35')]:_0x206ed5['model'];if(_0x5255aa[_0x26fa('0x37')][_0x26fa('0x47')]){_0x161f8e[_0x26fa('0x48')]=[{'all':!![]}];}_0x161f8e=_[_0x26fa('0x40')]({},_0x161f8e,_0x5255aa[_0x26fa('0x42')]);return db[_0x26fa('0x2d')][_0x26fa('0x49')](_0x161f8e)[_0x26fa('0x24')](handleEntityNotFound(_0x3c90eb,null))[_0x26fa('0x24')](respondWithResult(_0x3c90eb,null))['catch'](handleError(_0x3c90eb,null));};exports['update']=function(_0x26fc4c,_0x52b4d9){if(_0x26fc4c[_0x26fa('0x4a')]['id']){delete _0x26fc4c[_0x26fa('0x4a')]['id'];}return db[_0x26fa('0x2d')][_0x26fa('0x49')]({'where':{'id':_0x26fc4c['params']['id']}})['then'](handleEntityNotFound(_0x52b4d9,null))['then'](saveUpdates(_0x26fc4c[_0x26fa('0x4a')],null))[_0x26fa('0x24')](respondWithResult(_0x52b4d9,null))[_0x26fa('0x44')](handleError(_0x52b4d9,null));};exports[_0x26fa('0x4b')]=function(_0x34ff1e,_0x907ac5,_0x43c9dc){return db[_0x26fa('0x4c')]['transaction'](function(_0x32a3cc){if(_0x34ff1e[_0x26fa('0x4a')][_0x26fa('0x4d')]===_0x26fa('0x4e')){_0x34ff1e[_0x26fa('0x4a')][_0x26fa('0x4f')]=path[_0x26fa('0x50')](config[_0x26fa('0x51')],_0x26fa('0x52'),_0x34ff1e[_0x26fa('0x4a')][_0x26fa('0x2a')]);}return db[_0x26fa('0x2d')][_0x26fa('0x4b')](_0x34ff1e['body'],{'transaction':_0x32a3cc})[_0x26fa('0x24')](function(_0x4f212e){if(_0x34ff1e[_0x26fa('0x4a')][_0x26fa('0x4d')]===_0x26fa('0x4e')){fs[_0x26fa('0x53')](_0x4f212e[_0x26fa('0x4f')],parseInt('0777',0x8));}var _0x5205d1=_0x34ff1e['user']['get']({'plain':!![]});if(!_0x5205d1)throw new Error(_0x26fa('0x54'));if(_0x5205d1[_0x26fa('0x55')]===_0x26fa('0x56')){var _0x3324ac=_0x4f212e['get']({'plain':!![]});return db['UserProfileSection'][_0x26fa('0x49')]({'where':{'name':_0x26fa('0x27'),'userProfileId':_0x5205d1[_0x26fa('0x57')]},'raw':!![]})[_0x26fa('0x24')](function(_0x669007){if(_0x669007&&_0x669007[_0x26fa('0x58')]===0x0){return db[_0x26fa('0x28')][_0x26fa('0x4b')]({'name':_0x3324ac[_0x26fa('0x2a')],'resourceId':_0x3324ac['id'],'type':_0x669007[_0x26fa('0x2a')],'sectionId':_0x669007['id']},{})[_0x26fa('0x24')](function(){return _0x4f212e;});}else{return _0x4f212e;}})[_0x26fa('0x44')](function(_0x87fe21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x87fe21);});}return _0x4f212e;});})[_0x26fa('0x24')](respondWithResult(_0x907ac5,0xc9))['catch'](handleError(_0x907ac5,null));};exports[_0x26fa('0x25')]=function(_0x2b98c4,_0x305887,_0x3e9071){var _0x334f98;return db[_0x26fa('0x2d')][_0x26fa('0x49')]({'where':{'id':_0x2b98c4[_0x26fa('0x45')]['id']}})[_0x26fa('0x24')](function(_0x116d4b){if(_0x116d4b){return db[_0x26fa('0x4c')][_0x26fa('0x59')](function(_0xf8fac1){return _0x116d4b[_0x26fa('0x25')]({'transaction':_0xf8fac1,'raw':!![]})[_0x26fa('0x24')](function(_0x13b18a){if(_0x13b18a[_0x26fa('0x4f')]){fs[_0x26fa('0x5a')](_0x13b18a['directory'])['forEach'](function(_0x2fe961){fs['unlinkSync'](path[_0x26fa('0x50')](_0x13b18a['directory'],_0x2fe961));});fs[_0x26fa('0x5b')](_0x13b18a[_0x26fa('0x4f')]);}return _0x13b18a;});})['catch'](function(_0x40c767){throw new db['Sequelize'][(_0x26fa('0x5c'))](_0x40c767['message']);});}})['then'](handleEntityNotFound(_0x305887,null))[_0x26fa('0x24')](removeEntity(_0x305887,null))[_0x26fa('0x44')](handleError(_0x305887,null));};exports[_0x26fa('0x5d')]=function(_0x5c0c79,_0x54e50c,_0x3e64b5){return db[_0x26fa('0x4c')]['transaction'](function(_0x575c56){var _0x3e219f;return db[_0x26fa('0x2d')][_0x26fa('0x49')]({'where':{'id':_0x5c0c79[_0x26fa('0x45')]['id']}})[_0x26fa('0x24')](function(_0x25349e){if(_0x25349e){_0x3e219f=_0x25349e;return _0x25349e[_0x26fa('0x5d')](_0x5c0c79[_0x26fa('0x4a')]['id'],{'transaction':_0x575c56});}})[_0x26fa('0x24')](function(_0x59f810){if(_0x59f810){return db[_0x26fa('0x5e')]['findOne']({'where':{'id':_0x5c0c79[_0x26fa('0x4a')]['id']},'attributes':['id',_0x26fa('0x2a'),'save_name',_0x26fa('0x5f'),_0x26fa('0x60')],'raw':!![]});}})[_0x26fa('0x24')](function(_0x18ee56){if(_0x18ee56){var _0x36a083=path[_0x26fa('0x50')](config[_0x26fa('0x51')],_0x26fa('0x61'),util[_0x26fa('0x62')](_0x26fa('0x63'),path[_0x26fa('0x64')](_0x18ee56[_0x26fa('0x65')],path['extname'](_0x18ee56[_0x26fa('0x65')])),_0x18ee56[_0x26fa('0x5f')]));var _0x104692=path[_0x26fa('0x50')](config[_0x26fa('0x51')],'server/files/moh',_0x3e219f[_0x26fa('0x2a')],util[_0x26fa('0x62')](_0x26fa('0x63'),_0x18ee56['name'],_0x18ee56[_0x26fa('0x5f')]));fs[_0x26fa('0x66')](_0x36a083,_0x104692);return _0x18ee56;}})[_0x26fa('0x44')](function(_0x5d8476){throw new db[(_0x26fa('0x67'))][(_0x26fa('0x5c'))](_0x5d8476[_0x26fa('0x68')]);});})[_0x26fa('0x24')](handleEntityNotFound(_0x54e50c,null))[_0x26fa('0x24')](respondWithResult(_0x54e50c,0xc9))[_0x26fa('0x44')](handleError(_0x54e50c,null));};exports['removeSound']=function(_0x43aa92,_0x245262,_0x5b76f5){return db[_0x26fa('0x4c')]['transaction'](function(_0x3eef2e){var _0x1bce91;return db[_0x26fa('0x2d')][_0x26fa('0x69')]({'where':{'id':_0x43aa92[_0x26fa('0x45')]['id']}})['then'](handleEntityNotFound(_0x245262,null))[_0x26fa('0x24')](function(_0x49e484){if(_0x49e484){_0x1bce91=_0x49e484;return _0x49e484[_0x26fa('0x6a')](_0x43aa92['params'][_0x26fa('0x6b')]);}})[_0x26fa('0x24')](function(_0x26f73b){if(_0x26f73b){return db['Sound'][_0x26fa('0x69')]({'where':{'id':_0x43aa92[_0x26fa('0x45')][_0x26fa('0x6b')]},'attributes':['id',_0x26fa('0x2a'),_0x26fa('0x65'),_0x26fa('0x5f'),_0x26fa('0x60')],'raw':!![]});}})[_0x26fa('0x24')](function(_0x2be706){if(_0x2be706){fs['unlinkSync'](path[_0x26fa('0x50')](_0x1bce91[_0x26fa('0x4f')],util[_0x26fa('0x62')]('%s.%s',_0x2be706[_0x26fa('0x2a')],_0x2be706['converted_format'])));return _0x2be706;}})[_0x26fa('0x44')](function(_0x2fb798){throw new db[(_0x26fa('0x67'))][(_0x26fa('0x5c'))](_0x2fb798[_0x26fa('0x68')]);});})[_0x26fa('0x24')](handleEntityNotFound(_0x245262,null))[_0x26fa('0x24')](respondWithStatusCode(_0x245262,0xcc))[_0x26fa('0x44')](handleError(_0x245262,null));};exports[_0x26fa('0x6c')]=function(_0x3e1ee8,_0x16b6ca,_0x47e547){var _0xeb0a18={};var _0x3151e7={};var _0x4f7382;var _0x4939f6;return db[_0x26fa('0x2d')][_0x26fa('0x69')]({'where':{'id':_0x3e1ee8[_0x26fa('0x45')]['id']}})[_0x26fa('0x24')](handleEntityNotFound(_0x16b6ca,null))[_0x26fa('0x24')](function(_0x130016){if(_0x130016){_0x4f7382=_0x130016;_0x3151e7[_0x26fa('0x31')]=_[_0x26fa('0x33')](db[_0x26fa('0x5e')][_0x26fa('0x46')]);_0x3151e7['query']=_[_0x26fa('0x33')](_0x3e1ee8[_0x26fa('0x37')]);_0x3151e7[_0x26fa('0x3d')]=_[_0x26fa('0x34')](_0x3151e7[_0x26fa('0x31')],_0x3151e7[_0x26fa('0x37')]);_0xeb0a18[_0x26fa('0x35')]=_[_0x26fa('0x34')](_0x3151e7[_0x26fa('0x31')],qs['fields'](_0x3e1ee8['query'][_0x26fa('0x36')]));_0xeb0a18[_0x26fa('0x35')]=_0xeb0a18[_0x26fa('0x35')][_0x26fa('0x38')]?_0xeb0a18[_0x26fa('0x35')]:_0x3151e7[_0x26fa('0x31')];_0xeb0a18[_0x26fa('0x3a')]=qs[_0x26fa('0x3b')](_0x3e1ee8[_0x26fa('0x37')][_0x26fa('0x3b')]);_0xeb0a18[_0x26fa('0x3c')]=qs[_0x26fa('0x3d')](_[_0x26fa('0x3e')](_0x3e1ee8['query'],_0x3151e7[_0x26fa('0x3d')]));if(_0x3e1ee8[_0x26fa('0x37')][_0x26fa('0x3f')]){_0xeb0a18[_0x26fa('0x3c')]=_[_0x26fa('0x40')](_0xeb0a18[_0x26fa('0x3c')],{'$or':_['map'](_0xeb0a18[_0x26fa('0x35')],function(_0xfa5fa8){var _0x190563={};_0x190563[_0xfa5fa8]={'$like':'%'+_0x3e1ee8['query']['filter']+'%'};return _0x190563;})});}_0xeb0a18=_[_0x26fa('0x40')]({},_0xeb0a18,_0x3e1ee8[_0x26fa('0x42')]);return _0x4f7382[_0x26fa('0x6c')](_0xeb0a18);}})[_0x26fa('0x24')](function(_0x36b2a0){if(_0x36b2a0){_0x4939f6=_0x36b2a0['length'];if(!_0x3e1ee8['query'][_0x26fa('0x39')](_0x26fa('0x6d'))){_0xeb0a18['limit']=qs[_0x26fa('0x1d')](_0x3e1ee8[_0x26fa('0x37')][_0x26fa('0x1d')]);_0xeb0a18[_0x26fa('0x1f')]=qs[_0x26fa('0x1f')](_0x3e1ee8[_0x26fa('0x37')][_0x26fa('0x1f')]);}return _0x4f7382[_0x26fa('0x6c')](_0xeb0a18);}})['then'](function(_0x2904f5){if(_0x2904f5){return _0x2904f5?{'count':_0x4939f6,'rows':_0x2904f5}:null;}})['then'](respondWithResult(_0x16b6ca,null))['catch'](handleError(_0x16b6ca,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4049838..51fffb9 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 _0x0468=['path','../../config/environment','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x343ed8,_0x585e54){var _0x7969eb=function(_0x4abe3b){while(--_0x4abe3b){_0x343ed8['push'](_0x343ed8['shift']());}};_0x7969eb(++_0x585e54);}(_0x0468,0x1a9));var _0x8046=function(_0x17fa1b,_0x5f28db){_0x17fa1b=_0x17fa1b-0x0;var _0x4979e8=_0x0468[_0x17fa1b];return _0x4979e8;};'use strict';var _=require(_0x8046('0x0'));var util=require(_0x8046('0x1'));var logger=require(_0x8046('0x2'))(_0x8046('0x3'));var moment=require(_0x8046('0x4'));var BPromise=require(_0x8046('0x5'));var rp=require(_0x8046('0x6'));var fs=require('fs');var path=require(_0x8046('0x7'));var rimraf=require('rimraf');var config=require(_0x8046('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x8046('0x9')]=function(_0x1b9ebf,_0x2a1305){return _0x1b9ebf[_0x8046('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x8046('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fd5=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util'];(function(_0x4cfeab,_0x4d1084){var _0x26f1c0=function(_0x1db379){while(--_0x1db379){_0x4cfeab['push'](_0x4cfeab['shift']());}};_0x26f1c0(++_0x4d1084);}(_0x1fd5,0x177));var _0x51fd=function(_0x4f3f42,_0x50f3af){_0x4f3f42=_0x4f3f42-0x0;var _0x30a1a4=_0x1fd5[_0x4f3f42];return _0x30a1a4;};'use strict';var _=require(_0x51fd('0x0'));var util=require(_0x51fd('0x1'));var logger=require(_0x51fd('0x2'))(_0x51fd('0x3'));var moment=require(_0x51fd('0x4'));var BPromise=require(_0x51fd('0x5'));var rp=require(_0x51fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51fd('0x7'));var config=require(_0x51fd('0x8'));var attributes=require(_0x51fd('0x9'));module[_0x51fd('0xa')]=function(_0x440d23,_0x485765){return _0x440d23[_0x51fd('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x51fd('0xc'),'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 c72b212..37f93a7 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x189c1f,_0x527767){var _0x54b4a6=function(_0x5481e8){while(--_0x5481e8){_0x189c1f['push'](_0x189c1f['shift']());}};_0x54b4a6(++_0x527767);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x13d913,_0x379ef3){var _0xf9b111=function(_0x405092){while(--_0x405092){_0x13d913['push'](_0x13d913['shift']());}};_0xf9b111(++_0x379ef3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xcb91[_0x305c31];return _0x17f39f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a449dc8..26d19e6 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 _0xa5fd=['describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','update','delete','destroy','removeAgents','removeTeams','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x4a363f,_0x36480a){var _0x391de0=function(_0x55a220){while(--_0x55a220){_0x4a363f['push'](_0x4a363f['shift']());}};_0x391de0(++_0x36480a);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xda5f('0x0'));var util=require('util');var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express['Router']();var fs_extra=require(_0xda5f('0x4'));var auth=require(_0xda5f('0x5'));var interaction=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xda5f('0x8')](),controller[_0xda5f('0x9')]);router[_0xda5f('0xa')](_0xda5f('0xb'),auth[_0xda5f('0x8')](),controller[_0xda5f('0xc')]);router['get'](_0xda5f('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xda5f('0xe'),auth['isAuthenticated'](),controller[_0xda5f('0xf')]);router[_0xda5f('0xa')](_0xda5f('0x10'),auth['isAuthenticated'](),controller[_0xda5f('0x11')]);router[_0xda5f('0x12')]('/',auth[_0xda5f('0x8')](),controller['create']);router['post'](_0xda5f('0xe'),auth[_0xda5f('0x8')](),controller[_0xda5f('0x13')]);router[_0xda5f('0x12')]('/:id/teams',auth[_0xda5f('0x8')](),controller[_0xda5f('0x14')]);router['put'](_0xda5f('0xd'),auth[_0xda5f('0x8')](),controller[_0xda5f('0x15')]);router[_0xda5f('0x16')](_0xda5f('0xd'),auth[_0xda5f('0x8')](),controller[_0xda5f('0x17')]);router[_0xda5f('0x16')](_0xda5f('0xe'),auth[_0xda5f('0x8')](),controller[_0xda5f('0x18')]);router[_0xda5f('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xda5f('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb673=['removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/users','getAgents','/:id/teams','post','addAgents','addTeams','put','/:id','update','destroy','delete'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb673,0xa5));var _0x3b67=function(_0x4020ea,_0x88ab57){_0x4020ea=_0x4020ea-0x0;var _0x42557f=_0xb673[_0x4020ea];return _0x42557f;};'use strict';var multer=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var path=require('path');var timeout=require(_0x3b67('0x2'));var express=require(_0x3b67('0x3'));var router=express[_0x3b67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3b67('0x5'));var interaction=require(_0x3b67('0x6'));var config=require(_0x3b67('0x7'));var controller=require('./voicePrefix.controller');router[_0x3b67('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b67('0x9')]);router[_0x3b67('0x8')](_0x3b67('0xa'),auth[_0x3b67('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3b67('0xc')]);router['get'](_0x3b67('0xd'),auth['isAuthenticated'](),controller[_0x3b67('0xe')]);router[_0x3b67('0x8')](_0x3b67('0xf'),auth[_0x3b67('0xb')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3b67('0x10')](_0x3b67('0xd'),auth['isAuthenticated'](),controller[_0x3b67('0x11')]);router[_0x3b67('0x10')]('/:id/teams',auth[_0x3b67('0xb')](),controller[_0x3b67('0x12')]);router[_0x3b67('0x13')](_0x3b67('0x14'),auth[_0x3b67('0xb')](),controller[_0x3b67('0x15')]);router['delete']('/:id',auth[_0x3b67('0xb')](),controller[_0x3b67('0x16')]);router[_0x3b67('0x17')](_0x3b67('0xd'),auth['isAuthenticated'](),controller[_0x3b67('0x18')]);router[_0x3b67('0x17')]('/:id/teams',auth[_0x3b67('0xb')](),controller[_0x3b67('0x19')]);module[_0x3b67('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4e9a1a0..b7577d1 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 _0x0df1=['getDataValue','STRING','sequelize','exports','name','VIRTUAL','system-'];(function(_0x57ebf7,_0x38f43b){var _0x199719=function(_0x562475){while(--_0x562475){_0x57ebf7['push'](_0x57ebf7['shift']());}};_0x199719(++_0x38f43b);}(_0x0df1,0xc6));var _0x10df=function(_0x177d0e,_0xcfb1b9){_0x177d0e=_0x177d0e-0x0;var _0x152ce7=_0x0df1[_0x177d0e];return _0x152ce7;};'use strict';var Sequelize=require(_0x10df('0x0'));module[_0x10df('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x10df('0x2')},'prefix':{'type':Sequelize[_0x10df('0x3')],'get':function(_0x35e0bb){return _0x10df('0x4')+this[_0x10df('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x10df('0x6')]},'callerIdAll':{'type':Sequelize[_0x10df('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3387=['getDataValue','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x173a8d,_0x55963c){var _0x388290=function(_0x50a17f){while(--_0x50a17f){_0x173a8d['push'](_0x173a8d['shift']());}};_0x388290(++_0x55963c);}(_0x3387,0x97));var _0x7338=function(_0x4f602d,_0x54d3b9){_0x4f602d=_0x4f602d-0x0;var _0x4e0fa4=_0x3387[_0x4f602d];return _0x4e0fa4;};'use strict';var Sequelize=require(_0x7338('0x0'));module['exports']={'name':{'type':Sequelize[_0x7338('0x1')],'allowNull':![],'unique':_0x7338('0x2')},'prefix':{'type':Sequelize[_0x7338('0x3')],'get':function(_0x4a4a1d){return _0x7338('0x4')+this[_0x7338('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7338('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index fd568bb..f72ac6a 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 _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x326adb,_0x498980){var _0x98d4e9=function(_0x3ded4f){while(--_0x3ded4f){_0x326adb['push'](_0x326adb['shift']());}};_0x98d4e9(++_0x498980);}(_0x2032,0xd9));var _0x2203=function(_0x4700ee,_0x329723){_0x4700ee=_0x4700ee-0x0;var _0xd1f3da=_0x2032[_0x4700ee];return _0xd1f3da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file +var _0xbaf0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','describe','create','sequelize','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','prefix','system-','ids','omit','spread','userVoicePrefix:save','params','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x756632,_0xc043cf){var _0x990247=function(_0x21a4b1){while(--_0x21a4b1){_0x756632['push'](_0x756632['shift']());}};_0x990247(++_0xc043cf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./voicePrefix.socket')[_0x0baf('0x1e')](socket);function respondWithStatusCode(_0x1f50c3,_0x7fbf67){_0x7fbf67=_0x7fbf67||0xcc;return function(_0x2bc381){if(_0x2bc381){return _0x1f50c3[_0x0baf('0x1f')](_0x7fbf67);}return _0x1f50c3[_0x0baf('0x20')](_0x7fbf67)['end']();};}function respondWithResult(_0x4cd79d,_0x2312c7){_0x2312c7=_0x2312c7||0xc8;return function(_0x38395b){if(_0x38395b){return _0x4cd79d[_0x0baf('0x20')](_0x2312c7)[_0x0baf('0x21')](_0x38395b);}};}function respondWithFilteredResult(_0x2cf7da,_0x288a98){return function(_0x53c338){if(_0x53c338){var _0x63c820=typeof _0x288a98[_0x0baf('0x22')]===_0x0baf('0x23')&&typeof _0x288a98[_0x0baf('0x24')]===_0x0baf('0x23');var _0x42b7f2=_0x53c338['count'];var _0x5cff5d=_0x63c820?0x0:_0x288a98[_0x0baf('0x22')];var _0x154f48=_0x63c820?_0x53c338[_0x0baf('0x25')]:_0x288a98[_0x0baf('0x22')]+_0x288a98[_0x0baf('0x24')];var _0x3e3e20;if(_0x154f48>=_0x42b7f2){_0x154f48=_0x42b7f2;_0x3e3e20=0xc8;}else{_0x3e3e20=0xce;}_0x2cf7da[_0x0baf('0x20')](_0x3e3e20);return _0x2cf7da[_0x0baf('0x26')](_0x0baf('0x27'),_0x5cff5d+'-'+_0x154f48+'/'+_0x42b7f2)[_0x0baf('0x21')](_0x53c338);}return null;};}function patchUpdates(_0x54f2fa){return function(_0x334bd6){try{jsonpatch['apply'](_0x334bd6,_0x54f2fa,!![]);}catch(_0xf6c158){return BPromise['reject'](_0xf6c158);}return _0x334bd6['save']();};}function saveUpdates(_0x2ef0aa,_0x48a0e9){return function(_0x4be1b9){if(_0x4be1b9){return _0x4be1b9[_0x0baf('0x28')](_0x2ef0aa)[_0x0baf('0x29')](function(_0x34e264){return _0x34e264;});}return null;};}function removeEntity(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(_0x56b299){return _0x56b299[_0x0baf('0x2a')]()[_0x0baf('0x29')](function(){var _0x1ca35a=_0x56b299[_0x0baf('0x2b')]({'plain':!![]});var _0x3843b8=_0x0baf('0x2c');return db[_0x0baf('0x2d')]['destroy']({'where':{'type':_0x3843b8,'resourceId':_0x1ca35a['id']}})[_0x0baf('0x29')](function(){return _0x56b299;});})[_0x0baf('0x29')](function(){_0x19d9fd[_0x0baf('0x20')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x55c715,_0x29dbdf){return function(_0x34a58a){if(!_0x34a58a){_0x55c715['sendStatus'](0x194);}return _0x34a58a;};}function handleError(_0x44ec31,_0x32e4fb){_0x32e4fb=_0x32e4fb||0x1f4;return function(_0x478ce8){logger[_0x0baf('0x2f')](_0x478ce8[_0x0baf('0x30')]);if(_0x478ce8[_0x0baf('0x31')]){delete _0x478ce8[_0x0baf('0x31')];}_0x44ec31['status'](_0x32e4fb)[_0x0baf('0x32')](_0x478ce8);};}exports[_0x0baf('0x33')]=function(_0x37be4e,_0x3ed995){var _0x24ecee={},_0x275ea1={},_0x2fc983={'count':0x0,'rows':[]};var _0x2f0a45=_[_0x0baf('0x34')](db[_0x0baf('0x35')][_0x0baf('0x36')],function(_0x165d14){return{'name':_0x165d14[_0x0baf('0x37')],'type':_0x165d14[_0x0baf('0x38')]['key']};});_0x275ea1[_0x0baf('0x39')]=_['map'](_0x2f0a45,_0x0baf('0x31'));_0x275ea1[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x37be4e[_0x0baf('0x3a')]);_0x275ea1['filters']=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],_0x275ea1['query']);_0x24ecee[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],qs[_0x0baf('0x3e')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x24ecee[_0x0baf('0x3d')]=_0x24ecee[_0x0baf('0x3d')]['length']?_0x24ecee[_0x0baf('0x3d')]:_0x275ea1[_0x0baf('0x39')];if(!_0x37be4e['query'][_0x0baf('0x3f')]('nolimit')){_0x24ecee['limit']=qs[_0x0baf('0x24')](_0x37be4e[_0x0baf('0x3a')]['limit']);_0x24ecee['offset']=qs[_0x0baf('0x22')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x22')]);}_0x24ecee[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x24ecee[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x37be4e[_0x0baf('0x3a')],_0x275ea1[_0x0baf('0x43')]),_0x2f0a45);if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x24ecee['where']=_[_0x0baf('0x46')](_0x24ecee[_0x0baf('0x42')],{'$or':_['map'](_0x2f0a45,function(_0x38006a){if(_0x38006a[_0x0baf('0x38')]!==_0x0baf('0x47')){var _0x299f93={};_0x299f93[_0x38006a[_0x0baf('0x31')]]={'$like':'%'+_0x37be4e[_0x0baf('0x3a')]['filter']+'%'};return _0x299f93;}})});}_0x24ecee=_[_0x0baf('0x46')]({},_0x24ecee,_0x37be4e[_0x0baf('0x48')]);var _0x540c41={'where':_0x24ecee[_0x0baf('0x42')]};return db[_0x0baf('0x35')][_0x0baf('0x25')](_0x540c41)[_0x0baf('0x29')](function(_0x504031){_0x2fc983[_0x0baf('0x25')]=_0x504031;if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x24ecee[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x35')][_0x0baf('0x4b')](_0x24ecee);})[_0x0baf('0x29')](function(_0x1fa237){_0x2fc983[_0x0baf('0x4c')]=_0x1fa237;return _0x2fc983;})[_0x0baf('0x29')](respondWithFilteredResult(_0x3ed995,_0x24ecee))['catch'](handleError(_0x3ed995,null));};exports[_0x0baf('0x4d')]=function(_0x2bc755,_0x1daf1d){var _0x339aff={'raw':![],'where':{'id':_0x2bc755['params']['id']}},_0x22207a={};_0x22207a[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x35')][_0x0baf('0x36')]);_0x22207a[_0x0baf('0x3a')]=_['keys'](_0x2bc755[_0x0baf('0x3a')]);_0x22207a[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x22207a[_0x0baf('0x39')],_0x22207a[_0x0baf('0x3a')]);_0x339aff[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x22207a['model'],qs[_0x0baf('0x3e')](_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x339aff['attributes']=_0x339aff[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x339aff[_0x0baf('0x3d')]:_0x22207a[_0x0baf('0x39')];if(_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x339aff[_0x0baf('0x4a')]=[{'all':!![]}];}_0x339aff=_['merge']({},_0x339aff,_0x2bc755[_0x0baf('0x48')]);return db[_0x0baf('0x35')][_0x0baf('0x4f')](_0x339aff)[_0x0baf('0x29')](handleEntityNotFound(_0x1daf1d,null))[_0x0baf('0x29')](respondWithResult(_0x1daf1d,null))[_0x0baf('0x50')](handleError(_0x1daf1d,null));};exports[_0x0baf('0x2a')]=function(_0x1af4aa,_0x2be7fe){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x1af4aa['params']['id']}})['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x29')](removeEntity(_0x2be7fe,null))[_0x0baf('0x50')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x51')]=function(_0xb8fa28,_0x21b108){return db[_0x0baf('0x35')][_0x0baf('0x51')]()['then'](respondWithResult(_0x21b108,null))[_0x0baf('0x50')](handleError(_0x21b108,null));};exports[_0x0baf('0x52')]=function(_0xf2424,_0x16d9fb){var _0x3fdb41;return db[_0x0baf('0x53')]['transaction'](function(_0x3eebe5){return db['VoicePrefix'][_0x0baf('0x52')](_0xf2424['body'],{'transaction':_0x3eebe5})[_0x0baf('0x29')](function(_0x5eaeb2){_0x3fdb41=_0x5eaeb2[_0x0baf('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x0baf('0x4f')]({'where':{'id':_0x3fdb41[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x4520d1){return createVoicePrefixExtensions(_0x3fdb41,_0x4520d1,_0x3eebe5);});});})[_0x0baf('0x29')](function(){var _0x576475=_0xf2424[_0x0baf('0x55')][_0x0baf('0x2b')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x56'));if(_0x576475[_0x0baf('0x57')]===_0x0baf('0x55')){var _0xa19b21=_0x3fdb41;return db['UserProfileSection'][_0x0baf('0x4f')]({'where':{'name':_0x0baf('0x2c'),'userProfileId':_0x576475[_0x0baf('0x58')]},'raw':!![]})[_0x0baf('0x29')](function(_0xbc7cc2){if(_0xbc7cc2&&_0xbc7cc2[_0x0baf('0x59')]===0x0){return db[_0x0baf('0x2d')]['create']({'name':_0xa19b21['name'],'resourceId':_0xa19b21['id'],'type':_0xbc7cc2[_0x0baf('0x31')],'sectionId':_0xbc7cc2['id']},{})[_0x0baf('0x29')](function(){return _0x3fdb41;});}else{return _0x3fdb41;}})[_0x0baf('0x50')](function(_0x337d94){logger[_0x0baf('0x2f')](_0x0baf('0x5a'),_0x337d94);throw _0x337d94;});}return _0x3fdb41;})[_0x0baf('0x29')](respondWithResult(_0x16d9fb,null))[_0x0baf('0x50')](handleError(_0x16d9fb,null));};function Extension(_0x3d9a32,_0x585969,_0x3238f9,_0x268be8){this[_0x0baf('0x5b')]=_0x0baf('0x5c');this[_0x0baf('0x5d')]=_0x3d9a32;this[_0x0baf('0x5e')]=_0x3238f9;this[_0x0baf('0x38')]='system';this[_0x0baf('0x5f')]=_0x0baf('0x60');this[_0x0baf('0x61')]=_0x585969;this[_0x0baf('0x62')]=_0x268be8;}function createVoicePrefixExtensions(_0x1c7d88,_0x1a6d22,_0x14e6d0){return new BPromise(function(_0x12543e,_0x498405){var _0x178495=new Extension(formatPrefixName(_0x1c7d88['prefix']),0x1,_0x0baf('0x63'),'Voice\x20Prefix');_0x178495['VoicePrefixId']=_0x1c7d88['id'];return db[_0x0baf('0x64')]['create'](_0x178495,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x2b17f8){var _0x49d713=_0x2b17f8[_0x0baf('0x2b')]({'plain':!![]});var _0xfb6708=_[_0x0baf('0x34')](addVoicePrefixExtensions(_0x1c7d88,_0x1a6d22),function(_0x5b3c1d){_0x5b3c1d['VoiceExtensionId']=_0x49d713['id'];_0x5b3c1d[_0x0baf('0x65')]=_0x1c7d88['id'];return _0x5b3c1d;});return db[_0x0baf('0x64')][_0x0baf('0x66')](_0xfb6708,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x784e1a){if(!_0x784e1a){return _0x498405('Extensions\x20creation\x20failed');}else{return _0x12543e(_0x784e1a);}})[_0x0baf('0x50')](function(_0x4c02ca){return _0x498405(_0x4c02ca);});});;});};function addVoicePrefixExtensions(_0x5d5751,_0x59a0b2){var _0x427ed1=[];var _0x58a366=formatPrefixName(_0x5d5751['prefix']);_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x2,_0x0baf('0x68'),_0x0baf('0x69')+_0x5d5751[_0x0baf('0x31')]));if(_0x5d5751[_0x0baf('0x6a')]){_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,'Set',_0x0baf('0x6b')+_0x5d5751[_0x0baf('0x6a')]));}else{_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,_0x0baf('0x63'),_0x0baf('0x6c')));}_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x4,'goto',_0x59a0b2[_0x0baf('0x5b')]+','+_0x0baf('0x6d')+(0x8+_0x5d5751[_0x0baf('0x31')]['length'])+'}'+','+0x1));return _0x427ed1;}function formatPrefixName(_0x89484d){var _0x1e474f='_';for(var _0x3d333d=0x0;_0x3d333d<_0x89484d[_0x0baf('0x4e')];_0x3d333d++){if(_0x89484d[_0x0baf('0x6e')](_0x3d333d)=='-'){_0x1e474f+=_0x89484d[_0x0baf('0x6e')](_0x3d333d);}else{_0x1e474f+='['+_0x89484d[_0x0baf('0x6e')](_0x3d333d)+']';}}_0x1e474f+='.';return _0x1e474f;}exports['update']=function(_0x54353a,_0x4b7caa,_0x6ce83c){var _0x89bec7=_0x54353a[_0x0baf('0x6f')];_0x89bec7[_0x0baf('0x70')]=_0x0baf('0x71')+_0x89bec7[_0x0baf('0x31')]+'-';return db['sequelize']['transaction'](function(_0x34c1f4){return db['VoicePrefix'][_0x0baf('0x28')](_0x89bec7,{'where':{'id':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db['VoiceExtension'][_0x0baf('0x2a')]({'where':{'VoicePrefixId':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db[_0x0baf('0x64')][_0x0baf('0x4f')]({'where':{'id':_0x89bec7[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x1b6b73){return createVoicePrefixExtensions(_0x89bec7,_0x1b6b73,_0x34c1f4);});});});})[_0x0baf('0x29')](function(){return db[_0x0baf('0x35')]['findById'](_0x89bec7['id']);})['then'](respondWithResult(_0x4b7caa,null))['catch'](handleError(_0x4b7caa,null));};exports['addAgents']=function(_0x5361a5,_0x418c45,_0x18963f){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x5361a5['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x418c45,null))[_0x0baf('0x29')](function(_0x58caee){if(_0x58caee){return _0x58caee['addAgents'](_0x5361a5[_0x0baf('0x6f')][_0x0baf('0x72')],_[_0x0baf('0x73')](_0x5361a5[_0x0baf('0x6f')],[_0x0baf('0x72'),'id'])||{})[_0x0baf('0x74')](function(_0x3ce111){for(var _0x399f40=0x0;_0x399f40<_0x5361a5['body'][_0x0baf('0x72')][_0x0baf('0x4e')];_0x399f40+=0x1){socket['emit'](_0x0baf('0x75'),{'UserId':Number(_0x5361a5[_0x0baf('0x6f')]['ids'][_0x399f40]),'VoicePrefixId':Number(_0x5361a5[_0x0baf('0x76')]['id'])});}return _0x3ce111;});}})[_0x0baf('0x29')](respondWithResult(_0x418c45,null))[_0x0baf('0x50')](handleError(_0x418c45,null));};exports[_0x0baf('0x77')]=function(_0x167977,_0x4fc5af,_0x4807fc){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x167977['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x4fc5af,null))[_0x0baf('0x29')](function(_0x21ad25){if(_0x21ad25){return _0x21ad25['removeAgents'](_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')])[_0x0baf('0x29')](function(){if(_['isArray'](_0x167977[_0x0baf('0x3a')]['ids'])){for(var _0x316397=0x0;_0x316397<_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x0baf('0x4e')];_0x316397+=0x1){socket[_0x0baf('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x316397]),'VoicePrefixId':Number(_0x167977['params']['id'])});}}else{socket[_0x0baf('0x78')](_0x0baf('0x79'),{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')]),'VoicePrefixId':Number(_0x167977[_0x0baf('0x76')]['id'])});}});}})[_0x0baf('0x29')](respondWithStatusCode(_0x4fc5af,null))[_0x0baf('0x50')](handleError(_0x4fc5af,null));};exports[_0x0baf('0x7a')]=function(_0x44ef57,_0x1ca3a6,_0x3b7abf){var _0x2c2f09={};var _0x5985f9={};var _0x599ac0;var _0x29a036;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x44ef57['params']['id']}})['then'](handleEntityNotFound(_0x1ca3a6,null))[_0x0baf('0x29')](function(_0x368e23){if(_0x368e23){_0x599ac0=_0x368e23;_0x5985f9[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x7c')][_0x0baf('0x36')]);_0x5985f9[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x44ef57[_0x0baf('0x3a')]);_0x5985f9['filters']=_[_0x0baf('0x3c')](_0x5985f9[_0x0baf('0x39')],_0x5985f9[_0x0baf('0x3a')]);_0x2c2f09[_0x0baf('0x3d')]=_['intersection'](_0x5985f9['model'],qs['fields'](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x2c2f09['attributes']=_0x2c2f09['attributes'][_0x0baf('0x4e')]?_0x2c2f09[_0x0baf('0x3d')]:_0x5985f9['model'];_0x2c2f09[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x2c2f09[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x44ef57[_0x0baf('0x3a')],_0x5985f9[_0x0baf('0x43')]));if(_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x2c2f09[_0x0baf('0x42')]=_['merge'](_0x2c2f09[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x2c2f09[_0x0baf('0x3d')],function(_0x3bd15b){var _0x3c37b4={};_0x3c37b4[_0x3bd15b]={'$like':'%'+_0x44ef57[_0x0baf('0x3a')]['filter']+'%'};return _0x3c37b4;})});}_0x2c2f09=_[_0x0baf('0x46')]({},_0x2c2f09,_0x44ef57[_0x0baf('0x48')]);return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x4376a1){if(_0x4376a1){_0x29a036=_0x4376a1['length'];if(!_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3f')](_0x0baf('0x7d'))){_0x2c2f09[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x44ef57['query']['limit']);_0x2c2f09[_0x0baf('0x22')]=qs['offset'](_0x44ef57[_0x0baf('0x3a')]['offset']);}return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x1ce7bb){if(_0x1ce7bb){return _0x1ce7bb?{'count':_0x29a036,'rows':_0x1ce7bb}:null;}})[_0x0baf('0x29')](respondWithResult(_0x1ca3a6,null))['catch'](handleError(_0x1ca3a6,null));};exports[_0x0baf('0x7e')]=function(_0x106ffa,_0xf7a9d0,_0x551df3){var _0x487aec={};var _0x591cc2={};var _0x4d4884;var _0x427638;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x106ffa[_0x0baf('0x76')]['id']}})['then'](handleEntityNotFound(_0xf7a9d0,null))[_0x0baf('0x29')](function(_0x37594e){if(_0x37594e){_0x4d4884=_0x37594e;_0x591cc2[_0x0baf('0x39')]=_['keys'](db[_0x0baf('0x7f')][_0x0baf('0x36')]);_0x591cc2['query']=_[_0x0baf('0x3b')](_0x106ffa['query']);_0x591cc2[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x591cc2[_0x0baf('0x39')],_0x591cc2[_0x0baf('0x3a')]);_0x487aec['attributes']=_['intersection'](_0x591cc2[_0x0baf('0x39')],qs['fields'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x487aec[_0x0baf('0x3d')]=_0x487aec[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x487aec['attributes']:_0x591cc2[_0x0baf('0x39')];_0x487aec['order']=qs[_0x0baf('0x41')](_0x106ffa['query'][_0x0baf('0x41')]);_0x487aec['where']=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x106ffa[_0x0baf('0x3a')],_0x591cc2['filters']));if(_0x106ffa['query'][_0x0baf('0x45')]){_0x487aec[_0x0baf('0x42')]=_[_0x0baf('0x46')](_0x487aec[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x487aec[_0x0baf('0x3d')],function(_0x4e6059){var _0xd4170d={};_0xd4170d[_0x4e6059]={'$like':'%'+_0x106ffa['query'][_0x0baf('0x45')]+'%'};return _0xd4170d;})});}_0x487aec=_['merge']({},_0x487aec,_0x106ffa[_0x0baf('0x48')]);return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0x557a38){if(_0x557a38){_0x427638=_0x557a38[_0x0baf('0x4e')];if(!_0x106ffa[_0x0baf('0x3a')]['hasOwnProperty']('nolimit')){_0x487aec[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x24')]);_0x487aec['offset']=qs['offset'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x22')]);}return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0xfc91ce){if(_0xfc91ce){return _0xfc91ce?{'count':_0x427638,'rows':_0xfc91ce}:null;}})[_0x0baf('0x29')](respondWithResult(_0xf7a9d0,null))[_0x0baf('0x50')](handleError(_0xf7a9d0,null));};exports[_0x0baf('0x80')]=function(_0x205de6,_0x2369f0,_0x58f95c){var _0xdb96c0=_0x205de6['body'][_0x0baf('0x72')];var _0x42abcf;return db[_0x0baf('0x7f')][_0x0baf('0x4b')]({'where':{'id':_0xdb96c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0baf('0x81'),'attributes':['id',_0x0baf('0x31'),_0x0baf('0x82'),_0x0baf('0x83'),_0x0baf('0x84')],'raw':!![]}]})[_0x0baf('0x29')](function(_0x3b9101){if(_0x3b9101){_0x42abcf=_0x3b9101;var _0x205075=_[_0x0baf('0x85')](_0x3b9101,function(_0x4b6cd5){var _0x8d1bae=_0x4b6cd5[_0x0baf('0x2b')]({'plain':!![]});return _0x8d1bae['Agents'];});return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x205de6[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x97f5d6){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x8c1dc2){return _0x97f5d6[_0x0baf('0x80')](_0xdb96c0,{'transaction':_0x8c1dc2})['then'](function(){return BPromise[_0x0baf('0x87')](_0x42abcf,function(_0x218fc5){return db[_0x0baf('0x88')][_0x0baf('0x89')]({'TeamId':_0x218fc5['id'],'VoicePrefixId':_0x205de6[_0x0baf('0x76')]['id']},{'transaction':_0x8c1dc2});});})[_0x0baf('0x29')](function(){return BPromise['each'](_0x205075,function(_0x121718){return db[_0x0baf('0x8a')][_0x0baf('0x8b')]({'where':{'UserId':_0x121718['id'],'VoicePrefixId':_0x205de6['params']['id']},'transaction':_0x8c1dc2});});})['then'](function(){_0x205075[_0x0baf('0x8c')](function(_0x1adb84){socket[_0x0baf('0x78')]('userVoicePrefix:save',{'UserId':_0x1adb84['id'],'VoicePrefixId':_0x97f5d6['id']});});});});});}})[_0x0baf('0x29')](respondWithStatusCode(_0x2369f0,null))['catch'](handleError(_0x2369f0,null));};exports[_0x0baf('0x8d')]=function(_0x5f09be,_0x41b216,_0x3f2838){return db['Team'][_0x0baf('0x4b')]({'where':{'id':_0x5f09be[_0x0baf('0x3a')][_0x0baf('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0baf('0x7c')],'as':_0x0baf('0x81'),'attributes':['id'],'raw':!![]}]})[_0x0baf('0x29')](handleEntityNotFound(_0x41b216,null))[_0x0baf('0x29')](function(_0x5508db){var _0x727cad=_[_0x0baf('0x34')](_0x5508db,'id');var _0x2766fb=[];var _0x2e1629=[];var _0x275cc4=squel[_0x0baf('0x8e')]();_0x275cc4[_0x0baf('0x8f')](_0x0baf('0x90'))[_0x0baf('0x91')](_0x0baf('0x92'),'tq')[_0x0baf('0x93')](_0x0baf('0x94'),'ut',_0x0baf('0x95'))[_0x0baf('0x42')]('VoicePrefixId\x20=\x20?',_0x5f09be['params']['id']);for(var _0x1cd215=0x0;_0x1cd215<_0x5508db[_0x0baf('0x4e')];_0x1cd215+=0x1){let _0x3b9429=_0x5508db[_0x1cd215];for(var _0x41d397=0x0;_0x41d397<_0x3b9429['Agents'][_0x0baf('0x4e')];_0x41d397+=0x1){let _0xc6c049=_0x3b9429[_0x0baf('0x81')][_0x41d397];var _0x2fb267=_0x275cc4[_0x0baf('0x96')]();_0x2fb267[_0x0baf('0x42')]('ut.UserId\x20=\x20?',_0xc6c049['id']);_0x2e1629[_0x0baf('0x67')](db[_0x0baf('0x53')][_0x0baf('0x3a')](_0x2fb267['toString'](),{'type':db[_0x0baf('0x53')][_0x0baf('0x97')][_0x0baf('0x98')]})['then'](function(_0x4f7145){if(_0x4f7145['length']===0x1){return _0xc6c049['id'];}else{var _0x11a85a=_['every'](_[_0x0baf('0x34')](_0x4f7145,_0x0baf('0x99')),function(_0x55124b){return _[_0x0baf('0x9a')](_0x727cad,_0x55124b);});if(_0x11a85a){return _0xc6c049['id'];}}}));}}return BPromise['all'](_0x2e1629)['then'](function(_0x21516f){_0x2766fb=_(_0x2766fb)['union'](_0x21516f)[_0x0baf('0x9b')]()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x5f09be[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x3d1f80){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x4f9904){return _0x3d1f80[_0x0baf('0x8d')](_0x5f09be['query'][_0x0baf('0x72')],{'transaction':_0x4f9904})[_0x0baf('0x29')](function(){if(!_[_0x0baf('0x9c')](_0x2766fb)){return _0x3d1f80['removeAgents'](_0x2766fb,{'transaction':_0x4f9904});}})[_0x0baf('0x29')](function(){_0x2766fb[_0x0baf('0x8c')](function(_0x12311d){socket['emit'](_0x0baf('0x79'),{'UserId':_0x12311d,'VoicePrefixId':_0x3d1f80['id']});});});});});});})['then'](respondWithStatusCode(_0x41b216,null))[_0x0baf('0x50')](handleError(_0x41b216,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index dafac6c..8e12da4 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 _0x0fe9=['../../mysqldb','VoicePrefix','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5f3f99,_0x1de87d){var _0x531aa3=function(_0x3fd360){while(--_0x3fd360){_0x5f3f99['push'](_0x5f3f99['shift']());}};_0x531aa3(++_0x1de87d);}(_0x0fe9,0x157));var _0x90fe=function(_0x52f521,_0xc591f5){_0x52f521=_0x52f521-0x0;var _0x4d2f52=_0x0fe9[_0x52f521];return _0x4d2f52;};'use strict';var EventEmitter=require(_0x90fe('0x0'));var VoicePrefix=require(_0x90fe('0x1'))['db'][_0x90fe('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x90fe('0x3')};function emitEvent(_0x1fea78){return function(_0x223022,_0x44ac56,_0xceb666){VoicePrefixEvents[_0x90fe('0x4')](_0x1fea78+':'+_0x223022['id'],_0x223022);VoicePrefixEvents[_0x90fe('0x4')](_0x1fea78,_0x223022);_0xceb666(null);};}for(var e in events){if(events[_0x90fe('0x5')](e)){var event=events[e];VoicePrefix[_0x90fe('0x6')](e,emitEvent(event));}}module[_0x90fe('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x57be=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoicePrefix'];(function(_0x4f4c53,_0x58ba7b){var _0x568ff1=function(_0x1b6013){while(--_0x1b6013){_0x4f4c53['push'](_0x4f4c53['shift']());}};_0x568ff1(++_0x58ba7b);}(_0x57be,0x103));var _0xe57b=function(_0x15140c,_0x4bf5fd){_0x15140c=_0x15140c-0x0;var _0x166bd8=_0x57be[_0x15140c];return _0x166bd8;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xe57b('0x0'))['db'][_0xe57b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe57b('0x2')](0x0);var events={'afterCreate':_0xe57b('0x3'),'afterUpdate':'update','afterDestroy':_0xe57b('0x4')};function emitEvent(_0x16ee50){return function(_0x328cda,_0x49506c,_0x8e9850){VoicePrefixEvents[_0xe57b('0x5')](_0x16ee50+':'+_0x328cda['id'],_0x328cda);VoicePrefixEvents['emit'](_0x16ee50,_0x328cda);_0x8e9850(null);};}for(var e in events){if(events[_0xe57b('0x6')](e)){var event=events[e];VoicePrefix[_0xe57b('0x7')](e,emitEvent(event));}}module[_0xe57b('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 ec688e6..f8f4d0f 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 _0xc711=['voice_prefixes','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x1f06e5,_0x189c32){var _0x3e61f9=function(_0x1ec9a8){while(--_0x1ec9a8){_0x1f06e5['push'](_0x1f06e5['shift']());}};_0x3e61f9(++_0x189c32);}(_0xc711,0x114));var _0x1c71=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xc711[_0x22c684];return _0x39fcbb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c71('0x0'))('api');var moment=require(_0x1c71('0x1'));var BPromise=require(_0x1c71('0x2'));var rp=require(_0x1c71('0x3'));var fs=require('fs');var path=require(_0x1c71('0x4'));var rimraf=require('rimraf');var config=require(_0x1c71('0x5'));var attributes=require(_0x1c71('0x6'));module[_0x1c71('0x7')]=function(_0x4e85d7,_0x112b31){return _0x4e85d7[_0x1c71('0x8')](_0x1c71('0x9'),attributes,{'tableName':_0x1c71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1101=['../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x1101,0x143));var _0x1110=function(_0xa106d0,_0x2ee480){_0xa106d0=_0xa106d0-0x0;var _0x158de4=_0x1101[_0xa106d0];return _0x158de4;};'use strict';var _=require(_0x1110('0x0'));var util=require(_0x1110('0x1'));var logger=require(_0x1110('0x2'))(_0x1110('0x3'));var moment=require('moment');var BPromise=require(_0x1110('0x4'));var rp=require(_0x1110('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1110('0x6'));var config=require(_0x1110('0x7'));var attributes=require(_0x1110('0x8'));module['exports']=function(_0x1850b0,_0x212f6b){return _0x1850b0['define'](_0x1110('0x9'),attributes,{'tableName':_0x1110('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 f612bf8..7a45011 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 _0x649f=['request','then','info','VoicePrefix,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x15419f,_0x30daff){var _0x1bae26=function(_0x3a0b18){while(--_0x3a0b18){_0x15419f['push'](_0x15419f['shift']());}};_0x1bae26(++_0x30daff);}(_0x649f,0x93));var _0xf649=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x649f[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var moment=require(_0xf649('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf649('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf649('0x4'));var logger=require(_0xf649('0x5'))(_0xf649('0x6'));var config=require(_0xf649('0x7'));var jayson=require(_0xf649('0x8'));var client=jayson[_0xf649('0x9')][_0xf649('0xa')]({'port':0x232a});config[_0xf649('0xb')]=_['defaults'](config['redis'],{'host':_0xf649('0xc'),'port':0x18eb});var socket=require(_0xf649('0xd'))(new Redis(config[_0xf649('0xb')]));require('./voicePrefix.socket')[_0xf649('0xe')](socket);function respondWithRpcPromise(_0x2a278c,_0x38d583,_0x4061a2){return new BPromise(function(_0x5abb8f,_0x7f5eda){return client[_0xf649('0xf')](_0x2a278c,_0x4061a2)[_0xf649('0x10')](function(_0xe5a71c){logger[_0xf649('0x11')](_0xf649('0x12'),_0x38d583,'request\x20sent');logger[_0xf649('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x38d583,'request\x20sent',JSON[_0xf649('0x14')](_0xe5a71c));if(_0xe5a71c[_0xf649('0x15')]){if(_0xe5a71c[_0xf649('0x15')][_0xf649('0x16')]===0x1f4){logger[_0xf649('0x15')](_0xf649('0x12'),_0x38d583,_0xe5a71c[_0xf649('0x15')][_0xf649('0x17')]);return _0x7f5eda(_0xe5a71c['error'][_0xf649('0x17')]);}logger[_0xf649('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x38d583,_0xe5a71c[_0xf649('0x15')][_0xf649('0x17')]);return _0x5abb8f(_0xe5a71c[_0xf649('0x15')]['message']);}else{logger['info'](_0xf649('0x12'),_0x38d583,_0xf649('0x18'));_0x5abb8f(_0xe5a71c[_0xf649('0x19')][_0xf649('0x17')]);}})[_0xf649('0x1a')](function(_0x2d956d){logger[_0xf649('0x15')](_0xf649('0x12'),_0x38d583,_0x2d956d);_0x7f5eda(_0x2d956d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x2ef3,0xba));var _0x32ef=function(_0x47a3c3,_0x43162d){_0x47a3c3=_0x47a3c3-0x0;var _0x500b72=_0x2ef3[_0x47a3c3];return _0x500b72;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e71431c..44b4390 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 _0x847d=['length','voicePrefix:','save','remove','update','emit','removeListener','register'];(function(_0x100253,_0x1ad89e){var _0x5a49d7=function(_0x311e2a){while(--_0x311e2a){_0x100253['push'](_0x100253['shift']());}};_0x5a49d7(++_0x1ad89e);}(_0x847d,0x14a));var _0xd847=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x847d[_0x40a825];return _0x273a54;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xd847('0x0'),_0xd847('0x1'),_0xd847('0x2')];function createListener(_0x4f2500,_0x202b1c){return function(_0x4a85d8){_0x202b1c[_0xd847('0x3')](_0x4f2500,_0x4a85d8);};}function removeListener(_0x18051f,_0x5258c0){return function(){VoicePrefixEvents[_0xd847('0x4')](_0x18051f,_0x5258c0);};}exports[_0xd847('0x5')]=function(_0x375a88){for(var _0x13d8d4=0x0,_0x5f3349=events[_0xd847('0x6')];_0x13d8d4<_0x5f3349;_0x13d8d4++){var _0x19fdb5=events[_0x13d8d4];var _0x2bb22b=createListener(_0xd847('0x7')+_0x19fdb5,_0x375a88);VoicePrefixEvents['on'](_0x19fdb5,_0x2bb22b);}}; \ No newline at end of file +var _0x167e=['register','length','./voicePrefix.events','save','remove','update','emit'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x167e,0xa3));var _0xe167=function(_0x543eb1,_0x28ed12){_0x543eb1=_0x543eb1-0x0;var _0x682a85=_0x167e[_0x543eb1];return _0x682a85;};'use strict';var VoicePrefixEvents=require(_0xe167('0x0'));var events=[_0xe167('0x1'),_0xe167('0x2'),_0xe167('0x3')];function createListener(_0x14457a,_0x398408){return function(_0x3958c5){_0x398408[_0xe167('0x4')](_0x14457a,_0x3958c5);};}function removeListener(_0x5e4863,_0x287097){return function(){VoicePrefixEvents['removeListener'](_0x5e4863,_0x287097);};}exports[_0xe167('0x5')]=function(_0x3563b8){for(var _0x3812f5=0x0,_0x3bad0c=events[_0xe167('0x6')];_0x3812f5<_0x3bad0c;_0x3812f5++){var _0x56cf9b=events[_0x3812f5];var _0x3a00d5=createListener('voicePrefix:'+_0x56cf9b,_0x3563b8);VoicePrefixEvents['on'](_0x56cf9b,_0x3a00d5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b9406be..2d484cd 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(_0x259a35,_0x44ba98){var _0x462543=function(_0x5262d4){while(--_0x5262d4){_0x259a35['push'](_0x259a35['shift']());}};_0x462543(++_0x44ba98);}(_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['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x22dd17,_0x56d249){var _0x517196=function(_0xdb7874){while(--_0xdb7874){_0x22dd17['push'](_0x22dd17['shift']());}};_0x517196(++_0x56d249);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b3ee63d..c702bb5 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 _0x0db3=['rrordered','setDataValue','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','outbound','inbound','default','STRING','ringall','fewestcalls','rrmemory','linear','wrandom'];(function(_0x1954ae,_0x368fea){var _0x2334d4=function(_0x2c5ef7){while(--_0x2c5ef7){_0x1954ae['push'](_0x1954ae['shift']());}};_0x2334d4(++_0x368fea);}(_0x0db3,0x8c));var _0x30db=function(_0x5517d0,_0x5d250d){_0x5517d0=_0x5517d0-0x0;var _0xfc52f3=_0x0db3[_0x5517d0];return _0xfc52f3;};'use strict';var Sequelize=require('sequelize');module[_0x30db('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x30db('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x30db('0x2')]('inbound',_0x30db('0x3')),'allowNull':![],'defaultValue':_0x30db('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x30db('0x5')},'announce':{'type':Sequelize[_0x30db('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0x30db('0x2')]('rr',_0x30db('0x7'),'leastrecent',_0x30db('0x8'),'random',_0x30db('0x9'),_0x30db('0xa'),_0x30db('0xb'),_0x30db('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x55e8d0){this[_0x30db('0xd')]('strategy',_0x55e8d0?_0x55e8d0:'rrmemory');},'get':function(){var _0x520c4f=this[_0x30db('0xe')](_0x30db('0xf'));var _0x5ac831=this[_0x30db('0xe')](_0x30db('0x10'));var _0xbef902=this[_0x30db('0xe')]('strategy');if(_0x520c4f==='outbound'){if(_0x5ac831===_0x30db('0x11')){return null;}if(_0x5ac831===_0x30db('0x12')&&!['rrmemory',_0x30db('0x13')][_0x30db('0x14')](_0xbef902)){this[_0x30db('0xd')]('strategy',_0x30db('0x9'));}}return _0xbef902;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x30db('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x30db('0x6')]},'weight':{'type':Sequelize[_0x30db('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':_0x30db('0x16')},'autopause':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x30db('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x30db('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x30db('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x30db('0x2')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x30db('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x30db('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x30db('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x30db('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x30db('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x30db('0x6')]},'queue_quantity1':{'type':Sequelize[_0x30db('0x6')]},'queue_quantity2':{'type':Sequelize[_0x30db('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x30db('0x6')]},'queue_less_than':{'type':Sequelize[_0x30db('0x6')]},'periodic_announce':{'type':Sequelize[_0x30db('0x17')],'set':function(_0x56bbe5){this[_0x30db('0xd')](_0x30db('0x18'),_0x56bbe5?_0x56bbe5['join'](','):[]);},'get':function(){return this[_0x30db('0xe')]('periodic_announce')?this['getDataValue'](_0x30db('0x18'))[_0x30db('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x30db('0x6')],'defaultValue':_0x30db('0x16'),'set':function(_0x5df95a){this[_0x30db('0xd')](_0x30db('0x1a'),_0x5df95a?_0x5df95a[_0x30db('0x1b')](','):undefined);},'get':function(){return this[_0x30db('0xe')](_0x30db('0x1a'))?this['getDataValue'](_0x30db('0x1a'))[_0x30db('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x30db('0x6')],'defaultValue':'no','set':function(_0x1fdfda){this['setDataValue'](_0x30db('0x1c'),_0x1fdfda?_0x1fdfda['join'](','):undefined);},'get':function(){return this[_0x30db('0xe')](_0x30db('0x1c'))?this[_0x30db('0xe')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x30db('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x30db('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':0x0,'set':function(_0x22ac53){this['setDataValue'](_0x30db('0x1e'),_0x22ac53);if(_0x22ac53){if(this[_0x30db('0xe')](_0x30db('0x1f'))<0x2){this[_0x30db('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x30db('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':0x0,'comment':_0x30db('0x20')},'dialMethod':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x11'),_0x30db('0x21'),_0x30db('0x22'),_0x30db('0x23'),_0x30db('0x12')),'defaultValue':_0x30db('0x21'),'comment':_0x30db('0x24')},'dialLimitChannel':{'type':Sequelize[_0x30db('0x15')](0x4)[_0x30db('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x30db('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x30db('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x30db('0x2')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x30db('0x26')](0x2)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x30db('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x30db('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x30db('0x29')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x30db('0x6')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x30db('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x30db('0x6')],'defaultValue':'tTxX','comment':_0x30db('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0x30db('0x15')](0x3)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x2b')},'dialQueueProject':{'type':Sequelize[_0x30db('0x6')],'comment':_0x30db('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x30db('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)[_0x30db('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30db('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x30db('0x15')](0x3)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30db('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x30db('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30db('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30db('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30db('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x30db('0x32')},'dialTimezone':{'type':Sequelize[_0x30db('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x30db('0x6')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x30db('0x33'),_0x30db('0x34'),_0x30db('0x35')),'defaultValue':_0x30db('0x33')},'dialAMDActive':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':0x0,'comment':_0x30db('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x30db('0x15')](0x9)[_0x30db('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x30db('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x30db('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x30db('0x15')](0x9)[_0x30db('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x30db('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x30db('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x30db('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x30db('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x30db('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x30db('0x15')](0x9)[_0x30db('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x30db('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x30db('0x15')](0x9)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x30db('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x30db('0x15')](0x5)[_0x30db('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x30db('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x30db('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x30db('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x30db('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x30db('0x2')](_0x30db('0x40'),_0x30db('0x41')),'defaultValue':_0x30db('0x40')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x30db('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x30db('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x30db('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)[_0x30db('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x30db('0x15')](0x3)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x30db('0x15')](0x3)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x30db('0x15')](0x3)[_0x30db('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)[_0x30db('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x30db('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30db('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x30db('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30db('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x30db('0x15')],'allowNull':!![],'comment':_0x30db('0x48')},'mandatoryDisposition':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':![],'comment':_0x30db('0x49'),'set':function(_0x2463f9){if(!_0x2463f9)this[_0x30db('0xd')](_0x30db('0x4a'),null);this['setDataValue'](_0x30db('0x4b'),_0x2463f9);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x30db('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x30db('0x15')](0x3)[_0x30db('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x30db('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x1500=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','outbound','preview','includes','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen'];(function(_0x2bb3cc,_0x90d13d){var _0xe053a1=function(_0x312769){while(--_0x312769){_0x2bb3cc['push'](_0x2bb3cc['shift']());}};_0xe053a1(++_0x90d13d);}(_0x1500,0x1af));var _0x0150=function(_0x10bfb1,_0x91cdb4){_0x10bfb1=_0x10bfb1-0x0;var _0x5bc4ad=_0x1500[_0x10bfb1];return _0x5bc4ad;};'use strict';var Sequelize=require(_0x0150('0x0'));module[_0x0150('0x1')]={'name':{'type':Sequelize[_0x0150('0x2')],'allowNull':![],'unique':_0x0150('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x5'),'outbound'),'allowNull':![],'defaultValue':_0x0150('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x0150('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0150('0x4')]('rr',_0x0150('0x7'),'leastrecent',_0x0150('0x8'),_0x0150('0x9'),'rrmemory',_0x0150('0xa'),_0x0150('0xb'),_0x0150('0xc')),'allowNull':![],'defaultValue':_0x0150('0x7'),'set':function(_0x443506){this[_0x0150('0xd')](_0x0150('0xe'),_0x443506?_0x443506:_0x0150('0xf'));},'get':function(){var _0x2b7207=this[_0x0150('0x10')](_0x0150('0x11'));var _0x5ec321=this[_0x0150('0x10')]('dialMethod');var _0x3b8698=this[_0x0150('0x10')](_0x0150('0xe'));if(_0x2b7207===_0x0150('0x12')){if(_0x5ec321===_0x0150('0x13')){return null;}if(_0x5ec321==='booked'&&!['rrmemory','roundrobin'][_0x0150('0x14')](_0x3b8698)){this[_0x0150('0xd')](_0x0150('0xe'),_0x0150('0xf'));}}return _0x3b8698;}},'servicelevel':{'type':Sequelize[_0x0150('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0150('0x15')](0xb)},'timeout':{'type':Sequelize[_0x0150('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0150('0x2')]},'weight':{'type':Sequelize[_0x0150('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0150('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no',_0x0150('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x0150('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0150('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x0150('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0150('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0150('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0150('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0150('0x16'),'no'),'defaultValue':_0x0150('0x16')},'announce_holdtime':{'type':Sequelize[_0x0150('0x4')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](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[_0x0150('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0150('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0150('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0150('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0150('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0150('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0150('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0150('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0150('0x2')]},'queue_less_than':{'type':Sequelize[_0x0150('0x2')]},'periodic_announce':{'type':Sequelize[_0x0150('0x18')],'set':function(_0x309cb8){this['setDataValue'](_0x0150('0x19'),_0x309cb8?_0x309cb8[_0x0150('0x1a')](','):[]);},'get':function(){return this[_0x0150('0x10')](_0x0150('0x19'))?this[_0x0150('0x10')](_0x0150('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0150('0x2')],'defaultValue':_0x0150('0x16'),'set':function(_0x23e135){this[_0x0150('0xd')](_0x0150('0x1b'),_0x23e135?_0x23e135[_0x0150('0x1a')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x0150('0x10')](_0x0150('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0150('0x2')],'defaultValue':'no','set':function(_0x2171a4){this['setDataValue']('leavewhenempty',_0x2171a4?_0x2171a4[_0x0150('0x1a')](','):undefined);},'get':function(){return this[_0x0150('0x10')]('leavewhenempty')?this[_0x0150('0x10')](_0x0150('0x1c'))[_0x0150('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0150('0x2')]},'description':{'type':Sequelize[_0x0150('0x2')]},'acw':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':0x0,'set':function(_0xa75563){this[_0x0150('0xd')](_0x0150('0x1f'),_0xa75563);if(_0xa75563){if(this[_0x0150('0x10')](_0x0150('0x20'))<0x2){this[_0x0150('0xd')](_0x0150('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0150('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':0x0,'comment':_0x0150('0x21')},'dialMethod':{'type':Sequelize['ENUM'](_0x0150('0x13'),_0x0150('0x22'),_0x0150('0x23'),'predictive',_0x0150('0x24')),'defaultValue':_0x0150('0x22'),'comment':_0x0150('0x25')},'dialLimitChannel':{'type':Sequelize[_0x0150('0x15')](0x4)[_0x0150('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x0150('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0150('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0150('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0150('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x29'),_0x0150('0x2a')),'defaultValue':'dropRate','comment':_0x0150('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0150('0x2c')](0x2)[_0x0150('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0150('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x0150('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0150('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0150('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0150('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0150('0x30'),'comment':_0x0150('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0150('0x32')},'dialQueueProject':{'type':Sequelize[_0x0150('0x2')],'comment':_0x0150('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0150('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0150('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0150('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0150('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0150('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0150('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0150('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0150('0x26')],'defaultValue':0x3,'comment':_0x0150('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0150('0x15')](0x5)[_0x0150('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0150('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0150('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0150('0x39')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x0150('0x3a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0150('0x4')]('always',_0x0150('0x3b'),_0x0150('0x3c')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':0x0,'comment':_0x0150('0x3d')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0150('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0150('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0x0150('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0150('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0150('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0150('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0150('0x15')](0x9)[_0x0150('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0150('0x41')},'dialAMDMinWordLength':{'type':Sequelize[_0x0150('0x15')](0x9)[_0x0150('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0150('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0150('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0150('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0150('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0150('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0150('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x0150('0x15')](0x5)[_0x0150('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0150('0x45')},'dialRecallInQueue':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':0x0,'comment':_0x0150('0x46')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0150('0x4')](_0x0150('0x47'),_0x0150('0x48')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x0150('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0150('0x49')},'dialCutDigit':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0150('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0150('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0150('0x4b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0150('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x0150('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0150('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0150('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0150('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0150('0x15')](0x5)[_0x0150('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0150('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0150('0x15')](0x5)[_0x0150('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0150('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0150('0x15')],'allowNull':!![],'comment':_0x0150('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xa3ffd){if(!_0xa3ffd)this[_0x0150('0xd')](_0x0150('0x50'),null);this[_0x0150('0xd')](_0x0150('0x51'),_0xa3ffd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0150('0x15')](0x3)[_0x0150('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x0150('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0150('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9b6b876..62fc2cc 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 _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(_0x197767,_0x5cd129){var _0xc51080=function(_0x293b62){while(--_0x293b62){_0x197767['push'](_0x197767['shift']());}};_0xc51080(++_0x5cd129);}(_0xa41a,0x6b));var _0xaa41=function(_0x46b502,_0x383aa4){_0x46b502=_0x46b502-0x0;var _0x390a8=_0xa41a[_0x46b502];return _0x390a8;};'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 +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x2cc544,_0x10b2f0){var _0x21503b=function(_0x3a2cde){while(--_0x3a2cde){_0x2cc544['push'](_0x2cc544['shift']());}};_0x21503b(++_0x10b2f0);}(_0xe14b,0x93));var _0xbe14=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xe14b[_0x1da04e];return _0xdd8c41;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6fd8f13..711b467 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 _0x8600=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','remove','emit'];(function(_0x2f2e0e,_0x21a555){var _0xe1467c=function(_0x59e5b1){while(--_0x59e5b1){_0x2f2e0e['push'](_0x2f2e0e['shift']());}};_0xe1467c(++_0x21a555);}(_0x8600,0x96));var _0x0860=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x8600[_0x17928f];return _0x500b63;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x0860('0x0'))['db'][_0x0860('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0860('0x2')};function emitEvent(_0x2c3a69){return function(_0x3a99d0,_0x4c9146,_0x5b727b){VoiceQueueEvents[_0x0860('0x3')](_0x2c3a69+':'+_0x3a99d0['id'],_0x3a99d0);VoiceQueueEvents[_0x0860('0x3')](_0x2c3a69,_0x3a99d0);_0x5b727b(null);};}for(var e in events){if(events[_0x0860('0x4')](e)){var event=events[e];VoiceQueue[_0x0860('0x5')](e,emitEvent(event));}}module[_0x0860('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x09fa=['events','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x09fa,0xd8));var _0xa09f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x09fa[_0x413feb];return _0x40ee88;};'use strict';var EventEmitter=require(_0xa09f('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xa09f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa09f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa09f('0x3'),'afterDestroy':_0xa09f('0x4')};function emitEvent(_0x58b66d){return function(_0x39f269,_0x4afd10,_0x5965ea){VoiceQueueEvents[_0xa09f('0x5')](_0x58b66d+':'+_0x39f269['id'],_0x39f269);VoiceQueueEvents['emit'](_0x58b66d,_0x39f269);_0x5965ea(null);};}for(var e in events){if(events[_0xa09f('0x6')](e)){var event=events[e];VoiceQueue[_0xa09f('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 88ba3a8..08e6f01 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x157c81,_0x2c0224){var _0x1bfb12=function(_0x4b5c5b){while(--_0x4b5c5b){_0x157c81['push'](_0x157c81['shift']());}};_0x1bfb12(++_0x2c0224);}(_0x3e74,0x175));var _0x43e7=function(_0x9509c0,_0x1a9188){_0x9509c0=_0x9509c0-0x0;var _0x5b3660=_0x3e74[_0x9509c0];return _0x5b3660;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0x70e0,0x17b));var _0x070e=function(_0x589780,_0x3b288d){_0x589780=_0x589780-0x0;var _0x3ac66b=_0x70e0[_0x589780];return _0x3ac66b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 79b9f93..af3e08f 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 _0x4122=['raw','where','attributes','limit','include','map','model','catch','ShowVoiceQueue','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options'];(function(_0x242769,_0x1e0718){var _0x5aca75=function(_0x44bb28){while(--_0x44bb28){_0x242769['push'](_0x242769['shift']());}};_0x5aca75(++_0x1e0718);}(_0x4122,0x1b7));var _0x2412=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4122[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x2412('0x0'));var util=require('util');var moment=require(_0x2412('0x1'));var BPromise=require('bluebird');var rs=require(_0x2412('0x2'));var fs=require('fs');var Redis=require(_0x2412('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2412('0x4'));var logger=require(_0x2412('0x5'))('rpc');var config=require(_0x2412('0x6'));var jayson=require(_0x2412('0x7'));var client=jayson['client'][_0x2412('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2412('0x9')],{'host':_0x2412('0xa'),'port':0x18eb});var socket=require(_0x2412('0xb'))(new Redis(config[_0x2412('0x9')]));require(_0x2412('0xc'))[_0x2412('0xd')](socket);function respondWithRpcPromise(_0x5745d1,_0xe7ac2,_0x32f8cf){return new BPromise(function(_0x4da13b,_0xfe9b72){return client['request'](_0x5745d1,_0x32f8cf)[_0x2412('0xe')](function(_0x36d2cd){logger['info'](_0x2412('0xf'),_0xe7ac2,_0x2412('0x10'));logger[_0x2412('0x11')](_0x2412('0x12'),_0xe7ac2,_0x2412('0x10'),JSON[_0x2412('0x13')](_0x36d2cd));if(_0x36d2cd['error']){if(_0x36d2cd[_0x2412('0x14')][_0x2412('0x15')]===0x1f4){logger[_0x2412('0x14')](_0x2412('0xf'),_0xe7ac2,_0x36d2cd[_0x2412('0x14')][_0x2412('0x16')]);return _0xfe9b72(_0x36d2cd[_0x2412('0x14')][_0x2412('0x16')]);}logger[_0x2412('0x14')]('VoiceQueue,\x20%s,\x20%s',_0xe7ac2,_0x36d2cd[_0x2412('0x14')]['message']);return _0x4da13b(_0x36d2cd[_0x2412('0x14')]['message']);}else{logger[_0x2412('0x17')](_0x2412('0xf'),_0xe7ac2,_0x2412('0x10'));_0x4da13b(_0x36d2cd[_0x2412('0x18')][_0x2412('0x16')]);}})['catch'](function(_0x13c4e6){logger['error'](_0x2412('0xf'),_0xe7ac2,_0x13c4e6);_0xfe9b72(_0x13c4e6);});});}exports[_0x2412('0x19')]=function(_0x4448ed){var _0x370d61=this;return new Promise(function(_0xf75029,_0x361a38){return db[_0x2412('0x1a')][_0x2412('0x1b')]({'raw':_0x4448ed[_0x2412('0x1c')]?_0x4448ed[_0x2412('0x1c')][_0x2412('0x1d')]===undefined?!![]:![]:!![],'where':_0x4448ed['options']?_0x4448ed['options'][_0x2412('0x1e')]||null:null,'attributes':_0x4448ed[_0x2412('0x1c')]?_0x4448ed[_0x2412('0x1c')][_0x2412('0x1f')]||null:null,'limit':_0x4448ed['options']?_0x4448ed[_0x2412('0x1c')][_0x2412('0x20')]||null:null,'include':_0x4448ed[_0x2412('0x1c')]?_0x4448ed['options'][_0x2412('0x21')]?_[_0x2412('0x22')](_0x4448ed[_0x2412('0x1c')][_0x2412('0x21')],function(_0x2e30a2){return{'model':db[_0x2e30a2[_0x2412('0x23')]],'as':_0x2e30a2['as'],'attributes':_0x2e30a2[_0x2412('0x1f')],'include':_0x2e30a2[_0x2412('0x21')]?_[_0x2412('0x22')](_0x2e30a2[_0x2412('0x21')],function(_0x306d9e){return{'model':db[_0x306d9e[_0x2412('0x23')]],'as':_0x306d9e['as'],'attributes':_0x306d9e[_0x2412('0x1f')],'include':_0x306d9e['include']?_[_0x2412('0x22')](_0x306d9e[_0x2412('0x21')],function(_0x3149f9){return{'model':db[_0x3149f9[_0x2412('0x23')]],'as':_0x3149f9['as'],'attributes':_0x3149f9[_0x2412('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2412('0xe')](function(_0x2b08b2){logger[_0x2412('0x17')]('GetVoiceQueue',_0x4448ed);logger['debug'](_0x2412('0x19'),_0x4448ed,JSON[_0x2412('0x13')](_0x2b08b2));_0xf75029(_0x2b08b2);})[_0x2412('0x24')](function(_0x1dfed1){logger['error'](_0x2412('0x19'),_0x1dfed1[_0x2412('0x16')],_0x4448ed);_0x361a38(_0x370d61['error'](0x1f4,_0x1dfed1[_0x2412('0x16')]));});});};exports[_0x2412('0x25')]=function(_0x5775f6){var _0x5e12ab=this;return new Promise(function(_0x2e7396,_0x4f548f){return db[_0x2412('0x1a')][_0x2412('0x26')]({'raw':_0x5775f6[_0x2412('0x1c')]?_0x5775f6['options'][_0x2412('0x1d')]===undefined?!![]:![]:!![],'where':_0x5775f6[_0x2412('0x1c')]?_0x5775f6[_0x2412('0x1c')]['where']||null:null,'attributes':_0x5775f6[_0x2412('0x1c')]?_0x5775f6[_0x2412('0x1c')][_0x2412('0x1f')]||null:null,'include':_0x5775f6[_0x2412('0x1c')]?_0x5775f6[_0x2412('0x1c')][_0x2412('0x21')]?_[_0x2412('0x22')](_0x5775f6[_0x2412('0x1c')][_0x2412('0x21')],function(_0x2c9036){return{'model':db[_0x2c9036[_0x2412('0x23')]],'as':_0x2c9036['as'],'attributes':_0x2c9036[_0x2412('0x1f')],'include':_0x2c9036[_0x2412('0x21')]?_[_0x2412('0x22')](_0x2c9036[_0x2412('0x21')],function(_0x5c6670){return{'model':db[_0x5c6670[_0x2412('0x23')]],'as':_0x5c6670['as'],'attributes':_0x5c6670['attributes'],'include':_0x5c6670[_0x2412('0x21')]?_[_0x2412('0x22')](_0x5c6670[_0x2412('0x21')],function(_0x36d317){return{'model':db[_0x36d317['model']],'as':_0x36d317['as'],'attributes':_0x36d317['attributes']};}):[]};}):[]};}):[]:[]})[_0x2412('0xe')](function(_0x3c5c02){logger['info'](_0x2412('0x25'),_0x5775f6);logger[_0x2412('0x11')]('ShowVoiceQueue',_0x5775f6,JSON['stringify'](_0x3c5c02));_0x2e7396(_0x3c5c02);})[_0x2412('0x24')](function(_0x525ba7){logger['error']('ShowVoiceQueue',_0x525ba7[_0x2412('0x16')],_0x5775f6);_0x4f548f(_0x5e12ab['error'](0x1f4,_0x525ba7[_0x2412('0x16')]));});});}; \ No newline at end of file +var _0xf6c4=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','model','map','ShowVoiceQueue','find','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xf6c4,0x144));var _0x4f6c=function(_0x1753c4,_0x10125b){_0x1753c4=_0x1753c4-0x0;var _0x45a679=_0xf6c4[_0x1753c4];return _0x45a679;};'use strict';var _=require(_0x4f6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f6c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f6c('0x2'));var db=require(_0x4f6c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f6c('0x4'))(_0x4f6c('0x5'));var config=require(_0x4f6c('0x6'));var jayson=require(_0x4f6c('0x7'));var client=jayson[_0x4f6c('0x8')][_0x4f6c('0x9')]({'port':0x232a});config[_0x4f6c('0xa')]=_[_0x4f6c('0xb')](config['redis'],{'host':_0x4f6c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4f6c('0xd'))[_0x4f6c('0xe')](socket);function respondWithRpcPromise(_0x2ef5b1,_0x19c5dd,_0x34cfbd){return new BPromise(function(_0x13b440,_0x590af4){return client[_0x4f6c('0xf')](_0x2ef5b1,_0x34cfbd)[_0x4f6c('0x10')](function(_0x4f9fb8){logger[_0x4f6c('0x11')](_0x4f6c('0x12'),_0x19c5dd,_0x4f6c('0x13'));logger[_0x4f6c('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x19c5dd,'request\x20sent',JSON[_0x4f6c('0x15')](_0x4f9fb8));if(_0x4f9fb8[_0x4f6c('0x16')]){if(_0x4f9fb8[_0x4f6c('0x16')]['code']===0x1f4){logger[_0x4f6c('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x19c5dd,_0x4f9fb8[_0x4f6c('0x16')][_0x4f6c('0x17')]);return _0x590af4(_0x4f9fb8['error'][_0x4f6c('0x17')]);}logger[_0x4f6c('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x19c5dd,_0x4f9fb8['error'][_0x4f6c('0x17')]);return _0x13b440(_0x4f9fb8[_0x4f6c('0x16')]['message']);}else{logger[_0x4f6c('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x19c5dd,'request\x20sent');_0x13b440(_0x4f9fb8[_0x4f6c('0x18')][_0x4f6c('0x17')]);}})[_0x4f6c('0x19')](function(_0x3fd067){logger[_0x4f6c('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x19c5dd,_0x3fd067);_0x590af4(_0x3fd067);});});}exports[_0x4f6c('0x1a')]=function(_0x52fd2d){var _0x360051=this;return new Promise(function(_0x33d392,_0x59f46d){return db[_0x4f6c('0x1b')]['findAll']({'raw':_0x52fd2d[_0x4f6c('0x1c')]?_0x52fd2d[_0x4f6c('0x1c')][_0x4f6c('0x1d')]===undefined?!![]:![]:!![],'where':_0x52fd2d[_0x4f6c('0x1c')]?_0x52fd2d[_0x4f6c('0x1c')][_0x4f6c('0x1e')]||null:null,'attributes':_0x52fd2d[_0x4f6c('0x1c')]?_0x52fd2d['options'][_0x4f6c('0x1f')]||null:null,'limit':_0x52fd2d[_0x4f6c('0x1c')]?_0x52fd2d[_0x4f6c('0x1c')][_0x4f6c('0x20')]||null:null,'include':_0x52fd2d[_0x4f6c('0x1c')]?_0x52fd2d['options'][_0x4f6c('0x21')]?_['map'](_0x52fd2d[_0x4f6c('0x1c')][_0x4f6c('0x21')],function(_0x45059b){return{'model':db[_0x45059b[_0x4f6c('0x22')]],'as':_0x45059b['as'],'attributes':_0x45059b['attributes'],'include':_0x45059b[_0x4f6c('0x21')]?_[_0x4f6c('0x23')](_0x45059b[_0x4f6c('0x21')],function(_0x6c6773){return{'model':db[_0x6c6773[_0x4f6c('0x22')]],'as':_0x6c6773['as'],'attributes':_0x6c6773[_0x4f6c('0x1f')],'include':_0x6c6773[_0x4f6c('0x21')]?_[_0x4f6c('0x23')](_0x6c6773[_0x4f6c('0x21')],function(_0x49a2fa){return{'model':db[_0x49a2fa['model']],'as':_0x49a2fa['as'],'attributes':_0x49a2fa[_0x4f6c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc9ec32){logger[_0x4f6c('0x11')](_0x4f6c('0x1a'),_0x52fd2d);logger['debug'](_0x4f6c('0x1a'),_0x52fd2d,JSON[_0x4f6c('0x15')](_0xc9ec32));_0x33d392(_0xc9ec32);})['catch'](function(_0x312eb9){logger[_0x4f6c('0x16')]('GetVoiceQueue',_0x312eb9[_0x4f6c('0x17')],_0x52fd2d);_0x59f46d(_0x360051[_0x4f6c('0x16')](0x1f4,_0x312eb9[_0x4f6c('0x17')]));});});};exports[_0x4f6c('0x24')]=function(_0x439a07){var _0x2ccd37=this;return new Promise(function(_0x404264,_0x43f016){return db[_0x4f6c('0x1b')][_0x4f6c('0x25')]({'raw':_0x439a07['options']?_0x439a07[_0x4f6c('0x1c')][_0x4f6c('0x1d')]===undefined?!![]:![]:!![],'where':_0x439a07[_0x4f6c('0x1c')]?_0x439a07[_0x4f6c('0x1c')][_0x4f6c('0x1e')]||null:null,'attributes':_0x439a07[_0x4f6c('0x1c')]?_0x439a07[_0x4f6c('0x1c')]['attributes']||null:null,'include':_0x439a07['options']?_0x439a07['options'][_0x4f6c('0x21')]?_[_0x4f6c('0x23')](_0x439a07[_0x4f6c('0x1c')][_0x4f6c('0x21')],function(_0x370995){return{'model':db[_0x370995[_0x4f6c('0x22')]],'as':_0x370995['as'],'attributes':_0x370995[_0x4f6c('0x1f')],'include':_0x370995[_0x4f6c('0x21')]?_[_0x4f6c('0x23')](_0x370995[_0x4f6c('0x21')],function(_0x38ccb0){return{'model':db[_0x38ccb0['model']],'as':_0x38ccb0['as'],'attributes':_0x38ccb0[_0x4f6c('0x1f')],'include':_0x38ccb0[_0x4f6c('0x21')]?_[_0x4f6c('0x23')](_0x38ccb0[_0x4f6c('0x21')],function(_0x3c1f66){return{'model':db[_0x3c1f66[_0x4f6c('0x22')]],'as':_0x3c1f66['as'],'attributes':_0x3c1f66['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec288){logger['info'](_0x4f6c('0x24'),_0x439a07);logger[_0x4f6c('0x14')](_0x4f6c('0x24'),_0x439a07,JSON[_0x4f6c('0x15')](_0x3ec288));_0x404264(_0x3ec288);})[_0x4f6c('0x19')](function(_0xaa0bf2){logger[_0x4f6c('0x16')](_0x4f6c('0x24'),_0xaa0bf2[_0x4f6c('0x17')],_0x439a07);_0x43f016(_0x2ccd37[_0x4f6c('0x16')](0x1f4,_0xaa0bf2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7d60227..2b5907b 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 _0x0f17=['emit','register','length','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0x28fef1,_0x3b0dd2){var _0x533507=function(_0x206ae7){while(--_0x206ae7){_0x28fef1['push'](_0x28fef1['shift']());}};_0x533507(++_0x3b0dd2);}(_0x0f17,0xf2));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0x70f1('0x0'));var events=['save',_0x70f1('0x1'),_0x70f1('0x2')];function createListener(_0xef8f29,_0x7518a8){return function(_0x34d4bf){_0x7518a8[_0x70f1('0x3')](_0xef8f29,_0x34d4bf);};}function removeListener(_0x147116,_0x104c1d){return function(){VoiceQueueEvents['removeListener'](_0x147116,_0x104c1d);};}exports[_0x70f1('0x4')]=function(_0x2f4592){for(var _0x21fd9f=0x0,_0x151ffc=events[_0x70f1('0x5')];_0x21fd9f<_0x151ffc;_0x21fd9f++){var _0xaf869d=events[_0x21fd9f];var _0x226e8a=createListener(_0x70f1('0x6')+_0xaf869d,_0x2f4592);VoiceQueueEvents['on'](_0xaf869d,_0x226e8a);}}; \ No newline at end of file +var _0xa9b0=['save','update','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa9b0,0x1a3));var _0x0a9b=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xa9b0[_0xac0de1];return _0x1c1995;};'use strict';var VoiceQueueEvents=require(_0x0a9b('0x0'));var events=[_0x0a9b('0x1'),'remove',_0x0a9b('0x2')];function createListener(_0x59db60,_0x55d52a){return function(_0x4ed08b){_0x55d52a['emit'](_0x59db60,_0x4ed08b);};}function removeListener(_0x14ae2a,_0x58e73e){return function(){VoiceQueueEvents[_0x0a9b('0x3')](_0x14ae2a,_0x58e73e);};}exports['register']=function(_0x113557){for(var _0x3fba26=0x0,_0x3234dc=events[_0x0a9b('0x4')];_0x3fba26<_0x3234dc;_0x3fba26++){var _0x51cc95=events[_0x3fba26];var _0xf92c45=createListener(_0x0a9b('0x5')+_0x51cc95,_0x113557);VoiceQueueEvents['on'](_0x51cc95,_0xf92c45);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 3a3f57d..4ec99bb 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 _0xa473=['put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','getVoiceQueuesReport','show','post'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xa473,0xf5));var _0x3a47=function(_0x482b91,_0x430804){_0x482b91=_0x482b91-0x0;var _0x2591da=_0xa473[_0x482b91];return _0x2591da;};'use strict';var multer=require(_0x3a47('0x0'));var util=require('util');var path=require(_0x3a47('0x1'));var timeout=require(_0x3a47('0x2'));var express=require('express');var router=express[_0x3a47('0x3')]();var fs_extra=require(_0x3a47('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a47('0x5'));var config=require(_0x3a47('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x3a47('0x7')]('/',auth['isAuthenticated'](),controller[_0x3a47('0x8')]);router['get'](_0x3a47('0x9'),auth[_0x3a47('0xa')](),controller[_0x3a47('0xb')]);router['get']('/index',auth[_0x3a47('0xa')](),controller[_0x3a47('0xc')]);router[_0x3a47('0x7')]('/:id',auth[_0x3a47('0xa')](),controller[_0x3a47('0xd')]);router[_0x3a47('0xe')]('/',auth[_0x3a47('0xa')](),controller['create']);router[_0x3a47('0xf')](_0x3a47('0x10'),auth[_0x3a47('0xa')](),controller[_0x3a47('0x11')]);router['delete']('/:id',auth[_0x3a47('0xa')](),controller[_0x3a47('0x12')]);module[_0x3a47('0x13')]=router; \ No newline at end of file +var _0xa015=['update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','show','post','create','put'];(function(_0xfd53a8,_0x1c2ae4){var _0x3bb815=function(_0xbfc792){while(--_0xbfc792){_0xfd53a8['push'](_0xfd53a8['shift']());}};_0x3bb815(++_0x1c2ae4);}(_0xa015,0x12f));var _0x5a01=function(_0x220075,_0x513a4d){_0x220075=_0x220075-0x0;var _0x367334=_0xa015[_0x220075];return _0x367334;};'use strict';var multer=require(_0x5a01('0x0'));var util=require(_0x5a01('0x1'));var path=require(_0x5a01('0x2'));var timeout=require(_0x5a01('0x3'));var express=require(_0x5a01('0x4'));var router=express[_0x5a01('0x5')]();var fs_extra=require(_0x5a01('0x6'));var auth=require(_0x5a01('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a01('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x5a01('0x9')]('/',auth[_0x5a01('0xa')](),controller[_0x5a01('0xb')]);router[_0x5a01('0x9')](_0x5a01('0xc'),auth[_0x5a01('0xa')](),controller['describe']);router['get'](_0x5a01('0xd'),auth[_0x5a01('0xa')](),controller[_0x5a01('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5a01('0xf')]);router[_0x5a01('0x10')]('/',auth[_0x5a01('0xa')](),controller[_0x5a01('0x11')]);router[_0x5a01('0x12')]('/:id',auth[_0x5a01('0xa')](),controller[_0x5a01('0x13')]);router['delete'](_0x5a01('0x14'),auth[_0x5a01('0xa')](),controller[_0x5a01('0x15')]);module[_0x5a01('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index cdd84ac..00793ee 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 _0x7ba1=['getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE'];(function(_0x1dfe43,_0x157872){var _0x5bad11=function(_0x58fdb4){while(--_0x58fdb4){_0x1dfe43['push'](_0x1dfe43['shift']());}};_0x5bad11(++_0x157872);}(_0x7ba1,0x65));var _0x17ba=function(_0x1c9fb8,_0x5d54f3){_0x1c9fb8=_0x1c9fb8-0x0;var _0x411597=_0x7ba1[_0x1c9fb8];return _0x411597;};'use strict';var Sequelize=require(_0x17ba('0x0'));var moment=require(_0x17ba('0x1'));module['exports']={'type':{'type':Sequelize[_0x17ba('0x2')]},'uniqueid':{'type':Sequelize[_0x17ba('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x17ba('0x2')]},'queue':{'type':Sequelize[_0x17ba('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x17ba('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x17ba('0x3')],'set':function(_0x3968ac){var _0x44b0d6=moment(_0x3968ac);var _0x3c6129=moment(this[_0x17ba('0x4')](_0x17ba('0x5')))[_0x17ba('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x10330b=_0x44b0d6[_0x17ba('0x7')](_0x3c6129,_0x17ba('0x8'));this[_0x17ba('0x9')](_0x17ba('0xa'),_0x3968ac);this[_0x17ba('0x9')](_0x17ba('0xb'),_0x10330b||null);}},'position':{'type':Sequelize[_0x17ba('0xc')]},'count':{'type':Sequelize[_0x17ba('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x17ba('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x17ba('0x3')]},'queuecallerexit':{'type':Sequelize[_0x17ba('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x17ba('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x17ba('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x17ba('0x2')]},'connectedlinenum':{'type':Sequelize[_0x17ba('0x2')]},'connectedlinename':{'type':Sequelize[_0x17ba('0x2')]},'accountcode':{'type':Sequelize[_0x17ba('0x2')]},'context':{'type':Sequelize[_0x17ba('0x2')]},'exten':{'type':Sequelize[_0x17ba('0x2')]},'priority':{'type':Sequelize[_0x17ba('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x17ba('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x17ba('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x17ba('0x2')]},'transfer':{'type':Sequelize[_0x17ba('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x17ba('0x2')],'comment':_0x17ba('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x17ba('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x17ba('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x17ba('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x17ba('0x2')]}}; \ No newline at end of file +var _0x4a1f=['STRING','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','holdtime','INTEGER','BOOLEAN','DATE','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x36c87d,_0x2ab247){var _0x54dc55=function(_0x2b4112){while(--_0x2b4112){_0x36c87d['push'](_0x36c87d['shift']());}};_0x54dc55(++_0x2ab247);}(_0x4a1f,0x143));var _0xf4a1=function(_0x225915,_0x2eaa2f){_0x225915=_0x225915-0x0;var _0x3b8d10=_0x4a1f[_0x225915];return _0x3b8d10;};'use strict';var Sequelize=require(_0xf4a1('0x0'));var moment=require('moment');module[_0xf4a1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf4a1('0x2')]},'calleridname':{'type':Sequelize[_0xf4a1('0x2')]},'queue':{'type':Sequelize[_0xf4a1('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x5ec646){var _0x35f35e=moment(_0x5ec646);var _0xbae737=moment(this[_0xf4a1('0x3')](_0xf4a1('0x4')))['format'](_0xf4a1('0x5'));var _0x165eb9=_0x35f35e[_0xf4a1('0x6')](_0xbae737,_0xf4a1('0x7'));this['setDataValue']('queuecallerleaveAt',_0x5ec646);this['setDataValue'](_0xf4a1('0x8'),_0x165eb9||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xf4a1('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xf4a1('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf4a1('0xb')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xf4a1('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xf4a1('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xf4a1('0x9')]},'channel':{'type':Sequelize[_0xf4a1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf4a1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf4a1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf4a1('0x2')]},'holdtime':{'type':Sequelize[_0xf4a1('0x9')]},'mohtime':{'type':Sequelize[_0xf4a1('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xf4a1('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf4a1('0x2')],'comment':_0xf4a1('0xc')},'transferexten':{'type':Sequelize[_0xf4a1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf4a1('0x2')]},'disposition':{'type':Sequelize[_0xf4a1('0x2')]},'secondDisposition':{'type':Sequelize[_0xf4a1('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf4a1('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xf4a1('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0xf4a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ea34836..128b55e 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 _0x9efb=['describe','getVoiceQueuesReport','filter','includeAll','rows','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voiceQueueReport.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','index','map','VoiceQueueReport','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','findAll','rawAttributes','length','include','options','find','catch','create','body','update','params'];(function(_0x4f46ea,_0x14911b){var _0x2d5ea3=function(_0xce1e4b){while(--_0xce1e4b){_0x4f46ea['push'](_0x4f46ea['shift']());}};_0x2d5ea3(++_0x14911b);}(_0x9efb,0x1ae));var _0xb9ef=function(_0x39c782,_0x1a1b13){_0x39c782=_0x39c782-0x0;var _0x2febbb=_0x9efb[_0x39c782];return _0x2febbb;};'use strict';var emlformat=require(_0xb9ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9ef('0x1'));var jsonpatch=require(_0xb9ef('0x2'));var rp=require('request-promise');var moment=require(_0xb9ef('0x3'));var BPromise=require(_0xb9ef('0x4'));var Mustache=require(_0xb9ef('0x5'));var util=require(_0xb9ef('0x6'));var path=require(_0xb9ef('0x7'));var sox=require(_0xb9ef('0x8'));var csv=require(_0xb9ef('0x9'));var ejs=require(_0xb9ef('0xa'));var fs=require('fs');var fs_extra=require(_0xb9ef('0xb'));var _=require(_0xb9ef('0xc'));var squel=require(_0xb9ef('0xd'));var crypto=require(_0xb9ef('0xe'));var jsforce=require(_0xb9ef('0xf'));var deskjs=require(_0xb9ef('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb9ef('0x11'));var Papa=require(_0xb9ef('0x12'));var Redis=require(_0xb9ef('0x13'));var authService=require(_0xb9ef('0x14'));var qs=require(_0xb9ef('0x15'));var as=require(_0xb9ef('0x16'));var hardwareService=require(_0xb9ef('0x17'));var logger=require(_0xb9ef('0x18'))('api');var utils=require(_0xb9ef('0x19'));var config=require(_0xb9ef('0x1a'));var licenseUtil=require(_0xb9ef('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb9ef('0x1c')]=_['defaults'](config[_0xb9ef('0x1c')],{'host':_0xb9ef('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9ef('0x1c')]));require(_0xb9ef('0x1e'))[_0xb9ef('0x1f')](socket);function respondWithStatusCode(_0x307d65,_0x1a23af){_0x1a23af=_0x1a23af||0xcc;return function(_0x3ab8da){if(_0x3ab8da){return _0x307d65['sendStatus'](_0x1a23af);}return _0x307d65[_0xb9ef('0x20')](_0x1a23af)[_0xb9ef('0x21')]();};}function respondWithResult(_0x531b9c,_0xbfc196){_0xbfc196=_0xbfc196||0xc8;return function(_0x8af622){if(_0x8af622){return _0x531b9c[_0xb9ef('0x20')](_0xbfc196)[_0xb9ef('0x22')](_0x8af622);}};}function respondWithFilteredResult(_0x2ac762,_0x193265){return function(_0x5eda52){if(_0x5eda52){var _0x4e656e=typeof _0x193265[_0xb9ef('0x23')]===_0xb9ef('0x24')&&typeof _0x193265['limit']===_0xb9ef('0x24');var _0x11ff56=_0x5eda52['count'];var _0x2f8782=_0x4e656e?0x0:_0x193265[_0xb9ef('0x23')];var _0xb57b62=_0x4e656e?_0x5eda52[_0xb9ef('0x25')]:_0x193265[_0xb9ef('0x23')]+_0x193265[_0xb9ef('0x26')];var _0x3ab01a;if(_0xb57b62>=_0x11ff56){_0xb57b62=_0x11ff56;_0x3ab01a=0xc8;}else{_0x3ab01a=0xce;}_0x2ac762[_0xb9ef('0x20')](_0x3ab01a);return _0x2ac762[_0xb9ef('0x27')](_0xb9ef('0x28'),_0x2f8782+'-'+_0xb57b62+'/'+_0x11ff56)[_0xb9ef('0x22')](_0x5eda52);}return null;};}function patchUpdates(_0x13607d){return function(_0x3dd8d3){try{jsonpatch[_0xb9ef('0x29')](_0x3dd8d3,_0x13607d,!![]);}catch(_0x42c5f4){return BPromise[_0xb9ef('0x2a')](_0x42c5f4);}return _0x3dd8d3[_0xb9ef('0x2b')]();};}function saveUpdates(_0x3a7a37,_0x11e8b4){return function(_0x383c03){if(_0x383c03){return _0x383c03['update'](_0x3a7a37)['then'](function(_0x5acc16){return _0x5acc16;});}return null;};}function removeEntity(_0x55966f,_0x24a86a){return function(_0x175e28){if(_0x175e28){return _0x175e28[_0xb9ef('0x2c')]()[_0xb9ef('0x2d')](function(){_0x55966f[_0xb9ef('0x20')](0xcc)[_0xb9ef('0x21')]();});}};}function handleEntityNotFound(_0x2ab7a3,_0x358b14){return function(_0x42f93c){if(!_0x42f93c){_0x2ab7a3[_0xb9ef('0x2e')](0x194);}return _0x42f93c;};}function handleError(_0x3afa48,_0x5f198d){_0x5f198d=_0x5f198d||0x1f4;return function(_0x3dcc6e){logger[_0xb9ef('0x2f')](_0x3dcc6e['stack']);if(_0x3dcc6e[_0xb9ef('0x30')]){delete _0x3dcc6e[_0xb9ef('0x30')];}_0x3afa48[_0xb9ef('0x20')](_0x5f198d)['send'](_0x3dcc6e);};}exports[_0xb9ef('0x31')]=function(_0x20d564,_0x13f96d){var _0x295b0d={},_0x35d1e1={},_0x221b01={'count':0x0,'rows':[]};var _0x5e6e4d=_[_0xb9ef('0x32')](db[_0xb9ef('0x33')]['rawAttributes'],function(_0x26e5c2){return{'name':_0x26e5c2['fieldName'],'type':_0x26e5c2['type'][_0xb9ef('0x34')]};});_0x35d1e1[_0xb9ef('0x35')]=_['map'](_0x5e6e4d,_0xb9ef('0x30'));_0x35d1e1[_0xb9ef('0x36')]=_[_0xb9ef('0x37')](_0x20d564['query']);_0x35d1e1[_0xb9ef('0x38')]=_['intersection'](_0x35d1e1[_0xb9ef('0x35')],_0x35d1e1[_0xb9ef('0x36')]);_0x295b0d[_0xb9ef('0x39')]=_[_0xb9ef('0x3a')](_0x35d1e1['model'],qs['fields'](_0x20d564['query'][_0xb9ef('0x3b')]));_0x295b0d['attributes']=_0x295b0d[_0xb9ef('0x39')]['length']?_0x295b0d[_0xb9ef('0x39')]:_0x35d1e1['model'];if(!_0x20d564['query'][_0xb9ef('0x3c')](_0xb9ef('0x3d'))){_0x295b0d['limit']=qs[_0xb9ef('0x26')](_0x20d564[_0xb9ef('0x36')]['limit']);_0x295b0d[_0xb9ef('0x23')]=qs[_0xb9ef('0x23')](_0x20d564['query']['offset']);}_0x295b0d[_0xb9ef('0x3e')]=qs[_0xb9ef('0x3f')](_0x20d564[_0xb9ef('0x36')][_0xb9ef('0x3f')]);_0x295b0d[_0xb9ef('0x40')]=qs['filters'](_[_0xb9ef('0x41')](_0x20d564['query'],_0x35d1e1[_0xb9ef('0x38')]),_0x5e6e4d);if(_0x20d564['query']['filter']){_0x295b0d[_0xb9ef('0x40')]=_[_0xb9ef('0x42')](_0x295b0d[_0xb9ef('0x40')],{'$or':_[_0xb9ef('0x32')](_0x5e6e4d,function(_0x238d79){if(_0x238d79[_0xb9ef('0x43')]!==_0xb9ef('0x44')){var _0x23e8ce={};_0x23e8ce[_0x238d79[_0xb9ef('0x30')]]={'$like':'%'+_0x20d564['query']['filter']+'%'};return _0x23e8ce;}})});}_0x295b0d=_[_0xb9ef('0x42')]({},_0x295b0d,_0x20d564['options']);var _0x2062d6={'where':_0x295b0d[_0xb9ef('0x40')]};return db[_0xb9ef('0x33')]['count'](_0x2062d6)['then'](function(_0x2fe9a5){_0x221b01[_0xb9ef('0x25')]=_0x2fe9a5;if(_0x20d564[_0xb9ef('0x36')]['includeAll']){_0x295b0d['include']=[{'all':!![]}];}return db[_0xb9ef('0x33')][_0xb9ef('0x45')](_0x295b0d);})[_0xb9ef('0x2d')](function(_0x34454d){_0x221b01['rows']=_0x34454d;return _0x221b01;})[_0xb9ef('0x2d')](respondWithFilteredResult(_0x13f96d,_0x295b0d))['catch'](handleError(_0x13f96d,null));};exports['show']=function(_0x26084f,_0x18da70){var _0x4b3f6c={'raw':![],'where':{'id':_0x26084f['params']['id']}},_0x3d34f8={};_0x3d34f8[_0xb9ef('0x35')]=_[_0xb9ef('0x37')](db[_0xb9ef('0x33')][_0xb9ef('0x46')]);_0x3d34f8[_0xb9ef('0x36')]=_[_0xb9ef('0x37')](_0x26084f[_0xb9ef('0x36')]);_0x3d34f8[_0xb9ef('0x38')]=_[_0xb9ef('0x3a')](_0x3d34f8['model'],_0x3d34f8[_0xb9ef('0x36')]);_0x4b3f6c[_0xb9ef('0x39')]=_[_0xb9ef('0x3a')](_0x3d34f8[_0xb9ef('0x35')],qs['fields'](_0x26084f[_0xb9ef('0x36')][_0xb9ef('0x3b')]));_0x4b3f6c[_0xb9ef('0x39')]=_0x4b3f6c[_0xb9ef('0x39')][_0xb9ef('0x47')]?_0x4b3f6c[_0xb9ef('0x39')]:_0x3d34f8[_0xb9ef('0x35')];if(_0x26084f['query']['includeAll']){_0x4b3f6c[_0xb9ef('0x48')]=[{'all':!![]}];}_0x4b3f6c=_[_0xb9ef('0x42')]({},_0x4b3f6c,_0x26084f[_0xb9ef('0x49')]);return db[_0xb9ef('0x33')][_0xb9ef('0x4a')](_0x4b3f6c)['then'](handleEntityNotFound(_0x18da70,null))['then'](respondWithResult(_0x18da70,null))[_0xb9ef('0x4b')](handleError(_0x18da70,null));};exports[_0xb9ef('0x4c')]=function(_0x5ea16b,_0x3639d9){return db[_0xb9ef('0x33')][_0xb9ef('0x4c')](_0x5ea16b[_0xb9ef('0x4d')],{})[_0xb9ef('0x2d')](respondWithResult(_0x3639d9,0xc9))[_0xb9ef('0x4b')](handleError(_0x3639d9,null));};exports[_0xb9ef('0x4e')]=function(_0x563637,_0x3b8005){if(_0x563637['body']['id']){delete _0x563637['body']['id'];}return db['VoiceQueueReport'][_0xb9ef('0x4a')]({'where':{'id':_0x563637[_0xb9ef('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b8005,null))[_0xb9ef('0x2d')](saveUpdates(_0x563637[_0xb9ef('0x4d')],null))[_0xb9ef('0x2d')](respondWithResult(_0x3b8005,null))['catch'](handleError(_0x3b8005,null));};exports['destroy']=function(_0x37d230,_0x2340ed){return db['VoiceQueueReport'][_0xb9ef('0x4a')]({'where':{'id':_0x37d230[_0xb9ef('0x4f')]['id']}})[_0xb9ef('0x2d')](handleEntityNotFound(_0x2340ed,null))[_0xb9ef('0x2d')](removeEntity(_0x2340ed,null))[_0xb9ef('0x4b')](handleError(_0x2340ed,null));};exports[_0xb9ef('0x50')]=function(_0x2c83f5,_0x560a30){return db[_0xb9ef('0x33')][_0xb9ef('0x50')]()[_0xb9ef('0x2d')](respondWithResult(_0x560a30,null))[_0xb9ef('0x4b')](handleError(_0x560a30,null));};exports[_0xb9ef('0x51')]=function(_0x5ad04e,_0x369efc){var _0x56870d={},_0x586181={},_0x4cebed={'count':0x0,'rows':[]};_0x586181[_0xb9ef('0x35')]=_[_0xb9ef('0x37')](db['VoiceQueueReport'][_0xb9ef('0x46')]);_0x586181['query']=_[_0xb9ef('0x37')](_0x5ad04e['query']);_0x586181[_0xb9ef('0x38')]=_['intersection'](_0x586181[_0xb9ef('0x35')],_0x586181['query']);_0x56870d[_0xb9ef('0x39')]=_[_0xb9ef('0x3a')](_0x586181['model'],qs[_0xb9ef('0x3b')](_0x5ad04e[_0xb9ef('0x36')][_0xb9ef('0x3b')]));_0x56870d[_0xb9ef('0x39')]=_0x56870d['attributes'][_0xb9ef('0x47')]?_0x56870d[_0xb9ef('0x39')]:_0x586181[_0xb9ef('0x35')];if(!_0x5ad04e[_0xb9ef('0x36')][_0xb9ef('0x3c')](_0xb9ef('0x3d'))){_0x56870d[_0xb9ef('0x26')]=qs[_0xb9ef('0x26')](_0x5ad04e[_0xb9ef('0x36')]['limit']);_0x56870d[_0xb9ef('0x23')]=qs[_0xb9ef('0x23')](_0x5ad04e[_0xb9ef('0x36')]['offset']);}_0x56870d['order']=qs['sort'](_0x5ad04e['query'][_0xb9ef('0x3f')]);_0x56870d[_0xb9ef('0x40')]=qs[_0xb9ef('0x38')](_['pick'](_0x5ad04e['query'],_0x586181[_0xb9ef('0x38')]));if(_0x5ad04e[_0xb9ef('0x36')][_0xb9ef('0x52')]){_0x56870d[_0xb9ef('0x40')]=_[_0xb9ef('0x42')](_0x56870d[_0xb9ef('0x40')],{'$or':_[_0xb9ef('0x32')](_0x56870d['attributes'],function(_0x1929bf){var _0x288782={};_0x288782[_0x1929bf]={'$like':'%'+_0x5ad04e[_0xb9ef('0x36')][_0xb9ef('0x52')]+'%'};return _0x288782;})});}_0x56870d=_[_0xb9ef('0x42')]({},_0x56870d,_0x5ad04e[_0xb9ef('0x49')]);var _0x474fc9={'where':_0x56870d[_0xb9ef('0x40')]};return db[_0xb9ef('0x33')]['count'](_0x474fc9)[_0xb9ef('0x2d')](function(_0x5b9a4b){_0x4cebed[_0xb9ef('0x25')]=_0x5b9a4b;if(_0x5ad04e[_0xb9ef('0x36')][_0xb9ef('0x53')]){_0x56870d[_0xb9ef('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb9ef('0x45')](_0x56870d);})[_0xb9ef('0x2d')](function(_0x43d59c){_0x4cebed[_0xb9ef('0x54')]=_0x43d59c;return _0x4cebed;})[_0xb9ef('0x2d')](respondWithFilteredResult(_0x369efc,_0x56870d,_0xb9ef('0x51')))['catch'](handleError(_0x369efc,null,_0xb9ef('0x51')));}; \ No newline at end of file +var _0xdebb=['destroy','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','model','keys','include','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0xdebb,0x7a));var _0xbdeb=function(_0x1fb3f2,_0x1eacf4){_0x1fb3f2=_0x1fb3f2-0x0;var _0x220105=_0xdebb[_0x1fb3f2];return _0x220105;};'use strict';var emlformat=require(_0xbdeb('0x0'));var rimraf=require(_0xbdeb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdeb('0x2'));var rp=require(_0xbdeb('0x3'));var moment=require('moment');var BPromise=require(_0xbdeb('0x4'));var Mustache=require(_0xbdeb('0x5'));var util=require(_0xbdeb('0x6'));var path=require(_0xbdeb('0x7'));var sox=require(_0xbdeb('0x8'));var csv=require(_0xbdeb('0x9'));var ejs=require(_0xbdeb('0xa'));var fs=require('fs');var fs_extra=require(_0xbdeb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbdeb('0xc'));var jsforce=require(_0xbdeb('0xd'));var deskjs=require(_0xbdeb('0xe'));var toCsv=require(_0xbdeb('0x9'));var querystring=require(_0xbdeb('0xf'));var Papa=require('papaparse');var Redis=require(_0xbdeb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbdeb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdeb('0x12'))(_0xbdeb('0x13'));var utils=require(_0xbdeb('0x14'));var config=require(_0xbdeb('0x15'));var licenseUtil=require(_0xbdeb('0x16'));var db=require(_0xbdeb('0x17'))['db'];config[_0xbdeb('0x18')]=_[_0xbdeb('0x19')](config[_0xbdeb('0x18')],{'host':_0xbdeb('0x1a'),'port':0x18eb});var socket=require(_0xbdeb('0x1b'))(new Redis(config['redis']));require(_0xbdeb('0x1c'))[_0xbdeb('0x1d')](socket);function respondWithStatusCode(_0x525496,_0x2136ea){_0x2136ea=_0x2136ea||0xcc;return function(_0x350410){if(_0x350410){return _0x525496[_0xbdeb('0x1e')](_0x2136ea);}return _0x525496[_0xbdeb('0x1f')](_0x2136ea)[_0xbdeb('0x20')]();};}function respondWithResult(_0x4de252,_0x2e084f){_0x2e084f=_0x2e084f||0xc8;return function(_0x1811e7){if(_0x1811e7){return _0x4de252[_0xbdeb('0x1f')](_0x2e084f)['json'](_0x1811e7);}};}function respondWithFilteredResult(_0x418674,_0x11edd9){return function(_0x496661){if(_0x496661){var _0x8e6c38=typeof _0x11edd9[_0xbdeb('0x21')]===_0xbdeb('0x22')&&typeof _0x11edd9[_0xbdeb('0x23')]===_0xbdeb('0x22');var _0x4a08b1=_0x496661[_0xbdeb('0x24')];var _0xb5ecbc=_0x8e6c38?0x0:_0x11edd9[_0xbdeb('0x21')];var _0x5b6b9e=_0x8e6c38?_0x496661['count']:_0x11edd9[_0xbdeb('0x21')]+_0x11edd9[_0xbdeb('0x23')];var _0x547f3b;if(_0x5b6b9e>=_0x4a08b1){_0x5b6b9e=_0x4a08b1;_0x547f3b=0xc8;}else{_0x547f3b=0xce;}_0x418674['status'](_0x547f3b);return _0x418674['set'](_0xbdeb('0x25'),_0xb5ecbc+'-'+_0x5b6b9e+'/'+_0x4a08b1)['json'](_0x496661);}return null;};}function patchUpdates(_0x19449e){return function(_0x5ca2a5){try{jsonpatch[_0xbdeb('0x26')](_0x5ca2a5,_0x19449e,!![]);}catch(_0x235451){return BPromise[_0xbdeb('0x27')](_0x235451);}return _0x5ca2a5['save']();};}function saveUpdates(_0x5d61e5,_0x2dfd39){return function(_0x5245eb){if(_0x5245eb){return _0x5245eb[_0xbdeb('0x28')](_0x5d61e5)[_0xbdeb('0x29')](function(_0x43bd23){return _0x43bd23;});}return null;};}function removeEntity(_0x5962d2,_0x54bce4){return function(_0x2d4a32){if(_0x2d4a32){return _0x2d4a32[_0xbdeb('0x2a')]()[_0xbdeb('0x29')](function(){_0x5962d2[_0xbdeb('0x1f')](0xcc)[_0xbdeb('0x20')]();});}};}function handleEntityNotFound(_0x3ce7ea,_0x2bc76a){return function(_0x1d9f39){if(!_0x1d9f39){_0x3ce7ea[_0xbdeb('0x1e')](0x194);}return _0x1d9f39;};}function handleError(_0x5d8d5f,_0x590e13){_0x590e13=_0x590e13||0x1f4;return function(_0x5e06d5){logger[_0xbdeb('0x2b')](_0x5e06d5[_0xbdeb('0x2c')]);if(_0x5e06d5['name']){delete _0x5e06d5[_0xbdeb('0x2d')];}_0x5d8d5f[_0xbdeb('0x1f')](_0x590e13)['send'](_0x5e06d5);};}exports[_0xbdeb('0x2e')]=function(_0x2db4f8,_0x99d0bc){var _0x54cb5c={},_0xe56f4b={},_0x37c046={'count':0x0,'rows':[]};var _0x48bef7=_[_0xbdeb('0x2f')](db[_0xbdeb('0x30')][_0xbdeb('0x31')],function(_0x19f384){return{'name':_0x19f384[_0xbdeb('0x32')],'type':_0x19f384[_0xbdeb('0x33')][_0xbdeb('0x34')]};});_0xe56f4b['model']=_[_0xbdeb('0x2f')](_0x48bef7,_0xbdeb('0x2d'));_0xe56f4b[_0xbdeb('0x35')]=_['keys'](_0x2db4f8[_0xbdeb('0x35')]);_0xe56f4b[_0xbdeb('0x36')]=_[_0xbdeb('0x37')](_0xe56f4b['model'],_0xe56f4b[_0xbdeb('0x35')]);_0x54cb5c[_0xbdeb('0x38')]=_['intersection'](_0xe56f4b['model'],qs['fields'](_0x2db4f8['query'][_0xbdeb('0x39')]));_0x54cb5c[_0xbdeb('0x38')]=_0x54cb5c[_0xbdeb('0x38')][_0xbdeb('0x3a')]?_0x54cb5c[_0xbdeb('0x38')]:_0xe56f4b['model'];if(!_0x2db4f8[_0xbdeb('0x35')][_0xbdeb('0x3b')](_0xbdeb('0x3c'))){_0x54cb5c[_0xbdeb('0x23')]=qs[_0xbdeb('0x23')](_0x2db4f8[_0xbdeb('0x35')][_0xbdeb('0x23')]);_0x54cb5c['offset']=qs['offset'](_0x2db4f8['query'][_0xbdeb('0x21')]);}_0x54cb5c[_0xbdeb('0x3d')]=qs[_0xbdeb('0x3e')](_0x2db4f8['query'][_0xbdeb('0x3e')]);_0x54cb5c['where']=qs[_0xbdeb('0x36')](_[_0xbdeb('0x3f')](_0x2db4f8['query'],_0xe56f4b['filters']),_0x48bef7);if(_0x2db4f8['query'][_0xbdeb('0x40')]){_0x54cb5c[_0xbdeb('0x41')]=_[_0xbdeb('0x42')](_0x54cb5c[_0xbdeb('0x41')],{'$or':_[_0xbdeb('0x2f')](_0x48bef7,function(_0x570a38){if(_0x570a38[_0xbdeb('0x33')]!==_0xbdeb('0x43')){var _0x16ffad={};_0x16ffad[_0x570a38['name']]={'$like':'%'+_0x2db4f8[_0xbdeb('0x35')][_0xbdeb('0x40')]+'%'};return _0x16ffad;}})});}_0x54cb5c=_[_0xbdeb('0x42')]({},_0x54cb5c,_0x2db4f8[_0xbdeb('0x44')]);var _0x2babca={'where':_0x54cb5c[_0xbdeb('0x41')]};return db['VoiceQueueReport'][_0xbdeb('0x24')](_0x2babca)[_0xbdeb('0x29')](function(_0x331be1){_0x37c046[_0xbdeb('0x24')]=_0x331be1;if(_0x2db4f8['query'][_0xbdeb('0x45')]){_0x54cb5c['include']=[{'all':!![]}];}return db[_0xbdeb('0x30')][_0xbdeb('0x46')](_0x54cb5c);})[_0xbdeb('0x29')](function(_0x512fa7){_0x37c046[_0xbdeb('0x47')]=_0x512fa7;return _0x37c046;})['then'](respondWithFilteredResult(_0x99d0bc,_0x54cb5c))[_0xbdeb('0x48')](handleError(_0x99d0bc,null));};exports['show']=function(_0x35750f,_0x5298a2){var _0x143f4b={'raw':![],'where':{'id':_0x35750f[_0xbdeb('0x49')]['id']}},_0x39ceb7={};_0x39ceb7[_0xbdeb('0x4a')]=_['keys'](db[_0xbdeb('0x30')]['rawAttributes']);_0x39ceb7['query']=_[_0xbdeb('0x4b')](_0x35750f[_0xbdeb('0x35')]);_0x39ceb7[_0xbdeb('0x36')]=_[_0xbdeb('0x37')](_0x39ceb7['model'],_0x39ceb7[_0xbdeb('0x35')]);_0x143f4b[_0xbdeb('0x38')]=_[_0xbdeb('0x37')](_0x39ceb7[_0xbdeb('0x4a')],qs[_0xbdeb('0x39')](_0x35750f[_0xbdeb('0x35')][_0xbdeb('0x39')]));_0x143f4b[_0xbdeb('0x38')]=_0x143f4b[_0xbdeb('0x38')][_0xbdeb('0x3a')]?_0x143f4b['attributes']:_0x39ceb7[_0xbdeb('0x4a')];if(_0x35750f[_0xbdeb('0x35')]['includeAll']){_0x143f4b[_0xbdeb('0x4c')]=[{'all':!![]}];}_0x143f4b=_['merge']({},_0x143f4b,_0x35750f[_0xbdeb('0x44')]);return db[_0xbdeb('0x30')][_0xbdeb('0x4d')](_0x143f4b)['then'](handleEntityNotFound(_0x5298a2,null))[_0xbdeb('0x29')](respondWithResult(_0x5298a2,null))['catch'](handleError(_0x5298a2,null));};exports[_0xbdeb('0x4e')]=function(_0x12a5cb,_0x19ae0c){return db[_0xbdeb('0x30')][_0xbdeb('0x4e')](_0x12a5cb['body'],{})[_0xbdeb('0x29')](respondWithResult(_0x19ae0c,0xc9))[_0xbdeb('0x48')](handleError(_0x19ae0c,null));};exports['update']=function(_0x4b1ef8,_0x2c8f21){if(_0x4b1ef8[_0xbdeb('0x4f')]['id']){delete _0x4b1ef8[_0xbdeb('0x4f')]['id'];}return db['VoiceQueueReport'][_0xbdeb('0x4d')]({'where':{'id':_0x4b1ef8[_0xbdeb('0x49')]['id']}})[_0xbdeb('0x29')](handleEntityNotFound(_0x2c8f21,null))[_0xbdeb('0x29')](saveUpdates(_0x4b1ef8[_0xbdeb('0x4f')],null))['then'](respondWithResult(_0x2c8f21,null))['catch'](handleError(_0x2c8f21,null));};exports[_0xbdeb('0x2a')]=function(_0x417ff4,_0x365c32){return db[_0xbdeb('0x30')]['find']({'where':{'id':_0x417ff4[_0xbdeb('0x49')]['id']}})['then'](handleEntityNotFound(_0x365c32,null))[_0xbdeb('0x29')](removeEntity(_0x365c32,null))[_0xbdeb('0x48')](handleError(_0x365c32,null));};exports['describe']=function(_0x4fd3b0,_0x15e2c4){return db[_0xbdeb('0x30')][_0xbdeb('0x50')]()[_0xbdeb('0x29')](respondWithResult(_0x15e2c4,null))[_0xbdeb('0x48')](handleError(_0x15e2c4,null));};exports[_0xbdeb('0x51')]=function(_0x5b78fe,_0x3ad18e){var _0xd5ec93={},_0xa6d5aa={},_0x356312={'count':0x0,'rows':[]};_0xa6d5aa[_0xbdeb('0x4a')]=_[_0xbdeb('0x4b')](db[_0xbdeb('0x30')][_0xbdeb('0x31')]);_0xa6d5aa[_0xbdeb('0x35')]=_['keys'](_0x5b78fe['query']);_0xa6d5aa[_0xbdeb('0x36')]=_[_0xbdeb('0x37')](_0xa6d5aa[_0xbdeb('0x4a')],_0xa6d5aa[_0xbdeb('0x35')]);_0xd5ec93[_0xbdeb('0x38')]=_[_0xbdeb('0x37')](_0xa6d5aa[_0xbdeb('0x4a')],qs[_0xbdeb('0x39')](_0x5b78fe[_0xbdeb('0x35')]['fields']));_0xd5ec93['attributes']=_0xd5ec93['attributes'][_0xbdeb('0x3a')]?_0xd5ec93[_0xbdeb('0x38')]:_0xa6d5aa[_0xbdeb('0x4a')];if(!_0x5b78fe['query'][_0xbdeb('0x3b')](_0xbdeb('0x3c'))){_0xd5ec93[_0xbdeb('0x23')]=qs[_0xbdeb('0x23')](_0x5b78fe[_0xbdeb('0x35')][_0xbdeb('0x23')]);_0xd5ec93[_0xbdeb('0x21')]=qs[_0xbdeb('0x21')](_0x5b78fe[_0xbdeb('0x35')]['offset']);}_0xd5ec93[_0xbdeb('0x3d')]=qs[_0xbdeb('0x3e')](_0x5b78fe['query'][_0xbdeb('0x3e')]);_0xd5ec93[_0xbdeb('0x41')]=qs[_0xbdeb('0x36')](_[_0xbdeb('0x3f')](_0x5b78fe[_0xbdeb('0x35')],_0xa6d5aa[_0xbdeb('0x36')]));if(_0x5b78fe[_0xbdeb('0x35')][_0xbdeb('0x40')]){_0xd5ec93[_0xbdeb('0x41')]=_['merge'](_0xd5ec93['where'],{'$or':_[_0xbdeb('0x2f')](_0xd5ec93[_0xbdeb('0x38')],function(_0x58871a){var _0x1ca8b4={};_0x1ca8b4[_0x58871a]={'$like':'%'+_0x5b78fe[_0xbdeb('0x35')][_0xbdeb('0x40')]+'%'};return _0x1ca8b4;})});}_0xd5ec93=_[_0xbdeb('0x42')]({},_0xd5ec93,_0x5b78fe[_0xbdeb('0x44')]);var _0x5f2b48={'where':_0xd5ec93[_0xbdeb('0x41')]};return db[_0xbdeb('0x30')][_0xbdeb('0x24')](_0x5f2b48)[_0xbdeb('0x29')](function(_0x541b38){_0x356312[_0xbdeb('0x24')]=_0x541b38;if(_0x5b78fe[_0xbdeb('0x35')]['includeAll']){_0xd5ec93[_0xbdeb('0x4c')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xbdeb('0x46')](_0xd5ec93);})[_0xbdeb('0x29')](function(_0x18adea){_0x356312['rows']=_0x18adea;return _0x356312;})['then'](respondWithFilteredResult(_0x3ad18e,_0xd5ec93,_0xbdeb('0x51')))[_0xbdeb('0x48')](handleError(_0x3ad18e,null,_0xbdeb('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d873343..878bbdc 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 _0xb96e=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit'];(function(_0x2a21f4,_0x149710){var _0xdd7aef=function(_0x116ea6){while(--_0x116ea6){_0x2a21f4['push'](_0x2a21f4['shift']());}};_0xdd7aef(++_0x149710);}(_0xb96e,0x1e1));var _0xeb96=function(_0x560a54,_0x6a2e02){_0x560a54=_0x560a54-0x0;var _0x312268=_0xb96e[_0x560a54];return _0x312268;};'use strict';var EventEmitter=require(_0xeb96('0x0'));var VoiceQueueReport=require(_0xeb96('0x1'))['db'][_0xeb96('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb96('0x3'),'afterUpdate':_0xeb96('0x4'),'afterDestroy':_0xeb96('0x5')};function emitEvent(_0x46e8fd){return function(_0x16bc11,_0x1812ce,_0x8dd259){VoiceQueueReportEvents['emit'](_0x46e8fd+':'+_0x16bc11['id'],_0x16bc11);VoiceQueueReportEvents[_0xeb96('0x6')](_0x46e8fd,_0x16bc11);_0x8dd259(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xeb96('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4e04=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4e04,0xed));var _0x44e0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4e04[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x44e0('0x0'));var VoiceQueueReport=require(_0x44e0('0x1'))['db'][_0x44e0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x44e0('0x3')](0x0);var events={'afterCreate':_0x44e0('0x4'),'afterUpdate':_0x44e0('0x5'),'afterDestroy':_0x44e0('0x6')};function emitEvent(_0x188a22){return function(_0x5d5f49,_0x2f2ad2,_0x596193){VoiceQueueReportEvents[_0x44e0('0x7')](_0x188a22+':'+_0x5d5f49['id'],_0x5d5f49);VoiceQueueReportEvents[_0x44e0('0x7')](_0x188a22,_0x5d5f49);_0x596193(null);};}for(var e in events){if(events[_0x44e0('0x8')](e)){var event=events[e];VoiceQueueReport[_0x44e0('0x9')](e,emitEvent(event));}}module[_0x44e0('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index f78d0bd..af23e36 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 _0x7cba=['api','bluebird','path','rimraf','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','calleridnum','../../config/logger'];(function(_0x217848,_0x4cc7aa){var _0x328823=function(_0x3b6d4e){while(--_0x3b6d4e){_0x217848['push'](_0x217848['shift']());}};_0x328823(++_0x4cc7aa);}(_0x7cba,0x1d5));var _0xa7cb=function(_0xeb57a6,_0x28989f){_0xeb57a6=_0xeb57a6-0x0;var _0x499b7a=_0x7cba[_0xeb57a6];return _0x499b7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa7cb('0x0'))(_0xa7cb('0x1'));var moment=require('moment');var BPromise=require(_0xa7cb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7cb('0x3'));var rimraf=require(_0xa7cb('0x4'));var config=require('../../config/environment');var attributes=require(_0xa7cb('0x5'));module[_0xa7cb('0x6')]=function(_0x35c383,_0x4df6de){return _0x35c383['define'](_0xa7cb('0x7'),attributes,{'tableName':_0xa7cb('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa7cb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2896=['../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x236df7,_0x3a00eb){var _0x125d69=function(_0x4a4411){while(--_0x4a4411){_0x236df7['push'](_0x236df7['shift']());}};_0x125d69(++_0x3a00eb);}(_0x2896,0x157));var _0x6289=function(_0x1d55d1,_0xbedf34){_0x1d55d1=_0x1d55d1-0x0;var _0x20596a=_0x2896[_0x1d55d1];return _0x20596a;};'use strict';var _=require(_0x6289('0x0'));var util=require(_0x6289('0x1'));var logger=require(_0x6289('0x2'))(_0x6289('0x3'));var moment=require('moment');var BPromise=require(_0x6289('0x4'));var rp=require(_0x6289('0x5'));var fs=require('fs');var path=require(_0x6289('0x6'));var rimraf=require(_0x6289('0x7'));var config=require(_0x6289('0x8'));var attributes=require(_0x6289('0x9'));module['exports']=function(_0x365460,_0x1c9fae){return _0x365460[_0x6289('0xa')](_0x6289('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x6289('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 38e3575..18d9aad 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 _0x6328=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','include','map','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','body','update','limit','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x559642,_0x30f3b1){var _0x2b81ce=function(_0x276a94){while(--_0x276a94){_0x559642['push'](_0x559642['shift']());}};_0x2b81ce(++_0x30f3b1);}(_0x6328,0xda));var _0x8632=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x6328[_0x8c1005];return _0x175354;};'use strict';var _=require(_0x8632('0x0'));var util=require(_0x8632('0x1'));var moment=require('moment');var BPromise=require(_0x8632('0x2'));var rs=require(_0x8632('0x3'));var fs=require('fs');var Redis=require(_0x8632('0x4'));var db=require(_0x8632('0x5'))['db'];var utils=require(_0x8632('0x6'));var logger=require(_0x8632('0x7'))(_0x8632('0x8'));var config=require(_0x8632('0x9'));var jayson=require(_0x8632('0xa'));var client=jayson['client'][_0x8632('0xb')]({'port':0x232a});config[_0x8632('0xc')]=_[_0x8632('0xd')](config['redis'],{'host':_0x8632('0xe'),'port':0x18eb});var socket=require(_0x8632('0xf'))(new Redis(config[_0x8632('0xc')]));require(_0x8632('0x10'))['register'](socket);function respondWithRpcPromise(_0x3dadb7,_0x1ba0c6,_0x36550f){return new BPromise(function(_0x343788,_0x2c474f){return client[_0x8632('0x11')](_0x3dadb7,_0x36550f)[_0x8632('0x12')](function(_0x5439c7){logger[_0x8632('0x13')](_0x8632('0x14'),_0x1ba0c6,_0x8632('0x15'));logger[_0x8632('0x16')](_0x8632('0x17'),_0x1ba0c6,_0x8632('0x15'),JSON['stringify'](_0x5439c7));if(_0x5439c7[_0x8632('0x18')]){if(_0x5439c7[_0x8632('0x18')][_0x8632('0x19')]===0x1f4){logger[_0x8632('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x1ba0c6,_0x5439c7[_0x8632('0x18')][_0x8632('0x1a')]);return _0x2c474f(_0x5439c7[_0x8632('0x18')][_0x8632('0x1a')]);}logger[_0x8632('0x18')](_0x8632('0x14'),_0x1ba0c6,_0x5439c7['error']['message']);return _0x343788(_0x5439c7[_0x8632('0x18')][_0x8632('0x1a')]);}else{logger['info'](_0x8632('0x14'),_0x1ba0c6,_0x8632('0x15'));_0x343788(_0x5439c7[_0x8632('0x1b')][_0x8632('0x1a')]);}})[_0x8632('0x1c')](function(_0x27285c){logger[_0x8632('0x18')](_0x8632('0x14'),_0x1ba0c6,_0x27285c);_0x2c474f(_0x27285c);});});}exports['GetVoiceQueueReport']=function(_0x42eb46){var _0x4f2ba8=this;return new Promise(function(_0xea95d9,_0xb3460d){return db['VoiceQueueReport']['findAll']({'raw':_0x42eb46[_0x8632('0x1d')]?_0x42eb46['options'][_0x8632('0x1e')]===undefined?!![]:![]:!![],'where':_0x42eb46['options']?_0x42eb46[_0x8632('0x1d')][_0x8632('0x1f')]||null:null,'attributes':_0x42eb46[_0x8632('0x1d')]?_0x42eb46[_0x8632('0x1d')][_0x8632('0x20')]||null:null,'limit':_0x42eb46[_0x8632('0x1d')]?_0x42eb46[_0x8632('0x1d')]['limit']||null:null,'include':_0x42eb46[_0x8632('0x1d')]?_0x42eb46[_0x8632('0x1d')][_0x8632('0x21')]?_[_0x8632('0x22')](_0x42eb46['options']['include'],function(_0x344f3e){return{'model':db[_0x344f3e[_0x8632('0x23')]],'as':_0x344f3e['as'],'attributes':_0x344f3e['attributes'],'include':_0x344f3e[_0x8632('0x21')]?_['map'](_0x344f3e[_0x8632('0x21')],function(_0x368f0f){return{'model':db[_0x368f0f[_0x8632('0x23')]],'as':_0x368f0f['as'],'attributes':_0x368f0f['attributes'],'include':_0x368f0f[_0x8632('0x21')]?_[_0x8632('0x22')](_0x368f0f[_0x8632('0x21')],function(_0x2224d1){return{'model':db[_0x2224d1[_0x8632('0x23')]],'as':_0x2224d1['as'],'attributes':_0x2224d1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x187422){logger[_0x8632('0x13')](_0x8632('0x24'),_0x42eb46);logger[_0x8632('0x16')](_0x8632('0x24'),_0x42eb46,JSON[_0x8632('0x25')](_0x187422));_0xea95d9(_0x187422);})[_0x8632('0x1c')](function(_0x3c85f0){logger[_0x8632('0x18')](_0x8632('0x24'),_0x3c85f0[_0x8632('0x1a')],_0x42eb46);_0xb3460d(_0x4f2ba8[_0x8632('0x18')](0x1f4,_0x3c85f0[_0x8632('0x1a')]));});});};exports[_0x8632('0x26')]=function(_0x5694cf){var _0x8fb987=this;return new Promise(function(_0x57c9b3,_0x59ae3f){return db[_0x8632('0x27')][_0x8632('0x28')](_0x5694cf[_0x8632('0x29')],{'raw':_0x5694cf[_0x8632('0x1d')]?_0x5694cf['options']['raw']===undefined?!![]:![]:!![]})[_0x8632('0x12')](function(_0x520c02){logger['info'](_0x8632('0x26'),_0x5694cf);logger['debug'](_0x8632('0x26'),_0x5694cf,JSON[_0x8632('0x25')](_0x520c02));_0x57c9b3(_0x520c02);})[_0x8632('0x1c')](function(_0x4045d8){logger[_0x8632('0x18')](_0x8632('0x26'),_0x4045d8[_0x8632('0x1a')],_0x5694cf);_0x59ae3f(_0x8fb987[_0x8632('0x18')](0x1f4,_0x4045d8['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x5d4c39){var _0x150fbf=this;return new Promise(function(_0x20989e,_0x3decc4){return db[_0x8632('0x27')][_0x8632('0x2a')](_0x5d4c39[_0x8632('0x29')],{'raw':_0x5d4c39[_0x8632('0x1d')]?_0x5d4c39['options'][_0x8632('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d4c39[_0x8632('0x1d')]?_0x5d4c39[_0x8632('0x1d')][_0x8632('0x1f')]||null:null,'attributes':_0x5d4c39[_0x8632('0x1d')]?_0x5d4c39['options'][_0x8632('0x20')]||null:null,'limit':_0x5d4c39[_0x8632('0x1d')]?_0x5d4c39[_0x8632('0x1d')][_0x8632('0x2b')]||null:null})['then'](function(_0x11a93e){logger[_0x8632('0x13')](_0x8632('0x2c'),_0x5d4c39);logger['debug'](_0x8632('0x2c'),_0x5d4c39,JSON[_0x8632('0x25')](_0x11a93e));_0x20989e(_0x11a93e);})[_0x8632('0x1c')](function(_0x2c0899){logger['error'](_0x8632('0x2c'),_0x2c0899[_0x8632('0x1a')],_0x5d4c39);_0x3decc4(_0x150fbf['error'](0x1f4,_0x2c0899[_0x8632('0x1a')]));});});}; \ No newline at end of file +var _0x8e16=['http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','attributes','limit','include','model','map','GetVoiceQueueReport','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','catch','UpdateVoiceQueueReport','update','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8e16,0x11e));var _0x68e1=function(_0x4e9d4a,_0x6203c4){_0x4e9d4a=_0x4e9d4a-0x0;var _0x288d6a=_0x8e16[_0x4e9d4a];return _0x288d6a;};'use strict';var _=require(_0x68e1('0x0'));var util=require(_0x68e1('0x1'));var moment=require('moment');var BPromise=require(_0x68e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68e1('0x3'))['db'];var utils=require(_0x68e1('0x4'));var logger=require(_0x68e1('0x5'))(_0x68e1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x68e1('0x7')][_0x68e1('0x8')]({'port':0x232a});config[_0x68e1('0x9')]=_[_0x68e1('0xa')](config['redis'],{'host':_0x68e1('0xb'),'port':0x18eb});var socket=require(_0x68e1('0xc'))(new Redis(config[_0x68e1('0x9')]));require(_0x68e1('0xd'))[_0x68e1('0xe')](socket);function respondWithRpcPromise(_0x1bb820,_0x8100ff,_0x22d008){return new BPromise(function(_0x4ed30f,_0x29cd0e){return client[_0x68e1('0xf')](_0x1bb820,_0x22d008)[_0x68e1('0x10')](function(_0x11ce37){logger[_0x68e1('0x11')](_0x68e1('0x12'),_0x8100ff,_0x68e1('0x13'));logger['debug'](_0x68e1('0x14'),_0x8100ff,_0x68e1('0x13'),JSON[_0x68e1('0x15')](_0x11ce37));if(_0x11ce37[_0x68e1('0x16')]){if(_0x11ce37[_0x68e1('0x16')][_0x68e1('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x8100ff,_0x11ce37[_0x68e1('0x16')][_0x68e1('0x18')]);return _0x29cd0e(_0x11ce37[_0x68e1('0x16')]['message']);}logger[_0x68e1('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x8100ff,_0x11ce37[_0x68e1('0x16')]['message']);return _0x4ed30f(_0x11ce37[_0x68e1('0x16')][_0x68e1('0x18')]);}else{logger[_0x68e1('0x11')](_0x68e1('0x12'),_0x8100ff,'request\x20sent');_0x4ed30f(_0x11ce37[_0x68e1('0x19')][_0x68e1('0x18')]);}})['catch'](function(_0x4c3422){logger[_0x68e1('0x16')](_0x68e1('0x12'),_0x8100ff,_0x4c3422);_0x29cd0e(_0x4c3422);});});}exports['GetVoiceQueueReport']=function(_0x1bce89){var _0x1e6a62=this;return new Promise(function(_0x461de5,_0x172dad){return db['VoiceQueueReport']['findAll']({'raw':_0x1bce89[_0x68e1('0x1a')]?_0x1bce89[_0x68e1('0x1a')][_0x68e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1bce89[_0x68e1('0x1a')]?_0x1bce89[_0x68e1('0x1a')]['where']||null:null,'attributes':_0x1bce89[_0x68e1('0x1a')]?_0x1bce89[_0x68e1('0x1a')][_0x68e1('0x1c')]||null:null,'limit':_0x1bce89[_0x68e1('0x1a')]?_0x1bce89['options'][_0x68e1('0x1d')]||null:null,'include':_0x1bce89['options']?_0x1bce89[_0x68e1('0x1a')][_0x68e1('0x1e')]?_['map'](_0x1bce89[_0x68e1('0x1a')][_0x68e1('0x1e')],function(_0x1fb626){return{'model':db[_0x1fb626[_0x68e1('0x1f')]],'as':_0x1fb626['as'],'attributes':_0x1fb626['attributes'],'include':_0x1fb626[_0x68e1('0x1e')]?_[_0x68e1('0x20')](_0x1fb626[_0x68e1('0x1e')],function(_0x2e5d94){return{'model':db[_0x2e5d94[_0x68e1('0x1f')]],'as':_0x2e5d94['as'],'attributes':_0x2e5d94[_0x68e1('0x1c')],'include':_0x2e5d94[_0x68e1('0x1e')]?_['map'](_0x2e5d94[_0x68e1('0x1e')],function(_0x598a83){return{'model':db[_0x598a83[_0x68e1('0x1f')]],'as':_0x598a83['as'],'attributes':_0x598a83[_0x68e1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x68e1('0x10')](function(_0x180cb6){logger[_0x68e1('0x11')](_0x68e1('0x21'),_0x1bce89);logger[_0x68e1('0x22')](_0x68e1('0x21'),_0x1bce89,JSON[_0x68e1('0x15')](_0x180cb6));_0x461de5(_0x180cb6);})['catch'](function(_0x3e8bf4){logger['error'](_0x68e1('0x21'),_0x3e8bf4[_0x68e1('0x18')],_0x1bce89);_0x172dad(_0x1e6a62['error'](0x1f4,_0x3e8bf4[_0x68e1('0x18')]));});});};exports[_0x68e1('0x23')]=function(_0xd55fb6){var _0x32829b=this;return new Promise(function(_0x565de1,_0x5459f9){return db[_0x68e1('0x24')][_0x68e1('0x25')](_0xd55fb6[_0x68e1('0x26')],{'raw':_0xd55fb6[_0x68e1('0x1a')]?_0xd55fb6[_0x68e1('0x1a')][_0x68e1('0x1b')]===undefined?!![]:![]:!![]})[_0x68e1('0x10')](function(_0x179c20){logger['info'](_0x68e1('0x23'),_0xd55fb6);logger[_0x68e1('0x22')](_0x68e1('0x23'),_0xd55fb6,JSON['stringify'](_0x179c20));_0x565de1(_0x179c20);})[_0x68e1('0x27')](function(_0x39544a){logger[_0x68e1('0x16')](_0x68e1('0x23'),_0x39544a[_0x68e1('0x18')],_0xd55fb6);_0x5459f9(_0x32829b['error'](0x1f4,_0x39544a[_0x68e1('0x18')]));});});};exports[_0x68e1('0x28')]=function(_0x22da1e){var _0x32f98a=this;return new Promise(function(_0x44d88d,_0x4193e1){return db['VoiceQueueReport'][_0x68e1('0x29')](_0x22da1e[_0x68e1('0x26')],{'raw':_0x22da1e['options']?_0x22da1e[_0x68e1('0x1a')][_0x68e1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22da1e[_0x68e1('0x1a')]?_0x22da1e[_0x68e1('0x1a')]['where']||null:null,'attributes':_0x22da1e[_0x68e1('0x1a')]?_0x22da1e[_0x68e1('0x1a')]['attributes']||null:null,'limit':_0x22da1e[_0x68e1('0x1a')]?_0x22da1e[_0x68e1('0x1a')][_0x68e1('0x1d')]||null:null})[_0x68e1('0x10')](function(_0x524b72){logger[_0x68e1('0x11')](_0x68e1('0x28'),_0x22da1e);logger['debug'](_0x68e1('0x28'),_0x22da1e,JSON[_0x68e1('0x15')](_0x524b72));_0x44d88d(_0x524b72);})[_0x68e1('0x27')](function(_0x358bfb){logger['error'](_0x68e1('0x28'),_0x358bfb[_0x68e1('0x18')],_0x22da1e);_0x4193e1(_0x32f98a['error'](0x1f4,_0x358bfb[_0x68e1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3554243..48d24e5 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 _0xc83b=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0xa8f24a,_0x48d7d3){var _0x3a1471=function(_0x281470){while(--_0x281470){_0xa8f24a['push'](_0xa8f24a['shift']());}};_0x3a1471(++_0x48d7d3);}(_0xc83b,0xa4));var _0xbc83=function(_0x3f2b15,_0x2df038){_0x3f2b15=_0x3f2b15-0x0;var _0x342e3a=_0xc83b[_0x3f2b15];return _0x342e3a;};'use strict';var VoiceQueueReportEvents=require(_0xbc83('0x0'));var events=[_0xbc83('0x1'),_0xbc83('0x2'),_0xbc83('0x3')];function createListener(_0x4b7749,_0x34a18e){return function(_0x443083){_0x34a18e[_0xbc83('0x4')](_0x4b7749,_0x443083);};}function removeListener(_0x261032,_0xee232c){return function(){VoiceQueueReportEvents['removeListener'](_0x261032,_0xee232c);};}exports[_0xbc83('0x5')]=function(_0x230b16){for(var _0x48d06a=0x0,_0x109543=events[_0xbc83('0x6')];_0x48d06a<_0x109543;_0x48d06a++){var _0x5447f8=events[_0x48d06a];var _0x285181=createListener(_0xbc83('0x7')+_0x5447f8,_0x230b16);VoiceQueueReportEvents['on'](_0x5447f8,_0x285181);}}; \ No newline at end of file +var _0x6934=['save','remove','update','emit','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x40dc5e,_0x2116a5){var _0x5b07b4=function(_0x4b0028){while(--_0x4b0028){_0x40dc5e['push'](_0x40dc5e['shift']());}};_0x5b07b4(++_0x2116a5);}(_0x6934,0x17f));var _0x4693=function(_0x58a2b3,_0x411b78){_0x58a2b3=_0x58a2b3-0x0;var _0x3df529=_0x6934[_0x58a2b3];return _0x3df529;};'use strict';var VoiceQueueReportEvents=require(_0x4693('0x0'));var events=[_0x4693('0x1'),_0x4693('0x2'),_0x4693('0x3')];function createListener(_0x438c15,_0x5940cd){return function(_0x1bc798){_0x5940cd[_0x4693('0x4')](_0x438c15,_0x1bc798);};}function removeListener(_0x2812a9,_0x2cc753){return function(){VoiceQueueReportEvents['removeListener'](_0x2812a9,_0x2cc753);};}exports[_0x4693('0x5')]=function(_0x19e7d1){for(var _0x344c63=0x0,_0x9f08b0=events[_0x4693('0x6')];_0x344c63<_0x9f08b0;_0x344c63++){var _0x389ea6=events[_0x344c63];var _0x259149=createListener(_0x4693('0x7')+_0x389ea6,_0x19e7d1);VoiceQueueReportEvents['on'](_0x389ea6,_0x259149);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c6f6a3d..b664164 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 _0xd3bd=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','connect-timeout'];(function(_0xe3e0f6,_0x4c8a9d){var _0x5e2625=function(_0x550b8c){while(--_0x550b8c){_0xe3e0f6['push'](_0xe3e0f6['shift']());}};_0x5e2625(++_0x4c8a9d);}(_0xd3bd,0xa9));var _0xdd3b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xd3bd[_0x9df060];return _0x338dfe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdd3b('0x0'));var express=require(_0xdd3b('0x1'));var router=express['Router']();var fs_extra=require(_0xdd3b('0x2'));var auth=require(_0xdd3b('0x3'));var interaction=require(_0xdd3b('0x4'));var config=require(_0xdd3b('0x5'));var controller=require(_0xdd3b('0x6'));router[_0xdd3b('0x7')]('/',auth[_0xdd3b('0x8')](),controller[_0xdd3b('0x9')]);router['get'](_0xdd3b('0xa'),auth[_0xdd3b('0x8')](),controller[_0xdd3b('0xb')]);router[_0xdd3b('0xc')]('/',auth[_0xdd3b('0x8')](),controller[_0xdd3b('0xd')]);router[_0xdd3b('0xe')]('/:id',auth[_0xdd3b('0x8')](),controller[_0xdd3b('0xf')]);router['delete'](_0xdd3b('0xa'),auth[_0xdd3b('0x8')](),controller[_0xdd3b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe40b=['get','isAuthenticated','index','show','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x11b19b,_0x213234){var _0x1daac1=function(_0x516d3b){while(--_0x516d3b){_0x11b19b['push'](_0x11b19b['shift']());}};_0x1daac1(++_0x213234);}(_0xe40b,0x1d5));var _0xbe40=function(_0x405261,_0x7d07ee){_0x405261=_0x405261-0x0;var _0x101203=_0xe40b[_0x405261];return _0x101203;};'use strict';var multer=require(_0xbe40('0x0'));var util=require(_0xbe40('0x1'));var path=require(_0xbe40('0x2'));var timeout=require(_0xbe40('0x3'));var express=require(_0xbe40('0x4'));var router=express[_0xbe40('0x5')]();var fs_extra=require(_0xbe40('0x6'));var auth=require(_0xbe40('0x7'));var interaction=require(_0xbe40('0x8'));var config=require(_0xbe40('0x9'));var controller=require(_0xbe40('0xa'));router[_0xbe40('0xb')]('/',auth[_0xbe40('0xc')](),controller[_0xbe40('0xd')]);router[_0xbe40('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbe40('0xe')]);router['post']('/',auth[_0xbe40('0xc')](),controller['create']);router[_0xbe40('0xf')]('/:id',auth[_0xbe40('0xc')](),controller[_0xbe40('0x10')]);router[_0xbe40('0x11')](_0xbe40('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe40('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 55f676b..02ca362 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 _0xf017=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf017,0x11c));var _0x7f01=function(_0x2196be,_0x42feaf){_0x2196be=_0x2196be-0x0;var _0x379fc1=_0xf017[_0x2196be];return _0x379fc1;};'use strict';var Sequelize=require(_0x7f01('0x0'));var moment=require('moment');module[_0x7f01('0x1')]={'time':{'type':Sequelize[_0x7f01('0x2')]},'callid':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7f01('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7f01('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x7f01('0x4')](_0x7f01('0x5'))}}; \ No newline at end of file +var _0x51f1=['literal','sequelize','moment','exports','STRING','DATE'];(function(_0x3d6785,_0x492ea3){var _0x39a624=function(_0x27d7db){while(--_0x27d7db){_0x3d6785['push'](_0x3d6785['shift']());}};_0x39a624(++_0x492ea3);}(_0x51f1,0x139));var _0x151f=function(_0x2a7fa8,_0x413c0e){_0x2a7fa8=_0x2a7fa8-0x0;var _0xf7e306=_0x51f1[_0x2a7fa8];return _0xf7e306;};'use strict';var Sequelize=require(_0x151f('0x0'));var moment=require(_0x151f('0x1'));module[_0x151f('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x151f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x151f('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x151f('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4008148..19c1d84 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 _0x3069=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../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','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5d7742,_0x4738e5){var _0x202be5=function(_0x4a9146){while(--_0x4a9146){_0x5d7742['push'](_0x5d7742['shift']());}};_0x202be5(++_0x4738e5);}(_0x3069,0x1d7));var _0x9306=function(_0x119ac4,_0x39e8a0){_0x119ac4=_0x119ac4-0x0;var _0x2b49a3=_0x3069[_0x119ac4];return _0x2b49a3;};'use strict';var emlformat=require(_0x9306('0x0'));var rimraf=require(_0x9306('0x1'));var zipdir=require(_0x9306('0x2'));var jsonpatch=require(_0x9306('0x3'));var rp=require(_0x9306('0x4'));var moment=require(_0x9306('0x5'));var BPromise=require(_0x9306('0x6'));var Mustache=require(_0x9306('0x7'));var util=require(_0x9306('0x8'));var path=require(_0x9306('0x9'));var sox=require('sox');var csv=require(_0x9306('0xa'));var ejs=require(_0x9306('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9306('0xc'));var squel=require(_0x9306('0xd'));var crypto=require('crypto');var jsforce=require(_0x9306('0xe'));var deskjs=require(_0x9306('0xf'));var toCsv=require(_0x9306('0xa'));var querystring=require(_0x9306('0x10'));var Papa=require(_0x9306('0x11'));var Redis=require('ioredis');var authService=require(_0x9306('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9306('0x13'));var hardwareService=require(_0x9306('0x14'));var logger=require('../../config/logger')(_0x9306('0x15'));var utils=require(_0x9306('0x16'));var config=require(_0x9306('0x17'));var licenseUtil=require(_0x9306('0x18'));var db=require(_0x9306('0x19'))['db'];function respondWithStatusCode(_0x2469be,_0x10e7a2){_0x10e7a2=_0x10e7a2||0xcc;return function(_0x471fa8){if(_0x471fa8){return _0x2469be[_0x9306('0x1a')](_0x10e7a2);}return _0x2469be[_0x9306('0x1b')](_0x10e7a2)['end']();};}function respondWithResult(_0x3a893e,_0x1745d1){_0x1745d1=_0x1745d1||0xc8;return function(_0x168ea2){if(_0x168ea2){return _0x3a893e[_0x9306('0x1b')](_0x1745d1)[_0x9306('0x1c')](_0x168ea2);}};}function respondWithFilteredResult(_0x49ff38,_0xd16277){return function(_0x3bb123){if(_0x3bb123){var _0x5d8755=typeof _0xd16277[_0x9306('0x1d')]===_0x9306('0x1e')&&typeof _0xd16277[_0x9306('0x1f')]===_0x9306('0x1e');var _0x407f10=_0x3bb123[_0x9306('0x20')];var _0xbed488=_0x5d8755?0x0:_0xd16277[_0x9306('0x1d')];var _0x8bc91c=_0x5d8755?_0x3bb123[_0x9306('0x20')]:_0xd16277[_0x9306('0x1d')]+_0xd16277[_0x9306('0x1f')];var _0x3f831a;if(_0x8bc91c>=_0x407f10){_0x8bc91c=_0x407f10;_0x3f831a=0xc8;}else{_0x3f831a=0xce;}_0x49ff38[_0x9306('0x1b')](_0x3f831a);return _0x49ff38['set'](_0x9306('0x21'),_0xbed488+'-'+_0x8bc91c+'/'+_0x407f10)[_0x9306('0x1c')](_0x3bb123);}return null;};}function patchUpdates(_0x372287){return function(_0xcc3a2e){try{jsonpatch[_0x9306('0x22')](_0xcc3a2e,_0x372287,!![]);}catch(_0x5724ba){return BPromise[_0x9306('0x23')](_0x5724ba);}return _0xcc3a2e[_0x9306('0x24')]();};}function saveUpdates(_0x43bcd5,_0x2eae10){return function(_0xab9995){if(_0xab9995){return _0xab9995[_0x9306('0x25')](_0x43bcd5)[_0x9306('0x26')](function(_0x3f3c91){return _0x3f3c91;});}return null;};}function removeEntity(_0x79cf38,_0x3152a6){return function(_0x18d31c){if(_0x18d31c){return _0x18d31c[_0x9306('0x27')]()[_0x9306('0x26')](function(){_0x79cf38['status'](0xcc)[_0x9306('0x28')]();});}};}function handleEntityNotFound(_0x2eed25,_0x20df94){return function(_0x7654ee){if(!_0x7654ee){_0x2eed25['sendStatus'](0x194);}return _0x7654ee;};}function handleError(_0x285355,_0x3a5180){_0x3a5180=_0x3a5180||0x1f4;return function(_0x4f44fd){logger[_0x9306('0x29')](_0x4f44fd[_0x9306('0x2a')]);if(_0x4f44fd[_0x9306('0x2b')]){delete _0x4f44fd[_0x9306('0x2b')];}_0x285355[_0x9306('0x1b')](_0x3a5180)[_0x9306('0x2c')](_0x4f44fd);};}exports[_0x9306('0x2d')]=function(_0x254192,_0x345ac5){var _0x33518b={},_0x5b167d={},_0x306d71={'count':0x0,'rows':[]};var _0x459aaf=_[_0x9306('0x2e')](db[_0x9306('0x2f')][_0x9306('0x30')],function(_0x5bd447){return{'name':_0x5bd447[_0x9306('0x31')],'type':_0x5bd447[_0x9306('0x32')]['key']};});_0x5b167d[_0x9306('0x33')]=_[_0x9306('0x2e')](_0x459aaf,_0x9306('0x2b'));_0x5b167d['query']=_[_0x9306('0x34')](_0x254192[_0x9306('0x35')]);_0x5b167d[_0x9306('0x36')]=_[_0x9306('0x37')](_0x5b167d['model'],_0x5b167d['query']);_0x33518b[_0x9306('0x38')]=_['intersection'](_0x5b167d[_0x9306('0x33')],qs[_0x9306('0x39')](_0x254192[_0x9306('0x35')][_0x9306('0x39')]));_0x33518b[_0x9306('0x38')]=_0x33518b[_0x9306('0x38')][_0x9306('0x3a')]?_0x33518b[_0x9306('0x38')]:_0x5b167d[_0x9306('0x33')];if(!_0x254192[_0x9306('0x35')][_0x9306('0x3b')](_0x9306('0x3c'))){_0x33518b[_0x9306('0x1f')]=qs['limit'](_0x254192[_0x9306('0x35')]['limit']);_0x33518b[_0x9306('0x1d')]=qs['offset'](_0x254192['query'][_0x9306('0x1d')]);}_0x33518b['order']=qs[_0x9306('0x3d')](_0x254192[_0x9306('0x35')][_0x9306('0x3d')]);_0x33518b[_0x9306('0x3e')]=qs[_0x9306('0x36')](_['pick'](_0x254192[_0x9306('0x35')],_0x5b167d[_0x9306('0x36')]),_0x459aaf);if(_0x254192[_0x9306('0x35')]['filter']){_0x33518b[_0x9306('0x3e')]=_[_0x9306('0x3f')](_0x33518b[_0x9306('0x3e')],{'$or':_[_0x9306('0x2e')](_0x459aaf,function(_0x176a8d){if(_0x176a8d[_0x9306('0x32')]!==_0x9306('0x40')){var _0x41d304={};_0x41d304[_0x176a8d[_0x9306('0x2b')]]={'$like':'%'+_0x254192[_0x9306('0x35')][_0x9306('0x41')]+'%'};return _0x41d304;}})});}_0x33518b=_[_0x9306('0x3f')]({},_0x33518b,_0x254192[_0x9306('0x42')]);var _0x16242a={'where':_0x33518b[_0x9306('0x3e')]};return db[_0x9306('0x2f')]['count'](_0x16242a)[_0x9306('0x26')](function(_0x490993){_0x306d71[_0x9306('0x20')]=_0x490993;if(_0x254192[_0x9306('0x35')][_0x9306('0x43')]){_0x33518b[_0x9306('0x44')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9306('0x45')](_0x33518b);})['then'](function(_0x450d71){_0x306d71['rows']=_0x450d71;return _0x306d71;})[_0x9306('0x26')](respondWithFilteredResult(_0x345ac5,_0x33518b))[_0x9306('0x46')](handleError(_0x345ac5,null));};exports[_0x9306('0x47')]=function(_0x567a69,_0x2a609c){var _0x594649={'raw':!![],'where':{'id':_0x567a69['params']['id']}},_0x1b5324={};_0x1b5324[_0x9306('0x33')]=_[_0x9306('0x34')](db['VoiceQueuesLog'][_0x9306('0x30')]);_0x1b5324[_0x9306('0x35')]=_[_0x9306('0x34')](_0x567a69['query']);_0x1b5324[_0x9306('0x36')]=_[_0x9306('0x37')](_0x1b5324[_0x9306('0x33')],_0x1b5324[_0x9306('0x35')]);_0x594649[_0x9306('0x38')]=_[_0x9306('0x37')](_0x1b5324[_0x9306('0x33')],qs[_0x9306('0x39')](_0x567a69[_0x9306('0x35')][_0x9306('0x39')]));_0x594649[_0x9306('0x38')]=_0x594649['attributes']['length']?_0x594649[_0x9306('0x38')]:_0x1b5324['model'];if(_0x567a69[_0x9306('0x35')][_0x9306('0x43')]){_0x594649[_0x9306('0x44')]=[{'all':!![]}];}_0x594649=_[_0x9306('0x3f')]({},_0x594649,_0x567a69[_0x9306('0x42')]);return db[_0x9306('0x2f')]['find'](_0x594649)[_0x9306('0x26')](handleEntityNotFound(_0x2a609c,null))[_0x9306('0x26')](respondWithResult(_0x2a609c,null))['catch'](handleError(_0x2a609c,null));};exports[_0x9306('0x48')]=function(_0x206a59,_0x1d1319){return db['VoiceQueuesLog'][_0x9306('0x48')](_0x206a59['body'],{})[_0x9306('0x26')](respondWithResult(_0x1d1319,0xc9))[_0x9306('0x46')](handleError(_0x1d1319,null));};exports[_0x9306('0x25')]=function(_0x1f888f,_0x228bed){if(_0x1f888f[_0x9306('0x49')]['id']){delete _0x1f888f[_0x9306('0x49')]['id'];}return db[_0x9306('0x2f')][_0x9306('0x4a')]({'where':{'id':_0x1f888f[_0x9306('0x4b')]['id']}})[_0x9306('0x26')](handleEntityNotFound(_0x228bed,null))[_0x9306('0x26')](saveUpdates(_0x1f888f['body'],null))[_0x9306('0x26')](respondWithResult(_0x228bed,null))['catch'](handleError(_0x228bed,null));};exports[_0x9306('0x27')]=function(_0x1fa418,_0x1b5e46){return db[_0x9306('0x2f')][_0x9306('0x4a')]({'where':{'id':_0x1fa418['params']['id']}})[_0x9306('0x26')](handleEntityNotFound(_0x1b5e46,null))['then'](removeEntity(_0x1b5e46,null))[_0x9306('0x46')](handleError(_0x1b5e46,null));}; \ No newline at end of file +var _0xbd4f=['filters','includeAll','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','options','where','count','include','rows','catch','show','params','keys'];(function(_0x8c33b2,_0x372ac7){var _0x4a11a1=function(_0x3cf6ed){while(--_0x3cf6ed){_0x8c33b2['push'](_0x8c33b2['shift']());}};_0x4a11a1(++_0x372ac7);}(_0xbd4f,0xe9));var _0xfbd4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xbd4f[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xfbd4('0x0'));var rimraf=require(_0xfbd4('0x1'));var zipdir=require(_0xfbd4('0x2'));var jsonpatch=require(_0xfbd4('0x3'));var rp=require('request-promise');var moment=require(_0xfbd4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfbd4('0x5'));var util=require(_0xfbd4('0x6'));var path=require(_0xfbd4('0x7'));var sox=require(_0xfbd4('0x8'));var csv=require('to-csv');var ejs=require(_0xfbd4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbd4('0xa'));var squel=require(_0xfbd4('0xb'));var crypto=require(_0xfbd4('0xc'));var jsforce=require(_0xfbd4('0xd'));var deskjs=require(_0xfbd4('0xe'));var toCsv=require(_0xfbd4('0xf'));var querystring=require(_0xfbd4('0x10'));var Papa=require(_0xfbd4('0x11'));var Redis=require(_0xfbd4('0x12'));var authService=require(_0xfbd4('0x13'));var qs=require(_0xfbd4('0x14'));var as=require(_0xfbd4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd4('0x16'))('api');var utils=require(_0xfbd4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfbd4('0x18'));var db=require(_0xfbd4('0x19'))['db'];function respondWithStatusCode(_0x2c9ec0,_0x5eaaf5){_0x5eaaf5=_0x5eaaf5||0xcc;return function(_0x1348e0){if(_0x1348e0){return _0x2c9ec0['sendStatus'](_0x5eaaf5);}return _0x2c9ec0['status'](_0x5eaaf5)[_0xfbd4('0x1a')]();};}function respondWithResult(_0x591d54,_0x51d8e6){_0x51d8e6=_0x51d8e6||0xc8;return function(_0xb4e62d){if(_0xb4e62d){return _0x591d54[_0xfbd4('0x1b')](_0x51d8e6)[_0xfbd4('0x1c')](_0xb4e62d);}};}function respondWithFilteredResult(_0x2f30e8,_0x14cf69){return function(_0xdb4e90){if(_0xdb4e90){var _0xfa5747=typeof _0x14cf69[_0xfbd4('0x1d')]===_0xfbd4('0x1e')&&typeof _0x14cf69[_0xfbd4('0x1f')]==='undefined';var _0x38606b=_0xdb4e90['count'];var _0x1215c6=_0xfa5747?0x0:_0x14cf69[_0xfbd4('0x1d')];var _0x5931e4=_0xfa5747?_0xdb4e90['count']:_0x14cf69[_0xfbd4('0x1d')]+_0x14cf69[_0xfbd4('0x1f')];var _0x138023;if(_0x5931e4>=_0x38606b){_0x5931e4=_0x38606b;_0x138023=0xc8;}else{_0x138023=0xce;}_0x2f30e8[_0xfbd4('0x1b')](_0x138023);return _0x2f30e8[_0xfbd4('0x20')](_0xfbd4('0x21'),_0x1215c6+'-'+_0x5931e4+'/'+_0x38606b)[_0xfbd4('0x1c')](_0xdb4e90);}return null;};}function patchUpdates(_0x23e235){return function(_0xa565eb){try{jsonpatch[_0xfbd4('0x22')](_0xa565eb,_0x23e235,!![]);}catch(_0x5c6670){return BPromise[_0xfbd4('0x23')](_0x5c6670);}return _0xa565eb[_0xfbd4('0x24')]();};}function saveUpdates(_0x546569,_0x5753e8){return function(_0x3881f2){if(_0x3881f2){return _0x3881f2[_0xfbd4('0x25')](_0x546569)[_0xfbd4('0x26')](function(_0x336c55){return _0x336c55;});}return null;};}function removeEntity(_0x30d761,_0xaeb2bb){return function(_0xbdcd91){if(_0xbdcd91){return _0xbdcd91['destroy']()['then'](function(){_0x30d761['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8635,_0x179b28){return function(_0x5b993f){if(!_0x5b993f){_0x3c8635[_0xfbd4('0x27')](0x194);}return _0x5b993f;};}function handleError(_0x5b6236,_0x53335b){_0x53335b=_0x53335b||0x1f4;return function(_0x22dbcc){logger[_0xfbd4('0x28')](_0x22dbcc[_0xfbd4('0x29')]);if(_0x22dbcc[_0xfbd4('0x2a')]){delete _0x22dbcc[_0xfbd4('0x2a')];}_0x5b6236[_0xfbd4('0x1b')](_0x53335b)[_0xfbd4('0x2b')](_0x22dbcc);};}exports[_0xfbd4('0x2c')]=function(_0x39bfac,_0x49aac1){var _0x29a9f3={},_0x289b18={},_0x44239e={'count':0x0,'rows':[]};var _0x47d2a7=_['map'](db[_0xfbd4('0x2d')][_0xfbd4('0x2e')],function(_0x906677){return{'name':_0x906677[_0xfbd4('0x2f')],'type':_0x906677[_0xfbd4('0x30')][_0xfbd4('0x31')]};});_0x289b18['model']=_[_0xfbd4('0x32')](_0x47d2a7,_0xfbd4('0x2a'));_0x289b18[_0xfbd4('0x33')]=_['keys'](_0x39bfac[_0xfbd4('0x33')]);_0x289b18['filters']=_[_0xfbd4('0x34')](_0x289b18[_0xfbd4('0x35')],_0x289b18['query']);_0x29a9f3[_0xfbd4('0x36')]=_[_0xfbd4('0x34')](_0x289b18[_0xfbd4('0x35')],qs[_0xfbd4('0x37')](_0x39bfac['query'][_0xfbd4('0x37')]));_0x29a9f3['attributes']=_0x29a9f3[_0xfbd4('0x36')][_0xfbd4('0x38')]?_0x29a9f3[_0xfbd4('0x36')]:_0x289b18[_0xfbd4('0x35')];if(!_0x39bfac['query'][_0xfbd4('0x39')]('nolimit')){_0x29a9f3[_0xfbd4('0x1f')]=qs[_0xfbd4('0x1f')](_0x39bfac[_0xfbd4('0x33')][_0xfbd4('0x1f')]);_0x29a9f3['offset']=qs[_0xfbd4('0x1d')](_0x39bfac['query'][_0xfbd4('0x1d')]);}_0x29a9f3['order']=qs[_0xfbd4('0x3a')](_0x39bfac['query']['sort']);_0x29a9f3['where']=qs['filters'](_[_0xfbd4('0x3b')](_0x39bfac[_0xfbd4('0x33')],_0x289b18['filters']),_0x47d2a7);if(_0x39bfac['query'][_0xfbd4('0x3c')]){_0x29a9f3['where']=_[_0xfbd4('0x3d')](_0x29a9f3['where'],{'$or':_[_0xfbd4('0x32')](_0x47d2a7,function(_0x46691b){if(_0x46691b[_0xfbd4('0x30')]!=='VIRTUAL'){var _0xb905ea={};_0xb905ea[_0x46691b[_0xfbd4('0x2a')]]={'$like':'%'+_0x39bfac['query'][_0xfbd4('0x3c')]+'%'};return _0xb905ea;}})});}_0x29a9f3=_[_0xfbd4('0x3d')]({},_0x29a9f3,_0x39bfac[_0xfbd4('0x3e')]);var _0x39fd6a={'where':_0x29a9f3[_0xfbd4('0x3f')]};return db[_0xfbd4('0x2d')][_0xfbd4('0x40')](_0x39fd6a)['then'](function(_0x32b24e){_0x44239e[_0xfbd4('0x40')]=_0x32b24e;if(_0x39bfac[_0xfbd4('0x33')]['includeAll']){_0x29a9f3[_0xfbd4('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x29a9f3);})[_0xfbd4('0x26')](function(_0x2a7ea4){_0x44239e[_0xfbd4('0x42')]=_0x2a7ea4;return _0x44239e;})['then'](respondWithFilteredResult(_0x49aac1,_0x29a9f3))[_0xfbd4('0x43')](handleError(_0x49aac1,null));};exports[_0xfbd4('0x44')]=function(_0x104dc5,_0x54e7aa){var _0x8a417f={'raw':!![],'where':{'id':_0x104dc5[_0xfbd4('0x45')]['id']}},_0x3f96da={};_0x3f96da[_0xfbd4('0x35')]=_[_0xfbd4('0x46')](db[_0xfbd4('0x2d')][_0xfbd4('0x2e')]);_0x3f96da['query']=_[_0xfbd4('0x46')](_0x104dc5[_0xfbd4('0x33')]);_0x3f96da[_0xfbd4('0x47')]=_[_0xfbd4('0x34')](_0x3f96da[_0xfbd4('0x35')],_0x3f96da['query']);_0x8a417f[_0xfbd4('0x36')]=_[_0xfbd4('0x34')](_0x3f96da[_0xfbd4('0x35')],qs[_0xfbd4('0x37')](_0x104dc5[_0xfbd4('0x33')][_0xfbd4('0x37')]));_0x8a417f['attributes']=_0x8a417f[_0xfbd4('0x36')]['length']?_0x8a417f[_0xfbd4('0x36')]:_0x3f96da['model'];if(_0x104dc5[_0xfbd4('0x33')][_0xfbd4('0x48')]){_0x8a417f[_0xfbd4('0x41')]=[{'all':!![]}];}_0x8a417f=_[_0xfbd4('0x3d')]({},_0x8a417f,_0x104dc5['options']);return db[_0xfbd4('0x2d')]['find'](_0x8a417f)[_0xfbd4('0x26')](handleEntityNotFound(_0x54e7aa,null))[_0xfbd4('0x26')](respondWithResult(_0x54e7aa,null))[_0xfbd4('0x43')](handleError(_0x54e7aa,null));};exports['create']=function(_0xb8613c,_0x346548){return db[_0xfbd4('0x2d')]['create'](_0xb8613c[_0xfbd4('0x49')],{})['then'](respondWithResult(_0x346548,0xc9))[_0xfbd4('0x43')](handleError(_0x346548,null));};exports['update']=function(_0x1c3f73,_0x3b6f2b){if(_0x1c3f73['body']['id']){delete _0x1c3f73[_0xfbd4('0x49')]['id'];}return db['VoiceQueuesLog'][_0xfbd4('0x4a')]({'where':{'id':_0x1c3f73[_0xfbd4('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6f2b,null))[_0xfbd4('0x26')](saveUpdates(_0x1c3f73[_0xfbd4('0x49')],null))[_0xfbd4('0x26')](respondWithResult(_0x3b6f2b,null))[_0xfbd4('0x43')](handleError(_0x3b6f2b,null));};exports[_0xfbd4('0x4b')]=function(_0x28302d,_0x2639bb){return db[_0xfbd4('0x2d')][_0xfbd4('0x4a')]({'where':{'id':_0x28302d['params']['id']}})[_0xfbd4('0x26')](handleEntityNotFound(_0x2639bb,null))['then'](removeEntity(_0x2639bb,null))['catch'](handleError(_0x2639bb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2ba6112..7aae544 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 _0x3d1b=['dtm','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','voice_queues_log','event_dtm','event'];(function(_0x4f67f1,_0x3d02bf){var _0x52c611=function(_0x2ff881){while(--_0x2ff881){_0x4f67f1['push'](_0x4f67f1['shift']());}};_0x52c611(++_0x3d02bf);}(_0x3d1b,0xb7));var _0xb3d1=function(_0x5dda44,_0x40b720){_0x5dda44=_0x5dda44-0x0;var _0x25506a=_0x3d1b[_0x5dda44];return _0x25506a;};'use strict';var _=require(_0xb3d1('0x0'));var util=require(_0xb3d1('0x1'));var logger=require(_0xb3d1('0x2'))(_0xb3d1('0x3'));var moment=require('moment');var BPromise=require(_0xb3d1('0x4'));var rp=require(_0xb3d1('0x5'));var fs=require('fs');var path=require(_0xb3d1('0x6'));var rimraf=require(_0xb3d1('0x7'));var config=require(_0xb3d1('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0xb3d1('0x9')]=function(_0x57e99a,_0x527560){return _0x57e99a['define']('VoiceQueuesLog',attributes,{'tableName':_0xb3d1('0xa'),'paranoid':![],'indexes':[{'name':_0xb3d1('0xb'),'fields':[_0xb3d1('0xc'),_0xb3d1('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4f73=['../../config/logger','api','bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x4f73,0x10f));var _0x34f7=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0x4f73[_0x1be9ce];return _0x164439;};'use strict';var _=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var logger=require(_0x34f7('0x2'))(_0x34f7('0x3'));var moment=require('moment');var BPromise=require(_0x34f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34f7('0x5'));var rimraf=require('rimraf');var config=require(_0x34f7('0x6'));var attributes=require(_0x34f7('0x7'));module[_0x34f7('0x8')]=function(_0x3125aa,_0x27053f){return _0x3125aa['define']('VoiceQueuesLog',attributes,{'tableName':_0x34f7('0x9'),'paranoid':![],'indexes':[{'name':_0x34f7('0xa'),'fields':[_0x34f7('0xb'),_0x34f7('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2bf75a8..147a415 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 _0xb7f1=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x1cfad8,_0x1a5444){var _0x1e3f35=function(_0x11620d){while(--_0x11620d){_0x1cfad8['push'](_0x1cfad8['shift']());}};_0x1e3f35(++_0x1a5444);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x3dba2d,_0x54e044){_0x3dba2d=_0x3dba2d-0x0;var _0x5371dc=_0xb7f1[_0x3dba2d];return _0x5371dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b7f('0x0'));var BPromise=require(_0x1b7f('0x1'));var rs=require(_0x1b7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b7f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b7f('0x4'));var config=require(_0x1b7f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1b7f('0x6')][_0x1b7f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b58f7,_0x6c9f9,_0x34213c){return new BPromise(function(_0x4dda12,_0x16935b){return client[_0x1b7f('0x8')](_0x2b58f7,_0x34213c)[_0x1b7f('0x9')](function(_0x1ee997){logger[_0x1b7f('0xa')](_0x1b7f('0xb'),_0x6c9f9,_0x1b7f('0xc'));logger['debug'](_0x1b7f('0xd'),_0x6c9f9,'request\x20sent',JSON['stringify'](_0x1ee997));if(_0x1ee997[_0x1b7f('0xe')]){if(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0xf')]===0x1f4){logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x1ee997[_0x1b7f('0xe')]['message']);return _0x16935b(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);}logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);return _0x4dda12(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x6c9f9,_0x1b7f('0xc'));_0x4dda12(_0x1ee997[_0x1b7f('0x11')]['message']);}})[_0x1b7f('0x12')](function(_0x45735f){logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x45735f);_0x16935b(_0x45735f);});});} \ No newline at end of file +var _0x210d=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x2e7b28,_0x14094e){var _0x24e5bd=function(_0x3a762d){while(--_0x3a762d){_0x2e7b28['push'](_0x2e7b28['shift']());}};_0x24e5bd(++_0x14094e);}(_0x210d,0x7c));var _0xd210=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x210d[_0xd336fa];return _0x3370b1;};'use strict';var _=require(_0xd210('0x0'));var util=require(_0xd210('0x1'));var moment=require('moment');var BPromise=require(_0xd210('0x2'));var rs=require(_0xd210('0x3'));var fs=require('fs');var Redis=require(_0xd210('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd210('0x5'))(_0xd210('0x6'));var config=require(_0xd210('0x7'));var jayson=require(_0xd210('0x8'));var client=jayson[_0xd210('0x9')][_0xd210('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e63bd,_0x288c98,_0x2e8df7){return new BPromise(function(_0xc3fd08,_0x26bd4e){return client[_0xd210('0xb')](_0x3e63bd,_0x2e8df7)['then'](function(_0x14a04e){logger[_0xd210('0xc')](_0xd210('0xd'),_0x288c98,_0xd210('0xe'));logger[_0xd210('0xf')](_0xd210('0x10'),_0x288c98,'request\x20sent',JSON[_0xd210('0x11')](_0x14a04e));if(_0x14a04e[_0xd210('0x12')]){if(_0x14a04e[_0xd210('0x12')][_0xd210('0x13')]===0x1f4){logger[_0xd210('0x12')](_0xd210('0xd'),_0x288c98,_0x14a04e[_0xd210('0x12')]['message']);return _0x26bd4e(_0x14a04e[_0xd210('0x12')][_0xd210('0x14')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x288c98,_0x14a04e[_0xd210('0x12')][_0xd210('0x14')]);return _0xc3fd08(_0x14a04e[_0xd210('0x12')][_0xd210('0x14')]);}else{logger[_0xd210('0xc')](_0xd210('0xd'),_0x288c98,'request\x20sent');_0xc3fd08(_0x14a04e[_0xd210('0x15')][_0xd210('0x14')]);}})[_0xd210('0x16')](function(_0x8c0b8){logger[_0xd210('0x12')](_0xd210('0xd'),_0x288c98,_0x8c0b8);_0x26bd4e(_0x8c0b8);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7a23a9e..8e2eef9 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 _0x49bc=['isAuthenticated','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','runTranscribe','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceRecording.controller','get','index','/describe'];(function(_0x46c836,_0x30019f){var _0x4da8d1=function(_0x5ecb56){while(--_0x5ecb56){_0x46c836['push'](_0x46c836['shift']());}};_0x4da8d1(++_0x30019f);}(_0x49bc,0xbc));var _0xc49b=function(_0x1f1c2d,_0x140a00){_0x1f1c2d=_0x1f1c2d-0x0;var _0x341b65=_0x49bc[_0x1f1c2d];return _0x341b65;};'use strict';var multer=require(_0xc49b('0x0'));var util=require(_0xc49b('0x1'));var path=require(_0xc49b('0x2'));var timeout=require(_0xc49b('0x3'));var express=require(_0xc49b('0x4'));var router=express[_0xc49b('0x5')]();var fs_extra=require(_0xc49b('0x6'));var auth=require(_0xc49b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc49b('0x8'));router[_0xc49b('0x9')]('/',auth['isAuthenticated'](),controller[_0xc49b('0xa')]);router[_0xc49b('0x9')](_0xc49b('0xb'),auth[_0xc49b('0xc')](),controller['describe']);router[_0xc49b('0x9')](_0xc49b('0xd'),auth[_0xc49b('0xc')](),controller[_0xc49b('0xe')]);router[_0xc49b('0x9')](_0xc49b('0xf'),auth['isAuthenticated'](),controller[_0xc49b('0x10')]);router[_0xc49b('0x9')](_0xc49b('0x11'),controller[_0xc49b('0x12')]);router[_0xc49b('0x9')]('/:id/transcribe',auth[_0xc49b('0xc')](),controller[_0xc49b('0x13')]);router['post']('/',auth[_0xc49b('0xc')](),controller['create']);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller[_0xc49b('0x14')]);router[_0xc49b('0x15')](_0xc49b('0xd'),auth[_0xc49b('0xc')](),controller[_0xc49b('0x16')]);router[_0xc49b('0x17')](_0xc49b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc49b('0x18')]=router; \ No newline at end of file +var _0xed73=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','/:id','delete','destroy','util','path','connect-timeout'];(function(_0x10b6ba,_0x54fd78){var _0x149282=function(_0x45b829){while(--_0x45b829){_0x10b6ba['push'](_0x10b6ba['shift']());}};_0x149282(++_0x54fd78);}(_0xed73,0x14d));var _0x3ed7=function(_0x3f2b79,_0x371c8a){_0x3f2b79=_0x3f2b79-0x0;var _0x5d0033=_0xed73[_0x3f2b79];return _0x5d0033;};'use strict';var multer=require('multer');var util=require(_0x3ed7('0x0'));var path=require(_0x3ed7('0x1'));var timeout=require(_0x3ed7('0x2'));var express=require(_0x3ed7('0x3'));var router=express[_0x3ed7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3ed7('0x5'));var interaction=require(_0x3ed7('0x6'));var config=require('../../config/environment');var controller=require(_0x3ed7('0x7'));router[_0x3ed7('0x8')]('/',auth[_0x3ed7('0x9')](),controller[_0x3ed7('0xa')]);router['get'](_0x3ed7('0xb'),auth[_0x3ed7('0x9')](),controller[_0x3ed7('0xc')]);router[_0x3ed7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3ed7('0xd')]);router[_0x3ed7('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3ed7('0xe')]);router[_0x3ed7('0x8')](_0x3ed7('0xf'),controller[_0x3ed7('0x10')]);router[_0x3ed7('0x8')](_0x3ed7('0x11'),auth[_0x3ed7('0x9')](),controller[_0x3ed7('0x12')]);router['post']('/',auth[_0x3ed7('0x9')](),controller['create']);router[_0x3ed7('0x13')](_0x3ed7('0x11'),auth['isAuthenticated'](),controller[_0x3ed7('0x14')]);router['put'](_0x3ed7('0x15'),auth[_0x3ed7('0x9')](),controller['update']);router[_0x3ed7('0x16')](_0x3ed7('0x15'),auth[_0x3ed7('0x9')](),controller[_0x3ed7('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index dcbdc0b..ca41a82 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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f7a9300..6c68556 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 _0x3f6b=['findOne','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','update','then','destroy','error','stack','name','map','VoiceRecording','type','key','differenceBy','format','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','download','unlink','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','decryptFile','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe'];(function(_0x4845e4,_0x94613b){var _0x563711=function(_0x3cef0c){while(--_0x3cef0c){_0x4845e4['push'](_0x4845e4['shift']());}};_0x563711(++_0x94613b);}(_0x3f6b,0xb8));var _0xb3f6=function(_0x262ede,_0x2def4e){_0x262ede=_0x262ede-0x0;var _0xa2e1c7=_0x3f6b[_0x262ede];return _0xa2e1c7;};'use strict';var emlformat=require(_0xb3f6('0x0'));var rimraf=require(_0xb3f6('0x1'));var zipdir=require(_0xb3f6('0x2'));var jsonpatch=require(_0xb3f6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb3f6('0x4'));var Mustache=require(_0xb3f6('0x5'));var util=require(_0xb3f6('0x6'));var path=require(_0xb3f6('0x7'));var sox=require(_0xb3f6('0x8'));var csv=require(_0xb3f6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3f6('0xa'));var _=require(_0xb3f6('0xb'));var squel=require(_0xb3f6('0xc'));var crypto=require('crypto');var jsforce=require(_0xb3f6('0xd'));var deskjs=require(_0xb3f6('0xe'));var toCsv=require(_0xb3f6('0x9'));var querystring=require(_0xb3f6('0xf'));var Papa=require('papaparse');var AWS=require(_0xb3f6('0x10'));var uuidv4=require(_0xb3f6('0x11'));var Redis=require(_0xb3f6('0x12'));var authService=require(_0xb3f6('0x13'));var qs=require(_0xb3f6('0x14'));var as=require(_0xb3f6('0x15'));var hardwareService=require(_0xb3f6('0x16'));var logger=require(_0xb3f6('0x17'))(_0xb3f6('0x18'));var utils=require(_0xb3f6('0x19'));var config=require(_0xb3f6('0x1a'));var licenseUtil=require(_0xb3f6('0x1b'));var db=require(_0xb3f6('0x1c'))['db'];function respondWithStatusCode(_0x2ebaf6,_0x13f287){_0x13f287=_0x13f287||0xcc;return function(_0x35af73){if(_0x35af73){return _0x2ebaf6[_0xb3f6('0x1d')](_0x13f287);}return _0x2ebaf6['status'](_0x13f287)[_0xb3f6('0x1e')]();};}function respondWithResult(_0x38c3cd,_0x14aff5){_0x14aff5=_0x14aff5||0xc8;return function(_0x37d9b1){if(_0x37d9b1){return _0x38c3cd['status'](_0x14aff5)[_0xb3f6('0x1f')](_0x37d9b1);}};}function respondWithFilteredResult(_0x2e28b7,_0x257506){return function(_0x1f78e4){if(_0x1f78e4){var _0x1aa9cc=typeof _0x257506[_0xb3f6('0x20')]==='undefined'&&typeof _0x257506[_0xb3f6('0x21')]===_0xb3f6('0x22');var _0x4539b2=_0x1f78e4[_0xb3f6('0x23')];var _0xe5a0a1=_0x1aa9cc?0x0:_0x257506['offset'];var _0xd347d3=_0x1aa9cc?_0x1f78e4[_0xb3f6('0x23')]:_0x257506[_0xb3f6('0x20')]+_0x257506['limit'];var _0x13d99d;if(_0xd347d3>=_0x4539b2){_0xd347d3=_0x4539b2;_0x13d99d=0xc8;}else{_0x13d99d=0xce;}_0x2e28b7[_0xb3f6('0x24')](_0x13d99d);return _0x2e28b7[_0xb3f6('0x25')](_0xb3f6('0x26'),_0xe5a0a1+'-'+_0xd347d3+'/'+_0x4539b2)[_0xb3f6('0x1f')](_0x1f78e4);}return null;};}function patchUpdates(_0x5ccf99){return function(_0x33aae4){try{jsonpatch[_0xb3f6('0x27')](_0x33aae4,_0x5ccf99,!![]);}catch(_0x1fd6f2){return BPromise['reject'](_0x1fd6f2);}return _0x33aae4['save']();};}function saveUpdates(_0x452b63,_0x20a473){return function(_0x120ce7){if(_0x120ce7){return _0x120ce7[_0xb3f6('0x28')](_0x452b63)[_0xb3f6('0x29')](function(_0x26591f){return _0x26591f;});}return null;};}function removeEntity(_0x39927e,_0x1a6a91){return function(_0x22e4c4){if(_0x22e4c4){return _0x22e4c4[_0xb3f6('0x2a')]()[_0xb3f6('0x29')](function(){_0x39927e[_0xb3f6('0x24')](0xcc)[_0xb3f6('0x1e')]();});}};}function handleEntityNotFound(_0x3d5172,_0x472bf2){return function(_0x271d81){if(!_0x271d81){_0x3d5172[_0xb3f6('0x1d')](0x194);}return _0x271d81;};}function handleError(_0x5d0e3a,_0x54422f){_0x54422f=_0x54422f||0x1f4;return function(_0x5d5490){logger[_0xb3f6('0x2b')](_0x5d5490[_0xb3f6('0x2c')]);if(_0x5d5490[_0xb3f6('0x2d')]){delete _0x5d5490[_0xb3f6('0x2d')];}_0x5d0e3a[_0xb3f6('0x24')](_0x54422f)['send'](_0x5d5490);};}exports['index']=function(_0x271cc0,_0x2c7a28){var _0x151b33={},_0xc4f2b0={},_0x3b0896={'count':0x0,'rows':[]};var _0x4eb5e8=_[_0xb3f6('0x2e')](db[_0xb3f6('0x2f')]['rawAttributes'],function(_0x270f86){return{'name':_0x270f86['fieldName'],'type':_0x270f86[_0xb3f6('0x30')][_0xb3f6('0x31')]};});_0xc4f2b0['model']=_[_0xb3f6('0x32')](_['map'](_0x4eb5e8,'name'),[_0xb3f6('0x33')]);_0xc4f2b0[_0xb3f6('0x34')]=_[_0xb3f6('0x35')](_0x271cc0[_0xb3f6('0x34')]);_0xc4f2b0['filters']=_['intersection'](_0xc4f2b0[_0xb3f6('0x36')],_0xc4f2b0['query']);_0x151b33[_0xb3f6('0x37')]=_[_0xb3f6('0x38')](_0xc4f2b0[_0xb3f6('0x36')],qs[_0xb3f6('0x39')](_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x39')]));_0x151b33[_0xb3f6('0x37')]=_0x151b33[_0xb3f6('0x37')][_0xb3f6('0x3a')]?_0x151b33[_0xb3f6('0x37')]:_0xc4f2b0['model'];if(!_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x3b')]('nolimit')){_0x151b33[_0xb3f6('0x21')]=qs[_0xb3f6('0x21')](_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x21')]);_0x151b33['offset']=qs['offset'](_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x20')]);}_0x151b33[_0xb3f6('0x3c')]=qs[_0xb3f6('0x3d')](_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x3d')]);_0x151b33[_0xb3f6('0x3e')]=qs['filters'](_[_0xb3f6('0x3f')](_0x271cc0[_0xb3f6('0x34')],_0xc4f2b0['filters']),_0x4eb5e8);if(_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x40')]){_0x151b33[_0xb3f6('0x3e')]=_[_0xb3f6('0x41')](_0x151b33[_0xb3f6('0x3e')],{'$or':_[_0xb3f6('0x2e')](_0x4eb5e8,function(_0x2d1188){if(_0x2d1188[_0xb3f6('0x30')]!==_0xb3f6('0x42')){var _0x2ccd45={};_0x2ccd45[_0x2d1188[_0xb3f6('0x2d')]]={'$like':'%'+_0x271cc0['query'][_0xb3f6('0x40')]+'%'};return _0x2ccd45;}})});}_0x151b33=_['merge']({},_0x151b33,_0x271cc0[_0xb3f6('0x43')]);var _0x178666={'where':_0x151b33['where']};return db[_0xb3f6('0x2f')][_0xb3f6('0x23')](_0x178666)[_0xb3f6('0x29')](function(_0x2c0cf7){_0x3b0896[_0xb3f6('0x23')]=_0x2c0cf7;if(_0x271cc0[_0xb3f6('0x34')][_0xb3f6('0x44')]){_0x151b33[_0xb3f6('0x45')]=[{'all':!![]}];}return db[_0xb3f6('0x2f')][_0xb3f6('0x46')](_0x151b33);})[_0xb3f6('0x29')](function(_0x4e177a){_0x3b0896[_0xb3f6('0x47')]=_0x4e177a;return _0x3b0896;})[_0xb3f6('0x29')](respondWithFilteredResult(_0x2c7a28,_0x151b33))[_0xb3f6('0x48')](handleError(_0x2c7a28,null));};exports[_0xb3f6('0x49')]=function(_0x354bd1,_0x30b5e0){var _0x362f47={'raw':![],'where':{'id':_0x354bd1[_0xb3f6('0x4a')]['id']}},_0x1f62d4={};_0x1f62d4[_0xb3f6('0x36')]=_[_0xb3f6('0x35')](db['VoiceRecording'][_0xb3f6('0x4b')]);_0x1f62d4[_0xb3f6('0x34')]=_[_0xb3f6('0x35')](_0x354bd1[_0xb3f6('0x34')]);_0x1f62d4[_0xb3f6('0x4c')]=_[_0xb3f6('0x38')](_0x1f62d4[_0xb3f6('0x36')],_0x1f62d4[_0xb3f6('0x34')]);_0x362f47[_0xb3f6('0x37')]=_[_0xb3f6('0x38')](_0x1f62d4[_0xb3f6('0x36')],qs[_0xb3f6('0x39')](_0x354bd1['query']['fields']));_0x362f47[_0xb3f6('0x37')]=_0x362f47[_0xb3f6('0x37')][_0xb3f6('0x3a')]?_0x362f47[_0xb3f6('0x37')]:_0x1f62d4['model'];if(_0x354bd1['query'][_0xb3f6('0x44')]){_0x362f47[_0xb3f6('0x45')]=[{'all':!![]}];}_0x362f47=_[_0xb3f6('0x41')]({},_0x362f47,_0x354bd1[_0xb3f6('0x43')]);return db[_0xb3f6('0x2f')]['find'](_0x362f47)[_0xb3f6('0x29')](handleEntityNotFound(_0x30b5e0,null))[_0xb3f6('0x29')](respondWithResult(_0x30b5e0,null))['catch'](handleError(_0x30b5e0,null));};exports[_0xb3f6('0x4d')]=function(_0x134588,_0x4cb6a3){return db[_0xb3f6('0x2f')][_0xb3f6('0x4d')](_0x134588['body'],{})[_0xb3f6('0x29')](respondWithResult(_0x4cb6a3,0xc9))[_0xb3f6('0x48')](handleError(_0x4cb6a3,null));};exports[_0xb3f6('0x28')]=function(_0x273e44,_0x5ef748){if(_0x273e44[_0xb3f6('0x4e')]['id']){delete _0x273e44[_0xb3f6('0x4e')]['id'];}return db[_0xb3f6('0x2f')][_0xb3f6('0x4f')]({'where':{'id':_0x273e44[_0xb3f6('0x4a')]['id']}})[_0xb3f6('0x29')](handleEntityNotFound(_0x5ef748,null))[_0xb3f6('0x29')](saveUpdates(_0x273e44[_0xb3f6('0x4e')],null))[_0xb3f6('0x29')](respondWithResult(_0x5ef748,null))[_0xb3f6('0x48')](handleError(_0x5ef748,null));};exports[_0xb3f6('0x50')]=function(_0x5d4973,_0x52f2da){return db[_0xb3f6('0x2f')][_0xb3f6('0x50')]()[_0xb3f6('0x29')](respondWithResult(_0x52f2da,null))[_0xb3f6('0x48')](handleError(_0x52f2da,null));};exports['download']=function(_0x79644a,_0x480e88,_0x4fc90a){var _0x227d94=require(_0xb3f6('0x51'));var _0x3c0b3f=![];var _0x104bc0={};if(_0x79644a['query'][_0xb3f6('0x30')]&&_0x79644a[_0xb3f6('0x34')][_0xb3f6('0x30')]==='uniqueid'){_0x104bc0[_0xb3f6('0x52')]=_0x79644a['params']['id'];}else{_0x104bc0['id']=_0x79644a['params']['id'];}return db[_0xb3f6('0x2f')][_0xb3f6('0x4f')]({'where':_0x104bc0,'attributes':['id',_0xb3f6('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x480e88,null))[_0xb3f6('0x29')](function(_0x5abded){if(_0x5abded){var _0x207985=_0x5abded[_0xb3f6('0x53')];var _0xccf8cf=util['format'](_0xb3f6('0x54'),_0x207985);if(fs[_0xb3f6('0x55')](_0xccf8cf)){_0x3c0b3f=!![];return _0x227d94['decryptFile'](_0xccf8cf,_0x207985,config[_0xb3f6('0x56')][_0xb3f6('0x57')])['then'](function(){return _0x5abded;});}return _0x5abded;}})['then'](function(_0x272408){if(_0x272408){var _0x4e2f0d=_0x272408['value'];if(!fs['existsSync'](_0x4e2f0d)){throw new db[(_0xb3f6('0x58'))]['ValidationError'](_0xb3f6('0x59'));}if(_0x272408[_0xb3f6('0x5a')]){return _0x480e88[_0xb3f6('0x5b')](_0x4e2f0d,_0x272408[_0xb3f6('0x5a')]+path['extname'](_0x4e2f0d),function(){if(_0x3c0b3f){fs[_0xb3f6('0x5c')](_0x4e2f0d);}});}else{return _0x480e88[_0xb3f6('0x5b')](_0x4e2f0d,function(_0x3b6c98){if(_0x3c0b3f){fs['unlink'](_0x4e2f0d);}});}}})[_0xb3f6('0x48')](function(_0x30f475){if(_0x30f475['message']===_0xb3f6('0x59')){_0x480e88[_0xb3f6('0x24')](0x194)['send'](_0xb3f6('0x5d'));}else{return handleError(_0x480e88,null);}});};exports[_0xb3f6('0x5e')]=function(_0x35ae6f,_0x5560b9,_0x216fd0){var _0x5baef7=require(_0xb3f6('0x51'));var _0x250be1=![];var _0x2f64ff={'$and':[db[_0xb3f6('0x5f')][_0xb3f6('0x3e')](db['sequelize']['fn'](_0xb3f6('0x60'),db[_0xb3f6('0x5f')][_0xb3f6('0x61')]('uniqueid')),_0x35ae6f[_0xb3f6('0x34')][_0xb3f6('0x62')])]};if(_0x35ae6f[_0xb3f6('0x34')]['type']&&_0x35ae6f[_0xb3f6('0x34')][_0xb3f6('0x30')]===_0xb3f6('0x52')){_0x2f64ff['$and'][_0xb3f6('0x63')]({'uniqueid':_0x35ae6f[_0xb3f6('0x4a')]['id']});}else{_0x2f64ff[_0xb3f6('0x64')][_0xb3f6('0x63')]({'id':_0x35ae6f[_0xb3f6('0x4a')]['id']});}return db[_0xb3f6('0x2f')]['find']({'where':_0x2f64ff,'attributes':['id',_0xb3f6('0x53')],'raw':!![]})[_0xb3f6('0x29')](handleEntityNotFound(_0x5560b9,null))[_0xb3f6('0x29')](function(_0x522c45){if(_0x522c45){var _0x166011=util['format'](_0xb3f6('0x54'),_0x522c45[_0xb3f6('0x53')]);if(fs[_0xb3f6('0x55')](_0x166011)){_0x250be1=!![];return _0x5baef7[_0xb3f6('0x65')](_0x166011,_0x522c45['value'],config['secrets'][_0xb3f6('0x57')])[_0xb3f6('0x29')](function(){return _0x522c45;});}return _0x522c45;}})[_0xb3f6('0x29')](function(_0x2a0204){if(_0x2a0204){if(!fs[_0xb3f6('0x55')](_0x2a0204['value'])){throw new db[(_0xb3f6('0x58'))]['ValidationError'](_0xb3f6('0x59'));}if(_0x2a0204['filename']){return _0x5560b9['download'](_0x2a0204['value'],_0x2a0204['filename']+path[_0xb3f6('0x66')](_0x2a0204[_0xb3f6('0x53')]),function(){if(_0x250be1){fs[_0xb3f6('0x5c')](_0x2a0204[_0xb3f6('0x53')]);}});}else{return _0x5560b9['download'](_0x2a0204[_0xb3f6('0x53')],function(_0x12c350){if(_0x250be1){fs[_0xb3f6('0x5c')](_0x2a0204[_0xb3f6('0x53')]);}});}}})[_0xb3f6('0x48')](handleError(_0x5560b9,null));};exports[_0xb3f6('0x2a')]=function(_0x5c9241,_0x1eadb6){return db[_0xb3f6('0x2f')]['find']({'where':{'id':_0x5c9241[_0xb3f6('0x4a')]['id']}})[_0xb3f6('0x29')](function(_0x11a9f9){if(_['isNil'](_0x11a9f9)){throw new ReferenceError(_0xb3f6('0x67'));}return _0x11a9f9;})[_0xb3f6('0x29')](function(_0x2eebb6){var _0x420069=_0x2eebb6[_0xb3f6('0x53')];logger[_0xb3f6('0x68')](_0xb3f6('0x69'),_0x420069);if(!_['isNil'](_0x2eebb6[_0xb3f6('0x53')])&&fs[_0xb3f6('0x55')](_0x420069)){logger[_0xb3f6('0x68')](_0xb3f6('0x6a')+_0x420069+_0xb3f6('0x6b'));fs[_0xb3f6('0x6c')](_0x420069);}_0x420069=_0x420069+_0xb3f6('0x6d');if(!_[_0xb3f6('0x6e')](_0x2eebb6[_0xb3f6('0x53')])&&fs[_0xb3f6('0x55')](_0x420069)){logger[_0xb3f6('0x68')]('File:\x20\x22'+_0x420069+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb3f6('0x6c')](_0x420069);}return _0x2eebb6;})[_0xb3f6('0x29')](function(_0x4ac342){if(!_0x4ac342)throw new InternalError();return _0x4ac342[_0xb3f6('0x2a')]();})[_0xb3f6('0x29')](function(){_0x1eadb6['status'](0xcc)['end']();})[_0xb3f6('0x48')](handleError(_0x1eadb6,null));};function getBucketslist(_0x30e929,_0x2d4ff0,_0x5911cb){return new Promise(function(_0x1b1012,_0x109412){var _0x24ef8c=new AWS['S3']({'accessKeyId':_0x2d4ff0,'secretAccessKey':_0x30e929,'region':_0x5911cb});_0x24ef8c[_0xb3f6('0x6f')]({},function(_0x16489a,_0x5a7783){if(_0x16489a){return _0x109412(_0x16489a);}else{return _0x1b1012(_0x5a7783);}});});}function createBucket(_0x28d18e,_0x4e5efe,_0x586075,_0x2e3ddf){return new Promise(function(_0x258710,_0x505410){var _0x2f224e=new AWS['S3']({'accessKeyId':_0x4e5efe,'secretAccessKey':_0x28d18e,'region':_0x586075});_0x2f224e[_0xb3f6('0x70')]({'Bucket':_0x2e3ddf},function(_0x1b83c1,_0x20b653){if(_0x1b83c1){return _0x505410(_0x1b83c1);}else{return _0x258710(_0x20b653);}});});}function uploadFile(_0x1fda49,_0x4d7c93,_0x27142c,_0x307153,_0x2a167c,_0x5a75b6){return new Promise(function(_0x5dbd42,_0x59fccb){var _0x371032=new AWS['S3']({'accessKeyId':_0x4d7c93,'secretAccessKey':_0x1fda49,'region':_0x27142c});_0x371032[_0xb3f6('0x71')]({'Bucket':_0x307153,'Key':_0x2a167c,'Body':_0x5a75b6},function(_0x297be9,_0x95e948){if(_0x297be9){return _0x59fccb(_0x297be9);}else{return _0x5dbd42(_0x95e948);}});});}function startTranscribe(_0x3c3e24,_0x5261a0,_0x4ed285,_0x10fbd5,_0xe55cae,_0x51f2c6){return new Promise(function(_0x822cb8,_0x2e96d1){var _0x5f1dbe=new AWS['TranscribeService']({'accessKeyId':_0x5261a0,'secretAccessKey':_0x3c3e24,'region':_0x4ed285});_0x5f1dbe['startTranscriptionJob']({'TranscriptionJobName':_0x10fbd5,'LanguageCode':_0xe55cae,'Media':{'MediaFileUri':_0x51f2c6}},function(_0x276ae4,_0x586cf4){if(_0x276ae4){return _0x2e96d1(_0x276ae4);}else{return _0x822cb8(_0x586cf4);}});});}function transcribe(_0x44af61,_0xa80dc0,_0x170725,_0x5d8900,_0x485bff,_0x3b849a,_0x4bd9e3){return new Promise(function(_0x48a923,_0x194459){var _0x5ed13e={};logger[_0xb3f6('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x44af61,_0x485bff));return uploadFile(_0xa80dc0,_0x170725,_0x5d8900,_0x485bff,path[_0xb3f6('0x72')](_0x3b849a),fs[_0xb3f6('0x73')](_0x3b849a))[_0xb3f6('0x29')](function(_0x4b7bc9){logger[_0xb3f6('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x44af61,_0x485bff,_0x4b7bc9['Location']));_0x5ed13e[_0xb3f6('0x74')]=_0x4b7bc9[_0xb3f6('0x75')];_0x5ed13e[_0xb3f6('0x76')]=_0x4b7bc9[_0xb3f6('0x77')];logger[_0xb3f6('0x68')](util[_0xb3f6('0x33')](_0xb3f6('0x78'),_0x44af61));return startTranscribe(_0xa80dc0,_0x170725,_0x5d8900,uuidv4(),_0x4bd9e3,_0x4b7bc9[_0xb3f6('0x77')]);})[_0xb3f6('0x29')](function(_0x42e2ca){logger[_0xb3f6('0x68')](util['format'](_0xb3f6('0x79'),_0x44af61,_0x42e2ca[_0xb3f6('0x7a')][_0xb3f6('0x7b')]));_0x5ed13e[_0xb3f6('0x7c')]=_0x42e2ca[_0xb3f6('0x7a')]['TranscriptionJobName'];_0x5ed13e[_0xb3f6('0x7d')]=_0x42e2ca[_0xb3f6('0x7a')][_0xb3f6('0x7e')];return _0x48a923(_0x5ed13e);})[_0xb3f6('0x48')](function(_0x34e12f){return _0x194459(_0x34e12f);});});}exports[_0xb3f6('0x7f')]=function(_0x4c96e3,_0x3fbd30,_0xb3a8af){var _0x23ce4a;var _0x4e7891;var _0x3214db;var _0x35bbbe=require(_0xb3f6('0x51'));return db['VoiceRecording'][_0xb3f6('0x80')]({'where':{'id':_0x4c96e3['params']['id']}})[_0xb3f6('0x29')](function(_0xee87f9){if(_0xee87f9){var _0x10d698=util[_0xb3f6('0x33')](_0xb3f6('0x54'),_0xee87f9[_0xb3f6('0x53')]);if(fs[_0xb3f6('0x55')](_0x10d698)){cypher=!![];return _0x35bbbe[_0xb3f6('0x65')](_0x10d698,_0xee87f9[_0xb3f6('0x53')],config['secrets'][_0xb3f6('0x57')])['then'](function(){return _0xee87f9;});}return _0xee87f9;}})['then'](function(_0x2f0f93){if(!_0x2f0f93){throw new db[(_0xb3f6('0x58'))][(_0xb3f6('0x81'))](_0xb3f6('0x82'));}_0x4e7891=_0x2f0f93;return db[_0xb3f6('0x83')]['findOne']({'where':{'id':0x1}});})[_0xb3f6('0x29')](handleEntityNotFound(_0x3fbd30,null))[_0xb3f6('0x29')](function(_0x2bddb9){if(_0x2bddb9){_0x23ce4a=_0x2bddb9;if(!_0x23ce4a[_0xb3f6('0x84')]||!_0x23ce4a[_0xb3f6('0x85')]||!_0x23ce4a[_0xb3f6('0x86')]||!_0x23ce4a[_0xb3f6('0x87')]||!_0x23ce4a['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x4c96e3['body']['runSentiment']&&(!_0x23ce4a['sentiment']||!_0x23ce4a[_0xb3f6('0x88')]||!_0x23ce4a[_0xb3f6('0x89')]||!_0x23ce4a[_0xb3f6('0x87')]||!_0x23ce4a[_0xb3f6('0x74')])){throw new db[(_0xb3f6('0x58'))][(_0xb3f6('0x81'))](_0xb3f6('0x8a'));}return db[_0xb3f6('0x8b')][_0xb3f6('0x80')]({'where':{'id':_0x23ce4a[_0xb3f6('0x85')]}});}})[_0xb3f6('0x29')](function(_0x30ddf6){if(!_0x30ddf6){throw new db[(_0xb3f6('0x58'))]['ValidationError'](_0xb3f6('0x8c'));}if(!_0x30ddf6[_0xb3f6('0x8d')]||!_0x30ddf6['data2']){throw new db['Sequelize']['ValidationError'](_0xb3f6('0x8e'));}_0x3214db=_0x30ddf6;return getBucketslist(_0x3214db['data1'],_0x3214db[_0xb3f6('0x8f')],_0x23ce4a[_0xb3f6('0x86')]);})[_0xb3f6('0x29')](function(_0x14da42){if(_0x14da42&&_0x14da42[_0xb3f6('0x90')]){var _0x292bb0=_['find'](_0x14da42[_0xb3f6('0x90')],function(_0x3b2701){return _0x3b2701[_0xb3f6('0x91')]===_0x23ce4a[_0xb3f6('0x74')];});if(!_0x292bb0){logger[_0xb3f6('0x68')](util[_0xb3f6('0x33')](_0xb3f6('0x92'),_0x4c96e3['params']['id'],_0x23ce4a[_0xb3f6('0x74')]));return createBucket(_0x3214db[_0xb3f6('0x8d')],_0x3214db[_0xb3f6('0x8f')],_0x23ce4a['transcribeRegion'],_0x23ce4a[_0xb3f6('0x74')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4c96e3[_0xb3f6('0x4a')]['id'],_0x23ce4a['bucket']));return;}})[_0xb3f6('0x29')](function(_0x490142){if(_0x4e7891[_0xb3f6('0x7d')]==='NEW'){return transcribe(_0x4c96e3['params']['id'],_0x3214db[_0xb3f6('0x8d')],_0x3214db['data2'],_0x23ce4a['transcribeRegion'],_0x23ce4a['bucket'],_0x4e7891[_0xb3f6('0x53')],_0x23ce4a['language']);}else{logger[_0xb3f6('0x68')](util['format'](_0xb3f6('0x93'),_0x4c96e3[_0xb3f6('0x4a')]['id']));return{'transcribeStatus':_0xb3f6('0x94')};}})[_0xb3f6('0x29')](function(_0x3d0745){if(_0x3d0745){_0x3d0745[_0xb3f6('0x95')]=_0x4c96e3[_0xb3f6('0x4e')][_0xb3f6('0x96')];return _0x4e7891['updateAttributes'](_0x3d0745);}})[_0xb3f6('0x29')](respondWithResult(_0x3fbd30,null))[_0xb3f6('0x48')](handleError(_0x3fbd30,null));};function writeFile(_0x29d4ac,_0x145006){return new Promise(function(_0x5b64b8,_0x3a24a0){fs[_0xb3f6('0x97')](_0x145006,_0x29d4ac,function(_0x544e4e,_0x2e860d){if(_0x544e4e){return _0x3a24a0(_0x544e4e);}else{return _0x5b64b8(_0x2e860d);}});});}exports[_0xb3f6('0x98')]=function(_0x48e3cb,_0x45e768,_0xf8f17a){return db[_0xb3f6('0x2f')][_0xb3f6('0x80')]({'where':{'id':_0x48e3cb[_0xb3f6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45e768))[_0xb3f6('0x29')](function(_0xb5a56d){if(_0xb5a56d&&_0xb5a56d['fileText']){var _0x130323=_0xb5a56d['fileText'];var _0x514b27=config[_0xb3f6('0x99')]+'/server/files/transcribes/transcribe_'+_0xb5a56d['id']+_0xb3f6('0x9a');if(fs['existsSync'](_0x514b27)){return _0x514b27;}return writeFile(_0x130323,_0x514b27)[_0xb3f6('0x29')](function(){return _0x514b27;});}else{throw new db['Sequelize'][(_0xb3f6('0x81'))](_0xb3f6('0x9b'));}})[_0xb3f6('0x29')](function(_0xe369ec){return _0x45e768[_0xb3f6('0x5b')](_0xe369ec);})['catch'](handleError(_0x45e768));}; \ No newline at end of file +var _0xb90c=['Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','.txt','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','key','format','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','../../components/encryptor','sequelize','col','token','$and','push','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','bucket','ValidationError','runSentiment','sentiment','sentimentAccountId'];(function(_0xd07790,_0x3db009){var _0x32f10e=function(_0x1f4911){while(--_0x1f4911){_0xd07790['push'](_0xd07790['shift']());}};_0x32f10e(++_0x3db009);}(_0xb90c,0x140));var _0xcb90=function(_0x12d121,_0x1ef59d){_0x12d121=_0x12d121-0x0;var _0x1af836=_0xb90c[_0x12d121];return _0x1af836;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb90('0x1'));var rp=require(_0xcb90('0x2'));var moment=require(_0xcb90('0x3'));var BPromise=require(_0xcb90('0x4'));var Mustache=require(_0xcb90('0x5'));var util=require(_0xcb90('0x6'));var path=require('path');var sox=require(_0xcb90('0x7'));var csv=require(_0xcb90('0x8'));var ejs=require(_0xcb90('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcb90('0xa'));var crypto=require(_0xcb90('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcb90('0xc'));var toCsv=require(_0xcb90('0x8'));var querystring=require('querystring');var Papa=require(_0xcb90('0xd'));var AWS=require(_0xcb90('0xe'));var uuidv4=require(_0xcb90('0xf'));var Redis=require(_0xcb90('0x10'));var authService=require(_0xcb90('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcb90('0x12'));var hardwareService=require(_0xcb90('0x13'));var logger=require(_0xcb90('0x14'))(_0xcb90('0x15'));var utils=require('../../config/utils');var config=require(_0xcb90('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb90('0x17'))['db'];function respondWithStatusCode(_0x2a9dcb,_0x47cd90){_0x47cd90=_0x47cd90||0xcc;return function(_0x50bcaa){if(_0x50bcaa){return _0x2a9dcb[_0xcb90('0x18')](_0x47cd90);}return _0x2a9dcb[_0xcb90('0x19')](_0x47cd90)[_0xcb90('0x1a')]();};}function respondWithResult(_0x44c28a,_0x376483){_0x376483=_0x376483||0xc8;return function(_0x10a052){if(_0x10a052){return _0x44c28a[_0xcb90('0x19')](_0x376483)[_0xcb90('0x1b')](_0x10a052);}};}function respondWithFilteredResult(_0x421813,_0x8fce9){return function(_0x326851){if(_0x326851){var _0x4e619=typeof _0x8fce9[_0xcb90('0x1c')]===_0xcb90('0x1d')&&typeof _0x8fce9['limit']===_0xcb90('0x1d');var _0x2b7667=_0x326851[_0xcb90('0x1e')];var _0x1667e8=_0x4e619?0x0:_0x8fce9[_0xcb90('0x1c')];var _0x2e8458=_0x4e619?_0x326851[_0xcb90('0x1e')]:_0x8fce9[_0xcb90('0x1c')]+_0x8fce9[_0xcb90('0x1f')];var _0x7242bd;if(_0x2e8458>=_0x2b7667){_0x2e8458=_0x2b7667;_0x7242bd=0xc8;}else{_0x7242bd=0xce;}_0x421813[_0xcb90('0x19')](_0x7242bd);return _0x421813[_0xcb90('0x20')](_0xcb90('0x21'),_0x1667e8+'-'+_0x2e8458+'/'+_0x2b7667)[_0xcb90('0x1b')](_0x326851);}return null;};}function patchUpdates(_0x138aa7){return function(_0x5dc8bc){try{jsonpatch[_0xcb90('0x22')](_0x5dc8bc,_0x138aa7,!![]);}catch(_0x7e6b68){return BPromise['reject'](_0x7e6b68);}return _0x5dc8bc[_0xcb90('0x23')]();};}function saveUpdates(_0x4c46db,_0x175dc2){return function(_0x245e21){if(_0x245e21){return _0x245e21[_0xcb90('0x24')](_0x4c46db)['then'](function(_0xdd9be9){return _0xdd9be9;});}return null;};}function removeEntity(_0x1ab5fe,_0x5d995c){return function(_0x50983c){if(_0x50983c){return _0x50983c[_0xcb90('0x25')]()[_0xcb90('0x26')](function(){_0x1ab5fe[_0xcb90('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3c76,_0x3bd764){return function(_0x24b742){if(!_0x24b742){_0xd3c76['sendStatus'](0x194);}return _0x24b742;};}function handleError(_0x3d9bef,_0x49561a){_0x49561a=_0x49561a||0x1f4;return function(_0x42b72a){logger[_0xcb90('0x27')](_0x42b72a[_0xcb90('0x28')]);if(_0x42b72a[_0xcb90('0x29')]){delete _0x42b72a['name'];}_0x3d9bef[_0xcb90('0x19')](_0x49561a)[_0xcb90('0x2a')](_0x42b72a);};}exports['index']=function(_0xf956bf,_0x3c1e7c){var _0x2fb75b={},_0x53ce84={},_0x4cb0c1={'count':0x0,'rows':[]};var _0x3235e9=_[_0xcb90('0x2b')](db[_0xcb90('0x2c')][_0xcb90('0x2d')],function(_0xf4fd65){return{'name':_0xf4fd65[_0xcb90('0x2e')],'type':_0xf4fd65['type'][_0xcb90('0x2f')]};});_0x53ce84['model']=_['differenceBy'](_[_0xcb90('0x2b')](_0x3235e9,_0xcb90('0x29')),[_0xcb90('0x30')]);_0x53ce84[_0xcb90('0x31')]=_[_0xcb90('0x32')](_0xf956bf[_0xcb90('0x31')]);_0x53ce84['filters']=_[_0xcb90('0x33')](_0x53ce84[_0xcb90('0x34')],_0x53ce84[_0xcb90('0x31')]);_0x2fb75b[_0xcb90('0x35')]=_[_0xcb90('0x33')](_0x53ce84[_0xcb90('0x34')],qs[_0xcb90('0x36')](_0xf956bf[_0xcb90('0x31')]['fields']));_0x2fb75b['attributes']=_0x2fb75b[_0xcb90('0x35')][_0xcb90('0x37')]?_0x2fb75b[_0xcb90('0x35')]:_0x53ce84[_0xcb90('0x34')];if(!_0xf956bf['query']['hasOwnProperty'](_0xcb90('0x38'))){_0x2fb75b['limit']=qs[_0xcb90('0x1f')](_0xf956bf[_0xcb90('0x31')][_0xcb90('0x1f')]);_0x2fb75b['offset']=qs[_0xcb90('0x1c')](_0xf956bf[_0xcb90('0x31')][_0xcb90('0x1c')]);}_0x2fb75b[_0xcb90('0x39')]=qs[_0xcb90('0x3a')](_0xf956bf['query'][_0xcb90('0x3a')]);_0x2fb75b[_0xcb90('0x3b')]=qs[_0xcb90('0x3c')](_[_0xcb90('0x3d')](_0xf956bf[_0xcb90('0x31')],_0x53ce84['filters']),_0x3235e9);if(_0xf956bf['query'][_0xcb90('0x3e')]){_0x2fb75b[_0xcb90('0x3b')]=_[_0xcb90('0x3f')](_0x2fb75b[_0xcb90('0x3b')],{'$or':_[_0xcb90('0x2b')](_0x3235e9,function(_0x2e5247){if(_0x2e5247[_0xcb90('0x40')]!==_0xcb90('0x41')){var _0x2ac75c={};_0x2ac75c[_0x2e5247[_0xcb90('0x29')]]={'$like':'%'+_0xf956bf['query'][_0xcb90('0x3e')]+'%'};return _0x2ac75c;}})});}_0x2fb75b=_['merge']({},_0x2fb75b,_0xf956bf[_0xcb90('0x42')]);var _0x3612bd={'where':_0x2fb75b[_0xcb90('0x3b')]};return db[_0xcb90('0x2c')][_0xcb90('0x1e')](_0x3612bd)['then'](function(_0x976955){_0x4cb0c1['count']=_0x976955;if(_0xf956bf[_0xcb90('0x31')][_0xcb90('0x43')]){_0x2fb75b[_0xcb90('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0xcb90('0x45')](_0x2fb75b);})[_0xcb90('0x26')](function(_0x42760d){_0x4cb0c1[_0xcb90('0x46')]=_0x42760d;return _0x4cb0c1;})[_0xcb90('0x26')](respondWithFilteredResult(_0x3c1e7c,_0x2fb75b))['catch'](handleError(_0x3c1e7c,null));};exports[_0xcb90('0x47')]=function(_0x1f174e,_0x37c156){var _0x42f12e={'raw':![],'where':{'id':_0x1f174e[_0xcb90('0x48')]['id']}},_0x504715={};_0x504715[_0xcb90('0x34')]=_['keys'](db['VoiceRecording'][_0xcb90('0x2d')]);_0x504715[_0xcb90('0x31')]=_[_0xcb90('0x32')](_0x1f174e[_0xcb90('0x31')]);_0x504715[_0xcb90('0x3c')]=_[_0xcb90('0x33')](_0x504715['model'],_0x504715['query']);_0x42f12e[_0xcb90('0x35')]=_[_0xcb90('0x33')](_0x504715[_0xcb90('0x34')],qs['fields'](_0x1f174e[_0xcb90('0x31')][_0xcb90('0x36')]));_0x42f12e[_0xcb90('0x35')]=_0x42f12e[_0xcb90('0x35')][_0xcb90('0x37')]?_0x42f12e[_0xcb90('0x35')]:_0x504715[_0xcb90('0x34')];if(_0x1f174e[_0xcb90('0x31')][_0xcb90('0x43')]){_0x42f12e[_0xcb90('0x44')]=[{'all':!![]}];}_0x42f12e=_[_0xcb90('0x3f')]({},_0x42f12e,_0x1f174e[_0xcb90('0x42')]);return db[_0xcb90('0x2c')][_0xcb90('0x49')](_0x42f12e)[_0xcb90('0x26')](handleEntityNotFound(_0x37c156,null))[_0xcb90('0x26')](respondWithResult(_0x37c156,null))[_0xcb90('0x4a')](handleError(_0x37c156,null));};exports['create']=function(_0x352eda,_0x313c4f){return db['VoiceRecording'][_0xcb90('0x4b')](_0x352eda[_0xcb90('0x4c')],{})[_0xcb90('0x26')](respondWithResult(_0x313c4f,0xc9))[_0xcb90('0x4a')](handleError(_0x313c4f,null));};exports[_0xcb90('0x24')]=function(_0x57328e,_0x456ac2){if(_0x57328e[_0xcb90('0x4c')]['id']){delete _0x57328e[_0xcb90('0x4c')]['id'];}return db[_0xcb90('0x2c')]['find']({'where':{'id':_0x57328e[_0xcb90('0x48')]['id']}})[_0xcb90('0x26')](handleEntityNotFound(_0x456ac2,null))['then'](saveUpdates(_0x57328e[_0xcb90('0x4c')],null))[_0xcb90('0x26')](respondWithResult(_0x456ac2,null))['catch'](handleError(_0x456ac2,null));};exports[_0xcb90('0x4d')]=function(_0x4fc9ea,_0x320231){return db[_0xcb90('0x2c')][_0xcb90('0x4d')]()[_0xcb90('0x26')](respondWithResult(_0x320231,null))['catch'](handleError(_0x320231,null));};exports[_0xcb90('0x4e')]=function(_0x3bd402,_0x375e9f,_0x2100d9){var _0x5b3836=require('../../components/encryptor');var _0xa134a6=![];var _0x52b27d={};if(_0x3bd402['query'][_0xcb90('0x40')]&&_0x3bd402['query'][_0xcb90('0x40')]==='uniqueid'){_0x52b27d[_0xcb90('0x4f')]=_0x3bd402[_0xcb90('0x48')]['id'];}else{_0x52b27d['id']=_0x3bd402[_0xcb90('0x48')]['id'];}return db['VoiceRecording'][_0xcb90('0x49')]({'where':_0x52b27d,'attributes':['id',_0xcb90('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x375e9f,null))['then'](function(_0x2fd2a9){if(_0x2fd2a9){var _0x293ecc=_0x2fd2a9[_0xcb90('0x50')];var _0x50c399=util[_0xcb90('0x30')](_0xcb90('0x51'),_0x293ecc);if(fs[_0xcb90('0x52')](_0x50c399)){_0xa134a6=!![];return _0x5b3836[_0xcb90('0x53')](_0x50c399,_0x293ecc,config[_0xcb90('0x54')][_0xcb90('0x55')])['then'](function(){return _0x2fd2a9;});}return _0x2fd2a9;}})[_0xcb90('0x26')](function(_0x772f65){if(_0x772f65){var _0x101b17=_0x772f65[_0xcb90('0x50')];if(!fs[_0xcb90('0x52')](_0x101b17)){throw new db[(_0xcb90('0x56'))]['ValidationError'](_0xcb90('0x57'));}if(_0x772f65['filename']){return _0x375e9f[_0xcb90('0x4e')](_0x101b17,_0x772f65[_0xcb90('0x58')]+path[_0xcb90('0x59')](_0x101b17),function(){if(_0xa134a6){fs[_0xcb90('0x5a')](_0x101b17);}});}else{return _0x375e9f[_0xcb90('0x4e')](_0x101b17,function(_0x599699){if(_0xa134a6){fs[_0xcb90('0x5a')](_0x101b17);}});}}})[_0xcb90('0x4a')](function(_0x3cd527){if(_0x3cd527['message']===_0xcb90('0x57')){_0x375e9f[_0xcb90('0x19')](0x194)[_0xcb90('0x2a')](_0xcb90('0x5b'));}else{return handleError(_0x375e9f,null);}});};exports['downloads']=function(_0x4b975f,_0x252147,_0x34ebe5){var _0x25fa12=require(_0xcb90('0x5c'));var _0x14f060=![];var _0xe1d2b2={'$and':[db[_0xcb90('0x5d')][_0xcb90('0x3b')](db['sequelize']['fn']('MD5',db[_0xcb90('0x5d')][_0xcb90('0x5e')](_0xcb90('0x4f'))),_0x4b975f[_0xcb90('0x31')][_0xcb90('0x5f')])]};if(_0x4b975f['query'][_0xcb90('0x40')]&&_0x4b975f[_0xcb90('0x31')][_0xcb90('0x40')]===_0xcb90('0x4f')){_0xe1d2b2[_0xcb90('0x60')]['push']({'uniqueid':_0x4b975f[_0xcb90('0x48')]['id']});}else{_0xe1d2b2[_0xcb90('0x60')][_0xcb90('0x61')]({'id':_0x4b975f[_0xcb90('0x48')]['id']});}return db[_0xcb90('0x2c')][_0xcb90('0x49')]({'where':_0xe1d2b2,'attributes':['id',_0xcb90('0x50')],'raw':!![]})[_0xcb90('0x26')](handleEntityNotFound(_0x252147,null))['then'](function(_0x5ae755){if(_0x5ae755){var _0x26e25a=util[_0xcb90('0x30')](_0xcb90('0x51'),_0x5ae755['value']);if(fs[_0xcb90('0x52')](_0x26e25a)){_0x14f060=!![];return _0x25fa12[_0xcb90('0x53')](_0x26e25a,_0x5ae755[_0xcb90('0x50')],config[_0xcb90('0x54')][_0xcb90('0x55')])[_0xcb90('0x26')](function(){return _0x5ae755;});}return _0x5ae755;}})[_0xcb90('0x26')](function(_0x50e270){if(_0x50e270){if(!fs[_0xcb90('0x52')](_0x50e270[_0xcb90('0x50')])){throw new db[(_0xcb90('0x56'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x50e270[_0xcb90('0x58')]){return _0x252147['download'](_0x50e270[_0xcb90('0x50')],_0x50e270[_0xcb90('0x58')]+path[_0xcb90('0x59')](_0x50e270['value']),function(){if(_0x14f060){fs[_0xcb90('0x5a')](_0x50e270[_0xcb90('0x50')]);}});}else{return _0x252147[_0xcb90('0x4e')](_0x50e270[_0xcb90('0x50')],function(_0x4307b0){if(_0x14f060){fs[_0xcb90('0x5a')](_0x50e270['value']);}});}}})['catch'](handleError(_0x252147,null));};exports[_0xcb90('0x25')]=function(_0x9c7b5c,_0x49583f){return db[_0xcb90('0x2c')][_0xcb90('0x49')]({'where':{'id':_0x9c7b5c[_0xcb90('0x48')]['id']}})[_0xcb90('0x26')](function(_0x1bfd21){if(_['isNil'](_0x1bfd21)){throw new ReferenceError(_0xcb90('0x62'));}return _0x1bfd21;})[_0xcb90('0x26')](function(_0x130a58){var _0x408a31=_0x130a58['value'];logger[_0xcb90('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x408a31);if(!_[_0xcb90('0x64')](_0x130a58[_0xcb90('0x50')])&&fs['existsSync'](_0x408a31)){logger['info']('File:\x20\x22'+_0x408a31+_0xcb90('0x65'));fs[_0xcb90('0x66')](_0x408a31);}_0x408a31=_0x408a31+_0xcb90('0x67');if(!_['isNil'](_0x130a58[_0xcb90('0x50')])&&fs[_0xcb90('0x52')](_0x408a31)){logger['info'](_0xcb90('0x68')+_0x408a31+_0xcb90('0x65'));fs[_0xcb90('0x66')](_0x408a31);}return _0x130a58;})['then'](function(_0x7f2300){if(!_0x7f2300)throw new InternalError();return _0x7f2300[_0xcb90('0x25')]();})['then'](function(){_0x49583f[_0xcb90('0x19')](0xcc)[_0xcb90('0x1a')]();})['catch'](handleError(_0x49583f,null));};function getBucketslist(_0x2ec259,_0x4723a5,_0x385941){return new Promise(function(_0x365b94,_0xf59fdc){var _0x2a98c3=new AWS['S3']({'accessKeyId':_0x4723a5,'secretAccessKey':_0x2ec259,'region':_0x385941});_0x2a98c3[_0xcb90('0x69')]({},function(_0x389199,_0x209f09){if(_0x389199){return _0xf59fdc(_0x389199);}else{return _0x365b94(_0x209f09);}});});}function createBucket(_0x5bb1ed,_0x1e1f60,_0x3cf344,_0x5960c8){return new Promise(function(_0x5d49e7,_0x1e94bc){var _0xef4c20=new AWS['S3']({'accessKeyId':_0x1e1f60,'secretAccessKey':_0x5bb1ed,'region':_0x3cf344});_0xef4c20[_0xcb90('0x6a')]({'Bucket':_0x5960c8},function(_0xe17798,_0x4bd7f0){if(_0xe17798){return _0x1e94bc(_0xe17798);}else{return _0x5d49e7(_0x4bd7f0);}});});}function uploadFile(_0x3a9a85,_0x2e7e4a,_0x1180a2,_0x113488,_0x461181,_0x3f163f){return new Promise(function(_0x3dd42a,_0x526aa5){var _0x4d50e8=new AWS['S3']({'accessKeyId':_0x2e7e4a,'secretAccessKey':_0x3a9a85,'region':_0x1180a2});_0x4d50e8['upload']({'Bucket':_0x113488,'Key':_0x461181,'Body':_0x3f163f},function(_0x17b14d,_0xef7969){if(_0x17b14d){return _0x526aa5(_0x17b14d);}else{return _0x3dd42a(_0xef7969);}});});}function startTranscribe(_0x3cb8bd,_0x2e170b,_0x1882c0,_0x4ebec1,_0xadd8bd,_0x33b31b){return new Promise(function(_0x564129,_0x307f21){var _0x1cd43d=new AWS[(_0xcb90('0x6b'))]({'accessKeyId':_0x2e170b,'secretAccessKey':_0x3cb8bd,'region':_0x1882c0});_0x1cd43d[_0xcb90('0x6c')]({'TranscriptionJobName':_0x4ebec1,'LanguageCode':_0xadd8bd,'Media':{'MediaFileUri':_0x33b31b}},function(_0x2fd816,_0x44b826){if(_0x2fd816){return _0x307f21(_0x2fd816);}else{return _0x564129(_0x44b826);}});});}function transcribe(_0x177b1f,_0x2bcb5c,_0x4fcef1,_0x3a632c,_0xbe54ae,_0x24efa0,_0xe6d700){return new Promise(function(_0x12d64d,_0x3107c8){var _0x38b208={};logger[_0xcb90('0x63')](util[_0xcb90('0x30')](_0xcb90('0x6d'),_0x177b1f,_0xbe54ae));return uploadFile(_0x2bcb5c,_0x4fcef1,_0x3a632c,_0xbe54ae,path[_0xcb90('0x6e')](_0x24efa0),fs[_0xcb90('0x6f')](_0x24efa0))[_0xcb90('0x26')](function(_0x53d86b){logger[_0xcb90('0x63')](util['format'](_0xcb90('0x70'),_0x177b1f,_0xbe54ae,_0x53d86b[_0xcb90('0x71')]));_0x38b208['bucket']=_0x53d86b[_0xcb90('0x72')];_0x38b208[_0xcb90('0x73')]=_0x53d86b[_0xcb90('0x71')];logger[_0xcb90('0x63')](util[_0xcb90('0x30')](_0xcb90('0x74'),_0x177b1f));return startTranscribe(_0x2bcb5c,_0x4fcef1,_0x3a632c,uuidv4(),_0xe6d700,_0x53d86b[_0xcb90('0x71')]);})[_0xcb90('0x26')](function(_0x34364a){logger['info'](util[_0xcb90('0x30')](_0xcb90('0x75'),_0x177b1f,_0x34364a['TranscriptionJob'][_0xcb90('0x76')]));_0x38b208[_0xcb90('0x77')]=_0x34364a['TranscriptionJob'][_0xcb90('0x76')];_0x38b208['transcribeStatus']=_0x34364a[_0xcb90('0x78')][_0xcb90('0x79')];return _0x12d64d(_0x38b208);})[_0xcb90('0x4a')](function(_0x495548){return _0x3107c8(_0x495548);});});}exports[_0xcb90('0x7a')]=function(_0x1b0754,_0x4a81e5,_0x4f7e22){var _0x248a9e;var _0x49ddc4;var _0x315cde;var _0x8c344b=require(_0xcb90('0x5c'));return db[_0xcb90('0x2c')][_0xcb90('0x7b')]({'where':{'id':_0x1b0754[_0xcb90('0x48')]['id']}})['then'](function(_0x299620){if(_0x299620){var _0x18ca19=util[_0xcb90('0x30')](_0xcb90('0x51'),_0x299620['value']);if(fs[_0xcb90('0x52')](_0x18ca19)){cypher=!![];return _0x8c344b[_0xcb90('0x53')](_0x18ca19,_0x299620['value'],config[_0xcb90('0x54')][_0xcb90('0x55')])[_0xcb90('0x26')](function(){return _0x299620;});}return _0x299620;}})['then'](function(_0x3beda7){if(!_0x3beda7){throw new db['Sequelize']['ValidationError'](_0xcb90('0x7c'));}_0x49ddc4=_0x3beda7;return db[_0xcb90('0x7d')]['findOne']({'where':{'id':0x1}});})[_0xcb90('0x26')](handleEntityNotFound(_0x4a81e5,null))[_0xcb90('0x26')](function(_0x458974){if(_0x458974){_0x248a9e=_0x458974;if(!_0x248a9e['transcribe']||!_0x248a9e[_0xcb90('0x7e')]||!_0x248a9e['transcribeRegion']||!_0x248a9e[_0xcb90('0x7f')]||!_0x248a9e[_0xcb90('0x80')]){throw new db[(_0xcb90('0x56'))][(_0xcb90('0x81'))]('Transcribe\x20not\x20configured');}if(_0x1b0754[_0xcb90('0x4c')][_0xcb90('0x82')]&&(!_0x248a9e[_0xcb90('0x83')]||!_0x248a9e[_0xcb90('0x84')]||!_0x248a9e['sentimentRegion']||!_0x248a9e['language']||!_0x248a9e[_0xcb90('0x80')])){throw new db[(_0xcb90('0x56'))]['ValidationError'](_0xcb90('0x85'));}return db['CloudProvider'][_0xcb90('0x7b')]({'where':{'id':_0x248a9e[_0xcb90('0x7e')]}});}})[_0xcb90('0x26')](function(_0x53b354){if(!_0x53b354){throw new db[(_0xcb90('0x56'))][(_0xcb90('0x81'))](_0xcb90('0x86'));}if(!_0x53b354[_0xcb90('0x87')]||!_0x53b354[_0xcb90('0x88')]){throw new db[(_0xcb90('0x56'))][(_0xcb90('0x81'))]('Cloud\x20Provider\x20not\x20configured');}_0x315cde=_0x53b354;return getBucketslist(_0x315cde[_0xcb90('0x87')],_0x315cde[_0xcb90('0x88')],_0x248a9e['transcribeRegion']);})['then'](function(_0x3aaf09){if(_0x3aaf09&&_0x3aaf09['Buckets']){var _0x2bf1cb=_['find'](_0x3aaf09[_0xcb90('0x89')],function(_0x56d38e){return _0x56d38e[_0xcb90('0x8a')]===_0x248a9e['bucket'];});if(!_0x2bf1cb){logger['info'](util[_0xcb90('0x30')](_0xcb90('0x8b'),_0x1b0754[_0xcb90('0x48')]['id'],_0x248a9e[_0xcb90('0x80')]));return createBucket(_0x315cde[_0xcb90('0x87')],_0x315cde[_0xcb90('0x88')],_0x248a9e['transcribeRegion'],_0x248a9e['bucket']);}logger['info'](util[_0xcb90('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1b0754['params']['id'],_0x248a9e[_0xcb90('0x80')]));return;}})[_0xcb90('0x26')](function(_0x57c67e){if(_0x49ddc4[_0xcb90('0x8c')]===_0xcb90('0x8d')){return transcribe(_0x1b0754[_0xcb90('0x48')]['id'],_0x315cde[_0xcb90('0x87')],_0x315cde[_0xcb90('0x88')],_0x248a9e[_0xcb90('0x8e')],_0x248a9e[_0xcb90('0x80')],_0x49ddc4[_0xcb90('0x50')],_0x248a9e[_0xcb90('0x7f')]);}else{logger[_0xcb90('0x63')](util[_0xcb90('0x30')](_0xcb90('0x8f'),_0x1b0754[_0xcb90('0x48')]['id']));return{'transcribeStatus':_0xcb90('0x90')};}})[_0xcb90('0x26')](function(_0x18aebb){if(_0x18aebb){_0x18aebb[_0xcb90('0x91')]=_0x1b0754['body'][_0xcb90('0x82')];return _0x49ddc4[_0xcb90('0x92')](_0x18aebb);}})[_0xcb90('0x26')](respondWithResult(_0x4a81e5,null))[_0xcb90('0x4a')](handleError(_0x4a81e5,null));};function writeFile(_0x1acd7d,_0x59b8e1){return new Promise(function(_0x153903,_0x3334e6){fs[_0xcb90('0x93')](_0x59b8e1,_0x1acd7d,function(_0xc89809,_0x2ea283){if(_0xc89809){return _0x3334e6(_0xc89809);}else{return _0x153903(_0x2ea283);}});});}exports['downloadTranscribe']=function(_0x3246e9,_0x56d57b,_0x4dcce4){return db[_0xcb90('0x2c')]['findOne']({'where':{'id':_0x3246e9[_0xcb90('0x48')]['id']}})[_0xcb90('0x26')](handleEntityNotFound(_0x56d57b))[_0xcb90('0x26')](function(_0x44fb7d){if(_0x44fb7d&&_0x44fb7d[_0xcb90('0x94')]){var _0x538c17=_0x44fb7d['fileText'];var _0xa487fb=config['root']+'/server/files/transcribes/transcribe_'+_0x44fb7d['id']+_0xcb90('0x95');if(fs[_0xcb90('0x52')](_0xa487fb)){return _0xa487fb;}return writeFile(_0x538c17,_0xa487fb)['then'](function(){return _0xa487fb;});}else{throw new db['Sequelize']['ValidationError'](_0xcb90('0x96'));}})['then'](function(_0x5834a2){return _0x56d57b[_0xcb90('0x4e')](_0x5834a2);})[_0xcb90('0x4a')](handleError(_0x56d57b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index cfdf1bd..e779881 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 _0x0b40=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x274865,_0x206535){var _0x1af46d=function(_0xc8d547){while(--_0xc8d547){_0x274865['push'](_0x274865['shift']());}};_0x1af46d(++_0x206535);}(_0x0b40,0xba));var _0x00b4=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x0b40[_0x1147ab];return _0x55cb5a;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x00b4('0x0')]=function(_0x10719a,_0x53b8fd){return _0x10719a[_0x00b4('0x1')](_0x00b4('0x2'),attributes,{'tableName':_0x00b4('0x3'),'paranoid':![],'indexes':[{'name':_0x00b4('0x4'),'fields':[_0x00b4('0x4')]},{'name':_0x00b4('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb201=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x57b2ef,_0x2f3ad2){var _0x198ece=function(_0x565828){while(--_0x565828){_0x57b2ef['push'](_0x57b2ef['shift']());}};_0x198ece(++_0x2f3ad2);}(_0xb201,0x1b1));var _0x1b20=function(_0x17ea10,_0x24330e){_0x17ea10=_0x17ea10-0x0;var _0x362886=_0xb201[_0x17ea10];return _0x362886;};'use strict';var attributes=require(_0x1b20('0x0'));module['exports']=function(_0x333586,_0x1db4d5){return _0x333586[_0x1b20('0x1')](_0x1b20('0x2'),attributes,{'tableName':_0x1b20('0x3'),'paranoid':![],'indexes':[{'name':_0x1b20('0x4'),'fields':['uniqueid']},{'name':_0x1b20('0x5'),'fields':[_0x1b20('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9d2b1a8..30a9ebe 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 _0x3d04=['result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','debug','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','VoiceRecording,\x20%s,\x20%s','message','info'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['UpdateVoiceRecording']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['update'](_0x2c641e[_0x43d0('0x16')],{'raw':_0x2c641e[_0x43d0('0x17')]?_0x2c641e['options'][_0x43d0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x19')]||null:null,'attributes':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x1a')]||null:null,'limit':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x1b')]||null:null})[_0x43d0('0xd')](function(_0x19d2ff){logger[_0x43d0('0x13')](_0x43d0('0x1c'),_0x2c641e);logger[_0x43d0('0x1d')]('UpdateVoiceRecording',_0x2c641e,JSON[_0x43d0('0xf')](_0x19d2ff));_0x2c9d06(_0x19d2ff);})[_0x43d0('0x1e')](function(_0x509041){logger[_0x43d0('0x10')]('UpdateVoiceRecording',_0x509041[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402[_0x43d0('0x10')](0x1f4,_0x509041['message']));});});};exports[_0x43d0('0x1f')]=function(_0x238c64){var _0x5ac4c0=this;return new Promise(function(_0x12df30,_0x4692bc){var _0x22ae3c=require('../../components/encryptor');var _0x447725;return db[_0x43d0('0x20')][_0x43d0('0x21')]({'attributes':['id',_0x43d0('0x22')],'where':{'id':0x1},'raw':!![]})[_0x43d0('0xd')](function(_0x440ecb){_0x447725=_0x440ecb;return db[_0x43d0('0x15')]['create'](_0x238c64[_0x43d0('0x16')]);})[_0x43d0('0xd')](function(_0x6bc471){if(_0x447725['callRecordingEncryption']&&fs['existsSync'](_0x6bc471['value'])){var _0x3c1ea3=util[_0x43d0('0x23')](_0x43d0('0x24'),_0x6bc471[_0x43d0('0x25')]);return _0x22ae3c[_0x43d0('0x26')](_0x6bc471[_0x43d0('0x25')],_0x3c1ea3,config['secrets'][_0x43d0('0x27')])[_0x43d0('0xd')](function(){fs[_0x43d0('0x28')](_0x6bc471[_0x43d0('0x25')]);logger[_0x43d0('0x13')](_0x43d0('0x29'));return _0x6bc471;});}return _0x6bc471;})[_0x43d0('0xd')](function(_0x1bdd74){logger[_0x43d0('0x13')](_0x43d0('0x1f'),_0x238c64);logger[_0x43d0('0x1d')]('CreateVoiceRecording',_0x238c64,JSON[_0x43d0('0xf')](_0x1bdd74));_0x12df30(_0x1bdd74);})[_0x43d0('0x1e')](function(_0x45ec78){logger[_0x43d0('0x10')]('CreateVoiceRecording',_0x45ec78[_0x43d0('0x12')],_0x238c64);_0x4692bc(_0x5ac4c0['error'](0x1f4,_0x45ec78[_0x43d0('0x12')]));});});}; \ No newline at end of file +var _0xeb3b=['rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','attributes','limit','stringify','../../components/encryptor','findOne','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','debug','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x48291a,_0x5a29dc){var _0xf76871=function(_0x2a4be5){while(--_0x2a4be5){_0x48291a['push'](_0x48291a['shift']());}};_0xf76871(++_0x5a29dc);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xeb3b[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var BPromise=require(_0xbeb3('0x3'));var rs=require(_0xbeb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeb3('0x5'));var logger=require('../../config/logger')(_0xbeb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeb3('0x7'));var client=jayson[_0xbeb3('0x8')][_0xbeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294cc9,_0x406927,_0x143255){return new BPromise(function(_0x5a6a06,_0x241dbb){return client[_0xbeb3('0xa')](_0x294cc9,_0x143255)[_0xbeb3('0xb')](function(_0x3b61ac){logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,_0xbeb3('0xe'));logger['debug'](_0xbeb3('0xf'),_0x406927,_0xbeb3('0xe'),JSON['stringify'](_0x3b61ac));if(_0x3b61ac[_0xbeb3('0x10')]){if(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x11')]===0x1f4){logger[_0xbeb3('0x10')](_0xbeb3('0xd'),_0x406927,_0x3b61ac[_0xbeb3('0x10')]['message']);return _0x241dbb(_0x3b61ac['error'][_0xbeb3('0x12')]);}logger[_0xbeb3('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x406927,_0x3b61ac['error'][_0xbeb3('0x12')]);return _0x5a6a06(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x12')]);}else{logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,'request\x20sent');_0x5a6a06(_0x3b61ac[_0xbeb3('0x13')]['message']);}})[_0xbeb3('0x14')](function(_0x4e7d99){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x406927,_0x4e7d99);_0x241dbb(_0x4e7d99);});});}exports[_0xbeb3('0x15')]=function(_0x44a4bb){var _0x32275b=this;return new Promise(function(_0x10b15d,_0x5d0689){return db[_0xbeb3('0x16')][_0xbeb3('0x17')](_0x44a4bb[_0xbeb3('0x18')],{'raw':_0x44a4bb['options']?_0x44a4bb['options'][_0xbeb3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a4bb['options']?_0x44a4bb[_0xbeb3('0x1a')]['where']||null:null,'attributes':_0x44a4bb['options']?_0x44a4bb[_0xbeb3('0x1a')][_0xbeb3('0x1b')]||null:null,'limit':_0x44a4bb[_0xbeb3('0x1a')]?_0x44a4bb['options'][_0xbeb3('0x1c')]||null:null})[_0xbeb3('0xb')](function(_0x5e047e){logger[_0xbeb3('0xc')](_0xbeb3('0x15'),_0x44a4bb);logger['debug'](_0xbeb3('0x15'),_0x44a4bb,JSON[_0xbeb3('0x1d')](_0x5e047e));_0x10b15d(_0x5e047e);})[_0xbeb3('0x14')](function(_0x42c6c3){logger[_0xbeb3('0x10')](_0xbeb3('0x15'),_0x42c6c3[_0xbeb3('0x12')],_0x44a4bb);_0x5d0689(_0x32275b[_0xbeb3('0x10')](0x1f4,_0x42c6c3[_0xbeb3('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x4e695e){var _0x1f36b9=this;return new Promise(function(_0x520116,_0x3e7f7d){var _0xda808c=require(_0xbeb3('0x1e'));var _0x400f65;return db['Setting'][_0xbeb3('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xbeb3('0xb')](function(_0xab301c){_0x400f65=_0xab301c;return db['VoiceRecording']['create'](_0x4e695e[_0xbeb3('0x18')]);})['then'](function(_0x51f7ef){if(_0x400f65['callRecordingEncryption']&&fs['existsSync'](_0x51f7ef[_0xbeb3('0x20')])){var _0x4e9a04=util[_0xbeb3('0x21')](_0xbeb3('0x22'),_0x51f7ef[_0xbeb3('0x20')]);return _0xda808c[_0xbeb3('0x23')](_0x51f7ef[_0xbeb3('0x20')],_0x4e9a04,config[_0xbeb3('0x24')][_0xbeb3('0x25')])[_0xbeb3('0xb')](function(){fs[_0xbeb3('0x26')](_0x51f7ef[_0xbeb3('0x20')]);logger['info'](_0xbeb3('0x27'));return _0x51f7ef;});}return _0x51f7ef;})[_0xbeb3('0xb')](function(_0x5821dd){logger[_0xbeb3('0xc')](_0xbeb3('0x28'),_0x4e695e);logger[_0xbeb3('0x29')](_0xbeb3('0x28'),_0x4e695e,JSON['stringify'](_0x5821dd));_0x520116(_0x5821dd);})[_0xbeb3('0x14')](function(_0x18f2be){logger[_0xbeb3('0x10')](_0xbeb3('0x28'),_0x18f2be[_0xbeb3('0x12')],_0x4e695e);_0x3e7f7d(_0x1f36b9[_0xbeb3('0x10')](0x1f4,_0x18f2be[_0xbeb3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4e44994..4534378 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 _0x2a1c=['Router','fs-extra','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','express'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2a1c,0x19e));var _0xc2a1=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x2a1c[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0xc2a1('0x0'));var util=require(_0xc2a1('0x1'));var path=require(_0xc2a1('0x2'));var timeout=require('connect-timeout');var express=require(_0xc2a1('0x3'));var router=express[_0xc2a1('0x4')]();var fs_extra=require(_0xc2a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc2a1('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc2a1('0x7')]);router[_0xc2a1('0x8')](_0xc2a1('0x9'),auth[_0xc2a1('0xa')](),controller[_0xc2a1('0xb')]);router[_0xc2a1('0x8')](_0xc2a1('0xc'),auth[_0xc2a1('0xa')](),controller[_0xc2a1('0xd')]);router[_0xc2a1('0xe')]('/',auth[_0xc2a1('0xa')](),controller['create']);router[_0xc2a1('0xf')](_0xc2a1('0xc'),auth[_0xc2a1('0xa')](),controller['update']);router[_0xc2a1('0x10')](_0xc2a1('0xc'),auth['isAuthenticated'](),controller[_0xc2a1('0x11')]);module[_0xc2a1('0x12')]=router; \ No newline at end of file +var _0x817a=['get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x5b5960,_0x2bab09){var _0x16b671=function(_0x430f0b){while(--_0x430f0b){_0x5b5960['push'](_0x5b5960['shift']());}};_0x16b671(++_0x2bab09);}(_0x817a,0x1aa));var _0xa817=function(_0x2c0621,_0x453189){_0x2c0621=_0x2c0621-0x0;var _0x544a02=_0x817a[_0x2c0621];return _0x544a02;};'use strict';var multer=require(_0xa817('0x0'));var util=require(_0xa817('0x1'));var path=require(_0xa817('0x2'));var timeout=require(_0xa817('0x3'));var express=require(_0xa817('0x4'));var router=express[_0xa817('0x5')]();var fs_extra=require(_0xa817('0x6'));var auth=require(_0xa817('0x7'));var interaction=require(_0xa817('0x8'));var config=require(_0xa817('0x9'));var controller=require(_0xa817('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa817('0xb')](_0xa817('0xc'),auth[_0xa817('0xd')](),controller[_0xa817('0xe')]);router[_0xa817('0xb')]('/:id',auth[_0xa817('0xd')](),controller[_0xa817('0xf')]);router[_0xa817('0x10')]('/',auth[_0xa817('0xd')](),controller[_0xa817('0x11')]);router[_0xa817('0x12')](_0xa817('0x13'),auth['isAuthenticated'](),controller[_0xa817('0x14')]);router['delete'](_0xa817('0x13'),auth[_0xa817('0xd')](),controller[_0xa817('0x15')]);module[_0xa817('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1e66cce..ffbafe0 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 _0x2ac6=['Yes','sequelize','ENUM','attended','STRING'];(function(_0x59abe4,_0x3ef04d){var _0x18e292=function(_0x4da8ed){while(--_0x4da8ed){_0x59abe4['push'](_0x59abe4['shift']());}};_0x18e292(++_0x3ef04d);}(_0x2ac6,0xf1));var _0x62ac=function(_0x1254a5,_0x2ba0be){_0x1254a5=_0x1254a5-0x0;var _0x2fbf81=_0x2ac6[_0x1254a5];return _0x2fbf81;};'use strict';var Sequelize=require(_0x62ac('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x62ac('0x1')]('blind',_0x62ac('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x62ac('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x62ac('0x3')]},'transferercalleridname':{'type':Sequelize[_0x62ac('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x62ac('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x62ac('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x62ac('0x3')]},'transferercontext':{'type':Sequelize[_0x62ac('0x3')]},'transfererexten':{'type':Sequelize[_0x62ac('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x62ac('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x62ac('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x62ac('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x62ac('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x62ac('0x3')]},'transfereecontext':{'type':Sequelize[_0x62ac('0x3')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x62ac('0x1')](_0x62ac('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x62ac('0x3')]}}; \ No newline at end of file +var _0x33fb=['blind','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x226829,_0x38daf2){var _0x32dca7=function(_0x14caa9){while(--_0x14caa9){_0x226829['push'](_0x226829['shift']());}};_0x32dca7(++_0x38daf2);}(_0x33fb,0xc7));var _0xb33f=function(_0x273270,_0x220787){_0x273270=_0x273270-0x0;var _0x209651=_0x33fb[_0x273270];return _0x209651;};'use strict';var Sequelize=require(_0xb33f('0x0'));var moment=require(_0xb33f('0x1'));module[_0xb33f('0x2')]={'type':{'type':Sequelize[_0xb33f('0x3')](_0xb33f('0x4'),'attended')},'result':{'type':Sequelize[_0xb33f('0x5')]},'transfererchannel':{'type':Sequelize[_0xb33f('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb33f('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb33f('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xb33f('0x5')]},'transferercontext':{'type':Sequelize[_0xb33f('0x5')]},'transfererexten':{'type':Sequelize[_0xb33f('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xb33f('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb33f('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb33f('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb33f('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xb33f('0x5')]},'transfereecontext':{'type':Sequelize[_0xb33f('0x5')]},'transfereeexten':{'type':Sequelize[_0xb33f('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb33f('0x5')]},'isexternal':{'type':Sequelize[_0xb33f('0x3')](_0xb33f('0x6'),'No')},'context':{'type':Sequelize[_0xb33f('0x5')]},'extension':{'type':Sequelize[_0xb33f('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c73fc4e..b4af5e6 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 _0x8b0f=['VIRTUAL','merge','options','VoiceTransferReport','then','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','error','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b0f,0x156));var _0xf8b0=function(_0x115bf2,_0x17b577){_0x115bf2=_0x115bf2-0x0;var _0x149a65=_0x8b0f[_0x115bf2];return _0x149a65;};'use strict';var emlformat=require(_0xf8b0('0x0'));var rimraf=require(_0xf8b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8b0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf8b0('0x3'));var Mustache=require('mustache');var util=require(_0xf8b0('0x4'));var path=require(_0xf8b0('0x5'));var sox=require(_0xf8b0('0x6'));var csv=require(_0xf8b0('0x7'));var ejs=require(_0xf8b0('0x8'));var fs=require('fs');var fs_extra=require(_0xf8b0('0x9'));var _=require(_0xf8b0('0xa'));var squel=require(_0xf8b0('0xb'));var crypto=require(_0xf8b0('0xc'));var jsforce=require(_0xf8b0('0xd'));var deskjs=require(_0xf8b0('0xe'));var toCsv=require(_0xf8b0('0x7'));var querystring=require(_0xf8b0('0xf'));var Papa=require(_0xf8b0('0x10'));var Redis=require(_0xf8b0('0x11'));var authService=require(_0xf8b0('0x12'));var qs=require(_0xf8b0('0x13'));var as=require(_0xf8b0('0x14'));var hardwareService=require(_0xf8b0('0x15'));var logger=require(_0xf8b0('0x16'))(_0xf8b0('0x17'));var utils=require(_0xf8b0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf8b0('0x19'));var db=require(_0xf8b0('0x1a'))['db'];function respondWithStatusCode(_0x143976,_0xc71aed){_0xc71aed=_0xc71aed||0xcc;return function(_0x20a53f){if(_0x20a53f){return _0x143976[_0xf8b0('0x1b')](_0xc71aed);}return _0x143976['status'](_0xc71aed)['end']();};}function respondWithResult(_0x844716,_0x518fcf){_0x518fcf=_0x518fcf||0xc8;return function(_0x57d24b){if(_0x57d24b){return _0x844716[_0xf8b0('0x1c')](_0x518fcf)['json'](_0x57d24b);}};}function respondWithFilteredResult(_0x52b2ab,_0x33257d){return function(_0xf65c58){if(_0xf65c58){var _0x4eea91=typeof _0x33257d[_0xf8b0('0x1d')]===_0xf8b0('0x1e')&&typeof _0x33257d[_0xf8b0('0x1f')]===_0xf8b0('0x1e');var _0x282af7=_0xf65c58['count'];var _0x19e28c=_0x4eea91?0x0:_0x33257d[_0xf8b0('0x1d')];var _0x4c3dd1=_0x4eea91?_0xf65c58[_0xf8b0('0x20')]:_0x33257d[_0xf8b0('0x1d')]+_0x33257d['limit'];var _0x1bd162;if(_0x4c3dd1>=_0x282af7){_0x4c3dd1=_0x282af7;_0x1bd162=0xc8;}else{_0x1bd162=0xce;}_0x52b2ab[_0xf8b0('0x1c')](_0x1bd162);return _0x52b2ab[_0xf8b0('0x21')](_0xf8b0('0x22'),_0x19e28c+'-'+_0x4c3dd1+'/'+_0x282af7)['json'](_0xf65c58);}return null;};}function patchUpdates(_0x315cf3){return function(_0x570285){try{jsonpatch[_0xf8b0('0x23')](_0x570285,_0x315cf3,!![]);}catch(_0x269892){return BPromise[_0xf8b0('0x24')](_0x269892);}return _0x570285[_0xf8b0('0x25')]();};}function saveUpdates(_0x59f02e,_0x10aba0){return function(_0x2b5ca0){if(_0x2b5ca0){return _0x2b5ca0['update'](_0x59f02e)['then'](function(_0x45df43){return _0x45df43;});}return null;};}function removeEntity(_0x1aa1f5,_0x440303){return function(_0x4314fc){if(_0x4314fc){return _0x4314fc[_0xf8b0('0x26')]()['then'](function(){_0x1aa1f5['status'](0xcc)[_0xf8b0('0x27')]();});}};}function handleEntityNotFound(_0x5e30b2,_0x3cf648){return function(_0x5e2cf0){if(!_0x5e2cf0){_0x5e30b2['sendStatus'](0x194);}return _0x5e2cf0;};}function handleError(_0x5115f1,_0x58f5b5){_0x58f5b5=_0x58f5b5||0x1f4;return function(_0x29b201){logger[_0xf8b0('0x28')](_0x29b201['stack']);if(_0x29b201[_0xf8b0('0x29')]){delete _0x29b201[_0xf8b0('0x29')];}_0x5115f1['status'](_0x58f5b5)[_0xf8b0('0x2a')](_0x29b201);};}exports[_0xf8b0('0x2b')]=function(_0x34df7d,_0x16b56a){var _0x65508b={},_0x371ff3={},_0x413b04={'count':0x0,'rows':[]};var _0x2d0efa=_['map'](db['VoiceTransferReport'][_0xf8b0('0x2c')],function(_0x579e91){return{'name':_0x579e91[_0xf8b0('0x2d')],'type':_0x579e91['type'][_0xf8b0('0x2e')]};});_0x371ff3['model']=_[_0xf8b0('0x2f')](_0x2d0efa,'name');_0x371ff3[_0xf8b0('0x30')]=_['keys'](_0x34df7d[_0xf8b0('0x30')]);_0x371ff3[_0xf8b0('0x31')]=_[_0xf8b0('0x32')](_0x371ff3[_0xf8b0('0x33')],_0x371ff3[_0xf8b0('0x30')]);_0x65508b[_0xf8b0('0x34')]=_[_0xf8b0('0x32')](_0x371ff3[_0xf8b0('0x33')],qs[_0xf8b0('0x35')](_0x34df7d[_0xf8b0('0x30')]['fields']));_0x65508b[_0xf8b0('0x34')]=_0x65508b[_0xf8b0('0x34')][_0xf8b0('0x36')]?_0x65508b[_0xf8b0('0x34')]:_0x371ff3['model'];if(!_0x34df7d['query'][_0xf8b0('0x37')](_0xf8b0('0x38'))){_0x65508b['limit']=qs[_0xf8b0('0x1f')](_0x34df7d[_0xf8b0('0x30')]['limit']);_0x65508b[_0xf8b0('0x1d')]=qs['offset'](_0x34df7d['query']['offset']);}_0x65508b[_0xf8b0('0x39')]=qs[_0xf8b0('0x3a')](_0x34df7d[_0xf8b0('0x30')][_0xf8b0('0x3a')]);_0x65508b[_0xf8b0('0x3b')]=qs[_0xf8b0('0x31')](_[_0xf8b0('0x3c')](_0x34df7d['query'],_0x371ff3['filters']),_0x2d0efa);if(_0x34df7d[_0xf8b0('0x30')][_0xf8b0('0x3d')]){_0x65508b[_0xf8b0('0x3b')]=_['merge'](_0x65508b['where'],{'$or':_['map'](_0x2d0efa,function(_0x17d95a){if(_0x17d95a[_0xf8b0('0x3e')]!==_0xf8b0('0x3f')){var _0x295ccd={};_0x295ccd[_0x17d95a[_0xf8b0('0x29')]]={'$like':'%'+_0x34df7d[_0xf8b0('0x30')]['filter']+'%'};return _0x295ccd;}})});}_0x65508b=_[_0xf8b0('0x40')]({},_0x65508b,_0x34df7d[_0xf8b0('0x41')]);var _0x5c2969={'where':_0x65508b[_0xf8b0('0x3b')]};return db[_0xf8b0('0x42')][_0xf8b0('0x20')](_0x5c2969)[_0xf8b0('0x43')](function(_0x40605a){_0x413b04['count']=_0x40605a;if(_0x34df7d[_0xf8b0('0x30')][_0xf8b0('0x44')]){_0x65508b[_0xf8b0('0x45')]=[{'all':!![]}];}return db[_0xf8b0('0x42')][_0xf8b0('0x46')](_0x65508b);})[_0xf8b0('0x43')](function(_0x5ab9be){_0x413b04[_0xf8b0('0x47')]=_0x5ab9be;return _0x413b04;})[_0xf8b0('0x43')](respondWithFilteredResult(_0x16b56a,_0x65508b))[_0xf8b0('0x48')](handleError(_0x16b56a,null));};exports[_0xf8b0('0x49')]=function(_0x5da979,_0x42d6fa){var _0x12aa45={'raw':!![],'where':{'id':_0x5da979[_0xf8b0('0x4a')]['id']}},_0x3a5aaa={};_0x3a5aaa[_0xf8b0('0x33')]=_[_0xf8b0('0x4b')](db[_0xf8b0('0x42')]['rawAttributes']);_0x3a5aaa[_0xf8b0('0x30')]=_[_0xf8b0('0x4b')](_0x5da979[_0xf8b0('0x30')]);_0x3a5aaa[_0xf8b0('0x31')]=_[_0xf8b0('0x32')](_0x3a5aaa[_0xf8b0('0x33')],_0x3a5aaa[_0xf8b0('0x30')]);_0x12aa45[_0xf8b0('0x34')]=_[_0xf8b0('0x32')](_0x3a5aaa['model'],qs['fields'](_0x5da979[_0xf8b0('0x30')]['fields']));_0x12aa45['attributes']=_0x12aa45[_0xf8b0('0x34')][_0xf8b0('0x36')]?_0x12aa45['attributes']:_0x3a5aaa[_0xf8b0('0x33')];if(_0x5da979[_0xf8b0('0x30')]['includeAll']){_0x12aa45[_0xf8b0('0x45')]=[{'all':!![]}];}_0x12aa45=_[_0xf8b0('0x40')]({},_0x12aa45,_0x5da979[_0xf8b0('0x41')]);return db[_0xf8b0('0x42')]['find'](_0x12aa45)['then'](handleEntityNotFound(_0x42d6fa,null))['then'](respondWithResult(_0x42d6fa,null))[_0xf8b0('0x48')](handleError(_0x42d6fa,null));};exports[_0xf8b0('0x4c')]=function(_0x386799,_0xd8da13){return db[_0xf8b0('0x42')][_0xf8b0('0x4c')](_0x386799[_0xf8b0('0x4d')],{})[_0xf8b0('0x43')](respondWithResult(_0xd8da13,0xc9))[_0xf8b0('0x48')](handleError(_0xd8da13,null));};exports[_0xf8b0('0x4e')]=function(_0x222530,_0x4d5b94){if(_0x222530['body']['id']){delete _0x222530['body']['id'];}return db[_0xf8b0('0x42')][_0xf8b0('0x4f')]({'where':{'id':_0x222530[_0xf8b0('0x4a')]['id']}})[_0xf8b0('0x43')](handleEntityNotFound(_0x4d5b94,null))[_0xf8b0('0x43')](saveUpdates(_0x222530['body'],null))[_0xf8b0('0x43')](respondWithResult(_0x4d5b94,null))[_0xf8b0('0x48')](handleError(_0x4d5b94,null));};exports[_0xf8b0('0x26')]=function(_0x1b8446,_0x1ea6a1){return db[_0xf8b0('0x42')][_0xf8b0('0x4f')]({'where':{'id':_0x1b8446['params']['id']}})['then'](handleEntityNotFound(_0x1ea6a1,null))['then'](removeEntity(_0x1ea6a1,null))[_0xf8b0('0x48')](handleError(_0x1ea6a1,null));};exports[_0xf8b0('0x50')]=function(_0x1ff3c4,_0x2db35a){return db[_0xf8b0('0x42')][_0xf8b0('0x50')]()[_0xf8b0('0x43')](respondWithResult(_0x2db35a,null))[_0xf8b0('0x48')](handleError(_0x2db35a,null));}; \ No newline at end of file +var _0xd8e4=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','include','VoiceTransferReport','findAll','rows','catch','params','rawAttributes','includeAll','merge','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x1c84d2,_0x10b9a9){var _0x50d239=function(_0xcb64da){while(--_0xcb64da){_0x1c84d2['push'](_0x1c84d2['shift']());}};_0x50d239(++_0x10b9a9);}(_0xd8e4,0xda));var _0x4d8e=function(_0x37ad9f,_0xc6429a){_0x37ad9f=_0x37ad9f-0x0;var _0x47344d=_0xd8e4[_0x37ad9f];return _0x47344d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d8e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d8e('0x1'));var rp=require(_0x4d8e('0x2'));var moment=require(_0x4d8e('0x3'));var BPromise=require(_0x4d8e('0x4'));var Mustache=require(_0x4d8e('0x5'));var util=require(_0x4d8e('0x6'));var path=require('path');var sox=require(_0x4d8e('0x7'));var csv=require(_0x4d8e('0x8'));var ejs=require(_0x4d8e('0x9'));var fs=require('fs');var fs_extra=require(_0x4d8e('0xa'));var _=require(_0x4d8e('0xb'));var squel=require(_0x4d8e('0xc'));var crypto=require('crypto');var jsforce=require(_0x4d8e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4d8e('0x8'));var querystring=require(_0x4d8e('0xe'));var Papa=require(_0x4d8e('0xf'));var Redis=require(_0x4d8e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d8e('0x11'));var logger=require(_0x4d8e('0x12'))(_0x4d8e('0x13'));var utils=require(_0x4d8e('0x14'));var config=require(_0x4d8e('0x15'));var licenseUtil=require(_0x4d8e('0x16'));var db=require(_0x4d8e('0x17'))['db'];function respondWithStatusCode(_0x3246ab,_0x395c09){_0x395c09=_0x395c09||0xcc;return function(_0x576a86){if(_0x576a86){return _0x3246ab[_0x4d8e('0x18')](_0x395c09);}return _0x3246ab['status'](_0x395c09)[_0x4d8e('0x19')]();};}function respondWithResult(_0x234480,_0x27628c){_0x27628c=_0x27628c||0xc8;return function(_0x53dbb7){if(_0x53dbb7){return _0x234480[_0x4d8e('0x1a')](_0x27628c)[_0x4d8e('0x1b')](_0x53dbb7);}};}function respondWithFilteredResult(_0xaf68ba,_0x6f040e){return function(_0x3256a6){if(_0x3256a6){var _0x398d34=typeof _0x6f040e[_0x4d8e('0x1c')]==='undefined'&&typeof _0x6f040e[_0x4d8e('0x1d')]===_0x4d8e('0x1e');var _0x2b0543=_0x3256a6[_0x4d8e('0x1f')];var _0x73f8b1=_0x398d34?0x0:_0x6f040e[_0x4d8e('0x1c')];var _0x1cc8e9=_0x398d34?_0x3256a6['count']:_0x6f040e[_0x4d8e('0x1c')]+_0x6f040e[_0x4d8e('0x1d')];var _0x274fa9;if(_0x1cc8e9>=_0x2b0543){_0x1cc8e9=_0x2b0543;_0x274fa9=0xc8;}else{_0x274fa9=0xce;}_0xaf68ba[_0x4d8e('0x1a')](_0x274fa9);return _0xaf68ba[_0x4d8e('0x20')](_0x4d8e('0x21'),_0x73f8b1+'-'+_0x1cc8e9+'/'+_0x2b0543)['json'](_0x3256a6);}return null;};}function patchUpdates(_0x1a1ea0){return function(_0x2fea17){try{jsonpatch[_0x4d8e('0x22')](_0x2fea17,_0x1a1ea0,!![]);}catch(_0x243445){return BPromise[_0x4d8e('0x23')](_0x243445);}return _0x2fea17[_0x4d8e('0x24')]();};}function saveUpdates(_0x8020bc,_0x100893){return function(_0x2036e0){if(_0x2036e0){return _0x2036e0['update'](_0x8020bc)['then'](function(_0x464ba0){return _0x464ba0;});}return null;};}function removeEntity(_0x278d8f,_0x21c7b9){return function(_0x8fdb50){if(_0x8fdb50){return _0x8fdb50[_0x4d8e('0x25')]()[_0x4d8e('0x26')](function(){_0x278d8f['status'](0xcc)[_0x4d8e('0x19')]();});}};}function handleEntityNotFound(_0x467146,_0x3dd177){return function(_0x2cdcc5){if(!_0x2cdcc5){_0x467146['sendStatus'](0x194);}return _0x2cdcc5;};}function handleError(_0x1f6dfc,_0x19dfab){_0x19dfab=_0x19dfab||0x1f4;return function(_0x191901){logger[_0x4d8e('0x27')](_0x191901['stack']);if(_0x191901['name']){delete _0x191901[_0x4d8e('0x28')];}_0x1f6dfc['status'](_0x19dfab)[_0x4d8e('0x29')](_0x191901);};}exports[_0x4d8e('0x2a')]=function(_0x30f2eb,_0x10f621){var _0x25f6cf={},_0xef8e74={},_0x405080={'count':0x0,'rows':[]};var _0x5a0748=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x482ca0){return{'name':_0x482ca0['fieldName'],'type':_0x482ca0[_0x4d8e('0x2b')]['key']};});_0xef8e74[_0x4d8e('0x2c')]=_[_0x4d8e('0x2d')](_0x5a0748,_0x4d8e('0x28'));_0xef8e74[_0x4d8e('0x2e')]=_[_0x4d8e('0x2f')](_0x30f2eb[_0x4d8e('0x2e')]);_0xef8e74['filters']=_[_0x4d8e('0x30')](_0xef8e74['model'],_0xef8e74[_0x4d8e('0x2e')]);_0x25f6cf[_0x4d8e('0x31')]=_['intersection'](_0xef8e74[_0x4d8e('0x2c')],qs[_0x4d8e('0x32')](_0x30f2eb[_0x4d8e('0x2e')][_0x4d8e('0x32')]));_0x25f6cf[_0x4d8e('0x31')]=_0x25f6cf['attributes']['length']?_0x25f6cf['attributes']:_0xef8e74[_0x4d8e('0x2c')];if(!_0x30f2eb['query'][_0x4d8e('0x33')](_0x4d8e('0x34'))){_0x25f6cf[_0x4d8e('0x1d')]=qs[_0x4d8e('0x1d')](_0x30f2eb[_0x4d8e('0x2e')][_0x4d8e('0x1d')]);_0x25f6cf[_0x4d8e('0x1c')]=qs['offset'](_0x30f2eb[_0x4d8e('0x2e')]['offset']);}_0x25f6cf[_0x4d8e('0x35')]=qs['sort'](_0x30f2eb[_0x4d8e('0x2e')][_0x4d8e('0x36')]);_0x25f6cf[_0x4d8e('0x37')]=qs[_0x4d8e('0x38')](_[_0x4d8e('0x39')](_0x30f2eb[_0x4d8e('0x2e')],_0xef8e74['filters']),_0x5a0748);if(_0x30f2eb[_0x4d8e('0x2e')][_0x4d8e('0x3a')]){_0x25f6cf[_0x4d8e('0x37')]=_['merge'](_0x25f6cf['where'],{'$or':_[_0x4d8e('0x2d')](_0x5a0748,function(_0x3401cb){if(_0x3401cb[_0x4d8e('0x2b')]!=='VIRTUAL'){var _0x5d3f44={};_0x5d3f44[_0x3401cb['name']]={'$like':'%'+_0x30f2eb[_0x4d8e('0x2e')][_0x4d8e('0x3a')]+'%'};return _0x5d3f44;}})});}_0x25f6cf=_['merge']({},_0x25f6cf,_0x30f2eb[_0x4d8e('0x3b')]);var _0x2287d4={'where':_0x25f6cf[_0x4d8e('0x37')]};return db['VoiceTransferReport'][_0x4d8e('0x1f')](_0x2287d4)[_0x4d8e('0x26')](function(_0x316348){_0x405080[_0x4d8e('0x1f')]=_0x316348;if(_0x30f2eb[_0x4d8e('0x2e')]['includeAll']){_0x25f6cf[_0x4d8e('0x3c')]=[{'all':!![]}];}return db[_0x4d8e('0x3d')][_0x4d8e('0x3e')](_0x25f6cf);})[_0x4d8e('0x26')](function(_0x23ad8f){_0x405080[_0x4d8e('0x3f')]=_0x23ad8f;return _0x405080;})[_0x4d8e('0x26')](respondWithFilteredResult(_0x10f621,_0x25f6cf))[_0x4d8e('0x40')](handleError(_0x10f621,null));};exports['show']=function(_0x24df36,_0x3af410){var _0x5bf50={'raw':!![],'where':{'id':_0x24df36[_0x4d8e('0x41')]['id']}},_0x3d6bc6={};_0x3d6bc6[_0x4d8e('0x2c')]=_[_0x4d8e('0x2f')](db[_0x4d8e('0x3d')][_0x4d8e('0x42')]);_0x3d6bc6[_0x4d8e('0x2e')]=_['keys'](_0x24df36[_0x4d8e('0x2e')]);_0x3d6bc6[_0x4d8e('0x38')]=_[_0x4d8e('0x30')](_0x3d6bc6['model'],_0x3d6bc6['query']);_0x5bf50[_0x4d8e('0x31')]=_[_0x4d8e('0x30')](_0x3d6bc6[_0x4d8e('0x2c')],qs[_0x4d8e('0x32')](_0x24df36[_0x4d8e('0x2e')][_0x4d8e('0x32')]));_0x5bf50['attributes']=_0x5bf50[_0x4d8e('0x31')]['length']?_0x5bf50[_0x4d8e('0x31')]:_0x3d6bc6[_0x4d8e('0x2c')];if(_0x24df36[_0x4d8e('0x2e')][_0x4d8e('0x43')]){_0x5bf50[_0x4d8e('0x3c')]=[{'all':!![]}];}_0x5bf50=_[_0x4d8e('0x44')]({},_0x5bf50,_0x24df36[_0x4d8e('0x3b')]);return db[_0x4d8e('0x3d')][_0x4d8e('0x45')](_0x5bf50)['then'](handleEntityNotFound(_0x3af410,null))['then'](respondWithResult(_0x3af410,null))[_0x4d8e('0x40')](handleError(_0x3af410,null));};exports['create']=function(_0x54993f,_0x56c9b1){return db[_0x4d8e('0x3d')][_0x4d8e('0x46')](_0x54993f[_0x4d8e('0x47')],{})[_0x4d8e('0x26')](respondWithResult(_0x56c9b1,0xc9))['catch'](handleError(_0x56c9b1,null));};exports[_0x4d8e('0x48')]=function(_0x6aff43,_0x39c3e0){if(_0x6aff43['body']['id']){delete _0x6aff43['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x6aff43[_0x4d8e('0x41')]['id']}})[_0x4d8e('0x26')](handleEntityNotFound(_0x39c3e0,null))['then'](saveUpdates(_0x6aff43[_0x4d8e('0x47')],null))[_0x4d8e('0x26')](respondWithResult(_0x39c3e0,null))[_0x4d8e('0x40')](handleError(_0x39c3e0,null));};exports['destroy']=function(_0x53c946,_0x22aa43){return db[_0x4d8e('0x3d')]['find']({'where':{'id':_0x53c946[_0x4d8e('0x41')]['id']}})[_0x4d8e('0x26')](handleEntityNotFound(_0x22aa43,null))[_0x4d8e('0x26')](removeEntity(_0x22aa43,null))[_0x4d8e('0x40')](handleError(_0x22aa43,null));};exports[_0x4d8e('0x49')]=function(_0x238a64,_0xab8d77){return db[_0x4d8e('0x3d')][_0x4d8e('0x49')]()['then'](respondWithResult(_0xab8d77,null))[_0x4d8e('0x40')](handleError(_0xab8d77,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 326e893..1759772 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 _0x96a5=['exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x55afdb,_0x48d0e4){var _0x115fb2=function(_0x26f7bd){while(--_0x26f7bd){_0x55afdb['push'](_0x55afdb['shift']());}};_0x115fb2(++_0x48d0e4);}(_0x96a5,0xe1));var _0x596a=function(_0x9a7d08,_0xe9048){_0x9a7d08=_0x9a7d08-0x0;var _0x58e6e8=_0x96a5[_0x9a7d08];return _0x58e6e8;};'use strict';var _=require(_0x596a('0x0'));var util=require('util');var logger=require(_0x596a('0x1'))(_0x596a('0x2'));var moment=require('moment');var BPromise=require(_0x596a('0x3'));var rp=require(_0x596a('0x4'));var fs=require('fs');var path=require(_0x596a('0x5'));var rimraf=require(_0x596a('0x6'));var config=require(_0x596a('0x7'));var attributes=require(_0x596a('0x8'));module[_0x596a('0x9')]=function(_0x230e9c,_0x512fe8){return _0x230e9c[_0x596a('0xa')](_0x596a('0xb'),attributes,{'tableName':_0x596a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa422=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x1411dd,_0x264b3b){var _0x48d5a9=function(_0x2650a5){while(--_0x2650a5){_0x1411dd['push'](_0x1411dd['shift']());}};_0x48d5a9(++_0x264b3b);}(_0xa422,0xd1));var _0x2a42=function(_0x504b7c,_0x589ab2){_0x504b7c=_0x504b7c-0x0;var _0x4e286d=_0xa422[_0x504b7c];return _0x4e286d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2a42('0x0'));var moment=require(_0x2a42('0x1'));var BPromise=require(_0x2a42('0x2'));var rp=require(_0x2a42('0x3'));var fs=require('fs');var path=require(_0x2a42('0x4'));var rimraf=require(_0x2a42('0x5'));var config=require(_0x2a42('0x6'));var attributes=require(_0x2a42('0x7'));module[_0x2a42('0x8')]=function(_0x1c4fa8,_0x4b6623){return _0x1c4fa8[_0x2a42('0x9')](_0x2a42('0xa'),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 c84ab56..4f531b8 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 _0x9ff3=['raw','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options'];(function(_0x39653b,_0x218650){var _0x5dbb60=function(_0x1f2bec){while(--_0x1f2bec){_0x39653b['push'](_0x39653b['shift']());}};_0x5dbb60(++_0x218650);}(_0x9ff3,0x115));var _0x39ff=function(_0x226e0b,_0x5cbc29){_0x226e0b=_0x226e0b-0x0;var _0x5f2cd5=_0x9ff3[_0x226e0b];return _0x5f2cd5;};'use strict';var _=require(_0x39ff('0x0'));var util=require(_0x39ff('0x1'));var moment=require('moment');var BPromise=require(_0x39ff('0x2'));var rs=require(_0x39ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39ff('0x4'));var logger=require('../../config/logger')(_0x39ff('0x5'));var config=require(_0x39ff('0x6'));var jayson=require(_0x39ff('0x7'));var client=jayson['client'][_0x39ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cf546,_0x4fa51e,_0x49ecdb){return new BPromise(function(_0x3f2474,_0x1e8a52){return client[_0x39ff('0x9')](_0x4cf546,_0x49ecdb)[_0x39ff('0xa')](function(_0x1da3aa){logger[_0x39ff('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x4fa51e,_0x39ff('0xc'));logger[_0x39ff('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4fa51e,_0x39ff('0xc'),JSON['stringify'](_0x1da3aa));if(_0x1da3aa[_0x39ff('0xe')]){if(_0x1da3aa[_0x39ff('0xe')]['code']===0x1f4){logger[_0x39ff('0xe')](_0x39ff('0xf'),_0x4fa51e,_0x1da3aa[_0x39ff('0xe')][_0x39ff('0x10')]);return _0x1e8a52(_0x1da3aa[_0x39ff('0xe')][_0x39ff('0x10')]);}logger[_0x39ff('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x4fa51e,_0x1da3aa[_0x39ff('0xe')][_0x39ff('0x10')]);return _0x3f2474(_0x1da3aa['error'][_0x39ff('0x10')]);}else{logger[_0x39ff('0xb')](_0x39ff('0xf'),_0x4fa51e,_0x39ff('0xc'));_0x3f2474(_0x1da3aa[_0x39ff('0x11')][_0x39ff('0x10')]);}})[_0x39ff('0x12')](function(_0x57b324){logger['error'](_0x39ff('0xf'),_0x4fa51e,_0x57b324);_0x1e8a52(_0x57b324);});});}exports['CreateVoiceTransferReport']=function(_0xafa265){var _0x15e3be=this;return new Promise(function(_0x4512f1,_0x556544){return db[_0x39ff('0x13')][_0x39ff('0x14')](_0xafa265[_0x39ff('0x15')],{'raw':_0xafa265[_0x39ff('0x16')]?_0xafa265[_0x39ff('0x16')][_0x39ff('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x19faab){logger[_0x39ff('0xb')]('CreateVoiceTransferReport',_0xafa265);logger[_0x39ff('0xd')](_0x39ff('0x18'),_0xafa265,JSON['stringify'](_0x19faab));_0x4512f1(_0x19faab);})[_0x39ff('0x12')](function(_0x17a789){logger[_0x39ff('0xe')](_0x39ff('0x18'),_0x17a789[_0x39ff('0x10')],_0xafa265);_0x556544(_0x15e3be[_0x39ff('0xe')](0x1f4,_0x17a789[_0x39ff('0x10')]));});});}; \ No newline at end of file +var _0xef32=['catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result'];(function(_0x26f118,_0x4e17d9){var _0x450dda=function(_0x3e2147){while(--_0x3e2147){_0x26f118['push'](_0x26f118['shift']());}};_0x450dda(++_0x4e17d9);}(_0xef32,0x159));var _0x2ef3=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xef32[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x2ef3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ef3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ef3('0x2'))['db'];var utils=require(_0x2ef3('0x3'));var logger=require(_0x2ef3('0x4'))(_0x2ef3('0x5'));var config=require(_0x2ef3('0x6'));var jayson=require(_0x2ef3('0x7'));var client=jayson['client'][_0x2ef3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b243b,_0xd3192d,_0x301a59){return new BPromise(function(_0x435ac1,_0x357e04){return client['request'](_0x2b243b,_0x301a59)['then'](function(_0x57de92){logger[_0x2ef3('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0xd3192d,_0x2ef3('0xa'));logger[_0x2ef3('0xb')](_0x2ef3('0xc'),_0xd3192d,_0x2ef3('0xa'),JSON[_0x2ef3('0xd')](_0x57de92));if(_0x57de92['error']){if(_0x57de92[_0x2ef3('0xe')][_0x2ef3('0xf')]===0x1f4){logger['error'](_0x2ef3('0x10'),_0xd3192d,_0x57de92[_0x2ef3('0xe')][_0x2ef3('0x11')]);return _0x357e04(_0x57de92['error'][_0x2ef3('0x11')]);}logger[_0x2ef3('0xe')](_0x2ef3('0x10'),_0xd3192d,_0x57de92[_0x2ef3('0xe')][_0x2ef3('0x11')]);return _0x435ac1(_0x57de92[_0x2ef3('0xe')]['message']);}else{logger[_0x2ef3('0x9')](_0x2ef3('0x10'),_0xd3192d,'request\x20sent');_0x435ac1(_0x57de92[_0x2ef3('0x12')]['message']);}})[_0x2ef3('0x13')](function(_0x4b572f){logger['error'](_0x2ef3('0x10'),_0xd3192d,_0x4b572f);_0x357e04(_0x4b572f);});});}exports[_0x2ef3('0x14')]=function(_0x24d96a){var _0x3549f5=this;return new Promise(function(_0x52187f,_0x230daa){return db[_0x2ef3('0x15')][_0x2ef3('0x16')](_0x24d96a['body'],{'raw':_0x24d96a[_0x2ef3('0x17')]?_0x24d96a[_0x2ef3('0x17')][_0x2ef3('0x18')]===undefined?!![]:![]:!![]})[_0x2ef3('0x19')](function(_0x112738){logger['info']('CreateVoiceTransferReport',_0x24d96a);logger[_0x2ef3('0xb')](_0x2ef3('0x14'),_0x24d96a,JSON['stringify'](_0x112738));_0x52187f(_0x112738);})['catch'](function(_0x521784){logger[_0x2ef3('0xe')](_0x2ef3('0x14'),_0x521784[_0x2ef3('0x11')],_0x24d96a);_0x230daa(_0x3549f5['error'](0x1f4,_0x521784[_0x2ef3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 3a61122..1c1294e 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x53c8b8,_0x342fb3){var _0x59b9fa=function(_0x1bd129){while(--_0x1bd129){_0x53c8b8['push'](_0x53c8b8['shift']());}};_0x59b9fa(++_0x342fb3);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb4e6[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x59c376,_0x30b609){_0x59c376=_0x59c376-0x0;var _0x1fc48a=_0xb43b[_0x59c376];return _0x1fc48a;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 70b327f..7fd1b05 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 _0x63c9=['calls\x20fired:','conference','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','redis','localhost','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','NotFound','request','error','code','message','result','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','originate\x20executed!','catch','hangup','sessionId','user:%s','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls'];(function(_0x5c7e1f,_0x2b323e){var _0x491712=function(_0x2ed016){while(--_0x2ed016){_0x5c7e1f['push'](_0x5c7e1f['shift']());}};_0x491712(++_0x2b323e);}(_0x63c9,0x97));var _0x963c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x63c9[_0x4565bf];return _0x5610ba;};'use strict';var path=require(_0x963c('0x0'));var fs=require('fs');var _=require(_0x963c('0x1'));var db=require(_0x963c('0x2'))['db'];var config=require(_0x963c('0x3'));var util=require('util');var BPromise=require(_0x963c('0x4'));var jayson=require(_0x963c('0x5'));var amiClient=jayson[_0x963c('0x6')][_0x963c('0x7')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x963c('0x8')]=_['defaults'](config[_0x963c('0x8')],{'host':_0x963c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x963c('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x963c('0xa')]},'callNumber':{'type':_0x963c('0xb'),'required':[!![],_0x963c('0xc')]},'callerId':{'type':_0x963c('0xb')},'callbackUrl':{'type':_0x963c('0xb')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x963c('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x963c('0xd'),'required':[!![],_0x963c('0xa')]},'sessionId':{'type':_0x963c('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x963c('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x963c('0xb'),'required':[!![],_0x963c('0xe')]},'transferNumber':{'type':_0x963c('0xb'),'required':[!![],_0x963c('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x963c('0xd'),'required':[!![],_0x963c('0xa')]},'sessionId':{'type':_0x963c('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x963c('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x963c('0xd'),'required':[!![],_0x963c('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0x963c('0xd'),'required':[!![],_0x963c('0xa')]}});function emit(_0x3a60c6,_0x183a35,_0x1119d8){logger[_0x963c('0x10')](_0x3a60c6,_0x183a35,JSON[_0x963c('0x11')](_0x1119d8));io['to'](_0x3a60c6)[_0x963c('0x12')](_0x183a35,_0x1119d8);}function handleError(_0x4d479b){return function(_0x3e1746){console['log'](_0x963c('0x13'),_0x3e1746,_0x3e1746 instanceof RangeError);logger['error'](_0x3e1746[_0x963c('0x14')]);if(_0x3e1746 instanceof RangeError){if(_0x3e1746[_0x963c('0x15')]){delete _0x3e1746[_0x963c('0x15')];}_0x4d479b[_0x963c('0x16')](0x194)['send'](_0x3e1746);}else{if(_0x3e1746[_0x963c('0x15')]){delete _0x3e1746[_0x963c('0x15')];}_0x4d479b[_0x963c('0x16')](0x1f4)['send'](_0x3e1746);}};}function checkError(){return function(_0x245fe1){if(!_0x245fe1){throw new RangeError(_0x963c('0x17'));}return _0x245fe1;};}function respondWithRpcPromise(_0x417218,_0x1d3f0b){return new BPromise(function(_0x1afaaf,_0x4b566d){var _0x5a10e0=amiClient;return _0x5a10e0[_0x963c('0x18')](_0x417218,_0x1d3f0b)['then'](function(_0x145a07){if(_0x145a07[_0x963c('0x19')]){if(_0x145a07[_0x963c('0x19')][_0x963c('0x1a')]===0x1f4){return _0x4b566d(_0x145a07[_0x963c('0x19')]['message']);}return _0x1afaaf(_0x145a07[_0x963c('0x19')][_0x963c('0x1b')]);}else{_0x1afaaf(_0x145a07[_0x963c('0x1c')]);}})['catch'](function(_0x10cf35){_0x4b566d(_0x10cf35);});});}function getAgent(_0x53f145){return db[_0x963c('0x1d')][_0x963c('0x1e')]({'where':{'id':_0x53f145,'role':_0x963c('0x1f')}})[_0x963c('0x20')](checkError());}function getAgentCheckSession(_0x4bce70,_0x34907f){return new BPromise(function(_0x467d4c,_0x431384){var _0x36201f=respondWithRpcPromise(_0x963c('0x21'));var _0x1ff286=getAgent(_0x4bce70);Promise[_0x963c('0x22')]([_0x36201f,_0x1ff286])[_0x963c('0x20')](function(_0x520589){var _0x595606=_0x520589[0x0];var _0x2a313d=_0x520589[0x1];var _0xe22558=_[_0x963c('0x23')](_0x595606[_0x963c('0x24')],function(_0x5f9376){return _0x5f9376[_0x963c('0x25')]==_0x2a313d['id']&&_0x5f9376['sessionId']==_0x34907f;});if(_0xe22558[_0x963c('0x26')]==0x1){_0x467d4c(_0x2a313d);}else{_0x431384(new RangeError('sessionId\x20'+_0x34907f+_0x963c('0x27')));}});});}exports[_0x963c('0x28')]=function(_0x44d0d9,_0x451283){logger[_0x963c('0x10')](_0x963c('0x29'),_0x44d0d9[_0x963c('0x2a')]);var _0x3918e2=originateValidation[_0x963c('0x2b')](_0x44d0d9[_0x963c('0x2a')]);if(_0x3918e2[_0x963c('0x26')]>0x0){return _0x451283['status'](0x190)[_0x963c('0x2c')](_0x3918e2);}var _0x2fdbe5=_0x44d0d9[_0x963c('0x2a')][_0x963c('0x2d')];var _0xcd10da=_0x44d0d9['body'][_0x963c('0x2e')];var _0x515201=_0x44d0d9[_0x963c('0x2a')]['callerId'];var _0x142ec2=_0x44d0d9[_0x963c('0x2a')][_0x963c('0x2f')];return getAgent(_0x2fdbe5)['then'](function(_0x580f31){logger[_0x963c('0x10')](_0x963c('0x30'),_0x580f31['name']);emit(util[_0x963c('0x31')]('user:%s',_0x580f31[_0x963c('0x15')]),'webbar:originate',{'callNumber':_0xcd10da,'callerId':_0x515201,'callbackUrl':_0x142ec2});return _0x451283[_0x963c('0x16')](0xc8)[_0x963c('0x2c')]({'error':![],'message':_0x963c('0x32')});})[_0x963c('0x33')](handleError(_0x451283));};exports[_0x963c('0x34')]=function(_0x205e40,_0x13021f){logger[_0x963c('0x10')]('hangup\x20fired:',_0x205e40[_0x963c('0x2a')]);var _0x60e550=hangupValidation[_0x963c('0x2b')](_0x205e40[_0x963c('0x2a')]);if(_0x60e550[_0x963c('0x26')]>0x0){return _0x13021f['status'](0x190)['json'](_0x60e550);}var _0x49ae16=_0x205e40[_0x963c('0x2a')]['userId'];var _0x3e1ff9=_0x205e40[_0x963c('0x2a')][_0x963c('0x35')];return getAgent(_0x49ae16)['then'](function(_0x1a406f){logger[_0x963c('0x10')](_0x963c('0x30'),_0x1a406f[_0x963c('0x15')]);emit(util[_0x963c('0x31')](_0x963c('0x36'),_0x1a406f['name']),_0x963c('0x37'),{'sessionId':_0x3e1ff9});return _0x13021f['status'](0xc8)[_0x963c('0x2c')]({'error':![],'message':_0x963c('0x38')});})['catch'](handleError(_0x13021f));};exports[_0x963c('0x39')]=function(_0x202743,_0x251309){logger[_0x963c('0x10')]('answer\x20fired:',_0x202743[_0x963c('0x2a')]);var _0x80c06b=answerValidation['validate'](_0x202743[_0x963c('0x2a')]);if(_0x80c06b[_0x963c('0x26')]>0x0){return _0x251309[_0x963c('0x16')](0x190)[_0x963c('0x2c')](_0x80c06b);}var _0x1d0de6=_0x202743[_0x963c('0x2a')]['userId'];var _0x18e628=_0x202743[_0x963c('0x2a')][_0x963c('0x35')];return getAgent(_0x1d0de6)[_0x963c('0x20')](function(_0x187c16){logger[_0x963c('0x10')]('entityFound:',_0x187c16[_0x963c('0x15')]);emit(util[_0x963c('0x31')](_0x963c('0x36'),_0x187c16[_0x963c('0x15')]),_0x963c('0x3a'),{'sessionId':_0x18e628});return _0x251309[_0x963c('0x16')](0xc8)[_0x963c('0x2c')]({'error':![],'message':'answer\x20executed!'});})[_0x963c('0x33')](handleError(_0x251309));};exports['hold']=function(_0x138155,_0x3354a5){logger[_0x963c('0x10')](_0x963c('0x3b'),_0x138155[_0x963c('0x2a')]);var _0x4ca069=holdValidation[_0x963c('0x2b')](_0x138155[_0x963c('0x2a')]);if(_0x4ca069[_0x963c('0x26')]>0x0){return _0x3354a5[_0x963c('0x16')](0x190)[_0x963c('0x2c')](_0x4ca069);}var _0x445dc9=_0x138155['body'][_0x963c('0x2d')];var _0x56d84d=_0x138155[_0x963c('0x2a')][_0x963c('0x35')];return getAgent(_0x445dc9)['then'](function(_0x296b15){logger['info']('entityFound:',_0x296b15[_0x963c('0x15')]);emit(util[_0x963c('0x31')](_0x963c('0x36'),_0x296b15[_0x963c('0x15')]),_0x963c('0x3c'),{'sessionId':_0x56d84d});return _0x3354a5[_0x963c('0x16')](0xc8)[_0x963c('0x2c')]({'error':![],'message':_0x963c('0x3d')});})[_0x963c('0x33')](handleError(_0x3354a5));};exports['unhold']=function(_0xac1f80,_0x170b46){logger[_0x963c('0x10')](_0x963c('0x3e'),_0xac1f80[_0x963c('0x2a')]);var _0x566659=unholdValidation[_0x963c('0x2b')](_0xac1f80[_0x963c('0x2a')]);if(_0x566659[_0x963c('0x26')]>0x0){return _0x170b46[_0x963c('0x16')](0x190)[_0x963c('0x2c')](_0x566659);}var _0x3445d7=_0xac1f80[_0x963c('0x2a')]['userId'];var _0x3651f9=_0xac1f80[_0x963c('0x2a')][_0x963c('0x35')];return getAgent(_0x3445d7)[_0x963c('0x20')](function(_0x4b7e0a){logger['info'](_0x963c('0x30'),_0x4b7e0a['name']);emit(util['format']('user:%s',_0x4b7e0a['name']),'webbar:unhold',{'sessionId':_0x3651f9});return _0x170b46['status'](0xc8)['json']({'error':![],'message':_0x963c('0x3f')});})[_0x963c('0x33')](handleError(_0x170b46));};exports[_0x963c('0x40')]=function(_0x444db7,_0x4bff0e){logger['info'](_0x963c('0x41'),_0x4bff0e['body']);var _0x565ebb=callsValidation['validate'](_0x444db7['body']);if(_0x565ebb[_0x963c('0x26')]>0x0){return _0x4bff0e[_0x963c('0x16')](0x190)[_0x963c('0x2c')](_0x565ebb);}var _0x21135e=_0x444db7[_0x963c('0x2a')][_0x963c('0x2d')];var _0x9d41ec=respondWithRpcPromise(_0x963c('0x21'));var _0x3e3775=getAgent(_0x21135e);return Promise[_0x963c('0x22')]([_0x9d41ec,_0x3e3775])['then'](function(_0xc4870){var _0x9bd2ad=_0xc4870[0x0];var _0x25b437=_0xc4870[0x1];var _0x2097a8=_[_0x963c('0x23')](_0x9bd2ad[_0x963c('0x24')],function(_0x7016e9){return _0x7016e9[_0x963c('0x25')]==_0x25b437['id'];});return _0x4bff0e[_0x963c('0x16')](0xc8)[_0x963c('0x2c')]({'count':_0x2097a8[_0x963c('0x26')],'rows':_0x2097a8});})[_0x963c('0x33')](handleError(_0x4bff0e));};exports[_0x963c('0x42')]=function(_0x3de976,_0x5e77b9){logger[_0x963c('0x10')]('conference\x20fired:',_0x3de976[_0x963c('0x2a')]);var _0x353c5b=conferenceValidation['validate'](_0x3de976[_0x963c('0x2a')]);if(_0x353c5b[_0x963c('0x26')]>0x0){return _0x5e77b9[_0x963c('0x16')](0x190)[_0x963c('0x2c')](_0x353c5b);}var _0x3c8b62=_0x3de976[_0x963c('0x2a')][_0x963c('0x2d')];return getAgent(_0x3c8b62)[_0x963c('0x20')](function(_0x4f52fc){logger[_0x963c('0x10')](_0x963c('0x30'),_0x4f52fc[_0x963c('0x15')]);emit(util['format'](_0x963c('0x36'),_0x4f52fc[_0x963c('0x15')]),_0x963c('0x43'));return _0x5e77b9[_0x963c('0x16')](0xc8)[_0x963c('0x2c')]({'error':![],'message':'conference\x20executed!'});})[_0x963c('0x33')](handleError(_0x5e77b9));};exports['transfer']=function(_0x2b9e73,_0x388c30){logger[_0x963c('0x10')](_0x963c('0x44'),_0x2b9e73[_0x963c('0x2a')]);var _0x1abbc9=transferValidation[_0x963c('0x2b')](_0x2b9e73[_0x963c('0x2a')]);if(_0x1abbc9[_0x963c('0x26')]>0x0){return _0x388c30[_0x963c('0x16')](0x190)[_0x963c('0x2c')](_0x1abbc9);}var _0x5cbdd9=_0x2b9e73[_0x963c('0x2a')][_0x963c('0x2d')];var _0x835633=_0x2b9e73[_0x963c('0x2a')][_0x963c('0x35')];var _0x1dcf0c=_0x2b9e73[_0x963c('0x2a')][_0x963c('0x45')];return getAgent(_0x5cbdd9)[_0x963c('0x20')](function(_0xcabad5){logger[_0x963c('0x10')]('entityFound:',_0xcabad5[_0x963c('0x15')]);emit(util[_0x963c('0x31')](_0x963c('0x36'),_0xcabad5[_0x963c('0x15')]),_0x963c('0x46'),{'sessionId':_0x835633,'transferNumber':_0x1dcf0c});return _0x388c30[_0x963c('0x16')](0xc8)[_0x963c('0x2c')]({'error':![],'message':_0x963c('0x47')});})[_0x963c('0x33')](handleError(_0x388c30));}; \ No newline at end of file +var _0xc102=['callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','rows','conference','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','info','stringify','log','handleError:','error','stack','name','status','NotFound','request','code','message','catch','User','findOne','then','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId'];(function(_0x16dfcc,_0x4ef8d7){var _0x324ef5=function(_0x23f438){while(--_0x23f438){_0x16dfcc['push'](_0x16dfcc['shift']());}};_0x324ef5(++_0x4ef8d7);}(_0xc102,0xb8));var _0x2c10=function(_0x8e4de5,_0xb5ba1c){_0x8e4de5=_0x8e4de5-0x0;var _0x447ef9=_0xc102[_0x8e4de5];return _0x447ef9;};'use strict';var path=require(_0x2c10('0x0'));var fs=require('fs');var _=require(_0x2c10('0x1'));var db=require(_0x2c10('0x2'))['db'];var config=require(_0x2c10('0x3'));var util=require(_0x2c10('0x4'));var BPromise=require(_0x2c10('0x5'));var jayson=require(_0x2c10('0x6'));var amiClient=jayson[_0x2c10('0x7')][_0x2c10('0x8')]({'port':0x232a});var logger=require(_0x2c10('0x9'))(_0x2c10('0xa'));var Redis=require(_0x2c10('0xb'));config[_0x2c10('0xc')]=_[_0x2c10('0xd')](config[_0x2c10('0xc')],{'host':_0x2c10('0xe'),'port':0x18eb});var io=require(_0x2c10('0xf'))(new Redis(config[_0x2c10('0xc')]));var Schema=require(_0x2c10('0x10'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2c10('0x11')]},'callNumber':{'type':_0x2c10('0x12'),'required':[!![],_0x2c10('0x13')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x2c10('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x2c10('0x14'),'required':[!![],_0x2c10('0x11')]},'sessionId':{'type':_0x2c10('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2c10('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2c10('0x14'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2c10('0x12'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2c10('0x12'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x2c10('0x14'),'required':[!![],_0x2c10('0x11')]},'sessionId':{'type':_0x2c10('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2c10('0x14'),'required':[!![],_0x2c10('0x11')]},'sessionId':{'type':_0x2c10('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2c10('0x14'),'required':[!![],_0x2c10('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x2c10('0x14'),'required':[!![],_0x2c10('0x11')]}});function emit(_0x16c971,_0x21e155,_0x4a5ce5){logger[_0x2c10('0x15')](_0x16c971,_0x21e155,JSON[_0x2c10('0x16')](_0x4a5ce5));io['to'](_0x16c971)['emit'](_0x21e155,_0x4a5ce5);}function handleError(_0x47d90a){return function(_0x43adaa){console[_0x2c10('0x17')](_0x2c10('0x18'),_0x43adaa,_0x43adaa instanceof RangeError);logger[_0x2c10('0x19')](_0x43adaa[_0x2c10('0x1a')]);if(_0x43adaa instanceof RangeError){if(_0x43adaa[_0x2c10('0x1b')]){delete _0x43adaa[_0x2c10('0x1b')];}_0x47d90a[_0x2c10('0x1c')](0x194)['send'](_0x43adaa);}else{if(_0x43adaa[_0x2c10('0x1b')]){delete _0x43adaa['name'];}_0x47d90a[_0x2c10('0x1c')](0x1f4)['send'](_0x43adaa);}};}function checkError(){return function(_0x50e19e){if(!_0x50e19e){throw new RangeError(_0x2c10('0x1d'));}return _0x50e19e;};}function respondWithRpcPromise(_0x4885c1,_0x4bf024){return new BPromise(function(_0x3aad40,_0x145ed9){var _0x32c97a=amiClient;return _0x32c97a[_0x2c10('0x1e')](_0x4885c1,_0x4bf024)['then'](function(_0x2f9a5b){if(_0x2f9a5b[_0x2c10('0x19')]){if(_0x2f9a5b[_0x2c10('0x19')][_0x2c10('0x1f')]===0x1f4){return _0x145ed9(_0x2f9a5b[_0x2c10('0x19')][_0x2c10('0x20')]);}return _0x3aad40(_0x2f9a5b[_0x2c10('0x19')]['message']);}else{_0x3aad40(_0x2f9a5b['result']);}})[_0x2c10('0x21')](function(_0x5e7c2e){_0x145ed9(_0x5e7c2e);});});}function getAgent(_0x683f8f){return db[_0x2c10('0x22')][_0x2c10('0x23')]({'where':{'id':_0x683f8f,'role':'agent'}})[_0x2c10('0x24')](checkError());}function getAgentCheckSession(_0x488aab,_0x2dcf9e){return new BPromise(function(_0x3045db,_0x37d18c){var _0xc43e86=respondWithRpcPromise('VoiceChannels');var _0xff2f84=getAgent(_0x488aab);Promise['all']([_0xc43e86,_0xff2f84])['then'](function(_0xa50422){var _0x318a90=_0xa50422[0x0];var _0xfb43ca=_0xa50422[0x1];var _0x3ab77a=_[_0x2c10('0x25')](_0x318a90['rows'],function(_0x2c3538){return _0x2c3538[_0x2c10('0x26')]==_0xfb43ca['id']&&_0x2c3538[_0x2c10('0x27')]==_0x2dcf9e;});if(_0x3ab77a[_0x2c10('0x28')]==0x1){_0x3045db(_0xfb43ca);}else{_0x37d18c(new RangeError(_0x2c10('0x29')+_0x2dcf9e+_0x2c10('0x2a')));}});});}exports[_0x2c10('0x2b')]=function(_0x1bb6b1,_0x50fde){logger[_0x2c10('0x15')]('originate\x20fired:',_0x1bb6b1[_0x2c10('0x2c')]);var _0x5a4951=originateValidation[_0x2c10('0x10')](_0x1bb6b1[_0x2c10('0x2c')]);if(_0x5a4951[_0x2c10('0x28')]>0x0){return _0x50fde[_0x2c10('0x1c')](0x190)[_0x2c10('0x2d')](_0x5a4951);}var _0x2666fc=_0x1bb6b1[_0x2c10('0x2c')][_0x2c10('0x2e')];var _0x549a63=_0x1bb6b1[_0x2c10('0x2c')]['callNumber'];var _0xf329d6=_0x1bb6b1['body'][_0x2c10('0x2f')];var _0x2c374d=_0x1bb6b1[_0x2c10('0x2c')][_0x2c10('0x30')];return getAgent(_0x2666fc)[_0x2c10('0x24')](function(_0x2c2b2a){logger['info'](_0x2c10('0x31'),_0x2c2b2a['name']);emit(util[_0x2c10('0x32')](_0x2c10('0x33'),_0x2c2b2a['name']),'webbar:originate',{'callNumber':_0x549a63,'callerId':_0xf329d6,'callbackUrl':_0x2c374d});return _0x50fde[_0x2c10('0x1c')](0xc8)[_0x2c10('0x2d')]({'error':![],'message':_0x2c10('0x34')});})['catch'](handleError(_0x50fde));};exports['hangup']=function(_0x15ba65,_0x5e74f3){logger[_0x2c10('0x15')](_0x2c10('0x35'),_0x15ba65[_0x2c10('0x2c')]);var _0x2b49db=hangupValidation[_0x2c10('0x10')](_0x15ba65['body']);if(_0x2b49db[_0x2c10('0x28')]>0x0){return _0x5e74f3[_0x2c10('0x1c')](0x190)[_0x2c10('0x2d')](_0x2b49db);}var _0x406c81=_0x15ba65['body'][_0x2c10('0x2e')];var _0x225b63=_0x15ba65[_0x2c10('0x2c')][_0x2c10('0x27')];return getAgent(_0x406c81)[_0x2c10('0x24')](function(_0x49c938){logger[_0x2c10('0x15')](_0x2c10('0x31'),_0x49c938[_0x2c10('0x1b')]);emit(util[_0x2c10('0x32')]('user:%s',_0x49c938[_0x2c10('0x1b')]),_0x2c10('0x36'),{'sessionId':_0x225b63});return _0x5e74f3[_0x2c10('0x1c')](0xc8)[_0x2c10('0x2d')]({'error':![],'message':_0x2c10('0x37')});})[_0x2c10('0x21')](handleError(_0x5e74f3));};exports['answer']=function(_0x535e78,_0x38916d){logger['info'](_0x2c10('0x38'),_0x535e78[_0x2c10('0x2c')]);var _0x2566fd=answerValidation['validate'](_0x535e78['body']);if(_0x2566fd[_0x2c10('0x28')]>0x0){return _0x38916d[_0x2c10('0x1c')](0x190)['json'](_0x2566fd);}var _0x118782=_0x535e78[_0x2c10('0x2c')][_0x2c10('0x2e')];var _0x5aa3bf=_0x535e78['body'][_0x2c10('0x27')];return getAgent(_0x118782)[_0x2c10('0x24')](function(_0x59ec17){logger[_0x2c10('0x15')]('entityFound:',_0x59ec17[_0x2c10('0x1b')]);emit(util[_0x2c10('0x32')](_0x2c10('0x33'),_0x59ec17[_0x2c10('0x1b')]),_0x2c10('0x39'),{'sessionId':_0x5aa3bf});return _0x38916d[_0x2c10('0x1c')](0xc8)[_0x2c10('0x2d')]({'error':![],'message':_0x2c10('0x3a')});})[_0x2c10('0x21')](handleError(_0x38916d));};exports[_0x2c10('0x3b')]=function(_0x5c8eef,_0x2d4c35){logger[_0x2c10('0x15')](_0x2c10('0x3c'),_0x5c8eef[_0x2c10('0x2c')]);var _0x2714ad=holdValidation['validate'](_0x5c8eef['body']);if(_0x2714ad[_0x2c10('0x28')]>0x0){return _0x2d4c35[_0x2c10('0x1c')](0x190)[_0x2c10('0x2d')](_0x2714ad);}var _0x469b87=_0x5c8eef[_0x2c10('0x2c')][_0x2c10('0x2e')];var _0x5d7a4f=_0x5c8eef[_0x2c10('0x2c')][_0x2c10('0x27')];return getAgent(_0x469b87)[_0x2c10('0x24')](function(_0x57c90e){logger[_0x2c10('0x15')](_0x2c10('0x31'),_0x57c90e[_0x2c10('0x1b')]);emit(util[_0x2c10('0x32')](_0x2c10('0x33'),_0x57c90e[_0x2c10('0x1b')]),'webbar:hold',{'sessionId':_0x5d7a4f});return _0x2d4c35[_0x2c10('0x1c')](0xc8)[_0x2c10('0x2d')]({'error':![],'message':_0x2c10('0x3d')});})['catch'](handleError(_0x2d4c35));};exports[_0x2c10('0x3e')]=function(_0x20a738,_0x2f6a2a){logger['info'](_0x2c10('0x3f'),_0x20a738[_0x2c10('0x2c')]);var _0x4a6787=unholdValidation[_0x2c10('0x10')](_0x20a738[_0x2c10('0x2c')]);if(_0x4a6787[_0x2c10('0x28')]>0x0){return _0x2f6a2a[_0x2c10('0x1c')](0x190)[_0x2c10('0x2d')](_0x4a6787);}var _0x6e5c56=_0x20a738[_0x2c10('0x2c')]['userId'];var _0x548def=_0x20a738[_0x2c10('0x2c')][_0x2c10('0x27')];return getAgent(_0x6e5c56)[_0x2c10('0x24')](function(_0x4da2ef){logger[_0x2c10('0x15')](_0x2c10('0x31'),_0x4da2ef[_0x2c10('0x1b')]);emit(util[_0x2c10('0x32')](_0x2c10('0x33'),_0x4da2ef[_0x2c10('0x1b')]),'webbar:unhold',{'sessionId':_0x548def});return _0x2f6a2a['status'](0xc8)[_0x2c10('0x2d')]({'error':![],'message':_0x2c10('0x40')});})['catch'](handleError(_0x2f6a2a));};exports[_0x2c10('0x41')]=function(_0x8ddee6,_0x49322f){logger[_0x2c10('0x15')](_0x2c10('0x42'),_0x49322f[_0x2c10('0x2c')]);var _0x1dc9cc=callsValidation[_0x2c10('0x10')](_0x8ddee6[_0x2c10('0x2c')]);if(_0x1dc9cc[_0x2c10('0x28')]>0x0){return _0x49322f[_0x2c10('0x1c')](0x190)['json'](_0x1dc9cc);}var _0x422222=_0x8ddee6[_0x2c10('0x2c')][_0x2c10('0x2e')];var _0x190b55=respondWithRpcPromise(_0x2c10('0x43'));var _0x3e500f=getAgent(_0x422222);return Promise[_0x2c10('0x44')]([_0x190b55,_0x3e500f])['then'](function(_0xf69c36){var _0x5af363=_0xf69c36[0x0];var _0x446504=_0xf69c36[0x1];var _0x52e5eb=_[_0x2c10('0x25')](_0x5af363[_0x2c10('0x45')],function(_0x14faaa){return _0x14faaa[_0x2c10('0x26')]==_0x446504['id'];});return _0x49322f[_0x2c10('0x1c')](0xc8)[_0x2c10('0x2d')]({'count':_0x52e5eb[_0x2c10('0x28')],'rows':_0x52e5eb});})[_0x2c10('0x21')](handleError(_0x49322f));};exports[_0x2c10('0x46')]=function(_0x108c21,_0x21dd7e){logger['info']('conference\x20fired:',_0x108c21[_0x2c10('0x2c')]);var _0x2abc55=conferenceValidation['validate'](_0x108c21[_0x2c10('0x2c')]);if(_0x2abc55['length']>0x0){return _0x21dd7e['status'](0x190)[_0x2c10('0x2d')](_0x2abc55);}var _0x38d00b=_0x108c21[_0x2c10('0x2c')][_0x2c10('0x2e')];return getAgent(_0x38d00b)[_0x2c10('0x24')](function(_0x242e54){logger[_0x2c10('0x15')](_0x2c10('0x31'),_0x242e54[_0x2c10('0x1b')]);emit(util[_0x2c10('0x32')](_0x2c10('0x33'),_0x242e54[_0x2c10('0x1b')]),_0x2c10('0x47'));return _0x21dd7e[_0x2c10('0x1c')](0xc8)[_0x2c10('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0x2c10('0x21')](handleError(_0x21dd7e));};exports[_0x2c10('0x48')]=function(_0x3dc383,_0x3b98a9){logger[_0x2c10('0x15')](_0x2c10('0x49'),_0x3dc383[_0x2c10('0x2c')]);var _0x1b744c=transferValidation[_0x2c10('0x10')](_0x3dc383[_0x2c10('0x2c')]);if(_0x1b744c[_0x2c10('0x28')]>0x0){return _0x3b98a9[_0x2c10('0x1c')](0x190)[_0x2c10('0x2d')](_0x1b744c);}var _0x45667f=_0x3dc383[_0x2c10('0x2c')][_0x2c10('0x2e')];var _0x2dd6bd=_0x3dc383['body'][_0x2c10('0x27')];var _0x4b7310=_0x3dc383['body'][_0x2c10('0x4a')];return getAgent(_0x45667f)[_0x2c10('0x24')](function(_0x5737c7){logger[_0x2c10('0x15')](_0x2c10('0x31'),_0x5737c7[_0x2c10('0x1b')]);emit(util[_0x2c10('0x32')]('user:%s',_0x5737c7[_0x2c10('0x1b')]),_0x2c10('0x4b'),{'sessionId':_0x2dd6bd,'transferNumber':_0x4b7310});return _0x3b98a9[_0x2c10('0x1c')](0xc8)['json']({'error':![],'message':_0x2c10('0x4c')});})[_0x2c10('0x21')](handleError(_0x3b98a9));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c6a75a6..d43f59e 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 _0xe6cf=['./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x565dc8,_0x4261e5){var _0x46d643=function(_0x90b2f7){while(--_0x90b2f7){_0x565dc8['push'](_0x565dc8['shift']());}};_0x46d643(++_0x4261e5);}(_0xe6cf,0x1f0));var _0xfe6c=function(_0x3a96e2,_0x5ecb0f){_0x3a96e2=_0x3a96e2-0x0;var _0x2c1e1f=_0xe6cf[_0x3a96e2];return _0x2c1e1f;};'use strict';var multer=require('multer');var util=require(_0xfe6c('0x0'));var path=require(_0xfe6c('0x1'));var timeout=require(_0xfe6c('0x2'));var express=require(_0xfe6c('0x3'));var router=express[_0xfe6c('0x4')]();var fs_extra=require(_0xfe6c('0x5'));var auth=require(_0xfe6c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe6c('0x7'));var controller=require(_0xfe6c('0x8'));router[_0xfe6c('0x9')]('/',auth[_0xfe6c('0xa')](),controller[_0xfe6c('0xb')]);router[_0xfe6c('0x9')]('/describe',auth[_0xfe6c('0xa')](),controller[_0xfe6c('0xc')]);router[_0xfe6c('0x9')](_0xfe6c('0xd'),auth[_0xfe6c('0xa')](),controller['show']);router[_0xfe6c('0x9')](_0xfe6c('0xe'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0xf')]);router['get']('/:id/canned_answers',auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x10')]);router[_0xfe6c('0x9')](_0xfe6c('0x11'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x12')]);router[_0xfe6c('0x9')](_0xfe6c('0x13'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x14')]);router['post']('/',auth[_0xfe6c('0xa')](),controller['create']);router[_0xfe6c('0x15')](_0xfe6c('0xe'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x16')]);router[_0xfe6c('0x15')](_0xfe6c('0x17'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x18')]);router['post'](_0xfe6c('0x11'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x19')]);router[_0xfe6c('0x15')](_0xfe6c('0x13'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x1a')]);router[_0xfe6c('0x15')](_0xfe6c('0x1b'),controller[_0xfe6c('0x1c')]);router[_0xfe6c('0x15')](_0xfe6c('0x1d'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x1e')]);router['put'](_0xfe6c('0xd'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x1f')]);router[_0xfe6c('0x20')](_0xfe6c('0xd'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x21')]);router[_0xfe6c('0x20')](_0xfe6c('0xe'),auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x22')]);router['delete'](_0xfe6c('0x17'),auth[_0xfe6c('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xfe6c('0xa')](),controller[_0xfe6c('0x23')]);module['exports']=router; \ No newline at end of file +var _0x17f2=['getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x3900be,_0x59a4f5){var _0x1ca48e=function(_0x1885ee){while(--_0x1885ee){_0x3900be['push'](_0x3900be['shift']());}};_0x1ca48e(++_0x59a4f5);}(_0x17f2,0x14e));var _0x217f=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0x17f2[_0x3cec8c];return _0x38032e;};'use strict';var multer=require(_0x217f('0x0'));var util=require('util');var path=require(_0x217f('0x1'));var timeout=require(_0x217f('0x2'));var express=require(_0x217f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x217f('0x4'));var interaction=require(_0x217f('0x5'));var config=require('../../config/environment');var controller=require(_0x217f('0x6'));router[_0x217f('0x7')]('/',auth[_0x217f('0x8')](),controller[_0x217f('0x9')]);router[_0x217f('0x7')](_0x217f('0xa'),auth[_0x217f('0x8')](),controller[_0x217f('0xb')]);router[_0x217f('0x7')](_0x217f('0xc'),auth[_0x217f('0x8')](),controller['show']);router[_0x217f('0x7')](_0x217f('0xd'),auth[_0x217f('0x8')](),controller[_0x217f('0xe')]);router['get'](_0x217f('0xf'),auth[_0x217f('0x8')](),controller[_0x217f('0x10')]);router['get'](_0x217f('0x11'),auth[_0x217f('0x8')](),controller[_0x217f('0x12')]);router[_0x217f('0x7')](_0x217f('0x13'),auth[_0x217f('0x8')](),controller[_0x217f('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x217f('0x15')]);router[_0x217f('0x16')]('/:id/dispositions',auth[_0x217f('0x8')](),controller[_0x217f('0x17')]);router[_0x217f('0x16')](_0x217f('0xf'),auth[_0x217f('0x8')](),controller[_0x217f('0x18')]);router[_0x217f('0x16')](_0x217f('0x11'),auth[_0x217f('0x8')](),controller['addAgents']);router['post'](_0x217f('0x13'),auth[_0x217f('0x8')](),controller[_0x217f('0x19')]);router[_0x217f('0x16')](_0x217f('0x1a'),controller['notify']);router[_0x217f('0x16')](_0x217f('0x1b'),auth[_0x217f('0x8')](),controller[_0x217f('0x1c')]);router[_0x217f('0x1d')](_0x217f('0xc'),auth[_0x217f('0x8')](),controller[_0x217f('0x1e')]);router['delete']('/:id',auth[_0x217f('0x8')](),controller[_0x217f('0x1f')]);router[_0x217f('0x20')](_0x217f('0xd'),auth[_0x217f('0x8')](),controller[_0x217f('0x21')]);router[_0x217f('0x20')](_0x217f('0xf'),auth[_0x217f('0x8')](),controller[_0x217f('0x22')]);router[_0x217f('0x20')]('/:id/users',auth[_0x217f('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6f139a1..5375b1a 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 _0xa535=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xa535,0x19b));var _0x5a53=function(_0x28c368,_0x31fab2){_0x28c368=_0x28c368-0x0;var _0x5969ee=_0xa535[_0x28c368];return _0x5969ee;};'use strict';var Sequelize=require(_0x5a53('0x0'));var rs=require(_0x5a53('0x1'));module[_0x5a53('0x2')]={'name':{'type':Sequelize[_0x5a53('0x3')],'unique':_0x5a53('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5a53('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5a53('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5a53('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5a53('0x3')]},'type':{'type':Sequelize[_0x5a53('0x5')](_0x5a53('0x6'),_0x5a53('0x7'))},'accountSid':{'type':Sequelize[_0x5a53('0x3')]},'baseUrl':{'type':Sequelize[_0x5a53('0x3')]},'authToken':{'type':Sequelize[_0x5a53('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5a53('0x8');}},'notificationSound':{'type':Sequelize[_0x5a53('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5a53('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5a53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5a53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5a53('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5a53('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5a53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a53('0xa')],'comment':_0x5a53('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x5a53('0x9')],'defaultValue':![],'comment':_0x5a53('0xc'),'set':function(_0x28ac08){if(!_0x28ac08){this[_0x5a53('0xd')](_0x5a53('0xe'),null);}this[_0x5a53('0xd')]('mandatoryDisposition',_0x28ac08);}},'description':{'type':Sequelize[_0x5a53('0x3')]}}; \ No newline at end of file +var _0x6012=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xc30587,_0x301ea6){var _0x4ffaa1=function(_0xa99cdf){while(--_0xa99cdf){_0xc30587['push'](_0xc30587['shift']());}};_0x4ffaa1(++_0x301ea6);}(_0x6012,0xeb));var _0x2601=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x6012[_0x4ec13d];return _0x3c3fa7;};'use strict';var Sequelize=require(_0x2601('0x0'));var rs=require(_0x2601('0x1'));module[_0x2601('0x2')]={'name':{'type':Sequelize[_0x2601('0x3')],'unique':_0x2601('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x2601('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2601('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2601('0x3')],'defaultValue':function(){return rs[_0x2601('0x5')]();}},'phone':{'type':Sequelize[_0x2601('0x3')]},'type':{'type':Sequelize[_0x2601('0x6')](_0x2601('0x7'),_0x2601('0x8'))},'accountSid':{'type':Sequelize[_0x2601('0x3')]},'baseUrl':{'type':Sequelize[_0x2601('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2601('0x9')],'defaultValue':function(){return _0x2601('0xa');}},'notificationSound':{'type':Sequelize[_0x2601('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2601('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2601('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2601('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2601('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2601('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2601('0xc')],'comment':_0x2601('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2601('0xe'),'set':function(_0x552690){if(!_0x552690){this[_0x2601('0xf')](_0x2601('0x10'),null);}this[_0x2601('0xf')](_0x2601('0x11'),_0x552690);}},'description':{'type':Sequelize[_0x2601('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8f896f8..c8bfb6f 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 _0x75d4=['localhost','jayson/promise','request','info','debug','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','WhatsappAccountId','Disposition','findOne','ids','getAnswers','CannedAnswer','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x53ce96,_0x5bb735){var _0x162ed4=function(_0x2588e8){while(--_0x2588e8){_0x53ce96['push'](_0x53ce96['shift']());}};_0x162ed4(++_0x5bb735);}(_0x75d4,0x16e));var _0x475d=function(_0x248fb6,_0xa44f1a){_0x248fb6=_0x248fb6-0x0;var _0x207e5f=_0x75d4[_0x248fb6];return _0x207e5f;};'use strict';var emlformat=require(_0x475d('0x0'));var rimraf=require(_0x475d('0x1'));var zipdir=require(_0x475d('0x2'));var jsonpatch=require(_0x475d('0x3'));var rp=require(_0x475d('0x4'));var moment=require(_0x475d('0x5'));var BPromise=require(_0x475d('0x6'));var Mustache=require(_0x475d('0x7'));var util=require(_0x475d('0x8'));var path=require(_0x475d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x475d('0xa'));var _=require(_0x475d('0xb'));var squel=require(_0x475d('0xc'));var crypto=require('crypto');var jsforce=require(_0x475d('0xd'));var deskjs=require(_0x475d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x475d('0xf'));var Redis=require(_0x475d('0x10'));var authService=require(_0x475d('0x11'));var qs=require(_0x475d('0x12'));var as=require(_0x475d('0x13'));var hardwareService=require(_0x475d('0x14'));var logger=require(_0x475d('0x15'))(_0x475d('0x16'));var utils=require(_0x475d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x475d('0x18'));var db=require(_0x475d('0x19'))['db'];config[_0x475d('0x1a')]=_[_0x475d('0x1b')](config[_0x475d('0x1a')],{'host':_0x475d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x475d('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1a00fc,_0xf9f5c7,_0x4722d5,_0x2613d2){return new BPromise(function(_0x3b1dfd,_0x2f1e97){var _0x6de170=_0x2613d2||client;return _0x6de170[_0x475d('0x1e')](_0x1a00fc,_0x4722d5)['then'](function(_0xe2ac1f){logger[_0x475d('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0xf9f5c7,'request\x20sent');logger[_0x475d('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf9f5c7,_0x475d('0x21'),JSON[_0x475d('0x22')](_0xe2ac1f));if(_0xe2ac1f['error']){if(_0xe2ac1f[_0x475d('0x23')][_0x475d('0x24')]===0x1f4){logger[_0x475d('0x23')](_0x475d('0x25'),_0xf9f5c7,_0xe2ac1f[_0x475d('0x23')][_0x475d('0x26')]);return _0x2f1e97(_0xe2ac1f['error']['message']);}logger[_0x475d('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0xf9f5c7,_0xe2ac1f[_0x475d('0x23')][_0x475d('0x26')]);return _0x3b1dfd(_0xe2ac1f[_0x475d('0x23')]['message']);}else{logger[_0x475d('0x1f')](_0x475d('0x25'),_0xf9f5c7,_0x475d('0x21'));_0x3b1dfd(_0xe2ac1f['result'][_0x475d('0x26')]);}})[_0x475d('0x27')](function(_0x4365f0){logger['error'](_0x475d('0x25'),_0xf9f5c7,_0x4365f0);_0x2f1e97(_0x4365f0);});});}function respondWithStatusCode(_0x357f55,_0x1a2ecf){_0x1a2ecf=_0x1a2ecf||0xcc;return function(_0x34ddfa){if(_0x34ddfa){return _0x357f55[_0x475d('0x28')](_0x1a2ecf);}return _0x357f55[_0x475d('0x29')](_0x1a2ecf)[_0x475d('0x2a')]();};}function respondWithResult(_0x328228,_0x4a5a38){_0x4a5a38=_0x4a5a38||0xc8;return function(_0x230220){if(_0x230220){return _0x328228[_0x475d('0x29')](_0x4a5a38)['json'](_0x230220);}};}function respondWithFilteredResult(_0x1c39a1,_0x3a979d){return function(_0xf1a65f){if(_0xf1a65f){var _0x3ee84d=typeof _0x3a979d[_0x475d('0x2b')]===_0x475d('0x2c')&&typeof _0x3a979d['limit']===_0x475d('0x2c');var _0xe02ad3=_0xf1a65f[_0x475d('0x2d')];var _0x2f746b=_0x3ee84d?0x0:_0x3a979d[_0x475d('0x2b')];var _0x2539be=_0x3ee84d?_0xf1a65f[_0x475d('0x2d')]:_0x3a979d[_0x475d('0x2b')]+_0x3a979d[_0x475d('0x2e')];var _0x2d620b;if(_0x2539be>=_0xe02ad3){_0x2539be=_0xe02ad3;_0x2d620b=0xc8;}else{_0x2d620b=0xce;}_0x1c39a1['status'](_0x2d620b);return _0x1c39a1[_0x475d('0x2f')](_0x475d('0x30'),_0x2f746b+'-'+_0x2539be+'/'+_0xe02ad3)[_0x475d('0x31')](_0xf1a65f);}return null;};}function patchUpdates(_0x4de709){return function(_0x45b224){try{jsonpatch[_0x475d('0x32')](_0x45b224,_0x4de709,!![]);}catch(_0x3a4b81){return BPromise['reject'](_0x3a4b81);}return _0x45b224[_0x475d('0x33')]();};}function saveUpdates(_0x304158,_0xcd11e1){return function(_0x1fb3ae){if(_0x1fb3ae){return _0x1fb3ae[_0x475d('0x34')](_0x304158)[_0x475d('0x35')](function(_0x381efa){return _0x381efa;});}return null;};}function removeEntity(_0x535fb0,_0x83f3a1){return function(_0x56398a){if(_0x56398a){return _0x56398a[_0x475d('0x36')]()[_0x475d('0x35')](function(){var _0x5eb419=_0x56398a[_0x475d('0x37')]({'plain':!![]});var _0x2d6cb3='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2d6cb3,'resourceId':_0x5eb419['id']}})[_0x475d('0x35')](function(){return _0x56398a;});})['then'](function(){_0x535fb0[_0x475d('0x29')](0xcc)[_0x475d('0x2a')]();});}};}function handleEntityNotFound(_0x3d2ec6,_0x29d786){return function(_0x31535b){if(!_0x31535b){_0x3d2ec6[_0x475d('0x28')](0x194);}return _0x31535b;};}function handleError(_0x32bc44,_0x41ecbf){_0x41ecbf=_0x41ecbf||0x1f4;return function(_0x275aa1){logger[_0x475d('0x23')](_0x275aa1[_0x475d('0x38')]);if(_0x275aa1[_0x475d('0x39')]){delete _0x275aa1[_0x475d('0x39')];}_0x32bc44['status'](_0x41ecbf)[_0x475d('0x3a')](_0x275aa1);};}exports[_0x475d('0x3b')]=function(_0x1248d4,_0xa2ec1){var _0x56257a={'include':[{'model':db[_0x475d('0x3c')],'as':_0x475d('0x3d')}]},_0x32285a={},_0x941a76={'count':0x0,'rows':[]};var _0x3bc384=_['map'](db[_0x475d('0x3e')][_0x475d('0x3f')],function(_0x4fd7cf){return{'name':_0x4fd7cf[_0x475d('0x40')],'type':_0x4fd7cf[_0x475d('0x41')]['key']};});_0x32285a[_0x475d('0x42')]=_[_0x475d('0x43')](_0x3bc384,_0x475d('0x39'));_0x32285a[_0x475d('0x44')]=_[_0x475d('0x45')](_0x1248d4[_0x475d('0x44')]);_0x32285a[_0x475d('0x46')]=_[_0x475d('0x47')](_0x32285a[_0x475d('0x42')],_0x32285a[_0x475d('0x44')]);_0x56257a[_0x475d('0x48')]=_[_0x475d('0x47')](_0x32285a[_0x475d('0x42')],qs['fields'](_0x1248d4[_0x475d('0x44')]['fields']));_0x56257a['attributes']=_0x56257a['attributes'][_0x475d('0x49')]?_0x56257a[_0x475d('0x48')]:_0x32285a[_0x475d('0x42')];if(!_0x1248d4[_0x475d('0x44')][_0x475d('0x4a')](_0x475d('0x4b'))){_0x56257a['limit']=qs['limit'](_0x1248d4['query'][_0x475d('0x2e')]);_0x56257a[_0x475d('0x2b')]=qs[_0x475d('0x2b')](_0x1248d4[_0x475d('0x44')][_0x475d('0x2b')]);}_0x56257a[_0x475d('0x4c')]=qs[_0x475d('0x4d')](_0x1248d4[_0x475d('0x44')][_0x475d('0x4d')]);_0x56257a[_0x475d('0x4e')]=qs['filters'](_[_0x475d('0x4f')](_0x1248d4[_0x475d('0x44')],_0x32285a[_0x475d('0x46')]),_0x3bc384);if(_0x1248d4[_0x475d('0x44')][_0x475d('0x50')]){_0x56257a[_0x475d('0x4e')]=_[_0x475d('0x51')](_0x56257a[_0x475d('0x4e')],{'$or':_[_0x475d('0x43')](_0x3bc384,function(_0x26593b){if(_0x26593b[_0x475d('0x41')]!==_0x475d('0x52')){var _0x13ea65={};_0x13ea65[_0x26593b[_0x475d('0x39')]]={'$like':'%'+_0x1248d4[_0x475d('0x44')][_0x475d('0x50')]+'%'};return _0x13ea65;}})});}_0x56257a=_[_0x475d('0x51')]({},_0x56257a,_0x1248d4['options']);var _0x1181f3={'where':_0x56257a['where']};return db[_0x475d('0x3e')]['count'](_0x1181f3)[_0x475d('0x35')](function(_0x21acdf){_0x941a76[_0x475d('0x2d')]=_0x21acdf;if(_0x1248d4[_0x475d('0x44')][_0x475d('0x53')]){_0x56257a[_0x475d('0x54')]=[{'all':!![]}];}return db[_0x475d('0x3e')][_0x475d('0x55')](_0x56257a);})[_0x475d('0x35')](function(_0x3a3f36){_0x941a76[_0x475d('0x56')]=_0x3a3f36;return _0x941a76;})[_0x475d('0x35')](respondWithFilteredResult(_0xa2ec1,_0x56257a))[_0x475d('0x27')](handleError(_0xa2ec1,null));};exports[_0x475d('0x57')]=function(_0x1187a3,_0x1d5264){var _0x5bc7ea={'raw':![],'where':{'id':_0x1187a3[_0x475d('0x58')]['id']},'include':[{'model':db[_0x475d('0x3c')],'as':_0x475d('0x3d')}]},_0x202fe3={};_0x202fe3[_0x475d('0x42')]=_[_0x475d('0x45')](db['WhatsappAccount'][_0x475d('0x3f')]);_0x202fe3['query']=_[_0x475d('0x45')](_0x1187a3['query']);_0x202fe3[_0x475d('0x46')]=_[_0x475d('0x47')](_0x202fe3['model'],_0x202fe3[_0x475d('0x44')]);_0x5bc7ea[_0x475d('0x48')]=_[_0x475d('0x47')](_0x202fe3[_0x475d('0x42')],qs[_0x475d('0x59')](_0x1187a3[_0x475d('0x44')]['fields']));_0x5bc7ea[_0x475d('0x48')]=_0x5bc7ea[_0x475d('0x48')][_0x475d('0x49')]?_0x5bc7ea[_0x475d('0x48')]:_0x202fe3[_0x475d('0x42')];if(_0x1187a3[_0x475d('0x44')][_0x475d('0x53')]){_0x5bc7ea['include']=[{'all':!![]}];}_0x5bc7ea=_[_0x475d('0x51')]({},_0x5bc7ea,_0x1187a3[_0x475d('0x5a')]);return db[_0x475d('0x3e')][_0x475d('0x5b')](_0x5bc7ea)[_0x475d('0x35')](handleEntityNotFound(_0x1d5264,null))[_0x475d('0x35')](respondWithResult(_0x1d5264,null))[_0x475d('0x27')](handleError(_0x1d5264,null));};exports[_0x475d('0x5c')]=function(_0x49bbab,_0x108954){return db[_0x475d('0x3e')][_0x475d('0x5c')](_0x49bbab[_0x475d('0x5d')],{})[_0x475d('0x35')](function(_0xdb775f){var _0x3b9326=_0x49bbab['user'][_0x475d('0x37')]({'plain':!![]});if(!_0x3b9326)throw new Error(_0x475d('0x5e'));if(_0x3b9326['role']===_0x475d('0x5f')){var _0x3d69f8=_0xdb775f[_0x475d('0x37')]({'plain':!![]});var _0x278c83='WhatsappAccounts';return db[_0x475d('0x60')][_0x475d('0x5b')]({'where':{'name':_0x278c83,'userProfileId':_0x3b9326[_0x475d('0x61')]},'raw':!![]})[_0x475d('0x35')](function(_0x20a208){if(_0x20a208&&_0x20a208[_0x475d('0x62')]===0x0){return db[_0x475d('0x63')]['create']({'name':_0x3d69f8[_0x475d('0x39')],'resourceId':_0x3d69f8['id'],'type':_0x20a208[_0x475d('0x39')],'sectionId':_0x20a208['id']},{})['then'](function(){return _0xdb775f;});}else{return _0xdb775f;}})[_0x475d('0x27')](function(_0x4c35e7){logger[_0x475d('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c35e7);throw _0x4c35e7;});}return _0xdb775f;})[_0x475d('0x35')](respondWithResult(_0x108954,0xc9))['catch'](handleError(_0x108954,null));};exports[_0x475d('0x34')]=function(_0x40c6c4,_0x1fdc23){if(_0x40c6c4[_0x475d('0x5d')]['id']){delete _0x40c6c4['body']['id'];}return db[_0x475d('0x3e')][_0x475d('0x5b')]({'where':{'id':_0x40c6c4[_0x475d('0x58')]['id']},'include':[{'model':db[_0x475d('0x3c')],'as':_0x475d('0x3d')}]})[_0x475d('0x35')](handleEntityNotFound(_0x1fdc23,null))[_0x475d('0x35')](saveUpdates(_0x40c6c4[_0x475d('0x5d')],null))[_0x475d('0x35')](respondWithResult(_0x1fdc23,null))['catch'](handleError(_0x1fdc23,null));};exports[_0x475d('0x36')]=function(_0x2dc0bb,_0x14abf9){return db['WhatsappAccount'][_0x475d('0x5b')]({'where':{'id':_0x2dc0bb['params']['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x14abf9,null))['then'](removeEntity(_0x14abf9,null))[_0x475d('0x27')](handleError(_0x14abf9,null));};exports[_0x475d('0x64')]=function(_0x298857,_0x4c2de8){return db[_0x475d('0x3e')][_0x475d('0x64')]()[_0x475d('0x35')](respondWithResult(_0x4c2de8,null))[_0x475d('0x27')](handleError(_0x4c2de8,null));};exports['addDisposition']=function(_0x4e98a2,_0x27d029,_0x23168f){if(_0x4e98a2[_0x475d('0x5d')]['id']){delete _0x4e98a2['body']['id'];}return db[_0x475d('0x3e')][_0x475d('0x5b')]({'where':{'id':_0x4e98a2['params']['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x27d029,null))['then'](function(_0x55c333){if(_0x55c333){_0x4e98a2[_0x475d('0x5d')][_0x475d('0x65')]=_0x55c333['id'];return db[_0x475d('0x66')][_0x475d('0x5c')](_0x4e98a2['body']);}})['then'](respondWithResult(_0x27d029,null))[_0x475d('0x27')](handleError(_0x27d029,null));};exports['getDispositions']=function(_0x5602ef,_0x38a099,_0x3381bc){var _0x42f53e={'raw':![],'where':{}};var _0xe4728b={};var _0x43688e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x475d('0x67')]({'where':{'id':_0x5602ef[_0x475d('0x58')]['id']}})['then'](handleEntityNotFound(_0x38a099,null))[_0x475d('0x35')](function(_0x3e4ea1){if(_0x3e4ea1){_0xe4728b['model']=_[_0x475d('0x45')](db[_0x475d('0x66')][_0x475d('0x3f')]);_0xe4728b['query']=_[_0x475d('0x45')](_0x5602ef[_0x475d('0x44')]);_0xe4728b[_0x475d('0x46')]=_[_0x475d('0x47')](_0xe4728b[_0x475d('0x42')],_0xe4728b[_0x475d('0x44')]);_0x42f53e[_0x475d('0x48')]=_[_0x475d('0x47')](_0xe4728b[_0x475d('0x42')],qs['fields'](_0x5602ef[_0x475d('0x44')][_0x475d('0x59')]));_0x42f53e[_0x475d('0x48')]=_0x42f53e[_0x475d('0x48')]['length']?_0x42f53e[_0x475d('0x48')]:_0xe4728b[_0x475d('0x42')];if(!_0x5602ef['query'][_0x475d('0x4a')](_0x475d('0x4b'))){_0x42f53e[_0x475d('0x2e')]=qs[_0x475d('0x2e')](_0x5602ef['query'][_0x475d('0x2e')]);_0x42f53e[_0x475d('0x2b')]=qs[_0x475d('0x2b')](_0x5602ef[_0x475d('0x44')]['offset']);}_0x42f53e[_0x475d('0x4c')]=qs[_0x475d('0x4d')](_0x5602ef[_0x475d('0x44')][_0x475d('0x4d')]);_0x42f53e[_0x475d('0x4e')]=qs['filters'](_[_0x475d('0x4f')](_0x5602ef[_0x475d('0x44')],_0xe4728b['filters']));_0x42f53e['where'][_0x475d('0x65')]=_0x3e4ea1['id'];if(_0x5602ef['query'][_0x475d('0x50')]){_0x42f53e[_0x475d('0x4e')]=_['merge'](_0x42f53e[_0x475d('0x4e')],{'$or':_[_0x475d('0x43')](_0x42f53e[_0x475d('0x48')],function(_0xe00b38){var _0x25d08d={};_0x25d08d[_0xe00b38]={'$like':'%'+_0x5602ef['query'][_0x475d('0x50')]+'%'};return _0x25d08d;})});}_0x42f53e=_[_0x475d('0x51')]({},_0x42f53e,_0x5602ef[_0x475d('0x5a')]);return db[_0x475d('0x66')][_0x475d('0x2d')]({'where':_0x42f53e[_0x475d('0x4e')]})[_0x475d('0x35')](function(_0x4db1e4){_0x43688e['count']=_0x4db1e4;if(_0x5602ef[_0x475d('0x44')][_0x475d('0x53')]){_0x42f53e[_0x475d('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x475d('0x55')](_0x42f53e);})[_0x475d('0x35')](function(_0x1d7af6){_0x43688e[_0x475d('0x56')]=_0x1d7af6;return _0x43688e;});}})[_0x475d('0x35')](respondWithFilteredResult(_0x38a099,_0x42f53e))[_0x475d('0x27')](handleError(_0x38a099,null));};exports['removeDispositions']=function(_0xb23f89,_0x4be300,_0x2c272b){return db[_0x475d('0x3e')]['find']({'where':{'id':_0xb23f89[_0x475d('0x58')]['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x4be300,null))['then'](function(_0x55b04c){if(_0x55b04c){return _0x55b04c['removeDispositions'](_0xb23f89[_0x475d('0x44')][_0x475d('0x68')]);}})[_0x475d('0x35')](respondWithStatusCode(_0x4be300,null))[_0x475d('0x27')](handleError(_0x4be300,null));};exports['addAnswer']=function(_0xe34915,_0x270d7c,_0x167495){if(_0xe34915[_0x475d('0x5d')]['id']){delete _0xe34915[_0x475d('0x5d')]['id'];}return db[_0x475d('0x3e')][_0x475d('0x5b')]({'where':{'id':_0xe34915['params']['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x270d7c,null))[_0x475d('0x35')](function(_0x5288dd){if(_0x5288dd){_0xe34915[_0x475d('0x5d')][_0x475d('0x65')]=_0x5288dd['id'];return db['CannedAnswer'][_0x475d('0x5c')](_0xe34915[_0x475d('0x5d')]);}})[_0x475d('0x35')](respondWithResult(_0x270d7c,null))[_0x475d('0x27')](handleError(_0x270d7c,null));};exports[_0x475d('0x69')]=function(_0xb4760c,_0x3f96df,_0x4e9fb1){var _0x2ac447={'raw':![],'where':{}};var _0x5414e={};var _0x353060={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x475d('0x67')]({'where':{'id':_0xb4760c[_0x475d('0x58')]['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x3f96df,null))[_0x475d('0x35')](function(_0x3f66b4){if(_0x3f66b4){_0x5414e[_0x475d('0x42')]=_[_0x475d('0x45')](db[_0x475d('0x6a')][_0x475d('0x3f')]);_0x5414e[_0x475d('0x44')]=_['keys'](_0xb4760c[_0x475d('0x44')]);_0x5414e[_0x475d('0x46')]=_['intersection'](_0x5414e[_0x475d('0x42')],_0x5414e[_0x475d('0x44')]);_0x2ac447[_0x475d('0x48')]=_['intersection'](_0x5414e['model'],qs[_0x475d('0x59')](_0xb4760c[_0x475d('0x44')][_0x475d('0x59')]));_0x2ac447[_0x475d('0x48')]=_0x2ac447[_0x475d('0x48')]['length']?_0x2ac447[_0x475d('0x48')]:_0x5414e[_0x475d('0x42')];if(!_0xb4760c[_0x475d('0x44')][_0x475d('0x4a')]('nolimit')){_0x2ac447[_0x475d('0x2e')]=qs[_0x475d('0x2e')](_0xb4760c[_0x475d('0x44')][_0x475d('0x2e')]);_0x2ac447[_0x475d('0x2b')]=qs[_0x475d('0x2b')](_0xb4760c[_0x475d('0x44')][_0x475d('0x2b')]);}_0x2ac447[_0x475d('0x4c')]=qs[_0x475d('0x4d')](_0xb4760c['query']['sort']);_0x2ac447[_0x475d('0x4e')]=qs[_0x475d('0x46')](_[_0x475d('0x4f')](_0xb4760c[_0x475d('0x44')],_0x5414e['filters']));_0x2ac447[_0x475d('0x4e')][_0x475d('0x65')]=_0x3f66b4['id'];if(_0xb4760c[_0x475d('0x44')][_0x475d('0x50')]){_0x2ac447['where']=_[_0x475d('0x51')](_0x2ac447[_0x475d('0x4e')],{'$or':_[_0x475d('0x43')](_0x2ac447[_0x475d('0x48')],function(_0xe8b754){var _0x4ef360={};_0x4ef360[_0xe8b754]={'$like':'%'+_0xb4760c[_0x475d('0x44')][_0x475d('0x50')]+'%'};return _0x4ef360;})});}_0x2ac447=_['merge']({},_0x2ac447,_0xb4760c[_0x475d('0x5a')]);return db[_0x475d('0x6a')][_0x475d('0x2d')]({'where':_0x2ac447['where']})[_0x475d('0x35')](function(_0x1817fb){_0x353060[_0x475d('0x2d')]=_0x1817fb;if(_0xb4760c[_0x475d('0x44')][_0x475d('0x53')]){_0x2ac447[_0x475d('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x475d('0x55')](_0x2ac447);})[_0x475d('0x35')](function(_0x372c61){_0x353060['rows']=_0x372c61;return _0x353060;});}})['then'](respondWithFilteredResult(_0x3f96df,_0x2ac447))['catch'](handleError(_0x3f96df,null));};exports[_0x475d('0x6b')]=function(_0x5c3a47,_0x561438,_0x5b0699){return db['WhatsappAccount'][_0x475d('0x5b')]({'where':{'id':_0x5c3a47['params']['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x561438,null))[_0x475d('0x35')](function(_0x4b2c11){if(_0x4b2c11){return _0x4b2c11['removeAnswers'](_0x5c3a47['query']['ids']);}})[_0x475d('0x35')](respondWithStatusCode(_0x561438,null))[_0x475d('0x27')](handleError(_0x561438,null));};exports[_0x475d('0x6c')]=function(_0x2d36fe,_0x330426,_0x30e6bf){return db[_0x475d('0x3e')]['find']({'where':{'id':_0x2d36fe[_0x475d('0x58')]['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x330426,null))[_0x475d('0x35')](function(_0x29bc50){if(_0x29bc50){return _0x29bc50[_0x475d('0x6c')](_0x2d36fe[_0x475d('0x5d')][_0x475d('0x68')],_['omit'](_0x2d36fe[_0x475d('0x5d')],['ids','id'])||{})['spread'](function(_0x4238d1){for(var _0x16ead1=0x0;_0x16ead1<_0x2d36fe['body']['ids']['length'];_0x16ead1+=0x1){socket[_0x475d('0x6d')](_0x475d('0x6e'),{'UserId':Number(_0x2d36fe['body']['ids'][_0x16ead1]),'WhatsappAccountId':Number(_0x2d36fe['params']['id'])});}return _0x4238d1;});}})[_0x475d('0x35')](respondWithResult(_0x330426,null))[_0x475d('0x27')](handleError(_0x330426,null));};exports[_0x475d('0x6f')]=function(_0x23996c,_0x48a98f,_0x12b704){return db['WhatsappAccount'][_0x475d('0x5b')]({'where':{'id':_0x23996c[_0x475d('0x58')]['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x48a98f,null))['then'](function(_0xe10038){if(_0xe10038){return _0xe10038[_0x475d('0x6f')](_0x23996c[_0x475d('0x44')][_0x475d('0x68')])[_0x475d('0x35')](function(){if(_[_0x475d('0x70')](_0x23996c['query'][_0x475d('0x68')])){for(var _0x10a1f9=0x0;_0x10a1f9<_0x23996c[_0x475d('0x44')][_0x475d('0x68')][_0x475d('0x49')];_0x10a1f9+=0x1){socket[_0x475d('0x6d')](_0x475d('0x71'),{'UserId':Number(_0x23996c['query'][_0x475d('0x68')][_0x10a1f9]),'WhatsappAccountId':Number(_0x23996c[_0x475d('0x58')]['id'])});}}else{socket[_0x475d('0x6d')](_0x475d('0x71'),{'UserId':Number(_0x23996c[_0x475d('0x44')]['ids']),'WhatsappAccountId':Number(_0x23996c[_0x475d('0x58')]['id'])});}});}})[_0x475d('0x35')](respondWithStatusCode(_0x48a98f,null))[_0x475d('0x27')](handleError(_0x48a98f,null));};exports[_0x475d('0x72')]=function(_0x1077d5,_0x456291,_0x10cb30){var _0x4bfb50={};var _0x40e111={};var _0xd5065d;var _0x277edc;return db[_0x475d('0x3e')][_0x475d('0x67')]({'where':{'id':_0x1077d5[_0x475d('0x58')]['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x456291,null))[_0x475d('0x35')](function(_0x310ea4){if(_0x310ea4){_0xd5065d=_0x310ea4;_0x40e111[_0x475d('0x42')]=_[_0x475d('0x45')](db['User'][_0x475d('0x3f')]);_0x40e111[_0x475d('0x44')]=_[_0x475d('0x45')](_0x1077d5[_0x475d('0x44')]);_0x40e111['filters']=_[_0x475d('0x47')](_0x40e111['model'],_0x40e111[_0x475d('0x44')]);_0x4bfb50[_0x475d('0x48')]=_[_0x475d('0x47')](_0x40e111[_0x475d('0x42')],qs['fields'](_0x1077d5[_0x475d('0x44')][_0x475d('0x59')]));_0x4bfb50[_0x475d('0x48')]=_0x4bfb50[_0x475d('0x48')][_0x475d('0x49')]?_0x4bfb50['attributes']:_0x40e111[_0x475d('0x42')];_0x4bfb50[_0x475d('0x4c')]=qs['sort'](_0x1077d5[_0x475d('0x44')][_0x475d('0x4d')]);_0x4bfb50[_0x475d('0x4e')]=qs[_0x475d('0x46')](_['pick'](_0x1077d5['query'],_0x40e111[_0x475d('0x46')]));if(_0x1077d5[_0x475d('0x44')][_0x475d('0x50')]){_0x4bfb50['where']=_[_0x475d('0x51')](_0x4bfb50['where'],{'$or':_[_0x475d('0x43')](_0x4bfb50[_0x475d('0x48')],function(_0x2c2139){var _0x1edd80={};_0x1edd80[_0x2c2139]={'$like':'%'+_0x1077d5[_0x475d('0x44')]['filter']+'%'};return _0x1edd80;})});}_0x4bfb50=_[_0x475d('0x51')]({},_0x4bfb50,_0x1077d5[_0x475d('0x5a')]);return _0xd5065d[_0x475d('0x72')](_0x4bfb50);}})['then'](function(_0x2a6cf0){if(_0x2a6cf0){_0x277edc=_0x2a6cf0['length'];if(!_0x1077d5[_0x475d('0x44')][_0x475d('0x4a')](_0x475d('0x4b'))){_0x4bfb50[_0x475d('0x2e')]=qs['limit'](_0x1077d5['query'][_0x475d('0x2e')]);_0x4bfb50[_0x475d('0x2b')]=qs[_0x475d('0x2b')](_0x1077d5[_0x475d('0x44')][_0x475d('0x2b')]);}return _0xd5065d['getAgents'](_0x4bfb50);}})[_0x475d('0x35')](function(_0x2cd868){if(_0x2cd868){return _0x2cd868?{'count':_0x277edc,'rows':_0x2cd868}:null;}})[_0x475d('0x35')](respondWithResult(_0x456291,null))[_0x475d('0x27')](handleError(_0x456291,null));};exports['addApplications']=function(_0x2b724f,_0x20fa79){var _0x2cec93=_0x2b724f[_0x475d('0x58')]['id'];var _0x26121e=_0x2b724f[_0x475d('0x5d')];var _0x46b47d=0xc8;var _0x1a4b23=null;return db[_0x475d('0x73')][_0x475d('0x74')]({'isolationLevel':db[_0x475d('0x73')][_0x475d('0x75')][_0x475d('0x76')][_0x475d('0x77')]},function(_0x5e2d16){return db[_0x475d('0x3e')][_0x475d('0x67')]({'where':{'id':_0x2cec93},'transaction':_0x5e2d16})[_0x475d('0x35')](function(_0x245033){if(_0x245033){return db[_0x475d('0x78')][_0x475d('0x36')]({'where':{'WhatsappAccountId':_0x2cec93},'transaction':_0x5e2d16})[_0x475d('0x35')](function(){var _0x3ec146=_[_0x475d('0x43')](_0x26121e,function(_0x42bcbb){_0x42bcbb[_0x475d('0x65')]=_0x2cec93;return _0x42bcbb;});return db[_0x475d('0x78')][_0x475d('0x79')](_0x3ec146,{'transaction':_0x5e2d16});});}else{_0x46b47d=0x194;_0x1a4b23=[];}});})['then'](function(){if(_0x46b47d!==0x194){return db[_0x475d('0x78')][_0x475d('0x7a')]({'where':{'WhatsappAccountId':_0x2cec93},'order':_0x475d('0x7b')})[_0x475d('0x35')](function(_0x5b2a51){_0x1a4b23=_0x5b2a51;});}})[_0x475d('0x27')](function(_0x517d6b){_0x46b47d=0x1f4;logger[_0x475d('0x23')](_0x517d6b[_0x475d('0x38')]);if(_0x517d6b[_0x475d('0x39')]){delete _0x517d6b[_0x475d('0x39')];}_0x1a4b23=_0x517d6b;})['finally'](function(){if(_0x1a4b23===null){_0x20fa79[_0x475d('0x28')](_0x46b47d);}else{if(_0x46b47d===0x1f4){_0x20fa79[_0x475d('0x29')](_0x46b47d)[_0x475d('0x3a')](_0x1a4b23);}else{_0x20fa79[_0x475d('0x29')](_0x46b47d)[_0x475d('0x31')](_0x1a4b23);}}});};exports[_0x475d('0x7c')]=function(_0x2f0f78,_0x486a98,_0x572f14){var _0x3a7d03={};var _0x4902e2={};var _0x4d0389;var _0x11f11e;return db[_0x475d('0x3e')]['findOne']({'where':{'id':_0x2f0f78[_0x475d('0x58')]['id']}})[_0x475d('0x35')](handleEntityNotFound(_0x486a98,null))[_0x475d('0x35')](function(_0x3b2ec7){if(_0x3b2ec7){_0x4d0389=_0x3b2ec7;_0x4902e2['model']=_[_0x475d('0x45')](db[_0x475d('0x78')][_0x475d('0x3f')]);_0x4902e2[_0x475d('0x44')]=_[_0x475d('0x45')](_0x2f0f78[_0x475d('0x44')]);_0x4902e2['filters']=_[_0x475d('0x47')](_0x4902e2[_0x475d('0x42')],_0x4902e2['query']);_0x3a7d03[_0x475d('0x48')]=_[_0x475d('0x47')](_0x4902e2[_0x475d('0x42')],qs[_0x475d('0x59')](_0x2f0f78[_0x475d('0x44')][_0x475d('0x59')]));_0x3a7d03[_0x475d('0x48')]=_0x3a7d03[_0x475d('0x48')][_0x475d('0x49')]?_0x3a7d03[_0x475d('0x48')]:_0x4902e2[_0x475d('0x42')];_0x3a7d03[_0x475d('0x4c')]=qs['sort'](_0x2f0f78[_0x475d('0x44')][_0x475d('0x4d')]);_0x3a7d03[_0x475d('0x4e')]=qs[_0x475d('0x46')](_['pick'](_0x2f0f78[_0x475d('0x44')],_0x4902e2[_0x475d('0x46')]));if(_0x2f0f78[_0x475d('0x44')][_0x475d('0x50')]){_0x3a7d03['where']=_[_0x475d('0x51')](_0x3a7d03[_0x475d('0x4e')],{'$or':_[_0x475d('0x43')](_0x3a7d03[_0x475d('0x48')],function(_0x41b254){var _0x20dbcd={};_0x20dbcd[_0x41b254]={'$like':'%'+_0x2f0f78['query'][_0x475d('0x50')]+'%'};return _0x20dbcd;})});}_0x3a7d03=_[_0x475d('0x51')]({},_0x3a7d03,_0x2f0f78[_0x475d('0x5a')]);return _0x4d0389[_0x475d('0x7c')](_0x3a7d03);}})[_0x475d('0x35')](function(_0x35b9ed){if(_0x35b9ed){_0x11f11e=_0x35b9ed[_0x475d('0x49')];if(!_0x2f0f78[_0x475d('0x44')][_0x475d('0x4a')](_0x475d('0x4b'))){_0x3a7d03[_0x475d('0x2e')]=qs[_0x475d('0x2e')](_0x2f0f78['query'][_0x475d('0x2e')]);_0x3a7d03[_0x475d('0x2b')]=qs[_0x475d('0x2b')](_0x2f0f78[_0x475d('0x44')][_0x475d('0x2b')]);}return _0x4d0389['getApplications'](_0x3a7d03);}})[_0x475d('0x35')](function(_0x8a9951){if(_0x8a9951){return _0x8a9951?{'count':_0x11f11e,'rows':_0x8a9951}:null;}})[_0x475d('0x35')](respondWithResult(_0x486a98,null))[_0x475d('0x27')](handleError(_0x486a98,null));};exports['notify']=function(_0x3a4cb7,_0x458c48,_0x5384df){var _0x21def4={'channel':_0x475d('0x7d')};var _0x325282=[];var _0x417a69=[];var _0x45b575={};return db[_0x475d('0x3e')][_0x475d('0x5b')]({'where':{'id':_0x3a4cb7[_0x475d('0x58')]['id']},'include':[{'model':db[_0x475d('0x78')],'as':_0x475d('0x7e')}]})[_0x475d('0x35')](handleEntityNotFound(_0x458c48,null))[_0x475d('0x35')](function(_0x51500d){_0x21def4[_0x475d('0x7f')]=_0x51500d;if(_0x21def4[_0x475d('0x7f')]&&_0x21def4[_0x475d('0x7f')][_0x475d('0x41')]===_0x475d('0x80')&&_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x81')]){if(_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x81')]['length']===0x0)return;if(_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x81')][0x0][_0x475d('0x82')]!==_0x475d('0x83'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x81')][0x0]['timestamp']},{'where':{'messageId':_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x81')][0x0]['message_id']},'individualHooks':!![]})[_0x475d('0x35')](function(_0x57d619){return _0x458c48[_0x475d('0x29')](0xc8)[_0x475d('0x31')](_0x57d619);});}_0x21def4[_0x475d('0x84')]=_['orderBy'](_0x51500d[_0x475d('0x7e')],[_0x475d('0x7b')],['asc']);if(_0x21def4[_0x475d('0x7f')][_0x475d('0x7e')]){delete _0x21def4[_0x475d('0x7f')][_0x475d('0x7e')];}return db[_0x475d('0x85')][_0x475d('0x64')]()[_0x475d('0x35')](function(_0x2d4f7e){if(!_0x2d4f7e){throw new db[(_0x475d('0x86'))][(_0x475d('0x87'))](_0x475d('0x88'));}_0x325282=_[_0x475d('0x89')](_[_0x475d('0x45')](_0x2d4f7e),[_0x475d('0x8a'),'updatedAt']);_0x417a69=_[_0x475d('0x89')](_['keys'](_0x2d4f7e),['createdAt',_0x475d('0x8b'),_0x475d('0x8c'),_0x475d('0x8d')]);_0x21def4[_0x475d('0x5d')]={'mapKey':_0x475d('0x8e')};if(_0x21def4[_0x475d('0x7f')]&&_0x21def4[_0x475d('0x7f')][_0x475d('0x41')]==='twilio'){_0x21def4['body'][_0x475d('0x8f')]=_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x90')][_0x475d('0x91')](_0x475d('0x92'),'');_0x21def4[_0x475d('0x5d')][_0x475d('0x5d')]=_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x93')];_0x21def4[_0x475d('0x5d')]['messageId']=_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x94')];}if(_0x21def4[_0x475d('0x7f')]&&_0x21def4[_0x475d('0x7f')]['type']==='sinch'){_0x21def4[_0x475d('0x5d')][_0x475d('0x8f')]=_0x3a4cb7['body']['notifications'][0x0][_0x475d('0x8f')];_0x21def4[_0x475d('0x5d')][_0x475d('0x5d')]=_0x3a4cb7[_0x475d('0x5d')][_0x475d('0x95')][0x0]['message'][_0x475d('0x5d')];_0x21def4[_0x475d('0x5d')]['messageId']=_0x3a4cb7['body'][_0x475d('0x95')][0x0][_0x475d('0x96')];}if(_0x21def4['body']['id']){delete _0x21def4[_0x475d('0x5d')]['id'];}if(_[_0x475d('0x97')](_0x21def4[_0x475d('0x5d')][_0x475d('0x8f')])){throw new db['Sequelize'][(_0x475d('0x87'))](_0x475d('0x98'));}if(_[_0x475d('0x97')](_0x21def4[_0x475d('0x5d')]['body'])||_0x21def4[_0x475d('0x5d')]['body']===''){throw new db[(_0x475d('0x86'))][(_0x475d('0x87'))](_0x475d('0x99'));}if(_[_0x475d('0x97')](_0x21def4[_0x475d('0x5d')]['mapKey'])){throw new db[(_0x475d('0x86'))][(_0x475d('0x87'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x417a69);}if(!_[_0x475d('0x9a')](_0x417a69,_0x21def4[_0x475d('0x5d')][_0x475d('0x9b')])){throw new db[(_0x475d('0x86'))]['ValidationError'](_0x475d('0x9c')+_0x417a69);}_0x45b575[_0x21def4['body']['mapKey']]=_0x21def4[_0x475d('0x5d')][_0x475d('0x8f')];return db[_0x475d('0x9d')][_0x475d('0x5b')]({'where':{'id':_0x21def4['account'][_0x475d('0x8d')]},'include':[{'model':db[_0x475d('0x85')],'as':_0x475d('0x9e'),'where':_0x45b575,'limit':0x1,'order':[[_0x475d('0x8b'),_0x475d('0x9f')]]}]});})[_0x475d('0x35')](handleEntityNotFound(_0x458c48,null))['then'](function(_0x4f0776){if(_0x4f0776){_0x21def4[_0x475d('0xa0')]=_[_0x475d('0xa1')](_0x4f0776,['Contacts']);if(_0x4f0776['Contacts'][_0x475d('0x49')]){return _0x4f0776[_0x475d('0x9e')][0x0];}var _0x3daf8e=_[_0x475d('0x1b')](_0x21def4['body'],{'firstName':_0x21def4[_0x475d('0x5d')][_0x475d('0x8f')],'ListId':_0x4f0776['id']});_0x3daf8e[_0x21def4[_0x475d('0x5d')][_0x475d('0x9b')]]=_0x21def4['body'][_0x475d('0x8f')];return db[_0x475d('0x85')][_0x475d('0x5c')](_0x3daf8e,{'fields':_0x325282,'raw':!![]});}})[_0x475d('0x35')](handleEntityNotFound(_0x458c48,null))[_0x475d('0x35')](function(_0x500d1b){if(_0x500d1b){_0x21def4[_0x475d('0xa2')]=_0x500d1b;var _0x4a67e4={'ContactId':_0x500d1b['id'],'phone':_0x21def4[_0x475d('0x5d')][_0x475d('0x8f')],'WhatsappAccountId':_0x3a4cb7[_0x475d('0x58')]['id']};var _0x1bf2e2={'ContactId':_0x500d1b['id'],'WhatsappAccountId':_0x3a4cb7[_0x475d('0x58')]['id'],'closed':![]};return db[_0x475d('0xa3')]['find']({'where':_0x1bf2e2})[_0x475d('0x35')](function(_0x43d9f6){if(_0x43d9f6){return[_0x43d9f6,![]];}return db[_0x475d('0xa3')][_0x475d('0x5c')](_0x4a67e4)[_0x475d('0x35')](function(_0x57bef9){return[_0x57bef9,!![]];});});}})[_0x475d('0xa4')](function(_0x4a85a1,_0x3d7f06){_0x21def4[_0x475d('0xa5')]=_0x4a85a1[_0x475d('0x37')]({'plain':!![]});_0x21def4[_0x475d('0xa5')]['created']=![];if(_0x3d7f06){if(_0x21def4[_0x475d('0x7f')][_0x475d('0xa6')]){_0x21def4[_0x475d('0x84')][_0x475d('0xa7')]({'id':0x0,'priority':_0x21def4[_0x475d('0x84')][_0x475d('0x49')]+0x1,'app':_0x475d('0xa8'),'appdata':'unmanaged','interval':_0x475d('0xa9')});}_0x21def4[_0x475d('0xa5')][_0x475d('0xaa')]=!![];}return db[_0x475d('0xab')][_0x475d('0x5c')]({'phone':_0x21def4[_0x475d('0x5d')][_0x475d('0x8f')],'messageId':_0x21def4[_0x475d('0x5d')][_0x475d('0xac')],'body':_0x21def4[_0x475d('0x5d')][_0x475d('0x5d')],'WhatsappAccountId':_0x3a4cb7[_0x475d('0x58')]['id'],'WhatsappInteractionId':_0x4a85a1['id'],'direction':'in','ContactId':_0x4a85a1[_0x475d('0xad')],'AttachmentId':_0x21def4['body'][_0x475d('0xae')]});})['then'](function(_0x5aacdb){_0x21def4[_0x475d('0x26')]=_0x5aacdb;if(!_0x21def4[_0x475d('0xa5')][_0x475d('0xaf')])return;return db[_0x475d('0xb0')][_0x475d('0x5b')]({'attributes':['id',_0x475d('0x39')],'where':{'id':_0x21def4[_0x475d('0xa5')][_0x475d('0xaf')]}});})[_0x475d('0x35')](function(_0x3060b6){if(_0x3060b6){_0x21def4[_0x475d('0x84')][_0x475d('0xb1')]({'id':0x0,'priority':0x0,'app':_0x475d('0xb2'),'appdata':_0x3060b6[_0x475d('0x39')]+','+(_0x21def4[_0x475d('0x7f')][_0x475d('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0x21def4['interaction'][_0x475d('0xb4')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x475d('0x39')],'where':{'id':_0x21def4[_0x475d('0xa5')]['queueId']}});})['then'](function(_0x1d8b14){if(_0x1d8b14){_0x21def4[_0x475d('0x84')][_0x475d('0xb1')]({'id':0x0,'priority':0x1,'app':_0x475d('0xb5'),'appdata':_0x1d8b14[_0x475d('0x39')]+','+(_0x21def4[_0x475d('0x7f')][_0x475d('0xb6')]||0x12c),'interval':_0x475d('0xa9')});}return respondWithRpcPromise(_0x475d('0xb7'),_0x475d('0xb8'),_0x21def4);})[_0x475d('0x35')](function(_0x101ecf){if(_0x101ecf){var _0x411c02=0xc8;var _0x5708d8=_0x475d('0xb9');logger['info'](_0x475d('0xba'),_0x5708d8,_0x411c02,_0x475d('0xbb'));logger[_0x475d('0x20')](_0x475d('0xbc'),_0x5708d8,_0x411c02,_0x475d('0xbb'),JSON['stringify'](_0x101ecf));if(_0x21def4[_0x475d('0x7f')][_0x475d('0x41')]===_0x475d('0xbd')){return _0x458c48[_0x475d('0x29')](_0x411c02)[_0x475d('0x2f')](_0x475d('0xbe'),_0x475d('0xbf'))[_0x475d('0x3a')](_0x475d('0xc0'));}else{return _0x458c48[_0x475d('0x29')](_0x411c02)[_0x475d('0x31')](_0x101ecf);}}});})[_0x475d('0x27')](handleError(_0x458c48,null));};exports[_0x475d('0x3a')]=function(_0x357a83,_0x354bf1,_0x1ef793){var _0x236026,_0x495306,_0x1740ee;if(_['isNil'](_0x357a83[_0x475d('0x5d')][_0x475d('0x5d')])||_0x357a83[_0x475d('0x5d')][_0x475d('0x5d')]===''){throw new db[(_0x475d('0x86'))][(_0x475d('0x87'))](_0x475d('0x99'));}if(_[_0x475d('0x97')](_0x357a83[_0x475d('0x5d')]['to'])){throw new db['Sequelize'][(_0x475d('0x87'))]('to\x20is\x20mandatory');}_0x236026=_0x357a83[_0x475d('0x5d')]['to'];return db[_0x475d('0x3e')][_0x475d('0x5b')]({'where':{'id':_0x357a83[_0x475d('0x58')]['id']},'include':[{'model':db[_0x475d('0x9d')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x236026},'limit':0x1,'order':[[_0x475d('0x8b'),_0x475d('0x9f')]]}]}]})[_0x475d('0x35')](handleEntityNotFound(_0x354bf1,null))[_0x475d('0x35')](function(_0x44a99d){if(_0x44a99d&&_0x44a99d['List']){_0x495306=_0x44a99d[_0x475d('0x37')]({'plain':!![]});if(_0x495306[_0x475d('0xc1')]&&_0x495306[_0x475d('0xc1')][_0x475d('0x9e')][_0x475d('0x49')]){return _0x495306[_0x475d('0xc1')][_0x475d('0x9e')][0x0];}return db[_0x475d('0x85')][_0x475d('0x5c')](_[_0x475d('0x1b')](_0x357a83[_0x475d('0x5d')],{'firstName':_0x236026,'mobile':_0x236026,'phone':_0x236026,'ListId':_0x495306['ListId']}));}})[_0x475d('0x35')](handleEntityNotFound(_0x354bf1,null))[_0x475d('0x35')](function(_0x16e2ba){if(_0x16e2ba){_0x1740ee=_0x16e2ba;return db[_0x475d('0xa3')][_0x475d('0x5b')]({'where':{'ContactId':_0x1740ee['id'],'closed':![],'WhatsappAccountId':_0x495306['id']}})[_0x475d('0x35')](function(_0x1b8f50){if(_0x1b8f50){return[_0x1b8f50,![]];}return db['WhatsappInteraction'][_0x475d('0x5c')]({'UserId':_0x357a83['user']['id'],'ContactId':_0x1740ee['id'],'WhatsappAccountId':_0x495306['id'],'phone':_0x236026,'firstMsgDirection':_0x475d('0xc2'),'Messages':[_[_0x475d('0x51')](_0x357a83[_0x475d('0x5d')],{'read':![],'body':_0x357a83[_0x475d('0x5d')][_0x475d('0x5d')],'phone':_0x236026,'WhatsappAccountId':_0x495306['id'],'UserId':_0x357a83['user']['id'],'ContactId':_0x1740ee['id']})]},{'include':[{'model':db[_0x475d('0xab')],'as':'Messages'}]})[_0x475d('0x35')](function(_0x3f2fc3){return[_0x3f2fc3,!![]];});});}})[_0x475d('0xa4')](function(_0x677197,_0x4ff13e){if(_0x4ff13e){return _0x677197;}return db['WhatsappMessage'][_0x475d('0x5c')](_[_0x475d('0x51')](_0x357a83[_0x475d('0x5d')],{'read':![],'body':_0x357a83['body'][_0x475d('0x5d')],'phone':_0x236026,'WhatsappAccountId':_0x495306['id'],'WhatsappInteractionId':_0x677197['id'],'UserId':_0x357a83[_0x475d('0x5f')]['id'],'ContactId':_0x1740ee['id']}))[_0x475d('0x35')](function(_0x3d87cd){_0x677197[_0x475d('0xc3')][_0x475d('0xc4')]=[];_0x677197[_0x475d('0xc3')][_0x475d('0xc4')][_0x475d('0xa7')](_0x3d87cd[_0x475d('0xc3')]);return _0x677197;});})[_0x475d('0x35')](respondWithResult(_0x354bf1,null))[_0x475d('0x27')](handleError(_0x354bf1,null));}; \ No newline at end of file +var _0x27bd=['show','params','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','stack','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','update','timestamp','message_id','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','MessageSid','sinch','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','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','undefined','limit','count','Content-Range','apply','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','WhatsappAccount','includeAll','include','findAll','rows'];(function(_0x172096,_0x1efae4){var _0x5eb274=function(_0x4b9f26){while(--_0x4b9f26){_0x172096['push'](_0x172096['shift']());}};_0x5eb274(++_0x1efae4);}(_0x27bd,0x136));var _0xd27b=function(_0x198cef,_0x2dda04){_0x198cef=_0x198cef-0x0;var _0x4c4788=_0x27bd[_0x198cef];return _0x4c4788;};'use strict';var emlformat=require(_0xd27b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd27b('0x1'));var jsonpatch=require(_0xd27b('0x2'));var rp=require(_0xd27b('0x3'));var moment=require(_0xd27b('0x4'));var BPromise=require(_0xd27b('0x5'));var Mustache=require(_0xd27b('0x6'));var util=require(_0xd27b('0x7'));var path=require(_0xd27b('0x8'));var sox=require('sox');var csv=require(_0xd27b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd27b('0xa'));var _=require(_0xd27b('0xb'));var squel=require(_0xd27b('0xc'));var crypto=require(_0xd27b('0xd'));var jsforce=require(_0xd27b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd27b('0x9'));var querystring=require('querystring');var Papa=require(_0xd27b('0xf'));var Redis=require(_0xd27b('0x10'));var authService=require(_0xd27b('0x11'));var qs=require(_0xd27b('0x12'));var as=require(_0xd27b('0x13'));var hardwareService=require(_0xd27b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd27b('0x15'));var config=require(_0xd27b('0x16'));var licenseUtil=require(_0xd27b('0x17'));var db=require('../../mysqldb')['db'];config[_0xd27b('0x18')]=_[_0xd27b('0x19')](config[_0xd27b('0x18')],{'host':_0xd27b('0x1a'),'port':0x18eb});var socket=require(_0xd27b('0x1b'))(new Redis(config[_0xd27b('0x18')]));require(_0xd27b('0x1c'))['register'](socket);var jayson=require(_0xd27b('0x1d'));var client=jayson['client'][_0xd27b('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x283726,_0x1e5d93,_0x3f6590,_0x4f7109){return new BPromise(function(_0x11378b,_0x545c26){var _0x395a98=_0x4f7109||client;return _0x395a98['request'](_0x283726,_0x3f6590)[_0xd27b('0x1f')](function(_0x182763){logger[_0xd27b('0x20')](_0xd27b('0x21'),_0x1e5d93,_0xd27b('0x22'));logger[_0xd27b('0x23')](_0xd27b('0x24'),_0x1e5d93,_0xd27b('0x22'),JSON[_0xd27b('0x25')](_0x182763));if(_0x182763[_0xd27b('0x26')]){if(_0x182763[_0xd27b('0x26')][_0xd27b('0x27')]===0x1f4){logger['error'](_0xd27b('0x21'),_0x1e5d93,_0x182763['error'][_0xd27b('0x28')]);return _0x545c26(_0x182763['error'][_0xd27b('0x28')]);}logger[_0xd27b('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1e5d93,_0x182763['error'][_0xd27b('0x28')]);return _0x11378b(_0x182763[_0xd27b('0x26')]['message']);}else{logger[_0xd27b('0x20')](_0xd27b('0x21'),_0x1e5d93,_0xd27b('0x22'));_0x11378b(_0x182763[_0xd27b('0x29')][_0xd27b('0x28')]);}})[_0xd27b('0x2a')](function(_0x52e88c){logger[_0xd27b('0x26')](_0xd27b('0x21'),_0x1e5d93,_0x52e88c);_0x545c26(_0x52e88c);});});}function respondWithStatusCode(_0x4b2a33,_0x121f8e){_0x121f8e=_0x121f8e||0xcc;return function(_0x17404b){if(_0x17404b){return _0x4b2a33[_0xd27b('0x2b')](_0x121f8e);}return _0x4b2a33[_0xd27b('0x2c')](_0x121f8e)[_0xd27b('0x2d')]();};}function respondWithResult(_0x12e4f9,_0x12e3fd){_0x12e3fd=_0x12e3fd||0xc8;return function(_0x382550){if(_0x382550){return _0x12e4f9['status'](_0x12e3fd)[_0xd27b('0x2e')](_0x382550);}};}function respondWithFilteredResult(_0x2717e8,_0x6ce8ec){return function(_0x49e848){if(_0x49e848){var _0xaf1d0a=typeof _0x6ce8ec[_0xd27b('0x2f')]===_0xd27b('0x30')&&typeof _0x6ce8ec[_0xd27b('0x31')]===_0xd27b('0x30');var _0x12f7b5=_0x49e848['count'];var _0x6ef125=_0xaf1d0a?0x0:_0x6ce8ec[_0xd27b('0x2f')];var _0x56760b=_0xaf1d0a?_0x49e848[_0xd27b('0x32')]:_0x6ce8ec['offset']+_0x6ce8ec['limit'];var _0x357a81;if(_0x56760b>=_0x12f7b5){_0x56760b=_0x12f7b5;_0x357a81=0xc8;}else{_0x357a81=0xce;}_0x2717e8[_0xd27b('0x2c')](_0x357a81);return _0x2717e8['set'](_0xd27b('0x33'),_0x6ef125+'-'+_0x56760b+'/'+_0x12f7b5)[_0xd27b('0x2e')](_0x49e848);}return null;};}function patchUpdates(_0x2d6a14){return function(_0x4fd85c){try{jsonpatch[_0xd27b('0x34')](_0x4fd85c,_0x2d6a14,!![]);}catch(_0x21fb0c){return BPromise['reject'](_0x21fb0c);}return _0x4fd85c['save']();};}function saveUpdates(_0x2c5e91,_0x774c94){return function(_0x1bcc82){if(_0x1bcc82){return _0x1bcc82['update'](_0x2c5e91)[_0xd27b('0x1f')](function(_0x1228a1){return _0x1228a1;});}return null;};}function removeEntity(_0x367c6c,_0x3f208d){return function(_0x1a963a){if(_0x1a963a){return _0x1a963a[_0xd27b('0x35')]()['then'](function(){var _0x5ea67a=_0x1a963a['get']({'plain':!![]});var _0x2ae489=_0xd27b('0x36');return db[_0xd27b('0x37')][_0xd27b('0x35')]({'where':{'type':_0x2ae489,'resourceId':_0x5ea67a['id']}})[_0xd27b('0x1f')](function(){return _0x1a963a;});})[_0xd27b('0x1f')](function(){_0x367c6c['status'](0xcc)[_0xd27b('0x2d')]();});}};}function handleEntityNotFound(_0x4ad6dd,_0x4782fa){return function(_0x34acb8){if(!_0x34acb8){_0x4ad6dd['sendStatus'](0x194);}return _0x34acb8;};}function handleError(_0x2db7c4,_0x4f8aab){_0x4f8aab=_0x4f8aab||0x1f4;return function(_0x3a7615){logger[_0xd27b('0x26')](_0x3a7615['stack']);if(_0x3a7615[_0xd27b('0x38')]){delete _0x3a7615[_0xd27b('0x38')];}_0x2db7c4[_0xd27b('0x2c')](_0x4f8aab)[_0xd27b('0x39')](_0x3a7615);};}exports[_0xd27b('0x3a')]=function(_0x4de64a,_0x19dbc5){var _0x3b5f50={'include':[{'model':db[_0xd27b('0x3b')],'as':_0xd27b('0x3c')}]},_0x526494={},_0x35a82e={'count':0x0,'rows':[]};var _0x475aaa=_[_0xd27b('0x3d')](db['WhatsappAccount'][_0xd27b('0x3e')],function(_0x26b4a){return{'name':_0x26b4a['fieldName'],'type':_0x26b4a[_0xd27b('0x3f')][_0xd27b('0x40')]};});_0x526494['model']=_[_0xd27b('0x3d')](_0x475aaa,_0xd27b('0x38'));_0x526494[_0xd27b('0x41')]=_[_0xd27b('0x42')](_0x4de64a[_0xd27b('0x41')]);_0x526494[_0xd27b('0x43')]=_[_0xd27b('0x44')](_0x526494[_0xd27b('0x45')],_0x526494[_0xd27b('0x41')]);_0x3b5f50[_0xd27b('0x46')]=_[_0xd27b('0x44')](_0x526494[_0xd27b('0x45')],qs['fields'](_0x4de64a[_0xd27b('0x41')][_0xd27b('0x47')]));_0x3b5f50[_0xd27b('0x46')]=_0x3b5f50[_0xd27b('0x46')][_0xd27b('0x48')]?_0x3b5f50[_0xd27b('0x46')]:_0x526494[_0xd27b('0x45')];if(!_0x4de64a['query'][_0xd27b('0x49')](_0xd27b('0x4a'))){_0x3b5f50[_0xd27b('0x31')]=qs[_0xd27b('0x31')](_0x4de64a['query'][_0xd27b('0x31')]);_0x3b5f50['offset']=qs[_0xd27b('0x2f')](_0x4de64a['query'][_0xd27b('0x2f')]);}_0x3b5f50[_0xd27b('0x4b')]=qs[_0xd27b('0x4c')](_0x4de64a['query'][_0xd27b('0x4c')]);_0x3b5f50[_0xd27b('0x4d')]=qs[_0xd27b('0x43')](_[_0xd27b('0x4e')](_0x4de64a[_0xd27b('0x41')],_0x526494[_0xd27b('0x43')]),_0x475aaa);if(_0x4de64a[_0xd27b('0x41')][_0xd27b('0x4f')]){_0x3b5f50[_0xd27b('0x4d')]=_['merge'](_0x3b5f50['where'],{'$or':_[_0xd27b('0x3d')](_0x475aaa,function(_0xfb1982){if(_0xfb1982[_0xd27b('0x3f')]!=='VIRTUAL'){var _0x48acdc={};_0x48acdc[_0xfb1982[_0xd27b('0x38')]]={'$like':'%'+_0x4de64a['query'][_0xd27b('0x4f')]+'%'};return _0x48acdc;}})});}_0x3b5f50=_[_0xd27b('0x50')]({},_0x3b5f50,_0x4de64a['options']);var _0x540930={'where':_0x3b5f50[_0xd27b('0x4d')]};return db[_0xd27b('0x51')][_0xd27b('0x32')](_0x540930)[_0xd27b('0x1f')](function(_0x5605a4){_0x35a82e['count']=_0x5605a4;if(_0x4de64a[_0xd27b('0x41')][_0xd27b('0x52')]){_0x3b5f50[_0xd27b('0x53')]=[{'all':!![]}];}return db[_0xd27b('0x51')][_0xd27b('0x54')](_0x3b5f50);})[_0xd27b('0x1f')](function(_0x298567){_0x35a82e[_0xd27b('0x55')]=_0x298567;return _0x35a82e;})[_0xd27b('0x1f')](respondWithFilteredResult(_0x19dbc5,_0x3b5f50))[_0xd27b('0x2a')](handleError(_0x19dbc5,null));};exports[_0xd27b('0x56')]=function(_0x3feab4,_0x45226a){var _0x5149a3={'raw':![],'where':{'id':_0x3feab4[_0xd27b('0x57')]['id']},'include':[{'model':db[_0xd27b('0x3b')],'as':_0xd27b('0x3c')}]},_0x18aead={};_0x18aead[_0xd27b('0x45')]=_[_0xd27b('0x42')](db['WhatsappAccount'][_0xd27b('0x3e')]);_0x18aead[_0xd27b('0x41')]=_['keys'](_0x3feab4[_0xd27b('0x41')]);_0x18aead[_0xd27b('0x43')]=_[_0xd27b('0x44')](_0x18aead[_0xd27b('0x45')],_0x18aead['query']);_0x5149a3[_0xd27b('0x46')]=_[_0xd27b('0x44')](_0x18aead[_0xd27b('0x45')],qs[_0xd27b('0x47')](_0x3feab4[_0xd27b('0x41')][_0xd27b('0x47')]));_0x5149a3[_0xd27b('0x46')]=_0x5149a3[_0xd27b('0x46')]['length']?_0x5149a3[_0xd27b('0x46')]:_0x18aead[_0xd27b('0x45')];if(_0x3feab4[_0xd27b('0x41')][_0xd27b('0x52')]){_0x5149a3[_0xd27b('0x53')]=[{'all':!![]}];}_0x5149a3=_[_0xd27b('0x50')]({},_0x5149a3,_0x3feab4[_0xd27b('0x58')]);return db[_0xd27b('0x51')][_0xd27b('0x59')](_0x5149a3)[_0xd27b('0x1f')](handleEntityNotFound(_0x45226a,null))[_0xd27b('0x1f')](respondWithResult(_0x45226a,null))['catch'](handleError(_0x45226a,null));};exports['create']=function(_0x2af9cb,_0x378eaf){return db['WhatsappAccount']['create'](_0x2af9cb[_0xd27b('0x5a')],{})['then'](function(_0x3ab89f){var _0x573c4b=_0x2af9cb[_0xd27b('0x5b')][_0xd27b('0x5c')]({'plain':!![]});if(!_0x573c4b)throw new Error(_0xd27b('0x5d'));if(_0x573c4b['role']===_0xd27b('0x5b')){var _0x12f7f8=_0x3ab89f['get']({'plain':!![]});var _0x27ec84=_0xd27b('0x36');return db[_0xd27b('0x5e')][_0xd27b('0x59')]({'where':{'name':_0x27ec84,'userProfileId':_0x573c4b['userProfileId']},'raw':!![]})[_0xd27b('0x1f')](function(_0x5aa164){if(_0x5aa164&&_0x5aa164[_0xd27b('0x5f')]===0x0){return db['UserProfileResource'][_0xd27b('0x60')]({'name':_0x12f7f8[_0xd27b('0x38')],'resourceId':_0x12f7f8['id'],'type':_0x5aa164[_0xd27b('0x38')],'sectionId':_0x5aa164['id']},{})['then'](function(){return _0x3ab89f;});}else{return _0x3ab89f;}})[_0xd27b('0x2a')](function(_0x10c83b){logger[_0xd27b('0x26')](_0xd27b('0x61'),_0x10c83b);throw _0x10c83b;});}return _0x3ab89f;})[_0xd27b('0x1f')](respondWithResult(_0x378eaf,0xc9))['catch'](handleError(_0x378eaf,null));};exports['update']=function(_0x474f7e,_0x29a770){if(_0x474f7e[_0xd27b('0x5a')]['id']){delete _0x474f7e['body']['id'];}return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x474f7e[_0xd27b('0x57')]['id']},'include':[{'model':db[_0xd27b('0x3b')],'as':_0xd27b('0x3c')}]})[_0xd27b('0x1f')](handleEntityNotFound(_0x29a770,null))[_0xd27b('0x1f')](saveUpdates(_0x474f7e[_0xd27b('0x5a')],null))[_0xd27b('0x1f')](respondWithResult(_0x29a770,null))[_0xd27b('0x2a')](handleError(_0x29a770,null));};exports['destroy']=function(_0x17305d,_0x58a47b){return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x17305d['params']['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x58a47b,null))['then'](removeEntity(_0x58a47b,null))['catch'](handleError(_0x58a47b,null));};exports[_0xd27b('0x62')]=function(_0x2a8e55,_0x3ec57d){return db[_0xd27b('0x51')]['describe']()['then'](respondWithResult(_0x3ec57d,null))['catch'](handleError(_0x3ec57d,null));};exports[_0xd27b('0x63')]=function(_0x120220,_0x15556e,_0x2e9127){if(_0x120220[_0xd27b('0x5a')]['id']){delete _0x120220[_0xd27b('0x5a')]['id'];}return db['WhatsappAccount'][_0xd27b('0x59')]({'where':{'id':_0x120220[_0xd27b('0x57')]['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x15556e,null))[_0xd27b('0x1f')](function(_0x3f6985){if(_0x3f6985){_0x120220['body'][_0xd27b('0x64')]=_0x3f6985['id'];return db[_0xd27b('0x65')][_0xd27b('0x60')](_0x120220[_0xd27b('0x5a')]);}})[_0xd27b('0x1f')](respondWithResult(_0x15556e,null))[_0xd27b('0x2a')](handleError(_0x15556e,null));};exports[_0xd27b('0x66')]=function(_0x2f368f,_0x13ab29,_0x462ed8){var _0x4447e2={'raw':![],'where':{}};var _0x50ebcf={};var _0x5b44b5={'count':0x0,'rows':[]};return db[_0xd27b('0x51')][_0xd27b('0x67')]({'where':{'id':_0x2f368f[_0xd27b('0x57')]['id']}})['then'](handleEntityNotFound(_0x13ab29,null))[_0xd27b('0x1f')](function(_0xd6d9d){if(_0xd6d9d){_0x50ebcf[_0xd27b('0x45')]=_[_0xd27b('0x42')](db[_0xd27b('0x65')][_0xd27b('0x3e')]);_0x50ebcf[_0xd27b('0x41')]=_[_0xd27b('0x42')](_0x2f368f['query']);_0x50ebcf[_0xd27b('0x43')]=_[_0xd27b('0x44')](_0x50ebcf[_0xd27b('0x45')],_0x50ebcf[_0xd27b('0x41')]);_0x4447e2[_0xd27b('0x46')]=_['intersection'](_0x50ebcf['model'],qs['fields'](_0x2f368f[_0xd27b('0x41')]['fields']));_0x4447e2['attributes']=_0x4447e2['attributes'][_0xd27b('0x48')]?_0x4447e2['attributes']:_0x50ebcf['model'];if(!_0x2f368f[_0xd27b('0x41')]['hasOwnProperty']('nolimit')){_0x4447e2[_0xd27b('0x31')]=qs[_0xd27b('0x31')](_0x2f368f['query'][_0xd27b('0x31')]);_0x4447e2[_0xd27b('0x2f')]=qs[_0xd27b('0x2f')](_0x2f368f[_0xd27b('0x41')][_0xd27b('0x2f')]);}_0x4447e2['order']=qs['sort'](_0x2f368f['query'][_0xd27b('0x4c')]);_0x4447e2[_0xd27b('0x4d')]=qs[_0xd27b('0x43')](_[_0xd27b('0x4e')](_0x2f368f[_0xd27b('0x41')],_0x50ebcf['filters']));_0x4447e2[_0xd27b('0x4d')][_0xd27b('0x64')]=_0xd6d9d['id'];if(_0x2f368f['query'][_0xd27b('0x4f')]){_0x4447e2[_0xd27b('0x4d')]=_[_0xd27b('0x50')](_0x4447e2[_0xd27b('0x4d')],{'$or':_[_0xd27b('0x3d')](_0x4447e2[_0xd27b('0x46')],function(_0x47a420){var _0x17155e={};_0x17155e[_0x47a420]={'$like':'%'+_0x2f368f[_0xd27b('0x41')][_0xd27b('0x4f')]+'%'};return _0x17155e;})});}_0x4447e2=_[_0xd27b('0x50')]({},_0x4447e2,_0x2f368f[_0xd27b('0x58')]);return db[_0xd27b('0x65')][_0xd27b('0x32')]({'where':_0x4447e2[_0xd27b('0x4d')]})['then'](function(_0x347507){_0x5b44b5[_0xd27b('0x32')]=_0x347507;if(_0x2f368f[_0xd27b('0x41')]['includeAll']){_0x4447e2[_0xd27b('0x53')]=[{'all':!![]}];}return db[_0xd27b('0x65')][_0xd27b('0x54')](_0x4447e2);})[_0xd27b('0x1f')](function(_0x390001){_0x5b44b5[_0xd27b('0x55')]=_0x390001;return _0x5b44b5;});}})[_0xd27b('0x1f')](respondWithFilteredResult(_0x13ab29,_0x4447e2))['catch'](handleError(_0x13ab29,null));};exports[_0xd27b('0x68')]=function(_0x4b16a7,_0x555401,_0x171962){return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x4b16a7[_0xd27b('0x57')]['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x555401,null))[_0xd27b('0x1f')](function(_0x616764){if(_0x616764){return _0x616764[_0xd27b('0x68')](_0x4b16a7['query']['ids']);}})[_0xd27b('0x1f')](respondWithStatusCode(_0x555401,null))['catch'](handleError(_0x555401,null));};exports['addAnswer']=function(_0xae8f4a,_0x20afdb,_0x469ee3){if(_0xae8f4a[_0xd27b('0x5a')]['id']){delete _0xae8f4a[_0xd27b('0x5a')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0xae8f4a['params']['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x20afdb,null))[_0xd27b('0x1f')](function(_0x347702){if(_0x347702){_0xae8f4a[_0xd27b('0x5a')][_0xd27b('0x64')]=_0x347702['id'];return db['CannedAnswer'][_0xd27b('0x60')](_0xae8f4a[_0xd27b('0x5a')]);}})[_0xd27b('0x1f')](respondWithResult(_0x20afdb,null))['catch'](handleError(_0x20afdb,null));};exports[_0xd27b('0x69')]=function(_0xfa7f10,_0x4afb27,_0x19453b){var _0x3cb0ce={'raw':![],'where':{}};var _0x4134b1={};var _0x37e17b={'count':0x0,'rows':[]};return db[_0xd27b('0x51')][_0xd27b('0x67')]({'where':{'id':_0xfa7f10['params']['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x4afb27,null))['then'](function(_0x23caeb){if(_0x23caeb){_0x4134b1[_0xd27b('0x45')]=_['keys'](db[_0xd27b('0x6a')][_0xd27b('0x3e')]);_0x4134b1[_0xd27b('0x41')]=_[_0xd27b('0x42')](_0xfa7f10[_0xd27b('0x41')]);_0x4134b1[_0xd27b('0x43')]=_['intersection'](_0x4134b1[_0xd27b('0x45')],_0x4134b1[_0xd27b('0x41')]);_0x3cb0ce[_0xd27b('0x46')]=_[_0xd27b('0x44')](_0x4134b1[_0xd27b('0x45')],qs[_0xd27b('0x47')](_0xfa7f10['query'][_0xd27b('0x47')]));_0x3cb0ce[_0xd27b('0x46')]=_0x3cb0ce['attributes'][_0xd27b('0x48')]?_0x3cb0ce['attributes']:_0x4134b1[_0xd27b('0x45')];if(!_0xfa7f10['query'][_0xd27b('0x49')](_0xd27b('0x4a'))){_0x3cb0ce[_0xd27b('0x31')]=qs[_0xd27b('0x31')](_0xfa7f10[_0xd27b('0x41')][_0xd27b('0x31')]);_0x3cb0ce[_0xd27b('0x2f')]=qs[_0xd27b('0x2f')](_0xfa7f10['query'][_0xd27b('0x2f')]);}_0x3cb0ce[_0xd27b('0x4b')]=qs[_0xd27b('0x4c')](_0xfa7f10[_0xd27b('0x41')][_0xd27b('0x4c')]);_0x3cb0ce[_0xd27b('0x4d')]=qs[_0xd27b('0x43')](_[_0xd27b('0x4e')](_0xfa7f10['query'],_0x4134b1['filters']));_0x3cb0ce[_0xd27b('0x4d')][_0xd27b('0x64')]=_0x23caeb['id'];if(_0xfa7f10['query'][_0xd27b('0x4f')]){_0x3cb0ce['where']=_[_0xd27b('0x50')](_0x3cb0ce['where'],{'$or':_['map'](_0x3cb0ce['attributes'],function(_0x3164e8){var _0x492379={};_0x492379[_0x3164e8]={'$like':'%'+_0xfa7f10[_0xd27b('0x41')]['filter']+'%'};return _0x492379;})});}_0x3cb0ce=_['merge']({},_0x3cb0ce,_0xfa7f10['options']);return db['CannedAnswer'][_0xd27b('0x32')]({'where':_0x3cb0ce['where']})[_0xd27b('0x1f')](function(_0x275145){_0x37e17b[_0xd27b('0x32')]=_0x275145;if(_0xfa7f10[_0xd27b('0x41')][_0xd27b('0x52')]){_0x3cb0ce[_0xd27b('0x53')]=[{'all':!![]}];}return db[_0xd27b('0x6a')][_0xd27b('0x54')](_0x3cb0ce);})[_0xd27b('0x1f')](function(_0x213df5){_0x37e17b['rows']=_0x213df5;return _0x37e17b;});}})[_0xd27b('0x1f')](respondWithFilteredResult(_0x4afb27,_0x3cb0ce))['catch'](handleError(_0x4afb27,null));};exports[_0xd27b('0x6b')]=function(_0x22ef82,_0x345464,_0x56e460){return db[_0xd27b('0x51')]['find']({'where':{'id':_0x22ef82['params']['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x345464,null))[_0xd27b('0x1f')](function(_0x503bca){if(_0x503bca){return _0x503bca[_0xd27b('0x6b')](_0x22ef82[_0xd27b('0x41')][_0xd27b('0x6c')]);}})[_0xd27b('0x1f')](respondWithStatusCode(_0x345464,null))[_0xd27b('0x2a')](handleError(_0x345464,null));};exports[_0xd27b('0x6d')]=function(_0x4a1c63,_0x45db8b,_0x37db5a){return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x4a1c63[_0xd27b('0x57')]['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x45db8b,null))[_0xd27b('0x1f')](function(_0x59e8c2){if(_0x59e8c2){return _0x59e8c2[_0xd27b('0x6d')](_0x4a1c63['body'][_0xd27b('0x6c')],_[_0xd27b('0x6e')](_0x4a1c63[_0xd27b('0x5a')],['ids','id'])||{})['spread'](function(_0x45efc0){for(var _0x44f8d8=0x0;_0x44f8d8<_0x4a1c63[_0xd27b('0x5a')][_0xd27b('0x6c')][_0xd27b('0x48')];_0x44f8d8+=0x1){socket['emit'](_0xd27b('0x6f'),{'UserId':Number(_0x4a1c63['body'][_0xd27b('0x6c')][_0x44f8d8]),'WhatsappAccountId':Number(_0x4a1c63['params']['id'])});}return _0x45efc0;});}})[_0xd27b('0x1f')](respondWithResult(_0x45db8b,null))[_0xd27b('0x2a')](handleError(_0x45db8b,null));};exports['removeAgents']=function(_0x3662d3,_0x377182,_0x433fd2){return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x3662d3[_0xd27b('0x57')]['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x377182,null))['then'](function(_0x475f3f){if(_0x475f3f){return _0x475f3f[_0xd27b('0x70')](_0x3662d3[_0xd27b('0x41')][_0xd27b('0x6c')])[_0xd27b('0x1f')](function(){if(_[_0xd27b('0x71')](_0x3662d3[_0xd27b('0x41')][_0xd27b('0x6c')])){for(var _0x48a87e=0x0;_0x48a87e<_0x3662d3[_0xd27b('0x41')][_0xd27b('0x6c')][_0xd27b('0x48')];_0x48a87e+=0x1){socket[_0xd27b('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x3662d3[_0xd27b('0x41')]['ids'][_0x48a87e]),'WhatsappAccountId':Number(_0x3662d3[_0xd27b('0x57')]['id'])});}}else{socket[_0xd27b('0x72')](_0xd27b('0x73'),{'UserId':Number(_0x3662d3[_0xd27b('0x41')][_0xd27b('0x6c')]),'WhatsappAccountId':Number(_0x3662d3[_0xd27b('0x57')]['id'])});}});}})[_0xd27b('0x1f')](respondWithStatusCode(_0x377182,null))[_0xd27b('0x2a')](handleError(_0x377182,null));};exports[_0xd27b('0x74')]=function(_0x49346a,_0x476e63,_0x2b0922){var _0x4df9eb={};var _0x21da22={};var _0xa5456f;var _0x2aa137;return db[_0xd27b('0x51')][_0xd27b('0x67')]({'where':{'id':_0x49346a['params']['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x476e63,null))['then'](function(_0x160277){if(_0x160277){_0xa5456f=_0x160277;_0x21da22[_0xd27b('0x45')]=_['keys'](db[_0xd27b('0x75')][_0xd27b('0x3e')]);_0x21da22[_0xd27b('0x41')]=_[_0xd27b('0x42')](_0x49346a['query']);_0x21da22[_0xd27b('0x43')]=_[_0xd27b('0x44')](_0x21da22['model'],_0x21da22[_0xd27b('0x41')]);_0x4df9eb[_0xd27b('0x46')]=_[_0xd27b('0x44')](_0x21da22[_0xd27b('0x45')],qs[_0xd27b('0x47')](_0x49346a[_0xd27b('0x41')]['fields']));_0x4df9eb[_0xd27b('0x46')]=_0x4df9eb[_0xd27b('0x46')][_0xd27b('0x48')]?_0x4df9eb[_0xd27b('0x46')]:_0x21da22[_0xd27b('0x45')];_0x4df9eb[_0xd27b('0x4b')]=qs[_0xd27b('0x4c')](_0x49346a[_0xd27b('0x41')][_0xd27b('0x4c')]);_0x4df9eb['where']=qs[_0xd27b('0x43')](_[_0xd27b('0x4e')](_0x49346a['query'],_0x21da22[_0xd27b('0x43')]));if(_0x49346a[_0xd27b('0x41')][_0xd27b('0x4f')]){_0x4df9eb[_0xd27b('0x4d')]=_['merge'](_0x4df9eb[_0xd27b('0x4d')],{'$or':_[_0xd27b('0x3d')](_0x4df9eb['attributes'],function(_0x3b7c45){var _0x16570f={};_0x16570f[_0x3b7c45]={'$like':'%'+_0x49346a['query'][_0xd27b('0x4f')]+'%'};return _0x16570f;})});}_0x4df9eb=_[_0xd27b('0x50')]({},_0x4df9eb,_0x49346a[_0xd27b('0x58')]);return _0xa5456f[_0xd27b('0x74')](_0x4df9eb);}})[_0xd27b('0x1f')](function(_0x4548e3){if(_0x4548e3){_0x2aa137=_0x4548e3[_0xd27b('0x48')];if(!_0x49346a[_0xd27b('0x41')][_0xd27b('0x49')](_0xd27b('0x4a'))){_0x4df9eb[_0xd27b('0x31')]=qs[_0xd27b('0x31')](_0x49346a[_0xd27b('0x41')][_0xd27b('0x31')]);_0x4df9eb[_0xd27b('0x2f')]=qs[_0xd27b('0x2f')](_0x49346a['query'][_0xd27b('0x2f')]);}return _0xa5456f[_0xd27b('0x74')](_0x4df9eb);}})['then'](function(_0x14b130){if(_0x14b130){return _0x14b130?{'count':_0x2aa137,'rows':_0x14b130}:null;}})['then'](respondWithResult(_0x476e63,null))[_0xd27b('0x2a')](handleError(_0x476e63,null));};exports[_0xd27b('0x76')]=function(_0x559697,_0x8d6bf7){var _0x52e959=_0x559697[_0xd27b('0x57')]['id'];var _0x324420=_0x559697[_0xd27b('0x5a')];var _0x54236d=0xc8;var _0x6c2b50=null;return db[_0xd27b('0x77')]['transaction']({'isolationLevel':db[_0xd27b('0x77')][_0xd27b('0x78')][_0xd27b('0x79')][_0xd27b('0x7a')]},function(_0x246311){return db['WhatsappAccount']['findOne']({'where':{'id':_0x52e959},'transaction':_0x246311})['then'](function(_0x1452ca){if(_0x1452ca){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x52e959},'transaction':_0x246311})['then'](function(){var _0x7c9bb8=_[_0xd27b('0x3d')](_0x324420,function(_0x44b40c){_0x44b40c[_0xd27b('0x64')]=_0x52e959;return _0x44b40c;});return db['WhatsappApplication']['bulkCreate'](_0x7c9bb8,{'transaction':_0x246311});});}else{_0x54236d=0x194;_0x6c2b50=[];}});})[_0xd27b('0x1f')](function(){if(_0x54236d!==0x194){return db[_0xd27b('0x7b')][_0xd27b('0x7c')]({'where':{'WhatsappAccountId':_0x52e959},'order':'priority'})[_0xd27b('0x1f')](function(_0x511b94){_0x6c2b50=_0x511b94;});}})[_0xd27b('0x2a')](function(_0x10f030){_0x54236d=0x1f4;logger[_0xd27b('0x26')](_0x10f030[_0xd27b('0x7d')]);if(_0x10f030[_0xd27b('0x38')]){delete _0x10f030['name'];}_0x6c2b50=_0x10f030;})['finally'](function(){if(_0x6c2b50===null){_0x8d6bf7[_0xd27b('0x2b')](_0x54236d);}else{if(_0x54236d===0x1f4){_0x8d6bf7[_0xd27b('0x2c')](_0x54236d)[_0xd27b('0x39')](_0x6c2b50);}else{_0x8d6bf7[_0xd27b('0x2c')](_0x54236d)['json'](_0x6c2b50);}}});};exports['getApplications']=function(_0x23b5c2,_0x19428f,_0x5ec022){var _0x5e4528={};var _0x50e0d0={};var _0x1f21b2;var _0x3ce6ee;return db[_0xd27b('0x51')][_0xd27b('0x67')]({'where':{'id':_0x23b5c2[_0xd27b('0x57')]['id']}})[_0xd27b('0x1f')](handleEntityNotFound(_0x19428f,null))['then'](function(_0x4cfa30){if(_0x4cfa30){_0x1f21b2=_0x4cfa30;_0x50e0d0['model']=_[_0xd27b('0x42')](db[_0xd27b('0x7b')][_0xd27b('0x3e')]);_0x50e0d0['query']=_[_0xd27b('0x42')](_0x23b5c2[_0xd27b('0x41')]);_0x50e0d0[_0xd27b('0x43')]=_[_0xd27b('0x44')](_0x50e0d0[_0xd27b('0x45')],_0x50e0d0[_0xd27b('0x41')]);_0x5e4528[_0xd27b('0x46')]=_[_0xd27b('0x44')](_0x50e0d0[_0xd27b('0x45')],qs[_0xd27b('0x47')](_0x23b5c2[_0xd27b('0x41')][_0xd27b('0x47')]));_0x5e4528['attributes']=_0x5e4528[_0xd27b('0x46')][_0xd27b('0x48')]?_0x5e4528[_0xd27b('0x46')]:_0x50e0d0[_0xd27b('0x45')];_0x5e4528['order']=qs['sort'](_0x23b5c2[_0xd27b('0x41')]['sort']);_0x5e4528['where']=qs['filters'](_[_0xd27b('0x4e')](_0x23b5c2[_0xd27b('0x41')],_0x50e0d0[_0xd27b('0x43')]));if(_0x23b5c2[_0xd27b('0x41')][_0xd27b('0x4f')]){_0x5e4528[_0xd27b('0x4d')]=_['merge'](_0x5e4528[_0xd27b('0x4d')],{'$or':_[_0xd27b('0x3d')](_0x5e4528['attributes'],function(_0x42ed39){var _0x5a7601={};_0x5a7601[_0x42ed39]={'$like':'%'+_0x23b5c2[_0xd27b('0x41')]['filter']+'%'};return _0x5a7601;})});}_0x5e4528=_[_0xd27b('0x50')]({},_0x5e4528,_0x23b5c2[_0xd27b('0x58')]);return _0x1f21b2[_0xd27b('0x7e')](_0x5e4528);}})[_0xd27b('0x1f')](function(_0x57575a){if(_0x57575a){_0x3ce6ee=_0x57575a[_0xd27b('0x48')];if(!_0x23b5c2[_0xd27b('0x41')][_0xd27b('0x49')](_0xd27b('0x4a'))){_0x5e4528['limit']=qs['limit'](_0x23b5c2[_0xd27b('0x41')][_0xd27b('0x31')]);_0x5e4528[_0xd27b('0x2f')]=qs[_0xd27b('0x2f')](_0x23b5c2[_0xd27b('0x41')][_0xd27b('0x2f')]);}return _0x1f21b2[_0xd27b('0x7e')](_0x5e4528);}})[_0xd27b('0x1f')](function(_0x30dfcb){if(_0x30dfcb){return _0x30dfcb?{'count':_0x3ce6ee,'rows':_0x30dfcb}:null;}})[_0xd27b('0x1f')](respondWithResult(_0x19428f,null))[_0xd27b('0x2a')](handleError(_0x19428f,null));};exports[_0xd27b('0x7f')]=function(_0x3762f5,_0x3bfafe,_0x338814){var _0x3f13f0={'channel':'whatsapp'};var _0x2e867e=[];var _0x35ded1=[];var _0x4425e8={};return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x3762f5[_0xd27b('0x57')]['id']},'include':[{'model':db[_0xd27b('0x7b')],'as':_0xd27b('0x80')}]})[_0xd27b('0x1f')](handleEntityNotFound(_0x3bfafe,null))[_0xd27b('0x1f')](function(_0x62816c){_0x3f13f0[_0xd27b('0x81')]=_0x62816c;if(_0x3f13f0[_0xd27b('0x81')]&&_0x3f13f0['account'][_0xd27b('0x3f')]==='sinch'&&_0x3762f5[_0xd27b('0x5a')][_0xd27b('0x82')]){if(_0x3762f5[_0xd27b('0x5a')][_0xd27b('0x82')][_0xd27b('0x48')]===0x0)return;if(_0x3762f5['body'][_0xd27b('0x82')][0x0][_0xd27b('0x83')]!==_0xd27b('0x84'))return;return db[_0xd27b('0x85')][_0xd27b('0x86')]({'read':!![],'readAt':_0x3762f5['body'][_0xd27b('0x82')][0x0][_0xd27b('0x87')]},{'where':{'messageId':_0x3762f5['body'][_0xd27b('0x82')][0x0][_0xd27b('0x88')]},'individualHooks':!![]})[_0xd27b('0x1f')](function(_0x46cab0){return _0x3bfafe[_0xd27b('0x2c')](0xc8)[_0xd27b('0x2e')](_0x46cab0);});}_0x3f13f0['applications']=_[_0xd27b('0x89')](_0x62816c[_0xd27b('0x80')],[_0xd27b('0x8a')],[_0xd27b('0x8b')]);if(_0x3f13f0[_0xd27b('0x81')][_0xd27b('0x80')]){delete _0x3f13f0[_0xd27b('0x81')][_0xd27b('0x80')];}return db[_0xd27b('0x8c')][_0xd27b('0x62')]()[_0xd27b('0x1f')](function(_0xace37c){if(!_0xace37c){throw new db[(_0xd27b('0x8d'))][(_0xd27b('0x8e'))](_0xd27b('0x8f'));}_0x2e867e=_[_0xd27b('0x90')](_[_0xd27b('0x42')](_0xace37c),[_0xd27b('0x91'),_0xd27b('0x92')]);_0x35ded1=_[_0xd27b('0x90')](_['keys'](_0xace37c),[_0xd27b('0x91'),'updatedAt',_0xd27b('0x93'),_0xd27b('0x94')]);_0x3f13f0[_0xd27b('0x5a')]={'mapKey':_0xd27b('0x95')};if(_0x3f13f0['account']&&_0x3f13f0[_0xd27b('0x81')][_0xd27b('0x3f')]===_0xd27b('0x96')){_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x97')]=_0x3762f5[_0xd27b('0x5a')][_0xd27b('0x98')]['replace'](_0xd27b('0x99'),'');_0x3f13f0['body'][_0xd27b('0x5a')]=_0x3762f5[_0xd27b('0x5a')][_0xd27b('0x9a')];_0x3f13f0[_0xd27b('0x5a')]['messageId']=_0x3762f5[_0xd27b('0x5a')][_0xd27b('0x9b')];}if(_0x3f13f0['account']&&_0x3f13f0[_0xd27b('0x81')][_0xd27b('0x3f')]===_0xd27b('0x9c')){_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x97')]=_0x3762f5['body'][_0xd27b('0x9d')][0x0][_0xd27b('0x97')];_0x3f13f0['body'][_0xd27b('0x5a')]=_0x3762f5['body']['notifications'][0x0][_0xd27b('0x28')][_0xd27b('0x5a')];_0x3f13f0['body']['messageId']=_0x3762f5[_0xd27b('0x5a')][_0xd27b('0x9d')][0x0]['message_id'];}if(_0x3f13f0[_0xd27b('0x5a')]['id']){delete _0x3f13f0[_0xd27b('0x5a')]['id'];}if(_[_0xd27b('0x9e')](_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x97')])){throw new db[(_0xd27b('0x8d'))]['ValidationError'](_0xd27b('0x9f'));}if(_[_0xd27b('0x9e')](_0x3f13f0['body']['body'])||_0x3f13f0['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0xa0')])){throw new db[(_0xd27b('0x8d'))][(_0xd27b('0x8e'))](_0xd27b('0xa1')+_0x35ded1);}if(!_['includes'](_0x35ded1,_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0xa0')])){throw new db['Sequelize'][(_0xd27b('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35ded1);}_0x4425e8[_0x3f13f0[_0xd27b('0x5a')]['mapKey']]=_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x97')];return db['CmList'][_0xd27b('0x59')]({'where':{'id':_0x3f13f0[_0xd27b('0x81')][_0xd27b('0x94')]},'include':[{'model':db[_0xd27b('0x8c')],'as':_0xd27b('0xa2'),'where':_0x4425e8,'limit':0x1,'order':[[_0xd27b('0x92'),_0xd27b('0xa3')]]}]});})[_0xd27b('0x1f')](handleEntityNotFound(_0x3bfafe,null))['then'](function(_0x86a44b){if(_0x86a44b){_0x3f13f0[_0xd27b('0xa4')]=_[_0xd27b('0x6e')](_0x86a44b,[_0xd27b('0xa2')]);if(_0x86a44b[_0xd27b('0xa2')]['length']){return _0x86a44b[_0xd27b('0xa2')][0x0];}var _0x4a60ab=_[_0xd27b('0x19')](_0x3f13f0[_0xd27b('0x5a')],{'firstName':_0x3f13f0['body'][_0xd27b('0x97')],'ListId':_0x86a44b['id']});_0x4a60ab[_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0xa0')]]=_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x97')];return db[_0xd27b('0x8c')][_0xd27b('0x60')](_0x4a60ab,{'fields':_0x2e867e,'raw':!![]});}})[_0xd27b('0x1f')](handleEntityNotFound(_0x3bfafe,null))[_0xd27b('0x1f')](function(_0x12a56b){if(_0x12a56b){_0x3f13f0[_0xd27b('0xa5')]=_0x12a56b;var _0x1fc38e={'ContactId':_0x12a56b['id'],'phone':_0x3f13f0['body'][_0xd27b('0x97')],'WhatsappAccountId':_0x3762f5[_0xd27b('0x57')]['id']};var _0x4d1686={'ContactId':_0x12a56b['id'],'WhatsappAccountId':_0x3762f5['params']['id'],'closed':![]};return db[_0xd27b('0xa6')][_0xd27b('0x59')]({'where':_0x4d1686})['then'](function(_0x4c9551){if(_0x4c9551){return[_0x4c9551,![]];}return db[_0xd27b('0xa6')][_0xd27b('0x60')](_0x1fc38e)[_0xd27b('0x1f')](function(_0x514c4a){return[_0x514c4a,!![]];});});}})[_0xd27b('0xa7')](function(_0x52bd85,_0x4cf7c6){_0x3f13f0[_0xd27b('0xa8')]=_0x52bd85[_0xd27b('0x5c')]({'plain':!![]});_0x3f13f0['interaction'][_0xd27b('0xa9')]=![];if(_0x4cf7c6){if(_0x3f13f0[_0xd27b('0x81')]['autoclose']){_0x3f13f0[_0xd27b('0xaa')][_0xd27b('0xab')]({'id':0x0,'priority':_0x3f13f0['applications'][_0xd27b('0x48')]+0x1,'app':_0xd27b('0xac'),'appdata':_0xd27b('0xad'),'interval':_0xd27b('0xae')});}_0x3f13f0[_0xd27b('0xa8')]['created']=!![];}return db[_0xd27b('0x85')][_0xd27b('0x60')]({'phone':_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x97')],'messageId':_0x3f13f0[_0xd27b('0x5a')]['messageId'],'body':_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0x5a')],'WhatsappAccountId':_0x3762f5['params']['id'],'WhatsappInteractionId':_0x52bd85['id'],'direction':'in','ContactId':_0x52bd85[_0xd27b('0xaf')],'AttachmentId':_0x3f13f0[_0xd27b('0x5a')][_0xd27b('0xb0')]});})[_0xd27b('0x1f')](function(_0x4ce924){_0x3f13f0['message']=_0x4ce924;if(!_0x3f13f0[_0xd27b('0xa8')]['UserId'])return;return db[_0xd27b('0x75')]['find']({'attributes':['id',_0xd27b('0x38')],'where':{'id':_0x3f13f0[_0xd27b('0xa8')][_0xd27b('0xb1')]}});})[_0xd27b('0x1f')](function(_0xc319f6){if(_0xc319f6){_0x3f13f0[_0xd27b('0xaa')][_0xd27b('0xb2')]({'id':0x0,'priority':0x0,'app':_0xd27b('0xb3'),'appdata':_0xc319f6[_0xd27b('0x38')]+','+(_0x3f13f0[_0xd27b('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xd27b('0xae')});}if(!_0x3f13f0[_0xd27b('0xa8')][_0xd27b('0xb4')])return;return db[_0xd27b('0xb5')][_0xd27b('0x59')]({'attributes':['id',_0xd27b('0x38')],'where':{'id':_0x3f13f0[_0xd27b('0xa8')][_0xd27b('0xb4')]}});})[_0xd27b('0x1f')](function(_0x5edd2f){if(_0x5edd2f){_0x3f13f0[_0xd27b('0xaa')][_0xd27b('0xb2')]({'id':0x0,'priority':0x1,'app':_0xd27b('0xb6'),'appdata':_0x5edd2f[_0xd27b('0x38')]+','+(_0x3f13f0[_0xd27b('0x81')]['waitForTheAssignedQueue']||0x12c),'interval':_0xd27b('0xae')});}return respondWithRpcPromise(_0xd27b('0xb7'),_0xd27b('0xb8'),_0x3f13f0);})[_0xd27b('0x1f')](function(_0x52c1ec){if(_0x52c1ec){var _0x4a8dcc=0xc8;var _0x5a36ae=_0xd27b('0xb9');logger[_0xd27b('0x20')](_0xd27b('0x24'),_0x5a36ae,_0x4a8dcc,'entity\x20found');logger['debug'](_0xd27b('0xba'),_0x5a36ae,_0x4a8dcc,'entity\x20found',JSON[_0xd27b('0x25')](_0x52c1ec));if(_0x3f13f0['account']['type']===_0xd27b('0x96')){return _0x3bfafe[_0xd27b('0x2c')](_0x4a8dcc)[_0xd27b('0xbb')](_0xd27b('0xbc'),_0xd27b('0xbd'))[_0xd27b('0x39')](_0xd27b('0xbe'));}else{return _0x3bfafe['status'](_0x4a8dcc)[_0xd27b('0x2e')](_0x52c1ec);}}});})[_0xd27b('0x2a')](handleError(_0x3bfafe,null));};exports['send']=function(_0x516259,_0x2525dc,_0x59b3f5){var _0x1de3a8,_0x9a4419,_0x5bcf6a;if(_[_0xd27b('0x9e')](_0x516259[_0xd27b('0x5a')][_0xd27b('0x5a')])||_0x516259[_0xd27b('0x5a')][_0xd27b('0x5a')]===''){throw new db[(_0xd27b('0x8d'))][(_0xd27b('0x8e'))](_0xd27b('0xbf'));}if(_['isNil'](_0x516259['body']['to'])){throw new db['Sequelize'][(_0xd27b('0x8e'))](_0xd27b('0xc0'));}_0x1de3a8=_0x516259['body']['to'];return db[_0xd27b('0x51')][_0xd27b('0x59')]({'where':{'id':_0x516259[_0xd27b('0x57')]['id']},'include':[{'model':db[_0xd27b('0xc1')],'as':_0xd27b('0xc2'),'include':[{'model':db[_0xd27b('0x8c')],'as':_0xd27b('0xa2'),'where':{'mobile':_0x1de3a8},'limit':0x1,'order':[[_0xd27b('0x92'),_0xd27b('0xa3')]]}]}]})[_0xd27b('0x1f')](handleEntityNotFound(_0x2525dc,null))['then'](function(_0x1de2e8){if(_0x1de2e8&&_0x1de2e8['List']){_0x9a4419=_0x1de2e8[_0xd27b('0x5c')]({'plain':!![]});if(_0x9a4419[_0xd27b('0xc2')]&&_0x9a4419['List']['Contacts'][_0xd27b('0x48')]){return _0x9a4419[_0xd27b('0xc2')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xd27b('0x19')](_0x516259['body'],{'firstName':_0x1de3a8,'mobile':_0x1de3a8,'phone':_0x1de3a8,'ListId':_0x9a4419[_0xd27b('0x94')]}));}})[_0xd27b('0x1f')](handleEntityNotFound(_0x2525dc,null))['then'](function(_0x4b539e){if(_0x4b539e){_0x5bcf6a=_0x4b539e;return db[_0xd27b('0xa6')][_0xd27b('0x59')]({'where':{'ContactId':_0x5bcf6a['id'],'closed':![],'WhatsappAccountId':_0x9a4419['id']}})['then'](function(_0x22e741){if(_0x22e741){return[_0x22e741,![]];}return db[_0xd27b('0xa6')]['create']({'UserId':_0x516259[_0xd27b('0x5b')]['id'],'ContactId':_0x5bcf6a['id'],'WhatsappAccountId':_0x9a4419['id'],'phone':_0x1de3a8,'firstMsgDirection':_0xd27b('0xc3'),'Messages':[_[_0xd27b('0x50')](_0x516259[_0xd27b('0x5a')],{'read':![],'body':_0x516259[_0xd27b('0x5a')]['body'],'phone':_0x1de3a8,'WhatsappAccountId':_0x9a4419['id'],'UserId':_0x516259['user']['id'],'ContactId':_0x5bcf6a['id']})]},{'include':[{'model':db[_0xd27b('0x85')],'as':_0xd27b('0xc4')}]})[_0xd27b('0x1f')](function(_0x465b1b){return[_0x465b1b,!![]];});});}})[_0xd27b('0xa7')](function(_0x1c882a,_0x56759b){if(_0x56759b){return _0x1c882a;}return db[_0xd27b('0x85')][_0xd27b('0x60')](_['merge'](_0x516259[_0xd27b('0x5a')],{'read':![],'body':_0x516259[_0xd27b('0x5a')][_0xd27b('0x5a')],'phone':_0x1de3a8,'WhatsappAccountId':_0x9a4419['id'],'WhatsappInteractionId':_0x1c882a['id'],'UserId':_0x516259['user']['id'],'ContactId':_0x5bcf6a['id']}))[_0xd27b('0x1f')](function(_0x505724){_0x1c882a[_0xd27b('0xc5')][_0xd27b('0xc4')]=[];_0x1c882a['dataValues'][_0xd27b('0xc4')][_0xd27b('0xab')](_0x505724[_0xd27b('0xc5')]);return _0x1c882a;});})[_0xd27b('0x1f')](respondWithResult(_0x2525dc,null))[_0xd27b('0x2a')](handleError(_0x2525dc,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4a776ff..c8980b6 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 _0x6264=['remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6264,0x11e));var _0x4626=function(_0x3067fe,_0x1eb454){_0x3067fe=_0x3067fe-0x0;var _0x14c031=_0x6264[_0x3067fe];return _0x14c031;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x4626('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4626('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4626('0x2')};function emitEvent(_0x4a34f6){return function(_0x23c8cc,_0x351faa,_0x39fd39){WhatsappAccountEvents[_0x4626('0x3')](_0x4a34f6+':'+_0x23c8cc['id'],_0x23c8cc);WhatsappAccountEvents[_0x4626('0x3')](_0x4a34f6,_0x23c8cc);_0x39fd39(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x4626('0x4')](e,emitEvent(event));}}module[_0x4626('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0x14d4=['WhatsappAccount','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3e62e3,_0x312502){var _0x170059=function(_0x249261){while(--_0x249261){_0x3e62e3['push'](_0x3e62e3['shift']());}};_0x170059(++_0x312502);}(_0x14d4,0x127));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x414d('0x0'));var WhatsappAccount=require(_0x414d('0x1'))['db'][_0x414d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x414d('0x3'),'afterUpdate':_0x414d('0x4'),'afterDestroy':_0x414d('0x5')};function emitEvent(_0x2e3223){return function(_0x695af,_0x395634,_0x2ff9e2){WhatsappAccountEvents['emit'](_0x2e3223+':'+_0x695af['id'],_0x695af);WhatsappAccountEvents['emit'](_0x2e3223,_0x695af);_0x2ff9e2(null);};}for(var e in events){if(events[_0x414d('0x6')](e)){var event=events[e];WhatsappAccount[_0x414d('0x7')](e,emitEvent(event));}}module[_0x414d('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index af694a1..00c40a9 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 _0xd734=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x1437c2,_0x571f30){var _0x41b1ad=function(_0x4dc2ea){while(--_0x4dc2ea){_0x1437c2['push'](_0x1437c2['shift']());}};_0x41b1ad(++_0x571f30);}(_0xd734,0xd2));var _0x4d73=function(_0x322b84,_0x576604){_0x322b84=_0x322b84-0x0;var _0x2398b2=_0xd734[_0x322b84];return _0x2398b2;};'use strict';var _=require(_0x4d73('0x0'));var util=require(_0x4d73('0x1'));var logger=require(_0x4d73('0x2'))(_0x4d73('0x3'));var moment=require(_0x4d73('0x4'));var BPromise=require(_0x4d73('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d73('0x6'));var config=require(_0x4d73('0x7'));var attributes=require(_0x4d73('0x8'));module[_0x4d73('0x9')]=function(_0x22745e,_0x5a59ce){return _0x22745e[_0x4d73('0xa')](_0x4d73('0xb'),attributes,{'tableName':_0x4d73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcab1=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','util'];(function(_0xb80aed,_0x48b106){var _0x2759eb=function(_0x370ea1){while(--_0x370ea1){_0xb80aed['push'](_0xb80aed['shift']());}};_0x2759eb(++_0x48b106);}(_0xcab1,0x143));var _0x1cab=function(_0x394f38,_0x231727){_0x394f38=_0x394f38-0x0;var _0x168347=_0xcab1[_0x394f38];return _0x168347;};'use strict';var _=require('lodash');var util=require(_0x1cab('0x0'));var logger=require(_0x1cab('0x1'))('api');var moment=require(_0x1cab('0x2'));var BPromise=require('bluebird');var rp=require(_0x1cab('0x3'));var fs=require('fs');var path=require(_0x1cab('0x4'));var rimraf=require(_0x1cab('0x5'));var config=require(_0x1cab('0x6'));var attributes=require(_0x1cab('0x7'));module['exports']=function(_0x2a697b,_0x523d32){return _0x2a697b[_0x1cab('0x8')]('WhatsappAccount',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 ea0e86f..8b34bd6 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 _0x26bd=['stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0xcdb5c1,_0xea6ccf){var _0x1e80de=function(_0x437cba){while(--_0x437cba){_0xcdb5c1['push'](_0xcdb5c1['shift']());}};_0x1e80de(++_0xea6ccf);}(_0x26bd,0xaa));var _0xd26b=function(_0x45dd01,_0x1afc0a){_0x45dd01=_0x45dd01-0x0;var _0x25037e=_0x26bd[_0x45dd01];return _0x25037e;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var moment=require(_0xd26b('0x2'));var BPromise=require(_0xd26b('0x3'));var rs=require(_0xd26b('0x4'));var fs=require('fs');var Redis=require(_0xd26b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd26b('0x6'));var logger=require(_0xd26b('0x7'))(_0xd26b('0x8'));var config=require(_0xd26b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd26b('0xa')][_0xd26b('0xb')]({'port':0x232a});config[_0xd26b('0xc')]=_[_0xd26b('0xd')](config['redis'],{'host':_0xd26b('0xe'),'port':0x18eb});var socket=require(_0xd26b('0xf'))(new Redis(config[_0xd26b('0xc')]));require(_0xd26b('0x10'))[_0xd26b('0x11')](socket);function respondWithRpcPromise(_0x1cbf48,_0x5c590d,_0x2cbde7){return new BPromise(function(_0x5b40c6,_0x40ce1c){return client[_0xd26b('0x12')](_0x1cbf48,_0x2cbde7)[_0xd26b('0x13')](function(_0x385735){logger[_0xd26b('0x14')](_0xd26b('0x15'),_0x5c590d,_0xd26b('0x16'));logger[_0xd26b('0x17')](_0xd26b('0x18'),_0x5c590d,'request\x20sent',JSON[_0xd26b('0x19')](_0x385735));if(_0x385735[_0xd26b('0x1a')]){if(_0x385735['error']['code']===0x1f4){logger[_0xd26b('0x1a')](_0xd26b('0x15'),_0x5c590d,_0x385735[_0xd26b('0x1a')][_0xd26b('0x1b')]);return _0x40ce1c(_0x385735[_0xd26b('0x1a')]['message']);}logger[_0xd26b('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x5c590d,_0x385735[_0xd26b('0x1a')][_0xd26b('0x1b')]);return _0x5b40c6(_0x385735[_0xd26b('0x1a')][_0xd26b('0x1b')]);}else{logger['info'](_0xd26b('0x15'),_0x5c590d,_0xd26b('0x16'));_0x5b40c6(_0x385735[_0xd26b('0x1c')][_0xd26b('0x1b')]);}})[_0xd26b('0x1d')](function(_0x24da5d){logger['error'](_0xd26b('0x15'),_0x5c590d,_0x24da5d);_0x40ce1c(_0x24da5d);});});}exports[_0xd26b('0x1e')]=function(_0x1c5eb5){var _0x3a7bfc=this;return new Promise(function(_0x343623,_0x2443b9){return db[_0xd26b('0x1f')][_0xd26b('0x20')]({'raw':_0x1c5eb5['options']?_0x1c5eb5[_0xd26b('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1c5eb5[_0xd26b('0x21')]?_0x1c5eb5[_0xd26b('0x21')][_0xd26b('0x22')]||null:null,'attributes':_0x1c5eb5[_0xd26b('0x21')]?_0x1c5eb5[_0xd26b('0x21')]['attributes']||null:null,'include':_0x1c5eb5['options']?_0x1c5eb5[_0xd26b('0x21')][_0xd26b('0x23')]?_[_0xd26b('0x24')](_0x1c5eb5[_0xd26b('0x21')][_0xd26b('0x23')],function(_0x23c933){return{'model':db[_0x23c933[_0xd26b('0x25')]],'as':_0x23c933['as'],'attributes':_0x23c933[_0xd26b('0x26')],'include':_0x23c933[_0xd26b('0x23')]?_[_0xd26b('0x24')](_0x23c933[_0xd26b('0x23')],function(_0x42a2c0){return{'model':db[_0x42a2c0[_0xd26b('0x25')]],'as':_0x42a2c0['as'],'attributes':_0x42a2c0['attributes'],'include':_0x42a2c0[_0xd26b('0x23')]?_[_0xd26b('0x24')](_0x42a2c0[_0xd26b('0x23')],function(_0x5611d6){return{'model':db[_0x5611d6[_0xd26b('0x25')]],'as':_0x5611d6['as'],'attributes':_0x5611d6[_0xd26b('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20530f){logger['info'](_0xd26b('0x1e'),_0x1c5eb5);logger[_0xd26b('0x17')](_0xd26b('0x1e'),_0x1c5eb5,JSON['stringify'](_0x20530f));_0x343623(_0x20530f);})[_0xd26b('0x1d')](function(_0x19e48c){logger[_0xd26b('0x1a')](_0xd26b('0x1e'),_0x19e48c[_0xd26b('0x1b')],_0x1c5eb5);_0x2443b9(_0x3a7bfc[_0xd26b('0x1a')](0x1f4,_0x19e48c[_0xd26b('0x1b')]));});});}; \ No newline at end of file +var _0x7d34=['then','info','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','WhatsappAccount','find','options','where','attributes','include','map','model','ShowWhatsappAccount','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x253288,_0xcc6c27){var _0x4fe96f=function(_0x32dbc1){while(--_0x32dbc1){_0x253288['push'](_0x253288['shift']());}};_0x4fe96f(++_0xcc6c27);}(_0x7d34,0xe6));var _0x47d3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7d34[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x47d3('0x0'));var moment=require(_0x47d3('0x1'));var BPromise=require(_0x47d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47d3('0x3'));var db=require(_0x47d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47d3('0x5'))('rpc');var config=require(_0x47d3('0x6'));var jayson=require(_0x47d3('0x7'));var client=jayson[_0x47d3('0x8')][_0x47d3('0x9')]({'port':0x232a});config[_0x47d3('0xa')]=_['defaults'](config[_0x47d3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x47d3('0xb'))(new Redis(config[_0x47d3('0xa')]));require(_0x47d3('0xc'))[_0x47d3('0xd')](socket);function respondWithRpcPromise(_0x14310d,_0x3c0db1,_0x22f773){return new BPromise(function(_0x2a9fae,_0x52767e){return client[_0x47d3('0xe')](_0x14310d,_0x22f773)[_0x47d3('0xf')](function(_0x21b4a8){logger[_0x47d3('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3c0db1,_0x47d3('0x11'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c0db1,'request\x20sent',JSON[_0x47d3('0x12')](_0x21b4a8));if(_0x21b4a8[_0x47d3('0x13')]){if(_0x21b4a8[_0x47d3('0x13')][_0x47d3('0x14')]===0x1f4){logger['error'](_0x47d3('0x15'),_0x3c0db1,_0x21b4a8[_0x47d3('0x13')]['message']);return _0x52767e(_0x21b4a8[_0x47d3('0x13')][_0x47d3('0x16')]);}logger[_0x47d3('0x13')](_0x47d3('0x15'),_0x3c0db1,_0x21b4a8[_0x47d3('0x13')][_0x47d3('0x16')]);return _0x2a9fae(_0x21b4a8['error'][_0x47d3('0x16')]);}else{logger[_0x47d3('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3c0db1,_0x47d3('0x11'));_0x2a9fae(_0x21b4a8[_0x47d3('0x17')][_0x47d3('0x16')]);}})['catch'](function(_0x2c3aea){logger[_0x47d3('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x3c0db1,_0x2c3aea);_0x52767e(_0x2c3aea);});});}exports['ShowWhatsappAccount']=function(_0x553ec6){var _0x1cd25f=this;return new Promise(function(_0x3b8fce,_0x4634fd){return db[_0x47d3('0x18')][_0x47d3('0x19')]({'raw':_0x553ec6[_0x47d3('0x1a')]?_0x553ec6[_0x47d3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x553ec6['options']?_0x553ec6[_0x47d3('0x1a')][_0x47d3('0x1b')]||null:null,'attributes':_0x553ec6['options']?_0x553ec6[_0x47d3('0x1a')][_0x47d3('0x1c')]||null:null,'include':_0x553ec6[_0x47d3('0x1a')]?_0x553ec6[_0x47d3('0x1a')][_0x47d3('0x1d')]?_[_0x47d3('0x1e')](_0x553ec6['options']['include'],function(_0x213aa9){return{'model':db[_0x213aa9['model']],'as':_0x213aa9['as'],'attributes':_0x213aa9[_0x47d3('0x1c')],'include':_0x213aa9[_0x47d3('0x1d')]?_[_0x47d3('0x1e')](_0x213aa9[_0x47d3('0x1d')],function(_0x5703ef){return{'model':db[_0x5703ef[_0x47d3('0x1f')]],'as':_0x5703ef['as'],'attributes':_0x5703ef[_0x47d3('0x1c')],'include':_0x5703ef[_0x47d3('0x1d')]?_['map'](_0x5703ef[_0x47d3('0x1d')],function(_0x5905e0){return{'model':db[_0x5905e0[_0x47d3('0x1f')]],'as':_0x5905e0['as'],'attributes':_0x5905e0[_0x47d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x47d3('0xf')](function(_0x14ad89){logger[_0x47d3('0x10')](_0x47d3('0x20'),_0x553ec6);logger[_0x47d3('0x21')](_0x47d3('0x20'),_0x553ec6,JSON[_0x47d3('0x12')](_0x14ad89));_0x3b8fce(_0x14ad89);})[_0x47d3('0x22')](function(_0x1fabf6){logger[_0x47d3('0x13')](_0x47d3('0x20'),_0x1fabf6[_0x47d3('0x16')],_0x553ec6);_0x4634fd(_0x1cd25f[_0x47d3('0x13')](0x1f4,_0x1fabf6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d48e938..34580d9 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 _0xb8e6=['update','length'];(function(_0x411ce6,_0x4b3d2a){var _0x345706=function(_0x35cade){while(--_0x35cade){_0x411ce6['push'](_0x411ce6['shift']());}};_0x345706(++_0x4b3d2a);}(_0xb8e6,0x1b6));var _0x6b8e=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0xb8e6[_0x44d9ab];return _0x31485e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save','remove',_0x6b8e('0x0')];function createListener(_0x11cc90,_0x4ed7b3){return function(_0x3fd274){_0x4ed7b3['emit'](_0x11cc90,_0x3fd274);};}function removeListener(_0x3480fd,_0x4e1394){return function(){WhatsappAccountEvents['removeListener'](_0x3480fd,_0x4e1394);};}exports['register']=function(_0x4af7fe){for(var _0x55b747=0x0,_0x359fff=events[_0x6b8e('0x1')];_0x55b747<_0x359fff;_0x55b747++){var _0x906d5e=events[_0x55b747];var _0x139406=createListener('whatsappAccount:'+_0x906d5e,_0x4af7fe);WhatsappAccountEvents['on'](_0x906d5e,_0x139406);}}; \ No newline at end of file +var _0x5cf2=['length','./whatsappAccount.events','remove','update','emit','removeListener'];(function(_0x32767b,_0x4ac09d){var _0x45f047=function(_0x49dce2){while(--_0x49dce2){_0x32767b['push'](_0x32767b['shift']());}};_0x45f047(++_0x4ac09d);}(_0x5cf2,0x133));var _0x25cf=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x5cf2[_0x2ec461];return _0x28603d;};'use strict';var WhatsappAccountEvents=require(_0x25cf('0x0'));var events=['save',_0x25cf('0x1'),_0x25cf('0x2')];function createListener(_0xac8c81,_0x127819){return function(_0x3e9bc4){_0x127819[_0x25cf('0x3')](_0xac8c81,_0x3e9bc4);};}function removeListener(_0x4c0c17,_0x2c3b9c){return function(){WhatsappAccountEvents[_0x25cf('0x4')](_0x4c0c17,_0x2c3b9c);};}exports['register']=function(_0x4e57d7){for(var _0x14678a=0x0,_0x7b7943=events[_0x25cf('0x5')];_0x14678a<_0x7b7943;_0x14678a++){var _0x2a377a=events[_0x14678a];var _0x13cb97=createListener('whatsappAccount:'+_0x2a377a,_0x4e57d7);WhatsappAccountEvents['on'](_0x2a377a,_0x13cb97);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 04bd4e0..ca3cd1c 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 _0x75d5=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0x75d5,0x149));var _0x575d=function(_0x498e1b,_0x27e8bb){_0x498e1b=_0x498e1b-0x0;var _0x2c1d62=_0x75d5[_0x498e1b];return _0x2c1d62;};'use strict';var multer=require(_0x575d('0x0'));var util=require(_0x575d('0x1'));var path=require('path');var timeout=require(_0x575d('0x2'));var express=require(_0x575d('0x3'));var router=express[_0x575d('0x4')]();var fs_extra=require(_0x575d('0x5'));var auth=require(_0x575d('0x6'));var interaction=require(_0x575d('0x7'));var config=require(_0x575d('0x8'));var controller=require(_0x575d('0x9'));router[_0x575d('0xa')]('/',auth['isAuthenticated'](),controller[_0x575d('0xb')]);router[_0x575d('0xa')](_0x575d('0xc'),auth[_0x575d('0xd')](),controller[_0x575d('0xe')]);router[_0x575d('0xf')]('/',auth[_0x575d('0xd')](),controller[_0x575d('0x10')]);router[_0x575d('0x11')](_0x575d('0xc'),auth[_0x575d('0xd')](),controller[_0x575d('0x12')]);router[_0x575d('0x13')](_0x575d('0xc'),auth['isAuthenticated'](),controller[_0x575d('0x14')]);module[_0x575d('0x15')]=router; \ No newline at end of file +var _0x0a46=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller'];(function(_0x22ca9e,_0x197d6c){var _0x19c927=function(_0x38c5d8){while(--_0x38c5d8){_0x22ca9e['push'](_0x22ca9e['shift']());}};_0x19c927(++_0x197d6c);}(_0x0a46,0xbf));var _0x60a4=function(_0x4a92b9,_0x5f108e){_0x4a92b9=_0x4a92b9-0x0;var _0x4bd487=_0x0a46[_0x4a92b9];return _0x4bd487;};'use strict';var multer=require(_0x60a4('0x0'));var util=require(_0x60a4('0x1'));var path=require('path');var timeout=require(_0x60a4('0x2'));var express=require(_0x60a4('0x3'));var router=express[_0x60a4('0x4')]();var fs_extra=require(_0x60a4('0x5'));var auth=require(_0x60a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x60a4('0x7'));var controller=require(_0x60a4('0x8'));router[_0x60a4('0x9')]('/',auth[_0x60a4('0xa')](),controller[_0x60a4('0xb')]);router[_0x60a4('0x9')](_0x60a4('0xc'),auth[_0x60a4('0xa')](),controller[_0x60a4('0xd')]);router[_0x60a4('0xe')]('/',auth[_0x60a4('0xa')](),controller[_0x60a4('0xf')]);router['put']('/:id',auth[_0x60a4('0xa')](),controller[_0x60a4('0x10')]);router[_0x60a4('0x11')](_0x60a4('0xc'),auth[_0x60a4('0xa')](),controller[_0x60a4('0x12')]);module[_0x60a4('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f6cde49..52bbd28 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 _0x03db=['noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x19e759,_0x4ef25d){var _0x356807=function(_0x39184f){while(--_0x39184f){_0x19e759['push'](_0x19e759['shift']());}};_0x356807(++_0x4ef25d);}(_0x03db,0x116));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb03d('0x0'));module[_0xb03d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb03d('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb03d('0x3')]},'interval':{'type':Sequelize[_0xb03d('0x3')],'defaultValue':_0xb03d('0x4')}}; \ No newline at end of file +var _0xe0d2=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x162b4e,_0x4d9f28){var _0x4f0fed=function(_0x499948){while(--_0x499948){_0x162b4e['push'](_0x162b4e['shift']());}};_0x4f0fed(++_0x4d9f28);}(_0xe0d2,0x164));var _0x2e0d=function(_0x25df01,_0x3f0b06){_0x25df01=_0x25df01-0x0;var _0x5577ff=_0xe0d2[_0x25df01];return _0x5577ff;};'use strict';var Sequelize=require('sequelize');module[_0x2e0d('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2e0d('0x1')],'allowNull':![],'defaultValue':_0x2e0d('0x2')},'appdata':{'type':Sequelize[_0x2e0d('0x3')]()},'description':{'type':Sequelize[_0x2e0d('0x1')]},'interval':{'type':Sequelize[_0x2e0d('0x1')],'defaultValue':_0x2e0d('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 256585e..c1f213c 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 _0xfb67=['catch','show','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','name','WhatsappApplication','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows'];(function(_0xa3b332,_0x5e3799){var _0xf10aad=function(_0x10a184){while(--_0x10a184){_0xa3b332['push'](_0xa3b332['shift']());}};_0xf10aad(++_0x5e3799);}(_0xfb67,0xdd));var _0x7fb6=function(_0x2ad6e1,_0x30fbe0){_0x2ad6e1=_0x2ad6e1-0x0;var _0x2629b5=_0xfb67[_0x2ad6e1];return _0x2629b5;};'use strict';var emlformat=require(_0x7fb6('0x0'));var rimraf=require(_0x7fb6('0x1'));var zipdir=require(_0x7fb6('0x2'));var jsonpatch=require(_0x7fb6('0x3'));var rp=require(_0x7fb6('0x4'));var moment=require(_0x7fb6('0x5'));var BPromise=require(_0x7fb6('0x6'));var Mustache=require('mustache');var util=require(_0x7fb6('0x7'));var path=require(_0x7fb6('0x8'));var sox=require(_0x7fb6('0x9'));var csv=require(_0x7fb6('0xa'));var ejs=require(_0x7fb6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fb6('0xc'));var squel=require(_0x7fb6('0xd'));var crypto=require(_0x7fb6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fb6('0xf'));var toCsv=require(_0x7fb6('0xa'));var querystring=require('querystring');var Papa=require(_0x7fb6('0x10'));var Redis=require(_0x7fb6('0x11'));var authService=require(_0x7fb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fb6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb6('0x14'))(_0x7fb6('0x15'));var utils=require(_0x7fb6('0x16'));var config=require(_0x7fb6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fb6('0x18'))['db'];function respondWithStatusCode(_0x1b6ac7,_0x3c594f){_0x3c594f=_0x3c594f||0xcc;return function(_0x549370){if(_0x549370){return _0x1b6ac7['sendStatus'](_0x3c594f);}return _0x1b6ac7['status'](_0x3c594f)['end']();};}function respondWithResult(_0x4fe18e,_0x59287e){_0x59287e=_0x59287e||0xc8;return function(_0x2e8b7c){if(_0x2e8b7c){return _0x4fe18e[_0x7fb6('0x19')](_0x59287e)['json'](_0x2e8b7c);}};}function respondWithFilteredResult(_0x196700,_0x3e4441){return function(_0x5046e2){if(_0x5046e2){var _0xb4c375=typeof _0x3e4441[_0x7fb6('0x1a')]===_0x7fb6('0x1b')&&typeof _0x3e4441[_0x7fb6('0x1c')]===_0x7fb6('0x1b');var _0x26c3ec=_0x5046e2[_0x7fb6('0x1d')];var _0x3ef701=_0xb4c375?0x0:_0x3e4441[_0x7fb6('0x1a')];var _0x5de506=_0xb4c375?_0x5046e2[_0x7fb6('0x1d')]:_0x3e4441[_0x7fb6('0x1a')]+_0x3e4441[_0x7fb6('0x1c')];var _0x169389;if(_0x5de506>=_0x26c3ec){_0x5de506=_0x26c3ec;_0x169389=0xc8;}else{_0x169389=0xce;}_0x196700[_0x7fb6('0x19')](_0x169389);return _0x196700[_0x7fb6('0x1e')](_0x7fb6('0x1f'),_0x3ef701+'-'+_0x5de506+'/'+_0x26c3ec)['json'](_0x5046e2);}return null;};}function patchUpdates(_0x5e6997){return function(_0x1fa63a){try{jsonpatch[_0x7fb6('0x20')](_0x1fa63a,_0x5e6997,!![]);}catch(_0x293c9d){return BPromise[_0x7fb6('0x21')](_0x293c9d);}return _0x1fa63a['save']();};}function saveUpdates(_0xc44cf5,_0x13ad95){return function(_0x490749){if(_0x490749){return _0x490749[_0x7fb6('0x22')](_0xc44cf5)['then'](function(_0x488cd2){return _0x488cd2;});}return null;};}function removeEntity(_0x34a4d1,_0x4b15e5){return function(_0x51ed55){if(_0x51ed55){return _0x51ed55['destroy']()[_0x7fb6('0x23')](function(){_0x34a4d1['status'](0xcc)[_0x7fb6('0x24')]();});}};}function handleEntityNotFound(_0x4a9866,_0x3566a1){return function(_0xc60290){if(!_0xc60290){_0x4a9866[_0x7fb6('0x25')](0x194);}return _0xc60290;};}function handleError(_0x260e8b,_0x253f23){_0x253f23=_0x253f23||0x1f4;return function(_0x4c9b90){logger[_0x7fb6('0x26')](_0x4c9b90['stack']);if(_0x4c9b90[_0x7fb6('0x27')]){delete _0x4c9b90[_0x7fb6('0x27')];}_0x260e8b['status'](_0x253f23)['send'](_0x4c9b90);};}exports['index']=function(_0x25216a,_0x440a04){var _0x35e18f={},_0x3bf606={},_0x7f3844={'count':0x0,'rows':[]};var _0x2bc3b9=_['map'](db[_0x7fb6('0x28')]['rawAttributes'],function(_0x4221c3){return{'name':_0x4221c3[_0x7fb6('0x29')],'type':_0x4221c3[_0x7fb6('0x2a')][_0x7fb6('0x2b')]};});_0x3bf606[_0x7fb6('0x2c')]=_[_0x7fb6('0x2d')](_0x2bc3b9,_0x7fb6('0x27'));_0x3bf606[_0x7fb6('0x2e')]=_[_0x7fb6('0x2f')](_0x25216a['query']);_0x3bf606[_0x7fb6('0x30')]=_[_0x7fb6('0x31')](_0x3bf606[_0x7fb6('0x2c')],_0x3bf606[_0x7fb6('0x2e')]);_0x35e18f[_0x7fb6('0x32')]=_[_0x7fb6('0x31')](_0x3bf606[_0x7fb6('0x2c')],qs[_0x7fb6('0x33')](_0x25216a[_0x7fb6('0x2e')]['fields']));_0x35e18f[_0x7fb6('0x32')]=_0x35e18f[_0x7fb6('0x32')][_0x7fb6('0x34')]?_0x35e18f[_0x7fb6('0x32')]:_0x3bf606['model'];if(!_0x25216a['query'][_0x7fb6('0x35')](_0x7fb6('0x36'))){_0x35e18f[_0x7fb6('0x1c')]=qs[_0x7fb6('0x1c')](_0x25216a[_0x7fb6('0x2e')]['limit']);_0x35e18f[_0x7fb6('0x1a')]=qs[_0x7fb6('0x1a')](_0x25216a[_0x7fb6('0x2e')][_0x7fb6('0x1a')]);}_0x35e18f['order']=qs[_0x7fb6('0x37')](_0x25216a[_0x7fb6('0x2e')]['sort']);_0x35e18f[_0x7fb6('0x38')]=qs['filters'](_[_0x7fb6('0x39')](_0x25216a['query'],_0x3bf606[_0x7fb6('0x30')]),_0x2bc3b9);if(_0x25216a['query'][_0x7fb6('0x3a')]){_0x35e18f[_0x7fb6('0x38')]=_[_0x7fb6('0x3b')](_0x35e18f[_0x7fb6('0x38')],{'$or':_[_0x7fb6('0x2d')](_0x2bc3b9,function(_0x39edfe){if(_0x39edfe['type']!=='VIRTUAL'){var _0x5d237={};_0x5d237[_0x39edfe[_0x7fb6('0x27')]]={'$like':'%'+_0x25216a[_0x7fb6('0x2e')][_0x7fb6('0x3a')]+'%'};return _0x5d237;}})});}_0x35e18f=_['merge']({},_0x35e18f,_0x25216a['options']);var _0x213e6a={'where':_0x35e18f['where']};return db[_0x7fb6('0x28')][_0x7fb6('0x1d')](_0x213e6a)[_0x7fb6('0x23')](function(_0x33828c){_0x7f3844[_0x7fb6('0x1d')]=_0x33828c;if(_0x25216a[_0x7fb6('0x2e')][_0x7fb6('0x3c')]){_0x35e18f[_0x7fb6('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x35e18f);})[_0x7fb6('0x23')](function(_0x543de3){_0x7f3844[_0x7fb6('0x3e')]=_0x543de3;return _0x7f3844;})[_0x7fb6('0x23')](respondWithFilteredResult(_0x440a04,_0x35e18f))[_0x7fb6('0x3f')](handleError(_0x440a04,null));};exports[_0x7fb6('0x40')]=function(_0x6fa286,_0x3b77ba){var _0x1dbfb8={'raw':!![],'where':{'id':_0x6fa286['params']['id']}},_0x661d04={};_0x661d04['model']=_[_0x7fb6('0x2f')](db['WhatsappApplication'][_0x7fb6('0x41')]);_0x661d04['query']=_[_0x7fb6('0x2f')](_0x6fa286[_0x7fb6('0x2e')]);_0x661d04['filters']=_[_0x7fb6('0x31')](_0x661d04[_0x7fb6('0x2c')],_0x661d04[_0x7fb6('0x2e')]);_0x1dbfb8[_0x7fb6('0x32')]=_[_0x7fb6('0x31')](_0x661d04[_0x7fb6('0x2c')],qs[_0x7fb6('0x33')](_0x6fa286[_0x7fb6('0x2e')][_0x7fb6('0x33')]));_0x1dbfb8['attributes']=_0x1dbfb8[_0x7fb6('0x32')]['length']?_0x1dbfb8[_0x7fb6('0x32')]:_0x661d04[_0x7fb6('0x2c')];if(_0x6fa286['query'][_0x7fb6('0x3c')]){_0x1dbfb8[_0x7fb6('0x3d')]=[{'all':!![]}];}_0x1dbfb8=_[_0x7fb6('0x3b')]({},_0x1dbfb8,_0x6fa286['options']);return db[_0x7fb6('0x28')][_0x7fb6('0x42')](_0x1dbfb8)[_0x7fb6('0x23')](handleEntityNotFound(_0x3b77ba,null))[_0x7fb6('0x23')](respondWithResult(_0x3b77ba,null))[_0x7fb6('0x3f')](handleError(_0x3b77ba,null));};exports[_0x7fb6('0x43')]=function(_0x363564,_0x4eac42){return db[_0x7fb6('0x28')][_0x7fb6('0x43')](_0x363564['body'],{})[_0x7fb6('0x23')](respondWithResult(_0x4eac42,0xc9))['catch'](handleError(_0x4eac42,null));};exports[_0x7fb6('0x22')]=function(_0x597eac,_0x2fb8f0){if(_0x597eac['body']['id']){delete _0x597eac[_0x7fb6('0x44')]['id'];}return db[_0x7fb6('0x28')]['find']({'where':{'id':_0x597eac[_0x7fb6('0x45')]['id']}})[_0x7fb6('0x23')](handleEntityNotFound(_0x2fb8f0,null))[_0x7fb6('0x23')](saveUpdates(_0x597eac[_0x7fb6('0x44')],null))[_0x7fb6('0x23')](respondWithResult(_0x2fb8f0,null))[_0x7fb6('0x3f')](handleError(_0x2fb8f0,null));};exports[_0x7fb6('0x46')]=function(_0x164bfd,_0x14993f){return db[_0x7fb6('0x28')][_0x7fb6('0x42')]({'where':{'id':_0x164bfd[_0x7fb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x14993f,null))['then'](removeEntity(_0x14993f,null))[_0x7fb6('0x3f')](handleError(_0x14993f,null));}; \ No newline at end of file +var _0xb114=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb114,0x11f));var _0x4b11=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb114[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x4b11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b11('0x1'));var jsonpatch=require(_0x4b11('0x2'));var rp=require('request-promise');var moment=require(_0x4b11('0x3'));var BPromise=require(_0x4b11('0x4'));var Mustache=require(_0x4b11('0x5'));var util=require(_0x4b11('0x6'));var path=require(_0x4b11('0x7'));var sox=require(_0x4b11('0x8'));var csv=require('to-csv');var ejs=require(_0x4b11('0x9'));var fs=require('fs');var fs_extra=require(_0x4b11('0xa'));var _=require(_0x4b11('0xb'));var squel=require(_0x4b11('0xc'));var crypto=require(_0x4b11('0xd'));var jsforce=require(_0x4b11('0xe'));var deskjs=require(_0x4b11('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4b11('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b11('0x11'));var authService=require(_0x4b11('0x12'));var qs=require(_0x4b11('0x13'));var as=require(_0x4b11('0x14'));var hardwareService=require(_0x4b11('0x15'));var logger=require(_0x4b11('0x16'))('api');var utils=require(_0x4b11('0x17'));var config=require(_0x4b11('0x18'));var licenseUtil=require(_0x4b11('0x19'));var db=require(_0x4b11('0x1a'))['db'];function respondWithStatusCode(_0x5f1c08,_0x53d05e){_0x53d05e=_0x53d05e||0xcc;return function(_0x1782f8){if(_0x1782f8){return _0x5f1c08[_0x4b11('0x1b')](_0x53d05e);}return _0x5f1c08[_0x4b11('0x1c')](_0x53d05e)[_0x4b11('0x1d')]();};}function respondWithResult(_0x3119d8,_0x46ca74){_0x46ca74=_0x46ca74||0xc8;return function(_0x3f8523){if(_0x3f8523){return _0x3119d8[_0x4b11('0x1c')](_0x46ca74)['json'](_0x3f8523);}};}function respondWithFilteredResult(_0x50e9d4,_0x287df3){return function(_0x26c3e2){if(_0x26c3e2){var _0x3910c7=typeof _0x287df3['offset']==='undefined'&&typeof _0x287df3['limit']===_0x4b11('0x1e');var _0x4a573f=_0x26c3e2[_0x4b11('0x1f')];var _0xf14a7f=_0x3910c7?0x0:_0x287df3[_0x4b11('0x20')];var _0x2db145=_0x3910c7?_0x26c3e2[_0x4b11('0x1f')]:_0x287df3[_0x4b11('0x20')]+_0x287df3[_0x4b11('0x21')];var _0x2f2f6b;if(_0x2db145>=_0x4a573f){_0x2db145=_0x4a573f;_0x2f2f6b=0xc8;}else{_0x2f2f6b=0xce;}_0x50e9d4['status'](_0x2f2f6b);return _0x50e9d4[_0x4b11('0x22')](_0x4b11('0x23'),_0xf14a7f+'-'+_0x2db145+'/'+_0x4a573f)[_0x4b11('0x24')](_0x26c3e2);}return null;};}function patchUpdates(_0x55e18e){return function(_0x30c80f){try{jsonpatch['apply'](_0x30c80f,_0x55e18e,!![]);}catch(_0x32021a){return BPromise[_0x4b11('0x25')](_0x32021a);}return _0x30c80f[_0x4b11('0x26')]();};}function saveUpdates(_0x12a7cc,_0x113a1e){return function(_0x28b219){if(_0x28b219){return _0x28b219[_0x4b11('0x27')](_0x12a7cc)[_0x4b11('0x28')](function(_0x34aeae){return _0x34aeae;});}return null;};}function removeEntity(_0x398b12,_0x3e9a73){return function(_0x49a69c){if(_0x49a69c){return _0x49a69c[_0x4b11('0x29')]()['then'](function(){_0x398b12[_0x4b11('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x479e85,_0x32bc7e){return function(_0x3c0a9c){if(!_0x3c0a9c){_0x479e85[_0x4b11('0x1b')](0x194);}return _0x3c0a9c;};}function handleError(_0x347d32,_0x2abb0b){_0x2abb0b=_0x2abb0b||0x1f4;return function(_0x5b904a){logger[_0x4b11('0x2a')](_0x5b904a[_0x4b11('0x2b')]);if(_0x5b904a[_0x4b11('0x2c')]){delete _0x5b904a[_0x4b11('0x2c')];}_0x347d32[_0x4b11('0x1c')](_0x2abb0b)[_0x4b11('0x2d')](_0x5b904a);};}exports[_0x4b11('0x2e')]=function(_0xc3c5d0,_0x5897ea){var _0x22948f={},_0x15d27d={},_0x4ff92d={'count':0x0,'rows':[]};var _0x25e87f=_[_0x4b11('0x2f')](db[_0x4b11('0x30')][_0x4b11('0x31')],function(_0x3a0d9e){return{'name':_0x3a0d9e[_0x4b11('0x32')],'type':_0x3a0d9e[_0x4b11('0x33')]['key']};});_0x15d27d[_0x4b11('0x34')]=_[_0x4b11('0x2f')](_0x25e87f,_0x4b11('0x2c'));_0x15d27d['query']=_[_0x4b11('0x35')](_0xc3c5d0[_0x4b11('0x36')]);_0x15d27d[_0x4b11('0x37')]=_[_0x4b11('0x38')](_0x15d27d[_0x4b11('0x34')],_0x15d27d[_0x4b11('0x36')]);_0x22948f['attributes']=_['intersection'](_0x15d27d[_0x4b11('0x34')],qs[_0x4b11('0x39')](_0xc3c5d0[_0x4b11('0x36')][_0x4b11('0x39')]));_0x22948f[_0x4b11('0x3a')]=_0x22948f[_0x4b11('0x3a')][_0x4b11('0x3b')]?_0x22948f['attributes']:_0x15d27d[_0x4b11('0x34')];if(!_0xc3c5d0[_0x4b11('0x36')][_0x4b11('0x3c')](_0x4b11('0x3d'))){_0x22948f[_0x4b11('0x21')]=qs['limit'](_0xc3c5d0['query'][_0x4b11('0x21')]);_0x22948f[_0x4b11('0x20')]=qs[_0x4b11('0x20')](_0xc3c5d0[_0x4b11('0x36')]['offset']);}_0x22948f['order']=qs['sort'](_0xc3c5d0[_0x4b11('0x36')][_0x4b11('0x3e')]);_0x22948f['where']=qs[_0x4b11('0x37')](_['pick'](_0xc3c5d0[_0x4b11('0x36')],_0x15d27d[_0x4b11('0x37')]),_0x25e87f);if(_0xc3c5d0[_0x4b11('0x36')][_0x4b11('0x3f')]){_0x22948f[_0x4b11('0x40')]=_[_0x4b11('0x41')](_0x22948f[_0x4b11('0x40')],{'$or':_[_0x4b11('0x2f')](_0x25e87f,function(_0x3847f3){if(_0x3847f3[_0x4b11('0x33')]!=='VIRTUAL'){var _0x4fbce5={};_0x4fbce5[_0x3847f3[_0x4b11('0x2c')]]={'$like':'%'+_0xc3c5d0[_0x4b11('0x36')][_0x4b11('0x3f')]+'%'};return _0x4fbce5;}})});}_0x22948f=_[_0x4b11('0x41')]({},_0x22948f,_0xc3c5d0[_0x4b11('0x42')]);var _0x1477cb={'where':_0x22948f[_0x4b11('0x40')]};return db[_0x4b11('0x30')][_0x4b11('0x1f')](_0x1477cb)[_0x4b11('0x28')](function(_0x554866){_0x4ff92d['count']=_0x554866;if(_0xc3c5d0['query'][_0x4b11('0x43')]){_0x22948f[_0x4b11('0x44')]=[{'all':!![]}];}return db[_0x4b11('0x30')][_0x4b11('0x45')](_0x22948f);})[_0x4b11('0x28')](function(_0x2884f1){_0x4ff92d[_0x4b11('0x46')]=_0x2884f1;return _0x4ff92d;})[_0x4b11('0x28')](respondWithFilteredResult(_0x5897ea,_0x22948f))[_0x4b11('0x47')](handleError(_0x5897ea,null));};exports[_0x4b11('0x48')]=function(_0x489080,_0x1786e1){var _0xfd58a7={'raw':!![],'where':{'id':_0x489080[_0x4b11('0x49')]['id']}},_0x58e4ba={};_0x58e4ba[_0x4b11('0x34')]=_[_0x4b11('0x35')](db[_0x4b11('0x30')]['rawAttributes']);_0x58e4ba[_0x4b11('0x36')]=_[_0x4b11('0x35')](_0x489080['query']);_0x58e4ba[_0x4b11('0x37')]=_[_0x4b11('0x38')](_0x58e4ba['model'],_0x58e4ba[_0x4b11('0x36')]);_0xfd58a7[_0x4b11('0x3a')]=_[_0x4b11('0x38')](_0x58e4ba['model'],qs[_0x4b11('0x39')](_0x489080[_0x4b11('0x36')]['fields']));_0xfd58a7[_0x4b11('0x3a')]=_0xfd58a7[_0x4b11('0x3a')][_0x4b11('0x3b')]?_0xfd58a7[_0x4b11('0x3a')]:_0x58e4ba[_0x4b11('0x34')];if(_0x489080[_0x4b11('0x36')][_0x4b11('0x43')]){_0xfd58a7['include']=[{'all':!![]}];}_0xfd58a7=_['merge']({},_0xfd58a7,_0x489080[_0x4b11('0x42')]);return db[_0x4b11('0x30')][_0x4b11('0x4a')](_0xfd58a7)[_0x4b11('0x28')](handleEntityNotFound(_0x1786e1,null))[_0x4b11('0x28')](respondWithResult(_0x1786e1,null))[_0x4b11('0x47')](handleError(_0x1786e1,null));};exports['create']=function(_0x2222f0,_0x5dd014){return db[_0x4b11('0x30')][_0x4b11('0x4b')](_0x2222f0[_0x4b11('0x4c')],{})[_0x4b11('0x28')](respondWithResult(_0x5dd014,0xc9))[_0x4b11('0x47')](handleError(_0x5dd014,null));};exports[_0x4b11('0x27')]=function(_0x1f0949,_0x42a3d6){if(_0x1f0949[_0x4b11('0x4c')]['id']){delete _0x1f0949[_0x4b11('0x4c')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x1f0949[_0x4b11('0x49')]['id']}})[_0x4b11('0x28')](handleEntityNotFound(_0x42a3d6,null))[_0x4b11('0x28')](saveUpdates(_0x1f0949[_0x4b11('0x4c')],null))[_0x4b11('0x28')](respondWithResult(_0x42a3d6,null))[_0x4b11('0x47')](handleError(_0x42a3d6,null));};exports['destroy']=function(_0x56297d,_0x5b1ca6){return db[_0x4b11('0x30')][_0x4b11('0x4a')]({'where':{'id':_0x56297d['params']['id']}})[_0x4b11('0x28')](handleEntityNotFound(_0x5b1ca6,null))[_0x4b11('0x28')](removeEntity(_0x5b1ca6,null))['catch'](handleError(_0x5b1ca6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b00ad1f..43903d8 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 _0x6c32=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var logger=require(_0x26c3('0x1'))('api');var moment=require(_0x26c3('0x2'));var BPromise=require('bluebird');var rp=require(_0x26c3('0x3'));var fs=require('fs');var path=require(_0x26c3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26c3('0x5'));module[_0x26c3('0x6')]=function(_0x421941,_0x402393){return _0x421941[_0x26c3('0x7')](_0x26c3('0x8'),attributes,{'tableName':_0x26c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x26c3('0xa'),'collate':_0x26c3('0xb')});}; \ No newline at end of file +var _0xc43c=['rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xc43c,0x152));var _0xcc43=function(_0x1ee5a9,_0x2ae8eb){_0x1ee5a9=_0x1ee5a9-0x0;var _0x2ab626=_0xc43c[_0x1ee5a9];return _0x2ab626;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var logger=require(_0xcc43('0x2'))(_0xcc43('0x3'));var moment=require(_0xcc43('0x4'));var BPromise=require(_0xcc43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc43('0x6'));var rimraf=require(_0xcc43('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc43('0x8'));module[_0xcc43('0x9')]=function(_0x217a5e,_0x17d1a2){return _0x217a5e[_0xcc43('0xa')](_0xcc43('0xb'),attributes,{'tableName':_0xcc43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc43('0xd'),'collate':_0xcc43('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 707a9b4..3abaeb4 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 _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x38da29,_0x50dc9a){var _0x4a32b1=function(_0x3c50c3){while(--_0x3c50c3){_0x38da29['push'](_0x38da29['shift']());}};_0x4a32b1(++_0x50dc9a);}(_0x5fd1,0x155));var _0x15fd=function(_0x107d3a,_0x3ca698){_0x107d3a=_0x107d3a-0x0;var _0x10b64e=_0x5fd1[_0x107d3a];return _0x10b64e;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','util'];(function(_0x5af089,_0x524923){var _0x38f5bc=function(_0x35b57a){while(--_0x35b57a){_0x5af089['push'](_0x5af089['shift']());}};_0x38f5bc(++_0x524923);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a9130,_0x1a32f3){_0x5a9130=_0x5a9130-0x0;var _0x53580d=_0xedd9[_0x5a9130];return _0x53580d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d356e52..cbbcb4e 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 _0xaf1b=['tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags'];(function(_0x1aa71b,_0x39a178){var _0x50c2b7=function(_0x487c17){while(--_0x487c17){_0x1aa71b['push'](_0x1aa71b['shift']());}};_0x50c2b7(++_0x39a178);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x45e8c7,_0x460776){_0x45e8c7=_0x45e8c7-0x0;var _0x2a934f=_0xaf1b[_0x45e8c7];return _0x2a934f;};'use strict';var multer=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var path=require(_0xbaf1('0x2'));var timeout=require(_0xbaf1('0x3'));var express=require(_0xbaf1('0x4'));var router=express[_0xbaf1('0x5')]();var fs_extra=require(_0xbaf1('0x6'));var auth=require(_0xbaf1('0x7'));var interaction=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var controller=require(_0xbaf1('0xa'));router[_0xbaf1('0xb')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0xd')]);router['get'](_0xbaf1('0xe'),auth['isAuthenticated'](),controller[_0xbaf1('0xf')]);router['get'](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x11')]);router['get'](_0xbaf1('0x12'),auth[_0xbaf1('0xc')](),controller['getMessages']);router[_0xbaf1('0xb')]('/:id/download',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x13')]);router[_0xbaf1('0x14')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x15')]);router[_0xbaf1('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbaf1('0x16')]);router[_0xbaf1('0x14')](_0xbaf1('0x17'),auth[_0xbaf1('0xc')](),interaction[_0xbaf1('0x18')](_0xbaf1('0x19'),_0xbaf1('0x1a')),controller['addTags']);router[_0xbaf1('0x1b')](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),interaction[_0xbaf1('0x18')](_0xbaf1('0x19'),_0xbaf1('0x1c')),controller[_0xbaf1('0x1d')]);router[_0xbaf1('0x1e')]('/:id',auth[_0xbaf1('0xc')](),interaction['tracked'](_0xbaf1('0x19'),_0xbaf1('0x1f')),controller[_0xbaf1('0x20')]);router[_0xbaf1('0x1e')]('/:id/tags',auth[_0xbaf1('0xc')](),controller['removeTags']);module[_0xbaf1('0x21')]=router; \ No newline at end of file +var _0x3831=['whatsappinteraction:destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete'];(function(_0x8b2f2c,_0x5c3fa9){var _0x3ce00d=function(_0x47d820){while(--_0x47d820){_0x8b2f2c['push'](_0x8b2f2c['shift']());}};_0x3ce00d(++_0x5c3fa9);}(_0x3831,0x14c));var _0x1383=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x3831[_0x1c3b41];return _0x41e3fe;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0x8')](_0x1383('0xd'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0x8')](_0x1383('0xf'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);router['post']('/',auth[_0x1383('0x9')](),controller[_0x1383('0x11')]);router[_0x1383('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1383('0x13')]);router[_0x1383('0x12')](_0x1383('0x14'),auth[_0x1383('0x9')](),interaction[_0x1383('0x15')](_0x1383('0x16'),_0x1383('0x17')),controller[_0x1383('0x18')]);router['put'](_0x1383('0xb'),auth[_0x1383('0x9')](),interaction[_0x1383('0x15')](_0x1383('0x16'),_0x1383('0x19')),controller[_0x1383('0x1a')]);router[_0x1383('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0x1383('0x15')]('whatsapp',_0x1383('0x1c')),controller['destroy']);router['delete']('/:id/tags',auth[_0x1383('0x9')](),controller['removeTags']);module[_0x1383('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 16bdb24..2f8a3e9 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 _0x6d11=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x1709fa,_0x41c9c7){var _0x3bd583=function(_0x276652){while(--_0x276652){_0x1709fa['push'](_0x1709fa['shift']());}};_0x3bd583(++_0x41c9c7);}(_0x6d11,0xbf));var _0x16d1=function(_0x2e7266,_0x4340ee){_0x2e7266=_0x2e7266-0x0;var _0x5d0cc7=_0x6d11[_0x2e7266];return _0x5d0cc7;};'use strict';var Sequelize=require(_0x16d1('0x0'));var moment=require(_0x16d1('0x1'));module[_0x16d1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x16d1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x16d1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x16d1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x16d1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x16d1('0x5')]('in',_0x16d1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x16d1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x16d1('0x5')]('in',_0x16d1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x16d1('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfaf2=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfaf2,0x169));var _0x2faf=function(_0x4a4b2f,_0x15a25a){_0x4a4b2f=_0x4a4b2f-0x0;var _0x43fb3f=_0xfaf2[_0x4a4b2f];return _0x43fb3f;};'use strict';var Sequelize=require(_0x2faf('0x0'));var moment=require(_0x2faf('0x1'));module[_0x2faf('0x2')]={'closed':{'type':Sequelize[_0x2faf('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2faf('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2faf('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2faf('0x5')]},'note':{'type':Sequelize[_0x2faf('0x5')]},'phone':{'type':Sequelize[_0x2faf('0x5')]},'read1stAt':{'type':Sequelize[_0x2faf('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2faf('0x6')]('in',_0x2faf('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2faf('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2faf('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 12ffe6a..422b213 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 _0x867d=['rawAttributes','filters','intersection','length','include','merge','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','attributes','fields','hasOwnProperty','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','omit','spread','Tag','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','Messages','existsSync','createReadStream','pipe','createWriteStream','out','System','value','views','downloadInteraction.ejs','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','json','destroy','then','error','name','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','model','keys'];(function(_0x594c5c,_0x55e42e){var _0xfd162e=function(_0x60ec46){while(--_0x60ec46){_0x594c5c['push'](_0x594c5c['shift']());}};_0xfd162e(++_0x55e42e);}(_0x867d,0x13d));var _0xd867=function(_0x454219,_0xe71f95){_0x454219=_0x454219-0x0;var _0x5a16b0=_0x867d[_0x454219];return _0x5a16b0;};'use strict';var rimraf=require(_0xd867('0x0'));var zipdir=require(_0xd867('0x1'));var moment=require(_0xd867('0x2'));var BPromise=require(_0xd867('0x3'));var util=require(_0xd867('0x4'));var path=require('path');var ejs=require(_0xd867('0x5'));var fs=require('fs');var _=require(_0xd867('0x6'));var Redis=require(_0xd867('0x7'));var interaction=require(_0xd867('0x8'));var qs=require(_0xd867('0x9'));var pdf=require(_0xd867('0xa'));var logger=require(_0xd867('0xb'))('api');var config=require(_0xd867('0xc'));var db=require('../../mysqldb')['db'];config[_0xd867('0xd')]=_[_0xd867('0xe')](config[_0xd867('0xd')],{'host':_0xd867('0xf'),'port':0x18eb});var socket=require(_0xd867('0x10'))(new Redis(config['redis']));require(_0xd867('0x11'))[_0xd867('0x12')](socket);function respondWithStatusCode(_0x405fb0,_0x5207fc){_0x5207fc=_0x5207fc||0xcc;return function(_0x50f1ae){if(_0x50f1ae){return _0x405fb0[_0xd867('0x13')](_0x5207fc);}return _0x405fb0['status'](_0x5207fc)[_0xd867('0x14')]();};}function respondWithResult(_0xfab6be,_0x56a13d){_0x56a13d=_0x56a13d||0xc8;return function(_0x25f237){if(_0x25f237){return _0xfab6be[_0xd867('0x15')](_0x56a13d)['json'](_0x25f237);}};}function respondWithFilteredResult(_0x267764,_0x2692b6){return function(_0x274e05){if(_0x274e05){var _0x44f6cd=typeof _0x2692b6[_0xd867('0x16')]===_0xd867('0x17')&&typeof _0x2692b6['limit']===_0xd867('0x17');var _0x52750e=_0x274e05[_0xd867('0x18')];var _0x34bf10=_0x44f6cd?0x0:_0x2692b6[_0xd867('0x16')];var _0x31b60c=_0x44f6cd?_0x274e05[_0xd867('0x18')]:_0x2692b6['offset']+_0x2692b6[_0xd867('0x19')];var _0xf43654;if(_0x31b60c>=_0x52750e){_0x31b60c=_0x52750e;_0xf43654=0xc8;}else{_0xf43654=0xce;}_0x267764[_0xd867('0x15')](_0xf43654);return _0x267764[_0xd867('0x1a')]('Content-Range',_0x34bf10+'-'+_0x31b60c+'/'+_0x52750e)[_0xd867('0x1b')](_0x274e05);}return null;};}function saveUpdates(_0x1d7694){return function(_0x59f213){if(_0x59f213){return _0x59f213['update'](_0x1d7694)['then'](function(_0x3ebc0e){return _0x3ebc0e;});}return null;};}function removeEntity(_0x5c314c){return function(_0x5ec69e){if(_0x5ec69e){return _0x5ec69e[_0xd867('0x1c')]()[_0xd867('0x1d')](function(){_0x5c314c[_0xd867('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b9ad){return function(_0x286bb2){if(!_0x286bb2){_0x58b9ad[_0xd867('0x13')](0x194);}return _0x286bb2;};}function handleError(_0x395af2,_0x3d4a08){_0x3d4a08=_0x3d4a08||0x1f4;return function(_0x31a4e9){logger[_0xd867('0x1e')](_0x31a4e9['stack']);if(_0x31a4e9[_0xd867('0x1f')]){delete _0x31a4e9[_0xd867('0x1f')];}_0x395af2['status'](_0x3d4a08)['send'](_0x31a4e9);};}exports[_0xd867('0x20')]=function(_0x5173dd,_0x136f49){var _0x379612={};var _0x3d10db=_[_0xd867('0x21')](db[_0xd867('0x22')]['rawAttributes'],function(_0x53d9f6){return{'name':_0x53d9f6[_0xd867('0x23')],'type':_0x53d9f6[_0xd867('0x24')][_0xd867('0x25')]};});_0x379612=qs[_0xd867('0x26')](_0x3d10db,_0x5173dd);return interaction[_0xd867('0x27')]('whatsapp',_0x5173dd[_0xd867('0x28')],_0x5173dd[_0xd867('0x29')],_0x379612,_0x3d10db)[_0xd867('0x1d')](respondWithFilteredResult(_0x136f49,_0x379612))[_0xd867('0x2a')](handleError(_0x136f49,null));};exports[_0xd867('0x2b')]=function(_0x238152,_0x4f93e9){var _0xd40d66={'raw':![],'where':{'id':_0x238152['params']['id']}},_0x560315={};_0x560315[_0xd867('0x2c')]=_[_0xd867('0x2d')](db[_0xd867('0x22')][_0xd867('0x2e')]);_0x560315[_0xd867('0x28')]=_[_0xd867('0x2d')](_0x238152['query']);_0x560315[_0xd867('0x2f')]=_[_0xd867('0x30')](_0x560315[_0xd867('0x2c')],_0x560315['query']);_0xd40d66['attributes']=_[_0xd867('0x30')](_0x560315[_0xd867('0x2c')],qs['fields'](_0x238152[_0xd867('0x28')]['fields']));_0xd40d66['attributes']=_0xd40d66['attributes'][_0xd867('0x31')]?_0xd40d66['attributes']:_0x560315['model'];if(_0x238152['query']['includeAll']){_0xd40d66[_0xd867('0x32')]=[{'all':!![]}];}_0xd40d66=_[_0xd867('0x33')]({},_0xd40d66,_0x238152[_0xd867('0x34')]);return db[_0xd867('0x22')][_0xd867('0x35')](_0xd40d66)['then'](handleEntityNotFound(_0x4f93e9,null))[_0xd867('0x1d')](respondWithResult(_0x4f93e9,null))[_0xd867('0x2a')](handleError(_0x4f93e9,null));};exports[_0xd867('0x36')]=function(_0x424f07,_0x36c249){return db[_0xd867('0x22')][_0xd867('0x36')](_0x424f07[_0xd867('0x37')],{})[_0xd867('0x1d')](respondWithResult(_0x36c249,0xc9))[_0xd867('0x2a')](handleError(_0x36c249,null));};exports['update']=function(_0x47aae7,_0x2e1e62){if(_0x47aae7[_0xd867('0x37')]['id']){delete _0x47aae7[_0xd867('0x37')]['id'];}return db[_0xd867('0x22')][_0xd867('0x35')]({'where':{'id':_0x47aae7[_0xd867('0x38')]['id']}})[_0xd867('0x1d')](handleEntityNotFound(_0x2e1e62,null))[_0xd867('0x1d')](saveUpdates(_0x47aae7['body'],null))[_0xd867('0x1d')](respondWithResult(_0x2e1e62,null))['catch'](handleError(_0x2e1e62,null));};exports[_0xd867('0x1c')]=function(_0x1828e1,_0x3d4001){return db[_0xd867('0x22')]['find']({'where':{'id':_0x1828e1['params']['id']}})[_0xd867('0x1d')](handleEntityNotFound(_0x3d4001,null))[_0xd867('0x1d')](removeEntity(_0x3d4001,null))[_0xd867('0x2a')](handleError(_0x3d4001,null));};exports[_0xd867('0x39')]=function(_0x272a41,_0x23e92f){return db['WhatsappInteraction']['describe']()[_0xd867('0x1d')](respondWithResult(_0x23e92f,null))[_0xd867('0x2a')](handleError(_0x23e92f,null));};exports[_0xd867('0x3a')]=function(_0x59c42b,_0x1638c0){return db[_0xd867('0x3b')][_0xd867('0x35')]({'where':{'id':_0x59c42b[_0xd867('0x38')]['id']}})[_0xd867('0x1d')](handleEntityNotFound(_0x1638c0,null))[_0xd867('0x1d')](function(_0x147469){if(_0x147469){return _0x147469['addMessage'](_0x59c42b['body'][_0xd867('0x3c')],_['omit'](_0x59c42b[_0xd867('0x37')],[_0xd867('0x3c'),'id'])||{});}})[_0xd867('0x1d')](respondWithResult(_0x1638c0,null))[_0xd867('0x2a')](handleError(_0x1638c0,null));};exports[_0xd867('0x3d')]=function(_0x1d631b,_0x499415){var _0x1395bf={'raw':![],'where':{}};var _0x58bfa7={};var _0x5a6575={'count':0x0,'rows':[]};return db[_0xd867('0x22')][_0xd867('0x3e')]({'where':{'id':_0x1d631b[_0xd867('0x38')]['id']}})[_0xd867('0x1d')](handleEntityNotFound(_0x499415,null))[_0xd867('0x1d')](function(_0x26b0e9){if(_0x26b0e9){_0x58bfa7[_0xd867('0x2c')]=_[_0xd867('0x2d')](db['WhatsappMessage'][_0xd867('0x2e')]);_0x58bfa7[_0xd867('0x28')]=_['keys'](_0x1d631b[_0xd867('0x28')]);_0x58bfa7['filters']=_[_0xd867('0x30')](_0x58bfa7[_0xd867('0x2c')],_0x58bfa7[_0xd867('0x28')]);_0x1395bf[_0xd867('0x3f')]=_[_0xd867('0x30')](_0x58bfa7[_0xd867('0x2c')],qs[_0xd867('0x40')](_0x1d631b[_0xd867('0x28')]['fields']));_0x1395bf[_0xd867('0x3f')]=_0x1395bf[_0xd867('0x3f')][_0xd867('0x31')]?_0x1395bf[_0xd867('0x3f')]:_0x58bfa7[_0xd867('0x2c')];if(!_0x1d631b[_0xd867('0x28')][_0xd867('0x41')]('nolimit')){_0x1395bf[_0xd867('0x19')]=qs[_0xd867('0x19')](_0x1d631b[_0xd867('0x28')][_0xd867('0x19')]);_0x1395bf[_0xd867('0x16')]=qs[_0xd867('0x16')](_0x1d631b[_0xd867('0x28')][_0xd867('0x16')]);}_0x1395bf['order']=qs[_0xd867('0x42')](_0x1d631b['query'][_0xd867('0x42')]);_0x1395bf[_0xd867('0x43')]=qs[_0xd867('0x2f')](_[_0xd867('0x44')](_0x1d631b[_0xd867('0x28')],_0x58bfa7[_0xd867('0x2f')]));_0x1395bf[_0xd867('0x43')]['WhatsappInteractionId']=_0x26b0e9['id'];if(_0x1d631b[_0xd867('0x28')][_0xd867('0x45')]){_0x1395bf[_0xd867('0x43')]=_[_0xd867('0x33')](_0x1395bf[_0xd867('0x43')],{'$or':_[_0xd867('0x21')](_0x1395bf['attributes'],function(_0x54bfb3){var _0x56e1cc={};_0x56e1cc[_0x54bfb3]={'$like':'%'+_0x1d631b[_0xd867('0x28')][_0xd867('0x45')]+'%'};return _0x56e1cc;})});}if(_0x1d631b[_0xd867('0x28')][_0xd867('0x46')]){var _0x317f53=_0x1d631b[_0xd867('0x28')]['$gte'][_0xd867('0x47')](',');var _0x4b91ba={};_0x4b91ba[_0x317f53[0x0]]={'$gte':moment(_0x317f53[0x1])[_0xd867('0x48')](_0xd867('0x49'))};_0x1395bf[_0xd867('0x43')]=_['merge'](_0x1395bf[_0xd867('0x43')],_0x4b91ba);}_0x1395bf=_['merge']({},_0x1395bf,_0x1d631b[_0xd867('0x34')]);return db[_0xd867('0x3b')][_0xd867('0x18')]({'where':_0x1395bf[_0xd867('0x43')]})[_0xd867('0x1d')](function(_0x4ad5f3){_0x5a6575[_0xd867('0x18')]=_0x4ad5f3;if(_0x1d631b[_0xd867('0x28')][_0xd867('0x4a')]){_0x1395bf[_0xd867('0x32')]=[{'all':!![]}];}return db[_0xd867('0x3b')][_0xd867('0x27')](_0x1395bf);})[_0xd867('0x1d')](function(_0x15284f){_0x5a6575[_0xd867('0x4b')]=_0x15284f;return _0x5a6575;});}})[_0xd867('0x1d')](respondWithFilteredResult(_0x499415,_0x1395bf))['catch'](handleError(_0x499415,null));};exports[_0xd867('0x4c')]=function(_0x1eff5d,_0x19d24f){return db['WhatsappInteraction'][_0xd867('0x35')]({'where':{'id':_0x1eff5d['params']['id']}})[_0xd867('0x1d')](handleEntityNotFound(_0x19d24f,null))[_0xd867('0x1d')](function(_0xcbc376){if(_0xcbc376){return _0xcbc376[_0xd867('0x4d')](_0x1eff5d[_0xd867('0x37')]['ids'],_[_0xd867('0x4e')](_0x1eff5d['body'],[_0xd867('0x3c'),'id'])||{})[_0xd867('0x4f')](function(){return db[_0xd867('0x50')]['findAll']({'attributes':['id',_0xd867('0x1f'),'color'],'where':{'id':_0x1eff5d[_0xd867('0x37')][_0xd867('0x3c')]}});})[_0xd867('0x1d')](function(_0x5f19e9){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x1eff5d['params']['id']),'tags':_0x5f19e9||[]});return{'id':Number(_0x1eff5d[_0xd867('0x38')]['id']),'tags':_0x5f19e9||[]};});}})[_0xd867('0x1d')](respondWithResult(_0x19d24f,null))[_0xd867('0x2a')](handleError(_0x19d24f,null));};exports['removeTags']=function(_0x30c4b2,_0x52aef4){return db[_0xd867('0x22')][_0xd867('0x35')]({'where':{'id':_0x30c4b2[_0xd867('0x38')]['id']}})['then'](handleEntityNotFound(_0x52aef4,null))['then'](function(_0x48a89a){if(_0x48a89a){return _0x48a89a['removeTags'](_0x30c4b2[_0xd867('0x28')][_0xd867('0x3c')]);}})[_0xd867('0x1d')](respondWithStatusCode(_0x52aef4,null))[_0xd867('0x2a')](handleError(_0x52aef4,null));};exports[_0xd867('0x51')]=function(_0x122dba,_0x4c4c55){var _0x391bd5=moment()['unix']()[_0xd867('0x52')]();var _0x113976=path[_0xd867('0x53')](config[_0xd867('0x54')],_0xd867('0x55'),_0xd867('0x56'),_0xd867('0x57'));var _0x34ac38=path[_0xd867('0x53')](config[_0xd867('0x54')],_0xd867('0x55'),'files',_0xd867('0x58'));var _0x334068=path['join'](_0x113976,_0x391bd5);var _0x5da6b3=util['format'](_0xd867('0x59'),_0x122dba[_0xd867('0x38')]['id'],_0x391bd5);var _0x1e053a=path['join'](_0x113976,_0x5da6b3);var _0x2e6180=[];_0x2e6180[_0xd867('0x5a')]({'model':db['User'],'as':_0xd867('0x5b'),'attributes':['id',_0xd867('0x5c')],'raw':!![]});_0x2e6180['push']({'model':db[_0xd867('0x5d')],'as':_0xd867('0x5e'),'attributes':['id',_0xd867('0x5f'),_0xd867('0x60')],'raw':!![]});if(_0x122dba['query'][_0xd867('0x58')]){_0x2e6180[_0xd867('0x5a')]({'model':db[_0xd867('0x61')],'as':_0xd867('0x61'),'raw':!![]});}var _0x24f954=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0xd867('0x62'),_0xd867('0x63'),'secret',_0xd867('0x64')],'include':_0x2e6180}];_0x24f954[_0xd867('0x5a')]({'model':db[_0xd867('0x65')],'as':'Account','attributes':['id',_0xd867('0x1f')]});_0x24f954[_0xd867('0x5a')]({'model':db[_0xd867('0x5b')],'as':_0xd867('0x66'),'attributes':['id','fullname']});return db[_0xd867('0x22')][_0xd867('0x35')]({'where':{'id':_0x122dba[_0xd867('0x38')]['id']},'include':_0x24f954})[_0xd867('0x1d')](handleEntityNotFound(_0x4c4c55,null))[_0xd867('0x1d')](function(_0x10ed4f){if(_0x10ed4f){var _0x3dcb49=_0x10ed4f[_0xd867('0x67')]({'plain':!![]});fs[_0xd867('0x68')](_0x334068);var _0x3dd800={'channel':_0xd867('0x69'),'account':_0x3dcb49['Account'][_0xd867('0x1f')],'agent':_0x3dcb49['Owner']?_0x3dcb49[_0xd867('0x66')][_0xd867('0x5c')]:_0xd867('0x6a'),'createdAt':moment(_0x3dcb49[_0xd867('0x62')])[_0xd867('0x48')](_0xd867('0x49'))[_0xd867('0x52')](),'closedAt':_0x3dcb49['closed']?moment(_0x3dcb49[_0xd867('0x6b')])[_0xd867('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd867('0x52')]():'','disposition':_0x3dcb49['disposition'],'messages':_(_0x3dcb49[_0xd867('0x6c')])['filter']({'secret':![]})['map'](function(_0x51a359){if(_0x51a359[_0xd867('0x61')]){var _0x4c64e1=path[_0xd867('0x53')](_0x34ac38,_0x51a359[_0xd867('0x61')]['basename']);if(fs[_0xd867('0x6d')](_0x4c64e1)){fs[_0xd867('0x6e')](_0x4c64e1)[_0xd867('0x6f')](fs[_0xd867('0x70')](path[_0xd867('0x53')](_0x334068,_0x51a359[_0xd867('0x61')]['basename'])));}}return{'date':moment(_0x51a359[_0xd867('0x62')])[_0xd867('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd867('0x52')](),'sender':_0x51a359[_0xd867('0x63')]===_0xd867('0x71')?_0x51a359[_0xd867('0x5b')]?_0x51a359[_0xd867('0x5b')][_0xd867('0x5c')]:_0xd867('0x72'):_0x51a359[_0xd867('0x5e')][_0xd867('0x5f')]+(_0x51a359[_0xd867('0x5e')]['lastName']?'\x20'+_0x51a359['Contact'][_0xd867('0x60')]:''),'body':_0x51a359['Attachment']?_0x51a359['Attachment']['basename']:_0x51a359[_0xd867('0x37')],'direction':_0x51a359[_0xd867('0x63')]==='out'?'A':'C','secret':_0x51a359['secret'],'read':_0x51a359[_0xd867('0x64')],'attachment':_0x51a359[_0xd867('0x61')]};})[_0xd867('0x73')]()};return ejs['renderFile'](path[_0xd867('0x53')](config[_0xd867('0x54')],_0xd867('0x55'),_0xd867('0x74'),_0xd867('0x75')),{'interaction':_0x3dd800})[_0xd867('0x1d')](function(_0x19ee31){var _0x5b7044=path['join'](_0x334068,'transcript-'+_0x3dcb49['id']+'-'+_0x391bd5+'.pdf');var _0x3c0232={'path':_0x5b7044,'channel':_0xd867('0x69'),'interactionId':_0x3dcb49['id']};return pdf[_0xd867('0x76')](_0x19ee31,_0x3c0232);})['then'](function(){return new BPromise(function(_0x4def41,_0x40e3d1){zipdir(_0x334068,{'saveTo':_0x1e053a},function(_0x111ea3,_0x2ed387){if(_0x111ea3)return _0x40e3d1(_0x111ea3);return _0x4def41(_0x2ed387);});})[_0xd867('0x1d')](function(){return new BPromise(function(_0xf74940,_0x36d254){rimraf(_0x334068,function(_0x36ec55){if(_0x36ec55)_0x36d254(_0x36ec55);return _0xf74940();});});})[_0xd867('0x1d')](function(){return _0x4c4c55[_0xd867('0x51')](_0x1e053a,_0x5da6b3,function(_0x19ff17){if(_0x19ff17){console[_0xd867('0x77')](_0xd867('0x78'),_0x19ff17);}else{fs['unlinkSync'](_0x1e053a);}});});});}else{return _0x4c4c55[_0xd867('0x13')](0xc8);}})['catch'](handleError(_0x4c4c55,null));}; \ No newline at end of file +var _0x8b26=['zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','then','destroy','error','stack','name','send','WhatsappInteraction','fieldName','type','key','findAll','whatsapp','user','catch','params','keys','query','filters','intersection','model','fields','attributes','length','includeAll','include','options','find','create','update','body','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','rawAttributes','hasOwnProperty','order','sort','where','WhatsappInteractionId','filter','merge','map','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','color','emit','whatsappInteractionTags:save','removeTags','download','root','server','files','tmp','attachments','join','format','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','toString','basename','existsSync','createReadStream','pipe','createWriteStream','out','fullname','System','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf'];(function(_0x123be2,_0x547a9e){var _0x47fd4c=function(_0x133bbb){while(--_0x133bbb){_0x123be2['push'](_0x123be2['shift']());}};_0x47fd4c(++_0x547a9e);}(_0x8b26,0x1f3));var _0x68b2=function(_0x336c8b,_0x56b55b){_0x336c8b=_0x336c8b-0x0;var _0x4dd2f6=_0x8b26[_0x336c8b];return _0x4dd2f6;};'use strict';var rimraf=require(_0x68b2('0x0'));var zipdir=require(_0x68b2('0x1'));var moment=require(_0x68b2('0x2'));var BPromise=require('bluebird');var util=require(_0x68b2('0x3'));var path=require(_0x68b2('0x4'));var ejs=require(_0x68b2('0x5'));var fs=require('fs');var _=require(_0x68b2('0x6'));var Redis=require(_0x68b2('0x7'));var interaction=require(_0x68b2('0x8'));var qs=require(_0x68b2('0x9'));var pdf=require(_0x68b2('0xa'));var logger=require(_0x68b2('0xb'))(_0x68b2('0xc'));var config=require('../../config/environment');var db=require(_0x68b2('0xd'))['db'];config[_0x68b2('0xe')]=_[_0x68b2('0xf')](config[_0x68b2('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x68b2('0x10'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x68b2('0x11')](socket);function respondWithStatusCode(_0x17fd91,_0x179350){_0x179350=_0x179350||0xcc;return function(_0x4b31c6){if(_0x4b31c6){return _0x17fd91[_0x68b2('0x12')](_0x179350);}return _0x17fd91['status'](_0x179350)['end']();};}function respondWithResult(_0x856dfe,_0x1a12d3){_0x1a12d3=_0x1a12d3||0xc8;return function(_0x2688a8){if(_0x2688a8){return _0x856dfe[_0x68b2('0x13')](_0x1a12d3)[_0x68b2('0x14')](_0x2688a8);}};}function respondWithFilteredResult(_0x3a57c2,_0x26ac07){return function(_0x3b216f){if(_0x3b216f){var _0x43536e=typeof _0x26ac07[_0x68b2('0x15')]===_0x68b2('0x16')&&typeof _0x26ac07['limit']===_0x68b2('0x16');var _0x34881a=_0x3b216f[_0x68b2('0x17')];var _0x1f1e43=_0x43536e?0x0:_0x26ac07[_0x68b2('0x15')];var _0x528823=_0x43536e?_0x3b216f[_0x68b2('0x17')]:_0x26ac07['offset']+_0x26ac07[_0x68b2('0x18')];var _0x306167;if(_0x528823>=_0x34881a){_0x528823=_0x34881a;_0x306167=0xc8;}else{_0x306167=0xce;}_0x3a57c2[_0x68b2('0x13')](_0x306167);return _0x3a57c2['set']('Content-Range',_0x1f1e43+'-'+_0x528823+'/'+_0x34881a)[_0x68b2('0x14')](_0x3b216f);}return null;};}function saveUpdates(_0x200bf5){return function(_0x42e318){if(_0x42e318){return _0x42e318['update'](_0x200bf5)[_0x68b2('0x19')](function(_0x3b8a4a){return _0x3b8a4a;});}return null;};}function removeEntity(_0x3a969f){return function(_0x28af4d){if(_0x28af4d){return _0x28af4d[_0x68b2('0x1a')]()[_0x68b2('0x19')](function(){_0x3a969f[_0x68b2('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f1c44){return function(_0x128c6b){if(!_0x128c6b){_0x2f1c44[_0x68b2('0x12')](0x194);}return _0x128c6b;};}function handleError(_0x46b5c4,_0x3df744){_0x3df744=_0x3df744||0x1f4;return function(_0x5e0271){logger[_0x68b2('0x1b')](_0x5e0271[_0x68b2('0x1c')]);if(_0x5e0271[_0x68b2('0x1d')]){delete _0x5e0271[_0x68b2('0x1d')];}_0x46b5c4['status'](_0x3df744)[_0x68b2('0x1e')](_0x5e0271);};}exports['index']=function(_0x1ed70d,_0x25eed7){var _0x41d80d={};var _0x4a81b3=_['map'](db[_0x68b2('0x1f')]['rawAttributes'],function(_0x1ceb95){return{'name':_0x1ceb95[_0x68b2('0x20')],'type':_0x1ceb95[_0x68b2('0x21')][_0x68b2('0x22')]};});_0x41d80d=qs['getOptions'](_0x4a81b3,_0x1ed70d);return interaction[_0x68b2('0x23')](_0x68b2('0x24'),_0x1ed70d['query'],_0x1ed70d[_0x68b2('0x25')],_0x41d80d,_0x4a81b3)['then'](respondWithFilteredResult(_0x25eed7,_0x41d80d))[_0x68b2('0x26')](handleError(_0x25eed7,null));};exports['show']=function(_0x360dd2,_0x432822){var _0x4248f8={'raw':![],'where':{'id':_0x360dd2[_0x68b2('0x27')]['id']}},_0x356899={};_0x356899['model']=_[_0x68b2('0x28')](db[_0x68b2('0x1f')]['rawAttributes']);_0x356899[_0x68b2('0x29')]=_['keys'](_0x360dd2[_0x68b2('0x29')]);_0x356899[_0x68b2('0x2a')]=_[_0x68b2('0x2b')](_0x356899[_0x68b2('0x2c')],_0x356899[_0x68b2('0x29')]);_0x4248f8['attributes']=_['intersection'](_0x356899[_0x68b2('0x2c')],qs[_0x68b2('0x2d')](_0x360dd2[_0x68b2('0x29')][_0x68b2('0x2d')]));_0x4248f8[_0x68b2('0x2e')]=_0x4248f8['attributes'][_0x68b2('0x2f')]?_0x4248f8[_0x68b2('0x2e')]:_0x356899[_0x68b2('0x2c')];if(_0x360dd2[_0x68b2('0x29')][_0x68b2('0x30')]){_0x4248f8[_0x68b2('0x31')]=[{'all':!![]}];}_0x4248f8=_['merge']({},_0x4248f8,_0x360dd2[_0x68b2('0x32')]);return db['WhatsappInteraction'][_0x68b2('0x33')](_0x4248f8)[_0x68b2('0x19')](handleEntityNotFound(_0x432822,null))[_0x68b2('0x19')](respondWithResult(_0x432822,null))[_0x68b2('0x26')](handleError(_0x432822,null));};exports['create']=function(_0x58552d,_0x37bfbc){return db[_0x68b2('0x1f')][_0x68b2('0x34')](_0x58552d['body'],{})[_0x68b2('0x19')](respondWithResult(_0x37bfbc,0xc9))['catch'](handleError(_0x37bfbc,null));};exports[_0x68b2('0x35')]=function(_0x14be76,_0x2066d3){if(_0x14be76[_0x68b2('0x36')]['id']){delete _0x14be76[_0x68b2('0x36')]['id'];}return db[_0x68b2('0x1f')][_0x68b2('0x33')]({'where':{'id':_0x14be76[_0x68b2('0x27')]['id']}})[_0x68b2('0x19')](handleEntityNotFound(_0x2066d3,null))['then'](saveUpdates(_0x14be76[_0x68b2('0x36')],null))[_0x68b2('0x19')](respondWithResult(_0x2066d3,null))[_0x68b2('0x26')](handleError(_0x2066d3,null));};exports[_0x68b2('0x1a')]=function(_0x275aeb,_0x3d0829){return db[_0x68b2('0x1f')][_0x68b2('0x33')]({'where':{'id':_0x275aeb[_0x68b2('0x27')]['id']}})[_0x68b2('0x19')](handleEntityNotFound(_0x3d0829,null))[_0x68b2('0x19')](removeEntity(_0x3d0829,null))[_0x68b2('0x26')](handleError(_0x3d0829,null));};exports[_0x68b2('0x37')]=function(_0x373171,_0x355c6d){return db['WhatsappInteraction']['describe']()[_0x68b2('0x19')](respondWithResult(_0x355c6d,null))[_0x68b2('0x26')](handleError(_0x355c6d,null));};exports[_0x68b2('0x38')]=function(_0x47ab66,_0xb370cb){return db[_0x68b2('0x39')][_0x68b2('0x33')]({'where':{'id':_0x47ab66['params']['id']}})['then'](handleEntityNotFound(_0xb370cb,null))[_0x68b2('0x19')](function(_0x39a50c){if(_0x39a50c){return _0x39a50c['addMessage'](_0x47ab66[_0x68b2('0x36')]['ids'],_[_0x68b2('0x3a')](_0x47ab66[_0x68b2('0x36')],['ids','id'])||{});}})[_0x68b2('0x19')](respondWithResult(_0xb370cb,null))[_0x68b2('0x26')](handleError(_0xb370cb,null));};exports[_0x68b2('0x3b')]=function(_0xe3f8a9,_0x42df60){var _0x4ede8f={'raw':![],'where':{}};var _0x4a3c80={};var _0x1e2828={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x68b2('0x3c')]({'where':{'id':_0xe3f8a9['params']['id']}})[_0x68b2('0x19')](handleEntityNotFound(_0x42df60,null))['then'](function(_0x299298){if(_0x299298){_0x4a3c80[_0x68b2('0x2c')]=_[_0x68b2('0x28')](db['WhatsappMessage'][_0x68b2('0x3d')]);_0x4a3c80[_0x68b2('0x29')]=_[_0x68b2('0x28')](_0xe3f8a9['query']);_0x4a3c80[_0x68b2('0x2a')]=_[_0x68b2('0x2b')](_0x4a3c80[_0x68b2('0x2c')],_0x4a3c80['query']);_0x4ede8f[_0x68b2('0x2e')]=_[_0x68b2('0x2b')](_0x4a3c80[_0x68b2('0x2c')],qs['fields'](_0xe3f8a9['query'][_0x68b2('0x2d')]));_0x4ede8f[_0x68b2('0x2e')]=_0x4ede8f[_0x68b2('0x2e')][_0x68b2('0x2f')]?_0x4ede8f[_0x68b2('0x2e')]:_0x4a3c80[_0x68b2('0x2c')];if(!_0xe3f8a9[_0x68b2('0x29')][_0x68b2('0x3e')]('nolimit')){_0x4ede8f['limit']=qs[_0x68b2('0x18')](_0xe3f8a9[_0x68b2('0x29')][_0x68b2('0x18')]);_0x4ede8f[_0x68b2('0x15')]=qs[_0x68b2('0x15')](_0xe3f8a9[_0x68b2('0x29')][_0x68b2('0x15')]);}_0x4ede8f[_0x68b2('0x3f')]=qs[_0x68b2('0x40')](_0xe3f8a9['query'][_0x68b2('0x40')]);_0x4ede8f['where']=qs[_0x68b2('0x2a')](_['pick'](_0xe3f8a9['query'],_0x4a3c80[_0x68b2('0x2a')]));_0x4ede8f[_0x68b2('0x41')][_0x68b2('0x42')]=_0x299298['id'];if(_0xe3f8a9[_0x68b2('0x29')][_0x68b2('0x43')]){_0x4ede8f['where']=_[_0x68b2('0x44')](_0x4ede8f[_0x68b2('0x41')],{'$or':_[_0x68b2('0x45')](_0x4ede8f[_0x68b2('0x2e')],function(_0x156919){var _0x5df08a={};_0x5df08a[_0x156919]={'$like':'%'+_0xe3f8a9[_0x68b2('0x29')][_0x68b2('0x43')]+'%'};return _0x5df08a;})});}if(_0xe3f8a9['query']['$gte']){var _0x3915d1=_0xe3f8a9[_0x68b2('0x29')]['$gte'][_0x68b2('0x46')](',');var _0x3a2205={};_0x3a2205[_0x3915d1[0x0]]={'$gte':moment(_0x3915d1[0x1])['format'](_0x68b2('0x47'))};_0x4ede8f['where']=_[_0x68b2('0x44')](_0x4ede8f[_0x68b2('0x41')],_0x3a2205);}_0x4ede8f=_['merge']({},_0x4ede8f,_0xe3f8a9[_0x68b2('0x32')]);return db[_0x68b2('0x39')]['count']({'where':_0x4ede8f[_0x68b2('0x41')]})['then'](function(_0x3a472f){_0x1e2828[_0x68b2('0x17')]=_0x3a472f;if(_0xe3f8a9['query']['includeAll']){_0x4ede8f[_0x68b2('0x31')]=[{'all':!![]}];}return db[_0x68b2('0x39')][_0x68b2('0x23')](_0x4ede8f);})[_0x68b2('0x19')](function(_0xcdde95){_0x1e2828[_0x68b2('0x48')]=_0xcdde95;return _0x1e2828;});}})[_0x68b2('0x19')](respondWithFilteredResult(_0x42df60,_0x4ede8f))['catch'](handleError(_0x42df60,null));};exports['addTags']=function(_0x108308,_0x3c75af){return db[_0x68b2('0x1f')][_0x68b2('0x33')]({'where':{'id':_0x108308['params']['id']}})[_0x68b2('0x19')](handleEntityNotFound(_0x3c75af,null))['then'](function(_0x407002){if(_0x407002){return _0x407002[_0x68b2('0x49')](_0x108308[_0x68b2('0x36')][_0x68b2('0x4a')],_[_0x68b2('0x3a')](_0x108308[_0x68b2('0x36')],[_0x68b2('0x4a'),'id'])||{})['spread'](function(){return db['Tag'][_0x68b2('0x23')]({'attributes':['id','name',_0x68b2('0x4b')],'where':{'id':_0x108308['body'][_0x68b2('0x4a')]}});})[_0x68b2('0x19')](function(_0x18c6c2){socket[_0x68b2('0x4c')](_0x68b2('0x4d'),{'id':Number(_0x108308[_0x68b2('0x27')]['id']),'tags':_0x18c6c2||[]});return{'id':Number(_0x108308[_0x68b2('0x27')]['id']),'tags':_0x18c6c2||[]};});}})[_0x68b2('0x19')](respondWithResult(_0x3c75af,null))['catch'](handleError(_0x3c75af,null));};exports[_0x68b2('0x4e')]=function(_0x593377,_0x55268c){return db[_0x68b2('0x1f')][_0x68b2('0x33')]({'where':{'id':_0x593377[_0x68b2('0x27')]['id']}})[_0x68b2('0x19')](handleEntityNotFound(_0x55268c,null))[_0x68b2('0x19')](function(_0x1cdee1){if(_0x1cdee1){return _0x1cdee1[_0x68b2('0x4e')](_0x593377['query'][_0x68b2('0x4a')]);}})['then'](respondWithStatusCode(_0x55268c,null))['catch'](handleError(_0x55268c,null));};exports[_0x68b2('0x4f')]=function(_0x48224d,_0x53e801){var _0xe86f45=moment()['unix']()['toString']();var _0x8c9e9b=path['join'](config[_0x68b2('0x50')],_0x68b2('0x51'),_0x68b2('0x52'),_0x68b2('0x53'));var _0x4c0e40=path['join'](config['root'],'server',_0x68b2('0x52'),_0x68b2('0x54'));var _0x465f2a=path[_0x68b2('0x55')](_0x8c9e9b,_0xe86f45);var _0x425628=util[_0x68b2('0x56')](_0x68b2('0x57'),_0x48224d[_0x68b2('0x27')]['id'],_0xe86f45);var _0x4d03d9=path[_0x68b2('0x55')](_0x8c9e9b,_0x425628);var _0x3f84c0=[];_0x3f84c0['push']({'model':db[_0x68b2('0x58')],'as':_0x68b2('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x3f84c0[_0x68b2('0x59')]({'model':db[_0x68b2('0x5a')],'as':_0x68b2('0x5b'),'attributes':['id',_0x68b2('0x5c'),_0x68b2('0x5d')],'raw':!![]});if(_0x48224d[_0x68b2('0x29')][_0x68b2('0x54')]){_0x3f84c0[_0x68b2('0x59')]({'model':db[_0x68b2('0x5e')],'as':'Attachment','raw':!![]});}var _0x3e7fcb=[{'model':db['WhatsappMessage'],'as':_0x68b2('0x5f'),'attributes':['id',_0x68b2('0x36'),_0x68b2('0x60'),_0x68b2('0x61'),_0x68b2('0x62'),_0x68b2('0x63')],'include':_0x3f84c0}];_0x3e7fcb['push']({'model':db[_0x68b2('0x64')],'as':_0x68b2('0x65'),'attributes':['id',_0x68b2('0x1d')]});_0x3e7fcb[_0x68b2('0x59')]({'model':db[_0x68b2('0x58')],'as':_0x68b2('0x66'),'attributes':['id','fullname']});return db[_0x68b2('0x1f')][_0x68b2('0x33')]({'where':{'id':_0x48224d['params']['id']},'include':_0x3e7fcb})[_0x68b2('0x19')](handleEntityNotFound(_0x53e801,null))[_0x68b2('0x19')](function(_0xdcd43){if(_0xdcd43){var _0x4e74be=_0xdcd43[_0x68b2('0x67')]({'plain':!![]});fs[_0x68b2('0x68')](_0x465f2a);var _0x4b52be={'channel':_0x68b2('0x69'),'account':_0x4e74be['Account'][_0x68b2('0x1d')],'agent':_0x4e74be[_0x68b2('0x66')]?_0x4e74be[_0x68b2('0x66')]['fullname']:_0x68b2('0x6a'),'createdAt':moment(_0x4e74be[_0x68b2('0x60')])[_0x68b2('0x56')](_0x68b2('0x47'))['toString'](),'closedAt':_0x4e74be[_0x68b2('0x6b')]?moment(_0x4e74be[_0x68b2('0x6c')])['format'](_0x68b2('0x47'))[_0x68b2('0x6d')]():'','disposition':_0x4e74be['disposition'],'messages':_(_0x4e74be[_0x68b2('0x5f')])[_0x68b2('0x43')]({'secret':![]})[_0x68b2('0x45')](function(_0x3b60e6){if(_0x3b60e6[_0x68b2('0x5e')]){var _0x34788f=path[_0x68b2('0x55')](_0x4c0e40,_0x3b60e6[_0x68b2('0x5e')][_0x68b2('0x6e')]);if(fs[_0x68b2('0x6f')](_0x34788f)){fs[_0x68b2('0x70')](_0x34788f)[_0x68b2('0x71')](fs[_0x68b2('0x72')](path[_0x68b2('0x55')](_0x465f2a,_0x3b60e6[_0x68b2('0x5e')][_0x68b2('0x6e')])));}}return{'date':moment(_0x3b60e6[_0x68b2('0x60')])[_0x68b2('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0x68b2('0x6d')](),'sender':_0x3b60e6[_0x68b2('0x61')]===_0x68b2('0x73')?_0x3b60e6[_0x68b2('0x58')]?_0x3b60e6['User'][_0x68b2('0x74')]:_0x68b2('0x75'):_0x3b60e6[_0x68b2('0x5b')][_0x68b2('0x5c')]+(_0x3b60e6[_0x68b2('0x5b')][_0x68b2('0x5d')]?'\x20'+_0x3b60e6['Contact']['lastName']:''),'body':_0x3b60e6[_0x68b2('0x5e')]?_0x3b60e6[_0x68b2('0x5e')][_0x68b2('0x6e')]:_0x3b60e6['body'],'direction':_0x3b60e6[_0x68b2('0x61')]===_0x68b2('0x73')?'A':'C','secret':_0x3b60e6[_0x68b2('0x62')],'read':_0x3b60e6[_0x68b2('0x63')],'attachment':_0x3b60e6[_0x68b2('0x5e')]};})['value']()};return ejs[_0x68b2('0x76')](path['join'](config[_0x68b2('0x50')],'server',_0x68b2('0x77'),_0x68b2('0x78')),{'interaction':_0x4b52be})['then'](function(_0x370d02){var _0x2f4104=path[_0x68b2('0x55')](_0x465f2a,'transcript-'+_0x4e74be['id']+'-'+_0xe86f45+_0x68b2('0x79'));var _0x2628ef={'path':_0x2f4104,'channel':_0x68b2('0x69'),'interactionId':_0x4e74be['id']};return pdf[_0x68b2('0x7a')](_0x370d02,_0x2628ef);})[_0x68b2('0x19')](function(){return new BPromise(function(_0x2ae924,_0x4d339f){zipdir(_0x465f2a,{'saveTo':_0x4d03d9},function(_0x6afd39,_0x2218dc){if(_0x6afd39)return _0x4d339f(_0x6afd39);return _0x2ae924(_0x2218dc);});})[_0x68b2('0x19')](function(){return new BPromise(function(_0x7bffed,_0xfcf711){rimraf(_0x465f2a,function(_0x1a2aef){if(_0x1a2aef)_0xfcf711(_0x1a2aef);return _0x7bffed();});});})[_0x68b2('0x19')](function(){return _0x53e801[_0x68b2('0x4f')](_0x4d03d9,_0x425628,function(_0x4d9b14){if(_0x4d9b14){console[_0x68b2('0x7b')](_0x68b2('0x7c'),_0x4d9b14);}else{fs['unlinkSync'](_0x4d03d9);}});});});}else{return _0x53e801[_0x68b2('0x12')](0xc8);}})[_0x68b2('0x26')](handleError(_0x53e801,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a17986f..92bbe7d 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 _0x3c81=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x9cf9f8,_0x1efb85){var _0x24550a=function(_0x588463){while(--_0x588463){_0x9cf9f8['push'](_0x9cf9f8['shift']());}};_0x24550a(++_0x1efb85);}(_0x3c81,0x102));var _0x13c8=function(_0x14149e,_0x2826bb){_0x14149e=_0x14149e-0x0;var _0x1c5db6=_0x3c81[_0x14149e];return _0x1c5db6;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var WhatsappInteraction=require(_0x13c8('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x13c8('0x1'))['db'][_0x13c8('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x101d4f){return function(_0x3ec886,_0x18bd0f,_0x1c16f1){_0x3ec886[_0x13c8('0x3')]({'attributes':['id'],'raw':!![]})[_0x13c8('0x4')](function(_0x445b69){_0x3ec886['setDataValue'](_0x13c8('0x5'),_0x445b69['map'](function(_0x380aed){return{'id':_0x380aed['id']};}));return WhatsappMessage[_0x13c8('0x6')]({'where':{'WhatsappInteractionId':_0x3ec886['id'],'direction':'in','read':![]},'raw':!![]});})[_0x13c8('0x4')](function(_0x30b4d6){_0x3ec886[_0x13c8('0x7')](_0x13c8('0x8'),_0x30b4d6[_0x13c8('0x9')]);WhatsappInteractionEvents[_0x13c8('0xa')](_0x101d4f+':'+_0x3ec886['id'],_0x3ec886);WhatsappInteractionEvents[_0x13c8('0xa')](_0x101d4f,_0x3ec886);_0x1c16f1(null);})[_0x13c8('0xb')](_0x1c16f1(null));};}for(var e in events){if(events[_0x13c8('0xc')](e)){var event=events[e];WhatsappInteraction[_0x13c8('0xd')](e,emitEvent(event));}}module[_0x13c8('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa25c=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','unreadMessages','length','emit','hook','exports','../../mysqldb'];(function(_0x1278f4,_0x2a8911){var _0x3ced08=function(_0x49d9a9){while(--_0x49d9a9){_0x1278f4['push'](_0x1278f4['shift']());}};_0x3ced08(++_0x2a8911);}(_0xa25c,0x13f));var _0xca25=function(_0xb2b502,_0x3c4f6b){_0xb2b502=_0xb2b502-0x0;var _0x38b8b2=_0xa25c[_0xb2b502];return _0x38b8b2;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xca25('0x0'))['db'][_0xca25('0x1')];var WhatsappMessage=require(_0xca25('0x0'))['db'][_0xca25('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xca25('0x3')](0x0);var events={'afterCreate':_0xca25('0x4'),'afterUpdate':_0xca25('0x5'),'afterDestroy':_0xca25('0x6')};function emitEvent(_0x498b8e){return function(_0x41d208,_0x4ff5bd,_0x4ec046){_0x41d208[_0xca25('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb2fc94){_0x41d208[_0xca25('0x8')](_0xca25('0x9'),_0xb2fc94[_0xca25('0xa')](function(_0x43149d){return{'id':_0x43149d['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x41d208['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x44d596){_0x41d208['setDataValue'](_0xca25('0xb'),_0x44d596[_0xca25('0xc')]);WhatsappInteractionEvents[_0xca25('0xd')](_0x498b8e+':'+_0x41d208['id'],_0x41d208);WhatsappInteractionEvents['emit'](_0x498b8e,_0x41d208);_0x4ec046(null);})['catch'](_0x4ec046(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xca25('0xe')](e,emitEvent(event));}}module[_0xca25('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 9818c25..e4bf601 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 _0xf0e4=['format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','closed','closedAt'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf0e4,0x198));var _0x4f0e=function(_0x2f7116,_0x459cef){_0x2f7116=_0x2f7116-0x0;var _0x22ccdc=_0xf0e4[_0x2f7116];return _0x22ccdc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4f0e('0x0'));var moment=require(_0x4f0e('0x1'));var BPromise=require(_0x4f0e('0x2'));var rp=require(_0x4f0e('0x3'));var fs=require('fs');var path=require(_0x4f0e('0x4'));var rimraf=require(_0x4f0e('0x5'));var config=require(_0x4f0e('0x6'));var attributes=require(_0x4f0e('0x7'));module[_0x4f0e('0x8')]=function(_0x2c5999,_0x85019f){return _0x2c5999['define']('WhatsappInteraction',attributes,{'tableName':_0x4f0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1af495,_0x1415e3,_0x1e9610){if(_0x1af495['changed'](_0x4f0e('0xa'))){_0x1af495[_0x4f0e('0xb')]=moment()[_0x4f0e('0xc')](_0x4f0e('0xd'));}_0x1e9610(null,_0x1af495);}}});}; \ No newline at end of file +var _0x0c7d=['moment','request-promise','../../config/environment','define','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x0c7d,0x111));var _0xd0c7=function(_0x279de4,_0x5d552d){_0x279de4=_0x279de4-0x0;var _0x104a16=_0x0c7d[_0x279de4];return _0x104a16;};'use strict';var _=require(_0xd0c7('0x0'));var util=require(_0xd0c7('0x1'));var logger=require('../../config/logger')(_0xd0c7('0x2'));var moment=require(_0xd0c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd0c7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0c7('0x5'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x5939dd,_0x2ce4a6){return _0x5939dd[_0xd0c7('0x6')](_0xd0c7('0x7'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x428312,_0x282dce,_0x3c4c87){if(_0x428312[_0xd0c7('0x8')]('closed')){_0x428312[_0xd0c7('0x9')]=moment()[_0xd0c7('0xa')](_0xd0c7('0xb'));}_0x3c4c87(null,_0x428312);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 048c428..1d62c1d 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 _0x8b0e=['options','raw','where','attributes','info','debug','AddTagsToWhatsappInteraction','find','addTags','body','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x8b0e,0xd0));var _0xe8b0=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x8b0e[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8b0('0x4'))['db'];var utils=require(_0xe8b0('0x5'));var logger=require(_0xe8b0('0x6'))(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson['client'][_0xe8b0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe8b0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b0('0xc'))(new Redis(config['redis']));require(_0xe8b0('0xd'))[_0xe8b0('0xe')](socket);function respondWithRpcPromise(_0x3282f5,_0x486dd9,_0x48909b){return new BPromise(function(_0x23364a,_0x182afe){return client[_0xe8b0('0xf')](_0x3282f5,_0x48909b)[_0xe8b0('0x10')](function(_0x58dbaa){logger['info'](_0xe8b0('0x11'),_0x486dd9,_0xe8b0('0x12'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x486dd9,_0xe8b0('0x12'),JSON[_0xe8b0('0x13')](_0x58dbaa));if(_0x58dbaa[_0xe8b0('0x14')]){if(_0x58dbaa['error'][_0xe8b0('0x15')]===0x1f4){logger[_0xe8b0('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x486dd9,_0x58dbaa[_0xe8b0('0x14')]['message']);return _0x182afe(_0x58dbaa[_0xe8b0('0x14')][_0xe8b0('0x16')]);}logger['error'](_0xe8b0('0x11'),_0x486dd9,_0x58dbaa[_0xe8b0('0x14')][_0xe8b0('0x16')]);return _0x23364a(_0x58dbaa['error'][_0xe8b0('0x16')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x486dd9,_0xe8b0('0x12'));_0x23364a(_0x58dbaa['result'][_0xe8b0('0x16')]);}})[_0xe8b0('0x17')](function(_0x2f43c1){logger[_0xe8b0('0x14')](_0xe8b0('0x11'),_0x486dd9,_0x2f43c1);_0x182afe(_0x2f43c1);});});}exports[_0xe8b0('0x18')]=function(_0x19fc78){var _0x3e2ced=this;return new Promise(function(_0x4b77a3,_0x5b2ecd){return db[_0xe8b0('0x19')]['update'](_0x19fc78['body'],{'raw':_0x19fc78['options']?_0x19fc78[_0xe8b0('0x1a')][_0xe8b0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19fc78[_0xe8b0('0x1a')]?_0x19fc78[_0xe8b0('0x1a')][_0xe8b0('0x1c')]||null:null,'attributes':_0x19fc78[_0xe8b0('0x1a')]?_0x19fc78[_0xe8b0('0x1a')][_0xe8b0('0x1d')]||null:null,'limit':_0x19fc78[_0xe8b0('0x1a')]?_0x19fc78[_0xe8b0('0x1a')]['limit']||null:null})[_0xe8b0('0x10')](function(_0x410f05){logger[_0xe8b0('0x1e')](_0xe8b0('0x18'),_0x19fc78);logger[_0xe8b0('0x1f')](_0xe8b0('0x18'),_0x19fc78,JSON[_0xe8b0('0x13')](_0x410f05));_0x4b77a3(_0x410f05);})[_0xe8b0('0x17')](function(_0x23a546){logger['error']('UpdateWhatsappInteraction',_0x23a546['message'],_0x19fc78);_0x5b2ecd(_0x3e2ced[_0xe8b0('0x14')](0x1f4,_0x23a546[_0xe8b0('0x16')]));});});};exports[_0xe8b0('0x20')]=function(_0xcd72aa){return new Promise(function(_0x537bcb,_0x42fab0){return db[_0xe8b0('0x19')][_0xe8b0('0x21')]({'where':_0xcd72aa[_0xe8b0('0x1a')]?_0xcd72aa[_0xe8b0('0x1a')][_0xe8b0('0x1c')]||null:null})['then'](function(_0x1465bd){if(_0x1465bd){return _0x1465bd[_0xe8b0('0x22')](_0xcd72aa[_0xe8b0('0x23')]['ids'],_[_0xe8b0('0x24')](_0xcd72aa[_0xe8b0('0x23')],['ids','id'])||{});}})[_0xe8b0('0x25')](function(_0x378258){logger[_0xe8b0('0x1e')](_0xe8b0('0x26'),_0xcd72aa);logger[_0xe8b0('0x1f')](_0xe8b0('0x26'),_0xcd72aa,JSON[_0xe8b0('0x13')](_0x378258));_0x537bcb(_0x378258);})[_0xe8b0('0x17')](function(_0x48a786){logger[_0xe8b0('0x14')]('AddTags',_0x48a786[_0xe8b0('0x16')],_0xcd72aa);_0x42fab0(_this[_0xe8b0('0x14')](0x1f4,_0x48a786['message']));});});}; \ No newline at end of file +var _0x677f=['WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','then','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','info'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x677f,0x1d0));var _0xf677=function(_0x5e385c,_0x21d4fc){_0x5e385c=_0x5e385c-0x0;var _0x337e85=_0x677f[_0x5e385c];return _0x337e85;};'use strict';var _=require(_0xf677('0x0'));var util=require(_0xf677('0x1'));var moment=require(_0xf677('0x2'));var BPromise=require(_0xf677('0x3'));var rs=require(_0xf677('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf677('0x5'))['db'];var utils=require(_0xf677('0x6'));var logger=require('../../config/logger')(_0xf677('0x7'));var config=require(_0xf677('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf677('0x9')][_0xf677('0xa')]({'port':0x232a});config[_0xf677('0xb')]=_[_0xf677('0xc')](config[_0xf677('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf677('0xd'))(new Redis(config[_0xf677('0xb')]));require('./whatsappInteraction.socket')[_0xf677('0xe')](socket);function respondWithRpcPromise(_0xdc565e,_0x162765,_0x33342a){return new BPromise(function(_0x1e2762,_0x5002b0){return client['request'](_0xdc565e,_0x33342a)['then'](function(_0x33d7c6){logger[_0xf677('0xf')](_0xf677('0x10'),_0x162765,_0xf677('0x11'));logger[_0xf677('0x12')](_0xf677('0x13'),_0x162765,_0xf677('0x11'),JSON[_0xf677('0x14')](_0x33d7c6));if(_0x33d7c6[_0xf677('0x15')]){if(_0x33d7c6[_0xf677('0x15')]['code']===0x1f4){logger[_0xf677('0x15')](_0xf677('0x10'),_0x162765,_0x33d7c6[_0xf677('0x15')][_0xf677('0x16')]);return _0x5002b0(_0x33d7c6['error'][_0xf677('0x16')]);}logger[_0xf677('0x15')](_0xf677('0x10'),_0x162765,_0x33d7c6['error'][_0xf677('0x16')]);return _0x1e2762(_0x33d7c6[_0xf677('0x15')]['message']);}else{logger[_0xf677('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x162765,_0xf677('0x11'));_0x1e2762(_0x33d7c6[_0xf677('0x17')][_0xf677('0x16')]);}})[_0xf677('0x18')](function(_0x39f94b){logger[_0xf677('0x15')](_0xf677('0x10'),_0x162765,_0x39f94b);_0x5002b0(_0x39f94b);});});}exports[_0xf677('0x19')]=function(_0xb9e4b1){var _0x25a687=this;return new Promise(function(_0x24e220,_0x299c47){return db[_0xf677('0x1a')][_0xf677('0x1b')](_0xb9e4b1[_0xf677('0x1c')],{'raw':_0xb9e4b1['options']?_0xb9e4b1[_0xf677('0x1d')][_0xf677('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb9e4b1[_0xf677('0x1d')]?_0xb9e4b1[_0xf677('0x1d')][_0xf677('0x1f')]||null:null,'attributes':_0xb9e4b1[_0xf677('0x1d')]?_0xb9e4b1['options'][_0xf677('0x20')]||null:null,'limit':_0xb9e4b1[_0xf677('0x1d')]?_0xb9e4b1[_0xf677('0x1d')]['limit']||null:null})[_0xf677('0x21')](function(_0x2e3244){logger[_0xf677('0xf')](_0xf677('0x19'),_0xb9e4b1);logger[_0xf677('0x12')](_0xf677('0x19'),_0xb9e4b1,JSON[_0xf677('0x14')](_0x2e3244));_0x24e220(_0x2e3244);})[_0xf677('0x18')](function(_0x1fc00d){logger[_0xf677('0x15')]('UpdateWhatsappInteraction',_0x1fc00d[_0xf677('0x16')],_0xb9e4b1);_0x299c47(_0x25a687[_0xf677('0x15')](0x1f4,_0x1fc00d['message']));});});};exports[_0xf677('0x22')]=function(_0x2885f4){return new Promise(function(_0x3f06c0,_0x4f25de){return db[_0xf677('0x1a')][_0xf677('0x23')]({'where':_0x2885f4['options']?_0x2885f4[_0xf677('0x1d')][_0xf677('0x1f')]||null:null})[_0xf677('0x21')](function(_0x396c6c){if(_0x396c6c){return _0x396c6c[_0xf677('0x24')](_0x2885f4[_0xf677('0x1c')][_0xf677('0x25')],_[_0xf677('0x26')](_0x2885f4[_0xf677('0x1c')],[_0xf677('0x25'),'id'])||{});}})['spread'](function(_0x491473){logger[_0xf677('0xf')](_0xf677('0x27'),_0x2885f4);logger[_0xf677('0x12')](_0xf677('0x27'),_0x2885f4,JSON['stringify'](_0x491473));_0x3f06c0(_0x491473);})[_0xf677('0x18')](function(_0x1bf7dc){logger[_0xf677('0x15')](_0xf677('0x27'),_0x1bf7dc['message'],_0x2885f4);_0x4f25de(_this[_0xf677('0x15')](0x1f4,_0x1bf7dc[_0xf677('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ab96c05..2346964 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 _0x8a15=['update','emit','removeListener','length','whatsappInteraction:','save','remove'];(function(_0x547640,_0x579b2a){var _0x481c2a=function(_0x4a972f){while(--_0x4a972f){_0x547640['push'](_0x547640['shift']());}};_0x481c2a(++_0x579b2a);}(_0x8a15,0xd0));var _0x58a1=function(_0x4413a1,_0x55a868){_0x4413a1=_0x4413a1-0x0;var _0x184cf3=_0x8a15[_0x4413a1];return _0x184cf3;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x58a1('0x0'),_0x58a1('0x1'),_0x58a1('0x2')];function createListener(_0x4e6bc7,_0x17da95){return function(_0x37ca08){_0x17da95[_0x58a1('0x3')](_0x4e6bc7,_0x37ca08);};}function removeListener(_0x3461b7,_0x5ce80c){return function(){WhatsappInteractionEvents[_0x58a1('0x4')](_0x3461b7,_0x5ce80c);};}exports['register']=function(_0x16b160){for(var _0x383113=0x0,_0x3d88a=events[_0x58a1('0x5')];_0x383113<_0x3d88a;_0x383113++){var _0x26ff74=events[_0x383113];var _0x160699=createListener(_0x58a1('0x6')+_0x26ff74,_0x16b160);WhatsappInteractionEvents['on'](_0x26ff74,_0x160699);}}; \ No newline at end of file +var _0x369a=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x57ef91,_0x27e0e9){var _0x1e0655=function(_0x314f44){while(--_0x314f44){_0x57ef91['push'](_0x57ef91['shift']());}};_0x1e0655(++_0x27e0e9);}(_0x369a,0x1ea));var _0xa369=function(_0x4cea07,_0x1d68f3){_0x4cea07=_0x4cea07-0x0;var _0x365fce=_0x369a[_0x4cea07];return _0x365fce;};'use strict';var WhatsappInteractionEvents=require(_0xa369('0x0'));var events=[_0xa369('0x1'),_0xa369('0x2'),_0xa369('0x3')];function createListener(_0x4626e8,_0x139d68){return function(_0x138936){_0x139d68[_0xa369('0x4')](_0x4626e8,_0x138936);};}function removeListener(_0x1455d7,_0x10ab00){return function(){WhatsappInteractionEvents[_0xa369('0x5')](_0x1455d7,_0x10ab00);};}exports[_0xa369('0x6')]=function(_0x3e69c4){for(var _0x2ec84d=0x0,_0x2cce3f=events[_0xa369('0x7')];_0x2ec84d<_0x2cce3f;_0x2ec84d++){var _0x1bb329=events[_0x2ec84d];var _0x4cba01=createListener(_0xa369('0x8')+_0x1bb329,_0x3e69c4);WhatsappInteractionEvents['on'](_0x1bb329,_0x4cba01);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1466569..fe5ea03 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 _0xb013=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2b0352,_0x11756b){var _0x3e2a75=function(_0x226284){while(--_0x226284){_0x2b0352['push'](_0x2b0352['shift']());}};_0x3e2a75(++_0x11756b);}(_0xb013,0x11b));var _0x3b01=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb013[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3b01('0x0'));var util=require(_0x3b01('0x1'));var path=require(_0x3b01('0x2'));var timeout=require(_0x3b01('0x3'));var express=require('express');var router=express[_0x3b01('0x4')]();var fs_extra=require(_0x3b01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3b01('0x6'));var config=require(_0x3b01('0x7'));var controller=require(_0x3b01('0x8'));router[_0x3b01('0x9')]('/',auth['isAuthenticated'](),controller[_0x3b01('0xa')]);router[_0x3b01('0x9')](_0x3b01('0xb'),auth[_0x3b01('0xc')](),controller[_0x3b01('0xd')]);router[_0x3b01('0x9')](_0x3b01('0xe'),auth['isAuthenticated'](),controller[_0x3b01('0xf')]);router[_0x3b01('0x10')]('/',auth[_0x3b01('0xc')](),interaction[_0x3b01('0x11')](_0x3b01('0x12'),_0x3b01('0x13')),controller[_0x3b01('0x14')]);router[_0x3b01('0x10')](_0x3b01('0x15'),controller[_0x3b01('0x16')]);router['put'](_0x3b01('0xe'),auth[_0x3b01('0xc')](),controller[_0x3b01('0x17')]);router[_0x3b01('0x18')](_0x3b01('0x19'),auth['isAuthenticated'](),controller[_0x3b01('0x1a')]);router[_0x3b01('0x18')](_0x3b01('0x1b'),auth['isAuthenticated'](),controller[_0x3b01('0x1c')]);router[_0x3b01('0x1d')](_0x3b01('0xe'),auth[_0x3b01('0xc')](),controller[_0x3b01('0x1e')]);module[_0x3b01('0x1f')]=router; \ No newline at end of file +var _0xbd05=['create','status','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xbd05,0xd4));var _0x5bd0=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xbd05[_0x58b301];return _0x2171b3;};'use strict';var multer=require(_0x5bd0('0x0'));var util=require(_0x5bd0('0x1'));var path=require(_0x5bd0('0x2'));var timeout=require(_0x5bd0('0x3'));var express=require(_0x5bd0('0x4'));var router=express['Router']();var fs_extra=require(_0x5bd0('0x5'));var auth=require(_0x5bd0('0x6'));var interaction=require(_0x5bd0('0x7'));var config=require(_0x5bd0('0x8'));var controller=require(_0x5bd0('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5bd0('0xa')](_0x5bd0('0xb'),auth[_0x5bd0('0xc')](),controller[_0x5bd0('0xd')]);router['get'](_0x5bd0('0xe'),auth['isAuthenticated'](),controller[_0x5bd0('0xf')]);router[_0x5bd0('0x10')]('/',auth[_0x5bd0('0xc')](),interaction[_0x5bd0('0x11')](_0x5bd0('0x12'),_0x5bd0('0x13')),controller[_0x5bd0('0x14')]);router[_0x5bd0('0x10')]('/:id/status',controller[_0x5bd0('0x15')]);router[_0x5bd0('0x16')]('/:id',auth[_0x5bd0('0xc')](),controller[_0x5bd0('0x17')]);router['put'](_0x5bd0('0x18'),auth[_0x5bd0('0xc')](),controller[_0x5bd0('0x19')]);router[_0x5bd0('0x16')](_0x5bd0('0x1a'),auth[_0x5bd0('0xc')](),controller['reject']);router[_0x5bd0('0x1b')](_0x5bd0('0xe'),auth[_0x5bd0('0xc')](),controller['destroy']);module[_0x5bd0('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 ead8e1c..f8239d6 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 _0xd16a=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x1b3d60,_0x51583b){var _0x4abc3d=function(_0x5c9acb){while(--_0x5c9acb){_0x1b3d60['push'](_0x1b3d60['shift']());}};_0x4abc3d(++_0x51583b);}(_0xd16a,0x151));var _0xad16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd16a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xad16('0x0'));module[_0xad16('0x1')]={'body':{'type':Sequelize[_0xad16('0x2')](_0xad16('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xad16('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xad16('0x5')]('in','out'),'defaultValue':_0xad16('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xad16('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xad16('0x8')]},'secret':{'type':Sequelize[_0xad16('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xad16('0x2')]}}; \ No newline at end of file +var _0x894b=['exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x26cca6,_0x3e6a96){var _0x47ba15=function(_0x500c88){while(--_0x500c88){_0x26cca6['push'](_0x26cca6['shift']());}};_0x47ba15(++_0x3e6a96);}(_0x894b,0x18f));var _0xb894=function(_0x50c9ee,_0x3f06a7){_0x50c9ee=_0x50c9ee-0x0;var _0x4c5fd2=_0x894b[_0x50c9ee];return _0x4c5fd2;};'use strict';var Sequelize=require('sequelize');module[_0xb894('0x0')]={'body':{'type':Sequelize[_0xb894('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb894('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb894('0x3')]('in',_0xb894('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb894('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb894('0x5')]},'readAt':{'type':Sequelize[_0xb894('0x6')]},'secret':{'type':Sequelize[_0xb894('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb894('0x5')]},'providerResponse':{'type':Sequelize[_0xb894('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 91778c9..0708929 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 _0xf025=['../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','end','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','length','find','create','params','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE: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','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x589002,_0x1c9c42){var _0x1ebe5a=function(_0x7f9547){while(--_0x7f9547){_0x589002['push'](_0x589002['shift']());}};_0x1ebe5a(++_0x1c9c42);}(_0xf025,0x17f));var _0x5f02=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xf025[_0x4fbb15];return _0x436338;};'use strict';var emlformat=require(_0x5f02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f02('0x1'));var rp=require(_0x5f02('0x2'));var moment=require(_0x5f02('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5f02('0x4'));var path=require(_0x5f02('0x5'));var sox=require('sox');var csv=require(_0x5f02('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f02('0x7'));var squel=require(_0x5f02('0x8'));var crypto=require(_0x5f02('0x9'));var jsforce=require(_0x5f02('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5f02('0x6'));var querystring=require('querystring');var Papa=require(_0x5f02('0xb'));var Redis=require(_0x5f02('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5f02('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f02('0xe'))('api');var utils=require(_0x5f02('0xf'));var config=require(_0x5f02('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f02('0x11'))['db'];config[_0x5f02('0x12')]=_[_0x5f02('0x13')](config[_0x5f02('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f02('0x14'))(new Redis(config[_0x5f02('0x12')]));require(_0x5f02('0x15'))[_0x5f02('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5f02('0x17')][_0x5f02('0x18')]({'port':0x232c});var client9002=jayson[_0x5f02('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31bcb0,_0x12cea2,_0x2fcecc,_0x4391f6){return new BPromise(function(_0x249b10,_0x2e5f6b){var _0x4c87f1=_0x4391f6||client;return _0x4c87f1[_0x5f02('0x19')](_0x31bcb0,_0x2fcecc)[_0x5f02('0x1a')](function(_0xe4c8a5){logger[_0x5f02('0x1b')](_0x5f02('0x1c'),_0x12cea2,_0x5f02('0x1d'));logger['debug'](_0x5f02('0x1e'),_0x12cea2,'request\x20sent',JSON[_0x5f02('0x1f')](_0xe4c8a5));if(_0xe4c8a5[_0x5f02('0x20')]){if(_0xe4c8a5['error']['code']===0x1f4){logger[_0x5f02('0x20')](_0x5f02('0x1c'),_0x12cea2,_0xe4c8a5[_0x5f02('0x20')][_0x5f02('0x21')]);return _0x2e5f6b(_0xe4c8a5[_0x5f02('0x20')]['message']);}logger[_0x5f02('0x20')](_0x5f02('0x1c'),_0x12cea2,_0xe4c8a5[_0x5f02('0x20')][_0x5f02('0x21')]);return _0x249b10(_0xe4c8a5['error'][_0x5f02('0x21')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x12cea2,_0x5f02('0x1d'));_0x249b10(_0xe4c8a5['result'][_0x5f02('0x21')]);}})[_0x5f02('0x22')](function(_0x4b7ed5){logger['error'](_0x5f02('0x1c'),_0x12cea2,_0x4b7ed5);_0x2e5f6b(_0x4b7ed5);});});}function respondWithStatusCode(_0x46d1f0,_0x225d04){_0x225d04=_0x225d04||0xcc;return function(_0x1fec38){if(_0x1fec38){return _0x46d1f0[_0x5f02('0x23')](_0x225d04);}return _0x46d1f0[_0x5f02('0x24')](_0x225d04)['end']();};}function respondWithResult(_0x447651,_0x3544c3){_0x3544c3=_0x3544c3||0xc8;return function(_0x20b841){if(_0x20b841){return _0x447651[_0x5f02('0x24')](_0x3544c3)[_0x5f02('0x25')](_0x20b841);}};}function respondWithFilteredResult(_0x187e4e,_0x537503){return function(_0x416789){if(_0x416789){var _0x37f5ed=typeof _0x537503[_0x5f02('0x26')]==='undefined'&&typeof _0x537503['limit']===_0x5f02('0x27');var _0x374c1e=_0x416789[_0x5f02('0x28')];var _0x11a250=_0x37f5ed?0x0:_0x537503[_0x5f02('0x26')];var _0x2a792a=_0x37f5ed?_0x416789[_0x5f02('0x28')]:_0x537503[_0x5f02('0x26')]+_0x537503[_0x5f02('0x29')];var _0x4e3b20;if(_0x2a792a>=_0x374c1e){_0x2a792a=_0x374c1e;_0x4e3b20=0xc8;}else{_0x4e3b20=0xce;}_0x187e4e[_0x5f02('0x24')](_0x4e3b20);return _0x187e4e[_0x5f02('0x2a')](_0x5f02('0x2b'),_0x11a250+'-'+_0x2a792a+'/'+_0x374c1e)[_0x5f02('0x25')](_0x416789);}return null;};}function patchUpdates(_0x557671){return function(_0x2753e9){try{jsonpatch['apply'](_0x2753e9,_0x557671,!![]);}catch(_0x40d13e){return BPromise['reject'](_0x40d13e);}return _0x2753e9['save']();};}function saveUpdates(_0x3a392e,_0x1b2492){return function(_0x5adb09){if(_0x5adb09){return _0x5adb09[_0x5f02('0x2c')](_0x3a392e)[_0x5f02('0x1a')](function(_0x37023e){return _0x37023e;});}return null;};}function removeEntity(_0x3ccef7,_0x2142e2){return function(_0x55fecb){if(_0x55fecb){return _0x55fecb['destroy']()[_0x5f02('0x1a')](function(){_0x3ccef7[_0x5f02('0x24')](0xcc)[_0x5f02('0x2d')]();});}};}function handleEntityNotFound(_0x36fea6,_0x370c28){return function(_0x27418c){if(!_0x27418c){_0x36fea6[_0x5f02('0x23')](0x194);}return _0x27418c;};}function handleError(_0x7145e3,_0xf8be88){_0xf8be88=_0xf8be88||0x1f4;return function(_0x5811d7){logger[_0x5f02('0x20')](_0x5811d7[_0x5f02('0x2e')]);if(_0x5811d7[_0x5f02('0x2f')]){delete _0x5811d7[_0x5f02('0x2f')];}_0x7145e3[_0x5f02('0x24')](_0xf8be88)[_0x5f02('0x30')](_0x5811d7);};}exports['index']=function(_0x2f31a2,_0x4e33ef){var _0x489072={},_0x489774={},_0xe97ac2={'count':0x0,'rows':[]};var _0x1dcebf=_[_0x5f02('0x31')](db[_0x5f02('0x32')][_0x5f02('0x33')],function(_0x2fcd02){return{'name':_0x2fcd02[_0x5f02('0x34')],'type':_0x2fcd02['type']['key']};});_0x489774[_0x5f02('0x35')]=_['map'](_0x1dcebf,_0x5f02('0x2f'));_0x489774[_0x5f02('0x36')]=_[_0x5f02('0x37')](_0x2f31a2[_0x5f02('0x36')]);_0x489774['filters']=_[_0x5f02('0x38')](_0x489774[_0x5f02('0x35')],_0x489774['query']);_0x489072[_0x5f02('0x39')]=_[_0x5f02('0x38')](_0x489774[_0x5f02('0x35')],qs[_0x5f02('0x3a')](_0x2f31a2['query'][_0x5f02('0x3a')]));_0x489072[_0x5f02('0x39')]=_0x489072[_0x5f02('0x39')]['length']?_0x489072[_0x5f02('0x39')]:_0x489774[_0x5f02('0x35')];if(!_0x2f31a2['query'][_0x5f02('0x3b')](_0x5f02('0x3c'))){_0x489072[_0x5f02('0x29')]=qs[_0x5f02('0x29')](_0x2f31a2['query'][_0x5f02('0x29')]);_0x489072['offset']=qs[_0x5f02('0x26')](_0x2f31a2[_0x5f02('0x36')]['offset']);}_0x489072[_0x5f02('0x3d')]=qs[_0x5f02('0x3e')](_0x2f31a2[_0x5f02('0x36')][_0x5f02('0x3e')]);_0x489072['where']=qs['filters'](_[_0x5f02('0x3f')](_0x2f31a2['query'],_0x489774['filters']),_0x1dcebf);if(_0x2f31a2['query'][_0x5f02('0x40')]){_0x489072[_0x5f02('0x41')]=_['merge'](_0x489072[_0x5f02('0x41')],{'$or':_[_0x5f02('0x31')](_0x1dcebf,function(_0x1e2560){if(_0x1e2560[_0x5f02('0x42')]!==_0x5f02('0x43')){var _0x1d1815={};_0x1d1815[_0x1e2560[_0x5f02('0x2f')]]={'$like':'%'+_0x2f31a2['query'][_0x5f02('0x40')]+'%'};return _0x1d1815;}})});}_0x489072=_[_0x5f02('0x44')]({},_0x489072,_0x2f31a2[_0x5f02('0x45')]);var _0x158528={'where':_0x489072[_0x5f02('0x41')]};return db[_0x5f02('0x32')][_0x5f02('0x28')](_0x158528)['then'](function(_0x15cd74){_0xe97ac2['count']=_0x15cd74;if(_0x2f31a2[_0x5f02('0x36')][_0x5f02('0x46')]){_0x489072[_0x5f02('0x47')]=[{'all':!![]}];}return db[_0x5f02('0x32')][_0x5f02('0x48')](_0x489072);})[_0x5f02('0x1a')](function(_0x2482c8){_0xe97ac2[_0x5f02('0x49')]=_0x2482c8;return _0xe97ac2;})[_0x5f02('0x1a')](respondWithFilteredResult(_0x4e33ef,_0x489072))[_0x5f02('0x22')](handleError(_0x4e33ef,null));};exports[_0x5f02('0x4a')]=function(_0x2aca96,_0x53c2cf){var _0x5efaf9={'raw':!![],'where':{'id':_0x2aca96['params']['id']}},_0x3e6b3f={};_0x3e6b3f[_0x5f02('0x35')]=_[_0x5f02('0x37')](db[_0x5f02('0x32')][_0x5f02('0x33')]);_0x3e6b3f[_0x5f02('0x36')]=_[_0x5f02('0x37')](_0x2aca96[_0x5f02('0x36')]);_0x3e6b3f['filters']=_[_0x5f02('0x38')](_0x3e6b3f[_0x5f02('0x35')],_0x3e6b3f[_0x5f02('0x36')]);_0x5efaf9['attributes']=_[_0x5f02('0x38')](_0x3e6b3f[_0x5f02('0x35')],qs['fields'](_0x2aca96['query'][_0x5f02('0x3a')]));_0x5efaf9[_0x5f02('0x39')]=_0x5efaf9[_0x5f02('0x39')][_0x5f02('0x4b')]?_0x5efaf9['attributes']:_0x3e6b3f[_0x5f02('0x35')];if(_0x2aca96[_0x5f02('0x36')][_0x5f02('0x46')]){_0x5efaf9[_0x5f02('0x47')]=[{'all':!![]}];}_0x5efaf9=_[_0x5f02('0x44')]({},_0x5efaf9,_0x2aca96[_0x5f02('0x45')]);return db[_0x5f02('0x32')][_0x5f02('0x4c')](_0x5efaf9)[_0x5f02('0x1a')](handleEntityNotFound(_0x53c2cf,null))[_0x5f02('0x1a')](respondWithResult(_0x53c2cf,null))[_0x5f02('0x22')](handleError(_0x53c2cf,null));};exports[_0x5f02('0x4d')]=function(_0x3f8f4b,_0x57be5c){return db[_0x5f02('0x32')]['create'](_0x3f8f4b['body'],{})[_0x5f02('0x1a')](respondWithResult(_0x57be5c,0xc9))[_0x5f02('0x22')](handleError(_0x57be5c,null));};exports['update']=function(_0x20009f,_0x31bc70){if(_0x20009f['body']['id']){delete _0x20009f['body']['id'];}return db[_0x5f02('0x32')][_0x5f02('0x4c')]({'where':{'id':_0x20009f[_0x5f02('0x4e')]['id']}})[_0x5f02('0x1a')](handleEntityNotFound(_0x31bc70,null))[_0x5f02('0x1a')](saveUpdates(_0x20009f[_0x5f02('0x4f')],null))[_0x5f02('0x1a')](respondWithResult(_0x31bc70,null))[_0x5f02('0x22')](handleError(_0x31bc70,null));};exports['destroy']=function(_0x5d0416,_0x3d55c2){return db['WhatsappMessage']['find']({'where':{'id':_0x5d0416[_0x5f02('0x4e')]['id']}})[_0x5f02('0x1a')](handleEntityNotFound(_0x3d55c2,null))[_0x5f02('0x1a')](removeEntity(_0x3d55c2,null))[_0x5f02('0x22')](handleError(_0x3d55c2,null));};exports['describe']=function(_0x5970e4,_0x2433b8){return db[_0x5f02('0x32')][_0x5f02('0x50')]()[_0x5f02('0x1a')](respondWithResult(_0x2433b8,null))[_0x5f02('0x22')](handleError(_0x2433b8,null));};var interaction_log=require(_0x5f02('0xe'))(_0x5f02('0x51'));exports[_0x5f02('0x52')]=function(_0x129bcf,_0x3166f,_0x3f1280){var _0x228f2c={'agent':{},'channel':_0x5f02('0x53')};if(_0x129bcf[_0x5f02('0x4f')]['id']){delete _0x129bcf[_0x5f02('0x4f')]['id'];}_0x129bcf['body'][_0x5f02('0x54')]=!![];_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x55')]=moment()['format'](_0x5f02('0x56'));_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x57')]=_0x129bcf['body'][_0x5f02('0x57')]||_0x129bcf[_0x5f02('0x58')]['id'];_0x228f2c[_0x5f02('0x59')]['id']=_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x57')];return db[_0x5f02('0x32')][_0x5f02('0x4c')]({'where':{'id':_0x129bcf[_0x5f02('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3166f,null))['then'](saveUpdates(_0x129bcf[_0x5f02('0x4f')],null))['then'](function(_0x5e16d0){if(_0x5e16d0){_0x228f2c[_0x5f02('0x21')]=_0x5e16d0['get']({'plain':!![]});return db[_0x5f02('0x5a')]['find']({'where':{'id':_0x5e16d0[_0x5f02('0x5b')]}});}return null;})[_0x5f02('0x1a')](handleEntityNotFound(_0x3166f,null))[_0x5f02('0x1a')](function(_0x917287){if(_0x917287){return _0x917287['update']({'UserId':_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x57')],'read1stAt':_[_0x5f02('0x5c')](_0x917287[_0x5f02('0x5d')])?moment()[_0x5f02('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x44aab9){if(_0x44aab9){_0x228f2c[_0x5f02('0x5f')]=_0x44aab9[_0x5f02('0x60')]({'plain':!![]});interaction_log[_0x5f02('0x1b')](_0x5f02('0x61'),_0x129bcf[_0x5f02('0x58')]['id'],_0x129bcf['user']['name'],_0x129bcf[_0x5f02('0x58')][_0x5f02('0x62')],_0x228f2c[_0x5f02('0x5f')]['id'],_0x129bcf[_0x5f02('0x4f')]?JSON[_0x5f02('0x1f')](_0x129bcf['body']):_0x5f02('0x63'));return respondWithRpcPromise(_0x5f02('0x64'),'acceptMessage',_0x228f2c);}return null;})[_0x5f02('0x1a')](function(_0x49d449){var _0x5c0591=_0x5f02('0x65')+_0x49d449['message'][_0x5f02('0x66')];return db[_0x5f02('0x67')][_0x5f02('0x36')](_0x5c0591,{'type':db[_0x5f02('0x68')][_0x5f02('0x69')][_0x5f02('0x6a')],'raw':!![]})[_0x5f02('0x1a')](function(_0x214f90){return _0x214f90;});})[_0x5f02('0x1a')](function(_0x2e5fd6){if(_0x2e5fd6){_0x228f2c[_0x5f02('0x21')][_0x5f02('0x6b')]=_0x2e5fd6[0x0];if(!_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x57')])return;return db[_0x5f02('0x6c')][_0x5f02('0x4c')]({'where':{'id':_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x57')],'role':_0x5f02('0x59')},'attributes':['id',_0x5f02('0x2f'),_0x5f02('0x6d'),_0x5f02('0x6e'),_0x5f02('0x6f')],'raw':!![]});}return null;})['then'](function(_0x3b911c){if(!_0x3b911c)return null;_0x228f2c[_0x5f02('0x21')][_0x5f02('0x59')]=_0x3b911c;return _0x228f2c;})[_0x5f02('0x1a')](function(_0x46ee41){if(_0x46ee41){if(_0x129bcf[_0x5f02('0x4f')][_0x5f02('0x70')]){_0x228f2c['message']['interface']=util['format']('SIP/%s',_0x129bcf['user'][_0x5f02('0x2f')]);_0x228f2c['message'][_0x5f02('0x71')]=_0x228f2c[_0x5f02('0x71')];_0x228f2c['message'][_0x5f02('0x72')]=_0x228f2c['channel'];_0x228f2c['message'][_0x5f02('0x73')]=_0x5f02('0x52');return respondWithRpcPromise(_0x5f02('0x74'),_0x5f02('0x74'),{'event':_0x5f02('0x75'),'message':_0x228f2c[_0x5f02('0x21')]},client9002)['then'](function(){return _0x228f2c;});}return _0x228f2c;}return null;})[_0x5f02('0x1a')](respondWithResult(_0x3166f,null))[_0x5f02('0x22')](handleError(_0x3166f,null));};var interaction_log=require(_0x5f02('0xe'))(_0x5f02('0x51'));exports[_0x5f02('0x76')]=function(_0x155ac8,_0x14da0b,_0x3c3a54){var _0x4dc5aa={'agent':{},'channel':_0x5f02('0x53')};if(_0x155ac8[_0x5f02('0x4f')]['id']){delete _0x155ac8['body']['id'];}_0x155ac8[_0x5f02('0x4f')][_0x5f02('0x57')]=_0x155ac8['body'][_0x5f02('0x57')]||_0x155ac8[_0x5f02('0x58')]['id'];_0x4dc5aa['agent']['id']=_0x155ac8['body']['UserId'];return db['WhatsappMessage'][_0x5f02('0x4c')]({'where':{'id':_0x155ac8[_0x5f02('0x4e')]['id'],'UserId':null}})[_0x5f02('0x1a')](handleEntityNotFound(_0x14da0b,null))[_0x5f02('0x1a')](function(_0x25d4f7){if(_0x25d4f7){_0x4dc5aa[_0x5f02('0x21')]=_0x25d4f7[_0x5f02('0x60')]({'plain':!![]});return db[_0x5f02('0x5a')]['find']({'where':{'id':_0x25d4f7[_0x5f02('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x14da0b,null))['then'](function(_0x18755c){if(_0x18755c){_0x4dc5aa[_0x5f02('0x5f')]=_0x18755c['get']({'plain':!![]});interaction_log[_0x5f02('0x1b')](_0x5f02('0x77'),_0x155ac8['user']['id'],_0x155ac8[_0x5f02('0x58')][_0x5f02('0x2f')],_0x155ac8[_0x5f02('0x58')][_0x5f02('0x62')],_0x4dc5aa['interaction']['id'],_0x155ac8['body']?JSON[_0x5f02('0x1f')](_0x155ac8[_0x5f02('0x4f')]):_0x5f02('0x63'));return respondWithRpcPromise(_0x5f02('0x78'),_0x5f02('0x79'),_0x4dc5aa);}return null;})[_0x5f02('0x1a')](function(_0x24b95c){var _0x225627='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24b95c['message'][_0x5f02('0x66')];return db['sequelize'][_0x5f02('0x36')](_0x225627,{'type':db[_0x5f02('0x68')]['QueryTypes'][_0x5f02('0x6a')],'raw':!![]})[_0x5f02('0x1a')](function(_0xf1af2f){return _0xf1af2f;});})[_0x5f02('0x1a')](function(_0x47d9eb){if(_0x47d9eb){_0x4dc5aa['message']['contact']=_0x47d9eb[0x0];if(!_0x155ac8[_0x5f02('0x4f')]['UserId'])return;return db[_0x5f02('0x6c')][_0x5f02('0x4c')]({'where':{'id':_0x155ac8[_0x5f02('0x4f')]['UserId'],'role':_0x5f02('0x59')},'attributes':['id','name','fullname',_0x5f02('0x6e'),_0x5f02('0x6f')],'raw':!![]});}return null;})[_0x5f02('0x1a')](function(_0x71e80c){if(!_0x71e80c)return null;_0x4dc5aa[_0x5f02('0x21')]['agent']=_0x71e80c;return _0x4dc5aa;})[_0x5f02('0x1a')](function(_0x3fce64){if(_0x3fce64){_0x3fce64[_0x5f02('0x21')]['interface']=util['format'](_0x5f02('0x7a'),_0x155ac8[_0x5f02('0x58')][_0x5f02('0x2f')]);_0x3fce64[_0x5f02('0x21')][_0x5f02('0x71')]=_0x4dc5aa[_0x5f02('0x71')];_0x3fce64[_0x5f02('0x21')][_0x5f02('0x72')]=_0x4dc5aa[_0x5f02('0x71')];_0x3fce64[_0x5f02('0x21')][_0x5f02('0x73')]=_0x5f02('0x76');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x3fce64[_0x5f02('0x21')]},client9002);return _0x4dc5aa;}return null;})['then'](respondWithResult(_0x14da0b,null))['catch'](handleError(_0x14da0b,null));};exports[_0x5f02('0x24')]=function(_0x51daa9,_0x2ec1f7,_0x3ccbee){if(_0x51daa9['body']['id']){delete _0x51daa9['body']['id'];}var _0x9ee2a4;return db[_0x5f02('0x32')][_0x5f02('0x4c')]({'where':{'id':_0x51daa9[_0x5f02('0x4e')]['id']}})[_0x5f02('0x1a')](handleEntityNotFound(_0x2ec1f7,null))[_0x5f02('0x1a')](function(_0x3162dc){if(_0x3162dc){_0x9ee2a4=_0x3162dc;return db[_0x5f02('0x7b')][_0x5f02('0x4c')]({'where':{'id':_0x3162dc[_0x5f02('0x7c')]}});}})[_0x5f02('0x1a')](handleEntityNotFound(_0x2ec1f7,null))['then'](function(_0x2a2473){if(_0x2a2473){logger[_0x5f02('0x7d')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x5f02('0x24'),_0x5f02('0x7e'),_0x2a2473[_0x5f02('0x42')],util[_0x5f02('0x7f')](_0x51daa9[_0x5f02('0x4f')],{'showHidden':![],'depth':null}));switch(_0x2a2473['type']){case'twilio':if(_0x51daa9[_0x5f02('0x4f')][_0x5f02('0x80')]&&_0x51daa9[_0x5f02('0x4f')][_0x5f02('0x80')]===_0x9ee2a4[_0x5f02('0x81')]&&_0x51daa9[_0x5f02('0x4f')]['MessageStatus']&&_0x51daa9['body'][_0x5f02('0x82')]==='read'){return _0x9ee2a4[_0x5f02('0x2c')]({'read':!![]});}else{logger['error'](_0x5f02('0x83'),'status',_0x5f02('0x84'),util[_0x5f02('0x7f')](_0x51daa9[_0x5f02('0x4f')],{'showHidden':![],'depth':null}));}break;}return _0x9ee2a4;}})['then'](respondWithResult(_0x2ec1f7,null))[_0x5f02('0x22')](handleError(_0x2ec1f7,null));}; \ No newline at end of file +var _0x388b=['../../config/environment','../../mysqldb','redis','defaults','localhost','client','http','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','intersection','merge','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','reject','WhatsappInteractionId','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SIP/%s','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x388b,0x73));var _0xb388=function(_0x2d0270,_0x104042){_0x2d0270=_0x2d0270-0x0;var _0x4b8643=_0x388b[_0x2d0270];return _0x4b8643;};'use strict';var emlformat=require(_0xb388('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb388('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb388('0x2'));var moment=require(_0xb388('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb388('0x4'));var util=require(_0xb388('0x5'));var path=require(_0xb388('0x6'));var sox=require(_0xb388('0x7'));var csv=require(_0xb388('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb388('0x9'));var _=require(_0xb388('0xa'));var squel=require(_0xb388('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb388('0x8'));var querystring=require('querystring');var Papa=require(_0xb388('0xc'));var Redis=require(_0xb388('0xd'));var authService=require(_0xb388('0xe'));var qs=require(_0xb388('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb388('0x10'));var logger=require(_0xb388('0x11'))(_0xb388('0x12'));var utils=require(_0xb388('0x13'));var config=require(_0xb388('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb388('0x15'))['db'];config[_0xb388('0x16')]=_[_0xb388('0x17')](config[_0xb388('0x16')],{'host':_0xb388('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb388('0x16')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xb388('0x19')][_0xb388('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xb388('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4be120,_0x5c89e9,_0x1786ce,_0x244c74){return new BPromise(function(_0x5661f3,_0x47f38a){var _0x4052e8=_0x244c74||client;return _0x4052e8['request'](_0x4be120,_0x1786ce)[_0xb388('0x1b')](function(_0x221213){logger[_0xb388('0x1c')]('WhatsappMessage,\x20%s,\x20%s',_0x5c89e9,_0xb388('0x1d'));logger[_0xb388('0x1e')](_0xb388('0x1f'),_0x5c89e9,'request\x20sent',JSON[_0xb388('0x20')](_0x221213));if(_0x221213['error']){if(_0x221213['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5c89e9,_0x221213[_0xb388('0x21')][_0xb388('0x22')]);return _0x47f38a(_0x221213[_0xb388('0x21')]['message']);}logger[_0xb388('0x21')](_0xb388('0x23'),_0x5c89e9,_0x221213[_0xb388('0x21')][_0xb388('0x22')]);return _0x5661f3(_0x221213['error'][_0xb388('0x22')]);}else{logger[_0xb388('0x1c')]('WhatsappMessage,\x20%s,\x20%s',_0x5c89e9,_0xb388('0x1d'));_0x5661f3(_0x221213['result'][_0xb388('0x22')]);}})[_0xb388('0x24')](function(_0x28f199){logger['error'](_0xb388('0x23'),_0x5c89e9,_0x28f199);_0x47f38a(_0x28f199);});});}function respondWithStatusCode(_0x1ef08b,_0x4b7fde){_0x4b7fde=_0x4b7fde||0xcc;return function(_0x53106f){if(_0x53106f){return _0x1ef08b[_0xb388('0x25')](_0x4b7fde);}return _0x1ef08b[_0xb388('0x26')](_0x4b7fde)[_0xb388('0x27')]();};}function respondWithResult(_0x5157db,_0x4cb0dd){_0x4cb0dd=_0x4cb0dd||0xc8;return function(_0x2a2f7a){if(_0x2a2f7a){return _0x5157db['status'](_0x4cb0dd)[_0xb388('0x28')](_0x2a2f7a);}};}function respondWithFilteredResult(_0x3a8158,_0x413645){return function(_0x501873){if(_0x501873){var _0x251718=typeof _0x413645[_0xb388('0x29')]===_0xb388('0x2a')&&typeof _0x413645[_0xb388('0x2b')]===_0xb388('0x2a');var _0x28f631=_0x501873[_0xb388('0x2c')];var _0x40eeb3=_0x251718?0x0:_0x413645[_0xb388('0x29')];var _0x394ae6=_0x251718?_0x501873[_0xb388('0x2c')]:_0x413645[_0xb388('0x29')]+_0x413645['limit'];var _0x4f5e5e;if(_0x394ae6>=_0x28f631){_0x394ae6=_0x28f631;_0x4f5e5e=0xc8;}else{_0x4f5e5e=0xce;}_0x3a8158[_0xb388('0x26')](_0x4f5e5e);return _0x3a8158[_0xb388('0x2d')](_0xb388('0x2e'),_0x40eeb3+'-'+_0x394ae6+'/'+_0x28f631)[_0xb388('0x28')](_0x501873);}return null;};}function patchUpdates(_0x59305a){return function(_0x2b1e87){try{jsonpatch[_0xb388('0x2f')](_0x2b1e87,_0x59305a,!![]);}catch(_0x4e9817){return BPromise['reject'](_0x4e9817);}return _0x2b1e87[_0xb388('0x30')]();};}function saveUpdates(_0x59d5f5,_0x5c6e40){return function(_0x41bc78){if(_0x41bc78){return _0x41bc78[_0xb388('0x31')](_0x59d5f5)[_0xb388('0x1b')](function(_0x2d0f55){return _0x2d0f55;});}return null;};}function removeEntity(_0x1fd95c,_0x5328da){return function(_0x56c24e){if(_0x56c24e){return _0x56c24e[_0xb388('0x32')]()['then'](function(){_0x1fd95c[_0xb388('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da5e3,_0x2a126e){return function(_0x87c920){if(!_0x87c920){_0x5da5e3[_0xb388('0x25')](0x194);}return _0x87c920;};}function handleError(_0x5d9a60,_0x55eb39){_0x55eb39=_0x55eb39||0x1f4;return function(_0x49fd51){logger[_0xb388('0x21')](_0x49fd51[_0xb388('0x33')]);if(_0x49fd51[_0xb388('0x34')]){delete _0x49fd51[_0xb388('0x34')];}_0x5d9a60[_0xb388('0x26')](_0x55eb39)['send'](_0x49fd51);};}exports[_0xb388('0x35')]=function(_0x4110aa,_0x45bbbe){var _0x132cbd={},_0x27ea4e={},_0xe96c18={'count':0x0,'rows':[]};var _0x5d7828=_[_0xb388('0x36')](db[_0xb388('0x37')][_0xb388('0x38')],function(_0x33caef){return{'name':_0x33caef[_0xb388('0x39')],'type':_0x33caef[_0xb388('0x3a')][_0xb388('0x3b')]};});_0x27ea4e[_0xb388('0x3c')]=_[_0xb388('0x36')](_0x5d7828,_0xb388('0x34'));_0x27ea4e[_0xb388('0x3d')]=_[_0xb388('0x3e')](_0x4110aa[_0xb388('0x3d')]);_0x27ea4e[_0xb388('0x3f')]=_['intersection'](_0x27ea4e[_0xb388('0x3c')],_0x27ea4e[_0xb388('0x3d')]);_0x132cbd[_0xb388('0x40')]=_['intersection'](_0x27ea4e[_0xb388('0x3c')],qs[_0xb388('0x41')](_0x4110aa['query']['fields']));_0x132cbd[_0xb388('0x40')]=_0x132cbd[_0xb388('0x40')][_0xb388('0x42')]?_0x132cbd[_0xb388('0x40')]:_0x27ea4e[_0xb388('0x3c')];if(!_0x4110aa[_0xb388('0x3d')][_0xb388('0x43')](_0xb388('0x44'))){_0x132cbd[_0xb388('0x2b')]=qs[_0xb388('0x2b')](_0x4110aa[_0xb388('0x3d')][_0xb388('0x2b')]);_0x132cbd[_0xb388('0x29')]=qs[_0xb388('0x29')](_0x4110aa[_0xb388('0x3d')]['offset']);}_0x132cbd['order']=qs[_0xb388('0x45')](_0x4110aa[_0xb388('0x3d')][_0xb388('0x45')]);_0x132cbd[_0xb388('0x46')]=qs[_0xb388('0x3f')](_[_0xb388('0x47')](_0x4110aa['query'],_0x27ea4e['filters']),_0x5d7828);if(_0x4110aa['query'][_0xb388('0x48')]){_0x132cbd[_0xb388('0x46')]=_['merge'](_0x132cbd[_0xb388('0x46')],{'$or':_['map'](_0x5d7828,function(_0x41a467){if(_0x41a467[_0xb388('0x3a')]!==_0xb388('0x49')){var _0x54cec3={};_0x54cec3[_0x41a467[_0xb388('0x34')]]={'$like':'%'+_0x4110aa[_0xb388('0x3d')][_0xb388('0x48')]+'%'};return _0x54cec3;}})});}_0x132cbd=_['merge']({},_0x132cbd,_0x4110aa[_0xb388('0x4a')]);var _0x434946={'where':_0x132cbd[_0xb388('0x46')]};return db[_0xb388('0x37')][_0xb388('0x2c')](_0x434946)[_0xb388('0x1b')](function(_0x2e4618){_0xe96c18['count']=_0x2e4618;if(_0x4110aa[_0xb388('0x3d')][_0xb388('0x4b')]){_0x132cbd[_0xb388('0x4c')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xb388('0x4d')](_0x132cbd);})[_0xb388('0x1b')](function(_0x4a1f64){_0xe96c18[_0xb388('0x4e')]=_0x4a1f64;return _0xe96c18;})[_0xb388('0x1b')](respondWithFilteredResult(_0x45bbbe,_0x132cbd))[_0xb388('0x24')](handleError(_0x45bbbe,null));};exports['show']=function(_0x1025ed,_0x2a30ba){var _0xba13e4={'raw':!![],'where':{'id':_0x1025ed['params']['id']}},_0x2212f8={};_0x2212f8[_0xb388('0x3c')]=_[_0xb388('0x3e')](db[_0xb388('0x37')][_0xb388('0x38')]);_0x2212f8[_0xb388('0x3d')]=_[_0xb388('0x3e')](_0x1025ed[_0xb388('0x3d')]);_0x2212f8[_0xb388('0x3f')]=_[_0xb388('0x4f')](_0x2212f8['model'],_0x2212f8['query']);_0xba13e4[_0xb388('0x40')]=_[_0xb388('0x4f')](_0x2212f8[_0xb388('0x3c')],qs[_0xb388('0x41')](_0x1025ed['query'][_0xb388('0x41')]));_0xba13e4['attributes']=_0xba13e4[_0xb388('0x40')]['length']?_0xba13e4['attributes']:_0x2212f8['model'];if(_0x1025ed[_0xb388('0x3d')]['includeAll']){_0xba13e4[_0xb388('0x4c')]=[{'all':!![]}];}_0xba13e4=_[_0xb388('0x50')]({},_0xba13e4,_0x1025ed[_0xb388('0x4a')]);return db[_0xb388('0x37')]['find'](_0xba13e4)[_0xb388('0x1b')](handleEntityNotFound(_0x2a30ba,null))['then'](respondWithResult(_0x2a30ba,null))[_0xb388('0x24')](handleError(_0x2a30ba,null));};exports[_0xb388('0x51')]=function(_0x79630c,_0x6a8ddb){return db[_0xb388('0x37')][_0xb388('0x51')](_0x79630c[_0xb388('0x52')],{})['then'](respondWithResult(_0x6a8ddb,0xc9))['catch'](handleError(_0x6a8ddb,null));};exports[_0xb388('0x31')]=function(_0x8554d4,_0xc0f391){if(_0x8554d4[_0xb388('0x52')]['id']){delete _0x8554d4['body']['id'];}return db[_0xb388('0x37')][_0xb388('0x53')]({'where':{'id':_0x8554d4[_0xb388('0x54')]['id']}})[_0xb388('0x1b')](handleEntityNotFound(_0xc0f391,null))[_0xb388('0x1b')](saveUpdates(_0x8554d4[_0xb388('0x52')],null))[_0xb388('0x1b')](respondWithResult(_0xc0f391,null))[_0xb388('0x24')](handleError(_0xc0f391,null));};exports['destroy']=function(_0x1d497c,_0x3f90b9){return db[_0xb388('0x37')][_0xb388('0x53')]({'where':{'id':_0x1d497c[_0xb388('0x54')]['id']}})[_0xb388('0x1b')](handleEntityNotFound(_0x3f90b9,null))[_0xb388('0x1b')](removeEntity(_0x3f90b9,null))[_0xb388('0x24')](handleError(_0x3f90b9,null));};exports[_0xb388('0x55')]=function(_0x2a176f,_0x170458){return db[_0xb388('0x37')][_0xb388('0x55')]()[_0xb388('0x1b')](respondWithResult(_0x170458,null))[_0xb388('0x24')](handleError(_0x170458,null));};var interaction_log=require(_0xb388('0x11'))(_0xb388('0x56'));exports[_0xb388('0x57')]=function(_0x4584b3,_0x25fbb8,_0x14d481){var _0x17f573={'agent':{},'channel':_0xb388('0x58')};if(_0x4584b3[_0xb388('0x52')]['id']){delete _0x4584b3[_0xb388('0x52')]['id'];}_0x4584b3['body'][_0xb388('0x59')]=!![];_0x4584b3[_0xb388('0x52')][_0xb388('0x5a')]=moment()['format'](_0xb388('0x5b'));_0x4584b3[_0xb388('0x52')][_0xb388('0x5c')]=_0x4584b3[_0xb388('0x52')][_0xb388('0x5c')]||_0x4584b3[_0xb388('0x5d')]['id'];_0x17f573[_0xb388('0x5e')]['id']=_0x4584b3['body'][_0xb388('0x5c')];return db[_0xb388('0x37')][_0xb388('0x53')]({'where':{'id':_0x4584b3[_0xb388('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x25fbb8,null))[_0xb388('0x1b')](saveUpdates(_0x4584b3[_0xb388('0x52')],null))[_0xb388('0x1b')](function(_0xdc90ea){if(_0xdc90ea){_0x17f573['message']=_0xdc90ea[_0xb388('0x5f')]({'plain':!![]});return db[_0xb388('0x60')][_0xb388('0x53')]({'where':{'id':_0xdc90ea['WhatsappInteractionId']}});}return null;})[_0xb388('0x1b')](handleEntityNotFound(_0x25fbb8,null))[_0xb388('0x1b')](function(_0x1f08d8){if(_0x1f08d8){return _0x1f08d8[_0xb388('0x31')]({'UserId':_0x4584b3[_0xb388('0x52')][_0xb388('0x5c')],'read1stAt':_['isNil'](_0x1f08d8[_0xb388('0x61')])?moment()[_0xb388('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5ce50a){if(_0x5ce50a){_0x17f573['interaction']=_0x5ce50a[_0xb388('0x5f')]({'plain':!![]});interaction_log[_0xb388('0x1c')](_0xb388('0x63'),_0x4584b3[_0xb388('0x5d')]['id'],_0x4584b3['user']['name'],_0x4584b3['user']['role'],_0x17f573[_0xb388('0x64')]['id'],_0x4584b3['body']?JSON[_0xb388('0x20')](_0x4584b3[_0xb388('0x52')]):_0xb388('0x65'));return respondWithRpcPromise(_0xb388('0x66'),_0xb388('0x67'),_0x17f573);}return null;})['then'](function(_0x403031){var _0x4f0b2a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x403031['message'][_0xb388('0x68')];return db['sequelize'][_0xb388('0x3d')](_0x4f0b2a,{'type':db[_0xb388('0x69')][_0xb388('0x6a')][_0xb388('0x6b')],'raw':!![]})[_0xb388('0x1b')](function(_0x10a833){return _0x10a833;});})[_0xb388('0x1b')](function(_0x5d28eb){if(_0x5d28eb){_0x17f573[_0xb388('0x22')][_0xb388('0x6c')]=_0x5d28eb[0x0];if(!_0x4584b3[_0xb388('0x52')][_0xb388('0x5c')])return;return db[_0xb388('0x6d')][_0xb388('0x53')]({'where':{'id':_0x4584b3['body'][_0xb388('0x5c')],'role':_0xb388('0x5e')},'attributes':['id','name','fullname',_0xb388('0x6e'),_0xb388('0x6f')],'raw':!![]});}return null;})[_0xb388('0x1b')](function(_0x262d74){if(!_0x262d74)return null;_0x17f573[_0xb388('0x22')][_0xb388('0x5e')]=_0x262d74;return _0x17f573;})['then'](function(_0x20e15b){if(_0x20e15b){if(_0x4584b3['body'][_0xb388('0x70')]){_0x17f573[_0xb388('0x22')][_0xb388('0x71')]=util[_0xb388('0x62')]('SIP/%s',_0x4584b3[_0xb388('0x5d')][_0xb388('0x34')]);_0x17f573[_0xb388('0x22')][_0xb388('0x72')]=_0x17f573[_0xb388('0x72')];_0x17f573[_0xb388('0x22')][_0xb388('0x73')]=_0x17f573[_0xb388('0x72')];_0x17f573[_0xb388('0x22')]['event']=_0xb388('0x57');return respondWithRpcPromise(_0xb388('0x74'),_0xb388('0x74'),{'event':_0xb388('0x75'),'message':_0x17f573['message']},client9002)['then'](function(){return _0x17f573;});}return _0x17f573;}return null;})[_0xb388('0x1b')](respondWithResult(_0x25fbb8,null))['catch'](handleError(_0x25fbb8,null));};var interaction_log=require('../../config/logger')(_0xb388('0x56'));exports[_0xb388('0x76')]=function(_0x2c78e7,_0x443f81,_0x2d1d4d){var _0x55be07={'agent':{},'channel':'whatsapp'};if(_0x2c78e7[_0xb388('0x52')]['id']){delete _0x2c78e7[_0xb388('0x52')]['id'];}_0x2c78e7[_0xb388('0x52')][_0xb388('0x5c')]=_0x2c78e7[_0xb388('0x52')][_0xb388('0x5c')]||_0x2c78e7[_0xb388('0x5d')]['id'];_0x55be07[_0xb388('0x5e')]['id']=_0x2c78e7[_0xb388('0x52')][_0xb388('0x5c')];return db[_0xb388('0x37')]['find']({'where':{'id':_0x2c78e7[_0xb388('0x54')]['id'],'UserId':null}})[_0xb388('0x1b')](handleEntityNotFound(_0x443f81,null))[_0xb388('0x1b')](function(_0x1a2c7f){if(_0x1a2c7f){_0x55be07[_0xb388('0x22')]=_0x1a2c7f['get']({'plain':!![]});return db[_0xb388('0x60')][_0xb388('0x53')]({'where':{'id':_0x1a2c7f[_0xb388('0x77')]}});}return null;})[_0xb388('0x1b')](handleEntityNotFound(_0x443f81,null))['then'](function(_0x2a1c3e){if(_0x2a1c3e){_0x55be07[_0xb388('0x64')]=_0x2a1c3e['get']({'plain':!![]});interaction_log[_0xb388('0x1c')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c78e7['user']['id'],_0x2c78e7[_0xb388('0x5d')]['name'],_0x2c78e7[_0xb388('0x5d')][_0xb388('0x78')],_0x55be07['interaction']['id'],_0x2c78e7[_0xb388('0x52')]?JSON[_0xb388('0x20')](_0x2c78e7[_0xb388('0x52')]):_0xb388('0x65'));return respondWithRpcPromise(_0xb388('0x79'),_0xb388('0x7a'),_0x55be07);}return null;})[_0xb388('0x1b')](function(_0x45c2a9){var _0x43a93b=_0xb388('0x7b')+_0x45c2a9['message'][_0xb388('0x68')];return db[_0xb388('0x7c')]['query'](_0x43a93b,{'type':db[_0xb388('0x69')][_0xb388('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x2de90c){return _0x2de90c;});})[_0xb388('0x1b')](function(_0x380607){if(_0x380607){_0x55be07[_0xb388('0x22')][_0xb388('0x6c')]=_0x380607[0x0];if(!_0x2c78e7[_0xb388('0x52')]['UserId'])return;return db[_0xb388('0x6d')]['find']({'where':{'id':_0x2c78e7['body']['UserId'],'role':'agent'},'attributes':['id',_0xb388('0x34'),'fullname',_0xb388('0x6e'),'internal'],'raw':!![]});}return null;})[_0xb388('0x1b')](function(_0x37c736){if(!_0x37c736)return null;_0x55be07[_0xb388('0x22')][_0xb388('0x5e')]=_0x37c736;return _0x55be07;})[_0xb388('0x1b')](function(_0x4f310f){if(_0x4f310f){_0x4f310f[_0xb388('0x22')][_0xb388('0x71')]=util[_0xb388('0x62')](_0xb388('0x7d'),_0x2c78e7['user'][_0xb388('0x34')]);_0x4f310f['message'][_0xb388('0x72')]=_0x55be07[_0xb388('0x72')];_0x4f310f['message'][_0xb388('0x73')]=_0x55be07['channel'];_0x4f310f[_0xb388('0x22')][_0xb388('0x7e')]=_0xb388('0x76');respondWithRpcPromise(_0xb388('0x74'),'EventManager',{'event':_0xb388('0x7f'),'message':_0x4f310f[_0xb388('0x22')]},client9002);return _0x55be07;}return null;})[_0xb388('0x1b')](respondWithResult(_0x443f81,null))[_0xb388('0x24')](handleError(_0x443f81,null));};exports[_0xb388('0x26')]=function(_0x29c6ae,_0x124799,_0x561e97){if(_0x29c6ae[_0xb388('0x52')]['id']){delete _0x29c6ae[_0xb388('0x52')]['id'];}var _0x5a566e;return db[_0xb388('0x37')][_0xb388('0x53')]({'where':{'id':_0x29c6ae['params']['id']}})[_0xb388('0x1b')](handleEntityNotFound(_0x124799,null))['then'](function(_0x5c7a23){if(_0x5c7a23){_0x5a566e=_0x5c7a23;return db['WhatsappAccount'][_0xb388('0x53')]({'where':{'id':_0x5c7a23[_0xb388('0x80')]}});}})[_0xb388('0x1b')](handleEntityNotFound(_0x124799,null))[_0xb388('0x1b')](function(_0x2e99c7){if(_0x2e99c7){logger[_0xb388('0x1e')](_0xb388('0x81'),_0xb388('0x26'),_0xb388('0x82'),_0x2e99c7[_0xb388('0x3a')],util[_0xb388('0x83')](_0x29c6ae[_0xb388('0x52')],{'showHidden':![],'depth':null}));switch(_0x2e99c7[_0xb388('0x3a')]){case _0xb388('0x84'):if(_0x29c6ae[_0xb388('0x52')][_0xb388('0x85')]&&_0x29c6ae[_0xb388('0x52')][_0xb388('0x85')]===_0x5a566e['messageId']&&_0x29c6ae[_0xb388('0x52')]['MessageStatus']&&_0x29c6ae[_0xb388('0x52')]['MessageStatus']==='read'){return _0x5a566e[_0xb388('0x31')]({'read':!![]});}else{logger[_0xb388('0x21')](_0xb388('0x86'),_0xb388('0x26'),'twilio',util[_0xb388('0x83')](_0x29c6ae[_0xb388('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x5a566e;}})[_0xb388('0x1b')](respondWithResult(_0x124799,null))[_0xb388('0x24')](handleError(_0x124799,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3b8a075..6cb853b 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 _0xf45e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0xba6447,_0x458f89){var _0x11e3ba=function(_0x4fe040){while(--_0x4fe040){_0xba6447['push'](_0xba6447['shift']());}};_0x11e3ba(++_0x458f89);}(_0xf45e,0x115));var _0xef45=function(_0x283448,_0x251f5e){_0x283448=_0x283448-0x0;var _0x481bcf=_0xf45e[_0x283448];return _0x481bcf;};'use strict';var EventEmitter=require(_0xef45('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xef45('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef45('0x2'),'afterUpdate':_0xef45('0x3'),'afterDestroy':_0xef45('0x4')};function emitEvent(_0x1e94ee){return function(_0x37772f,_0x8b048c,_0x3cd579){WhatsappMessageEvents[_0xef45('0x5')](_0x1e94ee+':'+_0x37772f['id'],_0x37772f);WhatsappMessageEvents[_0xef45('0x5')](_0x1e94ee,_0x37772f);_0x3cd579(null);};}for(var e in events){if(events[_0xef45('0x6')](e)){var event=events[e];WhatsappMessage[_0xef45('0x7')](e,emitEvent(event));}}module[_0xef45('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xde2c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0xde2c,0x7f));var _0xcde2=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xde2c[_0x54d4a8];return _0x3b321b;};'use strict';var EventEmitter=require(_0xcde2('0x0'));var WhatsappMessage=require(_0xcde2('0x1'))['db'][_0xcde2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xcde2('0x3')](0x0);var events={'afterCreate':_0xcde2('0x4'),'afterUpdate':_0xcde2('0x5'),'afterDestroy':_0xcde2('0x6')};function emitEvent(_0x3a309f){return function(_0x55c175,_0x4353c8,_0x196898){WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f+':'+_0x55c175['id'],_0x55c175);WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f,_0x55c175);_0x196898(null);};}for(var e in events){if(events[_0xcde2('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xcde2('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 70c1b24..2e96b4d 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 _0xb770=['twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type'];(function(_0x4ed8a2,_0x9c29f7){var _0x1c81f4=function(_0x857247){while(--_0x857247){_0x4ed8a2['push'](_0x4ed8a2['shift']());}};_0x1c81f4(++_0x9c29f7);}(_0xb770,0x191));var _0x0b77=function(_0x1b128f,_0x368097){_0x1b128f=_0x1b128f-0x0;var _0x27fb39=_0xb770[_0x1b128f];return _0x27fb39;};'use strict';var _=require(_0x0b77('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0b77('0x1'));var moment=require(_0x0b77('0x2'));var BPromise=require(_0x0b77('0x3'));var rp=require(_0x0b77('0x4'));var fetch=require(_0x0b77('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b77('0x6'));var config=require(_0x0b77('0x7'));var attributes=require(_0x0b77('0x8'));module[_0x0b77('0x9')]=function(_0x562a26,_0x4ad389){return _0x562a26['define'](_0x0b77('0xa'),attributes,{'tableName':_0x0b77('0xb'),'paranoid':![],'indexes':[{'name':_0x0b77('0xc'),'fields':['messageId']},{'name':_0x0b77('0xd'),'fields':[_0x0b77('0xe')],'type':_0x0b77('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47c6ef,_0x4bd643,_0x2970b9){var _0x18a547=_0x562a26[_0x0b77('0x10')];var _0x5715ce=_0x47c6ef[_0x0b77('0x11')]({'plain':!![]});if(_0x5715ce[_0x0b77('0x12')][_0x0b77('0x13')]()==='in'||_0x5715ce[_0x0b77('0x12')][_0x0b77('0x13')]()===_0x0b77('0x14')&&!_0x5715ce[_0x0b77('0x15')]&&!_[_0x0b77('0x16')](_0x5715ce['UserId'])){_0x18a547[_0x0b77('0x17')][_0x0b77('0x18')]({'where':{'id':_0x5715ce['WhatsappInteractionId']}})[_0x0b77('0x19')](function(_0x570f96){if(_0x570f96){_0x570f96[_0x0b77('0x1a')]({'lastMsgAt':_0x5715ce[_0x0b77('0x1b')],'lastMsgDirection':_0x5715ce[_0x0b77('0x12')][_0x0b77('0x13')]()});}})['catch'](function(_0x42b3f2){console[_0x0b77('0x1c')](_0x42b3f2);});}if(_0x5715ce[_0x0b77('0x12')]===_0x0b77('0x14')&&!_0x5715ce['secret']){var _0x3c82f5;_0x18a547[_0x0b77('0x1d')][_0x0b77('0x1e')]({'where':{'id':_0x5715ce[_0x0b77('0x1f')]},'raw':!![]})[_0x0b77('0x19')](function(_0x49ff3f){_0x3c82f5=_0x49ff3f;if(_0x3c82f5&&_0x3c82f5['type']){switch(_0x3c82f5[_0x0b77('0x20')]){case _0x0b77('0x21'):var _0x2dc69d=require('twilio');if(_0x3c82f5[_0x0b77('0x22')]&&_0x3c82f5[_0x0b77('0x23')]&&_0x3c82f5[_0x0b77('0x24')]){var _0x5d5ead=new _0x2dc69d(_0x3c82f5['accountSid'],_0x3c82f5['authToken']);_0x5d5ead[_0x0b77('0x25')][_0x0b77('0x26')]({'body':_0x5715ce['body'],'to':_0x0b77('0x27')+_0x5715ce[_0x0b77('0x24')],'from':'whatsapp:'+_0x3c82f5['phone'],'statusCallback':_0x3c82f5[_0x0b77('0x28')]+_0x0b77('0x29')+_0x5715ce['id']+_0x0b77('0x2a')+_0x3c82f5[_0x0b77('0x2b')]})[_0x0b77('0x19')](function(_0x2e672e){if(_0x2e672e[_0x0b77('0x2c')]){return _0x47c6ef['update']({'messageId':_0x2e672e[_0x0b77('0x2c')]});}})[_0x0b77('0x2d')](function(_0x262a7c){logger[_0x0b77('0x1c')](_0x0b77('0x2e'),_0x0b77('0x2f'),'twilio',util['inspect'](_0x262a7c,{'showHidden':![],'depth':null}));});}else{logger[_0x0b77('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0b77('0x2f'),_0x0b77('0x21'),_0x0b77('0x30'));}break;case _0x0b77('0x31'):var _0x3fef46=_0x3c82f5[_0x0b77('0x22')];var _0x3dae57=_0x3c82f5[_0x0b77('0x23')];var _0x4db804=_0x3c82f5['baseUrl']+_0x0b77('0x32')+_0x3fef46+_0x0b77('0x33');var _0x2230e4={'to':[_0x5715ce[_0x0b77('0x24')]],'message':{'type':_0x0b77('0x34'),'text':_0x5715ce['body']}};var _0x58f536={'method':_0x0b77('0x35'),'uri':_0x4db804,'headers':{'Authorization':_0x0b77('0x36')+_0x3dae57,'Content-Type':'application/json'},'body':_0x2230e4,'json':!![]};rp(_0x58f536)['then'](function(_0x2809e3){if(_0x2809e3[_0x0b77('0x37')][0x0][_0x0b77('0x38')]){return _0x47c6ef[_0x0b77('0x1a')]({'messageId':_0x2809e3[_0x0b77('0x37')][0x0][_0x0b77('0x38')]});}})[_0x0b77('0x2d')](function(_0x127f32){logger[_0x0b77('0x39')](_0x0b77('0x3a'),_0x127f32);});break;}}})[_0x0b77('0x3b')](function(){_0x2970b9();});}else{_0x2970b9();}}},'charset':_0x0b77('0x3c'),'collate':_0x0b77('0x3d')});}; \ No newline at end of file +var _0x015d=['token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0x26fa9b,_0x5992e2){var _0x1ab7df=function(_0x162d33){while(--_0x162d33){_0x26fa9b['push'](_0x26fa9b['shift']());}};_0x1ab7df(++_0x5992e2);}(_0x015d,0xd2));var _0xd015=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0x015d[_0x10a904];return _0x53815a;};'use strict';var _=require(_0xd015('0x0'));var util=require(_0xd015('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd015('0x2'));var rp=require(_0xd015('0x3'));var fetch=require(_0xd015('0x4'));var fs=require('fs');var path=require(_0xd015('0x5'));var rimraf=require(_0xd015('0x6'));var config=require(_0xd015('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x10505a,_0x1bf4e5){return _0x10505a[_0xd015('0x8')](_0xd015('0x9'),attributes,{'tableName':_0xd015('0xa'),'paranoid':![],'indexes':[{'name':_0xd015('0xb'),'fields':[_0xd015('0xb')]},{'name':_0xd015('0xc'),'fields':['body'],'type':_0xd015('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x175022,_0x3763fc,_0x1b669d){var _0x35548a=_0x10505a[_0xd015('0xe')];var _0x286ac4=_0x175022[_0xd015('0xf')]({'plain':!![]});if(_0x286ac4['direction'][_0xd015('0x10')]()==='in'||_0x286ac4[_0xd015('0x11')]['toLowerCase']()===_0xd015('0x12')&&!_0x286ac4[_0xd015('0x13')]&&!_[_0xd015('0x14')](_0x286ac4['UserId'])){_0x35548a[_0xd015('0x15')][_0xd015('0x16')]({'where':{'id':_0x286ac4[_0xd015('0x17')]}})[_0xd015('0x18')](function(_0x47483f){if(_0x47483f){_0x47483f[_0xd015('0x19')]({'lastMsgAt':_0x286ac4[_0xd015('0x1a')],'lastMsgDirection':_0x286ac4[_0xd015('0x11')][_0xd015('0x10')]()});}})[_0xd015('0x1b')](function(_0x55590b){console['error'](_0x55590b);});}if(_0x286ac4[_0xd015('0x11')]==='out'&&!_0x286ac4[_0xd015('0x13')]){var _0x4583cd;_0x35548a[_0xd015('0x1c')][_0xd015('0x1d')]({'where':{'id':_0x286ac4[_0xd015('0x1e')]},'raw':!![]})[_0xd015('0x18')](function(_0x34c9f2){_0x4583cd=_0x34c9f2;if(_0x4583cd&&_0x4583cd[_0xd015('0x1f')]){switch(_0x4583cd['type']){case _0xd015('0x20'):var _0x569e11=require('twilio');if(_0x4583cd[_0xd015('0x21')]&&_0x4583cd[_0xd015('0x22')]&&_0x4583cd[_0xd015('0x23')]){var _0x538357=new _0x569e11(_0x4583cd['accountSid'],_0x4583cd[_0xd015('0x22')]);_0x538357[_0xd015('0x24')][_0xd015('0x25')]({'body':_0x286ac4['body'],'to':'whatsapp:'+_0x286ac4['phone'],'from':_0xd015('0x26')+_0x4583cd['phone'],'statusCallback':_0x4583cd[_0xd015('0x27')]+_0xd015('0x28')+_0x286ac4['id']+_0xd015('0x29')+_0x4583cd[_0xd015('0x2a')]})[_0xd015('0x18')](function(_0x5290da){if(_0x5290da[_0xd015('0x2b')]){return _0x175022[_0xd015('0x19')]({'messageId':_0x5290da[_0xd015('0x2b')]});}})[_0xd015('0x1b')](function(_0x3d024d){logger[_0xd015('0x2c')](_0xd015('0x2d'),_0xd015('0x2e'),_0xd015('0x20'),util[_0xd015('0x2f')](_0x3d024d,{'showHidden':![],'depth':null}));});}else{logger[_0xd015('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd015('0x2e'),_0xd015('0x20'),_0xd015('0x30'));}break;case _0xd015('0x31'):var _0xe9ad04=_0x4583cd[_0xd015('0x21')];var _0x453906=_0x4583cd[_0xd015('0x22')];var _0x1fb308=_0x4583cd[_0xd015('0x32')]+_0xd015('0x33')+_0xe9ad04+_0xd015('0x34');var _0x4fd7fb={'to':[_0x286ac4[_0xd015('0x23')]],'message':{'type':_0xd015('0x35'),'text':_0x286ac4[_0xd015('0x36')]}};var _0x657199={'method':_0xd015('0x37'),'uri':_0x1fb308,'headers':{'Authorization':'Bearer\x20'+_0x453906,'Content-Type':_0xd015('0x38')},'body':_0x4fd7fb,'json':!![]};rp(_0x657199)[_0xd015('0x18')](function(_0x2951cb){if(_0x2951cb[_0xd015('0x39')][0x0][_0xd015('0x3a')]){return _0x175022[_0xd015('0x19')]({'messageId':_0x2951cb[_0xd015('0x39')][0x0][_0xd015('0x3a')]});}})[_0xd015('0x1b')](function(_0x2a02d3){logger[_0xd015('0x3b')](_0xd015('0x3c'),_0x2a02d3);});break;}}})[_0xd015('0x3d')](function(){_0x1b669d();});}else{_0x1b669d();}}},'charset':'utf8mb4','collate':_0xd015('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a3de38f..2519557 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 _0x92b4=['options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x190180,_0x3eb2a4){var _0x50a373=function(_0x5f5848){while(--_0x5f5848){_0x190180['push'](_0x190180['shift']());}};_0x50a373(++_0x3eb2a4);}(_0x92b4,0x1c3));var _0x492b=function(_0x1f9804,_0x4aed5a){_0x1f9804=_0x1f9804-0x0;var _0x5418d3=_0x92b4[_0x1f9804];return _0x5418d3;};'use strict';var _=require(_0x492b('0x0'));var util=require(_0x492b('0x1'));var moment=require(_0x492b('0x2'));var BPromise=require(_0x492b('0x3'));var rs=require(_0x492b('0x4'));var fs=require('fs');var Redis=require(_0x492b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x492b('0x6'));var logger=require('../../config/logger')(_0x492b('0x7'));var config=require(_0x492b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x492b('0x9')][_0x492b('0xa')]({'port':0x232a});config['redis']=_[_0x492b('0xb')](config[_0x492b('0xc')],{'host':_0x492b('0xd'),'port':0x18eb});var socket=require(_0x492b('0xe'))(new Redis(config[_0x492b('0xc')]));require(_0x492b('0xf'))[_0x492b('0x10')](socket);function respondWithRpcPromise(_0x2fb860,_0x44ee5b,_0x5c5a1c){return new BPromise(function(_0x4aea4b,_0x50fdad){return client[_0x492b('0x11')](_0x2fb860,_0x5c5a1c)['then'](function(_0x485f13){logger[_0x492b('0x12')](_0x492b('0x13'),_0x44ee5b,_0x492b('0x14'));logger[_0x492b('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x44ee5b,_0x492b('0x14'),JSON['stringify'](_0x485f13));if(_0x485f13[_0x492b('0x16')]){if(_0x485f13[_0x492b('0x16')][_0x492b('0x17')]===0x1f4){logger[_0x492b('0x16')](_0x492b('0x13'),_0x44ee5b,_0x485f13[_0x492b('0x16')][_0x492b('0x18')]);return _0x50fdad(_0x485f13['error']['message']);}logger[_0x492b('0x16')](_0x492b('0x13'),_0x44ee5b,_0x485f13[_0x492b('0x16')][_0x492b('0x18')]);return _0x4aea4b(_0x485f13[_0x492b('0x16')][_0x492b('0x18')]);}else{logger[_0x492b('0x12')](_0x492b('0x13'),_0x44ee5b,_0x492b('0x14'));_0x4aea4b(_0x485f13['result'][_0x492b('0x18')]);}})[_0x492b('0x19')](function(_0x938b1){logger[_0x492b('0x16')](_0x492b('0x13'),_0x44ee5b,_0x938b1);_0x50fdad(_0x938b1);});});}exports[_0x492b('0x1a')]=function(_0x362c6e){var _0x21c893=this;return new Promise(function(_0x188c49,_0x2a3791){return db[_0x492b('0x1b')][_0x492b('0x1c')](_0x362c6e['body'],{'raw':_0x362c6e['options']?_0x362c6e[_0x492b('0x1d')][_0x492b('0x1e')]===undefined?!![]:![]:!![]})[_0x492b('0x1f')](function(_0x162204){logger[_0x492b('0x12')](_0x492b('0x1a'),_0x362c6e);logger[_0x492b('0x15')]('CreateWhatsappMessage',_0x362c6e,JSON['stringify'](_0x162204));_0x188c49(_0x162204);})[_0x492b('0x19')](function(_0x3bc04b){logger['error'](_0x492b('0x1a'),_0x3bc04b[_0x492b('0x18')],_0x362c6e);_0x2a3791(_0x21c893[_0x492b('0x16')](0x1f4,_0x3bc04b['message']));});});}; \ No newline at end of file +var _0x00dd=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2c6760,_0x487080){var _0x704576=function(_0x30f235){while(--_0x30f235){_0x2c6760['push'](_0x2c6760['shift']());}};_0x704576(++_0x487080);}(_0x00dd,0x17c));var _0xd00d=function(_0x7dd3c0,_0x43d5b7){_0x7dd3c0=_0x7dd3c0-0x0;var _0x30cbf8=_0x00dd[_0x7dd3c0];return _0x30cbf8;};'use strict';var _=require(_0xd00d('0x0'));var util=require('util');var moment=require(_0xd00d('0x1'));var BPromise=require(_0xd00d('0x2'));var rs=require(_0xd00d('0x3'));var fs=require('fs');var Redis=require(_0xd00d('0x4'));var db=require(_0xd00d('0x5'))['db'];var utils=require(_0xd00d('0x6'));var logger=require(_0xd00d('0x7'))(_0xd00d('0x8'));var config=require('../../config/environment');var jayson=require(_0xd00d('0x9'));var client=jayson['client'][_0xd00d('0xa')]({'port':0x232a});config[_0xd00d('0xb')]=_[_0xd00d('0xc')](config[_0xd00d('0xb')],{'host':_0xd00d('0xd'),'port':0x18eb});var socket=require(_0xd00d('0xe'))(new Redis(config[_0xd00d('0xb')]));require(_0xd00d('0xf'))[_0xd00d('0x10')](socket);function respondWithRpcPromise(_0x522eaf,_0x4351f6,_0x4ba9eb){return new BPromise(function(_0x168992,_0x4bad9f){return client[_0xd00d('0x11')](_0x522eaf,_0x4ba9eb)[_0xd00d('0x12')](function(_0x42ac48){logger[_0xd00d('0x13')](_0xd00d('0x14'),_0x4351f6,_0xd00d('0x15'));logger['debug'](_0xd00d('0x16'),_0x4351f6,_0xd00d('0x15'),JSON[_0xd00d('0x17')](_0x42ac48));if(_0x42ac48[_0xd00d('0x18')]){if(_0x42ac48[_0xd00d('0x18')][_0xd00d('0x19')]===0x1f4){logger[_0xd00d('0x18')](_0xd00d('0x14'),_0x4351f6,_0x42ac48[_0xd00d('0x18')]['message']);return _0x4bad9f(_0x42ac48[_0xd00d('0x18')]['message']);}logger[_0xd00d('0x18')](_0xd00d('0x14'),_0x4351f6,_0x42ac48[_0xd00d('0x18')][_0xd00d('0x1a')]);return _0x168992(_0x42ac48[_0xd00d('0x18')]['message']);}else{logger[_0xd00d('0x13')](_0xd00d('0x14'),_0x4351f6,'request\x20sent');_0x168992(_0x42ac48[_0xd00d('0x1b')][_0xd00d('0x1a')]);}})[_0xd00d('0x1c')](function(_0x99bba5){logger[_0xd00d('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x4351f6,_0x99bba5);_0x4bad9f(_0x99bba5);});});}exports[_0xd00d('0x1d')]=function(_0x22d736){var _0x14d0d1=this;return new Promise(function(_0x953ebc,_0x2082a4){return db['WhatsappMessage'][_0xd00d('0x1e')](_0x22d736[_0xd00d('0x1f')],{'raw':_0x22d736[_0xd00d('0x20')]?_0x22d736[_0xd00d('0x20')][_0xd00d('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x5acca8){logger[_0xd00d('0x13')](_0xd00d('0x1d'),_0x22d736);logger[_0xd00d('0x22')](_0xd00d('0x1d'),_0x22d736,JSON[_0xd00d('0x17')](_0x5acca8));_0x953ebc(_0x5acca8);})[_0xd00d('0x1c')](function(_0x2417a6){logger[_0xd00d('0x18')](_0xd00d('0x1d'),_0x2417a6[_0xd00d('0x1a')],_0x22d736);_0x2082a4(_0x14d0d1[_0xd00d('0x18')](0x1f4,_0x2417a6[_0xd00d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index d78bf00..87bf991 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 _0x05b0=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0x05b0,0x195));var _0x005b=function(_0x221a15,_0x2a6eb6){_0x221a15=_0x221a15-0x0;var _0x3c7e1d=_0x05b0[_0x221a15];return _0x3c7e1d;};'use strict';var WhatsappMessageEvents=require(_0x005b('0x0'));var events=['save',_0x005b('0x1'),_0x005b('0x2')];function createListener(_0x4cd943,_0x2119e2){return function(_0x1e6152){_0x2119e2[_0x005b('0x3')](_0x4cd943,_0x1e6152);};}function removeListener(_0x410c24,_0x5b1026){return function(){WhatsappMessageEvents[_0x005b('0x4')](_0x410c24,_0x5b1026);};}exports[_0x005b('0x5')]=function(_0x30570a){for(var _0x1766a0=0x0,_0x3d2026=events[_0x005b('0x6')];_0x1766a0<_0x3d2026;_0x1766a0++){var _0x4b92e7=events[_0x1766a0];var _0x14c7b0=createListener(_0x005b('0x7')+_0x4b92e7,_0x30570a);WhatsappMessageEvents['on'](_0x4b92e7,_0x14c7b0);}}; \ No newline at end of file +var _0x81d6=['register','save','remove','update','emit'];(function(_0x5d18a6,_0x416183){var _0x335faf=function(_0x46ee0a){while(--_0x46ee0a){_0x5d18a6['push'](_0x5d18a6['shift']());}};_0x335faf(++_0x416183);}(_0x81d6,0x155));var _0x681d=function(_0x1ea4ff,_0x30e7cf){_0x1ea4ff=_0x1ea4ff-0x0;var _0x4c2e46=_0x81d6[_0x1ea4ff];return _0x4c2e46;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x681d('0x0'),_0x681d('0x1'),_0x681d('0x2')];function createListener(_0xa66384,_0x4eb6c3){return function(_0x191da9){_0x4eb6c3[_0x681d('0x3')](_0xa66384,_0x191da9);};}function removeListener(_0x1f4b17,_0x21de7a){return function(){WhatsappMessageEvents['removeListener'](_0x1f4b17,_0x21de7a);};}exports[_0x681d('0x4')]=function(_0xa8daca){for(var _0x17d4fc=0x0,_0x256cf8=events['length'];_0x17d4fc<_0x256cf8;_0x17d4fc++){var _0x470efa=events[_0x17d4fc];var _0x6e30b4=createListener('whatsappMessage:'+_0x470efa,_0xa8daca);WhatsappMessageEvents['on'](_0x470efa,_0x6e30b4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f2f1e4a..033a207 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 _0xd540=['/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','/:id/teams','removeTeams','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5c1726,_0x27281a){var _0x20f183=function(_0x4ce740){while(--_0x4ce740){_0x5c1726['push'](_0x5c1726['shift']());}};_0x20f183(++_0x27281a);}(_0xd540,0x1d2));var _0x0d54=function(_0x4cacb8,_0x4af4a6){_0x4cacb8=_0x4cacb8-0x0;var _0x5248fa=_0xd540[_0x4cacb8];return _0x5248fa;};'use strict';var multer=require(_0x0d54('0x0'));var util=require('util');var path=require(_0x0d54('0x1'));var timeout=require(_0x0d54('0x2'));var express=require('express');var router=express[_0x0d54('0x3')]();var fs_extra=require(_0x0d54('0x4'));var auth=require(_0x0d54('0x5'));var interaction=require(_0x0d54('0x6'));var config=require(_0x0d54('0x7'));var controller=require(_0x0d54('0x8'));router[_0x0d54('0x9')]('/',auth[_0x0d54('0xa')](),controller[_0x0d54('0xb')]);router[_0x0d54('0x9')](_0x0d54('0xc'),auth[_0x0d54('0xa')](),controller[_0x0d54('0xd')]);router['get'](_0x0d54('0xe'),auth[_0x0d54('0xa')](),controller['show']);router[_0x0d54('0x9')](_0x0d54('0xf'),auth[_0x0d54('0xa')](),controller[_0x0d54('0x10')]);router[_0x0d54('0x9')]('/:id/teams',auth[_0x0d54('0xa')](),controller[_0x0d54('0x11')]);router[_0x0d54('0x9')](_0x0d54('0x12'),auth['isAuthenticated'](),controller[_0x0d54('0x13')]);router[_0x0d54('0x14')]('/',auth[_0x0d54('0xa')](),controller[_0x0d54('0x15')]);router[_0x0d54('0x14')]('/:id/teams',auth[_0x0d54('0xa')](),controller[_0x0d54('0x16')]);router[_0x0d54('0x14')](_0x0d54('0x12'),auth[_0x0d54('0xa')](),controller[_0x0d54('0x17')]);router['put']('/:id',auth[_0x0d54('0xa')](),controller[_0x0d54('0x18')]);router[_0x0d54('0x19')]('/:id',auth[_0x0d54('0xa')](),controller[_0x0d54('0x1a')]);router['delete'](_0x0d54('0x1b'),auth['isAuthenticated'](),controller[_0x0d54('0x1c')]);router[_0x0d54('0x19')](_0x0d54('0x12'),auth[_0x0d54('0xa')](),controller['removeAgents']);module[_0x0d54('0x1d')]=router; \ No newline at end of file +var _0x114b=['Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x114b,0x1e9));var _0xb114=function(_0x2e2c5d,_0x412e2d){_0x2e2c5d=_0x2e2c5d-0x0;var _0x7d45da=_0x114b[_0x2e2c5d];return _0x7d45da;};'use strict';var multer=require('multer');var util=require(_0xb114('0x0'));var path=require(_0xb114('0x1'));var timeout=require(_0xb114('0x2'));var express=require(_0xb114('0x3'));var router=express[_0xb114('0x4')]();var fs_extra=require(_0xb114('0x5'));var auth=require(_0xb114('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb114('0x7'));var controller=require(_0xb114('0x8'));router[_0xb114('0x9')]('/',auth[_0xb114('0xa')](),controller['index']);router['get'](_0xb114('0xb'),auth[_0xb114('0xa')](),controller[_0xb114('0xc')]);router[_0xb114('0x9')](_0xb114('0xd'),auth[_0xb114('0xa')](),controller[_0xb114('0xe')]);router[_0xb114('0x9')](_0xb114('0xf'),auth[_0xb114('0xa')](),controller['getMembers']);router[_0xb114('0x9')](_0xb114('0x10'),auth[_0xb114('0xa')](),controller['getTeams']);router[_0xb114('0x9')](_0xb114('0x11'),auth[_0xb114('0xa')](),controller[_0xb114('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb114('0x13')]);router[_0xb114('0x14')](_0xb114('0x10'),auth['isAuthenticated'](),controller[_0xb114('0x15')]);router['post']('/:id/users',auth[_0xb114('0xa')](),controller[_0xb114('0x16')]);router[_0xb114('0x17')](_0xb114('0xd'),auth[_0xb114('0xa')](),controller[_0xb114('0x18')]);router[_0xb114('0x19')](_0xb114('0xd'),auth[_0xb114('0xa')](),controller[_0xb114('0x1a')]);router[_0xb114('0x19')](_0xb114('0x10'),auth[_0xb114('0xa')](),controller['removeTeams']);router[_0xb114('0x19')](_0xb114('0x11'),auth[_0xb114('0xa')](),controller[_0xb114('0x1b')]);module[_0xb114('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a1551f5..6065074 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 _0xd240=['exports','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xd240,0x1c7));var _0x0d24=function(_0x1ca226,_0x3618a7){_0x1ca226=_0x1ca226-0x0;var _0x19830e=_0xd240[_0x1ca226];return _0x19830e;};'use strict';var Sequelize=require('sequelize');module[_0x0d24('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0d24('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0d24('0x2')](_0x0d24('0x3'),_0x0d24('0x4'),_0x0d24('0x5'))},'description':{'type':Sequelize[_0x0d24('0x6')]}}; \ No newline at end of file +var _0x26bc=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x302695,_0x3dea91){var _0x3f0fd7=function(_0x905b0a){while(--_0x905b0a){_0x302695['push'](_0x302695['shift']());}};_0x3f0fd7(++_0x3dea91);}(_0x26bc,0x162));var _0xc26b=function(_0x56634f,_0x21d65b){_0x56634f=_0x56634f-0x0;var _0x3c676f=_0x26bc[_0x56634f];return _0x3c676f;};'use strict';var Sequelize=require(_0xc26b('0x0'));module[_0xc26b('0x1')]={'name':{'type':Sequelize[_0xc26b('0x2')],'unique':_0xc26b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc26b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc26b('0x5'),_0xc26b('0x6'),_0xc26b('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 79a7424..7384049 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 _0xd8a8=['UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappQueueId','filter','options','findAll','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','include','query','rows','catch','show','params','model','keys','attributes','intersection','fields','length','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne'];(function(_0x3674d4,_0x4ce93b){var _0x4b5cd4=function(_0x59081c){while(--_0x59081c){_0x3674d4['push'](_0x3674d4['shift']());}};_0x4b5cd4(++_0x4ce93b);}(_0xd8a8,0x13d));var _0x8d8a=function(_0x220b41,_0x332855){_0x220b41=_0x220b41-0x0;var _0x406a52=_0xd8a8[_0x220b41];return _0x406a52;};'use strict';var BPromise=require('bluebird');var util=require(_0x8d8a('0x0'));var _=require(_0x8d8a('0x1'));var squel=require(_0x8d8a('0x2'));var Redis=require(_0x8d8a('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x8d8a('0x4'))(_0x8d8a('0x5'));var config=require('../../config/environment');var db=require(_0x8d8a('0x6'))['db'];config[_0x8d8a('0x7')]=_[_0x8d8a('0x8')](config['redis'],{'host':_0x8d8a('0x9'),'port':0x18eb});var socket=require(_0x8d8a('0xa'))(new Redis(config[_0x8d8a('0x7')]));require(_0x8d8a('0xb'))[_0x8d8a('0xc')](socket);function respondWithStatusCode(_0x4f7b0d,_0x546dfc){_0x546dfc=_0x546dfc||0xcc;return function(_0x1ab1c5){if(_0x1ab1c5){return _0x4f7b0d[_0x8d8a('0xd')](_0x546dfc);}return _0x4f7b0d[_0x8d8a('0xe')](_0x546dfc)[_0x8d8a('0xf')]();};}function respondWithResult(_0x522dc9,_0x70c640){_0x70c640=_0x70c640||0xc8;return function(_0x53a6a2){if(_0x53a6a2){return _0x522dc9[_0x8d8a('0xe')](_0x70c640)[_0x8d8a('0x10')](_0x53a6a2);}};}function respondWithFilteredResult(_0x2dc6ab,_0x2a4b90){return function(_0x2852a9){if(_0x2852a9){var _0x451a96=typeof _0x2a4b90[_0x8d8a('0x11')]===_0x8d8a('0x12')&&typeof _0x2a4b90[_0x8d8a('0x13')]===_0x8d8a('0x12');var _0x566b16=_0x2852a9['count'];var _0x2549a7=_0x451a96?0x0:_0x2a4b90[_0x8d8a('0x11')];var _0x4fe710=_0x451a96?_0x2852a9[_0x8d8a('0x14')]:_0x2a4b90[_0x8d8a('0x11')]+_0x2a4b90['limit'];var _0x403590;if(_0x4fe710>=_0x566b16){_0x4fe710=_0x566b16;_0x403590=0xc8;}else{_0x403590=0xce;}_0x2dc6ab[_0x8d8a('0xe')](_0x403590);return _0x2dc6ab[_0x8d8a('0x15')]('Content-Range',_0x2549a7+'-'+_0x4fe710+'/'+_0x566b16)[_0x8d8a('0x10')](_0x2852a9);}return null;};}function saveUpdates(_0x5861e6){return function(_0x192ad6){if(_0x192ad6){return _0x192ad6[_0x8d8a('0x16')](_0x5861e6)['then'](function(_0x2050a8){return _0x2050a8;});}return null;};}function removeEntity(_0x13762e){return function(_0x1ce529){if(_0x1ce529){return _0x1ce529[_0x8d8a('0x17')]()[_0x8d8a('0x18')](function(){var _0x446f43=_0x1ce529['get']({'plain':!![]});var _0x1552b3=_0x8d8a('0x19');return db[_0x8d8a('0x1a')][_0x8d8a('0x17')]({'where':{'type':_0x1552b3,'resourceId':_0x446f43['id']}})['then'](function(){return _0x1ce529;});})[_0x8d8a('0x18')](function(){_0x13762e[_0x8d8a('0xe')](0xcc)[_0x8d8a('0xf')]();});}};}function handleEntityNotFound(_0x2f9532){return function(_0x2e5d94){if(!_0x2e5d94){_0x2f9532[_0x8d8a('0xd')](0x194);}return _0x2e5d94;};}function handleError(_0x32e0b1,_0x132945){_0x132945=_0x132945||0x1f4;return function(_0x555c40){logger[_0x8d8a('0x1b')](_0x555c40[_0x8d8a('0x1c')]);if(_0x555c40[_0x8d8a('0x1d')]){delete _0x555c40[_0x8d8a('0x1d')];}_0x32e0b1[_0x8d8a('0xe')](_0x132945)[_0x8d8a('0x1e')](_0x555c40);};}exports[_0x8d8a('0x1f')]=function(_0x232f28,_0x27b045){var _0xecb4e={};var _0x5ad219={'count':0x0,'rows':[]};var _0x4a6d18=_[_0x8d8a('0x20')](db[_0x8d8a('0x21')][_0x8d8a('0x22')],function(_0x1ce948){return{'name':_0x1ce948['fieldName'],'type':_0x1ce948[_0x8d8a('0x23')][_0x8d8a('0x24')]};});_0xecb4e=qs['getOptions'](_0x4a6d18,_0x232f28);var _0x54f570={'where':_0xecb4e['where']};return db[_0x8d8a('0x21')][_0x8d8a('0x14')](_0x54f570)[_0x8d8a('0x18')](function(_0x198626){_0x5ad219[_0x8d8a('0x14')]=_0x198626;_0xecb4e[_0x8d8a('0x25')]=qs[_0x8d8a('0x25')](_0x232f28[_0x8d8a('0x26')]);return db[_0x8d8a('0x21')]['findAll'](_0xecb4e);})[_0x8d8a('0x18')](function(_0x4bc774){_0x5ad219[_0x8d8a('0x27')]=_0x4bc774;return _0x5ad219;})[_0x8d8a('0x18')](respondWithFilteredResult(_0x27b045,_0xecb4e))[_0x8d8a('0x28')](handleError(_0x27b045,null));};exports[_0x8d8a('0x29')]=function(_0x4f5c84,_0x4e2572){var _0x4ce0e4={'raw':!![],'where':{'id':_0x4f5c84[_0x8d8a('0x2a')]['id']}},_0x242ae1={};_0x242ae1[_0x8d8a('0x2b')]=_['keys'](db[_0x8d8a('0x21')][_0x8d8a('0x22')]);_0x242ae1[_0x8d8a('0x26')]=_[_0x8d8a('0x2c')](_0x4f5c84[_0x8d8a('0x26')]);_0x242ae1['filters']=_['intersection'](_0x242ae1[_0x8d8a('0x2b')],_0x242ae1[_0x8d8a('0x26')]);_0x4ce0e4[_0x8d8a('0x2d')]=_[_0x8d8a('0x2e')](_0x242ae1[_0x8d8a('0x2b')],qs[_0x8d8a('0x2f')](_0x4f5c84['query']['fields']));_0x4ce0e4[_0x8d8a('0x2d')]=_0x4ce0e4[_0x8d8a('0x2d')][_0x8d8a('0x30')]?_0x4ce0e4[_0x8d8a('0x2d')]:_0x242ae1[_0x8d8a('0x2b')];if(_0x4f5c84[_0x8d8a('0x26')][_0x8d8a('0x31')]){_0x4ce0e4[_0x8d8a('0x25')]=[{'all':!![]}];}_0x4ce0e4=_[_0x8d8a('0x32')]({},_0x4ce0e4,_0x4f5c84['options']);return db[_0x8d8a('0x21')][_0x8d8a('0x33')](_0x4ce0e4)[_0x8d8a('0x18')](handleEntityNotFound(_0x4e2572,null))['then'](respondWithResult(_0x4e2572,null))['catch'](handleError(_0x4e2572,null));};exports[_0x8d8a('0x34')]=function(_0x353396,_0x1ae2cd){return db[_0x8d8a('0x21')]['create'](_0x353396[_0x8d8a('0x35')],{})[_0x8d8a('0x18')](function(_0x1b4d61){var _0x47d04e=_0x353396[_0x8d8a('0x36')][_0x8d8a('0x37')]({'plain':!![]});if(!_0x47d04e)throw new Error(_0x8d8a('0x38'));if(_0x47d04e[_0x8d8a('0x39')]===_0x8d8a('0x36')){var _0x50d798=_0x1b4d61[_0x8d8a('0x37')]({'plain':!![]});var _0x511c8c='WhatsappQueues';return db[_0x8d8a('0x3a')][_0x8d8a('0x33')]({'where':{'name':_0x511c8c,'userProfileId':_0x47d04e[_0x8d8a('0x3b')]},'raw':!![]})['then'](function(_0x1cf664){if(_0x1cf664&&_0x1cf664[_0x8d8a('0x3c')]===0x0){return db[_0x8d8a('0x1a')][_0x8d8a('0x34')]({'name':_0x50d798[_0x8d8a('0x1d')],'resourceId':_0x50d798['id'],'type':_0x1cf664[_0x8d8a('0x1d')],'sectionId':_0x1cf664['id']},{})[_0x8d8a('0x18')](function(){return _0x1b4d61;});}else{return _0x1b4d61;}})['catch'](function(_0x1a5b5f){logger[_0x8d8a('0x1b')](_0x8d8a('0x3d'),_0x1a5b5f);throw _0x1a5b5f;});}return _0x1b4d61;})['then'](respondWithResult(_0x1ae2cd,0xc9))['catch'](handleError(_0x1ae2cd,null));};exports[_0x8d8a('0x16')]=function(_0x56c49d,_0x3d1892){if(_0x56c49d['body']['id']){delete _0x56c49d[_0x8d8a('0x35')]['id'];}return db[_0x8d8a('0x21')]['find']({'where':{'id':_0x56c49d['params']['id']}})['then'](handleEntityNotFound(_0x3d1892,null))['then'](saveUpdates(_0x56c49d[_0x8d8a('0x35')],null))[_0x8d8a('0x18')](respondWithResult(_0x3d1892,null))[_0x8d8a('0x28')](handleError(_0x3d1892,null));};exports[_0x8d8a('0x17')]=function(_0x5ad7e3,_0x5ecd82){return db['WhatsappQueue'][_0x8d8a('0x33')]({'where':{'id':_0x5ad7e3[_0x8d8a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5ecd82,null))[_0x8d8a('0x18')](removeEntity(_0x5ecd82,null))[_0x8d8a('0x28')](handleError(_0x5ecd82,null));};exports[_0x8d8a('0x3e')]=function(_0x51c52e,_0x5d3cf0){return db[_0x8d8a('0x21')]['describe']()[_0x8d8a('0x18')](respondWithResult(_0x5d3cf0,null))[_0x8d8a('0x28')](handleError(_0x5d3cf0,null));};exports['getMembers']=function(_0x41c137,_0x1eb219){var _0x480aa3={'raw':!![],'where':{}},_0x534473={},_0x4d0257;return db[_0x8d8a('0x21')][_0x8d8a('0x3f')]({'where':{'id':_0x41c137[_0x8d8a('0x2a')]['id']}})[_0x8d8a('0x18')](handleEntityNotFound(_0x1eb219,null))[_0x8d8a('0x18')](function(_0xb9536){if(_0xb9536){_0x4d0257=_0xb9536['get']({'plain':!![]});_0x534473[_0x8d8a('0x2b')]=_[_0x8d8a('0x2c')](db[_0x8d8a('0x40')][_0x8d8a('0x22')]);_0x534473[_0x8d8a('0x26')]=_[_0x8d8a('0x2c')](_0x41c137[_0x8d8a('0x26')]);_0x534473[_0x8d8a('0x41')]=_[_0x8d8a('0x2e')](_0x534473[_0x8d8a('0x2b')],_0x534473[_0x8d8a('0x26')]);_0x480aa3[_0x8d8a('0x2d')]=_['intersection'](_0x534473[_0x8d8a('0x2b')],qs[_0x8d8a('0x2f')](_0x41c137[_0x8d8a('0x26')]['fields']));_0x480aa3['attributes']=_0x480aa3[_0x8d8a('0x2d')][_0x8d8a('0x30')]?_0x480aa3[_0x8d8a('0x2d')]:_0x534473['model'];if(!_0x41c137[_0x8d8a('0x26')][_0x8d8a('0x42')](_0x8d8a('0x43'))){_0x480aa3[_0x8d8a('0x13')]=qs[_0x8d8a('0x13')](_0x41c137[_0x8d8a('0x26')][_0x8d8a('0x13')]);_0x480aa3[_0x8d8a('0x11')]=qs['offset'](_0x41c137[_0x8d8a('0x26')]['offset']);}_0x480aa3[_0x8d8a('0x44')]=qs[_0x8d8a('0x45')](_0x41c137[_0x8d8a('0x26')][_0x8d8a('0x45')]);_0x480aa3[_0x8d8a('0x46')]=qs['filters'](_[_0x8d8a('0x47')](_0x41c137['query'],_0x534473['filters']));_0x480aa3['where'][_0x8d8a('0x48')]=_0xb9536['id'];if(_0x41c137[_0x8d8a('0x26')][_0x8d8a('0x49')]){_0x480aa3[_0x8d8a('0x46')]=_[_0x8d8a('0x32')](_0x480aa3['where'],{'$or':_[_0x8d8a('0x20')](_0x480aa3[_0x8d8a('0x2d')],function(_0x3e79a7){var _0x53d0a2={};_0x53d0a2[_0x3e79a7]={'$like':'%'+_0x41c137['query']['filter']+'%'};return _0x53d0a2;})});}_0x480aa3=_[_0x8d8a('0x32')]({},_0x480aa3,_0x41c137[_0x8d8a('0x4a')]);return db[_0x8d8a('0x40')][_0x8d8a('0x4b')](_0x480aa3);}})[_0x8d8a('0x18')](function(_0x124354){if(_0x124354){return db[_0x8d8a('0x4c')][_0x8d8a('0x4d')]({'where':{'id':_[_0x8d8a('0x20')](_0x124354,_0x8d8a('0x4e')),'role':_0x8d8a('0x4f')},'attributes':['id',_0x8d8a('0x1d'),_0x8d8a('0x50'),'updatedAt',_0x8d8a('0x51')]});}})[_0x8d8a('0x18')](function(_0xf986fb){if(_0xf986fb){return{'count':_0xf986fb[_0x8d8a('0x14')],'rows':_[_0x8d8a('0x20')](_0xf986fb[_0x8d8a('0x27')],function(_0x4caa87){return{'membername':_0x4caa87[_0x8d8a('0x1d')],'UserId':_0x4caa87['id'],'queue_name':_0x4d0257[_0x8d8a('0x1d')],'WhatsappQueueId':_0x4d0257['id'],'interface':util['format']('%s/%s',_0x8d8a('0x52'),_0x4caa87[_0x8d8a('0x1d')]),'penalty':0x0,'paused':_0x4caa87['whatsappPause'],'createdAt':_0x4caa87[_0x8d8a('0x51')],'updatedAt':_0x4caa87[_0x8d8a('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d8a('0x18')](respondWithFilteredResult(_0x1eb219,_0x480aa3))[_0x8d8a('0x28')](handleError(_0x1eb219,null));};exports[_0x8d8a('0x54')]=function(_0x41f717,_0x27e620){var _0x5ed076={};var _0x480a12={};var _0x5c6524;var _0x3129b0;return db['WhatsappQueue'][_0x8d8a('0x3f')]({'where':{'id':_0x41f717['params']['id']}})[_0x8d8a('0x18')](handleEntityNotFound(_0x27e620,null))[_0x8d8a('0x18')](function(_0x9cead3){if(_0x9cead3){_0x5c6524=_0x9cead3;_0x480a12['model']=_[_0x8d8a('0x2c')](db[_0x8d8a('0x55')][_0x8d8a('0x22')]);_0x480a12[_0x8d8a('0x26')]=_['keys'](_0x41f717[_0x8d8a('0x26')]);_0x480a12[_0x8d8a('0x41')]=_[_0x8d8a('0x2e')](_0x480a12[_0x8d8a('0x2b')],_0x480a12[_0x8d8a('0x26')]);_0x5ed076[_0x8d8a('0x2d')]=_['intersection'](_0x480a12[_0x8d8a('0x2b')],qs['fields'](_0x41f717[_0x8d8a('0x26')][_0x8d8a('0x2f')]));_0x5ed076['attributes']=_0x5ed076['attributes'][_0x8d8a('0x30')]?_0x5ed076['attributes']:_0x480a12['model'];_0x5ed076[_0x8d8a('0x44')]=qs[_0x8d8a('0x45')](_0x41f717[_0x8d8a('0x26')][_0x8d8a('0x45')]);_0x5ed076[_0x8d8a('0x46')]=qs[_0x8d8a('0x41')](_[_0x8d8a('0x47')](_0x41f717[_0x8d8a('0x26')],_0x480a12[_0x8d8a('0x41')]));if(_0x41f717[_0x8d8a('0x26')]['filter']){_0x5ed076[_0x8d8a('0x46')]=_['merge'](_0x5ed076[_0x8d8a('0x46')],{'$or':_[_0x8d8a('0x20')](_0x5ed076['attributes'],function(_0x47605c){var _0x5a6abc={};_0x5a6abc[_0x47605c]={'$like':'%'+_0x41f717[_0x8d8a('0x26')][_0x8d8a('0x49')]+'%'};return _0x5a6abc;})});}_0x5ed076=_[_0x8d8a('0x32')]({},_0x5ed076,_0x41f717[_0x8d8a('0x4a')]);return _0x5c6524['getTeams'](_0x5ed076);}})[_0x8d8a('0x18')](function(_0x1c962e){if(_0x1c962e){_0x3129b0=_0x1c962e[_0x8d8a('0x30')];if(!_0x41f717[_0x8d8a('0x26')]['hasOwnProperty'](_0x8d8a('0x43'))){_0x5ed076[_0x8d8a('0x13')]=qs['limit'](_0x41f717[_0x8d8a('0x26')][_0x8d8a('0x13')]);_0x5ed076[_0x8d8a('0x11')]=qs[_0x8d8a('0x11')](_0x41f717['query']['offset']);}return _0x5c6524['getTeams'](_0x5ed076);}})[_0x8d8a('0x18')](function(_0x4d3570){if(_0x4d3570){return _0x4d3570?{'count':_0x3129b0,'rows':_0x4d3570}:null;}})[_0x8d8a('0x18')](respondWithResult(_0x27e620,null))[_0x8d8a('0x28')](handleError(_0x27e620,null));};exports[_0x8d8a('0x56')]=function(_0x578b9d,_0x39668f){var _0x519fd6=_0x578b9d['body'][_0x8d8a('0x57')];return db[_0x8d8a('0x55')][_0x8d8a('0x4b')]({'where':{'id':_0x519fd6},'attributes':['id'],'include':[{'model':db[_0x8d8a('0x4c')],'as':_0x8d8a('0x58'),'attributes':['id',_0x8d8a('0x1d'),_0x8d8a('0x59'),_0x8d8a('0x5a'),_0x8d8a('0x5b')],'raw':!![]}]})[_0x8d8a('0x18')](function(_0x4e7cff){if(_0x4e7cff){var _0x4eda20=_[_0x8d8a('0x5c')](_0x4e7cff,function(_0x25398d){var _0x3eb957=_0x25398d[_0x8d8a('0x37')]({'plain':!![]});return _0x3eb957[_0x8d8a('0x58')];});return db[_0x8d8a('0x21')][_0x8d8a('0x33')]({'where':{'id':_0x578b9d[_0x8d8a('0x2a')]['id']}})[_0x8d8a('0x18')](function(_0x234d16){return db[_0x8d8a('0x5d')]['transaction'](function(_0x5e2987){return _0x234d16[_0x8d8a('0x56')](_0x519fd6,{'transaction':_0x5e2987})[_0x8d8a('0x18')](function(){return BPromise[_0x8d8a('0x5e')](_0x4eda20,function(_0xc5f606){return db[_0x8d8a('0x40')][_0x8d8a('0x5f')]({'where':{'UserId':_0xc5f606['id'],'WhatsappQueueId':_0x578b9d[_0x8d8a('0x2a')]['id']},'transaction':_0x5e2987});});})[_0x8d8a('0x18')](function(){_0x4eda20[_0x8d8a('0x60')](function(_0x110eb5){socket[_0x8d8a('0x61')](_0x8d8a('0x62'),{'UserId':_0x110eb5['id'],'WhatsappQueueId':_0x234d16['id']});});});});});}})[_0x8d8a('0x18')](respondWithStatusCode(_0x39668f,null))[_0x8d8a('0x28')](handleError(_0x39668f,null));};exports['removeTeams']=function(_0xea2368,_0x1ac074){return db[_0x8d8a('0x55')][_0x8d8a('0x4b')]({'where':{'id':_0xea2368[_0x8d8a('0x26')][_0x8d8a('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8d8a('0x18')](handleEntityNotFound(_0x1ac074,null))['then'](function(_0xf30430){var _0x5e402a=_[_0x8d8a('0x20')](_0xf30430,'id');var _0x4cf388=[];var _0x4796b3=[];var _0x15b492=squel['select']();_0x15b492[_0x8d8a('0x63')](_0x8d8a('0x64'))['from'](_0x8d8a('0x65'),'tq')[_0x8d8a('0x66')](_0x8d8a('0x67'),'ut',_0x8d8a('0x68'))['where'](_0x8d8a('0x69'),_0xea2368['params']['id']);for(var _0x21f086=0x0;_0x21f086<_0xf30430[_0x8d8a('0x30')];_0x21f086+=0x1){let _0xe3680e=_0xf30430[_0x21f086];for(var _0x3892a6=0x0;_0x3892a6<_0xe3680e[_0x8d8a('0x58')][_0x8d8a('0x30')];_0x3892a6+=0x1){let _0x364235=_0xe3680e[_0x8d8a('0x58')][_0x3892a6];var _0x22d00b=_0x15b492[_0x8d8a('0x6a')]();_0x22d00b[_0x8d8a('0x46')](_0x8d8a('0x6b'),_0x364235['id']);_0x4796b3[_0x8d8a('0x6c')](db[_0x8d8a('0x5d')]['query'](_0x22d00b[_0x8d8a('0x6d')](),{'type':db[_0x8d8a('0x5d')][_0x8d8a('0x6e')][_0x8d8a('0x6f')]})[_0x8d8a('0x18')](function(_0x5a3829){if(_0x5a3829['length']===0x1){return _0x364235['id'];}else{var _0xdd07a0=_['every'](_[_0x8d8a('0x20')](_0x5a3829,_0x8d8a('0x70')),function(_0x383d86){return _[_0x8d8a('0x71')](_0x5e402a,_0x383d86);});if(_0xdd07a0){return _0x364235['id'];}}}));}}return BPromise['all'](_0x4796b3)[_0x8d8a('0x18')](function(_0x424c45){_0x4cf388=_(_0x4cf388)[_0x8d8a('0x72')](_0x424c45)[_0x8d8a('0x73')]()[_0x8d8a('0x74')]();return db[_0x8d8a('0x21')][_0x8d8a('0x33')]({'where':{'id':_0xea2368[_0x8d8a('0x2a')]['id']}})[_0x8d8a('0x18')](function(_0x5b2bc1){return db[_0x8d8a('0x5d')][_0x8d8a('0x75')](function(_0x4ad23b){return _0x5b2bc1[_0x8d8a('0x76')](_0xea2368['query'][_0x8d8a('0x57')],{'transaction':_0x4ad23b})[_0x8d8a('0x18')](function(){if(!_[_0x8d8a('0x77')](_0x4cf388)){return _0x5b2bc1[_0x8d8a('0x78')](_0x4cf388,{'transaction':_0x4ad23b});}})[_0x8d8a('0x18')](function(){_0x4cf388[_0x8d8a('0x60')](function(_0x37e4d2){socket[_0x8d8a('0x61')](_0x8d8a('0x79'),{'UserId':_0x37e4d2,'WhatsappQueueId':_0x5b2bc1['id']});});});});});});})[_0x8d8a('0x18')](respondWithStatusCode(_0x1ac074,null))['catch'](handleError(_0x1ac074,null));};exports[_0x8d8a('0x7a')]=function(_0x30bb98,_0x563903){return db[_0x8d8a('0x21')][_0x8d8a('0x33')]({'where':{'id':_0x30bb98[_0x8d8a('0x2a')]['id']}})[_0x8d8a('0x18')](handleEntityNotFound(_0x563903,null))[_0x8d8a('0x18')](function(_0x4c83b7){if(_0x4c83b7){return _0x4c83b7['addAgents'](_0x30bb98[_0x8d8a('0x35')][_0x8d8a('0x57')],_[_0x8d8a('0x7b')](_0x30bb98[_0x8d8a('0x35')],[_0x8d8a('0x57'),'id'])||{})[_0x8d8a('0x7c')](function(_0x26a76a){for(var _0x1fc04a=0x0;_0x1fc04a<_0x30bb98['body'][_0x8d8a('0x57')][_0x8d8a('0x30')];_0x1fc04a+=0x1){socket[_0x8d8a('0x61')](_0x8d8a('0x62'),{'UserId':Number(_0x30bb98[_0x8d8a('0x35')][_0x8d8a('0x57')][_0x1fc04a]),'WhatsappQueueId':Number(_0x30bb98['params']['id'])});}return _0x26a76a;});}})[_0x8d8a('0x18')](respondWithResult(_0x563903,null))[_0x8d8a('0x28')](handleError(_0x563903,null));};exports[_0x8d8a('0x78')]=function(_0x507021,_0x27fe01){return db[_0x8d8a('0x21')][_0x8d8a('0x33')]({'where':{'id':_0x507021[_0x8d8a('0x2a')]['id']}})[_0x8d8a('0x18')](handleEntityNotFound(_0x27fe01,null))[_0x8d8a('0x18')](function(_0x75a207){if(_0x75a207){return _0x75a207[_0x8d8a('0x78')](_0x507021[_0x8d8a('0x26')][_0x8d8a('0x57')])[_0x8d8a('0x18')](function(){if(_[_0x8d8a('0x7d')](_0x507021[_0x8d8a('0x26')][_0x8d8a('0x57')])){for(var _0x1debd5=0x0;_0x1debd5<_0x507021[_0x8d8a('0x26')]['ids']['length'];_0x1debd5+=0x1){socket[_0x8d8a('0x61')]('userWhatsappQueue:remove',{'UserId':Number(_0x507021[_0x8d8a('0x26')][_0x8d8a('0x57')][_0x1debd5]),'WhatsappQueueId':Number(_0x507021['params']['id'])});}}else{socket[_0x8d8a('0x61')](_0x8d8a('0x79'),{'UserId':Number(_0x507021['query'][_0x8d8a('0x57')]),'WhatsappQueueId':Number(_0x507021[_0x8d8a('0x2a')]['id'])});}});}})[_0x8d8a('0x18')](respondWithStatusCode(_0x27fe01,null))[_0x8d8a('0x28')](handleError(_0x27fe01,null));};exports[_0x8d8a('0x7e')]=function(_0x73a7e5,_0x2c3923){var _0x13caad={};var _0x16cf27={};var _0x243e80;var _0x456aa8;return db[_0x8d8a('0x21')][_0x8d8a('0x3f')]({'where':{'id':_0x73a7e5[_0x8d8a('0x2a')]['id']}})[_0x8d8a('0x18')](handleEntityNotFound(_0x2c3923,null))[_0x8d8a('0x18')](function(_0x362b71){if(_0x362b71){_0x243e80=_0x362b71;_0x16cf27[_0x8d8a('0x2b')]=_[_0x8d8a('0x2c')](db['User']['rawAttributes']);_0x16cf27[_0x8d8a('0x26')]=_['keys'](_0x73a7e5[_0x8d8a('0x26')]);_0x16cf27[_0x8d8a('0x41')]=_['intersection'](_0x16cf27[_0x8d8a('0x2b')],_0x16cf27['query']);_0x13caad[_0x8d8a('0x2d')]=_[_0x8d8a('0x2e')](_0x16cf27[_0x8d8a('0x2b')],qs[_0x8d8a('0x2f')](_0x73a7e5[_0x8d8a('0x26')]['fields']));_0x13caad['attributes']=_0x13caad[_0x8d8a('0x2d')][_0x8d8a('0x30')]?_0x13caad['attributes']:_0x16cf27[_0x8d8a('0x2b')];_0x13caad[_0x8d8a('0x44')]=qs[_0x8d8a('0x45')](_0x73a7e5['query'][_0x8d8a('0x45')]);_0x13caad[_0x8d8a('0x46')]=qs['filters'](_[_0x8d8a('0x47')](_0x73a7e5[_0x8d8a('0x26')],_0x16cf27['filters']));if(_0x73a7e5[_0x8d8a('0x26')]['filter']){_0x13caad[_0x8d8a('0x46')]=_[_0x8d8a('0x32')](_0x13caad[_0x8d8a('0x46')],{'$or':_[_0x8d8a('0x20')](_0x13caad[_0x8d8a('0x2d')],function(_0x481084){var _0x57c863={};_0x57c863[_0x481084]={'$like':'%'+_0x73a7e5[_0x8d8a('0x26')][_0x8d8a('0x49')]+'%'};return _0x57c863;})});}_0x13caad=_[_0x8d8a('0x32')]({},_0x13caad,_0x73a7e5[_0x8d8a('0x4a')]);return _0x243e80['getAgents'](_0x13caad);}})[_0x8d8a('0x18')](function(_0x9f117e){if(_0x9f117e){_0x456aa8=_0x9f117e[_0x8d8a('0x30')];if(!_0x73a7e5[_0x8d8a('0x26')][_0x8d8a('0x42')](_0x8d8a('0x43'))){_0x13caad[_0x8d8a('0x13')]=qs[_0x8d8a('0x13')](_0x73a7e5[_0x8d8a('0x26')][_0x8d8a('0x13')]);_0x13caad[_0x8d8a('0x11')]=qs[_0x8d8a('0x11')](_0x73a7e5[_0x8d8a('0x26')]['offset']);}return _0x243e80[_0x8d8a('0x7e')](_0x13caad);}})['then'](function(_0x1e7086){if(_0x1e7086){return _0x1e7086?{'count':_0x456aa8,'rows':_0x1e7086}:null;}})['then'](respondWithResult(_0x2c3923,null))[_0x8d8a('0x28')](handleError(_0x2c3923,null));}; \ No newline at end of file +var _0x92d7=['value','isEmpty','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','index','WhatsappQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','show','params','model','intersection','fields','attributes','length','merge','options','find','catch','create','body','userProfileId','autoAssociation','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','map','filter','findAndCountAll','agent','rows','format','%s/%s','SIP','whatsappPause','createdAt','updatedAt','findOne','keys','Team','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','push','SELECT','includes','union','compact'];(function(_0x2a6bc,_0x761a07){var _0x288d3a=function(_0x3c52d8){while(--_0x3c52d8){_0x2a6bc['push'](_0x2a6bc['shift']());}};_0x288d3a(++_0x761a07);}(_0x92d7,0x1cf));var _0x792d=function(_0x2ad9f5,_0xb0ed16){_0x2ad9f5=_0x2ad9f5-0x0;var _0x3ea170=_0x92d7[_0x2ad9f5];return _0x3ea170;};'use strict';var BPromise=require(_0x792d('0x0'));var util=require(_0x792d('0x1'));var _=require(_0x792d('0x2'));var squel=require(_0x792d('0x3'));var Redis=require(_0x792d('0x4'));var qs=require(_0x792d('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x792d('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x792d('0x7')](config[_0x792d('0x8')],{'host':_0x792d('0x9'),'port':0x18eb});var socket=require(_0x792d('0xa'))(new Redis(config[_0x792d('0x8')]));require(_0x792d('0xb'))['register'](socket);function respondWithStatusCode(_0xaf0aa8,_0x59f005){_0x59f005=_0x59f005||0xcc;return function(_0x2419ad){if(_0x2419ad){return _0xaf0aa8['sendStatus'](_0x59f005);}return _0xaf0aa8[_0x792d('0xc')](_0x59f005)[_0x792d('0xd')]();};}function respondWithResult(_0x3b0599,_0x214bff){_0x214bff=_0x214bff||0xc8;return function(_0x17b450){if(_0x17b450){return _0x3b0599[_0x792d('0xc')](_0x214bff)[_0x792d('0xe')](_0x17b450);}};}function respondWithFilteredResult(_0x24d03f,_0x2f790b){return function(_0x852112){if(_0x852112){var _0x4f00d0=typeof _0x2f790b[_0x792d('0xf')]===_0x792d('0x10')&&typeof _0x2f790b[_0x792d('0x11')]===_0x792d('0x10');var _0x33c3f8=_0x852112[_0x792d('0x12')];var _0x59f271=_0x4f00d0?0x0:_0x2f790b['offset'];var _0x8f2764=_0x4f00d0?_0x852112['count']:_0x2f790b[_0x792d('0xf')]+_0x2f790b[_0x792d('0x11')];var _0x342bb0;if(_0x8f2764>=_0x33c3f8){_0x8f2764=_0x33c3f8;_0x342bb0=0xc8;}else{_0x342bb0=0xce;}_0x24d03f[_0x792d('0xc')](_0x342bb0);return _0x24d03f[_0x792d('0x13')](_0x792d('0x14'),_0x59f271+'-'+_0x8f2764+'/'+_0x33c3f8)[_0x792d('0xe')](_0x852112);}return null;};}function saveUpdates(_0x534eaa){return function(_0x41da86){if(_0x41da86){return _0x41da86[_0x792d('0x15')](_0x534eaa)['then'](function(_0x313aee){return _0x313aee;});}return null;};}function removeEntity(_0x2db4ac){return function(_0xdd23d5){if(_0xdd23d5){return _0xdd23d5[_0x792d('0x16')]()[_0x792d('0x17')](function(){var _0x3fda64=_0xdd23d5[_0x792d('0x18')]({'plain':!![]});var _0x1ec3c5=_0x792d('0x19');return db[_0x792d('0x1a')][_0x792d('0x16')]({'where':{'type':_0x1ec3c5,'resourceId':_0x3fda64['id']}})[_0x792d('0x17')](function(){return _0xdd23d5;});})[_0x792d('0x17')](function(){_0x2db4ac['status'](0xcc)[_0x792d('0xd')]();});}};}function handleEntityNotFound(_0x361f34){return function(_0xcdb00){if(!_0xcdb00){_0x361f34[_0x792d('0x1b')](0x194);}return _0xcdb00;};}function handleError(_0x8d1ca3,_0x422f43){_0x422f43=_0x422f43||0x1f4;return function(_0x524753){logger[_0x792d('0x1c')](_0x524753[_0x792d('0x1d')]);if(_0x524753['name']){delete _0x524753[_0x792d('0x1e')];}_0x8d1ca3[_0x792d('0xc')](_0x422f43)['send'](_0x524753);};}exports[_0x792d('0x1f')]=function(_0x320db4,_0x3fe1de){var _0x3e4112={};var _0x4f61c9={'count':0x0,'rows':[]};var _0x442d26=_['map'](db[_0x792d('0x20')][_0x792d('0x21')],function(_0x287026){return{'name':_0x287026['fieldName'],'type':_0x287026[_0x792d('0x22')][_0x792d('0x23')]};});_0x3e4112=qs[_0x792d('0x24')](_0x442d26,_0x320db4);var _0x554133={'where':_0x3e4112[_0x792d('0x25')]};return db[_0x792d('0x20')][_0x792d('0x12')](_0x554133)[_0x792d('0x17')](function(_0x241726){_0x4f61c9[_0x792d('0x12')]=_0x241726;_0x3e4112[_0x792d('0x26')]=qs[_0x792d('0x26')](_0x320db4[_0x792d('0x27')]);return db[_0x792d('0x20')][_0x792d('0x28')](_0x3e4112);})['then'](function(_0x2bd249){_0x4f61c9['rows']=_0x2bd249;return _0x4f61c9;})[_0x792d('0x17')](respondWithFilteredResult(_0x3fe1de,_0x3e4112))['catch'](handleError(_0x3fe1de,null));};exports[_0x792d('0x29')]=function(_0x338db4,_0x5542aa){var _0x428432={'raw':!![],'where':{'id':_0x338db4[_0x792d('0x2a')]['id']}},_0x679590={};_0x679590[_0x792d('0x2b')]=_['keys'](db[_0x792d('0x20')][_0x792d('0x21')]);_0x679590[_0x792d('0x27')]=_['keys'](_0x338db4['query']);_0x679590['filters']=_[_0x792d('0x2c')](_0x679590['model'],_0x679590[_0x792d('0x27')]);_0x428432['attributes']=_[_0x792d('0x2c')](_0x679590[_0x792d('0x2b')],qs[_0x792d('0x2d')](_0x338db4[_0x792d('0x27')]['fields']));_0x428432[_0x792d('0x2e')]=_0x428432[_0x792d('0x2e')][_0x792d('0x2f')]?_0x428432['attributes']:_0x679590[_0x792d('0x2b')];if(_0x338db4[_0x792d('0x27')]['includeAll']){_0x428432['include']=[{'all':!![]}];}_0x428432=_[_0x792d('0x30')]({},_0x428432,_0x338db4[_0x792d('0x31')]);return db['WhatsappQueue'][_0x792d('0x32')](_0x428432)[_0x792d('0x17')](handleEntityNotFound(_0x5542aa,null))['then'](respondWithResult(_0x5542aa,null))[_0x792d('0x33')](handleError(_0x5542aa,null));};exports[_0x792d('0x34')]=function(_0x485583,_0x37a2d1){return db['WhatsappQueue'][_0x792d('0x34')](_0x485583[_0x792d('0x35')],{})[_0x792d('0x17')](function(_0x16233d){var _0x47b1e0=_0x485583['user'][_0x792d('0x18')]({'plain':!![]});if(!_0x47b1e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47b1e0['role']==='user'){var _0x13c0bf=_0x16233d[_0x792d('0x18')]({'plain':!![]});var _0x511166='WhatsappQueues';return db['UserProfileSection'][_0x792d('0x32')]({'where':{'name':_0x511166,'userProfileId':_0x47b1e0[_0x792d('0x36')]},'raw':!![]})[_0x792d('0x17')](function(_0x41ffed){if(_0x41ffed&&_0x41ffed[_0x792d('0x37')]===0x0){return db[_0x792d('0x1a')]['create']({'name':_0x13c0bf[_0x792d('0x1e')],'resourceId':_0x13c0bf['id'],'type':_0x41ffed[_0x792d('0x1e')],'sectionId':_0x41ffed['id']},{})[_0x792d('0x17')](function(){return _0x16233d;});}else{return _0x16233d;}})[_0x792d('0x33')](function(_0x5e4642){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e4642);throw _0x5e4642;});}return _0x16233d;})[_0x792d('0x17')](respondWithResult(_0x37a2d1,0xc9))['catch'](handleError(_0x37a2d1,null));};exports[_0x792d('0x15')]=function(_0x43eae2,_0x53253f){if(_0x43eae2[_0x792d('0x35')]['id']){delete _0x43eae2['body']['id'];}return db['WhatsappQueue'][_0x792d('0x32')]({'where':{'id':_0x43eae2[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x53253f,null))[_0x792d('0x17')](saveUpdates(_0x43eae2[_0x792d('0x35')],null))[_0x792d('0x17')](respondWithResult(_0x53253f,null))[_0x792d('0x33')](handleError(_0x53253f,null));};exports['destroy']=function(_0x3f96b6,_0x4bf466){return db[_0x792d('0x20')][_0x792d('0x32')]({'where':{'id':_0x3f96b6[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x4bf466,null))['then'](removeEntity(_0x4bf466,null))[_0x792d('0x33')](handleError(_0x4bf466,null));};exports[_0x792d('0x38')]=function(_0x46ce92,_0x1acc3c){return db[_0x792d('0x20')][_0x792d('0x38')]()[_0x792d('0x17')](respondWithResult(_0x1acc3c,null))[_0x792d('0x33')](handleError(_0x1acc3c,null));};exports[_0x792d('0x39')]=function(_0x26491f,_0x4a8483){var _0x3c1088={'raw':!![],'where':{}},_0x36be01={},_0x1f2333;return db[_0x792d('0x20')]['findOne']({'where':{'id':_0x26491f['params']['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x4a8483,null))[_0x792d('0x17')](function(_0x321255){if(_0x321255){_0x1f2333=_0x321255[_0x792d('0x18')]({'plain':!![]});_0x36be01[_0x792d('0x2b')]=_['keys'](db[_0x792d('0x3a')][_0x792d('0x21')]);_0x36be01[_0x792d('0x27')]=_['keys'](_0x26491f['query']);_0x36be01[_0x792d('0x3b')]=_[_0x792d('0x2c')](_0x36be01[_0x792d('0x2b')],_0x36be01[_0x792d('0x27')]);_0x3c1088[_0x792d('0x2e')]=_[_0x792d('0x2c')](_0x36be01[_0x792d('0x2b')],qs[_0x792d('0x2d')](_0x26491f['query'][_0x792d('0x2d')]));_0x3c1088[_0x792d('0x2e')]=_0x3c1088[_0x792d('0x2e')]['length']?_0x3c1088['attributes']:_0x36be01[_0x792d('0x2b')];if(!_0x26491f[_0x792d('0x27')][_0x792d('0x3c')](_0x792d('0x3d'))){_0x3c1088[_0x792d('0x11')]=qs[_0x792d('0x11')](_0x26491f[_0x792d('0x27')][_0x792d('0x11')]);_0x3c1088[_0x792d('0xf')]=qs[_0x792d('0xf')](_0x26491f[_0x792d('0x27')][_0x792d('0xf')]);}_0x3c1088[_0x792d('0x3e')]=qs[_0x792d('0x3f')](_0x26491f[_0x792d('0x27')][_0x792d('0x3f')]);_0x3c1088[_0x792d('0x25')]=qs[_0x792d('0x3b')](_[_0x792d('0x40')](_0x26491f[_0x792d('0x27')],_0x36be01[_0x792d('0x3b')]));_0x3c1088['where'][_0x792d('0x41')]=_0x321255['id'];if(_0x26491f[_0x792d('0x27')]['filter']){_0x3c1088[_0x792d('0x25')]=_[_0x792d('0x30')](_0x3c1088[_0x792d('0x25')],{'$or':_[_0x792d('0x42')](_0x3c1088['attributes'],function(_0x1b6922){var _0x26ebc2={};_0x26ebc2[_0x1b6922]={'$like':'%'+_0x26491f[_0x792d('0x27')][_0x792d('0x43')]+'%'};return _0x26ebc2;})});}_0x3c1088=_['merge']({},_0x3c1088,_0x26491f['options']);return db[_0x792d('0x3a')][_0x792d('0x28')](_0x3c1088);}})[_0x792d('0x17')](function(_0x4437d0){if(_0x4437d0){return db['User'][_0x792d('0x44')]({'where':{'id':_['map'](_0x4437d0,'UserId'),'role':_0x792d('0x45')},'attributes':['id','name','whatsappPause','updatedAt','createdAt']});}})['then'](function(_0x5548c1){if(_0x5548c1){return{'count':_0x5548c1[_0x792d('0x12')],'rows':_['map'](_0x5548c1[_0x792d('0x46')],function(_0x17b96c){return{'membername':_0x17b96c[_0x792d('0x1e')],'UserId':_0x17b96c['id'],'queue_name':_0x1f2333[_0x792d('0x1e')],'WhatsappQueueId':_0x1f2333['id'],'interface':util[_0x792d('0x47')](_0x792d('0x48'),_0x792d('0x49'),_0x17b96c[_0x792d('0x1e')]),'penalty':0x0,'paused':_0x17b96c[_0x792d('0x4a')],'createdAt':_0x17b96c[_0x792d('0x4b')],'updatedAt':_0x17b96c[_0x792d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x792d('0x17')](respondWithFilteredResult(_0x4a8483,_0x3c1088))['catch'](handleError(_0x4a8483,null));};exports['getTeams']=function(_0x10716f,_0x46f4ed){var _0x4d0a13={};var _0xbf54db={};var _0x4aa0a1;var _0x546a0f;return db[_0x792d('0x20')][_0x792d('0x4d')]({'where':{'id':_0x10716f[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x46f4ed,null))[_0x792d('0x17')](function(_0x2f025e){if(_0x2f025e){_0x4aa0a1=_0x2f025e;_0xbf54db[_0x792d('0x2b')]=_[_0x792d('0x4e')](db[_0x792d('0x4f')][_0x792d('0x21')]);_0xbf54db['query']=_[_0x792d('0x4e')](_0x10716f[_0x792d('0x27')]);_0xbf54db[_0x792d('0x3b')]=_[_0x792d('0x2c')](_0xbf54db[_0x792d('0x2b')],_0xbf54db[_0x792d('0x27')]);_0x4d0a13[_0x792d('0x2e')]=_[_0x792d('0x2c')](_0xbf54db['model'],qs['fields'](_0x10716f['query'][_0x792d('0x2d')]));_0x4d0a13[_0x792d('0x2e')]=_0x4d0a13[_0x792d('0x2e')][_0x792d('0x2f')]?_0x4d0a13[_0x792d('0x2e')]:_0xbf54db['model'];_0x4d0a13[_0x792d('0x3e')]=qs['sort'](_0x10716f[_0x792d('0x27')][_0x792d('0x3f')]);_0x4d0a13[_0x792d('0x25')]=qs[_0x792d('0x3b')](_[_0x792d('0x40')](_0x10716f['query'],_0xbf54db['filters']));if(_0x10716f[_0x792d('0x27')][_0x792d('0x43')]){_0x4d0a13[_0x792d('0x25')]=_[_0x792d('0x30')](_0x4d0a13[_0x792d('0x25')],{'$or':_[_0x792d('0x42')](_0x4d0a13[_0x792d('0x2e')],function(_0x4e08a3){var _0x5649e1={};_0x5649e1[_0x4e08a3]={'$like':'%'+_0x10716f[_0x792d('0x27')][_0x792d('0x43')]+'%'};return _0x5649e1;})});}_0x4d0a13=_[_0x792d('0x30')]({},_0x4d0a13,_0x10716f[_0x792d('0x31')]);return _0x4aa0a1[_0x792d('0x50')](_0x4d0a13);}})[_0x792d('0x17')](function(_0x4ae47b){if(_0x4ae47b){_0x546a0f=_0x4ae47b[_0x792d('0x2f')];if(!_0x10716f[_0x792d('0x27')][_0x792d('0x3c')](_0x792d('0x3d'))){_0x4d0a13[_0x792d('0x11')]=qs[_0x792d('0x11')](_0x10716f[_0x792d('0x27')][_0x792d('0x11')]);_0x4d0a13['offset']=qs[_0x792d('0xf')](_0x10716f[_0x792d('0x27')][_0x792d('0xf')]);}return _0x4aa0a1[_0x792d('0x50')](_0x4d0a13);}})[_0x792d('0x17')](function(_0x36e335){if(_0x36e335){return _0x36e335?{'count':_0x546a0f,'rows':_0x36e335}:null;}})['then'](respondWithResult(_0x46f4ed,null))[_0x792d('0x33')](handleError(_0x46f4ed,null));};exports[_0x792d('0x51')]=function(_0x1656da,_0x46747f){var _0x3e51e1=_0x1656da[_0x792d('0x35')][_0x792d('0x52')];return db[_0x792d('0x4f')][_0x792d('0x28')]({'where':{'id':_0x3e51e1},'attributes':['id'],'include':[{'model':db[_0x792d('0x53')],'as':_0x792d('0x54'),'attributes':['id',_0x792d('0x1e'),'online',_0x792d('0x55'),_0x792d('0x56')],'raw':!![]}]})[_0x792d('0x17')](function(_0x250653){if(_0x250653){var _0x4ebe0e=_[_0x792d('0x57')](_0x250653,function(_0x337b5b){var _0x253b69=_0x337b5b['get']({'plain':!![]});return _0x253b69[_0x792d('0x54')];});return db['WhatsappQueue']['find']({'where':{'id':_0x1656da[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](function(_0x2880bc){return db[_0x792d('0x58')][_0x792d('0x59')](function(_0xbd1247){return _0x2880bc[_0x792d('0x51')](_0x3e51e1,{'transaction':_0xbd1247})[_0x792d('0x17')](function(){return BPromise['each'](_0x4ebe0e,function(_0x22599c){return db[_0x792d('0x3a')]['findOrCreate']({'where':{'UserId':_0x22599c['id'],'WhatsappQueueId':_0x1656da[_0x792d('0x2a')]['id']},'transaction':_0xbd1247});});})[_0x792d('0x17')](function(){_0x4ebe0e[_0x792d('0x5a')](function(_0x4f5107){socket[_0x792d('0x5b')](_0x792d('0x5c'),{'UserId':_0x4f5107['id'],'WhatsappQueueId':_0x2880bc['id']});});});});});}})[_0x792d('0x17')](respondWithStatusCode(_0x46747f,null))['catch'](handleError(_0x46747f,null));};exports[_0x792d('0x5d')]=function(_0x348f1f,_0x5d9fd4){return db[_0x792d('0x4f')][_0x792d('0x28')]({'where':{'id':_0x348f1f[_0x792d('0x27')][_0x792d('0x52')]},'attributes':['id'],'include':[{'model':db[_0x792d('0x53')],'as':_0x792d('0x54'),'attributes':['id'],'raw':!![]}]})[_0x792d('0x17')](handleEntityNotFound(_0x5d9fd4,null))[_0x792d('0x17')](function(_0x2a02a7){var _0x2701f3=_[_0x792d('0x42')](_0x2a02a7,'id');var _0x4e52e9=[];var _0x46269b=[];var _0x2947f2=squel[_0x792d('0x5e')]();_0x2947f2[_0x792d('0x5f')](_0x792d('0x60'))[_0x792d('0x61')](_0x792d('0x62'),'tq')[_0x792d('0x63')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x792d('0x25')](_0x792d('0x64'),_0x348f1f[_0x792d('0x2a')]['id']);for(var _0x3af1e5=0x0;_0x3af1e5<_0x2a02a7[_0x792d('0x2f')];_0x3af1e5+=0x1){let _0x36183f=_0x2a02a7[_0x3af1e5];for(var _0x1174c0=0x0;_0x1174c0<_0x36183f['Agents'][_0x792d('0x2f')];_0x1174c0+=0x1){let _0x4fe7af=_0x36183f[_0x792d('0x54')][_0x1174c0];var _0x1a9679=_0x2947f2[_0x792d('0x65')]();_0x1a9679[_0x792d('0x25')]('ut.UserId\x20=\x20?',_0x4fe7af['id']);_0x46269b[_0x792d('0x66')](db['sequelize'][_0x792d('0x27')](_0x1a9679['toString'](),{'type':db[_0x792d('0x58')]['QueryTypes'][_0x792d('0x67')]})[_0x792d('0x17')](function(_0x5ab8dc){if(_0x5ab8dc[_0x792d('0x2f')]===0x1){return _0x4fe7af['id'];}else{var _0xe78093=_['every'](_[_0x792d('0x42')](_0x5ab8dc,'TeamId'),function(_0x4aca61){return _[_0x792d('0x68')](_0x2701f3,_0x4aca61);});if(_0xe78093){return _0x4fe7af['id'];}}}));}}return BPromise['all'](_0x46269b)[_0x792d('0x17')](function(_0x4fe249){_0x4e52e9=_(_0x4e52e9)[_0x792d('0x69')](_0x4fe249)[_0x792d('0x6a')]()[_0x792d('0x6b')]();return db[_0x792d('0x20')][_0x792d('0x32')]({'where':{'id':_0x348f1f[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](function(_0xff254f){return db[_0x792d('0x58')][_0x792d('0x59')](function(_0x1a69dd){return _0xff254f['removeTeams'](_0x348f1f[_0x792d('0x27')][_0x792d('0x52')],{'transaction':_0x1a69dd})[_0x792d('0x17')](function(){if(!_[_0x792d('0x6c')](_0x4e52e9)){return _0xff254f['removeAgents'](_0x4e52e9,{'transaction':_0x1a69dd});}})['then'](function(){_0x4e52e9['forEach'](function(_0x220632){socket[_0x792d('0x5b')](_0x792d('0x6d'),{'UserId':_0x220632,'WhatsappQueueId':_0xff254f['id']});});});});});});})[_0x792d('0x17')](respondWithStatusCode(_0x5d9fd4,null))[_0x792d('0x33')](handleError(_0x5d9fd4,null));};exports[_0x792d('0x6e')]=function(_0x3377c9,_0x3db7c7){return db[_0x792d('0x20')][_0x792d('0x32')]({'where':{'id':_0x3377c9[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x3db7c7,null))[_0x792d('0x17')](function(_0x3c3b02){if(_0x3c3b02){return _0x3c3b02[_0x792d('0x6e')](_0x3377c9[_0x792d('0x35')]['ids'],_['omit'](_0x3377c9[_0x792d('0x35')],['ids','id'])||{})[_0x792d('0x6f')](function(_0x24f326){for(var _0x37005e=0x0;_0x37005e<_0x3377c9['body'][_0x792d('0x52')][_0x792d('0x2f')];_0x37005e+=0x1){socket[_0x792d('0x5b')](_0x792d('0x5c'),{'UserId':Number(_0x3377c9[_0x792d('0x35')]['ids'][_0x37005e]),'WhatsappQueueId':Number(_0x3377c9['params']['id'])});}return _0x24f326;});}})[_0x792d('0x17')](respondWithResult(_0x3db7c7,null))[_0x792d('0x33')](handleError(_0x3db7c7,null));};exports['removeAgents']=function(_0x1ed1bd,_0x2e30c6){return db[_0x792d('0x20')][_0x792d('0x32')]({'where':{'id':_0x1ed1bd[_0x792d('0x2a')]['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x2e30c6,null))[_0x792d('0x17')](function(_0x15e21e){if(_0x15e21e){return _0x15e21e['removeAgents'](_0x1ed1bd[_0x792d('0x27')][_0x792d('0x52')])['then'](function(){if(_[_0x792d('0x70')](_0x1ed1bd[_0x792d('0x27')][_0x792d('0x52')])){for(var _0x55c2d4=0x0;_0x55c2d4<_0x1ed1bd[_0x792d('0x27')][_0x792d('0x52')][_0x792d('0x2f')];_0x55c2d4+=0x1){socket[_0x792d('0x5b')](_0x792d('0x6d'),{'UserId':Number(_0x1ed1bd[_0x792d('0x27')][_0x792d('0x52')][_0x55c2d4]),'WhatsappQueueId':Number(_0x1ed1bd['params']['id'])});}}else{socket['emit'](_0x792d('0x6d'),{'UserId':Number(_0x1ed1bd['query'][_0x792d('0x52')]),'WhatsappQueueId':Number(_0x1ed1bd[_0x792d('0x2a')]['id'])});}});}})[_0x792d('0x17')](respondWithStatusCode(_0x2e30c6,null))[_0x792d('0x33')](handleError(_0x2e30c6,null));};exports[_0x792d('0x71')]=function(_0x20434b,_0x5eb073){var _0x2bfb90={};var _0x445f2a={};var _0x54c63c;var _0x90ee7f;return db[_0x792d('0x20')]['findOne']({'where':{'id':_0x20434b['params']['id']}})[_0x792d('0x17')](handleEntityNotFound(_0x5eb073,null))[_0x792d('0x17')](function(_0x1528b7){if(_0x1528b7){_0x54c63c=_0x1528b7;_0x445f2a[_0x792d('0x2b')]=_[_0x792d('0x4e')](db[_0x792d('0x53')]['rawAttributes']);_0x445f2a[_0x792d('0x27')]=_[_0x792d('0x4e')](_0x20434b[_0x792d('0x27')]);_0x445f2a[_0x792d('0x3b')]=_[_0x792d('0x2c')](_0x445f2a[_0x792d('0x2b')],_0x445f2a[_0x792d('0x27')]);_0x2bfb90[_0x792d('0x2e')]=_['intersection'](_0x445f2a[_0x792d('0x2b')],qs[_0x792d('0x2d')](_0x20434b[_0x792d('0x27')][_0x792d('0x2d')]));_0x2bfb90[_0x792d('0x2e')]=_0x2bfb90[_0x792d('0x2e')][_0x792d('0x2f')]?_0x2bfb90[_0x792d('0x2e')]:_0x445f2a[_0x792d('0x2b')];_0x2bfb90[_0x792d('0x3e')]=qs[_0x792d('0x3f')](_0x20434b[_0x792d('0x27')][_0x792d('0x3f')]);_0x2bfb90[_0x792d('0x25')]=qs['filters'](_[_0x792d('0x40')](_0x20434b[_0x792d('0x27')],_0x445f2a[_0x792d('0x3b')]));if(_0x20434b[_0x792d('0x27')][_0x792d('0x43')]){_0x2bfb90['where']=_[_0x792d('0x30')](_0x2bfb90['where'],{'$or':_[_0x792d('0x42')](_0x2bfb90[_0x792d('0x2e')],function(_0x556b8a){var _0x4cd92a={};_0x4cd92a[_0x556b8a]={'$like':'%'+_0x20434b[_0x792d('0x27')][_0x792d('0x43')]+'%'};return _0x4cd92a;})});}_0x2bfb90=_['merge']({},_0x2bfb90,_0x20434b[_0x792d('0x31')]);return _0x54c63c[_0x792d('0x71')](_0x2bfb90);}})[_0x792d('0x17')](function(_0xa222da){if(_0xa222da){_0x90ee7f=_0xa222da[_0x792d('0x2f')];if(!_0x20434b[_0x792d('0x27')]['hasOwnProperty'](_0x792d('0x3d'))){_0x2bfb90['limit']=qs[_0x792d('0x11')](_0x20434b[_0x792d('0x27')][_0x792d('0x11')]);_0x2bfb90[_0x792d('0xf')]=qs[_0x792d('0xf')](_0x20434b['query']['offset']);}return _0x54c63c[_0x792d('0x71')](_0x2bfb90);}})[_0x792d('0x17')](function(_0x3b82f6){if(_0x3b82f6){return _0x3b82f6?{'count':_0x90ee7f,'rows':_0x3b82f6}:null;}})[_0x792d('0x17')](respondWithResult(_0x5eb073,null))[_0x792d('0x33')](handleError(_0x5eb073,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f8c1f6a..bf8161d 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 _0x991f=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','WhatsappQueue'];(function(_0x2f1a99,_0x27bd1c){var _0x4c415c=function(_0x11720c){while(--_0x11720c){_0x2f1a99['push'](_0x2f1a99['shift']());}};_0x4c415c(++_0x27bd1c);}(_0x991f,0xd7));var _0xf991=function(_0x20b5d6,_0x426c04){_0x20b5d6=_0x20b5d6-0x0;var _0x1d3319=_0x991f[_0x20b5d6];return _0x1d3319;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xf991('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf991('0x1')](0x0);var events={'afterCreate':_0xf991('0x2'),'afterUpdate':_0xf991('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10f898){return function(_0x4f9cc1,_0x2aad90,_0x41b8ba){WhatsappQueueEvents[_0xf991('0x4')](_0x10f898+':'+_0x4f9cc1['id'],_0x4f9cc1);WhatsappQueueEvents['emit'](_0x10f898,_0x4f9cc1);_0x41b8ba(null);};}for(var e in events){if(events[_0xf991('0x5')](e)){var event=events[e];WhatsappQueue[_0xf991('0x6')](e,emitEvent(event));}}module[_0xf991('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x37d2=['../../mysqldb','WhatsappQueue','save','remove','emit','exports','events'];(function(_0xa9b067,_0x2047eb){var _0x492156=function(_0x32a056){while(--_0x32a056){_0xa9b067['push'](_0xa9b067['shift']());}};_0x492156(++_0x2047eb);}(_0x37d2,0x14f));var _0x237d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x37d2[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x237d('0x0'));var WhatsappQueue=require(_0x237d('0x1'))['db'][_0x237d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x237d('0x3'),'afterUpdate':'update','afterDestroy':_0x237d('0x4')};function emitEvent(_0xdfb42){return function(_0x5efae6,_0x4b9286,_0x1bbf6b){WhatsappQueueEvents[_0x237d('0x5')](_0xdfb42+':'+_0x5efae6['id'],_0x5efae6);WhatsappQueueEvents[_0x237d('0x5')](_0xdfb42,_0x5efae6);_0x1bbf6b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x237d('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 447f84e..d3ccb0d 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 _0x6483=['lodash','util','api','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','whatsapp_queues'];(function(_0x22b8d4,_0x3c0230){var _0x2b0328=function(_0x13bfbc){while(--_0x13bfbc){_0x22b8d4['push'](_0x22b8d4['shift']());}};_0x2b0328(++_0x3c0230);}(_0x6483,0xb0));var _0x3648=function(_0x5238ca,_0x750aa4){_0x5238ca=_0x5238ca-0x0;var _0x4f39f8=_0x6483[_0x5238ca];return _0x4f39f8;};'use strict';var _=require(_0x3648('0x0'));var util=require(_0x3648('0x1'));var logger=require('../../config/logger')(_0x3648('0x2'));var moment=require('moment');var BPromise=require(_0x3648('0x3'));var rp=require(_0x3648('0x4'));var fs=require('fs');var path=require(_0x3648('0x5'));var rimraf=require(_0x3648('0x6'));var config=require('../../config/environment');var attributes=require(_0x3648('0x7'));module[_0x3648('0x8')]=function(_0x2da67d,_0x12243a){return _0x2da67d[_0x3648('0x9')]('WhatsappQueue',attributes,{'tableName':_0x3648('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fa8=['./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0fa8,0xbb));var _0x80fa=function(_0x466410,_0x4069d9){_0x466410=_0x466410-0x0;var _0x3d758e=_0x0fa8[_0x466410];return _0x3d758e;};'use strict';var _=require('lodash');var util=require(_0x80fa('0x0'));var logger=require(_0x80fa('0x1'))(_0x80fa('0x2'));var moment=require(_0x80fa('0x3'));var BPromise=require(_0x80fa('0x4'));var rp=require(_0x80fa('0x5'));var fs=require('fs');var path=require(_0x80fa('0x6'));var rimraf=require(_0x80fa('0x7'));var config=require('../../config/environment');var attributes=require(_0x80fa('0x8'));module[_0x80fa('0x9')]=function(_0x6eca35,_0x4a11c3){return _0x6eca35[_0x80fa('0xa')](_0x80fa('0xb'),attributes,{'tableName':_0x80fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 7eb6eb3..e97f37c 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 _0xdad2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model','catch','find','ShowWhatsappQueue','lodash','bluebird'];(function(_0x3a801b,_0x592c24){var _0x2535fe=function(_0x53f3b1){while(--_0x53f3b1){_0x3a801b['push'](_0x3a801b['shift']());}};_0x2535fe(++_0x592c24);}(_0xdad2,0xee));var _0x2dad=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xdad2[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x2dad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2dad('0x1'));var rs=require(_0x2dad('0x2'));var fs=require('fs');var Redis=require(_0x2dad('0x3'));var db=require(_0x2dad('0x4'))['db'];var utils=require(_0x2dad('0x5'));var logger=require(_0x2dad('0x6'))(_0x2dad('0x7'));var config=require(_0x2dad('0x8'));var jayson=require(_0x2dad('0x9'));var client=jayson[_0x2dad('0xa')]['http']({'port':0x232a});config[_0x2dad('0xb')]=_[_0x2dad('0xc')](config[_0x2dad('0xb')],{'host':_0x2dad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2dad('0xb')]));require(_0x2dad('0xe'))[_0x2dad('0xf')](socket);function respondWithRpcPromise(_0x310eb0,_0x41450c,_0x575123){return new BPromise(function(_0x2771cb,_0x434c84){return client[_0x2dad('0x10')](_0x310eb0,_0x575123)[_0x2dad('0x11')](function(_0x333df1){logger[_0x2dad('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x41450c,_0x2dad('0x13'));logger[_0x2dad('0x14')](_0x2dad('0x15'),_0x41450c,_0x2dad('0x13'),JSON[_0x2dad('0x16')](_0x333df1));if(_0x333df1['error']){if(_0x333df1[_0x2dad('0x17')][_0x2dad('0x18')]===0x1f4){logger[_0x2dad('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x41450c,_0x333df1['error'][_0x2dad('0x19')]);return _0x434c84(_0x333df1[_0x2dad('0x17')][_0x2dad('0x19')]);}logger[_0x2dad('0x17')](_0x2dad('0x1a'),_0x41450c,_0x333df1[_0x2dad('0x17')][_0x2dad('0x19')]);return _0x2771cb(_0x333df1[_0x2dad('0x17')][_0x2dad('0x19')]);}else{logger[_0x2dad('0x12')](_0x2dad('0x1a'),_0x41450c,_0x2dad('0x13'));_0x2771cb(_0x333df1[_0x2dad('0x1b')]['message']);}})['catch'](function(_0x515454){logger[_0x2dad('0x17')](_0x2dad('0x1a'),_0x41450c,_0x515454);_0x434c84(_0x515454);});});}exports[_0x2dad('0x1c')]=function(_0x3045a0){var _0x17a10d=this;return new Promise(function(_0x276428,_0x48aa95){return db[_0x2dad('0x1d')][_0x2dad('0x1e')]({'raw':_0x3045a0[_0x2dad('0x1f')]?_0x3045a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x3045a0['options']?_0x3045a0[_0x2dad('0x1f')]['where']||null:null,'attributes':_0x3045a0[_0x2dad('0x1f')]?_0x3045a0[_0x2dad('0x1f')][_0x2dad('0x20')]||null:null,'limit':_0x3045a0[_0x2dad('0x1f')]?_0x3045a0[_0x2dad('0x1f')][_0x2dad('0x21')]||null:null,'include':_0x3045a0['options']?_0x3045a0['options'][_0x2dad('0x22')]?_[_0x2dad('0x23')](_0x3045a0[_0x2dad('0x1f')][_0x2dad('0x22')],function(_0x4af639){return{'model':db[_0x4af639[_0x2dad('0x24')]],'as':_0x4af639['as'],'attributes':_0x4af639[_0x2dad('0x20')],'include':_0x4af639[_0x2dad('0x22')]?_['map'](_0x4af639['include'],function(_0xca8ead){return{'model':db[_0xca8ead['model']],'as':_0xca8ead['as'],'attributes':_0xca8ead[_0x2dad('0x20')],'include':_0xca8ead[_0x2dad('0x22')]?_['map'](_0xca8ead[_0x2dad('0x22')],function(_0x42c611){return{'model':db[_0x42c611[_0x2dad('0x24')]],'as':_0x42c611['as'],'attributes':_0x42c611['attributes']};}):[]};}):[]};}):[]:[]})[_0x2dad('0x11')](function(_0x284c6a){logger[_0x2dad('0x12')](_0x2dad('0x1c'),_0x3045a0);logger['debug'](_0x2dad('0x1c'),_0x3045a0,JSON[_0x2dad('0x16')](_0x284c6a));_0x276428(_0x284c6a);})[_0x2dad('0x25')](function(_0x104e8c){logger['error']('GetWhatsappQueue',_0x104e8c['message'],_0x3045a0);_0x48aa95(_0x17a10d['error'](0x1f4,_0x104e8c[_0x2dad('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x3f8acb){var _0x403905=this;return new Promise(function(_0xec272f,_0xa97543){return db[_0x2dad('0x1d')][_0x2dad('0x26')]({'raw':_0x3f8acb[_0x2dad('0x1f')]?_0x3f8acb[_0x2dad('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3f8acb[_0x2dad('0x1f')]?_0x3f8acb[_0x2dad('0x1f')]['where']||null:null,'attributes':_0x3f8acb[_0x2dad('0x1f')]?_0x3f8acb[_0x2dad('0x1f')][_0x2dad('0x20')]||null:null,'include':_0x3f8acb[_0x2dad('0x1f')]?_0x3f8acb['options'][_0x2dad('0x22')]?_[_0x2dad('0x23')](_0x3f8acb[_0x2dad('0x1f')]['include'],function(_0x52117b){return{'model':db[_0x52117b['model']],'as':_0x52117b['as'],'attributes':_0x52117b[_0x2dad('0x20')],'include':_0x52117b[_0x2dad('0x22')]?_['map'](_0x52117b['include'],function(_0xd39ab5){return{'model':db[_0xd39ab5['model']],'as':_0xd39ab5['as'],'attributes':_0xd39ab5[_0x2dad('0x20')],'include':_0xd39ab5[_0x2dad('0x22')]?_[_0x2dad('0x23')](_0xd39ab5[_0x2dad('0x22')],function(_0x1e4e66){return{'model':db[_0x1e4e66[_0x2dad('0x24')]],'as':_0x1e4e66['as'],'attributes':_0x1e4e66[_0x2dad('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2dad('0x11')](function(_0x5d3905){logger['info']('ShowWhatsappQueue',_0x3f8acb);logger['debug'](_0x2dad('0x27'),_0x3f8acb,JSON['stringify'](_0x5d3905));_0xec272f(_0x5d3905);})[_0x2dad('0x25')](function(_0x252caa){logger[_0x2dad('0x17')]('ShowWhatsappQueue',_0x252caa[_0x2dad('0x19')],_0x3f8acb);_0xa97543(_0x403905[_0x2dad('0x17')](0x1f4,_0x252caa['message']));});});}; \ No newline at end of file +var _0x0a7b=['WhatsappQueue,\x20%s,\x20%s','message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','request','then','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x193fb1,_0xb02d80){var _0x55b300=function(_0x20cbc4){while(--_0x20cbc4){_0x193fb1['push'](_0x193fb1['shift']());}};_0x55b300(++_0xb02d80);}(_0x0a7b,0x107));var _0xb0a7=function(_0x411926,_0x30d5f0){_0x411926=_0x411926-0x0;var _0x457e62=_0x0a7b[_0x411926];return _0x457e62;};'use strict';var _=require(_0xb0a7('0x0'));var util=require(_0xb0a7('0x1'));var moment=require(_0xb0a7('0x2'));var BPromise=require(_0xb0a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0a7('0x4'));var db=require(_0xb0a7('0x5'))['db'];var utils=require(_0xb0a7('0x6'));var logger=require(_0xb0a7('0x7'))(_0xb0a7('0x8'));var config=require('../../config/environment');var jayson=require(_0xb0a7('0x9'));var client=jayson[_0xb0a7('0xa')][_0xb0a7('0xb')]({'port':0x232a});config['redis']=_[_0xb0a7('0xc')](config[_0xb0a7('0xd')],{'host':_0xb0a7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0a7('0xd')]));require('./whatsappQueue.socket')[_0xb0a7('0xf')](socket);function respondWithRpcPromise(_0x2dd68a,_0x5c9dfd,_0x30e8a6){return new BPromise(function(_0x4f7dd8,_0x343917){return client[_0xb0a7('0x10')](_0x2dd68a,_0x30e8a6)[_0xb0a7('0x11')](function(_0x16bdda){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x5c9dfd,_0xb0a7('0x12'));logger[_0xb0a7('0x13')](_0xb0a7('0x14'),_0x5c9dfd,'request\x20sent',JSON[_0xb0a7('0x15')](_0x16bdda));if(_0x16bdda['error']){if(_0x16bdda[_0xb0a7('0x16')][_0xb0a7('0x17')]===0x1f4){logger[_0xb0a7('0x16')](_0xb0a7('0x18'),_0x5c9dfd,_0x16bdda[_0xb0a7('0x16')][_0xb0a7('0x19')]);return _0x343917(_0x16bdda[_0xb0a7('0x16')]['message']);}logger[_0xb0a7('0x16')](_0xb0a7('0x18'),_0x5c9dfd,_0x16bdda[_0xb0a7('0x16')][_0xb0a7('0x19')]);return _0x4f7dd8(_0x16bdda[_0xb0a7('0x16')]['message']);}else{logger[_0xb0a7('0x1a')](_0xb0a7('0x18'),_0x5c9dfd,_0xb0a7('0x12'));_0x4f7dd8(_0x16bdda[_0xb0a7('0x1b')][_0xb0a7('0x19')]);}})['catch'](function(_0x1fdf18){logger[_0xb0a7('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x5c9dfd,_0x1fdf18);_0x343917(_0x1fdf18);});});}exports[_0xb0a7('0x1c')]=function(_0x25ca8a){var _0x593d42=this;return new Promise(function(_0x39e1ef,_0x555378){return db[_0xb0a7('0x1d')][_0xb0a7('0x1e')]({'raw':_0x25ca8a[_0xb0a7('0x1f')]?_0x25ca8a[_0xb0a7('0x1f')][_0xb0a7('0x20')]===undefined?!![]:![]:!![],'where':_0x25ca8a[_0xb0a7('0x1f')]?_0x25ca8a[_0xb0a7('0x1f')]['where']||null:null,'attributes':_0x25ca8a['options']?_0x25ca8a['options'][_0xb0a7('0x21')]||null:null,'limit':_0x25ca8a[_0xb0a7('0x1f')]?_0x25ca8a['options']['limit']||null:null,'include':_0x25ca8a[_0xb0a7('0x1f')]?_0x25ca8a['options'][_0xb0a7('0x22')]?_[_0xb0a7('0x23')](_0x25ca8a['options'][_0xb0a7('0x22')],function(_0x308d98){return{'model':db[_0x308d98[_0xb0a7('0x24')]],'as':_0x308d98['as'],'attributes':_0x308d98['attributes'],'include':_0x308d98[_0xb0a7('0x22')]?_[_0xb0a7('0x23')](_0x308d98[_0xb0a7('0x22')],function(_0x204a33){return{'model':db[_0x204a33['model']],'as':_0x204a33['as'],'attributes':_0x204a33[_0xb0a7('0x21')],'include':_0x204a33[_0xb0a7('0x22')]?_[_0xb0a7('0x23')](_0x204a33[_0xb0a7('0x22')],function(_0x1e45b2){return{'model':db[_0x1e45b2['model']],'as':_0x1e45b2['as'],'attributes':_0x1e45b2[_0xb0a7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb0a7('0x11')](function(_0x5a6eb4){logger[_0xb0a7('0x1a')](_0xb0a7('0x1c'),_0x25ca8a);logger[_0xb0a7('0x13')](_0xb0a7('0x1c'),_0x25ca8a,JSON[_0xb0a7('0x15')](_0x5a6eb4));_0x39e1ef(_0x5a6eb4);})[_0xb0a7('0x25')](function(_0x16ff05){logger[_0xb0a7('0x16')]('GetWhatsappQueue',_0x16ff05[_0xb0a7('0x19')],_0x25ca8a);_0x555378(_0x593d42[_0xb0a7('0x16')](0x1f4,_0x16ff05['message']));});});};exports['ShowWhatsappQueue']=function(_0x1d3a83){var _0x307424=this;return new Promise(function(_0x4bffb3,_0x1b7fab){return db[_0xb0a7('0x1d')][_0xb0a7('0x26')]({'raw':_0x1d3a83[_0xb0a7('0x1f')]?_0x1d3a83[_0xb0a7('0x1f')][_0xb0a7('0x20')]===undefined?!![]:![]:!![],'where':_0x1d3a83[_0xb0a7('0x1f')]?_0x1d3a83[_0xb0a7('0x1f')][_0xb0a7('0x27')]||null:null,'attributes':_0x1d3a83[_0xb0a7('0x1f')]?_0x1d3a83[_0xb0a7('0x1f')]['attributes']||null:null,'include':_0x1d3a83[_0xb0a7('0x1f')]?_0x1d3a83[_0xb0a7('0x1f')]['include']?_['map'](_0x1d3a83[_0xb0a7('0x1f')][_0xb0a7('0x22')],function(_0xcc4920){return{'model':db[_0xcc4920[_0xb0a7('0x24')]],'as':_0xcc4920['as'],'attributes':_0xcc4920[_0xb0a7('0x21')],'include':_0xcc4920[_0xb0a7('0x22')]?_[_0xb0a7('0x23')](_0xcc4920[_0xb0a7('0x22')],function(_0x1d100c){return{'model':db[_0x1d100c[_0xb0a7('0x24')]],'as':_0x1d100c['as'],'attributes':_0x1d100c[_0xb0a7('0x21')],'include':_0x1d100c[_0xb0a7('0x22')]?_[_0xb0a7('0x23')](_0x1d100c[_0xb0a7('0x22')],function(_0x2fe5a6){return{'model':db[_0x2fe5a6[_0xb0a7('0x24')]],'as':_0x2fe5a6['as'],'attributes':_0x2fe5a6['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a7('0x11')](function(_0x1da041){logger[_0xb0a7('0x1a')](_0xb0a7('0x28'),_0x1d3a83);logger[_0xb0a7('0x13')]('ShowWhatsappQueue',_0x1d3a83,JSON[_0xb0a7('0x15')](_0x1da041));_0x4bffb3(_0x1da041);})[_0xb0a7('0x25')](function(_0x182243){logger[_0xb0a7('0x16')](_0xb0a7('0x28'),_0x182243[_0xb0a7('0x19')],_0x1d3a83);_0x1b7fab(_0x307424[_0xb0a7('0x16')](0x1f4,_0x182243['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5dc92c3..59c9906 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 _0x6ba5=['update','emit','removeListener','register','./whatsappQueue.events','save','remove'];(function(_0x444002,_0x14b95c){var _0x3d1271=function(_0x105248){while(--_0x105248){_0x444002['push'](_0x444002['shift']());}};_0x3d1271(++_0x14b95c);}(_0x6ba5,0x17e));var _0x56ba=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x6ba5[_0x12b8ec];return _0x21af77;};'use strict';var WhatsappQueueEvents=require(_0x56ba('0x0'));var events=[_0x56ba('0x1'),_0x56ba('0x2'),_0x56ba('0x3')];function createListener(_0x34dda2,_0x24d4fb){return function(_0x48c761){_0x24d4fb[_0x56ba('0x4')](_0x34dda2,_0x48c761);};}function removeListener(_0x379c30,_0x33260){return function(){WhatsappQueueEvents[_0x56ba('0x5')](_0x379c30,_0x33260);};}exports[_0x56ba('0x6')]=function(_0xfdfdc1){for(var _0x585226=0x0,_0x21771b=events['length'];_0x585226<_0x21771b;_0x585226++){var _0x4ffd8a=events[_0x585226];var _0xa08f9a=createListener('whatsappQueue:'+_0x4ffd8a,_0xfdfdc1);WhatsappQueueEvents['on'](_0x4ffd8a,_0xa08f9a);}}; \ No newline at end of file +var _0x1874=['save','remove','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1874,0x8f));var _0x4187=function(_0x3666ef,_0x373d7b){_0x3666ef=_0x3666ef-0x0;var _0x4f4289=_0x1874[_0x3666ef];return _0x4f4289;};'use strict';var WhatsappQueueEvents=require(_0x4187('0x0'));var events=[_0x4187('0x1'),_0x4187('0x2'),_0x4187('0x3')];function createListener(_0x3d222a,_0x28801){return function(_0x4071ec){_0x28801[_0x4187('0x4')](_0x3d222a,_0x4071ec);};}function removeListener(_0x3bce11,_0x306296){return function(){WhatsappQueueEvents[_0x4187('0x5')](_0x3bce11,_0x306296);};}exports[_0x4187('0x6')]=function(_0x1467ce){for(var _0x35fbd3=0x0,_0x2815af=events['length'];_0x35fbd3<_0x2815af;_0x35fbd3++){var _0x2cf2a6=events[_0x35fbd3];var _0xac9934=createListener(_0x4187('0x7')+_0x2cf2a6,_0x1467ce);WhatsappQueueEvents['on'](_0x2cf2a6,_0xac9934);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8b945d5..7fa402a 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 _0x51bf=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x99405c,_0x445476){var _0x3daed0=function(_0x21d002){while(--_0x21d002){_0x99405c['push'](_0x99405c['shift']());}};_0x3daed0(++_0x445476);}(_0x51bf,0x185));var _0xf51b=function(_0x5c8734,_0xdef60){_0x5c8734=_0x5c8734-0x0;var _0x2ac6f8=_0x51bf[_0x5c8734];return _0x2ac6f8;};'use strict';var multer=require(_0xf51b('0x0'));var util=require(_0xf51b('0x1'));var path=require(_0xf51b('0x2'));var timeout=require(_0xf51b('0x3'));var express=require(_0xf51b('0x4'));var router=express[_0xf51b('0x5')]();var fs_extra=require(_0xf51b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf51b('0x7'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0xf51b('0x8')](),controller['index']);router[_0xf51b('0x9')](_0xf51b('0xa'),auth['isAuthenticated'](),controller[_0xf51b('0xb')]);router[_0xf51b('0x9')](_0xf51b('0xc'),auth['isAuthenticated'](),controller[_0xf51b('0xd')]);router[_0xf51b('0xe')]('/',auth['isAuthenticated'](),controller[_0xf51b('0xf')]);router[_0xf51b('0x10')](_0xf51b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf51b('0x11')](_0xf51b('0xc'),auth[_0xf51b('0x8')](),controller[_0xf51b('0x12')]);module[_0xf51b('0x13')]=router; \ No newline at end of file +var _0x51f3=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','create','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x50d698,_0x50f292){var _0x3279d0=function(_0x3a0b16){while(--_0x3a0b16){_0x50d698['push'](_0x50d698['shift']());}};_0x3279d0(++_0x50f292);}(_0x51f3,0x9f));var _0x351f=function(_0x269ef5,_0x3c17a3){_0x269ef5=_0x269ef5-0x0;var _0x590ccc=_0x51f3[_0x269ef5];return _0x590ccc;};'use strict';var multer=require(_0x351f('0x0'));var util=require(_0x351f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x351f('0x2'));var router=express[_0x351f('0x3')]();var fs_extra=require(_0x351f('0x4'));var auth=require(_0x351f('0x5'));var interaction=require(_0x351f('0x6'));var config=require(_0x351f('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x351f('0x8')]('/',auth['isAuthenticated'](),controller[_0x351f('0x9')]);router[_0x351f('0x8')]('/describe',auth[_0x351f('0xa')](),controller[_0x351f('0xb')]);router[_0x351f('0x8')](_0x351f('0xc'),auth['isAuthenticated'](),controller[_0x351f('0xd')]);router['post']('/',auth[_0x351f('0xa')](),controller[_0x351f('0xe')]);router['put'](_0x351f('0xc'),auth[_0x351f('0xa')](),controller['update']);router['delete'](_0x351f('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 03b79b0..5544511 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(_0x4002d1,_0x55ee08){var _0x54031c=function(_0x30cd45){while(--_0x30cd45){_0x4002d1['push'](_0x4002d1['shift']());}};_0x54031c(++_0x55ee08);}(_0x7a54,0x106));var _0x47a5=function(_0x41d9fc,_0x9595ec){_0x41d9fc=_0x41d9fc-0x0;var _0x1527af=_0x7a54[_0x41d9fc];return _0x1527af;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x249227,_0x4cb466){var _0x504046=function(_0x5e0daf){while(--_0x5e0daf){_0x249227['push'](_0x249227['shift']());}};_0x504046(++_0x4cb466);}(_0x7a54,0x106));var _0x47a5=function(_0x4bf6b7,_0x9307ec){_0x4bf6b7=_0x4bf6b7-0x0;var _0x63c961=_0x7a54[_0x4bf6b7];return _0x63c961;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 417ef79..b4a151c 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 _0xac4a=['where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5d9d73,_0x36381e){var _0x6826f3=function(_0x3a0240){while(--_0x3a0240){_0x5d9d73['push'](_0x5d9d73['shift']());}};_0x6826f3(++_0x36381e);}(_0xac4a,0x13f));var _0xaac4=function(_0x16b159,_0x46d9d6){_0x16b159=_0x16b159-0x0;var _0x251447=_0xac4a[_0x16b159];return _0x251447;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={},_0x16b33c={},_0xda10b6={'count':0x0,'rows':[]};var _0xb76ccc=_[_0xaac4('0x29')](db[_0xaac4('0x2a')]['rawAttributes'],function(_0xcf6c1){return{'name':_0xcf6c1['fieldName'],'type':_0xcf6c1[_0xaac4('0x2b')][_0xaac4('0x2c')]};});_0x16b33c[_0xaac4('0x2d')]=_[_0xaac4('0x29')](_0xb76ccc,'name');_0x16b33c['query']=_['keys'](_0x386c9b[_0xaac4('0x2e')]);_0x16b33c[_0xaac4('0x2f')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],_0x16b33c[_0xaac4('0x2e')]);_0x316445[_0xaac4('0x31')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x32')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x33')]?_0x316445[_0xaac4('0x31')]:_0x16b33c['model'];if(!_0x386c9b['query'][_0xaac4('0x34')](_0xaac4('0x35'))){_0x316445[_0xaac4('0x1a')]=qs['limit'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x1a')]);_0x316445[_0xaac4('0x18')]=qs[_0xaac4('0x18')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x18')]);}_0x316445[_0xaac4('0x36')]=qs['sort'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x316445[_0xaac4('0x38')]=qs['filters'](_[_0xaac4('0x39')](_0x386c9b['query'],_0x16b33c['filters']),_0xb76ccc);if(_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x3a')]){_0x316445[_0xaac4('0x38')]=_['merge'](_0x316445['where'],{'$or':_[_0xaac4('0x29')](_0xb76ccc,function(_0x33cc4){if(_0x33cc4[_0xaac4('0x2b')]!==_0xaac4('0x3b')){var _0x2b65b1={};_0x2b65b1[_0x33cc4[_0xaac4('0x26')]]={'$like':'%'+_0x386c9b['query']['filter']+'%'};return _0x2b65b1;}})});}_0x316445=_[_0xaac4('0x3c')]({},_0x316445,_0x386c9b[_0xaac4('0x3d')]);var _0x5371b4={'where':_0x316445[_0xaac4('0x38')]};return db[_0xaac4('0x2a')][_0xaac4('0x1b')](_0x5371b4)['then'](function(_0x74a1c){_0xda10b6[_0xaac4('0x1b')]=_0x74a1c;if(_0x386c9b[_0xaac4('0x2e')]['includeAll']){_0x316445[_0xaac4('0x3e')]=[{'all':!![]}];}return db[_0xaac4('0x2a')][_0xaac4('0x3f')](_0x316445);})[_0xaac4('0x23')](function(_0x51e59d){_0xda10b6[_0xaac4('0x40')]=_0x51e59d;return _0xda10b6;})['then'](respondWithFilteredResult(_0x4d0f5f,_0x316445))['catch'](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x41')]=function(_0x31e240,_0x27df36){var _0x40c007={'raw':!![],'where':{'id':_0x31e240[_0xaac4('0x42')]['id']}},_0x43bc12={};_0x43bc12[_0xaac4('0x2d')]=_[_0xaac4('0x43')](db['WhatsappQueueReport'][_0xaac4('0x44')]);_0x43bc12[_0xaac4('0x2e')]=_[_0xaac4('0x43')](_0x31e240[_0xaac4('0x2e')]);_0x43bc12['filters']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],_0x43bc12[_0xaac4('0x2e')]);_0x40c007['attributes']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x31e240[_0xaac4('0x2e')]['fields']));_0x40c007[_0xaac4('0x31')]=_0x40c007[_0xaac4('0x31')][_0xaac4('0x33')]?_0x40c007['attributes']:_0x43bc12[_0xaac4('0x2d')];if(_0x31e240[_0xaac4('0x2e')][_0xaac4('0x45')]){_0x40c007[_0xaac4('0x3e')]=[{'all':!![]}];}_0x40c007=_[_0xaac4('0x3c')]({},_0x40c007,_0x31e240[_0xaac4('0x3d')]);return db[_0xaac4('0x2a')][_0xaac4('0x46')](_0x40c007)[_0xaac4('0x23')](handleEntityNotFound(_0x27df36,null))['then'](respondWithResult(_0x27df36,null))[_0xaac4('0x47')](handleError(_0x27df36,null));};exports[_0xaac4('0x48')]=function(_0x27425a,_0x360420){return db[_0xaac4('0x2a')]['create'](_0x27425a['body'],{})[_0xaac4('0x23')](respondWithResult(_0x360420,0xc9))[_0xaac4('0x47')](handleError(_0x360420,null));};exports[_0xaac4('0x21')]=function(_0x16c7f4,_0x5f33ea){if(_0x16c7f4[_0xaac4('0x49')]['id']){delete _0x16c7f4['body']['id'];}return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x16c7f4['params']['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x5f33ea,null))[_0xaac4('0x23')](saveUpdates(_0x16c7f4[_0xaac4('0x49')],null))['then'](respondWithResult(_0x5f33ea,null))['catch'](handleError(_0x5f33ea,null));};exports[_0xaac4('0x22')]=function(_0x2c1751,_0x22dda7){return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x2c1751[_0xaac4('0x42')]['id']}})['then'](handleEntityNotFound(_0x22dda7,null))[_0xaac4('0x23')](removeEntity(_0x22dda7,null))[_0xaac4('0x47')](handleError(_0x22dda7,null));};exports[_0xaac4('0x4a')]=function(_0x38f9af,_0x56201b){return db[_0xaac4('0x2a')]['describe']()[_0xaac4('0x23')](respondWithResult(_0x56201b,null))[_0xaac4('0x47')](handleError(_0x56201b,null));}; \ No newline at end of file +var _0x1339=['../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xf801da,_0x362fea){var _0x359bed=function(_0x9bbfac){while(--_0x9bbfac){_0xf801da['push'](_0xf801da['shift']());}};_0x359bed(++_0x362fea);}(_0x1339,0x1ed));var _0x9133=function(_0x41c4b3,_0x1e67c7){_0x41c4b3=_0x41c4b3-0x0;var _0x32e75e=_0x1339[_0x41c4b3];return _0x32e75e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));};exports[_0x9133('0x49')]=function(_0x4f7b1e,_0x2342f4){return db[_0x9133('0x29')][_0x9133('0x49')]()[_0x9133('0x20')](respondWithResult(_0x2342f4,null))['catch'](handleError(_0x2342f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 6a32e1b..6464440 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 _0xe373=['define','uniqueid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe373,0x136));var _0x3e37=function(_0x356589,_0x30d81e){_0x356589=_0x356589-0x0;var _0x2b85e4=_0xe373[_0x356589];return _0x2b85e4;};'use strict';var _=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));var logger=require(_0x3e37('0x2'))(_0x3e37('0x3'));var moment=require('moment');var BPromise=require(_0x3e37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e37('0x5'));var rimraf=require('rimraf');var config=require(_0x3e37('0x6'));var attributes=require(_0x3e37('0x7'));module[_0x3e37('0x8')]=function(_0x15d201,_0x4dc84f){return _0x15d201[_0x3e37('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3e37('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x044c=['define','uniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x044c,0x142));var _0xc044=function(_0x4a4d83,_0x33fafb){_0x4a4d83=_0x4a4d83-0x0;var _0x262b54=_0x044c[_0x4a4d83];return _0x262b54;};'use strict';var _=require(_0xc044('0x0'));var util=require('util');var logger=require(_0xc044('0x1'))(_0xc044('0x2'));var moment=require(_0xc044('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc044('0x4'));var rimraf=require(_0xc044('0x5'));var config=require(_0xc044('0x6'));var attributes=require(_0xc044('0x7'));module['exports']=function(_0x12261a,_0x21196e){return _0x12261a[_0xc044('0x8')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xc044('0x9'),'fields':[_0xc044('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1cfd7d3..72d541a 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 _0x1d89=['raw','body','attributes','limit','UpdateWhatsappQueueReport','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1d89,0x156));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91d8('0x0'));var util=require(_0x91d8('0x1'));var moment=require('moment');var BPromise=require(_0x91d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91d8('0x3'))['db'];var utils=require(_0x91d8('0x4'));var logger=require(_0x91d8('0x5'))(_0x91d8('0x6'));var config=require(_0x91d8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x91d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19516b,_0x4847d6,_0x5ade3a){return new BPromise(function(_0x36d4af,_0x22cc9b){return client[_0x91d8('0x9')](_0x19516b,_0x5ade3a)[_0x91d8('0xa')](function(_0x2a1a9d){logger[_0x91d8('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4847d6,_0x91d8('0xc'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4847d6,'request\x20sent',JSON[_0x91d8('0xd')](_0x2a1a9d));if(_0x2a1a9d[_0x91d8('0xe')]){if(_0x2a1a9d[_0x91d8('0xe')]['code']===0x1f4){logger['error'](_0x91d8('0xf'),_0x4847d6,_0x2a1a9d[_0x91d8('0xe')][_0x91d8('0x10')]);return _0x22cc9b(_0x2a1a9d[_0x91d8('0xe')][_0x91d8('0x10')]);}logger[_0x91d8('0xe')](_0x91d8('0xf'),_0x4847d6,_0x2a1a9d[_0x91d8('0xe')][_0x91d8('0x10')]);return _0x36d4af(_0x2a1a9d[_0x91d8('0xe')][_0x91d8('0x10')]);}else{logger[_0x91d8('0xb')](_0x91d8('0xf'),_0x4847d6,'request\x20sent');_0x36d4af(_0x2a1a9d[_0x91d8('0x11')][_0x91d8('0x10')]);}})[_0x91d8('0x12')](function(_0x52e1e3){logger['error'](_0x91d8('0xf'),_0x4847d6,_0x52e1e3);_0x22cc9b(_0x52e1e3);});});}exports[_0x91d8('0x13')]=function(_0xb7054c){var _0x4e5b14=this;return new Promise(function(_0x4b5531,_0x5a5633){return db[_0x91d8('0x14')]['create'](_0xb7054c['body'],{'raw':_0xb7054c[_0x91d8('0x15')]?_0xb7054c['options'][_0x91d8('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x40a5be){logger[_0x91d8('0xb')]('CreateWhatsappQueueReport',_0xb7054c);logger['debug'](_0x91d8('0x13'),_0xb7054c,JSON[_0x91d8('0xd')](_0x40a5be));_0x4b5531(_0x40a5be);})['catch'](function(_0x4a26c8){logger[_0x91d8('0xe')](_0x91d8('0x13'),_0x4a26c8[_0x91d8('0x10')],_0xb7054c);_0x5a5633(_0x4e5b14[_0x91d8('0xe')](0x1f4,_0x4a26c8['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x3d656b){var _0x1cdc73=this;return new Promise(function(_0x14b24c,_0x13233b){return db[_0x91d8('0x14')]['update'](_0x3d656b[_0x91d8('0x17')],{'raw':_0x3d656b[_0x91d8('0x15')]?_0x3d656b[_0x91d8('0x15')][_0x91d8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d656b['options']?_0x3d656b['options']['where']||null:null,'attributes':_0x3d656b[_0x91d8('0x15')]?_0x3d656b[_0x91d8('0x15')][_0x91d8('0x18')]||null:null,'limit':_0x3d656b[_0x91d8('0x15')]?_0x3d656b[_0x91d8('0x15')][_0x91d8('0x19')]||null:null})[_0x91d8('0xa')](function(_0x3b38cc){logger[_0x91d8('0xb')](_0x91d8('0x1a'),_0x3d656b);logger[_0x91d8('0x1b')](_0x91d8('0x1a'),_0x3d656b,JSON[_0x91d8('0xd')](_0x3b38cc));_0x14b24c(_0x3b38cc);})[_0x91d8('0x12')](function(_0x3dcf69){logger[_0x91d8('0xe')](_0x91d8('0x1a'),_0x3dcf69[_0x91d8('0x10')],_0x3d656b);_0x13233b(_0x1cdc73[_0x91d8('0xe')](0x1f4,_0x3dcf69['message']));});});}; \ No newline at end of file +var _0x415d=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappQueueReport','create','body','options','raw','update','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x177435,_0x47939f){var _0x229744=function(_0x3e8051){while(--_0x3e8051){_0x177435['push'](_0x177435['shift']());}};_0x229744(++_0x47939f);}(_0x415d,0x1e6));var _0xd415=function(_0x3f9cce,_0x424731){_0x3f9cce=_0x3f9cce-0x0;var _0x485d40=_0x415d[_0x3f9cce];return _0x485d40;};'use strict';var _=require(_0xd415('0x0'));var util=require(_0xd415('0x1'));var moment=require(_0xd415('0x2'));var BPromise=require(_0xd415('0x3'));var rs=require(_0xd415('0x4'));var fs=require('fs');var Redis=require(_0xd415('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd415('0x6'));var logger=require(_0xd415('0x7'))(_0xd415('0x8'));var config=require(_0xd415('0x9'));var jayson=require(_0xd415('0xa'));var client=jayson[_0xd415('0xb')][_0xd415('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dfd9b,_0x66e567,_0x46463e){return new BPromise(function(_0x30cc7b,_0x341b90){return client[_0xd415('0xd')](_0x2dfd9b,_0x46463e)[_0xd415('0xe')](function(_0x4d36ea){logger[_0xd415('0xf')](_0xd415('0x10'),_0x66e567,_0xd415('0x11'));logger[_0xd415('0x12')](_0xd415('0x13'),_0x66e567,_0xd415('0x11'),JSON[_0xd415('0x14')](_0x4d36ea));if(_0x4d36ea['error']){if(_0x4d36ea[_0xd415('0x15')][_0xd415('0x16')]===0x1f4){logger[_0xd415('0x15')](_0xd415('0x10'),_0x66e567,_0x4d36ea['error'][_0xd415('0x17')]);return _0x341b90(_0x4d36ea[_0xd415('0x15')]['message']);}logger[_0xd415('0x15')](_0xd415('0x10'),_0x66e567,_0x4d36ea[_0xd415('0x15')][_0xd415('0x17')]);return _0x30cc7b(_0x4d36ea[_0xd415('0x15')]['message']);}else{logger['info'](_0xd415('0x10'),_0x66e567,_0xd415('0x11'));_0x30cc7b(_0x4d36ea['result'][_0xd415('0x17')]);}})['catch'](function(_0x4e1e96){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x66e567,_0x4e1e96);_0x341b90(_0x4e1e96);});});}exports[_0xd415('0x18')]=function(_0x463699){var _0x1fed7e=this;return new Promise(function(_0xfc461e,_0x4014d6){return db['WhatsappQueueReport'][_0xd415('0x19')](_0x463699[_0xd415('0x1a')],{'raw':_0x463699[_0xd415('0x1b')]?_0x463699['options'][_0xd415('0x1c')]===undefined?!![]:![]:!![]})[_0xd415('0xe')](function(_0x4e26a8){logger['info'](_0xd415('0x18'),_0x463699);logger[_0xd415('0x12')](_0xd415('0x18'),_0x463699,JSON[_0xd415('0x14')](_0x4e26a8));_0xfc461e(_0x4e26a8);})['catch'](function(_0xde3323){logger[_0xd415('0x15')]('CreateWhatsappQueueReport',_0xde3323['message'],_0x463699);_0x4014d6(_0x1fed7e[_0xd415('0x15')](0x1f4,_0xde3323['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x41d9be){var _0x4c7fa1=this;return new Promise(function(_0x21efc0,_0x15a8b5){return db['WhatsappQueueReport'][_0xd415('0x1d')](_0x41d9be[_0xd415('0x1a')],{'raw':_0x41d9be[_0xd415('0x1b')]?_0x41d9be['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41d9be[_0xd415('0x1b')]?_0x41d9be[_0xd415('0x1b')][_0xd415('0x1e')]||null:null,'attributes':_0x41d9be[_0xd415('0x1b')]?_0x41d9be[_0xd415('0x1b')][_0xd415('0x1f')]||null:null,'limit':_0x41d9be[_0xd415('0x1b')]?_0x41d9be['options']['limit']||null:null})[_0xd415('0xe')](function(_0x5956b7){logger['info']('UpdateWhatsappQueueReport',_0x41d9be);logger[_0xd415('0x12')]('UpdateWhatsappQueueReport',_0x41d9be,JSON['stringify'](_0x5956b7));_0x21efc0(_0x5956b7);})[_0xd415('0x20')](function(_0x39f07a){logger['error']('UpdateWhatsappQueueReport',_0x39f07a[_0xd415('0x17')],_0x41d9be);_0x15a8b5(_0x4c7fa1['error'](0x1f4,_0x39f07a[_0xd415('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b79ecef..4630bef 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 _0xb287=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xc3d9bb,_0xfe7ac1){var _0x2431c1=function(_0x29f8c7){while(--_0x29f8c7){_0xc3d9bb['push'](_0xc3d9bb['shift']());}};_0x2431c1(++_0xfe7ac1);}(_0xb287,0x1eb));var _0x7b28=function(_0x3042d4,_0x4e14d5){_0x3042d4=_0x3042d4-0x0;var _0x150b74=_0xb287[_0x3042d4];return _0x150b74;};'use strict';var multer=require('multer');var util=require(_0x7b28('0x0'));var path=require(_0x7b28('0x1'));var timeout=require(_0x7b28('0x2'));var express=require(_0x7b28('0x3'));var router=express['Router']();var fs_extra=require(_0x7b28('0x4'));var auth=require(_0x7b28('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b28('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x7b28('0x7')]('/',auth[_0x7b28('0x8')](),controller[_0x7b28('0x9')]);router['get'](_0x7b28('0xa'),auth[_0x7b28('0x8')](),controller[_0x7b28('0xb')]);router['get'](_0x7b28('0xc'),auth[_0x7b28('0x8')](),controller[_0x7b28('0xd')]);router['post']('/',auth[_0x7b28('0x8')](),controller[_0x7b28('0xe')]);router[_0x7b28('0xf')](_0x7b28('0xc'),auth[_0x7b28('0x8')](),controller['update']);router[_0x7b28('0x10')](_0x7b28('0xc'),auth['isAuthenticated'](),controller[_0x7b28('0x11')]);module[_0x7b28('0x12')]=router; \ No newline at end of file +var _0x03bd=['update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id'];(function(_0x211193,_0x5530fa){var _0x2f256c=function(_0x233843){while(--_0x233843){_0x211193['push'](_0x211193['shift']());}};_0x2f256c(++_0x5530fa);}(_0x03bd,0x1bb));var _0xd03b=function(_0x6d30d9,_0x4b5705){_0x6d30d9=_0x6d30d9-0x0;var _0x1e47c=_0x03bd[_0x6d30d9];return _0x1e47c;};'use strict';var multer=require(_0xd03b('0x0'));var util=require(_0xd03b('0x1'));var path=require('path');var timeout=require(_0xd03b('0x2'));var express=require(_0xd03b('0x3'));var router=express['Router']();var fs_extra=require(_0xd03b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd03b('0x5'));var config=require(_0xd03b('0x6'));var controller=require(_0xd03b('0x7'));router[_0xd03b('0x8')]('/',auth[_0xd03b('0x9')](),controller[_0xd03b('0xa')]);router[_0xd03b('0x8')](_0xd03b('0xb'),auth['isAuthenticated'](),controller[_0xd03b('0xc')]);router['get']('/:id',auth[_0xd03b('0x9')](),controller['show']);router[_0xd03b('0xd')]('/',auth['isAuthenticated'](),controller[_0xd03b('0xe')]);router[_0xd03b('0xf')](_0xd03b('0x10'),auth[_0xd03b('0x9')](),controller[_0xd03b('0x11')]);router['delete'](_0xd03b('0x10'),auth[_0xd03b('0x9')](),controller[_0xd03b('0x12')]);module[_0xd03b('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fe5ac30..f637fd4 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 _0x38fd=['exports','STRING','account','agent','queue','DATE','sequelize'];(function(_0x1b50ec,_0x9007a7){var _0x2adaab=function(_0xff9ffb){while(--_0xff9ffb){_0x1b50ec['push'](_0x1b50ec['shift']());}};_0x2adaab(++_0x9007a7);}(_0x38fd,0x117));var _0xd38f=function(_0x55ac81,_0x15cb67){_0x55ac81=_0x55ac81-0x0;var _0x37ac74=_0x38fd[_0x55ac81];return _0x37ac74;};'use strict';var Sequelize=require(_0xd38f('0x0'));module[_0xd38f('0x1')]={'uniqueid':{'type':Sequelize[_0xd38f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd38f('0x3'),_0xd38f('0x4'),_0xd38f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd38f('0x6')]}}; \ No newline at end of file +var _0x85de=['STRING','ENUM','account','queue','sequelize','exports'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x85de,0x1f0));var _0xe85d=function(_0x2c6d3a,_0x497e41){_0x2c6d3a=_0x2c6d3a-0x0;var _0x33a2e3=_0x85de[_0x2c6d3a];return _0x33a2e3;};'use strict';var Sequelize=require(_0xe85d('0x0'));module[_0xe85d('0x1')]={'uniqueid':{'type':Sequelize[_0xe85d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe85d('0x3')](_0xe85d('0x4'),'agent',_0xe85d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 518f0df..9c93fd0 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 _0xcc1b=['error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xcc1b,0x100));var _0xbcc1=function(_0x437a39,_0x1700ca){_0x437a39=_0x437a39-0x0;var _0x293144=_0xcc1b[_0x437a39];return _0x293144;};'use strict';var emlformat=require(_0xbcc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcc1('0x1'));var jsonpatch=require(_0xbcc1('0x2'));var rp=require('request-promise');var moment=require(_0xbcc1('0x3'));var BPromise=require(_0xbcc1('0x4'));var Mustache=require(_0xbcc1('0x5'));var util=require(_0xbcc1('0x6'));var path=require(_0xbcc1('0x7'));var sox=require(_0xbcc1('0x8'));var csv=require(_0xbcc1('0x9'));var ejs=require(_0xbcc1('0xa'));var fs=require('fs');var fs_extra=require(_0xbcc1('0xb'));var _=require('lodash');var squel=require(_0xbcc1('0xc'));var crypto=require('crypto');var jsforce=require(_0xbcc1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbcc1('0x9'));var querystring=require(_0xbcc1('0xe'));var Papa=require(_0xbcc1('0xf'));var Redis=require('ioredis');var authService=require(_0xbcc1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcc1('0x11'))('api');var utils=require(_0xbcc1('0x12'));var config=require(_0xbcc1('0x13'));var licenseUtil=require(_0xbcc1('0x14'));var db=require(_0xbcc1('0x15'))['db'];function respondWithStatusCode(_0x44d7b4,_0x4ea7d6){_0x4ea7d6=_0x4ea7d6||0xcc;return function(_0x4693fa){if(_0x4693fa){return _0x44d7b4['sendStatus'](_0x4ea7d6);}return _0x44d7b4[_0xbcc1('0x16')](_0x4ea7d6)[_0xbcc1('0x17')]();};}function respondWithResult(_0x53ede,_0x4619bc){_0x4619bc=_0x4619bc||0xc8;return function(_0x1e5543){if(_0x1e5543){return _0x53ede[_0xbcc1('0x16')](_0x4619bc)[_0xbcc1('0x18')](_0x1e5543);}};}function respondWithFilteredResult(_0x4be22d,_0x23cfd5){return function(_0xd37cb){if(_0xd37cb){var _0x124c8f=typeof _0x23cfd5[_0xbcc1('0x19')]===_0xbcc1('0x1a')&&typeof _0x23cfd5[_0xbcc1('0x1b')]===_0xbcc1('0x1a');var _0x4dae80=_0xd37cb[_0xbcc1('0x1c')];var _0x523530=_0x124c8f?0x0:_0x23cfd5[_0xbcc1('0x19')];var _0x1c4d6c=_0x124c8f?_0xd37cb[_0xbcc1('0x1c')]:_0x23cfd5[_0xbcc1('0x19')]+_0x23cfd5[_0xbcc1('0x1b')];var _0x175c06;if(_0x1c4d6c>=_0x4dae80){_0x1c4d6c=_0x4dae80;_0x175c06=0xc8;}else{_0x175c06=0xce;}_0x4be22d[_0xbcc1('0x16')](_0x175c06);return _0x4be22d[_0xbcc1('0x1d')](_0xbcc1('0x1e'),_0x523530+'-'+_0x1c4d6c+'/'+_0x4dae80)[_0xbcc1('0x18')](_0xd37cb);}return null;};}function patchUpdates(_0x1717c8){return function(_0x4533ad){try{jsonpatch[_0xbcc1('0x1f')](_0x4533ad,_0x1717c8,!![]);}catch(_0x38b471){return BPromise['reject'](_0x38b471);}return _0x4533ad['save']();};}function saveUpdates(_0x769638,_0x6e78af){return function(_0x1ecab2){if(_0x1ecab2){return _0x1ecab2[_0xbcc1('0x20')](_0x769638)[_0xbcc1('0x21')](function(_0x4305ab){return _0x4305ab;});}return null;};}function removeEntity(_0x5063ee,_0xbafce7){return function(_0x433cd2){if(_0x433cd2){return _0x433cd2[_0xbcc1('0x22')]()[_0xbcc1('0x21')](function(){_0x5063ee[_0xbcc1('0x16')](0xcc)[_0xbcc1('0x17')]();});}};}function handleEntityNotFound(_0x3522fb,_0x23a45b){return function(_0x2f6325){if(!_0x2f6325){_0x3522fb[_0xbcc1('0x23')](0x194);}return _0x2f6325;};}function handleError(_0x417a63,_0x2e6d4d){_0x2e6d4d=_0x2e6d4d||0x1f4;return function(_0x577ff8){logger[_0xbcc1('0x24')](_0x577ff8['stack']);if(_0x577ff8[_0xbcc1('0x25')]){delete _0x577ff8[_0xbcc1('0x25')];}_0x417a63[_0xbcc1('0x16')](_0x2e6d4d)[_0xbcc1('0x26')](_0x577ff8);};}exports[_0xbcc1('0x27')]=function(_0x21dc90,_0x1bca3f){var _0x4d27c2={},_0x5d8c0e={},_0x2b3f06={'count':0x0,'rows':[]};var _0x36323e=_[_0xbcc1('0x28')](db[_0xbcc1('0x29')][_0xbcc1('0x2a')],function(_0x1b64d0){return{'name':_0x1b64d0[_0xbcc1('0x2b')],'type':_0x1b64d0[_0xbcc1('0x2c')][_0xbcc1('0x2d')]};});_0x5d8c0e[_0xbcc1('0x2e')]=_[_0xbcc1('0x28')](_0x36323e,_0xbcc1('0x25'));_0x5d8c0e[_0xbcc1('0x2f')]=_[_0xbcc1('0x30')](_0x21dc90['query']);_0x5d8c0e[_0xbcc1('0x31')]=_[_0xbcc1('0x32')](_0x5d8c0e[_0xbcc1('0x2e')],_0x5d8c0e[_0xbcc1('0x2f')]);_0x4d27c2['attributes']=_[_0xbcc1('0x32')](_0x5d8c0e[_0xbcc1('0x2e')],qs[_0xbcc1('0x33')](_0x21dc90[_0xbcc1('0x2f')][_0xbcc1('0x33')]));_0x4d27c2[_0xbcc1('0x34')]=_0x4d27c2[_0xbcc1('0x34')][_0xbcc1('0x35')]?_0x4d27c2[_0xbcc1('0x34')]:_0x5d8c0e[_0xbcc1('0x2e')];if(!_0x21dc90['query'][_0xbcc1('0x36')]('nolimit')){_0x4d27c2['limit']=qs[_0xbcc1('0x1b')](_0x21dc90['query'][_0xbcc1('0x1b')]);_0x4d27c2[_0xbcc1('0x19')]=qs['offset'](_0x21dc90[_0xbcc1('0x2f')][_0xbcc1('0x19')]);}_0x4d27c2[_0xbcc1('0x37')]=qs[_0xbcc1('0x38')](_0x21dc90[_0xbcc1('0x2f')]['sort']);_0x4d27c2[_0xbcc1('0x39')]=qs[_0xbcc1('0x31')](_[_0xbcc1('0x3a')](_0x21dc90[_0xbcc1('0x2f')],_0x5d8c0e[_0xbcc1('0x31')]),_0x36323e);if(_0x21dc90[_0xbcc1('0x2f')]['filter']){_0x4d27c2['where']=_[_0xbcc1('0x3b')](_0x4d27c2['where'],{'$or':_[_0xbcc1('0x28')](_0x36323e,function(_0xbfdb14){if(_0xbfdb14[_0xbcc1('0x2c')]!==_0xbcc1('0x3c')){var _0x12d7f2={};_0x12d7f2[_0xbfdb14['name']]={'$like':'%'+_0x21dc90[_0xbcc1('0x2f')][_0xbcc1('0x3d')]+'%'};return _0x12d7f2;}})});}_0x4d27c2=_[_0xbcc1('0x3b')]({},_0x4d27c2,_0x21dc90[_0xbcc1('0x3e')]);var _0xb696fe={'where':_0x4d27c2['where']};return db[_0xbcc1('0x29')][_0xbcc1('0x1c')](_0xb696fe)[_0xbcc1('0x21')](function(_0x3be47f){_0x2b3f06[_0xbcc1('0x1c')]=_0x3be47f;if(_0x21dc90['query'][_0xbcc1('0x3f')]){_0x4d27c2['include']=[{'all':!![]}];}return db[_0xbcc1('0x29')][_0xbcc1('0x40')](_0x4d27c2);})[_0xbcc1('0x21')](function(_0xdd1318){_0x2b3f06[_0xbcc1('0x41')]=_0xdd1318;return _0x2b3f06;})[_0xbcc1('0x21')](respondWithFilteredResult(_0x1bca3f,_0x4d27c2))[_0xbcc1('0x42')](handleError(_0x1bca3f,null));};exports[_0xbcc1('0x43')]=function(_0x3ebab0,_0x39ccdc){var _0x448c4d={'raw':!![],'where':{'id':_0x3ebab0[_0xbcc1('0x44')]['id']}},_0x23f78f={};_0x23f78f[_0xbcc1('0x2e')]=_[_0xbcc1('0x30')](db['WhatsappTransferReport']['rawAttributes']);_0x23f78f[_0xbcc1('0x2f')]=_['keys'](_0x3ebab0[_0xbcc1('0x2f')]);_0x23f78f[_0xbcc1('0x31')]=_[_0xbcc1('0x32')](_0x23f78f[_0xbcc1('0x2e')],_0x23f78f['query']);_0x448c4d[_0xbcc1('0x34')]=_[_0xbcc1('0x32')](_0x23f78f['model'],qs[_0xbcc1('0x33')](_0x3ebab0[_0xbcc1('0x2f')]['fields']));_0x448c4d[_0xbcc1('0x34')]=_0x448c4d[_0xbcc1('0x34')][_0xbcc1('0x35')]?_0x448c4d[_0xbcc1('0x34')]:_0x23f78f[_0xbcc1('0x2e')];if(_0x3ebab0[_0xbcc1('0x2f')][_0xbcc1('0x3f')]){_0x448c4d['include']=[{'all':!![]}];}_0x448c4d=_[_0xbcc1('0x3b')]({},_0x448c4d,_0x3ebab0[_0xbcc1('0x3e')]);return db[_0xbcc1('0x29')][_0xbcc1('0x45')](_0x448c4d)[_0xbcc1('0x21')](handleEntityNotFound(_0x39ccdc,null))['then'](respondWithResult(_0x39ccdc,null))[_0xbcc1('0x42')](handleError(_0x39ccdc,null));};exports[_0xbcc1('0x46')]=function(_0xda31e,_0x3d134b){return db['WhatsappTransferReport'][_0xbcc1('0x46')](_0xda31e[_0xbcc1('0x47')],{})[_0xbcc1('0x21')](respondWithResult(_0x3d134b,0xc9))[_0xbcc1('0x42')](handleError(_0x3d134b,null));};exports['update']=function(_0x4c2ed5,_0x13ceee){if(_0x4c2ed5[_0xbcc1('0x47')]['id']){delete _0x4c2ed5[_0xbcc1('0x47')]['id'];}return db[_0xbcc1('0x29')][_0xbcc1('0x45')]({'where':{'id':_0x4c2ed5[_0xbcc1('0x44')]['id']}})[_0xbcc1('0x21')](handleEntityNotFound(_0x13ceee,null))['then'](saveUpdates(_0x4c2ed5[_0xbcc1('0x47')],null))[_0xbcc1('0x21')](respondWithResult(_0x13ceee,null))['catch'](handleError(_0x13ceee,null));};exports[_0xbcc1('0x22')]=function(_0x5269b9,_0x5ccc74){return db[_0xbcc1('0x29')][_0xbcc1('0x45')]({'where':{'id':_0x5269b9[_0xbcc1('0x44')]['id']}})[_0xbcc1('0x21')](handleEntityNotFound(_0x5ccc74,null))['then'](removeEntity(_0x5ccc74,null))[_0xbcc1('0x42')](handleError(_0x5ccc74,null));};exports[_0xbcc1('0x48')]=function(_0xe641b6,_0x448a7a){return db['WhatsappTransferReport'][_0xbcc1('0x48')]()[_0xbcc1('0x21')](respondWithResult(_0x448a7a,null))[_0xbcc1('0x42')](handleError(_0x448a7a,null));}; \ No newline at end of file +var _0x63a6=['findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','status','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include'];(function(_0x34132a,_0xda2d88){var _0x5777e3=function(_0x1d1195){while(--_0x1d1195){_0x34132a['push'](_0x34132a['shift']());}};_0x5777e3(++_0xda2d88);}(_0x63a6,0x1c7));var _0x663a=function(_0x915908,_0x333bc8){_0x915908=_0x915908-0x0;var _0x26a3ea=_0x63a6[_0x915908];return _0x26a3ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x663a('0x0'));var zipdir=require(_0x663a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x663a('0x2'));var moment=require(_0x663a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x663a('0x4'));var util=require(_0x663a('0x5'));var path=require(_0x663a('0x6'));var sox=require(_0x663a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663a('0x8'));var squel=require(_0x663a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x663a('0xa'));var toCsv=require(_0x663a('0xb'));var querystring=require(_0x663a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x663a('0xd'));var qs=require(_0x663a('0xe'));var as=require(_0x663a('0xf'));var hardwareService=require(_0x663a('0x10'));var logger=require(_0x663a('0x11'))(_0x663a('0x12'));var utils=require('../../config/utils');var config=require(_0x663a('0x13'));var licenseUtil=require(_0x663a('0x14'));var db=require(_0x663a('0x15'))['db'];function respondWithStatusCode(_0x581440,_0x583366){_0x583366=_0x583366||0xcc;return function(_0x3f3ef4){if(_0x3f3ef4){return _0x581440['sendStatus'](_0x583366);}return _0x581440['status'](_0x583366)[_0x663a('0x16')]();};}function respondWithResult(_0x39d5d4,_0x558f2f){_0x558f2f=_0x558f2f||0xc8;return function(_0x1eaf35){if(_0x1eaf35){return _0x39d5d4['status'](_0x558f2f)[_0x663a('0x17')](_0x1eaf35);}};}function respondWithFilteredResult(_0x1eab42,_0x15afa0){return function(_0x2d794f){if(_0x2d794f){var _0x1a8d76=typeof _0x15afa0['offset']===_0x663a('0x18')&&typeof _0x15afa0['limit']===_0x663a('0x18');var _0x45f489=_0x2d794f[_0x663a('0x19')];var _0x1508ab=_0x1a8d76?0x0:_0x15afa0['offset'];var _0x2a1f33=_0x1a8d76?_0x2d794f['count']:_0x15afa0['offset']+_0x15afa0['limit'];var _0x2d006c;if(_0x2a1f33>=_0x45f489){_0x2a1f33=_0x45f489;_0x2d006c=0xc8;}else{_0x2d006c=0xce;}_0x1eab42[_0x663a('0x1a')](_0x2d006c);return _0x1eab42['set']('Content-Range',_0x1508ab+'-'+_0x2a1f33+'/'+_0x45f489)[_0x663a('0x17')](_0x2d794f);}return null;};}function patchUpdates(_0x173a10){return function(_0x89d455){try{jsonpatch[_0x663a('0x1b')](_0x89d455,_0x173a10,!![]);}catch(_0x221c83){return BPromise[_0x663a('0x1c')](_0x221c83);}return _0x89d455[_0x663a('0x1d')]();};}function saveUpdates(_0x52d97b,_0x1586f3){return function(_0x21152c){if(_0x21152c){return _0x21152c[_0x663a('0x1e')](_0x52d97b)[_0x663a('0x1f')](function(_0x3d4e7c){return _0x3d4e7c;});}return null;};}function removeEntity(_0x207b26,_0x5e1bd1){return function(_0x310339){if(_0x310339){return _0x310339[_0x663a('0x20')]()['then'](function(){_0x207b26[_0x663a('0x1a')](0xcc)[_0x663a('0x16')]();});}};}function handleEntityNotFound(_0x5463d5,_0x3cb58a){return function(_0x2b2762){if(!_0x2b2762){_0x5463d5['sendStatus'](0x194);}return _0x2b2762;};}function handleError(_0x1e2653,_0x41c552){_0x41c552=_0x41c552||0x1f4;return function(_0x57131d){logger[_0x663a('0x21')](_0x57131d['stack']);if(_0x57131d[_0x663a('0x22')]){delete _0x57131d[_0x663a('0x22')];}_0x1e2653[_0x663a('0x1a')](_0x41c552)[_0x663a('0x23')](_0x57131d);};}exports[_0x663a('0x24')]=function(_0x57f93d,_0xcf9f0a){var _0x71efb={},_0x1ab286={},_0xf68801={'count':0x0,'rows':[]};var _0x210f03=_[_0x663a('0x25')](db[_0x663a('0x26')]['rawAttributes'],function(_0x3b4329){return{'name':_0x3b4329[_0x663a('0x27')],'type':_0x3b4329[_0x663a('0x28')][_0x663a('0x29')]};});_0x1ab286[_0x663a('0x2a')]=_['map'](_0x210f03,_0x663a('0x22'));_0x1ab286['query']=_[_0x663a('0x2b')](_0x57f93d[_0x663a('0x2c')]);_0x1ab286[_0x663a('0x2d')]=_[_0x663a('0x2e')](_0x1ab286[_0x663a('0x2a')],_0x1ab286['query']);_0x71efb[_0x663a('0x2f')]=_['intersection'](_0x1ab286[_0x663a('0x2a')],qs[_0x663a('0x30')](_0x57f93d[_0x663a('0x2c')][_0x663a('0x30')]));_0x71efb['attributes']=_0x71efb[_0x663a('0x2f')][_0x663a('0x31')]?_0x71efb[_0x663a('0x2f')]:_0x1ab286[_0x663a('0x2a')];if(!_0x57f93d[_0x663a('0x2c')][_0x663a('0x32')](_0x663a('0x33'))){_0x71efb[_0x663a('0x34')]=qs['limit'](_0x57f93d[_0x663a('0x2c')][_0x663a('0x34')]);_0x71efb['offset']=qs[_0x663a('0x35')](_0x57f93d[_0x663a('0x2c')][_0x663a('0x35')]);}_0x71efb[_0x663a('0x36')]=qs[_0x663a('0x37')](_0x57f93d['query'][_0x663a('0x37')]);_0x71efb['where']=qs[_0x663a('0x2d')](_[_0x663a('0x38')](_0x57f93d['query'],_0x1ab286['filters']),_0x210f03);if(_0x57f93d[_0x663a('0x2c')][_0x663a('0x39')]){_0x71efb['where']=_[_0x663a('0x3a')](_0x71efb[_0x663a('0x3b')],{'$or':_[_0x663a('0x25')](_0x210f03,function(_0x4d0b8d){if(_0x4d0b8d[_0x663a('0x28')]!==_0x663a('0x3c')){var _0x5e2826={};_0x5e2826[_0x4d0b8d[_0x663a('0x22')]]={'$like':'%'+_0x57f93d['query'][_0x663a('0x39')]+'%'};return _0x5e2826;}})});}_0x71efb=_[_0x663a('0x3a')]({},_0x71efb,_0x57f93d['options']);var _0x1aff26={'where':_0x71efb[_0x663a('0x3b')]};return db['WhatsappTransferReport'][_0x663a('0x19')](_0x1aff26)[_0x663a('0x1f')](function(_0x5de40d){_0xf68801['count']=_0x5de40d;if(_0x57f93d[_0x663a('0x2c')][_0x663a('0x3d')]){_0x71efb[_0x663a('0x3e')]=[{'all':!![]}];}return db[_0x663a('0x26')][_0x663a('0x3f')](_0x71efb);})[_0x663a('0x1f')](function(_0x110afa){_0xf68801[_0x663a('0x40')]=_0x110afa;return _0xf68801;})['then'](respondWithFilteredResult(_0xcf9f0a,_0x71efb))[_0x663a('0x41')](handleError(_0xcf9f0a,null));};exports[_0x663a('0x42')]=function(_0x252963,_0x2e0df7){var _0x51fd91={'raw':!![],'where':{'id':_0x252963['params']['id']}},_0x285ed3={};_0x285ed3['model']=_['keys'](db['WhatsappTransferReport'][_0x663a('0x43')]);_0x285ed3[_0x663a('0x2c')]=_[_0x663a('0x2b')](_0x252963['query']);_0x285ed3[_0x663a('0x2d')]=_['intersection'](_0x285ed3[_0x663a('0x2a')],_0x285ed3[_0x663a('0x2c')]);_0x51fd91['attributes']=_[_0x663a('0x2e')](_0x285ed3[_0x663a('0x2a')],qs[_0x663a('0x30')](_0x252963[_0x663a('0x2c')][_0x663a('0x30')]));_0x51fd91[_0x663a('0x2f')]=_0x51fd91[_0x663a('0x2f')][_0x663a('0x31')]?_0x51fd91['attributes']:_0x285ed3[_0x663a('0x2a')];if(_0x252963[_0x663a('0x2c')]['includeAll']){_0x51fd91['include']=[{'all':!![]}];}_0x51fd91=_[_0x663a('0x3a')]({},_0x51fd91,_0x252963[_0x663a('0x44')]);return db[_0x663a('0x26')][_0x663a('0x45')](_0x51fd91)['then'](handleEntityNotFound(_0x2e0df7,null))['then'](respondWithResult(_0x2e0df7,null))[_0x663a('0x41')](handleError(_0x2e0df7,null));};exports[_0x663a('0x46')]=function(_0x55b3ed,_0x5efe40){return db[_0x663a('0x26')][_0x663a('0x46')](_0x55b3ed[_0x663a('0x47')],{})[_0x663a('0x1f')](respondWithResult(_0x5efe40,0xc9))[_0x663a('0x41')](handleError(_0x5efe40,null));};exports[_0x663a('0x1e')]=function(_0x1c3bc4,_0x5ec404){if(_0x1c3bc4[_0x663a('0x47')]['id']){delete _0x1c3bc4[_0x663a('0x47')]['id'];}return db[_0x663a('0x26')][_0x663a('0x45')]({'where':{'id':_0x1c3bc4[_0x663a('0x48')]['id']}})[_0x663a('0x1f')](handleEntityNotFound(_0x5ec404,null))[_0x663a('0x1f')](saveUpdates(_0x1c3bc4[_0x663a('0x47')],null))[_0x663a('0x1f')](respondWithResult(_0x5ec404,null))[_0x663a('0x41')](handleError(_0x5ec404,null));};exports[_0x663a('0x20')]=function(_0x4a61f5,_0x32fbe2){return db[_0x663a('0x26')]['find']({'where':{'id':_0x4a61f5[_0x663a('0x48')]['id']}})[_0x663a('0x1f')](handleEntityNotFound(_0x32fbe2,null))[_0x663a('0x1f')](removeEntity(_0x32fbe2,null))['catch'](handleError(_0x32fbe2,null));};exports[_0x663a('0x49')]=function(_0x384629,_0x5462d4){return db[_0x663a('0x26')][_0x663a('0x49')]()['then'](respondWithResult(_0x5462d4,null))['catch'](handleError(_0x5462d4,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ce7c894..b809a9f 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 _0x81df=['../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x81df,0x163));var _0xf81d=function(_0x41beea,_0x5104db){_0x41beea=_0x41beea-0x0;var _0x26fa17=_0x81df[_0x41beea];return _0x26fa17;};'use strict';var _=require(_0xf81d('0x0'));var util=require(_0xf81d('0x1'));var logger=require(_0xf81d('0x2'))(_0xf81d('0x3'));var moment=require(_0xf81d('0x4'));var BPromise=require(_0xf81d('0x5'));var rp=require(_0xf81d('0x6'));var fs=require('fs');var path=require(_0xf81d('0x7'));var rimraf=require(_0xf81d('0x8'));var config=require(_0xf81d('0x9'));var attributes=require(_0xf81d('0xa'));module['exports']=function(_0x56f541,_0x16ec69){return _0x56f541[_0xf81d('0xb')](_0xf81d('0xc'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xf81d('0xd'),'fields':[_0xf81d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bb7=['rimraf','../../config/environment','./whatsappTransferReport.attributes','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6bb7,0x1b2));var _0x76bb=function(_0x49859e,_0x1eae28){_0x49859e=_0x49859e-0x0;var _0xa3d5c2=_0x6bb7[_0x49859e];return _0xa3d5c2;};'use strict';var _=require('lodash');var util=require(_0x76bb('0x0'));var logger=require(_0x76bb('0x1'))(_0x76bb('0x2'));var moment=require(_0x76bb('0x3'));var BPromise=require(_0x76bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76bb('0x5'));var rimraf=require(_0x76bb('0x6'));var config=require(_0x76bb('0x7'));var attributes=require(_0x76bb('0x8'));module['exports']=function(_0x4adde2,_0x8784d5){return _0x4adde2['define']('WhatsappTransferReport',attributes,{'tableName':_0x76bb('0x9'),'paranoid':![],'indexes':[{'name':_0x76bb('0xa'),'fields':[_0x76bb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c62a5eb..491edb7 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 _0x6042=['then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x6042,0x109));var _0x2604=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6042[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2604('0x0'));var util=require(_0x2604('0x1'));var moment=require(_0x2604('0x2'));var BPromise=require(_0x2604('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2604('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2604('0x5'));var logger=require(_0x2604('0x6'))(_0x2604('0x7'));var config=require(_0x2604('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2604('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52ab02,_0xd9a858,_0x24381d){return new BPromise(function(_0x5e61ef,_0x43827d){return client[_0x2604('0xa')](_0x52ab02,_0x24381d)[_0x2604('0xb')](function(_0xf603ae){logger[_0x2604('0xc')](_0x2604('0xd'),_0xd9a858,_0x2604('0xe'));logger[_0x2604('0xf')](_0x2604('0x10'),_0xd9a858,_0x2604('0xe'),JSON[_0x2604('0x11')](_0xf603ae));if(_0xf603ae['error']){if(_0xf603ae[_0x2604('0x12')][_0x2604('0x13')]===0x1f4){logger[_0x2604('0x12')](_0x2604('0xd'),_0xd9a858,_0xf603ae[_0x2604('0x12')][_0x2604('0x14')]);return _0x43827d(_0xf603ae['error'][_0x2604('0x14')]);}logger[_0x2604('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0xd9a858,_0xf603ae[_0x2604('0x12')][_0x2604('0x14')]);return _0x5e61ef(_0xf603ae[_0x2604('0x12')][_0x2604('0x14')]);}else{logger[_0x2604('0xc')](_0x2604('0xd'),_0xd9a858,_0x2604('0xe'));_0x5e61ef(_0xf603ae[_0x2604('0x15')][_0x2604('0x14')]);}})[_0x2604('0x16')](function(_0x9d2402){logger[_0x2604('0x12')](_0x2604('0xd'),_0xd9a858,_0x9d2402);_0x43827d(_0x9d2402);});});} \ No newline at end of file +var _0xb66f=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xb66f,0x83));var _0xfb66=function(_0x5304c0,_0x240d71){_0x5304c0=_0x5304c0-0x0;var _0x11d983=_0xb66f[_0x5304c0];return _0x11d983;};'use strict';var _=require(_0xfb66('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfb66('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb66('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb66('0x3'));var logger=require(_0xfb66('0x4'))('rpc');var config=require(_0xfb66('0x5'));var jayson=require(_0xfb66('0x6'));var client=jayson['client'][_0xfb66('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x593120,_0x456949,_0xff699c){return new BPromise(function(_0x2d422e,_0x3d9d68){return client[_0xfb66('0x8')](_0x593120,_0xff699c)[_0xfb66('0x9')](function(_0x2d1863){logger[_0xfb66('0xa')](_0xfb66('0xb'),_0x456949,_0xfb66('0xc'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x456949,'request\x20sent',JSON[_0xfb66('0xd')](_0x2d1863));if(_0x2d1863['error']){if(_0x2d1863[_0xfb66('0xe')][_0xfb66('0xf')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x456949,_0x2d1863[_0xfb66('0xe')][_0xfb66('0x10')]);return _0x3d9d68(_0x2d1863[_0xfb66('0xe')]['message']);}logger[_0xfb66('0xe')](_0xfb66('0xb'),_0x456949,_0x2d1863[_0xfb66('0xe')][_0xfb66('0x10')]);return _0x2d422e(_0x2d1863[_0xfb66('0xe')]['message']);}else{logger[_0xfb66('0xa')](_0xfb66('0xb'),_0x456949,_0xfb66('0xc'));_0x2d422e(_0x2d1863[_0xfb66('0x11')][_0xfb66('0x10')]);}})[_0xfb66('0x12')](function(_0x4d7a49){logger[_0xfb66('0xe')](_0xfb66('0xb'),_0x456949,_0x4d7a49);_0x3d9d68(_0x4d7a49);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3497260..cbad083 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c17=['info','start','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','default','listen'];(function(_0x14a6bb,_0x68aaa6){var _0x53d06f=function(_0x4335d7){while(--_0x4335d7){_0x14a6bb['push'](_0x14a6bb['shift']());}};_0x53d06f(++_0x68aaa6);}(_0x3c17,0x1a1));var _0x73c1=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x3c17[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x73c1('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x73c1('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x73c1('0x2'));var config=require(_0x73c1('0x3'));var logger=require(_0x73c1('0x4'))('app');var pm2=require(_0x73c1('0x5'));var pm2Config=require(_0x73c1('0x6'));var schedule=require(_0x73c1('0x7'));var chat=require(_0x73c1('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x73c1('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x73c1('0xa')][_0x73c1('0xb')]()[_0x73c1('0xc')](function(){if(config['seedDB']){return seedDb['default']();}})[_0x73c1('0xc')](function(){return checkLicense[_0x73c1('0xd')]();})[_0x73c1('0xc')](function(){return rpc[_0x73c1('0xe')]();})[_0x73c1('0xc')](function(_0x11518f){logger[_0x73c1('0xf')](_0x11518f);return chat['start']();})['then'](function(){return whatsapp[_0x73c1('0x10')]();})[_0x73c1('0xc')](function(){return schedule[_0x73c1('0x10')]();})[_0x73c1('0xc')](function(){return transcribe['start']();})[_0x73c1('0xc')](function(){return provider['start']();})[_0x73c1('0xc')](function(_0x5f3799){logger[_0x73c1('0xf')](_0x5f3799);return pm2[_0x73c1('0x10')](pm2Config);})['then'](function(_0x537965){var _0x1cc555=_0x537965['filter'](function(_0x72a36){return typeof _0x72a36['exitCode']===_0x73c1('0x11')&&_0x72a36['exitCode']>=0x0;});if(_0x1cc555[_0x73c1('0x12')]>0x0){throw new Error(_0x1cc555[_0x73c1('0x12')]+_0x73c1('0x13')+_[_0x73c1('0x14')](_0x1cc555,function(_0x8c0803){return'\x22'+_0x8c0803[_0x73c1('0x15')][_0x73c1('0x16')]+'\x22';}));}logger[_0x73c1('0xf')](_0x73c1('0x17'),_['map'](_[_0x73c1('0x18')](_0x537965,{'status':_0x73c1('0x19')}),_0x73c1('0x16'))[_0x73c1('0x1a')]());logger['info'](_0x73c1('0x1b'),_[_0x73c1('0x14')](_[_0x73c1('0x18')](_0x537965,function(_0x2e17e5){return _0x2e17e5[_0x73c1('0x1c')]!==_0x73c1('0x19');}),_0x73c1('0x16'))[_0x73c1('0x1a')]()||'None');console[_0x73c1('0x1d')](_0x73c1('0x1e'));})[_0x73c1('0x1f')](function(_0x5eafe2){console[_0x73c1('0x1d')](_0x73c1('0x20'),_0x5eafe2);logger[_0x73c1('0x21')](_0x73c1('0x22'),_0x5eafe2);process[_0x73c1('0x23')](0x1);});}main(); \ No newline at end of file +var _0xfc46=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','map','online','name','join','Offline\x20apps:','status','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0x13b18b,_0x5553c4){var _0x33ee5a=function(_0x51c78b){while(--_0x51c78b){_0x13b18b['push'](_0x13b18b['shift']());}};_0x33ee5a(++_0x5553c4);}(_0xfc46,0x9a));var _0x6fc4=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0xfc46[_0x9c8b4a];return _0x198bef;};'use strict';var _=require(_0x6fc4('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x6fc4('0x1'));var checkLicense=require(_0x6fc4('0x2'));var rpc=require(_0x6fc4('0x3'));var config=require('./config/environment');var logger=require(_0x6fc4('0x4'))(_0x6fc4('0x5'));var pm2=require(_0x6fc4('0x6'));var pm2Config=require(_0x6fc4('0x7'));var schedule=require('./config/schedule');var chat=require(_0x6fc4('0x8'));var whatsapp=require(_0x6fc4('0x9'));var transcribe=require(_0x6fc4('0xa'));var provider=require(_0x6fc4('0xb'));function main(){return db[_0x6fc4('0xc')][_0x6fc4('0xd')]()['then'](function(){if(config[_0x6fc4('0xe')]){return seedDb['default']();}})[_0x6fc4('0xf')](function(){return checkLicense[_0x6fc4('0x10')]();})['then'](function(){return rpc[_0x6fc4('0x11')]();})[_0x6fc4('0xf')](function(_0x3a8f51){logger[_0x6fc4('0x12')](_0x3a8f51);return chat[_0x6fc4('0x13')]();})[_0x6fc4('0xf')](function(){return whatsapp[_0x6fc4('0x13')]();})[_0x6fc4('0xf')](function(){return schedule[_0x6fc4('0x13')]();})[_0x6fc4('0xf')](function(){return transcribe[_0x6fc4('0x13')]();})[_0x6fc4('0xf')](function(){return provider[_0x6fc4('0x13')]();})[_0x6fc4('0xf')](function(_0x13eb64){logger[_0x6fc4('0x12')](_0x13eb64);return pm2[_0x6fc4('0x13')](pm2Config);})['then'](function(_0x56383b){var _0x15305c=_0x56383b[_0x6fc4('0x14')](function(_0x3b42a5){return typeof _0x3b42a5[_0x6fc4('0x15')]===_0x6fc4('0x16')&&_0x3b42a5[_0x6fc4('0x15')]>=0x0;});if(_0x15305c[_0x6fc4('0x17')]>0x0){throw new Error(_0x15305c[_0x6fc4('0x17')]+_0x6fc4('0x18')+_['map'](_0x15305c,function(_0xf85d9b){return'\x22'+_0xf85d9b[_0x6fc4('0x19')]['name']+'\x22';}));}logger['info'](_0x6fc4('0x1a'),_[_0x6fc4('0x1b')](_['filter'](_0x56383b,{'status':_0x6fc4('0x1c')}),_0x6fc4('0x1d'))[_0x6fc4('0x1e')]());logger['info'](_0x6fc4('0x1f'),_[_0x6fc4('0x1b')](_[_0x6fc4('0x14')](_0x56383b,function(_0x518579){return _0x518579[_0x6fc4('0x20')]!==_0x6fc4('0x1c');}),'name')['join']()||_0x6fc4('0x21'));console['log']('App\x20Ready!');})['catch'](function(_0x417ce6){console[_0x6fc4('0x22')](_0x6fc4('0x23'),_0x417ce6);logger['error'](_0x6fc4('0x24'),_0x417ce6);process[_0x6fc4('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 60f18e1..a4d0632 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 _0xdfe2=['bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isAuthenticated','user','ChatInteraction','findOne','params','closed','then','query','forceDownload','status','unmanaged','json','disposition','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','promisify','sign','secrets','payload','options','verify','randomBytes','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','composable-middleware','crypto'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xdfe2,0x86));var _0x2dfe=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xdfe2[_0x101e7b];return _0x4995c0;};'use strict';var db=require(_0x2dfe('0x0'))['db'];var config=require(_0x2dfe('0x1'));var hardwareConf=require(_0x2dfe('0x2'));var licenseUtil=require(_0x2dfe('0x3'));var encryptor=require(_0x2dfe('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x2dfe('0x5'));var compose=require(_0x2dfe('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x2dfe('0x7'));var BPromise=require(_0x2dfe('0x8'));var util=require(_0x2dfe('0x9'));var moment=require(_0x2dfe('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x2dfe('0xb')]});var userAttributes=['id',_0x2dfe('0xc'),_0x2dfe('0xd'),_0x2dfe('0xe'),_0x2dfe('0xf'),_0x2dfe('0x10'),_0x2dfe('0x11'),_0x2dfe('0x12'),_0x2dfe('0x13'),_0x2dfe('0x14'),_0x2dfe('0x15'),_0x2dfe('0x16'),_0x2dfe('0x17'),_0x2dfe('0x18'),_0x2dfe('0x19'),_0x2dfe('0x1a'),_0x2dfe('0x1b'),_0x2dfe('0x1c'),_0x2dfe('0x1d'),_0x2dfe('0x1e'),_0x2dfe('0x1f'),'passwordResetAt','alias',_0x2dfe('0x20'),_0x2dfe('0x21'),_0x2dfe('0x22'),_0x2dfe('0x23'),_0x2dfe('0x24'),'phoneBarEnableSettings',_0x2dfe('0x25'),'phoneBarPrefixRequired',_0x2dfe('0x26'),_0x2dfe('0x27'),_0x2dfe('0x28'),_0x2dfe('0x29'),_0x2dfe('0x2a'),_0x2dfe('0x2b'),'settingsEnabled',_0x2dfe('0x2c'),_0x2dfe('0x2d'),_0x2dfe('0x2e'),_0x2dfe('0x2f'),'ignorePauseForPreviewCalls',_0x2dfe('0x30'),'chatAutoanswer',_0x2dfe('0x31'),'emailAutoanswer',_0x2dfe('0x32'),_0x2dfe('0x33'),_0x2dfe('0x34'),'openchannelAutoanswer',_0x2dfe('0x35'),_0x2dfe('0x36'),_0x2dfe('0x37'),_0x2dfe('0x38'),_0x2dfe('0x39'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0x2dfe('0x3a')](!![])['use'](function(_0x166b59,_0x4a8f60,_0x5d13a3){if(_0x166b59[_0x2dfe('0x3b')]){_0x5d13a3();}else{return db[_0x2dfe('0x3c')][_0x2dfe('0x3d')]({'where':{'id':_0x166b59[_0x2dfe('0x3e')]['id']},'attributes':['id',_0x2dfe('0x3f'),'disposition'],'raw':!![]})[_0x2dfe('0x40')](function(_0x48fd34){if(_0x48fd34&&_0x48fd34[_0x2dfe('0x3f')]&&!_0x166b59[_0x2dfe('0x41')][_0x2dfe('0x42')]){return _0x4a8f60[_0x2dfe('0x43')](_0x48fd34['disposition']===_0x2dfe('0x44')?0x195:0x193)[_0x2dfe('0x45')]({'message':_0x48fd34[_0x2dfe('0x46')]==='unmanaged'?'Unmanaged.':_0x2dfe('0x47')});}else{_0x5d13a3();}})[_0x2dfe('0x48')](function(_0x3b58da){_0x5d13a3(_0x3b58da);});}});};exports[_0x2dfe('0x3a')]=function isAuthenticated(_0x46b996){return compose()[_0x2dfe('0x49')](function(_0x2cfe62,_0x35fcb3,_0x4f010d){var _0x2e6b0a;if(_0x2cfe62[_0x2dfe('0x4a')][_0x2dfe('0x4b')]){if(_[_0x2dfe('0x4c')](_0x2cfe62['headers']['authorization'],_0x2dfe('0x4d'))){var _0x33b691=basicAuth(_0x2cfe62);db[_0x2dfe('0x4e')][_0x2dfe('0x4f')]({'where':{'name':_0x33b691[_0x2dfe('0xe')]}})['then'](function(_0x23f02a){if(!_0x23f02a||!_0x23f02a[_0x2dfe('0x50')](_0x33b691['pass'])){return _0x35fcb3[_0x2dfe('0x43')](0x191)[_0x2dfe('0x45')]({'message':_0x2dfe('0x51')});}_0x2cfe62[_0x2dfe('0x3b')]={'id':_0x23f02a['id']};_0x4f010d();})[_0x2dfe('0x48')](function(_0x3064c0){_0x4f010d(_0x3064c0);});}else if(_[_0x2dfe('0x4c')](_0x2cfe62['headers'][_0x2dfe('0x4b')],_0x2dfe('0x52'))){validateJwt(_0x2cfe62,_0x35fcb3,_0x4f010d);}else{if(_0x46b996){_0x4f010d();}else{return _0x35fcb3[_0x2dfe('0x43')](0x193)[_0x2dfe('0x45')]({'message':_0x2dfe('0x53')});}}}else if(_0x2cfe62[_0x2dfe('0x41')][_0x2dfe('0x54')]){try{var _0x4c7de1={'audience':hardwareConf[_0x2dfe('0x55')](),'issuer':hardwareConf[_0x2dfe('0x55')]()};verifyJwt(_0x2cfe62[_0x2dfe('0x41')][_0x2dfe('0x54')],_0x4c7de1)[_0x2dfe('0x40')](function(_0x5af8a6){return db[_0x2dfe('0x4e')][_0x2dfe('0x4f')]({'where':{'id':_0x5af8a6['sub']}})[_0x2dfe('0x40')](function(_0x10089c){_0x2e6b0a=_0x10089c;return db[_0x2dfe('0x56')][_0x2dfe('0x3d')]({'where':{'id':0x1},'attributes':[_0x2dfe('0x57'),'blockDuration'],'raw':!![]});})[_0x2dfe('0x40')](function(_0x70f603){if(!_0x2e6b0a||!_[_0x2dfe('0x58')](_0x2e6b0a[_0x2dfe('0x59')],_0x5af8a6[_0x2dfe('0x5a')])){return _0x35fcb3[_0x2dfe('0x43')](0x191)[_0x2dfe('0x45')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2e6b0a[_0x2dfe('0x5b')]){return _0x35fcb3[_0x2dfe('0x43')](0x191)['json']({'message':_0x2dfe('0x5c')});}if(_0x2e6b0a[_0x2dfe('0x5d')]){if(_0x70f603[_0x2dfe('0x5e')]>0x0){if(moment(_0x2e6b0a[_0x2dfe('0x5f')])[_0x2dfe('0x60')](_0x70f603['blockDuration'],'minutes')>moment()){return _0x35fcb3[_0x2dfe('0x43')](0x191)['json']({'message':_0x2dfe('0x5c')});}}else{return _0x35fcb3['status'](0x191)[_0x2dfe('0x45')]({'message':_0x2dfe('0x5c')});}}_0x2cfe62[_0x2dfe('0x3b')]={'id':_0x2e6b0a['id']};_0x4f010d();});})[_0x2dfe('0x48')](function(){return _0x35fcb3[_0x2dfe('0x43')](0x191)['json']({'message':_0x2dfe('0x5c')});});}catch(_0x34e117){_0x4f010d(_0x34e117);}}else if(_0x46b996){_0x4f010d();}else{return _0x35fcb3['status'](0x193)[_0x2dfe('0x45')]({'message':_0x2dfe('0x53')});}})['use'](function(_0x249232,_0x71ff16,_0x5ad8e6){if(_0x249232[_0x2dfe('0x3b')]){db[_0x2dfe('0x4e')][_0x2dfe('0x4f')]({'where':{'id':_0x249232[_0x2dfe('0x3b')]['id']},'attributes':userAttributes})[_0x2dfe('0x40')](function(_0x43326f){if(!_0x43326f){return _0x71ff16[_0x2dfe('0x43')](0x194)[_0x2dfe('0x45')]({'message':_0x2dfe('0x61')});}_0x249232[_0x2dfe('0x3b')]=_0x43326f;_0x5ad8e6();})[_0x2dfe('0x48')](function(_0x59d5d3){_0x5ad8e6(_0x59d5d3);});}else if(_0x46b996){_0x5ad8e6();}else{return _0x71ff16['status'](0x194)[_0x2dfe('0x45')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2dfe('0x62')]=function canUpdate(){return compose()[_0x2dfe('0x49')](function(_0x187afe,_0x26679b,_0x1d2c98){return licenseUtil[_0x2dfe('0x63')]()[_0x2dfe('0x40')](function(_0x2bfdb6){if(_0x2bfdb6[_0x2dfe('0x64')]){_0x1d2c98();}else{return _0x26679b[_0x2dfe('0x43')](0x193)[_0x2dfe('0x45')]({'message':'Forbidden'});}})[_0x2dfe('0x48')](function(_0x5e73ca){_0x1d2c98(_0x5e73ca);});});};exports[_0x2dfe('0x65')]=function isWebrtcLicence(){return compose()[_0x2dfe('0x49')](function(_0x517d33,_0x431f1a,_0x58943f){return licenseUtil[_0x2dfe('0x63')]()[_0x2dfe('0x40')](function(_0x5b9dac){if(_0x5b9dac[_0x2dfe('0x66')]){_0x58943f();}else{return _0x431f1a['status'](0x193)[_0x2dfe('0x45')]({'message':'Forbidden'});}})[_0x2dfe('0x48')](function(_0x1e1295){_0x58943f(_0x1e1295);});});};exports[_0x2dfe('0x67')]=function(_0x40a3cc,_0x21c1b5,_0xa8c5fa){_0x40a3cc[_0x2dfe('0x67')]=!![];return _0xa8c5fa();};exports[_0x2dfe('0x68')]=function signToken(_0x18bd3c){return signJwt(_0x18bd3c);};exports['setTokenCookie']=function(_0x1e25df,_0x372def){if(!_0x1e25df[_0x2dfe('0x3b')]){return _0x372def['status'](0x194)[_0x2dfe('0x45')]({'message':_0x2dfe('0x69')});}var _0xd19cfd={'payload':{'id':_0x1e25df[_0x2dfe('0x3b')]['id'],'role':_0x1e25df['user'][_0x2dfe('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0xd19cfd)[_0x2dfe('0x40')](function(_0x9fd035){_0x372def[_0x2dfe('0x6a')](_0x2dfe('0x6b'),_0x9fd035);_0x372def[_0x2dfe('0x6c')](_0x2dfe('0x6d'));})[_0x2dfe('0x48')](function(_0x34ff35){return _0x372def[_0x2dfe('0x43')](0x1f4)[_0x2dfe('0x6e')](_0x34ff35);});};exports['retrieveApiKey']=function(_0x4111b0){if(_[_0x2dfe('0x6f')](_0x4111b0[_0x2dfe('0x59')])||_[_0x2dfe('0x6f')](_0x4111b0['apiKeyIat'])){return null;}else{return createJwt(_0x4111b0);}};exports[_0x2dfe('0x70')]=function(_0x4f950b){_0x4f950b['apiKeyNonce']=generateNonce();_0x4f950b[_0x2dfe('0x71')]=generateIssuedAt();return createJwt(_0x4f950b);};exports[_0x2dfe('0x72')]=function(_0x94f619,_0x430219){var _0x3c2b74=_0x94f619[_0x2dfe('0x41')][_0x2dfe('0x54')];if(_0x3c2b74){var _0x19c03d={'nonce':_0x430219[_0x2dfe('0x59')],'iat':_0x430219[_0x2dfe('0x71')],'audience':hardwareConf[_0x2dfe('0x55')](),'issuer':hardwareConf[_0x2dfe('0x55')]()};return verifyJwt(_0x3c2b74,_0x19c03d)[_0x2dfe('0x40')](function(){return generateApiKey(_0x430219);});}else{throw{'message':_0x2dfe('0x73')};}};exports['validatePasswordPattern']=function(_0x2ab2a1){var _0x452a84=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x452a84[_0x2dfe('0x74')](_0x2ab2a1))throw new db[(_0x2dfe('0x75'))][(_0x2dfe('0x76'))](_0x2dfe('0x77'));return;};exports[_0x2dfe('0x78')]=function(_0x1987a6,_0x3be5ab,_0x193dc){var _0x182014=encryptor[_0x2dfe('0x79')](_0x3be5ab)[_0x2dfe('0x7a')](',');for(var _0xb538f4=0x0;_0xb538f4<_0x193dc;_0xb538f4++){if(!_0x182014[_0xb538f4])break;if(_0x1987a6['toLowerCase']()===_0x182014[_0xb538f4][_0x2dfe('0x7b')]()){var _0x4177f5=util[_0x2dfe('0x7c')](_0x2dfe('0x7d'),_0x193dc);if(_0x193dc===0x1){_0x4177f5=_0x2dfe('0x7e');}throw new db['Sequelize'][(_0x2dfe('0x76'))](_0x4177f5);}}return;};exports[_0x2dfe('0x7f')]=function(_0x5149bd,_0x4a0e87){var _0x14aaa3=_0x4a0e87?encryptor[_0x2dfe('0x79')](_0x4a0e87)[_0x2dfe('0x7a')](','):[];if(_0x14aaa3[_0x2dfe('0x80')]===0x5){_0x14aaa3[_0x2dfe('0x81')](-0x1,0x1);}_0x14aaa3[_0x2dfe('0x82')](_0x5149bd);return encryptor['encryptString'](_0x14aaa3['join'](','));};function signJwt(_0x52c6cb){var _0x4d7f29=BPromise[_0x2dfe('0x83')](jwt[_0x2dfe('0x84')],{'context':jwt});var _0x37d811=_0x52c6cb['secret']||config[_0x2dfe('0x85')][_0x2dfe('0xb')];return new BPromise(function(_0x2bd023,_0x2bd430){_0x4d7f29(_0x52c6cb[_0x2dfe('0x86')],_0x37d811,_0x52c6cb[_0x2dfe('0x87')])[_0x2dfe('0x40')](function(_0x4e2b5d){_0x2bd023(_0x4e2b5d);})['catch'](function(_0x34240e){_0x2bd430(_0x34240e);});});}function verifyJwt(_0x218043,_0x78bb79,_0x625196){var _0x2bb27d=BPromise[_0x2dfe('0x83')](jwt[_0x2dfe('0x88')],{'context':jwt});var _0x4c6ef5=_0x625196||config[_0x2dfe('0x85')][_0x2dfe('0xb')];return new BPromise(function(_0x3ce9fb,_0x135155){_0x2bb27d(_0x218043,_0x4c6ef5,_0x78bb79)[_0x2dfe('0x40')](function(_0x40a6dc){_0x3ce9fb(_0x40a6dc);})[_0x2dfe('0x48')](function(_0x54e43f){_0x135155(_0x54e43f);});});}function generateNonce(){return crypto[_0x2dfe('0x89')](0x10)['toString'](_0x2dfe('0x8a'));}function generateIssuedAt(){return Math[_0x2dfe('0x8b')](Date[_0x2dfe('0x8c')]()/0x3e8)['toString']();}function createJwt(_0x416ab1){var _0x4f03bd={'payload':{'iat':_0x416ab1[_0x2dfe('0x71')],'nonce':_0x416ab1['apiKeyNonce']},'options':{'algorithm':_0x2dfe('0x8d'),'subject':_0x416ab1['id']['toString'](),'issuer':hardwareConf[_0x2dfe('0x55')](),'audience':hardwareConf[_0x2dfe('0x55')]()}};return signJwt(_0x4f03bd)[_0x2dfe('0x40')](function(_0x3d08b5){return{'iat':_0x416ab1[_0x2dfe('0x71')],'nonce':_0x416ab1['apiKeyNonce'],'token':_0x3d08b5};});} \ No newline at end of file +var _0x6852=['emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','messengerSoundNotification','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','authenticate','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','getUuid','apikey','find','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','updatePasswordsHistory','encryptString','join','promisify','sign','secret','options','verify','session','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','role','fullname','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer'];(function(_0x5dcd44,_0x5f3963){var _0x3e496e=function(_0x413ba5){while(--_0x413ba5){_0x5dcd44['push'](_0x5dcd44['shift']());}};_0x3e496e(++_0x5f3963);}(_0x6852,0xd5));var _0x2685=function(_0xd8f9a7,_0x36778f){_0xd8f9a7=_0xd8f9a7-0x0;var _0x2b77ab=_0x6852[_0xd8f9a7];return _0x2b77ab;};'use strict';var db=require(_0x2685('0x0'))['db'];var config=require(_0x2685('0x1'));var hardwareConf=require(_0x2685('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0x2685('0x3'));var expressJwt=require(_0x2685('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x2685('0x5'));var crypto=require(_0x2685('0x6'));var BPromise=require('bluebird');var util=require(_0x2685('0x7'));var moment=require(_0x2685('0x8'));var validateJwt=expressJwt({'secret':config[_0x2685('0x9')]['session']});var userAttributes=['id',_0x2685('0xa'),_0x2685('0xb'),'name',_0x2685('0xc'),_0x2685('0xd'),_0x2685('0xe'),'permissions',_0x2685('0xf'),_0x2685('0x10'),_0x2685('0x11'),_0x2685('0x12'),_0x2685('0x13'),_0x2685('0x14'),'openchannelPause',_0x2685('0x15'),_0x2685('0x16'),'lastLoginAt',_0x2685('0x17'),_0x2685('0x18'),'allowmessenger',_0x2685('0x19'),_0x2685('0x1a'),_0x2685('0x1b'),_0x2685('0x1c'),_0x2685('0x1d'),_0x2685('0x1e'),_0x2685('0x1f'),_0x2685('0x20'),'phoneBarExpires',_0x2685('0x21'),_0x2685('0x22'),_0x2685('0x23'),'hotdesk',_0x2685('0x24'),_0x2685('0x25'),_0x2685('0x26'),_0x2685('0x27'),_0x2685('0x28'),_0x2685('0x29'),_0x2685('0x2a'),_0x2685('0x2b'),_0x2685('0x2c'),_0x2685('0x2d'),_0x2685('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x2685('0x2f'),_0x2685('0x30'),_0x2685('0x31'),_0x2685('0x32'),'openchannelAutoanswerDelay',_0x2685('0x33'),'faxAutoanswerDelay',_0x2685('0x34'),'whatsappAutoanswerDelay',_0x2685('0x35')];exports['isChatInteractionAuthorized']=function(){return this[_0x2685('0x36')](!![])[_0x2685('0x37')](function(_0x3e86b9,_0x266b17,_0x5d09cf){if(_0x3e86b9[_0x2685('0x38')]){_0x5d09cf();}else{return db[_0x2685('0x39')][_0x2685('0x3a')]({'where':{'id':_0x3e86b9[_0x2685('0x3b')]['id']},'attributes':['id',_0x2685('0x3c'),_0x2685('0x3d')],'raw':!![]})[_0x2685('0x3e')](function(_0x46e59b){if(_0x46e59b&&_0x46e59b['closed']&&!_0x3e86b9[_0x2685('0x3f')][_0x2685('0x40')]){return _0x266b17['status'](_0x46e59b[_0x2685('0x3d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x46e59b[_0x2685('0x3d')]===_0x2685('0x41')?_0x2685('0x42'):_0x2685('0x43')});}else{_0x5d09cf();}})[_0x2685('0x44')](function(_0x5a15d7){_0x5d09cf(_0x5a15d7);});}});};exports[_0x2685('0x36')]=function isAuthenticated(_0x5b549e){return compose()[_0x2685('0x37')](function(_0x47e62a,_0x258560,_0x3675bb){var _0x2dbbf1;if(_0x47e62a[_0x2685('0x45')][_0x2685('0x46')]){if(_['startsWith'](_0x47e62a['headers'][_0x2685('0x46')],'Basic')){var _0x345187=basicAuth(_0x47e62a);db[_0x2685('0x47')]['find']({'where':{'name':_0x345187[_0x2685('0x48')]}})[_0x2685('0x3e')](function(_0x402b41){if(!_0x402b41||!_0x402b41[_0x2685('0x49')](_0x345187[_0x2685('0x4a')])){return _0x258560[_0x2685('0x4b')](0x191)[_0x2685('0x4c')]({'message':_0x2685('0x4d')});}_0x47e62a[_0x2685('0x38')]={'id':_0x402b41['id']};_0x3675bb();})[_0x2685('0x44')](function(_0x1a4647){_0x3675bb(_0x1a4647);});}else if(_['startsWith'](_0x47e62a['headers']['authorization'],'Bearer')){validateJwt(_0x47e62a,_0x258560,_0x3675bb);}else{if(_0x5b549e){_0x3675bb();}else{return _0x258560[_0x2685('0x4b')](0x193)[_0x2685('0x4c')]({'message':_0x2685('0x4e')});}}}else if(_0x47e62a['query']['apikey']){try{var _0x5d740b={'audience':hardwareConf[_0x2685('0x4f')](),'issuer':hardwareConf[_0x2685('0x4f')]()};verifyJwt(_0x47e62a[_0x2685('0x3f')][_0x2685('0x50')],_0x5d740b)[_0x2685('0x3e')](function(_0x3c4321){return db[_0x2685('0x47')][_0x2685('0x51')]({'where':{'id':_0x3c4321['sub']}})[_0x2685('0x3e')](function(_0x268ce1){_0x2dbbf1=_0x268ce1;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2685('0x52')],'raw':!![]});})[_0x2685('0x3e')](function(_0x41e11d){if(!_0x2dbbf1||!_['isEqual'](_0x2dbbf1[_0x2685('0x53')],_0x3c4321[_0x2685('0x54')])){return _0x258560[_0x2685('0x4b')](0x191)[_0x2685('0x4c')]({'message':_0x2685('0x55')});}if(_0x2dbbf1['disabled']){return _0x258560[_0x2685('0x4b')](0x191)[_0x2685('0x4c')]({'message':_0x2685('0x56')});}if(_0x2dbbf1['blocked']){if(_0x41e11d[_0x2685('0x52')]>0x0){if(moment(_0x2dbbf1['blockedAt'])[_0x2685('0x57')](_0x41e11d[_0x2685('0x52')],_0x2685('0x58'))>moment()){return _0x258560[_0x2685('0x4b')](0x191)[_0x2685('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x258560['status'](0x191)[_0x2685('0x4c')]({'message':_0x2685('0x56')});}}_0x47e62a[_0x2685('0x38')]={'id':_0x2dbbf1['id']};_0x3675bb();});})['catch'](function(){return _0x258560[_0x2685('0x4b')](0x191)[_0x2685('0x4c')]({'message':_0x2685('0x56')});});}catch(_0x25375a){_0x3675bb(_0x25375a);}}else if(_0x5b549e){_0x3675bb();}else{return _0x258560[_0x2685('0x4b')](0x193)[_0x2685('0x4c')]({'message':'Unknown\x20authorization\x20format'});}})[_0x2685('0x37')](function(_0x1340e4,_0x22c46c,_0x216c31){if(_0x1340e4[_0x2685('0x38')]){db[_0x2685('0x47')][_0x2685('0x51')]({'where':{'id':_0x1340e4[_0x2685('0x38')]['id']},'attributes':userAttributes})[_0x2685('0x3e')](function(_0x2f625c){if(!_0x2f625c){return _0x22c46c[_0x2685('0x4b')](0x194)['json']({'message':_0x2685('0x59')});}_0x1340e4[_0x2685('0x38')]=_0x2f625c;_0x216c31();})[_0x2685('0x44')](function(_0x509369){_0x216c31(_0x509369);});}else if(_0x5b549e){_0x216c31();}else{return _0x22c46c[_0x2685('0x4b')](0x194)[_0x2685('0x4c')]({'message':_0x2685('0x5a')});}});};exports[_0x2685('0x5b')]=function canUpdate(){return compose()[_0x2685('0x37')](function(_0x5b1a7b,_0x2061b6,_0x46bb87){return licenseUtil['getLicense']()[_0x2685('0x3e')](function(_0x33eaa6){if(_0x33eaa6[_0x2685('0x5c')]){_0x46bb87();}else{return _0x2061b6[_0x2685('0x4b')](0x193)[_0x2685('0x4c')]({'message':_0x2685('0x5d')});}})['catch'](function(_0x500138){_0x46bb87(_0x500138);});});};exports[_0x2685('0x5e')]=function isWebrtcLicence(){return compose()[_0x2685('0x37')](function(_0x15df74,_0x407044,_0x125953){return licenseUtil[_0x2685('0x5f')]()['then'](function(_0x9de1d3){if(_0x9de1d3[_0x2685('0x60')]){_0x125953();}else{return _0x407044[_0x2685('0x4b')](0x193)['json']({'message':_0x2685('0x5d')});}})['catch'](function(_0x2f19bb){_0x125953(_0x2f19bb);});});};exports[_0x2685('0x61')]=function(_0x43f58c,_0x6a98ca,_0x570355){_0x43f58c[_0x2685('0x61')]=!![];return _0x570355();};exports['signToken']=function signToken(_0x3a4b62){return signJwt(_0x3a4b62);};exports[_0x2685('0x62')]=function(_0x1a4e1b,_0x4faf2f){if(!_0x1a4e1b[_0x2685('0x38')]){return _0x4faf2f['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x38d60a={'payload':{'id':_0x1a4e1b['user']['id'],'role':_0x1a4e1b[_0x2685('0x38')][_0x2685('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x38d60a)['then'](function(_0x9df4d8){_0x4faf2f[_0x2685('0x63')](_0x2685('0x64'),_0x9df4d8);_0x4faf2f[_0x2685('0x65')](_0x2685('0x66'));})['catch'](function(_0xca065d){return _0x4faf2f['status'](0x1f4)['send'](_0xca065d);});};exports[_0x2685('0x67')]=function(_0xbbab48){if(_['isNil'](_0xbbab48[_0x2685('0x53')])||_[_0x2685('0x68')](_0xbbab48['apiKeyIat'])){return null;}else{return createJwt(_0xbbab48);}};exports[_0x2685('0x69')]=function(_0x4767e9){_0x4767e9[_0x2685('0x53')]=generateNonce();_0x4767e9[_0x2685('0x6a')]=generateIssuedAt();return createJwt(_0x4767e9);};exports[_0x2685('0x6b')]=function(_0x48406d,_0x67dd81){var _0x2d6432=_0x48406d['query'][_0x2685('0x50')];if(_0x2d6432){var _0x4b7c03={'nonce':_0x67dd81[_0x2685('0x53')],'iat':_0x67dd81[_0x2685('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2685('0x4f')]()};return verifyJwt(_0x2d6432,_0x4b7c03)[_0x2685('0x3e')](function(){return generateApiKey(_0x67dd81);});}else{throw{'message':_0x2685('0x6c')};}};exports['validatePasswordPattern']=function(_0x2694c3){var _0x43d275=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x43d275['test'](_0x2694c3))throw new db[(_0x2685('0x6d'))][(_0x2685('0x6e'))](_0x2685('0x6f'));return;};exports['validatePasswordHistory']=function(_0x234afc,_0x1461cd,_0x37572f){var _0x2bc3b2=encryptor[_0x2685('0x70')](_0x1461cd)[_0x2685('0x71')](',');for(var _0x5da4d2=0x0;_0x5da4d2<_0x37572f;_0x5da4d2++){if(!_0x2bc3b2[_0x5da4d2])break;if(_0x234afc[_0x2685('0x72')]()===_0x2bc3b2[_0x5da4d2]['toLowerCase']()){var _0x3ef083=util[_0x2685('0x73')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x37572f);if(_0x37572f===0x1){_0x3ef083='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2685('0x6d'))][(_0x2685('0x6e'))](_0x3ef083);}}return;};exports[_0x2685('0x74')]=function(_0xe83708,_0x2845fc){var _0x3a48bb=_0x2845fc?encryptor[_0x2685('0x70')](_0x2845fc)['split'](','):[];if(_0x3a48bb['length']===0x5){_0x3a48bb['splice'](-0x1,0x1);}_0x3a48bb['unshift'](_0xe83708);return encryptor[_0x2685('0x75')](_0x3a48bb[_0x2685('0x76')](','));};function signJwt(_0x57bf3d){var _0x396dc5=BPromise[_0x2685('0x77')](jwt[_0x2685('0x78')],{'context':jwt});var _0x3950a2=_0x57bf3d[_0x2685('0x79')]||config[_0x2685('0x9')]['session'];return new BPromise(function(_0x4c66cb,_0x2a9710){_0x396dc5(_0x57bf3d['payload'],_0x3950a2,_0x57bf3d[_0x2685('0x7a')])['then'](function(_0x34d97a){_0x4c66cb(_0x34d97a);})[_0x2685('0x44')](function(_0x378fe2){_0x2a9710(_0x378fe2);});});}function verifyJwt(_0x183fae,_0x33f78e,_0x336428){var _0x1a8dd2=BPromise[_0x2685('0x77')](jwt[_0x2685('0x7b')],{'context':jwt});var _0x24e879=_0x336428||config[_0x2685('0x9')][_0x2685('0x7c')];return new BPromise(function(_0x281673,_0x2e4e72){_0x1a8dd2(_0x183fae,_0x24e879,_0x33f78e)[_0x2685('0x3e')](function(_0x59d887){_0x281673(_0x59d887);})[_0x2685('0x44')](function(_0x428290){_0x2e4e72(_0x428290);});});}function generateNonce(){return crypto[_0x2685('0x7d')](0x10)[_0x2685('0x7e')](_0x2685('0x7f'));}function generateIssuedAt(){return Math[_0x2685('0x80')](Date[_0x2685('0x81')]()/0x3e8)['toString']();}function createJwt(_0x22c100){var _0x3ed283={'payload':{'iat':_0x22c100[_0x2685('0x6a')],'nonce':_0x22c100[_0x2685('0x53')]},'options':{'algorithm':'HS512','subject':_0x22c100['id'][_0x2685('0x7e')](),'issuer':hardwareConf[_0x2685('0x4f')](),'audience':hardwareConf[_0x2685('0x4f')]()}};return signJwt(_0x3ed283)[_0x2685('0x3e')](function(_0x343f05){return{'iat':_0x22c100[_0x2685('0x6a')],'nonce':_0x22c100[_0x2685('0x53')],'token':_0x343f05};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 7ac580f..520ea6c 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 _0xfbfb=['filter','user','clause','tags','checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','describe','startsWith','cf_','map','findOne','slice','all','length','fieldType','type','catch','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseQueryParameters','where','fields'];(function(_0x18ba0d,_0x38941d){var _0x4ea85a=function(_0x2e0cc0){while(--_0x2e0cc0){_0x18ba0d['push'](_0x18ba0d['shift']());}};_0x4ea85a(++_0x38941d);}(_0xfbfb,0x116));var _0xbfbf=function(_0x4f7a4b,_0x5d759e){_0x4f7a4b=_0x4f7a4b-0x0;var _0x1cb979=_0xfbfb[_0x4f7a4b];return _0x1cb979;};'use strict';var _=require('lodash');var sqlUtils=require(_0xbfbf('0x0'));var db=require(_0xbfbf('0x1'))['db'];exports['findAll']=function(_0x28cf6c,_0x370eab,_0xbc04de,_0x366b5e){var _0x4a4ccf={'count':0x0,'rows':[]};var _0x52d17e=sqlUtils[_0xbfbf('0x2')](_0x370eab,_0x28cf6c);if(_0x52d17e){return Promise['resolve'](_0x4a4ccf);}var _0xa8b68a=sqlUtils[_0xbfbf('0x3')]();var _0x6335b1={};var _0x5b8694=![];var _0xbd8ea5=![];return Promise[_0xbfbf('0x4')]()[_0xbfbf('0x5')](function(){if(_0x28cf6c['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x28cf6c[_0xbfbf('0x6')],_0x366b5e);}else{return sqlUtils[_0xbfbf('0x7')](_0x28cf6c,_0x366b5e);}})['then'](function(_0x3bf39f){_0xa8b68a['where'](_0x3bf39f['default']);_0xa8b68a[_0xbfbf('0x8')](_0x3bf39f[_0xbfbf('0x9')]);_0xa8b68a[_0xbfbf('0x8')](_0x3bf39f[_0xbfbf('0xa')]);_0xa8b68a[_0xbfbf('0x8')](_0x3bf39f[_0xbfbf('0xb')][_0xbfbf('0xc')]);_0x6335b1=_0x3bf39f[_0xbfbf('0xd')];_0xbd8ea5=_0x3bf39f['user']['skip'];return sqlUtils[_0xbfbf('0xe')](_0x370eab,_0x28cf6c,_0xbd8ea5);})[_0xbfbf('0x5')](function(_0x304ec8){_0xa8b68a['where'](_0x304ec8);var _0x5d50e2=_0x28cf6c[_0xbfbf('0x6')]?_0x6335b1['ids']:_0x28cf6c[_0xbfbf('0xf')];_0x5b8694=_0x5d50e2?!![]:![];return sqlUtils[_0xbfbf('0x10')](_0xa8b68a,_0x5d50e2);})['then'](function(_0x248c8d){_0x4a4ccf[_0xbfbf('0x11')]=_0x248c8d;if(_0x4a4ccf['count']===0x0){return;}if(_0x28cf6c[_0xbfbf('0x12')]){_0xbd8ea5=!![];}return sqlUtils[_0xbfbf('0x13')](_0xa8b68a,_0x28cf6c[_0xbfbf('0x9')],_0xbc04de,_0x5b8694,_0x6335b1[_0xbfbf('0xc')],_0xbd8ea5);})[_0xbfbf('0x5')](function(_0x4c3c41){if(!_0x4c3c41){return[];}return sqlUtils[_0xbfbf('0x14')](_0x4c3c41,_0x28cf6c,_0xbc04de);})[_0xbfbf('0x5')](function(_0x3e6f98){_0x4a4ccf['rows']=_0x3e6f98;return _0x4a4ccf;})['catch'](function(_0x3d3271){throw _0x3d3271;});};exports[_0xbfbf('0x15')]=function(){var _0x50ffa9={};var _0xff1b5a=[];return db['CmContact']['describe']()['then'](function(_0x3d54ff){_0x50ffa9=_0x3d54ff;var _0x58677c=Object['keys'](_0x50ffa9)[_0xbfbf('0xa')](function(_0x640969){return _[_0xbfbf('0x16')](_0x640969,_0xbfbf('0x17'))?_0x640969:undefined;});var _0x50ddd5=_0x58677c[_0xbfbf('0x18')](function(_0x43e6ec){return db['CmCustomField'][_0xbfbf('0x19')]({'where':{'id':_0x43e6ec[_0xbfbf('0x1a')](0x3)},'raw':!![]});});return Promise[_0xbfbf('0x1b')](_0x50ddd5);})[_0xbfbf('0x5')](function(_0x12b51e){for(var _0x55ff9d=0x0;_0x55ff9d<_0x12b51e[_0xbfbf('0x1c')];_0x55ff9d++){if(_0x12b51e[_0x55ff9d]){var _0x3963e8=_0xbfbf('0x17')+_0x12b51e[_0x55ff9d]['id'];_0x50ffa9[_0x3963e8][_0xbfbf('0x1d')]=_0x12b51e[_0x55ff9d][_0xbfbf('0x1e')];}}_0xff1b5a=_[_0xbfbf('0x18')](Object['keys'](_0x50ffa9),function(_0x5b07b2){return{'name':_0x5b07b2,'type':_0x50ffa9[_0x5b07b2][_0xbfbf('0x1e')]};});return _0xff1b5a;})[_0xbfbf('0x1f')](function(_0x394969){throw _0x394969;});}; \ No newline at end of file +var _0x07e9=['lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','default','where','filter','user','clause','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','fields','getFilteredContacts','catch','describe','keys','startsWith','CmCustomField','all','length','map','type'];(function(_0x230d85,_0x44b12a){var _0x566458=function(_0x1a5aaa){while(--_0x1a5aaa){_0x230d85['push'](_0x230d85['shift']());}};_0x566458(++_0x44b12a);}(_0x07e9,0xcc));var _0x907e=function(_0x182d8c,_0x32c47c){_0x182d8c=_0x182d8c-0x0;var _0x58b4a3=_0x07e9[_0x182d8c];return _0x58b4a3;};'use strict';var _=require(_0x907e('0x0'));var sqlUtils=require(_0x907e('0x1'));var db=require(_0x907e('0x2'))['db'];exports[_0x907e('0x3')]=function(_0x4f7821,_0x3f7f3f,_0xd21c53,_0x343335){var _0x28bf7a={'count':0x0,'rows':[]};var _0x3aea5a=sqlUtils[_0x907e('0x4')](_0x3f7f3f,_0x4f7821);if(_0x3aea5a){return Promise[_0x907e('0x5')](_0x28bf7a);}var _0xeb62b0=sqlUtils[_0x907e('0x6')]();var _0x5be8cb={};var _0x3bf493=![];var _0x26ad68=![];return Promise[_0x907e('0x5')]()['then'](function(){if(_0x4f7821[_0x907e('0x7')]){return sqlUtils[_0x907e('0x8')](_0x4f7821[_0x907e('0x7')],_0x343335);}else{return sqlUtils[_0x907e('0x9')](_0x4f7821,_0x343335);}})[_0x907e('0xa')](function(_0x1d964a){_0xeb62b0['where'](_0x1d964a[_0x907e('0xb')]);_0xeb62b0[_0x907e('0xc')](_0x1d964a['fields']);_0xeb62b0[_0x907e('0xc')](_0x1d964a[_0x907e('0xd')]);_0xeb62b0[_0x907e('0xc')](_0x1d964a[_0x907e('0xe')][_0x907e('0xf')]);_0x5be8cb=_0x1d964a['tags'];_0x26ad68=_0x1d964a[_0x907e('0xe')][_0x907e('0x10')];return sqlUtils[_0x907e('0x11')](_0x3f7f3f,_0x4f7821,_0x26ad68);})[_0x907e('0xa')](function(_0x2a3954){_0xeb62b0[_0x907e('0xc')](_0x2a3954);var _0x293d31=_0x4f7821[_0x907e('0x7')]?_0x5be8cb[_0x907e('0x12')]:_0x4f7821[_0x907e('0x13')];_0x3bf493=_0x293d31?!![]:![];return sqlUtils[_0x907e('0x14')](_0xeb62b0,_0x293d31);})[_0x907e('0xa')](function(_0x5ed451){_0x28bf7a[_0x907e('0x15')]=_0x5ed451;if(_0x28bf7a[_0x907e('0x15')]===0x0){return;}if(_0x4f7821['User']){_0x26ad68=!![];}return sqlUtils[_0x907e('0x16')](_0xeb62b0,_0x4f7821[_0x907e('0x17')],_0xd21c53,_0x3bf493,_0x5be8cb[_0x907e('0xf')],_0x26ad68);})[_0x907e('0xa')](function(_0x3d052f){if(!_0x3d052f){return[];}return sqlUtils[_0x907e('0x18')](_0x3d052f,_0x4f7821,_0xd21c53);})[_0x907e('0xa')](function(_0x5ef8e0){_0x28bf7a['rows']=_0x5ef8e0;return _0x28bf7a;})[_0x907e('0x19')](function(_0x401071){throw _0x401071;});};exports[_0x907e('0x1a')]=function(){var _0x4a7c47={};var _0x3c25c3=[];return db['CmContact'][_0x907e('0x1a')]()[_0x907e('0xa')](function(_0x4dd2a0){_0x4a7c47=_0x4dd2a0;var _0x2baad6=Object[_0x907e('0x1b')](_0x4a7c47)[_0x907e('0xd')](function(_0x407606){return _[_0x907e('0x1c')](_0x407606,'cf_')?_0x407606:undefined;});var _0x5bd8c1=_0x2baad6['map'](function(_0x930d9){return db[_0x907e('0x1d')]['findOne']({'where':{'id':_0x930d9['slice'](0x3)},'raw':!![]});});return Promise[_0x907e('0x1e')](_0x5bd8c1);})[_0x907e('0xa')](function(_0x108de2){for(var _0x5ca2c1=0x0;_0x5ca2c1<_0x108de2[_0x907e('0x1f')];_0x5ca2c1++){if(_0x108de2[_0x5ca2c1]){var _0x480d33='cf_'+_0x108de2[_0x5ca2c1]['id'];_0x4a7c47[_0x480d33]['fieldType']=_0x108de2[_0x5ca2c1]['type'];}}_0x3c25c3=_[_0x907e('0x20')](Object[_0x907e('0x1b')](_0x4a7c47),function(_0x33e12b){return{'name':_0x33e12b,'type':_0x4a7c47[_0x33e12b][_0x907e('0x21')]};});return _0x3c25c3;})[_0x907e('0x19')](function(_0x1a2aa6){throw _0x1a2aa6;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 6c7ce32..455e42b 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 _0xdbaf=['limit','offset','subqry.id','order','DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','TagIds','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','query','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','autocomplete','true','from','cm_contacts','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','email','ListId','createdAt','deletedAt','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','buildExpression','type','default','value','end','Tag','split','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','concat','\x20=\x20?','resolve','then','fields','tag','getLists','c.ListId\x20IS\x20NULL','attributes','group'];(function(_0x530e45,_0x1b7670){var _0x266ade=function(_0x485236){while(--_0x485236){_0x530e45['push'](_0x530e45['shift']());}};_0x266ade(++_0x1b7670);}(_0xdbaf,0x1c2));var _0xfdba=function(_0x40d0cb,_0x21d091){_0x40d0cb=_0x40d0cb-0x0;var _0x54a504=_0xdbaf[_0x40d0cb];return _0x54a504;};'use strict';var _=require(_0xfdba('0x0'));var squel=require(_0xfdba('0x1'));var as=require(_0xfdba('0x2'));var qs=require(_0xfdba('0x3'));var utils=require(_0xfdba('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x14bced,_0x9859e6){var _0x364d78=![];if(_0x14bced[_0xfdba('0x5')]===_0xfdba('0x6')&&!_0x9859e6[_0xfdba('0x7')]&&!_0x9859e6['ListId']&&_0x9859e6[_0xfdba('0x8')]!==_0xfdba('0x9')){_0x364d78=!![];}return _0x364d78;}function getContactsSubquery(){return squel['select']()[_0xfdba('0xa')](_0xfdba('0xb'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x461cd4,_0x174def){var _0x2c1d53=_0x174def?'c':'subqry';_0x461cd4[_0xfdba('0xc')](_0xfdba('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x2c1d53+_0xfdba('0xe'))[_0xfdba('0xc')](_0xfdba('0xf'),'ct','ct.CmContactId\x20=\x20'+_0x2c1d53+_0xfdba('0xe'))[_0xfdba('0xc')](_0xfdba('0x10'),'t',_0xfdba('0x11'));return _0x461cd4;}function addFieldsToQuery(_0x17a5a7,_0x1256ce,_0x320d04,_0x4a65d7,_0x5b6aff){var _0x1c078b=_0x5b6aff?'c':_0xfdba('0x12');if(!_0x1256ce){_0x1256ce=['id',_0xfdba('0x13'),_0xfdba('0x14'),_0xfdba('0x15'),_0xfdba('0x16'),_0xfdba('0x17'),_0xfdba('0x18'),_0xfdba('0x19'),'CompanyId',_0xfdba('0x1a'),'updatedAt',_0xfdba('0x1b'),'TagIds'];}else if(!_0x1256ce[_0xfdba('0x1c')]('id')){_0x1256ce[_0xfdba('0x1d')]('id');}var _0x494f34=_0x320d04&&_0x5b6aff||!_0x320d04&&!_0x5b6aff;if(_0x4a65d7){_0x494f34=_0x4a65d7&&_0x5b6aff||!_0x4a65d7&&!_0x5b6aff;}_0x1256ce[_0xfdba('0x1e')](function(_0x56c39a){if(_0x56c39a==='TagIds'){if(_0x494f34){_0x17a5a7['field'](_0xfdba('0x1f'),_0x56c39a);}else if(_0x320d04||_0x4a65d7){_0x17a5a7['field'](_0x1c078b+'.'+_0x56c39a);}}else{_0x17a5a7[_0xfdba('0x20')](_0x1c078b+'.'+_0x56c39a);}});return _0x17a5a7;}function getSqlClauses(){var _0x3a1d0a={'default':squel['expr'](),'fields':squel[_0xfdba('0x21')](),'filter':squel[_0xfdba('0x21')](),'tags':{'clause':squel[_0xfdba('0x21')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x3a1d0a;}function parseTagParameter(_0x1641d){var _0x22c9c4=squel[_0xfdba('0x21')]();if(_0x1641d){var _0x5e5f65=utils[_0xfdba('0x22')](_0x1641d);_0x5e5f65['forEach'](function(_0x4ee53e){_0x22c9c4['or'](_0xfdba('0x23'),'%,'+_0x4ee53e+',%');});}return _0x22c9c4;}function parseSearchFilter(_0x49208b){var _0x2d0832=squel[_0xfdba('0x21')]();if(_0x49208b){var _0x2a4e4e=_0x49208b[_0xfdba('0x24')]('\x5c','\x5c\x5c')[_0xfdba('0x24')](/'/g,'\x27\x27');if(_0x2a4e4e['split']('\x20')[_0xfdba('0x25')]>0x1){_0x2d0832['or'](_0xfdba('0x26'),qs[_0xfdba('0x27')](_0x2a4e4e,!![]),null);}else{if(qs['isNumeric'](_0x2a4e4e)){_0x2d0832['or'](_0xfdba('0x28'),_0x2a4e4e+'%');_0x2d0832['or'](_0xfdba('0x29'),_0x2a4e4e+'%');_0x2d0832['or'](_0xfdba('0x2a'),_0x2a4e4e+'%');_0x2d0832['or'](_0xfdba('0x2b'),_0x2a4e4e+'%');}else if(qs[_0xfdba('0x2c')](_0x2a4e4e)){_0x2d0832['or'](_0xfdba('0x2d'),_0x2a4e4e+'%');}else{_0x2d0832['or'](_0xfdba('0x2e'),'%'+_0x2a4e4e+'%');_0x2d0832['or'](_0xfdba('0x2f'),'%'+_0x2a4e4e+'%');_0x2d0832['or'](_0xfdba('0x2d'),'%'+_0x2a4e4e+'%');}}}return _0x2d0832;}function parseAdvancedSearchFilter(_0x525e13,_0x1dc32c){var _0x2dadec=getSqlClauses();var _0x40c636=as[_0xfdba('0x30')](_0x525e13);var _0x5afa14=_0x40c636[_0xfdba('0x31')];for(var _0x3b9837=0x0;_0x3b9837<_0x40c636[_0xfdba('0x32')]['length'];_0x3b9837++){var _0x1c02a2=_0x40c636[_0xfdba('0x32')][_0x3b9837];var _0xab339c='c';var _0x33a256=_[_0xfdba('0x33')](_0x1dc32c,[_0xfdba('0x34'),_0x1c02a2[_0xfdba('0x20')]]);if(_0x33a256){if(_0x1c02a2[_0xfdba('0x20')]===_0xfdba('0x35')||_0x33a256[_0xfdba('0x36')]==='datetime'){_0x1c02a2[_0xfdba('0x37')]='DATE';}var _0xdd2b2d=as[_0xfdba('0x38')](_0xab339c,_0x33a256[_0xfdba('0x39')],_0x1c02a2);_0x2dadec[_0xfdba('0x3a')][_0x5afa14](_0xdd2b2d['text'],_0xdd2b2d[_0xfdba('0x3b')]['start'],_0xdd2b2d['value'][_0xfdba('0x3c')]);}else{if(_0x1c02a2[_0xfdba('0x20')]===_0xfdba('0x3d')){var _0xe39c87=_0x1c02a2[_0xfdba('0x3b')][_0xfdba('0x3e')](',')[_0xfdba('0x3f')](function(_0x3bf3b8){return Number(_0x3bf3b8);});var _0x2ac270=parseTagParameter(_0xe39c87);_0x2dadec[_0xfdba('0x40')][_0xfdba('0x41')][_0xfdba('0x42')](_0x2ac270);_0x2dadec['tags'][_0xfdba('0x43')]=_0xe39c87;}else if(_0x1c02a2[_0xfdba('0x20')]===_0xfdba('0x44')){_0x2dadec[_0xfdba('0x45')][_0xfdba('0x41')]['and'](_0xfdba('0x46'),_0x1c02a2[_0xfdba('0x3b')]);_0x2dadec[_0xfdba('0x45')][_0xfdba('0x47')]=!![];}}}return _0x2dadec;}function parseModelFields(_0x374a71,_0x6437e2){var _0x4b5502=squel[_0xfdba('0x21')]();var _0x329b2c=_(_0x374a71)[_0xfdba('0x48')]()[_0xfdba('0x3f')](function(_0x28e78b){return _[_0xfdba('0x49')](_0x6437e2,[_0xfdba('0x34'),_0x28e78b])?_0x28e78b:undefined;})['compact']()[_0xfdba('0x3b')]();if(_0x374a71[_0xfdba('0x4a')]){_0x329b2c['push'](_0xfdba('0x4a'));}if(_0x374a71[_0xfdba('0x44')]){_0x329b2c[_0xfdba('0x1d')](_0xfdba('0x44'));}if(_0x329b2c[_0xfdba('0x25')]>0x0){_0x329b2c[_0xfdba('0x1e')](function(_0x155f7e){if(_0x155f7e==='ListId'){_0x4b5502['and']('c.ListId\x20IN\x20?',[][_0xfdba('0x4b')](_0x374a71[_0x155f7e]));}else if(_0x155f7e===_0xfdba('0x4a')){var _0xdfcb92='%'+_0x374a71[_0x155f7e]+'%';_0x4b5502[_0xfdba('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0xdfcb92);}else if(_0x155f7e===_0xfdba('0x44')){_0x4b5502[_0xfdba('0x42')](_0xfdba('0x46'),_0x374a71[_0x155f7e]);}else{_0x4b5502['and']('c.'+_0x155f7e+_0xfdba('0x4c'),_0x374a71[_0x155f7e]);}});}return _0x4b5502;}function parseQueryParameters(_0x2cb91,_0x5d2313){var _0x4a033b=getSqlClauses();return Promise[_0xfdba('0x4d')]()[_0xfdba('0x4e')](function(){return parseModelFields(_0x2cb91,_0x5d2313);})['then'](function(_0x2c674e){_0x4a033b[_0xfdba('0x4f')][_0xfdba('0x42')](_0x2c674e);return parseTagParameter(_0x2cb91[_0xfdba('0x50')]);})[_0xfdba('0x4e')](function(_0x414c19){_0x4a033b[_0xfdba('0x40')][_0xfdba('0x41')][_0xfdba('0x42')](_0x414c19);return parseSearchFilter(_0x2cb91['filter']);})['then'](function(_0x2d4eba){_0x4a033b['filter']=_0x2d4eba;return _0x4a033b;});}function checkListsRestrictions(_0xc99f6,_0x49409b,_0x3b8b56){var _0x2a1995=squel[_0xfdba('0x21')]();return Promise[_0xfdba('0x4d')]()['then'](function(){if(_0x49409b['search']&&_0xc99f6[_0xfdba('0x5')]===_0xfdba('0x6')&&!_0x3b8b56){return _0xc99f6[_0xfdba('0x51')]({'attributes':['id'],'raw':!![]});}})[_0xfdba('0x4e')](function(_0x211469){if(_0x211469){if(_0x211469[_0xfdba('0x25')]===0x0){_0x2a1995[_0xfdba('0x42')](_0xfdba('0x52'));}else{_0x2a1995[_0xfdba('0x42')]('c.ListId\x20IN\x20?',_[_0xfdba('0x3f')](_0x211469,'id'));}}})['then'](function(){return _0x2a1995;});}function buildContactsQuery(_0x27105b,_0x43fa14,_0x15e06c,_0xe25528,_0x561e0a,_0x242fe7){if(_0x43fa14){_0x43fa14=_0x15e06c[_0xfdba('0x53')];}_0x27105b=addFieldsToQuery(_0x27105b,_0x43fa14,_0xe25528,_0x242fe7,!![]);var _0x5947ca=squel['select']();_0x5947ca=addFieldsToQuery(_0x5947ca,_0x43fa14,_0xe25528,_0x242fe7,![]);if(_0xe25528||_0x242fe7){_0x27105b=applyJoinClauses(_0x27105b,!![]);_0x27105b[_0xfdba('0x54')]('c.id');if(_0x15e06c['limit']){_0x5947ca[_0xfdba('0x55')](_0x15e06c[_0xfdba('0x55')]);}if(_0x15e06c[_0xfdba('0x56')]){_0x5947ca[_0xfdba('0x56')](_0x15e06c[_0xfdba('0x56')]);}}else{_0x5947ca=applyJoinClauses(_0x5947ca,![]);_0x5947ca['group'](_0xfdba('0x57'));if(_0x15e06c['limit']){_0x27105b['limit'](_0x15e06c[_0xfdba('0x55')]);}if(_0x15e06c[_0xfdba('0x56')]){_0x27105b[_0xfdba('0x56')](_0x15e06c[_0xfdba('0x56')]);}}_0x5947ca['having'](_0x561e0a);if(_0x15e06c[_0xfdba('0x58')]){_0x15e06c['order'][_0xfdba('0x1e')](function(_0xdbd1a7){_0x27105b[_0xfdba('0x58')]('c.'+_0xdbd1a7[0x0],_0xdbd1a7[0x1]===_0xfdba('0x59')?![]:!![]);_0x5947ca[_0xfdba('0x58')](_0xfdba('0x5a')+_0xdbd1a7[0x0],_0xdbd1a7[0x1]===_0xfdba('0x59')?![]:!![]);});}_0x5947ca['from'](_0x27105b,'subqry');return _0x5947ca;}function getFilteredContacts(_0x534cd0){var _0x4014f7=[];return db['Tag']['findAll']({'attributes':['id',_0xfdba('0x34'),_0xfdba('0x5b')],'raw':!![]})['then'](function(_0xb3d3b6){_0x4014f7=_[_0xfdba('0x5c')](_0xb3d3b6,'id');var _0x30a0ed={'type':db[_0xfdba('0x5d')][_0xfdba('0x5e')][_0xfdba('0x5f')],'model':db[_0xfdba('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xfdba('0x61')]['query'](_0x534cd0[_0xfdba('0x62')](),_0x30a0ed);})['then'](function(_0x5389d0){_0x5389d0[_0xfdba('0x1e')](function(_0x5b7b20){if(_0x5b7b20['TagIds']){_0x5b7b20[_0xfdba('0x63')]=[];_0x5b7b20[_0xfdba('0x64')][_0xfdba('0x3e')](',')[_0xfdba('0x1e')](function(_0x469a06){_0x5b7b20[_0xfdba('0x63')][_0xfdba('0x1d')](_0x4014f7[_0x469a06]);});}delete _0x5b7b20[_0xfdba('0x64')];});return _0x5389d0;});}function countFilteredContacts(_0x5a628b,_0x555e44){var _0xdd6393=_0x5a628b[_0xfdba('0x65')]();_0xdd6393[_0xfdba('0x20')](_0xfdba('0x66'));_0xdd6393=applyJoinClauses(_0xdd6393,!![]);_0x5a628b[_0xfdba('0x54')](_0xfdba('0x67'));var _0x54d367=utils[_0xfdba('0x22')](_0x555e44);if(!_[_0xfdba('0x68')](_0x54d367)){_0xdd6393['where'](_0xfdba('0x69'),_0x54d367);}var _0x3d8d6c={'type':db[_0xfdba('0x5d')]['QueryTypes'][_0xfdba('0x5f')],'raw':!![]};return db[_0xfdba('0x61')][_0xfdba('0x6a')](_0xdd6393[_0xfdba('0x62')](),_0x3d8d6c)[_0xfdba('0x4e')](function(_0x58bc99){return _0x58bc99[0x0][_0xfdba('0x66')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x1183=['subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','mobile','fax','email','CompanyId','updatedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','value','Tag','split','map','tags','clause','and','User','user','skip','some','compact','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','select','group','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','exports','squel','../parsers/qs','../../mysqldb','agent','search','ListId','autocomplete','true','from','where','c.deletedAt\x20IS\x20NULL'];(function(_0x2fd69e,_0xb96bc3){var _0x51770f=function(_0x41adf5){while(--_0x41adf5){_0x2fd69e['push'](_0x2fd69e['shift']());}};_0x51770f(++_0xb96bc3);}(_0x1183,0x127));var _0x3118=function(_0x35d291,_0x1a131b){_0x35d291=_0x35d291-0x0;var _0x370b86=_0x1183[_0x35d291];return _0x370b86;};'use strict';var _=require('lodash');var squel=require(_0x3118('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x3118('0x1'));var utils=require('../interaction/utils');var db=require(_0x3118('0x2'))['db'];function skipContactsQuery(_0x2ee7a9,_0x330617){var _0x528282=![];if(_0x2ee7a9['role']===_0x3118('0x3')&&!_0x330617[_0x3118('0x4')]&&!_0x330617[_0x3118('0x5')]&&_0x330617[_0x3118('0x6')]!==_0x3118('0x7')){_0x528282=!![];}return _0x528282;}function getContactsSubquery(){return squel['select']()[_0x3118('0x8')]('cm_contacts','c')[_0x3118('0x9')](_0x3118('0xa'));}function applyJoinClauses(_0x25a333,_0x143f02){var _0x378d05=_0x143f02?'c':_0x3118('0xb');_0x25a333[_0x3118('0xc')](_0x3118('0xd'),'uc',_0x3118('0xe')+_0x378d05+'.id')['left_join'](_0x3118('0xf'),'ct',_0x3118('0x10')+_0x378d05+_0x3118('0x11'))[_0x3118('0xc')](_0x3118('0x12'),'t',_0x3118('0x13'));return _0x25a333;}function addFieldsToQuery(_0x4ba31f,_0x53a31f,_0x10a302,_0x452825,_0x19e053){var _0x411c57=_0x19e053?'c':_0x3118('0xb');if(!_0x53a31f){_0x53a31f=['id',_0x3118('0x14'),'lastName','phone',_0x3118('0x15'),_0x3118('0x16'),_0x3118('0x17'),_0x3118('0x5'),_0x3118('0x18'),'createdAt',_0x3118('0x19'),'deletedAt',_0x3118('0x1a')];}else if(!_0x53a31f[_0x3118('0x1b')]('id')){_0x53a31f[_0x3118('0x1c')]('id');}var _0x3554b0=_0x10a302&&_0x19e053||!_0x10a302&&!_0x19e053;if(_0x452825){_0x3554b0=_0x452825&&_0x19e053||!_0x452825&&!_0x19e053;}_0x53a31f[_0x3118('0x1d')](function(_0x333c9a){if(_0x333c9a===_0x3118('0x1a')){if(_0x3554b0){_0x4ba31f[_0x3118('0x1e')](_0x3118('0x1f'),_0x333c9a);}else if(_0x10a302||_0x452825){_0x4ba31f[_0x3118('0x1e')](_0x411c57+'.'+_0x333c9a);}}else{_0x4ba31f[_0x3118('0x1e')](_0x411c57+'.'+_0x333c9a);}});return _0x4ba31f;}function getSqlClauses(){var _0x180377={'default':squel[_0x3118('0x20')](),'fields':squel[_0x3118('0x20')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x3118('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x180377;}function parseTagParameter(_0x58a024){var _0x26b0c5=squel[_0x3118('0x20')]();if(_0x58a024){var _0x4539a2=utils['getSelectedTags'](_0x58a024);_0x4539a2['forEach'](function(_0x168e24){_0x26b0c5['or'](_0x3118('0x21'),'%,'+_0x168e24+',%');});}return _0x26b0c5;}function parseSearchFilter(_0x5f3cbe){var _0x2bbc9b=squel[_0x3118('0x20')]();if(_0x5f3cbe){var _0x340db7=_0x5f3cbe['replace']('\x5c','\x5c\x5c')[_0x3118('0x22')](/'/g,'\x27\x27');if(_0x340db7['split']('\x20')[_0x3118('0x23')]>0x1){_0x2bbc9b['or'](_0x3118('0x24'),qs[_0x3118('0x25')](_0x340db7,!![]),null);}else{if(qs[_0x3118('0x26')](_0x340db7)){_0x2bbc9b['or'](_0x3118('0x27'),_0x340db7+'%');_0x2bbc9b['or']('c.phone\x20LIKE\x20?',_0x340db7+'%');_0x2bbc9b['or']('c.mobile\x20LIKE\x20?',_0x340db7+'%');_0x2bbc9b['or']('c.fax\x20LIKE\x20?',_0x340db7+'%');}else if(qs[_0x3118('0x28')](_0x340db7)){_0x2bbc9b['or'](_0x3118('0x29'),_0x340db7+'%');}else{_0x2bbc9b['or']('c.firstName\x20LIKE\x20?','%'+_0x340db7+'%');_0x2bbc9b['or'](_0x3118('0x2a'),'%'+_0x340db7+'%');_0x2bbc9b['or'](_0x3118('0x29'),'%'+_0x340db7+'%');}}}return _0x2bbc9b;}function parseAdvancedSearchFilter(_0x5e21d3,_0x415180){var _0x55960d=getSqlClauses();var _0x2a91b6=as[_0x3118('0x2b')](_0x5e21d3);var _0x8c873f=_0x2a91b6[_0x3118('0x2c')];for(var _0x590caa=0x0;_0x590caa<_0x2a91b6['conditions']['length'];_0x590caa++){var _0x1144ff=_0x2a91b6[_0x3118('0x2d')][_0x590caa];var _0x1ac03f='c';var _0xad1005=_[_0x3118('0x2e')](_0x415180,[_0x3118('0x2f'),_0x1144ff[_0x3118('0x1e')]]);if(_0xad1005){if(_0x1144ff[_0x3118('0x1e')]===_0x3118('0x30')||_0xad1005[_0x3118('0x31')]===_0x3118('0x32')){_0x1144ff['castTo']=_0x3118('0x33');}var _0x3f45bf=as[_0x3118('0x34')](_0x1ac03f,_0xad1005[_0x3118('0x35')],_0x1144ff);_0x55960d[_0x3118('0x36')][_0x8c873f](_0x3f45bf['text'],_0x3f45bf[_0x3118('0x37')]['start'],_0x3f45bf[_0x3118('0x37')]['end']);}else{if(_0x1144ff[_0x3118('0x1e')]===_0x3118('0x38')){var _0x399fa8=_0x1144ff[_0x3118('0x37')][_0x3118('0x39')](',')[_0x3118('0x3a')](function(_0x6c637){return Number(_0x6c637);});var _0x3f48b0=parseTagParameter(_0x399fa8);_0x55960d[_0x3118('0x3b')][_0x3118('0x3c')][_0x3118('0x3d')](_0x3f48b0);_0x55960d[_0x3118('0x3b')]['ids']=_0x399fa8;}else if(_0x1144ff[_0x3118('0x1e')]===_0x3118('0x3e')){_0x55960d[_0x3118('0x3f')][_0x3118('0x3c')][_0x3118('0x3d')]('uc.UserId\x20=\x20?',_0x1144ff[_0x3118('0x37')]);_0x55960d[_0x3118('0x3f')][_0x3118('0x40')]=!![];}}}return _0x55960d;}function parseModelFields(_0x56c518,_0x55f4b4){var _0x5d4432=squel[_0x3118('0x20')]();var _0x4e1c47=_(_0x56c518)['keys']()[_0x3118('0x3a')](function(_0x37405c){return _[_0x3118('0x41')](_0x55f4b4,[_0x3118('0x2f'),_0x37405c])?_0x37405c:undefined;})[_0x3118('0x42')]()[_0x3118('0x37')]();if(_0x56c518[_0x3118('0x43')]){_0x4e1c47[_0x3118('0x1c')]('Contact');}if(_0x56c518['User']){_0x4e1c47[_0x3118('0x1c')](_0x3118('0x3e'));}if(_0x4e1c47[_0x3118('0x23')]>0x0){_0x4e1c47[_0x3118('0x1d')](function(_0x4b4e78){if(_0x4b4e78===_0x3118('0x5')){_0x5d4432[_0x3118('0x3d')]('c.ListId\x20IN\x20?',[]['concat'](_0x56c518[_0x4b4e78]));}else if(_0x4b4e78===_0x3118('0x43')){var _0x3f8249='%'+_0x56c518[_0x4b4e78]+'%';_0x5d4432[_0x3118('0x3d')](_0x3118('0x44'),_0x3f8249);}else if(_0x4b4e78===_0x3118('0x3e')){_0x5d4432[_0x3118('0x3d')]('uc.UserId\x20=\x20?',_0x56c518[_0x4b4e78]);}else{_0x5d4432[_0x3118('0x3d')]('c.'+_0x4b4e78+'\x20=\x20?',_0x56c518[_0x4b4e78]);}});}return _0x5d4432;}function parseQueryParameters(_0x365cfe,_0x35be3d){var _0x220cef=getSqlClauses();return Promise[_0x3118('0x45')]()[_0x3118('0x46')](function(){return parseModelFields(_0x365cfe,_0x35be3d);})[_0x3118('0x46')](function(_0x3271d2){_0x220cef[_0x3118('0x47')]['and'](_0x3271d2);return parseTagParameter(_0x365cfe[_0x3118('0x48')]);})['then'](function(_0x15c2f7){_0x220cef[_0x3118('0x3b')]['clause']['and'](_0x15c2f7);return parseSearchFilter(_0x365cfe[_0x3118('0x49')]);})[_0x3118('0x46')](function(_0x3bfd7e){_0x220cef['filter']=_0x3bfd7e;return _0x220cef;});}function checkListsRestrictions(_0x37acde,_0x4e94ba,_0x5b417d){var _0x7e129b=squel[_0x3118('0x20')]();return Promise['resolve']()[_0x3118('0x46')](function(){if(_0x4e94ba[_0x3118('0x4')]&&_0x37acde[_0x3118('0x4a')]===_0x3118('0x3')&&!_0x5b417d){return _0x37acde[_0x3118('0x4b')]({'attributes':['id'],'raw':!![]});}})[_0x3118('0x46')](function(_0x539740){if(_0x539740){if(_0x539740[_0x3118('0x23')]===0x0){_0x7e129b[_0x3118('0x3d')](_0x3118('0x4c'));}else{_0x7e129b[_0x3118('0x3d')](_0x3118('0x4d'),_[_0x3118('0x3a')](_0x539740,'id'));}}})['then'](function(){return _0x7e129b;});}function buildContactsQuery(_0x4032c2,_0x26bd24,_0x516759,_0x249d28,_0x99a39d,_0x50f058){if(_0x26bd24){_0x26bd24=_0x516759['attributes'];}_0x4032c2=addFieldsToQuery(_0x4032c2,_0x26bd24,_0x249d28,_0x50f058,!![]);var _0x1f85a1=squel[_0x3118('0x4e')]();_0x1f85a1=addFieldsToQuery(_0x1f85a1,_0x26bd24,_0x249d28,_0x50f058,![]);if(_0x249d28||_0x50f058){_0x4032c2=applyJoinClauses(_0x4032c2,!![]);_0x4032c2[_0x3118('0x4f')]('c.id');if(_0x516759[_0x3118('0x50')]){_0x1f85a1[_0x3118('0x50')](_0x516759[_0x3118('0x50')]);}if(_0x516759[_0x3118('0x51')]){_0x1f85a1[_0x3118('0x51')](_0x516759[_0x3118('0x51')]);}}else{_0x1f85a1=applyJoinClauses(_0x1f85a1,![]);_0x1f85a1[_0x3118('0x4f')](_0x3118('0x52'));if(_0x516759[_0x3118('0x50')]){_0x4032c2[_0x3118('0x50')](_0x516759[_0x3118('0x50')]);}if(_0x516759[_0x3118('0x51')]){_0x4032c2[_0x3118('0x51')](_0x516759[_0x3118('0x51')]);}}_0x1f85a1[_0x3118('0x53')](_0x99a39d);if(_0x516759[_0x3118('0x54')]){_0x516759[_0x3118('0x54')]['forEach'](function(_0x3c6b4f){_0x4032c2[_0x3118('0x54')]('c.'+_0x3c6b4f[0x0],_0x3c6b4f[0x1]===_0x3118('0x55')?![]:!![]);_0x1f85a1[_0x3118('0x54')](_0x3118('0x56')+_0x3c6b4f[0x0],_0x3c6b4f[0x1]===_0x3118('0x55')?![]:!![]);});}_0x1f85a1[_0x3118('0x8')](_0x4032c2,_0x3118('0xb'));return _0x1f85a1;}function getFilteredContacts(_0x5a28){var _0x1f4cf5=[];return db[_0x3118('0x38')][_0x3118('0x57')]({'attributes':['id','name',_0x3118('0x58')],'raw':!![]})[_0x3118('0x46')](function(_0x5600f3){_0x1f4cf5=_[_0x3118('0x59')](_0x5600f3,'id');var _0x5a7522={'type':db[_0x3118('0x5a')]['QueryTypes'][_0x3118('0x5b')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x3118('0x5c')][_0x3118('0x5d')](_0x5a28[_0x3118('0x5e')](),_0x5a7522);})[_0x3118('0x46')](function(_0x40fa25){_0x40fa25['forEach'](function(_0x5f0b13){if(_0x5f0b13[_0x3118('0x1a')]){_0x5f0b13[_0x3118('0x5f')]=[];_0x5f0b13[_0x3118('0x1a')]['split'](',')[_0x3118('0x1d')](function(_0x1e7943){_0x5f0b13[_0x3118('0x5f')][_0x3118('0x1c')](_0x1f4cf5[_0x1e7943]);});}delete _0x5f0b13['TagIds'];});return _0x40fa25;});}function countFilteredContacts(_0x785fa4,_0x214857){var _0x331882=_0x785fa4[_0x3118('0x60')]();_0x331882[_0x3118('0x1e')](_0x3118('0x61'));_0x331882=applyJoinClauses(_0x331882,!![]);_0x785fa4[_0x3118('0x4f')](_0x3118('0x62'));var _0x421a2d=utils[_0x3118('0x63')](_0x214857);if(!_[_0x3118('0x64')](_0x421a2d)){_0x331882['where']('t.id\x20IN\x20?',_0x421a2d);}var _0x187a20={'type':db[_0x3118('0x5a')]['QueryTypes'][_0x3118('0x5b')],'raw':!![]};return db['sequelize']['query'](_0x331882[_0x3118('0x5e')](),_0x187a20)[_0x3118('0x46')](function(_0x348d6d){return _0x348d6d[0x0][_0x3118('0x61')];});}module[_0x3118('0x65')]={'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 59b6143..a7bb785 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 _0xb18d=['getCiphers','filter','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','final','end','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x156627,_0x27ec9a){var _0x174ce9=function(_0x12b9c2){while(--_0x12b9c2){_0x156627['push'](_0x156627['shift']());}};_0x174ce9(++_0x27ec9a);}(_0xb18d,0x1b9));var _0xdb18=function(_0x2a60ae,_0x2f523f){_0x2a60ae=_0x2a60ae-0x0;var _0x3b5161=_0xb18d[_0x2a60ae];return _0x3b5161;};'use strict';var crypto=require(_0xdb18('0x0'));var fs=require('fs');var BPromise=require(_0xdb18('0x1'));var _=require(_0xdb18('0x2'));var config=require('../../config/environment');var logger=require(_0xdb18('0x3'))(_0xdb18('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xdb18('0x5')][_0xdb18('0x6')],'algorithm':_0xdb18('0x7')};const fileOptions={'algorithm':_0xdb18('0x8')};if(config['encrypt']&&config[_0xdb18('0x9')][_0xdb18('0xa')]){var isSupported=isAlgorithmSupported(config[_0xdb18('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xdb18('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xdb18('0xb')](',\x20');logger[_0xdb18('0xc')](config['encrypt'][_0xdb18('0xa')],_0xdb18('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x18c8ee){return AES_SUPPORTED_RX['test'](_0x18c8ee);}function getSupportedCiphers(){return crypto[_0xdb18('0xe')]()[_0xdb18('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xdade7b){return getSupportedCiphers()[_0xdb18('0x10')](_0xdade7b)>-0x1;}function combineOptions(_0x1530ab){var _0x38e4bc={};for(var _0x404e3b in fileOptions){if(fileOptions['hasOwnProperty'](_0x404e3b)){_0x38e4bc[_0x404e3b]=fileOptions[_0x404e3b];}}if(_0x1530ab){for(var _0x4c5aaf in _0x1530ab){if(_0x1530ab['hasOwnProperty'](_0x4c5aaf)){_0x38e4bc[_0x4c5aaf]=_0x1530ab[_0x4c5aaf];}}}return _0x38e4bc;}exports[_0xdb18('0x11')]=function(_0x5df086,_0x43fa78,_0x25092e,_0x20744f){return new BPromise(function(_0x4f11e8,_0x25948c){_0x20744f=combineOptions(_0x20744f);var _0x3fb4d7=new Buffer(_0x25092e);var _0x45d397=fs[_0xdb18('0x12')](_0x5df086);var _0x39ca38=fs[_0xdb18('0x13')](_0x43fa78);var _0x55c954=crypto[_0xdb18('0x14')](_0x20744f[_0xdb18('0xa')],_0x3fb4d7);_0x45d397['on'](_0xdb18('0x15'),function(_0x157d29){var _0x1108e6=new Buffer(_0x55c954[_0xdb18('0x16')](_0x157d29),_0xdb18('0x17'));_0x39ca38[_0xdb18('0x18')](_0x1108e6);});_0x45d397['on']('end',function(){try{var _0x56b25e=new Buffer(_0x55c954[_0xdb18('0x19')]('binary'),_0xdb18('0x17'));_0x39ca38[_0xdb18('0x18')](_0x56b25e);_0x39ca38[_0xdb18('0x1a')]();_0x39ca38['on'](_0xdb18('0x1b'),function(){return _0x4f11e8(_0x43fa78);});}catch(_0x47fb11){fs[_0xdb18('0x1c')](_0x43fa78);return _0x25948c(_0x47fb11);}});});};exports[_0xdb18('0x1d')]=function(_0x2830ed,_0x4a5d90,_0x522149,_0x15e604){return new BPromise(function(_0x1825a4,_0x4f6cf4){_0x15e604=combineOptions(_0x15e604);var _0x40c329=new Buffer(_0x522149);var _0x5d6615=fs['createReadStream'](_0x2830ed);var _0x43d473=fs[_0xdb18('0x13')](_0x4a5d90);var _0x4fdc41=crypto[_0xdb18('0x1e')](_0x15e604[_0xdb18('0xa')],_0x40c329);_0x5d6615['on']('data',function(_0x51b562){var _0x35c94a=new Buffer(_0x4fdc41[_0xdb18('0x16')](_0x51b562),_0xdb18('0x17'));_0x43d473[_0xdb18('0x18')](_0x35c94a);});_0x5d6615['on']('end',function(){try{var _0x19265d=new Buffer(_0x4fdc41[_0xdb18('0x19')](_0xdb18('0x17')),_0xdb18('0x17'));_0x43d473[_0xdb18('0x18')](_0x19265d);_0x43d473[_0xdb18('0x1a')]();_0x43d473['on'](_0xdb18('0x1b'),function(){return _0x1825a4(_0x4a5d90);});}catch(_0x2009b6){fs['unlink'](_0x4a5d90);return _0x4f6cf4(_0x2009b6);}});});};exports[_0xdb18('0x1f')]=function(_0x158dbb,_0x12378f,_0x3b8b85){var _0x46eaa6=_0x3b8b85||stringOptions[_0xdb18('0xa')];var _0x185866=_0x12378f||stringOptions[_0xdb18('0x20')];var _0x2eef00=crypto[_0xdb18('0x14')](_0x46eaa6,_0x185866);var _0x134f15=_0x2eef00[_0xdb18('0x16')](_0x158dbb,_0xdb18('0x21'),_0xdb18('0x22'));_0x134f15+=_0x2eef00[_0xdb18('0x19')]('base64');return _0x134f15;};exports['decryptString']=function(_0x45c438,_0x43f8ee,_0x26d675){var _0x1711e7=_0x26d675||stringOptions[_0xdb18('0xa')];var _0x4f6a39=_0x43f8ee||stringOptions['secret'];var _0x4a2264=crypto[_0xdb18('0x1e')](_0x1711e7,_0x4f6a39);var _0x45b5f3=_0x4a2264[_0xdb18('0x16')](_0x45c438,_0xdb18('0x22'),_0xdb18('0x21'));_0x45b5f3+=_0x4a2264[_0xdb18('0x19')](_0xdb18('0x21'));return _0x45b5f3;}; \ No newline at end of file +var _0xbf5f=['update','binary','write','end','final','close','unlink','decryptFile','createReadStream','createDecipher','encryptString','createCipher','base64','secret','utf8','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data'];(function(_0x9e1c1a,_0x329c91){var _0x4ae1a1=function(_0x1a2006){while(--_0x1a2006){_0x9e1c1a['push'](_0x9e1c1a['shift']());}};_0x4ae1a1(++_0x329c91);}(_0xbf5f,0x19b));var _0xfbf5=function(_0x24a0c9,_0x4fd67e){_0x24a0c9=_0x24a0c9-0x0;var _0x2902a8=_0xbf5f[_0x24a0c9];return _0x2902a8;};'use strict';var crypto=require(_0xfbf5('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xfbf5('0x1'));var config=require(_0xfbf5('0x2'));var logger=require(_0xfbf5('0x3'))(_0xfbf5('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xfbf5('0x5')][_0xfbf5('0x6')],'algorithm':_0xfbf5('0x7')};const fileOptions={'algorithm':_0xfbf5('0x8')};if(config['encrypt']&&config[_0xfbf5('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xfbf5('0x9')][_0xfbf5('0xa')]);if(isSupported){fileOptions[_0xfbf5('0xa')]=config[_0xfbf5('0x9')][_0xfbf5('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xfbf5('0xb')](',\x20');logger[_0xfbf5('0xc')](config[_0xfbf5('0x9')]['algorithm'],_0xfbf5('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x10e900){return AES_SUPPORTED_RX[_0xfbf5('0xe')](_0x10e900);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xfbf5('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x13f022){return getSupportedCiphers()[_0xfbf5('0x10')](_0x13f022)>-0x1;}function combineOptions(_0x5af634){var _0x3ddb77={};for(var _0x5926c4 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5926c4)){_0x3ddb77[_0x5926c4]=fileOptions[_0x5926c4];}}if(_0x5af634){for(var _0x2b1509 in _0x5af634){if(_0x5af634[_0xfbf5('0x11')](_0x2b1509)){_0x3ddb77[_0x2b1509]=_0x5af634[_0x2b1509];}}}return _0x3ddb77;}exports[_0xfbf5('0x12')]=function(_0x511563,_0x370440,_0x36c644,_0x388887){return new BPromise(function(_0x1666c2,_0x44a12c){_0x388887=combineOptions(_0x388887);var _0x111de3=new Buffer(_0x36c644);var _0x5604c4=fs['createReadStream'](_0x511563);var _0x1305b5=fs[_0xfbf5('0x13')](_0x370440);var _0x54f0e9=crypto['createCipher'](_0x388887[_0xfbf5('0xa')],_0x111de3);_0x5604c4['on'](_0xfbf5('0x14'),function(_0x366919){var _0x5402ae=new Buffer(_0x54f0e9[_0xfbf5('0x15')](_0x366919),_0xfbf5('0x16'));_0x1305b5[_0xfbf5('0x17')](_0x5402ae);});_0x5604c4['on'](_0xfbf5('0x18'),function(){try{var _0x13f185=new Buffer(_0x54f0e9[_0xfbf5('0x19')]('binary'),_0xfbf5('0x16'));_0x1305b5[_0xfbf5('0x17')](_0x13f185);_0x1305b5[_0xfbf5('0x18')]();_0x1305b5['on'](_0xfbf5('0x1a'),function(){return _0x1666c2(_0x370440);});}catch(_0x40ce8e){fs[_0xfbf5('0x1b')](_0x370440);return _0x44a12c(_0x40ce8e);}});});};exports[_0xfbf5('0x1c')]=function(_0x3c3cc0,_0x3050f3,_0x41bb,_0x444ace){return new BPromise(function(_0x5f298c,_0x323ad8){_0x444ace=combineOptions(_0x444ace);var _0x118429=new Buffer(_0x41bb);var _0xbd00de=fs[_0xfbf5('0x1d')](_0x3c3cc0);var _0x12a570=fs[_0xfbf5('0x13')](_0x3050f3);var _0x2f0073=crypto[_0xfbf5('0x1e')](_0x444ace[_0xfbf5('0xa')],_0x118429);_0xbd00de['on'](_0xfbf5('0x14'),function(_0x2f5c1e){var _0x14f86d=new Buffer(_0x2f0073[_0xfbf5('0x15')](_0x2f5c1e),_0xfbf5('0x16'));_0x12a570['write'](_0x14f86d);});_0xbd00de['on']('end',function(){try{var _0x51d897=new Buffer(_0x2f0073[_0xfbf5('0x19')]('binary'),_0xfbf5('0x16'));_0x12a570[_0xfbf5('0x17')](_0x51d897);_0x12a570[_0xfbf5('0x18')]();_0x12a570['on'](_0xfbf5('0x1a'),function(){return _0x5f298c(_0x3050f3);});}catch(_0x1cd6a3){fs[_0xfbf5('0x1b')](_0x3050f3);return _0x323ad8(_0x1cd6a3);}});});};exports[_0xfbf5('0x1f')]=function(_0x5bfe24,_0x447ea1,_0x3ecc48){var _0xdf0e84=_0x3ecc48||stringOptions[_0xfbf5('0xa')];var _0x903377=_0x447ea1||stringOptions['secret'];var _0x403706=crypto[_0xfbf5('0x20')](_0xdf0e84,_0x903377);var _0x3f825b=_0x403706[_0xfbf5('0x15')](_0x5bfe24,'utf8',_0xfbf5('0x21'));_0x3f825b+=_0x403706[_0xfbf5('0x19')]('base64');return _0x3f825b;};exports['decryptString']=function(_0x59aae4,_0x3130cc,_0x377c94){var _0xd0d669=_0x377c94||stringOptions[_0xfbf5('0xa')];var _0x4c249f=_0x3130cc||stringOptions[_0xfbf5('0x22')];var _0x602bdb=crypto[_0xfbf5('0x1e')](_0xd0d669,_0x4c249f);var _0x4ae725=_0x602bdb[_0xfbf5('0x15')](_0x59aae4,_0xfbf5('0x21'),_0xfbf5('0x23'));_0x4ae725+=_0x602bdb[_0xfbf5('0x19')](_0xfbf5('0x23'));return _0x4ae725;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0fa982a..21c7f6c 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 _0x8c58=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','query','format','SELECT','num','Empty','isInteger','forEach','push'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x8c58,0x135));var _0x88c5=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x8c58[_0x24259d];return _0x5a701;};'use strict';var util=require(_0x88c5('0x0'));var path=require(_0x88c5('0x1'));var _=require(_0x88c5('0x2'));var csv=require(_0x88c5('0x3'));var fs=require('fs');var BPromise=require(_0x88c5('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x88c5('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x88c5('0x6')];var logger=require(_0x88c5('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x88c5('0x8')][0x2]);var QUERY=process[_0x88c5('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c7a7c,_0x3fea90){var _0x340777={'status':_0x4c7a7c};var _0x33ddb9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3fea90){_0x340777[_0x88c5('0x9')]=_0x3fea90;}return db[_0x88c5('0xa')][_0x88c5('0xb')](_0x340777,_0x33ddb9);}function main(){var _0xc7c296=0x1388;var _0x5a65df;logger['info'](util['format'](_0x88c5('0xc'),EXTRACTED_REPORT_ID,_0x88c5('0xd')));return db[_0x88c5('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x88c5('0xf'),'splitSizeCsv']})[_0x88c5('0x10')](function(_0x143699){if(_0x143699){_0x5a65df=_0x143699;_0xc7c296=_0x5a65df[_0x88c5('0x11')]||0x1388;}})[_0x88c5('0x10')](function(){return dbH[_0x88c5('0x12')][_0x88c5('0x13')](util[_0x88c5('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x88c5('0x12')]['QueryTypes'][_0x88c5('0x15')]});})[_0x88c5('0x10')](function(_0x14765a){if(!_0x14765a[0x0][_0x88c5('0x16')]){return analyticExtractedReport(_0x88c5('0x17'));}var _0x39e312=[];var _0x39a159=0x0;if(_0x5a65df['split']){if(_0x14765a&&_0x14765a['length']){var _0x4a5609=_['range'](_0x14765a[0x0][_0x88c5('0x16')]/_0xc7c296);var _0x58a29b=Number[_0x88c5('0x18')](_0x14765a[0x0][_0x88c5('0x16')]/_0xc7c296)?_0x14765a[0x0]['num']%_0xc7c296:0x0;_0x4a5609[_0x88c5('0x19')](function(_0x22f1eb){if(_0x22f1eb>0x0){_0x39a159+=_0xc7c296;}_0x39e312[_0x88c5('0x1a')](dbH[_0x88c5('0x12')][_0x88c5('0x13')](util[_0x88c5('0x14')](_0x88c5('0x1b'),QUERY,_0xc7c296,_0x39a159),{'type':dbH[_0x88c5('0x12')]['QueryTypes'][_0x88c5('0x15')]}));});if(_0x58a29b>0x0){_0x39a159+=_0xc7c296;_0x39e312[_0x88c5('0x1a')](dbH['sequelize'][_0x88c5('0x13')](util[_0x88c5('0x14')](_0x88c5('0x1b'),QUERY,_0x58a29b,_0x39a159),{'type':dbH[_0x88c5('0x12')][_0x88c5('0x1c')][_0x88c5('0x15')]}));}}}else{_0x39e312['push'](dbH[_0x88c5('0x12')][_0x88c5('0x13')](QUERY,{'type':dbH[_0x88c5('0x12')][_0x88c5('0x1c')][_0x88c5('0x15')]}));}var _0x442764=path[_0x88c5('0x1d')](PATH);var _0x109841=path[_0x88c5('0x1e')](PATH,_0x88c5('0x1f'));var _0x416484=_0x5a65df['split']&&_0x39e312[_0x88c5('0x20')]>0x1;var _0x37d438=[];if(!fs['existsSync'](path['join'](_0x442764,_0x109841))&&_0x416484){fs[_0x88c5('0x21')](path[_0x88c5('0x22')](_0x442764,_0x109841));}return BPromise[_0x88c5('0x23')](_0x39e312,function(_0x36d378){_0x37d438['push'](_0x36d378);})[_0x88c5('0x10')](function(){for(var _0x586d66=0x0;_0x586d66<_0x37d438[_0x88c5('0x20')];_0x586d66+=0x1){var _0x22bc88;var _0x2116b8=_0x37d438[_0x586d66];if(_0x416484){_0x22bc88=path['join'](_0x442764,_0x109841,util[_0x88c5('0x14')]('%s%d.%s',_0x109841,_0x586d66,_0x88c5('0x24')));}else{_0x22bc88=path['join'](_0x442764,util[_0x88c5('0x14')](_0x88c5('0x25'),_0x109841,_0x88c5('0x24')));}fs[_0x88c5('0x26')](_0x22bc88,csv(_0x2116b8));}})[_0x88c5('0x10')](function(){if(_0x416484){return new Promise(function(_0x26bb1f){zipdir(path[_0x88c5('0x22')](_0x442764,_0x109841),{'saveTo':path[_0x88c5('0x22')](_0x442764,util[_0x88c5('0x14')](_0x88c5('0x25'),_0x109841,_0x88c5('0x27')))},function(_0x5c0742,_0x391dd7){rimraf(path[_0x88c5('0x22')](_0x442764,_0x109841),function(){});_0x26bb1f(_0x88c5('0x28'));});});}})[_0x88c5('0x10')](function(){logger[_0x88c5('0x29')](util['format'](_0x88c5('0x2a'),EXTRACTED_REPORT_ID,_0x88c5('0xd')));return analyticExtractedReport('Completed',_0x416484?util[_0x88c5('0x14')](_0x88c5('0x25'),_0x109841,_0x416484?_0x88c5('0x27'):_0x88c5('0x24')):null);});})[_0x88c5('0x2b')](function(_0x16da8f){logger[_0x88c5('0x29')](util[_0x88c5('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x88c5('0xd')),util[_0x88c5('0x2c')](_0x16da8f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x88c5('0x2d'));})[_0x88c5('0x2e')](function(){process[_0x88c5('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0660=['length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','split','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','inspect','Failed','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0660,0x1bd));var _0x0066=function(_0x284a10,_0x302410){_0x284a10=_0x284a10-0x0;var _0x33557a=_0x0660[_0x284a10];return _0x33557a;};'use strict';var util=require(_0x0066('0x0'));var path=require(_0x0066('0x1'));var _=require(_0x0066('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0066('0x3'));var rimraf=require(_0x0066('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0066('0x5'))[_0x0066('0x6')];var logger=require(_0x0066('0x7'))(_0x0066('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0066('0x9')][0x2]);var QUERY=process[_0x0066('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3c1a03,_0x21de20){var _0x1acc73={'status':_0x3c1a03};var _0x35983d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x21de20){_0x1acc73['savename']=_0x21de20;}return db[_0x0066('0xa')][_0x0066('0xb')](_0x1acc73,_0x35983d);}function main(){var _0x6647a9=0x1388;var _0x41f4e9;logger[_0x0066('0xc')](util[_0x0066('0xd')](_0x0066('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x0066('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x0066('0x10')](function(_0x499c13){if(_0x499c13){_0x41f4e9=_0x499c13;_0x6647a9=_0x41f4e9[_0x0066('0x11')]||0x1388;}})['then'](function(){return dbH[_0x0066('0x12')][_0x0066('0x13')](util[_0x0066('0xd')](_0x0066('0x14'),QUERY),{'type':dbH['sequelize'][_0x0066('0x15')][_0x0066('0x16')]});})[_0x0066('0x10')](function(_0x584ac7){if(!_0x584ac7[0x0][_0x0066('0x17')]){return analyticExtractedReport(_0x0066('0x18'));}var _0x14dde4=[];var _0xed4c53=0x0;if(_0x41f4e9['split']){if(_0x584ac7&&_0x584ac7[_0x0066('0x19')]){var _0x290b94=_[_0x0066('0x1a')](_0x584ac7[0x0][_0x0066('0x17')]/_0x6647a9);var _0x1c5c93=Number[_0x0066('0x1b')](_0x584ac7[0x0]['num']/_0x6647a9)?_0x584ac7[0x0][_0x0066('0x17')]%_0x6647a9:0x0;_0x290b94[_0x0066('0x1c')](function(_0x4e86bc){if(_0x4e86bc>0x0){_0xed4c53+=_0x6647a9;}_0x14dde4[_0x0066('0x1d')](dbH[_0x0066('0x12')][_0x0066('0x13')](util[_0x0066('0xd')](_0x0066('0x1e'),QUERY,_0x6647a9,_0xed4c53),{'type':dbH[_0x0066('0x12')][_0x0066('0x15')][_0x0066('0x16')]}));});if(_0x1c5c93>0x0){_0xed4c53+=_0x6647a9;_0x14dde4[_0x0066('0x1d')](dbH['sequelize'][_0x0066('0x13')](util[_0x0066('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c5c93,_0xed4c53),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x14dde4[_0x0066('0x1d')](dbH[_0x0066('0x12')][_0x0066('0x13')](QUERY,{'type':dbH[_0x0066('0x12')][_0x0066('0x15')][_0x0066('0x16')]}));}var _0x18d8ac=path['dirname'](PATH);var _0x4315bf=path[_0x0066('0x1f')](PATH,_0x0066('0x20'));var _0x5ba9ec=_0x41f4e9[_0x0066('0x21')]&&_0x14dde4['length']>0x1;var _0xebaf36=[];if(!fs['existsSync'](path[_0x0066('0x22')](_0x18d8ac,_0x4315bf))&&_0x5ba9ec){fs['mkdirSync'](path[_0x0066('0x22')](_0x18d8ac,_0x4315bf));}return BPromise[_0x0066('0x23')](_0x14dde4,function(_0x2b69d9){_0xebaf36[_0x0066('0x1d')](_0x2b69d9);})[_0x0066('0x10')](function(){for(var _0xb7b220=0x0;_0xb7b220<_0xebaf36[_0x0066('0x19')];_0xb7b220+=0x1){var _0x10b3ef;var _0xc325d2=_0xebaf36[_0xb7b220];if(_0x5ba9ec){_0x10b3ef=path[_0x0066('0x22')](_0x18d8ac,_0x4315bf,util['format'](_0x0066('0x24'),_0x4315bf,_0xb7b220,_0x0066('0x25')));}else{_0x10b3ef=path['join'](_0x18d8ac,util[_0x0066('0xd')](_0x0066('0x26'),_0x4315bf,_0x0066('0x25')));}fs[_0x0066('0x27')](_0x10b3ef,csv(_0xc325d2));}})[_0x0066('0x10')](function(){if(_0x5ba9ec){return new Promise(function(_0x530b9b){zipdir(path[_0x0066('0x22')](_0x18d8ac,_0x4315bf),{'saveTo':path[_0x0066('0x22')](_0x18d8ac,util[_0x0066('0xd')](_0x0066('0x26'),_0x4315bf,_0x0066('0x28')))},function(_0x33f123,_0x25c2c2){rimraf(path[_0x0066('0x22')](_0x18d8ac,_0x4315bf),function(){});_0x530b9b('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0x0066('0xd')](_0x0066('0x29'),EXTRACTED_REPORT_ID,_0x0066('0x2a')));return analyticExtractedReport('Completed',_0x5ba9ec?util['format'](_0x0066('0x26'),_0x4315bf,_0x5ba9ec?'zip':_0x0066('0x25')):null);});})[_0x0066('0x2b')](function(_0x32940e){logger[_0x0066('0xc')](util[_0x0066('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x0066('0x2c')](_0x32940e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0066('0x2d'));})['finally'](function(){process[_0x0066('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cc1cbdb..9cf7df6 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 _0x4c53=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','path','lodash','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','toString','value','length','auto','body','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','sequelize','query'];(function(_0x460d5c,_0x2502a8){var _0x2983d9=function(_0x40a42e){while(--_0x40a42e){_0x460d5c['push'](_0x460d5c['shift']());}};_0x2983d9(++_0x2502a8);}(_0x4c53,0xe3));var _0x34c5=function(_0x3aa0f6,_0x4dd14b){_0x3aa0f6=_0x3aa0f6-0x0;var _0xf10f49=_0x4c53[_0x3aa0f6];return _0xf10f49;};'use strict';var _=require(_0x34c5('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x34c5('0x1'));var htmlToPdfmake=require(_0x34c5('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x34c5('0x3'));var rimraf=require(_0x34c5('0x4'));var JSDOM=require(_0x34c5('0x5'))[_0x34c5('0x6')];var window=new JSDOM('')[_0x34c5('0x7')];var BPromise=require(_0x34c5('0x8'));var db=require(_0x34c5('0x9'))['db'];var dbH=require(_0x34c5('0x9'))['dbH'];var logger=require('../../config/logger')(_0x34c5('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x34c5('0xb')][0x2]);var QUERY=process[_0x34c5('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x34c5('0xb')][0x5];var FORMAT=_0x34c5('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x10908f,_0x125084){var _0x2f0336={'status':_0x10908f};var _0x97712={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x125084){_0x2f0336[_0x34c5('0xd')]=_0x125084;}return db['AnalyticExtractedReport'][_0x34c5('0xe')](_0x2f0336,_0x97712);}function getHeaders(_0x3fb7dd){return _[_0x34c5('0xf')](_0x3fb7dd,function(_0x63a06c){return{'text':_0x63a06c,'style':'tableHeader'};});}function getRows(_0x1f7067,_0x1ed814){return _[_0x34c5('0xf')](_0x1ed814,function(_0x3f44e0){return _(_0x3f44e0)[_0x34c5('0x10')](_0x1f7067)['map'](function(_0x54f08f){return _0x54f08f?_[_0x34c5('0x11')](_0x54f08f):'';})[_0x34c5('0x12')]();});}function createTable(_0x5e99bd,_0x237d22){var _0xbb29b0={'widths':_['fill'](Array(_0x5e99bd[_0x34c5('0x13')]),0x91),'heights':function(_0x300ae6){return _0x300ae6===0x0?_0x34c5('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x35afb4=getHeaders(_0x5e99bd);_0xbb29b0[_0x34c5('0x15')]['push'](_0x35afb4);var _0x1ec31d=getRows(_0x5e99bd,_0x237d22);_0xbb29b0[_0x34c5('0x15')]=_0xbb29b0[_0x34c5('0x15')]['concat'](_0x1ec31d);return _0xbb29b0;}function createTables(_0x48ccee){var _0x178d78=[];var _0x348dd0=_[_0x34c5('0x16')](Object[_0x34c5('0x17')](_0x48ccee[0x0]),0x5);_0x348dd0[_0x34c5('0x18')](function(_0x3c768e){_0x178d78[_0x34c5('0x19')](createTable(_0x3c768e,_0x48ccee));});return _0x178d78;}function getPDFDocDefinition(_0x23101d){var _0xd48d53=util[_0x34c5('0x1a')](_0x34c5('0x1b'),NAME,EXTRACTED_REPORT[_0x34c5('0x1c')],moment(EXTRACTED_REPORT[_0x34c5('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x270d45=[];for(var _0x4539f3=0x0;_0x4539f3<_0x23101d[_0x34c5('0x13')];_0x4539f3++){var _0x585032=[];if(_0x4539f3===0x0){_0x585032[_0x34c5('0x19')]({'text':_0xd48d53,'style':_0x34c5('0x1e')});}var _0x316f60={'table':_0x23101d[_0x4539f3]};if(_0x4539f3>0x0){_0x316f60[_0x34c5('0x1f')]=_0x34c5('0x20');_0x316f60[_0x34c5('0x21')]=[0x0,0x46,0x0,0x0];}_0x585032['push'](_0x316f60);_0x270d45['push'](_0x585032);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x270d45,'footer':function(_0x54217c,_0x5cda96){return{'text':_0x54217c[_0x34c5('0x11')]()+_0x34c5('0x22')+_0x5cda96,'style':_0x34c5('0x23')};},'defaultStyle':{'font':_0x34c5('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x34c5('0x25')},'footer':{'alignment':_0x34c5('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x35f8a2){var _0x30fa89=0x1388;var _0x4d0037;if(!_0x35f8a2[0x0]['num']){return analyticExtractedReport(_0x34c5('0x27'));}return db[_0x34c5('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x34c5('0x29'),_0x34c5('0x2a')]})[_0x34c5('0x2b')](function(_0x43b6f7){if(_0x43b6f7){_0x4d0037=_0x43b6f7;_0x30fa89=_0x4d0037[_0x34c5('0x2a')]||0x3e8;}})[_0x34c5('0x2b')](function(){var _0xdb5d53=[];var _0x4c7c2e=0x0;if(_0x4d0037[_0x34c5('0x29')]){if(_0x35f8a2&&_0x35f8a2[_0x34c5('0x13')]){var _0x9cf655=_[_0x34c5('0x2c')](_0x35f8a2[0x0][_0x34c5('0x2d')]/_0x30fa89);var _0x295ddd=Number[_0x34c5('0x2e')](_0x35f8a2[0x0][_0x34c5('0x2d')]/_0x30fa89)?_0x35f8a2[0x0]['num']%_0x30fa89:0x0;_0x9cf655[_0x34c5('0x18')](function(_0x11a048){if(_0x11a048>0x0){_0x4c7c2e+=_0x30fa89;}_0xdb5d53[_0x34c5('0x19')](dbH[_0x34c5('0x2f')][_0x34c5('0x30')](util['format'](_0x34c5('0x31'),QUERY,_0x30fa89,_0x4c7c2e),{'type':dbH[_0x34c5('0x2f')][_0x34c5('0x32')][_0x34c5('0x33')]}));});if(_0x295ddd>0x0){_0x4c7c2e+=_0x30fa89;_0xdb5d53[_0x34c5('0x19')](dbH['sequelize'][_0x34c5('0x30')](util['format'](_0x34c5('0x31'),QUERY,_0x295ddd,_0x4c7c2e),{'type':dbH[_0x34c5('0x2f')]['QueryTypes'][_0x34c5('0x33')]}));}}}else{_0xdb5d53['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x34c5('0x2f')][_0x34c5('0x32')][_0x34c5('0x33')]}));}var _0x8b1c3b=path[_0x34c5('0x34')](PATH);var _0x250760=path[_0x34c5('0x35')](PATH,_0x34c5('0x36'));var _0x4ed5b8=_0x4d0037[_0x34c5('0x29')]&&_0xdb5d53[_0x34c5('0x13')]>0x1;var _0x3521a5=[];if(!fs['existsSync'](path[_0x34c5('0x37')](_0x8b1c3b,_0x250760))&&_0x4ed5b8){fs[_0x34c5('0x38')](path['join'](_0x8b1c3b,_0x250760));}return BPromise[_0x34c5('0x39')](_0xdb5d53,function(_0x244c47){_0x3521a5[_0x34c5('0x19')](_0x244c47);})[_0x34c5('0x2b')](function(){var _0x10b0ea=[];for(var _0x1c6388=0x0;_0x1c6388<_0x3521a5[_0x34c5('0x13')];_0x1c6388+=0x1){var _0x507873=_0x3521a5[_0x1c6388];var _0x29c52c=createTables(_[_0x34c5('0x3a')](_0x507873));var _0x234edd;var _0x40b979=getPDFDocDefinition(_0x29c52c);var _0x23e6b1=getPDFPrinter();var _0x45d334=_0x23e6b1[_0x34c5('0x3b')](_0x40b979);if(_0x4ed5b8){_0x234edd=path[_0x34c5('0x37')](_0x8b1c3b,_0x250760,util[_0x34c5('0x1a')](_0x34c5('0x3c'),_0x250760,_0x1c6388,'pdf'));}else{_0x234edd=path[_0x34c5('0x37')](_0x8b1c3b,util[_0x34c5('0x1a')](_0x34c5('0x3d'),_0x250760,_0x34c5('0x3e')));}_0x10b0ea[_0x34c5('0x19')](writePDFDocument(_0x45d334,_0x234edd));}return Promise[_0x34c5('0x3f')](_0x10b0ea);})[_0x34c5('0x2b')](function(){if(_0x4ed5b8){return new Promise(function(_0x317a9d){zipdir(path[_0x34c5('0x37')](_0x8b1c3b,_0x250760),{'saveTo':path['join'](_0x8b1c3b,util['format']('%s.%s',_0x250760,_0x34c5('0x40')))},function(){rimraf(path[_0x34c5('0x37')](_0x8b1c3b,_0x250760),function(){});_0x317a9d('zip\x20finished');});});}})[_0x34c5('0x2b')](function(){if(!_0x4ed5b8)return;rimraf(path['join'](_0x8b1c3b,_0x250760),function(){});})[_0x34c5('0x2b')](function(){logger[_0x34c5('0x41')](util[_0x34c5('0x1a')](_0x34c5('0x42'),EXTRACTED_REPORT_ID,_0x34c5('0x43')));return analyticExtractedReport(_0x34c5('0x44'),_0x4ed5b8?util['format'](_0x34c5('0x3d'),_0x250760,_0x4ed5b8?'zip':_0x34c5('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x34c5('0x41')](util[_0x34c5('0x1a')](_0x34c5('0x45'),EXTRACTED_REPORT_ID,_0x34c5('0x43')));return db[_0x34c5('0x46')][_0x34c5('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x34c5('0x2b')](function(_0x36233b){EXTRACTED_REPORT=_0x36233b;return dbH['sequelize'][_0x34c5('0x30')](util[_0x34c5('0x1a')](_0x34c5('0x48'),QUERY),{'type':dbH[_0x34c5('0x2f')]['QueryTypes'][_0x34c5('0x33')]});})[_0x34c5('0x2b')](extractReport)[_0x34c5('0x49')](function(_0x4aef7d){logger['info'](util[_0x34c5('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x34c5('0x43')),util[_0x34c5('0x4a')](_0x4aef7d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x34c5('0x4b')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5a8a4b=new PdfPrinter({'Arial':{'normal':__dirname+_0x34c5('0x4c'),'bold':__dirname+_0x34c5('0x4d'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x34c5('0x4e')}});return _0x5a8a4b;}function getPDFDocDefinitionFromHTML(_0x12f2b7,_0x236d9b){var _0xa966f9=util[_0x34c5('0x1a')](_0x34c5('0x4f'),_0x236d9b[_0x34c5('0x50')],_0x236d9b[_0x34c5('0x51')]);var _0xe5db12=moment()[_0x34c5('0x1a')](_0x34c5('0x52'))[_0x34c5('0x11')]();var _0x1dab24=htmlToPdfmake(_0x12f2b7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1dab24],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x34c5('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x34c5('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x34c5('0x53')}},'header':function(){return[{'text':_0x34c5('0x54'),'style':_0x34c5('0x1e')}];},'footer':function(_0x5800f6,_0x10f871){return[{'text':util[_0x34c5('0x1a')](_0x34c5('0x55'),_0xa966f9,_0x5800f6,_0x10f871,_0xe5db12),'style':'footer'}];}};}function writePDFDocument(_0x3728dd,_0x997bdc){return new Promise(function(_0x35d7a7,_0x412c7f){var _0x4687be=_0x3728dd[_0x34c5('0x56')](fs[_0x34c5('0x57')](_0x997bdc));_0x4687be['on'](_0x34c5('0x58'),function(){_0x35d7a7('finish');});_0x4687be['on']('error',function(_0x49e99a){_0x412c7f(_0x49e99a);});_0x3728dd[_0x34c5('0x59')]();});}exports[_0x34c5('0x5a')]=function(_0x495002,_0x34cbf5){var _0x14306e=getPDFPrinter();var _0x39a5e4=getPDFDocDefinitionFromHTML(_0x495002,_0x34cbf5);var _0x13c6e4=_0x14306e[_0x34c5('0x3b')](_0x39a5e4);return writePDFDocument(_0x13c6e4,_0x34cbf5[_0x34c5('0x5b')])[_0x34c5('0x49')](function(_0x324f89){throw _0x324f89;});}; \ No newline at end of file +var _0x0ced=['findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','end','createPdfFromHTML','lodash','util','path','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','map','pick','toString','value','auto','body','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','length','push','header','pageBreak','before','margin','landscape','footer','Arial','black','right','num','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x0ced,0x72));var _0xd0ce=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0ced[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xd0ce('0x0'));var fs=require('fs');var util=require(_0xd0ce('0x1'));var path=require(_0xd0ce('0x2'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xd0ce('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0xd0ce('0x4'))[_0xd0ce('0x5')];var window=new JSDOM('')[_0xd0ce('0x6')];var BPromise=require(_0xd0ce('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0xd0ce('0x8'))[_0xd0ce('0x9')];var logger=require('../../config/logger')(_0xd0ce('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xd0ce('0xb')][0x2]);var QUERY=process[_0xd0ce('0xb')][0x3];var PATH=process[_0xd0ce('0xb')][0x4];var NAME=process[_0xd0ce('0xb')][0x5];var FORMAT=_0xd0ce('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xab8685,_0xa9f1d8){var _0x43c3e4={'status':_0xab8685};var _0x54a68b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa9f1d8){_0x43c3e4[_0xd0ce('0xd')]=_0xa9f1d8;}return db[_0xd0ce('0xe')]['update'](_0x43c3e4,_0x54a68b);}function getHeaders(_0x4e8347){return _['map'](_0x4e8347,function(_0x27d738){return{'text':_0x27d738,'style':_0xd0ce('0xf')};});}function getRows(_0x1794c6,_0x463ebe){return _[_0xd0ce('0x10')](_0x463ebe,function(_0x28d9d7){return _(_0x28d9d7)[_0xd0ce('0x11')](_0x1794c6)[_0xd0ce('0x10')](function(_0x8dbb6b){return _0x8dbb6b?_[_0xd0ce('0x12')](_0x8dbb6b):'';})[_0xd0ce('0x13')]();});}function createTable(_0x5a6976,_0x408042){var _0x41f9cb={'widths':_['fill'](Array(_0x5a6976['length']),0x91),'heights':function(_0x24cfb6){return _0x24cfb6===0x0?_0xd0ce('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x47c46e=getHeaders(_0x5a6976);_0x41f9cb['body']['push'](_0x47c46e);var _0x249683=getRows(_0x5a6976,_0x408042);_0x41f9cb['body']=_0x41f9cb[_0xd0ce('0x15')][_0xd0ce('0x16')](_0x249683);return _0x41f9cb;}function createTables(_0x20ea87){var _0x365974=[];var _0x3cdb0e=_[_0xd0ce('0x17')](Object['keys'](_0x20ea87[0x0]),0x5);_0x3cdb0e[_0xd0ce('0x18')](function(_0x4c0783){_0x365974['push'](createTable(_0x4c0783,_0x20ea87));});return _0x365974;}function getPDFDocDefinition(_0x2304ce){var _0x40ace6=util[_0xd0ce('0x19')](_0xd0ce('0x1a'),NAME,EXTRACTED_REPORT[_0xd0ce('0x1b')],moment(EXTRACTED_REPORT['startDate'])[_0xd0ce('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xd0ce('0x1c')])['format'](FORMAT));var _0xc465e=[];for(var _0x5adfa1=0x0;_0x5adfa1<_0x2304ce[_0xd0ce('0x1d')];_0x5adfa1++){var _0x39cbd3=[];if(_0x5adfa1===0x0){_0x39cbd3[_0xd0ce('0x1e')]({'text':_0x40ace6,'style':_0xd0ce('0x1f')});}var _0x2a9c30={'table':_0x2304ce[_0x5adfa1]};if(_0x5adfa1>0x0){_0x2a9c30[_0xd0ce('0x20')]=_0xd0ce('0x21');_0x2a9c30[_0xd0ce('0x22')]=[0x0,0x46,0x0,0x0];}_0x39cbd3[_0xd0ce('0x1e')](_0x2a9c30);_0xc465e[_0xd0ce('0x1e')](_0x39cbd3);}return{'pageSize':'A4','pageOrientation':_0xd0ce('0x23'),'content':_0xc465e,'footer':function(_0x2a3a81,_0x337b34){return{'text':_0x2a3a81['toString']()+'\x20/\x20'+_0x337b34,'style':_0xd0ce('0x24')};},'defaultStyle':{'font':_0xd0ce('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd0ce('0x26')},'footer':{'alignment':_0xd0ce('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4585ee){var _0x11ab00=0x1388;var _0x34f967;if(!_0x4585ee[0x0][_0xd0ce('0x28')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd0ce('0x29'),_0xd0ce('0x2a')]})['then'](function(_0xb95ccf){if(_0xb95ccf){_0x34f967=_0xb95ccf;_0x11ab00=_0x34f967[_0xd0ce('0x2a')]||0x3e8;}})[_0xd0ce('0x2b')](function(){var _0x42c32b=[];var _0x5e93d4=0x0;if(_0x34f967['split']){if(_0x4585ee&&_0x4585ee[_0xd0ce('0x1d')]){var _0x311e14=_[_0xd0ce('0x2c')](_0x4585ee[0x0][_0xd0ce('0x28')]/_0x11ab00);var _0x483f4c=Number[_0xd0ce('0x2d')](_0x4585ee[0x0][_0xd0ce('0x28')]/_0x11ab00)?_0x4585ee[0x0][_0xd0ce('0x28')]%_0x11ab00:0x0;_0x311e14['forEach'](function(_0x2c9bc0){if(_0x2c9bc0>0x0){_0x5e93d4+=_0x11ab00;}_0x42c32b[_0xd0ce('0x1e')](dbH[_0xd0ce('0x2e')][_0xd0ce('0x2f')](util['format'](_0xd0ce('0x30'),QUERY,_0x11ab00,_0x5e93d4),{'type':dbH['sequelize']['QueryTypes'][_0xd0ce('0x31')]}));});if(_0x483f4c>0x0){_0x5e93d4+=_0x11ab00;_0x42c32b[_0xd0ce('0x1e')](dbH[_0xd0ce('0x2e')][_0xd0ce('0x2f')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x483f4c,_0x5e93d4),{'type':dbH['sequelize']['QueryTypes'][_0xd0ce('0x31')]}));}}}else{_0x42c32b[_0xd0ce('0x1e')](dbH[_0xd0ce('0x2e')]['query'](QUERY,{'type':dbH[_0xd0ce('0x2e')]['QueryTypes'][_0xd0ce('0x31')]}));}var _0x40f22e=path[_0xd0ce('0x32')](PATH);var _0x404386=path[_0xd0ce('0x33')](PATH,_0xd0ce('0x34'));var _0xe3e51e=_0x34f967[_0xd0ce('0x29')]&&_0x42c32b[_0xd0ce('0x1d')]>0x1;var _0x511f8e=[];if(!fs[_0xd0ce('0x35')](path['join'](_0x40f22e,_0x404386))&&_0xe3e51e){fs[_0xd0ce('0x36')](path[_0xd0ce('0x37')](_0x40f22e,_0x404386));}return BPromise[_0xd0ce('0x38')](_0x42c32b,function(_0x35d4e3){_0x511f8e[_0xd0ce('0x1e')](_0x35d4e3);})[_0xd0ce('0x2b')](function(){var _0x14334b=[];for(var _0x582827=0x0;_0x582827<_0x511f8e['length'];_0x582827+=0x1){var _0x58228c=_0x511f8e[_0x582827];var _0x5224b1=createTables(_[_0xd0ce('0x39')](_0x58228c));var _0x1dfb86;var _0x5c8dde=getPDFDocDefinition(_0x5224b1);var _0x20f8e1=getPDFPrinter();var _0x45ab33=_0x20f8e1[_0xd0ce('0x3a')](_0x5c8dde);if(_0xe3e51e){_0x1dfb86=path[_0xd0ce('0x37')](_0x40f22e,_0x404386,util[_0xd0ce('0x19')](_0xd0ce('0x3b'),_0x404386,_0x582827,_0xd0ce('0x3c')));}else{_0x1dfb86=path[_0xd0ce('0x37')](_0x40f22e,util[_0xd0ce('0x19')](_0xd0ce('0x3d'),_0x404386,_0xd0ce('0x3c')));}_0x14334b['push'](writePDFDocument(_0x45ab33,_0x1dfb86));}return Promise[_0xd0ce('0x3e')](_0x14334b);})['then'](function(){if(_0xe3e51e){return new Promise(function(_0x5b1bd3){zipdir(path[_0xd0ce('0x37')](_0x40f22e,_0x404386),{'saveTo':path[_0xd0ce('0x37')](_0x40f22e,util[_0xd0ce('0x19')](_0xd0ce('0x3d'),_0x404386,_0xd0ce('0x3f')))},function(){rimraf(path[_0xd0ce('0x37')](_0x40f22e,_0x404386),function(){});_0x5b1bd3(_0xd0ce('0x40'));});});}})[_0xd0ce('0x2b')](function(){if(!_0xe3e51e)return;rimraf(path['join'](_0x40f22e,_0x404386),function(){});})[_0xd0ce('0x2b')](function(){logger[_0xd0ce('0x41')](util[_0xd0ce('0x19')](_0xd0ce('0x42'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xd0ce('0x43'),_0xe3e51e?util[_0xd0ce('0x19')](_0xd0ce('0x3d'),_0x404386,_0xe3e51e?_0xd0ce('0x3f'):_0xd0ce('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd0ce('0x41')](util['format'](_0xd0ce('0x44'),EXTRACTED_REPORT_ID,_0xd0ce('0x45')));return db[_0xd0ce('0xe')][_0xd0ce('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd0ce('0x2b')](function(_0x565701){EXTRACTED_REPORT=_0x565701;return dbH['sequelize'][_0xd0ce('0x2f')](util[_0xd0ce('0x19')](_0xd0ce('0x47'),QUERY),{'type':dbH[_0xd0ce('0x2e')][_0xd0ce('0x48')]['SELECT']});})['then'](extractReport)[_0xd0ce('0x49')](function(_0x477228){logger[_0xd0ce('0x41')](util[_0xd0ce('0x19')](_0xd0ce('0x4a'),EXTRACTED_REPORT_ID,_0xd0ce('0x45')),util[_0xd0ce('0x4b')](_0x477228,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd0ce('0x4c'));})[_0xd0ce('0x4d')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1d825b=new PdfPrinter({'Arial':{'normal':__dirname+_0xd0ce('0x4e'),'bold':__dirname+_0xd0ce('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xd0ce('0x50')}});return _0x1d825b;}function getPDFDocDefinitionFromHTML(_0x1d346a,_0x1448c4){var _0x202c6e=util['format'](_0xd0ce('0x51'),_0x1448c4[_0xd0ce('0x52')],_0x1448c4[_0xd0ce('0x53')]);var _0x7eea95=moment()[_0xd0ce('0x19')](_0xd0ce('0x54'))[_0xd0ce('0x12')]();var _0x295d88=htmlToPdfmake(_0x1d346a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x295d88],'defaultStyle':{'font':_0xd0ce('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd0ce('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd0ce('0x55')}},'header':function(){return[{'text':_0xd0ce('0x56'),'style':_0xd0ce('0x1f')}];},'footer':function(_0x1e68a0,_0x2bd81c){return[{'text':util[_0xd0ce('0x19')](_0xd0ce('0x57'),_0x202c6e,_0x1e68a0,_0x2bd81c,_0x7eea95),'style':_0xd0ce('0x24')}];}};}function writePDFDocument(_0x5d2ed7,_0x46094c){return new Promise(function(_0x184a11,_0x1c8e2b){var _0x28fe46=_0x5d2ed7[_0xd0ce('0x58')](fs['createWriteStream'](_0x46094c));_0x28fe46['on'](_0xd0ce('0x59'),function(){_0x184a11(_0xd0ce('0x59'));});_0x28fe46['on']('error',function(_0x1ac1cc){_0x1c8e2b(_0x1ac1cc);});_0x5d2ed7[_0xd0ce('0x5a')]();});}exports[_0xd0ce('0x5b')]=function(_0x5886c7,_0x288bf1){var _0x4e6eea=getPDFPrinter();var _0x4157e5=getPDFDocDefinitionFromHTML(_0x5886c7,_0x288bf1);var _0x317131=_0x4e6eea['createPdfKitDocument'](_0x4157e5);return writePDFDocument(_0x317131,_0x288bf1[_0xd0ce('0x2')])[_0xd0ce('0x49')](function(_0x357063){throw _0x357063;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9e778ff..46ecc36 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 _0x4b74=['each','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','QueryTypes','num','Empty','split','length','range','isInteger','forEach','push','SELECT','dirname','join','mkdirSync'];(function(_0x27b44f,_0x4a3547){var _0x5c4c8b=function(_0x561495){while(--_0x561495){_0x27b44f['push'](_0x27b44f['shift']());}};_0x5c4c8b(++_0x4a3547);}(_0x4b74,0x103));var _0x44b7=function(_0x465a4c,_0x228080){_0x465a4c=_0x465a4c-0x0;var _0x1df8c5=_0x4b74[_0x465a4c];return _0x1df8c5;};'use strict';var util=require(_0x44b7('0x0'));var path=require(_0x44b7('0x1'));var _=require(_0x44b7('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x44b7('0x3'));var zipdir=require(_0x44b7('0x4'));var rimraf=require(_0x44b7('0x5'));var db=require(_0x44b7('0x6'))['db'];var dbH=require(_0x44b7('0x6'))[_0x44b7('0x7')];var logger=require(_0x44b7('0x8'))(_0x44b7('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x44b7('0xa')][0x3];var PATH=process[_0x44b7('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x7b80e9,_0x4a582b){var _0x45dfbe={'status':_0x7b80e9};var _0xabf05c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4a582b){_0x45dfbe[_0x44b7('0xb')]=_0x4a582b;}return db['AnalyticExtractedReport'][_0x44b7('0xc')](_0x45dfbe,_0xabf05c);}function main(){var _0x4765e6=0x1388;var _0x592286;logger[_0x44b7('0xd')](util[_0x44b7('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x44b7('0xf')));return db[_0x44b7('0x10')][_0x44b7('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x44b7('0x12')]})[_0x44b7('0x13')](function(_0x47e9f2){if(_0x47e9f2){_0x592286=_0x47e9f2;_0x4765e6=_0x592286[_0x44b7('0x12')]||0x1388;}})['then'](function(){return dbH[_0x44b7('0x14')][_0x44b7('0x15')](util[_0x44b7('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x44b7('0x16')]['SELECT']});})['then'](function(_0x52419d){if(!_0x52419d[0x0][_0x44b7('0x17')]){return analyticExtractedReport(_0x44b7('0x18'));}var _0x4bae25=[];var _0x304807=0x0;if(_0x592286[_0x44b7('0x19')]){if(_0x52419d&&_0x52419d[_0x44b7('0x1a')]){var _0xb3f580=_[_0x44b7('0x1b')](_0x52419d[0x0][_0x44b7('0x17')]/_0x4765e6);var _0x40c84e=Number[_0x44b7('0x1c')](_0x52419d[0x0][_0x44b7('0x17')]/_0x4765e6)?_0x52419d[0x0][_0x44b7('0x17')]%_0x4765e6:0x0;_0xb3f580[_0x44b7('0x1d')](function(_0x490b4b){if(_0x490b4b>0x0){_0x304807+=_0x4765e6;}_0x4bae25[_0x44b7('0x1e')](dbH['sequelize'][_0x44b7('0x15')](util[_0x44b7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4765e6,_0x304807),{'type':dbH[_0x44b7('0x14')][_0x44b7('0x16')][_0x44b7('0x1f')]}));});if(_0x40c84e>0x0){_0x304807+=_0x4765e6;_0x4bae25[_0x44b7('0x1e')](dbH[_0x44b7('0x14')][_0x44b7('0x15')](util[_0x44b7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x40c84e,_0x304807),{'type':dbH[_0x44b7('0x14')]['QueryTypes'][_0x44b7('0x1f')]}));}}}else{_0x4bae25[_0x44b7('0x1e')](dbH['sequelize'][_0x44b7('0x15')](QUERY,{'type':dbH[_0x44b7('0x14')][_0x44b7('0x16')][_0x44b7('0x1f')]}));}var _0x27d96c=path[_0x44b7('0x20')](PATH);var _0xe90edf=path['basename'](PATH,'.xlsx');var _0x2c2a29=_0x592286['split']&&_0x4bae25[_0x44b7('0x1a')]>0x1;var _0x5e5f58=[];if(!fs['existsSync'](path[_0x44b7('0x21')](_0x27d96c,_0xe90edf))&&_0x2c2a29){fs[_0x44b7('0x22')](path[_0x44b7('0x21')](_0x27d96c,_0xe90edf));}return BPromise[_0x44b7('0x23')](_0x4bae25,function(_0x2bad24){_0x5e5f58['push'](_0x2bad24);})[_0x44b7('0x13')](function(){for(var _0x5d33af=0x0;_0x5d33af<_0x5e5f58[_0x44b7('0x1a')];_0x5d33af+=0x1){var _0x3da272;var _0x115f80=_0x5e5f58[_0x5d33af];if(_0x2c2a29){_0x3da272=path['join'](_0x27d96c,_0xe90edf,util['format']('%s%d.%s',_0xe90edf,_0x5d33af,_0x44b7('0x24')));}else{_0x3da272=path[_0x44b7('0x21')](_0x27d96c,util['format']('%s.%s',_0xe90edf,_0x44b7('0x24')));}fs[_0x44b7('0x25')](_0x3da272,json2xls(_0x115f80),_0x44b7('0x26'));}})[_0x44b7('0x13')](function(){if(_0x2c2a29){return new Promise(function(_0x420fc5){zipdir(path[_0x44b7('0x21')](_0x27d96c,_0xe90edf),{'saveTo':path[_0x44b7('0x21')](_0x27d96c,util['format']('%s.%s',_0xe90edf,_0x44b7('0x27')))},function(_0x41a178,_0xe40ce4){rimraf(path[_0x44b7('0x21')](_0x27d96c,_0xe90edf),function(){});_0x420fc5(_0x44b7('0x28'));});});}})[_0x44b7('0x13')](function(){logger['info'](util[_0x44b7('0xe')](_0x44b7('0x29'),EXTRACTED_REPORT_ID,_0x44b7('0xf')));return analyticExtractedReport(_0x44b7('0x2a'),_0x2c2a29?util[_0x44b7('0xe')](_0x44b7('0x2b'),_0xe90edf,_0x2c2a29?_0x44b7('0x27'):_0x44b7('0x24')):null);});})[_0x44b7('0x2c')](function(_0x278383){logger[_0x44b7('0xd')](util['format'](_0x44b7('0x2d'),EXTRACTED_REPORT_ID,_0x44b7('0xf')),util['inspect'](_0x278383,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x44b7('0x2e'));})[_0x44b7('0x2f')](function(){process[_0x44b7('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1833=['../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x49a3b7,_0x5d2586){var _0x569e43=function(_0x4ddf94){while(--_0x4ddf94){_0x49a3b7['push'](_0x49a3b7['shift']());}};_0x569e43(++_0x5d2586);}(_0x1833,0x93));var _0x3183=function(_0x4587fe,_0x4b740c){_0x4587fe=_0x4587fe-0x0;var _0x379355=_0x1833[_0x4587fe];return _0x379355;};'use strict';var util=require(_0x3183('0x0'));var path=require(_0x3183('0x1'));var _=require(_0x3183('0x2'));var fs=require('fs');var json2xls=require(_0x3183('0x3'));var BPromise=require(_0x3183('0x4'));var zipdir=require(_0x3183('0x5'));var rimraf=require(_0x3183('0x6'));var db=require(_0x3183('0x7'))['db'];var dbH=require('../../mysqldb')[_0x3183('0x8')];var logger=require(_0x3183('0x9'))(_0x3183('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3183('0xb')][0x3];var PATH=process[_0x3183('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf7fc91,_0x3bd649){var _0x18829d={'status':_0xf7fc91};var _0xcb6ace={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bd649){_0x18829d[_0x3183('0xc')]=_0x3bd649;}return db[_0x3183('0xd')]['update'](_0x18829d,_0xcb6ace);}function main(){var _0x5e3077=0x1388;var _0x15e8bf;logger['info'](util[_0x3183('0xe')](_0x3183('0xf'),EXTRACTED_REPORT_ID,_0x3183('0x10')));return db[_0x3183('0x11')][_0x3183('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3183('0x13'),_0x3183('0x14')]})[_0x3183('0x15')](function(_0xb906d3){if(_0xb906d3){_0x15e8bf=_0xb906d3;_0x5e3077=_0x15e8bf[_0x3183('0x14')]||0x1388;}})[_0x3183('0x15')](function(){return dbH[_0x3183('0x16')][_0x3183('0x17')](util[_0x3183('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3183('0x16')][_0x3183('0x18')][_0x3183('0x19')]});})[_0x3183('0x15')](function(_0x382051){if(!_0x382051[0x0][_0x3183('0x1a')]){return analyticExtractedReport(_0x3183('0x1b'));}var _0x3ea34e=[];var _0x5d10d2=0x0;if(_0x15e8bf['split']){if(_0x382051&&_0x382051['length']){var _0xa071fa=_[_0x3183('0x1c')](_0x382051[0x0][_0x3183('0x1a')]/_0x5e3077);var _0x547c70=Number[_0x3183('0x1d')](_0x382051[0x0][_0x3183('0x1a')]/_0x5e3077)?_0x382051[0x0][_0x3183('0x1a')]%_0x5e3077:0x0;_0xa071fa[_0x3183('0x1e')](function(_0x2491c3){if(_0x2491c3>0x0){_0x5d10d2+=_0x5e3077;}_0x3ea34e[_0x3183('0x1f')](dbH[_0x3183('0x16')][_0x3183('0x17')](util[_0x3183('0xe')](_0x3183('0x20'),QUERY,_0x5e3077,_0x5d10d2),{'type':dbH[_0x3183('0x16')][_0x3183('0x18')][_0x3183('0x19')]}));});if(_0x547c70>0x0){_0x5d10d2+=_0x5e3077;_0x3ea34e[_0x3183('0x1f')](dbH[_0x3183('0x16')][_0x3183('0x17')](util[_0x3183('0xe')](_0x3183('0x20'),QUERY,_0x547c70,_0x5d10d2),{'type':dbH[_0x3183('0x16')][_0x3183('0x18')]['SELECT']}));}}}else{_0x3ea34e[_0x3183('0x1f')](dbH[_0x3183('0x16')]['query'](QUERY,{'type':dbH[_0x3183('0x16')][_0x3183('0x18')][_0x3183('0x19')]}));}var _0x252dda=path[_0x3183('0x21')](PATH);var _0x10c7a9=path[_0x3183('0x22')](PATH,_0x3183('0x23'));var _0x22beff=_0x15e8bf['split']&&_0x3ea34e['length']>0x1;var _0x9826a6=[];if(!fs[_0x3183('0x24')](path[_0x3183('0x25')](_0x252dda,_0x10c7a9))&&_0x22beff){fs['mkdirSync'](path[_0x3183('0x25')](_0x252dda,_0x10c7a9));}return BPromise['each'](_0x3ea34e,function(_0x5509c2){_0x9826a6[_0x3183('0x1f')](_0x5509c2);})['then'](function(){for(var _0x256b59=0x0;_0x256b59<_0x9826a6['length'];_0x256b59+=0x1){var _0x239a3a;var _0x1edf98=_0x9826a6[_0x256b59];if(_0x22beff){_0x239a3a=path[_0x3183('0x25')](_0x252dda,_0x10c7a9,util['format'](_0x3183('0x26'),_0x10c7a9,_0x256b59,'xlsx'));}else{_0x239a3a=path['join'](_0x252dda,util[_0x3183('0xe')](_0x3183('0x27'),_0x10c7a9,_0x3183('0x28')));}fs[_0x3183('0x29')](_0x239a3a,json2xls(_0x1edf98),_0x3183('0x2a'));}})[_0x3183('0x15')](function(){if(_0x22beff){return new Promise(function(_0x2b6e6e){zipdir(path[_0x3183('0x25')](_0x252dda,_0x10c7a9),{'saveTo':path[_0x3183('0x25')](_0x252dda,util['format'](_0x3183('0x27'),_0x10c7a9,_0x3183('0x2b')))},function(_0x5f00e8,_0x1a1149){rimraf(path[_0x3183('0x25')](_0x252dda,_0x10c7a9),function(){});_0x2b6e6e(_0x3183('0x2c'));});});}})['then'](function(){logger['info'](util[_0x3183('0xe')](_0x3183('0x2d'),EXTRACTED_REPORT_ID,_0x3183('0x10')));return analyticExtractedReport('Completed',_0x22beff?util[_0x3183('0xe')](_0x3183('0x27'),_0x10c7a9,_0x22beff?_0x3183('0x2b'):'xlsx'):null);});})[_0x3183('0x2e')](function(_0x1afe1c){logger[_0x3183('0x2f')](util['format'](_0x3183('0x30'),EXTRACTED_REPORT_ID,_0x3183('0x10')),util['inspect'](_0x1afe1c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3183('0x31'));})[_0x3183('0x32')](function(){process[_0x3183('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2ae501b..78bb031 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 _0x2f35=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','catch','rewrite','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map'];(function(_0x323b83,_0x3d791e){var _0x1ce44f=function(_0x2ac607){while(--_0x2ac607){_0x323b83['push'](_0x323b83['shift']());}};_0x1ce44f(++_0x3d791e);}(_0x2f35,0x146));var _0x52f3=function(_0x20c893,_0xbef2b4){_0x20c893=_0x20c893-0x0;var _0xc705e8=_0x2f35[_0x20c893];return _0xc705e8;};'use strict';var _=require('lodash');var util=require(_0x52f3('0x0'));function rewrite(_0x452eba,_0x34ef8b){var _0x39c0ee=this;return _0x452eba[_0x52f3('0x1')][_0x52f3('0x2')][_0x52f3('0x3')]({'raw':!![]})[_0x52f3('0x4')](function(_0x32fb8c){_0x39c0ee['intervals']=_0x32fb8c;return _0x452eba[_0x52f3('0x1')][_0x52f3('0x5')][_0x52f3('0x3')]({'where':{'IntervalId':_0x34ef8b[_0x52f3('0x6')]},'raw':!![]});})['then'](function(_0x5e076e){return _0x452eba[_0x52f3('0x1')][_0x52f3('0x5')][_0x52f3('0x3')]({'where':{'exten':{'$in':_[_0x52f3('0x7')](_[_0x52f3('0x8')](_0x5e076e,_0x52f3('0x9')))}},'order':[{'raw':_0x52f3('0xa')}],'raw':!![]});})[_0x52f3('0x4')](function(_0x3082b0){var _0x25805d=_[_0x52f3('0xb')](_0x3082b0,{'priority':'1'});var _0x15bd98=_[_0x52f3('0xb')](_0x3082b0,{'isApp':0x1});var _0x19c4a4=_['groupBy'](_0x15bd98,_0x52f3('0x9'));var _0x21a06f=['queue',_0x52f3('0xc')];var _0x1835d6=[];var _0x276f97=[];for(var _0x434c6f in _0x19c4a4){if(_0x19c4a4[_0x52f3('0xd')](_0x434c6f)){_0x39c0ee[_0x52f3('0xe')]=0x2;_0x39c0ee[_0x52f3('0xf')]=[];_0x39c0ee[_0x52f3('0x10')]=_['find'](_0x25805d,{'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')]});_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':util[_0x52f3('0x14')]('CDR(type)=%s',_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')]),'context':_0x19c4a4[_0x434c6f][0x0]['context'],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee[_0x52f3('0xe')]++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});if(_0x19c4a4[_0x434c6f][0x0]['type']===_0x52f3('0x16')){_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x17')+_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')],'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0]['exten'],'priority':_0x39c0ee['priority']++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});}else if(_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')]===_0x52f3('0x19')){if(_0x39c0ee[_0x52f3('0x10')]){_0x39c0ee[_0x52f3('0xf')]['push']({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x1a')+(_0x39c0ee[_0x52f3('0x10')][_0x52f3('0x1b')]?'${EXTEN:'+_0x39c0ee['extension'][_0x52f3('0x1b')]+'}':'${EXTEN}'),'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0]['exten'],'priority':_0x39c0ee[_0x52f3('0xe')]++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0]['VoiceExtensionId']});}_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x17')+_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')],'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee['priority']++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0]['VoiceExtensionId']});var _0x53ef9d=_0x39c0ee[_0x52f3('0xe')]++;_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':'ExecIf','appdata':_0x52f3('0x1c')+(_0x53ef9d+0x2)+_0x52f3('0x1d')+(_0x53ef9d+0x1)+')','context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x53ef9d,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});if(_0x39c0ee['extension']){_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':_0x39c0ee[_0x52f3('0x10')]['cutdigits']?_0x52f3('0x1e')+_0x39c0ee[_0x52f3('0x10')][_0x52f3('0x1b')]+'}':_0x52f3('0x1f'),'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0]['exten'],'priority':_0x39c0ee['priority']++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});}_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x20')+_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')],'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee[_0x52f3('0xe')]++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});if(_0x39c0ee[_0x52f3('0x10')]&&_0x39c0ee[_0x52f3('0x10')][_0x52f3('0xd')](_0x52f3('0x21'))&&_0x39c0ee[_0x52f3('0x10')][_0x52f3('0x21')]!==_0x52f3('0x22')){_0x39c0ee['extensions'][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x19c4a4[_0x434c6f][0x0]['context'],'exten':_0x19c4a4[_0x434c6f][0x0]['exten'],'priority':_0x39c0ee[_0x52f3('0xe')]++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x39c0ee[_0x52f3('0x10')]['recordingFormat']||_0x52f3('0x23'),'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee['priority']++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});}}_0x39c0ee[_0x52f3('0xf')][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x24'),'context':_0x19c4a4[_0x434c6f][0x0]['context'],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee[_0x52f3('0xe')]++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0]['VoiceExtensionId']});_0x39c0ee['extensions'][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':'Set','appdata':_0x52f3('0x25'),'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee['priority']++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0]['VoiceExtensionId']});_0x39c0ee[_0x52f3('0xf')]['push']({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':'Set','appdata':_0x52f3('0x26'),'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'priority':_0x39c0ee[_0x52f3('0xe')]++,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0]['VoiceExtensionId']});for(var _0x43e2b7=0x0,_0x4dc85b=0x0;_0x43e2b7<_0x19c4a4[_0x434c6f][_0x52f3('0x27')];_0x43e2b7+=0x1,_0x4dc85b=0x0){var _0x3076a0=_0x19c4a4[_0x434c6f][_0x43e2b7];if(_0x3076a0[_0x52f3('0x12')]){_0x3076a0[_0x52f3('0x12')]=_0x3076a0[_0x52f3('0x12')][_0x52f3('0x28')]();}var _0x59a707=[];var _0x113c73=[];delete _0x3076a0['id'];delete _0x3076a0[_0x52f3('0x29')];delete _0x3076a0['updatedAt'];var _0x712f3=_0x3076a0[_0x52f3('0x2a')]!==_0x52f3('0x2b')?[_0x3076a0[_0x52f3('0x2a')]]:_0x3076a0[_0x52f3('0x6')]?_[_0x52f3('0x8')](_[_0x52f3('0xb')](_0x39c0ee[_0x52f3('0x2c')],{'IntervalId':_0x3076a0['IntervalId']}),_0x52f3('0x2a')):[];if(_0x3076a0[_0x52f3('0xd')](_0x52f3('0x2d'))){if(_0x3076a0[_0x52f3('0x2d')]&&_0x3076a0[_0x52f3('0x2d')]!=='--'){_0x59a707[_0x52f3('0x11')]({'type':_0x3076a0['type'],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x2e')+_0x3076a0['tag'],'context':_0x3076a0[_0x52f3('0x18')],'exten':_0x3076a0[_0x52f3('0x9')],'priority':_0x712f3[_0x52f3('0x27')]+_0x39c0ee[_0x52f3('0xe')]+_0x4dc85b++,'VoiceExtensionId':_0x3076a0[_0x52f3('0x15')]});}}if(_0x3076a0['type']===_0x52f3('0x19')&&_0x3076a0[_0x52f3('0xd')]('callerID')){if(_0x3076a0['callerID']){_0x59a707[_0x52f3('0x11')]({'type':_0x3076a0['type'],'app':'ExecIf','appdata':_0x52f3('0x2f')+_0x3076a0[_0x52f3('0x30')]+')','context':_0x3076a0[_0x52f3('0x18')],'exten':_0x3076a0[_0x52f3('0x9')],'priority':_0x712f3[_0x52f3('0x27')]+_0x39c0ee[_0x52f3('0xe')]+_0x4dc85b++,'VoiceExtensionId':_0x3076a0[_0x52f3('0x15')]});}else{_0x59a707['push']({'type':_0x3076a0['type'],'app':_0x52f3('0x31'),'appdata':_0x52f3('0x32'),'context':_0x3076a0[_0x52f3('0x18')],'exten':_0x3076a0[_0x52f3('0x9')],'priority':_0x712f3['length']+_0x39c0ee['priority']+_0x4dc85b++,'VoiceExtensionId':_0x3076a0[_0x52f3('0x15')]});}}if(_0x3076a0[_0x52f3('0xd')](_0x52f3('0x33'))){if(_0x21a06f['indexOf'](_0x3076a0['app'][_0x52f3('0x28')]())>=0x0&&_0x3076a0[_0x52f3('0x34')]!==_0x52f3('0x35')){if(_0x3076a0[_0x52f3('0x33')]){_0x59a707['push']({'type':_0x3076a0[_0x52f3('0x12')],'app':_0x52f3('0x31'),'appdata':_0x52f3('0x36'),'context':_0x3076a0[_0x52f3('0x18')],'exten':_0x3076a0[_0x52f3('0x9')],'priority':_0x712f3['length']+_0x39c0ee[_0x52f3('0xe')]+_0x4dc85b++,'VoiceExtensionId':_0x3076a0[_0x52f3('0x15')]});_0x59a707[_0x52f3('0x11')]({'type':_0x3076a0['type'],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x37'),'context':_0x3076a0[_0x52f3('0x18')],'exten':_0x3076a0['exten'],'priority':_0x712f3[_0x52f3('0x27')]+_0x39c0ee['priority']+_0x4dc85b++,'VoiceExtensionId':_0x3076a0[_0x52f3('0x15')]});}else{_0x59a707[_0x52f3('0x11')]({'type':_0x3076a0['type'],'app':'ExecIf','appdata':_0x52f3('0x38'),'context':_0x3076a0[_0x52f3('0x18')],'exten':_0x3076a0[_0x52f3('0x9')],'priority':_0x712f3[_0x52f3('0x27')]+_0x39c0ee['priority']+_0x4dc85b++,'VoiceExtensionId':_0x3076a0[_0x52f3('0x15')]});_0x59a707['push']({'type':_0x3076a0['type'],'app':_0x52f3('0x13'),'appdata':_0x52f3('0x39'),'context':_0x3076a0['context'],'exten':_0x3076a0[_0x52f3('0x9')],'priority':_0x712f3[_0x52f3('0x27')]+_0x39c0ee[_0x52f3('0xe')]+_0x4dc85b++,'VoiceExtensionId':_0x3076a0['VoiceExtensionId']});}}}for(var _0x196fc6=0x0;_0x196fc6<_0x712f3['length'];_0x196fc6+=0x1){var _0x1f0863=_0x39c0ee[_0x52f3('0xe')]+_0x712f3['length'];var _0x2bad13=_0x196fc6===_0x712f3['length']-0x1?_0x39c0ee['priority']+_0x59a707['length']+_0x113c73[_0x52f3('0x27')]+0x2:_0x39c0ee[_0x52f3('0xe')]+_0x196fc6+0x1;_0x59a707[_0x52f3('0x3a')](_0x196fc6,0x0,{'type':_0x3076a0['type'],'app':'GotoIfTime','appdata':_0x712f3[_0x196fc6]+'?'+_0x3076a0[_0x52f3('0x18')]+_0x52f3('0x3b')+_0x1f0863+':'+_0x3076a0['context']+_0x52f3('0x3b')+_0x2bad13,'exten':_0x3076a0[_0x52f3('0x9')],'context':_0x3076a0[_0x52f3('0x18')],'priority':_0x39c0ee[_0x52f3('0xe')]+_0x196fc6,'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});}_0x3076a0[_0x52f3('0xe')]=_0x59a707[_0x52f3('0x27')]?_[_0x52f3('0x3c')](_0x59a707)['priority']+0x1:_0x39c0ee[_0x52f3('0xe')];_0x39c0ee[_0x52f3('0xe')]=(_0x113c73[_0x52f3('0x27')]?_[_0x52f3('0x3c')](_0x113c73)[_0x52f3('0xe')]:_0x3076a0[_0x52f3('0xe')])+0x1;_0x39c0ee[_0x52f3('0xf')]=_[_0x52f3('0x3d')](_0x39c0ee[_0x52f3('0xf')],_0x59a707,[_0x3076a0],_0x113c73);}_0x39c0ee['extensions'][_0x52f3('0x11')]({'type':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x12')],'app':'Hangup','exten':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x9')],'context':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x18')],'priority':_0x39c0ee['priority'],'VoiceExtensionId':_0x19c4a4[_0x434c6f][0x0][_0x52f3('0x15')]});_0x1835d6['push'](_0x19c4a4[_0x434c6f][0x0]['VoiceExtensionId']);_0x276f97=_[_0x52f3('0x3d')](_0x276f97,_0x39c0ee[_0x52f3('0xf')]);}}return _0x452eba[_0x52f3('0x3e')](function(_0x474342){return _0x452eba[_0x52f3('0x1')][_0x52f3('0x5')][_0x52f3('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x1835d6}},'transaction':_0x474342})[_0x52f3('0x4')](function(_0x3efe31){return _0x452eba['models']['VoiceExtension'][_0x52f3('0x40')](_['sortBy'](_0x276f97,'priority'),{'transaction':_0x474342});});});})[_0x52f3('0x41')](function(_0x32fc84){console['error'](_0x32fc84);});}exports[_0x52f3('0x42')]=rewrite; \ No newline at end of file +var _0x2e4b=['Set','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','toLowerCase','updatedAt','interval','filter','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','catch','error','rewrite','util','models','Interval','findAll','then','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','exten','push','type'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x2e4b,0xef));var _0xb2e4=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x2e4b[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require('lodash');var util=require(_0xb2e4('0x0'));function rewrite(_0x43e39b,_0x130455){var _0x762eea=this;return _0x43e39b[_0xb2e4('0x1')][_0xb2e4('0x2')][_0xb2e4('0x3')]({'raw':!![]})[_0xb2e4('0x4')](function(_0x5c1a09){_0x762eea['intervals']=_0x5c1a09;return _0x43e39b[_0xb2e4('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x130455[_0xb2e4('0x5')]},'raw':!![]});})[_0xb2e4('0x4')](function(_0x50b5f8){return _0x43e39b[_0xb2e4('0x1')][_0xb2e4('0x6')][_0xb2e4('0x3')]({'where':{'exten':{'$in':_[_0xb2e4('0x7')](_[_0xb2e4('0x8')](_0x50b5f8,'exten'))}},'order':[{'raw':_0xb2e4('0x9')}],'raw':!![]});})[_0xb2e4('0x4')](function(_0x3b2482){var _0x4ed466=_['filter'](_0x3b2482,{'priority':'1'});var _0x39444e=_['filter'](_0x3b2482,{'isApp':0x1});var _0x37a304=_[_0xb2e4('0xa')](_0x39444e,'exten');var _0x1752d6=[_0xb2e4('0xb'),_0xb2e4('0xc')];var _0x40a733=[];var _0x29232b=[];for(var _0x1ccddf in _0x37a304){if(_0x37a304[_0xb2e4('0xd')](_0x1ccddf)){_0x762eea[_0xb2e4('0xe')]=0x2;_0x762eea[_0xb2e4('0xf')]=[];_0x762eea[_0xb2e4('0x10')]=_[_0xb2e4('0x11')](_0x4ed466,{'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')]});_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':util[_0xb2e4('0x16')](_0xb2e4('0x17'),_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')]),'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0]['VoiceExtensionId']});if(_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')]===_0xb2e4('0x19')){_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x1a')+_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')],'context':_0x37a304[_0x1ccddf][0x0]['context'],'exten':_0x37a304[_0x1ccddf][0x0]['exten'],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});}else if(_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')]===_0xb2e4('0x1c')){if(_0x762eea['extension']){_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':'CDR(destination)='+(_0x762eea[_0xb2e4('0x10')][_0xb2e4('0x1d')]?_0xb2e4('0x1e')+_0x762eea[_0xb2e4('0x10')][_0xb2e4('0x1d')]+'}':'${EXTEN}'),'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});}_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x1a')+_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')],'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0]['exten'],'priority':_0x762eea['priority']++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0]['VoiceExtensionId']});var _0x38a212=_0x762eea['priority']++;_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x38a212+0x2)+_0xb2e4('0x20')+(_0x38a212+0x1)+')','context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x38a212,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});if(_0x762eea['extension']){_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':'Set','appdata':_0x762eea[_0xb2e4('0x10')][_0xb2e4('0x1d')]?_0xb2e4('0x21')+_0x762eea[_0xb2e4('0x10')][_0xb2e4('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x37a304[_0x1ccddf][0x0]['context'],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0]['VoiceExtensionId']});}_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x22')+_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')],'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});if(_0x762eea[_0xb2e4('0x10')]&&_0x762eea['extension'][_0xb2e4('0xd')](_0xb2e4('0x23'))&&_0x762eea[_0xb2e4('0x10')][_0xb2e4('0x23')]!==_0xb2e4('0x24')){_0x762eea['extensions'][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x25'),'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});_0x762eea['extensions']['push']({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x26')+_0x762eea[_0xb2e4('0x10')][_0xb2e4('0x23')]||_0xb2e4('0x27'),'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0]['exten'],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});}}_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x37a304[_0x1ccddf][0x0]['context'],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0]['VoiceExtensionId']});_0x762eea[_0xb2e4('0xf')]['push']({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});_0x762eea[_0xb2e4('0xf')][_0xb2e4('0x13')]({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'exten':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x12')],'priority':_0x762eea[_0xb2e4('0xe')]++,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});for(var _0x1b5b3b=0x0,_0x2f4033=0x0;_0x1b5b3b<_0x37a304[_0x1ccddf]['length'];_0x1b5b3b+=0x1,_0x2f4033=0x0){var _0x9af66c=_0x37a304[_0x1ccddf][_0x1b5b3b];if(_0x9af66c['type']){_0x9af66c[_0xb2e4('0x14')]=_0x9af66c['type'][_0xb2e4('0x28')]();}var _0x45443c=[];var _0x44fe0b=[];delete _0x9af66c['id'];delete _0x9af66c['createdAt'];delete _0x9af66c[_0xb2e4('0x29')];var _0x5e9388=_0x9af66c[_0xb2e4('0x2a')]!=='*,*,*,*'?[_0x9af66c[_0xb2e4('0x2a')]]:_0x9af66c['IntervalId']?_[_0xb2e4('0x8')](_[_0xb2e4('0x2b')](_0x762eea['intervals'],{'IntervalId':_0x9af66c[_0xb2e4('0x5')]}),_0xb2e4('0x2a')):[];if(_0x9af66c[_0xb2e4('0xd')]('tag')){if(_0x9af66c[_0xb2e4('0x2c')]&&_0x9af66c[_0xb2e4('0x2c')]!=='--'){_0x45443c[_0xb2e4('0x13')]({'type':_0x9af66c[_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x2d')+_0x9af66c['tag'],'context':_0x9af66c[_0xb2e4('0x18')],'exten':_0x9af66c[_0xb2e4('0x12')],'priority':_0x5e9388[_0xb2e4('0x2e')]+_0x762eea['priority']+_0x2f4033++,'VoiceExtensionId':_0x9af66c[_0xb2e4('0x1b')]});}}if(_0x9af66c[_0xb2e4('0x14')]===_0xb2e4('0x1c')&&_0x9af66c[_0xb2e4('0xd')]('callerID')){if(_0x9af66c[_0xb2e4('0x2f')]){_0x45443c[_0xb2e4('0x13')]({'type':_0x9af66c[_0xb2e4('0x14')],'app':_0xb2e4('0x1f'),'appdata':_0xb2e4('0x30')+_0x9af66c[_0xb2e4('0x2f')]+')','context':_0x9af66c[_0xb2e4('0x18')],'exten':_0x9af66c[_0xb2e4('0x12')],'priority':_0x5e9388[_0xb2e4('0x2e')]+_0x762eea[_0xb2e4('0xe')]+_0x2f4033++,'VoiceExtensionId':_0x9af66c[_0xb2e4('0x1b')]});}else{_0x45443c['push']({'type':_0x9af66c['type'],'app':_0xb2e4('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x9af66c[_0xb2e4('0x18')],'exten':_0x9af66c[_0xb2e4('0x12')],'priority':_0x5e9388[_0xb2e4('0x2e')]+_0x762eea[_0xb2e4('0xe')]+_0x2f4033++,'VoiceExtensionId':_0x9af66c[_0xb2e4('0x1b')]});}}if(_0x9af66c[_0xb2e4('0xd')](_0xb2e4('0x31'))){if(_0x1752d6[_0xb2e4('0x32')](_0x9af66c['app']['toLowerCase']())>=0x0&&_0x9af66c[_0xb2e4('0x33')]!==_0xb2e4('0x34')){if(_0x9af66c[_0xb2e4('0x31')]){_0x45443c['push']({'type':_0x9af66c[_0xb2e4('0x14')],'app':_0xb2e4('0x1f'),'appdata':_0xb2e4('0x35'),'context':_0x9af66c['context'],'exten':_0x9af66c[_0xb2e4('0x12')],'priority':_0x5e9388['length']+_0x762eea[_0xb2e4('0xe')]+_0x2f4033++,'VoiceExtensionId':_0x9af66c['VoiceExtensionId']});_0x45443c['push']({'type':_0x9af66c[_0xb2e4('0x14')],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x36'),'context':_0x9af66c[_0xb2e4('0x18')],'exten':_0x9af66c['exten'],'priority':_0x5e9388[_0xb2e4('0x2e')]+_0x762eea[_0xb2e4('0xe')]+_0x2f4033++,'VoiceExtensionId':_0x9af66c[_0xb2e4('0x1b')]});}else{_0x45443c['push']({'type':_0x9af66c[_0xb2e4('0x14')],'app':_0xb2e4('0x1f'),'appdata':_0xb2e4('0x37'),'context':_0x9af66c[_0xb2e4('0x18')],'exten':_0x9af66c[_0xb2e4('0x12')],'priority':_0x5e9388[_0xb2e4('0x2e')]+_0x762eea['priority']+_0x2f4033++,'VoiceExtensionId':_0x9af66c[_0xb2e4('0x1b')]});_0x45443c[_0xb2e4('0x13')]({'type':_0x9af66c['type'],'app':_0xb2e4('0x15'),'appdata':_0xb2e4('0x38'),'context':_0x9af66c['context'],'exten':_0x9af66c[_0xb2e4('0x12')],'priority':_0x5e9388['length']+_0x762eea[_0xb2e4('0xe')]+_0x2f4033++,'VoiceExtensionId':_0x9af66c[_0xb2e4('0x1b')]});}}}for(var _0x3fcae4=0x0;_0x3fcae4<_0x5e9388[_0xb2e4('0x2e')];_0x3fcae4+=0x1){var _0x3d2dde=_0x762eea['priority']+_0x5e9388['length'];var _0x1ba8df=_0x3fcae4===_0x5e9388[_0xb2e4('0x2e')]-0x1?_0x762eea[_0xb2e4('0xe')]+_0x45443c[_0xb2e4('0x2e')]+_0x44fe0b[_0xb2e4('0x2e')]+0x2:_0x762eea[_0xb2e4('0xe')]+_0x3fcae4+0x1;_0x45443c['splice'](_0x3fcae4,0x0,{'type':_0x9af66c['type'],'app':_0xb2e4('0x39'),'appdata':_0x5e9388[_0x3fcae4]+'?'+_0x9af66c[_0xb2e4('0x18')]+_0xb2e4('0x3a')+_0x3d2dde+':'+_0x9af66c[_0xb2e4('0x18')]+',${EXTEN},'+_0x1ba8df,'exten':_0x9af66c[_0xb2e4('0x12')],'context':_0x9af66c['context'],'priority':_0x762eea[_0xb2e4('0xe')]+_0x3fcae4,'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});}_0x9af66c[_0xb2e4('0xe')]=_0x45443c[_0xb2e4('0x2e')]?_['last'](_0x45443c)['priority']+0x1:_0x762eea[_0xb2e4('0xe')];_0x762eea[_0xb2e4('0xe')]=(_0x44fe0b[_0xb2e4('0x2e')]?_[_0xb2e4('0x3b')](_0x44fe0b)[_0xb2e4('0xe')]:_0x9af66c['priority'])+0x1;_0x762eea[_0xb2e4('0xf')]=_[_0xb2e4('0x3c')](_0x762eea[_0xb2e4('0xf')],_0x45443c,[_0x9af66c],_0x44fe0b);}_0x762eea[_0xb2e4('0xf')]['push']({'type':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x14')],'app':'Hangup','exten':_0x37a304[_0x1ccddf][0x0]['exten'],'context':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x18')],'priority':_0x762eea[_0xb2e4('0xe')],'VoiceExtensionId':_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]});_0x40a733[_0xb2e4('0x13')](_0x37a304[_0x1ccddf][0x0][_0xb2e4('0x1b')]);_0x29232b=_['concat'](_0x29232b,_0x762eea[_0xb2e4('0xf')]);}}return _0x43e39b[_0xb2e4('0x3d')](function(_0x15ac4b){return _0x43e39b[_0xb2e4('0x1')][_0xb2e4('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x40a733}},'transaction':_0x15ac4b})[_0xb2e4('0x4')](function(_0x1e3a3d){return _0x43e39b['models'][_0xb2e4('0x6')]['bulkCreate'](_['sortBy'](_0x29232b,_0xb2e4('0xe')),{'transaction':_0x15ac4b});});});})[_0xb2e4('0x3e')](function(_0x4b8b34){console[_0xb2e4('0x3f')](_0x4b8b34);});}exports[_0xb2e4('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b42e17f..2174dc6 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 _0xb6c9=['birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','select','field','phone','ContactId','toString','NOW()','createdAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','updatedAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','papaparse','../../../mysqldb','../../../config/environment','redis','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','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid'];(function(_0x695fb9,_0x19d6ac){var _0x502e29=function(_0x260c4c){while(--_0x260c4c){_0x695fb9['push'](_0x695fb9['shift']());}};_0x502e29(++_0x19d6ac);}(_0xb6c9,0x12d));var _0x9b6c=function(_0x3a0614,_0x4b6627){_0x3a0614=_0x3a0614-0x0;var _0x12bba7=_0xb6c9[_0x3a0614];return _0x12bba7;};'use strict';var BPromise=require('bluebird');var util=require(_0x9b6c('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x9b6c('0x1'));var Redis=require('ioredis');var db=require(_0x9b6c('0x2'))['db'];var config=require(_0x9b6c('0x3'));var logger=require('../../../config/logger')('api');config[_0x9b6c('0x4')]=_[_0x9b6c('0x5')](config['redis'],{'host':_0x9b6c('0x6'),'port':0x18eb});var socket=require(_0x9b6c('0x7'))(new Redis(config[_0x9b6c('0x4')]));require(_0x9b6c('0x8'))[_0x9b6c('0x9')](socket);try{if(!process['argv'][0x2]||process[_0x9b6c('0xa')][0x2]===_0x9b6c('0xb')||process[_0x9b6c('0xa')][0x2]==='null'){throw new Error(_0x9b6c('0xc'));}var FILEPATH=process[_0x9b6c('0xa')][0x2];if(!process[_0x9b6c('0xa')][0x3]||process[_0x9b6c('0xa')][0x3]==='undefined'||process['argv'][0x3]===_0x9b6c('0xd')||!process[_0x9b6c('0xa')][0x4]||process[_0x9b6c('0xa')][0x4]===_0x9b6c('0xb')||process[_0x9b6c('0xa')][0x4]===_0x9b6c('0xd')){throw new Error(_0x9b6c('0xe'));}var FIELDS=_[_0x9b6c('0xf')](process[_0x9b6c('0xa')][0x3][_0x9b6c('0x10')](','),process[_0x9b6c('0xa')][0x4][_0x9b6c('0x10')](','));if(!process[_0x9b6c('0xa')][0x5]||process[_0x9b6c('0xa')][0x5]===_0x9b6c('0xb')||process[_0x9b6c('0xa')][0x5]===_0x9b6c('0xd')){throw new Error(_0x9b6c('0x11'));}var LISTID=process[_0x9b6c('0xa')][0x5];var COMPANYID=process[_0x9b6c('0xa')][0x6]&&process[_0x9b6c('0xa')][0x6]!=='undefined'&&process[_0x9b6c('0xa')][0x6]!=='null'?process[_0x9b6c('0xa')][0x6]:null;var DUPLICATES=process[_0x9b6c('0xa')][0x7]&&process['argv'][0x7]!==_0x9b6c('0xb')&&process[_0x9b6c('0xa')][0x7]!==_0x9b6c('0xd')?process['argv'][0x7]:null;if(!process[_0x9b6c('0xa')][0x8]||process['argv'][0x8]===_0x9b6c('0xb')||process[_0x9b6c('0xa')][0x8]==='null'){throw new Error(_0x9b6c('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1a8bc1){logger[_0x9b6c('0x13')](_0x1a8bc1);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(_0x1caae3,_0x41a6a1,_0x1a081d,_0x2050e9){var _0x2cbb11={'message':_0x41a6a1};_0x2cbb11[_0x1caae3]=!![];if(_0x1a081d){_0x2cbb11[_0x9b6c('0x14')]=_0x1a081d;}if(_0x2050e9){_0x2cbb11[_0x9b6c('0x15')]=_0x2050e9;}return _0x2cbb11;}function isEmail(_0x374c95){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))*$/[_0x9b6c('0x16')](_0x374c95);}function checkRow(_0x3365d7,_0x303061,_0x9fc803){return new BPromise(function(_0x28fca6,_0x4ea7e8){if(_[_0x9b6c('0x17')](_0x3365d7)){return _0x4ea7e8(handleCheckRowError(_0x9b6c('0x13'),_0x9b6c('0x18'),null,_0x9fc803));}if(_0x3365d7[_0x9b6c('0x19')]&&_0x3365d7[_0x9b6c('0x19')][_0x9b6c('0x1a')]){var _0x147875=_[_0x9b6c('0x1b')](_0x3365d7[_0x9b6c('0x19')],_0x9b6c('0x1c'))[_0x9b6c('0x1d')](';');return _0x4ea7e8(handleCheckRowError(_0x9b6c('0x13'),_0x147875,null,_0x9fc803));}var _0x332e46={};for(var _0x4158a5 in FIELDS){if(FIELDS[_0x9b6c('0x1e')](_0x4158a5)&&FIELDS[_0x4158a5]){_0x332e46[_0x4158a5]=_0x3365d7[_0x9b6c('0x1f')][0x0][FIELDS[_0x4158a5]]||_0x3365d7['data'][0x0]['\ufeff'+FIELDS[_0x4158a5]];}}if(!_0x332e46[_0x9b6c('0x20')]){return _0x4ea7e8(handleCheckRowError(_0x9b6c('0x13'),_0x9b6c('0x21'),null,_0x9fc803));}if(!_0x332e46['phone']){return _0x4ea7e8(handleCheckRowError('error',_0x9b6c('0x22'),null,_0x9fc803));}if(_0x332e46[_0x9b6c('0x23')]){var _0x1ee34f=moment(_0x332e46[_0x9b6c('0x23')],_0x9b6c('0x24'));if(!_0x1ee34f[_0x9b6c('0x25')]()){return _0x4ea7e8(handleCheckRowError('error',_0x9b6c('0x26'),null,_0x9fc803));}}if(_0x332e46[_0x9b6c('0x27')]){if(!isEmail(_0x332e46[_0x9b6c('0x27')])){return _0x4ea7e8(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x9fc803));}}_0x332e46[_0x9b6c('0x28')]=LISTID;_0x332e46[_0x9b6c('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x303061){var _0x2ba49c={};for(var _0x532b3d=0x0,_0x5953e8=DUPLICATES['length'];_0x532b3d<_0x5953e8;_0x532b3d+=0x1){_0x2ba49c[DUPLICATES[_0x532b3d]]=_0x332e46[DUPLICATES[_0x532b3d]];}var _0x1b92ee=_[_0x9b6c('0x2a')](_0x303061,_0x2ba49c);if(_0x1b92ee){return _0x4ea7e8(handleCheckRowError(_0x9b6c('0x2b'),_0x9b6c('0x2c'),_0x1b92ee,_0x9fc803));}}return db[_0x9b6c('0x2d')]['create'](_0x332e46,{'raw':!![],'hooks':![],'fields':_[_0x9b6c('0x2e')](_0x332e46)})[_0x9b6c('0x2f')](function(_0x656cc9){if(DUPLICATES&&DUPLICATES[_0x9b6c('0x1a')]&&_0x303061){_0x303061[_0x9b6c('0x30')](_[_0x9b6c('0x31')](_0x332e46,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x656cc9['id'];return _0x28fca6();})[_0x9b6c('0x32')](function(_0x30686d){return _0x4ea7e8(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x30686d[_0x9b6c('0x1c')]||JSON[_0x9b6c('0x33')](_0x30686d)),null,_0x9fc803));});});}function checkHopper(){function _0xc94139(){return function(_0x3f48f6){logger[_0x9b6c('0x13')](_0x9b6c('0x34'),_0x9b6c('0x35'),util[_0x9b6c('0x36')](_0x3f48f6,{'showHidden':![],'depth':null}));};}var _0x4e2cd8=function(_0x1c3d86,_0x38410c){var _0x430369=squel[_0x9b6c('0x37')]()[_0x9b6c('0x38')](_0x9b6c('0x39'))[_0x9b6c('0x3a')](['phone',_0x9b6c('0x3b'),'ContactId',_0x9b6c('0x28'),_0x38410c,'createdAt','updatedAt'],squel[_0x9b6c('0x3c')]()[_0x9b6c('0x3d')](_0x9b6c('0x3e'),_0x9b6c('0x3e'))[_0x9b6c('0x3d')]('NOW()',_0x9b6c('0x3b'))['field']('id',_0x9b6c('0x3f'))[_0x9b6c('0x3d')](LISTID[_0x9b6c('0x40')](),_0x9b6c('0x28'))['field'](_0x1c3d86['id']['toString'](),_0x38410c)[_0x9b6c('0x3d')](_0x9b6c('0x41'),_0x9b6c('0x42'))[_0x9b6c('0x3d')](_0x9b6c('0x41'),'updatedAt')[_0x9b6c('0x43')](_0x9b6c('0x44'))[_0x9b6c('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x9b6c('0x46'),LISTID[_0x9b6c('0x40')]())['where'](_0x9b6c('0x47'))[_0x9b6c('0x45')](_0x9b6c('0x48'),squel[_0x9b6c('0x3c')]()[_0x9b6c('0x3d')]('phone')['from'](_0x9b6c('0x39'))[_0x9b6c('0x45')](_0x38410c+_0x9b6c('0x49'),_0x1c3d86['id'][_0x9b6c('0x40')]())))[_0x9b6c('0x40')]();return _0x430369;};var _0x186236=function(_0x3c174f,_0x292677){var _0x5830c7=squel[_0x9b6c('0x37')]()[_0x9b6c('0x38')](_0x9b6c('0x39'))[_0x9b6c('0x3a')]([_0x9b6c('0x3e'),'scheduledAt','ContactId','ListId',_0x292677,_0x9b6c('0x42'),_0x9b6c('0x4a')],squel['select']()[_0x9b6c('0x3d')](_0x9b6c('0x3e'),_0x9b6c('0x3e'))[_0x9b6c('0x3d')]('NOW()',_0x9b6c('0x3b'))[_0x9b6c('0x3d')]('id',_0x9b6c('0x3f'))[_0x9b6c('0x3d')](LISTID[_0x9b6c('0x40')](),_0x9b6c('0x28'))[_0x9b6c('0x3d')](_0x3c174f['id']['toString'](),_0x292677)[_0x9b6c('0x3d')]('NOW()',_0x9b6c('0x42'))['field']('NOW()','updatedAt')['from']('cm_contacts')[_0x9b6c('0x45')](_0x9b6c('0x4b'))[_0x9b6c('0x45')](_0x9b6c('0x46'),LISTID[_0x9b6c('0x40')]())[_0x9b6c('0x45')](_0x9b6c('0x4c'),squel[_0x9b6c('0x4d')](hopperContacts))['where'](_0x9b6c('0x47'))[_0x9b6c('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9b6c('0x3c')]()['field'](_0x9b6c('0x4e'))[_0x9b6c('0x43')]('cm_hopper_final')[_0x9b6c('0x45')](_0x292677+_0x9b6c('0x49'),_0x3c174f['id']['toString']()))[_0x9b6c('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9b6c('0x3c')]()[_0x9b6c('0x3d')]('phone')[_0x9b6c('0x43')](_0x9b6c('0x39'))[_0x9b6c('0x45')](_0x292677+_0x9b6c('0x49'),_0x3c174f['id'][_0x9b6c('0x40')]())))[_0x9b6c('0x40')]();return _0x5830c7;};function _0x1eec12(_0x9f9851,_0x1e5815){var _0x11e898=squel[_0x9b6c('0x37')]()[_0x9b6c('0x38')](_0x9b6c('0x39'))[_0x9b6c('0x3a')]([_0x9b6c('0x3e'),_0x9b6c('0x3b'),_0x9b6c('0x3f'),'ListId',_0x1e5815,'createdAt',_0x9b6c('0x4a')],squel['select']()[_0x9b6c('0x3d')](_0x9b6c('0x3e'),'phone')[_0x9b6c('0x3d')](_0x9b6c('0x41'),_0x9b6c('0x3b'))[_0x9b6c('0x3d')]('id',_0x9b6c('0x3f'))['field'](LISTID[_0x9b6c('0x40')](),'ListId')[_0x9b6c('0x3d')](_0x9f9851['id']['toString'](),_0x1e5815)[_0x9b6c('0x3d')](_0x9b6c('0x41'),_0x9b6c('0x42'))['field'](_0x9b6c('0x41'),_0x9b6c('0x4a'))[_0x9b6c('0x43')](_0x9b6c('0x44'))[_0x9b6c('0x45')](_0x9b6c('0x4b'))[_0x9b6c('0x45')]('ListId\x20=\x20?',LISTID[_0x9b6c('0x40')]())[_0x9b6c('0x45')]('id\x20IN\x20?',squel[_0x9b6c('0x4d')](hopperContacts))[_0x9b6c('0x45')](_0x9b6c('0x47')))['toString']();return _0x11e898;}function _0x1d0dcd(_0x374a14,_0x37d8fe){var _0x5f3046=squel[_0x9b6c('0x37')]()[_0x9b6c('0x38')](_0x9b6c('0x4f'))[_0x9b6c('0x3a')]([_0x9b6c('0x3e'),_0x9b6c('0x3f'),'ListId',_0x37d8fe,'createdAt',_0x9b6c('0x4a')],squel[_0x9b6c('0x3c')]()[_0x9b6c('0x3d')]('phone','phone')[_0x9b6c('0x3d')]('id',_0x9b6c('0x3f'))[_0x9b6c('0x3d')](LISTID[_0x9b6c('0x40')](),_0x9b6c('0x28'))[_0x9b6c('0x3d')](_0x374a14['id'][_0x9b6c('0x40')](),_0x37d8fe)[_0x9b6c('0x3d')](_0x9b6c('0x41'),_0x9b6c('0x42'))[_0x9b6c('0x3d')]('NOW()','updatedAt')[_0x9b6c('0x43')](_0x9b6c('0x44'))[_0x9b6c('0x45')](_0x9b6c('0x4b'))[_0x9b6c('0x45')]('ListId\x20=\x20?',LISTID[_0x9b6c('0x40')]())['where'](_0x9b6c('0x4c'),squel['str'](hopperContacts))[_0x9b6c('0x45')](_0x9b6c('0x47')))[_0x9b6c('0x40')]();return _0x5f3046;}return db['VoiceQueue'][_0x9b6c('0x50')]({'where':{'type':_0x9b6c('0x51')},'attributes':['id',_0x9b6c('0x52')],'include':[{'model':db[_0x9b6c('0x53')],'as':_0x9b6c('0x54'),'where':{'id':LISTID}}]})[_0x9b6c('0x2f')](function(_0x4b0af1){var _0x5cd4a5=[];if(_0x4b0af1){var _0x423f2e;for(var _0x4046d3=0x0,_0x5586e6;_0x4046d3<_0x4b0af1[_0x9b6c('0x1a')];_0x4046d3+=0x1){_0x5586e6=_0x4b0af1[_0x4046d3][_0x9b6c('0x55')]({'plain':!![]});switch(_0x5586e6[_0x9b6c('0x52')]){case _0x9b6c('0x56'):_0x5cd4a5[_0x9b6c('0x30')](db[_0x9b6c('0x57')][_0x9b6c('0x58')](_0x186236(_0x5586e6,_0x9b6c('0x59')))['then'](function(){})[_0x9b6c('0x32')](_0xc94139()));break;case'onlyIfOpen':_0x5cd4a5[_0x9b6c('0x30')](db[_0x9b6c('0x57')][_0x9b6c('0x58')](_0x4e2cd8(_0x5586e6,_0x9b6c('0x59')))['then'](function(){})[_0x9b6c('0x32')](_0xc94139()));break;default:_0x5cd4a5[_0x9b6c('0x30')](db[_0x9b6c('0x57')][_0x9b6c('0x58')](_0x1eec12(_0x5586e6,_0x9b6c('0x59')))[_0x9b6c('0x2f')](function(){})['catch'](_0xc94139()));}}}return _0x5cd4a5;})[_0x9b6c('0x5a')]()[_0x9b6c('0x2f')](function(){return db[_0x9b6c('0x5b')][_0x9b6c('0x50')]({'where':{'type':_0x9b6c('0x51')},'attributes':['id'],'include':[{'model':db[_0x9b6c('0x53')],'as':_0x9b6c('0x5c'),'where':{'id':LISTID}}]})[_0x9b6c('0x2f')](function(_0x45b5aa){var _0x34decf=[];if(_0x45b5aa){var _0x48d104;for(var _0x50073a=0x0,_0x52f5c6;_0x50073a<_0x45b5aa[_0x9b6c('0x1a')];_0x50073a+=0x1){_0x52f5c6=_0x45b5aa[_0x50073a][_0x9b6c('0x55')]({'plain':!![]});_0x34decf[_0x9b6c('0x30')](db[_0x9b6c('0x57')]['query'](_0x1d0dcd(_0x52f5c6,_0x9b6c('0x59')))[_0x9b6c('0x2f')](function(){})[_0x9b6c('0x32')](_0xc94139()));}}return _0x34decf;})[_0x9b6c('0x5a')]();})['then'](function(){return db[_0x9b6c('0x5d')][_0x9b6c('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x9b6c('0x54'),'where':{'id':LISTID}}]})[_0x9b6c('0x2f')](function(_0x10fbb0){var _0x3dca4d=[];if(_0x10fbb0){for(var _0x366003=0x0,_0x341c96;_0x366003<_0x10fbb0['length'];_0x366003+=0x1){_0x341c96=_0x10fbb0[_0x366003][_0x9b6c('0x55')]({'plain':!![]});switch(_0x341c96[_0x9b6c('0x52')]){case _0x9b6c('0x56'):_0x3dca4d[_0x9b6c('0x30')](db[_0x9b6c('0x57')]['query'](_0x186236(_0x341c96,_0x9b6c('0x5e')))[_0x9b6c('0x2f')](function(){})[_0x9b6c('0x32')](_0xc94139()));break;case _0x9b6c('0x5f'):_0x3dca4d[_0x9b6c('0x30')](db[_0x9b6c('0x57')][_0x9b6c('0x58')](_0x4e2cd8(_0x341c96,_0x9b6c('0x5e')))['then'](function(){})['catch'](_0xc94139()));break;default:_0x3dca4d[_0x9b6c('0x30')](db['sequelize'][_0x9b6c('0x58')](_0x1eec12(_0x341c96,_0x9b6c('0x5e')))[_0x9b6c('0x2f')](function(){})[_0x9b6c('0x32')](_0xc94139()));}}}return _0x3dca4d;})[_0x9b6c('0x5a')]();})[_0x9b6c('0x2f')](function(){return db[_0x9b6c('0x5d')][_0x9b6c('0x50')]({'attributes':['id'],'include':[{'model':db[_0x9b6c('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5a3277){var _0x527621=[];if(_0x5a3277){for(var _0x525e99=0x0,_0x130107;_0x525e99<_0x5a3277[_0x9b6c('0x1a')];_0x525e99+=0x1){_0x130107=_0x5a3277[_0x525e99][_0x9b6c('0x55')]({'plain':!![]});_0x527621[_0x9b6c('0x30')](db[_0x9b6c('0x57')][_0x9b6c('0x58')](_0x1d0dcd(_0x130107,_0x9b6c('0x5e')))[_0x9b6c('0x2f')](function(){})[_0x9b6c('0x32')](_0xc94139()));}}return _0x527621;})[_0x9b6c('0x5a')]();})['catch'](function(_0x565574){logger[_0x9b6c('0x13')](_0x9b6c('0x60'),_0x9b6c('0x61'),_0x565574[_0x9b6c('0x1c')]);});}var processPromises=function(_0x25e3dc){return BPromise[_0x9b6c('0x5a')](promises)[_0x9b6c('0x2f')](function(_0x496ea9){})[_0x9b6c('0x32')](function(_0x599b3e){logger[_0x9b6c('0x13')]('Error\x20processing\x20rows\x20block:',JSON[_0x9b6c('0x33')](_0x599b3e));})[_0x9b6c('0x62')](function(){socket[_0x9b6c('0x63')](_0x9b6c('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x25e3dc){return _0x25e3dc['resume']();}});};var endCsv=function(){return BPromise[_0x9b6c('0x65')]()[_0x9b6c('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x9b6c('0x2f')](function(){socket['emit'](_0x9b6c('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9b6c('0x66')](FILEPATH);}catch(_0x2b78d3){logger[_0x9b6c('0x13')](_0x9b6c('0x67'),JSON[_0x9b6c('0x33')](_0x2b78d3));}finally{process[_0x9b6c('0x68')](0x0);}});};process['on'](_0x9b6c('0x69'),function(){logger[_0x9b6c('0x6a')](_0x9b6c('0x6b'));endCsv();});function main(){return BPromise[_0x9b6c('0x65')]()[_0x9b6c('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9b6c('0x10')](',');return db['CmContact'][_0x9b6c('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x9b6c('0x2f')](function(_0x371991){var _0x558ef1=fs[_0x9b6c('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x9b6c('0x6d')](_0x558ef1,{'header':!![],'skipEmptyLines':!![],'step':function(_0x19141f,_0x293460){total+=0x1;var _0x3055a9=total;promises[_0x9b6c('0x30')](checkRow(_0x19141f,_0x371991,_0x3055a9)[_0x9b6c('0x2f')](function(){success+=0x1;})[_0x9b6c('0x32')](function(_0x440f7d){if(_0x440f7d[_0x9b6c('0x13')]){errors+=0x1;delete _0x440f7d['error'];}else if(_0x440f7d[_0x9b6c('0x2b')]){duplicates+=0x1;delete _0x440f7d[_0x9b6c('0x2b')];}rows[_0x9b6c('0x30')](_0x440f7d);}));if(total%0xc8===0x0){_0x293460[_0x9b6c('0x6e')]();return processPromises(_0x293460);}},'complete':function(){return processPromises()['then'](function(){logger[_0x9b6c('0x6a')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x230c2e,_0x27c035){logger[_0x9b6c('0x6a')](_0x9b6c('0x6f'),JSON[_0x9b6c('0x33')](_0x230c2e));endCsv();}});})[_0x9b6c('0x32')](function(_0x20a6f9){logger[_0x9b6c('0x13')](_0x9b6c('0x70'),JSON[_0x9b6c('0x33')](_0x20a6f9));});}main(); \ No newline at end of file +var _0x8143=['Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','resolve','split','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','query','onlyIfOpen','sequelize','VoiceQueueId','get','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x8143,0x1dd));var _0x3814=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8143[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x3814('0x0'));var util=require(_0x3814('0x1'));var _=require(_0x3814('0x2'));var fs=require('fs');var squel=require(_0x3814('0x3'));var Papa=require(_0x3814('0x4'));var Redis=require(_0x3814('0x5'));var db=require(_0x3814('0x6'))['db'];var config=require(_0x3814('0x7'));var logger=require(_0x3814('0x8'))(_0x3814('0x9'));config[_0x3814('0xa')]=_[_0x3814('0xb')](config[_0x3814('0xa')],{'host':_0x3814('0xc'),'port':0x18eb});var socket=require(_0x3814('0xd'))(new Redis(config[_0x3814('0xa')]));require(_0x3814('0xe'))[_0x3814('0xf')](socket);try{if(!process[_0x3814('0x10')][0x2]||process[_0x3814('0x10')][0x2]===_0x3814('0x11')||process[_0x3814('0x10')][0x2]==='null'){throw new Error(_0x3814('0x12'));}var FILEPATH=process[_0x3814('0x10')][0x2];if(!process[_0x3814('0x10')][0x3]||process['argv'][0x3]===_0x3814('0x11')||process[_0x3814('0x10')][0x3]===_0x3814('0x13')||!process[_0x3814('0x10')][0x4]||process[_0x3814('0x10')][0x4]===_0x3814('0x11')||process[_0x3814('0x10')][0x4]===_0x3814('0x13')){throw new Error(_0x3814('0x14'));}var FIELDS=_[_0x3814('0x15')](process[_0x3814('0x10')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x3814('0x10')][0x5]||process['argv'][0x5]===_0x3814('0x11')||process[_0x3814('0x10')][0x5]==='null'){throw new Error(_0x3814('0x16'));}var LISTID=process[_0x3814('0x10')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x3814('0x10')][0x6]!==_0x3814('0x11')&&process[_0x3814('0x10')][0x6]!==_0x3814('0x13')?process[_0x3814('0x10')][0x6]:null;var DUPLICATES=process[_0x3814('0x10')][0x7]&&process['argv'][0x7]!==_0x3814('0x11')&&process[_0x3814('0x10')][0x7]!=='null'?process['argv'][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x3814('0x11')||process[_0x3814('0x10')][0x8]===_0x3814('0x13')){throw new Error(_0x3814('0x17'));}var SOCKET_TIMESTAMP=process[_0x3814('0x10')][0x8];}catch(_0x5d6944){logger[_0x3814('0x18')](_0x5d6944);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(_0x49266d,_0x1b768c,_0x4894f4,_0x5e9730){var _0x1aefe7={'message':_0x1b768c};_0x1aefe7[_0x49266d]=!![];if(_0x4894f4){_0x1aefe7['contact']=_0x4894f4;}if(_0x5e9730){_0x1aefe7[_0x3814('0x19')]=_0x5e9730;}return _0x1aefe7;}function isEmail(_0x3753a0){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'](_0x3753a0);}function checkRow(_0x25b779,_0x2ebe59,_0x630e54){return new BPromise(function(_0x2313d9,_0x15c9fb){if(_['isNil'](_0x25b779)){return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x3814('0x1a'),null,_0x630e54));}if(_0x25b779['errors']&&_0x25b779[_0x3814('0x1b')][_0x3814('0x1c')]){var _0x56ffcf=_['map'](_0x25b779[_0x3814('0x1b')],_0x3814('0x1d'))[_0x3814('0x1e')](';');return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x56ffcf,null,_0x630e54));}var _0x368327={};for(var _0x4581db in FIELDS){if(FIELDS[_0x3814('0x1f')](_0x4581db)&&FIELDS[_0x4581db]){_0x368327[_0x4581db]=_0x25b779[_0x3814('0x20')][0x0][FIELDS[_0x4581db]]||_0x25b779[_0x3814('0x20')][0x0]['\ufeff'+FIELDS[_0x4581db]];}}if(!_0x368327[_0x3814('0x21')]){return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x3814('0x22'),null,_0x630e54));}if(!_0x368327[_0x3814('0x23')]){return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x3814('0x24'),null,_0x630e54));}if(_0x368327[_0x3814('0x25')]){var _0x458216=moment(_0x368327[_0x3814('0x25')],_0x3814('0x26'));if(!_0x458216['isValid']()){return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x3814('0x27'),null,_0x630e54));}}if(_0x368327[_0x3814('0x28')]){if(!isEmail(_0x368327[_0x3814('0x28')])){return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x3814('0x29'),null,_0x630e54));}}_0x368327[_0x3814('0x2a')]=LISTID;_0x368327[_0x3814('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2ebe59){var _0x5d8af0={};for(var _0x41dd23=0x0,_0x3ea644=DUPLICATES[_0x3814('0x1c')];_0x41dd23<_0x3ea644;_0x41dd23+=0x1){_0x5d8af0[DUPLICATES[_0x41dd23]]=_0x368327[DUPLICATES[_0x41dd23]];}var _0x293255=_['find'](_0x2ebe59,_0x5d8af0);if(_0x293255){return _0x15c9fb(handleCheckRowError(_0x3814('0x2c'),_0x3814('0x2d'),_0x293255,_0x630e54));}}return db['CmContact'][_0x3814('0x2e')](_0x368327,{'raw':!![],'hooks':![],'fields':_['keys'](_0x368327)})[_0x3814('0x2f')](function(_0x5f4206){if(DUPLICATES&&DUPLICATES[_0x3814('0x1c')]&&_0x2ebe59){_0x2ebe59[_0x3814('0x30')](_[_0x3814('0x31')](_0x368327,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5f4206['id'];return _0x2313d9();})[_0x3814('0x32')](function(_0x465d86){return _0x15c9fb(handleCheckRowError(_0x3814('0x18'),_0x3814('0x33')+(_0x465d86[_0x3814('0x1d')]||JSON[_0x3814('0x34')](_0x465d86)),null,_0x630e54));});});}function checkHopper(){function _0xce8ea(){return function(_0x41b9e7){logger[_0x3814('0x18')](_0x3814('0x35'),_0x3814('0x36'),util[_0x3814('0x37')](_0x41b9e7,{'showHidden':![],'depth':null}));};}var _0x248a93=function(_0x57bee6,_0x2a78f9){var _0x39a706=squel[_0x3814('0x38')]()['into'](_0x3814('0x39'))[_0x3814('0x3a')]([_0x3814('0x23'),'scheduledAt',_0x3814('0x3b'),_0x3814('0x2a'),_0x2a78f9,_0x3814('0x3c'),'updatedAt'],squel[_0x3814('0x3d')]()[_0x3814('0x3e')]('phone',_0x3814('0x23'))['field'](_0x3814('0x3f'),_0x3814('0x40'))[_0x3814('0x3e')]('id',_0x3814('0x3b'))[_0x3814('0x3e')](LISTID[_0x3814('0x41')](),_0x3814('0x2a'))[_0x3814('0x3e')](_0x57bee6['id'][_0x3814('0x41')](),_0x2a78f9)[_0x3814('0x3e')]('NOW()',_0x3814('0x3c'))['field'](_0x3814('0x3f'),_0x3814('0x42'))[_0x3814('0x43')](_0x3814('0x44'))[_0x3814('0x45')](_0x3814('0x46'))['where'](_0x3814('0x47'),LISTID[_0x3814('0x41')]())[_0x3814('0x45')](_0x3814('0x48'))[_0x3814('0x45')](_0x3814('0x49'),squel[_0x3814('0x3d')]()[_0x3814('0x3e')](_0x3814('0x23'))['from'](_0x3814('0x39'))[_0x3814('0x45')](_0x2a78f9+_0x3814('0x4a'),_0x57bee6['id']['toString']())))['toString']();return _0x39a706;};var _0x5d14a8=function(_0x454d7c,_0x5c6132){var _0x319b7a=squel[_0x3814('0x38')]()[_0x3814('0x4b')]('cm_hopper')['fromQuery']([_0x3814('0x23'),_0x3814('0x40'),_0x3814('0x3b'),_0x3814('0x2a'),_0x5c6132,_0x3814('0x3c'),_0x3814('0x42')],squel['select']()[_0x3814('0x3e')](_0x3814('0x23'),_0x3814('0x23'))[_0x3814('0x3e')]('NOW()',_0x3814('0x40'))[_0x3814('0x3e')]('id',_0x3814('0x3b'))[_0x3814('0x3e')](LISTID['toString'](),_0x3814('0x2a'))['field'](_0x454d7c['id']['toString'](),_0x5c6132)[_0x3814('0x3e')](_0x3814('0x3f'),_0x3814('0x3c'))[_0x3814('0x3e')]('NOW()',_0x3814('0x42'))[_0x3814('0x43')]('cm_contacts')[_0x3814('0x45')](_0x3814('0x46'))['where'](_0x3814('0x47'),LISTID[_0x3814('0x41')]())[_0x3814('0x45')](_0x3814('0x4c'),squel[_0x3814('0x4d')](hopperContacts))[_0x3814('0x45')](_0x3814('0x48'))[_0x3814('0x45')](_0x3814('0x49'),squel['select']()[_0x3814('0x3e')](_0x3814('0x4e'))[_0x3814('0x43')](_0x3814('0x4f'))['where'](_0x5c6132+_0x3814('0x4a'),_0x454d7c['id']['toString']()))[_0x3814('0x45')](_0x3814('0x49'),squel[_0x3814('0x3d')]()[_0x3814('0x3e')]('phone')[_0x3814('0x43')]('cm_hopper')['where'](_0x5c6132+_0x3814('0x4a'),_0x454d7c['id'][_0x3814('0x41')]())))[_0x3814('0x41')]();return _0x319b7a;};function _0x522029(_0x9fb85,_0x1284b1){var _0x37682b=squel['insert']()[_0x3814('0x4b')](_0x3814('0x39'))[_0x3814('0x3a')]([_0x3814('0x23'),_0x3814('0x40'),'ContactId',_0x3814('0x2a'),_0x1284b1,_0x3814('0x3c'),'updatedAt'],squel[_0x3814('0x3d')]()[_0x3814('0x3e')](_0x3814('0x23'),_0x3814('0x23'))[_0x3814('0x3e')](_0x3814('0x3f'),_0x3814('0x40'))[_0x3814('0x3e')]('id',_0x3814('0x3b'))[_0x3814('0x3e')](LISTID[_0x3814('0x41')](),_0x3814('0x2a'))[_0x3814('0x3e')](_0x9fb85['id']['toString'](),_0x1284b1)[_0x3814('0x3e')](_0x3814('0x3f'),_0x3814('0x3c'))['field'](_0x3814('0x3f'),_0x3814('0x42'))[_0x3814('0x43')](_0x3814('0x44'))[_0x3814('0x45')](_0x3814('0x46'))['where'](_0x3814('0x47'),LISTID[_0x3814('0x41')]())['where'](_0x3814('0x4c'),squel['str'](hopperContacts))['where'](_0x3814('0x48')))[_0x3814('0x41')]();return _0x37682b;}function _0x5a67b4(_0x28e24e,_0x15831a){var _0x132586=squel['insert']()[_0x3814('0x4b')](_0x3814('0x50'))[_0x3814('0x3a')]([_0x3814('0x23'),_0x3814('0x3b'),_0x3814('0x2a'),_0x15831a,'createdAt',_0x3814('0x42')],squel[_0x3814('0x3d')]()[_0x3814('0x3e')](_0x3814('0x23'),_0x3814('0x23'))[_0x3814('0x3e')]('id','ContactId')[_0x3814('0x3e')](LISTID[_0x3814('0x41')](),'ListId')[_0x3814('0x3e')](_0x28e24e['id'][_0x3814('0x41')](),_0x15831a)[_0x3814('0x3e')](_0x3814('0x3f'),_0x3814('0x3c'))[_0x3814('0x3e')](_0x3814('0x3f'),_0x3814('0x42'))[_0x3814('0x43')](_0x3814('0x44'))[_0x3814('0x45')](_0x3814('0x46'))[_0x3814('0x45')](_0x3814('0x47'),LISTID['toString']())[_0x3814('0x45')](_0x3814('0x4c'),squel[_0x3814('0x4d')](hopperContacts))[_0x3814('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x3814('0x41')]();return _0x132586;}return db[_0x3814('0x51')][_0x3814('0x52')]({'where':{'type':_0x3814('0x53')},'attributes':['id',_0x3814('0x54')],'include':[{'model':db[_0x3814('0x55')],'as':_0x3814('0x56'),'where':{'id':LISTID}}]})[_0x3814('0x2f')](function(_0x301cdd){var _0x584b5e=[];if(_0x301cdd){var _0x54c31c;for(var _0x591fea=0x0,_0x266552;_0x591fea<_0x301cdd[_0x3814('0x1c')];_0x591fea+=0x1){_0x266552=_0x301cdd[_0x591fea]['get']({'plain':!![]});switch(_0x266552[_0x3814('0x54')]){case _0x3814('0x57'):_0x584b5e['push'](db['sequelize'][_0x3814('0x58')](_0x5d14a8(_0x266552,'VoiceQueueId'))['then'](function(){})[_0x3814('0x32')](_0xce8ea()));break;case _0x3814('0x59'):_0x584b5e['push'](db[_0x3814('0x5a')][_0x3814('0x58')](_0x248a93(_0x266552,'VoiceQueueId'))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));break;default:_0x584b5e['push'](db[_0x3814('0x5a')][_0x3814('0x58')](_0x522029(_0x266552,_0x3814('0x5b')))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));}}}return _0x584b5e;})['all']()[_0x3814('0x2f')](function(){return db[_0x3814('0x51')][_0x3814('0x52')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3814('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3814('0x2f')](function(_0x42742d){var _0xdeeca4=[];if(_0x42742d){var _0x1e9d9d;for(var _0x257c73=0x0,_0x2f9434;_0x257c73<_0x42742d['length'];_0x257c73+=0x1){_0x2f9434=_0x42742d[_0x257c73][_0x3814('0x5c')]({'plain':!![]});_0xdeeca4[_0x3814('0x30')](db[_0x3814('0x5a')][_0x3814('0x58')](_0x5a67b4(_0x2f9434,_0x3814('0x5b')))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));}}return _0xdeeca4;})[_0x3814('0x5d')]();})[_0x3814('0x2f')](function(){return db[_0x3814('0x5e')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3814('0x55')],'as':_0x3814('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x4f9a82){var _0x12691a=[];if(_0x4f9a82){for(var _0x67e10a=0x0,_0x9bb8df;_0x67e10a<_0x4f9a82[_0x3814('0x1c')];_0x67e10a+=0x1){_0x9bb8df=_0x4f9a82[_0x67e10a]['get']({'plain':!![]});switch(_0x9bb8df[_0x3814('0x54')]){case _0x3814('0x57'):_0x12691a[_0x3814('0x30')](db[_0x3814('0x5a')]['query'](_0x5d14a8(_0x9bb8df,_0x3814('0x5f')))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));break;case _0x3814('0x59'):_0x12691a[_0x3814('0x30')](db[_0x3814('0x5a')][_0x3814('0x58')](_0x248a93(_0x9bb8df,_0x3814('0x5f')))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));break;default:_0x12691a[_0x3814('0x30')](db[_0x3814('0x5a')][_0x3814('0x58')](_0x522029(_0x9bb8df,_0x3814('0x5f')))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));}}}return _0x12691a;})[_0x3814('0x5d')]();})[_0x3814('0x2f')](function(){return db[_0x3814('0x5e')][_0x3814('0x52')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3814('0x60'),'where':{'id':LISTID}}]})[_0x3814('0x2f')](function(_0x367cf7){var _0x5043ee=[];if(_0x367cf7){for(var _0x1bbbf1=0x0,_0x4126c2;_0x1bbbf1<_0x367cf7[_0x3814('0x1c')];_0x1bbbf1+=0x1){_0x4126c2=_0x367cf7[_0x1bbbf1]['get']({'plain':!![]});_0x5043ee['push'](db[_0x3814('0x5a')]['query'](_0x5a67b4(_0x4126c2,_0x3814('0x5f')))[_0x3814('0x2f')](function(){})[_0x3814('0x32')](_0xce8ea()));}}return _0x5043ee;})[_0x3814('0x5d')]();})[_0x3814('0x32')](function(_0x3d440b){logger[_0x3814('0x18')](_0x3814('0x61'),'generalCheckHopper',_0x3d440b['message']);});}var processPromises=function(_0x961247){return BPromise['all'](promises)['then'](function(_0xc0778d){})['catch'](function(_0x4b07f9){logger[_0x3814('0x18')](_0x3814('0x62'),JSON[_0x3814('0x34')](_0x4b07f9));})['finally'](function(){socket[_0x3814('0x63')](_0x3814('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x961247){return _0x961247[_0x3814('0x65')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3814('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3814('0x66')](FILEPATH);}catch(_0x467850){logger[_0x3814('0x18')](_0x3814('0x67'),JSON[_0x3814('0x34')](_0x467850));}finally{process[_0x3814('0x68')](0x0);}});};process['on'](_0x3814('0x69'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3814('0x6a')]()[_0x3814('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3814('0x6b')](',');return db[_0x3814('0x6c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3814('0x2f')](function(_0x1f141c){var _0x2a3189=fs[_0x3814('0x6d')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3814('0x6e')](_0x2a3189,{'header':!![],'skipEmptyLines':!![],'step':function(_0x541bc1,_0x364344){total+=0x1;var _0x307232=total;promises[_0x3814('0x30')](checkRow(_0x541bc1,_0x1f141c,_0x307232)[_0x3814('0x2f')](function(){success+=0x1;})[_0x3814('0x32')](function(_0x5dc2c7){if(_0x5dc2c7[_0x3814('0x18')]){errors+=0x1;delete _0x5dc2c7[_0x3814('0x18')];}else if(_0x5dc2c7[_0x3814('0x2c')]){duplicates+=0x1;delete _0x5dc2c7['duplicate'];}rows[_0x3814('0x30')](_0x5dc2c7);}));if(total%0xc8===0x0){_0x364344[_0x3814('0x6f')]();return processPromises(_0x364344);}},'complete':function(){return processPromises()[_0x3814('0x2f')](function(){logger[_0x3814('0x70')](_0x3814('0x71'));endCsv();});},'error':function(_0x497da0,_0x326fea){logger['info'](_0x3814('0x72'),JSON[_0x3814('0x34')](_0x497da0));endCsv();}});})[_0x3814('0x32')](function(_0x5da723){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x3814('0x34')](_0x5da723));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 13af2cd..4db8e46 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 _0x9538=['info','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','name','_description','AdditionalPhones','writeFileSync','parse','createReadStream','rows','data','find','hasOwnProperty','replace','isValid','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','trim','description','SystemRow','appendFileSync','emit','abort','SystemError','step','CREATE\x20TABLE\x20','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','then','length','push','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','updatedAt','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.updatedAt','createdAt','priority','UserId','cm_contacts','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','group','Received\x20SIGINT','message','exit','errors','code','sequelize','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','all','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x9538,0x1aa));var _0x8953=function(_0x4ed7,_0x14f3ba){_0x4ed7=_0x4ed7-0x0;var _0x584b32=_0x9538[_0x4ed7];return _0x584b32;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8953('0x0'));var Papa=require(_0x8953('0x1'));var util=require(_0x8953('0x2'));var BPromise=require(_0x8953('0x3'));var moment=require('moment');var squel=require(_0x8953('0x4'));var Redis=require(_0x8953('0x5'));var db=require(_0x8953('0x6'))['db'];var config=require(_0x8953('0x7'));var shared=require(_0x8953('0x8'));var logger=require(_0x8953('0x9'))('import');config[_0x8953('0xa')]=_[_0x8953('0xb')](config[_0x8953('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8953('0xc'))(new Redis(config[_0x8953('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8953('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8953('0xd')](_0x8953('0xe'));function isEmail(_0x332770){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'](_0x332770);}function selectNotIn(_0x159a4e,_0x80745,_0x64a158,_0x1317be,_0x4db032){return squel[_0x8953('0xf')]()[_0x8953('0x10')](_0x8953('0x11'))[_0x8953('0x12')](_0x1317be)[_0x8953('0x13')](_0x80745,null,_0x80745+_0x8953('0x14')+_0x1317be+'.'+_0x64a158)[_0x8953('0x15')](_0x1317be+'.'+_0x64a158+_0x8953('0x16')+_0x159a4e+'.'+_0x64a158)[_0x8953('0x15')](_0x80745+_0x8953('0x17')+_0x4db032[_0x8953('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4f2fb8,_0x2cb163){promisesAdditionalPhones=[];return db['CmContact'][_0x8953('0x18')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8953('0x19')](function(_0x1a56d0){if(_0x1a56d0!==null){var _0x4a5eb2=[];for(var _0x340563=0x0;_0x340563<_0x1a56d0[_0x8953('0x1a')];_0x340563++){var _0x3dac4f=_0x1a56d0[_0x340563];_0x4a5eb2[_0x8953('0x1b')](insertAdditionalPhones(_0x3dac4f));}}Promise['all'](_0x4a5eb2)['then'](function(){_0x4f2fb8({'val':0x1});});});});}function insertAdditionalPhones(_0x55abdf){return new Promise(function(_0x5b9600,_0x246e7c){var _0x6de778=_0x55abdf['AdditionalPhones'];var _0x281fb2=_0x6de778['split'](';');var _0xcc3c8b=[];orderBy=0x0;for(var _0x71d91d=0x0;_0x71d91d<_0x281fb2['length'];_0x71d91d++){_0xcc3c8b[_0x8953('0x1b')](splitAdditionalPhone(_0x55abdf['id'],_0x281fb2[_0x71d91d]));}Promise['all'](_0xcc3c8b)[_0x8953('0x19')](function(){_0x5b9600({'val':_0x281fb2[_0x8953('0x1a')]});});});}function splitAdditionalPhone(_0x1e1c5a,_0x483745){return new Promise(function(_0x531241,_0x23fe2b){var _0x17ea0a=_0x483745[_0x8953('0x1c')](':');var _0x2de36c=_0x17ea0a[0x0];var _0x465874=_0x17ea0a[0x1];if(!_[_0x8953('0x1d')](_0x465874)){var _0x3b9254=_0x465874[_0x8953('0x1c')]('|');var _0x4153ae=[];for(var _0x49ad82=0x0;_0x49ad82<_0x3b9254['length'];_0x49ad82++){if(_0x3b9254[_0x49ad82]!==''){var _0x1bda90=_[_0x8953('0x1e')](promisesAdditionalPhones,{'contactId':_0x1e1c5a,'phone':_0x3b9254[_0x49ad82]});if(_0x1bda90[_0x8953('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1e1c5a,'contactTypeId':_0x2de36c,'phone':_0x3b9254[_0x49ad82],'orderBy':orderBy});}}}_0x531241({'ok':0x1});}else _0x531241({'res':0x0});});}function createAdditionalPhone(_0x58728d,_0xdcd0e4,_0x3d8a98,_0x119672){var _0x134f3b='';var _0x24a408='';var _0x139435=_0x3d8a98['split']('§');_0x134f3b=_0x139435[0x0];if(_0x139435['length']==0x2)_0x24a408=_0x139435[0x1];return new Promise(function(_0x23324f,_0x1f66d3){return db[_0x8953('0x1f')][_0x8953('0x20')]({'where':{'CmContactId':_0x58728d,'item':_0x134f3b}})[_0x8953('0x19')](function(_0x2d216c){if(_0x2d216c){return db[_0x8953('0x1f')][_0x8953('0x21')]({'ItemTypeId':_0xdcd0e4,'description':_0x24a408,'OrderBy':_0x119672},{'where':{'CmContactId':_0x58728d,'item':_0x134f3b}})[_0x8953('0x19')](function(_0x543645){_0x23324f({'res':'updated'});});}else{return db['CmContactHasItem'][_0x8953('0x22')]({'CmContactId':_0x58728d,'item':_0x134f3b,'description':_0x24a408,'ItemTypeId':_0xdcd0e4,'OrderBy':_0x119672,'ItemClass':_0x8953('0x23')})[_0x8953('0x19')](function(_0x39d350){_0x23324f({'res':'inserted'});});}});});}function insertCmHopper(_0x3cba10,_0x53bba0,_0x54443b,_0x2f1134,_0x38f3f7){var _0x2453ae=[_0x8953('0x24'),'cm_contacts.scheduledat',_0x8953('0x25'),_0x8953('0x26'),_0x53bba0+'.'+_0x2f1134,_0x8953('0x27'),'cm_contacts.updatedAt',_0x8953('0x28'),_0x8953('0x29'),'\x22'+_0x38f3f7+'\x22'];return squel[_0x8953('0x2a')]()[_0x8953('0x2b')](_0x8953('0x2c'))[_0x8953('0x2d')]([_0x8953('0x11'),_0x8953('0x2e'),_0x8953('0x2f'),_0x8953('0x30'),_0x2f1134,'createdAt','updatedAt','priority','UserId',_0x8953('0x31')],squel[_0x8953('0xf')]()[_0x8953('0x32')](_0x2453ae)[_0x8953('0x12')](_0x53bba0)[_0x8953('0x13')]('cm_contacts',null,_0x8953('0x33')+_0x53bba0+_0x8953('0x34'))[_0x8953('0x13')](_0x54443b,null,_0x54443b+_0x8953('0x14')+_0x53bba0+'.'+_0x2f1134)[_0x8953('0x15')](_0x53bba0+_0x8953('0x35'),_0x3cba10)['where'](_0x8953('0x36'),NOW)['where'](_0x8953('0x37'),selectNotIn(_0x53bba0,_0x54443b,_0x2f1134,_0x8953('0x2c'),[_0x8953('0x38'),_0x8953('0x39')]))['where'](_0x8953('0x37'),selectNotIn(_0x53bba0,_0x54443b,_0x2f1134,'cm_hopper',[_0x8953('0x38')])))[_0x8953('0x3a')]();}function insertCmHopperBlack(_0x2368d5,_0x40a19c,_0x4ddf0a,_0x3e4cc0){var _0x23e079=[_0x8953('0x24'),_0x8953('0x25'),'cm_contacts.ListId',_0x40a19c+'.'+_0x3e4cc0,_0x8953('0x27'),'cm_contacts.updatedAt'];return squel[_0x8953('0x2a')]()[_0x8953('0x2b')](_0x8953('0x3b'))[_0x8953('0x2d')](['phone',_0x8953('0x2f'),_0x8953('0x30'),_0x3e4cc0,'createdAt',_0x8953('0x3c')],squel[_0x8953('0xf')]()[_0x8953('0x32')](_0x23e079)[_0x8953('0x12')](_0x40a19c)[_0x8953('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x40a19c+_0x8953('0x34'))[_0x8953('0x13')](_0x4ddf0a,null,_0x4ddf0a+'.id\x20=\x20'+_0x40a19c+'.'+_0x3e4cc0)['where'](_0x40a19c+_0x8953('0x35'),_0x2368d5)[_0x8953('0x15')](_0x8953('0x36'),NOW)[_0x8953('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8953('0xf')]()['field'](_0x8953('0x11'))[_0x8953('0x12')](_0x8953('0x3b'))[_0x8953('0x15')](_0x8953('0x3d'),_0x2368d5)[_0x8953('0x15')](_0x3e4cc0+_0x8953('0x16')+_0x40a19c+'.'+_0x3e4cc0)))[_0x8953('0x3a')]();}function insertTzCmHopper(_0x472506,_0x59c1d9,_0x1097cc,_0x421de4,_0x43573d,_0x357e0e){var _0x34414d=['cm_contacts.phone',_0x8953('0x3e')+_0x357e0e+'.offset-cm_contacts.utcOffset\x20minute)',_0x8953('0x25'),'cm_contacts.ListId',_0x59c1d9+'.'+_0x421de4,_0x8953('0x27'),_0x8953('0x3f'),'cm_contacts.priority',_0x8953('0x29'),'\x22'+_0x43573d+'\x22'];var _0x401b59=squel['insert']()[_0x8953('0x2b')](_0x8953('0x2c'))['fromQuery']([_0x8953('0x11'),_0x8953('0x2e'),_0x8953('0x2f'),_0x8953('0x30'),_0x421de4,_0x8953('0x40'),_0x8953('0x3c'),_0x8953('0x41'),_0x8953('0x42'),'recallme'],squel[_0x8953('0xf')]()['fields'](_0x34414d)[_0x8953('0x12')](_0x59c1d9)['join'](_0x8953('0x43'),null,_0x8953('0x33')+_0x59c1d9+_0x8953('0x34'))[_0x8953('0x13')](_0x1097cc,null,_0x1097cc+_0x8953('0x14')+_0x59c1d9+'.'+_0x421de4)[_0x8953('0x13')](_0x357e0e,null,_0x357e0e+'.id\x20=\x20'+_0x59c1d9+'.'+_0x421de4)[_0x8953('0x15')](_0x59c1d9+_0x8953('0x35'),_0x472506)[_0x8953('0x15')](_0x8953('0x36'),NOW)[_0x8953('0x15')](_0x8953('0x37'),selectNotIn(_0x59c1d9,_0x1097cc,_0x421de4,'cm_hopper',[_0x8953('0x38'),_0x8953('0x39')]))[_0x8953('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x59c1d9,_0x1097cc,_0x421de4,_0x8953('0x2c'),[_0x8953('0x38')])))[_0x8953('0x3a')]();return _0x401b59;}function insertTzCmHopperBlack(_0xc0f55e,_0x5b3182,_0x46fbf0,_0x5dedc9){var _0x5893fe=[_0x8953('0x24'),_0x8953('0x25'),_0x8953('0x26'),_0x5b3182+'.'+_0x5dedc9,_0x8953('0x27'),'cm_contacts.updatedAt'];return squel[_0x8953('0x2a')]()[_0x8953('0x2b')](_0x8953('0x3b'))[_0x8953('0x2d')](['phone',_0x8953('0x2f'),_0x8953('0x30'),_0x5dedc9,_0x8953('0x40'),_0x8953('0x3c')],squel[_0x8953('0xf')]()['fields'](_0x5893fe)['from'](_0x5b3182)[_0x8953('0x13')]('cm_contacts',null,_0x8953('0x33')+_0x5b3182+_0x8953('0x34'))[_0x8953('0x13')](_0x46fbf0,null,_0x46fbf0+'.id\x20=\x20'+_0x5b3182+'.'+_0x5dedc9)[_0x8953('0x15')](_0x5b3182+'.CmListId\x20=\x20?',_0xc0f55e)[_0x8953('0x15')](_0x8953('0x36'),NOW)['where'](_0x8953('0x37'),squel[_0x8953('0xf')]()['field']('phone')[_0x8953('0x12')](_0x8953('0x3b'))[_0x8953('0x15')]('ListId\x20=\x20?',_0xc0f55e)[_0x8953('0x15')](_0x5dedc9+_0x8953('0x16')+_0x5b3182+'.'+_0x5dedc9)))[_0x8953('0x3a')]();}function insertCmHopperAdditionalPhones(_0x2ef2ef){var _0x15ffac=[_0x8953('0x44'),_0x8953('0x45'),_0x8953('0x46'),_0x8953('0x47'),_0x8953('0x48')];return squel[_0x8953('0x2a')]()[_0x8953('0x2b')](_0x8953('0x49'))[_0x8953('0x2d')]([_0x8953('0x4a'),_0x8953('0x11'),'OrderBy',_0x8953('0x40'),_0x8953('0x3c')],squel[_0x8953('0xf')]()[_0x8953('0x32')](_0x15ffac)['from'](_0x8953('0x2c'))[_0x8953('0x13')](_0x8953('0x43'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x8953('0x13')]('cm_contact_has_items',null,_0x8953('0x4b'))['where'](_0x8953('0x4c'),_0x2ef2ef)[_0x8953('0x15')](_0x8953('0x36'),NOW))[_0x8953('0x3a')]();}function insertCmContact(_0x22ca0a,_0x255784,_0x838966,_0x22793a){var _0x12b00d=_[_0x8953('0x4d')](_[_0x8953('0x4e')](_0x22793a),[_0x8953('0x30'),'CompanyId',_0x8953('0x40'),_0x8953('0x3c'),_0x8953('0x4f')]);return squel[_0x8953('0x2a')]()['into'](_0x8953('0x43'))[_0x8953('0x2d')](_0x12b00d,squel[_0x8953('0xf')]()[_0x8953('0x32')](_0x12b00d)['from'](_0x255784)[_0x8953('0x15')]('('+_0x838966[_0x8953('0x13')](',')+_0x8953('0x50'),squel['select']()[_0x8953('0x32')](_0x838966)[_0x8953('0x12')]('cm_contacts')[_0x8953('0x15')](_0x8953('0x3d'),_0x22ca0a)[_0x8953('0x15')](_0x8953('0x51')))[_0x8953('0x15')](_0x8953('0x52'),squel[_0x8953('0xf')]()['field']('MIN(id)','min_id')[_0x8953('0x12')](_0x255784)[_0x8953('0x53')](_0x838966['join'](','))))['toString']();}function handleStop(){logger['info'](_0x8953('0x54'));stopped=!![];}function handleUncaughtException(_0x15708b){logger['error'](_0x15708b[_0x8953('0x55')]);process[_0x8953('0x56')](0x1);}function handleError(_0xd01805,_0x49791d){stats[_0x8953('0x57')]['push']({'name':_0x49791d[_0x8953('0x58')],'message':_0x49791d[_0x8953('0x55')],'row':_0xd01805});}function handleQuery(_0x2d89b2){logger['info'](_0x2d89b2);return db[_0x8953('0x59')][_0x8953('0x5a')](_0x2d89b2)['spread'](function(_0x386d68){results[_0x8953('0x1b')](_0x386d68);})[_0x8953('0x5b')](function(_0x4f19f0){logger[_0x8953('0x5c')](_0x4f19f0['message']);});}function updateTzCampaigns(_0x579efb){return new Promise(function(_0x539bb4,_0x3214fc){var _0x4de2ed=squel['select']()['fields']([_0x8953('0x5d'),_0x8953('0x5e')])[_0x8953('0x12')](_0x8953('0x5f'))[_0x8953('0x13')](_0x8953('0x60'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x8953('0x15')](_0x8953('0x61')+_0x579efb);db[_0x8953('0x59')][_0x8953('0x5a')](_0x4de2ed[_0x8953('0x3a')]())[_0x8953('0x62')](function(_0x4629cf){var _0x358259=[];for(var _0x22db08=0x0;_0x22db08<_0x4629cf[_0x8953('0x1a')];_0x22db08++){_0x358259['push'](getTimezoneData(_0x4629cf[_0x22db08],tmp_campaigns));}BPromise[_0x8953('0x63')](_0x358259)[_0x8953('0x19')](function(){_0x539bb4({'val':0x1});});})[_0x8953('0x5b')](function(_0x486ee7){logger[_0x8953('0x5c')](_0x486ee7[_0x8953('0x55')]);_0x539bb4({'val':0x0});});});}function updateTzVoiceQueues(_0x194464){return new Promise(function(_0x528079,_0x9ce2a7){var _0x18d3b2=squel['select']()[_0x8953('0x32')]([_0x8953('0x64'),_0x8953('0x65')])[_0x8953('0x12')](_0x8953('0x66'))[_0x8953('0x13')](_0x8953('0x67'),null,_0x8953('0x68'))[_0x8953('0x15')](_0x8953('0x69')+_0x194464);db[_0x8953('0x59')][_0x8953('0x5a')](_0x18d3b2[_0x8953('0x3a')]())[_0x8953('0x62')](function(_0x35fa32){var _0x22f3d3=[];for(var _0x1a9143=0x0;_0x1a9143<_0x35fa32[_0x8953('0x1a')];_0x1a9143++){_0x22f3d3[_0x8953('0x1b')](getTimezoneData(_0x35fa32[_0x1a9143],tmp_voice_queues));}BPromise[_0x8953('0x63')](_0x22f3d3)[_0x8953('0x19')](function(){_0x528079({'val':0x1});});})['catch'](function(_0x355176){logger[_0x8953('0x5c')](_0x355176[_0x8953('0x55')]);_0x528079({'val':0x0});});});}function getTimezoneData(_0x277736,_0x1881af){return new Promise(function(_0x34b7d2,_0x224689){var _0x50d1b4=shared[_0x8953('0x6a')];var _0xa01a2a=_0x50d1b4[_0x277736[_0x8953('0x6b')]];if(_[_0x8953('0x1d')](_0xa01a2a)){_0x34b7d2({'ret':0x1});}else{var _0x228616=_0xa01a2a[_0x8953('0x6c')];var _0x1a2504=squel[_0x8953('0x2a')]()[_0x8953('0x2b')](_0x1881af)['set']('id',_0x277736['id'])[_0x8953('0x6d')](_0x8953('0x6e'),_0x228616)[_0x8953('0x6d')](_0x8953('0x6b'),_0x277736[_0x8953('0x6b')])[_0x8953('0x3a')]();return db[_0x8953('0x59')][_0x8953('0x5a')](_0x1a2504)[_0x8953('0x62')](function(_0x155a07){_0x34b7d2({'ret':0x1});})[_0x8953('0x5b')](function(_0x2324aa){logger[_0x8953('0x5c')](_0x2324aa[_0x8953('0x55')]);_0x224689({'ret':0x1});});}});}function handleTZQuery(_0x235459){logger[_0x8953('0x6f')](_0x235459);return db[_0x8953('0x59')][_0x8953('0x5a')](_0x235459)[_0x8953('0x62')](function(_0x15e8c6){})[_0x8953('0x5b')](function(_0xdea1d3){logger[_0x8953('0x5c')](_0xdea1d3[_0x8953('0x55')]);});}function main(_0xa1906d,_0x133613,_0x14c84e,_0x104847){logger[_0x8953('0x6f')](_0x8953('0x70'),_0xa1906d,JSON[_0x8953('0x71')](_0x133613));process[_0x8953('0x72')](_0x8953('0x73'));var _0x5214a4=_0x133613[_0x8953('0x74')];var _0xc4c52f=_[_0x8953('0x75')](_0x5214a4);var _0x18b8a3=_0x133613[_0x8953('0x76')];var _0x57a9a9=path[_0x8953('0x13')](config['root'],_0x8953('0x77'),_0x18b8a3+_0x8953('0x78'));hasTZ=_['keys'](_0x5214a4)[_0x8953('0x79')]('dialTimezone');var _0x1e842f=_[_0x8953('0x4e')](_0x5214a4)['join']();logger['info'](_0x8953('0x7a'),_0x1e842f);db['ContactItemType'][_0x8953('0x18')]({'raw':!![],'attributes':['id',_0x8953('0x7b')]})[_0x8953('0x19')](function(_0x544177){for(var _0x4c492a=0x0;_0x4c492a<_0x544177[_0x8953('0x1a')];_0x4c492a++){if(_0x544177[_0x4c492a][_0x8953('0x7b')]in _0x5214a4){contactItemTypes[_0x8953('0x1b')](_0x544177[_0x4c492a]);delete _0xc4c52f[_0x544177[_0x4c492a]['name']];hasAdditionalPhones=!![];}for(var _0x3d758e in _0x5214a4){if(_0x544177[_0x4c492a][_0x8953('0x7b')]+_0x8953('0x7c')===_0x3d758e){phoneDescriptions[_0x8953('0x1b')]({'itemTypeId':_0x544177[_0x4c492a]['id'],'description':_0x3d758e});delete _0xc4c52f[_0x3d758e];}}}if(hasAdditionalPhones)_0xc4c52f[_0x8953('0x7d')]='';var _0x5a410a=_['keys'](_0xc4c52f)[_0x8953('0x13')]();logger[_0x8953('0x6f')](_0x8953('0x7a'),_0x5a410a);fs[_0x8953('0x7e')](_0x57a9a9,_0x5a410a+'\x0a');Papa[_0x8953('0x7f')](fs[_0x8953('0x80')](_0xa1906d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x8b7c02,_0x1a76ff){try{for(var _0x20ac04=0x0,_0xc4068c=[];_0x20ac04<_0x8b7c02['data'][_0x8953('0x1a')];_0x20ac04++){stats[_0x8953('0x81')]+=0x1;if(_0x8b7c02[_0x8953('0x57')][_0x20ac04]){handleError(_0x8b7c02[_0x8953('0x82')][_0x20ac04],_0x8b7c02[_0x8953('0x57')][_0x20ac04]);}else{var _0x49948f=[];var _0x3d7bf7=[];var _0x193bbd={};for(var _0x294669 in _0x5214a4){let _0x1148b9=contactItemTypes[_0x8953('0x83')](_0x2a3e5b=>_0x2a3e5b[_0x8953('0x7b')]===_0x294669);let _0xe80a66=contactItemTypes['find'](_0x4a5542=>_0x4a5542[_0x8953('0x7b')]+_0x8953('0x7c')===_0x294669);if(_['isNil'](_0x1148b9)&&_[_0x8953('0x1d')](_0xe80a66)){if(_0x5214a4[_0x8953('0x84')](_0x294669)){if(_0x8b7c02[_0x8953('0x82')][_0x20ac04][_0x5214a4[_0x294669]]){var _0x3a6dd9=_['trim'](_0x8b7c02[_0x8953('0x82')][_0x20ac04][_0x5214a4[_0x294669]][_0x8953('0x85')](/"/g,'\x27'));switch(_0x294669){case _0x8953('0x2e'):var _0x1b7afa=moment(_0x3a6dd9,_0x8953('0xe'),!![]);if(_0x1b7afa[_0x8953('0x86')]()){_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3a6dd9+'\x22');}else{_0x49948f[_0x8953('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x8953('0x41'):var _0x333898=parseInt(_0x3a6dd9);_0x3a6dd9=_['isNaN'](_0x333898)||_0x333898<0x0||_0x333898>0x4?_0x104847?0x3:0x2:_0x333898;_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3a6dd9+'\x22');break;case _0x8953('0x42'):var _0x268bba=parseInt(_0x3a6dd9);if(_[_0x8953('0x87')](_0x268bba)&&_[_0x8953('0x79')](_0x14c84e,_0x268bba)){_0xc4068c['push']('\x22'+_0x268bba+'\x22');}else{_0x49948f[_0x8953('0x1b')](_0x8953('0x88'));}break;case _0x8953('0x89'):if(isEmail(_0x3a6dd9)){_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3a6dd9+'\x22');}else{_0x49948f['push'](_0x8953('0x8a'));}break;case _0x8953('0x8b'):var _0x5c8502=moment(_0x3a6dd9,_0x8953('0x8c'),!![]);if(_0x5c8502[_0x8953('0x86')]()){_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3a6dd9+'\x22');}else{_0x49948f[_0x8953('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x22b1c0=shared[_0x8953('0x6a')];var _0x59867e=_0x22b1c0[_0x3a6dd9];if(!_[_0x8953('0x1d')](_0x59867e)){var _0x39e7f9=_0x59867e[_0x8953('0x6c')];_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3a6dd9+'\x22');_0xc4068c[_0x8953('0x1b')]('\x22'+_0x39e7f9+'\x22');}break;default:_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3a6dd9+'\x22');}}else{switch(_0x294669){case _0x8953('0x8d'):case _0x8953('0x11'):_0x49948f['push'](_0x294669+_0x8953('0x8e'));break;default:_0xc4068c['push']('\x22\x22');}}}}else{var _0x11bc36='';if(!_['isNil'](_0x1148b9)){if(!_0x193bbd['hasOwnProperty'](_0x1148b9['id'])){if(!_[_0x8953('0x1d')](_0x8b7c02[_0x8953('0x82')][_0x20ac04][_0x5214a4[_0x294669]])){var _0x3a6dd9=_[_0x8953('0x8f')](_0x8b7c02[_0x8953('0x82')][_0x20ac04][_0x5214a4[_0x294669]][_0x8953('0x85')](/"/g,'\x27'));var _0x3ffb13=phoneDescriptions[_0x8953('0x83')](_0x47eb4f=>_0x47eb4f['itemTypeId']===_0x1148b9['id']);if(!_[_0x8953('0x1d')](_0x3ffb13)){var _0x559e93=_['trim'](_0x8b7c02[_0x8953('0x82')][_0x20ac04][_0x5214a4[_0x3ffb13[_0x8953('0x90')]]][_0x8953('0x85')](/"/g,'\x27'));if(!_[_0x8953('0x1d')](_0x559e93))_0x3a6dd9=_0x3a6dd9+'§'+_0x559e93;}if(_0x11bc36=='')_0x11bc36=_0x3a6dd9;else _0x11bc36+='|'+_0x3a6dd9;}_0x3d7bf7[_0x8953('0x1b')](_0x1148b9['id']+':'+_0x11bc36);_0x193bbd[_0x1148b9['id']]=0x1;}}}}if(hasAdditionalPhones){_0xc4068c[_0x8953('0x1b')]('\x22'+_0x3d7bf7[_0x8953('0x13')](';')+'\x22');}if(_0x49948f['length']){handleError(_0x8b7c02[_0x8953('0x82')][_0x20ac04],{'code':_0x8953('0x91'),'message':_0x49948f['join']()});}else{fs[_0x8953('0x92')](_0x57a9a9,_0xc4068c[_0x8953('0x13')]()+'\x0a');}_0xc4068c=[];}if(!(stats[_0x8953('0x81')]%0xc8)){socket[_0x8953('0x93')]('contact:import:'+_0x18b8a3,stats);stats['errors']=[];}}if(stopped){logger[_0x8953('0x6f')]('Abort\x20parser');_0x1a76ff[_0x8953('0x94')]();}}catch(_0x58c5f2){handleError(_0x8b7c02[_0x8953('0x82')][_0x20ac04],{'code':_0x8953('0x95'),'message':_0x58c5f2[_0x8953('0x55')]});logger[_0x8953('0x5c')](_0x8953('0x96'),_0x58c5f2[_0x8953('0x55')]);}},'complete':function(){try{var _0x610e32=[];var _0x1d9137=[];var _0x5eacac=_0x8953('0x43');if(_0x133613['duplicates']&&_0x133613['duplicates'][_0x8953('0x1a')]){_0x5eacac='cm_contacts_'+_0x18b8a3;_0x610e32[_0x8953('0x1b')](_0x8953('0x97')+_0x5eacac+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x8953('0x98')+_0x18b8a3;tmp_voice_queues='voice_queues_'+_0x18b8a3;_0x1d9137['push'](_0x8953('0x97')+tmp_campaigns+_0x8953('0x99'));_0x1d9137[_0x8953('0x1b')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x8953('0x99'));BPromise['each'](_0x1d9137,handleTZQuery)['then'](function(_0x4ab0a9){updateTzCampaigns(_0x133613[_0x8953('0x30')])['then'](function(_0x1c6fa3){updateTzVoiceQueues(_0x133613['ListId'])[_0x8953('0x19')](function(_0x20ac00){if(hasTZ)_0x5a410a=_0x5a410a[_0x8953('0x85')]('dialTimezone',_0x8953('0x9a'));var _0xd6fd89=util['format'](_0x8953('0x9b'),_0x57a9a9,_0x5eacac,_0x5a410a,_0x133613[_0x8953('0x30')],_0x133613[_0x8953('0x9c')]||null,NOW,NOW);if(_[_0x8953('0x1d')](_0x5214a4[_0x8953('0x2e')])){_0xd6fd89+=_0x8953('0x9d');}_0x610e32[_0x8953('0x1b')](_0xd6fd89);if(_0x133613['duplicates']&&_0x133613[_0x8953('0x9e')][_0x8953('0x1a')]){_0x610e32[_0x8953('0x1b')](insertCmContact(_0x133613[_0x8953('0x30')],_0x5eacac,_0x133613[_0x8953('0x9e')],_0x5214a4));_0x610e32[_0x8953('0x1b')](_0x8953('0x9f')+_0x5eacac+';');}BPromise[_0x8953('0xa0')](_0x610e32,handleQuery)[_0x8953('0x19')](function(_0x53679a){BPromise[_0x8953('0x63')]([handleAdditionalPhones()])['then'](function(){_0x610e32=[];for(var _0x514517=0x0;_0x514517\x20\x20','existsSync','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../config/environment/shared','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','length','all','then','split','push','isNil','filter','CmContactHasItem','updated','create','PHONE','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','fromQuery'];(function(_0x37794e,_0x5f0c78){var _0x2a8426=function(_0x26cc5b){while(--_0x26cc5b){_0x37794e['push'](_0x37794e['shift']());}};_0x2a8426(++_0x5f0c78);}(_0x4d05,0x73));var _0x54d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d05[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require(_0x54d0('0x0'));var _=require(_0x54d0('0x1'));var Papa=require(_0x54d0('0x2'));var util=require('util');var BPromise=require(_0x54d0('0x3'));var moment=require(_0x54d0('0x4'));var squel=require(_0x54d0('0x5'));var Redis=require(_0x54d0('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x54d0('0x7'));var logger=require('../../../config/logger')('import');config['redis']=_[_0x54d0('0x8')](config[_0x54d0('0x9')],{'host':_0x54d0('0xa'),'port':0x18eb});var socket=require(_0x54d0('0xb'))(new Redis(config[_0x54d0('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x54d0('0xc')](_0x54d0('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x54d0('0xc')](_0x54d0('0xd'));function isEmail(_0x2b2d65){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))*$/[_0x54d0('0xe')](_0x2b2d65);}function selectNotIn(_0x3c5286,_0x1e2112,_0x1c2542,_0x17bdc5,_0x584775){return squel['select']()[_0x54d0('0xf')](_0x54d0('0x10'))[_0x54d0('0x11')](_0x17bdc5)[_0x54d0('0x12')](_0x1e2112,null,_0x1e2112+_0x54d0('0x13')+_0x17bdc5+'.'+_0x1c2542)['where'](_0x17bdc5+'.'+_0x1c2542+_0x54d0('0x14')+_0x3c5286+'.'+_0x1c2542)[_0x54d0('0x15')](_0x1e2112+_0x54d0('0x16')+_0x584775['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x144f24,_0x5f01ff){promisesAdditionalPhones=[];return db[_0x54d0('0x17')][_0x54d0('0x18')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x3e52f6){if(_0x3e52f6!==null){var _0x514d78=[];for(var _0x2109b1=0x0;_0x2109b1<_0x3e52f6[_0x54d0('0x19')];_0x2109b1++){var _0x30ef5f=_0x3e52f6[_0x2109b1];_0x514d78['push'](insertAdditionalPhones(_0x30ef5f));}}Promise[_0x54d0('0x1a')](_0x514d78)[_0x54d0('0x1b')](function(){_0x144f24({'val':0x1});});});});}function insertAdditionalPhones(_0x5e2537){return new Promise(function(_0x505f09,_0x5d56cd){var _0x3ec975=_0x5e2537['AdditionalPhones'];var _0x29bb0c=_0x3ec975[_0x54d0('0x1c')](';');var _0xed9701=[];orderBy=0x0;for(var _0x3d1cfc=0x0;_0x3d1cfc<_0x29bb0c['length'];_0x3d1cfc++){_0xed9701[_0x54d0('0x1d')](splitAdditionalPhone(_0x5e2537['id'],_0x29bb0c[_0x3d1cfc]));}Promise[_0x54d0('0x1a')](_0xed9701)[_0x54d0('0x1b')](function(){_0x505f09({'val':_0x29bb0c[_0x54d0('0x19')]});});});}function splitAdditionalPhone(_0x171e35,_0x3e1785){return new Promise(function(_0x594ea4,_0x10ab77){var _0x53b177=_0x3e1785['split'](':');var _0x47a19c=_0x53b177[0x0];var _0x4d3cd4=_0x53b177[0x1];if(!_[_0x54d0('0x1e')](_0x4d3cd4)){var _0x152d3f=_0x4d3cd4[_0x54d0('0x1c')]('|');var _0x45da98=[];for(var _0xcba099=0x0;_0xcba099<_0x152d3f[_0x54d0('0x19')];_0xcba099++){if(_0x152d3f[_0xcba099]!==''){var _0x8dae51=_[_0x54d0('0x1f')](promisesAdditionalPhones,{'contactId':_0x171e35,'phone':_0x152d3f[_0xcba099]});if(_0x8dae51[_0x54d0('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x171e35,'contactTypeId':_0x47a19c,'phone':_0x152d3f[_0xcba099],'orderBy':orderBy});}}}_0x594ea4({'ok':0x1});}else _0x594ea4({'res':0x0});});}function createAdditionalPhone(_0xc6ae84,_0x50a5ac,_0x40af37,_0x9d4b13){var _0x408d82='';var _0x480c60='';var _0x131442=_0x40af37[_0x54d0('0x1c')]('§');_0x408d82=_0x131442[0x0];if(_0x131442[_0x54d0('0x19')]==0x2)_0x480c60=_0x131442[0x1];return new Promise(function(_0x5aef3e,_0x24d3cd){return db[_0x54d0('0x20')]['findOne']({'where':{'CmContactId':_0xc6ae84,'item':_0x408d82}})[_0x54d0('0x1b')](function(_0x15ea1a){if(_0x15ea1a){return db[_0x54d0('0x20')]['update']({'ItemTypeId':_0x50a5ac,'description':_0x480c60,'OrderBy':_0x9d4b13},{'where':{'CmContactId':_0xc6ae84,'item':_0x408d82}})['then'](function(_0x16784c){_0x5aef3e({'res':_0x54d0('0x21')});});}else{return db[_0x54d0('0x20')][_0x54d0('0x22')]({'CmContactId':_0xc6ae84,'item':_0x408d82,'description':_0x480c60,'ItemTypeId':_0x50a5ac,'OrderBy':_0x9d4b13,'ItemClass':_0x54d0('0x23')})['then'](function(_0x5d488b){_0x5aef3e({'res':'inserted'});});}});});}function insertCmHopper(_0x31bc84,_0x265fa5,_0x58c5ae,_0x4566c8,_0x4713da){var _0x447cea=['cm_contacts.phone','cm_contacts.scheduledat',_0x54d0('0x24'),_0x54d0('0x25'),_0x265fa5+'.'+_0x4566c8,_0x54d0('0x26'),'cm_contacts.updatedAt',_0x54d0('0x27'),'cm_contacts.UserId','\x22'+_0x4713da+'\x22'];return squel[_0x54d0('0x28')]()[_0x54d0('0x29')]('cm_hopper')['fromQuery']([_0x54d0('0x10'),'scheduledat',_0x54d0('0x2a'),_0x54d0('0x2b'),_0x4566c8,_0x54d0('0x2c'),_0x54d0('0x2d'),_0x54d0('0x2e'),_0x54d0('0x2f'),_0x54d0('0x30')],squel['select']()[_0x54d0('0x31')](_0x447cea)[_0x54d0('0x11')](_0x265fa5)[_0x54d0('0x12')](_0x54d0('0x32'),null,_0x54d0('0x33')+_0x265fa5+_0x54d0('0x34'))['join'](_0x58c5ae,null,_0x58c5ae+_0x54d0('0x13')+_0x265fa5+'.'+_0x4566c8)['where'](_0x265fa5+'.CmListId\x20=\x20?',_0x31bc84)[_0x54d0('0x15')](_0x54d0('0x35'),NOW)['where'](_0x54d0('0x36'),selectNotIn(_0x265fa5,_0x58c5ae,_0x4566c8,_0x54d0('0x37'),['\x22always\x22',_0x54d0('0x38')]))[_0x54d0('0x15')](_0x54d0('0x36'),selectNotIn(_0x265fa5,_0x58c5ae,_0x4566c8,_0x54d0('0x37'),[_0x54d0('0x39')])))[_0x54d0('0x3a')]();}function insertCmHopperBlack(_0x1d678e,_0x1afbce,_0x2f093c,_0x518f2d){var _0x1c3076=['cm_contacts.phone',_0x54d0('0x24'),'cm_contacts.ListId',_0x1afbce+'.'+_0x518f2d,'cm_contacts.createdAt',_0x54d0('0x3b')];return squel[_0x54d0('0x28')]()['into'](_0x54d0('0x3c'))[_0x54d0('0x3d')]([_0x54d0('0x10'),'ContactId',_0x54d0('0x2b'),_0x518f2d,'createdAt',_0x54d0('0x2d')],squel[_0x54d0('0x3e')]()[_0x54d0('0x31')](_0x1c3076)[_0x54d0('0x11')](_0x1afbce)[_0x54d0('0x12')]('cm_contacts',null,_0x54d0('0x33')+_0x1afbce+_0x54d0('0x34'))[_0x54d0('0x12')](_0x2f093c,null,_0x2f093c+'.id\x20=\x20'+_0x1afbce+'.'+_0x518f2d)[_0x54d0('0x15')](_0x1afbce+_0x54d0('0x3f'),_0x1d678e)[_0x54d0('0x15')](_0x54d0('0x35'),NOW)[_0x54d0('0x15')](_0x54d0('0x36'),squel[_0x54d0('0x3e')]()[_0x54d0('0xf')](_0x54d0('0x10'))[_0x54d0('0x11')](_0x54d0('0x3c'))[_0x54d0('0x15')](_0x54d0('0x40'),_0x1d678e)['where'](_0x518f2d+_0x54d0('0x14')+_0x1afbce+'.'+_0x518f2d)))[_0x54d0('0x3a')]();}function insertTzCmHopper(_0xd8fe06,_0x1be7ff,_0x3942da,_0x91f164,_0x4e5a53,_0x10755a){var _0x1e0211=[_0x54d0('0x41'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x10755a+_0x54d0('0x42'),_0x54d0('0x24'),'cm_contacts.ListId',_0x1be7ff+'.'+_0x91f164,_0x54d0('0x26'),_0x54d0('0x3b'),'cm_contacts.priority',_0x54d0('0x43'),'\x22'+_0x4e5a53+'\x22'];var _0x49eb8d=squel[_0x54d0('0x28')]()[_0x54d0('0x29')](_0x54d0('0x37'))[_0x54d0('0x3d')]([_0x54d0('0x10'),_0x54d0('0x44'),_0x54d0('0x2a'),_0x54d0('0x2b'),_0x91f164,_0x54d0('0x2c'),_0x54d0('0x2d'),_0x54d0('0x2e'),_0x54d0('0x2f'),_0x54d0('0x30')],squel[_0x54d0('0x3e')]()['fields'](_0x1e0211)[_0x54d0('0x11')](_0x1be7ff)[_0x54d0('0x12')]('cm_contacts',null,_0x54d0('0x33')+_0x1be7ff+_0x54d0('0x34'))['join'](_0x3942da,null,_0x3942da+_0x54d0('0x13')+_0x1be7ff+'.'+_0x91f164)[_0x54d0('0x12')](_0x10755a,null,_0x10755a+_0x54d0('0x13')+_0x1be7ff+'.'+_0x91f164)['where'](_0x1be7ff+_0x54d0('0x3f'),_0xd8fe06)[_0x54d0('0x15')](_0x54d0('0x35'),NOW)[_0x54d0('0x15')](_0x54d0('0x36'),selectNotIn(_0x1be7ff,_0x3942da,_0x91f164,_0x54d0('0x37'),[_0x54d0('0x39'),_0x54d0('0x38')]))['where'](_0x54d0('0x36'),selectNotIn(_0x1be7ff,_0x3942da,_0x91f164,_0x54d0('0x37'),[_0x54d0('0x39')])))[_0x54d0('0x3a')]();return _0x49eb8d;}function insertTzCmHopperBlack(_0x1c51ae,_0x5b485a,_0x371e07,_0x35a80a){var _0x3b1600=[_0x54d0('0x41'),_0x54d0('0x24'),_0x54d0('0x25'),_0x5b485a+'.'+_0x35a80a,_0x54d0('0x26'),'cm_contacts.updatedAt'];return squel[_0x54d0('0x28')]()[_0x54d0('0x29')]('cm_hopper_black')[_0x54d0('0x3d')]([_0x54d0('0x10'),'ContactId',_0x54d0('0x2b'),_0x35a80a,_0x54d0('0x2c'),_0x54d0('0x2d')],squel[_0x54d0('0x3e')]()[_0x54d0('0x31')](_0x3b1600)[_0x54d0('0x11')](_0x5b485a)[_0x54d0('0x12')]('cm_contacts',null,_0x54d0('0x33')+_0x5b485a+_0x54d0('0x34'))['join'](_0x371e07,null,_0x371e07+_0x54d0('0x13')+_0x5b485a+'.'+_0x35a80a)['where'](_0x5b485a+'.CmListId\x20=\x20?',_0x1c51ae)[_0x54d0('0x15')](_0x54d0('0x35'),NOW)[_0x54d0('0x15')](_0x54d0('0x36'),squel[_0x54d0('0x3e')]()[_0x54d0('0xf')](_0x54d0('0x10'))['from'](_0x54d0('0x3c'))['where'](_0x54d0('0x40'),_0x1c51ae)[_0x54d0('0x15')](_0x35a80a+_0x54d0('0x14')+_0x5b485a+'.'+_0x35a80a)))[_0x54d0('0x3a')]();}function insertCmHopperAdditionalPhones(_0x4b9882){var _0x498434=[_0x54d0('0x45'),_0x54d0('0x46'),'cm_contact_has_items.OrderBy',_0x54d0('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x54d0('0x28')]()[_0x54d0('0x29')](_0x54d0('0x48'))[_0x54d0('0x3d')]([_0x54d0('0x49'),_0x54d0('0x10'),_0x54d0('0x4a'),_0x54d0('0x2c'),'updatedAt'],squel[_0x54d0('0x3e')]()[_0x54d0('0x31')](_0x498434)[_0x54d0('0x11')](_0x54d0('0x37'))[_0x54d0('0x12')](_0x54d0('0x32'),null,_0x54d0('0x4b'))[_0x54d0('0x12')]('cm_contact_has_items',null,_0x54d0('0x4c'))[_0x54d0('0x15')]('cm_hopper.ListId\x20=\x20?',_0x4b9882)[_0x54d0('0x15')](_0x54d0('0x35'),NOW))['toString']();}function insertCmContact(_0x90af70,_0x5bb50d,_0x9b5c49,_0x26d96a){var _0x3ae744=_[_0x54d0('0x4d')](_[_0x54d0('0x4e')](_0x26d96a),[_0x54d0('0x2b'),'CompanyId',_0x54d0('0x2c'),_0x54d0('0x2d'),'scheduledAt']);return squel[_0x54d0('0x28')]()['into'](_0x54d0('0x32'))[_0x54d0('0x3d')](_0x3ae744,squel[_0x54d0('0x3e')]()[_0x54d0('0x31')](_0x3ae744)[_0x54d0('0x11')](_0x5bb50d)[_0x54d0('0x15')]('('+_0x9b5c49[_0x54d0('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x54d0('0x3e')]()['fields'](_0x9b5c49)[_0x54d0('0x11')](_0x54d0('0x32'))[_0x54d0('0x15')](_0x54d0('0x40'),_0x90af70)[_0x54d0('0x15')](_0x54d0('0x4f')))[_0x54d0('0x15')](_0x54d0('0x50'),squel['select']()[_0x54d0('0xf')](_0x54d0('0x51'),'min_id')['from'](_0x5bb50d)[_0x54d0('0x52')](_0x9b5c49[_0x54d0('0x12')](','))))['toString']();}function handleStop(){logger[_0x54d0('0x53')](_0x54d0('0x54'));stopped=!![];}function handleUncaughtException(_0x568350){logger[_0x54d0('0x55')](_0x568350[_0x54d0('0x56')]);process['exit'](0x1);}function handleError(_0x1ac8b0,_0x2cd851){stats[_0x54d0('0x57')][_0x54d0('0x1d')]({'name':_0x2cd851[_0x54d0('0x58')],'message':_0x2cd851['message'],'row':_0x1ac8b0});}function handleQuery(_0x1a9eb8){logger['info'](_0x1a9eb8);return db[_0x54d0('0x59')][_0x54d0('0x5a')](_0x1a9eb8)[_0x54d0('0x5b')](function(_0x159f5e){results['push'](_0x159f5e);})[_0x54d0('0x5c')](function(_0x43979c){logger[_0x54d0('0x55')](_0x43979c[_0x54d0('0x56')]);});}function updateTzCampaigns(_0x387301){return new Promise(function(_0x5ae654,_0x1f3629){var _0x49f028=squel['select']()[_0x54d0('0x31')](['campaigns.id','campaigns.dialTimezone'])['from'](_0x54d0('0x5d'))[_0x54d0('0x12')](_0x54d0('0x5e'),null,_0x54d0('0x5f'))['where'](_0x54d0('0x60')+_0x387301);db[_0x54d0('0x59')][_0x54d0('0x5a')](_0x49f028['toString']())[_0x54d0('0x5b')](function(_0x5c87af){var _0x157f0f=[];for(var _0x581b09=0x0;_0x581b09<_0x5c87af[_0x54d0('0x19')];_0x581b09++){_0x157f0f[_0x54d0('0x1d')](getTimezoneData(_0x5c87af[_0x581b09],tmp_campaigns));}BPromise['all'](_0x157f0f)[_0x54d0('0x1b')](function(){_0x5ae654({'val':0x1});});})['catch'](function(_0x4216c1){logger[_0x54d0('0x55')](_0x4216c1[_0x54d0('0x56')]);_0x5ae654({'val':0x0});});});}function updateTzVoiceQueues(_0x5ad165){return new Promise(function(_0x32e2b7,_0x104cf1){var _0x6f60f3=squel[_0x54d0('0x3e')]()[_0x54d0('0x31')](['voice_queues.id',_0x54d0('0x61')])[_0x54d0('0x11')]('voice_queues')[_0x54d0('0x12')](_0x54d0('0x62'),null,_0x54d0('0x63'))['where'](_0x54d0('0x64')+_0x5ad165);db[_0x54d0('0x59')][_0x54d0('0x5a')](_0x6f60f3[_0x54d0('0x3a')]())[_0x54d0('0x5b')](function(_0x5911d0){var _0x9bcf4=[];for(var _0x3dbf7f=0x0;_0x3dbf7f<_0x5911d0[_0x54d0('0x19')];_0x3dbf7f++){_0x9bcf4[_0x54d0('0x1d')](getTimezoneData(_0x5911d0[_0x3dbf7f],tmp_voice_queues));}BPromise[_0x54d0('0x1a')](_0x9bcf4)[_0x54d0('0x1b')](function(){_0x32e2b7({'val':0x1});});})[_0x54d0('0x5c')](function(_0x1f5563){logger['error'](_0x1f5563[_0x54d0('0x56')]);_0x32e2b7({'val':0x0});});});}function getTimezoneData(_0x5ec60f,_0x1088ee){return new Promise(function(_0x241d30,_0x287e1d){var _0x4c251f=shared[_0x54d0('0x65')];var _0x5f56c2=_0x4c251f[_0x5ec60f[_0x54d0('0x66')]];if(_[_0x54d0('0x1e')](_0x5f56c2)){_0x241d30({'ret':0x1});}else{var _0x100426=_0x5f56c2['utcOffset'];var _0x1defbe=squel['insert']()[_0x54d0('0x29')](_0x1088ee)[_0x54d0('0x67')]('id',_0x5ec60f['id'])[_0x54d0('0x67')](_0x54d0('0x68'),_0x100426)['set'](_0x54d0('0x66'),_0x5ec60f[_0x54d0('0x66')])[_0x54d0('0x3a')]();return db[_0x54d0('0x59')][_0x54d0('0x5a')](_0x1defbe)[_0x54d0('0x5b')](function(_0x2d3c05){_0x241d30({'ret':0x1});})[_0x54d0('0x5c')](function(_0x13b6bf){logger['error'](_0x13b6bf['message']);_0x287e1d({'ret':0x1});});}});}function handleTZQuery(_0x380f8a){logger[_0x54d0('0x53')](_0x380f8a);return db[_0x54d0('0x59')][_0x54d0('0x5a')](_0x380f8a)[_0x54d0('0x5b')](function(_0xced438){})['catch'](function(_0x4419a8){logger[_0x54d0('0x55')](_0x4419a8[_0x54d0('0x56')]);});}function main(_0xaa5e5,_0x440ca5,_0x4495d8,_0x3ab8d0){logger['info']('main',_0xaa5e5,JSON[_0x54d0('0x69')](_0x440ca5));process['send'](_0x54d0('0x6a'));var _0x1eadf1=_0x440ca5[_0x54d0('0x6b')];var _0x52513e=_[_0x54d0('0x6c')](_0x1eadf1);var _0x45d637=_0x440ca5[_0x54d0('0x6d')];var _0x310d5f=path[_0x54d0('0x12')](config[_0x54d0('0x6e')],_0x54d0('0x6f'),_0x45d637+_0x54d0('0x70'));hasTZ=_[_0x54d0('0x4e')](_0x1eadf1)[_0x54d0('0x71')](_0x54d0('0x66'));var _0x21f735=_[_0x54d0('0x4e')](_0x1eadf1)['join']();logger[_0x54d0('0x53')](_0x54d0('0x72'),_0x21f735);db[_0x54d0('0x73')][_0x54d0('0x18')]({'raw':!![],'attributes':['id',_0x54d0('0x74')]})[_0x54d0('0x1b')](function(_0x4d07ec){for(var _0x1917f1=0x0;_0x1917f1<_0x4d07ec['length'];_0x1917f1++){if(_0x4d07ec[_0x1917f1][_0x54d0('0x74')]in _0x1eadf1){contactItemTypes[_0x54d0('0x1d')](_0x4d07ec[_0x1917f1]);delete _0x52513e[_0x4d07ec[_0x1917f1][_0x54d0('0x74')]];hasAdditionalPhones=!![];}for(var _0x1263af in _0x1eadf1){if(_0x4d07ec[_0x1917f1]['name']+_0x54d0('0x75')===_0x1263af){phoneDescriptions[_0x54d0('0x1d')]({'itemTypeId':_0x4d07ec[_0x1917f1]['id'],'description':_0x1263af});delete _0x52513e[_0x1263af];}}}if(hasAdditionalPhones)_0x52513e[_0x54d0('0x76')]='';var _0xf7553c=_[_0x54d0('0x4e')](_0x52513e)['join']();logger[_0x54d0('0x53')](_0x54d0('0x72'),_0xf7553c);fs[_0x54d0('0x77')](_0x310d5f,_0xf7553c+'\x0a');Papa[_0x54d0('0x78')](fs[_0x54d0('0x79')](_0xaa5e5),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf2661f,_0x4249e2){try{for(var _0xa4f851=0x0,_0x29aa0d=[];_0xa4f851<_0xf2661f[_0x54d0('0x7a')]['length'];_0xa4f851++){stats[_0x54d0('0x7b')]+=0x1;if(_0xf2661f['errors'][_0xa4f851]){handleError(_0xf2661f['data'][_0xa4f851],_0xf2661f['errors'][_0xa4f851]);}else{var _0x5d6968=[];var _0x18a2d4=[];var _0x4d68e9={};for(var _0xc60d9e in _0x1eadf1){let _0x55ac71=contactItemTypes[_0x54d0('0x7c')](_0x1478be=>_0x1478be['name']===_0xc60d9e);let _0xae6f19=contactItemTypes[_0x54d0('0x7c')](_0x1922d0=>_0x1922d0['name']+_0x54d0('0x75')===_0xc60d9e);if(_[_0x54d0('0x1e')](_0x55ac71)&&_[_0x54d0('0x1e')](_0xae6f19)){if(_0x1eadf1[_0x54d0('0x7d')](_0xc60d9e)){if(_0xf2661f[_0x54d0('0x7a')][_0xa4f851][_0x1eadf1[_0xc60d9e]]){var _0x3e7e91=_['trim'](_0xf2661f[_0x54d0('0x7a')][_0xa4f851][_0x1eadf1[_0xc60d9e]][_0x54d0('0x7e')](/"/g,'\x27'));switch(_0xc60d9e){case'scheduledat':var _0xc8fd03=moment(_0x3e7e91,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xc8fd03['isValid']()){_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x3e7e91+'\x22');}else{_0x5d6968['push'](_0x54d0('0x7f'));}break;case'priority':var _0xb307bb=parseInt(_0x3e7e91);_0x3e7e91=_['isNaN'](_0xb307bb)||_0xb307bb<0x0||_0xb307bb>0x4?_0x3ab8d0?0x3:0x2:_0xb307bb;_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x3e7e91+'\x22');break;case _0x54d0('0x2f'):var _0x5e5efe=parseInt(_0x3e7e91);if(_['isNumber'](_0x5e5efe)&&_['includes'](_0x4495d8,_0x5e5efe)){_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x5e5efe+'\x22');}else{_0x5d6968['push'](_0x54d0('0x80'));}break;case _0x54d0('0x81'):if(isEmail(_0x3e7e91)){_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x3e7e91+'\x22');}else{_0x5d6968[_0x54d0('0x1d')](_0x54d0('0x82'));}break;case _0x54d0('0x83'):var _0x4fa5a1=moment(_0x3e7e91,_0x54d0('0x84'),!![]);if(_0x4fa5a1[_0x54d0('0x85')]()){_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x3e7e91+'\x22');}else{_0x5d6968[_0x54d0('0x1d')](_0x54d0('0x86'));}break;case _0x54d0('0x66'):var _0x219a95=shared['timezones'];var _0x2d3f82=_0x219a95[_0x3e7e91];if(!_[_0x54d0('0x1e')](_0x2d3f82)){var _0x280d2f=_0x2d3f82[_0x54d0('0x87')];_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x3e7e91+'\x22');_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x280d2f+'\x22');}break;default:_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x3e7e91+'\x22');}}else{switch(_0xc60d9e){case _0x54d0('0x88'):case'phone':_0x5d6968[_0x54d0('0x1d')](_0xc60d9e+_0x54d0('0x89'));break;default:_0x29aa0d[_0x54d0('0x1d')]('\x22\x22');}}}}else{var _0x17d5a7='';if(!_[_0x54d0('0x1e')](_0x55ac71)){if(!_0x4d68e9['hasOwnProperty'](_0x55ac71['id'])){if(!_[_0x54d0('0x1e')](_0xf2661f[_0x54d0('0x7a')][_0xa4f851][_0x1eadf1[_0xc60d9e]])){var _0x3e7e91=_[_0x54d0('0x8a')](_0xf2661f['data'][_0xa4f851][_0x1eadf1[_0xc60d9e]][_0x54d0('0x7e')](/"/g,'\x27'));var _0x5e8126=phoneDescriptions['find'](_0x2b998d=>_0x2b998d[_0x54d0('0x8b')]===_0x55ac71['id']);if(!_[_0x54d0('0x1e')](_0x5e8126)){var _0x4abe03=_[_0x54d0('0x8a')](_0xf2661f[_0x54d0('0x7a')][_0xa4f851][_0x1eadf1[_0x5e8126[_0x54d0('0x8c')]]][_0x54d0('0x7e')](/"/g,'\x27'));if(!_[_0x54d0('0x1e')](_0x4abe03))_0x3e7e91=_0x3e7e91+'§'+_0x4abe03;}if(_0x17d5a7=='')_0x17d5a7=_0x3e7e91;else _0x17d5a7+='|'+_0x3e7e91;}_0x18a2d4[_0x54d0('0x1d')](_0x55ac71['id']+':'+_0x17d5a7);_0x4d68e9[_0x55ac71['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29aa0d[_0x54d0('0x1d')]('\x22'+_0x18a2d4[_0x54d0('0x12')](';')+'\x22');}if(_0x5d6968[_0x54d0('0x19')]){handleError(_0xf2661f[_0x54d0('0x7a')][_0xa4f851],{'code':_0x54d0('0x8d'),'message':_0x5d6968[_0x54d0('0x12')]()});}else{fs[_0x54d0('0x8e')](_0x310d5f,_0x29aa0d['join']()+'\x0a');}_0x29aa0d=[];}if(!(stats[_0x54d0('0x7b')]%0xc8)){socket[_0x54d0('0x8f')](_0x54d0('0x90')+_0x45d637,stats);stats[_0x54d0('0x57')]=[];}}if(stopped){logger[_0x54d0('0x53')](_0x54d0('0x91'));_0x4249e2[_0x54d0('0x92')]();}}catch(_0x59a88f){handleError(_0xf2661f[_0x54d0('0x7a')][_0xa4f851],{'code':'SystemError','message':_0x59a88f[_0x54d0('0x56')]});logger['error'](_0x54d0('0x93'),_0x59a88f['message']);}},'complete':function(){try{var _0x4d9bd9=[];var _0x1a1fe3=[];var _0x2586b8='cm_contacts';if(_0x440ca5[_0x54d0('0x94')]&&_0x440ca5[_0x54d0('0x94')]['length']){_0x2586b8=_0x54d0('0x95')+_0x45d637;_0x4d9bd9[_0x54d0('0x1d')]('CREATE\x20TABLE\x20'+_0x2586b8+_0x54d0('0x96'));}tmp_campaigns=_0x54d0('0x97')+_0x45d637;tmp_voice_queues=_0x54d0('0x98')+_0x45d637;_0x1a1fe3['push']('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x1a1fe3[_0x54d0('0x1d')](_0x54d0('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x54d0('0x9a')](_0x1a1fe3,handleTZQuery)[_0x54d0('0x1b')](function(_0x3ad5f6){updateTzCampaigns(_0x440ca5[_0x54d0('0x2b')])['then'](function(_0x34b841){updateTzVoiceQueues(_0x440ca5[_0x54d0('0x2b')])[_0x54d0('0x1b')](function(_0x2e69e8){if(hasTZ)_0xf7553c=_0xf7553c[_0x54d0('0x7e')]('dialTimezone',_0x54d0('0x9b'));var _0x66d024=util[_0x54d0('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x310d5f,_0x2586b8,_0xf7553c,_0x440ca5[_0x54d0('0x2b')],_0x440ca5['CompanyId']||null,NOW,NOW);if(_[_0x54d0('0x1e')](_0x1eadf1[_0x54d0('0x44')])){_0x66d024+=_0x54d0('0x9c');}_0x4d9bd9[_0x54d0('0x1d')](_0x66d024);if(_0x440ca5[_0x54d0('0x94')]&&_0x440ca5['duplicates'][_0x54d0('0x19')]){_0x4d9bd9[_0x54d0('0x1d')](insertCmContact(_0x440ca5[_0x54d0('0x2b')],_0x2586b8,_0x440ca5[_0x54d0('0x94')],_0x1eadf1));_0x4d9bd9['push']('DROP\x20TABLE\x20'+_0x2586b8+';');}BPromise['each'](_0x4d9bd9,handleQuery)['then'](function(_0x235987){BPromise['all']([handleAdditionalPhones()])[_0x54d0('0x1b')](function(){_0x4d9bd9=[];for(var _0x39d2fe=0x0;_0x39d2fe\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','from','join','where','sequelize','query','spread','isNil','AdditionalPhones','push','all','then','catch','error','message','length','split','filter','CmContactHasItem','findOne','updated','create','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','cm_hopper','\x22always\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?'];(function(_0x4fe2d7,_0x453708){var _0x123262=function(_0x4e452f){while(--_0x4e452f){_0x4fe2d7['push'](_0x4fe2d7['shift']());}};_0x123262(++_0x453708);}(_0xa88f,0x182));var _0xfa88=function(_0x2e0276,_0x51d7b8){_0x2e0276=_0x2e0276-0x0;var _0x7204fe=_0xa88f[_0x2e0276];return _0x7204fe;};'use strict';var fs=require('fs');var path=require(_0xfa88('0x0'));var _=require(_0xfa88('0x1'));var Papa=require(_0xfa88('0x2'));var util=require(_0xfa88('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xfa88('0x4'));var Redis=require(_0xfa88('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xfa88('0x6'));var logger=require(_0xfa88('0x7'))(_0xfa88('0x8'));config[_0xfa88('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfa88('0xa'))(new Redis(config[_0xfa88('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xfa88('0xb')](_0xfa88('0xc'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0xfa88('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4037e3){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))*$/[_0xfa88('0xe')](_0x4037e3);}function selectNotIn(_0x4b375c,_0x1d8487,_0x102d10,_0x4d92e7,_0x2432cd){return squel[_0xfa88('0xf')]()[_0xfa88('0x10')](_0xfa88('0x11'))[_0xfa88('0x12')](_0x4d92e7)[_0xfa88('0x13')](_0x1d8487,null,_0x1d8487+'.id\x20=\x20'+_0x4d92e7+'.'+_0x102d10)[_0xfa88('0x14')](_0x4d92e7+'.'+_0x102d10+'\x20=\x20'+_0x4b375c+'.'+_0x102d10)[_0xfa88('0x14')](_0x1d8487+'.dialCheckDuplicateType\x20IN\x20('+_0x2432cd[_0xfa88('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3448a5,_0x5c8c11){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfa88('0x15')][_0xfa88('0x16')]('select\x20*\x20from\x20'+tempTableName)[_0xfa88('0x17')](function(_0x39e9c5){if(_0x39e9c5!==null){var _0x40daca=[];for(var _0x18380a=0x0;_0x18380a<_0x39e9c5['length'];_0x18380a++){var _0x20a4c2=_0x39e9c5[_0x18380a];if(!_[_0xfa88('0x18')](_0x20a4c2[_0xfa88('0x11')])){if(!_[_0xfa88('0x18')](_0x20a4c2[_0xfa88('0x19')]))_0x40daca[_0xfa88('0x1a')](insertAdditionalPhones(_0x20a4c2));promisesContact['push']({'contact':_0x20a4c2});}}}Promise[_0xfa88('0x1b')](_0x40daca)[_0xfa88('0x1c')](function(){_0x3448a5({'val':0x1});});})[_0xfa88('0x1d')](function(_0x4d1489){logger[_0xfa88('0x1e')](_0x4d1489[_0xfa88('0x1f')]);});});}function insertAdditionalPhones(_0x5a225e){return new Promise(function(_0x1e6897,_0x15c286){var _0x48c827=_0x5a225e[_0xfa88('0x19')];if(_[_0xfa88('0x18')](_0x48c827))_0x15c286({'val':0x0});else{var _0x1b0808=_0x48c827['split'](';');var _0x5191af=[];orderBy=0x0;for(var _0x394b93=0x0;_0x394b93<_0x1b0808[_0xfa88('0x20')];_0x394b93++){_0x5191af[_0xfa88('0x1a')](splitAdditionalPhone(_0x5a225e['id'],_0x1b0808[_0x394b93]));}Promise['all'](_0x5191af)[_0xfa88('0x1c')](function(){_0x1e6897({'val':_0x1b0808[_0xfa88('0x20')]});});}});}function splitAdditionalPhone(_0x49d00e,_0x5eb8d1){return new Promise(function(_0x5e0d7f,_0x52bf05){var _0x4f0d16=_0x5eb8d1['split'](':');var _0x254790=_0x4f0d16[0x0];var _0x1be550=_0x4f0d16[0x1];if(_0x1be550!==''){var _0x5cbc65=_0x1be550[_0xfa88('0x21')]('|');var _0x14eb41=[];for(var _0x4cda27=0x0;_0x4cda27<_0x5cbc65[_0xfa88('0x20')];_0x4cda27++){if(_0x5cbc65[_0x4cda27]!==''){var _0x3114a8=_[_0xfa88('0x22')](promisesAdditionalPhones,{'contactId':_0x49d00e,'phone':_0x5cbc65[_0x4cda27]});if(_0x3114a8['length']==0x0){orderBy++;promisesAdditionalPhones[_0xfa88('0x1a')]({'contactId':_0x49d00e,'contactTypeId':_0x254790,'phone':_0x5cbc65[_0x4cda27],'orderBy':orderBy});}}}_0x5e0d7f({'ok':0x1});}else _0x5e0d7f({'res':0x0});});}function createAdditionalPhone(_0x193580,_0x586b99,_0x8aaf7c,_0x90ef74){var _0x13b87b='';var _0x584e7b='';var _0x30ca6c=_0x8aaf7c[_0xfa88('0x21')]('§');_0x13b87b=_0x30ca6c[0x0];if(_0x30ca6c[_0xfa88('0x20')]==0x2)_0x584e7b=_0x30ca6c[0x1];return new Promise(function(_0x245ee3,_0x45e65f){return db[_0xfa88('0x23')][_0xfa88('0x24')]({'where':{'CmContactId':_0x193580,'item':_0x13b87b}})[_0xfa88('0x1c')](function(_0x1628a4){if(_0x1628a4){return db[_0xfa88('0x23')]['update']({'ItemTypeId':_0x586b99,'description':_0x584e7b,'OrderBy':_0x90ef74},{'where':{'CmContactId':_0x193580,'item':_0x13b87b}})[_0xfa88('0x1c')](function(_0x1951fb){_0x245ee3({'res':_0xfa88('0x25')});});}else{return db[_0xfa88('0x23')][_0xfa88('0x26')]({'CmContactId':_0x193580,'item':_0x13b87b,'ItemTypeId':_0x586b99,'description':_0x584e7b,'OrderBy':_0x90ef74,'ItemClass':'PHONE'})[_0xfa88('0x1c')](function(_0x5a3749){_0x245ee3({'res':_0xfa88('0x27')});});}});});}function updateContact(_0x45cdf5){return new Promise(function(_0x596e7c,_0x22a27c){var _0x1682c3=_0x45cdf5['id'];delete _0x45cdf5['id'];return db['CmContact'][_0xfa88('0x28')](_0x45cdf5,{'where':{'id':_0x1682c3}})[_0xfa88('0x1c')](function(_0x3b1b8a){updatedRows+=0x1;return db[_0xfa88('0x29')][_0xfa88('0x28')]({'phone':_0x45cdf5['phone']},{'where':{'ContactId':_0x1682c3}})[_0xfa88('0x1c')](function(_0x165d25){_0x596e7c({'ret':'OK'});});});});}function insertCmHopper(_0x2af9fa,_0x5094e9,_0x1ee6b9,_0x35b984,_0x11e777){var _0x31978f=[_0xfa88('0x2a'),'cm_contacts.scheduledat',_0xfa88('0x2b'),_0xfa88('0x2c'),_0x5094e9+'.'+_0x35b984,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xfa88('0x2d'),_0xfa88('0x2e'),'\x22'+_0x11e777+'\x22'];return squel['insert']()[_0xfa88('0x2f')]('cm_hopper')[_0xfa88('0x30')]([_0xfa88('0x11'),'scheduledat',_0xfa88('0x31'),_0xfa88('0x32'),_0x35b984,_0xfa88('0x33'),_0xfa88('0x34'),'priority',_0xfa88('0x35'),_0xfa88('0x36')],squel[_0xfa88('0xf')]()['fields'](_0x31978f)[_0xfa88('0x12')](_0x5094e9)[_0xfa88('0x13')](_0xfa88('0x37'),null,_0xfa88('0x38')+_0x5094e9+_0xfa88('0x39'))[_0xfa88('0x13')](_0x1ee6b9,null,_0x1ee6b9+_0xfa88('0x3a')+_0x5094e9+'.'+_0x35b984)[_0xfa88('0x14')](_0x5094e9+_0xfa88('0x3b'),_0x2af9fa)[_0xfa88('0x14')](_0xfa88('0x3c'),NOW)[_0xfa88('0x14')](_0xfa88('0x3d'),selectNotIn(_0x5094e9,_0x1ee6b9,_0x35b984,'cm_hopper',['\x22always\x22',_0xfa88('0x3e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5094e9,_0x1ee6b9,_0x35b984,_0xfa88('0x3f'),[_0xfa88('0x40')])))[_0xfa88('0x41')]();}function insertCmHopperBlack(_0x4357d1,_0x54949c,_0xf9105d,_0x437177){var _0x4570ec=[_0xfa88('0x2a'),_0xfa88('0x2b'),_0xfa88('0x2c'),_0x54949c+'.'+_0x437177,_0xfa88('0x42'),_0xfa88('0x43')];return squel[_0xfa88('0x44')]()[_0xfa88('0x2f')](_0xfa88('0x45'))['fromQuery']([_0xfa88('0x11'),_0xfa88('0x31'),_0xfa88('0x32'),_0x437177,'createdAt',_0xfa88('0x34')],squel[_0xfa88('0xf')]()[_0xfa88('0x46')](_0x4570ec)[_0xfa88('0x12')](_0x54949c)['join'](_0xfa88('0x37'),null,_0xfa88('0x38')+_0x54949c+_0xfa88('0x39'))[_0xfa88('0x13')](_0xf9105d,null,_0xf9105d+_0xfa88('0x3a')+_0x54949c+'.'+_0x437177)[_0xfa88('0x14')](_0x54949c+_0xfa88('0x3b'),_0x4357d1)[_0xfa88('0x14')](_0xfa88('0x3c'),NOW)[_0xfa88('0x14')](_0xfa88('0x3d'),squel[_0xfa88('0xf')]()['field'](_0xfa88('0x11'))[_0xfa88('0x12')](_0xfa88('0x45'))[_0xfa88('0x14')](_0xfa88('0x47'),_0x4357d1)['where'](_0x437177+_0xfa88('0x48'),_0x54949c+'.'+_0x437177)))[_0xfa88('0x41')]();}function insertCmHopperAdditionalPhones(_0x3c0395){var _0x12efed=[_0xfa88('0x49'),_0xfa88('0x4a'),_0xfa88('0x4b'),_0xfa88('0x4c'),_0xfa88('0x4d')];return squel[_0xfa88('0x44')]()[_0xfa88('0x2f')]('cm_hopper_additional_phones')['fromQuery']([_0xfa88('0x4e'),_0xfa88('0x11'),'OrderBy',_0xfa88('0x33'),_0xfa88('0x34')],squel[_0xfa88('0xf')]()['fields'](_0x12efed)[_0xfa88('0x12')](_0xfa88('0x3f'))[_0xfa88('0x13')](_0xfa88('0x37'),null,_0xfa88('0x4f'))['join'](_0xfa88('0x50'),null,_0xfa88('0x51'))['where'](_0xfa88('0x52'),_0x3c0395)[_0xfa88('0x14')](_0xfa88('0x3c'),NOW))[_0xfa88('0x41')]();}function insertCmContact(_0x56f934,_0x3f9c85,_0x4963d1,_0x4ff262){var _0x1915d5=_['concat'](_[_0xfa88('0x53')](_0x4ff262),[_0xfa88('0x32'),'CompanyId',_0xfa88('0x33'),_0xfa88('0x34')]);return squel[_0xfa88('0x44')]()[_0xfa88('0x2f')](_0xfa88('0x37'))['fromQuery'](_0x1915d5,squel[_0xfa88('0xf')]()[_0xfa88('0x46')](_0x1915d5)['from'](_0x3f9c85)[_0xfa88('0x14')]('('+_0x4963d1[_0xfa88('0x13')](',')+_0xfa88('0x54'),squel[_0xfa88('0xf')]()[_0xfa88('0x46')](_0x4963d1)[_0xfa88('0x12')]('cm_contacts')['where'](_0xfa88('0x47'),_0x56f934))[_0xfa88('0x14')](_0xfa88('0x55'),squel['select']()[_0xfa88('0x10')](_0xfa88('0x56'),_0xfa88('0x57'))['from'](_0x3f9c85)[_0xfa88('0x58')](_0x4963d1[_0xfa88('0x13')](','))))[_0xfa88('0x41')]();}function handleStop(){logger[_0xfa88('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2d56eb){logger['error'](_0x2d56eb[_0xfa88('0x1f')]);process['exit'](0x1);}function handleError(_0x19aed8,_0x8f0319){stats[_0xfa88('0x5a')][_0xfa88('0x1a')]({'name':_0x8f0319[_0xfa88('0x5b')],'message':_0x8f0319[_0xfa88('0x1f')],'row':_0x19aed8});}function handleQuery(_0x2a6129){logger['info'](_0x2a6129);return db[_0xfa88('0x15')][_0xfa88('0x16')](_0x2a6129)[_0xfa88('0x17')](function(_0x2e5b0d){results[_0xfa88('0x1a')](_0x2e5b0d);})['catch'](function(_0x35285c){logger[_0xfa88('0x1e')](_0x35285c['message']);});}function main(_0x4ce9b5,_0x19a16e,_0x1a6b2e,_0x2d06e3){logger['info']('main',_0x4ce9b5,JSON['stringify'](_0x19a16e));process[_0xfa88('0x5c')]('start');var _0x28ea6a=_0x19a16e[_0xfa88('0x5d')];var _0x183721=_[_0xfa88('0x5e')](_0x28ea6a);var _0x6b2852=_0x19a16e['socket_timestamp'];var _0x1d3162=path['join'](config[_0xfa88('0x5f')],_0xfa88('0x60'),_0x6b2852+_0xfa88('0x61'));logger[_0xfa88('0x59')](_0xfa88('0x62'),_0x19a16e);db[_0xfa88('0x63')]['findAll']({'raw':!![],'attributes':['id',_0xfa88('0x64')]})[_0xfa88('0x1c')](function(_0x5992ff){for(var _0x3a4a8f=0x0;_0x3a4a8f<_0x5992ff[_0xfa88('0x20')];_0x3a4a8f++){if(_0x5992ff[_0x3a4a8f][_0xfa88('0x64')]in _0x28ea6a){contactItemTypes[_0xfa88('0x1a')](_0x5992ff[_0x3a4a8f]);delete _0x183721[_0x5992ff[_0x3a4a8f][_0xfa88('0x64')]];hasAdditionalPhones=!![];}for(var _0x39fc04 in _0x28ea6a){if(_0x5992ff[_0x3a4a8f][_0xfa88('0x64')]+_0xfa88('0x65')===_0x39fc04){phoneDescriptions[_0xfa88('0x1a')]({'itemTypeId':_0x5992ff[_0x3a4a8f]['id'],'description':_0x39fc04});delete _0x183721[_0x39fc04];}}}if(hasAdditionalPhones)_0x183721['AdditionalPhones']='';var _0x5b5f56=_[_0xfa88('0x53')](_0x183721)[_0xfa88('0x13')]();logger[_0xfa88('0x59')](_0xfa88('0x66'),_0x5b5f56);fs[_0xfa88('0x67')](_0x1d3162,_0x5b5f56+'\x0a');Papa['parse'](fs['createReadStream'](_0x4ce9b5),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb940a,_0x2d010f){try{for(var _0x5128f7=0x0,_0x58769c=[];_0x5128f7<_0xb940a[_0xfa88('0x68')]['length'];_0x5128f7++){stats['rows']+=0x1;if(_0xb940a['errors'][_0x5128f7]){handleError(_0xb940a[_0xfa88('0x68')][_0x5128f7],_0xb940a['errors'][_0x5128f7]);}else{var _0xa772=[];var _0x48dcb=[];var _0x474fad={};for(var _0xa91137 in _0x28ea6a){let _0x3c2fff=contactItemTypes[_0xfa88('0x69')](_0x4657df=>_0x4657df['name']===_0xa91137);let _0x2f008a=contactItemTypes[_0xfa88('0x69')](_0x42baf3=>_0x42baf3[_0xfa88('0x64')]+_0xfa88('0x65')===_0xa91137);if(_[_0xfa88('0x18')](_0x3c2fff)&&_[_0xfa88('0x18')](_0x2f008a)){if(_0x28ea6a[_0xfa88('0x6a')](_0xa91137)){if(_0xb940a[_0xfa88('0x68')][_0x5128f7][_0x28ea6a[_0xa91137]]){var _0xa884d5=_['trim'](_0xb940a[_0xfa88('0x68')][_0x5128f7][_0x28ea6a[_0xa91137]][_0xfa88('0x6b')](/"/g,'\x27'));switch(_0xa91137){case _0xfa88('0x6c'):var _0x33d7bc=moment(_0xa884d5,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x33d7bc[_0xfa88('0x6d')]()){_0x58769c['push']('\x22'+_0xa884d5+'\x22');}else{_0xa772[_0xfa88('0x1a')](_0xfa88('0x6e'));}break;case _0xfa88('0x6f'):var _0xee8722=parseInt(_0xa884d5);_0xa884d5=_[_0xfa88('0x70')](_0xee8722)||_0xee8722<0x0||_0xee8722>0x4?_0x2d06e3?0x3:0x2:_0xee8722;_0x58769c[_0xfa88('0x1a')]('\x22'+_0xa884d5+'\x22');break;case _0xfa88('0x35'):var _0x1946e1=parseInt(_0xa884d5);if(_[_0xfa88('0x71')](_0x1946e1)&&_[_0xfa88('0x72')](_0x1a6b2e,_0x1946e1)){_0x58769c[_0xfa88('0x1a')]('\x22'+_0x1946e1+'\x22');}else{_0xa772['push'](_0xfa88('0x73'));}break;case _0xfa88('0x74'):if(isEmail(_0xa884d5)){_0x58769c[_0xfa88('0x1a')]('\x22'+_0xa884d5+'\x22');}else{_0xa772['push'](_0xfa88('0x75'));}break;case _0xfa88('0x76'):var _0x557135=moment(_0xa884d5,_0xfa88('0x77'),!![]);if(_0x557135[_0xfa88('0x6d')]()){_0x58769c[_0xfa88('0x1a')]('\x22'+_0xa884d5+'\x22');}else{_0xa772[_0xfa88('0x1a')](_0xfa88('0x78'));}break;default:_0x58769c[_0xfa88('0x1a')]('\x22'+_0xa884d5+'\x22');}}else{switch(_0xa91137){case _0xfa88('0x79'):case'phone':_0xa772[_0xfa88('0x1a')](_0xa91137+_0xfa88('0x7a'));break;default:_0x58769c[_0xfa88('0x1a')]('\x22\x22');}}}}else{var _0x1a33f5='';if(!_[_0xfa88('0x18')](_0x3c2fff)){if(!_0x474fad[_0xfa88('0x6a')](_0x3c2fff['id'])){for(var _0xaaeacc=0x0;_0xaaeacc<_0x28ea6a[_0xa91137][_0xfa88('0x20')];_0xaaeacc++){var _0xa884d5=_[_0xfa88('0x7b')](_0xb940a[_0xfa88('0x68')][_0x5128f7][_0x28ea6a[_0xa91137][_0xaaeacc]][_0xfa88('0x6b')](/"/g,'\x27'));var _0x4c73ac=phoneDescriptions[_0xfa88('0x69')](_0x2cadb4=>_0x2cadb4[_0xfa88('0x7c')]===_0x3c2fff['id']);if(!_[_0xfa88('0x18')](_0x4c73ac)){var _0x1a44a4=_['trim'](_0xb940a[_0xfa88('0x68')][_0x5128f7][_0x28ea6a[_0x4c73ac['description']][0x0]][_0xfa88('0x6b')](/"/g,'\x27'));if(!_[_0xfa88('0x18')](_0x1a44a4))_0xa884d5=_0xa884d5+'§'+_0x1a44a4;}if(_0x1a33f5=='')_0x1a33f5=_0xa884d5;else _0x1a33f5+='|'+_0xa884d5;}_0x48dcb[_0xfa88('0x1a')](_0x3c2fff['id']+':'+_0x1a33f5);_0x474fad[_0x3c2fff['id']]=0x1;}}}}if(hasAdditionalPhones){_0x58769c[_0xfa88('0x1a')]('\x22'+_0x48dcb['join'](';')+'\x22');}if(_0xa772['length']){handleError(_0xb940a[_0xfa88('0x68')][_0x5128f7],{'code':_0xfa88('0x7d'),'message':_0xa772[_0xfa88('0x13')]()});}else{fs['appendFileSync'](_0x1d3162,_0x58769c[_0xfa88('0x13')]()+'\x0a');}_0x58769c=[];}if(!(stats[_0xfa88('0x7e')]%0xc8)){socket['emit']('contact:import:'+_0x6b2852,stats);stats[_0xfa88('0x5a')]=[];}}if(stopped){logger[_0xfa88('0x59')](_0xfa88('0x7f'));_0x2d010f[_0xfa88('0x80')]();}}catch(_0x428331){handleError(_0xb940a[_0xfa88('0x68')][_0x5128f7],{'code':_0xfa88('0x81'),'message':_0x428331['message']});logger[_0xfa88('0x1e')](_0xfa88('0x82'),_0x428331[_0xfa88('0x1f')]);}},'complete':function(){try{var _0x42dd32=[];var _0x3a1735=tempTableName;_0x42dd32[_0xfa88('0x1a')](_0xfa88('0x83')+_0x3a1735+'\x20LIKE\x20cm_contacts;');logger[_0xfa88('0x59')](_0xfa88('0x84'),contactItemTypes[_0xfa88('0x20')]);var _0x6c294a=util[_0xfa88('0xb')](_0xfa88('0x85'),_0x1d3162,_0x3a1735,_0x5b5f56,_0x19a16e[_0xfa88('0x32')],_0x19a16e[_0xfa88('0x86')]||null,NOW,NOW);if(_[_0xfa88('0x18')](_0x28ea6a[_0xfa88('0x6c')])){_0x6c294a+=',\x20scheduledAt\x20=\x20NOW()';}_0x42dd32[_0xfa88('0x1a')](_0x6c294a);BPromise[_0xfa88('0x87')](_0x42dd32,handleQuery)[_0xfa88('0x1c')](function(_0x1f68e6){BPromise[_0xfa88('0x1b')]([handleAdditionalPhones()])[_0xfa88('0x1c')](function(){_0x42dd32=[];for(var _0x3c6337=0x0;_0x3c6337\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','localhost','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push'];(function(_0x3f8be7,_0x2ac068){var _0x37ecc7=function(_0x623a19){while(--_0x623a19){_0x3f8be7['push'](_0x3f8be7['shift']());}};_0x37ecc7(++_0x2ac068);}(_0xc234,0x7f));var _0x4c23=function(_0x15d06f,_0x1c388f){_0x15d06f=_0x15d06f-0x0;var _0x2438e8=_0xc234[_0x15d06f];return _0x2438e8;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x4c23('0x0'));var Papa=require(_0x4c23('0x1'));var util=require('util');var BPromise=require(_0x4c23('0x2'));var moment=require(_0x4c23('0x3'));var squel=require(_0x4c23('0x4'));var Redis=require(_0x4c23('0x5'));var db=require(_0x4c23('0x6'))['db'];var config=require(_0x4c23('0x7'));var logger=require(_0x4c23('0x8'))(_0x4c23('0x9'));config['redis']=_[_0x4c23('0xa')](config['redis'],{'host':_0x4c23('0xb'),'port':0x18eb});var socket=require(_0x4c23('0xc'))(new Redis(config[_0x4c23('0xd')]));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'](_0x4c23('0xe'));var tempTableName=_0x4c23('0xf')+moment()[_0x4c23('0x10')](_0x4c23('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x49edff){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))*$/[_0x4c23('0x12')](_0x49edff);}function selectNotIn(_0x1a4f40,_0x117ad5,_0x4de15a,_0x2d6c76,_0x4effe9){return squel[_0x4c23('0x13')]()[_0x4c23('0x14')](_0x4c23('0x15'))[_0x4c23('0x16')](_0x2d6c76)['join'](_0x117ad5,null,_0x117ad5+_0x4c23('0x17')+_0x2d6c76+'.'+_0x4de15a)[_0x4c23('0x18')](_0x2d6c76+'.'+_0x4de15a+_0x4c23('0x19')+_0x1a4f40+'.'+_0x4de15a)[_0x4c23('0x18')](_0x117ad5+'.dialCheckDuplicateType\x20IN\x20('+_0x4effe9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x508ec6,_0x3645af){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4c23('0x1a')]['query'](_0x4c23('0x1b')+tempTableName)[_0x4c23('0x1c')](function(_0x1020f9){if(_0x1020f9!==null){var _0x87b529=[];for(var _0x12f985=0x0;_0x12f985<_0x1020f9[_0x4c23('0x1d')];_0x12f985++){var _0x4b6cbd=_0x1020f9[_0x12f985];if(!_['isNil'](_0x4b6cbd[_0x4c23('0x15')])){if(!_[_0x4c23('0x1e')](_0x4b6cbd[_0x4c23('0x1f')]))_0x87b529[_0x4c23('0x20')](insertAdditionalPhones(_0x4b6cbd));promisesContact[_0x4c23('0x20')]({'contact':_0x4b6cbd});}}}Promise[_0x4c23('0x21')](_0x87b529)[_0x4c23('0x22')](function(){_0x508ec6({'val':0x1});});})['catch'](function(_0x256210){logger['error'](_0x256210['message']);});});}function insertAdditionalPhones(_0x9ab69d){return new Promise(function(_0x5d8c9f,_0x749259){var _0x27253b=_0x9ab69d[_0x4c23('0x1f')];if(_['isNil'](_0x27253b))_0x749259({'val':0x0});else{var _0x444287=_0x27253b[_0x4c23('0x23')](';');var _0x23785f=[];orderBy=0x0;for(var _0x23c660=0x0;_0x23c660<_0x444287['length'];_0x23c660++){_0x23785f['push'](splitAdditionalPhone(_0x9ab69d['id'],_0x444287[_0x23c660]));}Promise['all'](_0x23785f)[_0x4c23('0x22')](function(){_0x5d8c9f({'val':_0x444287[_0x4c23('0x1d')]});});}});}function splitAdditionalPhone(_0xdea3b2,_0x3f05d3){return new Promise(function(_0x1dc97b,_0x57ef57){var _0x2db670=_0x3f05d3[_0x4c23('0x23')](':');var _0x56aac8=_0x2db670[0x0];var _0xf6a6f5=_0x2db670[0x1];if(_0xf6a6f5!==''){var _0x2f8cd7=_0xf6a6f5[_0x4c23('0x23')]('|');var _0xf7d5fd=[];for(var _0x4646b5=0x0;_0x4646b5<_0x2f8cd7[_0x4c23('0x1d')];_0x4646b5++){if(_0x2f8cd7[_0x4646b5]!==''){var _0x378270=_[_0x4c23('0x24')](promisesAdditionalPhones,{'contactId':_0xdea3b2,'phone':_0x2f8cd7[_0x4646b5]});if(_0x378270[_0x4c23('0x1d')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xdea3b2,'contactTypeId':_0x56aac8,'phone':_0x2f8cd7[_0x4646b5],'orderBy':orderBy});}}}_0x1dc97b({'ok':0x1});}else _0x1dc97b({'res':0x0});});}function createAdditionalPhone(_0x521500,_0x4537a2,_0x15afeb,_0x59f257){var _0x12b6a9='';var _0x237cd3='';var _0x3bb66a=_0x15afeb['split']('§');_0x12b6a9=_0x3bb66a[0x0];if(_0x3bb66a['length']==0x2)_0x237cd3=_0x3bb66a[0x1];return new Promise(function(_0x3ae82d,_0x5026e5){return db[_0x4c23('0x25')][_0x4c23('0x26')]({'where':{'CmContactId':_0x521500,'item':_0x12b6a9}})[_0x4c23('0x22')](function(_0x483d02){if(_0x483d02){return db['CmContactHasItem']['update']({'ItemTypeId':_0x4537a2,'description':_0x237cd3,'OrderBy':_0x59f257},{'where':{'CmContactId':_0x521500,'item':_0x12b6a9}})['then'](function(_0x5af8d8){_0x3ae82d({'res':_0x4c23('0x27')});});}else{return db['CmContactHasItem'][_0x4c23('0x28')]({'CmContactId':_0x521500,'item':_0x12b6a9,'ItemTypeId':_0x4537a2,'description':_0x237cd3,'OrderBy':_0x59f257,'ItemClass':_0x4c23('0x29')})['then'](function(_0x34a694){_0x3ae82d({'res':_0x4c23('0x2a')});});}});});}function updateContact(_0x3a8024){return new Promise(function(_0x2cb144,_0xc0cb72){var _0x194fe4=_0x3a8024['id'];delete _0x3a8024['id'];return db[_0x4c23('0x2b')][_0x4c23('0x2c')](_0x3a8024,{'where':{'id':_0x194fe4}})[_0x4c23('0x22')](function(_0x47085c){updatedRows+=0x1;return db['CmHopper'][_0x4c23('0x2c')]({'phone':_0x3a8024[_0x4c23('0x15')]},{'where':{'ContactId':_0x194fe4}})[_0x4c23('0x22')](function(_0x2f144d){_0x2cb144({'ret':'OK'});});});});}function insertCmHopper(_0x54d69a,_0x583161,_0xe66917,_0x902137,_0x4c6dd6){var _0x5f5728=[_0x4c23('0x2d'),_0x4c23('0x2e'),_0x4c23('0x2f'),_0x4c23('0x30'),_0x583161+'.'+_0x902137,_0x4c23('0x31'),_0x4c23('0x32'),'cm_contacts.priority',_0x4c23('0x33'),'\x22'+_0x4c6dd6+'\x22'];return squel['insert']()[_0x4c23('0x34')](_0x4c23('0x35'))[_0x4c23('0x36')](['phone',_0x4c23('0x37'),_0x4c23('0x38'),'ListId',_0x902137,_0x4c23('0x39'),_0x4c23('0x3a'),_0x4c23('0x3b'),_0x4c23('0x3c'),_0x4c23('0x3d')],squel[_0x4c23('0x13')]()['fields'](_0x5f5728)[_0x4c23('0x16')](_0x583161)[_0x4c23('0x3e')]('cm_contacts',null,_0x4c23('0x3f')+_0x583161+_0x4c23('0x40'))[_0x4c23('0x3e')](_0xe66917,null,_0xe66917+_0x4c23('0x17')+_0x583161+'.'+_0x902137)[_0x4c23('0x18')](_0x583161+_0x4c23('0x41'),_0x54d69a)[_0x4c23('0x18')](_0x4c23('0x42'),NOW)['where'](_0x4c23('0x43'),selectNotIn(_0x583161,_0xe66917,_0x902137,'cm_hopper',[_0x4c23('0x44'),_0x4c23('0x45')]))[_0x4c23('0x18')](_0x4c23('0x43'),selectNotIn(_0x583161,_0xe66917,_0x902137,_0x4c23('0x35'),['\x22always\x22'])))[_0x4c23('0x46')]();}function insertCmHopperBlack(_0x48f115,_0x27837b,_0x1b60cf,_0x30eacf){var _0x13cef9=['cm_contacts.phone','cm_contacts.id',_0x4c23('0x30'),_0x27837b+'.'+_0x30eacf,_0x4c23('0x31'),_0x4c23('0x32')];return squel[_0x4c23('0x47')]()['into']('cm_hopper_black')[_0x4c23('0x36')](['phone',_0x4c23('0x38'),_0x4c23('0x48'),_0x30eacf,'createdAt',_0x4c23('0x3a')],squel['select']()[_0x4c23('0x49')](_0x13cef9)[_0x4c23('0x16')](_0x27837b)[_0x4c23('0x3e')](_0x4c23('0x4a'),null,_0x4c23('0x3f')+_0x27837b+'.CmListId')[_0x4c23('0x3e')](_0x1b60cf,null,_0x1b60cf+'.id\x20=\x20'+_0x27837b+'.'+_0x30eacf)[_0x4c23('0x18')](_0x27837b+_0x4c23('0x41'),_0x48f115)['where'](_0x4c23('0x42'),NOW)['where'](_0x4c23('0x43'),squel[_0x4c23('0x13')]()[_0x4c23('0x14')]('phone')['from'](_0x4c23('0x4b'))['where'](_0x4c23('0x4c'),_0x48f115)[_0x4c23('0x18')](_0x30eacf+_0x4c23('0x4d'),_0x27837b+'.'+_0x30eacf)))[_0x4c23('0x46')]();}function insertCmHopperAdditionalPhones(_0x2dde42){var _0x580b03=[_0x4c23('0x4e'),_0x4c23('0x4f'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x4c23('0x50')];return squel['insert']()[_0x4c23('0x34')]('cm_hopper_additional_phones')['fromQuery']([_0x4c23('0x51'),'phone',_0x4c23('0x52'),_0x4c23('0x39'),'updatedAt'],squel[_0x4c23('0x13')]()[_0x4c23('0x49')](_0x580b03)[_0x4c23('0x16')](_0x4c23('0x35'))['join'](_0x4c23('0x4a'),null,_0x4c23('0x53'))[_0x4c23('0x3e')]('cm_contact_has_items',null,_0x4c23('0x54'))[_0x4c23('0x18')](_0x4c23('0x55'),_0x2dde42)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x4c23('0x46')]();}function insertCmContact(_0xf20024,_0x3e8ba8,_0x166df5,_0x2c02d1){var _0x1c28d1=_[_0x4c23('0x56')](_['keys'](_0x2c02d1),['ListId',_0x4c23('0x57'),_0x4c23('0x39'),'updatedAt']);return squel[_0x4c23('0x47')]()[_0x4c23('0x34')](_0x4c23('0x4a'))[_0x4c23('0x36')](_0x1c28d1,squel['select']()[_0x4c23('0x49')](_0x1c28d1)[_0x4c23('0x16')](_0x3e8ba8)['where']('('+_0x166df5[_0x4c23('0x3e')](',')+_0x4c23('0x58'),squel['select']()[_0x4c23('0x49')](_0x166df5)[_0x4c23('0x16')](_0x4c23('0x4a'))[_0x4c23('0x18')](_0x4c23('0x4c'),_0xf20024))[_0x4c23('0x18')]('id\x20IN\x20?',squel[_0x4c23('0x13')]()['field'](_0x4c23('0x59'),_0x4c23('0x5a'))[_0x4c23('0x16')](_0x3e8ba8)['group'](_0x166df5[_0x4c23('0x3e')](','))))[_0x4c23('0x46')]();}function handleStop(){logger[_0x4c23('0x5b')](_0x4c23('0x5c'));stopped=!![];}function handleUncaughtException(_0x1f1aba){logger[_0x4c23('0x5d')](_0x1f1aba[_0x4c23('0x5e')]);process[_0x4c23('0x5f')](0x1);}function handleError(_0x521c26,_0x547974){stats['errors']['push']({'name':_0x547974[_0x4c23('0x60')],'message':_0x547974[_0x4c23('0x5e')],'row':_0x521c26});}function handleQuery(_0x12e055){logger['info'](_0x12e055);return db[_0x4c23('0x1a')][_0x4c23('0x61')](_0x12e055)[_0x4c23('0x1c')](function(_0x46a5fe){results['push'](_0x46a5fe);})['catch'](function(_0x488c52){logger['error'](_0x488c52['message']);});}function main(_0x23f450,_0x5bdfec,_0x43201f,_0x5c2a2e){logger[_0x4c23('0x5b')](_0x4c23('0x62'),_0x23f450,JSON[_0x4c23('0x63')](_0x5bdfec));process['send'](_0x4c23('0x64'));var _0x51a9f0=_0x5bdfec['binding'];var _0x2a552b=_[_0x4c23('0x65')](_0x51a9f0);var _0x1c3980=_0x5bdfec['socket_timestamp'];var _0x49ed96=path[_0x4c23('0x3e')](config[_0x4c23('0x66')],_0x4c23('0x67'),_0x1c3980+_0x4c23('0x68'));logger[_0x4c23('0x5b')](_0x4c23('0x69'),_0x5bdfec);db[_0x4c23('0x6a')][_0x4c23('0x6b')]({'raw':!![],'attributes':['id',_0x4c23('0x6c')]})['then'](function(_0x53f504){for(var _0x471455=0x0;_0x471455<_0x53f504['length'];_0x471455++){if(_0x53f504[_0x471455]['name']in _0x51a9f0){contactItemTypes['push'](_0x53f504[_0x471455]);delete _0x2a552b[_0x53f504[_0x471455]['name']];hasAdditionalPhones=!![];}for(var _0x317dd4 in _0x51a9f0){if(_0x53f504[_0x471455][_0x4c23('0x6c')]+_0x4c23('0x6d')===_0x317dd4){phoneDescriptions[_0x4c23('0x20')]({'itemTypeId':_0x53f504[_0x471455]['id'],'description':_0x317dd4});delete _0x2a552b[_0x317dd4];}}}if(hasAdditionalPhones)_0x2a552b[_0x4c23('0x1f')]='';var _0x391b04=_[_0x4c23('0x6e')](_0x2a552b)['join']();logger[_0x4c23('0x5b')](_0x4c23('0x6f'),_0x391b04);fs[_0x4c23('0x70')](_0x49ed96,_0x391b04+'\x0a');Papa['parse'](fs[_0x4c23('0x71')](_0x23f450),{'header':!![],'skipEmptyLines':!![],'step':function(_0x366eb5,_0x371425){try{for(var _0x478361=0x0,_0x10bde5=[];_0x478361<_0x366eb5['data'][_0x4c23('0x1d')];_0x478361++){stats[_0x4c23('0x72')]+=0x1;if(_0x366eb5[_0x4c23('0x73')][_0x478361]){handleError(_0x366eb5[_0x4c23('0x74')][_0x478361],_0x366eb5[_0x4c23('0x73')][_0x478361]);}else{var _0x36b755=[];var _0x63066d=[];var _0x46ae45={};for(var _0xfa3a18 in _0x51a9f0){let _0x434219=contactItemTypes[_0x4c23('0x75')](_0x83ec0b=>_0x83ec0b['name']===_0xfa3a18);let _0x5419a0=contactItemTypes[_0x4c23('0x75')](_0x5f31ca=>_0x5f31ca[_0x4c23('0x6c')]+_0x4c23('0x6d')===_0xfa3a18);if(_[_0x4c23('0x1e')](_0x434219)&&_[_0x4c23('0x1e')](_0x5419a0)){if(_0x51a9f0['hasOwnProperty'](_0xfa3a18)){if(_0x366eb5['data'][_0x478361][_0x51a9f0[_0xfa3a18]]){var _0x1957e9=_['trim'](_0x366eb5[_0x4c23('0x74')][_0x478361][_0x51a9f0[_0xfa3a18]][_0x4c23('0x76')](/"/g,'\x27'));switch(_0xfa3a18){case'scheduledat':var _0x5b45d5=moment(_0x1957e9,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5b45d5[_0x4c23('0x77')]()){_0x10bde5[_0x4c23('0x20')]('\x22'+_0x1957e9+'\x22');}else{_0x36b755[_0x4c23('0x20')](_0x4c23('0x78'));}break;case'priority':var _0x31a695=parseInt(_0x1957e9);_0x1957e9=_[_0x4c23('0x79')](_0x31a695)||_0x31a695<0x0||_0x31a695>0x4?_0x5c2a2e?0x3:0x2:_0x31a695;_0x10bde5[_0x4c23('0x20')]('\x22'+_0x1957e9+'\x22');break;case _0x4c23('0x3c'):var _0x806ed7=parseInt(_0x1957e9);if(_[_0x4c23('0x7a')](_0x806ed7)&&_['includes'](_0x43201f,_0x806ed7)){_0x10bde5['push']('\x22'+_0x806ed7+'\x22');}else{_0x36b755[_0x4c23('0x20')](_0x4c23('0x7b'));}break;case _0x4c23('0x7c'):if(isEmail(_0x1957e9)){_0x10bde5[_0x4c23('0x20')]('\x22'+_0x1957e9+'\x22');}else{_0x36b755[_0x4c23('0x20')](_0x4c23('0x7d'));}break;case _0x4c23('0x7e'):var _0x11616d=moment(_0x1957e9,'YYYY-MM-DD',!![]);if(_0x11616d[_0x4c23('0x77')]()){_0x10bde5[_0x4c23('0x20')]('\x22'+_0x1957e9+'\x22');}else{_0x36b755[_0x4c23('0x20')](_0x4c23('0x7f'));}break;default:_0x10bde5['push']('\x22'+_0x1957e9+'\x22');}}else{switch(_0xfa3a18){case _0x4c23('0x80'):case _0x4c23('0x15'):_0x36b755[_0x4c23('0x20')](_0xfa3a18+'\x20not\x20specified');break;default:_0x10bde5[_0x4c23('0x20')]('\x22\x22');}}}}else{var _0x29c5a3='';if(!_['isNil'](_0x434219)){if(!_0x46ae45['hasOwnProperty'](_0x434219['id'])){for(var _0x2d500f=0x0;_0x2d500f<_0x51a9f0[_0xfa3a18][_0x4c23('0x1d')];_0x2d500f++){var _0x1957e9=_[_0x4c23('0x81')](_0x366eb5['data'][_0x478361][_0x51a9f0[_0xfa3a18][_0x2d500f]]['replace'](/"/g,'\x27'));var _0x36803c=phoneDescriptions[_0x4c23('0x75')](_0x2a9bb2=>_0x2a9bb2['itemTypeId']===_0x434219['id']);if(!_[_0x4c23('0x1e')](_0x36803c)){var _0x2d8aeb=_[_0x4c23('0x81')](_0x366eb5['data'][_0x478361][_0x51a9f0[_0x36803c[_0x4c23('0x82')]][0x0]][_0x4c23('0x76')](/"/g,'\x27'));if(!_[_0x4c23('0x1e')](_0x2d8aeb))_0x1957e9=_0x1957e9+'§'+_0x2d8aeb;}if(_0x29c5a3=='')_0x29c5a3=_0x1957e9;else _0x29c5a3+='|'+_0x1957e9;}_0x63066d['push'](_0x434219['id']+':'+_0x29c5a3);_0x46ae45[_0x434219['id']]=0x1;}}}}if(hasAdditionalPhones){_0x10bde5[_0x4c23('0x20')]('\x22'+_0x63066d['join'](';')+'\x22');}if(_0x36b755[_0x4c23('0x1d')]){handleError(_0x366eb5[_0x4c23('0x74')][_0x478361],{'code':'SystemRow','message':_0x36b755[_0x4c23('0x3e')]()});}else{fs['appendFileSync'](_0x49ed96,_0x10bde5[_0x4c23('0x3e')]()+'\x0a');}_0x10bde5=[];}if(!(stats[_0x4c23('0x72')]%0xc8)){socket[_0x4c23('0x83')](_0x4c23('0x84')+_0x1c3980,stats);stats[_0x4c23('0x73')]=[];}}if(stopped){logger[_0x4c23('0x5b')](_0x4c23('0x85'));_0x371425['abort']();}}catch(_0x34f7f0){handleError(_0x366eb5[_0x4c23('0x74')][_0x478361],{'code':_0x4c23('0x86'),'message':_0x34f7f0[_0x4c23('0x5e')]});logger[_0x4c23('0x5d')]('step',_0x34f7f0[_0x4c23('0x5e')]);}},'complete':function(){try{var _0x377905=[];var _0x447cc3=tempTableName;_0x377905[_0x4c23('0x20')](_0x4c23('0x87')+_0x447cc3+_0x4c23('0x88'));logger['info'](_0x4c23('0x89'),contactItemTypes[_0x4c23('0x1d')]);var _0x4ac3e8=util[_0x4c23('0x10')](_0x4c23('0x8a'),_0x49ed96,_0x447cc3,_0x391b04,_0x5bdfec['ListId'],_0x5bdfec[_0x4c23('0x57')]||null,NOW,NOW);if(_[_0x4c23('0x1e')](_0x51a9f0[_0x4c23('0x37')])){_0x4ac3e8+=',\x20scheduledAt\x20=\x20NOW()';}_0x377905['push'](_0x4ac3e8);BPromise['each'](_0x377905,handleQuery)[_0x4c23('0x22')](function(_0x16d0e4){BPromise[_0x4c23('0x21')]([handleAdditionalPhones()])['then'](function(){_0x377905=[];for(var _0x4f426=0x0;_0x4f426\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.closed','i.attach','i.lastMsgAt','i.subject','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','search','select','field','name','from','tools_tags','getInteractionFK','_interactions','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','interactions','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?'];(function(_0x5e859e,_0x4a4607){var _0x3fa5d5=function(_0x5972c0){while(--_0x5972c0){_0x5e859e['push'](_0x5e859e['shift']());}};_0x3fa5d5(++_0x4a4607);}(_0x4caf,0x7c));var _0xf4ca=function(_0x4897f3,_0x46d20c){_0x4897f3=_0x4897f3-0x0;var _0x596165=_0x4caf[_0x4897f3];return _0x596165;};'use strict';var _=require(_0xf4ca('0x0'));var squel=require(_0xf4ca('0x1'));var as=require(_0xf4ca('0x2'));var qs=require(_0xf4ca('0x3'));var updateInteraction=require(_0xf4ca('0x4'))[_0xf4ca('0x5')];var utils=require(_0xf4ca('0x6'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x416c94,_0x2d284b,_0x1f524e){var _0x2b48ea=![];var _0x3c6d86=utils[_0xf4ca('0x7')](_0x416c94);if(_0x2d284b[_0xf4ca('0x8')]==='agent'&&!_0x1f524e[_0xf4ca('0x9')]&&!_0x1f524e[_0x3c6d86]){_0x2b48ea=!![];}return _0x2b48ea;}function getTagsQuery(){return squel[_0xf4ca('0xa')]()[_0xf4ca('0xb')]('id')['field'](_0xf4ca('0xc'))['field']('color')[_0xf4ca('0xd')](_0xf4ca('0xe'));}function getUsersQuery(_0x4884b7,_0x322f67){var _0x52dea9=utils[_0xf4ca('0xf')](_0x4884b7);var _0x59873e='user_has_'+_0x4884b7+_0xf4ca('0x10');var _0x5b319c=squel[_0xf4ca('0xa')]()[_0xf4ca('0xb')]('u.id')[_0xf4ca('0xb')](_0xf4ca('0x11'))['field'](_0xf4ca('0x12')+_0x52dea9)[_0xf4ca('0xd')](_0x59873e,'ui')[_0xf4ca('0x13')](_0xf4ca('0x14'),'u',_0xf4ca('0x15'));if(_0x322f67[_0xf4ca('0x16')]>0x0){_0x5b319c[_0xf4ca('0x17')](_0xf4ca('0x12')+_0x52dea9+_0xf4ca('0x18'),_[_0xf4ca('0x19')](_0x322f67,'id'));}return _0x5b319c;}function getInteractionsQuery(_0x645ad4){var _0x4c4fb6=utils['getInteractionsTables'](_0x645ad4);var _0x9f5e98=utils[_0xf4ca('0x7')](_0x645ad4);var _0x8e9e89=utils[_0xf4ca('0xf')](_0x645ad4);return squel[_0xf4ca('0xa')]()[_0xf4ca('0xd')](_0x4c4fb6[_0xf4ca('0x1a')],'i')[_0xf4ca('0x13')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf4ca('0x13')]('users','o',_0xf4ca('0x1b'))[_0xf4ca('0x13')](_0x4c4fb6[_0xf4ca('0x1c')],'a','a.id\x20=\x20i.'+_0x9f5e98)[_0xf4ca('0x13')](_0x4c4fb6[_0xf4ca('0x1d')],'me',_0xf4ca('0x1e')+_0x8e9e89+_0xf4ca('0x1f'))[_0xf4ca('0x13')](_0x4c4fb6['interactionsTags'],'it','it.'+_0x8e9e89+_0xf4ca('0x1f'))['left_join'](_0xf4ca('0xe'),'t',_0xf4ca('0x20'));}function getSqlClauses(){var _0x4b046a={'body':squel[_0xf4ca('0x21')](),'contact':squel[_0xf4ca('0x21')](),'default':squel[_0xf4ca('0x21')](),'fields':squel[_0xf4ca('0x21')](),'filter':squel[_0xf4ca('0x21')](),'read':squel[_0xf4ca('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xf4ca('0x21')]()};return _0x4b046a;}function parseTagParameter(_0x256424){var _0x3b0db9=squel[_0xf4ca('0x21')]();if(_0x256424){var _0x1f5ed0=utils[_0xf4ca('0x22')](_0x256424);_0x1f5ed0[_0xf4ca('0x23')](function(_0x480616){_0x3b0db9['or'](_0xf4ca('0x24'),'%,'+_0x480616+',%');});}return _0x3b0db9;}function parseReadParameter(_0xeef30e){var _0x59e7db='';if(_0xeef30e){_0x59e7db=_0xf4ca('0x25');if(_0xeef30e==='1'){_0x59e7db=_0x59e7db['replace'](_0xf4ca('0x26'),'=');}else{_0x59e7db=_0x59e7db['replace']('{OPERATOR}','>');}}return _0x59e7db;}function parseSearchFilter(_0x5d6333,_0x4cc91e){var _0x57cc12=squel[_0xf4ca('0x21')]();if(_0x4cc91e){var _0x3a6a84=_0x4cc91e['replace']('\x5c','\x5c\x5c')[_0xf4ca('0x27')](/'/g,'\x27\x27');if(qs[_0xf4ca('0x28')](_0x3a6a84)){_0x57cc12['or'](_0xf4ca('0x29'),_0x3a6a84+'%');switch(_0x5d6333){case _0xf4ca('0x2a'):case _0xf4ca('0x2b'):_0x57cc12['or'](_0xf4ca('0x2c'),_0x3a6a84+'%');break;case _0xf4ca('0x2d'):_0x57cc12['or'](_0xf4ca('0x2e'),_0x3a6a84+'%');break;case'openchannel':_0x57cc12['or'](_0xf4ca('0x2f'),_0x3a6a84+'%');break;case'mail':_0x57cc12['or'](_0xf4ca('0x30'),qs['getFullTextValue'](_0x3a6a84,!![]))['or'](_0xf4ca('0x31'),qs[_0xf4ca('0x32')](_0x3a6a84));break;}}else if(_0x5d6333===_0xf4ca('0x33')&&qs['isEmail'](_0x3a6a84)){_0x57cc12['or'](_0xf4ca('0x34'),_0x3a6a84+'%');}else{if(_0x5d6333===_0xf4ca('0x33')){_0x57cc12['or'](_0xf4ca('0x30'),qs['getFullTextValue'](_0x3a6a84,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf4ca('0x32')](_0x3a6a84));}else if(_0x5d6333!==_0xf4ca('0x2d')){_0x57cc12['or'](_0xf4ca('0x35'),qs['getFullTextValue'](_0x3a6a84));}_0x57cc12['or'](_0xf4ca('0x36'),qs['getFullTextValue'](_0x3a6a84,!![]),null);}}return _0x57cc12;}function parseAdvancedSearchFilter(_0x48db5d,_0x10e2de){var _0x545af2=getSqlClauses();var _0x117af9=as[_0xf4ca('0x37')](_0x48db5d);var _0x440d9d=_0x117af9[_0xf4ca('0x38')];for(var _0x4bdca3=0x0;_0x4bdca3<_0x117af9['conditions'][_0xf4ca('0x16')];_0x4bdca3++){var _0x450125=_0x117af9[_0xf4ca('0x39')][_0x4bdca3];var _0x494799='i';var _0x1195c8=_['find'](_0x10e2de,[_0xf4ca('0xc'),_0x450125['field']]);if(_0x1195c8){var _0x98b3cd=as[_0xf4ca('0x3a')](_0x494799,_0x1195c8['type'],_0x450125);_0x545af2['default'][_0x440d9d](_0x98b3cd[_0xf4ca('0x3b')],_0x98b3cd['value'][_0xf4ca('0x3c')],_0x98b3cd[_0xf4ca('0x3d')][_0xf4ca('0x3e')]);}else{switch(_0x450125[_0xf4ca('0xb')]){case _0xf4ca('0x3f'):var _0x3b9e70=parseReadParameter(_0x450125[_0xf4ca('0x3d')]);_0x545af2[_0xf4ca('0x40')][_0xf4ca('0x41')](_0x3b9e70);break;case _0xf4ca('0x42'):if(_0x450125[_0xf4ca('0x43')]===_0xf4ca('0x44')){if(_0x450125[_0xf4ca('0x3d')][_0xf4ca('0x45')]('\x20')[_0xf4ca('0x16')]>0x1){_0x545af2['contact'][_0x440d9d](_0xf4ca('0x36'),qs['getFullTextValue'](_0x450125['value'],!![]),null);}else{var _0x37b9f5='%'+_0x450125[_0xf4ca('0x3d')]+'%';_0x545af2[_0xf4ca('0x46')][_0x440d9d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x37b9f5,_0x37b9f5,_0x37b9f5);}}else{_0x1195c8=_[_0xf4ca('0x47')](_0x10e2de,[_0xf4ca('0xc'),_0xf4ca('0x48')]);_0x450125[_0xf4ca('0xb')]=_0xf4ca('0x48');_0x98b3cd=as[_0xf4ca('0x3a')](_0x494799,_0x1195c8[_0xf4ca('0x49')],_0x450125);_0x545af2[_0xf4ca('0x46')][_0x440d9d](_0x98b3cd['text'],_0x98b3cd[_0xf4ca('0x3d')][_0xf4ca('0x3c')],_0x98b3cd[_0xf4ca('0x3d')][_0xf4ca('0x3e')]);}break;case _0xf4ca('0x4a'):var _0x4e8281=_0x450125['value'][_0xf4ca('0x45')](',')[_0xf4ca('0x19')](function(_0x26bc65){return Number(_0x26bc65);});var _0x25d3dc=parseTagParameter(_0x4e8281);_0x545af2[_0xf4ca('0x4b')][_0xf4ca('0x4c')][_0xf4ca('0x41')](_0x25d3dc);_0x545af2[_0xf4ca('0x4b')]['ids']=_0x4e8281;break;case _0xf4ca('0x4d'):if(_0x450125[_0xf4ca('0x43')]==='$substring'){_0x545af2['user'][_0x440d9d](_0xf4ca('0x4e'),'%'+_0x450125[_0xf4ca('0x3d')]+'%',null);}else{_0x1195c8=_['find'](_0x10e2de,[_0xf4ca('0xc'),'UserId']);_0x450125[_0xf4ca('0xb')]=_0xf4ca('0x4f');_0x98b3cd=as[_0xf4ca('0x3a')](_0x494799,_0x1195c8['type'],_0x450125);_0x545af2[_0xf4ca('0x50')][_0x440d9d](_0x98b3cd[_0xf4ca('0x3b')],_0x98b3cd[_0xf4ca('0x3d')][_0xf4ca('0x3c')],_0x98b3cd['value'][_0xf4ca('0x3e')]);}break;case _0xf4ca('0x51'):case _0xf4ca('0x52'):_0x98b3cd=as[_0xf4ca('0x3a')]('me',null,_0x450125);_0x545af2['body'][_0x440d9d](_0x98b3cd[_0xf4ca('0x3b')],_0x98b3cd['value']['start'],_0x98b3cd[_0xf4ca('0x3d')][_0xf4ca('0x3e')]);break;}}}return _0x545af2;}function parseModelFields(_0x48ba63,_0x561145,_0x5741cd){var _0x50908d=utils['getAccountFK'](_0x48ba63);var _0x1bc6eb=squel['expr']();var _0x277415=_(_0x561145)[_0xf4ca('0x53')]()[_0xf4ca('0x19')](function(_0x2fce67){return _[_0xf4ca('0x54')](_0x5741cd,['name',_0x2fce67])?_0x2fce67:undefined;})[_0xf4ca('0x55')]()[_0xf4ca('0x3d')]();if(_0x277415[_0xf4ca('0x16')]>0x0){_0x277415[_0xf4ca('0x23')](function(_0x583ae1){if(_0x583ae1===_0x50908d){_0x1bc6eb['and']('i.'+_0x50908d+_0xf4ca('0x18'),[][_0xf4ca('0x56')](_0x561145[_0x583ae1]));}else if(_0x583ae1==='createdAt'){var _0x5b721c=JSON[_0xf4ca('0x57')](_0x561145[_0x583ae1])[_0xf4ca('0x58')];var _0x4f4cfd=JSON[_0xf4ca('0x57')](_0x561145[_0x583ae1])[_0xf4ca('0x59')];_0x1bc6eb[_0xf4ca('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b721c,_0x4f4cfd);}else{if(_0x561145[_0x583ae1]===_0xf4ca('0x5a')){_0x1bc6eb[_0xf4ca('0x41')]('i.'+_0x583ae1+'\x20IS\x20NULL');}else{_0x1bc6eb['and']('i.'+_0x583ae1+_0xf4ca('0x5b'),_0x561145[_0x583ae1]);}}});}return _0x1bc6eb;}function parseQueryParameters(_0x2e18c5,_0x2562c7,_0x4c89da){var _0x372651=getSqlClauses();return Promise['resolve']()[_0xf4ca('0x5c')](function(){return parseModelFields(_0x2e18c5,_0x2562c7,_0x4c89da);})[_0xf4ca('0x5c')](function(_0x51b840){_0x372651['fields'][_0xf4ca('0x41')](_0x51b840);return parseReadParameter(_0x2562c7[_0xf4ca('0x40')]);})[_0xf4ca('0x5c')](function(_0x5d8638){_0x372651[_0xf4ca('0x40')]['and'](_0x5d8638);return parseTagParameter(_0x2562c7[_0xf4ca('0x5d')]);})['then'](function(_0x35185f){_0x372651['tags'][_0xf4ca('0x4c')][_0xf4ca('0x41')](_0x35185f);return parseSearchFilter(_0x2e18c5,_0x2562c7[_0xf4ca('0x5e')]);})[_0xf4ca('0x5c')](function(_0x5ba3b8){_0x372651[_0xf4ca('0x5e')]=_0x5ba3b8;return _0x372651;});}function checkAccountsRestrictions(_0x205625,_0xf25200,_0x4e72ff){var _0x2b1a50=utils[_0xf4ca('0x7')](_0x205625);var _0x1d0a8a='get'+_[_0xf4ca('0x5f')](_0x205625)+(_0x205625===_0xf4ca('0x60')?_0xf4ca('0x61'):_0xf4ca('0x62'));var _0x292c22=squel[_0xf4ca('0x21')]();return Promise[_0xf4ca('0x63')]()[_0xf4ca('0x5c')](function(){if(_0x4e72ff[_0xf4ca('0x9')]&&_0xf25200[_0xf4ca('0x8')]===_0xf4ca('0x64')){return _0xf25200[_0x1d0a8a]({'attributes':['id'],'raw':!![]});}})[_0xf4ca('0x5c')](function(_0x5ae859){if(_0x5ae859){if(_0x5ae859[_0xf4ca('0x16')]===0x0){_0x292c22['and']('i.'+_0x2b1a50+'\x20IS\x20NULL');}else{_0x292c22['and']('i.'+_0x2b1a50+_0xf4ca('0x18'),_[_0xf4ca('0x19')](_0x5ae859,'id'));}}else if(!_0x4e72ff[_0x2b1a50]){_0x292c22[_0xf4ca('0x41')]('i.'+_0x2b1a50+_0xf4ca('0x65'));}})[_0xf4ca('0x5c')](function(){return _0x292c22;});}function getClosedOrderClause(_0x7172e1,_0x4ae044){var _0x3f8809='';var _0x1a38a5=[_0xf4ca('0x66'),'i.secondDisposition',_0xf4ca('0x67')];if(_0x7172e1===_0xf4ca('0x33')){_0x1a38a5['unshift'](_0xf4ca('0x68'));}if(_0x4ae044['closed']==='0'&&_0x7172e1===_0xf4ca('0x33')){_0x3f8809=_0xf4ca('0x68');}else{if(_0x4ae044[_0xf4ca('0x69')]==='1'){_0x1a38a5[_0xf4ca('0x6a')]();}_0x3f8809='CONCAT_WS(\x27\x27,\x20'+_0x1a38a5[_0xf4ca('0x6b')](',\x20')+')';}return _0x3f8809;}function getFilteredInteractions(_0x2818d7,_0x2bd56a,_0x7b72f3,_0x11ab1a){var _0x5a5bb0=utils[_0xf4ca('0xf')](_0x2818d7);var _0x2b7219=_[_0xf4ca('0x5f')](_0x2818d7)+_0xf4ca('0x6c');var _0x383c3e=[];var _0x33c7b2=getTagsQuery();var _0x50eb6a={'type':db[_0xf4ca('0x6d')][_0xf4ca('0x6e')][_0xf4ca('0x6f')],'raw':!![]};var _0x241a95=[];var _0x340b16=[];return db[_0xf4ca('0x70')][_0xf4ca('0x71')](_0x33c7b2['toString'](),_0x50eb6a)['then'](function(_0x2b3fe3){_0x383c3e=_[_0xf4ca('0x72')](_0x2b3fe3,'id');_0x50eb6a=_[_0xf4ca('0x73')](_0x50eb6a,{'model':db[_0x2b7219],'mapToModel':!![],'nest':!![]});if(_0x7b72f3['fields']){_0x11ab1a[_0xf4ca('0x74')][_0xf4ca('0x23')](function(_0x1d4e61){_0x2bd56a[_0xf4ca('0xb')]('i.'+_0x1d4e61);});}else{_0x2bd56a[_0xf4ca('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf4ca('0x3f'));_0x2bd56a[_0xf4ca('0xb')]('a.key','Account.key');_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x75'),_0xf4ca('0x76'));if(_0x2818d7==='mail'){_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x77'),_0xf4ca('0x78'));_0x2bd56a['field'](_0xf4ca('0x79'),_0xf4ca('0x7a'));_0x2bd56a[_0xf4ca('0xb')]('i.id');_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x7b'));_0x2bd56a[_0xf4ca('0xb')]('i.updatedAt');_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x7c'));_0x2bd56a[_0xf4ca('0xb')]('i.closedAt');_0x2bd56a['field'](_0xf4ca('0x7d'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x7e'));_0x2bd56a[_0xf4ca('0xb')]('i.lastMsgDirection');_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x7f'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x67'));_0x2bd56a['field'](_0xf4ca('0x80'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x66'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x68'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x81'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x82'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x83'));_0x2bd56a['field'](_0xf4ca('0x84'));}else if(_0x2818d7==='openchannel'){_0x2bd56a[_0xf4ca('0xb')]('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',_0xf4ca('0x7a'));}else{_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x85'),_0xf4ca('0x7a'));}if(_0x2818d7!==_0xf4ca('0x33')){_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x86'));}_0x2bd56a[_0xf4ca('0xb')]('c.firstName',_0xf4ca('0x87'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x88'),_0xf4ca('0x89'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x8a'),_0xf4ca('0x8b'));_0x2bd56a[_0xf4ca('0xb')]('c.phone',_0xf4ca('0x8c'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x8d'),_0xf4ca('0x8e'));_0x2bd56a['field'](_0xf4ca('0x8f'),_0xf4ca('0x90'));_0x2bd56a[_0xf4ca('0xb')](_0xf4ca('0x91'),_0xf4ca('0x92'));_0x2bd56a['field'](_0xf4ca('0x93'),_0xf4ca('0x94'));_0x2bd56a[_0xf4ca('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x11ab1a[_0xf4ca('0x95')]){_0x2bd56a[_0xf4ca('0x95')](_0x11ab1a[_0xf4ca('0x95')]);}if(_0x11ab1a[_0xf4ca('0x96')]){_0x2bd56a[_0xf4ca('0x96')](_0x11ab1a[_0xf4ca('0x96')]);}return db[_0xf4ca('0x70')]['query'](_0x2bd56a[_0xf4ca('0x97')](),_0x50eb6a);})[_0xf4ca('0x5c')](function(_0x462c02){_0x241a95=_0x462c02;var _0x3f43fa=getUsersQuery(_0x2818d7,_0x241a95);return db[_0xf4ca('0x70')][_0xf4ca('0x71')](_0x3f43fa['toString'](),_0x50eb6a);})[_0xf4ca('0x5c')](function(_0x279c39){_0x340b16=_[_0xf4ca('0x98')](_0x279c39,_0x5a5bb0);if(_0x2818d7===_0xf4ca('0x33')){return db[_0xf4ca('0x99')][_0xf4ca('0x9a')]({'attributes':[_0xf4ca('0x9b')],'raw':!![]});}})[_0xf4ca('0x5c')](function(_0xf323f){var _0x324ac5=_0xf323f?_0xf323f[_0xf4ca('0x9b')]:undefined;var _0x4f675a=_0x241a95[_0xf4ca('0x19')](function(_0x79682e){return updateInteraction(_0x79682e,_0x383c3e,_0x340b16,_0x324ac5);});return Promise['all'](_0x4f675a);});}function countFilteredInteractions(_0x4e1c5f,_0x3c599f){var _0x40d5ad=_0x4e1c5f[_0xf4ca('0x9c')]();_0x40d5ad['field'](_0xf4ca('0x9d'));_0x40d5ad[_0xf4ca('0xb')](_0xf4ca('0x9e'),_0xf4ca('0x3f'));var _0x53e47a=utils[_0xf4ca('0x22')](_0x3c599f);if(!_['isEmpty'](_0x53e47a)){_0x40d5ad[_0xf4ca('0x17')](_0xf4ca('0x9f'),_0x53e47a);}var _0x56ddf5={'type':db[_0xf4ca('0x6d')][_0xf4ca('0x6e')][_0xf4ca('0x6f')],'raw':!![]};return db[_0xf4ca('0x70')][_0xf4ca('0x71')](_0x40d5ad['toString'](),_0x56ddf5);}module[_0xf4ca('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xcc2a=['_interactions','u.id','u.fullname','ui.','from','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','accounts','messages','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','i.id\x20LIKE\x20?','sms','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','type','default','text','start','value','end','unreadMessages','read','and','Contact','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','Tag','tags','clause','ids','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','user','body','plainBody','keys','some','compact','createdAt','parse','$gte','$lte','\x20IS\x20NULL','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','search','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Sequelize','QueryTypes','sequelize','query','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.mobile','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./utils','../../mysqldb','getAccountFK','agent','select','field','name','color','tools_tags','getInteractionFK'];(function(_0x37b1d8,_0x614312){var _0x3739e7=function(_0x15a5bb){while(--_0x15a5bb){_0x37b1d8['push'](_0x37b1d8['shift']());}};_0x3739e7(++_0x614312);}(_0xcc2a,0x1c6));var _0xacc2=function(_0x4fe749,_0x401bcc){_0x4fe749=_0x4fe749-0x0;var _0x3a591d=_0xcc2a[_0x4fe749];return _0x3a591d;};'use strict';var _=require(_0xacc2('0x0'));var squel=require(_0xacc2('0x1'));var as=require(_0xacc2('0x2'));var qs=require(_0xacc2('0x3'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0xacc2('0x4'));var db=require(_0xacc2('0x5'))['db'];function skipInteractionsQuery(_0xc1a6dc,_0x2a30d5,_0x5e968a){var _0x3296cf=![];var _0x2c282b=utils[_0xacc2('0x6')](_0xc1a6dc);if(_0x2a30d5['role']===_0xacc2('0x7')&&!_0x5e968a['search']&&!_0x5e968a[_0x2c282b]){_0x3296cf=!![];}return _0x3296cf;}function getTagsQuery(){return squel[_0xacc2('0x8')]()[_0xacc2('0x9')]('id')[_0xacc2('0x9')](_0xacc2('0xa'))['field'](_0xacc2('0xb'))['from'](_0xacc2('0xc'));}function getUsersQuery(_0x143d58,_0x5447c2){var _0x223288=utils[_0xacc2('0xd')](_0x143d58);var _0x1cdc0d='user_has_'+_0x143d58+_0xacc2('0xe');var _0x540f0e=squel[_0xacc2('0x8')]()[_0xacc2('0x9')](_0xacc2('0xf'))[_0xacc2('0x9')](_0xacc2('0x10'))[_0xacc2('0x9')](_0xacc2('0x11')+_0x223288)[_0xacc2('0x12')](_0x1cdc0d,'ui')['left_join'](_0xacc2('0x13'),'u',_0xacc2('0x14'));if(_0x5447c2[_0xacc2('0x15')]>0x0){_0x540f0e[_0xacc2('0x16')](_0xacc2('0x11')+_0x223288+_0xacc2('0x17'),_[_0xacc2('0x18')](_0x5447c2,'id'));}return _0x540f0e;}function getInteractionsQuery(_0x11e4d8){var _0x2313eb=utils[_0xacc2('0x19')](_0x11e4d8);var _0x5942ad=utils[_0xacc2('0x6')](_0x11e4d8);var _0x38aeae=utils[_0xacc2('0xd')](_0x11e4d8);return squel['select']()[_0xacc2('0x12')](_0x2313eb[_0xacc2('0x1a')],'i')['left_join'](_0xacc2('0x1b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xacc2('0x1c')](_0xacc2('0x13'),'o',_0xacc2('0x1d'))[_0xacc2('0x1c')](_0x2313eb[_0xacc2('0x1e')],'a','a.id\x20=\x20i.'+_0x5942ad)[_0xacc2('0x1c')](_0x2313eb[_0xacc2('0x1f')],'me','me.'+_0x38aeae+_0xacc2('0x20'))[_0xacc2('0x1c')](_0x2313eb['interactionsTags'],'it',_0xacc2('0x21')+_0x38aeae+_0xacc2('0x20'))['left_join'](_0xacc2('0xc'),'t',_0xacc2('0x22'));}function getSqlClauses(){var _0xe66f3={'body':squel[_0xacc2('0x23')](),'contact':squel[_0xacc2('0x23')](),'default':squel['expr'](),'fields':squel[_0xacc2('0x23')](),'filter':squel[_0xacc2('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0xacc2('0x23')](),'ids':null},'user':squel[_0xacc2('0x23')]()};return _0xe66f3;}function parseTagParameter(_0x49ab73){var _0x17949d=squel[_0xacc2('0x23')]();if(_0x49ab73){var _0x56ec6d=utils[_0xacc2('0x24')](_0x49ab73);_0x56ec6d[_0xacc2('0x25')](function(_0x268c06){_0x17949d['or'](_0xacc2('0x26'),'%,'+_0x268c06+',%');});}return _0x17949d;}function parseReadParameter(_0x554587){var _0x2da3e6='';if(_0x554587){_0x2da3e6=_0xacc2('0x27');if(_0x554587==='1'){_0x2da3e6=_0x2da3e6[_0xacc2('0x28')]('{OPERATOR}','=');}else{_0x2da3e6=_0x2da3e6[_0xacc2('0x28')]('{OPERATOR}','>');}}return _0x2da3e6;}function parseSearchFilter(_0x19a6a8,_0x4ceab8){var _0x1ca6ed=squel[_0xacc2('0x23')]();if(_0x4ceab8){var _0x4ee33d=_0x4ceab8['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xacc2('0x29')](_0x4ee33d)){_0x1ca6ed['or'](_0xacc2('0x2a'),_0x4ee33d+'%');switch(_0x19a6a8){case _0xacc2('0x2b'):case'whatsapp':_0x1ca6ed['or'](_0xacc2('0x2c'),_0x4ee33d+'%');break;case _0xacc2('0x2d'):_0x1ca6ed['or']('i.fax\x20LIKE\x20?',_0x4ee33d+'%');break;case _0xacc2('0x2e'):_0x1ca6ed['or'](_0xacc2('0x2f'),_0x4ee33d+'%');break;case _0xacc2('0x30'):_0x1ca6ed['or'](_0xacc2('0x31'),qs[_0xacc2('0x32')](_0x4ee33d,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xacc2('0x32')](_0x4ee33d));break;}}else if(_0x19a6a8===_0xacc2('0x30')&&qs['isEmail'](_0x4ee33d)){_0x1ca6ed['or']('c.email\x20LIKE\x20?',_0x4ee33d+'%');}else{if(_0x19a6a8==='mail'){_0x1ca6ed['or'](_0xacc2('0x31'),qs['getFullTextValue'](_0x4ee33d,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xacc2('0x32')](_0x4ee33d));}else if(_0x19a6a8!=='fax'){_0x1ca6ed['or'](_0xacc2('0x33'),qs['getFullTextValue'](_0x4ee33d));}_0x1ca6ed['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4ee33d,!![]),null);}}return _0x1ca6ed;}function parseAdvancedSearchFilter(_0x5f5c98,_0x2dce73){var _0x15bcb1=getSqlClauses();var _0xc25043=as[_0xacc2('0x34')](_0x5f5c98);var _0x3186cd=_0xc25043[_0xacc2('0x35')];for(var _0x45ce09=0x0;_0x45ce09<_0xc25043[_0xacc2('0x36')][_0xacc2('0x15')];_0x45ce09++){var _0x5b12e3=_0xc25043[_0xacc2('0x36')][_0x45ce09];var _0xce3056='i';var _0x3dc436=_['find'](_0x2dce73,[_0xacc2('0xa'),_0x5b12e3[_0xacc2('0x9')]]);if(_0x3dc436){var _0x5d5454=as[_0xacc2('0x37')](_0xce3056,_0x3dc436[_0xacc2('0x38')],_0x5b12e3);_0x15bcb1[_0xacc2('0x39')][_0x3186cd](_0x5d5454[_0xacc2('0x3a')],_0x5d5454['value'][_0xacc2('0x3b')],_0x5d5454[_0xacc2('0x3c')][_0xacc2('0x3d')]);}else{switch(_0x5b12e3[_0xacc2('0x9')]){case _0xacc2('0x3e'):var _0x23ecb6=parseReadParameter(_0x5b12e3[_0xacc2('0x3c')]);_0x15bcb1[_0xacc2('0x3f')][_0xacc2('0x40')](_0x23ecb6);break;case _0xacc2('0x41'):if(_0x5b12e3['operator']===_0xacc2('0x42')){if(_0x5b12e3['value'][_0xacc2('0x43')]('\x20')['length']>0x1){_0x15bcb1[_0xacc2('0x44')][_0x3186cd](_0xacc2('0x45'),qs['getFullTextValue'](_0x5b12e3['value'],!![]),null);}else{var _0x4dcf50='%'+_0x5b12e3['value']+'%';_0x15bcb1[_0xacc2('0x44')][_0x3186cd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4dcf50,_0x4dcf50,_0x4dcf50);}}else{_0x3dc436=_[_0xacc2('0x46')](_0x2dce73,['name','ContactId']);_0x5b12e3[_0xacc2('0x9')]='ContactId';_0x5d5454=as[_0xacc2('0x37')](_0xce3056,_0x3dc436[_0xacc2('0x38')],_0x5b12e3);_0x15bcb1[_0xacc2('0x44')][_0x3186cd](_0x5d5454['text'],_0x5d5454['value'][_0xacc2('0x3b')],_0x5d5454['value'][_0xacc2('0x3d')]);}break;case _0xacc2('0x47'):var _0x367c96=_0x5b12e3['value'][_0xacc2('0x43')](',')[_0xacc2('0x18')](function(_0xacc6b5){return Number(_0xacc6b5);});var _0x5ce88d=parseTagParameter(_0x367c96);_0x15bcb1[_0xacc2('0x48')][_0xacc2('0x49')][_0xacc2('0x40')](_0x5ce88d);_0x15bcb1[_0xacc2('0x48')][_0xacc2('0x4a')]=_0x367c96;break;case _0xacc2('0x4b'):if(_0x5b12e3[_0xacc2('0x4c')]==='$substring'){_0x15bcb1['user'][_0x3186cd](_0xacc2('0x4d'),'%'+_0x5b12e3[_0xacc2('0x3c')]+'%',null);}else{_0x3dc436=_[_0xacc2('0x46')](_0x2dce73,[_0xacc2('0xa'),_0xacc2('0x4e')]);_0x5b12e3[_0xacc2('0x9')]=_0xacc2('0x4e');_0x5d5454=as[_0xacc2('0x37')](_0xce3056,_0x3dc436['type'],_0x5b12e3);_0x15bcb1[_0xacc2('0x4f')][_0x3186cd](_0x5d5454['text'],_0x5d5454[_0xacc2('0x3c')][_0xacc2('0x3b')],_0x5d5454[_0xacc2('0x3c')]['end']);}break;case _0xacc2('0x50'):case _0xacc2('0x51'):_0x5d5454=as[_0xacc2('0x37')]('me',null,_0x5b12e3);_0x15bcb1[_0xacc2('0x50')][_0x3186cd](_0x5d5454[_0xacc2('0x3a')],_0x5d5454[_0xacc2('0x3c')]['start'],_0x5d5454[_0xacc2('0x3c')][_0xacc2('0x3d')]);break;}}}return _0x15bcb1;}function parseModelFields(_0x2c1633,_0x202a23,_0x47351d){var _0x427abe=utils['getAccountFK'](_0x2c1633);var _0x2e8f5f=squel['expr']();var _0x1a3496=_(_0x202a23)[_0xacc2('0x52')]()['map'](function(_0x506634){return _[_0xacc2('0x53')](_0x47351d,[_0xacc2('0xa'),_0x506634])?_0x506634:undefined;})[_0xacc2('0x54')]()[_0xacc2('0x3c')]();if(_0x1a3496['length']>0x0){_0x1a3496[_0xacc2('0x25')](function(_0x480571){if(_0x480571===_0x427abe){_0x2e8f5f[_0xacc2('0x40')]('i.'+_0x427abe+'\x20IN\x20?',[]['concat'](_0x202a23[_0x480571]));}else if(_0x480571===_0xacc2('0x55')){var _0x5f1a74=JSON[_0xacc2('0x56')](_0x202a23[_0x480571])[_0xacc2('0x57')];var _0x5eee93=JSON[_0xacc2('0x56')](_0x202a23[_0x480571])[_0xacc2('0x58')];_0x2e8f5f['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5f1a74,_0x5eee93);}else{if(_0x202a23[_0x480571]==='null'){_0x2e8f5f[_0xacc2('0x40')]('i.'+_0x480571+_0xacc2('0x59'));}else{_0x2e8f5f[_0xacc2('0x40')]('i.'+_0x480571+'\x20=\x20?',_0x202a23[_0x480571]);}}});}return _0x2e8f5f;}function parseQueryParameters(_0x1e5257,_0xfbe5ba,_0x2d4191){var _0x53ceb6=getSqlClauses();return Promise[_0xacc2('0x5a')]()['then'](function(){return parseModelFields(_0x1e5257,_0xfbe5ba,_0x2d4191);})[_0xacc2('0x5b')](function(_0x231c75){_0x53ceb6[_0xacc2('0x5c')]['and'](_0x231c75);return parseReadParameter(_0xfbe5ba[_0xacc2('0x3f')]);})[_0xacc2('0x5b')](function(_0x27c957){_0x53ceb6['read'][_0xacc2('0x40')](_0x27c957);return parseTagParameter(_0xfbe5ba[_0xacc2('0x5d')]);})['then'](function(_0x50533d){_0x53ceb6['tags']['clause'][_0xacc2('0x40')](_0x50533d);return parseSearchFilter(_0x1e5257,_0xfbe5ba[_0xacc2('0x5e')]);})[_0xacc2('0x5b')](function(_0x2c1e5a){_0x53ceb6['filter']=_0x2c1e5a;return _0x53ceb6;});}function checkAccountsRestrictions(_0x51a1e6,_0x27a048,_0x22c11e){var _0x5f0d6f=utils['getAccountFK'](_0x51a1e6);var _0x3d77ec='get'+_[_0xacc2('0x5f')](_0x51a1e6)+(_0x51a1e6===_0xacc2('0x60')?_0xacc2('0x61'):_0xacc2('0x62'));var _0x2c41fd=squel['expr']();return Promise['resolve']()[_0xacc2('0x5b')](function(){if(_0x22c11e[_0xacc2('0x63')]&&_0x27a048[_0xacc2('0x64')]==='agent'){return _0x27a048[_0x3d77ec]({'attributes':['id'],'raw':!![]});}})[_0xacc2('0x5b')](function(_0x439e17){if(_0x439e17){if(_0x439e17['length']===0x0){_0x2c41fd[_0xacc2('0x40')]('i.'+_0x5f0d6f+_0xacc2('0x59'));}else{_0x2c41fd[_0xacc2('0x40')]('i.'+_0x5f0d6f+'\x20IN\x20?',_[_0xacc2('0x18')](_0x439e17,'id'));}}else if(!_0x22c11e[_0x5f0d6f]){_0x2c41fd[_0xacc2('0x40')]('i.'+_0x5f0d6f+_0xacc2('0x65'));}})['then'](function(){return _0x2c41fd;});}function getClosedOrderClause(_0x43fb43,_0x4461a0){var _0x3f875b='';var _0x53c20e=[_0xacc2('0x66'),_0xacc2('0x67'),_0xacc2('0x68')];if(_0x43fb43===_0xacc2('0x30')){_0x53c20e[_0xacc2('0x69')](_0xacc2('0x6a'));}if(_0x4461a0[_0xacc2('0x6b')]==='0'&&_0x43fb43===_0xacc2('0x30')){_0x3f875b=_0xacc2('0x6a');}else{if(_0x4461a0[_0xacc2('0x6b')]==='1'){_0x53c20e[_0xacc2('0x6c')]();}_0x3f875b=_0xacc2('0x6d')+_0x53c20e['join'](',\x20')+')';}return _0x3f875b;}function getFilteredInteractions(_0x4dbbcf,_0x3c6e8,_0x4f4436,_0x4d021b){var _0x71cccc=utils[_0xacc2('0xd')](_0x4dbbcf);var _0x326263=_[_0xacc2('0x5f')](_0x4dbbcf)+'Interaction';var _0x4f94e4=[];var _0x195447=getTagsQuery();var _0x227da4={'type':db[_0xacc2('0x6e')][_0xacc2('0x6f')]['SELECT'],'raw':!![]};var _0x1ea802=[];var _0x2411bc=[];return db[_0xacc2('0x70')][_0xacc2('0x71')](_0x195447[_0xacc2('0x72')](),_0x227da4)[_0xacc2('0x5b')](function(_0x444f8f){_0x4f94e4=_[_0xacc2('0x73')](_0x444f8f,'id');_0x227da4=_['merge'](_0x227da4,{'model':db[_0x326263],'mapToModel':!![],'nest':!![]});if(_0x4f4436[_0xacc2('0x5c')]){_0x4d021b['attributes']['forEach'](function(_0x5ce314){_0x3c6e8[_0xacc2('0x9')]('i.'+_0x5ce314);});}else{_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x74'),_0xacc2('0x3e'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x75'),_0xacc2('0x76'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x77'),'Account.mandatoryDisposition');if(_0x4dbbcf==='mail'){_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x78'),'Account.email');_0x3c6e8[_0xacc2('0x9')]('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',_0xacc2('0x79'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x7a'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x7b'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x7c'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x7d'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x7e'));_0x3c6e8[_0xacc2('0x9')]('i.attach');_0x3c6e8['field'](_0xacc2('0x7f'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x80'));_0x3c6e8['field'](_0xacc2('0x81'));_0x3c6e8['field'](_0xacc2('0x68'));_0x3c6e8['field']('i.secondDisposition');_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x66'));_0x3c6e8['field'](_0xacc2('0x6a'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x82'));_0x3c6e8['field'](_0xacc2('0x83'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x84'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x85'));}else if(_0x4dbbcf===_0xacc2('0x2e')){_0x3c6e8[_0xacc2('0x9')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}else{_0x3c6e8[_0xacc2('0x9')]('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');}if(_0x4dbbcf!==_0xacc2('0x30')){_0x3c6e8[_0xacc2('0x9')]('i.*');}_0x3c6e8[_0xacc2('0x9')]('c.firstName',_0xacc2('0x86'));_0x3c6e8['field']('c.lastName',_0xacc2('0x87'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x88'),_0xacc2('0x89'));_0x3c6e8[_0xacc2('0x9')]('c.phone','Contact.phone');_0x3c6e8['field']('c.mobile',_0xacc2('0x8a'));_0x3c6e8[_0xacc2('0x9')]('c.fax','Contact.fax');_0x3c6e8['field'](_0xacc2('0x8b'),_0xacc2('0x8c'));_0x3c6e8[_0xacc2('0x9')]('o.internal',_0xacc2('0x8d'));_0x3c6e8[_0xacc2('0x9')](_0xacc2('0x8e'),_0xacc2('0x8f'));}if(_0x4d021b[_0xacc2('0x90')]){_0x3c6e8['limit'](_0x4d021b[_0xacc2('0x90')]);}if(_0x4d021b[_0xacc2('0x91')]){_0x3c6e8[_0xacc2('0x91')](_0x4d021b['offset']);}return db['sequelize'][_0xacc2('0x71')](_0x3c6e8['toString'](),_0x227da4);})['then'](function(_0x39b94e){_0x1ea802=_0x39b94e;var _0x4b1d9f=getUsersQuery(_0x4dbbcf,_0x1ea802);return db[_0xacc2('0x70')][_0xacc2('0x71')](_0x4b1d9f[_0xacc2('0x72')](),_0x227da4);})[_0xacc2('0x5b')](function(_0x1596a0){_0x2411bc=_[_0xacc2('0x92')](_0x1596a0,_0x71cccc);if(_0x4dbbcf===_0xacc2('0x30')){return db[_0xacc2('0x93')][_0xacc2('0x94')]({'attributes':[_0xacc2('0x95')],'raw':!![]});}})[_0xacc2('0x5b')](function(_0x182330){var _0x2aad53=_0x182330?_0x182330['enableEmailPreview']:undefined;var _0x81ce2e=_0x1ea802[_0xacc2('0x18')](function(_0x445f31){return updateInteraction(_0x445f31,_0x4f94e4,_0x2411bc,_0x2aad53);});return Promise[_0xacc2('0x96')](_0x81ce2e);});}function countFilteredInteractions(_0x2025ad,_0x4bb66f){var _0xd8679b=_0x2025ad[_0xacc2('0x97')]();_0xd8679b[_0xacc2('0x9')]('COUNT(*)');_0xd8679b[_0xacc2('0x9')](_0xacc2('0x74'),'unreadMessages');var _0x159658=utils[_0xacc2('0x24')](_0x4bb66f);if(!_[_0xacc2('0x98')](_0x159658)){_0xd8679b[_0xacc2('0x16')](_0xacc2('0x99'),_0x159658);}var _0x2539d4={'type':db['Sequelize']['QueryTypes'][_0xacc2('0x9a')],'raw':!![]};return db[_0xacc2('0x70')][_0xacc2('0x71')](_0xd8679b[_0xacc2('0x72')](),_0x2539d4);}module[_0xacc2('0x9b')]={'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 e729b5b..c257f88 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 _0xa088=['talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting'];(function(_0x9ce749,_0x38b8cf){var _0x3d2c62=function(_0x58d630){while(--_0x58d630){_0x9ce749['push'](_0x9ce749['shift']());}};_0x3d2c62(++_0x38b8cf);}(_0xa088,0x18d));var _0x8a08=function(_0x29bbe0,_0x421be4){_0x29bbe0=_0x29bbe0-0x0;var _0x4b2c42=_0xa088[_0x29bbe0];return _0x4b2c42;};'use strict';var _=require(_0x8a08('0x0'));var db=require(_0x8a08('0x1'))['db'];function getInteractionUsers(_0x58edae,_0x3ab79c){return new Promise(function(_0x4aaf34,_0x109722){try{var _0x4fa542=[];if(_0x3ab79c[_0x58edae]){_0x4fa542=_0x3ab79c[_0x58edae][_0x8a08('0x2')](function(_0x2139f5){return{'id':_0x2139f5['id'],'fullname':_0x2139f5[_0x8a08('0x3')]};});}return _0x4aaf34(_0x4fa542);}catch(_0x2e7153){_0x109722(_0x2e7153);}});}function getInteractionTags(_0x47f191,_0x3f0eaa){var _0xacb3d5=[];if(_0x47f191){_0x47f191[_0x8a08('0x4')](',')[_0x8a08('0x5')](function(_0x432a71){_0xacb3d5[_0x8a08('0x6')](_0x3f0eaa[_0x432a71]);});}return _0xacb3d5;}function updateWaitingCounter(_0x520036){if(_0x520036[_0x8a08('0x7')]){_0x520036[_0x8a08('0x7')]-=0x1;}}function updateInteractionCounters(_0x26e475){_0x26e475['waiting']=0x0;_0x26e475[_0x8a08('0x8')]=0x0;_0x26e475[_0x8a08('0x9')]=0x0;_0x26e475[_0x8a08('0xa')]=0x0;_0x26e475[_0x8a08('0xb')]=0x0;_0x26e475[_0x8a08('0xc')]=0x0;if(_0x26e475['closed']){if(_0x26e475[_0x8a08('0xd')]==='abandoned'){_0x26e475[_0x8a08('0xb')]+=0x1;updateWaitingCounter(_0x26e475);}if(_0x26e475[_0x8a08('0xe')]){_0x26e475['answered']+=0x1;if(_0x26e475[_0x8a08('0x8')]){_0x26e475['talking']-=0x1;}}else{if(_0x26e475[_0x8a08('0xd')]){_0x26e475[_0x8a08('0xa')]+=0x1;updateWaitingCounter(_0x26e475);}}}else{if(!_0x26e475[_0x8a08('0xe')]){_0x26e475['waiting']+=0x1;}if(_0x26e475[_0x8a08('0xe')]){_0x26e475[_0x8a08('0x8')]+=0x1;updateWaitingCounter(_0x26e475);}}_0x26e475[_0x8a08('0xc')]+=0x1;return _0x26e475;}function getLastMessageText(_0x5effe7){return db[_0x8a08('0xf')][_0x8a08('0x10')]({'where':{'$and':[{'MailInteractionId':_0x5effe7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8a08('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8a08('0x12')],'order':_0x8a08('0x13'),'raw':!![]})[_0x8a08('0x14')](function(_0x63d540){if(_0x63d540&&_0x63d540[_0x8a08('0x12')]){_0x5effe7[_0x8a08('0x15')]=_[_0x8a08('0x16')](_0x63d540['plainBody']);}return _0x5effe7;})[_0x8a08('0x17')](function(_0x5dce1){throw _0x5dce1;});}exports[_0x8a08('0x18')]=function(_0x30829d,_0x1c7d60,_0x1c6e47,_0x49baa2){return new Promise(function(_0x35afe2,_0x2bd9f9){return getInteractionUsers(_0x30829d['id'],_0x1c6e47)['then'](function(_0xb33d31){_0x30829d[_0x8a08('0x19')]=_0xb33d31;return getInteractionTags(_0x30829d['TagIds'],_0x1c7d60);})[_0x8a08('0x14')](function(_0x436ef5){_0x30829d[_0x8a08('0x1a')]=_0x436ef5;delete _0x30829d['TagIds'];return updateInteractionCounters(_0x30829d);})[_0x8a08('0x14')](function(_0x110fa2){if(_0x49baa2){return getLastMessageText(_0x110fa2);}else{return _0x110fa2;}})[_0x8a08('0x14')](function(_0x380bc3){_0x35afe2(_0x380bc3);})[_0x8a08('0x17')](function(_0x5039df){_0x2bd9f9(_0x5039df);});});}; \ No newline at end of file +var _0xcbc9=['UserId','answered','unmanaged','MailMessage','findOne','out','plainBody','lastMsgText','then','Users','TagIds','Tags','catch','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','abandoned','total','closed','disposition'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xcbc9,0x152));var _0x9cbc=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0xcbc9[_0x49f67f];return _0x4779a1;};'use strict';var _=require('lodash');var db=require(_0x9cbc('0x0'))['db'];function getInteractionUsers(_0x22645d,_0xc210b4){return new Promise(function(_0x549f61,_0x58d0a6){try{var _0x563f90=[];if(_0xc210b4[_0x22645d]){_0x563f90=_0xc210b4[_0x22645d][_0x9cbc('0x1')](function(_0x301425){return{'id':_0x301425['id'],'fullname':_0x301425[_0x9cbc('0x2')]};});}return _0x549f61(_0x563f90);}catch(_0x371273){_0x58d0a6(_0x371273);}});}function getInteractionTags(_0x2b2b3c,_0x33bc61){var _0x3d26a5=[];if(_0x2b2b3c){_0x2b2b3c[_0x9cbc('0x3')](',')[_0x9cbc('0x4')](function(_0x4b2316){_0x3d26a5[_0x9cbc('0x5')](_0x33bc61[_0x4b2316]);});}return _0x3d26a5;}function updateWaitingCounter(_0x59caad){if(_0x59caad[_0x9cbc('0x6')]){_0x59caad[_0x9cbc('0x6')]-=0x1;}}function updateInteractionCounters(_0x54c3b4){_0x54c3b4[_0x9cbc('0x6')]=0x0;_0x54c3b4[_0x9cbc('0x7')]=0x0;_0x54c3b4['answered']=0x0;_0x54c3b4['unmanaged']=0x0;_0x54c3b4[_0x9cbc('0x8')]=0x0;_0x54c3b4[_0x9cbc('0x9')]=0x0;if(_0x54c3b4[_0x9cbc('0xa')]){if(_0x54c3b4[_0x9cbc('0xb')]==='abandoned'){_0x54c3b4[_0x9cbc('0x8')]+=0x1;updateWaitingCounter(_0x54c3b4);}if(_0x54c3b4[_0x9cbc('0xc')]){_0x54c3b4[_0x9cbc('0xd')]+=0x1;if(_0x54c3b4[_0x9cbc('0x7')]){_0x54c3b4[_0x9cbc('0x7')]-=0x1;}}else{if(_0x54c3b4[_0x9cbc('0xb')]){_0x54c3b4[_0x9cbc('0xe')]+=0x1;updateWaitingCounter(_0x54c3b4);}}}else{if(!_0x54c3b4['UserId']){_0x54c3b4[_0x9cbc('0x6')]+=0x1;}if(_0x54c3b4[_0x9cbc('0xc')]){_0x54c3b4['talking']+=0x1;updateWaitingCounter(_0x54c3b4);}}_0x54c3b4['total']+=0x1;return _0x54c3b4;}function getLastMessageText(_0x583f98){return db[_0x9cbc('0xf')][_0x9cbc('0x10')]({'where':{'$and':[{'MailInteractionId':_0x583f98['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9cbc('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9cbc('0x12')],'order':'-id','raw':!![]})['then'](function(_0x5efae3){if(_0x5efae3&&_0x5efae3[_0x9cbc('0x12')]){_0x583f98[_0x9cbc('0x13')]=_['trimStart'](_0x5efae3[_0x9cbc('0x12')]);}return _0x583f98;})['catch'](function(_0x32a7f8){throw _0x32a7f8;});}exports['updateInteraction']=function(_0x20231e,_0x4cadab,_0x58601f,_0x5bb6d8){return new Promise(function(_0xee0d53,_0x59d9e7){return getInteractionUsers(_0x20231e['id'],_0x58601f)[_0x9cbc('0x14')](function(_0xe30738){_0x20231e[_0x9cbc('0x15')]=_0xe30738;return getInteractionTags(_0x20231e[_0x9cbc('0x16')],_0x4cadab);})['then'](function(_0x2fd641){_0x20231e[_0x9cbc('0x17')]=_0x2fd641;delete _0x20231e[_0x9cbc('0x16')];return updateInteractionCounters(_0x20231e);})['then'](function(_0x1f9c1f){if(_0x5bb6d8){return getLastMessageText(_0x1f9c1f);}else{return _0x1f9c1f;}})[_0x9cbc('0x14')](function(_0x4db54e){_0xee0d53(_0x4db54e);})[_0x9cbc('0x18')](function(_0xf14af1){_0x59d9e7(_0xf14af1);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c795c28..8a5aae9 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 _0x686d=['../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update','info','catch','error','exports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x686d,0x153));var _0xd686=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0x686d[_0x47a12a];return _0x30cd40;};'use strict';var _=require(_0xd686('0x0'));var db=require(_0xd686('0x1'))['db'];var loggers={'openchannel':require(_0xd686('0x2'))(_0xd686('0x3')),'mail':require(_0xd686('0x2'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0xd686('0x4')),'chat':require('../../config/logger')(_0xd686('0x5')),'whatsapp':require('../../config/logger')(_0xd686('0x6'))};function getAccountFK(_0x16b409){return _[_0xd686('0x7')](_0x16b409)+(_0x16b409===_0xd686('0x8')?_0xd686('0x9'):_0xd686('0xa'))+'Id';}function getInteractionFK(_0xc0b4bd){return _[_0xd686('0x7')](_0xc0b4bd)+_0xd686('0xb');}function getInteractionId(_0x4b403c,_0x472e7a,_0x2de8c7){if(_0x4b403c&&_0x4b403c[_[_0xd686('0xc')](_0x2de8c7)+_0xd686('0xb')]){return _0x4b403c[_[_0xd686('0xc')](_0x2de8c7)+_0xd686('0xb')];}else if(_0x4b403c&&_0x4b403c['id']){return _0x4b403c['id'];}else if(_0x472e7a&&_0x472e7a['id']){return _0x472e7a['id'];}else{return _0xd686('0xd');}}function getInteractionsTables(_0x22c39c){return{'accounts':_0x22c39c+'_'+(_0x22c39c==='chat'?_0xd686('0xe'):_0xd686('0xf')),'interactions':_0x22c39c+_0xd686('0x10'),'interactionsTags':_0x22c39c+_0xd686('0x11'),'messages':_0x22c39c+_0xd686('0x12'),'userInteractions':_0xd686('0x13')+_0x22c39c+_0xd686('0x10')};}function getSelectedTags(_0x44f5b7){var _0x43b01a=[];if(_0x44f5b7){_0x43b01a=Array['isArray'](_0x44f5b7)?_0x44f5b7:[_0x44f5b7];}return _0x43b01a;}function log(_0x2f7370,_0x20dcc7,_0x43c511,_0xa94caa,_0x1a6416,_0x5aff08){loggers[_0x1a6416[_0xd686('0x14')]()][_0x2f7370](_0xd686('0x15'),_0x5aff08[_0xd686('0x16')](),_0x20dcc7?_0x20dcc7['id']:null,_0x20dcc7?_0x20dcc7[_0xd686('0x17')]:null,_0x20dcc7?_0x20dcc7[_0xd686('0x18')]:null,getInteractionId(_0x43c511,_0xa94caa,_0x1a6416),_0x43c511?JSON['stringify'](_0x43c511):_0xd686('0x19'));}function updateUser(_0x18edf8,_0x13aa38,_0x2cad24,_0x45dc7c,_0x5698df){db[_[_0xd686('0xc')](_0x45dc7c)+_0xd686('0x1a')][_0xd686('0x1b')]({'where':{'id':getInteractionId(_0x13aa38,_0x2cad24,_0x45dc7c)}})[_0xd686('0x1c')](function(_0x59bcfb){if(_0x59bcfb){return _0x59bcfb[_0xd686('0x1d')]({'UserId':_0x18edf8?_0x18edf8['id']:null});}})[_0xd686('0x1c')](function(_0x20da1a){if(_0x20da1a){log(_0xd686('0x1e'),_0x18edf8,_0x13aa38,_0x2cad24,_0x45dc7c,_0x5698df);}})[_0xd686('0x1f')](function(){log(_0xd686('0x20'),_0x18edf8,_0x13aa38,_0x2cad24,_0x45dc7c,_0x5698df);});}module[_0xd686('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xdc45=['../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','websites','accounts','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','update','info','catch','error','exports','lodash','../../mysqldb'];(function(_0x2a8204,_0x1eed4a){var _0x9acde3=function(_0x56b957){while(--_0x56b957){_0x2a8204['push'](_0x2a8204['shift']());}};_0x9acde3(++_0x1eed4a);}(_0xdc45,0x184));var _0x5dc4=function(_0x45efa3,_0x3f5578){_0x45efa3=_0x45efa3-0x0;var _0x475953=_0xdc45[_0x45efa3];return _0x475953;};'use strict';var _=require(_0x5dc4('0x0'));var db=require(_0x5dc4('0x1'))['db'];var loggers={'openchannel':require(_0x5dc4('0x2'))(_0x5dc4('0x3')),'mail':require('../../config/logger')(_0x5dc4('0x4')),'fax':require(_0x5dc4('0x2'))(_0x5dc4('0x5')),'sms':require(_0x5dc4('0x2'))(_0x5dc4('0x6')),'chat':require(_0x5dc4('0x2'))('chat-interactions'),'whatsapp':require(_0x5dc4('0x2'))('whatsapp-interactions')};function getAccountFK(_0x12480e){return _['capitalize'](_0x12480e)+(_0x12480e===_0x5dc4('0x7')?_0x5dc4('0x8'):_0x5dc4('0x9'))+'Id';}function getInteractionFK(_0x683a83){return _[_0x5dc4('0xa')](_0x683a83)+_0x5dc4('0xb');}function getInteractionId(_0x32ff52,_0x5c6c5d,_0x12ab78){if(_0x32ff52&&_0x32ff52[_[_0x5dc4('0xc')](_0x12ab78)+_0x5dc4('0xb')]){return _0x32ff52[_[_0x5dc4('0xc')](_0x12ab78)+'InteractionId'];}else if(_0x32ff52&&_0x32ff52['id']){return _0x32ff52['id'];}else if(_0x5c6c5d&&_0x5c6c5d['id']){return _0x5c6c5d['id'];}else{return'unknown';}}function getInteractionsTables(_0x54f125){return{'accounts':_0x54f125+'_'+(_0x54f125===_0x5dc4('0x7')?_0x5dc4('0xd'):_0x5dc4('0xe')),'interactions':_0x54f125+'_interactions','interactionsTags':_0x54f125+'_interaction_has_tags','messages':_0x54f125+'_messages','userInteractions':'user_has_'+_0x54f125+_0x5dc4('0xf')};}function getSelectedTags(_0x327064){var _0x4f43f8=[];if(_0x327064){_0x4f43f8=Array[_0x5dc4('0x10')](_0x327064)?_0x327064:[_0x327064];}return _0x4f43f8;}function log(_0x4106c6,_0xf60eb7,_0x2a9709,_0x2aed96,_0x4a698e,_0x3b7f28){loggers[_0x4a698e[_0x5dc4('0x11')]()][_0x4106c6](_0x5dc4('0x12'),_0x3b7f28[_0x5dc4('0x13')](),_0xf60eb7?_0xf60eb7['id']:null,_0xf60eb7?_0xf60eb7[_0x5dc4('0x14')]:null,_0xf60eb7?_0xf60eb7[_0x5dc4('0x15')]:null,getInteractionId(_0x2a9709,_0x2aed96,_0x4a698e),_0x2a9709?JSON['stringify'](_0x2a9709):_0x5dc4('0x16'));}function updateUser(_0x5dddc0,_0x33a628,_0x3225b8,_0x29584a,_0x148cde){db[_['upperFirst'](_0x29584a)+_0x5dc4('0x17')][_0x5dc4('0x18')]({'where':{'id':getInteractionId(_0x33a628,_0x3225b8,_0x29584a)}})['then'](function(_0x4ce97c){if(_0x4ce97c){return _0x4ce97c[_0x5dc4('0x19')]({'UserId':_0x5dddc0?_0x5dddc0['id']:null});}})['then'](function(_0x8588df){if(_0x8588df){log(_0x5dc4('0x1a'),_0x5dddc0,_0x33a628,_0x3225b8,_0x29584a,_0x148cde);}})[_0x5dc4('0x1b')](function(){log(_0x5dc4('0x1c'),_0x5dddc0,_0x33a628,_0x3225b8,_0x29584a,_0x148cde);});}module[_0x5dc4('0x1d')]={'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 93876e2..9eaeffd 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 _0x544d=['format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','findOne','count','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher'];(function(_0xfc722f,_0x3f3954){var _0x2648d1=function(_0x131112){while(--_0x131112){_0xfc722f['push'](_0xfc722f['shift']());}};_0x2648d1(++_0x3f3954);}(_0x544d,0xbb));var _0xd544=function(_0x158d04,_0xbc4c8){_0x158d04=_0x158d04-0x0;var _0x454dfe=_0x544d[_0x158d04];return _0x454dfe;};'use strict';var crypto=require(_0xd544('0x0'));var util=require(_0xd544('0x1'));var compose=require(_0xd544('0x2'));var db=require(_0xd544('0x3'))['db'];var config=require(_0xd544('0x4'));function getValueFromLicense(_0x3809f6,_0x4e0ceb){if(_0x3809f6&&_0x4e0ceb){if(_0x4e0ceb[_0xd544('0x5')]&&_0x4e0ceb[_0xd544('0x6')]){var _0x3ca222=_0x4e0ceb[_0xd544('0x5')];var _0x4697e3=_0x4e0ceb['license'];var _0x306878=_0x3ca222[_0xd544('0x7')]('-')[0x4];var _0x4b1123=_0x3ca222[_0xd544('0x7')]('-')[0x0];var _0x1750b1=crypto[_0xd544('0x8')]('aes-256-ctr',util[_0xd544('0x9')](_0xd544('0xa'),_0x306878,_0x3ca222,_0x4b1123));var _0x1aa625=_0x1750b1[_0xd544('0xb')](_0x4697e3,'base64',_0xd544('0xc'));_0x1aa625+=_0x1750b1[_0xd544('0xd')](_0xd544('0xc'));var _0x32dafc=JSON[_0xd544('0xe')](_0x1aa625);return _0x32dafc[_0xd544('0xf')](_0x3809f6)?_0x32dafc[_0x3809f6]:null;}}return null;}function isLimit(_0x5081e8,_0x5893c6,_0xe235a0,_0x530037){var _0x5601e1=_0x5893c6;return compose()[_0xd544('0x10')](function(_0x24270a,_0x436c20,_0x43ae8b){return db[_0xd544('0x11')][_0xd544('0x12')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4b384f){var _0x53556e=getValueFromLicense(_0x5081e8,_0x4b384f);return _0x53556e?_0x53556e:_0x5601e1;})['then'](function(_0x50a810){_0x5601e1=_0x50a810;return _0xe235a0[_0xd544('0x13')](_0x530037);})[_0xd544('0x14')](function(_0x1b617c){if(_0x1b617c>=_0x5601e1){return _0x436c20[_0xd544('0x15')](0x193)['json']({'message':util[_0xd544('0x9')](_0xd544('0x16'),_0x5081e8)});}_0x43ae8b();})['catch'](function(_0x29060b){_0x43ae8b(_0x29060b);});});}function isUserLimit(){return isLimit(_0xd544('0x17'),0x1,db[_0xd544('0x18')],{'where':{'$or':[{'role':_0xd544('0x19')},{'role':_0xd544('0x1a')}]}});}exports[_0xd544('0x1b')]=isUserLimit; \ No newline at end of file +var _0xb239=['isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user'];(function(_0x81430c,_0x16bdcc){var _0x39402a=function(_0x2efc90){while(--_0x2efc90){_0x81430c['push'](_0x81430c['shift']());}};_0x39402a(++_0x16bdcc);}(_0xb239,0x139));var _0x9b23=function(_0x3501e2,_0x283304){_0x3501e2=_0x3501e2-0x0;var _0x5a6399=_0xb239[_0x3501e2];return _0x5a6399;};'use strict';var crypto=require(_0x9b23('0x0'));var util=require('util');var compose=require(_0x9b23('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x9b23('0x2'));function getValueFromLicense(_0x1201d2,_0x1cdd7c){if(_0x1201d2&&_0x1cdd7c){if(_0x1cdd7c['data1']&&_0x1cdd7c['license']){var _0xf13515=_0x1cdd7c[_0x9b23('0x3')];var _0x25dc0b=_0x1cdd7c[_0x9b23('0x4')];var _0x1ffcfb=_0xf13515[_0x9b23('0x5')]('-')[0x4];var _0x508100=_0xf13515[_0x9b23('0x5')]('-')[0x0];var _0x198b2f=crypto[_0x9b23('0x6')]('aes-256-ctr',util[_0x9b23('0x7')](_0x9b23('0x8'),_0x1ffcfb,_0xf13515,_0x508100));var _0x2fc238=_0x198b2f[_0x9b23('0x9')](_0x25dc0b,'base64',_0x9b23('0xa'));_0x2fc238+=_0x198b2f[_0x9b23('0xb')](_0x9b23('0xa'));var _0x225ff6=JSON[_0x9b23('0xc')](_0x2fc238);return _0x225ff6[_0x9b23('0xd')](_0x1201d2)?_0x225ff6[_0x1201d2]:null;}}return null;}function isLimit(_0x2c83fe,_0x57d1ee,_0x222f67,_0x2caa13){var _0x550080=_0x57d1ee;return compose()[_0x9b23('0xe')](function(_0x222317,_0x6500dc,_0x4a83f6){return db[_0x9b23('0xf')][_0x9b23('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x23b4ac){var _0x350e33=getValueFromLicense(_0x2c83fe,_0x23b4ac);return _0x350e33?_0x350e33:_0x550080;})[_0x9b23('0x11')](function(_0x3789a0){_0x550080=_0x3789a0;return _0x222f67['count'](_0x2caa13);})[_0x9b23('0x11')](function(_0x4071db){if(_0x4071db>=_0x550080){return _0x6500dc[_0x9b23('0x12')](0x193)[_0x9b23('0x13')]({'message':util['format'](_0x9b23('0x14'),_0x2c83fe)});}_0x4a83f6();})[_0x9b23('0x15')](function(_0xca956a){_0x4a83f6(_0xca956a);});});}function isUserLimit(){return isLimit(_0x9b23('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x9b23('0x17')},{'role':_0x9b23('0x18')}]}});}exports[_0x9b23('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 6651725..bca7fe3 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 _0xc862=['length','shift','forEach','filter','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split'];(function(_0x3b2489,_0x4a1f11){var _0x142a2b=function(_0x103721){while(--_0x103721){_0x3b2489['push'](_0x3b2489['shift']());}};_0x142a2b(++_0x4a1f11);}(_0xc862,0x130));var _0x2c86=function(_0x3dcf16,_0x371872){_0x3dcf16=_0x3dcf16-0x0;var _0x35f04c=_0xc862[_0x3dcf16];return _0x35f04c;};'use strict';var _=require(_0x2c86('0x0'));var moment=require('moment');exports[_0x2c86('0x1')]=function(_0x1f2ab0){var _0x4ec502={'conditions':[]};_0x4ec502[_0x2c86('0x2')]=_[_0x2c86('0x3')](_0x1f2ab0,'[$or]')?'or':'and';var _0x4bdbad=_0x1f2ab0[_0x2c86('0x4')](_0x2c86('0x5'),'')[_0x2c86('0x4')](_0x2c86('0x6'),'')[_0x2c86('0x7')]('||');for(var _0x6cdbd7=0x0;_0x6cdbd7<_0x4bdbad[_0x2c86('0x8')];_0x6cdbd7++){var _0x14bd7b=_0x4bdbad[_0x6cdbd7][_0x2c86('0x7')](':=');var _0x5bbef6=_0x14bd7b[0x0];var _0x51554e=_0x14bd7b['slice'](0x1);_0x51554e['forEach'](function(_0x116177){var _0x352bb8=_0x116177[_0x2c86('0x7')]('[')[_0x2c86('0x9')]();var _0x47e8aa=_0x116177['match'](/\[(.*?)\]/g);_0x47e8aa[_0x2c86('0xa')](function(_0x30f6f0){var _0x11ab23=_0x30f6f0[_0x2c86('0x7')]('[')[_0x2c86('0xb')](function(_0x352b14){return _0x352b14['indexOf'](']')>-0x1;})['map'](function(_0x2ed1c7){return _0x2ed1c7[_0x2c86('0x7')](']')[0x0];})[0x0];_0x4ec502[_0x2c86('0xc')][_0x2c86('0xd')]({'field':_0x5bbef6,'operator':_0x352bb8,'value':_0x11ab23});});});}return _0x4ec502;};exports[_0x2c86('0xe')]=function(_0x507d9d,_0x49dab7,_0x3f9fb0){var _0x5e3a71={};if(_0x49dab7===_0x2c86('0xf')){if(_0x3f9fb0[_0x2c86('0x10')]===_0x2c86('0x11')){_0x3f9fb0[_0x2c86('0x10')]='$between';_0x3f9fb0['value']+=','+_0x3f9fb0[_0x2c86('0x12')];}else if(_[_0x2c86('0x13')]([_0x2c86('0x14'),_0x2c86('0x15')],_0x3f9fb0[_0x2c86('0x10')])){_0x3f9fb0[_0x2c86('0x12')]=moment(_0x3f9fb0[_0x2c86('0x12')])[_0x2c86('0x16')](0x1,_0x2c86('0x17'))[_0x2c86('0x18')](_0x2c86('0x19'));}}if(_0x3f9fb0['castTo']){_0x49dab7=_0x3f9fb0[_0x2c86('0x1a')];_0x5e3a71[_0x2c86('0x1b')]=_0x2c86('0x1c')+_0x507d9d+'.'+_0x3f9fb0[_0x2c86('0x1d')]+'\x20AS\x20'+_0x3f9fb0[_0x2c86('0x1a')]+')\x20'+parseOperator(_0x3f9fb0[_0x2c86('0x10')]);}else{_0x5e3a71['text']=_0x507d9d+'.'+_0x3f9fb0['field']+'\x20'+parseOperator(_0x3f9fb0['operator']);}if(_[_0x2c86('0x13')]([_0x2c86('0x1e'),_0x2c86('0x1f')],_0x3f9fb0['operator']))_0x5e3a71['text']='('+_0x5e3a71[_0x2c86('0x1b')]+_0x2c86('0x20')+_0x507d9d+'.'+_0x3f9fb0[_0x2c86('0x1d')]+'\x20IS\x20NULL)';_0x5e3a71[_0x2c86('0x12')]=parseValue(_0x49dab7,_0x3f9fb0[_0x2c86('0x10')],_0x3f9fb0[_0x2c86('0x12')]);return _0x5e3a71;};function parseOperator(_0x409b36){var _0x2bea9f;switch(_0x409b36){case'$in':_0x2bea9f='IN\x20?';break;case'$notIn':_0x2bea9f=_0x2c86('0x21');break;case _0x2c86('0x11'):_0x2bea9f=_0x2c86('0x22');break;case _0x2c86('0x1e'):_0x2bea9f=_0x2c86('0x23');break;case _0x2c86('0x24'):case'$startsWith':case _0x2c86('0x25'):_0x2bea9f=_0x2c86('0x26');break;case'$lt':_0x2bea9f='<\x20?';break;case'$gt':_0x2bea9f=_0x2c86('0x27');break;case'$lte':_0x2bea9f=_0x2c86('0x28');break;case _0x2c86('0x29'):_0x2bea9f='>=\x20?';break;case _0x2c86('0x2a'):_0x2bea9f=_0x2c86('0x2b');break;}return _0x2bea9f;}function parseValue(_0x2fe010,_0x19bb70,_0x11aee1){var _0x4ed448={'start':undefined,'end':undefined};switch(_0x19bb70){case _0x2c86('0x2c'):case'$notIn':_0x4ed448[_0x2c86('0x2d')]=_0x11aee1[_0x2c86('0x7')](',');break;case _0x2c86('0x24'):_0x4ed448['start']='%'+_0x11aee1+'%';break;case _0x2c86('0x2e'):_0x4ed448['start']=_0x11aee1+'%';break;case'$endsWith':_0x4ed448[_0x2c86('0x2d')]='%'+_0x11aee1;break;case'$between':var _0x4be89b=_0x11aee1[_0x2c86('0x7')](',');var _0x11aee1=_0x4be89b[_0x2c86('0x9')]();var _0x32a549=_0x4be89b[_0x2c86('0x2f')]();if(_0x2fe010===_0x2c86('0xf')){_0x11aee1=moment(_0x11aee1)[_0x2c86('0x30')](0x0,!![])[_0x2c86('0x18')]();_0x32a549=moment(_0x32a549)[_0x2c86('0x30')](0x0,!![])[_0x2c86('0x16')](0x17,_0x2c86('0x31'))['add'](0x3b,_0x2c86('0x32'))[_0x2c86('0x16')](0x3b,_0x2c86('0x33'))[_0x2c86('0x18')]();}_0x4ed448={'start':_0x11aee1,'end':_0x32a549};break;default:_0x4ed448[_0x2c86('0x2d')]=_0x11aee1;break;}return _0x4ed448;} \ No newline at end of file +var _0x83c5=['$startsWith','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','indexOf','map','push','buildExpression','$eq','operator','includes','$gt','$lte','value','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','<=\x20?','$between','start'];(function(_0x24243b,_0x55c567){var _0x1a85ce=function(_0x28c017){while(--_0x28c017){_0x24243b['push'](_0x24243b['shift']());}};_0x1a85ce(++_0x55c567);}(_0x83c5,0x114));var _0x583c=function(_0x3a24b5,_0x313359){_0x3a24b5=_0x3a24b5-0x0;var _0x3c6702=_0x83c5[_0x3a24b5];return _0x3c6702;};'use strict';var _=require(_0x583c('0x0'));var moment=require(_0x583c('0x1'));exports['parseSearch']=function(_0x242287){var _0x54ee49={'conditions':[]};_0x54ee49[_0x583c('0x2')]=_[_0x583c('0x3')](_0x242287,_0x583c('0x4'))?'or':_0x583c('0x5');var _0x5c32b9=_0x242287[_0x583c('0x6')](_0x583c('0x7'),'')[_0x583c('0x6')]('[$or]','')[_0x583c('0x8')]('||');for(var _0x1b6b50=0x0;_0x1b6b50<_0x5c32b9['length'];_0x1b6b50++){var _0x1b6214=_0x5c32b9[_0x1b6b50][_0x583c('0x8')](':=');var _0x300d9f=_0x1b6214[0x0];var _0x102639=_0x1b6214[_0x583c('0x9')](0x1);_0x102639[_0x583c('0xa')](function(_0x21c261){var _0x5c58f0=_0x21c261[_0x583c('0x8')]('[')[_0x583c('0xb')]();var _0x17a703=_0x21c261[_0x583c('0xc')](/\[(.*?)\]/g);_0x17a703[_0x583c('0xa')](function(_0x293e2e){var _0x4a85a2=_0x293e2e[_0x583c('0x8')]('[')['filter'](function(_0x1ba57b){return _0x1ba57b[_0x583c('0xd')](']')>-0x1;})[_0x583c('0xe')](function(_0x4d1cd8){return _0x4d1cd8[_0x583c('0x8')](']')[0x0];})[0x0];_0x54ee49['conditions'][_0x583c('0xf')]({'field':_0x300d9f,'operator':_0x5c58f0,'value':_0x4a85a2});});});}return _0x54ee49;};exports[_0x583c('0x10')]=function(_0x1c183e,_0x9b9e00,_0x35dcda){var _0x38ac29={};if(_0x9b9e00==='DATE'){if(_0x35dcda['operator']===_0x583c('0x11')){_0x35dcda[_0x583c('0x12')]='$between';_0x35dcda['value']+=','+_0x35dcda['value'];}else if(_[_0x583c('0x13')]([_0x583c('0x14'),_0x583c('0x15')],_0x35dcda[_0x583c('0x12')])){_0x35dcda[_0x583c('0x16')]=moment(_0x35dcda['value'])[_0x583c('0x17')](0x1,_0x583c('0x18'))[_0x583c('0x19')](_0x583c('0x1a'));}}if(_0x35dcda[_0x583c('0x1b')]){_0x9b9e00=_0x35dcda[_0x583c('0x1b')];_0x38ac29[_0x583c('0x1c')]=_0x583c('0x1d')+_0x1c183e+'.'+_0x35dcda[_0x583c('0x1e')]+_0x583c('0x1f')+_0x35dcda['castTo']+')\x20'+parseOperator(_0x35dcda[_0x583c('0x12')]);}else{_0x38ac29[_0x583c('0x1c')]=_0x1c183e+'.'+_0x35dcda[_0x583c('0x1e')]+'\x20'+parseOperator(_0x35dcda[_0x583c('0x12')]);}if(_['includes']([_0x583c('0x20'),'$notIn'],_0x35dcda[_0x583c('0x12')]))_0x38ac29[_0x583c('0x1c')]='('+_0x38ac29[_0x583c('0x1c')]+_0x583c('0x21')+_0x1c183e+'.'+_0x35dcda[_0x583c('0x1e')]+_0x583c('0x22');_0x38ac29['value']=parseValue(_0x9b9e00,_0x35dcda[_0x583c('0x12')],_0x35dcda['value']);return _0x38ac29;};function parseOperator(_0xc2f8bf){var _0x243058;switch(_0xc2f8bf){case _0x583c('0x23'):_0x243058=_0x583c('0x24');break;case _0x583c('0x25'):_0x243058=_0x583c('0x26');break;case _0x583c('0x11'):_0x243058=_0x583c('0x27');break;case _0x583c('0x20'):_0x243058=_0x583c('0x28');break;case _0x583c('0x29'):case'$startsWith':case _0x583c('0x2a'):_0x243058='LIKE\x20?';break;case _0x583c('0x2b'):_0x243058=_0x583c('0x2c');break;case _0x583c('0x14'):_0x243058='>\x20?';break;case _0x583c('0x15'):_0x243058=_0x583c('0x2d');break;case'$gte':_0x243058='>=\x20?';break;case _0x583c('0x2e'):_0x243058='BETWEEN\x20?\x20AND\x20?';break;}return _0x243058;}function parseValue(_0x47c318,_0x4f45ac,_0x592d49){var _0x40fa53={'start':undefined,'end':undefined};switch(_0x4f45ac){case _0x583c('0x23'):case _0x583c('0x25'):_0x40fa53[_0x583c('0x2f')]=_0x592d49[_0x583c('0x8')](',');break;case _0x583c('0x29'):_0x40fa53[_0x583c('0x2f')]='%'+_0x592d49+'%';break;case _0x583c('0x30'):_0x40fa53[_0x583c('0x2f')]=_0x592d49+'%';break;case _0x583c('0x2a'):_0x40fa53[_0x583c('0x2f')]='%'+_0x592d49;break;case _0x583c('0x2e'):var _0x337949=_0x592d49['split'](',');var _0x592d49=_0x337949[_0x583c('0xb')]();var _0x110839=_0x337949[_0x583c('0x31')]();if(_0x47c318==='DATE'){_0x592d49=moment(_0x592d49)['utcOffset'](0x0,!![])[_0x583c('0x19')]();_0x110839=moment(_0x110839)[_0x583c('0x32')](0x0,!![])['add'](0x17,_0x583c('0x33'))['add'](0x3b,_0x583c('0x34'))['add'](0x3b,_0x583c('0x35'))[_0x583c('0x19')]();}_0x40fa53={'start':_0x592d49,'end':_0x110839};break;default:_0x40fa53[_0x583c('0x2f')]=_0x592d49;break;}return _0x40fa53;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7b59fab..d7742d9 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 _0x404f=['unsigned','substr','DESC','ASC','omit','isEmpty','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns','value','merge','lower','includeAll','include','sequelize','moment','parse','keys','includes','alias','fields','raw','split','filters','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','sort','map','indexOf','priority','cast','col'];(function(_0x68ed1c,_0x310895){var _0x1b6f34=function(_0x1d72f9){while(--_0x1d72f9){_0x68ed1c['push'](_0x68ed1c['shift']());}};_0x1b6f34(++_0x310895);}(_0x404f,0xf7));var _0xf404=function(_0x329310,_0x11824d){_0x329310=_0x329310-0x0;var _0x5f5148=_0x404f[_0x329310];return _0x5f5148;};'use strict';var _=require('lodash');var sequelize=require(_0xf404('0x0'));var moment=require(_0xf404('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x527f62){var _0x4ccc25=['ne'];try{var _0x305983=JSON[_0xf404('0x2')](_0x527f62);var _0x5e55cb=Object[_0xf404('0x3')](_0x305983)[0x0];return _0x4ccc25[_0xf404('0x4')](_0x5e55cb);}catch(_0x17357d){return![];}}function getOperatorValue(_0x30e9d7){var _0x4fc282=JSON[_0xf404('0x2')](_0x30e9d7);var _0xe754f7=Object[_0xf404('0x3')](_0x4fc282)[0x0];var _0x289707=_0x4fc282[_0xe754f7];return{['$'+_0xe754f7]:_0x289707};}function parseIncludeModel(_0x354577){var _0x3fbf13=JSON[_0xf404('0x2')](_0x354577);return{'model':db[_0x3fbf13['model']],'as':_0x3fbf13[_0xf404('0x5')],'attributes':_0x3fbf13[_0xf404('0x6')],'raw':_0x3fbf13[_0xf404('0x7')]};}exports['fields']=function(_0x2df2f3){var _0x38a1f6=null;if(_0x2df2f3){_0x38a1f6=_0x2df2f3[_0xf404('0x8')](',');}return _0x38a1f6;};exports[_0xf404('0x9')]=function(_0x5b5729,_0x19c882){var _0x35402b={};if(!_['isEmpty'](_0x5b5729)){_['forOwn'](_0x5b5729,function(_0x110995,_0x386943){try{if(_0x19c882){var _0x2ee9c8=_[_0xf404('0xa')](_0x19c882,{'name':_0x386943})||{};if(hasSequelizeOperator(_0x110995)){_0x35402b[_0x386943]=getOperatorValue(_0x110995);}else if(_0x2ee9c8[_0xf404('0xb')]===_0xf404('0xc')&&_[_0xf404('0xd')](_0x110995)){var _0x47d8be=JSON['parse'](_0x110995);var _0x343649={'$gte':moment(moment(_0x47d8be[_0xf404('0xe')])[_0xf404('0xf')](_0xf404('0x10')))[_0xf404('0x11')]()[_0xf404('0xf')](),'$lte':moment(moment(_0x47d8be[_0xf404('0x12')])[_0xf404('0xf')](_0xf404('0x10')))[_0xf404('0x11')]()[_0xf404('0x13')](0x1,'s')['format']()};_0x35402b[_0x386943]=_0x343649;}else if(_0x2ee9c8[_0xf404('0x14')]==='uniqueid'){_0x35402b[_0x386943]=_0x110995;}else{_0x35402b[_0x386943]=_[_0xf404('0x15')](_0x110995)?_0x110995:JSON[_0xf404('0x2')](_0x110995);}}else{_0x35402b[_0x386943]=_[_0xf404('0x15')](_0x110995)?_0x110995:JSON['parse'](_0x110995);}}catch(_0x327a23){_0x35402b[_0x386943]=_0x110995[_0xf404('0x8')](',');}});}return _0x35402b;};exports[_0xf404('0x16')]=function(_0x3f7664){_0x3f7664=parseInt(_0x3f7664,0xa);if(!_0x3f7664||_0x3f7664<0x0){_0x3f7664=LIMIT_VALUE;}return _0x3f7664;};exports['offset']=function(_0x4ab34a){_0x4ab34a=parseInt(_0x4ab34a,0xa);if(!_0x4ab34a||_0x4ab34a<0x0){_0x4ab34a=0x0;}return _0x4ab34a;};exports[_0xf404('0x17')]=function(_0x2de9d0){var _0x4e71b0,_0x438951=null;if(_0x2de9d0){_0x4e71b0=_0x2de9d0[_0xf404('0x8')](',');_0x438951=_[_0xf404('0x18')](_0x4e71b0,function(_0x459930){if(_0x459930[_0xf404('0x19')]('-')===0x0){return[_0x459930===_0xf404('0x1a')?sequelize[_0xf404('0x1b')](sequelize[_0xf404('0x1c')](_0xf404('0x1a')),_0xf404('0x1d')):_0x459930[_0xf404('0x1e')](0x1),_0xf404('0x1f')];}else{return[_0x459930==='priority'?sequelize['cast'](sequelize[_0xf404('0x1c')]('priority'),'unsigned'):_0x459930,_0xf404('0x20')];}});}return _0x438951;};exports[_0xf404('0x21')]=function(_0x594fe8,_0x2f94a3){if(_[_0xf404('0x22')](_0x594fe8)){return _0x594fe8;}if(_['isArray'](_0x594fe8)){for(var _0x5834e9=0x0;_0x5834e9<_0x594fe8[_0xf404('0x23')];_0x5834e9+=0x1){_0x594fe8[_0x5834e9]=this[_0xf404('0x21')](_0x594fe8[_0x5834e9],_0x2f94a3);}return _0x594fe8;}if(!_[_0xf404('0x24')](_0x594fe8)){return _0x594fe8;}if(_['isString'](_0x2f94a3)){_0x2f94a3=[_0x2f94a3];}if(!_[_0xf404('0x15')](_0x2f94a3)){return _0x594fe8;}for(var _0x4c1966=0x0;_0x4c1966<_0x2f94a3[_0xf404('0x23')];_0x4c1966+=0x1){_[_0xf404('0x25')](_0x594fe8,_0x2f94a3[_0x4c1966]);}for(var _0x30b367 in _0x594fe8){if(_0x594fe8[_0xf404('0x26')](_0x30b367)){_0x594fe8[_0x30b367]=this[_0xf404('0x21')](_0x594fe8[_0x30b367],_0x2f94a3);}}return _0x594fe8;};exports[_0xf404('0x27')]=function(_0x50fdfb){return _0x50fdfb[_0xf404('0x28')](RegExp(_0xf404('0x29')))?!![]:![];};exports[_0xf404('0x2a')]=function(_0x3fd4cf){return _0x3fd4cf[_0xf404('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0xf404('0x2b')]=function(_0x2c2593,_0x286c35){var _0x360dd1=[];var _0xc9e3b2=/[ `!@#$%^&*()_\-?~]/;var _0x142743=_0x286c35?_0xf404('0x2c'):_0xf404('0x2d');_0x2c2593[_0xf404('0x8')](/[ ,]+/)[_0xf404('0x2e')](function(_0xc09d59){_0xc09d59=_0xc09d59[_0xf404('0x2f')](/([^:]")"+/g,'$1');_0xc09d59='+'+_0xc09d59+'*';var _0x3d1f5a=_0xc09d59[_0xf404('0x28')](_0xc9e3b2);if(_0x3d1f5a){_0xc09d59='\x22'+_0xc09d59+'\x22';}_0x360dd1[_0xf404('0x30')](_0xc09d59);});_0x142743=_0x142743[_0xf404('0x2f')]('{EXPR}',_0x360dd1[_0xf404('0x31')]('\x20'));return _0x142743;};exports[_0xf404('0x32')]=function(_0x1ec7c9,_0x86b717,_0x5afe81){var _0x59efb0={},_0x33066e={};if(_0x86b717[_0xf404('0x33')][_0xf404('0x34')]){_0x86b717[_0xf404('0x33')]['id']=_0x86b717[_0xf404('0x33')]['$id'];delete _0x86b717['query'][_0xf404('0x34')];}_0x59efb0[_0xf404('0x35')]=_['map'](_0x1ec7c9,_0xf404('0x14'));_0x59efb0[_0xf404('0x33')]=_['keys'](_0x86b717['query']);_0x59efb0[_0xf404('0x9')]=_[_0xf404('0x36')](_0x59efb0[_0xf404('0x35')],_0x59efb0['query']);_0x33066e['attributes']=_[_0xf404('0x36')](_0x59efb0[_0xf404('0x35')],this[_0xf404('0x6')](_0x86b717['query']['fields']));_0x33066e[_0xf404('0x37')]=_0x33066e[_0xf404('0x37')][_0xf404('0x23')]?_0x33066e[_0xf404('0x37')]:_0x59efb0['model'];if(!_0x86b717[_0xf404('0x33')]['hasOwnProperty'](_0xf404('0x38'))){_0x33066e[_0xf404('0x16')]=this[_0xf404('0x16')](_0x86b717[_0xf404('0x33')]['limit']);_0x33066e[_0xf404('0x39')]=this[_0xf404('0x39')](_0x86b717[_0xf404('0x33')][_0xf404('0x39')]);}_0x33066e[_0xf404('0x3a')]=this[_0xf404('0x17')](_0x86b717[_0xf404('0x33')][_0xf404('0x17')]);_0x33066e[_0xf404('0x3b')]=this[_0xf404('0x9')](_[_0xf404('0x3c')](_0x86b717[_0xf404('0x33')],_0x59efb0[_0xf404('0x9')]),_0x1ec7c9);if(_0x86b717['query'][_0xf404('0x3d')]){var _0x190eaa=_0x1ec7c9;var _0x3946d5=_0x86b717[_0xf404('0x33')][_0xf404('0x3d')];if(typeof _0x3946d5===_0xf404('0x3e')){_0x190eaa=_['filter'](_0x1ec7c9,function(_0x4772e3){return _[_0xf404('0x4')](_0x3946d5[_0xf404('0x3f')],_0x4772e3[_0xf404('0x14')]);});_0x3946d5=_0x3946d5[_0xf404('0x40')];}_0x33066e[_0xf404('0x3b')]=_[_0xf404('0x41')](_0x33066e[_0xf404('0x3b')],{'$or':_[_0xf404('0x18')](_0x190eaa,function(_0x5e5aa7){if(_0x5e5aa7[_0xf404('0xb')]!=='VIRTUAL'){if(_0x5afe81){return sequelize['where'](sequelize['fn'](_0xf404('0x42'),sequelize[_0xf404('0x1c')](_0x5e5aa7[_0xf404('0x14')])),{'$like':sequelize['fn'](_0xf404('0x42'),'%'+_0x86b717[_0xf404('0x33')]['filter']+'%')});}else{var _0x3b805a={};_0x3b805a[_0x5e5aa7[_0xf404('0x14')]]={'$like':'%'+_0x86b717[_0xf404('0x33')]['filter']+'%'};return _0x3b805a;}}})});}_0x33066e=_['merge']({},_0x33066e,_0x86b717['options']);return _0x33066e;};exports['include']=function(_0x24f1dc){var _0xa49a4f=[];if(_0x24f1dc[_0xf404('0x43')]){_0xa49a4f['push']({'all':!![]});}else if(_0x24f1dc[_0xf404('0x44')]){if(Array[_0xf404('0x15')](_0x24f1dc[_0xf404('0x44')])){_0xa49a4f=Object[_0xf404('0x3')](_0x24f1dc[_0xf404('0x44')])[_0xf404('0x18')](function(_0x245c5b){return parseIncludeModel(_0x24f1dc[_0xf404('0x44')][_0x245c5b]);});}else{var _0x2c8879=parseIncludeModel(_0x24f1dc['include']);_0xa49a4f[_0xf404('0x30')](_0x2c8879);}}return _0xa49a4f;}; \ No newline at end of file +var _0x44fd=['isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','limit','order','where','pick','filter','object','columns','value','type','lower','merge','includeAll','include','moment','../../mysqldb','parse','keys','includes','alias','fields','split','filters','isEmpty','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','cast','col','unsigned','DESC','priority','omit','length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$'];(function(_0xa656d,_0xc5f407){var _0x17aedd=function(_0x1ef1a9){while(--_0x1ef1a9){_0xa656d['push'](_0xa656d['shift']());}};_0x17aedd(++_0xc5f407);}(_0x44fd,0x123));var _0xd44f=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x44fd[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xd44f('0x0'));var db=require(_0xd44f('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x458bea){var _0x3f2791=['ne'];try{var _0x4bc9a1=JSON[_0xd44f('0x2')](_0x458bea);var _0x5ca990=Object[_0xd44f('0x3')](_0x4bc9a1)[0x0];return _0x3f2791[_0xd44f('0x4')](_0x5ca990);}catch(_0xf990bf){return![];}}function getOperatorValue(_0xb14d0b){var _0x22c0ab=JSON[_0xd44f('0x2')](_0xb14d0b);var _0x6e1926=Object[_0xd44f('0x3')](_0x22c0ab)[0x0];var _0x4e5e68=_0x22c0ab[_0x6e1926];return{['$'+_0x6e1926]:_0x4e5e68};}function parseIncludeModel(_0x17fb72){var _0x4230b7=JSON[_0xd44f('0x2')](_0x17fb72);return{'model':db[_0x4230b7['model']],'as':_0x4230b7[_0xd44f('0x5')],'attributes':_0x4230b7[_0xd44f('0x6')],'raw':_0x4230b7['raw']};}exports[_0xd44f('0x6')]=function(_0x1f6d10){var _0x21dcb7=null;if(_0x1f6d10){_0x21dcb7=_0x1f6d10[_0xd44f('0x7')](',');}return _0x21dcb7;};exports[_0xd44f('0x8')]=function(_0x4c2c9f,_0x2bb1b8){var _0x410ceb={};if(!_[_0xd44f('0x9')](_0x4c2c9f)){_['forOwn'](_0x4c2c9f,function(_0x1dac66,_0x2c5602){try{if(_0x2bb1b8){var _0x148c98=_[_0xd44f('0xa')](_0x2bb1b8,{'name':_0x2c5602})||{};if(hasSequelizeOperator(_0x1dac66)){_0x410ceb[_0x2c5602]=getOperatorValue(_0x1dac66);}else if(_0x148c98['type']===_0xd44f('0xb')&&_[_0xd44f('0xc')](_0x1dac66)){var _0x6ee63=JSON['parse'](_0x1dac66);var _0x5e789d={'$gte':moment(moment(_0x6ee63[_0xd44f('0xd')])[_0xd44f('0xe')](_0xd44f('0xf')))[_0xd44f('0x10')]()['format'](),'$lte':moment(moment(_0x6ee63[_0xd44f('0x11')])[_0xd44f('0xe')]('YYYY-MM-DD'))['utc']()[_0xd44f('0x12')](0x1,'s')[_0xd44f('0xe')]()};_0x410ceb[_0x2c5602]=_0x5e789d;}else if(_0x148c98[_0xd44f('0x13')]===_0xd44f('0x14')){_0x410ceb[_0x2c5602]=_0x1dac66;}else{_0x410ceb[_0x2c5602]=_[_0xd44f('0x15')](_0x1dac66)?_0x1dac66:JSON[_0xd44f('0x2')](_0x1dac66);}}else{_0x410ceb[_0x2c5602]=_[_0xd44f('0x15')](_0x1dac66)?_0x1dac66:JSON['parse'](_0x1dac66);}}catch(_0x50381c){_0x410ceb[_0x2c5602]=_0x1dac66[_0xd44f('0x7')](',');}});}return _0x410ceb;};exports['limit']=function(_0x5a0951){_0x5a0951=parseInt(_0x5a0951,0xa);if(!_0x5a0951||_0x5a0951<0x0){_0x5a0951=LIMIT_VALUE;}return _0x5a0951;};exports[_0xd44f('0x16')]=function(_0x174e55){_0x174e55=parseInt(_0x174e55,0xa);if(!_0x174e55||_0x174e55<0x0){_0x174e55=0x0;}return _0x174e55;};exports[_0xd44f('0x17')]=function(_0x36673c){var _0x28f530,_0x342b7c=null;if(_0x36673c){_0x28f530=_0x36673c['split'](',');_0x342b7c=_[_0xd44f('0x18')](_0x28f530,function(_0x44b286){if(_0x44b286[_0xd44f('0x19')]('-')===0x0){return[_0x44b286==='priority'?sequelize[_0xd44f('0x1a')](sequelize[_0xd44f('0x1b')]('priority'),_0xd44f('0x1c')):_0x44b286['substr'](0x1),_0xd44f('0x1d')];}else{return[_0x44b286===_0xd44f('0x1e')?sequelize[_0xd44f('0x1a')](sequelize[_0xd44f('0x1b')]('priority'),_0xd44f('0x1c')):_0x44b286,'ASC'];}});}return _0x342b7c;};exports[_0xd44f('0x1f')]=function(_0x2762e4,_0x8c9492){if(_['isEmpty'](_0x2762e4)){return _0x2762e4;}if(_[_0xd44f('0x15')](_0x2762e4)){for(var _0x2450f9=0x0;_0x2450f9<_0x2762e4[_0xd44f('0x20')];_0x2450f9+=0x1){_0x2762e4[_0x2450f9]=this['omit'](_0x2762e4[_0x2450f9],_0x8c9492);}return _0x2762e4;}if(!_[_0xd44f('0x21')](_0x2762e4)){return _0x2762e4;}if(_[_0xd44f('0x22')](_0x8c9492)){_0x8c9492=[_0x8c9492];}if(!_[_0xd44f('0x15')](_0x8c9492)){return _0x2762e4;}for(var _0x197aa2=0x0;_0x197aa2<_0x8c9492[_0xd44f('0x20')];_0x197aa2+=0x1){_[_0xd44f('0x23')](_0x2762e4,_0x8c9492[_0x197aa2]);}for(var _0xecacfb in _0x2762e4){if(_0x2762e4[_0xd44f('0x24')](_0xecacfb)){_0x2762e4[_0xecacfb]=this[_0xd44f('0x1f')](_0x2762e4[_0xecacfb],_0x8c9492);}}return _0x2762e4;};exports['isNumeric']=function(_0x54beee){return _0x54beee[_0xd44f('0x25')](RegExp(_0xd44f('0x26')))?!![]:![];};exports[_0xd44f('0x27')]=function(_0x551ee8){return _0x551ee8[_0xd44f('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2a5847,_0x1047fc){var _0x40cb3a=[];var _0x247e8e=/[ `!@#$%^&*()_\-?~]/;var _0x2412a8=_0x1047fc?_0xd44f('0x28'):_0xd44f('0x29');_0x2a5847[_0xd44f('0x7')](/[ ,]+/)[_0xd44f('0x2a')](function(_0x35d514){_0x35d514=_0x35d514[_0xd44f('0x2b')](/([^:]")"+/g,'$1');_0x35d514='+'+_0x35d514+'*';var _0x42aff5=_0x35d514[_0xd44f('0x25')](_0x247e8e);if(_0x42aff5){_0x35d514='\x22'+_0x35d514+'\x22';}_0x40cb3a[_0xd44f('0x2c')](_0x35d514);});_0x2412a8=_0x2412a8[_0xd44f('0x2b')](_0xd44f('0x29'),_0x40cb3a[_0xd44f('0x2d')]('\x20'));return _0x2412a8;};exports[_0xd44f('0x2e')]=function(_0xfd11a,_0x54d673,_0x427493){var _0x23bda7={},_0x2a5d48={};if(_0x54d673[_0xd44f('0x2f')][_0xd44f('0x30')]){_0x54d673[_0xd44f('0x2f')]['id']=_0x54d673['query']['$id'];delete _0x54d673[_0xd44f('0x2f')][_0xd44f('0x30')];}_0x23bda7[_0xd44f('0x31')]=_[_0xd44f('0x18')](_0xfd11a,_0xd44f('0x13'));_0x23bda7['query']=_[_0xd44f('0x3')](_0x54d673[_0xd44f('0x2f')]);_0x23bda7[_0xd44f('0x8')]=_[_0xd44f('0x32')](_0x23bda7[_0xd44f('0x31')],_0x23bda7[_0xd44f('0x2f')]);_0x2a5d48[_0xd44f('0x33')]=_[_0xd44f('0x32')](_0x23bda7['model'],this['fields'](_0x54d673[_0xd44f('0x2f')][_0xd44f('0x6')]));_0x2a5d48[_0xd44f('0x33')]=_0x2a5d48[_0xd44f('0x33')]['length']?_0x2a5d48['attributes']:_0x23bda7[_0xd44f('0x31')];if(!_0x54d673[_0xd44f('0x2f')][_0xd44f('0x24')](_0xd44f('0x34'))){_0x2a5d48[_0xd44f('0x35')]=this[_0xd44f('0x35')](_0x54d673[_0xd44f('0x2f')][_0xd44f('0x35')]);_0x2a5d48[_0xd44f('0x16')]=this[_0xd44f('0x16')](_0x54d673[_0xd44f('0x2f')][_0xd44f('0x16')]);}_0x2a5d48[_0xd44f('0x36')]=this['sort'](_0x54d673[_0xd44f('0x2f')][_0xd44f('0x17')]);_0x2a5d48[_0xd44f('0x37')]=this['filters'](_[_0xd44f('0x38')](_0x54d673[_0xd44f('0x2f')],_0x23bda7['filters']),_0xfd11a);if(_0x54d673[_0xd44f('0x2f')]['filter']){var _0x411552=_0xfd11a;var _0x2ac47d=_0x54d673['query'][_0xd44f('0x39')];if(typeof _0x2ac47d===_0xd44f('0x3a')){_0x411552=_[_0xd44f('0x39')](_0xfd11a,function(_0x5a4f6a){return _[_0xd44f('0x4')](_0x2ac47d[_0xd44f('0x3b')],_0x5a4f6a['name']);});_0x2ac47d=_0x2ac47d[_0xd44f('0x3c')];}_0x2a5d48[_0xd44f('0x37')]=_['merge'](_0x2a5d48[_0xd44f('0x37')],{'$or':_['map'](_0x411552,function(_0x54ccc3){if(_0x54ccc3[_0xd44f('0x3d')]!=='VIRTUAL'){if(_0x427493){return sequelize[_0xd44f('0x37')](sequelize['fn'](_0xd44f('0x3e'),sequelize[_0xd44f('0x1b')](_0x54ccc3[_0xd44f('0x13')])),{'$like':sequelize['fn'](_0xd44f('0x3e'),'%'+_0x54d673[_0xd44f('0x2f')]['filter']+'%')});}else{var _0x275ab2={};_0x275ab2[_0x54ccc3[_0xd44f('0x13')]]={'$like':'%'+_0x54d673['query']['filter']+'%'};return _0x275ab2;}}})});}_0x2a5d48=_[_0xd44f('0x3f')]({},_0x2a5d48,_0x54d673['options']);return _0x2a5d48;};exports['include']=function(_0x2f33e3){var _0x220142=[];if(_0x2f33e3[_0xd44f('0x40')]){_0x220142['push']({'all':!![]});}else if(_0x2f33e3[_0xd44f('0x41')]){if(Array[_0xd44f('0x15')](_0x2f33e3[_0xd44f('0x41')])){_0x220142=Object[_0xd44f('0x3')](_0x2f33e3[_0xd44f('0x41')])[_0xd44f('0x18')](function(_0x4be3b3){return parseIncludeModel(_0x2f33e3[_0xd44f('0x41')][_0x4be3b3]);});}else{var _0x55db9c=parseIncludeModel(_0x2f33e3['include']);_0x220142[_0xd44f('0x2c')](_0x55db9c);}}return _0x220142;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 651cadb..8546c57 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 _0x19cb=['toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','filterAgentAttributes','role','online','lastLoginAt','faxStatusTime','mailStatusTime','voiceStatusTime','whatsappStatusTime','openchannelCurrentCapacity','whatsappCurrentCapacity','onhold','getRealtimeAgentsQueryFields','jayson/promise','../../mysqldb','http','chatPause','faxPause','smsPause','voicePause','whatsappPause','every','length','idle','unavailable','ringing','isNil','voiceStatus','chatStatus','faxStatus','openchannelStatus','smsStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','result','merge','getRealtimeAgents','unknown','*pause','busy','isArray','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','map','getAgentIdsByStatus','resolve','name','fullname','mailPause','openchannelPause','pauseType','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','validateSortParameter','sort','pause'];(function(_0x28f45a,_0xedfc23){var _0x314592=function(_0x51c973){while(--_0x51c973){_0x28f45a['push'](_0x28f45a['shift']());}};_0x314592(++_0xedfc23);}(_0x19cb,0x146));var _0xb19c=function(_0x5d958f,_0x478e75){_0x5d958f=_0x5d958f-0x0;var _0x3916d5=_0x19cb[_0x5d958f];return _0x3916d5;};'use strict';var _=require('lodash');var jayson=require(_0xb19c('0x0'));var db=require(_0xb19c('0x1'))['db'];var amiClient=jayson['client'][_0xb19c('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xb19c('0x2')]({'port':0x232c});function isAgentPaused(_0x534a1d,_0x503187){var _0x56d20c=[_0x534a1d[_0xb19c('0x3')],_0x534a1d[_0xb19c('0x4')],_0x534a1d['mailPause'],_0x534a1d['openchannelPause'],_0x534a1d[_0xb19c('0x5')],_0x534a1d[_0xb19c('0x6')],_0x534a1d[_0xb19c('0x7')]];if(!_0x503187)return _[_0xb19c('0x8')](_0x56d20c);var _0x5d50d4=_['filter'](_0x56d20c);return _0x5d50d4[_0xb19c('0x9')]>0x0&&_0x5d50d4[_0xb19c('0x9')]<_0x56d20c[_0xb19c('0x9')]?!![]:![];}function isIdle(_0x12d1ce){return _0x12d1ce===_0xb19c('0xa')||_0x12d1ce==='unknown'||_0x12d1ce===_0xb19c('0xb')||_0x12d1ce===_0xb19c('0xc')||_[_0xb19c('0xd')](_0x12d1ce);}function isAgentIdle(_0x3b7448){if(_0x3b7448[_0xb19c('0xe')]!==_0xb19c('0xa')&&_0x3b7448['voicePause']){_0x3b7448['voiceStatus']='pause';return![];}return _[_0xb19c('0x8')]([_0x3b7448[_0xb19c('0xf')],_0x3b7448[_0xb19c('0x10')],_0x3b7448['mailStatus'],_0x3b7448[_0xb19c('0x11')],_0x3b7448[_0xb19c('0x12')],_0x3b7448[_0xb19c('0xe')],_0x3b7448['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xb19c('0x13')]('Agents',{})[_0xb19c('0x14')](function(_0x261602){if(_0x261602[_0xb19c('0x15')]){throw new Error(_0xb19c('0x16'));}var _0x11eea0=_0x261602['result'];return routingClient[_0xb19c('0x13')](_0xb19c('0x17'),{})[_0xb19c('0x14')](function(_0x2b2815){if(_0x2b2815[_0xb19c('0x15')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4d3926=_0x2b2815[_0xb19c('0x18')];return _[_0xb19c('0x19')]({},_0x11eea0,_0x4d3926);});})['catch'](function(_0x55cf87){throw _0x55cf87;});}exports[_0xb19c('0x1a')]=getRealtimeAgents;function getAgentStatus(_0x1914e1){var _0xe42795=_0xb19c('0x1b');if(isAgentPaused(_0x1914e1))_0xe42795='pause';else if(isAgentPaused(_0x1914e1,!![]))_0xe42795=_0xb19c('0x1c');else if(isAgentIdle(_0x1914e1))_0xe42795=_0xb19c('0xa');else _0xe42795=_0xb19c('0x1d');return _0xe42795;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x250604,_0x383878){var _0x186f47=_[_0xb19c('0x1e')](_0x250604)?_0x250604:[_0x250604];var _0xe0e6d9=_['startCase'](_0x383878)+'Queue';var _0x3b3d64=_['map'](_0x186f47,function(_0x7b3f7a){return db[_0xe0e6d9]['findOne']({'where':{'id':_0x7b3f7a}})[_0xb19c('0x14')](function(_0x1fdc4e){if(!_0x1fdc4e)return[];return _0x1fdc4e[_0xb19c('0x1f')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xb19c('0x20')](_0x3b3d64)[_0xb19c('0x14')](function(_0x1774fc){var _0x343dda=_(_0x1774fc)[_0xb19c('0x21')]()['map']('id')[_0xb19c('0x22')]()[_0xb19c('0x23')]();return _0x343dda;});}exports[_0xb19c('0x24')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x318c5d,_0x513339,_0x5d9bcd){try{if(_0x513339['length']>0x0){_0x318c5d=_0x318c5d[_0xb19c('0x25')](function(_0x1dd187){return _0x513339[_0xb19c('0x26')](_0x1dd187['id']);});}var _0x168045=_0x318c5d[_0xb19c('0x25')](function(_0x4acb68){var _0x1f11e8=_0xb19c('0x1d');if(isAgentIdle(_0x4acb68)){_0x1f11e8=_0xb19c('0xa');}return _0x1f11e8===_0x5d9bcd;});return _[_0xb19c('0x27')](_0x168045,'id');}catch(_0x11ddf3){throw _0x11ddf3;}}exports[_0xb19c('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x7b42f5,_0x4bd235,_0x1f5720){return Promise[_0xb19c('0x29')]()['then'](function(){if(_0x4bd235[_0xb19c('0x9')]>0x0){_0x7b42f5=_0x7b42f5[_0xb19c('0x25')](function(_0x31c93f){return _0x4bd235[_0xb19c('0x26')](_0x31c93f['id']);});}return _0x7b42f5;})[_0xb19c('0x14')](function(){return db['User']['findAll']({'attributes':['id',_0xb19c('0x2a'),_0xb19c('0x2b'),_0xb19c('0x3'),'faxPause',_0xb19c('0x2c'),_0xb19c('0x2d'),_0xb19c('0x5'),_0xb19c('0x6'),_0xb19c('0x7'),_0xb19c('0x2e')],'where':{'id':{'$in':_[_0xb19c('0x27')](_0x7b42f5,'id')}},'raw':!![]});})[_0xb19c('0x14')](function(_0xa02709){return _0xa02709['map'](function(_0x36fd64){var _0x2d8eff=_['find'](_0x7b42f5,['id',_0x36fd64['id']]);var _0x546e2e=filterAgentAttributes(_0x2d8eff);_[_0xb19c('0x19')](_0x36fd64,_0x546e2e);_0x36fd64[_0xb19c('0x2f')]=getAgentStatus(_0x36fd64);return _0x36fd64;});})[_0xb19c('0x14')](function(_0x58ea64){var _0x13378a=sortAgentsByStatus(_0x58ea64,_0x1f5720);return _['map'](_0x13378a,'id');})[_0xb19c('0x30')](function(_0x54f1f7){throw _0x54f1f7;});}exports[_0xb19c('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x52226b){var _0x4573be={'fields':[],'order':null};var _0x37c64c=_0x52226b[_0xb19c('0x32')](',');_0x4573be[_0xb19c('0x33')]=_[_0xb19c('0x25')](_0x37c64c,function(_0x17e6dd){if(!_0x17e6dd[_0xb19c('0x26')](_0xb19c('0x2f'))){return!![];}_0x4573be[_0xb19c('0x34')]=_['startsWith'](_0x17e6dd,'-')?_0xb19c('0x35'):_0xb19c('0x36');return![];});return _0x4573be;}exports[_0xb19c('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x2826fd){if(!_0x2826fd){_0x2826fd=_0xb19c('0x38');}if(_0x2826fd[_0xb19c('0x26')]('fullname')&&!_0x2826fd[_0xb19c('0x26')](_0xb19c('0x39'))){var _0x5bde43=_0x2826fd[_0xb19c('0x3a')](0x0,_0x2826fd['indexOf'](_0xb19c('0x2b')));_0x2826fd+=','+_0x5bde43+_0xb19c('0x39');}return _0x2826fd;}exports[_0xb19c('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x238524,_0x371fb3){var _0x2981b2=_0x238524[_0xb19c('0x3c')](function(_0x49db9e,_0x584a57){if(_0x49db9e[_0xb19c('0x2f')]===_0x584a57['globalStatus']){if(_0x49db9e[_0xb19c('0x2f')]===_0xb19c('0x3d')){if(_0x371fb3===_0xb19c('0x35')){return(_0x49db9e[_0xb19c('0x2e')]||'')<(_0x584a57['pauseType']||'')||_0x49db9e['fullname']['toLowerCase']()>_0x584a57[_0xb19c('0x2b')][_0xb19c('0x3e')]()?0x1:-0x1;}else{return(_0x49db9e[_0xb19c('0x2e')]||'')<(_0x584a57[_0xb19c('0x2e')]||'')||_0x49db9e[_0xb19c('0x2b')][_0xb19c('0x3e')]()>_0x584a57[_0xb19c('0x2b')][_0xb19c('0x3e')]()?-0x1:0x1;}}else{if(_0x371fb3===_0xb19c('0x35')){return _0x49db9e['fullname'][_0xb19c('0x3e')]()<_0x584a57[_0xb19c('0x2b')][_0xb19c('0x3e')]()?0x1:-0x1;}else{return _0x49db9e[_0xb19c('0x2b')][_0xb19c('0x3e')]()<_0x584a57[_0xb19c('0x2b')][_0xb19c('0x3e')]()?-0x1:0x1;}}}else{if(_0x371fb3===_0xb19c('0x35')){return _0x49db9e[_0xb19c('0x2f')]<_0x584a57[_0xb19c('0x2f')]?0x1:-0x1;}else{return _0x49db9e[_0xb19c('0x2f')]<_0x584a57['globalStatus']?-0x1:0x1;}}});return _0x2981b2;}exports[_0xb19c('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x2f5a83){var _0x11b297=[_0xb19c('0x40'),'online','lastLoginAt',_0xb19c('0x41'),_0xb19c('0x2e'),_0xb19c('0x41'),_0xb19c('0x39'),'address',_0xb19c('0x3'),_0xb19c('0x2d'),'mailPause','smsPause',_0xb19c('0x7'),_0xb19c('0x4'),_0xb19c('0x6'),_0xb19c('0x42'),_0xb19c('0x43'),_0xb19c('0x44'),_0xb19c('0x45'),_0xb19c('0x46'),_0xb19c('0x47'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xb19c('0x48'),_0xb19c('0x49'),'whatsappCurrentCapacity',_0xb19c('0x4a'),_0xb19c('0xf'),_0xb19c('0x11'),_0xb19c('0x4b'),_0xb19c('0x12'),_0xb19c('0x4c'),_0xb19c('0x10'),'voiceStatus',_0xb19c('0x4d'),_0xb19c('0x4e'),'mailStatusTime',_0xb19c('0x4f'),'whatsappStatusTime','faxStatusTime','voiceStatusTime',_0xb19c('0x50'),_0xb19c('0x51'),_0xb19c('0x52'),_0xb19c('0x53'),_0xb19c('0x54')];var _0x5f1588=[_0xb19c('0x3'),_0xb19c('0x2d'),_0xb19c('0x2c'),_0xb19c('0x5'),_0xb19c('0x7'),'faxPause',_0xb19c('0x6'),'online'];var _0x60c816=_(_0x2f5a83)['omit'](_0x5f1588)['pick'](_0x11b297)['value']();return _0x60c816;}exports[_0xb19c('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xb19c('0x2b'),_0xb19c('0x56'),_0xb19c('0x39'),_0xb19c('0x57'),_0xb19c('0x2f'),'userpic',_0xb19c('0x58'),_0xb19c('0x2e'),'lastPauseAt',_0xb19c('0x4'),_0xb19c('0x3'),_0xb19c('0x2c'),_0xb19c('0x2d'),_0xb19c('0x5'),_0xb19c('0x6'),_0xb19c('0x7'),'chatStatus',_0xb19c('0x10'),_0xb19c('0x4b'),_0xb19c('0x11'),'smsStatus','voiceStatus','whatsappStatus','chatStatusTime',_0xb19c('0x59'),_0xb19c('0x5a'),_0xb19c('0x4e'),_0xb19c('0x4f'),_0xb19c('0x5b'),_0xb19c('0x5c'),_0xb19c('0x42'),_0xb19c('0x47'),_0xb19c('0x44'),'openchannelCapacity',_0xb19c('0x45'),'whatsappCapacity','chatCurrentCapacity','faxCurrentCapacity',_0xb19c('0x48'),_0xb19c('0x5d'),_0xb19c('0x49'),_0xb19c('0x5e'),_0xb19c('0x53'),_0xb19c('0x54'),_0xb19c('0x51'),_0xb19c('0x5f'),_0xb19c('0x50'),_0xb19c('0x52')];}exports[_0xb19c('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x4af8=['getRealtimeAgents','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','fullname','faxPause','smsPause','pauseType','fields','startsWith','DESC','ASC','internal','substring','sort','globalStatus','toLowerCase','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','role','userpic','faxStatusTime','whatsappCurrentCapacity','onhold','queue','screenrecording','getRealtimeAgentsQueryFields','http','client','chatPause','mailPause','openchannelPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','pause','every','chatStatus','faxStatus','openchannelStatus','voiceStatus','whatsappStatus','Agents','then','error','result','merge','catch'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x4af8,0x1ad));var _0x84af=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4af8[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x84af('0x0')]({'port':0x232a});var routingClient=jayson[_0x84af('0x1')][_0x84af('0x0')]({'port':0x232c});function isAgentPaused(_0x1446d3,_0x482825){var _0x294e04=[_0x1446d3[_0x84af('0x2')],_0x1446d3['faxPause'],_0x1446d3[_0x84af('0x3')],_0x1446d3[_0x84af('0x4')],_0x1446d3['smsPause'],_0x1446d3[_0x84af('0x5')],_0x1446d3[_0x84af('0x6')]];if(!_0x482825)return _['every'](_0x294e04);var _0x5b5e45=_[_0x84af('0x7')](_0x294e04);return _0x5b5e45[_0x84af('0x8')]>0x0&&_0x5b5e45['length']<_0x294e04[_0x84af('0x8')]?!![]:![];}function isIdle(_0x535556){return _0x535556===_0x84af('0x9')||_0x535556===_0x84af('0xa')||_0x535556===_0x84af('0xb')||_0x535556===_0x84af('0xc')||_['isNil'](_0x535556);}function isAgentIdle(_0x31f283){if(_0x31f283['voiceStatus']!==_0x84af('0x9')&&_0x31f283[_0x84af('0x5')]){_0x31f283['voiceStatus']=_0x84af('0xd');return![];}return _[_0x84af('0xe')]([_0x31f283[_0x84af('0xf')],_0x31f283[_0x84af('0x10')],_0x31f283['mailStatus'],_0x31f283[_0x84af('0x11')],_0x31f283['smsStatus'],_0x31f283[_0x84af('0x12')],_0x31f283[_0x84af('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x84af('0x14'),{})[_0x84af('0x15')](function(_0x49c38d){if(_0x49c38d[_0x84af('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x3c7b43=_0x49c38d[_0x84af('0x17')];return routingClient['request']('Agents',{})[_0x84af('0x15')](function(_0xd8120b){if(_0xd8120b[_0x84af('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4d0cf0=_0xd8120b[_0x84af('0x17')];return _[_0x84af('0x18')]({},_0x3c7b43,_0x4d0cf0);});})[_0x84af('0x19')](function(_0x13e2be){throw _0x13e2be;});}exports[_0x84af('0x1a')]=getRealtimeAgents;function getAgentStatus(_0xad929e){var _0x44e19b=_0x84af('0xa');if(isAgentPaused(_0xad929e))_0x44e19b=_0x84af('0xd');else if(isAgentPaused(_0xad929e,!![]))_0x44e19b='*pause';else if(isAgentIdle(_0xad929e))_0x44e19b=_0x84af('0x9');else _0x44e19b=_0x84af('0x1b');return _0x44e19b;}exports[_0x84af('0x1c')]=getAgentStatus;function getAgentIdsByQueues(_0x4ee3d1,_0x2f40d6){var _0xaea1ea=_[_0x84af('0x1d')](_0x4ee3d1)?_0x4ee3d1:[_0x4ee3d1];var _0x5af3ce=_['startCase'](_0x2f40d6)+_0x84af('0x1e');var _0x2a73ff=_[_0x84af('0x1f')](_0xaea1ea,function(_0x24aa07){return db[_0x5af3ce][_0x84af('0x20')]({'where':{'id':_0x24aa07}})[_0x84af('0x15')](function(_0x2e5ff4){if(!_0x2e5ff4)return[];return _0x2e5ff4[_0x84af('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x84af('0x22')](_0x2a73ff)[_0x84af('0x15')](function(_0x40ca9d){var _0x52ec78=_(_0x40ca9d)[_0x84af('0x23')]()[_0x84af('0x1f')]('id')[_0x84af('0x24')]()[_0x84af('0x25')]();return _0x52ec78;});}exports[_0x84af('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x881a95,_0x6e50b,_0x4c01e3){try{if(_0x6e50b[_0x84af('0x8')]>0x0){_0x881a95=_0x881a95[_0x84af('0x7')](function(_0x59417e){return _0x6e50b[_0x84af('0x27')](_0x59417e['id']);});}var _0x1f5d85=_0x881a95[_0x84af('0x7')](function(_0x42fb39){var _0x5e124a='busy';if(isAgentIdle(_0x42fb39)){_0x5e124a=_0x84af('0x9');}return _0x5e124a===_0x4c01e3;});return _[_0x84af('0x1f')](_0x1f5d85,'id');}catch(_0x238d03){throw _0x238d03;}}exports[_0x84af('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x302e67,_0x91a269,_0x47bdda){return Promise[_0x84af('0x29')]()[_0x84af('0x15')](function(){if(_0x91a269['length']>0x0){_0x302e67=_0x302e67[_0x84af('0x7')](function(_0x27a45e){return _0x91a269['includes'](_0x27a45e['id']);});}return _0x302e67;})['then'](function(){return db[_0x84af('0x2a')]['findAll']({'attributes':['id',_0x84af('0x2b'),_0x84af('0x2c'),'chatPause',_0x84af('0x2d'),_0x84af('0x3'),_0x84af('0x4'),_0x84af('0x2e'),_0x84af('0x5'),_0x84af('0x6'),_0x84af('0x2f')],'where':{'id':{'$in':_[_0x84af('0x1f')](_0x302e67,'id')}},'raw':!![]});})[_0x84af('0x15')](function(_0x2c2ee7){return _0x2c2ee7['map'](function(_0x1b5fc7){var _0x51cb6c=_['find'](_0x302e67,['id',_0x1b5fc7['id']]);var _0xea9e91=filterAgentAttributes(_0x51cb6c);_['merge'](_0x1b5fc7,_0xea9e91);_0x1b5fc7['globalStatus']=getAgentStatus(_0x1b5fc7);return _0x1b5fc7;});})[_0x84af('0x15')](function(_0x284826){var _0x292a0e=sortAgentsByStatus(_0x284826,_0x47bdda);return _['map'](_0x292a0e,'id');})[_0x84af('0x19')](function(_0x3b4389){throw _0x3b4389;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x663d64){var _0x41be31={'fields':[],'order':null};var _0x4b7dab=_0x663d64['split'](',');_0x41be31[_0x84af('0x30')]=_['filter'](_0x4b7dab,function(_0x2dca64){if(!_0x2dca64[_0x84af('0x27')]('globalStatus')){return!![];}_0x41be31['order']=_[_0x84af('0x31')](_0x2dca64,'-')?_0x84af('0x32'):_0x84af('0x33');return![];});return _0x41be31;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x3bd070){if(!_0x3bd070){_0x3bd070='fullname,internal';}if(_0x3bd070['includes'](_0x84af('0x2c'))&&!_0x3bd070['includes'](_0x84af('0x34'))){var _0x4717e1=_0x3bd070[_0x84af('0x35')](0x0,_0x3bd070['indexOf'](_0x84af('0x2c')));_0x3bd070+=','+_0x4717e1+_0x84af('0x34');}return _0x3bd070;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x4769ee,_0x355150){var _0x1d0f94=_0x4769ee[_0x84af('0x36')](function(_0x4f096b,_0x14608f){if(_0x4f096b[_0x84af('0x37')]===_0x14608f['globalStatus']){if(_0x4f096b[_0x84af('0x37')]===_0x84af('0xd')){if(_0x355150===_0x84af('0x32')){return(_0x4f096b[_0x84af('0x2f')]||'')<(_0x14608f['pauseType']||'')||_0x4f096b[_0x84af('0x2c')][_0x84af('0x38')]()>_0x14608f[_0x84af('0x2c')][_0x84af('0x38')]()?0x1:-0x1;}else{return(_0x4f096b[_0x84af('0x2f')]||'')<(_0x14608f[_0x84af('0x2f')]||'')||_0x4f096b['fullname'][_0x84af('0x38')]()>_0x14608f['fullname'][_0x84af('0x38')]()?-0x1:0x1;}}else{if(_0x355150===_0x84af('0x32')){return _0x4f096b['fullname'][_0x84af('0x38')]()<_0x14608f[_0x84af('0x2c')][_0x84af('0x38')]()?0x1:-0x1;}else{return _0x4f096b[_0x84af('0x2c')][_0x84af('0x38')]()<_0x14608f[_0x84af('0x2c')][_0x84af('0x38')]()?-0x1:0x1;}}}else{if(_0x355150===_0x84af('0x32')){return _0x4f096b[_0x84af('0x37')]<_0x14608f[_0x84af('0x37')]?0x1:-0x1;}else{return _0x4f096b[_0x84af('0x37')]<_0x14608f['globalStatus']?-0x1:0x1;}}});return _0x1d0f94;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x4145dd){var _0x594dbd=['userpic','online',_0x84af('0x39'),_0x84af('0x3a'),_0x84af('0x2f'),_0x84af('0x3a'),_0x84af('0x34'),_0x84af('0x3b'),_0x84af('0x2'),'openchannelPause',_0x84af('0x3'),_0x84af('0x2e'),'whatsappPause',_0x84af('0x2d'),_0x84af('0x5'),'chatCapacity',_0x84af('0x3c'),_0x84af('0x3d'),_0x84af('0x3e'),_0x84af('0x3f'),_0x84af('0x40'),_0x84af('0x41'),_0x84af('0x42'),'mailCurrentCapacity',_0x84af('0x43'),'whatsappCurrentCapacity',_0x84af('0x44'),_0x84af('0xf'),_0x84af('0x11'),_0x84af('0x45'),_0x84af('0x46'),_0x84af('0x13'),'faxStatus',_0x84af('0x12'),_0x84af('0x47'),_0x84af('0x48'),_0x84af('0x49'),_0x84af('0x4a'),_0x84af('0x4b'),'faxStatusTime',_0x84af('0x4c'),'queue',_0x84af('0x4d'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x84af('0x4e')];var _0x60a939=[_0x84af('0x2'),_0x84af('0x4'),_0x84af('0x3'),_0x84af('0x2e'),_0x84af('0x6'),_0x84af('0x2d'),_0x84af('0x5'),_0x84af('0x4f')];var _0x3bf724=_(_0x4145dd)[_0x84af('0x50')](_0x60a939)[_0x84af('0x51')](_0x594dbd)[_0x84af('0x25')]();return _0x3bf724;}exports[_0x84af('0x52')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x84af('0x2b'),_0x84af('0x2c'),_0x84af('0x53'),_0x84af('0x34'),_0x84af('0x4f'),_0x84af('0x37'),_0x84af('0x54'),'lastLoginAt',_0x84af('0x2f'),_0x84af('0x3a'),'faxPause',_0x84af('0x2'),'mailPause','openchannelPause',_0x84af('0x2e'),_0x84af('0x5'),'whatsappPause',_0x84af('0xf'),_0x84af('0x10'),_0x84af('0x45'),_0x84af('0x11'),_0x84af('0x46'),_0x84af('0x12'),'whatsappStatus',_0x84af('0x47'),_0x84af('0x55'),_0x84af('0x49'),_0x84af('0x48'),_0x84af('0x4a'),_0x84af('0x4c'),_0x84af('0x4b'),'chatCapacity',_0x84af('0x40'),'mailCapacity',_0x84af('0x3c'),'smsCapacity',_0x84af('0x3f'),_0x84af('0x41'),'faxCurrentCapacity','mailCurrentCapacity',_0x84af('0x42'),'smsCurrentCapacity',_0x84af('0x56'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x84af('0x57'),_0x84af('0x58'),_0x84af('0x59')];}exports[_0x84af('0x5a')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 779b4c9..2eb4ddf 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 _0xf411=['http','available','waiting','busy','inUse','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','outbound','concat','map','loggedIn','originated','find','pick','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf411,0x68));var _0x1f41=function(_0x5245bc,_0x55e740){_0x5245bc=_0x5245bc-0x0;var _0x2acb9a=_0xf411[_0x5245bc];return _0x2acb9a;};'use strict';var _=require(_0x1f41('0x0'));var jayson=require('jayson/promise');var util=require(_0x1f41('0x1'));var amiClient=jayson['client'][_0x1f41('0x2')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x1f41('0x3'),'loggedIn','paused',_0x1f41('0x4')];var VOICE_QUEUE_ATTRIBUTES=[_0x1f41('0x5'),_0x1f41('0x6'),'invalid',_0x1f41('0x7'),_0x1f41('0x8'),_0x1f41('0x9'),_0x1f41('0xa'),_0x1f41('0xb'),_0x1f41('0xc'),_0x1f41('0xd'),_0x1f41('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1f41('0xf'),'originated','message',_0x1f41('0x10'),_0x1f41('0x11'),_0x1f41('0x12'),_0x1f41('0x13'),_0x1f41('0x14'),_0x1f41('0x15'),_0x1f41('0x16'),_0x1f41('0x17'),_0x1f41('0x18'),_0x1f41('0x19'),_0x1f41('0x1a'),_0x1f41('0x1b'),_0x1f41('0x1c'),_0x1f41('0x1d'),'predictiveIntervalTotalCalls',_0x1f41('0x1e'),_0x1f41('0x1f'),_0x1f41('0x20'),_0x1f41('0x21'),_0x1f41('0x22')];function getRealtimeQueues(_0x79d8b3,_0x157547){var _0xc41900=_0x157547===_0x1f41('0x23')?amiClient:routingClient;return _0xc41900[_0x1f41('0x24')](_[_0x1f41('0x25')](_0x157547)+'Queues',_0x79d8b3)[_0x1f41('0x26')](function(_0xaf0a67){if(_0xaf0a67[_0x1f41('0x27')])throw new Error(util[_0x1f41('0x28')](_0x1f41('0x29'),_0x157547));return _0xaf0a67[_0x1f41('0x2a')];})[_0x1f41('0x2b')](function(_0x1b668c){throw _0x1b668c;});}exports[_0x1f41('0x2c')]=getRealtimeQueues;function initializeQueues(_0x30486d,_0x712351,_0x3f080e,_0x2d918f){var _0x4c7afd=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f080e===_0x1f41('0x23')){if(_0x2d918f===_0x1f41('0x2d')){_0x4c7afd=_0x4c7afd['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d918f===_0x1f41('0x2e')){_0x4c7afd=_0x4c7afd[_0x1f41('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x30486d[_0x1f41('0x30')](function(_0x98728a){var _0x2bf69a=_0x98728a['get']({'plain':!![]});_0x2bf69a['paused']=0x0;_0x2bf69a[_0x1f41('0x7')]=0x0;_0x2bf69a[_0x1f41('0x31')]=0x0;_0x2bf69a['available']=0x0;_0x2bf69a[_0x1f41('0x4')]=0x0;if(_0x3f080e==='voice'){_0x2bf69a[_0x1f41('0xc')]=0x0;_0x2bf69a[_0x1f41('0x5')]=0x0;if(_0x2d918f==='outbound'){_0x2bf69a[_0x1f41('0xf')]=0x0;_0x2bf69a[_0x1f41('0x32')]=0x0;}}var _0x111068=_[_0x1f41('0x33')](_0x712351,['id',_0x2bf69a['id']]);if(_0x111068){_['merge'](_0x2bf69a,_[_0x1f41('0x34')](_0x111068,_0x4c7afd));}return _0x2bf69a;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0xd6ec=['request','startCase','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','waiting','busy','pTalking','find','pick','initializeQueues','lodash','http','available','loggedIn','paused','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice'];(function(_0x1954f8,_0x4d1cbb){var _0x12e1c2=function(_0x53ca30){while(--_0x53ca30){_0x1954f8['push'](_0x1954f8['shift']());}};_0x12e1c2(++_0x4d1cbb);}(_0xd6ec,0xdb));var _0xcd6e=function(_0x385509,_0x1a9683){_0x385509=_0x385509-0x0;var _0x3b7e5e=_0xd6ec[_0x385509];return _0x3b7e5e;};'use strict';var _=require(_0xcd6e('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson['client'][_0xcd6e('0x1')]({'port':0x232a});var routingClient=jayson['client'][_0xcd6e('0x1')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xcd6e('0x2'),_0xcd6e('0x3'),_0xcd6e('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xcd6e('0x5'),_0xcd6e('0x6'),_0xcd6e('0x7'),_0xcd6e('0x8'),_0xcd6e('0x9'),'ringing',_0xcd6e('0xa'),_0xcd6e('0xb'),_0xcd6e('0xc'),_0xcd6e('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xcd6e('0xe'),'message',_0xcd6e('0xf'),_0xcd6e('0x10'),_0xcd6e('0x11'),_0xcd6e('0x12'),_0xcd6e('0x13'),'startProgressive','erlangCalls',_0xcd6e('0x14'),_0xcd6e('0x15'),_0xcd6e('0x16'),_0xcd6e('0x17'),_0xcd6e('0x18'),_0xcd6e('0x19'),'predictiveIntervalAvailable',_0xcd6e('0x1a'),_0xcd6e('0x1b'),'predictiveIntervalDroppedCallsTimeout',_0xcd6e('0x1c'),'predictiveIntervalAvgHoldtime',_0xcd6e('0x1d')];function getRealtimeQueues(_0xfb0a1e,_0x2f0dfe){var _0x678451=_0x2f0dfe===_0xcd6e('0x1e')?amiClient:routingClient;return _0x678451[_0xcd6e('0x1f')](_[_0xcd6e('0x20')](_0x2f0dfe)+'Queues',_0xfb0a1e)['then'](function(_0x348bf1){if(_0x348bf1[_0xcd6e('0x21')])throw new Error(util[_0xcd6e('0x22')](_0xcd6e('0x23'),_0x2f0dfe));return _0x348bf1[_0xcd6e('0x24')];})[_0xcd6e('0x25')](function(_0x1fd8e5){throw _0x1fd8e5;});}exports[_0xcd6e('0x26')]=getRealtimeQueues;function initializeQueues(_0x150b68,_0x4b4720,_0xb98216,_0x2ed4f3){var _0x28bbc7=DEFAULT_QUEUE_ATTRIBUTES;if(_0xb98216===_0xcd6e('0x1e')){if(_0x2ed4f3===_0xcd6e('0x27')){_0x28bbc7=_0x28bbc7[_0xcd6e('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2ed4f3===_0xcd6e('0x29')){_0x28bbc7=_0x28bbc7[_0xcd6e('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x150b68[_0xcd6e('0x2a')](function(_0x2bfe49){var _0x5a9d84=_0x2bfe49[_0xcd6e('0x2b')]({'plain':!![]});_0x5a9d84[_0xcd6e('0x4')]=0x0;_0x5a9d84[_0xcd6e('0x7')]=0x0;_0x5a9d84[_0xcd6e('0x3')]=0x0;_0x5a9d84[_0xcd6e('0x2')]=0x0;_0x5a9d84[_0xcd6e('0x2c')]=0x0;if(_0xb98216==='voice'){_0x5a9d84[_0xcd6e('0xb')]=0x0;_0x5a9d84[_0xcd6e('0x2d')]=0x0;if(_0x2ed4f3===_0xcd6e('0x29')){_0x5a9d84[_0xcd6e('0x2e')]=0x0;_0x5a9d84[_0xcd6e('0xe')]=0x0;}}var _0x6d92b2=_[_0xcd6e('0x2f')](_0x4b4720,['id',_0x5a9d84['id']]);if(_0x6d92b2){_['merge'](_0x5a9d84,_[_0xcd6e('0x30')](_0x6d92b2,_0x28bbc7));}return _0x5a9d84;});}exports[_0xcd6e('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8e4b937..c084c80 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1787787..5b0d38a 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 _0xa9fc=['hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','length','filter','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','map','model','join','createHash','md5','update','digest'];(function(_0x4d0222,_0x11e646){var _0x9ac99c=function(_0x1f0154){while(--_0x1f0154){_0x4d0222['push'](_0x4d0222['shift']());}};_0x9ac99c(++_0x11e646);}(_0xa9fc,0x154));var _0xca9f=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0xa9fc[_0x3725ee];return _0x399c71;};'use strict';var _=require(_0xca9f('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xca9f('0x1'));var exec=require(_0xca9f('0x2'))[_0xca9f('0x3')];var config=require(_0xca9f('0x4'));function getInterfaces(){var _0x547afe=[];var _0x4fe706=os[_0xca9f('0x5')]();var _0x3f6127=_['orderBy'](_['keys'](_0x4fe706));for(var _0x7295f9=0x0;_0x7295f9<_0x3f6127[_0xca9f('0x6')];_0x7295f9++){var _0x2d3035=_0x4fe706[_0x3f6127[_0x7295f9]][_0xca9f('0x7')](function(_0x310650){return _0x310650[_0xca9f('0x8')]===_0xca9f('0x9')&&_0x310650['internal']===![];});_0x547afe=_0x547afe['concat'](_0x2d3035);}return _0x547afe;}function getFirstInterface(){var _0x39a8f6=_[_0xca9f('0xa')](getInterfaces());return{'macAddress':_0x39a8f6&&_0x39a8f6[_0xca9f('0xb')]?_0x39a8f6[_0xca9f('0xb')]:_0xca9f('0xc'),'ipAddress':_0x39a8f6&&_0x39a8f6[_0xca9f('0xd')]?_0x39a8f6[_0xca9f('0xd')]:_0xca9f('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x113b9a=_[_0xca9f('0xf')](os['cpus']()[_0xca9f('0x10')](function(_0x59fee4){return _0x59fee4[_0xca9f('0x11')];}))[_0xca9f('0x12')](':');return crypto[_0xca9f('0x13')](_0xca9f('0x14'))[_0xca9f('0x15')](_0x113b9a)[_0xca9f('0x16')](_0xca9f('0x17'));}exports[_0xca9f('0x18')]=function(){var _0x4d0437=os[_0xca9f('0x19')]();var _0x1ad5d5=/[0-9a-f-]{36}/;if(config[_0xca9f('0x1a')]&&_0x1ad5d5[_0xca9f('0x1b')](config[_0xca9f('0x1a')])){return config[_0xca9f('0x1a')];}else if(_0x4d0437==='win32'){return exec(_0xca9f('0x1c'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x2c7ce5=getFirstInterface();var _0x450c90=getCPUhash();var _0x53f8a4=_0x450c90+'|'+os[_0xca9f('0x1d')]()+'|'+_0x2c7ce5[_0xca9f('0x1e')]+'|'+_0x2c7ce5[_0xca9f('0x1f')];var _0x56035c=crypto[_0xca9f('0x13')](_0xca9f('0x14'))[_0xca9f('0x15')](_0x53f8a4)[_0xca9f('0x16')](_0xca9f('0x17'));return _0x56035c[_0xca9f('0x20')](0x0,0x8)+'-'+_0x56035c[_0xca9f('0x20')](0x8,0xc)+'-'+_0x56035c[_0xca9f('0x20')](0xc,0x10)+'-'+_0x56035c['substring'](0x10,0x14)+'-'+_0x56035c[_0xca9f('0x20')](0x14);}}; \ No newline at end of file +var _0xddf9=['IPv4','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','update','substring','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','length','filter','family'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xddf9,0xc3));var _0x9ddf=function(_0xcf8f87,_0x5f5772){_0xcf8f87=_0xcf8f87-0x0;var _0x485b48=_0xddf9[_0xcf8f87];return _0x485b48;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x9ddf('0x0'));var machine=require(_0x9ddf('0x1'));var exec=require(_0x9ddf('0x2'))['execSync'];var config=require(_0x9ddf('0x3'));function getInterfaces(){var _0xadb580=[];var _0x531875=os[_0x9ddf('0x4')]();var _0x5d2515=_[_0x9ddf('0x5')](_['keys'](_0x531875));for(var _0x2c610c=0x0;_0x2c610c<_0x5d2515[_0x9ddf('0x6')];_0x2c610c++){var _0x3d1dd3=_0x531875[_0x5d2515[_0x2c610c]][_0x9ddf('0x7')](function(_0x9c0a81){return _0x9c0a81[_0x9ddf('0x8')]===_0x9ddf('0x9')&&_0x9c0a81['internal']===![];});_0xadb580=_0xadb580['concat'](_0x3d1dd3);}return _0xadb580;}function getFirstInterface(){var _0x36b46d=_['head'](getInterfaces());return{'macAddress':_0x36b46d&&_0x36b46d[_0x9ddf('0xa')]?_0x36b46d[_0x9ddf('0xa')]:_0x9ddf('0xb'),'ipAddress':_0x36b46d&&_0x36b46d[_0x9ddf('0xc')]?_0x36b46d[_0x9ddf('0xc')]:_0x9ddf('0xd')};}exports[_0x9ddf('0xe')]=getFirstInterface;function getCPUhash(){var _0x1e9212=_[_0x9ddf('0x5')](os[_0x9ddf('0xf')]()[_0x9ddf('0x10')](function(_0x21e4e0){return _0x21e4e0[_0x9ddf('0x11')];}))[_0x9ddf('0x12')](':');return crypto[_0x9ddf('0x13')](_0x9ddf('0x14'))['update'](_0x1e9212)[_0x9ddf('0x15')](_0x9ddf('0x16'));}exports[_0x9ddf('0x17')]=function(){var _0x26fee5=os[_0x9ddf('0x18')]();var _0x116dea=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x116dea['test'](config['licenseToken'])){return config[_0x9ddf('0x19')];}else if(_0x26fee5===_0x9ddf('0x1a')){return exec(_0x9ddf('0x1b'),{'encoding':_0x9ddf('0x1c')})['replace']('\x0d\x0a','');}else{var _0x20e020=getFirstInterface();var _0x146bcd=getCPUhash();var _0x2813d5=_0x146bcd+'|'+os[_0x9ddf('0x1d')]()+'|'+_0x20e020[_0x9ddf('0x1e')]+'|'+_0x20e020[_0x9ddf('0x1f')];var _0x262144=crypto[_0x9ddf('0x13')](_0x9ddf('0x14'))[_0x9ddf('0x20')](_0x2813d5)[_0x9ddf('0x15')](_0x9ddf('0x16'));return _0x262144[_0x9ddf('0x21')](0x0,0x8)+'-'+_0x262144[_0x9ddf('0x21')](0x8,0xc)+'-'+_0x262144[_0x9ddf('0x21')](0xc,0x10)+'-'+_0x262144[_0x9ddf('0x21')](0x10,0x14)+'-'+_0x262144['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 20214a4..cc46d20 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 _0x3ec0=['message','finally','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','version','../../components/encryptor','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x3ec0,0x165));var _0x03ec=function(_0x44b18a,_0x2c02b2){_0x44b18a=_0x44b18a-0x0;var _0x2088a4=_0x3ec0[_0x44b18a];return _0x2088a4;};'use strict';var util=require(_0x03ec('0x0'));var moment=require(_0x03ec('0x1'));var rp=require(_0x03ec('0x2'));var BPromise=require(_0x03ec('0x3'));var pkginfo=require('pkginfo')(module,_0x03ec('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x03ec('0x5'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST=_0x03ec('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2de593){return new BPromise(function(_0x27dd7a,_0x5e82ce){var _0x31eeeb=util[_0x03ec('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x2de593,module[_0x03ec('0x8')][_0x03ec('0x4')]);if(oldToken){_0x31eeeb=util['format'](_0x03ec('0x9'),HOST,_0x2de593,module[_0x03ec('0x8')][_0x03ec('0x4')],oldToken);}var _0x35c7af={'uri':_0x31eeeb,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x35c7af)[_0x03ec('0xa')](function(_0x134faf){_0x27dd7a(_0x134faf);})[_0x03ec('0xb')](function(_0xedfb8){_0x5e82ce(_0xedfb8);});});}function manageLicense(_0x3111d0,_0x1fbe86){var _0x55e31e=_0x1fbe86['get']({'plain':!![]});if(!isOldTokenSent&&_0x55e31e[_0x03ec('0xc')]!==_0x3111d0&&!_0x55e31e[_0x03ec('0xd')]){oldToken=_0x55e31e[_0x03ec('0xc')];}httpRequest(_0x3111d0)['then'](function(_0x459f27){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x459f27['active']){isOldTokenSent=![];if(!_0x55e31e[_0x03ec('0xe')]&&_0x55e31e['license']!=_0x459f27['license']||_0x55e31e[_0x03ec('0xe')]&&_0x55e31e['data2']){logger['info'](_0x03ec('0xf'));}if(_0x55e31e['license']&&!_0x55e31e['data2']&&_0x55e31e[_0x03ec('0xe')]!=_0x459f27[_0x03ec('0xe')]){logger['info'](_0x03ec('0x10'));}if(_0x55e31e[_0x03ec('0xe')]&&!_0x55e31e['data2']&&_0x55e31e[_0x03ec('0xe')]==_0x459f27[_0x03ec('0xe')]){return _0x1fbe86;}return _0x1fbe86[_0x03ec('0x11')]({'data1':_0x3111d0,'data2':null,'license':_0x459f27[_0x03ec('0xe')]});}else{if(_0x459f27['license']||_0x55e31e[_0x03ec('0xe')]){if(!_0x55e31e[_0x03ec('0xd')]){if(_0x55e31e[_0x03ec('0xc')]==_0x3111d0){GRAY_PERIOD_REASON=_0x03ec('0x12');logger[_0x03ec('0x13')](_0x03ec('0x14'));}else{GRAY_PERIOD_REASON=_0x03ec('0x15');logger[_0x03ec('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x55e31e[_0x03ec('0xc')],_0x3111d0);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x03ec('0x16')](),moment()['format'](_0x03ec('0x17')));return _0x1fbe86[_0x03ec('0x11')]({'data2':encryptor[_0x03ec('0x18')](moment()['format'](_0x03ec('0x17')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x55e31e[_0x03ec('0xd')]),_0x03ec('0x19'))>DAYS){logger[_0x03ec('0x13')](_0x03ec('0x1a'),moment()[_0x03ec('0x7')](_0x03ec('0x17')));isOldTokenSent=![];return _0x1fbe86['update']({'data1':_0x3111d0,'data2':null,'license':null});}}}else{if(_0x55e31e[_0x03ec('0xc')]!=_0x3111d0){logger[_0x03ec('0x13')](_0x03ec('0x1b'),_0x55e31e[_0x03ec('0xc')],_0x3111d0);return _0x1fbe86[_0x03ec('0x11')]({'data1':_0x3111d0,'data2':null,'license':null});}}}return _0x1fbe86;})[_0x03ec('0xa')](function(_0x52aa7d){_0x1fbe86=_0x52aa7d;})[_0x03ec('0xb')](function(_0x105c40){logger['error'](_0x105c40[_0x03ec('0x1c')]);})[_0x03ec('0x1d')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x1fbe86);},TIME);});}function defaultLicense(){var _0x594145=hardware['getUuid']();if(_0x594145){return db['License'][_0x03ec('0x1e')]({'where':{'id':0x1},'defaults':{'data1':_0x594145}})[_0x03ec('0x1f')](function(_0x69c8e9,_0x4a4980){logger['info'](_0x03ec('0x20'),_0x594145);manageLicense(_0x594145,_0x69c8e9);})[_0x03ec('0xb')](function(_0x423943){logger[_0x03ec('0x21')](_0x423943[_0x03ec('0x1c')]);});}}exports[_0x03ec('0x22')]=defaultLicense; \ No newline at end of file +var _0xd84a=['data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','then','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','request-promise','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','exports','format','GET','catch','get'];(function(_0x33adc3,_0x844bfc){var _0x4679f4=function(_0x4a49e8){while(--_0x4a49e8){_0x33adc3['push'](_0x33adc3['shift']());}};_0x4679f4(++_0x844bfc);}(_0xd84a,0x96));var _0xad84=function(_0x10f0dc,_0x5c81bd){_0x10f0dc=_0x10f0dc-0x0;var _0x424070=_0xd84a[_0x10f0dc];return _0x424070;};'use strict';var util=require(_0xad84('0x0'));var moment=require(_0xad84('0x1'));var rp=require(_0xad84('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xad84('0x3'));var db=require(_0xad84('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xad84('0x5'));var logger=require(_0xad84('0x6'))(_0xad84('0x7'));var HOST=_0xad84('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x15f94b){return new BPromise(function(_0x36be80,_0x1652be){var _0x1b606b=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x15f94b,module[_0xad84('0x9')][_0xad84('0x3')]);if(oldToken){_0x1b606b=util[_0xad84('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x15f94b,module[_0xad84('0x9')][_0xad84('0x3')],oldToken);}var _0x59e6a2={'uri':_0x1b606b,'method':_0xad84('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x59e6a2)['then'](function(_0x2733df){_0x36be80(_0x2733df);})[_0xad84('0xc')](function(_0x596756){_0x1652be(_0x596756);});});}function manageLicense(_0x26ece1,_0x483d98){var _0x2e181f=_0x483d98[_0xad84('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x2e181f['data1']!==_0x26ece1&&!_0x2e181f['data2']){oldToken=_0x2e181f[_0xad84('0xe')];}httpRequest(_0x26ece1)['then'](function(_0x21da99){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x21da99[_0xad84('0xf')]){isOldTokenSent=![];if(!_0x2e181f[_0xad84('0x7')]&&_0x2e181f[_0xad84('0x7')]!=_0x21da99[_0xad84('0x7')]||_0x2e181f[_0xad84('0x7')]&&_0x2e181f['data2']){logger[_0xad84('0x10')](_0xad84('0x11'));}if(_0x2e181f[_0xad84('0x7')]&&!_0x2e181f[_0xad84('0x12')]&&_0x2e181f[_0xad84('0x7')]!=_0x21da99[_0xad84('0x7')]){logger[_0xad84('0x10')](_0xad84('0x13'));}if(_0x2e181f[_0xad84('0x7')]&&!_0x2e181f[_0xad84('0x12')]&&_0x2e181f['license']==_0x21da99[_0xad84('0x7')]){return _0x483d98;}return _0x483d98['update']({'data1':_0x26ece1,'data2':null,'license':_0x21da99[_0xad84('0x7')]});}else{if(_0x21da99['license']||_0x2e181f[_0xad84('0x7')]){if(!_0x2e181f[_0xad84('0x12')]){if(_0x2e181f[_0xad84('0xe')]==_0x26ece1){GRAY_PERIOD_REASON=_0xad84('0x14');logger[_0xad84('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xad84('0x15');logger['info'](_0xad84('0x16'),_0x2e181f[_0xad84('0xe')],_0x26ece1);}logger[_0xad84('0x10')](_0xad84('0x17'),GRAY_PERIOD_REASON[_0xad84('0x18')](),moment()[_0xad84('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x483d98[_0xad84('0x19')]({'data2':encryptor[_0xad84('0x1a')](moment()[_0xad84('0xa')](_0xad84('0x1b')))});}else{if(moment()[_0xad84('0x1c')](encryptor[_0xad84('0x1d')](_0x2e181f[_0xad84('0x12')]),_0xad84('0x1e'))>DAYS){logger[_0xad84('0x10')](_0xad84('0x1f'),moment()['format'](_0xad84('0x1b')));isOldTokenSent=![];return _0x483d98['update']({'data1':_0x26ece1,'data2':null,'license':null});}}}else{if(_0x2e181f[_0xad84('0xe')]!=_0x26ece1){logger['info'](_0xad84('0x16'),_0x2e181f['data1'],_0x26ece1);return _0x483d98[_0xad84('0x19')]({'data1':_0x26ece1,'data2':null,'license':null});}}}return _0x483d98;})[_0xad84('0x20')](function(_0x18e21f){_0x483d98=_0x18e21f;})['catch'](function(_0xfb4494){logger['error'](_0xfb4494[_0xad84('0x21')]);})[_0xad84('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xad84('0x23')](),_0x483d98);},TIME);});}function defaultLicense(){var _0x4984d5=hardware['getUuid']();if(_0x4984d5){return db[_0xad84('0x24')][_0xad84('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4984d5}})[_0xad84('0x26')](function(_0x4d86bb,_0x1807a1){logger[_0xad84('0x10')](_0xad84('0x27'),_0x4984d5);manageLicense(_0x4984d5,_0x4d86bb);})['catch'](function(_0x3a6eb7){logger[_0xad84('0x28')](_0x3a6eb7[_0xad84('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6738660..d219739 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 _0x7a8d=['data2','decryptString','format','%s:%s:%s','parse','demo','uuid','deadline','days','machineUuid','changed','disabled','message','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','find','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0x42afde,_0x377195){var _0x5e9990=function(_0x157ea9){while(--_0x157ea9){_0x42afde['push'](_0x42afde['shift']());}};_0x5e9990(++_0x377195);}(_0x7a8d,0x17e));var _0xd7a8=function(_0x36bfc7,_0xc2841){_0x36bfc7=_0x36bfc7-0x0;var _0x26264c=_0x7a8d[_0x36bfc7];return _0x26264c;};'use strict';var util=require(_0xd7a8('0x0'));var _=require(_0xd7a8('0x1'));var moment=require(_0xd7a8('0x2'));var BPromise=require('bluebird');var hardware=require(_0xd7a8('0x3'));var encryptor=require(_0xd7a8('0x4'));var db=require(_0xd7a8('0x5'))['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['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd7a8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xd7a8('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x57c858){return new BPromise(function(_0x1607fc,_0x3bd10e){return db['License'][_0xd7a8('0x8')](_['defaults'](_0x57c858,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3d3ad5){return checkLicense(_0x3d3ad5,null);})[_0xd7a8('0x9')](function(_0xd46b4d){_0x1607fc(_0xd46b4d);return;})['catch'](function(_0x7ee5f){_0x3bd10e(_0x7ee5f);});});}function checkLicense(_0xcdd011,_0x2eac2b){if(!_0xcdd011){demoLicense['uuid']=_0xcdd011[_0xd7a8('0xa')];return demoLicense;}try{var _0x472bc0=_0x2eac2b||_0xcdd011[_0xd7a8('0xb')];if(_[_0xd7a8('0xc')](_0x472bc0)){throw new Error(_0xd7a8('0xd'));}var _0x4ef631=_0xcdd011[_0xd7a8('0xa')];var _0x3cc1c7=_0xcdd011[_0xd7a8('0xe')];var _0x5e2922=_0x4ef631['split']('-')[0x4];var _0x1996be=_0x4ef631['split']('-')[0x0];var _0x558c27=encryptor[_0xd7a8('0xf')](_0x472bc0,util[_0xd7a8('0x10')](_0xd7a8('0x11'),_0x5e2922,_0x4ef631,_0x1996be));var _0x22bce3=JSON[_0xd7a8('0x12')](_0x558c27);_0x22bce3[_0xd7a8('0x13')]=![];_0x22bce3[_0xd7a8('0x14')]=_0x4ef631;_0x22bce3['machineUuid']=hardware[_0xd7a8('0x7')]();if(_0x3cc1c7){var _0xa09b5a=encryptor[_0xd7a8('0xf')](_0x3cc1c7);_0x22bce3['gray']=_0xa09b5a;_0x22bce3[_0xd7a8('0x15')]=moment(_0xa09b5a)['add'](0x7,_0xd7a8('0x16'))['format']();_0x22bce3['grayReason']=_0x22bce3[_0xd7a8('0x14')]!=_0x22bce3[_0xd7a8('0x17')]?_0xd7a8('0x18'):_0xd7a8('0x19');}return _0x22bce3;}catch(_0x1c1d56){breakingLicense[_0xd7a8('0x14')]=_0xcdd011[_0xd7a8('0xa')];breakingLicense[_0xd7a8('0x1a')]=_0x1c1d56[_0xd7a8('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1354df,_0x8c5ae9){getLicense()[_0xd7a8('0x9')](function(_0x5c44cd){return db['User']['findAll']({'attributes':[_0xd7a8('0x1b'),[db[_0xd7a8('0x1c')]['fn'](_0xd7a8('0x1d'),db['sequelize'][_0xd7a8('0x1e')](_0xd7a8('0x1b'))),_0xd7a8('0x1f')]],'group':_0xd7a8('0x1b'),'where':{'role':{'$or':[_0xd7a8('0x20'),'user',_0xd7a8('0x21')]}},'raw':!![]})[_0xd7a8('0x9')](function(_0x59f51e){var _0x182fb8={'user':_0x5c44cd[_0xd7a8('0x22')]||0x0,'telephone':_0x5c44cd[_0xd7a8('0x23')]||0x0};_0x59f51e[_0xd7a8('0x24')](function(_0x42663b){var _0x2e0929=_0x42663b[_0xd7a8('0x1b')]==='admin'?_0xd7a8('0x25'):_0x42663b[_0xd7a8('0x1b')];_0x182fb8[_0x2e0929]-=_0x42663b[_0xd7a8('0x1f')];if(_0x182fb8[_0x2e0929]<0x0)_0x182fb8[_0x2e0929]=0x0;});_0x1354df(_0x182fb8);return;});})[_0xd7a8('0x26')](function(_0x5a8862){_0x8c5ae9(_0x5a8862);});});}function checkUserLimits(_0x218388){return new BPromise(function(_0x1d7829,_0x580d27){getLimits()[_0xd7a8('0x9')](function(_0x1751fb){var _0x3b1ffa=_[_0xd7a8('0x27')](_[_0xd7a8('0x28')](_0x218388,_0xd7a8('0x1b')),[_0xd7a8('0x20'),_0xd7a8('0x25'),_0xd7a8('0x21')]);var _0x4c9a55=(_0x3b1ffa[_0xd7a8('0x20')]||0x0)+(_0x3b1ffa[_0xd7a8('0x25')]||0x0);var _0x46dafe=_0x3b1ffa['telephone']||0x0;if(_0x4c9a55>_0x1751fb[_0xd7a8('0x25')])return _0x580d27(_0xd7a8('0x29'));if(_0x46dafe>_0x1751fb['telephone'])return _0x580d27(_0xd7a8('0x2a'));return _0x1d7829();})[_0xd7a8('0x26')](function(_0x5e8266){_0x580d27(_0x5e8266);});});}module[_0xd7a8('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xecdb=['Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','parse','demo','gray','deadline','days','grayReason','machineUuid','disabled','data1','message','User','role','sequelize','COUNT','count','admin','user','users','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x5b69f6,_0x2e28bd){var _0x37abab=function(_0x5b1fda){while(--_0x5b1fda){_0x5b69f6['push'](_0x5b69f6['shift']());}};_0x37abab(++_0x2e28bd);}(_0xecdb,0x1e7));var _0xbecd=function(_0x3811f0,_0x4ed435){_0x3811f0=_0x3811f0-0x0;var _0x1a6d56=_0xecdb[_0x3811f0];return _0x1a6d56;};'use strict';var util=require(_0xbecd('0x0'));var _=require(_0xbecd('0x1'));var moment=require(_0xbecd('0x2'));var BPromise=require(_0xbecd('0x3'));var hardware=require(_0xbecd('0x4'));var encryptor=require(_0xbecd('0x5'));var db=require(_0xbecd('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbecd('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbecd('0x8'),'machineUuid':hardware[_0xbecd('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbecd('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xbecd('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x56b3fa){return new BPromise(function(_0x4c379b,_0x5d027f){return db[_0xbecd('0xa')][_0xbecd('0xb')](_[_0xbecd('0xc')](_0x56b3fa,{'raw':!![],'where':{'id':0x1}}))[_0xbecd('0xd')](function(_0x2d8b7a){return checkLicense(_0x2d8b7a,null);})[_0xbecd('0xd')](function(_0x15bae8){_0x4c379b(_0x15bae8);return;})[_0xbecd('0xe')](function(_0x1f83f5){_0x5d027f(_0x1f83f5);});});}function checkLicense(_0x300067,_0xcedc22){if(!_0x300067){demoLicense[_0xbecd('0xf')]=_0x300067['data1'];return demoLicense;}try{var _0x2dd562=_0xcedc22||_0x300067[_0xbecd('0x10')];if(_[_0xbecd('0x11')](_0x2dd562)){throw new Error(_0xbecd('0x12'));}var _0x68e848=_0x300067['data1'];var _0x1bf949=_0x300067[_0xbecd('0x13')];var _0x348e8d=_0x68e848['split']('-')[0x4];var _0x2792e6=_0x68e848['split']('-')[0x0];var _0x209656=encryptor[_0xbecd('0x14')](_0x2dd562,util[_0xbecd('0x15')]('%s:%s:%s',_0x348e8d,_0x68e848,_0x2792e6));var _0x1e2017=JSON[_0xbecd('0x16')](_0x209656);_0x1e2017[_0xbecd('0x17')]=![];_0x1e2017[_0xbecd('0xf')]=_0x68e848;_0x1e2017['machineUuid']=hardware[_0xbecd('0x9')]();if(_0x1bf949){var _0x15eae8=encryptor[_0xbecd('0x14')](_0x1bf949);_0x1e2017[_0xbecd('0x18')]=_0x15eae8;_0x1e2017[_0xbecd('0x19')]=moment(_0x15eae8)['add'](0x7,_0xbecd('0x1a'))[_0xbecd('0x15')]();_0x1e2017[_0xbecd('0x1b')]=_0x1e2017[_0xbecd('0xf')]!=_0x1e2017[_0xbecd('0x1c')]?'changed':_0xbecd('0x1d');}return _0x1e2017;}catch(_0x3efc9c){breakingLicense[_0xbecd('0xf')]=_0x300067[_0xbecd('0x1e')];breakingLicense[_0xbecd('0x1f')]=_0x3efc9c[_0xbecd('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2d7091,_0x543d91){getLicense()[_0xbecd('0xd')](function(_0x1f44b8){return db[_0xbecd('0x20')]['findAll']({'attributes':[_0xbecd('0x21'),[db[_0xbecd('0x22')]['fn'](_0xbecd('0x23'),db[_0xbecd('0x22')]['col'](_0xbecd('0x21'))),_0xbecd('0x24')]],'group':_0xbecd('0x21'),'where':{'role':{'$or':[_0xbecd('0x25'),_0xbecd('0x26'),'telephone']}},'raw':!![]})[_0xbecd('0xd')](function(_0xdfb3f4){var _0x5ca090={'user':_0x1f44b8[_0xbecd('0x27')]||0x0,'telephone':_0x1f44b8['telephones']||0x0};_0xdfb3f4['forEach'](function(_0x4fca1e){var _0x4f2c81=_0x4fca1e['role']===_0xbecd('0x25')?_0xbecd('0x26'):_0x4fca1e['role'];_0x5ca090[_0x4f2c81]-=_0x4fca1e[_0xbecd('0x24')];if(_0x5ca090[_0x4f2c81]<0x0)_0x5ca090[_0x4f2c81]=0x0;});_0x2d7091(_0x5ca090);return;});})['catch'](function(_0x3dd199){_0x543d91(_0x3dd199);});});}function checkUserLimits(_0x107eba){return new BPromise(function(_0x568518,_0x3eacb9){getLimits()[_0xbecd('0xd')](function(_0x426b3d){var _0x34c34b=_[_0xbecd('0x28')](_[_0xbecd('0x29')](_0x107eba,'role'),[_0xbecd('0x25'),_0xbecd('0x26'),_0xbecd('0x2a')]);var _0x1c04b7=(_0x34c34b[_0xbecd('0x25')]||0x0)+(_0x34c34b[_0xbecd('0x26')]||0x0);var _0x32a6bd=_0x34c34b['telephone']||0x0;if(_0x1c04b7>_0x426b3d[_0xbecd('0x26')])return _0x3eacb9(_0xbecd('0x2b'));if(_0x32a6bd>_0x426b3d['telephone'])return _0x3eacb9(_0xbecd('0x2c'));return _0x568518();})[_0xbecd('0xe')](function(_0x5e8f7b){_0x3eacb9(_0x5e8f7b);});});}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 7a27cda..2fc319f 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 _0xfcbb=['http://localhost:9000','myappanuglar-secret','exports'];(function(_0x4c5258,_0x3afb0f){var _0x3055db=function(_0x3edca1){while(--_0x3edca1){_0x4c5258['push'](_0x4c5258['shift']());}};_0x3055db(++_0x3afb0f);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x41f54b,_0x2b1411){_0x41f54b=_0x41f54b-0x0;var _0xec31e9=_0xfcbb[_0x41f54b];return _0xec31e9;};'use strict';module[_0xbfcb('0x0')]={'DOMAIN':_0xbfcb('0x1'),'SESSION_SECRET':_0xbfcb('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x8e3f=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x4c44dc,_0x3d0d9d){var _0xa56cba=function(_0x43991d){while(--_0x43991d){_0x4c44dc['push'](_0x4c44dc['shift']());}};_0xa56cba(++_0x3d0d9d);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';module[_0xf8e3('0x0')]={'DOMAIN':_0xf8e3('0x1'),'SESSION_SECRET':_0xf8e3('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xf8e3('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2370c96..3352a1b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c42=['fileLogger','exports','../utils/loggers'];(function(_0x336769,_0x48670a){var _0x4bcde5=function(_0x1bf2d9){while(--_0x1bf2d9){_0x336769['push'](_0x336769['shift']());}};_0x4bcde5(++_0x48670a);}(_0x4c42,0x10a));var _0x24c4=function(_0x2ede73,_0x1057aa){_0x2ede73=_0x2ede73-0x0;var _0x2a0932=_0x4c42[_0x2ede73];return _0x2a0932;};'use strict';var fileLogger=require(_0x24c4('0x0'))[_0x24c4('0x1')];module[_0x24c4('0x2')]=fileLogger; \ No newline at end of file +var _0xe083=['fileLogger','../utils/loggers'];(function(_0x1bc019,_0x3b33ec){var _0x4dc25f=function(_0x18168c){while(--_0x18168c){_0x1bc019['push'](_0x1bc019['shift']());}};_0x4dc25f(++_0x3b33ec);}(_0xe083,0x1af));var _0x3e08=function(_0x49bd64,_0x527c06){_0x49bd64=_0x49bd64-0x0;var _0xd4dd7c=_0xe083[_0x49bd64];return _0xd4dd7c;};'use strict';var fileLogger=require(_0x3e08('0x0'))[_0x3e08('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6fc09d9..e019ee5 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 _0x4eef=['../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0xd9543,_0xa5f6cb){var _0x3ef7e0=function(_0x221ee6){while(--_0x221ee6){_0xd9543['push'](_0xd9543['shift']());}};_0x3ef7e0(++_0xa5f6cb);}(_0x4eef,0x172));var _0xf4ee=function(_0xcdaf32,_0x45a0f2){_0xcdaf32=_0xcdaf32-0x0;var _0x4a2e89=_0x4eef[_0xcdaf32];return _0x4a2e89;};'use strict';var path=require(_0xf4ee('0x0'));var cfg=require(_0xf4ee('0x1'));var env={'NODE_PATH':path[_0xf4ee('0x2')](path[_0xf4ee('0x3')](cfg[_0xf4ee('0x4')],_0xf4ee('0x5')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0xf4ee('0x6')),'env':env},{'name':_0xf4ee('0x7'),'script':path['join'](__dirname,_0xf4ee('0x8')),'env':env},{'name':_0xf4ee('0x9'),'script':path[_0xf4ee('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xf4ee('0xa'),'script':path[_0xf4ee('0x3')](__dirname,_0xf4ee('0xb')),'env':env},{'name':_0xf4ee('0xc'),'script':path[_0xf4ee('0x3')](__dirname,_0xf4ee('0xd')),'env':env},{'name':'xdr','script':path[_0xf4ee('0x3')](__dirname,_0xf4ee('0xe')),'env':env}]};module[_0xf4ee('0xf')]=pm2config; \ No newline at end of file +var _0xce73=['../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','legacy-libs'];(function(_0x4a5884,_0x493748){var _0xf8898b=function(_0x394456){while(--_0x394456){_0x4a5884['push'](_0x4a5884['shift']());}};_0xf8898b(++_0x493748);}(_0xce73,0x87));var _0x3ce7=function(_0xe9cb41,_0x17d273){_0xe9cb41=_0xe9cb41-0x0;var _0xb7b234=_0xce73[_0xe9cb41];return _0xb7b234;};'use strict';var path=require(_0x3ce7('0x0'));var cfg=require(_0x3ce7('0x1'));var env={'NODE_PATH':path[_0x3ce7('0x2')](path[_0x3ce7('0x3')](cfg['root'],_0x3ce7('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x3ce7('0x3')](__dirname,_0x3ce7('0x5')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x3ce7('0x6')),'env':env},{'name':_0x3ce7('0x7'),'script':path[_0x3ce7('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x3ce7('0x8'),'script':path[_0x3ce7('0x3')](__dirname,_0x3ce7('0x9')),'env':env},{'name':_0x3ce7('0xa'),'script':path['join'](__dirname,_0x3ce7('0xb')),'env':env},{'name':'xdr','script':path[_0x3ce7('0x3')](__dirname,_0x3ce7('0xc')),'env':env}]};module[_0x3ce7('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fdbc6de..eaa2c67 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 _0x0586=['dump','pm2','bluebird','./config','connect','connected','start','stop','disconnect','then','restart','list','describe','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0586,0x15f));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x6058('0x0'));var BPromise=require(_0x6058('0x1'));var config=require(_0x6058('0x2'));function connect(){return new BPromise(function(_0x3c4504,_0x5936ed){return pm2[_0x6058('0x3')](function(_0x3d3fb8){if(_0x3d3fb8){return _0x5936ed(_0x3d3fb8);}return _0x3c4504(_0x6058('0x4'));});});};exports['start']=function(_0x2014c7){return connect()['then'](function(){return new BPromise(function(_0x50baf7,_0x5391da){return pm2[_0x6058('0x5')](_0x2014c7,function(_0x5f214f,_0x4ce159){if(_0x5f214f){return _0x5391da(_0x5f214f);}pm2['disconnect']();return _0x50baf7(_0x4ce159);});});});};exports[_0x6058('0x6')]=function(_0x328538){return connect()['then'](function(){return new BPromise(function(_0x48111a,_0x40549f){return pm2[_0x6058('0x6')](_0x328538,function(_0x2ea7d2,_0x4bea85){if(_0x2ea7d2){return _0x40549f(_0x2ea7d2);}pm2[_0x6058('0x7')]();return _0x48111a(_0x4bea85);});});});};exports['restart']=function(_0xf84c31){return connect()[_0x6058('0x8')](function(){return new BPromise(function(_0xc3c0b6,_0x377948){return pm2[_0x6058('0x9')](_0xf84c31,function(_0x18d9b1,_0x3c6073){if(_0x18d9b1){return _0x377948(_0x18d9b1);}pm2[_0x6058('0x7')]();return _0xc3c0b6(_0x3c6073);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x329404,_0x5d9aa9){return pm2[_0x6058('0xa')](function(_0x25d180,_0x47b5a7){if(_0x25d180){return _0x5d9aa9(_0x25d180);}pm2[_0x6058('0x7')]();return _0x329404(_0x47b5a7);});});});};exports[_0x6058('0xb')]=function(_0x254f94){return connect()[_0x6058('0x8')](function(){return new BPromise(function(_0x301593,_0x3077d8){return pm2[_0x6058('0xb')](_0x254f94,function(_0x57ae98,_0x1b2a98){if(_0x57ae98){return _0x3077d8(_0x57ae98);}pm2['disconnect']();return _0x301593(_0x1b2a98);});});});};exports[_0x6058('0xc')]=function(_0x14335b){return connect()[_0x6058('0x8')](function(){return new BPromise(function(_0x5b138a,_0x2de85e){return pm2['delete'](_0x14335b,function(_0xba2f9c,_0x505c53){if(_0xba2f9c){return _0x2de85e(_0xba2f9c);}pm2[_0x6058('0x7')]();return _0x5b138a(_0x505c53);});});});};exports[_0x6058('0xd')]=function(){return connect()[_0x6058('0x8')](function(){return new BPromise(function(_0x188adc,_0x30bec3){return pm2['dump'](function(_0x5222e0){if(_0x5222e0){return _0x30bec3(_0x5222e0);}return _0x188adc('saved');});});});}; \ No newline at end of file +var _0xbfdc=['restart','list','describe','delete','saved','pm2','bluebird','connect','connected','then','disconnect','stop'];(function(_0x19f3d7,_0x446871){var _0x35503f=function(_0x838b00){while(--_0x838b00){_0x19f3d7['push'](_0x19f3d7['shift']());}};_0x35503f(++_0x446871);}(_0xbfdc,0x1cd));var _0xcbfd=function(_0x475961,_0x2c7aee){_0x475961=_0x475961-0x0;var _0x2cb203=_0xbfdc[_0x475961];return _0x2cb203;};'use strict';var pm2=require(_0xcbfd('0x0'));var BPromise=require(_0xcbfd('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x16d8c2,_0x490e13){return pm2[_0xcbfd('0x2')](function(_0x324c71){if(_0x324c71){return _0x490e13(_0x324c71);}return _0x16d8c2(_0xcbfd('0x3'));});});};exports['start']=function(_0x5021be){return connect()[_0xcbfd('0x4')](function(){return new BPromise(function(_0xea6130,_0x50f7cb){return pm2['start'](_0x5021be,function(_0x478e91,_0x45bdd1){if(_0x478e91){return _0x50f7cb(_0x478e91);}pm2[_0xcbfd('0x5')]();return _0xea6130(_0x45bdd1);});});});};exports['stop']=function(_0x4cb473){return connect()[_0xcbfd('0x4')](function(){return new BPromise(function(_0x438488,_0x3c56ca){return pm2[_0xcbfd('0x6')](_0x4cb473,function(_0x2ee27e,_0x57edee){if(_0x2ee27e){return _0x3c56ca(_0x2ee27e);}pm2[_0xcbfd('0x5')]();return _0x438488(_0x57edee);});});});};exports[_0xcbfd('0x7')]=function(_0x4eabd6){return connect()[_0xcbfd('0x4')](function(){return new BPromise(function(_0x47cef1,_0x38d327){return pm2[_0xcbfd('0x7')](_0x4eabd6,function(_0x4ed721,_0x351fa1){if(_0x4ed721){return _0x38d327(_0x4ed721);}pm2[_0xcbfd('0x5')]();return _0x47cef1(_0x351fa1);});});});};exports['list']=function(){return connect()[_0xcbfd('0x4')](function(){return new BPromise(function(_0x39d054,_0x1b0a71){return pm2[_0xcbfd('0x8')](function(_0x89f6fa,_0x5288a8){if(_0x89f6fa){return _0x1b0a71(_0x89f6fa);}pm2[_0xcbfd('0x5')]();return _0x39d054(_0x5288a8);});});});};exports['describe']=function(_0x399e54){return connect()[_0xcbfd('0x4')](function(){return new BPromise(function(_0xa3eaca,_0x3b9d23){return pm2[_0xcbfd('0x9')](_0x399e54,function(_0x27dba3,_0x32ebc2){if(_0x27dba3){return _0x3b9d23(_0x27dba3);}pm2['disconnect']();return _0xa3eaca(_0x32ebc2);});});});};exports['delete']=function(_0x37a20e){return connect()['then'](function(){return new BPromise(function(_0x5e7c1c,_0x378719){return pm2[_0xcbfd('0xa')](_0x37a20e,function(_0x483919,_0x461028){if(_0x483919){return _0x378719(_0x483919);}pm2[_0xcbfd('0x5')]();return _0x5e7c1c(_0x461028);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x3b9887,_0x2a4ab4){return pm2['dump'](function(_0x419d83){if(_0x419d83){return _0x2a4ab4(_0x419d83);}return _0x3b9887(_0xcbfd('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 218dbb6..83624f3 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 _0xa1d0=['localhost','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','inspect','start','lodash','ioredis','util','../../config/environment','schedule','redis','defaults'];(function(_0x4cbf1a,_0x537bf1){var _0x4d6087=function(_0x2cf64d){while(--_0x2cf64d){_0x4cbf1a['push'](_0x4cbf1a['shift']());}};_0x4d6087(++_0x537bf1);}(_0xa1d0,0xe0));var _0x0a1d=function(_0x54df0d,_0x44e2d3){_0x54df0d=_0x54df0d-0x0;var _0x1d4ceb=_0xa1d0[_0x54df0d];return _0x1d4ceb;};'use strict';var _=require(_0x0a1d('0x0'));var moment=require('moment');var Redis=require(_0x0a1d('0x1'));var util=require(_0x0a1d('0x2'));var config=require(_0x0a1d('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x0a1d('0x4'));config[_0x0a1d('0x5')]=_[_0x0a1d('0x6')](config[_0x0a1d('0x5')],{'host':_0x0a1d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x32ac75=0x0;var _0x4d5c2a=[];return db['Setting'][_0x0a1d('0x8')]({'raw':!![],'attributes':['id',_0x0a1d('0x9')],'where':{'id':0x1}})[_0x0a1d('0xa')](function(_0x1575cc){_0x32ac75=_0x1575cc[_0x0a1d('0x9')];if(_0x32ac75){return db[_0x0a1d('0xb')][_0x0a1d('0xc')]({'raw':!![],'attributes':['id',_0x0a1d('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0a1d('0xe')](_0x1575cc[_0x0a1d('0x9')],_0x0a1d('0xf'))}}});}else{return[];}})[_0x0a1d('0xa')](function(_0x178f4e){if(_0x178f4e&&_0x178f4e[_0x0a1d('0x10')]){_0x4d5c2a=_[_0x0a1d('0x11')](_0x178f4e||[],'id');logger[_0x0a1d('0x12')](_0x0a1d('0x13'),_0x4d5c2a['join']());return db[_0x0a1d('0xb')][_0x0a1d('0x14')]({'closeReason':_0x0a1d('0x15'),'disposition':_0x0a1d('0x16'),'closed':!![],'closedAt':moment()[_0x0a1d('0x17')](_0x0a1d('0x18'))},{'where':{'id':_0x4d5c2a}});}})[_0x0a1d('0xa')](function(){if(_0x4d5c2a&&_0x4d5c2a[_0x0a1d('0x10')]){logger[_0x0a1d('0x12')](_0x0a1d('0x19'),_0x4d5c2a[_0x0a1d('0x1a')]());for(var _0x5a4a01=0x0;_0x5a4a01<_0x4d5c2a[_0x0a1d('0x10')];_0x5a4a01++){io[_0x0a1d('0x1b')](_0x0a1d('0x1c'),{'id':_0x4d5c2a[_0x5a4a01],'closed':!![]});}}})[_0x0a1d('0x1d')](function(_0xa94be0){logger[_0x0a1d('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0xa94be0?util[_0x0a1d('0x1f')](_0xa94be0,{'showHidden':![],'depth':null}):'');});}exports[_0x0a1d('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6f71=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length'];(function(_0x2d95d8,_0x1a1f94){var _0x4a93c0=function(_0x559ba9){while(--_0x559ba9){_0x2d95d8['push'](_0x2d95d8['shift']());}};_0x4a93c0(++_0x1a1f94);}(_0x6f71,0x163));var _0x16f7=function(_0x458ef0,_0x366adb){_0x458ef0=_0x458ef0-0x0;var _0x10eab7=_0x6f71[_0x458ef0];return _0x10eab7;};'use strict';var _=require(_0x16f7('0x0'));var moment=require('moment');var Redis=require(_0x16f7('0x1'));var util=require(_0x16f7('0x2'));var config=require(_0x16f7('0x3'));var db=require(_0x16f7('0x4'))['db'];var logger=require(_0x16f7('0x5'))(_0x16f7('0x6'));config[_0x16f7('0x7')]=_[_0x16f7('0x8')](config[_0x16f7('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x16f7('0x9'))(new Redis(config[_0x16f7('0x7')]));function closeInteractions(){var _0x5eac56=0x0;var _0x31ba4d=[];return db['Setting'][_0x16f7('0xa')]({'raw':!![],'attributes':['id',_0x16f7('0xb')],'where':{'id':0x1}})[_0x16f7('0xc')](function(_0x371cd3){_0x5eac56=_0x371cd3[_0x16f7('0xb')];if(_0x5eac56){return db[_0x16f7('0xd')][_0x16f7('0xe')]({'raw':!![],'attributes':['id',_0x16f7('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x16f7('0x10')](_0x371cd3[_0x16f7('0xb')],_0x16f7('0x11'))}}});}else{return[];}})[_0x16f7('0xc')](function(_0x57c80c){if(_0x57c80c&&_0x57c80c[_0x16f7('0x12')]){_0x31ba4d=_[_0x16f7('0x13')](_0x57c80c||[],'id');logger[_0x16f7('0x14')](_0x16f7('0x15'),_0x31ba4d[_0x16f7('0x16')]());return db[_0x16f7('0xd')][_0x16f7('0x17')]({'closeReason':_0x16f7('0x18'),'disposition':_0x16f7('0x19'),'closed':!![],'closedAt':moment()[_0x16f7('0x1a')](_0x16f7('0x1b'))},{'where':{'id':_0x31ba4d}});}})[_0x16f7('0xc')](function(){if(_0x31ba4d&&_0x31ba4d[_0x16f7('0x12')]){logger[_0x16f7('0x14')](_0x16f7('0x1c'),_0x31ba4d[_0x16f7('0x16')]());for(var _0x47a098=0x0;_0x47a098<_0x31ba4d[_0x16f7('0x12')];_0x47a098++){io[_0x16f7('0x1d')](_0x16f7('0x1e'),{'id':_0x31ba4d[_0x47a098],'closed':!![]});}}})[_0x16f7('0x1f')](function(_0x4b7074){logger['error'](_0x16f7('0x20'),_0x4b7074?util[_0x16f7('0x21')](_0x4b7074,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index b509804..15409dd 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 _0x0b44=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2b8445,_0x9ebd55){var _0x321d21=function(_0xad1782){while(--_0xad1782){_0x2b8445['push'](_0x2b8445['shift']());}};_0x321d21(++_0x9ebd55);}(_0x0b44,0x116));var _0x40b4=function(_0x18f62a,_0x294c09){_0x18f62a=_0x18f62a-0x0;var _0x26ece9=_0x0b44[_0x18f62a];return _0x26ece9;};'use strict';function start(){var _0x8152ec=require(_0x40b4('0x0'));return _0x8152ec[_0x40b4('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xcd93=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x49ba22,_0x4b4feb){var _0x499290=function(_0x39702d){while(--_0x39702d){_0x49ba22['push'](_0x49ba22['shift']());}};_0x499290(++_0x4b4feb);}(_0xcd93,0x16f));var _0x3cd9=function(_0x3e0027,_0x5eb3d6){_0x3e0027=_0x3e0027-0x0;var _0x305ca5=_0xcd93[_0x3e0027];return _0x305ca5;};'use strict';function start(){var _0x4f1dfc=require(_0x3cd9('0x0'));return _0x4f1dfc[_0x3cd9('0x1')]();}module[_0x3cd9('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 66be614..3e1576b 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 _0x9749=['Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','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','[handleSendEmail]\x20Unrecognized\x20status:','SendMail','then','error\x20mail','info','email\x20sent','currentAttempt','retryOptions','retries','job','data','operation','still\x20loading','case\x20completed','stop','case\x20empty','Unrecognized\x20status:','entity','dataValues','attempt','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','MailServerOut','CloudProvider','jobs','map','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','findOne','catch','error','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x9749,0x1a1));var _0x9974=function(_0x2d6706,_0x901d04){_0x2d6706=_0x2d6706-0x0;var _0x475406=_0x9749[_0x2d6706];return _0x475406;};'use strict';var fs=require('fs');var util=require(_0x9974('0x0'));var path=require('path');var _=require(_0x9974('0x1'));var moment=require('moment');var CronJobManager=require(_0x9974('0x2'));var jayson=require(_0x9974('0x3'));var BPromise=require(_0x9974('0x4'));var logger=require(_0x9974('0x5'))(_0x9974('0x6'));var db=require(_0x9974('0x7'))['db'];const retry=require(_0x9974('0x8'));var analyticCustomReportController=require(_0x9974('0x9'));var analyticDefaultReportController=require(_0x9974('0xa'));var client=jayson[_0x9974('0xb')][_0x9974('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4d3e7a){const _0x2ad353={};if(typeof _0x4d3e7a===_0x9974('0xd')){_0x2ad353['id']=_0x4d3e7a;}return db['AnalyticExtractedReport'][_0x9974('0xe')]({'where':_0x2ad353})['then'](function(_0x32b106){return _0x32b106;})[_0x9974('0xf')](function(_0x78f9f7){logger[_0x9974('0x10')](_0x78f9f7);});}function handleSendEmail(_0x78340e,_0x3e591b){logger['info'](_0x9974('0x11'),_0x78340e[_0x9974('0x12')]);var _0x10eebf=!![];var _0x12a2ce=_0x78340e[_0x9974('0x13')][_0x9974('0x14')]();var _0x3b6407={'account':_0x12a2ce,'message':{'from':util[_0x9974('0x15')]('\x22%s\x22\x20<%s>',_0x78340e[_0x9974('0x13')][_0x9974('0x16')],_0x78340e[_0x9974('0x13')][_0x9974('0x12')]||_0x78340e[_0x9974('0x13')][_0x9974('0x17')][_0x9974('0x18')]),'to':_0x78340e['email'],'cc':_0x78340e['cc'],'bcc':_0x78340e[_0x9974('0x19')],'subject':util[_0x9974('0x15')](_0x9974('0x1a'),_0x3e591b['name'],_0x78340e[_0x9974('0x1b')],_0x78340e['subtractUnit'])}};var _0x276846=path[_0x9974('0x1c')](__dirname,_0x9974('0x1d'));var _0x53e54b=_0x3e591b[_0x9974('0x1e')];var _0x1cc3f6=util[_0x9974('0x15')](_0x9974('0x1f'),path[_0x9974('0x20')](_0x3e591b[_0x9974('0x1e')],path[_0x9974('0x21')](_0x3e591b[_0x9974('0x1e')])),'zip');var _0x38d5f1=path['join'](_0x276846,_0x53e54b);var _0x112e0d=path[_0x9974('0x1c')](_0x276846,_0x1cc3f6);if(fs['existsSync'](_0x38d5f1)){_0x3e591b['status']=_0x9974('0x22');_0x3b6407[_0x9974('0x23')][_0x9974('0x24')]=[{'filename':_0x53e54b,'path':_0x38d5f1}];_0x3b6407['message'][_0x9974('0x25')]=util['format'](_0x9974('0x26'),JSON[_0x9974('0x27')](_0x3e591b,null,0x2));}else if(fs['existsSync'](_0x112e0d)){_0x3e591b[_0x9974('0x28')]=_0x9974('0x22');_0x3b6407[_0x9974('0x23')][_0x9974('0x24')]=[{'filename':_0x1cc3f6,'path':_0x112e0d}];}else{if(_0x3e591b[_0x9974('0x28')]===_0x9974('0x29')){_0x3b6407[_0x9974('0x23')][_0x9974('0x25')]=_0x9974('0x2a');if(!_0x78340e[_0x9974('0x2b')]){_0x10eebf=![];logger['info'](_0x9974('0x2c'));}}else if(_0x3e591b[_0x9974('0x28')]===_0x9974('0x2d')){_0x3b6407[_0x9974('0x23')]['text']=_0x9974('0x2e');}else if(_0x3e591b[_0x9974('0x28')]===_0x9974('0x2f')){_0x3b6407[_0x9974('0x23')][_0x9974('0x25')]=_0x9974('0x30');}else if(_0x3e591b['status']===_0x9974('0x31')){_0x3b6407['message'][_0x9974('0x25')]='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';}else{logger[_0x9974('0x10')](_0x9974('0x32'),_0x3e591b[_0x9974('0x28')]);}}if(_0x10eebf){return client['request'](_0x9974('0x33'),_0x3b6407)[_0x9974('0x34')](function(_0x243393){if(_0x243393['error']){return logger[_0x9974('0x10')](_0x9974('0x35'),JSON[_0x9974('0x27')](_0x243393));}return logger[_0x9974('0x36')](_0x9974('0x37'));})[_0x9974('0xf')](function(_0x38dbde){return logger['error'](_0x9974('0x35'),JSON[_0x9974('0x27')](_0x38dbde));});}}function handleError(){return function(_0x8ea5f0){return logger['error'](JSON[_0x9974('0x27')](_0x8ea5f0));};}function loading(_0x442683){logger[_0x9974('0x36')]('case\x20loading');if(_0x442683[_0x9974('0x38')]===_0x442683[_0x9974('0x39')][_0x9974('0x3a')]){handleSendEmail(_0x442683[_0x9974('0x3b')],_0x442683[_0x9974('0x3c')]);_0x442683[_0x9974('0x3d')]['stop']();}else{_0x442683[_0x9974('0x3d')][_0x9974('0x8')](_0x9974('0x3e'));}}function completed(_0x2b4027){logger[_0x9974('0x36')](_0x9974('0x3f'));handleSendEmail(_0x2b4027['job'],_0x2b4027[_0x9974('0x3c')]);_0x2b4027[_0x9974('0x3d')][_0x9974('0x40')]();}function empty(_0x60131e){logger[_0x9974('0x36')](_0x9974('0x41'));handleSendEmail(_0x60131e[_0x9974('0x3b')],_0x60131e[_0x9974('0x3c')]);_0x60131e[_0x9974('0x3d')][_0x9974('0x40')]();}function failed(_0x84891f){logger[_0x9974('0x36')]('case\x20failed');handleSendEmail(_0x84891f[_0x9974('0x3b')],_0x84891f[_0x9974('0x3c')]);_0x84891f[_0x9974('0x3d')][_0x9974('0x40')]();}function urecognized(_0x3b96e1){logger['error'](_0x9974('0x42'),_0x3b96e1[_0x9974('0x43')][_0x9974('0x44')][_0x9974('0x28')]);_0x3b96e1[_0x9974('0x3d')][_0x9974('0x40')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x56914f,_0x66e17b){const _0xf0795d={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xe574b0=retry[_0x9974('0x3d')](_0xf0795d);_0xe574b0[_0x9974('0x45')](_0x32dbc2=>{logger[_0x9974('0x36')]('Job\x20ID\x20'+_0x56914f['id']+'\x20Attempt\x20#:'+_0x32dbc2);try{getReportData(_0x66e17b['id'])[_0x9974('0x34')](function(_0x452e0a){_0x66e17b=_0x452e0a;logger[_0x9974('0x36')](_0x9974('0x46'),_0x452e0a['dataValues'][_0x9974('0x28')]);if(!reportStatusStrategies[_0x452e0a[_0x9974('0x44')][_0x9974('0x28')]]){logger[_0x9974('0x10')](_0x9974('0x46'),_0x452e0a[_0x9974('0x44')][_0x9974('0x28')]);_0xe574b0[_0x9974('0x8')]();}reportStatusStrategies[_0x452e0a[_0x9974('0x44')]['status']]({'operation':_0xe574b0,'currentAttempt':_0x32dbc2,'retryOptions':_0xf0795d,'job':_0x56914f,'data':_0x66e17b,'entity':_0x452e0a});});}catch(_0x360c78){_0xe574b0[_0x9974('0x8')](_0x360c78);}});}function handleResult(_0x4a7fd3){return function(_0x29e3eb){if(_0x4a7fd3[_0x9974('0x47')]&&_0x4a7fd3[_0x9974('0x13')]&&_0x4a7fd3[_0x9974('0x13')][_0x9974('0x17')]&&!_[_0x9974('0x48')](_0x4a7fd3['email'])){retryer(_0x4a7fd3,_0x29e3eb);}};}function handleJob(_0x54de2d){return function(){try{if(_[_0x9974('0x48')](_0x54de2d[_0x9974('0x1b')])){return logger[_0x9974('0x36')](_0x9974('0x49'));}if(_[_0x9974('0x48')](_0x54de2d['subtractUnit'])){return logger[_0x9974('0x36')](_0x9974('0x4a'));}var _0x296360={'startDate':moment()[_0x9974('0x4b')](_0x54de2d['subtractNumber'],_0x54de2d[_0x9974('0x4c')])[_0x9974('0x15')](_0x9974('0x4d')),'endDate':moment()[_0x9974('0x15')](_0x9974('0x4d')),'type':_0x9974('0x4e'),'output':_0x54de2d[_0x9974('0x4f')],'name':_0x54de2d[_0x9974('0x16')]};if(!_[_0x9974('0x48')](_0x54de2d['DefaultReportId'])){logger[_0x9974('0x36')]('exec\x20defaul\x20report\x20id:%s',_0x54de2d[_0x9974('0x50')]);return analyticDefaultReportController[_0x9974('0x51')]({'id':_0x54de2d[_0x9974('0x50')]},_0x296360)[_0x9974('0x34')](handleResult(_0x54de2d))['catch'](handleError());}if(!_[_0x9974('0x48')](_0x54de2d['CustomReportId'])){logger[_0x9974('0x36')](_0x9974('0x52'),_0x54de2d[_0x9974('0x53')]);return analyticCustomReportController[_0x9974('0x51')]({'id':_0x54de2d[_0x9974('0x53')]},_0x296360)['then'](handleResult(_0x54de2d))[_0x9974('0xf')](handleError());}}catch(_0x5cec53){logger[_0x9974('0x10')](JSON[_0x9974('0x27')](_0x5cec53));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x262ebb){var _0x5b7a7f={};if(_0x262ebb){_0x5b7a7f['id']=_0x262ebb;}return db[_0x9974('0x54')]['findAll']({'where':_0x5b7a7f,'include':[{'model':db[_0x9974('0x13')],'attributes':['id',_0x9974('0x16'),_0x9974('0x12')],'include':[{'model':db[_0x9974('0x55')],'as':'Smtp','include':[{'model':db[_0x9974('0x56')],'as':_0x9974('0x56')}]}]}]})['then'](function(_0x28a859){var _0x44f3be=_['keys'](manager[_0x9974('0x57')]);var _0x2cbf5b=_[_0x9974('0x58')](_0x28a859,function(_0x138e92){return _0x138e92['id']['toString']();});var _0x44d987=_[_0x9974('0x59')](_0x28a859,function(_0x453162){return _0x453162['id'][_0x9974('0x5a')]();});var _0x552228=_0x262ebb?_0x2cbf5b:_[_0x9974('0x5b')](_0x2cbf5b,_0x44f3be);var _0x52c18f=_[_0x9974('0x5c')](_0x2cbf5b,_0x44f3be);var _0x2e11bd=_[_0x9974('0x5b')](_0x44f3be,_0x2cbf5b);var _0x49c88f;var _0x352e5f;for(_0x49c88f=0x0;_0x49c88f<_0x2e11bd[_0x9974('0x5d')]&&!_0x262ebb;_0x49c88f+=0x1){_0x352e5f=_0x2e11bd[_0x49c88f][_0x9974('0x5a')]();if(manager[_0x9974('0x5e')](_0x352e5f)){manager[_0x9974('0x40')](_0x352e5f);manager[_0x9974('0x5f')](_0x352e5f);logger[_0x9974('0x36')](_0x9974('0x60'),_0x352e5f);}}logger[_0x9974('0x36')]('toRun',JSON[_0x9974('0x27')](_0x552228));for(_0x49c88f=0x0;_0x49c88f<_0x552228[_0x9974('0x5d')];_0x49c88f+=0x1){_0x352e5f=_0x552228[_0x49c88f][_0x9974('0x5a')]();if(_0x262ebb){logger[_0x9974('0x36')](JSON[_0x9974('0x27')](_0x44d987[_0x352e5f]));BPromise[_0x9974('0x61')]()['then'](handleJob(_0x44d987[_0x352e5f]));logger['info'](_0x9974('0x62'),_0x44d987[_0x352e5f][_0x9974('0x16')],_0x44d987[_0x352e5f][_0x9974('0x63')]);}else if(_0x44d987[_0x352e5f][_0x9974('0x63')]&&_0x44d987[_0x352e5f][_0x9974('0x64')]&&moment()[_0x9974('0x65')](_0x44d987[_0x352e5f][_0x9974('0x66')],_0x44d987[_0x352e5f][_0x9974('0x67')])){manager[_0x9974('0x68')](_0x352e5f,_0x44d987[_0x352e5f][_0x9974('0x63')],handleJob(_0x44d987[_0x352e5f]));manager[_0x9974('0x69')](_0x352e5f);logger[_0x9974('0x36')](_0x9974('0x6a'),_0x44d987[_0x352e5f][_0x9974('0x16')],_0x44d987[_0x352e5f][_0x9974('0x63')]);}else if(manager['exists'](_0x352e5f)){manager['stop'](_0x352e5f);manager['deleteJob'](_0x352e5f);logger['info'](_0x9974('0x6b'),_0x44d987[_0x352e5f][_0x9974('0x16')],_0x44d987[_0x352e5f][_0x9974('0x63')]);}}for(_0x49c88f=0x0,_0x352e5f;_0x49c88f<_0x52c18f['length']&&!_0x262ebb;_0x49c88f+=0x1){_0x352e5f=_0x52c18f[_0x49c88f][_0x9974('0x5a')]();if(manager[_0x9974('0x5e')](_0x352e5f)){if(_0x44d987[_0x352e5f][_0x9974('0x63')]&&_0x44d987[_0x352e5f][_0x9974('0x64')]&&moment()[_0x9974('0x65')](_0x44d987[_0x352e5f][_0x9974('0x66')],_0x44d987[_0x352e5f][_0x9974('0x67')])){manager[_0x9974('0x6c')](_0x352e5f,_0x44d987[_0x352e5f][_0x9974('0x63')],handleJob(_0x44d987[_0x352e5f]));logger[_0x9974('0x36')]('update\x20cron',_0x44d987[_0x352e5f][_0x9974('0x16')],_0x44d987[_0x352e5f][_0x9974('0x63')]);}else{manager[_0x9974('0x40')](_0x352e5f);manager['deleteJob'](_0x352e5f);logger[_0x9974('0x36')]('stop\x20cron',_0x44d987[_0x352e5f][_0x9974('0x16')],_0x44d987[_0x352e5f]['cron']);}}}})[_0x9974('0xf')](function(_0x5d8abf){logger[_0x9974('0x10')](JSON[_0x9974('0x27')](_0x5d8abf));});}exports[_0x9974('0x6d')]=function(_0x2f99bd){return getJobs(_0x2f99bd);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9842=['error\x20mail','currentAttempt','retryOptions','retries','job','operation','case\x20completed','data','stop','case\x20empty','case\x20failed','entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','MailServerOut','CloudProvider','jobs','map','toString','intersection','difference','length','deleteJob','delete\x20cron','resolve','isBetween','startAt','add','cron','start','stop\x20cron','exists','active','endAt','update','update\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','then','catch','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','zip','existsSync','status','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Empty','message','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','info','email\x20sent'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x9842,0x1f2));var _0x2984=function(_0x4d6601,_0x4b0b22){_0x4d6601=_0x4d6601-0x0;var _0x2d0e52=_0x9842[_0x4d6601];return _0x2d0e52;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x2984('0x0'));var _=require(_0x2984('0x1'));var moment=require(_0x2984('0x2'));var CronJobManager=require(_0x2984('0x3'));var jayson=require(_0x2984('0x4'));var BPromise=require(_0x2984('0x5'));var logger=require(_0x2984('0x6'))('schedule');var db=require(_0x2984('0x7'))['db'];const retry=require(_0x2984('0x8'));var analyticCustomReportController=require(_0x2984('0x9'));var analyticDefaultReportController=require(_0x2984('0xa'));var client=jayson[_0x2984('0xb')][_0x2984('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x436444){const _0xfd819f={};if(typeof _0x436444===_0x2984('0xd')){_0xfd819f['id']=_0x436444;}return db[_0x2984('0xe')]['findOne']({'where':_0xfd819f})[_0x2984('0xf')](function(_0x2bd3e7){return _0x2bd3e7;})[_0x2984('0x10')](function(_0x4b7fb4){logger['error'](_0x4b7fb4);});}function handleSendEmail(_0x2d2c92,_0x2be692){logger['info'](_0x2984('0x11'),_0x2d2c92[_0x2984('0x12')]);var _0x162552=!![];var _0x7d8e97=_0x2d2c92['MailAccount'][_0x2984('0x13')]();var _0x2ebec4={'account':_0x7d8e97,'message':{'from':util[_0x2984('0x14')](_0x2984('0x15'),_0x2d2c92['MailAccount']['name'],_0x2d2c92[_0x2984('0x16')]['email']||_0x2d2c92[_0x2984('0x16')][_0x2984('0x17')]['user']),'to':_0x2d2c92['email'],'cc':_0x2d2c92['cc'],'bcc':_0x2d2c92[_0x2984('0x18')],'subject':util[_0x2984('0x14')](_0x2984('0x19'),_0x2be692['name'],_0x2d2c92[_0x2984('0x1a')],_0x2d2c92[_0x2984('0x1b')])}};var _0x5920bf=path[_0x2984('0x1c')](__dirname,'../../files/reports');var _0x370728=_0x2be692[_0x2984('0x1d')];var _0x4629fb=util[_0x2984('0x14')](_0x2984('0x1e'),path[_0x2984('0x1f')](_0x2be692[_0x2984('0x1d')],path['extname'](_0x2be692['savename'])),_0x2984('0x20'));var _0x3d18e8=path['join'](_0x5920bf,_0x370728);var _0x1679d1=path['join'](_0x5920bf,_0x4629fb);if(fs[_0x2984('0x21')](_0x3d18e8)){_0x2be692[_0x2984('0x22')]=_0x2984('0x23');_0x2ebec4['message'][_0x2984('0x24')]=[{'filename':_0x370728,'path':_0x3d18e8}];_0x2ebec4['message'][_0x2984('0x25')]=util[_0x2984('0x14')](_0x2984('0x26'),JSON[_0x2984('0x27')](_0x2be692,null,0x2));}else if(fs[_0x2984('0x21')](_0x1679d1)){_0x2be692['status']='Sent';_0x2ebec4['message'][_0x2984('0x24')]=[{'filename':_0x4629fb,'path':_0x1679d1}];}else{if(_0x2be692[_0x2984('0x22')]===_0x2984('0x28')){_0x2ebec4[_0x2984('0x29')][_0x2984('0x25')]=_0x2984('0x2a');if(!_0x2d2c92[_0x2984('0x2b')]){_0x162552=![];logger['info'](_0x2984('0x2c'));}}else if(_0x2be692[_0x2984('0x22')]===_0x2984('0x2d')){_0x2ebec4['message'][_0x2984('0x25')]=_0x2984('0x2e');}else if(_0x2be692[_0x2984('0x22')]===_0x2984('0x2f')){_0x2ebec4['message']['text']=_0x2984('0x30');}else if(_0x2be692['status']===_0x2984('0x31')){_0x2ebec4[_0x2984('0x29')]['text']=_0x2984('0x32');}else{logger[_0x2984('0x33')](_0x2984('0x34'),_0x2be692[_0x2984('0x22')]);}}if(_0x162552){return client[_0x2984('0x35')](_0x2984('0x36'),_0x2ebec4)[_0x2984('0xf')](function(_0x4ca3b4){if(_0x4ca3b4[_0x2984('0x33')]){return logger[_0x2984('0x33')]('error\x20mail',JSON['stringify'](_0x4ca3b4));}return logger[_0x2984('0x37')](_0x2984('0x38'));})['catch'](function(_0x166f2b){return logger['error'](_0x2984('0x39'),JSON[_0x2984('0x27')](_0x166f2b));});}}function handleError(){return function(_0x1a9a5a){return logger[_0x2984('0x33')](JSON[_0x2984('0x27')](_0x1a9a5a));};}function loading(_0x48e1f7){logger[_0x2984('0x37')]('case\x20loading');if(_0x48e1f7[_0x2984('0x3a')]===_0x48e1f7[_0x2984('0x3b')][_0x2984('0x3c')]){handleSendEmail(_0x48e1f7[_0x2984('0x3d')],_0x48e1f7['data']);_0x48e1f7[_0x2984('0x3e')]['stop']();}else{_0x48e1f7[_0x2984('0x3e')][_0x2984('0x8')]('still\x20loading');}}function completed(_0x443e4b){logger[_0x2984('0x37')](_0x2984('0x3f'));handleSendEmail(_0x443e4b[_0x2984('0x3d')],_0x443e4b[_0x2984('0x40')]);_0x443e4b[_0x2984('0x3e')][_0x2984('0x41')]();}function empty(_0x575d5b){logger[_0x2984('0x37')](_0x2984('0x42'));handleSendEmail(_0x575d5b[_0x2984('0x3d')],_0x575d5b[_0x2984('0x40')]);_0x575d5b[_0x2984('0x3e')][_0x2984('0x41')]();}function failed(_0x219b4c){logger['info'](_0x2984('0x43'));handleSendEmail(_0x219b4c['job'],_0x219b4c[_0x2984('0x40')]);_0x219b4c[_0x2984('0x3e')][_0x2984('0x41')]();}function urecognized(_0x437ec0){logger[_0x2984('0x33')]('Unrecognized\x20status:',_0x437ec0[_0x2984('0x44')]['dataValues'][_0x2984('0x22')]);_0x437ec0['operation'][_0x2984('0x41')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x486760,_0x2ee07c){const _0x3a05b2={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x500634=retry['operation'](_0x3a05b2);_0x500634[_0x2984('0x45')](_0xd26104=>{logger[_0x2984('0x37')](_0x2984('0x46')+_0x486760['id']+_0x2984('0x47')+_0xd26104);try{getReportData(_0x2ee07c['id'])[_0x2984('0xf')](function(_0x2aeb0f){_0x2ee07c=_0x2aeb0f;logger['info'](_0x2984('0x48'),_0x2aeb0f['dataValues'][_0x2984('0x22')]);if(!reportStatusStrategies[_0x2aeb0f[_0x2984('0x49')][_0x2984('0x22')]]){logger[_0x2984('0x33')]('report\x20status:',_0x2aeb0f['dataValues']['status']);_0x500634[_0x2984('0x8')]();}reportStatusStrategies[_0x2aeb0f['dataValues'][_0x2984('0x22')]]({'operation':_0x500634,'currentAttempt':_0xd26104,'retryOptions':_0x3a05b2,'job':_0x486760,'data':_0x2ee07c,'entity':_0x2aeb0f});});}catch(_0x21e75f){_0x500634[_0x2984('0x8')](_0x21e75f);}});}function handleResult(_0x418e91){return function(_0x25a07a){if(_0x418e91[_0x2984('0x4a')]&&_0x418e91[_0x2984('0x16')]&&_0x418e91[_0x2984('0x16')]['Smtp']&&!_[_0x2984('0x4b')](_0x418e91['email'])){retryer(_0x418e91,_0x25a07a);}};}function handleJob(_0x81b3de){return function(){try{if(_[_0x2984('0x4b')](_0x81b3de[_0x2984('0x1a')])){return logger['info'](_0x2984('0x4c'));}if(_['isNil'](_0x81b3de[_0x2984('0x1b')])){return logger['info'](_0x2984('0x4d'));}var _0x7e5213={'startDate':moment()[_0x2984('0x4e')](_0x81b3de[_0x2984('0x1a')],_0x81b3de['subtractUnit'])[_0x2984('0x14')](_0x2984('0x4f')),'endDate':moment()[_0x2984('0x14')](_0x2984('0x4f')),'type':_0x2984('0x50'),'output':_0x81b3de[_0x2984('0x51')],'name':_0x81b3de[_0x2984('0x52')]};if(!_[_0x2984('0x4b')](_0x81b3de['DefaultReportId'])){logger[_0x2984('0x37')](_0x2984('0x53'),_0x81b3de['DefaultReportId']);return analyticDefaultReportController[_0x2984('0x54')]({'id':_0x81b3de[_0x2984('0x55')]},_0x7e5213)['then'](handleResult(_0x81b3de))[_0x2984('0x10')](handleError());}if(!_[_0x2984('0x4b')](_0x81b3de['CustomReportId'])){logger[_0x2984('0x37')](_0x2984('0x56'),_0x81b3de[_0x2984('0x57')]);return analyticCustomReportController[_0x2984('0x54')]({'id':_0x81b3de['CustomReportId']},_0x7e5213)[_0x2984('0xf')](handleResult(_0x81b3de))[_0x2984('0x10')](handleError());}}catch(_0x3fb13a){logger[_0x2984('0x33')](JSON[_0x2984('0x27')](_0x3fb13a));}return logger[_0x2984('0x37')]('no\x20report\x20id');};}function getJobs(_0x2c526d){var _0x5e1cb7={};if(_0x2c526d){_0x5e1cb7['id']=_0x2c526d;}return db[_0x2984('0x58')]['findAll']({'where':_0x5e1cb7,'include':[{'model':db[_0x2984('0x16')],'attributes':['id',_0x2984('0x52'),_0x2984('0x12')],'include':[{'model':db[_0x2984('0x59')],'as':_0x2984('0x17'),'include':[{'model':db[_0x2984('0x5a')],'as':_0x2984('0x5a')}]}]}]})[_0x2984('0xf')](function(_0xcad43a){var _0x129fbf=_['keys'](manager[_0x2984('0x5b')]);var _0x2b52b9=_[_0x2984('0x5c')](_0xcad43a,function(_0x39c5e6){return _0x39c5e6['id'][_0x2984('0x5d')]();});var _0x2238d8=_['keyBy'](_0xcad43a,function(_0x1d87e8){return _0x1d87e8['id'][_0x2984('0x5d')]();});var _0x5b3640=_0x2c526d?_0x2b52b9:_['difference'](_0x2b52b9,_0x129fbf);var _0x1fe1a9=_[_0x2984('0x5e')](_0x2b52b9,_0x129fbf);var _0x2f128e=_[_0x2984('0x5f')](_0x129fbf,_0x2b52b9);var _0x3808cd;var _0x2e2a29;for(_0x3808cd=0x0;_0x3808cd<_0x2f128e[_0x2984('0x60')]&&!_0x2c526d;_0x3808cd+=0x1){_0x2e2a29=_0x2f128e[_0x3808cd][_0x2984('0x5d')]();if(manager['exists'](_0x2e2a29)){manager[_0x2984('0x41')](_0x2e2a29);manager[_0x2984('0x61')](_0x2e2a29);logger[_0x2984('0x37')](_0x2984('0x62'),_0x2e2a29);}}logger['info']('toRun',JSON[_0x2984('0x27')](_0x5b3640));for(_0x3808cd=0x0;_0x3808cd<_0x5b3640[_0x2984('0x60')];_0x3808cd+=0x1){_0x2e2a29=_0x5b3640[_0x3808cd][_0x2984('0x5d')]();if(_0x2c526d){logger[_0x2984('0x37')](JSON[_0x2984('0x27')](_0x2238d8[_0x2e2a29]));BPromise[_0x2984('0x63')]()[_0x2984('0xf')](handleJob(_0x2238d8[_0x2e2a29]));logger['info']('run\x20job',_0x2238d8[_0x2e2a29][_0x2984('0x52')],_0x2238d8[_0x2e2a29]['cron']);}else if(_0x2238d8[_0x2e2a29]['cron']&&_0x2238d8[_0x2e2a29]['active']&&moment()[_0x2984('0x64')](_0x2238d8[_0x2e2a29][_0x2984('0x65')],_0x2238d8[_0x2e2a29]['endAt'])){manager[_0x2984('0x66')](_0x2e2a29,_0x2238d8[_0x2e2a29][_0x2984('0x67')],handleJob(_0x2238d8[_0x2e2a29]));manager[_0x2984('0x68')](_0x2e2a29);logger[_0x2984('0x37')]('add\x20cron',_0x2238d8[_0x2e2a29][_0x2984('0x52')],_0x2238d8[_0x2e2a29][_0x2984('0x67')]);}else if(manager['exists'](_0x2e2a29)){manager['stop'](_0x2e2a29);manager[_0x2984('0x61')](_0x2e2a29);logger[_0x2984('0x37')](_0x2984('0x69'),_0x2238d8[_0x2e2a29]['name'],_0x2238d8[_0x2e2a29][_0x2984('0x67')]);}}for(_0x3808cd=0x0,_0x2e2a29;_0x3808cd<_0x1fe1a9[_0x2984('0x60')]&&!_0x2c526d;_0x3808cd+=0x1){_0x2e2a29=_0x1fe1a9[_0x3808cd][_0x2984('0x5d')]();if(manager[_0x2984('0x6a')](_0x2e2a29)){if(_0x2238d8[_0x2e2a29]['cron']&&_0x2238d8[_0x2e2a29][_0x2984('0x6b')]&&moment()[_0x2984('0x64')](_0x2238d8[_0x2e2a29][_0x2984('0x65')],_0x2238d8[_0x2e2a29][_0x2984('0x6c')])){manager[_0x2984('0x6d')](_0x2e2a29,_0x2238d8[_0x2e2a29][_0x2984('0x67')],handleJob(_0x2238d8[_0x2e2a29]));logger[_0x2984('0x37')](_0x2984('0x6e'),_0x2238d8[_0x2e2a29][_0x2984('0x52')],_0x2238d8[_0x2e2a29][_0x2984('0x67')]);}else{manager[_0x2984('0x41')](_0x2e2a29);manager[_0x2984('0x61')](_0x2e2a29);logger['info'](_0x2984('0x69'),_0x2238d8[_0x2e2a29][_0x2984('0x52')],_0x2238d8[_0x2e2a29][_0x2984('0x67')]);}}}})[_0x2984('0x10')](function(_0x464697){logger[_0x2984('0x33')](JSON[_0x2984('0x27')](_0x464697));});}exports['run']=function(_0x4fa592){return getJobs(_0x4fa592);};exports[_0x2984('0x68')]=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 df5daa7..5fd303d 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 _0x8721=['No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','ValidationError','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS'];(function(_0x3c16e6,_0x110ffc){var _0x27fb33=function(_0x1eeac2){while(--_0x1eeac2){_0x3c16e6['push'](_0x3c16e6['shift']());}};_0x27fb33(++_0x110ffc);}(_0x8721,0xd9));var _0x1872=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x8721[_0x10df18];return _0x1f9a1d;};var _=require(_0x1872('0x0'));var AWS=require(_0x1872('0x1'));var rp=require(_0x1872('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x1872('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x50a1c5,_0x40690e,_0x1cd36f,_0x3678b3){return new Promise(function(_0x47ca3a,_0x4befaf){var _0x2dc064=new AWS[(_0x1872('0x4'))]({'accessKeyId':_0x40690e,'secretAccessKey':_0x50a1c5,'region':_0x1cd36f});_0x2dc064[_0x1872('0x5')]({'TranscriptionJobName':_0x3678b3},function(_0x4d019e,_0x2aaad6){if(_0x4d019e){return _0x4befaf(_0x4d019e);}else{return _0x47ca3a(_0x2aaad6);}});});}function sentiment(_0x2c2f41,_0x3fe445,_0x2c2b48,_0x1f43c6,_0x1b057e){return new Promise(function(_0x120590,_0x1c18fc){var _0x406daf=new AWS[(_0x1872('0x6'))]({'accessKeyId':_0x3fe445,'secretAccessKey':_0x2c2f41,'region':_0x2c2b48});_0x406daf[_0x1872('0x7')]({'Text':_0x1f43c6,'LanguageCode':_0x1b057e['substring'](0x0,0x2)},function(_0x15a121,_0x392b65){if(_0x15a121){return _0x1c18fc(_0x15a121);}else{return _0x120590(_0x392b65);}});});}function checkTranscribeJob(_0xb6951b,_0x4345d0,_0x5122df){var _0x412663;return new BPromise(function(_0x1a8e90,_0x12ad66){logger[_0x1872('0x8')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xb6951b['id'],_0xb6951b[_0x1872('0x9')]));return getTranscriptionJob(_0x5122df[_0x1872('0xa')],_0x5122df[_0x1872('0xb')],_0x4345d0[_0x1872('0xc')],_0xb6951b[_0x1872('0x9')])[_0x1872('0xd')](function(_0x4be58a){logger['info'](util[_0x1872('0xe')](_0x1872('0xf'),_0xb6951b['id'],_0xb6951b[_0x1872('0x9')],_0x4be58a['TranscriptionJob'][_0x1872('0x10')]));if(!_0xb6951b['fileText']){switch(_0x4be58a[_0x1872('0x11')][_0x1872('0x10')]){case _0x1872('0x12'):var _0x4d1f11={'transcribeStatus':_0x4be58a[_0x1872('0x11')]['TranscriptionJobStatus'],'fileUri':_0x4be58a[_0x1872('0x11')][_0x1872('0x13')][_0x1872('0x14')]};logger[_0x1872('0x8')](util[_0x1872('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0xb6951b['id']));return rp({'uri':_0x4be58a[_0x1872('0x11')][_0x1872('0x13')][_0x1872('0x14')],'json':!![]})[_0x1872('0xd')](function(_0xcc4221){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x15'),_0xb6951b['id']));if(_0xcc4221&&_0xcc4221[_0x1872('0x16')]&&_0xcc4221['results']['transcripts']&&_0xcc4221['results'][_0x1872('0x17')][_0x1872('0x18')]){_0x4d1f11[_0x1872('0x19')]='';for(var _0x32499a=0x0;_0x32499a<_0xcc4221['results'][_0x1872('0x17')][_0x1872('0x18')];_0x32499a++){_0x4d1f11[_0x1872('0x19')]+=_0xcc4221['results'][_0x1872('0x17')][_0x32499a]['transcript']+'';}}return _0xb6951b[_0x1872('0x1a')](_0x4d1f11);})[_0x1872('0xd')](function(){logger[_0x1872('0x8')](util['format'](_0x1872('0x1b'),_0xb6951b['id']));if(!_0xb6951b[_0x1872('0x1c')]){throw new db['Sequelize']['ValidationError'](_0x1872('0x1d'));}if(!_0x4345d0['sentiment']||!_0x4345d0['sentimentAccountId']||!_0x4345d0[_0x1872('0x1e')]||!_0x4345d0['language']||!_0x4345d0[_0x1872('0x1f')]){throw new db[(_0x1872('0x20'))]['ValidationError'](_0x1872('0x21'));}if(!_0x4d1f11[_0x1872('0x19')]){throw new Error(_0x1872('0x22'));}if(_0x4345d0['sentimentAccountId']===_0x5122df['id']){return _0x5122df;}else{return db[_0x1872('0x23')][_0x1872('0x24')]({'where':{'id':_settings[_0x1872('0x25')]}});}})[_0x1872('0xd')](function(_0x372f7b){if(!_0x372f7b){throw new db['Sequelize'][(_0x1872('0x26'))](_0x1872('0x27'));}if(!_0x372f7b[_0x1872('0xa')]||!_0x372f7b[_0x1872('0xb')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x412663=_0x372f7b;logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x28'),_0xb6951b['id']));return sentiment(_0x412663[_0x1872('0xa')],_0x412663[_0x1872('0xb')],_0x4345d0[_0x1872('0x1e')],_0x4d1f11[_0x1872('0x19')],_0x4345d0[_0x1872('0x29')]);})['then'](function(_0x4a8c86){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x2a'),_0xb6951b['id']));return _0xb6951b[_0x1872('0x1a')]({'sentiment':_0x4a8c86[_0x1872('0x2b')],'sPositive':_0x4a8c86[_0x1872('0x2c')]['Positive'],'sNegative':_0x4a8c86[_0x1872('0x2c')][_0x1872('0x2d')],'sMixed':_0x4a8c86['SentimentScore']['Mixed'],'sNeutral':_0x4a8c86['SentimentScore'][_0x1872('0x2e')]});})[_0x1872('0xd')](function(){logger[_0x1872('0x8')](util['format'](_0x1872('0x1b'),_0xb6951b['id']));_0x1a8e90();});case _0x1872('0x2f'):return _0xb6951b[_0x1872('0x1a')]({'transcribeStatus':_0x1872('0x2f'),'failureReason':_0x4be58a[_0x1872('0x11')][_0x1872('0x30')]})['then'](function(){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x1b'),_0xb6951b['id']));_0x1a8e90();});default:logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x31'),_0xb6951b['id']));break;}}else{return BPromise[_0x1872('0x32')]()[_0x1872('0xd')](function(){if(!_0xb6951b['tempSentiment']){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))](_0x1872('0x1d'));}if(!_0x4345d0['sentiment']||!_0x4345d0[_0x1872('0x25')]||!_0x4345d0[_0x1872('0x1e')]||!_0x4345d0['language']||!_0x4345d0[_0x1872('0x1f')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))](_0x1872('0x21'));}if(!_0xb6951b[_0x1872('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x4345d0[_0x1872('0x25')]===_0x5122df['id']){return _0x5122df;}else{return db[_0x1872('0x23')][_0x1872('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x1872('0xd')](function(_0x1df449){if(!_0x1df449){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))](_0x1872('0x27'));}if(!_0x1df449[_0x1872('0xa')]||!_0x1df449[_0x1872('0xb')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x412663=_0x1df449;logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x28'),_0xb6951b['id']));return sentiment(_0x412663[_0x1872('0xa')],_0x412663[_0x1872('0xb')],_0x4345d0[_0x1872('0x1e')],_0xb6951b[_0x1872('0x19')],_0x4345d0['language']);})['then'](function(_0x42618f){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x2a'),_0xb6951b['id']));return _0xb6951b['update']({'sentiment':_0x42618f['Sentiment'],'sPositive':_0x42618f['SentimentScore']['Positive'],'sNegative':_0x42618f[_0x1872('0x2c')]['Negative'],'sMixed':_0x42618f[_0x1872('0x2c')][_0x1872('0x33')],'sNeutral':_0x42618f['SentimentScore'][_0x1872('0x2e')],'transcribeStatus':_0x1872('0x12')});})['then'](function(){logger[_0x1872('0x8')](util[_0x1872('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xb6951b['id']));_0x1a8e90();});}})[_0x1872('0x34')](function(_0x41042b){if(_0x41042b){if(!_0x41042b[_0x1872('0x35')]||_0x41042b[_0x1872('0x35')]!==_0x1872('0x36')){logger[_0x1872('0x37')](util[_0x1872('0xe')](_0x1872('0x38'),_0xb6951b['id']),util['inspect'](_0x41042b,{'showHidden':![],'depth':null}));}}_0x1a8e90();});});}function checkTranscribe(){var _0x5b7f62;var _0x8c015;var _0x1b555f;return db[_0x1872('0x39')]['findAll']({'where':{'transcribeStatus':_0x1872('0x3a')}})[_0x1872('0xd')](function(_0x8a4098){if(!_0x8a4098||!_0x8a4098[_0x1872('0x18')]){throw new db[(_0x1872('0x20'))]['ValidationError'](_0x1872('0x3b'));}_0x5b7f62=_0x8a4098;return db[_0x1872('0x3c')][_0x1872('0x24')]({'where':{'id':0x1}});})[_0x1872('0xd')](function(_0x3fc8c2){if(!_0x3fc8c2){throw new db['Sequelize'][(_0x1872('0x26'))](_0x1872('0x3d'));}_0x8c015=_0x3fc8c2;if(!_0x8c015[_0x1872('0x3e')]||!_0x8c015[_0x1872('0x3f')]||!_0x8c015[_0x1872('0xc')]||!_0x8c015[_0x1872('0x29')]||!_0x8c015[_0x1872('0x1f')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Transcribe\x20not\x20configured');}return db[_0x1872('0x23')][_0x1872('0x24')]({'where':{'id':_0x8c015[_0x1872('0x3f')]}});})[_0x1872('0xd')](function(_0x340570){if(!_0x340570){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x340570['data1']||!_0x340570[_0x1872('0xb')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x1b555f=_0x340570;var _0x25004c=[];_0x5b7f62[_0x1872('0x40')](function(_0xd33499){_0x25004c[_0x1872('0x41')](checkTranscribeJob(_0xd33499,_0x8c015,_0x1b555f));});return BPromise[_0x1872('0x42')](_0x25004c);})[_0x1872('0x34')](function(_0x1614de){if(_0x1614de){if(!_0x1614de[_0x1872('0x35')]||_0x1614de['name']!==_0x1872('0x36')){logger['error'](util[_0x1872('0x43')](_0x1614de,{'showHidden':![],'depth':null}));}}});}exports[_0x1872('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe0c0=['name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','error','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x38852f,_0x492996){_0x38852f=_0x38852f-0x0;var _0x5f7075=_0xe0c0[_0x38852f];return _0x5f7075;};var _=require(_0x0e0c('0x0'));var AWS=require('aws-sdk');var rp=require(_0x0e0c('0x1'));var util=require(_0x0e0c('0x2'));var BPromise=require(_0x0e0c('0x3'));var db=require(_0x0e0c('0x4'))['db'];var logger=require('../../config/logger')(_0x0e0c('0x5'));function getTranscriptionJob(_0x289810,_0x373046,_0x54c73b,_0x4271d1){return new Promise(function(_0x2856d7,_0x4a094c){var _0x14e5de=new AWS[(_0x0e0c('0x6'))]({'accessKeyId':_0x373046,'secretAccessKey':_0x289810,'region':_0x54c73b});_0x14e5de[_0x0e0c('0x7')]({'TranscriptionJobName':_0x4271d1},function(_0x13e45d,_0xe3ccce){if(_0x13e45d){return _0x4a094c(_0x13e45d);}else{return _0x2856d7(_0xe3ccce);}});});}function sentiment(_0x512f83,_0x4bc377,_0x518486,_0x2bd09c,_0x5b347b){return new Promise(function(_0xb2aa1d,_0xe4469){var _0x1ae848=new AWS[(_0x0e0c('0x8'))]({'accessKeyId':_0x4bc377,'secretAccessKey':_0x512f83,'region':_0x518486});_0x1ae848[_0x0e0c('0x9')]({'Text':_0x2bd09c,'LanguageCode':_0x5b347b[_0x0e0c('0xa')](0x0,0x2)},function(_0x45b7fb,_0x348502){if(_0x45b7fb){return _0xe4469(_0x45b7fb);}else{return _0xb2aa1d(_0x348502);}});});}function checkTranscribeJob(_0x5b514a,_0x246fd6,_0x5c31c7){var _0x5794fa;return new BPromise(function(_0x117d5b,_0x190751){logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0xd'),_0x5b514a['id'],_0x5b514a[_0x0e0c('0xe')]));return getTranscriptionJob(_0x5c31c7['data1'],_0x5c31c7[_0x0e0c('0xf')],_0x246fd6[_0x0e0c('0x10')],_0x5b514a[_0x0e0c('0xe')])['then'](function(_0x368ba0){logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0x11'),_0x5b514a['id'],_0x5b514a[_0x0e0c('0xe')],_0x368ba0[_0x0e0c('0x12')][_0x0e0c('0x13')]));if(!_0x5b514a[_0x0e0c('0x14')]){switch(_0x368ba0[_0x0e0c('0x12')]['TranscriptionJobStatus']){case _0x0e0c('0x15'):var _0x4dcc04={'transcribeStatus':_0x368ba0['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x368ba0[_0x0e0c('0x12')][_0x0e0c('0x16')][_0x0e0c('0x17')]};logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0x18'),_0x5b514a['id']));return rp({'uri':_0x368ba0['TranscriptionJob'][_0x0e0c('0x16')]['TranscriptFileUri'],'json':!![]})[_0x0e0c('0x19')](function(_0x4419e9){logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0x1a'),_0x5b514a['id']));if(_0x4419e9&&_0x4419e9['results']&&_0x4419e9[_0x0e0c('0x1b')][_0x0e0c('0x1c')]&&_0x4419e9[_0x0e0c('0x1b')][_0x0e0c('0x1c')][_0x0e0c('0x1d')]){_0x4dcc04[_0x0e0c('0x14')]='';for(var _0x3564cc=0x0;_0x3564cc<_0x4419e9[_0x0e0c('0x1b')][_0x0e0c('0x1c')][_0x0e0c('0x1d')];_0x3564cc++){_0x4dcc04['fileText']+=_0x4419e9[_0x0e0c('0x1b')][_0x0e0c('0x1c')][_0x3564cc]['transcript']+'';}}return _0x5b514a[_0x0e0c('0x1e')](_0x4dcc04);})[_0x0e0c('0x19')](function(){logger['info'](util[_0x0e0c('0xc')](_0x0e0c('0x1f'),_0x5b514a['id']));if(!_0x5b514a[_0x0e0c('0x20')]){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x23'));}if(!_0x246fd6[_0x0e0c('0x24')]||!_0x246fd6[_0x0e0c('0x25')]||!_0x246fd6[_0x0e0c('0x26')]||!_0x246fd6[_0x0e0c('0x27')]||!_0x246fd6[_0x0e0c('0x28')]){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x29'));}if(!_0x4dcc04[_0x0e0c('0x14')]){throw new Error(_0x0e0c('0x2a'));}if(_0x246fd6['sentimentAccountId']===_0x5c31c7['id']){return _0x5c31c7;}else{return db[_0x0e0c('0x2b')][_0x0e0c('0x2c')]({'where':{'id':_settings[_0x0e0c('0x25')]}});}})[_0x0e0c('0x19')](function(_0x289fc6){if(!_0x289fc6){throw new db['Sequelize'][(_0x0e0c('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x289fc6[_0x0e0c('0x2d')]||!_0x289fc6[_0x0e0c('0xf')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5794fa=_0x289fc6;logger['info'](util[_0x0e0c('0xc')](_0x0e0c('0x2e'),_0x5b514a['id']));return sentiment(_0x5794fa[_0x0e0c('0x2d')],_0x5794fa['data2'],_0x246fd6['sentimentRegion'],_0x4dcc04[_0x0e0c('0x14')],_0x246fd6[_0x0e0c('0x27')]);})['then'](function(_0x569e69){logger[_0x0e0c('0xb')](util['format'](_0x0e0c('0x2f'),_0x5b514a['id']));return _0x5b514a[_0x0e0c('0x1e')]({'sentiment':_0x569e69[_0x0e0c('0x30')],'sPositive':_0x569e69[_0x0e0c('0x31')][_0x0e0c('0x32')],'sNegative':_0x569e69[_0x0e0c('0x31')][_0x0e0c('0x33')],'sMixed':_0x569e69['SentimentScore'][_0x0e0c('0x34')],'sNeutral':_0x569e69[_0x0e0c('0x31')][_0x0e0c('0x35')]});})[_0x0e0c('0x19')](function(){logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0x1f'),_0x5b514a['id']));_0x117d5b();});case _0x0e0c('0x36'):return _0x5b514a['update']({'transcribeStatus':'FAILED','failureReason':_0x368ba0[_0x0e0c('0x12')][_0x0e0c('0x37')]})[_0x0e0c('0x19')](function(){logger[_0x0e0c('0xb')](util['format'](_0x0e0c('0x1f'),_0x5b514a['id']));_0x117d5b();});default:logger['info'](util['format'](_0x0e0c('0x38'),_0x5b514a['id']));break;}}else{return BPromise[_0x0e0c('0x39')]()[_0x0e0c('0x19')](function(){if(!_0x5b514a[_0x0e0c('0x20')]){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x23'));}if(!_0x246fd6[_0x0e0c('0x24')]||!_0x246fd6[_0x0e0c('0x25')]||!_0x246fd6[_0x0e0c('0x26')]||!_0x246fd6['language']||!_0x246fd6[_0x0e0c('0x28')]){throw new db[(_0x0e0c('0x21'))]['ValidationError'](_0x0e0c('0x29'));}if(!_0x5b514a[_0x0e0c('0x14')]){throw new Error(_0x0e0c('0x2a'));}if(_0x246fd6[_0x0e0c('0x25')]===_0x5c31c7['id']){return _0x5c31c7;}else{return db[_0x0e0c('0x2b')][_0x0e0c('0x2c')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x0e0c('0x19')](function(_0x372061){if(!_0x372061){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x3a'));}if(!_0x372061[_0x0e0c('0x2d')]||!_0x372061[_0x0e0c('0xf')]){throw new db['Sequelize']['ValidationError'](_0x0e0c('0x3b'));}_0x5794fa=_0x372061;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5b514a['id']));return sentiment(_0x5794fa[_0x0e0c('0x2d')],_0x5794fa[_0x0e0c('0xf')],_0x246fd6[_0x0e0c('0x26')],_0x5b514a[_0x0e0c('0x14')],_0x246fd6[_0x0e0c('0x27')]);})[_0x0e0c('0x19')](function(_0x7bcc2b){logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0x2f'),_0x5b514a['id']));return _0x5b514a[_0x0e0c('0x1e')]({'sentiment':_0x7bcc2b[_0x0e0c('0x30')],'sPositive':_0x7bcc2b['SentimentScore'][_0x0e0c('0x32')],'sNegative':_0x7bcc2b[_0x0e0c('0x31')][_0x0e0c('0x33')],'sMixed':_0x7bcc2b[_0x0e0c('0x31')]['Mixed'],'sNeutral':_0x7bcc2b[_0x0e0c('0x31')][_0x0e0c('0x35')],'transcribeStatus':_0x0e0c('0x15')});})[_0x0e0c('0x19')](function(){logger[_0x0e0c('0xb')](util[_0x0e0c('0xc')](_0x0e0c('0x1f'),_0x5b514a['id']));_0x117d5b();});}})[_0x0e0c('0x3c')](function(_0x1554de){if(_0x1554de){if(!_0x1554de['name']||_0x1554de[_0x0e0c('0x3d')]!==_0x0e0c('0x3e')){logger['error'](util['format'](_0x0e0c('0x3f'),_0x5b514a['id']),util[_0x0e0c('0x40')](_0x1554de,{'showHidden':![],'depth':null}));}}_0x117d5b();});});}function checkTranscribe(){var _0x321990;var _0x541e90;var _0x29c971;return db[_0x0e0c('0x41')][_0x0e0c('0x42')]({'where':{'transcribeStatus':_0x0e0c('0x43')}})['then'](function(_0x5e8c7a){if(!_0x5e8c7a||!_0x5e8c7a[_0x0e0c('0x1d')]){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x44'));}_0x321990=_0x5e8c7a;return db[_0x0e0c('0x45')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x6e907c){if(!_0x6e907c){throw new db['Sequelize'][(_0x0e0c('0x22'))](_0x0e0c('0x46'));}_0x541e90=_0x6e907c;if(!_0x541e90[_0x0e0c('0x5')]||!_0x541e90[_0x0e0c('0x47')]||!_0x541e90['transcribeRegion']||!_0x541e90[_0x0e0c('0x27')]||!_0x541e90['bucket']){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x48'));}return db[_0x0e0c('0x2b')][_0x0e0c('0x2c')]({'where':{'id':_0x541e90[_0x0e0c('0x47')]}});})['then'](function(_0x4faf89){if(!_0x4faf89){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))](_0x0e0c('0x3a'));}if(!_0x4faf89[_0x0e0c('0x2d')]||!_0x4faf89['data2']){throw new db[(_0x0e0c('0x21'))][(_0x0e0c('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x29c971=_0x4faf89;var _0x4d5095=[];_0x321990[_0x0e0c('0x49')](function(_0x166427){_0x4d5095[_0x0e0c('0x4a')](checkTranscribeJob(_0x166427,_0x541e90,_0x29c971));});return BPromise['all'](_0x4d5095);})[_0x0e0c('0x3c')](function(_0x8fafa3){if(_0x8fafa3){if(!_0x8fafa3[_0x0e0c('0x3d')]||_0x8fafa3[_0x0e0c('0x3d')]!==_0x0e0c('0x3e')){logger[_0x0e0c('0x4b')](util[_0x0e0c('0x40')](_0x8fafa3,{'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 1a10a3c..ce84ccd 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 _0x4961=['util','../../mysqldb','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','inspect','lodash','moment','ioredis'];(function(_0x4a6623,_0x556597){var _0x3c56ff=function(_0xa97801){while(--_0xa97801){_0x4a6623['push'](_0x4a6623['shift']());}};_0x3c56ff(++_0x556597);}(_0x4961,0x1a6));var _0x1496=function(_0x4d87ec,_0x3f2c31){_0x4d87ec=_0x4d87ec-0x0;var _0x1d1538=_0x4961[_0x4d87ec];return _0x1d1538;};'use strict';var _=require(_0x1496('0x0'));var moment=require(_0x1496('0x1'));var Redis=require(_0x1496('0x2'));var util=require(_0x1496('0x3'));var config=require('../../config/environment');var db=require(_0x1496('0x4'))['db'];var logger=require('../logger')('schedule');config[_0x1496('0x5')]=_['defaults'](config['redis'],{'host':_0x1496('0x6'),'port':0x18eb});var io=require(_0x1496('0x7'))(new Redis(config[_0x1496('0x5')]));function closeInteractions(){var _0x81bda2=[];return db[_0x1496('0x8')][_0x1496('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1496('0xa')](0x18,_0x1496('0xb'))}}})['then'](function(_0x3ab125){if(_0x3ab125&&_0x3ab125[_0x1496('0xc')]){_0x81bda2=_['map'](_0x3ab125||[],'id');logger['info'](_0x1496('0xd'),_0x81bda2[_0x1496('0xe')]());return db['WhatsappInteraction']['update']({'closeReason':_0x1496('0xf'),'disposition':_0x1496('0x10'),'closed':!![],'closedAt':moment()[_0x1496('0x11')](_0x1496('0x12'))},{'where':{'id':_0x81bda2}});}})[_0x1496('0x13')](function(){if(_0x81bda2&&_0x81bda2[_0x1496('0xc')]){logger[_0x1496('0x14')](_0x1496('0x15'),_0x81bda2['join']());for(var _0xb9c9a1=0x0;_0xb9c9a1<_0x81bda2['length'];_0xb9c9a1++){io[_0x1496('0x16')](_0x1496('0x17'),{'id':_0x81bda2[_0xb9c9a1],'closed':!![]});}}})['catch'](function(_0x23d374){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x23d374?util[_0x1496('0x18')](_0x23d374,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3715=['update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction'];(function(_0xd0e64a,_0x4c58d4){var _0x2fad2c=function(_0xa04463){while(--_0xa04463){_0xd0e64a['push'](_0xd0e64a['shift']());}};_0x2fad2c(++_0x4c58d4);}(_0x3715,0x124));var _0x5371=function(_0x53d79e,_0x48919d){_0x53d79e=_0x53d79e-0x0;var _0x14f2d8=_0x3715[_0x53d79e];return _0x14f2d8;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x5371('0x0'));var util=require('util');var config=require('../../config/environment');var db=require(_0x5371('0x1'))['db'];var logger=require(_0x5371('0x2'))(_0x5371('0x3'));config[_0x5371('0x4')]=_[_0x5371('0x5')](config[_0x5371('0x4')],{'host':_0x5371('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5371('0x4')]));function closeInteractions(){var _0x31985f=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x5371('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5371('0x8')](0x18,_0x5371('0x9'))}}})[_0x5371('0xa')](function(_0x282b77){if(_0x282b77&&_0x282b77[_0x5371('0xb')]){_0x31985f=_[_0x5371('0xc')](_0x282b77||[],'id');logger['info'](_0x5371('0xd'),_0x31985f[_0x5371('0xe')]());return db[_0x5371('0xf')][_0x5371('0x10')]({'closeReason':'system','disposition':_0x5371('0x11'),'closed':!![],'closedAt':moment()[_0x5371('0x12')](_0x5371('0x13'))},{'where':{'id':_0x31985f}});}})['then'](function(){if(_0x31985f&&_0x31985f['length']){logger[_0x5371('0x14')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x31985f['join']());for(var _0xa8e813=0x0;_0xa8e813<_0x31985f[_0x5371('0xb')];_0xa8e813++){io[_0x5371('0x15')](_0x5371('0x16'),{'id':_0x31985f[_0xa8e813],'closed':!![]});}}})[_0x5371('0x17')](function(_0x551952){logger[_0x5371('0x18')](_0x5371('0x19'),_0x551952?util[_0x5371('0x1a')](_0x551952,{'showHidden':![],'depth':null}):'');});}exports[_0x5371('0x1b')]=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 eec2fd7..d9178b1 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['CmContact','destroy','then','bulkCreate','finished\x20populating','CmHopper','log','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo'];(function(_0x277a8d,_0x8f4900){var _0x3e1793=function(_0x5e8f41){while(--_0x5e8f41){_0x277a8d['push'](_0x277a8d['shift']());}};_0x3e1793(++_0x8f4900);}(_0x236c,0x12a));var _0xc236=function(_0x16e16f,_0x48ee91){_0x16e16f=_0x16e16f-0x0;var _0x1e611c=_0x236c[_0x16e16f];return _0x1e611c;};'use strict';var util=require(_0xc236('0x0'));var db=require(_0xc236('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc236('0x2')]({'id':i,'firstName':_0xc236('0x3')+i,'lastName':_0xc236('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc236('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc236('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc236('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc236('0x2')]({'id':i,'firstName':_0xc236('0x3')+i,'lastName':_0xc236('0x4')+i,'phone':0xf879fb460+i,'email':_0xc236('0x7')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc236('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc236('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc236('0x6')]()});}db[_0xc236('0x8')][_0xc236('0x9')]({'where':{}})[_0xc236('0xa')](function(){return db[_0xc236('0x8')][_0xc236('0xb')](contacts);})[_0xc236('0xa')](function(){console['log'](_0xc236('0xc'),'contacts1');return db[_0xc236('0xd')][_0xc236('0x9')]({'where':{}});})[_0xc236('0xa')](function(){return db['CmHopper'][_0xc236('0xb')](hopper);})[_0xc236('0xa')](function(){console[_0xc236('0xe')](_0xc236('0xc'),_0xc236('0xf'));return db[_0xc236('0x8')][_0xc236('0xb')](contacts2);})['then'](function(){console['log'](_0xc236('0xc'),_0xc236('0x10'));return db[_0xc236('0xd')][_0xc236('0xb')](hopper2);})[_0xc236('0xa')](function(){console[_0xc236('0xe')](_0xc236('0xc'),_0xc236('0x11'));})['catch'](function(_0x16b16a){console[_0xc236('0xe')](_0x16b16a);}); \ No newline at end of file +var _0xb452=['hopper1','hopper2','catch','util','../mysqldb','Biondo','innocenzo.biondo','push','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating'];(function(_0x3ff17d,_0x265605){var _0x5dc636=function(_0x23e6d6){while(--_0x23e6d6){_0x3ff17d['push'](_0x3ff17d['shift']());}};_0x5dc636(++_0x265605);}(_0xb452,0x6f));var _0x2b45=function(_0x3a1f91,_0x15fe8b){_0x3a1f91=_0x3a1f91-0x0;var _0x451178=_0xb452[_0x3a1f91];return _0x451178;};'use strict';var util=require(_0x2b45('0x0'));var db=require(_0x2b45('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2b45('0x2')+i,'phone':0xf879fb460+i,'email':_0x2b45('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2b45('0x4')]({'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[_0x2b45('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2b45('0x4')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2b45('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2b45('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2b45('0x4')]({'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['now']()});}db[_0x2b45('0x7')][_0x2b45('0x8')]({'where':{}})[_0x2b45('0x9')](function(){return db[_0x2b45('0x7')][_0x2b45('0xa')](contacts);})[_0x2b45('0x9')](function(){console[_0x2b45('0xb')]('finished\x20populating',_0x2b45('0xc'));return db[_0x2b45('0xd')][_0x2b45('0x8')]({'where':{}});})[_0x2b45('0x9')](function(){return db['CmHopper'][_0x2b45('0xa')](hopper);})[_0x2b45('0x9')](function(){console['log'](_0x2b45('0xe'),_0x2b45('0xf'));return db[_0x2b45('0x7')][_0x2b45('0xa')](contacts2);})[_0x2b45('0x9')](function(){console[_0x2b45('0xb')](_0x2b45('0xe'),'contacts2');return db[_0x2b45('0xd')][_0x2b45('0xa')](hopper2);})['then'](function(){console['log'](_0x2b45('0xe'),_0x2b45('0x10'));})[_0x2b45('0x11')](function(_0xdc9a94){console[_0x2b45('0xb')](_0xdc9a94);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d1f37fd..ada70e5 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd52c=['/etc/pki/tls/private/motion.key','actpass','User','then','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','yes'];(function(_0x5d79ab,_0x2ff6d8){var _0x34d54c=function(_0x42fabf){while(--_0x42fabf){_0x5d79ab['push'](_0x5d79ab['shift']());}};_0x34d54c(++_0x2ff6d8);}(_0xd52c,0x76));var _0xcd52=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0xd52c[_0x2be104];return _0x31c115;};'use strict';var util=require(_0xcd52('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcd52('0x1')]({'name':util[_0xcd52('0x2')](_0xcd52('0x3'),_0xcd52('0x4'),i),'fullname':util[_0xcd52('0x2')](_0xcd52('0x3'),_0xcd52('0x4'),i),'email':util[_0xcd52('0x2')](_0xcd52('0x5'),'agent',i),'role':_0xcd52('0x4'),'password':'password','internal':0xfa0+i,'type':_0xcd52('0x6'),'transport':[_0xcd52('0x7'),'ws',_0xcd52('0x8')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0xcd52('0x4'),i),'encryption':_0xcd52('0x9'),'avpf':_0xcd52('0x9'),'force_avp':'yes','icesupport':_0xcd52('0x9'),'dtlsenable':_0xcd52('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xcd52('0xa'),'dtlssetup':_0xcd52('0xb'),'callerid':util[_0xcd52('0x2')]('\x22%s\x22\x20<%s>',util[_0xcd52('0x2')]('%s%s',_0xcd52('0x4'),i),0xfa0+i)});}db[_0xcd52('0xc')]['bulkCreate'](users)[_0xcd52('0xd')](function(){console['log'](_0xcd52('0xe'));})[_0xcd52('0xf')](function(_0x4d0787){console['log'](_0x4d0787);}); \ No newline at end of file +var _0x3fe0=['User','bulkCreate','then','log','catch','util','push','format','%s%s','agent','password','friend','udp','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3fe0,0x1c7));var _0x03fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fe0[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x03fe('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x03fe('0x1')]({'name':util[_0x03fe('0x2')](_0x03fe('0x3'),_0x03fe('0x4'),i),'fullname':util[_0x03fe('0x2')](_0x03fe('0x3'),_0x03fe('0x4'),i),'email':util[_0x03fe('0x2')]('%s%s@xcally.com',_0x03fe('0x4'),i),'role':_0x03fe('0x4'),'password':_0x03fe('0x5'),'internal':0xfa0+i,'type':_0x03fe('0x6'),'transport':[_0x03fe('0x7'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x03fe('0x2')](_0x03fe('0x3'),'agent',i),'encryption':_0x03fe('0x8'),'avpf':_0x03fe('0x8'),'force_avp':_0x03fe('0x8'),'icesupport':_0x03fe('0x8'),'dtlsenable':_0x03fe('0x8'),'dtlsverify':'no','dtlscertfile':_0x03fe('0x9'),'dtlsprivatekey':_0x03fe('0xa'),'dtlssetup':_0x03fe('0xb'),'callerid':util[_0x03fe('0x2')](_0x03fe('0xc'),util['format'](_0x03fe('0x3'),_0x03fe('0x4'),i),0xfa0+i)});}db[_0x03fe('0xd')][_0x03fe('0xe')](users)[_0x03fe('0xf')](function(){console[_0x03fe('0x10')]('add\x20user');})[_0x03fe('0x11')](function(_0x50e68c){console[_0x03fe('0x10')](_0x50e68c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2dceb0b..fe804a3 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcf1=['OpenchannelQueue','Trunk','user','voice:outbound','WhatsappQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','telephone','agent','type','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','then','map','resourceId','User','where','ivr','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','role','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue'];(function(_0x2ce323,_0x44ecb0){var _0x3a5732=function(_0x451ed7){while(--_0x451ed7){_0x2ce323['push'](_0x2ce323['shift']());}};_0x3a5732(++_0x44ecb0);}(_0xbcf1,0x97));var _0x1bcf=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xbcf1[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require(_0x1bcf('0x0'));var util=require('util');var BPromise=require(_0x1bcf('0x1'));var db=require(_0x1bcf('0x2'))['db'];var config=require(_0x1bcf('0x3'));var queryQueues={'attributes':['id',_0x1bcf('0x4')],'include':[{'as':_0x1bcf('0x5'),'model':db['User'],'attributes':['id',_0x1bcf('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1bcf('0x4')],'where':{'role':_0x1bcf('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1bcf('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x1bcf('0x4')],'where':{'role':_0x1bcf('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1bcf('0x4'),_0x1bcf('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x1d4518,_0x52dc9e,_0x42a7d6){return db[_0x1bcf('0x9')]['findOne']({'where':{'name':_0x1d4518,'userProfileId':_0x52dc9e},'raw':!![]})['then'](function(_0x4da9e6){if(_0x4da9e6){if(_0x4da9e6[_0x1bcf('0xa')]){switch(_0x1d4518){case _0x1bcf('0xb'):case _0x1bcf('0xc'):case _0x1bcf('0xd'):case _0x1bcf('0xe'):case _0x1bcf('0xf'):case _0x1bcf('0x10'):case _0x1bcf('0x11'):return db[_0x42a7d6][_0x1bcf('0x12')](queryQueues);case _0x1bcf('0x13'):return db[_0x42a7d6][_0x1bcf('0x12')](queryTelephones);case _0x1bcf('0x14'):return db[_0x42a7d6]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x42a7d6][_0x1bcf('0x12')](queryCampaigns);}}else{return db[_0x1bcf('0x15')][_0x1bcf('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x4da9e6['id']},'raw':!![]})[_0x1bcf('0x16')](function(_0x419fce){if(_0x419fce){var _0x34badf={'where':{'id':_[_0x1bcf('0x17')](_0x419fce,_0x1bcf('0x18'))},'raw':!![]};switch(_0x42a7d6){case _0x1bcf('0x19'):_0x34badf[_0x1bcf('0x1a')]['role']=_0x1bcf('0x6');break;case'Campaign':_0x34badf[_0x1bcf('0x1a')][_0x1bcf('0x8')]=_0x1bcf('0x1b');break;}return db[_0x42a7d6][_0x1bcf('0x12')](_0x34badf);}else{return[];}});}}else{return[];}})[_0x1bcf('0x16')](function(_0x5aede4){return _0x5aede4;});}function joinOrLeaveQueues(_0x4b1f72,_0x384b06,_0x5933bc,_0x193edf){_0x4b1f72[_0x384b06](util[_0x1bcf('0x1c')](_0x1bcf('0x1d'),_0x5933bc,_0x193edf[_0x1bcf('0x4')]));if(_0x193edf[_0x1bcf('0x5')]){for(var _0x2783e6=0x0;_0x2783e6<_0x193edf[_0x1bcf('0x5')][_0x1bcf('0x1e')];_0x2783e6+=0x1){_0x4b1f72[_0x384b06](util[_0x1bcf('0x1c')](_0x1bcf('0x1f'),_0x193edf['Agents'][_0x2783e6][_0x1bcf('0x4')]));}}}function joinOrLeave(_0x462c45,_0x563085,_0x4c028c){var _0x11f22c;if(_0x462c45[_0x1bcf('0x20')][_0x1bcf('0x21')]['id']){db[_0x1bcf('0x19')][_0x1bcf('0x22')]({'attributes':['id',_0x1bcf('0x4'),'role',_0x1bcf('0x23')],'where':{'id':_0x462c45[_0x1bcf('0x20')][_0x1bcf('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x1bcf('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x1bcf('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x1bcf('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1bcf('0x27')],'as':_0x1bcf('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x1bcf('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x1bcf('0x2a')],'as':_0x1bcf('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x1bcf('0x16')](function(_0x9ede1f){if(_0x9ede1f){_0x11f22c=_0x9ede1f;_0x462c45[_0x563085](util[_0x1bcf('0x1c')](_0x1bcf('0x1f'),_0x9ede1f[_0x1bcf('0x4')]));var _0x28d2ed=[];switch(_0x9ede1f[_0x1bcf('0x2c')]){case'admin':_0x462c45[_0x563085](_0x1bcf('0x2d'));_0x462c45[_0x563085]('voice:outbound');if(queryQueues[_0x1bcf('0x2e')](_0x1bcf('0x2f'))){delete queryQueues[_0x1bcf('0x2f')];}_0x28d2ed[_0x1bcf('0x30')](db[_0x1bcf('0x31')][_0x1bcf('0x12')](queryQueues));_0x28d2ed[_0x1bcf('0x30')](db[_0x1bcf('0x32')][_0x1bcf('0x12')](queryQueues));_0x28d2ed['push'](db[_0x1bcf('0x33')]['findAll'](queryQueues));_0x28d2ed[_0x1bcf('0x30')](db[_0x1bcf('0x34')][_0x1bcf('0x12')](queryQueues));_0x28d2ed[_0x1bcf('0x30')](db['MailQueue'][_0x1bcf('0x12')](queryQueues));_0x28d2ed[_0x1bcf('0x30')](db[_0x1bcf('0x35')]['findAll'](queryQueues));_0x28d2ed['push'](db['WhatsappQueue'][_0x1bcf('0x12')](queryQueues));_0x28d2ed['push'](db[_0x1bcf('0x19')][_0x1bcf('0x12')](queryTelephones));_0x28d2ed['push'](db[_0x1bcf('0x36')][_0x1bcf('0x12')](queryTrunks));_0x28d2ed[_0x1bcf('0x30')](db['Campaign']['findAll'](queryCampaigns));_0x28d2ed[_0x1bcf('0x30')](db[_0x1bcf('0x19')][_0x1bcf('0x12')](queryAgents));break;case _0x1bcf('0x37'):_0x462c45[_0x563085](_0x1bcf('0x2d'));_0x462c45[_0x563085](_0x1bcf('0x38'));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0xb'),_0x9ede1f[_0x1bcf('0x23')],'VoiceQueue'));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0xc'),_0x9ede1f[_0x1bcf('0x23')],_0x1bcf('0x32')));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0xd'),_0x9ede1f[_0x1bcf('0x23')],'FaxQueue'));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0xe'),_0x9ede1f[_0x1bcf('0x23')],_0x1bcf('0x34')));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0xf'),_0x9ede1f[_0x1bcf('0x23')],'MailQueue'));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0x10'),_0x9ede1f[_0x1bcf('0x23')],'OpenchannelQueue'));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0x11'),_0x9ede1f['userProfileId'],_0x1bcf('0x39')));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0x13'),_0x9ede1f[_0x1bcf('0x23')],_0x1bcf('0x19')));_0x28d2ed[_0x1bcf('0x30')](getAssociatedResources(_0x1bcf('0x14'),_0x9ede1f[_0x1bcf('0x23')],_0x1bcf('0x36')));_0x28d2ed['push'](getAssociatedResources(_0x1bcf('0x3a'),_0x9ede1f[_0x1bcf('0x23')],'Campaign'));_0x28d2ed[_0x1bcf('0x30')](db[_0x1bcf('0x19')][_0x1bcf('0x12')](queryAgents));break;case _0x1bcf('0x7'):_0x462c45[_0x563085]('voice:inbound');_0x462c45[_0x563085](_0x1bcf('0x38'));_0x28d2ed[_0x1bcf('0x30')](_0x9ede1f[_0x1bcf('0x3b')]({'attributes':['id',_0x1bcf('0x4')]}));_0x28d2ed[_0x1bcf('0x30')](_0x9ede1f[_0x1bcf('0x3c')]({'attributes':['id',_0x1bcf('0x4')]}));_0x28d2ed[_0x1bcf('0x30')](_0x9ede1f[_0x1bcf('0x3d')]({'attributes':['id','name']}));_0x28d2ed[_0x1bcf('0x30')](_0x9ede1f['getSmsQueues']({'attributes':['id',_0x1bcf('0x4')]}));_0x28d2ed[_0x1bcf('0x30')](_0x9ede1f[_0x1bcf('0x3e')]({'attributes':['id',_0x1bcf('0x4')]}));_0x28d2ed[_0x1bcf('0x30')](_0x9ede1f[_0x1bcf('0x3f')]({'attributes':['id',_0x1bcf('0x4')]}));_0x28d2ed['push'](_0x9ede1f['getWhatsappQueues']({'attributes':['id',_0x1bcf('0x4')]}));break;}return BPromise[_0x1bcf('0x40')](_0x28d2ed);}})[_0x1bcf('0x16')](function(_0x347a55){if(_0x347a55&&_0x347a55[_0x1bcf('0x1e')]){for(var _0x4541dc=0x0;_0x4541dc<_0x347a55[_0x1bcf('0x1e')];_0x4541dc+=0x1){for(var _0x466fa6=0x0;_0x466fa6<_0x347a55[_0x4541dc]['length'];_0x466fa6+=0x1){switch(_0x4541dc){case 0x0:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x41'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x1:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x42'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x2:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x43'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x3:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x44'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x4:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x45'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x5:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x46'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x6:joinOrLeaveQueues(_0x462c45,_0x563085,_0x1bcf('0x47'),_0x347a55[_0x4541dc][_0x466fa6]);break;case 0x7:if(_0x11f22c[_0x1bcf('0x2c')]!=='agent')_0x462c45[_0x563085](util['format'](_0x1bcf('0x48'),_0x347a55[_0x4541dc][_0x466fa6][_0x1bcf('0x4')]));break;case 0x8:if(_0x11f22c[_0x1bcf('0x2c')]!==_0x1bcf('0x7'))_0x462c45[_0x563085](util[_0x1bcf('0x1c')]('trunk:%s',_0x347a55[_0x4541dc][_0x466fa6][_0x1bcf('0x4')]));break;case 0x9:if(_0x11f22c[_0x1bcf('0x2c')]!==_0x1bcf('0x7'))_0x462c45[_0x563085](util[_0x1bcf('0x1c')](_0x1bcf('0x49'),_0x347a55[_0x4541dc][_0x466fa6][_0x1bcf('0x8')],_0x347a55[_0x4541dc][_0x466fa6][_0x1bcf('0x4')]));break;case 0xa:_0x462c45[_0x563085](util[_0x1bcf('0x1c')](_0x1bcf('0x1f'),_0x347a55[_0x4541dc][_0x466fa6][_0x1bcf('0x4')]));break;}}}}})[_0x1bcf('0x16')](function(){if(_0x563085==='leave'){var _0x48a4a9=_[_0x1bcf('0x17')](_0x11f22c[_0x1bcf('0x24')],'id');return _0x11f22c[_0x1bcf('0x4a')](_0x48a4a9)['then'](function(){for(var _0x29e510=0x0;_0x29e510<_0x48a4a9[_0x1bcf('0x1e')];_0x29e510+=0x1){_0x4c028c[_0x1bcf('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x48a4a9[_0x29e510]),'UserId':Number(_0x11f22c['id'])});}});}})[_0x1bcf('0x16')](function(){if(_0x563085===_0x1bcf('0x4c')){var _0x2250fe=_[_0x1bcf('0x17')](_0x11f22c[_0x1bcf('0x25')],'id');return _0x11f22c[_0x1bcf('0x4d')](_0x2250fe)[_0x1bcf('0x16')](function(){for(var _0x38dd1e=0x0;_0x38dd1e<_0x2250fe[_0x1bcf('0x1e')];_0x38dd1e+=0x1){_0x4c028c[_0x1bcf('0x4b')](_0x1bcf('0x4e'),{'MailInteractionId':Number(_0x2250fe[_0x38dd1e]),'UserId':Number(_0x11f22c['id'])});}});}})[_0x1bcf('0x16')](function(){if(_0x563085===_0x1bcf('0x4c')){var _0x57ab67=_['map'](_0x11f22c[_0x1bcf('0x4f')],'id');return _0x11f22c[_0x1bcf('0x50')](_0x57ab67)[_0x1bcf('0x16')](function(){for(var _0x3d8d48=0x0;_0x3d8d48<_0x57ab67[_0x1bcf('0x1e')];_0x3d8d48+=0x1){_0x4c028c[_0x1bcf('0x4b')](_0x1bcf('0x51'),{'FaxInteractionId':Number(_0x57ab67[_0x3d8d48]),'UserId':Number(_0x11f22c['id'])});}});}})[_0x1bcf('0x16')](function(){if(_0x563085===_0x1bcf('0x4c')){var _0x2182e9=_[_0x1bcf('0x17')](_0x11f22c['SmsInteractions'],'id');return _0x11f22c['removeSmsInteractions'](_0x2182e9)[_0x1bcf('0x16')](function(){for(var _0x5bcfd9=0x0;_0x5bcfd9<_0x2182e9[_0x1bcf('0x1e')];_0x5bcfd9+=0x1){_0x4c028c['emit'](_0x1bcf('0x52'),{'SmsInteractionId':Number(_0x2182e9[_0x5bcfd9]),'UserId':Number(_0x11f22c['id'])});}});}})[_0x1bcf('0x16')](function(){if(_0x563085===_0x1bcf('0x4c')){var _0x18a590=_['map'](_0x11f22c['OpenchannelInteractions'],'id');return _0x11f22c[_0x1bcf('0x53')](_0x18a590)[_0x1bcf('0x16')](function(){for(var _0x1818cf=0x0;_0x1818cf<_0x18a590[_0x1bcf('0x1e')];_0x1818cf+=0x1){_0x4c028c[_0x1bcf('0x4b')](_0x1bcf('0x54'),{'OpenchannelInteractionId':Number(_0x18a590[_0x1818cf]),'UserId':Number(_0x11f22c['id'])});}});}})[_0x1bcf('0x16')](function(){if(_0x563085===_0x1bcf('0x4c')){var _0x19517f=_[_0x1bcf('0x17')](_0x11f22c[_0x1bcf('0x2b')],'id');return _0x11f22c[_0x1bcf('0x55')](_0x19517f)[_0x1bcf('0x16')](function(){for(var _0x8627f=0x0;_0x8627f<_0x19517f['length'];_0x8627f+=0x1){_0x4c028c[_0x1bcf('0x4b')](_0x1bcf('0x56'),{'WhatsappInteractionId':Number(_0x19517f[_0x8627f]),'UserId':Number(_0x11f22c['id'])});}});}})[_0x1bcf('0x57')](function(_0x1c9c9c){_0x462c45['log'](_0x1c9c9c);});}}function onDisconnect(_0x4fd9cd,_0x395fbe){joinOrLeave(_0x4fd9cd,_0x1bcf('0x4c'),_0x395fbe);}function onConnect(_0x519c77){joinOrLeave(_0x519c77,_0x1bcf('0x58'));}exports[_0x1bcf('0x59')]=function(_0xa7405a){_0xa7405a['on'](_0x1bcf('0x5a'),function(_0x3fb1d4){_0x3fb1d4[_0x1bcf('0x5b')](0x0);_0x3fb1d4[_0x1bcf('0x5c')]=_0x3fb1d4[_0x1bcf('0x5d')][_0x1bcf('0x5a')][_0x1bcf('0x5e')]+':'+_0x3fb1d4[_0x1bcf('0x5d')][_0x1bcf('0x5a')][_0x1bcf('0x5f')];_0x3fb1d4[_0x1bcf('0x60')]=new Date();_0x3fb1d4[_0x1bcf('0x61')]=function(_0x48d0ec){console[_0x1bcf('0x61')](_0x1bcf('0x62')+_0x3fb1d4['nsp'][_0x1bcf('0x4')]+'['+_0x3fb1d4[_0x1bcf('0x5c')]+']',_0x48d0ec);};_0x3fb1d4['on'](_0x1bcf('0x63'),function(){onDisconnect(_0x3fb1d4,_0xa7405a);_0x3fb1d4[_0x1bcf('0x61')](_0x1bcf('0x64'));});onConnect(_0x3fb1d4);_0x3fb1d4[_0x1bcf('0x61')](_0x1bcf('0x65'));});}; \ No newline at end of file +var _0x7a71=['role','telephone','Campaign','%s:queue:%s','length','user:%s','Agents','handshake','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','format','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','FaxQueue','WhatsappQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','./environment','name','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','User','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a71,0xad));var _0x17a7=function(_0x25d97d,_0x4ab15a){_0x25d97d=_0x25d97d-0x0;var _0x364e60=_0x7a71[_0x25d97d];return _0x364e60;};'use strict';var _=require(_0x17a7('0x0'));var util=require(_0x17a7('0x1'));var BPromise=require(_0x17a7('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x17a7('0x3'));var queryQueues={'attributes':['id',_0x17a7('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x17a7('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x17a7('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x17a7('0x4')],'where':{'role':_0x17a7('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x17a7('0x4'),_0x17a7('0x6')],'where':{'type':_0x17a7('0x7')}};function getAssociatedResources(_0x30dc7e,_0xc2aa0d,_0x4b5a8a){return db['UserProfileSection'][_0x17a7('0x8')]({'where':{'name':_0x30dc7e,'userProfileId':_0xc2aa0d},'raw':!![]})[_0x17a7('0x9')](function(_0x24ea8f){if(_0x24ea8f){if(_0x24ea8f[_0x17a7('0xa')]){switch(_0x30dc7e){case _0x17a7('0xb'):case _0x17a7('0xc'):case _0x17a7('0xd'):case _0x17a7('0xe'):case _0x17a7('0xf'):case _0x17a7('0x10'):case _0x17a7('0x11'):return db[_0x4b5a8a]['findAll'](queryQueues);case _0x17a7('0x12'):return db[_0x4b5a8a][_0x17a7('0x13')](queryTelephones);case'Trunks':return db[_0x4b5a8a][_0x17a7('0x13')](queryTrunks);case _0x17a7('0x14'):return db[_0x4b5a8a][_0x17a7('0x13')](queryCampaigns);}}else{return db[_0x17a7('0x15')][_0x17a7('0x13')]({'attributes':[_0x17a7('0x16')],'where':{'sectionId':_0x24ea8f['id']},'raw':!![]})[_0x17a7('0x9')](function(_0x2938c5){if(_0x2938c5){var _0x437c87={'where':{'id':_['map'](_0x2938c5,'resourceId')},'raw':!![]};switch(_0x4b5a8a){case _0x17a7('0x17'):_0x437c87[_0x17a7('0x18')][_0x17a7('0x19')]=_0x17a7('0x1a');break;case _0x17a7('0x1b'):_0x437c87[_0x17a7('0x18')][_0x17a7('0x6')]=_0x17a7('0x7');break;}return db[_0x4b5a8a][_0x17a7('0x13')](_0x437c87);}else{return[];}});}}else{return[];}})[_0x17a7('0x9')](function(_0x5a85dc){return _0x5a85dc;});}function joinOrLeaveQueues(_0x3753f4,_0x4f520e,_0x1aaf9c,_0x571f7a){_0x3753f4[_0x4f520e](util['format'](_0x17a7('0x1c'),_0x1aaf9c,_0x571f7a[_0x17a7('0x4')]));if(_0x571f7a['Agents']){for(var _0x2cf646=0x0;_0x2cf646<_0x571f7a['Agents'][_0x17a7('0x1d')];_0x2cf646+=0x1){_0x3753f4[_0x4f520e](util['format'](_0x17a7('0x1e'),_0x571f7a[_0x17a7('0x1f')][_0x2cf646][_0x17a7('0x4')]));}}}function joinOrLeave(_0xad46dd,_0x35d20f,_0x47afec){var _0x2abf8a;if(_0xad46dd[_0x17a7('0x20')]['query']['id']){db[_0x17a7('0x17')]['find']({'attributes':['id',_0x17a7('0x4'),_0x17a7('0x19'),_0x17a7('0x21')],'where':{'id':_0xad46dd['handshake']['query']['id']},'include':[{'model':db[_0x17a7('0x22')],'as':_0x17a7('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x17a7('0x24')],'as':_0x17a7('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x17a7('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x17a7('0x27')],'as':_0x17a7('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x17a7('0x29'),'attributes':['id'],'raw':!![]}]})[_0x17a7('0x9')](function(_0x30733b){if(_0x30733b){_0x2abf8a=_0x30733b;_0xad46dd[_0x35d20f](util[_0x17a7('0x2a')](_0x17a7('0x1e'),_0x30733b[_0x17a7('0x4')]));var _0xcffe70=[];switch(_0x30733b[_0x17a7('0x19')]){case _0x17a7('0x2b'):_0xad46dd[_0x35d20f](_0x17a7('0x2c'));_0xad46dd[_0x35d20f](_0x17a7('0x2d'));if(queryQueues[_0x17a7('0x2e')]('include')){delete queryQueues[_0x17a7('0x2f')];}_0xcffe70[_0x17a7('0x30')](db[_0x17a7('0x31')]['findAll'](queryQueues));_0xcffe70['push'](db[_0x17a7('0x32')][_0x17a7('0x13')](queryQueues));_0xcffe70[_0x17a7('0x30')](db['FaxQueue'][_0x17a7('0x13')](queryQueues));_0xcffe70['push'](db[_0x17a7('0x33')][_0x17a7('0x13')](queryQueues));_0xcffe70[_0x17a7('0x30')](db[_0x17a7('0x34')]['findAll'](queryQueues));_0xcffe70[_0x17a7('0x30')](db[_0x17a7('0x35')][_0x17a7('0x13')](queryQueues));_0xcffe70[_0x17a7('0x30')](db['WhatsappQueue'][_0x17a7('0x13')](queryQueues));_0xcffe70[_0x17a7('0x30')](db[_0x17a7('0x17')][_0x17a7('0x13')](queryTelephones));_0xcffe70['push'](db[_0x17a7('0x36')][_0x17a7('0x13')](queryTrunks));_0xcffe70[_0x17a7('0x30')](db['Campaign'][_0x17a7('0x13')](queryCampaigns));_0xcffe70[_0x17a7('0x30')](db['User'][_0x17a7('0x13')](queryAgents));break;case'user':_0xad46dd[_0x35d20f](_0x17a7('0x2c'));_0xad46dd[_0x35d20f]('voice:outbound');_0xcffe70['push'](getAssociatedResources('VoiceQueues',_0x30733b[_0x17a7('0x21')],_0x17a7('0x31')));_0xcffe70[_0x17a7('0x30')](getAssociatedResources(_0x17a7('0xc'),_0x30733b['userProfileId'],_0x17a7('0x32')));_0xcffe70[_0x17a7('0x30')](getAssociatedResources(_0x17a7('0xd'),_0x30733b[_0x17a7('0x21')],_0x17a7('0x37')));_0xcffe70[_0x17a7('0x30')](getAssociatedResources('SmsQueues',_0x30733b[_0x17a7('0x21')],_0x17a7('0x33')));_0xcffe70[_0x17a7('0x30')](getAssociatedResources(_0x17a7('0xf'),_0x30733b[_0x17a7('0x21')],_0x17a7('0x34')));_0xcffe70[_0x17a7('0x30')](getAssociatedResources(_0x17a7('0x10'),_0x30733b[_0x17a7('0x21')],_0x17a7('0x35')));_0xcffe70[_0x17a7('0x30')](getAssociatedResources(_0x17a7('0x11'),_0x30733b[_0x17a7('0x21')],_0x17a7('0x38')));_0xcffe70['push'](getAssociatedResources(_0x17a7('0x12'),_0x30733b['userProfileId'],_0x17a7('0x17')));_0xcffe70['push'](getAssociatedResources(_0x17a7('0x39'),_0x30733b[_0x17a7('0x21')],'Trunk'));_0xcffe70['push'](getAssociatedResources('IvrCampaigns',_0x30733b[_0x17a7('0x21')],_0x17a7('0x1b')));_0xcffe70[_0x17a7('0x30')](db[_0x17a7('0x17')][_0x17a7('0x13')](queryAgents));break;case _0x17a7('0x5'):_0xad46dd[_0x35d20f]('voice:inbound');_0xad46dd[_0x35d20f](_0x17a7('0x2d'));_0xcffe70[_0x17a7('0x30')](_0x30733b[_0x17a7('0x3a')]({'attributes':['id',_0x17a7('0x4')]}));_0xcffe70['push'](_0x30733b[_0x17a7('0x3b')]({'attributes':['id','name']}));_0xcffe70[_0x17a7('0x30')](_0x30733b[_0x17a7('0x3c')]({'attributes':['id',_0x17a7('0x4')]}));_0xcffe70[_0x17a7('0x30')](_0x30733b[_0x17a7('0x3d')]({'attributes':['id',_0x17a7('0x4')]}));_0xcffe70[_0x17a7('0x30')](_0x30733b[_0x17a7('0x3e')]({'attributes':['id',_0x17a7('0x4')]}));_0xcffe70['push'](_0x30733b['getOpenchannelQueues']({'attributes':['id','name']}));_0xcffe70[_0x17a7('0x30')](_0x30733b[_0x17a7('0x3f')]({'attributes':['id',_0x17a7('0x4')]}));break;}return BPromise[_0x17a7('0x40')](_0xcffe70);}})[_0x17a7('0x9')](function(_0x39c529){if(_0x39c529&&_0x39c529[_0x17a7('0x1d')]){for(var _0x13a39d=0x0;_0x13a39d<_0x39c529[_0x17a7('0x1d')];_0x13a39d+=0x1){for(var _0x4949c1=0x0;_0x4949c1<_0x39c529[_0x13a39d][_0x17a7('0x1d')];_0x4949c1+=0x1){switch(_0x13a39d){case 0x0:joinOrLeaveQueues(_0xad46dd,_0x35d20f,_0x17a7('0x41'),_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x1:joinOrLeaveQueues(_0xad46dd,_0x35d20f,'chat',_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x2:joinOrLeaveQueues(_0xad46dd,_0x35d20f,_0x17a7('0x42'),_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x3:joinOrLeaveQueues(_0xad46dd,_0x35d20f,_0x17a7('0x43'),_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x4:joinOrLeaveQueues(_0xad46dd,_0x35d20f,_0x17a7('0x44'),_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x5:joinOrLeaveQueues(_0xad46dd,_0x35d20f,_0x17a7('0x45'),_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x6:joinOrLeaveQueues(_0xad46dd,_0x35d20f,'whatsapp',_0x39c529[_0x13a39d][_0x4949c1]);break;case 0x7:if(_0x2abf8a['role']!=='agent')_0xad46dd[_0x35d20f](util[_0x17a7('0x2a')](_0x17a7('0x46'),_0x39c529[_0x13a39d][_0x4949c1]['name']));break;case 0x8:if(_0x2abf8a[_0x17a7('0x19')]!==_0x17a7('0x5'))_0xad46dd[_0x35d20f](util[_0x17a7('0x2a')](_0x17a7('0x47'),_0x39c529[_0x13a39d][_0x4949c1]['name']));break;case 0x9:if(_0x2abf8a[_0x17a7('0x19')]!==_0x17a7('0x5'))_0xad46dd[_0x35d20f](util[_0x17a7('0x2a')](_0x17a7('0x48'),_0x39c529[_0x13a39d][_0x4949c1][_0x17a7('0x6')],_0x39c529[_0x13a39d][_0x4949c1][_0x17a7('0x4')]));break;case 0xa:_0xad46dd[_0x35d20f](util[_0x17a7('0x2a')](_0x17a7('0x1e'),_0x39c529[_0x13a39d][_0x4949c1][_0x17a7('0x4')]));break;}}}}})[_0x17a7('0x9')](function(){if(_0x35d20f==='leave'){var _0x36d3bf=_[_0x17a7('0x49')](_0x2abf8a[_0x17a7('0x23')],'id');return _0x2abf8a[_0x17a7('0x4a')](_0x36d3bf)[_0x17a7('0x9')](function(){for(var _0xdc8581=0x0;_0xdc8581<_0x36d3bf['length'];_0xdc8581+=0x1){_0x47afec[_0x17a7('0x4b')](_0x17a7('0x4c'),{'ChatInteractionId':Number(_0x36d3bf[_0xdc8581]),'UserId':Number(_0x2abf8a['id'])});}});}})[_0x17a7('0x9')](function(){if(_0x35d20f==='leave'){var _0x1a3624=_[_0x17a7('0x49')](_0x2abf8a[_0x17a7('0x25')],'id');return _0x2abf8a[_0x17a7('0x4d')](_0x1a3624)['then'](function(){for(var _0xd6bb44=0x0;_0xd6bb44<_0x1a3624[_0x17a7('0x1d')];_0xd6bb44+=0x1){_0x47afec['emit'](_0x17a7('0x4e'),{'MailInteractionId':Number(_0x1a3624[_0xd6bb44]),'UserId':Number(_0x2abf8a['id'])});}});}})['then'](function(){if(_0x35d20f===_0x17a7('0x4f')){var _0x52344f=_[_0x17a7('0x49')](_0x2abf8a['FaxInteractions'],'id');return _0x2abf8a[_0x17a7('0x50')](_0x52344f)[_0x17a7('0x9')](function(){for(var _0x4c17ff=0x0;_0x4c17ff<_0x52344f['length'];_0x4c17ff+=0x1){_0x47afec['emit'](_0x17a7('0x51'),{'FaxInteractionId':Number(_0x52344f[_0x4c17ff]),'UserId':Number(_0x2abf8a['id'])});}});}})['then'](function(){if(_0x35d20f==='leave'){var _0x4931a1=_['map'](_0x2abf8a[_0x17a7('0x26')],'id');return _0x2abf8a['removeSmsInteractions'](_0x4931a1)[_0x17a7('0x9')](function(){for(var _0x386a8f=0x0;_0x386a8f<_0x4931a1[_0x17a7('0x1d')];_0x386a8f+=0x1){_0x47afec['emit'](_0x17a7('0x52'),{'SmsInteractionId':Number(_0x4931a1[_0x386a8f]),'UserId':Number(_0x2abf8a['id'])});}});}})[_0x17a7('0x9')](function(){if(_0x35d20f===_0x17a7('0x4f')){var _0x42cd04=_[_0x17a7('0x49')](_0x2abf8a[_0x17a7('0x28')],'id');return _0x2abf8a[_0x17a7('0x53')](_0x42cd04)[_0x17a7('0x9')](function(){for(var _0x52b4aa=0x0;_0x52b4aa<_0x42cd04[_0x17a7('0x1d')];_0x52b4aa+=0x1){_0x47afec[_0x17a7('0x4b')](_0x17a7('0x54'),{'OpenchannelInteractionId':Number(_0x42cd04[_0x52b4aa]),'UserId':Number(_0x2abf8a['id'])});}});}})[_0x17a7('0x9')](function(){if(_0x35d20f===_0x17a7('0x4f')){var _0x2c6836=_[_0x17a7('0x49')](_0x2abf8a[_0x17a7('0x29')],'id');return _0x2abf8a[_0x17a7('0x55')](_0x2c6836)[_0x17a7('0x9')](function(){for(var _0x48638e=0x0;_0x48638e<_0x2c6836[_0x17a7('0x1d')];_0x48638e+=0x1){_0x47afec[_0x17a7('0x4b')](_0x17a7('0x56'),{'WhatsappInteractionId':Number(_0x2c6836[_0x48638e]),'UserId':Number(_0x2abf8a['id'])});}});}})['catch'](function(_0x12edcc){_0xad46dd[_0x17a7('0x57')](_0x12edcc);});}}function onDisconnect(_0x62caa2,_0x3b2131){joinOrLeave(_0x62caa2,_0x17a7('0x4f'),_0x3b2131);}function onConnect(_0x3c34cc){joinOrLeave(_0x3c34cc,_0x17a7('0x58'));}exports[_0x17a7('0x59')]=function(_0x3fc083){_0x3fc083['on']('connection',function(_0x359b21){_0x359b21[_0x17a7('0x5a')](0x0);_0x359b21[_0x17a7('0x5b')]=_0x359b21[_0x17a7('0x5c')][_0x17a7('0x5d')][_0x17a7('0x5e')]+':'+_0x359b21[_0x17a7('0x5c')][_0x17a7('0x5d')][_0x17a7('0x5f')];_0x359b21['connectedAt']=new Date();_0x359b21[_0x17a7('0x57')]=function(_0x206719){console[_0x17a7('0x57')]('SocketIO\x20'+_0x359b21[_0x17a7('0x60')][_0x17a7('0x4')]+'['+_0x359b21['address']+']',_0x206719);};_0x359b21['on'](_0x17a7('0x61'),function(){onDisconnect(_0x359b21,_0x3fc083);_0x359b21[_0x17a7('0x57')](_0x17a7('0x62'));});onConnect(_0x359b21);_0x359b21[_0x17a7('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1416a7b..a7f338c 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 _0x3cc4=['hook','callback','toLowerCase','../../mysqldb','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','Whatsapp','WhatsappInteraction','FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','contact','UserId','format','name','agent','incomingmessage','AfterCreateMessage','get','opened','resolve','SELECT','AfterCreate','changed','closed','substatus','interface','SIP/%s','AfterUpdate','User','find','fullname','email','internal','default','length','model'];(function(_0x193ad1,_0x6808d1){var _0xd3e8d=function(_0x383a55){while(--_0x383a55){_0x193ad1['push'](_0x193ad1['shift']());}};_0xd3e8d(++_0x6808d1);}(_0x3cc4,0xe1));var _0x43cc=function(_0x62d5ef,_0x175b43){_0x62d5ef=_0x62d5ef-0x0;var _0x379103=_0x3cc4[_0x62d5ef];return _0x379103;};'use strict';var util=require('util');var db=require(_0x43cc('0x0'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x43cc('0x1'));var client=jayson[_0x43cc('0x2')][_0x43cc('0x3')]({'port':0x232a});var triggers=[{'channel':_0x43cc('0x4'),'model':_0x43cc('0x5'),'event':_0x43cc('0x6'),'condition':_0x43cc('0x7'),'callback':afterCreate},{'channel':_0x43cc('0x4'),'model':_0x43cc('0x5'),'event':'afterUpdate','condition':_0x43cc('0x8'),'callback':afterUpdate},{'channel':_0x43cc('0x4'),'model':_0x43cc('0x9'),'event':'afterCreate','condition':_0x43cc('0xa'),'callback':afterCreateMessage},{'channel':_0x43cc('0x4'),'model':_0x43cc('0xb'),'event':_0x43cc('0x6'),'condition':_0x43cc('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x43cc('0xc'),'model':'SmsInteraction','event':_0x43cc('0x6'),'condition':_0x43cc('0x7'),'callback':afterCreate},{'channel':_0x43cc('0xc'),'model':_0x43cc('0xd'),'event':_0x43cc('0xe'),'condition':_0x43cc('0x8'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0x43cc('0x6'),'condition':_0x43cc('0xa'),'callback':afterCreateMessage},{'channel':_0x43cc('0xf'),'model':_0x43cc('0x10'),'event':_0x43cc('0x6'),'condition':_0x43cc('0x7'),'callback':afterCreate},{'channel':_0x43cc('0xf'),'model':_0x43cc('0x10'),'event':_0x43cc('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x43cc('0xf'),'model':'WhatsappMessage','event':_0x43cc('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x43cc('0x11'),'event':_0x43cc('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x43cc('0x12'),'model':_0x43cc('0x11'),'event':_0x43cc('0xe'),'condition':_0x43cc('0x8'),'callback':afterUpdate},{'channel':'Fax','model':_0x43cc('0x13'),'event':_0x43cc('0x6'),'condition':_0x43cc('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x43cc('0x14'),'event':_0x43cc('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x43cc('0x14'),'event':_0x43cc('0xe'),'condition':_0x43cc('0x8'),'callback':afterUpdate},{'channel':_0x43cc('0x15'),'model':_0x43cc('0x16'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x43cc('0x17'),'model':_0x43cc('0x18'),'event':_0x43cc('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x43cc('0x18'),'event':_0x43cc('0xe'),'condition':_0x43cc('0x8'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x43cc('0x19'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x122461){return client[_0x43cc('0x1a')](_0x43cc('0x1b'),_0x122461)[_0x43cc('0x1c')](function(_0x18aa10){logger[_0x43cc('0x1d')](_0x43cc('0x1e'),_0x43cc('0x1b'),_0x18aa10);if(_0x18aa10[_0x43cc('0x1f')]){if(_0x18aa10[_0x43cc('0x1f')][_0x43cc('0x20')]===0x1f4){logger['error'](_0x43cc('0x1e'),_0x43cc('0x1b'),_0x18aa10[_0x43cc('0x1f')]);}}})[_0x43cc('0x21')](function(_0x49a23f){logger[_0x43cc('0x1f')]('Trigger,\x20%s','EventManager',_0x49a23f);});}function afterCreateMessage(_0x5cced9){return function(_0x121d66){_0x121d66=_0x121d66['get']({'plain':!![]});_0x121d66[_0x43cc('0x22')]=_0x5cced9;_0x121d66[_0x43cc('0x23')]=_0x5cced9;_0x121d66[_0x43cc('0x24')]=_0x121d66[_0x43cc('0x25')];Promise['resolve']()[_0x43cc('0x1c')](function(){if(typeof _0x121d66[_0x43cc('0x26')]===_0x43cc('0x27'))return null;var _0x369de3=_0x43cc('0x28')+_0x121d66[_0x43cc('0x26')];return db[_0x43cc('0x29')][_0x43cc('0x2a')](_0x369de3,{'type':db[_0x43cc('0x2b')][_0x43cc('0x2c')]['SELECT'],'raw':!![]});})['then'](function(_0x105dce){if(_0x105dce){_0x121d66[_0x43cc('0x2d')]=_0x105dce[0x0];}if(typeof _0x121d66['UserId']===_0x43cc('0x27'))return;return getAgent(_0x121d66[_0x43cc('0x2e')]);})['then'](function(_0x48ceab){if(_0x48ceab){_0x121d66['interface']=util[_0x43cc('0x2f')]('SIP/%s',_0x48ceab[_0x43cc('0x30')]);_0x121d66[_0x43cc('0x31')]=_0x48ceab;_0x121d66[_0x43cc('0x22')]=_0x5cced9;return request({'event':_0x43cc('0x32'),'message':_0x121d66});}else{return request({'event':'outgoingmessage','message':_0x121d66});}})['catch'](function(_0x157511){logger[_0x43cc('0x1f')]('Trigger,\x20%s',_0x43cc('0x33'),_0x157511);});};}function afterCreateOfflineMessage(_0x4748c9){return function(_0xda9da1){_0xda9da1=_0xda9da1[_0x43cc('0x34')]({'plain':!![]});_0xda9da1[_0x43cc('0x22')]=_0x4748c9;_0xda9da1[_0x43cc('0x23')]=_0x4748c9;_0xda9da1['event']='offlineMessage';return request({'event':_0xda9da1[_0x43cc('0x24')],'message':_0xda9da1});};}function afterCreate(_0x26230d,_0x12a451){return function(_0x4bb945){_0x4bb945=_0x4bb945[_0x43cc('0x34')]({'plain':!![]});_0x4bb945['channel']=_0x26230d;_0x4bb945['motionChannel']=_0x26230d;_0x4bb945[_0x43cc('0x24')]=_0x43cc('0x35');Promise[_0x43cc('0x36')]()[_0x43cc('0x1c')](function(){var _0x36dfb6=_0x43cc('0x28')+_0x4bb945[_0x43cc('0x26')];return db['sequelize']['query'](_0x36dfb6,{'type':db[_0x43cc('0x2b')][_0x43cc('0x2c')][_0x43cc('0x37')],'raw':!![]});})[_0x43cc('0x1c')](function(_0x5b655c){if(_0x5b655c){_0x4bb945[_0x43cc('0x2d')]=_0x5b655c[0x0];}if(typeof _0x4bb945[_0x43cc('0x2e')]===_0x43cc('0x27'))return;return getAgent(_0x4bb945[_0x43cc('0x2e')]);})[_0x43cc('0x1c')](function(_0x4b2c9e){if(_0x4b2c9e){_0x4bb945['interface']=util[_0x43cc('0x2f')]('SIP/%s',_0x4b2c9e[_0x43cc('0x30')]);_0x4bb945[_0x43cc('0x31')]=_0x4b2c9e;}return request({'event':_0x12a451,'message':_0x4bb945});})[_0x43cc('0x21')](function(_0x195516){logger['error'](_0x43cc('0x1e'),_0x43cc('0x38'),_0x195516);});};}function afterUpdate(_0x51e5ea){return function(_0x2c0cda){var _0x51d2fe=_0x2c0cda[_0x43cc('0x39')]('closed')&&_0x2c0cda[_0x43cc('0x3a')];var _0x558ce5=_0x2c0cda[_0x43cc('0x39')]('substatus');if(_0x51d2fe||_0x558ce5){var _0x583f29=_0x51d2fe?'closedinteraction':_0x43cc('0x3b');var _0x42fa22=_0x2c0cda[_0x43cc('0x34')]({'plain':!![]});_0x42fa22[_0x43cc('0x22')]=_0x51e5ea;_0x42fa22[_0x43cc('0x23')]=_0x51e5ea;_0x42fa22[_0x43cc('0x24')]=_0x51d2fe?_0x43cc('0x3a'):_0x43cc('0x3b');var _0x2385d4=_0x43cc('0x28')+_0x42fa22[_0x43cc('0x26')];return db[_0x43cc('0x29')][_0x43cc('0x2a')](_0x2385d4,{'type':db[_0x43cc('0x2b')][_0x43cc('0x2c')]['SELECT'],'raw':!![]})[_0x43cc('0x1c')](function(_0x49f2b9){if(_0x49f2b9){_0x42fa22[_0x43cc('0x2d')]=_0x49f2b9[0x0];}if(typeof _0x42fa22[_0x43cc('0x2e')]==='undefined')return;return getAgent(_0x42fa22['UserId']);})[_0x43cc('0x1c')](function(_0xfe347c){if(_0xfe347c){_0x42fa22[_0x43cc('0x3c')]=util[_0x43cc('0x2f')](_0x43cc('0x3d'),_0xfe347c[_0x43cc('0x30')]);_0x42fa22[_0x43cc('0x31')]=_0xfe347c;}return request({'event':_0x583f29,'message':_0x42fa22});})['catch'](function(_0x301d24){logger[_0x43cc('0x1f')](_0x43cc('0x1e'),_0x43cc('0x3e'),_0x301d24);});}};}function getAgent(_0x438703){return db[_0x43cc('0x3f')][_0x43cc('0x40')]({'where':{'id':_0x438703},'attributes':['id',_0x43cc('0x30'),_0x43cc('0x41'),_0x43cc('0x42'),_0x43cc('0x43')],'raw':!![]})[_0x43cc('0x1c')](function(_0x589a19){return _0x589a19;});}exports[_0x43cc('0x44')]=function(){for(var _0x52e290=0x0;_0x52e290=_0x1b9620['agents']){throw Error(_0x0405('0x13'));}_0x15f653(_0x34e2f8);})[_0x0405('0x14')](function(_0x230b63){_0x2d7a96(_0x230b63);});});}; \ No newline at end of file +var _0xdb5a=['role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','fax','sms','openchannel','isValidChannel','includes','clearBlockUser','blockedAt','updateAttributes','getLicense'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0xdb5a,0x12d));var _0xadb5=function(_0x44d389,_0x56d779){_0x44d389=_0x44d389-0x0;var _0x45a6c5=_0xdb5a[_0x44d389];return _0x45a6c5;};'use strict';var _=require(_0xadb5('0x0'));var BPromise=require(_0xadb5('0x1'));var db=require(_0xadb5('0x2'))['db'];var util=require(_0xadb5('0x3'));var channels=[_0xadb5('0x4'),'mail','chat',_0xadb5('0x5'),_0xadb5('0x6'),'whatsapp',_0xadb5('0x7')];exports['getChannels']=function(){return channels;};exports[_0xadb5('0x8')]=function(_0x6fdcbc){_0x6fdcbc=_0x6fdcbc['toLowerCase']();return _[_0xadb5('0x9')](channels,_0x6fdcbc);};exports[_0xadb5('0xa')]=function(_0x4832eb,_0x30977a,_0x4a1513,_0x2e8a5c){var _0x4375f3={'loginAttempts':_0x30977a,'blocked':_0x4a1513};if(!_['isUndefined'](_0x2e8a5c)){_0x4375f3[_0xadb5('0xb')]=_0x2e8a5c;}return _0x4832eb[_0xadb5('0xc')](_0x4375f3);};exports[_0xadb5('0xd')]=function(_0x9cc52c){return new BPromise(function(_0x532834,_0x305f7b){var _0x14ee73=0x0;if(_0x9cc52c[_0xadb5('0xe')]!=='agent'){_0x532834(_0x9cc52c);}db['User'][_0xadb5('0xf')]({'where':{'role':_0xadb5('0x10'),'online':!![],'id':{'$ne':_0x9cc52c['id']}}})[_0xadb5('0x11')](function(_0x28850d){_0x14ee73=_0x28850d;return util['getLicense']();})['then'](function(_0x37ac6f){if(_0x37ac6f&&_0x37ac6f[_0xadb5('0x12')]&&_0x14ee73>=_0x37ac6f[_0xadb5('0x12')]){throw Error(_0xadb5('0x13'));}_0x532834(_0x9cc52c);})[_0xadb5('0x14')](function(_0x4e5298){_0x305f7b(_0x4e5298);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 060f324..3d18155 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x462a=['name','Forbidden','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','OutOfInterval','Conflict','error','stack','statusMessage','exports','api','Internal\x20Server\x20Error','inherits','message','Bad\x20Request'];(function(_0x4e85eb,_0x27a8b0){var _0xa68701=function(_0x5bd845){while(--_0x5bd845){_0x4e85eb['push'](_0x4e85eb['shift']());}};_0xa68701(++_0x27a8b0);}(_0x462a,0xcb));var _0xa462=function(_0x4a2217,_0x9c653a){_0x4a2217=_0x4a2217-0x0;var _0x24cb1c=_0x462a[_0x4a2217];return _0x24cb1c;};'use strict';var util=require('util');var logger=require('../config/logger')(_0xa462('0x0'));var APIError=function(_0x5964bb,_0x43c575){this['message']=_0x5964bb||_0xa462('0x1');this['name']=_0x43c575||'Error';util[_0xa462('0x2')](APIError,Error);};var APIBadRequestError=function(_0x43b54c){this[_0xa462('0x3')]=_0x43b54c||_0xa462('0x4');this[_0xa462('0x5')]=_0xa462('0x4');util[_0xa462('0x2')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4dae46){this['message']=_0x4dae46||_0xa462('0x6');this[_0xa462('0x5')]='Forbidden';util[_0xa462('0x2')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x2ed733){this[_0xa462('0x3')]=_0x2ed733||_0xa462('0x7');this[_0xa462('0x5')]=_0xa462('0x8');util[_0xa462('0x2')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xaa4322){this[_0xa462('0x3')]=_0xaa4322||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xa462('0x5')]=_0xa462('0x9');this['code']=0x193;this['details']={'type':_0xa462('0xa')};util[_0xa462('0x2')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x42afc8){this['message']=_0x42afc8||'Resource\x20Conflict';this[_0xa462('0x5')]=_0xa462('0xb');util[_0xa462('0x2')](APIBadRequestError,APIError);};function getStatusCode(_0x95e031){switch(_0x95e031){case _0xa462('0x4'):return 0x190;case _0xa462('0x6'),'Out\x20Of\x20Interval':return 0x193;case _0xa462('0x8'):return 0x194;case _0xa462('0xb'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2d8729){if(_0x2d8729===_0xa462('0x9'))return _0x2d8729;return null;}function handleError(_0x4535c0){return function(_0x4c7f87){logger[_0xa462('0xc')](_0x4c7f87[_0xa462('0xd')]);var _0x697308=getStatusCode(_0x4c7f87['name']);var _0x304653=getCustomStatusMessage(_0x4c7f87['name']);if(_0x4c7f87[_0xa462('0x5')]){delete _0x4c7f87[_0xa462('0x5')];}if(_0x304653){_0x4535c0[_0xa462('0xe')]=_0x304653;}return _0x4535c0['status'](_0x697308)['send'](_0x4c7f87);};}module[_0xa462('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x20e2=['stack','statusMessage','send','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','message','Bad\x20Request','Forbidden','inherits','Not\x20Found','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','error'];(function(_0x3fe7fa,_0xa4f071){var _0x32d401=function(_0xe79eac){while(--_0xe79eac){_0x3fe7fa['push'](_0x3fe7fa['shift']());}};_0x32d401(++_0xa4f071);}(_0x20e2,0x1bd));var _0x220e=function(_0x541754,_0x57c3f8){_0x541754=_0x541754-0x0;var _0x52344f=_0x20e2[_0x541754];return _0x52344f;};'use strict';var util=require(_0x220e('0x0'));var logger=require(_0x220e('0x1'))(_0x220e('0x2'));var APIError=function(_0x3b7ad1,_0x5e2fe9){this['message']=_0x3b7ad1||_0x220e('0x3');this[_0x220e('0x4')]=_0x5e2fe9||_0x220e('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x3b4f49){this[_0x220e('0x6')]=_0x3b4f49||_0x220e('0x7');this[_0x220e('0x4')]=_0x220e('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3057db){this[_0x220e('0x6')]=_0x3057db||_0x220e('0x8');this[_0x220e('0x4')]=_0x220e('0x8');util[_0x220e('0x9')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1817c6){this[_0x220e('0x6')]=_0x1817c6||'Entity\x20not\x20found';this[_0x220e('0x4')]=_0x220e('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3eda7e){this[_0x220e('0x6')]=_0x3eda7e||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']=_0x220e('0xb');this[_0x220e('0xc')]=0x193;this[_0x220e('0xd')]={'type':'OutOfInterval'};util[_0x220e('0x9')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4c57c6){this[_0x220e('0x6')]=_0x4c57c6||_0x220e('0xe');this[_0x220e('0x4')]=_0x220e('0xf');util[_0x220e('0x9')](APIBadRequestError,APIError);};function getStatusCode(_0x10201){switch(_0x10201){case _0x220e('0x7'):return 0x190;case'Forbidden',_0x220e('0xb'):return 0x193;case _0x220e('0xa'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xa16006){if(_0xa16006===_0x220e('0xb'))return _0xa16006;return null;}function handleError(_0x2a2fb7){return function(_0x360104){logger[_0x220e('0x10')](_0x360104[_0x220e('0x11')]);var _0x240a74=getStatusCode(_0x360104[_0x220e('0x4')]);var _0xe86192=getCustomStatusMessage(_0x360104[_0x220e('0x4')]);if(_0x360104['name']){delete _0x360104[_0x220e('0x4')];}if(_0xe86192){_0x2a2fb7[_0x220e('0x12')]=_0xe86192;}return _0x2a2fb7['status'](_0x240a74)[_0x220e('0x13')](_0x360104);};}module[_0x220e('0x14')]={'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 9188138..1cec34a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1d3=['render','json','status'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xd1d3,0x68));var _0x3d1d=function(_0x2f5cbf,_0x3910c8){_0x2f5cbf=_0x2f5cbf-0x0;var _0xfccd3e=_0xd1d3[_0x2f5cbf];return _0xfccd3e;};'use strict';module['exports'][0x194]=function pageNotFound(_0xe5c66e,_0x34204c){var _0x501a91='404';var _0x50fc0b=0x194;var _0x184f71={'status':_0x50fc0b};_0x34204c[_0x3d1d('0x0')](_0x184f71['status']);_0x34204c[_0x3d1d('0x1')](_0x501a91,{},function(_0xaf1915,_0x5ed012){if(_0xaf1915){return _0x34204c[_0x3d1d('0x0')](_0x184f71[_0x3d1d('0x0')])[_0x3d1d('0x2')](_0x184f71);}_0x34204c['send'](_0x5ed012);});}; \ No newline at end of file +var _0xe65c=['exports','404','status','render','json','send'];(function(_0x3ceda0,_0x40e069){var _0x4f087c=function(_0x33c82c){while(--_0x33c82c){_0x3ceda0['push'](_0x3ceda0['shift']());}};_0x4f087c(++_0x40e069);}(_0xe65c,0x19e));var _0xce65=function(_0x3ab0ac,_0x1ea9cf){_0x3ab0ac=_0x3ab0ac-0x0;var _0x1f743d=_0xe65c[_0x3ab0ac];return _0x1f743d;};'use strict';module[_0xce65('0x0')][0x194]=function pageNotFound(_0xb5f4e,_0x2572d7){var _0x7dc233=_0xce65('0x1');var _0x48ad8f=0x194;var _0x39be2a={'status':_0x48ad8f};_0x2572d7['status'](_0x39be2a[_0xce65('0x2')]);_0x2572d7[_0xce65('0x3')](_0x7dc233,{},function(_0x4f98fb,_0x409997){if(_0x4f98fb){return _0x2572d7[_0xce65('0x2')](_0x39be2a[_0xce65('0x2')])[_0xce65('0x4')](_0x39be2a);}_0x2572d7[_0xce65('0x5')](_0x409997);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 61f54af..282c9a5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4600=['../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','Integration','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','Hoppers','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','FaxQueues','OpenchannelQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','ReportAgentPreview','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','ScreenRecording','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Messages','Interactions','List','TemplateId','user_has_mail_accounts','team_has_mail_queues','Teams','MailInteraction','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessage','ChatOfflineMessageId','DashboardItem','FaxAccountId','Exntensions','ListId','TagId','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','UserOpenchannelQueue','team_has_openchannel_queues','Answers','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','ChatProactiveAction','Contacts','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperId','Queue','OwnerId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','Trigger','AllCondition','AnyConditions','AnyCondition','Action','TriggerId','Fields','DefaultReportId','MetricId','SalesforceConfiguration','SalesforceField','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','VariableId','Configurations','AccountId','Field','ZohoField','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ChatQueueReport','FromId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','MailQueues','ChatQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','CampaignId','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CmCustomField','CustomFields','HopperHistory','Queues','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappAccount','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8mb4','name','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue'];(function(_0x5d1f17,_0x79a922){var _0xc80013=function(_0x377b66){while(--_0x377b66){_0x5d1f17['push'](_0x5d1f17['shift']());}};_0xc80013(++_0x79a922);}(_0x4600,0x191));var _0x0460=function(_0x539234,_0xbb7ffa){_0x539234=_0x539234-0x0;var _0x44b8cb=_0x4600[_0x539234];return _0x44b8cb;};'use strict';var config=require(_0x0460('0x0'));var Sequelize=require(_0x0460('0x1'));var _=require(_0x0460('0x2'));var jstz=require(_0x0460('0x3'));var timezone=jstz['determine']();config[_0x0460('0x1')]=_[_0x0460('0x4')](config[_0x0460('0x1')],{'database':_0x0460('0x5'),'username':_0x0460('0x6'),'password':_0x0460('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x0460('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x0460('0x9'),'collate':_0x0460('0xa')}}});config[_0x0460('0xb')]=_[_0x0460('0x4')](config[_0x0460('0xb')],{'database':_0x0460('0x5'),'username':_0x0460('0x6'),'password':_0x0460('0x7'),'options':{'host':_0x0460('0xc'),'port':0xcea,'dialect':_0x0460('0x8'),'dialectOptions':{'charset':_0x0460('0xd')},'logging':![],'timezone':timezone[_0x0460('0xe')](),'define':{'charset':'utf8','collate':_0x0460('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0460('0x1')][_0x0460('0xf')],config[_0x0460('0x1')]['username'],config[_0x0460('0x1')][_0x0460('0x10')],config[_0x0460('0x1')][_0x0460('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0460('0xb')][_0x0460('0xf')],config[_0x0460('0xb')][_0x0460('0x12')],config[_0x0460('0xb')]['password'],config[_0x0460('0xb')]['options'])};db[_0x0460('0x13')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x15'));db[_0x0460('0x16')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x17'));db[_0x0460('0x18')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x19'));db[_0x0460('0x1a')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0x0460('0x1b')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x1c'));db[_0x0460('0x1d')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x0460('0x1e')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x1f'));db[_0x0460('0x20')]=db[_0x0460('0x1')]['import']('../api/voiceMail/voiceMail.model');db[_0x0460('0x21')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x22'));db[_0x0460('0x23')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x24'));db[_0x0460('0x25')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x26'));db['VoiceAgentReport']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x27'));db['VoiceQueueReport']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x28'));db[_0x0460('0x29')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x2a'));db[_0x0460('0x2b')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x2c'));db[_0x0460('0x2d')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x2e'));db[_0x0460('0x2f')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x0460('0x30')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x31'));db[_0x0460('0x32')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x33'));db[_0x0460('0x34')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x35'));db[_0x0460('0x36')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x37'));db[_0x0460('0x38')]=db[_0x0460('0x1')]['import'](_0x0460('0x39'));db['UserOpenchannelQueue']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x3a'));db[_0x0460('0x3b')]=db[_0x0460('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x0460('0x3c')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x3d'));db['MailServerOut']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x3e'));db[_0x0460('0x3f')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x40'));db[_0x0460('0x41')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x42'));db[_0x0460('0x43')]=db[_0x0460('0x1')]['import'](_0x0460('0x44'));db['MailInteraction']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x45'));db[_0x0460('0x46')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x47'));db[_0x0460('0x48')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x49'));db[_0x0460('0x4a')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x4b'));db[_0x0460('0x4c')]=db['sequelize'][_0x0460('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x4d'));db[_0x0460('0x4e')]=db[_0x0460('0x1')]['import'](_0x0460('0x4f'));db[_0x0460('0x50')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x51'));db['FaxInteraction']=db[_0x0460('0x1')]['import'](_0x0460('0x52'));db[_0x0460('0x53')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/faxMessage/faxMessage.model');db[_0x0460('0x54')]=db['sequelize']['import'](_0x0460('0x55'));db[_0x0460('0x56')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0x0460('0x57')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/smsAccount/smsAccount.model');db[_0x0460('0x58')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/smsApplication/smsApplication.model');db[_0x0460('0x59')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0x0460('0x5a')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x5b'));db[_0x0460('0x5c')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x5d'));db['OpenchannelAccount']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x5e'));db['OpenchannelApplication']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x5f'));db[_0x0460('0x60')]=db[_0x0460('0x1')]['import'](_0x0460('0x61'));db['OpenchannelMessage']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x0460('0x62')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x63'));db['OpenchannelQueueReport']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x64'));db[_0x0460('0x65')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/chatApplication/chatApplication.model');db[_0x0460('0x66')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x0460('0x67')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x68'));db['ChatOfflineMessage']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x69'));db[_0x0460('0x6a')]=db[_0x0460('0x1')]['import'](_0x0460('0x6b'));db[_0x0460('0x6c')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x6d'));db['ChatProactiveAction']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x6e'));db[_0x0460('0x6f')]=db[_0x0460('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0x0460('0x70')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/cmContact/cmContact.model');db[_0x0460('0x71')]=db[_0x0460('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x0460('0x72')]=db[_0x0460('0x1')]['import'](_0x0460('0x73'));db[_0x0460('0x74')]=db['sequelize']['import'](_0x0460('0x75'));db['CmHopperHistory']=db['sequelize'][_0x0460('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x76'));db['CmCustomField']=db[_0x0460('0x1')]['import'](_0x0460('0x77'));db['Action']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x78'));db['Automation']=db[_0x0460('0x1')]['import'](_0x0460('0x79'));db[_0x0460('0x7a')]=db[_0x0460('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x0460('0x7b')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x7c'));db[_0x0460('0x7d')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x7e'));db[_0x0460('0x7f')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x80'));db[_0x0460('0x81')]=db[_0x0460('0x1')]['import'](_0x0460('0x82'));db[_0x0460('0x83')]=db['sequelize']['import'](_0x0460('0x84'));db[_0x0460('0x85')]=db[_0x0460('0x1')]['import'](_0x0460('0x86'));db[_0x0460('0x87')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/schedule/schedule.model');db[_0x0460('0x88')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/sound/sound.model');db['Tag']=db[_0x0460('0x1')]['import'](_0x0460('0x89'));db['ContactItemType']=db['sequelize'][_0x0460('0x14')]('../api/contactItemType/contactItemType.model');db[_0x0460('0x8a')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x8b'));db[_0x0460('0x8c')]=db[_0x0460('0x1')]['import'](_0x0460('0x8d'));db[_0x0460('0x8e')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x8f'));db['Trigger']=db[_0x0460('0x1')]['import'](_0x0460('0x90'));db[_0x0460('0x91')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x92'));db['Integration']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x93'));db['IntegrationReport']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/integrationReport/integrationReport.model');db[_0x0460('0x94')]=db[_0x0460('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x0460('0x95')]=db['sequelize']['import'](_0x0460('0x96'));db[_0x0460('0x97')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x98'));db['AnalyticMetric']=db[_0x0460('0x1')]['import'](_0x0460('0x99'));db[_0x0460('0x9a')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x9b'));db[_0x0460('0x9c')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x0460('0x9d')]=db['sequelize']['import'](_0x0460('0x9e'));db['SalesforceConfiguration']=db[_0x0460('0x1')]['import'](_0x0460('0x9f'));db['SalesforceField']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0460('0xa0')]=db[_0x0460('0x1')]['import'](_0x0460('0xa1'));db[_0x0460('0xa2')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xa3'));db[_0x0460('0xa4')]=db[_0x0460('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x0460('0xa5')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xa6'));db[_0x0460('0xa7')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xa8'));db[_0x0460('0xa9')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xaa'));db[_0x0460('0xab')]=db['sequelize'][_0x0460('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x0460('0xac')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x0460('0x1')]['import'](_0x0460('0xad'));db[_0x0460('0xae')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xaf'));db['ZendeskConfiguration']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xb0'));db[_0x0460('0xb1')]=db['sequelize'][_0x0460('0x14')](_0x0460('0xb2'));db['FreshdeskAccount']=db['sequelize']['import'](_0x0460('0xb3'));db['FreshdeskConfiguration']=db['sequelize']['import'](_0x0460('0xb4'));db[_0x0460('0xb5')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xb6'));db[_0x0460('0xb7')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x0460('0xb8')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xb9'));db[_0x0460('0xba')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xbb'));db[_0x0460('0xbc')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xbd'));db[_0x0460('0xbe')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x0460('0xbf')]=db[_0x0460('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x0460('0xc0')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0460('0xc1')]=db[_0x0460('0x1')]['import'](_0x0460('0xc2'));db[_0x0460('0xc3')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xc4'));db[_0x0460('0xc5')]=db['sequelize'][_0x0460('0x14')](_0x0460('0xc6'));db[_0x0460('0xc7')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x0460('0xc8')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x0460('0xc9')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0x0460('0x14')](_0x0460('0xca'));db['ChatQueueReport']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x0460('0xcb')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xcc'));db[_0x0460('0xcd')]=db['sequelize']['import'](_0x0460('0xce'));db['JscriptyQuestionReport']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xcf'));db['JscriptySessionReport']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x0460('0x1')]['import'](_0x0460('0xd0'));db[_0x0460('0xd1')]=db['sequelize'][_0x0460('0x14')](_0x0460('0xd2'));db['SquareDetailsReport']=db[_0x0460('0x1')]['import'](_0x0460('0xd3'));db[_0x0460('0xd4')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xd5'));db[_0x0460('0xd6')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/setting/setting.model');db[_0x0460('0xd7')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xd8'));db[_0x0460('0xd9')]=db[_0x0460('0x1')]['import'](_0x0460('0xda'));db[_0x0460('0xdb')]=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db[_0x0460('0xdc')]=db[_0x0460('0x1')]['import'](_0x0460('0xdd'));db['Team']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xde'));db['License']=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xdf'));db[_0x0460('0xe0')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xe1'));db[_0x0460('0xe2')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xe3'));db[_0x0460('0xe4')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xe5'));db['Plugin']=db[_0x0460('0x1')]['import']('../api/plugin/plugin.model');db[_0x0460('0xe6')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xe7'));db[_0x0460('0xe8')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xe9'));db[_0x0460('0xea')]=db['sequelize']['import'](_0x0460('0xeb'));db['OpenchannelTransferReport']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x0460('0xec')]=db[_0x0460('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x0460('0xed')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/cmList/cmList.model');db[_0x0460('0xee')]=db['sequelize'][_0x0460('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x0460('0xef')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0xf0'));db[_0x0460('0xf1')]=db['sequelize'][_0x0460('0x14')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x0460('0x1')][_0x0460('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x0460('0xf2')]=db['sequelize'][_0x0460('0x14')](_0x0460('0xf3'));db['WhatsappAccount']=db[_0x0460('0x1')]['import'](_0x0460('0xf4'));db[_0x0460('0xf5')]=db[_0x0460('0x1')]['import'](_0x0460('0xf6'));db[_0x0460('0xf7')]=db['sequelize'][_0x0460('0x14')](_0x0460('0xf8'));db[_0x0460('0xf9')]=db[_0x0460('0x1')]['import'](_0x0460('0xfa'));db[_0x0460('0xfb')]=db[_0x0460('0x1')]['import'](_0x0460('0xfc'));db[_0x0460('0xfd')]=db['sequelize'][_0x0460('0x14')](_0x0460('0xfe'));db[_0x0460('0xff')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x100'));db[_0x0460('0x101')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x102'));db[_0x0460('0x103')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x104'));db[_0x0460('0x105')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x106'));db[_0x0460('0x107')]=db[_0x0460('0x1')][_0x0460('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x0460('0x108')]=db['sequelize'][_0x0460('0x14')](_0x0460('0x109'));db[_0x0460('0x10a')]=db[_0x0460('0x1')][_0x0460('0x14')](_0x0460('0x10b'));db['User'][_0x0460('0x10c')](db[_0x0460('0x20')],{'as':_0x0460('0x20'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')][_0x0460('0x10c')](db[_0x0460('0x108')],{'as':_0x0460('0x10f'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')]['hasMany'](db[_0x0460('0x1e')],{'as':_0x0460('0x110'),'foreignKey':'UserId'});db[_0x0460('0x13')][_0x0460('0x111')](db[_0x0460('0x2f')],{'as':_0x0460('0x112'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')][_0x0460('0x111')](db['VoiceExtension'],{'as':_0x0460('0x113'),'onDelete':'cascade','hooks':!![]});db['User'][_0x0460('0x111')](db[_0x0460('0x74')],{'as':_0x0460('0x114'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')][_0x0460('0x111')](db[_0x0460('0x115')],{'as':'HopperHistory','foreignKey':'UserId'});db['User']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x0460('0x13')][_0x0460('0x111')](db[_0x0460('0x60')],{'as':_0x0460('0x116'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x0460('0x66')],{'as':_0x0460('0x117'),'foreignKey':'UserId'});db[_0x0460('0x13')][_0x0460('0x111')](db[_0x0460('0x59')],{'as':_0x0460('0x118'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')][_0x0460('0x111')](db[_0x0460('0x119')],{'as':_0x0460('0x11a'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')]['hasMany'](db['MailInteraction'],{'as':_0x0460('0x11b'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')][_0x0460('0x111')](db[_0x0460('0xf7')],{'as':'WhatsappInteractions','foreignKey':_0x0460('0x10e')});db[_0x0460('0x13')]['hasMany'](db[_0x0460('0xf2')],{'as':_0x0460('0x11c'),'foreignKey':'SenderId'});db['User']['hasMany'](db[_0x0460('0x71')],{'as':_0x0460('0x11d'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x0460('0x13')][_0x0460('0x11e')](db[_0x0460('0xef')],{'as':_0x0460('0xef'),'foreignKey':_0x0460('0x11f')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x0460('0x120'),'through':_0x0460('0x121')});db[_0x0460('0x13')]['belongsToMany'](db[_0x0460('0x70')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0xed')],{'as':'Lists','through':_0x0460('0x123')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x124')],{'through':_0x0460('0x125')});db[_0x0460('0x13')][_0x0460('0x122')](db['MailInteraction'],{'as':_0x0460('0x11b'),'through':_0x0460('0x126')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x66')],{'as':'ChatInteractions','through':_0x0460('0x127')});db[_0x0460('0x13')]['belongsToMany'](db[_0x0460('0x119')],{'as':_0x0460('0x11a'),'through':_0x0460('0x128')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x59')],{'as':_0x0460('0x118'),'through':'user_has_sms_interactions'});db[_0x0460('0x13')]['belongsToMany'](db[_0x0460('0x60')],{'as':_0x0460('0x116'),'through':_0x0460('0x129')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0xf7')],{'as':'WhatsappInteractions','through':_0x0460('0x12a')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x1d')],{'as':_0x0460('0x12b'),'through':_0x0460('0x30'),'required':![]});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0xee')],{'as':_0x0460('0x12c'),'through':_0x0460('0x107'),'required':![]});db[_0x0460('0x13')][_0x0460('0x122')](db['MailQueue'],{'as':'MailQueues','through':_0x0460('0x34'),'required':![]});db[_0x0460('0x13')]['belongsToMany'](db[_0x0460('0x6a')],{'as':'ChatQueues','through':_0x0460('0x32'),'required':![],'hooks':!![]});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x54')],{'as':_0x0460('0x12d'),'through':_0x0460('0x36'),'required':![]});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x5c')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x0460('0x13')]['belongsToMany'](db[_0x0460('0x12e')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x0460('0x13')]['belongsToMany'](db[_0x0460('0xff')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0xed')],{'through':_0x0460('0x123')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x62')],{'as':_0x0460('0x12f'),'through':_0x0460('0x130')});db['User'][_0x0460('0x122')](db['FaxAccount'],{'as':_0x0460('0x131'),'through':_0x0460('0x132')});db[_0x0460('0x13')][_0x0460('0x122')](db[_0x0460('0x3f')],{'as':_0x0460('0x133'),'through':'user_has_mail_accounts'});db['User'][_0x0460('0x122')](db[_0x0460('0x134')],{'as':_0x0460('0x135'),'through':_0x0460('0x136')});db[_0x0460('0x13')]['belongsToMany'](db['SmsAccount'],{'as':_0x0460('0x137'),'through':_0x0460('0x138')});db[_0x0460('0x13')][_0x0460('0x122')](db['WhatsappAccount'],{'as':_0x0460('0x139'),'through':_0x0460('0x13a')});db[_0x0460('0x16')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x0460('0x18')][_0x0460('0x111')](db[_0x0460('0x1a')],{'onDelete':_0x0460('0x10d')});db[_0x0460('0x1a')][_0x0460('0x111')](db['VoiceExtension'],{'as':_0x0460('0x13b'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x1b')][_0x0460('0x122')](db[_0x0460('0x88')],{'as':_0x0460('0x13c'),'through':_0x0460('0x13d')});db['VoiceQueue'][_0x0460('0x111')](db[_0x0460('0x2f')],{'as':_0x0460('0x13e'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x111')](db[_0x0460('0x71')],{'as':_0x0460('0x11d'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x111')](db['CmHopperFinal'],{'as':_0x0460('0x114'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x111')](db[_0x0460('0x115')],{'as':_0x0460('0x140'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x111')](db[_0x0460('0x141')],{'as':_0x0460('0x141'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x111')](db['CmHopperBlack'],{'as':_0x0460('0x142'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x111')](db[_0x0460('0x143')],{'as':_0x0460('0x144'),'foreignKey':_0x0460('0x13f')});db[_0x0460('0x1d')][_0x0460('0x11e')](db[_0x0460('0x2b')],{'as':_0x0460('0x2b'),'foreignKey':_0x0460('0x145')});db[_0x0460('0x1d')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x0460('0x146')});db[_0x0460('0x1d')][_0x0460('0x11e')](db[_0x0460('0x7f')],{'as':_0x0460('0x7f'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x1d')][_0x0460('0x11e')](db[_0x0460('0x81')],{'as':_0x0460('0x148'),'foreignKey':_0x0460('0x149')});db[_0x0460('0x1d')][_0x0460('0x122')](db[_0x0460('0xed')],{'as':_0x0460('0x14a'),'through':_0x0460('0x14b')});db[_0x0460('0x1d')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x30')});db['VoiceQueue'][_0x0460('0x122')](db[_0x0460('0x124')],{'as':'Teams','through':_0x0460('0x103')});db[_0x0460('0x1d')]['belongsToMany'](db[_0x0460('0xed')],{'as':_0x0460('0x14d'),'through':'voice_queues_has_cm_blacklists'});db[_0x0460('0x1e')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x13'),'foreignKey':'UserId'});db[_0x0460('0x14e')]['belongsTo'](db[_0x0460('0x13')],{'as':_0x0460('0x13'),'foreignKey':_0x0460('0x10e')});db['VoiceMail'][_0x0460('0x111')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0460('0x14f'),'sourceKey':_0x0460('0x150')});db['VoiceMailMessage']['belongsTo'](db[_0x0460('0x20')],{'foreignKey':_0x0460('0x14f'),'targetKey':_0x0460('0x150')});db[_0x0460('0x23')]['hasMany'](db[_0x0460('0x151')],{'as':'QueueCalls','foreignKey':_0x0460('0x152'),'constraints':![]});db[_0x0460('0x23')]['hasMany'](db['VoiceAgentReport'],{'as':_0x0460('0x153'),'foreignKey':_0x0460('0x152'),'constraints':![]});db[_0x0460('0x23')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x13'),'foreignKey':_0x0460('0x10e')});db['VoiceCallReport'][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x3c')][_0x0460('0x11e')](db[_0x0460('0x3f')],{'as':'MailAccount','foreignKey':_0x0460('0x156')});db[_0x0460('0x3c')][_0x0460('0x11e')](db[_0x0460('0x101')],{'as':_0x0460('0x101'),'foreignKey':_0x0460('0x157'),'onDelete':_0x0460('0x158')});db['MailServerOut'][_0x0460('0x11e')](db[_0x0460('0x3f')],{'as':_0x0460('0x3f'),'foreignKey':_0x0460('0x156')});db['MailServerOut'][_0x0460('0x11e')](db[_0x0460('0x101')],{'as':_0x0460('0x101'),'foreignKey':'CloudProviderId','onDelete':_0x0460('0x158')});db[_0x0460('0x3f')][_0x0460('0x10c')](db[_0x0460('0x3c')],{'as':_0x0460('0x159'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x3f')][_0x0460('0x10c')](db['MailServerOut'],{'as':_0x0460('0x15a'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x3f')]['hasMany'](db[_0x0460('0x7b')],{'as':_0x0460('0x15b'),'foreignKey':_0x0460('0x156'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x3f')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x0460('0x156')});db[_0x0460('0x3f')][_0x0460('0x111')](db['MailMessage'],{'as':_0x0460('0x15c'),'foreignKey':_0x0460('0x156')});db[_0x0460('0x3f')][_0x0460('0x111')](db['MailInteraction'],{'as':_0x0460('0x15d')});db[_0x0460('0x3f')]['hasMany'](db[_0x0460('0x48')],{'as':'Applications','foreignKey':'MailAccountId','onDelete':_0x0460('0x10d')});db[_0x0460('0x3f')]['belongsTo'](db[_0x0460('0xed')],{'as':_0x0460('0x15e'),'foreignKey':'ListId'});db['MailAccount'][_0x0460('0x11e')](db[_0x0460('0x8e')],{'as':_0x0460('0x8e'),'foreignKey':_0x0460('0x15f')});db[_0x0460('0x3f')][_0x0460('0x11e')](db[_0x0460('0x81')],{'as':_0x0460('0x148'),'foreignKey':_0x0460('0x149')});db[_0x0460('0x3f')]['belongsToMany'](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x160')});db[_0x0460('0x41')]['belongsToMany'](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x34')});db[_0x0460('0x41')][_0x0460('0x122')](db[_0x0460('0x124')],{'through':_0x0460('0x161'),'as':_0x0460('0x162')});db['MailInteraction'][_0x0460('0x111')](db['MailMessage'],{'as':_0x0460('0x15c'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x0460('0x163')][_0x0460('0x11e')](db[_0x0460('0x3f')],{'as':_0x0460('0x164'),'foreignKey':'MailAccountId'});db[_0x0460('0x163')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':'ContactId'});db[_0x0460('0x163')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x165'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x163')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x167'),'as':_0x0460('0x168')});db['MailInteraction']['belongsToMany'](db[_0x0460('0x166')],{'through':_0x0460('0x167'),'as':_0x0460('0x169')});db['MailInteraction']['belongsToMany'](db[_0x0460('0x13')],{'as':_0x0460('0x16a'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0x0460('0xe4')],{'as':_0x0460('0x16b'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x46')][_0x0460('0x11e')](db['User'],{'as':_0x0460('0x13')});db[_0x0460('0x46')][_0x0460('0x11e')](db['CmContact'],{'onDelete':'cascade','as':_0x0460('0x154')});db[_0x0460('0x46')]['belongsTo'](db[_0x0460('0x163')],{'as':_0x0460('0x16c'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0460('0x11e')](db[_0x0460('0x3f')],{'as':'Account','foreignKey':_0x0460('0x156')});db[_0x0460('0x46')][_0x0460('0x11e')](db[_0x0460('0x62')],{'as':_0x0460('0x62'),'foreignKey':'ChatWebsiteId'});db[_0x0460('0x46')][_0x0460('0x11e')](db['ChatOfflineMessage'],{'as':_0x0460('0x16d'),'foreignKey':_0x0460('0x16e')});db[_0x0460('0x48')][_0x0460('0x11e')](db['User'],{'onDelete':_0x0460('0x158')});db[_0x0460('0x48')][_0x0460('0x11e')](db[_0x0460('0x41')],{'onDelete':'restrict'});db[_0x0460('0x48')][_0x0460('0x11e')](db[_0x0460('0x3f')],{'onDelete':_0x0460('0x158')});db[_0x0460('0x48')]['belongsTo'](db['Interval'],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x48')][_0x0460('0x11e')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x0460('0x4a')]['belongsTo'](db[_0x0460('0x3f')],{});db[_0x0460('0x4a')][_0x0460('0x11e')](db['CmList'],{'as':_0x0460('0x15e'),'foreignKey':'ListId'});db[_0x0460('0x4a')]['belongsTo'](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db['MailQueueReport'][_0x0460('0x11e')](db[_0x0460('0x163')],{});db[_0x0460('0x4a')]['belongsTo'](db[_0x0460('0x46')],{});db[_0x0460('0x4a')]['belongsTo'](db[_0x0460('0x13')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0x0460('0x4c')][_0x0460('0x111')](db[_0x0460('0x16f')],{'as':'Items','onDelete':_0x0460('0x10d')});db['FaxAccount']['hasMany'](db[_0x0460('0x7b')],{'as':_0x0460('0x15b'),'foreignKey':_0x0460('0x170'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x4e')][_0x0460('0x111')](db[_0x0460('0x7a')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x0460('0x4e')][_0x0460('0x111')](db[_0x0460('0x119')],{'as':_0x0460('0x15d')});db[_0x0460('0x4e')][_0x0460('0x111')](db[_0x0460('0x50')],{'as':_0x0460('0x13b'),'foreignKey':_0x0460('0x170'),'onDelete':_0x0460('0x10d')});db['FaxAccount'][_0x0460('0x111')](db[_0x0460('0x1a')],{'as':_0x0460('0x171'),'onDelete':_0x0460('0x10d')});db['FaxAccount'][_0x0460('0x111')](db['FaxMessage'],{'as':_0x0460('0x15c')});db['FaxAccount'][_0x0460('0x11e')](db[_0x0460('0x2b')],{'as':_0x0460('0x2b')});db[_0x0460('0x4e')][_0x0460('0x11e')](db['CmList'],{'as':_0x0460('0x15e'),'foreignKey':_0x0460('0x172')});db[_0x0460('0x4e')][_0x0460('0x11e')](db[_0x0460('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x0460('0x149')});db['FaxAccount'][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':'user_has_fax_accounts'});db[_0x0460('0x50')][_0x0460('0x11e')](db[_0x0460('0x13')],{'onDelete':_0x0460('0x158')});db[_0x0460('0x50')][_0x0460('0x11e')](db[_0x0460('0x54')],{'onDelete':_0x0460('0x158')});db[_0x0460('0x50')][_0x0460('0x11e')](db['FaxAccount'],{'onDelete':_0x0460('0x158')});db[_0x0460('0x50')][_0x0460('0x11e')](db[_0x0460('0x166')],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x173')});db[_0x0460('0x119')][_0x0460('0x111')](db[_0x0460('0x53')],{'as':_0x0460('0x15c'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x174')});db[_0x0460('0x119')][_0x0460('0x11e')](db[_0x0460('0x4e')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x170')});db[_0x0460('0x119')][_0x0460('0x11e')](db['CmContact'],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x119')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x165'),'foreignKey':'UserId'});db[_0x0460('0x119')][_0x0460('0x122')](db['Tag'],{'through':_0x0460('0x175'),'as':_0x0460('0x168')});db[_0x0460('0x119')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':'fax_interaction_has_tags','as':_0x0460('0x169')});db['FaxInteraction'][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x16a'),'through':_0x0460('0x128'),'foreignKey':_0x0460('0x174')});db[_0x0460('0x53')]['belongsTo'](db[_0x0460('0x13')],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x13')});db[_0x0460('0x53')]['belongsTo'](db[_0x0460('0x119')],{'as':'Interaction','foreignKey':_0x0460('0x174')});db[_0x0460('0x53')][_0x0460('0x11e')](db[_0x0460('0x70')],{'onDelete':'cascade','as':_0x0460('0x154')});db['FaxMessage'][_0x0460('0x11e')](db[_0x0460('0xe4')],{'as':_0x0460('0xe4'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x0460('0x11e')](db['FaxAccount'],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x170')});db[_0x0460('0x54')][_0x0460('0x122')](db['User'],{'as':_0x0460('0x14c'),'through':_0x0460('0x36')});db[_0x0460('0x54')][_0x0460('0x122')](db[_0x0460('0x124')],{'through':_0x0460('0x176'),'as':'Teams'});db['FaxQueueReport'][_0x0460('0x11e')](db[_0x0460('0x4e')],{});db[_0x0460('0x56')][_0x0460('0x11e')](db[_0x0460('0xed')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x56')]['belongsTo'](db[_0x0460('0x119')],{});db[_0x0460('0x56')][_0x0460('0x11e')](db[_0x0460('0x53')],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x0460('0x11e')](db['FaxQueue'],{});db[_0x0460('0x57')][_0x0460('0x111')](db['Disposition'],{'as':_0x0460('0x15b'),'foreignKey':'SmsAccountId','onDelete':_0x0460('0x10d')});db[_0x0460('0x57')][_0x0460('0x111')](db[_0x0460('0x7a')],{'as':'Answers','foreignKey':_0x0460('0x177')});db['SmsAccount'][_0x0460('0x111')](db[_0x0460('0x5a')],{'as':_0x0460('0x15c'),'foreignKey':_0x0460('0x177')});db['SmsAccount'][_0x0460('0x111')](db[_0x0460('0x59')],{'as':_0x0460('0x15d')});db[_0x0460('0x57')]['hasMany'](db[_0x0460('0x58')],{'as':_0x0460('0x13b'),'foreignKey':_0x0460('0x177'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x57')]['belongsTo'](db['CmList'],{'as':_0x0460('0x15e'),'foreignKey':'ListId'});db[_0x0460('0x57')][_0x0460('0x11e')](db[_0x0460('0x81')],{'as':_0x0460('0x148'),'foreignKey':_0x0460('0x149')});db[_0x0460('0x57')]['belongsToMany'](db['User'],{'as':_0x0460('0x14c'),'through':'user_has_sms_accounts'});db[_0x0460('0x58')]['belongsTo'](db[_0x0460('0x13')],{'onDelete':_0x0460('0x158')});db[_0x0460('0x58')][_0x0460('0x11e')](db['SmsQueue'],{'onDelete':_0x0460('0x158')});db['SmsApplication'][_0x0460('0x11e')](db['SmsAccount'],{'onDelete':_0x0460('0x158')});db['SmsApplication']['belongsTo'](db[_0x0460('0x7f')],{'onDelete':_0x0460('0x158'),'foreignKey':'IntervalId'});db[_0x0460('0x58')][_0x0460('0x11e')](db[_0x0460('0x166')],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x173')});db[_0x0460('0x59')][_0x0460('0x111')](db[_0x0460('0x5a')],{'as':'Messages','onDelete':_0x0460('0x10d'),'foreignKey':'SmsInteractionId'});db[_0x0460('0x59')][_0x0460('0x11e')](db[_0x0460('0x57')],{'as':_0x0460('0x164'),'foreignKey':'SmsAccountId'});db[_0x0460('0x59')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x59')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x165'),'foreignKey':'UserId'});db[_0x0460('0x59')][_0x0460('0x122')](db['Tag'],{'through':_0x0460('0x178'),'as':_0x0460('0x168')});db[_0x0460('0x59')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x178'),'as':_0x0460('0x169')});db[_0x0460('0x59')][_0x0460('0x122')](db['User'],{'as':_0x0460('0x16a'),'through':_0x0460('0x179'),'foreignKey':_0x0460('0x17a')});db[_0x0460('0x5a')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x13')});db['SmsMessage'][_0x0460('0x11e')](db[_0x0460('0x70')],{'onDelete':'cascade','as':_0x0460('0x154')});db[_0x0460('0x5a')][_0x0460('0x11e')](db['SmsInteraction'],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x16c'),'foreignKey':_0x0460('0x17a')});db[_0x0460('0x5a')][_0x0460('0x11e')](db[_0x0460('0x57')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x177')});db['SmsQueue']['belongsToMany'](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x38'),'foreignKey':_0x0460('0x17b')});db['SmsQueue'][_0x0460('0x122')](db[_0x0460('0x124')],{'through':_0x0460('0x17c'),'as':'Teams'});db['OpenchannelAccount'][_0x0460('0x111')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x0460('0x17d'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x134')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x0460('0x17d')});db[_0x0460('0x134')][_0x0460('0x111')](db[_0x0460('0x60')],{'as':_0x0460('0x15d'),'foreignKey':_0x0460('0x17d')});db[_0x0460('0x134')][_0x0460('0x111')](db[_0x0460('0x17e')],{'as':_0x0460('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x0460('0x134')][_0x0460('0x111')](db[_0x0460('0x17f')],{'as':_0x0460('0x13b'),'foreignKey':'OpenchannelAccountId','onDelete':_0x0460('0x10d')});db[_0x0460('0x134')]['belongsTo'](db[_0x0460('0xed')],{'as':_0x0460('0x15e'),'foreignKey':_0x0460('0x172')});db[_0x0460('0x134')]['belongsTo'](db[_0x0460('0x81')],{'as':_0x0460('0x148'),'foreignKey':_0x0460('0x149')});db[_0x0460('0x134')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':'Agents','through':_0x0460('0x136')});db[_0x0460('0x17f')][_0x0460('0x11e')](db[_0x0460('0x13')],{'onDelete':_0x0460('0x158')});db[_0x0460('0x17f')][_0x0460('0x11e')](db[_0x0460('0x12e')],{'onDelete':_0x0460('0x158'),'foreignKey':'OpenchannelQueueId'});db[_0x0460('0x17f')]['belongsTo'](db[_0x0460('0x134')],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x17d')});db[_0x0460('0x17f')]['belongsTo'](db[_0x0460('0x7f')],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x17f')][_0x0460('0x11e')](db['Tag'],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x173')});db[_0x0460('0x60')][_0x0460('0x111')](db[_0x0460('0x17e')],{'as':_0x0460('0x15c'),'onDelete':_0x0460('0x10d'),'foreignKey':'OpenchannelInteractionId'});db[_0x0460('0x60')][_0x0460('0x11e')](db[_0x0460('0x134')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x17d')});db[_0x0460('0x60')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x60')]['belongsTo'](db[_0x0460('0x13')],{'as':'Owner','foreignKey':_0x0460('0x10e')});db[_0x0460('0x60')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x180'),'as':_0x0460('0x168')});db['OpenchannelInteraction'][_0x0460('0x122')](db[_0x0460('0x166')],{'through':'openchannel_interaction_has_tags','as':_0x0460('0x169')});db[_0x0460('0x60')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x16a'),'through':_0x0460('0x129'),'foreignKey':_0x0460('0x181')});db[_0x0460('0x17e')]['belongsTo'](db[_0x0460('0x13')],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x13')});db['OpenchannelMessage']['belongsTo'](db[_0x0460('0x70')],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x154')});db[_0x0460('0x17e')][_0x0460('0x11e')](db['OpenchannelInteraction'],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x16c'),'foreignKey':_0x0460('0x181')});db[_0x0460('0x17e')][_0x0460('0x11e')](db[_0x0460('0xe4')],{'as':_0x0460('0xe4'),'foreignKey':_0x0460('0x182')});db[_0x0460('0x17e')][_0x0460('0x11e')](db['OpenchannelAccount'],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x17d')});db[_0x0460('0x12e')][_0x0460('0x122')](db['User'],{'as':_0x0460('0x14c'),'through':_0x0460('0x183'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x0460('0x122')](db['Team'],{'through':_0x0460('0x184'),'as':_0x0460('0x162')});db['ChatWebsite'][_0x0460('0x111')](db[_0x0460('0x7b')],{'as':_0x0460('0x15b'),'foreignKey':'ChatWebsiteId','onDelete':_0x0460('0x10d')});db[_0x0460('0x62')][_0x0460('0x111')](db[_0x0460('0x7a')],{'as':_0x0460('0x185'),'foreignKey':_0x0460('0x186')});db['ChatWebsite'][_0x0460('0x111')](db['ChatProactiveAction'],{'as':_0x0460('0x187')});db[_0x0460('0x62')][_0x0460('0x111')](db[_0x0460('0x66')],{'as':_0x0460('0x15d')});db[_0x0460('0x62')][_0x0460('0x111')](db['ChatApplication'],{'as':'Applications','foreignKey':_0x0460('0x186'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x62')]['hasMany'](db[_0x0460('0x67')],{'as':_0x0460('0x15c')});db[_0x0460('0x62')][_0x0460('0x11e')](db[_0x0460('0xed')],{'as':_0x0460('0x15e'),'foreignKey':_0x0460('0x172')});db['ChatWebsite']['belongsTo'](db[_0x0460('0x7f')],{'as':_0x0460('0x7f'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x62')][_0x0460('0x11e')](db[_0x0460('0x3f')],{'as':_0x0460('0x3f'),'foreignKey':_0x0460('0x156')});db[_0x0460('0x62')][_0x0460('0x11e')](db['Pause'],{'as':_0x0460('0x148'),'foreignKey':_0x0460('0x149')});db[_0x0460('0x62')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':'Agents','through':_0x0460('0x130')});db[_0x0460('0x188')]['belongsTo'](db[_0x0460('0x134')],{});db['OpenchannelQueueReport'][_0x0460('0x11e')](db[_0x0460('0xed')],{'as':_0x0460('0x15e'),'foreignKey':'ListId'});db[_0x0460('0x188')]['belongsTo'](db[_0x0460('0x70')],{'as':'Contact','foreignKey':_0x0460('0x155')});db[_0x0460('0x188')][_0x0460('0x11e')](db[_0x0460('0x60')],{});db[_0x0460('0x188')][_0x0460('0x11e')](db[_0x0460('0x17e')],{});db['OpenchannelQueueReport'][_0x0460('0x11e')](db[_0x0460('0x13')],{});db['OpenchannelQueueReport'][_0x0460('0x11e')](db['OpenchannelQueue'],{});db[_0x0460('0x65')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x189'),'foreignKey':_0x0460('0x10e'),'onDelete':_0x0460('0x158')});db[_0x0460('0x65')]['belongsTo'](db['ChatQueue'],{'as':'Queue','foreignKey':_0x0460('0x18a'),'onDelete':_0x0460('0x158')});db[_0x0460('0x65')][_0x0460('0x11e')](db[_0x0460('0x62')],{'as':_0x0460('0x18b'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x0460('0x65')][_0x0460('0x11e')](db['Tag'],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x173')});db[_0x0460('0x66')][_0x0460('0x111')](db[_0x0460('0x67')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0460('0x18c')});db[_0x0460('0x66')][_0x0460('0x11e')](db[_0x0460('0x62')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x186')});db[_0x0460('0x66')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x66')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x165'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x66')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':'chat_interaction_has_tags','as':'Tags'});db['ChatInteraction'][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x18d'),'as':_0x0460('0x169')});db[_0x0460('0x66')]['belongsToMany'](db[_0x0460('0x13')],{'as':'Users','through':_0x0460('0x127'),'foreignKey':_0x0460('0x18c')});db[_0x0460('0x67')][_0x0460('0x11e')](db[_0x0460('0x13')],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x13')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0460('0x155')});db[_0x0460('0x67')][_0x0460('0x11e')](db['ChatInteraction'],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x16c'),'foreignKey':_0x0460('0x18c')});db[_0x0460('0x67')][_0x0460('0x11e')](db[_0x0460('0xe4')],{'as':_0x0460('0xe4'),'foreignKey':'AttachmentId'});db[_0x0460('0x67')]['belongsTo'](db[_0x0460('0x62')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x186')});db['ChatOfflineMessage'][_0x0460('0x111')](db[_0x0460('0xe4')],{'as':_0x0460('0x16b'),'foreignKey':_0x0460('0x16e'),'onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x16d')][_0x0460('0x11e')](db[_0x0460('0x70')],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x154'),'foreignKey':'ContactId'});db[_0x0460('0x16d')][_0x0460('0x11e')](db[_0x0460('0x62')],{'as':_0x0460('0x164'),'foreignKey':'ChatWebsiteId'});db[_0x0460('0x6a')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x32'),'hooks':!![]});db[_0x0460('0x6a')][_0x0460('0x122')](db[_0x0460('0x124')],{'through':_0x0460('0x18e'),'as':'Teams'});db['ChatGroup'][_0x0460('0x111')](db[_0x0460('0xcb')],{'as':_0x0460('0x15c'),'foreignKey':_0x0460('0x18f'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x6c')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x13e'),'through':_0x0460('0x121')});db[_0x0460('0x190')][_0x0460('0x11e')](db[_0x0460('0x62')],{'as':_0x0460('0x18b'),'foreignKey':_0x0460('0x186')});db[_0x0460('0x6f')][_0x0460('0x111')](db['CmContact'],{'as':_0x0460('0x191'),'foreignKey':_0x0460('0x192')});db[_0x0460('0x70')]['hasMany'](db['CmContactHasItem'],{'as':_0x0460('0x193'),'foreignKey':_0x0460('0x194')});db['CmContact']['hasMany'](db[_0x0460('0x71')],{'as':'Hoppers','foreignKey':_0x0460('0x155')});db[_0x0460('0x70')][_0x0460('0x111')](db[_0x0460('0x74')],{'as':_0x0460('0x114'),'foreignKey':'ContactId'});db['CmContact'][_0x0460('0x111')](db['CmHopperHistory'],{'as':_0x0460('0x140'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x70')]['hasMany'](db[_0x0460('0x141')],{'as':_0x0460('0x141'),'foreignKey':_0x0460('0x155')});db[_0x0460('0x70')][_0x0460('0x111')](db[_0x0460('0x143')],{'as':_0x0460('0x144'),'foreignKey':_0x0460('0x155')});db['CmContact']['hasMany'](db[_0x0460('0x60')],{'as':_0x0460('0x116'),'foreignKey':_0x0460('0x155'),'onDelete':_0x0460('0x158')});db[_0x0460('0x70')]['hasMany'](db[_0x0460('0x66')],{'as':_0x0460('0x117'),'foreignKey':_0x0460('0x155'),'onDelete':_0x0460('0x158')});db[_0x0460('0x70')][_0x0460('0x111')](db[_0x0460('0x59')],{'as':'SmsInteractions','foreignKey':_0x0460('0x155'),'onDelete':_0x0460('0x158')});db['CmContact'][_0x0460('0x111')](db[_0x0460('0x119')],{'as':_0x0460('0x11a'),'foreignKey':_0x0460('0x155'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x0460('0x163')],{'as':'MailInteractions','foreignKey':_0x0460('0x155'),'onDelete':'restrict'});db[_0x0460('0x70')][_0x0460('0x11e')](db[_0x0460('0x6f')],{'as':_0x0460('0x195'),'foreignKey':'CompanyId'});db[_0x0460('0x70')][_0x0460('0x11e')](db[_0x0460('0xed')],{'as':_0x0460('0x15e'),'foreignKey':'ListId','onDelete':_0x0460('0x10d')});db['CmContact'][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x16a'),'through':_0x0460('0x196')});db[_0x0460('0x70')]['belongsToMany'](db[_0x0460('0x166')],{'as':_0x0460('0x168'),'through':'cm_contact_has_tags'});db[_0x0460('0x70')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x197'),'as':'ThroughTags'});db[_0x0460('0x71')][_0x0460('0x111')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x0460('0x198')});db[_0x0460('0x71')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x71')][_0x0460('0x11e')](db[_0x0460('0xed')],{'as':'List','foreignKey':_0x0460('0x172'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x71')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x189'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0x71')][_0x0460('0x11e')](db[_0x0460('0x1d')],{'as':_0x0460('0x199'),'foreignKey':_0x0460('0x13f'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x71')][_0x0460('0x11e')](db[_0x0460('0xe0')],{'as':_0x0460('0xe0'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x0460('0x71')][_0x0460('0x11e')](db['User'],{'as':_0x0460('0x165'),'foreignKey':_0x0460('0x19a')});db['CmHopperBlack']['belongsTo'](db['CmContact'],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155'),'onDelete':_0x0460('0x10d')});db['CmHopperBlack'][_0x0460('0x11e')](db['CmList'],{'as':'List','foreignKey':_0x0460('0x172'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x72')][_0x0460('0x11e')](db[_0x0460('0x1d')],{'as':'Queue','foreignKey':_0x0460('0x13f'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x72')][_0x0460('0x11e')](db[_0x0460('0xe0')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x0460('0x19b')][_0x0460('0x111')](db[_0x0460('0x7d')],{'as':{'plural':_0x0460('0x19c'),'singular':_0x0460('0x19d')},'foreignKey':_0x0460('0x19e'),'onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x19b')][_0x0460('0x111')](db[_0x0460('0x7d')],{'as':{'plural':_0x0460('0x19f'),'singular':_0x0460('0x1a0')},'foreignKey':_0x0460('0x1a1'),'onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x19b')][_0x0460('0x111')](db['Action'],{'as':_0x0460('0x1a2'),'foreignKey':'AutomationId','onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x7b')]['hasMany'](db['Disposition'],{'as':_0x0460('0x15b'),'foreignKey':_0x0460('0x1a3'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x7f')][_0x0460('0x111')](db[_0x0460('0x7f')],{'as':_0x0460('0x1a4'),'foreignKey':_0x0460('0x147'),'onDelete':_0x0460('0x10d'),'hooks':!![],'required':![]});db[_0x0460('0x7f')][_0x0460('0x111')](db[_0x0460('0x1a')],{'as':_0x0460('0x113'),'foreignKey':_0x0460('0x147'),'onDelete':_0x0460('0x158')});db['Interval'][_0x0460('0x111')](db[_0x0460('0x48')],{'as':_0x0460('0x1a5'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x7f')][_0x0460('0x111')](db['ChatApplication'],{'as':_0x0460('0x1a6'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x7f')]['hasMany'](db['FaxApplication'],{'as':_0x0460('0x1a7'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x7f')][_0x0460('0x111')](db[_0x0460('0x58')],{'as':_0x0460('0x1a8'),'foreignKey':_0x0460('0x147')});db[_0x0460('0x87')]['belongsTo'](db['MailAccount'],{});db[_0x0460('0x87')]['belongsTo'](db[_0x0460('0x95')],{'foreignKey':'DefaultReportId'});db[_0x0460('0x87')]['belongsTo'](db[_0x0460('0x94')],{'foreignKey':_0x0460('0x1a9')});db['Sound'][_0x0460('0x122')](db[_0x0460('0x1b')],{'as':_0x0460('0x1aa'),'through':_0x0460('0x13d'),'onDelete':_0x0460('0x158')});db[_0x0460('0x166')][_0x0460('0x122')](db[_0x0460('0x70')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0460('0x122')](db['ChatInteraction'],{'through':_0x0460('0x18d')});db[_0x0460('0x166')]['belongsToMany'](db[_0x0460('0x163')],{'through':'mail_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x0460('0x59')],{'through':_0x0460('0x178')});db[_0x0460('0x166')][_0x0460('0x122')](db[_0x0460('0x119')],{'through':_0x0460('0x175')});db['Tag'][_0x0460('0x122')](db['OpenchannelInteraction'],{'through':_0x0460('0x180')});db['Tag'][_0x0460('0x122')](db[_0x0460('0xf7')],{'through':_0x0460('0x1ab')});db['CmContactHasItem'][_0x0460('0x11e')](db[_0x0460('0x1ac')],{'as':_0x0460('0x1ad'),'foreignKey':_0x0460('0x1ae')});db[_0x0460('0x8c')]['belongsTo'](db[_0x0460('0x71')],{'as':_0x0460('0x1af'),'foreignKey':_0x0460('0x198')});db[_0x0460('0x8a')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x194')});db[_0x0460('0x1b0')][_0x0460('0x111')](db[_0x0460('0x7d')],{'as':{'plural':'AllConditions','singular':_0x0460('0x1b1')},'foreignKey':'TriggerAllId','onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x1b0')][_0x0460('0x111')](db[_0x0460('0x7d')],{'as':{'plural':_0x0460('0x1b2'),'singular':_0x0460('0x1b3')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x0460('0x1b0')]['hasMany'](db[_0x0460('0x1b4')],{'as':'Actions','foreignKey':_0x0460('0x1b5'),'onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x94')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1a9'),'hooks':!![]});db[_0x0460('0x95')][_0x0460('0x111')](db[_0x0460('0x9a')],{'as':_0x0460('0x1b6'),'onDelete':'cascade','foreignKey':_0x0460('0x1b7')});db['AnalyticMetric'][_0x0460('0x111')](db[_0x0460('0x9a')],{'as':_0x0460('0x1b6'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1b8')});db[_0x0460('0x9a')][_0x0460('0x11e')](db['AnalyticMetric'],{'foreignKey':_0x0460('0x1b8')});db[_0x0460('0x9d')][_0x0460('0x111')](db[_0x0460('0x1b9')],{'as':'Configurations','onDelete':_0x0460('0x10d'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0460('0x111')](db[_0x0460('0x1ba')],{'as':_0x0460('0x1bb'),'onDelete':'cascade','foreignKey':_0x0460('0x1bc')});db[_0x0460('0x1b9')][_0x0460('0x111')](db[_0x0460('0x1ba')],{'as':_0x0460('0x1bd'),'onDelete':_0x0460('0x10d'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x0460('0x111')](db[_0x0460('0x1ba')],{'as':_0x0460('0x1b6'),'onDelete':'cascade','foreignKey':_0x0460('0x1be')});db[_0x0460('0x1b9')][_0x0460('0x11e')](db['SalesforceAccount'],{'as':_0x0460('0x164'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x0460('0x1bf'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0x1ba')][_0x0460('0x111')](db['SalesforceField'],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0x1ba')][_0x0460('0x111')](db[_0x0460('0x1ba')],{'as':'Field','foreignKey':_0x0460('0x1be')});db[_0x0460('0x1ba')]['belongsTo'](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':_0x0460('0x1c2')});db[_0x0460('0xa0')][_0x0460('0x111')](db[_0x0460('0xa2')],{'as':_0x0460('0x1c3'),'onDelete':_0x0460('0x10d'),'foreignKey':'AccountId'});db[_0x0460('0xa2')][_0x0460('0x111')](db[_0x0460('0xa4')],{'as':_0x0460('0x1bb'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xa2')][_0x0460('0x111')](db[_0x0460('0xa4')],{'as':_0x0460('0x1bd'),'onDelete':_0x0460('0x10d'),'foreignKey':'DescriptionId'});db[_0x0460('0xa2')][_0x0460('0x111')](db[_0x0460('0xa4')],{'as':_0x0460('0x1b6'),'onDelete':'cascade','foreignKey':_0x0460('0x1be')});db['SugarcrmConfiguration'][_0x0460('0x11e')](db[_0x0460('0xa0')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1c4')});db['SugarcrmField'][_0x0460('0x111')](db[_0x0460('0xa4')],{'as':_0x0460('0x1bf'),'foreignKey':'SubjectId'});db[_0x0460('0xa4')]['hasMany'](db[_0x0460('0xa4')],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xa4')][_0x0460('0x111')](db[_0x0460('0xa4')],{'as':_0x0460('0x1c5'),'foreignKey':_0x0460('0x1be')});db['SugarcrmField'][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':_0x0460('0x1c2')});db[_0x0460('0xa5')]['hasMany'](db[_0x0460('0xa7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x0460('0x1c4')});db[_0x0460('0xa7')][_0x0460('0x111')](db[_0x0460('0xa9')],{'as':_0x0460('0x1bb'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xa7')][_0x0460('0x111')](db[_0x0460('0xa9')],{'as':_0x0460('0x1bd'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xa7')][_0x0460('0x111')](db[_0x0460('0xa9')],{'as':_0x0460('0x1b6'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0xa7')][_0x0460('0x11e')](db[_0x0460('0xa5')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0xa7')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':'int_desk_configuration_has_tags'});db[_0x0460('0xa9')]['hasMany'](db[_0x0460('0xa9')],{'as':'Subject','foreignKey':_0x0460('0x1bc')});db[_0x0460('0xa9')][_0x0460('0x111')](db[_0x0460('0xa9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0460('0xa9')][_0x0460('0x111')](db[_0x0460('0xa9')],{'as':_0x0460('0x1c5'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0xa9')][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':_0x0460('0x1c2')});db[_0x0460('0xab')][_0x0460('0x111')](db[_0x0460('0xac')],{'as':'Configurations','onDelete':_0x0460('0x10d'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x0460('0x111')](db[_0x0460('0x1c6')],{'as':_0x0460('0x1bb'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xac')]['hasMany'](db[_0x0460('0x1c6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x0460('0x1c1')});db['ZohoConfiguration'][_0x0460('0x111')](db[_0x0460('0x1c6')],{'as':'Fields','onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1be')});db['ZohoConfiguration'][_0x0460('0x11e')](db[_0x0460('0xab')],{'as':'Account','foreignKey':_0x0460('0x1c4')});db[_0x0460('0x1c6')][_0x0460('0x111')](db[_0x0460('0x1c6')],{'as':_0x0460('0x1bf'),'foreignKey':_0x0460('0x1bc')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0x0460('0x1c1')});db[_0x0460('0x1c6')][_0x0460('0x111')](db[_0x0460('0x1c6')],{'as':_0x0460('0x1c5'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0x1c6')][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':_0x0460('0x1c2')});db[_0x0460('0xae')][_0x0460('0x111')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x0460('0x10d'),'foreignKey':'AccountId'});db[_0x0460('0x1c7')][_0x0460('0x111')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x0460('0x1bc')});db['ZendeskConfiguration'][_0x0460('0x111')](db[_0x0460('0xb1')],{'as':_0x0460('0x1bd'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0x1c7')][_0x0460('0x111')](db['ZendeskField'],{'as':_0x0460('0x1b6'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0x1c7')][_0x0460('0x11e')](db[_0x0460('0xae')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0x1c7')]['belongsToMany'](db[_0x0460('0x166')],{'through':_0x0460('0x1c8')});db[_0x0460('0xb1')]['hasMany'](db['ZendeskField'],{'as':_0x0460('0x1bf'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xb1')]['hasMany'](db[_0x0460('0xb1')],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xb1')][_0x0460('0x111')](db[_0x0460('0xb1')],{'as':_0x0460('0x1c5'),'foreignKey':'FieldId'});db[_0x0460('0xb1')][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':_0x0460('0x1c2')});db[_0x0460('0x1c9')][_0x0460('0x111')](db[_0x0460('0x1ca')],{'as':_0x0460('0x1c3'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0x1ca')][_0x0460('0x111')](db[_0x0460('0xb5')],{'as':_0x0460('0x1bb'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0x1ca')][_0x0460('0x111')](db['FreshdeskField'],{'as':_0x0460('0x1bd'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0x1ca')][_0x0460('0x111')](db[_0x0460('0xb5')],{'as':_0x0460('0x1b6'),'onDelete':'cascade','foreignKey':_0x0460('0x1be')});db[_0x0460('0x1ca')][_0x0460('0x11e')](db['FreshdeskAccount'],{'as':_0x0460('0x164'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x0460('0x122')](db['Tag'],{'through':_0x0460('0x1cb')});db['FreshdeskField'][_0x0460('0x111')](db['FreshdeskField'],{'as':_0x0460('0x1bf'),'foreignKey':'SubjectId'});db[_0x0460('0xb5')][_0x0460('0x111')](db['FreshdeskField'],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xb5')][_0x0460('0x111')](db[_0x0460('0xb5')],{'as':_0x0460('0x1c5'),'foreignKey':'FieldId'});db[_0x0460('0xb5')][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0x0460('0xb7')][_0x0460('0x111')](db[_0x0460('0xb8')],{'as':_0x0460('0x1c3'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0xb8')][_0x0460('0x111')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x0460('0xb8')][_0x0460('0x111')](db['VtigerField'],{'as':_0x0460('0x1bd'),'foreignKey':_0x0460('0x1c1')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0x0460('0x1b6'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0xb8')][_0x0460('0x11e')](db[_0x0460('0xb7')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0xba')][_0x0460('0x111')](db[_0x0460('0xba')],{'as':_0x0460('0x1bf'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xba')][_0x0460('0x111')](db['VtigerField'],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xba')][_0x0460('0x111')](db['VtigerField'],{'as':'Field','foreignKey':_0x0460('0x1be')});db[_0x0460('0xba')][_0x0460('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0x0460('0x1c2')});db[_0x0460('0xbc')][_0x0460('0x111')](db[_0x0460('0xbe')],{'as':'Configurations','onDelete':_0x0460('0x10d'),'foreignKey':'AccountId'});db[_0x0460('0xbe')][_0x0460('0x111')](db[_0x0460('0xbf')],{'as':_0x0460('0x1bb'),'foreignKey':'SubjectId'});db[_0x0460('0xbe')][_0x0460('0x111')](db[_0x0460('0xbf')],{'as':_0x0460('0x1bd'),'foreignKey':'DescriptionId'});db[_0x0460('0xbe')][_0x0460('0x111')](db[_0x0460('0xbf')],{'as':_0x0460('0x1b6'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0xbe')]['belongsTo'](db['ServicenowAccount'],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1c4')});db['ServicenowField'][_0x0460('0x111')](db['ServicenowField'],{'as':_0x0460('0x1bf'),'foreignKey':_0x0460('0x1bc')});db['ServicenowField']['hasMany'](db[_0x0460('0xbf')],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xbf')][_0x0460('0x111')](db[_0x0460('0xbf')],{'as':'Field','foreignKey':'FieldId'});db[_0x0460('0xbf')][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':'VariableId'});db[_0x0460('0xc0')][_0x0460('0x111')](db[_0x0460('0xc1')],{'as':'Configurations','onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0xc0')][_0x0460('0x11e')](db[_0x0460('0x101')],{'as':_0x0460('0x101'),'foreignKey':_0x0460('0x157')});db[_0x0460('0xc1')][_0x0460('0x111')](db[_0x0460('0xc3')],{'as':'Subjects','onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xc1')][_0x0460('0x111')](db[_0x0460('0xc3')],{'as':_0x0460('0x1bd'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xc1')][_0x0460('0x111')](db[_0x0460('0xc3')],{'as':_0x0460('0x1b6'),'onDelete':_0x0460('0x10d'),'foreignKey':'FieldId'});db[_0x0460('0xc1')]['belongsTo'](db[_0x0460('0xc0')],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1c4')});db['Dynamics365Field'][_0x0460('0x111')](db[_0x0460('0xc3')],{'as':_0x0460('0x1bf'),'foreignKey':_0x0460('0x1bc')});db[_0x0460('0xc3')][_0x0460('0x111')](db[_0x0460('0xc3')],{'as':_0x0460('0x1c0'),'foreignKey':_0x0460('0x1c1')});db[_0x0460('0xc3')][_0x0460('0x111')](db[_0x0460('0xc3')],{'as':'Field','foreignKey':_0x0460('0x1be')});db[_0x0460('0xc3')]['belongsTo'](db[_0x0460('0x91')],{'as':_0x0460('0x91'),'foreignKey':'VariableId'});db[_0x0460('0xc5')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x0460('0x1c3'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1c4')});db[_0x0460('0xc7')][_0x0460('0x111')](db[_0x0460('0xc8')],{'as':'Subjects','foreignKey':_0x0460('0x1bc')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x0460('0x1bd'),'foreignKey':_0x0460('0x1c1')});db['FreshsalesConfiguration'][_0x0460('0x111')](db[_0x0460('0xc8')],{'as':_0x0460('0x1b6'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0xc7')][_0x0460('0x11e')](db[_0x0460('0xc5')],{'as':'Account','foreignKey':_0x0460('0x1c4')});db['FreshsalesField']['hasMany'](db[_0x0460('0xc8')],{'as':'Subject','foreignKey':_0x0460('0x1bc')});db[_0x0460('0xc8')][_0x0460('0x111')](db[_0x0460('0xc8')],{'as':_0x0460('0x1c0'),'foreignKey':'DescriptionId'});db[_0x0460('0xc8')][_0x0460('0x111')](db[_0x0460('0xc8')],{'as':_0x0460('0x1c5'),'foreignKey':_0x0460('0x1be')});db[_0x0460('0xc8')][_0x0460('0x11e')](db[_0x0460('0x91')],{'as':'Variable','foreignKey':_0x0460('0x1c2')});db[_0x0460('0x1cc')][_0x0460('0x11e')](db[_0x0460('0x62')],{});db[_0x0460('0x1cc')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x0460('0x172')});db[_0x0460('0x1cc')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':'Contact','foreignKey':_0x0460('0x155')});db[_0x0460('0x1cc')][_0x0460('0x11e')](db[_0x0460('0x66')],{});db[_0x0460('0x1cc')][_0x0460('0x11e')](db[_0x0460('0x67')],{});db[_0x0460('0x1cc')][_0x0460('0x11e')](db[_0x0460('0x13')],{});db[_0x0460('0x1cc')][_0x0460('0x11e')](db[_0x0460('0x6a')],{});db['ChatInternalMessage'][_0x0460('0x11e')](db['User'],{'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1cd')});db['ChatInternalMessage'][_0x0460('0x11e')](db[_0x0460('0x13')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x0460('0x143')][_0x0460('0x111')](db[_0x0460('0x1ce')],{'foreignKey':_0x0460('0x1cf'),'onDelete':'cascade'});db[_0x0460('0x143')][_0x0460('0x111')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x0460('0x10d')});db[_0x0460('0x1d0')][_0x0460('0x11e')](db[_0x0460('0x57')],{});db[_0x0460('0x1d0')][_0x0460('0x11e')](db[_0x0460('0xed')],{'as':'List','foreignKey':_0x0460('0x172')});db[_0x0460('0x1d0')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':'ContactId'});db[_0x0460('0x1d0')]['belongsTo'](db[_0x0460('0x59')],{});db[_0x0460('0x1d0')][_0x0460('0x11e')](db[_0x0460('0x5a')],{});db[_0x0460('0x1d0')][_0x0460('0x11e')](db[_0x0460('0x13')],{});db['SmsQueueReport']['belongsTo'](db[_0x0460('0x5c')],{});db[_0x0460('0xd4')]['hasMany'](db[_0x0460('0x143')],{'foreignKey':_0x0460('0x1d1')});db[_0x0460('0xd4')]['hasMany'](db[_0x0460('0x1ce')],{'foreignKey':_0x0460('0x1d1')});db[_0x0460('0xd4')][_0x0460('0x111')](db['JscriptyAnswerReport'],{'foreignKey':_0x0460('0x1d1')});db['Team'][_0x0460('0x122')](db[_0x0460('0x13')],{'as':'Agents','through':'user_has_teams'});db[_0x0460('0x124')]['belongsToMany'](db['VoiceQueue'],{'through':_0x0460('0x103'),'as':_0x0460('0x12b')});db['Team'][_0x0460('0x122')](db[_0x0460('0x41')],{'through':'team_has_mail_queues','as':_0x0460('0x1d2')});db[_0x0460('0x124')][_0x0460('0x122')](db[_0x0460('0x6a')],{'through':_0x0460('0x18e'),'as':_0x0460('0x1d3')});db[_0x0460('0x124')]['belongsToMany'](db[_0x0460('0x54')],{'through':'team_has_fax_queues','as':_0x0460('0x12d')});db[_0x0460('0x124')][_0x0460('0x122')](db['SmsQueue'],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x0460('0x124')][_0x0460('0x122')](db[_0x0460('0x12e')],{'through':_0x0460('0x184'),'as':_0x0460('0x1d4')});db[_0x0460('0x124')]['belongsToMany'](db[_0x0460('0xff')],{'through':_0x0460('0x1d5'),'as':_0x0460('0x1d6')});db[_0x0460('0x124')][_0x0460('0x122')](db[_0x0460('0xee')],{'through':_0x0460('0x105'),'as':_0x0460('0x12c')});db[_0x0460('0xe0')][_0x0460('0x111')](db[_0x0460('0x71')],{'as':_0x0460('0x11d'),'foreignKey':_0x0460('0x1d7')});db['Campaign'][_0x0460('0x111')](db['CmHopperFinal'],{'as':_0x0460('0x114'),'foreignKey':'CampaignId'});db[_0x0460('0xe0')][_0x0460('0x111')](db['CmHopperHistory'],{'as':_0x0460('0x140'),'foreignKey':'CampaignId'});db[_0x0460('0xe0')][_0x0460('0x111')](db['CmHopperBlack'],{'as':_0x0460('0x142'),'foreignKey':'CampaignId'});db[_0x0460('0xe0')][_0x0460('0x11e')](db[_0x0460('0x2b')],{'as':'Trunk','foreignKey':_0x0460('0x145')});db[_0x0460('0xe0')][_0x0460('0x11e')](db[_0x0460('0x2b')],{'as':_0x0460('0x1d8'),'foreignKey':_0x0460('0x146')});db[_0x0460('0xe0')][_0x0460('0x11e')](db[_0x0460('0x7f')],{'as':'Interval','foreignKey':_0x0460('0x147')});db[_0x0460('0xe0')][_0x0460('0x11e')](db['SquareProject'],{'as':_0x0460('0xd9'),'foreignKey':_0x0460('0x1d9')});db[_0x0460('0xe0')][_0x0460('0x122')](db[_0x0460('0xed')],{'as':_0x0460('0x14a'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x0460('0x122')](db[_0x0460('0xed')],{'as':_0x0460('0x14d'),'through':_0x0460('0x1da')});db[_0x0460('0xe4')]['belongsTo'](db[_0x0460('0x16d')],{'as':_0x0460('0x16d'),'foreignKey':_0x0460('0x16e')});db[_0x0460('0xe6')][_0x0460('0x11e')](db[_0x0460('0x46')],{});db[_0x0460('0xe6')][_0x0460('0x11e')](db['MailInteraction'],{});db[_0x0460('0xe6')][_0x0460('0x11e')](db[_0x0460('0x3f')],{'foreignKey':_0x0460('0x1db'),'as':_0x0460('0x1dc')});db['MailTransferReport'][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1dd'),'as':_0x0460('0x1de')});db[_0x0460('0xe6')][_0x0460('0x11e')](db['User'],{'foreignKey':_0x0460('0x1df'),'as':_0x0460('0x1e0')});db[_0x0460('0xe6')][_0x0460('0x11e')](db['MailQueue'],{'foreignKey':_0x0460('0x1e1'),'as':'ToQueue'});db['MailTransferReport']['belongsTo'](db[_0x0460('0x3f')],{'foreignKey':_0x0460('0x1e2'),'as':_0x0460('0x1e3')});db[_0x0460('0xe8')][_0x0460('0x11e')](db[_0x0460('0x67')],{});db['ChatTransferReport'][_0x0460('0x11e')](db['ChatInteraction'],{});db[_0x0460('0xe8')][_0x0460('0x11e')](db[_0x0460('0x62')],{'foreignKey':_0x0460('0x1e4'),'as':'FromAccount'});db[_0x0460('0xe8')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1dd'),'as':'FromAgent'});db[_0x0460('0xe8')][_0x0460('0x11e')](db['User'],{'foreignKey':_0x0460('0x1df'),'as':_0x0460('0x1e0')});db['ChatTransferReport']['belongsTo'](db[_0x0460('0x6a')],{'foreignKey':'ToChatQueueId','as':_0x0460('0x1e5')});db[_0x0460('0xe8')][_0x0460('0x11e')](db[_0x0460('0x62')],{'foreignKey':_0x0460('0x1e6'),'as':_0x0460('0x1e3')});db[_0x0460('0xea')][_0x0460('0x11e')](db[_0x0460('0x53')],{});db['FaxTransferReport'][_0x0460('0x11e')](db[_0x0460('0x119')],{});db[_0x0460('0xea')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x0460('0x1e7'),'as':_0x0460('0x1dc')});db[_0x0460('0xea')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1dd'),'as':'FromAgent'});db[_0x0460('0xea')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1df'),'as':_0x0460('0x1e0')});db[_0x0460('0xea')][_0x0460('0x11e')](db['FaxQueue'],{'foreignKey':_0x0460('0x1e8'),'as':_0x0460('0x1e5')});db['FaxTransferReport'][_0x0460('0x11e')](db[_0x0460('0x4e')],{'foreignKey':'ToFaxAccountId','as':_0x0460('0x1e3')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x0460('0x1e9')][_0x0460('0x11e')](db[_0x0460('0x60')],{});db[_0x0460('0x1e9')][_0x0460('0x11e')](db[_0x0460('0x134')],{'foreignKey':_0x0460('0x1ea'),'as':'FromAccount'});db[_0x0460('0x1e9')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1dd'),'as':_0x0460('0x1de')});db[_0x0460('0x1e9')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x0460('0x1e9')][_0x0460('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x0460('0x1eb'),'as':_0x0460('0x1e5')});db['OpenchannelTransferReport'][_0x0460('0x11e')](db[_0x0460('0x134')],{'foreignKey':_0x0460('0x1ec'),'as':_0x0460('0x1e3')});db[_0x0460('0xec')]['belongsTo'](db[_0x0460('0x5a')],{});db['SmsTransferReport'][_0x0460('0x11e')](db['SmsInteraction'],{});db[_0x0460('0xec')][_0x0460('0x11e')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x0460('0x1dc')});db['SmsTransferReport']['belongsTo'](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1dd'),'as':_0x0460('0x1de')});db[_0x0460('0xec')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1df'),'as':'ToAgent'});db[_0x0460('0xec')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x0460('0x1ed'),'as':_0x0460('0x1e5')});db[_0x0460('0xec')][_0x0460('0x11e')](db[_0x0460('0x57')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x0460('0xed')][_0x0460('0x111')](db[_0x0460('0x7b')],{'as':_0x0460('0x15b'),'foreignKey':'ListId','onDelete':_0x0460('0x10d')});db[_0x0460('0xed')]['hasMany'](db[_0x0460('0x1ee')],{'as':_0x0460('0x1ef'),'foreignKey':_0x0460('0x172')});db['CmList'][_0x0460('0x111')](db['CmContact'],{'as':_0x0460('0x191'),'onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x172')});db[_0x0460('0xed')]['hasMany'](db[_0x0460('0x74')],{'as':_0x0460('0x114'),'foreignKey':_0x0460('0x172')});db[_0x0460('0xed')][_0x0460('0x111')](db['CmHopperHistory'],{'as':_0x0460('0x1f0'),'foreignKey':_0x0460('0x172')});db[_0x0460('0xed')][_0x0460('0x111')](db['ReportAgentPreview'],{'as':_0x0460('0x141'),'foreignKey':'ListId'});db['CmList'][_0x0460('0x122')](db['VoiceQueue'],{'as':_0x0460('0x1f1'),'through':_0x0460('0x14b')});db[_0x0460('0xed')][_0x0460('0x122')](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x123')});db[_0x0460('0xee')][_0x0460('0x111')](db['VoiceExtension'],{'as':_0x0460('0x113'),'onDelete':'cascade'});db[_0x0460('0xee')]['belongsToMany'](db[_0x0460('0x13')],{'as':_0x0460('0x14c'),'through':_0x0460('0x107')});db['VoicePrefix'][_0x0460('0x122')](db['Team'],{'through':_0x0460('0x105'),'as':_0x0460('0x162')});db[_0x0460('0xef')][_0x0460('0x111')](db[_0x0460('0x13')],{'as':_0x0460('0x16a'),'foreignKey':_0x0460('0x11f')});db[_0x0460('0xef')][_0x0460('0x111')](db[_0x0460('0xf1')],{'as':_0x0460('0x1f2'),'foreignKey':_0x0460('0x11f'),'onDelete':'cascade'});db[_0x0460('0xf1')]['hasMany'](db[_0x0460('0x1f3')],{'as':_0x0460('0x1f4'),'foreignKey':'sectionId','onDelete':_0x0460('0x10d')});db['WhatsappAccount'][_0x0460('0x111')](db[_0x0460('0x7b')],{'as':'Dispositions','foreignKey':_0x0460('0x1f5'),'onDelete':_0x0460('0x10d')});db['WhatsappAccount']['hasMany'](db[_0x0460('0x7a')],{'as':_0x0460('0x185'),'foreignKey':_0x0460('0x1f5')});db[_0x0460('0x1f6')][_0x0460('0x111')](db[_0x0460('0xf9')],{'as':'Messages','foreignKey':_0x0460('0x1f5')});db['WhatsappAccount'][_0x0460('0x111')](db[_0x0460('0xf7')],{'as':_0x0460('0x15d')});db[_0x0460('0x1f6')][_0x0460('0x111')](db[_0x0460('0xf5')],{'as':_0x0460('0x13b'),'foreignKey':_0x0460('0x1f5'),'onDelete':_0x0460('0x10d')});db[_0x0460('0x1f6')]['belongsTo'](db[_0x0460('0xed')],{'as':'List','foreignKey':_0x0460('0x172')});db[_0x0460('0x1f6')]['belongsTo'](db[_0x0460('0x81')],{'as':_0x0460('0x148'),'foreignKey':_0x0460('0x149')});db[_0x0460('0x1f6')][_0x0460('0x122')](db['User'],{'as':_0x0460('0x14c'),'through':_0x0460('0x13a')});db[_0x0460('0xf5')][_0x0460('0x11e')](db[_0x0460('0x13')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x0460('0xff')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x0460('0x11e')](db['WhatsappAccount'],{'onDelete':_0x0460('0x158')});db['WhatsappApplication']['belongsTo'](db[_0x0460('0x7f')],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x147')});db[_0x0460('0xf5')][_0x0460('0x11e')](db[_0x0460('0x166')],{'onDelete':_0x0460('0x158'),'foreignKey':_0x0460('0x173')});db[_0x0460('0xf7')][_0x0460('0x111')](db[_0x0460('0xf9')],{'as':'Messages','onDelete':_0x0460('0x10d'),'foreignKey':_0x0460('0x1f7')});db[_0x0460('0xf7')][_0x0460('0x11e')](db[_0x0460('0x1f6')],{'as':_0x0460('0x164'),'foreignKey':'WhatsappAccountId'});db[_0x0460('0xf7')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':'Contact','foreignKey':'ContactId'});db[_0x0460('0xf7')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x165'),'foreignKey':_0x0460('0x10e')});db[_0x0460('0xf7')][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x1ab'),'as':'Tags'});db['WhatsappInteraction'][_0x0460('0x122')](db[_0x0460('0x166')],{'through':_0x0460('0x1ab'),'as':_0x0460('0x169')});db[_0x0460('0xf7')][_0x0460('0x122')](db['User'],{'as':'Users','through':_0x0460('0x12a'),'foreignKey':_0x0460('0x1f7')});db['WhatsappMessage'][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x13')});db[_0x0460('0xf9')][_0x0460('0x11e')](db[_0x0460('0x70')],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x154')});db[_0x0460('0xf9')][_0x0460('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x0460('0x10d'),'as':_0x0460('0x16c'),'foreignKey':_0x0460('0x1f7')});db[_0x0460('0xf9')][_0x0460('0x11e')](db['WhatsappAccount'],{'as':_0x0460('0x164'),'foreignKey':_0x0460('0x1f5')});db[_0x0460('0xfb')][_0x0460('0x11e')](db[_0x0460('0x1f6')],{});db[_0x0460('0xfb')]['belongsTo'](db[_0x0460('0xed')],{'as':_0x0460('0x15e'),'foreignKey':_0x0460('0x172')});db[_0x0460('0xfb')][_0x0460('0x11e')](db[_0x0460('0x70')],{'as':_0x0460('0x154'),'foreignKey':_0x0460('0x155')});db[_0x0460('0xfb')]['belongsTo'](db[_0x0460('0xf7')],{});db[_0x0460('0xfb')][_0x0460('0x11e')](db[_0x0460('0xff')],{});db[_0x0460('0xfb')][_0x0460('0x11e')](db[_0x0460('0xf9')],{});db[_0x0460('0xfb')][_0x0460('0x11e')](db[_0x0460('0x13')],{});db[_0x0460('0xfd')][_0x0460('0x11e')](db[_0x0460('0xf9')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x0460('0xf7')],{});db['WhatsappTransferReport'][_0x0460('0x11e')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x0460('0x1dc')});db[_0x0460('0xfd')][_0x0460('0x11e')](db[_0x0460('0x1f6')],{'foreignKey':_0x0460('0x1f8'),'as':_0x0460('0x1e3')});db['WhatsappTransferReport'][_0x0460('0x11e')](db['WhatsappQueue'],{'foreignKey':_0x0460('0x1f9'),'as':_0x0460('0x1e5')});db[_0x0460('0xfd')][_0x0460('0x11e')](db[_0x0460('0x13')],{'foreignKey':_0x0460('0x1dd'),'as':_0x0460('0x1de')});db[_0x0460('0xfd')][_0x0460('0x11e')](db['User'],{'foreignKey':_0x0460('0x1df'),'as':'ToAgent'});db['WhatsappQueue'][_0x0460('0x122')](db[_0x0460('0x13')],{'as':'Agents','through':_0x0460('0x3b'),'foreignKey':_0x0460('0x1fa')});db[_0x0460('0xff')][_0x0460('0x122')](db[_0x0460('0x124')],{'through':'team_has_whatsapp_queues','as':_0x0460('0x162')});db[_0x0460('0x108')][_0x0460('0x11e')](db[_0x0460('0x13')],{'as':_0x0460('0x1fb'),'foreignKey':_0x0460('0x10e'),'onDelete':_0x0460('0x10d'),'hooks':!![]});db[_0x0460('0x101')][_0x0460('0x10c')](db[_0x0460('0xc0')],{'as':_0x0460('0xc0'),'onDelete':_0x0460('0x158')});db[_0x0460('0x101')][_0x0460('0x10c')](db['MailServerIn'],{'as':_0x0460('0x159'),'onDelete':_0x0460('0x158')});db[_0x0460('0x101')][_0x0460('0x10c')](db['MailServerOut'],{'as':_0x0460('0x15a'),'onDelete':_0x0460('0x158')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf5c4=['SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','userSetting','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','Hoppers','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','Applications','Sound','moh_has_sounds','Members','VoiceQueueId','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','Contact','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Smtp','CannedAnswer','Answers','Interactions','List','ListId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Tag','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','Items','FaxAccountId','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','ThroughTags','team_has_fax_queues','Dispositions','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CmCompany','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CampaignId','All','OneAll','OneAny','AutomationAnyId','Automation','Actions','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','AnalyticCustomReport','CustomReportId','whatsapp_interaction_has_tags','ItemType','Hopper','CmHopperId','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceConfiguration','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmConfiguration','DeskAccount','DeskField','int_desk_configuration_has_tags','Field','ZohoConfiguration','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','Dynamics365Field','FreshsalesAccount','ChatQueueReport','ToId','SessionId','ProjectId','user_has_teams','team_has_whatsapp_queues','HopperBlacks','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAgent','ToUserId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','xC@LL1234','127.0.0.1','mysql','name','utf8','sequelizeHistory','defaultsDeep','xcall','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0xf5c4,0x1ae));var _0x4f5c=function(_0x1ee3d1,_0x41d916){_0x1ee3d1=_0x1ee3d1-0x0;var _0x495c8c=_0xf5c4[_0x1ee3d1];return _0x495c8c;};'use strict';var config=require(_0x4f5c('0x0'));var Sequelize=require(_0x4f5c('0x1'));var _=require(_0x4f5c('0x2'));var jstz=require(_0x4f5c('0x3'));var timezone=jstz[_0x4f5c('0x4')]();config[_0x4f5c('0x1')]=_['defaultsDeep'](config[_0x4f5c('0x1')],{'database':'motion2','username':'xcall','password':_0x4f5c('0x5'),'options':{'host':_0x4f5c('0x6'),'port':0xcea,'dialect':_0x4f5c('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4f5c('0x8')](),'define':{'charset':_0x4f5c('0x9'),'collate':'utf8_general_ci'}}});config[_0x4f5c('0xa')]=_[_0x4f5c('0xb')](config['sequelizeHistory'],{'database':'motion2','username':_0x4f5c('0xc'),'password':_0x4f5c('0x5'),'options':{'host':_0x4f5c('0x6'),'port':0xcea,'dialect':_0x4f5c('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4f5c('0x8')](),'define':{'charset':'utf8','collate':_0x4f5c('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4f5c('0x1')][_0x4f5c('0xe')],config[_0x4f5c('0x1')][_0x4f5c('0xf')],config['sequelize'][_0x4f5c('0x10')],config['sequelize'][_0x4f5c('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4f5c('0xa')]['database'],config['sequelizeHistory'][_0x4f5c('0xf')],config[_0x4f5c('0xa')][_0x4f5c('0x10')],config['sequelizeHistory'][_0x4f5c('0x11')])};db[_0x4f5c('0x12')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x14'));db[_0x4f5c('0x15')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x4f5c('0x16')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x17'));db['VoiceExtension']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x4f5c('0x18')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x19'));db[_0x4f5c('0x1a')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x1b'));db[_0x4f5c('0x1c')]=db['sequelize']['import'](_0x4f5c('0x1d'));db[_0x4f5c('0x1e')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x1f'));db[_0x4f5c('0x20')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x21'));db['VoiceMailMessage']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x4f5c('0x22')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x23'));db[_0x4f5c('0x24')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x25'));db[_0x4f5c('0x26')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x4f5c('0x27')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x28'));db[_0x4f5c('0x29')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x2a'));db[_0x4f5c('0x2b')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x2c'));db['VoiceTransferReport']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x2d'));db[_0x4f5c('0x2e')]=db['sequelize'][_0x4f5c('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x4f5c('0x2f')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x30'));db[_0x4f5c('0x31')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x32'));db['UserMailQueue']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x33'));db[_0x4f5c('0x34')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x35'));db[_0x4f5c('0x36')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x37'));db[_0x4f5c('0x38')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x4f5c('0x39')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x3a'));db['MailServerIn']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x3b'));db[_0x4f5c('0x3c')]=db['sequelize']['import'](_0x4f5c('0x3d'));db[_0x4f5c('0x3e')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x3f'));db['MailQueue']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x40'));db['MailSubstatus']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x41'));db[_0x4f5c('0x42')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x43'));db[_0x4f5c('0x44')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x45'));db[_0x4f5c('0x46')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x47'));db[_0x4f5c('0x48')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x49'));db[_0x4f5c('0x4a')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x4b'));db['DashboardItem']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x4c'));db[_0x4f5c('0x4d')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/faxAccount/faxAccount.model');db[_0x4f5c('0x4e')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x4f'));db[_0x4f5c('0x50')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x51'));db[_0x4f5c('0x52')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x53'));db['FaxQueue']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/faxQueue/faxQueue.model');db[_0x4f5c('0x54')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x55'));db[_0x4f5c('0x56')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x57'));db['SmsApplication']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x58'));db[_0x4f5c('0x59')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x5a'));db[_0x4f5c('0x5b')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x5c'));db[_0x4f5c('0x5d')]=db['sequelize']['import'](_0x4f5c('0x5e'));db[_0x4f5c('0x5f')]=db['sequelize'][_0x4f5c('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x4f5c('0x60')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x61'));db[_0x4f5c('0x62')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x63'));db[_0x4f5c('0x64')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x65'));db[_0x4f5c('0x66')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x67'));db[_0x4f5c('0x68')]=db['sequelize']['import'](_0x4f5c('0x69'));db[_0x4f5c('0x6a')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x6b'));db[_0x4f5c('0x6c')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x6d'));db[_0x4f5c('0x6e')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x6f'));db[_0x4f5c('0x70')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/chatMessage/chatMessage.model');db[_0x4f5c('0x71')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4f5c('0x72')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x73'));db[_0x4f5c('0x74')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x75'));db[_0x4f5c('0x76')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x77'));db['CmCompany']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x78'));db[_0x4f5c('0x79')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x7a'));db[_0x4f5c('0x7b')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x7c'));db[_0x4f5c('0x7d')]=db[_0x4f5c('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x4f5c('0x7e')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x7f'));db[_0x4f5c('0x80')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x81'));db['ReportAgentPreview']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x82'));db['CmCustomField']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x83'));db[_0x4f5c('0x84')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x85'));db['Automation']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x86'));db['CannedAnswer']=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x87'));db[_0x4f5c('0x88')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x89'));db[_0x4f5c('0x8a')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/condition/condition.model');db[_0x4f5c('0x8b')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x8c'));db[_0x4f5c('0x8d')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/pause/pause.model');db[_0x4f5c('0x8e')]=db['sequelize'][_0x4f5c('0x13')]('../api/cdr/cdr.model');db[_0x4f5c('0x8f')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x90'));db[_0x4f5c('0x91')]=db['sequelize']['import'](_0x4f5c('0x92'));db['Sound']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/sound/sound.model');db['Tag']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/tag/tag.model');db[_0x4f5c('0x93')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x94'));db[_0x4f5c('0x95')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x96'));db[_0x4f5c('0x97')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x98'));db[_0x4f5c('0x99')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x9a'));db[_0x4f5c('0x9b')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/trigger/trigger.model');db[_0x4f5c('0x9c')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x9d'));db[_0x4f5c('0x9e')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x9f'));db[_0x4f5c('0xa0')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xa1'));db['AnalyticDefaultReport']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xa2'));db[_0x4f5c('0xa3')]=db['sequelize'][_0x4f5c('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x4f5c('0xa4')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xa5'));db[_0x4f5c('0xa6')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xa7'));db[_0x4f5c('0xa8')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xa9'));db[_0x4f5c('0xaa')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xab'));db['SalesforceConfiguration']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xac'));db[_0x4f5c('0xad')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xae'));db[_0x4f5c('0xaf')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xb0'));db['SugarcrmConfiguration']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x4f5c('0xb1')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xb2'));db['DeskAccount']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xb3'));db[_0x4f5c('0xb4')]=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xb5'));db[_0x4f5c('0xb6')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xb7'));db['ZohoConfiguration']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xb8'));db['ZohoField']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xb9'));db['ZendeskAccount']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xba'));db[_0x4f5c('0xbb')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xbc'));db[_0x4f5c('0xbd')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xbe'));db[_0x4f5c('0xbf')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xc0'));db['FreshdeskConfiguration']=db['sequelize'][_0x4f5c('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x4f5c('0xc1')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xc2'));db[_0x4f5c('0xc3')]=db['sequelize']['import'](_0x4f5c('0xc4'));db[_0x4f5c('0xc5')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xc6'));db['ServicenowAccount']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xc7'));db[_0x4f5c('0xc8')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xc9'));db[_0x4f5c('0xca')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xcb'));db[_0x4f5c('0xcc')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xcd'));db[_0x4f5c('0xce')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xcf'));db['Dynamics365Field']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xd0'));db['FreshsalesAccount']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xd1'));db[_0x4f5c('0xd2')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xd3'));db[_0x4f5c('0xd4')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x4f5c('0x9e')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x9f'));db[_0x4f5c('0xd5')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xd6'));db['ChatQueueReport']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xd7'));db[_0x4f5c('0xd8')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xd9'));db[_0x4f5c('0xda')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xdb'));db[_0x4f5c('0xdc')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xdd'));db[_0x4f5c('0xde')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x4f5c('0xdf')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xe0'));db[_0x4f5c('0xe1')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xe2'));db[_0x4f5c('0xe3')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xe4'));db[_0x4f5c('0xe5')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xe6'));db[_0x4f5c('0xe7')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xe8'));db['SquareOdbc']=db['sequelize'][_0x4f5c('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x4f5c('0xe9')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xea'));db[_0x4f5c('0xeb')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xec'));db[_0x4f5c('0xed')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xee'));db['Team']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xef'));db[_0x4f5c('0xf0')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xf1'));db[_0x4f5c('0xf2')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xf3'));db[_0x4f5c('0xf4')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xf5'));db[_0x4f5c('0xf6')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0xf7'));db[_0x4f5c('0xf8')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x4f5c('0xf9')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0xfa'));db['FaxTransferReport']=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xfb'));db[_0x4f5c('0xfc')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0xfd'));db[_0x4f5c('0xfe')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x4f5c('0xff')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x100'));db[_0x4f5c('0x101')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x102'));db[_0x4f5c('0x103')]=db[_0x4f5c('0x1')]['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x4f5c('0x104')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x105'));db[_0x4f5c('0x106')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x107'));db[_0x4f5c('0x108')]=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x109'));db['WhatsappApplication']=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x10a'));db['WhatsappInteraction']=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x10b'));db[_0x4f5c('0x10c')]=db['sequelize'][_0x4f5c('0x13')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x4f5c('0x1')]['import'](_0x4f5c('0x10d'));db[_0x4f5c('0x10e')]=db['sequelize'][_0x4f5c('0x13')](_0x4f5c('0x10f'));db[_0x4f5c('0x110')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x111'));db[_0x4f5c('0x112')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x113'));db[_0x4f5c('0x114')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x115'));db[_0x4f5c('0x116')]=db[_0x4f5c('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x4f5c('0x117')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x118'));db[_0x4f5c('0x119')]=db[_0x4f5c('0x1')][_0x4f5c('0x13')]('../api/user-setting/user-setting.model');db['MailInteractionHasTag']=db[_0x4f5c('0x1')][_0x4f5c('0x13')](_0x4f5c('0x11a'));db['User'][_0x4f5c('0x11b')](db[_0x4f5c('0x20')],{'as':'VoiceMail','onDelete':_0x4f5c('0x11c'),'foreignKey':'UserId'});db['User']['hasOne'](db['UserSetting'],{'as':_0x4f5c('0x11d'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x11e')});db['User'][_0x4f5c('0x11f')](db['VoiceRecording'],{'as':_0x4f5c('0x120'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x2e')],{'as':_0x4f5c('0x121'),'foreignKey':_0x4f5c('0x11e')});db['User'][_0x4f5c('0x11f')](db[_0x4f5c('0x122')],{'as':_0x4f5c('0x123'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x7e')],{'as':_0x4f5c('0x124'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x80')],{'as':_0x4f5c('0x125'),'foreignKey':'UserId'});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x126')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x62')],{'as':_0x4f5c('0x127'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x6e')],{'as':_0x4f5c('0x128'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x59')],{'as':_0x4f5c('0x129'),'foreignKey':'UserId'});db['User'][_0x4f5c('0x11f')](db['FaxInteraction'],{'as':_0x4f5c('0x12a'),'foreignKey':'UserId'});db[_0x4f5c('0x12')]['hasMany'](db[_0x4f5c('0x42')],{'as':_0x4f5c('0x12b'),'foreignKey':_0x4f5c('0x11e')});db['User'][_0x4f5c('0x11f')](db[_0x4f5c('0x12c')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db[_0x4f5c('0x106')],{'as':_0x4f5c('0x12d'),'foreignKey':_0x4f5c('0x12e')});db[_0x4f5c('0x12')][_0x4f5c('0x11f')](db['CmHopper'],{'as':_0x4f5c('0x12f'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x4f5c('0x12')][_0x4f5c('0x130')](db['UserProfile'],{'as':_0x4f5c('0x103'),'foreignKey':_0x4f5c('0x131')});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x74')],{'as':_0x4f5c('0x133'),'through':_0x4f5c('0x134')});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x135'),'through':_0x4f5c('0x136')});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x137'),'through':_0x4f5c('0x138')});db[_0x4f5c('0x12')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0x4f5c('0x12')]['belongsToMany'](db[_0x4f5c('0x42')],{'as':_0x4f5c('0x12b'),'through':_0x4f5c('0x139')});db['User']['belongsToMany'](db[_0x4f5c('0x6e')],{'as':_0x4f5c('0x128'),'through':_0x4f5c('0x13a')});db[_0x4f5c('0x12')]['belongsToMany'](db['FaxInteraction'],{'as':_0x4f5c('0x12a'),'through':_0x4f5c('0x13b')});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db['SmsInteraction'],{'as':_0x4f5c('0x129'),'through':_0x4f5c('0x13c')});db[_0x4f5c('0x12')]['belongsToMany'](db[_0x4f5c('0x62')],{'as':_0x4f5c('0x127'),'through':'user_has_openchannel_interactions'});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x12c')],{'as':'WhatsappInteractions','through':_0x4f5c('0x13d')});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x1a')],{'as':_0x4f5c('0x13e'),'through':_0x4f5c('0x2f'),'required':![]});db['User'][_0x4f5c('0x132')](db[_0x4f5c('0x101')],{'as':_0x4f5c('0x13f'),'through':_0x4f5c('0x117'),'required':![]});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x140')],{'as':_0x4f5c('0x141'),'through':_0x4f5c('0x142'),'required':![]});db[_0x4f5c('0x12')]['belongsToMany'](db[_0x4f5c('0x72')],{'as':_0x4f5c('0x143'),'through':_0x4f5c('0x31'),'required':![],'hooks':!![]});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x144')],{'as':_0x4f5c('0x145'),'through':_0x4f5c('0x34'),'required':![]});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x5d')],{'as':_0x4f5c('0x146'),'through':_0x4f5c('0x36'),'required':![]});db['User'][_0x4f5c('0x132')](db['OpenchannelQueue'],{'as':_0x4f5c('0x147'),'through':_0x4f5c('0x38'),'required':![]});db['User'][_0x4f5c('0x132')](db['WhatsappQueue'],{'as':_0x4f5c('0x148'),'through':'UserWhatsappQueue','required':![]});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db['CmList'],{'through':_0x4f5c('0x138')});db[_0x4f5c('0x12')]['belongsToMany'](db[_0x4f5c('0x68')],{'as':_0x4f5c('0x149'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x4f5c('0x4d')],{'as':_0x4f5c('0x14a'),'through':_0x4f5c('0x14b')});db['User'][_0x4f5c('0x132')](db[_0x4f5c('0x3e')],{'as':_0x4f5c('0x14c'),'through':_0x4f5c('0x14d')});db[_0x4f5c('0x12')][_0x4f5c('0x132')](db[_0x4f5c('0x5f')],{'as':_0x4f5c('0x14e'),'through':_0x4f5c('0x14f')});db[_0x4f5c('0x12')]['belongsToMany'](db[_0x4f5c('0x56')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0x4f5c('0x108')],{'as':_0x4f5c('0x150'),'through':_0x4f5c('0x151')});db[_0x4f5c('0x15')][_0x4f5c('0x11f')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x4f5c('0x16')][_0x4f5c('0x11f')](db[_0x4f5c('0x122')],{'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x122')][_0x4f5c('0x11f')](db['VoiceExtension'],{'as':_0x4f5c('0x152'),'onDelete':'cascade'});db[_0x4f5c('0x18')][_0x4f5c('0x132')](db[_0x4f5c('0x153')],{'as':'Sounds','through':_0x4f5c('0x154')});db['VoiceQueue'][_0x4f5c('0x11f')](db['UserVoiceQueueRt'],{'as':_0x4f5c('0x155'),'foreignKey':'VoiceQueueId'});db[_0x4f5c('0x1a')][_0x4f5c('0x11f')](db[_0x4f5c('0x7b')],{'as':_0x4f5c('0x12f'),'foreignKey':_0x4f5c('0x156')});db[_0x4f5c('0x1a')][_0x4f5c('0x11f')](db[_0x4f5c('0x7e')],{'as':'HopperFinals','foreignKey':_0x4f5c('0x156')});db[_0x4f5c('0x1a')][_0x4f5c('0x11f')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x4f5c('0x156')});db[_0x4f5c('0x1a')][_0x4f5c('0x11f')](db[_0x4f5c('0x126')],{'as':'ReportAgentPreview','foreignKey':_0x4f5c('0x156')});db[_0x4f5c('0x1a')][_0x4f5c('0x11f')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x4f5c('0x156')});db['VoiceQueue']['hasMany'](db[_0x4f5c('0xde')],{'as':_0x4f5c('0x157'),'foreignKey':_0x4f5c('0x156')});db[_0x4f5c('0x1a')][_0x4f5c('0x130')](db['Trunk'],{'as':_0x4f5c('0x2b'),'foreignKey':_0x4f5c('0x158')});db[_0x4f5c('0x1a')][_0x4f5c('0x130')](db['Trunk'],{'as':_0x4f5c('0x159'),'foreignKey':_0x4f5c('0x15a')});db[_0x4f5c('0x1a')]['belongsTo'](db['Interval'],{'as':_0x4f5c('0x8b'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0x1a')][_0x4f5c('0x130')](db[_0x4f5c('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f5c('0x15c')});db[_0x4f5c('0x1a')][_0x4f5c('0x132')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x137'),'through':_0x4f5c('0x15d')});db['VoiceQueue'][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x2f')});db[_0x4f5c('0x1a')][_0x4f5c('0x132')](db[_0x4f5c('0x15f')],{'as':_0x4f5c('0x160'),'through':_0x4f5c('0x114')});db[_0x4f5c('0x1a')][_0x4f5c('0x132')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x161'),'through':_0x4f5c('0x162')});db[_0x4f5c('0x1c')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':'User','foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x1e')][_0x4f5c('0x130')](db['User'],{'as':_0x4f5c('0x12'),'foreignKey':_0x4f5c('0x11e')});db['VoiceMail'][_0x4f5c('0x11f')](db[_0x4f5c('0x163')],{'as':_0x4f5c('0x164'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x165'),'sourceKey':'mailbox'});db[_0x4f5c('0x163')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x4f5c('0x165'),'targetKey':'mailbox'});db[_0x4f5c('0x22')]['hasMany'](db[_0x4f5c('0x27')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x4f5c('0x22')][_0x4f5c('0x11f')](db[_0x4f5c('0x26')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x4f5c('0x22')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x12'),'foreignKey':'UserId'});db[_0x4f5c('0x22')][_0x4f5c('0x130')](db['CmContact'],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x168')]['belongsTo'](db['MailAccount'],{'as':_0x4f5c('0x3e'),'foreignKey':_0x4f5c('0x169')});db[_0x4f5c('0x168')][_0x4f5c('0x130')](db[_0x4f5c('0x112')],{'as':'CloudProvider','foreignKey':_0x4f5c('0x16a'),'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x3c')][_0x4f5c('0x130')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x4f5c('0x169')});db[_0x4f5c('0x3c')][_0x4f5c('0x130')](db[_0x4f5c('0x112')],{'as':'CloudProvider','foreignKey':_0x4f5c('0x16a'),'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x3e')][_0x4f5c('0x11b')](db[_0x4f5c('0x168')],{'as':'Imap','onDelete':_0x4f5c('0x11c')});db['MailAccount']['hasOne'](db[_0x4f5c('0x3c')],{'as':_0x4f5c('0x16c'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x3e')][_0x4f5c('0x11f')](db[_0x4f5c('0x88')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x4f5c('0x3e')][_0x4f5c('0x11f')](db[_0x4f5c('0x16d')],{'as':_0x4f5c('0x16e'),'foreignKey':_0x4f5c('0x169')});db[_0x4f5c('0x3e')][_0x4f5c('0x11f')](db[_0x4f5c('0x44')],{'as':_0x4f5c('0x164'),'foreignKey':'MailAccountId'});db[_0x4f5c('0x3e')][_0x4f5c('0x11f')](db[_0x4f5c('0x42')],{'as':_0x4f5c('0x16f')});db[_0x4f5c('0x3e')][_0x4f5c('0x11f')](db[_0x4f5c('0x46')],{'as':_0x4f5c('0x152'),'foreignKey':_0x4f5c('0x169'),'onDelete':'cascade'});db['MailAccount'][_0x4f5c('0x130')](db['CmList'],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db['MailAccount'][_0x4f5c('0x130')](db[_0x4f5c('0x99')],{'as':_0x4f5c('0x99'),'foreignKey':'TemplateId'});db['MailAccount'][_0x4f5c('0x130')](db[_0x4f5c('0x8d')],{'as':_0x4f5c('0x172'),'foreignKey':_0x4f5c('0x15c')});db[_0x4f5c('0x3e')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x4f5c('0x140')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x142')});db[_0x4f5c('0x140')][_0x4f5c('0x132')](db[_0x4f5c('0x15f')],{'through':_0x4f5c('0x173'),'as':_0x4f5c('0x160')});db[_0x4f5c('0x42')][_0x4f5c('0x11f')](db[_0x4f5c('0x44')],{'as':'Messages','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x174')});db[_0x4f5c('0x42')][_0x4f5c('0x130')](db[_0x4f5c('0x3e')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x169')});db[_0x4f5c('0x42')]['belongsTo'](db[_0x4f5c('0x79')],{'as':'Contact','foreignKey':_0x4f5c('0x167')});db['MailInteraction'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x177'),'as':_0x4f5c('0x178')});db[_0x4f5c('0x42')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x4f5c('0x42')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x179'),'through':'user_has_mail_interactions','foreignKey':_0x4f5c('0x174')});db['MailMessage'][_0x4f5c('0x11f')](db[_0x4f5c('0xf6')],{'as':_0x4f5c('0x17a'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x44')][_0x4f5c('0x130')](db['User'],{'as':'User'});db[_0x4f5c('0x44')][_0x4f5c('0x130')](db['CmContact'],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166')});db[_0x4f5c('0x44')][_0x4f5c('0x130')](db[_0x4f5c('0x42')],{'as':_0x4f5c('0x17b'),'foreignKey':_0x4f5c('0x174')});db[_0x4f5c('0x44')]['belongsTo'](db[_0x4f5c('0x3e')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x169')});db[_0x4f5c('0x44')][_0x4f5c('0x130')](db[_0x4f5c('0x68')],{'as':_0x4f5c('0x68'),'foreignKey':_0x4f5c('0x17c')});db[_0x4f5c('0x44')][_0x4f5c('0x130')](db['ChatOfflineMessage'],{'as':_0x4f5c('0x71'),'foreignKey':_0x4f5c('0x17d')});db['MailApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':'restrict'});db[_0x4f5c('0x46')][_0x4f5c('0x130')](db['MailQueue'],{'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x46')][_0x4f5c('0x130')](db[_0x4f5c('0x3e')],{'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x46')][_0x4f5c('0x130')](db[_0x4f5c('0x8b')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0x46')][_0x4f5c('0x130')](db[_0x4f5c('0x176')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':'TagId'});db[_0x4f5c('0x48')][_0x4f5c('0x130')](db[_0x4f5c('0x3e')],{});db['MailQueueReport'][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x48')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':'Contact','foreignKey':_0x4f5c('0x167')});db['MailQueueReport']['belongsTo'](db[_0x4f5c('0x42')],{});db[_0x4f5c('0x48')]['belongsTo'](db[_0x4f5c('0x44')],{});db[_0x4f5c('0x48')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{});db[_0x4f5c('0x48')][_0x4f5c('0x130')](db[_0x4f5c('0x140')],{});db['Dashboard'][_0x4f5c('0x11f')](db['DashboardItem'],{'as':_0x4f5c('0x17e'),'onDelete':'cascade'});db[_0x4f5c('0x4d')][_0x4f5c('0x11f')](db[_0x4f5c('0x88')],{'as':'Dispositions','foreignKey':_0x4f5c('0x17f'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x4d')][_0x4f5c('0x11f')](db[_0x4f5c('0x16d')],{'as':_0x4f5c('0x16e'),'foreignKey':_0x4f5c('0x17f')});db['FaxAccount']['hasMany'](db[_0x4f5c('0x50')],{'as':'Interactions'});db['FaxAccount']['hasMany'](db[_0x4f5c('0x4e')],{'as':_0x4f5c('0x152'),'foreignKey':_0x4f5c('0x17f'),'onDelete':_0x4f5c('0x11c')});db['FaxAccount']['hasMany'](db[_0x4f5c('0x122')],{'as':'Exntensions','onDelete':_0x4f5c('0x11c')});db['FaxAccount'][_0x4f5c('0x11f')](db['FaxMessage'],{'as':_0x4f5c('0x164')});db['FaxAccount'][_0x4f5c('0x130')](db[_0x4f5c('0x2b')],{'as':'Trunk'});db[_0x4f5c('0x4d')]['belongsTo'](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x4d')][_0x4f5c('0x130')](db[_0x4f5c('0x8d')],{'as':_0x4f5c('0x172'),'foreignKey':_0x4f5c('0x15c')});db['FaxAccount'][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x14b')});db[_0x4f5c('0x4e')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x4e')][_0x4f5c('0x130')](db[_0x4f5c('0x144')],{'onDelete':'restrict'});db['FaxApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x4d')],{'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x4e')]['belongsTo'](db[_0x4f5c('0x176')],{'onDelete':'restrict','foreignKey':_0x4f5c('0x180')});db[_0x4f5c('0x50')][_0x4f5c('0x11f')](db[_0x4f5c('0x52')],{'as':_0x4f5c('0x164'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x181')});db[_0x4f5c('0x50')]['belongsTo'](db['FaxAccount'],{'as':_0x4f5c('0x175'),'foreignKey':'FaxAccountId'});db[_0x4f5c('0x50')]['belongsTo'](db['CmContact'],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db['FaxInteraction'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x182'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x50')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x4f5c('0x50')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x183'),'as':_0x4f5c('0x184')});db[_0x4f5c('0x50')][_0x4f5c('0x132')](db['User'],{'as':_0x4f5c('0x179'),'through':_0x4f5c('0x13b'),'foreignKey':'FaxInteractionId'});db[_0x4f5c('0x52')]['belongsTo'](db['User'],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x12')});db[_0x4f5c('0x52')][_0x4f5c('0x130')](db[_0x4f5c('0x50')],{'as':'Interaction','foreignKey':_0x4f5c('0x181')});db[_0x4f5c('0x52')]['belongsTo'](db[_0x4f5c('0x79')],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166')});db['FaxMessage'][_0x4f5c('0x130')](db['Attachment'],{'as':_0x4f5c('0xf6'),'foreignKey':'AttachmentId'});db[_0x4f5c('0x52')][_0x4f5c('0x130')](db[_0x4f5c('0x4d')],{'as':'Account','foreignKey':_0x4f5c('0x17f')});db['FaxQueue'][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x34')});db[_0x4f5c('0x144')][_0x4f5c('0x132')](db[_0x4f5c('0x15f')],{'through':_0x4f5c('0x185'),'as':_0x4f5c('0x160')});db[_0x4f5c('0x54')][_0x4f5c('0x130')](db[_0x4f5c('0x4d')],{});db[_0x4f5c('0x54')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x54')][_0x4f5c('0x130')](db[_0x4f5c('0x50')],{});db[_0x4f5c('0x54')][_0x4f5c('0x130')](db[_0x4f5c('0x52')],{});db['FaxQueueReport'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{});db[_0x4f5c('0x54')][_0x4f5c('0x130')](db[_0x4f5c('0x144')],{});db[_0x4f5c('0x56')]['hasMany'](db[_0x4f5c('0x88')],{'as':_0x4f5c('0x186'),'foreignKey':_0x4f5c('0x187'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x56')][_0x4f5c('0x11f')](db['CannedAnswer'],{'as':_0x4f5c('0x16e'),'foreignKey':_0x4f5c('0x187')});db['SmsAccount']['hasMany'](db[_0x4f5c('0x5b')],{'as':_0x4f5c('0x164'),'foreignKey':_0x4f5c('0x187')});db[_0x4f5c('0x56')][_0x4f5c('0x11f')](db[_0x4f5c('0x59')],{'as':_0x4f5c('0x16f')});db[_0x4f5c('0x56')][_0x4f5c('0x11f')](db[_0x4f5c('0x188')],{'as':_0x4f5c('0x152'),'foreignKey':_0x4f5c('0x187'),'onDelete':_0x4f5c('0x11c')});db['SmsAccount'][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x56')][_0x4f5c('0x130')](db[_0x4f5c('0x8d')],{'as':_0x4f5c('0x172'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f5c('0x56')]['belongsToMany'](db['User'],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x189')});db['SmsApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x16b')});db['SmsApplication']['belongsTo'](db[_0x4f5c('0x5d')],{'onDelete':'restrict'});db[_0x4f5c('0x188')][_0x4f5c('0x130')](db[_0x4f5c('0x56')],{'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x188')][_0x4f5c('0x130')](db[_0x4f5c('0x8b')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x176')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':_0x4f5c('0x180')});db[_0x4f5c('0x59')][_0x4f5c('0x11f')](db[_0x4f5c('0x5b')],{'as':_0x4f5c('0x164'),'onDelete':'cascade','foreignKey':_0x4f5c('0x18a')});db[_0x4f5c('0x59')][_0x4f5c('0x130')](db[_0x4f5c('0x56')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x187')});db['SmsInteraction'][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x59')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x182'),'foreignKey':_0x4f5c('0x11e')});db['SmsInteraction'][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x18b'),'as':'Tags'});db['SmsInteraction'][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x18b'),'as':'ThroughTags'});db[_0x4f5c('0x59')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':'Users','through':_0x4f5c('0x13c'),'foreignKey':_0x4f5c('0x18a')});db[_0x4f5c('0x5b')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':'User'});db[_0x4f5c('0x5b')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166')});db[_0x4f5c('0x5b')][_0x4f5c('0x130')](db[_0x4f5c('0x59')],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x17b'),'foreignKey':_0x4f5c('0x18a')});db['SmsMessage'][_0x4f5c('0x130')](db[_0x4f5c('0x56')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x187')});db[_0x4f5c('0x5d')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x36'),'foreignKey':_0x4f5c('0x18c')});db[_0x4f5c('0x5d')][_0x4f5c('0x132')](db[_0x4f5c('0x15f')],{'through':_0x4f5c('0x18d'),'as':'Teams'});db[_0x4f5c('0x5f')]['hasMany'](db[_0x4f5c('0x88')],{'as':_0x4f5c('0x186'),'foreignKey':'OpenchannelAccountId','onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x5f')]['hasMany'](db[_0x4f5c('0x16d')],{'as':_0x4f5c('0x16e'),'foreignKey':_0x4f5c('0x18e')});db[_0x4f5c('0x5f')][_0x4f5c('0x11f')](db['OpenchannelInteraction'],{'as':_0x4f5c('0x16f'),'foreignKey':_0x4f5c('0x18e')});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0x4f5c('0x164'),'foreignKey':'OpenchannelAccountId'});db[_0x4f5c('0x5f')][_0x4f5c('0x11f')](db[_0x4f5c('0x60')],{'as':_0x4f5c('0x152'),'foreignKey':_0x4f5c('0x18e'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x5f')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db['OpenchannelAccount'][_0x4f5c('0x130')](db['Pause'],{'as':_0x4f5c('0x172'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x14f')});db['OpenchannelApplication']['belongsTo'](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x60')][_0x4f5c('0x130')](db[_0x4f5c('0x66')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':_0x4f5c('0x18f')});db['OpenchannelApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x5f')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':_0x4f5c('0x18e')});db['OpenchannelApplication']['belongsTo'](db[_0x4f5c('0x8b')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':_0x4f5c('0x15b')});db['OpenchannelApplication'][_0x4f5c('0x130')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x4f5c('0x62')][_0x4f5c('0x11f')](db[_0x4f5c('0x64')],{'as':_0x4f5c('0x164'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x190')});db[_0x4f5c('0x62')]['belongsTo'](db[_0x4f5c('0x5f')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x18e')});db[_0x4f5c('0x62')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x62')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x182'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x62')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':'openchannel_interaction_has_tags','as':_0x4f5c('0x178')});db[_0x4f5c('0x62')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x191'),'as':_0x4f5c('0x184')});db[_0x4f5c('0x62')]['belongsToMany'](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x179'),'through':'user_has_openchannel_interactions','foreignKey':_0x4f5c('0x190')});db[_0x4f5c('0x64')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x11c'),'as':'User'});db[_0x4f5c('0x64')][_0x4f5c('0x130')](db['CmContact'],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166')});db[_0x4f5c('0x64')]['belongsTo'](db[_0x4f5c('0x62')],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x17b'),'foreignKey':_0x4f5c('0x190')});db[_0x4f5c('0x64')][_0x4f5c('0x130')](db['Attachment'],{'as':_0x4f5c('0xf6'),'foreignKey':_0x4f5c('0x192')});db[_0x4f5c('0x64')][_0x4f5c('0x130')](db[_0x4f5c('0x5f')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x18e')});db['OpenchannelQueue']['belongsToMany'](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x38'),'foreignKey':_0x4f5c('0x18f')});db[_0x4f5c('0x66')]['belongsToMany'](db[_0x4f5c('0x15f')],{'through':_0x4f5c('0x193'),'as':'Teams'});db[_0x4f5c('0x68')][_0x4f5c('0x11f')](db[_0x4f5c('0x88')],{'as':_0x4f5c('0x186'),'foreignKey':_0x4f5c('0x17c'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x68')][_0x4f5c('0x11f')](db[_0x4f5c('0x16d')],{'as':_0x4f5c('0x16e'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x4f5c('0x11f')](db[_0x4f5c('0x76')],{'as':_0x4f5c('0x194')});db[_0x4f5c('0x68')][_0x4f5c('0x11f')](db[_0x4f5c('0x6e')],{'as':'Interactions'});db[_0x4f5c('0x68')][_0x4f5c('0x11f')](db[_0x4f5c('0x6c')],{'as':_0x4f5c('0x152'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x4f5c('0x68')][_0x4f5c('0x11f')](db[_0x4f5c('0x70')],{'as':'Messages'});db['ChatWebsite'][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db['ChatWebsite'][_0x4f5c('0x130')](db['Interval'],{'as':_0x4f5c('0x8b'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0x68')][_0x4f5c('0x130')](db[_0x4f5c('0x3e')],{'as':'MailAccount','foreignKey':_0x4f5c('0x169')});db[_0x4f5c('0x68')]['belongsTo'](db[_0x4f5c('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f5c('0x15c')});db[_0x4f5c('0x68')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x195')});db[_0x4f5c('0x6a')][_0x4f5c('0x130')](db[_0x4f5c('0x5f')],{});db[_0x4f5c('0x6a')]['belongsTo'](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x6a')][_0x4f5c('0x130')](db['CmContact'],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db['OpenchannelQueueReport'][_0x4f5c('0x130')](db[_0x4f5c('0x62')],{});db['OpenchannelQueueReport'][_0x4f5c('0x130')](db[_0x4f5c('0x64')],{});db[_0x4f5c('0x6a')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{});db[_0x4f5c('0x6a')]['belongsTo'](db[_0x4f5c('0x66')],{});db[_0x4f5c('0x6c')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x196'),'foreignKey':_0x4f5c('0x11e'),'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x6c')][_0x4f5c('0x130')](db['ChatQueue'],{'as':_0x4f5c('0x197'),'foreignKey':'ChatQueueId','onDelete':_0x4f5c('0x16b')});db['ChatApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x68')],{'as':'Website','foreignKey':_0x4f5c('0x17c'),'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x6c')][_0x4f5c('0x130')](db[_0x4f5c('0x176')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x4f5c('0x6e')][_0x4f5c('0x11f')](db[_0x4f5c('0x70')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x4f5c('0x198')});db[_0x4f5c('0x6e')][_0x4f5c('0x130')](db[_0x4f5c('0x68')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x17c')});db[_0x4f5c('0x6e')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x6e')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x182'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x6e')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x199'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x199'),'as':_0x4f5c('0x184')});db[_0x4f5c('0x6e')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x179'),'through':_0x4f5c('0x13a'),'foreignKey':_0x4f5c('0x198')});db[_0x4f5c('0x70')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x11c'),'as':'User'});db[_0x4f5c('0x70')]['belongsTo'](db['CmContact'],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166'),'foreignKey':'ContactId'});db['ChatMessage'][_0x4f5c('0x130')](db[_0x4f5c('0x6e')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x4f5c('0x198')});db['ChatMessage']['belongsTo'](db[_0x4f5c('0xf6')],{'as':_0x4f5c('0xf6'),'foreignKey':'AttachmentId'});db[_0x4f5c('0x70')][_0x4f5c('0x130')](db['ChatWebsite'],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x17c')});db['ChatOfflineMessage'][_0x4f5c('0x11f')](db[_0x4f5c('0xf6')],{'as':_0x4f5c('0x17a'),'foreignKey':_0x4f5c('0x17d'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db['ChatOfflineMessage'][_0x4f5c('0x130')](db['CmContact'],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db['ChatOfflineMessage']['belongsTo'](db[_0x4f5c('0x68')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x17c')});db[_0x4f5c('0x72')]['belongsToMany'](db['User'],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x31'),'hooks':!![]});db[_0x4f5c('0x72')][_0x4f5c('0x132')](db[_0x4f5c('0x15f')],{'through':_0x4f5c('0x19a'),'as':_0x4f5c('0x160')});db[_0x4f5c('0x74')][_0x4f5c('0x11f')](db['ChatInternalMessage'],{'as':_0x4f5c('0x164'),'foreignKey':_0x4f5c('0x19b'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x74')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x155'),'through':_0x4f5c('0x134')});db[_0x4f5c('0x76')]['belongsTo'](db[_0x4f5c('0x68')],{'as':_0x4f5c('0x19c'),'foreignKey':_0x4f5c('0x17c')});db[_0x4f5c('0x19d')]['hasMany'](db[_0x4f5c('0x79')],{'as':'Contacts','foreignKey':_0x4f5c('0x19e')});db[_0x4f5c('0x79')][_0x4f5c('0x11f')](db[_0x4f5c('0x95')],{'as':_0x4f5c('0x19f'),'foreignKey':_0x4f5c('0x1a0')});db[_0x4f5c('0x79')][_0x4f5c('0x11f')](db[_0x4f5c('0x7b')],{'as':_0x4f5c('0x12f'),'foreignKey':_0x4f5c('0x167')});db['CmContact'][_0x4f5c('0x11f')](db['CmHopperFinal'],{'as':_0x4f5c('0x124'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x79')][_0x4f5c('0x11f')](db[_0x4f5c('0x80')],{'as':_0x4f5c('0x1a1'),'foreignKey':_0x4f5c('0x167')});db['CmContact'][_0x4f5c('0x11f')](db[_0x4f5c('0x126')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x4f5c('0xde')],{'as':_0x4f5c('0x157'),'foreignKey':'ContactId'});db[_0x4f5c('0x79')]['hasMany'](db[_0x4f5c('0x62')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x79')][_0x4f5c('0x11f')](db[_0x4f5c('0x6e')],{'as':'ChatInteractions','foreignKey':_0x4f5c('0x167'),'onDelete':_0x4f5c('0x16b')});db['CmContact'][_0x4f5c('0x11f')](db[_0x4f5c('0x59')],{'as':'SmsInteractions','foreignKey':_0x4f5c('0x167'),'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x79')][_0x4f5c('0x11f')](db[_0x4f5c('0x50')],{'as':_0x4f5c('0x12a'),'foreignKey':_0x4f5c('0x167'),'onDelete':_0x4f5c('0x16b')});db['CmContact'][_0x4f5c('0x11f')](db['MailInteraction'],{'as':_0x4f5c('0x12b'),'foreignKey':_0x4f5c('0x167'),'onDelete':'restrict'});db[_0x4f5c('0x79')][_0x4f5c('0x130')](db['CmCompany'],{'as':_0x4f5c('0x1a2'),'foreignKey':'CompanyId'});db[_0x4f5c('0x79')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x4f5c('0x79')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':'Users','through':_0x4f5c('0x136')});db['CmContact'][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'as':_0x4f5c('0x178'),'through':_0x4f5c('0x1a3')});db[_0x4f5c('0x79')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x1a3'),'as':'ThroughTags'});db[_0x4f5c('0x7b')][_0x4f5c('0x11f')](db[_0x4f5c('0x97')],{'as':_0x4f5c('0x1a4'),'foreignKey':'CmHopperId'});db[_0x4f5c('0x7b')][_0x4f5c('0x130')](db['CmContact'],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x7b')][_0x4f5c('0x130')](db['CmList'],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171'),'onDelete':'cascade'});db['CmHopper'][_0x4f5c('0x130')](db['User'],{'as':_0x4f5c('0x196'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x7b')][_0x4f5c('0x130')](db['VoiceQueue'],{'as':_0x4f5c('0x197'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopper'][_0x4f5c('0x130')](db[_0x4f5c('0xf2')],{'as':'Campaign','foreignKey':_0x4f5c('0x1a5'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x7b')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x182'),'foreignKey':'OwnerId'});db[_0x4f5c('0x7d')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167'),'onDelete':'cascade'});db[_0x4f5c('0x7d')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':'List','foreignKey':_0x4f5c('0x171'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x7d')][_0x4f5c('0x130')](db[_0x4f5c('0x1a')],{'as':_0x4f5c('0x197'),'foreignKey':_0x4f5c('0x156'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x7d')][_0x4f5c('0x130')](db[_0x4f5c('0xf2')],{'as':_0x4f5c('0xf2'),'foreignKey':_0x4f5c('0x1a5'),'onDelete':_0x4f5c('0x11c')});db['Automation'][_0x4f5c('0x11f')](db[_0x4f5c('0x8a')],{'as':{'plural':_0x4f5c('0x1a6'),'singular':_0x4f5c('0x1a7')},'foreignKey':'AutomationAllId','onDelete':_0x4f5c('0x11c'),'hooks':!![]});db['Automation'][_0x4f5c('0x11f')](db[_0x4f5c('0x8a')],{'as':{'plural':'Any','singular':_0x4f5c('0x1a8')},'foreignKey':_0x4f5c('0x1a9'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db[_0x4f5c('0x1aa')][_0x4f5c('0x11f')](db['Action'],{'as':_0x4f5c('0x1ab'),'foreignKey':'AutomationId','onDelete':_0x4f5c('0x11c'),'hooks':!![]});db[_0x4f5c('0x88')]['hasMany'](db[_0x4f5c('0x88')],{'as':_0x4f5c('0x186'),'foreignKey':_0x4f5c('0x1ac'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x8b')][_0x4f5c('0x11f')](db[_0x4f5c('0x8b')],{'as':_0x4f5c('0x1ad'),'foreignKey':_0x4f5c('0x15b'),'onDelete':_0x4f5c('0x11c'),'hooks':!![],'required':![]});db[_0x4f5c('0x8b')][_0x4f5c('0x11f')](db['VoiceExtension'],{'as':_0x4f5c('0x123'),'foreignKey':'IntervalId','onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x8b')][_0x4f5c('0x11f')](db[_0x4f5c('0x46')],{'as':_0x4f5c('0x1ae'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0x8b')][_0x4f5c('0x11f')](db[_0x4f5c('0x6c')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x4f5c('0x8b')]['hasMany'](db['FaxApplication'],{'as':_0x4f5c('0x1af'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0x8b')][_0x4f5c('0x11f')](db['SmsApplication'],{'as':_0x4f5c('0x1b0'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0x91')][_0x4f5c('0x130')](db['MailAccount'],{});db[_0x4f5c('0x91')][_0x4f5c('0x130')](db[_0x4f5c('0x1b1')],{'foreignKey':_0x4f5c('0x1b2')});db[_0x4f5c('0x91')][_0x4f5c('0x130')](db[_0x4f5c('0x1b3')],{'foreignKey':_0x4f5c('0x1b4')});db[_0x4f5c('0x153')]['belongsToMany'](db[_0x4f5c('0x18')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x176')]['belongsToMany'](db[_0x4f5c('0x79')],{'through':_0x4f5c('0x1a3')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x4f5c('0x176')][_0x4f5c('0x132')](db[_0x4f5c('0x42')],{'through':_0x4f5c('0x177')});db['Tag']['belongsToMany'](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x4f5c('0x176')][_0x4f5c('0x132')](db[_0x4f5c('0x50')],{'through':_0x4f5c('0x183')});db[_0x4f5c('0x176')][_0x4f5c('0x132')](db[_0x4f5c('0x62')],{'through':_0x4f5c('0x191')});db['Tag']['belongsToMany'](db['WhatsappInteraction'],{'through':_0x4f5c('0x1b5')});db[_0x4f5c('0x95')][_0x4f5c('0x130')](db[_0x4f5c('0x93')],{'as':_0x4f5c('0x1b6'),'foreignKey':'ItemTypeId'});db[_0x4f5c('0x97')]['belongsTo'](db[_0x4f5c('0x7b')],{'as':_0x4f5c('0x1b7'),'foreignKey':_0x4f5c('0x1b8')});db[_0x4f5c('0x95')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':'CmContactId'});db['Trigger'][_0x4f5c('0x11f')](db[_0x4f5c('0x8a')],{'as':{'plural':_0x4f5c('0x1b9'),'singular':'AllCondition'},'foreignKey':_0x4f5c('0x1ba'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db[_0x4f5c('0x9b')][_0x4f5c('0x11f')](db[_0x4f5c('0x8a')],{'as':{'plural':_0x4f5c('0x1bb'),'singular':_0x4f5c('0x1bc')},'foreignKey':_0x4f5c('0x1bd'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db['Trigger'][_0x4f5c('0x11f')](db[_0x4f5c('0x84')],{'as':_0x4f5c('0x1ab'),'foreignKey':_0x4f5c('0x1be'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db['AnalyticCustomReport'][_0x4f5c('0x11f')](db['AnalyticFieldReport'],{'as':_0x4f5c('0x1bf'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1b4'),'hooks':!![]});db[_0x4f5c('0x1b1')][_0x4f5c('0x11f')](db['AnalyticFieldReport'],{'as':_0x4f5c('0x1bf'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1b2')});db[_0x4f5c('0xa4')][_0x4f5c('0x11f')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c0')});db[_0x4f5c('0xa6')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x4f5c('0xaa')][_0x4f5c('0x11f')](db['SalesforceConfiguration'],{'as':_0x4f5c('0x1c1'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0x1c3')][_0x4f5c('0x11f')](db[_0x4f5c('0xad')],{'as':_0x4f5c('0x1c4'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0x1c3')][_0x4f5c('0x11f')](db[_0x4f5c('0xad')],{'as':_0x4f5c('0x1c6'),'onDelete':_0x4f5c('0x11c'),'foreignKey':'DescriptionId'});db[_0x4f5c('0x1c3')][_0x4f5c('0x11f')](db[_0x4f5c('0xad')],{'as':_0x4f5c('0x1bf'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0x1c3')][_0x4f5c('0x130')](db[_0x4f5c('0xaa')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xad')]['hasMany'](db[_0x4f5c('0xad')],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xad')][_0x4f5c('0x11f')](db['SalesforceField'],{'as':_0x4f5c('0x1c9'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xad')][_0x4f5c('0x11f')](db[_0x4f5c('0xad')],{'as':'Field','foreignKey':'FieldId'});db[_0x4f5c('0xad')][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':_0x4f5c('0x9c'),'foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0xaf')][_0x4f5c('0x11f')](db[_0x4f5c('0x1cc')],{'as':_0x4f5c('0x1c1'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0x1cc')]['hasMany'](db[_0x4f5c('0xb1')],{'as':_0x4f5c('0x1c4'),'onDelete':_0x4f5c('0x11c'),'foreignKey':'SubjectId'});db[_0x4f5c('0x1cc')][_0x4f5c('0x11f')](db['SugarcrmField'],{'as':_0x4f5c('0x1c6'),'onDelete':_0x4f5c('0x11c'),'foreignKey':'DescriptionId'});db[_0x4f5c('0x1cc')]['hasMany'](db[_0x4f5c('0xb1')],{'as':_0x4f5c('0x1bf'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c7')});db['SugarcrmConfiguration'][_0x4f5c('0x130')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xb1')][_0x4f5c('0x11f')](db[_0x4f5c('0xb1')],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xb1')][_0x4f5c('0x11f')](db['SugarcrmField'],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x4f5c('0x11f')](db[_0x4f5c('0xb1')],{'as':'Field','foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0xb1')][_0x4f5c('0x130')](db['Variable'],{'as':_0x4f5c('0x9c'),'foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0x1cd')][_0x4f5c('0x11f')](db[_0x4f5c('0xb4')],{'as':_0x4f5c('0x1c1'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xb4')]['hasMany'](db[_0x4f5c('0x1ce')],{'as':'Subjects','onDelete':_0x4f5c('0x11c'),'foreignKey':'SubjectId'});db[_0x4f5c('0xb4')][_0x4f5c('0x11f')](db[_0x4f5c('0x1ce')],{'as':_0x4f5c('0x1c6'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xb4')][_0x4f5c('0x11f')](db[_0x4f5c('0x1ce')],{'as':_0x4f5c('0x1bf'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0xb4')][_0x4f5c('0x130')](db[_0x4f5c('0x1cd')],{'as':'Account','foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xb4')]['belongsToMany'](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x1cf')});db[_0x4f5c('0x1ce')][_0x4f5c('0x11f')](db[_0x4f5c('0x1ce')],{'as':_0x4f5c('0x1c8'),'foreignKey':'SubjectId'});db[_0x4f5c('0x1ce')][_0x4f5c('0x11f')](db['DeskField'],{'as':_0x4f5c('0x1c9'),'foreignKey':_0x4f5c('0x1ca')});db['DeskField']['hasMany'](db[_0x4f5c('0x1ce')],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0x1ce')][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':'Variable','foreignKey':_0x4f5c('0x1cb')});db['ZohoAccount'][_0x4f5c('0x11f')](db[_0x4f5c('0x1d1')],{'as':_0x4f5c('0x1c1'),'onDelete':_0x4f5c('0x11c'),'foreignKey':'AccountId'});db[_0x4f5c('0x1d1')]['hasMany'](db['ZohoField'],{'as':_0x4f5c('0x1c4'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c5')});db['ZohoConfiguration'][_0x4f5c('0x11f')](db[_0x4f5c('0x1d2')],{'as':_0x4f5c('0x1c6'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1ca')});db['ZohoConfiguration']['hasMany'](db[_0x4f5c('0x1d2')],{'as':_0x4f5c('0x1bf'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0x1d1')]['belongsTo'](db[_0x4f5c('0xb6')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0x1d2')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d2')],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0x1d2')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d2')],{'as':'Description','foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0x1d2')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d2')],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db['ZohoField'][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':_0x4f5c('0x9c'),'foreignKey':'VariableId'});db[_0x4f5c('0x1d3')][_0x4f5c('0x11f')](db[_0x4f5c('0xbb')],{'as':'Configurations','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xbb')][_0x4f5c('0x11f')](db[_0x4f5c('0xbd')],{'as':_0x4f5c('0x1c4'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xbb')][_0x4f5c('0x11f')](db[_0x4f5c('0xbd')],{'as':_0x4f5c('0x1c6'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xbb')][_0x4f5c('0x11f')](db[_0x4f5c('0xbd')],{'as':_0x4f5c('0x1bf'),'foreignKey':_0x4f5c('0x1c7')});db['ZendeskConfiguration'][_0x4f5c('0x130')](db['ZendeskAccount'],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xbb')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x1d4')});db[_0x4f5c('0xbd')][_0x4f5c('0x11f')](db[_0x4f5c('0xbd')],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xbd')]['hasMany'](db[_0x4f5c('0xbd')],{'as':_0x4f5c('0x1c9'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xbd')][_0x4f5c('0x11f')](db[_0x4f5c('0xbd')],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0xbd')][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':'Variable','foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0xbf')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d5')],{'as':'Configurations','onDelete':_0x4f5c('0x11c'),'foreignKey':'AccountId'});db[_0x4f5c('0x1d5')][_0x4f5c('0x11f')](db[_0x4f5c('0xc1')],{'as':_0x4f5c('0x1c4'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0x1d5')]['hasMany'](db[_0x4f5c('0xc1')],{'as':'Descriptions','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0x1d5')][_0x4f5c('0x11f')](db[_0x4f5c('0xc1')],{'as':'Fields','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0x1d5')][_0x4f5c('0x130')](db[_0x4f5c('0xbf')],{'as':_0x4f5c('0x175'),'foreignKey':'AccountId'});db[_0x4f5c('0x1d5')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x1d6')});db[_0x4f5c('0xc1')][_0x4f5c('0x11f')](db['FreshdeskField'],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db['FreshdeskField']['hasMany'](db[_0x4f5c('0xc1')],{'as':_0x4f5c('0x1c9'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xc1')][_0x4f5c('0x11f')](db[_0x4f5c('0xc1')],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0xc1')][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':_0x4f5c('0x9c'),'foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0xc3')][_0x4f5c('0x11f')](db[_0x4f5c('0xc5')],{'as':_0x4f5c('0x1c1'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration']['hasMany'](db[_0x4f5c('0x1d7')],{'as':_0x4f5c('0x1c4'),'foreignKey':'SubjectId'});db[_0x4f5c('0xc5')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d7')],{'as':_0x4f5c('0x1c6'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xc5')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d7')],{'as':'Fields','foreignKey':_0x4f5c('0x1c7')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x4f5c('0x1d7')]['hasMany'](db[_0x4f5c('0x1d7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4f5c('0x1d7')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d7')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x4f5c('0x11f')](db[_0x4f5c('0x1d7')],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0x1d7')][_0x4f5c('0x130')](db['Variable'],{'as':_0x4f5c('0x9c'),'foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0x1d8')][_0x4f5c('0x11f')](db[_0x4f5c('0xc8')],{'as':'Configurations','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xc8')][_0x4f5c('0x11f')](db['ServicenowField'],{'as':_0x4f5c('0x1c4'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xc8')][_0x4f5c('0x11f')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xc8')][_0x4f5c('0x11f')](db[_0x4f5c('0xca')],{'as':_0x4f5c('0x1bf'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0xc8')][_0x4f5c('0x130')](db[_0x4f5c('0x1d8')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xca')]['hasMany'](db['ServicenowField'],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xca')][_0x4f5c('0x11f')](db['ServicenowField'],{'as':'Description','foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xca')][_0x4f5c('0x11f')](db[_0x4f5c('0xca')],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0xca')][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':_0x4f5c('0x9c'),'foreignKey':_0x4f5c('0x1cb')});db['Dynamics365Account'][_0x4f5c('0x11f')](db[_0x4f5c('0xce')],{'as':_0x4f5c('0x1c1'),'onDelete':'cascade','foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xcc')][_0x4f5c('0x130')](db['CloudProvider'],{'as':_0x4f5c('0x112'),'foreignKey':_0x4f5c('0x16a')});db[_0x4f5c('0xce')][_0x4f5c('0x11f')](db[_0x4f5c('0x1d9')],{'as':_0x4f5c('0x1c4'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c5')});db[_0x4f5c('0xce')]['hasMany'](db['Dynamics365Field'],{'as':_0x4f5c('0x1c6'),'onDelete':_0x4f5c('0x11c'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x4f5c('0x11f')](db[_0x4f5c('0x1d9')],{'as':_0x4f5c('0x1bf'),'onDelete':_0x4f5c('0x11c'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x4f5c('0x130')](db[_0x4f5c('0xcc')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0x1d9')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x4f5c('0x1c5')});db['Dynamics365Field'][_0x4f5c('0x11f')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0x1d9')][_0x4f5c('0x11f')](db['Dynamics365Field'],{'as':_0x4f5c('0x1d0'),'foreignKey':_0x4f5c('0x1c7')});db[_0x4f5c('0x1d9')][_0x4f5c('0x130')](db[_0x4f5c('0x9c')],{'as':_0x4f5c('0x9c'),'foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0x1da')][_0x4f5c('0x11f')](db[_0x4f5c('0xd2')],{'as':'Configurations','onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xd2')][_0x4f5c('0x11f')](db[_0x4f5c('0xd4')],{'as':_0x4f5c('0x1c4'),'foreignKey':'SubjectId'});db[_0x4f5c('0xd2')][_0x4f5c('0x11f')](db['FreshsalesField'],{'as':_0x4f5c('0x1c6'),'foreignKey':_0x4f5c('0x1ca')});db[_0x4f5c('0xd2')][_0x4f5c('0x11f')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x4f5c('0x1c7')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1c2')});db[_0x4f5c('0xd4')][_0x4f5c('0x11f')](db[_0x4f5c('0xd4')],{'as':_0x4f5c('0x1c8'),'foreignKey':_0x4f5c('0x1c5')});db['FreshsalesField'][_0x4f5c('0x11f')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x4f5c('0x1ca')});db['FreshsalesField'][_0x4f5c('0x11f')](db[_0x4f5c('0xd4')],{'as':'Field','foreignKey':_0x4f5c('0x1c7')});db['FreshsalesField'][_0x4f5c('0x130')](db['Variable'],{'as':'Variable','foreignKey':_0x4f5c('0x1cb')});db[_0x4f5c('0x1db')]['belongsTo'](db['ChatWebsite'],{});db[_0x4f5c('0x1db')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x1db')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0x1db')]['belongsTo'](db[_0x4f5c('0x6e')],{});db[_0x4f5c('0x1db')]['belongsTo'](db[_0x4f5c('0x70')],{});db[_0x4f5c('0x1db')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{});db[_0x4f5c('0x1db')][_0x4f5c('0x130')](db[_0x4f5c('0x72')],{});db[_0x4f5c('0xd8')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x11c'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x1dc')});db[_0x4f5c('0xde')][_0x4f5c('0x11f')](db[_0x4f5c('0xdc')],{'foreignKey':'SessionId','onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0xde')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x4f5c('0x1dd'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0xdf')][_0x4f5c('0x130')](db[_0x4f5c('0x56')],{});db[_0x4f5c('0xdf')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0x4f5c('0x130')](db['CmContact'],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db[_0x4f5c('0xdf')][_0x4f5c('0x130')](db[_0x4f5c('0x59')],{});db['SmsQueueReport'][_0x4f5c('0x130')](db[_0x4f5c('0x5b')],{});db['SmsQueueReport'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{});db[_0x4f5c('0xdf')][_0x4f5c('0x130')](db[_0x4f5c('0x5d')],{});db['JscriptyProject'][_0x4f5c('0x11f')](db[_0x4f5c('0xde')],{'foreignKey':_0x4f5c('0x1de')});db['JscriptyProject'][_0x4f5c('0x11f')](db[_0x4f5c('0xdc')],{'foreignKey':_0x4f5c('0x1de')});db[_0x4f5c('0xe5')][_0x4f5c('0x11f')](db[_0x4f5c('0xda')],{'foreignKey':_0x4f5c('0x1de')});db[_0x4f5c('0x15f')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x1df')});db[_0x4f5c('0x15f')][_0x4f5c('0x132')](db[_0x4f5c('0x1a')],{'through':_0x4f5c('0x114'),'as':'VoiceQueues'});db[_0x4f5c('0x15f')][_0x4f5c('0x132')](db['MailQueue'],{'through':_0x4f5c('0x173'),'as':'MailQueues'});db[_0x4f5c('0x15f')][_0x4f5c('0x132')](db[_0x4f5c('0x72')],{'through':'team_has_chat_queues','as':_0x4f5c('0x143')});db[_0x4f5c('0x15f')]['belongsToMany'](db[_0x4f5c('0x144')],{'through':'team_has_fax_queues','as':_0x4f5c('0x145')});db[_0x4f5c('0x15f')]['belongsToMany'](db['SmsQueue'],{'through':_0x4f5c('0x18d'),'as':'SmsQueues'});db['Team'][_0x4f5c('0x132')](db[_0x4f5c('0x66')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x4f5c('0x15f')]['belongsToMany'](db[_0x4f5c('0x110')],{'through':_0x4f5c('0x1e0'),'as':_0x4f5c('0x148')});db[_0x4f5c('0x15f')][_0x4f5c('0x132')](db[_0x4f5c('0x101')],{'through':_0x4f5c('0x116'),'as':_0x4f5c('0x13f')});db[_0x4f5c('0xf2')]['hasMany'](db[_0x4f5c('0x7b')],{'as':_0x4f5c('0x12f'),'foreignKey':_0x4f5c('0x1a5')});db[_0x4f5c('0xf2')][_0x4f5c('0x11f')](db[_0x4f5c('0x7e')],{'as':_0x4f5c('0x124'),'foreignKey':'CampaignId'});db[_0x4f5c('0xf2')][_0x4f5c('0x11f')](db[_0x4f5c('0x80')],{'as':_0x4f5c('0x1a1'),'foreignKey':_0x4f5c('0x1a5')});db[_0x4f5c('0xf2')][_0x4f5c('0x11f')](db[_0x4f5c('0x7d')],{'as':_0x4f5c('0x1e1'),'foreignKey':'CampaignId'});db[_0x4f5c('0xf2')][_0x4f5c('0x130')](db['Trunk'],{'as':_0x4f5c('0x2b'),'foreignKey':_0x4f5c('0x158')});db[_0x4f5c('0xf2')][_0x4f5c('0x130')](db['Trunk'],{'as':_0x4f5c('0x159'),'foreignKey':'TrunkBackupId'});db['Campaign']['belongsTo'](db['Interval'],{'as':_0x4f5c('0x8b'),'foreignKey':_0x4f5c('0x15b')});db[_0x4f5c('0xf2')][_0x4f5c('0x130')](db[_0x4f5c('0xe9')],{'as':_0x4f5c('0xe9'),'foreignKey':'SquareProjectId'});db[_0x4f5c('0xf2')][_0x4f5c('0x132')](db['CmList'],{'as':'Lists','through':_0x4f5c('0x1e2')});db[_0x4f5c('0xf2')][_0x4f5c('0x132')](db['CmList'],{'as':'BlackLists','through':_0x4f5c('0x1e3')});db['Attachment'][_0x4f5c('0x130')](db[_0x4f5c('0x71')],{'as':'ChatOfflineMessage','foreignKey':_0x4f5c('0x17d')});db[_0x4f5c('0x1e4')][_0x4f5c('0x130')](db[_0x4f5c('0x44')],{});db[_0x4f5c('0x1e4')][_0x4f5c('0x130')](db[_0x4f5c('0x42')],{});db[_0x4f5c('0x1e4')][_0x4f5c('0x130')](db[_0x4f5c('0x3e')],{'foreignKey':_0x4f5c('0x1e5'),'as':_0x4f5c('0x1e6')});db['MailTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1e7'),'as':'FromAgent'});db[_0x4f5c('0x1e4')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':'ToUserId','as':_0x4f5c('0x1e8')});db['MailTransferReport']['belongsTo'](db[_0x4f5c('0x140')],{'foreignKey':_0x4f5c('0x1e9'),'as':_0x4f5c('0x1ea')});db[_0x4f5c('0x1e4')][_0x4f5c('0x130')](db[_0x4f5c('0x3e')],{'foreignKey':_0x4f5c('0x1eb'),'as':_0x4f5c('0x1ec')});db[_0x4f5c('0xf9')][_0x4f5c('0x130')](db[_0x4f5c('0x70')],{});db[_0x4f5c('0xf9')]['belongsTo'](db[_0x4f5c('0x6e')],{});db[_0x4f5c('0xf9')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x4f5c('0x1e6')});db[_0x4f5c('0xf9')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1e7'),'as':_0x4f5c('0x1ed')});db[_0x4f5c('0xf9')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1ee'),'as':_0x4f5c('0x1e8')});db[_0x4f5c('0xf9')][_0x4f5c('0x130')](db[_0x4f5c('0x72')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x4f5c('0xf9')][_0x4f5c('0x130')](db[_0x4f5c('0x68')],{'foreignKey':_0x4f5c('0x1ef'),'as':_0x4f5c('0x1ec')});db[_0x4f5c('0x1f0')]['belongsTo'](db['FaxMessage'],{});db['FaxTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x50')],{});db['FaxTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x4d')],{'foreignKey':_0x4f5c('0x1f1'),'as':_0x4f5c('0x1e6')});db[_0x4f5c('0x1f0')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1e7'),'as':_0x4f5c('0x1ed')});db['FaxTransferReport'][_0x4f5c('0x130')](db['User'],{'foreignKey':_0x4f5c('0x1ee'),'as':_0x4f5c('0x1e8')});db['FaxTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x144')],{'foreignKey':'ToFaxQueueId','as':_0x4f5c('0x1ea')});db[_0x4f5c('0x1f0')][_0x4f5c('0x130')](db['FaxAccount'],{'foreignKey':_0x4f5c('0x1f2'),'as':_0x4f5c('0x1ec')});db[_0x4f5c('0xfc')][_0x4f5c('0x130')](db['OpenchannelMessage'],{});db[_0x4f5c('0xfc')][_0x4f5c('0x130')](db['OpenchannelInteraction'],{});db[_0x4f5c('0xfc')][_0x4f5c('0x130')](db[_0x4f5c('0x5f')],{'foreignKey':_0x4f5c('0x1f3'),'as':_0x4f5c('0x1e6')});db['OpenchannelTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':'FromUserId','as':_0x4f5c('0x1ed')});db[_0x4f5c('0xfc')]['belongsTo'](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1ee'),'as':_0x4f5c('0x1e8')});db[_0x4f5c('0xfc')][_0x4f5c('0x130')](db[_0x4f5c('0x66')],{'foreignKey':_0x4f5c('0x1f4'),'as':_0x4f5c('0x1ea')});db[_0x4f5c('0xfc')][_0x4f5c('0x130')](db[_0x4f5c('0x5f')],{'foreignKey':_0x4f5c('0x1f5'),'as':_0x4f5c('0x1ec')});db[_0x4f5c('0xfe')][_0x4f5c('0x130')](db[_0x4f5c('0x5b')],{});db['SmsTransferReport'][_0x4f5c('0x130')](db['SmsInteraction'],{});db[_0x4f5c('0xfe')][_0x4f5c('0x130')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x4f5c('0xfe')][_0x4f5c('0x130')](db['User'],{'foreignKey':_0x4f5c('0x1e7'),'as':_0x4f5c('0x1ed')});db[_0x4f5c('0xfe')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1ee'),'as':_0x4f5c('0x1e8')});db[_0x4f5c('0xfe')][_0x4f5c('0x130')](db[_0x4f5c('0x5d')],{'foreignKey':_0x4f5c('0x1f6'),'as':_0x4f5c('0x1ea')});db['SmsTransferReport'][_0x4f5c('0x130')](db['SmsAccount'],{'foreignKey':_0x4f5c('0x1f7'),'as':_0x4f5c('0x1ec')});db[_0x4f5c('0xff')]['hasMany'](db[_0x4f5c('0x88')],{'as':_0x4f5c('0x186'),'foreignKey':'ListId','onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0xff')][_0x4f5c('0x11f')](db[_0x4f5c('0x1f8')],{'as':_0x4f5c('0x1f9'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0xff')][_0x4f5c('0x11f')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x135'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x4f5c('0xff')]['hasMany'](db[_0x4f5c('0x7e')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x4f5c('0xff')][_0x4f5c('0x11f')](db[_0x4f5c('0x80')],{'as':_0x4f5c('0x125'),'foreignKey':'ListId'});db[_0x4f5c('0xff')]['hasMany'](db[_0x4f5c('0x126')],{'as':_0x4f5c('0x126'),'foreignKey':'ListId'});db[_0x4f5c('0xff')][_0x4f5c('0x132')](db[_0x4f5c('0x1a')],{'as':_0x4f5c('0x1fa'),'through':'voice_queues_has_cm_lists'});db[_0x4f5c('0xff')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x138')});db['VoicePrefix'][_0x4f5c('0x11f')](db['VoiceExtension'],{'as':_0x4f5c('0x123'),'onDelete':'cascade'});db[_0x4f5c('0x101')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':'Agents','through':_0x4f5c('0x117')});db[_0x4f5c('0x101')][_0x4f5c('0x132')](db['Team'],{'through':_0x4f5c('0x116'),'as':_0x4f5c('0x160')});db[_0x4f5c('0x103')][_0x4f5c('0x11f')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x179'),'foreignKey':_0x4f5c('0x131')});db['UserProfile']['hasMany'](db[_0x4f5c('0x1fb')],{'as':_0x4f5c('0x1fc'),'foreignKey':_0x4f5c('0x131'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x1fb')][_0x4f5c('0x11f')](db[_0x4f5c('0x104')],{'as':_0x4f5c('0x1fd'),'foreignKey':'sectionId','onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x108')][_0x4f5c('0x11f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x4f5c('0x1fe'),'onDelete':_0x4f5c('0x11c')});db[_0x4f5c('0x108')][_0x4f5c('0x11f')](db['CannedAnswer'],{'as':_0x4f5c('0x16e'),'foreignKey':'WhatsappAccountId'});db[_0x4f5c('0x108')][_0x4f5c('0x11f')](db[_0x4f5c('0x10c')],{'as':_0x4f5c('0x164'),'foreignKey':_0x4f5c('0x1fe')});db[_0x4f5c('0x108')]['hasMany'](db[_0x4f5c('0x12c')],{'as':_0x4f5c('0x16f')});db[_0x4f5c('0x108')][_0x4f5c('0x11f')](db[_0x4f5c('0x1ff')],{'as':'Applications','foreignKey':_0x4f5c('0x1fe'),'onDelete':'cascade'});db[_0x4f5c('0x108')][_0x4f5c('0x130')](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x108')]['belongsTo'](db[_0x4f5c('0x8d')],{'as':_0x4f5c('0x172'),'foreignKey':_0x4f5c('0x15c')});db[_0x4f5c('0x108')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':'Agents','through':_0x4f5c('0x151')});db[_0x4f5c('0x1ff')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'onDelete':'restrict'});db[_0x4f5c('0x1ff')]['belongsTo'](db[_0x4f5c('0x110')],{'onDelete':_0x4f5c('0x16b')});db['WhatsappApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x108')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x4f5c('0x130')](db[_0x4f5c('0x8b')],{'onDelete':_0x4f5c('0x16b'),'foreignKey':_0x4f5c('0x15b')});db['WhatsappApplication']['belongsTo'](db[_0x4f5c('0x176')],{'onDelete':'restrict','foreignKey':_0x4f5c('0x180')});db[_0x4f5c('0x12c')]['hasMany'](db[_0x4f5c('0x10c')],{'as':_0x4f5c('0x164'),'onDelete':_0x4f5c('0x11c'),'foreignKey':_0x4f5c('0x200')});db[_0x4f5c('0x12c')][_0x4f5c('0x130')](db[_0x4f5c('0x108')],{'as':_0x4f5c('0x175'),'foreignKey':'WhatsappAccountId'});db[_0x4f5c('0x12c')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'as':_0x4f5c('0x166'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x4f5c('0x130')](db['User'],{'as':_0x4f5c('0x182'),'foreignKey':_0x4f5c('0x11e')});db[_0x4f5c('0x12c')][_0x4f5c('0x132')](db[_0x4f5c('0x176')],{'through':_0x4f5c('0x1b5'),'as':'Tags'});db['WhatsappInteraction'][_0x4f5c('0x132')](db['Tag'],{'through':_0x4f5c('0x1b5'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x179'),'through':'user_has_whatsapp_interactions','foreignKey':_0x4f5c('0x200')});db[_0x4f5c('0x10c')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x12')});db[_0x4f5c('0x10c')][_0x4f5c('0x130')](db[_0x4f5c('0x79')],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x166')});db[_0x4f5c('0x10c')]['belongsTo'](db[_0x4f5c('0x12c')],{'onDelete':_0x4f5c('0x11c'),'as':_0x4f5c('0x17b'),'foreignKey':_0x4f5c('0x200')});db[_0x4f5c('0x10c')][_0x4f5c('0x130')](db[_0x4f5c('0x108')],{'as':_0x4f5c('0x175'),'foreignKey':_0x4f5c('0x1fe')});db['WhatsappQueueReport']['belongsTo'](db[_0x4f5c('0x108')],{});db[_0x4f5c('0x201')]['belongsTo'](db[_0x4f5c('0xff')],{'as':_0x4f5c('0x170'),'foreignKey':_0x4f5c('0x171')});db[_0x4f5c('0x201')][_0x4f5c('0x130')](db['CmContact'],{'as':_0x4f5c('0x166'),'foreignKey':_0x4f5c('0x167')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x4f5c('0x201')]['belongsTo'](db[_0x4f5c('0x110')],{});db[_0x4f5c('0x201')]['belongsTo'](db[_0x4f5c('0x10c')],{});db[_0x4f5c('0x201')]['belongsTo'](db[_0x4f5c('0x12')],{});db['WhatsappTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x10c')],{});db['WhatsappTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x12c')],{});db[_0x4f5c('0x10e')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x4f5c('0x10e')][_0x4f5c('0x130')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x4f5c('0x1ec')});db[_0x4f5c('0x10e')][_0x4f5c('0x130')](db[_0x4f5c('0x110')],{'foreignKey':_0x4f5c('0x202'),'as':'ToQueue'});db[_0x4f5c('0x10e')][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':_0x4f5c('0x1e7'),'as':_0x4f5c('0x1ed')});db['WhatsappTransferReport'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'foreignKey':'ToUserId','as':_0x4f5c('0x1e8')});db[_0x4f5c('0x110')][_0x4f5c('0x132')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x15e'),'through':_0x4f5c('0x39'),'foreignKey':_0x4f5c('0x203')});db[_0x4f5c('0x110')][_0x4f5c('0x132')](db[_0x4f5c('0x15f')],{'through':_0x4f5c('0x1e0'),'as':_0x4f5c('0x160')});db['UserSetting'][_0x4f5c('0x130')](db[_0x4f5c('0x12')],{'as':_0x4f5c('0x204'),'foreignKey':_0x4f5c('0x11e'),'onDelete':_0x4f5c('0x11c'),'hooks':!![]});db[_0x4f5c('0x112')][_0x4f5c('0x11b')](db[_0x4f5c('0xcc')],{'as':_0x4f5c('0xcc'),'onDelete':_0x4f5c('0x16b')});db['CloudProvider'][_0x4f5c('0x11b')](db[_0x4f5c('0x168')],{'as':_0x4f5c('0x205'),'onDelete':_0x4f5c('0x16b')});db[_0x4f5c('0x112')][_0x4f5c('0x11b')](db[_0x4f5c('0x3c')],{'as':_0x4f5c('0x16c'),'onDelete':_0x4f5c('0x16b')});module[_0x4f5c('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6bf281f..6ae5186 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7de=['/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./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/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/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue'];(function(_0xe7c3f1,_0x12326f){var _0x1a0934=function(_0x2c3300){while(--_0x2c3300){_0xe7c3f1['push'](_0xe7c3f1['shift']());}};_0x1a0934(++_0x12326f);}(_0xe7de,0x165));var _0xee7d=function(_0x220d41,_0x44dd4a){_0x220d41=_0x220d41-0x0;var _0x1bc7f1=_0xe7de[_0x220d41];return _0x1bc7f1;};'use strict';var path=require(_0xee7d('0x0'));var express=require(_0xee7d('0x1'));var errors=require(_0xee7d('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0xee7d('0x3')];var clientSideLogs=require(_0xee7d('0x4'));exports[_0xee7d('0x5')]=function(_0x3f1c6d){return setupLoggers(_0x3f1c6d)[_0xee7d('0x6')](function(){_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x8'),require(_0xee7d('0x9')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xa'),require(_0xee7d('0xb')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xc'),require(_0xee7d('0xd')));_0x3f1c6d['use'](_0xee7d('0xe'),require(_0xee7d('0xf')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x10'),require(_0xee7d('0x11')));_0x3f1c6d[_0xee7d('0x7')]('/api/voice/queues',require(_0xee7d('0x12')));_0x3f1c6d['use'](_0xee7d('0x13'),require(_0xee7d('0x14')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x15'),require(_0xee7d('0x16')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x17'),require(_0xee7d('0x18')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x19'),require(_0xee7d('0x1a')));_0x3f1c6d['use']('/api/voice/calls/reports',require(_0xee7d('0x1b')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x1c'),require(_0xee7d('0x1d')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x1e'),require('./api/voiceAgentReport'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x1f'),require(_0xee7d('0x20')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x21'),require(_0xee7d('0x22')));_0x3f1c6d['use'](_0xee7d('0x23'),require(_0xee7d('0x24')));_0x3f1c6d[_0xee7d('0x7')]('/api/voice/transfers/reports',require(_0xee7d('0x25')));_0x3f1c6d['use'](_0xee7d('0x26'),require(_0xee7d('0x27')));_0x3f1c6d[_0xee7d('0x7')]('/api/mail/accounts',require(_0xee7d('0x28')));_0x3f1c6d['use'](_0xee7d('0x29'),require(_0xee7d('0x2a')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x2b'),require('./api/mailSubstatus'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x2c'),require(_0xee7d('0x2d')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x2e'),require(_0xee7d('0x2f')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x30'),require(_0xee7d('0x31')));_0x3f1c6d['use'](_0xee7d('0x32'),require(_0xee7d('0x33')));_0x3f1c6d[_0xee7d('0x7')]('/api/dashboards',require(_0xee7d('0x34')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x35'),require(_0xee7d('0x36')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x37'),require(_0xee7d('0x38')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x39'),require('./api/faxApplication'));_0x3f1c6d[_0xee7d('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x3f1c6d[_0xee7d('0x7')]('/api/fax/messages',require(_0xee7d('0x3a')));_0x3f1c6d[_0xee7d('0x7')]('/api/fax/queues',require(_0xee7d('0x3b')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x3c'),require(_0xee7d('0x3d')));_0x3f1c6d[_0xee7d('0x7')]('/api/sms/accounts',require(_0xee7d('0x3e')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x3f'),require(_0xee7d('0x40')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x41'),require(_0xee7d('0x42')));_0x3f1c6d[_0xee7d('0x7')]('/api/sms/messages',require(_0xee7d('0x43')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x44'),require('./api/smsQueue'));_0x3f1c6d[_0xee7d('0x7')]('/api/openchannel/accounts',require(_0xee7d('0x45')));_0x3f1c6d[_0xee7d('0x7')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x3f1c6d[_0xee7d('0x7')]('/api/openchannel/interactions',require(_0xee7d('0x46')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x47'),require(_0xee7d('0x48')));_0x3f1c6d[_0xee7d('0x7')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3f1c6d[_0xee7d('0x7')]('/api/chat/websites',require(_0xee7d('0x49')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x4a'),require(_0xee7d('0x4b')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x4c'),require(_0xee7d('0x4d')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x4e'),require(_0xee7d('0x4f')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x50'),require('./api/chatMessage'));_0x3f1c6d[_0xee7d('0x7')]('/api/chat/offline_messages',require(_0xee7d('0x51')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x52'),require('./api/chatQueue'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x53'),require(_0xee7d('0x54')));_0x3f1c6d['use'](_0xee7d('0x55'),require('./api/chatProactiveAction'));_0x3f1c6d[_0xee7d('0x7')]('/api/cm/companies',require('./api/cmCompany'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x56'),require(_0xee7d('0x57')));_0x3f1c6d[_0xee7d('0x7')]('/api/cm/hopper',require(_0xee7d('0x58')));_0x3f1c6d['use']('/api/cm/hopper_black',require(_0xee7d('0x59')));_0x3f1c6d['use'](_0xee7d('0x5a'),require('./api/cmHopperFinal'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x5b'),require(_0xee7d('0x5c')));_0x3f1c6d[_0xee7d('0x7')]('/api/cm/custom_fields',require(_0xee7d('0x5d')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x5e'),require(_0xee7d('0x5f')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x60'),require('./api/automation'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x61'),require(_0xee7d('0x62')));_0x3f1c6d[_0xee7d('0x7')]('/api/dispositions',require(_0xee7d('0x63')));_0x3f1c6d['use'](_0xee7d('0x64'),require('./api/condition'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x65'),require(_0xee7d('0x66')));_0x3f1c6d['use'](_0xee7d('0x67'),require('./api/pause'));_0x3f1c6d[_0xee7d('0x7')]('/api/cdr',require(_0xee7d('0x68')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x69'),require('./api/voiceQueuesLog'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x6a'),require('./api/schedule'));_0x3f1c6d['use'](_0xee7d('0x6b'),require(_0xee7d('0x6c')));_0x3f1c6d['use'](_0xee7d('0x6d'),require(_0xee7d('0x6e')));_0x3f1c6d[_0xee7d('0x7')]('/api/contact_item_types',require('./api/contactItemType'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x6f'),require(_0xee7d('0x70')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x71'),require(_0xee7d('0x72')));_0x3f1c6d['use'](_0xee7d('0x73'),require(_0xee7d('0x74')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x75'),require(_0xee7d('0x76')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x77'),require(_0xee7d('0x78')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x79'),require('./api/integration'));_0x3f1c6d['use'](_0xee7d('0x7a'),require(_0xee7d('0x7b')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x7c'),require(_0xee7d('0x7d')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x7e'),require('./api/analyticDefaultReport'));_0x3f1c6d[_0xee7d('0x7')]('/api/analytics/extracted_reports',require(_0xee7d('0x7f')));_0x3f1c6d[_0xee7d('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x3f1c6d['use'](_0xee7d('0x80'),require(_0xee7d('0x81')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x82'),require(_0xee7d('0x83')));_0x3f1c6d['use'](_0xee7d('0x84'),require(_0xee7d('0x85')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x86'),require(_0xee7d('0x87')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x88'),require(_0xee7d('0x89')));_0x3f1c6d['use'](_0xee7d('0x8a'),require(_0xee7d('0x8b')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x8c'),require(_0xee7d('0x8d')));_0x3f1c6d['use'](_0xee7d('0x8e'),require('./api/intSugarcrmField'));_0x3f1c6d['use'](_0xee7d('0x8f'),require('./api/intDeskAccount'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x90'),require('./api/intDeskConfiguration'));_0x3f1c6d['use']('/api/integrations/desk/fields',require(_0xee7d('0x91')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x92'),require(_0xee7d('0x93')));_0x3f1c6d[_0xee7d('0x7')]('/api/integrations/zoho/configurations',require(_0xee7d('0x94')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x95'),require(_0xee7d('0x96')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x97'),require('./api/intZendeskAccount'));_0x3f1c6d['use'](_0xee7d('0x98'),require('./api/intZendeskConfiguration'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x99'),require(_0xee7d('0x9a')));_0x3f1c6d[_0xee7d('0x7')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x3f1c6d['use'](_0xee7d('0x9b'),require(_0xee7d('0x9c')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x9d'),require('./api/intFreshdeskField'));_0x3f1c6d[_0xee7d('0x7')]('/api/integrations/vtiger/accounts',require(_0xee7d('0x9e')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x9f'),require(_0xee7d('0xa0')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xa1'),require(_0xee7d('0xa2')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xa3'),require(_0xee7d('0xa4')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xa5'),require('./api/intServicenowConfiguration'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xa6'),require(_0xee7d('0xa7')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xa8'),require(_0xee7d('0xa9')));_0x3f1c6d[_0xee7d('0x7')]('/api/integrations/dynamics365/configurations',require(_0xee7d('0xaa')));_0x3f1c6d[_0xee7d('0x7')]('/api/integrations/dynamics365/fields',require(_0xee7d('0xab')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xac'),require(_0xee7d('0xad')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xae'),require(_0xee7d('0xaf')));_0x3f1c6d[_0xee7d('0x7')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xb0'),require(_0xee7d('0xb1')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xb2'),require(_0xee7d('0xb3')));_0x3f1c6d['use'](_0xee7d('0xb4'),require(_0xee7d('0xb5')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xb6'),require('./api/jscriptyAnswerReport'));_0x3f1c6d['use'](_0xee7d('0xb7'),require(_0xee7d('0xb8')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xb9'),require('./api/jscriptySessionReport'));_0x3f1c6d['use'](_0xee7d('0xba'),require('./api/smsQueueReport'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xbb'),require('./api/squareReport'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xbc'),require(_0xee7d('0xbd')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xbe'),require(_0xee7d('0xbf')));_0x3f1c6d[_0xee7d('0x7')]('/api/settings',require(_0xee7d('0xc0')));_0x3f1c6d[_0xee7d('0x7')]('/api/square/odbc',require(_0xee7d('0xc1')));_0x3f1c6d['use']('/api/square/projects',require('./api/squareProject'));_0x3f1c6d['use'](_0xee7d('0xc2'),require(_0xee7d('0xc3')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xc4'),require(_0xee7d('0xc5')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xc6'),require(_0xee7d('0xc7')));_0x3f1c6d['use']('/api/license',require('./api/license'));_0x3f1c6d['use'](_0xee7d('0xc8'),require('./api/campaign'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xc9'),require('./api/migration'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xca'),require(_0xee7d('0xcb')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xcc'),require(_0xee7d('0xcd')));_0x3f1c6d['use'](_0xee7d('0xce'),require(_0xee7d('0xcf')));_0x3f1c6d['use'](_0xee7d('0xd0'),require('./api/chatTransferReport'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xd1'),require(_0xee7d('0xd2')));_0x3f1c6d['use']('/api/openchannel/reports/transfer',require(_0xee7d('0xd3')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xd4'),require(_0xee7d('0xd5')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xd6'),require(_0xee7d('0xd7')));_0x3f1c6d[_0xee7d('0x7')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xd8'),require(_0xee7d('0xd9')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xda'),require(_0xee7d('0xdb')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xdc'),require(_0xee7d('0xdd')));_0x3f1c6d['use']('/api/userNotifications',require(_0xee7d('0xde')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xdf'),require(_0xee7d('0xe0')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xe1'),require('./api/whatsappApplication'));_0x3f1c6d['use'](_0xee7d('0xe2'),require(_0xee7d('0xe3')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xe4'),require('./api/whatsappMessage'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xe5'),require(_0xee7d('0xe6')));_0x3f1c6d[_0xee7d('0x7')]('/api/whatsapp/reports/transfer',require(_0xee7d('0xe7')));_0x3f1c6d[_0xee7d('0x7')]('/api/whatsapp/queues',require(_0xee7d('0xe8')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xe9'),require('./api/cloudProvider'));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xea'),require(_0xee7d('0xeb')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xec'),require(_0xee7d('0xed')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xee'),require(_0xee7d('0xef')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xf0'),require(_0xee7d('0xf1')));_0x3f1c6d[_0xee7d('0x7')]('/api/auth/google',require(_0xee7d('0xf2')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xf3'),require(_0xee7d('0xf4')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xf5'),require('./api/jira'));_0x3f1c6d['use']('/api/rpc',require(_0xee7d('0xf6')));_0x3f1c6d[_0xee7d('0x7')]('/api/version',require(_0xee7d('0xf7')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xf8'),require('./api/system'));_0x3f1c6d['use'](_0xee7d('0xf9'),require(_0xee7d('0xfa')));_0x3f1c6d['use'](_0xee7d('0xfb'),require(_0xee7d('0xfc')));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0xfd'),clientSideLogs);_0x3f1c6d[_0xee7d('0x7')]('/apidoc',express[_0xee7d('0xfe')](path[_0xee7d('0xff')](config[_0xee7d('0x100')],_0xee7d('0x101'))));_0x3f1c6d[_0xee7d('0x7')]('/www',express['static'](path[_0xee7d('0xff')](config[_0xee7d('0x100')],_0xee7d('0x102'))));_0x3f1c6d[_0xee7d('0x7')](_0xee7d('0x103'),express[_0xee7d('0xfe')](path[_0xee7d('0xff')](config[_0xee7d('0x100')],_0xee7d('0x103'))));_0x3f1c6d['use'](_0xee7d('0x104'),express[_0xee7d('0xfe')](path[_0xee7d('0xff')](config['root'],_0xee7d('0x105'),_0xee7d('0x106'))));_0x3f1c6d['use'](_0xee7d('0x107'),express['static'](path[_0xee7d('0xff')](config[_0xee7d('0x100')],_0xee7d('0x108'))));_0x3f1c6d[_0xee7d('0x109')](_0xee7d('0x10a'))[_0xee7d('0x10b')](errors[0x194]);_0x3f1c6d[_0xee7d('0x109')]('/*')[_0xee7d('0x10b')](function(_0x522d7e,_0x490046){_0x490046[_0xee7d('0x10c')](path[_0xee7d('0x10d')](_0x3f1c6d[_0xee7d('0x10b')](_0xee7d('0x10e'))+_0xee7d('0x10f')));});return _0x3f1c6d;});}; \ No newline at end of file +var _0x1883=['/api/cm/hopper_final','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/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/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','/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/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/rpc','/api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','/snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./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/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1883,0xab));var _0x3188=function(_0xe1236,_0x3d8554){_0xe1236=_0xe1236-0x0;var _0x15a665=_0x1883[_0xe1236];return _0x15a665;};'use strict';var path=require(_0x3188('0x0'));var express=require(_0x3188('0x1'));var errors=require(_0x3188('0x2'));var config=require(_0x3188('0x3'));var setupLoggers=require(_0x3188('0x4'))[_0x3188('0x5')];var clientSideLogs=require(_0x3188('0x6'));exports[_0x3188('0x7')]=function(_0x1c7c86){return setupLoggers(_0x1c7c86)[_0x3188('0x8')](function(){_0x1c7c86[_0x3188('0x9')](_0x3188('0xa'),require(_0x3188('0xb')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xc'),require(_0x3188('0xd')));_0x1c7c86[_0x3188('0x9')]('/api/voice/contexts',require(_0x3188('0xe')));_0x1c7c86[_0x3188('0x9')]('/api/voice/extensions',require(_0x3188('0xf')));_0x1c7c86['use'](_0x3188('0x10'),require(_0x3188('0x11')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x12'),require('./api/voiceQueue'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x13'),require('./api/voiceRecording'));_0x1c7c86['use'](_0x3188('0x14'),require(_0x3188('0x15')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x16'),require(_0x3188('0x17')));_0x1c7c86[_0x3188('0x9')]('/api/voice/mails/messages',require(_0x3188('0x18')));_0x1c7c86['use']('/api/voice/calls/reports',require(_0x3188('0x19')));_0x1c7c86['use']('/api/voice/dials/reports',require(_0x3188('0x1a')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x1b'),require(_0x3188('0x1c')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x1d'),require('./api/voiceQueueReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x1e'),require(_0x3188('0x1f')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x20'),require(_0x3188('0x21')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x22'),require('./api/voiceTransferReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x23'),require('./api/mailServerOut'));_0x1c7c86['use']('/api/mail/accounts',require(_0x3188('0x24')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x25'),require('./api/mailQueue'));_0x1c7c86['use'](_0x3188('0x26'),require(_0x3188('0x27')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x28'),require(_0x3188('0x29')));_0x1c7c86['use'](_0x3188('0x2a'),require(_0x3188('0x2b')));_0x1c7c86['use'](_0x3188('0x2c'),require('./api/mailApplication'));_0x1c7c86['use'](_0x3188('0x2d'),require(_0x3188('0x2e')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x2f'),require(_0x3188('0x30')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x31'),require(_0x3188('0x32')));_0x1c7c86['use'](_0x3188('0x33'),require(_0x3188('0x34')));_0x1c7c86['use'](_0x3188('0x35'),require(_0x3188('0x36')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x37'),require(_0x3188('0x38')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x39'),require(_0x3188('0x3a')));_0x1c7c86['use'](_0x3188('0x3b'),require('./api/faxQueue'));_0x1c7c86[_0x3188('0x9')]('/api/fax/reports/queue',require(_0x3188('0x3c')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x3d'),require(_0x3188('0x3e')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x3f'),require(_0x3188('0x40')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x41'),require(_0x3188('0x42')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x43'),require(_0x3188('0x44')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x45'),require(_0x3188('0x46')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x47'),require('./api/openchannelAccount'));_0x1c7c86[_0x3188('0x9')]('/api/openchannel/applications',require(_0x3188('0x48')));_0x1c7c86[_0x3188('0x9')]('/api/openchannel/interactions',require(_0x3188('0x49')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x4a'),require(_0x3188('0x4b')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x4c'),require(_0x3188('0x4d')));_0x1c7c86['use']('/api/chat/websites',require(_0x3188('0x4e')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x4f'),require(_0x3188('0x50')));_0x1c7c86['use'](_0x3188('0x51'),require(_0x3188('0x52')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x53'),require('./api/chatInteraction'));_0x1c7c86[_0x3188('0x9')]('/api/chat/messages',require(_0x3188('0x54')));_0x1c7c86['use'](_0x3188('0x55'),require(_0x3188('0x56')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x57'),require(_0x3188('0x58')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x59'),require(_0x3188('0x5a')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x5b'),require('./api/chatProactiveAction'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x5c'),require(_0x3188('0x5d')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x5e'),require(_0x3188('0x5f')));_0x1c7c86['use'](_0x3188('0x60'),require('./api/cmHopper'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x61'),require(_0x3188('0x62')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x63'),require('./api/cmHopperFinal'));_0x1c7c86['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x1c7c86['use'](_0x3188('0x64'),require(_0x3188('0x65')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x66'),require(_0x3188('0x67')));_0x1c7c86['use'](_0x3188('0x68'),require('./api/automation'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x69'),require(_0x3188('0x6a')));_0x1c7c86[_0x3188('0x9')]('/api/dispositions',require(_0x3188('0x6b')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x6c'),require(_0x3188('0x6d')));_0x1c7c86[_0x3188('0x9')]('/api/intervals',require('./api/interval'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x6e'),require('./api/pause'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x6f'),require('./api/cdr'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x70'),require(_0x3188('0x71')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x72'),require('./api/schedule'));_0x1c7c86[_0x3188('0x9')]('/api/sounds',require(_0x3188('0x73')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x74'),require(_0x3188('0x75')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x76'),require(_0x3188('0x77')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x78'),require(_0x3188('0x79')));_0x1c7c86[_0x3188('0x9')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x1c7c86[_0x3188('0x9')]('/api/templates',require(_0x3188('0x7a')));_0x1c7c86[_0x3188('0x9')]('/api/triggers',require(_0x3188('0x7b')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x7c'),require(_0x3188('0x7d')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x7e'),require(_0x3188('0x7f')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/reports',require(_0x3188('0x80')));_0x1c7c86[_0x3188('0x9')]('/api/analytics/custom_reports',require(_0x3188('0x81')));_0x1c7c86['use'](_0x3188('0x82'),require(_0x3188('0x83')));_0x1c7c86[_0x3188('0x9')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x1c7c86['use']('/api/analytics/metrics',require('./api/analyticMetric'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x84'),require('./api/analyticFieldReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x85'),require('./api/analyticTreeReport'));_0x1c7c86['use']('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x1c7c86['use'](_0x3188('0x86'),require(_0x3188('0x87')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x88'),require(_0x3188('0x89')));_0x1c7c86['use'](_0x3188('0x8a'),require(_0x3188('0x8b')));_0x1c7c86['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x8c'),require(_0x3188('0x8d')));_0x1c7c86['use'](_0x3188('0x8e'),require(_0x3188('0x8f')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x90'),require(_0x3188('0x91')));_0x1c7c86['use'](_0x3188('0x92'),require(_0x3188('0x93')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/zoho/accounts',require(_0x3188('0x94')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x95'),require(_0x3188('0x96')));_0x1c7c86['use'](_0x3188('0x97'),require(_0x3188('0x98')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x99'),require(_0x3188('0x9a')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x9b'),require('./api/intZendeskConfiguration'));_0x1c7c86[_0x3188('0x9')](_0x3188('0x9c'),require(_0x3188('0x9d')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x9e'),require(_0x3188('0x9f')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/freshdesk/configurations',require(_0x3188('0xa0')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xa1'),require(_0x3188('0xa2')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/vtiger/accounts',require(_0x3188('0xa3')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xa4'),require(_0x3188('0xa5')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xa6'),require(_0x3188('0xa7')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xa8'),require(_0x3188('0xa9')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/servicenow/fields',require(_0x3188('0xaa')));_0x1c7c86['use']('/api/integrations/dynamics365/accounts',require(_0x3188('0xab')));_0x1c7c86['use'](_0x3188('0xac'),require(_0x3188('0xad')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xae'),require(_0x3188('0xaf')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/freshsales/accounts',require(_0x3188('0xb0')));_0x1c7c86[_0x3188('0x9')]('/api/integrations/freshsales/configurations',require(_0x3188('0xb1')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xb2'),require(_0x3188('0xb3')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xb4'),require('./api/network'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xb5'),require('./api/chatQueueReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xb6'),require(_0x3188('0xb7')));_0x1c7c86['use'](_0x3188('0xb8'),require(_0x3188('0xb9')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xba'),require(_0x3188('0xbb')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xbc'),require('./api/jscriptySessionReport'));_0x1c7c86['use']('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xbd'),require(_0x3188('0xbe')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xbf'),require('./api/squareReportDetail'));_0x1c7c86[_0x3188('0x9')]('/api/jscripty/projects',require(_0x3188('0xc0')));_0x1c7c86[_0x3188('0x9')]('/api/settings',require(_0x3188('0xc1')));_0x1c7c86['use'](_0x3188('0xc2'),require(_0x3188('0xc3')));_0x1c7c86['use'](_0x3188('0xc4'),require('./api/squareProject'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xc5'),require(_0x3188('0xc6')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xc7'),require('./api/squareMessage'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xc8'),require('./api/team'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xc9'),require('./api/license'));_0x1c7c86['use'](_0x3188('0xca'),require(_0x3188('0xcb')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xcc'),require(_0x3188('0xcd')));_0x1c7c86[_0x3188('0x9')]('/api/attachments',require(_0x3188('0xce')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xcf'),require('./api/plugin'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xd0'),require(_0x3188('0xd1')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xd2'),require(_0x3188('0xd3')));_0x1c7c86['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xd4'),require('./api/openchannelTransferReport'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xd5'),require(_0x3188('0xd6')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xd7'),require(_0x3188('0xd8')));_0x1c7c86['use'](_0x3188('0xd9'),require(_0x3188('0xda')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xdb'),require(_0x3188('0xdc')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xdd'),require(_0x3188('0xde')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xdf'),require(_0x3188('0xe0')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xe1'),require(_0x3188('0xe2')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xe3'),require(_0x3188('0xe4')));_0x1c7c86[_0x3188('0x9')]('/api/whatsapp/applications',require(_0x3188('0xe5')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xe6'),require(_0x3188('0xe7')));_0x1c7c86[_0x3188('0x9')]('/api/whatsapp/messages',require(_0x3188('0xe8')));_0x1c7c86[_0x3188('0x9')]('/api/whatsapp/reports/queue',require(_0x3188('0xe9')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xea'),require('./api/whatsappTransferReport'));_0x1c7c86[_0x3188('0x9')]('/api/whatsapp/queues',require(_0x3188('0xeb')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xec'),require(_0x3188('0xed')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xee'),require('./api/realtime'));_0x1c7c86['use'](_0x3188('0xef'),require(_0x3188('0xf0')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xf1'),require(_0x3188('0xf2')));_0x1c7c86[_0x3188('0x9')]('/api/auth/local',require(_0x3188('0xf3')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xf4'),require(_0x3188('0xf5')));_0x1c7c86['use'](_0x3188('0xf6'),require('./api/authActiveDirectory'));_0x1c7c86['use']('/api/jira',require('./api/jira'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xf7'),require('./api/rpc'));_0x1c7c86[_0x3188('0x9')](_0x3188('0xf8'),require('./api/version'));_0x1c7c86[_0x3188('0x9')]('/api/system',require(_0x3188('0xf9')));_0x1c7c86[_0x3188('0x9')]('/api/pm2',require(_0x3188('0xfa')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xfb'),require(_0x3188('0xfc')));_0x1c7c86[_0x3188('0x9')](_0x3188('0xfd'),clientSideLogs);_0x1c7c86[_0x3188('0x9')](_0x3188('0xfe'),express[_0x3188('0xff')](path[_0x3188('0x100')](config['root'],_0x3188('0xfe'))));_0x1c7c86[_0x3188('0x9')](_0x3188('0x101'),express['static'](path[_0x3188('0x100')](config['root'],_0x3188('0x101'))));_0x1c7c86['use']('/demo',express['static'](path['join'](config[_0x3188('0x102')],_0x3188('0x103'))));_0x1c7c86[_0x3188('0x9')](_0x3188('0x104'),express[_0x3188('0xff')](path['join'](config[_0x3188('0x102')],'snippet','3.10.1')));_0x1c7c86[_0x3188('0x9')](_0x3188('0x105'),express['static'](path[_0x3188('0x100')](config[_0x3188('0x102')],_0x3188('0x106'))));_0x1c7c86[_0x3188('0x107')](_0x3188('0x108'))[_0x3188('0x109')](errors[0x194]);_0x1c7c86[_0x3188('0x107')]('/*')['get'](function(_0x354b60,_0xa54e8a){_0xa54e8a[_0x3188('0x10a')](path[_0x3188('0x10b')](_0x1c7c86[_0x3188('0x109')](_0x3188('0x10c'))+_0x3188('0x10d')));});return _0x1c7c86;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 86d6900..5bb51cc 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x054c=['../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.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/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc'];(function(_0x36f82a,_0x4ec395){var _0x495067=function(_0x2ede56){while(--_0x2ede56){_0x36f82a['push'](_0x36f82a['shift']());}};_0x495067(++_0x4ec395);}(_0x054c,0x194));var _0xc054=function(_0x1c6231,_0x32a8cf){_0x1c6231=_0x1c6231-0x0;var _0x192b26=_0x054c[_0x1c6231];return _0x192b26;};'use strict';var jayson=require(_0xc054('0x0'));var _=require(_0xc054('0x1'));var config=require('../config/environment');exports[_0xc054('0x2')]=function(){return new Promise(function(_0x10e18e,_0x1ec677){var _0x24c371={};_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x3')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x5')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x6')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x7')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x8')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x9')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/memberReport/memberReport.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/trunk/trunk.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0xa')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0xb')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0xc')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0xd')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/mailInteraction/mailInteraction.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0xe')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0xf')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x10')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x11')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x12')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x13')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/faxMessage/faxMessage.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x14')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x15')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x16')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x17')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x18')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x19')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x1a')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x1b')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x1c')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x1d')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x1e')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x1f')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x20')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x21')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x22')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x23')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x24')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x25')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x26')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x27')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x28')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x29')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x2a')));_0x24c371=_['merge'](_0x24c371,require('../api/template/template.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x2b')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x2c')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x2d')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x2e')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x2f')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x30')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x31')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x32')));_0x24c371=_['merge'](_0x24c371,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x33')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x34')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x35')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x36')));_0x24c371=_['merge'](_0x24c371,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x37')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x38')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x39')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/squareOdbc/squareOdbc.rpc'));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x3a')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require('../api/squareRecording/squareRecording.rpc'));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x3b')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x3c')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x3d')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x3e')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x3f')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x40')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x41')));_0x24c371=_['merge'](_0x24c371,require(_0xc054('0x42')));_0x24c371=_[_0xc054('0x4')](_0x24c371,require(_0xc054('0x43')));var _0x13e755=jayson[_0xc054('0x44')](_0x24c371)[_0xc054('0x45')]();var _0x1edc66=config[_0xc054('0x46')][_0xc054('0x47')]||config[_0xc054('0x47')]+0x1;var _0x1021ab=config[_0xc054('0x46')]['ip']||'localhost';_0x13e755['on'](_0xc054('0x48'),function(_0xcadc2b){return _0x1ec677(_0xcadc2b);});_0x13e755[_0xc054('0x2')](_0x1edc66,_0x1021ab,function(){console[_0xc054('0x49')](_0xc054('0x4a'),_0x1021ab,_0x1edc66);require(_0xc054('0x4b'))['default']();return _0x10e18e(_0xc054('0x4c')+_0x1021ab+':'+_0x1edc66);});});}; \ No newline at end of file +var _0x1f0e=['../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/trigger/trigger.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/intFreshsalesAccount/intFreshsalesAccount.rpc'];(function(_0x84a188,_0x2d2aae){var _0x46cb97=function(_0x2b2bc7){while(--_0x2b2bc7){_0x84a188['push'](_0x84a188['shift']());}};_0x46cb97(++_0x2d2aae);}(_0x1f0e,0xe7));var _0xe1f0=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x1f0e[_0x5da0d9];return _0x4b6d2f;};'use strict';var jayson=require(_0xe1f0('0x0'));var _=require('lodash');var config=require(_0xe1f0('0x1'));exports[_0xe1f0('0x2')]=function(){return new Promise(function(_0x329738,_0x2106b1){var _0x58b237={};_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x4')));_0x58b237=_['merge'](_0x58b237,require('../api/voiceExtension/voiceExtension.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x5')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x6')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x7')));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x8')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x9')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0xa')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0xb')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0xc')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0xd')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0xe')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/mailServerIn/mailServerIn.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0xf')));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x10')));_0x58b237=_['merge'](_0x58b237,require('../api/mailInteraction/mailInteraction.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x11')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x12')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x58b237=_['merge'](_0x58b237,require('../api/faxAccount/faxAccount.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x13')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/faxInteraction/faxInteraction.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x14')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x15')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x16')));_0x58b237=_['merge'](_0x58b237,require('../api/smsInteraction/smsInteraction.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x17')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x18')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x19')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x1a')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x1b')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x1c')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/chatInteraction/chatInteraction.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x1d')));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x1e')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/cmContact/cmContact.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x1f')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x20')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x21')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x22')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x23')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x24')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x25')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x26')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x58b237=_['merge'](_0x58b237,require('../api/template/template.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x27')));_0x58b237=_['merge'](_0x58b237,require('../api/variable/variable.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x28')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x29')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x2a')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x2b')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x2c')));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x2d')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x2e')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x2f')));_0x58b237=_['merge'](_0x58b237,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x30')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x31')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x58b237=_['merge'](_0x58b237,require(_0xe1f0('0x32')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x33')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x34')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x35')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/squareRecording/squareRecording.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/squareMessage/squareMessage.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/campaign/campaign.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require('../api/attachment/attachment.rpc'));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x36')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x37')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x38')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x39')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x3a')));_0x58b237=_[_0xe1f0('0x3')](_0x58b237,require(_0xe1f0('0x3b')));var _0x510d3b=jayson[_0xe1f0('0x3c')](_0x58b237)[_0xe1f0('0x3d')]();var _0x17297b=config[_0xe1f0('0x3e')][_0xe1f0('0x3f')]||config[_0xe1f0('0x3f')]+0x1;var _0xc9fdb4=config[_0xe1f0('0x3e')]['ip']||_0xe1f0('0x40');_0x510d3b['on'](_0xe1f0('0x41'),function(_0x1cf45f){return _0x2106b1(_0x1cf45f);});_0x510d3b[_0xe1f0('0x2')](_0x17297b,_0xc9fdb4,function(){console['log'](_0xe1f0('0x42'),_0xc9fdb4,_0x17297b);require(_0xe1f0('0x43'))[_0xe1f0('0x44')]();return _0x329738(_0xe1f0('0x45')+_0xc9fdb4+':'+_0x17297b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8f30c8b..449a1af 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 _0xf970=['noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','emit','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','answer','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0f97('0x0'));var _=require('lodash');var EventEmitter=require(_0x0f97('0x1'))[_0x0f97('0x2')];var AGIReply=require(_0x0f97('0x3'));var AGIError=require(_0x0f97('0x4'));function AGIChannel(_0x1b1ab7){var _0x25e484=this,_0x439149=new AGIReply(),_0x4ab74d=![],_0xc822e8={};EventEmitter[_0x0f97('0x5')](_0x25e484);_0x1b1ab7[_0x0f97('0x6')](_0x0f97('0x7'));_0x1b1ab7[_0x0f97('0x8')](0x8*0x3c*0x3c*0x3e8);_0x439149[_0x0f97('0x6')](_0x0f97('0x7'));_0x439149['on'](_0x0f97('0x9'),function(_0x2891f7){for(var _0x5598eb in _0x2891f7){_0x25e484[_0x5598eb]=_0x2891f7[_0x5598eb];}_0x25e484['emit'](_0x0f97('0xa'));});_0x439149['on']('line',function(_0x1366b4){if(_0x1366b4[_0x0f97('0xb')]()==_0x0f97('0xc')){_0x25e484['emit'](_0x0f97('0xc'));return;}if(_0x1366b4['substring'](0x0,0xb)==_0x0f97('0xd')){_0x4ab74d=!![];}if(_0x4ab74d){_0xc822e8['rx']+=_0x1366b4+'\x0a';if(_0x1366b4[_0x0f97('0xe')](_0x0f97('0xf'))!=-0x1){_0x4ab74d=![];}}else{_0xc822e8['rx']=_0x1366b4;}if(_0x4ab74d){return;}if(typeof _0xc822e8['cb']==_0x0f97('0x10')){var _0x38ae73=_0xc822e8['rx'][_0x0f97('0x11')](0x0,0x3),_0x4934af=null,_0x56d310=null;_0x38ae73=parseInt(_0x38ae73);if(isNaN(_0x38ae73)){_0xc822e8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0f97('0x12')});return;}if(_0x38ae73!=0xc8){_0xc822e8['cb'](null,{'code':_0x38ae73,'result':-0x1,'extra':'KO'});return;}_0x4934af=_0xc822e8['rx'][_0x0f97('0x11')](0x4)[_0x0f97('0x13')](_0x0f97('0x14'),'');if(_0x4934af[_0x0f97('0x15')]('\x20')!=-0x1){_0x4934af=_0x4934af['substr'](0x0,_0x4934af['indexOf']('\x20'));}if(_[_0x0f97('0x16')](_0x4934af,'-1')){_0x4934af=parseInt(_0x4934af);}_0x56d310=_0xc822e8['rx'][_0x0f97('0x17')]('\x20');if(_0x56d310[_0x0f97('0x18')]==0x3){_0x56d310=_0x56d310[0x2][_0x0f97('0x11')](0x1,_0x56d310[0x2]['length']-0x1);}else if(_0x56d310['length']>0x3){var _0x336f61=/\((.+)\)/;var _0xf83320=_0xc822e8['rx'][_0x0f97('0x19')](_0x336f61);if(_0xf83320){_0x56d310=_0xf83320[0x1];}else{_0x56d310=null;}}else{_0x56d310=null;}_0xc822e8['cb'](null,{'code':_0x38ae73,'result':_0x4934af,'extra':_0x56d310});}});_0x1b1ab7['on'](_0x0f97('0x1a'),function(_0xae246){_0x25e484[_0x0f97('0x1b')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0xae246[_0x0f97('0x1c')]));});_0x1b1ab7['on'](_0x0f97('0x1d'),function(){_0x25e484[_0x0f97('0x1b')](_0x0f97('0x1d'),new AGIError(_0x0f97('0x1e')));});_0x1b1ab7['on'](_0x0f97('0x1f'),function(){_0x25e484['emit'](_0x0f97('0x1f'),new AGIError(_0x0f97('0x20')));_0x1b1ab7[_0x0f97('0x21')]();});_0x1b1ab7[_0x0f97('0x22')](_0x439149);this[_0x0f97('0x23')]=function(_0x316e84,_0x21784d){var _0x316e84=_0x316e84||'',_0x21784d=typeof _0x21784d==_0x0f97('0x10')?_0x21784d:new Function();_0xc822e8={'tx':_0x316e84,'rx':'','cb':_0x21784d};_0x1b1ab7[_0x0f97('0x24')](_0x316e84+'\x0a');},this['close']=function(){_0x1b1ab7[_0x0f97('0x21')]();};}util[_0x0f97('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x0f97('0x26')]=function(_0x15df5c){return this['command']['sync'](this,_0x15df5c);};AGIChannel['prototype'][_0x0f97('0x27')]=function(){return this[_0x0f97('0x26')]('ANSWER');};AGIChannel[_0x0f97('0x28')][_0x0f97('0x29')]=function(_0x30a715,_0x30d33d,_0x10f71c){_0x30a715=_0x30a715===undefined?_0x0f97('0x2a'):_0x30a715;_0x30d33d=_0x30d33d===undefined?'5':_0x30d33d;_0x10f71c=_0x10f71c===undefined?'1':_0x10f71c;return this[_0x0f97('0x26')](util[_0x0f97('0x2b')](_0x0f97('0x2c'),_0x30a715,_0x30d33d*0x3e8,_0x10f71c));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x2d')]=function(_0x4fe728){_0x4fe728=_0x4fe728||_0x0f97('0x2e');return this[_0x0f97('0x26')](util[_0x0f97('0x2b')](_0x0f97('0x2f'),_0x4fe728));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x30')]=function(_0x2aeef8,_0x28ba36){if(_['isArray'](_0x28ba36)){return this['sendRequest'](util[_0x0f97('0x2b')](_0x0f97('0x31'),_0x2aeef8,_0x28ba36[_0x0f97('0x32')](',')));}return this[_0x0f97('0x26')](util[_0x0f97('0x2b')](_0x0f97('0x31'),_0x2aeef8,_0x28ba36));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x33')]=function(_0x139c8a){return this[_0x0f97('0x26')](util[_0x0f97('0x2b')]('SET\x20CONTEXT\x20%s',_0x139c8a));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x34')]=function(_0xe2526c){return this[_0x0f97('0x26')](util[_0x0f97('0x2b')]('SET\x20EXTENSION\x20%s',_0xe2526c));};AGIChannel[_0x0f97('0x28')]['setPriority']=function(_0x2f85f5){return this['sendRequest'](util[_0x0f97('0x2b')](_0x0f97('0x35'),_0x2f85f5));};AGIChannel[_0x0f97('0x28')][_0x0f97('0xc')]=function(){return this[_0x0f97('0x26')]('HANGUP');};AGIChannel['prototype'][_0x0f97('0x36')]=function(_0x428089,_0x595adf){var _0xfa6702=_[_0x0f97('0x37')](_0x595adf)||_[_0x0f97('0x38')](_0x595adf)?_0x595adf[_0x0f97('0x39')]():_0x595adf;return this['sendRequest'](util[_0x0f97('0x2b')](_0x0f97('0x3a'),_0x428089,_0xfa6702?_0xfa6702[_0x0f97('0x39')]()[_0x0f97('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0f97('0x28')]['sayNumber']=function(_0x568fbd,_0x36effc){return this[_0x0f97('0x26')](util[_0x0f97('0x2b')](_0x0f97('0x3b'),_0x568fbd,_0x36effc));};AGIChannel[_0x0f97('0x28')]['sayDigits']=function(_0x516e3b,_0x230ccf){return this[_0x0f97('0x26')](util[_0x0f97('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x516e3b,_0x230ccf));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x3c')]=function(_0x1053cb,_0x5e07e8){return this[_0x0f97('0x26')](util[_0x0f97('0x2b')](_0x0f97('0x3d'),_0x1053cb,_0x5e07e8));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x3e')]=function(_0x1dc76d,_0xf4ed1a,_0x21500a){_0xf4ed1a=_0xf4ed1a||this[_0x0f97('0x3f')];_0x21500a=_0x21500a||0x1;this[_0x0f97('0x33')](_0x1dc76d);this[_0x0f97('0x34')](_0xf4ed1a);this['setPriority'](_0x21500a);return this[_0x0f97('0x2d')](util[_0x0f97('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x1dc76d,_0xf4ed1a,_0x21500a));};AGIChannel[_0x0f97('0x28')]['getVariable']=function(_0x153777){return this[_0x0f97('0x26')](util[_0x0f97('0x2b')]('GET\x20VARIABLE\x20\x22%s\x22',_0x153777));};AGIChannel['prototype'][_0x0f97('0x40')]=function(_0xb33b82,_0x299695,_0xcda718,_0x278a8c,_0x5ad169,_0x5962a4){_0x299695=_0x299695||_0x0f97('0x41');_0xcda718=_0xcda718||'';_0x278a8c=_0x278a8c===undefined?-0x1:_0x278a8c==='-1'?-0x1:_0x278a8c*0x3e8;_0x5ad169=_0x5ad169===undefined?'':'s='+_0x5ad169;_0x5962a4=_0x5962a4?_0x0f97('0x42'):'';return this[_0x0f97('0x26')](util[_0x0f97('0x2b')](_0x0f97('0x43'),_0xb33b82,_0x299695,_0xcda718,_0x278a8c,_0x5962a4,_0x5ad169));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x44')]=function(_0xd9f44b,_0x14b827){_0x14b827=_0x14b827||'';return this['sendRequest'](util[_0x0f97('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xd9f44b,_0x14b827));};AGIChannel[_0x0f97('0x28')][_0x0f97('0x45')]=function(_0xd246c1){return this['exec']('AGI',_0xd246c1);};AGIChannel[_0x0f97('0x28')][_0x0f97('0x46')]=function(_0x40ea51){return this['exec']('WAIT',_0x40ea51);};AGIChannel['prototype'][_0x0f97('0x1a')]=function(_0x3cdbee,_0x1871b6){this[_0x0f97('0x2d')](util[_0x0f97('0x2b')](_0x0f97('0x47'),_0x3cdbee['id'],_0x3cdbee[_0x0f97('0x48')],_0x1871b6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0f97('0x49')]=AGIChannel; \ No newline at end of file +var _0xf693=['sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','replace','result=','indexOf','startsWith','length','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','inherits','sendRequest','prototype','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits'];(function(_0x277257,_0x3bf305){var _0x1560ff=function(_0x5c2af2){while(--_0x5c2af2){_0x277257['push'](_0x277257['shift']());}};_0x1560ff(++_0x3bf305);}(_0xf693,0x181));var _0x3f69=function(_0x1e8284,_0x300361){_0x1e8284=_0x1e8284-0x0;var _0xbc4db0=_0xf693[_0x1e8284];return _0xbc4db0;};'use strict';var util=require('util');var _=require(_0x3f69('0x0'));var EventEmitter=require(_0x3f69('0x1'))[_0x3f69('0x2')];var AGIReply=require(_0x3f69('0x3'));var AGIError=require(_0x3f69('0x4'));function AGIChannel(_0x3dcdd6){var _0x414ca5=this,_0x527646=new AGIReply(),_0xf2fdd8=![],_0x300282={};EventEmitter[_0x3f69('0x5')](_0x414ca5);_0x3dcdd6[_0x3f69('0x6')](_0x3f69('0x7'));_0x3dcdd6[_0x3f69('0x8')](0x8*0x3c*0x3c*0x3e8);_0x527646[_0x3f69('0x6')](_0x3f69('0x7'));_0x527646['on'](_0x3f69('0x9'),function(_0xad860e){for(var _0x8fd1e5 in _0xad860e){_0x414ca5[_0x8fd1e5]=_0xad860e[_0x8fd1e5];}_0x414ca5[_0x3f69('0xa')](_0x3f69('0xb'));});_0x527646['on'](_0x3f69('0xc'),function(_0x3214f9){if(_0x3214f9[_0x3f69('0xd')]()==_0x3f69('0xe')){_0x414ca5['emit'](_0x3f69('0xe'));return;}if(_0x3214f9[_0x3f69('0xf')](0x0,0xb)==_0x3f69('0x10')){_0xf2fdd8=!![];}if(_0xf2fdd8){_0x300282['rx']+=_0x3214f9+'\x0a';if(_0x3214f9[_0x3f69('0x11')](_0x3f69('0x12'))!=-0x1){_0xf2fdd8=![];}}else{_0x300282['rx']=_0x3214f9;}if(_0xf2fdd8){return;}if(typeof _0x300282['cb']=='function'){var _0x37f1e5=_0x300282['rx'][_0x3f69('0xf')](0x0,0x3),_0x17a969=null,_0x5db35d=null;_0x37f1e5=parseInt(_0x37f1e5);if(isNaN(_0x37f1e5)){_0x300282['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x37f1e5!=0xc8){_0x300282['cb'](null,{'code':_0x37f1e5,'result':-0x1,'extra':'KO'});return;}_0x17a969=_0x300282['rx']['substring'](0x4)[_0x3f69('0x13')](_0x3f69('0x14'),'');if(_0x17a969[_0x3f69('0x15')]('\x20')!=-0x1){_0x17a969=_0x17a969['substr'](0x0,_0x17a969[_0x3f69('0x15')]('\x20'));}if(_[_0x3f69('0x16')](_0x17a969,'-1')){_0x17a969=parseInt(_0x17a969);}_0x5db35d=_0x300282['rx']['split']('\x20');if(_0x5db35d[_0x3f69('0x17')]==0x3){_0x5db35d=_0x5db35d[0x2][_0x3f69('0xf')](0x1,_0x5db35d[0x2][_0x3f69('0x17')]-0x1);}else if(_0x5db35d[_0x3f69('0x17')]>0x3){var _0x18f60a=/\((.+)\)/;var _0x54cfdd=_0x300282['rx']['match'](_0x18f60a);if(_0x54cfdd){_0x5db35d=_0x54cfdd[0x1];}else{_0x5db35d=null;}}else{_0x5db35d=null;}_0x300282['cb'](null,{'code':_0x37f1e5,'result':_0x17a969,'extra':_0x5db35d});}});_0x3dcdd6['on']('error',function(_0x1a3cb5){_0x414ca5['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x1a3cb5[_0x3f69('0x18')]));});_0x3dcdd6['on']('close',function(){_0x414ca5[_0x3f69('0xa')](_0x3f69('0x19'),new AGIError(_0x3f69('0x1a')));});_0x3dcdd6['on'](_0x3f69('0x1b'),function(){_0x414ca5[_0x3f69('0xa')](_0x3f69('0x1b'),new AGIError(_0x3f69('0x1c')));_0x3dcdd6['destroy']();});_0x3dcdd6[_0x3f69('0x1d')](_0x527646);this[_0x3f69('0x1e')]=function(_0x1e99eb,_0x461aa9){var _0x1e99eb=_0x1e99eb||'',_0x461aa9=typeof _0x461aa9==_0x3f69('0x1f')?_0x461aa9:new Function();_0x300282={'tx':_0x1e99eb,'rx':'','cb':_0x461aa9};_0x3dcdd6['write'](_0x1e99eb+'\x0a');},this[_0x3f69('0x19')]=function(){_0x3dcdd6['destroy']();};}util[_0x3f69('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x3f69('0x21')]=function(_0x5a9c52){return this[_0x3f69('0x1e')]['sync'](this,_0x5a9c52);};AGIChannel[_0x3f69('0x22')][_0x3f69('0x23')]=function(){return this['sendRequest'](_0x3f69('0x24'));};AGIChannel[_0x3f69('0x22')]['getData']=function(_0x3605ad,_0x4e0966,_0x42c056){_0x3605ad=_0x3605ad===undefined?_0x3f69('0x25'):_0x3605ad;_0x4e0966=_0x4e0966===undefined?'5':_0x4e0966;_0x42c056=_0x42c056===undefined?'1':_0x42c056;return this[_0x3f69('0x21')](util[_0x3f69('0x26')](_0x3f69('0x27'),_0x3605ad,_0x4e0966*0x3e8,_0x42c056));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x28')]=function(_0x534a0c){_0x534a0c=_0x534a0c||_0x3f69('0x29');return this[_0x3f69('0x21')](util[_0x3f69('0x26')](_0x3f69('0x2a'),_0x534a0c));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x2b')]=function(_0x2926c9,_0x5b7148){if(_['isArray'](_0x5b7148)){return this['sendRequest'](util[_0x3f69('0x26')]('EXEC\x20%s\x20%s',_0x2926c9,_0x5b7148[_0x3f69('0x2c')](',')));}return this[_0x3f69('0x21')](util[_0x3f69('0x26')](_0x3f69('0x2d'),_0x2926c9,_0x5b7148));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x2e')]=function(_0x11597f){return this[_0x3f69('0x21')](util[_0x3f69('0x26')](_0x3f69('0x2f'),_0x11597f));};AGIChannel['prototype'][_0x3f69('0x30')]=function(_0x451a1f){return this['sendRequest'](util[_0x3f69('0x26')](_0x3f69('0x31'),_0x451a1f));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x32')]=function(_0x8ae9fb){return this[_0x3f69('0x21')](util['format']('SET\x20PRIORITY\x20%s',_0x8ae9fb));};AGIChannel[_0x3f69('0x22')][_0x3f69('0xe')]=function(){return this[_0x3f69('0x21')]('HANGUP');};AGIChannel[_0x3f69('0x22')][_0x3f69('0x33')]=function(_0x255e40,_0x419d7e){var _0x581d54=_[_0x3f69('0x34')](_0x419d7e)||_[_0x3f69('0x35')](_0x419d7e)?_0x419d7e[_0x3f69('0x36')]():_0x419d7e;return this['sendRequest'](util[_0x3f69('0x26')](_0x3f69('0x37'),_0x255e40,_0x581d54?_0x581d54[_0x3f69('0x36')]()[_0x3f69('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x38')]=function(_0x3f4b0a,_0x3b24f4){return this[_0x3f69('0x21')](util[_0x3f69('0x26')](_0x3f69('0x39'),_0x3f4b0a,_0x3b24f4));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x3a')]=function(_0x529522,_0x494b69){return this[_0x3f69('0x21')](util[_0x3f69('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x529522,_0x494b69));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x3b')]=function(_0x27b2c0,_0x25f6c6){return this['sendRequest'](util[_0x3f69('0x26')](_0x3f69('0x3c'),_0x27b2c0,_0x25f6c6));};AGIChannel['prototype'][_0x3f69('0x3d')]=function(_0x54bb87,_0x44971b,_0x10d2b7){_0x44971b=_0x44971b||this['extension'];_0x10d2b7=_0x10d2b7||0x1;this['setContext'](_0x54bb87);this[_0x3f69('0x30')](_0x44971b);this['setPriority'](_0x10d2b7);return this[_0x3f69('0x28')](util[_0x3f69('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x54bb87,_0x44971b,_0x10d2b7));};AGIChannel['prototype'][_0x3f69('0x3e')]=function(_0x34035f){return this['sendRequest'](util['format'](_0x3f69('0x3f'),_0x34035f));};AGIChannel[_0x3f69('0x22')][_0x3f69('0x40')]=function(_0x2247ee,_0x1f66b8,_0x3ba4dd,_0x146c9,_0x2d992f,_0x4e9702){_0x1f66b8=_0x1f66b8||'wav';_0x3ba4dd=_0x3ba4dd||'';_0x146c9=_0x146c9===undefined?-0x1:_0x146c9==='-1'?-0x1:_0x146c9*0x3e8;_0x2d992f=_0x2d992f===undefined?'':'s='+_0x2d992f;_0x4e9702=_0x4e9702?_0x3f69('0x41'):'';return this[_0x3f69('0x21')](util[_0x3f69('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2247ee,_0x1f66b8,_0x3ba4dd,_0x146c9,_0x4e9702,_0x2d992f));};AGIChannel[_0x3f69('0x22')]['streamFile']=function(_0x2af029,_0x5ed579){_0x5ed579=_0x5ed579||'';return this[_0x3f69('0x21')](util['format'](_0x3f69('0x42'),_0x2af029,_0x5ed579));};AGIChannel['prototype']['agi']=function(_0x5bd3fb){return this[_0x3f69('0x2b')](_0x3f69('0x43'),_0x5bd3fb);};AGIChannel[_0x3f69('0x22')][_0x3f69('0x44')]=function(_0x35c25d){return this[_0x3f69('0x2b')](_0x3f69('0x45'),_0x35c25d);};AGIChannel[_0x3f69('0x22')][_0x3f69('0x46')]=function(_0x293327,_0x1783ba){this[_0x3f69('0x28')](util[_0x3f69('0x26')](_0x3f69('0x47'),_0x293327['id'],_0x293327[_0x3f69('0x48')],_0x1783ba));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3f69('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 37c333b..c13a56b 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 _0x4421=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x4a74e5,_0x108772){var _0x1339c6=function(_0x7d44df){while(--_0x7d44df){_0x4a74e5['push'](_0x4a74e5['shift']());}};_0x1339c6(++_0x108772);}(_0x4421,0x170));var _0x1442=function(_0x1be78c,_0x395cda){_0x1be78c=_0x1be78c-0x0;var _0x6554b8=_0x4421[_0x1be78c];return _0x6554b8;};'use strict';var util=require(_0x1442('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x1442('0x1'),'E_AGI_SERVER_ERROR':_0x1442('0x2'),'E_AGI_SERVER_CLOSE':_0x1442('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x1442('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x1442('0x5'),'E_AGI_SOCKET_ERROR':_0x1442('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1442('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1442('0x8'),'E_AGI_IVR_ENTRY':_0x1442('0x9')};function AGIError(_0xab4feb){var _0xab4feb=_0xab4feb||null,_0x1b5e29=_0x1b5e29||[],_0x439b09=0x1,_0x23fe1a='';if(!error[_0xab4feb]){_0xab4feb=_0x1442('0xa');}_0x1b5e29[_0x1442('0xb')](error[_0xab4feb]);while(arguments[_0x439b09]){_0x1b5e29[_0x1442('0xb')](arguments[_0x439b09]);_0x439b09++;}_0x23fe1a=util['format'][_0x1442('0xc')](util,_0x1b5e29);this[_0x1442('0xd')]=_0x23fe1a;this[_0x1442('0xe')]=_0xab4feb;}module['exports']=AGIError; \ No newline at end of file +var _0xf07b=['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','push','format','name','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0xf07b,0x19b));var _0xbf07=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf07b[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0xbf07('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xbf07('0x1'),'E_AGI_SERVER_CLOSE':_0xbf07('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xbf07('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xbf07('0x4'),'E_AGI_SOCKET_ERROR':_0xbf07('0x5'),'E_AGI_SOCKET_CLOSE':_0xbf07('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xbf07('0x7'),'E_AGI_COMMAND_EMPTY':_0xbf07('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbf07('0x9'),'E_AGI_IVR_ENTRY':_0xbf07('0xa')};function AGIError(_0x280b86){var _0x280b86=_0x280b86||null,_0x1ef7be=_0x1ef7be||[],_0xcdcc12=0x1,_0x2c6212='';if(!error[_0x280b86]){_0x280b86=_0xbf07('0xb');}_0x1ef7be['push'](error[_0x280b86]);while(arguments[_0xcdcc12]){_0x1ef7be[_0xbf07('0xc')](arguments[_0xcdcc12]);_0xcdcc12++;}_0x2c6212=util[_0xbf07('0xd')]['apply'](util,_0x1ef7be);this['message']=_0x2c6212;this[_0xbf07('0xe')]=_0x280b86;}module[_0xbf07('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index ca6d46c..aef5d7b 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 _0x3020=['subscribe','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','lodash','ioredis','./error','../../config/environment','redis','localhost'];(function(_0x40c652,_0x2ff0ec){var _0xe2b520=function(_0x1285fc){while(--_0x1285fc){_0x40c652['push'](_0x40c652['shift']());}};_0xe2b520(++_0x2ff0ec);}(_0x3020,0xdb));var _0x0302=function(_0x545f8b,_0x475cf8){_0x545f8b=_0x545f8b-0x0;var _0x3ea7c9=_0x3020[_0x545f8b];return _0x3ea7c9;};'use strict';var _=require(_0x0302('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x0302('0x1'));var AGIError=require(_0x0302('0x2'));var config=require(_0x0302('0x3'));config['redis']=_['defaults'](config[_0x0302('0x4')],{'host':_0x0302('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x0302('0x4')]);sub[_0x0302('0x6')](_0x0302('0x7'),function(_0x5a2568){if(_0x5a2568)return eventEmitter[_0x0302('0x8')]('error',new AGIError(_0x0302('0x9'),_0x5a2568));});sub['on'](_0x0302('0xa'),function(_0x8fc1e4,_0x7f699){if(_0x8fc1e4!=='agi')return;try{var _0x16fccd=JSON[_0x0302('0xb')](_0x7f699);eventEmitter[_0x0302('0x8')](_0x0302('0xc'),_0x16fccd);}catch(_0x4b16fb){eventEmitter[_0x0302('0x8')](_0x0302('0xd'),new AGIError(_0x0302('0x9'),_0x4b16fb));}});module[_0x0302('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xeb01=['EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate','lodash','events'];(function(_0x4e5fc8,_0x1ff94c){var _0x425116=function(_0x31b7af){while(--_0x31b7af){_0x4e5fc8['push'](_0x4e5fc8['shift']());}};_0x425116(++_0x1ff94c);}(_0xeb01,0x14e));var _0x1eb0=function(_0x209dd8,_0x3e8fe6){_0x209dd8=_0x209dd8-0x0;var _0x1b171c=_0xeb01[_0x209dd8];return _0x1b171c;};'use strict';var _=require(_0x1eb0('0x0'));var EventEmitter=require(_0x1eb0('0x1'))[_0x1eb0('0x2')];var Redis=require('ioredis');var AGIError=require(_0x1eb0('0x3'));var config=require(_0x1eb0('0x4'));config[_0x1eb0('0x5')]=_[_0x1eb0('0x6')](config['redis'],{'host':_0x1eb0('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1eb0('0x5')]);sub[_0x1eb0('0x8')]('agi',function(_0x55d625){if(_0x55d625)return eventEmitter[_0x1eb0('0x9')](_0x1eb0('0xa'),new AGIError(_0x1eb0('0xb'),_0x55d625));});sub['on'](_0x1eb0('0xc'),function(_0x5368e4,_0x2ca26b){if(_0x5368e4!=='agi')return;try{var _0x353c7a=JSON['parse'](_0x2ca26b);eventEmitter[_0x1eb0('0x9')](_0x1eb0('0xd'),_0x353c7a);}catch(_0x165d45){eventEmitter[_0x1eb0('0x9')]('error',new AGIError(_0x1eb0('0xb'),_0x165d45));}});module['exports']={'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 339db01..3da6422 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 _0xc8cf=['relations','getVertex','traverseBFS','no\x20vertex\x20found','length','info','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','prototype','addVertex','vertices','edges','addEdge','push','numberOfEdges','size'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xc8cf,0x11e));var _0xfc8c=function(_0x47e109,_0x76119b){_0x47e109=_0x47e109-0x0;var _0x3aa6d5=_0xc8cf[_0x47e109];return _0x3aa6d5;};'use strict';var _=require(_0xfc8c('0x0'));var logger=require(_0xfc8c('0x1'))(_0xfc8c('0x2'));var verticesWithRetry=[_0xfc8c('0x3'),_0xfc8c('0x4'),_0xfc8c('0x5')];var Graph=function(){this['vertices']={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0xfc8c('0x6')][_0xfc8c('0x7')]=function(_0x305d87){this[_0xfc8c('0x8')][_0x305d87['id']]=_0x305d87;this[_0xfc8c('0x9')][_0x305d87['id']]=[];};Graph[_0xfc8c('0x6')][_0xfc8c('0xa')]=function(_0x44327d,_0x3c1ff5,_0x5b2f79){this[_0xfc8c('0x9')][_0x44327d][_0xfc8c('0xb')]({'target':_0x3c1ff5,'condition':_0x5b2f79});this[_0xfc8c('0xc')]+=0x1;};Graph[_0xfc8c('0x6')][_0xfc8c('0xd')]=function(){return _[_0xfc8c('0xd')](this[_0xfc8c('0x8')]);};Graph['prototype'][_0xfc8c('0xe')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0xfc8c('0xf')]=function(_0x21db1d){return this[_0xfc8c('0x8')][_0x21db1d];};Graph[_0xfc8c('0x6')][_0xfc8c('0x10')]=function(_0x5274f6,_0x9f58b1){if(!this[_0xfc8c('0x8')][_0x5274f6]){return logger['info'](_0xfc8c('0x11'));}var _0x14d927=_0x9f58b1(this[_0xfc8c('0x8')][_0x5274f6]);if(!_0x14d927){return logger['info']('stop\x20traverse');}if(this[_0xfc8c('0x9')][_0x5274f6][_0xfc8c('0x12')]===0x0){return logger[_0xfc8c('0x13')](_0xfc8c('0x14'));}for(var _0x572362=0x0,_0x1b7395=[],_0x63c9f4=![];_0x572362\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find'];(function(_0x8fb5e2,_0x427d66){var _0x4d2bd0=function(_0x3ca1c6){while(--_0x3ca1c6){_0x8fb5e2['push'](_0x8fb5e2['shift']());}};_0x4d2bd0(++_0x427d66);}(_0xd449,0x8a));var _0x9d44=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0xd449[_0xbc2974];return _0x3a5b4f;};'use strict';var _=require(_0x9d44('0x0'));var syncho=require('syncho');var util=require(_0x9d44('0x1'));var config=require(_0x9d44('0x2'));var logger=require(_0x9d44('0x3'))(_0x9d44('0x4'));var utilLicense=require(_0x9d44('0x5'));var rpc=require(_0x9d44('0x6'));var Project=require(_0x9d44('0x7'));var AGIEmitter=require(_0x9d44('0x8'))[_0x9d44('0x9')];var projects=[];config['agi']=_[_0x9d44('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x9d44('0xb'),projectUpdateHandler);function connectionHandler(_0x440b7c){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x440b7c);agiHandler(_0x440b7c);}catch(_0x318ca5){logger[_0x9d44('0xc')](_0x318ca5[_0x9d44('0xd')]);}});});}function projectUpdateHandler(_0x20b665){try{var _0x2225b5=_[_0x9d44('0xe')](projects,['id',_0x20b665['id']]);if(_0x2225b5>-0x1){if(_0x20b665[_0x9d44('0xf')]===!![]){projects[_0x9d44('0x10')](_0x2225b5,0x1);}else{projects[_0x2225b5]=_0x20b665;}}else{projects[_0x9d44('0x11')](_0x20b665);}}catch(_0x2e1e6d){logger[_0x9d44('0xc')](_0x2e1e6d['stack']);}}function listeningHandler(){console['log'](_0x9d44('0x12'),config[_0x9d44('0x4')][_0x9d44('0x13')]);logger[_0x9d44('0x14')](util[_0x9d44('0x15')](_0x9d44('0x16'),config[_0x9d44('0x4')]['ip'],config[_0x9d44('0x4')][_0x9d44('0x13')]));}function errorHandler(_0x4b0e1a){if(_0x4b0e1a&&_0x4b0e1a[_0x9d44('0x17')]&&_0x4b0e1a[_0x9d44('0x18')]){logger[_0x9d44('0xc')](util[_0x9d44('0x15')](_0x9d44('0x19'),_0x4b0e1a[_0x9d44('0x17')],_0x4b0e1a[_0x9d44('0x18')]));}else{logger[_0x9d44('0xc')](util[_0x9d44('0x15')]('[ERROR]\x20%s',_0x4b0e1a[_0x9d44('0xd')]));}}function closeHandler(){logger['info'](util[_0x9d44('0x15')](_0x9d44('0x1a'),this[_0x9d44('0x1b')],this[_0x9d44('0x1c')],this['callerid'],this[_0x9d44('0x1d')],this[_0x9d44('0x1e')]));try{createSquareReport(this);}catch(_0x1eaeb8){logger['error'](_0x1eaeb8['stack']);}}function timeoutHandler(){logger[_0x9d44('0x14')](util[_0x9d44('0x15')](_0x9d44('0x1f'),this[_0x9d44('0x1b')],this[_0x9d44('0x1c')],this[_0x9d44('0x20')],this[_0x9d44('0x1d')],this[_0x9d44('0x1e')]));}function hangupHandler(){logger[_0x9d44('0x14')](util[_0x9d44('0x15')](_0x9d44('0x21'),this[_0x9d44('0x1b')],this[_0x9d44('0x1c')],this[_0x9d44('0x20')],this[_0x9d44('0x1d')],this[_0x9d44('0x1e')]));this[_0x9d44('0x22')]=!![];}function createSquareReport(_0x41ba32,_0x279a3f){rpc[_0x9d44('0x23')](_0x41ba32)[_0x9d44('0x24')](function(_0x2a894d){if(_0x279a3f){_0x279a3f(null,_0x2a894d);}})[_0x9d44('0x25')](function(_0x506afa){if(_0x279a3f){_0x279a3f(null,_0x506afa);}});}function setChannelVariables(_0x162842){for(var _0x411d09 in _0x162842){if(_0x162842[_0x9d44('0x26')](_0x411d09)){if(_0x411d09[_0x9d44('0x27')](_0x9d44('0x28'))===0x0){_0x162842[_0x411d09['substring'](0x4)]=_0x162842[_0x411d09];delete _0x162842[_0x411d09];}}}}function agiHandler(_0xd4be64){logger[_0x9d44('0x29')](_0x9d44('0x2a'),JSON[_0x9d44('0x2b')](_0xd4be64,null,0x2));logger[_0x9d44('0x14')](util[_0x9d44('0x15')](_0x9d44('0x2c'),_0xd4be64[_0x9d44('0x1b')],_0xd4be64[_0x9d44('0x1c')],_0xd4be64[_0x9d44('0x20')],_0xd4be64[_0x9d44('0x1d')],_0xd4be64[_0x9d44('0x1e')]));_0xd4be64['on'](_0x9d44('0xc'),errorHandler);_0xd4be64['on'](_0x9d44('0x2d'),closeHandler);_0xd4be64['on'](_0x9d44('0x2e'),timeoutHandler);_0xd4be64[_0x9d44('0x22')]=![];_0xd4be64['on']('hangup',hangupHandler);var _0x36932c=_[_0x9d44('0x2f')](projects,[_0x9d44('0x17'),_0xd4be64[_0x9d44('0x1b')]]);if(!_0x36932c)return Project[_0x9d44('0x30')](_0xd4be64);if(!_0x36932c['production'])return Project[_0x9d44('0x31')](_0xd4be64);return Project[_0x9d44('0x32')](_0x36932c,_0xd4be64);}function main(){var _0x3c351f;return utilLicense[_0x9d44('0x33')]()[_0x9d44('0x24')](function(_0x213e44){if(!_0x213e44)return;if(_0x213e44[_0x9d44('0x34')]){if(_0x213e44['callysquare']&&_0x213e44[_0x9d44('0x35')]>0x0){logger[_0x9d44('0x14')](util[_0x9d44('0x15')](_0x9d44('0x36'),_0x213e44['callysquare']));_0x3c351f=_0x213e44['callysquare'];}else{logger[_0x9d44('0x14')](_0x9d44('0x37'));}}else{logger[_0x9d44('0x14')](_0x9d44('0x38'));_0x3c351f=-0x1;}})[_0x9d44('0x24')](function(){return Project[_0x9d44('0x39')]();})[_0x9d44('0x24')](function(_0x3e93dc){projects=_0x3e93dc;return;})[_0x9d44('0x25')](function(_0x8948e6){logger['error'](_0x9d44('0x3a'),_0x8948e6[_0x9d44('0xd')]);})[_0x9d44('0x3b')](function(){var _0x2d7767=require('./server')(config['agi'][_0x9d44('0x13')],config[_0x9d44('0x4')]['ip'],_0x3c351f);_0x2d7767['on'](_0x9d44('0xc'),errorHandler);_0x2d7767['on'](_0x9d44('0x3c'),listeningHandler);_0x2d7767['on'](_0x9d44('0x3d'),connectionHandler);_0x2d7767['on'](_0x9d44('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0x1993=['hasOwnProperty','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','./events','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch'];(function(_0x24a82,_0x836580){var _0x37095d=function(_0x5bb2fc){while(--_0x5bb2fc){_0x24a82['push'](_0x24a82['shift']());}};_0x37095d(++_0x836580);}(_0x1993,0x1e7));var _0x3199=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x1993[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x3199('0x0'));var syncho=require(_0x3199('0x1'));var util=require(_0x3199('0x2'));var config=require(_0x3199('0x3'));var logger=require(_0x3199('0x4'))(_0x3199('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0x3199('0x6'))['EventEmitter'];var projects=[];config[_0x3199('0x5')]=_[_0x3199('0x7')](config[_0x3199('0x5')],{'ip':_0x3199('0x8'),'port':0x11dd});AGIEmitter['on'](_0x3199('0x9'),projectUpdateHandler);function connectionHandler(_0x185abe){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x185abe);agiHandler(_0x185abe);}catch(_0x1dc2db){logger[_0x3199('0xa')](_0x1dc2db[_0x3199('0xb')]);}});});}function projectUpdateHandler(_0xcc5ee9){try{var _0x257ae0=_[_0x3199('0xc')](projects,['id',_0xcc5ee9['id']]);if(_0x257ae0>-0x1){if(_0xcc5ee9[_0x3199('0xd')]===!![]){projects['splice'](_0x257ae0,0x1);}else{projects[_0x257ae0]=_0xcc5ee9;}}else{projects[_0x3199('0xe')](_0xcc5ee9);}}catch(_0x697556){logger['error'](_0x697556[_0x3199('0xb')]);}}function listeningHandler(){console[_0x3199('0xf')](_0x3199('0x10'),config[_0x3199('0x5')][_0x3199('0x11')]);logger[_0x3199('0x12')](util[_0x3199('0x13')](_0x3199('0x14'),config[_0x3199('0x5')]['ip'],config[_0x3199('0x5')][_0x3199('0x11')]));}function errorHandler(_0x186512){if(_0x186512&&_0x186512[_0x3199('0x15')]&&_0x186512[_0x3199('0x16')]){logger[_0x3199('0xa')](util[_0x3199('0x13')]('[%s]\x20%s',_0x186512[_0x3199('0x15')],_0x186512[_0x3199('0x16')]));}else{logger[_0x3199('0xa')](util[_0x3199('0x13')](_0x3199('0x17'),_0x186512[_0x3199('0xb')]));}}function closeHandler(){logger['info'](util['format'](_0x3199('0x18'),this['arg_1'],this['calleridname'],this[_0x3199('0x19')],this[_0x3199('0x1a')],this[_0x3199('0x1b')]));try{createSquareReport(this);}catch(_0x1d09b8){logger[_0x3199('0xa')](_0x1d09b8[_0x3199('0xb')]);}}function timeoutHandler(){logger[_0x3199('0x12')](util[_0x3199('0x13')](_0x3199('0x1c'),this[_0x3199('0x1d')],this[_0x3199('0x1e')],this[_0x3199('0x19')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x3199('0x12')](util[_0x3199('0x13')](_0x3199('0x1f'),this['arg_1'],this[_0x3199('0x1e')],this[_0x3199('0x19')],this[_0x3199('0x1a')],this[_0x3199('0x1b')]));this['evtHangup']=!![];}function createSquareReport(_0x372d3f,_0x2fdc7f){rpc[_0x3199('0x20')](_0x372d3f)[_0x3199('0x21')](function(_0x108338){if(_0x2fdc7f){_0x2fdc7f(null,_0x108338);}})[_0x3199('0x22')](function(_0x8c32ca){if(_0x2fdc7f){_0x2fdc7f(null,_0x8c32ca);}});}function setChannelVariables(_0x43cba0){for(var _0x3c66c9 in _0x43cba0){if(_0x43cba0[_0x3199('0x23')](_0x3c66c9)){if(_0x3c66c9[_0x3199('0x24')]('agi_')===0x0){_0x43cba0[_0x3c66c9[_0x3199('0x25')](0x4)]=_0x43cba0[_0x3c66c9];delete _0x43cba0[_0x3c66c9];}}}}function agiHandler(_0x3d11f0){logger[_0x3199('0x26')](_0x3199('0x27'),JSON[_0x3199('0x28')](_0x3d11f0,null,0x2));logger['info'](util['format'](_0x3199('0x29'),_0x3d11f0[_0x3199('0x1d')],_0x3d11f0[_0x3199('0x1e')],_0x3d11f0[_0x3199('0x19')],_0x3d11f0['dnid'],_0x3d11f0[_0x3199('0x1b')]));_0x3d11f0['on']('error',errorHandler);_0x3d11f0['on'](_0x3199('0x2a'),closeHandler);_0x3d11f0['on']('timeout',timeoutHandler);_0x3d11f0['evtHangup']=![];_0x3d11f0['on'](_0x3199('0x2b'),hangupHandler);var _0x14b4a2=_[_0x3199('0x2c')](projects,['name',_0x3d11f0[_0x3199('0x1d')]]);if(!_0x14b4a2)return Project[_0x3199('0x2d')](_0x3d11f0);if(!_0x14b4a2[_0x3199('0x2e')])return Project[_0x3199('0x2f')](_0x3d11f0);return Project['initialize'](_0x14b4a2,_0x3d11f0);}function main(){var _0x30d997;return utilLicense[_0x3199('0x30')]()[_0x3199('0x21')](function(_0x54358c){if(!_0x54358c)return;if(_0x54358c[_0x3199('0x31')]){if(_0x54358c[_0x3199('0x32')]&&_0x54358c[_0x3199('0x32')]>0x0){logger[_0x3199('0x12')](util[_0x3199('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x54358c['callysquare']));_0x30d997=_0x54358c[_0x3199('0x32')];}else{logger['info'](_0x3199('0x33'));}}else{logger['info'](_0x3199('0x34'));_0x30d997=-0x1;}})[_0x3199('0x21')](function(){return Project[_0x3199('0x35')]();})[_0x3199('0x21')](function(_0x5c67ec){projects=_0x5c67ec;return;})[_0x3199('0x22')](function(_0x5dcaa8){logger[_0x3199('0xa')]('[LICENSE]',_0x5dcaa8['stack']);})[_0x3199('0x36')](function(){var _0x2c3dff=require(_0x3199('0x37'))(config['agi'][_0x3199('0x11')],config[_0x3199('0x5')]['ip'],_0x30d997);_0x2c3dff['on']('error',errorHandler);_0x2c3dff['on'](_0x3199('0x38'),listeningHandler);_0x2c3dff['on'](_0x3199('0x39'),connectionHandler);_0x2c3dff['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 126c48c..fe8d6f4 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 _0x2651=['result','catch','SendMail','bluebird','jayson/promise','client','http','error','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2651,0xb7));var _0x1265=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x2651[_0x45b034];return _0x509cb0;};'use strict';var BPromise=require(_0x1265('0x0'));var jayson=require(_0x1265('0x1'));var client=jayson[_0x1265('0x2')][_0x1265('0x3')]({'port':0x232b});function request(_0x2184b3,_0x5f21aa){return new BPromise(function(_0x1363e9,_0x181f01){return client['request'](_0x2184b3,_0x5f21aa)['then'](function(_0xb88252){if(_0xb88252['error']){return _0x181f01(_0xb88252[_0x1265('0x4')][_0x1265('0x5')]);}else{return _0x1363e9(_0xb88252[_0x1265('0x6')]);}})[_0x1265('0x7')](function(_0x3441c6){return _0x181f01(_0x3441c6);});});}exports['sendMailMessage']=function(_0x213b8c,_0x3be7e9){return request(_0x1265('0x8'),{'account':_0x213b8c,'message':_0x3be7e9});}; \ No newline at end of file +var _0xf1f1=['sendMailMessage','SendMail','bluebird','client','request','then','error','message'];(function(_0x1274eb,_0x14edc0){var _0x425046=function(_0x3241cf){while(--_0x3241cf){_0x1274eb['push'](_0x1274eb['shift']());}};_0x425046(++_0x14edc0);}(_0xf1f1,0x122));var _0x1f1f=function(_0x51122a,_0x4be905){_0x51122a=_0x51122a-0x0;var _0x2d0bb0=_0xf1f1[_0x51122a];return _0x2d0bb0;};'use strict';var BPromise=require(_0x1f1f('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x1f1f('0x1')]['http']({'port':0x232b});function request(_0x76b205,_0x495d18){return new BPromise(function(_0x1bd199,_0x169695){return client[_0x1f1f('0x2')](_0x76b205,_0x495d18)[_0x1f1f('0x3')](function(_0x17fd78){if(_0x17fd78[_0x1f1f('0x4')]){return _0x169695(_0x17fd78['error'][_0x1f1f('0x5')]);}else{return _0x1bd199(_0x17fd78['result']);}})['catch'](function(_0x513759){return _0x169695(_0x513759);});});}exports[_0x1f1f('0x6')]=function(_0x5821c4,_0x490382){return request(_0x1f1f('0x7'),{'account':_0x5821c4,'message':_0x490382});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4a41f9d..381f56a 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 _0x558a=['[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','exports','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','retry','hasOwnProperty','length','source','target','addEdge','toJson','root','inspect','production','start','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','isUndefined','toString'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x558a,0x173));var _0xa558=function(_0x3bb39e,_0x2ca25d){_0x3bb39e=_0x3bb39e-0x0;var _0x28814f=_0x558a[_0x3bb39e];return _0x28814f;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require('xml2json');var util=require(_0xa558('0x0'));var logger=require(_0xa558('0x1'))(_0xa558('0x2'));var rpc=require(_0xa558('0x3'));var mailRpc=require(_0xa558('0x4'));var Graph=require(_0xa558('0x5'));var Vertices=require(_0xa558('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x26d9a3){logger[_0xa558('0x7')](_0xa558('0x8'),_0x26d9a3['stack']);return[];});}function addVertex(_0x583641,_0x2bf3b5,_0x402a05){_0x2bf3b5[_0xa558('0x9')]=_0x402a05;if(_0x2bf3b5['hasOwnProperty'](_0xa558('0xa'))){_0x2bf3b5['maxRetry']=parseInt(_0x2bf3b5[_0xa558('0xa')],0xa);}_0x583641['addVertex'](_['omit'](_0x2bf3b5,'mxCell'));}function initGraph(_0x51e1ba,_0x54ca60){var _0x4a439a=new Graph();for(var _0x385307 in _0x51e1ba){if(_0x51e1ba[_0xa558('0xb')](_0x385307)){if(_['isArray'](_0x51e1ba[_0x385307])){for(var _0xa62052=0x0;_0xa62052<_0x51e1ba[_0x385307][_0xa558('0xc')];_0xa62052+=0x1){addVertex(_0x4a439a,_0x51e1ba[_0x385307][_0xa62052],_0x385307);}}else{addVertex(_0x4a439a,_0x51e1ba[_0x385307],_0x385307);}}}for(var _0x4967f7=0x0;_0x4967f7<_0x54ca60['length'];_0x4967f7+=0x1){if(_0x54ca60[_0x4967f7][_0xa558('0xd')]&&_0x54ca60[_0x4967f7][_0xa558('0xe')]){_0x4a439a[_0xa558('0xf')](_0x54ca60[_0x4967f7][_0xa558('0xd')],_0x54ca60[_0x4967f7][_0xa558('0xe')],_0x54ca60[_0x4967f7]['value']);}}return _0x4a439a;}function getRoot(_0x170eba){return parser[_0xa558('0x10')](_0x170eba,{'object':!![]})['mxGraphModel'][_0xa558('0x11')];}function inspect(_0x3e2924){return util[_0xa558('0x12')](_0x3e2924,{'showHidden':![],'depth':null});}function initialize(_0x5d88d4,_0x31aa5b){var _0x4d90ee=getRoot(_0x5d88d4[_0xa558('0x13')]);if(!_0x4d90ee||!_0x4d90ee[_0xa558('0x14')])return;var _0x4542ef,_0x19fde1,_0x107db4;logger['debug'](_0xa558('0x11'),JSON[_0xa558('0x15')](_0x4d90ee,null,0x2));_0x31aa5b[_0xa558('0x16')]=moment()[_0xa558('0x17')]('YYYY-MM-DD\x20HH:mm:ss');_0x4542ef=initGraph(_['omit'](_0x4d90ee,'mxCell'),_0x4d90ee['mxCell']);_0x19fde1=new Vertices(_0x31aa5b,rpc,mailRpc);logger[_0xa558('0x18')](util[_0xa558('0x17')](_0xa558('0x19'),_0x31aa5b[_0xa558('0x1a')],_0x31aa5b[_0xa558('0x1b')],_0x31aa5b[_0xa558('0x1c')],_0x31aa5b[_0xa558('0x1d')],_0x31aa5b[_0xa558('0x1e')]));_0x4542ef[_0xa558('0x1f')](_0x4d90ee[_0xa558('0x14')]['id'],function(_0x35ee00){try{_0x35ee00=_0x19fde1[_0xa558('0x20')](_0x35ee00);logger[_0xa558('0x21')]('vertex',JSON[_0xa558('0x15')](_0x35ee00,null,0x2));if(_0x35ee00[_0xa558('0x9')]===_0xa558('0x22')){logger['info'](_0xa558('0x23'));_0x31aa5b[_0xa558('0x24')]=_0x35ee00[_0xa558('0x24')]||_0x31aa5b[_0xa558('0x24')];_0x31aa5b[_0xa558('0x25')]=_0x35ee00[_0xa558('0x25')];_0x31aa5b['priority']=_0x35ee00[_0xa558('0x26')]?_0x35ee00[_0xa558('0x26')]-0x1:0x1;return null;}else if(_0x35ee00&&_0x19fde1[_0x35ee00['agicommand']]){_0x107db4=_0x19fde1[_0x35ee00[_0xa558('0x9')]](_0x35ee00);logger[_0xa558('0x18')]('response',JSON['stringify'](_0x107db4,null,0x2));if(_0x107db4&&_0x107db4[_0xa558('0x27')]===AGI_CODE_SUCCESS&&_0x107db4[_0xa558('0x28')]!==AGI_RESULT_ERROR&&!_0x31aa5b[_0xa558('0x29')]){logger[_0xa558('0x21')](_0xa558('0x2a'),inspect(_0x107db4));return _[_0xa558('0x2b')](_0x107db4[_0xa558('0x28')])?null:_0x107db4[_0xa558('0x28')][_0xa558('0x2c')]();}else{logger[_0xa558('0x7')](_0xa558('0x2a'),inspect(_0x107db4));return null;}}else{logger[_0xa558('0x7')]('agicommand\x20not\x20found');return null;}}catch(_0x216c3a){logger[_0xa558('0x7')](_0x216c3a['stack']);return null;}});if(_0x4d90ee['finally']){logger['info'](util[_0xa558('0x17')](_0xa558('0x2d'),_0x31aa5b[_0xa558('0x1a')],_0x31aa5b['calleridname'],_0x31aa5b[_0xa558('0x1c')],_0x31aa5b['dnid'],_0x31aa5b[_0xa558('0x1e')]));_0x4542ef[_0xa558('0x1f')](_0x4d90ee[_0xa558('0x2e')]['id'],function(_0xe78580){try{_0xe78580=_0x19fde1['clear'](_0xe78580);logger['debug']('vertex',JSON[_0xa558('0x15')](_0xe78580,null,0x2));if(_0xe78580&&_0x19fde1[_0xe78580[_0xa558('0x9')]]){_0x107db4=_0x19fde1[_0xe78580['agicommand']](_0xe78580);if(_0x107db4){logger[_0xa558('0x21')](_0xa558('0x2a'),inspect(_0x107db4));return _[_0xa558('0x2b')](_0x107db4[_0xa558('0x28')])?null:_0x107db4[_0xa558('0x28')]['toString']();}else{logger['error'](_0xa558('0x2a'),inspect(_0x107db4));return null;}}else{logger[_0xa558('0x7')](_0xa558('0x2f'));return null;}}catch(_0x53cdff){logger[_0xa558('0x7')](_0x53cdff['stack']);return null;}});}logger['info'](util[_0xa558('0x17')](_0xa558('0x30'),_0x31aa5b['arg_1'],_0x31aa5b[_0xa558('0x1b')],_0x31aa5b[_0xa558('0x1c')],_0x31aa5b[_0xa558('0x1d')],_0x31aa5b[_0xa558('0x1e')]));logger['info'](util[_0xa558('0x17')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x31aa5b[_0xa558('0x24')],_0x31aa5b['extension'],parseInt(_0x31aa5b[_0xa558('0x26')],0xa)+0x1));_0x31aa5b[_0xa558('0x31')](_0x31aa5b[_0xa558('0x24')],_0x31aa5b[_0xa558('0x25')],parseInt(_0x31aa5b['priority'],0xa)+0x1);_0x31aa5b[_0xa558('0x32')]();}function handleNotFound(_0x5b554d){logger['error'](util[_0xa558('0x17')]('Project\x20%s\x20not\x20found',_0x5b554d['arg_1']));_0x5b554d[_0xa558('0x31')](_0x5b554d[_0xa558('0x24')],_0x5b554d[_0xa558('0x25')],parseInt(_0x5b554d[_0xa558('0x26')],0xa)+0x1);_0x5b554d[_0xa558('0x32')]();}function handleUnpublished(_0x1870d5){logger[_0xa558('0x7')](util[_0xa558('0x17')]('Project\x20%s\x20not\x20published',_0x1870d5['arg_1']));_0x1870d5['continueAt'](_0x1870d5['context'],_0x1870d5[_0xa558('0x25')],parseInt(_0x1870d5[_0xa558('0x26')],0xa)+0x1);_0x1870d5['close']();}module[_0xa558('0x33')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x612e=['./mailRpc','getSquareProjects','error','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','arg_1','uniqueid','isUndefined','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','close','exports','lodash','xml2json','util','../../config/logger','./rpc'];(function(_0x12009b,_0x385bbb){var _0x168254=function(_0x1fbeea){while(--_0x1fbeea){_0x12009b['push'](_0x12009b['shift']());}};_0x168254(++_0x385bbb);}(_0x612e,0xa9));var _0xe612=function(_0x12d085,_0x489d6b){_0x12d085=_0x12d085-0x0;var _0xeee8ce=_0x612e[_0x12d085];return _0xeee8ce;};'use strict';var _=require(_0xe612('0x0'));var moment=require('moment');var parser=require(_0xe612('0x1'));var util=require(_0xe612('0x2'));var logger=require(_0xe612('0x3'))('agi');var rpc=require(_0xe612('0x4'));var mailRpc=require(_0xe612('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe612('0x6')]()['catch'](function(_0x4c82be){logger[_0xe612('0x7')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x4c82be['stack']);return[];});}function addVertex(_0x455260,_0x25f0fd,_0x118fbb){_0x25f0fd[_0xe612('0x8')]=_0x118fbb;if(_0x25f0fd[_0xe612('0x9')](_0xe612('0xa'))){_0x25f0fd[_0xe612('0xb')]=parseInt(_0x25f0fd[_0xe612('0xa')],0xa);}_0x455260[_0xe612('0xc')](_[_0xe612('0xd')](_0x25f0fd,_0xe612('0xe')));}function initGraph(_0x23345a,_0x342563){var _0x15e905=new Graph();for(var _0x41c115 in _0x23345a){if(_0x23345a[_0xe612('0x9')](_0x41c115)){if(_[_0xe612('0xf')](_0x23345a[_0x41c115])){for(var _0x45b558=0x0;_0x45b558<_0x23345a[_0x41c115]['length'];_0x45b558+=0x1){addVertex(_0x15e905,_0x23345a[_0x41c115][_0x45b558],_0x41c115);}}else{addVertex(_0x15e905,_0x23345a[_0x41c115],_0x41c115);}}}for(var _0x4bf7ee=0x0;_0x4bf7ee<_0x342563[_0xe612('0x10')];_0x4bf7ee+=0x1){if(_0x342563[_0x4bf7ee]['source']&&_0x342563[_0x4bf7ee][_0xe612('0x11')]){_0x15e905[_0xe612('0x12')](_0x342563[_0x4bf7ee][_0xe612('0x13')],_0x342563[_0x4bf7ee][_0xe612('0x11')],_0x342563[_0x4bf7ee]['value']);}}return _0x15e905;}function getRoot(_0x4a80d7){return parser[_0xe612('0x14')](_0x4a80d7,{'object':!![]})[_0xe612('0x15')][_0xe612('0x16')];}function inspect(_0x51be0c){return util[_0xe612('0x17')](_0x51be0c,{'showHidden':![],'depth':null});}function initialize(_0x3d28f5,_0x29213f){var _0x413ffc=getRoot(_0x3d28f5[_0xe612('0x18')]);if(!_0x413ffc||!_0x413ffc[_0xe612('0x19')])return;var _0x4eb136,_0x318451,_0x362b12;logger[_0xe612('0x1a')]('root',JSON[_0xe612('0x1b')](_0x413ffc,null,0x2));_0x29213f[_0xe612('0x1c')]=moment()[_0xe612('0x1d')](_0xe612('0x1e'));_0x4eb136=initGraph(_[_0xe612('0xd')](_0x413ffc,_0xe612('0xe')),_0x413ffc[_0xe612('0xe')]);_0x318451=new Vertices(_0x29213f,rpc,mailRpc);logger[_0xe612('0x1f')](util[_0xe612('0x1d')](_0xe612('0x20'),_0x29213f['arg_1'],_0x29213f[_0xe612('0x21')],_0x29213f[_0xe612('0x22')],_0x29213f[_0xe612('0x23')],_0x29213f['uniqueid']));_0x4eb136[_0xe612('0x24')](_0x413ffc[_0xe612('0x19')]['id'],function(_0x897545){try{_0x897545=_0x318451[_0xe612('0x25')](_0x897545);logger['debug'](_0xe612('0x26'),JSON[_0xe612('0x1b')](_0x897545,null,0x2));if(_0x897545[_0xe612('0x8')]==='gotoc'){logger[_0xe612('0x1f')](_0xe612('0x27'));_0x29213f[_0xe612('0x28')]=_0x897545[_0xe612('0x28')]||_0x29213f['context'];_0x29213f[_0xe612('0x29')]=_0x897545[_0xe612('0x29')];_0x29213f['priority']=_0x897545[_0xe612('0x2a')]?_0x897545['priority']-0x1:0x1;return null;}else if(_0x897545&&_0x318451[_0x897545['agicommand']]){_0x362b12=_0x318451[_0x897545[_0xe612('0x8')]](_0x897545);logger[_0xe612('0x1f')](_0xe612('0x2b'),JSON['stringify'](_0x362b12,null,0x2));if(_0x362b12&&_0x362b12[_0xe612('0x2c')]===AGI_CODE_SUCCESS&&_0x362b12['result']!==AGI_RESULT_ERROR&&!_0x29213f['evtHangup']){logger[_0xe612('0x1a')](_0xe612('0x2b'),inspect(_0x362b12));return _['isUndefined'](_0x362b12[_0xe612('0x2d')])?null:_0x362b12[_0xe612('0x2d')][_0xe612('0x2e')]();}else{logger[_0xe612('0x7')](_0xe612('0x2b'),inspect(_0x362b12));return null;}}else{logger[_0xe612('0x7')](_0xe612('0x2f'));return null;}}catch(_0x1cf560){logger[_0xe612('0x7')](_0x1cf560['stack']);return null;}});if(_0x413ffc[_0xe612('0x30')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x29213f[_0xe612('0x31')],_0x29213f[_0xe612('0x21')],_0x29213f[_0xe612('0x22')],_0x29213f[_0xe612('0x23')],_0x29213f[_0xe612('0x32')]));_0x4eb136[_0xe612('0x24')](_0x413ffc['finally']['id'],function(_0x25da1a){try{_0x25da1a=_0x318451[_0xe612('0x25')](_0x25da1a);logger['debug'](_0xe612('0x26'),JSON[_0xe612('0x1b')](_0x25da1a,null,0x2));if(_0x25da1a&&_0x318451[_0x25da1a[_0xe612('0x8')]]){_0x362b12=_0x318451[_0x25da1a[_0xe612('0x8')]](_0x25da1a);if(_0x362b12){logger[_0xe612('0x1a')](_0xe612('0x2b'),inspect(_0x362b12));return _[_0xe612('0x33')](_0x362b12[_0xe612('0x2d')])?null:_0x362b12['result'][_0xe612('0x2e')]();}else{logger['error'](_0xe612('0x2b'),inspect(_0x362b12));return null;}}else{logger[_0xe612('0x7')](_0xe612('0x2f'));return null;}}catch(_0x2021ca){logger[_0xe612('0x7')](_0x2021ca[_0xe612('0x34')]);return null;}});}logger[_0xe612('0x1f')](util[_0xe612('0x1d')](_0xe612('0x35'),_0x29213f['arg_1'],_0x29213f[_0xe612('0x21')],_0x29213f[_0xe612('0x22')],_0x29213f[_0xe612('0x23')],_0x29213f[_0xe612('0x32')]));logger[_0xe612('0x1f')](util[_0xe612('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x29213f[_0xe612('0x28')],_0x29213f[_0xe612('0x29')],parseInt(_0x29213f['priority'],0xa)+0x1));_0x29213f[_0xe612('0x36')](_0x29213f[_0xe612('0x28')],_0x29213f[_0xe612('0x29')],parseInt(_0x29213f['priority'],0xa)+0x1);_0x29213f['close']();}function handleNotFound(_0x4ba1b1){logger[_0xe612('0x7')](util[_0xe612('0x1d')]('Project\x20%s\x20not\x20found',_0x4ba1b1[_0xe612('0x31')]));_0x4ba1b1['continueAt'](_0x4ba1b1[_0xe612('0x28')],_0x4ba1b1[_0xe612('0x29')],parseInt(_0x4ba1b1[_0xe612('0x2a')],0xa)+0x1);_0x4ba1b1['close']();}function handleUnpublished(_0x5a781a){logger[_0xe612('0x7')](util[_0xe612('0x1d')](_0xe612('0x37'),_0x5a781a[_0xe612('0x31')]));_0x5a781a['continueAt'](_0x5a781a['context'],_0x5a781a[_0xe612('0x29')],parseInt(_0x5a781a[_0xe612('0x2a')],0xa)+0x1);_0x5a781a[_0xe612('0x38')]();}module[_0xe612('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 07b6ee4..ff56f25 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 _0x65a6=['_transform','toString','indexOf','substring','split','trim','length','emit','headers','_localBuffer','exports','util','stream','_inBody'];(function(_0x41c0e0,_0x69d04c){var _0x155556=function(_0x5834b4){while(--_0x5834b4){_0x41c0e0['push'](_0x41c0e0['shift']());}};_0x155556(++_0x69d04c);}(_0x65a6,0xa5));var _0x665a=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x65a6[_0xe719ec];return _0x4842a1;};'use strict';var util=require(_0x665a('0x0'));var Transform=require(_0x665a('0x1'))['Transform'];function AGIReply(_0x2ab044){Transform['call'](this,_0x2ab044);this['_localBuffer']='';this[_0x665a('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x665a('0x3')]=function(_0x4ff178,_0x11bc3a,_0x5a0222){var _0x84e131='\x0a',_0x23813b=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x62656f=-0x1,_0x4a7631=-0x1,_0x4768d6='',_0x182c36=0x0,_0xed540d='',_0x582efe='';this['_localBuffer']+=_0x4ff178[_0x665a('0x4')]();_0xed540d=this['_localBuffer'];if(!this['_inBody']){_0x182c36=0x0;while(_0x23813b[_0x182c36]){while((_0x4a7631=_0xed540d[_0x665a('0x5')](_0x23813b[_0x182c36]))!=-0x1){_0x4768d6=_0x23813b[_0x182c36];_0x582efe=_0xed540d['substring'](0x0,_0x4a7631);_0xed540d=_0xed540d[_0x665a('0x6')](_0x4a7631+_0x4768d6['length']);var _0x5d4326=_0x582efe[_0x665a('0x7')](_0x84e131),_0x391e83=0x0,_0x5be700={},_0x1f5ab8='',_0x5db8d8='',_0x2b4fbc=-0x1;while(_0x5d4326[_0x391e83]){_0x2b4fbc=_0x5d4326[_0x391e83]['indexOf'](':');if(_0x2b4fbc!=-0x1){_0x1f5ab8=_0x5d4326[_0x391e83]['slice'](0x0,_0x2b4fbc)[_0x665a('0x8')]();_0x5db8d8=_0x5d4326[_0x391e83]['slice'](_0x2b4fbc+0x1)[_0x665a('0x8')]();if(_0x1f5ab8[_0x665a('0x9')]>0x0){_0x5be700[_0x1f5ab8]=_0x5db8d8;}}else{}_0x391e83++;}this[_0x665a('0xa')](_0x665a('0xb'),_0x5be700);this[_0x665a('0x2')]=!![];}_0x182c36++;}this[_0x665a('0xc')]=_0xed540d;}else{while((_0x62656f=_0xed540d['indexOf'](_0x84e131))!=-0x1){_0x582efe=_0xed540d['substring'](0x0,_0x62656f);this[_0x665a('0xa')]('line',_0x582efe);_0xed540d=_0xed540d['substring'](_0x62656f+_0x84e131[_0x665a('0x9')]);}this[_0x665a('0xc')]=_0xed540d;}_0x5a0222();};module[_0x665a('0xd')]=AGIReply; \ No newline at end of file +var _0x9085=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice','emit','line','exports','stream','Transform','call','_localBuffer','_inBody','inherits'];(function(_0x9cae0c,_0x42b12d){var _0x45542e=function(_0x31623a){while(--_0x31623a){_0x9cae0c['push'](_0x9cae0c['shift']());}};_0x45542e(++_0x42b12d);}(_0x9085,0x192));var _0x5908=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x9085[_0x4350c2];return _0x8b6406;};'use strict';var util=require('util');var Transform=require(_0x5908('0x0'))[_0x5908('0x1')];function AGIReply(_0x5e6177){Transform[_0x5908('0x2')](this,_0x5e6177);this[_0x5908('0x3')]='';this[_0x5908('0x4')]=![];}util[_0x5908('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x59c5d2,_0x13f775,_0x24a5d1){var _0x2b6afa='\x0a',_0x32458b=['\x0a\x0a',_0x5908('0x6')],_0x3cfa4f=-0x1,_0x53a700=-0x1,_0x4aaffb='',_0x228dc3=0x0,_0x5e10bb='',_0x82f453='';this[_0x5908('0x3')]+=_0x59c5d2[_0x5908('0x7')]();_0x5e10bb=this[_0x5908('0x3')];if(!this['_inBody']){_0x228dc3=0x0;while(_0x32458b[_0x228dc3]){while((_0x53a700=_0x5e10bb[_0x5908('0x8')](_0x32458b[_0x228dc3]))!=-0x1){_0x4aaffb=_0x32458b[_0x228dc3];_0x82f453=_0x5e10bb[_0x5908('0x9')](0x0,_0x53a700);_0x5e10bb=_0x5e10bb['substring'](_0x53a700+_0x4aaffb[_0x5908('0xa')]);var _0x4def13=_0x82f453[_0x5908('0xb')](_0x2b6afa),_0x133d4d=0x0,_0x591fcc={},_0x5f38b7='',_0x2cb73b='',_0xd023a6=-0x1;while(_0x4def13[_0x133d4d]){_0xd023a6=_0x4def13[_0x133d4d][_0x5908('0x8')](':');if(_0xd023a6!=-0x1){_0x5f38b7=_0x4def13[_0x133d4d]['slice'](0x0,_0xd023a6)[_0x5908('0xc')]();_0x2cb73b=_0x4def13[_0x133d4d][_0x5908('0xd')](_0xd023a6+0x1)[_0x5908('0xc')]();if(_0x5f38b7['length']>0x0){_0x591fcc[_0x5f38b7]=_0x2cb73b;}}else{}_0x133d4d++;}this[_0x5908('0xe')]('headers',_0x591fcc);this[_0x5908('0x4')]=!![];}_0x228dc3++;}this['_localBuffer']=_0x5e10bb;}else{while((_0x3cfa4f=_0x5e10bb['indexOf'](_0x2b6afa))!=-0x1){_0x82f453=_0x5e10bb[_0x5908('0x9')](0x0,_0x3cfa4f);this[_0x5908('0xe')](_0x5908('0xf'),_0x82f453);_0x5e10bb=_0x5e10bb[_0x5908('0x9')](_0x3cfa4f+_0x2b6afa[_0x5908('0xa')]);}this['_localBuffer']=_0x5e10bb;}_0x24a5d1();};module[_0x5908('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 15167d0..79d193c 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 _0x55d2=['ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById'];(function(_0x30798f,_0x3b68d6){var _0x2bce3c=function(_0x54fcb7){while(--_0x54fcb7){_0x30798f['push'](_0x30798f['shift']());}};_0x2bce3c(++_0x3b68d6);}(_0x55d2,0x9f));var _0x255d=function(_0x13b65c,_0x1aa36f){_0x13b65c=_0x13b65c-0x0;var _0xb7b670=_0x55d2[_0x13b65c];return _0xb7b670;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x255d('0x0'));var client=jayson[_0x255d('0x1')][_0x255d('0x2')]({'port':0x2329});function request(_0x2bac55,_0x28c41e){return new Promise(function(_0x2c9d29,_0x57cbc1){return client[_0x255d('0x3')](_0x2bac55,_0x28c41e)[_0x255d('0x4')](function(_0xda2444){if(_0xda2444[_0x255d('0x5')]){return _0x57cbc1(_0xda2444['error']['message']);}else{return _0x2c9d29(_0xda2444[_0x255d('0x6')]);}})[_0x255d('0x7')](function(_0x253ac9){return _0x57cbc1(_0x253ac9);});});}exports[_0x255d('0x8')]=function(){return request(_0x255d('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x51c2dc){return request(_0x255d('0xa'),{'options':{'raw':![],'where':{'name':_0x51c2dc},'attributes':['production']}});};exports[_0x255d('0xb')]=function(_0x2c3754){return request(_0x255d('0xc'),{'options':{'raw':![],'where':{'id':_0x2c3754},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x255d('0xd'),'as':_0x255d('0xd')}]}],'attributes':['id',_0x255d('0xe'),_0x255d('0xf')],'smtp':!![]}});};exports[_0x255d('0x10')]=function(_0x30d8f0){return request(_0x255d('0xa'),{'options':{'where':{'id':_0x30d8f0},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x11')]=function(_0x2b21fd){return request(_0x255d('0x12'),{'options':{'where':{'id':_0x2b21fd},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x13')]=function(_0x500002){return request(_0x255d('0x14'),{'options':{'where':{'id':_0x500002},'attributes':[_0x255d('0xe')]}});};exports['getSquareOdbcById']=function(_0x477c48){return request(_0x255d('0x15'),{'options':{'where':{'id':_0x477c48},'attributes':[_0x255d('0x16')]}});};exports[_0x255d('0x17')]=function(_0x201313){return request(_0x255d('0x18'),{'options':{'where':{'id':_0x201313},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x19')]=function(_0x464f6a){return request(_0x255d('0x1a'),{'options':{'where':{'phone':_0x464f6a['phone']},'attributes':['id']}});};exports[_0x255d('0x1b')]=function(_0x46b939){return request(_0x255d('0x1c'),{'options':{'where':{'id':_0x46b939},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x1d')]=function(_0x24f105){return request(_0x255d('0x1e'),{'options':{'where':{'id':_0x24f105},'attributes':[_0x255d('0x1f')]}});};exports[_0x255d('0x20')]=function(_0x48a380){return request(_0x255d('0x21'),{'options':{'raw':![],'where':{'id':_0x48a380},'include':[{'model':_0x255d('0x22'),'as':_0x255d('0x23')}]}});};exports[_0x255d('0x24')]=function(_0xb9d98e){return request(_0x255d('0x25'),{'options':{'where':{'id':_0xb9d98e},'attributes':['id',_0x255d('0xe')]}});};exports[_0x255d('0x26')]=function(_0xd69061){return request(_0x255d('0x27'),{'body':_0xd69061});};exports[_0x255d('0x28')]=function(_0x37e01e){return request(_0x255d('0x29'),{'body':_0x37e01e});};exports[_0x255d('0x2a')]=function(_0x3d7126){return request(_0x255d('0x2b'),{'body':_[_0x255d('0x2c')](_0x3d7126,{'project_name':_0x3d7126[_0x255d('0x2d')],'prev_project_name':_0x3d7126[_0x255d('0x2e')]||'','is_subproject':_0x3d7126['arg_2']?!![]:![],'leaveAt':moment()[_0x255d('0x2f')](_0x255d('0x30'))})});};exports[_0x255d('0x31')]=function(_0x22c91b){return request(_0x255d('0x32'),{'body':_0x22c91b});};exports[_0x255d('0x33')]=function(_0x56f124){return request(_0x255d('0x34'),{'body':_0x56f124});};exports['createCmContact']=function(_0x3ed01d){return request(_0x255d('0x35'),{'options':{'raw':![],'where':{'phone':_0x3ed01d[_0x255d('0x36')],'ListId':_0x3ed01d['ListId']}}})[_0x255d('0x4')](function(_0x3f8849){if(_0x3f8849){return _0x3f8849;}return request(_0x255d('0x37'),{'body':_0x3ed01d});});};exports[_0x255d('0x38')]=function(_0x25eb35){return request(_0x255d('0x39'),{'options':{'where':{'id':_0x25eb35},'attributes':['name']}});};exports[_0x255d('0x3a')]=function(_0x529680,_0x5e7231){return request(_0x255d('0x3b'),{'body':{'interface':_0x5e7231},'options':{'where':_0x529680}});};exports[_0x255d('0x3c')]=function(_0x2a9402,_0x3bc0a0,_0x5d28bd){return request(_0x255d('0x3d'),{'body':{'type':_0x3bc0a0,'uniqueid':_0x5d28bd},'options':{'where':_0x2a9402}});};exports[_0x255d('0x3e')]=function(_0x50983){return request('UnpauseUser',{'body':{},'options':{'where':_0x50983}});};exports[_0x255d('0x3f')]=function(_0x57acc7){return request('LogoutUser',{'body':{},'options':{'where':_0x57acc7}});}; \ No newline at end of file +var _0xb377=['getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','request','then','message','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','ShowUser','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact'];(function(_0x1a3002,_0x537a37){var _0xfef306=function(_0x53ea0f){while(--_0x53ea0f){_0x1a3002['push'](_0x1a3002['shift']());}};_0xfef306(++_0x537a37);}(_0xb377,0x1b6));var _0x7b37=function(_0xb7e6fb,_0x874303){_0xb7e6fb=_0xb7e6fb-0x0;var _0x54e3ce=_0xb377[_0xb7e6fb];return _0x54e3ce;};'use strict';var _=require(_0x7b37('0x0'));var moment=require(_0x7b37('0x1'));var jayson=require(_0x7b37('0x2'));var client=jayson[_0x7b37('0x3')][_0x7b37('0x4')]({'port':0x2329});function request(_0x36868b,_0x15bc68){return new Promise(function(_0x3c4851,_0x2018bd){return client[_0x7b37('0x5')](_0x36868b,_0x15bc68)[_0x7b37('0x6')](function(_0x38d1b4){if(_0x38d1b4['error']){return _0x2018bd(_0x38d1b4['error'][_0x7b37('0x7')]);}else{return _0x3c4851(_0x38d1b4['result']);}})['catch'](function(_0x3de992){return _0x2018bd(_0x3de992);});});}exports[_0x7b37('0x8')]=function(){return request(_0x7b37('0x9'),{'options':{'raw':![],'attributes':['id',_0x7b37('0xa'),_0x7b37('0xb')]}});};exports[_0x7b37('0xc')]=function(_0x4610cd){return request(_0x7b37('0xd'),{'options':{'raw':![],'where':{'name':_0x4610cd},'attributes':['production']}});};exports[_0x7b37('0xe')]=function(_0x20f993){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x20f993},'include':[{'model':'MailServerOut','as':_0x7b37('0xf'),'include':[{'model':_0x7b37('0x10'),'as':_0x7b37('0x10')}]}],'attributes':['id',_0x7b37('0xa'),_0x7b37('0x11')],'smtp':!![]}});};exports[_0x7b37('0x12')]=function(_0x28dd9c){return request(_0x7b37('0xd'),{'options':{'where':{'id':_0x28dd9c},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x13')]=function(_0x1a381a){return request(_0x7b37('0x14'),{'options':{'where':{'id':_0x1a381a},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x15')]=function(_0xbfdc78){return request(_0x7b37('0x16'),{'options':{'where':{'id':_0xbfdc78},'attributes':[_0x7b37('0xa')]}});};exports['getSquareOdbcById']=function(_0x537c83){return request(_0x7b37('0x17'),{'options':{'where':{'id':_0x537c83},'attributes':['dsn']}});};exports['getUserById']=function(_0x32ee3e){return request(_0x7b37('0x18'),{'options':{'where':{'id':_0x32ee3e},'attributes':[_0x7b37('0xa')]}});};exports['getContactByPhone']=function(_0x29a9dd){return request(_0x7b37('0x19'),{'options':{'where':{'phone':_0x29a9dd[_0x7b37('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x58c906){return request(_0x7b37('0x1b'),{'options':{'where':{'id':_0x58c906},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x1c')]=function(_0x28c427){return request(_0x7b37('0x1d'),{'options':{'where':{'id':_0x28c427},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x57f7f2){return request(_0x7b37('0x1e'),{'options':{'raw':![],'where':{'id':_0x57f7f2},'include':[{'model':_0x7b37('0x1f'),'as':_0x7b37('0x20')}]}});};exports[_0x7b37('0x21')]=function(_0x184bdd){return request(_0x7b37('0x22'),{'options':{'where':{'id':_0x184bdd},'attributes':['id',_0x7b37('0xa')]}});};exports['createSmsMessage']=function(_0x4066ea){return request(_0x7b37('0x23'),{'body':_0x4066ea});};exports['createSquareDetailsReport']=function(_0x239cfc){return request('CreateSquareDetailsReport',{'body':_0x239cfc});};exports[_0x7b37('0x24')]=function(_0x49cafd){return request('CreateSquareReport',{'body':_[_0x7b37('0x25')](_0x49cafd,{'project_name':_0x49cafd[_0x7b37('0x26')],'prev_project_name':_0x49cafd[_0x7b37('0x27')]||'','is_subproject':_0x49cafd[_0x7b37('0x27')]?!![]:![],'leaveAt':moment()[_0x7b37('0x28')](_0x7b37('0x29'))})});};exports['createSquareRecording']=function(_0x20a3cc){return request(_0x7b37('0x2a'),{'body':_0x20a3cc});};exports[_0x7b37('0x2b')]=function(_0x3d0cc1){return request(_0x7b37('0x2c'),{'body':_0x3d0cc1});};exports[_0x7b37('0x2d')]=function(_0x46810f){return request(_0x7b37('0x2e'),{'options':{'raw':![],'where':{'phone':_0x46810f[_0x7b37('0x1a')],'ListId':_0x46810f['ListId']}}})[_0x7b37('0x6')](function(_0x461858){if(_0x461858){return _0x461858;}return request(_0x7b37('0x2f'),{'body':_0x46810f});});};exports[_0x7b37('0x30')]=function(_0x50ac54){return request(_0x7b37('0x31'),{'options':{'where':{'id':_0x50ac54},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x32')]=function(_0x3e408c,_0x212185){return request(_0x7b37('0x33'),{'body':{'interface':_0x212185},'options':{'where':_0x3e408c}});};exports['agentPause']=function(_0x29ec63,_0x4a1def,_0x2cec69){return request('PauseUser',{'body':{'type':_0x4a1def,'uniqueid':_0x2cec69},'options':{'where':_0x29ec63}});};exports[_0x7b37('0x34')]=function(_0x1710f3){return request(_0x7b37('0x35'),{'body':{},'options':{'where':_0x1710f3}});};exports['agentLogout']=function(_0x1b88b7){return request('LogoutUser',{'body':{},'options':{'where':_0x1b88b7}});}; \ 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 b64651b..99e17d4 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 _0x4d68=['exports','./polly','./lex'];(function(_0x4fae85,_0x370e6a){var _0x121bab=function(_0x3e588a){while(--_0x3e588a){_0x4fae85['push'](_0x4fae85['shift']());}};_0x121bab(++_0x370e6a);}(_0x4d68,0x1c3));var _0x84d6=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x4d68[_0x35d3a8];return _0x182378;};var polly=require(_0x84d6('0x0'));var lex=require(_0x84d6('0x1'));module[_0x84d6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xfcbe=['exports','./lex'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x18eb8c,_0x2a1a1e){_0x18eb8c=_0x18eb8c-0x0;var _0x33beda=_0xfcbe[_0x18eb8c];return _0x33beda;};var polly=require('./polly');var lex=require(_0xefcb('0x0'));module[_0xefcb('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 3c05471..06ddc9a 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 _0x6c76=['./lib/api','exports'];(function(_0x42dd1d,_0xb0a2a6){var _0x5c67b7=function(_0x43e3e5){while(--_0x43e3e5){_0x42dd1d['push'](_0x42dd1d['shift']());}};_0x5c67b7(++_0xb0a2a6);}(_0x6c76,0x184));var _0x66c7=function(_0x5519da,_0x58bacc){_0x5519da=_0x5519da-0x0;var _0x584b8e=_0x6c76[_0x5519da];return _0x584b8e;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ No newline at end of file +var _0x13f6=['./lib/api','exports'];(function(_0x5e5d56,_0x104665){var _0x6a42ea=function(_0x56688b){while(--_0x56688b){_0x5e5d56['push'](_0x5e5d56['shift']());}};_0x6a42ea(++_0x104665);}(_0x13f6,0x124));var _0x613f=function(_0x1699e6,_0x38cb2d){_0x1699e6=_0x1699e6-0x0;var _0x4d8b9f=_0x13f6[_0x1699e6];return _0x4d8b9f;};'use strict';var lex=require(_0x613f('0x0'));module[_0x613f('0x1')]=function(_0x5f1b3e,_0x563492,_0xd04cfd,_0x13b50a,_0x12dc5a,_0x5414ff){return lex(_0x5f1b3e,_0x563492,_0xd04cfd,_0x13b50a,_0x12dc5a,_0x5414ff);}; \ 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 0094752..f7b4dca 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(_0x5eda34,_0x3836e2){var _0x27de7c=function(_0x52809b){while(--_0x52809b){_0x5eda34['push'](_0x5eda34['shift']());}};_0x27de7c(++_0x3836e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x3e2d1b,_0x43cb81){var _0xad99e6=function(_0x331594){while(--_0x331594){_0x3e2d1b['push'](_0x3e2d1b['shift']());}};_0xad99e6(++_0x43cb81);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 38bb4b8..4b8d923 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 _0x7782=['./lib/api','exports'];(function(_0xc33acc,_0xeeb744){var _0x16e08e=function(_0x2473f8){while(--_0x2473f8){_0xc33acc['push'](_0xc33acc['shift']());}};_0x16e08e(++_0xeeb744);}(_0x7782,0x1d0));var _0x2778=function(_0x272a31,_0x4e4a26){_0x272a31=_0x272a31-0x0;var _0x17cd00=_0x7782[_0x272a31];return _0x17cd00;};'use strict';var polly=require(_0x2778('0x0'));module[_0x2778('0x1')]=function(_0x3c1717,_0x22c66f,_0x50762e,_0x31bf01,_0x5ca6aa,_0x507872,_0x141700){return polly(_0x3c1717,_0x22c66f,_0x50762e,_0x31bf01,_0x5ca6aa,_0x507872,_0x141700);}; \ No newline at end of file +var _0x64b0=['exports'];(function(_0x2d1596,_0x330dba){var _0x46a36d=function(_0x32227b){while(--_0x32227b){_0x2d1596['push'](_0x2d1596['shift']());}};_0x46a36d(++_0x330dba);}(_0x64b0,0x7f));var _0x064b=function(_0x4f14ec,_0x3e7175){_0x4f14ec=_0x4f14ec-0x0;var _0x212bb2=_0x64b0[_0x4f14ec];return _0x212bb2;};'use strict';var polly=require('./lib/api');module[_0x064b('0x0')]=function(_0x59bc58,_0x74b68a,_0x726fb4,_0x4d8e6c,_0x30423a,_0x16bfd4,_0x4fa697){return polly(_0x59bc58,_0x74b68a,_0x726fb4,_0x4d8e6c,_0x30423a,_0x16bfd4,_0x4fa697);}; \ 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 9e5bed5..5779d78 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 _0x3027=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3027,0x101));var _0x7302=function(_0x1effd3,_0x52c997){_0x1effd3=_0x1effd3-0x0;var _0x47efad=_0x3027[_0x1effd3];return _0x47efad;};'use strict';var fs=require('fs');var path=require(_0x7302('0x0'));var BPromise=require(_0x7302('0x1'));var rs=require(_0x7302('0x2'));var AWS=require(_0x7302('0x3'));function pollyResult(_0x51e7e2,_0x11f097,_0x3d2c55){return new BPromise(function(_0x41178f,_0x481de9){_0x51e7e2['synthesizeSpeech'](_0x11f097,function(_0x18ec74,_0x402ec1){if(_0x18ec74){_0x481de9(_0x18ec74);}else if(_0x402ec1){if(_0x402ec1[_0x7302('0x4')]instanceof Buffer){fs[_0x7302('0x5')](_0x3d2c55,_0x402ec1[_0x7302('0x4')],function(_0x7e3dce){if(_0x7e3dce){_0x481de9(_0x7e3dce);}else{_0x41178f();}});}else{_0x481de9(new Error(_0x7302('0x6')));}}else{_0x481de9(new Error(_0x7302('0x7')));}});});}module['exports']=function(_0x161e9d,_0x3257c4,_0x44e0a0,_0x528170,_0x77d33c,_0x4c2cd9,_0x1d4afa){var _0x282bf6=new AWS[(_0x7302('0x8'))]({'accessKeyId':_0x161e9d,'secretAccessKey':_0x3257c4,'region':_0x44e0a0});var _0x117955={'Text':_0x77d33c,'TextType':_0x4c2cd9||_0x7302('0x9'),'OutputFormat':_0x7302('0xa'),'VoiceId':_0x528170};return pollyResult(_0x282bf6,_0x117955,_0x1d4afa);}; \ No newline at end of file +var _0xecd2=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x3ccc5f,_0x17ba72){var _0x15de37=function(_0x255971){while(--_0x255971){_0x3ccc5f['push'](_0x3ccc5f['shift']());}};_0x15de37(++_0x17ba72);}(_0xecd2,0xd0));var _0x2ecd=function(_0x4debf8,_0x5ac3d9){_0x4debf8=_0x4debf8-0x0;var _0x111419=_0xecd2[_0x4debf8];return _0x111419;};'use strict';var fs=require('fs');var path=require(_0x2ecd('0x0'));var BPromise=require(_0x2ecd('0x1'));var rs=require(_0x2ecd('0x2'));var AWS=require(_0x2ecd('0x3'));function pollyResult(_0x3fdfaf,_0x1e376f,_0x31da6f){return new BPromise(function(_0x1d90fc,_0x1df043){_0x3fdfaf[_0x2ecd('0x4')](_0x1e376f,function(_0x4a6fc2,_0x1fb482){if(_0x4a6fc2){_0x1df043(_0x4a6fc2);}else if(_0x1fb482){if(_0x1fb482['AudioStream']instanceof Buffer){fs[_0x2ecd('0x5')](_0x31da6f,_0x1fb482[_0x2ecd('0x6')],function(_0x4e0c49){if(_0x4e0c49){_0x1df043(_0x4e0c49);}else{_0x1d90fc();}});}else{_0x1df043(new Error(_0x2ecd('0x7')));}}else{_0x1df043(new Error(_0x2ecd('0x8')));}});});}module[_0x2ecd('0x9')]=function(_0x57ea49,_0x398c79,_0x5b3662,_0x31bc43,_0x25a419,_0x4d3833,_0xcba1c){var _0x5cb39e=new AWS[(_0x2ecd('0xa'))]({'accessKeyId':_0x57ea49,'secretAccessKey':_0x398c79,'region':_0x5b3662});var _0x2f9485={'Text':_0x25a419,'TextType':_0x4d3833||_0x2ecd('0xb'),'OutputFormat':_0x2ecd('0xc'),'VoiceId':_0x31bc43};return pollyResult(_0x5cb39e,_0x2f9485,_0xcba1c);}; \ 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 fbe47d8..c0a4a7b 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x399e50,_0x55cbfa,_0x2ae405,_0x3b64c0){return asr(_0x399e50,_0x55cbfa,_0x2ae405);}; \ No newline at end of file +var _0x98f2=['./lib/api','exports'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x98f2,0x118));var _0x298f=function(_0x16d7d8,_0x43a6cd){_0x16d7d8=_0x16d7d8-0x0;var _0x4f9dbf=_0x98f2[_0x16d7d8];return _0x4f9dbf;};'use strict';var asr=require(_0x298f('0x0'));module[_0x298f('0x1')]=function(_0x4c20fd,_0x16b012,_0x1f0317,_0xf76805){return asr(_0x4c20fd,_0x16b012,_0x1f0317);}; \ 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 e932875..361e1d2 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 _0xe57e=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','string','length'];(function(_0xccc44a,_0x4e3c11){var _0x239fd6=function(_0x37feda){while(--_0x37feda){_0xccc44a['push'](_0xccc44a['shift']());}};_0x239fd6(++_0x4e3c11);}(_0xe57e,0xf2));var _0xee57=function(_0x5aa48f,_0x5a31b7){_0x5aa48f=_0x5aa48f-0x0;var _0x18d72c=_0xe57e[_0x5aa48f];return _0x18d72c;};'use strict';var url=require(_0xee57('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xee57('0x1');module[_0xee57('0x2')]=function(_0x336aaa,_0x59bb30,_0x5e53cc){return new BPromise(function(_0x2dbc91,_0x544e4a){var _0x2d975b;if(typeof _0x336aaa!==_0xee57('0x3')||_0x336aaa[_0xee57('0x4')]===0x0){return _0x544e4a('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x59bb30!=='string'||_0x59bb30[_0xee57('0x4')]===0x0){return _0x544e4a(_0xee57('0x5'));}if(typeof _0x5e53cc!==_0xee57('0x6')&&(typeof _0x5e53cc!==_0xee57('0x3')||_0x5e53cc[_0xee57('0x4')]===0x0)){return _0x544e4a(_0xee57('0x7'));}try{_0x2d975b=fs[_0xee57('0x8')](_0x336aaa)['toString']('base64');}catch(_0x195956){return _0x544e4a(_0x195956);}return _0x2dbc91({'method':_0xee57('0x9'),'uri':host+_0xee57('0xa')+_0x59bb30,'body':{'config':{'encoding':_0xee57('0xb'),'sampleRateHertz':_0xee57('0xc'),'languageCode':_0x5e53cc},'audio':{'content':_0x2d975b}},'json':!![]});});}; \ No newline at end of file +var _0x6ae0=['exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x451151,_0x567944){var _0x11950c=function(_0x3d2d5b){while(--_0x3d2d5b){_0x451151['push'](_0x451151['shift']());}};_0x11950c(++_0x567944);}(_0x6ae0,0x192));var _0x06ae=function(_0x4a0ecf,_0x49d5bc){_0x4a0ecf=_0x4a0ecf-0x0;var _0x24057e=_0x6ae0[_0x4a0ecf];return _0x24057e;};'use strict';var url=require(_0x06ae('0x0'));var BPromise=require(_0x06ae('0x1'));var fs=require('fs');var host=_0x06ae('0x2');module[_0x06ae('0x3')]=function(_0x54e586,_0x52f385,_0x319535){return new BPromise(function(_0x58c780,_0x104bb4){var _0x5ec2f9;if(typeof _0x54e586!==_0x06ae('0x4')||_0x54e586[_0x06ae('0x5')]===0x0){return _0x104bb4('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x52f385!==_0x06ae('0x4')||_0x52f385['length']===0x0){return _0x104bb4(_0x06ae('0x6'));}if(typeof _0x319535!==_0x06ae('0x7')&&(typeof _0x319535!=='string'||_0x319535[_0x06ae('0x5')]===0x0)){return _0x104bb4(_0x06ae('0x8'));}try{_0x5ec2f9=fs[_0x06ae('0x9')](_0x54e586)[_0x06ae('0xa')](_0x06ae('0xb'));}catch(_0x1a667c){return _0x104bb4(_0x1a667c);}return _0x58c780({'method':_0x06ae('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x52f385,'body':{'config':{'encoding':_0x06ae('0xd'),'sampleRateHertz':_0x06ae('0xe'),'languageCode':_0x319535},'audio':{'content':_0x5ec2f9}},'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 7c37d1c..55df85a 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 _0x8b24=['exports','./asr'];(function(_0x90ead9,_0x4987e2){var _0x4cddce=function(_0x180784){while(--_0x180784){_0x90ead9['push'](_0x90ead9['shift']());}};_0x4cddce(++_0x4987e2);}(_0x8b24,0x109));var _0x48b2=function(_0x1b2b71,_0x338dd8){_0x1b2b71=_0x1b2b71-0x0;var _0x14aa21=_0x8b24[_0x1b2b71];return _0x14aa21;};var asr=require(_0x48b2('0x0'));module[_0x48b2('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7215=['exports'];(function(_0x1dc191,_0x47f271){var _0x32a87e=function(_0x531bfd){while(--_0x531bfd){_0x1dc191['push'](_0x1dc191['shift']());}};_0x32a87e(++_0x47f271);}(_0x7215,0xc9));var _0x5721=function(_0x3fd165,_0x5e2e2f){_0x3fd165=_0x3fd165-0x0;var _0x50f970=_0x7215[_0x3fd165];return _0x50f970;};var asr=require('./asr');module[_0x5721('0x0')]={'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 e9e1688..c44a9c4 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 _0xe47c=['freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','https','path','querystring','sox','google-tts-api','util','./google','./sestek','./tilde','agi','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','error','unlink','download\x20error','pipe','end','data','wav','error\x20convert','generate','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','text:synthesize','POST','resolve','tmp','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','.wav','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe47c,0x91));var _0xce47=function(_0x860f79,_0x121fbb){_0x860f79=_0x860f79-0x0;var _0xe7c610=_0xe47c[_0x860f79];return _0xe7c610;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xce47('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xce47('0x1'));var md5=require('md5');var path=require(_0xce47('0x2'));var querystring=require(_0xce47('0x3'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0xce47('0x4'));var tts=require(_0xce47('0x5'));var urlParse=require('url')['parse'];var util=require(_0xce47('0x6'));var aws=require('./aws');var google=require(_0xce47('0x7'));var sestek=require(_0xce47('0x8'));var tilde=require(_0xce47('0x9'));var logger=require('../../../config/logger')(_0xce47('0xa'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x10fcf8,_0x2f6d50){return new BPromise(function(_0x2af275,_0x52162a){var _0x1c77b8=urlParse(_0x10fcf8);var _0x459931=_0x1c77b8[_0xce47('0xb')]===_0xce47('0xc')?https:http;var _0x21cc35={'host':_0x1c77b8[_0xce47('0xd')],'path':_0x1c77b8[_0xce47('0x2')],'headers':{'user-agent':_0xce47('0xe')}};_0x459931[_0xce47('0xf')](_0x21cc35,function(_0x2ad2b8){if(_0x2ad2b8[_0xce47('0x10')]!==0xc8){logger['error'](_0xce47('0x11')+_0x10fcf8+_0xce47('0x12')+_0x2ad2b8[_0xce47('0x10')]+'\x20('+_0x2ad2b8[_0xce47('0x13')]+')');_0x52162a(new Error('request\x20to\x20'+_0x10fcf8+_0xce47('0x12')+_0x2ad2b8['statusCode']+'\x20('+_0x2ad2b8[_0xce47('0x13')]+')'));return;}var _0x3dbabd=fs[_0xce47('0x14')](_0x2f6d50);_0x3dbabd['on'](_0xce47('0x15'),function(){logger[_0xce47('0x16')]('finish\x20download\x20file');_0x3dbabd['close'](_0x2af275);});_0x3dbabd['on'](_0xce47('0x17'),function(_0x264ac4){fs[_0xce47('0x18')](_0x2f6d50);logger['error'](_0xce47('0x19'),_0x264ac4);_0x52162a(_0x264ac4);});_0x2ad2b8[_0xce47('0x1a')](_0x3dbabd);})['on'](_0xce47('0x17'),function(_0x187973){logger['error'](_0x187973);_0x52162a(_0x187973);})[_0xce47('0x1b')]();});}function uploadFile(_0x31fc4a){return new BPromise(function(_0x423c97,_0x183afb){var _0x5d9fb4=urlParse(_0x31fc4a);var _0x171dd3=_0x5d9fb4[_0xce47('0xb')]===_0xce47('0xc')?https:http;var _0x4f6ed2={'host':_0x5d9fb4['host'],'path':_0x5d9fb4['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x171dd3['get'](_0x4f6ed2,function(_0x643939){if(_0x643939[_0xce47('0x10')]!==0xc8){_0x183afb(new Error(_0xce47('0x11')+_0x31fc4a+_0xce47('0x12')+_0x643939[_0xce47('0x10')]+'\x20('+_0x643939[_0xce47('0x13')]+')'));return;}var _0x267754='';_0x643939['on'](_0xce47('0x1c'),function(_0x50a722){_0x267754+=_0x50a722;});_0x643939['on'](_0xce47('0x1b'),function(){_0x423c97(_0x267754);});})['on'](_0xce47('0x17'),function(_0x5c03ef){_0x183afb(_0x5c03ef);})[_0xce47('0x1b')]();});}function convertFile(_0xd3223f,_0x38f04a){return new BPromise(function(_0x124bf4,_0x1323dc){var _0x238824=sox['transcode'](_0xd3223f,_0x38f04a,{'sampleRate':0x1f40,'format':_0xce47('0x1d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x238824['on'](_0xce47('0x17'),function(_0x2ed687){logger['error'](_0xce47('0x1e'),_0x2ed687);_0x1323dc(_0x2ed687);});_0x238824['on'](_0xce47('0x1b'),function(){logger[_0xce47('0x16')]('finish\x20to\x20convert');_0x124bf4();});_0x238824['start']();});}function base64Decode(_0x2472d7,_0x34c3e0){var _0x51a175=path['resolve'](__dirname,'tmp',rs[_0xce47('0x1f')](0x4)+'.wav');fs[_0xce47('0x20')](_0x51a175,_0x2472d7,_0xce47('0x21'));return convertFile(_0x51a175,_0x34c3e0)[_0xce47('0x22')](function(){try{fs[_0xce47('0x18')](_0x51a175);fs[_0xce47('0x23')](_0x34c3e0,'777');}catch(_0x40e055){logger[_0xce47('0x17')](_0x40e055);}return _0x34c3e0[_0xce47('0x24')]('.')[0x0];});}function base64Encode(_0x4ea0da){var _0x18f260=fs[_0xce47('0x25')](_0x4ea0da);return new Buffer(_0x18f260)[_0xce47('0x26')](_0xce47('0x21'));}exports['googleCloudTTS']=function(_0x4559e7,_0x148315,_0x23916d,_0x43954f,_0x222315,_0x3bc2a9){var _0x38ab0a,_0x5f5aba;var _0x88d70e=_0xce47('0x27');var _0x5b35a6=_0xce47('0x28')+_0x4559e7;var _0x4c2c0b={};if(_0x148315===_0xce47('0x29')){_0x4c2c0b[_0xce47('0x2a')]={'ssml':_0x23916d};}else{_0x4c2c0b[_0xce47('0x2a')]={'text':_0x23916d};};_0x4c2c0b['voice']={'languageCode':_0x43954f,'ssmlGender':_0x222315};_0x4c2c0b['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4cc8d0={'url':_0x88d70e+_0xce47('0x2b')+_0x5b35a6,'method':_0xce47('0x2c'),'json':!![],'body':_0x4c2c0b};return rp(_0x4cc8d0)[_0xce47('0x22')](function(_0x4dbde3){return new BPromise(function(_0x38fcc9,_0x20d95d){_0x38ab0a=path[_0xce47('0x2d')](__dirname,_0xce47('0x2e'),rs[_0xce47('0x1f')](0x4)+_0xce47('0x2f'));var _0x980891=Buffer[_0xce47('0x30')](_0x4dbde3[_0xce47('0x31')],'base64');return fs[_0xce47('0x32')](_0x38ab0a,_0x980891,function(_0x4f9f9a){_0x20d95d(_0x4f9f9a);},function(_0x110367){fs['chmodSync'](_0x38ab0a,'777');_0x38fcc9(_0x110367);});});})[_0xce47('0x22')](function(_0x18ed52){_0x5f5aba=path['resolve'](__dirname,_0xce47('0x2e'),rs['generate'](0x4)+'.wav');return convertFile(_0x38ab0a,_0x5f5aba);})[_0xce47('0x22')](function(){try{fs['unlink'](_0x38ab0a);fs[_0xce47('0x23')](_0x5f5aba,_0xce47('0x33'));}catch(_0x1f6930){logger[_0xce47('0x17')](_0x1f6930);}logger[_0xce47('0x16')](_0xce47('0x34'),_0x5f5aba[_0xce47('0x24')]('.')[0x0]);return _0x5f5aba[_0xce47('0x24')]('.')[0x0];});};exports[_0xce47('0x35')]=function(_0x3e9095,_0x207ea9){var _0x4f24ff='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1e2186,_0x4e43e5;var _0x570cb3;var _0x450d8b={'encoding':_0xce47('0x36'),'method':_0xce47('0x2c'),'timeout':0x2710,'url':_0x4f24ff,'headers':{'Content-Type':_0xce47('0x37')},'body':_0xce47('0x38')+encodeURIComponent(JSON[_0xce47('0x39')]([[['jQ1olc',JSON[_0xce47('0x39')]([_0x3e9095,_0x207ea9||'en',![],_0xce47('0x3a')]),null,_0xce47('0x3b')]]]))};return rp(_0x450d8b)['then'](function(_0x4b91dd){try{_0x570cb3=eval(_0x4b91dd['slice'](0x5))[0x0][0x2];}catch(_0x5d3e86){throw new Error(_0xce47('0x3c')+_0x4b91dd['data']);}if(!_0x570cb3){if(_0x3e9095['length']>0xc8){throw new Error(_0xce47('0x3d'));}else{throw new Error(_0xce47('0x3e')+_0x207ea9+'\x22\x20might\x20not\x20exist');}}try{_0x570cb3=eval(_0x570cb3)[0x0];}catch(_0x1d599e){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xce47('0x1c')]);}const _0x2a5ff0=_0x570cb3;_0x1e2186=path[_0xce47('0x2d')](__dirname,_0xce47('0x2e'),rs[_0xce47('0x1f')](0x4)+_0xce47('0x2f'));fs[_0xce47('0x20')](_0x1e2186,_0x570cb3,{'encoding':_0xce47('0x21')});_0x4e43e5=path['resolve'](__dirname,'tmp',rs[_0xce47('0x1f')](0x4)+_0xce47('0x3f'));return convertFile(_0x1e2186,_0x4e43e5);})[_0xce47('0x22')](function(){try{fs[_0xce47('0x18')](_0x1e2186);fs[_0xce47('0x23')](_0x4e43e5,'777');}catch(_0x2d7ac9){logger[_0xce47('0x17')](_0x2d7ac9);}logger[_0xce47('0x16')](_0xce47('0x40'),_0x4e43e5[_0xce47('0x24')]('.')[0x0]);return _0x4e43e5['split']('.')[0x0];});};exports[_0xce47('0x41')]=function(_0x3e8283,_0x4d17ec,_0x2a203a){return google[_0xce47('0x42')](_0x3e8283,_0x4d17ec,_0x2a203a)[_0xce47('0x22')](function(_0x4d99a1){logger[_0xce47('0x16')](_0x4d99a1['uri']);return rp(_0x4d99a1);})[_0xce47('0x22')](function(_0x4864be){var _0x51e86e='';var _0x282e86=0x0;try{fs[_0xce47('0x18')](_0x3e8283);}catch(_0x3ef3e1){logger[_0xce47('0x17')](_0x3ef3e1);}if(_0x4864be&&_0x4864be['results']){_0x51e86e=_0x4864be[_0xce47('0x43')][_0xce47('0x44')](function(_0x22944d){return _0x22944d&&_0x22944d[_0xce47('0x45')][0x0]&&_0x22944d[_0xce47('0x45')][0x0]['transcript']?_0x22944d[_0xce47('0x45')][0x0][_0xce47('0x46')]:'';})[_0xce47('0x47')]('\x0a');_0x282e86=_0x4864be[_0xce47('0x43')]['map'](function(_0x307c0f){return _0x307c0f&&_0x307c0f[_0xce47('0x45')][0x0]&&_0x307c0f[_0xce47('0x45')][0x0][_0xce47('0x48')]?_0x307c0f['alternatives'][0x0][_0xce47('0x48')]:0x0;})[_0xce47('0x47')]('\x0a');}logger[_0xce47('0x16')](_0xce47('0x49'),_0x51e86e);logger['info'](_0xce47('0x4a'),_0x282e86);return{'transcript':_0x51e86e,'confidence':_0x282e86};})[_0xce47('0x4b')](function(_0x3887fe){logger[_0xce47('0x17')](_0xce47('0x4c'),_0x3887fe[_0xce47('0x10')],_0x3887fe[_0xce47('0x4d')],_0x3887fe['message']);});};exports['googleDialogflow']=function(_0x4f578a,_0x19575f,_0x56622d,_0x3a6fce){var _0x3d9f00=apiai(_0x19575f,{'language':_0x3a6fce||'en'});return _0x3d9f00[_0xce47('0x4e')](_0x56622d,{'sessionId':md5(_0x4f578a)})['then'](function(_0x4d7d61){logger[_0xce47('0x16')](JSON[_0xce47('0x39')](_0x4d7d61));return{'source':_0x4d7d61[_0xce47('0x4f')]['source'],'resolvedQuery':_0x4d7d61[_0xce47('0x4f')][_0xce47('0x50')],'action':_0x4d7d61[_0xce47('0x4f')][_0xce47('0x51')],'actionIncomplete':_0x4d7d61[_0xce47('0x4f')][_0xce47('0x52')],'speech':_0x4d7d61[_0xce47('0x4f')][_0xce47('0x53')][_0xce47('0x54')],'score':_0x4d7d61[_0xce47('0x4f')]['score'],'statusCode':_0x4d7d61[_0xce47('0x55')]['code'],'endConversation':_0x4d7d61[_0xce47('0x4f')][_0xce47('0x56')][_0xce47('0x57')]||![],'isFallbackIntent':_0x4d7d61[_0xce47('0x4f')][_0xce47('0x56')][_0xce47('0x58')]};});};exports[_0xce47('0x59')]=function(_0x1e5d6a,_0x4660be,_0x5db782,_0x37f697,_0x1b167d,_0x46d33f){var _0x34f2f9=_0x37f697[_0xce47('0x5a')](/\\n/g,'\x0a');var _0x2ce1e9={'credentials':{'private_key':_0x34f2f9,'client_email':_0x5db782}};var _0x435af9=new dialogflow[(_0xce47('0x5b'))](_0x2ce1e9);var _0x4b5c7d=_0x435af9[_0xce47('0x5c')](_0x4660be,md5(_0x1e5d6a));var _0x3933fb={'session':_0x4b5c7d,'queryInput':{'text':{'text':_0x1b167d,'languageCode':_0x46d33f}}};return _0x435af9[_0xce47('0x5d')](_0x3933fb)[_0xce47('0x22')](function(_0x44f483){if(_0x44f483&&_0x44f483[_0xce47('0x5e')]){logger['info'](_0xce47('0x5f'),JSON[_0xce47('0x39')](_0x44f483));var _0xb32d33=_0x44f483[0x0];if(_0xb32d33){var _0x2d18d9={'action':_0xb32d33[_0xce47('0x60')][_0xce47('0x51')],'allRequiredParamsPresent':_0xb32d33[_0xce47('0x60')][_0xce47('0x61')],'endConversation':_0xb32d33[_0xce47('0x60')]['diagnosticInfo']&&_0xb32d33[_0xce47('0x60')][_0xce47('0x62')][_0xce47('0x63')]?_0xb32d33['queryResult'][_0xce47('0x62')][_0xce47('0x63')][_0xce47('0x64')][_0xce47('0x65')]:![],'fulfillmentText':_0xb32d33[_0xce47('0x60')]['fulfillmentText'],'intentName':_0xb32d33[_0xce47('0x60')][_0xce47('0x66')][_0xce47('0x4d')],'intentDisplayName':_0xb32d33['queryResult'][_0xce47('0x66')][_0xce47('0x67')],'isFallbackIntent':_0xb32d33[_0xce47('0x60')][_0xce47('0x66')][_0xce47('0x68')],'languageCode':_0xb32d33[_0xce47('0x60')][_0xce47('0x69')],'queryText':_0xb32d33[_0xce47('0x60')][_0xce47('0x6a')],'responseId':_0xb32d33[_0xce47('0x6b')],'score':_0xb32d33['queryResult']['intentDetectionConfidence'],'speech':_0xb32d33[_0xce47('0x60')][_0xce47('0x6c')],'providerResponse':JSON[_0xce47('0x39')](_0x44f483)};return _0x2d18d9;}}});};exports[_0xce47('0x6d')]=function(_0x3a0060,_0x2348b0,_0x42a79f,_0x18d209){return tilde[_0xce47('0x42')](_0x3a0060,_0x2348b0,_0x42a79f,_0x18d209)[_0xce47('0x22')](function(_0x20d3dd){try{fs[_0xce47('0x18')](_0x3a0060);}catch(_0x2b8782){logger[_0xce47('0x17')](_0x2b8782);}logger['info'](_0xce47('0x6e'),_0x20d3dd[_0xce47('0x46')]);logger[_0xce47('0x16')]('Tilde\x20ASR\x20confidence',_0x20d3dd[_0xce47('0x48')]);return _0x20d3dd;});};exports[_0xce47('0x6f')]=function(_0x1f83f1,_0x3f4ccc,_0x5c9332,_0x299f74,_0x49812f,_0x5e9462){var _0x5971d9=path[_0xce47('0x2d')](__dirname,_0xce47('0x2e'),rs[_0xce47('0x1f')](0x4)+_0xce47('0x2f'));var _0x4316a6;return aws[_0xce47('0x70')](_0x1f83f1,_0x3f4ccc,_0x5c9332,_0x299f74,_0x49812f,_0x5e9462,_0x5971d9)['then'](function(){_0x4316a6=path[_0xce47('0x2d')](__dirname,'tmp',rs[_0xce47('0x1f')](0x4)+_0xce47('0x3f'));return convertFile(_0x5971d9,_0x4316a6);})[_0xce47('0x22')](function(){try{fs[_0xce47('0x18')](_0x5971d9);fs['chmodSync'](_0x4316a6,_0xce47('0x33'));}catch(_0x54ce5e){logger[_0xce47('0x17')](_0x54ce5e);}return _0x4316a6[_0xce47('0x24')]('.')[0x0];});};exports[_0xce47('0x71')]=function(_0x44c529,_0x48da2b,_0x53abf2,_0x5f09a6,_0x543502,_0x40434d){return aws[_0xce47('0x72')](_0x44c529,_0x48da2b,_0x53abf2,_0x5f09a6,_0x543502,_0x40434d)[_0xce47('0x22')](function(_0x12ad1c){logger['info'](JSON['stringify'](_0x12ad1c));return _0x12ad1c;});};exports[_0xce47('0x73')]=function(_0x42abad,_0x458332,_0x31185f,_0x6ba6ec){var _0x19a9d0=util['format'](_0xce47('0x74'),ISPEECH_API,_0x42abad,encodeURIComponent(_0x458332),_0x31185f,_0x6ba6ec);var _0x2ea476=path[_0xce47('0x2d')](__dirname,_0xce47('0x2e'),rs[_0xce47('0x1f')](0x4)+_0xce47('0x2f'));var _0x258d11;return downloadFile(_0x19a9d0,_0x2ea476)['then'](function(){_0x258d11=path[_0xce47('0x2d')](__dirname,_0xce47('0x2e'),rs[_0xce47('0x1f')](0x4)+_0xce47('0x3f'));return convertFile(_0x2ea476,_0x258d11);})['then'](function(){try{fs[_0xce47('0x18')](_0x2ea476);fs[_0xce47('0x23')](_0x258d11,_0xce47('0x33'));}catch(_0x14df92){logger[_0xce47('0x17')](_0x14df92);}return _0x258d11[_0xce47('0x24')]('.')[0x0];});};exports[_0xce47('0x75')]=function(_0x1ac3f9,_0x51b458,_0x594605,_0x3e4a3b){var _0x175df5=util[_0xce47('0x76')](_0xce47('0x77'),ISPEECH_API,_0x51b458,_0x594605,base64Encode(_0x1ac3f9),_0x3e4a3b?util[_0xce47('0x76')](_0xce47('0x78'),encodeURIComponent(_0x3e4a3b)):_0xce47('0x79'));return uploadFile(_0x175df5)[_0xce47('0x22')](function(_0x4ab694){return querystring[_0xce47('0x7a')](_0x4ab694);});};exports[_0xce47('0x7b')]=function(_0x5b6792,_0x3fb0b7){return sestek[_0xce47('0x7c')](_0x5b6792,_0x3fb0b7)[_0xce47('0x22')](function(_0x2d4b91){logger['info'](JSON[_0xce47('0x39')](_0x2d4b91));var _0x25da44={'speech':_0x2d4b91[_0xce47('0x7d')],'action':_0x2d4b91[_0xce47('0x7e')]?_0x2d4b91[_0xce47('0x7e')][_0xce47('0x7f')]:undefined,'actiondata':_0x2d4b91[_0xce47('0x7e')]?_0x2d4b91[_0xce47('0x7e')][_0xce47('0x80')]:undefined};if(_0x2d4b91[_0xce47('0x7e')]&&_0x2d4b91[_0xce47('0x7e')][_0xce47('0x81')]){return base64Decode(_0x2d4b91['channelData'][_0xce47('0x81')][_0xce47('0x82')],path[_0xce47('0x2d')](__dirname,_0xce47('0x2e'),rs[_0xce47('0x1f')](0x4)+_0xce47('0x3f')))[_0xce47('0x22')](function(_0x440d4c){_0x25da44[_0xce47('0x83')]=_0x440d4c;return _0x25da44;});}return _0x25da44;});};exports[_0xce47('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0xf83c=['uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','google-tts-api','url','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','end','protocol','get','transcode','wav','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','resolve','from','writeFile','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr'];(function(_0x45003a,_0x563b74){var _0x4e09f9=function(_0x50cd1e){while(--_0x50cd1e){_0x45003a['push'](_0x45003a['shift']());}};_0x4e09f9(++_0x563b74);}(_0xf83c,0x150));var _0xcf83=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0xf83c[_0x452968];return _0xb6f9ae;};'use strict';var apiai=require(_0xcf83('0x0'));var BPromise=require(_0xcf83('0x1'));var dialogflow=require(_0xcf83('0x2'));var fs=require('fs');var http=require(_0xcf83('0x3'));var https=require(_0xcf83('0x4'));var md5=require(_0xcf83('0x5'));var path=require(_0xcf83('0x6'));var querystring=require(_0xcf83('0x7'));var rp=require('request-promise');var rs=require(_0xcf83('0x8'));var sox=require('sox');var tts=require(_0xcf83('0x9'));var urlParse=require(_0xcf83('0xa'))['parse'];var util=require(_0xcf83('0xb'));var aws=require('./aws');var google=require(_0xcf83('0xc'));var sestek=require(_0xcf83('0xd'));var tilde=require(_0xcf83('0xe'));var logger=require(_0xcf83('0xf'))(_0xcf83('0x10'));var ISPEECH_API=_0xcf83('0x11');function downloadFile(_0x39ae5a,_0x3ec217){return new BPromise(function(_0x33f870,_0x2f3ceb){var _0x300324=urlParse(_0x39ae5a);var _0x23f66f=_0x300324['protocol']===_0xcf83('0x12')?https:http;var _0x45087b={'host':_0x300324['host'],'path':_0x300324[_0xcf83('0x6')],'headers':{'user-agent':_0xcf83('0x13')}};_0x23f66f['get'](_0x45087b,function(_0xc86822){if(_0xc86822[_0xcf83('0x14')]!==0xc8){logger[_0xcf83('0x15')](_0xcf83('0x16')+_0x39ae5a+_0xcf83('0x17')+_0xc86822[_0xcf83('0x14')]+'\x20('+_0xc86822[_0xcf83('0x18')]+')');_0x2f3ceb(new Error(_0xcf83('0x16')+_0x39ae5a+_0xcf83('0x17')+_0xc86822[_0xcf83('0x14')]+'\x20('+_0xc86822[_0xcf83('0x18')]+')'));return;}var _0x30a727=fs[_0xcf83('0x19')](_0x3ec217);_0x30a727['on'](_0xcf83('0x1a'),function(){logger[_0xcf83('0x1b')](_0xcf83('0x1c'));_0x30a727[_0xcf83('0x1d')](_0x33f870);});_0x30a727['on'](_0xcf83('0x15'),function(_0x5343e0){fs['unlink'](_0x3ec217);logger['error'](_0xcf83('0x1e'),_0x5343e0);_0x2f3ceb(_0x5343e0);});_0xc86822['pipe'](_0x30a727);})['on']('error',function(_0xbf1321){logger[_0xcf83('0x15')](_0xbf1321);_0x2f3ceb(_0xbf1321);})[_0xcf83('0x1f')]();});}function uploadFile(_0x4c4183){return new BPromise(function(_0xd4fcc2,_0x317bf1){var _0x3e945e=urlParse(_0x4c4183);var _0x23c56a=_0x3e945e[_0xcf83('0x20')]===_0xcf83('0x12')?https:http;var _0x52df6d={'host':_0x3e945e['host'],'path':_0x3e945e[_0xcf83('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x23c56a[_0xcf83('0x21')](_0x52df6d,function(_0x32fa79){if(_0x32fa79[_0xcf83('0x14')]!==0xc8){_0x317bf1(new Error(_0xcf83('0x16')+_0x4c4183+_0xcf83('0x17')+_0x32fa79['statusCode']+'\x20('+_0x32fa79['statusMessage']+')'));return;}var _0x13e4ec='';_0x32fa79['on']('data',function(_0x2313fb){_0x13e4ec+=_0x2313fb;});_0x32fa79['on']('end',function(){_0xd4fcc2(_0x13e4ec);});})['on']('error',function(_0x2b8d73){_0x317bf1(_0x2b8d73);})[_0xcf83('0x1f')]();});}function convertFile(_0x2a9355,_0x920c1b){return new BPromise(function(_0x1a3d6a,_0x11edbb){var _0x5c1510=sox[_0xcf83('0x22')](_0x2a9355,_0x920c1b,{'sampleRate':0x1f40,'format':_0xcf83('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5c1510['on'](_0xcf83('0x15'),function(_0x3bb433){logger[_0xcf83('0x15')]('error\x20convert',_0x3bb433);_0x11edbb(_0x3bb433);});_0x5c1510['on'](_0xcf83('0x1f'),function(){logger[_0xcf83('0x1b')](_0xcf83('0x24'));_0x1a3d6a();});_0x5c1510[_0xcf83('0x25')]();});}function base64Decode(_0x427804,_0x36cde9){var _0x417db4=path['resolve'](__dirname,_0xcf83('0x26'),rs[_0xcf83('0x27')](0x4)+_0xcf83('0x28'));fs[_0xcf83('0x29')](_0x417db4,_0x427804,_0xcf83('0x2a'));return convertFile(_0x417db4,_0x36cde9)[_0xcf83('0x2b')](function(){try{fs[_0xcf83('0x2c')](_0x417db4);fs[_0xcf83('0x2d')](_0x36cde9,_0xcf83('0x2e'));}catch(_0x561bb1){logger[_0xcf83('0x15')](_0x561bb1);}return _0x36cde9[_0xcf83('0x2f')]('.')[0x0];});}function base64Encode(_0x4fbf80){var _0x143500=fs['readFileSync'](_0x4fbf80);return new Buffer(_0x143500)['toString'](_0xcf83('0x2a'));}exports[_0xcf83('0x30')]=function(_0x16a9be,_0x3d0de7,_0x4dbd19,_0x3b4aee,_0x39f180,_0x1823d0){var _0x2184da,_0x2c878d;var _0x619a2c=_0xcf83('0x31');var _0x516dc6=_0xcf83('0x32')+_0x16a9be;var _0x2c9bd0={};if(_0x3d0de7==='ssml'){_0x2c9bd0[_0xcf83('0x33')]={'ssml':_0x4dbd19};}else{_0x2c9bd0[_0xcf83('0x33')]={'text':_0x4dbd19};};_0x2c9bd0['voice']={'languageCode':_0x3b4aee,'ssmlGender':_0x39f180};_0x2c9bd0[_0xcf83('0x34')]={'audioEncoding':_0xcf83('0x35'),'sampleRateHertz':0x1f40};var _0xb55f07={'url':_0x619a2c+_0xcf83('0x36')+_0x516dc6,'method':_0xcf83('0x37'),'json':!![],'body':_0x2c9bd0};return rp(_0xb55f07)['then'](function(_0x2ed2f9){return new BPromise(function(_0x2f0010,_0xd86ba3){_0x2184da=path[_0xcf83('0x38')](__dirname,'tmp',rs[_0xcf83('0x27')](0x4)+'.mp3');var _0x5bfd89=Buffer[_0xcf83('0x39')](_0x2ed2f9['audioContent'],'base64');return fs[_0xcf83('0x3a')](_0x2184da,_0x5bfd89,function(_0x5f3332){_0xd86ba3(_0x5f3332);},function(_0x31ea9b){fs['chmodSync'](_0x2184da,_0xcf83('0x2e'));_0x2f0010(_0x31ea9b);});});})['then'](function(_0x1aa33b){_0x2c878d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x2184da,_0x2c878d);})[_0xcf83('0x2b')](function(){try{fs[_0xcf83('0x2c')](_0x2184da);fs['chmodSync'](_0x2c878d,'777');}catch(_0x58b659){logger[_0xcf83('0x15')](_0x58b659);}logger[_0xcf83('0x1b')](_0xcf83('0x3b'),_0x2c878d[_0xcf83('0x2f')]('.')[0x0]);return _0x2c878d[_0xcf83('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x1e12a4,_0x253ce8){var _0x1aa0a4='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x530fc2,_0x260901;var _0x1de4e9;var _0x135519={'encoding':_0xcf83('0x3c'),'method':_0xcf83('0x37'),'timeout':0x2710,'url':_0x1aa0a4,'headers':{'Content-Type':_0xcf83('0x3d')},'body':_0xcf83('0x3e')+encodeURIComponent(JSON['stringify']([[[_0xcf83('0x3f'),JSON[_0xcf83('0x40')]([_0x1e12a4,_0x253ce8||'en',![],_0xcf83('0x41')]),null,'generic']]]))};return rp(_0x135519)['then'](function(_0x4ea4fb){try{_0x1de4e9=eval(_0x4ea4fb['slice'](0x5))[0x0][0x2];}catch(_0x5dd388){throw new Error(_0xcf83('0x42')+_0x4ea4fb[_0xcf83('0x43')]);}if(!_0x1de4e9){if(_0x1e12a4[_0xcf83('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xcf83('0x45')+_0x253ce8+_0xcf83('0x46'));}}try{_0x1de4e9=eval(_0x1de4e9)[0x0];}catch(_0x1f94eb){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x149d19=_0x1de4e9;_0x530fc2=path[_0xcf83('0x38')](__dirname,_0xcf83('0x26'),rs[_0xcf83('0x27')](0x4)+_0xcf83('0x47'));fs[_0xcf83('0x29')](_0x530fc2,_0x1de4e9,{'encoding':_0xcf83('0x2a')});_0x260901=path[_0xcf83('0x38')](__dirname,'tmp',rs[_0xcf83('0x27')](0x4)+_0xcf83('0x28'));return convertFile(_0x530fc2,_0x260901);})[_0xcf83('0x2b')](function(){try{fs['unlink'](_0x530fc2);fs[_0xcf83('0x2d')](_0x260901,_0xcf83('0x2e'));}catch(_0x34e9de){logger[_0xcf83('0x15')](_0x34e9de);}logger[_0xcf83('0x1b')](_0xcf83('0x48'),_0x260901[_0xcf83('0x2f')]('.')[0x0]);return _0x260901[_0xcf83('0x2f')]('.')[0x0];});};exports[_0xcf83('0x49')]=function(_0x58101c,_0x2e8424,_0x5bc076){return google[_0xcf83('0x4a')](_0x58101c,_0x2e8424,_0x5bc076)['then'](function(_0x5bd066){logger[_0xcf83('0x1b')](_0x5bd066[_0xcf83('0x4b')]);return rp(_0x5bd066);})[_0xcf83('0x2b')](function(_0x161a9c){var _0x5de0c7='';var _0x27bdff=0x0;try{fs[_0xcf83('0x2c')](_0x58101c);}catch(_0x243caa){logger[_0xcf83('0x15')](_0x243caa);}if(_0x161a9c&&_0x161a9c['results']){_0x5de0c7=_0x161a9c[_0xcf83('0x4c')][_0xcf83('0x4d')](function(_0xfff178){return _0xfff178&&_0xfff178[_0xcf83('0x4e')][0x0]&&_0xfff178[_0xcf83('0x4e')][0x0][_0xcf83('0x4f')]?_0xfff178[_0xcf83('0x4e')][0x0][_0xcf83('0x4f')]:'';})['join']('\x0a');_0x27bdff=_0x161a9c[_0xcf83('0x4c')][_0xcf83('0x4d')](function(_0x46d7d9){return _0x46d7d9&&_0x46d7d9[_0xcf83('0x4e')][0x0]&&_0x46d7d9[_0xcf83('0x4e')][0x0][_0xcf83('0x50')]?_0x46d7d9[_0xcf83('0x4e')][0x0][_0xcf83('0x50')]:0x0;})[_0xcf83('0x51')]('\x0a');}logger[_0xcf83('0x1b')]('googleASR\x20transcription',_0x5de0c7);logger[_0xcf83('0x1b')](_0xcf83('0x52'),_0x27bdff);return{'transcript':_0x5de0c7,'confidence':_0x27bdff};})['catch'](function(_0x3b55e4){logger[_0xcf83('0x15')](_0xcf83('0x53'),_0x3b55e4[_0xcf83('0x14')],_0x3b55e4['name'],_0x3b55e4[_0xcf83('0x54')]);});};exports[_0xcf83('0x55')]=function(_0x568b26,_0x46216c,_0x3ceed3,_0x13f26f){var _0x1d2118=apiai(_0x46216c,{'language':_0x13f26f||'en'});return _0x1d2118[_0xcf83('0x56')](_0x3ceed3,{'sessionId':md5(_0x568b26)})['then'](function(_0x3c3fdf){logger['info'](JSON['stringify'](_0x3c3fdf));return{'source':_0x3c3fdf[_0xcf83('0x57')][_0xcf83('0x58')],'resolvedQuery':_0x3c3fdf[_0xcf83('0x57')][_0xcf83('0x59')],'action':_0x3c3fdf[_0xcf83('0x57')][_0xcf83('0x5a')],'actionIncomplete':_0x3c3fdf[_0xcf83('0x57')][_0xcf83('0x5b')],'speech':_0x3c3fdf['result'][_0xcf83('0x5c')][_0xcf83('0x5d')],'score':_0x3c3fdf[_0xcf83('0x57')]['score'],'statusCode':_0x3c3fdf['status'][_0xcf83('0x5e')],'endConversation':_0x3c3fdf['result'][_0xcf83('0x5f')][_0xcf83('0x60')]||![],'isFallbackIntent':_0x3c3fdf['result'][_0xcf83('0x5f')][_0xcf83('0x61')]};});};exports[_0xcf83('0x62')]=function(_0x2cfb5d,_0x304de0,_0x40f0ea,_0x29b7aa,_0x394da8,_0x2576f2){var _0x154666=_0x29b7aa[_0xcf83('0x63')](/\\n/g,'\x0a');var _0x440f7f={'credentials':{'private_key':_0x154666,'client_email':_0x40f0ea}};var _0x2569fc=new dialogflow[(_0xcf83('0x64'))](_0x440f7f);var _0x39c892=_0x2569fc[_0xcf83('0x65')](_0x304de0,md5(_0x2cfb5d));var _0xe99a41={'session':_0x39c892,'queryInput':{'text':{'text':_0x394da8,'languageCode':_0x2576f2}}};return _0x2569fc['detectIntent'](_0xe99a41)['then'](function(_0x2eee72){if(_0x2eee72&&_0x2eee72[_0xcf83('0x44')]){logger[_0xcf83('0x1b')](_0xcf83('0x66'),JSON[_0xcf83('0x40')](_0x2eee72));var _0x56d641=_0x2eee72[0x0];if(_0x56d641){var _0x28b8da={'action':_0x56d641['queryResult'][_0xcf83('0x5a')],'allRequiredParamsPresent':_0x56d641[_0xcf83('0x67')][_0xcf83('0x68')],'endConversation':_0x56d641[_0xcf83('0x67')][_0xcf83('0x69')]&&_0x56d641[_0xcf83('0x67')][_0xcf83('0x69')]['fields']?_0x56d641[_0xcf83('0x67')]['diagnosticInfo'][_0xcf83('0x6a')][_0xcf83('0x6b')][_0xcf83('0x6c')]:![],'fulfillmentText':_0x56d641[_0xcf83('0x67')][_0xcf83('0x6d')],'intentName':_0x56d641['queryResult'][_0xcf83('0x6e')][_0xcf83('0x6f')],'intentDisplayName':_0x56d641[_0xcf83('0x67')][_0xcf83('0x6e')][_0xcf83('0x70')],'isFallbackIntent':_0x56d641['queryResult'][_0xcf83('0x6e')][_0xcf83('0x71')],'languageCode':_0x56d641['queryResult'][_0xcf83('0x72')],'queryText':_0x56d641[_0xcf83('0x67')][_0xcf83('0x73')],'responseId':_0x56d641[_0xcf83('0x74')],'score':_0x56d641[_0xcf83('0x67')][_0xcf83('0x75')],'speech':_0x56d641[_0xcf83('0x67')][_0xcf83('0x6d')],'providerResponse':JSON['stringify'](_0x2eee72)};return _0x28b8da;}}});};exports['tildeASR']=function(_0x2a14ad,_0x377373,_0x2312a2,_0x32cff6){return tilde[_0xcf83('0x4a')](_0x2a14ad,_0x377373,_0x2312a2,_0x32cff6)[_0xcf83('0x2b')](function(_0x7991f4){try{fs['unlink'](_0x2a14ad);}catch(_0x6d30c5){logger['error'](_0x6d30c5);}logger[_0xcf83('0x1b')](_0xcf83('0x76'),_0x7991f4[_0xcf83('0x4f')]);logger[_0xcf83('0x1b')](_0xcf83('0x77'),_0x7991f4[_0xcf83('0x50')]);return _0x7991f4;});};exports[_0xcf83('0x78')]=function(_0x449aff,_0x55a966,_0x551be8,_0x191471,_0x5db6ab,_0x42c7a3){var _0x260935=path[_0xcf83('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0xcf83('0x47'));var _0x3ab249;return aws['polly'](_0x449aff,_0x55a966,_0x551be8,_0x191471,_0x5db6ab,_0x42c7a3,_0x260935)[_0xcf83('0x2b')](function(){_0x3ab249=path[_0xcf83('0x38')](__dirname,_0xcf83('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x260935,_0x3ab249);})[_0xcf83('0x2b')](function(){try{fs[_0xcf83('0x2c')](_0x260935);fs['chmodSync'](_0x3ab249,_0xcf83('0x2e'));}catch(_0x15cdc5){logger[_0xcf83('0x15')](_0x15cdc5);}return _0x3ab249['split']('.')[0x0];});};exports[_0xcf83('0x79')]=function(_0x1a0d8c,_0x51d399,_0x2da16f,_0xf1bc40,_0x3f04c8,_0x4c8dcb){return aws[_0xcf83('0x7a')](_0x1a0d8c,_0x51d399,_0x2da16f,_0xf1bc40,_0x3f04c8,_0x4c8dcb)[_0xcf83('0x2b')](function(_0x43893e){logger[_0xcf83('0x1b')](JSON[_0xcf83('0x40')](_0x43893e));return _0x43893e;});};exports['ispeechTTS']=function(_0x233476,_0x39456a,_0x40ecba,_0x420b06){var _0x557774=util[_0xcf83('0x7b')](_0xcf83('0x7c'),ISPEECH_API,_0x233476,encodeURIComponent(_0x39456a),_0x40ecba,_0x420b06);var _0x242fea=path[_0xcf83('0x38')](__dirname,'tmp',rs[_0xcf83('0x27')](0x4)+_0xcf83('0x47'));var _0x1187c3;return downloadFile(_0x557774,_0x242fea)[_0xcf83('0x2b')](function(){_0x1187c3=path[_0xcf83('0x38')](__dirname,_0xcf83('0x26'),rs[_0xcf83('0x27')](0x4)+_0xcf83('0x28'));return convertFile(_0x242fea,_0x1187c3);})[_0xcf83('0x2b')](function(){try{fs['unlink'](_0x242fea);fs['chmodSync'](_0x1187c3,_0xcf83('0x2e'));}catch(_0x75850){logger[_0xcf83('0x15')](_0x75850);}return _0x1187c3['split']('.')[0x0];});};exports[_0xcf83('0x7d')]=function(_0x5c9194,_0x48ca5e,_0x2e4e22,_0x4b675e){var _0x1aa47b=util['format'](_0xcf83('0x7e'),ISPEECH_API,_0x48ca5e,_0x2e4e22,base64Encode(_0x5c9194),_0x4b675e?util[_0xcf83('0x7b')](_0xcf83('0x7f'),encodeURIComponent(_0x4b675e)):_0xcf83('0x80'));return uploadFile(_0x1aa47b)[_0xcf83('0x2b')](function(_0x17c2a4){return querystring[_0xcf83('0x81')](_0x17c2a4);});};exports['sestekNDA']=function(_0x28165b,_0x512207){return sestek['nda'](_0x28165b,_0x512207)['then'](function(_0x282723){logger[_0xcf83('0x1b')](JSON[_0xcf83('0x40')](_0x282723));var _0x11f2b8={'speech':_0x282723[_0xcf83('0x82')],'action':_0x282723[_0xcf83('0x83')]?_0x282723[_0xcf83('0x83')][_0xcf83('0x84')]:undefined,'actiondata':_0x282723[_0xcf83('0x83')]?_0x282723[_0xcf83('0x83')][_0xcf83('0x85')]:undefined};if(_0x282723[_0xcf83('0x83')]&&_0x282723['channelData']['AudioFromTts']){return base64Decode(_0x282723[_0xcf83('0x83')][_0xcf83('0x86')][_0xcf83('0x87')],path[_0xcf83('0x38')](__dirname,'tmp',rs[_0xcf83('0x27')](0x4)+_0xcf83('0x28')))[_0xcf83('0x2b')](function(_0x54d2a0){_0x11f2b8['audiofile']=_0x54d2a0;return _0x11f2b8;});}return _0x11f2b8;});};exports[_0xcf83('0x88')]=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 761c08f..ab623c9 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 _0x358d=['exports','./nda'];(function(_0x41c8aa,_0x444dd3){var _0x16b761=function(_0x93a04){while(--_0x93a04){_0x41c8aa['push'](_0x41c8aa['shift']());}};_0x16b761(++_0x444dd3);}(_0x358d,0xd9));var _0xd358=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x358d[_0x3616bb];return _0x1c0994;};var nda=require(_0xd358('0x0'));module[_0xd358('0x1')]={'nda':nda}; \ No newline at end of file +var _0x456d=['./nda'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x456d,0x1d4));var _0xd456=function(_0x4af5cd,_0x22abee){_0x4af5cd=_0x4af5cd-0x0;var _0x56ae09=_0x456d[_0x4af5cd];return _0x56ae09;};var nda=require(_0xd456('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index d146f21..dbbda2b 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 _0xb9a7=['text','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','url','POST','resolve','ndauth_url','/token','password','username','then','message','Nda','callerid','dnid'];(function(_0x281180,_0x4a7cda){var _0x183311=function(_0x2ea813){while(--_0x2ea813){_0x281180['push'](_0x281180['shift']());}};_0x183311(++_0x4a7cda);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb9a7[_0x4b055c];return _0x4b62bb;};'use strict';var rp=require('request-promise');var url=require(_0x7b9a('0x0'));var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x4278a1,_0x559be2){var _0x1396ec={'method':_0x7b9a('0x1'),'uri':url[_0x7b9a('0x2')](_0x559be2[_0x7b9a('0x3')],_0x7b9a('0x4')),'form':{'grant_type':_0x7b9a('0x5'),'username':_0x559be2[_0x7b9a('0x6')],'password':_0x559be2[_0x7b9a('0x5')]},'json':!![]};return rp(_0x1396ec)[_0x7b9a('0x7')](function(_0x3e51f0){var _0x4d3f20={'method':_0x7b9a('0x1'),'uri':url[_0x7b9a('0x2')](_0x559be2['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x559be2['ndaactivity_type']||_0x7b9a('0x8'),'channelId':_0x7b9a('0x9'),'conversation':{'id':_0x4278a1['uniqueid']},'from':{'id':_0x4278a1[_0x7b9a('0xa')],'name':_0x4278a1['calleridname']},'recipient':{'id':_0x4278a1[_0x7b9a('0xb')],'name':_0x4278a1['extension']},'text':_0x559be2[_0x7b9a('0xc')],'channelData':{}},'headers':{'Authorization':_0x7b9a('0xd')+_0x3e51f0[_0x7b9a('0xe')]},'json':!![]};if(_0x559be2['project']){_0x4d3f20[_0x7b9a('0xf')][_0x7b9a('0x10')]['ProjectName']=_0x559be2[_0x7b9a('0x11')];}if(_0x559be2[_0x7b9a('0x12')]=='1'){_0x4d3f20['body'][_0x7b9a('0x10')][_0x7b9a('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7b9a('0x14')};}if(_0x559be2[_0x7b9a('0x15')]){_0x4d3f20[_0x7b9a('0xf')][_0x7b9a('0x10')][_0x7b9a('0x16')]=_0x559be2[_0x7b9a('0x15')];if(_0x559be2[_0x7b9a('0x17')]){_0x4d3f20['body'][_0x7b9a('0x10')]['CustomActionData']=_0x559be2[_0x7b9a('0x17')];}}logger[_0x7b9a('0x18')](JSON[_0x7b9a('0x19')](_0x4d3f20));return rp(_0x4d3f20);});}; \ No newline at end of file +var _0x5ebe=['exports','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ndagenerate_audio','audio/wav','custom_action','custom_action_data','stringify','url','../../../../../config/logger','agi'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ebe,0x69));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var rp=require('request-promise');var url=require(_0xe5eb('0x0'));var logger=require(_0xe5eb('0x1'))(_0xe5eb('0x2'));module[_0xe5eb('0x3')]=function(_0x1f85f8,_0x3912d6){var _0x4aa14d={'method':'POST','uri':url[_0xe5eb('0x4')](_0x3912d6[_0xe5eb('0x5')],_0xe5eb('0x6')),'form':{'grant_type':_0xe5eb('0x7'),'username':_0x3912d6[_0xe5eb('0x8')],'password':_0x3912d6[_0xe5eb('0x7')]},'json':!![]};return rp(_0x4aa14d)[_0xe5eb('0x9')](function(_0x1acd9d){var _0x5158f0={'method':'POST','uri':url['resolve'](_0x3912d6['ndassistant_url'],_0xe5eb('0xa')),'body':{'type':_0x3912d6['ndaactivity_type']||_0xe5eb('0xb'),'channelId':_0xe5eb('0xc'),'conversation':{'id':_0x1f85f8[_0xe5eb('0xd')]},'from':{'id':_0x1f85f8['callerid'],'name':_0x1f85f8[_0xe5eb('0xe')]},'recipient':{'id':_0x1f85f8[_0xe5eb('0xf')],'name':_0x1f85f8[_0xe5eb('0x10')]},'text':_0x3912d6[_0xe5eb('0x11')],'channelData':{}},'headers':{'Authorization':_0xe5eb('0x12')+_0x1acd9d['access_token']},'json':!![]};if(_0x3912d6[_0xe5eb('0x13')]){_0x5158f0[_0xe5eb('0x14')][_0xe5eb('0x15')]['ProjectName']=_0x3912d6['project'];}if(_0x3912d6[_0xe5eb('0x16')]=='1'){_0x5158f0[_0xe5eb('0x14')][_0xe5eb('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe5eb('0x17')};}if(_0x3912d6[_0xe5eb('0x18')]){_0x5158f0['body'][_0xe5eb('0x15')]['CustomAction']=_0x3912d6['custom_action'];if(_0x3912d6['custom_action_data']){_0x5158f0[_0xe5eb('0x14')][_0xe5eb('0x15')]['CustomActionData']=_0x3912d6[_0xe5eb('0x19')];}}logger['info'](JSON[_0xe5eb('0x1a')](_0x5158f0));return rp(_0x5158f0);});}; \ 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 afb874e..e77e528 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 _0xa21e=['./lib/api','exports'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xa21e,0x166));var _0xea21=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa21e[_0x2aea9e];return _0x430b92;};'use strict';var asr=require(_0xea21('0x0'));module[_0xea21('0x1')]=function(_0x19c11d,_0x4d8f35,_0x78ed7b,_0x390a44){return asr(_0x19c11d,_0x4d8f35,_0x78ed7b,_0x390a44);}; \ No newline at end of file +var _0xe30d=['exports','./lib/api'];(function(_0x15cd42,_0x179ac7){var _0x5d9b6e=function(_0x28ae58){while(--_0x28ae58){_0x15cd42['push'](_0x15cd42['shift']());}};_0x5d9b6e(++_0x179ac7);}(_0xe30d,0x13b));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xde30('0x0'));module[_0xde30('0x1')]=function(_0x3eaf8a,_0x5501a1,_0x470a7e,_0x1f3aba){return asr(_0x3eaf8a,_0x5501a1,_0x470a7e,_0x1f3aba);}; \ 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 257bcdb..4b0ac5d 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 _0x17c5=['unix','stringify','createReadStream','data','close','send','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0xc501b0,_0x46a0e7){var _0x3c9941=function(_0xaaf8be){while(--_0xaaf8be){_0xc501b0['push'](_0xc501b0['shift']());}};_0x3c9941(++_0x46a0e7);}(_0x17c5,0x134));var _0x517c=function(_0x11f706,_0x7e59d6){_0x11f706=_0x11f706-0x0;var _0x43c630=_0x17c5[_0x11f706];return _0x43c630;};'use strict';var BPromise=require(_0x517c('0x0'));var _=require(_0x517c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x517c('0x2'));var logger=require(_0x517c('0x3'))(_0x517c('0x4'));module[_0x517c('0x5')]=function(_0x5253ec,_0x59f925,_0x5a33d2,_0x16e840){return new BPromise(function(_0x19dc0a,_0x1ca7a7){logger['info']('Tilde\x20URI',_0x16e840||_0x517c('0x6'));var _0x4f2330=new WebSocket(_0x16e840||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x444713='';var _0x527714='0';var _0x143357='1';var _0x5263ef=_0x517c('0x7');function _0x36ae33(_0x44a53c){var _0x47c881=crypto['createHash'](_0x517c('0x8'));_0x47c881[_0x517c('0x9')](_0x44a53c);return _0x47c881['digest'](_0x517c('0xa'));}function _0x3923fe(){try{logger['info'](_0x517c('0xb'));var _0x745c27=moment()[_0x517c('0xc')]();var _0x443863=_0x36ae33(_0x745c27+_0x59f925+_0x5a33d2);_0x4f2330['send'](JSON[_0x517c('0xd')]({'appID':_0x59f925,'timestamp':_0x745c27,'appKey':_0x443863}));var _0x37cf85=fs[_0x517c('0xe')](_0x5253ec);_0x37cf85['on'](_0x517c('0xf'),function(_0x305087){_0x4f2330['send'](_0x305087);});_0x37cf85['on'](_0x517c('0x10'),function(){_0x4f2330[_0x517c('0x11')]('EOS');});}catch(_0x19a9cc){logger[_0x517c('0x12')](_0x517c('0x13'),JSON[_0x517c('0xd')](_0x19a9cc));_0x4f2330[_0x517c('0x14')]();}}function _0x2a0784(_0x3f254c){try{if(_0x3f254c){var _0x492380=JSON['parse'](_0x3f254c);switch(_0x492380[_0x517c('0x15')]){case 0x0:if(_0x492380[_0x517c('0x16')]){if(_0x492380[_0x517c('0x16')][_0x517c('0x17')]){logger[_0x517c('0x18')](_0x517c('0x19'),JSON['stringify'](_0x492380[_0x517c('0x16')][_0x517c('0x1a')]));_0x444713=_0x492380[_0x517c('0x16')][_0x517c('0x1a')][0x0]['transcript'];_0x527714=_0x492380[_0x517c('0x16')][_0x517c('0x1a')][0x0][_0x517c('0x1b')];_0x143357='0';_0x5263ef=_0x517c('0x1c');_0x4f2330[_0x517c('0x14')]();}}break;case 0x1:logger[_0x517c('0x18')](_0x517c('0x7'));_0x143357='1';_0x5263ef=_0x517c('0x7');break;case 0x2:logger[_0x517c('0x18')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x143357='2';_0x5263ef=_0x517c('0x1d');break;case 0x9:logger[_0x517c('0x18')](_0x517c('0x1e'));_0x143357='9';_0x5263ef=_0x517c('0x1e');break;case 0xa:logger['info'](_0x517c('0x1f'));_0x143357='10';_0x5263ef=_0x517c('0x1f');break;case 0xb:logger[_0x517c('0x18')](_0x517c('0x20'));_0x143357='11';_0x5263ef='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5e2a09){logger[_0x517c('0x12')](_0x517c('0x21'),JSON[_0x517c('0xd')](_0x5e2a09));_0x4f2330[_0x517c('0x14')]();}}function _0x4d5281(){logger[_0x517c('0x18')](_0x517c('0x22'));_0x19dc0a({'transcript':_0x444713,'confidence':_0x527714,'status':_0x143357,'status_message':_0x5263ef});}function _0x5b2fcf(_0x41fb45){logger['error'](_0x517c('0x23'));if(!_[_0x517c('0x24')](_0x41fb45)){logger[_0x517c('0x12')](_[_0x517c('0x25')](_0x41fb45)?JSON['stringify'](_0x41fb45):_0x41fb45);}}_0x4f2330['on'](_0x517c('0x26'),_0x3923fe);_0x4f2330['on'](_0x517c('0x27'),_0x2a0784);_0x4f2330['on'](_0x517c('0x10'),_0x4d5281);_0x4f2330['on'](_0x517c('0x12'),_0x5b2fcf);});}; \ No newline at end of file +var _0xe39a=['agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','moment','../../../../../../config/logger'];(function(_0x26160d,_0x4b16e1){var _0x10ec15=function(_0x4b09d7){while(--_0x4b09d7){_0x26160d['push'](_0x26160d['shift']());}};_0x10ec15(++_0x4b16e1);}(_0xe39a,0xe8));var _0xae39=function(_0x9e81e6,_0x5ecac7){_0x9e81e6=_0x9e81e6-0x0;var _0x415212=_0xe39a[_0x9e81e6];return _0x415212;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xae39('0x0'));var crypto=require('crypto');var logger=require(_0xae39('0x1'))(_0xae39('0x2'));module[_0xae39('0x3')]=function(_0x1cc972,_0x57a0a5,_0x561b7a,_0x2f6f42){return new BPromise(function(_0x25c136,_0xdc6bf9){logger[_0xae39('0x4')](_0xae39('0x5'),_0x2f6f42||_0xae39('0x6'));var _0x3471df=new WebSocket(_0x2f6f42||_0xae39('0x6'),{'perMessageDeflate':![]});var _0x44c2be='';var _0x1a6d73='0';var _0x5f4f19='1';var _0xb9fc3a=_0xae39('0x7');function _0x2226ee(_0x2116a0){var _0x2c20c5=crypto[_0xae39('0x8')](_0xae39('0x9'));_0x2c20c5['update'](_0x2116a0);return _0x2c20c5[_0xae39('0xa')]('hex');}function _0x30eff1(){try{logger[_0xae39('0x4')](_0xae39('0xb'));var _0x42820=moment()[_0xae39('0xc')]();var _0x5c0a89=_0x2226ee(_0x42820+_0x57a0a5+_0x561b7a);_0x3471df[_0xae39('0xd')](JSON[_0xae39('0xe')]({'appID':_0x57a0a5,'timestamp':_0x42820,'appKey':_0x5c0a89}));var _0x72d2b=fs['createReadStream'](_0x1cc972);_0x72d2b['on'](_0xae39('0xf'),function(_0x556df6){_0x3471df[_0xae39('0xd')](_0x556df6);});_0x72d2b['on']('close',function(){_0x3471df['send'](_0xae39('0x10'));});}catch(_0x351bc5){logger[_0xae39('0x11')](_0xae39('0x12'),JSON[_0xae39('0xe')](_0x351bc5));_0x3471df[_0xae39('0x13')]();}}function _0x1c774e(_0x46cc5c){try{if(_0x46cc5c){var _0x75e7c3=JSON[_0xae39('0x14')](_0x46cc5c);switch(_0x75e7c3[_0xae39('0x15')]){case 0x0:if(_0x75e7c3[_0xae39('0x16')]){if(_0x75e7c3[_0xae39('0x16')][_0xae39('0x17')]){logger['info'](_0xae39('0x18'),JSON['stringify'](_0x75e7c3[_0xae39('0x16')][_0xae39('0x19')]));_0x44c2be=_0x75e7c3[_0xae39('0x16')]['hypotheses'][0x0][_0xae39('0x1a')];_0x1a6d73=_0x75e7c3[_0xae39('0x16')][_0xae39('0x19')][0x0][_0xae39('0x1b')];_0x5f4f19='0';_0xb9fc3a=_0xae39('0x1c');_0x3471df[_0xae39('0x13')]();}}break;case 0x1:logger[_0xae39('0x4')](_0xae39('0x7'));_0x5f4f19='1';_0xb9fc3a=_0xae39('0x7');break;case 0x2:logger['info'](_0xae39('0x1d'));_0x5f4f19='2';_0xb9fc3a='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xae39('0x4')](_0xae39('0x1e'));_0x5f4f19='9';_0xb9fc3a=_0xae39('0x1e');break;case 0xa:logger['info'](_0xae39('0x1f'));_0x5f4f19='10';_0xb9fc3a=_0xae39('0x1f');break;case 0xb:logger[_0xae39('0x4')](_0xae39('0x20'));_0x5f4f19='11';_0xb9fc3a=_0xae39('0x20');}}}catch(_0x3d48b1){logger[_0xae39('0x11')](_0xae39('0x21'),JSON[_0xae39('0xe')](_0x3d48b1));_0x3471df[_0xae39('0x13')]();}}function _0x10044a(){logger[_0xae39('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x25c136({'transcript':_0x44c2be,'confidence':_0x1a6d73,'status':_0x5f4f19,'status_message':_0xb9fc3a});}function _0x3af1fe(_0x16044b){logger['error'](_0xae39('0x22'));if(!_[_0xae39('0x23')](_0x16044b)){logger[_0xae39('0x11')](_[_0xae39('0x24')](_0x16044b)?JSON[_0xae39('0xe')](_0x16044b):_0x16044b);}}_0x3471df['on']('open',_0x30eff1);_0x3471df['on'](_0xae39('0x25'),_0x1c774e);_0x3471df['on'](_0xae39('0x26'),_0x10044a);_0x3471df['on']('error',_0x3af1fe);});}; \ 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 aac2bb3..f3739b2 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 _0x539e=['exports','./asr'];(function(_0x44cc65,_0x17e1ef){var _0x1f57dd=function(_0x5cf2cf){while(--_0x5cf2cf){_0x44cc65['push'](_0x44cc65['shift']());}};_0x1f57dd(++_0x17e1ef);}(_0x539e,0x13f));var _0xe539=function(_0x545262,_0x37382a){_0x545262=_0x545262-0x0;var _0x368866=_0x539e[_0x545262];return _0x368866;};var asr=require(_0xe539('0x0'));module[_0xe539('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe8a1=['exports','./asr'];(function(_0x441678,_0x4cdd69){var _0xbf89c3=function(_0x4c92f9){while(--_0x4c92f9){_0x441678['push'](_0x441678['shift']());}};_0xbf89c3(++_0x4cdd69);}(_0xe8a1,0x7f));var _0x1e8a=function(_0x4c1f8,_0x5220fa){_0x4c1f8=_0x4c1f8-0x0;var _0x2e710b=_0xe8a1[_0x4c1f8];return _0x2e710b;};var asr=require(_0x1e8a('0x0'));module[_0x1e8a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a0c926f..0a45cf5 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 39edbf1..0f51915 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 _0x08d9=['Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','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','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','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','wav','%s/recordings/%s','beep','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','NOBEEP','recordFile','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','no\x20key\x20configured','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','failure','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','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','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','no\x20subproject\x20selected','getSquareProject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','host','127.0.0.1','AGI','system','shellCommand','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','shelljs','randomstring','moment','mustache','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','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','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','extension','priority','file','createCmContact','isEmpty','callback_','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','internal','LOCAL','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','result','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','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','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','bot','createSquareMessage','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url'];(function(_0xd14ea2,_0x407488){var _0x9527a3=function(_0x3e53d3){while(--_0x3e53d3){_0xd14ea2['push'](_0xd14ea2['shift']());}};_0x9527a3(++_0x407488);}(_0x08d9,0xc2));var _0x908d=function(_0x54f220,_0x31abcd){_0x54f220=_0x54f220-0x0;var _0x55073b=_0x08d9[_0x54f220];return _0x55073b;};'use strict';var fs=require('fs');var util=require(_0x908d('0x0'));var _=require('lodash');var sh=require(_0x908d('0x1'));var odbc=require('odbc')();var rs=require(_0x908d('0x2'));var moment=require(_0x908d('0x3'));var Mustache=require(_0x908d('0x4'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x908d('0x5'));var config=require(_0x908d('0x6'));var scripts=require(_0x908d('0x7'));var FILES_PATH=_0x908d('0x8');var recursiveMapAttributes=[_0x908d('0x9'),'rawBody'];var verticesWithRetry=[_0x908d('0xa'),_0x908d('0xb'),_0x908d('0xc')];var AGIVertices=function(_0x2b5bad,_0x30bbd6,_0x44b888){this[_0x908d('0xd')]=_0x2b5bad;this[_0x908d('0xe')]=_0x30bbd6;this[_0x908d('0xf')]=_0x44b888;};AGIVertices[_0x908d('0x10')]['getVariable']=function(_0x938950,_0x1a1666){this[_0x908d('0xe')][_0x908d('0x11')](_0x938950)[_0x908d('0x12')](function(_0x4ecbf7){_0x1a1666(null,_0x4ecbf7?_0x4ecbf7['name']:![]);})['catch'](function(_0x3213df){_0x1a1666(_0x3213df);});};AGIVertices[_0x908d('0x10')][_0x908d('0x13')]=function(_0x23d6c8,_0x2e1a77){this[_0x908d('0xe')][_0x908d('0x14')](_0x23d6c8)['then'](function(_0x508b2e){_0x2e1a77(null,_0x508b2e?_0x508b2e[_0x908d('0x15')]:![]);})[_0x908d('0x16')](function(_0x178809){_0x2e1a77(_0x178809);});};AGIVertices[_0x908d('0x10')]['getSquareProject']=function(_0x4c56f2,_0x16895a){this[_0x908d('0xe')][_0x908d('0x17')](_0x4c56f2)[_0x908d('0x12')](function(_0x4cc9ba){_0x16895a(null,_0x4cc9ba?_0x4cc9ba[_0x908d('0x15')]:![]);})[_0x908d('0x16')](function(_0x3dea46){_0x16895a(_0x3dea46);});};AGIVertices[_0x908d('0x10')][_0x908d('0x18')]=function(_0x1c3d3c,_0x10137f){this['rpc'][_0x908d('0x19')](_0x1c3d3c)[_0x908d('0x12')](function(_0x46dd69){_0x10137f(null,_0x46dd69?_0x46dd69['dsn']:![]);})[_0x908d('0x16')](function(_0x126eaa){_0x10137f(_0x126eaa);});};AGIVertices[_0x908d('0x10')][_0x908d('0x1a')]=function(_0x3969d7,_0x53d9bb){this[_0x908d('0xe')]['getUserById'](_0x3969d7)[_0x908d('0x12')](function(_0x10148){_0x53d9bb(null,_0x10148?_0x10148[_0x908d('0x15')]:![]);})[_0x908d('0x16')](function(_0x43492b){_0x53d9bb(_0x43492b);});};AGIVertices[_0x908d('0x10')][_0x908d('0x1b')]=function(_0x3c68e0,_0x509105){this[_0x908d('0xe')][_0x908d('0x1c')](_0x3c68e0)[_0x908d('0x12')](function(_0x269e36){_0x509105(null,_0x269e36?_0x269e36[_0x908d('0x15')]:![]);})['catch'](function(_0x5cd721){_0x509105(_0x5cd721);});};AGIVertices[_0x908d('0x10')][_0x908d('0x1d')]=function(_0x41ca76,_0x40e8bc){var _0x35e70d=this;this['rpc'][_0x908d('0x1e')](_0x41ca76)[_0x908d('0x12')](function(_0x5f529e){_0x40e8bc(null,_0x5f529e?_0x35e70d[_0x908d('0x1f')](_0x5f529e[_0x908d('0x20')]):![]);})[_0x908d('0x16')](function(_0x44b7a5){_0x40e8bc(_0x44b7a5);});};AGIVertices[_0x908d('0x10')][_0x908d('0x21')]=function(_0x29418b,_0x7a0d41){this[_0x908d('0xe')][_0x908d('0x22')](_0x29418b)[_0x908d('0x12')](function(_0x4828e4){_0x7a0d41(null,_0x4828e4?_0x4828e4:![]);})[_0x908d('0x16')](function(_0x2f00ff){_0x7a0d41(_0x2f00ff);});};AGIVertices[_0x908d('0x10')][_0x908d('0x23')]=function(_0x4e44b6,_0x28f130,_0x22e8dd){this[_0x908d('0xf')][_0x908d('0x23')](_0x4e44b6,_0x28f130)[_0x908d('0x12')](function(){_0x22e8dd(null);})[_0x908d('0x16')](function(_0x235203){_0x22e8dd(_0x235203);});};AGIVertices[_0x908d('0x10')][_0x908d('0x24')]=function(_0x3890da,_0xe49bb8){this['rpc']['getIntervalById'](_0x3890da)[_0x908d('0x12')](function(_0x9eb272){if(_0x9eb272){if(_0x9eb272['IntervalId']){_0xe49bb8(null,[_0x9eb272['interval']]);}else{_0xe49bb8(null,_[_0x908d('0x25')](_0x9eb272[_0x908d('0x26')],_0x908d('0x27')));}}else{_0xe49bb8(null,![]);}})[_0x908d('0x16')](function(_0x1ebb8f){_0xe49bb8(_0x1ebb8f);});};AGIVertices['prototype'][_0x908d('0x1f')]=function(_0x17cbee){return util[_0x908d('0x28')](_0x908d('0x29'),FILES_PATH,_0x17cbee);};AGIVertices[_0x908d('0x10')]['getQueryOdbc']=function(_0x5e626e,_0x1a3b7d,_0x522ef1){odbc[_0x908d('0x2a')](_0x5e626e,function(_0x28768b){if(_0x28768b){logger[_0x908d('0x2b')](_0x908d('0x2c'),_0x28768b);_0x522ef1(_0x28768b);}else{logger[_0x908d('0x2d')](_0x908d('0x2e'));odbc[_0x908d('0x2f')](_0x1a3b7d,function(_0x2f8216,_0x47e985){if(_0x2f8216){logger['info'](_0x908d('0x30'),_0x1a3b7d);_0x522ef1(_0x2f8216);}else{logger[_0x908d('0x2d')](_0x908d('0x31'),_0x1a3b7d);odbc['close'](function(_0x48544e){if(_0x48544e){logger['error'](_0x908d('0x32'),_0x48544e);}_0x522ef1(null,_0x47e985);});}});}});};AGIVertices['prototype'][_0x908d('0x33')]=function(_0x10667b,_0x1dd840){this['rpc']['getSmsAccountById'](_0x10667b)['then'](function(_0x1c14fb){_0x1dd840(null,_0x1c14fb?_0x1c14fb:![]);})[_0x908d('0x16')](function(_0x59073d){_0x1dd840(_0x59073d);});};AGIVertices[_0x908d('0x10')]['createSmsMessage']=function(_0x929529,_0x13b5d7){this[_0x908d('0xe')]['createSmsMessage'](_0x929529)[_0x908d('0x12')](function(_0x375d21){_0x13b5d7(null,_0x375d21);})[_0x908d('0x16')](function(_0x3399e7){_0x13b5d7(_0x3399e7);});};AGIVertices['prototype'][_0x908d('0x34')]=function(_0x1a518d,_0x1c5910,_0x1eddf3){this[_0x908d('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x908d('0xd')][_0x908d('0x35')],'node':_0x1a518d[_0x908d('0x36')],'application':_0x1a518d[_0x908d('0x37')],'data':_0x1c5910||null,'project_name':this[_0x908d('0xd')][_0x908d('0x38')],'callerid':this['channel']['callerid']})[_0x908d('0x12')](function(_0x5556af){if(_0x1eddf3){_0x1eddf3(null,_0x5556af);}})[_0x908d('0x16')](function(_0x1ab59a){if(_0x1eddf3){_0x1eddf3(_0x1ab59a);}});};AGIVertices['prototype'][_0x908d('0x39')]=function(_0x1baf68,_0x53dccb,_0x47b978,_0x245fa8){this[_0x908d('0xe')][_0x908d('0x39')]({'uniqueid':this['channel'][_0x908d('0x35')],'callerid':this['channel'][_0x908d('0x3a')],'calleridname':this[_0x908d('0xd')]['calleridname'],'context':this[_0x908d('0xd')]['context'],'extension':this['channel'][_0x908d('0x3b')],'priority':this[_0x908d('0xd')][_0x908d('0x3c')],'accountcode':this[_0x908d('0xd')]['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0x908d('0xd')][_0x908d('0x38')],'saveName':_0x53dccb,'filename':_0x1baf68[_0x908d('0x3d')]||_0x53dccb,'savePath':_0x47b978})[_0x908d('0x12')](function(_0x44d091){_0x245fa8(null,_0x44d091);})[_0x908d('0x16')](function(_0x3f5d4f){_0x245fa8(_0x3f5d4f);});};AGIVertices[_0x908d('0x10')]['createSquareMessage']=function(_0x2c7ba3,_0x5c4105,_0xcabdb6,_0xf541e5,_0x192554){this[_0x908d('0xe')]['createSquareMessage']({'uniqueid':this['channel'][_0x908d('0x35')],'body':_0x2c7ba3,'direction':_0x5c4105,'providerName':_0xcabdb6,'providerResponse':_0xf541e5})[_0x908d('0x12')](function(_0xe24937){if(_0x192554){_0x192554(null,_0xe24937);}})[_0x908d('0x16')](function(_0x29d1ea){if(_0x192554){_0x192554(_0x29d1ea);}});};AGIVertices[_0x908d('0x10')][_0x908d('0x3e')]=function(_0x40615b,_0x176039){this[_0x908d('0xe')]['createCmContact']({'firstName':_[_0x908d('0x3f')](_0x40615b[_0x908d('0x15')])||_['isNil'](_0x40615b['name'])?_0x908d('0x40')+Math['random']():_0x40615b[_0x908d('0x15')],'lastName':_[_0x908d('0x3f')](_0x40615b['lastName'])||_['isNil'](_0x40615b[_0x908d('0x41')])?null:_0x40615b[_0x908d('0x41')],'phone':_0x40615b['phone'],'ListId':_0x40615b[_0x908d('0x42')],'scheduledat':_0x40615b[_0x908d('0x43')],'callbackUniqueid':this[_0x908d('0xd')][_0x908d('0x35')],'tags':_0x908d('0x44'),'description':_0x908d('0x45')+_0x40615b[_0x908d('0x43')][_0x908d('0x46')](),'priority':_0x40615b[_0x908d('0x47')]})[_0x908d('0x12')](function(_0x106320){_0x176039(null,_0x106320);})[_0x908d('0x16')](function(_0x488a80){_0x176039(_0x488a80);});};AGIVertices['prototype'][_0x908d('0x48')]=function(_0x5dcc5b,_0x1471cd){this[_0x908d('0xe')][_0x908d('0x49')](_0x5dcc5b)[_0x908d('0x12')](function(_0x3e959b){_0x1471cd(null,_0x3e959b?_0x3e959b[_0x908d('0x15')]:![]);})[_0x908d('0x16')](function(_0x403136){_0x1471cd(_0x403136);});};AGIVertices[_0x908d('0x10')][_0x908d('0x4a')]=function(_0x491953,_0x11d6f9,_0x1de835){var _0x3a3cd9={'role':_0x908d('0x4b')};_0x3a3cd9[_0x491953]=this[_0x908d('0xd')][_0x908d('0x3a')];this['rpc'][_0x908d('0x4a')](_0x3a3cd9,_0x11d6f9,this['channel'][_0x908d('0x35')])[_0x908d('0x12')](function(_0x23fe9a){_0x1de835(null,_[_0x908d('0x4c')](_0x23fe9a)?![]:!![]);})[_0x908d('0x16')](function(_0x9eec01){logger['error'](_0x9eec01);_0x1de835(null,![]);});};AGIVertices[_0x908d('0x10')][_0x908d('0x4d')]=function(_0x3bf30c,_0x24c79d){var _0x421274={'role':_0x908d('0x4b')};_0x421274[_0x3bf30c]=this['channel'][_0x908d('0x3a')];this[_0x908d('0xe')][_0x908d('0x4d')](_0x421274)['then'](function(_0x590368){_0x24c79d(null,_['isNil'](_0x590368)?![]:!![]);})['catch'](function(_0x154484){logger[_0x908d('0x2b')](_0x154484);_0x24c79d(null,![]);});};AGIVertices[_0x908d('0x10')][_0x908d('0x4e')]=function(_0x1e4ed0,_0x18b5fd){var _0x11bf76={'role':_0x908d('0x4b')};_0x11bf76[_0x1e4ed0]=this[_0x908d('0xd')][_0x908d('0x3a')];this['rpc'][_0x908d('0x4e')](_0x11bf76)[_0x908d('0x12')](function(_0x383355){_0x18b5fd(null,_[_0x908d('0x4c')](_0x383355)?![]:!![]);})[_0x908d('0x16')](function(_0x2cbb28){logger[_0x908d('0x2b')](_0x2cbb28);_0x18b5fd(null,![]);});};AGIVertices[_0x908d('0x10')]['agentLogin']=function(_0x927733,_0x12b880){var _0x444209={'role':_0x908d('0x4b')};_0x444209[_0x927733]=this[_0x908d('0xd')][_0x908d('0x3a')];var _0x491e21=_0x927733!=_0x908d('0x4f')?util[_0x908d('0x28')]('%s/%s@from-sip/n',_0x908d('0x50'),this[_0x908d('0xd')][_0x908d('0x3a')]):undefined;this['rpc'][_0x908d('0x51')](_0x444209,_0x491e21)[_0x908d('0x12')](function(_0x5dee6e){_0x12b880(null,_[_0x908d('0x4c')](_0x5dee6e)?![]:!![]);})['catch'](function(_0x526319){logger[_0x908d('0x2b')](_0x526319);_0x12b880(null,![]);});};AGIVertices[_0x908d('0x10')]['shellCommand']=function(_0x3bcfa1,_0xc179eb){sh[_0x908d('0x52')](_[_0x908d('0x53')](_0x3bcfa1),function(_0xa2a963,_0x1375ca){var _0x1bdbea=_0x1375ca[_0x908d('0x54')](/(\r\n|\n|\r)/gm,'');_0xc179eb(null,_0x1bdbea);});};AGIVertices[_0x908d('0x10')][_0x908d('0x55')]=function(_0x203404,_0x41ef83){scripts[_0x908d('0x55')](_0x203404[_0x908d('0x56')],_0x203404[_0x908d('0x57')]||_0x908d('0x58'),_0x203404['text'],_0x203404[_0x908d('0x59')]||'en-US',_0x203404[_0x908d('0x5a')]||'MALE',_0x203404[_0x908d('0x5b')]||_0x908d('0x5c'))['then'](function(_0xd3718e){_0x41ef83(null,_0xd3718e);})['catch'](function(_0x21fb82){_0x41ef83(_0x21fb82);});};AGIVertices[_0x908d('0x10')][_0x908d('0x5d')]=function(_0x4a1fe4,_0x5bcec1){scripts[_0x908d('0x5d')](_0x4a1fe4[_0x908d('0x58')],_0x4a1fe4[_0x908d('0x5e')]||'en',0x1)[_0x908d('0x12')](function(_0x3e0922){_0x5bcec1(null,_0x3e0922);})[_0x908d('0x16')](function(_0x2b7802){_0x5bcec1(_0x2b7802);});};AGIVertices['prototype'][_0x908d('0x5f')]=function(_0x3aa2a6,_0x31d4e9){var _0x35c028={'uri':_0x3aa2a6[_0x908d('0x60')],'method':_0x3aa2a6[_0x908d('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3aa2a6['timeout'])===_0x908d('0x62')&&parseInt(_0x3aa2a6[_0x908d('0x63')])>=0x1?parseInt(_0x3aa2a6[_0x908d('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x908d('0x64'),_0x908d('0x65')],_0x35c028[_0x908d('0x61')][_0x908d('0x66')]())){try{_0x35c028['body']=_0x3aa2a6['rawBody']?JSON[_0x908d('0x67')](_0x3aa2a6['rawBody']):{};}catch(_0x313d04){logger['error'](_0x908d('0x68'),_0x313d04);}}try{_0x35c028[_0x908d('0x69')]=_0x3aa2a6[_0x908d('0x9')]?JSON[_0x908d('0x67')](_0x3aa2a6[_0x908d('0x9')]):{};}catch(_0x23924a){logger[_0x908d('0x2b')](_0x908d('0x6a'),_0x23924a);}if(_0x3aa2a6[_0x908d('0x6b')]){try{var _0x49b490=require(_0x3aa2a6[_0x908d('0x6b')])[_0x908d('0x6c')](this,_0x35c028);_0x35c028[_0x908d('0x6d')]=Mustache[_0x908d('0x6e')](_0x3aa2a6[_0x908d('0x60')],_0x49b490,{},['$$','$$']);if(_0x35c028[_0x908d('0x69')]){_0x35c028['headers']=JSON['parse'](Mustache['render'](JSON[_0x908d('0x6f')](_0x35c028['headers']),_0x49b490,{},['$$','$$']));}if(_0x35c028[_0x908d('0x70')]){_0x35c028['body']=JSON[_0x908d('0x67')](Mustache['render'](JSON[_0x908d('0x6f')](_0x35c028[_0x908d('0x70')]),_0x49b490,{},['$$','$$']));}}catch(_0x31401f){logger[_0x908d('0x2b')](_0x908d('0x71'),_0x31401f);}}rp(_0x35c028)[_0x908d('0x12')](function(_0x177ee3){var _0x4f5efa={'statusCode':_0x177ee3[_0x908d('0x72')]||0xc8,'statusMessage':_0x177ee3['statusMessage']||'OK','headers':_0x177ee3[_0x908d('0x69')]||{},'body':_0x177ee3[_0x908d('0x70')]||{}};_0x31d4e9(null,_0x4f5efa);})[_0x908d('0x16')](function(_0xe6faa4){var _0x1aa433={'statusCode':_0xe6faa4['statusCode']||0x1f4,'statusMessage':_0xe6faa4['message']||_0x908d('0x73'),'headers':_0xe6faa4[_0x908d('0x74')][_0x908d('0x69')]||{},'body':_0xe6faa4[_0x908d('0x74')]['body']||{}};_0x31d4e9(null,_0x1aa433);});};AGIVertices[_0x908d('0x10')][_0x908d('0x75')]=function(_0xc2f39b,_0xde7683){scripts['googleDialogflow'](this[_0x908d('0xd')][_0x908d('0x35')],_0xc2f39b[_0x908d('0x76')],_0xc2f39b[_0x908d('0x58')],_0xc2f39b[_0x908d('0x77')]||'en')[_0x908d('0x12')](function(_0x474838){_0xde7683(null,_0x474838);})[_0x908d('0x16')](function(_0x1f1412){_0xde7683(_0x1f1412);});};AGIVertices['prototype'][_0x908d('0x78')]=function(_0xc9be1c,_0x3fbad0){scripts['googleDialogflowV2'](this[_0x908d('0xd')]['uniqueid'],_0xc9be1c[_0x908d('0x79')],_0xc9be1c[_0x908d('0x7a')],_0xc9be1c[_0x908d('0x7b')],_0xc9be1c[_0x908d('0x58')],_0xc9be1c[_0x908d('0x7c')]||'en')[_0x908d('0x12')](function(_0x5441ba){_0x3fbad0(null,_0x5441ba);})[_0x908d('0x16')](function(_0x173392){_0x3fbad0(_0x173392);});};AGIVertices[_0x908d('0x10')][_0x908d('0x7d')]=function(_0x378b70,_0x287869){scripts[_0x908d('0x7d')](this[_0x908d('0xd')],_0x378b70)[_0x908d('0x12')](function(_0xbe48ae){_0x287869(null,_0xbe48ae);})[_0x908d('0x16')](function(_0x278955){_0x287869(_0x278955);});};AGIVertices[_0x908d('0x10')]['ispeechTTS']=function(_0x463223,_0x1a3fd3){scripts[_0x908d('0x7e')](_0x463223[_0x908d('0x76')],_0x463223[_0x908d('0x58')],_0x463223[_0x908d('0x7f')]||_0x908d('0x80'),_0x463223['speed'])[_0x908d('0x12')](function(_0x49bb97){_0x1a3fd3(null,_0x49bb97);})[_0x908d('0x16')](function(_0x517586){_0x1a3fd3(_0x517586);});};AGIVertices[_0x908d('0x10')][_0x908d('0x81')]=function(_0x4a0b13,_0x3bb8d7,_0x144934){scripts[_0x908d('0x81')](_0x3bb8d7,_0x4a0b13[_0x908d('0x76')],_0x4a0b13[_0x908d('0x82')]||_0x908d('0x80'),this[_0x908d('0x83')](_0x4a0b13[_0x908d('0x84')])?_0x4a0b13[_0x908d('0x84')]:undefined)[_0x908d('0x12')](function(_0x50e621){_0x144934(null,_0x50e621);})[_0x908d('0x16')](function(_0xcb9437){_0x144934(_0xcb9437);});};AGIVertices[_0x908d('0x10')][_0x908d('0x85')]=function(_0x337bb3,_0x1af42d){scripts[_0x908d('0x85')](_0x337bb3[_0x908d('0x86')],_0x337bb3[_0x908d('0x87')],_0x337bb3[_0x908d('0x88')],_0x337bb3['aws_polly_voice']||_0x908d('0x89'),_0x337bb3[_0x908d('0x58')],_0x337bb3['aws_text_type']||_0x908d('0x58'))['then'](function(_0xb0e86c){_0x1af42d(null,_0xb0e86c);})[_0x908d('0x16')](function(_0x10468f){_0x1af42d(_0x10468f);});};AGIVertices[_0x908d('0x10')][_0x908d('0x8a')]=function(_0x312f1c,_0x2f8480){scripts[_0x908d('0x8a')](this['channel'][_0x908d('0x35')],_0x312f1c[_0x908d('0x86')],_0x312f1c[_0x908d('0x87')],_0x312f1c[_0x908d('0x8b')],_0x312f1c[_0x908d('0x58')],_0x312f1c[_0x908d('0x8c')])[_0x908d('0x12')](function(_0x4dd2ca){_0x2f8480(null,_0x4dd2ca);})['catch'](function(_0x425fda){_0x2f8480(_0x425fda);});};AGIVertices[_0x908d('0x10')][_0x908d('0x8d')]=function(_0x35ed11,_0x20f263,_0x1f74ce){scripts['googleASR'](_0x20f263,_0x35ed11[_0x908d('0x76')],_0x35ed11['google_asr_language']||'en-US')[_0x908d('0x12')](function(_0x5d4854){_0x1f74ce(null,_0x5d4854);})[_0x908d('0x16')](function(_0x254523){_0x1f74ce(_0x254523);});};AGIVertices[_0x908d('0x10')]['tildeASR']=function(_0x43deb0,_0x1be8c7,_0x111c29){scripts[_0x908d('0x8e')](_0x1be8c7,_0x43deb0['appid'],_0x43deb0[_0x908d('0x8f')],_0x43deb0[_0x908d('0x6d')])['then'](function(_0x2ee09b){_0x111c29(null,_0x2ee09b);})['catch'](function(_0x5d7389){_0x111c29(_0x5d7389);});};AGIVertices['prototype'][_0x908d('0x90')]=function(_0x10b2a2){var _0x2cfe60=_[_0x908d('0x91')](verticesWithRetry,_0x10b2a2[_0x908d('0x37')])?_0x10b2a2:_['clone'](_0x10b2a2);for(var _0x339c14 in _0x2cfe60){if(_0x2cfe60[_0x908d('0x92')](_0x339c14)){if(_0x2cfe60[_0x339c14]&&_[_0x908d('0x93')](_0x2cfe60[_0x339c14])){if(_['includes'](recursiveMapAttributes,_0x339c14)){_0x2cfe60[_0x339c14]=this[_0x908d('0x94')](_0x2cfe60[_0x339c14]);}else{_0x2cfe60[_0x339c14]=this[_0x908d('0x95')](_0x2cfe60[_0x339c14]);}}}}return _0x2cfe60;};AGIVertices[_0x908d('0x10')][_0x908d('0x96')]=function(_0x6cc3ac){for(var _0x17d332 in _0x6cc3ac){if(_0x6cc3ac[_0x908d('0x92')](_0x17d332)){if(_[_0x908d('0x97')](_0x6cc3ac[_0x17d332])){this[_0x908d('0x96')](_0x6cc3ac[_0x17d332]);}else if(_[_0x908d('0x98')](_0x6cc3ac[_0x17d332])){for(var _0x2a4ce6=0x0;_0x2a4ce6<_0x6cc3ac[_0x17d332][_0x908d('0x99')];_0x2a4ce6++){this[_0x908d('0x96')](_0x6cc3ac[_0x17d332][_0x2a4ce6]);}}else if(_[_0x908d('0x93')](_0x6cc3ac[_0x17d332])){_0x6cc3ac[_0x17d332]=this[_0x908d('0x95')](_0x6cc3ac[_0x17d332]);}}}};AGIVertices[_0x908d('0x10')][_0x908d('0x9a')]=function(_0x1f60e6,_0x43e9dd){for(var _0x210824 in _0x1f60e6){if(_0x1f60e6['hasOwnProperty'](_0x210824)){if(_[_0x908d('0x97')](_0x1f60e6[_0x210824])){if(!_['isEmpty'](_0x1f60e6[_0x210824])){this[_0x908d('0x9a')](_0x1f60e6[_0x210824],util['format'](_0x908d('0x9b'),_0x43e9dd,_0x210824));}}else if(_['isArray'](_0x1f60e6[_0x210824])){for(var _0x4c6d3d=0x0;_0x4c6d3d<_0x1f60e6[_0x210824]['length'];_0x4c6d3d++){this[_0x908d('0x9a')](_0x1f60e6[_0x210824][_0x4c6d3d],util[_0x908d('0x28')](_0x908d('0x9b'),_0x43e9dd,_0x210824+'['+_0x4c6d3d+']'));}}else{if(!_[_0x908d('0x4c')](_0x1f60e6[_0x210824])){this['channel'][_0x908d('0x9c')](util[_0x908d('0x28')]('%s.%s',_0x43e9dd,_0x210824),_0x1f60e6[_0x210824]);}}}}};AGIVertices[_0x908d('0x10')][_0x908d('0x94')]=function(_0x4bfd13){try{var _0x2ef543=JSON[_0x908d('0x67')](_0x4bfd13);this[_0x908d('0x96')](_0x2ef543);return JSON['stringify'](_0x2ef543);}catch(_0x1bd578){return this['replaceAllVariables'](_0x4bfd13);}};AGIVertices[_0x908d('0x10')][_0x908d('0x95')]=function(_0x2c804d){var _0x738549=_0x2c804d[_0x908d('0x9d')]('{');for(var _0x29c7dc=0x1;_0x29c7dc<_0x738549[_0x908d('0x99')];_0x29c7dc+=0x1){var _0x164fba=_0x738549[_0x29c7dc][_0x908d('0x9d')]('}');if(_0x164fba[_0x908d('0x99')]>0x1){_0x2c804d=_0x2c804d[_0x908d('0x9e')]('{'+_0x164fba[0x0]+'}',this[_0x908d('0xd')]['getVariable'](_0x164fba[0x0])[_0x908d('0x9f')]||_0x164fba[0x0]);}}if(_0x738549[_0x908d('0x99')]===0x1){return _0x2c804d[_0x908d('0x46')]();}return this[_0x908d('0x95')](_0x2c804d);};AGIVertices[_0x908d('0x10')][_0x908d('0xa0')]=function(_0x444ece,_0x1c308a){var _0x514c50=this[_0x908d('0xd')][_0x908d('0xa1')](_0x444ece);if(_0x514c50['result']===-0x1){return _0x514c50;}logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xa2'),_0x1c308a,_0x514c50['extra']));return this['channel'][_0x908d('0x9c')](_0x1c308a,_0x514c50['extra']);};AGIVertices[_0x908d('0x10')][_0x908d('0x83')]=function(_0x437c9c){return _0x437c9c&&_0x437c9c!=='0'&&_0x437c9c!=='-1'&&_0x437c9c!=='';};AGIVertices['prototype'][_0x908d('0xa3')]=function(_0x2a890c){this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x2a890c,'-');_0x2a890c[_0x908d('0xa4')]=_0x2a890c[_0x908d('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x908d('0x10')][_0x908d('0xa5')]=function(_0x285d1d){logger['info'](util[_0x908d('0x28')](_0x908d('0xa6'),_0x285d1d[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x285d1d[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xa8'));}var _0x3114ce='\x22'+_0x285d1d[_0x908d('0x58')]+'\x22';if(this[_0x908d('0x83')](_0x285d1d[_0x908d('0x74')])){_0x3114ce+=','+_0x285d1d[_0x908d('0x74')];}var _0x333d5b=this[_0x908d('0xd')][_0x908d('0x52')](_0x908d('0xa9'),_0x3114ce);if(_0x333d5b['result']===-0x1){return _0x333d5b;}return this[_0x908d('0xd')][_0x908d('0xa7')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x3114ce));};AGIVertices[_0x908d('0x10')][_0x908d('0xaa')]=function(_0x1db8d9){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xab'),_0x1db8d9['label']));if(!this[_0x908d('0x83')](_0x1db8d9[_0x908d('0xac')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20grammar\x20configured');}var _0x5baeef=_0x1db8d9[_0x908d('0xac')];if(this[_0x908d('0x83')](_0x1db8d9[_0x908d('0x74')])){_0x5baeef+=','+_0x1db8d9[_0x908d('0x74')];}var _0x510662=this['channel'][_0x908d('0x52')](_0x908d('0xad'),_0x5baeef);if(_0x510662[_0x908d('0xae')]===-0x1){return _0x510662;}var _0x442c9a=this[_0x908d('0xa0')]('RECOG_CONFIDENCE()',_0x908d('0xaf'));if(_0x442c9a[_0x908d('0xae')]===-0x1){return _0x442c9a;}var _0x2878be=this[_0x908d('0xa0')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x2878be['result']===-0x1){return _0x2878be;}var _0x13153f=this['getAndSetVariable'](_0x908d('0xb0'),_0x908d('0xb1'));if(_0x13153f[_0x908d('0xae')]===-0x1){return _0x13153f;}return this[_0x908d('0xd')][_0x908d('0xa7')](util['format'](_0x908d('0xb2'),_0x5baeef));};AGIVertices[_0x908d('0x10')][_0x908d('0x5')]=function(_0x1e73c8){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1e73c8[_0x908d('0x36')]));return this['channel'][_0x908d('0x5')]([_0x1e73c8['command'],_0x1e73c8['args']]);};AGIVertices['prototype']['answer']=function(_0x2f60d3){logger['info'](util[_0x908d('0x28')](_0x908d('0xb3'),_0x2f60d3[_0x908d('0x36')]));if(this[_0x908d('0x83')](_0x2f60d3['timeout'])){logger['info'](util[_0x908d('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2f60d3['timeout']));var _0x43ee91=this[_0x908d('0xd')][_0x908d('0xb4')](_0x2f60d3[_0x908d('0x63')]);if(_0x43ee91[_0x908d('0xae')]===-0x1){return _0x43ee91;}}return this[_0x908d('0xd')][_0x908d('0xb5')]();};AGIVertices[_0x908d('0x10')][_0x908d('0x44')]=function(_0x35648f){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xb6'),_0x35648f[_0x908d('0x36')]));if(!this['isConfigured'](_0x35648f[_0x908d('0x42')])){return this['channel'][_0x908d('0x2b')](_0x35648f,_0x908d('0xb7'));}_0x35648f[_0x908d('0x43')]=moment();if(this[_0x908d('0x83')](_0x35648f[_0x908d('0xb8')])){_0x35648f[_0x908d('0x43')]=moment()[_0x908d('0xb9')](_0x35648f[_0x908d('0xb8')],_0x908d('0xba'));}if(!this[_0x908d('0x83')](_0x35648f[_0x908d('0x47')])){_0x35648f[_0x908d('0x47')]=0x2;}this['createCmContact'][_0x908d('0x6c')](this,_0x35648f);return this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xbb'),_0x35648f[_0x908d('0xbc')],_0x35648f['list_id'],_0x35648f[_0x908d('0x43')]));};AGIVertices[_0x908d('0x10')][_0x908d('0xbd')]=function(_0x491b75){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xbe'),_0x491b75[_0x908d('0x36')]));var _0xea676c=this[_0x908d('0xd')][_0x908d('0x52')](_0x491b75['application'],_0x491b75[_0x908d('0x74')]);if(_0xea676c['result']===-0x1){return _0xea676c;}return this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xbf'),_0x491b75[_0x908d('0xc0')],_0x491b75['options']));};AGIVertices[_0x908d('0x10')][_0x908d('0xc1')]=function(_0x444f90){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xc2'),_0x444f90[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x444f90[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20text\x20configured');}var _0x35f91a='\x22'+_0x444f90[_0x908d('0x58')]+'\x22';if(this[_0x908d('0x83')](_0x444f90[_0x908d('0x74')])){_0x35f91a+=','+_0x444f90[_0x908d('0x74')];}var _0x17948f=this[_0x908d('0xd')][_0x908d('0x52')](_0x908d('0xa9'),_0x35f91a);if(_0x17948f[_0x908d('0xae')]===-0x1){return _0x17948f;}return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0xc3'),_0x35f91a));};AGIVertices[_0x908d('0x10')]['sestektts']=function(_0x285277){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xc4'),_0x285277[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x285277[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xa8'));}var _0x3f5a4c='\x22'+_0x285277[_0x908d('0x58')]+'\x22';if(this[_0x908d('0x83')](_0x285277['options'])){_0x3f5a4c+=','+_0x285277[_0x908d('0x74')];}var _0x17dbcf=this[_0x908d('0xd')]['exec'](_0x908d('0xa9'),_0x3f5a4c);if(_0x17dbcf['result']===-0x1){return _0x17dbcf;}return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0xc3'),_0x3f5a4c));};AGIVertices[_0x908d('0x10')][_0x908d('0xc5')]=function(_0x25d238){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x25d238['label']));if(!this[_0x908d('0x83')](_0x25d238[_0x908d('0xac')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x4c4d11=_0x25d238[_0x908d('0xac')];if(this[_0x908d('0x83')](_0x25d238[_0x908d('0x74')])){_0x4c4d11+=','+_0x25d238['options'];}var _0x31078a=this[_0x908d('0xd')][_0x908d('0x52')](_0x908d('0xad'),_0x4c4d11);if(_0x31078a[_0x908d('0xae')]===-0x1){return _0x31078a;}var _0x568935=this[_0x908d('0xa0')]('RECOG_CONFIDENCE()',_0x908d('0xc6'));if(_0x568935[_0x908d('0xae')]===-0x1){return _0x568935;}var _0xc61736=this[_0x908d('0xa0')](_0x908d('0xc7'),'LUMENVOX_ASR_TRANSCRIPT');if(_0xc61736[_0x908d('0xae')]===-0x1){return _0xc61736;}var _0x343e1d=this[_0x908d('0xa0')](_0x908d('0xb0'),_0x908d('0xc8'));if(_0x343e1d[_0x908d('0xae')]===-0x1){return _0x343e1d;}return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xb2'),_0x4c4d11));};AGIVertices['prototype'][_0x908d('0xc9')]=function(_0x426e0b){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xca'),_0x426e0b[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x426e0b['grammar'])){return this['channel'][_0x908d('0xa7')]('no\x20grammar\x20configured');}var _0x294c8a=_0x426e0b['grammar'];if(this[_0x908d('0x83')](_0x426e0b[_0x908d('0x74')])){_0x294c8a+=','+_0x426e0b[_0x908d('0x74')];}var _0x1a0ce8=this[_0x908d('0xd')]['exec'](_0x908d('0xad'),_0x294c8a);if(_0x1a0ce8[_0x908d('0xae')]===-0x1){return _0x1a0ce8;}var _0x34b255=this[_0x908d('0xa0')](_0x908d('0xcb'),_0x908d('0xcc'));if(_0x34b255[_0x908d('0xae')]===-0x1){return _0x34b255;}var _0x311677=this[_0x908d('0xa0')](_0x908d('0xc7'),_0x908d('0xcd'));if(_0x311677[_0x908d('0xae')]===-0x1){return _0x311677;}var _0xec528c=this[_0x908d('0xa0')](_0x908d('0xb0'),'SESTEK_ASR_INSTANCE');if(_0xec528c[_0x908d('0xae')]===-0x1){return _0xec528c;}return this['channel']['noop'](util[_0x908d('0x28')](_0x908d('0xb2'),_0x294c8a));};AGIVertices[_0x908d('0x10')][_0x908d('0xce')]=function(_0x537f9a){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xcf'),_0x537f9a[_0x908d('0x36')]));if(!this['isConfigured'](_0x537f9a[_0x908d('0xd0')])){return this['channel'][_0x908d('0x2b')](_0x537f9a,'no\x20database\x20selected');}var _0x10a47d=this['getSquareOdbc'][_0x908d('0x6c')](this,_0x537f9a[_0x908d('0xd0')]);if(!_0x10a47d){return this[_0x908d('0xd')]['error'](_0x537f9a,_0x908d('0xd1'));}if(!this[_0x908d('0x83')](_0x537f9a[_0x908d('0x2f')])){return this['channel'][_0x908d('0x2b')](_0x537f9a,_0x908d('0xd2'));}var _0x2d00fd=_0x537f9a[_0x908d('0x2f')][_0x908d('0x54')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xd3'),_0x2d00fd));var _0x18ae39=this[_0x908d('0xd4')]['sync'](this,_0x10a47d,_0x2d00fd);this[_0x908d('0x34')]['sync'](this,_0x537f9a,_0x2d00fd);if(!this['isConfigured'](_0x537f9a[_0x908d('0xd5')])){return this[_0x908d('0xd')]['noop'](_0x908d('0xd6'));}var _0x46995c=this[_0x908d('0xa1')][_0x908d('0x6c')](this,_0x537f9a[_0x908d('0xd5')]);if(!_0x46995c){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x537f9a,_0x908d('0xd7'));}var _0x5d8701=this;_0x18ae39[_0x908d('0xd8')](function(_0x39b5d3,_0x3dac7f){Object['keys'](_0x39b5d3)['forEach'](function(_0x24edb1){_0x5d8701[_0x908d('0xd')][_0x908d('0x9c')](util[_0x908d('0x28')](_0x908d('0xd9'),_0x46995c,_0x3dac7f,_0x24edb1),_0x39b5d3[_0x24edb1]);});});this[_0x908d('0xd')]['setVariable'](util['format'](_0x908d('0xda'),_0x46995c),_0x18ae39['length']);return this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xdb'),_0x46995c));};AGIVertices[_0x908d('0x10')][_0x908d('0xdc')]=function(_0x210abd){logger[_0x908d('0xdd')](util[_0x908d('0x28')](_0x908d('0xde'),_0x210abd['label']));if(!this[_0x908d('0x83')](_0x210abd[_0x908d('0xdf')])){return this['channel']['error'](_0x210abd,_0x908d('0xe0'));}var _0x2cba33=this[_0x908d('0x1a')][_0x908d('0x6c')](this,_0x210abd['sip_id']);if(!_0x2cba33){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x210abd,_0x908d('0xe1'));}var _0x175174=this['channel'][_0x908d('0x52')]('DIAL',[util[_0x908d('0x28')](_0x908d('0xe2'),_0x2cba33),_0x210abd[_0x908d('0x63')],_0x210abd[_0x908d('0xe3')],_0x210abd['url']]);if(_0x175174[_0x908d('0xae')]===-0x1){return _0x175174;}return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xe4'),_0x908d('0xe5')));};AGIVertices[_0x908d('0x10')][_0x908d('0xe6')]=function(_0x2d7c50){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2d7c50[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x2d7c50[_0x908d('0x76')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20key\x20configured');}if(!this[_0x908d('0x83')](_0x2d7c50[_0x908d('0x58')])){return this['channel'][_0x908d('0xa7')](_0x908d('0xa8'));}this[_0x908d('0xd')][_0x908d('0xe7')]=!![];this['createSquareDetailsReport'](_0x2d7c50);this[_0x908d('0xe8')](_0x2d7c50[_0x908d('0x58')],'in','','');this[_0x908d('0xd')][_0x908d('0xa7')](util['format']('Trying\x20Dialogflow:\x20%s',_0x2d7c50[_0x908d('0x58')]));var _0x1fac76=this['googleDialogflow'][_0x908d('0x6c')](this,_0x2d7c50);if(_0x1fac76){for(var _0x234328 in _0x1fac76){if(_0x1fac76[_0x908d('0x92')](_0x234328)){this[_0x908d('0xd')][_0x908d('0x9c')](util['format'](_0x908d('0xe9'),_0x234328[_0x908d('0x66')]()),_0x1fac76[_0x234328]);}}this[_0x908d('0xe8')](_0x1fac76[_0x908d('0xea')],_0x908d('0xeb'),_0x908d('0xe6'),'');return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xec'),_0x1fac76[_0x908d('0xea')]));}return this['channel'][_0x908d('0x2b')](_0x2d7c50,_0x908d('0xed'));};AGIVertices[_0x908d('0x10')][_0x908d('0xee')]=function(_0x18eefc){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xef'),_0x18eefc[_0x908d('0x36')]));if(!this['isConfigured'](_0x18eefc['dialogflowV2_project_id'])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x18eefc[_0x908d('0x7a')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xf0'));}if(!this[_0x908d('0x83')](_0x18eefc[_0x908d('0x7b')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xf1'));}if(!this[_0x908d('0x83')](_0x18eefc['dialogflowV2_language'])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xf2'));}if(!this[_0x908d('0x83')](_0x18eefc[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20text\x20configured');}this['channel'][_0x908d('0xe7')]=!![];this[_0x908d('0x34')](_0x18eefc);this[_0x908d('0xe8')](_0x18eefc[_0x908d('0x58')],'in','','');this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xf3'),_0x18eefc[_0x908d('0x58')]));var _0x48635c=this[_0x908d('0x78')][_0x908d('0x6c')](this,_0x18eefc);if(_0x48635c){for(var _0x41b36d in _0x48635c){if(_0x48635c[_0x908d('0x92')](_0x41b36d)){if(_0x41b36d!==_0x908d('0xf4')){this[_0x908d('0xd')][_0x908d('0x9c')](util[_0x908d('0x28')]('DIALOGFLOW_%s',_0x41b36d[_0x908d('0x66')]()),_0x48635c[_0x41b36d]);}}}this[_0x908d('0xe8')](_0x48635c[_0x908d('0xea')],_0x908d('0xeb'),_0x908d('0xee'),_0x48635c[_0x908d('0xf4')]);return this['channel']['noop'](util[_0x908d('0x28')]('DialogflowV2\x20Result\x20%s',_0x48635c['speech']));}return this['channel'][_0x908d('0x2b')](_0x18eefc,_0x908d('0xf5'));};AGIVertices['prototype']['sesteknda']=function(_0x143f56){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0xf6'),_0x143f56['label']));if(!this['isConfigured'](_0x143f56[_0x908d('0xf7')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x143f56['username'])){return this['channel'][_0x908d('0xa7')](_0x908d('0xf8'));}if(!this[_0x908d('0x83')](_0x143f56[_0x908d('0xf9')])){return this['channel']['noop'](_0x908d('0xfa'));}if(!this[_0x908d('0x83')](_0x143f56[_0x908d('0xfb')])){return this[_0x908d('0xd')]['noop'](_0x908d('0xa8'));}this['channel']['bot']=!![];this[_0x908d('0x34')](_0x143f56);this[_0x908d('0xe8')](_0x143f56[_0x908d('0x58')],'in','','');this[_0x908d('0xd')][_0x908d('0xa7')](util['format'](_0x908d('0xfc'),_0x143f56[_0x908d('0x58')]));var _0x378655=this[_0x908d('0x7d')][_0x908d('0x6c')](this,_0x143f56);if(_0x378655){for(var _0x23f4ca in _0x378655){if(_0x378655[_0x908d('0x92')](_0x23f4ca)){this[_0x908d('0xd')]['setVariable'](util['format'](_0x908d('0xfd'),_0x23f4ca[_0x908d('0x66')]()),_0x378655[_0x23f4ca]);}}this[_0x908d('0xe8')](_0x378655[_0x908d('0xea')],'out','sesteknda','');if(_0x378655[_0x908d('0xfe')]){this[_0x908d('0xd')]['noop'](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x378655[_0x908d('0xfe')]));var _0x4e1337=this[_0x908d('0xd')][_0x908d('0xff')](_0x378655[_0x908d('0xfe')]);try{fs[_0x908d('0x100')](_0x378655[_0x908d('0xfe')]+'.wav');}catch(_0x288d21){logger[_0x908d('0x2b')](_0x288d21);}return _0x4e1337;}else{return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x101'),_0x378655[_0x908d('0xea')]));}}return this[_0x908d('0xd')][_0x908d('0x2b')](_0x143f56,_0x908d('0x102'));};AGIVertices[_0x908d('0x10')]['end']=function(_0x3ba99b){logger[_0x908d('0x2d')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x3ba99b[_0x908d('0x36')]));return this[_0x908d('0xd')]['noop'](_0x908d('0x103'));};AGIVertices[_0x908d('0x10')]['ext_dial']=function(_0x335d34){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x335d34[_0x908d('0x36')]));var _0x56ca5a='';if(_0x335d34[_0x908d('0x104')]){if(!this[_0x908d('0x83')](_0x335d34[_0x908d('0x104')])){return this['channel'][_0x908d('0x2b')](_0x335d34,_0x908d('0x105'));}else{var _0x1acab0=parseInt(_0x335d34[_0x908d('0x104')],0xa);if(isNaN(_0x1acab0)){_0x56ca5a=_0x335d34[_0x908d('0x104')];}else{_0x56ca5a=this['getTrunk'][_0x908d('0x6c')](this,_0x335d34[_0x908d('0x104')]);if(!_0x56ca5a){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x335d34,'no\x20trunk\x20found');}}}}else if(_0x335d34['trunk_name']){_0x56ca5a=_0x335d34[_0x908d('0x106')];}else{return this[_0x908d('0xd')][_0x908d('0x2b')](_0x335d34,_0x908d('0x105'));}var _0x29d467=this[_0x908d('0xd')]['exec'](_0x908d('0xe5'),[util['format']('SIP/%s/%s',_0x56ca5a,_0x335d34['phone']),_0x335d34[_0x908d('0x63')],_0x335d34[_0x908d('0xe3')],_0x335d34[_0x908d('0x60')]]);if(_0x29d467[_0x908d('0xae')]===-0x1){return _0x29d467;}return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0xe4'),_0x908d('0xe5')));};AGIVertices['prototype'][_0x908d('0x107')]=function(_0x468002){logger[_0x908d('0x2d')](util['format'](_0x908d('0x108'),_0x468002['label']));return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x107'));};AGIVertices[_0x908d('0x10')][_0x908d('0xb')]=function(_0x17f187){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x109'),_0x17f187[_0x908d('0x36')]));if(_0x17f187[_0x908d('0xa4')]===0x0){return this[_0x908d('0xa3')](_0x17f187);}_0x17f187[_0x908d('0xa4')]-=0x1;if(!this[_0x908d('0x83')](_0x17f187[_0x908d('0x10a')])){return this['channel'][_0x908d('0x2b')](_0x17f187,_0x908d('0x10b'));}var _0x1c2787=this['getSound']['sync'](this,_0x17f187[_0x908d('0x10a')]);if(!_0x1c2787){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x17f187,_0x908d('0x10c'));}if(!this[_0x908d('0x83')](_0x17f187['variable_id'])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x908d('0xd6'));}var _0x4994ab=this[_0x908d('0xd')][_0x908d('0x10d')](_0x1c2787,_0x17f187[_0x908d('0x10e')],_0x17f187[_0x908d('0x10f')]);var _0x271af6=_0x4994ab[_0x908d('0xae')]?_0x4994ab[_0x908d('0xae')][_0x908d('0x46')]():'';logger[_0x908d('0x2d')](_0x908d('0x110'),JSON['stringify'](_0x4994ab));if(_0x4994ab[_0x908d('0xae')]===-0x1){this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x17f187,_0x271af6);return _0x4994ab;}else if(_0x4994ab[_0x908d('0x9f')]===_0x908d('0x63')){_0x4994ab['result']=_0x271af6[_0x908d('0x99')]>=parseInt(_0x17f187[_0x908d('0x111')])?'x':'i';}else{_0x4994ab['result']=_0x271af6['length']>=parseInt(_0x17f187['mindigit'])&&_0x271af6['length']<=parseInt(_0x17f187[_0x908d('0x10f')])?'x':'i';}var _0x4f3a58=this[_0x908d('0xa1')][_0x908d('0x6c')](this,_0x17f187[_0x908d('0xd5')]);if(!_0x4f3a58){return this['channel'][_0x908d('0x2b')](_0x17f187,_0x908d('0xd7'));}this[_0x908d('0xd')]['setVariable'](_0x4f3a58,_0x271af6);if(this['isConfigured'](_0x17f187[_0x908d('0x112')])){var _0x27c9ba=parseInt(_0x17f187[_0x908d('0x112')],0xa);var _0xfc5a3b=rs[_0x908d('0x113')]({'charset':'*','length':_0x27c9ba});var _0x233f58=_0x271af6['length'];if(_0x233f58>0x0){if(_0x233f58>_0x27c9ba){this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x17f187,_0x17f187[_0x908d('0x114')]==='first'?_0xfc5a3b+_0x271af6[_0x908d('0x115')](_0x27c9ba):_0x271af6[_0x908d('0x115')](0x0,_0x233f58-_0x27c9ba)+_0xfc5a3b);}else{this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x17f187,rs[_0x908d('0x113')]({'charset':'*','length':_0x233f58}));}}else{this['createSquareDetailsReport'][_0x908d('0x6c')](this,_0x17f187,'');}}else{this['createSquareDetailsReport'][_0x908d('0x6c')](this,_0x17f187,_0x271af6);}return _0x4994ab;};AGIVertices[_0x908d('0x10')]['getsecretdigits']=function(_0x23aceb){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x116'),_0x23aceb[_0x908d('0x36')]));return this[_0x908d('0xb')](_0x23aceb);};AGIVertices[_0x908d('0x10')][_0x908d('0x117')]=function(_0x508a51){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x118'),_0x508a51[_0x908d('0x36')]));this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x508a51,_0x508a51[_0x908d('0x119')]);return this[_0x908d('0xd')][_0x908d('0xa7')](util['format'](_0x908d('0x11a'),_0x508a51[_0x908d('0x119')]));};AGIVertices[_0x908d('0x10')][_0x908d('0x11b')]=function(_0x368a98){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x11c'),_0x368a98[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x368a98[_0x908d('0x86')])||!this[_0x908d('0x83')](_0x368a98[_0x908d('0x87')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x11d'));}if(!this[_0x908d('0x83')](_0x368a98[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20text\x20configured');}this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x11e'),_0x368a98[_0x908d('0x58')]));var _0x1753c6=this[_0x908d('0x85')][_0x908d('0x6c')](this,_0x368a98);if(_0x1753c6){this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x11f'),_0x1753c6));var _0x4f7d44=this[_0x908d('0xd')][_0x908d('0xff')](_0x1753c6);try{fs[_0x908d('0x100')](_0x1753c6+'.wav');}catch(_0x3585b6){logger[_0x908d('0x2b')](_0x3585b6);}return _0x4f7d44;}return this['channel']['error'](_0x368a98,_0x908d('0x120'));};AGIVertices['prototype'][_0x908d('0x121')]=function(_0x55d8ff){logger[_0x908d('0x2d')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x55d8ff['label']));if(!this[_0x908d('0x83')](_0x55d8ff['aws_access_key_id'])||!this[_0x908d('0x83')](_0x55d8ff[_0x908d('0x87')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x11d'));}if(!this[_0x908d('0x83')](_0x55d8ff[_0x908d('0x8c')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x122'));}if(!this[_0x908d('0x83')](_0x55d8ff[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20text\x20configured');}this[_0x908d('0xd')][_0x908d('0xe7')]=!![];this['createSquareDetailsReport'](_0x55d8ff);this[_0x908d('0xe8')](_0x55d8ff[_0x908d('0x58')],'in','','');this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x55d8ff[_0x908d('0x58')]));var _0x3261e7=this[_0x908d('0x8a')][_0x908d('0x6c')](this,_0x55d8ff);if(_0x3261e7){for(var _0x1537d4 in _0x3261e7){if(_0x3261e7[_0x908d('0x92')](_0x1537d4)&&_[_0x908d('0x93')](_0x3261e7[_0x1537d4])){this[_0x908d('0xd')][_0x908d('0x9c')](util['format'](_0x908d('0x123'),_0x1537d4[_0x908d('0x66')]()),_0x3261e7[_0x1537d4]);}}if(_['isNil'](_0x3261e7[_0x908d('0x124')])){return this[_0x908d('0xd')]['noop'](_0x908d('0x125'));}else{this['createSquareMessage'](_0x3261e7[_0x908d('0x124')],'out',_0x908d('0x126'),'');return this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x127'),_0x3261e7[_0x908d('0x124')]));}}return this[_0x908d('0xd')][_0x908d('0x2b')](_0x55d8ff,_0x908d('0x128'));};AGIVertices[_0x908d('0x10')][_0x908d('0x129')]=function(_0x3e4593){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x12a'),_0x3e4593[_0x908d('0x36')],_0x3e4593['timeout']));if(!this[_0x908d('0x83')](_0x3e4593[_0x908d('0x76')])){return this[_0x908d('0xd')]['noop']('no\x20key\x20configured');}var _0x413101=_0x908d('0x12b');var _0x314a89=util[_0x908d('0x28')](_0x908d('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x484af2=util[_0x908d('0x28')](_0x908d('0x9b'),_0x314a89,_0x413101);var _0x1a7055=!![];if(_0x3e4593[_0x908d('0x12d')]==='NOBEEP'){_0x1a7055=![];}var _0x49db8e=this[_0x908d('0xd')]['recordFile'](_0x314a89,_0x413101,_0x3e4593[_0x908d('0x12e')],_0x3e4593[_0x908d('0x63')],undefined,_0x1a7055);if(_0x49db8e[_0x908d('0xae')]!==-0x1){this['channel'][_0x908d('0xa7')](util['format']('google\x20%s\x20file\x20created',_0x484af2));var _0x592ed9=this['googleASR'][_0x908d('0x6c')](this,_0x3e4593,_0x484af2);if(_0x592ed9){for(var _0x8e1e76 in _0x592ed9){if(_0x592ed9[_0x908d('0x92')](_0x8e1e76)){this[_0x908d('0xd')]['setVariable'](util['format'](_0x908d('0x12f'),_0x8e1e76['toUpperCase']()),_0x592ed9[_0x8e1e76]);}}return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x130'),JSON[_0x908d('0x6f')](_0x592ed9)));}}return _0x49db8e;};AGIVertices['prototype']['tildeasr']=function(_0x5da38b){logger['info'](util[_0x908d('0x28')](_0x908d('0x131'),_0x5da38b[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x5da38b[_0x908d('0x132')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x5da38b[_0x908d('0x8f')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20appsecret\x20configured');}var _0x1b8e34=_0x908d('0x12b');var _0x17376a=util[_0x908d('0x28')](_0x908d('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x1c1303=util[_0x908d('0x28')]('%s.%s',_0x17376a,_0x1b8e34);var _0x4834a2=!![];if(_0x5da38b[_0x908d('0x12d')]==='NOBEEP'){_0x4834a2=![];}var _0x527630=this[_0x908d('0xd')]['recordFile'](_0x17376a,_0x1b8e34,_0x5da38b[_0x908d('0x12e')],_0x5da38b[_0x908d('0x63')],undefined,_0x4834a2);if(_0x527630[_0x908d('0xae')]!==-0x1){this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x133'),_0x1c1303));var _0x58618f=this[_0x908d('0x8e')][_0x908d('0x6c')](this,_0x5da38b,_0x1c1303);if(_0x58618f){for(var _0x3126ba in _0x58618f){if(_0x58618f[_0x908d('0x92')](_0x3126ba)){this[_0x908d('0xd')][_0x908d('0x9c')](util[_0x908d('0x28')](_0x908d('0x134'),_0x3126ba[_0x908d('0x66')]()),_0x58618f[_0x3126ba]);}}return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')]('TildeASR\x20Result\x20%s',JSON[_0x908d('0x6f')](_0x58618f)));}}return _0x527630;};AGIVertices[_0x908d('0x10')]['gotoc']=function(_0x4f6e40){logger[_0x908d('0x2d')](util['format'](_0x908d('0x135'),_0x4f6e40[_0x908d('0x36')]));return this[_0x908d('0xd')][_0x908d('0x136')](_0x4f6e40[_0x908d('0x137')],_0x4f6e40[_0x908d('0x3b')],_0x4f6e40[_0x908d('0x3c')]);};AGIVertices[_0x908d('0x10')]['gotoif']=function(_0x3d6b13){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x138'),_0x3d6b13['label']));if(!this[_0x908d('0x83')](_0x3d6b13['condition'])){return this[_0x908d('0xd')]['error'](_0x3d6b13,_0x908d('0x139'));}try{var _0x2fe3a3=eval(_0x3d6b13[_0x908d('0x13a')])?'true':_0x908d('0x13b');this[_0x908d('0xd')]['noop'](util['format'](_0x908d('0x13c'),_0x3d6b13[_0x908d('0x13a')],_0x2fe3a3));return{'code':0xc8,'result':_0x2fe3a3};}catch(_0x29961d){return{'code':0xc8,'result':_0x908d('0x13b')};}};AGIVertices['prototype'][_0x908d('0x13d')]=function(_0xae4f69){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x13e'),_0xae4f69[_0x908d('0x36')]));if(!this['isConfigured'](_0xae4f69[_0x908d('0x13f')])){return this[_0x908d('0xd')]['error'](_0xae4f69,_0x908d('0x140'));}var _0x91d169=this[_0x908d('0x24')]['sync'](this,_0xae4f69[_0x908d('0x13f')]);if(!_0x91d169){return this[_0x908d('0xd')]['error'](_0xae4f69,'no\x20intervals\x20found');}for(var _0x4a4cd0=0x0;_0x4a4cd0<_0x91d169['length'];_0x4a4cd0+=0x1){var _0x148d2a=this['channel'][_0x908d('0xa1')](util[_0x908d('0x28')](_0x908d('0x141'),_0x91d169[_0x4a4cd0]));if(_0x148d2a[_0x908d('0xae')]===-0x1){return _0x148d2a;}logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x142'),_0x91d169[_0x4a4cd0],_0x148d2a['extra']));if(_0x148d2a['extra']===_0x908d('0x143')){logger[_0x908d('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0x91d169[_0x4a4cd0],'true'));this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x142'),_0x91d169[_0x4a4cd0],_0x908d('0x143')));return{'code':0xc8,'result':_0x908d('0x143')};}else{logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x142'),_0x91d169[_0x4a4cd0],'false'));this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x142'),_0x91d169[_0x4a4cd0],_0x908d('0x13b')));}}return{'code':0xc8,'result':_0x908d('0x13b')};};AGIVertices['prototype'][_0x908d('0x144')]=function(_0x456598){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x145'),_0x456598[_0x908d('0x36')]));return this['channel'][_0x908d('0x144')]();};AGIVertices[_0x908d('0x10')][_0x908d('0x146')]=function(_0x251dab){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x251dab[_0x908d('0x36')]));if(!this['isConfigured'](_0x251dab['key'])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20key\x20configured');}var _0x5c2638=_0x908d('0x12b');var _0x2b470e=util[_0x908d('0x28')](_0x908d('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x78df32=util[_0x908d('0x28')](_0x908d('0x9b'),_0x2b470e,_0x5c2638);var _0x41ffb4=!![];if(_0x251dab[_0x908d('0x12d')]===_0x908d('0x147')){_0x41ffb4=![];}var _0x4cff3f=this[_0x908d('0xd')][_0x908d('0x148')](_0x2b470e,_0x5c2638,_0x251dab[_0x908d('0x12e')],_0x251dab[_0x908d('0x63')],undefined,_0x41ffb4);if(_0x4cff3f[_0x908d('0xae')]!==-0x1){this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x149'),_0x78df32));var _0x194a9f=this[_0x908d('0x81')][_0x908d('0x6c')](this,_0x251dab,_0x78df32);if(_0x194a9f){for(var _0xfee960 in _0x194a9f){if(_0x194a9f[_0x908d('0x92')](_0xfee960)){this[_0x908d('0xd')][_0x908d('0x9c')](util[_0x908d('0x28')]('ISPEECH_ASR_%s',_0xfee960[_0x908d('0x66')]()),_0x194a9f[_0xfee960]);}}return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x14a'),JSON[_0x908d('0x6f')](_0x194a9f)));}}return _0x4cff3f;};AGIVertices[_0x908d('0x10')][_0x908d('0x14b')]=function(_0x4342e8){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x14c'),_0x4342e8['label']));if(!this['isConfigured'](_0x4342e8[_0x908d('0x76')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x14d'));}if(!this[_0x908d('0x83')](_0x4342e8['text'])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xa8'));}this[_0x908d('0xd')][_0x908d('0xa7')](util['format'](_0x908d('0x14e'),_0x4342e8[_0x908d('0x58')]));var _0x41722c=this[_0x908d('0x7e')][_0x908d('0x6c')](this,_0x4342e8);if(_0x41722c){this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x149'),_0x41722c));var _0x52fc61=this[_0x908d('0xd')][_0x908d('0xff')](_0x41722c,_0x4342e8[_0x908d('0x12e')]);try{fs[_0x908d('0x100')](_0x41722c+_0x908d('0x14f'));}catch(_0x238d1){logger['error'](_0x238d1);}return _0x52fc61;}return this[_0x908d('0xd')]['error'](_0x4342e8,_0x908d('0x150'));};AGIVertices[_0x908d('0x10')][_0x908d('0x151')]=function(_0x2757db){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2757db['label']));if(!this[_0x908d('0x83')](_0x2757db[_0x908d('0x152')])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x2757db,'no\x20find\x20by\x20configured');}logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x153'),this['channel'][_0x908d('0x3a')],_0x2757db['findBy']));var _0x1cb200=this[_0x908d('0x51')][_0x908d('0x6c')](this,_0x2757db[_0x908d('0x152')]);if(_0x1cb200){logger[_0x908d('0x2d')](util['format'](_0x908d('0x154'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x2757db[_0x908d('0x152')]));this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x154'),this['channel'][_0x908d('0x3a')],_0x2757db[_0x908d('0x152')]));return{'code':0xc8,'result':_0x908d('0x155')};}else{logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x156'),this['channel'][_0x908d('0x3a')],_0x2757db['findBy']));this[_0x908d('0xd')][_0x908d('0xa7')](util['format'](_0x908d('0x156'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x2757db[_0x908d('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x908d('0x10')][_0x908d('0x157')]=function(_0x47725a){logger['info'](util[_0x908d('0x28')](_0x908d('0x158'),_0x47725a[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x47725a[_0x908d('0x152')])){return this[_0x908d('0xd')]['error'](_0x47725a,_0x908d('0x159'));}logger['info'](util[_0x908d('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x908d('0x3a')],_0x47725a[_0x908d('0x152')]));var _0x123fd5=this[_0x908d('0x4e')]['sync'](this,_0x47725a['findBy']);if(_0x123fd5){logger['info'](util[_0x908d('0x28')](_0x908d('0x154'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x47725a[_0x908d('0x152')]));this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x154'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x47725a[_0x908d('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x908d('0x2d')](util['format'](_0x908d('0x156'),this['channel']['callerid'],_0x47725a['findBy']));this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x156'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x47725a['findBy']));return{'code':0xc8,'result':_0x908d('0x15a')};}};AGIVertices[_0x908d('0x10')]['math']=function(_0x54af9a){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x54af9a[_0x908d('0x36')]));if(!this['isConfigured'](_0x54af9a[_0x908d('0x15b')])){return this['channel'][_0x908d('0x2b')](_0x54af9a,_0x908d('0x15c'));}this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x15d'),_0x54af9a[_0x908d('0x15b')]));var _0x25c45b=eval(_0x54af9a[_0x908d('0x15b')]);if(!this[_0x908d('0x83')](_0x54af9a[_0x908d('0xd5')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xd6'));}var _0xc19116=this[_0x908d('0xa1')]['sync'](this,_0x54af9a[_0x908d('0xd5')]);if(!_0xc19116){return this['channel'][_0x908d('0x2b')](_0x54af9a,_0x908d('0xd7'));}if(_[_0x908d('0x98')](_0x25c45b)){var _0x158465=this;_0x25c45b[_0x908d('0xd8')](function(_0x3fba0a,_0xadb5d7){_0x158465['channel'][_0x908d('0x9c')](util[_0x908d('0x28')](_0x908d('0x15e'),_0xc19116,_0xadb5d7),_0x3fba0a);});return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x15f'),_0xc19116));}else{return this['channel'][_0x908d('0x9c')](_0xc19116,_0x25c45b);}};AGIVertices[_0x908d('0x10')]['menu']=function(_0x1361ca){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1361ca[_0x908d('0x36')]));if(_0x1361ca[_0x908d('0xa4')]===0x0){return this[_0x908d('0xa3')](_0x1361ca);}_0x1361ca[_0x908d('0xa4')]-=0x1;if(!this[_0x908d('0x83')](_0x1361ca[_0x908d('0x10a')])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x1361ca,_0x908d('0x10b'));}var _0x4409a5=this[_0x908d('0x1d')]['sync'](this,_0x1361ca[_0x908d('0x10a')]);if(!_0x4409a5){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x1361ca,_0x908d('0x10c'));}var _0x52e8ee=this['channel']['getData'](_0x4409a5,_0x1361ca[_0x908d('0x10e')],_0x1361ca['digit']);var _0x2dbe0e=_0x52e8ee[_0x908d('0xae')];if(_0x52e8ee['result']===-0x1){this['createSquareDetailsReport'][_0x908d('0x6c')](this,_0x1361ca,'-1');return _0x52e8ee;}else if(_0x52e8ee[_0x908d('0x9f')]==='timeout'){_0x52e8ee[_0x908d('0xae')]=_0x52e8ee[_0x908d('0xae')][_0x908d('0x99')]>0x0?_0x52e8ee[_0x908d('0xae')]:'t';}else if(_[_0x908d('0x3f')](_0x52e8ee[_0x908d('0xae')])){_0x52e8ee[_0x908d('0xae')]='#';_0x2dbe0e='#';}if(!this[_0x908d('0x83')](_0x1361ca[_0x908d('0xd5')])){this['channel'][_0x908d('0xa7')](_0x908d('0xd6'));}else{var _0x4d5c01=this['getVariable'][_0x908d('0x6c')](this,_0x1361ca[_0x908d('0xd5')]);if(!_0x4d5c01){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x1361ca,_0x908d('0xd7'));}this['channel'][_0x908d('0x9c')](_0x4d5c01,_0x2dbe0e);}this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x1361ca,_0x2dbe0e);return _0x52e8ee;};AGIVertices[_0x908d('0x10')][_0x908d('0xa7')]=function(_0x578969){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x160'),_0x578969[_0x908d('0x36')]));return this['channel'][_0x908d('0xa7')](_0x578969[_0x908d('0x161')]||_0x578969[_0x908d('0x36')]);};AGIVertices[_0x908d('0x10')][_0x908d('0x162')]=function(_0x34fdb6){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x34fdb6[_0x908d('0x36')]));if(!this['isConfigured'](_0x34fdb6['findBy'])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x34fdb6,_0x908d('0x159'));}logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x153'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x34fdb6[_0x908d('0x152')]));var _0x1a2bdd=this[_0x908d('0x48')][_0x908d('0x6c')](this,_0x34fdb6[_0x908d('0x163')]);var _0x46c9b5=this['agentPause']['sync'](this,_0x34fdb6[_0x908d('0x152')],_0x1a2bdd);if(_0x46c9b5){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x34fdb6['findBy']));this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x908d('0x3a')],_0x34fdb6['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x156'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x34fdb6['findBy']));this[_0x908d('0xd')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x908d('0xd')][_0x908d('0x3a')],_0x34fdb6['findBy']));return{'code':0xc8,'result':_0x908d('0x15a')};}};AGIVertices[_0x908d('0x10')][_0x908d('0x164')]=function(_0x444df1){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x165'),_0x444df1[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x444df1[_0x908d('0x10a')])){return this['channel']['error'](_0x444df1,_0x908d('0x10b'));}var _0xfdd9ea=this[_0x908d('0x1d')][_0x908d('0x6c')](this,_0x444df1[_0x908d('0x10a')]);if(!_0xfdd9ea){return this['channel']['error'](_0x444df1,_0x908d('0x10c'));}var _0x3b38ab=this['channel'][_0x908d('0x52')](_0x908d('0x166'),[_0xfdd9ea,_0x444df1[_0x908d('0xe3')]]);if(_0x3b38ab[_0x908d('0xae')]===-0x1){return _0x3b38ab;}return this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xbf'),_0x908d('0x166'),_0xfdd9ea));};AGIVertices[_0x908d('0x10')][_0x908d('0x167')]=function(_0x47b54b){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x168'),_0x47b54b[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x47b54b[_0x908d('0x169')])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x47b54b,_0x908d('0x16a'));}var _0x595b5f='';var _0x302283=parseInt(_0x47b54b[_0x908d('0x169')],0xa);if(isNaN(_0x302283)){_0x595b5f=_0x47b54b['queue_id'];}else{_0x595b5f=this[_0x908d('0x13')]['sync'](this,_0x47b54b[_0x908d('0x169')]);if(!_0x595b5f){return this[_0x908d('0xd')]['error'](_0x47b54b,'no\x20queue\x20found');}}var _0x594701='';if(this[_0x908d('0x83')](_0x47b54b[_0x908d('0x10a')])){var _0x41b770=this['getSound'][_0x908d('0x6c')](this,_0x47b54b[_0x908d('0x10a')]);if(_0x41b770){_0x594701=_0x41b770;}}this['createSquareDetailsReport'][_0x908d('0x6c')](this,_0x47b54b,_0x595b5f);if(_0x47b54b[_0x908d('0xe3')]['indexOf']('x')<0x0){_0x47b54b[_0x908d('0xe3')]+='x';}if(_0x47b54b[_0x908d('0xe3')][_0x908d('0x16b')]('X')<0x0){_0x47b54b[_0x908d('0xe3')]+='X';}this[_0x908d('0xd')]['setVariable'](_0x908d('0x16c'),_0x595b5f?_0x595b5f['toLowerCase']():'');var _0x30c7af=this[_0x908d('0xd')][_0x908d('0x52')](_0x908d('0x16d'),[_0x595b5f,_0x47b54b['opts'],_0x47b54b[_0x908d('0x60')],_0x594701,_0x47b54b[_0x908d('0x63')],_0x47b54b[_0x908d('0x5')],_0x47b54b[_0x908d('0x16e')],_0x47b54b['gosub'],'',_0x47b54b[_0x908d('0x16f')]]);if(_0x30c7af[_0x908d('0xae')]===-0x1){return _0x30c7af;}return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0xbf'),_0x908d('0x16d'),_0x595b5f));};AGIVertices[_0x908d('0x10')][_0x908d('0x170')]=function(_0x1c024e){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x171'),_0x1c024e[_0x908d('0x36')]));var _0x33ce78=_0x1c024e[_0x908d('0x172')]||_0x908d('0x12b');var _0x30422e=util[_0x908d('0x28')](_0x908d('0x173'),this[_0x908d('0xd')][_0x908d('0x35')],rs[_0x908d('0x113')](0x5));var _0x2aa96e=util['format'](_0x908d('0x174'),FILES_PATH,_0x30422e,_0x33ce78);var _0x34ec37=util[_0x908d('0x28')]('%s/recordings/%s',FILES_PATH,_0x30422e);this[_0x908d('0x39')][_0x908d('0x6c')](this,_0x1c024e,_0x30422e,_0x2aa96e);this[_0x908d('0xd')][_0x908d('0x9c')](_0x908d('0x175'),_0x30422e);logger[_0x908d('0x2d')](_0x908d('0x176'),_0x34ec37,_0x33ce78,_0x1c024e['escape_digits'],_0x1c024e[_0x908d('0x63')]);return this['channel']['recordFile'](_0x34ec37,_0x33ce78,_0x1c024e[_0x908d('0x177')],_0x1c024e[_0x908d('0x63')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x260d23){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x260d23['label']));if(!this[_0x908d('0x83')](_0x260d23[_0x908d('0x60')])){return this['channel'][_0x908d('0xa7')](_0x908d('0x178'));}var _0x54041b=this[_0x908d('0x5f')][_0x908d('0x6c')](this,_0x260d23);logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x179'),util[_0x908d('0x17a')](_0x54041b,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x260d23[_0x908d('0xd5')])){return this['channel'][_0x908d('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x478b6c=this[_0x908d('0xa1')]['sync'](this,_0x260d23[_0x908d('0xd5')]);if(!_0x478b6c){return this[_0x908d('0xd')]['error'](_0x260d23,_0x908d('0xd7'));}this['channel'][_0x908d('0x9c')](util['format'](_0x908d('0x17b'),_0x478b6c),_0x54041b['statusCode']?_0x54041b[_0x908d('0x72')]:_0x908d('0x17c'));this[_0x908d('0xd')]['setVariable'](util['format'](_0x908d('0x17d'),_0x478b6c),_0x54041b[_0x908d('0x17e')]?_0x54041b[_0x908d('0x17e')]:'OK');if(_0x54041b[_0x908d('0x70')]){try{this[_0x908d('0x9a')](_0x54041b[_0x908d('0x70')],_0x478b6c);}catch(_0x1f5d6a){logger['error'](util[_0x908d('0x28')](_0x908d('0x17f'),_0x478b6c));}}return this[_0x908d('0xd')]['noop'](util['format']('variable\x20%s\x20set',_0x478b6c));};AGIVertices[_0x908d('0x10')][_0x908d('0x180')]=function(_0x14b638){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x14b638[_0x908d('0x36')]));return this[_0x908d('0xd')][_0x908d('0x181')](_0x14b638['digits'][_0x908d('0x54')](/\s+/g,''),_0x14b638[_0x908d('0x177')]);};AGIVertices[_0x908d('0x10')][_0x908d('0x182')]=function(_0x1054df){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x183'),_0x1054df[_0x908d('0x36')]));return this[_0x908d('0xd')][_0x908d('0x184')](_0x1054df[_0x908d('0x62')]['replace'](/\s+/g,''),_0x1054df[_0x908d('0x177')]);};AGIVertices[_0x908d('0x10')][_0x908d('0x185')]=function(_0x361a09){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x186'),_0x361a09[_0x908d('0x36')]));return this['channel'][_0x908d('0x187')](_0x361a09[_0x908d('0x58')],_0x361a09['escape_digits']);};AGIVertices[_0x908d('0x10')][_0x908d('0x188')]=function(_0x4b8706){logger[_0x908d('0x2d')](util['format'](_0x908d('0x189'),_0x4b8706['label']));if(!this['isConfigured'](_0x4b8706['account_id'])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20mail\x20account\x20configured');}var _0x2ce8ce=this['getMailAccount']['sync'](this,_0x4b8706[_0x908d('0x18a')]);if(!_0x2ce8ce||!_0x2ce8ce[_0x908d('0x18b')]){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x4b8706,_0x908d('0x18c'));}var _0x21ec88={'from':util[_0x908d('0x28')]('\x22%s\x22\x20<%s>',_0x2ce8ce[_0x908d('0x15')],_0x2ce8ce['email']||_0x2ce8ce[_0x908d('0x18b')][_0x908d('0x18d')]),'to':_0x4b8706['to']||'','cc':_0x4b8706['cc']||'','bcc':_0x4b8706[_0x908d('0x18e')]||'','subject':_0x4b8706[_0x908d('0x18f')],'html':_0x4b8706['text'],'text':_0x4b8706[_0x908d('0x58')]};if(this[_0x908d('0x83')](_0x4b8706[_0x908d('0x190')])){}logger[_0x908d('0xdd')]('sendMail\x20message',JSON['stringify'](_0x21ec88));this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x4b8706,_0x4b8706[_0x908d('0x18a')]);this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x191'),_0x2ce8ce[_0x908d('0x15')]));this['sendMailMessage'][_0x908d('0x6c')](this,_0x2ce8ce[_0x908d('0x192')],_0x21ec88);return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x193'));};AGIVertices[_0x908d('0x10')][_0x908d('0x194')]=function(_0x5d24b3){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x195'),_0x5d24b3[_0x908d('0x36')]));return this['channel'][_0x908d('0xa7')](_0x908d('0x196'));};AGIVertices[_0x908d('0x10')][_0x908d('0x197')]=function(_0x503204){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x503204[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x503204[_0x908d('0x198')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x199'));}var _0x52d857=this[_0x908d('0x33')][_0x908d('0x6c')](this,_0x503204[_0x908d('0x198')]);if(!_0x52d857){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x503204,'no\x20sms\x20account\x20found');}var _0x5e0698={'body':_0x503204['sms_text'],'phone':_0x503204['to']||'','SmsAccountId':_0x52d857['id']};logger[_0x908d('0xdd')](_0x908d('0x19a'),JSON[_0x908d('0x6f')](_0x5e0698));this[_0x908d('0x34')]['sync'](this,_0x503204,_0x503204[_0x908d('0x198')]);this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x19b'),_0x52d857['name']));this['createSmsMessage'][_0x908d('0x6c')](this,_0x5e0698);return this[_0x908d('0xd')][_0x908d('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x908d('0x10')]['set']=function(_0x5b3e22){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x19c'),_0x5b3e22[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x5b3e22[_0x908d('0xd5')])){return this['channel'][_0x908d('0x2b')](_0x5b3e22,_0x908d('0x19d'));}var _0x10003c=this['getVariable'][_0x908d('0x6c')](this,_0x5b3e22['variable_id']);if(!_0x10003c){return this[_0x908d('0xd')]['error'](_0x5b3e22,'no\x20variable\x20found');}return this[_0x908d('0xd')][_0x908d('0x9c')](_0x10003c,_0x5b3e22['variable_value']);};AGIVertices[_0x908d('0x10')][_0x908d('0x19e')]=function(_0x4a1210){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x19f'),_0x4a1210[_0x908d('0x36')]));this[_0x908d('0xd')][_0x908d('0xa7')]('START\x20CALLY\x20SQUARE');var _0x4c70fd=this[_0x908d('0xd')][_0x908d('0xa1')](_0x908d('0x1a0'));if(!_[_0x908d('0x3f')](_0x4c70fd[_0x908d('0x9f')])){this[_0x908d('0xd')][_0x908d('0x35')]=_0x4c70fd['extra'];}if(_0x4a1210[_0x908d('0xb5')]===_0x908d('0x1a1')){this[_0x908d('0xd')]['noop'](_0x908d('0x1a2'));return this['channel']['answer']();}return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x1a3'));};AGIVertices[_0x908d('0x10')]['subproject']=function(_0x1e828f){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1e828f[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x1e828f['project_id'])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x1e828f,_0x908d('0x1a4'));}var _0x1ea663=this[_0x908d('0x1a5')][_0x908d('0x6c')](this,_0x1e828f[_0x908d('0x1a6')]);if(!this['isConfigured'](_0x1ea663)){return this[_0x908d('0xd')]['error'](_0x1e828f,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1e828f['project_id']));}if(_0x1ea663===this[_0x908d('0xd')]['arg_1']){return this['channel'][_0x908d('0x2b')](_0x1e828f,_0x908d('0x1a7'));}this[_0x908d('0x34')][_0x908d('0x6c')](this,_0x1e828f,_0x1ea663);var _0x108978=this[_0x908d('0xd')][_0x908d('0x52')]('AGI',util[_0x908d('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x908d('0x1a8')]||_0x908d('0x1a9'),_0x1ea663,this[_0x908d('0xd')][_0x908d('0x38')]));if(_0x108978[_0x908d('0xae')]===-0x1){return _0x108978;}return this[_0x908d('0xd')][_0x908d('0xa7')](util['format'](_0x908d('0xbf'),_0x908d('0x1aa'),_0x1ea663));};AGIVertices[_0x908d('0x10')][_0x908d('0x1ab')]=function(_0x2b5f36){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2b5f36[_0x908d('0x36')]));var _0x2cc59c=this[_0x908d('0x1ac')]['sync'](this,_0x2b5f36[_0x908d('0x1ad')]);this[_0x908d('0x34')]['sync'](this,_0x2b5f36,_0x2b5f36[_0x908d('0x1ad')]);if(this['isConfigured'](_0x2b5f36[_0x908d('0xd5')])){var _0x56cc1a=this[_0x908d('0xa1')][_0x908d('0x6c')](this,_0x2b5f36[_0x908d('0xd5')]);if(_0x56cc1a){this[_0x908d('0xd')]['setVariable'](_0x56cc1a,_0x2cc59c);return this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2b5f36['command'],_0x56cc1a));}}return this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')](_0x908d('0x1ae'),_0x2b5f36[_0x908d('0x1ad')]));};AGIVertices[_0x908d('0x10')][_0x908d('0x1af')]=function(_0x4cc2f6){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x4cc2f6[_0x908d('0x36')]));_0x4cc2f6[_0x908d('0x58')]=_0x4cc2f6[_0x908d('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x908d('0x83')](_0x4cc2f6[_0x908d('0x56')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0x1b0'));}if(!this[_0x908d('0x83')](_0x4cc2f6[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')](_0x908d('0xa8'));}this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x1b1'),_0x4cc2f6['text']));var _0x1e3d4f=this[_0x908d('0x55')][_0x908d('0x6c')](this,_0x4cc2f6);if(_0x1e3d4f){this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x1b2'),_0x1e3d4f));var _0x21cd7b=this[_0x908d('0xd')][_0x908d('0xff')](_0x1e3d4f);try{fs['unlink'](_0x1e3d4f+_0x908d('0x14f'));}catch(_0x148273){logger[_0x908d('0x2b')](_0x148273);}return _0x21cd7b;}return this[_0x908d('0xd')]['error'](_0x4cc2f6,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x908d('0x10')][_0x908d('0x1b3')]=function(_0x493f6f){logger[_0x908d('0x2d')](util['format'](_0x908d('0x1b4'),_0x493f6f['label']));_0x493f6f[_0x908d('0x58')]=_0x493f6f[_0x908d('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x908d('0x83')](_0x493f6f[_0x908d('0x58')])){return this[_0x908d('0xd')][_0x908d('0xa7')]('no\x20text\x20configured');}this['channel'][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0x1b5'),_0x493f6f[_0x908d('0x58')]));var _0x1e7b0f=this['googleTTS'][_0x908d('0x6c')](this,_0x493f6f);if(_0x1e7b0f){this['channel']['noop'](util[_0x908d('0x28')](_0x908d('0x1b6'),_0x1e7b0f));var _0x47afb4=this[_0x908d('0xd')][_0x908d('0xff')](_0x1e7b0f);try{fs[_0x908d('0x100')](_0x1e7b0f+_0x908d('0x14f'));}catch(_0x3647f3){logger[_0x908d('0x2b')](_0x3647f3);}return _0x47afb4;}return this[_0x908d('0xd')][_0x908d('0x2b')](_0x493f6f,_0x908d('0x1b7'));};AGIVertices['prototype'][_0x908d('0x1b8')]=function(_0x11e8f8){logger['info'](util[_0x908d('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x11e8f8[_0x908d('0x36')]));if(!this[_0x908d('0x83')](_0x11e8f8[_0x908d('0x152')])){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x11e8f8,_0x908d('0x159'));}logger[_0x908d('0x2d')](util[_0x908d('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x908d('0x3a')],_0x11e8f8[_0x908d('0x152')]));var _0x54681e=this[_0x908d('0x4d')]['sync'](this,_0x11e8f8[_0x908d('0x152')]);if(_0x54681e){logger[_0x908d('0x2d')](util[_0x908d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x908d('0xd')][_0x908d('0x3a')],_0x11e8f8[_0x908d('0x152')]));this[_0x908d('0xd')]['noop'](util[_0x908d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x908d('0xd')]['callerid'],_0x11e8f8[_0x908d('0x152')]));return{'code':0xc8,'result':_0x908d('0x155')};}else{logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x156'),this[_0x908d('0xd')]['callerid'],_0x11e8f8[_0x908d('0x152')]));this['channel'][_0x908d('0xa7')](util['format'](_0x908d('0x156'),this[_0x908d('0xd')][_0x908d('0x3a')],_0x11e8f8[_0x908d('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x908d('0x1b9')]=function(_0x230786){logger[_0x908d('0x2d')](util[_0x908d('0x28')](_0x908d('0x1ba'),_0x230786['label']));var _0xe9354e=this[_0x908d('0xd')][_0x908d('0x52')](_0x908d('0x1bb'),[_0x230786['mailbox'],_0x230786[_0x908d('0x74')]]);if(_0xe9354e[_0x908d('0xae')]===-0x1){return _0xe9354e;}return this[_0x908d('0xd')][_0x908d('0xa7')](util[_0x908d('0x28')](_0x908d('0xbf'),_0x908d('0x1bb'),_0x230786['mailbox']));};AGIVertices[_0x908d('0x10')][_0x908d('0x1bc')]=function(_0x1a3d48){logger[_0x908d('0x2d')](util['format'](_0x908d('0x1bd'),_0x1a3d48['label']));if(!this[_0x908d('0x83')](_0x1a3d48[_0x908d('0xd5')])){return this['channel'][_0x908d('0x2b')](_0x1a3d48,'no\x20variable\x20selected');}var _0x2750f1=this['getVariable'][_0x908d('0x6c')](this,_0x1a3d48[_0x908d('0xd5')]);if(!_0x2750f1){return this[_0x908d('0xd')][_0x908d('0x2b')](_0x1a3d48,_0x908d('0xd7'));}var _0x1d537b=this[_0x908d('0xd')][_0x908d('0xa1')](_0x2750f1);return{'code':0xc8,'result':_0x1d537b['extra']?_0x1d537b[_0x908d('0x9f')]:'-'};};String[_0x908d('0x10')][_0x908d('0x9e')]=function(_0x3f369e,_0x35d48e){return this['split'](_0x3f369e)['join'](_0x35d48e);};module['exports']=AGIVertices; \ No newline at end of file +var _0xed95=['SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','generate','hiddendigitspos','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','%s/recordings/%s','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','name','getTrunk','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','timeout','number','includes','POST','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','computedVariables','sync','render','url','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','agicommand','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','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','no\x20list\x20selected','add','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','no\x20query\x20configured','replace','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name'];(function(_0x3bd498,_0x2cf55b){var _0x1743b4=function(_0x412f38){while(--_0x412f38){_0x3bd498['push'](_0x3bd498['shift']());}};_0x1743b4(++_0x2cf55b);}(_0xed95,0xb9));var _0x5ed9=function(_0x1db547,_0x55d50e){_0x1db547=_0x1db547-0x0;var _0x1f1a58=_0xed95[_0x1db547];return _0x1f1a58;};'use strict';var fs=require('fs');var util=require(_0x5ed9('0x0'));var _=require(_0x5ed9('0x1'));var sh=require(_0x5ed9('0x2'));var odbc=require(_0x5ed9('0x3'))();var rs=require(_0x5ed9('0x4'));var moment=require(_0x5ed9('0x5'));var Mustache=require(_0x5ed9('0x6'));var rp=require(_0x5ed9('0x7'));var logger=require(_0x5ed9('0x8'))(_0x5ed9('0x9'));var config=require(_0x5ed9('0xa'));var scripts=require(_0x5ed9('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x5ed9('0xc')];var verticesWithRetry=[_0x5ed9('0xd'),_0x5ed9('0xe'),_0x5ed9('0xf')];var AGIVertices=function(_0x2d5474,_0x40e8eb,_0x5b48b1){this['channel']=_0x2d5474;this[_0x5ed9('0x10')]=_0x40e8eb;this[_0x5ed9('0x11')]=_0x5b48b1;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x13')]=function(_0x526924,_0x575782){this[_0x5ed9('0x10')][_0x5ed9('0x14')](_0x526924)[_0x5ed9('0x15')](function(_0x2ed72e){_0x575782(null,_0x2ed72e?_0x2ed72e['name']:![]);})[_0x5ed9('0x16')](function(_0x110d83){_0x575782(_0x110d83);});};AGIVertices[_0x5ed9('0x12')]['getVoiceQueue']=function(_0x56695a,_0x3de296){this[_0x5ed9('0x10')]['getVoiceQueueById'](_0x56695a)[_0x5ed9('0x15')](function(_0x34ed28){_0x3de296(null,_0x34ed28?_0x34ed28['name']:![]);})['catch'](function(_0x1d2d60){_0x3de296(_0x1d2d60);});};AGIVertices[_0x5ed9('0x12')]['getSquareProject']=function(_0x3de09e,_0x10b784){this['rpc'][_0x5ed9('0x17')](_0x3de09e)[_0x5ed9('0x15')](function(_0x54a570){_0x10b784(null,_0x54a570?_0x54a570['name']:![]);})['catch'](function(_0x510ffe){_0x10b784(_0x510ffe);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x18')]=function(_0x3892d8,_0x44b8ca){this['rpc'][_0x5ed9('0x19')](_0x3892d8)[_0x5ed9('0x15')](function(_0x5cb2c1){_0x44b8ca(null,_0x5cb2c1?_0x5cb2c1['dsn']:![]);})['catch'](function(_0x302ec1){_0x44b8ca(_0x302ec1);});};AGIVertices[_0x5ed9('0x12')]['getUser']=function(_0x5eda05,_0xe7680){this[_0x5ed9('0x10')][_0x5ed9('0x1a')](_0x5eda05)['then'](function(_0x18b8c8){_0xe7680(null,_0x18b8c8?_0x18b8c8[_0x5ed9('0x1b')]:![]);})[_0x5ed9('0x16')](function(_0x40244e){_0xe7680(_0x40244e);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1c')]=function(_0x5da4d5,_0x492f36){this[_0x5ed9('0x10')][_0x5ed9('0x1d')](_0x5da4d5)[_0x5ed9('0x15')](function(_0x5b56df){_0x492f36(null,_0x5b56df?_0x5b56df['name']:![]);})[_0x5ed9('0x16')](function(_0x3a4968){_0x492f36(_0x3a4968);});};AGIVertices[_0x5ed9('0x12')]['getSound']=function(_0x1bc137,_0x7de1d2){var _0x389a73=this;this['rpc'][_0x5ed9('0x1e')](_0x1bc137)[_0x5ed9('0x15')](function(_0x411729){_0x7de1d2(null,_0x411729?_0x389a73[_0x5ed9('0x1f')](_0x411729['save_name']):![]);})['catch'](function(_0x43863c){_0x7de1d2(_0x43863c);});};AGIVertices['prototype'][_0x5ed9('0x20')]=function(_0xb39190,_0x1585e3){this[_0x5ed9('0x10')][_0x5ed9('0x21')](_0xb39190)[_0x5ed9('0x15')](function(_0xba5b97){_0x1585e3(null,_0xba5b97?_0xba5b97:![]);})['catch'](function(_0x58e2d0){_0x1585e3(_0x58e2d0);});};AGIVertices['prototype'][_0x5ed9('0x22')]=function(_0x36d050,_0x2cb3d2,_0x5da46e){this[_0x5ed9('0x11')]['sendMailMessage'](_0x36d050,_0x2cb3d2)[_0x5ed9('0x15')](function(){_0x5da46e(null);})[_0x5ed9('0x16')](function(_0x3061cd){_0x5da46e(_0x3061cd);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x23')]=function(_0x448778,_0x4a6567){this[_0x5ed9('0x10')][_0x5ed9('0x24')](_0x448778)[_0x5ed9('0x15')](function(_0x4c573e){if(_0x4c573e){if(_0x4c573e['IntervalId']){_0x4a6567(null,[_0x4c573e[_0x5ed9('0x25')]]);}else{_0x4a6567(null,_[_0x5ed9('0x26')](_0x4c573e['Intervals'],'interval'));}}else{_0x4a6567(null,![]);}})[_0x5ed9('0x16')](function(_0x1536c3){_0x4a6567(_0x1536c3);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1f')]=function(_0x29346d){return util[_0x5ed9('0x27')](_0x5ed9('0x28'),FILES_PATH,_0x29346d);};AGIVertices[_0x5ed9('0x12')]['getQueryOdbc']=function(_0x4bfe28,_0x59896b,_0x4699a0){odbc[_0x5ed9('0x29')](_0x4bfe28,function(_0x4f261f){if(_0x4f261f){logger[_0x5ed9('0x2a')](_0x5ed9('0x2b'),_0x4f261f);_0x4699a0(_0x4f261f);}else{logger[_0x5ed9('0x2c')](_0x5ed9('0x2d'));odbc['query'](_0x59896b,function(_0x34e190,_0x89486e){if(_0x34e190){logger[_0x5ed9('0x2c')](_0x5ed9('0x2e'),_0x59896b);_0x4699a0(_0x34e190);}else{logger[_0x5ed9('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x59896b);odbc[_0x5ed9('0x2f')](function(_0x2f728e){if(_0x2f728e){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x2f728e);}_0x4699a0(null,_0x89486e);});}});}});};AGIVertices[_0x5ed9('0x12')]['getSmsAccount']=function(_0x4fedbe,_0x5a9287){this[_0x5ed9('0x10')][_0x5ed9('0x30')](_0x4fedbe)['then'](function(_0x5f20a1){_0x5a9287(null,_0x5f20a1?_0x5f20a1:![]);})[_0x5ed9('0x16')](function(_0xb6ac0d){_0x5a9287(_0xb6ac0d);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x31')]=function(_0x3c4bbe,_0x3e844b){this[_0x5ed9('0x10')][_0x5ed9('0x31')](_0x3c4bbe)[_0x5ed9('0x15')](function(_0xbc9f61){_0x3e844b(null,_0xbc9f61);})[_0x5ed9('0x16')](function(_0xba8cc){_0x3e844b(_0xba8cc);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x32')]=function(_0x5b61af,_0x4494d1,_0x18bf88){this[_0x5ed9('0x10')][_0x5ed9('0x32')]({'uniqueid':this[_0x5ed9('0x33')]['uniqueid'],'node':_0x5b61af[_0x5ed9('0x34')],'application':_0x5b61af['agicommand'],'data':_0x4494d1||null,'project_name':this[_0x5ed9('0x33')][_0x5ed9('0x35')],'callerid':this[_0x5ed9('0x33')][_0x5ed9('0x36')]})[_0x5ed9('0x15')](function(_0x38e960){if(_0x18bf88){_0x18bf88(null,_0x38e960);}})[_0x5ed9('0x16')](function(_0x53c64f){if(_0x18bf88){_0x18bf88(_0x53c64f);}});};AGIVertices['prototype'][_0x5ed9('0x37')]=function(_0x41a1bf,_0x5a0ea6,_0x39ea43,_0x290508){this['rpc']['createSquareRecording']({'uniqueid':this[_0x5ed9('0x33')][_0x5ed9('0x38')],'callerid':this['channel'][_0x5ed9('0x36')],'calleridname':this[_0x5ed9('0x33')][_0x5ed9('0x39')],'context':this[_0x5ed9('0x33')][_0x5ed9('0x3a')],'extension':this[_0x5ed9('0x33')][_0x5ed9('0x3b')],'priority':this[_0x5ed9('0x33')][_0x5ed9('0x3c')],'accountcode':this[_0x5ed9('0x33')][_0x5ed9('0x3d')],'dnid':this[_0x5ed9('0x33')][_0x5ed9('0x3e')],'projectName':this['channel'][_0x5ed9('0x35')],'saveName':_0x5a0ea6,'filename':_0x41a1bf[_0x5ed9('0x3f')]||_0x5a0ea6,'savePath':_0x39ea43})[_0x5ed9('0x15')](function(_0x5e6515){_0x290508(null,_0x5e6515);})[_0x5ed9('0x16')](function(_0x4e65ed){_0x290508(_0x4e65ed);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x40')]=function(_0x1acd7b,_0x77d6df,_0x24b54,_0x3717fb,_0x17c434){this[_0x5ed9('0x10')][_0x5ed9('0x40')]({'uniqueid':this[_0x5ed9('0x33')][_0x5ed9('0x38')],'body':_0x1acd7b,'direction':_0x77d6df,'providerName':_0x24b54,'providerResponse':_0x3717fb})[_0x5ed9('0x15')](function(_0x533510){if(_0x17c434){_0x17c434(null,_0x533510);}})[_0x5ed9('0x16')](function(_0x1b5ff9){if(_0x17c434){_0x17c434(_0x1b5ff9);}});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x41')]=function(_0x2ca6d7,_0x550892){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x2ca6d7['name'])||_[_0x5ed9('0x42')](_0x2ca6d7[_0x5ed9('0x1b')])?_0x5ed9('0x43')+Math[_0x5ed9('0x44')]():_0x2ca6d7[_0x5ed9('0x1b')],'lastName':_[_0x5ed9('0x45')](_0x2ca6d7[_0x5ed9('0x46')])||_[_0x5ed9('0x42')](_0x2ca6d7[_0x5ed9('0x46')])?null:_0x2ca6d7[_0x5ed9('0x46')],'phone':_0x2ca6d7[_0x5ed9('0x47')],'ListId':_0x2ca6d7[_0x5ed9('0x48')],'scheduledat':_0x2ca6d7[_0x5ed9('0x49')],'callbackUniqueid':this[_0x5ed9('0x33')]['uniqueid'],'tags':_0x5ed9('0x4a'),'description':_0x5ed9('0x4b')+_0x2ca6d7[_0x5ed9('0x49')][_0x5ed9('0x4c')](),'priority':_0x2ca6d7[_0x5ed9('0x4d')]})[_0x5ed9('0x15')](function(_0x5a090d){_0x550892(null,_0x5a090d);})[_0x5ed9('0x16')](function(_0x5dda6c){_0x550892(_0x5dda6c);});};AGIVertices['prototype'][_0x5ed9('0x4e')]=function(_0x53206f,_0x8fe239){this[_0x5ed9('0x10')]['getPauseById'](_0x53206f)[_0x5ed9('0x15')](function(_0x1bf047){_0x8fe239(null,_0x1bf047?_0x1bf047[_0x5ed9('0x1b')]:![]);})[_0x5ed9('0x16')](function(_0x573530){_0x8fe239(_0x573530);});};AGIVertices['prototype']['agentPause']=function(_0x354f7a,_0x2a66a6,_0x5f41d6){var _0x2e6f74={'role':_0x5ed9('0x4f')};_0x2e6f74[_0x354f7a]=this['channel'][_0x5ed9('0x36')];this[_0x5ed9('0x10')]['agentPause'](_0x2e6f74,_0x2a66a6,this[_0x5ed9('0x33')][_0x5ed9('0x38')])[_0x5ed9('0x15')](function(_0x4acc3d){_0x5f41d6(null,_[_0x5ed9('0x42')](_0x4acc3d)?![]:!![]);})[_0x5ed9('0x16')](function(_0x33f184){logger[_0x5ed9('0x2a')](_0x33f184);_0x5f41d6(null,![]);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x50')]=function(_0x21be65,_0xe72d99){var _0x59ecf6={'role':_0x5ed9('0x4f')};_0x59ecf6[_0x21be65]=this[_0x5ed9('0x33')][_0x5ed9('0x36')];this[_0x5ed9('0x10')][_0x5ed9('0x50')](_0x59ecf6)[_0x5ed9('0x15')](function(_0x252cac){_0xe72d99(null,_[_0x5ed9('0x42')](_0x252cac)?![]:!![]);})[_0x5ed9('0x16')](function(_0x1f6767){logger[_0x5ed9('0x2a')](_0x1f6767);_0xe72d99(null,![]);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x51')]=function(_0xa68a6c,_0x1e6c73){var _0x3d51b6={'role':'agent'};_0x3d51b6[_0xa68a6c]=this[_0x5ed9('0x33')][_0x5ed9('0x36')];this['rpc'][_0x5ed9('0x51')](_0x3d51b6)[_0x5ed9('0x15')](function(_0x15b345){_0x1e6c73(null,_[_0x5ed9('0x42')](_0x15b345)?![]:!![]);})[_0x5ed9('0x16')](function(_0x23e16d){logger[_0x5ed9('0x2a')](_0x23e16d);_0x1e6c73(null,![]);});};AGIVertices[_0x5ed9('0x12')]['agentLogin']=function(_0x30b77e,_0x575398){var _0x510c19={'role':_0x5ed9('0x4f')};_0x510c19[_0x30b77e]=this[_0x5ed9('0x33')][_0x5ed9('0x36')];var _0x570fc3=_0x30b77e!=_0x5ed9('0x52')?util[_0x5ed9('0x27')](_0x5ed9('0x53'),_0x5ed9('0x54'),this[_0x5ed9('0x33')][_0x5ed9('0x36')]):undefined;this[_0x5ed9('0x10')]['agentLogin'](_0x510c19,_0x570fc3)['then'](function(_0x4d387c){_0x575398(null,_[_0x5ed9('0x42')](_0x4d387c)?![]:!![]);})[_0x5ed9('0x16')](function(_0x5c15d3){logger[_0x5ed9('0x2a')](_0x5c15d3);_0x575398(null,![]);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x55')]=function(_0x31efd8,_0x18b411){sh[_0x5ed9('0x56')](_[_0x5ed9('0x57')](_0x31efd8),function(_0x279257,_0x1c0012){var _0x246763=_0x1c0012['replace'](/(\r\n|\n|\r)/gm,'');_0x18b411(null,_0x246763);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x58')]=function(_0x19d09c,_0x36768c){scripts[_0x5ed9('0x58')](_0x19d09c[_0x5ed9('0x59')],_0x19d09c[_0x5ed9('0x5a')]||_0x5ed9('0x5b'),_0x19d09c[_0x5ed9('0x5b')],_0x19d09c[_0x5ed9('0x5c')]||_0x5ed9('0x5d'),_0x19d09c[_0x5ed9('0x5e')]||_0x5ed9('0x5f'),_0x19d09c['audioEncoding']||_0x5ed9('0x60'))['then'](function(_0x28d100){_0x36768c(null,_0x28d100);})[_0x5ed9('0x16')](function(_0x5aa5a8){_0x36768c(_0x5aa5a8);});};AGIVertices['prototype']['googleTTS']=function(_0x1088ef,_0x29f0f3){scripts[_0x5ed9('0x61')](_0x1088ef[_0x5ed9('0x5b')],_0x1088ef[_0x5ed9('0x62')]||'en',0x1)['then'](function(_0x5c05a4){_0x29f0f3(null,_0x5c05a4);})[_0x5ed9('0x16')](function(_0x2dba3b){_0x29f0f3(_0x2dba3b);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x63')]=function(_0x55821c,_0x5bf1c0){var _0xbe0e06={'uri':_0x55821c['url'],'method':_0x55821c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x55821c[_0x5ed9('0x64')])===_0x5ed9('0x65')&&parseInt(_0x55821c[_0x5ed9('0x64')])>=0x1?parseInt(_0x55821c['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x5ed9('0x66')]([_0x5ed9('0x67'),'PUT'],_0xbe0e06[_0x5ed9('0x68')][_0x5ed9('0x69')]())){try{_0xbe0e06[_0x5ed9('0x6a')]=_0x55821c[_0x5ed9('0xc')]?JSON['parse'](_0x55821c[_0x5ed9('0xc')]):{};}catch(_0x5bdb42){logger[_0x5ed9('0x2a')](_0x5ed9('0x6b'),_0x5bdb42);}}try{_0xbe0e06[_0x5ed9('0x6c')]=_0x55821c[_0x5ed9('0x6d')]?JSON[_0x5ed9('0x6e')](_0x55821c['rawHeaders']):{};}catch(_0x4d105e){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4d105e);}if(_0x55821c[_0x5ed9('0x6f')]){try{var _0xa3e738=require(_0x55821c[_0x5ed9('0x6f')])[_0x5ed9('0x70')](this,_0xbe0e06);_0xbe0e06['uri']=Mustache[_0x5ed9('0x71')](_0x55821c[_0x5ed9('0x72')],_0xa3e738,{},['$$','$$']);if(_0xbe0e06['headers']){_0xbe0e06[_0x5ed9('0x6c')]=JSON[_0x5ed9('0x6e')](Mustache[_0x5ed9('0x71')](JSON[_0x5ed9('0x73')](_0xbe0e06[_0x5ed9('0x6c')]),_0xa3e738,{},['$$','$$']));}if(_0xbe0e06['body']){_0xbe0e06[_0x5ed9('0x6a')]=JSON[_0x5ed9('0x6e')](Mustache[_0x5ed9('0x71')](JSON[_0x5ed9('0x73')](_0xbe0e06[_0x5ed9('0x6a')]),_0xa3e738,{},['$$','$$']));}}catch(_0x24d9fe){logger[_0x5ed9('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x24d9fe);}}rp(_0xbe0e06)[_0x5ed9('0x15')](function(_0x174a48){var _0x4200dd={'statusCode':_0x174a48[_0x5ed9('0x74')]||0xc8,'statusMessage':_0x174a48[_0x5ed9('0x75')]||'OK','headers':_0x174a48[_0x5ed9('0x6c')]||{},'body':_0x174a48['body']||{}};_0x5bf1c0(null,_0x4200dd);})[_0x5ed9('0x16')](function(_0x38176b){var _0x2fa06e={'statusCode':_0x38176b[_0x5ed9('0x74')]||0x1f4,'statusMessage':_0x38176b['message']||_0x5ed9('0x76'),'headers':_0x38176b['options'][_0x5ed9('0x6c')]||{},'body':_0x38176b[_0x5ed9('0x77')][_0x5ed9('0x6a')]||{}};_0x5bf1c0(null,_0x2fa06e);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x78')]=function(_0x5db252,_0x37b98a){scripts[_0x5ed9('0x78')](this[_0x5ed9('0x33')][_0x5ed9('0x38')],_0x5db252['key'],_0x5db252[_0x5ed9('0x5b')],_0x5db252[_0x5ed9('0x79')]||'en')[_0x5ed9('0x15')](function(_0x5d5ff3){_0x37b98a(null,_0x5d5ff3);})[_0x5ed9('0x16')](function(_0x44afb0){_0x37b98a(_0x44afb0);});};AGIVertices['prototype'][_0x5ed9('0x7a')]=function(_0x2d8868,_0x2164f1){scripts['googleDialogflowV2'](this[_0x5ed9('0x33')][_0x5ed9('0x38')],_0x2d8868[_0x5ed9('0x7b')],_0x2d8868[_0x5ed9('0x7c')],_0x2d8868[_0x5ed9('0x7d')],_0x2d8868[_0x5ed9('0x5b')],_0x2d8868[_0x5ed9('0x7e')]||'en')[_0x5ed9('0x15')](function(_0x43c8c7){_0x2164f1(null,_0x43c8c7);})[_0x5ed9('0x16')](function(_0x9a16d5){_0x2164f1(_0x9a16d5);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x7f')]=function(_0x548fee,_0x1185c8){scripts[_0x5ed9('0x7f')](this[_0x5ed9('0x33')],_0x548fee)[_0x5ed9('0x15')](function(_0x5bc97c){_0x1185c8(null,_0x5bc97c);})['catch'](function(_0x12fc45){_0x1185c8(_0x12fc45);});};AGIVertices[_0x5ed9('0x12')]['ispeechTTS']=function(_0x508e02,_0x1ddcc8){scripts['ispeechTTS'](_0x508e02[_0x5ed9('0x80')],_0x508e02[_0x5ed9('0x5b')],_0x508e02[_0x5ed9('0x81')]||_0x5ed9('0x5d'),_0x508e02[_0x5ed9('0x82')])[_0x5ed9('0x15')](function(_0x5d5d10){_0x1ddcc8(null,_0x5d5d10);})['catch'](function(_0x323e4f){_0x1ddcc8(_0x323e4f);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x83')]=function(_0x3fad48,_0x511069,_0x2da35f){scripts['ispeechASR'](_0x511069,_0x3fad48[_0x5ed9('0x80')],_0x3fad48[_0x5ed9('0x84')]||_0x5ed9('0x5d'),this[_0x5ed9('0x85')](_0x3fad48[_0x5ed9('0x86')])?_0x3fad48['model']:undefined)[_0x5ed9('0x15')](function(_0x1d8ce2){_0x2da35f(null,_0x1d8ce2);})[_0x5ed9('0x16')](function(_0x3994a0){_0x2da35f(_0x3994a0);});};AGIVertices['prototype']['awsPolly']=function(_0x4701a2,_0x4b84ad){scripts[_0x5ed9('0x87')](_0x4701a2[_0x5ed9('0x88')],_0x4701a2['aws_secret_access_key'],_0x4701a2['aws_polly_region'],_0x4701a2['aws_polly_voice']||_0x5ed9('0x89'),_0x4701a2[_0x5ed9('0x5b')],_0x4701a2[_0x5ed9('0x8a')]||'text')[_0x5ed9('0x15')](function(_0x4d438e){_0x4b84ad(null,_0x4d438e);})[_0x5ed9('0x16')](function(_0x46629f){_0x4b84ad(_0x46629f);});};AGIVertices[_0x5ed9('0x12')]['awsLex']=function(_0xa2b99e,_0x1481bf){scripts[_0x5ed9('0x8b')](this[_0x5ed9('0x33')][_0x5ed9('0x38')],_0xa2b99e[_0x5ed9('0x88')],_0xa2b99e[_0x5ed9('0x8c')],_0xa2b99e[_0x5ed9('0x8d')],_0xa2b99e[_0x5ed9('0x5b')],_0xa2b99e[_0x5ed9('0x8e')])[_0x5ed9('0x15')](function(_0x2b1032){_0x1481bf(null,_0x2b1032);})[_0x5ed9('0x16')](function(_0x308015){_0x1481bf(_0x308015);});};AGIVertices[_0x5ed9('0x12')]['googleASR']=function(_0x16c26e,_0xbd9ea,_0x5ad38f){scripts[_0x5ed9('0x8f')](_0xbd9ea,_0x16c26e[_0x5ed9('0x80')],_0x16c26e['google_asr_language']||_0x5ed9('0x5d'))['then'](function(_0x28a050){_0x5ad38f(null,_0x28a050);})[_0x5ed9('0x16')](function(_0x23f6dc){_0x5ad38f(_0x23f6dc);});};AGIVertices[_0x5ed9('0x12')]['tildeASR']=function(_0x3b9d38,_0x483aa0,_0x203dbd){scripts[_0x5ed9('0x90')](_0x483aa0,_0x3b9d38[_0x5ed9('0x91')],_0x3b9d38[_0x5ed9('0x92')],_0x3b9d38[_0x5ed9('0x93')])[_0x5ed9('0x15')](function(_0xda9d33){_0x203dbd(null,_0xda9d33);})[_0x5ed9('0x16')](function(_0x97d3aa){_0x203dbd(_0x97d3aa);});};AGIVertices[_0x5ed9('0x12')]['clear']=function(_0x2d4236){var _0x7d5055=_[_0x5ed9('0x66')](verticesWithRetry,_0x2d4236[_0x5ed9('0x94')])?_0x2d4236:_['clone'](_0x2d4236);for(var _0x482ff1 in _0x7d5055){if(_0x7d5055[_0x5ed9('0x95')](_0x482ff1)){if(_0x7d5055[_0x482ff1]&&_['isString'](_0x7d5055[_0x482ff1])){if(_[_0x5ed9('0x66')](recursiveMapAttributes,_0x482ff1)){_0x7d5055[_0x482ff1]=this['replaceObjectAllVariables'](_0x7d5055[_0x482ff1]);}else{_0x7d5055[_0x482ff1]=this[_0x5ed9('0x96')](_0x7d5055[_0x482ff1]);}}}}return _0x7d5055;};AGIVertices['prototype'][_0x5ed9('0x97')]=function(_0x28abb9){for(var _0x14b4c0 in _0x28abb9){if(_0x28abb9[_0x5ed9('0x95')](_0x14b4c0)){if(_['isPlainObject'](_0x28abb9[_0x14b4c0])){this['recursiveNodeIndex'](_0x28abb9[_0x14b4c0]);}else if(_[_0x5ed9('0x98')](_0x28abb9[_0x14b4c0])){for(var _0x4a8455=0x0;_0x4a8455<_0x28abb9[_0x14b4c0][_0x5ed9('0x99')];_0x4a8455++){this[_0x5ed9('0x97')](_0x28abb9[_0x14b4c0][_0x4a8455]);}}else if(_[_0x5ed9('0x9a')](_0x28abb9[_0x14b4c0])){_0x28abb9[_0x14b4c0]=this[_0x5ed9('0x96')](_0x28abb9[_0x14b4c0]);}}}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x9b')]=function(_0x442c46,_0x5638d0){for(var _0xd776a7 in _0x442c46){if(_0x442c46[_0x5ed9('0x95')](_0xd776a7)){if(_[_0x5ed9('0x9c')](_0x442c46[_0xd776a7])){if(!_[_0x5ed9('0x45')](_0x442c46[_0xd776a7])){this[_0x5ed9('0x9b')](_0x442c46[_0xd776a7],util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x5638d0,_0xd776a7));}}else if(_[_0x5ed9('0x98')](_0x442c46[_0xd776a7])){for(var _0xc7e0ae=0x0;_0xc7e0ae<_0x442c46[_0xd776a7][_0x5ed9('0x99')];_0xc7e0ae++){this[_0x5ed9('0x9b')](_0x442c46[_0xd776a7][_0xc7e0ae],util[_0x5ed9('0x27')]('%s.%s',_0x5638d0,_0xd776a7+'['+_0xc7e0ae+']'));}}else{if(!_[_0x5ed9('0x42')](_0x442c46[_0xd776a7])){this['channel'][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x5638d0,_0xd776a7),_0x442c46[_0xd776a7]);}}}}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x9f')]=function(_0x27ebd5){try{var _0xfb4219=JSON[_0x5ed9('0x6e')](_0x27ebd5);this['recursiveNodeIndex'](_0xfb4219);return JSON['stringify'](_0xfb4219);}catch(_0x4a13f6){return this[_0x5ed9('0x96')](_0x27ebd5);}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x96')]=function(_0x776c98){var _0xcd09fc=_0x776c98[_0x5ed9('0xa0')]('{');for(var _0x203b55=0x1;_0x203b55<_0xcd09fc[_0x5ed9('0x99')];_0x203b55+=0x1){var _0x437d69=_0xcd09fc[_0x203b55]['split']('}');if(_0x437d69[_0x5ed9('0x99')]>0x1){_0x776c98=_0x776c98[_0x5ed9('0xa1')]('{'+_0x437d69[0x0]+'}',this[_0x5ed9('0x33')][_0x5ed9('0x13')](_0x437d69[0x0])[_0x5ed9('0xa2')]||_0x437d69[0x0]);}}if(_0xcd09fc[_0x5ed9('0x99')]===0x1){return _0x776c98[_0x5ed9('0x4c')]();}return this['replaceAllVariables'](_0x776c98);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xa3')]=function(_0x2e143f,_0x5e6f9f){var _0x5d6141=this[_0x5ed9('0x33')][_0x5ed9('0x13')](_0x2e143f);if(_0x5d6141[_0x5ed9('0xa4')]===-0x1){return _0x5d6141;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5e6f9f,_0x5d6141[_0x5ed9('0xa2')]));return this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x5e6f9f,_0x5d6141[_0x5ed9('0xa2')]);};AGIVertices['prototype']['isConfigured']=function(_0x5d5b6d){return _0x5d5b6d&&_0x5d5b6d!=='0'&&_0x5d5b6d!=='-1'&&_0x5d5b6d!=='';};AGIVertices[_0x5ed9('0x12')]['maxRetry']=function(_0xee1a2d){this[_0x5ed9('0x32')]['sync'](this,_0xee1a2d,'-');_0xee1a2d[_0x5ed9('0xa5')]=_0xee1a2d[_0x5ed9('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xa7')]=function(_0x261853){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xa8'),_0x261853[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x261853['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}var _0x30846e='\x22'+_0x261853[_0x5ed9('0x5b')]+'\x22';if(this[_0x5ed9('0x85')](_0x261853['options'])){_0x30846e+=','+_0x261853[_0x5ed9('0x77')];}var _0x1f6a3c=this[_0x5ed9('0x33')]['exec'](_0x5ed9('0xab'),_0x30846e);if(_0x1f6a3c[_0x5ed9('0xa4')]===-0x1){return _0x1f6a3c;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xac'),_0x30846e));};AGIVertices[_0x5ed9('0x12')]['mrcprecog']=function(_0x6fb15f){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xad'),_0x6fb15f[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x6fb15f[_0x5ed9('0xae')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20grammar\x20configured');}var _0x6d7e5e=_0x6fb15f['grammar'];if(this['isConfigured'](_0x6fb15f[_0x5ed9('0x77')])){_0x6d7e5e+=','+_0x6fb15f['options'];}var _0x5a714b=this[_0x5ed9('0x33')][_0x5ed9('0x56')]('MRCPRecog',_0x6d7e5e);if(_0x5a714b[_0x5ed9('0xa4')]===-0x1){return _0x5a714b;}var _0x4e3bd8=this[_0x5ed9('0xa3')](_0x5ed9('0xaf'),_0x5ed9('0xb0'));if(_0x4e3bd8['result']===-0x1){return _0x4e3bd8;}var _0x497fca=this['getAndSetVariable'](_0x5ed9('0xb1'),'MRCP_RECOG_TRANSCRIPT');if(_0x497fca['result']===-0x1){return _0x497fca;}var _0x5c0b01=this['getAndSetVariable'](_0x5ed9('0xb2'),_0x5ed9('0xb3'));if(_0x5c0b01[_0x5ed9('0xa4')]===-0x1){return _0x5c0b01;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x6d7e5e));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x9')]=function(_0x7ae298){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xb4'),_0x7ae298[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')][_0x5ed9('0x9')]([_0x7ae298[_0x5ed9('0xb5')],_0x7ae298[_0x5ed9('0xb6')]]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xb7')]=function(_0x1dcc51){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xb8'),_0x1dcc51[_0x5ed9('0x34')]));if(this[_0x5ed9('0x85')](_0x1dcc51['timeout'])){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0xb9'),_0x1dcc51[_0x5ed9('0x64')]));var _0x20d284=this[_0x5ed9('0x33')]['wait'](_0x1dcc51['timeout']);if(_0x20d284[_0x5ed9('0xa4')]===-0x1){return _0x20d284;}}return this['channel'][_0x5ed9('0xb7')]();};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x4a')]=function(_0x455a84){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x455a84[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x455a84[_0x5ed9('0x48')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x455a84,_0x5ed9('0xba'));}_0x455a84[_0x5ed9('0x49')]=moment();if(this[_0x5ed9('0x85')](_0x455a84['delay'])){_0x455a84[_0x5ed9('0x49')]=moment()[_0x5ed9('0xbb')](_0x455a84[_0x5ed9('0xbc')],_0x5ed9('0xbd'));}if(!this[_0x5ed9('0x85')](_0x455a84[_0x5ed9('0x4d')])){_0x455a84[_0x5ed9('0x4d')]=0x2;}this[_0x5ed9('0x41')][_0x5ed9('0x70')](this,_0x455a84);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x455a84[_0x5ed9('0x47')],_0x455a84[_0x5ed9('0x48')],_0x455a84[_0x5ed9('0x49')]));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xbe')]=function(_0x11fdcf){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xbf'),_0x11fdcf[_0x5ed9('0x34')]));var _0x87b220=this[_0x5ed9('0x33')]['exec'](_0x11fdcf[_0x5ed9('0xc0')],_0x11fdcf['options']);if(_0x87b220[_0x5ed9('0xa4')]===-0x1){return _0x87b220;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s',_0x11fdcf[_0x5ed9('0xc0')],_0x11fdcf[_0x5ed9('0x77')]));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xc1')]=function(_0xacf47e){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xc2'),_0xacf47e[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0xacf47e['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}var _0x416f88='\x22'+_0xacf47e['text']+'\x22';if(this[_0x5ed9('0x85')](_0xacf47e[_0x5ed9('0x77')])){_0x416f88+=','+_0xacf47e[_0x5ed9('0x77')];}var _0x436b73=this[_0x5ed9('0x33')][_0x5ed9('0x56')]('MRCPSynth',_0x416f88);if(_0x436b73[_0x5ed9('0xa4')]===-0x1){return _0x436b73;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x416f88));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xc3')]=function(_0x22b027){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xc4'),_0x22b027[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x22b027['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}var _0x3ca355='\x22'+_0x22b027['text']+'\x22';if(this[_0x5ed9('0x85')](_0x22b027[_0x5ed9('0x77')])){_0x3ca355+=','+_0x22b027['options'];}var _0x594af1=this['channel']['exec'](_0x5ed9('0xab'),_0x3ca355);if(_0x594af1['result']===-0x1){return _0x594af1;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xac'),_0x3ca355));};AGIVertices['prototype']['lumenvoxasr']=function(_0x2f079c){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0xc5'),_0x2f079c[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x2f079c['grammar'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xc6'));}var _0x5f0fc3=_0x2f079c[_0x5ed9('0xae')];if(this[_0x5ed9('0x85')](_0x2f079c[_0x5ed9('0x77')])){_0x5f0fc3+=','+_0x2f079c['options'];}var _0x552d8b=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0xc7'),_0x5f0fc3);if(_0x552d8b[_0x5ed9('0xa4')]===-0x1){return _0x552d8b;}var _0x57a8f5=this[_0x5ed9('0xa3')](_0x5ed9('0xaf'),_0x5ed9('0xc8'));if(_0x57a8f5[_0x5ed9('0xa4')]===-0x1){return _0x57a8f5;}var _0x339976=this[_0x5ed9('0xa3')]('RECOG_INPUT()',_0x5ed9('0xc9'));if(_0x339976[_0x5ed9('0xa4')]===-0x1){return _0x339976;}var _0x48de82=this['getAndSetVariable'](_0x5ed9('0xb2'),_0x5ed9('0xca'));if(_0x48de82[_0x5ed9('0xa4')]===-0x1){return _0x48de82;}return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xcb'),_0x5f0fc3));};AGIVertices[_0x5ed9('0x12')]['sestekasr']=function(_0x1b1be0){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xcc'),_0x1b1be0[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x1b1be0['grammar'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xc6'));}var _0x52412c=_0x1b1be0[_0x5ed9('0xae')];if(this[_0x5ed9('0x85')](_0x1b1be0[_0x5ed9('0x77')])){_0x52412c+=','+_0x1b1be0[_0x5ed9('0x77')];}var _0x4b8d23=this[_0x5ed9('0x33')]['exec']('MRCPRecog',_0x52412c);if(_0x4b8d23[_0x5ed9('0xa4')]===-0x1){return _0x4b8d23;}var _0x51ef1f=this[_0x5ed9('0xa3')](_0x5ed9('0xaf'),_0x5ed9('0xcd'));if(_0x51ef1f[_0x5ed9('0xa4')]===-0x1){return _0x51ef1f;}var _0x5835e9=this[_0x5ed9('0xa3')](_0x5ed9('0xb1'),'SESTEK_ASR_TRANSCRIPT');if(_0x5835e9[_0x5ed9('0xa4')]===-0x1){return _0x5835e9;}var _0x38719c=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x38719c['result']===-0x1){return _0x38719c;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xcb'),_0x52412c));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xce')]=function(_0x42fefd){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0xcf'),_0x42fefd[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x42fefd[_0x5ed9('0xd0')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x42fefd,'no\x20database\x20selected');}var _0x3c86d9=this[_0x5ed9('0x18')][_0x5ed9('0x70')](this,_0x42fefd['odbc_id']);if(!_0x3c86d9){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x42fefd,'no\x20odbc\x20database\x20found');}if(!this[_0x5ed9('0x85')](_0x42fefd[_0x5ed9('0xd1')])){return this['channel'][_0x5ed9('0x2a')](_0x42fefd,_0x5ed9('0xd2'));}var _0x4cb62c=_0x42fefd['query'][_0x5ed9('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5ed9('0xa9')](util['format']('query:\x20%s',_0x4cb62c));var _0x36205b=this[_0x5ed9('0xd4')][_0x5ed9('0x70')](this,_0x3c86d9,_0x4cb62c);this['createSquareDetailsReport']['sync'](this,_0x42fefd,_0x4cb62c);if(!this[_0x5ed9('0x85')](_0x42fefd['variable_id'])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0xd5'));}var _0x18e11f=this[_0x5ed9('0x13')]['sync'](this,_0x42fefd[_0x5ed9('0xd6')]);if(!_0x18e11f){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x42fefd,_0x5ed9('0xd7'));}var _0x21f0d2=this;_0x36205b[_0x5ed9('0xd8')](function(_0xb381c2,_0x583c90){Object[_0x5ed9('0xd9')](_0xb381c2)[_0x5ed9('0xd8')](function(_0x4c668f){_0x21f0d2[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0xda'),_0x18e11f,_0x583c90,_0x4c668f),_0xb381c2[_0x4c668f]);});});this['channel'][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0xdb'),_0x18e11f),_0x36205b[_0x5ed9('0x99')]);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xdc'),_0x18e11f));};AGIVertices[_0x5ed9('0x12')]['dial']=function(_0x3178af){logger[_0x5ed9('0xdd')](util[_0x5ed9('0x27')](_0x5ed9('0xde'),_0x3178af['label']));if(!this['isConfigured'](_0x3178af[_0x5ed9('0xdf')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3178af,_0x5ed9('0xe0'));}var _0x2d9594=this['getUser'][_0x5ed9('0x70')](this,_0x3178af[_0x5ed9('0xdf')]);if(!_0x2d9594){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3178af,'no\x20user\x20found');}var _0x330de6=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0xe1'),[util[_0x5ed9('0x27')](_0x5ed9('0xe2'),_0x2d9594),_0x3178af[_0x5ed9('0x64')],_0x3178af[_0x5ed9('0xe3')],_0x3178af['url']]);if(_0x330de6[_0x5ed9('0xa4')]===-0x1){return _0x330de6;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x572dc2){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0xe4'),_0x572dc2[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x572dc2[_0x5ed9('0x80')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xe5'));}if(!this[_0x5ed9('0x85')](_0x572dc2[_0x5ed9('0x5b')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')][_0x5ed9('0xe6')]=!![];this[_0x5ed9('0x32')](_0x572dc2);this[_0x5ed9('0x40')](_0x572dc2[_0x5ed9('0x5b')],'in','','');this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('Trying\x20Dialogflow:\x20%s',_0x572dc2[_0x5ed9('0x5b')]));var _0x60630d=this[_0x5ed9('0x78')][_0x5ed9('0x70')](this,_0x572dc2);if(_0x60630d){for(var _0x1a0cf8 in _0x60630d){if(_0x60630d['hasOwnProperty'](_0x1a0cf8)){this[_0x5ed9('0x33')]['setVariable'](util['format'](_0x5ed9('0xe7'),_0x1a0cf8[_0x5ed9('0x69')]()),_0x60630d[_0x1a0cf8]);}}this['createSquareMessage'](_0x60630d[_0x5ed9('0xe8')],_0x5ed9('0xe9'),_0x5ed9('0xea'),'');return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format'](_0x5ed9('0xeb'),_0x60630d['speech']));}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x572dc2,_0x5ed9('0xec'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xed')]=function(_0x323db1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x323db1[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7b')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xee'));}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7c')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xef'));}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7d')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20private_key\x20configured');}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7e')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xf0'));}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x5b')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this['channel'][_0x5ed9('0xe6')]=!![];this[_0x5ed9('0x32')](_0x323db1);this[_0x5ed9('0x40')](_0x323db1['text'],'in','','');this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xf1'),_0x323db1[_0x5ed9('0x5b')]));var _0x1eec46=this[_0x5ed9('0x7a')][_0x5ed9('0x70')](this,_0x323db1);if(_0x1eec46){for(var _0x24eed6 in _0x1eec46){if(_0x1eec46[_0x5ed9('0x95')](_0x24eed6)){if(_0x24eed6!==_0x5ed9('0xf2')){this[_0x5ed9('0x33')]['setVariable'](util[_0x5ed9('0x27')](_0x5ed9('0xe7'),_0x24eed6[_0x5ed9('0x69')]()),_0x1eec46[_0x24eed6]);}}}this[_0x5ed9('0x40')](_0x1eec46['speech'],'out',_0x5ed9('0xed'),_0x1eec46[_0x5ed9('0xf2')]);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format'](_0x5ed9('0xf3'),_0x1eec46[_0x5ed9('0xe8')]));}return this['channel'][_0x5ed9('0x2a')](_0x323db1,_0x5ed9('0xf4'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xf5')]=function(_0x21dc3e){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0xf6'),_0x21dc3e['label']));if(!this[_0x5ed9('0x85')](_0x21dc3e[_0x5ed9('0xf7')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xf8'));}if(!this[_0x5ed9('0x85')](_0x21dc3e[_0x5ed9('0xf9')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xfa'));}if(!this[_0x5ed9('0x85')](_0x21dc3e[_0x5ed9('0xfb')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20password\x20configured');}if(!this[_0x5ed9('0x85')](_0x21dc3e['ndassistant_url'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20text\x20configured');}this[_0x5ed9('0x33')][_0x5ed9('0xe6')]=!![];this[_0x5ed9('0x32')](_0x21dc3e);this['createSquareMessage'](_0x21dc3e['text'],'in','','');this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xfc'),_0x21dc3e[_0x5ed9('0x5b')]));var _0x49a0e8=this['sestekNDA']['sync'](this,_0x21dc3e);if(_0x49a0e8){for(var _0x4b95b7 in _0x49a0e8){if(_0x49a0e8[_0x5ed9('0x95')](_0x4b95b7)){this[_0x5ed9('0x33')]['setVariable'](util['format'](_0x5ed9('0xfd'),_0x4b95b7['toUpperCase']()),_0x49a0e8[_0x4b95b7]);}}this[_0x5ed9('0x40')](_0x49a0e8[_0x5ed9('0xe8')],_0x5ed9('0xe9'),_0x5ed9('0xf5'),'');if(_0x49a0e8[_0x5ed9('0xfe')]){this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xff'),_0x49a0e8[_0x5ed9('0xfe')]));var _0x547ebc=this[_0x5ed9('0x33')]['streamFile'](_0x49a0e8[_0x5ed9('0xfe')]);try{fs[_0x5ed9('0x100')](_0x49a0e8[_0x5ed9('0xfe')]+_0x5ed9('0x101'));}catch(_0x3dd1ea){logger[_0x5ed9('0x2a')](_0x3dd1ea);}return _0x547ebc;}else{return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('SestekNDA\x20Result\x20%s',_0x49a0e8['speech']));}}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x21dc3e,_0x5ed9('0x102'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x103')]=function(_0x1b20a8){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x104'),_0x1b20a8[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x103'));};AGIVertices['prototype']['ext_dial']=function(_0x283620){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x283620[_0x5ed9('0x34')]));var _0x1eb44e='';if(_0x283620['trunk_id']){if(!this['isConfigured'](_0x283620[_0x5ed9('0x105')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x283620,_0x5ed9('0x106'));}else{var _0x1350e7=parseInt(_0x283620[_0x5ed9('0x105')],0xa);if(isNaN(_0x1350e7)){_0x1eb44e=_0x283620[_0x5ed9('0x105')];}else{_0x1eb44e=this[_0x5ed9('0x1c')][_0x5ed9('0x70')](this,_0x283620['trunk_id']);if(!_0x1eb44e){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x283620,_0x5ed9('0x107'));}}}}else if(_0x283620[_0x5ed9('0x108')]){_0x1eb44e=_0x283620['trunk_name'];}else{return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x283620,_0x5ed9('0x106'));}var _0x2e6cc0=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0xe1'),[util['format'](_0x5ed9('0x109'),_0x1eb44e,_0x283620[_0x5ed9('0x47')]),_0x283620['timeout'],_0x283620[_0x5ed9('0xe3')],_0x283620[_0x5ed9('0x72')]]);if(_0x2e6cc0['result']===-0x1){return _0x2e6cc0;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x10a'),'DIAL'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x10b')]=function(_0x5700e1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5700e1['label']));return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('finally');};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xe')]=function(_0x3c2e8c){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x10c'),_0x3c2e8c[_0x5ed9('0x34')]));if(_0x3c2e8c[_0x5ed9('0xa5')]===0x0){return this[_0x5ed9('0xa6')](_0x3c2e8c);}_0x3c2e8c[_0x5ed9('0xa5')]-=0x1;if(!this[_0x5ed9('0x85')](_0x3c2e8c[_0x5ed9('0x10d')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3c2e8c,_0x5ed9('0x10e'));}var _0x7f634f=this[_0x5ed9('0x10f')][_0x5ed9('0x70')](this,_0x3c2e8c['file_id']);if(!_0x7f634f){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3c2e8c,_0x5ed9('0x110'));}if(!this[_0x5ed9('0x85')](_0x3c2e8c[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x5ed9('0xd5'));}var _0x4d7fab=this[_0x5ed9('0x33')][_0x5ed9('0x111')](_0x7f634f,_0x3c2e8c[_0x5ed9('0x112')],_0x3c2e8c[_0x5ed9('0x113')]);var _0x27500b=_0x4d7fab['result']?_0x4d7fab[_0x5ed9('0xa4')][_0x5ed9('0x4c')]():'';logger['info'](_0x5ed9('0x114'),JSON[_0x5ed9('0x73')](_0x4d7fab));if(_0x4d7fab[_0x5ed9('0xa4')]===-0x1){this[_0x5ed9('0x32')]['sync'](this,_0x3c2e8c,_0x27500b);return _0x4d7fab;}else if(_0x4d7fab['extra']===_0x5ed9('0x64')){_0x4d7fab['result']=_0x27500b[_0x5ed9('0x99')]>=parseInt(_0x3c2e8c['mindigit'])?'x':'i';}else{_0x4d7fab[_0x5ed9('0xa4')]=_0x27500b[_0x5ed9('0x99')]>=parseInt(_0x3c2e8c[_0x5ed9('0x115')])&&_0x27500b['length']<=parseInt(_0x3c2e8c[_0x5ed9('0x113')])?'x':'i';}var _0x37efee=this[_0x5ed9('0x13')][_0x5ed9('0x70')](this,_0x3c2e8c[_0x5ed9('0xd6')]);if(!_0x37efee){return this['channel'][_0x5ed9('0x2a')](_0x3c2e8c,'no\x20variable\x20found');}this['channel'][_0x5ed9('0x9e')](_0x37efee,_0x27500b);if(this[_0x5ed9('0x85')](_0x3c2e8c['hiddendigitsnum'])){var _0x548288=parseInt(_0x3c2e8c['hiddendigitsnum'],0xa);var _0x15a414=rs[_0x5ed9('0x116')]({'charset':'*','length':_0x548288});var _0x4b0f73=_0x27500b[_0x5ed9('0x99')];if(_0x4b0f73>0x0){if(_0x4b0f73>_0x548288){this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x3c2e8c,_0x3c2e8c[_0x5ed9('0x117')]===_0x5ed9('0x118')?_0x15a414+_0x27500b['substr'](_0x548288):_0x27500b[_0x5ed9('0x119')](0x0,_0x4b0f73-_0x548288)+_0x15a414);}else{this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x3c2e8c,rs[_0x5ed9('0x116')]({'charset':'*','length':_0x4b0f73}));}}else{this[_0x5ed9('0x32')]['sync'](this,_0x3c2e8c,'');}}else{this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x3c2e8c,_0x27500b);}return _0x4d7fab;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xf')]=function(_0x36ba69){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x36ba69[_0x5ed9('0x34')]));return this[_0x5ed9('0xe')](_0x36ba69);};AGIVertices[_0x5ed9('0x12')]['goal']=function(_0x51a1ee){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x11a'),_0x51a1ee[_0x5ed9('0x34')]));this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x51a1ee,_0x51a1ee[_0x5ed9('0x11b')]);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('GOAL\x20%s',_0x51a1ee[_0x5ed9('0x11b')]));};AGIVertices[_0x5ed9('0x12')]['awspolly']=function(_0x222287){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x11c'),_0x222287['label']));if(!this[_0x5ed9('0x85')](_0x222287['aws_access_key_id'])||!this['isConfigured'](_0x222287[_0x5ed9('0x8c')])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0x11d'));}if(!this['isConfigured'](_0x222287['text'])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')]['noop'](util['format'](_0x5ed9('0x11e'),_0x222287['text']));var _0x54e644=this[_0x5ed9('0x87')][_0x5ed9('0x70')](this,_0x222287);if(_0x54e644){this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x54e644));var _0x11bef2=this[_0x5ed9('0x33')][_0x5ed9('0x11f')](_0x54e644);try{fs[_0x5ed9('0x100')](_0x54e644+_0x5ed9('0x101'));}catch(_0x19ed70){logger[_0x5ed9('0x2a')](_0x19ed70);}return _0x11bef2;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x222287,_0x5ed9('0x120'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x121')]=function(_0x51aebd){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x122'),_0x51aebd[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x51aebd[_0x5ed9('0x88')])||!this[_0x5ed9('0x85')](_0x51aebd[_0x5ed9('0x8c')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x11d'));}if(!this['isConfigured'](_0x51aebd['aws_bot_name'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x123'));}if(!this[_0x5ed9('0x85')](_0x51aebd[_0x5ed9('0x5b')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')]['bot']=!![];this[_0x5ed9('0x32')](_0x51aebd);this[_0x5ed9('0x40')](_0x51aebd[_0x5ed9('0x5b')],'in','','');this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x124'),_0x51aebd[_0x5ed9('0x5b')]));var _0x3f2924=this[_0x5ed9('0x8b')]['sync'](this,_0x51aebd);if(_0x3f2924){for(var _0x1db916 in _0x3f2924){if(_0x3f2924[_0x5ed9('0x95')](_0x1db916)&&_[_0x5ed9('0x9a')](_0x3f2924[_0x1db916])){this['channel'][_0x5ed9('0x9e')](util['format']('AWS_LEX_%s',_0x1db916['toUpperCase']()),_0x3f2924[_0x1db916]);}}if(_[_0x5ed9('0x42')](_0x3f2924[_0x5ed9('0x125')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x126'));}else{this['createSquareMessage'](_0x3f2924[_0x5ed9('0x125')],_0x5ed9('0xe9'),_0x5ed9('0x127'),'');return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x3f2924['message']));}}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x51aebd,_0x5ed9('0x128'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x129')]=function(_0x38fcf9){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x12a'),_0x38fcf9['label'],_0x38fcf9[_0x5ed9('0x64')]));if(!this[_0x5ed9('0x85')](_0x38fcf9[_0x5ed9('0x80')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xe5'));}var _0x1d8ba7=_0x5ed9('0x12b');var _0x2f360c=util[_0x5ed9('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x5ed9('0x116')](0x4));var _0x5a8d33=util['format'](_0x5ed9('0x9d'),_0x2f360c,_0x1d8ba7);var _0x59ae5d=!![];if(_0x38fcf9['beep']===_0x5ed9('0x12c')){_0x59ae5d=![];}var _0x5306e6=this['channel'][_0x5ed9('0x12d')](_0x2f360c,_0x1d8ba7,_0x38fcf9['intKey'],_0x38fcf9[_0x5ed9('0x64')],undefined,_0x59ae5d);if(_0x5306e6[_0x5ed9('0xa4')]!==-0x1){this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x12e'),_0x5a8d33));var _0x15f290=this['googleASR']['sync'](this,_0x38fcf9,_0x5a8d33);if(_0x15f290){for(var _0xba7ef1 in _0x15f290){if(_0x15f290[_0x5ed9('0x95')](_0xba7ef1)){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')]('GOOGLE_ASR_%s',_0xba7ef1[_0x5ed9('0x69')]()),_0x15f290[_0xba7ef1]);}}return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x12f'),JSON[_0x5ed9('0x73')](_0x15f290)));}}return _0x5306e6;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x130')]=function(_0x402e3d){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x402e3d[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x402e3d[_0x5ed9('0x91')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20appid\x20configured');}if(!this[_0x5ed9('0x85')](_0x402e3d[_0x5ed9('0x92')])){return this['channel'][_0x5ed9('0xa9')]('no\x20appsecret\x20configured');}var _0x253951=_0x5ed9('0x12b');var _0x2e5cb6=util[_0x5ed9('0x27')](_0x5ed9('0x131'),FILES_PATH,rs[_0x5ed9('0x116')](0x4));var _0x5b569b=util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x2e5cb6,_0x253951);var _0x5ce05c=!![];if(_0x402e3d[_0x5ed9('0x132')]===_0x5ed9('0x12c')){_0x5ce05c=![];}var _0x3b2384=this['channel'][_0x5ed9('0x12d')](_0x2e5cb6,_0x253951,_0x402e3d[_0x5ed9('0x133')],_0x402e3d['timeout'],undefined,_0x5ce05c);if(_0x3b2384[_0x5ed9('0xa4')]!==-0x1){this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x134'),_0x5b569b));var _0x35d9a4=this[_0x5ed9('0x90')][_0x5ed9('0x70')](this,_0x402e3d,_0x5b569b);if(_0x35d9a4){for(var _0xc9bb13 in _0x35d9a4){if(_0x35d9a4[_0x5ed9('0x95')](_0xc9bb13)){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util['format'](_0x5ed9('0x135'),_0xc9bb13[_0x5ed9('0x69')]()),_0x35d9a4[_0xc9bb13]);}}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x136'),JSON[_0x5ed9('0x73')](_0x35d9a4)));}}return _0x3b2384;};AGIVertices['prototype'][_0x5ed9('0x137')]=function(_0x321796){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x138'),_0x321796[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')][_0x5ed9('0x139')](_0x321796[_0x5ed9('0x3a')],_0x321796[_0x5ed9('0x3b')],_0x321796['priority']);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x13a')]=function(_0x3070f4){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x13b'),_0x3070f4[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3070f4[_0x5ed9('0x13c')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3070f4,_0x5ed9('0x13d'));}try{var _0x28d63d=eval(_0x3070f4[_0x5ed9('0x13c')])?_0x5ed9('0x13e'):_0x5ed9('0x13f');this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x3070f4[_0x5ed9('0x13c')],_0x28d63d));return{'code':0xc8,'result':_0x28d63d};}catch(_0x1e50d6){return{'code':0xc8,'result':_0x5ed9('0x13f')};}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x140')]=function(_0x3dddbc){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3dddbc[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x3dddbc[_0x5ed9('0x141')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3dddbc,_0x5ed9('0x142'));}var _0x5a9989=this['getIntervals'][_0x5ed9('0x70')](this,_0x3dddbc[_0x5ed9('0x141')]);if(!_0x5a9989){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3dddbc,_0x5ed9('0x143'));}for(var _0xf96148=0x0;_0xf96148<_0x5a9989[_0x5ed9('0x99')];_0xf96148+=0x1){var _0x4d685b=this[_0x5ed9('0x33')][_0x5ed9('0x13')](util[_0x5ed9('0x27')](_0x5ed9('0x144'),_0x5a9989[_0xf96148]));if(_0x4d685b[_0x5ed9('0xa4')]===-0x1){return _0x4d685b;}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('IFTIME\x20%s\x20%s',_0x5a9989[_0xf96148],_0x4d685b[_0x5ed9('0xa2')]));if(_0x4d685b[_0x5ed9('0xa2')]===_0x5ed9('0x13e')){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('IFTIME\x20%s\x20%s',_0x5a9989[_0xf96148],_0x5ed9('0x13e')));this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')]('IFTIME\x20%s\x20%s',_0x5a9989[_0xf96148],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x145'),_0x5a9989[_0xf96148],_0x5ed9('0x13f')));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x145'),_0x5a9989[_0xf96148],_0x5ed9('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x5ed9('0x146')]=function(_0x325e39){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x325e39[_0x5ed9('0x34')]));return this['channel'][_0x5ed9('0x146')]();};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x147')]=function(_0x3f86b8){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x148'),_0x3f86b8[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3f86b8['key'])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0xe5'));}var _0x17ddd9=_0x5ed9('0x12b');var _0x467271=util[_0x5ed9('0x27')](_0x5ed9('0x131'),FILES_PATH,rs[_0x5ed9('0x116')](0x4));var _0x5a7d12=util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x467271,_0x17ddd9);var _0x5b4884=!![];if(_0x3f86b8[_0x5ed9('0x132')]===_0x5ed9('0x12c')){_0x5b4884=![];}var _0x2344a9=this[_0x5ed9('0x33')][_0x5ed9('0x12d')](_0x467271,_0x17ddd9,_0x3f86b8['intKey'],_0x3f86b8['timeout'],undefined,_0x5b4884);if(_0x2344a9['result']!==-0x1){this['channel'][_0x5ed9('0xa9')](util['format']('ispeech\x20%s\x20file\x20created',_0x5a7d12));var _0x2a0316=this['ispeechASR'][_0x5ed9('0x70')](this,_0x3f86b8,_0x5a7d12);if(_0x2a0316){for(var _0x46c75b in _0x2a0316){if(_0x2a0316[_0x5ed9('0x95')](_0x46c75b)){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0x149'),_0x46c75b[_0x5ed9('0x69')]()),_0x2a0316[_0x46c75b]);}}return this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x14a'),JSON[_0x5ed9('0x73')](_0x2a0316)));}}return _0x2344a9;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x14b')]=function(_0x37dc92){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x37dc92[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x37dc92[_0x5ed9('0x80')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x37dc92['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x14c'),_0x37dc92[_0x5ed9('0x5b')]));var _0x55558f=this[_0x5ed9('0x14d')]['sync'](this,_0x37dc92);if(_0x55558f){this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x14e'),_0x55558f));var _0x30f6ad=this[_0x5ed9('0x33')]['streamFile'](_0x55558f,_0x37dc92[_0x5ed9('0x133')]);try{fs[_0x5ed9('0x100')](_0x55558f+_0x5ed9('0x101'));}catch(_0x1e687f){logger[_0x5ed9('0x2a')](_0x1e687f);}return _0x30f6ad;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x37dc92,_0x5ed9('0x14f'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x150')]=function(_0x5b7cf1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x151'),_0x5b7cf1['label']));if(!this[_0x5ed9('0x85')](_0x5b7cf1[_0x5ed9('0x152')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x5b7cf1,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x5b7cf1['findBy']));var _0x2658cb=this['agentLogin']['sync'](this,_0x5b7cf1[_0x5ed9('0x152')]);if(_0x2658cb){logger['info'](util[_0x5ed9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5b7cf1[_0x5ed9('0x152')]));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this['channel']['callerid'],_0x5b7cf1[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x156')};}else{logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x5b7cf1[_0x5ed9('0x152')]));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')]['callerid'],_0x5b7cf1[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x159')]=function(_0x223af1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x15a'),_0x223af1['label']));if(!this[_0x5ed9('0x85')](_0x223af1['findBy'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x223af1,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x223af1['findBy']));var _0x4c1b1a=this[_0x5ed9('0x51')]['sync'](this,_0x223af1['findBy']);if(_0x4c1b1a){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ed9('0x33')]['callerid'],_0x223af1[_0x5ed9('0x152')]));this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x223af1['findBy']));return{'code':0xc8,'result':_0x5ed9('0x156')};}else{logger['info'](util['format'](_0x5ed9('0x157'),this['channel'][_0x5ed9('0x36')],_0x223af1[_0x5ed9('0x152')]));this['channel'][_0x5ed9('0xa9')](util['format'](_0x5ed9('0x157'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x223af1[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices['prototype']['math']=function(_0x3f9fae){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x15b'),_0x3f9fae[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3f9fae['operation'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3f9fae,_0x5ed9('0x15c'));}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x15d'),_0x3f9fae[_0x5ed9('0x15e')]));var _0x4b3cc6=eval(_0x3f9fae[_0x5ed9('0x15e')]);if(!this['isConfigured'](_0x3f9fae[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3f8f1e=this[_0x5ed9('0x13')]['sync'](this,_0x3f9fae['variable_id']);if(!_0x3f8f1e){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3f9fae,_0x5ed9('0xd7'));}if(_['isArray'](_0x4b3cc6)){var _0xdf7514=this;_0x4b3cc6[_0x5ed9('0xd8')](function(_0x45697b,_0x4ad1c4){_0xdf7514[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')]('%s[%s]',_0x3f8f1e,_0x4ad1c4),_0x45697b);});return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x15f'),_0x3f8f1e));}else{return this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x3f8f1e,_0x4b3cc6);}};AGIVertices[_0x5ed9('0x12')]['menu']=function(_0x387a20){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x160'),_0x387a20[_0x5ed9('0x34')]));if(_0x387a20[_0x5ed9('0xa5')]===0x0){return this[_0x5ed9('0xa6')](_0x387a20);}_0x387a20[_0x5ed9('0xa5')]-=0x1;if(!this[_0x5ed9('0x85')](_0x387a20[_0x5ed9('0x10d')])){return this['channel'][_0x5ed9('0x2a')](_0x387a20,_0x5ed9('0x10e'));}var _0x32c2d3=this[_0x5ed9('0x10f')][_0x5ed9('0x70')](this,_0x387a20['file_id']);if(!_0x32c2d3){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x387a20,'no\x20file\x20audio\x20found');}var _0x180e50=this[_0x5ed9('0x33')][_0x5ed9('0x111')](_0x32c2d3,_0x387a20['response'],_0x387a20[_0x5ed9('0x161')]);var _0x2cebad=_0x180e50['result'];if(_0x180e50[_0x5ed9('0xa4')]===-0x1){this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x387a20,'-1');return _0x180e50;}else if(_0x180e50[_0x5ed9('0xa2')]===_0x5ed9('0x64')){_0x180e50[_0x5ed9('0xa4')]=_0x180e50[_0x5ed9('0xa4')]['length']>0x0?_0x180e50['result']:'t';}else if(_[_0x5ed9('0x45')](_0x180e50['result'])){_0x180e50[_0x5ed9('0xa4')]='#';_0x2cebad='#';}if(!this['isConfigured'](_0x387a20['variable_id'])){this[_0x5ed9('0x33')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x78f076=this[_0x5ed9('0x13')]['sync'](this,_0x387a20[_0x5ed9('0xd6')]);if(!_0x78f076){return this['channel'][_0x5ed9('0x2a')](_0x387a20,_0x5ed9('0xd7'));}this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x78f076,_0x2cebad);}this['createSquareDetailsReport'][_0x5ed9('0x70')](this,_0x387a20,_0x2cebad);return _0x180e50;};AGIVertices['prototype'][_0x5ed9('0xa9')]=function(_0x1458ec){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x162'),_0x1458ec['label']));return this['channel'][_0x5ed9('0xa9')](_0x1458ec[_0x5ed9('0x163')]||_0x1458ec[_0x5ed9('0x34')]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x164')]=function(_0x50d41e){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x165'),_0x50d41e['label']));if(!this[_0x5ed9('0x85')](_0x50d41e[_0x5ed9('0x152')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x50d41e,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));var _0x17a0ea=this[_0x5ed9('0x4e')][_0x5ed9('0x70')](this,_0x50d41e[_0x5ed9('0x166')]);var _0x284d87=this[_0x5ed9('0x167')]['sync'](this,_0x50d41e[_0x5ed9('0x152')],_0x17a0ea);if(_0x284d87){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));this['channel'][_0x5ed9('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5ed9('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e['findBy']));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x168')]=function(_0x4c504c){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x169'),_0x4c504c[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x4c504c['file_id'])){return this['channel']['error'](_0x4c504c,_0x5ed9('0x10e'));}var _0x38c90c=this[_0x5ed9('0x10f')]['sync'](this,_0x4c504c[_0x5ed9('0x10d')]);if(!_0x38c90c){return this['channel'][_0x5ed9('0x2a')](_0x4c504c,'no\x20file\x20audio\x20found');}var _0xa420e3=this['channel'][_0x5ed9('0x56')](_0x5ed9('0x16a'),[_0x38c90c,_0x4c504c['opts']]);if(_0xa420e3[_0x5ed9('0xa4')]===-0x1){return _0xa420e3;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x38c90c));};AGIVertices[_0x5ed9('0x12')]['queue']=function(_0xfc8e0e){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xfc8e0e[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0xfc8e0e[_0x5ed9('0x16b')])){return this['channel']['error'](_0xfc8e0e,_0x5ed9('0x16c'));}var _0xddabbd='';var _0x2e0823=parseInt(_0xfc8e0e[_0x5ed9('0x16b')],0xa);if(isNaN(_0x2e0823)){_0xddabbd=_0xfc8e0e[_0x5ed9('0x16b')];}else{_0xddabbd=this[_0x5ed9('0x16d')][_0x5ed9('0x70')](this,_0xfc8e0e[_0x5ed9('0x16b')]);if(!_0xddabbd){return this[_0x5ed9('0x33')]['error'](_0xfc8e0e,'no\x20queue\x20found');}}var _0x5980d0='';if(this['isConfigured'](_0xfc8e0e['file_id'])){var _0x57a7e3=this[_0x5ed9('0x10f')][_0x5ed9('0x70')](this,_0xfc8e0e[_0x5ed9('0x10d')]);if(_0x57a7e3){_0x5980d0=_0x57a7e3;}}this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0xfc8e0e,_0xddabbd);if(_0xfc8e0e[_0x5ed9('0xe3')][_0x5ed9('0x16e')]('x')<0x0){_0xfc8e0e[_0x5ed9('0xe3')]+='x';}if(_0xfc8e0e['opts'][_0x5ed9('0x16e')]('X')<0x0){_0xfc8e0e[_0x5ed9('0xe3')]+='X';}this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x5ed9('0x16f'),_0xddabbd?_0xddabbd[_0x5ed9('0x170')]():'');var _0x54e3a9=this['channel'][_0x5ed9('0x56')](_0x5ed9('0x171'),[_0xddabbd,_0xfc8e0e['opts'],_0xfc8e0e[_0x5ed9('0x72')],_0x5980d0,_0xfc8e0e['timeout'],_0xfc8e0e[_0x5ed9('0x9')],_0xfc8e0e[_0x5ed9('0x172')],_0xfc8e0e[_0x5ed9('0x173')],'',_0xfc8e0e[_0x5ed9('0x174')]]);if(_0x54e3a9[_0x5ed9('0xa4')]===-0x1){return _0x54e3a9;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x175'),_0x5ed9('0x171'),_0xddabbd));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x176')]=function(_0x28f044){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x177'),_0x28f044[_0x5ed9('0x34')]));var _0x1b7a87=_0x28f044['recordingFormat']||'wav';var _0x33abf2=util[_0x5ed9('0x27')]('%s_%s',this['channel']['uniqueid'],rs[_0x5ed9('0x116')](0x5));var _0xf8a790=util[_0x5ed9('0x27')](_0x5ed9('0x178'),FILES_PATH,_0x33abf2,_0x1b7a87);var _0x1bc5d7=util['format']('%s/recordings/%s',FILES_PATH,_0x33abf2);this['createSquareRecording'][_0x5ed9('0x70')](this,_0x28f044,_0x33abf2,_0xf8a790);this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x5ed9('0x179'),_0x33abf2);logger[_0x5ed9('0x2c')](_0x5ed9('0x17a'),_0x1bc5d7,_0x1b7a87,_0x28f044[_0x5ed9('0x17b')],_0x28f044['timeout']);return this[_0x5ed9('0x33')][_0x5ed9('0x12d')](_0x1bc5d7,_0x1b7a87,_0x28f044[_0x5ed9('0x17b')],_0x28f044[_0x5ed9('0x64')],undefined,!![]);};AGIVertices[_0x5ed9('0x12')]['restapi']=function(_0x27a703){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x17c'),_0x27a703['label']));if(!this[_0x5ed9('0x85')](_0x27a703['url'])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0x17d'));}var _0x5596e5=this['restAPI'][_0x5ed9('0x70')](this,_0x27a703);logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x17e'),util[_0x5ed9('0x17f')](_0x5596e5,{'showHidden':![],'depth':null})));if(!this[_0x5ed9('0x85')](_0x27a703[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x180'));}var _0x48434a=this[_0x5ed9('0x13')]['sync'](this,_0x27a703[_0x5ed9('0xd6')]);if(!_0x48434a){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x27a703,_0x5ed9('0xd7'));}this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util['format']('%s_STATUS_CODE',_0x48434a),_0x5596e5[_0x5ed9('0x74')]?_0x5596e5['statusCode']:_0x5ed9('0x181'));this[_0x5ed9('0x33')]['setVariable'](util[_0x5ed9('0x27')](_0x5ed9('0x182'),_0x48434a),_0x5596e5['statusMessage']?_0x5596e5[_0x5ed9('0x75')]:'OK');if(_0x5596e5[_0x5ed9('0x6a')]){try{this['saveRestApiResult'](_0x5596e5['body'],_0x48434a);}catch(_0x413e07){logger['error'](util[_0x5ed9('0x27')](_0x5ed9('0x183'),_0x48434a));}}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('variable\x20%s\x20set',_0x48434a));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x184')]=function(_0xc10fce){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x185'),_0xc10fce[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')]['sayDigits'](_0xc10fce[_0x5ed9('0x186')]['replace'](/\s+/g,''),_0xc10fce['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x3f219f){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x187'),_0x3f219f[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')]['sayNumber'](_0x3f219f[_0x5ed9('0x65')]['replace'](/\s+/g,''),_0x3f219f[_0x5ed9('0x17b')]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x188')]=function(_0xfa8f32){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x189'),_0xfa8f32[_0x5ed9('0x34')]));return this['channel']['sayPhonetic'](_0xfa8f32['text'],_0xfa8f32[_0x5ed9('0x17b')]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x18a')]=function(_0x2cbcd9){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x18b'),_0x2cbcd9[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x2cbcd9[_0x5ed9('0x18c')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x18d'));}var _0x5d5ca2=this[_0x5ed9('0x20')]['sync'](this,_0x2cbcd9[_0x5ed9('0x18c')]);if(!_0x5d5ca2||!_0x5d5ca2[_0x5ed9('0x18e')]){return this[_0x5ed9('0x33')]['error'](_0x2cbcd9,_0x5ed9('0x18f'));}var _0x19647b={'from':util[_0x5ed9('0x27')]('\x22%s\x22\x20<%s>',_0x5d5ca2[_0x5ed9('0x1b')],_0x5d5ca2[_0x5ed9('0x190')]||_0x5d5ca2['Smtp'][_0x5ed9('0x191')]),'to':_0x2cbcd9['to']||'','cc':_0x2cbcd9['cc']||'','bcc':_0x2cbcd9['bcc']||'','subject':_0x2cbcd9[_0x5ed9('0x192')],'html':_0x2cbcd9[_0x5ed9('0x5b')],'text':_0x2cbcd9[_0x5ed9('0x5b')]};if(this[_0x5ed9('0x85')](_0x2cbcd9['template_id'])){}logger[_0x5ed9('0xdd')]('sendMail\x20message',JSON[_0x5ed9('0x73')](_0x19647b));this['createSquareDetailsReport'][_0x5ed9('0x70')](this,_0x2cbcd9,_0x2cbcd9['account_id']);this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x193'),_0x5d5ca2[_0x5ed9('0x1b')]));this[_0x5ed9('0x22')][_0x5ed9('0x70')](this,_0x5d5ca2[_0x5ed9('0x194')],_0x19647b);return this['channel'][_0x5ed9('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x195')]=function(_0x162437){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x196'),_0x162437[_0x5ed9('0x34')]));return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x197'));};AGIVertices['prototype'][_0x5ed9('0x198')]=function(_0x3e5a70){logger['info'](util['format'](_0x5ed9('0x199'),_0x3e5a70[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3e5a70[_0x5ed9('0x19a')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x19b'));}var _0x12eaad=this['getSmsAccount'][_0x5ed9('0x70')](this,_0x3e5a70['sms_account_id']);if(!_0x12eaad){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3e5a70,_0x5ed9('0x19c'));}var _0x5766a3={'body':_0x3e5a70[_0x5ed9('0x19d')],'phone':_0x3e5a70['to']||'','SmsAccountId':_0x12eaad['id']};logger[_0x5ed9('0xdd')]('sendSMS\x20message',JSON[_0x5ed9('0x73')](_0x5766a3));this['createSquareDetailsReport']['sync'](this,_0x3e5a70,_0x3e5a70['sms_account_id']);this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x12eaad[_0x5ed9('0x1b')]));this['createSmsMessage']['sync'](this,_0x5766a3);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x19e'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x19f')]=function(_0x54f2ae){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x54f2ae[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x54f2ae['variable_id'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x54f2ae,'no\x20variable\x20selected');}var _0x6c58c8=this[_0x5ed9('0x13')][_0x5ed9('0x70')](this,_0x54f2ae[_0x5ed9('0xd6')]);if(!_0x6c58c8){return this[_0x5ed9('0x33')]['error'](_0x54f2ae,_0x5ed9('0xd7'));}return this[_0x5ed9('0x33')]['setVariable'](_0x6c58c8,_0x54f2ae[_0x5ed9('0x1a0')]);};AGIVertices[_0x5ed9('0x12')]['start']=function(_0x1d29a4){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x1a1'),_0x1d29a4['label']));this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x1a2'));var _0xc32db9=this['channel'][_0x5ed9('0x13')](_0x5ed9('0x1a3'));if(!_[_0x5ed9('0x45')](_0xc32db9[_0x5ed9('0xa2')])){this[_0x5ed9('0x33')][_0x5ed9('0x38')]=_0xc32db9[_0x5ed9('0xa2')];}if(_0x1d29a4[_0x5ed9('0xb7')]===_0x5ed9('0x1a4')){this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x1a5'));return this['channel'][_0x5ed9('0xb7')]();}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x1a6'));};AGIVertices[_0x5ed9('0x12')]['subproject']=function(_0x4f3631){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4f3631['label']));if(!this[_0x5ed9('0x85')](_0x4f3631['project_id'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x4f3631,_0x5ed9('0x1a7'));}var _0x2993e8=this[_0x5ed9('0x1a8')][_0x5ed9('0x70')](this,_0x4f3631[_0x5ed9('0x1a9')]);if(!this['isConfigured'](_0x2993e8)){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x4f3631,util[_0x5ed9('0x27')](_0x5ed9('0x1aa'),_0x4f3631[_0x5ed9('0x1a9')]));}if(_0x2993e8===this['channel'][_0x5ed9('0x35')]){return this[_0x5ed9('0x33')]['error'](_0x4f3631,_0x5ed9('0x1ab'));}this['createSquareDetailsReport'][_0x5ed9('0x70')](this,_0x4f3631,_0x2993e8);var _0x51e879=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0x1ac'),util[_0x5ed9('0x27')](_0x5ed9('0x1ad'),config[_0x5ed9('0x9')][_0x5ed9('0x1ae')]||_0x5ed9('0x1af'),_0x2993e8,this[_0x5ed9('0x33')][_0x5ed9('0x35')]));if(_0x51e879[_0x5ed9('0xa4')]===-0x1){return _0x51e879;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s',_0x5ed9('0x1ac'),_0x2993e8));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1b0')]=function(_0x1cc206){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1cc206['label']));var _0x30d98f=this[_0x5ed9('0x55')][_0x5ed9('0x70')](this,_0x1cc206[_0x5ed9('0xb5')]);this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x1cc206,_0x1cc206[_0x5ed9('0xb5')]);if(this[_0x5ed9('0x85')](_0x1cc206[_0x5ed9('0xd6')])){var _0x2ce58f=this[_0x5ed9('0x13')][_0x5ed9('0x70')](this,_0x1cc206['variable_id']);if(_0x2ce58f){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x2ce58f,_0x30d98f);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x1b1'),_0x1cc206[_0x5ed9('0xb5')],_0x2ce58f));}}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x1b2'),_0x1cc206[_0x5ed9('0xb5')]));};AGIVertices['prototype'][_0x5ed9('0x1b3')]=function(_0x2ed555){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x1b4'),_0x2ed555['label']));_0x2ed555[_0x5ed9('0x5b')]=_0x2ed555[_0x5ed9('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5ed9('0x85')](_0x2ed555['apiKey'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x1b5'));}if(!this['isConfigured'](_0x2ed555['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2ed555[_0x5ed9('0x5b')]));var _0x54dd80=this[_0x5ed9('0x58')][_0x5ed9('0x70')](this,_0x2ed555);if(_0x54dd80){this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x1b6'),_0x54dd80));var _0x3f7bbc=this[_0x5ed9('0x33')][_0x5ed9('0x11f')](_0x54dd80);try{fs[_0x5ed9('0x100')](_0x54dd80+'.wav');}catch(_0x17e409){logger[_0x5ed9('0x2a')](_0x17e409);}return _0x3f7bbc;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x2ed555,_0x5ed9('0x1b7'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1b8')]=function(_0x4ad5df){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x1b9'),_0x4ad5df[_0x5ed9('0x34')]));_0x4ad5df[_0x5ed9('0x5b')]=_0x4ad5df[_0x5ed9('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5ed9('0x85')](_0x4ad5df[_0x5ed9('0x5b')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20text\x20configured');}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x4ad5df['text']));var _0x1d1204=this['googleTTS'][_0x5ed9('0x70')](this,_0x4ad5df);if(_0x1d1204){this['channel']['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x1ba'),_0x1d1204));var _0x567dcb=this['channel'][_0x5ed9('0x11f')](_0x1d1204);try{fs['unlink'](_0x1d1204+'.wav');}catch(_0x4dccb5){logger['error'](_0x4dccb5);}return _0x567dcb;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x4ad5df,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1bb')]=function(_0x11d626){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x11d626[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x11d626[_0x5ed9('0x152')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x11d626,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')]['callerid'],_0x11d626[_0x5ed9('0x152')]));var _0x33da83=this[_0x5ed9('0x50')][_0x5ed9('0x70')](this,_0x11d626[_0x5ed9('0x152')]);if(_0x33da83){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x11d626[_0x5ed9('0x152')]));this['channel']['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')]['callerid'],_0x11d626[_0x5ed9('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')]['callerid'],_0x11d626['findBy']));this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x11d626[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices[_0x5ed9('0x12')]['voicemail']=function(_0x162790){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x162790[_0x5ed9('0x34')]));var _0xb01a74=this[_0x5ed9('0x33')][_0x5ed9('0x56')]('VOICEMAIL',[_0x162790['mailbox'],_0x162790[_0x5ed9('0x77')]]);if(_0xb01a74[_0x5ed9('0xa4')]===-0x1){return _0xb01a74;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s',_0x5ed9('0x1bc'),_0x162790[_0x5ed9('0x1bd')]));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1be')]=function(_0x43d948){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x1bf'),_0x43d948[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x43d948[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')]['error'](_0x43d948,_0x5ed9('0x1c0'));}var _0x5343fb=this['getVariable']['sync'](this,_0x43d948[_0x5ed9('0xd6')]);if(!_0x5343fb){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x43d948,_0x5ed9('0xd7'));}var _0x32f6b3=this[_0x5ed9('0x33')]['getVariable'](_0x5343fb);return{'code':0xc8,'result':_0x32f6b3['extra']?_0x32f6b3[_0x5ed9('0xa2')]:'-'};};String[_0x5ed9('0x12')][_0x5ed9('0xa1')]=function(_0x1118e6,_0x54db1c){return this['split'](_0x1118e6)['join'](_0x54db1c);};module[_0x5ed9('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 13abc6f..e5e80c9 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 _0x3a2c=['finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw'];(function(_0xc74312,_0x3d8ef0){var _0x3a9838=function(_0x49cfac){while(--_0x49cfac){_0xc74312['push'](_0xc74312['shift']());}};_0x3a9838(++_0x3d8ef0);}(_0x3a2c,0xe0));var _0xc3a2=function(_0x2787b6,_0x286653){_0x2787b6=_0x2787b6-0x0;var _0x483b48=_0x3a2c[_0x2787b6];return _0x483b48;};'use strict';var _=require(_0xc3a2('0x0'));var moment=require('moment');var ami=require(_0xc3a2('0x1'));var logger=require(_0xc3a2('0x2'))(_0xc3a2('0x3'));var RpcUser=require(_0xc3a2('0x4'));var RpcVoiceAgentReport=require(_0xc3a2('0x5'));function Acw(_0xeb1976){this[_0xc3a2('0x6')]=_0xeb1976['voiceQueues'];this[_0xc3a2('0x7')]=_0xeb1976[_0xc3a2('0x7')];this['timers']=_0xeb1976[_0xc3a2('0x8')];this[_0xc3a2('0x9')]={};ami['on'](_0xc3a2('0xa'),this['syncAgentConnect'][_0xc3a2('0xb')](this));ami['on'](_0xc3a2('0xc'),this[_0xc3a2('0xd')][_0xc3a2('0xb')](this));ami['on'](_0xc3a2('0xe'),this[_0xc3a2('0xf')]['bind'](this));ami['on']('agentringnoanswer',this[_0xc3a2('0x10')][_0xc3a2('0xb')](this));ami['on'](_0xc3a2('0x11'),this['syncAttendedTransfer'][_0xc3a2('0xb')](this));ami['on'](_0xc3a2('0x12'),this[_0xc3a2('0x13')][_0xc3a2('0xb')](this));ami['on'](_0xc3a2('0x14'),this[_0xc3a2('0x15')][_0xc3a2('0xb')](this));}function getDiff(_0x56862e){var _0x22b627=moment()[_0xc3a2('0x16')](0x0);var _0x4cfeb2=moment(_0x56862e)[_0xc3a2('0x16')](0x0);return _0x22b627['diff'](_0x4cfeb2,_0xc3a2('0x17'));}Acw[_0xc3a2('0x18')]['updateAcw']=function(_0x4328dc,_0xadc06d){var _0x11e1e3=this;var _0x7b9980=getDiff(_0x11e1e3[_0xc3a2('0x8')][_0x4328dc][_0xc3a2('0x19')]);clearTimeout(_0x11e1e3[_0xc3a2('0x8')][_0x4328dc][_0xc3a2('0x1a')]);_0x11e1e3['timers'][_0x4328dc][_0xc3a2('0x1a')]=![];return RpcVoiceAgentReport[_0xc3a2('0x1b')]({'acwtime':_0x7b9980},_0x11e1e3['timers'][_0x4328dc][_0xc3a2('0x1c')],_0x4328dc)[_0xc3a2('0x1d')](function(_0x3b6d63){logger['info'](_0xc3a2('0x1e'),_0xadc06d,_0x7b9980,_0x3b6d63);})[_0xc3a2('0x1f')](function(_0x1db69a){logger[_0xc3a2('0x20')](_0xc3a2('0x21'),_0xadc06d,_0x1db69a);})['finally'](function(){delete _0x11e1e3[_0xc3a2('0x8')][_0x4328dc];});};Acw[_0xc3a2('0x18')]['startAcw']=function(_0x85f0c8){try{var _0x3a6f1a=this;var _0xe57e8b=this[_0xc3a2('0x9')][_0x85f0c8][_0xc3a2('0x22')];var _0x52c982=this['channels'][_0x85f0c8][_0xc3a2('0x23')];var _0x52ff91=this[_0xc3a2('0x6')][_0x52c982];var _0x48ed8e=![];var _0x4a307b=_0xc3a2('0x24');if(_0x52ff91[_0xc3a2('0x25')]&&_0x52ff91[_0xc3a2('0x26')][_0xc3a2('0x27')]){_0x48ed8e=!![];_0x4a307b=_0x52ff91[_0xc3a2('0x26')]['name'];}return ami[_0xc3a2('0x28')]({'action':_0xc3a2('0x29'),'interface':_0xe57e8b,'paused':!![],'reason':_0x4a307b})['then'](function(){if(_0x3a6f1a[_0xc3a2('0x7')][_0xe57e8b]){return RpcUser[_0xc3a2('0x2a')](_0x3a6f1a['agents'][_0xe57e8b]['id'])[_0xc3a2('0x1d')](function(_0x3e880e){if(!_0x3e880e||_0x3e880e[_0xc3a2('0x2b')]){logger[_0xc3a2('0x2c')](_0xc3a2('0x2d'),_0x85f0c8,_0xe57e8b,_0x52c982);return;}logger[_0xc3a2('0x2c')](_0xc3a2('0x2e'),_0x85f0c8,_0xe57e8b,_0x52c982);var _0x40549f=_0x3a6f1a[_0xc3a2('0x9')][_0x85f0c8][_0xc3a2('0x2f')]&&_0x3a6f1a['channels'][_0x85f0c8][_0xc3a2('0x30')]?_0x3a6f1a['channels'][_0x85f0c8][_0xc3a2('0x30')]:_0x85f0c8;return RpcUser[_0xc3a2('0x31')](_0x3a6f1a[_0xc3a2('0x7')][_0xe57e8b],_0x4a307b,_0x40549f)[_0xc3a2('0x1d')](function(_0x53d19d){_0x3a6f1a[_0xc3a2('0x6')][_0x52c982][_0xc3a2('0x32')]-=0x1;_0x3a6f1a[_0xc3a2('0x6')][_0x52c982][_0xc3a2('0x33')]+=0x1;return _0x53d19d;});})[_0xc3a2('0x1d')](function(_0x35b5b7){if(_0x48ed8e||!_0x35b5b7){return;}_0x3a6f1a[_0xc3a2('0x8')][_0xe57e8b]={};logger[_0xc3a2('0x2c')](_0xc3a2('0x34'),_0x85f0c8,_0x3a6f1a[_0xc3a2('0x6')][_0x52c982][_0xc3a2('0x35')],_0xe57e8b,_0x52c982);_0x3a6f1a[_0xc3a2('0x8')][_0xe57e8b][_0xc3a2('0x1a')]=setTimeout(_0x3a6f1a[_0xc3a2('0x36')][_0xc3a2('0xb')](_0x3a6f1a,_0xe57e8b),_0x3a6f1a[_0xc3a2('0x6')][_0x52c982]['acwTimeout']*0x3e8);_0x3a6f1a[_0xc3a2('0x8')][_0xe57e8b][_0xc3a2('0x19')]=moment()[_0xc3a2('0x37')](_0xc3a2('0x38'));_0x3a6f1a[_0xc3a2('0x8')][_0xe57e8b]['uniqueid']=_0x85f0c8;_0x3a6f1a['timers'][_0xe57e8b][_0xc3a2('0x23')]=_0x52c982;_0x3a6f1a[_0xc3a2('0x8')][_0xe57e8b][_0xc3a2('0x39')]=_0x3a6f1a['updateAcw'][_0xc3a2('0xb')](_0x3a6f1a,_0xe57e8b,_0x85f0c8);});}})[_0xc3a2('0x1f')](function(){logger[_0xc3a2('0x20')](_0xc3a2('0x34'),_0x85f0c8,_0x3a6f1a['voiceQueues'][_0x52c982][_0xc3a2('0x35')],_0xe57e8b,_0x52c982);})[_0xc3a2('0x3a')](function(){delete _0x3a6f1a['channels'][_0x85f0c8];});}catch(_0x5b51f7){logger[_0xc3a2('0x20')](_0xc3a2('0x3b'),_0x5b51f7[_0xc3a2('0x3c')]);}};Acw[_0xc3a2('0x18')]['stopAcw']=function(_0x467485){try{var _0x17c323=this;if(_0x17c323['timers'][_0x467485]){_0x17c323['timers'][_0x467485][_0xc3a2('0x1a')]=![];var _0x113167=_0x17c323[_0xc3a2('0x8')][_0x467485][_0xc3a2('0x1c')];var _0x536912=_0x17c323[_0xc3a2('0x8')][_0x467485][_0xc3a2('0x23')];var _0x21dab4=_0x17c323[_0xc3a2('0x6')][_0x536912]['acwTimeout'];logger['info'](_0xc3a2('0x3d'),_0x113167,_0x467485);RpcUser[_0xc3a2('0x2a')](this[_0xc3a2('0x7')][_0x467485]['id'])[_0xc3a2('0x1d')](function(_0x105ff0){if(_0x105ff0['pauseType']===_0xc3a2('0x24')){return RpcUser[_0xc3a2('0x3e')](_0x17c323['agents'][_0x467485]);}});RpcVoiceAgentReport[_0xc3a2('0x1b')]({'acwtime':_0x21dab4,'agentacw':!![]},_0x113167,_0x467485)[_0xc3a2('0x1d')](function(_0x3cb574){logger[_0xc3a2('0x2c')](_0xc3a2('0x1e'),_0x113167,_0x21dab4,_0x3cb574);})[_0xc3a2('0x1f')](function(_0x36d40e){logger['error'](_0xc3a2('0x21'),_0x113167,_0x36d40e);});}else{logger[_0xc3a2('0x20')](_0xc3a2('0x3f'),_0x467485);if(_0x17c323['timers']){logger['info'](_0xc3a2('0x40'),JSON[_0xc3a2('0x41')](_0x17c323[_0xc3a2('0x8')]));}}}catch(_0x1ac294){logger[_0xc3a2('0x20')](_0xc3a2('0x42'),_0x1ac294[_0xc3a2('0x3c')]);}};Acw[_0xc3a2('0x18')][_0xc3a2('0x43')]=function(_0x1704b7){try{if(this['voiceQueues'][_0x1704b7[_0xc3a2('0x23')]]&&(this[_0xc3a2('0x6')][_0x1704b7['queue']][_0xc3a2('0x3')]||this['voiceQueues'][_0x1704b7['queue']][_0xc3a2('0x25')])){if(this[_0xc3a2('0x7')][_0x1704b7[_0xc3a2('0x22')]]){this[_0xc3a2('0x9')][_0x1704b7[_0xc3a2('0x1c')]]={'queue':_0x1704b7[_0xc3a2('0x23')],'interface':_0x1704b7[_0xc3a2('0x22')],'destlinkedid':_0x1704b7[_0xc3a2('0x30')]};}}}catch(_0x566753){logger[_0xc3a2('0x20')](_0xc3a2('0x44'),_0x566753[_0xc3a2('0x3c')]);}};Acw[_0xc3a2('0x18')]['syncAgentConnectPreview']=function(_0x2838f2){try{if(this[_0xc3a2('0x6')][_0x2838f2[_0xc3a2('0x23')]]&&(this[_0xc3a2('0x6')][_0x2838f2['queue']][_0xc3a2('0x3')]||this[_0xc3a2('0x6')][_0x2838f2[_0xc3a2('0x23')]][_0xc3a2('0x25')])){if(this[_0xc3a2('0x7')][_0x2838f2[_0xc3a2('0x22')]]){this['channels'][_0x2838f2[_0xc3a2('0x1c')]]={'queue':_0x2838f2[_0xc3a2('0x23')],'interface':_0x2838f2['interface']};}}}catch(_0x10d82f){logger[_0xc3a2('0x20')](_0xc3a2('0x45'),_0x10d82f['message']);}};Acw[_0xc3a2('0x18')][_0xc3a2('0xd')]=function(_0x5c1356){try{if(this[_0xc3a2('0x9')][_0x5c1356[_0xc3a2('0x1c')]]&&_[_0xc3a2('0x46')](this[_0xc3a2('0x9')][_0x5c1356[_0xc3a2('0x1c')]][_0xc3a2('0x2f')])){logger['info'](_0xc3a2('0x47'),_0x5c1356[_0xc3a2('0x1c')]);this['startAcw'](_0x5c1356[_0xc3a2('0x1c')]);}else if(this['channels'][_0x5c1356[_0xc3a2('0x48')]]&&_[_0xc3a2('0x46')](this[_0xc3a2('0x9')][_0x5c1356[_0xc3a2('0x48')]]['attended'])){logger[_0xc3a2('0x2c')](_0xc3a2('0x49'),_0x5c1356[_0xc3a2('0x48')]);this[_0xc3a2('0x4a')](_0x5c1356[_0xc3a2('0x48')]);}}catch(_0x2eaaaf){logger[_0xc3a2('0x20')]('[ACW][syncHangupRequest]\x20%s',_0x2eaaaf[_0xc3a2('0x3c')]);}};Acw['prototype'][_0xc3a2('0xf')]=function(_0x328013){try{if(this['channels'][_0x328013[_0xc3a2('0x1c')]]&&this[_0xc3a2('0x9')][_0x328013[_0xc3a2('0x1c')]][_0xc3a2('0x2f')]){logger['info'](_0xc3a2('0x4b'),_0x328013[_0xc3a2('0x1c')]);this[_0xc3a2('0x4a')](_0x328013[_0xc3a2('0x1c')]);}else if(this['channels'][_0x328013[_0xc3a2('0x48')]]&&this['channels'][_0x328013[_0xc3a2('0x48')]][_0xc3a2('0x2f')]){logger[_0xc3a2('0x2c')](_0xc3a2('0x4c'),_0x328013['linkedid']);this[_0xc3a2('0x4a')](_0x328013[_0xc3a2('0x48')]);}}catch(_0x1fcda1){logger[_0xc3a2('0x20')](_0xc3a2('0x4d'),_0x1fcda1['message']);}};Acw['prototype'][_0xc3a2('0x4e')]=function(_0x549596){try{if(!_[_0xc3a2('0x4f')](this[_0xc3a2('0x9')][_0x549596['transfereeuniqueid']])){this[_0xc3a2('0x4a')](_0x549596['transfereeuniqueid']);if(this['channels'][_0x549596[_0xc3a2('0x50')]]){this[_0xc3a2('0x9')][_0x549596['secondtransfereruniqueid']][_0xc3a2('0x2f')]=!![];this[_0xc3a2('0x9')][_0x549596[_0xc3a2('0x51')]]=this['channels'][_0x549596[_0xc3a2('0x50')]];this[_0xc3a2('0x52')](_0x549596[_0xc3a2('0x50')]);}}else if(!_[_0xc3a2('0x4f')](this[_0xc3a2('0x9')][_0x549596[_0xc3a2('0x51')]])){this[_0xc3a2('0x4a')](_0x549596[_0xc3a2('0x51')]);if(this['channels'][_0x549596[_0xc3a2('0x53')]]){this[_0xc3a2('0x9')][_0x549596[_0xc3a2('0x53')]][_0xc3a2('0x2f')]=!![];this[_0xc3a2('0x9')][_0x549596[_0xc3a2('0x54')]]=this[_0xc3a2('0x9')][_0x549596['origtransfereruniqueid']];this[_0xc3a2('0x52')](_0x549596[_0xc3a2('0x53')]);}}}catch(_0x1e5e29){logger[_0xc3a2('0x20')]('[ACW][syncAttendedTransfer]\x20%s',_0x1e5e29['message']);}};Acw[_0xc3a2('0x18')][_0xc3a2('0x13')]=function(_0x3746f7){try{if(this[_0xc3a2('0x9')][_0x3746f7[_0xc3a2('0x55')]]){logger['info'](_0xc3a2('0x56'),JSON[_0xc3a2('0x41')](_0x3746f7[_0xc3a2('0x55')]));this[_0xc3a2('0x4a')](_0x3746f7[_0xc3a2('0x55')]);}else if(this['channels'][_0x3746f7[_0xc3a2('0x57')]]){logger['info'](_0xc3a2('0x58'),JSON[_0xc3a2('0x41')](_0x3746f7['transfererlinkedid']));this[_0xc3a2('0x4a')](_0x3746f7[_0xc3a2('0x57')]);}}catch(_0x4071e6){logger[_0xc3a2('0x20')](_0xc3a2('0x59'),_0x4071e6[_0xc3a2('0x3c')]);}};Acw[_0xc3a2('0x18')]['syncAgentRingNoAnswer']=function(_0x4e64d3){try{if(this[_0xc3a2('0x6')][_0x4e64d3[_0xc3a2('0x23')]]&&this['voiceQueues'][_0x4e64d3[_0xc3a2('0x23')]][_0xc3a2('0x5a')]==='all'){if(this[_0xc3a2('0x7')][_0x4e64d3[_0xc3a2('0x22')]]){logger[_0xc3a2('0x2c')](_0xc3a2('0x5b'),_0x4e64d3[_0xc3a2('0x1c')],_0x4e64d3['interface'],_0x4e64d3[_0xc3a2('0x23')]);return RpcUser['savePause'](this['agents'][_0x4e64d3[_0xc3a2('0x22')]],_0xc3a2('0x5c'),_0x4e64d3[_0xc3a2('0x1c')]);}}}catch(_0x329e89){logger[_0xc3a2('0x20')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x329e89['message']);}};Acw[_0xc3a2('0x18')][_0xc3a2('0x52')]=function(_0x26b203,_0xb0a46b=0x2710){if(this[_0xc3a2('0x9')][_0x26b203]){setTimeout(()=>{delete this[_0xc3a2('0x9')][_0x26b203];},_0xb0a46b);}};module[_0xc3a2('0x5d')]=Acw; \ No newline at end of file +var _0xce4b=['[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','ACW','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xce4b,0x1bc));var _0xbce4=function(_0x21fd94,_0x19102c){_0x21fd94=_0x21fd94-0x0;var _0x5f9c17=_0xce4b[_0x21fd94];return _0x5f9c17;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0xbce4('0x0'));var logger=require(_0xbce4('0x1'))(_0xbce4('0x2'));var RpcUser=require(_0xbce4('0x3'));var RpcVoiceAgentReport=require(_0xbce4('0x4'));function Acw(_0x3f0b0a){this[_0xbce4('0x5')]=_0x3f0b0a[_0xbce4('0x5')];this[_0xbce4('0x6')]=_0x3f0b0a[_0xbce4('0x6')];this[_0xbce4('0x7')]=_0x3f0b0a[_0xbce4('0x7')];this[_0xbce4('0x8')]={};ami['on'](_0xbce4('0x9'),this[_0xbce4('0xa')][_0xbce4('0xb')](this));ami['on'](_0xbce4('0xc'),this['syncHangupRequest'][_0xbce4('0xb')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xbce4('0xd'),this['syncAgentRingNoAnswer'][_0xbce4('0xb')](this));ami['on'](_0xbce4('0xe'),this['syncAttendedTransfer'][_0xbce4('0xb')](this));ami['on'](_0xbce4('0xf'),this[_0xbce4('0x10')][_0xbce4('0xb')](this));ami['on'](_0xbce4('0x11'),this[_0xbce4('0x12')][_0xbce4('0xb')](this));}function getDiff(_0x386c58){var _0x19b5a6=moment()[_0xbce4('0x13')](0x0);var _0x4fab98=moment(_0x386c58)['milliseconds'](0x0);return _0x19b5a6[_0xbce4('0x14')](_0x4fab98,_0xbce4('0x15'));}Acw[_0xbce4('0x16')][_0xbce4('0x17')]=function(_0x556893,_0x1b09ce){var _0x2d7ead=this;var _0x59cfab=getDiff(_0x2d7ead[_0xbce4('0x7')][_0x556893][_0xbce4('0x18')]);clearTimeout(_0x2d7ead['timers'][_0x556893][_0xbce4('0x19')]);_0x2d7ead[_0xbce4('0x7')][_0x556893]['timer']=![];return RpcVoiceAgentReport[_0xbce4('0x1a')]({'acwtime':_0x59cfab},_0x2d7ead[_0xbce4('0x7')][_0x556893][_0xbce4('0x1b')],_0x556893)['then'](function(_0x428890){logger[_0xbce4('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x1b09ce,_0x59cfab,_0x428890);})[_0xbce4('0x1d')](function(_0x439922){logger[_0xbce4('0x1e')](_0xbce4('0x1f'),_0x1b09ce,_0x439922);})[_0xbce4('0x20')](function(){delete _0x2d7ead[_0xbce4('0x7')][_0x556893];});};Acw['prototype'][_0xbce4('0x21')]=function(_0x18a6a8){try{var _0x3d3855=this;var _0x44d11e=this[_0xbce4('0x8')][_0x18a6a8][_0xbce4('0x22')];var _0x56437b=this[_0xbce4('0x8')][_0x18a6a8][_0xbce4('0x23')];var _0x276553=this[_0xbce4('0x5')][_0x56437b];var _0xe29f89=![];var _0x4fc5c4='ACW';if(_0x276553[_0xbce4('0x24')]&&_0x276553[_0xbce4('0x25')]['name']){_0xe29f89=!![];_0x4fc5c4=_0x276553[_0xbce4('0x25')][_0xbce4('0x26')];}return ami[_0xbce4('0x27')]({'action':_0xbce4('0x28'),'interface':_0x44d11e,'paused':!![],'reason':_0x4fc5c4})[_0xbce4('0x29')](function(){if(_0x3d3855[_0xbce4('0x6')][_0x44d11e]){return RpcUser[_0xbce4('0x2a')](_0x3d3855['agents'][_0x44d11e]['id'])[_0xbce4('0x29')](function(_0x5698d5){if(!_0x5698d5||_0x5698d5[_0xbce4('0x2b')]){logger[_0xbce4('0x1c')](_0xbce4('0x2c'),_0x18a6a8,_0x44d11e,_0x56437b);return;}logger[_0xbce4('0x1c')](_0xbce4('0x2d'),_0x18a6a8,_0x44d11e,_0x56437b);var _0x18384a=_0x3d3855[_0xbce4('0x8')][_0x18a6a8][_0xbce4('0x2e')]&&_0x3d3855[_0xbce4('0x8')][_0x18a6a8][_0xbce4('0x2f')]?_0x3d3855['channels'][_0x18a6a8]['destlinkedid']:_0x18a6a8;return RpcUser[_0xbce4('0x30')](_0x3d3855['agents'][_0x44d11e],_0x4fc5c4,_0x18384a)['then'](function(_0x6fc4a7){_0x3d3855[_0xbce4('0x5')][_0x56437b][_0xbce4('0x31')]-=0x1;_0x3d3855['voiceQueues'][_0x56437b]['paused']+=0x1;return _0x6fc4a7;});})[_0xbce4('0x29')](function(_0x29b50b){if(_0xe29f89||!_0x29b50b){return;}_0x3d3855[_0xbce4('0x7')][_0x44d11e]={};logger['info'](_0xbce4('0x32'),_0x18a6a8,_0x3d3855[_0xbce4('0x5')][_0x56437b][_0xbce4('0x33')],_0x44d11e,_0x56437b);_0x3d3855[_0xbce4('0x7')][_0x44d11e][_0xbce4('0x19')]=setTimeout(_0x3d3855[_0xbce4('0x34')]['bind'](_0x3d3855,_0x44d11e),_0x3d3855[_0xbce4('0x5')][_0x56437b][_0xbce4('0x33')]*0x3e8);_0x3d3855[_0xbce4('0x7')][_0x44d11e][_0xbce4('0x18')]=moment()[_0xbce4('0x35')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d3855[_0xbce4('0x7')][_0x44d11e][_0xbce4('0x1b')]=_0x18a6a8;_0x3d3855[_0xbce4('0x7')][_0x44d11e][_0xbce4('0x23')]=_0x56437b;_0x3d3855[_0xbce4('0x7')][_0x44d11e][_0xbce4('0x17')]=_0x3d3855['updateAcw']['bind'](_0x3d3855,_0x44d11e,_0x18a6a8);});}})[_0xbce4('0x1d')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x18a6a8,_0x3d3855[_0xbce4('0x5')][_0x56437b]['acwTimeout'],_0x44d11e,_0x56437b);})['finally'](function(){delete _0x3d3855[_0xbce4('0x8')][_0x18a6a8];});}catch(_0x4e433c){logger[_0xbce4('0x1e')](_0xbce4('0x36'),_0x4e433c[_0xbce4('0x37')]);}};Acw[_0xbce4('0x16')]['stopAcw']=function(_0x1cbec5){try{var _0x352f3f=this;if(_0x352f3f[_0xbce4('0x7')][_0x1cbec5]){_0x352f3f[_0xbce4('0x7')][_0x1cbec5]['timer']=![];var _0x26f512=_0x352f3f[_0xbce4('0x7')][_0x1cbec5][_0xbce4('0x1b')];var _0x3c3121=_0x352f3f[_0xbce4('0x7')][_0x1cbec5][_0xbce4('0x23')];var _0x37c7b4=_0x352f3f['voiceQueues'][_0x3c3121][_0xbce4('0x33')];logger[_0xbce4('0x1c')](_0xbce4('0x38'),_0x26f512,_0x1cbec5);RpcUser[_0xbce4('0x2a')](this[_0xbce4('0x6')][_0x1cbec5]['id'])[_0xbce4('0x29')](function(_0x204f55){if(_0x204f55['pauseType']===_0xbce4('0x39')){return RpcUser['saveUnpause'](_0x352f3f[_0xbce4('0x6')][_0x1cbec5]);}});RpcVoiceAgentReport['update']({'acwtime':_0x37c7b4,'agentacw':!![]},_0x26f512,_0x1cbec5)[_0xbce4('0x29')](function(_0x3006a){logger[_0xbce4('0x1c')](_0xbce4('0x3a'),_0x26f512,_0x37c7b4,_0x3006a);})[_0xbce4('0x1d')](function(_0x1f3bef){logger[_0xbce4('0x1e')](_0xbce4('0x1f'),_0x26f512,_0x1f3bef);});}else{logger[_0xbce4('0x1e')](_0xbce4('0x3b'),_0x1cbec5);if(_0x352f3f[_0xbce4('0x7')]){logger[_0xbce4('0x1c')](_0xbce4('0x3c'),JSON[_0xbce4('0x3d')](_0x352f3f['timers']));}}}catch(_0x55fc46){logger[_0xbce4('0x1e')](_0xbce4('0x3e'),_0x55fc46[_0xbce4('0x37')]);}};Acw[_0xbce4('0x16')]['syncAgentConnect']=function(_0x70da88){try{if(this[_0xbce4('0x5')][_0x70da88['queue']]&&(this[_0xbce4('0x5')][_0x70da88[_0xbce4('0x23')]][_0xbce4('0x2')]||this['voiceQueues'][_0x70da88[_0xbce4('0x23')]][_0xbce4('0x24')])){if(this[_0xbce4('0x6')][_0x70da88[_0xbce4('0x22')]]){this[_0xbce4('0x8')][_0x70da88[_0xbce4('0x1b')]]={'queue':_0x70da88[_0xbce4('0x23')],'interface':_0x70da88[_0xbce4('0x22')],'destlinkedid':_0x70da88['destlinkedid']};}}}catch(_0x40de34){logger[_0xbce4('0x1e')](_0xbce4('0x3f'),_0x40de34['message']);}};Acw[_0xbce4('0x16')][_0xbce4('0x12')]=function(_0x588740){try{if(this['voiceQueues'][_0x588740[_0xbce4('0x23')]]&&(this[_0xbce4('0x5')][_0x588740['queue']]['acw']||this[_0xbce4('0x5')][_0x588740[_0xbce4('0x23')]][_0xbce4('0x24')])){if(this[_0xbce4('0x6')][_0x588740[_0xbce4('0x22')]]){this[_0xbce4('0x8')][_0x588740[_0xbce4('0x1b')]]={'queue':_0x588740[_0xbce4('0x23')],'interface':_0x588740[_0xbce4('0x22')]};}}}catch(_0x277110){logger[_0xbce4('0x1e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x277110[_0xbce4('0x37')]);}};Acw[_0xbce4('0x16')][_0xbce4('0x40')]=function(_0x4175ec){try{if(this['channels'][_0x4175ec[_0xbce4('0x1b')]]&&_[_0xbce4('0x41')](this[_0xbce4('0x8')][_0x4175ec['uniqueid']][_0xbce4('0x2e')])){logger[_0xbce4('0x1c')](_0xbce4('0x42'),_0x4175ec['uniqueid']);this[_0xbce4('0x21')](_0x4175ec[_0xbce4('0x1b')]);}else if(this[_0xbce4('0x8')][_0x4175ec[_0xbce4('0x43')]]&&_[_0xbce4('0x41')](this[_0xbce4('0x8')][_0x4175ec[_0xbce4('0x43')]]['attended'])){logger['info'](_0xbce4('0x44'),_0x4175ec['linkedid']);this['startAcw'](_0x4175ec[_0xbce4('0x43')]);}}catch(_0x31d43f){logger[_0xbce4('0x1e')](_0xbce4('0x45'),_0x31d43f[_0xbce4('0x37')]);}};Acw[_0xbce4('0x16')]['syncHangup']=function(_0x3a67d7){try{if(this['channels'][_0x3a67d7[_0xbce4('0x1b')]]&&this[_0xbce4('0x8')][_0x3a67d7[_0xbce4('0x1b')]][_0xbce4('0x2e')]){logger[_0xbce4('0x1c')](_0xbce4('0x46'),_0x3a67d7['uniqueid']);this['startAcw'](_0x3a67d7['uniqueid']);}else if(this['channels'][_0x3a67d7['linkedid']]&&this[_0xbce4('0x8')][_0x3a67d7['linkedid']]['attended']){logger[_0xbce4('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3a67d7[_0xbce4('0x43')]);this[_0xbce4('0x21')](_0x3a67d7[_0xbce4('0x43')]);}}catch(_0x3040d0){logger[_0xbce4('0x1e')]('[ACW][syncHangup]\x20%s',_0x3040d0[_0xbce4('0x37')]);}};Acw[_0xbce4('0x16')]['syncAttendedTransfer']=function(_0x7d3f16){try{if(!_[_0xbce4('0x47')](this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x48')]])){this[_0xbce4('0x21')](_0x7d3f16[_0xbce4('0x48')]);if(this['channels'][_0x7d3f16[_0xbce4('0x49')]]){this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x49')]]['attended']=!![];this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x4a')]]=this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x49')]];this[_0xbce4('0x4b')](_0x7d3f16[_0xbce4('0x49')]);}}else if(!_[_0xbce4('0x47')](this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x4a')]])){this[_0xbce4('0x21')](_0x7d3f16[_0xbce4('0x4a')]);if(this[_0xbce4('0x8')][_0x7d3f16['origtransfereruniqueid']]){this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x4c')]][_0xbce4('0x2e')]=!![];this[_0xbce4('0x8')][_0x7d3f16['transfereeuniqueid']]=this[_0xbce4('0x8')][_0x7d3f16[_0xbce4('0x4c')]];this['deleteChannelAfterTimeout'](_0x7d3f16[_0xbce4('0x4c')]);}}}catch(_0x4fce08){logger[_0xbce4('0x1e')](_0xbce4('0x4d'),_0x4fce08['message']);}};Acw['prototype'][_0xbce4('0x10')]=function(_0x1e1446){try{if(this[_0xbce4('0x8')][_0x1e1446[_0xbce4('0x4e')]]){logger[_0xbce4('0x1c')](_0xbce4('0x4f'),JSON[_0xbce4('0x3d')](_0x1e1446[_0xbce4('0x4e')]));this['startAcw'](_0x1e1446[_0xbce4('0x4e')]);}else if(this['channels'][_0x1e1446[_0xbce4('0x50')]]){logger[_0xbce4('0x1c')](_0xbce4('0x51'),JSON[_0xbce4('0x3d')](_0x1e1446[_0xbce4('0x50')]));this['startAcw'](_0x1e1446[_0xbce4('0x50')]);}}catch(_0x115f99){logger[_0xbce4('0x1e')]('[ACW][syncBlindTransfer]\x20%s',_0x115f99['message']);}};Acw[_0xbce4('0x16')]['syncAgentRingNoAnswer']=function(_0x1155a9){try{if(this[_0xbce4('0x5')][_0x1155a9[_0xbce4('0x23')]]&&this['voiceQueues'][_0x1155a9[_0xbce4('0x23')]][_0xbce4('0x52')]===_0xbce4('0x53')){if(this[_0xbce4('0x6')][_0x1155a9[_0xbce4('0x22')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1155a9['uniqueid'],_0x1155a9[_0xbce4('0x22')],_0x1155a9[_0xbce4('0x23')]);return RpcUser[_0xbce4('0x30')](this[_0xbce4('0x6')][_0x1155a9[_0xbce4('0x22')]],'Auto-Pause',_0x1155a9[_0xbce4('0x1b')]);}}}catch(_0x234cb5){logger[_0xbce4('0x1e')](_0xbce4('0x54'),_0x234cb5[_0xbce4('0x37')]);}};Acw['prototype'][_0xbce4('0x4b')]=function(_0x32c146,_0x2ac849=0x2710){if(this[_0xbce4('0x8')][_0x32c146]){setTimeout(()=>{delete this['channels'][_0x32c146];},_0x2ac849);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9d4ab80..34f2072 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 _0x0246=['actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','asterisk-manager','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus'];(function(_0x3b271f,_0x43ce48){var _0x104b37=function(_0x40df04){while(--_0x40df04){_0x3b271f['push'](_0x3b271f['shift']());}};_0x104b37(++_0x43ce48);}(_0x0246,0xe2));var _0x6024=function(_0x555da2,_0xcd6b7a){_0x555da2=_0x555da2-0x0;var _0xbce0ff=_0x0246[_0x555da2];return _0xbce0ff;};'use strict';var Manager=require(_0x6024('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require(_0x6024('0x1'))(_0x6024('0x2'));var config=require(_0x6024('0x3'));var ami=new Manager(config[_0x6024('0x4')]['port'],config[_0x6024('0x4')]['ip'],config['asterisk']['username'],config['asterisk'][_0x6024('0x5')],!![]);ami[_0x6024('0x6')]();ami[_0x6024('0x7')]=BPromise['promisify'](ami[_0x6024('0x8')]);function error(_0x2345bd){logger[_0x6024('0x9')](util[_0x6024('0xa')](_0x6024('0xb'),config['asterisk'][_0x6024('0xc')],config['asterisk']['ip'],config[_0x6024('0x4')][_0x6024('0xd')],util['inspect'](_0x2345bd,![],null)));}function close(){logger[_0x6024('0x9')](util[_0x6024('0xa')](_0x6024('0xe'),config[_0x6024('0x4')]['username'],config['asterisk']['ip'],config[_0x6024('0x4')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x6024('0x7')]({'action':_0x6024('0xf')});};};ami[_0x6024('0x10')]=function(){return function(){return ami[_0x6024('0x7')]({'action':'devicestatelist'});};};ami[_0x6024('0x11')]=function(){return function(){return ami['Action']({'action':_0x6024('0x12')});};};ami[_0x6024('0x13')]=function(){return function(){return ami[_0x6024('0x7')]({'action':'queuesummary'});};};ami[_0x6024('0x14')]=function(){return function(){return ami[_0x6024('0x7')]({'action':_0x6024('0x15')});};};function connect(){logger[_0x6024('0x16')](util[_0x6024('0xa')](_0x6024('0x17'),config['asterisk'][_0x6024('0xc')],config['asterisk']['ip'],config[_0x6024('0x4')][_0x6024('0xd')]));ami[_0x6024('0x18')](_0x6024('0x9'),error);ami[_0x6024('0x18')]('close',close);}ami['on']('connect',connect);ami['on'](_0x6024('0x19'),function(_0x1194d5){logger[_0x6024('0x16')](util[_0x6024('0xa')](_0x6024('0x1a'),config[_0x6024('0x4')]['username'],config[_0x6024('0x4')]['ip'],config[_0x6024('0x4')]['port'],util[_0x6024('0x1b')](_0x1194d5,![],null)));});ami['on'](_0x6024('0x1c'),function(){logger[_0x6024('0x16')](util[_0x6024('0xa')](_0x6024('0x1d'),config['asterisk'][_0x6024('0xc')],config['asterisk']['ip'],config[_0x6024('0x4')][_0x6024('0xd')]));return Promise[_0x6024('0x1e')]()[_0x6024('0x1f')](ami[_0x6024('0x20')]())[_0x6024('0x1f')](ami[_0x6024('0x10')]())['then'](ami[_0x6024('0x11')]())['then'](ami[_0x6024('0x13')]())[_0x6024('0x1f')](ami[_0x6024('0x14')]())[_0x6024('0x21')](function(_0x34558b){logger[_0x6024('0x9')](_0x6024('0x22'),util['inspect'](_0x34558b,{'showHidden':![],'depth':null}));});});ami['once'](_0x6024('0x9'),error);ami['once']('close',close);module['exports']=ami; \ No newline at end of file +var _0xc99c=['exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]'];(function(_0x5ea887,_0x5bb376){var _0x45c71b=function(_0x2353a3){while(--_0x2353a3){_0x5ea887['push'](_0x5ea887['shift']());}};_0x45c71b(++_0x5bb376);}(_0xc99c,0x1a3));var _0xcc99=function(_0x3b5ddb,_0x5c61da){_0x3b5ddb=_0x3b5ddb-0x0;var _0x5e95e4=_0xc99c[_0x3b5ddb];return _0x5e95e4;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xcc99('0x0'));var util=require(_0xcc99('0x1'));var logger=require(_0xcc99('0x2'))(_0xcc99('0x3'));var config=require(_0xcc99('0x4'));var ami=new Manager(config[_0xcc99('0x5')][_0xcc99('0x6')],config[_0xcc99('0x5')]['ip'],config[_0xcc99('0x5')][_0xcc99('0x7')],config[_0xcc99('0x5')][_0xcc99('0x8')],!![]);ami[_0xcc99('0x9')]();ami[_0xcc99('0xa')]=BPromise[_0xcc99('0xb')](ami[_0xcc99('0xc')]);function error(_0x39431c){logger[_0xcc99('0xd')](util[_0xcc99('0xe')](_0xcc99('0xf'),config[_0xcc99('0x5')][_0xcc99('0x7')],config['asterisk']['ip'],config[_0xcc99('0x5')][_0xcc99('0x6')],util[_0xcc99('0x10')](_0x39431c,![],null)));}function close(){logger[_0xcc99('0xd')](util[_0xcc99('0xe')](_0xcc99('0x11'),config['asterisk'][_0xcc99('0x7')],config[_0xcc99('0x5')]['ip'],config[_0xcc99('0x5')][_0xcc99('0x6')]));}ami[_0xcc99('0x12')]=function(){return function(){return ami[_0xcc99('0xa')]({'action':_0xcc99('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xcc99('0xa')]({'action':'devicestatelist'});};};ami[_0xcc99('0x14')]=function(){return function(){return ami[_0xcc99('0xa')]({'action':'sippeerstatus'});};};ami[_0xcc99('0x15')]=function(){return function(){return ami[_0xcc99('0xa')]({'action':'queuesummary'});};};ami[_0xcc99('0x16')]=function(){return function(){return ami['Action']({'action':_0xcc99('0x17')});};};function connect(){logger[_0xcc99('0x18')](util[_0xcc99('0xe')](_0xcc99('0x19'),config[_0xcc99('0x5')][_0xcc99('0x7')],config[_0xcc99('0x5')]['ip'],config[_0xcc99('0x5')]['port']));ami[_0xcc99('0x1a')](_0xcc99('0xd'),error);ami['once'](_0xcc99('0x1b'),close);}ami['on'](_0xcc99('0x1c'),connect);ami['on'](_0xcc99('0x1d'),function(_0xfece2b){logger['info'](util[_0xcc99('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xcc99('0x5')]['username'],config['asterisk']['ip'],config[_0xcc99('0x5')][_0xcc99('0x6')],util[_0xcc99('0x10')](_0xfece2b,![],null)));});ami['on'](_0xcc99('0x1e'),function(){logger['info'](util[_0xcc99('0xe')](_0xcc99('0x1f'),config[_0xcc99('0x5')][_0xcc99('0x7')],config[_0xcc99('0x5')]['ip'],config[_0xcc99('0x5')][_0xcc99('0x6')]));return Promise[_0xcc99('0x20')]()[_0xcc99('0x21')](ami['actionSipShowRegistry']())[_0xcc99('0x21')](ami[_0xcc99('0x22')]())[_0xcc99('0x21')](ami[_0xcc99('0x14')]())[_0xcc99('0x21')](ami[_0xcc99('0x15')]())[_0xcc99('0x21')](ami[_0xcc99('0x16')]())[_0xcc99('0x23')](function(_0x2aa599){logger[_0xcc99('0xd')](_0xcc99('0x24'),util[_0xcc99('0x10')](_0x2aa599,{'showHidden':![],'depth':null}));});});ami[_0xcc99('0x1a')](_0xcc99('0xd'),error);ami[_0xcc99('0x1a')](_0xcc99('0x1b'),close);module[_0xcc99('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9cfc463..02a0754 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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0xd2dd48,_0x1a985){var _0x3853db=function(_0x2cfb39){while(--_0x2cfb39){_0xd2dd48['push'](_0xd2dd48['shift']());}};_0x3853db(++_0x1a985);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1f7a87,_0x234585){_0x1f7a87=_0x1f7a87-0x0;var _0x4e15bc=_0xb43b[_0x1f7a87];return _0x4e15bc;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x52c553,_0x273e5a){var _0x425607=function(_0x25f443){while(--_0x25f443){_0x52c553['push'](_0x52c553['shift']());}};_0x425607(++_0x273e5a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2e67f6,_0x171766){_0x2e67f6=_0x2e67f6-0x0;var _0x56ff30=_0xb43b[_0x2e67f6];return _0x56ff30;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5100b52..c23cfe8 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 _0x2f49=['stringify','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','type','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','TIMEOUT','agiafterat','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actions','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','merge','idHopper','paused','syncQueueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','AMD','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','[syncAgentComplete]','outboundUnknownCallsDay','Unknow','running','INACTIVE','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel][ivr]','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','launchHandleIvr','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','assign','Trunk','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','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','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getVoiceQueueRtPauses','[CatchErlangB]','loggedIn','predictiveIntervalDroppedCallsTimeout','outboundQueuePauses','busyFactor','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','RUNNING','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','getContactDialer','[actionOriginate]\x20','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','../ami','redis','defaults','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CONTACTS_RESCHEDULED','CAMPAIGN_STATUS','[getContactDialer2][Empty]','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','prototype','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','isArray','push','Action','command','format','iftime\x20%s,%s','interval','content','catch','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x2f49,0x16d));var _0x92f4=function(_0x456540,_0x56c437){_0x456540=_0x456540-0x0;var _0x1ab26c=_0x2f49[_0x456540];return _0x1ab26c;};'use strict';var util=require(_0x92f4('0x0'));var _=require(_0x92f4('0x1'));var uuid=require(_0x92f4('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x92f4('0x3'));var utils=require(_0x92f4('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x92f4('0x5'));var config=require(_0x92f4('0x6'));var logger=require(_0x92f4('0x7'))(_0x92f4('0x8'));var loggerBooked=require('../../../config/logger')(_0x92f4('0x9'));var loggerPredictive=require(_0x92f4('0x7'))(_0x92f4('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x92f4('0x7'))('syncQueueSummary');var ami=require(_0x92f4('0xb'));config[_0x92f4('0xc')]=_[_0x92f4('0xd')](config[_0x92f4('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x92f4('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x92f4('0xe'));var RpcSetting=require(_0x92f4('0xf'));var Interval=require(_0x92f4('0x10'));var Action=require('./models/action');var History=require(_0x92f4('0x11'));var Final=require(_0x92f4('0x12'));var AgentComplete=require(_0x92f4('0x13'));var QueueCallerAbandon=require(_0x92f4('0x14'));var Hangup=require(_0x92f4('0x15'));var ipAgi=process[_0x92f4('0x16')][_0x92f4('0x17')]||_0x92f4('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x92f4('0x19')]=function(_0x34b3f5){this[_0x92f4('0x1a')]=this[_0x92f4('0x1a')]?this[_0x92f4('0x1a')][_0x92f4('0x1b')](_0x34b3f5):_0x34b3f5();};function Dialer(_0x1dcce4,_0x321347){this[_0x92f4('0x1c')]=new Sequence();this['preview']=_0x321347;this['voiceQueues']=_0x1dcce4[_0x92f4('0x1d')];this[_0x92f4('0x1e')]=_0x1dcce4[_0x92f4('0x1e')];this[_0x92f4('0x1f')]=_0x1dcce4['agents'];this[_0x92f4('0x20')]=_0x1dcce4[_0x92f4('0x20')];this[_0x92f4('0x21')]=config[_0x92f4('0x21')]||0x2;this[_0x92f4('0x22')]={};this['actions']={};this['contactsId']={};this[_0x92f4('0x23')]={};this[_0x92f4('0x24')]={};this[_0x92f4('0x25')]={};this['startProgressive']={};this[_0x92f4('0x26')]={};this[_0x92f4('0x27')]={};this[_0x92f4('0x28')]={};this[_0x92f4('0x29')]={};ami['on'](_0x92f4('0x2a'),this[_0x92f4('0x2b')]['bind'](this));ami['on'](_0x92f4('0x2c'),this[_0x92f4('0x2d')]['bind'](this));ami['on'](_0x92f4('0x2e'),this[_0x92f4('0x2f')][_0x92f4('0x30')](this));ami['on'](_0x92f4('0x31'),this[_0x92f4('0x32')][_0x92f4('0x30')](this));ami['on']('custom:queuesummary',this[_0x92f4('0x33')]['bind'](this));ami['on'](_0x92f4('0x34'),this[_0x92f4('0x35')][_0x92f4('0x30')](this));ami['on']('hangup',this[_0x92f4('0x36')][_0x92f4('0x30')](this));ami['on']('newexten',this[_0x92f4('0x37')][_0x92f4('0x30')](this));ami['on'](_0x92f4('0x38'),this[_0x92f4('0x39')][_0x92f4('0x30')](this));ami['on']('queuemember',this[_0x92f4('0x3a')][_0x92f4('0x30')](this));ami['on'](_0x92f4('0x3b'),this['syncQueueStatusComplete'][_0x92f4('0x30')](this));this[_0x92f4('0x3c')]();this[_0x92f4('0x3d')]();RpcSetting['getSettings']()[_0x92f4('0x3e')](function(_0x4aaf04){previewRecallmeReminderInterval=_0x4aaf04[_0x92f4('0x3f')];});}function isNotNull(_0x3405ea){return _0x3405ea!==null&&!_[_0x92f4('0x40')](_0x3405ea);}function msgResponse(_0x10aff0,_0xf522a5,_0x505b6f){return{'action':_0x10aff0,'response':_0xf522a5,'message':_0x505b6f,'stack':_0x505b6f};}function emit(_0x1a4e5c,_0x26fbf6,_0x49b86b){io['to'](_0x1a4e5c)['emit'](_0x26fbf6,_0x49b86b);}function emitOutboundVoiceQueueSummary(_0x2025d2){if(_0x2025d2['type']==='outbound'){logger[_0x92f4('0x41')](_0x92f4('0x42'),util[_0x92f4('0x43')](_0x2025d2,{'showHidden':![],'depth':null}));emit(util['format'](_0x92f4('0x44'),_0x2025d2[_0x92f4('0x45')]),_0x92f4('0x46'),_0x2025d2);}}function checkGetDataPredictive(_0x1ae3b8){if(isNotNull(_0x1ae3b8)&&!_['isEmpty'](_0x1ae3b8)){loggerPredictive[_0x92f4('0x47')](_0x92f4('0x48'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1ae3b8[_0x92f4('0x49')]);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x4a'),_0x1ae3b8[_0x92f4('0x4b')]);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x4c'),_0x1ae3b8['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x4d'),_0x1ae3b8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x4e'),_0x1ae3b8[_0x92f4('0x4f')]);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x50'),_0x1ae3b8['predictiveIntervalAvgTalktime']);loggerPredictive[_0x92f4('0x47')]('---------------------------');if(_0x1ae3b8[_0x92f4('0x49')]>0x0){if(!_[_0x92f4('0x40')](_0x1ae3b8[_0x92f4('0x51')])&&_0x1ae3b8[_0x92f4('0x51')]>0x0){return!![];}loggerPredictive[_0x92f4('0x47')](_0x92f4('0x52'));if(!_['isUndefined'](_0x1ae3b8[_0x92f4('0x4f')])&&_0x1ae3b8[_0x92f4('0x4f')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x92f4('0x47')](_0x92f4('0x53'));}}else{loggerPredictive[_0x92f4('0x47')](_0x92f4('0x54'));}return![];}function mergeDataErlangB(_0x3fa781){return function(_0x205010){loggerPredictive[_0x92f4('0x47')](_0x92f4('0x55'));loggerPredictive['info'](_0x92f4('0x56'),_0x205010[_0x92f4('0x57')]);loggerPredictive[_0x92f4('0x47')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x205010[_0x92f4('0x58')]);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x59'),_0x205010[_0x92f4('0x5a')]);loggerPredictive['info'](_0x92f4('0x5b'),_0x205010[_0x92f4('0x5c')]);loggerPredictive[_0x92f4('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x205010[_0x92f4('0x5a')]);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x5d'));_['merge'](_0x3fa781,_0x205010);};}function ifInterval(_0x23458b,_0x261050){if(_['isUndefined'](_0x261050)){return![];}return utils[_0x92f4('0x5e')](undefined,_0x261050)<_0x23458b*0x3c;}function clearPredictiveAttributes(_0x4897b7){if(_0x4897b7[_0x92f4('0x5f')]){_0x4897b7[_0x92f4('0x5f')]=undefined;loggerPredictive['debug'](_0x4897b7[_0x92f4('0x45')],_0x92f4('0x60'));}if(_0x4897b7['startPredictive']){_0x4897b7['startPredictive']=undefined;loggerPredictive[_0x92f4('0x41')](_0x4897b7[_0x92f4('0x45')],_0x92f4('0x61'));}if(_0x4897b7[_0x92f4('0x62')]){clearInterval(_0x4897b7[_0x92f4('0x62')]);_0x4897b7[_0x92f4('0x62')]=undefined;loggerPredictive['debug'](_0x4897b7[_0x92f4('0x45')],_0x92f4('0x63'));}}function loggerCatchPredictive(_0x578d82,_0x3ef12b){return function(_0x9ae415){loggerPredictive[_0x92f4('0x64')](_0x3ef12b[_0x92f4('0x45')],_0x578d82);loggerPredictive['error'](_0x9ae415[_0x92f4('0x65')]);clearPredictiveAttributes(_0x3ef12b);};}function loggerCatch(_0x2e9c5a){return function(_0x38f431){logger[_0x92f4('0x64')](_0x2e9c5a,util[_0x92f4('0x43')](_0x38f431,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4f6300,_0x56beca,_0x542ce1){return function(_0x255201){utils[_0x92f4('0x66')](_0x56beca,_0x542ce1,0x0);_0x56beca[_0x92f4('0x67')]=0x0;logger['error'](_0x4f6300,util['inspect'](_0x255201,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x223884){return function(_0x2853b1){if(isNotNull(_0x2853b1)&&isNotNull(_0x2853b1[0x0])){if(_0x2853b1[0x0][_0x92f4('0x68')]>0x0){_0x223884[_0x92f4('0x69')]=utils['CAMPAIGN_STATUS'][_0x92f4('0x6a')];logger[_0x92f4('0x47')]('[getContactDialer2][ReScheduled]'+_0x223884[_0x92f4('0x45')],_0x2853b1[0x0][_0x92f4('0x68')],'contacts');}else{_0x223884[_0x92f4('0x69')]=utils[_0x92f4('0x6b')]['NO_AVAILABLE_CONTACTS'];logger[_0x92f4('0x47')](_0x92f4('0x6c')+_0x223884[_0x92f4('0x45')]);}}};}function createObjHistory(_0x3ce30d,_0x88f77,_0x4438f1,_0x4109c5,_0x119db2){_0x3ce30d[_0x92f4('0x69')]=_0x4438f1;var _0x3649e6=new Action(_0x3ce30d,_0x88f77);var _0x167cae=new History(_0x3649e6);_0x167cae['state']=_0x4109c5;_0x167cae[_0x92f4('0x6d')]=_0x119db2;_0x167cae[_0x92f4('0x6e')]=_0x3649e6[_0x92f4('0x6f')];return _0x167cae;}function unlockQueueStatus(_0x4a8fd5,_0x5851fc){setTimeout(function(){if(_[_0x92f4('0x40')](_0x4a8fd5['queueStatusComplete'])){loggerBooked[_0x92f4('0x64')](_0x92f4('0x70'),_0x5851fc);}_0x4a8fd5[_0x92f4('0x71')]=!![];loggerBooked[_0x92f4('0x47')](_0x92f4('0x72'),_0x5851fc,JSON['stringify'](_[_0x92f4('0x73')](_0x4a8fd5,[_0x92f4('0x45'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0xb0e663){return function(){if(!isNotNull(_0xb0e663['Interval'])){_0xb0e663[_0x92f4('0x69')]=utils[_0x92f4('0x6b')][_0x92f4('0x74')];throw _0xb0e663[_0x92f4('0x45')]+_0x92f4('0x75');}if(!isNotNull(_0xb0e663[_0x92f4('0x76')][_0x92f4('0x77')])){_0xb0e663[_0x92f4('0x69')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0xb0e663[_0x92f4('0x45')]+_0x92f4('0x75');}if(!isNotNull(_[_0x92f4('0x78')](_0xb0e663[_0x92f4('0x76')]['Intervals']))){_0xb0e663[_0x92f4('0x69')]=utils[_0x92f4('0x6b')]['NULL_INTERVAL'];throw _0xb0e663['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x34d3c8){return function(){if(!utils[_0x92f4('0x79')](_0x34d3c8)){_0x34d3c8['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x34d3c8[_0x92f4('0x45')]+_0x92f4('0x7a');}};}function emitCampaignSummary(_0x471761){if(utils[_0x92f4('0x7b')](_0x471761)){emit(util['format'](_0x92f4('0x7c'),_0x471761[_0x92f4('0x45')]),_0x92f4('0x7d'),_0x471761);}}function loggerCatchQueueSummary(_0x575681,_0x40b1c2){return function(_0x473c6c){clearPredictiveAttributes(_0x40b1c2);emitCampaignSummary(_0x40b1c2);loggerSyncQueueSummary[_0x92f4('0x41')](_0x575681,util[_0x92f4('0x43')](_0x473c6c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5687c6){if(_0x5687c6[_0x92f4('0x7e')]){if(_0x5687c6[_0x92f4('0x7f')]===0x0){_0x5687c6['sendMessageOneNotActive']=![];_0x5687c6[_0x92f4('0x69')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x92f4('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5687c6['name'],_0x92f4('0x80'));}else{_0x5687c6[_0x92f4('0x69')]=utils[_0x92f4('0x6b')][_0x92f4('0x81')];loggerSyncQueueSummary[_0x92f4('0x41')](_0x92f4('0x82'),_0x5687c6[_0x92f4('0x45')],'is\x20disactive');}emitCampaignSummary(_0x5687c6);}}function myreject(_0x4ce74e){return function(_0x4f36d8){return _0x4ce74e(msgResponse(_0x92f4('0x83'),'Error',JSON['stringify'](_0x4f36d8)));};}Dialer['prototype'][_0x92f4('0x84')]=function(_0x1343be){return!_[_0x92f4('0x40')](_0x1343be)&&_0x1343be&&!_[_0x92f4('0x40')](_0x1343be[_0x92f4('0x45')])&&!_[_0x92f4('0x40')](_0x1343be[_0x92f4('0x85')])&&_0x1343be[_0x92f4('0x85')]&&(this[_0x92f4('0x20')][util['format'](_0x92f4('0x86'),_0x1343be[_0x92f4('0x45')])]['status']==='reachable'||this[_0x92f4('0x20')][util['format'](_0x92f4('0x86'),_0x1343be[_0x92f4('0x45')])][_0x92f4('0x87')]==='unmonitored');};Dialer[_0x92f4('0x88')][_0x92f4('0x89')]=function(_0x4a764e){var _0x3f653f=this;return function(){if(!_0x3f653f['isTrunkReachable'](_0x4a764e['Trunk'])){if(!_0x3f653f[_0x92f4('0x84')](_0x4a764e[_0x92f4('0x8a')])){_0x4a764e[_0x92f4('0x69')]=utils[_0x92f4('0x6b')][_0x92f4('0x8b')];throw _0x4a764e[_0x92f4('0x45')]+_0x92f4('0x8c');}}};};Dialer[_0x92f4('0x88')][_0x92f4('0x8d')]=function(_0x28644d,_0x4e577a,_0x40a26c,_0x52f464){var _0x6ef884=this;return function(){var _0x13f808=!![];return _0x6ef884[_0x92f4('0x8e')](_0x28644d,_0x4e577a,_0x40a26c,_0x52f464,_0x13f808);};};Dialer[_0x92f4('0x88')][_0x92f4('0x8f')]=function(_0x1972bd,_0x8d1dd7,_0x41f250,_0x250893){var _0x135196=this;return function(){var _0x4791f5=![];return _0x135196[_0x92f4('0x8e')](_0x1972bd[_0x92f4('0x77')],_0x8d1dd7,_0x41f250,_0x250893,_0x4791f5);};};Dialer['prototype'][_0x92f4('0x8e')]=function(_0x1c519f,_0x1d141e,_0x2cb1d9,_0x5b987f,_0x443dd2){var _0x46d4f2=[];return new Promise(function(_0x5d11cb,_0x1d0cb2){if(!isNotNull(_0x1c519f)){_0x5b987f[_0x92f4('0x69')]=utils[_0x92f4('0x6b')][_0x92f4('0x74')];return _0x1d0cb2(msgResponse('ifTime','Failure',_0x2cb1d9+_0x92f4('0x90')));}if(_[_0x92f4('0x78')](_0x1c519f)){_0x5b987f['message']=utils[_0x92f4('0x6b')]['EMPTY_INTERVAL'];return _0x1d0cb2(msgResponse('ifTime',_0x92f4('0x91'),_0x2cb1d9+_0x92f4('0x92')));}if(_0x1d141e&&_['isUndefined'](config[_0x92f4('0x93')][_0x1d141e])){_0x5b987f['message']=utils[_0x92f4('0x6b')][_0x92f4('0x94')];return _0x1d0cb2(msgResponse(_0x92f4('0x95'),_0x92f4('0x91'),_0x2cb1d9+'\x20Timezone\x20unknow\x20'+_0x1d141e));}if(_[_0x92f4('0x96')](_0x1c519f)){for(var _0x5321ca=0x0;_0x5321ca<_0x1c519f['length'];_0x5321ca+=0x1){_0x46d4f2[_0x92f4('0x97')](ami[_0x92f4('0x98')]({'action':_0x92f4('0x99'),'command':util[_0x92f4('0x9a')](_0x92f4('0x9b'),_0x1c519f[_0x5321ca][_0x92f4('0x9c')],!_[_0x92f4('0x40')](config[_0x92f4('0x93')][_0x1d141e])?_0x1d141e:'')})[_0x92f4('0x3e')](function(_0x236bdb){return _0x236bdb[_0x92f4('0x9d')]['indexOf']('true')>=0x0;})[_0x92f4('0x9e')](myreject(_0x1d0cb2)));}}else{_0x46d4f2[_0x92f4('0x97')](ami[_0x92f4('0x98')]({'action':'command','command':util[_0x92f4('0x9a')](_0x92f4('0x9b'),_0x1c519f,!_[_0x92f4('0x40')](config[_0x92f4('0x93')][_0x1d141e])?_0x1d141e:'')})['then'](function(_0x5a54b4){return _0x5a54b4[_0x92f4('0x9d')][_0x92f4('0x9f')](_0x92f4('0xa0'))>=0x0;})[_0x92f4('0x9e')](myreject(_0x1d0cb2)));}Promise[_0x92f4('0xa1')](_0x46d4f2)[_0x92f4('0x3e')](function(_0x49e21e){var _0x30dec7=_[_0x92f4('0xa2')](_0x49e21e);if(_0x30dec7){return _0x5d11cb(_0x30dec7);}else{_0x5b987f['message']=_0x443dd2?utils[_0x92f4('0x6b')][_0x92f4('0xa3')]:utils[_0x92f4('0x6b')][_0x92f4('0xa4')];return _0x1d0cb2(msgResponse(_0x92f4('0xa5'),_0x92f4('0x91'),_0x92f4('0xa6')+_0x443dd2+'\x20'+_0x2cb1d9+_0x92f4('0xa7')+util['inspect'](_0x1c519f,{'showHidden':![],'depth':null})+_0x92f4('0xa8')+_0x1d141e));}})[_0x92f4('0x9e')](function(_0x54ab59){return _0x1d0cb2(msgResponse(_0x92f4('0x95'),_0x92f4('0x91'),JSON[_0x92f4('0xa9')](_0x54ab59)));});});};Dialer[_0x92f4('0x88')][_0x92f4('0x3c')]=function(){var _0x177801=this;return cmHopper[_0x92f4('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0x92f4('0x3e')](function(){setInterval(function(){_0x177801[_0x92f4('0xab')]();},0x3e8);});};Dialer[_0x92f4('0x88')][_0x92f4('0xab')]=function(){var _0x194e9c=this;var _0x257181;for(var _0x5c19ae in this['campaigns']){if(typeof this[_0x92f4('0x1e')][_0x5c19ae]!==_0x92f4('0xac')){_0x257181=this[_0x92f4('0x1e')][_0x5c19ae];if(utils['isIVRCampaign'](_0x257181)&&utils['isIVRCampaignActive'](_0x257181)){_0x257181[_0x92f4('0x7e')]=!![];Promise[_0x92f4('0xad')]()[_0x92f4('0x3e')](checkIsIVRCampaignActive(_0x257181))[_0x92f4('0x3e')](checkInterval(_0x257181))[_0x92f4('0x3e')](_0x194e9c[_0x92f4('0x89')](_0x257181))[_0x92f4('0x3e')](_0x194e9c[_0x92f4('0x8d')](_0x257181['dialGlobalInterval'],_0x257181[_0x92f4('0xae')],_0x257181[_0x92f4('0x45')],_0x257181))[_0x92f4('0x3e')](_0x194e9c['checkIfTimeIntervals'](_0x257181[_0x92f4('0x76')],_0x257181['dialTimezone'],_0x257181[_0x92f4('0x45')],_0x257181))['then'](_0x194e9c['launchHandleIvr'](_0x257181))[_0x92f4('0x9e')](loggerCatchQueueSummary('[syncCampaigns]',_0x257181));}else{notSendMessagesCampaign(_0x257181);}}}};Dialer['prototype'][_0x92f4('0xaf')]=function(_0x5d11ce){if(_0x5d11ce[_0x92f4('0xb0')]!==_0x92f4('0xa')){clearPredictiveAttributes(_0x5d11ce);}switch(_0x5d11ce[_0x92f4('0xb0')]){case _0x92f4('0xb1'):this[_0x92f4('0xb2')](_0x5d11ce,0x1);break;case _0x92f4('0xb3'):this[_0x92f4('0xb2')](_0x5d11ce,_0x5d11ce[_0x92f4('0xb4')]);break;case _0x92f4('0xa'):this[_0x92f4('0xa')](_0x5d11ce);break;case'booked':this[_0x92f4('0xb2')](_0x5d11ce,0x1);break;default:logger[_0x92f4('0x64')](_0x92f4('0xb5'),_0x5d11ce[_0x92f4('0x45')],_0x92f4('0xb6'));}};Dialer[_0x92f4('0x88')][_0x92f4('0x95')]=function(_0x3a977f,_0x2dd3a1){var _0x55f643=_0x3a977f[_0x92f4('0xae')];var _0x2311aa=_0x2dd3a1?_0x3a977f[_0x92f4('0xb7')]:_0x3a977f[_0x92f4('0x76')][_0x92f4('0x77')];logger[_0x92f4('0xb8')]('Dialer::ifTime()',_0x2311aa,_0x55f643,_0x3a977f[_0x92f4('0x45')],util['format'](_0x92f4('0xb9'),_0x3a977f[_0x92f4('0x45')],_0x3a977f['id']));var _0x4a9697=null;return Interval['intervalIftime'](_0x2311aa,_0x55f643)[_0x92f4('0x3e')](function(_0x1e6377){if(_0x1e6377===!![]){return _0x1e6377;}else{_0x3a977f[_0x92f4('0x69')]=_0x2dd3a1?utils[_0x92f4('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x92f4('0xa4')];_0x4a9697=msgResponse(_0x92f4('0xa5'),'Failure',_0x92f4('0xa6')+_0x2dd3a1+'\x20'+_0x3a977f['name']+_0x92f4('0xa7')+util[_0x92f4('0x43')](_0x2311aa,{'showHidden':![],'depth':null})+_0x92f4('0xa8')+_0x55f643);}if(_0x4a9697!==null){logger[_0x92f4('0xb8')](_0x92f4('0xba'),_0x4a9697);_0x4a9697[_0x92f4('0xbb')]=_0x2dd3a1;throw _0x4a9697;}})['catch'](function(_0x3a650f){logger[_0x92f4('0x64')]('AMI\x20IfTime',_0x3a650f);throw msgResponse(_0x92f4('0x83'),'Error',util[_0x92f4('0x43')](_0x3a650f,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x101a59){if(this['voiceQueues'][_0x101a59[_0x92f4('0xbc')]]){if(this[_0x92f4('0x23')][_0x101a59[_0x92f4('0xbd')]]&&this[_0x92f4('0x23')][_0x101a59[_0x92f4('0xbd')]][_0x92f4('0xbe')]!==_0x92f4('0xbf')){this[_0x92f4('0xc0')](this[_0x92f4('0x1d')][_0x101a59['queue']]);this[_0x92f4('0x23')][_0x101a59[_0x92f4('0xbd')]]['answertime']=moment()[_0x92f4('0x9a')](_0x92f4('0xc1'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x103dba){var _0x534faa=this[_0x92f4('0x23')][_0x103dba['uniqueid']];if(this[_0x92f4('0x1d')][_0x103dba[_0x92f4('0xbc')]]){if(_0x534faa&&_0x534faa[_0x92f4('0xbe')]!==_0x92f4('0xbf')){delete this[_0x92f4('0x23')][_0x103dba['uniqueid']];this['voiceQueues'][_0x103dba[_0x92f4('0xbc')]][_0x92f4('0xc2')]+=0x1;var _0x33c12e=new AgentComplete(_0x534faa,_0x103dba);if(_0x103dba[_0x92f4('0xc3')]===_0x92f4('0xc4')){_0x33c12e['agiafterat']=this[_0x92f4('0x1d')][_0x103dba[_0x92f4('0xbc')]][_0x92f4('0xc5')]&&this[_0x92f4('0x1d')][_0x103dba[_0x92f4('0xbc')]]['dialAgiAfterHangupAgent']?moment()[_0x92f4('0x9a')](_0x92f4('0xc1')):undefined;}hopperUtils[_0x92f4('0xc6')](_0x33c12e)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xc7')));hopperUtils[_0x92f4('0xc8')](_0x33c12e)[_0x92f4('0x9e')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x92f4('0x88')][_0x92f4('0x2d')]=function(_0x5373a7){var _0x27bca7=this[_0x92f4('0x23')][_0x5373a7[_0x92f4('0xbd')]];var _0x5741d9=this;var _0x2d9ae8=![];var _0xb770e;var _0x5f55cc;if(this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]]){if(_0x27bca7&&_0x27bca7[_0x92f4('0xbe')]!==_0x92f4('0xbf')){delete this['uniqueId'][_0x5373a7['uniqueid']];this[_0x92f4('0xc0')](this[_0x92f4('0x1d')][_0x5373a7['queue']]);_0x27bca7[_0x92f4('0xc9')]=moment()[_0x92f4('0x9a')](_0x92f4('0xc1'));var _0xa9009d=new QueueCallerAbandon(_0x27bca7,_0x5373a7);if(utils[_0x92f4('0x5e')](_0x27bca7['droptime'],_0x27bca7[_0x92f4('0xca')])>=_0x27bca7[_0x92f4('0xcb')]){this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x92f4('0x1d')][_0x5373a7['queue']][_0x92f4('0xcc')]+=0x1;this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xcd')]+=0x1;_0xa9009d[_0x92f4('0xce')]=0xa;_0xa9009d[_0x92f4('0x6d')]=_0x92f4('0xcf');_0xa9009d['dropreason']=_0x92f4('0xd0');_0xa9009d[_0x92f4('0xd1')]=this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xc5')]?moment()[_0x92f4('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0xa9009d['countdropretry']+=0x1;_0xa9009d[_0x92f4('0xd2')]+=0x1;_0xb770e=this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]]['dialDropRetryFrequency'];_0x5f55cc=this['voiceQueues'][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xd3')];hopperUtils[_0x92f4('0xd4')](_0xa9009d,_0xa9009d[_0x92f4('0xce')],_0x27bca7['voiceQueue'])[_0x92f4('0x3e')](function(_0x52be13){_0x2d9ae8=_0x52be13[_0x92f4('0xd5')]==0x1;if(_0xa9009d[_0x92f4('0xd6')]>=_0x5741d9[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xd7')]){_0x5741d9[_0x92f4('0xd8')](_0xa9009d,_0x52be13[_0x92f4('0xd5')]);}else{hopperUtils[_0x92f4('0xd9')]({'active':![],'countdropretry':_0xa9009d[_0x92f4('0xd6')],'scheduledat':moment()[_0x92f4('0xda')](_0x5741d9['voiceQueues'][_0x5373a7[_0x92f4('0xbc')]]['dialDropRetryFrequency'],'minutes')[_0x92f4('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x27bca7[_0x92f4('0xdb')],'ListId':_0x27bca7['ListId'],'VoiceQueueId':_0x27bca7['VoiceQueueId']||undefined,'CampaignId':_0x27bca7['CampaignId']||undefined})[_0x92f4('0x9e')](loggerCatch('[rescheduleContact][Drop]'));var _0x3ff129=new History(_0xa9009d);_0x3ff129['state']=0xa;_0x3ff129[_0x92f4('0x6d')]=_0x92f4('0xcf');_0x3ff129[_0x92f4('0x6f')]=moment()['format'](_0x92f4('0xc1'));_0x3ff129['endtime']=_0x3ff129[_0x92f4('0x6f')];_0x3ff129['calleridname']=_0xa9009d[_0x92f4('0xdc')];_0x3ff129[_0x92f4('0xdd')]=_0xa9009d[_0x92f4('0xdd')];hopperUtils[_0x92f4('0xc6')](_0x3ff129)[_0x92f4('0x9e')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x2d9ae8)hopperUtils[_0x92f4('0xde')](_0xa9009d,_0xb770e,_0x5f55cc)[_0x92f4('0x3e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x5373a7[_0x92f4('0xbc')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xdf')]+=0x1;_0xa9009d['state']=0xb;_0xa9009d[_0x92f4('0x6d')]=_0x92f4('0xe0');_0xa9009d[_0x92f4('0xe1')]='CALLEREXIT';_0xa9009d['countabandonedretry']+=0x1;_0xa9009d[_0x92f4('0xd2')]+=0x1;_0xb770e=this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]]['dialAbandonedRetryFrequency'];_0x5f55cc=this[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x92f4('0xd4')](_0xa9009d,_0xa9009d[_0x92f4('0xce')],_0x27bca7['voiceQueue'])[_0x92f4('0x3e')](function(_0x1f1ff4){if(_0xa9009d[_0x92f4('0xe2')]>=_0x5741d9[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xe3')]){_0x5741d9[_0x92f4('0xd8')](_0xa9009d,_0x1f1ff4[_0x92f4('0xd5')]);}else{hopperUtils[_0x92f4('0xd9')]({'active':![],'countabandonedretry':_0xa9009d['countabandonedretry'],'scheduledat':moment()[_0x92f4('0xda')](_0x5741d9[_0x92f4('0x1d')][_0x5373a7[_0x92f4('0xbc')]][_0x92f4('0xe4')],_0x92f4('0xe5'))[_0x92f4('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x27bca7[_0x92f4('0xdb')],'ListId':_0x27bca7[_0x92f4('0xe6')],'VoiceQueueId':_0x27bca7[_0x92f4('0xe7')]||undefined,'CampaignId':_0x27bca7[_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xe9')));var _0xe0432b=new History(_0xa9009d);_0xe0432b[_0x92f4('0xce')]=0xb;_0xe0432b[_0x92f4('0x6d')]=_0x92f4('0xe0');_0xe0432b[_0x92f4('0x6f')]=moment()['format'](_0x92f4('0xc1'));_0xe0432b[_0x92f4('0x6e')]=_0xe0432b[_0x92f4('0x6f')];_0xe0432b[_0x92f4('0xdc')]=_0xa9009d[_0x92f4('0xdc')];_0xe0432b['calleridnum']=_0xa9009d[_0x92f4('0xdd')];hopperUtils[_0x92f4('0xc6')](_0xe0432b)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xea')));}})['then'](function(){if(_0x2d9ae8)hopperUtils[_0x92f4('0xde')](_0xa9009d,_0xb770e,_0x5f55cc)[_0x92f4('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x92f4('0x88')][_0x92f4('0x37')]=function(_0x2ba6c5){if(this['actions'][_0x2ba6c5[_0x92f4('0xbd')]]){this['actions'][_0x2ba6c5[_0x92f4('0xbd')]][_0x92f4('0xeb')]=_0x2ba6c5['channel'];}if(this[_0x92f4('0x23')][_0x2ba6c5[_0x92f4('0xbd')]]){this[_0x92f4('0x23')][_0x2ba6c5[_0x92f4('0xbd')]][_0x92f4('0xeb')]=_0x2ba6c5['channel'];}};Dialer[_0x92f4('0x88')][_0x92f4('0x3a')]=function(_0x31c9ba){if(!this[_0x92f4('0xec')][_0x31c9ba[_0x92f4('0xed')]]){return;}var _0x4fc771=this[_0x92f4('0x1d')][this[_0x92f4('0xec')][_0x31c9ba['actionid']][_0x92f4('0xbc')]][_0x92f4('0xee')]||_0x92f4('0xef');if(_0x4fc771===_0x92f4('0xf0')){if(this['actions'][_0x31c9ba[_0x92f4('0xed')]]&&_[_0x92f4('0xf1')](this['actions'][_0x31c9ba['actionid']][_0x92f4('0xf2')])&&_0x31c9ba[_0x92f4('0x87')]==='1'&&_0x31c9ba['paused']==='0'){if(this[_0x92f4('0x1f')][_0x31c9ba['stateinterface']]){if(!this['agents'][_0x31c9ba[_0x92f4('0xf3')]][_0x92f4('0xf2')]){this[_0x92f4('0x1f')][_0x31c9ba[_0x92f4('0xf3')]][_0x92f4('0xf2')]=!![];this[_0x92f4('0xec')][_0x31c9ba[_0x92f4('0xed')]][_0x92f4('0xf2')]=!![];this['actions'][_0x31c9ba['actionid']][_0x92f4('0xf3')]=_0x31c9ba['stateinterface'];}}}}else if(_0x4fc771==='rrmemory'){if(this[_0x92f4('0xec')][_0x31c9ba['actionid']]){if(this['agents'][_0x31c9ba[_0x92f4('0xf3')]]){this[_0x92f4('0xec')][_0x31c9ba[_0x92f4('0xed')]][_0x92f4('0xf3')]=_0x31c9ba[_0x92f4('0xf3')];if(_[_0x92f4('0xf1')](this[_0x92f4('0x27')][this[_0x92f4('0xec')][_0x31c9ba['actionid']]['queue']])){this[_0x92f4('0x27')][this['actions'][_0x31c9ba[_0x92f4('0xed')]][_0x92f4('0xbc')]]=[];}this[_0x92f4('0x27')][this[_0x92f4('0xec')][_0x31c9ba[_0x92f4('0xed')]][_0x92f4('0xbc')]][_0x92f4('0x97')](_[_0x92f4('0xf4')](_[_0x92f4('0x73')](this[_0x92f4('0xec')][_0x31c9ba['actionid']],[_0x92f4('0xf5'),_0x92f4('0xf3')]),{'status':_0x31c9ba[_0x92f4('0x87')],'paused':_0x31c9ba[_0x92f4('0xf6')]}));}}}};Dialer[_0x92f4('0x88')][_0x92f4('0xf7')]=function(_0x142b6b){if(!this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]]){return;}var _0x2f5b5e=this;var _0x434872=this[_0x92f4('0x1d')][this[_0x92f4('0xec')][_0x142b6b['actionid']][_0x92f4('0xbc')]];var _0x403bb7=_0x434872[_0x92f4('0xee')]||_0x92f4('0xef');if(_0x403bb7===_0x92f4('0xf0')){if(this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]]&&this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xf3')]){this[_0x92f4('0xf8')][_0x92f4('0xf9')](this[_0x92f4('0xec')][_0x142b6b['actionid']][_0x92f4('0xf5')],this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xf3')])[_0x92f4('0x9e')](function(_0x5988f9){logger[_0x92f4('0x64')](_0x92f4('0xfa'),util[_0x92f4('0x43')](_0x5988f9,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2f5b5e['updateOriginated'](_0x2f5b5e['voiceQueues'][_0x2f5b5e[_0x92f4('0xec')][_0x142b6b['actionid']][_0x92f4('0xbc')]]);_0x2f5b5e[_0x92f4('0x1f')][_0x2f5b5e[_0x92f4('0xec')][_0x142b6b['actionid']][_0x92f4('0xf3')]]['locked']=![];delete _0x2f5b5e[_0x92f4('0xec')][_0x142b6b['actionid']];unlockQueueStatus(_0x434872);});}else{this[_0x92f4('0xc0')](this[_0x92f4('0x1d')][this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xbc')]]);hopperUtils[_0x92f4('0xd9')]({'active':![],'ContactId':this['actions'][_0x142b6b['actionid']][_0x92f4('0xdb')],'ListId':this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xe6')],'VoiceQueueId':this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xe7')]||undefined,'CampaignId':this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xfb')));delete this['actions'][_0x142b6b[_0x92f4('0xed')]];unlockQueueStatus(_0x434872);}}else if(_0x403bb7===_0x92f4('0xef')){var _0x59ee13;if(this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]]&&!_[_0x92f4('0x78')](this[_0x92f4('0x27')][this['actions'][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xbc')]])){if(this[_0x92f4('0x28')][_0x2f5b5e[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]]['queue']]){this['queueBookedRR'][_0x2f5b5e[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]]['queue']]=this[_0x92f4('0x28')][this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xbc')]]?this[_0x92f4('0x28')][this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xbc')]]:this['queueBooked'][this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xbc')]]?this[_0x92f4('0x27')][this[_0x92f4('0xec')][_0x142b6b['actionid']][_0x92f4('0xbc')]][_0x92f4('0xfc')]||0x0:0x0;}this[_0x92f4('0x27')][this[_0x92f4('0xec')][_0x142b6b[_0x92f4('0xed')]]['queue']][_0x92f4('0xfc')]=this['queueBookedRR'][this['actions'][_0x142b6b[_0x92f4('0xed')]][_0x92f4('0xbc')]];for(var _0x593c18=0x0;_0x593c18=_0x59ef42[_0x92f4('0x123')]){_0x35b510[_0x92f4('0x124')](_0x35e44b,_0x16f3cf,_0x42e6bb,'reason19\x20machine....');}else{if(_0x35e44b['countmachineretry']>=_0x59ef42[_0x92f4('0x125')]){_0x35b510[_0x92f4('0x126')](_0x35e44b,_0x16f3cf,_0x42e6bb,_0x92f4('0x127'));}else{hopperUtils[_0x92f4('0xd9')]({'active':![],'countmachineretry':_0x35e44b[_0x92f4('0x11c')],'scheduledat':moment()['add'](_0x59ef42[_0x92f4('0x128')],'minutes')[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0x35e44b['ContactId'],'ListId':_0x35e44b[_0x92f4('0xe6')],'VoiceQueueId':_0x35e44b[_0x92f4('0xe7')]||undefined,'CampaignId':_0x35e44b[_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x129')));_0x16f3cf({'reschedule':0x1});}}});}if(_0x5a2aac['type']===_0x92f4('0xbf')&&this['campaigns'][_0x5a2aac[_0x92f4('0xbc')]]['dialAMDActive']&&_0x2a8b07[_0x92f4('0x10d')]===_0x92f4('0x10e')){delete this['uniqueId'][_0x2a8b07[_0x92f4('0xbd')]];this[_0x92f4('0xc0')](this[_0x92f4('0x1e')][_0x5a2aac[_0x92f4('0xbc')]]);_0x2a93f3=new Hangup(_0x5a2aac,_0x2a8b07);_0x2a93f3[_0x92f4('0xce')]=0x12;_0x2a93f3[_0x92f4('0x6d')]=_0x92f4('0x110');_0x2a93f3[_0x92f4('0x111')]=_0x92f4('0x12a');ami['emit'](_0x92f4('0x113'),ut[_0x92f4('0x114')](_0x2a93f3,_0x92f4('0x115')));this[_0x92f4('0x116')](_0x2a93f3,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x5a2aac[_0x92f4('0xbe')]==='ivr'&&this[_0x92f4('0x1e')][_0x5a2aac['queue']][_0x92f4('0x119')]&&_0x2a8b07[_0x92f4('0x10d')]===_0x92f4('0x11a')){return new Promise(function(_0x5a7b76,_0x49b564){delete _0x35b510[_0x92f4('0x23')][_0x2a8b07['uniqueid']];_0x35b510['updateOriginated'](_0x35b510['campaigns'][_0x5a2aac[_0x92f4('0xbc')]]);_0x35b510[_0x92f4('0x1e')][_0x5a2aac[_0x92f4('0xbc')]]['outboundAnswerCallsDay']+=0x1;_0x35b510[_0x92f4('0x1e')][_0x5a2aac['queue']][_0x92f4('0x10f')]+=0x1;var _0x4a06e2=_0x35b510[_0x92f4('0x1e')][_0x5a2aac[_0x92f4('0xbc')]];var _0x37fb46=new Hangup(_0x5a2aac,_0x2a8b07);_0x37fb46[_0x92f4('0xce')]=0x13;_0x37fb46['statedesc']='Machine';_0x37fb46['membername']=_0x92f4('0x12a');_0x37fb46['countmachineretry']+=0x1;_0x37fb46[_0x92f4('0xd2')]+=0x1;_0x37fb46['amd']=!![];ami[_0x92f4('0x112')]('custom:amd',ut['buildObj'](_0x37fb46,_0x92f4('0x115')));hopperUtils[_0x92f4('0xc6')](_0x37fb46)[_0x92f4('0x9e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x37fb46['countbusyretry']+_0x37fb46[_0x92f4('0x11f')]+_0x37fb46[_0x92f4('0x120')]+_0x37fb46[_0x92f4('0x121')]+_0x37fb46[_0x92f4('0xd6')]+_0x37fb46[_0x92f4('0xe2')]+_0x37fb46[_0x92f4('0x11c')]+_0x37fb46[_0x92f4('0x122')]>=_0x4a06e2[_0x92f4('0x123')]){_0x35b510[_0x92f4('0x124')](_0x37fb46,_0x5a7b76,_0x49b564,'reason19\x20machine....');}else{if(_0x37fb46[_0x92f4('0x11c')]>=_0x4a06e2[_0x92f4('0x125')]){_0x35b510['createStateFinal'](_0x37fb46,_0x5a7b76,_0x49b564,_0x92f4('0x127'));}else{hopperUtils[_0x92f4('0xd9')]({'active':![],'countmachineretry':_0x37fb46[_0x92f4('0x11c')],'scheduledat':moment()[_0x92f4('0xda')](_0x4a06e2[_0x92f4('0x128')],_0x92f4('0xe5'))[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0x37fb46['ContactId'],'ListId':_0x37fb46[_0x92f4('0xe6')],'VoiceQueueId':_0x37fb46[_0x92f4('0xe7')]||undefined,'CampaignId':_0x37fb46['CampaignId']||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x129')));_0x5a7b76({'reschedule':0x1});}}});}}};Dialer[_0x92f4('0x88')]['syncHangup']=function(_0x275a4b){var _0x21ac28=this['uniqueId'][_0x275a4b[_0x92f4('0xbd')]];var _0x23f00d;if(_0x21ac28&&_0x21ac28[_0x92f4('0xbe')]===_0x92f4('0xbf')){delete this[_0x92f4('0x23')][_0x275a4b[_0x92f4('0xbd')]];this[_0x92f4('0xc0')](this[_0x92f4('0x1e')][_0x21ac28[_0x92f4('0xbc')]]);this[_0x92f4('0x1e')][_0x21ac28[_0x92f4('0xbc')]][_0x92f4('0x12b')]+=0x1;_0x23f00d=new Hangup(_0x21ac28,_0x275a4b);hopperUtils[_0x92f4('0xc6')](_0x23f00d)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x12c')));hopperUtils['moveContactManagedDialer'](_0x23f00d)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x12d')));}if(_0x21ac28&&_0x21ac28['type']!==_0x92f4('0xbf')&&isNotNull(this[_0x92f4('0x1d')][_0x21ac28[_0x92f4('0xbc')]]['dialQueueProject'])){delete this['uniqueId'][_0x275a4b[_0x92f4('0xbd')]];this[_0x92f4('0xc0')](this[_0x92f4('0x1d')][_0x21ac28['queue']]);this[_0x92f4('0x1d')][_0x21ac28[_0x92f4('0xbc')]][_0x92f4('0xc2')]+=0x1;this[_0x92f4('0x1d')][_0x21ac28['queue']][_0x92f4('0x10f')]+=0x1;_0x23f00d=new Hangup(_0x21ac28,_0x275a4b);_0x23f00d[_0x92f4('0xce')]=0x10;_0x23f00d[_0x92f4('0x6d')]=_0x92f4('0x12e');_0x23f00d[_0x92f4('0x111')]=_0x92f4('0x12f');hopperUtils[_0x92f4('0xc6')](_0x23f00d)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x12c')));hopperUtils[_0x92f4('0xc8')](_0x23f00d)[_0x92f4('0x9e')](loggerCatch('[syncHangupIvr]'));}if(_0x21ac28&&_0x21ac28['type']!==_0x92f4('0xbf')&&!isNotNull(this[_0x92f4('0x1d')][_0x21ac28['queue']][_0x92f4('0x130')])){if(_0x275a4b[_0x92f4('0x131')]==='Normal\x20Clearing'){delete this[_0x92f4('0x23')][_0x275a4b[_0x92f4('0xbd')]];this[_0x92f4('0x1d')][_0x21ac28[_0x92f4('0xbc')]]['outboundAnswerCallsDay']+=0x1;const _0x1c0560=new AgentComplete(_0x21ac28,_0x275a4b);_0x1c0560[_0x92f4('0xe8')]=this[_0x92f4('0x1d')][_0x21ac28[_0x92f4('0xbc')]]['id'];hopperUtils[_0x92f4('0xc6')](_0x1c0560)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xc7')));hopperUtils[_0x92f4('0xc8')](_0x1c0560)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x132')));}else{delete this[_0x92f4('0x23')][_0x275a4b[_0x92f4('0xbd')]];this['updateOriginated'](this[_0x92f4('0x1d')][_0x21ac28['queue']]);this[_0x92f4('0x1d')][_0x21ac28[_0x92f4('0xbc')]][_0x92f4('0x133')]+=0x1;_0x23f00d=new Hangup(_0x21ac28,_0x275a4b);_0x23f00d[_0x92f4('0xce')]=0xc;_0x23f00d[_0x92f4('0x6d')]=_0x275a4b['cause-txt'];_0x23f00d[_0x92f4('0x111')]=_0x92f4('0x134');hopperUtils['createHistory'](_0x23f00d)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x12c')));hopperUtils[_0x92f4('0xc8')](_0x23f00d)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x12d')));}}};Dialer[_0x92f4('0x88')]['syncQueueSummary']=function(_0xe10b97){var _0x4417d9=this;if(!_0x4417d9[_0x92f4('0x29')][_0xe10b97[_0x92f4('0x45')]]){_0x4417d9[_0x92f4('0x29')][_0xe10b97['name']]={'running':![]};}else if(_0x4417d9[_0x92f4('0x29')][_0xe10b97['name']]['running']===!![]){return;}else if(_0x4417d9[_0x92f4('0x29')][_0xe10b97[_0x92f4('0x45')]][_0x92f4('0x135')]===![]){_0x4417d9[_0x92f4('0x29')][_0xe10b97[_0x92f4('0x45')]][_0x92f4('0x135')]=!![];}var _0x179e54=_0x4417d9[_0x92f4('0x1d')][_0xe10b97[_0x92f4('0x45')]];var _0x1f6506=_0x179e54[_0x92f4('0x69')]!==utils[_0x92f4('0x6b')][_0x92f4('0x136')];var _0x2d980b=utils[_0x92f4('0x137')](_0x179e54);_0x179e54[_0x92f4('0x138')]=utils[_0x92f4('0x139')](_0x179e54,_0x4417d9[_0x92f4('0x20')]);Promise[_0x92f4('0xad')]()['then'](function(){if(_0x179e54['statusMessage']===utils[_0x92f4('0x6b')][_0x92f4('0x136')]){if(_0x1f6506){clearPredictiveAttributes(_0x179e54);_0xe10b97[_0x92f4('0x25')]=undefined;_0xe10b97[_0x92f4('0x5f')]=undefined;}if(_0x179e54['statusMessage']===utils[_0x92f4('0x6b')][_0x92f4('0x136')]){_0xe10b97[_0x92f4('0x13a')]=0x0;_0xe10b97[_0x92f4('0xf6')]=0x0;_0xe10b97[_0x92f4('0x13b')]=0x0;_0xe10b97[_0x92f4('0x13c')]=0x0;_0xe10b97[_0x92f4('0x13d')]=0x0;}}else if(_0x179e54[_0x92f4('0x138')]===utils[_0x92f4('0x6b')][_0x92f4('0x13e')]&&!_0x2d980b){return _0x4417d9[_0x92f4('0x95')](_0x179e54,!![])['then'](function(){return _0x4417d9['ifTime'](_0x179e54,![]);})['then'](function(){return _0x4417d9['checkDialMethod'](_0x179e54);})[_0x92f4('0x9e')](function(_0x227ff8){loggerSyncQueueSummary[_0x92f4('0x41')]('[syncQueueSummary]',util[_0x92f4('0x43')](_0x227ff8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x179e54);});}else{clearPredictiveAttributes(_0x179e54);}})[_0x92f4('0x3e')](function(){var _0x520d12=_0xe10b97[_0x92f4('0x13f')](_0x179e54);if(_0x520d12||_0x179e54[_0x92f4('0x140')]){_0x179e54[_0x92f4('0x140')]=![];_0xe10b97[_0x92f4('0x141')](_0x179e54);Object['assign'](_0x179e54,_0xe10b97);emitOutboundVoiceQueueSummary(_0xe10b97);}_0x4417d9[_0x92f4('0x29')][_0x179e54[_0x92f4('0x45')]][_0x92f4('0x135')]=![];})['catch'](function(_0xf9d8a0){logger[_0x92f4('0x64')]('[syncQueueSummary]',util[_0x92f4('0x43')](_0xf9d8a0,{'showHidden':![],'depth':null}));_0x4417d9[_0x92f4('0x29')][_0x179e54[_0x92f4('0x45')]][_0x92f4('0x135')]=![];});};Dialer[_0x92f4('0x88')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x3de359=_[_0x92f4('0x142')](this[_0x92f4('0x1d')],function(_0x45fed8){return _0x45fed8[_0x92f4('0x143')];});var _0x354440=_['filter'](this[_0x92f4('0x1f')],function(_0x5d8cc1){return _0x5d8cc1['online']&&_0x5d8cc1['status']==='reachable';});if(_0x3de359[_0x92f4('0xfd')]>0x0&&_0x354440[_0x92f4('0xfd')]>0x0){return Promise['resolve']()['then'](cmHopper[_0x92f4('0x144')](_['map'](_0x3de359,'id'),previewRecallmeReminderInterval,_['map'](_0x354440,'id')))['then'](function(_0x3c1b9c){for(var _0x4a93d0=0x0;_0x4a93d0<_0x3c1b9c[_0x92f4('0xfd')];_0x4a93d0++){var _0x2811ef=_0x3c1b9c[_0x4a93d0][_0x92f4('0x145')]['name'];if(_0x2811ef)io['to'](util[_0x92f4('0x9a')](_0x92f4('0x146'),_0x2811ef))[_0x92f4('0x112')](_0x92f4('0x147'),{'hopper':_0x3c1b9c[_0x4a93d0]});}})[_0x92f4('0x9e')](function(_0x1c21c2){logger['error'](_0x92f4('0x148'),_0x1c21c2);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x92f4('0x88')][_0x92f4('0x3d')]=function(){var _0x3b7848=this;setInterval(function(){_0x3b7848['clearZombieChannels'](_0x3b7848[_0x92f4('0x23')],'[uniqueid]');_0x3b7848[_0x92f4('0x149')](_0x3b7848[_0x92f4('0xec')],'[actions]');},0x32c8);};Dialer[_0x92f4('0x88')]['clearZombieChannels']=function(_0x5b6cb4,_0x82e0df){var _0x260896=this;for(var _0x53da7b in _0x5b6cb4){if(typeof _0x5b6cb4[_0x53da7b]!==_0x92f4('0xac')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x5b6cb4[_0x53da7b])){return ami['Action']({'action':_0x92f4('0x87'),'channel':_0x5b6cb4[_0x53da7b][_0x92f4('0xeb')]})[_0x92f4('0x9e')](function(_0x409796){if(_0x409796[_0x92f4('0x69')]===_0x92f4('0x14a')){setTimeout(function(){if(_0x5b6cb4[_0x53da7b]&&_0x5b6cb4[_0x53da7b]['type']!=='ivr'){_0x260896[_0x92f4('0xc0')](_0x260896[_0x92f4('0x1d')][_0x5b6cb4[_0x53da7b][_0x92f4('0xbc')]]);logger[_0x92f4('0x64')]('[Dialer][checkChannel]',_0x82e0df,_0x53da7b,_0x5b6cb4[_0x53da7b][_0x92f4('0xbc')]);delete _0x5b6cb4[_0x53da7b];}if(_0x5b6cb4[_0x53da7b]&&_0x5b6cb4[_0x53da7b][_0x92f4('0xbe')]===_0x92f4('0xbf')){_0x260896['updateOriginated'](_0x260896[_0x92f4('0x1e')][_0x5b6cb4[_0x53da7b][_0x92f4('0xbc')]]);logger[_0x92f4('0x64')](_0x92f4('0x14b'),_0x82e0df,_0x53da7b,_0x5b6cb4[_0x53da7b][_0x92f4('0xbc')]);delete _0x5b6cb4[_0x53da7b];}},0x2328);}});}});}}};Dialer[_0x92f4('0x88')]['getVoiceQueueRtPauses']=function(_0x58b732){return Promise[_0x92f4('0xad')]()[_0x92f4('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x58b732))[_0x92f4('0x9e')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x92f4('0x88')][_0x92f4('0xc0')]=function(_0x592f7c){if(!_[_0x92f4('0x40')](_0x592f7c)&&_0x592f7c!==null){if(typeof _0x592f7c['originated']!==_0x92f4('0xac')){if(_0x592f7c['originated']>0x0){_0x592f7c[_0x92f4('0x7f')]-=0x1;}else{logger[_0x92f4('0x64')](_0x92f4('0x14c'));}}}else{logger[_0x92f4('0x64')](_0x92f4('0x14d'));}};Dialer['prototype'][_0x92f4('0x14e')]=function(_0x17bcea,_0x175fea){var _0x4d0e3e=this;return function(_0x3bc89f){_0x4d0e3e['updateOriginated'](_0x175fea);logger[_0x92f4('0x64')](_0x17bcea,util[_0x92f4('0x43')](_0x3bc89f,{'showHidden':![],'depth':null}));};};Dialer[_0x92f4('0x88')][_0x92f4('0x14f')]=function(_0x532f12,_0x2271a1,_0x1df479){var _0x484974={'state':0x19,'statedesc':'notFound'};this[_0x92f4('0xc0')](_0x2271a1);this[_0x92f4('0x116')](_[_0x92f4('0xf4')](_0x484974,_[_0x92f4('0x73')](_0x1df479,[_0x92f4('0xdb'),_0x92f4('0xe6'),_0x92f4('0x150'),_0x92f4('0xe7'),_0x92f4('0xe8')])),_0x92f4('0x151'),_0x92f4('0x152'));logger[_0x92f4('0x64')](_0x532f12);};Dialer['prototype'][_0x92f4('0x116')]=function(_0x42871c,_0x553248,_0x2bf474){hopperUtils[_0x92f4('0xc6')](_0x42871c)[_0x92f4('0x9e')](loggerCatch(_0x553248));hopperUtils[_0x92f4('0xc8')](_0x42871c)['catch'](loggerCatch(_0x2bf474));};Dialer[_0x92f4('0x88')][_0x92f4('0xd8')]=function(_0x3f1cc9,_0x4a6dc4){hopperUtils[_0x92f4('0xc6')](_0x3f1cc9)['catch'](loggerCatch(_0x92f4('0xc7')));if(_0x4a6dc4==0x0){hopperUtils[_0x92f4('0xc8')](_0x3f1cc9)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x153')));}};Dialer[_0x92f4('0x88')][_0x92f4('0x148')]=function(_0x3fd479){return Promise[_0x92f4('0xad')]()[_0x92f4('0x3e')](cmHopper[_0x92f4('0x144')](_0x3fd479['id'],previewRecallmeReminderInterval))[_0x92f4('0x3e')](function(_0x36e313){for(var _0x75afcd=0x0;_0x75afcd<_0x36e313[_0x92f4('0xfd')];_0x75afcd++){var _0x54d109=_0x36e313[_0x75afcd]['Agent']['name'];if(_0x54d109)io['to'](util[_0x92f4('0x9a')]('user:%s',_0x54d109))[_0x92f4('0x112')]('user:dialPreviewRecallReminder',{'hopper':_0x36e313[_0x75afcd]});}})[_0x92f4('0x9e')](function(){});};Dialer['prototype'][_0x92f4('0x154')]=function(_0x37e5c7){var _0x2cdb93=this;return function(){_0x2cdb93[_0x92f4('0x155')](_0x37e5c7);};};Dialer['prototype'][_0x92f4('0x156')]=function(_0x26190c,_0x2846e9){var _0x237b22=this;var _0x55faed=uuid['v4']();this[_0x92f4('0xec')][_0x55faed]=new Action(_0x26190c,_0x2846e9,_0x55faed);return new Promise(function(_0x3faa90,_0xf4847b){if(_[_0x92f4('0x40')](_0x26190c)&&typeof _0x26190c!=='object'){return _0xf4847b(msgResponse(_0x92f4('0x157'),_0x92f4('0x91'),_0x92f4('0x158')));}if(_['isUndefined'](_0x2846e9[_0x92f4('0x159')])||_0x2846e9[_0x92f4('0x159')]===null){return _0xf4847b(msgResponse(_0x92f4('0x157'),_0x92f4('0x91'),_0x92f4('0x15a')));}var _0x1ded46={'XMD-CALLERID':_0x237b22[_0x92f4('0xec')][_0x55faed][_0x92f4('0x15b')](),'XMD-AGI':_0x26190c[_0x92f4('0x130')]?util[_0x92f4('0x9a')](_0x92f4('0x15c'),ipAgi,_0x26190c[_0x92f4('0x130')]):_0x92f4('0x15d'),'XMD-AGIAFTER':_0x26190c[_0x92f4('0xc5')]?util[_0x92f4('0x9a')](_0x92f4('0x15c'),ipAgi,_0x26190c['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x92f4('0x15e')](_0x26190c)?util[_0x92f4('0x9a')](_0x92f4('0x15f'),_0x26190c[_0x92f4('0x45')],_0x26190c[_0x92f4('0x160')]||'',_0x26190c[_0x92f4('0x161')]?'c':'',_0x26190c[_0x92f4('0xcb')]||0x3):_0x92f4('0x15d'),'XMD-CONTACTID':_0x2846e9[_0x92f4('0xdb')],'XMD-CDRTYPE':_0x92f4('0x8'),'CALLERID(all)':_0x237b22[_0x92f4('0xec')][_0x55faed][_0x92f4('0x15b')](),'XMD-AMD':_0x26190c[_0x92f4('0x119')]?_0x92f4('0x13e'):_0x92f4('0x15d'),'XMD-DESTINATION':_0x92f4('0x10c')};if(_0x26190c['dialAMDActive']){_0x1ded46[_0x92f4('0x162')]=_0x26190c[_0x92f4('0x163')]||0x9c4;_0x1ded46['XMD-AMDGREETING']=_0x26190c[_0x92f4('0x164')]||0x5dc;_0x1ded46[_0x92f4('0x165')]=_0x26190c[_0x92f4('0x166')]||0x320;_0x1ded46[_0x92f4('0x167')]=_0x26190c[_0x92f4('0x168')]||0x1388;_0x1ded46['XMD-AMDMINWORDLENGTH']=_0x26190c[_0x92f4('0x169')]||0x64;_0x1ded46[_0x92f4('0x16a')]=_0x26190c[_0x92f4('0x16b')]||0x32;_0x1ded46[_0x92f4('0x16c')]=_0x26190c['dialAMDMaximumNumberOfWords']||0x3;_0x1ded46[_0x92f4('0x16d')]=_0x26190c[_0x92f4('0x16e')]||0x100;_0x1ded46['XMD-AMDMAXIMUMWORDLENGTH']=_0x26190c[_0x92f4('0x16f')]||0x1388;}if(utils[_0x92f4('0x15e')](_0x26190c)){_0x1ded46[_0x92f4('0x170')]=_0x2846e9[_0x92f4('0xe7')];}else{_0x1ded46['XMD-CAMPAIGNID']=_0x2846e9['CampaignId'];}var _0x2e946c=utils[_0x92f4('0x171')](_0x2846e9[_0x92f4('0x172')]);Object[_0x92f4('0x173')](_0x1ded46,_0x2e946c);var _0x1dc487=_0x237b22[_0x92f4('0x84')](_0x26190c[_0x92f4('0x174')])?utils[_0x92f4('0x175')](_0x26190c[_0x92f4('0x174')][_0x92f4('0x176')],_0x26190c[_0x92f4('0x177')],_0x26190c['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x92f4('0x178')](_0x26190c[_0x92f4('0x179')],_0x26190c[_0x92f4('0x17a')]):_0x26190c[_0x92f4('0x179')]):utils[_0x92f4('0x175')](_[_0x92f4('0xf1')](_0x26190c[_0x92f4('0x8a')])?_0x26190c['Trunk'][_0x92f4('0x176')]:_0x26190c[_0x92f4('0x8a')]['callerid'],_0x26190c[_0x92f4('0x177')],_0x26190c[_0x92f4('0x17a')]>0x0?utils['getCallerIdRandom'](_0x26190c[_0x92f4('0x179')],_0x26190c[_0x92f4('0x17a')]):_0x26190c[_0x92f4('0x179')]);if(_0x1dc487){_0x1ded46[_0x92f4('0x17b')]=_0x237b22[_0x92f4('0xec')][_0x55faed]['originatecalleridname']=utils[_0x92f4('0x17c')](_0x1dc487);_0x1ded46[_0x92f4('0x17d')]=_0x2846e9[_0x92f4('0x159')];}_0x26190c['variables']=_0x1ded46;return ami[_0x92f4('0x98')]({'actionid':_0x55faed,'action':_0x92f4('0x157'),'channel':_0x237b22[_0x92f4('0x84')](_0x26190c[_0x92f4('0x174')])?util[_0x92f4('0x9a')](_0x92f4('0x17e'),_0x26190c[_0x92f4('0x174')][_0x92f4('0x45')],isNotNull(_0x26190c[_0x92f4('0x17f')])?_0x26190c[_0x92f4('0x17f')]['trim']()||'':'',_0x26190c[_0x92f4('0x180')]>0x0?_0x2846e9[_0x92f4('0x159')][_0x92f4('0x181')](_0x26190c[_0x92f4('0x180')]):_0x2846e9[_0x92f4('0x159')]):util[_0x92f4('0x9a')](_0x92f4('0x17e'),_[_0x92f4('0xf1')](_0x26190c['TrunkBackup'])?_0x26190c[_0x92f4('0x174')]['name']:_0x26190c['TrunkBackup'][_0x92f4('0x45')],isNotNull(_0x26190c[_0x92f4('0x17f')])?_0x26190c[_0x92f4('0x17f')][_0x92f4('0x182')]()||'':'',_0x26190c[_0x92f4('0x180')]>0x0?_0x2846e9[_0x92f4('0x159')][_0x92f4('0x181')](_0x26190c[_0x92f4('0x180')]):_0x2846e9[_0x92f4('0x159')]),'callerid':_0x1dc487,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x1ded46,'timeout':(_0x26190c[_0x92f4('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55faed})['then'](function(_0x128dd6){return _0x3faa90(_0x128dd6);})['catch'](function(_0x100711){_0x26190c[_0x92f4('0x184')]+=0x1;var _0x46e1da=new History(_0x237b22[_0x92f4('0xec')][_0x55faed]);logger[_0x92f4('0x64')](util['format'](_0x92f4('0x185'),JSON[_0x92f4('0xa9')](_0x100711)));_0x46e1da[_0x92f4('0xce')]=0xe;_0x46e1da[_0x92f4('0x6d')]=_0x92f4('0x186');_0x46e1da[_0x92f4('0x6f')]=moment()['format'](_0x92f4('0xc1'));_0x46e1da[_0x92f4('0x6e')]=_0x46e1da[_0x92f4('0x6f')];hopperUtils[_0x92f4('0xc6')](_0x46e1da)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x187')));_0x237b22['moveContactManagedDialer'](_0x46e1da)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x187')))[_0x92f4('0x1b')](function(){delete _0x237b22[_0x92f4('0xec')][_0x55faed];return _0xf4847b(msgResponse('originate',_0x92f4('0x188'),_0x92f4('0x189')));});});});};Dialer[_0x92f4('0x88')][_0x92f4('0x18a')]=function(_0x3017d8,_0x12baff,_0x5007c3){var _0xed6750=new History(_0x12baff);if(_0xed6750[_0x92f4('0x11e')]+_0xed6750['countcongestionretry']+_0xed6750[_0x92f4('0x120')]+_0xed6750['countnosuchnumberretry']+_0xed6750[_0x92f4('0xd6')]+_0xed6750[_0x92f4('0xe2')]+_0xed6750[_0x92f4('0x11c')]+_0xed6750[_0x92f4('0x122')]>=_0x5007c3[_0x92f4('0x123')]-0x1){return!![];}switch(_0x3017d8){case 0x3:if(_0xed6750[_0x92f4('0x120')]>=_0x5007c3[_0x92f4('0x18b')]-0x1){return!![];}hopperUtils[_0x92f4('0xd9')]({'active':![],'countnoanswerretry':_0xed6750[_0x92f4('0x120')]+=0x1,'scheduledat':moment()[_0x92f4('0xda')](_0x5007c3['dialNoAnswerRetryFrequency'],_0x92f4('0xe5'))['format'](_0x92f4('0xc1')),'ContactId':_0xed6750['ContactId'],'ListId':_0xed6750[_0x92f4('0xe6')],'VoiceQueueId':_0xed6750[_0x92f4('0xe7')]||undefined,'CampaignId':_0xed6750['CampaignId']||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x18c')));break;case 0x5:if(_0xed6750[_0x92f4('0x11e')]>=_0x5007c3[_0x92f4('0x18d')]-0x1){return!![];}hopperUtils[_0x92f4('0xd9')]({'active':![],'countbusyretry':_0xed6750[_0x92f4('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x5007c3[_0x92f4('0x18e')],_0x92f4('0xe5'))[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0xed6750[_0x92f4('0xdb')],'ListId':_0xed6750[_0x92f4('0xe6')],'VoiceQueueId':_0xed6750[_0x92f4('0xe7')]||undefined,'CampaignId':_0xed6750['CampaignId']||undefined})[_0x92f4('0x9e')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0xed6750['countcongestionretry']>=_0x5007c3['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x92f4('0xd9')]({'active':![],'countcongestionretry':_0xed6750[_0x92f4('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x5007c3[_0x92f4('0x18f')],'minutes')[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0xed6750['ContactId'],'ListId':_0xed6750[_0x92f4('0xe6')],'VoiceQueueId':_0xed6750[_0x92f4('0xe7')]||undefined,'CampaignId':_0xed6750[_0x92f4('0xe8')]||undefined})['catch'](loggerCatch(_0x92f4('0x190')));break;case 0x0:if(_0xed6750[_0x92f4('0x121')]>=_0x5007c3[_0x92f4('0x191')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xed6750[_0x92f4('0x121')]+=0x1,'scheduledat':moment()[_0x92f4('0xda')](_0x5007c3[_0x92f4('0x192')],_0x92f4('0xe5'))[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0xed6750[_0x92f4('0xdb')],'ListId':_0xed6750[_0x92f4('0xe6')],'VoiceQueueId':_0xed6750['VoiceQueueId']||undefined,'CampaignId':_0xed6750[_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xed6750[_0x92f4('0xd6')]>=_0x5007c3[_0x92f4('0xd7')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xed6750['countdropretry']+=0x1,'scheduledat':moment()[_0x92f4('0xda')](_0x5007c3[_0x92f4('0x193')],_0x92f4('0xe5'))[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0xed6750['ContactId'],'ListId':_0xed6750[_0x92f4('0xe6')],'VoiceQueueId':_0xed6750['VoiceQueueId']||undefined,'CampaignId':_0xed6750[_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0xed6750[_0x92f4('0xe2')]>=_0x5007c3[_0x92f4('0xe3')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xed6750[_0x92f4('0xe2')]+=0x1,'scheduledat':moment()[_0x92f4('0xda')](_0x5007c3[_0x92f4('0xe4')],_0x92f4('0xe5'))['format'](_0x92f4('0xc1')),'ContactId':_0xed6750[_0x92f4('0xdb')],'ListId':_0xed6750['ListId'],'VoiceQueueId':_0xed6750['VoiceQueueId']||undefined,'CampaignId':_0xed6750[_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xe9')));break;case 0x13:if(_0xed6750['countmachineretry']>=_0x5007c3[_0x92f4('0x125')]-0x1){return!![];}hopperUtils[_0x92f4('0xd9')]({'active':![],'countmachineretry':_0xed6750[_0x92f4('0x11c')]+=0x1,'scheduledat':moment()[_0x92f4('0xda')](_0x5007c3[_0x92f4('0x128')],'minutes')[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0xed6750[_0x92f4('0xdb')],'ListId':_0xed6750['ListId'],'VoiceQueueId':_0xed6750[_0x92f4('0xe7')]||undefined,'CampaignId':_0xed6750[_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x129')));break;case 0x14:if(_0xed6750[_0x92f4('0x122')]>=_0x5007c3['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x92f4('0xd9')]({'active':![],'countagentrejectretry':_0xed6750[_0x92f4('0x122')]+=0x1,'scheduledat':moment()[_0x92f4('0xda')](_0x5007c3[_0x92f4('0x194')],'minutes')[_0x92f4('0x9a')](_0x92f4('0xc1')),'ContactId':_0xed6750[_0x92f4('0xdb')],'ListId':_0xed6750['ListId'],'VoiceQueueId':_0xed6750[_0x92f4('0xe7')]||undefined,'CampaignId':_0xed6750['CampaignId']||undefined})['catch'](loggerCatch(_0x92f4('0x195')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x31bd24,_0x22ecc0,_0x5cee05){var _0x168419=this;var _0x4d8aaa=new History(_0x31bd24);var _0x4fd624=![];var _0x3eee2b;var _0x4f1fed;return new Promise(function(_0x481cf2,_0x46d12){if(_[_0x92f4('0x40')](_0x22ecc0)&&typeof _0x22ecc0!==_0x92f4('0x196')){return _0x46d12(msgResponse(_0x92f4('0x197'),'Failure',_0x92f4('0x198')));}if(_[_0x92f4('0x40')](_0x5cee05)&&typeof _0x5cee05!==_0x92f4('0x196')){return _0x46d12(msgResponse(_0x92f4('0x197'),'Failure',_0x92f4('0x199')));}hopperUtils[_0x92f4('0xd4')](_0x4d8aaa,_0x5cee05[_0x92f4('0xc3')],_0x22ecc0)[_0x92f4('0x3e')](function(_0x252f3c){if(_0x252f3c[_0x92f4('0xd5')]==0x1)_0x4fd624=!![];switch(_0x5cee05['reason']){case'0':_0x22ecc0[_0x92f4('0x19a')]+=0x1;_0x4d8aaa['state']=0x0;_0x4d8aaa[_0x92f4('0x6d')]=_0x92f4('0x19b');_0x4d8aaa[_0x92f4('0x121')]+=0x1;_0x4d8aaa[_0x92f4('0xd2')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x31bd24,_0x92f4('0x19c')));_0x3eee2b=_0x22ecc0['dialNoSuchNumberRetryFrequency'];_0x4f1fed=_0x22ecc0['callAdditionalPhoneAfterMin'];hopperUtils[_0x92f4('0xc6')](_0x4d8aaa)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x168419[_0x92f4('0x18a')](0x0,_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa[_0x92f4('0x121')]>=_0x22ecc0[_0x92f4('0x191')]){_0x168419[_0x92f4('0x126')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x19d'));}else{_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x19d'));}}break;case'3':_0x22ecc0[_0x92f4('0x19e')]+=0x1;_0x4d8aaa[_0x92f4('0xce')]=0x3;_0x4d8aaa[_0x92f4('0x6d')]=_0x92f4('0x19f');_0x4d8aaa[_0x92f4('0x120')]+=0x1;_0x4d8aaa[_0x92f4('0xd2')]+=0x1;var _0x865472=ut[_0x92f4('0x1a0')](_0x31bd24,_0x22ecc0);ami[_0x92f4('0x112')](_0x92f4('0x1a1'),_0x865472);_0x3eee2b=_0x22ecc0[_0x92f4('0x1a2')];_0x4f1fed=_0x22ecc0[_0x92f4('0xd3')];hopperUtils['createHistory'](_0x4d8aaa)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x1a3')));if(_0x168419['checkRetriveMax'](0x3,_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa[_0x92f4('0x120')]>=_0x22ecc0[_0x92f4('0x18b')]){_0x168419[_0x92f4('0x126')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1a4'));}else{_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x22ecc0['outboundBusyCallsDay']+=0x1;_0x4d8aaa[_0x92f4('0xce')]=0x5;_0x4d8aaa[_0x92f4('0x6d')]='Busy';_0x4d8aaa[_0x92f4('0x11e')]+=0x1;_0x4d8aaa[_0x92f4('0xd2')]+=0x1;ami[_0x92f4('0x112')](_0x92f4('0x1a5'),ut['buildObj'](_0x31bd24,_0x92f4('0x1a6')));_0x3eee2b=_0x22ecc0[_0x92f4('0x18e')];_0x4f1fed=_0x22ecc0[_0x92f4('0xd3')];hopperUtils['createHistory'](_0x4d8aaa)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x1a7')));if(_0x168419[_0x92f4('0x18a')](0x5,_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa[_0x92f4('0x11e')]>=_0x22ecc0['dialBusyMaxRetry']){_0x168419[_0x92f4('0x126')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1a8'));}else{_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1a8'));}}break;case'8':_0x22ecc0[_0x92f4('0x1a9')]+=0x1;_0x4d8aaa[_0x92f4('0xce')]=0x8;_0x4d8aaa[_0x92f4('0x6d')]=_0x92f4('0x1aa');_0x4d8aaa[_0x92f4('0x11f')]+=0x1;_0x4d8aaa['countglobal']+=0x1;_0x3eee2b=_0x22ecc0[_0x92f4('0x18f')];_0x4f1fed=_0x22ecc0[_0x92f4('0xd3')];ami[_0x92f4('0x112')](_0x92f4('0x1ab'),ut[_0x92f4('0x114')](_0x31bd24,_0x92f4('0x1ac')));hopperUtils[_0x92f4('0xc6')](_0x4d8aaa)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x1ad')));if(_0x168419[_0x92f4('0x18a')](0x8,_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa[_0x92f4('0x11f')]>=_0x22ecc0['dialCongestionMaxRetry']){_0x168419['createStateFinal'](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1ae'));}else{_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1ae'));}}break;case'11':_0x22ecc0[_0x92f4('0x1af')]+=0x1;_0x4d8aaa[_0x92f4('0xce')]=0xb;_0x4d8aaa[_0x92f4('0x6d')]=_0x92f4('0xe0');_0x4d8aaa[_0x92f4('0xe2')]+=0x1;_0x4d8aaa[_0x92f4('0xd2')]+=0x1;_0x3eee2b=_0x22ecc0[_0x92f4('0xe4')];_0x4f1fed=_0x22ecc0[_0x92f4('0xd3')];hopperUtils[_0x92f4('0xc6')](_0x4d8aaa)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0xea')));if(_0x168419[_0x92f4('0x18a')](0xb,_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa[_0x92f4('0xe2')]>=_0x22ecc0[_0x92f4('0xe3')]){_0x168419['createStateFinal'](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1b0'));}else{_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1b0'));}}break;case'20':_0x22ecc0[_0x92f4('0x1b1')]+=0x1;_0x4d8aaa[_0x92f4('0xce')]=0x14;_0x4d8aaa[_0x92f4('0x6d')]=_0x92f4('0x1b2');_0x4d8aaa['countagentrejectretry']+=0x1;_0x4d8aaa['countglobal']+=0x1;_0x3eee2b=_0x22ecc0[_0x92f4('0x194')];_0x4f1fed=_0x22ecc0[_0x92f4('0xd3')];ami['emit'](_0x92f4('0x1b3'),ut[_0x92f4('0x114')](_0x31bd24,_0x92f4('0x1b4')));hopperUtils[_0x92f4('0xc6')](_0x4d8aaa)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x1b5')));if(_0x168419[_0x92f4('0x18a')](0x14,_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa[_0x92f4('0x122')]>=_0x22ecc0['dialAgentRejectMaxRetry']){_0x168419['createStateFinal'](_0x4d8aaa,_0x481cf2,_0x46d12,'reason\x2020\x20agentreject');}else{_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x92f4('0x1b6'));}}break;default:_0x22ecc0[_0x92f4('0x133')]+=0x1;_0x4d8aaa['state']=0xc;_0x4d8aaa[_0x92f4('0x6d')]=_0x5cee05[_0x92f4('0xc3')];_0x3eee2b=_0x22ecc0[_0x92f4('0x194')];_0x4f1fed=_0x22ecc0[_0x92f4('0xd3')];hopperUtils['createHistory'](_0x4d8aaa)[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x1b7')));if(_0x168419[_0x92f4('0x18a')](_0x5cee05[_0x92f4('0xc3')],_0x31bd24,_0x22ecc0)&&!_0x4fd624){if(_0x4d8aaa['countbusyretry']+_0x4d8aaa['countcongestionretry']+_0x4d8aaa[_0x92f4('0x120')]+_0x4d8aaa[_0x92f4('0x121')]+_0x4d8aaa[_0x92f4('0xd6')]+_0x4d8aaa[_0x92f4('0xe2')]+_0x4d8aaa[_0x92f4('0x11c')]+_0x4d8aaa[_0x92f4('0x122')]>=_0x22ecc0['dialGlobalMaxRetry']){_0x168419[_0x92f4('0x124')](_0x4d8aaa,_0x481cf2,_0x46d12,_0x5cee05[_0x92f4('0xc3')]);}else{_0x168419['createStateFinal'](_0x4d8aaa,_0x481cf2,_0x46d12,_0x5cee05[_0x92f4('0xc3')]);}}}})[_0x92f4('0x3e')](function(){if(_0x4fd624){hopperUtils[_0x92f4('0xde')](_0x4d8aaa,_0x3eee2b,_0x4f1fed)[_0x92f4('0x3e')](function(){return _0x481cf2(0x1);});}});});};Dialer[_0x92f4('0x88')][_0x92f4('0x124')]=function(_0x117f70,_0x587c52,_0x173b00,_0x79f116){var _0x2ffb43=new Final(_0x117f70);_0x2ffb43[_0x92f4('0xce')]=0xf;_0x2ffb43['statedesc']='Global';this[_0x92f4('0x126')](_0x2ffb43,_0x587c52,_0x173b00,_0x79f116);};Dialer['prototype'][_0x92f4('0x126')]=function(_0x390b1a,_0x4a43ee,_0xe88dcf,_0x5a1436){hopperUtils[_0x92f4('0xc8')](_0x390b1a)[_0x92f4('0x3e')](function(){return _0x4a43ee(msgResponse('[callProgressDetecting]',_0x92f4('0x1b8'),_0x5a1436));})[_0x92f4('0x9e')](function(){return _0xe88dcf(msgResponse('[moveContactManagedDialer][0]',_0x92f4('0x91'),_0x92f4('0x1b9')));});};Dialer[_0x92f4('0x88')][_0x92f4('0xa')]=function(_0x4d5f38){var _0x105bdc=_0x4d5f38[_0x92f4('0x1ba')]/0x64;var _0x46d2e2=_0x4d5f38[_0x92f4('0xcc')]/(_0x4d5f38[_0x92f4('0xcc')]+_0x4d5f38[_0x92f4('0xc2')]);var _0x186a65=Math[_0x92f4('0x1bb')](_0x4d5f38['predictiveIntervalAvailable']*(_0x4d5f38['predictiveIntervalMaxThreshold']/0x64));var _0x301c90=Math[_0x92f4('0x1bb')](_0x4d5f38[_0x92f4('0x1bc')]*(_0x4d5f38[_0x92f4('0x1bd')]/0x64));var _0xe08c4=_0x4d5f38[_0x92f4('0x13a')]+_0x4d5f38[_0x92f4('0x13c')];var _0x472c68=Math[_0x92f4('0x1be')](_0x4d5f38['erlangCalls']*_0x4d5f38['erlangAbandonmentRate']*_0x4d5f38[_0x92f4('0x1bf')]*_0x4d5f38[_0x92f4('0x1c0')]);if(_['isUndefined'](_0x4d5f38[_0x92f4('0x5f')])){if(!_[_0x92f4('0x40')](_0x4d5f38[_0x92f4('0x25')])){_0x4d5f38[_0x92f4('0x25')]=undefined;loggerPredictive[_0x92f4('0x64')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x92f4('0x40')](_0x4d5f38['handlePredictive'])){loggerPredictive[_0x92f4('0x64')](_0x92f4('0x1c1'),_0x92f4('0x1c2'));clearInterval(_0x4d5f38['handlePredictive']);_0x4d5f38[_0x92f4('0x62')]=undefined;}_0x4d5f38[_0x92f4('0x5f')]=moment()['format'](_0x92f4('0xc1'));loggerPredictive[_0x92f4('0x47')](_0x4d5f38[_0x92f4('0x45')],_0x92f4('0x1c3'),_0x4d5f38[_0x92f4('0x5f')]);this[_0x92f4('0xb2')](_0x4d5f38,0x1);}else if(ifInterval(_0x4d5f38[_0x92f4('0x1c4')],_0x4d5f38[_0x92f4('0x5f')])){this[_0x92f4('0xb2')](_0x4d5f38,0x1);loggerPredictiveCalls[_0x92f4('0x47')](_0x92f4('0x1c5'),_0x4d5f38[_0x92f4('0x5f')],_0x4d5f38[_0x92f4('0x45')]);_0x4d5f38[_0x92f4('0x57')]=0x0;_0x4d5f38[_0x92f4('0xcd')]=0x0;}else if(_0x105bdc<_0x46d2e2&&_0x4d5f38[_0x92f4('0x1c6')]===_0x92f4('0x1c7')){clearPredictiveAttributes(_0x4d5f38);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x1c8'),_0x92f4('0x1c9'),_0x46d2e2,_0x92f4('0x5f'),_0x4d5f38[_0x92f4('0x45')]);}else if(_0x472c68<_0x4d5f38[_0x92f4('0xcd')]&&_0x4d5f38[_0x92f4('0x1c6')]===_0x92f4('0x1c7')){clearPredictiveAttributes(_0x4d5f38);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x1ca'),_0x92f4('0x1cb'),_0x472c68,_0x92f4('0x1cc'),_0x4d5f38[_0x92f4('0xcd')],'startProgressive',_0x4d5f38[_0x92f4('0x45')]);}else if(!ifInterval(_0x4d5f38[_0x92f4('0x1c4')],_0x4d5f38['startProgressive'])&&_[_0x92f4('0x40')](_0x4d5f38[_0x92f4('0x25')])&&!_['isUndefined'](_0x4d5f38[_0x92f4('0x5f')])){_0x4d5f38[_0x92f4('0x25')]=moment()['format'](_0x92f4('0xc1'));loggerPredictive[_0x92f4('0x47')](_0x4d5f38[_0x92f4('0x45')],_0x92f4('0x1cd'),_0x4d5f38[_0x92f4('0x25')]);hopperUtils[_0x92f4('0x1ce')](_0x4d5f38[_0x92f4('0x1c4')])['then'](this[_0x92f4('0x1cf')](_0x4d5f38))['then'](mergeDataErlangB(_0x4d5f38))[_0x92f4('0x3e')](this[_0x92f4('0x1d0')](_0x4d5f38))[_0x92f4('0x9e')](loggerCatchPredictive(_0x92f4('0x1d1'),_0x4d5f38));}else if(!ifInterval(_0x4d5f38[_0x92f4('0x1c4')],_0x4d5f38['startPredictive'])){_0x4d5f38['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4d5f38['startPredictive']=moment()[_0x92f4('0x9a')](_0x92f4('0xc1'));loggerPredictive['info'](_0x4d5f38[_0x92f4('0x45')],'recalculate\x20predictive\x20at',_0x4d5f38[_0x92f4('0x25')]);clearInterval(_0x4d5f38[_0x92f4('0x62')]);_0x4d5f38[_0x92f4('0x62')]=undefined;hopperUtils['avgHandleTime'](_0x4d5f38[_0x92f4('0x1c4')])[_0x92f4('0x3e')](this[_0x92f4('0x1cf')](_0x4d5f38))[_0x92f4('0x3e')](mergeDataErlangB(_0x4d5f38))[_0x92f4('0x3e')](this['startMethodPredictive'](_0x4d5f38))[_0x92f4('0x9e')](loggerCatchPredictive(_0x92f4('0x1d2'),_0x4d5f38));}else if(_0x4d5f38[_0x92f4('0x1bc')]&&_0xe08c4<_0x4d5f38[_0x92f4('0x1bc')]-_0x301c90){clearPredictiveAttributes(_0x4d5f38);loggerPredictive[_0x92f4('0x47')](_0x4d5f38[_0x92f4('0x45')],_0x92f4('0x1d3'),_0xe08c4,')\x20are\x20less\x20than\x20threshold\x20(',_0x4d5f38[_0x92f4('0x1bc')],'-',_0x301c90,'=',_0x4d5f38[_0x92f4('0x1bc')]-_0x301c90,')');}else if(_0x4d5f38[_0x92f4('0x1bc')]&&_0xe08c4>_0x4d5f38[_0x92f4('0x1bc')]+_0x186a65){clearPredictiveAttributes(_0x4d5f38);loggerPredictive[_0x92f4('0x47')](_0x4d5f38[_0x92f4('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xe08c4,_0x92f4('0x1d4'),_0x4d5f38['predictiveIntervalAvailable'],'+',_0x186a65,'=',_0x4d5f38[_0x92f4('0x1bc')]+_0x186a65,')');}};Dialer[_0x92f4('0x88')]['getDataPredictive']=function(_0x9e1f95){var _0x30a784=this;return function(_0x1b9df8){return new Promise(function(_0x45827b,_0x846897){_[_0x92f4('0xf4')](_0x9e1f95,_0x1b9df8[0x0]);if(checkGetDataPredictive(_0x1b9df8[0x0])){var _0x2c77e0=_0x9e1f95[_0x92f4('0x1bc')]=_0x9e1f95[_0x92f4('0x13c')]+_0x9e1f95[_0x92f4('0x13a')];var _0x1e8a09=_0x9e1f95[_0x92f4('0x1c4')]*0x3c;var _0x31f414=_0x1b9df8[0x0][_0x92f4('0x51')]+_0x1b9df8[0x0][_0x92f4('0x4f')];var _0x59cb39=(_0x1b9df8[0x0][_0x92f4('0x4b')]+_0x1b9df8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1b9df8[0x0][_0x92f4('0x1d5')])/_0x1b9df8[0x0][_0x92f4('0x49')];_0x9e1f95[_0x92f4('0x1bf')]=_0x59cb39>0x0?_0x59cb39:0x1;switch(_0x9e1f95[_0x92f4('0x1c6')]){case _0x92f4('0x1c7'):var _0x1043ee=_0x9e1f95[_0x92f4('0x1ba')]/0x64;return _0x30a784[_0x92f4('0x1d6')](_0x2c77e0,_0x1e8a09,_0x31f414,_0x59cb39,_0x1043ee)[_0x92f4('0x3e')](function(_0x19aca4){return _0x45827b(_0x19aca4);});case'agentBusyFactor':var _0x4fcee3=_0x9e1f95['dialPredictiveOptimizationPercentage']/0x64;return _0x30a784['busyFactor'](_0x2c77e0,_0x1e8a09,_0x31f414,_0x59cb39,_0x4fcee3)[_0x92f4('0x3e')](function(_0xe005b2){return _0x45827b(_0xe005b2);});default:return _0x846897(msgResponse(_0x92f4('0x1d7'),'Failure',_0x92f4('0x1d8')));}}else{return _0x846897(msgResponse(_0x92f4('0x1d7'),'Failure',_0x92f4('0x1d9')));}});};};Dialer[_0x92f4('0x88')]['getDataPredictiveOld']=function(_0x21ce67){var _0xf84e=this;return function(_0x47021e){return new Promise(function(_0x4021a1,_0x44e4f1){_[_0x92f4('0xf4')](_0x21ce67,_0x47021e[0x0]);if(checkGetDataPredictive(_0x47021e[0x0])){loggerPredictive[_0x92f4('0x47')](JSON[_0x92f4('0xa9')](_0x47021e[0x0]));if(_0x21ce67[_0x92f4('0x1c6')]===_0x92f4('0x1c7')){return _0xf84e[_0x92f4('0x1da')](_0x21ce67['id'])['then'](function(_0x45ce09){var _0x3561e4=_0x21ce67['loggedIn']-_0x45ce09[0x0]['outboundQueuePauses'];var _0x511e24=_0x21ce67['dialPredictiveInterval']*0x3c;var _0x448dc4=_0x47021e[0x0][_0x92f4('0x51')]+_0x47021e[0x0][_0x92f4('0x4f')];var _0xac16be=(_0x47021e[0x0][_0x92f4('0x4b')]+_0x47021e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x47021e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x47021e[0x0][_0x92f4('0x49')];var _0x1a2aec=_0x21ce67[_0x92f4('0x1ba')]/0x64;_0x21ce67['predictiveIntervalPauses']=_0x45ce09[0x0]['outboundQueuePauses']||0x0;_0x21ce67[_0x92f4('0x1bf')]=_0xac16be>0x0?_0xac16be:0x1;return _0xf84e[_0x92f4('0x1d6')](_0x3561e4,_0x511e24,_0x448dc4,_0xac16be,_0x1a2aec);})[_0x92f4('0x3e')](function(_0x422b5a){return _0x4021a1(_0x422b5a);})[_0x92f4('0x9e')](function(_0x253f95){return _0x44e4f1(msgResponse(_0x92f4('0x1db'),_0x92f4('0x91'),JSON[_0x92f4('0xa9')](_0x253f95)));});}if(_0x21ce67[_0x92f4('0x1c6')]==='agentBusyFactor'){return _0xf84e[_0x92f4('0x1da')](_0x21ce67['id'])['then'](function(_0x1a03ce){var _0x2de8d9=_0x21ce67[_0x92f4('0x1dc')]-_0x1a03ce[0x0]['outboundQueuePauses'];var _0x376a7e=_0x21ce67['dialPredictiveInterval']*0x3c;var _0x348324=_0x47021e[0x0][_0x92f4('0x51')]+_0x47021e[0x0][_0x92f4('0x4f')];var _0x3568d1=(_0x47021e[0x0][_0x92f4('0x4b')]+_0x47021e[0x0][_0x92f4('0x1dd')]+_0x47021e[0x0][_0x92f4('0x1d5')])/_0x47021e[0x0]['predictiveIntervalTotalCalls'];var _0x21481d=_0x21ce67[_0x92f4('0x1ba')]/0x64;_0x21ce67['predictiveIntervalPauses']=_0x1a03ce[0x0][_0x92f4('0x1de')]||0x0;_0x21ce67[_0x92f4('0x1bf')]=_0x3568d1>0x0?_0x3568d1:0x1;return _0xf84e[_0x92f4('0x1df')](_0x2de8d9,_0x376a7e,_0x348324,_0x3568d1,_0x21481d);})['then'](function(_0x366958){return _0x4021a1(_0x366958);})['catch'](function(_0x26e9c9){return _0x44e4f1(msgResponse(_0x92f4('0x1db'),_0x92f4('0x91'),JSON['stringify'](_0x26e9c9)));});}}else{return _0x44e4f1(msgResponse(_0x92f4('0x1d7'),_0x92f4('0x91'),'check\x20failure'));}});};};Dialer['prototype'][_0x92f4('0x1d0')]=function(_0x11689b){var _0x35f216=this;return function(){var _0x3e05b0=0x0;var _0x226828=Math['floor'](_0x11689b[_0x92f4('0x58')]*0x3e8);if(_0x226828>0x0){_0x226828=_0x226828<0x64?0x64:_0x226828;loggerPredictive[_0x92f4('0x47')](_0x11689b[_0x92f4('0x45')],'one\x20call\x20every:',_0x226828,_0x92f4('0x1e0'));_0x11689b[_0x92f4('0x62')]=setInterval(function(){_0x35f216['handlePredictive'](_0x11689b);loggerPredictiveCalls[_0x92f4('0x47')](_0x92f4('0x1e1'),_0x3e05b0+=0x1);},_0x226828);}else{loggerPredictive[_0x92f4('0x47')](_0x11689b[_0x92f4('0x45')],_0x92f4('0x1e2'));}};};Dialer[_0x92f4('0x88')][_0x92f4('0x1e3')]=function(_0x521349,_0x205df2){var _0x4d11ca=this;return function(_0x8bae5b){if(_[_0x92f4('0x78')](_0x8bae5b)){if(_[_0x92f4('0xf1')](_0x205df2[_0x92f4('0x150')])||!_0x205df2[_0x92f4('0x1e4')]){if(_0x521349[_0x92f4('0xb0')]===_0x92f4('0x9')){_0x521349[_0x92f4('0x71')]=_[_0x92f4('0x40')](_0x521349[_0x92f4('0x71')])?!![]:_0x521349[_0x92f4('0x71')];var _0x40cba8=uuid['v4']();_0x4d11ca[_0x92f4('0xec')][_0x40cba8]=new Action(_0x521349,_0x205df2,_0x40cba8);loggerBooked['info'](_0x92f4('0x1e5'),_0x40cba8,'queueStatusComplete:\x20',JSON[_0x92f4('0xa9')](_0x521349[_0x92f4('0x71')]),_0x92f4('0x1e6'),_0x521349[_0x92f4('0x45')]);if(_0x521349[_0x92f4('0x71')]){_0x521349[_0x92f4('0x71')]=![];_0x4d11ca[_0x92f4('0x27')][_0x4d11ca[_0x92f4('0xec')][_0x40cba8]['queue']]=[];ami['Action']({'actionid':_0x40cba8,'action':_0x92f4('0x1e7'),'queue':_0x521349[_0x92f4('0x45')]})['catch'](function(){_0x4d11ca[_0x92f4('0xc0')](_0x521349);hopperUtils[_0x92f4('0xd9')]({'active':![],'ContactId':_0x4d11ca[_0x92f4('0xec')][_0x40cba8][_0x92f4('0xdb')],'ListId':_0x4d11ca[_0x92f4('0xec')][_0x40cba8][_0x92f4('0xe6')],'VoiceQueueId':_0x4d11ca['actions'][_0x40cba8][_0x92f4('0xe7')]||undefined,'CampaignId':_0x4d11ca[_0x92f4('0xec')][_0x40cba8][_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch(_0x92f4('0x1e8')));delete _0x4d11ca['actions'][_0x40cba8];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON['stringify'](_0x521349[_0x92f4('0x71')]),_0x92f4('0x1e6'),_0x521349['name']);_0x4d11ca[_0x92f4('0xc0')](_0x521349);hopperUtils[_0x92f4('0xd9')]({'active':![],'ContactId':_0x4d11ca[_0x92f4('0xec')][_0x40cba8]['ContactId'],'ListId':_0x4d11ca['actions'][_0x40cba8][_0x92f4('0xe6')],'VoiceQueueId':_0x4d11ca['actions'][_0x40cba8]['VoiceQueueId']||undefined,'CampaignId':_0x4d11ca[_0x92f4('0xec')][_0x40cba8][_0x92f4('0xe8')]||undefined})[_0x92f4('0x9e')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4d11ca['actions'][_0x40cba8];}}else{return _0x4d11ca[_0x92f4('0x156')](_0x521349,_0x205df2);}}else{if(utils[_0x92f4('0x5e')](undefined,_0x205df2[_0x92f4('0x1e9')])<_0x521349[_0x92f4('0x1ea')]*0x3c){if(_0x205df2[_0x92f4('0x145')]&&!_0x205df2[_0x92f4('0x145')][_0x92f4('0x1eb')]){_0x4d11ca[_0x92f4('0xf8')][_0x92f4('0xf9')](_0x205df2['id'])[_0x92f4('0x1b')](function(){_0x4d11ca[_0x92f4('0xc0')](_0x521349);});}else{hopperUtils['unlockContact']({'active':![]},_0x205df2['id'],0x1)['finally'](function(){_0x4d11ca[_0x92f4('0xc0')](_0x521349);});}}else{_0x521349[_0x92f4('0x1ec')]+=0x1;_0x4d11ca[_0x92f4('0xc0')](_0x521349);if(_0x521349['dialRecallInQueue']){hopperUtils[_0x92f4('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x205df2['ContactId'],'ListId':_0x205df2['ListId'],'VoiceQueueId':_0x205df2[_0x92f4('0xe7')]||undefined,'CampaignId':_0x205df2[_0x92f4('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x92f4('0xc6')](createObjHistory(_0x521349,_0x205df2,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x92f4('0x1ed')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4d11ca[_0x92f4('0x116')](createObjHistory(_0x521349,_0x205df2,utils[_0x92f4('0x6b')][_0x92f4('0x1ee')],0x16,_0x92f4('0x1ef')),_0x92f4('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x521349[_0x92f4('0x1f1')]+=0x1;_0x4d11ca['saveInDb'](createObjHistory(_0x521349,_0x205df2,utils['CAMPAIGN_STATUS'][_0x92f4('0x1f2')],0xd,_0x92f4('0x1f3')),_0x92f4('0x1f4'),_0x92f4('0x1f5'));throw _0x92f4('0x1f6');}};};Dialer['prototype'][_0x92f4('0x155')]=function(_0x478611){var _0x1c2753=this;var _0x1f7da2=_0x478611[_0x92f4('0x1f7')]-_0x478611['originated'];emitCampaignSummary(_0x478611);if(_0x1f7da2>0x0&&_0x478611[_0x92f4('0x67')]==0x0){if(_0x1f7da2>this[_0x92f4('0x21')]){_0x1f7da2=this[_0x92f4('0x21')];}_0x478611[_0x92f4('0x67')]=0x1;hopperUtils[_0x92f4('0x1f8')](_0x478611,_0x1f7da2)[_0x92f4('0x3e')](function(_0x4750a8){_0x478611[_0x92f4('0x67')]=0x0;if(_0x4750a8){if(!utils[_0x92f4('0x1f9')](_0x4750a8)){_0x478611[_0x92f4('0x69')]=utils[_0x92f4('0x6b')][_0x92f4('0x1fa')];logger[_0x92f4('0x47')]('[getContactCampaign2][Empty]'+_0x478611['name']);}else{_0x478611[_0x92f4('0x7f')]+=_0x4750a8[_0x92f4('0xfd')];_0x478611[_0x92f4('0x69')]=utils[_0x92f4('0x6b')][_0x92f4('0x1fb')];for(var _0x3b5a5c=0x0;_0x3b5a5c<_0x4750a8[_0x92f4('0xfd')];_0x3b5a5c+=0x1){_0x478611['ivrTotalCallsDays']+=0x1;if(_[_0x92f4('0xf1')](_0x4750a8[_0x3b5a5c])||_[_0x92f4('0xf1')](_0x4750a8[_0x3b5a5c][_0x92f4('0x172')])||_['isNil'](_0x4750a8[_0x3b5a5c][_0x92f4('0x159')])){_0x1c2753[_0x92f4('0x14f')]('[actionOriginate]\x20',_0x478611,_0x4750a8[_0x3b5a5c]);}else{hopperUtils[_0x92f4('0x1fc')](_['pick'](_0x4750a8[_0x3b5a5c],[_0x92f4('0xe8'),_0x92f4('0x159')]))['then'](_0x1c2753['checkContactBlack'](_0x478611,_0x4750a8[_0x3b5a5c]))[_0x92f4('0x9e')](_0x1c2753[_0x92f4('0x14e')]('[actionOriginateIvr]\x20',_0x478611));}}}}})[_0x92f4('0x9e')](loggerGetContactDialer(_0x92f4('0x1fd'),_0x478611,_0x1f7da2));}};Dialer['prototype'][_0x92f4('0xb2')]=function(_0xce9d10,_0x26583b){var _0x5956bd=this;var _0x1c4972=[];if(_0x26583b<0x1||_0xce9d10[_0x92f4('0xb0')]===_0x92f4('0x9')){_0x26583b=0x1;}var _0x4b88a1=Math[_0x92f4('0x1be')](_0xce9d10['available']*_0x26583b)-_0xce9d10[_0x92f4('0x7f')];if(_0xce9d10[_0x92f4('0x1fe')]>0x0){var _0x3550d7=_0xce9d10[_0x92f4('0x1fe')]-_0xce9d10['originated']-_0xce9d10[_0x92f4('0x13c')]-_0xce9d10[_0x92f4('0x13d')];if(_0x4b88a1>_0x3550d7){_0x4b88a1=_0x3550d7;}}if(_0x4b88a1>0x0&&_0xce9d10[_0x92f4('0x67')]==0x0){if(_0xce9d10[_0x92f4('0xb0')]===_0x92f4('0x9')){_0x4b88a1=0x1;}if(_0x4b88a1>this['maxNumberOriginate']){_0x4b88a1=this[_0x92f4('0x21')];}for(var _0x4aed91 in this[_0x92f4('0x1f')]){if(typeof this[_0x92f4('0x1f')][_0x4aed91]!=='undefined'){if(this[_0x92f4('0x1f')][_0x4aed91]['state']===_0x92f4('0x1ff')&&this['agents'][_0x4aed91][_0x92f4('0x87')]===_0x92f4('0x200')){_0x1c4972[_0x92f4('0x97')](this[_0x92f4('0x1f')][_0x4aed91]['id']);}}}_0xce9d10[_0x92f4('0x67')]=0x1;hopperUtils[_0x92f4('0x201')](_0xce9d10,_0x1c4972,_0x4b88a1)['then'](function(_0x1af1bf){_0xce9d10[_0x92f4('0x67')]=0x0;if(_0x1af1bf){if(!utils[_0x92f4('0x1f9')](_0x1af1bf)){hopperUtils['countReScheduled'](_0xce9d10)[_0x92f4('0x3e')](sendMessageReschedule(_0xce9d10))[_0x92f4('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0xce9d10[_0x92f4('0x7f')]+=_0x1af1bf[_0x92f4('0xfd')];_0xce9d10[_0x92f4('0x69')]=_0xce9d10[_0x92f4('0xb0')]==='booked'?utils[_0x92f4('0x6b')][_0x92f4('0x13e')]:utils[_0x92f4('0x6b')][_0x92f4('0x1fb')];for(var _0x332277=0x0;_0x332277<_0x1af1bf['length'];_0x332277+=0x1){if(_[_0x92f4('0xf1')](_0x1af1bf[_0x332277])||_[_0x92f4('0xf1')](_0x1af1bf[_0x332277][_0x92f4('0x172')])||_['isNil'](_0x1af1bf[_0x332277]['phone'])){_0x5956bd[_0x92f4('0x14f')](_0x92f4('0x202'),_0xce9d10,_0x1af1bf[_0x332277]);}else{hopperUtils[_0x92f4('0x203')](_[_0x92f4('0x73')](_0x1af1bf[_0x332277],[_0x92f4('0xe7'),'phone']))['then'](_0x5956bd[_0x92f4('0x1e3')](_0xce9d10,_0x1af1bf[_0x332277]))['catch'](_0x5956bd[_0x92f4('0x14e')](_0x92f4('0x202'),_0xce9d10));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0xce9d10,_0x4b88a1));}};Dialer[_0x92f4('0x88')][_0x92f4('0x62')]=function(_0x19d22f){if(_0x19d22f[_0x92f4('0x1fe')]>0x0){var _0x248d70=_0x19d22f[_0x92f4('0x1fe')]-_0x19d22f['originated']-_0x19d22f[_0x92f4('0x13c')];if(_0x248d70>0x0&&_0x19d22f[_0x92f4('0x67')]==0x0){this[_0x92f4('0x204')](_0x19d22f);}else{loggerPredictiveCalls[_0x92f4('0x47')](_0x92f4('0x205'));}}else{this[_0x92f4('0x204')](_0x19d22f);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x46b943){var _0x391608=this;var _0x2a8767=[];_0x46b943[_0x92f4('0x7f')]+=0x1;for(var _0x5970a4 in this[_0x92f4('0x1f')]){if(typeof this[_0x92f4('0x1f')][_0x5970a4]!==_0x92f4('0xac')){if(this[_0x92f4('0x1f')][_0x5970a4][_0x92f4('0xce')]===_0x92f4('0x1ff')&&this[_0x92f4('0x1f')][_0x5970a4][_0x92f4('0x87')]==='reachable'){_0x2a8767[_0x92f4('0x97')](this[_0x92f4('0x1f')][_0x5970a4]['id']);}}}_0x46b943[_0x92f4('0x67')]=0x1;return this[_0x92f4('0x201')](_0x46b943['id'],_0x2a8767,0x1,_0x46b943[_0x92f4('0x206')],_0x46b943)[_0x92f4('0x3e')](function(_0x157f9f){_0x46b943[_0x92f4('0x67')]=0x1;if(_0x157f9f){if(!utils[_0x92f4('0x1f9')](_0x157f9f)){utils[_0x92f4('0x66')](_0x46b943,0x1,0x0);return hopperUtils['countReScheduled'](_0x46b943)[_0x92f4('0x3e')](sendMessageReschedule(_0x46b943))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x46b943['message']=utils[_0x92f4('0x6b')]['RUNNING'];if(_[_0x92f4('0xf1')](_0x157f9f[0x0])||_[_0x92f4('0xf1')](_0x157f9f[0x0][_0x92f4('0x172')])||_[_0x92f4('0xf1')](_0x157f9f[0x0][_0x92f4('0x159')])){_0x391608[_0x92f4('0x14f')](_0x92f4('0x202'),_0x46b943,_0x157f9f[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x92f4('0x73')](_0x157f9f[0x0],[_0x92f4('0xe7'),'phone']))[_0x92f4('0x3e')](_0x391608[_0x92f4('0x1e3')](_0x46b943,_0x157f9f[0x0]))[_0x92f4('0x9e')](_0x391608[_0x92f4('0x14e')](_0x92f4('0x207'),_0x46b943));}}}})[_0x92f4('0x9e')](loggerGetContactDialer(_0x92f4('0x208'),_0x46b943,0x1));};Dialer[_0x92f4('0x88')][_0x92f4('0x1d6')]=function(_0x1e8dfd,_0x1b20eb,_0x26fe4d,_0x212e9f,_0x4d515a,_0x51aba3){loggerPredictive[_0x92f4('0x47')](_0x92f4('0x209'));loggerPredictive[_0x92f4('0x47')](_0x92f4('0x20a'),_0x1e8dfd);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x20b'),_0x1b20eb);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x20c'),_0x26fe4d);loggerPredictive[_0x92f4('0x47')]('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',_0x212e9f);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d515a);loggerPredictive['info']('---------------------------');return new Promise(function(_0x5bc0ad,_0x4c28ff){if(_0x1e8dfd<=0x0||isNaN(_0x1e8dfd)){return _0x4c28ff(msgResponse(_0x92f4('0x20d'),_0x92f4('0x188'),'m\x20=\x20'+_0x1e8dfd));}if(_0x26fe4d<=0x0||isNaN(_0x26fe4d)){return _0x4c28ff(msgResponse(_0x92f4('0x20d'),'Error',_0x92f4('0x20e')+_0x26fe4d));}if(_0x212e9f<=0x0||isNaN(_0x212e9f)){return _0x4c28ff(msgResponse(_0x92f4('0x20d'),_0x92f4('0x188'),_0x92f4('0x20f')+_0x212e9f));}if(_0x1b20eb<=0x0||isNaN(_0x1b20eb)){return _0x4c28ff(msgResponse(_0x92f4('0x20d'),'Error',_0x92f4('0x210')+_0x1b20eb));}if(_0x4d515a<=0x0||isNaN(_0x4d515a)){return _0x4c28ff(msgResponse(_0x92f4('0x20d'),'Error','Amax\x20=\x20'+_0x4d515a));}_0x51aba3=_0x51aba3||0x0;var _0x1b1d9b=0x1/_0x26fe4d;var _0x55aaef=0x0;var _0x1a400c=0x0;var _0x3977f2=0x0;var _0x183778=0x0;for(var _0x56a28c=0x0;_0x3977f2<_0x4d515a;_0x56a28c+=0x1){_0x1a400c=_0x56a28c/_0x1b20eb;_0x55aaef=(_0x212e9f*_0x1a400c+_0x51aba3)/_0x1b1d9b;_0x3977f2=utils[_0x92f4('0x211')](_0x55aaef,_0x1e8dfd);_0x183778=_0x55aaef/_0x1e8dfd*(0x1-utils['erlangb'](_0x55aaef,_0x1e8dfd));}return _0x5bc0ad({'erlangCalls':_0x56a28c,'erlangCallToSecond':_0x1b20eb/_0x56a28c,'erlangAbandonmentRate':_0x3977f2,'erlangBusyFactor':_0x183778});});};Dialer[_0x92f4('0x88')][_0x92f4('0x1df')]=function(_0x27178a,_0x28d1ab,_0x22126e,_0x4ec9f1,_0x5ced8e,_0x3e098a){loggerPredictive[_0x92f4('0x47')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x92f4('0x47')](_0x92f4('0x20a'),_0x27178a);loggerPredictive['info'](_0x92f4('0x20b'),_0x28d1ab);loggerPredictive[_0x92f4('0x47')](_0x92f4('0x20c'),_0x22126e);loggerPredictive[_0x92f4('0x47')]('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',_0x4ec9f1);loggerPredictive[_0x92f4('0x47')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ced8e);loggerPredictive['info'](_0x92f4('0x5d'));return new Promise(function(_0x5de96a,_0x219340){if(_0x27178a<=0x0||isNaN(_0x27178a)){return _0x219340(msgResponse(_0x92f4('0x212'),'Error',_0x92f4('0x213')+_0x27178a));}if(_0x22126e<=0x0||isNaN(_0x22126e)){return _0x219340(msgResponse(_0x92f4('0x212'),_0x92f4('0x188'),_0x92f4('0x20e')+_0x22126e));}if(_0x4ec9f1<=0x0||isNaN(_0x4ec9f1)){return _0x219340(msgResponse('[busyFactor]',_0x92f4('0x188'),_0x92f4('0x20f')+_0x4ec9f1));}if(_0x28d1ab<=0x0||isNaN(_0x28d1ab)){return _0x219340(msgResponse(_0x92f4('0x212'),_0x92f4('0x188'),_0x92f4('0x210')+_0x28d1ab));}if(_0x5ced8e<=0x0||isNaN(_0x5ced8e)){return _0x219340(msgResponse(_0x92f4('0x212'),_0x92f4('0x188'),_0x92f4('0x214')+_0x5ced8e));}_0x3e098a=_0x3e098a||0x0;var _0x3a598e=0x1/_0x22126e;var _0x13b064=0x0;var _0x2f085c=0x0;var _0x5f02d8=0x0;var _0x235e4e=0x0;for(var _0x5317ef=0x0;_0x235e4e<_0x5ced8e;_0x5317ef+=0x1){_0x2f085c=_0x5317ef/_0x28d1ab;_0x13b064=(_0x4ec9f1*_0x2f085c+_0x3e098a)/_0x3a598e;_0x5f02d8=utils['erlangb'](_0x13b064,_0x27178a);_0x235e4e=_0x13b064/_0x27178a*(0x1-utils['erlangb'](_0x13b064,_0x27178a));}return _0x5de96a({'erlangCalls':_0x5317ef,'erlangCallToSecond':_0x28d1ab/_0x5317ef,'erlangAbandonmentRate':_0x5f02d8,'erlangBusyFactor':_0x235e4e});});};module[_0x92f4('0x215')]=Dialer; \ No newline at end of file +var _0x22b8=['Interval','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','trunks','SIP/%s','reachable','status','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','NULL_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','then','content','true','catch','command','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','Error','queue','ivr','updateOriginated','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agiafterat','dialQueueProject2','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialAbandonedMaxRetry','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','actions','channel','actionid','strategy','rrmemory','locked','paused','stateinterface','isNil','idHopper','roundrobin','run','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','buildObj','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','Machine','AMD','countmachineretry','emit','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[syncHangupInAMDIvr]','countnosuchnumberretry','dialGlobalMaxRetry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','map','Agent','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','UserId','[emptyContact][createHistory]','[emptyContact]','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','push','getContactDialer','[countReScheduled]\x20','checkIsBlackList','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[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','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]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','util','lodash','uuid','moment','./utils','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','debug','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick'];(function(_0x417fba,_0x49c253){var _0x20b9f0=function(_0x4aef4f){while(--_0x4aef4f){_0x417fba['push'](_0x417fba['shift']());}};_0x20b9f0(++_0x49c253);}(_0x22b8,0x1a9));var _0x822b=function(_0x31e982,_0x521c6a){_0x31e982=_0x31e982-0x0;var _0x3efb59=_0x22b8[_0x31e982];return _0x3efb59;};'use strict';var util=require(_0x822b('0x0'));var _=require(_0x822b('0x1'));var uuid=require(_0x822b('0x2'));var moment=require(_0x822b('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x822b('0x4'));var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0x822b('0x5'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x822b('0x6'))('booked');var loggerPredictive=require(_0x822b('0x6'))(_0x822b('0x7'));var loggerPredictiveCalls=require(_0x822b('0x6'))(_0x822b('0x8'));var loggerSyncQueueSummary=require(_0x822b('0x6'))(_0x822b('0x9'));var ami=require(_0x822b('0xa'));config[_0x822b('0xb')]=_[_0x822b('0xc')](config['redis'],{'host':_0x822b('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x822b('0xb')]));var cmHopper=require(_0x822b('0xe'));var voiceQueueRt=require(_0x822b('0xf'));var RpcSetting=require(_0x822b('0x10'));var Interval=require(_0x822b('0x11'));var Action=require('./models/action');var History=require(_0x822b('0x12'));var Final=require('./models/final');var AgentComplete=require(_0x822b('0x13'));var QueueCallerAbandon=require(_0x822b('0x14'));var Hangup=require(_0x822b('0x15'));var ipAgi=process['env'][_0x822b('0x16')]||_0x822b('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x822b('0x18')][_0x822b('0x19')]=function(_0x10ccd5){this['tail']=this[_0x822b('0x1a')]?this[_0x822b('0x1a')]['finally'](_0x10ccd5):_0x10ccd5();};function Dialer(_0x239206,_0x3650f3){this[_0x822b('0x1b')]=new Sequence();this[_0x822b('0x1c')]=_0x3650f3;this[_0x822b('0x1d')]=_0x239206[_0x822b('0x1d')];this[_0x822b('0x1e')]=_0x239206[_0x822b('0x1e')];this[_0x822b('0x1f')]=_0x239206['agents'];this['trunks']=_0x239206['trunks'];this[_0x822b('0x20')]=config['maxNumberOriginate']||0x2;this[_0x822b('0x21')]={};this['actions']={};this['contactsId']={};this[_0x822b('0x22')]={};this['optionPredictive']={};this[_0x822b('0x23')]={};this[_0x822b('0x24')]={};this[_0x822b('0x25')]={};this[_0x822b('0x26')]={};this['queueBookedRR']={};this[_0x822b('0x27')]={};ami['on'](_0x822b('0x28'),this[_0x822b('0x29')][_0x822b('0x2a')](this));ami['on'](_0x822b('0x2b'),this['syncQueueCallerAbandon'][_0x822b('0x2a')](this));ami['on'](_0x822b('0x2c'),this[_0x822b('0x2d')][_0x822b('0x2a')](this));ami['on'](_0x822b('0x2e'),this[_0x822b('0x2f')][_0x822b('0x2a')](this));ami['on'](_0x822b('0x30'),this['syncQueueSummary'][_0x822b('0x2a')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x822b('0x31'),this[_0x822b('0x32')][_0x822b('0x2a')](this));ami['on'](_0x822b('0x33'),this[_0x822b('0x34')][_0x822b('0x2a')](this));ami['on']('varset',this[_0x822b('0x35')][_0x822b('0x2a')](this));ami['on'](_0x822b('0x36'),this['syncQueueMember'][_0x822b('0x2a')](this));ami['on'](_0x822b('0x37'),this[_0x822b('0x38')][_0x822b('0x2a')](this));this[_0x822b('0x39')]();this[_0x822b('0x3a')]();RpcSetting[_0x822b('0x3b')]()['then'](function(_0x40a603){previewRecallmeReminderInterval=_0x40a603[_0x822b('0x3c')];});}function isNotNull(_0x451275){return _0x451275!==null&&!_['isUndefined'](_0x451275);}function msgResponse(_0x45199d,_0x56b224,_0x111200){return{'action':_0x45199d,'response':_0x56b224,'message':_0x111200,'stack':_0x111200};}function emit(_0x13463c,_0x52a2bc,_0x184aff){io['to'](_0x13463c)['emit'](_0x52a2bc,_0x184aff);}function emitOutboundVoiceQueueSummary(_0x4f01e7){if(_0x4f01e7[_0x822b('0x3d')]===_0x822b('0x3e')){logger['debug'](_0x822b('0x3f'),util['inspect'](_0x4f01e7,{'showHidden':![],'depth':null}));emit(util[_0x822b('0x40')](_0x822b('0x41'),_0x4f01e7[_0x822b('0x42')]),_0x822b('0x43'),_0x4f01e7);}}function checkGetDataPredictive(_0xda90e1){if(isNotNull(_0xda90e1)&&!_[_0x822b('0x44')](_0xda90e1)){loggerPredictive[_0x822b('0x45')](_0x822b('0x46'));loggerPredictive[_0x822b('0x45')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xda90e1['predictiveIntervalTotalCalls']);loggerPredictive[_0x822b('0x45')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xda90e1['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x822b('0x45')](_0x822b('0x47'),_0xda90e1[_0x822b('0x48')]);loggerPredictive[_0x822b('0x45')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xda90e1[_0x822b('0x49')]);loggerPredictive['info'](_0x822b('0x4a'),_0xda90e1['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x822b('0x4b'),_0xda90e1['predictiveIntervalAvgTalktime']);loggerPredictive[_0x822b('0x45')](_0x822b('0x4c'));if(_0xda90e1[_0x822b('0x4d')]>0x0){if(!_[_0x822b('0x4e')](_0xda90e1[_0x822b('0x4f')])&&_0xda90e1[_0x822b('0x4f')]>0x0){return!![];}loggerPredictive[_0x822b('0x45')](_0x822b('0x50'));if(!_[_0x822b('0x4e')](_0xda90e1[_0x822b('0x51')])&&_0xda90e1['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x822b('0x45')](_0x822b('0x52'));}else{loggerPredictive['info'](_0x822b('0x53'));}}else{loggerPredictive[_0x822b('0x45')](_0x822b('0x54'));}return![];}function mergeDataErlangB(_0x335443){return function(_0x5bb864){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x822b('0x45')](_0x822b('0x55'),_0x5bb864[_0x822b('0x56')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb864[_0x822b('0x57')]);loggerPredictive[_0x822b('0x45')](_0x822b('0x58'),_0x5bb864[_0x822b('0x59')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb864[_0x822b('0x5a')]);loggerPredictive['info'](_0x822b('0x58'),_0x5bb864[_0x822b('0x59')]);loggerPredictive[_0x822b('0x45')]('---------------------------');_[_0x822b('0x5b')](_0x335443,_0x5bb864);};}function ifInterval(_0x2f1ed6,_0x462ffa){if(_[_0x822b('0x4e')](_0x462ffa)){return![];}return utils['getSeconds'](undefined,_0x462ffa)<_0x2f1ed6*0x3c;}function clearPredictiveAttributes(_0x462a65){if(_0x462a65['startProgressive']){_0x462a65[_0x822b('0x24')]=undefined;loggerPredictive[_0x822b('0x5c')](_0x462a65[_0x822b('0x42')],'startProgressive\x20value\x20cleared');}if(_0x462a65['startPredictive']){_0x462a65[_0x822b('0x23')]=undefined;loggerPredictive[_0x822b('0x5c')](_0x462a65['name'],_0x822b('0x5d'));}if(_0x462a65[_0x822b('0x5e')]){clearInterval(_0x462a65[_0x822b('0x5e')]);_0x462a65[_0x822b('0x5e')]=undefined;loggerPredictive[_0x822b('0x5c')](_0x462a65[_0x822b('0x42')],_0x822b('0x5f'));}}function loggerCatchPredictive(_0x1c3209,_0x4cc6fd){return function(_0x1c6b12){loggerPredictive[_0x822b('0x60')](_0x4cc6fd[_0x822b('0x42')],_0x1c3209);loggerPredictive[_0x822b('0x60')](_0x1c6b12[_0x822b('0x61')]);clearPredictiveAttributes(_0x4cc6fd);};}function loggerCatch(_0x586af6){return function(_0x304dac){logger[_0x822b('0x60')](_0x586af6,util[_0x822b('0x62')](_0x304dac,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4c0b50,_0x26bf1a,_0x2b1e51){return function(_0x14a278){utils[_0x822b('0x63')](_0x26bf1a,_0x2b1e51,0x0);_0x26bf1a['temp']=0x0;logger[_0x822b('0x60')](_0x4c0b50,util[_0x822b('0x62')](_0x14a278,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x426833){return function(_0x4af486){if(isNotNull(_0x4af486)&&isNotNull(_0x4af486[0x0])){if(_0x4af486[0x0]['contactsRescheduled']>0x0){_0x426833[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x66')];logger[_0x822b('0x45')](_0x822b('0x67')+_0x426833['name'],_0x4af486[0x0][_0x822b('0x68')],_0x822b('0x69'));}else{_0x426833[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x6a')];logger[_0x822b('0x45')](_0x822b('0x6b')+_0x426833[_0x822b('0x42')]);}}};}function createObjHistory(_0x5dc64e,_0x236a88,_0x4648fc,_0x5294e6,_0x53bb71){_0x5dc64e[_0x822b('0x64')]=_0x4648fc;var _0x4a97aa=new Action(_0x5dc64e,_0x236a88);var _0xc7a79f=new History(_0x4a97aa);_0xc7a79f[_0x822b('0x6c')]=_0x5294e6;_0xc7a79f[_0x822b('0x6d')]=_0x53bb71;_0xc7a79f[_0x822b('0x6e')]=_0x4a97aa[_0x822b('0x6f')];return _0xc7a79f;}function unlockQueueStatus(_0x5ec4c7,_0xcb8e2d){setTimeout(function(){if(_[_0x822b('0x4e')](_0x5ec4c7[_0x822b('0x70')])){loggerBooked['error'](_0x822b('0x71'),_0xcb8e2d);}_0x5ec4c7[_0x822b('0x70')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0xcb8e2d,JSON[_0x822b('0x72')](_[_0x822b('0x73')](_0x5ec4c7,[_0x822b('0x42'),_0x822b('0x70')])));},0x1f3);}function checkInterval(_0x2e1f9d){return function(){if(!isNotNull(_0x2e1f9d[_0x822b('0x74')])){_0x2e1f9d['message']=utils[_0x822b('0x65')]['NULL_INTERVAL'];throw _0x2e1f9d['name']+_0x822b('0x75');}if(!isNotNull(_0x2e1f9d[_0x822b('0x74')][_0x822b('0x76')])){_0x2e1f9d[_0x822b('0x64')]=utils[_0x822b('0x65')]['NULL_INTERVAL'];throw _0x2e1f9d[_0x822b('0x42')]+_0x822b('0x75');}if(!isNotNull(_[_0x822b('0x44')](_0x2e1f9d[_0x822b('0x74')][_0x822b('0x76')]))){_0x2e1f9d['message']=utils[_0x822b('0x65')]['NULL_INTERVAL'];throw _0x2e1f9d[_0x822b('0x42')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x102b93){return function(){if(!utils[_0x822b('0x77')](_0x102b93)){_0x102b93[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x78')];throw _0x102b93[_0x822b('0x42')]+_0x822b('0x79');}};}function emitCampaignSummary(_0x2cb45a){if(utils[_0x822b('0x7a')](_0x2cb45a)){emit(util[_0x822b('0x40')](_0x822b('0x7b'),_0x2cb45a[_0x822b('0x42')]),'campaign:save',_0x2cb45a);}}function loggerCatchQueueSummary(_0x123860,_0x4f99ff){return function(_0x2c4900){clearPredictiveAttributes(_0x4f99ff);emitCampaignSummary(_0x4f99ff);loggerSyncQueueSummary[_0x822b('0x5c')](_0x123860,util[_0x822b('0x62')](_0x2c4900,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x355787){if(_0x355787['sendMessageOneNotActive']){if(_0x355787[_0x822b('0x7c')]===0x0){_0x355787[_0x822b('0x7d')]=![];_0x355787[_0x822b('0x64')]=utils['CAMPAIGN_STATUS'][_0x822b('0x78')];loggerSyncQueueSummary[_0x822b('0x5c')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x355787[_0x822b('0x42')],_0x822b('0x7e'));}else{_0x355787['message']=utils['CAMPAIGN_STATUS'][_0x822b('0x7f')];loggerSyncQueueSummary[_0x822b('0x5c')](_0x822b('0x80'),_0x355787[_0x822b('0x42')],_0x822b('0x81'));}emitCampaignSummary(_0x355787);}}function myreject(_0x17780b){return function(_0x12ca5c){return _0x17780b(msgResponse(_0x822b('0x82'),'Error',JSON[_0x822b('0x72')](_0x12ca5c)));};}Dialer[_0x822b('0x18')][_0x822b('0x83')]=function(_0x246df1){return!_['isUndefined'](_0x246df1)&&_0x246df1&&!_[_0x822b('0x4e')](_0x246df1[_0x822b('0x42')])&&!_[_0x822b('0x4e')](_0x246df1['active'])&&_0x246df1[_0x822b('0x84')]&&(this[_0x822b('0x85')][util[_0x822b('0x40')](_0x822b('0x86'),_0x246df1[_0x822b('0x42')])]['status']===_0x822b('0x87')||this[_0x822b('0x85')][util['format']('SIP/%s',_0x246df1[_0x822b('0x42')])][_0x822b('0x88')]==='unmonitored');};Dialer['prototype'][_0x822b('0x89')]=function(_0x2a59a4){var _0x340f0d=this;return function(){if(!_0x340f0d[_0x822b('0x83')](_0x2a59a4[_0x822b('0x8a')])){if(!_0x340f0d['isTrunkReachable'](_0x2a59a4['TrunkBackup'])){_0x2a59a4[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x8b')];throw _0x2a59a4['name']+_0x822b('0x8c');}}};};Dialer[_0x822b('0x18')][_0x822b('0x8d')]=function(_0x23a4dc,_0x26dea8,_0x117a28,_0x454dfb){var _0xf16079=this;return function(){var _0x2f423d=!![];return _0xf16079['ifTimeIvr'](_0x23a4dc,_0x26dea8,_0x117a28,_0x454dfb,_0x2f423d);};};Dialer[_0x822b('0x18')][_0x822b('0x8e')]=function(_0x587c8b,_0x431440,_0x2a34f4,_0x124a1b){var _0x7a14e0=this;return function(){var _0x1555f8=![];return _0x7a14e0['ifTimeIvr'](_0x587c8b[_0x822b('0x76')],_0x431440,_0x2a34f4,_0x124a1b,_0x1555f8);};};Dialer[_0x822b('0x18')]['ifTimeIvr']=function(_0x528de4,_0x1d88ff,_0xb93f49,_0x178feb,_0xc62e3f){var _0x3758cb=[];return new Promise(function(_0x1a24af,_0x391213){if(!isNotNull(_0x528de4)){_0x178feb[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x8f')];return _0x391213(msgResponse(_0x822b('0x90'),_0x822b('0x91'),_0xb93f49+_0x822b('0x92')));}if(_['isEmpty'](_0x528de4)){_0x178feb[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x93')];return _0x391213(msgResponse('ifTime',_0x822b('0x91'),_0xb93f49+_0x822b('0x94')));}if(_0x1d88ff&&_[_0x822b('0x4e')](config[_0x822b('0x95')][_0x1d88ff])){_0x178feb[_0x822b('0x64')]=utils[_0x822b('0x65')][_0x822b('0x96')];return _0x391213(msgResponse(_0x822b('0x90'),_0x822b('0x91'),_0xb93f49+_0x822b('0x97')+_0x1d88ff));}if(_[_0x822b('0x98')](_0x528de4)){for(var _0x2deb2c=0x0;_0x2deb2c<_0x528de4[_0x822b('0x99')];_0x2deb2c+=0x1){_0x3758cb['push'](ami[_0x822b('0x9a')]({'action':'command','command':util[_0x822b('0x40')](_0x822b('0x9b'),_0x528de4[_0x2deb2c][_0x822b('0x9c')],!_['isUndefined'](config[_0x822b('0x95')][_0x1d88ff])?_0x1d88ff:'')})[_0x822b('0x9d')](function(_0x7580a1){return _0x7580a1[_0x822b('0x9e')]['indexOf'](_0x822b('0x9f'))>=0x0;})[_0x822b('0xa0')](myreject(_0x391213)));}}else{_0x3758cb['push'](ami[_0x822b('0x9a')]({'action':_0x822b('0xa1'),'command':util['format'](_0x822b('0x9b'),_0x528de4,!_[_0x822b('0x4e')](config[_0x822b('0x95')][_0x1d88ff])?_0x1d88ff:'')})['then'](function(_0x1a4357){return _0x1a4357[_0x822b('0x9e')]['indexOf'](_0x822b('0x9f'))>=0x0;})['catch'](myreject(_0x391213)));}Promise[_0x822b('0xa2')](_0x3758cb)[_0x822b('0x9d')](function(_0xa4e341){var _0x41e509=_[_0x822b('0xa3')](_0xa4e341);if(_0x41e509){return _0x1a24af(_0x41e509);}else{_0x178feb[_0x822b('0x64')]=_0xc62e3f?utils[_0x822b('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x822b('0x65')][_0x822b('0xa4')];return _0x391213(msgResponse(_0x822b('0xa5'),_0x822b('0x91'),_0x822b('0xa6')+_0xc62e3f+'\x20'+_0xb93f49+_0x822b('0xa7')+util[_0x822b('0x62')](_0x528de4,{'showHidden':![],'depth':null})+_0x822b('0xa8')+_0x1d88ff));}})[_0x822b('0xa0')](function(_0x231d35){return _0x391213(msgResponse(_0x822b('0x90'),_0x822b('0x91'),JSON['stringify'](_0x231d35)));});});};Dialer[_0x822b('0x18')][_0x822b('0x39')]=function(){var _0x1d9fd1=this;return cmHopper[_0x822b('0xa9')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x1d9fd1[_0x822b('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x822b('0xaa')]=function(){var _0x3d99d6=this;var _0x5027d2;for(var _0x259438 in this[_0x822b('0x1e')]){if(typeof this[_0x822b('0x1e')][_0x259438]!==_0x822b('0xab')){_0x5027d2=this['campaigns'][_0x259438];if(utils[_0x822b('0x7a')](_0x5027d2)&&utils[_0x822b('0x77')](_0x5027d2)){_0x5027d2[_0x822b('0x7d')]=!![];Promise[_0x822b('0xac')]()[_0x822b('0x9d')](checkIsIVRCampaignActive(_0x5027d2))[_0x822b('0x9d')](checkInterval(_0x5027d2))[_0x822b('0x9d')](_0x3d99d6[_0x822b('0x89')](_0x5027d2))[_0x822b('0x9d')](_0x3d99d6['checkIfTime'](_0x5027d2[_0x822b('0xad')],_0x5027d2['dialTimezone'],_0x5027d2[_0x822b('0x42')],_0x5027d2))[_0x822b('0x9d')](_0x3d99d6['checkIfTimeIntervals'](_0x5027d2[_0x822b('0x74')],_0x5027d2[_0x822b('0xae')],_0x5027d2[_0x822b('0x42')],_0x5027d2))[_0x822b('0x9d')](_0x3d99d6[_0x822b('0xaf')](_0x5027d2))[_0x822b('0xa0')](loggerCatchQueueSummary(_0x822b('0xb0'),_0x5027d2));}else{notSendMessagesCampaign(_0x5027d2);}}}};Dialer[_0x822b('0x18')][_0x822b('0xb1')]=function(_0x477224){if(_0x477224['dialMethod']!==_0x822b('0x7')){clearPredictiveAttributes(_0x477224);}switch(_0x477224[_0x822b('0xb2')]){case _0x822b('0xb3'):this['handlePower'](_0x477224,0x1);break;case _0x822b('0xb4'):this[_0x822b('0xb5')](_0x477224,_0x477224[_0x822b('0xb6')]);break;case'predictive':this['predictive'](_0x477224);break;case _0x822b('0xb7'):this['handlePower'](_0x477224,0x1);break;default:logger['error'](_0x822b('0xb8'),_0x477224['name'],_0x822b('0xb9'));}};Dialer['prototype'][_0x822b('0x90')]=function(_0x54145f,_0x59c9ec){var _0x4f3e14=_0x54145f[_0x822b('0xae')];var _0x40a03a=_0x59c9ec?_0x54145f[_0x822b('0xad')]:_0x54145f[_0x822b('0x74')][_0x822b('0x76')];logger[_0x822b('0xba')](_0x822b('0xbb'),_0x40a03a,_0x4f3e14,_0x54145f[_0x822b('0x42')],util[_0x822b('0x40')](_0x822b('0xbc'),_0x54145f[_0x822b('0x42')],_0x54145f['id']));var _0x53b79f=null;return Interval[_0x822b('0xbd')](_0x40a03a,_0x4f3e14)[_0x822b('0x9d')](function(_0x3ff499){if(_0x3ff499===!![]){return _0x3ff499;}else{_0x54145f[_0x822b('0x64')]=_0x59c9ec?utils[_0x822b('0x65')][_0x822b('0xbe')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x53b79f=msgResponse('[ifTime][promiseAll]',_0x822b('0x91'),_0x822b('0xa6')+_0x59c9ec+'\x20'+_0x54145f[_0x822b('0x42')]+_0x822b('0xa7')+util[_0x822b('0x62')](_0x40a03a,{'showHidden':![],'depth':null})+_0x822b('0xa8')+_0x4f3e14);}if(_0x53b79f!==null){logger[_0x822b('0xba')](_0x822b('0xbf'),_0x53b79f);_0x53b79f[_0x822b('0xc0')]=_0x59c9ec;throw _0x53b79f;}})[_0x822b('0xa0')](function(_0x52a50e){logger[_0x822b('0x60')]('AMI\x20IfTime',_0x52a50e);throw msgResponse(_0x822b('0x82'),_0x822b('0xc1'),util[_0x822b('0x62')](_0x52a50e,{'showHidden':![],'depth':null}));});};Dialer[_0x822b('0x18')][_0x822b('0x29')]=function(_0x25abfd){if(this[_0x822b('0x1d')][_0x25abfd[_0x822b('0xc2')]]){if(this['uniqueId'][_0x25abfd['uniqueid']]&&this['uniqueId'][_0x25abfd['uniqueid']][_0x822b('0x3d')]!==_0x822b('0xc3')){this[_0x822b('0xc4')](this['voiceQueues'][_0x25abfd['queue']]);this[_0x822b('0x22')][_0x25abfd[_0x822b('0xc5')]][_0x822b('0xc6')]=moment()[_0x822b('0x40')](_0x822b('0xc7'));}}};Dialer['prototype']['syncAgentComplete']=function(_0xb6af9b){var _0xe087a6=this['uniqueId'][_0xb6af9b[_0x822b('0xc5')]];if(this['voiceQueues'][_0xb6af9b['queue']]){if(_0xe087a6&&_0xe087a6[_0x822b('0x3d')]!==_0x822b('0xc3')){delete this[_0x822b('0x22')][_0xb6af9b['uniqueid']];this[_0x822b('0x1d')][_0xb6af9b[_0x822b('0xc2')]][_0x822b('0xc8')]+=0x1;var _0x5ac28b=new AgentComplete(_0xe087a6,_0xb6af9b);if(_0xb6af9b['reason']==='agent'){_0x5ac28b[_0x822b('0xc9')]=this[_0x822b('0x1d')][_0xb6af9b[_0x822b('0xc2')]][_0x822b('0xca')]&&this[_0x822b('0x1d')][_0xb6af9b[_0x822b('0xc2')]]['dialAgiAfterHangupAgent']?moment()[_0x822b('0x40')](_0x822b('0xc7')):undefined;}hopperUtils[_0x822b('0xcb')](_0x5ac28b)[_0x822b('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x822b('0xcc')](_0x5ac28b)[_0x822b('0xa0')](loggerCatch(_0x822b('0xcd')));}}};Dialer[_0x822b('0x18')]['syncQueueCallerAbandon']=function(_0x4ea108){var _0x54c980=this[_0x822b('0x22')][_0x4ea108[_0x822b('0xc5')]];var _0x2691b2=this;var _0x349711=![];var _0x54ac2c;var _0x402f05;if(this['voiceQueues'][_0x4ea108[_0x822b('0xc2')]]){if(_0x54c980&&_0x54c980['type']!==_0x822b('0xc3')){delete this[_0x822b('0x22')][_0x4ea108[_0x822b('0xc5')]];this[_0x822b('0xc4')](this[_0x822b('0x1d')][_0x4ea108['queue']]);_0x54c980[_0x822b('0xce')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xbc88f1=new QueueCallerAbandon(_0x54c980,_0x4ea108);if(utils[_0x822b('0xcf')](_0x54c980[_0x822b('0xce')],_0x54c980[_0x822b('0xd0')])>=_0x54c980[_0x822b('0xd1')]){this[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]][_0x822b('0xd2')]+=0x1;this[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xbc88f1['state']=0xa;_0xbc88f1['statedesc']=_0x822b('0xd3');_0xbc88f1[_0x822b('0xd4')]=_0x822b('0xd5');_0xbc88f1[_0x822b('0xc9')]=this[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]][_0x822b('0xca')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0xbc88f1[_0x822b('0xd6')]+=0x1;_0xbc88f1[_0x822b('0xd7')]+=0x1;_0x54ac2c=this[_0x822b('0x1d')][_0x4ea108['queue']][_0x822b('0xd8')];_0x402f05=this[_0x822b('0x1d')][_0x4ea108['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0xbc88f1,_0xbc88f1[_0x822b('0x6c')],_0x54c980[_0x822b('0xd9')])[_0x822b('0x9d')](function(_0x1aa7f2){_0x349711=_0x1aa7f2[_0x822b('0xda')]==0x1;if(_0xbc88f1['countdropretry']>=_0x2691b2[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]][_0x822b('0xdb')]){_0x2691b2[_0x822b('0xdc')](_0xbc88f1,_0x1aa7f2[_0x822b('0xda')]);}else{hopperUtils[_0x822b('0xdd')]({'active':![],'countdropretry':_0xbc88f1['countdropretry'],'scheduledat':moment()[_0x822b('0xde')](_0x2691b2[_0x822b('0x1d')][_0x4ea108['queue']]['dialDropRetryFrequency'],_0x822b('0xdf'))[_0x822b('0x40')](_0x822b('0xc7')),'ContactId':_0x54c980[_0x822b('0xe0')],'ListId':_0x54c980[_0x822b('0xe1')],'VoiceQueueId':_0x54c980['VoiceQueueId']||undefined,'CampaignId':_0x54c980[_0x822b('0xe2')]||undefined})['catch'](loggerCatch(_0x822b('0xe3')));var _0x5aa356=new History(_0xbc88f1);_0x5aa356[_0x822b('0x6c')]=0xa;_0x5aa356[_0x822b('0x6d')]=_0x822b('0xd3');_0x5aa356[_0x822b('0x6f')]=moment()[_0x822b('0x40')](_0x822b('0xc7'));_0x5aa356[_0x822b('0x6e')]=_0x5aa356[_0x822b('0x6f')];_0x5aa356[_0x822b('0xe4')]=_0xbc88f1['calleridname'];_0x5aa356[_0x822b('0xe5')]=_0xbc88f1['calleridnum'];hopperUtils['createHistory'](_0x5aa356)[_0x822b('0xa0')](loggerCatch(_0x822b('0xe6')));}})[_0x822b('0x9d')](function(){if(_0x349711)hopperUtils['swapAdditionalPhones'](_0xbc88f1,_0x54ac2c,_0x402f05)[_0x822b('0x9d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4ea108['queue']][_0x822b('0x49')]+=0x1;this['voiceQueues'][_0x4ea108['queue']][_0x822b('0xe7')]+=0x1;_0xbc88f1[_0x822b('0x6c')]=0xb;_0xbc88f1[_0x822b('0x6d')]=_0x822b('0xe8');_0xbc88f1[_0x822b('0xd4')]=_0x822b('0xe9');_0xbc88f1[_0x822b('0xea')]+=0x1;_0xbc88f1['countglobal']+=0x1;_0x54ac2c=this['voiceQueues'][_0x4ea108[_0x822b('0xc2')]][_0x822b('0xeb')];_0x402f05=this[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]][_0x822b('0xec')];hopperUtils[_0x822b('0xed')](_0xbc88f1,_0xbc88f1[_0x822b('0x6c')],_0x54c980[_0x822b('0xd9')])[_0x822b('0x9d')](function(_0x4f1a6a){if(_0xbc88f1[_0x822b('0xea')]>=_0x2691b2[_0x822b('0x1d')][_0x4ea108['queue']][_0x822b('0xee')]){_0x2691b2[_0x822b('0xdc')](_0xbc88f1,_0x4f1a6a['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xbc88f1[_0x822b('0xea')],'scheduledat':moment()['add'](_0x2691b2[_0x822b('0x1d')][_0x4ea108[_0x822b('0xc2')]][_0x822b('0xeb')],_0x822b('0xdf'))[_0x822b('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x54c980[_0x822b('0xe0')],'ListId':_0x54c980[_0x822b('0xe1')],'VoiceQueueId':_0x54c980[_0x822b('0xef')]||undefined,'CampaignId':_0x54c980[_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0xf0')));var _0x2540dc=new History(_0xbc88f1);_0x2540dc[_0x822b('0x6c')]=0xb;_0x2540dc[_0x822b('0x6d')]=_0x822b('0xe8');_0x2540dc[_0x822b('0x6f')]=moment()[_0x822b('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x2540dc['endtime']=_0x2540dc[_0x822b('0x6f')];_0x2540dc[_0x822b('0xe4')]=_0xbc88f1[_0x822b('0xe4')];_0x2540dc[_0x822b('0xe5')]=_0xbc88f1[_0x822b('0xe5')];hopperUtils[_0x822b('0xcb')](_0x2540dc)[_0x822b('0xa0')](loggerCatch(_0x822b('0xf1')));}})[_0x822b('0x9d')](function(){if(_0x349711)hopperUtils[_0x822b('0xf2')](_0xbc88f1,_0x54ac2c,_0x402f05)[_0x822b('0x9d')](function(){return 0x1;});});}}}};Dialer[_0x822b('0x18')]['syncNewExten']=function(_0x2997b9){if(this[_0x822b('0xf3')][_0x2997b9[_0x822b('0xc5')]]){this[_0x822b('0xf3')][_0x2997b9[_0x822b('0xc5')]][_0x822b('0xf4')]=_0x2997b9[_0x822b('0xf4')];}if(this[_0x822b('0x22')][_0x2997b9[_0x822b('0xc5')]]){this[_0x822b('0x22')][_0x2997b9['uniqueid']][_0x822b('0xf4')]=_0x2997b9[_0x822b('0xf4')];}};Dialer[_0x822b('0x18')]['syncQueueMember']=function(_0x49ec33){if(!this['actions'][_0x49ec33[_0x822b('0xf5')]]){return;}var _0x554c09=this['voiceQueues'][this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]][_0x822b('0xc2')]][_0x822b('0xf6')]||_0x822b('0xf7');if(_0x554c09==='roundrobin'){if(this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]]&&_['isNil'](this['actions'][_0x49ec33[_0x822b('0xf5')]][_0x822b('0xf8')])&&_0x49ec33[_0x822b('0x88')]==='1'&&_0x49ec33[_0x822b('0xf9')]==='0'){if(this[_0x822b('0x1f')][_0x49ec33[_0x822b('0xfa')]]){if(!this['agents'][_0x49ec33[_0x822b('0xfa')]][_0x822b('0xf8')]){this[_0x822b('0x1f')][_0x49ec33['stateinterface']][_0x822b('0xf8')]=!![];this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]][_0x822b('0xf8')]=!![];this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]][_0x822b('0xfa')]=_0x49ec33['stateinterface'];}}}}else if(_0x554c09===_0x822b('0xf7')){if(this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]]){if(this[_0x822b('0x1f')][_0x49ec33[_0x822b('0xfa')]]){this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]][_0x822b('0xfa')]=_0x49ec33['stateinterface'];if(_[_0x822b('0xfb')](this[_0x822b('0x26')][this['actions'][_0x49ec33[_0x822b('0xf5')]][_0x822b('0xc2')]])){this['queueBooked'][this[_0x822b('0xf3')][_0x49ec33['actionid']][_0x822b('0xc2')]]=[];}this[_0x822b('0x26')][this[_0x822b('0xf3')][_0x49ec33[_0x822b('0xf5')]]['queue']]['push'](_[_0x822b('0x5b')](_[_0x822b('0x73')](this[_0x822b('0xf3')][_0x49ec33['actionid']],[_0x822b('0xfc'),_0x822b('0xfa')]),{'status':_0x49ec33[_0x822b('0x88')],'paused':_0x49ec33[_0x822b('0xf9')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x386221){if(!this['actions'][_0x386221[_0x822b('0xf5')]]){return;}var _0x241b1f=this;var _0x153d9f=this[_0x822b('0x1d')][this['actions'][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]];var _0x40ff98=_0x153d9f['strategy']||_0x822b('0xf7');if(_0x40ff98===_0x822b('0xfd')){if(this['actions'][_0x386221['actionid']]&&this[_0x822b('0xf3')][_0x386221['actionid']][_0x822b('0xfa')]){this[_0x822b('0x1c')][_0x822b('0xfe')](this['actions'][_0x386221['actionid']]['idHopper'],this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xfa')])[_0x822b('0xa0')](function(_0x3e6e9c){logger[_0x822b('0x60')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x822b('0x62')](_0x3e6e9c,{'showHidden':![],'depth':null}));})['finally'](function(){_0x241b1f[_0x822b('0xc4')](_0x241b1f['voiceQueues'][_0x241b1f[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]]);_0x241b1f[_0x822b('0x1f')][_0x241b1f[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xfa')]]['locked']=![];delete _0x241b1f[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]];unlockQueueStatus(_0x153d9f);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]]);hopperUtils[_0x822b('0xdd')]({'active':![],'ContactId':this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xe0')],'ListId':this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xe1')],'VoiceQueueId':this['actions'][_0x386221[_0x822b('0xf5')]][_0x822b('0xef')]||undefined,'CampaignId':this[_0x822b('0xf3')][_0x386221['actionid']][_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0xff')));delete this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]];unlockQueueStatus(_0x153d9f);}}else if(_0x40ff98==='rrmemory'){var _0x3b35fc;if(this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]]&&!_[_0x822b('0x44')](this['queueBooked'][this[_0x822b('0xf3')][_0x386221['actionid']]['queue']])){if(this[_0x822b('0x100')][_0x241b1f['actions'][_0x386221['actionid']][_0x822b('0xc2')]]){this[_0x822b('0x100')][_0x241b1f[_0x822b('0xf3')][_0x386221['actionid']]['queue']]=this[_0x822b('0x100')][this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]]?this[_0x822b('0x100')][this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]]:this[_0x822b('0x26')][this[_0x822b('0xf3')][_0x386221['actionid']][_0x822b('0xc2')]]?this[_0x822b('0x26')][this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]][_0x822b('0x101')]||0x0:0x0;}this[_0x822b('0x26')][this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]][_0x822b('0x101')]=this['queueBookedRR'][this[_0x822b('0xf3')][_0x386221[_0x822b('0xf5')]][_0x822b('0xc2')]];for(var _0x122882=0x0;_0x122882=_0x100dcf['dialGlobalMaxRetry']){_0x22737b[_0x822b('0x129')](_0x58bb5e,_0x7b1c2f,_0x3b03e0,_0x822b('0x12a'));}else{if(_0x58bb5e[_0x822b('0x122')]>=_0x100dcf[_0x822b('0x12b')]){_0x22737b[_0x822b('0x12c')](_0x58bb5e,_0x7b1c2f,_0x3b03e0,_0x822b('0x12d'));}else{hopperUtils[_0x822b('0xdd')]({'active':![],'countmachineretry':_0x58bb5e[_0x822b('0x122')],'scheduledat':moment()[_0x822b('0xde')](_0x100dcf['dialMachineRetryFrequency'],_0x822b('0xdf'))[_0x822b('0x40')](_0x822b('0xc7')),'ContactId':_0x58bb5e[_0x822b('0xe0')],'ListId':_0x58bb5e[_0x822b('0xe1')],'VoiceQueueId':_0x58bb5e[_0x822b('0xef')]||undefined,'CampaignId':_0x58bb5e[_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch('[rescheduleContact][Machine]'));_0x7b1c2f({'reschedule':0x1});}}});}if(_0x56a82b['type']===_0x822b('0xc3')&&this[_0x822b('0x1e')][_0x56a82b['queue']]['dialAMDActive']&&_0x53ad2d['value']===_0x822b('0x117')){delete this['uniqueId'][_0x53ad2d[_0x822b('0xc5')]];this[_0x822b('0xc4')](this['campaigns'][_0x56a82b['queue']]);_0x8cbf01=new Hangup(_0x56a82b,_0x53ad2d);_0x8cbf01[_0x822b('0x6c')]=0x12;_0x8cbf01[_0x822b('0x6d')]=_0x822b('0x119');_0x8cbf01[_0x822b('0x11a')]='AMD';ami[_0x822b('0x123')](_0x822b('0x11b'),ut['buildObj'](_0x8cbf01,_0x822b('0x124')));this['saveInDb'](_0x8cbf01,'[syncHangupInAMDIvr][createHistory]',_0x822b('0x12e'));}if(_0x56a82b[_0x822b('0x3d')]===_0x822b('0xc3')&&this[_0x822b('0x1e')][_0x56a82b[_0x822b('0xc2')]][_0x822b('0x11e')]&&_0x53ad2d[_0x822b('0x116')]===_0x822b('0x11f')){return new Promise(function(_0x8bf226,_0x3b97b2){delete _0x22737b[_0x822b('0x22')][_0x53ad2d[_0x822b('0xc5')]];_0x22737b[_0x822b('0xc4')](_0x22737b[_0x822b('0x1e')][_0x56a82b[_0x822b('0xc2')]]);_0x22737b[_0x822b('0x1e')][_0x56a82b['queue']][_0x822b('0xc8')]+=0x1;_0x22737b[_0x822b('0x1e')][_0x56a82b[_0x822b('0xc2')]][_0x822b('0x118')]+=0x1;var _0x3eea42=_0x22737b[_0x822b('0x1e')][_0x56a82b[_0x822b('0xc2')]];var _0x4a9b4e=new Hangup(_0x56a82b,_0x53ad2d);_0x4a9b4e['state']=0x13;_0x4a9b4e['statedesc']='Machine';_0x4a9b4e[_0x822b('0x11a')]=_0x822b('0x121');_0x4a9b4e['countmachineretry']+=0x1;_0x4a9b4e[_0x822b('0xd7')]+=0x1;_0x4a9b4e[_0x822b('0x124')]=!![];ami['emit'](_0x822b('0x11b'),ut['buildObj'](_0x4a9b4e,_0x822b('0x124')));hopperUtils['createHistory'](_0x4a9b4e)[_0x822b('0xa0')](loggerCatch(_0x822b('0x125')));if(_0x4a9b4e[_0x822b('0x126')]+_0x4a9b4e['countcongestionretry']+_0x4a9b4e[_0x822b('0x127')]+_0x4a9b4e[_0x822b('0x12f')]+_0x4a9b4e['countdropretry']+_0x4a9b4e[_0x822b('0xea')]+_0x4a9b4e['countmachineretry']+_0x4a9b4e[_0x822b('0x128')]>=_0x3eea42[_0x822b('0x130')]){_0x22737b[_0x822b('0x129')](_0x4a9b4e,_0x8bf226,_0x3b97b2,'reason19\x20machine....');}else{if(_0x4a9b4e['countmachineretry']>=_0x3eea42['dialMachineMaxRetry']){_0x22737b['createStateFinal'](_0x4a9b4e,_0x8bf226,_0x3b97b2,_0x822b('0x12d'));}else{hopperUtils[_0x822b('0xdd')]({'active':![],'countmachineretry':_0x4a9b4e[_0x822b('0x122')],'scheduledat':moment()[_0x822b('0xde')](_0x3eea42['dialMachineRetryFrequency'],_0x822b('0xdf'))[_0x822b('0x40')](_0x822b('0xc7')),'ContactId':_0x4a9b4e['ContactId'],'ListId':_0x4a9b4e[_0x822b('0xe1')],'VoiceQueueId':_0x4a9b4e[_0x822b('0xef')]||undefined,'CampaignId':_0x4a9b4e[_0x822b('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x8bf226({'reschedule':0x1});}}});}}};Dialer[_0x822b('0x18')][_0x822b('0x32')]=function(_0xfb6f83){var _0x31100b=this['uniqueId'][_0xfb6f83[_0x822b('0xc5')]];var _0x38e1d3;if(_0x31100b&&_0x31100b['type']===_0x822b('0xc3')){delete this[_0x822b('0x22')][_0xfb6f83['uniqueid']];this[_0x822b('0xc4')](this[_0x822b('0x1e')][_0x31100b[_0x822b('0xc2')]]);this['campaigns'][_0x31100b[_0x822b('0xc2')]]['ivrAnswerCallsDay']+=0x1;_0x38e1d3=new Hangup(_0x31100b,_0xfb6f83);hopperUtils[_0x822b('0xcb')](_0x38e1d3)['catch'](loggerCatch(_0x822b('0x131')));hopperUtils[_0x822b('0xcc')](_0x38e1d3)[_0x822b('0xa0')](loggerCatch(_0x822b('0x132')));}if(_0x31100b&&_0x31100b['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x31100b[_0x822b('0xc2')]][_0x822b('0x133')])){delete this[_0x822b('0x22')][_0xfb6f83['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x31100b[_0x822b('0xc2')]]);this[_0x822b('0x1d')][_0x31100b[_0x822b('0xc2')]]['outboundAnswerCallsDay']+=0x1;this[_0x822b('0x1d')][_0x31100b['queue']][_0x822b('0x118')]+=0x1;_0x38e1d3=new Hangup(_0x31100b,_0xfb6f83);_0x38e1d3['state']=0x10;_0x38e1d3['statedesc']='AnswerAGI';_0x38e1d3['membername']=_0x822b('0x134');hopperUtils[_0x822b('0xcb')](_0x38e1d3)[_0x822b('0xa0')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x822b('0xcc')](_0x38e1d3)['catch'](loggerCatch(_0x822b('0x132')));}if(_0x31100b&&_0x31100b[_0x822b('0x3d')]!==_0x822b('0xc3')&&!isNotNull(this['voiceQueues'][_0x31100b['queue']][_0x822b('0x133')])){if(_0xfb6f83[_0x822b('0x135')]===_0x822b('0x136')){delete this[_0x822b('0x22')][_0xfb6f83[_0x822b('0xc5')]];this[_0x822b('0x1d')][_0x31100b[_0x822b('0xc2')]][_0x822b('0xc8')]+=0x1;const _0x386021=new AgentComplete(_0x31100b,_0xfb6f83);_0x386021[_0x822b('0xe2')]=this[_0x822b('0x1d')][_0x31100b[_0x822b('0xc2')]]['id'];hopperUtils[_0x822b('0xcb')](_0x386021)['catch'](loggerCatch(_0x822b('0x137')));hopperUtils[_0x822b('0xcc')](_0x386021)[_0x822b('0xa0')](loggerCatch(_0x822b('0xcd')));}else{delete this['uniqueId'][_0xfb6f83[_0x822b('0xc5')]];this[_0x822b('0xc4')](this[_0x822b('0x1d')][_0x31100b[_0x822b('0xc2')]]);this[_0x822b('0x1d')][_0x31100b[_0x822b('0xc2')]][_0x822b('0x138')]+=0x1;_0x38e1d3=new Hangup(_0x31100b,_0xfb6f83);_0x38e1d3[_0x822b('0x6c')]=0xc;_0x38e1d3['statedesc']=_0xfb6f83[_0x822b('0x135')];_0x38e1d3[_0x822b('0x11a')]=_0x822b('0x139');hopperUtils[_0x822b('0xcb')](_0x38e1d3)[_0x822b('0xa0')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x822b('0xcc')](_0x38e1d3)[_0x822b('0xa0')](loggerCatch(_0x822b('0x132')));}}};Dialer['prototype'][_0x822b('0x9')]=function(_0x14f3b2){var _0x345511=this;if(!_0x345511[_0x822b('0x27')][_0x14f3b2['name']]){_0x345511[_0x822b('0x27')][_0x14f3b2[_0x822b('0x42')]]={'running':![]};}else if(_0x345511[_0x822b('0x27')][_0x14f3b2[_0x822b('0x42')]][_0x822b('0x13a')]===!![]){return;}else if(_0x345511[_0x822b('0x27')][_0x14f3b2['name']][_0x822b('0x13a')]===![]){_0x345511[_0x822b('0x27')][_0x14f3b2['name']]['running']=!![];}var _0x589702=_0x345511[_0x822b('0x1d')][_0x14f3b2[_0x822b('0x42')]];var _0x34d1d4=_0x589702[_0x822b('0x64')]!==utils[_0x822b('0x65')][_0x822b('0x78')];var _0x5106ec=utils[_0x822b('0x13b')](_0x589702);_0x589702['statusMessage']=utils[_0x822b('0x13c')](_0x589702,_0x345511['trunks']);Promise[_0x822b('0xac')]()[_0x822b('0x9d')](function(){if(_0x589702[_0x822b('0x13d')]===utils[_0x822b('0x65')][_0x822b('0x78')]){if(_0x34d1d4){clearPredictiveAttributes(_0x589702);_0x14f3b2[_0x822b('0x23')]=undefined;_0x14f3b2[_0x822b('0x24')]=undefined;}if(_0x589702[_0x822b('0x13d')]===utils[_0x822b('0x65')]['INACTIVE']){_0x14f3b2[_0x822b('0x13e')]=0x0;_0x14f3b2[_0x822b('0xf9')]=0x0;_0x14f3b2[_0x822b('0x13f')]=0x0;_0x14f3b2[_0x822b('0x140')]=0x0;_0x14f3b2[_0x822b('0x141')]=0x0;}}else if(_0x589702[_0x822b('0x13d')]===utils[_0x822b('0x65')]['ACTIVE']&&!_0x5106ec){return _0x345511[_0x822b('0x90')](_0x589702,!![])['then'](function(){return _0x345511[_0x822b('0x90')](_0x589702,![]);})['then'](function(){return _0x345511['checkDialMethod'](_0x589702);})[_0x822b('0xa0')](function(_0x8ce7f0){loggerSyncQueueSummary['debug'](_0x822b('0x142'),util[_0x822b('0x62')](_0x8ce7f0,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x589702);});}else{clearPredictiveAttributes(_0x589702);}})[_0x822b('0x9d')](function(){var _0x28b80f=_0x14f3b2[_0x822b('0x143')](_0x589702);if(_0x28b80f||_0x589702[_0x822b('0x144')]){_0x589702[_0x822b('0x144')]=![];_0x14f3b2[_0x822b('0x145')](_0x589702);Object['assign'](_0x589702,_0x14f3b2);emitOutboundVoiceQueueSummary(_0x14f3b2);}_0x345511['queuesSummary'][_0x589702['name']][_0x822b('0x13a')]=![];})['catch'](function(_0x2be98f){logger[_0x822b('0x60')](_0x822b('0x142'),util[_0x822b('0x62')](_0x2be98f,{'showHidden':![],'depth':null}));_0x345511[_0x822b('0x27')][_0x589702[_0x822b('0x42')]]['running']=![];});};Dialer['prototype'][_0x822b('0x146')]=_['throttle'](function(){var _0xa687b1=_[_0x822b('0x147')](this['voiceQueues'],function(_0x4126a7){return _0x4126a7[_0x822b('0x148')];});var _0x31c2c6=_['filter'](this[_0x822b('0x1f')],function(_0x37e8cb){return _0x37e8cb[_0x822b('0x149')]&&_0x37e8cb[_0x822b('0x88')]==='reachable';});if(_0xa687b1[_0x822b('0x99')]>0x0&&_0x31c2c6['length']>0x0){return Promise[_0x822b('0xac')]()[_0x822b('0x9d')](cmHopper['handlePreviewRecallNotifications'](_[_0x822b('0x14a')](_0xa687b1,'id'),previewRecallmeReminderInterval,_[_0x822b('0x14a')](_0x31c2c6,'id')))[_0x822b('0x9d')](function(_0x50e149){for(var _0x21213e=0x0;_0x21213e<_0x50e149['length'];_0x21213e++){var _0x5383ba=_0x50e149[_0x21213e][_0x822b('0x14b')][_0x822b('0x42')];if(_0x5383ba)io['to'](util[_0x822b('0x40')]('user:%s',_0x5383ba))[_0x822b('0x123')]('user:dialPreviewRecallReminder',{'hopper':_0x50e149[_0x21213e]});}})[_0x822b('0xa0')](function(_0x12a9b4){logger['error'](_0x822b('0x14c'),_0x12a9b4);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x822b('0x3a')]=function(){var _0x20b419=this;setInterval(function(){_0x20b419[_0x822b('0x14d')](_0x20b419['uniqueId'],_0x822b('0x14e'));_0x20b419['clearZombieChannels'](_0x20b419['actions'],_0x822b('0x14f'));},0x32c8);};Dialer[_0x822b('0x18')][_0x822b('0x14d')]=function(_0x1efbbe,_0x255c25){var _0x12b74a=this;for(var _0x33c2a7 in _0x1efbbe){if(typeof _0x1efbbe[_0x33c2a7]!==_0x822b('0xab')){this[_0x822b('0x1b')][_0x822b('0x19')](function(){if(!_['isNil'](_0x1efbbe[_0x33c2a7])){return ami[_0x822b('0x9a')]({'action':_0x822b('0x88'),'channel':_0x1efbbe[_0x33c2a7][_0x822b('0xf4')]})['catch'](function(_0x27adb6){if(_0x27adb6[_0x822b('0x64')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1efbbe[_0x33c2a7]&&_0x1efbbe[_0x33c2a7][_0x822b('0x3d')]!==_0x822b('0xc3')){_0x12b74a[_0x822b('0xc4')](_0x12b74a[_0x822b('0x1d')][_0x1efbbe[_0x33c2a7]['queue']]);logger['error'](_0x822b('0x150'),_0x255c25,_0x33c2a7,_0x1efbbe[_0x33c2a7][_0x822b('0xc2')]);delete _0x1efbbe[_0x33c2a7];}if(_0x1efbbe[_0x33c2a7]&&_0x1efbbe[_0x33c2a7][_0x822b('0x3d')]===_0x822b('0xc3')){_0x12b74a['updateOriginated'](_0x12b74a[_0x822b('0x1e')][_0x1efbbe[_0x33c2a7]['queue']]);logger['error'](_0x822b('0x151'),_0x255c25,_0x33c2a7,_0x1efbbe[_0x33c2a7][_0x822b('0xc2')]);delete _0x1efbbe[_0x33c2a7];}},0x2328);}});}});}}};Dialer['prototype'][_0x822b('0x152')]=function(_0x6c8b09){return Promise[_0x822b('0xac')]()[_0x822b('0x9d')](voiceQueueRt['getVoiceQueueRtPauses'](_0x6c8b09))[_0x822b('0xa0')](loggerCatch(_0x822b('0x153')));};Dialer['prototype'][_0x822b('0xc4')]=function(_0x1ad7a0){if(!_[_0x822b('0x4e')](_0x1ad7a0)&&_0x1ad7a0!==null){if(typeof _0x1ad7a0['originated']!==_0x822b('0xab')){if(_0x1ad7a0['originated']>0x0){_0x1ad7a0[_0x822b('0x7c')]-=0x1;}else{logger[_0x822b('0x60')](_0x822b('0x154'));}}}else{logger[_0x822b('0x60')](_0x822b('0x155'));}};Dialer['prototype']['loggerHandler']=function(_0x1263ea,_0x3e03c2){var _0x430edf=this;return function(_0x507f08){_0x430edf[_0x822b('0xc4')](_0x3e03c2);logger[_0x822b('0x60')](_0x1263ea,util[_0x822b('0x62')](_0x507f08,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x822b('0x156')]=function(_0x5a194d,_0xfc902b,_0x40c6fb){var _0x13c2d8={'state':0x19,'statedesc':_0x822b('0x157')};this[_0x822b('0xc4')](_0xfc902b);this[_0x822b('0x158')](_[_0x822b('0x5b')](_0x13c2d8,_[_0x822b('0x73')](_0x40c6fb,['ContactId',_0x822b('0xe1'),_0x822b('0x159'),_0x822b('0xef'),_0x822b('0xe2')])),_0x822b('0x15a'),_0x822b('0x15b'));logger['error'](_0x5a194d);};Dialer[_0x822b('0x18')][_0x822b('0x158')]=function(_0x3c84c6,_0x47a796,_0x234c53){hopperUtils['createHistory'](_0x3c84c6)[_0x822b('0xa0')](loggerCatch(_0x47a796));hopperUtils[_0x822b('0xcc')](_0x3c84c6)[_0x822b('0xa0')](loggerCatch(_0x234c53));};Dialer[_0x822b('0x18')][_0x822b('0xdc')]=function(_0x57e813,_0x2d8575){hopperUtils[_0x822b('0xcb')](_0x57e813)['catch'](loggerCatch(_0x822b('0x137')));if(_0x2d8575==0x0){hopperUtils['moveContactManagedDialer'](_0x57e813)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x822b('0x18')][_0x822b('0x14c')]=function(_0x30a22a){return Promise['resolve']()[_0x822b('0x9d')](cmHopper[_0x822b('0x15c')](_0x30a22a['id'],previewRecallmeReminderInterval))['then'](function(_0x5760c3){for(var _0x16a755=0x0;_0x16a755<_0x5760c3['length'];_0x16a755++){var _0x4157c8=_0x5760c3[_0x16a755]['Agent'][_0x822b('0x42')];if(_0x4157c8)io['to'](util[_0x822b('0x40')]('user:%s',_0x4157c8))['emit'](_0x822b('0x15d'),{'hopper':_0x5760c3[_0x16a755]});}})[_0x822b('0xa0')](function(){});};Dialer[_0x822b('0x18')][_0x822b('0xaf')]=function(_0x181ee4){var _0x50d7ec=this;return function(){_0x50d7ec[_0x822b('0x15e')](_0x181ee4);};};Dialer['prototype'][_0x822b('0x15f')]=function(_0x351fd8,_0x1d0a3c){var _0x488245=this;var _0x5f228c=uuid['v4']();this[_0x822b('0xf3')][_0x5f228c]=new Action(_0x351fd8,_0x1d0a3c,_0x5f228c);return new Promise(function(_0x5c051b,_0x41f2c9){if(_[_0x822b('0x4e')](_0x351fd8)&&typeof _0x351fd8!==_0x822b('0x160')){return _0x41f2c9(msgResponse(_0x822b('0x161'),_0x822b('0x91'),_0x822b('0x162')));}if(_[_0x822b('0x4e')](_0x1d0a3c['phone'])||_0x1d0a3c[_0x822b('0x163')]===null){return _0x41f2c9(msgResponse(_0x822b('0x161'),'Failure','contact\x20is\x20undefine'));}var _0x2ea360={'XMD-CALLERID':_0x488245[_0x822b('0xf3')][_0x5f228c][_0x822b('0x164')](),'XMD-AGI':_0x351fd8[_0x822b('0x133')]?util[_0x822b('0x40')](_0x822b('0x165'),ipAgi,_0x351fd8[_0x822b('0x133')]):_0x822b('0x166'),'XMD-AGIAFTER':_0x351fd8[_0x822b('0xca')]?util['format'](_0x822b('0x165'),ipAgi,_0x351fd8[_0x822b('0xca')]):_0x822b('0x166'),'XMD-QUEUE':utils[_0x822b('0x167')](_0x351fd8)?util[_0x822b('0x40')]('\x22%s,%s%s,,,%s\x22',_0x351fd8['name'],_0x351fd8[_0x822b('0x168')]||'',_0x351fd8[_0x822b('0x169')]?'c':'',_0x351fd8['dialQueueTimeout']||0x3):_0x822b('0x166'),'XMD-CONTACTID':_0x1d0a3c[_0x822b('0xe0')],'XMD-CDRTYPE':_0x822b('0x16a'),'CALLERID(all)':_0x488245[_0x822b('0xf3')][_0x5f228c][_0x822b('0x164')](),'XMD-AMD':_0x351fd8[_0x822b('0x11e')]?_0x822b('0x16b'):'NONE','XMD-DESTINATION':_0x822b('0x115')};if(_0x351fd8[_0x822b('0x11e')]){_0x2ea360[_0x822b('0x16c')]=_0x351fd8['dialAMDInitialSilence']||0x9c4;_0x2ea360[_0x822b('0x16d')]=_0x351fd8[_0x822b('0x16e')]||0x5dc;_0x2ea360[_0x822b('0x16f')]=_0x351fd8['dialAMDAfterGreetingSilence']||0x320;_0x2ea360[_0x822b('0x170')]=_0x351fd8[_0x822b('0x171')]||0x1388;_0x2ea360[_0x822b('0x172')]=_0x351fd8['dialAMDMinWordLength']||0x64;_0x2ea360['XMD-AMDBETWEENWORDSSILENCE']=_0x351fd8['dialAMDBetweenWordsSilence']||0x32;_0x2ea360[_0x822b('0x173')]=_0x351fd8[_0x822b('0x174')]||0x3;_0x2ea360['XMD-AMDSILENCETHRESHOLD']=_0x351fd8['dialAMDSilenceThreshold']||0x100;_0x2ea360[_0x822b('0x175')]=_0x351fd8[_0x822b('0x176')]||0x1388;}if(utils[_0x822b('0x167')](_0x351fd8)){_0x2ea360[_0x822b('0x177')]=_0x1d0a3c['VoiceQueueId'];}else{_0x2ea360[_0x822b('0x178')]=_0x1d0a3c[_0x822b('0xe2')];}var _0x4fa8f9=utils[_0x822b('0x179')](_0x1d0a3c[_0x822b('0x17a')]);Object[_0x822b('0x17b')](_0x2ea360,_0x4fa8f9);var _0xc0495f=_0x488245[_0x822b('0x83')](_0x351fd8[_0x822b('0x8a')])?utils[_0x822b('0x17c')](_0x351fd8[_0x822b('0x8a')][_0x822b('0x17d')],_0x351fd8[_0x822b('0x17e')],_0x351fd8[_0x822b('0x17f')]>0x0?utils['getCallerIdRandom'](_0x351fd8[_0x822b('0x180')],_0x351fd8[_0x822b('0x17f')]):_0x351fd8[_0x822b('0x180')]):utils[_0x822b('0x17c')](_['isNil'](_0x351fd8[_0x822b('0x181')])?_0x351fd8[_0x822b('0x8a')][_0x822b('0x17d')]:_0x351fd8[_0x822b('0x181')][_0x822b('0x17d')],_0x351fd8[_0x822b('0x17e')],_0x351fd8[_0x822b('0x17f')]>0x0?utils[_0x822b('0x182')](_0x351fd8[_0x822b('0x180')],_0x351fd8['dialRandomLastDigitCallerIdNumber']):_0x351fd8[_0x822b('0x180')]);if(_0xc0495f){_0x2ea360[_0x822b('0x183')]=_0x488245['actions'][_0x5f228c]['originatecalleridname']=utils['extractCalleridName'](_0xc0495f);_0x2ea360['XMD-ORIGINATECALLERIDNUM']=_0x1d0a3c[_0x822b('0x163')];}_0x351fd8[_0x822b('0x184')]=_0x2ea360;return ami[_0x822b('0x9a')]({'actionid':_0x5f228c,'action':_0x822b('0x161'),'channel':_0x488245[_0x822b('0x83')](_0x351fd8[_0x822b('0x8a')])?util[_0x822b('0x40')](_0x822b('0x185'),_0x351fd8[_0x822b('0x8a')][_0x822b('0x42')],isNotNull(_0x351fd8['dialPrefix'])?_0x351fd8[_0x822b('0x186')][_0x822b('0x187')]()||'':'',_0x351fd8['dialCutDigit']>0x0?_0x1d0a3c[_0x822b('0x163')][_0x822b('0x188')](_0x351fd8[_0x822b('0x189')]):_0x1d0a3c[_0x822b('0x163')]):util[_0x822b('0x40')](_0x822b('0x185'),_['isNil'](_0x351fd8[_0x822b('0x181')])?_0x351fd8[_0x822b('0x8a')]['name']:_0x351fd8[_0x822b('0x181')][_0x822b('0x42')],isNotNull(_0x351fd8[_0x822b('0x186')])?_0x351fd8[_0x822b('0x186')][_0x822b('0x187')]()||'':'',_0x351fd8[_0x822b('0x189')]>0x0?_0x1d0a3c[_0x822b('0x163')][_0x822b('0x188')](_0x351fd8[_0x822b('0x189')]):_0x1d0a3c[_0x822b('0x163')]),'callerid':_0xc0495f,'Exten':_0x822b('0x115'),'Context':_0x822b('0x18a'),'Priority':'1','variable':_0x2ea360,'timeout':(_0x351fd8[_0x822b('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5f228c})[_0x822b('0x9d')](function(_0x2657d5){return _0x5c051b(_0x2657d5);})[_0x822b('0xa0')](function(_0x10e4cd){_0x351fd8[_0x822b('0x18c')]+=0x1;var _0x2bd21f=new History(_0x488245[_0x822b('0xf3')][_0x5f228c]);logger[_0x822b('0x60')](util['format'](_0x822b('0x18d'),JSON['stringify'](_0x10e4cd)));_0x2bd21f[_0x822b('0x6c')]=0xe;_0x2bd21f[_0x822b('0x6d')]=_0x822b('0x18e');_0x2bd21f['starttime']=moment()[_0x822b('0x40')](_0x822b('0xc7'));_0x2bd21f['endtime']=_0x2bd21f[_0x822b('0x6f')];hopperUtils[_0x822b('0xcb')](_0x2bd21f)[_0x822b('0xa0')](loggerCatch(_0x822b('0x18f')));_0x488245['moveContactManagedDialer'](_0x2bd21f)[_0x822b('0xa0')](loggerCatch(_0x822b('0x18f')))[_0x822b('0x107')](function(){delete _0x488245[_0x822b('0xf3')][_0x5f228c];return _0x41f2c9(msgResponse(_0x822b('0x161'),_0x822b('0xc1'),_0x822b('0x190')));});});});};Dialer[_0x822b('0x18')][_0x822b('0x191')]=function(_0x53ccf3,_0xda08c3,_0x31b6c9){var _0x588244=new History(_0xda08c3);if(_0x588244[_0x822b('0x126')]+_0x588244[_0x822b('0x192')]+_0x588244['countnoanswerretry']+_0x588244['countnosuchnumberretry']+_0x588244[_0x822b('0xd6')]+_0x588244['countabandonedretry']+_0x588244[_0x822b('0x122')]+_0x588244[_0x822b('0x128')]>=_0x31b6c9[_0x822b('0x130')]-0x1){return!![];}switch(_0x53ccf3){case 0x3:if(_0x588244['countnoanswerretry']>=_0x31b6c9[_0x822b('0x193')]-0x1){return!![];}hopperUtils[_0x822b('0xdd')]({'active':![],'countnoanswerretry':_0x588244['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x822b('0xde')](_0x31b6c9[_0x822b('0x194')],'minutes')[_0x822b('0x40')](_0x822b('0xc7')),'ContactId':_0x588244['ContactId'],'ListId':_0x588244['ListId'],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244['CampaignId']||undefined})['catch'](loggerCatch(_0x822b('0x195')));break;case 0x5:if(_0x588244['countbusyretry']>=_0x31b6c9[_0x822b('0x196')]-0x1){return!![];}hopperUtils[_0x822b('0xdd')]({'active':![],'countbusyretry':_0x588244[_0x822b('0x126')]+=0x1,'scheduledat':moment()['add'](_0x31b6c9[_0x822b('0x197')],_0x822b('0xdf'))['format'](_0x822b('0xc7')),'ContactId':_0x588244[_0x822b('0xe0')],'ListId':_0x588244[_0x822b('0xe1')],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244['CampaignId']||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0x198')));break;case 0x8:if(_0x588244['countcongestionretry']>=_0x31b6c9[_0x822b('0x199')]-0x1){return!![];}hopperUtils[_0x822b('0xdd')]({'active':![],'countcongestionretry':_0x588244[_0x822b('0x192')]+=0x1,'scheduledat':moment()['add'](_0x31b6c9[_0x822b('0x19a')],_0x822b('0xdf'))[_0x822b('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588244[_0x822b('0xe0')],'ListId':_0x588244['ListId'],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244['CampaignId']||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0x19b')));break;case 0x0:if(_0x588244[_0x822b('0x12f')]>=_0x31b6c9[_0x822b('0x19c')]-0x1){return!![];}else{hopperUtils[_0x822b('0xdd')]({'active':![],'countnosuchnumberretry':_0x588244[_0x822b('0x12f')]+=0x1,'scheduledat':moment()[_0x822b('0xde')](_0x31b6c9['dialNoSuchNumberRetryFrequency'],_0x822b('0xdf'))[_0x822b('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588244[_0x822b('0xe0')],'ListId':_0x588244[_0x822b('0xe1')],'VoiceQueueId':_0x588244['VoiceQueueId']||undefined,'CampaignId':_0x588244[_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0x19d')));}break;case 0xa:if(_0x588244[_0x822b('0xd6')]>=_0x31b6c9[_0x822b('0xdb')]-0x1){return!![];}hopperUtils[_0x822b('0xdd')]({'active':![],'countdropretry':_0x588244[_0x822b('0xd6')]+=0x1,'scheduledat':moment()[_0x822b('0xde')](_0x31b6c9[_0x822b('0xd8')],'minutes')['format'](_0x822b('0xc7')),'ContactId':_0x588244[_0x822b('0xe0')],'ListId':_0x588244[_0x822b('0xe1')],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244[_0x822b('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x588244[_0x822b('0xea')]>=_0x31b6c9[_0x822b('0xee')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x588244[_0x822b('0xea')]+=0x1,'scheduledat':moment()['add'](_0x31b6c9[_0x822b('0xeb')],'minutes')[_0x822b('0x40')](_0x822b('0xc7')),'ContactId':_0x588244[_0x822b('0xe0')],'ListId':_0x588244['ListId'],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244[_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x588244[_0x822b('0x122')]>=_0x31b6c9['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x588244['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x31b6c9['dialMachineRetryFrequency'],'minutes')[_0x822b('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588244[_0x822b('0xe0')],'ListId':_0x588244[_0x822b('0xe1')],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244[_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x588244[_0x822b('0x128')]>=_0x31b6c9[_0x822b('0x19e')]-0x1){return!![];}hopperUtils[_0x822b('0xdd')]({'active':![],'countagentrejectretry':_0x588244['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x822b('0xde')](_0x31b6c9[_0x822b('0x19f')],_0x822b('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588244['ContactId'],'ListId':_0x588244[_0x822b('0xe1')],'VoiceQueueId':_0x588244[_0x822b('0xef')]||undefined,'CampaignId':_0x588244['CampaignId']||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0x1a0')));break;default:return!![];}};Dialer[_0x822b('0x18')][_0x822b('0x111')]=function(_0x317ef0,_0x3e7b81,_0x574980){var _0x1d4036=this;var _0x539686=new History(_0x317ef0);var _0x248538=![];var _0x48885d;var _0x522bd2;return new Promise(function(_0x3ad1af,_0x1352f3){if(_['isUndefined'](_0x3e7b81)&&typeof _0x3e7b81!==_0x822b('0x160')){return _0x1352f3(msgResponse('[callProgressDetecting]',_0x822b('0x91'),_0x822b('0x1a1')));}if(_[_0x822b('0x4e')](_0x574980)&&typeof _0x574980!==_0x822b('0x160')){return _0x1352f3(msgResponse(_0x822b('0x1a2'),'Failure',_0x822b('0x1a3')));}hopperUtils[_0x822b('0xed')](_0x539686,_0x574980[_0x822b('0x1a4')],_0x3e7b81)[_0x822b('0x9d')](function(_0x7ff479){if(_0x7ff479[_0x822b('0xda')]==0x1)_0x248538=!![];switch(_0x574980[_0x822b('0x1a4')]){case'0':_0x3e7b81[_0x822b('0x1a5')]+=0x1;_0x539686[_0x822b('0x6c')]=0x0;_0x539686[_0x822b('0x6d')]=_0x822b('0x1a6');_0x539686[_0x822b('0x12f')]+=0x1;_0x539686['countglobal']+=0x1;ami[_0x822b('0x123')](_0x822b('0x1a7'),ut[_0x822b('0x11c')](_0x317ef0,_0x822b('0x1a8')));_0x48885d=_0x3e7b81['dialNoSuchNumberRetryFrequency'];_0x522bd2=_0x3e7b81[_0x822b('0xec')];hopperUtils['createHistory'](_0x539686)[_0x822b('0xa0')](loggerCatch(_0x822b('0x125')));if(_0x1d4036[_0x822b('0x191')](0x0,_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686[_0x822b('0x12f')]>=_0x3e7b81[_0x822b('0x19c')]){_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,'reason\x200\x20no\x20such\x20number....');}else{_0x1d4036['stateGlobal'](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1a9'));}}break;case'3':_0x3e7b81[_0x822b('0x1aa')]+=0x1;_0x539686[_0x822b('0x6c')]=0x3;_0x539686[_0x822b('0x6d')]=_0x822b('0x1ab');_0x539686['countnoanswerretry']+=0x1;_0x539686['countglobal']+=0x1;var _0x2fd58c=ut['buildNoAnswerEventPayload'](_0x317ef0,_0x3e7b81);ami[_0x822b('0x123')](_0x822b('0x1ac'),_0x2fd58c);_0x48885d=_0x3e7b81[_0x822b('0x194')];_0x522bd2=_0x3e7b81[_0x822b('0xec')];hopperUtils[_0x822b('0xcb')](_0x539686)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1d4036[_0x822b('0x191')](0x3,_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686[_0x822b('0x127')]>=_0x3e7b81['dialNoAnswerMaxRetry']){_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1ad'));}else{_0x1d4036['stateGlobal'](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1ad'));}}break;case'5':_0x3e7b81[_0x822b('0x1ae')]+=0x1;_0x539686[_0x822b('0x6c')]=0x5;_0x539686[_0x822b('0x6d')]=_0x822b('0x1af');_0x539686[_0x822b('0x126')]+=0x1;_0x539686[_0x822b('0xd7')]+=0x1;ami[_0x822b('0x123')](_0x822b('0x1b0'),ut[_0x822b('0x11c')](_0x317ef0,'busy'));_0x48885d=_0x3e7b81[_0x822b('0x197')];_0x522bd2=_0x3e7b81[_0x822b('0xec')];hopperUtils[_0x822b('0xcb')](_0x539686)[_0x822b('0xa0')](loggerCatch(_0x822b('0x1b1')));if(_0x1d4036[_0x822b('0x191')](0x5,_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686[_0x822b('0x126')]>=_0x3e7b81[_0x822b('0x196')]){_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1b2'));}else{_0x1d4036[_0x822b('0x129')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1b2'));}}break;case'8':_0x3e7b81[_0x822b('0x1b3')]+=0x1;_0x539686[_0x822b('0x6c')]=0x8;_0x539686[_0x822b('0x6d')]=_0x822b('0x1b4');_0x539686[_0x822b('0x192')]+=0x1;_0x539686[_0x822b('0xd7')]+=0x1;_0x48885d=_0x3e7b81[_0x822b('0x19a')];_0x522bd2=_0x3e7b81['callAdditionalPhoneAfterMin'];ami[_0x822b('0x123')](_0x822b('0x1b5'),ut['buildObj'](_0x317ef0,_0x822b('0x1b6')));hopperUtils[_0x822b('0xcb')](_0x539686)['catch'](loggerCatch(_0x822b('0x1b7')));if(_0x1d4036['checkRetriveMax'](0x8,_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686[_0x822b('0x192')]>=_0x3e7b81[_0x822b('0x199')]){_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1b8'));}else{_0x1d4036[_0x822b('0x129')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1b8'));}}break;case'11':_0x3e7b81[_0x822b('0x1b9')]+=0x1;_0x539686['state']=0xb;_0x539686[_0x822b('0x6d')]=_0x822b('0xe8');_0x539686[_0x822b('0xea')]+=0x1;_0x539686[_0x822b('0xd7')]+=0x1;_0x48885d=_0x3e7b81['dialAbandonedRetryFrequency'];_0x522bd2=_0x3e7b81[_0x822b('0xec')];hopperUtils[_0x822b('0xcb')](_0x539686)['catch'](loggerCatch(_0x822b('0xf1')));if(_0x1d4036[_0x822b('0x191')](0xb,_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686['countabandonedretry']>=_0x3e7b81[_0x822b('0xee')]){_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1ba'));}else{_0x1d4036[_0x822b('0x129')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1ba'));}}break;case'20':_0x3e7b81[_0x822b('0x1bb')]+=0x1;_0x539686['state']=0x14;_0x539686[_0x822b('0x6d')]=_0x822b('0x1bc');_0x539686['countagentrejectretry']+=0x1;_0x539686[_0x822b('0xd7')]+=0x1;_0x48885d=_0x3e7b81['dialAgentRejectRetryFrequency'];_0x522bd2=_0x3e7b81[_0x822b('0xec')];ami[_0x822b('0x123')]('custom:agentreject',ut[_0x822b('0x11c')](_0x317ef0,_0x822b('0x1bd')));hopperUtils[_0x822b('0xcb')](_0x539686)[_0x822b('0xa0')](loggerCatch(_0x822b('0x1be')));if(_0x1d4036[_0x822b('0x191')](0x14,_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686[_0x822b('0x128')]>=_0x3e7b81[_0x822b('0x19e')]){_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,_0x822b('0x1bf'));}else{_0x1d4036[_0x822b('0x129')](_0x539686,_0x3ad1af,_0x1352f3,'reason\x2020\x20agentreject');}}break;default:_0x3e7b81[_0x822b('0x138')]+=0x1;_0x539686[_0x822b('0x6c')]=0xc;_0x539686[_0x822b('0x6d')]=_0x574980[_0x822b('0x1a4')];_0x48885d=_0x3e7b81[_0x822b('0x19f')];_0x522bd2=_0x3e7b81['callAdditionalPhoneAfterMin'];hopperUtils[_0x822b('0xcb')](_0x539686)[_0x822b('0xa0')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1d4036[_0x822b('0x191')](_0x574980[_0x822b('0x1a4')],_0x317ef0,_0x3e7b81)&&!_0x248538){if(_0x539686['countbusyretry']+_0x539686[_0x822b('0x192')]+_0x539686['countnoanswerretry']+_0x539686[_0x822b('0x12f')]+_0x539686[_0x822b('0xd6')]+_0x539686['countabandonedretry']+_0x539686[_0x822b('0x122')]+_0x539686['countagentrejectretry']>=_0x3e7b81['dialGlobalMaxRetry']){_0x1d4036[_0x822b('0x129')](_0x539686,_0x3ad1af,_0x1352f3,_0x574980[_0x822b('0x1a4')]);}else{_0x1d4036[_0x822b('0x12c')](_0x539686,_0x3ad1af,_0x1352f3,_0x574980[_0x822b('0x1a4')]);}}}})[_0x822b('0x9d')](function(){if(_0x248538){hopperUtils[_0x822b('0xf2')](_0x539686,_0x48885d,_0x522bd2)[_0x822b('0x9d')](function(){return _0x3ad1af(0x1);});}});});};Dialer[_0x822b('0x18')][_0x822b('0x129')]=function(_0x1d8dd0,_0x3ed4d6,_0x10eef7,_0x365170){var _0x53ecf8=new Final(_0x1d8dd0);_0x53ecf8[_0x822b('0x6c')]=0xf;_0x53ecf8[_0x822b('0x6d')]=_0x822b('0x1c0');this[_0x822b('0x12c')](_0x53ecf8,_0x3ed4d6,_0x10eef7,_0x365170);};Dialer[_0x822b('0x18')][_0x822b('0x12c')]=function(_0x3413dd,_0x262101,_0x17c48b,_0x56322a){hopperUtils[_0x822b('0xcc')](_0x3413dd)[_0x822b('0x9d')](function(){return _0x262101(msgResponse(_0x822b('0x1a2'),_0x822b('0x110'),_0x56322a));})[_0x822b('0xa0')](function(){return _0x17c48b(msgResponse(_0x822b('0x1c1'),_0x822b('0x91'),_0x822b('0x1c2')));});};Dialer[_0x822b('0x18')]['predictive']=function(_0x4f2ebc){var _0x2e10c8=_0x4f2ebc[_0x822b('0x1c3')]/0x64;var _0x210ce7=_0x4f2ebc[_0x822b('0xd2')]/(_0x4f2ebc[_0x822b('0xd2')]+_0x4f2ebc[_0x822b('0xc8')]);var _0x4bcb82=Math[_0x822b('0x1c4')](_0x4f2ebc[_0x822b('0x1c5')]*(_0x4f2ebc[_0x822b('0x1c6')]/0x64));var _0x4cc5fa=Math[_0x822b('0x1c4')](_0x4f2ebc[_0x822b('0x1c5')]*(_0x4f2ebc['predictiveIntervalMinThreshold']/0x64));var _0x5b1790=_0x4f2ebc[_0x822b('0x13e')]+_0x4f2ebc[_0x822b('0x140')];var _0x44ab7b=Math[_0x822b('0x1c7')](_0x4f2ebc['erlangCalls']*_0x4f2ebc['erlangAbandonmentRate']*_0x4f2ebc[_0x822b('0x1c8')]*_0x4f2ebc[_0x822b('0x1c9')]);if(_[_0x822b('0x4e')](_0x4f2ebc[_0x822b('0x24')])){if(!_['isUndefined'](_0x4f2ebc['startPredictive'])){_0x4f2ebc['startPredictive']=undefined;loggerPredictive[_0x822b('0x60')](_0x822b('0x1ca'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4f2ebc[_0x822b('0x5e')])){loggerPredictive[_0x822b('0x60')](_0x822b('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4f2ebc[_0x822b('0x5e')]);_0x4f2ebc[_0x822b('0x5e')]=undefined;}_0x4f2ebc[_0x822b('0x24')]=moment()[_0x822b('0x40')](_0x822b('0xc7'));loggerPredictive['info'](_0x4f2ebc[_0x822b('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x4f2ebc[_0x822b('0x24')]);this[_0x822b('0xb5')](_0x4f2ebc,0x1);}else if(ifInterval(_0x4f2ebc[_0x822b('0x1cb')],_0x4f2ebc[_0x822b('0x24')])){this[_0x822b('0xb5')](_0x4f2ebc,0x1);loggerPredictiveCalls[_0x822b('0x45')](_0x822b('0x1cc'),_0x4f2ebc['startProgressive'],_0x4f2ebc[_0x822b('0x42')]);_0x4f2ebc['erlangCalls']=0x0;_0x4f2ebc[_0x822b('0x1cd')]=0x0;}else if(_0x2e10c8<_0x210ce7&&_0x4f2ebc[_0x822b('0x1ce')]===_0x822b('0x1cf')){clearPredictiveAttributes(_0x4f2ebc);loggerPredictive['info'](_0x822b('0x1d0'),'Dropped\x20calls\x20day',_0x210ce7,_0x822b('0x24'),_0x4f2ebc['name']);}else if(_0x44ab7b<_0x4f2ebc[_0x822b('0x1cd')]&&_0x4f2ebc['dialPredictiveOptimization']===_0x822b('0x1cf')){clearPredictiveAttributes(_0x4f2ebc);loggerPredictive[_0x822b('0x45')](_0x822b('0x1d1'),'Max\x20Drop\x20',_0x44ab7b,'Drop\x20in\x20this\x20interval',_0x4f2ebc[_0x822b('0x1cd')],'startProgressive',_0x4f2ebc[_0x822b('0x42')]);}else if(!ifInterval(_0x4f2ebc[_0x822b('0x1cb')],_0x4f2ebc['startProgressive'])&&_['isUndefined'](_0x4f2ebc[_0x822b('0x23')])&&!_['isUndefined'](_0x4f2ebc[_0x822b('0x24')])){_0x4f2ebc[_0x822b('0x23')]=moment()[_0x822b('0x40')](_0x822b('0xc7'));loggerPredictive[_0x822b('0x45')](_0x4f2ebc[_0x822b('0x42')],_0x822b('0x1d2'),_0x4f2ebc[_0x822b('0x23')]);hopperUtils[_0x822b('0x1d3')](_0x4f2ebc[_0x822b('0x1cb')])[_0x822b('0x9d')](this[_0x822b('0x1d4')](_0x4f2ebc))[_0x822b('0x9d')](mergeDataErlangB(_0x4f2ebc))[_0x822b('0x9d')](this['startMethodPredictive'](_0x4f2ebc))[_0x822b('0xa0')](loggerCatchPredictive(_0x822b('0x1d5'),_0x4f2ebc));}else if(!ifInterval(_0x4f2ebc[_0x822b('0x1cb')],_0x4f2ebc[_0x822b('0x23')])){_0x4f2ebc['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4f2ebc['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x4f2ebc['name'],_0x822b('0x1d6'),_0x4f2ebc[_0x822b('0x23')]);clearInterval(_0x4f2ebc[_0x822b('0x5e')]);_0x4f2ebc[_0x822b('0x5e')]=undefined;hopperUtils[_0x822b('0x1d3')](_0x4f2ebc[_0x822b('0x1cb')])[_0x822b('0x9d')](this[_0x822b('0x1d4')](_0x4f2ebc))[_0x822b('0x9d')](mergeDataErlangB(_0x4f2ebc))[_0x822b('0x9d')](this[_0x822b('0x1d7')](_0x4f2ebc))[_0x822b('0xa0')](loggerCatchPredictive(_0x822b('0x1d8'),_0x4f2ebc));}else if(_0x4f2ebc[_0x822b('0x1c5')]&&_0x5b1790<_0x4f2ebc['predictiveIntervalAvailable']-_0x4cc5fa){clearPredictiveAttributes(_0x4f2ebc);loggerPredictive[_0x822b('0x45')](_0x4f2ebc[_0x822b('0x42')],_0x822b('0x1d9'),_0x5b1790,')\x20are\x20less\x20than\x20threshold\x20(',_0x4f2ebc[_0x822b('0x1c5')],'-',_0x4cc5fa,'=',_0x4f2ebc[_0x822b('0x1c5')]-_0x4cc5fa,')');}else if(_0x4f2ebc[_0x822b('0x1c5')]&&_0x5b1790>_0x4f2ebc['predictiveIntervalAvailable']+_0x4bcb82){clearPredictiveAttributes(_0x4f2ebc);loggerPredictive[_0x822b('0x45')](_0x4f2ebc['name'],_0x822b('0x1d9'),_0x5b1790,_0x822b('0x1da'),_0x4f2ebc[_0x822b('0x1c5')],'+',_0x4bcb82,'=',_0x4f2ebc[_0x822b('0x1c5')]+_0x4bcb82,')');}};Dialer[_0x822b('0x18')][_0x822b('0x1d4')]=function(_0x58896a){var _0x3cf56b=this;return function(_0x3ed782){return new Promise(function(_0x134624,_0x55de08){_[_0x822b('0x5b')](_0x58896a,_0x3ed782[0x0]);if(checkGetDataPredictive(_0x3ed782[0x0])){var _0x3d7f4a=_0x58896a[_0x822b('0x1c5')]=_0x58896a['talking']+_0x58896a[_0x822b('0x13e')];var _0xdb4297=_0x58896a[_0x822b('0x1cb')]*0x3c;var _0x673db9=_0x3ed782[0x0][_0x822b('0x4f')]+_0x3ed782[0x0][_0x822b('0x51')];var _0x18863b=(_0x3ed782[0x0][_0x822b('0x1db')]+_0x3ed782[0x0][_0x822b('0x48')]+_0x3ed782[0x0][_0x822b('0x49')])/_0x3ed782[0x0][_0x822b('0x4d')];_0x58896a[_0x822b('0x1c8')]=_0x18863b>0x0?_0x18863b:0x1;switch(_0x58896a[_0x822b('0x1ce')]){case _0x822b('0x1cf'):var _0x67e890=_0x58896a['dialPredictiveOptimizationPercentage']/0x64;return _0x3cf56b[_0x822b('0x1dc')](_0x3d7f4a,_0xdb4297,_0x673db9,_0x18863b,_0x67e890)['then'](function(_0x5c18db){return _0x134624(_0x5c18db);});case _0x822b('0x1dd'):var _0x3f1fa5=_0x58896a[_0x822b('0x1c3')]/0x64;return _0x3cf56b[_0x822b('0x1de')](_0x3d7f4a,_0xdb4297,_0x673db9,_0x18863b,_0x3f1fa5)[_0x822b('0x9d')](function(_0x752d07){return _0x134624(_0x752d07);});default:return _0x55de08(msgResponse(_0x822b('0x1df'),_0x822b('0x91'),_0x822b('0x1e0')));}}else{return _0x55de08(msgResponse(_0x822b('0x1df'),'Failure',_0x822b('0x1e1')));}});};};Dialer[_0x822b('0x18')]['getDataPredictiveOld']=function(_0x17d180){var _0x4df4b7=this;return function(_0x8a13e4){return new Promise(function(_0x266df0,_0x23c5c4){_['merge'](_0x17d180,_0x8a13e4[0x0]);if(checkGetDataPredictive(_0x8a13e4[0x0])){loggerPredictive['info'](JSON[_0x822b('0x72')](_0x8a13e4[0x0]));if(_0x17d180['dialPredictiveOptimization']===_0x822b('0x1cf')){return _0x4df4b7['getVoiceQueueRtPauses'](_0x17d180['id'])[_0x822b('0x9d')](function(_0x1da728){var _0x63219b=_0x17d180[_0x822b('0x1e2')]-_0x1da728[0x0][_0x822b('0x1e3')];var _0x380df8=_0x17d180[_0x822b('0x1cb')]*0x3c;var _0x47d778=_0x8a13e4[0x0][_0x822b('0x4f')]+_0x8a13e4[0x0][_0x822b('0x51')];var _0x21f140=(_0x8a13e4[0x0][_0x822b('0x1db')]+_0x8a13e4[0x0][_0x822b('0x48')]+_0x8a13e4[0x0][_0x822b('0x49')])/_0x8a13e4[0x0][_0x822b('0x4d')];var _0x3f69a4=_0x17d180[_0x822b('0x1c3')]/0x64;_0x17d180[_0x822b('0x1e4')]=_0x1da728[0x0]['outboundQueuePauses']||0x0;_0x17d180[_0x822b('0x1c8')]=_0x21f140>0x0?_0x21f140:0x1;return _0x4df4b7[_0x822b('0x1dc')](_0x63219b,_0x380df8,_0x47d778,_0x21f140,_0x3f69a4);})[_0x822b('0x9d')](function(_0x542f19){return _0x266df0(_0x542f19);})[_0x822b('0xa0')](function(_0x106b0b){return _0x23c5c4(msgResponse('[CatchErlangB]','Failure',JSON[_0x822b('0x72')](_0x106b0b)));});}if(_0x17d180[_0x822b('0x1ce')]===_0x822b('0x1dd')){return _0x4df4b7[_0x822b('0x152')](_0x17d180['id'])[_0x822b('0x9d')](function(_0x14adcb){var _0x3ba3d8=_0x17d180[_0x822b('0x1e2')]-_0x14adcb[0x0]['outboundQueuePauses'];var _0x380771=_0x17d180['dialPredictiveInterval']*0x3c;var _0x8a3b69=_0x8a13e4[0x0][_0x822b('0x4f')]+_0x8a13e4[0x0][_0x822b('0x51')];var _0x130971=(_0x8a13e4[0x0][_0x822b('0x1db')]+_0x8a13e4[0x0][_0x822b('0x48')]+_0x8a13e4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x8a13e4[0x0]['predictiveIntervalTotalCalls'];var _0x53cd2b=_0x17d180[_0x822b('0x1c3')]/0x64;_0x17d180[_0x822b('0x1e4')]=_0x14adcb[0x0][_0x822b('0x1e3')]||0x0;_0x17d180[_0x822b('0x1c8')]=_0x130971>0x0?_0x130971:0x1;return _0x4df4b7[_0x822b('0x1de')](_0x3ba3d8,_0x380771,_0x8a3b69,_0x130971,_0x53cd2b);})[_0x822b('0x9d')](function(_0x6698c3){return _0x266df0(_0x6698c3);})[_0x822b('0xa0')](function(_0x530949){return _0x23c5c4(msgResponse(_0x822b('0x1e5'),_0x822b('0x91'),JSON[_0x822b('0x72')](_0x530949)));});}}else{return _0x23c5c4(msgResponse(_0x822b('0x1df'),'Failure',_0x822b('0x1e1')));}});};};Dialer[_0x822b('0x18')][_0x822b('0x1d7')]=function(_0x1da6b5){var _0xbe3149=this;return function(){var _0x505558=0x0;var _0x58ed8b=Math[_0x822b('0x1c7')](_0x1da6b5['erlangCallToSecond']*0x3e8);if(_0x58ed8b>0x0){_0x58ed8b=_0x58ed8b<0x64?0x64:_0x58ed8b;loggerPredictive[_0x822b('0x45')](_0x1da6b5[_0x822b('0x42')],_0x822b('0x1e6'),_0x58ed8b,'milliseconds');_0x1da6b5['handlePredictive']=setInterval(function(){_0xbe3149[_0x822b('0x5e')](_0x1da6b5);loggerPredictiveCalls[_0x822b('0x45')](_0x822b('0x1e7'),_0x505558+=0x1);},_0x58ed8b);}else{loggerPredictive[_0x822b('0x45')](_0x1da6b5[_0x822b('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x822b('0x18')][_0x822b('0x1e8')]=function(_0x3e554f,_0x462206){var _0x3b9ee8=this;return function(_0x26a136){if(_[_0x822b('0x44')](_0x26a136)){if(_[_0x822b('0xfb')](_0x462206['UserId'])||!_0x462206[_0x822b('0x1e9')]){if(_0x3e554f[_0x822b('0xb2')]===_0x822b('0xb7')){_0x3e554f[_0x822b('0x70')]=_[_0x822b('0x4e')](_0x3e554f[_0x822b('0x70')])?!![]:_0x3e554f[_0x822b('0x70')];var _0x2769ba=uuid['v4']();_0x3b9ee8[_0x822b('0xf3')][_0x2769ba]=new Action(_0x3e554f,_0x462206,_0x2769ba);loggerBooked[_0x822b('0x45')](_0x822b('0x1ea'),_0x2769ba,'queueStatusComplete:\x20',JSON['stringify'](_0x3e554f[_0x822b('0x70')]),_0x822b('0x1eb'),_0x3e554f['name']);if(_0x3e554f['queueStatusComplete']){_0x3e554f[_0x822b('0x70')]=![];_0x3b9ee8[_0x822b('0x26')][_0x3b9ee8['actions'][_0x2769ba][_0x822b('0xc2')]]=[];ami['Action']({'actionid':_0x2769ba,'action':_0x822b('0x1ec'),'queue':_0x3e554f['name']})['catch'](function(){_0x3b9ee8[_0x822b('0xc4')](_0x3e554f);hopperUtils[_0x822b('0xdd')]({'active':![],'ContactId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba][_0x822b('0xe0')],'ListId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba][_0x822b('0xe1')],'VoiceQueueId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba][_0x822b('0xef')]||undefined,'CampaignId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba]['CampaignId']||undefined})[_0x822b('0xa0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3b9ee8[_0x822b('0xf3')][_0x2769ba];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x822b('0x72')](_0x3e554f[_0x822b('0x70')]),_0x822b('0x1eb'),_0x3e554f[_0x822b('0x42')]);_0x3b9ee8[_0x822b('0xc4')](_0x3e554f);hopperUtils[_0x822b('0xdd')]({'active':![],'ContactId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba][_0x822b('0xe0')],'ListId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba][_0x822b('0xe1')],'VoiceQueueId':_0x3b9ee8[_0x822b('0xf3')][_0x2769ba][_0x822b('0xef')]||undefined,'CampaignId':_0x3b9ee8['actions'][_0x2769ba][_0x822b('0xe2')]||undefined})[_0x822b('0xa0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3b9ee8[_0x822b('0xf3')][_0x2769ba];}}else{return _0x3b9ee8[_0x822b('0x15f')](_0x3e554f,_0x462206);}}else{if(utils['getSeconds'](undefined,_0x462206['scheduledat'])<_0x3e554f['dialRecallMeTimeout']*0x3c){if(_0x462206[_0x822b('0x14b')]&&!_0x462206[_0x822b('0x14b')][_0x822b('0x1ed')]){_0x3b9ee8[_0x822b('0x1c')][_0x822b('0xfe')](_0x462206['id'])[_0x822b('0x107')](function(){_0x3b9ee8['updateOriginated'](_0x3e554f);});}else{hopperUtils[_0x822b('0x1ee')]({'active':![]},_0x462206['id'],0x1)[_0x822b('0x107')](function(){_0x3b9ee8[_0x822b('0xc4')](_0x3e554f);});}}else{_0x3e554f[_0x822b('0x1ef')]+=0x1;_0x3b9ee8[_0x822b('0xc4')](_0x3e554f);if(_0x3e554f[_0x822b('0x1f0')]){hopperUtils[_0x822b('0xdd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x462206[_0x822b('0xe0')],'ListId':_0x462206[_0x822b('0xe1')],'VoiceQueueId':_0x462206[_0x822b('0xef')]||undefined,'CampaignId':_0x462206['CampaignId']||undefined})[_0x822b('0xa0')](loggerCatch(_0x822b('0x1f1')));hopperUtils[_0x822b('0xcb')](createObjHistory(_0x3e554f,_0x462206,utils[_0x822b('0x65')]['QUEUE_RECALL'],0x17,_0x822b('0x1f2')))[_0x822b('0xa0')](loggerCatch(_0x822b('0x1f3')));}else{_0x3b9ee8[_0x822b('0x158')](createObjHistory(_0x3e554f,_0x462206,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x3e554f['outboundBlacklistCallsDay']+=0x1;_0x3b9ee8[_0x822b('0x158')](createObjHistory(_0x3e554f,_0x462206,utils[_0x822b('0x65')]['BLACKLIST'],0xd,_0x822b('0x1f4')),_0x822b('0x1f5'),'[Originate][MoveBlacklist]');throw _0x822b('0x1f6');}};};Dialer[_0x822b('0x18')][_0x822b('0x15e')]=function(_0x42f10c){var _0x2e6030=this;var _0x26512c=_0x42f10c[_0x822b('0x1f7')]-_0x42f10c['originated'];emitCampaignSummary(_0x42f10c);if(_0x26512c>0x0&&_0x42f10c['temp']==0x0){if(_0x26512c>this[_0x822b('0x20')]){_0x26512c=this['maxNumberOriginate'];}_0x42f10c['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x42f10c,_0x26512c)[_0x822b('0x9d')](function(_0x52a65e){_0x42f10c[_0x822b('0x1f8')]=0x0;if(_0x52a65e){if(!utils[_0x822b('0x1f9')](_0x52a65e)){_0x42f10c[_0x822b('0x64')]=utils['CAMPAIGN_STATUS'][_0x822b('0x6a')];logger[_0x822b('0x45')](_0x822b('0x1fa')+_0x42f10c[_0x822b('0x42')]);}else{_0x42f10c['originated']+=_0x52a65e[_0x822b('0x99')];_0x42f10c['message']=utils[_0x822b('0x65')][_0x822b('0x1fb')];for(var _0x1f2775=0x0;_0x1f2775<_0x52a65e[_0x822b('0x99')];_0x1f2775+=0x1){_0x42f10c[_0x822b('0x1fc')]+=0x1;if(_[_0x822b('0xfb')](_0x52a65e[_0x1f2775])||_[_0x822b('0xfb')](_0x52a65e[_0x1f2775]['Contact'])||_['isNil'](_0x52a65e[_0x1f2775][_0x822b('0x163')])){_0x2e6030[_0x822b('0x156')](_0x822b('0x1fd'),_0x42f10c,_0x52a65e[_0x1f2775]);}else{hopperUtils[_0x822b('0x1fe')](_[_0x822b('0x73')](_0x52a65e[_0x1f2775],[_0x822b('0xe2'),_0x822b('0x163')]))[_0x822b('0x9d')](_0x2e6030[_0x822b('0x1e8')](_0x42f10c,_0x52a65e[_0x1f2775]))[_0x822b('0xa0')](_0x2e6030['loggerHandler'](_0x822b('0x1ff'),_0x42f10c));}}}}})[_0x822b('0xa0')](loggerGetContactDialer(_0x822b('0x200'),_0x42f10c,_0x26512c));}};Dialer[_0x822b('0x18')][_0x822b('0xb5')]=function(_0x4ee140,_0x113750){var _0x26cec6=this;var _0x481b6d=[];if(_0x113750<0x1||_0x4ee140['dialMethod']===_0x822b('0xb7')){_0x113750=0x1;}var _0x2a0503=Math[_0x822b('0x1c7')](_0x4ee140[_0x822b('0x13e')]*_0x113750)-_0x4ee140[_0x822b('0x7c')];if(_0x4ee140[_0x822b('0x201')]>0x0){var _0x3e8362=_0x4ee140[_0x822b('0x201')]-_0x4ee140[_0x822b('0x7c')]-_0x4ee140[_0x822b('0x140')]-_0x4ee140['pTalking'];if(_0x2a0503>_0x3e8362){_0x2a0503=_0x3e8362;}}if(_0x2a0503>0x0&&_0x4ee140['temp']==0x0){if(_0x4ee140[_0x822b('0xb2')]===_0x822b('0xb7')){_0x2a0503=0x1;}if(_0x2a0503>this['maxNumberOriginate']){_0x2a0503=this[_0x822b('0x20')];}for(var _0x3244c8 in this[_0x822b('0x1f')]){if(typeof this[_0x822b('0x1f')][_0x3244c8]!=='undefined'){if(this['agents'][_0x3244c8][_0x822b('0x6c')]==='not_inuse'&&this['agents'][_0x3244c8][_0x822b('0x88')]===_0x822b('0x87')){_0x481b6d[_0x822b('0x202')](this[_0x822b('0x1f')][_0x3244c8]['id']);}}}_0x4ee140[_0x822b('0x1f8')]=0x1;hopperUtils[_0x822b('0x203')](_0x4ee140,_0x481b6d,_0x2a0503)[_0x822b('0x9d')](function(_0x641317){_0x4ee140[_0x822b('0x1f8')]=0x0;if(_0x641317){if(!utils[_0x822b('0x1f9')](_0x641317)){hopperUtils['countReScheduled'](_0x4ee140)['then'](sendMessageReschedule(_0x4ee140))[_0x822b('0xa0')](loggerCatch(_0x822b('0x204')));}else{_0x4ee140[_0x822b('0x7c')]+=_0x641317[_0x822b('0x99')];_0x4ee140['message']=_0x4ee140[_0x822b('0xb2')]===_0x822b('0xb7')?utils[_0x822b('0x65')]['ACTIVE']:utils[_0x822b('0x65')][_0x822b('0x1fb')];for(var _0x10e70a=0x0;_0x10e70a<_0x641317['length'];_0x10e70a+=0x1){if(_['isNil'](_0x641317[_0x10e70a])||_[_0x822b('0xfb')](_0x641317[_0x10e70a][_0x822b('0x17a')])||_[_0x822b('0xfb')](_0x641317[_0x10e70a]['phone'])){_0x26cec6[_0x822b('0x156')](_0x822b('0x1fd'),_0x4ee140,_0x641317[_0x10e70a]);}else{hopperUtils[_0x822b('0x205')](_[_0x822b('0x73')](_0x641317[_0x10e70a],[_0x822b('0xef'),_0x822b('0x163')]))['then'](_0x26cec6['checkContactBlack'](_0x4ee140,_0x641317[_0x10e70a]))[_0x822b('0xa0')](_0x26cec6[_0x822b('0x206')](_0x822b('0x1fd'),_0x4ee140));}}}}})['catch'](loggerGetContactDialer(_0x822b('0x207'),_0x4ee140,_0x2a0503));}};Dialer[_0x822b('0x18')][_0x822b('0x5e')]=function(_0x4e2f6d){if(_0x4e2f6d[_0x822b('0x201')]>0x0){var _0x4404a6=_0x4e2f6d['dialLimitQueue']-_0x4e2f6d[_0x822b('0x7c')]-_0x4e2f6d[_0x822b('0x140')];if(_0x4404a6>0x0&&_0x4e2f6d['temp']==0x0){this[_0x822b('0x208')](_0x4e2f6d);}else{loggerPredictiveCalls['info'](_0x822b('0x209'));}}else{this['tryOriginatePredictive'](_0x4e2f6d);}};Dialer[_0x822b('0x18')][_0x822b('0x208')]=function(_0x3a9abd){var _0x9679c7=this;var _0x795874=[];_0x3a9abd[_0x822b('0x7c')]+=0x1;for(var _0x53e452 in this[_0x822b('0x1f')]){if(typeof this[_0x822b('0x1f')][_0x53e452]!==_0x822b('0xab')){if(this[_0x822b('0x1f')][_0x53e452][_0x822b('0x6c')]==='not_inuse'&&this[_0x822b('0x1f')][_0x53e452]['status']===_0x822b('0x87')){_0x795874[_0x822b('0x202')](this[_0x822b('0x1f')][_0x53e452]['id']);}}}_0x3a9abd[_0x822b('0x1f8')]=0x1;return this[_0x822b('0x203')](_0x3a9abd['id'],_0x795874,0x1,_0x3a9abd[_0x822b('0x20a')],_0x3a9abd)['then'](function(_0x2326a2){_0x3a9abd[_0x822b('0x1f8')]=0x1;if(_0x2326a2){if(!utils['checkContactEmpty'](_0x2326a2)){utils['checkContactLowerLimitOriginate'](_0x3a9abd,0x1,0x0);return hopperUtils[_0x822b('0x20b')](_0x3a9abd)[_0x822b('0x9d')](sendMessageReschedule(_0x3a9abd))[_0x822b('0xa0')](loggerCatch(_0x822b('0x204')));}else{_0x3a9abd[_0x822b('0x64')]=utils[_0x822b('0x65')]['RUNNING'];if(_[_0x822b('0xfb')](_0x2326a2[0x0])||_[_0x822b('0xfb')](_0x2326a2[0x0][_0x822b('0x17a')])||_[_0x822b('0xfb')](_0x2326a2[0x0]['phone'])){_0x9679c7['emptyContact'](_0x822b('0x1fd'),_0x3a9abd,_0x2326a2[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x2326a2[0x0],['VoiceQueueId',_0x822b('0x163')]))[_0x822b('0x9d')](_0x9679c7['checkContactBlack'](_0x3a9abd,_0x2326a2[0x0]))[_0x822b('0xa0')](_0x9679c7[_0x822b('0x206')](_0x822b('0x20c'),_0x3a9abd));}}}})[_0x822b('0xa0')](loggerGetContactDialer(_0x822b('0x20d'),_0x3a9abd,0x1));};Dialer[_0x822b('0x18')][_0x822b('0x1dc')]=function(_0x590b97,_0x561cee,_0x435648,_0x37864a,_0x2113b8,_0x4a9cf0){loggerPredictive['info'](_0x822b('0x20e'));loggerPredictive['info'](_0x822b('0x20f'),_0x590b97);loggerPredictive[_0x822b('0x45')](_0x822b('0x210'),_0x561cee);loggerPredictive[_0x822b('0x45')](_0x822b('0x211'),_0x435648);loggerPredictive['info'](_0x822b('0x212'),_0x37864a);loggerPredictive[_0x822b('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2113b8);loggerPredictive[_0x822b('0x45')]('---------------------------');return new Promise(function(_0x178f7e,_0x44d4b9){if(_0x590b97<=0x0||isNaN(_0x590b97)){return _0x44d4b9(msgResponse(_0x822b('0x213'),_0x822b('0xc1'),_0x822b('0x214')+_0x590b97));}if(_0x435648<=0x0||isNaN(_0x435648)){return _0x44d4b9(msgResponse('[abandonmentRate]',_0x822b('0xc1'),_0x822b('0x215')+_0x435648));}if(_0x37864a<=0x0||isNaN(_0x37864a)){return _0x44d4b9(msgResponse(_0x822b('0x213'),'Error','p\x20=\x20'+_0x37864a));}if(_0x561cee<=0x0||isNaN(_0x561cee)){return _0x44d4b9(msgResponse(_0x822b('0x213'),_0x822b('0xc1'),_0x822b('0x216')+_0x561cee));}if(_0x2113b8<=0x0||isNaN(_0x2113b8)){return _0x44d4b9(msgResponse(_0x822b('0x213'),_0x822b('0xc1'),'Amax\x20=\x20'+_0x2113b8));}_0x4a9cf0=_0x4a9cf0||0x0;var _0x3aba13=0x1/_0x435648;var _0x246422=0x0;var _0x36231c=0x0;var _0x55ac7e=0x0;var _0x35b9ec=0x0;for(var _0x4e1b7f=0x0;_0x55ac7e<_0x2113b8;_0x4e1b7f+=0x1){_0x36231c=_0x4e1b7f/_0x561cee;_0x246422=(_0x37864a*_0x36231c+_0x4a9cf0)/_0x3aba13;_0x55ac7e=utils[_0x822b('0x217')](_0x246422,_0x590b97);_0x35b9ec=_0x246422/_0x590b97*(0x1-utils[_0x822b('0x217')](_0x246422,_0x590b97));}return _0x178f7e({'erlangCalls':_0x4e1b7f,'erlangCallToSecond':_0x561cee/_0x4e1b7f,'erlangAbandonmentRate':_0x55ac7e,'erlangBusyFactor':_0x35b9ec});});};Dialer[_0x822b('0x18')]['busyFactor']=function(_0x49fabc,_0x1953da,_0x38a868,_0x3fd1fa,_0x57891f,_0x10a292){loggerPredictive[_0x822b('0x45')](_0x822b('0x218'));loggerPredictive[_0x822b('0x45')](_0x822b('0x20f'),_0x49fabc);loggerPredictive[_0x822b('0x45')](_0x822b('0x210'),_0x1953da);loggerPredictive[_0x822b('0x45')](_0x822b('0x211'),_0x38a868);loggerPredictive[_0x822b('0x45')](_0x822b('0x212'),_0x3fd1fa);loggerPredictive[_0x822b('0x45')](_0x822b('0x219'),_0x57891f);loggerPredictive['info'](_0x822b('0x4c'));return new Promise(function(_0x4e60a2,_0xa2c2ec){if(_0x49fabc<=0x0||isNaN(_0x49fabc)){return _0xa2c2ec(msgResponse(_0x822b('0x21a'),_0x822b('0xc1'),_0x822b('0x214')+_0x49fabc));}if(_0x38a868<=0x0||isNaN(_0x38a868)){return _0xa2c2ec(msgResponse(_0x822b('0x21a'),_0x822b('0xc1'),_0x822b('0x215')+_0x38a868));}if(_0x3fd1fa<=0x0||isNaN(_0x3fd1fa)){return _0xa2c2ec(msgResponse(_0x822b('0x21a'),_0x822b('0xc1'),_0x822b('0x21b')+_0x3fd1fa));}if(_0x1953da<=0x0||isNaN(_0x1953da)){return _0xa2c2ec(msgResponse('[busyFactor]',_0x822b('0xc1'),_0x822b('0x216')+_0x1953da));}if(_0x57891f<=0x0||isNaN(_0x57891f)){return _0xa2c2ec(msgResponse(_0x822b('0x21a'),_0x822b('0xc1'),'Umin\x20=\x20'+_0x57891f));}_0x10a292=_0x10a292||0x0;var _0x1dfe6b=0x1/_0x38a868;var _0x16bd3d=0x0;var _0x2cac3d=0x0;var _0x235d06=0x0;var _0x32a32b=0x0;for(var _0x390008=0x0;_0x32a32b<_0x57891f;_0x390008+=0x1){_0x2cac3d=_0x390008/_0x1953da;_0x16bd3d=(_0x3fd1fa*_0x2cac3d+_0x10a292)/_0x1dfe6b;_0x235d06=utils[_0x822b('0x217')](_0x16bd3d,_0x49fabc);_0x32a32b=_0x16bd3d/_0x49fabc*(0x1-utils[_0x822b('0x217')](_0x16bd3d,_0x49fabc));}return _0x4e60a2({'erlangCalls':_0x390008,'erlangCallToSecond':_0x1953da/_0x390008,'erlangAbandonmentRate':_0x235d06,'erlangBusyFactor':_0x32a32b});});};module[_0x822b('0x21c')]=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 5058a37..c7e6964 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 _0x08f8=['dialCutDigit','prototype','exports','isNil','string','voiceQueue','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','substring'];(function(_0xe43ade,_0x43f1a3){var _0x956560=function(_0x46ae95){while(--_0x46ae95){_0xe43ade['push'](_0xe43ade['shift']());}};_0x956560(++_0x43f1a3);}(_0x08f8,0x13b));var _0x808f=function(_0x4ba770,_0x42ba83){_0x4ba770=_0x4ba770-0x0;var _0x4a6b45=_0x08f8[_0x4ba770];return _0x4a6b45;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x194795,_0x40a69b,_0x592c49){var _0x14a9f3='';if(!_[_0x808f('0x0')](_0x40a69b)&&_0x808f('0x1')===typeof _0x40a69b){_0x14a9f3+=_0x40a69b;}if(!_[_0x808f('0x0')](_0x592c49)&&_0x808f('0x1')===typeof _0x592c49){_0x14a9f3+='\x20'+_0x592c49;}if(_0x14a9f3!==''){return _0x14a9f3;}return _0x194795;}function Action(_0x40e55d,_0x1d5f8a,_0x1e9b83){this[_0x808f('0x2')]=_0x40e55d;this['uniqueid']=_0x1e9b83||undefined;this[_0x808f('0x3')]=checkNameSurname(_0x1d5f8a[_0x808f('0x4')][_0x808f('0x5')],_0x1d5f8a[_0x808f('0x4')]['firstName'],_0x1d5f8a['Contact'][_0x808f('0x6')]);this[_0x808f('0x7')]=_0x1d5f8a[_0x808f('0x5')];this[_0x808f('0x8')]=_0x40e55d[_0x808f('0x3')];this[_0x808f('0x9')]=_0x1d5f8a[_0x808f('0x9')]||![];this['type']=_0x40e55d[_0x808f('0xa')];this['dialQueueTimeout']=_0x40e55d[_0x808f('0xb')]||0x3;this[_0x808f('0xc')]=_0x1d5f8a[_0x808f('0xc')];this['countbusyretry']=_0x1d5f8a['countbusyretry'];this['countcongestionretry']=_0x1d5f8a[_0x808f('0xd')];this['countnoanswerretry']=_0x1d5f8a['countnoanswerretry'];this[_0x808f('0xe')]=_0x1d5f8a[_0x808f('0xe')];this['countdropretry']=_0x1d5f8a[_0x808f('0xf')];this[_0x808f('0x10')]=_0x1d5f8a[_0x808f('0x10')];this['countmachineretry']=_0x1d5f8a[_0x808f('0x11')];this[_0x808f('0x12')]=_0x1d5f8a['countagentrejectretry'];this['ContactId']=_0x1d5f8a['ContactId'];this[_0x808f('0x13')]=_0x1d5f8a[_0x808f('0x13')];this[_0x808f('0x14')]=_0x1d5f8a[_0x808f('0x14')];this[_0x808f('0x15')]=_0x1d5f8a[_0x808f('0x15')];this[_0x808f('0x16')]=_0x1d5f8a[_0x808f('0x16')];this[_0x808f('0x17')]=_0x1d5f8a['id'];this[_0x808f('0x18')]=_0x1d5f8a['Contact'][_0x808f('0x19')]||'';this[_0x808f('0x1a')]=moment()['format'](_0x808f('0x1b'));this['callback']=_0x1d5f8a[_0x808f('0x1c')];this[_0x808f('0x1d')]=_0x1d5f8a[_0x808f('0x1d')];this['callbackat']=_0x1d5f8a[_0x808f('0x1e')];this[_0x808f('0x1f')]=_0x1d5f8a[_0x808f('0x1f')];this['originatecalleridnum']='';this[_0x808f('0x20')]='';}Action['prototype'][_0x808f('0x21')]=function(){return util['format'](_0x808f('0x22'),this[_0x808f('0x3')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x808f('0x7')][_0x808f('0x23')](this[_0x808f('0x2')][_0x808f('0x24')]):this['number']);};Action[_0x808f('0x25')]['getQueue']=function(){return this[_0x808f('0x8')];};module[_0x808f('0x26')]=Action; \ No newline at end of file +var _0x1976=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','number','substring','voiceQueue','getQueue','exports','util','moment','isNil','string','uniqueid','Contact','phone','firstName','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x54daf5,_0x528643){var _0xf70158=function(_0x4902d6){while(--_0x4902d6){_0x54daf5['push'](_0x54daf5['shift']());}};_0xf70158(++_0x528643);}(_0x1976,0x148));var _0x6197=function(_0x4ed539,_0x1f6517){_0x4ed539=_0x4ed539-0x0;var _0x4ba358=_0x1976[_0x4ed539];return _0x4ba358;};'use strict';var util=require(_0x6197('0x0'));var _=require('lodash');var moment=require(_0x6197('0x1'));function checkNameSurname(_0x1a38a6,_0x19cfc6,_0x5a960e){var _0x569bd8='';if(!_[_0x6197('0x2')](_0x19cfc6)&&_0x6197('0x3')===typeof _0x19cfc6){_0x569bd8+=_0x19cfc6;}if(!_[_0x6197('0x2')](_0x5a960e)&&'string'===typeof _0x5a960e){_0x569bd8+='\x20'+_0x5a960e;}if(_0x569bd8!==''){return _0x569bd8;}return _0x1a38a6;}function Action(_0x506162,_0x33c7d1,_0x3bc251){this['voiceQueue']=_0x506162;this[_0x6197('0x4')]=_0x3bc251||undefined;this['name']=checkNameSurname(_0x33c7d1[_0x6197('0x5')][_0x6197('0x6')],_0x33c7d1[_0x6197('0x5')][_0x6197('0x7')],_0x33c7d1['Contact'][_0x6197('0x8')]);this['number']=_0x33c7d1[_0x6197('0x6')];this[_0x6197('0x9')]=_0x506162[_0x6197('0xa')];this['active']=_0x33c7d1[_0x6197('0xb')]||![];this[_0x6197('0xc')]=_0x506162[_0x6197('0xc')];this[_0x6197('0xd')]=_0x506162[_0x6197('0xd')]||0x3;this[_0x6197('0xe')]=_0x33c7d1[_0x6197('0xe')];this[_0x6197('0xf')]=_0x33c7d1[_0x6197('0xf')];this[_0x6197('0x10')]=_0x33c7d1['countcongestionretry'];this['countnoanswerretry']=_0x33c7d1[_0x6197('0x11')];this[_0x6197('0x12')]=_0x33c7d1[_0x6197('0x12')];this[_0x6197('0x13')]=_0x33c7d1[_0x6197('0x13')];this[_0x6197('0x14')]=_0x33c7d1[_0x6197('0x14')];this[_0x6197('0x15')]=_0x33c7d1[_0x6197('0x15')];this[_0x6197('0x16')]=_0x33c7d1[_0x6197('0x16')];this['ContactId']=_0x33c7d1[_0x6197('0x17')];this[_0x6197('0x18')]=_0x33c7d1['ListId'];this[_0x6197('0x19')]=_0x33c7d1[_0x6197('0x19')];this[_0x6197('0x1a')]=_0x33c7d1['VoiceQueueId'];this[_0x6197('0x1b')]=_0x33c7d1[_0x6197('0x1b')];this[_0x6197('0x1c')]=_0x33c7d1['id'];this['ContactFirstName']=_0x33c7d1[_0x6197('0x5')]['firstName']||'';this[_0x6197('0x1d')]=moment()[_0x6197('0x1e')](_0x6197('0x1f'));this[_0x6197('0x20')]=_0x33c7d1[_0x6197('0x20')];this[_0x6197('0x21')]=_0x33c7d1[_0x6197('0x21')];this[_0x6197('0x22')]=_0x33c7d1[_0x6197('0x22')];this[_0x6197('0x23')]=_0x33c7d1[_0x6197('0x23')];this[_0x6197('0x24')]='';this[_0x6197('0x25')]='';}Action[_0x6197('0x26')][_0x6197('0x27')]=function(){return util[_0x6197('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0x6197('0x28')][_0x6197('0x29')](this[_0x6197('0x2a')]['dialCutDigit']):this[_0x6197('0x28')]);};Action[_0x6197('0x26')][_0x6197('0x2b')]=function(){return this[_0x6197('0x9')];};module[_0x6197('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 1c9d63b..c74d59b 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 _0x48cd=['../utils','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x48cd,0x158));var _0xd48c=function(_0x58d4d6,_0x1127fb){_0x58d4d6=_0x58d4d6-0x0;var _0x68c6b0=_0x48cd[_0x58d4d6];return _0x68c6b0;};'use strict';var moment=require('moment');var utils=require(_0xd48c('0x0'));function AgentComplete(_0x247a80,_0x3f8ce4){this[_0xd48c('0x1')]=0x4;this['statedesc']=_0xd48c('0x2');this[_0xd48c('0x3')]=_0x247a80[_0xd48c('0x3')];this[_0xd48c('0x4')]=_0x247a80[_0xd48c('0x4')];this[_0xd48c('0x5')]=_0x247a80[_0xd48c('0x4')]===_0xd48c('0x6')?'queue':_0x247a80['type'];this[_0xd48c('0x7')]=_0x247a80['countbusyretry'];this[_0xd48c('0x8')]=_0x247a80['countcongestionretry'];this[_0xd48c('0x9')]=_0x247a80[_0xd48c('0x9')];this[_0xd48c('0xa')]=_0x247a80[_0xd48c('0x7')]+_0x247a80[_0xd48c('0x8')]+_0x247a80[_0xd48c('0x9')]+_0x247a80[_0xd48c('0xb')]+_0x247a80[_0xd48c('0xc')]+_0x247a80[_0xd48c('0xd')]+_0x247a80[_0xd48c('0xe')]+_0x247a80[_0xd48c('0xf')];this[_0xd48c('0xb')]=_0x247a80[_0xd48c('0xb')];this[_0xd48c('0xc')]=_0x247a80[_0xd48c('0xc')];this[_0xd48c('0xd')]=_0x247a80['countabandonedretry'];this[_0xd48c('0xe')]=_0x247a80[_0xd48c('0xe')];this[_0xd48c('0xf')]=_0x247a80[_0xd48c('0xf')];this['uniqueid']=_0x3f8ce4[_0xd48c('0x10')];this[_0xd48c('0x11')]=_0x247a80['name'];this[_0xd48c('0x12')]=_0x247a80[_0xd48c('0x13')];this[_0xd48c('0x14')]=_0x247a80[_0xd48c('0x14')];this[_0xd48c('0x15')]=_0x247a80[_0xd48c('0x15')];this['answertime']=_0x247a80['answertime'];this[_0xd48c('0x16')]=moment()[_0xd48c('0x17')](_0xd48c('0x18'));this[_0xd48c('0x19')]=utils[_0xd48c('0x1a')](_0x247a80[_0xd48c('0x15')],_0x247a80[_0xd48c('0x14')]);this['holdtime']=utils[_0xd48c('0x1a')](_0x247a80['answertime'],_0x247a80[_0xd48c('0x15')]);this['talktime']=utils[_0xd48c('0x1a')](this['endtime'],_0x247a80['answertime']);this[_0xd48c('0x1b')]=_0x3f8ce4[_0xd48c('0x1b')];this['membername']=_0x3f8ce4[_0xd48c('0x1c')];this['reason']=_0x3f8ce4[_0xd48c('0x1d')];this[_0xd48c('0x1e')]=_0x247a80[_0xd48c('0x1e')];this[_0xd48c('0x1f')]=_0x247a80[_0xd48c('0x1f')];this['callbackat']=_0x247a80[_0xd48c('0x20')];this[_0xd48c('0x21')]=_0x247a80[_0xd48c('0x21')];this[_0xd48c('0x22')]=_0x247a80['ContactId'];this[_0xd48c('0x23')]=_0x247a80['ListId'];this[_0xd48c('0x24')]=_0x247a80[_0xd48c('0x24')];this[_0xd48c('0x25')]=_0x247a80[_0xd48c('0x25')];this[_0xd48c('0x26')]=_0x247a80['CampaignId'];this[_0xd48c('0x27')]=_0x247a80[_0xd48c('0x27')]||'';this['originatecalleridname']=_0x247a80[_0xd48c('0x28')]||'';this['agiafterat']=_0x247a80[_0xd48c('0x29')];}module[_0xd48c('0x2a')]=AgentComplete; \ No newline at end of file +var _0x418a=['countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x524e33,_0x393e22){var _0x58612f=function(_0x2c7f13){while(--_0x2c7f13){_0x524e33['push'](_0x524e33['shift']());}};_0x58612f(++_0x393e22);}(_0x418a,0xc3));var _0xa418=function(_0x37c9ef,_0x8cd045){_0x37c9ef=_0x37c9ef-0x0;var _0x2b0174=_0x418a[_0x37c9ef];return _0x2b0174;};'use strict';var moment=require(_0xa418('0x0'));var utils=require(_0xa418('0x1'));function AgentComplete(_0x4d9f2c,_0x325275){this['state']=0x4;this[_0xa418('0x2')]='Answer';this['scheduledat']=_0x4d9f2c['scheduledat'];this['type']=_0x4d9f2c[_0xa418('0x3')];this[_0xa418('0x4')]=_0x4d9f2c[_0xa418('0x3')]===_0xa418('0x5')?_0xa418('0x6'):_0x4d9f2c[_0xa418('0x3')];this[_0xa418('0x7')]=_0x4d9f2c[_0xa418('0x7')];this[_0xa418('0x8')]=_0x4d9f2c[_0xa418('0x8')];this[_0xa418('0x9')]=_0x4d9f2c[_0xa418('0x9')];this[_0xa418('0xa')]=_0x4d9f2c['countbusyretry']+_0x4d9f2c['countcongestionretry']+_0x4d9f2c[_0xa418('0x9')]+_0x4d9f2c[_0xa418('0xb')]+_0x4d9f2c[_0xa418('0xc')]+_0x4d9f2c[_0xa418('0xd')]+_0x4d9f2c[_0xa418('0xe')]+_0x4d9f2c[_0xa418('0xf')];this[_0xa418('0xb')]=_0x4d9f2c[_0xa418('0xb')];this[_0xa418('0xc')]=_0x4d9f2c[_0xa418('0xc')];this[_0xa418('0xd')]=_0x4d9f2c[_0xa418('0xd')];this[_0xa418('0xe')]=_0x4d9f2c[_0xa418('0xe')];this['countagentrejectretry']=_0x4d9f2c[_0xa418('0xf')];this[_0xa418('0x10')]=_0x325275[_0xa418('0x10')];this['calleridname']=_0x4d9f2c[_0xa418('0x11')];this['calleridnum']=_0x4d9f2c[_0xa418('0x12')];this[_0xa418('0x13')]=_0x4d9f2c[_0xa418('0x13')];this[_0xa418('0x14')]=_0x4d9f2c[_0xa418('0x14')];this['answertime']=_0x4d9f2c[_0xa418('0x15')];this['endtime']=moment()[_0xa418('0x16')](_0xa418('0x17'));this[_0xa418('0x18')]=utils[_0xa418('0x19')](_0x4d9f2c['responsetime'],_0x4d9f2c[_0xa418('0x13')]);this[_0xa418('0x1a')]=utils[_0xa418('0x19')](_0x4d9f2c[_0xa418('0x15')],_0x4d9f2c['responsetime']);this['talktime']=utils['getSeconds'](this['endtime'],_0x4d9f2c[_0xa418('0x15')]);this[_0xa418('0x6')]=_0x325275[_0xa418('0x6')];this[_0xa418('0x1b')]=_0x325275[_0xa418('0x1b')];this[_0xa418('0x1c')]=_0x325275[_0xa418('0x1c')];this[_0xa418('0x1d')]=_0x4d9f2c[_0xa418('0x1d')];this['callbackuniqueid']=_0x4d9f2c[_0xa418('0x1e')];this[_0xa418('0x1f')]=_0x4d9f2c[_0xa418('0x1f')];this[_0xa418('0x20')]=_0x4d9f2c[_0xa418('0x20')];this[_0xa418('0x21')]=_0x4d9f2c[_0xa418('0x21')];this[_0xa418('0x22')]=_0x4d9f2c[_0xa418('0x22')];this[_0xa418('0x23')]=_0x4d9f2c[_0xa418('0x23')];this[_0xa418('0x24')]=_0x4d9f2c[_0xa418('0x24')];this[_0xa418('0x25')]=_0x4d9f2c[_0xa418('0x25')];this['originatecalleridnum']=_0x4d9f2c[_0xa418('0x26')]||'';this['originatecalleridname']=_0x4d9f2c[_0xa418('0x27')]||'';this['agiafterat']=_0x4d9f2c[_0xa418('0x28')];}module[_0xa418('0x29')]=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 1626830..ae5d318 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 _0xa67e=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x1da1d1,_0x2530fc){var _0x1c2bfb=function(_0x2a35d5){while(--_0x2a35d5){_0x1da1d1['push'](_0x1da1d1['shift']());}};_0x1c2bfb(++_0x2530fc);}(_0xa67e,0x1e3));var _0xea67=function(_0xbe5cb8,_0x791122){_0xbe5cb8=_0xbe5cb8-0x0;var _0x21da0a=_0xa67e[_0xbe5cb8];return _0x21da0a;};'use strict';function Final(_0xe3bc8a){this[_0xea67('0x0')]=_0xe3bc8a[_0xea67('0x0')];this['scheduledat']=_0xe3bc8a[_0xea67('0x1')];this[_0xea67('0x2')]=_0xe3bc8a[_0xea67('0x2')];this['campaigntype']=_0xe3bc8a[_0xea67('0x2')]===_0xea67('0x3')?_0xea67('0x4'):_0xe3bc8a[_0xea67('0x2')];this[_0xea67('0x5')]=_0xe3bc8a[_0xea67('0x5')];this[_0xea67('0x6')]=_0xe3bc8a['countcongestionretry'];this[_0xea67('0x7')]=_0xe3bc8a[_0xea67('0x7')];this['countglobal']=_0xe3bc8a[_0xea67('0x5')]+_0xe3bc8a[_0xea67('0x6')]+_0xe3bc8a[_0xea67('0x7')]+_0xe3bc8a[_0xea67('0x8')]+_0xe3bc8a[_0xea67('0x9')]+_0xe3bc8a[_0xea67('0xa')]+_0xe3bc8a[_0xea67('0xb')]+_0xe3bc8a[_0xea67('0xc')];this[_0xea67('0x8')]=_0xe3bc8a[_0xea67('0x8')];this[_0xea67('0x9')]=_0xe3bc8a[_0xea67('0x9')];this[_0xea67('0xa')]=_0xe3bc8a['countabandonedretry'];this[_0xea67('0xb')]=_0xe3bc8a[_0xea67('0xb')];this[_0xea67('0xc')]=_0xe3bc8a[_0xea67('0xc')];this[_0xea67('0x4')]=_0xe3bc8a['queue'];this[_0xea67('0xd')]=_0xe3bc8a[_0xea67('0xd')];this[_0xea67('0xe')]=_0xe3bc8a['calleridnum'];this[_0xea67('0xf')]=_0xe3bc8a[_0xea67('0xf')];this['responsetime']=_0xe3bc8a[_0xea67('0x10')];this['endtime']=_0xe3bc8a[_0xea67('0x10')];this['ringtime']=_0xe3bc8a[_0xea67('0x11')]||0x0;this[_0xea67('0x12')]=_0xe3bc8a['holdtime']||0x0;this['talktime']=_0xe3bc8a[_0xea67('0x13')]||0x0;this[_0xea67('0x14')]=_0xe3bc8a[_0xea67('0x14')];this[_0xea67('0x15')]=_0xe3bc8a[_0xea67('0x15')];this[_0xea67('0x16')]=_0xe3bc8a['callbackat'];this[_0xea67('0x17')]=_0xe3bc8a['recallme'];this[_0xea67('0x18')]=_0xe3bc8a['ContactId'];this[_0xea67('0x19')]=_0xe3bc8a[_0xea67('0x19')];this['UserId']=_0xe3bc8a[_0xea67('0x1a')];this[_0xea67('0x1b')]=_0xe3bc8a['VoiceQueueId'];this[_0xea67('0x1c')]=_0xe3bc8a[_0xea67('0x1c')];this[_0xea67('0x1d')]=_0xe3bc8a['originatecalleridnum']||'';this['originatecalleridname']=_0xe3bc8a[_0xea67('0x1e')]||'';this[_0xea67('0x1f')]=_0xe3bc8a[_0xea67('0x1f')];this[_0xea67('0x20')]=_0xe3bc8a[_0xea67('0x20')];}module[_0xea67('0x21')]=Final; \ No newline at end of file +var _0xba10=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0xa1b74d,_0x614e6f){var _0x56bad4=function(_0x29795c){while(--_0x29795c){_0xa1b74d['push'](_0xa1b74d['shift']());}};_0x56bad4(++_0x614e6f);}(_0xba10,0xf6));var _0x0ba1=function(_0x3a5601,_0x159f90){_0x3a5601=_0x3a5601-0x0;var _0x363732=_0xba10[_0x3a5601];return _0x363732;};'use strict';function Final(_0xc54361){this[_0x0ba1('0x0')]=_0xc54361[_0x0ba1('0x0')];this[_0x0ba1('0x1')]=_0xc54361['scheduledat'];this['type']=_0xc54361['type'];this['campaigntype']=_0xc54361[_0x0ba1('0x2')]===_0x0ba1('0x3')?_0x0ba1('0x4'):_0xc54361[_0x0ba1('0x2')];this[_0x0ba1('0x5')]=_0xc54361['countbusyretry'];this[_0x0ba1('0x6')]=_0xc54361[_0x0ba1('0x6')];this[_0x0ba1('0x7')]=_0xc54361[_0x0ba1('0x7')];this['countglobal']=_0xc54361[_0x0ba1('0x5')]+_0xc54361[_0x0ba1('0x6')]+_0xc54361['countnoanswerretry']+_0xc54361[_0x0ba1('0x8')]+_0xc54361[_0x0ba1('0x9')]+_0xc54361[_0x0ba1('0xa')]+_0xc54361[_0x0ba1('0xb')]+_0xc54361[_0x0ba1('0xc')];this[_0x0ba1('0x8')]=_0xc54361[_0x0ba1('0x8')];this['countdropretry']=_0xc54361[_0x0ba1('0x9')];this[_0x0ba1('0xa')]=_0xc54361['countabandonedretry'];this[_0x0ba1('0xb')]=_0xc54361[_0x0ba1('0xb')];this[_0x0ba1('0xc')]=_0xc54361[_0x0ba1('0xc')];this[_0x0ba1('0x4')]=_0xc54361[_0x0ba1('0x4')];this[_0x0ba1('0xd')]=_0xc54361['calleridname'];this[_0x0ba1('0xe')]=_0xc54361['calleridnum'];this['starttime']=_0xc54361[_0x0ba1('0xf')];this[_0x0ba1('0x10')]=_0xc54361[_0x0ba1('0x10')];this['endtime']=_0xc54361['responsetime'];this[_0x0ba1('0x11')]=_0xc54361[_0x0ba1('0x11')]||0x0;this['holdtime']=_0xc54361[_0x0ba1('0x12')]||0x0;this[_0x0ba1('0x13')]=_0xc54361['talktime']||0x0;this['callback']=_0xc54361['callback'];this[_0x0ba1('0x14')]=_0xc54361[_0x0ba1('0x14')];this[_0x0ba1('0x15')]=_0xc54361[_0x0ba1('0x15')];this[_0x0ba1('0x16')]=_0xc54361[_0x0ba1('0x16')];this[_0x0ba1('0x17')]=_0xc54361[_0x0ba1('0x17')];this[_0x0ba1('0x18')]=_0xc54361['ListId'];this[_0x0ba1('0x19')]=_0xc54361['UserId'];this[_0x0ba1('0x1a')]=_0xc54361[_0x0ba1('0x1a')];this[_0x0ba1('0x1b')]=_0xc54361[_0x0ba1('0x1b')];this[_0x0ba1('0x1c')]=_0xc54361[_0x0ba1('0x1c')]||'';this[_0x0ba1('0x1d')]=_0xc54361[_0x0ba1('0x1d')]||'';this[_0x0ba1('0x1e')]=_0xc54361[_0x0ba1('0x1e')];this[_0x0ba1('0x1f')]=_0xc54361[_0x0ba1('0x1f')];}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 ba369ab..dba336c 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 _0xe548=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','endtime','membername','IVR','reason','cause-txt','callback'];(function(_0x9e6237,_0x21fefa){var _0x5e1124=function(_0x3b5437){while(--_0x3b5437){_0x9e6237['push'](_0x9e6237['shift']());}};_0x5e1124(++_0x21fefa);}(_0xe548,0xef));var _0x8e54=function(_0x4da3b6,_0x233aff){_0x4da3b6=_0x4da3b6-0x0;var _0x574d38=_0xe548[_0x4da3b6];return _0x574d38;};'use strict';var moment=require(_0x8e54('0x0'));var utils=require(_0x8e54('0x1'));function Hangup(_0x1f4ca0,_0x2e5cab){this[_0x8e54('0x2')]=0x4;this[_0x8e54('0x3')]=_0x8e54('0x4');this['scheduledat']=_0x1f4ca0[_0x8e54('0x5')];this[_0x8e54('0x6')]=_0x1f4ca0['type'];this['campaigntype']=_0x1f4ca0[_0x8e54('0x6')]===_0x8e54('0x7')?_0x8e54('0x8'):_0x1f4ca0[_0x8e54('0x6')];this[_0x8e54('0x9')]=_0x1f4ca0[_0x8e54('0x9')]||![];this[_0x8e54('0xa')]=_0x1f4ca0['countbusyretry'];this['countcongestionretry']=_0x1f4ca0['countcongestionretry'];this[_0x8e54('0xb')]=_0x1f4ca0[_0x8e54('0xb')];this[_0x8e54('0xc')]=_0x1f4ca0['countbusyretry']+_0x1f4ca0[_0x8e54('0xd')]+_0x1f4ca0[_0x8e54('0xb')]+_0x1f4ca0[_0x8e54('0xe')]+_0x1f4ca0['countdropretry']+_0x1f4ca0[_0x8e54('0xf')]+_0x1f4ca0['countmachineretry']+_0x1f4ca0[_0x8e54('0x10')];this[_0x8e54('0xe')]=_0x1f4ca0[_0x8e54('0xe')];this[_0x8e54('0x11')]=_0x1f4ca0[_0x8e54('0x11')];this['countabandonedretry']=_0x1f4ca0['countabandonedretry'];this[_0x8e54('0x12')]=_0x1f4ca0['countmachineretry'];this[_0x8e54('0x10')]=_0x1f4ca0['countagentrejectretry'];this['uniqueid']=_0x2e5cab['uniqueid'];this[_0x8e54('0x13')]=_0x1f4ca0[_0x8e54('0x14')];this[_0x8e54('0x15')]=_0x1f4ca0[_0x8e54('0x16')];this[_0x8e54('0x17')]=_0x1f4ca0['starttime'];this['responsetime']=_0x1f4ca0[_0x8e54('0x18')];this['endtime']=moment()[_0x8e54('0x19')](_0x8e54('0x1a'));this[_0x8e54('0x1b')]=utils['getSeconds'](_0x1f4ca0[_0x8e54('0x18')],_0x1f4ca0['starttime']);this[_0x8e54('0x1c')]=0x0;this[_0x8e54('0x1d')]=utils[_0x8e54('0x1e')](this[_0x8e54('0x1f')],_0x1f4ca0[_0x8e54('0x18')]);this['queue']=_0x1f4ca0[_0x8e54('0x8')];this[_0x8e54('0x20')]=_0x8e54('0x21');this[_0x8e54('0x22')]=_0x2e5cab[_0x8e54('0x23')];this[_0x8e54('0x24')]=_0x1f4ca0[_0x8e54('0x24')];this[_0x8e54('0x25')]=_0x1f4ca0[_0x8e54('0x25')];this['callbackat']=_0x1f4ca0[_0x8e54('0x26')];this['recallme']=_0x1f4ca0[_0x8e54('0x27')];this[_0x8e54('0x28')]=_0x1f4ca0['ContactId'];this[_0x8e54('0x29')]=_0x1f4ca0[_0x8e54('0x29')];this['UserId']=_0x1f4ca0[_0x8e54('0x2a')];this[_0x8e54('0x2b')]=_0x1f4ca0[_0x8e54('0x2b')];this[_0x8e54('0x2c')]=_0x1f4ca0[_0x8e54('0x2c')];}module[_0x8e54('0x2d')]=Hangup; \ No newline at end of file +var _0x4e07=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x5ad584,_0x26e6f3){var _0x508bb1=function(_0x339d09){while(--_0x339d09){_0x5ad584['push'](_0x5ad584['shift']());}};_0x508bb1(++_0x26e6f3);}(_0x4e07,0x12c));var _0x74e0=function(_0xc48c21,_0x13dbe1){_0xc48c21=_0xc48c21-0x0;var _0x34cc69=_0x4e07[_0xc48c21];return _0x34cc69;};'use strict';var moment=require(_0x74e0('0x0'));var utils=require('../utils');function Hangup(_0x402793,_0x446f8a){this[_0x74e0('0x1')]=0x4;this[_0x74e0('0x2')]=_0x74e0('0x3');this[_0x74e0('0x4')]=_0x402793[_0x74e0('0x4')];this[_0x74e0('0x5')]=_0x402793[_0x74e0('0x5')];this[_0x74e0('0x6')]=_0x402793['type']===_0x74e0('0x7')?'queue':_0x402793[_0x74e0('0x5')];this['amd']=_0x402793[_0x74e0('0x8')]||![];this['countbusyretry']=_0x402793[_0x74e0('0x9')];this[_0x74e0('0xa')]=_0x402793['countcongestionretry'];this[_0x74e0('0xb')]=_0x402793[_0x74e0('0xb')];this[_0x74e0('0xc')]=_0x402793[_0x74e0('0x9')]+_0x402793[_0x74e0('0xa')]+_0x402793[_0x74e0('0xb')]+_0x402793['countnosuchnumberretry']+_0x402793[_0x74e0('0xd')]+_0x402793[_0x74e0('0xe')]+_0x402793[_0x74e0('0xf')]+_0x402793['countagentrejectretry'];this[_0x74e0('0x10')]=_0x402793[_0x74e0('0x10')];this[_0x74e0('0xd')]=_0x402793[_0x74e0('0xd')];this[_0x74e0('0xe')]=_0x402793[_0x74e0('0xe')];this[_0x74e0('0xf')]=_0x402793[_0x74e0('0xf')];this[_0x74e0('0x11')]=_0x402793['countagentrejectretry'];this[_0x74e0('0x12')]=_0x446f8a[_0x74e0('0x12')];this[_0x74e0('0x13')]=_0x402793['name'];this[_0x74e0('0x14')]=_0x402793[_0x74e0('0x15')];this[_0x74e0('0x16')]=_0x402793[_0x74e0('0x16')];this[_0x74e0('0x17')]=_0x402793[_0x74e0('0x17')];this['endtime']=moment()[_0x74e0('0x18')](_0x74e0('0x19'));this[_0x74e0('0x1a')]=utils[_0x74e0('0x1b')](_0x402793['responsetime'],_0x402793[_0x74e0('0x16')]);this[_0x74e0('0x1c')]=0x0;this[_0x74e0('0x1d')]=utils[_0x74e0('0x1b')](this[_0x74e0('0x1e')],_0x402793[_0x74e0('0x17')]);this[_0x74e0('0x1f')]=_0x402793[_0x74e0('0x1f')];this[_0x74e0('0x20')]=_0x74e0('0x21');this[_0x74e0('0x22')]=_0x446f8a['cause-txt'];this[_0x74e0('0x23')]=_0x402793[_0x74e0('0x23')];this[_0x74e0('0x24')]=_0x402793['callbackuniqueid'];this[_0x74e0('0x25')]=_0x402793[_0x74e0('0x25')];this[_0x74e0('0x26')]=_0x402793['recallme'];this[_0x74e0('0x27')]=_0x402793['ContactId'];this[_0x74e0('0x28')]=_0x402793[_0x74e0('0x28')];this[_0x74e0('0x29')]=_0x402793[_0x74e0('0x29')];this[_0x74e0('0x2a')]=_0x402793[_0x74e0('0x2a')];this[_0x74e0('0x2b')]=_0x402793[_0x74e0('0x2b')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 4ff8bad..235f935 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 _0x42d5=['ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId'];(function(_0x4d919f,_0x5b0e3b){var _0x521be6=function(_0x283ce3){while(--_0x283ce3){_0x4d919f['push'](_0x4d919f['shift']());}};_0x521be6(++_0x5b0e3b);}(_0x42d5,0x103));var _0x542d=function(_0x54a756,_0x5488ac){_0x54a756=_0x54a756-0x0;var _0xafce1d=_0x42d5[_0x54a756];return _0xafce1d;};'use strict';var utils=require('../utils');function History(_0xdcf01d){this[_0x542d('0x0')]=_0xdcf01d[_0x542d('0x0')];this[_0x542d('0x1')]=_0xdcf01d['scheduledat']||undefined;this['type']=_0xdcf01d[_0x542d('0x2')];this[_0x542d('0x3')]=_0xdcf01d['type']===_0x542d('0x4')?_0x542d('0x5'):_0xdcf01d[_0x542d('0x2')];this['countbusyretry']=_0xdcf01d[_0x542d('0x6')];this['countcongestionretry']=_0xdcf01d[_0x542d('0x7')];this[_0x542d('0x8')]=_0xdcf01d[_0x542d('0x8')];this[_0x542d('0x9')]=_0xdcf01d[_0x542d('0x6')]+_0xdcf01d['countcongestionretry']+_0xdcf01d[_0x542d('0x8')]+_0xdcf01d[_0x542d('0xa')]+_0xdcf01d[_0x542d('0xb')]+_0xdcf01d[_0x542d('0xc')]+_0xdcf01d[_0x542d('0xd')]+_0xdcf01d[_0x542d('0xe')];this['countnosuchnumberretry']=_0xdcf01d[_0x542d('0xa')];this[_0x542d('0xb')]=_0xdcf01d[_0x542d('0xb')];this['countabandonedretry']=_0xdcf01d[_0x542d('0xc')];this['countmachineretry']=_0xdcf01d[_0x542d('0xd')];this[_0x542d('0xe')]=_0xdcf01d[_0x542d('0xe')];this[_0x542d('0x5')]=_0xdcf01d[_0x542d('0x5')];this[_0x542d('0xf')]=_0xdcf01d[_0x542d('0x10')];this[_0x542d('0x11')]=_0xdcf01d[_0x542d('0x12')];this[_0x542d('0x13')]=_0xdcf01d[_0x542d('0x13')];this[_0x542d('0x14')]=_0xdcf01d[_0x542d('0x14')];this[_0x542d('0x15')]=_0xdcf01d[_0x542d('0x14')];this['ringtime']=utils[_0x542d('0x16')](_0xdcf01d['responsetime'],_0xdcf01d[_0x542d('0x13')]);this[_0x542d('0x17')]=0x0;this[_0x542d('0x18')]=0x0;this[_0x542d('0x19')]=_0xdcf01d[_0x542d('0x19')];this['callbackuniqueid']=_0xdcf01d[_0x542d('0x1a')];this[_0x542d('0x1b')]=_0xdcf01d[_0x542d('0x1b')];this['recallme']=_0xdcf01d['recallme'];this[_0x542d('0x1c')]=_0xdcf01d['ContactId'];this[_0x542d('0x1d')]=_0xdcf01d[_0x542d('0x1d')];this[_0x542d('0x1e')]=_0xdcf01d['UserId'];this['VoiceQueueId']=_0xdcf01d['VoiceQueueId'];this[_0x542d('0x1f')]=_0xdcf01d[_0x542d('0x1f')];this[_0x542d('0x20')]=_0xdcf01d[_0x542d('0x20')]||'';this[_0x542d('0x21')]=_0xdcf01d[_0x542d('0x21')]||'';this[_0x542d('0x22')]=_0xdcf01d['state'];this[_0x542d('0x23')]=_0xdcf01d['statedesc'];}module['exports']=History; \ No newline at end of file +var _0xf8c7=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','name','number','starttime','responsetime','ringtime','holdtime','callback'];(function(_0x295279,_0x4996a4){var _0x3614ea=function(_0x1a3fd9){while(--_0x1a3fd9){_0x295279['push'](_0x295279['shift']());}};_0x3614ea(++_0x4996a4);}(_0xf8c7,0x72));var _0x7f8c=function(_0x10ce64,_0x56ec21){_0x10ce64=_0x10ce64-0x0;var _0x204214=_0xf8c7[_0x10ce64];return _0x204214;};'use strict';var utils=require(_0x7f8c('0x0'));function History(_0x3e0f59){this['uniqueid']=_0x3e0f59[_0x7f8c('0x1')];this[_0x7f8c('0x2')]=_0x3e0f59['scheduledat']||undefined;this[_0x7f8c('0x3')]=_0x3e0f59[_0x7f8c('0x3')];this[_0x7f8c('0x4')]=_0x3e0f59[_0x7f8c('0x3')]===_0x7f8c('0x5')?'queue':_0x3e0f59[_0x7f8c('0x3')];this['countbusyretry']=_0x3e0f59[_0x7f8c('0x6')];this[_0x7f8c('0x7')]=_0x3e0f59['countcongestionretry'];this[_0x7f8c('0x8')]=_0x3e0f59[_0x7f8c('0x8')];this['countglobal']=_0x3e0f59[_0x7f8c('0x6')]+_0x3e0f59[_0x7f8c('0x7')]+_0x3e0f59[_0x7f8c('0x8')]+_0x3e0f59[_0x7f8c('0x9')]+_0x3e0f59['countdropretry']+_0x3e0f59['countabandonedretry']+_0x3e0f59[_0x7f8c('0xa')]+_0x3e0f59[_0x7f8c('0xb')];this[_0x7f8c('0x9')]=_0x3e0f59[_0x7f8c('0x9')];this[_0x7f8c('0xc')]=_0x3e0f59[_0x7f8c('0xc')];this[_0x7f8c('0xd')]=_0x3e0f59['countabandonedretry'];this[_0x7f8c('0xa')]=_0x3e0f59[_0x7f8c('0xa')];this[_0x7f8c('0xb')]=_0x3e0f59[_0x7f8c('0xb')];this[_0x7f8c('0xe')]=_0x3e0f59['queue'];this['calleridname']=_0x3e0f59[_0x7f8c('0xf')];this['calleridnum']=_0x3e0f59[_0x7f8c('0x10')];this[_0x7f8c('0x11')]=_0x3e0f59[_0x7f8c('0x11')];this['responsetime']=_0x3e0f59[_0x7f8c('0x12')];this['endtime']=_0x3e0f59['responsetime'];this[_0x7f8c('0x13')]=utils['getSeconds'](_0x3e0f59['responsetime'],_0x3e0f59[_0x7f8c('0x11')]);this[_0x7f8c('0x14')]=0x0;this['talktime']=0x0;this[_0x7f8c('0x15')]=_0x3e0f59[_0x7f8c('0x15')];this[_0x7f8c('0x16')]=_0x3e0f59[_0x7f8c('0x16')];this[_0x7f8c('0x17')]=_0x3e0f59['callbackat'];this[_0x7f8c('0x18')]=_0x3e0f59[_0x7f8c('0x18')];this[_0x7f8c('0x19')]=_0x3e0f59[_0x7f8c('0x19')];this[_0x7f8c('0x1a')]=_0x3e0f59[_0x7f8c('0x1a')];this[_0x7f8c('0x1b')]=_0x3e0f59[_0x7f8c('0x1b')];this[_0x7f8c('0x1c')]=_0x3e0f59[_0x7f8c('0x1c')];this[_0x7f8c('0x1d')]=_0x3e0f59['CampaignId'];this[_0x7f8c('0x1e')]=_0x3e0f59[_0x7f8c('0x1e')]||'';this['originatecalleridname']=_0x3e0f59[_0x7f8c('0x1f')]||'';this[_0x7f8c('0x20')]=_0x3e0f59[_0x7f8c('0x20')];this[_0x7f8c('0x21')]=_0x3e0f59['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index cd2cd85..44c0f1b 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 _0x5288=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x5288,0x112));var _0x8528=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5288[_0x17d9e3];return _0x14192d;};'use strict';var utils=require(_0x8528('0x0'));function QueueCallerAbandon(_0x5275e6,_0x2192a9){this[_0x8528('0x1')]=_0x5275e6[_0x8528('0x1')];this[_0x8528('0x2')]=_0x5275e6[_0x8528('0x2')];this[_0x8528('0x3')]=_0x5275e6[_0x8528('0x2')]==='outbound'?_0x8528('0x4'):_0x5275e6['type'];this[_0x8528('0x5')]=_0x5275e6[_0x8528('0x5')];this['countcongestionretry']=_0x5275e6['countcongestionretry'];this[_0x8528('0x6')]=_0x5275e6[_0x8528('0x6')];this[_0x8528('0x7')]=_0x5275e6[_0x8528('0x5')]+_0x5275e6[_0x8528('0x8')]+_0x5275e6[_0x8528('0x6')]+_0x5275e6[_0x8528('0x9')]+_0x5275e6['countdropretry']+_0x5275e6['countabandonedretry']+_0x5275e6[_0x8528('0xa')]+_0x5275e6[_0x8528('0xb')];this[_0x8528('0x9')]=_0x5275e6[_0x8528('0x9')];this['countdropretry']=_0x5275e6['countdropretry'];this[_0x8528('0xc')]=_0x5275e6[_0x8528('0xc')];this[_0x8528('0xa')]=_0x5275e6[_0x8528('0xa')];this[_0x8528('0xb')]=_0x5275e6[_0x8528('0xb')];this[_0x8528('0xd')]=_0x2192a9['uniqueid'];this[_0x8528('0xe')]=_0x5275e6[_0x8528('0xf')];this[_0x8528('0x10')]=_0x5275e6[_0x8528('0x11')];this[_0x8528('0x12')]=_0x5275e6[_0x8528('0x12')];this[_0x8528('0x13')]=_0x5275e6[_0x8528('0x13')];this[_0x8528('0x14')]=_0x5275e6['droptime'];this['dropreason']=_0x5275e6[_0x8528('0x15')];this[_0x8528('0x16')]=this[_0x8528('0x14')];this[_0x8528('0x17')]=utils[_0x8528('0x18')](_0x5275e6['responsetime'],_0x5275e6[_0x8528('0x12')]);this['holdtime']=utils[_0x8528('0x18')](this['droptime'],_0x5275e6[_0x8528('0x13')]);this[_0x8528('0x19')]=0x0;this[_0x8528('0x4')]=_0x2192a9[_0x8528('0x4')];this['membername']=_0x2192a9['connectedlinename'];this[_0x8528('0x1a')]=_0x2192a9[_0x8528('0x1a')];this[_0x8528('0x1b')]=_0x5275e6['callback'];this[_0x8528('0x1c')]=_0x5275e6['callbackuniqueid'];this[_0x8528('0x1d')]=_0x5275e6[_0x8528('0x1d')];this[_0x8528('0x1e')]=_0x5275e6[_0x8528('0x1e')];this[_0x8528('0x1f')]=_0x5275e6[_0x8528('0x1f')];this[_0x8528('0x20')]=_0x5275e6[_0x8528('0x20')];this[_0x8528('0x21')]=_0x5275e6['UserId'];this['VoiceQueueId']=_0x5275e6[_0x8528('0x22')];this['CampaignId']=_0x5275e6['CampaignId'];this[_0x8528('0x23')]=_0x5275e6[_0x8528('0x23')]||'';this[_0x8528('0x24')]=_0x5275e6[_0x8528('0x24')]||'';this[_0x8528('0x25')]=_0x5275e6[_0x8528('0x25')];this[_0x8528('0x26')]=_0x5275e6[_0x8528('0x26')];this[_0x8528('0x27')]=_0x5275e6['statedesc'];}module[_0x8528('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x569c=['callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callback'];(function(_0x3d781b,_0x433d58){var _0x36ea7f=function(_0x59bd5e){while(--_0x59bd5e){_0x3d781b['push'](_0x3d781b['shift']());}};_0x36ea7f(++_0x433d58);}(_0x569c,0x1a6));var _0xc569=function(_0x2dda86,_0x27f6f2){_0x2dda86=_0x2dda86-0x0;var _0x240b52=_0x569c[_0x2dda86];return _0x240b52;};'use strict';var utils=require(_0xc569('0x0'));function QueueCallerAbandon(_0x533846,_0x107a32){this['scheduledat']=_0x533846[_0xc569('0x1')];this[_0xc569('0x2')]=_0x533846['type'];this[_0xc569('0x3')]=_0x533846[_0xc569('0x2')]==='outbound'?_0xc569('0x4'):_0x533846[_0xc569('0x2')];this[_0xc569('0x5')]=_0x533846[_0xc569('0x5')];this[_0xc569('0x6')]=_0x533846[_0xc569('0x6')];this[_0xc569('0x7')]=_0x533846[_0xc569('0x7')];this[_0xc569('0x8')]=_0x533846[_0xc569('0x5')]+_0x533846[_0xc569('0x6')]+_0x533846['countnoanswerretry']+_0x533846['countnosuchnumberretry']+_0x533846['countdropretry']+_0x533846[_0xc569('0x9')]+_0x533846[_0xc569('0xa')]+_0x533846[_0xc569('0xb')];this[_0xc569('0xc')]=_0x533846[_0xc569('0xc')];this[_0xc569('0xd')]=_0x533846['countdropretry'];this[_0xc569('0x9')]=_0x533846[_0xc569('0x9')];this[_0xc569('0xa')]=_0x533846[_0xc569('0xa')];this['countagentrejectretry']=_0x533846[_0xc569('0xb')];this[_0xc569('0xe')]=_0x107a32[_0xc569('0xe')];this[_0xc569('0xf')]=_0x533846['name'];this['calleridnum']=_0x533846[_0xc569('0x10')];this[_0xc569('0x11')]=_0x533846[_0xc569('0x11')];this[_0xc569('0x12')]=_0x533846[_0xc569('0x12')];this['droptime']=_0x533846[_0xc569('0x13')];this[_0xc569('0x14')]=_0x533846[_0xc569('0x14')];this[_0xc569('0x15')]=this[_0xc569('0x13')];this[_0xc569('0x16')]=utils[_0xc569('0x17')](_0x533846[_0xc569('0x12')],_0x533846['starttime']);this[_0xc569('0x18')]=utils[_0xc569('0x17')](this['droptime'],_0x533846[_0xc569('0x12')]);this['talktime']=0x0;this['queue']=_0x107a32[_0xc569('0x4')];this[_0xc569('0x19')]=_0x107a32[_0xc569('0x1a')];this['reason']=_0x107a32[_0xc569('0x1b')];this[_0xc569('0x1c')]=_0x533846['callback'];this['callbackuniqueid']=_0x533846['callbackuniqueid'];this[_0xc569('0x1d')]=_0x533846['callbackat'];this[_0xc569('0x1e')]=_0x533846[_0xc569('0x1e')];this[_0xc569('0x1f')]=_0x533846['ContactId'];this['ListId']=_0x533846[_0xc569('0x20')];this['UserId']=_0x533846['UserId'];this[_0xc569('0x21')]=_0x533846['VoiceQueueId'];this[_0xc569('0x22')]=_0x533846['CampaignId'];this[_0xc569('0x23')]=_0x533846['originatecalleridnum']||'';this[_0xc569('0x24')]=_0x533846[_0xc569('0x24')]||'';this[_0xc569('0x25')]=_0x533846[_0xc569('0x25')];this[_0xc569('0x26')]=_0x533846[_0xc569('0x26')];this[_0xc569('0x27')]=_0x533846['statedesc'];}module[_0xc569('0x28')]=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 ce0f89b..5e2d797 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 _0x68b3=['../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper'];(function(_0x4129d8,_0x5f19e1){var _0x1f6d2c=function(_0x381ee1){while(--_0x381ee1){_0x4129d8['push'](_0x4129d8['shift']());}};_0x1f6d2c(++_0x5f19e1);}(_0x68b3,0x1d8));var _0x368b=function(_0x15b313,_0x558bf0){_0x15b313=_0x15b313-0x0;var _0x1d5e28=_0x68b3[_0x15b313];return _0x1d5e28;};'use strict';var util=require(_0x368b('0x0'));var logger=require(_0x368b('0x1'))(_0x368b('0x2'));var cmHopper=require(_0x368b('0x3'));var cmHopperAdditionalPhone=require(_0x368b('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x368b('0x5'));function inspectError(_0x3325ac){return util[_0x368b('0x6')](_0x3325ac,{'showHidden':![],'depth':null});}function getContactDialer(_0x404282,_0x5d68cb,_0x12eb8f){return cmHopper[_0x368b('0x7')](_0x404282['id'],_0x5d68cb,_0x12eb8f,_0x404282[_0x368b('0x8')])[_0x368b('0x9')](function(_0x4406c8){_0x404282[_0x368b('0xa')]=0x0;logger[_0x368b('0xb')](_0x368b('0xc'),inspectError(_0x4406c8));});}exports[_0x368b('0x7')]=getContactDialer;function getContactDialerIvr(_0x1f64d8,_0x2a7b9f){return cmHopper['getContactDialerIvr'](_0x1f64d8['id'],_0x2a7b9f,_0x1f64d8[_0x368b('0x8')])[_0x368b('0x9')](function(_0x34a110){_0x1f64d8['temp']=0x0;logger[_0x368b('0xb')](_0x368b('0xd'),inspectError(_0x34a110));});}exports[_0x368b('0xe')]=getContactDialerIvr;function countReScheduled(_0x5924a6){return cmHopper[_0x368b('0xf')](_0x5924a6)[_0x368b('0x9')](function(_0x514dc7){logger[_0x368b('0xb')](_0x368b('0x10'),inspectError(_0x514dc7));});}exports[_0x368b('0xf')]=countReScheduled;function rescheduleContact(_0x4015fe){return cmHopper[_0x368b('0x11')](_0x4015fe)['catch'](function(_0x2b326c){logger[_0x368b('0xb')]('[rescheduleContact]',inspectError(_0x2b326c));});}exports[_0x368b('0x11')]=rescheduleContact;function unlockContact(_0x2aabb9,_0x30c245,_0x515350){return cmHopper[_0x368b('0x12')](_0x2aabb9,_0x30c245,_0x515350)[_0x368b('0x9')](function(_0x1f1029){logger['error'](_0x368b('0x13'),inspectError(_0x1f1029));});}exports[_0x368b('0x12')]=unlockContact;function moveContactManagedDialer(_0x1c2956){return cmHopper['moveContactManagedDialer'](_0x1c2956)['catch'](function(_0x3e2e9f){logger[_0x368b('0xb')](_0x368b('0x14'),inspectError(_0x3e2e9f));});}exports[_0x368b('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x1a4f20){return cmHopperBlack['checkIsBlackList'](_0x1a4f20)[_0x368b('0x9')](function(_0x44cfe6){logger[_0x368b('0xb')](_0x368b('0x16'),inspectError(_0x44cfe6));});}exports[_0x368b('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x26b206){return cmHopperBlack[_0x368b('0x18')](_0x26b206)[_0x368b('0x9')](function(_0x508e48){logger[_0x368b('0xb')](_0x368b('0x19'),inspectError(_0x508e48));});}exports[_0x368b('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xc0f7af,_0x286853,_0x4c2fca){return cmHopperAdditionalPhone[_0x368b('0x1a')](_0xc0f7af,_0x286853,_0x4c2fca)[_0x368b('0x9')](function(_0x3a22bd){logger[_0x368b('0xb')](_0x368b('0x1b'),inspectError(_0x3a22bd));});}exports[_0x368b('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x430e16,_0x11ea2d,_0x3123c1){return cmHopperAdditionalPhone[_0x368b('0x1c')](_0x430e16,_0x11ea2d,_0x3123c1)[_0x368b('0x9')](function(_0x344d8a){logger[_0x368b('0xb')](_0x368b('0x1d'),inspectError(_0x344d8a));});}exports[_0x368b('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x23a83a){return cmHopperHistory[_0x368b('0x1e')](_0x23a83a)[_0x368b('0x9')](function(_0x39ef94){logger[_0x368b('0xb')](_0x368b('0x1f'),inspectError(_0x39ef94));});}exports[_0x368b('0x1e')]=avgHandleTime;function createHistory(_0x107d2f){return cmHopperHistory[_0x368b('0x20')](_0x107d2f)['catch'](function(_0x4af77a){logger[_0x368b('0xb')](_0x368b('0x21'),inspectError(_0x4af77a));});}exports[_0x368b('0x20')]=createHistory; \ No newline at end of file +var _0xc6ac=['../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','catch','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone'];(function(_0x43b169,_0x553359){var _0x1a9140=function(_0x5e7e77){while(--_0x5e7e77){_0x43b169['push'](_0x43b169['shift']());}};_0x1a9140(++_0x553359);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x24f09e,_0x1c102e){_0x24f09e=_0x24f09e-0x0;var _0xece0ce=_0xc6ac[_0x24f09e];return _0xece0ce;};'use strict';var util=require(_0xcc6a('0x0'));var logger=require(_0xcc6a('0x1'))(_0xcc6a('0x2'));var cmHopper=require(_0xcc6a('0x3'));var cmHopperAdditionalPhone=require(_0xcc6a('0x4'));var cmHopperBlack=require(_0xcc6a('0x5'));var cmHopperHistory=require(_0xcc6a('0x6'));function inspectError(_0x31bbcd){return util[_0xcc6a('0x7')](_0x31bbcd,{'showHidden':![],'depth':null});}function getContactDialer(_0x22ee99,_0x2f26ab,_0x188b05){return cmHopper[_0xcc6a('0x8')](_0x22ee99['id'],_0x2f26ab,_0x188b05,_0x22ee99[_0xcc6a('0x9')])['catch'](function(_0x3dd497){_0x22ee99[_0xcc6a('0xa')]=0x0;logger[_0xcc6a('0xb')]('[getContactDialer]',inspectError(_0x3dd497));});}exports[_0xcc6a('0x8')]=getContactDialer;function getContactDialerIvr(_0x210f63,_0x7806a0){return cmHopper[_0xcc6a('0xc')](_0x210f63['id'],_0x7806a0,_0x210f63[_0xcc6a('0x9')])['catch'](function(_0x30a004){_0x210f63[_0xcc6a('0xa')]=0x0;logger[_0xcc6a('0xb')]('[getContactDialerIvr]',inspectError(_0x30a004));});}exports[_0xcc6a('0xc')]=getContactDialerIvr;function countReScheduled(_0x9e9a63){return cmHopper[_0xcc6a('0xd')](_0x9e9a63)['catch'](function(_0x59ce6d){logger[_0xcc6a('0xb')](_0xcc6a('0xe'),inspectError(_0x59ce6d));});}exports[_0xcc6a('0xd')]=countReScheduled;function rescheduleContact(_0x559a0a){return cmHopper['rescheduleContact'](_0x559a0a)[_0xcc6a('0xf')](function(_0xcb9e2e){logger[_0xcc6a('0xb')](_0xcc6a('0x10'),inspectError(_0xcb9e2e));});}exports[_0xcc6a('0x11')]=rescheduleContact;function unlockContact(_0x337ec5,_0x4133fa,_0x403b18){return cmHopper['unlockContact'](_0x337ec5,_0x4133fa,_0x403b18)['catch'](function(_0x4d021a){logger[_0xcc6a('0xb')](_0xcc6a('0x12'),inspectError(_0x4d021a));});}exports[_0xcc6a('0x13')]=unlockContact;function moveContactManagedDialer(_0x3e63d9){return cmHopper[_0xcc6a('0x14')](_0x3e63d9)[_0xcc6a('0xf')](function(_0x2d9585){logger[_0xcc6a('0xb')](_0xcc6a('0x15'),inspectError(_0x2d9585));});}exports[_0xcc6a('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1d20a3){return cmHopperBlack['checkIsBlackList'](_0x1d20a3)[_0xcc6a('0xf')](function(_0x3e1fda){logger[_0xcc6a('0xb')](_0xcc6a('0x16'),inspectError(_0x3e1fda));});}exports[_0xcc6a('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x30b8ed){return cmHopperBlack[_0xcc6a('0x18')](_0x30b8ed)[_0xcc6a('0xf')](function(_0x2254a8){logger[_0xcc6a('0xb')](_0xcc6a('0x19'),inspectError(_0x2254a8));});}exports[_0xcc6a('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x51be9a,_0x41c4c8,_0x3a081e){return cmHopperAdditionalPhone[_0xcc6a('0x1a')](_0x51be9a,_0x41c4c8,_0x3a081e)['catch'](function(_0x10016a){logger[_0xcc6a('0xb')](_0xcc6a('0x1b'),inspectError(_0x10016a));});}exports[_0xcc6a('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x432c23,_0x5fc697,_0x50abc1){return cmHopperAdditionalPhone[_0xcc6a('0x1c')](_0x432c23,_0x5fc697,_0x50abc1)[_0xcc6a('0xf')](function(_0x3514f3){logger['error'](_0xcc6a('0x1d'),inspectError(_0x3514f3));});}exports[_0xcc6a('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x4da301){return cmHopperHistory[_0xcc6a('0x1e')](_0x4da301)[_0xcc6a('0xf')](function(_0x3233d1){logger[_0xcc6a('0xb')]('[avgHandleTime]',inspectError(_0x3233d1));});}exports[_0xcc6a('0x1e')]=avgHandleTime;function createHistory(_0x3cf14c){return cmHopperHistory[_0xcc6a('0x1f')](_0x3cf14c)['catch'](function(_0x2590a2){logger['error']('[createHistory]',inspectError(_0x2590a2));});}exports[_0xcc6a('0x1f')]=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 b64fde8..d3cc07e 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 _0x1dcd=['isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','diff','seconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x1dcd,0x1b8));var _0xd1dc=function(_0x3aecfa,_0x5bb070){_0x3aecfa=_0x3aecfa-0x0;var _0x228b31=_0x1dcd[_0x3aecfa];return _0x228b31;};'use strict';var _=require(_0xd1dc('0x0'));var moment=require(_0xd1dc('0x1'));var util=require(_0xd1dc('0x2'));var logger=require(_0xd1dc('0x3'))(_0xd1dc('0x4'));var timezones=require('../../../../config/environment/shared')[_0xd1dc('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xd1dc('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xd1dc('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xd1dc('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xd1dc('0x9'),'NO_AGENTS_LOGGED':_0xd1dc('0xa'),'NO_AVAILABLE_CONTACTS':_0xd1dc('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xd1dc('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xd1dc('0xd'),'RECALL_TIMEOUT':_0xd1dc('0xe'),'RUNNING':_0xd1dc('0xf'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xd1dc('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5ca9dd){return _0x5ca9dd[_0xd1dc('0x11')]===_0xd1dc('0x12');}exports[_0xd1dc('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x3cb6bc){return _0x3cb6bc[_0xd1dc('0x14')]===_0xd1dc('0x15');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x26094b){return _0x26094b[_0xd1dc('0x14')]===_0xd1dc('0x16');}exports[_0xd1dc('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x145aef){return _0x145aef[_0xd1dc('0x18')];}exports[_0xd1dc('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x18be8b){return _0x18be8b[_0xd1dc('0x1a')];}exports[_0xd1dc('0x1b')]=isIVRCampaignActive;function getSeconds(_0x2a65e5,_0x359a24){var _0x27f2dc=moment(_0x2a65e5)['milliseconds'](0x0);var _0x90deb4=moment(_0x359a24)['milliseconds'](0x0);return _0x27f2dc[_0xd1dc('0x1c')](_0x90deb4,_0xd1dc('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x597b8e,_0x56c456){var _0x4b32c9=![];var _0x4d09e4=_0x597b8e[_0xd1dc('0x11')]!==_0x56c456['dialMethod']||_0x597b8e[_0xd1dc('0x18')]!==_0x56c456[_0xd1dc('0x18')]||_0x597b8e['message']!==_0x56c456[_0xd1dc('0x1e')];var _0x348d19=_0x597b8e[_0xd1dc('0x1f')]!==_0x56c456[_0xd1dc('0x1f')]||_0x597b8e[_0xd1dc('0x20')]!==_0x56c456[_0xd1dc('0x20')]||_0x597b8e[_0xd1dc('0x21')]!==_0x56c456[_0xd1dc('0x21')]||_0x597b8e['paused']!==_0x56c456['paused']||_0x597b8e[_0xd1dc('0x22')]!==_0x56c456[_0xd1dc('0x22')]||_0x597b8e[_0xd1dc('0x23')]!==_0x56c456[_0xd1dc('0x23')]||_0x597b8e[_0xd1dc('0x24')]!==_0x56c456[_0xd1dc('0x24')]||_0x597b8e[_0xd1dc('0x25')]!==_0x56c456['inUse']||_0x597b8e[_0xd1dc('0x26')]!==_0x56c456['originated'];if(_0x597b8e['Trunk']&&_0x56c456[_0xd1dc('0x27')]){_0x4b32c9=_0x597b8e[_0xd1dc('0x27')][_0xd1dc('0x28')]!==_0x56c456[_0xd1dc('0x27')][_0xd1dc('0x28')]||_0x597b8e[_0xd1dc('0x27')][_0xd1dc('0x1a')]!==_0x56c456[_0xd1dc('0x27')][_0xd1dc('0x1a')];}return _0x4d09e4||_0x348d19||_0x4b32c9;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x37a786){var _0x1d0325=null;var _0x233eed=_0x37a786[_0xd1dc('0x29')];if(_['isNil'](_0x37a786[_0xd1dc('0x2a')])||_[_0xd1dc('0x2b')](_0x37a786[_0xd1dc('0x2c')])||_[_0xd1dc('0x2b')](_0x37a786[_0xd1dc('0x2c')][_0xd1dc('0x2d')])){_0x1d0325=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xd1dc('0x2e')](_0x37a786[_0xd1dc('0x2a')])||_[_0xd1dc('0x2e')](_0x37a786[_0xd1dc('0x2c')][_0xd1dc('0x2d')])){_0x1d0325=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x233eed&&!timezones[_0x233eed]){_0x1d0325=CAMPAIGN_STATUS[_0xd1dc('0x2f')];}return _0x1d0325;}function checkAnyValidTrunk(_0x277152,_0x5e4edb){var _0x20bbf9=null;var _0x38e90e=_0xd1dc('0x30');var _0x4c747e=['reachable',_0xd1dc('0x31')];var _0x3dcd4e=!![];if(_0x277152[_0xd1dc('0x27')]&&_0x277152[_0xd1dc('0x27')][_0xd1dc('0x1a')]){_0x38e90e+=_0x277152['Trunk']['name'];_0x20bbf9=_0x5e4edb[_0x38e90e];_0x3dcd4e=_0x4c747e[_0xd1dc('0x32')](_0x20bbf9[_0xd1dc('0x33')]);}else if(_0x277152[_0xd1dc('0x34')]&&_0x277152['TrunkBackup']['active']){_0x38e90e+=_0x277152['TrunkBackup']['name'];_0x20bbf9=_0x5e4edb[_0x38e90e];_0x3dcd4e=_0x4c747e[_0xd1dc('0x32')](_0x20bbf9[_0xd1dc('0x33')]);}return _0x3dcd4e;}function getQueueCampaignStatusMessage(_0x5d151f,_0x1712f6){var _0x184d2b=CAMPAIGN_STATUS[_0xd1dc('0x6')];var _0x263db8=isPreviewCampaign(_0x5d151f);if(!isQueueCampaignActive(_0x5d151f)){if(_0x263db8){_0x184d2b=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5d151f[_0xd1dc('0x26')]===0x0&&_0x5d151f[_0xd1dc('0x22')]===0x0&&_0x5d151f[_0xd1dc('0x24')]===0x0&&(_0x5d151f[_0xd1dc('0x23')]||0x0)===0x0){_0x184d2b=CAMPAIGN_STATUS[_0xd1dc('0x35')];}else{_0x184d2b=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x5d151f[_0xd1dc('0x20')]===0x0){_0x184d2b=CAMPAIGN_STATUS[_0xd1dc('0x36')];}else if(!checkAnyValidTrunk(_0x5d151f,_0x1712f6)){_0x184d2b=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x5d151f)){var _0x2a3a3f=checkAnyValidQueueCampaignInterval(_0x5d151f);if(_0x2a3a3f){_0x184d2b=_0x2a3a3f;}}return _0x184d2b;}exports[_0xd1dc('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x249e6a){var _0x422607=CAMPAIGN_STATUS['DISACTIVED'];if(_0x249e6a[_0xd1dc('0x26')]===0x0&&_0x249e6a[_0xd1dc('0x22')]===0x0&&_0x249e6a['waiting']===0x0&&(_0x249e6a[_0xd1dc('0x23')]||0x0)===0x0){_0x422607=CAMPAIGN_STATUS[_0xd1dc('0x35')];}return _0x422607;}exports[_0xd1dc('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1475ed){var _0x1e4021=_0x1475ed['match'](/"(.*?)"/);return _0x1e4021?_0x1e4021[0x1]:_0x1475ed;}exports[_0xd1dc('0x39')]=extractCalleridName;function getCallerId(_0x3b624b,_0x23aeb2,_0x1363d1){if(!_['isUndefined'](_0x1363d1)&&typeof _0x1363d1==='string'&&!_['isEmpty'](_0x1363d1)){if(!_[_0xd1dc('0x3a')](_0x23aeb2)&&typeof _0x23aeb2===_0xd1dc('0x3b')&&!_[_0xd1dc('0x2e')](_0x23aeb2)){return util[_0xd1dc('0x3c')](_0xd1dc('0x3d'),_0x23aeb2,_0x1363d1);}return util[_0xd1dc('0x3c')](_0xd1dc('0x3d'),_0x1363d1,_0x1363d1);}if(!_[_0xd1dc('0x3a')](_0x3b624b)&&typeof _0x3b624b===_0xd1dc('0x3b')&&!_['isEmpty'](_0x3b624b)){return _0x3b624b;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x6d75e2,_0x37b6e4){var _0x5c146a;var _0x1346c4;var _0x208383;if(_0x37b6e4<=0x0){_0x37b6e4=0x1;}_0x5c146a=new RegExp(_0xd1dc('0x3e')+_0x37b6e4+'}$');_0x1346c4=Math['pow'](0xa,_0x37b6e4-0x1);_0x208383=Math['pow'](0xa,_0x37b6e4)-0x1;return util['format']('%s',_[_0xd1dc('0x3f')](_0x6d75e2,_0x5c146a,_['random'](_0x1346c4,_0x208383)[_0xd1dc('0x40')]()));}exports[_0xd1dc('0x41')]=getCallerIdRandom;function decrementOriginate(_0x238d55){if(_0x238d55[_0xd1dc('0x26')]&&_0x238d55[_0xd1dc('0x26')]>0x0){_0x238d55[_0xd1dc('0x26')]-=0x1;}else{logger[_0xd1dc('0x42')](_0xd1dc('0x43'));}}exports[_0xd1dc('0x44')]=decrementOriginate;function checkContactEmpty(_0x16c83a){return _0x16c83a&&_0x16c83a[_0xd1dc('0x45')]>0x0;}exports[_0xd1dc('0x46')]=checkContactEmpty;function erlangb(_0x499028,_0x2e9369){if(_0x2e9369===0x0){return 0x0;}var _0x22332e=0x1;for(var _0x414720=0x1;_0x414720<=_0x2e9369;_0x414720+=0x1){_0x22332e=0x1+_0x22332e*_0x414720/_0x499028;}return 0x1/_0x22332e;}exports[_0xd1dc('0x47')]=erlangb;function checkContactLowerLimitOriginate(_0x10b8dc,_0x1a930a,_0x1c1477){if(_0x1a930a>_0x1c1477){for(var _0x2f1dfb=0x0;_0x2f1dfb<_0x1a930a-_0x1c1477;_0x2f1dfb+=0x1){decrementOriginate(_0x10b8dc);}}}exports[_0xd1dc('0x48')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4ab249){var _0x4c1d48={};var _0x268f0e=['id',_0xd1dc('0x49'),'tags',_0xd1dc('0x4a')];const _0x4942ac=0xfa;if(_0x4ab249){for(var _0x502a1a in _0x4ab249){if(typeof _0x4ab249[_0x502a1a]!==_0xd1dc('0x4b')){if(!_[_0xd1dc('0x2b')](_0x4ab249[_0x502a1a])&&!_0x268f0e[_0xd1dc('0x32')](_0x502a1a)){if(_0x502a1a===_0xd1dc('0x4c')&&_0x4ab249[_0x502a1a][_0xd1dc('0x45')]>_0x4942ac){_0x4c1d48[_0xd1dc('0x4d')+_0x502a1a[_0xd1dc('0x4e')]()]=_0x4ab249[_0x502a1a]['toString']()[_0xd1dc('0x4f')](0x0,_0x4942ac);}else{_0x4c1d48[_0xd1dc('0x4d')+_0x502a1a[_0xd1dc('0x4e')]()]=_0x4ab249[_0x502a1a];}}}}}return _0x4c1d48;}exports[_0xd1dc('0x50')]=setXMDContactVariables; \ No newline at end of file +var _0x0f91=['isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','waiting','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','INACTIVE','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','toUpperCase','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod'];(function(_0x1233a6,_0x447f3f){var _0x30d72b=function(_0xcf5f68){while(--_0xcf5f68){_0x1233a6['push'](_0x1233a6['shift']());}};_0x30d72b(++_0x447f3f);}(_0x0f91,0x1ae));var _0x10f9=function(_0x33f7e1,_0x48d209){_0x33f7e1=_0x33f7e1-0x0;var _0x23bab4=_0x0f91[_0x33f7e1];return _0x23bab4;};'use strict';var _=require(_0x10f9('0x0'));var moment=require(_0x10f9('0x1'));var util=require(_0x10f9('0x2'));var logger=require(_0x10f9('0x3'))(_0x10f9('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x10f9('0x5'),'DEACTIVATED':_0x10f9('0x6'),'DISACTIVED':_0x10f9('0x7'),'EMPTY_INTERVAL':_0x10f9('0x8'),'INACTIVE':_0x10f9('0x9'),'NO_AGENTS_LOGGED':_0x10f9('0xa'),'NO_AVAILABLE_CONTACTS':_0x10f9('0xb'),'NULL_INTERVAL':_0x10f9('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x10f9('0xd'),'RECALL_TIMEOUT':_0x10f9('0xe'),'RUNNING':_0x10f9('0xf'),'UNKNOWN_TIMEZONE':_0x10f9('0x10'),'UNREACHABLE_TRUNK':_0x10f9('0x11')};exports[_0x10f9('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3c2840){return _0x3c2840[_0x10f9('0x13')]==='preview';}exports[_0x10f9('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x2a87aa){return _0x2a87aa[_0x10f9('0x15')]===_0x10f9('0x16');}exports[_0x10f9('0x17')]=isIVRCampaign;function isOutboundQueue(_0x17d5fa){return _0x17d5fa[_0x10f9('0x15')]===_0x10f9('0x18');}exports[_0x10f9('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x18ee4a){return _0x18ee4a[_0x10f9('0x1a')];}exports[_0x10f9('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x29c1d5){return _0x29c1d5[_0x10f9('0x1c')];}exports[_0x10f9('0x1d')]=isIVRCampaignActive;function getSeconds(_0x31c5cb,_0x234383){var _0x2f45c8=moment(_0x31c5cb)[_0x10f9('0x1e')](0x0);var _0x28d0d6=moment(_0x234383)[_0x10f9('0x1e')](0x0);return _0x2f45c8[_0x10f9('0x1f')](_0x28d0d6,_0x10f9('0x20'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x5953aa,_0x22dd0c){var _0x5747c1=![];var _0xb14a59=_0x5953aa['dialMethod']!==_0x22dd0c[_0x10f9('0x13')]||_0x5953aa['dialActive']!==_0x22dd0c[_0x10f9('0x1a')]||_0x5953aa[_0x10f9('0x21')]!==_0x22dd0c[_0x10f9('0x21')];var _0x317f1a=_0x5953aa[_0x10f9('0x22')]!==_0x22dd0c[_0x10f9('0x22')]||_0x5953aa['loggedIn']!==_0x22dd0c[_0x10f9('0x23')]||_0x5953aa[_0x10f9('0x24')]!==_0x22dd0c[_0x10f9('0x24')]||_0x5953aa['paused']!==_0x22dd0c[_0x10f9('0x25')]||_0x5953aa[_0x10f9('0x26')]!==_0x22dd0c[_0x10f9('0x26')]||_0x5953aa['pTalking']!==_0x22dd0c[_0x10f9('0x27')]||_0x5953aa['waiting']!==_0x22dd0c['waiting']||_0x5953aa[_0x10f9('0x28')]!==_0x22dd0c['inUse']||_0x5953aa['originated']!==_0x22dd0c[_0x10f9('0x29')];if(_0x5953aa[_0x10f9('0x2a')]&&_0x22dd0c[_0x10f9('0x2a')]){_0x5747c1=_0x5953aa[_0x10f9('0x2a')][_0x10f9('0x2b')]!==_0x22dd0c['Trunk'][_0x10f9('0x2b')]||_0x5953aa['Trunk'][_0x10f9('0x1c')]!==_0x22dd0c['Trunk'][_0x10f9('0x1c')];}return _0xb14a59||_0x317f1a||_0x5747c1;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xc0086d){var _0x3a35fe=null;var _0x4f9ed5=_0xc0086d[_0x10f9('0x2c')];if(_[_0x10f9('0x2d')](_0xc0086d[_0x10f9('0x2e')])||_[_0x10f9('0x2d')](_0xc0086d[_0x10f9('0x2f')])||_[_0x10f9('0x2d')](_0xc0086d[_0x10f9('0x2f')][_0x10f9('0x30')])){_0x3a35fe=CAMPAIGN_STATUS[_0x10f9('0x31')];}else if(_[_0x10f9('0x32')](_0xc0086d[_0x10f9('0x2e')])||_[_0x10f9('0x32')](_0xc0086d[_0x10f9('0x2f')][_0x10f9('0x30')])){_0x3a35fe=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4f9ed5&&!timezones[_0x4f9ed5]){_0x3a35fe=CAMPAIGN_STATUS[_0x10f9('0x33')];}return _0x3a35fe;}function checkAnyValidTrunk(_0x589de7,_0x3d5e94){var _0xa6f1d7=null;var _0x407634=_0x10f9('0x34');var _0x13633b=[_0x10f9('0x35'),_0x10f9('0x36')];var _0x30dfce=!![];if(_0x589de7['Trunk']&&_0x589de7[_0x10f9('0x2a')][_0x10f9('0x1c')]){_0x407634+=_0x589de7[_0x10f9('0x2a')][_0x10f9('0x2b')];_0xa6f1d7=_0x3d5e94[_0x407634];_0x30dfce=_0x13633b[_0x10f9('0x37')](_0xa6f1d7[_0x10f9('0x38')]);}else if(_0x589de7[_0x10f9('0x39')]&&_0x589de7[_0x10f9('0x39')][_0x10f9('0x1c')]){_0x407634+=_0x589de7[_0x10f9('0x39')]['name'];_0xa6f1d7=_0x3d5e94[_0x407634];_0x30dfce=_0x13633b[_0x10f9('0x37')](_0xa6f1d7[_0x10f9('0x38')]);}return _0x30dfce;}function getQueueCampaignStatusMessage(_0x2943a0,_0x379b99){var _0x460b22=CAMPAIGN_STATUS[_0x10f9('0x3a')];var _0x31e05c=isPreviewCampaign(_0x2943a0);if(!isQueueCampaignActive(_0x2943a0)){if(_0x31e05c){_0x460b22=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2943a0[_0x10f9('0x29')]===0x0&&_0x2943a0['talking']===0x0&&_0x2943a0[_0x10f9('0x3b')]===0x0&&(_0x2943a0[_0x10f9('0x27')]||0x0)===0x0){_0x460b22=CAMPAIGN_STATUS['INACTIVE'];}else{_0x460b22=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x2943a0[_0x10f9('0x23')]===0x0){_0x460b22=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2943a0,_0x379b99)){_0x460b22=CAMPAIGN_STATUS[_0x10f9('0x3c')];}else if(!isPreviewCampaign(_0x2943a0)){var _0x14a52e=checkAnyValidQueueCampaignInterval(_0x2943a0);if(_0x14a52e){_0x460b22=_0x14a52e;}}return _0x460b22;}exports[_0x10f9('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xdbc777){var _0x440910=CAMPAIGN_STATUS[_0x10f9('0x3e')];if(_0xdbc777[_0x10f9('0x29')]===0x0&&_0xdbc777[_0x10f9('0x26')]===0x0&&_0xdbc777['waiting']===0x0&&(_0xdbc777[_0x10f9('0x27')]||0x0)===0x0){_0x440910=CAMPAIGN_STATUS[_0x10f9('0x3f')];}return _0x440910;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x51ecc0){var _0x5960bc=_0x51ecc0['match'](/"(.*?)"/);return _0x5960bc?_0x5960bc[0x1]:_0x51ecc0;}exports[_0x10f9('0x40')]=extractCalleridName;function getCallerId(_0x2fee7f,_0x213457,_0x4a850b){if(!_['isUndefined'](_0x4a850b)&&typeof _0x4a850b==='string'&&!_[_0x10f9('0x32')](_0x4a850b)){if(!_[_0x10f9('0x41')](_0x213457)&&typeof _0x213457===_0x10f9('0x42')&&!_[_0x10f9('0x32')](_0x213457)){return util[_0x10f9('0x43')](_0x10f9('0x44'),_0x213457,_0x4a850b);}return util[_0x10f9('0x43')](_0x10f9('0x44'),_0x4a850b,_0x4a850b);}if(!_['isUndefined'](_0x2fee7f)&&typeof _0x2fee7f===_0x10f9('0x42')&&!_['isEmpty'](_0x2fee7f)){return _0x2fee7f;}return _0x10f9('0x45');}exports[_0x10f9('0x46')]=getCallerId;function getCallerIdRandom(_0x4bd1f4,_0x58dbc8){var _0x347391;var _0x281465;var _0x24518a;if(_0x58dbc8<=0x0){_0x58dbc8=0x1;}_0x347391=new RegExp(_0x10f9('0x47')+_0x58dbc8+'}$');_0x281465=Math[_0x10f9('0x48')](0xa,_0x58dbc8-0x1);_0x24518a=Math[_0x10f9('0x48')](0xa,_0x58dbc8)-0x1;return util[_0x10f9('0x43')]('%s',_[_0x10f9('0x49')](_0x4bd1f4,_0x347391,_[_0x10f9('0x4a')](_0x281465,_0x24518a)[_0x10f9('0x4b')]()));}exports[_0x10f9('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x111e12){if(_0x111e12['originated']&&_0x111e12['originated']>0x0){_0x111e12[_0x10f9('0x29')]-=0x1;}else{logger[_0x10f9('0x4d')](_0x10f9('0x4e'));}}exports[_0x10f9('0x4f')]=decrementOriginate;function checkContactEmpty(_0x146c39){return _0x146c39&&_0x146c39[_0x10f9('0x50')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x5c4fa9,_0x5a9d6a){if(_0x5a9d6a===0x0){return 0x0;}var _0x3cfa39=0x1;for(var _0xacb341=0x1;_0xacb341<=_0x5a9d6a;_0xacb341+=0x1){_0x3cfa39=0x1+_0x3cfa39*_0xacb341/_0x5c4fa9;}return 0x1/_0x3cfa39;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x881e07,_0x34be50,_0x4eb4ed){if(_0x34be50>_0x4eb4ed){for(var _0xfc91b4=0x0;_0xfc91b4<_0x34be50-_0x4eb4ed;_0xfc91b4+=0x1){decrementOriginate(_0x881e07);}}}exports[_0x10f9('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1f22fc){var _0x5d366d={};var _0x30b698=['id',_0x10f9('0x52'),'tags',_0x10f9('0x53')];const _0xfecc7d=0xfa;if(_0x1f22fc){for(var _0x14f458 in _0x1f22fc){if(typeof _0x1f22fc[_0x14f458]!==_0x10f9('0x54')){if(!_[_0x10f9('0x2d')](_0x1f22fc[_0x14f458])&&!_0x30b698[_0x10f9('0x37')](_0x14f458)){if(_0x14f458===_0x10f9('0x55')&&_0x1f22fc[_0x14f458][_0x10f9('0x50')]>_0xfecc7d){_0x5d366d['XMD-'+_0x14f458[_0x10f9('0x56')]()]=_0x1f22fc[_0x14f458][_0x10f9('0x4b')]()[_0x10f9('0x57')](0x0,_0xfecc7d);}else{_0x5d366d[_0x10f9('0x58')+_0x14f458[_0x10f9('0x56')]()]=_0x1f22fc[_0x14f458];}}}}}return _0x5d366d;}exports[_0x10f9('0x59')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index cdb6964..1a9face 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(_0x24ec31,_0x6498f){var _0x4fdb44=function(_0x4508eb){while(--_0x4508eb){_0x24ec31['push'](_0x24ec31['shift']());}};_0x4fdb44(++_0x6498f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var 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(_0x1aabd7,_0x30472c){var _0xc8617=function(_0x2f8c48){while(--_0x2f8c48){_0x1aabd7['push'](_0x1aabd7['shift']());}};_0xc8617(++_0x30472c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 092b87e..1863cf5 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 _0x83aa=['\x20receiveFax\x20','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','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','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify'];(function(_0x1539d9,_0x9981f6){var _0x40fbef=function(_0x11c845){while(--_0x11c845){_0x1539d9['push'](_0x1539d9['shift']());}};_0x40fbef(++_0x9981f6);}(_0x83aa,0xaf));var _0xa83a=function(_0x1d2064,_0x47aef1){_0x1d2064=_0x1d2064-0x0;var _0x269138=_0x83aa[_0x1d2064];return _0x269138;};'use strict';var util=require(_0xa83a('0x0'));var _=require(_0xa83a('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa83a('0x2'));var moment=require(_0xa83a('0x3'));var path=require(_0xa83a('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xa83a('0x5'));var logger=require(_0xa83a('0x6'))(_0xa83a('0x7'));var ami=require('../ami');var rpcDb=require(_0xa83a('0x8'));var Channel=require(_0xa83a('0x9'));var ut=require(_0xa83a('0xa'));var Action=require(_0xa83a('0xb'));var faxAccount=require(_0xa83a('0xc'));var attachment=require(_0xa83a('0xd'));var faxMessage=require(_0xa83a('0xe'));function Fax(_0x2d27b2){this[_0xa83a('0xf')]={};this[_0xa83a('0x10')]=_0x2d27b2[_0xa83a('0x10')];this[_0xa83a('0x11')]=_0x2d27b2[_0xa83a('0x11')];this[_0xa83a('0x12')]={};ami['on']('newchannel',this[_0xa83a('0x13')][_0xa83a('0x14')](this));ami['on'](_0xa83a('0x15'),this[_0xa83a('0x16')][_0xa83a('0x14')](this));ami['on'](_0xa83a('0x17'),this[_0xa83a('0x18')][_0xa83a('0x14')](this));ami['on'](_0xa83a('0x19'),this[_0xa83a('0x1a')][_0xa83a('0x14')](this));ami['on'](_0xa83a('0x1b'),this[_0xa83a('0x1c')]['bind'](this));ami['on'](_0xa83a('0x1d'),this['syncReceiveFax'][_0xa83a('0x14')](this));ami['on']('hangup',this[_0xa83a('0x1e')][_0xa83a('0x14')](this));ami['on'](_0xa83a('0x1f'),this[_0xa83a('0x20')]['bind'](this));}Fax[_0xa83a('0x21')]['syncNewchannel']=function(_0x3216a6){if(_0x3216a6['context']===_0xa83a('0x22')){for(var _0x3cd2a8 in this[_0xa83a('0x10')]){if(this[_0xa83a('0x10')]['hasOwnProperty'](_0x3cd2a8)){if(_0x3216a6[_0xa83a('0x23')]===this[_0xa83a('0x10')][_0x3cd2a8][_0xa83a('0x24')]){this[_0xa83a('0xf')][_0x3216a6[_0xa83a('0x25')]]={};this[_0xa83a('0xf')][_0x3216a6['uniqueid']][_0xa83a('0x26')]=_0x3216a6[_0xa83a('0x26')];this[_0xa83a('0xf')][_0x3216a6[_0xa83a('0x25')]]['id']=this['faxAccounts'][_0x3cd2a8]['id'];this[_0xa83a('0xf')][_0x3216a6[_0xa83a('0x25')]][_0xa83a('0x27')]=this[_0xa83a('0x10')][_0x3cd2a8][_0xa83a('0x27')];logger[_0xa83a('0x28')](_0x3216a6[_0xa83a('0x25')],_0xa83a('0x29'));}}}}if(this['actions'][_0x3216a6['uniqueid']]){this[_0xa83a('0xf')][_0x3216a6[_0xa83a('0x25')]]={};this[_0xa83a('0xf')][_0x3216a6['uniqueid']]['channel']=_0x3216a6[_0xa83a('0x26')];logger[_0xa83a('0x28')](_0x3216a6[_0xa83a('0x25')],_0xa83a('0x29'));}};Fax['prototype'][_0xa83a('0x16')]=function(_0x336409){if(this['channels'][_0x336409[_0xa83a('0x25')]]){for(var _0x5d1243 in _0x336409[_0xa83a('0x2a')]){if(_0x336409[_0xa83a('0x2a')][_0xa83a('0x2b')](_0x5d1243)){this[_0xa83a('0xf')][_0x336409[_0xa83a('0x25')]][_0x5d1243]=_0x336409[_0xa83a('0x2c')];}}}};Fax[_0xa83a('0x21')][_0xa83a('0x18')]=function(_0x4d60c1){if(this[_0xa83a('0xf')][_0x4d60c1[_0xa83a('0x25')]]){this['channels'][_0x4d60c1[_0xa83a('0x25')]][_0xa83a('0x2d')]=_0x4d60c1[_0xa83a('0x2d')];this[_0xa83a('0xf')][_0x4d60c1[_0xa83a('0x25')]]['channelstatedesc']=_0x4d60c1['channelstatedesc'];}};Fax[_0xa83a('0x21')]['syncNewExten']=function(_0x202e70){if(this[_0xa83a('0xf')][_0x202e70[_0xa83a('0x25')]]){for(var _0x435e24 in _0x202e70[_0xa83a('0x2a')]){if(_0x202e70[_0xa83a('0x2a')][_0xa83a('0x2b')](_0x435e24)){this[_0xa83a('0xf')][_0x202e70[_0xa83a('0x25')]][_0x435e24]=_0x202e70['value'];}}}};Fax[_0xa83a('0x21')][_0xa83a('0x1c')]=function(_0x1ed879){if(this[_0xa83a('0xf')][_0x1ed879[_0xa83a('0x25')]]){this['channels'][_0x1ed879['uniqueid']][_0xa83a('0x2e')]=_0x1ed879[_0xa83a('0x2e')];this[_0xa83a('0xf')][_0x1ed879[_0xa83a('0x25')]][_0xa83a('0x2f')]=_0x1ed879[_0xa83a('0x2f')];this['channels'][_0x1ed879[_0xa83a('0x25')]][_0xa83a('0x24')]=_0x1ed879[_0xa83a('0x24')];this[_0xa83a('0xf')][_0x1ed879[_0xa83a('0x25')]][_0xa83a('0x30')]=_0x1ed879['filename'];logger[_0xa83a('0x28')](_0x1ed879[_0xa83a('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0xa83a('0x21')][_0xa83a('0x31')]=function(_0x3fc345){var _0x7036ae=this;if(this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]]){var _0x55f745=this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]]['id'];this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]]['remotestationid']=_0x3fc345[_0xa83a('0x32')];this[_0xa83a('0xf')][_0x3fc345['uniqueid']][_0xa83a('0x33')]=_0x3fc345[_0xa83a('0x33')];this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]][_0xa83a('0x24')]=_0x3fc345[_0xa83a('0x24')];this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]][_0xa83a('0x34')]=_0x3fc345[_0xa83a('0x34')];this['channels'][_0x3fc345['uniqueid']][_0xa83a('0x35')]=_0x3fc345['transferrate'];this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]][_0xa83a('0x30')]=_0x3fc345[_0xa83a('0x30')];this[_0xa83a('0xf')][_0x3fc345['uniqueid']][_0xa83a('0x36')]=_0x3fc345[_0xa83a('0x36')];if(this[_0xa83a('0xf')][_0x3fc345[_0xa83a('0x25')]][_0xa83a('0x33')]>0x0){tiff2pdf(_0x3fc345[_0xa83a('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x4f9574){logger['info'](_0x3fc345[_0xa83a('0x25')],'\x20result\x20conversion\x20file\x20',_0x4f9574['message']);attachment['create']({'name':path[_0xa83a('0x37')](_0x3fc345[_0xa83a('0x30')])[_0xa83a('0x27')],'basename':path[_0xa83a('0x37')](_0x3fc345[_0xa83a('0x30')])[_0xa83a('0x27')]+_0xa83a('0x38'),'type':_0xa83a('0x39')})[_0xa83a('0x3a')](function(_0xb4217a){faxAccount[_0xa83a('0x3b')](_0x55f745,{'from':_0x3fc345[_0xa83a('0x36')],'mapKey':_0xa83a('0x7'),'body':path[_0xa83a('0x37')](_0x3fc345['filename'])[_0xa83a('0x27')]+_0xa83a('0x38'),'AttachmentId':_0xb4217a['id']})[_0xa83a('0x3c')](function(_0x2f38d2){logger['error'](_0x3fc345['uniqueid'],_0xa83a('0x3d'),JSON[_0xa83a('0x3e')](_0x2f38d2));});})[_0xa83a('0x3c')](function(_0x3af806){logger['error'](_0x3fc345[_0xa83a('0x25')],_0xa83a('0x3f'),JSON[_0xa83a('0x3e')](_0x3af806));});});}logger['info'](_0x3fc345[_0xa83a('0x25')],_0xa83a('0x3f'));}};Fax[_0xa83a('0x21')][_0xa83a('0x20')]=function(_0x10aa7d){if(this[_0xa83a('0x12')][_0x10aa7d['uniqueid']]){_[_0xa83a('0x40')](this[_0xa83a('0xf')][_0x10aa7d[_0xa83a('0x25')]],_['pick'](_0x10aa7d,[_0xa83a('0x41'),_0xa83a('0x42')]));}};function updateStatus(_0x32a8cb){if(_0x32a8cb[_0xa83a('0x43')]){faxMessage[_0xa83a('0x44')](_0x32a8cb['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xa83a('0x3a')](function(_0x309eaf){ut[_0xa83a('0x45')](_0xa83a('0x46'),_0x309eaf);})[_0xa83a('0x3c')](function(_0x2fe951){ut[_0xa83a('0x45')](_0xa83a('0x47'),_0x2fe951);});}else{ut[_0xa83a('0x45')](_0xa83a('0x48'));}}Fax[_0xa83a('0x21')][_0xa83a('0x49')]=function(_0x5bf42a,_0x322973,_0x9e77f4){var _0x2d0503=this;var _0x15e742={};if(_0x322973){_0x15e742={'read':_0x322973};}else{_0x15e742={'failMessage':_0x9e77f4};}if(this[_0xa83a('0x12')][_0x5bf42a][_0xa83a('0x43')]){faxMessage['update'](this[_0xa83a('0x12')][_0x5bf42a][_0xa83a('0x43')],_0x15e742)[_0xa83a('0x3a')](function(_0x1238b8){ut['logger'](_0xa83a('0x4a'),_0x1238b8);})[_0xa83a('0x3c')](function(_0x4f7cbd){ut[_0xa83a('0x45')](_0xa83a('0x4b'),_0x4f7cbd);})[_0xa83a('0x4c')](function(){delete _0x2d0503['channels'][_0x5bf42a];delete _0x2d0503[_0xa83a('0x12')][_0x5bf42a];});}else{ut['logger'](_0xa83a('0x4d'));this['deleteChannelAfterTimeout'](_0x5bf42a);delete this['actions'][_0x5bf42a];}};Fax['prototype'][_0xa83a('0x1e')]=function(_0x4701dd){var _0x5aede9=this;if(this[_0xa83a('0xf')][_0x4701dd[_0xa83a('0x25')]]){if(this[_0xa83a('0x12')][_0x4701dd[_0xa83a('0x25')]]){this[_0xa83a('0xf')][_0x4701dd[_0xa83a('0x25')]]['id']=this[_0xa83a('0x12')][_0x4701dd[_0xa83a('0x25')]]['id'];this[_0xa83a('0xf')][_0x4701dd[_0xa83a('0x25')]][_0xa83a('0x27')]=this[_0xa83a('0x12')][_0x4701dd[_0xa83a('0x25')]][_0xa83a('0x27')];}logger[_0xa83a('0x28')](_0x4701dd[_0xa83a('0x25')],this[_0xa83a('0x12')][_0x4701dd[_0xa83a('0x25')]]?_0xa83a('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0xa83a('0x3e')](this[_0xa83a('0xf')][_0x4701dd[_0xa83a('0x25')]]));if(this[_0xa83a('0x12')][_0x4701dd[_0xa83a('0x25')]]){if(this[_0xa83a('0xf')][_0x4701dd['uniqueid']]['faxpages']>0x0&&this[_0xa83a('0xf')][_0x4701dd['uniqueid']]['faxstatus']===_0xa83a('0x4f')){this[_0xa83a('0x49')](_0x4701dd['uniqueid'],!![]);}else{this[_0xa83a('0x49')](_0x4701dd[_0xa83a('0x25')],![],this['channels'][_0x4701dd[_0xa83a('0x25')]][_0xa83a('0x50')]?_0xa83a('0x51')+this[_0xa83a('0xf')][_0x4701dd[_0xa83a('0x25')]][_0xa83a('0x50')]:_0xa83a('0x52'));}}}};Fax[_0xa83a('0x21')][_0xa83a('0x53')]=function(_0x10a5af){var _0xaf2aa7=this;return new BPromise(function(_0x187ea4,_0x3501b9){_0xaf2aa7[_0xa83a('0x54')](_0x10a5af,_0xaf2aa7[_0xa83a('0x10')][_0x10a5af['FaxAccountId']])[_0xa83a('0x3a')](function(_0x4bfaa7){ut['logger'](_0xa83a('0x55'),_0x4bfaa7);_0x187ea4(ut['message'](_0xa83a('0x56')));})[_0xa83a('0x3c')](function(_0x1915d7){ut[_0xa83a('0x45')](_0xa83a('0x57'),_0x1915d7);updateStatus(_0x10a5af);_0x3501b9(ut[_0xa83a('0x58')]('Fax\x20failed'));});});};Fax['prototype'][_0xa83a('0x59')]=function(_0x598132){var _0x44c235=this;return new BPromise(function(_0x2d6c80,_0x4c1e52){var _0x28cad1=_0x44c235[_0xa83a('0x5a')](_0x44c235[_0xa83a('0x10')][_0x598132[_0xa83a('0x5b')]][_0xa83a('0x5c')],_0x598132);if(_0x28cad1[_0xa83a('0x5d')]){_0x2d6c80(ut[_0xa83a('0x58')]('Trunk\x20Reachable'));}else{_0x4c1e52(ut[_0xa83a('0x58')](_0x28cad1['message']));}});};function originate(_0x582fbd,_0x1e58c1,_0x5c703a){return new BPromise(function(_0x20411e,_0x4a443e){if(_0x5c703a){var _0x4fec21=util[_0xa83a('0x5e')](_0xa83a('0x5f'),path[_0xa83a('0x37')](_0x582fbd['path'])[_0xa83a('0x27')],_0x582fbd[_0xa83a('0x4')]);gs[_0xa83a('0x60')](_0x4fec21)['then'](function(){_0x582fbd[_0xa83a('0x4')]=util['format'](_0xa83a('0x61'),path['parse'](_0x582fbd[_0xa83a('0x4')])[_0xa83a('0x62')],path[_0xa83a('0x37')](_0x582fbd[_0xa83a('0x4')])[_0xa83a('0x27')]);_0x1e58c1[_0xa83a('0x63')]=_0x582fbd['path'];ut[_0xa83a('0x45')](_0xa83a('0x64'),'');ami[_0xa83a('0x65')](ut[_0xa83a('0x66')](_0x582fbd,_0x1e58c1))[_0xa83a('0x3a')](function(_0x1446bc){_0x20411e(_0x1446bc);})[_0xa83a('0x3c')](function(_0x51612d){_0x4a443e(_0x51612d);});})[_0xa83a('0x3c')](function(_0x1bd081){_0x4a443e(_0x1bd081);});}else{ami[_0xa83a('0x65')](ut['variablesAction'](_0x582fbd,_0x1e58c1))[_0xa83a('0x3a')](function(_0x293f67){_0x20411e(_0x293f67);})[_0xa83a('0x3c')](function(_0x25f2dd){_0x4a443e(_0x25f2dd);});}});}Fax['prototype']['execOriginate']=function(_0x26c578,_0x40e363){var _0x16f137=this;return new BPromise(function(_0x4522f6,_0x30308){var _0x2d6a42=uuid['v4']();var _0x2693bb=ut[_0xa83a('0x67')](_0x26c578,_0x40e363);_0x16f137[_0xa83a('0x12')][_0x2d6a42]=new Action(_0x2d6a42,_0x40e363,_0x26c578);var _0xc216f3=_0x16f137[_0xa83a('0x12')][_0x2d6a42];if(path[_0xa83a('0x37')](_0x26c578[_0xa83a('0x4')])['ext']==='.pdf'){originate(_0xc216f3,_0x2693bb,!![])[_0xa83a('0x3a')](function(_0x32218a){_0x4522f6(_0x32218a);})[_0xa83a('0x3c')](function(_0x370895){_0x30308(_0x370895);});}else{originate(_0xc216f3,_0x2693bb,![])[_0xa83a('0x3a')](function(_0x34ded5){_0x4522f6(_0x34ded5);})[_0xa83a('0x3c')](function(_0x26195d){_0x30308(_0x26195d);});}});};Fax[_0xa83a('0x21')][_0xa83a('0x68')]=function(_0x75e2c5){return!_[_0xa83a('0x69')](_0x75e2c5)&&!_[_0xa83a('0x69')](_0x75e2c5[_0xa83a('0x27')])&&!_[_0xa83a('0x69')](_0x75e2c5[_0xa83a('0x6a')])&&_0x75e2c5[_0xa83a('0x6a')]&&!_[_0xa83a('0x69')](this[_0xa83a('0x11')][util[_0xa83a('0x5e')](_0xa83a('0x6b'),_0x75e2c5[_0xa83a('0x27')])])&&!_[_0xa83a('0x69')](this[_0xa83a('0x11')][util['format']('SIP/%s',_0x75e2c5[_0xa83a('0x27')])][_0xa83a('0x2f')])&&(this[_0xa83a('0x11')][util[_0xa83a('0x5e')]('SIP/%s',_0x75e2c5['name'])][_0xa83a('0x2f')]===_0xa83a('0x6c')||this['trunks'][util[_0xa83a('0x5e')]('SIP/%s',_0x75e2c5['name'])][_0xa83a('0x2f')]===_0xa83a('0x6d'));};Fax[_0xa83a('0x21')][_0xa83a('0x5a')]=function(_0x565edc,_0xd52ddd){if(!this[_0xa83a('0x68')](_0x565edc)){ut[_0xa83a('0x45')](_0xa83a('0x6e'),_[_0xa83a('0x69')](_0x565edc)?'':_0x565edc[_0xa83a('0x27')]+_0xa83a('0x6f'));return{'isValid':![],'message':_0xa83a('0x70')};}if(_[_0xa83a('0x69')](_0xd52ddd[_0xa83a('0x7')])){ut[_0xa83a('0x45')](_0xa83a('0x71'),JSON[_0xa83a('0x3e')](_0xd52ddd));return{'isValid':![],'message':_0xa83a('0x72')};}if(_[_0xa83a('0x69')](_0xd52ddd[_0xa83a('0x4')])){ut[_0xa83a('0x45')](_0xa83a('0x73'),JSON[_0xa83a('0x3e')](_0xd52ddd));return{'isValid':![],'message':_0xa83a('0x74')};}return{'isValid':!![],'message':_0xa83a('0x75')};};Fax[_0xa83a('0x21')]['deleteChannelAfterTimeout']=function(_0x3c8dff,_0x42e634=0x2710){if(this[_0xa83a('0xf')][_0x3c8dff]){setTimeout(()=>{delete this[_0xa83a('0xf')][_0x3c8dff];},_0x42e634);}};module[_0xa83a('0x76')]=Fax; \ No newline at end of file +var _0xd977=['Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','trunks','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','deleteChannelAfterTimeout','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','syncNewchannel','bind','varset','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xd977,0x10e));var _0x7d97=function(_0x391cea,_0x46bb62){_0x391cea=_0x391cea-0x0;var _0x169a6a=_0xd977[_0x391cea];return _0x169a6a;};'use strict';var util=require(_0x7d97('0x0'));var _=require(_0x7d97('0x1'));var BPromise=require(_0x7d97('0x2'));var uuid=require(_0x7d97('0x3'));var moment=require(_0x7d97('0x4'));var path=require(_0x7d97('0x5'));var tiff2pdf=require(_0x7d97('0x6'));var gs=require(_0x7d97('0x7'));var logger=require(_0x7d97('0x8'))('fax');var ami=require(_0x7d97('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x7d97('0xa'));var ut=require(_0x7d97('0xb'));var Action=require(_0x7d97('0xc'));var faxAccount=require(_0x7d97('0xd'));var attachment=require(_0x7d97('0xe'));var faxMessage=require(_0x7d97('0xf'));function Fax(_0x5a4642){this[_0x7d97('0x10')]={};this[_0x7d97('0x11')]=_0x5a4642[_0x7d97('0x11')];this['trunks']=_0x5a4642['trunks'];this[_0x7d97('0x12')]={};ami['on']('newchannel',this[_0x7d97('0x13')][_0x7d97('0x14')](this));ami['on'](_0x7d97('0x15'),this['syncVarSet'][_0x7d97('0x14')](this));ami['on'](_0x7d97('0x16'),this[_0x7d97('0x17')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x7d97('0x14')](this));ami['on'](_0x7d97('0x18'),this[_0x7d97('0x19')]['bind'](this));ami['on'](_0x7d97('0x1a'),this[_0x7d97('0x1b')][_0x7d97('0x14')](this));ami['on'](_0x7d97('0x1c'),this[_0x7d97('0x1d')][_0x7d97('0x14')](this));ami['on'](_0x7d97('0x1e'),this[_0x7d97('0x1f')][_0x7d97('0x14')](this));}Fax[_0x7d97('0x20')][_0x7d97('0x13')]=function(_0x203448){if(_0x203448[_0x7d97('0x21')]===_0x7d97('0x22')){for(var _0x41cd83 in this[_0x7d97('0x11')]){if(this[_0x7d97('0x11')][_0x7d97('0x23')](_0x41cd83)){if(_0x203448['exten']===this[_0x7d97('0x11')][_0x41cd83][_0x7d97('0x24')]){this['channels'][_0x203448[_0x7d97('0x25')]]={};this['channels'][_0x203448[_0x7d97('0x25')]][_0x7d97('0x26')]=_0x203448['channel'];this[_0x7d97('0x10')][_0x203448[_0x7d97('0x25')]]['id']=this['faxAccounts'][_0x41cd83]['id'];this[_0x7d97('0x10')][_0x203448[_0x7d97('0x25')]][_0x7d97('0x27')]=this[_0x7d97('0x11')][_0x41cd83]['name'];logger['info'](_0x203448[_0x7d97('0x25')],_0x7d97('0x28'));}}}}if(this[_0x7d97('0x12')][_0x203448[_0x7d97('0x25')]]){this[_0x7d97('0x10')][_0x203448['uniqueid']]={};this['channels'][_0x203448['uniqueid']][_0x7d97('0x26')]=_0x203448[_0x7d97('0x26')];logger[_0x7d97('0x29')](_0x203448['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x7d97('0x20')][_0x7d97('0x2a')]=function(_0x4c926c){if(this['channels'][_0x4c926c[_0x7d97('0x25')]]){for(var _0x4ed9de in _0x4c926c[_0x7d97('0x2b')]){if(_0x4c926c[_0x7d97('0x2b')][_0x7d97('0x23')](_0x4ed9de)){this[_0x7d97('0x10')][_0x4c926c[_0x7d97('0x25')]][_0x4ed9de]=_0x4c926c[_0x7d97('0x2c')];}}}};Fax[_0x7d97('0x20')][_0x7d97('0x17')]=function(_0x180dc2){if(this[_0x7d97('0x10')][_0x180dc2[_0x7d97('0x25')]]){this[_0x7d97('0x10')][_0x180dc2['uniqueid']][_0x7d97('0x2d')]=_0x180dc2['channelstate'];this[_0x7d97('0x10')][_0x180dc2[_0x7d97('0x25')]]['channelstatedesc']=_0x180dc2[_0x7d97('0x2e')];}};Fax[_0x7d97('0x20')][_0x7d97('0x2f')]=function(_0x4d8e1f){if(this[_0x7d97('0x10')][_0x4d8e1f['uniqueid']]){for(var _0x207ee1 in _0x4d8e1f['variable']){if(_0x4d8e1f[_0x7d97('0x2b')]['hasOwnProperty'](_0x207ee1)){this['channels'][_0x4d8e1f[_0x7d97('0x25')]][_0x207ee1]=_0x4d8e1f['value'];}}}};Fax['prototype'][_0x7d97('0x19')]=function(_0x617020){if(this[_0x7d97('0x10')][_0x617020[_0x7d97('0x25')]]){this[_0x7d97('0x10')][_0x617020[_0x7d97('0x25')]][_0x7d97('0x30')]=_0x617020['operation'];this[_0x7d97('0x10')][_0x617020['uniqueid']][_0x7d97('0x31')]=_0x617020[_0x7d97('0x31')];this[_0x7d97('0x10')][_0x617020[_0x7d97('0x25')]][_0x7d97('0x24')]=_0x617020[_0x7d97('0x24')];this[_0x7d97('0x10')][_0x617020[_0x7d97('0x25')]]['filename']=_0x617020[_0x7d97('0x32')];logger[_0x7d97('0x29')](_0x617020['uniqueid'],_0x7d97('0x33'));}};Fax[_0x7d97('0x20')]['syncReceiveFax']=function(_0x4e4544){var _0x552b67=this;if(this[_0x7d97('0x10')][_0x4e4544[_0x7d97('0x25')]]){var _0x56cd6d=this[_0x7d97('0x10')][_0x4e4544[_0x7d97('0x25')]]['id'];this['channels'][_0x4e4544[_0x7d97('0x25')]][_0x7d97('0x34')]=_0x4e4544[_0x7d97('0x34')];this['channels'][_0x4e4544['uniqueid']][_0x7d97('0x35')]=_0x4e4544[_0x7d97('0x35')];this[_0x7d97('0x10')][_0x4e4544[_0x7d97('0x25')]]['localstationid']=_0x4e4544[_0x7d97('0x24')];this[_0x7d97('0x10')][_0x4e4544[_0x7d97('0x25')]][_0x7d97('0x36')]=_0x4e4544[_0x7d97('0x36')];this[_0x7d97('0x10')][_0x4e4544['uniqueid']]['transferrate']=_0x4e4544[_0x7d97('0x37')];this['channels'][_0x4e4544[_0x7d97('0x25')]][_0x7d97('0x32')]=_0x4e4544['filename'];this['channels'][_0x4e4544['uniqueid']][_0x7d97('0x38')]=_0x4e4544[_0x7d97('0x38')];if(this[_0x7d97('0x10')][_0x4e4544[_0x7d97('0x25')]][_0x7d97('0x35')]>0x0){tiff2pdf(_0x4e4544[_0x7d97('0x32')],_0x7d97('0x39'),function(_0x2b11d7){logger[_0x7d97('0x29')](_0x4e4544[_0x7d97('0x25')],'\x20result\x20conversion\x20file\x20',_0x2b11d7[_0x7d97('0x3a')]);attachment[_0x7d97('0x3b')]({'name':path[_0x7d97('0x3c')](_0x4e4544[_0x7d97('0x32')])[_0x7d97('0x27')],'basename':path[_0x7d97('0x3c')](_0x4e4544[_0x7d97('0x32')])[_0x7d97('0x27')]+_0x7d97('0x3d'),'type':_0x7d97('0x3e')})[_0x7d97('0x3f')](function(_0x12e6e5){faxAccount[_0x7d97('0x40')](_0x56cd6d,{'from':_0x4e4544['calleridnum'],'mapKey':_0x7d97('0x41'),'body':path['parse'](_0x4e4544[_0x7d97('0x32')])[_0x7d97('0x27')]+_0x7d97('0x3d'),'AttachmentId':_0x12e6e5['id']})[_0x7d97('0x42')](function(_0x18bbc2){logger[_0x7d97('0x43')](_0x4e4544[_0x7d97('0x25')],_0x7d97('0x44'),JSON[_0x7d97('0x45')](_0x18bbc2));});})[_0x7d97('0x42')](function(_0x1883ab){logger[_0x7d97('0x43')](_0x4e4544[_0x7d97('0x25')],'\x20receiveFax\x20',JSON['stringify'](_0x1883ab));});});}logger[_0x7d97('0x29')](_0x4e4544[_0x7d97('0x25')],'\x20receiveFax\x20');}};Fax['prototype'][_0x7d97('0x1f')]=function(_0x39e5fc){if(this[_0x7d97('0x12')][_0x39e5fc[_0x7d97('0x25')]]){_[_0x7d97('0x46')](this['channels'][_0x39e5fc['uniqueid']],_[_0x7d97('0x47')](_0x39e5fc,[_0x7d97('0x48'),_0x7d97('0x49')]));}};function updateStatus(_0x25bcbd){if(_0x25bcbd[_0x7d97('0x4a')]){faxMessage[_0x7d97('0x4b')](_0x25bcbd['AttachmentId'],{'failMessage':_0x7d97('0x4c')})[_0x7d97('0x3f')](function(_0x34244f){ut[_0x7d97('0x4d')]('[Fax][Message][Error][Updated]',_0x34244f);})[_0x7d97('0x42')](function(_0x4413c4){ut[_0x7d97('0x4d')](_0x7d97('0x4e'),_0x4413c4);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x7d97('0x20')][_0x7d97('0x4f')]=function(_0x154f24,_0x2e09db,_0x4aeb5f){var _0x13b26c=this;var _0x3b4055={};if(_0x2e09db){_0x3b4055={'read':_0x2e09db};}else{_0x3b4055={'failMessage':_0x4aeb5f};}if(this[_0x7d97('0x12')][_0x154f24]['AttachmentId']){faxMessage[_0x7d97('0x4b')](this[_0x7d97('0x12')][_0x154f24][_0x7d97('0x4a')],_0x3b4055)['then'](function(_0x1e641a){ut['logger'](_0x7d97('0x50'),_0x1e641a);})[_0x7d97('0x42')](function(_0x114ff8){ut['logger'](_0x7d97('0x51'),_0x114ff8);})[_0x7d97('0x52')](function(){delete _0x13b26c[_0x7d97('0x10')][_0x154f24];delete _0x13b26c[_0x7d97('0x12')][_0x154f24];});}else{ut[_0x7d97('0x4d')](_0x7d97('0x53'));this['deleteChannelAfterTimeout'](_0x154f24);delete this[_0x7d97('0x12')][_0x154f24];}};Fax[_0x7d97('0x20')]['syncHangup']=function(_0x3b417a){var _0x1f529c=this;if(this['channels'][_0x3b417a[_0x7d97('0x25')]]){if(this[_0x7d97('0x12')][_0x3b417a[_0x7d97('0x25')]]){this[_0x7d97('0x10')][_0x3b417a['uniqueid']]['id']=this[_0x7d97('0x12')][_0x3b417a[_0x7d97('0x25')]]['id'];this[_0x7d97('0x10')][_0x3b417a[_0x7d97('0x25')]]['name']=this[_0x7d97('0x12')][_0x3b417a[_0x7d97('0x25')]][_0x7d97('0x27')];}logger[_0x7d97('0x29')](_0x3b417a[_0x7d97('0x25')],this[_0x7d97('0x12')][_0x3b417a[_0x7d97('0x25')]]?'\x20hangup\x20sendFile\x20':_0x7d97('0x54'),JSON['stringify'](this[_0x7d97('0x10')][_0x3b417a[_0x7d97('0x25')]]));if(this[_0x7d97('0x12')][_0x3b417a[_0x7d97('0x25')]]){if(this[_0x7d97('0x10')][_0x3b417a[_0x7d97('0x25')]][_0x7d97('0x55')]>0x0&&this['channels'][_0x3b417a[_0x7d97('0x25')]][_0x7d97('0x18')]===_0x7d97('0x56')){this[_0x7d97('0x4f')](_0x3b417a[_0x7d97('0x25')],!![]);}else{this[_0x7d97('0x4f')](_0x3b417a['uniqueid'],![],this[_0x7d97('0x10')][_0x3b417a[_0x7d97('0x25')]][_0x7d97('0x57')]?_0x7d97('0x58')+this[_0x7d97('0x10')][_0x3b417a[_0x7d97('0x25')]][_0x7d97('0x57')]:_0x7d97('0x59'));}}}};Fax[_0x7d97('0x20')][_0x7d97('0x5a')]=function(_0x28ae1b){var _0x1ac58d=this;return new BPromise(function(_0x105997,_0x3854f5){_0x1ac58d[_0x7d97('0x5b')](_0x28ae1b,_0x1ac58d['faxAccounts'][_0x28ae1b[_0x7d97('0x5c')]])['then'](function(_0x5967c6){ut[_0x7d97('0x4d')]('[Fax][execOriginate][success]',_0x5967c6);_0x105997(ut['message'](_0x7d97('0x5d')));})[_0x7d97('0x42')](function(_0x18d69e){ut['logger'](_0x7d97('0x5e'),_0x18d69e);updateStatus(_0x28ae1b);_0x3854f5(ut['message'](_0x7d97('0x5f')));});});};Fax[_0x7d97('0x20')]['checkAfterSend']=function(_0x28da57){var _0x3625e7=this;return new BPromise(function(_0x114559,_0x51259f){var _0x17c988=_0x3625e7[_0x7d97('0x60')](_0x3625e7[_0x7d97('0x11')][_0x28da57['FaxAccountId']][_0x7d97('0x61')],_0x28da57);if(_0x17c988[_0x7d97('0x62')]){_0x114559(ut[_0x7d97('0x3a')](_0x7d97('0x63')));}else{_0x51259f(ut[_0x7d97('0x3a')](_0x17c988[_0x7d97('0x3a')]));}});};function originate(_0x2c29f0,_0xfc3972,_0x177bd7){return new BPromise(function(_0x4ad69e,_0x3e7512){if(_0x177bd7){var _0x2397d8=util[_0x7d97('0x64')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x2c29f0['path'])[_0x7d97('0x27')],_0x2c29f0[_0x7d97('0x5')]);gs[_0x7d97('0x65')](_0x2397d8)[_0x7d97('0x3f')](function(){_0x2c29f0[_0x7d97('0x5')]=util[_0x7d97('0x64')](_0x7d97('0x66'),path[_0x7d97('0x3c')](_0x2c29f0[_0x7d97('0x5')])[_0x7d97('0x67')],path[_0x7d97('0x3c')](_0x2c29f0['path'])['name']);_0xfc3972[_0x7d97('0x68')]=_0x2c29f0[_0x7d97('0x5')];ut[_0x7d97('0x4d')](_0x7d97('0x69'),'');ami['Action'](ut[_0x7d97('0x6a')](_0x2c29f0,_0xfc3972))['then'](function(_0x272970){_0x4ad69e(_0x272970);})[_0x7d97('0x42')](function(_0x2d9c79){_0x3e7512(_0x2d9c79);});})[_0x7d97('0x42')](function(_0x5ea632){_0x3e7512(_0x5ea632);});}else{ami['Action'](ut[_0x7d97('0x6a')](_0x2c29f0,_0xfc3972))[_0x7d97('0x3f')](function(_0x21fce9){_0x4ad69e(_0x21fce9);})[_0x7d97('0x42')](function(_0x46ef90){_0x3e7512(_0x46ef90);});}});}Fax[_0x7d97('0x20')][_0x7d97('0x5b')]=function(_0x44aef2,_0x2a92b0){var _0x1682c4=this;return new BPromise(function(_0x2f4c6a,_0x19cedc){var _0xb9d808=uuid['v4']();var _0x1f3f51=ut['addVariables'](_0x44aef2,_0x2a92b0);_0x1682c4[_0x7d97('0x12')][_0xb9d808]=new Action(_0xb9d808,_0x2a92b0,_0x44aef2);var _0x2829fc=_0x1682c4[_0x7d97('0x12')][_0xb9d808];if(path[_0x7d97('0x3c')](_0x44aef2[_0x7d97('0x5')])[_0x7d97('0x6b')]==='.pdf'){originate(_0x2829fc,_0x1f3f51,!![])[_0x7d97('0x3f')](function(_0x1a8018){_0x2f4c6a(_0x1a8018);})[_0x7d97('0x42')](function(_0xd39925){_0x19cedc(_0xd39925);});}else{originate(_0x2829fc,_0x1f3f51,![])['then'](function(_0x334b18){_0x2f4c6a(_0x334b18);})['catch'](function(_0x1d8a69){_0x19cedc(_0x1d8a69);});}});};Fax[_0x7d97('0x20')][_0x7d97('0x6c')]=function(_0x171f0f){return!_[_0x7d97('0x6d')](_0x171f0f)&&!_['isNil'](_0x171f0f[_0x7d97('0x27')])&&!_['isNil'](_0x171f0f[_0x7d97('0x6e')])&&_0x171f0f['active']&&!_[_0x7d97('0x6d')](this['trunks'][util[_0x7d97('0x64')](_0x7d97('0x6f'),_0x171f0f[_0x7d97('0x27')])])&&!_['isNil'](this[_0x7d97('0x70')][util[_0x7d97('0x64')](_0x7d97('0x6f'),_0x171f0f[_0x7d97('0x27')])][_0x7d97('0x31')])&&(this[_0x7d97('0x70')][util['format'](_0x7d97('0x6f'),_0x171f0f[_0x7d97('0x27')])][_0x7d97('0x31')]===_0x7d97('0x71')||this['trunks'][util['format']('SIP/%s',_0x171f0f[_0x7d97('0x27')])][_0x7d97('0x31')]===_0x7d97('0x72'));};Fax[_0x7d97('0x20')]['checkTrunk']=function(_0x50581c,_0x4a0caf){if(!this[_0x7d97('0x6c')](_0x50581c)){ut[_0x7d97('0x4d')](_0x7d97('0x73'),_['isNil'](_0x50581c)?'':_0x50581c[_0x7d97('0x27')]+_0x7d97('0x74'));return{'isValid':![],'message':_0x7d97('0x75')};}if(_[_0x7d97('0x6d')](_0x4a0caf[_0x7d97('0x41')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x7d97('0x45')](_0x4a0caf));return{'isValid':![],'message':_0x7d97('0x76')};}if(_['isNil'](_0x4a0caf[_0x7d97('0x5')])){ut[_0x7d97('0x4d')](_0x7d97('0x77'),JSON[_0x7d97('0x45')](_0x4a0caf));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x7d97('0x78')};};Fax['prototype'][_0x7d97('0x79')]=function(_0x1e8fb7,_0x27dd86=0x2710){if(this[_0x7d97('0x10')][_0x1e8fb7]){setTimeout(()=>{delete this[_0x7d97('0x10')][_0x1e8fb7];},_0x27dd86);}};module[_0x7d97('0x7a')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 139418a..26293cb 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 _0xcd7a=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util'];(function(_0x3bf043,_0x439342){var _0x35a484=function(_0x3ad0ab){while(--_0x3ad0ab){_0x3bf043['push'](_0x3bf043['shift']());}};_0x35a484(++_0x439342);}(_0xcd7a,0x154));var _0xacd7=function(_0x399837,_0x56edf2){_0x399837=_0x399837-0x0;var _0x18fed4=_0xcd7a[_0x399837];return _0x18fed4;};'use strict';var util=require(_0xacd7('0x0'));var BPromise=require('bluebird');var logger=require(_0xacd7('0x1'))(_0xacd7('0x2'));var _=require(_0xacd7('0x3'));var faxAccount=require(_0xacd7('0x4'));function loggerCatch(_0x18e3ec){return function(_0x274864){logger[_0xacd7('0x5')](_0x18e3ec,util[_0xacd7('0x6')](_0x274864,{'showHidden':![],'depth':null}));};}exports[_0xacd7('0x7')]=function(_0x5871bf,_0x1956ef){return BPromise[_0xacd7('0x8')]()[_0xacd7('0x9')](faxAccount[_0xacd7('0x7')](_0x5871bf,_0x1956ef))['catch'](loggerCatch(_0xacd7('0xa')));}; \ No newline at end of file +var _0x5be9=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','resolve','then','notify'];(function(_0xfc34d7,_0x436fdf){var _0x15c5f7=function(_0x135410){while(--_0x135410){_0xfc34d7['push'](_0xfc34d7['shift']());}};_0x15c5f7(++_0x436fdf);}(_0x5be9,0x1a4));var _0x95be=function(_0x2c62ca,_0x3ff9f3){_0x2c62ca=_0x2c62ca-0x0;var _0x17294b=_0x5be9[_0x2c62ca];return _0x17294b;};'use strict';var util=require(_0x95be('0x0'));var BPromise=require(_0x95be('0x1'));var logger=require(_0x95be('0x2'))(_0x95be('0x3'));var _=require('lodash');var faxAccount=require(_0x95be('0x4'));function loggerCatch(_0x316155){return function(_0x3fef9e){logger['error'](_0x316155,util[_0x95be('0x5')](_0x3fef9e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4675bc,_0x5887bf){return BPromise[_0x95be('0x6')]()[_0x95be('0x7')](faxAccount[_0x95be('0x8')](_0x4675bc,_0x5887bf))[_0x95be('0x9')](loggerCatch(_0x95be('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9911fc8..a44aad5 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 _0xa8f7=['Exec\x20gs','info','fax','bluebird','child_process'];(function(_0x57acf8,_0x5cc0e0){var _0x2b5a45=function(_0x490306){while(--_0x490306){_0x57acf8['push'](_0x57acf8['shift']());}};_0x2b5a45(++_0x5cc0e0);}(_0xa8f7,0x1d3));var _0x7a8f=function(_0x51a036,_0x208d6f){_0x51a036=_0x51a036-0x0;var _0x202911=_0xa8f7[_0x51a036];return _0x202911;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x7a8f('0x0'));var BPromise=require(_0x7a8f('0x1'));var exec=require(_0x7a8f('0x2'))['exec'];exports['execute']=function(_0x1866c5){return new BPromise(function(_0x395857,_0x141022){exec(_0x1866c5,function(_0x4fcdd4,_0x27f80b,_0x24ac32){logger['info'](_0x7a8f('0x3'),_0x27f80b);if(_0x4fcdd4){logger[_0x7a8f('0x4')](_0x7a8f('0x3'),'\x20Error\x20:',util['inspect'](_0x4fcdd4,{'showHidden':![],'depth':null}),_0x27f80b,_0x24ac32);_0x141022(_0x4fcdd4);}_0x395857(_0x27f80b);});});}; \ No newline at end of file +var _0x47ff=['inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x9eeea2,_0x2fb0d3){var _0x19b327=function(_0x5db4f1){while(--_0x5db4f1){_0x9eeea2['push'](_0x9eeea2['shift']());}};_0x19b327(++_0x2fb0d3);}(_0x47ff,0x1b9));var _0xf47f=function(_0x1a30c7,_0x5d5441){_0x1a30c7=_0x1a30c7-0x0;var _0x3be1e6=_0x47ff[_0x1a30c7];return _0x3be1e6;};'use strict';var util=require(_0xf47f('0x0'));var logger=require(_0xf47f('0x1'))(_0xf47f('0x2'));var BPromise=require(_0xf47f('0x3'));var exec=require('child_process')[_0xf47f('0x4')];exports[_0xf47f('0x5')]=function(_0x3a2675){return new BPromise(function(_0x536fe9,_0x4a753d){exec(_0x3a2675,function(_0x5c1ebb,_0x1919e7,_0x3f4a65){logger[_0xf47f('0x6')](_0xf47f('0x7'),_0x1919e7);if(_0x5c1ebb){logger[_0xf47f('0x6')](_0xf47f('0x7'),_0xf47f('0x8'),util[_0xf47f('0x9')](_0x5c1ebb,{'showHidden':![],'depth':null}),_0x1919e7,_0x3f4a65);_0x4a753d(_0x5c1ebb);}_0x536fe9(_0x1919e7);});});}; \ 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 f08e836..be18418 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 _0x54da=['localstationid','path','variablesAction','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x4c1f9c,_0x517d17){var _0x1307b5=function(_0x48b055){while(--_0x48b055){_0x4c1f9c['push'](_0x4c1f9c['shift']());}};_0x1307b5(++_0x517d17);}(_0x54da,0x180));var _0xa54d=function(_0x32f05c,_0x273aef){_0x32f05c=_0x32f05c-0x0;var _0x4307ed=_0x54da[_0x32f05c];return _0x4307ed;};'use strict';var util=require(_0xa54d('0x0'));var _=require(_0xa54d('0x1'));var moment=require(_0xa54d('0x2'));var logger=require('../../../../config/logger')(_0xa54d('0x3'));exports[_0xa54d('0x4')]=function(_0x267219){return{'message':_0x267219};};exports[_0xa54d('0x5')]=function(_0xd558cf,_0x1771e6){logger[_0xa54d('0x6')](_0xd558cf,util[_0xa54d('0x7')](_0x1771e6,{'showHidden':![],'depth':null}));};exports[_0xa54d('0x8')]=function(_0x1c03e1,_0x3fd19c){var _0x377b29={'XMF-ECM':_0x3fd19c['ecm'],'XMF-HEADERINFO':_0x3fd19c[_0xa54d('0x9')],'XMF-MINRATE':_0x3fd19c[_0xa54d('0xa')],'XMF-MAXRATE':_0x3fd19c[_0xa54d('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x3fd19c[_0xa54d('0xc')]),'XMF-GATEWAY':_0x3fd19c[_0xa54d('0xd')],'XMF-FAXDETECT':_0x3fd19c[_0xa54d('0xe')],'XMF-T38TIMEOUT':_0x3fd19c[_0xa54d('0xf')],'XMF-LOCALSTATIONID':_0x3fd19c[_0xa54d('0x10')],'XMF-PATH':_0x1c03e1[_0xa54d('0x11')]};return _0x377b29;};exports[_0xa54d('0x12')]=function(_0x4f9b5c,_0x3a3013){return{'actionid':_0x4f9b5c['uniqueid'],'action':'originate','channel':_0x4f9b5c[_0xa54d('0x13')],'Exten':_0xa54d('0x14'),'Context':_0xa54d('0x15'),'Priority':'1','callerid':util[_0xa54d('0x16')](_0xa54d('0x17'),_0x4f9b5c[_0xa54d('0x9')]?_0x4f9b5c[_0xa54d('0x9')]:'',_0x4f9b5c[_0xa54d('0x10')]),'variable':_0x3a3013,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4f9b5c[_0xa54d('0x18')]};}; \ No newline at end of file +var _0xccee=['moment','../../../../config/logger','message','info','addVariables','headerinfo','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','util','lodash'];(function(_0x46f287,_0x362aa6){var _0x2d72d6=function(_0x2ef14b){while(--_0x2ef14b){_0x46f287['push'](_0x46f287['shift']());}};_0x2d72d6(++_0x362aa6);}(_0xccee,0x1de));var _0xecce=function(_0x2f1fc1,_0x6f0a8a){_0x2f1fc1=_0x2f1fc1-0x0;var _0x56c278=_0xccee[_0x2f1fc1];return _0x56c278;};'use strict';var util=require(_0xecce('0x0'));var _=require(_0xecce('0x1'));var moment=require(_0xecce('0x2'));var logger=require(_0xecce('0x3'))('fax');exports[_0xecce('0x4')]=function(_0x2da3c4){return{'message':_0x2da3c4};};exports['logger']=function(_0x3bb2b7,_0x3c303b){logger[_0xecce('0x5')](_0x3bb2b7,util['inspect'](_0x3c303b,{'showHidden':![],'depth':null}));};exports[_0xecce('0x6')]=function(_0x4c5aff,_0x256bb7){var _0x23a733={'XMF-ECM':_0x256bb7['ecm'],'XMF-HEADERINFO':_0x256bb7[_0xecce('0x7')],'XMF-MINRATE':_0x256bb7['minrate'],'XMF-MAXRATE':_0x256bb7['maxrate'],'XMF-MODEM':util[_0xecce('0x8')](_0xecce('0x9'),_0x256bb7[_0xecce('0xa')]),'XMF-GATEWAY':_0x256bb7['gateway'],'XMF-FAXDETECT':_0x256bb7[_0xecce('0xb')],'XMF-T38TIMEOUT':_0x256bb7[_0xecce('0xc')],'XMF-LOCALSTATIONID':_0x256bb7[_0xecce('0xd')],'XMF-PATH':_0x4c5aff[_0xecce('0xe')]};return _0x23a733;};exports[_0xecce('0xf')]=function(_0x740217,_0x145b9a){return{'actionid':_0x740217[_0xecce('0x10')],'action':_0xecce('0x11'),'channel':_0x740217[_0xecce('0x12')],'Exten':'xcally-motion-fax','Context':_0xecce('0x13'),'Priority':'1','callerid':util[_0xecce('0x8')]('\x22%s\x22\x20<%s>',_0x740217[_0xecce('0x7')]?_0x740217['headerinfo']:'',_0x740217[_0xecce('0xd')]),'variable':_0x145b9a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x740217[_0xecce('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f9ce676..6c22c33 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 _0x4a22=['sync','catch','util','moment','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','get','hour','then','initAgents','getTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','listen'];(function(_0x439892,_0x2c1700){var _0x3fe156=function(_0x4ce6c8){while(--_0x4ce6c8){_0x439892['push'](_0x439892['shift']());}};_0x3fe156(++_0x2c1700);}(_0x4a22,0x11e));var _0x24a2=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x4a22[_0x5627e1];return _0x2f013f;};'use strict';var util=require(_0x24a2('0x0'));var moment=require(_0x24a2('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x24a2('0x2'));var Trigger=require(_0x24a2('0x3'));var Dialer=require(_0x24a2('0x4'));var Preview=require(_0x24a2('0x5'));var Fax=require(_0x24a2('0x6'));var user=require(_0x24a2('0x7'));var voiceQueue=require(_0x24a2('0x8'));var voiceQueueReport=require(_0x24a2('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x24a2('0xa'));var trigger=require(_0x24a2('0xb'));var template=require(_0x24a2('0xc'));var cmHopperHistory=require(_0x24a2('0xd'));var campaign=require(_0x24a2('0xe'));var voiceExtension=require(_0x24a2('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x24a2('0x10'));var sugarcrm=require(_0x24a2('0x11'));var freshdesk=require(_0x24a2('0x12'));var desk=require(_0x24a2('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x24a2('0x14'));var freshsales=require(_0x24a2('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x24a2('0x16'))(_0x24a2('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x24a2('0x18')](_0x24a2('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x24a2('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x24a2('0x1a')](user['getAgents']())['then'](realtime[_0x24a2('0x1b')]())[_0x24a2('0x1a')](user[_0x24a2('0x1c')]())['then'](realtime['initTelephones']())[_0x24a2('0x1a')](trunk['getTrunks']())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x24a2('0x1d')]())['then'](realtime[_0x24a2('0x1e')]())[_0x24a2('0x1a')](trigger[_0x24a2('0x1f')]())['then'](realtime[_0x24a2('0x20')]())[_0x24a2('0x1a')](template[_0x24a2('0x21')]())['then'](realtime[_0x24a2('0x22')]())['then'](zendesk[_0x24a2('0x23')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x24')]())[_0x24a2('0x1a')](salesforce[_0x24a2('0x25')]())['then'](realtime[_0x24a2('0x26')]())[_0x24a2('0x1a')](sugarcrm[_0x24a2('0x27')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x28')]())['then'](freshdesk[_0x24a2('0x29')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x2a')]())['then'](desk[_0x24a2('0x2b')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x2c')]())[_0x24a2('0x1a')](zoho['getZohoAccounts']())['then'](realtime[_0x24a2('0x2d')]())[_0x24a2('0x1a')](vtiger[_0x24a2('0x2e')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x2f')]())[_0x24a2('0x1a')](freshsales[_0x24a2('0x30')]())['then'](realtime[_0x24a2('0x31')]())['then'](servicenow[_0x24a2('0x32')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x33')]())[_0x24a2('0x1a')](dynamics365[_0x24a2('0x34')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x35')]())[_0x24a2('0x1a')](campaign[_0x24a2('0x36')]())['then'](realtime[_0x24a2('0x37')]())[_0x24a2('0x1a')](voiceExtension['getVoiceExtensions']())[_0x24a2('0x1a')](realtime[_0x24a2('0x38')]())['then'](faxAccount[_0x24a2('0x39')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x3a')]())[_0x24a2('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x24a2('0x3b')]()[_0x24a2('0x1a')](voiceQueueReport[_0x24a2('0x3c')]())[_0x24a2('0x1a')](realtime['initVoiceQueueReports']())[_0x24a2('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x24a2('0x1a')](realtime[_0x24a2('0x3d')]())[_0x24a2('0x1a')](cmHopperHistory[_0x24a2('0x3e')]())[_0x24a2('0x1a')](realtime[_0x24a2('0x3f')]())[_0x24a2('0x1a')](voiceCallReport[_0x24a2('0x40')]())['then'](realtime[_0x24a2('0x41')]())['catch'](function(_0x1e5863){logger[_0x24a2('0x42')](_0x24a2('0x43'),util['inspect'](_0x1e5863,{'showHidden':![],'depth':null}));});}function main(){return server[_0x24a2('0x44')](realtime,preview,fax)[_0x24a2('0x1a')](function(){return initRealtime();})[_0x24a2('0x1a')](function(){return initParams();})[_0x24a2('0x1a')](function(){report[_0x24a2('0x45')]();setInterval(initRealtime,0x1388);})[_0x24a2('0x46')](function(_0x214148){logger['error']('[index.js][main]',util['inspect'](_0x214148,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4a7c=['./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','hour','get','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','inspect','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trigger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a7c,0x111));var _0xc4a7=function(_0x16dc50,_0x1aa28c){_0x16dc50=_0x16dc50-0x0;var _0x3d5afa=_0x4a7c[_0x16dc50];return _0x3d5afa;};'use strict';var util=require('util');var moment=require(_0xc4a7('0x0'));var server=require('./server');var Realtime=require(_0xc4a7('0x1'));var Report=require(_0xc4a7('0x2'));var Acw=require(_0xc4a7('0x3'));var Trigger=require(_0xc4a7('0x4'));var Dialer=require(_0xc4a7('0x5'));var Preview=require(_0xc4a7('0x6'));var Fax=require(_0xc4a7('0x7'));var user=require(_0xc4a7('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc4a7('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0xc4a7('0xa'));var template=require(_0xc4a7('0xb'));var cmHopperHistory=require(_0xc4a7('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xc4a7('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc4a7('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xc4a7('0xf'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc4a7('0x10'));var vtiger=require(_0xc4a7('0x11'));var freshsales=require(_0xc4a7('0x12'));var servicenow=require(_0xc4a7('0x13'));var dynamics365=require(_0xc4a7('0x14'));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(_0xc4a7('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xc4a7('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc4a7('0x17')](_0xc4a7('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xc4a7('0x18')]()[_0xc4a7('0x19')](user[_0xc4a7('0x1a')]())[_0xc4a7('0x19')](realtime['initAgents']())[_0xc4a7('0x19')](user[_0xc4a7('0x1b')]())['then'](realtime[_0xc4a7('0x1c')]())[_0xc4a7('0x19')](trunk[_0xc4a7('0x1d')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x1e')]())['then'](voiceQueue[_0xc4a7('0x1f')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x20')]())[_0xc4a7('0x19')](trigger[_0xc4a7('0x21')]())['then'](realtime[_0xc4a7('0x22')]())[_0xc4a7('0x19')](template[_0xc4a7('0x23')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x24')]())['then'](zendesk[_0xc4a7('0x25')]())['then'](realtime[_0xc4a7('0x26')]())[_0xc4a7('0x19')](salesforce['getSalesforceAccounts']())[_0xc4a7('0x19')](realtime[_0xc4a7('0x27')]())[_0xc4a7('0x19')](sugarcrm[_0xc4a7('0x28')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x29')]())[_0xc4a7('0x19')](freshdesk[_0xc4a7('0x2a')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x2b')]())[_0xc4a7('0x19')](desk[_0xc4a7('0x2c')]())['then'](realtime[_0xc4a7('0x2d')]())[_0xc4a7('0x19')](zoho[_0xc4a7('0x2e')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x2f')]())[_0xc4a7('0x19')](vtiger[_0xc4a7('0x30')]())['then'](realtime[_0xc4a7('0x31')]())[_0xc4a7('0x19')](freshsales[_0xc4a7('0x32')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x33')]())[_0xc4a7('0x19')](servicenow[_0xc4a7('0x34')]())['then'](realtime[_0xc4a7('0x35')]())[_0xc4a7('0x19')](dynamics365['getDynamics365Accounts']())[_0xc4a7('0x19')](realtime[_0xc4a7('0x36')]())[_0xc4a7('0x19')](campaign[_0xc4a7('0x37')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x38')]())['then'](voiceExtension[_0xc4a7('0x39')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x3a')]())[_0xc4a7('0x19')](faxAccount['getFaxAccounts']())[_0xc4a7('0x19')](realtime['initFaxAccounts']())[_0xc4a7('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xc4a7('0x18')]()['then'](voiceQueueReport[_0xc4a7('0x3b')]())[_0xc4a7('0x19')](realtime[_0xc4a7('0x3c')]())[_0xc4a7('0x19')](cmHopperHistory[_0xc4a7('0x3d')]())['then'](realtime[_0xc4a7('0x3e')]())[_0xc4a7('0x19')](cmHopperHistory[_0xc4a7('0x3f')]())[_0xc4a7('0x19')](realtime['initCampaignHopperHistory']())[_0xc4a7('0x19')](voiceCallReport['getVoiceCallReports']())[_0xc4a7('0x19')](realtime[_0xc4a7('0x40')]())[_0xc4a7('0x41')](function(_0x2c50af){logger[_0xc4a7('0x42')](_0xc4a7('0x43'),util['inspect'](_0x2c50af,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc4a7('0x44')](realtime,preview,fax)[_0xc4a7('0x19')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xc4a7('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xc4a7('0x41')](function(_0x1906d1){logger[_0xc4a7('0x42')](_0xc4a7('0x45'),util[_0xc4a7('0x46')](_0x1906d1,{'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 e98f425..fa61a47 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 _0x86af=['accountcode','state','unknown','stateTime','address','phone','mobile','online','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','voiceStatusTime','toNumber','format','name','fullname','status','stringify','user:%s','user:ami:update','omit','emit','lodash','util','md5','ioredis','redis','localhost','socket.io-emitter','email'];(function(_0x1afc81,_0x4114a6){var _0x6a34a8=function(_0x21857e){while(--_0x21857e){_0x1afc81['push'](_0x1afc81['shift']());}};_0x6a34a8(++_0x4114a6);}(_0x86af,0x6a));var _0xf86a=function(_0x2c0421,_0xa30722){_0x2c0421=_0x2c0421-0x0;var _0x25a09e=_0x86af[_0x2c0421];return _0x25a09e;};'use strict';var _=require(_0xf86a('0x0'));var util=require(_0xf86a('0x1'));var moment=require('moment');var md5=require(_0xf86a('0x2'));var Redis=require(_0xf86a('0x3'));var config=require('../../../config/environment');config[_0xf86a('0x4')]=_['defaults'](config[_0xf86a('0x4')],{'host':_0xf86a('0x5'),'port':0x18eb});var io=require(_0xf86a('0x6'))(new Redis(config['redis']));function Agent(_0x401347){this['id']=_0x401347['id']||0x0;this['name']=_0x401347['name']||'';this['email']=_0x401347[_0xf86a('0x7')]||'';this['accountcode']=_0x401347[_0xf86a('0x8')]||'';this['fullname']=_0x401347['fullname']||'';this[_0xf86a('0x9')]=_0xf86a('0xa');this[_0xf86a('0xb')]=0x0;this['status']=_0xf86a('0xa');this[_0xf86a('0xc')]='';this[_0xf86a('0xd')]='';this[_0xf86a('0xe')]='';this['interface']='';this[_0xf86a('0xf')]=_0x401347[_0xf86a('0xf')]||![];this['voiceStatus']=_0xf86a('0xa');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0xf86a('0x10')]='';this[_0xf86a('0x11')]=![];this[_0xf86a('0x12')]=![];this[_0xf86a('0x2')]='';}Agent[_0xf86a('0x13')][_0xf86a('0x14')]=function(_0x20d3ab){var _0x58a11f;if(_0x20d3ab&&_0x20d3ab[_0xf86a('0x9')]){_0x58a11f=_0x20d3ab[_0xf86a('0x9')][_0xf86a('0x15')]();switch(_0x58a11f){case _0xf86a('0x16'):_0x58a11f=_0xf86a('0x17');break;case _0xf86a('0x18'):_0x58a11f=_0xf86a('0x19');break;}}if(_0x58a11f&&this['voiceStatus']!==_0x58a11f||_0x20d3ab[_0xf86a('0x1a')]){this[_0xf86a('0x1b')]=_[_0xf86a('0x1c')](moment()[_0xf86a('0x1d')]('x'));}if(_0x58a11f){this['voiceStatus']=_0x58a11f;}var _0xfb5b7={'id':this['id'],'name':this[_0xf86a('0x1e')],'email':this[_0xf86a('0x7')],'accountcode':this[_0xf86a('0x8')],'fullname':this[_0xf86a('0x1f')],'state':this[_0xf86a('0x9')],'stateTime':this['stateTime'],'status':this[_0xf86a('0x20')],'address':this[_0xf86a('0xc')],'online':this[_0xf86a('0xf')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xf86a('0x10')],'interface':this['interface'],'onhold':this[_0xf86a('0x11')]};var _0x2e7a4a=md5(JSON[_0xf86a('0x21')](_0xfb5b7));if(this[_0xf86a('0x2')]!==_0x2e7a4a){this[_0xf86a('0x2')]=_0x2e7a4a;io['to'](util[_0xf86a('0x1d')](_0xf86a('0x22'),_0xfb5b7['name']))['emit'](_0xf86a('0x23'),_[_0xf86a('0x24')](_0xfb5b7,[_0xf86a('0xf')]));io[_0xf86a('0x25')]('user:presence',_0xfb5b7);}};module['exports']=Agent; \ No newline at end of file +var _0x5763=['exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','not_inuse','idle','inuse','statePause','toNumber','format','interface','stringify','user:%s','user:ami:update','omit','emit','user:presence'];(function(_0x34ecbf,_0x210898){var _0x115f8a=function(_0x559567){while(--_0x559567){_0x34ecbf['push'](_0x34ecbf['shift']());}};_0x115f8a(++_0x210898);}(_0x5763,0xfd));var _0x3576=function(_0x1e1a42,_0x2b3c46){_0x1e1a42=_0x1e1a42-0x0;var _0x43d5de=_0x5763[_0x1e1a42];return _0x43d5de;};'use strict';var _=require(_0x3576('0x0'));var util=require(_0x3576('0x1'));var moment=require(_0x3576('0x2'));var md5=require(_0x3576('0x3'));var Redis=require(_0x3576('0x4'));var config=require(_0x3576('0x5'));config[_0x3576('0x6')]=_['defaults'](config[_0x3576('0x6')],{'host':_0x3576('0x7'),'port':0x18eb});var io=require(_0x3576('0x8'))(new Redis(config[_0x3576('0x6')]));function Agent(_0x313442){this['id']=_0x313442['id']||0x0;this[_0x3576('0x9')]=_0x313442[_0x3576('0x9')]||'';this[_0x3576('0xa')]=_0x313442[_0x3576('0xa')]||'';this[_0x3576('0xb')]=_0x313442[_0x3576('0xb')]||'';this['fullname']=_0x313442[_0x3576('0xc')]||'';this['state']=_0x3576('0xd');this[_0x3576('0xe')]=0x0;this[_0x3576('0xf')]=_0x3576('0xd');this[_0x3576('0x10')]='';this[_0x3576('0x11')]='';this['mobile']='';this['interface']='';this[_0x3576('0x12')]=_0x313442['online']||![];this[_0x3576('0x13')]=_0x3576('0xd');this[_0x3576('0x14')]=0x0;this[_0x3576('0x15')]='';this[_0x3576('0x16')]='';this[_0x3576('0x17')]=![];this[_0x3576('0x18')]=![];this[_0x3576('0x3')]='';}Agent[_0x3576('0x19')][_0x3576('0x1a')]=function(_0x41b4d6){var _0x1f1bbe;if(_0x41b4d6&&_0x41b4d6[_0x3576('0x1b')]){_0x1f1bbe=_0x41b4d6['state']['toLowerCase']();switch(_0x1f1bbe){case _0x3576('0x1c'):_0x1f1bbe=_0x3576('0x1d');break;case _0x3576('0x1e'):_0x1f1bbe='talking';break;}}if(_0x1f1bbe&&this[_0x3576('0x13')]!==_0x1f1bbe||_0x41b4d6[_0x3576('0x1f')]){this[_0x3576('0x14')]=_[_0x3576('0x20')](moment()[_0x3576('0x21')]('x'));}if(_0x1f1bbe){this[_0x3576('0x13')]=_0x1f1bbe;}var _0x1bd71f={'id':this['id'],'name':this[_0x3576('0x9')],'email':this[_0x3576('0xa')],'accountcode':this[_0x3576('0xb')],'fullname':this[_0x3576('0xc')],'state':this['state'],'stateTime':this[_0x3576('0xe')],'status':this['status'],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3576('0x14')],'voiceStatusCallerIdNumber':this[_0x3576('0x15')],'voiceStatusQueue':this[_0x3576('0x16')],'interface':this[_0x3576('0x22')],'onhold':this[_0x3576('0x17')]};var _0x380673=md5(JSON[_0x3576('0x23')](_0x1bd71f));if(this[_0x3576('0x3')]!==_0x380673){this[_0x3576('0x3')]=_0x380673;io['to'](util[_0x3576('0x21')](_0x3576('0x24'),_0x1bd71f['name']))['emit'](_0x3576('0x25'),_[_0x3576('0x26')](_0x1bd71f,[_0x3576('0x12')]));io[_0x3576('0x27')](_0x3576('0x28'),_0x1bd71f);}};module[_0x3576('0x29')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 59e7bad..42ed9df 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 _0x444e=['ivrAnswerCallsDay','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x444e,0x152));var _0xe444=function(_0x313474,_0x4b3fdb){_0x313474=_0x313474-0x0;var _0x2ecb81=_0x444e[_0x313474];return _0x2ecb81;};'use strict';function Campaign(_0x55a1e9){this['id']=_0x55a1e9['id']||0x0;this[_0xe444('0x0')]=_0x55a1e9['name']||'';this[_0xe444('0x1')]=_0x55a1e9[_0xe444('0x1')]||_0xe444('0x2');this[_0xe444('0x3')]=0x0;this[_0xe444('0x4')]=0x0;this[_0xe444('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0xe444('0x6')]=_0x55a1e9['active'];this[_0xe444('0x7')]=_0x55a1e9[_0xe444('0x7')];this[_0xe444('0x8')]=_0x55a1e9[_0xe444('0x8')]||null;this[_0xe444('0x9')]=_0x55a1e9[_0xe444('0x9')]?_0x55a1e9[_0xe444('0x9')]:null;this[_0xe444('0xa')]=_0x55a1e9[_0xe444('0xa')];this[_0xe444('0xb')]=_0x55a1e9[_0xe444('0xb')];this[_0xe444('0xc')]=_0x55a1e9['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x55a1e9[_0xe444('0xd')];this[_0xe444('0xe')]=_0x55a1e9[_0xe444('0xe')];this[_0xe444('0xf')]=_0x55a1e9[_0xe444('0xf')];this[_0xe444('0x10')]=_0x55a1e9[_0xe444('0x10')];this[_0xe444('0x11')]=_0x55a1e9[_0xe444('0x11')];this[_0xe444('0x12')]=_0x55a1e9[_0xe444('0x12')];this[_0xe444('0x13')]=_0x55a1e9[_0xe444('0x13')];this[_0xe444('0x14')]=_0x55a1e9['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x55a1e9['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe444('0x15')]=_0x55a1e9[_0xe444('0x15')]||0x3;this[_0xe444('0x16')]=_0x55a1e9[_0xe444('0x16')]||0x96;this[_0xe444('0x17')]=_0x55a1e9[_0xe444('0x17')]||0x3;this[_0xe444('0x18')]=_0x55a1e9[_0xe444('0x18')]||0x96;this[_0xe444('0x19')]=_0x55a1e9[_0xe444('0x19')]||0x3;this[_0xe444('0x1a')]=_0x55a1e9[_0xe444('0x1a')]||0x96;this[_0xe444('0x1b')]=_0x55a1e9[_0xe444('0x1b')]||0x3;this[_0xe444('0x1c')]=_0x55a1e9[_0xe444('0x1c')]||0x96;this[_0xe444('0x1d')]=_0x55a1e9['dialOrderByScheduledAt']||_0xe444('0x1e');this[_0xe444('0x1f')]=_0x55a1e9['dialPrefix']||undefined;this[_0xe444('0x20')]=_0x55a1e9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xe444('0x21')]=_0x55a1e9['dialCutDigit']||undefined;this[_0xe444('0x22')]=_0x55a1e9['TrunkBackup']?_0x55a1e9[_0xe444('0x22')]:undefined;this[_0xe444('0x23')]=_0x55a1e9[_0xe444('0x23')]?_0x55a1e9[_0xe444('0x23')]:undefined;this[_0xe444('0x24')]=_0x55a1e9['Interval']?_0x55a1e9['Interval']:undefined;this[_0xe444('0x25')]=_0x55a1e9[_0xe444('0x25')]?_0x55a1e9['SquareProject']:undefined;this[_0xe444('0x26')]=_0x55a1e9[_0xe444('0x25')]?_0x55a1e9[_0xe444('0x25')][_0xe444('0x0')]:undefined;this[_0xe444('0x27')]=_0x55a1e9[_0xe444('0x27')]||![];this['dialAMDInitialSilence']=_0x55a1e9[_0xe444('0x28')];this[_0xe444('0x29')]=_0x55a1e9[_0xe444('0x29')];this['dialAMDAfterGreetingSilence']=_0x55a1e9[_0xe444('0x2a')];this[_0xe444('0x2b')]=_0x55a1e9[_0xe444('0x2b')];this[_0xe444('0x2c')]=_0x55a1e9[_0xe444('0x2c')];this[_0xe444('0x2d')]=_0x55a1e9[_0xe444('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x55a1e9[_0xe444('0x2e')];this['dialAMDSilenceThreshold']=_0x55a1e9[_0xe444('0x2f')];this[_0xe444('0x30')]=_0x55a1e9['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x0522=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x5992e4,_0xfd3e21){var _0x45e915=function(_0x3cead3){while(--_0x3cead3){_0x5992e4['push'](_0x5992e4['shift']());}};_0x45e915(++_0xfd3e21);}(_0x0522,0x138));var _0x2052=function(_0x37debb,_0x4a88ab){_0x37debb=_0x37debb-0x0;var _0x162ec2=_0x0522[_0x37debb];return _0x162ec2;};'use strict';function Campaign(_0x24f3fb){this['id']=_0x24f3fb['id']||0x0;this[_0x2052('0x0')]=_0x24f3fb[_0x2052('0x0')]||'';this[_0x2052('0x1')]=_0x24f3fb['type']||'campaign';this[_0x2052('0x2')]=0x0;this['temp']=0x0;this[_0x2052('0x3')]=0x0;this[_0x2052('0x4')]=0x0;this[_0x2052('0x5')]='';this[_0x2052('0x6')]=!![];this[_0x2052('0x7')]=_0x24f3fb[_0x2052('0x7')];this[_0x2052('0x8')]=_0x24f3fb[_0x2052('0x8')];this[_0x2052('0x9')]=_0x24f3fb[_0x2052('0x9')]||null;this[_0x2052('0xa')]=_0x24f3fb[_0x2052('0xa')]?_0x24f3fb[_0x2052('0xa')]:null;this[_0x2052('0xb')]=_0x24f3fb[_0x2052('0xb')];this[_0x2052('0xc')]=_0x24f3fb[_0x2052('0xc')];this[_0x2052('0xd')]=_0x24f3fb[_0x2052('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x24f3fb['dialCongestionMaxRetry'];this[_0x2052('0xe')]=_0x24f3fb[_0x2052('0xe')];this[_0x2052('0xf')]=_0x24f3fb['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x24f3fb[_0x2052('0x10')];this[_0x2052('0x11')]=_0x24f3fb['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x24f3fb[_0x2052('0x12')];this[_0x2052('0x13')]=_0x24f3fb['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x24f3fb['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x24f3fb[_0x2052('0x14')]||0x96;this[_0x2052('0x15')]=_0x24f3fb[_0x2052('0x15')]||0x3;this['dialDropRetryFrequency']=_0x24f3fb[_0x2052('0x16')]||0x96;this[_0x2052('0x17')]=_0x24f3fb[_0x2052('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x24f3fb[_0x2052('0x18')]||0x96;this[_0x2052('0x19')]=_0x24f3fb[_0x2052('0x19')]||0x3;this[_0x2052('0x1a')]=_0x24f3fb[_0x2052('0x1a')]||0x96;this[_0x2052('0x1b')]=_0x24f3fb[_0x2052('0x1b')]||0x3;this[_0x2052('0x1c')]=_0x24f3fb['dialAgentRejectRetryFrequency']||0x96;this[_0x2052('0x1d')]=_0x24f3fb['dialOrderByScheduledAt']||_0x2052('0x1e');this[_0x2052('0x1f')]=_0x24f3fb[_0x2052('0x1f')]||undefined;this[_0x2052('0x20')]=_0x24f3fb['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2052('0x21')]=_0x24f3fb['dialCutDigit']||undefined;this['TrunkBackup']=_0x24f3fb[_0x2052('0x22')]?_0x24f3fb[_0x2052('0x22')]:undefined;this[_0x2052('0x23')]=_0x24f3fb[_0x2052('0x23')]?_0x24f3fb['Trunk']:undefined;this['Interval']=_0x24f3fb[_0x2052('0x24')]?_0x24f3fb['Interval']:undefined;this[_0x2052('0x25')]=_0x24f3fb[_0x2052('0x25')]?_0x24f3fb[_0x2052('0x25')]:undefined;this[_0x2052('0x26')]=_0x24f3fb[_0x2052('0x25')]?_0x24f3fb[_0x2052('0x25')]['name']:undefined;this[_0x2052('0x27')]=_0x24f3fb[_0x2052('0x27')]||![];this['dialAMDInitialSilence']=_0x24f3fb['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x24f3fb[_0x2052('0x28')];this[_0x2052('0x29')]=_0x24f3fb[_0x2052('0x29')];this[_0x2052('0x2a')]=_0x24f3fb[_0x2052('0x2a')];this[_0x2052('0x2b')]=_0x24f3fb[_0x2052('0x2b')];this[_0x2052('0x2c')]=_0x24f3fb['dialAMDBetweenWordsSilence'];this[_0x2052('0x2d')]=_0x24f3fb[_0x2052('0x2d')];this[_0x2052('0x2e')]=_0x24f3fb[_0x2052('0x2e')];this[_0x2052('0x2f')]=_0x24f3fb[_0x2052('0x2f')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6a403eb..036a4e9 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 _0x68c3=['billableseconds','type','tag','monitor','queue','monitors','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x68c3,0x8b));var _0x368c=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x68c3[_0x71cd05];return _0x59c9e7;};'use strict';function Channel(){this[_0x368c('0x0')]=null;this['channel']='';this[_0x368c('0x1')]='';this[_0x368c('0x2')]=0x0;this[_0x368c('0x3')]='';this[_0x368c('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x368c('0x5')]=0x0;this[_0x368c('0x6')]='';this[_0x368c('0x7')]=0x0;this[_0x368c('0x8')]=0x0;this[_0x368c('0x9')]=0x0;this[_0x368c('0xa')]=![];this[_0x368c('0xb')]=null;this[_0x368c('0xc')]=null;this[_0x368c('0xd')]=![];this['abandoned']=![];this[_0x368c('0xe')]='';this[_0x368c('0xf')]='';this[_0x368c('0x10')]=0x0;this[_0x368c('0x11')]=0x0;this['holdtime']=0x0;this[_0x368c('0x12')]=null;this[_0x368c('0x13')]=null;this['disposition']=null;this[_0x368c('0x14')]=![];this['monitorFilename']=null;this[_0x368c('0x15')]=null;this[_0x368c('0x16')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x368c('0x17')]=undefined;this[_0x368c('0x18')]=0x0;}module[_0x368c('0x19')]=Channel; \ No newline at end of file +var _0x9e6b=['accountcode','context','uniqueid','exten','answered','answertime','unmanaged','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','connectedlinename'];(function(_0x1d1806,_0x117e66){var _0x32710c=function(_0x7b4b87){while(--_0x7b4b87){_0x1d1806['push'](_0x1d1806['shift']());}};_0x32710c(++_0x117e66);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9e6b[_0x4b369d];return _0x571a98;};'use strict';function Channel(){this[_0xb9e6('0x0')]=null;this[_0xb9e6('0x1')]='';this['destinationchannel']='';this[_0xb9e6('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xb9e6('0x3')]=undefined;this[_0xb9e6('0x4')]=0x0;this[_0xb9e6('0x5')]='';this[_0xb9e6('0x6')]=0x0;this['linkedid']=0x0;this[_0xb9e6('0x7')]=0x0;this[_0xb9e6('0x8')]=![];this[_0xb9e6('0x9')]=null;this['endtime']=null;this[_0xb9e6('0xa')]=![];this['abandoned']=![];this['lastapplication']='';this['lastdata']='';this[_0xb9e6('0xb')]=0x0;this['billableseconds']=0x0;this[_0xb9e6('0xc')]=0x0;this[_0xb9e6('0xd')]=null;this[_0xb9e6('0xe')]=null;this[_0xb9e6('0xf')]=null;this[_0xb9e6('0x10')]=![];this[_0xb9e6('0x11')]=null;this[_0xb9e6('0x12')]=null;this[_0xb9e6('0x13')]=[];this[_0xb9e6('0x14')]=undefined;this[_0xb9e6('0x15')]=undefined;this['transferType']=undefined;this[_0xb9e6('0x16')]=0x0;}module[_0xb9e6('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d440aec..1fa2f3e 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 _0x45bc=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','token','tokenSecret','type'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x45bc,0x142));var _0xc45b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x45bc[_0x14add3];return _0x4a174f;};'use strict';function DeskAccount(_0x2fc564){this['id']=_0x2fc564['id']||0x0;this['name']=_0x2fc564[_0xc45b('0x0')]||'';this['username']=_0x2fc564['username']||'';this[_0xc45b('0x1')]=_0x2fc564[_0xc45b('0x1')]||'';this[_0xc45b('0x2')]=_0x2fc564[_0xc45b('0x2')]||'';this[_0xc45b('0x3')]=_0x2fc564[_0xc45b('0x3')]||'';this[_0xc45b('0x4')]=_0x2fc564[_0xc45b('0x4')]||'';this['consumerSecret']=_0x2fc564['consumerSecret']||'';this[_0xc45b('0x5')]=_0x2fc564[_0xc45b('0x5')]||'';this[_0xc45b('0x6')]=_0x2fc564['tokenSecret']||'';this[_0xc45b('0x7')]=_0x2fc564[_0xc45b('0x7')]||'';this[_0xc45b('0x8')]=_0x2fc564[_0xc45b('0x8')]||'';this[_0xc45b('0x9')]=_0x2fc564[_0xc45b('0x9')]||{};}module[_0xc45b('0xa')]=DeskAccount; \ No newline at end of file +var _0xe11e=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0xe11e,0x9b));var _0xee11=function(_0x4b1e9b,_0x1211d6){_0x4b1e9b=_0x4b1e9b-0x0;var _0x2c85df=_0xe11e[_0x4b1e9b];return _0x2c85df;};'use strict';function DeskAccount(_0x2db934){this['id']=_0x2db934['id']||0x0;this['name']=_0x2db934[_0xee11('0x0')]||'';this[_0xee11('0x1')]=_0x2db934[_0xee11('0x1')]||'';this[_0xee11('0x2')]=_0x2db934[_0xee11('0x2')]||'';this[_0xee11('0x3')]=_0x2db934['authType']||'';this[_0xee11('0x4')]=_0x2db934[_0xee11('0x4')]||'';this[_0xee11('0x5')]=_0x2db934[_0xee11('0x5')]||'';this[_0xee11('0x6')]=_0x2db934[_0xee11('0x6')]||'';this[_0xee11('0x7')]=_0x2db934[_0xee11('0x7')]||'';this[_0xee11('0x8')]=_0x2db934[_0xee11('0x8')]||'';this[_0xee11('0x9')]=_0x2db934[_0xee11('0x9')]||'';this['serverUrl']=_0x2db934[_0xee11('0xa')]||'';this[_0xee11('0xb')]=_0x2db934[_0xee11('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 16ee7b1..ab9ed7e 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 _0x9b9a=['Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x128c21,_0x5e4b3d){var _0x4e222d=function(_0xcf56ea){while(--_0xcf56ea){_0x128c21['push'](_0x128c21['shift']());}};_0x4e222d(++_0x5e4b3d);}(_0x9b9a,0xff));var _0xa9b9=function(_0x70ea1b,_0x536395){_0x70ea1b=_0x70ea1b-0x0;var _0xe73e0b=_0x9b9a[_0x70ea1b];return _0xe73e0b;};'use strict';function Dynamics365Account(_0x7f6d7){this['id']=_0x7f6d7['id']||0x0;this['name']=_0x7f6d7[_0xa9b9('0x0')]||'';this[_0xa9b9('0x1')]=_0x7f6d7[_0xa9b9('0x1')]||'';this[_0xa9b9('0x2')]=_0x7f6d7[_0xa9b9('0x2')]||'';this[_0xa9b9('0x3')]=_0x7f6d7['remoteUri']||'';this[_0xa9b9('0x4')]=_0x7f6d7['tenantId']||'';this[_0xa9b9('0x5')]=_0x7f6d7[_0xa9b9('0x5')]||'';this[_0xa9b9('0x6')]=_0x7f6d7['clientSecret']||{};this[_0xa9b9('0x7')]=_0x7f6d7[_0xa9b9('0x7')]||'';this['modernAuthentication']=_0x7f6d7[_0xa9b9('0x8')]||![];this[_0xa9b9('0x9')]=_0x7f6d7[_0xa9b9('0x9')]||{};this[_0xa9b9('0xa')]=_0x7f6d7[_0xa9b9('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x77e1=['tenantId','clientId','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri'];(function(_0x2f3df0,_0xa662fc){var _0x1fde71=function(_0x312723){while(--_0x312723){_0x2f3df0['push'](_0x2f3df0['shift']());}};_0x1fde71(++_0xa662fc);}(_0x77e1,0x12e));var _0x177e=function(_0x280fd9,_0x2d7a80){_0x280fd9=_0x280fd9-0x0;var _0x275068=_0x77e1[_0x280fd9];return _0x275068;};'use strict';function Dynamics365Account(_0x4ab763){this['id']=_0x4ab763['id']||0x0;this[_0x177e('0x0')]=_0x4ab763[_0x177e('0x0')]||'';this[_0x177e('0x1')]=_0x4ab763[_0x177e('0x1')]||'';this[_0x177e('0x2')]=_0x4ab763[_0x177e('0x2')]||'';this['remoteUri']=_0x4ab763[_0x177e('0x3')]||'';this[_0x177e('0x4')]=_0x4ab763[_0x177e('0x4')]||'';this[_0x177e('0x5')]=_0x4ab763[_0x177e('0x5')]||'';this['clientSecret']=_0x4ab763['clientSecret']||{};this['serverUrl']=_0x4ab763['serverUrl']||'';this[_0x177e('0x6')]=_0x4ab763['modernAuthentication']||![];this[_0x177e('0x7')]=_0x4ab763[_0x177e('0x7')]||{};this[_0x177e('0x8')]=_0x4ab763[_0x177e('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d3e7fff..a5d8593 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 _0x68d3=['key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId'];(function(_0x1d5397,_0x5c4771){var _0x52ecea=function(_0x43aeb2){while(--_0x43aeb2){_0x1d5397['push'](_0x1d5397['shift']());}};_0x52ecea(++_0x5c4771);}(_0x68d3,0x162));var _0x368d=function(_0x3f0df6,_0x6b43c3){_0x3f0df6=_0x3f0df6-0x0;var _0x322434=_0x68d3[_0x3f0df6];return _0x322434;};'use strict';function FaxAccount(_0x4414a6){this['id']=_0x4414a6['id']||0x0;this[_0x368d('0x0')]=_0x4414a6[_0x368d('0x0')]||'';this[_0x368d('0x1')]=_0x4414a6[_0x368d('0x1')];this[_0x368d('0x2')]=_0x4414a6[_0x368d('0x2')];this['headerinfo']=_0x4414a6[_0x368d('0x3')];this[_0x368d('0x4')]=_0x4414a6[_0x368d('0x4')];this[_0x368d('0x5')]=_0x4414a6['minrate']||0x960;this[_0x368d('0x6')]=_0x4414a6['maxrate']||0x3840;this[_0x368d('0x7')]=_0x4414a6[_0x368d('0x7')]||'v17,v27,v29';this['gateway']=_0x4414a6[_0x368d('0x8')]||'no';this['faxdetect']=_0x4414a6[_0x368d('0x9')]||'no';this[_0x368d('0xa')]=_0x4414a6['t38timeout']||0x1388;this[_0x368d('0xb')]=_0x4414a6[_0x368d('0xb')]||'SIP';this[_0x368d('0xc')]=_0x4414a6[_0x368d('0xc')]?_0x4414a6[_0x368d('0xc')]:undefined;this[_0x368d('0xd')]=_0x4414a6['ListId'];this[_0x368d('0xe')]=_0x4414a6[_0x368d('0xe')];}module[_0x368d('0xf')]=FaxAccount; \ No newline at end of file +var _0x2b0c=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x36b224,_0xa7c98){var _0x3156ea=function(_0x14de6b){while(--_0x14de6b){_0x36b224['push'](_0x36b224['shift']());}};_0x3156ea(++_0xa7c98);}(_0x2b0c,0x160));var _0xc2b0=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x2b0c[_0x276468];return _0x36dc3a;};'use strict';function FaxAccount(_0x440049){this['id']=_0x440049['id']||0x0;this[_0xc2b0('0x0')]=_0x440049[_0xc2b0('0x0')]||'';this[_0xc2b0('0x1')]=_0x440049[_0xc2b0('0x1')];this[_0xc2b0('0x2')]=_0x440049[_0xc2b0('0x2')];this[_0xc2b0('0x3')]=_0x440049[_0xc2b0('0x3')];this[_0xc2b0('0x4')]=_0x440049[_0xc2b0('0x4')];this['minrate']=_0x440049['minrate']||0x960;this[_0xc2b0('0x5')]=_0x440049['maxrate']||0x3840;this[_0xc2b0('0x6')]=_0x440049['modem']||_0xc2b0('0x7');this[_0xc2b0('0x8')]=_0x440049[_0xc2b0('0x8')]||'no';this[_0xc2b0('0x9')]=_0x440049['faxdetect']||'no';this[_0xc2b0('0xa')]=_0x440049[_0xc2b0('0xa')]||0x1388;this[_0xc2b0('0xb')]=_0x440049[_0xc2b0('0xb')]||_0xc2b0('0xc');this[_0xc2b0('0xd')]=_0x440049['Trunk']?_0x440049['Trunk']:undefined;this[_0xc2b0('0xe')]=_0x440049[_0xc2b0('0xe')];this[_0xc2b0('0xf')]=_0x440049[_0xc2b0('0xf')];}module[_0xc2b0('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4d957e8..fb48abe 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 _0x0217=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4afe3b,_0x255e0d){var _0x2c22d1=function(_0x313847){while(--_0x313847){_0x4afe3b['push'](_0x4afe3b['shift']());}};_0x2c22d1(++_0x255e0d);}(_0x0217,0x1af));var _0x7021=function(_0x574858,_0x3fd612){_0x574858=_0x574858-0x0;var _0x30010a=_0x0217[_0x574858];return _0x30010a;};'use strict';function FreshdeskAccount(_0x4e9143){this['id']=_0x4e9143['id']||0x0;this[_0x7021('0x0')]=_0x4e9143['name']||'';this[_0x7021('0x1')]=_0x4e9143[_0x7021('0x1')]||'';this['apiKey']=_0x4e9143['token']||'';this[_0x7021('0x2')]=_0x4e9143[_0x7021('0x2')]||'';this[_0x7021('0x3')]=_0x4e9143[_0x7021('0x3')]||'';this[_0x7021('0x4')]=_0x4e9143[_0x7021('0x4')]||{};}module[_0x7021('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x9fe2=['Configurations','exports','name','username','token','remoteUri'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x9fe2,0x68));var _0x29fe=function(_0x319889,_0x56cf31){_0x319889=_0x319889-0x0;var _0x2261fc=_0x9fe2[_0x319889];return _0x2261fc;};'use strict';function FreshdeskAccount(_0x3b75bc){this['id']=_0x3b75bc['id']||0x0;this[_0x29fe('0x0')]=_0x3b75bc[_0x29fe('0x0')]||'';this[_0x29fe('0x1')]=_0x3b75bc[_0x29fe('0x1')]||'';this['apiKey']=_0x3b75bc[_0x29fe('0x2')]||'';this[_0x29fe('0x3')]=_0x3b75bc[_0x29fe('0x3')]||'';this['serverUrl']=_0x3b75bc['serverUrl']||'';this[_0x29fe('0x4')]=_0x3b75bc[_0x29fe('0x4')]||{};}module[_0x29fe('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index ea21c9f..256d348 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 _0x8d0a=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xe1b7b3,_0x48cfb0){var _0x1fb71c=function(_0x4e1093){while(--_0x4e1093){_0xe1b7b3['push'](_0xe1b7b3['shift']());}};_0x1fb71c(++_0x48cfb0);}(_0x8d0a,0x65));var _0xa8d0=function(_0x39f850,_0x280c4c){_0x39f850=_0x39f850-0x0;var _0x57f7a3=_0x8d0a[_0x39f850];return _0x57f7a3;};'use strict';function FreshsalesAccount(_0x3c4ce0){this['id']=_0x3c4ce0['id']||0x0;this['name']=_0x3c4ce0[_0xa8d0('0x0')]||'';this[_0xa8d0('0x1')]=_0x3c4ce0[_0xa8d0('0x1')]||'';this[_0xa8d0('0x2')]=_0x3c4ce0[_0xa8d0('0x3')]||'';this[_0xa8d0('0x4')]=_0x3c4ce0[_0xa8d0('0x4')]||'';this[_0xa8d0('0x5')]=_0x3c4ce0[_0xa8d0('0x5')]||'';this['Configurations']=_0x3c4ce0[_0xa8d0('0x6')]||{};}module[_0xa8d0('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x0689=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x248c90,_0x1ed333){var _0x449036=function(_0x54ed08){while(--_0x54ed08){_0x248c90['push'](_0x248c90['shift']());}};_0x449036(++_0x1ed333);}(_0x0689,0x161));var _0x9068=function(_0x55611d,_0x4646f0){_0x55611d=_0x55611d-0x0;var _0x2d968a=_0x0689[_0x55611d];return _0x2d968a;};'use strict';function FreshsalesAccount(_0x33f9a8){this['id']=_0x33f9a8['id']||0x0;this[_0x9068('0x0')]=_0x33f9a8['name']||'';this[_0x9068('0x1')]=_0x33f9a8[_0x9068('0x1')]||'';this[_0x9068('0x2')]=_0x33f9a8[_0x9068('0x3')]||'';this[_0x9068('0x4')]=_0x33f9a8[_0x9068('0x4')]||'';this[_0x9068('0x5')]=_0x33f9a8[_0x9068('0x5')]||'';this[_0x9068('0x6')]=_0x33f9a8[_0x9068('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 98c73e9..de2a8b0 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 _0x719a=['queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x505e5f,_0x3238c6){var _0x5de7a9=function(_0x352542){while(--_0x352542){_0x505e5f['push'](_0x505e5f['shift']());}};_0x5de7a9(++_0x3238c6);}(_0x719a,0x1e2));var _0xa719=function(_0x10ca94,_0x3070a5){_0x10ca94=_0x10ca94-0x0;var _0x24a46d=_0x719a[_0x10ca94];return _0x24a46d;};'use strict';function QueueReport(){this[_0xa719('0x0')]='inbound';this[_0xa719('0x1')]='';this[_0xa719('0x2')]='';this[_0xa719('0x3')]='';this[_0xa719('0x4')]='';this[_0xa719('0x5')]=null;this[_0xa719('0x6')]=null;this[_0xa719('0x7')]=0x1;this[_0xa719('0x8')]=0x1;this[_0xa719('0x9')]=![];this[_0xa719('0xa')]=null;this[_0xa719('0xb')]=![];this[_0xa719('0xc')]=null;this['queuecallerexit']=![];this[_0xa719('0xd')]=null;this['originalposition']=0x1;this[_0xa719('0xe')]='';this[_0xa719('0xf')]='';this[_0xa719('0x10')]='';this['accountcode']='';this[_0xa719('0x11')]='';this[_0xa719('0x12')]='';this[_0xa719('0x13')]='';this[_0xa719('0x14')]=0x0;this['assigned']=![];this[_0xa719('0x15')]='';this[_0xa719('0x16')]=_0xa719('0x17');this[_0xa719('0x18')]=0x0;this[_0xa719('0x19')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x1dc2=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','assigned','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count'];(function(_0x1fe881,_0x556c3c){var _0x5676cc=function(_0x229c61){while(--_0x229c61){_0x1fe881['push'](_0x1fe881['shift']());}};_0x5676cc(++_0x556c3c);}(_0x1dc2,0x83));var _0x21dc=function(_0x337981,_0x2e89e1){_0x337981=_0x337981-0x0;var _0x3686bc=_0x1dc2[_0x337981];return _0x3686bc;};'use strict';function QueueReport(){this[_0x21dc('0x0')]='inbound';this[_0x21dc('0x1')]='';this['calleridnum']='';this[_0x21dc('0x2')]='';this['queue']='';this[_0x21dc('0x3')]=null;this[_0x21dc('0x4')]=null;this[_0x21dc('0x5')]=0x1;this[_0x21dc('0x6')]=0x1;this[_0x21dc('0x7')]=![];this[_0x21dc('0x8')]=null;this[_0x21dc('0x9')]=![];this[_0x21dc('0xa')]=null;this['queuecallerexit']=![];this[_0x21dc('0xb')]=null;this['originalposition']=0x1;this[_0x21dc('0xc')]='';this[_0x21dc('0xd')]='';this[_0x21dc('0xe')]='';this['accountcode']='';this[_0x21dc('0xf')]='';this[_0x21dc('0x10')]='';this[_0x21dc('0x11')]='';this['holdtime']=0x0;this[_0x21dc('0x12')]=![];this[_0x21dc('0x13')]='';this['motionChannel']='voice';this[_0x21dc('0x14')]=0x0;this[_0x21dc('0x15')]={};}module[_0x21dc('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 801052e..a504cc9 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 _0x6219=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x8ac845,_0x535da8){var _0x3f69ce=function(_0x58bff1){while(--_0x58bff1){_0x8ac845['push'](_0x8ac845['shift']());}};_0x3f69ce(++_0x535da8);}(_0x6219,0xc4));var _0x9621=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x6219[_0x1e081a];return _0x428209;};'use strict';function SalesforceAccount(_0x4da812){this['id']=_0x4da812['id']||0x0;this[_0x9621('0x0')]=_0x4da812[_0x9621('0x0')]||'';this[_0x9621('0x1')]=_0x4da812[_0x9621('0x1')]||'';this[_0x9621('0x2')]=_0x4da812['remoteUri']||'';this[_0x9621('0x3')]=_0x4da812[_0x9621('0x3')]||'';this['clientId']=_0x4da812[_0x9621('0x4')]||'';this[_0x9621('0x5')]=_0x4da812[_0x9621('0x5')]||'';this[_0x9621('0x6')]=_0x4da812['securityToken']||'';this[_0x9621('0x7')]=_0x4da812[_0x9621('0x7')]||_0x9621('0x8');this[_0x9621('0x9')]=_0x4da812[_0x9621('0x9')]||'';this[_0x9621('0xa')]=_0x4da812['Configurations']||{};}module[_0x9621('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xb6a2=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xb6a2,0x170));var _0x2b6a=function(_0x2e0504,_0x2bdb2a){_0x2e0504=_0x2e0504-0x0;var _0x57fecc=_0xb6a2[_0x2e0504];return _0x57fecc;};'use strict';function SalesforceAccount(_0x357294){this['id']=_0x357294['id']||0x0;this['name']=_0x357294[_0x2b6a('0x0')]||'';this[_0x2b6a('0x1')]=_0x357294[_0x2b6a('0x1')]||'';this[_0x2b6a('0x2')]=_0x357294[_0x2b6a('0x2')]||'';this['password']=_0x357294[_0x2b6a('0x3')]||'';this[_0x2b6a('0x4')]=_0x357294[_0x2b6a('0x4')]||'';this[_0x2b6a('0x5')]=_0x357294[_0x2b6a('0x5')]||'';this['securityToken']=_0x357294[_0x2b6a('0x6')]||'';this[_0x2b6a('0x7')]=_0x357294[_0x2b6a('0x7')]||_0x2b6a('0x8');this[_0x2b6a('0x9')]=_0x357294[_0x2b6a('0x9')]||'';this[_0x2b6a('0xa')]=_0x357294['Configurations']||{};}module[_0x2b6a('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 49940dc..adfef38 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 _0xe7c0=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x485817,_0xbaea3){var _0x1bfb72=function(_0x5bd0b9){while(--_0x5bd0b9){_0x485817['push'](_0x485817['shift']());}};_0x1bfb72(++_0xbaea3);}(_0xe7c0,0x1ae));var _0x0e7c=function(_0x1eaf5e,_0x333d16){_0x1eaf5e=_0x1eaf5e-0x0;var _0x409fa2=_0xe7c0[_0x1eaf5e];return _0x409fa2;};'use strict';function ServicenowAccount(_0xacf68f){this['id']=_0xacf68f['id']||0x0;this[_0x0e7c('0x0')]=_0xacf68f[_0x0e7c('0x0')]||'';this['username']=_0xacf68f['username']||'';this[_0x0e7c('0x1')]=_0xacf68f[_0x0e7c('0x1')]||'';this[_0x0e7c('0x2')]=_0xacf68f[_0x0e7c('0x2')]||'';this[_0x0e7c('0x3')]=_0xacf68f[_0x0e7c('0x3')]||'';this[_0x0e7c('0x4')]=_0xacf68f[_0x0e7c('0x4')]||{};}module[_0x0e7c('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x7abb=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x25ae1c,_0x4c422d){var _0x13a8cd=function(_0x41dfce){while(--_0x41dfce){_0x25ae1c['push'](_0x25ae1c['shift']());}};_0x13a8cd(++_0x4c422d);}(_0x7abb,0x148));var _0xb7ab=function(_0x2417cb,_0x30f452){_0x2417cb=_0x2417cb-0x0;var _0x4dabae=_0x7abb[_0x2417cb];return _0x4dabae;};'use strict';function ServicenowAccount(_0x5af6ff){this['id']=_0x5af6ff['id']||0x0;this[_0xb7ab('0x0')]=_0x5af6ff['name']||'';this[_0xb7ab('0x1')]=_0x5af6ff[_0xb7ab('0x1')]||'';this[_0xb7ab('0x2')]=_0x5af6ff[_0xb7ab('0x2')]||'';this[_0xb7ab('0x3')]=_0x5af6ff[_0xb7ab('0x3')]||'';this['serverUrl']=_0x5af6ff[_0xb7ab('0x4')]||'';this[_0xb7ab('0x5')]=_0x5af6ff['Configurations']||{};}module[_0xb7ab('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 16400f4..c147461 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 _0x7e62=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x441cc0,_0x205b84){var _0x599a84=function(_0x574f30){while(--_0x574f30){_0x441cc0['push'](_0x441cc0['shift']());}};_0x599a84(++_0x205b84);}(_0x7e62,0x15a));var _0x27e6=function(_0x12369c,_0xe97a11){_0x12369c=_0x12369c-0x0;var _0x3ce340=_0x7e62[_0x12369c];return _0x3ce340;};'use strict';function SugarcrmAccount(_0x2d5ac){this['id']=_0x2d5ac['id']||0x0;this[_0x27e6('0x0')]=_0x2d5ac['name']||'';this[_0x27e6('0x1')]=_0x2d5ac[_0x27e6('0x1')]||'';this['password']=_0x2d5ac['password']||'';this[_0x27e6('0x2')]=_0x2d5ac['remoteUri']||'';this[_0x27e6('0x3')]=_0x2d5ac[_0x27e6('0x3')]||'';this[_0x27e6('0x4')]=_0x2d5ac['Configurations']||{};}module[_0x27e6('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x4ccc=['exports','name','password','remoteUri','serverUrl','Configurations'];(function(_0x4ad364,_0x34d600){var _0x1ace8f=function(_0x4f4503){while(--_0x4f4503){_0x4ad364['push'](_0x4ad364['shift']());}};_0x1ace8f(++_0x34d600);}(_0x4ccc,0x145));var _0xc4cc=function(_0x18fdc4,_0x41840b){_0x18fdc4=_0x18fdc4-0x0;var _0x2ebbfb=_0x4ccc[_0x18fdc4];return _0x2ebbfb;};'use strict';function SugarcrmAccount(_0x4297a0){this['id']=_0x4297a0['id']||0x0;this[_0xc4cc('0x0')]=_0x4297a0['name']||'';this['username']=_0x4297a0['username']||'';this['password']=_0x4297a0[_0xc4cc('0x1')]||'';this[_0xc4cc('0x2')]=_0x4297a0[_0xc4cc('0x2')]||'';this[_0xc4cc('0x3')]=_0x4297a0[_0xc4cc('0x3')]||'';this[_0xc4cc('0x4')]=_0x4297a0[_0xc4cc('0x4')]||{};}module[_0xc4cc('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 55965e0..d83c213 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 _0x2182=['address','exports','name','accountcode','state','stateTime','status','unknown'];(function(_0x554936,_0x469ccc){var _0x30f597=function(_0x3e2240){while(--_0x3e2240){_0x554936['push'](_0x554936['shift']());}};_0x30f597(++_0x469ccc);}(_0x2182,0xea));var _0x2218=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2182[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x3bda3e){this['id']=_0x3bda3e['id']||0x0;this[_0x2218('0x0')]=_0x3bda3e[_0x2218('0x0')]||'';this[_0x2218('0x1')]=_0x3bda3e['accountcode']||'';this[_0x2218('0x2')]='unknown';this[_0x2218('0x3')]=0x0;this[_0x2218('0x4')]=_0x2218('0x5');this[_0x2218('0x6')]='';}module[_0x2218('0x7')]=Telephone; \ No newline at end of file +var _0x152f=['name','accountcode','unknown','stateTime','status','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x152f,0x144));var _0xf152=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x152f[_0xc6be3a];return _0x56a310;};'use strict';function Telephone(_0x1f860c){this['id']=_0x1f860c['id']||0x0;this[_0xf152('0x0')]=_0x1f860c[_0xf152('0x0')]||'';this[_0xf152('0x1')]=_0x1f860c[_0xf152('0x1')]||'';this['state']=_0xf152('0x2');this[_0xf152('0x3')]=0x0;this[_0xf152('0x4')]=_0xf152('0x2');this['address']='';}module[_0xf152('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fbffc6f..81d369d 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(_0x429eee,_0x550b5f){var _0x250180=function(_0x2026e1){while(--_0x2026e1){_0x429eee['push'](_0x429eee['shift']());}};_0x250180(++_0x550b5f);}(_0xb10b,0x12a));var _0xbb10=function(_0x41da6,_0x42431b){_0x41da6=_0x41da6-0x0;var _0x282340=_0xb10b[_0x41da6];return _0x282340;};'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(_0x4b2336,_0x414d2e){var _0x483b7d=function(_0x53c7b4){while(--_0x53c7b4){_0x4b2336['push'](_0x4b2336['shift']());}};_0x483b7d(++_0x414d2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 fbf9f5a..a8b4902 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 _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0xac72f7,_0x237a87){var _0x5b1c13=function(_0x465d93){while(--_0x465d93){_0xac72f7['push'](_0xac72f7['shift']());}};_0x5b1c13(++_0x237a87);}(_0x5f2f,0x73));var _0xf5f2=function(_0x246331,_0x19793b){_0x246331=_0x246331-0x0;var _0xfeb210=_0x5f2f[_0x246331];return _0xfeb210;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x434345,_0x5a10f0){var _0x717205=function(_0xc12569){while(--_0xc12569){_0x434345['push'](_0x434345['shift']());}};_0x717205(++_0x5a10f0);}(_0xda3f,0xec));var _0xfda3=function(_0x54ff03,_0x507ff8){_0x54ff03=_0x54ff03-0x0;var _0x3ed0c3=_0xda3f[_0x54ff03];return _0x3ed0c3;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 897c701..83b1a8d 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 _0xc71a=['unknown','stateTime','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name'];(function(_0x4ad14b,_0x26b9e9){var _0x2c219e=function(_0x59eda4){while(--_0x59eda4){_0x4ad14b['push'](_0x4ad14b['shift']());}};_0x2c219e(++_0x26b9e9);}(_0xc71a,0x184));var _0xac71=function(_0x5d8992,_0x24fcb5){_0x5d8992=_0x5d8992-0x0;var _0x477d5f=_0xc71a[_0x5d8992];return _0x477d5f;};'use strict';function Trunk(_0x8d77fa){this['id']=_0x8d77fa['id']||0x0;this[_0xac71('0x0')]=_0x8d77fa[_0xac71('0x0')]||![];this[_0xac71('0x1')]=_0x8d77fa[_0xac71('0x1')]||'';this['state']=_0xac71('0x2');this[_0xac71('0x3')]=0x0;this['status']='unknown';this['registry']=_0x8d77fa['registry']&&_0x8d77fa[_0xac71('0x4')][_0xac71('0x5')](':')?_0x8d77fa['registry'][_0xac71('0x6')](':')[0x0]:'';this[_0xac71('0x7')]='';this['port']='';this[_0xac71('0x8')]='';this[_0xac71('0x9')]='';this[_0xac71('0xa')]='';this[_0xac71('0xb')]=_0xac71('0x2');this[_0xac71('0xc')]='';this[_0xac71('0xd')]='';this['defaultuser']=_0x8d77fa[_0xac71('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x29bf=['unknown','stateTime','registry','split','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','name','state'];(function(_0xc000d6,_0x1ff5f7){var _0x40d0d8=function(_0x28324e){while(--_0x28324e){_0xc000d6['push'](_0xc000d6['shift']());}};_0x40d0d8(++_0x1ff5f7);}(_0x29bf,0x1c0));var _0xf29b=function(_0x44061d,_0x412613){_0x44061d=_0x44061d-0x0;var _0xf3333c=_0x29bf[_0x44061d];return _0xf3333c;};'use strict';function Trunk(_0x303194){this['id']=_0x303194['id']||0x0;this['active']=_0x303194['active']||![];this[_0xf29b('0x0')]=_0x303194[_0xf29b('0x0')]||'';this[_0xf29b('0x1')]=_0xf29b('0x2');this[_0xf29b('0x3')]=0x0;this['status']=_0xf29b('0x2');this['registry']=_0x303194[_0xf29b('0x4')]&&_0x303194[_0xf29b('0x4')]['indexOf'](':')?_0x303194[_0xf29b('0x4')][_0xf29b('0x5')](':')[0x0]:'';this[_0xf29b('0x6')]='';this[_0xf29b('0x7')]='';this[_0xf29b('0x8')]='';this[_0xf29b('0x9')]='';this[_0xf29b('0xa')]='';this[_0xf29b('0xb')]='unknown';this['registrationtime']='';this[_0xf29b('0xc')]='';this[_0xf29b('0xd')]=_0x303194[_0xf29b('0xd')]||'';}module[_0xf29b('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 1d0c430..70db942 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 _0x6476=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x2d38ad,_0x49c7b7){var _0x35d12b=function(_0x3916e1){while(--_0x3916e1){_0x2d38ad['push'](_0x2d38ad['shift']());}};_0x35d12b(++_0x49c7b7);}(_0x6476,0x1cb));var _0x6647=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6476[_0xa1e3e3];return _0xc980e9;};'use strict';function voiceExtension(_0x57240b){this['id']=_0x57240b['id']||0x0;this[_0x6647('0x0')]=_0x57240b[_0x6647('0x0')]||'';this[_0x6647('0x1')]=_0x57240b[_0x6647('0x1')]||'none';this['mandatoryDisposition']=_0x57240b[_0x6647('0x2')]||![];}module[_0x6647('0x3')]=voiceExtension; \ No newline at end of file +var _0x352b=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x2f808e,_0x25ccb5){var _0x2e8476=function(_0x44f618){while(--_0x44f618){_0x2f808e['push'](_0x2f808e['shift']());}};_0x2e8476(++_0x25ccb5);}(_0x352b,0x96));var _0xb352=function(_0x189350,_0x4dd997){_0x189350=_0x189350-0x0;var _0x109f5f=_0x352b[_0x189350];return _0x109f5f;};'use strict';function voiceExtension(_0x2c343a){this['id']=_0x2c343a['id']||0x0;this[_0xb352('0x0')]=_0x2c343a['exten']||'';this['recordingFormat']=_0x2c343a[_0xb352('0x1')]||_0xb352('0x2');this[_0xb352('0x3')]=_0x2c343a[_0xb352('0x3')]||![];}module[_0xb352('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 04dbce8..2b32273 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 _0x5078=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','unknown','acw','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x3d3401,_0x3c9a64){var _0x20cde3=function(_0x540725){while(--_0x540725){_0x3d3401['push'](_0x3d3401['shift']());}};_0x20cde3(++_0x3c9a64);}(_0x5078,0x148));var _0x8507=function(_0xea19d5,_0x4ac565){_0xea19d5=_0xea19d5-0x0;var _0x19698e=_0x5078[_0xea19d5];return _0x19698e;};'use strict';var monitorFormat={'wav':_0x8507('0x0'),'wav49':_0x8507('0x1'),'gsm':_0x8507('0x2')};var strategy={'fewestcalls':_0x8507('0x3'),'leastrecent':_0x8507('0x4'),'linear':_0x8507('0x5'),'random':_0x8507('0x6'),'ringall':_0x8507('0x7'),'rr':_0x8507('0x8'),'rrmemory':_0x8507('0x9'),'rrordered':_0x8507('0xa'),'wrandom':_0x8507('0xb')};function VoiceQueue(_0x37519c){this['id']=_0x37519c['id']||0x0;this[_0x8507('0xc')]=_0x37519c[_0x8507('0xc')]||'';this[_0x8507('0xd')]=_0x37519c['monitor_format']||'';this[_0x8507('0xe')]=_0x37519c[_0x8507('0xe')]||_0x8507('0xf');this['waiting']=0x0;this['total']=0x0;this[_0x8507('0x10')]=0x0;this[_0x8507('0x11')]=0x0;this[_0x8507('0x12')]=0x0;this[_0x8507('0x13')]=0x0;this[_0x8507('0x14')]=0x0;this[_0x8507('0x15')]=0x0;this[_0x8507('0x16')]=0x0;this['busy']=0x0;this[_0x8507('0x17')]=0x0;this[_0x8507('0x18')]=0x0;this[_0x8507('0x19')]=0x0;this[_0x8507('0x1a')]=0x0;this[_0x8507('0x1b')]=0x0;this[_0x8507('0x1c')]=0x0;this['ringing']=0x0;this[_0x8507('0x1d')]=0x0;this[_0x8507('0x1e')]=0x0;this[_0x8507('0x1f')]=0x0;this[_0x8507('0x20')]=0x0;this[_0x8507('0x21')]=_0x37519c[_0x8507('0x21')]||![];this['acwTimeout']=_0x37519c['acwTimeout']||0xa;this[_0x8507('0x22')]=_0x37519c[_0x8507('0x22')]||'no';this[_0x8507('0x23')]=!![];this['message']='';this[_0x8507('0x24')]='';this[_0x8507('0x25')]=0x0;this[_0x8507('0x26')]=0x0;this[_0x8507('0x27')]=_0x37519c[_0x8507('0x27')]||null;this[_0x8507('0x28')]=_0x37519c[_0x8507('0x28')]?_0x37519c[_0x8507('0x28')]:null;this['dialActive']=_0x37519c['dialActive'];this[_0x8507('0x29')]=_0x37519c[_0x8507('0x29')]||_0x8507('0x2a');this[_0x8507('0x2b')]=_0x37519c[_0x8507('0x2b')]||0x0;this['dialLimitQueue']=_0x37519c[_0x8507('0x2c')]||0x0;this[_0x8507('0x2d')]=_0x37519c[_0x8507('0x2d')]||0x1;this[_0x8507('0x2e')]=_0x37519c[_0x8507('0x2e')]||_0x8507('0x2f');this[_0x8507('0x30')]=_0x37519c[_0x8507('0x30')]||0.03;this['dialPredictiveInterval']=_0x37519c[_0x8507('0x31')]||0x258;this[_0x8507('0x32')]=_0x37519c[_0x8507('0x32')]||_0x8507('0x33');this[_0x8507('0x34')]=_0x37519c[_0x8507('0x34')]||_0x8507('0x33');this[_0x8507('0x35')]=_0x37519c['dialOriginateTimeout']||0x1e;this[_0x8507('0x36')]=_0x37519c[_0x8507('0x36')]||_0x8507('0x37');this['dialQueueTimeout']=_0x37519c[_0x8507('0x38')]||0x3;this[_0x8507('0x39')]=_0x37519c[_0x8507('0x39')]||undefined;this[_0x8507('0x3a')]=_0x37519c['dialCongestionMaxRetry']||0x3;this[_0x8507('0x3b')]=_0x37519c[_0x8507('0x3b')]||0x96;this[_0x8507('0x3c')]=_0x37519c[_0x8507('0x3c')]||0x3;this[_0x8507('0x3d')]=_0x37519c['dialBusyRetryFrequency']||0x96;this[_0x8507('0x3e')]=_0x37519c[_0x8507('0x3e')]||0x3;this[_0x8507('0x3f')]=_0x37519c[_0x8507('0x3f')]||0x96;this[_0x8507('0x40')]=_0x37519c[_0x8507('0x40')]||0x3;this[_0x8507('0x41')]=_0x37519c[_0x8507('0x41')]||0x96;this[_0x8507('0x42')]=_0x37519c[_0x8507('0x42')]||0x3;this[_0x8507('0x43')]=_0x37519c[_0x8507('0x43')]||0x96;this[_0x8507('0x44')]=_0x37519c['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x37519c[_0x8507('0x45')]||0x96;this['dialMachineMaxRetry']=_0x37519c[_0x8507('0x46')]||0x3;this[_0x8507('0x47')]=_0x37519c['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x37519c['dialAgentRejectMaxRetry']||0x3;this[_0x8507('0x48')]=_0x37519c[_0x8507('0x48')]||0x96;this[_0x8507('0x49')]=_0x37519c[_0x8507('0x49')]||0x3;this[_0x8507('0x4a')]=_0x37519c[_0x8507('0x4a')]||0x4;this['Trunk']=_0x37519c['Trunk']?_0x37519c[_0x8507('0x4b')]:undefined;this[_0x8507('0x4c')]=_0x37519c[_0x8507('0x4c')]?_0x37519c['TrunkBackup']:undefined;this['dialPrefix']=_0x37519c[_0x8507('0x4d')]||undefined;this[_0x8507('0x4e')]=_0x37519c['Interval']?_0x37519c[_0x8507('0x4e')]:undefined;this[_0x8507('0x4f')]=_0x37519c['dialOrderByScheduledAt']||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x37519c[_0x8507('0x50')]||undefined;this[_0x8507('0x51')]=_0x37519c[_0x8507('0x51')]||undefined;this[_0x8507('0x52')]=strategy[_0x37519c['strategy']];this['queueStatusComplete']=!![];this[_0x8507('0x53')]=_0x37519c[_0x8507('0x53')]||![];this['dialAMDInitialSilence']=_0x37519c[_0x8507('0x54')];this[_0x8507('0x55')]=_0x37519c[_0x8507('0x55')];this['dialAMDAfterGreetingSilence']=_0x37519c[_0x8507('0x56')];this[_0x8507('0x57')]=_0x37519c[_0x8507('0x57')];this[_0x8507('0x58')]=_0x37519c[_0x8507('0x58')];this[_0x8507('0x59')]=_0x37519c['dialAMDBetweenWordsSilence'];this[_0x8507('0x5a')]=_0x37519c[_0x8507('0x5a')];this['dialAMDSilenceThreshold']=_0x37519c[_0x8507('0x5b')];this[_0x8507('0x5c')]=_0x37519c['dialAMDMaximumWordLength'];this[_0x8507('0x5d')]=0x0;this['pTalking']=0x0;this[_0x8507('0x5e')]=_0x37519c[_0x8507('0x5e')];this['outboundAnswerCallsDay']=0x0;this[_0x8507('0x5f')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x8507('0x60')]=0x0;this[_0x8507('0x61')]=0x0;this[_0x8507('0x62')]=0x0;this[_0x8507('0x63')]=0x0;this[_0x8507('0x64')]=0x0;this[_0x8507('0x65')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x8507('0x66')]=0x0;this[_0x8507('0x67')]=0x0;this[_0x8507('0x68')]=0x0;this[_0x8507('0x69')]=0x0;this['startProgressive']=undefined;this[_0x8507('0x6a')]=undefined;this[_0x8507('0x6b')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x8507('0x6c')]=0x0;this[_0x8507('0x6d')]=0x0;this[_0x8507('0x6e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x8507('0x6f')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8507('0x70')]=0x0;this[_0x8507('0x71')]=0x0;this[_0x8507('0x72')]=_0x37519c[_0x8507('0x73')]||0x14;this['predictiveIntervalMinThreshold']=_0x37519c[_0x8507('0x73')]||0xa;this[_0x8507('0x74')]=0x0;this[_0x8507('0x75')]=0x0;this[_0x8507('0x76')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x8507('0x77')]=0x0;this[_0x8507('0x78')]=_0x37519c[_0x8507('0x78')]||0x1e;this[_0x8507('0x79')]=_0x37519c[_0x8507('0x79')]||![];this[_0x8507('0x7a')]=!!_0x37519c['dialPreviewAutoRecallMe']||![];this[_0x8507('0x7b')]=!!_0x37519c[_0x8507('0x7b')]||![];this['dialQueueProject2']=_0x37519c[_0x8507('0x7c')]||undefined;this[_0x8507('0x7d')]=_0x37519c[_0x8507('0x7d')]||![];this[_0x8507('0x7e')]=_0x37519c[_0x8507('0x7e')]||![];this[_0x8507('0xd')]=monitorFormat[_0x37519c['monitor_format']]?monitorFormat[_0x37519c['monitor_format']]:undefined;this['mandatoryDisposition']=_0x37519c[_0x8507('0x7f')]||![];this[_0x8507('0x80')]=_0x37519c[_0x8507('0x80')]?_0x37519c[_0x8507('0x80')]:undefined;this[_0x8507('0x81')]=![];}module[_0x8507('0x82')]=VoiceQueue; \ No newline at end of file +var _0x5b5a=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','exports','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','inUse','loggedIn','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acwTimeout','autopause','sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x5054e2,_0x1f6ff3){var _0x446031=function(_0x40e9ce){while(--_0x40e9ce){_0x5054e2['push'](_0x5054e2['shift']());}};_0x446031(++_0x1f6ff3);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x3df935,_0x2f6877){_0x3df935=_0x3df935-0x0;var _0x152412=_0x5b5a[_0x3df935];return _0x152412;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xa5b5('0x0'),'gsm':_0xa5b5('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xa5b5('0x2'),'linear':_0xa5b5('0x3'),'random':_0xa5b5('0x4'),'ringall':_0xa5b5('0x5'),'rr':_0xa5b5('0x6'),'rrmemory':_0xa5b5('0x7'),'rrordered':_0xa5b5('0x8'),'wrandom':_0xa5b5('0x9')};function VoiceQueue(_0x509b78){this['id']=_0x509b78['id']||0x0;this[_0xa5b5('0xa')]=_0x509b78[_0xa5b5('0xa')]||'';this['monitor_format']=_0x509b78[_0xa5b5('0xb')]||'';this[_0xa5b5('0xc')]=_0x509b78[_0xa5b5('0xc')]||_0xa5b5('0xd');this[_0xa5b5('0xe')]=0x0;this[_0xa5b5('0xf')]=0x0;this[_0xa5b5('0x10')]=0x0;this[_0xa5b5('0x11')]=0x0;this[_0xa5b5('0x12')]=0x0;this[_0xa5b5('0x13')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['available']=0x0;this['busy']=0x0;this[_0xa5b5('0x14')]=0x0;this['invalid']=0x0;this[_0xa5b5('0x15')]=0x0;this['notInUse']=0x0;this[_0xa5b5('0x16')]=0x0;this[_0xa5b5('0x17')]=0x0;this[_0xa5b5('0x18')]=0x0;this[_0xa5b5('0x19')]=0x0;this[_0xa5b5('0x1a')]=0x0;this[_0xa5b5('0x1b')]=0x0;this[_0xa5b5('0x1c')]=0x0;this['acw']=_0x509b78['acw']||![];this[_0xa5b5('0x1d')]=_0x509b78['acwTimeout']||0xa;this[_0xa5b5('0x1e')]=_0x509b78[_0xa5b5('0x1e')]||'no';this[_0xa5b5('0x1f')]=!![];this['message']='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this[_0xa5b5('0x20')]=_0x509b78[_0xa5b5('0x20')]||null;this[_0xa5b5('0x21')]=_0x509b78[_0xa5b5('0x21')]?_0x509b78[_0xa5b5('0x21')]:null;this[_0xa5b5('0x22')]=_0x509b78['dialActive'];this[_0xa5b5('0x23')]=_0x509b78[_0xa5b5('0x23')]||_0xa5b5('0x24');this['dialLimitChannel']=_0x509b78[_0xa5b5('0x25')]||0x0;this[_0xa5b5('0x26')]=_0x509b78[_0xa5b5('0x26')]||0x0;this[_0xa5b5('0x27')]=_0x509b78[_0xa5b5('0x27')]||0x1;this[_0xa5b5('0x28')]=_0x509b78[_0xa5b5('0x28')]||_0xa5b5('0x29');this[_0xa5b5('0x2a')]=_0x509b78[_0xa5b5('0x2a')]||0.03;this[_0xa5b5('0x2b')]=_0x509b78[_0xa5b5('0x2b')]||0x258;this[_0xa5b5('0x2c')]=_0x509b78[_0xa5b5('0x2c')]||_0xa5b5('0x2d');this[_0xa5b5('0x2e')]=_0x509b78[_0xa5b5('0x2e')]||_0xa5b5('0x2d');this[_0xa5b5('0x2f')]=_0x509b78[_0xa5b5('0x2f')]||0x1e;this[_0xa5b5('0x30')]=_0x509b78[_0xa5b5('0x30')]||_0xa5b5('0x31');this[_0xa5b5('0x32')]=_0x509b78[_0xa5b5('0x32')]||0x3;this[_0xa5b5('0x33')]=_0x509b78[_0xa5b5('0x33')]||undefined;this['dialCongestionMaxRetry']=_0x509b78[_0xa5b5('0x34')]||0x3;this[_0xa5b5('0x35')]=_0x509b78[_0xa5b5('0x35')]||0x96;this[_0xa5b5('0x36')]=_0x509b78['dialBusyMaxRetry']||0x3;this[_0xa5b5('0x37')]=_0x509b78[_0xa5b5('0x37')]||0x96;this[_0xa5b5('0x38')]=_0x509b78[_0xa5b5('0x38')]||0x3;this[_0xa5b5('0x39')]=_0x509b78['dialNoAnswerRetryFrequency']||0x96;this[_0xa5b5('0x3a')]=_0x509b78['dialNoSuchNumberMaxRetry']||0x3;this[_0xa5b5('0x3b')]=_0x509b78[_0xa5b5('0x3b')]||0x96;this[_0xa5b5('0x3c')]=_0x509b78['dialDropMaxRetry']||0x3;this[_0xa5b5('0x3d')]=_0x509b78['dialDropRetryFrequency']||0x96;this[_0xa5b5('0x3e')]=_0x509b78[_0xa5b5('0x3e')]||0x3;this[_0xa5b5('0x3f')]=_0x509b78[_0xa5b5('0x3f')]||0x96;this[_0xa5b5('0x40')]=_0x509b78[_0xa5b5('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x509b78[_0xa5b5('0x41')]||0x96;this[_0xa5b5('0x42')]=_0x509b78[_0xa5b5('0x42')]||0x3;this[_0xa5b5('0x43')]=_0x509b78[_0xa5b5('0x43')]||0x96;this[_0xa5b5('0x44')]=_0x509b78['callAdditionalPhoneAfterMin']||0x3;this[_0xa5b5('0x45')]=_0x509b78[_0xa5b5('0x45')]||0x4;this[_0xa5b5('0x46')]=_0x509b78[_0xa5b5('0x46')]?_0x509b78[_0xa5b5('0x46')]:undefined;this[_0xa5b5('0x47')]=_0x509b78[_0xa5b5('0x47')]?_0x509b78[_0xa5b5('0x47')]:undefined;this[_0xa5b5('0x48')]=_0x509b78[_0xa5b5('0x48')]||undefined;this[_0xa5b5('0x49')]=_0x509b78[_0xa5b5('0x49')]?_0x509b78[_0xa5b5('0x49')]:undefined;this[_0xa5b5('0x4a')]=_0x509b78[_0xa5b5('0x4a')]||_0xa5b5('0x4b');this['dialRandomLastDigitCallerIdNumber']=_0x509b78[_0xa5b5('0x4c')]||undefined;this[_0xa5b5('0x4d')]=_0x509b78[_0xa5b5('0x4d')]||undefined;this['strategy']=strategy[_0x509b78[_0xa5b5('0x4e')]];this[_0xa5b5('0x4f')]=!![];this[_0xa5b5('0x50')]=_0x509b78[_0xa5b5('0x50')]||![];this[_0xa5b5('0x51')]=_0x509b78['dialAMDInitialSilence'];this[_0xa5b5('0x52')]=_0x509b78[_0xa5b5('0x52')];this[_0xa5b5('0x53')]=_0x509b78['dialAMDAfterGreetingSilence'];this[_0xa5b5('0x54')]=_0x509b78['dialAMDTotalAnalysisTime'];this[_0xa5b5('0x55')]=_0x509b78[_0xa5b5('0x55')];this[_0xa5b5('0x56')]=_0x509b78[_0xa5b5('0x56')];this[_0xa5b5('0x57')]=_0x509b78[_0xa5b5('0x57')];this[_0xa5b5('0x58')]=_0x509b78[_0xa5b5('0x58')];this[_0xa5b5('0x59')]=_0x509b78['dialAMDMaximumWordLength'];this[_0xa5b5('0x5a')]=0x0;this[_0xa5b5('0x5b')]=0x0;this['timeout']=_0x509b78[_0xa5b5('0x5c')];this[_0xa5b5('0x5d')]=0x0;this[_0xa5b5('0x5e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xa5b5('0x5f')]=0x0;this[_0xa5b5('0x60')]=0x0;this[_0xa5b5('0x61')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa5b5('0x62')]=0x0;this[_0xa5b5('0x63')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa5b5('0x64')]=0x0;this[_0xa5b5('0x65')]=0x0;this[_0xa5b5('0x66')]=0x0;this[_0xa5b5('0x67')]=0x0;this[_0xa5b5('0x68')]=undefined;this[_0xa5b5('0x69')]=undefined;this['handlePredictive']=undefined;this[_0xa5b5('0x6a')]=1.05;this[_0xa5b5('0x6b')]=0x0;this[_0xa5b5('0x6c')]=0x0;this[_0xa5b5('0x6d')]=0x0;this[_0xa5b5('0x6e')]=0x0;this[_0xa5b5('0x6f')]=0x0;this[_0xa5b5('0x70')]=0x0;this[_0xa5b5('0x71')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xa5b5('0x72')]=_0x509b78[_0xa5b5('0x73')]||0x14;this['predictiveIntervalMinThreshold']=_0x509b78['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xa5b5('0x74')]=0x0;this[_0xa5b5('0x75')]=0x0;this[_0xa5b5('0x76')]=0x1;this['erlangCalls']=0x0;this[_0xa5b5('0x77')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa5b5('0x78')]=0x0;this[_0xa5b5('0x79')]=_0x509b78[_0xa5b5('0x79')]||0x1e;this['dialRecallInQueue']=_0x509b78[_0xa5b5('0x7a')]||![];this[_0xa5b5('0x7b')]=!!_0x509b78[_0xa5b5('0x7b')]||![];this[_0xa5b5('0x7c')]=!!_0x509b78[_0xa5b5('0x7c')]||![];this['dialQueueProject2']=_0x509b78[_0xa5b5('0x7d')]||undefined;this[_0xa5b5('0x7e')]=_0x509b78[_0xa5b5('0x7e')]||![];this[_0xa5b5('0x7f')]=_0x509b78[_0xa5b5('0x7f')]||![];this[_0xa5b5('0xb')]=monitorFormat[_0x509b78[_0xa5b5('0xb')]]?monitorFormat[_0x509b78[_0xa5b5('0xb')]]:undefined;this['mandatoryDisposition']=_0x509b78[_0xa5b5('0x80')]||![];this['mandatoryDispositionPause']=_0x509b78['mandatoryDispositionPause']?_0x509b78['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xa5b5('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 67cab8f..4ae19e1 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 _0xae1c=['strategy','abandoned','busy','invalid','onHold','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','notInUse','loggedin','callers','length','SIP/','incall','status','booked','keys','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundCongestionCallsDay','preview','exports','ringing','talking','waiting','available','answered','inUse','loggedIn','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','sumDuration','total','name'];(function(_0x226147,_0x89c729){var _0x599c23=function(_0x39ce38){while(--_0x39ce38){_0x226147['push'](_0x226147['shift']());}};_0x599c23(++_0x89c729);}(_0xae1c,0xff));var _0xcae1=function(_0x44cdf6,_0x27c98e){_0x44cdf6=_0x44cdf6-0x0;var _0x21eae1=_0xae1c[_0x44cdf6];return _0x21eae1;};'use strict';var INBOUND_COUNTERS=['available','loggedIn','loggedInDb','paused',_0xcae1('0x0'),_0xcae1('0x1'),_0xcae1('0x2')];var OUTBOUND_COUNTERS=[_0xcae1('0x3'),_0xcae1('0x4'),_0xcae1('0x5'),_0xcae1('0x6'),_0xcae1('0x7'),_0xcae1('0x8'),_0xcae1('0x9'),_0xcae1('0xa'),_0xcae1('0xb'),_0xcae1('0xc'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xcae1('0xd'),_0xcae1('0xe'),_0xcae1('0xf'),'outboundUnknownCallsDay',_0xcae1('0x10'),_0xcae1('0x11'),_0xcae1('0x1'),'sumBillable',_0xcae1('0x12'),_0xcae1('0x13'),'waiting'];function VoiceQueueSummary(_0x4e24fb){this['id']=_0x4e24fb['id'];this[_0xcae1('0x14')]=_0x4e24fb[_0xcae1('0x14')];this[_0xcae1('0x15')]=_0x4e24fb[_0xcae1('0x15')];this[_0xcae1('0x16')]=_0x4e24fb[_0xcae1('0x16')]||0x0;this[_0xcae1('0x4')]=_0x4e24fb[_0xcae1('0x4')]||0x0;this[_0xcae1('0x3')]=_0x4e24fb[_0xcae1('0x3')]||0x0;this[_0xcae1('0x17')]=_0x4e24fb[_0xcae1('0x17')]||0x0;this[_0xcae1('0x5')]=_0x4e24fb[_0xcae1('0x5')]||0x0;this[_0xcae1('0x18')]=_0x4e24fb['invalid']||0x0;this[_0xcae1('0x6')]=_0x4e24fb[_0xcae1('0x6')]||0x0;this['loggedInDb']=_0x4e24fb['loggedInDb']||0x0;this[_0xcae1('0x19')]=_0x4e24fb[_0xcae1('0x19')]||0x0;this['notInUse']=_0x4e24fb['notInUse']||0x0;this[_0xcae1('0x10')]=_0x4e24fb['paused']||0x0;this[_0xcae1('0x0')]=_0x4e24fb[_0xcae1('0x0')]||0x0;this[_0xcae1('0x1a')]=_0x4e24fb[_0xcae1('0x1a')];this[_0xcae1('0x1b')]=_0x4e24fb[_0xcae1('0x1b')];this[_0xcae1('0x12')]=_0x4e24fb[_0xcae1('0x12')];this[_0xcae1('0x1c')]=_0x4e24fb[_0xcae1('0x1c')]||0x0;this[_0xcae1('0x1')]=_0x4e24fb[_0xcae1('0x1')]||0x0;this[_0xcae1('0x13')]=_0x4e24fb[_0xcae1('0x13')]||0x0;this['type']=_0x4e24fb[_0xcae1('0x1d')];this[_0xcae1('0x1e')]=_0x4e24fb[_0xcae1('0x1e')]||0x0;this[_0xcae1('0x1f')]=_0x4e24fb['unknown']||0x0;this[_0xcae1('0x20')]=_0x4e24fb[_0xcae1('0x20')]||0x0;this[_0xcae1('0x2')]=_0x4e24fb[_0xcae1('0x2')]||0x0;if(_0x4e24fb[_0xcae1('0x1d')]===_0xcae1('0x21')){this[_0xcae1('0x11')]=_0x4e24fb[_0xcae1('0x11')]||0x0;this['dialActive']=_0x4e24fb[_0xcae1('0x22')];this['dialMethod']=_0x4e24fb[_0xcae1('0x23')];this[_0xcae1('0x24')]=_0x4e24fb['dialOriginateCallerIdName'];this[_0xcae1('0x25')]=_0x4e24fb[_0xcae1('0x25')];this[_0xcae1('0x26')]=_0x4e24fb['dialOriginateTimeout'];this['dialPrefix']=_0x4e24fb[_0xcae1('0x27')];this[_0xcae1('0x28')]=_0x4e24fb[_0xcae1('0x28')];this[_0xcae1('0x29')]=_0x4e24fb[_0xcae1('0x29')];this[_0xcae1('0xa')]=_0x4e24fb[_0xcae1('0xa')];this['outboundBlacklistCallsDay']=_0x4e24fb[_0xcae1('0xb')];this[_0xcae1('0xc')]=_0x4e24fb[_0xcae1('0xc')];this['outboundCongestionCallsDay']=_0x4e24fb['outboundCongestionCallsDay'];this[_0xcae1('0x2a')]=_0x4e24fb['outboundDropCallsDayACS'];this[_0xcae1('0x2b')]=_0x4e24fb[_0xcae1('0x2b')];this[_0xcae1('0x2c')]=_0x4e24fb[_0xcae1('0x2c')];this[_0xcae1('0x2d')]=_0x4e24fb[_0xcae1('0x2d')];this[_0xcae1('0xd')]=_0x4e24fb[_0xcae1('0xd')];this[_0xcae1('0x2e')]=_0x4e24fb[_0xcae1('0x2e')];this['outboundReCallsDay']=_0x4e24fb[_0xcae1('0xe')];this[_0xcae1('0xf')]=_0x4e24fb[_0xcae1('0xf')];this[_0xcae1('0x2f')]=_0x4e24fb['outboundUnknownCallsDay'];this[_0xcae1('0x30')]=_0x4e24fb['predictiveIntervalAnsweredCalls'];this[_0xcae1('0x31')]=_0x4e24fb['predictiveIntervalAvgHoldtime'];this[_0xcae1('0x32')]=_0x4e24fb[_0xcae1('0x32')];this[_0xcae1('0x33')]=_0x4e24fb[_0xcae1('0x33')];this[_0xcae1('0x34')]=_0x4e24fb[_0xcae1('0x34')];this[_0xcae1('0x35')]=_0x4e24fb[_0xcae1('0x35')];this[_0xcae1('0x36')]=_0x4e24fb[_0xcae1('0x36')];this['predictiveIntervalHitRate']=_0x4e24fb[_0xcae1('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x4e24fb[_0xcae1('0x38')];this['predictiveIntervalPauses']=_0x4e24fb[_0xcae1('0x39')];this[_0xcae1('0x3a')]=_0x4e24fb['predictiveIntervalAvailable'];this[_0xcae1('0x3b')]=_0x4e24fb[_0xcae1('0x3b')];this[_0xcae1('0x8')]=_0x4e24fb[_0xcae1('0x8')];this['erlangCalls']=_0x4e24fb[_0xcae1('0x3c')];this[_0xcae1('0x3d')]=_0x4e24fb['erlangCallToSecond'];this[_0xcae1('0x3e')]=_0x4e24fb[_0xcae1('0x3e')];this[_0xcae1('0x3f')]=_0x4e24fb['erlangBusyFactor'];this[_0xcae1('0x40')]=_0x4e24fb['startPredictive'];this[_0xcae1('0x41')]=_0x4e24fb[_0xcae1('0x41')];this[_0xcae1('0x42')]=_0x4e24fb['message'];this[_0xcae1('0x43')]=_0x4e24fb[_0xcae1('0x43')];}if(_0x4e24fb[_0xcae1('0x44')]){this[_0xcae1('0x44')]={'id':_0x4e24fb[_0xcae1('0x44')]['id'],'name':_0x4e24fb[_0xcae1('0x44')]['name'],'active':_0x4e24fb[_0xcae1('0x44')][_0xcae1('0x45')],'callerid':_0x4e24fb[_0xcae1('0x44')][_0xcae1('0x46')]};}}VoiceQueueSummary[_0xcae1('0x47')][_0xcae1('0x48')]=function(_0x349a18,_0x1d6700,_0x145fd7,_0x43f389){this[_0xcae1('0x7')]=0x0;this['talking']=0x0;this[_0xcae1('0x10')]=0x0;this[_0xcae1('0x1f')]=0x0;this[_0xcae1('0x49')]=0x0;this[_0xcae1('0x5')]=0x0;this[_0xcae1('0x17')]=0x0;this[_0xcae1('0x18')]=0x0;this[_0xcae1('0x1e')]=0x0;this['ringing']=0x0;this[_0xcae1('0x1a')]=0x0;this[_0xcae1('0x19')]=0x0;if(_0x145fd7){if(_0x145fd7[_0xcae1('0x3')]){this[_0xcae1('0x3')]=Number(_0x145fd7['available']);}if(_0x145fd7['loggedin']){this['loggedIn']=Number(_0x145fd7[_0xcae1('0x4a')]);}if(_0x145fd7[_0xcae1('0x4b')]){this[_0xcae1('0x2')]=Number(_0x145fd7[_0xcae1('0x4b')]);}}for(var _0x11bacb=0x0;_0x11bacb<_0x349a18[_0xcae1('0x4c')];_0x11bacb++){var _0x5b95ab=_0x1d6700[_0xcae1('0x4d')+_0x349a18[_0x11bacb][_0xcae1('0x14')]];if(_0x5b95ab&&_0x5b95ab['online']){this[_0xcae1('0x7')]+=0x1;}if(_0x349a18[_0x11bacb][_0xcae1('0x4e')]==='1'){this[_0xcae1('0x1')]+=0x1;}if(_0x349a18[_0x11bacb]['paused']==='1'&&!['2','7','8']['includes'](_0x349a18[_0x11bacb][_0xcae1('0x4f')])){this[_0xcae1('0x10')]+=0x1;}switch(_0x349a18[_0x11bacb][_0xcae1('0x4f')]){case'0':this[_0xcae1('0x1f')]+=0x1;break;case'1':this[_0xcae1('0x49')]+=0x1;break;case'2':this[_0xcae1('0x5')]+=0x1;break;case'3':this[_0xcae1('0x17')]+=0x1;break;case'4':this[_0xcae1('0x18')]+=0x1;break;case'5':this[_0xcae1('0x1e')]+=0x1;break;case'6':this[_0xcae1('0x0')]+=0x1;break;case'7':this[_0xcae1('0x1a')]+=0x1;break;case'8':this[_0xcae1('0x19')]+=0x1;break;}}if(this['dialMethod']===_0xcae1('0x50')){var _0xcad695=Object[_0xcae1('0x51')](_0x43f389);for(var _0x258630=0x0;_0x258630<_0xcad695[_0xcae1('0x4c')];_0x258630++){var _0x3ccfb4=_0xcad695[_0x258630];var _0x9ef6d4=_0x43f389[_0x3ccfb4];if(_0x9ef6d4[_0xcae1('0x52')]===this[_0xcae1('0x14')]&&_0x9ef6d4[_0xcae1('0x1d')]===_0xcae1('0x53')&&_0x9ef6d4[_0xcae1('0x54')]==='xcally-motion-preview'){this[_0xcae1('0x1')]+=0x1;}}if(this[_0xcae1('0x1')]>this[_0xcae1('0x5')]){this['talking']=this[_0xcae1('0x5')];}this[_0xcae1('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xcae1('0x47')][_0xcae1('0x55')]=function(_0x5282ac){var _0x2efd37=![];if(_0x5282ac){_0x2efd37=INBOUND_COUNTERS[_0xcae1('0x56')](function(_0x1b40b9){return this[_0x1b40b9]!==_0x5282ac[_0x1b40b9];},this);}return _0x2efd37;};VoiceQueueSummary['prototype'][_0xcae1('0x57')]=function(_0x16b1b2){var _0x90b0ad=![];var _0x4e5d01=![];var _0x303b98=![];if(_0x16b1b2){_0x90b0ad=this[_0xcae1('0x23')]!==_0x16b1b2['dialMethod']||this[_0xcae1('0x22')]!==_0x16b1b2[_0xcae1('0x22')]||this[_0xcae1('0x42')]!==_0x16b1b2['message']||this[_0xcae1('0x43')]!==_0x16b1b2[_0xcae1('0x43')];_0x4e5d01=OUTBOUND_COUNTERS['some'](function(_0x4b68d1){return this[_0x4b68d1]!==_0x16b1b2[_0x4b68d1];},this);if(this[_0xcae1('0x44')]&&_0x16b1b2[_0xcae1('0x44')]){_0x303b98=this[_0xcae1('0x44')][_0xcae1('0x14')]!==_0x16b1b2['Trunk'][_0xcae1('0x14')]||this[_0xcae1('0x44')]['active']!==_0x16b1b2[_0xcae1('0x44')][_0xcae1('0x45')];}}return _0x90b0ad||_0x4e5d01||_0x303b98;};VoiceQueueSummary[_0xcae1('0x47')][_0xcae1('0x58')]=function(_0x1de80e){this[_0xcae1('0x4')]=_0x1de80e[_0xcae1('0x4')];this[_0xcae1('0x42')]=_0x1de80e[_0xcae1('0x42')];this['statusMessage']=_0x1de80e['statusMessage'];this[_0xcae1('0x8')]=_0x1de80e['originated'];this['outboundAbandonedCallsDay']=_0x1de80e[_0xcae1('0x9')];this[_0xcae1('0xa')]=_0x1de80e[_0xcae1('0xa')];this[_0xcae1('0xb')]=_0x1de80e[_0xcae1('0xb')];this[_0xcae1('0xc')]=_0x1de80e[_0xcae1('0xc')];this[_0xcae1('0x59')]=_0x1de80e[_0xcae1('0x59')];this[_0xcae1('0x2d')]=_0x1de80e[_0xcae1('0x2d')];this[_0xcae1('0xd')]=_0x1de80e['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1de80e[_0xcae1('0xe')];this[_0xcae1('0xf')]=_0x1de80e[_0xcae1('0xf')];this[_0xcae1('0x2f')]=_0x1de80e[_0xcae1('0x2f')];this['sumBillable']=_0x1de80e[_0xcae1('0x1b')];this[_0xcae1('0x12')]=_0x1de80e[_0xcae1('0x12')];this[_0xcae1('0x13')]=_0x1de80e[_0xcae1('0x13')];if(this[_0xcae1('0x23')]===_0xcae1('0x5a')){this[_0xcae1('0x11')]=_0x1de80e[_0xcae1('0x11')];}};module[_0xcae1('0x5b')]=VoiceQueueSummary; \ No newline at end of file +var _0x6b4e=['busy','invalid','onHold','paused','ringing','ringInUse','sumBillable','sumDuration','sumHoldTime','total','type','unavailable','unknown','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','notInUse','loggedin','callers','online','incall','includes','status','booked','keys','length','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','prototype','compareToOutboundQueue','some','exports','loggedIn','waiting','available','answered','inUse','loggedInDb','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','name','strategy','abandoned'];(function(_0x5de1e1,_0x42d021){var _0x52ab25=function(_0x5ab2cc){while(--_0x5ab2cc){_0x5de1e1['push'](_0x5de1e1['shift']());}};_0x52ab25(++_0x42d021);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x125dec,_0x4bacb8){_0x125dec=_0x125dec-0x0;var _0x31b390=_0x6b4e[_0x125dec];return _0x31b390;};'use strict';var INBOUND_COUNTERS=['available',_0xe6b4('0x0'),'loggedInDb','paused','ringing','talking',_0xe6b4('0x1')];var OUTBOUND_COUNTERS=[_0xe6b4('0x2'),_0xe6b4('0x3'),_0xe6b4('0x4'),_0xe6b4('0x0'),_0xe6b4('0x5'),'originated',_0xe6b4('0x6'),_0xe6b4('0x7'),_0xe6b4('0x8'),_0xe6b4('0x9'),_0xe6b4('0xa'),_0xe6b4('0xb'),_0xe6b4('0xc'),_0xe6b4('0xd'),_0xe6b4('0xe'),_0xe6b4('0xf'),'paused',_0xe6b4('0x10'),_0xe6b4('0x11'),'sumBillable','sumDuration','total',_0xe6b4('0x1')];function VoiceQueueSummary(_0x1519c0){this['id']=_0x1519c0['id'];this['name']=_0x1519c0[_0xe6b4('0x12')];this[_0xe6b4('0x13')]=_0x1519c0[_0xe6b4('0x13')];this[_0xe6b4('0x14')]=_0x1519c0[_0xe6b4('0x14')]||0x0;this['answered']=_0x1519c0[_0xe6b4('0x3')]||0x0;this[_0xe6b4('0x2')]=_0x1519c0[_0xe6b4('0x2')]||0x0;this[_0xe6b4('0x15')]=_0x1519c0['busy']||0x0;this[_0xe6b4('0x4')]=_0x1519c0[_0xe6b4('0x4')]||0x0;this[_0xe6b4('0x16')]=_0x1519c0[_0xe6b4('0x16')]||0x0;this[_0xe6b4('0x0')]=_0x1519c0['loggedIn']||0x0;this[_0xe6b4('0x5')]=_0x1519c0[_0xe6b4('0x5')]||0x0;this[_0xe6b4('0x17')]=_0x1519c0['onHold']||0x0;this['notInUse']=_0x1519c0['notInUse']||0x0;this[_0xe6b4('0x18')]=_0x1519c0['paused']||0x0;this['ringing']=_0x1519c0[_0xe6b4('0x19')]||0x0;this['ringInUse']=_0x1519c0[_0xe6b4('0x1a')];this[_0xe6b4('0x1b')]=_0x1519c0[_0xe6b4('0x1b')];this[_0xe6b4('0x1c')]=_0x1519c0[_0xe6b4('0x1c')];this[_0xe6b4('0x1d')]=_0x1519c0[_0xe6b4('0x1d')]||0x0;this[_0xe6b4('0x11')]=_0x1519c0['talking']||0x0;this[_0xe6b4('0x1e')]=_0x1519c0['total']||0x0;this[_0xe6b4('0x1f')]=_0x1519c0[_0xe6b4('0x1f')];this[_0xe6b4('0x20')]=_0x1519c0[_0xe6b4('0x20')]||0x0;this[_0xe6b4('0x21')]=_0x1519c0['unknown']||0x0;this['unmanaged']=_0x1519c0['unmanaged']||0x0;this[_0xe6b4('0x1')]=_0x1519c0['waiting']||0x0;if(_0x1519c0[_0xe6b4('0x1f')]===_0xe6b4('0x22')){this[_0xe6b4('0x10')]=_0x1519c0[_0xe6b4('0x10')]||0x0;this['dialActive']=_0x1519c0[_0xe6b4('0x23')];this[_0xe6b4('0x24')]=_0x1519c0[_0xe6b4('0x24')];this['dialOriginateCallerIdName']=_0x1519c0[_0xe6b4('0x25')];this['dialOriginateCallerIdNumber']=_0x1519c0[_0xe6b4('0x26')];this[_0xe6b4('0x27')]=_0x1519c0['dialOriginateTimeout'];this[_0xe6b4('0x28')]=_0x1519c0[_0xe6b4('0x28')];this[_0xe6b4('0x29')]=_0x1519c0['temp'];this['outboundAnswerAgiCallsDay']=_0x1519c0[_0xe6b4('0x2a')];this[_0xe6b4('0x7')]=_0x1519c0[_0xe6b4('0x7')];this[_0xe6b4('0x8')]=_0x1519c0[_0xe6b4('0x8')];this[_0xe6b4('0x9')]=_0x1519c0[_0xe6b4('0x9')];this[_0xe6b4('0xa')]=_0x1519c0[_0xe6b4('0xa')];this['outboundDropCallsDayACS']=_0x1519c0['outboundDropCallsDayACS'];this[_0xe6b4('0x2b')]=_0x1519c0[_0xe6b4('0x2b')];this['outboundDropCallsDayTimeout']=_0x1519c0[_0xe6b4('0x2c')];this[_0xe6b4('0xb')]=_0x1519c0[_0xe6b4('0xb')];this['outboundNoSuchCallsDay']=_0x1519c0[_0xe6b4('0xc')];this[_0xe6b4('0x2d')]=_0x1519c0[_0xe6b4('0x2d')];this[_0xe6b4('0xd')]=_0x1519c0[_0xe6b4('0xd')];this[_0xe6b4('0xe')]=_0x1519c0[_0xe6b4('0xe')];this['outboundUnknownCallsDay']=_0x1519c0[_0xe6b4('0xf')];this[_0xe6b4('0x2e')]=_0x1519c0[_0xe6b4('0x2e')];this['predictiveIntervalAvgHoldtime']=_0x1519c0[_0xe6b4('0x2f')];this[_0xe6b4('0x30')]=_0x1519c0['predictiveIntervalAvgTalktime'];this[_0xe6b4('0x31')]=_0x1519c0[_0xe6b4('0x31')];this[_0xe6b4('0x32')]=_0x1519c0[_0xe6b4('0x32')];this['predictiveIntervalErlangCalls']=_0x1519c0[_0xe6b4('0x33')];this[_0xe6b4('0x34')]=_0x1519c0[_0xe6b4('0x34')];this['predictiveIntervalHitRate']=_0x1519c0[_0xe6b4('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x1519c0[_0xe6b4('0x36')];this['predictiveIntervalPauses']=_0x1519c0['predictiveIntervalPauses'];this[_0xe6b4('0x37')]=_0x1519c0[_0xe6b4('0x37')];this[_0xe6b4('0x38')]=_0x1519c0['predictiveIntervalTotalCalls'];this[_0xe6b4('0x39')]=_0x1519c0[_0xe6b4('0x39')];this[_0xe6b4('0x3a')]=_0x1519c0[_0xe6b4('0x3a')];this[_0xe6b4('0x3b')]=_0x1519c0[_0xe6b4('0x3b')];this[_0xe6b4('0x3c')]=_0x1519c0[_0xe6b4('0x3c')];this[_0xe6b4('0x3d')]=_0x1519c0['erlangBusyFactor'];this[_0xe6b4('0x3e')]=_0x1519c0['startPredictive'];this['startProgressive']=_0x1519c0[_0xe6b4('0x3f')];this[_0xe6b4('0x40')]=_0x1519c0[_0xe6b4('0x40')];this[_0xe6b4('0x41')]=_0x1519c0['statusMessage'];}if(_0x1519c0[_0xe6b4('0x42')]){this[_0xe6b4('0x42')]={'id':_0x1519c0[_0xe6b4('0x42')]['id'],'name':_0x1519c0['Trunk'][_0xe6b4('0x12')],'active':_0x1519c0[_0xe6b4('0x42')][_0xe6b4('0x43')],'callerid':_0x1519c0[_0xe6b4('0x42')][_0xe6b4('0x44')]};}}VoiceQueueSummary['prototype'][_0xe6b4('0x45')]=function(_0x5bdd9d,_0x1538a7,_0x3ea04f,_0x3e7189){this['loggedInDb']=0x0;this[_0xe6b4('0x11')]=0x0;this['paused']=0x0;this[_0xe6b4('0x21')]=0x0;this[_0xe6b4('0x46')]=0x0;this[_0xe6b4('0x4')]=0x0;this[_0xe6b4('0x15')]=0x0;this[_0xe6b4('0x16')]=0x0;this[_0xe6b4('0x20')]=0x0;this[_0xe6b4('0x19')]=0x0;this[_0xe6b4('0x1a')]=0x0;this['onHold']=0x0;if(_0x3ea04f){if(_0x3ea04f[_0xe6b4('0x2')]){this['available']=Number(_0x3ea04f[_0xe6b4('0x2')]);}if(_0x3ea04f[_0xe6b4('0x47')]){this[_0xe6b4('0x0')]=Number(_0x3ea04f[_0xe6b4('0x47')]);}if(_0x3ea04f[_0xe6b4('0x48')]){this[_0xe6b4('0x1')]=Number(_0x3ea04f[_0xe6b4('0x48')]);}}for(var _0x4ecb9c=0x0;_0x4ecb9c<_0x5bdd9d['length'];_0x4ecb9c++){var _0x1ee558=_0x1538a7['SIP/'+_0x5bdd9d[_0x4ecb9c][_0xe6b4('0x12')]];if(_0x1ee558&&_0x1ee558[_0xe6b4('0x49')]){this[_0xe6b4('0x5')]+=0x1;}if(_0x5bdd9d[_0x4ecb9c][_0xe6b4('0x4a')]==='1'){this[_0xe6b4('0x11')]+=0x1;}if(_0x5bdd9d[_0x4ecb9c][_0xe6b4('0x18')]==='1'&&!['2','7','8'][_0xe6b4('0x4b')](_0x5bdd9d[_0x4ecb9c][_0xe6b4('0x4c')])){this[_0xe6b4('0x18')]+=0x1;}switch(_0x5bdd9d[_0x4ecb9c][_0xe6b4('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xe6b4('0x4')]+=0x1;break;case'3':this[_0xe6b4('0x15')]+=0x1;break;case'4':this[_0xe6b4('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xe6b4('0x19')]+=0x1;break;case'7':this[_0xe6b4('0x1a')]+=0x1;break;case'8':this[_0xe6b4('0x17')]+=0x1;break;}}if(this[_0xe6b4('0x24')]===_0xe6b4('0x4d')){var _0x407734=Object[_0xe6b4('0x4e')](_0x3e7189);for(var _0x299387=0x0;_0x299387<_0x407734[_0xe6b4('0x4f')];_0x299387++){var _0x447b53=_0x407734[_0x299387];var _0x2e3813=_0x3e7189[_0x447b53];if(_0x2e3813[_0xe6b4('0x50')]===this[_0xe6b4('0x12')]&&_0x2e3813[_0xe6b4('0x1f')]===_0xe6b4('0x51')&&_0x2e3813[_0xe6b4('0x52')]===_0xe6b4('0x53')){this[_0xe6b4('0x11')]+=0x1;}}if(this[_0xe6b4('0x11')]>this[_0xe6b4('0x4')]){this['talking']=this['inUse'];}this[_0xe6b4('0x10')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xe6b4('0x54')]=function(_0x1c815a){var _0xbca01f=![];if(_0x1c815a){_0xbca01f=INBOUND_COUNTERS['some'](function(_0x15c03a){return this[_0x15c03a]!==_0x1c815a[_0x15c03a];},this);}return _0xbca01f;};VoiceQueueSummary[_0xe6b4('0x55')][_0xe6b4('0x56')]=function(_0x181401){var _0x74f7d8=![];var _0xe5773e=![];var _0x74a8dd=![];if(_0x181401){_0x74f7d8=this['dialMethod']!==_0x181401[_0xe6b4('0x24')]||this[_0xe6b4('0x23')]!==_0x181401[_0xe6b4('0x23')]||this[_0xe6b4('0x40')]!==_0x181401[_0xe6b4('0x40')]||this['statusMessage']!==_0x181401[_0xe6b4('0x41')];_0xe5773e=OUTBOUND_COUNTERS[_0xe6b4('0x57')](function(_0xc9b063){return this[_0xc9b063]!==_0x181401[_0xc9b063];},this);if(this[_0xe6b4('0x42')]&&_0x181401[_0xe6b4('0x42')]){_0x74a8dd=this[_0xe6b4('0x42')][_0xe6b4('0x12')]!==_0x181401[_0xe6b4('0x42')][_0xe6b4('0x12')]||this['Trunk']['active']!==_0x181401[_0xe6b4('0x42')]['active'];}}return _0x74f7d8||_0xe5773e||_0x74a8dd;};VoiceQueueSummary[_0xe6b4('0x55')]['updateReportFromOutboundQueue']=function(_0x4c70ea){this[_0xe6b4('0x3')]=_0x4c70ea[_0xe6b4('0x3')];this[_0xe6b4('0x40')]=_0x4c70ea[_0xe6b4('0x40')];this[_0xe6b4('0x41')]=_0x4c70ea['statusMessage'];this[_0xe6b4('0x39')]=_0x4c70ea[_0xe6b4('0x39')];this[_0xe6b4('0x6')]=_0x4c70ea[_0xe6b4('0x6')];this['outboundAnswerCallsDay']=_0x4c70ea['outboundAnswerCallsDay'];this[_0xe6b4('0x8')]=_0x4c70ea['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x4c70ea[_0xe6b4('0x9')];this[_0xe6b4('0xa')]=_0x4c70ea[_0xe6b4('0xa')];this[_0xe6b4('0xb')]=_0x4c70ea[_0xe6b4('0xb')];this[_0xe6b4('0xc')]=_0x4c70ea[_0xe6b4('0xc')];this[_0xe6b4('0xd')]=_0x4c70ea[_0xe6b4('0xd')];this[_0xe6b4('0xe')]=_0x4c70ea[_0xe6b4('0xe')];this[_0xe6b4('0xf')]=_0x4c70ea[_0xe6b4('0xf')];this[_0xe6b4('0x1b')]=_0x4c70ea[_0xe6b4('0x1b')];this[_0xe6b4('0x1c')]=_0x4c70ea['sumDuration'];this[_0xe6b4('0x1e')]=_0x4c70ea[_0xe6b4('0x1e')];if(this[_0xe6b4('0x24')]==='preview'){this[_0xe6b4('0x10')]=_0x4c70ea['pTalking'];}};module[_0xe6b4('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 a0c87aa..abcdce1 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 _0x8d7b=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x32072a,_0x98e19){var _0x42135e=function(_0x4fb2a7){while(--_0x4fb2a7){_0x32072a['push'](_0x32072a['shift']());}};_0x42135e(++_0x98e19);}(_0x8d7b,0x1e8));var _0xb8d7=function(_0x3bf684,_0x43609f){_0x3bf684=_0x3bf684-0x0;var _0x46504d=_0x8d7b[_0x3bf684];return _0x46504d;};'use strict';function VtigerAccount(_0x1c8850){this['id']=_0x1c8850['id']||0x0;this['name']=_0x1c8850[_0xb8d7('0x0')]||'';this[_0xb8d7('0x1')]=_0x1c8850[_0xb8d7('0x1')]||'';this[_0xb8d7('0x2')]=_0x1c8850[_0xb8d7('0x2')]||'';this['remoteUri']=_0x1c8850[_0xb8d7('0x3')]||'';this[_0xb8d7('0x4')]=_0x1c8850[_0xb8d7('0x4')]||'';this[_0xb8d7('0x5')]=_0x1c8850[_0xb8d7('0x5')]||{};}module[_0xb8d7('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb4d5=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x44d10f,_0x1c1f23){var _0x8453ec=function(_0xb98937){while(--_0xb98937){_0x44d10f['push'](_0x44d10f['shift']());}};_0x8453ec(++_0x1c1f23);}(_0xb4d5,0x18e));var _0x5b4d=function(_0x2a73b3,_0x5f313f){_0x2a73b3=_0x2a73b3-0x0;var _0xadd5d1=_0xb4d5[_0x2a73b3];return _0xadd5d1;};'use strict';function VtigerAccount(_0x50aa1a){this['id']=_0x50aa1a['id']||0x0;this[_0x5b4d('0x0')]=_0x50aa1a[_0x5b4d('0x0')]||'';this['username']=_0x50aa1a[_0x5b4d('0x1')]||'';this[_0x5b4d('0x2')]=_0x50aa1a[_0x5b4d('0x2')]||'';this[_0x5b4d('0x3')]=_0x50aa1a[_0x5b4d('0x3')]||'';this[_0x5b4d('0x4')]=_0x50aa1a[_0x5b4d('0x4')]||'';this[_0x5b4d('0x5')]=_0x50aa1a['Configurations']||{};}module[_0x5b4d('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 5acacca..5f5823f 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 _0xe908=['serverUrl','Configurations','exports','name','username','password','remoteUri','authType','type','integrationTab'];(function(_0x3cba44,_0x280031){var _0x5750bb=function(_0x9b255d){while(--_0x9b255d){_0x3cba44['push'](_0x3cba44['shift']());}};_0x5750bb(++_0x280031);}(_0xe908,0x193));var _0x8e90=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe908[_0x465a0c];return _0x1e202e;};'use strict';function ZendeskAccount(_0x229431){this['id']=_0x229431['id']||0x0;this['name']=_0x229431[_0x8e90('0x0')]||'';this[_0x8e90('0x1')]=_0x229431[_0x8e90('0x1')]||'';this[_0x8e90('0x2')]=_0x229431['password']||'';this['token']=_0x229431['token']||'';this[_0x8e90('0x3')]=_0x229431[_0x8e90('0x3')]||'';this[_0x8e90('0x4')]=_0x229431[_0x8e90('0x4')]||'';this[_0x8e90('0x5')]=_0x229431['type']||_0x8e90('0x6');this['serverUrl']=_0x229431[_0x8e90('0x7')]||'';this[_0x8e90('0x8')]=_0x229431['Configurations']||{};}module[_0x8e90('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xfee3=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x19ff82,_0x4b3ca6){var _0x4979ee=function(_0x3b3d34){while(--_0x3b3d34){_0x19ff82['push'](_0x19ff82['shift']());}};_0x4979ee(++_0x4b3ca6);}(_0xfee3,0xc8));var _0x3fee=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xfee3[_0x10d34b];return _0x92b0bf;};'use strict';function ZendeskAccount(_0x3a9c4d){this['id']=_0x3a9c4d['id']||0x0;this[_0x3fee('0x0')]=_0x3a9c4d[_0x3fee('0x0')]||'';this[_0x3fee('0x1')]=_0x3a9c4d[_0x3fee('0x1')]||'';this[_0x3fee('0x2')]=_0x3a9c4d[_0x3fee('0x2')]||'';this[_0x3fee('0x3')]=_0x3a9c4d[_0x3fee('0x3')]||'';this['remoteUri']=_0x3a9c4d[_0x3fee('0x4')]||'';this['authType']=_0x3a9c4d[_0x3fee('0x5')]||'';this[_0x3fee('0x6')]=_0x3a9c4d['type']||_0x3fee('0x7');this['serverUrl']=_0x3a9c4d[_0x3fee('0x8')]||'';this[_0x3fee('0x9')]=_0x3a9c4d[_0x3fee('0x9')]||{};}module[_0x3fee('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 491d02d..40cc3bc 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 _0xaa6a=['clientSecret','serverUrl','code','refreshToken','exports','name','description','host','zone','clientId'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xaa6a,0x1db));var _0xaaa6=function(_0x31f736,_0x3d652a){_0x31f736=_0x31f736-0x0;var _0x301d9a=_0xaa6a[_0x31f736];return _0x301d9a;};'use strict';function ZohoAccount(_0xf5d9b1){this['id']=_0xf5d9b1['id']||0x0;this[_0xaaa6('0x0')]=_0xf5d9b1['name']||'';this['description']=_0xf5d9b1[_0xaaa6('0x1')]||'';this['host']=_0xf5d9b1[_0xaaa6('0x2')]||'';this['zone']=_0xf5d9b1[_0xaaa6('0x3')]||'';this[_0xaaa6('0x4')]=_0xf5d9b1[_0xaaa6('0x4')]||'';this[_0xaaa6('0x5')]=_0xf5d9b1[_0xaaa6('0x5')]||'';this[_0xaaa6('0x6')]=_0xf5d9b1[_0xaaa6('0x6')]||'';this[_0xaaa6('0x7')]=_0xf5d9b1['code']||'';this[_0xaaa6('0x8')]=_0xf5d9b1[_0xaaa6('0x8')]||'';this['Configurations']=_0xf5d9b1['Configurations']||{};}module[_0xaaa6('0x9')]=ZohoAccount; \ No newline at end of file +var _0x68e6=['clientId','clientSecret','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68e6,0x11c));var _0x668e=function(_0xab7710,_0x1bf517){_0xab7710=_0xab7710-0x0;var _0x238bad=_0x68e6[_0xab7710];return _0x238bad;};'use strict';function ZohoAccount(_0x21c175){this['id']=_0x21c175['id']||0x0;this[_0x668e('0x0')]=_0x21c175[_0x668e('0x0')]||'';this[_0x668e('0x1')]=_0x21c175[_0x668e('0x1')]||'';this[_0x668e('0x2')]=_0x21c175['host']||'';this[_0x668e('0x3')]=_0x21c175[_0x668e('0x3')]||'';this[_0x668e('0x4')]=_0x21c175[_0x668e('0x4')]||'';this['clientSecret']=_0x21c175[_0x668e('0x5')]||'';this['serverUrl']=_0x21c175['serverUrl']||'';this[_0x668e('0x6')]=_0x21c175[_0x668e('0x6')]||'';this[_0x668e('0x7')]=_0x21c175[_0x668e('0x7')]||'';this[_0x668e('0x8')]=_0x21c175[_0x668e('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index dbd7bc1..f3cdae4 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 _0x4991=['ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x226432,_0x80ae6f){var _0x468ca2=function(_0x4fb1ea){while(--_0x4fb1ea){_0x226432['push'](_0x226432['shift']());}};_0x468ca2(++_0x80ae6f);}(_0x4991,0xf7));var _0x1499=function(_0x35ca52,_0x2ce03c){_0x35ca52=_0x35ca52-0x0;var _0x383006=_0x4991[_0x35ca52];return _0x383006;};'use strict';var util=require(_0x1499('0x0'));var _=require('lodash');var moment=require(_0x1499('0x1'));function checkNameSurname(_0x5bd577,_0x30d640,_0x256e41){var _0x16ac22='';if(!_[_0x1499('0x2')](_0x30d640)&&_0x1499('0x3')===typeof _0x30d640){_0x16ac22+=_0x30d640;}if(!_[_0x1499('0x2')](_0x256e41)&&_0x1499('0x3')===typeof _0x256e41){_0x16ac22+='\x20'+_0x256e41;}if(_0x16ac22!==''){return _0x16ac22;}return _0x5bd577;}function Action(_0x209616,_0x4b6154,_0x2a8e96,_0x1c3bd7,_0x1c65c3){this[_0x1499('0x4')]=_0x2a8e96||undefined;this[_0x1499('0x5')]=_0x209616['id'];this[_0x1499('0x6')]=_0x4b6154[_0x1499('0x7')];this[_0x1499('0x8')]=_0x4b6154['type'];this[_0x1499('0x9')]=_0x1499('0x6');this['dialAnswer']=![];this[_0x1499('0xa')]=_[_0x1499('0x2')](_0x209616['Agent'])?undefined:_0x209616[_0x1499('0xb')][_0x1499('0x7')];this['channelAgent']=this['membername']?util['format'](_0x1499('0xc'),this[_0x1499('0xa')]):_0x1c3bd7||undefined;this[_0x1499('0xd')]=checkNameSurname(_0x209616[_0x1499('0xe')][_0x1499('0xf')],_0x209616['Contact']['firstName'],_0x209616[_0x1499('0xe')]['lastName']);this[_0x1499('0x10')]=_0x209616[_0x1499('0x10')]||![];this[_0x1499('0x11')]=_0x209616[_0x1499('0xf')];this['scheduledat']=_0x209616[_0x1499('0x12')];this[_0x1499('0x13')]=_0x209616['countbusyretry']||0x0;this[_0x1499('0x14')]=_0x209616[_0x1499('0x14')]||0x0;this[_0x1499('0x15')]=_0x209616[_0x1499('0x15')]||0x0;this[_0x1499('0x16')]=(_0x209616[_0x1499('0x13')]||0x0)+(_0x209616['countcongestionretry']||0x0)+(_0x209616['countnoanswerretry']||0x0)+(_0x209616['countnosuchnumberretry']||0x0)+(_0x209616[_0x1499('0x17')]||0x0)+(_0x209616[_0x1499('0x18')]||0x0)+(_0x209616['countmachineretry']||0x0)+(_0x209616[_0x1499('0x19')]||0x0);this[_0x1499('0x1a')]=_0x209616[_0x1499('0x1a')]||0x0;this[_0x1499('0x17')]=_0x209616[_0x1499('0x17')]||0x0;this[_0x1499('0x18')]=_0x209616[_0x1499('0x18')]||0x0;this[_0x1499('0x1b')]=_0x209616[_0x1499('0x1b')]||0x0;this[_0x1499('0x19')]=_0x209616[_0x1499('0x19')]||0x0;this[_0x1499('0x1c')]=_0x209616[_0x1499('0x1c')];this[_0x1499('0x1d')]=_0x209616[_0x1499('0x1d')];this[_0x1499('0x1e')]=_0x209616[_0x1499('0x1e')];this['recallme']=_0x209616[_0x1499('0x1f')];this[_0x1499('0x20')]=_0x209616[_0x1499('0x20')];this[_0x1499('0x21')]=_0x209616[_0x1499('0x21')];this[_0x1499('0x22')]=_['isNil'](_0x209616['Agent'])?_0x209616[_0x1499('0x22')]:_0x209616[_0x1499('0xb')]['id'];this[_0x1499('0x23')]=_0x209616[_0x1499('0x23')];this[_0x1499('0x24')]='';this['originatecalleridname']='';}Action[_0x1499('0x25')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x1499('0xd')],this[_0x1499('0x26')]);};module[_0x1499('0x27')]=Action; \ No newline at end of file +var _0x4b17=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback'];(function(_0x4be492,_0x5deda5){var _0x3555f0=function(_0x2cb0ff){while(--_0x2cb0ff){_0x4be492['push'](_0x4be492['shift']());}};_0x3555f0(++_0x5deda5);}(_0x4b17,0x10f));var _0x74b1=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x4b17[_0x22dac7];return _0x3e6cfa;};'use strict';var util=require(_0x74b1('0x0'));var _=require('lodash');var moment=require(_0x74b1('0x1'));function checkNameSurname(_0x5483a2,_0xd14270,_0x356a31){var _0x547636='';if(!_[_0x74b1('0x2')](_0xd14270)&&'string'===typeof _0xd14270){_0x547636+=_0xd14270;}if(!_['isNil'](_0x356a31)&&_0x74b1('0x3')===typeof _0x356a31){_0x547636+='\x20'+_0x356a31;}if(_0x547636!==''){return _0x547636;}return _0x5483a2;}function Action(_0x30d910,_0x379dcc,_0x3873a6,_0x371c3b,_0x191d2b){this[_0x74b1('0x4')]=_0x3873a6||undefined;this['idContact']=_0x30d910['id'];this[_0x74b1('0x5')]=_0x379dcc[_0x74b1('0x6')];this[_0x74b1('0x7')]=_0x379dcc[_0x74b1('0x7')];this[_0x74b1('0x8')]='queue';this[_0x74b1('0x9')]=![];this[_0x74b1('0xa')]=_['isNil'](_0x30d910[_0x74b1('0xb')])?undefined:_0x30d910[_0x74b1('0xb')][_0x74b1('0x6')];this[_0x74b1('0xc')]=this['membername']?util[_0x74b1('0xd')]('SIP/%s',this['membername']):_0x371c3b||undefined;this[_0x74b1('0xe')]=checkNameSurname(_0x30d910[_0x74b1('0xf')]['phone'],_0x30d910['Contact']['firstName'],_0x30d910[_0x74b1('0xf')]['lastName']);this['active']=_0x30d910[_0x74b1('0x10')]||![];this[_0x74b1('0x11')]=_0x30d910[_0x74b1('0x12')];this[_0x74b1('0x13')]=_0x30d910[_0x74b1('0x13')];this[_0x74b1('0x14')]=_0x30d910['countbusyretry']||0x0;this[_0x74b1('0x15')]=_0x30d910[_0x74b1('0x15')]||0x0;this[_0x74b1('0x16')]=_0x30d910[_0x74b1('0x16')]||0x0;this[_0x74b1('0x17')]=(_0x30d910[_0x74b1('0x14')]||0x0)+(_0x30d910[_0x74b1('0x15')]||0x0)+(_0x30d910['countnoanswerretry']||0x0)+(_0x30d910[_0x74b1('0x18')]||0x0)+(_0x30d910[_0x74b1('0x19')]||0x0)+(_0x30d910['countabandonedretry']||0x0)+(_0x30d910[_0x74b1('0x1a')]||0x0)+(_0x30d910[_0x74b1('0x1b')]||0x0);this[_0x74b1('0x18')]=_0x30d910[_0x74b1('0x18')]||0x0;this[_0x74b1('0x19')]=_0x30d910[_0x74b1('0x19')]||0x0;this[_0x74b1('0x1c')]=_0x30d910[_0x74b1('0x1c')]||0x0;this['countmachineretry']=_0x30d910[_0x74b1('0x1a')]||0x0;this['countagentrejectretry']=_0x30d910['countagentrejectretry']||0x0;this['callback']=_0x30d910[_0x74b1('0x1d')];this[_0x74b1('0x1e')]=_0x30d910[_0x74b1('0x1e')];this[_0x74b1('0x1f')]=_0x30d910[_0x74b1('0x1f')];this['recallme']=_0x30d910[_0x74b1('0x20')];this['ContactId']=_0x30d910[_0x74b1('0x21')];this[_0x74b1('0x22')]=_0x30d910[_0x74b1('0x22')];this[_0x74b1('0x23')]=_[_0x74b1('0x2')](_0x30d910[_0x74b1('0xb')])?_0x30d910[_0x74b1('0x23')]:_0x30d910[_0x74b1('0xb')]['id'];this['VoiceQueueId']=_0x30d910[_0x74b1('0x24')];this[_0x74b1('0x25')]='';this[_0x74b1('0x26')]='';}Action['prototype'][_0x74b1('0x27')]=function(){return util[_0x74b1('0xd')](_0x74b1('0x28'),this[_0x74b1('0xe')],this[_0x74b1('0x29')]);};module[_0x74b1('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8ec44c4..f382fc1 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(_0x4e8e9f,_0x38421e){var _0x4cc150=function(_0x3951ec){while(--_0x3951ec){_0x4e8e9f['push'](_0x4e8e9f['shift']());}};_0x4cc150(++_0x38421e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x2c0537,_0x1ac252){var _0x5c29e5=function(_0x32d691){while(--_0x32d691){_0x2c0537['push'](_0x2c0537['shift']());}};_0x5c29e5(++_0x1ac252);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 0c126ae..d384a52 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 _0xac35=['../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','inspect','createHistory','catch','resolve','then','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird'];(function(_0x167983,_0x5f0ac3){var _0x417171=function(_0x1101e3){while(--_0x1101e3){_0x167983['push'](_0x167983['shift']());}};_0x417171(++_0x5f0ac3);}(_0xac35,0x180));var _0x5ac3=function(_0x24c38e,_0x512304){_0x24c38e=_0x24c38e-0x0;var _0x5070ed=_0xac35[_0x24c38e];return _0x5070ed;};'use strict';var util=require('util');var BPromise=require(_0x5ac3('0x0'));var logger=require(_0x5ac3('0x1'))(_0x5ac3('0x2'));var cmHopper=require(_0x5ac3('0x3'));var cmHopperHistory=require(_0x5ac3('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x5ac3('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4b1ebf){return function(_0x1e537c){logger['error'](_0x4b1ebf,util[_0x5ac3('0x6')](_0x1e537c,{'showHidden':![],'depth':null}));};}function create(_0x4eeb7f){return cmHopperHistory[_0x5ac3('0x7')](_0x4eeb7f)[_0x5ac3('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x39317d){return BPromise[_0x5ac3('0x9')]()[_0x5ac3('0xa')](agentReportPreview[_0x5ac3('0x7')](_0x39317d))[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0xb')));}function moveContact(_0x5a926b){return cmHopper['moveContactManagedDialer'](_0x5a926b,!![])[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0xc')));}exports[_0x5ac3('0xd')]=function(_0x591141){return cmHopperBlack[_0x5ac3('0xd')](_0x591141)[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0xe')));};exports[_0x5ac3('0xf')]=function(_0x8c975b){return BPromise[_0x5ac3('0x9')]()[_0x5ac3('0xa')](cmHopper[_0x5ac3('0xf')](_0x8c975b))[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x10')));};exports[_0x5ac3('0x7')]=function(_0x4e2dfa,_0x5ec9bc){create(_0x4e2dfa)[_0x5ac3('0x8')](loggerCatch(_0x5ec9bc));moveContact(_0x4e2dfa)['catch'](loggerCatch(_0x5ec9bc));};exports[_0x5ac3('0x11')]=function(_0x4a49bf,_0x3b14f1){createAgent(_0x4a49bf)[_0x5ac3('0x8')](loggerCatch(_0x3b14f1));};exports[_0x5ac3('0x12')]=function(_0xb3ea24,_0x32d245){create(_0xb3ea24)[_0x5ac3('0x8')](loggerCatch(_0x32d245));};exports[_0x5ac3('0x13')]=function(_0x2f310e,_0x1f580e){moveContact(_0x2f310e)[_0x5ac3('0x8')](loggerCatch(_0x1f580e));};exports[_0x5ac3('0x14')]=function(_0x151b80,_0x2db657,_0x377192){if(_0x2db657){_0x151b80[_0x5ac3('0x15')]=null;}if(_0x377192){_0x151b80[_0x5ac3('0x16')]=![];}return cmHopper[_0x5ac3('0x14')](_0x151b80)[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x17')));};exports[_0x5ac3('0x18')]=function(_0x22f88e){return cmHopper[_0x5ac3('0x18')](_0x22f88e)[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x19')));};exports['unlockContact']=function(_0x30ab36){return cmHopper[_0x5ac3('0x1a')]({'UserId':null},_0x30ab36,0x1)[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x1b')));};exports[_0x5ac3('0x1c')]=function(_0x18ac9c){return cmHopper[_0x5ac3('0x1a')]({'active':![]},_0x18ac9c,0x1)[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x1d')));};exports[_0x5ac3('0x1e')]=function(_0x37628f){var _0x20c3a5={};_0x20c3a5[_0x5ac3('0x1f')]=_0x37628f[_0x5ac3('0x1f')];_0x20c3a5['uniqueid']=_0x37628f[_0x5ac3('0x20')];_0x20c3a5[_0x5ac3('0x21')]=_0x37628f[_0x5ac3('0x21')];_0x20c3a5[_0x5ac3('0x22')]=_0x37628f[_0x5ac3('0x22')];_0x20c3a5['queue']=_0x37628f[_0x5ac3('0x23')];_0x20c3a5[_0x5ac3('0x24')]=_0x37628f['answertime'];_0x20c3a5[_0x5ac3('0x25')]=_0x37628f[_0x5ac3('0x26')];_0x20c3a5[_0x5ac3('0x27')]=0x1;_0x20c3a5[_0x5ac3('0x28')]=_0x37628f[_0x5ac3('0x29')];_0x20c3a5[_0x5ac3('0x2a')]=_0x37628f[_0x5ac3('0x2b')];_0x20c3a5['context']=_0x5ac3('0x2c');_0x20c3a5[_0x5ac3('0x2d')]='xcally-motion-preview';_0x20c3a5['holdtime']=0x0;_0x20c3a5[_0x5ac3('0x2e')]=0x1;_0x20c3a5[_0x5ac3('0x2f')]=_0x37628f['membername'];_0x20c3a5[_0x5ac3('0x30')]=_0x5ac3('0x31');return BPromise[_0x5ac3('0x9')]()[_0x5ac3('0xa')](voiceQueueReport['create'](_0x20c3a5))[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x32')));};exports[_0x5ac3('0x33')]=function(_0x29300a,_0x7254d8){return BPromise[_0x5ac3('0x9')]()['then'](cmHopper[_0x5ac3('0x33')](_0x29300a,_0x7254d8))[_0x5ac3('0x8')](loggerCatch(_0x5ac3('0x34')));};exports[_0x5ac3('0x35')]=function(_0x285d50){return cmHopper[_0x5ac3('0x14')](_0x285d50,!![],!![])['catch'](loggerCatch(_0x5ac3('0x36')));}; \ No newline at end of file +var _0x0572=['exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','resolve','then','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x0572,0x124));var _0x2057=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x0572[_0x4ff09b];return _0x3f5c2e;};'use strict';var util=require(_0x2057('0x0'));var BPromise=require(_0x2057('0x1'));var logger=require(_0x2057('0x2'))(_0x2057('0x3'));var cmHopper=require(_0x2057('0x4'));var cmHopperHistory=require(_0x2057('0x5'));var cmHopperBlack=require(_0x2057('0x6'));var agentReportPreview=require(_0x2057('0x7'));var voiceQueueReport=require(_0x2057('0x8'));function loggerCatch(_0x94c598){return function(_0x1d981e){logger[_0x2057('0x9')](_0x94c598,util[_0x2057('0xa')](_0x1d981e,{'showHidden':![],'depth':null}));};}function create(_0x1d78c4){return cmHopperHistory[_0x2057('0xb')](_0x1d78c4)[_0x2057('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x59c84f){return BPromise[_0x2057('0xd')]()[_0x2057('0xe')](agentReportPreview['createHistory'](_0x59c84f))[_0x2057('0xc')](loggerCatch(_0x2057('0xf')));}function moveContact(_0x2c8015){return cmHopper['moveContactManagedDialer'](_0x2c8015,!![])[_0x2057('0xc')](loggerCatch(_0x2057('0x10')));}exports[_0x2057('0x11')]=function(_0x149133){return cmHopperBlack[_0x2057('0x11')](_0x149133)['catch'](loggerCatch(_0x2057('0x12')));};exports['getContactPreview']=function(_0x39ad88){return BPromise[_0x2057('0xd')]()[_0x2057('0xe')](cmHopper['getContactPreview'](_0x39ad88))[_0x2057('0xc')](loggerCatch(_0x2057('0x13')));};exports['createHistory']=function(_0x9b76fc,_0x3d1404){create(_0x9b76fc)[_0x2057('0xc')](loggerCatch(_0x3d1404));moveContact(_0x9b76fc)['catch'](loggerCatch(_0x3d1404));};exports[_0x2057('0x14')]=function(_0x15d96c,_0x1a41ff){createAgent(_0x15d96c)[_0x2057('0xc')](loggerCatch(_0x1a41ff));};exports[_0x2057('0x15')]=function(_0x116497,_0x144eca){create(_0x116497)['catch'](loggerCatch(_0x144eca));};exports[_0x2057('0x16')]=function(_0x2af133,_0x265549){moveContact(_0x2af133)[_0x2057('0xc')](loggerCatch(_0x265549));};exports['rescheduleContact']=function(_0x1694b0,_0x4cddcd,_0x8567a6){if(_0x4cddcd){_0x1694b0[_0x2057('0x17')]=null;}if(_0x8567a6){_0x1694b0[_0x2057('0x18')]=![];}return cmHopper[_0x2057('0x19')](_0x1694b0)[_0x2057('0xc')](loggerCatch(_0x2057('0x1a')));};exports[_0x2057('0x1b')]=function(_0x50f4b5){return cmHopper[_0x2057('0x1b')](_0x50f4b5)[_0x2057('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x34cb4f){return cmHopper[_0x2057('0x1c')]({'UserId':null},_0x34cb4f,0x1)[_0x2057('0xc')](loggerCatch(_0x2057('0x1d')));};exports['disableContact']=function(_0x1422e5){return cmHopper['unlockContact']({'active':![]},_0x1422e5,0x1)[_0x2057('0xc')](loggerCatch(_0x2057('0x1e')));};exports[_0x2057('0x1f')]=function(_0x1ed60a){var _0x54b577={};_0x54b577['type']=_0x1ed60a['type'];_0x54b577['uniqueid']=_0x1ed60a[_0x2057('0x20')];_0x54b577[_0x2057('0x21')]=_0x1ed60a[_0x2057('0x21')];_0x54b577[_0x2057('0x22')]=_0x1ed60a[_0x2057('0x22')];_0x54b577[_0x2057('0x23')]=_0x1ed60a['queue'];_0x54b577[_0x2057('0x24')]=_0x1ed60a[_0x2057('0x25')];_0x54b577[_0x2057('0x26')]=_0x1ed60a[_0x2057('0x25')];_0x54b577[_0x2057('0x27')]=0x1;_0x54b577[_0x2057('0x28')]=_0x1ed60a[_0x2057('0x29')];_0x54b577[_0x2057('0x2a')]=_0x1ed60a['membername'];_0x54b577[_0x2057('0x2b')]='from-sip';_0x54b577[_0x2057('0x2c')]=_0x2057('0x2d');_0x54b577['holdtime']=0x0;_0x54b577[_0x2057('0x2e')]=0x1;_0x54b577[_0x2057('0x2f')]=_0x1ed60a[_0x2057('0x30')];_0x54b577[_0x2057('0x31')]=_0x2057('0x32');return BPromise[_0x2057('0xd')]()[_0x2057('0xe')](voiceQueueReport[_0x2057('0x33')](_0x54b577))[_0x2057('0xc')](loggerCatch(_0x2057('0x34')));};exports[_0x2057('0x35')]=function(_0x1cae9e,_0x11198e){return BPromise[_0x2057('0xd')]()[_0x2057('0xe')](cmHopper[_0x2057('0x35')](_0x1cae9e,_0x11198e))['catch'](loggerCatch(_0x2057('0x36')));};exports[_0x2057('0x37')]=function(_0x20ffca){return cmHopper[_0x2057('0x19')](_0x20ffca,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index f8f6402..521f617 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 _0x57b5=['xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','logger2','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','statedesc','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','Global','active','scheduledat','minutes','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl'];(function(_0x324c68,_0x3545c9){var _0x12023f=function(_0x13c2f8){while(--_0x13c2f8){_0x324c68['push'](_0x324c68['shift']());}};_0x12023f(++_0x3545c9);}(_0x57b5,0x1bf));var _0x557b=function(_0x3d5798,_0x11a5a4){_0x3d5798=_0x3d5798-0x0;var _0x2f9b86=_0x57b5[_0x3d5798];return _0x2f9b86;};'use strict';var util=require(_0x557b('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0x557b('0x1'));var ipAgi=process[_0x557b('0x2')][_0x557b('0x3')]||_0x557b('0x4');var utils=require(_0x557b('0x5'));exports[_0x557b('0x6')]=function(_0xdebfa1){return function(_0x1f257d){logger[_0x557b('0x7')](_0xdebfa1,util[_0x557b('0x8')](_0x1f257d,{'showHidden':![],'depth':null}));};};exports[_0x557b('0x9')]=function(_0x5b5519,_0x34209a){logger['info'](_0x5b5519,util[_0x557b('0x8')](_0x34209a,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4ba2e9,_0x54ea92){logger['error'](_0x4ba2e9,util[_0x557b('0x8')](_0x54ea92,{'showHidden':![],'depth':null}));};exports[_0x557b('0xa')]=function(_0x2e20d0){return function(_0x3e5dc4){logger[_0x557b('0xb')](_0x2e20d0,util[_0x557b('0x8')](_0x3e5dc4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3a1a95,_0x216003,_0x1eee7e){return{'message':_0x3a1a95,'unlock':_0x216003,'active':_0x1eee7e};};exports[_0x557b('0xc')]=function(_0x557fe4,_0x363557,_0x13f242){if(!_[_0x557b('0xd')](_0x13f242)&&_0x557b('0xe')===typeof _0x13f242&&!_['isEmpty'](_0x13f242)){if(!_[_0x557b('0xd')](_0x363557)&&_0x557b('0xe')===typeof _0x363557&&!_[_0x557b('0xf')](_0x363557)){return util[_0x557b('0x10')](_0x557b('0x11'),_0x363557,_0x13f242);}return util[_0x557b('0x10')](_0x557b('0x11'),_0x13f242,_0x13f242);}if(!_[_0x557b('0xd')](_0x557fe4)&&_0x557b('0xe')===typeof _0x557fe4&&!_[_0x557b('0xf')](_0x557fe4)){return _0x557fe4;}return _0x557b('0x12');};exports[_0x557b('0x13')]=function(_0x5d1730){if(_['isNil'](_0x5d1730)){return![];}return _0x5d1730;};exports[_0x557b('0x14')]=function(_0x5ef7bb,_0x3ddddf,_0x2d411f,_0x1c0097,_0x43325b,_0x4b0471){var _0x269db2={'XMD-QUEUE':_0x3ddddf['Queue']?_0x3ddddf[_0x557b('0x15')][_0x557b('0x16')]:'','XMD-CALLERID':_0x1c0097,'XMD-CALLERID-PREVIEW':_0x4b0471?util['format'](_0x557b('0x11'),_0x4b0471[_0x557b('0x17')],_0x4b0471[_0x557b('0x18')]):_0x1c0097,'XMD-DIALID':_0x43325b,'XMD-CONTACTID':_0x3ddddf[_0x557b('0x19')],'XMD-CDRTYPE':_0x557b('0x1a'),'CALLERID(all)':_0x1c0097,'XMD-VOICEQUEUEID':_0x3ddddf[_0x557b('0x1b')],'XMD-DIALCHANNEL':_0x2d411f,'XMD-DIALTIMEOUT':_0x5ef7bb[_0x557b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x557b('0x10')](_0x557b('0x1d'),_0x5ef7bb[_0x557b('0x1e')]?'g':'',_[_0x557b('0xf')](_0x5ef7bb[_0x557b('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5ef7bb['dialPreviewUrl']||'','XMD-AGI':_0x5ef7bb['dialQueueProject']?util[_0x557b('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5ef7bb[_0x557b('0x20')]):_0x557b('0x21'),'XMD-AGIAFTER':_0x5ef7bb[_0x557b('0x1e')]?util['format'](_0x557b('0x22'),ipAgi,_0x5ef7bb[_0x557b('0x1e')]):_0x557b('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x4b0471?_0x4b0471[_0x557b('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x4b0471?_0x4b0471[_0x557b('0x24')]:'','XMD-DESTINATION':_0x557b('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x557b('0xf')](_0x5ef7bb[_0x557b('0x1f')])){_0x269db2[util[_0x557b('0x10')]('%s',_0x557b('0x26'))]=_0x5ef7bb['monitor_format'];_0x269db2[util[_0x557b('0x10')]('%s',_0x557b('0x27'))]=_0x43325b;}return _0x269db2;};exports[_0x557b('0x28')]=function(_0x49c7b5){var _0x507608={};for(var _0x45ca88 in _0x49c7b5){if(_0x49c7b5[_0x557b('0x29')](_0x45ca88)){_0x507608[util[_0x557b('0x10')]('%s',_['toLower'](_0x45ca88))]=_0x49c7b5[_0x45ca88];}}return{'variables':_0x507608};};exports[_0x557b('0x2a')]=function(_0x40434f,_0x36655){if(!_[_0x557b('0x2b')](_0x40434f)){if(_0x40434f[_0x557b('0x29')]('originated')){if(_0x40434f[_0x557b('0x2c')]>0x0){_0x40434f[_0x557b('0x2c')]-=0x1;}else{logger[_0x557b('0x7')](_0x557b('0x2d'),_0x36655);}}}else{logger[_0x557b('0x7')](_0x557b('0x2e'),_0x36655);}};exports[_0x557b('0x2f')]=function(_0x4391dc){var _0x56d1c8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4391dc[_0x557b('0x30')]=0xd;_0x4391dc['statedesc']=_0x557b('0x31');_0x4391dc[_0x557b('0x32')]=_0x56d1c8;_0x4391dc['responsetime']=_0x56d1c8;_0x4391dc[_0x557b('0x33')]=_0x56d1c8;};exports[_0x557b('0x34')]=function(_0x589dff,_0x1adbb0,_0x1893d3){var _0x2bb320=moment()[_0x557b('0x10')](_0x557b('0x35'));_0x589dff['state']=_0x1adbb0;_0x589dff['statedesc']=_0x1893d3;_0x589dff[_0x557b('0x36')]=_0x2bb320;_0x589dff[_0x557b('0x37')]=utils[_0x557b('0x38')](_0x589dff[_0x557b('0x36')],_0x589dff[_0x557b('0x32')]);};exports[_0x557b('0x39')]=function(_0x1938ea,_0x60a8b,_0x4c94fd){_0x1938ea[_0x557b('0x3a')]=_0x60a8b;_0x1938ea[_0x557b('0x3b')]=_0x4c94fd;};exports['logCustomer']=function(_0x2e2be0,_0x442840,_0x4a44ea){var _0x3b9f05=moment()[_0x557b('0x10')](_0x557b('0x35'));_0x2e2be0['state']=_0x442840;_0x2e2be0[_0x557b('0x3c')]=_0x4a44ea;_0x2e2be0[_0x557b('0x36')]=_0x2e2be0['responsetime']?_0x2e2be0[_0x557b('0x36')]:_0x3b9f05;_0x2e2be0[_0x557b('0x33')]=_0x2e2be0[_0x557b('0x33')]?_0x2e2be0[_0x557b('0x33')]:_0x3b9f05;_0x2e2be0[_0x557b('0x37')]=utils['getSeconds'](_0x2e2be0[_0x557b('0x36')]||0x0,_0x2e2be0['starttime']||0x0);_0x2e2be0[_0x557b('0x3d')]=_0x2e2be0[_0x557b('0x3e')]?utils[_0x557b('0x38')](_0x2e2be0['endtime'],_0x2e2be0['answertime']):0x0;};exports[_0x557b('0x3f')]=function(_0x1c2de3){return _0x1c2de3===_0x557b('0x40');};exports[_0x557b('0x41')]=function(_0x4ec2f3,_0x31def2,_0x11df8f,_0x34184c,_0x4f1d0e){var _0x246011=_0x34184c?_0x557b('0x42'):_0x4ec2f3['calleridname'];_0x246011=_0x4f1d0e?_0x557b('0x43'):_0x246011;return{'actionid':_0x4ec2f3[_0x557b('0x44')],'action':_0x557b('0x45'),'channel':_0x4ec2f3[_0x557b('0x46')],'callerid':util['format'](_0x557b('0x11'),_0x246011,_0x4ec2f3[_0x557b('0x18')]),'Exten':_0x557b('0x25'),'Context':_0x557b('0x47'),'Priority':'1','variable':_0x11df8f,'timeout':(_0x31def2[_0x557b('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4ec2f3[_0x557b('0x44')]};};exports[_0x557b('0x49')]=function(_0x11b08a){return _0x11b08a[_0x557b('0x4a')]+_0x11b08a[_0x557b('0x4b')]+_0x11b08a[_0x557b('0x4c')]+_0x11b08a['countagentrejectretry']+_0x11b08a['countnosuchnumberretry'];};exports['cloneAction']=function(_0x54ee70){var _0xe4baa3=_['clone'](_0x54ee70);_0xe4baa3[_0x557b('0x30')]=0xf;_0xe4baa3[_0x557b('0x3c')]=_0x557b('0x4d');return _0xe4baa3;};exports['scheduledAt']=function(_0x3dd89d,_0x5e4c63,_0x454827){var _0x24d82a={};_0x24d82a[_0x5e4c63]=_0x3dd89d[_0x5e4c63];_0x24d82a[_0x557b('0x4e')]=![];_0x24d82a[_0x557b('0x4f')]=moment()['add'](_0x454827,_0x557b('0x50'))[_0x557b('0x10')](_0x557b('0x35'));_0x24d82a[_0x557b('0x19')]=_0x3dd89d[_0x557b('0x19')];_0x24d82a[_0x557b('0x51')]=_0x3dd89d['ListId'];_0x24d82a[_0x557b('0x1b')]=_0x3dd89d[_0x557b('0x1b')]||undefined;return _0x24d82a;};exports[_0x557b('0x52')]=function(_0x46c1f2,_0x360bca){if(!_[_0x557b('0x2b')](_0x46c1f2)){if(_0x46c1f2['pTalking']>0x0){_0x46c1f2['pTalking']-=0x1;}else{logger[_0x557b('0x7')](_0x360bca,_0x557b('0x53'));}}else{logger['error'](_0x360bca,_0x557b('0x54'));}};exports[_0x557b('0x55')]=function(_0x5ecedd){if(_0x5ecedd<=0x0){return!![];}return![];};function buildObj(_0x260451,_0x28bb32,_0x2ad07d){_0x260451[_0x557b('0x56')]=_0x28bb32;_0x260451[_0x557b('0x16')]=_0x260451[_0x557b('0x57')];_0x260451['interface']=_0x260451[_0x557b('0x46')];_0x260451[_0x557b('0x58')]=_0x557b('0x59');if(_0x2ad07d){_0x260451[_0x557b('0x5a')]=_0x2ad07d[_0x557b('0x5a')];}return _0x260451;}exports[_0x557b('0x5b')]=buildObj;exports[_0x557b('0x5c')]=function(_0x4756aa){var _0x40bb9f=[];for(var _0x58beaa in _0x4756aa){if(_0x4756aa['hasOwnProperty'](_0x58beaa)){if(!_['isNil'](_0x4756aa[_0x58beaa])&&_0x4756aa[_0x58beaa][_0x557b('0x30')]===_0x557b('0x5d')&&_0x4756aa[_0x58beaa]['status']==='reachable'){_0x40bb9f[_0x557b('0x5e')](_0x4756aa[_0x58beaa]['id']);}}}return _0x40bb9f;};exports[_0x557b('0x5f')]=function(_0x44df91){var _0xe1d71c=moment()[_0x557b('0x60')](0x0);var _0x236627=moment(_0x44df91)['milliseconds'](0x0);return _0xe1d71c[_0x557b('0x61')](_0x236627,_0x557b('0x62'));};exports[_0x557b('0x63')]=function(_0x315a60){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x315a60[_0x557b('0x19')],'ListId':_0x315a60[_0x557b('0x51')],'VoiceQueueId':_0x315a60['VoiceQueueId']||undefined,'CampaignId':_0x315a60[_0x557b('0x64')]||undefined};};exports['filterKey']=function(_0x6b0ff8){if(_0x6b0ff8===_0x557b('0x44')||_0x6b0ff8===_0x557b('0x65')||_0x6b0ff8===_0x557b('0x57')||_0x6b0ff8===_0x557b('0x66')||_0x6b0ff8===_0x557b('0x67')||_0x6b0ff8==='dialAnswer'||_0x6b0ff8===_0x557b('0x3a')||_0x6b0ff8==='channelAgent'||_0x6b0ff8===_0x557b('0x17')||_0x6b0ff8===_0x557b('0x4e')||_0x6b0ff8===_0x557b('0x18')||_0x6b0ff8===_0x557b('0x4f')||_0x6b0ff8===_0x557b('0x4a')||_0x6b0ff8==='countcongestionretry'||_0x6b0ff8===_0x557b('0x4c')||_0x6b0ff8===_0x557b('0x68')||_0x6b0ff8===_0x557b('0x69')||_0x6b0ff8===_0x557b('0x6a')||_0x6b0ff8===_0x557b('0x6b')||_0x6b0ff8===_0x557b('0x6c')||_0x6b0ff8===_0x557b('0x19')||_0x6b0ff8===_0x557b('0x51')||_0x6b0ff8===_0x557b('0x3b')||_0x6b0ff8===_0x557b('0x1b')||_0x6b0ff8==='sipcallid'||_0x6b0ff8===_0x557b('0x6d')||_0x6b0ff8==='xmd-queue'||_0x6b0ff8===_0x557b('0x6e')||_0x6b0ff8===_0x557b('0x6f')||_0x6b0ff8===_0x557b('0x70')||_0x6b0ff8===_0x557b('0x71')||_0x6b0ff8===_0x557b('0x72')||_0x6b0ff8===_0x557b('0x73')||_0x6b0ff8===_0x557b('0x74')||_0x6b0ff8===_0x557b('0x75')||_0x6b0ff8==='xmd-cdrtype'||_0x6b0ff8==='xmd-callerid'||_0x6b0ff8===_0x557b('0x76')||_0x6b0ff8===_0x557b('0x77')||_0x6b0ff8===_0x557b('0x78')||_0x6b0ff8===_0x557b('0x79')||_0x6b0ff8===_0x557b('0x7a')||_0x6b0ff8===_0x557b('0x7b')||_0x6b0ff8===_0x557b('0x7c')||_0x6b0ff8===_0x557b('0x7d')||_0x6b0ff8===_0x557b('0x7e')||_0x6b0ff8===_0x557b('0x7f')||_0x6b0ff8==='rtpaudioqos'||_0x6b0ff8===_0x557b('0x79')||_0x6b0ff8==='rtpaudioqosjitter'||_0x6b0ff8==='rtpaudioqosjitterbridged'||_0x6b0ff8===_0x557b('0x7c')||_0x6b0ff8==='rtpaudioqoslossbridged'||_0x6b0ff8==='rtpaudioqosrtt'||_0x6b0ff8===_0x557b('0x7f')||_0x6b0ff8===_0x557b('0x80')||_0x6b0ff8===_0x557b('0x81')||_0x6b0ff8===_0x557b('0x30')||_0x6b0ff8===_0x557b('0x3c')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2f20ae,_0xd027cd){var _0xc666d1,_0x187171,_0x2016ed;if(_0xd027cd<=0x0){_0xd027cd=0x1;}_0xc666d1=new RegExp('\x5cw{0,'+_0xd027cd+'}$');_0x187171=Math[_0x557b('0x82')](0xa,_0xd027cd-0x1);_0x2016ed=Math[_0x557b('0x82')](0xa,_0xd027cd)-0x1;return util['format']('%s',_[_0x557b('0x83')](_0x2f20ae,_0xc666d1,_[_0x557b('0x84')](_0x187171,_0x2016ed)));};exports['extractCalleridName']=function(_0x2ceea7){var _0x338880=_0x2ceea7[_0x557b('0x85')](/"(.*?)"/);return _0x338880?_0x338880[0x1]:_0x2ceea7;};exports[_0x557b('0x86')]=function(_0x2257d1){var _0x33029f=_0x2257d1[_0x557b('0x85')](/<(.*?)>/);return _0x33029f?_0x33029f[0x1]:_0x2257d1;};function buildNoAnswerEventPayload(_0x3436cb,_0x4ab79a){var _0x264f22=buildObj(_0x3436cb,_0x557b('0x87'));if(!_['isEmpty'](_0x4ab79a[_0x557b('0x88')])){Object['keys'](_0x4ab79a['variables'])[_0x557b('0x89')](function(_0x2fec76){_0x264f22[_0x2fec76[_0x557b('0x8a')]()]=_0x4ab79a[_0x557b('0x88')][_0x2fec76];});}return _0x264f22;}exports[_0x557b('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x3f7c=['lastevent','name','queue','interface','voice','mandatoryDisposition','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','logAgent','statedesc','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','endtime','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','countbusyretry','countnosuchnumberretry','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn'];(function(_0x5705d5,_0x69022f){var _0xb6ee8d=function(_0x1aa65d){while(--_0x1aa65d){_0x5705d5['push'](_0x5705d5['shift']());}};_0xb6ee8d(++_0x69022f);}(_0x3f7c,0x1e0));var _0xc3f7=function(_0x49086d,_0x2356ee){_0x49086d=_0x49086d-0x0;var _0x8d1dd6=_0x3f7c[_0x49086d];return _0x8d1dd6;};'use strict';var util=require(_0xc3f7('0x0'));var _=require(_0xc3f7('0x1'));var moment=require(_0xc3f7('0x2'));var logger=require('../../../../config/logger')(_0xc3f7('0x3'));var ipAgi=process['env'][_0xc3f7('0x4')]||'127.0.0.1';var utils=require(_0xc3f7('0x5'));exports[_0xc3f7('0x6')]=function(_0x463d86){return function(_0x446cd7){logger[_0xc3f7('0x7')](_0x463d86,util[_0xc3f7('0x8')](_0x446cd7,{'showHidden':![],'depth':null}));};};exports[_0xc3f7('0x9')]=function(_0x31b367,_0x31401d){logger[_0xc3f7('0xa')](_0x31b367,util['inspect'](_0x31401d,{'showHidden':![],'depth':null}));};exports[_0xc3f7('0xb')]=function(_0x6daa2c,_0xffb9f){logger[_0xc3f7('0x7')](_0x6daa2c,util[_0xc3f7('0x8')](_0xffb9f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x56e3a2){return function(_0x253b99){logger[_0xc3f7('0xa')](_0x56e3a2,util[_0xc3f7('0x8')](_0x253b99,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x52f87e,_0x1ecc3a,_0xcb9dd4){return{'message':_0x52f87e,'unlock':_0x1ecc3a,'active':_0xcb9dd4};};exports[_0xc3f7('0xc')]=function(_0x536f0b,_0xf10967,_0x1dfbb1){if(!_[_0xc3f7('0xd')](_0x1dfbb1)&&_0xc3f7('0xe')===typeof _0x1dfbb1&&!_[_0xc3f7('0xf')](_0x1dfbb1)){if(!_[_0xc3f7('0xd')](_0xf10967)&&_0xc3f7('0xe')===typeof _0xf10967&&!_[_0xc3f7('0xf')](_0xf10967)){return util['format'](_0xc3f7('0x10'),_0xf10967,_0x1dfbb1);}return util[_0xc3f7('0x11')]('\x22%s\x22\x20<%s>',_0x1dfbb1,_0x1dfbb1);}if(!_[_0xc3f7('0xd')](_0x536f0b)&&_0xc3f7('0xe')===typeof _0x536f0b&&!_[_0xc3f7('0xf')](_0x536f0b)){return _0x536f0b;}return'\x22\x22\x20<>';};exports[_0xc3f7('0x12')]=function(_0x1aadac){if(_[_0xc3f7('0x13')](_0x1aadac)){return![];}return _0x1aadac;};exports[_0xc3f7('0x14')]=function(_0x3ae5f3,_0x400bef,_0x3eee90,_0x735378,_0xa3c4f2,_0x5644bd){var _0x4b9c9f={'XMD-QUEUE':_0x400bef[_0xc3f7('0x15')]?_0x400bef['Queue']['name']:'','XMD-CALLERID':_0x735378,'XMD-CALLERID-PREVIEW':_0x5644bd?util[_0xc3f7('0x11')]('\x22%s\x22\x20<%s>',_0x5644bd[_0xc3f7('0x16')],_0x5644bd['calleridnum']):_0x735378,'XMD-DIALID':_0xa3c4f2,'XMD-CONTACTID':_0x400bef[_0xc3f7('0x17')],'XMD-CDRTYPE':_0xc3f7('0x18'),'CALLERID(all)':_0x735378,'XMD-VOICEQUEUEID':_0x400bef[_0xc3f7('0x19')],'XMD-DIALCHANNEL':_0x3eee90,'XMD-DIALTIMEOUT':_0x3ae5f3[_0xc3f7('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xc3f7('0x11')](_0xc3f7('0x1b'),_0x3ae5f3[_0xc3f7('0x1c')]?'g':'',_[_0xc3f7('0xf')](_0x3ae5f3[_0xc3f7('0x1d')])?'':_0xc3f7('0x1e')),'XMD-DIALURL':_0x3ae5f3[_0xc3f7('0x1f')]||'','XMD-AGI':_0x3ae5f3['dialQueueProject']?util[_0xc3f7('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3ae5f3['dialQueueProject']):_0xc3f7('0x20'),'XMD-AGIAFTER':_0x3ae5f3[_0xc3f7('0x1c')]?util['format'](_0xc3f7('0x21'),ipAgi,_0x3ae5f3[_0xc3f7('0x1c')]):_0xc3f7('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x5644bd?_0x5644bd['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5644bd?_0x5644bd[_0xc3f7('0x22')]:'','XMD-DESTINATION':_0xc3f7('0x23'),'SIPADDHEADER':_0xc3f7('0x24')};if(!_[_0xc3f7('0xf')](_0x3ae5f3[_0xc3f7('0x1d')])){_0x4b9c9f[util[_0xc3f7('0x11')]('%s',_0xc3f7('0x25'))]=_0x3ae5f3[_0xc3f7('0x1d')];_0x4b9c9f[util['format']('%s',_0xc3f7('0x26'))]=_0xa3c4f2;}return _0x4b9c9f;};exports[_0xc3f7('0x27')]=function(_0x846b68){var _0x521a84={};for(var _0x522197 in _0x846b68){if(_0x846b68[_0xc3f7('0x28')](_0x522197)){_0x521a84[util['format']('%s',_['toLower'](_0x522197))]=_0x846b68[_0x522197];}}return{'variables':_0x521a84};};exports[_0xc3f7('0x29')]=function(_0xc83bc9,_0x340a6e){if(!_['isNil'](_0xc83bc9)){if(_0xc83bc9[_0xc3f7('0x28')](_0xc3f7('0x2a'))){if(_0xc83bc9[_0xc3f7('0x2a')]>0x0){_0xc83bc9[_0xc3f7('0x2a')]-=0x1;}else{logger[_0xc3f7('0x7')](_0xc3f7('0x2b'),_0x340a6e);}}}else{logger['error'](_0xc3f7('0x2c'),_0x340a6e);}};exports[_0xc3f7('0x2d')]=function(_0x5c9a38){var _0x47316d=moment()[_0xc3f7('0x11')](_0xc3f7('0x2e'));_0x5c9a38[_0xc3f7('0x2f')]=0xd;_0x5c9a38['statedesc']='Blacklist';_0x5c9a38['starttime']=_0x47316d;_0x5c9a38[_0xc3f7('0x30')]=_0x47316d;_0x5c9a38['endtime']=_0x47316d;};exports[_0xc3f7('0x31')]=function(_0x2192bb,_0x1480a6,_0x117cea){var _0x33309f=moment()[_0xc3f7('0x11')](_0xc3f7('0x2e'));_0x2192bb[_0xc3f7('0x2f')]=_0x1480a6;_0x2192bb[_0xc3f7('0x32')]=_0x117cea;_0x2192bb[_0xc3f7('0x30')]=_0x33309f;_0x2192bb[_0xc3f7('0x33')]=utils[_0xc3f7('0x34')](_0x2192bb[_0xc3f7('0x30')],_0x2192bb[_0xc3f7('0x35')]);};exports[_0xc3f7('0x36')]=function(_0x2c1750,_0x2b208e,_0x588099){_0x2c1750[_0xc3f7('0x37')]=_0x2b208e;_0x2c1750[_0xc3f7('0x38')]=_0x588099;};exports['logCustomer']=function(_0x102fe3,_0x47fad6,_0x1c9898){var _0x4be8e3=moment()[_0xc3f7('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x102fe3[_0xc3f7('0x2f')]=_0x47fad6;_0x102fe3[_0xc3f7('0x32')]=_0x1c9898;_0x102fe3[_0xc3f7('0x30')]=_0x102fe3['responsetime']?_0x102fe3[_0xc3f7('0x30')]:_0x4be8e3;_0x102fe3['endtime']=_0x102fe3[_0xc3f7('0x39')]?_0x102fe3[_0xc3f7('0x39')]:_0x4be8e3;_0x102fe3[_0xc3f7('0x33')]=utils[_0xc3f7('0x34')](_0x102fe3['responsetime']||0x0,_0x102fe3[_0xc3f7('0x35')]||0x0);_0x102fe3[_0xc3f7('0x3a')]=_0x102fe3[_0xc3f7('0x3b')]?utils[_0xc3f7('0x34')](_0x102fe3[_0xc3f7('0x39')],_0x102fe3[_0xc3f7('0x3b')]):0x0;};exports[_0xc3f7('0x3c')]=function(_0x53a1cd){return _0x53a1cd===_0xc3f7('0x3d');};exports['variablesAction']=function(_0x5981ad,_0x149489,_0x2fe83,_0x1b02db,_0x27399d){var _0x5b1395=_0x1b02db?'RECALL':_0x5981ad[_0xc3f7('0x16')];_0x5b1395=_0x27399d?_0xc3f7('0x3e'):_0x5b1395;return{'actionid':_0x5981ad[_0xc3f7('0x3f')],'action':_0xc3f7('0x40'),'channel':_0x5981ad[_0xc3f7('0x41')],'callerid':util[_0xc3f7('0x11')](_0xc3f7('0x10'),_0x5b1395,_0x5981ad[_0xc3f7('0x42')]),'Exten':_0xc3f7('0x23'),'Context':_0xc3f7('0x43'),'Priority':'1','variable':_0x2fe83,'timeout':(_0x149489['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5981ad[_0xc3f7('0x3f')]};};exports['totalGlobal']=function(_0x48aa76){return _0x48aa76[_0xc3f7('0x44')]+_0x48aa76['countcongestionretry']+_0x48aa76['countnoanswerretry']+_0x48aa76['countagentrejectretry']+_0x48aa76[_0xc3f7('0x45')];};exports['cloneAction']=function(_0x245033){var _0x2cc520=_[_0xc3f7('0x46')](_0x245033);_0x2cc520['state']=0xf;_0x2cc520[_0xc3f7('0x32')]=_0xc3f7('0x47');return _0x2cc520;};exports['scheduledAt']=function(_0x35fff7,_0x32ff2f,_0x1cba8a){var _0x172e22={};_0x172e22[_0x32ff2f]=_0x35fff7[_0x32ff2f];_0x172e22[_0xc3f7('0x48')]=![];_0x172e22[_0xc3f7('0x49')]=moment()['add'](_0x1cba8a,_0xc3f7('0x4a'))['format'](_0xc3f7('0x2e'));_0x172e22['ContactId']=_0x35fff7[_0xc3f7('0x17')];_0x172e22[_0xc3f7('0x4b')]=_0x35fff7[_0xc3f7('0x4b')];_0x172e22[_0xc3f7('0x19')]=_0x35fff7[_0xc3f7('0x19')]||undefined;return _0x172e22;};exports[_0xc3f7('0x4c')]=function(_0x542739,_0x15daea){if(!_[_0xc3f7('0x13')](_0x542739)){if(_0x542739['pTalking']>0x0){_0x542739[_0xc3f7('0x4d')]-=0x1;}else{logger[_0xc3f7('0x7')](_0x15daea,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc3f7('0x7')](_0x15daea,_0xc3f7('0x4e'));}};exports[_0xc3f7('0x4f')]=function(_0x5f08f0){if(_0x5f08f0<=0x0){return!![];}return![];};function buildObj(_0x34d830,_0x39cae0,_0x45db5d){_0x34d830[_0xc3f7('0x50')]=_0x39cae0;_0x34d830[_0xc3f7('0x51')]=_0x34d830[_0xc3f7('0x52')];_0x34d830[_0xc3f7('0x53')]=_0x34d830[_0xc3f7('0x41')];_0x34d830['motionChannel']=_0xc3f7('0x54');if(_0x45db5d){_0x34d830[_0xc3f7('0x55')]=_0x45db5d[_0xc3f7('0x55')];}return _0x34d830;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x46d51c){var _0x1b52ff=[];for(var _0x46ccc2 in _0x46d51c){if(_0x46d51c[_0xc3f7('0x28')](_0x46ccc2)){if(!_[_0xc3f7('0x13')](_0x46d51c[_0x46ccc2])&&_0x46d51c[_0x46ccc2][_0xc3f7('0x2f')]===_0xc3f7('0x56')&&_0x46d51c[_0x46ccc2][_0xc3f7('0x57')]===_0xc3f7('0x58')){_0x1b52ff[_0xc3f7('0x59')](_0x46d51c[_0x46ccc2]['id']);}}}return _0x1b52ff;};exports[_0xc3f7('0x5a')]=function(_0x4ff9b4){var _0x153e67=moment()[_0xc3f7('0x5b')](0x0);var _0x408749=moment(_0x4ff9b4)[_0xc3f7('0x5b')](0x0);return _0x153e67[_0xc3f7('0x5c')](_0x408749,_0xc3f7('0x5d'));};exports[_0xc3f7('0x5e')]=function(_0x4b01db){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b01db[_0xc3f7('0x17')],'ListId':_0x4b01db['ListId'],'VoiceQueueId':_0x4b01db[_0xc3f7('0x19')]||undefined,'CampaignId':_0x4b01db[_0xc3f7('0x5f')]||undefined};};exports[_0xc3f7('0x60')]=function(_0x3f20d9){if(_0x3f20d9===_0xc3f7('0x3f')||_0x3f20d9===_0xc3f7('0x61')||_0x3f20d9===_0xc3f7('0x52')||_0x3f20d9==='type'||_0x3f20d9===_0xc3f7('0x62')||_0x3f20d9==='dialAnswer'||_0x3f20d9==='membername'||_0x3f20d9==='channelAgent'||_0x3f20d9===_0xc3f7('0x16')||_0x3f20d9===_0xc3f7('0x48')||_0x3f20d9===_0xc3f7('0x42')||_0x3f20d9===_0xc3f7('0x49')||_0x3f20d9==='countbusyretry'||_0x3f20d9==='countcongestionretry'||_0x3f20d9===_0xc3f7('0x63')||_0x3f20d9===_0xc3f7('0x64')||_0x3f20d9===_0xc3f7('0x65')||_0x3f20d9===_0xc3f7('0x66')||_0x3f20d9===_0xc3f7('0x67')||_0x3f20d9===_0xc3f7('0x68')||_0x3f20d9==='ContactId'||_0x3f20d9===_0xc3f7('0x4b')||_0x3f20d9==='UserId'||_0x3f20d9===_0xc3f7('0x19')||_0x3f20d9===_0xc3f7('0x69')||_0x3f20d9===_0xc3f7('0x6a')||_0x3f20d9===_0xc3f7('0x6b')||_0x3f20d9===_0xc3f7('0x6c')||_0x3f20d9==='xmd-listid'||_0x3f20d9===_0xc3f7('0x6d')||_0x3f20d9===_0xc3f7('0x6e')||_0x3f20d9===_0xc3f7('0x6f')||_0x3f20d9===_0xc3f7('0x70')||_0x3f20d9===_0xc3f7('0x71')||_0x3f20d9===_0xc3f7('0x72')||_0x3f20d9==='xmd-cdrtype'||_0x3f20d9===_0xc3f7('0x73')||_0x3f20d9==='xmd-agiafter'||_0x3f20d9===_0xc3f7('0x74')||_0x3f20d9===_0xc3f7('0x75')||_0x3f20d9===_0xc3f7('0x76')||_0x3f20d9===_0xc3f7('0x77')||_0x3f20d9===_0xc3f7('0x78')||_0x3f20d9===_0xc3f7('0x79')||_0x3f20d9===_0xc3f7('0x7a')||_0x3f20d9===_0xc3f7('0x7b')||_0x3f20d9===_0xc3f7('0x7c')||_0x3f20d9===_0xc3f7('0x75')||_0x3f20d9==='rtpaudioqosbridged'||_0x3f20d9===_0xc3f7('0x77')||_0x3f20d9===_0xc3f7('0x78')||_0x3f20d9===_0xc3f7('0x79')||_0x3f20d9===_0xc3f7('0x7a')||_0x3f20d9===_0xc3f7('0x7b')||_0x3f20d9===_0xc3f7('0x7c')||_0x3f20d9===_0xc3f7('0x7d')||_0x3f20d9===_0xc3f7('0x7e')||_0x3f20d9===_0xc3f7('0x2f')||_0x3f20d9==='statedesc'){return![];}return!![];};exports[_0xc3f7('0x7f')]=function(_0x22f6d8,_0xdd99c){var _0xd771e0,_0x9aa24e,_0x5895eb;if(_0xdd99c<=0x0){_0xdd99c=0x1;}_0xd771e0=new RegExp(_0xc3f7('0x80')+_0xdd99c+'}$');_0x9aa24e=Math[_0xc3f7('0x81')](0xa,_0xdd99c-0x1);_0x5895eb=Math['pow'](0xa,_0xdd99c)-0x1;return util[_0xc3f7('0x11')]('%s',_[_0xc3f7('0x82')](_0x22f6d8,_0xd771e0,_[_0xc3f7('0x83')](_0x9aa24e,_0x5895eb)));};exports[_0xc3f7('0x84')]=function(_0x548a10){var _0x250178=_0x548a10[_0xc3f7('0x85')](/"(.*?)"/);return _0x250178?_0x250178[0x1]:_0x548a10;};exports[_0xc3f7('0x86')]=function(_0x167bcb){var _0x160fd3=_0x167bcb['match'](/<(.*?)>/);return _0x160fd3?_0x160fd3[0x1]:_0x167bcb;};function buildNoAnswerEventPayload(_0x2cdefc,_0x95d091){var _0x2939a3=buildObj(_0x2cdefc,_0xc3f7('0x87'));if(!_[_0xc3f7('0xf')](_0x95d091['variables'])){Object[_0xc3f7('0x88')](_0x95d091[_0xc3f7('0x89')])['forEach'](function(_0x1fd085){_0x2939a3[_0x1fd085[_0xc3f7('0x8a')]()]=_0x95d091['variables'][_0x1fd085];});}return _0x2939a3;}exports[_0xc3f7('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6b32395..7b62a9e 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 _0x82d2=['voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause'];(function(_0x381654,_0x233f76){var _0x13af54=function(_0x51b061){while(--_0x51b061){_0x381654['push'](_0x381654['shift']());}};_0x13af54(++_0x233f76);}(_0x82d2,0xd4));var _0x282d=function(_0x2bcf57,_0x176e37){_0x2bcf57=_0x2bcf57-0x0;var _0x3bc6d1=_0x82d2[_0x2bcf57];return _0x3bc6d1;};'use strict';exports[_0x282d('0x0')]={'queue':{'type':_0x282d('0x1'),'required':!![]},'interface':{'type':_0x282d('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x282d('0x2'),'required':![]},'paused':{'type':_0x282d('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x282d('0x1'),'required':!![]},'interface':{'type':_0x282d('0x1'),'required':!![]}};exports[_0x282d('0x4')]={'interface':{'type':_0x282d('0x1'),'required':!![]},'paused':{'type':_0x282d('0x3')},'reason':{'type':_0x282d('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x282d('0x1'),'required':!![]}};exports[_0x282d('0x5')]={'uniqueid':{'type':_0x282d('0x1'),'required':!![]},'filename':{'type':_0x282d('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x282d('0x1'),'required':!![]}};exports[_0x282d('0x6')]={'uniqueid':{'type':_0x282d('0x1'),'required':!![]},'exten':{'type':_0x282d('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xaf46=['voicequeuechannelredirect','queueadd','string','number','boolean','voicequeuechannel','voicequeuechannelhangup'];(function(_0x2247d7,_0x2ad652){var _0x1d3dd0=function(_0x1a1f6f){while(--_0x1a1f6f){_0x2247d7['push'](_0x2247d7['shift']());}};_0x1d3dd0(++_0x2ad652);}(_0xaf46,0x8d));var _0x6af4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaf46[_0x122ef9];return _0x42fba0;};'use strict';exports[_0x6af4('0x0')]={'queue':{'type':_0x6af4('0x1'),'required':!![]},'interface':{'type':_0x6af4('0x1'),'required':!![]},'membername':{'type':_0x6af4('0x1'),'required':!![]},'penalty':{'type':_0x6af4('0x2'),'required':![]},'paused':{'type':_0x6af4('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x6af4('0x1'),'required':!![]},'interface':{'type':_0x6af4('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x6af4('0x1'),'required':!![]},'paused':{'type':_0x6af4('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x6af4('0x4')]={'uniqueid':{'type':_0x6af4('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x6af4('0x1'),'required':!![]},'filename':{'type':_0x6af4('0x1')},'format':{'type':_0x6af4('0x1')},'mixmonitorid':{'type':_0x6af4('0x1')}};exports[_0x6af4('0x5')]={'uniqueid':{'type':_0x6af4('0x1'),'required':!![]}};exports[_0x6af4('0x6')]={'uniqueid':{'type':_0x6af4('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x6af4('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 72f3b01..372b72b 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x4ac1b0,_0x4887e2){var _0x4b06c5=function(_0x1beb40){while(--_0x1beb40){_0x4ac1b0['push'](_0x4ac1b0['shift']());}};_0x4b06c5(++_0x4887e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xb10b[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x58f971,_0x3a8ae4){var _0x4ce838=function(_0x455343){while(--_0x455343){_0x58f971['push'](_0x58f971['shift']());}};_0x4ce838(++_0x3a8ae4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index ef01fc4..752a29b 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 _0x16fe=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x35ceb8,_0xc332fc){var _0x2ea11e=function(_0x4c6494){while(--_0x4c6494){_0x35ceb8['push'](_0x35ceb8['shift']());}};_0x2ea11e(++_0xc332fc);}(_0x16fe,0x82));var _0xe16f=function(_0x45502a,_0x3ca17b){_0x45502a=_0x45502a-0x0;var _0x55959c=_0x16fe[_0x45502a];return _0x55959c;};'use strict';function mergeDBDataToRealtime(_0x288b4d,_0x3d98c9){var _0xad4050=Object[_0xe16f('0x0')]({},_0x288b4d);for(var _0x28194a in _0x3d98c9){if(_0xad4050[_0xe16f('0x1')](_0x28194a)){_0xad4050[_0x28194a]=_0x3d98c9[_0x28194a];}}return _0xad4050;}exports[_0xe16f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x11bb=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x176a52,_0x423983){var _0x1866a8=function(_0x1c5d3c){while(--_0x1c5d3c){_0x176a52['push'](_0x176a52['shift']());}};_0x1866a8(++_0x423983);}(_0x11bb,0x152));var _0xb11b=function(_0x1a825f,_0x1af04a){_0x1a825f=_0x1a825f-0x0;var _0x3bc689=_0x11bb[_0x1a825f];return _0x3bc689;};'use strict';function mergeDBDataToRealtime(_0x315e63,_0x3bbe10){var _0x46b85f=Object['assign']({},_0x315e63);for(var _0x3b1848 in _0x3bbe10){if(_0x46b85f[_0xb11b('0x0')](_0x3b1848)){_0x46b85f[_0x3b1848]=_0x3bbe10[_0x3b1848];}}return _0x46b85f;}exports[_0xb11b('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8713658..8ed97c9 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 _0x888f=['custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','getAgentByInternal','keys','channel','split','outbound','internal','destination','exten','dialer','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','type','getCallType','UserId','monitor','monitors','monitorFilename','createdAt','connectedlinenum','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport'];(function(_0x3bd053,_0x102a3d){var _0x40e1e3=function(_0x34a2cc){while(--_0x34a2cc){_0x3bd053['push'](_0x3bd053['shift']());}};_0x40e1e3(++_0x102a3d);}(_0x888f,0xa6));var _0xf888=function(_0x1f3b9e,_0x564869){_0x1f3b9e=_0x1f3b9e-0x0;var _0x245276=_0x888f[_0x1f3b9e];return _0x245276;};'use strict';var _=require(_0xf888('0x0'));var moment=require(_0xf888('0x1'));var util=require(_0xf888('0x2'));var config=require(_0xf888('0x3'));var ami=require(_0xf888('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xf888('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xf888('0x6'));var RpcVoiceRecording=require(_0xf888('0x7'));var RpcVoiceTransferReport=require(_0xf888('0x8'));var VoiceQueueReport=require(_0xf888('0x9'));var VoiceCallReport=require(_0xf888('0xa'));var VoiceAgentReport=require(_0xf888('0xb'));var VoiceDialReport=require(_0xf888('0xc'));var UserReport=require('./userReport');function Report(_0x4aa48b){this[_0xf888('0xd')]=_0x4aa48b;this[_0xf888('0xe')]=_0x4aa48b['agents'];this[_0xf888('0xf')]=_0x4aa48b[_0xf888('0xf')];}Report[_0xf888('0x10')][_0xf888('0x11')]=function(_0x4ca1f5){var _0x2095b0=new VoiceQueueReport(this[_0xf888('0xd')]);var _0x387651=new VoiceAgentReport(this[_0xf888('0xd')]);var _0x33ae09=new VoiceDialReport(this[_0xf888('0xd')]);var _0x5ccb96=new VoiceCallReport(this[_0xf888('0xd')]);var _0xe077c3=new UserReport(this[_0xf888('0xd')]);if(config[_0xf888('0x12')]&&config['xdr']['disabled']){ami['on'](_0xf888('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0xf888('0x14'),this['voiceCallReport']['bind'](this));ami['on'](_0xf888('0x15'),this[_0xf888('0x16')][_0xf888('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xf888('0x18')][_0xf888('0x17')](this));ami['on'](_0xf888('0x19'),this[_0xf888('0x1a')]['bind'](this));ami['on'](_0xf888('0x1b'),this[_0xf888('0x1c')][_0xf888('0x17')](this));}};Report[_0xf888('0x10')][_0xf888('0x1d')]=function(_0x373d8b){var _0xdff63b;_0xdff63b=_[_0xf888('0x1e')](this[_0xf888('0xe')],function(_0x316b68){return _0x316b68[_0xf888('0x1f')]==_0x373d8b||_0x316b68[_0xf888('0x20')]==_0x373d8b;});if(_[_0xf888('0x21')](_0xdff63b)){var _0x201dca=_[_0xf888('0x1e')](this[_0xf888('0xf')],function(_0x2e992b){return _0x2e992b[_0xf888('0x1f')]==_0x373d8b||_0x2e992b[_0xf888('0x20')]==_0x373d8b;});if(_0x201dca){_0xdff63b=_[_0xf888('0x1e')](this['agents'],function(_0x203b39){return _0x203b39[_0xf888('0x22')]==util[_0xf888('0x23')](_0xf888('0x24'),_0x201dca['name']);});}}return _0xdff63b;};Report['prototype']['voiceQueueReport']=function(_0x1c72fe){for(var _0x51efd3=0x0;_0x51efd3<_0x1c72fe[_0xf888('0x25')];_0x51efd3+=0x1){var _0x17ea8c=this[_0xf888('0x1d')](_0x1c72fe[_0x51efd3]['connectedlinenum']);if(_0x17ea8c){_0x1c72fe[_0x51efd3][_0xf888('0x1f')]=_0x17ea8c['accountcode'];_0x1c72fe[_0x51efd3]['assigned']=!![];_0x1c72fe[_0x51efd3][_0xf888('0x26')]=_0x17ea8c[_0xf888('0x20')];_0x1c72fe[_0x51efd3][_0xf888('0x22')]=_[_0xf888('0x21')](_0x17ea8c[_0xf888('0x22')])?util['format'](_0xf888('0x24'),_0x17ea8c[_0xf888('0x20')]):_0x17ea8c['interface'];if(_0x1c72fe[_0x51efd3][_0xf888('0x27')]){_0x1c72fe[_0x51efd3]['queuecallercompleteAt']=moment()[_0xf888('0x23')](_0xf888('0x28'));}if(_0x1c72fe[_0x51efd3][_0xf888('0x29')]){_0x1c72fe[_0x51efd3][_0xf888('0x2a')]=moment()[_0xf888('0x23')](_0xf888('0x28'));}RpcMemberReport[_0xf888('0x2b')](_0x1c72fe[_0x51efd3]);}RpcVoiceQueueReport[_0xf888('0x2c')](_0x1c72fe[_0x51efd3]);}};function extractCalleridNumber(_0xb695ba){var _0x32541c=_0xb695ba[_0xf888('0x2d')](/<(.*?)>/);return _0x32541c?_0x32541c[0x1]:_0xb695ba;}Report[_0xf888('0x10')][_0xf888('0x2e')]=function(_0x504c80){for(var _0x24c7e3=0x0;_0x24c7e3','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','create','voiceDialReport','startsWith','Local','substring','indexOf','lastIndexOf','findAgent','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8907,0x1d3));var _0x7890=function(_0x2232d9,_0x452ce5){_0x2232d9=_0x2232d9-0x0;var _0x11afa1=_0x8907[_0x2232d9];return _0x11afa1;};'use strict';var _=require(_0x7890('0x0'));var moment=require(_0x7890('0x1'));var util=require(_0x7890('0x2'));var config=require(_0x7890('0x3'));var ami=require(_0x7890('0x4'));var RpcVoiceAgentReport=require(_0x7890('0x5'));var RpcVoiceCallReport=require(_0x7890('0x6'));var RpcVoiceDialReport=require(_0x7890('0x7'));var RpcMemberReport=require(_0x7890('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x7890('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x7890('0xa'));var VoiceCallReport=require(_0x7890('0xb'));var VoiceAgentReport=require(_0x7890('0xc'));var VoiceDialReport=require(_0x7890('0xd'));var UserReport=require(_0x7890('0xe'));function Report(_0xc1e8d){this[_0x7890('0xf')]=_0xc1e8d;this['agents']=_0xc1e8d['agents'];this[_0x7890('0x10')]=_0xc1e8d[_0x7890('0x10')];}Report[_0x7890('0x11')][_0x7890('0x12')]=function(_0x3690cf){var _0x5d0fde=new VoiceQueueReport(this[_0x7890('0xf')]);var _0x36d3b9=new VoiceAgentReport(this[_0x7890('0xf')]);var _0x275b48=new VoiceDialReport(this[_0x7890('0xf')]);var _0x32f19c=new VoiceCallReport(this['realtime']);var _0x21590c=new UserReport(this[_0x7890('0xf')]);if(config[_0x7890('0x13')]&&config[_0x7890('0x13')][_0x7890('0x14')]){ami['on'](_0x7890('0x15'),this['voiceQueueReport'][_0x7890('0x16')](this));ami['on'](_0x7890('0x17'),this[_0x7890('0x18')][_0x7890('0x16')](this));ami['on'](_0x7890('0x19'),this[_0x7890('0x1a')][_0x7890('0x16')](this));ami['on'](_0x7890('0x1b'),this['voiceDialReport'][_0x7890('0x16')](this));ami['on'](_0x7890('0x1c'),this[_0x7890('0x1d')][_0x7890('0x16')](this));ami['on'](_0x7890('0x1e'),this[_0x7890('0x1f')][_0x7890('0x16')](this));}};Report[_0x7890('0x11')]['findAgent']=function(_0x56fee8){var _0x2bbd55;_0x2bbd55=_[_0x7890('0x20')](this[_0x7890('0x21')],function(_0x1e1512){return _0x1e1512['accountcode']==_0x56fee8||_0x1e1512[_0x7890('0x22')]==_0x56fee8;});if(_[_0x7890('0x23')](_0x2bbd55)){var _0x3b07f5=_['find'](this[_0x7890('0x10')],function(_0x2a5adf){return _0x2a5adf['accountcode']==_0x56fee8||_0x2a5adf[_0x7890('0x22')]==_0x56fee8;});if(_0x3b07f5){_0x2bbd55=_['find'](this['agents'],function(_0x12fe2c){return _0x12fe2c[_0x7890('0x24')]==util['format'](_0x7890('0x25'),_0x3b07f5[_0x7890('0x22')]);});}}return _0x2bbd55;};Report[_0x7890('0x11')][_0x7890('0x26')]=function(_0x5406b6){for(var _0x416b1b=0x0;_0x416b1b<_0x5406b6[_0x7890('0x27')];_0x416b1b+=0x1){var _0x10aaa2=this['findAgent'](_0x5406b6[_0x416b1b][_0x7890('0x28')]);if(_0x10aaa2){_0x5406b6[_0x416b1b][_0x7890('0x29')]=_0x10aaa2[_0x7890('0x29')];_0x5406b6[_0x416b1b][_0x7890('0x2a')]=!![];_0x5406b6[_0x416b1b][_0x7890('0x2b')]=_0x10aaa2[_0x7890('0x22')];_0x5406b6[_0x416b1b][_0x7890('0x24')]=_[_0x7890('0x23')](_0x10aaa2[_0x7890('0x24')])?util['format'](_0x7890('0x25'),_0x10aaa2[_0x7890('0x22')]):_0x10aaa2[_0x7890('0x24')];if(_0x5406b6[_0x416b1b]['queuecallercomplete']){_0x5406b6[_0x416b1b]['queuecallercompleteAt']=moment()[_0x7890('0x2c')](_0x7890('0x2d'));}if(_0x5406b6[_0x416b1b][_0x7890('0x2e')]){_0x5406b6[_0x416b1b]['queuecallerexitAt']=moment()['format'](_0x7890('0x2d'));}RpcMemberReport[_0x7890('0x26')](_0x5406b6[_0x416b1b]);}RpcVoiceQueueReport['create'](_0x5406b6[_0x416b1b]);}};function extractCalleridNumber(_0x343377){var _0x32f45c=_0x343377[_0x7890('0x2f')](/<(.*?)>/);return _0x32f45c?_0x32f45c[0x1]:_0x343377;}Report['prototype'][_0x7890('0x30')]=function(_0x331b94){for(var _0x2f37cb=0x0;_0x2f37cb{delete this[_0x94c0('0x9')][_0x186871];},_0x4365f9);}};module[_0x94c0('0x9a')]=VoiceAgentReport; \ No newline at end of file +var _0x8bd5=['syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','connectedlinename','connectedlinenum','destchannelstate','holdtime','connect','interface','pick','name','accountcode','exten','custom:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','inspect','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','error','[%s][voiceAgentReport][queuecallerabandon]','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer'];(function(_0x494a1b,_0x5e5aae){var _0x443e67=function(_0x3838a3){while(--_0x3838a3){_0x494a1b['push'](_0x494a1b['shift']());}};_0x443e67(++_0x5e5aae);}(_0x8bd5,0x1ca));var _0x58bd=function(_0x56e266,_0x3d095f){_0x56e266=_0x56e266-0x0;var _0x20d2a9=_0x8bd5[_0x56e266];return _0x20d2a9;};'use strict';var _=require(_0x58bd('0x0'));var moment=require(_0x58bd('0x1'));var util=require('util');var Redis=require(_0x58bd('0x2'));var config=require(_0x58bd('0x3'));var logger=require(_0x58bd('0x4'))(_0x58bd('0x5'));var ami=require(_0x58bd('0x6'));config[_0x58bd('0x7')]=_[_0x58bd('0x8')](config[_0x58bd('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58bd('0x7')]));function VoiceAgentReport(_0x4146f1){this[_0x58bd('0x9')]={};this[_0x58bd('0xa')]=_0x4146f1[_0x58bd('0x9')];this[_0x58bd('0xb')]=_0x4146f1[_0x58bd('0xb')];this['agents']=_0x4146f1[_0x58bd('0xc')];this['variables']={};ami['on'](_0x58bd('0xd'),this[_0x58bd('0xe')][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x10'),this[_0x58bd('0x11')][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x12'),this['syncAgentRingNoAnswer'][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x13'),this[_0x58bd('0x14')][_0x58bd('0xf')](this));ami['on']('agentcomplete',this[_0x58bd('0x15')][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x16'),this[_0x58bd('0x17')][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x18'),this['syncHangup'][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x19'),this[_0x58bd('0x1a')][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x1b'),this['syncMusicOnHoldStop'][_0x58bd('0xf')](this));ami['on'](_0x58bd('0x1c'),this[_0x58bd('0x1d')]['bind'](this));ami['on'](_0x58bd('0x1e'),this[_0x58bd('0x1f')][_0x58bd('0xf')](this));}VoiceAgentReport[_0x58bd('0x20')]['emit']=function(_0x21ada2,_0x5ba33d,_0x2ae229){io['to'](_0x21ada2)[_0x58bd('0x21')](_0x5ba33d,_0x2ae229);};VoiceAgentReport['prototype'][_0x58bd('0x22')]=function(_0x5e025f){return _0x5e025f!==null&&!_[_0x58bd('0x23')](_0x5e025f);};VoiceAgentReport[_0x58bd('0x20')][_0x58bd('0xe')]=function(_0x2d0b8c){try{if(this[_0x58bd('0x22')](_0x2d0b8c)){logger[_0x58bd('0x24')](_0x58bd('0x25'),_0x2d0b8c[_0x58bd('0x26')],_0x2d0b8c[_0x58bd('0x27')],_0x2d0b8c[_0x58bd('0x28')]);logger['debug'](_0x58bd('0x29'),_0x2d0b8c[_0x58bd('0x26')],util['inspect'](_0x2d0b8c,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x2d0b8c[_0x58bd('0x26')]])){this[_0x58bd('0x9')][_0x2d0b8c[_0x58bd('0x26')]]={};}var _0x38cae9=this[_0x58bd('0xc')][_0x2d0b8c['interface']];var _0x5d889f=this['channels'][_0x2d0b8c[_0x58bd('0x26')]][_0x2d0b8c[_0x58bd('0x28')]];var _0x2fdd96=this[_0x58bd('0xb')][_0x2d0b8c[_0x58bd('0x2a')]];var _0x1768fe=this[_0x58bd('0x2b')][_0x2d0b8c['uniqueid']];if(_[_0x58bd('0x23')](_0x5d889f)){_0x5d889f={'agentcalledAt':moment()[_0x58bd('0x2c')](_0x58bd('0x2d')),'lastevent':_0x58bd('0x2e'),'mandatoryDisposition':_0x2fdd96&&_0x2fdd96[_0x58bd('0x2f')]?_0x2fdd96[_0x58bd('0x2f')]:![],'type':_0x2fdd96&&_0x2fdd96[_0x58bd('0x30')]?_0x2fdd96['type']:_0x58bd('0x31'),'variables':_0x1768fe,'motionChannel':_0x58bd('0x32')};}Object['assign'](_0x5d889f,_[_0x58bd('0x33')](_0x2d0b8c,[_0x58bd('0x34'),_0x58bd('0x35')]));this[_0x58bd('0x9')][_0x2d0b8c['uniqueid']][_0x2d0b8c[_0x58bd('0x28')]]=_0x5d889f;logger[_0x58bd('0x36')](_0x58bd('0x37'),_0x2d0b8c[_0x58bd('0x26')],util['inspect'](_0x5d889f,{'showHidden':![],'depth':null}));ami[_0x58bd('0x21')](_0x58bd('0x38'),_0x5d889f);var _0xb78e3b={'id':_0x38cae9['id'],'calleridnum':_0x5d889f[_0x58bd('0x39')],'queue':_0x5d889f[_0x58bd('0x2a')],'variables':_0x5d889f[_0x58bd('0x2b')],'uniqueid':_0x2d0b8c[_0x58bd('0x26')]};logger[_0x58bd('0x36')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x2d0b8c[_0x58bd('0x26')],util['inspect'](_0xb78e3b,{'showHidden':![],'depth':null}));this['emit'](util[_0x58bd('0x2c')](_0x58bd('0x3a'),_0x2d0b8c[_0x58bd('0x27')]),_0x58bd('0x3b'),_0xb78e3b);}}catch(_0x13ab07){logger['error'](_0x58bd('0x3c'),_0x2d0b8c[_0x58bd('0x26')],util['inspect'](_0x13ab07,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')][_0x58bd('0x11')]=function(_0x1fcc9d){try{if(this[_0x58bd('0x22')](_0x1fcc9d)){if(this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]]){for(var _0x2580a1 in this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]]){if(this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x58bd('0x3d')](_0x2580a1)){if(_0x1fcc9d[_0x58bd('0x28')]===_0x2580a1){logger[_0x58bd('0x24')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1fcc9d['uniqueid'],_0x1fcc9d[_0x58bd('0x27')],_0x1fcc9d[_0x58bd('0x28')]);this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1]['agentconnectAt']=moment()[_0x58bd('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x3e')]=_0x1fcc9d[_0x58bd('0x3e')];this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x3f')]=_0x1fcc9d[_0x58bd('0x3f')];this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1]['destchannelstate']=_0x1fcc9d[_0x58bd('0x40')];this[_0x58bd('0x9')][_0x1fcc9d['uniqueid']][_0x2580a1]['destchannelstatedesc']=_0x1fcc9d['destchannelstatedesc'];this[_0x58bd('0x9')][_0x1fcc9d['uniqueid']][_0x2580a1][_0x58bd('0x41')]=_0x1fcc9d[_0x58bd('0x41')];this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1]['lastevent']=_0x58bd('0x42');_['merge'](this[_0x58bd('0xc')][_0x1fcc9d[_0x58bd('0x43')]],_[_0x58bd('0x44')](_0x1fcc9d,['queue','destconnectedlinenum']));var _0xe8de5a=this[_0x58bd('0xc')][_0x1fcc9d[_0x58bd('0x43')]];var _0x219af0={'id':_0xe8de5a['id'],'name':_0xe8de5a[_0x58bd('0x45')],'agentconnected':!![],'destaccountcode':_0xe8de5a[_0x58bd('0x46')],'destconnectedlinenum':this['channels'][_0x1fcc9d['uniqueid']][_0x1fcc9d[_0x58bd('0x28')]][_0x58bd('0x47')],'queue':this['channels'][_0x1fcc9d[_0x58bd('0x26')]][_0x1fcc9d[_0x58bd('0x28')]][_0x58bd('0x2a')],'uniqueid':this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x1fcc9d[_0x58bd('0x28')]][_0x58bd('0x26')]};ami[_0x58bd('0x21')](_0x58bd('0x48'),this[_0x58bd('0x9')][_0x1fcc9d['uniqueid']][_0x1fcc9d[_0x58bd('0x28')]]);this[_0x58bd('0x21')](util['format'](_0x58bd('0x3a'),_0x1fcc9d[_0x58bd('0x27')]),'user:agentconnect',_0x219af0);}else if(!this['channels'][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x12')]&&!this['channels'][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x49')]){logger[_0x58bd('0x24')](_0x58bd('0x4a'),_0x1fcc9d[_0x58bd('0x26')],this['channels'][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x27')],_0x2580a1);this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x12')]=!![];this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x4b')]=moment()[_0x58bd('0x2c')](_0x58bd('0x2d'));this[_0x58bd('0x9')][_0x1fcc9d['uniqueid']][_0x2580a1][_0x58bd('0x4c')]=_0x1fcc9d[_0x58bd('0x28')];this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x4d')]=_0x1fcc9d[_0x58bd('0x27')];this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1][_0x58bd('0x4e')]=_0x58bd('0x4f');this[_0x58bd('0x9')][_0x1fcc9d[_0x58bd('0x26')]][_0x2580a1]['reason']=_0x58bd('0x4f');logger[_0x58bd('0x36')](_0x58bd('0x50'),_0x1fcc9d[_0x58bd('0x26')],util[_0x58bd('0x51')](this[_0x58bd('0x9')][_0x1fcc9d['uniqueid']][_0x2580a1],{'showHidden':![],'depth':null}));ami[_0x58bd('0x21')](_0x58bd('0x52'),this['channels'][_0x1fcc9d['uniqueid']][_0x2580a1]);}else{logger[_0x58bd('0x36')](_0x58bd('0x53'),_0x1fcc9d[_0x58bd('0x26')]);}}}}}}catch(_0x3089cc){logger['error'](_0x58bd('0x54'),_0x1fcc9d[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x3089cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')][_0x58bd('0x55')]=function(_0x819073){try{if(this['isNotNull'](_0x819073)){logger[_0x58bd('0x36')](_0x58bd('0x56'),_0x819073['uniqueid'],util[_0x58bd('0x51')](_0x819073,{'showHidden':![],'depth':null}));if(this['channels'][_0x819073[_0x58bd('0x26')]]&&this[_0x58bd('0x9')][_0x819073[_0x58bd('0x26')]][_0x819073[_0x58bd('0x28')]]){logger[_0x58bd('0x24')](_0x58bd('0x57'),_0x819073['uniqueid'],_0x819073[_0x58bd('0x27')],_0x819073[_0x58bd('0x28')]);var _0xd369d0=this[_0x58bd('0xc')][_0x819073[_0x58bd('0x43')]];var _0xd30df=this[_0x58bd('0x9')][_0x819073[_0x58bd('0x26')]][_0x819073[_0x58bd('0x28')]];_0xd30df[_0x58bd('0x12')]=!![];_0xd30df[_0x58bd('0x4b')]=moment()[_0x58bd('0x2c')](_0x58bd('0x2d'));_0xd30df[_0x58bd('0x4e')]=_0x58bd('0x58');_0xd30df[_0x58bd('0x59')]=_0x58bd('0x58');var _0x43f061={'id':_0xd369d0['id'],'name':_0xd369d0[_0x58bd('0x45')],'queue':_0xd30df[_0x58bd('0x2a')],'uniqueid':_0xd30df[_0x58bd('0x26')]};logger['debug'](_0x58bd('0x5a'),_0x819073['uniqueid'],util[_0x58bd('0x51')](_0x43f061,{'showHidden':![],'depth':null}));this['emit'](util[_0x58bd('0x2c')]('user:%s',_0xd369d0[_0x58bd('0x45')]),_0x58bd('0x5b'),_0x43f061);ami['emit'](_0x58bd('0x5c'),_0xd30df);this[_0x58bd('0x9')][_0x819073[_0x58bd('0x26')]][_0x819073[_0x58bd('0x28')]]=Object[_0x58bd('0x5d')]({},_0xd30df);}}}catch(_0x247b45){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x819073[_0x58bd('0x26')],util['inspect'](_0x247b45,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x5ac294){try{if(this['isNotNull'](_0x5ac294)){logger[_0x58bd('0x36')](_0x58bd('0x5e'),_0x5ac294[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x5ac294,{'showHidden':![],'depth':null}));if(this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]]){for(var _0x25774a in this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]]){if(this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]][_0x58bd('0x3d')](_0x25774a)&&!this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x12')]&&!this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x49')]){logger[_0x58bd('0x24')](_0x58bd('0x5f'),_0x5ac294['uniqueid'],this['channels'][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x27')],_0x25774a);this['channels'][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x12')]=!![];this['channels'][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x4b')]=moment()[_0x58bd('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x4e')]='abandoned';this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]][_0x25774a][_0x58bd('0x59')]=_0x58bd('0x60');logger[_0x58bd('0x36')](_0x58bd('0x61'),_0x5ac294[_0x58bd('0x26')],util[_0x58bd('0x51')](this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]][_0x25774a],{'showHidden':![],'depth':null}));ami[_0x58bd('0x21')](_0x58bd('0x62'),this[_0x58bd('0x9')][_0x5ac294[_0x58bd('0x26')]][_0x25774a]);}}}}}catch(_0x36d042){logger[_0x58bd('0x63')](_0x58bd('0x64'),_0x5ac294[_0x58bd('0x26')],util['inspect'](_0x36d042,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x58bd('0x15')]=function(_0x387f89){try{if(this['isNotNull'](_0x387f89)){logger[_0x58bd('0x36')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x387f89[_0x58bd('0x26')],util['inspect'](_0x387f89,{'showHidden':![],'depth':null}));if(this[_0x58bd('0x9')][_0x387f89['uniqueid']]){for(var _0x32cb7a in this['channels'][_0x387f89[_0x58bd('0x26')]]){if(this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x58bd('0x3d')](_0x32cb7a)){if(this['channels'][_0x387f89[_0x58bd('0x26')]][_0x32cb7a][_0x58bd('0x65')]&&!this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x32cb7a][_0x58bd('0x49')]){logger[_0x58bd('0x24')](_0x58bd('0x66'),_0x387f89[_0x58bd('0x26')],this[_0x58bd('0x9')][_0x387f89['uniqueid']][_0x32cb7a]['membername'],_0x32cb7a);this['channels'][_0x387f89[_0x58bd('0x26')]][_0x32cb7a][_0x58bd('0x49')]=!![];this['channels'][_0x387f89['uniqueid']][_0x32cb7a][_0x58bd('0x67')]=moment()[_0x58bd('0x2c')](_0x58bd('0x2d'));this['channels'][_0x387f89['uniqueid']][_0x32cb7a][_0x58bd('0x4e')]='complete';this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x32cb7a]['reason']=_0x387f89['reason']==_0x58bd('0x68')?_0x58bd('0x69'):_0x387f89[_0x58bd('0x59')];this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x32cb7a]['talktime']=_0x387f89[_0x58bd('0x6a')];if(this['voiceQueues'][_0x387f89[_0x58bd('0x2a')]]&&this[_0x58bd('0xb')][_0x387f89['queue']]['acw']){this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x32cb7a][_0x58bd('0x6b')]=this['voiceQueues'][_0x387f89['queue']][_0x58bd('0x6c')];this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x32cb7a][_0x58bd('0x6d')]=!![];}this[_0x58bd('0xc')][_0x387f89[_0x58bd('0x43')]]=_[_0x58bd('0x33')](this['agents'][_0x387f89[_0x58bd('0x43')]],[_0x58bd('0x2a'),'destconnectedlinenum']);logger[_0x58bd('0x36')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x387f89['uniqueid'],util[_0x58bd('0x51')](this[_0x58bd('0x9')][_0x387f89[_0x58bd('0x26')]][_0x32cb7a],{'showHidden':![],'depth':null}));ami[_0x58bd('0x21')]('custom:agentcomplete',this['channels'][_0x387f89['uniqueid']][_0x32cb7a]);logger[_0x58bd('0x36')](_0x58bd('0x6e'),_0x387f89['uniqueid'],util['inspect']({'id':this[_0x58bd('0xc')][_0x387f89[_0x58bd('0x43')]]['id'],'destaccountcode':_0x387f89['destaccountcode']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x58bd('0x3a'),_0x387f89['membername']),_0x58bd('0x6f'),{'id':this[_0x58bd('0xc')][_0x387f89['interface']]['id'],'destaccountcode':Number(_0x387f89[_0x58bd('0x70')])});}}}}}}catch(_0x75462){logger[_0x58bd('0x63')]('[%s][voiceAgentReport][agentcomplete]',_0x387f89[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x75462,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x258b9f){try{if(this[_0x58bd('0x22')](_0x258b9f)){logger[_0x58bd('0x36')](_0x58bd('0x71'),_0x258b9f[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x258b9f,{'showHidden':![],'depth':null}));this[_0x58bd('0x72')](_0x258b9f['uniqueid'],_[_0x58bd('0x73')](_0x258b9f[_0x58bd('0x74')])[0x0],_0x258b9f[_0x58bd('0x75')]);if(this['channels'][_0x258b9f['uniqueid']]){for(var _0x4cb86e in this[_0x58bd('0x9')][_0x258b9f[_0x58bd('0x26')]]){if(this[_0x58bd('0x9')][_0x258b9f[_0x58bd('0x26')]][_0x58bd('0x3d')](_0x4cb86e)){logger['info']('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x258b9f['uniqueid'],_0x4cb86e,_['keys'](_0x258b9f[_0x58bd('0x74')])[0x0],_0x258b9f['value']);if(_[_0x58bd('0x23')](this['channels'][_0x258b9f[_0x58bd('0x26')]][_0x4cb86e]['variables'])){this[_0x58bd('0x9')][_0x258b9f['uniqueid']][_0x4cb86e][_0x58bd('0x2b')]={};}this[_0x58bd('0x9')][_0x258b9f[_0x58bd('0x26')]][_0x4cb86e][_0x58bd('0x2b')]=this['variables'][_0x258b9f[_0x58bd('0x26')]];}}}}}catch(_0xc4a32){logger['error'](_0x58bd('0x76'),_0x258b9f[_0x58bd('0x26')],util[_0x58bd('0x51')](_0xc4a32,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x58bd('0x72')]=function(_0x27adf5,_0x443981,_0x417ac1){var _0x1de6df=[_0x58bd('0x77'),_0x58bd('0x78'),_0x58bd('0x79'),_0x58bd('0x7a'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x58bd('0x7b'),_0x58bd('0x7c'),_0x58bd('0x7d'),_0x58bd('0x7e'),_0x58bd('0x7f'),_0x58bd('0x80'),_0x58bd('0x81'),_0x58bd('0x82'),_0x58bd('0x83'),_0x58bd('0x84'),'membername',_0x58bd('0x85'),_0x58bd('0x86')];if(!_[_0x58bd('0x87')](_0x443981)&&!_[_0x58bd('0x88')](_0x1de6df,_0x443981)){if(_[_0x58bd('0x23')](this['variables'][_0x27adf5])){this['variables'][_0x27adf5]={};}this[_0x58bd('0x2b')][_0x27adf5][_0x443981]=_0x417ac1;}};VoiceAgentReport[_0x58bd('0x20')][_0x58bd('0x89')]=function(_0x10afce){try{if(this[_0x58bd('0x22')](_0x10afce)){logger[_0x58bd('0x36')](_0x58bd('0x8a'),_0x10afce['uniqueid'],util[_0x58bd('0x51')](_0x10afce,{'showHidden':![],'depth':null}));if(this[_0x58bd('0x9')][_0x10afce[_0x58bd('0x26')]]){for(var _0x309aeb in this[_0x58bd('0x9')][_0x10afce[_0x58bd('0x26')]]){if(this['channels'][_0x10afce['uniqueid']][_0x58bd('0x3d')](_0x309aeb)){if(this[_0x58bd('0x9')][_0x10afce['uniqueid']][_0x309aeb][_0x58bd('0x59')]==_0x58bd('0x68')&&this[_0x58bd('0x9')][_0x10afce[_0x58bd('0x26')]][_0x309aeb]['agentcomplete']){logger[_0x58bd('0x24')](_0x58bd('0x8b'),_0x10afce[_0x58bd('0x26')],_0x309aeb);this[_0x58bd('0x9')][_0x10afce[_0x58bd('0x26')]][_0x309aeb]['agentcompleteAt']=moment()['format'](_0x58bd('0x2d'));}}}logger[_0x58bd('0x36')](_0x58bd('0x8c'),_0x10afce[_0x58bd('0x26')],util[_0x58bd('0x51')](_[_0x58bd('0x8d')](this[_0x58bd('0x9')][_0x10afce[_0x58bd('0x26')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x58bd('0x8e'),_[_0x58bd('0x8d')](this[_0x58bd('0x9')][_0x10afce[_0x58bd('0x26')]]));this[_0x58bd('0x8f')](_0x10afce[_0x58bd('0x26')]);}if(this['variables'][_0x10afce[_0x58bd('0x26')]]){delete this[_0x58bd('0x2b')][_0x10afce[_0x58bd('0x26')]];}}}catch(_0x142f75){logger[_0x58bd('0x63')]('[%s][voiceAgentReport][hangup]',_0x10afce['uniqueid'],util['inspect'](_0x142f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')]['syncAttendedTransfer']=function(_0x33560b){try{if(this[_0x58bd('0x22')](_0x33560b)){logger[_0x58bd('0x36')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x33560b[_0x58bd('0x26')],util['inspect'](_0x33560b,{'showHidden':![],'depth':null}));if(this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]]){for(var _0xe74a07 in this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]]){if(this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]][_0x58bd('0x3d')](_0xe74a07)){if(_0x33560b['origtransfereruniqueid']===_0xe74a07){logger['info'](_0x58bd('0x91'),_0x33560b[_0x58bd('0x26')],this['channels'][_0x33560b[_0x58bd('0x90')]][_0xe74a07][_0x58bd('0x27')],_0xe74a07);var _0x32ca4f=moment();this[_0x58bd('0x9')][_0x33560b['transfereeuniqueid']][_0xe74a07][_0x58bd('0x49')]=!![];this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]][_0xe74a07][_0x58bd('0x67')]=moment()[_0x58bd('0x2c')](_0x58bd('0x2d'));this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]][_0xe74a07][_0x58bd('0x4e')]=_0x58bd('0x92');this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]][_0xe74a07][_0x58bd('0x59')]=_0x58bd('0x68');this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]][_0xe74a07]['talktime']=_0x32ca4f[_0x58bd('0x93')](this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]][_0xe74a07][_0x58bd('0x65')],_0x58bd('0x94'));}}}}if(this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x95')]]){var _0x40cb6f=this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x95')]];this['channels'][_0x33560b[_0x58bd('0x95')]]=this[_0x58bd('0x9')][_0x33560b[_0x58bd('0x90')]];this['channels'][_0x33560b['transfereeuniqueid']]=_0x40cb6f;}}}catch(_0x331e64){logger['error'](_0x58bd('0x96'),_0x33560b[_0x58bd('0x26')],util['inspect'](_0x331e64,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')][_0x58bd('0x1f')]=function(_0x11ca51){try{if(this[_0x58bd('0x22')](_0x11ca51)){logger[_0x58bd('0x36')](_0x58bd('0x97'),_0x11ca51[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x11ca51,{'showHidden':![],'depth':null}));if(this['channels'][_0x11ca51[_0x58bd('0x90')]]){for(var _0x510a34 in this[_0x58bd('0x9')][_0x11ca51[_0x58bd('0x90')]]){if(this[_0x58bd('0x9')][_0x11ca51['transfereeuniqueid']][_0x58bd('0x3d')](_0x510a34)){if(_0x11ca51[_0x58bd('0x98')]===_0x510a34){logger[_0x58bd('0x24')](_0x58bd('0x99'),_0x11ca51[_0x58bd('0x26')],this[_0x58bd('0x9')][_0x11ca51['transfereeuniqueid']][_0x510a34][_0x58bd('0x27')],_0x510a34);var _0xa8488e=moment();this[_0x58bd('0x9')][_0x11ca51[_0x58bd('0x90')]][_0x510a34][_0x58bd('0x49')]=!![];this[_0x58bd('0x9')][_0x11ca51[_0x58bd('0x90')]][_0x510a34][_0x58bd('0x67')]=_0xa8488e;this['channels'][_0x11ca51[_0x58bd('0x90')]][_0x510a34]['lastevent']='complete';this['channels'][_0x11ca51[_0x58bd('0x90')]][_0x510a34][_0x58bd('0x59')]='transfer';this['channels'][_0x11ca51['transfereeuniqueid']][_0x510a34][_0x58bd('0x6a')]=_0xa8488e[_0x58bd('0x93')](this[_0x58bd('0x9')][_0x11ca51[_0x58bd('0x90')]][_0x510a34][_0x58bd('0x65')],'seconds');}}}}}}catch(_0x40e426){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x11ca51['uniqueid'],util[_0x58bd('0x51')](_0x40e426,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')]['syncMusicOnHoldStart']=function(_0x5ce910){var _0x393085='';try{if(this[_0x58bd('0x22')](_0x5ce910)){logger[_0x58bd('0x36')](_0x58bd('0x9a'),_0x5ce910[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x5ce910,{'showHidden':![],'depth':null}));if(_0x5ce910[_0x58bd('0x9b')]){_0x393085=_0x5ce910[_0x58bd('0x9b')]['substring'](0x0,_0x5ce910[_0x58bd('0x9b')][_0x58bd('0x9c')]('-'));if(this[_0x58bd('0xc')][_0x393085]){logger[_0x58bd('0x24')](_0x58bd('0x9d'),_0x5ce910['uniqueid'],_0x393085);this['agents'][_0x393085][_0x58bd('0x9e')]=!![];}}}}catch(_0xece7a2){logger['error'](_0x58bd('0x9f'),_0x5ce910[_0x58bd('0x26')],util['inspect'](_0xece7a2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')]['syncMusicOnHoldStop']=function(_0xb6986a){var _0x74af61='';try{if(this[_0x58bd('0x22')](_0xb6986a)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0xb6986a[_0x58bd('0x26')],util[_0x58bd('0x51')](_0xb6986a,{'showHidden':![],'depth':null}));if(_0xb6986a[_0x58bd('0x9b')]){_0x74af61=_0xb6986a['channel'][_0x58bd('0xa0')](0x0,_0xb6986a[_0x58bd('0x9b')][_0x58bd('0x9c')]('-'));if(this[_0x58bd('0xc')][_0x74af61]){logger[_0x58bd('0x24')](_0x58bd('0xa1'),_0xb6986a[_0x58bd('0x26')],_0x74af61);this['agents'][_0x74af61][_0x58bd('0x9e')]=![];}}}}catch(_0x661eb9){logger[_0x58bd('0x63')](_0x58bd('0xa2'),_0xb6986a[_0x58bd('0x26')],util[_0x58bd('0x51')](_0x661eb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x58bd('0x20')][_0x58bd('0x8f')]=function(_0x402b35,_0xb2101=0x2710){if(this['channels'][_0x402b35]){setTimeout(()=>{delete this['channels'][_0x402b35];},_0xb2101);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 208ae32..ca47c37 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 _0x038f=['event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../model/channel','../rpc/setting','set','queue','agi','dial','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','channels','agents','coreshowchannel','newexten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','inspect','OutgoingSpoolFailed','blindTransfers','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','context','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','error','[%s][voiceCallReport][newchannel]','syncNewExten','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','cdr(','match','isNil','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','connectedlinename','toNumber','diff','destinationchannel','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','replace','.wav49','monitorFilename','find','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','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','sipcalllinkedid','[%s][voiceCallReport][varset]','deleteChannelAfterTimeout','cause-txt','billableseconds','omit','user:agentcomplete','length','transferType','undefined','transferToInternal','isEmpty','getSettings','then','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038f,0xdc));var _0xf038=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x038f[_0x506d2f];return _0x101255;};'use strict';var _=require(_0xf038('0x0'));var moment=require(_0xf038('0x1'));var util=require(_0xf038('0x2'));var path=require(_0xf038('0x3'));var Redis=require(_0xf038('0x4'));var config=require(_0xf038('0x5'));var logger=require('../../../config/logger')(_0xf038('0x6'));var ami=require('../ami');var Channel=require(_0xf038('0x7'));var RpcSetting=require(_0xf038('0x8'));var applications=[_0xf038('0x9'),_0xf038('0xa'),_0xf038('0xb'),_0xf038('0xc'),'playback','voicemail'];var dispositions=[_0xf038('0xd'),'FAILED','FAILED',_0xf038('0xd'),'NO\x20ANSWER','NO\x20ANSWER',_0xf038('0xe'),_0xf038('0xf'),_0xf038('0x10'),_0xf038('0x10'),_0xf038('0x10')];config[_0xf038('0x11')]=_[_0xf038('0x12')](config[_0xf038('0x11')],{'host':_0xf038('0x13'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf038('0x11')]));function VoiceCallReport(_0xd2edd5){this['channels']=_0xd2edd5[_0xf038('0x14')];this[_0xf038('0x15')]=_0xd2edd5[_0xf038('0x15')];this['blindTransfers']={};ami['on'](_0xf038('0x16'),this['syncNewExten']['bind'](this));ami['on'](_0xf038('0x17'),this['syncNewExten'][_0xf038('0x18')](this));ami['on']('newchannel',this[_0xf038('0x19')][_0xf038('0x18')](this));ami['on'](_0xf038('0x1a'),this[_0xf038('0x1b')][_0xf038('0x18')](this));ami['on'](_0xf038('0x1c'),this[_0xf038('0x1d')][_0xf038('0x18')](this));ami['on'](_0xf038('0x1e'),this[_0xf038('0x1f')][_0xf038('0x18')](this));ami['on'](_0xf038('0x20'),this[_0xf038('0x21')][_0xf038('0x18')](this));ami['on'](_0xf038('0x22'),this[_0xf038('0x23')]['bind'](this));ami['on']('blindtransfer',this[_0xf038('0x24')][_0xf038('0x18')](this));ami['on'](_0xf038('0x25'),this['syncMusicOnHoldStart'][_0xf038('0x18')](this));ami['on'](_0xf038('0x26'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0xf038('0x27')](_0xf038('0x28'));ami[_0xf038('0x29')]();}catch(_0x1bdeea){logger['error'](_0xf038('0x2a'),util['inspect'](_0x1bdeea,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf038('0x2b')][_0xf038('0x2c')]=function(_0x5c75e4){return _0x5c75e4!==null&&!_[_0xf038('0x2d')](_0x5c75e4);};VoiceCallReport['prototype'][_0xf038('0x2e')]=function(_0x2ff8c9,_0x100f0b,_0x44d3ca){io['to'](_0x2ff8c9)[_0xf038('0x2e')](_0x100f0b,_0x44d3ca);};VoiceCallReport[_0xf038('0x2b')]['syncNewCallerId']=function(_0xb55897){try{if(this[_0xf038('0x2c')](_0xb55897)){logger[_0xf038('0x27')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0xb55897[_0xf038('0x2f')],_0xb55897[_0xf038('0x30')],_0xb55897[_0xf038('0x31')]);logger[_0xf038('0x32')](_0xf038('0x33'),_0xb55897['uniqueid'],util['inspect'](_0xb55897,{'showHidden':![],'depth':null}));if(_0xb55897[_0xf038('0x2f')]===_0xb55897[_0xf038('0x34')]){if(!_[_0xf038('0x2d')](this[_0xf038('0x14')][_0xb55897[_0xf038('0x2f')]])){_[_0xf038('0x35')](this[_0xf038('0x14')][_0xb55897[_0xf038('0x2f')]],_[_0xf038('0x36')](_0xb55897,_[_0xf038('0x37')](this['channels'][_0xb55897[_0xf038('0x2f')]])));}}if(_0xb55897['context']===_0xf038('0x38')){var _0x27a6de=this['agents'][_0xb55897[_0xf038('0x39')]['split']('-')[0x0]];if(_0x27a6de){if(_0xb55897[_0xf038('0x3a')]==_0xf038('0x3b')){_0x27a6de[_0xf038('0x3c')]=_0xb55897[_0xf038('0x3d')];this[_0xf038('0x2e')](util[_0xf038('0x3e')]('user:%s',_0x27a6de[_0xf038('0x3f')]),_0xf038('0x40'),{'id':_0x27a6de['id'],'destaccountcode':_0x27a6de['accountcode'],'destconnectedlinenum':_0xb55897[_0xf038('0x3d')]});}}}}}catch(_0x31fc09){logger['error']('[%s][voiceCallReport][newcallerid]',_0xb55897[_0xf038('0x2f')],util[_0xf038('0x41')](_0x31fc09,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf038('0x2b')][_0xf038('0x19')]=function(_0x4ebe5d){try{if(this[_0xf038('0x2c')](_0x4ebe5d)){logger[_0xf038('0x32')]('[%s][voiceCallReport][newchannel]\x20event:',_0x4ebe5d['uniqueid'],util[_0xf038('0x41')](_0x4ebe5d,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ebe5d[_0xf038('0x2f')]]){return;}if(_0x4ebe5d['channel']===_0xf038('0x42')){return;}if(_0x4ebe5d[_0xf038('0x2f')]!==_0x4ebe5d['linkedid']&&!this[_0xf038('0x43')][_0x4ebe5d[_0xf038('0x34')]]){return;}logger[_0xf038('0x27')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4ebe5d[_0xf038('0x2f')],_0x4ebe5d['context'],_0x4ebe5d[_0xf038('0x3a')]);this[_0xf038('0x14')][_0x4ebe5d['uniqueid']]=new Channel();this[_0xf038('0x14')][_0x4ebe5d['uniqueid']][_0xf038('0x44')]=moment()[_0xf038('0x3e')](_0xf038('0x45'));this[_0xf038('0x14')][_0x4ebe5d[_0xf038('0x2f')]][_0xf038('0x46')]=dispositions[_['toNumber'](_0x4ebe5d[_0xf038('0x47')])];_['merge'](this[_0xf038('0x14')][_0x4ebe5d[_0xf038('0x2f')]],_[_0xf038('0x36')](_0x4ebe5d,_[_0xf038('0x37')](this[_0xf038('0x14')][_0x4ebe5d[_0xf038('0x2f')]])));if(_0x4ebe5d[_0xf038('0x48')]===_0xf038('0x38')){var _0x2c52bc=this['agents'][_0x4ebe5d[_0xf038('0x39')][_0xf038('0x49')]('-')[0x0]];if(_0x2c52bc&&typeof _0x2c52bc['destconnectedlinenum']==='undefined'){_0x2c52bc[_0xf038('0x3c')]=_0x4ebe5d[_0xf038('0x3a')];logger['debug'](_0xf038('0x4a'),_0x4ebe5d[_0xf038('0x2f')],util[_0xf038('0x41')]({'id':_0x2c52bc['id'],'destaccountcode':_0x2c52bc[_0xf038('0x4b')],'destconnectedlinenum':_0x4ebe5d[_0xf038('0x3a')]},{'showHidden':![],'depth':null}));this[_0xf038('0x2e')](util['format'](_0xf038('0x4c'),_0x2c52bc[_0xf038('0x3f')]),_0xf038('0x40'),{'id':_0x2c52bc['id'],'destaccountcode':_0x2c52bc[_0xf038('0x4b')],'destconnectedlinenum':_0x4ebe5d[_0xf038('0x3a')]});}}}}catch(_0x109611){logger[_0xf038('0x4d')](_0xf038('0x4e'),_0x4ebe5d[_0xf038('0x2f')],util['inspect'](_0x109611,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf038('0x4f')]=function(_0x28b807){try{if(this[_0xf038('0x2c')](_0x28b807)){logger['debug'](_0xf038('0x50'),_0x28b807['uniqueid'],util[_0xf038('0x41')](_0x28b807,{'showHidden':![],'depth':null}));if(_0x28b807['channel']===_0xf038('0x42')||_0x28b807[_0xf038('0x3a')]==='h')return;if(_0x28b807[_0xf038('0x2f')]===_0x28b807[_0xf038('0x34')]||this[_0xf038('0x43')][_0x28b807[_0xf038('0x34')]]){_0x28b807[_0xf038('0x51')]=_0x28b807[_0xf038('0x51')]?_0x28b807[_0xf038('0x51')][_0xf038('0x52')]():undefined;_0x28b807[_0xf038('0x53')]=_0x28b807[_0xf038('0x54')]||_0x28b807[_0xf038('0x53')];if(_0x28b807[_0xf038('0x54')]&&_0x28b807[_0xf038('0x51')]!==_0xf038('0xa')){_0x28b807[_0xf038('0x53')]=_0x28b807[_0xf038('0x53')]['toLowerCase']();}logger[_0xf038('0x27')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x28b807['uniqueid'],_0x28b807['application'],_0x28b807[_0xf038('0x53')]);if(_[_0xf038('0x2d')](this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]])){this[_0xf038('0x14')][_0x28b807['uniqueid']]=new Channel();this[_0xf038('0x14')][_0x28b807['uniqueid']][_0xf038('0x44')]=_0x28b807[_0xf038('0x55')]?moment()['subtract'](moment['duration'](_0x28b807['duration'])[_0xf038('0x56')](),_0xf038('0x56'))[_0xf038('0x3e')](_0xf038('0x45')):moment()[_0xf038('0x3e')](_0xf038('0x45'));this[_0xf038('0x14')][_0x28b807['uniqueid']][_0xf038('0x46')]=_0xf038('0xd');}_[_0xf038('0x35')](this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]],_[_0xf038('0x36')](_0x28b807,_[_0xf038('0x37')](this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]])));if(_[_0xf038('0x57')](applications,_0x28b807[_0xf038('0x51')])){this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]][_0xf038('0x58')]=_0x28b807[_0xf038('0x51')];this[_0xf038('0x14')][_0x28b807['uniqueid']]['lastdata']=_0x28b807[_0xf038('0x53')];if(_0x28b807[_0xf038('0x51')]===_0xf038('0x9')&&_['startsWith'](_0x28b807[_0xf038('0x53')][_0xf038('0x52')](),_0xf038('0x59'))){var _0x1db692=_0x28b807['applicationdata'][_0xf038('0x49')]('=');var _0x545269=_0x1db692[0x0][_0xf038('0x52')]()[_0xf038('0x5a')](/cdr\((.*)\)/);if(_0x545269){if(_0x545269[0x1]==='type'&&!_[_0xf038('0x5b')](this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]][_0x545269[0x1]]))return;this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]][_0x545269[0x1]]=_0x1db692[0x1];}}else if(_0x28b807['application']===_0xf038('0xa')){this[_0xf038('0x14')][_0x28b807[_0xf038('0x2f')]][_0xf038('0xa')]=_0x28b807['applicationdata']['split'](',')[0x0];}}}}}catch(_0x13702f){logger['error']('[%s][voiceCallReport][newexten]',_0x28b807['uniqueid'],util[_0xf038('0x41')](_0x13702f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf038('0x2b')][_0xf038('0x1b')]=function(_0x31933c){try{if(this['isNotNull'](_0x31933c)){logger[_0xf038('0x27')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x31933c[_0xf038('0x2f')],_0x31933c[_0xf038('0x34')],_0x31933c[_0xf038('0x30')],_0x31933c[_0xf038('0x31')]);logger[_0xf038('0x32')](_0xf038('0x5c'),_0x31933c[_0xf038('0x2f')],util[_0xf038('0x41')](_0x31933c,{'showHidden':![],'depth':null}));if(_0x31933c['channelstate']!=='6')return;var _0x3cf896=this[_0xf038('0x15')][_0x31933c['channel'][_0xf038('0x49')]('-')[0x0]];if(_0x31933c['uniqueid']!==_0x31933c['linkedid']){var _0x55adf2=moment();if(this[_0xf038('0x14')][_0x31933c['linkedid']]){if(!this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x5d')]){this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x5d')]=!![];this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x5e')]=_0x55adf2[_0xf038('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xf038('0x14')][_0x31933c['linkedid']][_0xf038('0x44')]){this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x5f')]=_0x55adf2['diff'](this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x44')],_0xf038('0x56'));}}this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x34')]=_0x31933c['uniqueid'];if(_0x31933c[_0xf038('0x31')]!=='xcally-motion-preview'){this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x3d')]=_0x31933c[_0xf038('0x31')];}this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0x60')]=_0x31933c[_0xf038('0x30')];this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]]['destinationchannel']=_0x31933c[_0xf038('0x39')];this['channels'][_0x31933c['linkedid']][_0xf038('0x46')]=dispositions[_[_0xf038('0x61')](_0x31933c[_0xf038('0x47')])];if(_0x3cf896){this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]]['UserId']=_0x3cf896['id'];this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]]['membername']=_0x3cf896[_0xf038('0x3f')];}}if(this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]]){if(!this['channels'][_0x31933c[_0xf038('0x2f')]]['answered']){this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x5d')]=!![];this['channels'][_0x31933c[_0xf038('0x2f')]][_0xf038('0x5e')]=_0x55adf2[_0xf038('0x3e')](_0xf038('0x45'));if(this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x44')]){this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x5f')]=_0x55adf2[_0xf038('0x62')](this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x44')],_0xf038('0x56'));}}if(_0x31933c[_0xf038('0x31')]!==_0xf038('0x3b')){this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x3d')]=_0x31933c[_0xf038('0x31')];}this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x60')]=_0x31933c[_0xf038('0x30')];this['channels'][_0x31933c[_0xf038('0x2f')]][_0xf038('0x63')]=_0x31933c[_0xf038('0x39')];this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0x46')]=dispositions[_[_0xf038('0x61')](_0x31933c['channelstate'])];}}else{if(this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]]){if(_0x3cf896){this[_0xf038('0x14')][_0x31933c['uniqueid']]['UserId']=_0x3cf896['id'];this[_0xf038('0x14')][_0x31933c['uniqueid']][_0xf038('0x64')]=_0x3cf896[_0xf038('0x3f')];}}}if(_0x31933c[_0xf038('0x48')]===_0xf038('0x38')){if(_0x3cf896){_0x3cf896[_0xf038('0x3c')]=_0x31933c['exten'];var _0x1af3ec;if(this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]]){_0x1af3ec=this[_0xf038('0x14')][_0x31933c[_0xf038('0x2f')]][_0xf038('0xa')];}else if(this['channels'][_0x31933c[_0xf038('0x34')]]){_0x1af3ec=this[_0xf038('0x14')][_0x31933c[_0xf038('0x34')]][_0xf038('0xa')];}_0x3cf896[_0xf038('0xa')]=_0x1af3ec;var _0x840ada={'id':_0x3cf896['id'],'name':_0x3cf896[_0xf038('0x3f')],'agentconnected':!![],'destaccountcode':_0x3cf896[_0xf038('0x4b')],'destconnectedlinenum':_0x31933c[_0xf038('0x3a')],'queue':_0x1af3ec||undefined,'uniqueid':_0x31933c[_0xf038('0x34')]};logger[_0xf038('0x32')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x31933c[_0xf038('0x2f')],util['inspect'](_0x840ada,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x3cf896['name']),_0xf038('0x40'),_0x840ada);}}}}catch(_0x2911d0){logger[_0xf038('0x4d')](_0xf038('0x65'),_0x31933c['uniqueid'],util[_0xf038('0x41')](_0x2911d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf038('0x2b')][_0xf038('0x66')]=function(_0x220c1a,_0xbae65d){try{if(this['channels'][_0x220c1a]){logger['info'](_0xf038('0x67'),_0x220c1a,_0xbae65d);this[_0xf038('0x14')][_0x220c1a][_0xf038('0x68')]=!![];if(_['endsWith'](_0xbae65d,'.wav49')){_0xbae65d=_0xbae65d[_0xf038('0x69')](_0xf038('0x6a'),'.WAV');}this[_0xf038('0x14')][_0x220c1a][_0xf038('0x6b')]=_0xbae65d;var _0x172034=_[_0xf038('0x6c')](this['channels'][_0x220c1a][_0xf038('0x6d')],{'filename':_0xbae65d});if(_[_0xf038('0x5b')](_0x172034)){this[_0xf038('0x14')][_0x220c1a][_0xf038('0x6d')][_0xf038('0x6e')]({'filename':_0xbae65d,'createdAt':moment()['format'](_0xf038('0x45')),'mixmonitorid':'','status':'rec'});}}}catch(_0x588207){logger[_0xf038('0x4d')](_0xf038('0x6f'),_0x220c1a,util[_0xf038('0x41')](_0x588207,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf038('0x2b')][_0xf038('0x1d')]=function(_0x3813b2){try{if(this['isNotNull'](_0x3813b2)){logger[_0xf038('0x32')](_0xf038('0x70'),_0x3813b2[_0xf038('0x2f')],util['inspect'](_0x3813b2,{'showHidden':![],'depth':null}));if(this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]]&&_0x3813b2[_0xf038('0x39')]!=_0xf038('0x42')){if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')])){if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')]['mixmonitor_filename'])){logger[_0xf038('0x27')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3813b2['uniqueid'],_0x3813b2[_0xf038('0x72')]);this['syncMixMonitorFilename'](_0x3813b2[_0xf038('0x2f')],_0x3813b2[_0xf038('0x72')]);}else if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')][_0xf038('0x73')])){logger[_0xf038('0x27')](_0xf038('0x74'),_0x3813b2['uniqueid'],_0x3813b2[_0xf038('0x72')]);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]][_0xf038('0x31')]=_0x3813b2[_0xf038('0x72')];}else if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')][_0xf038('0x75')])){logger[_0xf038('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x3813b2['uniqueid'],_0x3813b2['value']);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]]['callerid']=_0x3813b2[_0xf038('0x72')];}else if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')]['xmd-cdrtype'])){logger[_0xf038('0x27')](_0xf038('0x76'),_0x3813b2[_0xf038('0x2f')],_0x3813b2[_0xf038('0x72')]);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]][_0xf038('0x77')]=_0x3813b2[_0xf038('0x72')];}else if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')][_0xf038('0x78')])){logger[_0xf038('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3813b2[_0xf038('0x2f')],_0x3813b2[_0xf038('0x72')][_0xf038('0x49')](',')[0x0]);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]][_0xf038('0xa')]=_0x3813b2[_0xf038('0x72')][_0xf038('0x49')](',')[0x0];}else if(this[_0xf038('0x2c')](_0x3813b2['variable'][_0xf038('0x79')])){logger[_0xf038('0x27')](_0xf038('0x7a'),_0x3813b2[_0xf038('0x2f')],_0x3813b2['value']);this[_0xf038('0x14')][_0x3813b2['uniqueid']]['originatecalleridnum']=_0x3813b2[_0xf038('0x72')];}else if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')]['xmd-destination'])){logger[_0xf038('0x27')](_0xf038('0x7b'),_0x3813b2[_0xf038('0x2f')],_0x3813b2['value']);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]][_0xf038('0x7c')]=_0x3813b2['value'];}else if(this['isNotNull'](_0x3813b2[_0xf038('0x71')][_0xf038('0x7d')])){logger[_0xf038('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x3813b2['uniqueid'],_0x3813b2[_0xf038('0x72')]);this['channels'][_0x3813b2[_0xf038('0x2f')]][_0xf038('0x7e')]=_0x3813b2[_0xf038('0x72')];}else if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')][_0xf038('0x7f')])){logger[_0xf038('0x27')](_0xf038('0x80'),_0x3813b2[_0xf038('0x2f')],_0x3813b2['value']);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]][_0xf038('0xa')]=_0x3813b2['value'];}else if(this['isNotNull'](_0x3813b2[_0xf038('0x71')][_0xf038('0x81')])){logger[_0xf038('0x27')](_0xf038('0x82'),_0x3813b2['uniqueid'],_0x3813b2['value']);this[_0xf038('0x14')][_0x3813b2[_0xf038('0x2f')]][_0xf038('0x83')]=_0x3813b2[_0xf038('0x72')];}}}else if(this['isNotNull'](_0x3813b2[_0xf038('0x71')]['mixmonitor_filename'])){if(_0x3813b2['value']){var _0x5a0466=path[_0xf038('0x84')](_0x3813b2[_0xf038('0x72')])[_0xf038('0x3f')];logger[_0xf038('0x27')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5a0466,_0x3813b2[_0xf038('0x72')]);this['syncMixMonitorFilename'](_0x5a0466,_0x3813b2[_0xf038('0x72')]);}}else if(this[_0xf038('0x14')][_0x3813b2[_0xf038('0x34')]]){if(this[_0xf038('0x2c')](_0x3813b2[_0xf038('0x71')])){if(this['isNotNull'](_0x3813b2[_0xf038('0x71')][_0xf038('0x81')])){logger[_0xf038('0x27')](_0xf038('0x82'),_0x3813b2[_0xf038('0x34')],_0x3813b2['value']);this['channels'][_0x3813b2['linkedid']][_0xf038('0x85')]=_0x3813b2[_0xf038('0x72')];}}}}}catch(_0x570481){logger['error'](_0xf038('0x86'),_0x3813b2['uniqueid'],util[_0xf038('0x41')](_0x570481,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf038('0x2b')][_0xf038('0x1f')]=function(_0x5224e1){try{if(this['isNotNull'](_0x5224e1)){logger[_0xf038('0x32')]('[%s][voiceCallReport][hangup]\x20event:',_0x5224e1[_0xf038('0x2f')],util[_0xf038('0x41')](_0x5224e1,{'showHidden':![],'depth':null}));if(this[_0xf038('0x43')][_0x5224e1['linkedid']]){if(this['channels'][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x34')]]){this['channels'][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x34')]][_0xf038('0x2f')]=_0x5224e1[_0xf038('0x2f')];this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1['linkedid']][_0xf038('0x34')]][_0xf038('0x5d')]=this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x5d')];this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]]['linkedid']][_0xf038('0x5e')]=this[_0xf038('0x14')][_0x5224e1['uniqueid']][_0xf038('0x5e')];this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x34')]][_0xf038('0x63')]=this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]]['linkedid']][_0xf038('0x39')];this['channels'][this['blindTransfers'][_0x5224e1[_0xf038('0x34')]]['linkedid']]['disposition']=this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x46')];this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]]=this['channels'][this[_0xf038('0x43')][_0x5224e1['linkedid']][_0xf038('0x34')]];this['deleteChannelAfterTimeout'](this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x34')]);}else if(this[_0xf038('0x14')][this['blindTransfers'][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]]){this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]][_0xf038('0x2f')]=[this['channels'][this[_0xf038('0x43')][_0x5224e1['linkedid']][_0xf038('0x2f')]]['linkedid'],this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]][_0xf038('0x34')]=this['channels'][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]][_0xf038('0x2f')]][0x0];this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]]['uniqueid']][_0xf038('0x5d')]=this[_0xf038('0x14')][_0x5224e1['uniqueid']]['answered'];this[_0xf038('0x14')][this['blindTransfers'][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]]['answertime']=this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x5e')];this['channels'][this['blindTransfers'][_0x5224e1['linkedid']][_0xf038('0x2f')]][_0xf038('0x63')]=this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1['linkedid']][_0xf038('0x2f')]][_0xf038('0x39')];this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]][_0xf038('0x46')]=this[_0xf038('0x14')][_0x5224e1['uniqueid']][_0xf038('0x46')];this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]]=this[_0xf038('0x14')][this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]][_0xf038('0x2f')]];this[_0xf038('0x87')](this[_0xf038('0x43')][_0x5224e1[_0xf038('0x34')]]['uniqueid']);}}if(this[_0xf038('0x14')][_0x5224e1['uniqueid']]){logger[_0xf038('0x27')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x5224e1[_0xf038('0x2f')],_0x5224e1[_0xf038('0x88')]);var _0x3235de=moment();this[_0xf038('0x14')][_0x5224e1['uniqueid']]['endtime']=_0x3235de[_0xf038('0x3e')](_0xf038('0x45'));this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x55')]=_0x3235de['diff'](this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]]['starttime'],_0xf038('0x56'));if(this['channels'][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x5d')]){this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x89')]=_0x3235de[_0xf038('0x62')](this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x5e')],_0xf038('0x56'));this['channels'][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x5f')]=this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x55')]-this[_0xf038('0x14')][_0x5224e1[_0xf038('0x2f')]][_0xf038('0x89')];}if(_0x5224e1[_0xf038('0x48')]===_0xf038('0x38')){if(this[_0xf038('0x15')][_0x5224e1['channel'][_0xf038('0x49')]('-')[0x0]]){this[_0xf038('0x15')][_0x5224e1[_0xf038('0x39')][_0xf038('0x49')]('-')[0x0]]=_[_0xf038('0x8a')](this[_0xf038('0x15')][_0x5224e1[_0xf038('0x39')][_0xf038('0x49')]('-')[0x0]],[_0xf038('0x3c')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x5224e1[_0xf038('0x2f')],util[_0xf038('0x41')]({'id':this['agents'][_0x5224e1[_0xf038('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xf038('0x15')][_0x5224e1['channel']['split']('-')[0x0]][_0xf038('0x4b')]},{'showHidden':![],'depth':null}));this[_0xf038('0x2e')](util[_0xf038('0x3e')]('user:%s',this[_0xf038('0x15')][_0x5224e1[_0xf038('0x39')][_0xf038('0x49')]('-')[0x0]][_0xf038('0x3f')]),_0xf038('0x8b'),{'id':this['agents'][_0x5224e1[_0xf038('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xf038('0x15')][_0x5224e1[_0xf038('0x39')][_0xf038('0x49')]('-')[0x0]]['accountcode']});for(var _0x35912b=0x0;_0x35912b{delete this[_0xf038('0x14')][_0x309ebc];},_0x262a38);}};module[_0xf038('0xb9')]=VoiceCallReport; \ No newline at end of file +var _0x72f0=['[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','user:agentcomplete','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','StopMixMonitor','webbar:stopmonitors','event','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','BLIND','syncHangup','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','path','ioredis','../../../config/environment','ami','../ami','../rpc/setting','set','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isNotNull','isUndefined','prototype','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','context','from-sip','channel','exten','destconnectedlinenum','connectedlinenum','format','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','merge','undefined','debug','user:%s','name','error','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','keys','includes','lastdata','startsWith','cdr(','split','type','isNil','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','disposition','toNumber','channelstate','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','[%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','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout'];(function(_0x195d9e,_0x4fc668){var _0x18fde5=function(_0x51898d){while(--_0x51898d){_0x195d9e['push'](_0x195d9e['shift']());}};_0x18fde5(++_0x4fc668);}(_0x72f0,0x1c3));var _0x072f=function(_0x592cbc,_0x5ec030){_0x592cbc=_0x592cbc-0x0;var _0x39b8d9=_0x72f0[_0x592cbc];return _0x39b8d9;};'use strict';var _=require(_0x072f('0x0'));var moment=require(_0x072f('0x1'));var util=require('util');var path=require(_0x072f('0x2'));var Redis=require(_0x072f('0x3'));var config=require(_0x072f('0x4'));var logger=require('../../../config/logger')(_0x072f('0x5'));var ami=require(_0x072f('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x072f('0x7'));var applications=[_0x072f('0x8'),'queue',_0x072f('0x9'),_0x072f('0xa'),_0x072f('0xb'),'voicemail'];var dispositions=[_0x072f('0xc'),_0x072f('0xd'),_0x072f('0xd'),'NO\x20ANSWER','NO\x20ANSWER',_0x072f('0xc'),_0x072f('0xe'),_0x072f('0xf'),'FAILED','FAILED',_0x072f('0xd')];config['redis']=_[_0x072f('0x10')](config[_0x072f('0x11')],{'host':_0x072f('0x12'),'port':0x18eb});var io=require(_0x072f('0x13'))(new Redis(config[_0x072f('0x11')]));function VoiceCallReport(_0xedda37){this[_0x072f('0x14')]=_0xedda37['channels'];this[_0x072f('0x15')]=_0xedda37[_0x072f('0x15')];this[_0x072f('0x16')]={};ami['on'](_0x072f('0x17'),this[_0x072f('0x18')][_0x072f('0x19')](this));ami['on'](_0x072f('0x1a'),this[_0x072f('0x18')]['bind'](this));ami['on'](_0x072f('0x1b'),this[_0x072f('0x1c')][_0x072f('0x19')](this));ami['on']('newstate',this[_0x072f('0x1d')][_0x072f('0x19')](this));ami['on'](_0x072f('0x1e'),this[_0x072f('0x1f')]['bind'](this));ami['on'](_0x072f('0x20'),this['syncHangup']['bind'](this));ami['on'](_0x072f('0x21'),this[_0x072f('0x22')]['bind'](this));ami['on']('attendedtransfer',this[_0x072f('0x23')][_0x072f('0x19')](this));ami['on'](_0x072f('0x24'),this[_0x072f('0x25')]['bind'](this));ami['on'](_0x072f('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x072f('0x27'),this[_0x072f('0x28')][_0x072f('0x19')](this));try{logger['info'](_0x072f('0x29'));ami[_0x072f('0x2a')]();}catch(_0x3a58fe){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x072f('0x2b')](_0x3a58fe,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x072f('0x2c')]=function(_0xba034b){return _0xba034b!==null&&!_[_0x072f('0x2d')](_0xba034b);};VoiceCallReport[_0x072f('0x2e')][_0x072f('0x2f')]=function(_0x142589,_0x2b72cd,_0x417784){io['to'](_0x142589)[_0x072f('0x2f')](_0x2b72cd,_0x417784);};VoiceCallReport[_0x072f('0x2e')][_0x072f('0x22')]=function(_0x152c2f){try{if(this[_0x072f('0x2c')](_0x152c2f)){logger[_0x072f('0x30')](_0x072f('0x31'),_0x152c2f[_0x072f('0x32')],_0x152c2f[_0x072f('0x33')],_0x152c2f[_0x072f('0x34')]);logger['debug'](_0x072f('0x35'),_0x152c2f[_0x072f('0x32')],util[_0x072f('0x2b')](_0x152c2f,{'showHidden':![],'depth':null}));if(_0x152c2f[_0x072f('0x32')]===_0x152c2f[_0x072f('0x36')]){if(!_['isUndefined'](this['channels'][_0x152c2f[_0x072f('0x32')]])){_['merge'](this[_0x072f('0x14')][_0x152c2f['uniqueid']],_[_0x072f('0x37')](_0x152c2f,_['keys'](this[_0x072f('0x14')][_0x152c2f['uniqueid']])));}}if(_0x152c2f[_0x072f('0x38')]===_0x072f('0x39')){var _0x1abb99=this['agents'][_0x152c2f[_0x072f('0x3a')]['split']('-')[0x0]];if(_0x1abb99){if(_0x152c2f[_0x072f('0x3b')]=='xcally-motion-preview'){_0x1abb99[_0x072f('0x3c')]=_0x152c2f[_0x072f('0x3d')];this[_0x072f('0x2f')](util[_0x072f('0x3e')]('user:%s',_0x1abb99['name']),_0x072f('0x3f'),{'id':_0x1abb99['id'],'destaccountcode':_0x1abb99[_0x072f('0x40')],'destconnectedlinenum':_0x152c2f[_0x072f('0x3d')]});}}}}}catch(_0x594827){logger['error']('[%s][voiceCallReport][newcallerid]',_0x152c2f[_0x072f('0x32')],util[_0x072f('0x2b')](_0x594827,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x3d1f03){try{if(this[_0x072f('0x2c')](_0x3d1f03)){logger['debug'](_0x072f('0x41'),_0x3d1f03[_0x072f('0x32')],util[_0x072f('0x2b')](_0x3d1f03,{'showHidden':![],'depth':null}));if(this[_0x072f('0x14')][_0x3d1f03['uniqueid']]){return;}if(_0x3d1f03[_0x072f('0x3a')]===_0x072f('0x42')){return;}if(_0x3d1f03[_0x072f('0x32')]!==_0x3d1f03['linkedid']&&!this[_0x072f('0x16')][_0x3d1f03['linkedid']]){return;}logger['info'](_0x072f('0x43'),_0x3d1f03[_0x072f('0x32')],_0x3d1f03[_0x072f('0x38')],_0x3d1f03['exten']);this['channels'][_0x3d1f03[_0x072f('0x32')]]=new Channel();this[_0x072f('0x14')][_0x3d1f03['uniqueid']]['starttime']=moment()[_0x072f('0x3e')](_0x072f('0x44'));this[_0x072f('0x14')][_0x3d1f03[_0x072f('0x32')]]['disposition']=dispositions[_['toNumber'](_0x3d1f03['channelstate'])];_[_0x072f('0x45')](this[_0x072f('0x14')][_0x3d1f03[_0x072f('0x32')]],_['pick'](_0x3d1f03,_['keys'](this[_0x072f('0x14')][_0x3d1f03[_0x072f('0x32')]])));if(_0x3d1f03['context']===_0x072f('0x39')){var _0x301f04=this[_0x072f('0x15')][_0x3d1f03[_0x072f('0x3a')]['split']('-')[0x0]];if(_0x301f04&&typeof _0x301f04[_0x072f('0x3c')]===_0x072f('0x46')){_0x301f04[_0x072f('0x3c')]=_0x3d1f03[_0x072f('0x3b')];logger[_0x072f('0x47')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3d1f03[_0x072f('0x32')],util[_0x072f('0x2b')]({'id':_0x301f04['id'],'destaccountcode':_0x301f04[_0x072f('0x40')],'destconnectedlinenum':_0x3d1f03[_0x072f('0x3b')]},{'showHidden':![],'depth':null}));this[_0x072f('0x2f')](util[_0x072f('0x3e')](_0x072f('0x48'),_0x301f04[_0x072f('0x49')]),_0x072f('0x3f'),{'id':_0x301f04['id'],'destaccountcode':_0x301f04[_0x072f('0x40')],'destconnectedlinenum':_0x3d1f03['exten']});}}}}catch(_0x13e759){logger[_0x072f('0x4a')]('[%s][voiceCallReport][newchannel]',_0x3d1f03[_0x072f('0x32')],util[_0x072f('0x2b')](_0x13e759,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x072f('0x2e')][_0x072f('0x18')]=function(_0x3315d7){try{if(this[_0x072f('0x2c')](_0x3315d7)){logger['debug'](_0x072f('0x4b'),_0x3315d7[_0x072f('0x32')],util[_0x072f('0x2b')](_0x3315d7,{'showHidden':![],'depth':null}));if(_0x3315d7[_0x072f('0x3a')]===_0x072f('0x42')||_0x3315d7[_0x072f('0x3b')]==='h')return;if(_0x3315d7[_0x072f('0x32')]===_0x3315d7[_0x072f('0x36')]||this['blindTransfers'][_0x3315d7[_0x072f('0x36')]]){_0x3315d7[_0x072f('0x4c')]=_0x3315d7[_0x072f('0x4c')]?_0x3315d7[_0x072f('0x4c')][_0x072f('0x4d')]():undefined;_0x3315d7[_0x072f('0x4e')]=_0x3315d7[_0x072f('0x4f')]||_0x3315d7[_0x072f('0x4e')];if(_0x3315d7['appdata']&&_0x3315d7[_0x072f('0x4c')]!=='queue'){_0x3315d7[_0x072f('0x4e')]=_0x3315d7[_0x072f('0x4e')][_0x072f('0x4d')]();}logger['info'](_0x072f('0x50'),_0x3315d7[_0x072f('0x32')],_0x3315d7[_0x072f('0x4c')],_0x3315d7[_0x072f('0x4e')]);if(_['isUndefined'](this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]])){this[_0x072f('0x14')][_0x3315d7['uniqueid']]=new Channel();this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]][_0x072f('0x51')]=_0x3315d7[_0x072f('0x52')]?moment()['subtract'](moment[_0x072f('0x52')](_0x3315d7['duration'])[_0x072f('0x53')](),_0x072f('0x53'))[_0x072f('0x3e')](_0x072f('0x44')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]]['disposition']=_0x072f('0xc');}_[_0x072f('0x45')](this[_0x072f('0x14')][_0x3315d7['uniqueid']],_['pick'](_0x3315d7,_[_0x072f('0x54')](this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]])));if(_[_0x072f('0x55')](applications,_0x3315d7[_0x072f('0x4c')])){this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]]['lastapplication']=_0x3315d7[_0x072f('0x4c')];this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]][_0x072f('0x56')]=_0x3315d7[_0x072f('0x4e')];if(_0x3315d7[_0x072f('0x4c')]===_0x072f('0x8')&&_[_0x072f('0x57')](_0x3315d7['applicationdata'][_0x072f('0x4d')](),_0x072f('0x58'))){var _0x10bd9a=_0x3315d7[_0x072f('0x4e')][_0x072f('0x59')]('=');var _0xe9dad8=_0x10bd9a[0x0][_0x072f('0x4d')]()['match'](/cdr\((.*)\)/);if(_0xe9dad8){if(_0xe9dad8[0x1]===_0x072f('0x5a')&&!_[_0x072f('0x5b')](this['channels'][_0x3315d7[_0x072f('0x32')]][_0xe9dad8[0x1]]))return;this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]][_0xe9dad8[0x1]]=_0x10bd9a[0x1];}}else if(_0x3315d7[_0x072f('0x4c')]===_0x072f('0x5c')){this[_0x072f('0x14')][_0x3315d7[_0x072f('0x32')]]['queue']=_0x3315d7['applicationdata'][_0x072f('0x59')](',')[0x0];}}}}}catch(_0x5bc907){logger[_0x072f('0x4a')](_0x072f('0x5d'),_0x3315d7['uniqueid'],util[_0x072f('0x2b')](_0x5bc907,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x072f('0x2e')][_0x072f('0x1d')]=function(_0x3892d9){try{if(this[_0x072f('0x2c')](_0x3892d9)){logger[_0x072f('0x30')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x3892d9[_0x072f('0x32')],_0x3892d9['linkedid'],_0x3892d9[_0x072f('0x33')],_0x3892d9[_0x072f('0x34')]);logger[_0x072f('0x47')](_0x072f('0x5e'),_0x3892d9['uniqueid'],util[_0x072f('0x2b')](_0x3892d9,{'showHidden':![],'depth':null}));if(_0x3892d9['channelstate']!=='6')return;var _0x35a7f0=this[_0x072f('0x15')][_0x3892d9[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]];if(_0x3892d9['uniqueid']!==_0x3892d9[_0x072f('0x36')]){var _0x4da475=moment();if(this[_0x072f('0x14')][_0x3892d9[_0x072f('0x36')]]){if(!this['channels'][_0x3892d9[_0x072f('0x36')]][_0x072f('0x5f')]){this[_0x072f('0x14')][_0x3892d9['linkedid']][_0x072f('0x5f')]=!![];this[_0x072f('0x14')][_0x3892d9[_0x072f('0x36')]][_0x072f('0x60')]=_0x4da475[_0x072f('0x3e')](_0x072f('0x44'));if(this[_0x072f('0x14')][_0x3892d9[_0x072f('0x36')]][_0x072f('0x51')]){this[_0x072f('0x14')][_0x3892d9[_0x072f('0x36')]][_0x072f('0x61')]=_0x4da475[_0x072f('0x62')](this[_0x072f('0x14')][_0x3892d9['linkedid']][_0x072f('0x51')],_0x072f('0x53'));}}this[_0x072f('0x14')][_0x3892d9['linkedid']][_0x072f('0x36')]=_0x3892d9[_0x072f('0x32')];if(_0x3892d9[_0x072f('0x34')]!=='xcally-motion-preview'){this[_0x072f('0x14')][_0x3892d9['linkedid']][_0x072f('0x3d')]=_0x3892d9[_0x072f('0x34')];}this[_0x072f('0x14')][_0x3892d9[_0x072f('0x36')]][_0x072f('0x63')]=_0x3892d9['calleridname'];this[_0x072f('0x14')][_0x3892d9['linkedid']][_0x072f('0x64')]=_0x3892d9['channel'];this['channels'][_0x3892d9[_0x072f('0x36')]][_0x072f('0x65')]=dispositions[_['toNumber'](_0x3892d9['channelstate'])];if(_0x35a7f0){this[_0x072f('0x14')][_0x3892d9['linkedid']]['UserId']=_0x35a7f0['id'];this['channels'][_0x3892d9[_0x072f('0x36')]]['membername']=_0x35a7f0[_0x072f('0x49')];}}if(this[_0x072f('0x14')][_0x3892d9[_0x072f('0x32')]]){if(!this[_0x072f('0x14')][_0x3892d9[_0x072f('0x32')]][_0x072f('0x5f')]){this['channels'][_0x3892d9[_0x072f('0x32')]][_0x072f('0x5f')]=!![];this['channels'][_0x3892d9[_0x072f('0x32')]][_0x072f('0x60')]=_0x4da475[_0x072f('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x072f('0x14')][_0x3892d9['uniqueid']][_0x072f('0x51')]){this['channels'][_0x3892d9[_0x072f('0x32')]][_0x072f('0x61')]=_0x4da475[_0x072f('0x62')](this[_0x072f('0x14')][_0x3892d9['uniqueid']][_0x072f('0x51')],_0x072f('0x53'));}}if(_0x3892d9[_0x072f('0x34')]!=='xcally-motion-preview'){this[_0x072f('0x14')][_0x3892d9[_0x072f('0x32')]][_0x072f('0x3d')]=_0x3892d9[_0x072f('0x34')];}this[_0x072f('0x14')][_0x3892d9['uniqueid']][_0x072f('0x63')]=_0x3892d9[_0x072f('0x33')];this[_0x072f('0x14')][_0x3892d9['uniqueid']]['destinationchannel']=_0x3892d9[_0x072f('0x3a')];this[_0x072f('0x14')][_0x3892d9[_0x072f('0x32')]][_0x072f('0x65')]=dispositions[_[_0x072f('0x66')](_0x3892d9[_0x072f('0x67')])];}}else{if(this[_0x072f('0x14')][_0x3892d9[_0x072f('0x32')]]){if(_0x35a7f0){this['channels'][_0x3892d9['uniqueid']][_0x072f('0x68')]=_0x35a7f0['id'];this[_0x072f('0x14')][_0x3892d9[_0x072f('0x32')]]['membername']=_0x35a7f0[_0x072f('0x49')];}}}if(_0x3892d9['context']==='from-sip'){if(_0x35a7f0){_0x35a7f0[_0x072f('0x3c')]=_0x3892d9['exten'];var _0x13f5e1;if(this['channels'][_0x3892d9[_0x072f('0x32')]]){_0x13f5e1=this[_0x072f('0x14')][_0x3892d9['uniqueid']][_0x072f('0x5c')];}else if(this['channels'][_0x3892d9[_0x072f('0x36')]]){_0x13f5e1=this['channels'][_0x3892d9[_0x072f('0x36')]]['queue'];}_0x35a7f0[_0x072f('0x5c')]=_0x13f5e1;var _0x471dc3={'id':_0x35a7f0['id'],'name':_0x35a7f0['name'],'agentconnected':!![],'destaccountcode':_0x35a7f0[_0x072f('0x40')],'destconnectedlinenum':_0x3892d9[_0x072f('0x3b')],'queue':_0x13f5e1||undefined,'uniqueid':_0x3892d9['linkedid']};logger[_0x072f('0x47')](_0x072f('0x69'),_0x3892d9[_0x072f('0x32')],util[_0x072f('0x2b')](_0x471dc3,{'showHidden':![],'depth':null}));this[_0x072f('0x2f')](util['format']('user:%s',_0x35a7f0[_0x072f('0x49')]),'user:agentconnect',_0x471dc3);}}}}catch(_0x4b3d57){logger['error'](_0x072f('0x6a'),_0x3892d9['uniqueid'],util['inspect'](_0x4b3d57,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x072f('0x2e')][_0x072f('0x6b')]=function(_0x521ad3,_0x343a6e){try{if(this[_0x072f('0x14')][_0x521ad3]){logger[_0x072f('0x30')](_0x072f('0x6c'),_0x521ad3,_0x343a6e);this['channels'][_0x521ad3][_0x072f('0x6d')]=!![];if(_['endsWith'](_0x343a6e,_0x072f('0x6e'))){_0x343a6e=_0x343a6e[_0x072f('0x6f')](_0x072f('0x6e'),_0x072f('0x70'));}this['channels'][_0x521ad3][_0x072f('0x71')]=_0x343a6e;var _0xb3fe41=_[_0x072f('0x72')](this['channels'][_0x521ad3][_0x072f('0x73')],{'filename':_0x343a6e});if(_['isNil'](_0xb3fe41)){this[_0x072f('0x14')][_0x521ad3][_0x072f('0x73')][_0x072f('0x74')]({'filename':_0x343a6e,'createdAt':moment()[_0x072f('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x072f('0x75')});}}}catch(_0x141ccb){logger[_0x072f('0x4a')](_0x072f('0x76'),_0x521ad3,util[_0x072f('0x2b')](_0x141ccb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x072f('0x2e')][_0x072f('0x1f')]=function(_0x258e5a){try{if(this[_0x072f('0x2c')](_0x258e5a)){logger['debug'](_0x072f('0x77'),_0x258e5a['uniqueid'],util[_0x072f('0x2b')](_0x258e5a,{'showHidden':![],'depth':null}));if(this[_0x072f('0x14')][_0x258e5a[_0x072f('0x32')]]&&_0x258e5a[_0x072f('0x3a')]!=_0x072f('0x42')){if(this['isNotNull'](_0x258e5a[_0x072f('0x78')])){if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')][_0x072f('0x79')])){logger[_0x072f('0x30')](_0x072f('0x7a'),_0x258e5a[_0x072f('0x32')],_0x258e5a[_0x072f('0x7b')]);this['syncMixMonitorFilename'](_0x258e5a['uniqueid'],_0x258e5a[_0x072f('0x7b')]);}else if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')]['xmd-phone'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x258e5a[_0x072f('0x32')],_0x258e5a[_0x072f('0x7b')]);this[_0x072f('0x14')][_0x258e5a[_0x072f('0x32')]][_0x072f('0x34')]=_0x258e5a['value'];}else if(this['isNotNull'](_0x258e5a['variable'][_0x072f('0x7c')])){logger[_0x072f('0x30')](_0x072f('0x7d'),_0x258e5a[_0x072f('0x32')],_0x258e5a['value']);this[_0x072f('0x14')][_0x258e5a[_0x072f('0x32')]][_0x072f('0x7e')]=_0x258e5a[_0x072f('0x7b')];}else if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')][_0x072f('0x7f')])){logger['info'](_0x072f('0x80'),_0x258e5a[_0x072f('0x32')],_0x258e5a[_0x072f('0x7b')]);this['channels'][_0x258e5a[_0x072f('0x32')]][_0x072f('0x5a')]=_0x258e5a[_0x072f('0x7b')];}else if(this[_0x072f('0x2c')](_0x258e5a['variable'][_0x072f('0x81')])){logger[_0x072f('0x30')](_0x072f('0x82'),_0x258e5a[_0x072f('0x32')],_0x258e5a[_0x072f('0x7b')][_0x072f('0x59')](',')[0x0]);this[_0x072f('0x14')][_0x258e5a[_0x072f('0x32')]][_0x072f('0x5c')]=_0x258e5a['value']['split'](',')[0x0];}else if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')]['xmd-originatecalleridnum'])){logger[_0x072f('0x30')](_0x072f('0x83'),_0x258e5a[_0x072f('0x32')],_0x258e5a['value']);this[_0x072f('0x14')][_0x258e5a['uniqueid']]['originatecalleridnum']=_0x258e5a[_0x072f('0x7b')];}else if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')][_0x072f('0x84')])){logger[_0x072f('0x30')](_0x072f('0x85'),_0x258e5a['uniqueid'],_0x258e5a[_0x072f('0x7b')]);this['channels'][_0x258e5a[_0x072f('0x32')]][_0x072f('0x86')]=_0x258e5a['value'];}else if(this['isNotNull'](_0x258e5a['variable'][_0x072f('0x87')])){logger[_0x072f('0x30')](_0x072f('0x88'),_0x258e5a[_0x072f('0x32')],_0x258e5a[_0x072f('0x7b')]);this[_0x072f('0x14')][_0x258e5a['uniqueid']][_0x072f('0x89')]=_0x258e5a[_0x072f('0x7b')];}else if(this[_0x072f('0x2c')](_0x258e5a['variable'][_0x072f('0x8a')])){logger[_0x072f('0x30')](_0x072f('0x8b'),_0x258e5a['uniqueid'],_0x258e5a[_0x072f('0x7b')]);this[_0x072f('0x14')][_0x258e5a[_0x072f('0x32')]]['queue']=_0x258e5a[_0x072f('0x7b')];}else if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')][_0x072f('0x8c')])){logger[_0x072f('0x30')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x258e5a[_0x072f('0x32')],_0x258e5a[_0x072f('0x7b')]);this[_0x072f('0x14')][_0x258e5a[_0x072f('0x32')]][_0x072f('0x8d')]=_0x258e5a[_0x072f('0x7b')];}}}else if(this[_0x072f('0x2c')](_0x258e5a[_0x072f('0x78')][_0x072f('0x79')])){if(_0x258e5a[_0x072f('0x7b')]){var _0xb620a5=path[_0x072f('0x8e')](_0x258e5a[_0x072f('0x7b')])[_0x072f('0x49')];logger[_0x072f('0x30')](_0x072f('0x7a'),_0xb620a5,_0x258e5a['value']);this[_0x072f('0x6b')](_0xb620a5,_0x258e5a[_0x072f('0x7b')]);}}else if(this[_0x072f('0x14')][_0x258e5a[_0x072f('0x36')]]){if(this['isNotNull'](_0x258e5a[_0x072f('0x78')])){if(this['isNotNull'](_0x258e5a[_0x072f('0x78')][_0x072f('0x8c')])){logger[_0x072f('0x30')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x258e5a[_0x072f('0x36')],_0x258e5a['value']);this[_0x072f('0x14')][_0x258e5a[_0x072f('0x36')]]['sipcalllinkedid']=_0x258e5a[_0x072f('0x7b')];}}}}}catch(_0x5df2e){logger[_0x072f('0x4a')](_0x072f('0x8f'),_0x258e5a[_0x072f('0x32')],util[_0x072f('0x2b')](_0x5df2e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x072f('0x2e')]['syncHangup']=function(_0x935f34){try{if(this['isNotNull'](_0x935f34)){logger[_0x072f('0x47')](_0x072f('0x90'),_0x935f34[_0x072f('0x32')],util['inspect'](_0x935f34,{'showHidden':![],'depth':null}));if(this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]){if(this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x36')]]){this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34['linkedid']][_0x072f('0x36')]][_0x072f('0x32')]=_0x935f34['uniqueid'];this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['linkedid']][_0x072f('0x5f')]=this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x5f')];this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['linkedid']][_0x072f('0x60')]=this['channels'][_0x935f34[_0x072f('0x32')]]['answertime'];this['channels'][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x36')]][_0x072f('0x64')]=this['channels'][this[_0x072f('0x16')][_0x935f34['linkedid']][_0x072f('0x36')]]['channel'];this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x36')]][_0x072f('0x65')]=this['channels'][_0x935f34[_0x072f('0x32')]][_0x072f('0x65')];this['channels'][_0x935f34[_0x072f('0x32')]]=this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['linkedid']];this[_0x072f('0x91')](this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x36')]);}else if(this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x32')]]){this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['uniqueid']][_0x072f('0x32')]=[this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x32')]]['linkedid'],this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['uniqueid']][_0x072f('0x36')]=this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['uniqueid']][_0x072f('0x32')]][0x0];this[_0x072f('0x14')][this['blindTransfers'][_0x935f34[_0x072f('0x36')]][_0x072f('0x32')]][_0x072f('0x5f')]=this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x5f')];this['channels'][this[_0x072f('0x16')][_0x935f34['linkedid']]['uniqueid']][_0x072f('0x60')]=this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x60')];this['channels'][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x32')]][_0x072f('0x64')]=this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x32')]][_0x072f('0x3a')];this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]]['uniqueid']][_0x072f('0x65')]=this[_0x072f('0x14')][_0x935f34['uniqueid']][_0x072f('0x65')];this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]]=this[_0x072f('0x14')][this[_0x072f('0x16')][_0x935f34[_0x072f('0x36')]][_0x072f('0x32')]];this[_0x072f('0x91')](this[_0x072f('0x16')][_0x935f34['linkedid']][_0x072f('0x32')]);}}if(this['channels'][_0x935f34[_0x072f('0x32')]]){logger[_0x072f('0x30')](_0x072f('0x92'),_0x935f34['uniqueid'],_0x935f34[_0x072f('0x93')]);var _0x1c747f=moment();this['channels'][_0x935f34[_0x072f('0x32')]]['endtime']=_0x1c747f[_0x072f('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x52')]=_0x1c747f['diff'](this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]]['starttime'],_0x072f('0x53'));if(this['channels'][_0x935f34[_0x072f('0x32')]][_0x072f('0x5f')]){this['channels'][_0x935f34[_0x072f('0x32')]][_0x072f('0x94')]=_0x1c747f['diff'](this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x60')],_0x072f('0x53'));this[_0x072f('0x14')][_0x935f34['uniqueid']][_0x072f('0x61')]=this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x52')]-this[_0x072f('0x14')][_0x935f34[_0x072f('0x32')]][_0x072f('0x94')];}if(_0x935f34[_0x072f('0x38')]===_0x072f('0x39')){if(this['agents'][_0x935f34[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]]){this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]]=_['omit'](this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]],[_0x072f('0x3c')]);logger[_0x072f('0x47')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x935f34[_0x072f('0x32')],util[_0x072f('0x2b')]({'id':this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]]['id'],'destaccountcode':this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]][_0x072f('0x40')]},{'showHidden':![],'depth':null}));this[_0x072f('0x2f')](util[_0x072f('0x3e')](_0x072f('0x48'),this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')][_0x072f('0x59')]('-')[0x0]][_0x072f('0x49')]),_0x072f('0x95'),{'id':this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x072f('0x15')][_0x935f34[_0x072f('0x3a')]['split']('-')[0x0]][_0x072f('0x40')]});for(var _0x15f5bb=0x0;_0x15f5bb{delete this[_0x072f('0x14')][_0x7c25f3];},_0x5ca3f1);}};module[_0x072f('0xc6')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index ca07ee1..d16ca1c 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 _0xdfaa=['omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','error','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','duration','endtime','diff','seconds','total','answered','holdtime','starttime','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','application','set','appdata','toLowerCase','startsWith','applicationdata','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','lastIndexOf','channel'];(function(_0x142422,_0x316c14){var _0x48d830=function(_0x510623){while(--_0x510623){_0x142422['push'](_0x142422['shift']());}};_0x48d830(++_0x316c14);}(_0xdfaa,0xd0));var _0xadfa=function(_0x295d00,_0x1e47a2){_0x295d00=_0x295d00-0x0;var _0x44e718=_0xdfaa[_0x295d00];return _0x44e718;};'use strict';var _=require(_0xadfa('0x0'));var moment=require(_0xadfa('0x1'));var util=require(_0xadfa('0x2'));var Redis=require(_0xadfa('0x3'));var config=require(_0xadfa('0x4'));var logger=require(_0xadfa('0x5'))(_0xadfa('0x6'));var ami=require(_0xadfa('0x7'));config[_0xadfa('0x8')]=_[_0xadfa('0x9')](config['redis'],{'host':_0xadfa('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x4eb8c3){this[_0xadfa('0xb')]=_0x4eb8c3[_0xadfa('0xc')];this[_0xadfa('0xd')]=_0x4eb8c3[_0xadfa('0xd')];this[_0xadfa('0xe')]={};this[_0xadfa('0xf')]={};ami['on'](_0xadfa('0x10'),this['syncDialBegin'][_0xadfa('0x11')](this));ami['on'](_0xadfa('0x12'),this[_0xadfa('0x13')][_0xadfa('0x11')](this));ami['on'](_0xadfa('0x14'),this[_0xadfa('0x15')][_0xadfa('0x11')](this));ami['on'](_0xadfa('0x16'),this[_0xadfa('0x17')][_0xadfa('0x11')](this));}VoiceDialReport[_0xadfa('0x18')]['isNotNull']=function(_0x1f0560){return _0x1f0560!==null&&!_[_0xadfa('0x19')](_0x1f0560);};VoiceDialReport[_0xadfa('0x18')]['emit']=function(_0x8f7b7,_0x9f6c09,_0x53b1da){io['to'](_0x8f7b7)[_0xadfa('0x1a')](_0x9f6c09,_0x53b1da);};VoiceDialReport[_0xadfa('0x18')][_0xadfa('0x1b')]=function(_0xe6608){try{if(this[_0xadfa('0x1c')](_0xe6608)){logger['debug'](_0xadfa('0x1d'),_0xe6608['uniqueid'],util['inspect'](_0xe6608,{'showHidden':![],'depth':null}));if(this[_0xadfa('0xb')][_0xe6608[_0xadfa('0x1e')]]){_[_0xadfa('0x1f')](this[_0xadfa('0xb')][_0xe6608['uniqueid']],{'starttime':moment()[_0xadfa('0x20')](_0xadfa('0x21')),'lastevent':_0xadfa('0x22'),'interface':_0xe6608['channel'][_0xadfa('0x23')](0x0,_0xe6608['channel'][_0xadfa('0x24')]('-')),'membername':_0xe6608[_0xadfa('0x25')][_0xadfa('0x23')](_0xe6608['channel'][_0xadfa('0x24')]('/')+0x1,_0xe6608[_0xadfa('0x25')]['lastIndexOf']('-'))},_[_0xadfa('0x26')](_0xe6608,[_0xadfa('0x27'),'privilege']));logger[_0xadfa('0x28')](_0xadfa('0x29'),_0xe6608[_0xadfa('0x1e')],this[_0xadfa('0xb')][_0xe6608['uniqueid']][_0xadfa('0x2a')],this[_0xadfa('0xb')][_0xe6608[_0xadfa('0x1e')]][_0xadfa('0x2b')]);logger[_0xadfa('0x2c')](_0xadfa('0x2d'),_0xe6608[_0xadfa('0x1e')],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0xe6608[_0xadfa('0x1e')]],{'showHidden':![],'depth':null}));if(this['applications'][_0xe6608['uniqueid']])_[_0xadfa('0x1f')](this[_0xadfa('0xb')][_0xe6608[_0xadfa('0x1e')]],this[_0xadfa('0xe')][_0xe6608['uniqueid']]);this[_0xadfa('0x1a')](_0xadfa('0x2f'),_0xadfa('0x30'),this[_0xadfa('0xb')][_0xe6608['uniqueid']]);logger[_0xadfa('0x2c')](_0xadfa('0x31'),_0xe6608[_0xadfa('0x1e')],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0xe6608['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xadfa('0x1a')](_0xadfa('0x32'),this[_0xadfa('0xb')][_0xe6608[_0xadfa('0x1e')]]);}}}catch(_0x3e67cd){logger['error'](_0xadfa('0x33'),_0xe6608[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x3e67cd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xadfa('0x13')]=function(_0x17f92c){try{if(this[_0xadfa('0x1c')](_0x17f92c)){logger['debug'](_0xadfa('0x34'),_0x17f92c[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x17f92c,{'showHidden':![],'depth':null}));if(this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]]){this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]]['dialstatus']=_0x17f92c[_0xadfa('0x35')];if(_0x17f92c[_0xadfa('0x35')]===_0xadfa('0x36')){this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]][_0xadfa('0x37')]=_0x17f92c[_0xadfa('0x37')];this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]][_0xadfa('0x38')]=_0x17f92c[_0xadfa('0x38')];this[_0xadfa('0xb')][_0x17f92c['uniqueid']][_0xadfa('0x39')]=moment()['format'](_0xadfa('0x21'));this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]][_0xadfa('0x3a')]=_0xadfa('0x3b');logger[_0xadfa('0x28')](_0xadfa('0x3c'),_0x17f92c[_0xadfa('0x1e')],_0x17f92c['channel']['substring'](_0x17f92c[_0xadfa('0x25')][_0xadfa('0x24')]('/')+0x1,_0x17f92c['channel'][_0xadfa('0x24')]('-')));logger[_0xadfa('0x2c')](_0xadfa('0x3d'),_0x17f92c[_0xadfa('0x1e')],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]],{'showHidden':![],'depth':null}));ami[_0xadfa('0x1a')](_0xadfa('0x3e'),this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]]);}logger[_0xadfa('0x2c')](_0xadfa('0x3f'),_0x17f92c['uniqueid'],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]],{'showHidden':![],'depth':null}));this[_0xadfa('0x1a')](_0xadfa('0x2f'),_0xadfa('0x30'),this[_0xadfa('0xb')][_0x17f92c[_0xadfa('0x1e')]]);}}}catch(_0x9c9e51){logger['error'](_0xadfa('0x40'),_0x17f92c[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x9c9e51,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xadfa('0x18')]['syncVarSet']=function(_0x253283){try{if(this[_0xadfa('0x1c')](_0x253283)){logger[_0xadfa('0x2c')](_0xadfa('0x41'),_0x253283[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x253283,{'showHidden':![],'depth':null}));this[_0xadfa('0x42')](_0x253283['uniqueid'],_[_0xadfa('0x43')](_0x253283[_0xadfa('0x44')])[0x0],_0x253283[_0xadfa('0x45')]);if(this[_0xadfa('0x1c')](_0x253283['variable'])&&this[_0xadfa('0x1c')](_0x253283[_0xadfa('0x44')][_0xadfa('0x46')])){if(_[_0xadfa('0x19')](this[_0xadfa('0xb')][_0x253283['uniqueid']])){this[_0xadfa('0xb')][_0x253283[_0xadfa('0x1e')]]={'routeId':_0x253283[_0xadfa('0x45')],'variables':this[_0xadfa('0xf')][_0x253283['uniqueid']],'motionChannel':'voice'};logger['info'](_0xadfa('0x47'),_0x253283[_0xadfa('0x1e')],_0x253283['variable'][_0xadfa('0x46')],_[_0xadfa('0x43')](_0x253283[_0xadfa('0x44')])[0x0],_0x253283['value']);logger[_0xadfa('0x2c')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x253283['uniqueid'],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0x253283[_0xadfa('0x1e')]],{'showHidden':![],'depth':null}));this[_0xadfa('0x1a')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x253283[_0xadfa('0x1e')]]);}}}}catch(_0x510757){logger[_0xadfa('0x48')](_0xadfa('0x49'),_0x253283[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x510757,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xadfa('0x18')]['addVariable']=function(_0x4822de,_0x45456e,_0x27771c){var _0x3472de=[_0xadfa('0x4a'),_0xadfa('0x4b'),'rtpaudioqosjitter',_0xadfa('0x4c'),_0xadfa('0x4d'),_0xadfa('0x4e'),_0xadfa('0x4f'),_0xadfa('0x50'),_0xadfa('0x51'),_0xadfa('0x52'),_0xadfa('0x53'),_0xadfa('0x54'),_0xadfa('0x55'),'memberdynamic','memberinterface',_0xadfa('0x56'),_0xadfa('0x2a'),_0xadfa('0x57'),_0xadfa('0x58')];if(!_[_0xadfa('0x59')](_0x45456e)&&!_[_0xadfa('0x5a')](_0x3472de,_0x45456e)){if(_[_0xadfa('0x19')](this[_0xadfa('0xf')][_0x4822de])){this[_0xadfa('0xf')][_0x4822de]={};}this[_0xadfa('0xf')][_0x4822de][_0x45456e]=_0x27771c;}};VoiceDialReport[_0xadfa('0x18')][_0xadfa('0x17')]=function(_0x3ed778){try{if(this['isNotNull'](_0x3ed778)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x3ed778['uniqueid'],util[_0xadfa('0x2e')](_0x3ed778,{'showHidden':![],'depth':null}));if(this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]]){logger[_0xadfa('0x28')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x3ed778[_0xadfa('0x1e')],_0x3ed778['cause-txt']);this[_0xadfa('0xb')][_0x3ed778['uniqueid']]['endtime']=moment()['format'](_0xadfa('0x21'));this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]][_0xadfa('0x5b')]=moment(this[_0xadfa('0xb')][_0x3ed778['uniqueid']][_0xadfa('0x5c')])[_0xadfa('0x5d')](this[_0xadfa('0xb')][_0x3ed778['uniqueid']]['starttime'],_0xadfa('0x5e'));this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]][_0xadfa('0x3a')]='complete';this[_0xadfa('0xd')][_0xadfa('0x5f')]+=0x1;if(this['channels'][_0x3ed778[_0xadfa('0x1e')]][_0xadfa('0x39')]){this[_0xadfa('0xd')][_0xadfa('0x60')]+=0x1;this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]][_0xadfa('0x61')]=moment(this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]]['answertime'])[_0xadfa('0x5d')](this[_0xadfa('0xb')][_0x3ed778['uniqueid']][_0xadfa('0x62')],_0xadfa('0x5e'));this['channels'][_0x3ed778[_0xadfa('0x1e')]]['billableseconds']=moment(this[_0xadfa('0xb')][_0x3ed778['uniqueid']][_0xadfa('0x5c')])['diff'](this[_0xadfa('0xb')][_0x3ed778['uniqueid']][_0xadfa('0x39')],_0xadfa('0x5e'));this[_0xadfa('0xd')][_0xadfa('0x63')]+=this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]][_0xadfa('0x61')]||0x0;this[_0xadfa('0xd')][_0xadfa('0x64')]+=this['channels'][_0x3ed778[_0xadfa('0x1e')]]['billableseconds'];}this['outbound'][_0xadfa('0x65')]+=this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]][_0xadfa('0x5b')];logger[_0xadfa('0x2c')](_0xadfa('0x66'),_0x3ed778['uniqueid'],util[_0xadfa('0x2e')](this['channels'][_0x3ed778['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xadfa('0x1a')](_0xadfa('0x67'),this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]]);logger[_0xadfa('0x2c')](_0xadfa('0x68'),_0x3ed778[_0xadfa('0x1e')],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0x3ed778['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xadfa('0x1a')]('custom:dialend',this[_0xadfa('0xb')][_0x3ed778['uniqueid']]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x3ed778[_0xadfa('0x1e')],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]],{'showHidden':![],'depth':null}));this[_0xadfa('0x1a')](_0xadfa('0x2f'),_0xadfa('0x69'),this['outbound']);logger['info'](_0xadfa('0x6a'),JSON['stringify'](this['channels'][_0x3ed778[_0xadfa('0x1e')]]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x3ed778[_0xadfa('0x1e')],util[_0xadfa('0x2e')](this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]],{'showHidden':![],'depth':null}));this[_0xadfa('0x1a')]('voice:outbound',_0xadfa('0x6b'),this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x1e')]]);this[_0xadfa('0x6c')](_0x3ed778['uniqueid']);}else if(this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x6d')]]){this[_0xadfa('0xb')][_0x3ed778['linkedid']][_0xadfa('0x1e')]=this[_0xadfa('0xb')][_0x3ed778[_0xadfa('0x6d')]]['destuniqueid'];}if(this[_0xadfa('0xf')][_0x3ed778[_0xadfa('0x1e')]]){delete this[_0xadfa('0xf')][_0x3ed778[_0xadfa('0x1e')]];}}}catch(_0x1a5f9a){logger[_0xadfa('0x48')](_0xadfa('0x6e'),_0x3ed778[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x1a5f9a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xadfa('0x18')][_0xadfa('0x6f')]=function(_0x21e736){try{if(this['isNotNull'](_0x21e736)){logger[_0xadfa('0x2c')]('[%s][voiceDialReport][newexten]\x20event:',_0x21e736[_0xadfa('0x1e')],util[_0xadfa('0x2e')](_0x21e736,{'showHidden':![],'depth':null}));if(_0x21e736[_0xadfa('0x70')]['toLowerCase']()===_0xadfa('0x71')){_0x21e736['applicationdata']=(_0x21e736[_0xadfa('0x72')]||_0x21e736['applicationdata'])[_0xadfa('0x73')]();if(_[_0xadfa('0x74')](_0x21e736[_0xadfa('0x75')],'cdr(')){if(_[_0xadfa('0x19')](this[_0xadfa('0xe')][_0x21e736[_0xadfa('0x1e')]]))this[_0xadfa('0xe')][_0x21e736[_0xadfa('0x1e')]]={};logger['info'](_0xadfa('0x76'),_0x21e736[_0xadfa('0x1e')],_0x21e736[_0xadfa('0x70')],_0x21e736[_0xadfa('0x75')]);var _0x28bc30=_0x21e736['applicationdata'][_0xadfa('0x77')]('=');var _0x25dddd=_0x28bc30[0x0][_0xadfa('0x78')](/cdr\((.*)\)/);if(_0x25dddd)this[_0xadfa('0xe')][_0x21e736[_0xadfa('0x1e')]][_0x25dddd[0x1]]=_0x28bc30[0x1];}}}}catch(_0x32be8f){logger[_0xadfa('0x48')](_0xadfa('0x79'),_0x21e736['uniqueid'],util['inspect'](_0x32be8f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xadfa('0x18')]['deleteChannelAfterTimeout']=function(_0x1efb43,_0x135698=0x2710){if(this[_0xadfa('0xb')][_0x1efb43]){setTimeout(()=>{delete this[_0xadfa('0xb')][_0x1efb43];},_0x135698);}};module[_0xadfa('0x7a')]=VoiceDialReport; \ No newline at end of file +var _0x46cb=['isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','omit','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','addVariable','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','complete','answered','starttime','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','varset','syncVarSet','hangup','syncHangup','prototype'];(function(_0x5bea12,_0x5484d1){var _0x2b362d=function(_0x1da89c){while(--_0x1da89c){_0x5bea12['push'](_0x5bea12['shift']());}};_0x2b362d(++_0x5484d1);}(_0x46cb,0xd6));var _0xb46c=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x46cb[_0x545bed];return _0x16c79c;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xb46c('0x0'));var config=require(_0xb46c('0x1'));var logger=require(_0xb46c('0x2'))(_0xb46c('0x3'));var ami=require(_0xb46c('0x4'));config[_0xb46c('0x5')]=_[_0xb46c('0x6')](config[_0xb46c('0x5')],{'host':_0xb46c('0x7'),'port':0x18eb});var io=require(_0xb46c('0x8'))(new Redis(config[_0xb46c('0x5')]));function VoiceDialReport(_0x4603b8){this[_0xb46c('0x9')]=_0x4603b8[_0xb46c('0xa')];this['outbound']=_0x4603b8[_0xb46c('0xb')];this[_0xb46c('0xc')]={};this[_0xb46c('0xd')]={};ami['on'](_0xb46c('0xe'),this[_0xb46c('0xf')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0xb46c('0x10')](this));ami['on'](_0xb46c('0x11'),this[_0xb46c('0x12')][_0xb46c('0x10')](this));ami['on'](_0xb46c('0x13'),this[_0xb46c('0x14')]['bind'](this));}VoiceDialReport[_0xb46c('0x15')]['isNotNull']=function(_0x464456){return _0x464456!==null&&!_[_0xb46c('0x16')](_0x464456);};VoiceDialReport['prototype'][_0xb46c('0x17')]=function(_0x59c2db,_0x24b897,_0x5246b4){io['to'](_0x59c2db)[_0xb46c('0x17')](_0x24b897,_0x5246b4);};VoiceDialReport[_0xb46c('0x15')]['syncDialBegin']=function(_0x3455d7){try{if(this[_0xb46c('0x18')](_0x3455d7)){logger[_0xb46c('0x19')](_0xb46c('0x1a'),_0x3455d7[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x3455d7,{'showHidden':![],'depth':null}));if(this[_0xb46c('0x9')][_0x3455d7[_0xb46c('0x1b')]]){_['merge'](this[_0xb46c('0x9')][_0x3455d7[_0xb46c('0x1b')]],{'starttime':moment()[_0xb46c('0x1d')](_0xb46c('0x1e')),'lastevent':'called','interface':_0x3455d7[_0xb46c('0x1f')]['substring'](0x0,_0x3455d7[_0xb46c('0x1f')][_0xb46c('0x20')]('-')),'membername':_0x3455d7[_0xb46c('0x1f')]['substring'](_0x3455d7[_0xb46c('0x1f')][_0xb46c('0x20')]('/')+0x1,_0x3455d7['channel']['lastIndexOf']('-'))},_[_0xb46c('0x21')](_0x3455d7,['event','privilege']));logger[_0xb46c('0x22')](_0xb46c('0x23'),_0x3455d7[_0xb46c('0x1b')],this[_0xb46c('0x9')][_0x3455d7['uniqueid']]['membername'],this[_0xb46c('0x9')][_0x3455d7[_0xb46c('0x1b')]][_0xb46c('0x24')]);logger[_0xb46c('0x19')](_0xb46c('0x25'),_0x3455d7[_0xb46c('0x1b')],util[_0xb46c('0x1c')](this[_0xb46c('0x9')][_0x3455d7['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xb46c('0xc')][_0x3455d7[_0xb46c('0x1b')]])_[_0xb46c('0x26')](this[_0xb46c('0x9')][_0x3455d7[_0xb46c('0x1b')]],this[_0xb46c('0xc')][_0x3455d7[_0xb46c('0x1b')]]);this[_0xb46c('0x17')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x3455d7[_0xb46c('0x1b')]]);logger[_0xb46c('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x3455d7[_0xb46c('0x1b')],util['inspect'](this['channels'][_0x3455d7[_0xb46c('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xb46c('0x17')]('custom:dialbegin',this[_0xb46c('0x9')][_0x3455d7[_0xb46c('0x1b')]]);}}}catch(_0x5badf3){logger[_0xb46c('0x27')]('[%s][voiceDialReport][dialbegin]',_0x3455d7[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x5badf3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb46c('0x15')]['syncDialEnd']=function(_0x5d77d9){try{if(this[_0xb46c('0x18')](_0x5d77d9)){logger[_0xb46c('0x19')](_0xb46c('0x28'),_0x5d77d9['uniqueid'],util[_0xb46c('0x1c')](_0x5d77d9,{'showHidden':![],'depth':null}));if(this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]]){this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]][_0xb46c('0x29')]=_0x5d77d9[_0xb46c('0x29')];if(_0x5d77d9[_0xb46c('0x29')]==='ANSWER'){this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]][_0xb46c('0x2a')]=_0x5d77d9[_0xb46c('0x2a')];this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]][_0xb46c('0x2b')]=_0x5d77d9['connectedlinename'];this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]][_0xb46c('0x2c')]=moment()['format'](_0xb46c('0x1e'));this['channels'][_0x5d77d9[_0xb46c('0x1b')]][_0xb46c('0x2d')]=_0xb46c('0x2e');logger[_0xb46c('0x22')](_0xb46c('0x2f'),_0x5d77d9[_0xb46c('0x1b')],_0x5d77d9[_0xb46c('0x1f')][_0xb46c('0x30')](_0x5d77d9[_0xb46c('0x1f')][_0xb46c('0x20')]('/')+0x1,_0x5d77d9['channel'][_0xb46c('0x20')]('-')));logger[_0xb46c('0x19')](_0xb46c('0x31'),_0x5d77d9['uniqueid'],util[_0xb46c('0x1c')](this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xb46c('0x17')]('custom:dialconnect',this[_0xb46c('0x9')][_0x5d77d9['uniqueid']]);}logger[_0xb46c('0x19')](_0xb46c('0x32'),_0x5d77d9[_0xb46c('0x1b')],util[_0xb46c('0x1c')](this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]],{'showHidden':![],'depth':null}));this[_0xb46c('0x17')]('voice:outbound',_0xb46c('0x33'),this[_0xb46c('0x9')][_0x5d77d9[_0xb46c('0x1b')]]);}}}catch(_0xa045f6){logger[_0xb46c('0x27')](_0xb46c('0x34'),_0x5d77d9[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0xa045f6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb46c('0x15')][_0xb46c('0x12')]=function(_0xca83d4){try{if(this[_0xb46c('0x18')](_0xca83d4)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0xca83d4[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0xca83d4,{'showHidden':![],'depth':null}));this[_0xb46c('0x35')](_0xca83d4[_0xb46c('0x1b')],_['keys'](_0xca83d4[_0xb46c('0x36')])[0x0],_0xca83d4[_0xb46c('0x37')]);if(this[_0xb46c('0x18')](_0xca83d4[_0xb46c('0x36')])&&this[_0xb46c('0x18')](_0xca83d4['variable'][_0xb46c('0x38')])){if(_[_0xb46c('0x16')](this['channels'][_0xca83d4[_0xb46c('0x1b')]])){this[_0xb46c('0x9')][_0xca83d4[_0xb46c('0x1b')]]={'routeId':_0xca83d4[_0xb46c('0x37')],'variables':this[_0xb46c('0xd')][_0xca83d4[_0xb46c('0x1b')]],'motionChannel':_0xb46c('0x39')};logger[_0xb46c('0x22')](_0xb46c('0x3a'),_0xca83d4[_0xb46c('0x1b')],_0xca83d4[_0xb46c('0x36')][_0xb46c('0x38')],_[_0xb46c('0x3b')](_0xca83d4[_0xb46c('0x36')])[0x0],_0xca83d4[_0xb46c('0x37')]);logger[_0xb46c('0x19')](_0xb46c('0x3c'),_0xca83d4['uniqueid'],util['inspect'](this[_0xb46c('0x9')][_0xca83d4[_0xb46c('0x1b')]],{'showHidden':![],'depth':null}));this[_0xb46c('0x17')](_0xb46c('0x3d'),'voice_outbound_channel:save',this[_0xb46c('0x9')][_0xca83d4['uniqueid']]);}}}}catch(_0x3f5617){logger[_0xb46c('0x27')](_0xb46c('0x3e'),_0xca83d4[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x3f5617,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xb46c('0x35')]=function(_0x1da11f,_0x2493a1,_0x4bdc45){var _0x38f116=[_0xb46c('0x3f'),_0xb46c('0x40'),'rtpaudioqosjitter',_0xb46c('0x41'),_0xb46c('0x42'),_0xb46c('0x43'),_0xb46c('0x44'),'rtpaudioqosrttbridged','sipcallid',_0xb46c('0x45'),_0xb46c('0x46'),'bridgepvtcallid',_0xb46c('0x47'),_0xb46c('0x48'),_0xb46c('0x49'),_0xb46c('0x4a'),_0xb46c('0x4b'),_0xb46c('0x4c'),_0xb46c('0x4d')];if(!_[_0xb46c('0x4e')](_0x2493a1)&&!_[_0xb46c('0x4f')](_0x38f116,_0x2493a1)){if(_['isUndefined'](this[_0xb46c('0xd')][_0x1da11f])){this[_0xb46c('0xd')][_0x1da11f]={};}this['variables'][_0x1da11f][_0x2493a1]=_0x4bdc45;}};VoiceDialReport[_0xb46c('0x15')][_0xb46c('0x14')]=function(_0x5ab649){try{if(this['isNotNull'](_0x5ab649)){logger[_0xb46c('0x19')]('[%s][voiceDialReport][hangup]\x20event:',_0x5ab649[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x5ab649,{'showHidden':![],'depth':null}));if(this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]]){logger['info'](_0xb46c('0x50'),_0x5ab649['uniqueid'],_0x5ab649[_0xb46c('0x51')]);this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x52')]=moment()[_0xb46c('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x53')]=moment(this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x52')])[_0xb46c('0x54')](this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]]['starttime'],_0xb46c('0x55'));this['channels'][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x2d')]=_0xb46c('0x56');this[_0xb46c('0xb')]['total']+=0x1;if(this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x2c')]){this[_0xb46c('0xb')][_0xb46c('0x57')]+=0x1;this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]]['holdtime']=moment(this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x2c')])['diff'](this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x58')],'seconds');this[_0xb46c('0x9')][_0x5ab649['uniqueid']]['billableseconds']=moment(this[_0xb46c('0x9')][_0x5ab649['uniqueid']][_0xb46c('0x52')])[_0xb46c('0x54')](this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x2c')],_0xb46c('0x55'));this['outbound']['sumHoldTime']+=this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x59')]||0x0;this[_0xb46c('0xb')]['sumBillable']+=this['channels'][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x5a')];}this['outbound'][_0xb46c('0x5b')]+=this['channels'][_0x5ab649[_0xb46c('0x1b')]][_0xb46c('0x53')];logger[_0xb46c('0x19')](_0xb46c('0x5c'),_0x5ab649['uniqueid'],util[_0xb46c('0x1c')](this[_0xb46c('0x9')][_0x5ab649['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xb46c('0x17')](_0xb46c('0x5d'),this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x1b')]]);logger[_0xb46c('0x19')](_0xb46c('0x5e'),_0x5ab649[_0xb46c('0x1b')],util[_0xb46c('0x1c')](this['channels'][_0x5ab649[_0xb46c('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xb46c('0x17')](_0xb46c('0x5f'),this['channels'][_0x5ab649[_0xb46c('0x1b')]]);logger['debug'](_0xb46c('0x60'),_0x5ab649['uniqueid'],util[_0xb46c('0x1c')](this[_0xb46c('0x9')][_0x5ab649['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xb46c('0x3d'),'voice_outbound:save',this[_0xb46c('0xb')]);logger[_0xb46c('0x22')](_0xb46c('0x61'),JSON[_0xb46c('0x62')](this['channels'][_0x5ab649[_0xb46c('0x1b')]]));logger['debug'](_0xb46c('0x63'),_0x5ab649[_0xb46c('0x1b')],util['inspect'](this['channels'][_0x5ab649[_0xb46c('0x1b')]],{'showHidden':![],'depth':null}));this[_0xb46c('0x17')](_0xb46c('0x3d'),_0xb46c('0x64'),this['channels'][_0x5ab649[_0xb46c('0x1b')]]);this[_0xb46c('0x65')](_0x5ab649[_0xb46c('0x1b')]);}else if(this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x66')]]){this[_0xb46c('0x9')][_0x5ab649['linkedid']]['uniqueid']=this[_0xb46c('0x9')][_0x5ab649[_0xb46c('0x66')]][_0xb46c('0x67')];}if(this[_0xb46c('0xd')][_0x5ab649[_0xb46c('0x1b')]]){delete this[_0xb46c('0xd')][_0x5ab649[_0xb46c('0x1b')]];}}}catch(_0x89d0ee){logger[_0xb46c('0x27')](_0xb46c('0x68'),_0x5ab649[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x89d0ee,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb46c('0x15')][_0xb46c('0x69')]=function(_0x2bc72c){try{if(this[_0xb46c('0x18')](_0x2bc72c)){logger['debug'](_0xb46c('0x6a'),_0x2bc72c[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x2bc72c,{'showHidden':![],'depth':null}));if(_0x2bc72c[_0xb46c('0x6b')][_0xb46c('0x6c')]()===_0xb46c('0x6d')){_0x2bc72c[_0xb46c('0x6e')]=(_0x2bc72c[_0xb46c('0x6f')]||_0x2bc72c[_0xb46c('0x6e')])[_0xb46c('0x6c')]();if(_[_0xb46c('0x70')](_0x2bc72c[_0xb46c('0x6e')],_0xb46c('0x71'))){if(_[_0xb46c('0x16')](this[_0xb46c('0xc')][_0x2bc72c[_0xb46c('0x1b')]]))this[_0xb46c('0xc')][_0x2bc72c[_0xb46c('0x1b')]]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x2bc72c['uniqueid'],_0x2bc72c[_0xb46c('0x6b')],_0x2bc72c[_0xb46c('0x6e')]);var _0x106ba7=_0x2bc72c[_0xb46c('0x6e')][_0xb46c('0x72')]('=');var _0x45c435=_0x106ba7[0x0][_0xb46c('0x73')](/cdr\((.*)\)/);if(_0x45c435)this[_0xb46c('0xc')][_0x2bc72c[_0xb46c('0x1b')]][_0x45c435[0x1]]=_0x106ba7[0x1];}}}}catch(_0x536eb0){logger['error'](_0xb46c('0x74'),_0x2bc72c[_0xb46c('0x1b')],util[_0xb46c('0x1c')](_0x536eb0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb46c('0x15')][_0xb46c('0x65')]=function(_0xe880e0,_0x844548=0x2710){if(this[_0xb46c('0x9')][_0xe880e0]){setTimeout(()=>{delete this['channels'][_0xe880e0];},_0x844548);}};module[_0xb46c('0x75')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b9ce092..16b61e7 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 _0x3868=['[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','localhost','redis','prototype','tail','sequence','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','bind','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','switch','enqueue','isNil','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','voice_queue_presence:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','Action','queues','[voiceQueueReport][queues]','loopQueueSummary','isRunning','queuesummary','actionid','queuestatus','createQueueSummaryReport','name','createReport','handleInboundQueueSummaryReport','realtime','statusRequests','syncQueueSummaryComplete','completeEvent','push','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','assign','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','diff','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','custom:queuecallerabandon','sumHoldTime'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x3868,0x117));var _0x8386=function(_0x15d6d6,_0x14d98c){_0x15d6d6=_0x15d6d6-0x0;var _0x27d97a=_0x3868[_0x15d6d6];return _0x27d97a;};'use strict';var _=require('lodash');var moment=require(_0x8386('0x0'));var util=require(_0x8386('0x1'));var Redis=require(_0x8386('0x2'));var config=require(_0x8386('0x3'));var logger=require(_0x8386('0x4'))(_0x8386('0x5'));var ami=require(_0x8386('0x6'));var QueueReport=require(_0x8386('0x7'));var VoiceQueueSummary=require(_0x8386('0x8'));config['redis']=_[_0x8386('0x9')](config['redis'],{'host':_0x8386('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8386('0xb')]));var Sequence=function(){};Sequence[_0x8386('0xc')]['enqueue']=function(_0x4a8f36){this[_0x8386('0xd')]=this['tail']?this[_0x8386('0xd')]['finally'](_0x4a8f36):_0x4a8f36();};function VoiceQueueReport(_0x18339e){this[_0x8386('0xe')]=new Sequence();this['queueReports']={};this['realtime']=_0x18339e;this[_0x8386('0xf')]=_0x18339e[_0x8386('0xf')];this[_0x8386('0x10')]=_0x18339e[_0x8386('0x11')];this[_0x8386('0x12')]=_0x18339e[_0x8386('0x12')];this[_0x8386('0x13')]=_0x18339e[_0x8386('0x13')];this[_0x8386('0x14')]=initializeSummary();this[_0x8386('0x15')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0x8386('0x16')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0x8386('0x16')](this));ami['on']('queuemember',this[_0x8386('0x17')][_0x8386('0x16')](this));ami['on'](_0x8386('0x18'),this[_0x8386('0x19')][_0x8386('0x16')](this));ami['on'](_0x8386('0x1a'),this['syncQueueCallerJoin'][_0x8386('0x16')](this));ami['on']('queuecallerabandon',this[_0x8386('0x1b')][_0x8386('0x16')](this));ami['on'](_0x8386('0x1c'),this[_0x8386('0x1d')][_0x8386('0x16')](this));ami['on'](_0x8386('0x1e'),this['syncAgentComplete']['bind'](this));ami['on'](_0x8386('0x1f'),this[_0x8386('0x20')][_0x8386('0x16')](this));ami['on'](_0x8386('0x21'),this[_0x8386('0x22')][_0x8386('0x16')](this));ami['on'](_0x8386('0x23'),this['syncHangup'][_0x8386('0x16')](this));ami['on']('fullybooted',this['syncFullyBooted'][_0x8386('0x16')](this));ami['on'](_0x8386('0x24'),this['syncMusicOnHoldStart'][_0x8386('0x16')](this));ami['on'](_0x8386('0x25'),this[_0x8386('0x26')][_0x8386('0x16')](this));ami['on'](_0x8386('0x27'),this[_0x8386('0x28')][_0x8386('0x16')](this));ami['on'](_0x8386('0x29'),this[_0x8386('0x2a')][_0x8386('0x16')](this));this['loopQueueSummary']();this[_0x8386('0x2b')]();}function clearChannels(_0x1705a9){if(!_[_0x8386('0x2c')](_0x1705a9)){for(var _0x54b322 in _0x1705a9){if(_0x1705a9['hasOwnProperty'](_0x54b322)){delete _0x1705a9[_0x54b322];}}}}function clearCampaigns(_0x1b2821){if(!_[_0x8386('0x2c')](_0x1b2821)){for(var _0x31b313 in _0x1b2821){if(_0x1b2821[_0x8386('0x2d')](_0x31b313)){_0x1b2821[_0x31b313][_0x8386('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x311773){if(!_[_0x8386('0x2c')](_0x311773)){for(var _0x33e907 in _0x311773){if(_0x311773[_0x8386('0x2d')](_0x33e907)){_0x311773[_0x33e907][_0x8386('0x2e')]=0x0;_0x311773[_0x33e907]['talking']=0x0;_0x311773[_0x33e907][_0x8386('0x2f')]=0x0;_0x311773[_0x33e907]['waiting']=0x0;_0x311773[_0x33e907][_0x8386('0x30')]=!![];}}}}function clearAgentBooked(_0x9cf886){if(!_[_0x8386('0x2c')](_0x9cf886)){for(var _0x5f1b55 in _0x9cf886){if(_0x9cf886[_0x8386('0x2d')](_0x5f1b55)){_0x9cf886[_0x5f1b55][_0x8386('0x31')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x18ee89){return _0x18ee89[_0x8386('0x32')]||_0x18ee89[_0x8386('0x33')]||_0x18ee89[_0x8386('0x34')];}VoiceQueueReport[_0x8386('0xc')]['clearZombieChannels']=function(){var _0x2ef315=this;for(var _0x2d6cd8 in this[_0x8386('0x10')]){if(this['channels'][_0x8386('0x2d')](_0x2d6cd8)&&!this[_0x8386('0x10')][_0x2d6cd8][_0x8386('0x35')]){this[_0x8386('0xe')][_0x8386('0x36')](function(){if(!_[_0x8386('0x37')](_0x2ef315[_0x8386('0x10')][_0x2d6cd8])){return ami['Action']({'action':_0x8386('0x38'),'channel':_0x2ef315[_0x8386('0x10')][_0x2d6cd8][_0x8386('0x39')]})[_0x8386('0x3a')](function(_0x3514f0){if(_0x3514f0[_0x8386('0x3b')]===_0x8386('0x3c')){setTimeout(function(){if(_0x2ef315[_0x8386('0x10')][_0x2d6cd8]){delete _0x2ef315[_0x8386('0x10')][_0x2d6cd8];logger[_0x8386('0x3d')](_0x8386('0x3e'),_0x2d6cd8,util[_0x8386('0x3f')](_0x3514f0,{'showHidden':![],'depth':null}));}if(_0x2ef315[_0x8386('0x40')][_0x2d6cd8]){delete _0x2ef315[_0x8386('0x40')][_0x2d6cd8];logger['error']('[%s][voiceQueueReport][checkQueueReport]',_0x2d6cd8,util[_0x8386('0x3f')](_0x3514f0,{'showHidden':![],'depth':null}));}if(_0x2ef315[_0x8386('0x15')][_0x2d6cd8]){delete _0x2ef315[_0x8386('0x15')][_0x2d6cd8];logger[_0x8386('0x3d')]('[%s][voiceQueueReport][checkVariables]',_0x2d6cd8,util[_0x8386('0x3f')](_0x3514f0,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x41')]=function(){logger[_0x8386('0x3d')](_0x8386('0x42'));clearChannels(this['channels']);this[_0x8386('0x43')](this[_0x8386('0x40')]);clearAgentBooked(this[_0x8386('0xf')]);clearVoiceQueues(this[_0x8386('0x12')]);clearCampaigns(this[_0x8386('0x13')]);this[_0x8386('0x14')]=initializeSummary();};VoiceQueueReport['prototype'][_0x8386('0x43')]=function(_0x334655){var _0x6abedb=this;if(!_[_0x8386('0x2c')](_0x334655)){for(var _0x3e7ca4 in _0x334655){if(_0x334655[_0x8386('0x2d')](_0x3e7ca4)){_0x6abedb['emitVoiceQueueChannelRemove'](_0x334655[_0x3e7ca4],'clearqueuereport');delete _0x334655[_0x3e7ca4];}}}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x44')]=function(_0x270ea4,_0x3fc9a9,_0x2d6177){io['to'](_0x270ea4)[_0x8386('0x44')](_0x3fc9a9,_0x2d6177);};VoiceQueueReport[_0x8386('0xc')]['emitVoiceQueueChannelSave']=function(_0x8ca7c1,_0x475efa){logger[_0x8386('0x45')](_0x8386('0x46')+_0x475efa+_0x8386('0x47'),_0x8ca7c1[_0x8386('0x48')],util[_0x8386('0x3f')](_0x8ca7c1,{'showHidden':![],'depth':null}));this[_0x8386('0x44')](util['format'](_0x8386('0x49'),_0x8ca7c1['queue']),'voice_queue_channel:save',_0x8ca7c1);io[_0x8386('0x44')](_0x8386('0x4a'),_0x8ca7c1);};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x4b')]=function(_0x80febb,_0x4bca54){logger[_0x8386('0x45')](_0x8386('0x46')+_0x4bca54+_0x8386('0x4c'),_0x80febb[_0x8386('0x48')],util[_0x8386('0x3f')](_0x80febb,{'showHidden':![],'depth':null}));if(_0x80febb[_0x8386('0x4d')]===_0x8386('0x4e')){return;}this[_0x8386('0x44')](util[_0x8386('0x4f')](_0x8386('0x49'),_0x80febb['queue']),_0x8386('0x50'),_0x80febb);io[_0x8386('0x44')](_0x8386('0x51'),_0x80febb);};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x52')]=function(_0x5d6269){if(_0x5d6269[_0x8386('0x53')]===_0x8386('0x54')){logger[_0x8386('0x45')](_0x8386('0x55'),util[_0x8386('0x3f')](_0x5d6269,{'showHidden':![],'depth':null}));this[_0x8386('0x44')](util[_0x8386('0x4f')](_0x8386('0x49'),_0x5d6269['name']),_0x8386('0x56'),_0x5d6269);}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x57')]=function(_0x2899ae){return _0x2899ae!==null&&!_[_0x8386('0x58')](_0x2899ae);};VoiceQueueReport['prototype'][_0x8386('0x2b')]=function(){var _0x587482=this;setInterval(function(){_0x587482[_0x8386('0x59')]();ami[_0x8386('0x5a')]({'action':_0x8386('0x5b')})[_0x8386('0x3a')](function(_0xb0985){logger[_0x8386('0x3d')](_0x8386('0x5c'),util[_0x8386('0x3f')](_0xb0985,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x5d')]=function(){var _0x3fd05b=this;setInterval(function(){if(!_0x3fd05b[_0x8386('0x14')][_0x8386('0x5e')]){return ami[_0x8386('0x5a')]({'action':_0x8386('0x5f')})['then'](function(_0x4c19c8){_0x3fd05b[_0x8386('0x14')]['id']=_0x4c19c8[_0x8386('0x60')];_0x3fd05b['summary']['isRunning']=!![];_0x3fd05b[_0x8386('0x14')][_0x8386('0x61')][_0x4c19c8[_0x8386('0x60')]]={};})['catch'](function(_0x600f24){logger[_0x8386('0x3d')]('[voiceQueueReport][queuesummary]',util[_0x8386('0x3f')](_0x600f24,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x62')]=function(_0x1880e5,_0x327b8d){var _0x3d55dd;if(this['summary']&&this[_0x8386('0x14')][_0x8386('0x5b')]&&this['summary']['queues'][_0x1880e5[_0x8386('0x63')]]){_0x3d55dd=this[_0x8386('0x14')][_0x8386('0x5b')][_0x1880e5['name']]['summaryEvent'];}var _0xb3e727=new VoiceQueueSummary(_0x1880e5);return _0xb3e727[_0x8386('0x64')](_0x327b8d[_0x8386('0xf')],this[_0x8386('0xf')],_0x3d55dd,this['realtime'][_0x8386('0x10')]);};VoiceQueueReport['prototype'][_0x8386('0x65')]=function(_0x3ff1b9,_0x23c552){var _0x183fe7=this[_0x8386('0x62')](_0x3ff1b9,_0x23c552);var _0x487ca2=![];_0x487ca2=_0x183fe7['compareToInboundQueue'](_0x3ff1b9);if(_0x487ca2){Object['assign'](_0x3ff1b9,_0x183fe7);this[_0x8386('0x66')][_0x8386('0x12')][_0x3ff1b9[_0x8386('0x63')]]=_0x3ff1b9;this[_0x8386('0x52')](_0x183fe7);}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x19')]=function(_0x3afbc7){var _0x5b1945=null;var _0xe64265=this[_0x8386('0x14')]['id'];if(this[_0x8386('0x14')][_0x8386('0x61')][_0xe64265]){_0x5b1945=this[_0x8386('0x14')]['queuestatus'][_0xe64265][_0x3afbc7[_0x8386('0x60')]];}if(!_0x5b1945){this['summary']=initializeSummary();return;}var _0x2fb049=this[_0x8386('0x12')][_0x5b1945['queue']];if(_0x2fb049[_0x8386('0x53')]==='inbound'){this['handleInboundQueueSummaryReport'](_0x2fb049,_0x5b1945);}else if(_0x2fb049[_0x8386('0x53')]==='outbound'){var _0x22c725=this['createQueueSummaryReport'](_0x2fb049,_0x5b1945);ami[_0x8386('0x44')]('custom:queuesummary',_0x22c725);}this[_0x8386('0x14')][_0x8386('0x67')]-=0x1;var _0x24e74e=this[_0x8386('0x14')][_0x8386('0x67')]>0x0?!![]:![];if(!_0x24e74e){return this[_0x8386('0x68')](this[_0x8386('0x14')][_0x8386('0x69')]);}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x17')]=function(_0x3c347a){var _0x93491c=this[_0x8386('0x14')]['id'];if(this['summary'][_0x8386('0x61')][_0x93491c]&&this[_0x8386('0x14')][_0x8386('0x61')][_0x93491c][_0x3c347a['actionid']]){this['summary'][_0x8386('0x61')][_0x93491c][_0x3c347a[_0x8386('0x60')]][_0x8386('0xf')][_0x8386('0x6a')](_0x3c347a);}};VoiceQueueReport['prototype'][_0x8386('0x6b')]=function(_0x21d3bd){var _0x268062=this;try{if(this[_0x8386('0x57')](_0x21d3bd)&&this[_0x8386('0x57')](_0x21d3bd[_0x8386('0x6c')])){logger['debug'](_0x8386('0x6d'),util[_0x8386('0x3f')](_0x21d3bd,{'showHidden':![],'depth':null}));var _0x18665d=this[_0x8386('0x12')][_0x21d3bd[_0x8386('0x6c')]];if(_0x18665d){logger[_0x8386('0x45')](_0x8386('0x6e'),_0x18665d[_0x8386('0x63')]);this[_0x8386('0x14')][_0x8386('0x5b')][_0x18665d[_0x8386('0x63')]]={'summaryEvent':_0x21d3bd};this[_0x8386('0x14')]['statusRequests']+=0x1;return ami[_0x8386('0x5a')]({'action':_0x8386('0x61'),'queue':_0x18665d[_0x8386('0x63')]})['then'](function(_0x2e0291){if(!_0x268062[_0x8386('0x14')][_0x8386('0x61')][_0x21d3bd[_0x8386('0x60')]]){_0x268062[_0x8386('0x14')]['queuestatus'][_0x21d3bd[_0x8386('0x60')]]={};}_0x268062['summary'][_0x8386('0x61')][_0x21d3bd[_0x8386('0x60')]][_0x2e0291[_0x8386('0x60')]]={'queue':_0x18665d[_0x8386('0x63')],'agents':[]};})['catch'](function(_0x5b25c7){throw _0x5b25c7;});}}}catch(_0xc9e60a){logger[_0x8386('0x3d')](_0x8386('0x6f'),util[_0x8386('0x3f')](_0xc9e60a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x68')]=function(_0x31d27d){if(this['summary'][_0x8386('0x67')]>0x0){this[_0x8386('0x14')][_0x8386('0x69')]=_0x31d27d;return;}logger['debug'](_0x8386('0x70'),util[_0x8386('0x3f')](_0x31d27d,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x71')]=function(_0x396fe8){try{if(this[_0x8386('0x57')](_0x396fe8)){logger[_0x8386('0x45')](_0x8386('0x72'),_0x396fe8[_0x8386('0x48')],util[_0x8386('0x3f')](_0x396fe8,{'showHidden':![],'depth':null}));if(_[_0x8386('0x58')](this[_0x8386('0x40')][_0x396fe8[_0x8386('0x48')]])){this['queueReports'][_0x396fe8['uniqueid']]=[];}if(_['isUndefined'](this[_0x8386('0x10')][_0x396fe8[_0x8386('0x48')]])){this[_0x8386('0x10')][_0x396fe8[_0x8386('0x48')]]={};}var _0x2a4eac=new QueueReport();_0x2a4eac['queue']=_0x396fe8[_0x8386('0x6c')];_0x2a4eac['type']=this[_0x8386('0x12')][_0x2a4eac[_0x8386('0x6c')]]&&this[_0x8386('0x12')][_0x2a4eac['queue']][_0x8386('0x53')]?this['voiceQueues'][_0x2a4eac[_0x8386('0x6c')]][_0x8386('0x53')]||_0x8386('0x54'):'inbound';_0x2a4eac[_0x8386('0x73')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));_0x2a4eac['position']=_0x396fe8['position'];_0x2a4eac[_0x8386('0x75')]=_0x396fe8[_0x8386('0x75')];_0x2a4eac[_0x8386('0x48')]=_0x396fe8[_0x8386('0x48')];logger[_0x8386('0x76')](_0x8386('0x77'),_0x2a4eac[_0x8386('0x6c')],_0x2a4eac['type']);Object[_0x8386('0x78')](_0x2a4eac,_[_0x8386('0x79')](_0x396fe8,_[_0x8386('0x7a')](_0x2a4eac)));this[_0x8386('0x40')][_0x396fe8['uniqueid']][_0x8386('0x6a')](_0x2a4eac);this[_0x8386('0x10')][_0x396fe8[_0x8386('0x48')]]=_0x2a4eac;this[_0x8386('0x7b')](_0x2a4eac,_0x8386('0x1a'));}}catch(_0x122226){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x396fe8[_0x8386('0x48')],util[_0x8386('0x3f')](_0x122226,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8386('0x1b')]=function(_0x45d8b2){try{if(this[_0x8386('0x57')](_0x45d8b2)){logger[_0x8386('0x45')](_0x8386('0x7c'),_0x45d8b2[_0x8386('0x48')],util[_0x8386('0x3f')](_0x45d8b2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x45d8b2[_0x8386('0x48')]]){var _0x23b3af=_['last'](this[_0x8386('0x40')][_0x45d8b2[_0x8386('0x48')]]);_0x23b3af[_0x8386('0x34')]=![];_0x23b3af[_0x8386('0x7d')]=null;_0x23b3af[_0x8386('0x7e')]=_0x45d8b2[_0x8386('0x7e')];_0x23b3af['originalposition']=_0x45d8b2['originalposition'];_0x23b3af[_0x8386('0x33')]=!![];_0x23b3af['queuecallerabandonAt']=moment()[_0x8386('0x4f')](_0x8386('0x74'));_0x23b3af[_0x8386('0x4d')]='ABANDONED';_0x23b3af[_0x8386('0x7f')]=null;logger['info'](_0x8386('0x80'),_0x23b3af['queue'],_0x23b3af[_0x8386('0x53')]);this[_0x8386('0x10')][_0x45d8b2[_0x8386('0x48')]]=_0x23b3af;this[_0x8386('0x4b')](_0x23b3af,_0x8386('0x33'));}}}catch(_0x56d360){logger[_0x8386('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x45d8b2[_0x8386('0x48')],util['inspect'](_0x56d360,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x1d')]=function(_0x252bf){try{if(this['isNotNull'](_0x252bf)){logger[_0x8386('0x45')](_0x8386('0x81'),_0x252bf[_0x8386('0x48')],util['inspect'](_0x252bf,{'showHidden':![],'depth':null}));if(this[_0x8386('0x40')][_0x252bf[_0x8386('0x48')]]){var _0x152c48=_[_0x8386('0x82')](this['queueReports'][_0x252bf[_0x8386('0x48')]]);_0x152c48[_0x8386('0x83')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));_0x152c48[_0x8386('0x84')]=_0x252bf[_0x8386('0x84')];_0x152c48[_0x8386('0x85')]=_0x252bf[_0x8386('0x85')];logger['info'](_0x8386('0x86'),_0x152c48[_0x8386('0x6c')],_0x152c48[_0x8386('0x53')],_0x252bf[_0x8386('0x84')],_0x252bf['connectedlinename']);this[_0x8386('0x10')][_0x252bf[_0x8386('0x48')]]=_0x152c48;this[_0x8386('0x7b')](_0x152c48,'queuecallerleave');}}}catch(_0x2abc9b){logger[_0x8386('0x3d')](_0x8386('0x81'),_0x252bf[_0x8386('0x48')],util[_0x8386('0x3f')](_0x2abc9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x20')]=function(_0x4d6acf){try{if(this[_0x8386('0x57')](_0x4d6acf)){logger[_0x8386('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x4d6acf[_0x8386('0x48')],util[_0x8386('0x3f')](_0x4d6acf,{'showHidden':![],'depth':null}));if(this[_0x8386('0x40')][_0x4d6acf[_0x8386('0x48')]]){var _0x3d9413=_['last'](this['queueReports'][_0x4d6acf[_0x8386('0x48')]]);_0x3d9413['queuecallercomplete']=!![];_0x3d9413[_0x8386('0x4d')]=_0x8386('0x87');logger['info'](_0x8386('0x88'),_0x3d9413[_0x8386('0x6c')],_0x3d9413['type']);}}}catch(_0x319b88){logger[_0x8386('0x3d')](_0x8386('0x89'),_0x4d6acf['uniqueid'],util[_0x8386('0x3f')](_0x319b88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0x8a')]=function(_0x36aa41){try{if(this[_0x8386('0x57')](_0x36aa41)){logger[_0x8386('0x45')](_0x8386('0x8b'),_0x36aa41[_0x8386('0x48')],util[_0x8386('0x3f')](_0x36aa41,{'showHidden':![],'depth':null}));if(this[_0x8386('0x40')][_0x36aa41['uniqueid']]){var _0x45708b=_[_0x8386('0x82')](this['queueReports'][_0x36aa41[_0x8386('0x48')]]);_0x45708b[_0x8386('0x33')]=![];_0x45708b[_0x8386('0x8c')]=null;_0x45708b[_0x8386('0x8d')]=!![];_0x45708b[_0x8386('0x7f')]=_0x36aa41[_0x8386('0x8e')];_0x45708b[_0x8386('0x7e')]=_0x36aa41[_0x8386('0x7e')];_0x45708b[_0x8386('0x34')]=!![];_0x45708b[_0x8386('0x32')]=![];_0x45708b[_0x8386('0x8f')]=null;if(!_0x45708b[_0x8386('0x90')]){if(_0x36aa41[_0x8386('0x91')]=='transfer'){_0x45708b[_0x8386('0x4d')]='COMPLETED';logger[_0x8386('0x76')](_0x8386('0x92'),_0x45708b[_0x8386('0x6c')],_0x45708b[_0x8386('0x53')]);}else{if(_[_0x8386('0x93')](_0x36aa41['channel']['toLowerCase'](),_0x8386('0x94'))){if(this[_0x8386('0x40')][_0x36aa41[_0x8386('0x95')]]){var _0x5b8862=_[_0x8386('0x82')](this['queueReports'][_0x36aa41[_0x8386('0x95')]]);_0x5b8862[_0x8386('0x34')]=![];_0x5b8862[_0x8386('0x32')]=!![];_0x5b8862[_0x8386('0x8f')]=moment(_0x45708b['queuecallerjoinAt'])[_0x8386('0x96')](_0x36aa41[_0x8386('0x7e')],_0x8386('0x97'))[_0x8386('0x4f')](_0x8386('0x74'));_0x5b8862['queuecallerexitreason']=_0x8386('0x98');_0x5b8862[_0x8386('0x90')]=!![];_0x5b8862[_0x8386('0x99')]=_0x8386('0x9a');_0x5b8862[_0x8386('0x9b')]=_0x36aa41['destexten'];_0x5b8862[_0x8386('0x9c')]=_0x36aa41[_0x8386('0x48')];logger[_0x8386('0x76')](_0x8386('0x9d'),_0x5b8862['queue'],_0x5b8862[_0x8386('0x53')]);var _0x4f76cd=this[_0x8386('0x40')][_0x36aa41[_0x8386('0x95')]];this[_0x8386('0x40')][_0x36aa41[_0x8386('0x95')]]=this[_0x8386('0x40')][_0x36aa41[_0x8386('0x48')]];this[_0x8386('0x40')][_0x36aa41['uniqueid']]=_0x4f76cd;}}else{_0x45708b['queuecallerexitreason']=_0x8386('0x9e')+_0x36aa41[_0x8386('0x91')]['toUpperCase']();logger[_0x8386('0x76')](_0x8386('0x9f'),_0x45708b[_0x8386('0x6c')],_0x45708b[_0x8386('0x53')],_0x45708b[_0x8386('0x4d')]);}}}this[_0x8386('0x10')][_0x36aa41[_0x8386('0x48')]]=_0x45708b;}}}catch(_0x5797d9){logger[_0x8386('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x36aa41[_0x8386('0x48')],util['inspect'](_0x5797d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x177f16){try{if(this['isNotNull'](_0x177f16)){logger[_0x8386('0x45')](_0x8386('0xa0'),_0x177f16['uniqueid'],util[_0x8386('0x3f')](_0x177f16,{'showHidden':![],'depth':null}));this[_0x8386('0xa1')](_0x177f16[_0x8386('0x48')],_[_0x8386('0x7a')](_0x177f16[_0x8386('0xa2')])[0x0],_0x177f16[_0x8386('0xa3')]);if(this[_0x8386('0x40')][_0x177f16[_0x8386('0x48')]]){var _0x3972f4=_[_0x8386('0x82')](this[_0x8386('0x40')][_0x177f16[_0x8386('0x48')]]);if(_0x3972f4){if(this[_0x8386('0x57')](_0x177f16[_0x8386('0xa2')])&&this[_0x8386('0x57')](_0x177f16[_0x8386('0xa2')][_0x8386('0x61')])){switch(_0x177f16[_0x8386('0xa3')]){case _0x8386('0xa4'):_0x3972f4[_0x8386('0x32')]=![];_0x3972f4[_0x8386('0x8f')]=null;break;case'TIMEOUT':_0x3972f4['lastevent']='timeout';_0x3972f4[_0x8386('0x32')]=!![];_0x3972f4[_0x8386('0x8f')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));_0x3972f4['queuecallerleaveAt']=moment()[_0x8386('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x8386('0x45')](_0x8386('0xa5'),_0x177f16[_0x8386('0x48')],util[_0x8386('0x3f')](_0x3972f4,{'showHidden':![],'depth':null}));ami[_0x8386('0x44')](_0x8386('0xa6'),_0x3972f4);break;default:_0x3972f4['queuecallerexit']=!![];_0x3972f4[_0x8386('0x8f')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));_0x3972f4[_0x8386('0x83')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));}_0x3972f4[_0x8386('0x33')]=![];_0x3972f4[_0x8386('0x8c')]=null;_0x3972f4['queuecallerexitreason']=_0x177f16[_0x8386('0xa3')];this['channels'][_0x177f16[_0x8386('0x48')]]=_0x3972f4;this[_0x8386('0x4b')](_0x3972f4,_0x8386('0x21'));}else if(this['isNotNull'](_0x177f16[_0x8386('0xa2')])&&this['isNotNull'](_0x177f16[_0x8386('0xa2')][_0x8386('0xa7')])){if(!_0x3972f4['queuecallerabandon']){_0x3972f4['queuecallerexit']=!![];_0x3972f4[_0x8386('0x8f')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));_0x3972f4['queuecallerexitreason']=_0x8386('0xa8');_0x3972f4[_0x8386('0x83')]=moment()[_0x8386('0x4f')](_0x8386('0x74'));this[_0x8386('0x10')][_0x177f16[_0x8386('0x48')]]=_0x3972f4;}}logger[_0x8386('0x76')](_0x8386('0xa9'),_0x177f16[_0x8386('0x48')],_0x3972f4['queue'],_0x3972f4[_0x8386('0x53')],_[_0x8386('0x7a')](_0x177f16[_0x8386('0xa2')])[0x0],_0x177f16[_0x8386('0xa3')]);_0x3972f4[_0x8386('0x15')]=this[_0x8386('0x15')][_0x177f16[_0x8386('0x48')]];}}}}catch(_0x49cbcb){logger[_0x8386('0x3d')](_0x8386('0xa0'),_0x177f16[_0x8386('0x48')],util[_0x8386('0x3f')](_0x49cbcb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0xa1')]=function(_0x3f1951,_0x7b7d86,_0x592099){var _0x1e62e5=['rtpaudioqos',_0x8386('0xaa'),_0x8386('0xab'),_0x8386('0xac'),'rtpaudioqosloss',_0x8386('0xad'),_0x8386('0xae'),'rtpaudioqosrttbridged','sipcallid',_0x8386('0xaf'),_0x8386('0xb0'),'bridgepvtcallid',_0x8386('0xb1'),_0x8386('0xb2'),_0x8386('0xb3'),_0x8386('0xb4'),'membername',_0x8386('0xb5'),_0x8386('0xb6')];if(!_[_0x8386('0x37')](_0x7b7d86)&&!_['includes'](_0x1e62e5,_0x7b7d86)){if(_['isUndefined'](this['variables'][_0x3f1951])){this[_0x8386('0x15')][_0x3f1951]={};}this['variables'][_0x3f1951][_0x7b7d86]=_0x592099;}};VoiceQueueReport[_0x8386('0xc')][_0x8386('0xb7')]=function(_0x35c25f,_0x1cc51b,_0x4a2ba3){try{var _0x4a332d={};if(this[_0x8386('0x40')][_0x35c25f]){for(var _0x6d2eed=0x0;_0x6d2eed{delete this[_0x8386('0x10')][_0x395823];},_0x265909);}};module[_0x8386('0xed')]=VoiceQueueReport; \ No newline at end of file +var _0x333d=['moment','ioredis','../../../config/environment','ami','../model/queueReport','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','voiceQueues','campaigns','variables','bind','queuemember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','channels','isNil','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','summary','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','voice:queue:%s','queue','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_channel:remove','voice_queue_presence:remove','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','Action','[voiceQueueReport][queues]','isRunning','queuesummary','then','queuestatus','actionid','createQueueSummaryReport','queues','createReport','assign','emitInboundVoiceQueueSummary','type','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','syncQueueMember','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberrealtime','includes','handleHangup','length','sumDuration','diff','total','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','transferid','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','lodash'];(function(_0x481f70,_0x5b02ca){var _0x24fcee=function(_0x49fe7c){while(--_0x49fe7c){_0x481f70['push'](_0x481f70['shift']());}};_0x24fcee(++_0x5b02ca);}(_0x333d,0xeb));var _0xd333=function(_0x487a0b,_0x33c302){_0x487a0b=_0x487a0b-0x0;var _0x4cb1ba=_0x333d[_0x487a0b];return _0x4cb1ba;};'use strict';var _=require(_0xd333('0x0'));var moment=require(_0xd333('0x1'));var util=require('util');var Redis=require(_0xd333('0x2'));var config=require(_0xd333('0x3'));var logger=require('../../../config/logger')(_0xd333('0x4'));var ami=require('../ami');var QueueReport=require(_0xd333('0x5'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0xd333('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd333('0x7'))(new Redis(config[_0xd333('0x6')]));var Sequence=function(){};Sequence[_0xd333('0x8')][_0xd333('0x9')]=function(_0x5a2d98){this[_0xd333('0xa')]=this['tail']?this['tail'][_0xd333('0xb')](_0x5a2d98):_0x5a2d98();};function VoiceQueueReport(_0x46222e){this[_0xd333('0xc')]=new Sequence();this[_0xd333('0xd')]={};this[_0xd333('0xe')]=_0x46222e;this[_0xd333('0xf')]=_0x46222e[_0xd333('0xf')];this['channels']=_0x46222e['queueChannels'];this[_0xd333('0x10')]=_0x46222e['voiceQueues'];this['campaigns']=_0x46222e[_0xd333('0x11')];this['summary']=initializeSummary();this[_0xd333('0x12')]={};ami['on']('queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xd333('0x13')](this));ami['on'](_0xd333('0x14'),this['syncQueueMember'][_0xd333('0x13')](this));ami['on'](_0xd333('0x15'),this[_0xd333('0x16')]['bind'](this));ami['on'](_0xd333('0x17'),this['syncQueueCallerJoin'][_0xd333('0x13')](this));ami['on'](_0xd333('0x18'),this[_0xd333('0x19')][_0xd333('0x13')](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave']['bind'](this));ami['on'](_0xd333('0x1a'),this[_0xd333('0x1b')][_0xd333('0x13')](this));ami['on']('agentconnect',this[_0xd333('0x1c')]['bind'](this));ami['on'](_0xd333('0x1d'),this['syncVarSet'][_0xd333('0x13')](this));ami['on'](_0xd333('0x1e'),this[_0xd333('0x1f')][_0xd333('0x13')](this));ami['on'](_0xd333('0x20'),this[_0xd333('0x21')][_0xd333('0x13')](this));ami['on'](_0xd333('0x22'),this[_0xd333('0x23')][_0xd333('0x13')](this));ami['on'](_0xd333('0x24'),this[_0xd333('0x25')]['bind'](this));ami['on'](_0xd333('0x26'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xd333('0x13')](this));this[_0xd333('0x27')]();this[_0xd333('0x28')]();}function clearChannels(_0x42ffa0){if(!_[_0xd333('0x29')](_0x42ffa0)){for(var _0x24bb08 in _0x42ffa0){if(_0x42ffa0[_0xd333('0x2a')](_0x24bb08)){delete _0x42ffa0[_0x24bb08];}}}}function clearCampaigns(_0x2a7d9f){if(!_[_0xd333('0x29')](_0x2a7d9f)){for(var _0x158d45 in _0x2a7d9f){if(_0x2a7d9f[_0xd333('0x2a')](_0x158d45)){_0x2a7d9f[_0x158d45][_0xd333('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16b024){if(!_['isEmpty'](_0x16b024)){for(var _0x2c06b7 in _0x16b024){if(_0x16b024[_0xd333('0x2a')](_0x2c06b7)){_0x16b024[_0x2c06b7]['originated']=0x0;_0x16b024[_0x2c06b7][_0xd333('0x2c')]=0x0;_0x16b024[_0x2c06b7][_0xd333('0x2d')]=0x0;_0x16b024[_0x2c06b7]['waiting']=0x0;_0x16b024[_0x2c06b7][_0xd333('0x2e')]=!![];}}}}function clearAgentBooked(_0x2158d2){if(!_[_0xd333('0x29')](_0x2158d2)){for(var _0x2411c9 in _0x2158d2){if(_0x2158d2[_0xd333('0x2a')](_0x2411c9)){_0x2158d2[_0x2411c9][_0xd333('0x2f')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x39c012){return _0x39c012[_0xd333('0x30')]||_0x39c012[_0xd333('0x18')]||_0x39c012[_0xd333('0x31')];}VoiceQueueReport[_0xd333('0x8')][_0xd333('0x32')]=function(){var _0x4dd683=this;for(var _0x46ff30 in this['channels']){if(this[_0xd333('0x33')]['hasOwnProperty'](_0x46ff30)&&!this[_0xd333('0x33')][_0x46ff30]['switch']){this[_0xd333('0xc')][_0xd333('0x9')](function(){if(!_[_0xd333('0x34')](_0x4dd683[_0xd333('0x33')][_0x46ff30])){return ami['Action']({'action':'status','channel':_0x4dd683[_0xd333('0x33')][_0x46ff30]['channel']})[_0xd333('0x35')](function(_0x4d99f4){if(_0x4d99f4[_0xd333('0x36')]===_0xd333('0x37')){setTimeout(function(){if(_0x4dd683[_0xd333('0x33')][_0x46ff30]){delete _0x4dd683[_0xd333('0x33')][_0x46ff30];logger['error'](_0xd333('0x38'),_0x46ff30,util[_0xd333('0x39')](_0x4d99f4,{'showHidden':![],'depth':null}));}if(_0x4dd683[_0xd333('0xd')][_0x46ff30]){delete _0x4dd683[_0xd333('0xd')][_0x46ff30];logger[_0xd333('0x3a')](_0xd333('0x3b'),_0x46ff30,util[_0xd333('0x39')](_0x4d99f4,{'showHidden':![],'depth':null}));}if(_0x4dd683['variables'][_0x46ff30]){delete _0x4dd683['variables'][_0x46ff30];logger[_0xd333('0x3a')](_0xd333('0x3c'),_0x46ff30,util[_0xd333('0x39')](_0x4d99f4,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xd333('0x8')]['syncFullyBooted']=function(){logger[_0xd333('0x3a')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xd333('0x33')]);this[_0xd333('0x3d')](this[_0xd333('0xd')]);clearAgentBooked(this[_0xd333('0xf')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);this[_0xd333('0x3e')]=initializeSummary();};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x3d')]=function(_0xfa795f){var _0x1946a5=this;if(!_['isEmpty'](_0xfa795f)){for(var _0x463e83 in _0xfa795f){if(_0xfa795f['hasOwnProperty'](_0x463e83)){_0x1946a5[_0xd333('0x3f')](_0xfa795f[_0x463e83],_0xd333('0x40'));delete _0xfa795f[_0x463e83];}}}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x41')]=function(_0x223e92,_0x2afe99,_0x72bab4){io['to'](_0x223e92)[_0xd333('0x41')](_0x2afe99,_0x72bab4);};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x42')]=function(_0x34e070,_0x2ec47b){logger[_0xd333('0x43')](_0xd333('0x44')+_0x2ec47b+_0xd333('0x45'),_0x34e070['uniqueid'],util[_0xd333('0x39')](_0x34e070,{'showHidden':![],'depth':null}));this[_0xd333('0x41')](util['format'](_0xd333('0x46'),_0x34e070[_0xd333('0x47')]),'voice_queue_channel:save',_0x34e070);io['emit']('voice_queue_presence:save',_0x34e070);};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x3f')]=function(_0x560994,_0x38bb4c){logger[_0xd333('0x43')](_0xd333('0x44')+_0x38bb4c+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x560994[_0xd333('0x48')],util[_0xd333('0x39')](_0x560994,{'showHidden':![],'depth':null}));if(_0x560994[_0xd333('0x49')]===_0xd333('0x4a')){return;}this[_0xd333('0x41')](util[_0xd333('0x4b')](_0xd333('0x46'),_0x560994[_0xd333('0x47')]),_0xd333('0x4c'),_0x560994);io[_0xd333('0x41')](_0xd333('0x4d'),_0x560994);};VoiceQueueReport[_0xd333('0x8')]['emitInboundVoiceQueueSummary']=function(_0x3ef3ad){if(_0x3ef3ad['type']===_0xd333('0x4e')){logger[_0xd333('0x43')](_0xd333('0x4f'),util['inspect'](_0x3ef3ad,{'showHidden':![],'depth':null}));this[_0xd333('0x41')](util[_0xd333('0x4b')]('voice:queue:%s',_0x3ef3ad[_0xd333('0x50')]),_0xd333('0x51'),_0x3ef3ad);}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x52')]=function(_0x21c534){return _0x21c534!==null&&!_['isUndefined'](_0x21c534);};VoiceQueueReport[_0xd333('0x8')]['loopQueueShow']=function(){var _0x2cfa5a=this;setInterval(function(){_0x2cfa5a[_0xd333('0x32')]();ami[_0xd333('0x53')]({'action':'queues'})[_0xd333('0x35')](function(_0x329efc){logger['error'](_0xd333('0x54'),util[_0xd333('0x39')](_0x329efc,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x27')]=function(){var _0x2cebe0=this;setInterval(function(){if(!_0x2cebe0[_0xd333('0x3e')][_0xd333('0x55')]){return ami[_0xd333('0x53')]({'action':_0xd333('0x56')})[_0xd333('0x57')](function(_0x55b158){_0x2cebe0[_0xd333('0x3e')]['id']=_0x55b158['actionid'];_0x2cebe0[_0xd333('0x3e')][_0xd333('0x55')]=!![];_0x2cebe0['summary'][_0xd333('0x58')][_0x55b158[_0xd333('0x59')]]={};})[_0xd333('0x35')](function(_0x1e8ebd){logger['error']('[voiceQueueReport][queuesummary]',util[_0xd333('0x39')](_0x1e8ebd,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x5a')]=function(_0x26277d,_0x226a1a){var _0x5f3d72;if(this[_0xd333('0x3e')]&&this['summary'][_0xd333('0x5b')]&&this['summary']['queues'][_0x26277d[_0xd333('0x50')]]){_0x5f3d72=this['summary']['queues'][_0x26277d[_0xd333('0x50')]]['summaryEvent'];}var _0x1a66d3=new VoiceQueueSummary(_0x26277d);return _0x1a66d3[_0xd333('0x5c')](_0x226a1a[_0xd333('0xf')],this[_0xd333('0xf')],_0x5f3d72,this['realtime'][_0xd333('0x33')]);};VoiceQueueReport[_0xd333('0x8')]['handleInboundQueueSummaryReport']=function(_0x24fb8b,_0x6bd552){var _0x21acae=this[_0xd333('0x5a')](_0x24fb8b,_0x6bd552);var _0x35f4dc=![];_0x35f4dc=_0x21acae['compareToInboundQueue'](_0x24fb8b);if(_0x35f4dc){Object[_0xd333('0x5d')](_0x24fb8b,_0x21acae);this[_0xd333('0xe')]['voiceQueues'][_0x24fb8b[_0xd333('0x50')]]=_0x24fb8b;this[_0xd333('0x5e')](_0x21acae);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x39389c){var _0x56796a=null;var _0x320086=this[_0xd333('0x3e')]['id'];if(this[_0xd333('0x3e')][_0xd333('0x58')][_0x320086]){_0x56796a=this[_0xd333('0x3e')][_0xd333('0x58')][_0x320086][_0x39389c[_0xd333('0x59')]];}if(!_0x56796a){this[_0xd333('0x3e')]=initializeSummary();return;}var _0x175a1a=this[_0xd333('0x10')][_0x56796a[_0xd333('0x47')]];if(_0x175a1a[_0xd333('0x5f')]===_0xd333('0x4e')){this[_0xd333('0x60')](_0x175a1a,_0x56796a);}else if(_0x175a1a[_0xd333('0x5f')]===_0xd333('0x61')){var _0x440bef=this[_0xd333('0x5a')](_0x175a1a,_0x56796a);ami[_0xd333('0x41')](_0xd333('0x62'),_0x440bef);}this[_0xd333('0x3e')][_0xd333('0x63')]-=0x1;var _0xcdf0ef=this[_0xd333('0x3e')][_0xd333('0x63')]>0x0?!![]:![];if(!_0xcdf0ef){return this[_0xd333('0x64')](this['summary'][_0xd333('0x65')]);}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x66')]=function(_0x2c39cc){var _0x451e42=this[_0xd333('0x3e')]['id'];if(this[_0xd333('0x3e')]['queuestatus'][_0x451e42]&&this[_0xd333('0x3e')]['queuestatus'][_0x451e42][_0x2c39cc[_0xd333('0x59')]]){this[_0xd333('0x3e')][_0xd333('0x58')][_0x451e42][_0x2c39cc[_0xd333('0x59')]]['agents'][_0xd333('0x67')](_0x2c39cc);}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x68')]=function(_0x5347e7){var _0x3b3ba6=this;try{if(this[_0xd333('0x52')](_0x5347e7)&&this[_0xd333('0x52')](_0x5347e7['queue'])){logger['debug'](_0xd333('0x69'),util['inspect'](_0x5347e7,{'showHidden':![],'depth':null}));var _0x496e2c=this[_0xd333('0x10')][_0x5347e7[_0xd333('0x47')]];if(_0x496e2c){logger[_0xd333('0x43')](_0xd333('0x6a'),_0x496e2c[_0xd333('0x50')]);this[_0xd333('0x3e')]['queues'][_0x496e2c[_0xd333('0x50')]]={'summaryEvent':_0x5347e7};this[_0xd333('0x3e')][_0xd333('0x63')]+=0x1;return ami[_0xd333('0x53')]({'action':_0xd333('0x58'),'queue':_0x496e2c[_0xd333('0x50')]})[_0xd333('0x57')](function(_0x1e2792){if(!_0x3b3ba6['summary'][_0xd333('0x58')][_0x5347e7['actionid']]){_0x3b3ba6[_0xd333('0x3e')][_0xd333('0x58')][_0x5347e7['actionid']]={};}_0x3b3ba6[_0xd333('0x3e')][_0xd333('0x58')][_0x5347e7['actionid']][_0x1e2792['actionid']]={'queue':_0x496e2c[_0xd333('0x50')],'agents':[]};})[_0xd333('0x35')](function(_0x2e6504){throw _0x2e6504;});}}}catch(_0x1d478e){logger[_0xd333('0x3a')](_0xd333('0x6b'),util['inspect'](_0x1d478e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x64')]=function(_0x28a15d){if(this[_0xd333('0x3e')][_0xd333('0x63')]>0x0){this[_0xd333('0x3e')][_0xd333('0x65')]=_0x28a15d;return;}logger[_0xd333('0x43')](_0xd333('0x6c'),util[_0xd333('0x39')](_0x28a15d,{'showHidden':![],'depth':null}));this[_0xd333('0x3e')]=initializeSummary();ami['emit'](_0xd333('0x6d'),{});};VoiceQueueReport['prototype'][_0xd333('0x6e')]=function(_0x487c2c){try{if(this[_0xd333('0x52')](_0x487c2c)){logger[_0xd333('0x43')](_0xd333('0x6f'),_0x487c2c['uniqueid'],util[_0xd333('0x39')](_0x487c2c,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xd333('0xd')][_0x487c2c[_0xd333('0x48')]])){this['queueReports'][_0x487c2c[_0xd333('0x48')]]=[];}if(_[_0xd333('0x70')](this[_0xd333('0x33')][_0x487c2c['uniqueid']])){this[_0xd333('0x33')][_0x487c2c['uniqueid']]={};}var _0xe15812=new QueueReport();_0xe15812['queue']=_0x487c2c[_0xd333('0x47')];_0xe15812['type']=this[_0xd333('0x10')][_0xe15812[_0xd333('0x47')]]&&this[_0xd333('0x10')][_0xe15812['queue']][_0xd333('0x5f')]?this[_0xd333('0x10')][_0xe15812[_0xd333('0x47')]][_0xd333('0x5f')]||_0xd333('0x4e'):_0xd333('0x4e');_0xe15812[_0xd333('0x71')]=moment()[_0xd333('0x4b')](_0xd333('0x72'));_0xe15812[_0xd333('0x73')]=_0x487c2c[_0xd333('0x73')];_0xe15812[_0xd333('0x74')]=_0x487c2c['count'];_0xe15812[_0xd333('0x48')]=_0x487c2c[_0xd333('0x48')];logger['info'](_0xd333('0x75'),_0xe15812['queue'],_0xe15812[_0xd333('0x5f')]);Object['assign'](_0xe15812,_['pick'](_0x487c2c,_['keys'](_0xe15812)));this[_0xd333('0xd')][_0x487c2c[_0xd333('0x48')]][_0xd333('0x67')](_0xe15812);this[_0xd333('0x33')][_0x487c2c[_0xd333('0x48')]]=_0xe15812;this[_0xd333('0x42')](_0xe15812,_0xd333('0x17'));}}catch(_0x21beb0){logger[_0xd333('0x3a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x487c2c[_0xd333('0x48')],util['inspect'](_0x21beb0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd333('0x8')]['syncQueueCallerAbandon']=function(_0x53e707){try{if(this[_0xd333('0x52')](_0x53e707)){logger[_0xd333('0x43')](_0xd333('0x76'),_0x53e707[_0xd333('0x48')],util[_0xd333('0x39')](_0x53e707,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x53e707['uniqueid']]){var _0x1408aa=_[_0xd333('0x77')](this[_0xd333('0xd')][_0x53e707[_0xd333('0x48')]]);_0x1408aa[_0xd333('0x31')]=![];_0x1408aa[_0xd333('0x78')]=null;_0x1408aa['holdtime']=_0x53e707[_0xd333('0x79')];_0x1408aa[_0xd333('0x7a')]=_0x53e707[_0xd333('0x7a')];_0x1408aa[_0xd333('0x18')]=!![];_0x1408aa[_0xd333('0x7b')]=moment()[_0xd333('0x4b')](_0xd333('0x72'));_0x1408aa[_0xd333('0x49')]=_0xd333('0x7c');_0x1408aa[_0xd333('0x7d')]=null;logger[_0xd333('0x7e')](_0xd333('0x7f'),_0x1408aa[_0xd333('0x47')],_0x1408aa[_0xd333('0x5f')]);this['channels'][_0x53e707[_0xd333('0x48')]]=_0x1408aa;this[_0xd333('0x3f')](_0x1408aa,_0xd333('0x18'));}}}catch(_0x3d0c3d){logger[_0xd333('0x3a')](_0xd333('0x76'),_0x53e707[_0xd333('0x48')],util[_0xd333('0x39')](_0x3d0c3d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd333('0x80')]=function(_0x263063){try{if(this[_0xd333('0x52')](_0x263063)){logger[_0xd333('0x43')](_0xd333('0x81'),_0x263063['uniqueid'],util[_0xd333('0x39')](_0x263063,{'showHidden':![],'depth':null}));if(this[_0xd333('0xd')][_0x263063[_0xd333('0x48')]]){var _0x54c28c=_['last'](this[_0xd333('0xd')][_0x263063['uniqueid']]);_0x54c28c['queuecallerleaveAt']=moment()[_0xd333('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x54c28c[_0xd333('0x82')]=_0x263063[_0xd333('0x82')];_0x54c28c[_0xd333('0x83')]=_0x263063['connectedlinename'];logger[_0xd333('0x7e')](_0xd333('0x84'),_0x54c28c[_0xd333('0x47')],_0x54c28c[_0xd333('0x5f')],_0x263063[_0xd333('0x82')],_0x263063[_0xd333('0x83')]);this[_0xd333('0x33')][_0x263063[_0xd333('0x48')]]=_0x54c28c;this['emitVoiceQueueChannelSave'](_0x54c28c,_0xd333('0x85'));}}}catch(_0x110406){logger[_0xd333('0x3a')](_0xd333('0x81'),_0x263063['uniqueid'],util['inspect'](_0x110406,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd333('0x1c')]=function(_0x5eb73d){try{if(this[_0xd333('0x52')](_0x5eb73d)){logger['debug'](_0xd333('0x86'),_0x5eb73d[_0xd333('0x48')],util['inspect'](_0x5eb73d,{'showHidden':![],'depth':null}));if(this[_0xd333('0xd')][_0x5eb73d[_0xd333('0x48')]]){var _0x1654a7=_[_0xd333('0x77')](this[_0xd333('0xd')][_0x5eb73d[_0xd333('0x48')]]);_0x1654a7[_0xd333('0x31')]=!![];_0x1654a7[_0xd333('0x49')]=_0xd333('0x87');logger[_0xd333('0x7e')](_0xd333('0x88'),_0x1654a7[_0xd333('0x47')],_0x1654a7[_0xd333('0x5f')]);}}}catch(_0x12d2fd){logger['error'](_0xd333('0x86'),_0x5eb73d[_0xd333('0x48')],util[_0xd333('0x39')](_0x12d2fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd333('0x1b')]=function(_0xb05a8d){try{if(this[_0xd333('0x52')](_0xb05a8d)){logger[_0xd333('0x43')](_0xd333('0x89'),_0xb05a8d[_0xd333('0x48')],util[_0xd333('0x39')](_0xb05a8d,{'showHidden':![],'depth':null}));if(this[_0xd333('0xd')][_0xb05a8d['uniqueid']]){var _0x5d138c=_[_0xd333('0x77')](this['queueReports'][_0xb05a8d['uniqueid']]);_0x5d138c[_0xd333('0x18')]=![];_0x5d138c[_0xd333('0x7b')]=null;_0x5d138c['assigned']=!![];_0x5d138c[_0xd333('0x7d')]=_0xb05a8d['membername'];_0x5d138c[_0xd333('0x79')]=_0xb05a8d[_0xd333('0x79')];_0x5d138c[_0xd333('0x31')]=!![];_0x5d138c['queuecallerexit']=![];_0x5d138c[_0xd333('0x8a')]=null;if(!_0x5d138c[_0xd333('0x8b')]){if(_0xb05a8d[_0xd333('0x8c')]==_0xd333('0x8b')){_0x5d138c[_0xd333('0x49')]='COMPLETED';logger[_0xd333('0x7e')](_0xd333('0x8d'),_0x5d138c[_0xd333('0x47')],_0x5d138c[_0xd333('0x5f')]);}else{if(_[_0xd333('0x8e')](_0xb05a8d[_0xd333('0x8f')][_0xd333('0x90')](),_0xd333('0x91'))){if(this[_0xd333('0xd')][_0xb05a8d['linkedid']]){var _0x1a5e7c=_[_0xd333('0x77')](this['queueReports'][_0xb05a8d[_0xd333('0x92')]]);_0x1a5e7c[_0xd333('0x31')]=![];_0x1a5e7c['queuecallerexit']=!![];_0x1a5e7c[_0xd333('0x8a')]=moment(_0x5d138c[_0xd333('0x71')])['add'](_0xb05a8d[_0xd333('0x79')],_0xd333('0x93'))['format'](_0xd333('0x72'));_0x1a5e7c['queuecallerexitreason']='FORWARDTRANSFER';_0x1a5e7c[_0xd333('0x8b')]=!![];_0x1a5e7c[_0xd333('0x94')]=_0xd333('0x95');_0x1a5e7c[_0xd333('0x96')]=_0xb05a8d[_0xd333('0x97')];_0x1a5e7c[_0xd333('0x98')]=_0xb05a8d[_0xd333('0x48')];logger[_0xd333('0x7e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1a5e7c[_0xd333('0x47')],_0x1a5e7c['type']);var _0x38355e=this['queueReports'][_0xb05a8d[_0xd333('0x92')]];this[_0xd333('0xd')][_0xb05a8d[_0xd333('0x92')]]=this[_0xd333('0xd')][_0xb05a8d[_0xd333('0x48')]];this[_0xd333('0xd')][_0xb05a8d['uniqueid']]=_0x38355e;}}else{_0x5d138c['queuecallerexitreason']='COMPLETEDBY'+_0xb05a8d['reason'][_0xd333('0x99')]();logger[_0xd333('0x7e')](_0xd333('0x9a'),_0x5d138c[_0xd333('0x47')],_0x5d138c['type'],_0x5d138c[_0xd333('0x49')]);}}}this['channels'][_0xb05a8d[_0xd333('0x48')]]=_0x5d138c;}}}catch(_0x3f3878){logger[_0xd333('0x3a')](_0xd333('0x89'),_0xb05a8d[_0xd333('0x48')],util[_0xd333('0x39')](_0x3f3878,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x9b')]=function(_0xa9c15d){try{if(this[_0xd333('0x52')](_0xa9c15d)){logger[_0xd333('0x43')](_0xd333('0x9c'),_0xa9c15d[_0xd333('0x48')],util['inspect'](_0xa9c15d,{'showHidden':![],'depth':null}));this[_0xd333('0x9d')](_0xa9c15d[_0xd333('0x48')],_['keys'](_0xa9c15d[_0xd333('0x9e')])[0x0],_0xa9c15d[_0xd333('0x9f')]);if(this[_0xd333('0xd')][_0xa9c15d[_0xd333('0x48')]]){var _0x34b576=_[_0xd333('0x77')](this[_0xd333('0xd')][_0xa9c15d[_0xd333('0x48')]]);if(_0x34b576){if(this[_0xd333('0x52')](_0xa9c15d['variable'])&&this[_0xd333('0x52')](_0xa9c15d[_0xd333('0x9e')][_0xd333('0x58')])){switch(_0xa9c15d[_0xd333('0x9f')]){case _0xd333('0xa0'):_0x34b576[_0xd333('0x30')]=![];_0x34b576[_0xd333('0x8a')]=null;break;case'TIMEOUT':_0x34b576[_0xd333('0xa1')]=_0xd333('0xa2');_0x34b576[_0xd333('0x30')]=!![];_0x34b576[_0xd333('0x8a')]=moment()['format'](_0xd333('0x72'));_0x34b576[_0xd333('0xa3')]=moment()[_0xd333('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd333('0x43')](_0xd333('0xa4'),_0xa9c15d['uniqueid'],util['inspect'](_0x34b576,{'showHidden':![],'depth':null}));ami[_0xd333('0x41')](_0xd333('0xa5'),_0x34b576);break;default:_0x34b576[_0xd333('0x30')]=!![];_0x34b576[_0xd333('0x8a')]=moment()[_0xd333('0x4b')](_0xd333('0x72'));_0x34b576[_0xd333('0xa3')]=moment()[_0xd333('0x4b')](_0xd333('0x72'));}_0x34b576['queuecallerabandon']=![];_0x34b576[_0xd333('0x7b')]=null;_0x34b576[_0xd333('0x49')]=_0xa9c15d[_0xd333('0x9f')];this[_0xd333('0x33')][_0xa9c15d[_0xd333('0x48')]]=_0x34b576;this['emitVoiceQueueChannelRemove'](_0x34b576,_0xd333('0x1d'));}else if(this[_0xd333('0x52')](_0xa9c15d[_0xd333('0x9e')])&&this['isNotNull'](_0xa9c15d[_0xd333('0x9e')][_0xd333('0xa6')])){if(!_0x34b576[_0xd333('0x18')]){_0x34b576[_0xd333('0x30')]=!![];_0x34b576[_0xd333('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x34b576['queuecallerexitreason']=_0xd333('0xa7');_0x34b576['queuecallerleaveAt']=moment()['format'](_0xd333('0x72'));this[_0xd333('0x33')][_0xa9c15d[_0xd333('0x48')]]=_0x34b576;}}logger[_0xd333('0x7e')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0xa9c15d['uniqueid'],_0x34b576[_0xd333('0x47')],_0x34b576[_0xd333('0x5f')],_[_0xd333('0xa8')](_0xa9c15d[_0xd333('0x9e')])[0x0],_0xa9c15d[_0xd333('0x9f')]);_0x34b576[_0xd333('0x12')]=this[_0xd333('0x12')][_0xa9c15d[_0xd333('0x48')]];}}}}catch(_0x280cf2){logger[_0xd333('0x3a')](_0xd333('0x9c'),_0xa9c15d[_0xd333('0x48')],util[_0xd333('0x39')](_0x280cf2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0x9d')]=function(_0x37e7d3,_0x27d2e2,_0x5a27c4){var _0x4601d5=[_0xd333('0xa9'),_0xd333('0xaa'),_0xd333('0xab'),_0xd333('0xac'),'rtpaudioqosloss',_0xd333('0xad'),_0xd333('0xae'),_0xd333('0xaf'),_0xd333('0xb0'),_0xd333('0xb1'),_0xd333('0xb2'),_0xd333('0xb3'),_0xd333('0xb4'),_0xd333('0xb5'),'memberinterface',_0xd333('0xb6'),_0xd333('0xb7'),'memberpenalty',_0xd333('0xb8')];if(!_['isNil'](_0x27d2e2)&&!_[_0xd333('0xb9')](_0x4601d5,_0x27d2e2)){if(_[_0xd333('0x70')](this[_0xd333('0x12')][_0x37e7d3])){this[_0xd333('0x12')][_0x37e7d3]={};}this['variables'][_0x37e7d3][_0x27d2e2]=_0x5a27c4;}};VoiceQueueReport[_0xd333('0x8')][_0xd333('0xba')]=function(_0x1734fb,_0x2a3609,_0x1b2243){try{var _0x24bdf4={};if(this[_0xd333('0xd')][_0x1734fb]){for(var _0x546d93=0x0;_0x546d93{delete this['channels'][_0x44be94];},_0x192809);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 517df43..185a16d 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 _0x2e05=['Request','CreateReportAgentPreview','../client','createHistory','campaign','queue'];(function(_0xc15e30,_0x231639){var _0x5a2d88=function(_0x36893e){while(--_0x36893e){_0xc15e30['push'](_0xc15e30['shift']());}};_0x5a2d88(++_0x231639);}(_0x2e05,0x128));var _0x52e0=function(_0x5e5ecb,_0x2b519b){_0x5e5ecb=_0x5e5ecb-0x0;var _0x322b22=_0x2e05[_0x5e5ecb];return _0x322b22;};'use strict';var client=require(_0x52e0('0x0'));exports[_0x52e0('0x1')]=function(_0x1a4777){return function(){_0x1a4777[_0x52e0('0x2')]=_0x1a4777[_0x52e0('0x3')];return client[_0x52e0('0x4')](_0x52e0('0x5'),{'body':_0x1a4777,'log':_0x52e0('0x5')});};}; \ No newline at end of file +var _0x163e=['campaign','queue','CreateReportAgentPreview','../client','createHistory'];(function(_0x56a217,_0xc188a4){var _0x3bbd0a=function(_0x47cbdf){while(--_0x47cbdf){_0x56a217['push'](_0x56a217['shift']());}};_0x3bbd0a(++_0xc188a4);}(_0x163e,0x11b));var _0xe163=function(_0x179314,_0x32d3a2){_0x179314=_0x179314-0x0;var _0x3556f7=_0x163e[_0x179314];return _0x3556f7;};'use strict';var client=require(_0xe163('0x0'));exports[_0xe163('0x1')]=function(_0x58b5b9){return function(){_0x58b5b9[_0xe163('0x2')]=_0x58b5b9[_0xe163('0x3')];return client['Request']('CreateReportAgentPreview',{'body':_0x58b5b9,'log':_0xe163('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 4c97901..45aa9f5 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 _0x4f2f=['CreateAttachment','Request'];(function(_0x4da15a,_0x226d9d){var _0x314e82=function(_0x5d7e2a){while(--_0x5d7e2a){_0x4da15a['push'](_0x4da15a['shift']());}};_0x314e82(++_0x226d9d);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4f2f[_0x4cf98e];return _0x1623ac;};'use strict';var client=require('../client');exports['create']=function(_0x21c4bf){return client[_0xf4f2('0x0')]('CreateAttachment',{'body':_0x21c4bf,'log':_0xf4f2('0x1')});}; \ No newline at end of file +var _0xd555=['CreateAttachment','create'];(function(_0x498035,_0x4ab1d0){var _0x260326=function(_0x1da7fd){while(--_0x1da7fd){_0x498035['push'](_0x498035['shift']());}};_0x260326(++_0x4ab1d0);}(_0xd555,0xef));var _0x5d55=function(_0x2cb1df,_0x4b439c){_0x2cb1df=_0x2cb1df-0x0;var _0x30e674=_0xd555[_0x2cb1df];return _0x30e674;};'use strict';var client=require('../client');exports[_0x5d55('0x0')]=function(_0x3a9d21){return client['Request']('CreateAttachment',{'body':_0x3a9d21,'log':_0x5d55('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index db8b9ef..fbb8ce4 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x480e90,_0x512741){var _0x4b6e6d=function(_0x5ccef0){while(--_0x5ccef0){_0x480e90['push'](_0x480e90['shift']());}};_0x4b6e6d(++_0x512741);}(_0x326f,0xd1));var _0xf326=function(_0x4ba6ce,_0x404cc4){_0x4ba6ce=_0x4ba6ce-0x0;var _0x42377e=_0x326f[_0x4ba6ce];return _0x42377e;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0xa71985,_0x1aeaba){var _0x419751=function(_0x324911){while(--_0x324911){_0xa71985['push'](_0xa71985['shift']());}};_0x419751(++_0x1aeaba);}(_0x1261,0x144));var _0x1126=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0x1261[_0x4d3187];return _0x107906;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index a7c4aed..b46f56b 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 _0x6d2a=['createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x3d4878,_0x4b8078){var _0x18f481=function(_0x42be43){while(--_0x42be43){_0x3d4878['push'](_0x3d4878['shift']());}};_0x18f481(++_0x4b8078);}(_0x6d2a,0x136));var _0xa6d2=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0x6d2a[_0x4e28c0];return _0x4039d4;};'use strict';var client=require('../client');exports[_0xa6d2('0x0')]=function(_0x3226d5){return function(){return client[_0xa6d2('0x1')]('CreateCmContact',{'body':_0x3226d5,'log':_0xa6d2('0x2')});};};exports[_0xa6d2('0x3')]=function(_0x1a89b2){return function(){return client[_0xa6d2('0x1')](_0xa6d2('0x4'),{'options':_0x1a89b2,'log':_0xa6d2('0x4')});};}; \ No newline at end of file +var _0xa94b=['CreateCmContact','getContacts','Request'];(function(_0x33990e,_0x27b1f4){var _0x366423=function(_0x488cf4){while(--_0x488cf4){_0x33990e['push'](_0x33990e['shift']());}};_0x366423(++_0x27b1f4);}(_0xa94b,0x101));var _0xba94=function(_0x47fe9a,_0x7d65d5){_0x47fe9a=_0x47fe9a-0x0;var _0x247cf3=_0xa94b[_0x47fe9a];return _0x247cf3;};'use strict';var client=require('../client');exports['createContact']=function(_0x2c956f){return function(){return client[_0xba94('0x0')](_0xba94('0x1'),{'body':_0x2c956f,'log':_0xba94('0x1')});};};exports[_0xba94('0x2')]=function(_0x1d59fe){return function(){return client[_0xba94('0x0')]('GetCmContact',{'options':_0x1d59fe,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index ba9fe3f..a91c961 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 _0x8a28=['format','Contact','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','CampaignId','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','getCmHopper','updateContacts','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr'];(function(_0x4b043b,_0x598b17){var _0x398f5a=function(_0x59bea2){while(--_0x59bea2){_0x4b043b['push'](_0x4b043b['shift']());}};_0x398f5a(++_0x598b17);}(_0x8a28,0xfd));var _0x88a2=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x8a28[_0x4ae625];return _0x31accf;};'use strict';var client=require(_0x88a2('0x0'));var moment=require(_0x88a2('0x1'));exports[_0x88a2('0x2')]=function(_0x3c2c72,_0x27b1c1){return function(){return client[_0x88a2('0x3')](_0x88a2('0x4'),{'options':{'where':{'VoiceQueueId':_0x3c2c72},'include':[{'model':_0x88a2('0x5'),'as':'Contact'}],'limit':_0x27b1c1,'raw':![]},'log':_0x88a2('0x6')});};};exports[_0x88a2('0x7')]=function(_0x3c3392,_0x438e32,_0x29ce92){return function(){return client['Request'](_0x88a2('0x8'),{'body':_0x3c3392,'options':{'where':{'VoiceQueueId':_0x438e32,'scheduledat':{'$lte':moment()['format'](_0x88a2('0x9'))}},'limit':_0x29ce92},'log':_0x88a2('0x8')});};};exports[_0x88a2('0xa')]=function(_0xdbb322){return client[_0x88a2('0x3')](_0x88a2('0x8'),{'body':_0xdbb322,'options':{'where':{'ContactId':_0xdbb322[_0x88a2('0xb')],'ListId':_0xdbb322[_0x88a2('0xc')],'VoiceQueueId':_0xdbb322[_0x88a2('0xd')],'CampaignId':_0xdbb322['CampaignId']}},'log':'rescheduleContact'});};exports[_0x88a2('0xe')]=function(_0x430931,_0x14559e,_0xae0676){return function(){return client[_0x88a2('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x430931,'ListId':_0x14559e,'ContactId':_0xae0676}},'log':_0x88a2('0xf')});};};exports[_0x88a2('0x10')]=function(_0x367a7d,_0x21b05a,_0x5093c0,_0x923706){return client[_0x88a2('0x3')](_0x88a2('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x367a7d,'active':![],'scheduledat':{'$lte':moment()['format'](_0x88a2('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x21b05a}}]},'order':[[_0x88a2('0x12'),_0x88a2('0x13')],[_0x88a2('0x14'),_0x923706],['id',_0x88a2('0x15')]],'raw':!![],'limit':_0x5093c0},'log':_0x88a2('0x11')});};exports[_0x88a2('0x16')]=function(_0x2f5220,_0x2890d8,_0x417bf8){return client[_0x88a2('0x3')](_0x88a2('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x2f5220,'active':![],'scheduledat':{'$lte':moment()[_0x88a2('0x17')](_0x88a2('0x9'))}},'include':[{'model':_0x88a2('0x5'),'as':_0x88a2('0x18')}],'order':[[_0x88a2('0x12'),_0x88a2('0x13')],['scheduledat',_0x417bf8],['id',_0x88a2('0x15')]],'raw':!![],'limit':_0x2890d8},'log':_0x88a2('0x19')});};exports['moveContactManagedDialer']=function(_0x499891,_0x7a054c){_0x499891[_0x88a2('0x1a')]=_0x499891[_0x88a2('0x1b')];return client[_0x88a2('0x3')](_0x88a2('0x1c'),{'body':_0x499891,'options':{'where':{'ContactId':_0x499891['ContactId'],'ListId':_0x499891[_0x88a2('0xc')],'VoiceQueueId':_0x499891[_0x88a2('0xd')],'CampaignId':_0x499891[_0x88a2('0x1d')],'active':_0x7a054c?undefined:!![]}},'log':_0x88a2('0x1c')});};exports['countReScheduled']=function(_0x1f104c){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x1f104c['id']?_0x1f104c['id']||null:null}},'log':_0x88a2('0x1e')});};exports[_0x88a2('0x1f')]=function(_0x4ec713){return function(){return client['Request'](_0x88a2('0x20'),{'options':{'where':{'id':_0x4ec713},'include':[{'model':_0x88a2('0x5'),'as':'Contact'},{'model':_0x88a2('0x21'),'as':_0x88a2('0x22'),'attributes':['id',_0x88a2('0x23')]},{'model':_0x88a2('0x24'),'as':'Queue','attributes':['id',_0x88a2('0x23')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x88a2('0x25')]=function(_0x3d9e8a,_0x39249a,_0x4bb833){return client[_0x88a2('0x3')](_0x88a2('0x8'),{'body':_0x3d9e8a,'options':{'where':{'id':_0x39249a},'limit':_0x4bb833},'log':'UpdateCmHopper'});};exports[_0x88a2('0x26')]=function(_0x537a8f,_0x541cd0){return function(){return client['Request'](_0x88a2('0x27'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x537a8f,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x88a2('0x17')](_0x88a2('0x9'))},'UserId':{'$in':_0x541cd0}},'order':[[_0x88a2('0x12'),_0x88a2('0x13')],[_0x88a2('0x14'),'DESC'],['id',_0x88a2('0x15')]],'include':[{'model':_0x88a2('0x5'),'as':_0x88a2('0x18')},{'model':_0x88a2('0x21'),'as':_0x88a2('0x22'),'attributes':['id',_0x88a2('0x23'),_0x88a2('0x28')]}],'group':_0x88a2('0x29'),'raw':!![]},'log':_0x88a2('0x11')});};};exports[_0x88a2('0x2a')]=function(_0x4db7b1,_0x5afbce){return client[_0x88a2('0x3')](_0x88a2('0x2b'),{'body':_0x4db7b1,'options':_0x5afbce||{},'log':_0x88a2('0x2b')});};exports['handlePreviewRecallNotifications']=function(_0x3ea9d0,_0x12acdf,_0x57dc2f){return function(){return client[_0x88a2('0x3')](_0x88a2('0x2c'),{'body':{'where':{'voiceQueueIds':_0x3ea9d0,'interval':_0x12acdf,'availableAgentsIds':_0x57dc2f}},'log':_0x88a2('0x2d')});};}; \ No newline at end of file +var _0xf494=['DESC','getContactDialerIvr','scheduledat','ASC','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','User','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','format','Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','priority'];(function(_0x2a07b5,_0xe4ca2d){var _0x57fe14=function(_0x4af366){while(--_0x4af366){_0x2a07b5['push'](_0x2a07b5['shift']());}};_0x57fe14(++_0xe4ca2d);}(_0xf494,0x1c6));var _0x4f49=function(_0x91d178,_0x4824a0){_0x91d178=_0x91d178-0x0;var _0x55f637=_0xf494[_0x91d178];return _0x55f637;};'use strict';var client=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));exports[_0x4f49('0x2')]=function(_0x52d22c,_0x3aeeb8){return function(){return client[_0x4f49('0x3')](_0x4f49('0x4'),{'options':{'where':{'VoiceQueueId':_0x52d22c},'include':[{'model':_0x4f49('0x5'),'as':_0x4f49('0x6')}],'limit':_0x3aeeb8,'raw':![]},'log':_0x4f49('0x7')});};};exports[_0x4f49('0x8')]=function(_0x790e8b,_0xc5e778,_0x413530){return function(){return client[_0x4f49('0x3')]('UpdateCmHopper',{'body':_0x790e8b,'options':{'where':{'VoiceQueueId':_0xc5e778,'scheduledat':{'$lte':moment()['format'](_0x4f49('0x9'))}},'limit':_0x413530},'log':_0x4f49('0xa')});};};exports[_0x4f49('0xb')]=function(_0x30ca57){return client[_0x4f49('0x3')](_0x4f49('0xa'),{'body':_0x30ca57,'options':{'where':{'ContactId':_0x30ca57[_0x4f49('0xc')],'ListId':_0x30ca57[_0x4f49('0xd')],'VoiceQueueId':_0x30ca57['VoiceQueueId'],'CampaignId':_0x30ca57[_0x4f49('0xe')]}},'log':_0x4f49('0xb')});};exports['destroyContact']=function(_0x15e7a1,_0x5bbc75,_0x496293){return function(){return client[_0x4f49('0x3')](_0x4f49('0xf'),{'options':{'where':{'VoiceQueueId':_0x15e7a1,'ListId':_0x5bbc75,'ContactId':_0x496293}},'log':'DestroyCmHopper'});};};exports[_0x4f49('0x10')]=function(_0x111a8b,_0x1b9145,_0x2efe49,_0x1a0f1e){return client[_0x4f49('0x3')](_0x4f49('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x111a8b,'active':![],'scheduledat':{'$lte':moment()['format'](_0x4f49('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x1b9145}}]},'order':[[_0x4f49('0x12'),_0x4f49('0x13')],['scheduledat',_0x1a0f1e],['id','ASC']],'raw':!![],'limit':_0x2efe49},'log':_0x4f49('0x11')});};exports[_0x4f49('0x14')]=function(_0x74886e,_0x5cb79c,_0x1dccfd){return client[_0x4f49('0x3')](_0x4f49('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x74886e,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':'CmContact','as':'Contact'}],'order':[[_0x4f49('0x12'),_0x4f49('0x13')],[_0x4f49('0x15'),_0x1dccfd],['id',_0x4f49('0x16')]],'raw':!![],'limit':_0x5cb79c},'log':'GetContactDialerIvr'});};exports[_0x4f49('0x17')]=function(_0x2aed27,_0x197a49){_0x2aed27[_0x4f49('0x18')]=_0x2aed27[_0x4f49('0x19')];return client['Request'](_0x4f49('0x1a'),{'body':_0x2aed27,'options':{'where':{'ContactId':_0x2aed27[_0x4f49('0xc')],'ListId':_0x2aed27[_0x4f49('0xd')],'VoiceQueueId':_0x2aed27['VoiceQueueId'],'CampaignId':_0x2aed27[_0x4f49('0xe')],'active':_0x197a49?undefined:!![]}},'log':_0x4f49('0x1a')});};exports[_0x4f49('0x1b')]=function(_0x43c458){return client[_0x4f49('0x3')](_0x4f49('0x1c'),{'options':{'where':{'VoiceQueueId':_0x43c458['id']?_0x43c458['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x3a947b){return function(){return client[_0x4f49('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x3a947b},'include':[{'model':_0x4f49('0x5'),'as':_0x4f49('0x6')},{'model':_0x4f49('0x1d'),'as':'Agent','attributes':['id',_0x4f49('0x1e')]},{'model':_0x4f49('0x1f'),'as':_0x4f49('0x20'),'attributes':['id',_0x4f49('0x1e')]}],'raw':!![]},'log':_0x4f49('0x7')});};};exports[_0x4f49('0x21')]=function(_0x4915af,_0x50c571,_0x239f44){return client[_0x4f49('0x3')](_0x4f49('0xa'),{'body':_0x4915af,'options':{'where':{'id':_0x50c571},'limit':_0x239f44},'log':'UpdateCmHopper'});};exports[_0x4f49('0x22')]=function(_0x206203,_0x43d8e3){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x206203,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x4f49('0x23')](_0x4f49('0x9'))},'UserId':{'$in':_0x43d8e3}},'order':[[_0x4f49('0x12'),'DESC'],[_0x4f49('0x15'),_0x4f49('0x13')],['id',_0x4f49('0x16')]],'include':[{'model':_0x4f49('0x5'),'as':_0x4f49('0x6')},{'model':_0x4f49('0x1d'),'as':_0x4f49('0x24'),'attributes':['id',_0x4f49('0x1e'),_0x4f49('0x25')]}],'group':_0x4f49('0x26'),'raw':!![]},'log':_0x4f49('0x11')});};};exports[_0x4f49('0x27')]=function(_0x29ff83,_0x6625cd){return client[_0x4f49('0x3')](_0x4f49('0x28'),{'body':_0x29ff83,'options':_0x6625cd||{},'log':_0x4f49('0x28')});};exports[_0x4f49('0x29')]=function(_0x3e7a08,_0x492b16,_0x45d0d2){return function(){return client[_0x4f49('0x3')](_0x4f49('0x2a'),{'body':{'where':{'voiceQueueIds':_0x3e7a08,'interval':_0x492b16,'availableAgentsIds':_0x45d0d2}},'log':_0x4f49('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 43d6df2..1c906d2 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 _0xaedf=['verifyAdditionalPhones','VerifyAdditionalPhones','Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xaedf,0x1b8));var _0xfaed=function(_0x4385e8,_0x1c455a){_0x4385e8=_0x4385e8-0x0;var _0x26d658=_0xaedf[_0x4385e8];return _0x26d658;};'use strict';var client=require(_0xfaed('0x0'));exports[_0xfaed('0x1')]=function(_0xb0845d,_0x379a9d,_0x49be51){return client['Request'](_0xfaed('0x2'),{'body':_0xb0845d,'reason':_0x379a9d,'entity':_0x49be51,'log':_0xfaed('0x2')});};exports['swapAdditionalPhones']=function(_0x1deceb,_0x41ff4a,_0x4fb13f){return client[_0xfaed('0x3')](_0xfaed('0x4'),{'body':_0x1deceb,'duration':_0x41ff4a,'waitTime':_0x4fb13f,'log':_0xfaed('0x4')});};exports[_0xfaed('0x5')]=function(_0x4a43bf){return function(){return client[_0xfaed('0x3')](_0xfaed('0x6'),{'body':_0x4a43bf,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file +var _0xf162=['SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x11e762,_0x3f7103){var _0x24c967=function(_0x4a3cf0){while(--_0x4a3cf0){_0x11e762['push'](_0x11e762['shift']());}};_0x24c967(++_0x3f7103);}(_0xf162,0x1b5));var _0x2f16=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf162[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x2f16('0x0'));exports[_0x2f16('0x1')]=function(_0x1b6292,_0x178826,_0x59cda7){return client[_0x2f16('0x2')](_0x2f16('0x3'),{'body':_0x1b6292,'reason':_0x178826,'entity':_0x59cda7,'log':_0x2f16('0x3')});};exports['swapAdditionalPhones']=function(_0x4b9287,_0x5cab88,_0x3aa96e){return client['Request'](_0x2f16('0x4'),{'body':_0x4b9287,'duration':_0x5cab88,'waitTime':_0x3aa96e,'log':_0x2f16('0x4')});};exports[_0x2f16('0x5')]=function(_0x5c2743){return function(){return client[_0x2f16('0x2')](_0x2f16('0x6'),{'body':_0x5c2743,'log':_0x2f16('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 67863f8..b4d12ee 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 _0xf2fe=['VoiceQueueId','phone','checkIsBlackListIvr','../client','checkIsBlackList','Request','GetCmHopperBlack'];(function(_0x3da225,_0x3f410c){var _0x3c05d4=function(_0x14f8d9){while(--_0x14f8d9){_0x3da225['push'](_0x3da225['shift']());}};_0x3c05d4(++_0x3f410c);}(_0xf2fe,0x8f));var _0xef2f=function(_0x377dbd,_0xf30c3d){_0x377dbd=_0x377dbd-0x0;var _0x4f54e0=_0xf2fe[_0x377dbd];return _0x4f54e0;};'use strict';var client=require(_0xef2f('0x0'));exports[_0xef2f('0x1')]=function(_0x276ce3){return client[_0xef2f('0x2')](_0xef2f('0x3'),{'options':{'where':{'VoiceQueueId':_0x276ce3[_0xef2f('0x4')],'phone':_0x276ce3[_0xef2f('0x5')]},'raw':![]},'log':_0xef2f('0x3')});};exports[_0xef2f('0x6')]=function(_0x238b13){return client[_0xef2f('0x2')](_0xef2f('0x3'),{'options':{'where':{'CampaignId':_0x238b13['CampaignId'],'phone':_0x238b13[_0xef2f('0x5')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file +var _0x123a=['Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','GetCmHopperBlackIvr'];(function(_0x355974,_0x335fc2){var _0xd65261=function(_0x12e148){while(--_0x12e148){_0x355974['push'](_0x355974['shift']());}};_0xd65261(++_0x335fc2);}(_0x123a,0x1d4));var _0xa123=function(_0x1b1621,_0x400c65){_0x1b1621=_0x1b1621-0x0;var _0xab8b9=_0x123a[_0x1b1621];return _0xab8b9;};'use strict';var client=require('../client');exports['checkIsBlackList']=function(_0xb2a14c){return client[_0xa123('0x0')](_0xa123('0x1'),{'options':{'where':{'VoiceQueueId':_0xb2a14c[_0xa123('0x2')],'phone':_0xb2a14c[_0xa123('0x3')]},'raw':![]},'log':_0xa123('0x1')});};exports[_0xa123('0x4')]=function(_0x703d4a){return client[_0xa123('0x0')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x703d4a['CampaignId'],'phone':_0x703d4a['phone']},'raw':![]},'log':_0xa123('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 9d4dce5..0808cf8 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 _0xc92b=['../client','queue','Request','CreateCmHopperFinal'];(function(_0x1aa85d,_0x227ebb){var _0x487537=function(_0x214516){while(--_0x214516){_0x1aa85d['push'](_0x1aa85d['shift']());}};_0x487537(++_0x227ebb);}(_0xc92b,0xb8));var _0xbc92=function(_0x9a0465,_0x331b3f){_0x9a0465=_0x9a0465-0x0;var _0x1de86f=_0xc92b[_0x9a0465];return _0x1de86f;};'use strict';var client=require(_0xbc92('0x0'));exports['createContact']=function(_0x13f6cd){return function(){_0x13f6cd['campaign']=_0x13f6cd[_0xbc92('0x1')];return client[_0xbc92('0x2')](_0xbc92('0x3'),{'body':_0x13f6cd,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0x9bd5=['../client','createContact','campaign','queue','Request','CreateCmHopperFinal'];(function(_0x21c622,_0x124272){var _0x4fed92=function(_0x2dfe00){while(--_0x2dfe00){_0x21c622['push'](_0x21c622['shift']());}};_0x4fed92(++_0x124272);}(_0x9bd5,0x15c));var _0x59bd=function(_0x4b4e87,_0x4bf51a){_0x4b4e87=_0x4b4e87-0x0;var _0x145237=_0x9bd5[_0x4b4e87];return _0x145237;};'use strict';var client=require(_0x59bd('0x0'));exports[_0x59bd('0x1')]=function(_0x5928cb){return function(){_0x5928cb[_0x59bd('0x2')]=_0x5928cb[_0x59bd('0x3')];return client[_0x59bd('0x4')](_0x59bd('0x5'),{'body':_0x5928cb,'log':_0x59bd('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index baa17ef..cbb66d2 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 _0x4ddb=['CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','day','queue','getCampaignHopperHistory','endOf','ivr','GetCampaignHopperHistory','../client','moment','Request'];(function(_0x21b7f2,_0x55c1d4){var _0x1c86da=function(_0xf445ef){while(--_0xf445ef){_0x21b7f2['push'](_0x21b7f2['shift']());}};_0x1c86da(++_0x55c1d4);}(_0x4ddb,0x107));var _0xb4dd=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x4ddb[_0x3b87f4];return _0x63d16e;};'use strict';var client=require(_0xb4dd('0x0'));var moment=require(_0xb4dd('0x1'));exports['createHistory']=function(_0x3a7bf0){_0x3a7bf0['campaign']=_0x3a7bf0['queue'];return client[_0xb4dd('0x2')]('CreateCmHopperHistory',{'body':_0x3a7bf0,'log':_0xb4dd('0x3')});};exports[_0xb4dd('0x4')]=function(_0x5423e7){return client['Request'](_0xb4dd('0x5'),{'options':{'where':{'endtime':{'$between':[moment()[_0xb4dd('0x6')](_0x5423e7,_0xb4dd('0x7'))[_0xb4dd('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb4dd('0x8')](_0xb4dd('0x9'))]}},'raw':![]},'log':_0xb4dd('0xa')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0xb4dd('0x2')](_0xb4dd('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb4dd('0xc')](_0xb4dd('0xd'))[_0xb4dd('0x8')](_0xb4dd('0x9')),moment()['endOf'](_0xb4dd('0xd'))['format'](_0xb4dd('0x9'))]},'campaigntype':_0xb4dd('0xe')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0xb4dd('0xf')]=function(){return function(){return client['Request']('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xb4dd('0xd'))[_0xb4dd('0x8')](_0xb4dd('0x9')),moment()[_0xb4dd('0x10')](_0xb4dd('0xd'))[_0xb4dd('0x8')](_0xb4dd('0x9'))]},'campaigntype':_0xb4dd('0x11')},'raw':![]},'log':_0xb4dd('0x12')});};}; \ No newline at end of file +var _0xd3e7=['moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','day','GetCampaignHopperHistory','../client'];(function(_0x4cf136,_0x121f83){var _0x5e711d=function(_0x4e5db7){while(--_0x4e5db7){_0x4cf136['push'](_0x4cf136['shift']());}};_0x5e711d(++_0x121f83);}(_0xd3e7,0xbd));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x7d3e('0x0'));var moment=require(_0x7d3e('0x1'));exports[_0x7d3e('0x2')]=function(_0x4ab240){_0x4ab240[_0x7d3e('0x3')]=_0x4ab240[_0x7d3e('0x4')];return client[_0x7d3e('0x5')](_0x7d3e('0x6'),{'body':_0x4ab240,'log':_0x7d3e('0x6')});};exports[_0x7d3e('0x7')]=function(_0x6564cb){return client['Request']('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x7d3e('0x8')](_0x6564cb,_0x7d3e('0x9'))[_0x7d3e('0xa')](_0x7d3e('0xb')),moment()[_0x7d3e('0xa')](_0x7d3e('0xb'))]}},'raw':![]},'log':_0x7d3e('0xc')});};exports[_0x7d3e('0xd')]=function(){return function(){return client['Request'](_0x7d3e('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x7d3e('0xf')]('day')[_0x7d3e('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x7d3e('0x10')](_0x7d3e('0x11'))['format'](_0x7d3e('0xb'))]},'campaigntype':_0x7d3e('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x7d3e('0x5')](_0x7d3e('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x7d3e('0xf')](_0x7d3e('0x11'))[_0x7d3e('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x7d3e('0x11'))['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':'ivr'},'raw':![]},'log':_0x7d3e('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index d939f3f..63296ae 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 _0xcabe=['NotifyFaxAccount','../client','Request','GetFaxAccount','description','ecm','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','active','getFaxAccount'];(function(_0x5e9b6e,_0x37cf45){var _0x469cef=function(_0x9c5840){while(--_0x9c5840){_0x5e9b6e['push'](_0x5e9b6e['shift']());}};_0x469cef(++_0x37cf45);}(_0xcabe,0x1ef));var _0xecab=function(_0xf6f768,_0x42c4d6){_0xf6f768=_0xf6f768-0x0;var _0xbd237=_0xcabe[_0xf6f768];return _0xbd237;};'use strict';var client=require(_0xecab('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0xecab('0x1')](_0xecab('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xecab('0x3'),_0xecab('0x4'),'headerinfo',_0xecab('0x5'),_0xecab('0x6'),_0xecab('0x7'),'modem',_0xecab('0x8'),_0xecab('0x9'),_0xecab('0xa'),_0xecab('0xb'),_0xecab('0xc'),_0xecab('0xd'),_0xecab('0xe')],'include':[{'model':_0xecab('0xf'),'as':_0xecab('0xf'),'attributes':['id','name','callerid',_0xecab('0x10')]}]},'log':_0xecab('0x11')});};};exports['notify']=function(_0x445617,_0x3e9db8){return client[_0xecab('0x1')](_0xecab('0x12'),{'account':{'id':_0x445617},'body':_0x3e9db8,'log':_0xecab('0x12')});}; \ No newline at end of file +var _0x7af9=['Trunk','callerid','getFaxAccount','notify','NotifyFaxAccount','../client','Request','GetFaxAccount','description','ecm','headerinfo','localstationid','minrate','faxdetect','t38timeout','tech','TrunkId','key'];(function(_0xca74f8,_0x20f9d3){var _0x40c4f3=function(_0x1d7bad){while(--_0x1d7bad){_0xca74f8['push'](_0xca74f8['shift']());}};_0x40c4f3(++_0x20f9d3);}(_0x7af9,0x95));var _0x97af=function(_0x5461d3,_0x597ee6){_0x5461d3=_0x5461d3-0x0;var _0x18f75e=_0x7af9[_0x5461d3];return _0x18f75e;};'use strict';var client=require(_0x97af('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0x97af('0x1')](_0x97af('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x97af('0x3'),_0x97af('0x4'),_0x97af('0x5'),_0x97af('0x6'),_0x97af('0x7'),'maxrate','modem','gateway',_0x97af('0x8'),_0x97af('0x9'),_0x97af('0xa'),_0x97af('0xb'),'ListId',_0x97af('0xc')],'include':[{'model':_0x97af('0xd'),'as':_0x97af('0xd'),'attributes':['id','name',_0x97af('0xe'),'active']}]},'log':_0x97af('0xf')});};};exports[_0x97af('0x10')]=function(_0x18a9e5,_0x225451){return client[_0x97af('0x1')](_0x97af('0x11'),{'account':{'id':_0x18a9e5},'body':_0x225451,'log':_0x97af('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 308d565..d944e3f 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 _0x51f8=['../client','Request','UpdateFaxMessage'];(function(_0x1c9c23,_0x40544e){var _0x2f807f=function(_0x2b2f3b){while(--_0x2b2f3b){_0x1c9c23['push'](_0x1c9c23['shift']());}};_0x2f807f(++_0x40544e);}(_0x51f8,0x1b3));var _0x851f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x51f8[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x851f('0x0'));exports['update']=function(_0x84805e,_0x174aa5){return client[_0x851f('0x1')]('UpdateFaxMessage',{'body':_0x174aa5,'options':{'where':{'AttachmentId':_0x84805e}},'log':_0x851f('0x2')});}; \ No newline at end of file +var _0xc85d=['Request','../client','update'];(function(_0xda8937,_0x5847da){var _0x60a826=function(_0x345056){while(--_0x345056){_0xda8937['push'](_0xda8937['shift']());}};_0x60a826(++_0x5847da);}(_0xc85d,0x1e1));var _0xdc85=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc85d[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require(_0xdc85('0x0'));exports[_0xdc85('0x1')]=function(_0x375780,_0x2cd288){return client[_0xdc85('0x2')]('UpdateFaxMessage',{'body':_0x2cd288,'options':{'where':{'AttachmentId':_0x375780}},'log':'UpdateFaxMessage'});}; \ 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 f3b548d..51a9750 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 _0x1d47=['keyContent','customField','Tag','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','username','remoteUri','authType','DeskConfiguration','Configurations','type','variableName','Variable','DeskField','Descriptions','content','keyType'];(function(_0x5e6c73,_0x476594){var _0x3e4f33=function(_0x2aff46){while(--_0x2aff46){_0x5e6c73['push'](_0x5e6c73['shift']());}};_0x3e4f33(++_0x476594);}(_0x1d47,0xec));var _0x71d4=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1d47[_0x5d4607];return _0x5e4a86;};'use strict';var client=require(_0x71d4('0x0'));exports[_0x71d4('0x1')]=function(){return function(_0x5b0acc){return client[_0x71d4('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x71d4('0x3'),'description',_0x71d4('0x4'),'password',_0x71d4('0x5'),_0x71d4('0x6'),'type','serverUrl'],'include':[{'model':_0x71d4('0x7'),'as':_0x71d4('0x8'),'attributes':['id','name'],'include':[{'model':'DeskField','as':'Subjects','attributes':['id',_0x71d4('0x9'),'content',_0x71d4('0xa')],'include':[{'model':'Variable','as':_0x71d4('0xb'),'attributes':['id',_0x71d4('0x3')]}]},{'model':_0x71d4('0xc'),'as':_0x71d4('0xd'),'attributes':['id',_0x71d4('0x9'),_0x71d4('0xe'),'key',_0x71d4('0xf'),_0x71d4('0x10'),_0x71d4('0xa')],'include':[{'model':_0x71d4('0xb'),'as':_0x71d4('0xb'),'attributes':['id',_0x71d4('0x3')]}]},{'model':_0x71d4('0xc'),'as':'Fields','attributes':['id',_0x71d4('0x9'),_0x71d4('0xe'),'idField','nameField',_0x71d4('0x11'),_0x71d4('0xa')],'include':[{'model':_0x71d4('0xb'),'as':_0x71d4('0xb'),'attributes':['id',_0x71d4('0x3')]}]},{'model':_0x71d4('0x12'),'as':_0x71d4('0x13'),'attributes':['id',_0x71d4('0x3')]}]}]},'log':_0x71d4('0x14')});};}; \ No newline at end of file +var _0x82ed=['name','description','password','remoteUri','authType','DeskConfiguration','Configurations','Subjects','type','content','variableName','Variable','DeskField','Descriptions','key','keyType','idField','Tags','GetDeskAccount','../../client','getDeskAccounts','Request'];(function(_0xa07924,_0x57d0d1){var _0x3b2950=function(_0x38dd72){while(--_0x38dd72){_0xa07924['push'](_0xa07924['shift']());}};_0x3b2950(++_0x57d0d1);}(_0x82ed,0x189));var _0xd82e=function(_0x486be5,_0x443cb9){_0x486be5=_0x486be5-0x0;var _0x5ebcbe=_0x82ed[_0x486be5];return _0x5ebcbe;};'use strict';var client=require(_0xd82e('0x0'));exports[_0xd82e('0x1')]=function(){return function(_0xb8d897){return client[_0xd82e('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xd82e('0x3'),_0xd82e('0x4'),'username',_0xd82e('0x5'),_0xd82e('0x6'),_0xd82e('0x7'),'type','serverUrl'],'include':[{'model':_0xd82e('0x8'),'as':_0xd82e('0x9'),'attributes':['id','name'],'include':[{'model':'DeskField','as':_0xd82e('0xa'),'attributes':['id',_0xd82e('0xb'),_0xd82e('0xc'),_0xd82e('0xd')],'include':[{'model':_0xd82e('0xe'),'as':'Variable','attributes':['id',_0xd82e('0x3')]}]},{'model':_0xd82e('0xf'),'as':_0xd82e('0x10'),'attributes':['id',_0xd82e('0xb'),'content',_0xd82e('0x11'),_0xd82e('0x12'),'keyContent',_0xd82e('0xd')],'include':[{'model':_0xd82e('0xe'),'as':_0xd82e('0xe'),'attributes':['id',_0xd82e('0x3')]}]},{'model':_0xd82e('0xf'),'as':'Fields','attributes':['id',_0xd82e('0xb'),_0xd82e('0xc'),_0xd82e('0x13'),'nameField','customField',_0xd82e('0xd')],'include':[{'model':_0xd82e('0xe'),'as':_0xd82e('0xe'),'attributes':['id',_0xd82e('0x3')]}]},{'model':'Tag','as':_0xd82e('0x14'),'attributes':['id',_0xd82e('0x3')]}]}]},'log':_0xd82e('0x15')});};}; \ 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 04f1f0c..daf3b5d 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 _0xd2bf=['password','tenantId','clientId','clientSecret','serverUrl','description','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','Fields','nameField','customField','data2','data5','data7','../../client','GetDynamics365Account','name'];(function(_0x1dee88,_0x361904){var _0x399f8c=function(_0x4ba160){while(--_0x4ba160){_0x1dee88['push'](_0x1dee88['shift']());}};_0x399f8c(++_0x361904);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0xd2bf[_0x7ad123];return _0x37d073;};'use strict';var client=require(_0xfd2b('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x4fba3c){return client['Request'](_0xfd2b('0x1'),{'options':{'raw':![],'attributes':['id',_0xfd2b('0x2'),'username',_0xfd2b('0x3'),'remoteUri',_0xfd2b('0x4'),_0xfd2b('0x5'),_0xfd2b('0x6'),_0xfd2b('0x7'),_0xfd2b('0x8'),'modernAuthentication'],'include':[{'model':_0xfd2b('0x9'),'as':_0xfd2b('0xa'),'attributes':['id',_0xfd2b('0x2'),_0xfd2b('0xb'),_0xfd2b('0xc'),_0xfd2b('0xd'),_0xfd2b('0xe')],'include':[{'model':_0xfd2b('0xf'),'as':_0xfd2b('0x10'),'attributes':['id',_0xfd2b('0x11'),_0xfd2b('0x12'),_0xfd2b('0x13')],'include':[{'model':_0xfd2b('0x14'),'as':_0xfd2b('0x14'),'attributes':['id','name']}]},{'model':_0xfd2b('0xf'),'as':_0xfd2b('0x15'),'attributes':['id',_0xfd2b('0x11'),'content',_0xfd2b('0x16'),'keyType',_0xfd2b('0x17'),_0xfd2b('0x13')],'include':[{'model':_0xfd2b('0x14'),'as':'Variable','attributes':['id',_0xfd2b('0x2')]}]},{'model':_0xfd2b('0xf'),'as':_0xfd2b('0x18'),'attributes':['id',_0xfd2b('0x11'),_0xfd2b('0x12'),'idField',_0xfd2b('0x19'),_0xfd2b('0x1a'),_0xfd2b('0x13')],'include':[{'model':_0xfd2b('0x14'),'as':_0xfd2b('0x14'),'attributes':['id',_0xfd2b('0x2')]}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0xfd2b('0x1b'),_0xfd2b('0x1c'),_0xfd2b('0x1d')]}]},'log':_0xfd2b('0x1')});};}; \ No newline at end of file +var _0x97e6=['customField','CloudProvider','data5','data7','../../client','Request','GetDynamics365Account','username','password','tenantId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','moduleCreate','additionalSearchContact','openNewTab','Subjects','type','content','variableName','Variable','name','key','keyContent','Dynamics365Field','Fields','idField','nameField'];(function(_0x886fa2,_0x472551){var _0x476008=function(_0x45481f){while(--_0x45481f){_0x886fa2['push'](_0x886fa2['shift']());}};_0x476008(++_0x472551);}(_0x97e6,0x159));var _0x697e=function(_0x20463f,_0x4cc37a){_0x20463f=_0x20463f-0x0;var _0x143ee4=_0x97e6[_0x20463f];return _0x143ee4;};'use strict';var client=require(_0x697e('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x5555c4){return client[_0x697e('0x1')](_0x697e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x697e('0x3'),_0x697e('0x4'),'remoteUri',_0x697e('0x5'),'clientId',_0x697e('0x6'),_0x697e('0x7'),_0x697e('0x8'),_0x697e('0x9')],'include':[{'model':_0x697e('0xa'),'as':_0x697e('0xb'),'attributes':['id','name','ticketType',_0x697e('0xc'),_0x697e('0xd'),_0x697e('0xe')],'include':[{'model':'Dynamics365Field','as':_0x697e('0xf'),'attributes':['id',_0x697e('0x10'),_0x697e('0x11'),_0x697e('0x12')],'include':[{'model':_0x697e('0x13'),'as':'Variable','attributes':['id',_0x697e('0x14')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0x697e('0x10'),_0x697e('0x11'),_0x697e('0x15'),'keyType',_0x697e('0x16'),_0x697e('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x697e('0x14')]}]},{'model':_0x697e('0x17'),'as':_0x697e('0x18'),'attributes':['id',_0x697e('0x10'),_0x697e('0x11'),_0x697e('0x19'),_0x697e('0x1a'),_0x697e('0x1b'),_0x697e('0x12')],'include':[{'model':'Variable','as':_0x697e('0x13'),'attributes':['id',_0x697e('0x14')]}]}]},{'model':'CloudProvider','as':_0x697e('0x1c'),'attributes':['id','data2',_0x697e('0x1d'),_0x697e('0x1e')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index f24d074..bd354d7 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 _0x4e34=['FreshdeskConfiguration','Tag','name','FreshdeskField','Subjects','type','content','variableName','Variable','keyContent','Fields','idField','nameField','customField','GetFreshdeskAccount','Request','username','remoteUri','serverUrl'];(function(_0x4f7b5e,_0x555f6f){var _0x4bac7b=function(_0x45fc9b){while(--_0x45fc9b){_0x4f7b5e['push'](_0x4f7b5e['shift']());}};_0x4bac7b(++_0x555f6f);}(_0x4e34,0x19e));var _0x44e3=function(_0x4fee74,_0x52dc94){_0x4fee74=_0x4fee74-0x0;var _0x1720c5=_0x4e34[_0x4fee74];return _0x1720c5;};'use strict';var client=require('../../client');exports['getFreshdeskAccounts']=function(){return function(_0x44f62b){return client[_0x44e3('0x0')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x44e3('0x1'),'apiKey',_0x44e3('0x2'),_0x44e3('0x3')],'include':[{'model':_0x44e3('0x4'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x44e3('0x5'),'attributes':['id',_0x44e3('0x6')]},{'model':_0x44e3('0x7'),'as':_0x44e3('0x8'),'attributes':['id',_0x44e3('0x9'),_0x44e3('0xa'),_0x44e3('0xb')],'include':[{'model':'Variable','as':_0x44e3('0xc'),'attributes':['id',_0x44e3('0x6')]}]},{'model':'FreshdeskField','as':'Descriptions','attributes':['id',_0x44e3('0x9'),_0x44e3('0xa'),'key','keyType',_0x44e3('0xd'),_0x44e3('0xb')],'include':[{'model':_0x44e3('0xc'),'as':_0x44e3('0xc'),'attributes':['id','name']}]},{'model':_0x44e3('0x7'),'as':_0x44e3('0xe'),'attributes':['id',_0x44e3('0x9'),_0x44e3('0xa'),_0x44e3('0xf'),_0x44e3('0x10'),_0x44e3('0x11'),_0x44e3('0xb')],'include':[{'model':'Variable','as':_0x44e3('0xc'),'attributes':['id','name']}]}]}]},'log':_0x44e3('0x12')});};}; \ No newline at end of file +var _0xb688=['name','username','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','Fields','nameField','getFreshdeskAccounts','Request','GetFreshdeskAccount'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xb688,0xcf));var _0x8b68=function(_0x45980b,_0x4b06af){_0x45980b=_0x45980b-0x0;var _0x506c05=_0xb688[_0x45980b];return _0x506c05;};'use strict';var client=require('../../client');exports[_0x8b68('0x0')]=function(){return function(_0x196cec){return client[_0x8b68('0x1')](_0x8b68('0x2'),{'options':{'raw':![],'attributes':['id',_0x8b68('0x3'),_0x8b68('0x4'),'apiKey',_0x8b68('0x5'),_0x8b68('0x6')],'include':[{'model':_0x8b68('0x7'),'as':_0x8b68('0x8'),'attributes':['id','name'],'include':[{'model':_0x8b68('0x9'),'attributes':['id','name']},{'model':_0x8b68('0xa'),'as':_0x8b68('0xb'),'attributes':['id',_0x8b68('0xc'),_0x8b68('0xd'),_0x8b68('0xe')],'include':[{'model':_0x8b68('0xf'),'as':_0x8b68('0xf'),'attributes':['id',_0x8b68('0x3')]}]},{'model':_0x8b68('0xa'),'as':_0x8b68('0x10'),'attributes':['id',_0x8b68('0xc'),_0x8b68('0xd'),_0x8b68('0x11'),'keyType',_0x8b68('0x12'),_0x8b68('0xe')],'include':[{'model':_0x8b68('0xf'),'as':_0x8b68('0xf'),'attributes':['id',_0x8b68('0x3')]}]},{'model':_0x8b68('0xa'),'as':_0x8b68('0x13'),'attributes':['id',_0x8b68('0xc'),_0x8b68('0xd'),'idField',_0x8b68('0x14'),'customField','variableName'],'include':[{'model':_0x8b68('0xf'),'as':_0x8b68('0xf'),'attributes':['id',_0x8b68('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ 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 af5ca3a..8454bf3 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 _0x5e0e=['GetFreshsalesAccount','name','username','apiKey','serverUrl','Configurations','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x5e0e,0x89));var _0xe5e0=function(_0x3f7146,_0x824eba){_0x3f7146=_0x3f7146-0x0;var _0x316350=_0x5e0e[_0x3f7146];return _0x316350;};'use strict';var client=require(_0xe5e0('0x0'));exports[_0xe5e0('0x1')]=function(){return function(_0x54701a){return client[_0xe5e0('0x2')](_0xe5e0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe5e0('0x4'),_0xe5e0('0x5'),_0xe5e0('0x6'),'remoteUri',_0xe5e0('0x7')],'include':[{'model':'FreshsalesConfiguration','as':_0xe5e0('0x8'),'attributes':['id',_0xe5e0('0x4')],'include':[{'model':_0xe5e0('0x9'),'as':_0xe5e0('0xa'),'attributes':['id',_0xe5e0('0xb'),_0xe5e0('0xc'),'variableName'],'include':[{'model':_0xe5e0('0xd'),'as':_0xe5e0('0xd'),'attributes':['id','name']}]},{'model':_0xe5e0('0x9'),'as':_0xe5e0('0xe'),'attributes':['id',_0xe5e0('0xb'),_0xe5e0('0xc'),_0xe5e0('0xf'),_0xe5e0('0x10'),_0xe5e0('0x11'),_0xe5e0('0x12')],'include':[{'model':_0xe5e0('0xd'),'as':_0xe5e0('0xd'),'attributes':['id',_0xe5e0('0x4')]}]}]}]},'log':_0xe5e0('0x13')});};}; \ No newline at end of file +var _0x7ee1=['Subjects','content','Variable','keyType','keyContent','variableName','../../client','GetFreshsalesAccount','name','username','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x59f066,_0x3d8a42){var _0x21187c=function(_0x17a6ee){while(--_0x17a6ee){_0x59f066['push'](_0x59f066['shift']());}};_0x21187c(++_0x3d8a42);}(_0x7ee1,0x8d));var _0x17ee=function(_0x3c6096,_0x81b39d){_0x3c6096=_0x3c6096-0x0;var _0x37bd40=_0x7ee1[_0x3c6096];return _0x37bd40;};'use strict';var client=require(_0x17ee('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x534bb6){return client['Request'](_0x17ee('0x1'),{'options':{'raw':![],'attributes':['id',_0x17ee('0x2'),_0x17ee('0x3'),'apiKey',_0x17ee('0x4'),_0x17ee('0x5')],'include':[{'model':_0x17ee('0x6'),'as':_0x17ee('0x7'),'attributes':['id','name'],'include':[{'model':_0x17ee('0x8'),'as':_0x17ee('0x9'),'attributes':['id','type',_0x17ee('0xa'),'variableName'],'include':[{'model':_0x17ee('0xb'),'as':_0x17ee('0xb'),'attributes':['id',_0x17ee('0x2')]}]},{'model':'FreshsalesField','as':'Descriptions','attributes':['id','type',_0x17ee('0xa'),'key',_0x17ee('0xc'),_0x17ee('0xd'),_0x17ee('0xe')],'include':[{'model':_0x17ee('0xb'),'as':'Variable','attributes':['id',_0x17ee('0x2')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index bb360fc..550b5ad 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 _0xc6d7=['clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','name','moduleSearch','moduleCreate','ticketType','additionalSearchAccount','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','GetSalesforceAccount','../../client','getSalesforceAccounts','Request','username','password','remoteUri','clientId'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xc6d7,0x71));var _0x7c6d=function(_0x4a24b5,_0x55f7cf){_0x4a24b5=_0x4a24b5-0x0;var _0x4c1deb=_0xc6d7[_0x4a24b5];return _0x4c1deb;};'use strict';var client=require(_0x7c6d('0x0'));exports[_0x7c6d('0x1')]=function(){return function(_0xa7b347){return client[_0x7c6d('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id','name',_0x7c6d('0x3'),_0x7c6d('0x4'),_0x7c6d('0x5'),_0x7c6d('0x6'),_0x7c6d('0x7'),_0x7c6d('0x8'),_0x7c6d('0x9'),_0x7c6d('0xa')],'include':[{'model':_0x7c6d('0xb'),'as':_0x7c6d('0xc'),'attributes':['id',_0x7c6d('0xd'),_0x7c6d('0xe'),_0x7c6d('0xf'),_0x7c6d('0x10'),'leadId',_0x7c6d('0x11'),'additionalSearchContact',_0x7c6d('0x12')],'include':[{'model':_0x7c6d('0x13'),'as':_0x7c6d('0x14'),'include':[{'model':_0x7c6d('0x15'),'as':'Variable','attributes':['id',_0x7c6d('0xd')]}]},{'model':_0x7c6d('0x13'),'as':_0x7c6d('0x16'),'include':[{'model':_0x7c6d('0x15'),'as':_0x7c6d('0x15'),'attributes':['id',_0x7c6d('0xd')]}]},{'model':_0x7c6d('0x13'),'as':'Fields','include':[{'model':_0x7c6d('0x15'),'as':_0x7c6d('0x15'),'attributes':['id',_0x7c6d('0xd')]}]}]}]},'log':_0x7c6d('0x17')});};}; \ No newline at end of file +var _0x8f1a=['additionalSearchAccount','additionalSearchContact','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','clientSecret','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','leadId'];(function(_0x3b2fda,_0x164d52){var _0x5ad579=function(_0x488767){while(--_0x488767){_0x3b2fda['push'](_0x3b2fda['shift']());}};_0x5ad579(++_0x164d52);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x451d2e,_0xec68e2){_0x451d2e=_0x451d2e-0x0;var _0x4aec0b=_0x8f1a[_0x451d2e];return _0x4aec0b;};'use strict';var client=require(_0xa8f1('0x0'));exports[_0xa8f1('0x1')]=function(){return function(_0x17cbdb){return client[_0xa8f1('0x2')](_0xa8f1('0x3'),{'options':{'raw':![],'attributes':['id',_0xa8f1('0x4'),_0xa8f1('0x5'),_0xa8f1('0x6'),'remoteUri','clientId',_0xa8f1('0x7'),'securityToken',_0xa8f1('0x8'),_0xa8f1('0x9')],'include':[{'model':'SalesforceConfiguration','as':_0xa8f1('0xa'),'attributes':['id',_0xa8f1('0x4'),_0xa8f1('0xb'),_0xa8f1('0xc'),_0xa8f1('0xd'),_0xa8f1('0xe'),_0xa8f1('0xf'),_0xa8f1('0x10'),'additionalSearchLead'],'include':[{'model':_0xa8f1('0x11'),'as':_0xa8f1('0x12'),'include':[{'model':'Variable','as':_0xa8f1('0x13'),'attributes':['id','name']}]},{'model':_0xa8f1('0x11'),'as':_0xa8f1('0x14'),'include':[{'model':_0xa8f1('0x13'),'as':'Variable','attributes':['id',_0xa8f1('0x4')]}]},{'model':_0xa8f1('0x11'),'as':_0xa8f1('0x15'),'include':[{'model':_0xa8f1('0x13'),'as':_0xa8f1('0x13'),'attributes':['id','name']}]}]}]},'log':_0xa8f1('0x3')});};}; \ 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 12a862b..74f0f0e 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 _0xda19=['ServicenowConfiguration','Configurations','name','ServicenowField','Subjects','type','Variable','Descriptions','content','key','keyType','keyContent','Fields','nameField','GetServicenowkAccount','getServicenowAccounts','GetServicenowAccount','description','password','email','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda19,0xd5));var _0x9da1=function(_0x103fe2,_0x55dd47){_0x103fe2=_0x103fe2-0x0;var _0xf67b45=_0xda19[_0x103fe2];return _0xf67b45;};'use strict';var client=require('../../client');exports[_0x9da1('0x0')]=function(){return function(_0x430d39){return client['Request'](_0x9da1('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x9da1('0x2'),'username',_0x9da1('0x3'),_0x9da1('0x4'),_0x9da1('0x5'),_0x9da1('0x6')],'include':[{'model':_0x9da1('0x7'),'as':_0x9da1('0x8'),'attributes':['id',_0x9da1('0x9')],'include':[{'model':_0x9da1('0xa'),'as':_0x9da1('0xb'),'attributes':['id',_0x9da1('0xc'),'content','variableName'],'include':[{'model':'Variable','as':_0x9da1('0xd'),'attributes':['id','name']}]},{'model':_0x9da1('0xa'),'as':_0x9da1('0xe'),'attributes':['id',_0x9da1('0xc'),_0x9da1('0xf'),_0x9da1('0x10'),_0x9da1('0x11'),_0x9da1('0x12'),'variableName'],'include':[{'model':'Variable','as':_0x9da1('0xd'),'attributes':['id','name']}]},{'model':_0x9da1('0xa'),'as':_0x9da1('0x13'),'attributes':['id',_0x9da1('0xc'),_0x9da1('0xf'),'idField',_0x9da1('0x14'),'customField','variableName'],'include':[{'model':_0x9da1('0xd'),'as':'Variable','attributes':['id',_0x9da1('0x9')]}]}]}]},'log':_0x9da1('0x15')});};}; \ No newline at end of file +var _0xc6ac=['GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x48ba27,_0x26c8f6){_0x48ba27=_0x48ba27-0x0;var _0x42c5f8=_0xc6ac[_0x48ba27];return _0x42c5f8;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(){return function(_0x1b6e92){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc6a('0x4'),_0xcc6a('0x5'),_0xcc6a('0x6'),_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa')],'include':[{'model':_0xcc6a('0xb'),'as':_0xcc6a('0xc'),'attributes':['id','name'],'include':[{'model':_0xcc6a('0xd'),'as':_0xcc6a('0xe'),'attributes':['id',_0xcc6a('0xf'),'content',_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]},{'model':_0xcc6a('0xd'),'as':'Descriptions','attributes':['id',_0xcc6a('0xf'),_0xcc6a('0x12'),_0xcc6a('0x13'),'keyType',_0xcc6a('0x14'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xcc6a('0xd'),'as':_0xcc6a('0x15'),'attributes':['id',_0xcc6a('0xf'),'content','idField',_0xcc6a('0x16'),_0xcc6a('0x17'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]}]}]},'log':_0xcc6a('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 01441d5..423405d 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 _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xda2d,0x102));var _0xdda2=function(_0x15aa0b,_0x2af8af){_0x15aa0b=_0x15aa0b-0x0;var _0x28681f=_0xda2d[_0x15aa0b];return _0x28681f;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file +var _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0xda2d,0x102));var _0xdda2=function(_0x58dae5,_0x6df2d9){_0x58dae5=_0x58dae5-0x0;var _0x52ee2b=_0xda2d[_0x58dae5];return _0x52ee2b;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ 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 727d90a..9504f87 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 _0x9110=['Subjects','type','content','variableName','Descriptions','key','keyType','keyContent','Variable','VtigerField','Fields','nameField','../../client','Request','GetVtigerAccount','name','username','accessKey','serverUrl','VtigerConfiguration'];(function(_0xa7f12b,_0x513b11){var _0x5069c5=function(_0x440ecf){while(--_0x440ecf){_0xa7f12b['push'](_0xa7f12b['shift']());}};_0x5069c5(++_0x513b11);}(_0x9110,0x124));var _0x0911=function(_0x83b426,_0x18fc9f){_0x83b426=_0x83b426-0x0;var _0x4f4588=_0x9110[_0x83b426];return _0x4f4588;};'use strict';var client=require(_0x0911('0x0'));exports['getVtigerAccounts']=function(){return function(_0x143369){return client[_0x0911('0x1')](_0x0911('0x2'),{'options':{'raw':![],'attributes':['id',_0x0911('0x3'),'description',_0x0911('0x4'),_0x0911('0x5'),'remoteUri',_0x0911('0x6')],'include':[{'model':_0x0911('0x7'),'as':'Configurations','attributes':['id',_0x0911('0x3')],'include':[{'model':'VtigerField','as':_0x0911('0x8'),'attributes':['id',_0x0911('0x9'),_0x0911('0xa'),_0x0911('0xb')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x0911('0x3')]}]},{'model':'VtigerField','as':_0x0911('0xc'),'attributes':['id',_0x0911('0x9'),'content',_0x0911('0xd'),_0x0911('0xe'),_0x0911('0xf'),_0x0911('0xb')],'include':[{'model':_0x0911('0x10'),'as':'Variable','attributes':['id',_0x0911('0x3')]}]},{'model':_0x0911('0x11'),'as':_0x0911('0x12'),'attributes':['id',_0x0911('0x9'),'content','idField',_0x0911('0x13'),'customField',_0x0911('0xb')],'include':[{'model':_0x0911('0x10'),'as':_0x0911('0x10'),'attributes':['id',_0x0911('0x3')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x6ec3=['variableName','Variable','Descriptions','key','keyType','Fields','nameField','GetVtigerAccount','../../client','getVtigerAccounts','Request','name','description','remoteUri','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content'];(function(_0x457f9b,_0x240086){var _0x2113e0=function(_0x393511){while(--_0x393511){_0x457f9b['push'](_0x457f9b['shift']());}};_0x2113e0(++_0x240086);}(_0x6ec3,0xa8));var _0x36ec=function(_0x1f9ada,_0xf00a10){_0x1f9ada=_0x1f9ada-0x0;var _0x55f24e=_0x6ec3[_0x1f9ada];return _0x55f24e;};'use strict';var client=require(_0x36ec('0x0'));exports[_0x36ec('0x1')]=function(){return function(_0x3e1c1d){return client[_0x36ec('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x36ec('0x3'),_0x36ec('0x4'),'username','accessKey',_0x36ec('0x5'),'serverUrl'],'include':[{'model':_0x36ec('0x6'),'as':_0x36ec('0x7'),'attributes':['id',_0x36ec('0x3')],'include':[{'model':_0x36ec('0x8'),'as':_0x36ec('0x9'),'attributes':['id',_0x36ec('0xa'),_0x36ec('0xb'),_0x36ec('0xc')],'include':[{'model':_0x36ec('0xd'),'as':_0x36ec('0xd'),'attributes':['id',_0x36ec('0x3')]}]},{'model':_0x36ec('0x8'),'as':_0x36ec('0xe'),'attributes':['id','type',_0x36ec('0xb'),_0x36ec('0xf'),_0x36ec('0x10'),'keyContent',_0x36ec('0xc')],'include':[{'model':_0x36ec('0xd'),'as':_0x36ec('0xd'),'attributes':['id',_0x36ec('0x3')]}]},{'model':_0x36ec('0x8'),'as':_0x36ec('0x11'),'attributes':['id',_0x36ec('0xa'),'content','idField',_0x36ec('0x12'),'customField',_0x36ec('0xc')],'include':[{'model':'Variable','as':_0x36ec('0xd'),'attributes':['id',_0x36ec('0x3')]}]}]}]},'log':_0x36ec('0x13')});};}; \ 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 9295991..4b5b666 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 _0x43f2=['customField','../../client','Request','GetZendeskAccount','password','remoteUri','authType','serverUrl','type','Configurations','name','Tag','ZendeskField','Subjects','content','variableName','Descriptions','key','keyType','keyContent','Variable','Fields','idField','nameField'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x43f2,0x151));var _0x243f=function(_0x22397d,_0x1be3eb){_0x22397d=_0x22397d-0x0;var _0x16b143=_0x43f2[_0x22397d];return _0x16b143;};'use strict';var client=require(_0x243f('0x0'));exports['getZendeskAccounts']=function(){return function(_0x1ec23d){return client[_0x243f('0x1')](_0x243f('0x2'),{'options':{'raw':![],'attributes':['id','name','username',_0x243f('0x3'),'token',_0x243f('0x4'),_0x243f('0x5'),_0x243f('0x6'),_0x243f('0x7')],'include':[{'model':'ZendeskConfiguration','as':_0x243f('0x8'),'attributes':['id',_0x243f('0x9')],'include':[{'model':_0x243f('0xa'),'attributes':['id','name']},{'model':_0x243f('0xb'),'as':_0x243f('0xc'),'attributes':['id',_0x243f('0x7'),_0x243f('0xd'),_0x243f('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x243f('0x9')]}]},{'model':_0x243f('0xb'),'as':_0x243f('0xf'),'attributes':['id',_0x243f('0x7'),_0x243f('0xd'),_0x243f('0x10'),_0x243f('0x11'),_0x243f('0x12'),_0x243f('0xe')],'include':[{'model':_0x243f('0x13'),'as':_0x243f('0x13'),'attributes':['id','name']}]},{'model':_0x243f('0xb'),'as':_0x243f('0x14'),'attributes':['id','type',_0x243f('0xd'),_0x243f('0x15'),_0x243f('0x16'),_0x243f('0x17'),'variableName'],'include':[{'model':_0x243f('0x13'),'as':_0x243f('0x13'),'attributes':['id','name']}]}]}]},'log':_0x243f('0x2')});};}; \ No newline at end of file +var _0xe654=['remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Subjects','content','Variable','ZendeskField','keyType','Fields','idField','nameField','../../client','Request','GetZendeskAccount','name','username','password','token'];(function(_0x381fac,_0x2c7e36){var _0xdb89c4=function(_0x413f48){while(--_0x413f48){_0x381fac['push'](_0x381fac['shift']());}};_0xdb89c4(++_0x2c7e36);}(_0xe654,0x10a));var _0x4e65=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe654[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x4e65('0x0'));exports['getZendeskAccounts']=function(){return function(_0x3b313c){return client[_0x4e65('0x1')](_0x4e65('0x2'),{'options':{'raw':![],'attributes':['id',_0x4e65('0x3'),_0x4e65('0x4'),_0x4e65('0x5'),_0x4e65('0x6'),_0x4e65('0x7'),_0x4e65('0x8'),_0x4e65('0x9'),_0x4e65('0xa')],'include':[{'model':_0x4e65('0xb'),'as':_0x4e65('0xc'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id','name']},{'model':'ZendeskField','as':_0x4e65('0xd'),'attributes':['id',_0x4e65('0xa'),_0x4e65('0xe'),'variableName'],'include':[{'model':_0x4e65('0xf'),'as':_0x4e65('0xf'),'attributes':['id',_0x4e65('0x3')]}]},{'model':_0x4e65('0x10'),'as':'Descriptions','attributes':['id',_0x4e65('0xa'),_0x4e65('0xe'),'key',_0x4e65('0x11'),'keyContent','variableName'],'include':[{'model':_0x4e65('0xf'),'as':_0x4e65('0xf'),'attributes':['id',_0x4e65('0x3')]}]},{'model':_0x4e65('0x10'),'as':_0x4e65('0x12'),'attributes':['id',_0x4e65('0xa'),_0x4e65('0xe'),_0x4e65('0x13'),_0x4e65('0x14'),'customField','variableName'],'include':[{'model':_0x4e65('0xf'),'as':_0x4e65('0xf'),'attributes':['id',_0x4e65('0x3')]}]}]}]},'log':_0x4e65('0x2')});};}; \ 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 3b6da9e..678fb5e 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 _0xefa3=['Variable','ZohoField','Descriptions','key','keyType','keyContent','Fields','nameField','customField','../../client','getZohoAccounts','GetZohoAccount','name','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleSearch','description','Subjects','type','content','variableName'];(function(_0x56e175,_0x12a1ac){var _0x53bb00=function(_0x22bf2f){while(--_0x22bf2f){_0x56e175['push'](_0x56e175['shift']());}};_0x53bb00(++_0x12a1ac);}(_0xefa3,0x11c));var _0x3efa=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0xefa3[_0x476c7];return _0x47ae56;};'use strict';var client=require(_0x3efa('0x0'));exports[_0x3efa('0x1')]=function(){return function(_0x5b8a83){return client['Request'](_0x3efa('0x2'),{'options':{'raw':![],'attributes':['id',_0x3efa('0x3'),'description','host','zone','clientId',_0x3efa('0x4'),_0x3efa('0x5'),_0x3efa('0x6'),_0x3efa('0x7')],'include':[{'model':_0x3efa('0x8'),'as':_0x3efa('0x9'),'attributes':['id','name','moduleCreate',_0x3efa('0xa'),_0x3efa('0xb')],'include':[{'model':'ZohoField','as':_0x3efa('0xc'),'attributes':['id',_0x3efa('0xd'),_0x3efa('0xe'),_0x3efa('0xf')],'include':[{'model':_0x3efa('0x10'),'as':'Variable','attributes':['id','name']}]},{'model':_0x3efa('0x11'),'as':_0x3efa('0x12'),'attributes':['id',_0x3efa('0xd'),_0x3efa('0xe'),_0x3efa('0x13'),_0x3efa('0x14'),_0x3efa('0x15'),_0x3efa('0xf')],'include':[{'model':_0x3efa('0x10'),'as':_0x3efa('0x10'),'attributes':['id',_0x3efa('0x3')]}]},{'model':_0x3efa('0x11'),'as':_0x3efa('0x16'),'attributes':['id','type',_0x3efa('0xe'),'idField',_0x3efa('0x17'),_0x3efa('0x18'),_0x3efa('0xf')],'include':[{'model':_0x3efa('0x10'),'as':_0x3efa('0x10'),'attributes':['id',_0x3efa('0x3')]}]}]}]},'log':_0x3efa('0x2')});};}; \ No newline at end of file +var _0x59f4=['clientId','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','variableName','Descriptions','keyContent','idField','nameField','customField','Variable','../../client','GetZohoAccount','name','description','host'];(function(_0x36b118,_0x298b28){var _0x2711db=function(_0x25c67c){while(--_0x25c67c){_0x36b118['push'](_0x36b118['shift']());}};_0x2711db(++_0x298b28);}(_0x59f4,0x163));var _0x459f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x59f4[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x459f('0x0'));exports['getZohoAccounts']=function(){return function(_0xd47d5){return client['Request'](_0x459f('0x1'),{'options':{'raw':![],'attributes':['id',_0x459f('0x2'),_0x459f('0x3'),_0x459f('0x4'),'zone',_0x459f('0x5'),'clientSecret',_0x459f('0x6'),_0x459f('0x7'),_0x459f('0x8')],'include':[{'model':_0x459f('0x9'),'as':_0x459f('0xa'),'attributes':['id',_0x459f('0x2'),_0x459f('0xb'),_0x459f('0xc'),_0x459f('0x3')],'include':[{'model':_0x459f('0xd'),'as':_0x459f('0xe'),'attributes':['id',_0x459f('0xf'),_0x459f('0x10'),_0x459f('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x459f('0x2')]}]},{'model':_0x459f('0xd'),'as':_0x459f('0x12'),'attributes':['id',_0x459f('0xf'),_0x459f('0x10'),'key','keyType',_0x459f('0x13'),_0x459f('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x459f('0x2')]}]},{'model':'ZohoField','as':'Fields','attributes':['id',_0x459f('0xf'),'content',_0x459f('0x14'),_0x459f('0x15'),_0x459f('0x16'),_0x459f('0x11')],'include':[{'model':_0x459f('0x17'),'as':_0x459f('0x17'),'attributes':['id',_0x459f('0x2')]}]}]}]},'log':_0x459f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 30149cc..f20cd0a 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 _0x129d=['silly','intervalIftime\x20called\x20with','isArray','length','every','number','string','map','concat','Request','IntervalIftime','intervalIftime','../client','stack','replace','trim'];(function(_0x1280e3,_0x5a6dbf){var _0x2431a0=function(_0x4e468f){while(--_0x4e468f){_0x1280e3['push'](_0x1280e3['shift']());}};_0x2431a0(++_0x5a6dbf);}(_0x129d,0x17c));var _0xd129=function(_0x4e7b85,_0x3a4d8c){_0x4e7b85=_0x4e7b85-0x0;var _0x9f8531=_0x129d[_0x4e7b85];return _0x9f8531;};var logger=require('../../../config/logger')('dialer');var client=require(_0xd129('0x0'));function intervalIftime(_0x48d0c5,_0x120723){const _0x48f8b3=new Error()[_0xd129('0x1')][_0xd129('0x2')](/^Error/,'')[_0xd129('0x3')]();logger[_0xd129('0x4')](_0xd129('0x5'),_0x48d0c5,_0x120723,_0x48f8b3);const _0x392b2f=Array[_0xd129('0x6')](_0x48d0c5);if(!_0x48d0c5||_0x392b2f&&_0x48d0c5[_0xd129('0x7')]===0x0){return Promise['resolve'](![]);}else{var _0x22cd73=[];var _0x10c797=[];var _0x4bced4=_0x392b2f?_0x48d0c5:[_0x48d0c5];var _0x25a188=_0x4bced4[_0xd129('0x8')](function(_0x1e79df){return typeof _0x1e79df===_0xd129('0x9');});var _0xc5842c=_0x4bced4[_0xd129('0x8')](function(_0x3e0aa9){return typeof _0x3e0aa9===_0xd129('0xa');});if(!_0x25a188&&!_0xc5842c){_0x22cd73=_0x4bced4[_0xd129('0xb')](function(_0x298d6c){return _0x298d6c['id'];});if(_0x22cd73['length']===0x0){_0x10c797=_0x4bced4['map'](function(_0x661ec7){return _0x661ec7['interval'];});}}else{if(_0x25a188){_0x22cd73=_0x22cd73[_0xd129('0xc')](_0x4bced4);}if(_0xc5842c){_0x10c797=_0x10c797[_0xd129('0xc')](_0x4bced4);}}return client[_0xd129('0xd')](_0xd129('0xe'),{'intervalIds':_0x22cd73,'intervals':_0x10c797,'timezone':_0x120723,'log':_0xd129('0xe')});}}exports[_0xd129('0xf')]=intervalIftime; \ No newline at end of file +var _0x6199=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','replace','trim','silly','intervalIftime\x20called\x20with','isArray','resolve','map','length','interval'];(function(_0x17f502,_0x5a31a2){var _0x5f1554=function(_0x3e3c28){while(--_0x3e3c28){_0x17f502['push'](_0x17f502['shift']());}};_0x5f1554(++_0x5a31a2);}(_0x6199,0x112));var _0x9619=function(_0x16ac08,_0x545d75){_0x16ac08=_0x16ac08-0x0;var _0x3e9017=_0x6199[_0x16ac08];return _0x3e9017;};var logger=require(_0x9619('0x0'))(_0x9619('0x1'));var client=require('../client');function intervalIftime(_0x24a654,_0x4fb619){const _0x4282b0=new Error()['stack'][_0x9619('0x2')](/^Error/,'')[_0x9619('0x3')]();logger[_0x9619('0x4')](_0x9619('0x5'),_0x24a654,_0x4fb619,_0x4282b0);const _0x7b4802=Array[_0x9619('0x6')](_0x24a654);if(!_0x24a654||_0x7b4802&&_0x24a654['length']===0x0){return Promise[_0x9619('0x7')](![]);}else{var _0x55dc7c=[];var _0xea19ac=[];var _0x326e34=_0x7b4802?_0x24a654:[_0x24a654];var _0x436a04=_0x326e34['every'](function(_0x23a513){return typeof _0x23a513==='number';});var _0x4a9738=_0x326e34['every'](function(_0x5b6391){return typeof _0x5b6391==='string';});if(!_0x436a04&&!_0x4a9738){_0x55dc7c=_0x326e34[_0x9619('0x8')](function(_0x118a5c){return _0x118a5c['id'];});if(_0x55dc7c[_0x9619('0x9')]===0x0){_0xea19ac=_0x326e34[_0x9619('0x8')](function(_0x220d5b){return _0x220d5b[_0x9619('0xa')];});}}else{if(_0x436a04){_0x55dc7c=_0x55dc7c[_0x9619('0xb')](_0x326e34);}if(_0x4a9738){_0xea19ac=_0xea19ac[_0x9619('0xb')](_0x326e34);}}return client[_0x9619('0xc')](_0x9619('0xd'),{'intervalIds':_0x55dc7c,'intervals':_0xea19ac,'timezone':_0x4fb619,'log':_0x9619('0xd')});}}exports[_0x9619('0xe')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index cebef3f..8e26d27 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 _0x6ab7=['util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','format','SIP/%s','lastAssignedTo','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','agent','accountcode','voiceDialReport','endtime','starttime','outbound','dialstring','toNumber','uniqueid','moment'];(function(_0x8053f7,_0x1dc82d){var _0x184f82=function(_0x3df55e){while(--_0x3df55e){_0x8053f7['push'](_0x8053f7['shift']());}};_0x184f82(++_0x1dc82d);}(_0x6ab7,0x185));var _0x76ab=function(_0xde9fa7,_0x2b8a00){_0xde9fa7=_0xde9fa7-0x0;var _0x1f286d=_0x6ab7[_0xde9fa7];return _0x1f286d;};'use strict';var moment=require(_0x76ab('0x0'));var _=require('lodash');var util=require(_0x76ab('0x1'));var client=require(_0x76ab('0x2'));exports[_0x76ab('0x3')]=function(_0x2e7e18){var _0x3db218=_0x2e7e18[_0x76ab('0x4')]||_0x2e7e18[_0x76ab('0x5')];return client[_0x76ab('0x6')](_0x76ab('0x7'),{'body':{'channel':_0x76ab('0x8'),'membername':_0x2e7e18['lastAssignedTo'],'interface':_[_0x76ab('0x9')](_0x2e7e18['interface'])?util[_0x76ab('0xa')](_0x76ab('0xb'),_0x2e7e18[_0x76ab('0xc')]):_0x2e7e18[_0x76ab('0xd')],'type':_0x76ab('0xe'),'enterAt':_0x2e7e18[_0x76ab('0xf')],'exitAt':_0x3db218,'duration':moment(_0x3db218)[_0x76ab('0x10')](_0x2e7e18['queuecallerleaveAt'],_0x76ab('0x11')),'data1':_0x76ab('0x12'),'data2':_0x2e7e18[_0x76ab('0x13')],'data3':_0x2e7e18[_0x76ab('0x14')],'data4':null,'data5':_0x2e7e18['queue'],'role':_0x76ab('0x15'),'internal':_0x2e7e18[_0x76ab('0x16')]?_['toNumber'](_0x2e7e18[_0x76ab('0x16')]):undefined,'uniqueid':_0x2e7e18['uniqueid']},'log':_0x76ab('0x7')});};exports[_0x76ab('0x17')]=function(_0x591a2a){return client[_0x76ab('0x6')](_0x76ab('0x7'),{'body':{'channel':'voice','membername':_0x591a2a['membername'],'interface':_0x591a2a[_0x76ab('0xd')],'type':_0x76ab('0xe'),'enterAt':_0x591a2a['starttime'],'exitAt':_0x591a2a[_0x76ab('0x18')],'duration':moment(_0x591a2a[_0x76ab('0x18')])[_0x76ab('0x10')](_0x591a2a[_0x76ab('0x19')],_0x76ab('0x11'))>=0x0?moment(_0x591a2a[_0x76ab('0x18')])['diff'](_0x591a2a[_0x76ab('0x19')],_0x76ab('0x11')):null,'data1':_0x76ab('0x1a'),'data2':_0x591a2a[_0x76ab('0x16')],'data3':_0x591a2a[_0x76ab('0x14')],'data4':_0x591a2a[_0x76ab('0x1b')]||null,'role':_0x76ab('0x15'),'internal':_0x591a2a['accountcode']?_[_0x76ab('0x1c')](_0x591a2a['accountcode']):undefined,'uniqueid':_0x591a2a[_0x76ab('0x1d')]},'log':_0x76ab('0x7')});}; \ No newline at end of file +var _0xee4e=['lastAssignedTo','interface','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','Request','voice','membername','TALKING','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','format','SIP/%s'];(function(_0x2f1ac2,_0x69699a){var _0xbbb440=function(_0x2908dc){while(--_0x2908dc){_0x2f1ac2['push'](_0x2f1ac2['shift']());}};_0xbbb440(++_0x69699a);}(_0xee4e,0x8c));var _0xeee4=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xee4e[_0x13b8f3];return _0x1a6d06;};'use strict';var moment=require(_0xeee4('0x0'));var _=require(_0xeee4('0x1'));var util=require(_0xeee4('0x2'));var client=require(_0xeee4('0x3'));exports[_0xeee4('0x4')]=function(_0x12b3e8){var _0x2c5204=_0x12b3e8[_0xeee4('0x5')]||_0x12b3e8[_0xeee4('0x6')];return client['Request'](_0xeee4('0x7'),{'body':{'channel':'voice','membername':_0x12b3e8['lastAssignedTo'],'interface':_['isNil'](_0x12b3e8['interface'])?util[_0xeee4('0x8')](_0xeee4('0x9'),_0x12b3e8[_0xeee4('0xa')]):_0x12b3e8[_0xeee4('0xb')],'type':'TALKING','enterAt':_0x12b3e8['queuecallerleaveAt'],'exitAt':_0x2c5204,'duration':moment(_0x2c5204)[_0xeee4('0xc')](_0x12b3e8[_0xeee4('0xd')],_0xeee4('0xe')),'data1':_0xeee4('0xf'),'data2':_0x12b3e8[_0xeee4('0x10')],'data3':_0x12b3e8[_0xeee4('0x11')],'data4':null,'data5':_0x12b3e8['queue'],'role':_0xeee4('0x12'),'internal':_0x12b3e8[_0xeee4('0x13')]?_[_0xeee4('0x14')](_0x12b3e8[_0xeee4('0x13')]):undefined,'uniqueid':_0x12b3e8[_0xeee4('0x15')]},'log':_0xeee4('0x7')});};exports['voiceDialReport']=function(_0x540bbf){return client[_0xeee4('0x16')]('CreateMemberReport',{'body':{'channel':_0xeee4('0x17'),'membername':_0x540bbf[_0xeee4('0x18')],'interface':_0x540bbf[_0xeee4('0xb')],'type':_0xeee4('0x19'),'enterAt':_0x540bbf[_0xeee4('0x1a')],'exitAt':_0x540bbf[_0xeee4('0x1b')],'duration':moment(_0x540bbf[_0xeee4('0x1b')])[_0xeee4('0xc')](_0x540bbf[_0xeee4('0x1a')],_0xeee4('0xe'))>=0x0?moment(_0x540bbf[_0xeee4('0x1b')])[_0xeee4('0xc')](_0x540bbf[_0xeee4('0x1a')],_0xeee4('0xe')):null,'data1':_0xeee4('0x1c'),'data2':_0x540bbf[_0xeee4('0x13')],'data3':_0x540bbf['exten'],'data4':_0x540bbf[_0xeee4('0x1d')]||null,'role':_0xeee4('0x12'),'internal':_0x540bbf[_0xeee4('0x13')]?_['toNumber'](_0x540bbf[_0xeee4('0x13')]):undefined,'uniqueid':_0x540bbf[_0xeee4('0x15')]},'log':_0xeee4('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8829a6e..c2e4ee4 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 _0x3f8c=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x5d3d3d,_0x8a3cb1){var _0x4bdf59=function(_0x3f0ea8){while(--_0x3f0ea8){_0x5d3d3d['push'](_0x5d3d3d['shift']());}};_0x4bdf59(++_0x8a3cb1);}(_0x3f8c,0x104));var _0xc3f8=function(_0x160471,_0x3c4871){_0x160471=_0x160471-0x0;var _0x284d56=_0x3f8c[_0x160471];return _0x284d56;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xc3f8('0x0')](_0xc3f8('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc3f8('0x2'),_0xc3f8('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x8c51=['previewRecallmeReminderInterval','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x2b18d8,_0x21778e){var _0x2bcce2=function(_0xc14e4b){while(--_0xc14e4b){_0x2b18d8['push'](_0x2b18d8['shift']());}};_0x2bcce2(++_0x21778e);}(_0x8c51,0x100));var _0x18c5=function(_0xbddc74,_0x3df5be){_0xbddc74=_0xbddc74-0x0;var _0x3e1329=_0x8c51[_0xbddc74];return _0x3e1329;};'use strict';var client=require('../client');exports[_0x18c5('0x0')]=function(){return client[_0x18c5('0x1')](_0x18c5('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x18c5('0x3'),_0x18c5('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d5f74f0..5a23440 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 _0x7c80=['getTemplates','Request','GetTemplate','name','../client'];(function(_0x51a822,_0x6303fc){var _0xfa9db5=function(_0xda0729){while(--_0xda0729){_0x51a822['push'](_0x51a822['shift']());}};_0xfa9db5(++_0x6303fc);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x07c8('0x0'));exports[_0x07c8('0x1')]=function(_0x4c4d1c){return function(_0x4d1be3){return client[_0x07c8('0x2')](_0x07c8('0x3'),{'options':{'raw':!![],'attributes':['id',_0x07c8('0x4'),'html']},'log':_0x07c8('0x3')});};}; \ No newline at end of file +var _0xe78b=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x1c759e,_0x464ccc){var _0x284153=function(_0x392942){while(--_0x392942){_0x1c759e['push'](_0x1c759e['shift']());}};_0x284153(++_0x464ccc);}(_0xe78b,0x1c2));var _0xbe78=function(_0x1f0c26,_0x365f93){_0x1f0c26=_0x1f0c26-0x0;var _0x2ebbc6=_0xe78b[_0x1f0c26];return _0x2ebbc6;};'use strict';var client=require(_0xbe78('0x0'));exports[_0xbe78('0x1')]=function(_0x52c04e){return function(_0x7ba089){return client[_0xbe78('0x2')](_0xbe78('0x3'),{'options':{'raw':!![],'attributes':['id',_0xbe78('0x4'),_0xbe78('0x5')]},'log':_0xbe78('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 025f5b1..61a40f0 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 _0x6af0=['data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','action','data2','data3','data5'];(function(_0x5bf79a,_0x2eaa1d){var _0x3ff10f=function(_0x48523){while(--_0x48523){_0x5bf79a['push'](_0x5bf79a['shift']());}};_0x3ff10f(++_0x2eaa1d);}(_0x6af0,0x1ba));var _0x06af=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x6af0[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0x06af('0x0'));exports[_0x06af('0x1')]=function(_0x189ce2){return function(_0x3680be){return client[_0x06af('0x2')](_0x06af('0x3'),{'options':{'raw':![],'attributes':['id',_0x06af('0x4'),_0x06af('0x5'),_0x06af('0x6')],'include':[{'model':_0x06af('0x7'),'as':_0x06af('0x8'),'attributes':['id',_0x06af('0x9'),_0x06af('0xa'),'value']},{'model':_0x06af('0x7'),'as':_0x06af('0xb'),'attributes':['id',_0x06af('0x9'),_0x06af('0xa'),_0x06af('0xc')]},{'model':_0x06af('0xd'),'as':'Actions','attributes':['id',_0x06af('0xe'),'data1',_0x06af('0xf'),_0x06af('0x10'),'data4',_0x06af('0x11'),_0x06af('0x12'),_0x06af('0x13')]}]},'log':_0x06af('0x3')});};}; \ No newline at end of file +var _0xf067=['GetTrigger','name','channel','Condition','field','AnyConditions','operator','Action','Actions','action','data1','data2','data3','data5','data6','data7','getTriggers','Request'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xf067,0xb2));var _0x7f06=function(_0x2474e9,_0x380525){_0x2474e9=_0x2474e9-0x0;var _0x4d09a6=_0xf067[_0x2474e9];return _0x4d09a6;};'use strict';var client=require('../client');exports[_0x7f06('0x0')]=function(_0x3d065d){return function(_0x35c912){return client[_0x7f06('0x1')](_0x7f06('0x2'),{'options':{'raw':![],'attributes':['id',_0x7f06('0x3'),_0x7f06('0x4'),'status'],'include':[{'model':_0x7f06('0x5'),'as':'AllConditions','attributes':['id',_0x7f06('0x6'),'operator','value']},{'model':'Condition','as':_0x7f06('0x7'),'attributes':['id',_0x7f06('0x6'),_0x7f06('0x8'),'value']},{'model':_0x7f06('0x9'),'as':_0x7f06('0xa'),'attributes':['id',_0x7f06('0xb'),_0x7f06('0xc'),_0x7f06('0xd'),_0x7f06('0xe'),'data4',_0x7f06('0xf'),_0x7f06('0x10'),_0x7f06('0x11')]}]},'log':_0x7f06('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7bad907..871ac34 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 _0xa509=['GetTrunk','registry','../client','Request'];(function(_0x675360,_0x3b8385){var _0x492792=function(_0x4f1fa9){while(--_0x4f1fa9){_0x675360['push'](_0x675360['shift']());}};_0x492792(++_0x3b8385);}(_0xa509,0x1ce));var _0x9a50=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa509[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x9a50('0x0'));exports['getTrunks']=function(_0x2f0476){return function(_0x5d4692){return client[_0x9a50('0x1')](_0x9a50('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x9a50('0x3'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x3b18=['Request','GetTrunk','registry','defaultuser'];(function(_0x2178e9,_0x30db4c){var _0x51113b=function(_0xf469aa){while(--_0xf469aa){_0x2178e9['push'](_0x2178e9['shift']());}};_0x51113b(++_0x30db4c);}(_0x3b18,0x1d4));var _0x83b1=function(_0x16387c,_0x2a5def){_0x16387c=_0x16387c-0x0;var _0x80b509=_0x3b18[_0x16387c];return _0x80b509;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x51c3f9){return function(_0x3129f4){return client[_0x83b1('0x0')](_0x83b1('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x83b1('0x2'),_0x83b1('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 214dd10..7cdafce 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x536ffd,_0xbe6fb){var _0x29f75c=function(_0x1d64d8){while(--_0x1d64d8){_0x536ffd['push'](_0x536ffd['shift']());}};_0x29f75c(++_0xbe6fb);}(_0x34e8,0x12c));var _0x834e=function(_0x1b3022,_0x1e5f0f){_0x1b3022=_0x1b3022-0x0;var _0xaf4ba2=_0x34e8[_0x1b3022];return _0xaf4ba2;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x4e03e3,_0x121899){var _0x43459c=function(_0x414ee6){while(--_0x414ee6){_0x4e03e3['push'](_0x4e03e3['shift']());}};_0x43459c(++_0x121899);}(_0x34e8,0x12c));var _0x834e=function(_0x4eb31d,_0xfd999e){_0x4eb31d=_0x4eb31d-0x0;var _0x1d7086=_0x34e8[_0x4eb31d];return _0x1d7086;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 72fc273..341ee81 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 _0xc5fb=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x5d061e,_0x37481d){var _0x187164=function(_0x431ba3){while(--_0x431ba3){_0x5d061e['push'](_0x5d061e['shift']());}};_0x187164(++_0x37481d);}(_0xc5fb,0xcb));var _0xbc5f=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0xc5fb[_0x26bcec];return _0x1049dc;};'use strict';var client=require(_0xbc5f('0x0'));exports[_0xbc5f('0x1')]=function(_0x155263){return client[_0xbc5f('0x2')](_0xbc5f('0x3'),{'body':_0x155263,'log':_0xbc5f('0x3')});};exports[_0xbc5f('0x4')]=function(_0x321e82,_0x15903f,_0x464216){return client[_0xbc5f('0x2')]('UpdateVoiceAgentReport',{'body':_0x321e82,'options':{'where':{'uniqueid':_0x15903f,'interface':_0x464216,'agentcomplete':!![]}},'log':_0xbc5f('0x5')});}; \ No newline at end of file +var _0x9bb2=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x578ad9,_0x441df9){var _0x4de9db=function(_0x471abe){while(--_0x471abe){_0x578ad9['push'](_0x578ad9['shift']());}};_0x4de9db(++_0x441df9);}(_0x9bb2,0x1ba));var _0x29bb=function(_0x306324,_0x2acd6d){_0x306324=_0x306324-0x0;var _0x24785f=_0x9bb2[_0x306324];return _0x24785f;};'use strict';var client=require(_0x29bb('0x0'));exports[_0x29bb('0x1')]=function(_0x21aa56){return client[_0x29bb('0x2')]('CreateVoiceAgentReport',{'body':_0x21aa56,'log':_0x29bb('0x3')});};exports['update']=function(_0x4099d1,_0x3b0660,_0x2b841f){return client[_0x29bb('0x2')](_0x29bb('0x4'),{'body':_0x4099d1,'options':{'where':{'uniqueid':_0x3b0660,'interface':_0x2b841f,'agentcomplete':!![]}},'log':_0x29bb('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1765a70..be23347 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 _0x613d=['callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x613d,0x91));var _0xd613=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x613d[_0x5e77db];return _0x34b675;};'use strict';var moment=require(_0xd613('0x0'));var util=require(_0xd613('0x1'));var _=require('lodash');var client=require(_0xd613('0x2'));exports[_0xd613('0x3')]=function(_0x376edd){return client[_0xd613('0x4')](_0xd613('0x5'),{'body':_[_0xd613('0x6')](_0x376edd,{'source':_0x376edd[_0xd613('0x7')],'destinationcontext':_0x376edd[_0xd613('0x8')],'callerid':_0x376edd[_0xd613('0x9')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xd613('0xa')]=function(){return function(){return client[_0xd613('0x4')](_0xd613('0xb'),{'options':{'where':{'type':[_0xd613('0xc')],'createdAt':{'$between':[moment()[_0xd613('0xd')](_0xd613('0xe'))[_0xd613('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xd613('0x10')](_0xd613('0xe'))[_0xd613('0xf')](_0xd613('0x11'))]}},'attributes':[_0xd613('0x12'),_0xd613('0x13'),'duration',_0xd613('0x14')]},'log':_0xd613('0x15')});};}; \ No newline at end of file +var _0xbd3a=['day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf'];(function(_0x2e1b8d,_0x4f4bb8){var _0x2711ad=function(_0x5ba1bc){while(--_0x5ba1bc){_0x2e1b8d['push'](_0x2e1b8d['shift']());}};_0x2711ad(++_0x4f4bb8);}(_0xbd3a,0xe4));var _0xabd3=function(_0x2e82f6,_0x184558){_0x2e82f6=_0x2e82f6-0x0;var _0x52cddf=_0xbd3a[_0x2e82f6];return _0x52cddf;};'use strict';var moment=require(_0xabd3('0x0'));var util=require(_0xabd3('0x1'));var _=require(_0xabd3('0x2'));var client=require(_0xabd3('0x3'));exports[_0xabd3('0x4')]=function(_0xa4d31b){return client[_0xabd3('0x5')](_0xabd3('0x6'),{'body':_[_0xabd3('0x7')](_0xa4d31b,{'source':_0xa4d31b[_0xabd3('0x8')],'destinationcontext':_0xa4d31b['context'],'callerid':_0xa4d31b[_0xabd3('0x9')],'amaflags':_0xabd3('0xa')}),'log':_0xabd3('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xabd3('0xb'),{'options':{'where':{'type':[_0xabd3('0xc')],'createdAt':{'$between':[moment()[_0xabd3('0xd')](_0xabd3('0xe'))[_0xabd3('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xabd3('0x10')](_0xabd3('0xe'))[_0xabd3('0xf')](_0xabd3('0x11'))]}},'attributes':[_0xabd3('0x12'),_0xabd3('0x13'),_0xabd3('0x14'),'billableseconds']},'log':_0xabd3('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 164b4b1..b6f20c2 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 _0xa24b=['Request','CreateVoiceDialReport','../client'];(function(_0x27450d,_0x3d55d2){var _0x18b566=function(_0x2a9390){while(--_0x2a9390){_0x27450d['push'](_0x27450d['shift']());}};_0x18b566(++_0x3d55d2);}(_0xa24b,0x137));var _0xba24=function(_0x4cdf61,_0x38a75a){_0x4cdf61=_0x4cdf61-0x0;var _0x5d3f3c=_0xa24b[_0x4cdf61];return _0x5d3f3c;};'use strict';var client=require(_0xba24('0x0'));exports['create']=function(_0x6ccdcc){return client[_0xba24('0x1')](_0xba24('0x2'),{'body':_0x6ccdcc,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x51c9=['../client','create','Request'];(function(_0x502812,_0x2834e3){var _0x9fe255=function(_0x216d14){while(--_0x216d14){_0x502812['push'](_0x502812['shift']());}};_0x9fe255(++_0x2834e3);}(_0x51c9,0x1c8));var _0x951c=function(_0xe1c56d,_0x58efc8){_0xe1c56d=_0xe1c56d-0x0;var _0xeda395=_0x51c9[_0xe1c56d];return _0xeda395;};'use strict';var client=require(_0x951c('0x0'));exports[_0x951c('0x1')]=function(_0x2ac713){return client[_0x951c('0x2')]('CreateVoiceDialReport',{'body':_0x2ac713,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5018ecf..3c2f7f0 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 _0xe9ad=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x3a22ae,_0x1cae81){var _0x1c5332=function(_0x33ab02){while(--_0x33ab02){_0x3a22ae['push'](_0x3a22ae['shift']());}};_0x1c5332(++_0x1cae81);}(_0xe9ad,0x82));var _0xde9a=function(_0x5becd6,_0x13e651){_0x5becd6=_0x5becd6-0x0;var _0x3b7b78=_0xe9ad[_0x5becd6];return _0x3b7b78;};'use strict';var client=require(_0xde9a('0x0'));exports[_0xde9a('0x1')]=function(){return function(){return client[_0xde9a('0x2')](_0xde9a('0x3'),{'options':{'raw':!![],'attributes':['id',_0xde9a('0x4'),_0xde9a('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xde9a('0x1')});};}; \ No newline at end of file +var _0x6e16=['exten','getVoiceExtensions','Request'];(function(_0x399aac,_0x162856){var _0x2b902e=function(_0x5a7115){while(--_0x5a7115){_0x399aac['push'](_0x399aac['shift']());}};_0x2b902e(++_0x162856);}(_0x6e16,0x1d3));var _0x66e1=function(_0x1d5424,_0xfa6434){_0x1d5424=_0x1d5424-0x0;var _0x3e78c6=_0x6e16[_0x1d5424];return _0x3e78c6;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x66e1('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x66e1('0x1'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x66e1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 113ddf9..b872ddb 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 _0xc0f3=['callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','name'];(function(_0x180a60,_0x11d0e3){var _0xf37e5c=function(_0x7c7ea2){while(--_0x7c7ea2){_0x180a60['push'](_0x180a60['shift']());}};_0xf37e5c(++_0x11d0e3);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0f3[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x3c0f('0x0')]=function(){return function(){return client[_0x3c0f('0x1')](_0x3c0f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3c0f('0x3'),'acwTimeout','autopause',_0x3c0f('0x4'),_0x3c0f('0x5'),_0x3c0f('0x6'),_0x3c0f('0x7'),_0x3c0f('0x8'),'dialLimitQueue',_0x3c0f('0x9'),_0x3c0f('0xa'),_0x3c0f('0xb'),_0x3c0f('0xc'),'dialOriginateCallerIdName',_0x3c0f('0xd'),_0x3c0f('0xe'),_0x3c0f('0xf'),_0x3c0f('0x10'),_0x3c0f('0x11'),'dialCongestionMaxRetry',_0x3c0f('0x12'),_0x3c0f('0x13'),_0x3c0f('0x14'),_0x3c0f('0x15'),'dialNoAnswerRetryFrequency',_0x3c0f('0x16'),_0x3c0f('0x17'),_0x3c0f('0x18'),_0x3c0f('0x19'),_0x3c0f('0x1a'),_0x3c0f('0x1b'),'dialAMDInitialSilence',_0x3c0f('0x1c'),_0x3c0f('0x1d'),'dialAMDTotalAnalysisTime',_0x3c0f('0x1e'),_0x3c0f('0x1f'),_0x3c0f('0x20'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x3c0f('0x21'),_0x3c0f('0x22'),'dialRecallInQueue',_0x3c0f('0x23'),_0x3c0f('0x24'),_0x3c0f('0x25'),_0x3c0f('0x26'),_0x3c0f('0x4'),'strategy','dialRandomLastDigitCallerIdNumber',_0x3c0f('0x27'),_0x3c0f('0x28'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0x3c0f('0x29'),_0x3c0f('0x2a'),_0x3c0f('0x2b'),'dialMachineRetryFrequency',_0x3c0f('0x2c'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x3c0f('0x2d'),_0x3c0f('0x2e'),'dialPreviewAutoRecallMe',_0x3c0f('0x2f')],'include':[{'model':_0x3c0f('0x30'),'as':_0x3c0f('0x30'),'attributes':['id',_0x3c0f('0x31'),_0x3c0f('0x32'),_0x3c0f('0x33')]},{'model':_0x3c0f('0x34'),'as':_0x3c0f('0x35'),'attributes':['id',_0x3c0f('0x31')]},{'model':_0x3c0f('0x30'),'as':_0x3c0f('0x36'),'attributes':['id',_0x3c0f('0x31'),_0x3c0f('0x32'),_0x3c0f('0x33')]},{'model':_0x3c0f('0x37'),'as':_0x3c0f('0x37'),'attributes':['id',_0x3c0f('0x31')],'include':[{'model':_0x3c0f('0x37'),'as':_0x3c0f('0x38'),'attributes':['id',_0x3c0f('0x31'),_0x3c0f('0x39')]}]}]},'log':_0x3c0f('0x0')});};}; \ No newline at end of file +var _0x6c13=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialOriginateCallerIdNumber','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x4cd14a,_0x3c08b4){var _0x59ac6a=function(_0x5d95ec){while(--_0x5d95ec){_0x4cd14a['push'](_0x4cd14a['shift']());}};_0x59ac6a(++_0x3c08b4);}(_0x6c13,0xa2));var _0x36c1=function(_0x24984a,_0x10fb2d){_0x24984a=_0x24984a-0x0;var _0x405c82=_0x6c13[_0x24984a];return _0x405c82;};'use strict';var client=require(_0x36c1('0x0'));exports[_0x36c1('0x1')]=function(){return function(){return client[_0x36c1('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x36c1('0x3'),'acw','acwTimeout',_0x36c1('0x4'),_0x36c1('0x5'),'type',_0x36c1('0x6'),_0x36c1('0x7'),_0x36c1('0x8'),_0x36c1('0x9'),'dialPowerLevel',_0x36c1('0xa'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0x36c1('0xb'),'dialOriginateTimeout',_0x36c1('0xc'),'dialQueueTimeout','dialQueueProject',_0x36c1('0xd'),_0x36c1('0xe'),_0x36c1('0xf'),_0x36c1('0x10'),_0x36c1('0x11'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x36c1('0x12'),'dialGlobalInterval',_0x36c1('0x13'),_0x36c1('0x14'),_0x36c1('0x15'),_0x36c1('0x16'),_0x36c1('0x17'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x36c1('0x18'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x36c1('0x19'),'timeout',_0x36c1('0x1a'),_0x36c1('0x1b'),_0x36c1('0x1c'),_0x36c1('0x1d'),'dialAgiAfterHangupClient',_0x36c1('0x1e'),_0x36c1('0x5'),'strategy',_0x36c1('0x1f'),_0x36c1('0x20'),_0x36c1('0x21'),'dialNoSuchNumberRetryFrequency',_0x36c1('0x22'),'dialDropRetryFrequency',_0x36c1('0x23'),_0x36c1('0x24'),_0x36c1('0x25'),_0x36c1('0x26'),_0x36c1('0x27'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x36c1('0x28'),_0x36c1('0x29'),'dialPreviewAutoRecallMe',_0x36c1('0x2a')],'include':[{'model':'Trunk','as':_0x36c1('0x2b'),'attributes':['id','name',_0x36c1('0x2c'),_0x36c1('0x2d')]},{'model':'Pause','as':_0x36c1('0x2e'),'attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x36c1('0x3'),'callerid',_0x36c1('0x2d')]},{'model':_0x36c1('0x2f'),'as':_0x36c1('0x2f'),'attributes':['id',_0x36c1('0x3')],'include':[{'model':'Interval','as':_0x36c1('0x30'),'attributes':['id',_0x36c1('0x3'),_0x36c1('0x31')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 05b8fc8..0353e7f 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(_0x31ddb0,_0x261044){var _0x3f9d79=function(_0x34bcaf){while(--_0x34bcaf){_0x31ddb0['push'](_0x31ddb0['shift']());}};_0x3f9d79(++_0x261044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x166372,_0x135912){var _0x2d147e=function(_0x1bbb00){while(--_0x1bbb00){_0x166372['push'](_0x166372['shift']());}};_0x2d147e(++_0x135912);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 6d586e5..e2fa557 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 _0x9f9e=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x1cc551,_0x546124){var _0x2bd073=function(_0x1854f3){while(--_0x1854f3){_0x1cc551['push'](_0x1cc551['shift']());}};_0x2bd073(++_0x546124);}(_0x9f9e,0x10f));var _0xe9f9=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0x9f9e[_0x3a9635];return _0x10d08c;};'use strict';var client=require(_0xe9f9('0x0'));exports[_0xe9f9('0x1')]=function(_0x56eb54){return function(){return client[_0xe9f9('0x2')](_0xe9f9('0x3'),{'options':{'where':{'VoiceQueueId':_0x56eb54,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x1a6b=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x1c8937,_0x476ee1){var _0x463aa6=function(_0x152bf0){while(--_0x152bf0){_0x1c8937['push'](_0x1c8937['shift']());}};_0x463aa6(++_0x476ee1);}(_0x1a6b,0x188));var _0xb1a6=function(_0x10db52,_0x4497bf){_0x10db52=_0x10db52-0x0;var _0x30d887=_0x1a6b[_0x10db52];return _0x30d887;};'use strict';var client=require(_0xb1a6('0x0'));exports[_0xb1a6('0x1')]=function(_0x5cb239){return function(){return client[_0xb1a6('0x2')](_0xb1a6('0x3'),{'options':{'where':{'VoiceQueueId':_0x5cb239,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 73b982f..912d101 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x35a934,_0x3d7cd3){var _0x46d520=function(_0x45d464){while(--_0x45d464){_0x35a934['push'](_0x35a934['shift']());}};_0x46d520(++_0x3d7cd3);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1e5816,_0xbc1c3f){var _0x3faf63=function(_0x403d66){while(--_0x403d66){_0x1e5816['push'](_0x1e5816['shift']());}};_0x3faf63(++_0xbc1c3f);}(_0x7a54,0x106));var _0x47a5=function(_0x196897,_0x49df81){_0x196897=_0x196897-0x0;var _0xc69f9=_0x7a54[_0x196897];return _0xc69f9;};'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 c39f90b..e556654 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 _0x192a=['attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','origtransfererexten'];(function(_0x23fcec,_0x48ec4c){var _0x447567=function(_0x4781bb){while(--_0x4781bb){_0x23fcec['push'](_0x23fcec['shift']());}};_0x447567(++_0x48ec4c);}(_0x192a,0x151));var _0xa192=function(_0x11c657,_0x370939){_0x11c657=_0x11c657-0x0;var _0x5e62af=_0x192a[_0x11c657];return _0x5e62af;};'use strict';var client=require(_0xa192('0x0'));exports[_0xa192('0x1')]={};exports[_0xa192('0x2')]=function(_0x27e52d){return client[_0xa192('0x3')](_0xa192('0x4'),{'body':{'result':_0x27e52d['result'],'transfererchannel':_0x27e52d['transfererchannel'],'transferercalleridnum':_0x27e52d[_0xa192('0x5')],'transferercalleridname':_0x27e52d[_0xa192('0x6')],'transfererconnectedlinenum':_0x27e52d[_0xa192('0x7')],'transfererconnectedlinename':_0x27e52d[_0xa192('0x8')],'transfereraccountcode':_0x27e52d[_0xa192('0x9')],'transferercontext':_0x27e52d['transferercontext'],'transfererexten':_0x27e52d[_0xa192('0xa')],'transfererlinkedid':_0x27e52d[_0xa192('0xb')],'transfereechannel':_0x27e52d[_0xa192('0xc')],'transfereecalleridnum':_0x27e52d[_0xa192('0xd')],'transfereecalleridname':_0x27e52d[_0xa192('0xe')],'transfereeconnectedlinenum':_0x27e52d[_0xa192('0xf')],'transfereeconnectedlinename':_0x27e52d[_0xa192('0x10')],'transfereeaccountcode':_0x27e52d[_0xa192('0x11')],'transfereecontext':_0x27e52d[_0xa192('0x12')],'transfereeexten':_0x27e52d[_0xa192('0x13')],'transfereelinkedid':_0x27e52d[_0xa192('0x14')],'isexternal':_0x27e52d['isexternal'],'context':_0x27e52d['context'],'extension':_0x27e52d[_0xa192('0x15')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xa192('0x16')]=function(_0x158c78){return client[_0xa192('0x3')](_0xa192('0x4'),{'body':{'result':_0x158c78[_0xa192('0x17')],'transfererchannel':_0x158c78[_0xa192('0x18')],'transferercalleridnum':_0x158c78['origtransferercalleridnum'],'transferercalleridname':_0x158c78[_0xa192('0x19')],'transfererconnectedlinenum':_0x158c78[_0xa192('0x1a')],'transfererconnectedlinename':_0x158c78[_0xa192('0x1b')],'transfereraccountcode':_0x158c78['origtransfereraccountcode'],'transferercontext':_0x158c78[_0xa192('0x1c')],'transfererexten':_0x158c78[_0xa192('0x1d')],'transfererlinkedid':_0x158c78[_0xa192('0x1e')],'transfereechannel':_0x158c78['transfertargetchannel'],'transfereecalleridnum':_0x158c78[_0xa192('0x1f')],'transfereecalleridname':_0x158c78[_0xa192('0x20')],'transfereeconnectedlinenum':_0x158c78[_0xa192('0x21')],'transfereeconnectedlinename':_0x158c78[_0xa192('0x22')],'transfereeaccountcode':_0x158c78[_0xa192('0x23')],'transfereecontext':_0x158c78[_0xa192('0x24')],'transfereeexten':_0x158c78[_0xa192('0x25')],'transfereelinkedid':_0x158c78['transfertargetlinkedid'],'isexternal':_0x158c78[_0xa192('0x26')],'context':_0x158c78[_0xa192('0x27')],'extension':_0x158c78[_0xa192('0x28')],'type':_0xa192('0x29')},'log':_0xa192('0x4')});}; \ No newline at end of file +var _0x95c7=['origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','CreateVoiceTransferReport','origtransferercalleridnum'];(function(_0x4102e0,_0x3217bd){var _0x112b0e=function(_0x350e3d){while(--_0x350e3d){_0x4102e0['push'](_0x4102e0['shift']());}};_0x112b0e(++_0x3217bd);}(_0x95c7,0x115));var _0x795c=function(_0x37cd44,_0x547741){_0x37cd44=_0x37cd44-0x0;var _0x5b774c=_0x95c7[_0x37cd44];return _0x5b774c;};'use strict';var client=require('../client');exports[_0x795c('0x0')]={};exports[_0x795c('0x1')]=function(_0x508e75){return client[_0x795c('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x508e75['result'],'transfererchannel':_0x508e75['transfererchannel'],'transferercalleridnum':_0x508e75[_0x795c('0x3')],'transferercalleridname':_0x508e75[_0x795c('0x4')],'transfererconnectedlinenum':_0x508e75['transfererconnectedlinenum'],'transfererconnectedlinename':_0x508e75[_0x795c('0x5')],'transfereraccountcode':_0x508e75[_0x795c('0x6')],'transferercontext':_0x508e75[_0x795c('0x7')],'transfererexten':_0x508e75['transfererexten'],'transfererlinkedid':_0x508e75['transfererlinkedid'],'transfereechannel':_0x508e75[_0x795c('0x8')],'transfereecalleridnum':_0x508e75[_0x795c('0x9')],'transfereecalleridname':_0x508e75['transfereecalleridname'],'transfereeconnectedlinenum':_0x508e75[_0x795c('0xa')],'transfereeconnectedlinename':_0x508e75[_0x795c('0xb')],'transfereeaccountcode':_0x508e75[_0x795c('0xc')],'transfereecontext':_0x508e75[_0x795c('0xd')],'transfereeexten':_0x508e75[_0x795c('0xe')],'transfereelinkedid':_0x508e75['transfereelinkedid'],'isexternal':_0x508e75[_0x795c('0xf')],'context':_0x508e75[_0x795c('0x10')],'extension':_0x508e75[_0x795c('0x11')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x5b3a08){return client['Request'](_0x795c('0x12'),{'body':{'result':_0x5b3a08['result'],'transfererchannel':_0x5b3a08['origtransfererchannel'],'transferercalleridnum':_0x5b3a08[_0x795c('0x13')],'transferercalleridname':_0x5b3a08[_0x795c('0x14')],'transfererconnectedlinenum':_0x5b3a08['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5b3a08[_0x795c('0x15')],'transfereraccountcode':_0x5b3a08[_0x795c('0x16')],'transferercontext':_0x5b3a08['secondtransferercontext'],'transfererexten':_0x5b3a08[_0x795c('0x17')],'transfererlinkedid':_0x5b3a08['origtransfererlinkedid'],'transfereechannel':_0x5b3a08[_0x795c('0x18')],'transfereecalleridnum':_0x5b3a08[_0x795c('0x19')],'transfereecalleridname':_0x5b3a08[_0x795c('0x1a')],'transfereeconnectedlinenum':_0x5b3a08[_0x795c('0x1b')],'transfereeconnectedlinename':_0x5b3a08[_0x795c('0x1c')],'transfereeaccountcode':_0x5b3a08['transfertargetaccountcode'],'transfereecontext':_0x5b3a08[_0x795c('0x1d')],'transfereeexten':_0x5b3a08[_0x795c('0x1e')],'transfereelinkedid':_0x5b3a08['transfertargetlinkedid'],'isexternal':_0x5b3a08[_0x795c('0xf')],'context':_0x5b3a08[_0x795c('0x1f')],'extension':_0x5b3a08[_0x795c('0x20')],'type':'attended'},'log':_0x795c('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ad86783..a726450 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x3bffc8,_0x4e0cc7){var _0x2937bc=function(_0x432a6f){while(--_0x432a6f){_0x3bffc8['push'](_0x3bffc8['shift']());}};_0x2937bc(++_0x4e0cc7);}(_0x7a54,0x106));var _0x47a5=function(_0x2467d0,_0x279bdc){_0x2467d0=_0x2467d0-0x0;var _0x4fbce2=_0x7a54[_0x2467d0];return _0x4fbce2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _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(_0x4e89db,_0x200e43){var _0x25279c=function(_0x3e73c2){while(--_0x3e73c2){_0x4e89db['push'](_0x4e89db['shift']());}};_0x25279c(++_0x200e43);}(_0x7a54,0x106));var _0x47a5=function(_0x26eec0,_0x25356e){_0x26eec0=_0x26eec0-0x0;var _0x4f4297=_0x7a54[_0x26eec0];return _0x4f4297;};'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 1a09adc..e2f6d71 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 _0x85b0=['[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','firstName','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','action','toLowerCase','length','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','fax','createdAt','scheduledAt','union','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s'];(function(_0x13f520,_0x269ec1){var _0x61867c=function(_0x1434b4){while(--_0x1434b4){_0x13f520['push'](_0x13f520['shift']());}};_0x61867c(++_0x269ec1);}(_0x85b0,0x7f));var _0x085b=function(_0x332a67,_0x40a3ea){_0x332a67=_0x332a67-0x0;var _0x69828a=_0x85b0[_0x332a67];return _0x69828a;};'use strict';var _=require(_0x085b('0x0'));var BPromise=require(_0x085b('0x1'));var Redis=require('ioredis');var util=require(_0x085b('0x2'));var config=require(_0x085b('0x3'));var logger=require(_0x085b('0x4'))(_0x085b('0x5'));var cmContactRpc=require(_0x085b('0x6'));config[_0x085b('0x7')]=_[_0x085b('0x8')](config[_0x085b('0x7')],{'host':_0x085b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x085b('0x7')]));function emit(_0x50c638,_0x32cba9,_0x36f883,_0x208f28,_0x5828d1){logger[_0x085b('0xa')](_0x085b('0xb'),_0x50c638,_0x32cba9['id'],_0x36f883,_0x208f28,JSON[_0x085b('0xc')](_0x5828d1));io['to'](_0x36f883)['emit'](_0x208f28,_0x5828d1);}exports['exec']=function(_0x451ba8,_0x1868a1,_0x161be2,_0x3cb024){var _0x2eae03,_0x26923b;var _0x362ae9={};var _0x2defdc;var _0x49c5cf=Number(_0x161be2[_0x085b('0xd')]);var _0x3e8acb=_0x161be2['data2']?Boolean(Number(_0x161be2[_0x085b('0xe')])):![];var _0x51c82f;var _0x494e68=![];if(!_[_0x085b('0xf')](_0x161be2['data5'])){if(_0x161be2[_0x085b('0x10')]=='1')_0x494e68=!![];}if(!_0x494e68){if(_0x3cb024[_0x085b('0x11')]){_0x362ae9['id']=_0x3cb024['xmd-contactid'];}}if(!_0x362ae9['id']){_0x362ae9[_0x085b('0x12')]=_0x49c5cf;_0x51c82f=_0x161be2[_0x085b('0x13')]&&_0x161be2[_0x085b('0x13')]!=='0'?_0x161be2['data3'][_0x085b('0x14')](','):[_0x085b('0x15')];_0x362ae9[_0x085b('0x16')]=_[_0x085b('0x17')](_0x51c82f,function(_0x5ecd46){var _0x574afe={};_0x574afe[_0x5ecd46]=_0x3cb024[_0x085b('0x18')]?_0x3cb024[_0x085b('0x19')]:_0x3cb024[_0x085b('0x1a')];return _0x574afe;});_0x2defdc=_0x3cb024[_0x085b('0x18')]?_0x3cb024[_0x085b('0x19')]:_0x3cb024[_0x085b('0x1a')];}var _0xc20181=['id','firstName',_0x085b('0x1b'),_0x085b('0x15'),'mobile',_0x085b('0x1c'),_0x085b('0x12'),_0x085b('0x1d'),_0x085b('0x1e'),'updatedAt'];var _0x2db204=_[_0x085b('0x1f')](_0xc20181,_0x51c82f);BPromise['resolve']()[_0x085b('0x20')](cmContactRpc[_0x085b('0x21')]({'attributes':_0x2db204,'where':_0x362ae9,'phone':_0x2defdc}))[_0x085b('0x20')](function(_0x59f8d1){_0x26923b=_0x59f8d1;if(!_['isEmpty'](_0x26923b)){if(_0x26923b['length']===0x1){_0x2eae03=_0x26923b[0x0];logger[_0x085b('0xa')](_0x085b('0x22'),_0x3cb024['uniqueid'],_0x1868a1['id'],_0x2eae03['id']);}else{logger[_0x085b('0xa')](_0x085b('0x23'),_0x3cb024[_0x085b('0x24')],_0x1868a1['id'],_[_0x085b('0x17')](_0x26923b,'id')[_0x085b('0x25')](','));}return;}else{logger[_0x085b('0xa')](_0x085b('0x26'),_0x3cb024[_0x085b('0x24')],_0x1868a1['id']);var _0x30ab8d={'ListId':_0x49c5cf};var _0x38dbac=_0x161be2[_0x085b('0x27')]&&_0x161be2['data4']!=='0'?_0x161be2[_0x085b('0x27')]:_0x085b('0x15');if(_0x3e8acb){logger[_0x085b('0xa')](_0x085b('0x28'),_0x3cb024[_0x085b('0x24')],_0x1868a1['id']);_0x30ab8d[_0x38dbac]=_[_0x085b('0xf')](_0x3cb024[_0x085b('0x18')])?_0x3cb024['calleridnum']:_0x3cb024[_0x085b('0x19')];if(_[_0x085b('0xf')](_0x3cb024[_0x085b('0x18')])){_0x30ab8d['firstName']=_0x3cb024[_0x085b('0x29')]&&_0x3cb024[_0x085b('0x29')]!==_0x085b('0x2a')?_0x3cb024[_0x085b('0x29')]:_0x085b('0x2b');}else{_0x30ab8d[_0x085b('0x2c')]=_0x3cb024[_0x085b('0x2d')]&&_0x3cb024[_0x085b('0x2d')]!==''?_0x3cb024[_0x085b('0x2d')]:_0x085b('0x2b');}return BPromise[_0x085b('0x2e')]()[_0x085b('0x20')](cmContactRpc[_0x085b('0x2f')](_0x30ab8d))[_0x085b('0x20')](function(_0x25b30f){_0x2eae03=_0x25b30f;_0x26923b[_0x085b('0x30')](_0x25b30f);if(_0x2eae03){logger[_0x085b('0xa')](_0x085b('0x31'),_0x3cb024[_0x085b('0x24')],_0x1868a1['id'],_0x2eae03['id']);}return;});}else{logger[_0x085b('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x3cb024[_0x085b('0x24')],_0x1868a1['id']);_0x30ab8d[_0x38dbac]=_[_0x085b('0xf')](_0x3cb024['routeId'])?_0x3cb024['calleridnum']:_0x3cb024['destcalleridnum'];if(_[_0x085b('0xf')](_0x3cb024[_0x085b('0x18')])){_0x30ab8d['firstName']=_0x3cb024[_0x085b('0x29')]&&_0x3cb024['calleridname']!==''?_0x3cb024['calleridname']:_0x085b('0x2b');}else{_0x30ab8d[_0x085b('0x2c')]=_0x3cb024[_0x085b('0x2d')]&&_0x3cb024['destcalleridname']!==_0x085b('0x2a')?_0x3cb024[_0x085b('0x2d')]:'Unknown';}_0x2eae03=_0x30ab8d;_0x26923b['push'](_0x30ab8d);return;}}})[_0x085b('0x20')](function(){if(_0x451ba8){emit(_0x3cb024['uniqueid'],_0x1868a1,util[_0x085b('0x32')]('user:%s',_0x451ba8['name']),util[_0x085b('0x32')]('trigger:%s',_0x161be2[_0x085b('0x33')][_0x085b('0x34')]()),{'evt':_['merge'](_0x3cb024,{'autoCreate':_0x3e8acb}),'contact':_0x2eae03===undefined?{}:_0x2eae03,'contacts':_0x26923b[_0x085b('0x35')]===0x0?undefined:_0x26923b});}});}; \ No newline at end of file +var _0x5ff0=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','name','trigger:%s','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','routeId','destcalleridnum','calleridnum','firstName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','uniqueid','join'];(function(_0x16a946,_0x5bdc4e){var _0x46418a=function(_0x5154fc){while(--_0x5154fc){_0x16a946['push'](_0x16a946['shift']());}};_0x46418a(++_0x5bdc4e);}(_0x5ff0,0xad));var _0x05ff=function(_0x2c3b81,_0x4090f6){_0x2c3b81=_0x2c3b81-0x0;var _0x265d1a=_0x5ff0[_0x2c3b81];return _0x265d1a;};'use strict';var _=require(_0x05ff('0x0'));var BPromise=require(_0x05ff('0x1'));var Redis=require(_0x05ff('0x2'));var util=require(_0x05ff('0x3'));var config=require(_0x05ff('0x4'));var logger=require('../../../../config/logger')(_0x05ff('0x5'));var cmContactRpc=require(_0x05ff('0x6'));config[_0x05ff('0x7')]=_[_0x05ff('0x8')](config[_0x05ff('0x7')],{'host':_0x05ff('0x9'),'port':0x18eb});var io=require(_0x05ff('0xa'))(new Redis(config[_0x05ff('0x7')]));function emit(_0x2b7fd8,_0x565dd5,_0x46eab9,_0x783754,_0x5f3e1a){logger[_0x05ff('0xb')]('[CM][%s][%s]',_0x2b7fd8,_0x565dd5['id'],_0x46eab9,_0x783754,JSON[_0x05ff('0xc')](_0x5f3e1a));io['to'](_0x46eab9)[_0x05ff('0xd')](_0x783754,_0x5f3e1a);}exports['exec']=function(_0xa68313,_0x5de34f,_0x3a9239,_0x450531){var _0x53f528,_0x1919f3;var _0x4ad35f={};var _0x48c409;var _0x5b8b1a=Number(_0x3a9239[_0x05ff('0xe')]);var _0x5f1066=_0x3a9239[_0x05ff('0xf')]?Boolean(Number(_0x3a9239[_0x05ff('0xf')])):![];var _0xf08782;var _0x449ac3=![];if(!_[_0x05ff('0x10')](_0x3a9239[_0x05ff('0x11')])){if(_0x3a9239[_0x05ff('0x11')]=='1')_0x449ac3=!![];}if(!_0x449ac3){if(_0x450531['xmd-contactid']){_0x4ad35f['id']=_0x450531[_0x05ff('0x12')];}}if(!_0x4ad35f['id']){_0x4ad35f[_0x05ff('0x13')]=_0x5b8b1a;_0xf08782=_0x3a9239[_0x05ff('0x14')]&&_0x3a9239['data3']!=='0'?_0x3a9239[_0x05ff('0x14')]['split'](','):['phone'];_0x4ad35f['$or']=_['map'](_0xf08782,function(_0x3a4d1b){var _0x5a8a7d={};_0x5a8a7d[_0x3a4d1b]=_0x450531[_0x05ff('0x15')]?_0x450531[_0x05ff('0x16')]:_0x450531[_0x05ff('0x17')];return _0x5a8a7d;});_0x48c409=_0x450531['routeId']?_0x450531['destcalleridnum']:_0x450531['calleridnum'];}var _0xbe482e=['id',_0x05ff('0x18'),'lastName',_0x05ff('0x19'),_0x05ff('0x1a'),_0x05ff('0x1b'),_0x05ff('0x13'),_0x05ff('0x1c'),_0x05ff('0x1d'),_0x05ff('0x1e')];var _0xa018fb=_[_0x05ff('0x1f')](_0xbe482e,_0xf08782);BPromise[_0x05ff('0x20')]()[_0x05ff('0x21')](cmContactRpc[_0x05ff('0x22')]({'attributes':_0xa018fb,'where':_0x4ad35f,'phone':_0x48c409}))[_0x05ff('0x21')](function(_0x538b80){_0x1919f3=_0x538b80;if(!_[_0x05ff('0x23')](_0x1919f3)){if(_0x1919f3[_0x05ff('0x24')]===0x1){_0x53f528=_0x1919f3[0x0];logger[_0x05ff('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x450531[_0x05ff('0x25')],_0x5de34f['id'],_0x53f528['id']);}else{logger[_0x05ff('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x450531[_0x05ff('0x25')],_0x5de34f['id'],_['map'](_0x1919f3,'id')[_0x05ff('0x26')](','));}return;}else{logger[_0x05ff('0xb')](_0x05ff('0x27'),_0x450531['uniqueid'],_0x5de34f['id']);var _0x473e30={'ListId':_0x5b8b1a};var _0x4f10c1=_0x3a9239[_0x05ff('0x28')]&&_0x3a9239[_0x05ff('0x28')]!=='0'?_0x3a9239['data4']:_0x05ff('0x19');if(_0x5f1066){logger[_0x05ff('0xb')](_0x05ff('0x29'),_0x450531[_0x05ff('0x25')],_0x5de34f['id']);_0x473e30[_0x4f10c1]=_[_0x05ff('0x10')](_0x450531['routeId'])?_0x450531[_0x05ff('0x17')]:_0x450531[_0x05ff('0x16')];if(_['isNil'](_0x450531[_0x05ff('0x15')])){_0x473e30[_0x05ff('0x18')]=_0x450531[_0x05ff('0x2a')]&&_0x450531['calleridname']!==_0x05ff('0x2b')?_0x450531[_0x05ff('0x2a')]:'Unknown';}else{_0x473e30['firstName']=_0x450531[_0x05ff('0x2c')]&&_0x450531[_0x05ff('0x2c')]!==_0x05ff('0x2b')?_0x450531['destcalleridname']:'Unknown';}return BPromise[_0x05ff('0x20')]()[_0x05ff('0x21')](cmContactRpc[_0x05ff('0x2d')](_0x473e30))[_0x05ff('0x21')](function(_0x1c0765){_0x53f528=_0x1c0765;_0x1919f3[_0x05ff('0x2e')](_0x1c0765);if(_0x53f528){logger[_0x05ff('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x450531[_0x05ff('0x25')],_0x5de34f['id'],_0x53f528['id']);}return;});}else{logger[_0x05ff('0xb')](_0x05ff('0x2f'),_0x450531[_0x05ff('0x25')],_0x5de34f['id']);_0x473e30[_0x4f10c1]=_[_0x05ff('0x10')](_0x450531['routeId'])?_0x450531[_0x05ff('0x17')]:_0x450531['destcalleridnum'];if(_[_0x05ff('0x10')](_0x450531[_0x05ff('0x15')])){_0x473e30[_0x05ff('0x18')]=_0x450531[_0x05ff('0x2a')]&&_0x450531['calleridname']!==_0x05ff('0x2b')?_0x450531[_0x05ff('0x2a')]:_0x05ff('0x30');}else{_0x473e30[_0x05ff('0x18')]=_0x450531[_0x05ff('0x2c')]&&_0x450531[_0x05ff('0x2c')]!==_0x05ff('0x2b')?_0x450531['destcalleridname']:_0x05ff('0x30');}_0x53f528=_0x473e30;_0x1919f3[_0x05ff('0x2e')](_0x473e30);return;}}})[_0x05ff('0x21')](function(){if(_0xa68313){emit(_0x450531['uniqueid'],_0x5de34f,util[_0x05ff('0x31')](_0x05ff('0x32'),_0xa68313[_0x05ff('0x33')]),util[_0x05ff('0x31')](_0x05ff('0x34'),_0x3a9239['action']['toLowerCase']()),{'evt':_['merge'](_0x450531,{'autoCreate':_0x5f1066}),'contact':_0x53f528===undefined?{}:_0x53f528,'contacts':_0x1919f3[_0x05ff('0x24')]===0x0?undefined:_0x1919f3});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3f89539..966f486 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 _0x1b03=['localhost','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','debug','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','location','data4','windowWidth','data5','data6','winArguments','format','name','trigger:%s:%s','action','jscripty','user:%s','trigger:%s','exec','queue','routeId','urlforward','parse','query','search','replace','channel','AllConditions','every','AnyConditions','some','checkConditions','checkTrigger:\x20trigger','inspect','evt','chat','ChatWebsiteId','operator','upperFirst','AccountId','value','message','event','agent','membername','lastevent','null','substatus','offlineMessage','created','equals','exports','lodash','url','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults'];(function(_0x5c7e42,_0x3d252b){var _0x100eae=function(_0x2d042f){while(--_0x2d042f){_0x5c7e42['push'](_0x5c7e42['shift']());}};_0x100eae(++_0x3d252b);}(_0x1b03,0xef));var _0x31b0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1b03[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var _=require(_0x31b0('0x0'));var url=require(_0x31b0('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x31b0('0x2'));var integration=require(_0x31b0('0x3'));var cmContact=require(_0x31b0('0x4'));var script=require('./script');var config=require(_0x31b0('0x5'));var logger=require(_0x31b0('0x6'))(_0x31b0('0x7'));var ami=require(_0x31b0('0x8'));config[_0x31b0('0x9')]=_[_0x31b0('0xa')](config[_0x31b0('0x9')],{'host':_0x31b0('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x31b0('0x9')]));var operators={'equals':function(_0x21c3c6,_0x1cad6c){return _0x21c3c6==_0x1cad6c;},'not_equals':function(_0x2e0844,_0x18ce20){return _0x2e0844!=_0x18ce20;}};var barAndWebActions=['popup',_0x31b0('0x1'),_0x31b0('0xc')];function Trigger(_0x46ebd8){this[_0x31b0('0xd')]=_0x46ebd8[_0x31b0('0xd')];this[_0x31b0('0xe')]=_0x46ebd8[_0x31b0('0xe')];this[_0x31b0('0xf')]=_0x46ebd8['voiceQueues'];this[_0x31b0('0x10')]=_0x46ebd8[_0x31b0('0x10')];this[_0x31b0('0x11')]=_0x46ebd8[_0x31b0('0x11')];this[_0x31b0('0x12')]=_0x46ebd8[_0x31b0('0x12')];this['freshdeskAccounts']=_0x46ebd8[_0x31b0('0x13')];this[_0x31b0('0x14')]=_0x46ebd8[_0x31b0('0x14')];this[_0x31b0('0x15')]=_0x46ebd8['sugarcrmAccounts'];this[_0x31b0('0x16')]=_0x46ebd8[_0x31b0('0x16')];this[_0x31b0('0x17')]=_0x46ebd8['deskAccounts'];this[_0x31b0('0x18')]=_0x46ebd8[_0x31b0('0x18')];this['servicenowAccounts']=_0x46ebd8[_0x31b0('0x19')];this[_0x31b0('0x1a')]=_0x46ebd8[_0x31b0('0x1a')];this[_0x31b0('0x1b')]=_0x46ebd8['freshsalesAccounts'];this[_0x31b0('0x1c')]={'zendesk':this[_0x31b0('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x31b0('0x13')],'sugarcrm':this[_0x31b0('0x15')],'zoho':this[_0x31b0('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0x31b0('0x18')],'dynamics365':this[_0x31b0('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x31b0('0x19')]};ami['on']('custom:agentcalled',this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on']('custom:agentconnect',this[_0x31b0('0x1d')]['bind'](this));ami['on'](_0x31b0('0x1f'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x20'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x21'),this[_0x31b0('0x1d')]['bind'](this));ami['on'](_0x31b0('0x22'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x23'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on']('custom:agentcongestion',this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x24'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on']('custom:amd',this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x25'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x26'),this[_0x31b0('0x27')]['bind'](this));ami['on'](_0x31b0('0x28'),this[_0x31b0('0x27')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x29'),this[_0x31b0('0x27')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x2a'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on']('custom:closedinteraction',this[_0x31b0('0x1d')]['bind'](this));ami['on'](_0x31b0('0x2b'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x2c'),this['syncCustomEvent'][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x2d'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on'](_0x31b0('0x2e'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));ami['on']('custom:rejectmessage',this[_0x31b0('0x1d')]['bind'](this));ami['on'](_0x31b0('0x2f'),this[_0x31b0('0x1d')][_0x31b0('0x1e')](this));}Trigger[_0x31b0('0x30')][_0x31b0('0x31')]=function(_0x54f2ee,_0x2ed234,_0x170d31){logger[_0x31b0('0x32')](_0x54f2ee,_0x2ed234,JSON['stringify'](_0x170d31));io['to'](_0x54f2ee)[_0x31b0('0x31')](_0x2ed234,_0x170d31);};Trigger['prototype'][_0x31b0('0x1d')]=function(_0x26ebbc){var _0x47ccec=_[_0x31b0('0x33')](_0x26ebbc);if(typeof _0x47ccec[_0x31b0('0x34')]===_0x31b0('0x35')){_0x47ccec[_0x31b0('0x34')]=_0x31b0('0x36');}logger[_0x31b0('0x37')]('syncCustomEvent',util['inspect'](_0x47ccec,{'showHidden':!![],'depth':null}));this[_0x31b0('0x38')](_0x47ccec);};Trigger[_0x31b0('0x30')][_0x31b0('0x27')]=function(_0x51f366){if(this[_0x31b0('0xe')][_0x51f366[_0x31b0('0x39')]]){this[_0x31b0('0x1d')](_0x51f366);}};Trigger['prototype']['checkTriggers']=function(_0x3bd424){var _0x267f82;for(var _0x29d9ed in this[_0x31b0('0xd')]){if(this[_0x31b0('0xd')][_0x31b0('0x3a')](_0x29d9ed)){if(this[_0x31b0('0xd')][_0x29d9ed]['status']){_0x267f82=this[_0x31b0('0x3b')](this[_0x31b0('0xd')][_0x29d9ed],_0x3bd424);if(_0x267f82){_[_0x31b0('0x3c')](_0x3bd424,_0x3bd424[_0x31b0('0x3d')]);for(var _0x2ef0d8=0x0,_0x562927,_0x1958e9,_0x1f0f4d;_0x2ef0d80x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x40d617,_0x2671ca){var _0x586c31=function(_0x4661b7){while(--_0x4661b7){_0x40d617['push'](_0x40d617['shift']());}};_0x586c31(++_0x2671ca);}(_0x3e74,0x175));var _0x43e7=function(_0x543ef6,_0x501299){_0x543ef6=_0x543ef6-0x0;var _0x542f57=_0x3e74[_0x543ef6];return _0x542f57;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 094c2bd..aac8914 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 _0x95d1=['trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\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','unmanaged','openNewTab','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','resolve','data5','POST','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','\x20eq\x20\x27','%2b',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','phonecall','queue','callDirection','phonecalls','Descriptions','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit'];(function(_0xec15d9,_0x53d85a){var _0x5875af=function(_0x53e5bc){while(--_0x53e5bc){_0xec15d9['push'](_0xec15d9['shift']());}};_0x5875af(++_0x53d85a);}(_0x95d1,0x84));var _0x195d=function(_0x5dede9,_0x251e16){_0x5dede9=_0x5dede9-0x0;var _0x1a3d15=_0x95d1[_0x5dede9];return _0x1a3d15;};'use strict';var _=require('lodash');var rp=require(_0x195d('0x0'));var util=require(_0x195d('0x1'));var intUtil=require('./util');var md5=require(_0x195d('0x2'));var Redis=require(_0x195d('0x3'));var logger=require(_0x195d('0x4'))(_0x195d('0x5'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0x195d('0x6'),'port':0x18eb});var io=require(_0x195d('0x7'))(new Redis(config['redis']));function getAuthToken(_0x34a091,_0x19ac4d,_0x4be2a4){if(_0x34a091[_0x195d('0x8')]){_0x34a091['remoteUri']=_0x34a091[_0x195d('0x9')][_0x195d('0xa')];_0x34a091[_0x195d('0xb')]=_0x34a091['CloudProvider']['data2'];return Promise[_0x195d('0xc')](_0x34a091[_0x195d('0x9')][_0x195d('0xd')]);}var _0x20b3fc={'method':_0x195d('0xe'),'uri':_0x19ac4d,'form':{'client_id':_0x34a091['clientId'],'resource':_0x34a091[_0x195d('0xf')],'username':_0x34a091[_0x195d('0x10')],'password':_0x34a091[_0x195d('0x11')],'grant_type':'password','client_secret':_0x34a091[_0x195d('0x12')]},'json':!![]};return rp(_0x20b3fc)[_0x195d('0x13')](function(_0x558516){return _0x558516[_0x195d('0x14')];})[_0x195d('0x15')](function(_0x28a83){logger['error']('['+[_0x4be2a4[_0x195d('0x16')]()]+_0x195d('0x17'));return _0x28a83[_0x195d('0x18')];});}function getUser(_0x40f3f7,_0x3b5bbf,_0x5343b7,_0x1b9b16,_0x40a439,_0x215f1a){return new Promise(function(_0x3b5aab,_0x439aa7){return getAuthToken(_0x3b5bbf,_0x1b9b16,_0x215f1a)[_0x195d('0x13')](function(_0x2cc0bd){var _0x5518dd={'method':_0x195d('0x19'),'uri':_0x40a439+_0x195d('0x1a'),'headers':{'Authorization':_0x195d('0x1b')+_0x2cc0bd,'OData-Version':_0x195d('0x1c')},'json':!![]};return rp(_0x5518dd);})['then'](function(_0x7735a0){var _0x34e0f8=_0x7735a0[_0x195d('0x1d')];var _0xce787d=![];var _0x464cf9=null;if(!_[_0x195d('0x1e')](_0x5343b7)){if(intUtil[_0x195d('0x1f')](_0x5343b7[_0x195d('0x20')])){_0x40f3f7[_0x195d('0x21')]=_0x5343b7[_0x195d('0x20')];for(_0x464cf9=0x0;_0x464cf9<_0x34e0f8[_0x195d('0x22')];_0x464cf9++){if(_0x34e0f8[_0x464cf9][_0x195d('0x23')]===_0x5343b7['email']&&!_0x34e0f8[_0x464cf9]['isdisabled']){_0xce787d=!![];logger[_0x195d('0x24')]('['+[_0x215f1a[_0x195d('0x16')]()]+_0x195d('0x25')+_0x34e0f8[_0x464cf9][_0x195d('0x26')]+'!');_0x40f3f7[_0x195d('0x27')]=_0x34e0f8[_0x464cf9][_0x195d('0x26')];}}}}if(!_0xce787d){logger[_0x195d('0x24')]('['+[_0x215f1a[_0x195d('0x16')]()]+_0x195d('0x28'));_0x40f3f7['userEmail']=_0x3b5bbf[_0x195d('0x10')];for(_0x464cf9=0x0;_0x464cf9<_0x34e0f8[_0x195d('0x22')];_0x464cf9++){if(_0x34e0f8[_0x464cf9][_0x195d('0x23')]===_0x3b5bbf[_0x195d('0x10')]){_0x40f3f7[_0x195d('0x27')]=_0x34e0f8[_0x464cf9][_0x195d('0x26')];}}}_0x3b5aab(_0x40f3f7);})[_0x195d('0x15')](function(_0x5d1393){_0x439aa7(_0x5d1393[_0x195d('0x18')]);});});}function createEndUser(_0x46af0a,_0x3587e9,_0xa9a37f,_0x220d80,_0x5c45e4,_0x41f4a6,_0x1a1021){return new Promise(function(_0x49b6fe,_0x1f8c90){return getAuthToken(_0x3587e9,_0xa9a37f,_0x41f4a6)[_0x195d('0x13')](function(_0x35ded0){var _0xa697c9=_0x41f4a6['toLowerCase']()===_0x195d('0x29')?_0x5c45e4[_0x195d('0x2a')]:_0x5c45e4[_0x195d('0x2b')];var _0x412892={'method':'POST','uri':_0x220d80+_0x195d('0x2c'),'body':{'fullname':_0xa697c9,'firstname':_0xa697c9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x195d('0x2d')+_0x46af0a[_0x195d('0x27')]+')'},'headers':{'Authorization':_0x195d('0x1b')+_0x35ded0,'OData-Version':_0x195d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x412892[_0x195d('0x2e')][_0x1a1021]=_0xa697c9;return rp(_0x412892);})[_0x195d('0x13')](function(_0x3229b7){var _0x114e41=_0x3229b7[_0x195d('0x2f')][_0x195d('0x30')];var _0x44c4b=_0x114e41[_0x195d('0x31')](_0x114e41[_0x195d('0x32')]('(')+0x1,_0x114e41[_0x195d('0x32')](')'));_0x46af0a[_0x195d('0x33')]=_0x44c4b;_0x49b6fe(_0x46af0a);})[_0x195d('0x15')](function(_0x1eecb1){_0x1f8c90(_0x1eecb1[_0x195d('0x18')]);});});}function getEndUser(_0x2009d4,_0x268691,_0x7d365a,_0x4f5200,_0x4778ca,_0x1b5e28,_0x3e1b01,_0x4ad281){var _0x5266e5=_0x1b5e28[_0x195d('0x34')]()===_0x195d('0x29')?_0x4778ca[_0x195d('0x2a')]:_0x4778ca[_0x195d('0x2b')];return getAuthToken(_0x268691,_0x7d365a,_0x1b5e28)['then'](function(_0x2e96ed){_0x4ad281=_0x4ad281?_0x4ad281:_0x195d('0x35');var _0x2bdfd6={'method':_0x195d('0x19'),'uri':_0x4f5200+_0x195d('0x36')+_0x4ad281+'&$filter='+_0x4ad281+_0x195d('0x37')+_0x5266e5['replace']('+',_0x195d('0x38'))+'\x27','headers':{'Authorization':_0x195d('0x1b')+_0x2e96ed,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2bdfd6);})['then'](function(_0x2cf4c9){var _0x3838c4=![];if(!_0x2cf4c9)return _0x3838c4;var _0x27a5bf=_0x2cf4c9['value'];for(var _0x1b53eb=0x0;_0x1b53eb<_0x27a5bf[_0x195d('0x22')];_0x1b53eb++){if(_0x27a5bf[_0x1b53eb][_0x4ad281]===_0x5266e5){_0x3838c4=!![];_0x2009d4[_0x195d('0x33')]=_0x27a5bf[_0x1b53eb]['contactid'];}}return _0x3838c4;})['then'](function(_0x21a8fb){if(_0x21a8fb)return _0x2009d4;if(_0x3e1b01==='nothing'){logger[_0x195d('0x24')]('['+[_0x1b5e28[_0x195d('0x16')]()]+_0x195d('0x39'));return _0x2009d4;}return createEndUser(_0x2009d4,_0x268691,_0x7d365a,_0x4f5200,_0x4778ca,_0x1b5e28,_0x4ad281)[_0x195d('0x13')](function(_0x8c807a){logger[_0x195d('0x24')]('['+[_0x1b5e28[_0x195d('0x16')]()]+_0x195d('0x3a'),_0x8c807a['enduserId']);return _0x8c807a;});});}function getCustomFields(_0x4ebed0,_0xaf875b,_0x4bb1ef){var _0x597bdf={};if(_0x4ebed0[_0x195d('0x22')]>0x0){_[_0x195d('0x3b')](_0x4ebed0,function(_0x1436b2){if(_[_0x195d('0x3c')](['string',_0x195d('0x3d')],_0x1436b2[_0x195d('0x3e')])&&_0x1436b2[_0x195d('0x3f')]&&!_0x1436b2[_0x195d('0x40')]){var _0x44fbc0=_0x1436b2['idField']['toLowerCase']();var _0x56997a=_0x44fbc0['substring'](0x0,_0x44fbc0[_0x195d('0x41')]('_'));var _0x56b145=_0x44fbc0[_0x195d('0x31')](_0x44fbc0[_0x195d('0x41')]('_')+0x1);if(_0x56997a===_0x4bb1ef){_0x597bdf[_0x56b145]=_0x1436b2[_0x195d('0x42')];}}});}return _0x597bdf;}function getTicket(_0x2eca8e,_0xf3216f,_0x550d3e,_0x28dc08,_0x2d83ad,_0x4c462a,_0x4491e3){return new Promise(function(_0x19f686,_0x3a5c17){var _0x260caf;return getAuthToken(_0xf3216f,_0x550d3e,_0x4491e3)[_0x195d('0x13')](function(_0x2d7d78){if(_0x4c462a[_0x195d('0x43')]===_0x195d('0x44')){_0x260caf={'method':_0x195d('0xe'),'uri':_0x28dc08+_0x195d('0x45'),'body':Object[_0x195d('0x46')]({},{'title':intUtil[_0x195d('0x47')](_0x4c462a[_0x195d('0x48')],_0x2d83ad,'\x20'),'description':intUtil[_0x195d('0x47')](_0x4c462a['Descriptions'],_0x2d83ad,'\x0a'),'customerid_contact@odata.bind':_0x2eca8e['enduserId']?_0x195d('0x49')+_0x2eca8e[_0x195d('0x33')]+')':undefined,'ownerid@odata.bind':_0x195d('0x2d')+_0x2eca8e[_0x195d('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x4c462a['Fields'],_0x2d83ad,_0x4c462a[_0x195d('0x43')])),'headers':{'Authorization':_0x195d('0x1b')+_0x2d7d78,'OData-Version':_0x195d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4c462a[_0x195d('0x43')]===_0x195d('0x4a')){var _0x3d8f57=_0x2eca8e[_0x195d('0x33')]?[{'partyid_systemuser@odata.bind':_0x195d('0x2d')+_0x2eca8e[_0x195d('0x27')]+')','participationtypemask':_0x2eca8e['callDirection']===_0x195d('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x195d('0x49')+_0x2eca8e['enduserId']+')','participationtypemask':_0x2eca8e['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x195d('0x2d')+_0x2eca8e[_0x195d('0x27')]+')','participationtypemask':_0x2eca8e[_0x195d('0x4c')]===_0x195d('0x4b')?0x2:0x1}];_0x260caf={'method':_0x195d('0xe'),'uri':_0x28dc08+_0x195d('0x4d'),'body':Object[_0x195d('0x46')]({},{'subject':intUtil[_0x195d('0x47')](_0x4c462a[_0x195d('0x48')],_0x2d83ad,'\x20'),'phonenumber':String(_0x2d83ad[_0x195d('0x2b')]),'description':intUtil[_0x195d('0x47')](_0x4c462a[_0x195d('0x4e')],_0x2d83ad,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2eca8e['enduserId']?'/contacts('+_0x2eca8e[_0x195d('0x33')]+')':undefined,'ownerid@odata.bind':_0x195d('0x2d')+_0x2eca8e[_0x195d('0x27')]+')','directioncode':_0x2eca8e[_0x195d('0x4c')]===_0x195d('0x4b')?![]:!![],'phonecall_activity_parties':_0x3d8f57},getCustomFields(_0x4c462a[_0x195d('0x4f')],_0x2d83ad,_0x4c462a[_0x195d('0x43')])),'headers':{'Authorization':_0x195d('0x1b')+_0x2d7d78,'OData-Version':_0x195d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x260caf);})[_0x195d('0x13')](function(_0x45f306){var _0x439548=_0x45f306[_0x195d('0x2f')][_0x195d('0x30')];var _0x3b66eb=_0x439548['substring'](_0x439548[_0x195d('0x32')]('(')+0x1,_0x439548[_0x195d('0x32')](')'));_0x2eca8e[_0x195d('0x50')]=_0x3b66eb;_0x19f686(_0x2eca8e);})['catch'](function(_0x10c116){_0x3a5c17(_0x10c116[_0x195d('0x18')]);});});}function emit(_0x4272af,_0x3f2657,_0xdfde22,_0x3acb24){var _0x123c84={'uri':util[_0x195d('0x51')](_0x195d('0x52'),_0x4272af,_0xdfde22,_0x3acb24)};io['to'](util[_0x195d('0x51')]('user:%s',_0x3f2657))[_0x195d('0x53')](_0x195d('0x54'),_0x123c84);}exports['cs']=function(_0x334ec4,_0x7acc5e,_0x1bc6dc,_0x2da4d1,_0x49b685,_0x2f6f5f,_0x3f3b89,_0xe661a9){var _0x4de7f8={};_0x2f6f5f['remoteUri']=_0x2f6f5f[_0x195d('0x8')]?intUtil[_0x195d('0x55')](_0x2f6f5f['CloudProvider'][_0x195d('0xa')]):intUtil['stripTrailingSlash'](_0x2f6f5f[_0x195d('0xf')]);_0x2f6f5f[_0x195d('0x56')]=intUtil[_0x195d('0x55')](_0x2f6f5f[_0x195d('0x56')]);_0x4de7f8[_0x195d('0x4c')]=_0xe661a9===_0x195d('0x4b')||_0xe661a9==='unmanaged'?_0x195d('0x4b'):_0x195d('0x29');var _0x279bb6=_0x2f6f5f[_0x195d('0x8')]?util[_0x195d('0x51')]('%s/api/data/v9.0/',_0x2f6f5f[_0x195d('0x9')][_0x195d('0xa')]):util[_0x195d('0x51')]('%s/api/data/v9.0/',_0x2f6f5f['remoteUri']);var _0x336e0e=util[_0x195d('0x51')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2f6f5f['tenantId']);var _0x5dadfe=util[_0x195d('0x51')](_0x195d('0x57'),_0x2f6f5f['serverUrl'],_0x7acc5e[_0x195d('0x58')],md5(_0x7acc5e[_0x195d('0x58')]));if(_0x49b685&&_0x49b685[_0x195d('0x59')]){logger[_0x195d('0x24')](_0x195d('0x5a'),_0x195d('0x5b'));_0x7acc5e[_0x195d('0x5c')]=_0x5dadfe;}else if(_0x3f3b89&&_0x3f3b89[_0x195d('0x5d')]&&_0x3f3b89[_0x195d('0x5d')]!==_0x195d('0x5e')){logger[_0x195d('0x24')](_0x195d('0x5f'),_0x195d('0x5b'));_0x7acc5e[_0x195d('0x5c')]=_0x5dadfe;}else{_0x7acc5e['recordingURL']='';}return getUser(_0x4de7f8,_0x2f6f5f,_0x2da4d1,_0x336e0e,_0x279bb6,_0xe661a9)[_0x195d('0x13')](function(_0x315d2a){logger['info']('['+_0xe661a9[_0x195d('0x16')]()+_0x195d('0x60'),_0x315d2a[_0x195d('0x27')]);logger[_0x195d('0x24')]('['+_0xe661a9['toUpperCase']()+_0x195d('0x61'),_0x315d2a['userEmail']);return getEndUser(_0x315d2a,_0x2f6f5f,_0x336e0e,_0x279bb6,_0x7acc5e,_0xe661a9,_0x1bc6dc[_0x195d('0x62')],_0x1bc6dc[_0x195d('0x63')]);})[_0x195d('0x13')](function(_0x406b6f){logger['info']('['+_0xe661a9[_0x195d('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x406b6f[_0x195d('0x33')]);logger[_0x195d('0x24')]('['+_0xe661a9[_0x195d('0x16')]()+_0x195d('0x64'),_0x7acc5e[_0x195d('0x2b')]);return getTicket(_0x406b6f,_0x2f6f5f,_0x336e0e,_0x279bb6,_0x7acc5e,_0x1bc6dc,_0xe661a9);})['then'](function(_0x143069){logger['info'](util[_0x195d('0x51')]('['+_0xe661a9['toUpperCase']()+_0x195d('0x65'),_0x1bc6dc[_0x195d('0x43')],_0x143069[_0x195d('0x50')]));logger[_0x195d('0x24')](util[_0x195d('0x51')]('['+_0xe661a9[_0x195d('0x16')]()+_0x195d('0x66'),_0xe661a9));if(_0xe661a9!==_0x195d('0x67')&&_0x1bc6dc[_0x195d('0x68')]){logger[_0x195d('0x24')]('['+_0xe661a9['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2f6f5f[_0x195d('0xf')],_0x2da4d1['name'],_0x1bc6dc[_0x195d('0x43')],_0x143069[_0x195d('0x50')]);}})[_0x195d('0x15')](function(_0x2f55d1){logger[_0x195d('0x69')]('['+_0xe661a9[_0x195d('0x16')]()+_0x195d('0x6a'),_0x2f55d1[_0x195d('0x18')]);console[_0x195d('0x69')](_0x195d('0x6b'),_0x2f55d1);});}; \ No newline at end of file +var _0xc56b=['indexOf','content','ticketType','incident','incidents','getString','Subjects','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','length','internalemailaddress','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','calleridnum','body','headers','odata-entityid','substring','lastIndexOf','destcalleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','enduserId','contactid',']\x20Enduser\x20created!','string','picklist','type','customField'];(function(_0x51efeb,_0x74aec1){var _0x5f3fc5=function(_0x68a662){while(--_0x68a662){_0x51efeb['push'](_0x51efeb['shift']());}};_0x5f3fc5(++_0x74aec1);}(_0xc56b,0x8b));var _0xbc56=function(_0x3a3465,_0x3b466e){_0x3a3465=_0x3a3465-0x0;var _0xd92ae8=_0xc56b[_0x3a3465];return _0xd92ae8;};'use strict';var _=require(_0xbc56('0x0'));var rp=require(_0xbc56('0x1'));var util=require(_0xbc56('0x2'));var intUtil=require('./util');var md5=require(_0xbc56('0x3'));var Redis=require('ioredis');var logger=require(_0xbc56('0x4'))(_0xbc56('0x5'));var config=require(_0xbc56('0x6'));config['redis']=_[_0xbc56('0x7')](config['redis'],{'host':_0xbc56('0x8'),'port':0x18eb});var io=require(_0xbc56('0x9'))(new Redis(config['redis']));function getAuthToken(_0x5244a3,_0x23f2d2,_0x10c184){if(_0x5244a3[_0xbc56('0xa')]){_0x5244a3[_0xbc56('0xb')]=_0x5244a3[_0xbc56('0xc')]['data7'];_0x5244a3[_0xbc56('0xd')]=_0x5244a3[_0xbc56('0xc')]['data2'];return Promise[_0xbc56('0xe')](_0x5244a3[_0xbc56('0xc')][_0xbc56('0xf')]);}var _0x204352={'method':_0xbc56('0x10'),'uri':_0x23f2d2,'form':{'client_id':_0x5244a3[_0xbc56('0x11')],'resource':_0x5244a3[_0xbc56('0xb')],'username':_0x5244a3[_0xbc56('0x12')],'password':_0x5244a3[_0xbc56('0x13')],'grant_type':_0xbc56('0x13'),'client_secret':_0x5244a3[_0xbc56('0x14')]},'json':!![]};return rp(_0x204352)[_0xbc56('0x15')](function(_0x451e18){return _0x451e18[_0xbc56('0x16')];})[_0xbc56('0x17')](function(_0x228a47){logger[_0xbc56('0x18')]('['+[_0x10c184[_0xbc56('0x19')]()]+']\x20Wrong\x20credentials!');return _0x228a47[_0xbc56('0x1a')];});}function getUser(_0x51af9c,_0x387a00,_0x467374,_0x96740b,_0x4f44ab,_0x3c9ac7){return new Promise(function(_0x1e0d7d,_0x5a7202){return getAuthToken(_0x387a00,_0x96740b,_0x3c9ac7)[_0xbc56('0x15')](function(_0x42be81){var _0x4884e6={'method':_0xbc56('0x1b'),'uri':_0x4f44ab+_0xbc56('0x1c'),'headers':{'Authorization':_0xbc56('0x1d')+_0x42be81,'OData-Version':_0xbc56('0x1e')},'json':!![]};return rp(_0x4884e6);})[_0xbc56('0x15')](function(_0x48608e){var _0x467067=_0x48608e[_0xbc56('0x1f')];var _0x13de12=![];var _0x19c42a=null;if(!_[_0xbc56('0x20')](_0x467374)){if(intUtil[_0xbc56('0x21')](_0x467374['email'])){_0x51af9c['userEmail']=_0x467374['email'];for(_0x19c42a=0x0;_0x19c42a<_0x467067[_0xbc56('0x22')];_0x19c42a++){if(_0x467067[_0x19c42a][_0xbc56('0x23')]===_0x467374[_0xbc56('0x24')]&&!_0x467067[_0x19c42a][_0xbc56('0x25')]){_0x13de12=!![];logger[_0xbc56('0x26')]('['+[_0x3c9ac7[_0xbc56('0x19')]()]+_0xbc56('0x27')+_0x467067[_0x19c42a][_0xbc56('0x28')]+'!');_0x51af9c[_0xbc56('0x29')]=_0x467067[_0x19c42a]['systemuserid'];}}}}if(!_0x13de12){logger[_0xbc56('0x26')]('['+[_0x3c9ac7[_0xbc56('0x19')]()]+_0xbc56('0x2a'));_0x51af9c[_0xbc56('0x2b')]=_0x387a00[_0xbc56('0x12')];for(_0x19c42a=0x0;_0x19c42a<_0x467067[_0xbc56('0x22')];_0x19c42a++){if(_0x467067[_0x19c42a][_0xbc56('0x23')]===_0x387a00['username']){_0x51af9c['userId']=_0x467067[_0x19c42a][_0xbc56('0x28')];}}}_0x1e0d7d(_0x51af9c);})[_0xbc56('0x17')](function(_0x3db493){_0x5a7202(_0x3db493[_0xbc56('0x1a')]);});});}function createEndUser(_0x185039,_0x10ee69,_0x182f4d,_0x9db0e6,_0x5a3b73,_0x1bfa5d,_0x4b9ec8){return new Promise(function(_0x1a23b3,_0x2ba8f5){return getAuthToken(_0x10ee69,_0x182f4d,_0x1bfa5d)[_0xbc56('0x15')](function(_0x2f6a94){var _0x47b4ee=_0x1bfa5d[_0xbc56('0x2c')]()==='outbound'?_0x5a3b73['destcalleridnum']:_0x5a3b73[_0xbc56('0x2d')];var _0xd44c3c={'method':_0xbc56('0x10'),'uri':_0x9db0e6+'contacts','body':{'fullname':_0x47b4ee,'firstname':_0x47b4ee,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x185039['userId']+')'},'headers':{'Authorization':_0xbc56('0x1d')+_0x2f6a94,'OData-Version':_0xbc56('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0xd44c3c[_0xbc56('0x2e')][_0x4b9ec8]=_0x47b4ee;return rp(_0xd44c3c);})[_0xbc56('0x15')](function(_0x3d42a3){var _0x6cdb17=_0x3d42a3[_0xbc56('0x2f')][_0xbc56('0x30')];var _0xfdcd09=_0x6cdb17[_0xbc56('0x31')](_0x6cdb17[_0xbc56('0x32')]('(')+0x1,_0x6cdb17['lastIndexOf'](')'));_0x185039['enduserId']=_0xfdcd09;_0x1a23b3(_0x185039);})['catch'](function(_0x3f19a9){_0x2ba8f5(_0x3f19a9[_0xbc56('0x1a')]);});});}function getEndUser(_0x26c35f,_0x36b873,_0x2a43c7,_0x196864,_0x5e1a77,_0x202e7d,_0x2bc9f2,_0x55b502){var _0x3ced12=_0x202e7d[_0xbc56('0x2c')]()==='outbound'?_0x5e1a77[_0xbc56('0x33')]:_0x5e1a77[_0xbc56('0x2d')];return getAuthToken(_0x36b873,_0x2a43c7,_0x202e7d)[_0xbc56('0x15')](function(_0x5073d6){_0x55b502=_0x55b502?_0x55b502:'telephone1';var _0x1bca8e={'method':_0xbc56('0x1b'),'uri':_0x196864+_0xbc56('0x34')+_0x55b502+_0xbc56('0x35')+_0x55b502+_0xbc56('0x36')+_0x3ced12['replace']('+',_0xbc56('0x37'))+'\x27','headers':{'Authorization':_0xbc56('0x1d')+_0x5073d6,'If-None-Match':null,'OData-Version':_0xbc56('0x1e')},'json':!![]};return rp(_0x1bca8e);})['then'](function(_0xc78b8e){var _0x3c6280=![];if(!_0xc78b8e)return _0x3c6280;var _0x42caff=_0xc78b8e[_0xbc56('0x1f')];for(var _0x3109e5=0x0;_0x3109e5<_0x42caff[_0xbc56('0x22')];_0x3109e5++){if(_0x42caff[_0x3109e5][_0x55b502]===_0x3ced12){_0x3c6280=!![];_0x26c35f[_0xbc56('0x38')]=_0x42caff[_0x3109e5][_0xbc56('0x39')];}}return _0x3c6280;})['then'](function(_0x2bdff8){if(_0x2bdff8)return _0x26c35f;if(_0x2bc9f2==='nothing'){logger['info']('['+[_0x202e7d[_0xbc56('0x19')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x26c35f;}return createEndUser(_0x26c35f,_0x36b873,_0x2a43c7,_0x196864,_0x5e1a77,_0x202e7d,_0x55b502)['then'](function(_0x24be2a){logger[_0xbc56('0x26')]('['+[_0x202e7d[_0xbc56('0x19')]()]+_0xbc56('0x3a'),_0x24be2a[_0xbc56('0x38')]);return _0x24be2a;});});}function getCustomFields(_0x229acd,_0x59ee3f,_0x3eb0ef){var _0x3c1590={};if(_0x229acd[_0xbc56('0x22')]>0x0){_['forEach'](_0x229acd,function(_0x453121){if(_['includes']([_0xbc56('0x3b'),_0xbc56('0x3c')],_0x453121[_0xbc56('0x3d')])&&_0x453121['nameField']&&!_0x453121[_0xbc56('0x3e')]){var _0x5d6ff0=_0x453121['idField'][_0xbc56('0x2c')]();var _0x6c7711=_0x5d6ff0[_0xbc56('0x31')](0x0,_0x5d6ff0[_0xbc56('0x3f')]('_'));var _0x19b2b8=_0x5d6ff0['substring'](_0x5d6ff0[_0xbc56('0x3f')]('_')+0x1);if(_0x6c7711===_0x3eb0ef){_0x3c1590[_0x19b2b8]=_0x453121[_0xbc56('0x40')];}}});}return _0x3c1590;}function getTicket(_0xc6b3d7,_0x9009c4,_0x13144d,_0x2cadd9,_0x4547d7,_0x3e8642,_0x547700){return new Promise(function(_0x1d0879,_0x48af42){var _0x5ac95e;return getAuthToken(_0x9009c4,_0x13144d,_0x547700)[_0xbc56('0x15')](function(_0x37b15f){if(_0x3e8642[_0xbc56('0x41')]===_0xbc56('0x42')){_0x5ac95e={'method':_0xbc56('0x10'),'uri':_0x2cadd9+_0xbc56('0x43'),'body':Object['assign']({},{'title':intUtil[_0xbc56('0x44')](_0x3e8642[_0xbc56('0x45')],_0x4547d7,'\x20'),'description':intUtil[_0xbc56('0x44')](_0x3e8642['Descriptions'],_0x4547d7,'\x0a'),'customerid_contact@odata.bind':_0xc6b3d7[_0xbc56('0x38')]?_0xbc56('0x46')+_0xc6b3d7[_0xbc56('0x38')]+')':undefined,'ownerid@odata.bind':_0xbc56('0x47')+_0xc6b3d7['userId']+')','caseorigincode':'1'},getCustomFields(_0x3e8642[_0xbc56('0x48')],_0x4547d7,_0x3e8642[_0xbc56('0x41')])),'headers':{'Authorization':_0xbc56('0x1d')+_0x37b15f,'OData-Version':_0xbc56('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3e8642[_0xbc56('0x41')]===_0xbc56('0x49')){var _0x466e57=_0xc6b3d7[_0xbc56('0x38')]?[{'partyid_systemuser@odata.bind':_0xbc56('0x47')+_0xc6b3d7[_0xbc56('0x29')]+')','participationtypemask':_0xc6b3d7[_0xbc56('0x4a')]===_0xbc56('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xbc56('0x46')+_0xc6b3d7[_0xbc56('0x38')]+')','participationtypemask':_0xc6b3d7[_0xbc56('0x4a')]===_0xbc56('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xbc56('0x47')+_0xc6b3d7['userId']+')','participationtypemask':_0xc6b3d7[_0xbc56('0x4a')]===_0xbc56('0x4b')?0x2:0x1}];_0x5ac95e={'method':_0xbc56('0x10'),'uri':_0x2cadd9+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xbc56('0x44')](_0x3e8642[_0xbc56('0x45')],_0x4547d7,'\x20'),'phonenumber':String(_0x4547d7['calleridnum']),'description':intUtil[_0xbc56('0x44')](_0x3e8642[_0xbc56('0x4c')],_0x4547d7,'\x0a'),'regardingobjectid_contact@odata.bind':_0xc6b3d7[_0xbc56('0x38')]?_0xbc56('0x46')+_0xc6b3d7['enduserId']+')':undefined,'ownerid@odata.bind':_0xbc56('0x47')+_0xc6b3d7['userId']+')','directioncode':_0xc6b3d7[_0xbc56('0x4a')]===_0xbc56('0x4b')?![]:!![],'phonecall_activity_parties':_0x466e57},getCustomFields(_0x3e8642['Fields'],_0x4547d7,_0x3e8642[_0xbc56('0x41')])),'headers':{'Authorization':_0xbc56('0x1d')+_0x37b15f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5ac95e);})['then'](function(_0x291a6e){var _0x2b41f9=_0x291a6e[_0xbc56('0x2f')][_0xbc56('0x30')];var _0x322410=_0x2b41f9[_0xbc56('0x31')](_0x2b41f9[_0xbc56('0x32')]('(')+0x1,_0x2b41f9['lastIndexOf'](')'));_0xc6b3d7[_0xbc56('0x4d')]=_0x322410;_0x1d0879(_0xc6b3d7);})['catch'](function(_0x2d7902){_0x48af42(_0x2d7902[_0xbc56('0x1a')]);});});}function emit(_0xdd93d4,_0x3accc8,_0x37f216,_0x545c43){var _0x51ea2a={'uri':util[_0xbc56('0x4e')](_0xbc56('0x4f'),_0xdd93d4,_0x37f216,_0x545c43)};io['to'](util[_0xbc56('0x4e')]('user:%s',_0x3accc8))[_0xbc56('0x50')](_0xbc56('0x51'),_0x51ea2a);}exports['cs']=function(_0x4f9d8b,_0x165971,_0x5b418a,_0x5218ae,_0x42f157,_0x5dd743,_0x123da7,_0xafb159){var _0x34a79b={};_0x5dd743['remoteUri']=_0x5dd743['modernAuthentication']?intUtil[_0xbc56('0x52')](_0x5dd743[_0xbc56('0xc')][_0xbc56('0x53')]):intUtil[_0xbc56('0x52')](_0x5dd743[_0xbc56('0xb')]);_0x5dd743[_0xbc56('0x54')]=intUtil[_0xbc56('0x52')](_0x5dd743['serverUrl']);_0x34a79b[_0xbc56('0x4a')]=_0xafb159===_0xbc56('0x4b')||_0xafb159===_0xbc56('0x55')?_0xbc56('0x4b'):_0xbc56('0x56');var _0x2978bc=_0x5dd743[_0xbc56('0xa')]?util[_0xbc56('0x4e')]('%s/api/data/v9.0/',_0x5dd743['CloudProvider']['data7']):util[_0xbc56('0x4e')]('%s/api/data/v9.0/',_0x5dd743[_0xbc56('0xb')]);var _0x185488=util[_0xbc56('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5dd743['tenantId']);var _0xc8a0d1=util[_0xbc56('0x4e')](_0xbc56('0x57'),_0x5dd743[_0xbc56('0x54')],_0x165971[_0xbc56('0x58')],md5(_0x165971[_0xbc56('0x58')]));if(_0x42f157&&_0x42f157[_0xbc56('0x59')]){logger[_0xbc56('0x26')]('[QUEUE]',_0xbc56('0x5a'));_0x165971['recordingURL']=_0xc8a0d1;}else if(_0x123da7&&_0x123da7[_0xbc56('0x5b')]&&_0x123da7[_0xbc56('0x5b')]!==_0xbc56('0x5c')){logger[_0xbc56('0x26')]('[OUTBOUND]',_0xbc56('0x5a'));_0x165971[_0xbc56('0x5d')]=_0xc8a0d1;}else{_0x165971['recordingURL']='';}return getUser(_0x34a79b,_0x5dd743,_0x5218ae,_0x185488,_0x2978bc,_0xafb159)['then'](function(_0x4d2ad1){logger['info']('['+_0xafb159[_0xbc56('0x19')]()+_0xbc56('0x5e'),_0x4d2ad1[_0xbc56('0x29')]);logger[_0xbc56('0x26')]('['+_0xafb159[_0xbc56('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x4d2ad1[_0xbc56('0x2b')]);return getEndUser(_0x4d2ad1,_0x5dd743,_0x185488,_0x2978bc,_0x165971,_0xafb159,_0x5b418a['moduleCreate'],_0x5b418a[_0xbc56('0x5f')]);})[_0xbc56('0x15')](function(_0x744cd1){logger['info']('['+_0xafb159[_0xbc56('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x744cd1[_0xbc56('0x38')]);logger[_0xbc56('0x26')]('['+_0xafb159[_0xbc56('0x19')]()+_0xbc56('0x60'),_0x165971[_0xbc56('0x2d')]);return getTicket(_0x744cd1,_0x5dd743,_0x185488,_0x2978bc,_0x165971,_0x5b418a,_0xafb159);})[_0xbc56('0x15')](function(_0x169218){logger['info'](util[_0xbc56('0x4e')]('['+_0xafb159[_0xbc56('0x19')]()+_0xbc56('0x61'),_0x5b418a[_0xbc56('0x41')],_0x169218[_0xbc56('0x4d')]));logger[_0xbc56('0x26')](util[_0xbc56('0x4e')]('['+_0xafb159[_0xbc56('0x19')]()+_0xbc56('0x62'),_0xafb159));if(_0xafb159!=='unmanaged'&&_0x5b418a[_0xbc56('0x63')]){logger[_0xbc56('0x26')]('['+_0xafb159[_0xbc56('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5dd743['remoteUri'],_0x5218ae['name'],_0x5b418a[_0xbc56('0x41')],_0x169218[_0xbc56('0x4d')]);}})[_0xbc56('0x17')](function(_0x18d75f){logger['error']('['+_0xafb159[_0xbc56('0x19')]()+_0xbc56('0x64'),_0x18d75f[_0xbc56('0x1a')]);console[_0xbc56('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x18d75f);});}; \ 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 90ed74a..6dc988a 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 _0x0ec6=['%s/api/v2/agents','then','length','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','push','variable','variableName','idField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','stringify','outbound','recordingFormat','none','Authorization','destcalleridname','[OUTBOUND]','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','
','name','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ec6,0x198));var _0x60ec=function(_0x4c9cd7,_0x2dd8fc){_0x4c9cd7=_0x4c9cd7-0x0;var _0x28491c=_0x0ec6[_0x4c9cd7];return _0x28491c;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x60ec('0x0'));var util=require('util');var Redis=require(_0x60ec('0x1'));var intUtil=require(_0x60ec('0x2'));var config=require(_0x60ec('0x3'));var logger=require(_0x60ec('0x4'))(_0x60ec('0x5'));config['redis']=_[_0x60ec('0x6')](config[_0x60ec('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x60ec('0x8'),'Accept':_0x60ec('0x8')};function emit(_0x14150b,_0x45fde9,_0x37cbd5){io['to'](_0x14150b)[_0x60ec('0x9')](_0x45fde9,_0x37cbd5);}function getTicket(_0x72d4f9,_0x14ebee,_0x17387f,_0x324195,_0x434390){logger[_0x60ec('0xa')](_0x60ec('0xb'));var _0x4c0da6=_['merge']({'responder_id':_0x14ebee['id'],'requester_id':_0x17387f['id'],'name':util['format'](_0x60ec('0xc'),_0x434390[_0x60ec('0xd')]),'phone':_0x434390[_0x60ec('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x324195[_0x60ec('0xf')],_0x434390,'\x20'),'description':intUtil[_0x60ec('0x10')](_0x324195['Descriptions'],_0x434390,_0x60ec('0x11')),'tags':getTags(_0x324195['Tags'],_0x60ec('0x12'))},getCustomFields(_0x324195['Fields'],_0x434390));_0x4c0da6[_0x60ec('0x13')]=_[_0x60ec('0x14')](_[_0x60ec('0x15')](_0x4c0da6[_0x60ec('0x13')],'id'),'value');return request({'uri':util[_0x60ec('0x16')](_0x60ec('0x17'),_0x72d4f9[_0x60ec('0x18')]),'method':'POST','body':_0x4c0da6})['then'](function(_0x56abd2){logger[_0x60ec('0xa')](_0x60ec('0x19'));return _0x56abd2;});}function getUser(_0x245d18,_0x1be464){if(intUtil[_0x60ec('0x1a')](_0x1be464)){return request({'uri':util[_0x60ec('0x16')](_0x60ec('0x1b'),_0x245d18[_0x60ec('0x18')]),'qs':{'email':_0x1be464}})[_0x60ec('0x1c')](function(_0x533b53){if(_0x533b53[_0x60ec('0x1d')]){logger[_0x60ec('0xa')]('Agent\x20found!');return _[_0x60ec('0x1e')](_0x533b53,function(_0x45e7e1){return _0x45e7e1[_0x60ec('0x1f')][_0x60ec('0x20')]===_0x1be464;});}else{logger[_0x60ec('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x60ec('0x16')](_0x60ec('0x21'),_0x245d18[_0x60ec('0x18')])})[_0x60ec('0x1c')](function(_0x3c8245){logger[_0x60ec('0xa')]('Admin\x20account\x20selected.');return _0x3c8245;});}});}else{logger[_0x60ec('0xa')](_0x60ec('0x22'));return request({'uri':util['format'](_0x60ec('0x21'),_0x245d18[_0x60ec('0x18')])})[_0x60ec('0x1c')](function(_0x4d2e3c){logger[_0x60ec('0xa')]('Admin\x20account\x20selected.');return _0x4d2e3c;});}}function getEndUser(_0x666522,_0x54dbbf,_0x5cfc52){logger[_0x60ec('0xa')](_0x60ec('0x23'),_0x5cfc52);return request({'uri':util[_0x60ec('0x16')](_0x60ec('0x24'),_0x666522['remoteUri']),'qs':{'phone':_0x5cfc52}})[_0x60ec('0x1c')](function(_0x44c9e4){if(_0x44c9e4[_0x60ec('0x1d')]){logger[_0x60ec('0xa')]('Enduser\x20found!');return _[_0x60ec('0x1e')](_0x44c9e4,{'phone':_0x5cfc52});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x60ec('0x16')](_0x60ec('0x24'),_0x666522[_0x60ec('0x18')]),'method':'POST','body':{'name':_0x54dbbf,'phone':_0x5cfc52}})[_0x60ec('0x1c')](function(_0x35995e){logger['info'](_0x60ec('0x25'));return _0x35995e;});}});}function getAuth(_0x3a492c){return util[_0x60ec('0x16')](_0x60ec('0x26'),new Buffer(_0x3a492c[_0x60ec('0x27')]+':X')[_0x60ec('0x28')](_0x60ec('0x29')));}function request(_0x256228){logger[_0x60ec('0x2a')](_0x60ec('0x2b'),JSON['stringify'](_0x256228));return rp(_['defaults'](_0x256228,{'method':_0x60ec('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x291397,_0x520204){var _0x13b26c=[];if(_0x291397&&_0x291397[_0x60ec('0x1d')]>0x0){_0x13b26c=_[_0x60ec('0x2d')](_0x291397,_0x520204);}return _0x13b26c;}function getCustomFields(_0x5c562d,_0xa3b193){var _0x4a4b55=[];var _0x41c511={'custom_fields':[]};if(_0x5c562d[_0x60ec('0x1d')]>0x0){_[_0x60ec('0x2e')](_0x5c562d,function(_0x45a7eb){if(_[_0x60ec('0x2f')]([_0x60ec('0x30'),_0x60ec('0x31')],_0x45a7eb[_0x60ec('0x32')])&&_0x45a7eb[_0x60ec('0x33')]&&!_0x45a7eb[_0x60ec('0x34')]){_0x41c511[_0x45a7eb['nameField'][_0x60ec('0x35')]()]=_0x45a7eb['content'][_0x60ec('0x28')]();}else if(_[_0x60ec('0x2f')](['string',_0x60ec('0x31')],_0x45a7eb[_0x60ec('0x32')])&&_0x45a7eb['idField']&&_0x45a7eb['customField']){_0x41c511['custom_fields'][_0x60ec('0x36')]({'id':_0x45a7eb['idField'],'value':_0x45a7eb['content']['toString']()});}else if(_0x45a7eb[_0x60ec('0x32')]===_0x60ec('0x37')&&_0x45a7eb[_0x60ec('0x38')]&&_0x45a7eb[_0x60ec('0x39')]&&_0x45a7eb[_0x60ec('0x34')]){_0xa3b193[_0x45a7eb[_0x60ec('0x38')]]&&_0x41c511[_0x60ec('0x13')][_0x60ec('0x36')]({'id':_0x45a7eb['idField'],'value':_0xa3b193[_0x45a7eb['variableName']][_0x60ec('0x28')]()});}else if(_0x45a7eb[_0x60ec('0x32')]===_0x60ec('0x3a')&&_0x45a7eb[_0x60ec('0x3b')]&&_0x45a7eb[_0x60ec('0x3b')][_0x60ec('0x12')]&&_0x45a7eb['idField']&&_0x45a7eb['customField']){_0xa3b193[_0x45a7eb['Variable'][_0x60ec('0x12')]['toLowerCase']()]&&_0x41c511['custom_fields'][_0x60ec('0x36')]({'id':_0x45a7eb[_0x60ec('0x39')],'value':_0xa3b193[_0x45a7eb[_0x60ec('0x3b')]['name'][_0x60ec('0x35')]()][_0x60ec('0x28')]()});}});}return _0x41c511;}exports[_0x60ec('0x3c')]=function(_0x5e5a2d,_0x29d3d8,_0x3951ad,_0x648afd,_0x273821,_0x3277cb){var _0x9f4b4a,_0x27bc98;_0x3277cb[_0x60ec('0x18')]=intUtil[_0x60ec('0x3d')](_0x3277cb[_0x60ec('0x18')]);_0x3277cb[_0x60ec('0x3e')]=intUtil[_0x60ec('0x3d')](_0x3277cb[_0x60ec('0x3e')]);if(_0x273821&&_0x273821[_0x60ec('0x3f')]){logger[_0x60ec('0xa')](_0x60ec('0x40'),_0x60ec('0x41'));_0x29d3d8[_0x60ec('0x42')]=util['format'](_0x60ec('0x43'),_0x3277cb[_0x60ec('0x3e')],_0x29d3d8[_0x60ec('0x44')],md5(_0x29d3d8[_0x60ec('0x44')]));}else{_0x29d3d8[_0x60ec('0x42')]='';}headers['Authorization']=getAuth(_0x3277cb);return getUser(_0x3277cb,_0x648afd[_0x60ec('0x20')])[_0x60ec('0x1c')](function(_0x45fa69){_0x9f4b4a=_0x45fa69;logger['info'](_0x60ec('0x45'),_0x9f4b4a['id']);return getEndUser(_0x3277cb,_0x29d3d8[_0x60ec('0xd')],_0x29d3d8['calleridnum']);})[_0x60ec('0x1c')](function(_0x12e9b4){_0x27bc98=_0x12e9b4;logger[_0x60ec('0xa')](_0x60ec('0x46'),_0x27bc98['id']);return getTicket(_0x3277cb,_0x9f4b4a,_0x27bc98,_0x3951ad,_0x29d3d8);})['then'](function(_0x537719){if(_0x537719&&_0x537719['id']){logger['info'](_0x60ec('0x19'));logger[_0x60ec('0xa')]('The\x20Ticket\x20ID\x20is:',_0x537719['id']);logger[_0x60ec('0xa')](_0x60ec('0x40'),_0x60ec('0x47'));emit(util[_0x60ec('0x16')](_0x60ec('0x48'),_0x648afd['name']),'trigger:browser:url',{'uri':util[_0x60ec('0x16')]('%s/helpdesk/tickets/%d',_0x3277cb['remoteUri'],_0x537719['id'])});}})[_0x60ec('0x49')](function(_0x3bda94){logger[_0x60ec('0x4a')]('[QUEUE]',JSON[_0x60ec('0x4b')](_0x3bda94));});};exports[_0x60ec('0x4c')]=function(_0x26b9ea,_0x234ed4,_0x2b8620,_0x316bc6,_0x173cca,_0x14ed30,_0x449ffc){var _0x592a53,_0x11abb6;_0x14ed30[_0x60ec('0x18')]=intUtil[_0x60ec('0x3d')](_0x14ed30[_0x60ec('0x18')]);_0x14ed30[_0x60ec('0x3e')]=intUtil[_0x60ec('0x3d')](_0x14ed30[_0x60ec('0x3e')]);if(_0x449ffc&&_0x449ffc[_0x60ec('0x4d')]&&_0x449ffc[_0x60ec('0x4d')]!==_0x60ec('0x4e')){logger[_0x60ec('0xa')]('[OUTBOUND]',_0x60ec('0x41'));_0x234ed4[_0x60ec('0x42')]=util[_0x60ec('0x16')](_0x60ec('0x43'),_0x14ed30[_0x60ec('0x3e')],_0x234ed4[_0x60ec('0x44')],md5(_0x234ed4[_0x60ec('0x44')]));}headers[_0x60ec('0x4f')]=getAuth(_0x14ed30);return getUser(_0x14ed30,_0x316bc6[_0x60ec('0x20')])[_0x60ec('0x1c')](function(_0x3fea85){_0x592a53=_0x3fea85;logger['info'](_0x60ec('0x45'),_0x592a53['id']);return getEndUser(_0x14ed30,_0x234ed4[_0x60ec('0x50')],_0x234ed4['destcalleridnum']);})[_0x60ec('0x1c')](function(_0x16b45d){_0x11abb6=_0x16b45d;logger[_0x60ec('0xa')](_0x60ec('0x46'),_0x11abb6['id']);return getTicket(_0x14ed30,_0x592a53,_0x11abb6,_0x2b8620,_0x234ed4);})['then'](function(_0x11dd2e){if(_0x11dd2e&&_0x11dd2e['id']){logger[_0x60ec('0xa')](_0x60ec('0x19'));logger[_0x60ec('0xa')]('The\x20Ticket\x20ID\x20is:',_0x11dd2e['id']);logger[_0x60ec('0xa')](_0x60ec('0x51'),_0x60ec('0x47'));emit(util['format'](_0x60ec('0x48'),_0x316bc6[_0x60ec('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x60ec('0x52'),_0x14ed30[_0x60ec('0x18')],_0x11dd2e['id'])});}})['catch'](function(_0xaf319c){logger[_0x60ec('0x4a')](_0x60ec('0x51'),JSON['stringify'](_0xaf319c));});};exports[_0x60ec('0x53')]=function(_0x58cba3,_0x2b0653,_0x183317,_0x3b8746,_0x4777ec,_0x325ec4){var _0x3d70f2,_0xfd2e69;_0x325ec4[_0x60ec('0x18')]=intUtil[_0x60ec('0x3d')](_0x325ec4[_0x60ec('0x18')]);_0x325ec4[_0x60ec('0x3e')]=intUtil[_0x60ec('0x3d')](_0x325ec4[_0x60ec('0x3e')]);if(_0x4777ec&&_0x4777ec[_0x60ec('0x3f')]){logger[_0x60ec('0xa')]('['+_0x2b0653[_0x60ec('0x54')][_0x60ec('0x55')]()+']',_0x60ec('0x41'));_0x2b0653[_0x60ec('0x42')]=util[_0x60ec('0x16')](_0x60ec('0x43'),_0x325ec4[_0x60ec('0x3e')],_0x2b0653[_0x60ec('0x44')],md5(_0x2b0653[_0x60ec('0x44')]));}else{_0x2b0653['recordingURL']='';}headers[_0x60ec('0x4f')]=getAuth(_0x325ec4);return getUser(_0x325ec4,'')[_0x60ec('0x1c')](function(_0x93ab0b){_0x3d70f2=_0x93ab0b;logger['info'](_0x60ec('0x45'),_0x3d70f2['id']);return getEndUser(_0x325ec4,_0x2b0653[_0x60ec('0xd')],_0x2b0653[_0x60ec('0xe')]);})[_0x60ec('0x1c')](function(_0x251d74){_0xfd2e69=_0x251d74;logger[_0x60ec('0xa')]('The\x20Enduser\x20ID\x20is:',_0xfd2e69['id']);return getTicket(_0x325ec4,_0x3d70f2,_0xfd2e69,_0x183317,_0x2b0653);})[_0x60ec('0x1c')](function(_0x6f0bac){if(_0x6f0bac){logger[_0x60ec('0xa')](_0x60ec('0x19'));logger[_0x60ec('0xa')](_0x60ec('0x56'),_0x6f0bac['id']);}})[_0x60ec('0x49')](function(_0x4b46d4){logger[_0x60ec('0x4a')]('['+_0x2b0653['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x4b46d4));});}; \ No newline at end of file +var _0xe3c4=['[QUEUE]','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','catch','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','Ticket\x20created!','validateEmail','then','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','customField','nameField','toLowerCase','content','toString','type','push','idField','variableName','customVariable','Variable','queue','serverUrl','monitor_format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3c4,0x1d8));var _0x4e3c=function(_0x1ff52f,_0x41a2b2){_0x1ff52f=_0x1ff52f-0x0;var _0x3f06c4=_0xe3c4[_0x1ff52f];return _0x3f06c4;};'use strict';var _=require(_0x4e3c('0x0'));var rp=require(_0x4e3c('0x1'));var md5=require('md5');var util=require(_0x4e3c('0x2'));var Redis=require(_0x4e3c('0x3'));var intUtil=require(_0x4e3c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4e3c('0x5'))(_0x4e3c('0x6'));config[_0x4e3c('0x7')]=_[_0x4e3c('0x8')](config['redis'],{'host':_0x4e3c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x4e3c('0xa'),'Accept':'application/json'};function emit(_0x2412e2,_0x2e8983,_0x36de9b){io['to'](_0x2412e2)[_0x4e3c('0xb')](_0x2e8983,_0x36de9b);}function getTicket(_0x38ceeb,_0x5c7526,_0x34dae3,_0x6cc984,_0x4cedf7){logger[_0x4e3c('0xc')](_0x4e3c('0xd'));var _0x3785d1=_[_0x4e3c('0xe')]({'responder_id':_0x5c7526['id'],'requester_id':_0x34dae3['id'],'name':util[_0x4e3c('0xf')]('Caller\x20-\x20%s',_0x4cedf7[_0x4e3c('0x10')]),'phone':_0x4cedf7[_0x4e3c('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4e3c('0x12')](_0x6cc984[_0x4e3c('0x13')],_0x4cedf7,'\x20'),'description':intUtil[_0x4e3c('0x12')](_0x6cc984[_0x4e3c('0x14')],_0x4cedf7,_0x4e3c('0x15')),'tags':getTags(_0x6cc984[_0x4e3c('0x16')],_0x4e3c('0x17'))},getCustomFields(_0x6cc984[_0x4e3c('0x18')],_0x4cedf7));_0x3785d1[_0x4e3c('0x19')]=_[_0x4e3c('0x1a')](_[_0x4e3c('0x1b')](_0x3785d1[_0x4e3c('0x19')],'id'),_0x4e3c('0x1c'));return request({'uri':util[_0x4e3c('0xf')]('%s/api/v2/tickets',_0x38ceeb[_0x4e3c('0x1d')]),'method':'POST','body':_0x3785d1})['then'](function(_0x4b5cfd){logger['info'](_0x4e3c('0x1e'));return _0x4b5cfd;});}function getUser(_0x3fa3cb,_0x1b6875){if(intUtil[_0x4e3c('0x1f')](_0x1b6875)){return request({'uri':util[_0x4e3c('0xf')]('%s/api/v2/agents',_0x3fa3cb[_0x4e3c('0x1d')]),'qs':{'email':_0x1b6875}})[_0x4e3c('0x20')](function(_0x4e09ef){if(_0x4e09ef[_0x4e3c('0x21')]){logger[_0x4e3c('0xc')]('Agent\x20found!');return _[_0x4e3c('0x22')](_0x4e09ef,function(_0x432ba8){return _0x432ba8['contact'][_0x4e3c('0x23')]===_0x1b6875;});}else{logger[_0x4e3c('0xc')](_0x4e3c('0x24'));return request({'uri':util[_0x4e3c('0xf')](_0x4e3c('0x25'),_0x3fa3cb['remoteUri'])})[_0x4e3c('0x20')](function(_0x51b9fb){logger['info'](_0x4e3c('0x26'));return _0x51b9fb;});}});}else{logger[_0x4e3c('0xc')](_0x4e3c('0x27'));return request({'uri':util[_0x4e3c('0xf')](_0x4e3c('0x25'),_0x3fa3cb[_0x4e3c('0x1d')])})['then'](function(_0x3b5f30){logger[_0x4e3c('0xc')](_0x4e3c('0x26'));return _0x3b5f30;});}}function getEndUser(_0x108f18,_0x5c2075,_0x487cea){logger[_0x4e3c('0xc')]('Searching\x20enduser\x20with\x20phone',_0x487cea);return request({'uri':util['format']('%s/api/v2/contacts',_0x108f18[_0x4e3c('0x1d')]),'qs':{'phone':_0x487cea}})[_0x4e3c('0x20')](function(_0x92fdd5){if(_0x92fdd5[_0x4e3c('0x21')]){logger[_0x4e3c('0xc')]('Enduser\x20found!');return _[_0x4e3c('0x22')](_0x92fdd5,{'phone':_0x487cea});}else{logger['info'](_0x4e3c('0x28'));return request({'uri':util[_0x4e3c('0xf')](_0x4e3c('0x29'),_0x108f18[_0x4e3c('0x1d')]),'method':_0x4e3c('0x2a'),'body':{'name':_0x5c2075,'phone':_0x487cea}})['then'](function(_0x2a8461){logger[_0x4e3c('0xc')](_0x4e3c('0x2b'));return _0x2a8461;});}});}function getAuth(_0x1272c3){return util[_0x4e3c('0xf')]('Basic\x20%s',new Buffer(_0x1272c3[_0x4e3c('0x2c')]+':X')['toString'](_0x4e3c('0x2d')));}function request(_0x326312){logger[_0x4e3c('0x2e')](_0x4e3c('0x2f'),JSON[_0x4e3c('0x30')](_0x326312));return rp(_[_0x4e3c('0x8')](_0x326312,{'method':_0x4e3c('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1046af,_0x2a8a97){var _0x117f8a=[];if(_0x1046af&&_0x1046af['length']>0x0){_0x117f8a=_[_0x4e3c('0x32')](_0x1046af,_0x2a8a97);}return _0x117f8a;}function getCustomFields(_0x5028c4,_0xb42386){var _0x1ad371=[];var _0x21794a={'custom_fields':[]};if(_0x5028c4[_0x4e3c('0x21')]>0x0){_['forEach'](_0x5028c4,function(_0x59b1c8){if(_[_0x4e3c('0x33')]([_0x4e3c('0x34'),_0x4e3c('0x35')],_0x59b1c8['type'])&&_0x59b1c8['nameField']&&!_0x59b1c8[_0x4e3c('0x36')]){_0x21794a[_0x59b1c8[_0x4e3c('0x37')][_0x4e3c('0x38')]()]=_0x59b1c8[_0x4e3c('0x39')][_0x4e3c('0x3a')]();}else if(_['includes'](['string',_0x4e3c('0x35')],_0x59b1c8[_0x4e3c('0x3b')])&&_0x59b1c8['idField']&&_0x59b1c8[_0x4e3c('0x36')]){_0x21794a[_0x4e3c('0x19')][_0x4e3c('0x3c')]({'id':_0x59b1c8[_0x4e3c('0x3d')],'value':_0x59b1c8['content'][_0x4e3c('0x3a')]()});}else if(_0x59b1c8[_0x4e3c('0x3b')]==='variable'&&_0x59b1c8[_0x4e3c('0x3e')]&&_0x59b1c8[_0x4e3c('0x3d')]&&_0x59b1c8[_0x4e3c('0x36')]){_0xb42386[_0x59b1c8['variableName']]&&_0x21794a[_0x4e3c('0x19')][_0x4e3c('0x3c')]({'id':_0x59b1c8[_0x4e3c('0x3d')],'value':_0xb42386[_0x59b1c8[_0x4e3c('0x3e')]][_0x4e3c('0x3a')]()});}else if(_0x59b1c8['type']===_0x4e3c('0x3f')&&_0x59b1c8[_0x4e3c('0x40')]&&_0x59b1c8[_0x4e3c('0x40')][_0x4e3c('0x17')]&&_0x59b1c8[_0x4e3c('0x3d')]&&_0x59b1c8['customField']){_0xb42386[_0x59b1c8[_0x4e3c('0x40')]['name'][_0x4e3c('0x38')]()]&&_0x21794a[_0x4e3c('0x19')][_0x4e3c('0x3c')]({'id':_0x59b1c8[_0x4e3c('0x3d')],'value':_0xb42386[_0x59b1c8[_0x4e3c('0x40')][_0x4e3c('0x17')]['toLowerCase']()][_0x4e3c('0x3a')]()});}});}return _0x21794a;}exports[_0x4e3c('0x41')]=function(_0xbb1ae2,_0x3727d7,_0x59ae6f,_0x49ed81,_0x3fadbe,_0x58dfcd){var _0x9f941b,_0x12274b;_0x58dfcd[_0x4e3c('0x1d')]=intUtil['stripTrailingSlash'](_0x58dfcd[_0x4e3c('0x1d')]);_0x58dfcd['serverUrl']=intUtil['stripTrailingSlash'](_0x58dfcd[_0x4e3c('0x42')]);if(_0x3fadbe&&_0x3fadbe[_0x4e3c('0x43')]){logger[_0x4e3c('0xc')](_0x4e3c('0x44'),'Recording\x20is\x20enabled!');_0x3727d7[_0x4e3c('0x45')]=util[_0x4e3c('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58dfcd['serverUrl'],_0x3727d7[_0x4e3c('0x46')],md5(_0x3727d7[_0x4e3c('0x46')]));}else{_0x3727d7[_0x4e3c('0x45')]='';}headers[_0x4e3c('0x47')]=getAuth(_0x58dfcd);return getUser(_0x58dfcd,_0x49ed81[_0x4e3c('0x23')])['then'](function(_0x298568){_0x9f941b=_0x298568;logger[_0x4e3c('0xc')](_0x4e3c('0x48'),_0x9f941b['id']);return getEndUser(_0x58dfcd,_0x3727d7[_0x4e3c('0x10')],_0x3727d7[_0x4e3c('0x11')]);})[_0x4e3c('0x20')](function(_0x23e4ab){_0x12274b=_0x23e4ab;logger[_0x4e3c('0xc')]('The\x20Enduser\x20ID\x20is:',_0x12274b['id']);return getTicket(_0x58dfcd,_0x9f941b,_0x12274b,_0x59ae6f,_0x3727d7);})[_0x4e3c('0x20')](function(_0x3c9c2b){if(_0x3c9c2b&&_0x3c9c2b['id']){logger[_0x4e3c('0xc')]('Ticket\x20created!');logger['info'](_0x4e3c('0x49'),_0x3c9c2b['id']);logger['info'](_0x4e3c('0x44'),_0x4e3c('0x4a'));emit(util['format']('user:%s',_0x49ed81[_0x4e3c('0x17')]),'trigger:browser:url',{'uri':util['format'](_0x4e3c('0x4b'),_0x58dfcd[_0x4e3c('0x1d')],_0x3c9c2b['id'])});}})['catch'](function(_0x4735f7){logger[_0x4e3c('0x4c')](_0x4e3c('0x44'),JSON['stringify'](_0x4735f7));});};exports[_0x4e3c('0x4d')]=function(_0x31b630,_0x1ddd8a,_0x53621d,_0x416a3b,_0x454970,_0x19f47e,_0x170e5c){var _0x1dae7b,_0x7de13e;_0x19f47e['remoteUri']=intUtil[_0x4e3c('0x4e')](_0x19f47e[_0x4e3c('0x1d')]);_0x19f47e['serverUrl']=intUtil[_0x4e3c('0x4e')](_0x19f47e[_0x4e3c('0x42')]);if(_0x170e5c&&_0x170e5c[_0x4e3c('0x4f')]&&_0x170e5c['recordingFormat']!=='none'){logger[_0x4e3c('0xc')](_0x4e3c('0x50'),_0x4e3c('0x51'));_0x1ddd8a[_0x4e3c('0x45')]=util['format'](_0x4e3c('0x52'),_0x19f47e[_0x4e3c('0x42')],_0x1ddd8a[_0x4e3c('0x46')],md5(_0x1ddd8a[_0x4e3c('0x46')]));}headers[_0x4e3c('0x47')]=getAuth(_0x19f47e);return getUser(_0x19f47e,_0x416a3b[_0x4e3c('0x23')])[_0x4e3c('0x20')](function(_0x2da629){_0x1dae7b=_0x2da629;logger['info']('The\x20User\x20ID\x20is:',_0x1dae7b['id']);return getEndUser(_0x19f47e,_0x1ddd8a[_0x4e3c('0x53')],_0x1ddd8a[_0x4e3c('0x54')]);})[_0x4e3c('0x20')](function(_0x18cf17){_0x7de13e=_0x18cf17;logger[_0x4e3c('0xc')](_0x4e3c('0x55'),_0x7de13e['id']);return getTicket(_0x19f47e,_0x1dae7b,_0x7de13e,_0x53621d,_0x1ddd8a);})[_0x4e3c('0x20')](function(_0x2154e9){if(_0x2154e9&&_0x2154e9['id']){logger[_0x4e3c('0xc')](_0x4e3c('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2154e9['id']);logger[_0x4e3c('0xc')]('[OUTBOUND]',_0x4e3c('0x4a'));emit(util[_0x4e3c('0xf')]('user:%s',_0x416a3b[_0x4e3c('0x17')]),_0x4e3c('0x56'),{'uri':util['format'](_0x4e3c('0x4b'),_0x19f47e[_0x4e3c('0x1d')],_0x2154e9['id'])});}})[_0x4e3c('0x57')](function(_0x279309){logger['error']('[OUTBOUND]',JSON[_0x4e3c('0x30')](_0x279309));});};exports['unmanaged']=function(_0x34f2f4,_0xf67048,_0x16ce83,_0x6811ab,_0x467362,_0x5bf282){var _0x4a94f3,_0x3fc72f;_0x5bf282[_0x4e3c('0x1d')]=intUtil[_0x4e3c('0x4e')](_0x5bf282[_0x4e3c('0x1d')]);_0x5bf282[_0x4e3c('0x42')]=intUtil[_0x4e3c('0x4e')](_0x5bf282[_0x4e3c('0x42')]);if(_0x467362&&_0x467362['monitor_format']){logger[_0x4e3c('0xc')]('['+_0xf67048[_0x4e3c('0x58')]['toUpperCase']()+']',_0x4e3c('0x51'));_0xf67048[_0x4e3c('0x45')]=util[_0x4e3c('0xf')](_0x4e3c('0x52'),_0x5bf282['serverUrl'],_0xf67048[_0x4e3c('0x46')],md5(_0xf67048[_0x4e3c('0x46')]));}else{_0xf67048[_0x4e3c('0x45')]='';}headers[_0x4e3c('0x47')]=getAuth(_0x5bf282);return getUser(_0x5bf282,'')[_0x4e3c('0x20')](function(_0x5d2446){_0x4a94f3=_0x5d2446;logger[_0x4e3c('0xc')](_0x4e3c('0x48'),_0x4a94f3['id']);return getEndUser(_0x5bf282,_0xf67048[_0x4e3c('0x10')],_0xf67048[_0x4e3c('0x11')]);})[_0x4e3c('0x20')](function(_0x5b0e25){_0x3fc72f=_0x5b0e25;logger[_0x4e3c('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3fc72f['id']);return getTicket(_0x5bf282,_0x4a94f3,_0x3fc72f,_0x16ce83,_0xf67048);})[_0x4e3c('0x20')](function(_0x52f80c){if(_0x52f80c){logger['info'](_0x4e3c('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x52f80c['id']);}})[_0x4e3c('0x57')](function(_0x6cd82f){logger['error']('['+_0xf67048['lastevent'][_0x4e3c('0x59')]()+']',JSON[_0x4e3c('0x30')](_0x6cd82f));});}; \ 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 ecd8a4c..9963084 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 _0x2ccc=['Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail'];(function(_0x211fe5,_0x46dba4){var _0x561c9d=function(_0x25fdbe){while(--_0x25fdbe){_0x211fe5['push'](_0x211fe5['shift']());}};_0x561c9d(++_0x46dba4);}(_0x2ccc,0x193));var _0xc2cc=function(_0x43758b,_0x320468){_0x43758b=_0x43758b-0x0;var _0x1b0b2c=_0x2ccc[_0x43758b];return _0x1b0b2c;};'use strict';var _=require(_0xc2cc('0x0'));var rp=require(_0xc2cc('0x1'));var md5=require('md5');var util=require(_0xc2cc('0x2'));var moment=require('moment');var Promise=require(_0xc2cc('0x3'));var Redis=require(_0xc2cc('0x4'));var intUtil=require(_0xc2cc('0x5'));var config=require(_0xc2cc('0x6'));var logger=require(_0xc2cc('0x7'))(_0xc2cc('0x8'));config[_0xc2cc('0x9')]=_['defaults'](config[_0xc2cc('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc2cc('0x9')]));function getAdminId(_0x1b1fe7,_0x12e302,_0x12aa06,_0x24b885){return new Promise(function(_0x14e73f,_0x244928){var _0x87ccb9=![];var _0x36d0c8={'method':_0xc2cc('0xa'),'uri':_0x24b885+_0xc2cc('0xb'),'json':!![]};_0x36d0c8['headers']=_0x12aa06;logger['info'](_0xc2cc('0xc'));return rp(_0x36d0c8)[_0xc2cc('0xd')](function(_0x35d7b5){if(_0x35d7b5){var _0x3306d7=_0x35d7b5[_0xc2cc('0xe')];var _0x40ce94=null;for(_0x40ce94=0x0;_0x40ce94<_0x3306d7[_0xc2cc('0xf')];_0x40ce94++){if(_0x3306d7[_0x40ce94][_0xc2cc('0x10')]===_0x1b1fe7[_0xc2cc('0x11')]){_0x1b1fe7['adminId']=_0x3306d7[_0x40ce94]['id'];_0x87ccb9=!![];}}if(_0x87ccb9){logger[_0xc2cc('0x12')](_0xc2cc('0x13'),_0x1b1fe7[_0xc2cc('0x14')]);_0x14e73f(_0x1b1fe7);}else{_0x244928({'statusCode':0x194,'message':_0xc2cc('0x15')});}}else{_0x244928({'statusCode':0x194,'message':_0xc2cc('0x15')});}})[_0xc2cc('0x16')](function(_0x4f51f8){logger['error']('['+[_0x12e302[_0xc2cc('0x17')]()]+']',_0x4f51f8[_0xc2cc('0x18')]);_0x244928(_0x4f51f8);});});}function getUser(_0x1d1ec7,_0x5e1bbc,_0x4404b2){return function(_0x291bc3){return new Promise(function(_0x4f342d,_0x4d999c){var _0x474a63={'method':_0xc2cc('0xa'),'uri':_0x4404b2+_0xc2cc('0xb'),'json':!![]};_0x474a63['headers']=_0x5e1bbc;logger[_0xc2cc('0x12')](_0xc2cc('0x19'));return rp(_0x474a63)[_0xc2cc('0xd')](function(_0x20a3d0){if(_0x20a3d0){var _0x4e5631=_0x20a3d0[_0xc2cc('0xe')];var _0x3806fb=![];var _0x5569b1=null;if(_0x291bc3[_0xc2cc('0x1a')]!==null){logger['info'](_0xc2cc('0x1b'),_0x291bc3['agentEmail']);_0x291bc3[_0xc2cc('0x1c')]=_0x291bc3[_0xc2cc('0x1a')];for(_0x5569b1=0x0;_0x5569b1<_0x4e5631[_0xc2cc('0xf')];_0x5569b1++){if(_0x4e5631[_0x5569b1][_0xc2cc('0x10')]===_0x291bc3[_0xc2cc('0x1a')]){_0x3806fb=!![];_0x291bc3[_0xc2cc('0x1d')]=_0x4e5631[_0x5569b1]['id'];logger[_0xc2cc('0x12')]('User\x20found:',_0x291bc3[_0xc2cc('0x1d')]);}}}if(!_0x3806fb){logger[_0xc2cc('0x12')](_0xc2cc('0x1e'));_0x291bc3['userEmail']=_0x291bc3['adminEmail'];_0x291bc3['userId']=_0x291bc3[_0xc2cc('0x14')];_0x3806fb=!![];}if(_0x3806fb){_0x4f342d(_0x291bc3);}else{_0x4d999c({'statusCode':0x194,'message':_0xc2cc('0x15')});}}else{_0x4d999c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc2cc('0x16')](function(_0x5aa2ad){logger[_0xc2cc('0x1f')]('['+[_0x1d1ec7['toUpperCase']()]+']',_0x5aa2ad['message']);_0x4d999c(_0x5aa2ad);});});};}function searchContact(_0x4f5d90,_0x1b5a12,_0x277458,_0x215d90){return new Promise(function(_0x3608c9,_0x514e8f){var _0x2907c9={'method':_0xc2cc('0xa'),'headers':_0x1b5a12,'uri':_0x4f5d90+_0xc2cc('0x20')+_0x215d90+_0xc2cc('0x21')+_0x277458+_0xc2cc('0x22'),'json':!![]};rp(_0x2907c9)['then'](function(_0x41e7bc){var _0x550b88=_[_0xc2cc('0x23')](_0x41e7bc[_0xc2cc('0x24')][_0xc2cc('0x24')],[_0x277458,_0x215d90]);_0x3608c9(_0x550b88);})['catch'](function(_0x502c39){_0x514e8f(_0x502c39);});});}function getEndUser(_0x2ccfa8,_0x1d55c3,_0x71a6dd){return function(_0x275a5d){return new Promise(function(_0x1a92e4,_0x1730c3){logger[_0xc2cc('0x12')](util[_0xc2cc('0x25')](_0xc2cc('0x26'),_0x275a5d['contactNumber']));searchContact(_0x71a6dd,_0x1d55c3,_0xc2cc('0x27'),_0x275a5d['contactNumber'])[_0xc2cc('0xd')](function(_0x1d4dae){if(_0x1d4dae){_0x275a5d[_0xc2cc('0x28')]=_0x1d4dae['id'];logger[_0xc2cc('0x12')](_0xc2cc('0x29'),_0x275a5d['endUserId']);return _0x1a92e4(_0x275a5d);}searchContact(_0x71a6dd,_0x1d55c3,_0xc2cc('0x2a'),_0x275a5d['contactNumber'])['then'](function(_0x3cf96c){if(_0x3cf96c){_0x275a5d[_0xc2cc('0x28')]=_0x3cf96c['id'];logger[_0xc2cc('0x12')](_0xc2cc('0x2b'),_0x275a5d[_0xc2cc('0x28')]);return _0x1a92e4(_0x275a5d);}createEndUser(_0x275a5d,_0x2ccfa8,_0x1d55c3,_0x71a6dd)[_0xc2cc('0xd')](function(_0x22a87d){logger[_0xc2cc('0x12')](_0xc2cc('0x2c'),_0x22a87d[_0xc2cc('0x28')]);return _0x1a92e4(_0x22a87d);});});})[_0xc2cc('0x16')](function(_0x3c5118){_0x1730c3(_0x3c5118);});});};}function createEndUser(_0x5a37ff,_0x4c4d5e,_0x476ad8,_0x33511e){return new Promise(function(_0x2ab8d1,_0x6223fd){var _0x35d7b8=moment();var _0x4895c2={'method':_0xc2cc('0x2d'),'uri':_0x33511e+_0xc2cc('0x2e'),'body':{'contact':{'last_name':_0x5a37ff[_0xc2cc('0x2f')],'work_number':_0x5a37ff[_0xc2cc('0x2f')],'mobile_number':_0x5a37ff[_0xc2cc('0x2f')],'owner_id':_0x5a37ff[_0xc2cc('0x1d')],'created_at':_0x35d7b8[_0xc2cc('0x25')](_0xc2cc('0x30'))}},'json':!![]};_0x4895c2[_0xc2cc('0x31')]=_0x476ad8;logger[_0xc2cc('0x12')](_0xc2cc('0x32'));return rp(_0x4895c2)[_0xc2cc('0xd')](function(_0x3e2625){_0x5a37ff[_0xc2cc('0x28')]=_0x3e2625[_0xc2cc('0x33')]['id'];_0x2ab8d1(_0x5a37ff);})[_0xc2cc('0x16')](function(_0x2f621b){logger['error']('['+[_0x4c4d5e[_0xc2cc('0x17')]()]+']',_0x2f621b[_0xc2cc('0x18')]);_0x6223fd(_0x2f621b['message']);});});}function getTicket(_0x427a6f,_0x29ed45,_0x5e62a4,_0x367274,_0x1bc161){return function(_0x28d35f){logger[_0xc2cc('0x12')](_0xc2cc('0x34'));return new Promise(function(_0x52c654,_0x22b2e8){var _0x279796=moment();var _0x40f207={'method':_0xc2cc('0x2d'),'uri':_0x5e62a4+_0xc2cc('0x35'),'body':{'title':intUtil[_0xc2cc('0x36')](_0x367274[_0xc2cc('0x37')],_0x1bc161,'\x20'),'description':intUtil['getString'](_0x367274[_0xc2cc('0x38')],_0x1bc161,'\x0a'),'owner_id':_0x28d35f[_0xc2cc('0x1d')],'creater_id':_0x28d35f['adminId'],'targetable_id':_0x28d35f[_0xc2cc('0x28')],'targetable_type':_0xc2cc('0x39'),'created_at':_0x279796[_0xc2cc('0x25')](_0xc2cc('0x30')),'due_date':_0x279796[_0xc2cc('0x3a')](0x1e,'m')[_0xc2cc('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x40f207['headers']=_0x29ed45;return rp(_0x40f207)['then'](function(_0x4111ef){_0x28d35f[_0xc2cc('0x3b')]=_0x4111ef['task']['id'];logger[_0xc2cc('0x12')]('Task\x20created:',_0x28d35f[_0xc2cc('0x3b')]);_0x52c654(_0x28d35f);})['catch'](function(_0x49dcb0){logger['error']('['+[_0x427a6f[_0xc2cc('0x17')]()]+']',_0x49dcb0[_0xc2cc('0x18')]);_0x22b2e8(_0x49dcb0['message']);});});};}function emit(_0x59c3e4,_0x25ec35,_0xda8007){var _0x9cc9c2={'uri':_0x59c3e4+_0xc2cc('0x3c')+_0xda8007};io['to'](util[_0xc2cc('0x25')](_0xc2cc('0x3d'),_0x25ec35))[_0xc2cc('0x3e')](_0xc2cc('0x3f'),_0x9cc9c2);}exports['cs']=function(_0x503809,_0xd3ad88,_0x50bd8e,_0x16ff64,_0x473294,_0x5c3366,_0x5841df,_0x19fa7b){var _0x445811={};var _0x191cec={'Authorization':_0xc2cc('0x40')+_0x5c3366['apiKey']};_0x5c3366[_0xc2cc('0x41')]=intUtil['stripTrailingSlash'](_0x5c3366[_0xc2cc('0x41')]);_0x5c3366['serverUrl']=intUtil[_0xc2cc('0x42')](_0x5c3366[_0xc2cc('0x43')]);var _0x3fa615=_0x5c3366['remoteUri'];_0x445811['adminEmail']=_0x5c3366['username'];_0x445811['contactNumber']=_0x19fa7b[_0xc2cc('0x44')]()==='outbound'?_0xd3ad88[_0xc2cc('0x45')]:_0xd3ad88[_0xc2cc('0x46')];_0x445811[_0xc2cc('0x47')]=_0x19fa7b==='queue'||_0x19fa7b===_0xc2cc('0x48')?_0xc2cc('0x49'):_0xc2cc('0x4a');if(_0x16ff64){_0x445811['agentEmail']=_0x16ff64['email'];}var _0x13c785=util[_0xc2cc('0x25')](_0xc2cc('0x4b'),_0x5c3366[_0xc2cc('0x43')],_0xd3ad88['uniqueid'],md5(_0xd3ad88[_0xc2cc('0x4c')]));if(_0x473294&&_0x473294[_0xc2cc('0x4d')]){logger[_0xc2cc('0x12')](_0xc2cc('0x4e'),'Recording\x20is\x20enabled!');_0xd3ad88['recordingURL']=_0x13c785;}else if(_0x5841df&&_0x5841df['recordingFormat']&&_0x5841df[_0xc2cc('0x4f')]!==_0xc2cc('0x50')){logger[_0xc2cc('0x12')](_0xc2cc('0x51'),_0xc2cc('0x52'));_0xd3ad88[_0xc2cc('0x53')]=_0x13c785;}else{_0xd3ad88[_0xc2cc('0x53')]='';}return getAdminId(_0x445811,_0x19fa7b,_0x191cec,_0x3fa615)['then'](getUser(_0x19fa7b,_0x191cec,_0x3fa615))[_0xc2cc('0xd')](getEndUser(_0x19fa7b,_0x191cec,_0x3fa615))[_0xc2cc('0xd')](getTicket(_0x19fa7b,_0x191cec,_0x3fa615,_0x50bd8e,_0xd3ad88))[_0xc2cc('0xd')](function(_0x211cf8){logger[_0xc2cc('0x12')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x211cf8['ticketId']));if(_0x19fa7b!=='unmanaged'){logger[_0xc2cc('0x12')]('['+[_0x19fa7b[_0xc2cc('0x17')]()]+']',_0xc2cc('0x54'));emit(_0x3fa615,_0x16ff64['name'],_0x211cf8[_0xc2cc('0x28')]);}})['catch'](function(_0x1894ad){logger[_0xc2cc('0x1f')]('['+[_0x19fa7b[_0xc2cc('0x17')]()]+_0xc2cc('0x55'),util['inspect'](_0x1894ad,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x051e=['The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','task','Task\x20created:','ticketId','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x051e,0x1ea));var _0xe051=function(_0x410800,_0x3ea17a){_0x410800=_0x410800-0x0;var _0xbd45a2=_0x051e[_0x410800];return _0xbd45a2;};'use strict';var _=require(_0xe051('0x0'));var rp=require(_0xe051('0x1'));var md5=require('md5');var util=require(_0xe051('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0xe051('0x3'));var intUtil=require(_0xe051('0x4'));var config=require(_0xe051('0x5'));var logger=require(_0xe051('0x6'))('freshsales');config[_0xe051('0x7')]=_[_0xe051('0x8')](config[_0xe051('0x7')],{'host':_0xe051('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x4b647,_0x406f5e,_0xed2076,_0x26165e){return new Promise(function(_0xf3ffc6,_0x3d9810){var _0x2ed93e=![];var _0x2a0c8f={'method':_0xe051('0xa'),'uri':_0x26165e+'/api/selector/owners','json':!![]};_0x2a0c8f[_0xe051('0xb')]=_0xed2076;logger[_0xe051('0xc')](_0xe051('0xd'));return rp(_0x2a0c8f)[_0xe051('0xe')](function(_0x3903dc){if(_0x3903dc){var _0x5dbd8d=_0x3903dc[_0xe051('0xf')];var _0x14210a=null;for(_0x14210a=0x0;_0x14210a<_0x5dbd8d[_0xe051('0x10')];_0x14210a++){if(_0x5dbd8d[_0x14210a][_0xe051('0x11')]===_0x4b647[_0xe051('0x12')]){_0x4b647['adminId']=_0x5dbd8d[_0x14210a]['id'];_0x2ed93e=!![];}}if(_0x2ed93e){logger[_0xe051('0xc')](_0xe051('0x13'),_0x4b647[_0xe051('0x14')]);_0xf3ffc6(_0x4b647);}else{_0x3d9810({'statusCode':0x194,'message':_0xe051('0x15')});}}else{_0x3d9810({'statusCode':0x194,'message':_0xe051('0x15')});}})[_0xe051('0x16')](function(_0x3f3bf9){logger[_0xe051('0x17')]('['+[_0x406f5e['toUpperCase']()]+']',_0x3f3bf9['message']);_0x3d9810(_0x3f3bf9);});});}function getUser(_0x177438,_0x46c62e,_0x5803a7){return function(_0x54086b){return new Promise(function(_0x23646c,_0x45e1f0){var _0x1fd463={'method':_0xe051('0xa'),'uri':_0x5803a7+_0xe051('0x18'),'json':!![]};_0x1fd463[_0xe051('0xb')]=_0x46c62e;logger['info'](_0xe051('0x19'));return rp(_0x1fd463)['then'](function(_0x28b47a){if(_0x28b47a){var _0x19b9f6=_0x28b47a['users'];var _0xf4882f=![];var _0xff4f8a=null;if(_0x54086b[_0xe051('0x1a')]!==null){logger[_0xe051('0xc')](_0xe051('0x1b'),_0x54086b[_0xe051('0x1a')]);_0x54086b[_0xe051('0x1c')]=_0x54086b[_0xe051('0x1a')];for(_0xff4f8a=0x0;_0xff4f8a<_0x19b9f6['length'];_0xff4f8a++){if(_0x19b9f6[_0xff4f8a]['email']===_0x54086b[_0xe051('0x1a')]){_0xf4882f=!![];_0x54086b[_0xe051('0x1d')]=_0x19b9f6[_0xff4f8a]['id'];logger[_0xe051('0xc')](_0xe051('0x1e'),_0x54086b[_0xe051('0x1d')]);}}}if(!_0xf4882f){logger[_0xe051('0xc')](_0xe051('0x1f'));_0x54086b[_0xe051('0x1c')]=_0x54086b['adminEmail'];_0x54086b['userId']=_0x54086b[_0xe051('0x14')];_0xf4882f=!![];}if(_0xf4882f){_0x23646c(_0x54086b);}else{_0x45e1f0({'statusCode':0x194,'message':_0xe051('0x15')});}}else{_0x45e1f0({'statusCode':0x194,'message':_0xe051('0x15')});}})[_0xe051('0x16')](function(_0x392b48){logger['error']('['+[_0x177438['toUpperCase']()]+']',_0x392b48[_0xe051('0x20')]);_0x45e1f0(_0x392b48);});});};}function searchContact(_0x43dddf,_0x1cade1,_0x23eeb2,_0x1c1dce){return new Promise(function(_0x44e2a4,_0x3766c8){var _0x384f45={'method':_0xe051('0xa'),'headers':_0x1cade1,'uri':_0x43dddf+_0xe051('0x21')+_0x1c1dce+_0xe051('0x22')+_0x23eeb2+_0xe051('0x23'),'json':!![]};rp(_0x384f45)['then'](function(_0x2f66e4){var _0x15af5c=_['find'](_0x2f66e4[_0xe051('0x24')]['contacts'],[_0x23eeb2,_0x1c1dce]);_0x44e2a4(_0x15af5c);})['catch'](function(_0x25b13c){_0x3766c8(_0x25b13c);});});}function getEndUser(_0x25a39b,_0x3e1fca,_0x3b45e2){return function(_0x58d48a){return new Promise(function(_0x9dbb63,_0x1dd761){logger['info'](util['format'](_0xe051('0x25'),_0x58d48a[_0xe051('0x26')]));searchContact(_0x3b45e2,_0x3e1fca,_0xe051('0x27'),_0x58d48a[_0xe051('0x26')])[_0xe051('0xe')](function(_0x1ba124){if(_0x1ba124){_0x58d48a[_0xe051('0x28')]=_0x1ba124['id'];logger[_0xe051('0xc')](_0xe051('0x29'),_0x58d48a[_0xe051('0x28')]);return _0x9dbb63(_0x58d48a);}searchContact(_0x3b45e2,_0x3e1fca,_0xe051('0x2a'),_0x58d48a[_0xe051('0x26')])[_0xe051('0xe')](function(_0x3e45d2){if(_0x3e45d2){_0x58d48a[_0xe051('0x28')]=_0x3e45d2['id'];logger[_0xe051('0xc')](_0xe051('0x2b'),_0x58d48a[_0xe051('0x28')]);return _0x9dbb63(_0x58d48a);}createEndUser(_0x58d48a,_0x25a39b,_0x3e1fca,_0x3b45e2)[_0xe051('0xe')](function(_0x41ecef){logger[_0xe051('0xc')]('Contact\x20created:',_0x41ecef['endUserId']);return _0x9dbb63(_0x41ecef);});});})[_0xe051('0x16')](function(_0x16bbc0){_0x1dd761(_0x16bbc0);});});};}function createEndUser(_0x326a94,_0x1c143b,_0x47a5e3,_0x1332ac){return new Promise(function(_0x4d14b4,_0x426544){var _0xccb822=moment();var _0xabfa94={'method':_0xe051('0x2c'),'uri':_0x1332ac+'/api/contacts','body':{'contact':{'last_name':_0x326a94[_0xe051('0x26')],'work_number':_0x326a94[_0xe051('0x26')],'mobile_number':_0x326a94[_0xe051('0x26')],'owner_id':_0x326a94[_0xe051('0x1d')],'created_at':_0xccb822[_0xe051('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xabfa94[_0xe051('0xb')]=_0x47a5e3;logger[_0xe051('0xc')](_0xe051('0x2e'));return rp(_0xabfa94)['then'](function(_0x3f6bff){_0x326a94[_0xe051('0x28')]=_0x3f6bff[_0xe051('0x2f')]['id'];_0x4d14b4(_0x326a94);})[_0xe051('0x16')](function(_0x116011){logger[_0xe051('0x17')]('['+[_0x1c143b[_0xe051('0x30')]()]+']',_0x116011[_0xe051('0x20')]);_0x426544(_0x116011[_0xe051('0x20')]);});});}function getTicket(_0x19bfe6,_0x68b3ae,_0x192176,_0x386f0d,_0x19ab0d){return function(_0x273042){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x364efe,_0x594f77){var _0x3d179e=moment();var _0x39bbf0={'method':_0xe051('0x2c'),'uri':_0x192176+_0xe051('0x31'),'body':{'title':intUtil[_0xe051('0x32')](_0x386f0d[_0xe051('0x33')],_0x19ab0d,'\x20'),'description':intUtil[_0xe051('0x32')](_0x386f0d[_0xe051('0x34')],_0x19ab0d,'\x0a'),'owner_id':_0x273042[_0xe051('0x1d')],'creater_id':_0x273042[_0xe051('0x14')],'targetable_id':_0x273042[_0xe051('0x28')],'targetable_type':'Contact','created_at':_0x3d179e[_0xe051('0x2d')](_0xe051('0x35')),'due_date':_0x3d179e[_0xe051('0x36')](0x1e,'m')['format'](_0xe051('0x35'))},'json':!![]};_0x39bbf0[_0xe051('0xb')]=_0x68b3ae;return rp(_0x39bbf0)[_0xe051('0xe')](function(_0x2a1f42){_0x273042['ticketId']=_0x2a1f42[_0xe051('0x37')]['id'];logger[_0xe051('0xc')](_0xe051('0x38'),_0x273042[_0xe051('0x39')]);_0x364efe(_0x273042);})[_0xe051('0x16')](function(_0x3c0581){logger[_0xe051('0x17')]('['+[_0x19bfe6['toUpperCase']()]+']',_0x3c0581[_0xe051('0x20')]);_0x594f77(_0x3c0581[_0xe051('0x20')]);});});};}function emit(_0x10f932,_0x5775f4,_0xe9e09){var _0x33eb4f={'uri':_0x10f932+'/contacts/'+_0xe9e09};io['to'](util['format'](_0xe051('0x3a'),_0x5775f4))['emit'](_0xe051('0x3b'),_0x33eb4f);}exports['cs']=function(_0x2f2e59,_0x56a79f,_0x2973e4,_0x3363d9,_0x2789af,_0x5e2f09,_0x5cb561,_0x4accdf){var _0x1160e6={};var _0x37d23e={'Authorization':_0xe051('0x3c')+_0x5e2f09['apiKey']};_0x5e2f09[_0xe051('0x3d')]=intUtil[_0xe051('0x3e')](_0x5e2f09[_0xe051('0x3d')]);_0x5e2f09['serverUrl']=intUtil[_0xe051('0x3e')](_0x5e2f09[_0xe051('0x3f')]);var _0x16aa39=_0x5e2f09[_0xe051('0x3d')];_0x1160e6[_0xe051('0x12')]=_0x5e2f09['username'];_0x1160e6[_0xe051('0x26')]=_0x4accdf['toLowerCase']()==='outbound'?_0x56a79f[_0xe051('0x40')]:_0x56a79f[_0xe051('0x41')];_0x1160e6[_0xe051('0x42')]=_0x4accdf===_0xe051('0x43')||_0x4accdf==='unmanaged'?_0xe051('0x43'):_0xe051('0x44');if(_0x3363d9){_0x1160e6['agentEmail']=_0x3363d9[_0xe051('0x11')];}var _0x1a6ff0=util[_0xe051('0x2d')](_0xe051('0x45'),_0x5e2f09[_0xe051('0x3f')],_0x56a79f[_0xe051('0x46')],md5(_0x56a79f[_0xe051('0x46')]));if(_0x2789af&&_0x2789af[_0xe051('0x47')]){logger[_0xe051('0xc')]('[QUEUE]',_0xe051('0x48'));_0x56a79f['recordingURL']=_0x1a6ff0;}else if(_0x5cb561&&_0x5cb561[_0xe051('0x49')]&&_0x5cb561[_0xe051('0x49')]!==_0xe051('0x4a')){logger[_0xe051('0xc')](_0xe051('0x4b'),_0xe051('0x48'));_0x56a79f[_0xe051('0x4c')]=_0x1a6ff0;}else{_0x56a79f[_0xe051('0x4c')]='';}return getAdminId(_0x1160e6,_0x4accdf,_0x37d23e,_0x16aa39)[_0xe051('0xe')](getUser(_0x4accdf,_0x37d23e,_0x16aa39))[_0xe051('0xe')](getEndUser(_0x4accdf,_0x37d23e,_0x16aa39))['then'](getTicket(_0x4accdf,_0x37d23e,_0x16aa39,_0x2973e4,_0x56a79f))[_0xe051('0xe')](function(_0x343be7){logger[_0xe051('0xc')](util[_0xe051('0x2d')](_0xe051('0x4d'),_0x343be7[_0xe051('0x39')]));if(_0x4accdf!=='unmanaged'){logger[_0xe051('0xc')]('['+[_0x4accdf[_0xe051('0x30')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x16aa39,_0x3363d9[_0xe051('0x4e')],_0x343be7['endUserId']);}})[_0xe051('0x16')](function(_0x38ba4a){logger[_0xe051('0x17')]('['+[_0x4accdf['toUpperCase']()]+_0xe051('0x4f'),util[_0xe051('0x50')](_0x38ba4a,{'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 0b60f58..2bd7dcc 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 _0xa7a1=['salesforce','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','desk','vtiger','freshsales','exec','data1','data2','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','zendesk'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xa7a1,0x1b8));var _0x1a7a=function(_0x4e346a,_0x1ba060){_0x4e346a=_0x4e346a-0x0;var _0x12ac3a=_0xa7a1[_0x4e346a];return _0x12ac3a;};'use strict';var _=require(_0x1a7a('0x0'));var util=require(_0x1a7a('0x1'));var zendesk=require(_0x1a7a('0x2'));var salesforce=require(_0x1a7a('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x1a7a('0x4'));var zoho=require(_0x1a7a('0x5'));var desk=require(_0x1a7a('0x6'));var vtiger=require(_0x1a7a('0x7'));var servicenow=require(_0x1a7a('0x8'));var dynamics365=require(_0x1a7a('0x9'));var freshsales=require(_0x1a7a('0xa'));var integrations=['zendesk','salesforce',_0x1a7a('0xb'),_0x1a7a('0xc'),'zoho',_0x1a7a('0xd'),_0x1a7a('0xe'),'dynamics365',_0x1a7a('0xf'),'servicenow'];exports[_0x1a7a('0x10')]=function(_0x77ce56,_0x20e410,_0x288e2c,_0x41fcba,_0x3fb484,_0x100865){if(_0x288e2c){if(_['includes'](integrations,_0x77ce56[_0x1a7a('0x11')]['toLowerCase']())){try{var _0x10023b=null;var _0xaf6418='';var _0x296f29=_0x288e2c[_0x77ce56['data1']['toLowerCase']()];if(_0x296f29){var _0x551173=_0x296f29[_0x77ce56[_0x1a7a('0x12')]];if(_0x551173){var _0x186aac=_['find'](_0x551173['Configurations'],{'id':parseInt(_0x77ce56[_0x1a7a('0x13')],0xa)});if(_0x186aac){if(_0x41fcba){if(_0x3fb484&&_0x20e410[_0x1a7a('0x14')]){_0xaf6418='queue';}else if(_0x20e410[_0x1a7a('0x15')]){_0xaf6418=_0x1a7a('0x16');}else{console[_0x1a7a('0x17')](_0x1a7a('0x18'),_0x20e410);}}else{_0xaf6418=_0x1a7a('0x19');}switch(_0x77ce56[_0x1a7a('0x11')][_0x1a7a('0x1a')]()){case _0x1a7a('0x1b'):zendesk[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case _0x1a7a('0x1c'):salesforce[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case'sugarcrm':sugarcrm[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case _0x1a7a('0xc'):freshdesk[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case'zoho':zoho[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case _0x1a7a('0xd'):desk[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case _0x1a7a('0xe'):vtiger[_0xaf6418](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865);break;case _0x1a7a('0xf'):freshsales['cs'](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865,_0xaf6418);break;case'servicenow':servicenow['cs'](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865,_0xaf6418);break;case'dynamics365':dynamics365['cs'](_0x77ce56,_0x20e410,_0x186aac,_0x41fcba,_0x3fb484,_0x551173,_0x100865,_0xaf6418);break;default:console[_0x1a7a('0x17')](_0x1a7a('0x1d'));}}else{_0x10023b=require(_0x1a7a('0x1e'))(_0x77ce56[_0x1a7a('0x11')]['toLowerCase']());_0x10023b[_0x1a7a('0x1f')](_0x1a7a('0x20'),util[_0x1a7a('0x21')](_0x1a7a('0x22'),_0x77ce56[_0x1a7a('0x11')][_0x1a7a('0x1a')](),_0x77ce56['data3']));}}else{_0x10023b=require(_0x1a7a('0x1e'))(_0x77ce56[_0x1a7a('0x11')][_0x1a7a('0x1a')]());_0x10023b[_0x1a7a('0x1f')](_0x1a7a('0x20'),util['format'](_0x1a7a('0x23'),_0x77ce56[_0x1a7a('0x11')][_0x1a7a('0x1a')](),_0x77ce56[_0x1a7a('0x12')]));}}else{}}catch(_0x648b83){console['error'](_0x648b83);}}}}; \ No newline at end of file +var _0x9a23=['lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','log','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x9a23,0x81));var _0x39a2=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x9a23[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x39a2('0x0'));var util=require(_0x39a2('0x1'));var zendesk=require(_0x39a2('0x2'));var salesforce=require(_0x39a2('0x3'));var sugarcrm=require(_0x39a2('0x4'));var freshdesk=require(_0x39a2('0x5'));var zoho=require(_0x39a2('0x6'));var desk=require(_0x39a2('0x7'));var vtiger=require(_0x39a2('0x8'));var servicenow=require(_0x39a2('0x9'));var dynamics365=require(_0x39a2('0xa'));var freshsales=require(_0x39a2('0xb'));var integrations=['zendesk',_0x39a2('0xc'),_0x39a2('0xd'),_0x39a2('0xe'),_0x39a2('0xf'),_0x39a2('0x10'),_0x39a2('0x11'),_0x39a2('0x12'),_0x39a2('0x13'),_0x39a2('0x14')];exports[_0x39a2('0x15')]=function(_0x3e76c8,_0x21d4e0,_0x15017f,_0x7bd0c9,_0x2cda00,_0x5e249f){if(_0x15017f){if(_[_0x39a2('0x16')](integrations,_0x3e76c8[_0x39a2('0x17')][_0x39a2('0x18')]())){try{var _0x2c1523=null;var _0x3472c0='';var _0x54fcb1=_0x15017f[_0x3e76c8['data1']['toLowerCase']()];if(_0x54fcb1){var _0x27496f=_0x54fcb1[_0x3e76c8[_0x39a2('0x19')]];if(_0x27496f){var _0x31dd0a=_[_0x39a2('0x1a')](_0x27496f[_0x39a2('0x1b')],{'id':parseInt(_0x3e76c8[_0x39a2('0x1c')],0xa)});if(_0x31dd0a){if(_0x7bd0c9){if(_0x2cda00&&_0x21d4e0[_0x39a2('0x1d')]){_0x3472c0=_0x39a2('0x1d');}else if(_0x21d4e0[_0x39a2('0x1e')]){_0x3472c0=_0x39a2('0x1f');}else{console['log'](_0x39a2('0x20'),_0x21d4e0);}}else{_0x3472c0=_0x39a2('0x21');}switch(_0x3e76c8['data1']['toLowerCase']()){case _0x39a2('0x22'):zendesk[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case _0x39a2('0xc'):salesforce[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case'sugarcrm':sugarcrm[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case _0x39a2('0xe'):freshdesk[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case _0x39a2('0xf'):zoho[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case _0x39a2('0x10'):desk[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case _0x39a2('0x11'):vtiger[_0x3472c0](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f);break;case _0x39a2('0x13'):freshsales['cs'](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f,_0x3472c0);break;case _0x39a2('0x14'):servicenow['cs'](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f,_0x3472c0);break;case'dynamics365':dynamics365['cs'](_0x3e76c8,_0x21d4e0,_0x31dd0a,_0x7bd0c9,_0x2cda00,_0x27496f,_0x5e249f,_0x3472c0);break;default:console[_0x39a2('0x23')](_0x39a2('0x24'));}}else{_0x2c1523=require(_0x39a2('0x25'))(_0x3e76c8['data1'][_0x39a2('0x18')]());_0x2c1523['error'](_0x39a2('0x26'),util[_0x39a2('0x27')](_0x39a2('0x28'),_0x3e76c8[_0x39a2('0x17')][_0x39a2('0x18')](),_0x3e76c8[_0x39a2('0x1c')]));}}else{_0x2c1523=require(_0x39a2('0x25'))(_0x3e76c8['data1'][_0x39a2('0x18')]());_0x2c1523[_0x39a2('0x29')](_0x39a2('0x26'),util['format'](_0x39a2('0x2a'),_0x3e76c8[_0x39a2('0x17')][_0x39a2('0x18')](),_0x3e76c8[_0x39a2('0x19')]));}}else{}}catch(_0x1e54a2){console[_0x39a2('0x29')](_0x1e54a2);}}}}; \ 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 98ba6e5..dd037db 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 _0xa848=['lastevent','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','toUpperCase','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Descriptions','ActivityDate','utc','WhoId','endUserType','account','WhatId','Case','AccountId','lead','leadId','info','ticketType','isNil','validateEmail','sobject','User','find','then','length','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','merge','$or','execute','additionalSearchLead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','additionalSearchContact','Contact','Lead','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','create','forEach','includes','string','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','https://login.salesforce.com','username','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged'];(function(_0x194797,_0x40c56e){var _0x2d2177=function(_0x410fdb){while(--_0x410fdb){_0x194797['push'](_0x194797['shift']());}};_0x2d2177(++_0x40c56e);}(_0xa848,0x107));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8a84('0x0'));var rp=require(_0x8a84('0x1'));var moment=require(_0x8a84('0x2'));var BPromise=require(_0x8a84('0x3'));var md5=require(_0x8a84('0x4'));var jsforce=require(_0x8a84('0x5'));var util=require(_0x8a84('0x6'));var Redis=require(_0x8a84('0x7'));var intUtil=require(_0x8a84('0x8'));var config=require(_0x8a84('0x9'));var logger=require(_0x8a84('0xa'))(_0x8a84('0xb'));config[_0x8a84('0xc')]=_[_0x8a84('0xd')](config[_0x8a84('0xc')],{'host':_0x8a84('0xe'),'port':0x18eb});var io=require(_0x8a84('0xf'))(new Redis(config['redis']));function emit(_0x26d292,_0x402f41,_0x35386b){io['to'](_0x26d292)[_0x8a84('0x10')](_0x402f41,_0x35386b);}function getTicket(_0x4f412e,_0x2277e2,_0x5b1a5e,_0x346dc6,_0x50f1fe,_0x18b2f3,_0x58da9d,_0x4e319d){var _0x2f48ab=Object['assign']({},{'OwnerId':_0x2277e2['id'],'Subject':intUtil[_0x8a84('0x11')](_0x346dc6['Subjects'],_0x50f1fe,'\x20'),'Description':intUtil[_0x8a84('0x11')](_0x346dc6[_0x8a84('0x12')],_0x50f1fe,'\x0a')},getCustomFields(_0x18b2f3,_0x50f1fe));if(_0x5b1a5e){if(_0x346dc6['ticketType']==='Task'){_0x2f48ab[_0x8a84('0x13')]=moment[_0x8a84('0x14')]();_0x2f48ab['IsReminderSet']=![];_0x2f48ab['IsRecurrence']=![];if(_0x5b1a5e['endUserType']==='contact'||_0x5b1a5e['endUserType']==='lead'){_0x2f48ab[_0x8a84('0x15')]=_0x5b1a5e['id'];}else if(_0x5b1a5e[_0x8a84('0x16')]===_0x8a84('0x17')){_0x2f48ab[_0x8a84('0x18')]=_0x5b1a5e['id'];}}else if(_0x346dc6['ticketType']===_0x8a84('0x19')){if(_0x5b1a5e[_0x8a84('0x16')]==='contact'){_0x2f48ab['ContactId']=_0x5b1a5e['id'];}else if(_0x5b1a5e['endUserType']===_0x8a84('0x17')){_0x2f48ab[_0x8a84('0x1a')]=_0x5b1a5e['id'];}else if(_0x5b1a5e[_0x8a84('0x16')]===_0x8a84('0x1b')&&_0x346dc6[_0x8a84('0x1c')]){_0x2f48ab[_0x346dc6['leadId']]=_0x5b1a5e['id'];}else{logger[_0x8a84('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x58da9d['sobject'](_0x346dc6[_0x8a84('0x1e')])['create'](_0x2f48ab);}function getUser(_0x186f2e,_0x4f42eb,_0xb6091a){if(!_[_0x8a84('0x1f')](_0x4f42eb)&&intUtil[_0x8a84('0x20')](_0x4f42eb)){var _0x358578={'Email':_0x4f42eb};var _0x36d3b0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb6091a[_0x8a84('0x21')](_0x8a84('0x22'))[_0x8a84('0x23')](_0x358578,_0x36d3b0)['execute']()[_0x8a84('0x24')](function(_0x46682e){if(_0x46682e[_0x8a84('0x25')]){var _0x10ed06=_[_0x8a84('0x23')](_0x46682e,function(_0x2dcc65){return _0x2dcc65['Email']===_0x4f42eb;});if(_0x10ed06){logger['info'](_0x8a84('0x26'),_0x4f42eb);return BPromise[_0x8a84('0x27')]({'id':_0x10ed06['Id'],'name':_0x10ed06['Name']});}}else{logger[_0x8a84('0x1d')](_0x8a84('0x28'),_0x4f42eb);return _0xb6091a[_0x8a84('0x29')]()[_0x8a84('0x24')](function(_0x1e043c){return BPromise[_0x8a84('0x27')]({'id':_0x1e043c[_0x8a84('0x2a')],'name':_0x1e043c['display_name']});});}});}else{logger[_0x8a84('0x1d')](_0x8a84('0x28'),_0x4f42eb);return _0xb6091a[_0x8a84('0x29')]()['then'](function(_0x3accaf){return BPromise[_0x8a84('0x27')]({'id':_0x3accaf[_0x8a84('0x2a')],'name':_0x3accaf['display_name']});});}}function getEndUser(_0x529e14,_0x325d5c,_0x26817d,_0x560f9f,_0x2a15bb){var _0x566446={'$or':{'Phone':_0x560f9f}};var _0x4dea08={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x8a84('0x24')](function(){logger[_0x8a84('0x1d')](_0x8a84('0x2b'),_0x560f9f,_0x325d5c[_0x8a84('0x2c')]);switch(_0x325d5c[_0x8a84('0x2c')]){case _0x8a84('0x2d'):var _0x507267=_['cloneDeep'](_0x566446);if(_0x325d5c['additionalSearchContact']){var _0x115e1f={};_0x115e1f[_0x325d5c['additionalSearchContact']]=_0x560f9f;_[_0x8a84('0x2e')](_0x507267[_0x8a84('0x2f')],_0x115e1f);}return _0x2a15bb[_0x8a84('0x21')]('Contact')[_0x8a84('0x23')](_0x507267,_0x4dea08)[_0x8a84('0x30')]()['then'](function(_0x5e6f3e){if(_0x5e6f3e&&_0x5e6f3e[_0x8a84('0x25')]){return _0x5e6f3e;}else{var _0x2f94ce=_['cloneDeep'](_0x566446);if(_0x325d5c[_0x8a84('0x31')]){var _0x5c2751={};_0x5c2751[_0x325d5c[_0x8a84('0x31')]]=_0x560f9f;_[_0x8a84('0x2e')](_0x2f94ce[_0x8a84('0x2f')],_0x5c2751);}return _0x2a15bb[_0x8a84('0x21')]('Lead')['find'](_0x2f94ce,_0x4dea08);}});case _0x8a84('0x32'):var _0x35e837=_[_0x8a84('0x33')](_0x566446);if(_0x325d5c[_0x8a84('0x34')]){var _0x115e1f={};_0x115e1f[_0x325d5c['additionalSearchAccount']]=_0x560f9f;_[_0x8a84('0x2e')](_0x35e837['$or'],_0x115e1f);}return _0x2a15bb['sobject'](_0x8a84('0x35'))[_0x8a84('0x23')](_0x35e837,_0x4dea08)[_0x8a84('0x30')]()[_0x8a84('0x24')](function(_0x446634){if(_0x446634&&_0x446634['length']){return _0x446634;}else{var _0xc8e85c=_['cloneDeep'](_0x566446);if(_0x325d5c[_0x8a84('0x36')]){var _0x17c1e8={};_0x17c1e8[_0x325d5c[_0x8a84('0x36')]]=_0x560f9f;_[_0x8a84('0x2e')](_0xc8e85c[_0x8a84('0x2f')],_0x17c1e8);}return _0x2a15bb['sobject'](_0x8a84('0x37'))['find'](_0xc8e85c,_0x4dea08)['then'](function(_0x3ff823){if(_0x3ff823&&_0x3ff823[_0x8a84('0x25')]){return _0x3ff823;}else{var _0x1b674e=_[_0x8a84('0x33')](_0x566446);if(_0x325d5c['additionalSearchLead']){var _0x1b662f={};_0x1b662f[_0x325d5c[_0x8a84('0x31')]]=_0x560f9f;_[_0x8a84('0x2e')](_0x1b674e[_0x8a84('0x2f')],_0x1b662f);}return _0x2a15bb['sobject'](_0x8a84('0x38'))[_0x8a84('0x23')](_0x1b674e,_0x4dea08);}});}});case'contact':var _0x507267=_[_0x8a84('0x33')](_0x566446);if(_0x325d5c[_0x8a84('0x36')]){var _0x115e1f={};_0x115e1f[_0x325d5c['additionalSearchContact']]=_0x560f9f;_[_0x8a84('0x2e')](_0x507267[_0x8a84('0x2f')],_0x115e1f);}return _0x2a15bb[_0x8a84('0x21')](_0x8a84('0x37'))[_0x8a84('0x23')](_0x507267,_0x4dea08)[_0x8a84('0x30')]();case _0x8a84('0x1b'):var _0x7f3142=_['cloneDeep'](_0x566446);if(_0x325d5c['additionalSearchLead']){var _0x115e1f={};_0x115e1f[_0x325d5c[_0x8a84('0x31')]]=_0x560f9f;_[_0x8a84('0x2e')](_0x7f3142[_0x8a84('0x2f')],_0x115e1f);}return _0x2a15bb[_0x8a84('0x21')](_0x8a84('0x38'))[_0x8a84('0x23')](_0x7f3142,_0x4dea08);case _0x8a84('0x17'):var _0x35e837=_['cloneDeep'](_0x566446);if(_0x325d5c[_0x8a84('0x34')]){var _0x115e1f={};_0x115e1f[_0x325d5c[_0x8a84('0x34')]]=_0x560f9f;_[_0x8a84('0x2e')](_0x35e837[_0x8a84('0x2f')],_0x115e1f);}return _0x2a15bb[_0x8a84('0x21')]('Account')['find'](_0x35e837,_0x4dea08);default:return null;}})['then'](function(_0x52b5a0){if(_0x52b5a0&&_0x52b5a0[_0x8a84('0x25')]){var _0x1d76ed=_[_0x8a84('0x39')](_0x52b5a0);if(_0x1d76ed){return BPromise['resolve']({'id':_0x1d76ed['Id'],'name':_0x1d76ed[_0x8a84('0x3a')],'phone':_0x1d76ed[_0x8a84('0x3b')],'endUserType':_0x1d76ed[_0x8a84('0x3c')][_0x8a84('0x3d')][_0x8a84('0x3e')]()});}}})[_0x8a84('0x24')](function(_0x18731b){if(_0x18731b){logger['info'](_0x8a84('0x3f'),_0x18731b[_0x8a84('0x16')],_0x560f9f);return BPromise[_0x8a84('0x27')](_0x18731b);}else{logger[_0x8a84('0x1d')](_0x8a84('0x40'),_0x560f9f);var _0x19f9fe={'Phone':_0x560f9f};if(_0x325d5c[_0x8a84('0x41')]){if(_0x325d5c[_0x8a84('0x41')]===_0x8a84('0x42')){logger[_0x8a84('0x1d')](_0x8a84('0x43'),_0x560f9f,_0x325d5c[_0x8a84('0x41')]);_0x19f9fe[_0x8a84('0x44')]=_0x26817d!==_0x8a84('0x45')?_0x26817d:util[_0x8a84('0x46')](_0x8a84('0x47'),_0x560f9f);}else if(_0x325d5c[_0x8a84('0x41')]===_0x8a84('0x1b')){logger[_0x8a84('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x560f9f,_0x325d5c[_0x8a84('0x41')]);_0x19f9fe[_0x8a84('0x44')]=_0x26817d!==_0x8a84('0x45')?_0x26817d:util[_0x8a84('0x46')](_0x8a84('0x47'),_0x560f9f);_0x19f9fe[_0x8a84('0x48')]='No\x20Company';}else if(_0x325d5c[_0x8a84('0x41')]===_0x8a84('0x17')){logger[_0x8a84('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x560f9f,_0x325d5c[_0x8a84('0x41')]);_0x19f9fe[_0x8a84('0x3a')]=_0x26817d!==''?_0x26817d:util['format'](_0x8a84('0x47'),_0x560f9f);}else{return null;}}return _0x2a15bb[_0x8a84('0x21')](_['upperFirst'](_0x325d5c[_0x8a84('0x41')]))[_0x8a84('0x49')](_0x19f9fe)[_0x8a84('0x24')](function(_0x20e2c3){return BPromise['resolve']({'id':_0x20e2c3['id'],'endUserType':_0x325d5c[_0x8a84('0x41')]});});}});}function getCustomFields(_0x48bf70,_0x441cef){var _0xcb303c={};if(_0x48bf70[_0x8a84('0x25')]>0x0){_[_0x8a84('0x4a')](_0x48bf70,function(_0x1759eb){if(_[_0x8a84('0x4b')]([_0x8a84('0x4c'),'picklist'],_0x1759eb[_0x8a84('0x3d')])&&_0x1759eb[_0x8a84('0x4d')]){_0xcb303c[_0x1759eb[_0x8a84('0x4d')]]=_0x1759eb[_0x8a84('0x4e')]['toString']();}else if(_0x1759eb[_0x8a84('0x3d')]===_0x8a84('0x4f')&&_0x1759eb[_0x8a84('0x50')]&&_0x1759eb[_0x8a84('0x4d')]){_0x441cef[_0x1759eb[_0x8a84('0x50')]]&&(_0xcb303c[_0x1759eb[_0x8a84('0x4d')]]=_0x441cef[_0x1759eb[_0x8a84('0x50')]][_0x8a84('0x51')]());}else if(_0x1759eb[_0x8a84('0x3d')]===_0x8a84('0x52')&&_0x1759eb[_0x8a84('0x53')]&&_0x1759eb['Variable']['name']&&_0x1759eb[_0x8a84('0x4d')]){_0x441cef[_0x1759eb[_0x8a84('0x53')]['name'][_0x8a84('0x3e')]()]&&(_0xcb303c[_0x1759eb['idField']]=_0x441cef[_0x1759eb[_0x8a84('0x53')][_0x8a84('0x54')][_0x8a84('0x3e')]()][_0x8a84('0x51')]());}});}return _0xcb303c;}function getConnection(_0x132386){var _0xee8e48=_0x132386[_0x8a84('0x55')][_0x8a84('0x56')](_0x132386['securityToken']);var _0x3fc8ad=new jsforce['Connection']({'oauth2':{'loginUrl':_0x132386['remoteUri']||_0x8a84('0x57'),'clientId':_0x132386['clientId'],'clientSecret':_0x132386['clientSecret']}});return _0x3fc8ad['login'](_0x132386[_0x8a84('0x58')],_0xee8e48)[_0x8a84('0x24')](function(){logger[_0x8a84('0x1d')](_0x8a84('0x59'));return _0x3fc8ad;});}exports[_0x8a84('0x5a')]=function(_0x2eccd8,_0x223967,_0x3dbb4f,_0x33cd4e,_0xa1a96d,_0x29689f){var _0x1c59b6,_0x3e05a9,_0xe95bf7,_0x3caa6f;_0x29689f[_0x8a84('0x5b')]=intUtil['stripTrailingSlash'](_0x29689f[_0x8a84('0x5b')]);_0x29689f[_0x8a84('0x5c')]=intUtil[_0x8a84('0x5d')](_0x29689f[_0x8a84('0x5c')]);if(_0xa1a96d&&_0xa1a96d[_0x8a84('0x5e')]){logger[_0x8a84('0x1d')](_0x8a84('0x5f'),'Recording\x20is\x20enabled!');_0x223967[_0x8a84('0x60')]=util[_0x8a84('0x46')](_0x8a84('0x61'),_0x29689f['serverUrl'],_0x223967[_0x8a84('0x62')],md5(_0x223967[_0x8a84('0x62')]));}else{_0x223967[_0x8a84('0x60')]='';}return getConnection(_0x29689f)['then'](function(_0x242406){_0x3caa6f=_0x242406;return getUser(_0x29689f,_0x33cd4e[_0x8a84('0x63')],_0x3caa6f);})[_0x8a84('0x24')](function(_0x169ff7){_0x1c59b6=_0x169ff7;return getEndUser(_0x29689f,_0x3dbb4f,_0x223967['calleridname'],_0x223967[_0x8a84('0x64')],_0x3caa6f);})[_0x8a84('0x24')](function(_0x4be411){_0x3e05a9=_0x4be411;return getTicket(_0x29689f,_0x1c59b6,_0x3e05a9,_0x3dbb4f,_0x223967,_0x3dbb4f[_0x8a84('0x65')],_0x3caa6f,_0x8a84('0x5a'));})['then'](function(_0x40f88a){_0xe95bf7=_0x40f88a;logger['info'](_0x8a84('0x66'),_0xe95bf7['id']);logger['info'](_0x8a84('0x67'),_0xe95bf7['id'],_0x33cd4e['name'],_0x29689f['type']);switch(_0x29689f['type']){case _0x8a84('0x68'):emit(util[_0x8a84('0x46')](_0x8a84('0x69'),_0x33cd4e[_0x8a84('0x54')]),_0x8a84('0x6a'),{'recordId':_0xe95bf7['id']});break;case _0x8a84('0x6b'):emit(util[_0x8a84('0x46')]('user:%s',_0x33cd4e[_0x8a84('0x54')]),_0x8a84('0x6c'),{'uri':util['format'](_0x8a84('0x6d'),_0x3caa6f[_0x8a84('0x6e')],_0xe95bf7['id'])});break;default:logger['error'](_0x8a84('0x6f'));}})[_0x8a84('0x70')](function(_0x611bab){logger[_0x8a84('0x71')](_0x8a84('0x5f'),_0x611bab);});};exports[_0x8a84('0x72')]=function(_0x537dde,_0x5bc74a,_0x3be86c,_0x7d5af5,_0x424b9,_0x498dc6,_0x260347){var _0x15042b,_0x4f14a0,_0x405c68,_0x3a851c;_0x498dc6[_0x8a84('0x5b')]=intUtil[_0x8a84('0x5d')](_0x498dc6[_0x8a84('0x5b')]);_0x498dc6['remoteUri']=intUtil[_0x8a84('0x5d')](_0x498dc6['remoteUri']);if(_0x260347&&_0x260347[_0x8a84('0x73')]&&_0x260347[_0x8a84('0x73')]!=='none'){logger[_0x8a84('0x1d')](_0x8a84('0x74'),_0x8a84('0x75'));_0x5bc74a['recordingURL']=util[_0x8a84('0x46')](_0x8a84('0x61'),_0x498dc6[_0x8a84('0x5b')],_0x5bc74a[_0x8a84('0x62')],md5(_0x5bc74a[_0x8a84('0x62')]));}return getConnection(_0x498dc6)[_0x8a84('0x24')](function(_0x1e8767){_0x3a851c=_0x1e8767;return getUser(_0x498dc6,_0x7d5af5[_0x8a84('0x63')],_0x3a851c);})['then'](function(_0x20bd24){_0x15042b=_0x20bd24;return getEndUser(_0x498dc6,_0x3be86c,_0x5bc74a[_0x8a84('0x76')],_0x5bc74a[_0x8a84('0x77')],_0x3a851c);})[_0x8a84('0x24')](function(_0x2a2e8e){_0x4f14a0=_0x2a2e8e;return getTicket(_0x498dc6,_0x15042b,_0x4f14a0,_0x3be86c,_0x5bc74a,_0x3be86c[_0x8a84('0x65')],_0x3a851c,_0x8a84('0x72'));})['then'](function(_0x200777){_0x405c68=_0x200777;logger['info'](_0x8a84('0x78'),_0x405c68['id']);logger[_0x8a84('0x1d')](_0x8a84('0x79'),_0x405c68['id'],_0x7d5af5['name'],_0x498dc6[_0x8a84('0x3d')]);switch(_0x498dc6[_0x8a84('0x3d')]){case _0x8a84('0x68'):emit(util['format'](_0x8a84('0x69'),_0x7d5af5['name']),'trigger:salesforce:display',{'recordId':_0x405c68['id']});break;case _0x8a84('0x6b'):emit(util[_0x8a84('0x46')](_0x8a84('0x69'),_0x7d5af5[_0x8a84('0x54')]),'trigger:browser:url',{'uri':util['format'](_0x8a84('0x6d'),_0x3a851c[_0x8a84('0x6e')],_0x405c68['id'])});break;default:logger[_0x8a84('0x71')](_0x8a84('0x74'),_0x8a84('0x7a'));}})[_0x8a84('0x70')](function(_0x222463){logger[_0x8a84('0x71')]('[OUTBOUND]',_0x222463);});};exports[_0x8a84('0x7b')]=function(_0x1194cd,_0x2dc93a,_0xadb6d4,_0x29c59c,_0x3c474a,_0x53aa29){var _0x2126a8,_0x37f8b4,_0x10005e,_0x40111e;_0x53aa29[_0x8a84('0x5b')]=intUtil['stripTrailingSlash'](_0x53aa29[_0x8a84('0x5b')]);_0x53aa29[_0x8a84('0x5c')]=intUtil[_0x8a84('0x5d')](_0x53aa29['remoteUri']);if(_0x3c474a&&_0x3c474a[_0x8a84('0x5e')]){logger[_0x8a84('0x1d')]('['+_0x2dc93a[_0x8a84('0x7c')]['toUpperCase']()+']',_0x8a84('0x75'));_0x2dc93a[_0x8a84('0x60')]=util[_0x8a84('0x46')](_0x8a84('0x61'),_0x53aa29[_0x8a84('0x5b')],_0x2dc93a[_0x8a84('0x62')],md5(_0x2dc93a['uniqueid']));}else{_0x2dc93a['recordingURL']='';}return getConnection(_0x53aa29)[_0x8a84('0x24')](function(_0x10bba5){_0x40111e=_0x10bba5;if(!_[_0x8a84('0x1f')](_0x29c59c)){return getUser(_0x53aa29,_0x29c59c[_0x8a84('0x54')],_0x40111e);}else{return getUser(_0x53aa29,null,_0x40111e);}})[_0x8a84('0x24')](function(_0x3b3187){_0x2126a8=_0x3b3187;return getEndUser(_0x53aa29,_0xadb6d4,_0x2dc93a[_0x8a84('0x7d')],_0x2dc93a[_0x8a84('0x64')],_0x40111e);})[_0x8a84('0x24')](function(_0x3f724a){_0x37f8b4=_0x3f724a;return getTicket(_0x53aa29,_0x2126a8,_0x37f8b4,_0xadb6d4,_0x2dc93a,_0xadb6d4[_0x8a84('0x65')],_0x40111e);})[_0x8a84('0x24')](function(_0x1d403c){_0x10005e=_0x1d403c;logger[_0x8a84('0x1d')]('['+_0x2dc93a[_0x8a84('0x7c')]['toUpperCase']()+_0x8a84('0x7e'),_0x10005e['id']);logger[_0x8a84('0x1d')]('['+_0x2dc93a[_0x8a84('0x7c')]['toUpperCase']()+_0x8a84('0x7f'),_0x53aa29[_0x8a84('0x3d')]);})[_0x8a84('0x70')](function(_0x2d93b2){logger[_0x8a84('0x71')]('['+_0x2dc93a['lastevent'][_0x8a84('0x80')]()+']',_0x2d93b2);});}; \ No newline at end of file +var _0x8ff0=['[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','ticketType','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','upperFirst','includes','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','format','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum'];(function(_0x139f50,_0x18b9cf){var _0xb5efa9=function(_0x5e097e){while(--_0x5e097e){_0x139f50['push'](_0x139f50['shift']());}};_0xb5efa9(++_0x18b9cf);}(_0x8ff0,0x16c));var _0x08ff=function(_0x5a709c,_0x1e6cfe){_0x5a709c=_0x5a709c-0x0;var _0x719025=_0x8ff0[_0x5a709c];return _0x719025;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x08ff('0x0'));var BPromise=require(_0x08ff('0x1'));var md5=require(_0x08ff('0x2'));var jsforce=require(_0x08ff('0x3'));var util=require(_0x08ff('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x08ff('0x5'));config[_0x08ff('0x6')]=_[_0x08ff('0x7')](config[_0x08ff('0x6')],{'host':_0x08ff('0x8'),'port':0x18eb});var io=require(_0x08ff('0x9'))(new Redis(config[_0x08ff('0x6')]));function emit(_0x2fee47,_0xc4226d,_0x2fb4e7){io['to'](_0x2fee47)[_0x08ff('0xa')](_0xc4226d,_0x2fb4e7);}function getTicket(_0x186903,_0x2f40be,_0x3e1ebf,_0x35a44a,_0x119691,_0x518a81,_0x35a7c0,_0x3d5700){var _0x5f5dc7=Object[_0x08ff('0xb')]({},{'OwnerId':_0x2f40be['id'],'Subject':intUtil[_0x08ff('0xc')](_0x35a44a['Subjects'],_0x119691,'\x20'),'Description':intUtil['getString'](_0x35a44a[_0x08ff('0xd')],_0x119691,'\x0a')},getCustomFields(_0x518a81,_0x119691));if(_0x3e1ebf){if(_0x35a44a['ticketType']===_0x08ff('0xe')){_0x5f5dc7[_0x08ff('0xf')]=moment[_0x08ff('0x10')]();_0x5f5dc7[_0x08ff('0x11')]=![];_0x5f5dc7[_0x08ff('0x12')]=![];if(_0x3e1ebf[_0x08ff('0x13')]===_0x08ff('0x14')||_0x3e1ebf[_0x08ff('0x13')]===_0x08ff('0x15')){_0x5f5dc7['WhoId']=_0x3e1ebf['id'];}else if(_0x3e1ebf[_0x08ff('0x13')]===_0x08ff('0x16')){_0x5f5dc7[_0x08ff('0x17')]=_0x3e1ebf['id'];}}else if(_0x35a44a[_0x08ff('0x18')]===_0x08ff('0x19')){if(_0x3e1ebf[_0x08ff('0x13')]===_0x08ff('0x14')){_0x5f5dc7['ContactId']=_0x3e1ebf['id'];}else if(_0x3e1ebf['endUserType']===_0x08ff('0x16')){_0x5f5dc7[_0x08ff('0x1a')]=_0x3e1ebf['id'];}else if(_0x3e1ebf[_0x08ff('0x13')]===_0x08ff('0x15')&&_0x35a44a[_0x08ff('0x1b')]){_0x5f5dc7[_0x35a44a[_0x08ff('0x1b')]]=_0x3e1ebf['id'];}else{logger[_0x08ff('0x1c')](_0x08ff('0x1d'));}}}return _0x35a7c0[_0x08ff('0x1e')](_0x35a44a['ticketType'])[_0x08ff('0x1f')](_0x5f5dc7);}function getUser(_0x63182f,_0x40b754,_0xef1033){if(!_['isNil'](_0x40b754)&&intUtil[_0x08ff('0x20')](_0x40b754)){var _0x4c74b0={'Email':_0x40b754};var _0x4a7e4b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xef1033[_0x08ff('0x1e')](_0x08ff('0x21'))[_0x08ff('0x22')](_0x4c74b0,_0x4a7e4b)['execute']()[_0x08ff('0x23')](function(_0x5d4632){if(_0x5d4632[_0x08ff('0x24')]){var _0x26f01f=_['find'](_0x5d4632,function(_0x19c2de){return _0x19c2de[_0x08ff('0x25')]===_0x40b754;});if(_0x26f01f){logger[_0x08ff('0x1c')]('Agent\x20%s\x20found.',_0x40b754);return BPromise[_0x08ff('0x26')]({'id':_0x26f01f['Id'],'name':_0x26f01f[_0x08ff('0x27')]});}}else{logger['info'](_0x08ff('0x28'),_0x40b754);return _0xef1033[_0x08ff('0x29')]()[_0x08ff('0x23')](function(_0x590239){return BPromise[_0x08ff('0x26')]({'id':_0x590239[_0x08ff('0x2a')],'name':_0x590239['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x40b754);return _0xef1033[_0x08ff('0x29')]()[_0x08ff('0x23')](function(_0x13ab85){return BPromise[_0x08ff('0x26')]({'id':_0x13ab85[_0x08ff('0x2a')],'name':_0x13ab85[_0x08ff('0x2b')]});});}}function getEndUser(_0x2f4253,_0xc597da,_0x3e376d,_0x29c113,_0x4c480b){var _0x7e6aac={'$or':{'Phone':_0x29c113}};var _0x5f2061={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x08ff('0x26')]()[_0x08ff('0x23')](function(){logger[_0x08ff('0x1c')](_0x08ff('0x2c'),_0x29c113,_0xc597da['moduleSearch']);switch(_0xc597da[_0x08ff('0x2d')]){case _0x08ff('0x2e'):var _0x51538e=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da[_0x08ff('0x30')]){var _0x543e34={};_0x543e34[_0xc597da['additionalSearchContact']]=_0x29c113;_[_0x08ff('0x31')](_0x51538e[_0x08ff('0x32')],_0x543e34);}return _0x4c480b[_0x08ff('0x1e')](_0x08ff('0x33'))[_0x08ff('0x22')](_0x51538e,_0x5f2061)[_0x08ff('0x34')]()[_0x08ff('0x23')](function(_0x2e50ef){if(_0x2e50ef&&_0x2e50ef[_0x08ff('0x24')]){return _0x2e50ef;}else{var _0x314c84=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da[_0x08ff('0x35')]){var _0x49e2a2={};_0x49e2a2[_0xc597da[_0x08ff('0x35')]]=_0x29c113;_[_0x08ff('0x31')](_0x314c84['$or'],_0x49e2a2);}return _0x4c480b[_0x08ff('0x1e')](_0x08ff('0x36'))[_0x08ff('0x22')](_0x314c84,_0x5f2061);}});case _0x08ff('0x37'):var _0x1fedc9=_['cloneDeep'](_0x7e6aac);if(_0xc597da[_0x08ff('0x38')]){var _0x543e34={};_0x543e34[_0xc597da['additionalSearchAccount']]=_0x29c113;_[_0x08ff('0x31')](_0x1fedc9[_0x08ff('0x32')],_0x543e34);}return _0x4c480b[_0x08ff('0x1e')](_0x08ff('0x39'))[_0x08ff('0x22')](_0x1fedc9,_0x5f2061)[_0x08ff('0x34')]()[_0x08ff('0x23')](function(_0xc2744d){if(_0xc2744d&&_0xc2744d[_0x08ff('0x24')]){return _0xc2744d;}else{var _0x530e78=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da[_0x08ff('0x30')]){var _0x472222={};_0x472222[_0xc597da[_0x08ff('0x30')]]=_0x29c113;_[_0x08ff('0x31')](_0x530e78[_0x08ff('0x32')],_0x472222);}return _0x4c480b[_0x08ff('0x1e')](_0x08ff('0x33'))['find'](_0x530e78,_0x5f2061)[_0x08ff('0x23')](function(_0x503709){if(_0x503709&&_0x503709['length']){return _0x503709;}else{var _0x48e75b=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da['additionalSearchLead']){var _0x53210f={};_0x53210f[_0xc597da['additionalSearchLead']]=_0x29c113;_['merge'](_0x48e75b[_0x08ff('0x32')],_0x53210f);}return _0x4c480b[_0x08ff('0x1e')]('Lead')[_0x08ff('0x22')](_0x48e75b,_0x5f2061);}});}});case _0x08ff('0x14'):var _0x51538e=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da[_0x08ff('0x30')]){var _0x543e34={};_0x543e34[_0xc597da[_0x08ff('0x30')]]=_0x29c113;_[_0x08ff('0x31')](_0x51538e[_0x08ff('0x32')],_0x543e34);}return _0x4c480b[_0x08ff('0x1e')]('Contact')[_0x08ff('0x22')](_0x51538e,_0x5f2061)[_0x08ff('0x34')]();case _0x08ff('0x15'):var _0x2eae12=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da[_0x08ff('0x35')]){var _0x543e34={};_0x543e34[_0xc597da['additionalSearchLead']]=_0x29c113;_[_0x08ff('0x31')](_0x2eae12[_0x08ff('0x32')],_0x543e34);}return _0x4c480b['sobject'](_0x08ff('0x36'))[_0x08ff('0x22')](_0x2eae12,_0x5f2061);case _0x08ff('0x16'):var _0x1fedc9=_[_0x08ff('0x2f')](_0x7e6aac);if(_0xc597da[_0x08ff('0x38')]){var _0x543e34={};_0x543e34[_0xc597da['additionalSearchAccount']]=_0x29c113;_['merge'](_0x1fedc9['$or'],_0x543e34);}return _0x4c480b[_0x08ff('0x1e')](_0x08ff('0x39'))[_0x08ff('0x22')](_0x1fedc9,_0x5f2061);default:return null;}})[_0x08ff('0x23')](function(_0x1b99ff){if(_0x1b99ff&&_0x1b99ff[_0x08ff('0x24')]){var _0x28234a=_[_0x08ff('0x3a')](_0x1b99ff);if(_0x28234a){return BPromise[_0x08ff('0x26')]({'id':_0x28234a['Id'],'name':_0x28234a[_0x08ff('0x27')],'phone':_0x28234a[_0x08ff('0x3b')],'endUserType':_0x28234a['attributes'][_0x08ff('0x3c')]['toLowerCase']()});}}})[_0x08ff('0x23')](function(_0x4413c2){if(_0x4413c2){logger[_0x08ff('0x1c')](_0x08ff('0x3d'),_0x4413c2[_0x08ff('0x13')],_0x29c113);return BPromise[_0x08ff('0x26')](_0x4413c2);}else{logger[_0x08ff('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x29c113);var _0x4b6d01={'Phone':_0x29c113};if(_0xc597da['moduleCreate']){if(_0xc597da[_0x08ff('0x3e')]===_0x08ff('0x14')){logger['info'](_0x08ff('0x3f'),_0x29c113,_0xc597da[_0x08ff('0x3e')]);_0x4b6d01[_0x08ff('0x40')]=_0x3e376d!==_0x08ff('0x41')?_0x3e376d:util['format'](_0x08ff('0x42'),_0x29c113);}else if(_0xc597da[_0x08ff('0x3e')]===_0x08ff('0x15')){logger[_0x08ff('0x1c')](_0x08ff('0x3f'),_0x29c113,_0xc597da[_0x08ff('0x3e')]);_0x4b6d01[_0x08ff('0x40')]=_0x3e376d!==_0x08ff('0x41')?_0x3e376d:util['format']('Caller\x20-\x20%s',_0x29c113);_0x4b6d01[_0x08ff('0x43')]='No\x20Company';}else if(_0xc597da[_0x08ff('0x3e')]===_0x08ff('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x29c113,_0xc597da[_0x08ff('0x3e')]);_0x4b6d01[_0x08ff('0x27')]=_0x3e376d!==_0x08ff('0x41')?_0x3e376d:util['format'](_0x08ff('0x42'),_0x29c113);}else{return null;}}return _0x4c480b[_0x08ff('0x1e')](_[_0x08ff('0x44')](_0xc597da['moduleCreate']))[_0x08ff('0x1f')](_0x4b6d01)[_0x08ff('0x23')](function(_0x350f1c){return BPromise[_0x08ff('0x26')]({'id':_0x350f1c['id'],'endUserType':_0xc597da[_0x08ff('0x3e')]});});}});}function getCustomFields(_0x31c1fd,_0x57fb32){var _0x14f0eb={};if(_0x31c1fd[_0x08ff('0x24')]>0x0){_['forEach'](_0x31c1fd,function(_0xb009b8){if(_[_0x08ff('0x45')](['string','picklist'],_0xb009b8[_0x08ff('0x3c')])&&_0xb009b8['idField']){_0x14f0eb[_0xb009b8['idField']]=_0xb009b8['content'][_0x08ff('0x46')]();}else if(_0xb009b8[_0x08ff('0x3c')]===_0x08ff('0x47')&&_0xb009b8[_0x08ff('0x48')]&&_0xb009b8[_0x08ff('0x49')]){_0x57fb32[_0xb009b8[_0x08ff('0x48')]]&&(_0x14f0eb[_0xb009b8[_0x08ff('0x49')]]=_0x57fb32[_0xb009b8[_0x08ff('0x48')]][_0x08ff('0x46')]());}else if(_0xb009b8[_0x08ff('0x3c')]===_0x08ff('0x4a')&&_0xb009b8['Variable']&&_0xb009b8[_0x08ff('0x4b')][_0x08ff('0x4c')]&&_0xb009b8[_0x08ff('0x49')]){_0x57fb32[_0xb009b8[_0x08ff('0x4b')][_0x08ff('0x4c')][_0x08ff('0x4d')]()]&&(_0x14f0eb[_0xb009b8[_0x08ff('0x49')]]=_0x57fb32[_0xb009b8[_0x08ff('0x4b')][_0x08ff('0x4c')][_0x08ff('0x4d')]()][_0x08ff('0x46')]());}});}return _0x14f0eb;}function getConnection(_0x39472f){var _0x444e6e=_0x39472f['password'][_0x08ff('0x4e')](_0x39472f[_0x08ff('0x4f')]);var _0x597e21=new jsforce['Connection']({'oauth2':{'loginUrl':_0x39472f[_0x08ff('0x50')]||_0x08ff('0x51'),'clientId':_0x39472f['clientId'],'clientSecret':_0x39472f[_0x08ff('0x52')]}});return _0x597e21[_0x08ff('0x53')](_0x39472f['username'],_0x444e6e)[_0x08ff('0x23')](function(){logger[_0x08ff('0x1c')]('Connection\x20established.');return _0x597e21;});}exports['queue']=function(_0x5c41d7,_0x4af8aa,_0x216d43,_0x4106c0,_0xb89192,_0x5755ee){var _0x4f6c61,_0x40135c,_0x79d0e6,_0x266e28;_0x5755ee['serverUrl']=intUtil[_0x08ff('0x54')](_0x5755ee[_0x08ff('0x55')]);_0x5755ee['remoteUri']=intUtil[_0x08ff('0x54')](_0x5755ee['remoteUri']);if(_0xb89192&&_0xb89192[_0x08ff('0x56')]){logger['info'](_0x08ff('0x57'),'Recording\x20is\x20enabled!');_0x4af8aa[_0x08ff('0x58')]=util['format'](_0x08ff('0x59'),_0x5755ee[_0x08ff('0x55')],_0x4af8aa[_0x08ff('0x5a')],md5(_0x4af8aa['uniqueid']));}else{_0x4af8aa[_0x08ff('0x58')]='';}return getConnection(_0x5755ee)['then'](function(_0x53c5f8){_0x266e28=_0x53c5f8;return getUser(_0x5755ee,_0x4106c0[_0x08ff('0x5b')],_0x266e28);})[_0x08ff('0x23')](function(_0x258804){_0x4f6c61=_0x258804;return getEndUser(_0x5755ee,_0x216d43,_0x4af8aa[_0x08ff('0x5c')],_0x4af8aa['calleridnum'],_0x266e28);})[_0x08ff('0x23')](function(_0x4cb3b1){_0x40135c=_0x4cb3b1;return getTicket(_0x5755ee,_0x4f6c61,_0x40135c,_0x216d43,_0x4af8aa,_0x216d43[_0x08ff('0x5d')],_0x266e28,_0x08ff('0x5e'));})[_0x08ff('0x23')](function(_0x1d065e){_0x79d0e6=_0x1d065e;logger['info'](_0x08ff('0x5f'),_0x79d0e6['id']);logger[_0x08ff('0x1c')](_0x08ff('0x60'),_0x79d0e6['id'],_0x4106c0[_0x08ff('0x4c')],_0x5755ee[_0x08ff('0x3c')]);switch(_0x5755ee[_0x08ff('0x3c')]){case _0x08ff('0x61'):emit(util['format'](_0x08ff('0x62'),_0x4106c0['name']),'trigger:salesforce:display',{'recordId':_0x79d0e6['id']});break;case _0x08ff('0x63'):emit(util['format'](_0x08ff('0x62'),_0x4106c0[_0x08ff('0x4c')]),_0x08ff('0x64'),{'uri':util[_0x08ff('0x65')]('%s/%s/e',_0x266e28[_0x08ff('0x66')],_0x79d0e6['id'])});break;default:logger[_0x08ff('0x67')](_0x08ff('0x68'));}})[_0x08ff('0x69')](function(_0x42e87a){logger['error'](_0x08ff('0x57'),_0x42e87a);});};exports[_0x08ff('0x6a')]=function(_0x53ed99,_0x165ebb,_0x4931cf,_0xc941a3,_0x5bf04d,_0x2dad76,_0x52fed7){var _0x29149e,_0x2fce59,_0x8c56a8,_0x290356;_0x2dad76['serverUrl']=intUtil[_0x08ff('0x54')](_0x2dad76[_0x08ff('0x55')]);_0x2dad76['remoteUri']=intUtil[_0x08ff('0x54')](_0x2dad76[_0x08ff('0x50')]);if(_0x52fed7&&_0x52fed7[_0x08ff('0x6b')]&&_0x52fed7['recordingFormat']!==_0x08ff('0x6c')){logger['info'](_0x08ff('0x6d'),_0x08ff('0x6e'));_0x165ebb[_0x08ff('0x58')]=util['format'](_0x08ff('0x59'),_0x2dad76[_0x08ff('0x55')],_0x165ebb[_0x08ff('0x5a')],md5(_0x165ebb[_0x08ff('0x5a')]));}return getConnection(_0x2dad76)[_0x08ff('0x23')](function(_0x5b48e8){_0x290356=_0x5b48e8;return getUser(_0x2dad76,_0xc941a3[_0x08ff('0x5b')],_0x290356);})[_0x08ff('0x23')](function(_0x52f240){_0x29149e=_0x52f240;return getEndUser(_0x2dad76,_0x4931cf,_0x165ebb['destcalleridname'],_0x165ebb[_0x08ff('0x6f')],_0x290356);})[_0x08ff('0x23')](function(_0x57fa2d){_0x2fce59=_0x57fa2d;return getTicket(_0x2dad76,_0x29149e,_0x2fce59,_0x4931cf,_0x165ebb,_0x4931cf[_0x08ff('0x5d')],_0x290356,'outbound');})[_0x08ff('0x23')](function(_0x8630db){_0x8c56a8=_0x8630db;logger[_0x08ff('0x1c')](_0x08ff('0x70'),_0x8c56a8['id']);logger[_0x08ff('0x1c')](_0x08ff('0x71'),_0x8c56a8['id'],_0xc941a3[_0x08ff('0x4c')],_0x2dad76[_0x08ff('0x3c')]);switch(_0x2dad76['type']){case _0x08ff('0x61'):emit(util[_0x08ff('0x65')](_0x08ff('0x62'),_0xc941a3[_0x08ff('0x4c')]),'trigger:salesforce:display',{'recordId':_0x8c56a8['id']});break;case'newTab':emit(util[_0x08ff('0x65')](_0x08ff('0x62'),_0xc941a3[_0x08ff('0x4c')]),'trigger:browser:url',{'uri':util[_0x08ff('0x65')]('%s/%s/e',_0x290356[_0x08ff('0x66')],_0x8c56a8['id'])});break;default:logger[_0x08ff('0x67')](_0x08ff('0x6d'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x08ff('0x69')](function(_0x2c7c95){logger[_0x08ff('0x67')](_0x08ff('0x6d'),_0x2c7c95);});};exports['unmanaged']=function(_0x7cc13b,_0x13ed5e,_0x22d07f,_0x253145,_0x53672a,_0x3dff61){var _0x350272,_0x129b6c,_0x3a1c7d,_0x589ee8;_0x3dff61[_0x08ff('0x55')]=intUtil[_0x08ff('0x54')](_0x3dff61[_0x08ff('0x55')]);_0x3dff61[_0x08ff('0x50')]=intUtil[_0x08ff('0x54')](_0x3dff61[_0x08ff('0x50')]);if(_0x53672a&&_0x53672a['monitor_format']){logger[_0x08ff('0x1c')]('['+_0x13ed5e['lastevent'][_0x08ff('0x72')]()+']',_0x08ff('0x6e'));_0x13ed5e['recordingURL']=util[_0x08ff('0x65')](_0x08ff('0x59'),_0x3dff61[_0x08ff('0x55')],_0x13ed5e['uniqueid'],md5(_0x13ed5e['uniqueid']));}else{_0x13ed5e[_0x08ff('0x58')]='';}return getConnection(_0x3dff61)[_0x08ff('0x23')](function(_0x5d2526){_0x589ee8=_0x5d2526;if(!_['isNil'](_0x253145)){return getUser(_0x3dff61,_0x253145['name'],_0x589ee8);}else{return getUser(_0x3dff61,null,_0x589ee8);}})[_0x08ff('0x23')](function(_0x53f0e8){_0x350272=_0x53f0e8;return getEndUser(_0x3dff61,_0x22d07f,_0x13ed5e[_0x08ff('0x5c')],_0x13ed5e[_0x08ff('0x73')],_0x589ee8);})[_0x08ff('0x23')](function(_0x38c648){_0x129b6c=_0x38c648;return getTicket(_0x3dff61,_0x350272,_0x129b6c,_0x22d07f,_0x13ed5e,_0x22d07f['Fields'],_0x589ee8);})[_0x08ff('0x23')](function(_0x38bd88){_0x3a1c7d=_0x38bd88;logger['info']('['+_0x13ed5e[_0x08ff('0x74')]['toUpperCase']()+_0x08ff('0x75'),_0x3a1c7d['id']);logger[_0x08ff('0x1c')]('['+_0x13ed5e[_0x08ff('0x74')][_0x08ff('0x72')]()+_0x08ff('0x76'),_0x3dff61[_0x08ff('0x3c')]);})[_0x08ff('0x69')](function(_0x41ba95){logger[_0x08ff('0x67')]('['+_0x13ed5e[_0x08ff('0x74')][_0x08ff('0x72')]()+']',_0x41ba95);});}; \ 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 9ee2d44..7297134 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 _0x6fa1=['Variable','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','email','calleridnum','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','sys_id','userId','adminEmail','error','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','toString','string','idField','content','variable','variableName','customVariable'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x6fa1,0x93));var _0x16fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6fa1[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var Promise=require(_0x16fa('0x0'));var rp=require(_0x16fa('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0x16fa('0x2'));var intUtil=require('./util');var config=require(_0x16fa('0x3'));var logger=require(_0x16fa('0x4'))('servicenow');config[_0x16fa('0x5')]=_[_0x16fa('0x6')](config[_0x16fa('0x5')],{'host':_0x16fa('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16fa('0x5')]));function getAdminUser(_0x8a8836,_0x9f903b,_0x4cb6c4,_0xde9f0,_0x39db34,_0x206ec1){return new Promise(function(_0x3c5760,_0x35bb58){var _0x53caf3={'method':_0x16fa('0x8'),'uri':_0xde9f0+_0x16fa('0x9')+'&'+_0x39db34+'&'+_0x206ec1,'auth':_0x9f903b,'json':!![]};return rp(_0x53caf3)[_0x16fa('0xa')](function(_0x216309){if(_0x216309[_0x16fa('0xb')][_0x16fa('0xc')]>0x0){_0x4cb6c4[_0x16fa('0xd')]=_0x216309[_0x16fa('0xb')][0x0]['sys_id'];}logger['info']('['+[_0x8a8836[_0x16fa('0xe')]()]+_0x16fa('0xf'),_0x4cb6c4);_0x3c5760(_0x4cb6c4);})[_0x16fa('0x10')](function(_0x5c4c66){logger['error']('['+[_0x8a8836[_0x16fa('0xe')]()]+']',_0x5c4c66[_0x16fa('0x11')]);_0x35bb58(_0x5c4c66['message']);});});}function getUser(_0xac115a,_0x3c13ef,_0x8138b2,_0x1e461e,_0x25120e){return function(_0x26fb27){logger[_0x16fa('0x12')]('['+[_0xac115a[_0x16fa('0xe')]()]+'],\x20getUser\x20input\x20crm',_0x26fb27);return new Promise(function(_0x412a3a,_0x37accd){if(intUtil['validateEmail'](_0x26fb27[_0x16fa('0x13')])){var _0x24d210={'method':_0x16fa('0x8'),'uri':_0x8138b2+_0x16fa('0x14')+_0x26fb27[_0x16fa('0x13')]+'&'+_0x1e461e+'&'+_0x25120e,'auth':_0x3c13ef,'json':!![]};logger['info']('['+[_0xac115a['toUpperCase']()]+_0x16fa('0x15'),_0x24d210);return rp(_0x24d210)[_0x16fa('0xa')](function(_0x2acd45){logger['info']('['+[_0xac115a['toUpperCase']()]+_0x16fa('0x16'),_0x2acd45);if(_0x2acd45[_0x16fa('0xb')][_0x16fa('0xc')]>0x0&&String(_0x2acd45['result'][0x0][_0x16fa('0x17')])==='true'){_0x26fb27['userId']=_0x2acd45['result'][0x0][_0x16fa('0x18')];}else{_0x26fb27[_0x16fa('0x19')]=_0x26fb27['adminId'];_0x26fb27['userEmail']=_0x26fb27[_0x16fa('0x1a')];}logger[_0x16fa('0x12')]('['+[_0xac115a[_0x16fa('0xe')]()]+'],\x20getUser\x20crm',_0x26fb27);_0x412a3a(_0x26fb27);})[_0x16fa('0x10')](function(_0x3b6210){logger[_0x16fa('0x1b')]('['+[_0xac115a[_0x16fa('0xe')]()]+']',_0x3b6210[_0x16fa('0x11')]);_0x37accd(_0x3b6210[_0x16fa('0x11')]);});}else{logger[_0x16fa('0x12')]('['+[_0xac115a[_0x16fa('0xe')]()]+']\x20using\x20admin\x20profile');_0x26fb27[_0x16fa('0x19')]=_0x26fb27['adminId'];_0x26fb27[_0x16fa('0x13')]=_0x26fb27[_0x16fa('0x1a')];_0x412a3a(_0x26fb27);}});};}function createEndUser(_0x205176,_0x110c2f,_0x5c263e,_0x5f1ac3,_0x351ada){logger[_0x16fa('0x12')]('['+[_0x205176['toUpperCase']()]+_0x16fa('0x1c'),_0x5c263e);return new Promise(function(_0x20b95d,_0x5eebb1){var _0x1ac1a0={'method':_0x16fa('0x1d'),'uri':_0x5f1ac3+_0x16fa('0x1e')+_0x351ada,'body':{'user_name':_0x5c263e[_0x16fa('0x1f')],'roles':_0x16fa('0x20'),'first_name':_0x5c263e['endUserNumber'],'active':_0x16fa('0x21'),'date_format':'System','phone':_0x5c263e[_0x16fa('0x1f')]},'auth':_0x110c2f,'json':!![]};return rp(_0x1ac1a0)[_0x16fa('0xa')](function(_0x4f3f56){logger[_0x16fa('0x12')]('['+[_0x205176['toUpperCase']()]+_0x16fa('0x22'),_0x4f3f56[_0x16fa('0xb')]);_0x5c263e[_0x16fa('0x23')]=_0x4f3f56[_0x16fa('0xb')][_0x16fa('0x18')];_0x20b95d(_0x5c263e);})[_0x16fa('0x10')](function(_0x19fcb9){logger[_0x16fa('0x1b')]('['+[_0x205176['toUpperCase']()]+']',_0x19fcb9[_0x16fa('0x11')]);_0x5eebb1(_0x19fcb9[_0x16fa('0x11')]);});});}function getEndUser(_0x36e96d,_0x5cbdb4,_0x556eb4,_0x3bcf59,_0x556dcc){return function(_0x3685ca){logger[_0x16fa('0x12')]('['+[_0x36e96d[_0x16fa('0xe')]()]+_0x16fa('0x24'),_0x3685ca);return new Promise(function(_0x5aeb0b,_0x12c9cd){var _0xf08a3={'method':'GET','uri':_0x556eb4+_0x16fa('0x25')+_0x3685ca[_0x16fa('0x1f')]+'&'+_0x3bcf59+'&'+_0x556dcc,'auth':_0x5cbdb4,'json':!![]};return rp(_0xf08a3)[_0x16fa('0xa')](function(_0x45b8e8){if(_0x45b8e8[_0x16fa('0xb')]['length']>0x0){_0x3685ca[_0x16fa('0x23')]=_0x45b8e8[_0x16fa('0xb')][0x0][_0x16fa('0x18')];logger['info']('['+[_0x36e96d[_0x16fa('0xe')]()]+_0x16fa('0x26'),_0x3685ca);_0x5aeb0b(_0x3685ca);}else{return createEndUser(_0x36e96d,_0x5cbdb4,_0x3685ca,_0x556eb4,_0x3bcf59)[_0x16fa('0xa')](function(_0x15740a){logger['info']('['+[_0x36e96d[_0x16fa('0xe')]()]+'],\x20createEndUser\x20crm',_0x15740a);_0x5aeb0b(_0x15740a);});}})[_0x16fa('0x10')](function(_0x1a9ff8){logger[_0x16fa('0x1b')]('['+[_0x36e96d['toUpperCase']()]+']',_0x1a9ff8['message']);_0x12c9cd(_0x1a9ff8[_0x16fa('0x11')]);});});};}function getCustomFields(_0x2a54e9,_0x53d17e){var _0x733c9={};if(_0x2a54e9[_0x16fa('0xc')]>0x0){_[_0x16fa('0x27')](_0x2a54e9,function(_0x5665e0){if(_[_0x16fa('0x28')](['string',_0x16fa('0x29')],_0x5665e0[_0x16fa('0x2a')])&&_0x5665e0[_0x16fa('0x2b')]&&!_0x5665e0[_0x16fa('0x2c')]){_0x733c9[_0x5665e0['nameField'][_0x16fa('0x2d')]()]=_0x5665e0['content'][_0x16fa('0x2e')]();}else if(_[_0x16fa('0x28')]([_0x16fa('0x2f'),'picklist'],_0x5665e0[_0x16fa('0x2a')])&&_0x5665e0[_0x16fa('0x30')]&&_0x5665e0[_0x16fa('0x2c')]){_0x733c9[_0x5665e0[_0x16fa('0x30')]['toLowerCase']()]=_0x5665e0[_0x16fa('0x31')]['toString']();}else if(_0x5665e0[_0x16fa('0x2a')]===_0x16fa('0x32')&&_0x5665e0[_0x16fa('0x33')]&&_0x5665e0[_0x16fa('0x30')]&&_0x5665e0[_0x16fa('0x2c')]){_0x733c9[_0x5665e0[_0x16fa('0x30')][_0x16fa('0x2d')]()]=_0x53d17e[_0x5665e0[_0x16fa('0x33')]][_0x16fa('0x2e')]();}else if(_0x5665e0['type']===_0x16fa('0x34')&&_0x5665e0['Variable']&&_0x5665e0['Variable']['name']&&_0x5665e0[_0x16fa('0x30')]&&_0x5665e0[_0x16fa('0x2c')]){_0x733c9[_0x5665e0[_0x16fa('0x30')][_0x16fa('0x2d')]()]=_0x53d17e[_0x5665e0[_0x16fa('0x35')]['name']['toLowerCase']()][_0x16fa('0x2e')]();}});}return _0x733c9;}function getTicket(_0x69d983,_0x43f953,_0x4d07db,_0x49f881,_0x4e6595,_0x335543){return function(_0x12206d){logger[_0x16fa('0x12')]('['+[_0x69d983['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x12206d);return new Promise(function(_0x311c0d,_0x15b37d){var _0x54fdf3=_0x69d983[_0x16fa('0x2d')]()===_0x16fa('0x36')?_0x12206d[_0x16fa('0x19')]:_0x12206d[_0x16fa('0x23')];var _0x35c5d3={'method':_0x16fa('0x1d'),'uri':_0x4d07db+_0x16fa('0x37')+'?'+_0x335543,'body':Object[_0x16fa('0x38')]({},{'active':_0x16fa('0x21'),'caller_id':_0x54fdf3,'assigned_to':_0x12206d['userId'],'short_description':intUtil[_0x16fa('0x39')](_0x49f881[_0x16fa('0x3a')],_0x4e6595,'\x20'),'description':intUtil[_0x16fa('0x39')](_0x49f881[_0x16fa('0x3b')],_0x4e6595,'\x0a')},getCustomFields(_0x49f881[_0x16fa('0x3c')],_0x4e6595)),'auth':_0x43f953,'json':!![]};return rp(_0x35c5d3)[_0x16fa('0xa')](function(_0x14f70b){logger[_0x16fa('0x12')]('['+[_0x69d983[_0x16fa('0xe')]()]+_0x16fa('0x3d'),_0x14f70b['result']);_0x12206d['ticketId']=_0x14f70b[_0x16fa('0xb')][_0x16fa('0x18')];_0x12206d['ticketNumber']=_0x14f70b[_0x16fa('0xb')][_0x16fa('0x3e')];logger[_0x16fa('0x12')]('['+[_0x69d983[_0x16fa('0xe')]()]+_0x16fa('0x3f'),_0x12206d);_0x311c0d(_0x12206d);})[_0x16fa('0x10')](function(_0x14729c){logger['error']('['+[_0x69d983['toUpperCase']()]+']',_0x14729c['message']);_0x15b37d(_0x14729c['message']);});});};}function createRemoteTag(_0x30147f,_0x45fc56,_0x5eb53c,_0x36c7c3){return new Promise(function(_0x3c0c36,_0x38484c){var _0x37e65b={'method':'POST','uri':_0x5eb53c+_0x16fa('0x40')+'?'+_0x36c7c3,'body':{'short_description':_0x30147f,'global':!![],'active':!![],'name':_0x30147f},'auth':_0x45fc56,'json':!![]};return rp(_0x37e65b)[_0x16fa('0xa')](function(_0x548093){var _0x48f009=_0x548093[_0x16fa('0xb')][_0x16fa('0x18')];_0x3c0c36(_0x48f009);});});}function getRemoteTag(_0xb49018,_0x449921,_0x55037f,_0x3997f2,_0x1dfb24){return new Promise(function(_0x44aecc,_0x361f65){var _0x1f98b4={'method':'GET','uri':_0x55037f+_0x16fa('0x40')+_0x16fa('0x41')+_0xb49018+'&'+_0x3997f2,'auth':_0x449921,'json':!![]};return rp(_0x1f98b4)['then'](function(_0xdb02dd){if(_0xdb02dd['result'][_0x16fa('0xc')]>0x0){var _0x4d3ce6=_0xdb02dd[_0x16fa('0xb')][0x0][_0x16fa('0x18')];_0x44aecc(_0x4d3ce6);}else{return createRemoteTag(_0xb49018,_0x449921,_0x55037f,_0x3997f2)[_0x16fa('0xa')](function(_0x278058){_0x44aecc(_0x278058);});}});});}function assignTagToIncident(_0x17157f,_0x446776,_0x542066,_0x144a6e,_0x34386f){return new Promise(function(_0x1799c9,_0x3a38ae){var _0x56b52d={'method':_0x16fa('0x1d'),'uri':_0x542066+_0x16fa('0x42')+'?'+_0x34386f,'body':{'label':_0x17157f,'table':'incident','id_type':_0x16fa('0x43'),'table_key':_0x144a6e[_0x16fa('0x44')],'title':_0x16fa('0x45')+_0x144a6e[_0x16fa('0x46')],'id_display':_0x144a6e[_0x16fa('0x46')]},'auth':_0x446776,'json':!![]};return rp(_0x56b52d)['then'](function(_0x2f697c){_0x1799c9();})[_0x16fa('0x10')](function(){_0x1799c9();});});}function manageTags(_0x3db58b,_0x151f17,_0x3bcdad,_0x2cd2a5,_0x100438,_0x48e038,_0x8a013){return new Promise(function(_0x5614af,_0x8ff188){var _0x3863dd=[];_0x151f17[_0x16fa('0x27')](function(_0x2a4050){_0x3863dd[_0x16fa('0x47')](getRemoteTag(_0x2a4050,_0x3bcdad,_0x2cd2a5,_0x48e038,_0x8a013));});return Promise[_0x16fa('0x48')](_0x3863dd)[_0x16fa('0xa')](function(_0x1edb66){if(_0x1edb66[_0x16fa('0xc')]){logger[_0x16fa('0x12')]('['+[_0x3db58b[_0x16fa('0xe')]()]+_0x16fa('0x49'),_0x1edb66);var _0x48e0c8=[];_0x1edb66[_0x16fa('0x27')](function(_0x133e5b){_0x48e0c8[_0x16fa('0x47')](assignTagToIncident(_0x133e5b,_0x3bcdad,_0x2cd2a5,_0x100438,_0x48e038));});return Promise[_0x16fa('0x48')](_0x48e0c8)[_0x16fa('0xa')](function(){_0x5614af();})['catch'](function(){_0x5614af();});}else{_0x5614af();}});});}function getTags(_0x321ff3,_0x41146d,_0x41c162,_0x3083aa,_0x14b8b7,_0x779e87){return function(_0x1a3957){return new Promise(function(_0x5afed9,_0x3407a8){var _0xd7f4b6=[];var _0xc62466=_0x3083aa['Tags'];if(_0xc62466&&_0xc62466[_0x16fa('0xc')]>0x0){_0xd7f4b6=_[_0x16fa('0x4a')](_0xc62466,_0x16fa('0x4b'));}if(_0xd7f4b6[_0x16fa('0xc')]>0x0){return manageTags(_0x321ff3,_0xd7f4b6,_0x41146d,_0x41c162,_0x1a3957,_0x14b8b7,_0x779e87)['then'](function(){_0x5afed9(_0x1a3957);});}else{_0x5afed9(_0x1a3957);}});};}function emit(_0x46dad5,_0x3fbbf1,_0x22d244){var _0x340901=_0x16fa('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x16fa('0x4d')+_0x16fa('0x4e');var _0x39c258={'uri':_0x46dad5+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x22d244+_0x340901};io['to'](util[_0x16fa('0x4f')]('user:%s',_0x3fbbf1))[_0x16fa('0x50')](_0x16fa('0x51'),_0x39c258);}exports['cs']=function(_0x409450,_0x4661e9,_0x308d74,_0x4791a8,_0x255783,_0x357d60,_0x413315,_0x5e554c){var _0x4a322a={};var _0x12442b={'user':_0x357d60['username'],'pass':_0x357d60[_0x16fa('0x52')]};var _0x21962e=_0x16fa('0x53');var _0x5cbc91='sysparm_display_value=true';_0x357d60[_0x16fa('0x54')]=intUtil[_0x16fa('0x55')](_0x357d60['remoteUri']);_0x357d60[_0x16fa('0x56')]=intUtil[_0x16fa('0x55')](_0x357d60[_0x16fa('0x56')]);var _0x536ecb=util[_0x16fa('0x4f')]('%s/api/now/table/',_0x357d60[_0x16fa('0x54')]);_0x4a322a['userEmail']=!_[_0x16fa('0x57')](_0x4791a8)?_0x4791a8[_0x16fa('0x58')]:null;_0x4a322a['adminEmail']=_0x357d60[_0x16fa('0x58')];_0x4a322a[_0x16fa('0x1f')]=_0x5e554c[_0x16fa('0x2d')]()===_0x16fa('0x36')?_0x4661e9['destcalleridnum']:_0x4661e9[_0x16fa('0x59')];_0x4a322a['callDirection']=_0x5e554c==='queue'||_0x5e554c===_0x16fa('0x5a')?_0x16fa('0x5b'):_0x16fa('0x36');var _0x1b7778=util[_0x16fa('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x357d60[_0x16fa('0x56')],_0x4661e9[_0x16fa('0x5c')],md5(_0x4661e9[_0x16fa('0x5c')]));if(_0x255783&&_0x255783[_0x16fa('0x5d')]){logger[_0x16fa('0x12')](_0x16fa('0x5e'),'Recording\x20is\x20enabled!');_0x4661e9[_0x16fa('0x5f')]=_0x1b7778;}else if(_0x413315&&_0x413315['recordingFormat']&&_0x413315['recordingFormat']!=='none'){logger[_0x16fa('0x12')]('[OUTBOUND]',_0x16fa('0x60'));_0x4661e9[_0x16fa('0x5f')]=_0x1b7778;}else{_0x4661e9['recordingURL']='';}return getAdminUser(_0x5e554c,_0x12442b,_0x4a322a,_0x536ecb,_0x5cbc91,_0x21962e)[_0x16fa('0xa')](getUser(_0x5e554c,_0x12442b,_0x536ecb,_0x5cbc91,_0x21962e))['then'](getEndUser(_0x5e554c,_0x12442b,_0x536ecb,_0x5cbc91,_0x21962e))[_0x16fa('0xa')](getTicket(_0x5e554c,_0x12442b,_0x536ecb,_0x308d74,_0x4661e9,_0x5cbc91))[_0x16fa('0xa')](function(_0x45f18a){logger[_0x16fa('0x12')](util['format'](_0x16fa('0x61'),_0x45f18a[_0x16fa('0x44')]));logger[_0x16fa('0x12')](util[_0x16fa('0x4f')](_0x16fa('0x62'),_0x5e554c));if(_0x5e554c!==_0x16fa('0x5a')){logger[_0x16fa('0x12')]('['+[_0x5e554c[_0x16fa('0xe')]()]+']',_0x16fa('0x63'));emit(_0x357d60[_0x16fa('0x54')],_0x4791a8[_0x16fa('0x4b')],_0x45f18a[_0x16fa('0x44')]);}})[_0x16fa('0x10')](function(_0xe4d8d6){logger[_0x16fa('0x1b')]('['+[_0x5e554c[_0x16fa('0xe')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0xe4d8d6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x65a0=['picklist','customField','nameField','toLowerCase','content','toString','type','idField','variableName','customVariable','Variable','name','endUserId','POST','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','Incident','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string'];(function(_0x594c57,_0x1cc97b){var _0x34bac9=function(_0x5e5833){while(--_0x5e5833){_0x594c57['push'](_0x594c57['shift']());}};_0x34bac9(++_0x1cc97b);}(_0x65a0,0x1e6));var _0x065a=function(_0x2a2fc3,_0x14c843){_0x2a2fc3=_0x2a2fc3-0x0;var _0x59c952=_0x65a0[_0x2a2fc3];return _0x59c952;};'use strict';var _=require('lodash');var Promise=require(_0x065a('0x0'));var rp=require(_0x065a('0x1'));var util=require(_0x065a('0x2'));var md5=require('md5');var Redis=require(_0x065a('0x3'));var intUtil=require(_0x065a('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x065a('0x5')]=_[_0x065a('0x6')](config[_0x065a('0x5')],{'host':_0x065a('0x7'),'port':0x18eb});var io=require(_0x065a('0x8'))(new Redis(config[_0x065a('0x5')]));function getAdminUser(_0x489f49,_0x5769f9,_0x3a8b08,_0x4920b8,_0x336ec7,_0xd75cb4){return new Promise(function(_0x572afc,_0x39b701){var _0x1b562b={'method':'GET','uri':_0x4920b8+_0x065a('0x9')+'&'+_0x336ec7+'&'+_0xd75cb4,'auth':_0x5769f9,'json':!![]};return rp(_0x1b562b)[_0x065a('0xa')](function(_0x2c7a7a){if(_0x2c7a7a[_0x065a('0xb')][_0x065a('0xc')]>0x0){_0x3a8b08[_0x065a('0xd')]=_0x2c7a7a[_0x065a('0xb')][0x0][_0x065a('0xe')];}logger[_0x065a('0xf')]('['+[_0x489f49[_0x065a('0x10')]()]+_0x065a('0x11'),_0x3a8b08);_0x572afc(_0x3a8b08);})[_0x065a('0x12')](function(_0x42cbe8){logger['error']('['+[_0x489f49['toUpperCase']()]+']',_0x42cbe8[_0x065a('0x13')]);_0x39b701(_0x42cbe8[_0x065a('0x13')]);});});}function getUser(_0x41f815,_0x2dd500,_0x7a3b8,_0x65377d,_0x4b21db){return function(_0x33d570){logger[_0x065a('0xf')]('['+[_0x41f815[_0x065a('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x33d570);return new Promise(function(_0x1b094a,_0x238894){if(intUtil[_0x065a('0x14')](_0x33d570[_0x065a('0x15')])){var _0x38d66b={'method':_0x065a('0x16'),'uri':_0x7a3b8+_0x065a('0x17')+_0x33d570[_0x065a('0x15')]+'&'+_0x65377d+'&'+_0x4b21db,'auth':_0x2dd500,'json':!![]};logger[_0x065a('0xf')]('['+[_0x41f815[_0x065a('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x38d66b);return rp(_0x38d66b)[_0x065a('0xa')](function(_0x196ede){logger['info']('['+[_0x41f815[_0x065a('0x10')]()]+_0x065a('0x18'),_0x196ede);if(_0x196ede[_0x065a('0xb')][_0x065a('0xc')]>0x0&&String(_0x196ede[_0x065a('0xb')][0x0][_0x065a('0x19')])===_0x065a('0x1a')){_0x33d570['userId']=_0x196ede[_0x065a('0xb')][0x0][_0x065a('0xe')];}else{_0x33d570[_0x065a('0x1b')]=_0x33d570['adminId'];_0x33d570[_0x065a('0x15')]=_0x33d570['adminEmail'];}logger[_0x065a('0xf')]('['+[_0x41f815['toUpperCase']()]+_0x065a('0x1c'),_0x33d570);_0x1b094a(_0x33d570);})[_0x065a('0x12')](function(_0x1cbacf){logger[_0x065a('0x1d')]('['+[_0x41f815[_0x065a('0x10')]()]+']',_0x1cbacf[_0x065a('0x13')]);_0x238894(_0x1cbacf[_0x065a('0x13')]);});}else{logger[_0x065a('0xf')]('['+[_0x41f815[_0x065a('0x10')]()]+_0x065a('0x1e'));_0x33d570[_0x065a('0x1b')]=_0x33d570[_0x065a('0xd')];_0x33d570['userEmail']=_0x33d570[_0x065a('0x1f')];_0x1b094a(_0x33d570);}});};}function createEndUser(_0x3db2d1,_0xb0af,_0xab64cd,_0x30dd16,_0x2ffabf){logger[_0x065a('0xf')]('['+[_0x3db2d1[_0x065a('0x10')]()]+_0x065a('0x20'),_0xab64cd);return new Promise(function(_0x5ec1d5,_0x302d25){var _0x4b485b={'method':'POST','uri':_0x30dd16+_0x065a('0x21')+_0x2ffabf,'body':{'user_name':_0xab64cd['endUserNumber'],'roles':_0x065a('0x22'),'first_name':_0xab64cd['endUserNumber'],'active':_0x065a('0x1a'),'date_format':_0x065a('0x23'),'phone':_0xab64cd[_0x065a('0x24')]},'auth':_0xb0af,'json':!![]};return rp(_0x4b485b)['then'](function(_0x26f862){logger['info']('['+[_0x3db2d1[_0x065a('0x10')]()]+_0x065a('0x25'),_0x26f862[_0x065a('0xb')]);_0xab64cd['endUserId']=_0x26f862[_0x065a('0xb')][_0x065a('0xe')];_0x5ec1d5(_0xab64cd);})[_0x065a('0x12')](function(_0x265706){logger[_0x065a('0x1d')]('['+[_0x3db2d1[_0x065a('0x10')]()]+']',_0x265706[_0x065a('0x13')]);_0x302d25(_0x265706[_0x065a('0x13')]);});});}function getEndUser(_0x152515,_0x24708c,_0x19512b,_0xf6f906,_0x160537){return function(_0x5a0e93){logger[_0x065a('0xf')]('['+[_0x152515[_0x065a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a0e93);return new Promise(function(_0x1a613a,_0x2b059e){var _0x2830d2={'method':'GET','uri':_0x19512b+_0x065a('0x26')+_0x5a0e93[_0x065a('0x24')]+'&'+_0xf6f906+'&'+_0x160537,'auth':_0x24708c,'json':!![]};return rp(_0x2830d2)[_0x065a('0xa')](function(_0x28b913){if(_0x28b913[_0x065a('0xb')][_0x065a('0xc')]>0x0){_0x5a0e93['endUserId']=_0x28b913[_0x065a('0xb')][0x0][_0x065a('0xe')];logger[_0x065a('0xf')]('['+[_0x152515[_0x065a('0x10')]()]+_0x065a('0x27'),_0x5a0e93);_0x1a613a(_0x5a0e93);}else{return createEndUser(_0x152515,_0x24708c,_0x5a0e93,_0x19512b,_0xf6f906)[_0x065a('0xa')](function(_0x221e9a){logger[_0x065a('0xf')]('['+[_0x152515[_0x065a('0x10')]()]+_0x065a('0x28'),_0x221e9a);_0x1a613a(_0x221e9a);});}})[_0x065a('0x12')](function(_0x13ff56){logger[_0x065a('0x1d')]('['+[_0x152515[_0x065a('0x10')]()]+']',_0x13ff56['message']);_0x2b059e(_0x13ff56['message']);});});};}function getCustomFields(_0x126c27,_0x38e483){var _0x2eaffc={};if(_0x126c27[_0x065a('0xc')]>0x0){_[_0x065a('0x29')](_0x126c27,function(_0x153774){if(_[_0x065a('0x2a')]([_0x065a('0x2b'),_0x065a('0x2c')],_0x153774['type'])&&_0x153774['nameField']&&!_0x153774[_0x065a('0x2d')]){_0x2eaffc[_0x153774[_0x065a('0x2e')][_0x065a('0x2f')]()]=_0x153774[_0x065a('0x30')][_0x065a('0x31')]();}else if(_[_0x065a('0x2a')]([_0x065a('0x2b'),_0x065a('0x2c')],_0x153774[_0x065a('0x32')])&&_0x153774[_0x065a('0x33')]&&_0x153774[_0x065a('0x2d')]){_0x2eaffc[_0x153774['idField']['toLowerCase']()]=_0x153774[_0x065a('0x30')]['toString']();}else if(_0x153774[_0x065a('0x32')]==='variable'&&_0x153774['variableName']&&_0x153774[_0x065a('0x33')]&&_0x153774['customField']){_0x2eaffc[_0x153774['idField'][_0x065a('0x2f')]()]=_0x38e483[_0x153774[_0x065a('0x34')]][_0x065a('0x31')]();}else if(_0x153774[_0x065a('0x32')]===_0x065a('0x35')&&_0x153774[_0x065a('0x36')]&&_0x153774[_0x065a('0x36')][_0x065a('0x37')]&&_0x153774['idField']&&_0x153774[_0x065a('0x2d')]){_0x2eaffc[_0x153774[_0x065a('0x33')][_0x065a('0x2f')]()]=_0x38e483[_0x153774[_0x065a('0x36')]['name']['toLowerCase']()]['toString']();}});}return _0x2eaffc;}function getTicket(_0x26a3b,_0x1c1374,_0x6fb1d,_0x460f4c,_0x1ca77b,_0x160678){return function(_0x50b4b6){logger[_0x065a('0xf')]('['+[_0x26a3b[_0x065a('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x50b4b6);return new Promise(function(_0x527888,_0x5e1810){var _0xe1d298=_0x26a3b[_0x065a('0x2f')]()==='outbound'?_0x50b4b6[_0x065a('0x1b')]:_0x50b4b6[_0x065a('0x38')];var _0x21ce52={'method':_0x065a('0x39'),'uri':_0x6fb1d+_0x065a('0x3a')+'?'+_0x160678,'body':Object[_0x065a('0x3b')]({},{'active':_0x065a('0x1a'),'caller_id':_0xe1d298,'assigned_to':_0x50b4b6[_0x065a('0x1b')],'short_description':intUtil['getString'](_0x460f4c[_0x065a('0x3c')],_0x1ca77b,'\x20'),'description':intUtil[_0x065a('0x3d')](_0x460f4c[_0x065a('0x3e')],_0x1ca77b,'\x0a')},getCustomFields(_0x460f4c[_0x065a('0x3f')],_0x1ca77b)),'auth':_0x1c1374,'json':!![]};return rp(_0x21ce52)['then'](function(_0x2348b7){logger[_0x065a('0xf')]('['+[_0x26a3b[_0x065a('0x10')]()]+_0x065a('0x40'),_0x2348b7[_0x065a('0xb')]);_0x50b4b6[_0x065a('0x41')]=_0x2348b7[_0x065a('0xb')][_0x065a('0xe')];_0x50b4b6['ticketNumber']=_0x2348b7[_0x065a('0xb')][_0x065a('0x42')];logger[_0x065a('0xf')]('['+[_0x26a3b[_0x065a('0x10')]()]+']\x20getTicket\x20crm',_0x50b4b6);_0x527888(_0x50b4b6);})[_0x065a('0x12')](function(_0x2697d7){logger[_0x065a('0x1d')]('['+[_0x26a3b[_0x065a('0x10')]()]+']',_0x2697d7[_0x065a('0x13')]);_0x5e1810(_0x2697d7[_0x065a('0x13')]);});});};}function createRemoteTag(_0x193668,_0x37b5d5,_0xa5f485,_0x47c006){return new Promise(function(_0x580766,_0x8b4eaf){var _0x3379f7={'method':'POST','uri':_0xa5f485+'label'+'?'+_0x47c006,'body':{'short_description':_0x193668,'global':!![],'active':!![],'name':_0x193668},'auth':_0x37b5d5,'json':!![]};return rp(_0x3379f7)[_0x065a('0xa')](function(_0x38962d){var _0x366e7b=_0x38962d[_0x065a('0xb')][_0x065a('0xe')];_0x580766(_0x366e7b);});});}function getRemoteTag(_0x2f2e81,_0x4eb7cb,_0xb8e135,_0x51b8a4,_0x5e8ab6){return new Promise(function(_0x2e660a,_0x3509b2){var _0x6e5abd={'method':'GET','uri':_0xb8e135+_0x065a('0x43')+'?sysparm_query=name%3D'+_0x2f2e81+'&'+_0x51b8a4,'auth':_0x4eb7cb,'json':!![]};return rp(_0x6e5abd)[_0x065a('0xa')](function(_0x4e0e4d){if(_0x4e0e4d['result']['length']>0x0){var _0x24f481=_0x4e0e4d[_0x065a('0xb')][0x0][_0x065a('0xe')];_0x2e660a(_0x24f481);}else{return createRemoteTag(_0x2f2e81,_0x4eb7cb,_0xb8e135,_0x51b8a4)['then'](function(_0x1291c6){_0x2e660a(_0x1291c6);});}});});}function assignTagToIncident(_0x2bbf98,_0x4e482a,_0x52eb78,_0x29d5da,_0x222a26){return new Promise(function(_0x3b35b5,_0x35971f){var _0x25ef69={'method':_0x065a('0x39'),'uri':_0x52eb78+'label_entry'+'?'+_0x222a26,'body':{'label':_0x2bbf98,'table':_0x065a('0x3a'),'id_type':_0x065a('0x44'),'table_key':_0x29d5da[_0x065a('0x41')],'title':'Incident\x20-\x20'+_0x29d5da[_0x065a('0x45')],'id_display':_0x29d5da['ticketNumber']},'auth':_0x4e482a,'json':!![]};return rp(_0x25ef69)[_0x065a('0xa')](function(_0x5195f9){_0x3b35b5();})[_0x065a('0x12')](function(){_0x3b35b5();});});}function manageTags(_0x2bdaf7,_0x40e250,_0x32b6d4,_0x374121,_0x257dcd,_0x2a03f4,_0x406aee){return new Promise(function(_0x4b9109,_0x1972d7){var _0x107a30=[];_0x40e250[_0x065a('0x29')](function(_0x32bc59){_0x107a30['push'](getRemoteTag(_0x32bc59,_0x32b6d4,_0x374121,_0x2a03f4,_0x406aee));});return Promise['all'](_0x107a30)[_0x065a('0xa')](function(_0x30cbf7){if(_0x30cbf7[_0x065a('0xc')]){logger[_0x065a('0xf')]('['+[_0x2bdaf7['toUpperCase']()]+_0x065a('0x46'),_0x30cbf7);var _0x13927c=[];_0x30cbf7[_0x065a('0x29')](function(_0x1e9495){_0x13927c['push'](assignTagToIncident(_0x1e9495,_0x32b6d4,_0x374121,_0x257dcd,_0x2a03f4));});return Promise['all'](_0x13927c)[_0x065a('0xa')](function(){_0x4b9109();})[_0x065a('0x12')](function(){_0x4b9109();});}else{_0x4b9109();}});});}function getTags(_0x45a68f,_0x5b5a31,_0xd302eb,_0x77dcf4,_0x5b3fef,_0x502d4b){return function(_0x15c15b){return new Promise(function(_0x392938,_0x442684){var _0x30212a=[];var _0x26b0fa=_0x77dcf4[_0x065a('0x47')];if(_0x26b0fa&&_0x26b0fa['length']>0x0){_0x30212a=_[_0x065a('0x48')](_0x26b0fa,_0x065a('0x37'));}if(_0x30212a['length']>0x0){return manageTags(_0x45a68f,_0x30212a,_0x5b5a31,_0xd302eb,_0x15c15b,_0x5b3fef,_0x502d4b)[_0x065a('0xa')](function(){_0x392938(_0x15c15b);});}else{_0x392938(_0x15c15b);}});};}function emit(_0xe5a8f5,_0x1d2f83,_0x445acf){var _0xf1e545=_0x065a('0x49')+_0x065a('0x4a')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x065a('0x4b');var _0x2854ee={'uri':_0xe5a8f5+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x445acf+_0xf1e545};io['to'](util[_0x065a('0x4c')](_0x065a('0x4d'),_0x1d2f83))[_0x065a('0x4e')](_0x065a('0x4f'),_0x2854ee);}exports['cs']=function(_0x1c97ff,_0x58ff60,_0x5ba396,_0x557a62,_0x56f096,_0x3abe64,_0x25017e,_0x178e93){var _0x509612={};var _0x194694={'user':_0x3abe64['username'],'pass':_0x3abe64[_0x065a('0x50')]};var _0x78a30d=_0x065a('0x51');var _0x38a7a2='sysparm_display_value=true';_0x3abe64[_0x065a('0x52')]=intUtil[_0x065a('0x53')](_0x3abe64[_0x065a('0x52')]);_0x3abe64[_0x065a('0x54')]=intUtil['stripTrailingSlash'](_0x3abe64['serverUrl']);var _0x378147=util[_0x065a('0x4c')](_0x065a('0x55'),_0x3abe64[_0x065a('0x52')]);_0x509612[_0x065a('0x15')]=!_['isNil'](_0x557a62)?_0x557a62[_0x065a('0x56')]:null;_0x509612[_0x065a('0x1f')]=_0x3abe64[_0x065a('0x56')];_0x509612[_0x065a('0x24')]=_0x178e93[_0x065a('0x2f')]()===_0x065a('0x57')?_0x58ff60[_0x065a('0x58')]:_0x58ff60['calleridnum'];_0x509612[_0x065a('0x59')]=_0x178e93===_0x065a('0x5a')||_0x178e93===_0x065a('0x5b')?_0x065a('0x5a'):_0x065a('0x57');var _0x2cb7fc=util[_0x065a('0x4c')](_0x065a('0x5c'),_0x3abe64[_0x065a('0x54')],_0x58ff60[_0x065a('0x5d')],md5(_0x58ff60[_0x065a('0x5d')]));if(_0x56f096&&_0x56f096[_0x065a('0x5e')]){logger[_0x065a('0xf')](_0x065a('0x5f'),_0x065a('0x60'));_0x58ff60[_0x065a('0x61')]=_0x2cb7fc;}else if(_0x25017e&&_0x25017e[_0x065a('0x62')]&&_0x25017e['recordingFormat']!==_0x065a('0x63')){logger[_0x065a('0xf')](_0x065a('0x64'),_0x065a('0x60'));_0x58ff60['recordingURL']=_0x2cb7fc;}else{_0x58ff60[_0x065a('0x61')]='';}return getAdminUser(_0x178e93,_0x194694,_0x509612,_0x378147,_0x38a7a2,_0x78a30d)[_0x065a('0xa')](getUser(_0x178e93,_0x194694,_0x378147,_0x38a7a2,_0x78a30d))['then'](getEndUser(_0x178e93,_0x194694,_0x378147,_0x38a7a2,_0x78a30d))[_0x065a('0xa')](getTicket(_0x178e93,_0x194694,_0x378147,_0x5ba396,_0x58ff60,_0x38a7a2))[_0x065a('0xa')](function(_0x2b266a){logger['info'](util[_0x065a('0x4c')](_0x065a('0x65'),_0x2b266a['ticketId']));logger[_0x065a('0xf')](util[_0x065a('0x4c')](_0x065a('0x66'),_0x178e93));if(_0x178e93!==_0x065a('0x5b')){logger[_0x065a('0xf')]('['+[_0x178e93['toUpperCase']()]+']',_0x065a('0x67'));emit(_0x3abe64[_0x065a('0x52')],_0x557a62[_0x065a('0x37')],_0x2b266a[_0x065a('0x41')]);}})['catch'](function(_0x5398ad){logger[_0x065a('0x1d')]('['+[_0x178e93['toUpperCase']()]+_0x065a('0x68'),util[_0x065a('0x69')](_0x5398ad,{'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 1ef085c..842e185 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 _0x9e37=['catch','lastevent','toUpperCase','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','getString','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','customField','nameField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Fields','Outbound','The\x20Ticket\x20ID\x20is:','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','monitor_format'];(function(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0x9e37,0x7c));var _0x79e3=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0x9e37[_0x243bba];return _0x12e696;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x79e3('0x0'));var util=require('util');var Redis=require(_0x79e3('0x1'));var intUtil=require('./util');var config=require(_0x79e3('0x2'));var logger=require(_0x79e3('0x3'))(_0x79e3('0x4'));config[_0x79e3('0x5')]=_['defaults'](config[_0x79e3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x79e3('0x6'))(new Redis(config[_0x79e3('0x5')]));var def={'method':_0x79e3('0x7'),'json':!![]};function emit(_0x438b77,_0x4bac80,_0x50e9dc){io['to'](_0x438b77)[_0x79e3('0x8')](_0x4bac80,_0x50e9dc);}function getTicket(_0x44a06e,_0x58d4fb,_0x2287d0,_0x56002d,_0x3138ec,_0x18f706,_0x469c89,_0x389e59){logger[_0x79e3('0x9')](_0x79e3('0xa'));var _0x1e0cbd=new Date();var _0x2c3d51=[{'name':_0x79e3('0xb'),'value':intUtil['getString'](_0x56002d[_0x79e3('0xc')],_0x3138ec,'\x20')},{'name':'assigned_user_id','value':_0x58d4fb['id']},{'name':_0x79e3('0xd'),'value':_0x58d4fb['id']},{'name':_0x79e3('0xe'),'value':intUtil[_0x79e3('0xf')](_0x56002d[_0x79e3('0x10')],_0x3138ec,'\x0a')},{'name':_0x79e3('0x11'),'value':_0x1e0cbd[_0x79e3('0x12')]()[_0x79e3('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x79e3('0x14'),'value':'15'},{'name':_0x79e3('0x15'),'value':_0x2287d0['id']},{'name':'parent_type','value':_0x79e3('0x16')},{'name':_0x79e3('0x17'),'value':_0x2287d0[_0x79e3('0xb')]},{'name':_0x79e3('0x18'),'value':_0x389e59}];if(_0x18f706['length']){_[_0x79e3('0x19')](_0x18f706,function(_0x3dc848){if(_0x3138ec[_0x3dc848[_0x79e3('0x1a')]]){_0x2c3d51[_0x79e3('0x1b')]({'name':_0x3dc848[_0x79e3('0x1c')],'value':_0x3138ec[_0x3dc848[_0x79e3('0x1a')]]});}});}return request({'form':{'method':_0x79e3('0x1d'),'input_type':_0x79e3('0x1e'),'response_type':_0x79e3('0x1e'),'rest_data':JSON[_0x79e3('0x1f')]({'session':_0x469c89['id'],'module_name':'Calls','name_value_list':_0x2c3d51})}});}function getAuth(_0x5c5de7){return util[_0x79e3('0x20')](_0x79e3('0x21'),new Buffer(_0x5c5de7[_0x79e3('0x22')]+':X')[_0x79e3('0x23')](_0x79e3('0x24')));}function getServerInfo(_0x35fcbe){return request({'form':{'method':_0x79e3('0x25'),'input_type':_0x79e3('0x1e'),'response_type':_0x79e3('0x1e'),'rest_data':JSON[_0x79e3('0x1f')]({'session':_0x35fcbe['id']})}});}function getUser(_0x188bc0,_0x1f7b8c,_0x568a83){if(!_[_0x79e3('0x26')](_0x1f7b8c)){logger[_0x79e3('0x9')](_0x79e3('0x27'),_0x1f7b8c);return request({'form':{'method':_0x79e3('0x28'),'input_type':_0x79e3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x79e3('0x1f')]({'session':_0x568a83['id'],'module_name':_0x79e3('0x29'),'query':util['format'](_0x79e3('0x2a'),_0x1f7b8c),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x79e3('0x2b')](function(_0x4a9562){if(_0x4a9562[_0x79e3('0x2c')][_0x79e3('0x2d')]){var _0x1be73f=_[_0x79e3('0x2e')](_0x4a9562[_0x79e3('0x2c')],function(_0x57bddc){return _0x57bddc[_0x79e3('0x2f')][_0x79e3('0x30')][_0x79e3('0x31')]===_0x1f7b8c;});if(_0x1be73f){logger[_0x79e3('0x9')](_0x79e3('0x32'));return BPromise['resolve']({'id':_0x1be73f[_0x79e3('0x2f')]['id'][_0x79e3('0x31')],'name':_0x1be73f[_0x79e3('0x2f')]['name'][_0x79e3('0x31')]});}}logger[_0x79e3('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x79e3('0x33')]({'id':_0x568a83['name_value_list'][_0x79e3('0x34')][_0x79e3('0x31')],'name':_0x568a83[_0x79e3('0x2f')][_0x79e3('0x30')]['value']});});}else{logger[_0x79e3('0x9')](_0x79e3('0x35'));return BPromise[_0x79e3('0x33')]({'id':_0x568a83[_0x79e3('0x2f')][_0x79e3('0x34')][_0x79e3('0x31')],'name':_0x568a83[_0x79e3('0x2f')][_0x79e3('0x30')][_0x79e3('0x31')]});}}function getEndUser(_0x1163ff,_0x434fb8,_0x470538,_0x696e42){logger['info'](_0x79e3('0x36'),_0x470538);return request({'form':{'method':_0x79e3('0x28'),'input_type':_0x79e3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x79e3('0x1f')]({'session':_0x696e42['id'],'module_name':_0x79e3('0x16'),'query':util[_0x79e3('0x20')](_0x79e3('0x37'),_0x470538),'order_by':'','offset':'0','select_fields':['id',_0x79e3('0xb'),_0x79e3('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x307620){if(_0x307620[_0x79e3('0x2c')][_0x79e3('0x2d')]){var _0x6301bd=_['find'](_0x307620[_0x79e3('0x2c')],function(_0xff76cb){return _0xff76cb[_0x79e3('0x2f')]['phone_home'][_0x79e3('0x31')]===_0x470538;});if(_0x6301bd){logger[_0x79e3('0x9')](_0x79e3('0x39'));return BPromise[_0x79e3('0x33')]({'id':_0x6301bd['name_value_list']['id'][_0x79e3('0x31')],'name':_0x6301bd[_0x79e3('0x2f')][_0x79e3('0xb')]['value'],'phone':_0x6301bd[_0x79e3('0x2f')][_0x79e3('0x38')][_0x79e3('0x31')]});}}else{logger[_0x79e3('0x9')](_0x79e3('0x3a'));return request({'form':{'method':_0x79e3('0x1d'),'input_type':_0x79e3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x79e3('0x1f')]({'session':_0x696e42['id'],'module_name':_0x79e3('0x16'),'name_value_list':[{'name':_0x79e3('0x3b'),'value':_0x434fb8!==_0x79e3('0x3c')?_0x434fb8:util[_0x79e3('0x20')](_0x79e3('0x3d'),_0x470538)},{'name':_0x79e3('0x38'),'value':_0x470538}]})}})[_0x79e3('0x2b')](function(_0x46f75e){logger[_0x79e3('0x9')](_0x79e3('0x3e'));return BPromise[_0x79e3('0x33')]({'id':_0x46f75e['id'],'name':_0x46f75e['entry_list'][_0x79e3('0x3b')]['value'],'phone':_0x46f75e[_0x79e3('0x2c')][_0x79e3('0x38')][_0x79e3('0x31')]});});}});}function request(_0x36ebf6){logger[_0x79e3('0x3f')](_0x79e3('0x40'),JSON['stringify'](_0x36ebf6));return rp(_['merge'](def,_0x36ebf6));}function getTags(_0x28847e,_0x5338a4){var _0x20bd30=[];if(_0x28847e&&_0x28847e[_0x79e3('0x2d')]>0x0){_0x20bd30=_[_0x79e3('0x41')](_0x28847e,_0x5338a4);}return _0x20bd30;}function getCustomFields(_0x5107e8,_0x5e1bc9){var _0x46f4a7=[];var _0xecd053={'custom_fields':[]};if(_0x5107e8['length']>0x0){_[_0x79e3('0x19')](_0x5107e8,function(_0x16e9e8){if(_0x16e9e8[_0x79e3('0x42')]===_0x79e3('0x43')&&_0x16e9e8['nameField']&&!_0x16e9e8[_0x79e3('0x44')]){_0xecd053[_0x16e9e8[_0x79e3('0x45')][_0x79e3('0x46')]()]=_0x16e9e8[_0x79e3('0x47')][_0x79e3('0x23')]();}else if(_0x16e9e8[_0x79e3('0x42')]===_0x79e3('0x43')&&_0x16e9e8[_0x79e3('0x1c')]&&_0x16e9e8[_0x79e3('0x44')]){_0xecd053[_0x79e3('0x48')][_0x79e3('0x1b')]({'id':_0x16e9e8[_0x79e3('0x1c')],'value':_0x16e9e8[_0x79e3('0x47')][_0x79e3('0x23')]()});}else if(_0x16e9e8[_0x79e3('0x42')]===_0x79e3('0x49')&&_0x16e9e8[_0x79e3('0x1a')]&&_0x16e9e8[_0x79e3('0x1c')]&&_0x16e9e8[_0x79e3('0x44')]){_0x5e1bc9[_0x16e9e8[_0x79e3('0x1a')]]&&_0xecd053[_0x79e3('0x48')][_0x79e3('0x1b')]({'id':_0x16e9e8['idField'],'value':_0x5e1bc9[_0x16e9e8[_0x79e3('0x1a')]][_0x79e3('0x23')]()});}else if(_0x16e9e8[_0x79e3('0x42')]===_0x79e3('0x4a')&&_0x16e9e8[_0x79e3('0x4b')]&&_0x16e9e8[_0x79e3('0x4b')]['name']&&_0x16e9e8[_0x79e3('0x1c')]&&_0x16e9e8[_0x79e3('0x44')]){_0x5e1bc9[_0x16e9e8[_0x79e3('0x4b')]['name'][_0x79e3('0x46')]()]&&_0xecd053[_0x79e3('0x48')]['push']({'id':_0x16e9e8[_0x79e3('0x1c')],'value':_0x5e1bc9[_0x16e9e8['Variable'][_0x79e3('0xb')][_0x79e3('0x46')]()]['toString']()});}});}return _0xecd053;}function getConnection(_0x3d222d){return request({'method':_0x79e3('0x7'),'form':{'method':_0x79e3('0x4c'),'input_type':_0x79e3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x79e3('0x1f')]({'user_auth':{'user_name':_0x3d222d[_0x79e3('0x4d')],'password':_0x3d222d[_0x79e3('0x4e')],'encryption':_0x79e3('0x4f')},'application':_0x79e3('0x50')})}})['then'](function(_0x4f17f1){var _0x3e422a=_0x4f17f1;if(_0x3e422a['id']){def[_0x79e3('0x51')]=_0x3e422a['id'];return BPromise[_0x79e3('0x33')](_0x3e422a);}else{throw new Error(util[_0x79e3('0x20')](_0x79e3('0x52'),_0x3d222d['id']));}});}function setRelationship(_0x2a6614,_0x4a4e94,_0x35cc03,_0x1be055){return request({'form':{'method':'set_relationship','input_type':_0x79e3('0x1e'),'response_type':_0x79e3('0x1e'),'rest_data':JSON['stringify']({'session':_0x2a6614['id'],'module_name':_0x79e3('0x53'),'module_id':_0x35cc03['id'],'link_field_name':_0x1be055,'related_ids':[_0x4a4e94['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x79e3('0x54')]=function(_0x29fb6f,_0x10ac83,_0x23bd41,_0x15305e,_0x504fed,_0x2c6c16){var _0x249786,_0x5e7b4f,_0x522bdd,_0x16cc78;_0x2c6c16[_0x79e3('0x55')]=intUtil[_0x79e3('0x56')](_0x2c6c16[_0x79e3('0x55')]);_0x2c6c16[_0x79e3('0x57')]=intUtil[_0x79e3('0x56')](_0x2c6c16[_0x79e3('0x57')]);def[_0x79e3('0x58')]=util['format'](_0x79e3('0x59'),_0x2c6c16[_0x79e3('0x55')]);if(_0x504fed&&_0x504fed['monitor_format']){logger['info'](_0x79e3('0x5a'),_0x79e3('0x5b'));_0x10ac83[_0x79e3('0x5c')]=util['format'](_0x79e3('0x5d'),_0x2c6c16['serverUrl'],_0x10ac83[_0x79e3('0x5e')],md5(_0x10ac83['uniqueid']));}else{_0x10ac83[_0x79e3('0x5c')]='';}return getConnection(_0x2c6c16)[_0x79e3('0x2b')](function(_0x54a96f){_0x16cc78=_0x54a96f;return getUser(_0x2c6c16,_0x15305e['name'],_0x16cc78);})[_0x79e3('0x2b')](function(_0x3fe81a){_0x249786=_0x3fe81a;logger[_0x79e3('0x9')](_0x79e3('0x5f'),_0x249786['id']);return getEndUser(_0x2c6c16,_0x10ac83[_0x79e3('0x60')],_0x10ac83[_0x79e3('0x61')],_0x16cc78);})[_0x79e3('0x2b')](function(_0x50ec0a){_0x5e7b4f=_0x50ec0a;logger[_0x79e3('0x9')](_0x79e3('0x62'),_0x5e7b4f['id']);return getTicket(_0x2c6c16,_0x249786,_0x5e7b4f,_0x23bd41,_0x10ac83,_0x23bd41['Fields'],_0x16cc78,'Inbound');})[_0x79e3('0x2b')](function(_0x49dcf6){_0x522bdd=_0x49dcf6;logger['info'](_0x79e3('0x63'));logger[_0x79e3('0x9')]('The\x20Ticket\x20ID\x20is:',_0x522bdd['id']);return setRelationship(_0x16cc78,_0x249786,_0x522bdd,'users');})[_0x79e3('0x2b')](function(){return setRelationship(_0x16cc78,_0x5e7b4f,_0x522bdd,_0x79e3('0x64'));})['then'](function(){return getServerInfo(_0x16cc78);})[_0x79e3('0x2b')](function(_0x28310d){var _0x7e1d99=parseInt(_0x28310d[_0x79e3('0x65')][_0x79e3('0x66')](0x0));var _0x5f2520=util[_0x79e3('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2c6c16[_0x79e3('0x55')],_0x522bdd['id']);if(_0x7e1d99>0x6){_0x5f2520=util[_0x79e3('0x20')](_0x79e3('0x67'),_0x2c6c16[_0x79e3('0x55')],_0x522bdd['id']);}logger[_0x79e3('0x9')](_0x79e3('0x5a'),_0x79e3('0x68'));emit(util[_0x79e3('0x20')](_0x79e3('0x69'),_0x15305e[_0x79e3('0xb')]),'trigger:browser:url',{'uri':_0x5f2520});})['catch'](function(_0x2dd976){logger[_0x79e3('0x6a')](_0x79e3('0x5a'),JSON['stringify'](_0x2dd976));});};exports[_0x79e3('0x6b')]=function(_0x269a44,_0x1e0e42,_0x38c912,_0x35b3e5,_0x5d0bff,_0x50d534,_0x3e24ff){var _0x2538c5,_0xb52c0c,_0x59d199,_0x32a69f;_0x50d534[_0x79e3('0x55')]=intUtil['stripTrailingSlash'](_0x50d534[_0x79e3('0x55')]);_0x50d534[_0x79e3('0x57')]=intUtil[_0x79e3('0x56')](_0x50d534['serverUrl']);def[_0x79e3('0x58')]=util[_0x79e3('0x20')](_0x79e3('0x59'),_0x50d534['remoteUri']);if(_0x3e24ff&&_0x3e24ff['recordingFormat']&&_0x3e24ff[_0x79e3('0x6c')]!=='none'){logger['info'](_0x79e3('0x6d'),_0x79e3('0x5b'));_0x1e0e42[_0x79e3('0x5c')]=util[_0x79e3('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50d534[_0x79e3('0x57')],_0x1e0e42[_0x79e3('0x5e')],md5(_0x1e0e42[_0x79e3('0x5e')]));}return getConnection(_0x50d534)[_0x79e3('0x2b')](function(_0x3af399){_0x32a69f=_0x3af399;return getUser(_0x50d534,_0x35b3e5[_0x79e3('0xb')],_0x32a69f);})[_0x79e3('0x2b')](function(_0x5ee1d5){_0x2538c5=_0x5ee1d5;logger[_0x79e3('0x9')](_0x79e3('0x5f'),_0x2538c5['id']);return getEndUser(_0x50d534,_0x1e0e42[_0x79e3('0x6e')],_0x1e0e42['destcalleridnum'],_0x32a69f);})[_0x79e3('0x2b')](function(_0x4be988){_0xb52c0c=_0x4be988;logger['info'](_0x79e3('0x62'),_0xb52c0c['id']);return getTicket(_0x50d534,_0x2538c5,_0xb52c0c,_0x38c912,_0x1e0e42,_0x38c912[_0x79e3('0x6f')],_0x32a69f,_0x79e3('0x70'));})[_0x79e3('0x2b')](function(_0x40d74e){_0x59d199=_0x40d74e;logger[_0x79e3('0x9')](_0x79e3('0x63'));logger['info'](_0x79e3('0x71'),_0x59d199['id']);return setRelationship(_0x32a69f,_0x2538c5,_0x59d199,_0x79e3('0x72'));})['then'](function(){return setRelationship(_0x32a69f,_0xb52c0c,_0x59d199,_0x79e3('0x64'));})[_0x79e3('0x2b')](function(){return getServerInfo(_0x32a69f);})[_0x79e3('0x2b')](function(_0x18226b){var _0x5f2f1a=parseInt(_0x18226b[_0x79e3('0x65')][_0x79e3('0x66')](0x0));var _0x524462=util[_0x79e3('0x20')](_0x79e3('0x73'),_0x50d534[_0x79e3('0x55')],_0x59d199['id']);if(_0x5f2f1a>0x6){_0x524462=util[_0x79e3('0x20')](_0x79e3('0x67'),_0x50d534[_0x79e3('0x55')],_0x59d199['id']);}logger[_0x79e3('0x9')](_0x79e3('0x6d'),_0x79e3('0x68'));emit(util['format'](_0x79e3('0x69'),_0x35b3e5['name']),_0x79e3('0x74'),{'uri':_0x524462});})['catch'](function(_0x5a9a9a){logger['error'](_0x79e3('0x6d'),JSON[_0x79e3('0x1f')](_0x5a9a9a));});};exports['unmanaged']=function(_0x31fe87,_0x63cb8,_0x5c2b65,_0x39dcb9,_0x1332be,_0x27d86c){var _0x52670c,_0x17cfc4,_0x359f5f,_0x55e7fa;_0x27d86c[_0x79e3('0x55')]=intUtil[_0x79e3('0x56')](_0x27d86c['remoteUri']);_0x27d86c[_0x79e3('0x57')]=intUtil[_0x79e3('0x56')](_0x27d86c[_0x79e3('0x57')]);def['uri']=util[_0x79e3('0x20')](_0x79e3('0x59'),_0x27d86c[_0x79e3('0x55')]);if(_0x1332be&&_0x1332be[_0x79e3('0x75')]){logger['info']('['+_0x63cb8['lastevent']['toUpperCase']()+']',_0x79e3('0x5b'));_0x63cb8[_0x79e3('0x5c')]=util['format'](_0x79e3('0x5d'),_0x27d86c[_0x79e3('0x57')],_0x63cb8[_0x79e3('0x5e')],md5(_0x63cb8['uniqueid']));}else{_0x63cb8[_0x79e3('0x5c')]='';}return getConnection(_0x27d86c)[_0x79e3('0x2b')](function(_0x298589){_0x55e7fa=_0x298589;if(!_['isNil'](_0x39dcb9)){return getUser(_0x27d86c,_0x39dcb9[_0x79e3('0xb')],_0x55e7fa);}else{return getUser(_0x27d86c,null,_0x55e7fa);}})['then'](function(_0x6515eb){_0x52670c=_0x6515eb;logger[_0x79e3('0x9')]('The\x20User\x20ID\x20is:',_0x52670c['id']);return getEndUser(_0x27d86c,_0x63cb8[_0x79e3('0x60')],_0x63cb8[_0x79e3('0x61')],_0x55e7fa);})['then'](function(_0x44fe30){_0x17cfc4=_0x44fe30;logger[_0x79e3('0x9')]('The\x20Enduser\x20ID\x20is:',_0x17cfc4['id']);return getTicket(_0x27d86c,_0x52670c,_0x17cfc4,_0x5c2b65,_0x63cb8,_0x5c2b65['Fields'],_0x55e7fa,'Inbound');})['then'](function(_0x106927){_0x359f5f=_0x106927;logger[_0x79e3('0x9')](_0x79e3('0x63'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x359f5f['id']);return setRelationship(_0x55e7fa,_0x52670c,_0x359f5f,_0x79e3('0x72'));})[_0x79e3('0x2b')](function(){return setRelationship(_0x55e7fa,_0x17cfc4,_0x359f5f,_0x79e3('0x64'));})['then'](function(){return getServerInfo(_0x55e7fa);})[_0x79e3('0x76')](function(_0x446a73){logger[_0x79e3('0x6a')]('['+_0x63cb8[_0x79e3('0x77')][_0x79e3('0x78')]()+']',JSON[_0x79e3('0x1f')](_0x446a73));});}; \ No newline at end of file +var _0xf9ab=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','customField','custom_fields','content','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','contacts','user:%s','trigger:browser:url','monitor_format','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','Inbound','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','date_start','toISOString','slice','replace','duration_minutes','parent_id','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf9ab,0x12c));var _0xbf9a=function(_0x589e86,_0x59f058){_0x589e86=_0x589e86-0x0;var _0x10b364=_0xf9ab[_0x589e86];return _0x10b364;};'use strict';var _=require(_0xbf9a('0x0'));var rp=require(_0xbf9a('0x1'));var BPromise=require(_0xbf9a('0x2'));var md5=require(_0xbf9a('0x3'));var util=require('util');var Redis=require(_0xbf9a('0x4'));var intUtil=require(_0xbf9a('0x5'));var config=require(_0xbf9a('0x6'));var logger=require('../../../../config/logger')(_0xbf9a('0x7'));config[_0xbf9a('0x8')]=_[_0xbf9a('0x9')](config[_0xbf9a('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xbf9a('0xa'))(new Redis(config[_0xbf9a('0x8')]));var def={'method':_0xbf9a('0xb'),'json':!![]};function emit(_0xd0d9df,_0x5b8dd0,_0x2cdc66){io['to'](_0xd0d9df)[_0xbf9a('0xc')](_0x5b8dd0,_0x2cdc66);}function getTicket(_0x540695,_0x288506,_0x4a062f,_0x261b5f,_0x34d6db,_0x2a5c81,_0x238427,_0x3dc856){logger[_0xbf9a('0xd')](_0xbf9a('0xe'));var _0x20df9d=new Date();var _0x3df902=[{'name':_0xbf9a('0xf'),'value':intUtil['getString'](_0x261b5f[_0xbf9a('0x10')],_0x34d6db,'\x20')},{'name':_0xbf9a('0x11'),'value':_0x288506['id']},{'name':'created_by','value':_0x288506['id']},{'name':_0xbf9a('0x12'),'value':intUtil[_0xbf9a('0x13')](_0x261b5f['Descriptions'],_0x34d6db,'\x0a')},{'name':_0xbf9a('0x14'),'value':_0x20df9d[_0xbf9a('0x15')]()[_0xbf9a('0x16')](0x0,0x13)[_0xbf9a('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xbf9a('0x18'),'value':'15'},{'name':_0xbf9a('0x19'),'value':_0x4a062f['id']},{'name':'parent_type','value':_0xbf9a('0x1a')},{'name':_0xbf9a('0x1b'),'value':_0x4a062f[_0xbf9a('0xf')]},{'name':'direction','value':_0x3dc856}];if(_0x2a5c81[_0xbf9a('0x1c')]){_[_0xbf9a('0x1d')](_0x2a5c81,function(_0x27f024){if(_0x34d6db[_0x27f024[_0xbf9a('0x1e')]]){_0x3df902[_0xbf9a('0x1f')]({'name':_0x27f024[_0xbf9a('0x20')],'value':_0x34d6db[_0x27f024[_0xbf9a('0x1e')]]});}});}return request({'form':{'method':_0xbf9a('0x21'),'input_type':_0xbf9a('0x22'),'response_type':'JSON','rest_data':JSON[_0xbf9a('0x23')]({'session':_0x238427['id'],'module_name':_0xbf9a('0x24'),'name_value_list':_0x3df902})}});}function getAuth(_0x44dbc7){return util[_0xbf9a('0x25')](_0xbf9a('0x26'),new Buffer(_0x44dbc7[_0xbf9a('0x27')]+':X')[_0xbf9a('0x28')](_0xbf9a('0x29')));}function getServerInfo(_0x4bcb59){return request({'form':{'method':_0xbf9a('0x2a'),'input_type':_0xbf9a('0x22'),'response_type':_0xbf9a('0x22'),'rest_data':JSON['stringify']({'session':_0x4bcb59['id']})}});}function getUser(_0x27af73,_0x2d3a1d,_0x16622e){if(!_[_0xbf9a('0x2b')](_0x2d3a1d)){logger[_0xbf9a('0xd')](_0xbf9a('0x2c'),_0x2d3a1d);return request({'form':{'method':_0xbf9a('0x2d'),'input_type':_0xbf9a('0x22'),'response_type':'JSON','rest_data':JSON[_0xbf9a('0x23')]({'session':_0x16622e['id'],'module_name':_0xbf9a('0x2e'),'query':util[_0xbf9a('0x25')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2d3a1d),'order_by':'','offset':'0','select_fields':['id',_0xbf9a('0xf'),_0xbf9a('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf9a('0x30')](function(_0x4e0a89){if(_0x4e0a89['entry_list'][_0xbf9a('0x1c')]){var _0x2a24f6=_[_0xbf9a('0x31')](_0x4e0a89[_0xbf9a('0x32')],function(_0x572533){return _0x572533[_0xbf9a('0x33')]['user_name'][_0xbf9a('0x34')]===_0x2d3a1d;});if(_0x2a24f6){logger[_0xbf9a('0xd')]('Agent\x20found!');return BPromise[_0xbf9a('0x35')]({'id':_0x2a24f6[_0xbf9a('0x33')]['id'][_0xbf9a('0x34')],'name':_0x2a24f6[_0xbf9a('0x33')][_0xbf9a('0xf')][_0xbf9a('0x34')]});}}logger[_0xbf9a('0xd')](_0xbf9a('0x36'));return BPromise[_0xbf9a('0x35')]({'id':_0x16622e['name_value_list'][_0xbf9a('0x37')][_0xbf9a('0x34')],'name':_0x16622e[_0xbf9a('0x33')][_0xbf9a('0x2f')][_0xbf9a('0x34')]});});}else{logger['info'](_0xbf9a('0x38'));return BPromise[_0xbf9a('0x35')]({'id':_0x16622e['name_value_list'][_0xbf9a('0x37')][_0xbf9a('0x34')],'name':_0x16622e['name_value_list'][_0xbf9a('0x2f')][_0xbf9a('0x34')]});}}function getEndUser(_0x12731d,_0x5ec788,_0x3b951e,_0x120ae8){logger[_0xbf9a('0xd')]('Searching\x20enduser\x20with\x20phone',_0x3b951e);return request({'form':{'method':'get_entry_list','input_type':_0xbf9a('0x22'),'response_type':'JSON','rest_data':JSON[_0xbf9a('0x23')]({'session':_0x120ae8['id'],'module_name':_0xbf9a('0x1a'),'query':util[_0xbf9a('0x25')](_0xbf9a('0x39'),_0x3b951e),'order_by':'','offset':'0','select_fields':['id',_0xbf9a('0xf'),_0xbf9a('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf9a('0x30')](function(_0x8a10d5){if(_0x8a10d5['entry_list'][_0xbf9a('0x1c')]){var _0x2009f9=_['find'](_0x8a10d5[_0xbf9a('0x32')],function(_0x52c04e){return _0x52c04e[_0xbf9a('0x33')]['phone_home'][_0xbf9a('0x34')]===_0x3b951e;});if(_0x2009f9){logger[_0xbf9a('0xd')](_0xbf9a('0x3b'));return BPromise[_0xbf9a('0x35')]({'id':_0x2009f9['name_value_list']['id'][_0xbf9a('0x34')],'name':_0x2009f9[_0xbf9a('0x33')][_0xbf9a('0xf')]['value'],'phone':_0x2009f9[_0xbf9a('0x33')][_0xbf9a('0x3a')][_0xbf9a('0x34')]});}}else{logger[_0xbf9a('0xd')](_0xbf9a('0x3c'));return request({'form':{'method':'set_entry','input_type':_0xbf9a('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x120ae8['id'],'module_name':_0xbf9a('0x1a'),'name_value_list':[{'name':'first_name','value':_0x5ec788!==_0xbf9a('0x3d')?_0x5ec788:util['format'](_0xbf9a('0x3e'),_0x3b951e)},{'name':_0xbf9a('0x3a'),'value':_0x3b951e}]})}})[_0xbf9a('0x30')](function(_0x5f1ef3){logger[_0xbf9a('0xd')]('Enduser\x20created.');return BPromise[_0xbf9a('0x35')]({'id':_0x5f1ef3['id'],'name':_0x5f1ef3['entry_list']['first_name'][_0xbf9a('0x34')],'phone':_0x5f1ef3[_0xbf9a('0x32')]['phone_home']['value']});});}});}function request(_0x2fe60e){logger[_0xbf9a('0x3f')](_0xbf9a('0x40'),JSON[_0xbf9a('0x23')](_0x2fe60e));return rp(_[_0xbf9a('0x41')](def,_0x2fe60e));}function getTags(_0x3b5556,_0x3cce98){var _0x200676=[];if(_0x3b5556&&_0x3b5556[_0xbf9a('0x1c')]>0x0){_0x200676=_[_0xbf9a('0x42')](_0x3b5556,_0x3cce98);}return _0x200676;}function getCustomFields(_0x32aeb3,_0x5e9982){var _0x5eb861=[];var _0x127f8b={'custom_fields':[]};if(_0x32aeb3['length']>0x0){_[_0xbf9a('0x1d')](_0x32aeb3,function(_0x329202){if(_0x329202[_0xbf9a('0x43')]===_0xbf9a('0x44')&&_0x329202[_0xbf9a('0x45')]&&!_0x329202[_0xbf9a('0x46')]){_0x127f8b[_0x329202[_0xbf9a('0x45')]['toLowerCase']()]=_0x329202['content'][_0xbf9a('0x28')]();}else if(_0x329202[_0xbf9a('0x43')]===_0xbf9a('0x44')&&_0x329202[_0xbf9a('0x20')]&&_0x329202[_0xbf9a('0x46')]){_0x127f8b[_0xbf9a('0x47')][_0xbf9a('0x1f')]({'id':_0x329202[_0xbf9a('0x20')],'value':_0x329202[_0xbf9a('0x48')][_0xbf9a('0x28')]()});}else if(_0x329202[_0xbf9a('0x43')]==='variable'&&_0x329202[_0xbf9a('0x1e')]&&_0x329202[_0xbf9a('0x20')]&&_0x329202['customField']){_0x5e9982[_0x329202['variableName']]&&_0x127f8b[_0xbf9a('0x47')]['push']({'id':_0x329202['idField'],'value':_0x5e9982[_0x329202['variableName']][_0xbf9a('0x28')]()});}else if(_0x329202[_0xbf9a('0x43')]===_0xbf9a('0x49')&&_0x329202[_0xbf9a('0x4a')]&&_0x329202[_0xbf9a('0x4a')][_0xbf9a('0xf')]&&_0x329202[_0xbf9a('0x20')]&&_0x329202['customField']){_0x5e9982[_0x329202[_0xbf9a('0x4a')]['name'][_0xbf9a('0x4b')]()]&&_0x127f8b[_0xbf9a('0x47')][_0xbf9a('0x1f')]({'id':_0x329202['idField'],'value':_0x5e9982[_0x329202[_0xbf9a('0x4a')][_0xbf9a('0xf')][_0xbf9a('0x4b')]()][_0xbf9a('0x28')]()});}});}return _0x127f8b;}function getConnection(_0x223a6b){return request({'method':_0xbf9a('0xb'),'form':{'method':_0xbf9a('0x4c'),'input_type':_0xbf9a('0x22'),'response_type':_0xbf9a('0x22'),'rest_data':JSON[_0xbf9a('0x23')]({'user_auth':{'user_name':_0x223a6b[_0xbf9a('0x4d')],'password':_0x223a6b[_0xbf9a('0x4e')],'encryption':_0xbf9a('0x4f')},'application':_0xbf9a('0x50')})}})[_0xbf9a('0x30')](function(_0x2d9751){var _0x4156aa=_0x2d9751;if(_0x4156aa['id']){def['sessionID']=_0x4156aa['id'];return BPromise[_0xbf9a('0x35')](_0x4156aa);}else{throw new Error(util['format'](_0xbf9a('0x51'),_0x223a6b['id']));}});}function setRelationship(_0x42ccba,_0x51a6f8,_0x5857be,_0x52e38f){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xbf9a('0x23')]({'session':_0x42ccba['id'],'module_name':_0xbf9a('0x24'),'module_id':_0x5857be['id'],'link_field_name':_0x52e38f,'related_ids':[_0x51a6f8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbf9a('0x52')]=function(_0x51e174,_0x412d7c,_0x78af9a,_0x48effc,_0x5105d5,_0x5e66f5){var _0x4ef55f,_0x2db825,_0x885aee,_0x2884b9;_0x5e66f5['remoteUri']=intUtil[_0xbf9a('0x53')](_0x5e66f5[_0xbf9a('0x54')]);_0x5e66f5[_0xbf9a('0x55')]=intUtil[_0xbf9a('0x53')](_0x5e66f5[_0xbf9a('0x55')]);def[_0xbf9a('0x56')]=util[_0xbf9a('0x25')](_0xbf9a('0x57'),_0x5e66f5[_0xbf9a('0x54')]);if(_0x5105d5&&_0x5105d5['monitor_format']){logger[_0xbf9a('0xd')](_0xbf9a('0x58'),_0xbf9a('0x59'));_0x412d7c[_0xbf9a('0x5a')]=util['format'](_0xbf9a('0x5b'),_0x5e66f5[_0xbf9a('0x55')],_0x412d7c[_0xbf9a('0x5c')],md5(_0x412d7c[_0xbf9a('0x5c')]));}else{_0x412d7c[_0xbf9a('0x5a')]='';}return getConnection(_0x5e66f5)['then'](function(_0x3b461d){_0x2884b9=_0x3b461d;return getUser(_0x5e66f5,_0x48effc['name'],_0x2884b9);})[_0xbf9a('0x30')](function(_0x4823c7){_0x4ef55f=_0x4823c7;logger[_0xbf9a('0xd')](_0xbf9a('0x5d'),_0x4ef55f['id']);return getEndUser(_0x5e66f5,_0x412d7c[_0xbf9a('0x5e')],_0x412d7c[_0xbf9a('0x5f')],_0x2884b9);})['then'](function(_0x45ff95){_0x2db825=_0x45ff95;logger[_0xbf9a('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2db825['id']);return getTicket(_0x5e66f5,_0x4ef55f,_0x2db825,_0x78af9a,_0x412d7c,_0x78af9a[_0xbf9a('0x60')],_0x2884b9,'Inbound');})['then'](function(_0x148773){_0x885aee=_0x148773;logger[_0xbf9a('0xd')](_0xbf9a('0x61'));logger['info'](_0xbf9a('0x62'),_0x885aee['id']);return setRelationship(_0x2884b9,_0x4ef55f,_0x885aee,_0xbf9a('0x63'));})[_0xbf9a('0x30')](function(){return setRelationship(_0x2884b9,_0x2db825,_0x885aee,'contacts');})[_0xbf9a('0x30')](function(){return getServerInfo(_0x2884b9);})[_0xbf9a('0x30')](function(_0x5771cb){var _0x372d7a=parseInt(_0x5771cb[_0xbf9a('0x64')][_0xbf9a('0x65')](0x0));var _0x1d0d48=util[_0xbf9a('0x25')](_0xbf9a('0x66'),_0x5e66f5[_0xbf9a('0x54')],_0x885aee['id']);if(_0x372d7a>0x6){_0x1d0d48=util[_0xbf9a('0x25')](_0xbf9a('0x67'),_0x5e66f5['remoteUri'],_0x885aee['id']);}logger[_0xbf9a('0xd')](_0xbf9a('0x58'),_0xbf9a('0x68'));emit(util[_0xbf9a('0x25')]('user:%s',_0x48effc[_0xbf9a('0xf')]),'trigger:browser:url',{'uri':_0x1d0d48});})[_0xbf9a('0x69')](function(_0x49d8e8){logger[_0xbf9a('0x6a')]('[QUEUE]',JSON[_0xbf9a('0x23')](_0x49d8e8));});};exports['outbound']=function(_0x17003e,_0x79fa77,_0x487fc0,_0x5aca70,_0x49e26b,_0x2ea315,_0xd82029){var _0x85719f,_0x287d21,_0x47a10e,_0x2dfc3e;_0x2ea315[_0xbf9a('0x54')]=intUtil[_0xbf9a('0x53')](_0x2ea315[_0xbf9a('0x54')]);_0x2ea315[_0xbf9a('0x55')]=intUtil[_0xbf9a('0x53')](_0x2ea315[_0xbf9a('0x55')]);def['uri']=util['format'](_0xbf9a('0x57'),_0x2ea315[_0xbf9a('0x54')]);if(_0xd82029&&_0xd82029['recordingFormat']&&_0xd82029['recordingFormat']!==_0xbf9a('0x6b')){logger['info'](_0xbf9a('0x6c'),_0xbf9a('0x59'));_0x79fa77['recordingURL']=util['format'](_0xbf9a('0x5b'),_0x2ea315[_0xbf9a('0x55')],_0x79fa77[_0xbf9a('0x5c')],md5(_0x79fa77[_0xbf9a('0x5c')]));}return getConnection(_0x2ea315)[_0xbf9a('0x30')](function(_0x336798){_0x2dfc3e=_0x336798;return getUser(_0x2ea315,_0x5aca70[_0xbf9a('0xf')],_0x2dfc3e);})['then'](function(_0x240204){_0x85719f=_0x240204;logger[_0xbf9a('0xd')](_0xbf9a('0x5d'),_0x85719f['id']);return getEndUser(_0x2ea315,_0x79fa77[_0xbf9a('0x6d')],_0x79fa77[_0xbf9a('0x6e')],_0x2dfc3e);})[_0xbf9a('0x30')](function(_0x4490e2){_0x287d21=_0x4490e2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x287d21['id']);return getTicket(_0x2ea315,_0x85719f,_0x287d21,_0x487fc0,_0x79fa77,_0x487fc0[_0xbf9a('0x60')],_0x2dfc3e,_0xbf9a('0x6f'));})[_0xbf9a('0x30')](function(_0x2a7976){_0x47a10e=_0x2a7976;logger[_0xbf9a('0xd')](_0xbf9a('0x61'));logger['info'](_0xbf9a('0x62'),_0x47a10e['id']);return setRelationship(_0x2dfc3e,_0x85719f,_0x47a10e,_0xbf9a('0x63'));})['then'](function(){return setRelationship(_0x2dfc3e,_0x287d21,_0x47a10e,_0xbf9a('0x70'));})[_0xbf9a('0x30')](function(){return getServerInfo(_0x2dfc3e);})[_0xbf9a('0x30')](function(_0x329582){var _0x176d82=parseInt(_0x329582['version'][_0xbf9a('0x65')](0x0));var _0x1e6e38=util[_0xbf9a('0x25')](_0xbf9a('0x66'),_0x2ea315['remoteUri'],_0x47a10e['id']);if(_0x176d82>0x6){_0x1e6e38=util[_0xbf9a('0x25')](_0xbf9a('0x67'),_0x2ea315[_0xbf9a('0x54')],_0x47a10e['id']);}logger[_0xbf9a('0xd')](_0xbf9a('0x6c'),_0xbf9a('0x68'));emit(util[_0xbf9a('0x25')](_0xbf9a('0x71'),_0x5aca70['name']),_0xbf9a('0x72'),{'uri':_0x1e6e38});})[_0xbf9a('0x69')](function(_0x5e63bb){logger[_0xbf9a('0x6a')](_0xbf9a('0x6c'),JSON['stringify'](_0x5e63bb));});};exports['unmanaged']=function(_0x33f3c1,_0x539572,_0x2b31f5,_0x2570d7,_0x17705b,_0x548542){var _0x8b2c4,_0x25ff08,_0x4caaa3,_0x4aabc3;_0x548542[_0xbf9a('0x54')]=intUtil[_0xbf9a('0x53')](_0x548542[_0xbf9a('0x54')]);_0x548542['serverUrl']=intUtil[_0xbf9a('0x53')](_0x548542[_0xbf9a('0x55')]);def[_0xbf9a('0x56')]=util[_0xbf9a('0x25')](_0xbf9a('0x57'),_0x548542['remoteUri']);if(_0x17705b&&_0x17705b[_0xbf9a('0x73')]){logger['info']('['+_0x539572[_0xbf9a('0x74')][_0xbf9a('0x75')]()+']',_0xbf9a('0x59'));_0x539572[_0xbf9a('0x5a')]=util[_0xbf9a('0x25')](_0xbf9a('0x5b'),_0x548542[_0xbf9a('0x55')],_0x539572[_0xbf9a('0x5c')],md5(_0x539572[_0xbf9a('0x5c')]));}else{_0x539572['recordingURL']='';}return getConnection(_0x548542)['then'](function(_0x39d0de){_0x4aabc3=_0x39d0de;if(!_[_0xbf9a('0x2b')](_0x2570d7)){return getUser(_0x548542,_0x2570d7[_0xbf9a('0xf')],_0x4aabc3);}else{return getUser(_0x548542,null,_0x4aabc3);}})[_0xbf9a('0x30')](function(_0x28103f){_0x8b2c4=_0x28103f;logger['info'](_0xbf9a('0x5d'),_0x8b2c4['id']);return getEndUser(_0x548542,_0x539572[_0xbf9a('0x5e')],_0x539572[_0xbf9a('0x5f')],_0x4aabc3);})['then'](function(_0x98db3e){_0x25ff08=_0x98db3e;logger[_0xbf9a('0xd')](_0xbf9a('0x76'),_0x25ff08['id']);return getTicket(_0x548542,_0x8b2c4,_0x25ff08,_0x2b31f5,_0x539572,_0x2b31f5[_0xbf9a('0x60')],_0x4aabc3,_0xbf9a('0x77'));})[_0xbf9a('0x30')](function(_0x4eef84){_0x4caaa3=_0x4eef84;logger[_0xbf9a('0xd')](_0xbf9a('0x61'));logger[_0xbf9a('0xd')](_0xbf9a('0x62'),_0x4caaa3['id']);return setRelationship(_0x4aabc3,_0x8b2c4,_0x4caaa3,_0xbf9a('0x63'));})[_0xbf9a('0x30')](function(){return setRelationship(_0x4aabc3,_0x25ff08,_0x4caaa3,_0xbf9a('0x70'));})[_0xbf9a('0x30')](function(){return getServerInfo(_0x4aabc3);})[_0xbf9a('0x69')](function(_0x2344d3){logger['error']('['+_0x539572[_0xbf9a('0x74')][_0xbf9a('0x75')]()+']',JSON['stringify'](_0x2344d3));});}; \ 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 715c876..74a19c6 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 _0xb68d=['Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable'];(function(_0x4b2256,_0x5a9835){var _0x31a63d=function(_0x2d0bdc){while(--_0x2d0bdc){_0x4b2256['push'](_0x4b2256['shift']());}};_0x31a63d(++_0x5a9835);}(_0xb68d,0x160));var _0xdb68=function(_0x112c3b,_0x30c0bc){_0x112c3b=_0x112c3b-0x0;var _0x47f747=_0xb68d[_0x112c3b];return _0x47f747;};'use strict';var _=require(_0xdb68('0x0'));var util=require(_0xdb68('0x1'));exports['getString']=function(_0x37bd64,_0x9cd16d,_0xf76ca6){var _0x221dd0=[];if(_0x37bd64[_0xdb68('0x2')]>0x0){var _0x319bfb=_[_0xdb68('0x3')](_0x37bd64,['id']);for(var _0x25eb73=0x0;_0x25eb73<_0x319bfb[_0xdb68('0x2')];_0x25eb73++){var _0x390ea3=_0x319bfb[_0x25eb73];if(_0x390ea3['type']===_0xdb68('0x4')){_0x221dd0[_0xdb68('0x5')](_0x390ea3[_0xdb68('0x6')]);}else if(_0x390ea3[_0xdb68('0x7')]===_0xdb68('0x8')&&_0x390ea3[_0xdb68('0x9')]){_0x9cd16d[_0x390ea3[_0xdb68('0x9')]]&&_0x221dd0[_0xdb68('0x5')](_0x9cd16d[_0x390ea3['variableName']][_0xdb68('0xa')]());}else if(_0x390ea3[_0xdb68('0x7')]===_0xdb68('0xb')&&_0x390ea3[_0xdb68('0xc')]&&_0x390ea3[_0xdb68('0xc')][_0xdb68('0xd')]){_0x9cd16d[_0x390ea3[_0xdb68('0xc')][_0xdb68('0xd')][_0xdb68('0xe')]()]&&_0x221dd0[_0xdb68('0x5')](_0x9cd16d[_0x390ea3[_0xdb68('0xc')][_0xdb68('0xd')][_0xdb68('0xe')]()][_0xdb68('0xa')]());}else if(_0x390ea3[_0xdb68('0x7')]===_0xdb68('0xf')){if(_0x390ea3[_0xdb68('0x10')]===_0xdb68('0x4')&&_0x390ea3[_0xdb68('0x11')]){_0x221dd0['push'](util[_0xdb68('0x12')](_0xdb68('0x13'),_0x390ea3[_0xdb68('0x11')],_0x390ea3[_0xdb68('0x14')]));}else if(_0x390ea3[_0xdb68('0x10')]===_0xdb68('0x8')&&_0x390ea3[_0xdb68('0x9')]&&_0x390ea3[_0xdb68('0x11')]){_0x9cd16d[_0x390ea3[_0xdb68('0x9')]]&&_0x221dd0[_0xdb68('0x5')](util[_0xdb68('0x12')](_0xdb68('0x13'),_0x390ea3[_0xdb68('0x11')],_0x9cd16d[_0x390ea3[_0xdb68('0x9')]]));}else if(_0x390ea3[_0xdb68('0x10')]===_0xdb68('0xb')&&_0x390ea3['Variable']&&_0x390ea3['Variable'][_0xdb68('0xd')]&&_0x390ea3[_0xdb68('0x11')]){_0x9cd16d[_0x390ea3[_0xdb68('0xc')]['name']['toLowerCase']()]&&_0x221dd0[_0xdb68('0x5')](util[_0xdb68('0x12')](_0xdb68('0x13'),_0x390ea3[_0xdb68('0x11')],_0x9cd16d[_0x390ea3[_0xdb68('0xc')]['name']['toLowerCase']()]));}}}}return _0x221dd0['join'](_0xf76ca6);};exports['stripTrailingSlash']=function(_0x111545){var _0x53418e=_0x111545[_0xdb68('0x15')](-0x1);if(_0x53418e==='/'){_0x111545=_0x111545[_0xdb68('0x16')](0x0,_0x111545[_0xdb68('0x17')](_0x53418e));}return _0x111545;};exports[_0xdb68('0x18')]=function(_0x5879a6){if(!_[_0xdb68('0x19')](_0x5879a6)&&_0x5879a6!==''){var _0xf1d04b=/^(([^<>()\[\]\\.,;:\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 _0xf1d04b['test'](String(_0x5879a6)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x26f5=['length','string','content','variable','variableName','push','customVariable','Variable','name','toLowerCase','toString','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lodash','getString'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x26f5,0x1a0));var _0x526f=function(_0xb77207,_0x377c84){_0xb77207=_0xb77207-0x0;var _0x4b80ad=_0x26f5[_0xb77207];return _0x4b80ad;};'use strict';var _=require(_0x526f('0x0'));var util=require('util');exports[_0x526f('0x1')]=function(_0x5260b8,_0x47d307,_0x44ad5d){var _0x7967b5=[];if(_0x5260b8[_0x526f('0x2')]>0x0){var _0x134421=_['sortBy'](_0x5260b8,['id']);for(var _0x3aa4d2=0x0;_0x3aa4d2<_0x134421[_0x526f('0x2')];_0x3aa4d2++){var _0x429d31=_0x134421[_0x3aa4d2];if(_0x429d31['type']===_0x526f('0x3')){_0x7967b5['push'](_0x429d31[_0x526f('0x4')]);}else if(_0x429d31['type']===_0x526f('0x5')&&_0x429d31[_0x526f('0x6')]){_0x47d307[_0x429d31[_0x526f('0x6')]]&&_0x7967b5[_0x526f('0x7')](_0x47d307[_0x429d31[_0x526f('0x6')]]['toString']());}else if(_0x429d31['type']===_0x526f('0x8')&&_0x429d31[_0x526f('0x9')]&&_0x429d31[_0x526f('0x9')][_0x526f('0xa')]){_0x47d307[_0x429d31['Variable'][_0x526f('0xa')][_0x526f('0xb')]()]&&_0x7967b5['push'](_0x47d307[_0x429d31[_0x526f('0x9')][_0x526f('0xa')][_0x526f('0xb')]()][_0x526f('0xc')]());}else if(_0x429d31['type']==='keyValue'){if(_0x429d31[_0x526f('0xd')]===_0x526f('0x3')&&_0x429d31[_0x526f('0xe')]){_0x7967b5[_0x526f('0x7')](util[_0x526f('0xf')](_0x526f('0x10'),_0x429d31['key'],_0x429d31[_0x526f('0x11')]));}else if(_0x429d31[_0x526f('0xd')]===_0x526f('0x5')&&_0x429d31[_0x526f('0x6')]&&_0x429d31[_0x526f('0xe')]){_0x47d307[_0x429d31['variableName']]&&_0x7967b5[_0x526f('0x7')](util[_0x526f('0xf')](_0x526f('0x10'),_0x429d31[_0x526f('0xe')],_0x47d307[_0x429d31['variableName']]));}else if(_0x429d31[_0x526f('0xd')]==='customVariable'&&_0x429d31['Variable']&&_0x429d31['Variable']['name']&&_0x429d31[_0x526f('0xe')]){_0x47d307[_0x429d31[_0x526f('0x9')][_0x526f('0xa')][_0x526f('0xb')]()]&&_0x7967b5[_0x526f('0x7')](util[_0x526f('0xf')](_0x526f('0x10'),_0x429d31['key'],_0x47d307[_0x429d31['Variable'][_0x526f('0xa')][_0x526f('0xb')]()]));}}}}return _0x7967b5[_0x526f('0x12')](_0x44ad5d);};exports[_0x526f('0x13')]=function(_0x1cd48d){var _0x36a9f8=_0x1cd48d[_0x526f('0x14')](-0x1);if(_0x36a9f8==='/'){_0x1cd48d=_0x1cd48d[_0x526f('0x15')](0x0,_0x1cd48d['lastIndexOf'](_0x36a9f8));}return _0x1cd48d;};exports['validateEmail']=function(_0x551a39){if(!_['isNil'](_0x551a39)&&_0x551a39!==''){var _0x351e28=/^(([^<>()\[\]\\.,;:\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 _0x351e28['test'](String(_0x551a39)['toLowerCase']());}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 6ea6b61..23e221e 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 480faa6..d9e98bf 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 _0x5dcb=['catch','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','stringify','GET','length','map','forEach','includes','type','nameField','customField','toLowerCase','content','idField','variable','variableName','custom_fields','Variable','push','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','email'];(function(_0x7f3cde,_0x110d5e){var _0x35ec22=function(_0xd495b){while(--_0xd495b){_0x7f3cde['push'](_0x7f3cde['shift']());}};_0x35ec22(++_0x110d5e);}(_0x5dcb,0x1c2));var _0xb5dc=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x5dcb[_0x547ff4];return _0xe41057;};'use strict';var _=require(_0xb5dc('0x0'));var rp=require(_0xb5dc('0x1'));var md5=require(_0xb5dc('0x2'));var util=require(_0xb5dc('0x3'));var Redis=require(_0xb5dc('0x4'));var intUtil=require(_0xb5dc('0x5'));var config=require(_0xb5dc('0x6'));var logger=require(_0xb5dc('0x7'))(_0xb5dc('0x8'));config[_0xb5dc('0x9')]=_[_0xb5dc('0xa')](config[_0xb5dc('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb5dc('0xb'))(new Redis(config[_0xb5dc('0x9')]));function emit(_0x2f615f,_0x1a02cf,_0x2c7c63){io['to'](_0x2f615f)[_0xb5dc('0xc')](_0x1a02cf,_0x2c7c63);}var headers={'Content-Type':_0xb5dc('0xd'),'Accept':_0xb5dc('0xd')};function getTicket(_0x283228,_0x2a5684,_0x2d61c9,_0x5becb0,_0x2c0f4a){logger['info'](_0xb5dc('0xe'));return request({'uri':util['format'](_0xb5dc('0xf'),_0x283228[_0xb5dc('0x10')]),'method':_0xb5dc('0x11'),'body':{'ticket':_[_0xb5dc('0x12')]({'requester_id':_0x2d61c9['id'],'submitter_id':_0x2a5684?_0x2a5684['id']:undefined,'assignee_id':_0x2a5684?_0x2a5684['id']:undefined,'tags':getTags(_0x5becb0[_0xb5dc('0x13')],_0xb5dc('0x14')),'subject':intUtil[_0xb5dc('0x15')](_0x5becb0[_0xb5dc('0x16')],_0x2c0f4a,'\x20'),'description':intUtil[_0xb5dc('0x15')](_0x5becb0[_0xb5dc('0x17')],_0x2c0f4a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb5dc('0x15')](_0x5becb0[_0xb5dc('0x17')],_0x2c0f4a,'\x0a')}},getCustomFields(_0x5becb0[_0xb5dc('0x18')],_0x2c0f4a))}})[_0xb5dc('0x19')](function(_0x210cf9){logger[_0xb5dc('0x1a')](_0xb5dc('0x1b'));return _0x210cf9[_0xb5dc('0x1c')];});}function getUser(_0x3f95be,_0x5a7dde){if(intUtil['validateEmail'](_0x5a7dde)){logger[_0xb5dc('0x1a')](_0xb5dc('0x1d'),_0x5a7dde);return request({'uri':util[_0xb5dc('0x1e')](_0xb5dc('0x1f'),_0x3f95be[_0xb5dc('0x10')]),'qs':{'query':util[_0xb5dc('0x1e')](_0xb5dc('0x20'),_0x5a7dde)}})[_0xb5dc('0x19')](function(_0x2cf446){if(_0x2cf446[_0xb5dc('0x21')]){logger[_0xb5dc('0x1a')]('Agent\x20found!');return _[_0xb5dc('0x22')](_0x2cf446[_0xb5dc('0x23')],{'email':_0x5a7dde,'role':_0xb5dc('0x24')});}else{logger[_0xb5dc('0x1a')](_0xb5dc('0x25'));return request({'uri':util[_0xb5dc('0x1e')](_0xb5dc('0x26'),_0x3f95be[_0xb5dc('0x10')])})['then'](function(_0x2ec73b){logger[_0xb5dc('0x1a')](_0xb5dc('0x27'));return _0x2ec73b[_0xb5dc('0x28')];});}});}else{logger[_0xb5dc('0x1a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb5dc('0x1e')](_0xb5dc('0x26'),_0x3f95be[_0xb5dc('0x10')])})[_0xb5dc('0x19')](function(_0x1dc199){logger[_0xb5dc('0x1a')]('Admin\x20account\x20selected.');return _0x1dc199['user'];});}}function getEndUser(_0x5b755a,_0x437ef4,_0x359fd7){logger['info']('Searching\x20enduser\x20with\x20phone',_0x359fd7);return request({'uri':util[_0xb5dc('0x1e')]('%s/search.json',_0x5b755a[_0xb5dc('0x10')]),'qs':{'query':util[_0xb5dc('0x1e')]('type:user\x20role:end-user\x20phone:%s',_0x359fd7)}})['then'](function(_0x1f4c99){var _0x2f03c1;if(_0x1f4c99[_0xb5dc('0x23')]['length']){_0x1f4c99[_0xb5dc('0x23')]=_[_0xb5dc('0x29')](_0x1f4c99[_0xb5dc('0x23')],{'suspended':![],'role':_0xb5dc('0x2a')});if(_0x1f4c99['results']['length']){_0x2f03c1=_[_0xb5dc('0x2b')](_0x1f4c99[_0xb5dc('0x23')]);}}if(_0x2f03c1){logger[_0xb5dc('0x1a')](_0xb5dc('0x2c'));return _0x2f03c1;}else{logger[_0xb5dc('0x1a')](_0xb5dc('0x2d'));return request({'uri':util[_0xb5dc('0x1e')](_0xb5dc('0x2e'),_0x5b755a['remoteUri']),'method':_0xb5dc('0x11'),'body':{'user':{'role':_0xb5dc('0x2a'),'name':util[_0xb5dc('0x1e')](_0xb5dc('0x2f'),_0x437ef4||_0x359fd7),'phone':_0x359fd7}}})['then'](function(_0x1b9213){logger['info'](_0xb5dc('0x30'));return _0x1b9213[_0xb5dc('0x28')];});}});}function getAuth(_0x3301b9){var _0x1992c0;if(_0x3301b9[_0xb5dc('0x31')]===_0xb5dc('0x32')){_0x1992c0=util[_0xb5dc('0x1e')](_0xb5dc('0x33'),_0x3301b9['username'],_0x3301b9[_0xb5dc('0x32')]);}else if(_0x3301b9[_0xb5dc('0x31')]===_0xb5dc('0x34')){_0x1992c0=util[_0xb5dc('0x1e')](_0xb5dc('0x35'),_0x3301b9[_0xb5dc('0x36')],_0x3301b9[_0xb5dc('0x34')]);}return util[_0xb5dc('0x1e')](_0xb5dc('0x37'),new Buffer(_0x1992c0)[_0xb5dc('0x38')](_0xb5dc('0x39')));}function request(_0x3b09a4){logger[_0xb5dc('0x3a')]('[HTTP]',JSON[_0xb5dc('0x3b')](_0x3b09a4));return rp(_['defaults'](_0x3b09a4,{'method':_0xb5dc('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x4fd2dc,_0x34df5a){var _0x11eaa7=[];if(_0x4fd2dc&&_0x4fd2dc[_0xb5dc('0x3d')]>0x0){_0x11eaa7=_[_0xb5dc('0x3e')](_0x4fd2dc,_0x34df5a);}return _0x11eaa7;}function getCustomFields(_0x488d70,_0x2dcfb8){var _0xbcea5f=[];var _0x4ba085={'custom_fields':[]};if(_0x488d70['length']>0x0){_[_0xb5dc('0x3f')](_0x488d70,function(_0x589463){if(_[_0xb5dc('0x40')](['string','picklist'],_0x589463[_0xb5dc('0x41')])&&_0x589463[_0xb5dc('0x42')]&&!_0x589463[_0xb5dc('0x43')]){_0x4ba085[_0x589463[_0xb5dc('0x42')][_0xb5dc('0x44')]()]=_0x589463[_0xb5dc('0x45')]['toString']();}else if(_['includes'](['string','picklist'],_0x589463[_0xb5dc('0x41')])&&_0x589463[_0xb5dc('0x46')]&&_0x589463[_0xb5dc('0x43')]){_0x4ba085['custom_fields']['push']({'id':_0x589463['idField'],'value':_0x589463[_0xb5dc('0x45')][_0xb5dc('0x38')]()});}else if(_0x589463[_0xb5dc('0x41')]===_0xb5dc('0x47')&&_0x589463[_0xb5dc('0x48')]&&_0x589463[_0xb5dc('0x46')]&&_0x589463['customField']){_0x2dcfb8[_0x589463['variableName']]&&_0x4ba085[_0xb5dc('0x49')]['push']({'id':_0x589463[_0xb5dc('0x46')],'value':_0x2dcfb8[_0x589463[_0xb5dc('0x48')]]['toString']()});}else if(_0x589463[_0xb5dc('0x41')]==='customVariable'&&_0x589463[_0xb5dc('0x4a')]&&_0x589463[_0xb5dc('0x4a')][_0xb5dc('0x14')]&&_0x589463[_0xb5dc('0x46')]&&_0x589463['customField']){_0x2dcfb8[_0x589463[_0xb5dc('0x4a')][_0xb5dc('0x14')][_0xb5dc('0x44')]()]&&_0x4ba085[_0xb5dc('0x49')][_0xb5dc('0x4b')]({'id':_0x589463[_0xb5dc('0x46')],'value':_0x2dcfb8[_0x589463['Variable'][_0xb5dc('0x14')][_0xb5dc('0x44')]()]['toString']()});}});}return _0x4ba085;}exports[_0xb5dc('0x4c')]=function(_0x1af868,_0x5083b5,_0xd87773,_0x3b7ac2,_0x336f3a,_0x4192cf){var _0x2d931a,_0x4d46aa;_0x4192cf[_0xb5dc('0x10')]=intUtil['stripTrailingSlash'](_0x4192cf[_0xb5dc('0x10')]);_0x4192cf[_0xb5dc('0x4d')]=intUtil['stripTrailingSlash'](_0x4192cf['serverUrl']);if(_0x336f3a&&_0x336f3a[_0xb5dc('0x4e')]){logger[_0xb5dc('0x1a')]('[QUEUE]',_0xb5dc('0x4f'));_0x5083b5[_0xb5dc('0x50')]=util['format'](_0xb5dc('0x51'),_0x4192cf[_0xb5dc('0x4d')],_0x5083b5[_0xb5dc('0x52')],md5(_0x5083b5[_0xb5dc('0x52')]));}else{_0x5083b5['recordingURL']='';}headers[_0xb5dc('0x53')]=getAuth(_0x4192cf);return getUser(_0x4192cf,_0x3b7ac2['email'])[_0xb5dc('0x19')](function(_0x13cf2f){_0x2d931a=_0x13cf2f;logger['info']('The\x20User\x20ID\x20is:',_0x2d931a['id']);return getEndUser(_0x4192cf,_0x5083b5[_0xb5dc('0x54')],_0x5083b5[_0xb5dc('0x55')]);})[_0xb5dc('0x19')](function(_0x847ac7){_0x4d46aa=_0x847ac7;logger[_0xb5dc('0x1a')](_0xb5dc('0x56'),_0x4d46aa['id']);return getTicket(_0x4192cf,_0x2d931a,_0x4d46aa,_0xd87773,_0x5083b5);})[_0xb5dc('0x19')](function(_0x5879d9){if(_0x5879d9){logger[_0xb5dc('0x1a')](_0xb5dc('0x57'),_0x5879d9['id']);switch(_0x4192cf[_0xb5dc('0x41')]){case _0xb5dc('0x58'):logger[_0xb5dc('0x1a')](_0xb5dc('0x59'),_0xb5dc('0x5a'));return request({'uri':util[_0xb5dc('0x1e')](_0xb5dc('0x5b'),_0x4192cf[_0xb5dc('0x10')],_0x2d931a['id'],_0x5879d9['id']),'method':_0xb5dc('0x11')});case'newTab':logger[_0xb5dc('0x1a')](_0xb5dc('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb5dc('0x1e')](_0xb5dc('0x5c'),_0x3b7ac2[_0xb5dc('0x14')]),'trigger:browser:url',{'uri':util['format'](_0xb5dc('0x5d'),_0x4192cf[_0xb5dc('0x10')][_0xb5dc('0x5e')](_0xb5dc('0x5f'),''),_0x5879d9['id'])});break;default:logger[_0xb5dc('0x60')](_0xb5dc('0x59'),_0xb5dc('0x61'));}}})['catch'](function(_0x99a81b){logger[_0xb5dc('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb5dc('0x62')](_0x99a81b,{'showHidden':!![],'depth':null}));});};exports[_0xb5dc('0x63')]=function(_0x16171b,_0x578f74,_0x527d69,_0x211cd1,_0x1455a7,_0x3f8bdd,_0x174a77){var _0x394486,_0x2e44e2;_0x3f8bdd[_0xb5dc('0x10')]=intUtil[_0xb5dc('0x64')](_0x3f8bdd[_0xb5dc('0x10')]);_0x3f8bdd[_0xb5dc('0x4d')]=intUtil[_0xb5dc('0x64')](_0x3f8bdd[_0xb5dc('0x4d')]);if(_0x174a77&&_0x174a77['recordingFormat']&&_0x174a77[_0xb5dc('0x65')]!==_0xb5dc('0x66')){logger[_0xb5dc('0x1a')](_0xb5dc('0x67'),_0xb5dc('0x4f'));_0x578f74[_0xb5dc('0x50')]=util['format'](_0xb5dc('0x51'),_0x3f8bdd['serverUrl'],_0x578f74[_0xb5dc('0x52')],md5(_0x578f74[_0xb5dc('0x52')]));}headers[_0xb5dc('0x53')]=getAuth(_0x3f8bdd);return getUser(_0x3f8bdd,_0x211cd1[_0xb5dc('0x68')])[_0xb5dc('0x19')](function(_0x2cb2fc){_0x394486=_0x2cb2fc;logger['info']('The\x20User\x20ID\x20is:',_0x394486['id']);return getEndUser(_0x3f8bdd,_0x578f74['destcalleridname'],_0x578f74['destcalleridnum']);})[_0xb5dc('0x19')](function(_0x372893){_0x2e44e2=_0x372893;logger[_0xb5dc('0x1a')](_0xb5dc('0x56'),_0x2e44e2['id']);return getTicket(_0x3f8bdd,_0x394486,_0x2e44e2,_0x527d69,_0x578f74);})['then'](function(_0x41d3e5){if(_0x41d3e5){logger['info']('The\x20Ticket\x20ID\x20is:',_0x41d3e5['id']);switch(_0x3f8bdd['type']){case _0xb5dc('0x58'):logger[_0xb5dc('0x1a')](_0xb5dc('0x67'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xb5dc('0x5b'),_0x3f8bdd[_0xb5dc('0x10')],_0x394486['id'],_0x41d3e5['id']),'method':'POST'});case'newTab':logger['info'](_0xb5dc('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb5dc('0x1e')](_0xb5dc('0x5c'),_0x211cd1[_0xb5dc('0x14')]),'trigger:browser:url',{'uri':util['format'](_0xb5dc('0x5d'),_0x3f8bdd[_0xb5dc('0x10')][_0xb5dc('0x5e')](_0xb5dc('0x5f'),''),_0x41d3e5['id'])});break;default:logger[_0xb5dc('0x60')]('[OUTBOUND]',_0xb5dc('0x61'));}}})[_0xb5dc('0x69')](function(_0x22e9e1){logger[_0xb5dc('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb5dc('0x62')](_0x22e9e1,{'showHidden':!![],'depth':null}));});};exports[_0xb5dc('0x6a')]=function(_0x4f959f,_0x2f4297,_0x742bf5,_0x58cf38,_0x3e3440,_0x5507b6){var _0x2e07ce,_0x4eced8;_0x5507b6[_0xb5dc('0x10')]=intUtil[_0xb5dc('0x64')](_0x5507b6[_0xb5dc('0x10')]);_0x5507b6[_0xb5dc('0x4d')]=intUtil['stripTrailingSlash'](_0x5507b6['serverUrl']);if(_0x3e3440&&_0x3e3440['monitor_format']){logger[_0xb5dc('0x1a')]('['+_0x2f4297[_0xb5dc('0x6b')][_0xb5dc('0x6c')]()+']',_0xb5dc('0x4f'));_0x2f4297['recordingURL']=util[_0xb5dc('0x1e')](_0xb5dc('0x51'),_0x5507b6[_0xb5dc('0x4d')],_0x2f4297[_0xb5dc('0x52')],md5(_0x2f4297['uniqueid']));}else{_0x2f4297[_0xb5dc('0x50')]='';}headers[_0xb5dc('0x53')]=getAuth(_0x5507b6);return getUser(_0x5507b6)[_0xb5dc('0x19')](function(_0x5a9962){_0x2e07ce=_0x5a9962;logger['info'](_0xb5dc('0x6d'),_0x2e07ce['id']);return getEndUser(_0x5507b6,_0x2f4297['calleridname'],_0x2f4297[_0xb5dc('0x55')]);})['then'](function(_0x457184){_0x4eced8=_0x457184;logger[_0xb5dc('0x1a')](_0xb5dc('0x56'),_0x4eced8['id']);return getTicket(_0x5507b6,_0x2e07ce,_0x4eced8,_0x742bf5,_0x2f4297);})[_0xb5dc('0x19')](function(_0x3e553a){if(_0x3e553a){logger[_0xb5dc('0x1a')](_0xb5dc('0x57'),_0x3e553a['id']);}})[_0xb5dc('0x69')](function(_0x1b1485){logger[_0xb5dc('0x60')]('['+_0x2f4297[_0xb5dc('0x6b')][_0xb5dc('0x6c')]()+']'+_0xb5dc('0x6e'),util[_0xb5dc('0x62')](_0x1b1485,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb3df=['customField','custom_fields','push','content','variableName','idField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','format','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','map','forEach','includes','string','picklist','type'];(function(_0x45c62a,_0x3a9be8){var _0x2f11cd=function(_0x14b14b){while(--_0x14b14b){_0x45c62a['push'](_0x45c62a['shift']());}};_0x2f11cd(++_0x3a9be8);}(_0xb3df,0x18c));var _0xfb3d=function(_0x18e540,_0x34c916){_0x18e540=_0x18e540-0x0;var _0x205baa=_0xb3df[_0x18e540];return _0x205baa;};'use strict';var _=require(_0xfb3d('0x0'));var rp=require(_0xfb3d('0x1'));var md5=require('md5');var util=require(_0xfb3d('0x2'));var Redis=require(_0xfb3d('0x3'));var intUtil=require(_0xfb3d('0x4'));var config=require(_0xfb3d('0x5'));var logger=require(_0xfb3d('0x6'))(_0xfb3d('0x7'));config[_0xfb3d('0x8')]=_[_0xfb3d('0x9')](config['redis'],{'host':_0xfb3d('0xa'),'port':0x18eb});var io=require(_0xfb3d('0xb'))(new Redis(config[_0xfb3d('0x8')]));function emit(_0xb1721d,_0x457814,_0xa5524c){io['to'](_0xb1721d)[_0xfb3d('0xc')](_0x457814,_0xa5524c);}var headers={'Content-Type':_0xfb3d('0xd'),'Accept':_0xfb3d('0xd')};function getTicket(_0x3c6e86,_0x4d190e,_0x3725bd,_0x2ddd58,_0x524576){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0xf'),_0x3c6e86['remoteUri']),'method':_0xfb3d('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x3725bd['id'],'submitter_id':_0x4d190e?_0x4d190e['id']:undefined,'assignee_id':_0x4d190e?_0x4d190e['id']:undefined,'tags':getTags(_0x2ddd58[_0xfb3d('0x11')],_0xfb3d('0x12')),'subject':intUtil[_0xfb3d('0x13')](_0x2ddd58[_0xfb3d('0x14')],_0x524576,'\x20'),'description':intUtil[_0xfb3d('0x13')](_0x2ddd58['Descriptions'],_0x524576,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2ddd58[_0xfb3d('0x15')],_0x524576,'\x0a')}},getCustomFields(_0x2ddd58['Fields'],_0x524576))}})[_0xfb3d('0x16')](function(_0x11364d){logger['info'](_0xfb3d('0x17'));return _0x11364d[_0xfb3d('0x18')];});}function getUser(_0x5c24f0,_0x4fabb4){if(intUtil[_0xfb3d('0x19')](_0x4fabb4)){logger[_0xfb3d('0x1a')](_0xfb3d('0x1b'),_0x4fabb4);return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0x1c'),_0x5c24f0['remoteUri']),'qs':{'query':util[_0xfb3d('0xe')](_0xfb3d('0x1d'),_0x4fabb4)}})[_0xfb3d('0x16')](function(_0x3c649c){if(_0x3c649c[_0xfb3d('0x1e')]){logger[_0xfb3d('0x1a')]('Agent\x20found!');return _['find'](_0x3c649c[_0xfb3d('0x1f')],{'email':_0x4fabb4,'role':_0xfb3d('0x20')});}else{logger[_0xfb3d('0x1a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0x21'),_0x5c24f0[_0xfb3d('0x22')])})[_0xfb3d('0x16')](function(_0x362968){logger[_0xfb3d('0x1a')](_0xfb3d('0x23'));return _0x362968[_0xfb3d('0x24')];});}});}else{logger[_0xfb3d('0x1a')](_0xfb3d('0x25'));return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0x21'),_0x5c24f0[_0xfb3d('0x22')])})[_0xfb3d('0x16')](function(_0x167abf){logger[_0xfb3d('0x1a')](_0xfb3d('0x23'));return _0x167abf[_0xfb3d('0x24')];});}}function getEndUser(_0x2a2388,_0xd4c442,_0x2deaec){logger[_0xfb3d('0x1a')]('Searching\x20enduser\x20with\x20phone',_0x2deaec);return request({'uri':util['format'](_0xfb3d('0x1c'),_0x2a2388[_0xfb3d('0x22')]),'qs':{'query':util['format'](_0xfb3d('0x26'),_0x2deaec)}})[_0xfb3d('0x16')](function(_0x3becfc){var _0x23646d;if(_0x3becfc['results'][_0xfb3d('0x27')]){_0x3becfc[_0xfb3d('0x1f')]=_[_0xfb3d('0x28')](_0x3becfc[_0xfb3d('0x1f')],{'suspended':![],'role':_0xfb3d('0x29')});if(_0x3becfc['results'][_0xfb3d('0x27')]){_0x23646d=_[_0xfb3d('0x2a')](_0x3becfc[_0xfb3d('0x1f')]);}}if(_0x23646d){logger[_0xfb3d('0x1a')](_0xfb3d('0x2b'));return _0x23646d;}else{logger[_0xfb3d('0x1a')](_0xfb3d('0x2c'));return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0x2d'),_0x2a2388['remoteUri']),'method':_0xfb3d('0x10'),'body':{'user':{'role':_0xfb3d('0x29'),'name':util['format'](_0xfb3d('0x2e'),_0xd4c442||_0x2deaec),'phone':_0x2deaec}}})[_0xfb3d('0x16')](function(_0x17ea2c){logger[_0xfb3d('0x1a')](_0xfb3d('0x2f'));return _0x17ea2c[_0xfb3d('0x24')];});}});}function getAuth(_0x41cd16){var _0xe2f291;if(_0x41cd16[_0xfb3d('0x30')]===_0xfb3d('0x31')){_0xe2f291=util[_0xfb3d('0xe')](_0xfb3d('0x32'),_0x41cd16[_0xfb3d('0x33')],_0x41cd16[_0xfb3d('0x31')]);}else if(_0x41cd16[_0xfb3d('0x30')]===_0xfb3d('0x34')){_0xe2f291=util[_0xfb3d('0xe')](_0xfb3d('0x35'),_0x41cd16[_0xfb3d('0x33')],_0x41cd16[_0xfb3d('0x34')]);}return util[_0xfb3d('0xe')](_0xfb3d('0x36'),new Buffer(_0xe2f291)[_0xfb3d('0x37')](_0xfb3d('0x38')));}function request(_0x809922){logger['debug'](_0xfb3d('0x39'),JSON['stringify'](_0x809922));return rp(_['defaults'](_0x809922,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x23f910,_0x499b3b){var _0x5452b7=[];if(_0x23f910&&_0x23f910[_0xfb3d('0x27')]>0x0){_0x5452b7=_[_0xfb3d('0x3a')](_0x23f910,_0x499b3b);}return _0x5452b7;}function getCustomFields(_0x3cb758,_0x4e99c3){var _0x2a6119=[];var _0x388277={'custom_fields':[]};if(_0x3cb758[_0xfb3d('0x27')]>0x0){_[_0xfb3d('0x3b')](_0x3cb758,function(_0x59f054){if(_[_0xfb3d('0x3c')]([_0xfb3d('0x3d'),_0xfb3d('0x3e')],_0x59f054[_0xfb3d('0x3f')])&&_0x59f054['nameField']&&!_0x59f054[_0xfb3d('0x40')]){_0x388277[_0x59f054['nameField']['toLowerCase']()]=_0x59f054['content'][_0xfb3d('0x37')]();}else if(_[_0xfb3d('0x3c')]([_0xfb3d('0x3d'),_0xfb3d('0x3e')],_0x59f054[_0xfb3d('0x3f')])&&_0x59f054['idField']&&_0x59f054['customField']){_0x388277[_0xfb3d('0x41')][_0xfb3d('0x42')]({'id':_0x59f054['idField'],'value':_0x59f054[_0xfb3d('0x43')][_0xfb3d('0x37')]()});}else if(_0x59f054[_0xfb3d('0x3f')]==='variable'&&_0x59f054[_0xfb3d('0x44')]&&_0x59f054[_0xfb3d('0x45')]&&_0x59f054[_0xfb3d('0x40')]){_0x4e99c3[_0x59f054['variableName']]&&_0x388277[_0xfb3d('0x41')]['push']({'id':_0x59f054[_0xfb3d('0x45')],'value':_0x4e99c3[_0x59f054['variableName']]['toString']()});}else if(_0x59f054['type']===_0xfb3d('0x46')&&_0x59f054[_0xfb3d('0x47')]&&_0x59f054[_0xfb3d('0x47')]['name']&&_0x59f054[_0xfb3d('0x45')]&&_0x59f054['customField']){_0x4e99c3[_0x59f054['Variable'][_0xfb3d('0x12')]['toLowerCase']()]&&_0x388277['custom_fields'][_0xfb3d('0x42')]({'id':_0x59f054['idField'],'value':_0x4e99c3[_0x59f054[_0xfb3d('0x47')]['name'][_0xfb3d('0x48')]()][_0xfb3d('0x37')]()});}});}return _0x388277;}exports[_0xfb3d('0x49')]=function(_0x2c434f,_0x8ff9d6,_0x2d0360,_0x40036a,_0x167975,_0x1f0766){var _0x2f4f5d,_0x4887ff;_0x1f0766['remoteUri']=intUtil[_0xfb3d('0x4a')](_0x1f0766[_0xfb3d('0x22')]);_0x1f0766[_0xfb3d('0x4b')]=intUtil['stripTrailingSlash'](_0x1f0766['serverUrl']);if(_0x167975&&_0x167975[_0xfb3d('0x4c')]){logger['info'](_0xfb3d('0x4d'),'Recording\x20is\x20enabled!');_0x8ff9d6[_0xfb3d('0x4e')]=util[_0xfb3d('0xe')](_0xfb3d('0x4f'),_0x1f0766['serverUrl'],_0x8ff9d6[_0xfb3d('0x50')],md5(_0x8ff9d6[_0xfb3d('0x50')]));}else{_0x8ff9d6[_0xfb3d('0x4e')]='';}headers[_0xfb3d('0x51')]=getAuth(_0x1f0766);return getUser(_0x1f0766,_0x40036a['email'])['then'](function(_0x35c717){_0x2f4f5d=_0x35c717;logger['info'](_0xfb3d('0x52'),_0x2f4f5d['id']);return getEndUser(_0x1f0766,_0x8ff9d6[_0xfb3d('0x53')],_0x8ff9d6[_0xfb3d('0x54')]);})['then'](function(_0x4bc69d){_0x4887ff=_0x4bc69d;logger['info'](_0xfb3d('0x55'),_0x4887ff['id']);return getTicket(_0x1f0766,_0x2f4f5d,_0x4887ff,_0x2d0360,_0x8ff9d6);})[_0xfb3d('0x16')](function(_0x2b6cb3){if(_0x2b6cb3){logger[_0xfb3d('0x1a')](_0xfb3d('0x56'),_0x2b6cb3['id']);switch(_0x1f0766[_0xfb3d('0x3f')]){case'integrationTab':logger[_0xfb3d('0x1a')](_0xfb3d('0x4d'),_0xfb3d('0x57'));return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0x58'),_0x1f0766[_0xfb3d('0x22')],_0x2f4f5d['id'],_0x2b6cb3['id']),'method':_0xfb3d('0x10')});case _0xfb3d('0x59'):logger[_0xfb3d('0x1a')]('[QUEUE]',_0xfb3d('0x5a'));emit(util[_0xfb3d('0xe')](_0xfb3d('0x5b'),_0x40036a[_0xfb3d('0x12')]),_0xfb3d('0x5c'),{'uri':util['format'](_0xfb3d('0x5d'),_0x1f0766[_0xfb3d('0x22')][_0xfb3d('0x5e')](_0xfb3d('0x5f'),''),_0x2b6cb3['id'])});break;default:logger[_0xfb3d('0x60')](_0xfb3d('0x4d'),_0xfb3d('0x61'));}}})[_0xfb3d('0x62')](function(_0x26ae75){logger['error'](_0xfb3d('0x63'),util['inspect'](_0x26ae75,{'showHidden':!![],'depth':null}));});};exports[_0xfb3d('0x64')]=function(_0x3ad19d,_0x2d59dc,_0x40d2f4,_0x29a664,_0x1d06c7,_0x1eae67,_0x37be39){var _0x1b09f3,_0x544fda;_0x1eae67[_0xfb3d('0x22')]=intUtil[_0xfb3d('0x4a')](_0x1eae67[_0xfb3d('0x22')]);_0x1eae67[_0xfb3d('0x4b')]=intUtil[_0xfb3d('0x4a')](_0x1eae67['serverUrl']);if(_0x37be39&&_0x37be39[_0xfb3d('0x65')]&&_0x37be39['recordingFormat']!==_0xfb3d('0x66')){logger[_0xfb3d('0x1a')](_0xfb3d('0x67'),_0xfb3d('0x68'));_0x2d59dc[_0xfb3d('0x4e')]=util[_0xfb3d('0xe')](_0xfb3d('0x4f'),_0x1eae67[_0xfb3d('0x4b')],_0x2d59dc[_0xfb3d('0x50')],md5(_0x2d59dc[_0xfb3d('0x50')]));}headers['Authorization']=getAuth(_0x1eae67);return getUser(_0x1eae67,_0x29a664[_0xfb3d('0x69')])[_0xfb3d('0x16')](function(_0x570d73){_0x1b09f3=_0x570d73;logger['info']('The\x20User\x20ID\x20is:',_0x1b09f3['id']);return getEndUser(_0x1eae67,_0x2d59dc[_0xfb3d('0x6a')],_0x2d59dc[_0xfb3d('0x6b')]);})['then'](function(_0x480884){_0x544fda=_0x480884;logger[_0xfb3d('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x544fda['id']);return getTicket(_0x1eae67,_0x1b09f3,_0x544fda,_0x40d2f4,_0x2d59dc);})[_0xfb3d('0x16')](function(_0x2febe6){if(_0x2febe6){logger[_0xfb3d('0x1a')](_0xfb3d('0x56'),_0x2febe6['id']);switch(_0x1eae67['type']){case _0xfb3d('0x6c'):logger[_0xfb3d('0x1a')](_0xfb3d('0x67'),_0xfb3d('0x57'));return request({'uri':util[_0xfb3d('0xe')](_0xfb3d('0x58'),_0x1eae67[_0xfb3d('0x22')],_0x1b09f3['id'],_0x2febe6['id']),'method':_0xfb3d('0x10')});case _0xfb3d('0x59'):logger['info'](_0xfb3d('0x67'),_0xfb3d('0x5a'));emit(util[_0xfb3d('0xe')](_0xfb3d('0x5b'),_0x29a664[_0xfb3d('0x12')]),_0xfb3d('0x5c'),{'uri':util[_0xfb3d('0xe')]('%s/agent/tickets/%s',_0x1eae67[_0xfb3d('0x22')][_0xfb3d('0x5e')](_0xfb3d('0x5f'),''),_0x2febe6['id'])});break;default:logger[_0xfb3d('0x60')]('[OUTBOUND]',_0xfb3d('0x61'));}}})[_0xfb3d('0x62')](function(_0x42713d){logger[_0xfb3d('0x60')](_0xfb3d('0x6d'),util[_0xfb3d('0x6e')](_0x42713d,{'showHidden':!![],'depth':null}));});};exports[_0xfb3d('0x6f')]=function(_0x2821d5,_0x1866ef,_0x56fc07,_0x1d912b,_0x24440b,_0x1950e8){var _0x14504f,_0x1f7947;_0x1950e8[_0xfb3d('0x22')]=intUtil[_0xfb3d('0x4a')](_0x1950e8['remoteUri']);_0x1950e8['serverUrl']=intUtil[_0xfb3d('0x4a')](_0x1950e8['serverUrl']);if(_0x24440b&&_0x24440b[_0xfb3d('0x4c')]){logger[_0xfb3d('0x1a')]('['+_0x1866ef['lastevent'][_0xfb3d('0x70')]()+']',_0xfb3d('0x68'));_0x1866ef[_0xfb3d('0x4e')]=util[_0xfb3d('0xe')](_0xfb3d('0x4f'),_0x1950e8[_0xfb3d('0x4b')],_0x1866ef[_0xfb3d('0x50')],md5(_0x1866ef[_0xfb3d('0x50')]));}else{_0x1866ef[_0xfb3d('0x4e')]='';}headers[_0xfb3d('0x51')]=getAuth(_0x1950e8);return getUser(_0x1950e8)['then'](function(_0x52768c){_0x14504f=_0x52768c;logger[_0xfb3d('0x1a')](_0xfb3d('0x52'),_0x14504f['id']);return getEndUser(_0x1950e8,_0x1866ef[_0xfb3d('0x53')],_0x1866ef['calleridnum']);})[_0xfb3d('0x16')](function(_0x3c62b3){_0x1f7947=_0x3c62b3;logger[_0xfb3d('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x1f7947['id']);return getTicket(_0x1950e8,_0x14504f,_0x1f7947,_0x56fc07,_0x1866ef);})['then'](function(_0x4e465d){if(_0x4e465d){logger[_0xfb3d('0x1a')](_0xfb3d('0x56'),_0x4e465d['id']);}})[_0xfb3d('0x62')](function(_0x45aa0a){logger['error']('['+_0x1866ef[_0xfb3d('0x71')][_0xfb3d('0x70')]()+']'+_0xfb3d('0x72'),util[_0xfb3d('0x6e')](_0x45aa0a,{'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 d0de86d..19d78d4 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 _0x3039=['https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','format','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Fields','POST','/crm/v2/Calls','Call\x20created!','err','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','com','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','request-promise','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','clientId','clientSecret','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','then','users','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType'];(function(_0x14c9ac,_0x1d8b15){var _0xb93cac=function(_0x51adbd){while(--_0x51adbd){_0x14c9ac['push'](_0x14c9ac['shift']());}};_0xb93cac(++_0x1d8b15);}(_0x3039,0x18b));var _0x9303=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3039[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var rp=require(_0x9303('0x0'));var md5=require(_0x9303('0x1'));var util=require(_0x9303('0x2'));var intUtil=require(_0x9303('0x3'));var moment=require('moment');var Redis=require(_0x9303('0x4'));var BPromise=require('bluebird');var config=require(_0x9303('0x5'));var logger=require(_0x9303('0x6'))(_0x9303('0x7'));config['redis']=_[_0x9303('0x8')](config['redis'],{'host':_0x9303('0x9'),'port':0x18eb});var io=require(_0x9303('0xa'))(new Redis(config[_0x9303('0xb')]));function emit(_0x4f67e9,_0xaf6b2e,_0x57f85a){io['to'](_0x4f67e9)[_0x9303('0xc')](_0xaf6b2e,_0x57f85a);}function request(_0x426151){logger[_0x9303('0xd')](_0x9303('0xe'),JSON[_0x9303('0xf')](_0x426151));return rp(_0x426151);}function getCustomFields(_0x3f020b,_0x474969){var _0x1f7431={};if(_0x3f020b['length']>0x0){_[_0x9303('0x10')](_0x3f020b,function(_0x525e50){if(_[_0x9303('0x11')](['string',_0x9303('0x12')],_0x525e50['type'])&&_0x525e50[_0x9303('0x13')]){_0x1f7431[_0x525e50['idField']]=_0x525e50[_0x9303('0x14')][_0x9303('0x15')]();}else if(_0x525e50[_0x9303('0x16')]===_0x9303('0x17')&&_0x525e50[_0x9303('0x18')]&&_0x525e50[_0x9303('0x13')]&&_0x474969[_0x525e50[_0x9303('0x18')]]){_0x1f7431[_0x525e50[_0x9303('0x13')]]=_0x474969[_0x525e50[_0x9303('0x18')]][_0x9303('0x15')]();}else if(_0x525e50[_0x9303('0x16')]===_0x9303('0x19')&&_0x525e50[_0x9303('0x1a')]&&_0x525e50[_0x9303('0x1a')]['name']&&_0x525e50[_0x9303('0x13')]&&_0x474969[_0x525e50['Variable'][_0x9303('0x1b')][_0x9303('0x1c')]()]){_0x1f7431[_0x525e50['idField']]=_0x474969[_0x525e50[_0x9303('0x1a')][_0x9303('0x1b')][_0x9303('0x1c')]()]['toString']();}});}return _0x1f7431;}function getName(_0x1d720a){if(_0x1d720a[_0x9303('0x1d')]('\x20')>0x0){var _0x34fe71=_0x1d720a[_0x9303('0x1e')](/ (.+)/);if(_0x34fe71[0x1]){return _0x34fe71;}}return[_0x1d720a,_0x1d720a];}var accountsTokens={};function getAccessToken(_0x314050){return new Promise(function(_0x15dc5e,_0xbc5c8e){if(!_[_0x9303('0x1f')](accountsTokens[_0x314050['id']])&&!_[_0x9303('0x1f')](accountsTokens[_0x314050['id']][_0x9303('0x20')])){if(moment()['isBefore'](accountsTokens[_0x314050['id']][_0x9303('0x21')])){_0x15dc5e(accountsTokens[_0x314050['id']]['access_token']);}}var _0x1b8e30;switch(_0x314050[_0x9303('0x22')]){case'US':_0x1b8e30='https://accounts.zoho.com';break;case'AU':_0x1b8e30='https://accounts.zoho.com.au';break;case'EU':_0x1b8e30=_0x9303('0x23');break;case'IN':_0x1b8e30=_0x9303('0x24');break;case'CN':_0x1b8e30='https://accounts.zoho.com.cn';break;default:_0x1b8e30=_0x9303('0x23');break;}var _0x25cee6={'method':'POST','uri':_0x1b8e30+_0x9303('0x25'),'qs':{'refresh_token':_0x314050['refreshToken'],'client_id':_0x314050[_0x9303('0x26')],'client_secret':_0x314050[_0x9303('0x27')],'grant_type':_0x9303('0x28')},'json':!![]};return rp(_0x25cee6)['then'](function(_0x1b996e){accountsTokens[_0x314050['id']]={'access_token':_0x1b996e[_0x9303('0x20')],'expires_in':moment()['add'](_0x1b996e[_0x9303('0x21')],_0x9303('0x29'))};_0x15dc5e(_0x1b996e[_0x9303('0x20')]);})[_0x9303('0x2a')](function(_0x1fd199){logger[_0x9303('0x2b')](_0x9303('0x2c'),_0x1fd199[_0x9303('0x2d')]);_0xbc5c8e(_0x1fd199);});});}function getUser(_0x11b838,_0xeb0e4f,_0xed6db6,_0x3ccbac){logger['info'](_0x9303('0x2e'));return request({'method':_0x9303('0x2f'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0xeb0e4f),'qs':{'type':_0x9303('0x30')},'headers':{'Authorization':_0x9303('0x31')+_0x11b838},'json':!![]})[_0x9303('0x32')](function(_0x58b56a){if(_0x58b56a['users']){var _0x5a9781=-0x1;if(_['isArrayLikeObject'](_0x58b56a['users'])){if(!_[_0x9303('0x1f')](_0x3ccbac)){_0x5a9781=_['findIndex'](_0x58b56a[_0x9303('0x33')],function(_0x22c65c){return _0x22c65c[_0x9303('0x34')]===_0x3ccbac;});}if(_0x5a9781>=0x0){logger[_0x9303('0x35')](_0x9303('0x36'));}else{logger['info'](_0x9303('0x37'));_0x5a9781=_[_0x9303('0x38')](_0x58b56a[_0x9303('0x33')],function(_0x35267a){return _0x35267a[_0x9303('0x39')][_0x9303('0x1b')]===_0x9303('0x3a');});}return _0x58b56a[_0x9303('0x33')][_0x5a9781];}else{if(_0x58b56a['user'][_0x9303('0x39')][_0x9303('0x1b')]===_0x9303('0x3a')){logger[_0x9303('0x35')](_0x9303('0x37'));user=_0x58b56a[_0x9303('0x3b')];return user;}else{logger[_0x9303('0x2b')](_0x9303('0x3c'),JSON[_0x9303('0xf')](_0x58b56a));throw new Error(_0x9303('0x3d')+JSON[_0x9303('0xf')](_0x58b56a));}}}else{logger[_0x9303('0x2b')](_0x9303('0x3c'),JSON['stringify'](_0x58b56a));throw new Error(_0x9303('0x3d')+JSON[_0x9303('0xf')](_0x58b56a));}})[_0x9303('0x2a')](function(_0x5d69e1){console['error'](_0x5d69e1);});}function getZohoUser(_0x12282d,_0x273094){return new BPromise(function(_0x283e24,_0x1112a2){request(_0x12282d)['then'](function(_0x157404){var _0xd970bb=null;if(_0x157404){_0xd970bb=_0x157404[_0x9303('0x3e')][0x0];_0xd970bb[_0x9303('0x3f')]=_0x273094;}_0x283e24(_0xd970bb);})[_0x9303('0x2a')](function(_0x202ed3){_0x1112a2(_0x202ed3);});});}function createEndUser(_0x573e04,_0x52911b,_0xb194e4,_0x6e2fb4,_0x4ca4f8,_0x4ae95f){var _0xb194e4=getName(_0xb194e4);return request({'method':'POST','uri':_0x9303('0x40')+_0x52911b+_0x9303('0x41')+_[_0x9303('0x42')](_0x4ae95f[_0x9303('0x43')])+'s','body':{'data':[{'Last_Name':_0xb194e4[0x1],'First_Name':_0xb194e4[0x0],'Phone':_0x6e2fb4,'Owner':{'name':!_[_0x9303('0x1f')](_0x4ca4f8[_0x9303('0x44')]['name'])?_0x4ca4f8[_0x9303('0x44')][_0x9303('0x1b')]:!_['isNil'](_0x4ca4f8['first_name'])?_0x4ca4f8['first_name']+'\x20'+_0x4ca4f8[_0x9303('0x45')]:_0x4ca4f8[_0x9303('0x45')],'id':_0x4ca4f8['id']}}]},'headers':{'Authorization':_0x9303('0x31')+_0x573e04},'json':!![]})[_0x9303('0x32')](function(_0x4b658f){if(_0x4b658f&&_0x4b658f['data'][0x0][_0x9303('0x46')]===_0x9303('0x47')){var _0x401577=_0x4b658f['data'][0x0][_0x9303('0x48')];_0x401577[_0x9303('0x3f')]=_['startCase'](_0x4ae95f[_0x9303('0x43')])+'s';return _0x401577;}logger[_0x9303('0x2b')](_0x9303('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x9303('0xf')](data));})[_0x9303('0x2a')](function(_0x59cfa9){console[_0x9303('0x49')]('CREATE\x20ERROR',_0x59cfa9);});}function getEndUser(_0x587577,_0x3844ae,_0x4c9e45,_0x11ebb0,_0x34a30a,_0xc4bc81,_0x218c80){var _0x392567={'method':_0x9303('0x2f'),'uri':'','headers':{'Authorization':_0x9303('0x31')+_0x587577},'json':!![]};switch(_0x218c80['moduleSearch']){case _0x9303('0x4a'):_0x392567[_0x9303('0x4b')]=_0x9303('0x40')+_0x3844ae+_0x9303('0x4c')+_0x34a30a+'))';return getZohoUser(_0x392567,_0x9303('0x4d'))[_0x9303('0x32')](function(_0x583503){if(_0x583503)return _0x583503;_0x392567[_0x9303('0x4b')]=_0x9303('0x40')+_0x3844ae+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x34a30a+'))';return getZohoUser(_0x392567,_0x9303('0x4e'))['then'](function(_0x63e2f7){if(_0x63e2f7)return _0x63e2f7;if(_0x218c80['moduleCreate']!=_0x9303('0x4f')){return createEndUser(_0x587577,_0x3844ae,_0x11ebb0,_0x34a30a,_0xc4bc81,_0x218c80);}else{return{};}});});break;case _0x9303('0x50'):_0x392567[_0x9303('0x4b')]=_0x9303('0x40')+_0x3844ae+_0x9303('0x4c')+_0x34a30a+'))';return getZohoUser(_0x392567,_0x9303('0x4d'))[_0x9303('0x32')](function(_0x2ecebd){if(_0x2ecebd)return _0x2ecebd;if(_0x218c80[_0x9303('0x43')]!=_0x9303('0x4f')){return createEndUser(_0x587577,_0x3844ae,_0x11ebb0,_0x34a30a,_0xc4bc81,_0x218c80);}else{return{};}});break;case _0x9303('0x51'):_0x392567[_0x9303('0x4b')]=_0x9303('0x40')+_0x3844ae+_0x9303('0x52')+_0x34a30a+'))';return getZohoUser(_0x392567,_0x9303('0x4e'))[_0x9303('0x32')](function(_0x2d5714){if(_0x2d5714)return _0x2d5714;if(_0x218c80[_0x9303('0x43')]!=_0x9303('0x4f')){return createEndUser(_0x587577,_0x3844ae,_0x11ebb0,_0x34a30a,_0xc4bc81,_0x218c80);}else{return{};}});break;}}function getCall(_0x4e1d97,_0x4806b3,_0x34f6fd,_0x544340,_0x2803ba,_0x5b14a9,_0x4f0459,_0x4ba47a){logger[_0x9303('0x35')](_0x9303('0x53'));var _0x632fb3={};_0x632fb3[_0x9303('0x54')]={'name':!_[_0x9303('0x1f')](_0x544340[_0x9303('0x44')]['name'])&&!_['isNil'](_0x544340[_0x9303('0x39')][_0x9303('0x1b')])&&_0x544340['profile'][_0x9303('0x1b')]===_0x9303('0x55')?_0x544340['role'][_0x9303('0x1b')]:!_[_0x9303('0x1f')](_0x544340[_0x9303('0x56')])?_0x544340[_0x9303('0x56')]+'\x20'+_0x544340[_0x9303('0x45')]:_0x544340['last_name'],'id':_0x544340['id']};_0x632fb3[_0x9303('0x57')]=intUtil['getString'](_0x5b14a9[_0x9303('0x58')],_0x4f0459,'\x20');_0x632fb3['Description']=intUtil[_0x9303('0x59')](_0x5b14a9[_0x9303('0x5a')],_0x4f0459,'\x0a');if(_0x2803ba[_0x9303('0x3f')]==='Contacts'){_0x632fb3[_0x9303('0x5b')]={'name':!_[_0x9303('0x1f')](_0x2803ba[_0x9303('0x5c')])?_0x2803ba[_0x9303('0x5c')]:!_[_0x9303('0x1f')](_0x2803ba[_0x9303('0x5d')])?_0x2803ba[_0x9303('0x5d')]+'\x20'+_0x2803ba[_0x9303('0x5e')]:_0x2803ba[_0x9303('0x5e')],'id':_0x2803ba['id']};}if(_0x2803ba['enduserType']==='Leads'){_0x632fb3[_0x9303('0x5f')]={'name':!_[_0x9303('0x1f')](_0x2803ba['Full_Name'])?_0x2803ba['Full_Name']:!_[_0x9303('0x1f')](_0x2803ba[_0x9303('0x5d')])?_0x2803ba[_0x9303('0x5d')]+'\x20'+_0x2803ba[_0x9303('0x5e')]:_0x2803ba[_0x9303('0x5e')],'id':_0x2803ba['id']};_0x632fb3[_0x9303('0x60')]=_[_0x9303('0x42')](_0x2803ba[_0x9303('0x3f')]);}if(_0x4f0459[_0x9303('0x61')]){_0x632fb3[_0x9303('0x62')]=moment['utc'](parseInt(_0x4f0459[_0x9303('0x61')])*0x3e8)[_0x9303('0x63')](_0x9303('0x64'));}else if(_0x4f0459[_0x9303('0x65')]&&_0x4f0459[_0x9303('0x66')]){_0x632fb3[_0x9303('0x62')]=moment[_0x9303('0x67')](moment(_0x4f0459[_0x9303('0x66')],_0x9303('0x68'))['diff'](moment(_0x4f0459['starttime'],_0x9303('0x68'))))[_0x9303('0x63')](_0x9303('0x64'));}switch(_0x4f0459[_0x9303('0x69')]){case _0x9303('0x6a'):_0x632fb3[_0x9303('0x6b')]='Called';break;case _0x9303('0x6c'):case _0x9303('0x6d'):_0x632fb3[_0x9303('0x6b')]=_0x9303('0x6e');break;case _0x9303('0x6f'):_0x632fb3[_0x9303('0x6b')]=_0x9303('0x70');break;case _0x9303('0x71'):_0x632fb3[_0x9303('0x6b')]=_0x9303('0x72');break;case'timeout':_0x632fb3[_0x9303('0x6b')]=_0x9303('0x73');default:}_0x632fb3[_0x9303('0x74')]=(_0x4ba47a==='outbound'?moment(_0x4f0459[_0x9303('0x75')])[_0x9303('0x63')](_0x9303('0x68')):moment(_0x4f0459[_0x9303('0x76')])[_0x9303('0x63')](_0x9303('0x68')))||moment()[_0x9303('0x63')](_0x9303('0x68'));_0x632fb3[_0x9303('0x77')]=_0x4ba47a||'Inbound';_0x632fb3=_['merge'](_0x632fb3,getCustomFields(_0x5b14a9[_0x9303('0x78')],_0x4f0459));return request({'method':_0x9303('0x79'),'uri':_0x9303('0x40')+_0x4806b3+_0x9303('0x7a'),'headers':{'Authorization':_0x9303('0x31')+_0x4e1d97},'body':{'data':[_0x632fb3]},'json':!![]})[_0x9303('0x32')](function(_0x5bdb0b){if(_0x5bdb0b&&_0x5bdb0b['data'][0x0][_0x9303('0x46')]===_0x9303('0x47')){logger[_0x9303('0x35')](_0x9303('0x7b'));return{'id':_0x5bdb0b['data'][0x0][_0x9303('0x48')]['id']};}})[_0x9303('0x2a')](function(_0x569cd4){logger[_0x9303('0x35')](_0x9303('0x7c'),_0x569cd4[_0x9303('0x2d')]);console[_0x9303('0x49')](_0x9303('0x7c'),_0x569cd4);});}exports['queue']=function(_0x2f8384,_0x170eb9,_0x222ba8,_0x49f286,_0x413f9d,_0x189ed6){var _0x18b0e8,_0x40ebdc,_0x460727;_0x189ed6['host']=intUtil[_0x9303('0x7d')](_0x189ed6[_0x9303('0x7e')]);_0x189ed6['serverUrl']=intUtil['stripTrailingSlash'](_0x189ed6[_0x9303('0x7f')]);if(_0x413f9d&&_0x413f9d[_0x9303('0x80')]){logger['info'](_0x9303('0x81'),_0x9303('0x82'));_0x170eb9[_0x9303('0x83')]=_0x189ed6[_0x9303('0x7f')]+_0x9303('0x84')+_0x170eb9[_0x9303('0x85')]+_0x9303('0x86')+md5(_0x170eb9[_0x9303('0x85')]);}else{_0x170eb9[_0x9303('0x83')]='';}var _0x1985af=_0x189ed6['host']===_0x9303('0x87')?'eu':'com';return getAccessToken(_0x189ed6)['then'](function(_0x36d1ac){_0x460727=_0x36d1ac;return getUser(_0x460727,_0x1985af,_0x189ed6,_0x49f286[_0x9303('0x34')]);})[_0x9303('0x32')](function(_0x55649c){_0x18b0e8=_0x55649c;logger[_0x9303('0x35')](_0x9303('0x88'),_0x18b0e8['id']);return getEndUser(_0x460727,_0x1985af,_0x189ed6,_0x170eb9[_0x9303('0x89')],_0x170eb9[_0x9303('0x8a')],_0x18b0e8,_0x222ba8);})['then'](function(_0x1ce9d1){_0x40ebdc=_0x1ce9d1;return getCall(_0x460727,_0x1985af,_0x189ed6,_0x18b0e8,_0x40ebdc,_0x222ba8,_0x170eb9,_0x9303('0x8b'));})[_0x9303('0x32')](function(_0x367f1c){if(_0x367f1c){logger[_0x9303('0x35')](_0x9303('0x8c'),_0x367f1c['id']);logger['info'](_0x9303('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9303('0x63')](_0x9303('0x8d'),_0x49f286[_0x9303('0x1b')]),_0x9303('0x8e'),{'uri':'https://crm.'+_0x189ed6[_0x9303('0x7e')]+_0x9303('0x8f')+_0x367f1c['id']});}})[_0x9303('0x2a')](function(_0x3bc3ee){logger['error']('[QUEUE]',JSON['stringify'](_0x3bc3ee));});};exports[_0x9303('0x90')]=function(_0x4fdbb8,_0x494d86,_0x49b26a,_0x17cc4b,_0x1f8f00,_0x3cf65f,_0x255b6a){var _0x36ff6b,_0x3dc4f2,_0x1d9837;_0x3cf65f['host']=intUtil[_0x9303('0x7d')](_0x3cf65f[_0x9303('0x7e')]);_0x3cf65f[_0x9303('0x7f')]=intUtil[_0x9303('0x7d')](_0x3cf65f['serverUrl']);if(_0x255b6a&&_0x255b6a[_0x9303('0x91')]&&_0x255b6a[_0x9303('0x91')]!=='none'){logger[_0x9303('0x35')](_0x9303('0x92'),_0x9303('0x82'));_0x494d86['recordingURL']=_0x3cf65f[_0x9303('0x7f')]+_0x9303('0x84')+_0x494d86[_0x9303('0x85')]+_0x9303('0x86')+md5(_0x494d86[_0x9303('0x85')]);}var _0x2e2aeb=_0x3cf65f[_0x9303('0x7e')]===_0x9303('0x87')?'eu':_0x9303('0x93');return getAccessToken(_0x3cf65f)['then'](function(_0x23712d){_0x1d9837=_0x23712d;return getUser(_0x1d9837,_0x2e2aeb,_0x3cf65f,_0x17cc4b[_0x9303('0x34')]);})[_0x9303('0x32')](function(_0x16456c){_0x36ff6b=_0x16456c;logger[_0x9303('0x35')](_0x9303('0x88'),_0x36ff6b['id']);return getEndUser(_0x1d9837,_0x2e2aeb,_0x3cf65f,_0x494d86['destcalleridname'],_0x494d86[_0x9303('0x94')],_0x36ff6b,_0x49b26a);})[_0x9303('0x32')](function(_0x2a5598){_0x3dc4f2=_0x2a5598;return getCall(_0x1d9837,_0x2e2aeb,_0x3cf65f,_0x36ff6b,_0x3dc4f2,_0x49b26a,_0x494d86,_0x9303('0x95'));})[_0x9303('0x32')](function(_0x568f42){if(_0x568f42){logger[_0x9303('0x35')]('The\x20Call\x20ID\x20is:',_0x568f42['id']);logger['info'](_0x9303('0x92'),_0x9303('0x96'));emit(util[_0x9303('0x63')](_0x9303('0x8d'),_0x17cc4b[_0x9303('0x1b')]),_0x9303('0x8e'),{'uri':'https://crm.'+_0x3cf65f[_0x9303('0x7e')]+_0x9303('0x8f')+_0x568f42['id']});}})[_0x9303('0x2a')](function(_0x43cb34){logger['error']('[OUTBOUND]',JSON[_0x9303('0xf')](_0x43cb34));});};exports[_0x9303('0x97')]=function(_0x309cb0,_0x998e44,_0x3b0b80,_0x4b6828,_0x437ee6,_0x551ef2){var _0x342b3e,_0x2727eb,_0x5b2b04;_0x551ef2['host']=intUtil[_0x9303('0x7d')](_0x551ef2[_0x9303('0x7e')]);_0x551ef2[_0x9303('0x7f')]=intUtil['stripTrailingSlash'](_0x551ef2['serverUrl']);if(_0x437ee6&&_0x437ee6['monitor_format']){logger[_0x9303('0x35')]('['+_0x998e44[_0x9303('0x69')][_0x9303('0x98')]()+']',_0x9303('0x82'));_0x998e44[_0x9303('0x83')]=_0x551ef2[_0x9303('0x7f')]+_0x9303('0x84')+_0x998e44[_0x9303('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x998e44[_0x9303('0x85')]);}else{_0x998e44[_0x9303('0x83')]='';}var _0x13f10a=_0x551ef2[_0x9303('0x7e')]===_0x9303('0x87')?'eu':_0x9303('0x93');return getAccessToken(_0x551ef2)['then'](function(_0x229c07){_0x5b2b04=_0x229c07;return getUser(_0x5b2b04,_0x13f10a,_0x551ef2);})['then'](function(_0x40d1d0){_0x342b3e=_0x40d1d0;logger['info']('The\x20User\x20ID\x20is:',_0x342b3e['id']);return getEndUser(_0x5b2b04,_0x13f10a,_0x551ef2,_0x998e44[_0x9303('0x89')],_0x998e44[_0x9303('0x8a')],_0x342b3e,_0x3b0b80);})[_0x9303('0x32')](function(_0x4977a5){_0x2727eb=_0x4977a5;return getCall(_0x5b2b04,_0x13f10a,_0x551ef2,_0x342b3e,_0x2727eb,_0x3b0b80,_0x998e44,_0x9303('0x8b'));})[_0x9303('0x32')](function(_0x5b8287){if(_0x5b8287){logger[_0x9303('0x35')](_0x9303('0x8c'),_0x5b8287['id']);}})[_0x9303('0x2a')](function(_0x199788){logger['error']('['+_0x998e44[_0x9303('0x69')][_0x9303('0x98')]()+']',JSON[_0x9303('0xf')](_0x199788));});}; \ No newline at end of file +var _0xbf97=['The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','https://crm.','lastevent','The\x20Call\x20ID\x20is:','toUpperCase','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','expires_in','catch','error','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','Agent\x20found!','Administrator','Using\x20the\x20admin\x20account!','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','profile','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','Answered','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Fields','SUCCESS','Call\x20created!','stack','log','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email'];(function(_0xa0e632,_0x178d36){var _0x420bc2=function(_0x1fdfce){while(--_0x1fdfce){_0xa0e632['push'](_0xa0e632['shift']());}};_0x420bc2(++_0x178d36);}(_0xbf97,0xa6));var _0x7bf9=function(_0x29eae2,_0xf2cc03){_0x29eae2=_0x29eae2-0x0;var _0x11d693=_0xbf97[_0x29eae2];return _0x11d693;};'use strict';var _=require('lodash');var rp=require(_0x7bf9('0x0'));var md5=require(_0x7bf9('0x1'));var util=require(_0x7bf9('0x2'));var intUtil=require(_0x7bf9('0x3'));var moment=require('moment');var Redis=require(_0x7bf9('0x4'));var BPromise=require(_0x7bf9('0x5'));var config=require(_0x7bf9('0x6'));var logger=require(_0x7bf9('0x7'))('zoho');config[_0x7bf9('0x8')]=_[_0x7bf9('0x9')](config[_0x7bf9('0x8')],{'host':_0x7bf9('0xa'),'port':0x18eb});var io=require(_0x7bf9('0xb'))(new Redis(config[_0x7bf9('0x8')]));function emit(_0x3f3a2e,_0x53993c,_0x2149bc){io['to'](_0x3f3a2e)[_0x7bf9('0xc')](_0x53993c,_0x2149bc);}function request(_0x15530b){logger[_0x7bf9('0xd')](_0x7bf9('0xe'),JSON[_0x7bf9('0xf')](_0x15530b));return rp(_0x15530b);}function getCustomFields(_0xaf0400,_0x425788){var _0x5913c1={};if(_0xaf0400[_0x7bf9('0x10')]>0x0){_[_0x7bf9('0x11')](_0xaf0400,function(_0x558ad7){if(_['includes'](['string','picklist'],_0x558ad7['type'])&&_0x558ad7[_0x7bf9('0x12')]){_0x5913c1[_0x558ad7[_0x7bf9('0x12')]]=_0x558ad7[_0x7bf9('0x13')][_0x7bf9('0x14')]();}else if(_0x558ad7['type']==='variable'&&_0x558ad7['variableName']&&_0x558ad7['idField']&&_0x425788[_0x558ad7[_0x7bf9('0x15')]]){_0x5913c1[_0x558ad7[_0x7bf9('0x12')]]=_0x425788[_0x558ad7[_0x7bf9('0x15')]][_0x7bf9('0x14')]();}else if(_0x558ad7['type']===_0x7bf9('0x16')&&_0x558ad7[_0x7bf9('0x17')]&&_0x558ad7[_0x7bf9('0x17')]['name']&&_0x558ad7[_0x7bf9('0x12')]&&_0x425788[_0x558ad7[_0x7bf9('0x17')][_0x7bf9('0x18')][_0x7bf9('0x19')]()]){_0x5913c1[_0x558ad7['idField']]=_0x425788[_0x558ad7[_0x7bf9('0x17')][_0x7bf9('0x18')][_0x7bf9('0x19')]()][_0x7bf9('0x14')]();}});}return _0x5913c1;}function getName(_0x43031f){if(_0x43031f['indexOf']('\x20')>0x0){var _0x12de91=_0x43031f['split'](/ (.+)/);if(_0x12de91[0x1]){return _0x12de91;}}return[_0x43031f,_0x43031f];}var accountsTokens={};function getAccessToken(_0x44dfc5){return new Promise(function(_0x447f6a,_0x362a9c){if(!_[_0x7bf9('0x1a')](accountsTokens[_0x44dfc5['id']])&&!_[_0x7bf9('0x1a')](accountsTokens[_0x44dfc5['id']][_0x7bf9('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x44dfc5['id']]['expires_in'])){_0x447f6a(accountsTokens[_0x44dfc5['id']][_0x7bf9('0x1b')]);}}var _0xd8b520;switch(_0x44dfc5[_0x7bf9('0x1c')]){case'US':_0xd8b520='https://accounts.zoho.com';break;case'AU':_0xd8b520='https://accounts.zoho.com.au';break;case'EU':_0xd8b520='https://accounts.zoho.eu';break;case'IN':_0xd8b520=_0x7bf9('0x1d');break;case'CN':_0xd8b520=_0x7bf9('0x1e');break;default:_0xd8b520=_0x7bf9('0x1f');break;}var _0x40440b={'method':_0x7bf9('0x20'),'uri':_0xd8b520+_0x7bf9('0x21'),'qs':{'refresh_token':_0x44dfc5[_0x7bf9('0x22')],'client_id':_0x44dfc5[_0x7bf9('0x23')],'client_secret':_0x44dfc5[_0x7bf9('0x24')],'grant_type':_0x7bf9('0x25')},'json':!![]};return rp(_0x40440b)['then'](function(_0x39e2b8){accountsTokens[_0x44dfc5['id']]={'access_token':_0x39e2b8[_0x7bf9('0x1b')],'expires_in':moment()[_0x7bf9('0x26')](_0x39e2b8[_0x7bf9('0x27')],'seconds')};_0x447f6a(_0x39e2b8[_0x7bf9('0x1b')]);})[_0x7bf9('0x28')](function(_0x342229){logger[_0x7bf9('0x29')]('Failing\x20creating\x20the\x20access_token',_0x342229['stack']);_0x362a9c(_0x342229);});});}function getUser(_0x13b96a,_0x948d8d,_0x198676,_0xb3de2b){logger[_0x7bf9('0x2a')]('Search\x20user');return request({'method':_0x7bf9('0x2b'),'uri':util['format'](_0x7bf9('0x2c'),_0x948d8d),'qs':{'type':_0x7bf9('0x2d')},'headers':{'Authorization':_0x7bf9('0x2e')+_0x13b96a},'json':!![]})[_0x7bf9('0x2f')](function(_0x4689dc){if(_0x4689dc[_0x7bf9('0x30')]){var _0x20aee4=-0x1;if(_[_0x7bf9('0x31')](_0x4689dc['users'])){if(!_['isNil'](_0xb3de2b)){_0x20aee4=_[_0x7bf9('0x32')](_0x4689dc[_0x7bf9('0x30')],function(_0x1a705b){return _0x1a705b['email']===_0xb3de2b;});}if(_0x20aee4>=0x0){logger[_0x7bf9('0x2a')](_0x7bf9('0x33'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x20aee4=_[_0x7bf9('0x32')](_0x4689dc[_0x7bf9('0x30')],function(_0x505c8a){return _0x505c8a['profile'][_0x7bf9('0x18')]===_0x7bf9('0x34');});}return _0x4689dc['users'][_0x20aee4];}else{if(_0x4689dc['user']['profile'][_0x7bf9('0x18')]===_0x7bf9('0x34')){logger['info'](_0x7bf9('0x35'));user=_0x4689dc[_0x7bf9('0x36')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x4689dc));throw new Error(_0x7bf9('0x37')+JSON[_0x7bf9('0xf')](_0x4689dc));}}}else{logger[_0x7bf9('0x29')](_0x7bf9('0x38'),JSON[_0x7bf9('0xf')](_0x4689dc));throw new Error(_0x7bf9('0x37')+JSON['stringify'](_0x4689dc));}})[_0x7bf9('0x28')](function(_0x1cebf6){console[_0x7bf9('0x29')](_0x1cebf6);});}function getZohoUser(_0x287e05,_0x177644){return new BPromise(function(_0x1f309a,_0x211c4c){request(_0x287e05)[_0x7bf9('0x2f')](function(_0x194181){var _0x3a8398=null;if(_0x194181){_0x3a8398=_0x194181[_0x7bf9('0x39')][0x0];_0x3a8398[_0x7bf9('0x3a')]=_0x177644;}_0x1f309a(_0x3a8398);})[_0x7bf9('0x28')](function(_0x5d4fde){_0x211c4c(_0x5d4fde);});});}function createEndUser(_0x58c9f2,_0x3030cf,_0x14fdab,_0x4b30ee,_0x3a9702,_0x4b58d5){var _0x14fdab=getName(_0x14fdab);return request({'method':'POST','uri':_0x7bf9('0x3b')+_0x3030cf+_0x7bf9('0x3c')+_[_0x7bf9('0x3d')](_0x4b58d5[_0x7bf9('0x3e')])+'s','body':{'data':[{'Last_Name':_0x14fdab[0x1],'First_Name':_0x14fdab[0x0],'Phone':_0x4b30ee,'Owner':{'name':!_['isNil'](_0x3a9702[_0x7bf9('0x3f')]['name'])?_0x3a9702['role']['name']:!_[_0x7bf9('0x1a')](_0x3a9702[_0x7bf9('0x40')])?_0x3a9702[_0x7bf9('0x40')]+'\x20'+_0x3a9702[_0x7bf9('0x41')]:_0x3a9702[_0x7bf9('0x41')],'id':_0x3a9702['id']}}]},'headers':{'Authorization':_0x7bf9('0x2e')+_0x58c9f2},'json':!![]})['then'](function(_0x52126f){if(_0x52126f&&_0x52126f['data'][0x0][_0x7bf9('0x42')]==='SUCCESS'){var _0x3d030f=_0x52126f[_0x7bf9('0x39')][0x0][_0x7bf9('0x43')];_0x3d030f[_0x7bf9('0x3a')]=_[_0x7bf9('0x3d')](_0x4b58d5[_0x7bf9('0x3e')])+'s';return _0x3d030f;}logger[_0x7bf9('0x29')](_0x7bf9('0x38'),JSON[_0x7bf9('0xf')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})['catch'](function(_0x7a829){console['log'](_0x7bf9('0x44'),_0x7a829);});}function getEndUser(_0x46c385,_0xb49b8e,_0x377ccf,_0x41592f,_0x3c0c34,_0x2c445f,_0x93d2c0){var _0x1ad3f4={'method':_0x7bf9('0x2b'),'uri':'','headers':{'Authorization':_0x7bf9('0x2e')+_0x46c385},'json':!![]};switch(_0x93d2c0['moduleSearch']){case _0x7bf9('0x45'):_0x1ad3f4[_0x7bf9('0x46')]=_0x7bf9('0x3b')+_0xb49b8e+_0x7bf9('0x47')+_0x3c0c34+'))';return getZohoUser(_0x1ad3f4,'Contacts')[_0x7bf9('0x2f')](function(_0x5dd72e){if(_0x5dd72e)return _0x5dd72e;_0x1ad3f4[_0x7bf9('0x46')]=_0x7bf9('0x3b')+_0xb49b8e+_0x7bf9('0x48')+_0x3c0c34+'))';return getZohoUser(_0x1ad3f4,_0x7bf9('0x49'))[_0x7bf9('0x2f')](function(_0x344bb8){if(_0x344bb8)return _0x344bb8;if(_0x93d2c0[_0x7bf9('0x3e')]!=_0x7bf9('0x4a')){return createEndUser(_0x46c385,_0xb49b8e,_0x41592f,_0x3c0c34,_0x2c445f,_0x93d2c0);}else{return{};}});});break;case _0x7bf9('0x4b'):_0x1ad3f4[_0x7bf9('0x46')]=_0x7bf9('0x3b')+_0xb49b8e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3c0c34+'))';return getZohoUser(_0x1ad3f4,_0x7bf9('0x4c'))['then'](function(_0x60ee58){if(_0x60ee58)return _0x60ee58;if(_0x93d2c0[_0x7bf9('0x3e')]!=_0x7bf9('0x4a')){return createEndUser(_0x46c385,_0xb49b8e,_0x41592f,_0x3c0c34,_0x2c445f,_0x93d2c0);}else{return{};}});break;case _0x7bf9('0x4d'):_0x1ad3f4[_0x7bf9('0x46')]=_0x7bf9('0x3b')+_0xb49b8e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3c0c34+'))';return getZohoUser(_0x1ad3f4,_0x7bf9('0x49'))['then'](function(_0x323431){if(_0x323431)return _0x323431;if(_0x93d2c0[_0x7bf9('0x3e')]!='nothing'){return createEndUser(_0x46c385,_0xb49b8e,_0x41592f,_0x3c0c34,_0x2c445f,_0x93d2c0);}else{return{};}});break;}}function getCall(_0x574a8c,_0x33688d,_0x16f7d7,_0x4a5f26,_0x2326b4,_0x213250,_0x4eab59,_0x3bdb57){logger[_0x7bf9('0x2a')](_0x7bf9('0x4e'));var _0x4fc99e={};_0x4fc99e[_0x7bf9('0x4f')]={'name':!_['isNil'](_0x4a5f26[_0x7bf9('0x3f')][_0x7bf9('0x18')])&&!_['isNil'](_0x4a5f26[_0x7bf9('0x50')][_0x7bf9('0x18')])&&_0x4a5f26['profile'][_0x7bf9('0x18')]==='administrator'?_0x4a5f26[_0x7bf9('0x3f')][_0x7bf9('0x18')]:!_['isNil'](_0x4a5f26[_0x7bf9('0x40')])?_0x4a5f26[_0x7bf9('0x40')]+'\x20'+_0x4a5f26[_0x7bf9('0x41')]:_0x4a5f26['last_name'],'id':_0x4a5f26['id']};_0x4fc99e[_0x7bf9('0x51')]=intUtil['getString'](_0x213250[_0x7bf9('0x52')],_0x4eab59,'\x20');_0x4fc99e[_0x7bf9('0x53')]=intUtil['getString'](_0x213250[_0x7bf9('0x54')],_0x4eab59,'\x0a');if(_0x2326b4[_0x7bf9('0x3a')]===_0x7bf9('0x4c')){_0x4fc99e[_0x7bf9('0x55')]={'name':!_[_0x7bf9('0x1a')](_0x2326b4[_0x7bf9('0x56')])?_0x2326b4[_0x7bf9('0x56')]:!_[_0x7bf9('0x1a')](_0x2326b4[_0x7bf9('0x57')])?_0x2326b4['First_Name']+'\x20'+_0x2326b4['Last_Name']:_0x2326b4[_0x7bf9('0x58')],'id':_0x2326b4['id']};}if(_0x2326b4[_0x7bf9('0x3a')]===_0x7bf9('0x49')){_0x4fc99e[_0x7bf9('0x59')]={'name':!_[_0x7bf9('0x1a')](_0x2326b4[_0x7bf9('0x56')])?_0x2326b4[_0x7bf9('0x56')]:!_[_0x7bf9('0x1a')](_0x2326b4[_0x7bf9('0x57')])?_0x2326b4['First_Name']+'\x20'+_0x2326b4[_0x7bf9('0x58')]:_0x2326b4[_0x7bf9('0x58')],'id':_0x2326b4['id']};_0x4fc99e[_0x7bf9('0x5a')]=_[_0x7bf9('0x3d')](_0x2326b4['enduserType']);}if(_0x4eab59[_0x7bf9('0x5b')]){_0x4fc99e['Call_Duration']=moment[_0x7bf9('0x5c')](parseInt(_0x4eab59[_0x7bf9('0x5b')])*0x3e8)[_0x7bf9('0x5d')]('mm:ss');}else if(_0x4eab59[_0x7bf9('0x5e')]&&_0x4eab59[_0x7bf9('0x5f')]){_0x4fc99e[_0x7bf9('0x60')]=moment[_0x7bf9('0x5c')](moment(_0x4eab59[_0x7bf9('0x5f')],_0x7bf9('0x61'))[_0x7bf9('0x62')](moment(_0x4eab59[_0x7bf9('0x63')],_0x7bf9('0x61'))))[_0x7bf9('0x5d')](_0x7bf9('0x64'));}switch(_0x4eab59['lastevent']){case _0x7bf9('0x65'):_0x4fc99e[_0x7bf9('0x66')]=_0x7bf9('0x67');break;case _0x7bf9('0x68'):case'connect':_0x4fc99e['Call_Result']=_0x7bf9('0x69');break;case _0x7bf9('0x6a'):_0x4fc99e[_0x7bf9('0x66')]='Rejected';break;case _0x7bf9('0x6b'):_0x4fc99e[_0x7bf9('0x66')]='Abandoned';break;case _0x7bf9('0x6c'):_0x4fc99e[_0x7bf9('0x66')]=_0x7bf9('0x6d');default:}_0x4fc99e[_0x7bf9('0x6e')]=(_0x3bdb57===_0x7bf9('0x6f')?moment(_0x4eab59[_0x7bf9('0x63')])[_0x7bf9('0x5d')](_0x7bf9('0x61')):moment(_0x4eab59['agentcalledAt'])['format'](_0x7bf9('0x61')))||moment()['format'](_0x7bf9('0x61'));_0x4fc99e[_0x7bf9('0x70')]=_0x3bdb57||'Inbound';_0x4fc99e=_['merge'](_0x4fc99e,getCustomFields(_0x213250[_0x7bf9('0x71')],_0x4eab59));return request({'method':_0x7bf9('0x20'),'uri':_0x7bf9('0x3b')+_0x33688d+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x574a8c},'body':{'data':[_0x4fc99e]},'json':!![]})[_0x7bf9('0x2f')](function(_0x4d6517){if(_0x4d6517&&_0x4d6517[_0x7bf9('0x39')][0x0][_0x7bf9('0x42')]===_0x7bf9('0x72')){logger[_0x7bf9('0x2a')](_0x7bf9('0x73'));return{'id':_0x4d6517[_0x7bf9('0x39')][0x0][_0x7bf9('0x43')]['id']};}})['catch'](function(_0x5dfacc){logger[_0x7bf9('0x2a')]('err',_0x5dfacc[_0x7bf9('0x74')]);console[_0x7bf9('0x75')](_0x7bf9('0x76'),_0x5dfacc);});}exports[_0x7bf9('0x77')]=function(_0x331731,_0x4de562,_0x1d38f4,_0xcda455,_0x136182,_0x39cc98){var _0x1f77ab,_0x4dc862,_0x27a87a;_0x39cc98[_0x7bf9('0x78')]=intUtil[_0x7bf9('0x79')](_0x39cc98['host']);_0x39cc98[_0x7bf9('0x7a')]=intUtil[_0x7bf9('0x79')](_0x39cc98[_0x7bf9('0x7a')]);if(_0x136182&&_0x136182[_0x7bf9('0x7b')]){logger[_0x7bf9('0x2a')](_0x7bf9('0x7c'),_0x7bf9('0x7d'));_0x4de562[_0x7bf9('0x7e')]=_0x39cc98[_0x7bf9('0x7a')]+_0x7bf9('0x7f')+_0x4de562[_0x7bf9('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x4de562[_0x7bf9('0x80')]);}else{_0x4de562['recordingURL']='';}var _0x5065fc=_0x39cc98[_0x7bf9('0x78')]===_0x7bf9('0x81')?'eu':_0x7bf9('0x82');return getAccessToken(_0x39cc98)[_0x7bf9('0x2f')](function(_0x459f73){_0x27a87a=_0x459f73;return getUser(_0x27a87a,_0x5065fc,_0x39cc98,_0xcda455[_0x7bf9('0x83')]);})[_0x7bf9('0x2f')](function(_0xd60cdc){_0x1f77ab=_0xd60cdc;logger[_0x7bf9('0x2a')](_0x7bf9('0x84'),_0x1f77ab['id']);return getEndUser(_0x27a87a,_0x5065fc,_0x39cc98,_0x4de562[_0x7bf9('0x85')],_0x4de562[_0x7bf9('0x86')],_0x1f77ab,_0x1d38f4);})[_0x7bf9('0x2f')](function(_0x43475d){_0x4dc862=_0x43475d;return getCall(_0x27a87a,_0x5065fc,_0x39cc98,_0x1f77ab,_0x4dc862,_0x1d38f4,_0x4de562,_0x7bf9('0x87'));})[_0x7bf9('0x2f')](function(_0x3b4d6b){if(_0x3b4d6b){logger['info']('The\x20Call\x20ID\x20is:',_0x3b4d6b['id']);logger[_0x7bf9('0x2a')](_0x7bf9('0x7c'),_0x7bf9('0x88'));emit(util[_0x7bf9('0x5d')](_0x7bf9('0x89'),_0xcda455[_0x7bf9('0x18')]),_0x7bf9('0x8a'),{'uri':'https://crm.'+_0x39cc98[_0x7bf9('0x78')]+_0x7bf9('0x8b')+_0x3b4d6b['id']});}})[_0x7bf9('0x28')](function(_0x16a252){logger['error']('[QUEUE]',JSON['stringify'](_0x16a252));});};exports[_0x7bf9('0x6f')]=function(_0x3bcef2,_0x2436da,_0x23b5d2,_0x3b3dff,_0x4756f0,_0x3f6046,_0x41f2dc){var _0x291052,_0x49a368,_0x2cf68a;_0x3f6046[_0x7bf9('0x78')]=intUtil[_0x7bf9('0x79')](_0x3f6046[_0x7bf9('0x78')]);_0x3f6046[_0x7bf9('0x7a')]=intUtil[_0x7bf9('0x79')](_0x3f6046['serverUrl']);if(_0x41f2dc&&_0x41f2dc['recordingFormat']&&_0x41f2dc[_0x7bf9('0x8c')]!=='none'){logger[_0x7bf9('0x2a')](_0x7bf9('0x8d'),_0x7bf9('0x7d'));_0x2436da[_0x7bf9('0x7e')]=_0x3f6046[_0x7bf9('0x7a')]+_0x7bf9('0x7f')+_0x2436da['uniqueid']+_0x7bf9('0x8e')+md5(_0x2436da[_0x7bf9('0x80')]);}var _0x41dce6=_0x3f6046['host']===_0x7bf9('0x81')?'eu':_0x7bf9('0x82');return getAccessToken(_0x3f6046)[_0x7bf9('0x2f')](function(_0x5a7059){_0x2cf68a=_0x5a7059;return getUser(_0x2cf68a,_0x41dce6,_0x3f6046,_0x3b3dff[_0x7bf9('0x83')]);})[_0x7bf9('0x2f')](function(_0x562924){_0x291052=_0x562924;logger['info'](_0x7bf9('0x84'),_0x291052['id']);return getEndUser(_0x2cf68a,_0x41dce6,_0x3f6046,_0x2436da[_0x7bf9('0x8f')],_0x2436da[_0x7bf9('0x90')],_0x291052,_0x23b5d2);})[_0x7bf9('0x2f')](function(_0x34bffd){_0x49a368=_0x34bffd;return getCall(_0x2cf68a,_0x41dce6,_0x3f6046,_0x291052,_0x49a368,_0x23b5d2,_0x2436da,'Outbound');})[_0x7bf9('0x2f')](function(_0x4ac7b0){if(_0x4ac7b0){logger[_0x7bf9('0x2a')]('The\x20Call\x20ID\x20is:',_0x4ac7b0['id']);logger[_0x7bf9('0x2a')](_0x7bf9('0x8d'),_0x7bf9('0x88'));emit(util['format'](_0x7bf9('0x89'),_0x3b3dff['name']),_0x7bf9('0x8a'),{'uri':_0x7bf9('0x91')+_0x3f6046['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4ac7b0['id']});}})['catch'](function(_0x45cfb3){logger['error']('[OUTBOUND]',JSON[_0x7bf9('0xf')](_0x45cfb3));});};exports['unmanaged']=function(_0x5dc5e9,_0x5762e9,_0xd625ad,_0x2a1c7b,_0x511469,_0x506255){var _0x3d9986,_0x2c1fcb,_0x36cc28;_0x506255[_0x7bf9('0x78')]=intUtil[_0x7bf9('0x79')](_0x506255['host']);_0x506255[_0x7bf9('0x7a')]=intUtil[_0x7bf9('0x79')](_0x506255[_0x7bf9('0x7a')]);if(_0x511469&&_0x511469['monitor_format']){logger['info']('['+_0x5762e9[_0x7bf9('0x92')]['toUpperCase']()+']',_0x7bf9('0x7d'));_0x5762e9[_0x7bf9('0x7e')]=_0x506255['serverUrl']+'/api/voice/recordings/'+_0x5762e9[_0x7bf9('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x5762e9[_0x7bf9('0x80')]);}else{_0x5762e9['recordingURL']='';}var _0x46c09a=_0x506255['host']===_0x7bf9('0x81')?'eu':'com';return getAccessToken(_0x506255)[_0x7bf9('0x2f')](function(_0x547c9b){_0x36cc28=_0x547c9b;return getUser(_0x36cc28,_0x46c09a,_0x506255);})[_0x7bf9('0x2f')](function(_0x712ee5){_0x3d9986=_0x712ee5;logger[_0x7bf9('0x2a')](_0x7bf9('0x84'),_0x3d9986['id']);return getEndUser(_0x36cc28,_0x46c09a,_0x506255,_0x5762e9[_0x7bf9('0x85')],_0x5762e9[_0x7bf9('0x86')],_0x3d9986,_0xd625ad);})[_0x7bf9('0x2f')](function(_0x316d57){_0x2c1fcb=_0x316d57;return getCall(_0x36cc28,_0x46c09a,_0x506255,_0x3d9986,_0x2c1fcb,_0xd625ad,_0x5762e9,'Inbound');})[_0x7bf9('0x2f')](function(_0x4f8e6c){if(_0x4f8e6c){logger[_0x7bf9('0x2a')](_0x7bf9('0x93'),_0x4f8e6c['id']);}})[_0x7bf9('0x28')](function(_0x4c2e4b){logger[_0x7bf9('0x29')]('['+_0x5762e9[_0x7bf9('0x92')][_0x7bf9('0x94')]()+']',JSON['stringify'](_0x4c2e4b));});}; \ 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 8483d3b..a83e9e0 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 _0x9adc=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','../../../../config/logger','data2','Script','render','data3','exec','error','format'];(function(_0xfaa274,_0x382a1c){var _0x3ff21b=function(_0x2a7c83){while(--_0x2a7c83){_0xfaa274['push'](_0xfaa274['shift']());}};_0x3ff21b(++_0x382a1c);}(_0x9adc,0x1a5));var _0xc9ad=function(_0x1bc173,_0x1f46f5){_0x1bc173=_0x1bc173-0x0;var _0x2815a0=_0x9adc[_0x1bc173];return _0x2815a0;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0xc9ad('0x0'))('trigger');exports['exec']=function(_0x146d53,_0x18bf4f){var _0x2e6c99=_0x146d53[_0xc9ad('0x1')]?_0x146d53[_0xc9ad('0x1')]:_0xc9ad('0x2');var _0x2f6be1=_0x146d53['data3']?Mustache[_0xc9ad('0x3')](_0x146d53[_0xc9ad('0x4')],_0x18bf4f):_0x18bf4f;sh[_0xc9ad('0x5')](_0x2f6be1,function(_0x5cd988,_0x25be74,_0x2662a){if(_0x5cd988!==0x0){logger[_0xc9ad('0x6')](util[_0xc9ad('0x7')](_0xc9ad('0x8'),_0x2e6c99,_0x2f6be1,_0x5cd988,_0x2662a));}else{logger[_0xc9ad('0x9')](util[_0xc9ad('0x7')](_0xc9ad('0xa'),_0x2e6c99,_0x2f6be1,_0x25be74));}});}; \ No newline at end of file +var _0xcb3f=['exec','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger','data2','data3'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb3f,0x118));var _0xfcb3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcb3f[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0xfcb3('0x0'));var sh=require(_0xfcb3('0x1'));var Mustache=require('mustache');var logger=require(_0xfcb3('0x2'))(_0xfcb3('0x3'));exports['exec']=function(_0x51f818,_0x47edf8){var _0x1d9bf3=_0x51f818[_0xfcb3('0x4')]?_0x51f818['data2']:'Script';var _0x3d1678=_0x51f818[_0xfcb3('0x5')]?Mustache['render'](_0x51f818['data3'],_0x47edf8):_0x47edf8;sh[_0xfcb3('0x6')](_0x3d1678,function(_0x3b448f,_0x2347c7,_0x5b05c2){if(_0x3b448f!==0x0){logger[_0xfcb3('0x7')](util[_0xfcb3('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1d9bf3,_0x3d1678,_0x3b448f,_0x5b05c2));}else{logger[_0xfcb3('0x9')](util[_0xfcb3('0x8')](_0xfcb3('0xa'),_0x1d9bf3,_0x3d1678,_0x2347c7));}});}; \ 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 819a6e7..1f927ea 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 _0xd2ae=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','info','format','%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','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack','GET','DELETE','PUT','data7','body'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd2ae,0xfc));var _0xed2a=function(_0x1b25a0,_0x48567e){_0x1b25a0=_0x1b25a0-0x0;var _0x2c9e5e=_0xd2ae[_0x1b25a0];return _0x2c9e5e;};'use strict';var rp=require('request-promise');var util=require(_0xed2a('0x0'));var _=require(_0xed2a('0x1'));var Mustache=require('mustache');var logger=require(_0xed2a('0x2'))('trigger');exports[_0xed2a('0x3')]=function(_0x164d60,_0xfb5fed){var _0x786f8c,_0x2b6e40;var _0x10e3bd={'method':_0x164d60[_0xed2a('0x4')][_0xed2a('0x5')](),'uri':Mustache[_0xed2a('0x6')](_0x164d60[_0xed2a('0x7')],_0xfb5fed),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x164d60[_0xed2a('0x8')])===_0xed2a('0x9')&&parseInt(_0x164d60[_0xed2a('0x8')])>=0x1&&parseInt(_0x164d60['data5'])<=0xa?parseInt(_0x164d60[_0xed2a('0x8')])*0x3e8:0x5*0x3e8};try{_0x10e3bd[_0xed2a('0xa')]=_0x164d60['data6']?JSON[_0xed2a('0xb')](Mustache[_0xed2a('0x6')](_0x164d60[_0xed2a('0xc')],_0xfb5fed)):{};}catch(_0x21f69a){logger[_0xed2a('0xd')](_0x21f69a[_0xed2a('0xe')]);}switch(_0x164d60[_0xed2a('0x4')][_0xed2a('0x5')]()){case _0xed2a('0xf'):case _0xed2a('0x10'):_0x786f8c=null;_0x10e3bd['qs']=_0xfb5fed;break;case'POST':case _0xed2a('0x11'):if(_0x164d60[_0xed2a('0x12')]){try{_0x786f8c=JSON['parse'](Mustache[_0xed2a('0x6')](_0x164d60[_0xed2a('0x12')],_0xfb5fed));_0x10e3bd[_0xed2a('0x13')]=_0x786f8c;}catch(_0x2ae2f3){logger['error'](_0x2ae2f3[_0xed2a('0xe')]);logger[_0xed2a('0xd')](_0xed2a('0x14'));}}else{_0x786f8c=_0xfb5fed;_0x10e3bd[_0xed2a('0x13')]=_0x786f8c;}break;}logger['info'](util['format'](_0xed2a('0x15'),_0x164d60[_0xed2a('0x4')],_0x164d60['data2'],JSON[_0xed2a('0x16')](_0x10e3bd)));rp(_0x10e3bd)[_0xed2a('0x17')](function(_0x145c7b){_0x786f8c=!_[_0xed2a('0x18')](_0x786f8c)?_0xed2a('0x19')+_0x786f8c:'';_0x2b6e40=typeof _0x145c7b[_0xed2a('0x13')]===_0xed2a('0x1a')?JSON['stringify'](_0x145c7b['body']):_0x145c7b[_0xed2a('0x13')];logger[_0xed2a('0x1b')](util[_0xed2a('0x1c')](_0xed2a('0x1d'),_0x164d60['data1'],_0x164d60[_0xed2a('0x7')],_0x145c7b[_0xed2a('0x1e')],_0x2b6e40));})[_0xed2a('0x1f')](function(_0x1059db){logger[_0xed2a('0xd')](util[_0xed2a('0x1c')](_0xed2a('0x20'),_0x164d60[_0xed2a('0x4')],_0x164d60[_0xed2a('0x7')],_0x1059db['statusCode'],_0x1059db[_0xed2a('0x21')],_0x1059db['message']));});}; \ No newline at end of file +var _0xe6ce=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil','body','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','util','lodash','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','data7'];(function(_0xd008d9,_0x48c48c){var _0x470680=function(_0x380629){while(--_0x380629){_0xd008d9['push'](_0xd008d9['shift']());}};_0x470680(++_0x48c48c);}(_0xe6ce,0x1e9));var _0xee6c=function(_0x48cc02,_0x510c55){_0x48cc02=_0x48cc02-0x0;var _0x6b2545=_0xe6ce[_0x48cc02];return _0x6b2545;};'use strict';var rp=require('request-promise');var util=require(_0xee6c('0x0'));var _=require(_0xee6c('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0xee6c('0x2')]=function(_0x493824,_0x327585){var _0x4f8f45,_0x329da9;var _0x1bcc09={'method':_0x493824[_0xee6c('0x3')][_0xee6c('0x4')](),'uri':Mustache[_0xee6c('0x5')](_0x493824[_0xee6c('0x6')],_0x327585),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x493824[_0xee6c('0x7')])===_0xee6c('0x8')&&parseInt(_0x493824['data5'])>=0x1&&parseInt(_0x493824[_0xee6c('0x7')])<=0xa?parseInt(_0x493824[_0xee6c('0x7')])*0x3e8:0x5*0x3e8};try{_0x1bcc09[_0xee6c('0x9')]=_0x493824[_0xee6c('0xa')]?JSON[_0xee6c('0xb')](Mustache['render'](_0x493824[_0xee6c('0xa')],_0x327585)):{};}catch(_0x3c2c4c){logger[_0xee6c('0xc')](_0x3c2c4c[_0xee6c('0xd')]);}switch(_0x493824[_0xee6c('0x3')][_0xee6c('0x4')]()){case'GET':case'DELETE':_0x4f8f45=null;_0x1bcc09['qs']=_0x327585;break;case'POST':case'PUT':if(_0x493824[_0xee6c('0xe')]){try{_0x4f8f45=JSON[_0xee6c('0xb')](Mustache[_0xee6c('0x5')](_0x493824[_0xee6c('0xe')],_0x327585));_0x1bcc09['body']=_0x4f8f45;}catch(_0x4967b8){logger[_0xee6c('0xc')](_0x4967b8['stack']);logger[_0xee6c('0xc')](_0xee6c('0xf'));}}else{_0x4f8f45=_0x327585;_0x1bcc09['body']=_0x4f8f45;}break;}logger[_0xee6c('0x10')](util[_0xee6c('0x11')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x493824[_0xee6c('0x3')],_0x493824[_0xee6c('0x6')],JSON[_0xee6c('0x12')](_0x1bcc09)));rp(_0x1bcc09)[_0xee6c('0x13')](function(_0x4c2c08){_0x4f8f45=!_[_0xee6c('0x14')](_0x4f8f45)?',\x20request\x20body:\x20'+_0x4f8f45:'';_0x329da9=typeof _0x4c2c08[_0xee6c('0x15')]===_0xee6c('0x16')?JSON[_0xee6c('0x12')](_0x4c2c08[_0xee6c('0x15')]):_0x4c2c08['body'];logger[_0xee6c('0x10')](util[_0xee6c('0x11')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x493824['data1'],_0x493824[_0xee6c('0x6')],_0x4c2c08['statusCode'],_0x329da9));})[_0xee6c('0x17')](function(_0x7db75a){logger[_0xee6c('0xc')](util[_0xee6c('0x11')](_0xee6c('0x18'),_0x493824[_0xee6c('0x3')],_0x493824[_0xee6c('0x6')],_0x7db75a[_0xee6c('0x19')],_0x7db75a[_0xee6c('0x1a')],_0x7db75a[_0xee6c('0x1b')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e4669c3..4bc7523 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 _0xad4a=['jayson/promise','routing','client','Request','request','rpc','error','message','result','catch'];(function(_0x53fb9a,_0x560bc9){var _0x494b4e=function(_0x588e61){while(--_0x588e61){_0x53fb9a['push'](_0x53fb9a['shift']());}};_0x494b4e(++_0x560bc9);}(_0xad4a,0x168));var _0xaad4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xad4a[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0xaad4('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xaad4('0x1'));var client=jayson[_0xaad4('0x2')]['http']({'port':0x2329});client[_0xaad4('0x3')]=function(_0x2fcf3a,_0x2c8ca9){return new BPromise(function(_0xee281e,_0x8c4fd7){return client[_0xaad4('0x4')](_0x2fcf3a,_0x2c8ca9)['then'](function(_0x5d742a){logger['debug'](_0xaad4('0x5'),_0xaad4('0x1'),_0x2fcf3a,_0x2c8ca9,_0x5d742a);if(_0x5d742a[_0xaad4('0x6')]){logger[_0xaad4('0x6')](_0xaad4('0x5'),_0xaad4('0x1'),_0x2fcf3a,_0x5d742a[_0xaad4('0x6')]['message'],_0x2c8ca9);return _0x8c4fd7(_0x5d742a[_0xaad4('0x6')][_0xaad4('0x7')]);}else{return _0xee281e(_0x5d742a[_0xaad4('0x8')]);}})[_0xaad4('0x9')](function(_0x2ef44d){logger[_0xaad4('0x6')](_0xaad4('0x5'),'routing',_0x2fcf3a,_0x2ef44d,_0x2c8ca9);return _0x8c4fd7(_0x2ef44d);});});};module['exports']=client; \ No newline at end of file +var _0x6482=['message','result','catch','jayson/promise','bluebird','routing','http','Request','request','then','debug','rpc','error'];(function(_0x464059,_0x143e2b){var _0x2ee156=function(_0x39a773){while(--_0x39a773){_0x464059['push'](_0x464059['shift']());}};_0x2ee156(++_0x143e2b);}(_0x6482,0x1ca));var _0x2648=function(_0x5aeb6c,_0x428f4f){_0x5aeb6c=_0x5aeb6c-0x0;var _0x5676b3=_0x6482[_0x5aeb6c];return _0x5676b3;};'use strict';var jayson=require(_0x2648('0x0'));var BPromise=require(_0x2648('0x1'));var logger=require('../../config/logger')(_0x2648('0x2'));var client=jayson['client'][_0x2648('0x3')]({'port':0x2329});client[_0x2648('0x4')]=function(_0x29025d,_0x3db546){return new BPromise(function(_0x5ef978,_0x538302){return client[_0x2648('0x5')](_0x29025d,_0x3db546)[_0x2648('0x6')](function(_0x4e389a){logger[_0x2648('0x7')](_0x2648('0x8'),_0x2648('0x2'),_0x29025d,_0x3db546,_0x4e389a);if(_0x4e389a[_0x2648('0x9')]){logger[_0x2648('0x9')](_0x2648('0x8'),_0x2648('0x2'),_0x29025d,_0x4e389a[_0x2648('0x9')][_0x2648('0xa')],_0x3db546);return _0x538302(_0x4e389a['error'][_0x2648('0xa')]);}else{return _0x5ef978(_0x4e389a[_0x2648('0xb')]);}})[_0x2648('0xc')](function(_0x2f2a2c){logger[_0x2648('0x9')](_0x2648('0x8'),'routing',_0x29025d,_0x2f2a2c,_0x3db546);return _0x538302(_0x2f2a2c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 670ce80..5b2b9c1 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 _0x1267=['mailAccounts','listen','getSettings','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','then','getMailAccounts'];(function(_0x437aa2,_0x48d508){var _0x28ac4d=function(_0x4afc37){while(--_0x4afc37){_0x437aa2['push'](_0x437aa2['shift']());}};_0x28ac4d(++_0x48d508);}(_0x1267,0x172));var _0x7126=function(_0x5df926,_0x39e347){_0x5df926=_0x5df926-0x0;var _0x216064=_0x1267[_0x5df926];return _0x216064;};'use strict';var server=require('./server');var Realtime=require(_0x7126('0x0'));var EmailChannel=require(_0x7126('0x1'));var mailAccount=require(_0x7126('0x2'));var setting=require(_0x7126('0x3'));var logger=require(_0x7126('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x7126('0x5')](mailAccount[_0x7126('0x6')]())[_0x7126('0x5')](realtime['initMailAccounts']())[_0x7126('0x5')](function(){email['refresh'](realtime[_0x7126('0x7')]);return realtime;});}function main(){return server[_0x7126('0x8')](realtime,email)[_0x7126('0x5')](function(){return initRealtime();})[_0x7126('0x5')](function(){return setting[_0x7126('0x9')]();})[_0x7126('0x5')](function(_0x53cbf4){return setInterval(initRealtime,_0x53cbf4['loginMailFrequency']*0x3e8);})[_0x7126('0xa')](function(_0x3f5146){logger[_0x7126('0xb')](_0x7126('0xc'),_0x3f5146);});}main(); \ No newline at end of file +var _0xc5a1=['Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','error'];(function(_0x2fc530,_0x28412b){var _0x349913=function(_0x5427f6){while(--_0x5427f6){_0x2fc530['push'](_0x2fc530['shift']());}};_0x349913(++_0x28412b);}(_0xc5a1,0x1dd));var _0x1c5a=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0xc5a1[_0x33d4a2];return _0x2c793f;};'use strict';var server=require(_0x1c5a('0x0'));var Realtime=require(_0x1c5a('0x1'));var EmailChannel=require(_0x1c5a('0x2'));var mailAccount=require(_0x1c5a('0x3'));var setting=require(_0x1c5a('0x4'));var logger=require(_0x1c5a('0x5'))(_0x1c5a('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x1c5a('0x7')](mailAccount[_0x1c5a('0x8')]())[_0x1c5a('0x7')](realtime[_0x1c5a('0x9')]())[_0x1c5a('0x7')](function(){email[_0x1c5a('0xa')](realtime[_0x1c5a('0xb')]);return realtime;});}function main(){return server[_0x1c5a('0xc')](realtime,email)[_0x1c5a('0x7')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x1c5a('0x7')](function(_0x3d1db0){return setInterval(initRealtime,_0x3d1db0[_0x1c5a('0xd')]*0x3e8);})[_0x1c5a('0xe')](function(_0x22a3cb){logger[_0x1c5a('0xf')](_0x1c5a('0x10'),_0x22a3cb);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index fe68790..089c918 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 _0x7f09=['custom','service','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','handleImapError','status','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','stringify','smtp','verifySmtp','Smtp','lastSync','verify','then','verified','catch','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','Imap','messageStatus','total','isNil','mailAccount:update','prototype','refresh','provider'];(function(_0x1df63e,_0x13649a){var _0x5eaf1a=function(_0xdf1d45){while(--_0xdf1d45){_0x1df63e['push'](_0x1df63e['shift']());}};_0x5eaf1a(++_0x13649a);}(_0x7f09,0x1dd));var _0x97f0=function(_0x47ec84,_0x547331){_0x47ec84=_0x47ec84-0x0;var _0x2e7a80=_0x7f09[_0x47ec84];return _0x2e7a80;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x97f0('0x0'));var md5=require(_0x97f0('0x1'));var Redis=require(_0x97f0('0x2'));var config=require(_0x97f0('0x3'));var logger=require(_0x97f0('0x4'))(_0x97f0('0x5'));config[_0x97f0('0x6')]=_[_0x97f0('0x7')](config[_0x97f0('0x6')],{'host':_0x97f0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x97f0('0x6')]));var EmailImap=require(_0x97f0('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x97f0('0xa'));var md5Accounts={};function EmailChannel(_0x2ec1dd){logger[_0x97f0('0xb')](_0x97f0('0xc'));this['mailAccounts']=_0x2ec1dd[_0x97f0('0xd')];this[_0x97f0('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x97f0('0xf')]=function(_0x251e1b){var _0x218036=this[_0x97f0('0xd')][_0x251e1b];var _0x440227={'id':_0x218036['id'],'name':_0x218036[_0x97f0('0x10')],'key':_0x218036[_0x97f0('0x11')],'active':_0x218036[_0x97f0('0x12')],'Imap':{'status':_0x218036[_0x97f0('0x13')]['status'],'messageStatus':_0x218036[_0x97f0('0x13')][_0x97f0('0x14')],'total':_0x218036[_0x97f0('0x13')][_0x97f0('0x15')]}};if(_[_0x97f0('0x16')](md5Accounts[_0x251e1b])){md5Accounts[_0x251e1b]={};}var _0x32ec08=md5(JSON['stringify'](_0x440227));if(md5Accounts[_0x251e1b][_0x97f0('0x1')]!==_0x32ec08){md5Accounts[_0x251e1b][_0x97f0('0x1')]=_0x32ec08;io[_0x97f0('0xf')](_0x97f0('0x17'),_0x440227);}};EmailChannel[_0x97f0('0x18')][_0x97f0('0x19')]=function(_0x182387){for(var _0x4f32e1 in _0x182387){if(_0x182387['hasOwnProperty'](_0x4f32e1)){if(_0x182387[_0x4f32e1][_0x97f0('0x13')]&&_0x182387[_0x4f32e1][_0x97f0('0x12')]){var _0x3d3746=_0x182387[_0x4f32e1][_0x97f0('0x13')];if(!_0x3d3746['service']&&_0x182387[_0x4f32e1][_0x97f0('0x1a')]!==_0x97f0('0x1b'))_0x3d3746[_0x97f0('0x1c')]=_0x182387[_0x4f32e1][_0x97f0('0x1a')];if(!this[_0x97f0('0xe')][_0x97f0('0x1d')](_0x3d3746['id'])){this[_0x97f0('0xe')][_0x3d3746['id']]=new EmailImap(_0x3d3746,_0x182387[_0x4f32e1][_0x97f0('0x5')]);this[_0x97f0('0xe')][_0x3d3746['id']]['on'](_0x97f0('0x1e'),this[_0x97f0('0x1f')][_0x97f0('0x20')](this,_0x4f32e1));this['imapAccounts'][_0x3d3746['id']]['on'](_0x97f0('0x5'),this['handleImapEmail'][_0x97f0('0x20')](this,_0x4f32e1));this[_0x97f0('0xe')][_0x3d3746['id']]['on'](_0x97f0('0x21'),this[_0x97f0('0x22')][_0x97f0('0x20')](this,_0x4f32e1));this[_0x97f0('0xe')][_0x3d3746['id']]['on']('error',this[_0x97f0('0x23')]['bind'](this,_0x4f32e1));}}else{if(_[_0x97f0('0x16')](this[_0x97f0('0xd')][_0x4f32e1][_0x97f0('0x13')])){this[_0x97f0('0xd')][_0x4f32e1][_0x97f0('0x13')]={};}this[_0x97f0('0xd')][_0x4f32e1][_0x97f0('0x13')][_0x97f0('0x24')]=_0x97f0('0x25');this[_0x97f0('0xd')][_0x4f32e1]['Imap']['messageStatus']='';this[_0x97f0('0xf')](_0x4f32e1);}}}};EmailChannel[_0x97f0('0x18')][_0x97f0('0x1f')]=function(_0x1db035,_0x92edf2){if(this[_0x97f0('0xd')][_0x1db035]){this[_0x97f0('0xd')][_0x1db035]['Imap'][_0x97f0('0x24')]=_0x97f0('0x26');this[_0x97f0('0xd')][_0x1db035][_0x97f0('0x13')]['messageStatus']=_0x92edf2[_0x97f0('0x10')];if(_0x92edf2[_0x97f0('0x27')]){this[_0x97f0('0xd')][_0x1db035][_0x97f0('0x13')][_0x97f0('0x15')]=_0x92edf2['messages'][_0x97f0('0x15')];}return this[_0x97f0('0xf')](_0x1db035);}};EmailChannel[_0x97f0('0x18')][_0x97f0('0x28')]=function(_0x428907,_0x686200){logger[_0x97f0('0xb')](_0x97f0('0x29'),_0x686200[_0x97f0('0x2a')],_0x686200[_0x97f0('0x2b')],_0x686200[_0x97f0('0x2c')],_0x428907);if(this[_0x97f0('0xd')][_0x428907]){return mailAccount[_0x97f0('0x2d')](_0x428907,_0x686200)['then'](function(_0x3e40cf){if(_0x3e40cf){logger[_0x97f0('0xb')](_0x97f0('0x2e'));}})['catch'](function(_0x41ec0b){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x97f0('0x2f')](_0x41ec0b));});}};EmailChannel[_0x97f0('0x18')][_0x97f0('0x22')]=function(_0x269f60){if(this['mailAccounts'][_0x269f60]&&this[_0x97f0('0xd')][_0x269f60][_0x97f0('0x13')]){if(this[_0x97f0('0xe')][this[_0x97f0('0xd')][_0x269f60][_0x97f0('0x13')]['id']]){delete this[_0x97f0('0xe')][this[_0x97f0('0xd')][_0x269f60][_0x97f0('0x13')]['id']];}this[_0x97f0('0xd')][_0x269f60][_0x97f0('0x13')]['lastSync']=moment();this['emit'](_0x269f60);}};EmailChannel[_0x97f0('0x18')][_0x97f0('0x23')]=function(_0x351cc7,_0x4cca37){if(this[_0x97f0('0xd')][_0x351cc7]){this[_0x97f0('0xd')][_0x351cc7]['Imap']['status']='error';this['mailAccounts'][_0x351cc7][_0x97f0('0x13')][_0x97f0('0x14')]=_0x4cca37;return this[_0x97f0('0xf')](_0x351cc7);}};EmailChannel[_0x97f0('0x18')]['sendMail']=function(_0x59d0a8,_0x454be0){return this[_0x97f0('0x30')]['send'](_0x59d0a8,_0x454be0);};EmailChannel[_0x97f0('0x18')][_0x97f0('0x31')]=function(_0x16e98a){var _0x4750e3=this;if(this[_0x97f0('0xd')][_0x16e98a['id']]){if(_[_0x97f0('0x16')](this['mailAccounts'][_0x16e98a['id']][_0x97f0('0x32')])){this['mailAccounts'][_0x16e98a['id']][_0x97f0('0x32')]={};}this[_0x97f0('0xd')][_0x16e98a['id']][_0x97f0('0x32')][_0x97f0('0x33')]=moment();return new BPromise(function(_0x47f455,_0x52fde2){return _0x4750e3[_0x97f0('0x30')][_0x97f0('0x34')](_0x16e98a)[_0x97f0('0x35')](function(_0x3e8c3d){_0x4750e3[_0x97f0('0xd')][_0x16e98a['id']]['Smtp'][_0x97f0('0x24')]=_0x97f0('0x36');_0x4750e3[_0x97f0('0xd')][_0x16e98a['id']][_0x97f0('0x32')]['messageStatus']='';_0x4750e3[_0x97f0('0xf')](_0x16e98a['id']);_0x47f455(_0x3e8c3d);})[_0x97f0('0x37')](function(_0x4a0e2d){_0x4750e3['mailAccounts'][_0x16e98a['id']][_0x97f0('0x32')][_0x97f0('0x24')]='error';_0x4750e3[_0x97f0('0xd')][_0x16e98a['id']][_0x97f0('0x32')][_0x97f0('0x14')]=_0x4a0e2d;_0x4750e3[_0x97f0('0xf')](_0x16e98a['id']);_0x52fde2(_0x4a0e2d);});});}return this[_0x97f0('0x30')]['verify'](_0x16e98a);};module['exports']=EmailChannel; \ No newline at end of file +var _0x9f28=['status','messageStatus','isNil','refresh','hasOwnProperty','provider','service','email','box','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','connected','messages','total','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','sendMail','send','Smtp','lastSync','verify','verified','catch','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap'];(function(_0x169292,_0x8ab021){var _0x1b3e11=function(_0x14a374){while(--_0x14a374){_0x169292['push'](_0x169292['shift']());}};_0x1b3e11(++_0x8ab021);}(_0x9f28,0x1f3));var _0x89f2=function(_0x1f3168,_0x114c5b){_0x1f3168=_0x1f3168-0x0;var _0x29c789=_0x9f28[_0x1f3168];return _0x29c789;};'use strict';var _=require(_0x89f2('0x0'));var moment=require('moment');var BPromise=require(_0x89f2('0x1'));var md5=require(_0x89f2('0x2'));var Redis=require(_0x89f2('0x3'));var config=require(_0x89f2('0x4'));var logger=require(_0x89f2('0x5'))('email');config['redis']=_[_0x89f2('0x6')](config[_0x89f2('0x7')],{'host':_0x89f2('0x8'),'port':0x18eb});var io=require(_0x89f2('0x9'))(new Redis(config[_0x89f2('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x89f2('0xa'));var mailAccount=require(_0x89f2('0xb'));var md5Accounts={};function EmailChannel(_0x587c4b){logger[_0x89f2('0xc')](_0x89f2('0xd'));this[_0x89f2('0xe')]=_0x587c4b[_0x89f2('0xe')];this[_0x89f2('0xf')]={};this[_0x89f2('0x10')]=new EmailSmtp();}EmailChannel[_0x89f2('0x11')][_0x89f2('0x12')]=function(_0x5e191a){var _0x47e88e=this[_0x89f2('0xe')][_0x5e191a];var _0x592b49={'id':_0x47e88e['id'],'name':_0x47e88e[_0x89f2('0x13')],'key':_0x47e88e[_0x89f2('0x14')],'active':_0x47e88e[_0x89f2('0x15')],'Imap':{'status':_0x47e88e[_0x89f2('0x16')][_0x89f2('0x17')],'messageStatus':_0x47e88e['Imap'][_0x89f2('0x18')],'total':_0x47e88e['Imap']['total']}};if(_[_0x89f2('0x19')](md5Accounts[_0x5e191a])){md5Accounts[_0x5e191a]={};}var _0x723854=md5(JSON['stringify'](_0x592b49));if(md5Accounts[_0x5e191a][_0x89f2('0x2')]!==_0x723854){md5Accounts[_0x5e191a][_0x89f2('0x2')]=_0x723854;io[_0x89f2('0x12')]('mailAccount:update',_0x592b49);}};EmailChannel[_0x89f2('0x11')][_0x89f2('0x1a')]=function(_0x5bfb46){for(var _0x42c89c in _0x5bfb46){if(_0x5bfb46[_0x89f2('0x1b')](_0x42c89c)){if(_0x5bfb46[_0x42c89c][_0x89f2('0x16')]&&_0x5bfb46[_0x42c89c][_0x89f2('0x15')]){var _0x2c292f=_0x5bfb46[_0x42c89c]['Imap'];if(!_0x2c292f['service']&&_0x5bfb46[_0x42c89c][_0x89f2('0x1c')]!=='custom')_0x2c292f[_0x89f2('0x1d')]=_0x5bfb46[_0x42c89c][_0x89f2('0x1c')];if(!this['imapAccounts'][_0x89f2('0x1b')](_0x2c292f['id'])){this['imapAccounts'][_0x2c292f['id']]=new EmailImap(_0x2c292f,_0x5bfb46[_0x42c89c][_0x89f2('0x1e')]);this['imapAccounts'][_0x2c292f['id']]['on'](_0x89f2('0x1f'),this[_0x89f2('0x20')][_0x89f2('0x21')](this,_0x42c89c));this[_0x89f2('0xf')][_0x2c292f['id']]['on'](_0x89f2('0x1e'),this[_0x89f2('0x22')][_0x89f2('0x21')](this,_0x42c89c));this[_0x89f2('0xf')][_0x2c292f['id']]['on']('end',this['handleImapEnd'][_0x89f2('0x21')](this,_0x42c89c));this['imapAccounts'][_0x2c292f['id']]['on'](_0x89f2('0x23'),this[_0x89f2('0x24')][_0x89f2('0x21')](this,_0x42c89c));}}else{if(_[_0x89f2('0x19')](this[_0x89f2('0xe')][_0x42c89c][_0x89f2('0x16')])){this['mailAccounts'][_0x42c89c][_0x89f2('0x16')]={};}this[_0x89f2('0xe')][_0x42c89c][_0x89f2('0x16')][_0x89f2('0x17')]=_0x89f2('0x25');this[_0x89f2('0xe')][_0x42c89c]['Imap'][_0x89f2('0x18')]='';this[_0x89f2('0x12')](_0x42c89c);}}}};EmailChannel[_0x89f2('0x11')][_0x89f2('0x20')]=function(_0x4db248,_0x3cb13c){if(this[_0x89f2('0xe')][_0x4db248]){this[_0x89f2('0xe')][_0x4db248][_0x89f2('0x16')]['status']=_0x89f2('0x26');this[_0x89f2('0xe')][_0x4db248][_0x89f2('0x16')]['messageStatus']=_0x3cb13c[_0x89f2('0x13')];if(_0x3cb13c[_0x89f2('0x27')]){this[_0x89f2('0xe')][_0x4db248]['Imap'][_0x89f2('0x28')]=_0x3cb13c[_0x89f2('0x27')]['total'];}return this[_0x89f2('0x12')](_0x4db248);}};EmailChannel[_0x89f2('0x11')][_0x89f2('0x22')]=function(_0x5694b7,_0x10d1d3){logger[_0x89f2('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x10d1d3[_0x89f2('0x29')],_0x10d1d3[_0x89f2('0x2a')],_0x10d1d3[_0x89f2('0x2b')],_0x5694b7);if(this[_0x89f2('0xe')][_0x5694b7]){return mailAccount[_0x89f2('0x2c')](_0x5694b7,_0x10d1d3)[_0x89f2('0x2d')](function(_0x14ff3e){if(_0x14ff3e){logger[_0x89f2('0xc')](_0x89f2('0x2e'));}})['catch'](function(_0x3a0867){logger['error'](_0x89f2('0x2f'),JSON[_0x89f2('0x30')](_0x3a0867));});}};EmailChannel[_0x89f2('0x11')][_0x89f2('0x31')]=function(_0x4681a8){if(this[_0x89f2('0xe')][_0x4681a8]&&this['mailAccounts'][_0x4681a8][_0x89f2('0x16')]){if(this[_0x89f2('0xf')][this['mailAccounts'][_0x4681a8]['Imap']['id']]){delete this[_0x89f2('0xf')][this[_0x89f2('0xe')][_0x4681a8][_0x89f2('0x16')]['id']];}this['mailAccounts'][_0x4681a8]['Imap']['lastSync']=moment();this[_0x89f2('0x12')](_0x4681a8);}};EmailChannel['prototype'][_0x89f2('0x24')]=function(_0x49dc93,_0x3950bf){if(this[_0x89f2('0xe')][_0x49dc93]){this[_0x89f2('0xe')][_0x49dc93][_0x89f2('0x16')][_0x89f2('0x17')]='error';this[_0x89f2('0xe')][_0x49dc93][_0x89f2('0x16')][_0x89f2('0x18')]=_0x3950bf;return this[_0x89f2('0x12')](_0x49dc93);}};EmailChannel[_0x89f2('0x11')][_0x89f2('0x32')]=function(_0x47c61f,_0x2a9d1d){return this[_0x89f2('0x10')][_0x89f2('0x33')](_0x47c61f,_0x2a9d1d);};EmailChannel[_0x89f2('0x11')]['verifySmtp']=function(_0x46d4e1){var _0x47c41d=this;if(this['mailAccounts'][_0x46d4e1['id']]){if(_[_0x89f2('0x19')](this[_0x89f2('0xe')][_0x46d4e1['id']][_0x89f2('0x34')])){this[_0x89f2('0xe')][_0x46d4e1['id']][_0x89f2('0x34')]={};}this['mailAccounts'][_0x46d4e1['id']][_0x89f2('0x34')][_0x89f2('0x35')]=moment();return new BPromise(function(_0x240dea,_0x4d33c1){return _0x47c41d[_0x89f2('0x10')][_0x89f2('0x36')](_0x46d4e1)['then'](function(_0x13c560){_0x47c41d[_0x89f2('0xe')][_0x46d4e1['id']][_0x89f2('0x34')][_0x89f2('0x17')]=_0x89f2('0x37');_0x47c41d[_0x89f2('0xe')][_0x46d4e1['id']]['Smtp'][_0x89f2('0x18')]='';_0x47c41d['emit'](_0x46d4e1['id']);_0x240dea(_0x13c560);})[_0x89f2('0x38')](function(_0x4e0ec9){_0x47c41d[_0x89f2('0xe')][_0x46d4e1['id']]['Smtp'][_0x89f2('0x17')]='error';_0x47c41d[_0x89f2('0xe')][_0x46d4e1['id']][_0x89f2('0x34')][_0x89f2('0x18')]=_0x4e0ec9;_0x47c41d[_0x89f2('0x12')](_0x46d4e1['id']);_0x4d33c1(_0x4e0ec9);});});}return this[_0x89f2('0x10')][_0x89f2('0x36')](_0x46d4e1);};module[_0x89f2('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f0ffc63..018761c 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 _0x4a2e=['box','readUnseen','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleCloseBox','stringify','textCode','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','account','once','ready','handleReady','handleEnd','bind','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox'];(function(_0x16e26e,_0x525320){var _0x34b13b=function(_0x254594){while(--_0x254594){_0x16e26e['push'](_0x16e26e['shift']());}};_0x34b13b(++_0x525320);}(_0x4a2e,0xe3));var _0xe4a2=function(_0x31c3d5,_0x40a38c){_0x31c3d5=_0x31c3d5-0x0;var _0x5424ba=_0x4a2e[_0x31c3d5];return _0x5424ba;};'use strict';var _=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var Imap=require(_0xe4a2('0x2'));var simpleParser=require(_0xe4a2('0x3'))[_0xe4a2('0x4')];var Iconv=require(_0xe4a2('0x5'))['Iconv'];var EventEmitter=require(_0xe4a2('0x6'))[_0xe4a2('0x7')];var utils=require(_0xe4a2('0x8'));var logger=require(_0xe4a2('0x9'))(_0xe4a2('0xa'));function EmailImap(_0x44a12a,_0x1003f4){this['mailbox']=_0x44a12a['mailbox'];this[_0xe4a2('0xb')]=this['getAccount'](_0x44a12a,_0x1003f4);this['imap']=new Imap(this[_0xe4a2('0xb')]);this['imap'][_0xe4a2('0xc')](_0xe4a2('0xd'),this[_0xe4a2('0xe')]['bind'](this));this['imap'][_0xe4a2('0xc')]('end',this[_0xe4a2('0xf')][_0xe4a2('0x10')](this));this[_0xe4a2('0x2')]['on']('error',this[_0xe4a2('0x11')][_0xe4a2('0x10')](this));this['imap'][_0xe4a2('0x12')]();}util[_0xe4a2('0x13')](EmailImap,EventEmitter);EmailImap[_0xe4a2('0x14')][_0xe4a2('0x15')]=function(_0x12430c,_0x47e30c){var _0x582f9a={'connTimeout':_0x12430c[_0xe4a2('0x16')]?_0x12430c[_0xe4a2('0x16')]*0x3e8:0x2710,'authTimeout':_0x12430c[_0xe4a2('0x17')]?_0x12430c['authTimeout']*0x3e8:0x1388};if(_0x12430c[_0xe4a2('0x18')]){_0x582f9a[_0xe4a2('0x19')]=_0x12430c[_0xe4a2('0x19')];if(_0x12430c[_0xe4a2('0x1a')]){_0x582f9a[_0xe4a2('0x1b')]=utils[_0xe4a2('0x1c')](_0x12430c[_0xe4a2('0x1d')][_0xe4a2('0x1e')],_0x12430c[_0xe4a2('0x19')]);}else{_0x582f9a[_0xe4a2('0x1f')]=_0x12430c['password'];}}else{if(_0x12430c[_0xe4a2('0x20')]){_0x582f9a[_0xe4a2('0x19')]=_0x12430c[_0xe4a2('0x19')];_0x582f9a[_0xe4a2('0x1f')]=_0x12430c['password'];}}_0x582f9a[_0xe4a2('0xa')]=_0x47e30c||_0x12430c['user']||_0xe4a2('0x21');_0x582f9a[_0xe4a2('0x22')]=_0x12430c[_0xe4a2('0x22')];_0x582f9a[_0xe4a2('0x23')]=_0x12430c[_0xe4a2('0x23')]||0x3e1;if(_0x12430c[_0xe4a2('0x24')]){_0x582f9a['tls']=!![];}else{_0x582f9a[_0xe4a2('0x24')]=![];_0x582f9a[_0xe4a2('0x25')]=_0xe4a2('0x26');}return _0x582f9a;};EmailImap[_0xe4a2('0x14')][_0xe4a2('0xe')]=function(){this['imap'][_0xe4a2('0x27')](this['mailbox'],![],this[_0xe4a2('0x28')][_0xe4a2('0x10')](this));};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x28')]=function(_0x46af4e,_0x1b2cc9){if(_0x46af4e){this[_0xe4a2('0x11')](_0x46af4e,!![]);}else{this['emit'](_0xe4a2('0x29'),_0x1b2cc9);this[_0xe4a2('0x2a')]();}};EmailImap[_0xe4a2('0x14')]['handleCloseBox']=function(_0x31fc39){if(_0x31fc39){this[_0xe4a2('0x11')](_0x31fc39,!![]);}else{this[_0xe4a2('0x2')][_0xe4a2('0x2b')]();}};EmailImap['prototype'][_0xe4a2('0x2a')]=function(){this[_0xe4a2('0x2')][_0xe4a2('0x2c')]([_0xe4a2('0x2d')],this[_0xe4a2('0x2e')]['bind'](this));};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x2e')]=function(_0x31d08a,_0x205bce){if(_0x31d08a){this['handleError'](_0x31d08a,!![]);}else{if(_0x205bce[_0xe4a2('0x2f')]){try{var _0x400927=this[_0xe4a2('0x2')][_0xe4a2('0x30')](_0x205bce,{'bodies':'','markSeen':!![]});_0x400927['on'](_0xe4a2('0x31'),this[_0xe4a2('0x32')][_0xe4a2('0x10')](this));_0x400927['once'](_0xe4a2('0x33'),this[_0xe4a2('0x34')][_0xe4a2('0x10')](this));_0x400927[_0xe4a2('0xc')](_0xe4a2('0x2b'),this[_0xe4a2('0x35')][_0xe4a2('0x10')](this));}catch(_0x1c6e55){logger[_0xe4a2('0x33')](_0x1c6e55);}}else{this[_0xe4a2('0x2')][_0xe4a2('0x36')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x32')]=function(_0x41e912){_0x41e912['on'](_0xe4a2('0x37'),this[_0xe4a2('0x38')][_0xe4a2('0x10')](this));_0x41e912['once'](_0xe4a2('0x39'),this[_0xe4a2('0x3a')]['bind'](this));_0x41e912[_0xe4a2('0xc')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0xe4a2('0x14')]['handleMessageBody']=function(_0x52b95b){simpleParser(_0x52b95b,{'Iconv':Iconv},this['handleSimpleParser'][_0xe4a2('0x10')](this));};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x3a')]=function(){};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x3b')]=function(){};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x3c')]=function(_0x2c5a87,_0x549434){if(_0x2c5a87){logger[_0xe4a2('0x33')](_0x2c5a87);}else{var _0x2e2486=this;utils[_0xe4a2('0x3d')](this[_0xe4a2('0xb')],_0x549434,function(_0x15c06a){_0x2e2486[_0xe4a2('0x3e')](_0xe4a2('0xa'),_0x15c06a);});}};EmailImap[_0xe4a2('0x14')]['handleFetchEnd']=function(){this[_0xe4a2('0x2')][_0xe4a2('0x36')](!![],this[_0xe4a2('0x3f')]['bind'](this));};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x34')]=function(_0x285e54){this[_0xe4a2('0x11')](_0x285e54);this['imap'][_0xe4a2('0x36')](!![],this[_0xe4a2('0x3f')][_0xe4a2('0x10')](this));};EmailImap['prototype'][_0xe4a2('0xf')]=function(){this[_0xe4a2('0x3e')](_0xe4a2('0x2b'));};EmailImap[_0xe4a2('0x14')][_0xe4a2('0x11')]=function(_0x3fc20e,_0x19ff53){logger[_0xe4a2('0x33')]('handleError',this[_0xe4a2('0xb')][_0xe4a2('0xa')],JSON[_0xe4a2('0x40')](_0x3fc20e));var _0x3c073a='';if(_0x3fc20e){if(_0x3fc20e[_0xe4a2('0x41')]){_0x3c073a=_0x3fc20e['textCode'];}else{for(var _0x1eee01 in _0x3fc20e){if(_0x3fc20e['hasOwnProperty'](_0x1eee01)){_0x3c073a+=_[_0xe4a2('0x42')](_0x1eee01)+':\x20'+_0x3fc20e[_0x1eee01]+'\x0a';}}}}if(_0x19ff53){this['imap'][_0xe4a2('0x2b')]();}else{this[_0xe4a2('0x3e')](_0xe4a2('0x33'),_0x3c073a);this[_0xe4a2('0x3e')](_0xe4a2('0x2b'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x76b4=['stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','mailbox','account','getAccount','once','ready','end','handleEnd','bind','error','inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','email','host','port','tls','autotls','prototype','handleReady','openBox','handleOpenBox','handleError','emit','box','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0x690b77,_0x2d71ba){var _0x5eabce=function(_0x5a074e){while(--_0x5a074e){_0x690b77['push'](_0x690b77['shift']());}};_0x5eabce(++_0x2d71ba);}(_0x76b4,0xbc));var _0x476b=function(_0x369c53,_0x3f9eb2){_0x369c53=_0x369c53-0x0;var _0x2c00e2=_0x76b4[_0x369c53];return _0x2c00e2;};'use strict';var _=require(_0x476b('0x0'));var util=require(_0x476b('0x1'));var Imap=require(_0x476b('0x2'));var simpleParser=require(_0x476b('0x3'))[_0x476b('0x4')];var Iconv=require(_0x476b('0x5'))['Iconv'];var EventEmitter=require(_0x476b('0x6'))[_0x476b('0x7')];var utils=require('./utils');var logger=require(_0x476b('0x8'))('email');function EmailImap(_0x4a1773,_0x4e303d){this['mailbox']=_0x4a1773[_0x476b('0x9')];this[_0x476b('0xa')]=this[_0x476b('0xb')](_0x4a1773,_0x4e303d);this[_0x476b('0x2')]=new Imap(this[_0x476b('0xa')]);this[_0x476b('0x2')][_0x476b('0xc')](_0x476b('0xd'),this['handleReady']['bind'](this));this['imap']['once'](_0x476b('0xe'),this[_0x476b('0xf')][_0x476b('0x10')](this));this[_0x476b('0x2')]['on'](_0x476b('0x11'),this['handleError'][_0x476b('0x10')](this));this[_0x476b('0x2')]['connect']();}util[_0x476b('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x476b('0xb')]=function(_0x51e35d,_0xd09f1d){var _0x471c90={'connTimeout':_0x51e35d[_0x476b('0x13')]?_0x51e35d['connTimeout']*0x3e8:0x2710,'authTimeout':_0x51e35d[_0x476b('0x14')]?_0x51e35d[_0x476b('0x14')]*0x3e8:0x1388};if(_0x51e35d[_0x476b('0x15')]){_0x471c90[_0x476b('0x16')]=_0x51e35d[_0x476b('0x16')];if(_0x51e35d[_0x476b('0x17')]){_0x471c90[_0x476b('0x18')]=utils[_0x476b('0x19')](_0x51e35d[_0x476b('0x1a')][_0x476b('0x1b')],_0x51e35d[_0x476b('0x16')]);}else{_0x471c90['password']=_0x51e35d[_0x476b('0x1c')];}}else{if(_0x51e35d['authentication']){_0x471c90[_0x476b('0x16')]=_0x51e35d['user'];_0x471c90['password']=_0x51e35d[_0x476b('0x1c')];}}_0x471c90[_0x476b('0x1d')]=_0xd09f1d||_0x51e35d['user']||'anonymous@xcally.com';_0x471c90[_0x476b('0x1e')]=_0x51e35d[_0x476b('0x1e')];_0x471c90['port']=_0x51e35d[_0x476b('0x1f')]||0x3e1;if(_0x51e35d[_0x476b('0x20')]){_0x471c90[_0x476b('0x20')]=!![];}else{_0x471c90[_0x476b('0x20')]=![];_0x471c90[_0x476b('0x21')]='required';}return _0x471c90;};EmailImap[_0x476b('0x22')][_0x476b('0x23')]=function(){this['imap'][_0x476b('0x24')](this[_0x476b('0x9')],![],this[_0x476b('0x25')][_0x476b('0x10')](this));};EmailImap[_0x476b('0x22')][_0x476b('0x25')]=function(_0x54d336,_0x1e1fd9){if(_0x54d336){this[_0x476b('0x26')](_0x54d336,!![]);}else{this[_0x476b('0x27')](_0x476b('0x28'),_0x1e1fd9);this['readUnseen']();}};EmailImap[_0x476b('0x22')][_0x476b('0x29')]=function(_0x31ca9c){if(_0x31ca9c){this[_0x476b('0x26')](_0x31ca9c,!![]);}else{this['imap'][_0x476b('0xe')]();}};EmailImap[_0x476b('0x22')]['readUnseen']=function(){this['imap'][_0x476b('0x2a')](['UNSEEN'],this[_0x476b('0x2b')]['bind'](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4ac002,_0xcea74c){if(_0x4ac002){this[_0x476b('0x26')](_0x4ac002,!![]);}else{if(_0xcea74c[_0x476b('0x2c')]){try{var _0x4776e3=this[_0x476b('0x2')][_0x476b('0x2d')](_0xcea74c,{'bodies':'','markSeen':!![]});_0x4776e3['on'](_0x476b('0x2e'),this[_0x476b('0x2f')]['bind'](this));_0x4776e3[_0x476b('0xc')](_0x476b('0x11'),this[_0x476b('0x30')][_0x476b('0x10')](this));_0x4776e3[_0x476b('0xc')](_0x476b('0xe'),this[_0x476b('0x31')][_0x476b('0x10')](this));}catch(_0x593a5c){logger[_0x476b('0x11')](_0x593a5c);}}else{this[_0x476b('0x2')][_0x476b('0x32')](!![],this[_0x476b('0x29')][_0x476b('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x46dc41){_0x46dc41['on']('body',this[_0x476b('0x33')][_0x476b('0x10')](this));_0x46dc41[_0x476b('0xc')](_0x476b('0x34'),this[_0x476b('0x35')]['bind'](this));_0x46dc41['once'](_0x476b('0xe'),this['handleMessageEnd'][_0x476b('0x10')](this));};EmailImap['prototype'][_0x476b('0x33')]=function(_0x5d4fa7){simpleParser(_0x5d4fa7,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x476b('0x22')][_0x476b('0x35')]=function(){};EmailImap[_0x476b('0x22')][_0x476b('0x36')]=function(){};EmailImap[_0x476b('0x22')][_0x476b('0x37')]=function(_0x54da20,_0x55099e){if(_0x54da20){logger['error'](_0x54da20);}else{var _0x33ab00=this;utils['parser'](this[_0x476b('0xa')],_0x55099e,function(_0x1039c3){_0x33ab00[_0x476b('0x27')](_0x476b('0x1d'),_0x1039c3);});}};EmailImap[_0x476b('0x22')][_0x476b('0x31')]=function(){this[_0x476b('0x2')][_0x476b('0x32')](!![],this[_0x476b('0x29')][_0x476b('0x10')](this));};EmailImap[_0x476b('0x22')][_0x476b('0x30')]=function(_0x13a995){this[_0x476b('0x26')](_0x13a995);this['imap'][_0x476b('0x32')](!![],this[_0x476b('0x29')][_0x476b('0x10')](this));};EmailImap[_0x476b('0x22')][_0x476b('0xf')]=function(){this['emit']('end');};EmailImap[_0x476b('0x22')][_0x476b('0x26')]=function(_0xc43e7f,_0x1e32be){logger[_0x476b('0x11')](_0x476b('0x26'),this[_0x476b('0xa')]['email'],JSON[_0x476b('0x38')](_0xc43e7f));var _0x23e349='';if(_0xc43e7f){if(_0xc43e7f['textCode']){_0x23e349=_0xc43e7f[_0x476b('0x39')];}else{for(var _0x1ac351 in _0xc43e7f){if(_0xc43e7f[_0x476b('0x3a')](_0x1ac351)){_0x23e349+=_[_0x476b('0x3b')](_0x1ac351)+':\x20'+_0xc43e7f[_0x1ac351]+'\x0a';}}}}if(_0x1e32be){this[_0x476b('0x2')][_0x476b('0xe')]();}else{this['emit'](_0x476b('0x11'),_0x23e349);this[_0x476b('0x27')](_0x476b('0xe'));}};module[_0x476b('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2995b2a..201b291 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 _0x2543=['prototype','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','send','use','sendMail','toString'];(function(_0x1275b7,_0x457830){var _0x38524b=function(_0x51df7e){while(--_0x51df7e){_0x1275b7['push'](_0x1275b7['shift']());}};_0x38524b(++_0x457830);}(_0x2543,0xe5));var _0x3254=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x2543[_0x870b62];return _0x2dcb39;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x3254('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x3254('0x1')]=function(_0x1d1263,_0x6fb99c){return new Promise(function(_0x2f0e0e,_0x567432){var _0x47a88f=nodemailer['createTransport'](_0x1d1263);_0x47a88f[_0x3254('0x2')]('compile',inlineBase64());_0x47a88f[_0x3254('0x3')](_0x6fb99c,function(_0x1718df,_0x11fd45){if(_0x1718df){_0x567432(_0x1718df[_0x3254('0x4')]());}else{_0x2f0e0e(_0x11fd45);}});});};EmailSmtp[_0x3254('0x5')][_0x3254('0x6')]=function(_0x3b9284){return new Promise(function(_0xb8e404,_0x3c054f){var _0xfb4705=nodemailer['createTransport'](_0x3b9284);_0xfb4705['verify'](function(_0x70d86f,_0x295bd3){if(_0x70d86f){_0x3c054f(_0x70d86f[_0x3254('0x4')]());}else{if(_0x295bd3){_0xb8e404(_0x295bd3);}else{_0x3c054f(_0x3254('0x7'));}}});});};module[_0x3254('0x8')]=EmailSmtp; \ No newline at end of file +var _0xaea3=['createTransport','use','sendMail','toString','prototype','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3f9138,_0x57aa27){var _0x224d79=function(_0x1aff24){while(--_0x1aff24){_0x3f9138['push'](_0x3f9138['shift']());}};_0x224d79(++_0x57aa27);}(_0xaea3,0x9e));var _0x3aea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaea3[_0x14add3];return _0x4a174f;};'use strict';var nodemailer=require(_0x3aea('0x0'));var inlineBase64=require(_0x3aea('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x34f6bb,_0x2816ea){return new Promise(function(_0x423445,_0x45e8cf){var _0x41cc11=nodemailer[_0x3aea('0x2')](_0x34f6bb);_0x41cc11[_0x3aea('0x3')]('compile',inlineBase64());_0x41cc11[_0x3aea('0x4')](_0x2816ea,function(_0x5dd325,_0x51062f){if(_0x5dd325){_0x45e8cf(_0x5dd325[_0x3aea('0x5')]());}else{_0x423445(_0x51062f);}});});};EmailSmtp[_0x3aea('0x6')][_0x3aea('0x7')]=function(_0x220c04){return new Promise(function(_0x269763,_0x9927df){var _0xffdc50=nodemailer[_0x3aea('0x2')](_0x220c04);_0xffdc50['verify'](function(_0x36f37b,_0x210ed9){if(_0x36f37b){_0x9927df(_0x36f37b[_0x3aea('0x5')]());}else{if(_0x210ed9){_0x269763(_0x210ed9);}else{_0x9927df(_0x3aea('0x8'));}}});});};module[_0x3aea('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3d9389b..dedd1fa 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 _0x4227=['Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','split','slice','join','length','pop','test','html','replace','includes','\x20[Attachment:\x20','\x20]','textAsHtml','body','message','originTo','isEmpty','originCc','type','attachment','%s-%s','now','root','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','isAutoreply','from','subject','messageId','inReplyTo','date','format','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','

Empty\x20message

'];(function(_0x3fbeb6,_0x39f7c9){var _0x54d386=function(_0x473336){while(--_0x473336){_0x3fbeb6['push'](_0x3fbeb6['shift']());}};_0x54d386(++_0x39f7c9);}(_0x4227,0x121));var _0x7422=function(_0x1c515a,_0xdbd7ca){_0x1c515a=_0x1c515a-0x0;var _0x3e820d=_0x4227[_0x1c515a];return _0x3e820d;};'use strict';var _=require(_0x7422('0x0'));var moment=require(_0x7422('0x1'));var random=require(_0x7422('0x2'));var fs=require('fs');var path=require(_0x7422('0x3'));var util=require('util');var tnef=require(_0x7422('0x4'));var logger=require(_0x7422('0x5'))(_0x7422('0x6'));var config=require(_0x7422('0x7'));function getAddress(_0x2d9e98){var _0x2b55db=_['head'](_0x2d9e98[_0x7422('0x8')]);return _0x2b55db&&_0x2b55db[_0x7422('0x9')]?_0x2b55db[_0x7422('0x9')]:_0x7422('0xa')+random[_0x7422('0xb')](0x6)+_0x7422('0xc');}function getFirstName(_0xecbd59){var _0x3a9c58=_[_0x7422('0xd')](_0xecbd59[_0x7422('0x8')]);if(_0x3a9c58&&_0x3a9c58[_0x7422('0xe')]){if(_0x3a9c58[_0x7422('0xe')]==_0x3a9c58[_0x7422('0x9')]){return _0x3a9c58[_0x7422('0xe')][_0x7422('0xf')](0x0,_0x3a9c58['name']['indexOf']('@'));}var _0x3ec978=_0x3a9c58[_0x7422('0xe')][_0x7422('0x10')](/\s+/);return _0x3ec978['length']>0x1?_0x3ec978[_0x7422('0x11')](0x0,-0x1)[_0x7422('0x12')]('\x20'):_0x3a9c58[_0x7422('0xe')];}return'Anonymous';}function getLastName(_0x2b0054){var _0x80e668=_[_0x7422('0xd')](_0x2b0054[_0x7422('0x8')]);if(_0x80e668&&_0x80e668[_0x7422('0xe')]){var _0x5a161d=_0x80e668['name']['split'](/\s+/);return _0x5a161d[_0x7422('0x13')]>0x1?_0x5a161d[_0x7422('0x14')]():'';}return'';}function getMails(_0x145641,_0x2ac178){var _0x349c08='';for(var _0x26ce16=0x0;_0x26ce16<_0x2ac178['value'][_0x7422('0x13')];_0x26ce16+=0x1){if(_0x2ac178['value'][_0x26ce16][_0x7422('0x9')]!==_0x145641){if(!_['isEmpty'](_0x349c08)){_0x349c08+=',';}_0x349c08+=_0x2ac178[_0x7422('0x8')][_0x26ce16][_0x7422('0xe')]||_0x2ac178[_0x7422('0x8')][_0x26ce16][_0x7422('0x9')]||'';_0x349c08+='\x20<';_0x349c08+=_0x2ac178['value'][_0x26ce16][_0x7422('0x9')]?_0x2ac178['value'][_0x26ce16][_0x7422('0x9')]:_0x7422('0xa')+random[_0x7422('0xb')](0x6)+_0x7422('0xc');_0x349c08+='>';}}return _0x349c08;}function parseEmail(_0x24848f,_0x2a242d,_0x2d29cc){if(_0x2a242d['html']){var _0x317c0a=/)<[^<]*)*<\/script>/gi;while(_0x317c0a[_0x7422('0x15')](_0x2a242d[_0x7422('0x16')])){_0x2a242d['html']=_0x2a242d['html'][_0x7422('0x17')](_0x317c0a,'');}if(_0x2a242d[_0x7422('0x16')][_0x7422('0x18')](_0x7422('0x19'))){var _0x5ef96f=[];_0x2a242d[_0x7422('0x1a')][_0x7422('0x1b')](_0xd4dfed=>{_0x5ef96f[_0x7422('0x1c')](_0xd4dfed[_0x7422('0x1d')]);});var _0x45734f=/]+>/g;var _0x25bf5d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1bd1ce=_0x2a242d[_0x7422('0x16')][_0x7422('0x17')](_0x25bf5d,'_SRC');var _0x2b4bc5=_0x1bd1ce[_0x7422('0x17')](_0x45734f,_0x7422('0x1e'));for(let _0x16c9b7=0x0;_0x16c9b7<_0x5ef96f[_0x7422('0x13')];_0x16c9b7++){var _0x37d97d=_0x2b4bc5[_0x7422('0x17')]('_IMG',_0x7422('0x1f')+_0x5ef96f[_0x16c9b7]+_0x7422('0x20'));_0x2b4bc5=_0x37d97d;}_0x2a242d[_0x7422('0x16')]=_0x2b4bc5;}_0x2d29cc['body']=_0x2a242d[_0x7422('0x16')];}else{_0x2d29cc['body']=_0x2a242d[_0x7422('0x21')];}if(_0x2d29cc[_0x7422('0x22')]){_0x2d29cc[_0x7422('0x22')]=_0x2d29cc[_0x7422('0x22')][_0x7422('0x17')](/0x0){var _0x2e61ec=[_0x7422('0x2e'),_0x7422('0x2f'),'Precedence:\x20auto_reply'];for(var _0x5ad417=0x0;_0x5ad417<_0x2a242d[_0x7422('0x2d')]['length'];_0x5ad417++){var _0x28bf20=_['indexOf'](_0x2e61ec,_0x2a242d[_0x7422('0x2d')][_0x5ad417]['line']);if(_0x28bf20>=0x0){_0x2d29cc[_0x7422('0x30')]=!![];}}}return _0x2d29cc;}exports['parser']=function(_0x4613db,_0xd750de,_0x5933f5){var _0x33d250={'from':getAddress(_0xd750de['from']),'firstName':getFirstName(_0xd750de[_0x7422('0x31')]),'lastName':getLastName(_0xd750de[_0x7422('0x31')]),'mapKey':_0x7422('0x6'),'message':{'from':getMails(_0x4613db['email'],_0xd750de['from']),'to':_0x4613db['email'],'cc':'','subject':_0xd750de[_0x7422('0x32')]||'','messageId':_0xd750de[_0x7422('0x33')],'inReplyTo':_0xd750de[_0x7422('0x34')],'sentAt':moment(_0xd750de[_0x7422('0x35')])[_0x7422('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0xd750de['html']&&!_0xd750de['textAsHtml']){var _0x445d9d=_[_0x7422('0x37')](_0xd750de['attachments'],{'contentType':_0x7422('0x38')});if(_0x445d9d[_0x7422('0x13')]){logger['info'](util[_0x7422('0x36')](_0x7422('0x39'),_0xd750de[_0x7422('0x33')]));tnef[_0x7422('0x3a')](_['first'](_0x445d9d)[_0x7422('0x3b')],function(_0x29da5d,_0x5326c6){if(_0x5326c6){_0xd750de[_0x7422('0x16')]=_0x5326c6['BodyHTML']||_0x7422('0x3c');if(_0x5326c6['Attachments']){for(var _0x2bff6b=0x0;_0x2bff6b<_0x5326c6['Attachments'][_0x7422('0x13')];_0x2bff6b++){var _0x2ae42a=_0x5326c6[_0x7422('0x3d')][_0x2bff6b];_0x33d250[_0x7422('0x23')][_0x7422('0x1a')][_0x7422('0x1c')]({'filename':_0x2ae42a[_0x7422('0x3e')],'content':Buffer['from'](_0x2ae42a[_0x7422('0x3f')])});}}}_0x5933f5(parseEmail(_0x4613db,_0xd750de,_0x33d250));});}else{_0xd750de[_0x7422('0x16')]=_0x7422('0x3c');_0x5933f5(parseEmail(_0x4613db,_0xd750de,_0x33d250));}}else{_0x5933f5(parseEmail(_0x4613db,_0xd750de,_0x33d250));}};exports[_0x7422('0x40')]=function(_0x59f235,_0xdff949){var _0x3d8e2b=[_0x7422('0x41')+(_0xdff949||''),_0x7422('0x42')+_0x59f235,'',''];return Buffer[_0x7422('0x31')](_0x3d8e2b[_0x7422('0x12')](''),_0x7422('0x43'))[_0x7422('0x44')](_0x7422('0x45'));}; \ No newline at end of file +var _0x2537=['address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','replace','\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','email','../../../config/environment','head','value'];(function(_0x16b8b5,_0x3729bc){var _0x518ea7=function(_0x4eab01){while(--_0x4eab01){_0x16b8b5['push'](_0x16b8b5['shift']());}};_0x518ea7(++_0x3729bc);}(_0x2537,0xd6));var _0x7253=function(_0x23f720,_0x5dba43){_0x23f720=_0x23f720-0x0;var _0x190f8f=_0x2537[_0x23f720];return _0x190f8f;};'use strict';var _=require(_0x7253('0x0'));var moment=require(_0x7253('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x7253('0x2'));var util=require(_0x7253('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x7253('0x4'));var config=require(_0x7253('0x5'));function getAddress(_0x16f514){var _0x4d8b4f=_[_0x7253('0x6')](_0x16f514[_0x7253('0x7')]);return _0x4d8b4f&&_0x4d8b4f[_0x7253('0x8')]?_0x4d8b4f[_0x7253('0x8')]:_0x7253('0x9')+random[_0x7253('0xa')](0x6)+_0x7253('0xb');}function getFirstName(_0x3495fd){var _0x3f7c9b=_['head'](_0x3495fd['value']);if(_0x3f7c9b&&_0x3f7c9b[_0x7253('0xc')]){if(_0x3f7c9b[_0x7253('0xc')]==_0x3f7c9b[_0x7253('0x8')]){return _0x3f7c9b[_0x7253('0xc')][_0x7253('0xd')](0x0,_0x3f7c9b['name'][_0x7253('0xe')]('@'));}var _0x28fd00=_0x3f7c9b[_0x7253('0xc')][_0x7253('0xf')](/\s+/);return _0x28fd00[_0x7253('0x10')]>0x1?_0x28fd00[_0x7253('0x11')](0x0,-0x1)[_0x7253('0x12')]('\x20'):_0x3f7c9b[_0x7253('0xc')];}return _0x7253('0x13');}function getLastName(_0x35fa83){var _0x29fc81=_[_0x7253('0x6')](_0x35fa83[_0x7253('0x7')]);if(_0x29fc81&&_0x29fc81[_0x7253('0xc')]){var _0x4c8e74=_0x29fc81[_0x7253('0xc')][_0x7253('0xf')](/\s+/);return _0x4c8e74['length']>0x1?_0x4c8e74[_0x7253('0x14')]():'';}return'';}function getMails(_0xfbd258,_0x5a321e){var _0x37dc9c='';for(var _0xa46013=0x0;_0xa46013<_0x5a321e[_0x7253('0x7')][_0x7253('0x10')];_0xa46013+=0x1){if(_0x5a321e[_0x7253('0x7')][_0xa46013][_0x7253('0x8')]!==_0xfbd258){if(!_[_0x7253('0x15')](_0x37dc9c)){_0x37dc9c+=',';}_0x37dc9c+=_0x5a321e[_0x7253('0x7')][_0xa46013][_0x7253('0xc')]||_0x5a321e[_0x7253('0x7')][_0xa46013]['address']||'';_0x37dc9c+='\x20<';_0x37dc9c+=_0x5a321e['value'][_0xa46013][_0x7253('0x8')]?_0x5a321e['value'][_0xa46013][_0x7253('0x8')]:_0x7253('0x9')+random['generate'](0x6)+_0x7253('0xb');_0x37dc9c+='>';}}return _0x37dc9c;}function parseEmail(_0x14a35c,_0x55e683,_0x3d8cf4){if(_0x55e683[_0x7253('0x16')]){var _0x307988=/)<[^<]*)*<\/script>/gi;while(_0x307988['test'](_0x55e683['html'])){_0x55e683[_0x7253('0x16')]=_0x55e683[_0x7253('0x16')][_0x7253('0x17')](_0x307988,'');}if(_0x55e683[_0x7253('0x16')]['includes'](_0x7253('0x18'))){var _0x11bcf6=[];_0x55e683[_0x7253('0x19')][_0x7253('0x1a')](_0x476284=>{_0x11bcf6[_0x7253('0x1b')](_0x476284[_0x7253('0x1c')]);});var _0x5c4f4=/]+>/g;var _0x599c57=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x9ab152=_0x55e683[_0x7253('0x16')][_0x7253('0x17')](_0x599c57,'_SRC');var _0x28f5e1=_0x9ab152['replace'](_0x5c4f4,_0x7253('0x1d'));for(let _0x496a60=0x0;_0x496a60<_0x11bcf6[_0x7253('0x10')];_0x496a60++){var _0x4a91bc=_0x28f5e1[_0x7253('0x17')]('_IMG',_0x7253('0x1e')+_0x11bcf6[_0x496a60]+'\x20]');_0x28f5e1=_0x4a91bc;}_0x55e683[_0x7253('0x16')]=_0x28f5e1;}_0x3d8cf4[_0x7253('0x1f')]=_0x55e683[_0x7253('0x16')];}else{_0x3d8cf4[_0x7253('0x1f')]=_0x55e683['textAsHtml'];}if(_0x3d8cf4[_0x7253('0x1f')]){_0x3d8cf4[_0x7253('0x1f')]=_0x3d8cf4[_0x7253('0x1f')]['replace'](/0x0){var _0x1f0984=[_0x7253('0x31'),_0x7253('0x32'),_0x7253('0x33')];for(var _0x3566fe=0x0;_0x3566fe<_0x55e683[_0x7253('0x34')]['length'];_0x3566fe++){var _0x400bf8=_[_0x7253('0xe')](_0x1f0984,_0x55e683[_0x7253('0x34')][_0x3566fe][_0x7253('0x35')]);if(_0x400bf8>=0x0){_0x3d8cf4[_0x7253('0x36')]=!![];}}}return _0x3d8cf4;}exports[_0x7253('0x37')]=function(_0x4b8990,_0x275bdb,_0x190bd9){var _0x34f9b4={'from':getAddress(_0x275bdb[_0x7253('0x38')]),'firstName':getFirstName(_0x275bdb[_0x7253('0x38')]),'lastName':getLastName(_0x275bdb['from']),'mapKey':_0x7253('0x4'),'message':{'from':getMails(_0x4b8990[_0x7253('0x4')],_0x275bdb[_0x7253('0x38')]),'to':_0x4b8990[_0x7253('0x4')],'cc':'','subject':_0x275bdb['subject']||'','messageId':_0x275bdb[_0x7253('0x39')],'inReplyTo':_0x275bdb[_0x7253('0x3a')],'sentAt':moment(_0x275bdb[_0x7253('0x3b')])[_0x7253('0x2a')](_0x7253('0x3c')),'attach':![],'attachments':[]}};if(!_0x275bdb[_0x7253('0x16')]&&!_0x275bdb[_0x7253('0x3d')]){var _0x3993a1=_[_0x7253('0x3e')](_0x275bdb[_0x7253('0x19')],{'contentType':_0x7253('0x3f')});if(_0x3993a1[_0x7253('0x10')]){logger[_0x7253('0x40')](util[_0x7253('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x275bdb[_0x7253('0x39')]));tnef[_0x7253('0x41')](_[_0x7253('0x42')](_0x3993a1)[_0x7253('0x2f')],function(_0xfaf89b,_0x10e984){if(_0x10e984){_0x275bdb[_0x7253('0x16')]=_0x10e984['BodyHTML']||_0x7253('0x43');if(_0x10e984[_0x7253('0x44')]){for(var _0x5b70e6=0x0;_0x5b70e6<_0x10e984[_0x7253('0x44')][_0x7253('0x10')];_0x5b70e6++){var _0x2d1cc3=_0x10e984['Attachments'][_0x5b70e6];_0x34f9b4[_0x7253('0x21')][_0x7253('0x19')][_0x7253('0x1b')]({'filename':_0x2d1cc3[_0x7253('0x45')],'content':Buffer[_0x7253('0x38')](_0x2d1cc3['Data'])});}}}_0x190bd9(parseEmail(_0x4b8990,_0x275bdb,_0x34f9b4));});}else{_0x275bdb['html']=_0x7253('0x43');_0x190bd9(parseEmail(_0x4b8990,_0x275bdb,_0x34f9b4));}}else{_0x190bd9(parseEmail(_0x4b8990,_0x275bdb,_0x34f9b4));}};exports['generateXOAuth2Token']=function(_0x3a7868,_0x2c0b8c){var _0x220d31=['user='+(_0x2c0b8c||''),_0x7253('0x46')+_0x3a7868,'',''];return Buffer[_0x7253('0x38')](_0x220d31[_0x7253('0x12')](''),_0x7253('0x47'))[_0x7253('0x48')](_0x7253('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index de3c999..c3e8b51 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 _0xa09e=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0xb984a7,_0x564ef9){var _0x247044=function(_0x4142c7){while(--_0x4142c7){_0xb984a7['push'](_0xb984a7['shift']());}};_0x247044(++_0x564ef9);}(_0xa09e,0x92));var _0xea09=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0xa09e[_0x32e649];return _0x14d386;};'use strict';var _=require(_0xea09('0x0'));function MailAccount(_0x536380){this['id']=_0x536380['id']||0x0;this[_0xea09('0x1')]=_0x536380[_0xea09('0x1')]||_0xea09('0x2');this[_0xea09('0x3')]=_0x536380[_0xea09('0x3')]||_0xea09('0x4');this[_0xea09('0x5')]=_0x536380[_0xea09('0x5')]||![];this[_0xea09('0x6')]=_0x536380[_0xea09('0x6')]||[];this['Smtp']=_0x536380[_0xea09('0x7')]||[];}module[_0xea09('0x8')]=MailAccount; \ No newline at end of file +var _0x5496=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x428045,_0x57b6b6){var _0x5523a0=function(_0x4d4b96){while(--_0x4d4b96){_0x428045['push'](_0x428045['shift']());}};_0x5523a0(++_0x57b6b6);}(_0x5496,0x1bd));var _0x6549=function(_0xf30e20,_0xc30d5e){_0xf30e20=_0xf30e20-0x0;var _0xafd38c=_0x5496[_0xf30e20];return _0xafd38c;};'use strict';var _=require('lodash');function MailAccount(_0xc28781){this['id']=_0xc28781['id']||0x0;this[_0x6549('0x0')]=_0xc28781[_0x6549('0x0')]||_0x6549('0x1');this[_0x6549('0x2')]=_0xc28781[_0x6549('0x2')]||_0x6549('0x3');this['active']=_0xc28781[_0x6549('0x4')]||![];this[_0x6549('0x5')]=_0xc28781[_0x6549('0x5')]||[];this[_0x6549('0x6')]=_0xc28781[_0x6549('0x6')]||[];}module[_0x6549('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index fc89001..dba472b 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 _0x25c0=['isUndefined','merge','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','initMailAccounts','length'];(function(_0x22c665,_0x2164d6){var _0x405400=function(_0xac270b){while(--_0xac270b){_0x22c665['push'](_0x22c665['shift']());}};_0x405400(++_0x2164d6);}(_0x25c0,0x1aa));var _0x025c=function(_0x5178bc,_0x5f74e8){_0x5178bc=_0x5178bc-0x0;var _0xca7d8f=_0x25c0[_0x5178bc];return _0xca7d8f;};'use strict';var _=require('lodash');var MailAccount=require(_0x025c('0x0'));var Realtime=function(){this[_0x025c('0x1')]={};};function freeIsNotKey(_0x26977b,_0x544c2f,_0x306d18){var _0x339d03=_['mapKeys'](_0x26977b,function(_0x3d2265,_0x5d806b){return _0x3d2265[_0x306d18];});for(var _0x24e7e2 in _0x544c2f){if(_0x544c2f[_0x025c('0x2')](_0x24e7e2)){if(!_0x339d03[_0x24e7e2]){delete _0x544c2f[_0x24e7e2];}}}}Realtime[_0x025c('0x3')]['mergeFromDatabase']=function(_0x46953b,_0x1404d7){for(var _0x147f6b in _0x1404d7){if(_0x46953b[_0x025c('0x2')](_0x147f6b)){_0x46953b[_0x147f6b]=_0x1404d7[_0x147f6b];}}};Realtime[_0x025c('0x3')][_0x025c('0x4')]=function(){var _0x303db0=this;return function(_0x4ff4df){if(_0x4ff4df){freeIsNotKey(_0x4ff4df,_0x303db0['mailAccounts'],'id');for(var _0x4703b0=0x0,_0x35fc03={},_0x52d85a={};_0x4703b0<_0x4ff4df[_0x025c('0x5')];_0x4703b0+=0x1){_0x35fc03=_0x4ff4df[_0x4703b0];if(_[_0x025c('0x6')](_0x303db0['mailAccounts'][_0x35fc03['id']])){_0x303db0['mailAccounts'][_0x35fc03['id']]=new MailAccount(_0x35fc03);}else{_[_0x025c('0x7')](_0x303db0[_0x025c('0x1')][_0x35fc03['id']],_0x35fc03);}}}return _0x303db0['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x4d41=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mapKeys'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4d41,0x8d));var _0x14d4=function(_0x2deb15,_0x102a17){_0x2deb15=_0x2deb15-0x0;var _0x1abb33=_0x4d41[_0x2deb15];return _0x1abb33;};'use strict';var _=require(_0x14d4('0x0'));var MailAccount=require(_0x14d4('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x7b925e,_0x158806,_0xe229ce){var _0x9e8bc9=_[_0x14d4('0x2')](_0x7b925e,function(_0x2ee01b,_0x1a1738){return _0x2ee01b[_0xe229ce];});for(var _0x3595c7 in _0x158806){if(_0x158806[_0x14d4('0x3')](_0x3595c7)){if(!_0x9e8bc9[_0x3595c7]){delete _0x158806[_0x3595c7];}}}}Realtime[_0x14d4('0x4')][_0x14d4('0x5')]=function(_0x40addc,_0x58bd1b){for(var _0xcc8130 in _0x58bd1b){if(_0x40addc['hasOwnProperty'](_0xcc8130)){_0x40addc[_0xcc8130]=_0x58bd1b[_0xcc8130];}}};Realtime[_0x14d4('0x4')][_0x14d4('0x6')]=function(){var _0x458a9e=this;return function(_0x465f9d){if(_0x465f9d){freeIsNotKey(_0x465f9d,_0x458a9e[_0x14d4('0x7')],'id');for(var _0x4d352d=0x0,_0x36a88d={},_0x151e0f={};_0x4d352d<_0x465f9d[_0x14d4('0x8')];_0x4d352d+=0x1){_0x36a88d=_0x465f9d[_0x4d352d];if(_[_0x14d4('0x9')](_0x458a9e[_0x14d4('0x7')][_0x36a88d['id']])){_0x458a9e['mailAccounts'][_0x36a88d['id']]=new MailAccount(_0x36a88d);}else{_[_0x14d4('0xa')](_0x458a9e['mailAccounts'][_0x36a88d['id']],_0x36a88d);}}}return _0x458a9e[_0x14d4('0x7')];};};module[_0x14d4('0xb')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 297f5ea..2f1ccbe 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 _0x4932=['provider','service','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x20a7fe,_0x1b77d1){var _0x56a59e=function(_0x203af0){while(--_0x203af0){_0x20a7fe['push'](_0x20a7fe['shift']());}};_0x56a59e(++_0x1b77d1);}(_0x4932,0x164));var _0x2493=function(_0x11e4a6,_0x190699){_0x11e4a6=_0x11e4a6-0x0;var _0x1a0b81=_0x4932[_0x11e4a6];return _0x1a0b81;};'use strict';var client=require(_0x2493('0x0'));exports[_0x2493('0x1')]=function(){return function(){return client[_0x2493('0x2')](_0x2493('0x3'),{'options':{'attributes':['id','name',_0x2493('0x4'),_0x2493('0x5'),_0x2493('0x6'),_0x2493('0x7'),_0x2493('0x8'),_0x2493('0x9'),_0x2493('0xa')],'raw':![],'include':[{'model':_0x2493('0xb'),'as':'Imap','include':[{'model':_0x2493('0xc'),'attributes':['id','name',_0x2493('0x5'),_0x2493('0xd'),_0x2493('0xe')],'as':_0x2493('0xc')}]},{'model':_0x2493('0xf'),'as':_0x2493('0x10'),'include':[{'model':_0x2493('0xc'),'attributes':['id','name',_0x2493('0x5'),_0x2493('0xd'),_0x2493('0xe')],'as':_0x2493('0xc')}]}]},'log':_0x2493('0x11')});};};exports[_0x2493('0x12')]=function(_0x2358ce,_0x5680a0){return client[_0x2493('0x2')](_0x2493('0x13'),{'account':{'id':_0x2358ce},'body':_0x5680a0,'log':_0x2493('0x13')});}; \ No newline at end of file +var _0x1fcc=['Imap','data5','CloudProvider','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fcc,0x125));var _0xc1fc=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x1fcc[_0x15e6fe];return _0x34894d;};'use strict';var client=require(_0xc1fc('0x0'));exports[_0xc1fc('0x1')]=function(){return function(){return client['Request'](_0xc1fc('0x2'),{'options':{'attributes':['id',_0xc1fc('0x3'),_0xc1fc('0x4'),_0xc1fc('0x5'),_0xc1fc('0x6'),_0xc1fc('0x7'),_0xc1fc('0x8'),'ListId',_0xc1fc('0x9')],'raw':![],'include':[{'model':_0xc1fc('0xa'),'as':_0xc1fc('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0xc1fc('0x3'),_0xc1fc('0x5'),'type',_0xc1fc('0xc')],'as':_0xc1fc('0xd')}]},{'model':'MailServerOut','as':_0xc1fc('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0xc1fc('0x3'),_0xc1fc('0x5'),'type',_0xc1fc('0xc')],'as':_0xc1fc('0xd')}]}]},'log':_0xc1fc('0xf')});};};exports[_0xc1fc('0x10')]=function(_0x62369d,_0x5b7fb2){return client[_0xc1fc('0x11')](_0xc1fc('0x12'),{'account':{'id':_0x62369d},'body':_0x5b7fb2,'log':_0xc1fc('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 89b43ad..5e94bdc 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 _0xefce=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0xefce,0x19e));var _0xeefc=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0xefce[_0x12833b];return _0x3acad3;};'use strict';var client=require(_0xeefc('0x0'));exports[_0xeefc('0x1')]=function(){return client[_0xeefc('0x2')](_0xeefc('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xeefc('0x4')]},'log':_0xeefc('0x5')});}; \ No newline at end of file +var _0xed04=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x2f0006,_0x4611e4){var _0x409bb5=function(_0x3cc71d){while(--_0x3cc71d){_0x2f0006['push'](_0x2f0006['shift']());}};_0x409bb5(++_0x4611e4);}(_0xed04,0x1da));var _0x4ed0=function(_0x13c31b,_0x1b8e10){_0x13c31b=_0x13c31b-0x0;var _0x167375=_0xed04[_0x13c31b];return _0x167375;};'use strict';var client=require(_0x4ed0('0x0'));exports[_0x4ed0('0x1')]=function(){return client[_0x4ed0('0x2')](_0x4ed0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4ed0('0x4')]},'log':_0x4ed0('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index bf67543..7046792 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 ba43664..1fa8c4f 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 _0x8ebd=['../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','sticky-session','createServer','timeout','port','websocket','redis','defaults','localhost','adapter'];(function(_0x35601c,_0xdb7bd4){var _0x4d56a2=function(_0x4d464f){while(--_0x4d464f){_0x35601c['push'](_0x35601c['shift']());}};_0x4d56a2(++_0xdb7bd4);}(_0x8ebd,0x139));var _0xd8eb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x8ebd[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xd8eb('0x0'));var sticky=require(_0xd8eb('0x1'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0xd8eb('0x2')](app);server[_0xd8eb('0x3')]=0xdbba0;if(sticky['listen'](server,config[_0xd8eb('0x4')])){var socketio=require('socket.io')(server,{'transports':[_0xd8eb('0x5'),'polling']});config[_0xd8eb('0x6')]=_[_0xd8eb('0x7')](config[_0xd8eb('0x6')],{'host':_0xd8eb('0x8'),'port':0x18eb});socketio[_0xd8eb('0x9')](require('socket.io-redis')({'pubClient':new Redis(config[_0xd8eb('0x6')]),'subClient':new Redis(config[_0xd8eb('0x6')])}));require(_0xd8eb('0xa'))[_0xd8eb('0xb')]();require('../../config/socketio')[_0xd8eb('0xb')](socketio);require(_0xd8eb('0xc'))[_0xd8eb('0xb')](app);require(_0xd8eb('0xd'))[_0xd8eb('0xb')](app);}else{server[_0xd8eb('0xe')](_0xd8eb('0xf'),function(){console[_0xd8eb('0x10')](_0xd8eb('0x11'),config[_0xd8eb('0x4')]);});}exports=module[_0xd8eb('0x12')]=app; \ No newline at end of file +var _0xcb0a=['lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x41f429,_0x5e8560){var _0x122a59=function(_0x453a89){while(--_0x453a89){_0x41f429['push'](_0x41f429['shift']());}};_0x122a59(++_0x5e8560);}(_0xcb0a,0x1a9));var _0xacb0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xcb0a[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xacb0('0x0'));var http=require(_0xacb0('0x1'));var express=require('express');var sticky=require(_0xacb0('0x2'));var Redis=require(_0xacb0('0x3'));var config=require(_0xacb0('0x4'));var app=express();var server=http[_0xacb0('0x5')](app);server[_0xacb0('0x6')]=0xdbba0;if(sticky[_0xacb0('0x7')](server,config[_0xacb0('0x8')])){var socketio=require(_0xacb0('0x9'))(server,{'transports':[_0xacb0('0xa'),'polling']});config['redis']=_[_0xacb0('0xb')](config[_0xacb0('0xc')],{'host':_0xacb0('0xd'),'port':0x18eb});socketio[_0xacb0('0xe')](require(_0xacb0('0xf'))({'pubClient':new Redis(config[_0xacb0('0xc')]),'subClient':new Redis(config[_0xacb0('0xc')])}));require(_0xacb0('0x10'))['default']();require(_0xacb0('0x11'))[_0xacb0('0x12')](socketio);require(_0xacb0('0x13'))[_0xacb0('0x12')](app);require(_0xacb0('0x14'))['default'](app);}else{server[_0xacb0('0x15')](_0xacb0('0x16'),function(){console[_0xacb0('0x17')](_0xacb0('0x18'),config[_0xacb0('0x8')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 06b6474..030e28c 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 _0xbf83=['http','Request','request','then','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x439dc5,_0x3dbb0a){var _0x48acb8=function(_0x464f2c){while(--_0x464f2c){_0x439dc5['push'](_0x439dc5['shift']());}};_0x48acb8(++_0x3dbb0a);}(_0xbf83,0x1c9));var _0x3bf8=function(_0x5ea9e5,_0x5e0a3a){_0x5ea9e5=_0x5ea9e5-0x0;var _0x41a518=_0xbf83[_0x5ea9e5];return _0x41a518;};'use strict';var jayson=require(_0x3bf8('0x0'));var BPromise=require(_0x3bf8('0x1'));var logger=require(_0x3bf8('0x2'))(_0x3bf8('0x3'));var client=jayson[_0x3bf8('0x4')][_0x3bf8('0x5')]({'port':0x2329});client[_0x3bf8('0x6')]=function(_0x5167fd,_0x2ab321){return new BPromise(function(_0xe80faa,_0x4f3c0c){return client[_0x3bf8('0x7')](_0x5167fd,_0x2ab321)[_0x3bf8('0x8')](function(_0x555227){logger['debug']('rpc','routing',_0x5167fd,_0x2ab321,_0x555227);if(_0x555227[_0x3bf8('0x9')]){logger['error'](_0x3bf8('0xa'),_0x3bf8('0x3'),_0x5167fd,_0x555227[_0x3bf8('0x9')][_0x3bf8('0xb')],_0x2ab321);return _0x4f3c0c(_0x555227[_0x3bf8('0x9')]['message']);}else{return _0xe80faa(_0x555227[_0x3bf8('0xc')]);}})['catch'](function(_0x2538e0){logger['error'](_0x3bf8('0xa'),_0x3bf8('0x3'),_0x5167fd,_0x2538e0,_0x2ab321);return _0x4f3c0c(_0x2538e0);});});};module[_0x3bf8('0xd')]=client; \ No newline at end of file +var _0xeb08=['debug','error','rpc','message','exports','bluebird','../../config/logger','routing','Request','request','then'];(function(_0x2a4288,_0x22c9d2){var _0x1f0a2a=function(_0x388b94){while(--_0x388b94){_0x2a4288['push'](_0x2a4288['shift']());}};_0x1f0a2a(++_0x22c9d2);}(_0xeb08,0xe1));var _0x8eb0=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0xeb08[_0xbebf50];return _0xce1496;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8eb0('0x0'));var logger=require(_0x8eb0('0x1'))(_0x8eb0('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0x8eb0('0x3')]=function(_0x12d60a,_0x5e9d15){return new BPromise(function(_0x2039a6,_0x2564df){return client[_0x8eb0('0x4')](_0x12d60a,_0x5e9d15)[_0x8eb0('0x5')](function(_0x37a08c){logger[_0x8eb0('0x6')]('rpc',_0x8eb0('0x2'),_0x12d60a,_0x5e9d15,_0x37a08c);if(_0x37a08c[_0x8eb0('0x7')]){logger[_0x8eb0('0x7')](_0x8eb0('0x8'),_0x8eb0('0x2'),_0x12d60a,_0x37a08c['error'][_0x8eb0('0x9')],_0x5e9d15);return _0x2564df(_0x37a08c[_0x8eb0('0x7')]['message']);}else{return _0x2039a6(_0x37a08c['result']);}})['catch'](function(_0x21f805){logger[_0x8eb0('0x7')](_0x8eb0('0x8'),_0x8eb0('0x2'),_0x12d60a,_0x21f805,_0x5e9d15);return _0x2564df(_0x21f805);});});};module[_0x8eb0('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f82cd41..8cdb6a7 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 _0x8ba1=['getAgents','getIntervals','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then'];(function(_0xf2e1a3,_0x2fc294){var _0x1202f2=function(_0x3c2d0c){while(--_0x3c2d0c){_0xf2e1a3['push'](_0xf2e1a3['shift']());}};_0x1202f2(++_0x2fc294);}(_0x8ba1,0xbe));var _0x18ba=function(_0x5b0a0f,_0x56296d){_0x5b0a0f=_0x5b0a0f-0x0;var _0x2d0ecc=_0x8ba1[_0x5b0a0f];return _0x2d0ecc;};'use strict';var BPromise=require('bluebird');var server=require(_0x18ba('0x0'));var Realtime=require('./realtime');var user=require(_0x18ba('0x1'));var interval=require(_0x18ba('0x2'));var openchannelQueue=require(_0x18ba('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x18ba('0x4'));var mailQueue=require(_0x18ba('0x5'));var faxQueue=require(_0x18ba('0x6'));var whatsappQueue=require(_0x18ba('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x18ba('0x8')]()[_0x18ba('0x9')](user[_0x18ba('0xa')]())[_0x18ba('0x9')](realtime['initAgents']())[_0x18ba('0x9')](interval[_0x18ba('0xb')]())[_0x18ba('0x9')](realtime['initIntervals']())[_0x18ba('0x9')](openchannelQueue['getOpenchannelQueues']())[_0x18ba('0x9')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x18ba('0xc')]())[_0x18ba('0x9')](realtime[_0x18ba('0xd')]())['then'](smsQueue['getSmsQueues']())[_0x18ba('0x9')](realtime['initSmsQueues']())[_0x18ba('0x9')](mailQueue[_0x18ba('0xe')]())[_0x18ba('0x9')](realtime[_0x18ba('0xf')]())[_0x18ba('0x9')](faxQueue[_0x18ba('0x10')]())[_0x18ba('0x9')](realtime[_0x18ba('0x11')]())[_0x18ba('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime['initWhatsappQueues']())[_0x18ba('0x9')](function(){return realtime;});}function main(){return server[_0x18ba('0x12')](realtime)[_0x18ba('0x9')](function(_0x3eda81){return initRealtime();})['then'](function(_0x3b8844){return setInterval(initRealtime,0x1388);})[_0x18ba('0x13')](function(_0x5f45c0){console['log'](_0x5f45c0);});}main(); \ No newline at end of file +var _0xbc03=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user'];(function(_0x5a8c48,_0x584ed9){var _0x220ae4=function(_0x5145d7){while(--_0x5145d7){_0x5a8c48['push'](_0x5a8c48['shift']());}};_0x220ae4(++_0x584ed9);}(_0xbc03,0x13f));var _0x3bc0=function(_0x577f3d,_0x43ab79){_0x577f3d=_0x577f3d-0x0;var _0x3b11f6=_0xbc03[_0x577f3d];return _0x3b11f6;};'use strict';var BPromise=require('bluebird');var server=require(_0x3bc0('0x0'));var Realtime=require(_0x3bc0('0x1'));var user=require(_0x3bc0('0x2'));var interval=require(_0x3bc0('0x3'));var openchannelQueue=require(_0x3bc0('0x4'));var chatQueue=require(_0x3bc0('0x5'));var smsQueue=require(_0x3bc0('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x3bc0('0x7'));var whatsappQueue=require(_0x3bc0('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3bc0('0x9')]()[_0x3bc0('0xa')](user[_0x3bc0('0xb')]())[_0x3bc0('0xa')](realtime['initAgents']())['then'](interval[_0x3bc0('0xc')]())[_0x3bc0('0xa')](realtime['initIntervals']())[_0x3bc0('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x3bc0('0xa')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0x3bc0('0xa')](realtime[_0x3bc0('0xd')]())['then'](smsQueue[_0x3bc0('0xe')]())['then'](realtime['initSmsQueues']())[_0x3bc0('0xa')](mailQueue[_0x3bc0('0xf')]())[_0x3bc0('0xa')](realtime[_0x3bc0('0x10')]())[_0x3bc0('0xa')](faxQueue[_0x3bc0('0x11')]())[_0x3bc0('0xa')](realtime[_0x3bc0('0x12')]())['then'](whatsappQueue[_0x3bc0('0x13')]())[_0x3bc0('0xa')](realtime[_0x3bc0('0x14')]())[_0x3bc0('0xa')](function(){return realtime;});}function main(){return server[_0x3bc0('0x15')](realtime)[_0x3bc0('0xa')](function(_0x12ee35){return initRealtime();})[_0x3bc0('0xa')](function(_0x1031c9){return setInterval(initRealtime,0x1388);})['catch'](function(_0xcfc4c2){console[_0x3bc0('0x16')](_0xcfc4c2);});}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 f7884ab..faf4751 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x41cbab,_0x25ca4b){var _0x1c4b0e=function(_0x41505d){while(--_0x41505d){_0x41cbab['push'](_0x41cbab['shift']());}};_0x1c4b0e(++_0x25ca4b);}(_0x814b,0x1a2));var _0xb814=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0x814b[_0x26cd05];return _0x3e13b9;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x21cd58,_0x4604d6){var _0x3fba55=function(_0x51922e){while(--_0x51922e){_0x21cd58['push'](_0x21cd58['shift']());}};_0x3fba55(++_0x4604d6);}(_0x326f,0xd1));var _0xf326=function(_0x1b0558,_0x201df0){_0x1b0558=_0x1b0558-0x0;var _0x171853=_0x326f[_0x1b0558];return _0x171853;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 288215d..6904bfa 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 _0x113d=['catch','sendMailMessage','bluebird','jayson/promise','client','http','then','error','message','result'];(function(_0x16c3f5,_0x28a42c){var _0x43cbac=function(_0x1d985a){while(--_0x1d985a){_0x16c3f5['push'](_0x16c3f5['shift']());}};_0x43cbac(++_0x28a42c);}(_0x113d,0x110));var _0xd113=function(_0x424337,_0x266fba){_0x424337=_0x424337-0x0;var _0x37b139=_0x113d[_0x424337];return _0x37b139;};'use strict';var BPromise=require(_0xd113('0x0'));var jayson=require(_0xd113('0x1'));var client=jayson[_0xd113('0x2')][_0xd113('0x3')]({'port':0x232b});function request(_0x1590bb,_0x10cd40){return new BPromise(function(_0xe1bc07,_0x1b1bb2){return client['request'](_0x1590bb,_0x10cd40)[_0xd113('0x4')](function(_0x23cf7e){if(_0x23cf7e['error']){return _0x1b1bb2(_0x23cf7e[_0xd113('0x5')][_0xd113('0x6')]);}else{return _0xe1bc07(_0x23cf7e[_0xd113('0x7')]);}})[_0xd113('0x8')](function(_0x21dad6){return _0x1b1bb2(_0x21dad6);});});}exports[_0xd113('0x9')]=function(_0x3418de,_0x5b9763){return request('SendMail',{'account':_0x3418de,'message':_0x5b9763});}; \ No newline at end of file +var _0x1914=['sendMailMessage','SendMail','bluebird','jayson/promise','client','request','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1914,0x1f3));var _0x4191=function(_0x359b7c,_0x48b0ad){_0x359b7c=_0x359b7c-0x0;var _0x32d24d=_0x1914[_0x359b7c];return _0x32d24d;};'use strict';var BPromise=require(_0x4191('0x0'));var jayson=require(_0x4191('0x1'));var client=jayson[_0x4191('0x2')]['http']({'port':0x232b});function request(_0xc6e686,_0x1d4fb5){return new BPromise(function(_0x214aae,_0x3758a0){return client[_0x4191('0x3')](_0xc6e686,_0x1d4fb5)['then'](function(_0x2269a3){if(_0x2269a3['error']){return _0x3758a0(_0x2269a3[_0x4191('0x4')]['message']);}else{return _0x214aae(_0x2269a3['result']);}})['catch'](function(_0x3ff782){return _0x3758a0(_0x3ff782);});});}exports[_0x4191('0x5')]=function(_0x5e918f,_0x5c1cd6){return request(_0x4191('0x6'),{'account':_0x5e918f,'message':_0x5c1cd6});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d3f1335..0dbf2b0 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 _0x6d38=['chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','idle','openchannel','fax','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','voicePause','faxStatus','mailWaitingInteractions','smsWaitingInteractions','stringify','emit','omit','md5','moment','ioredis','defaults','localhost','socket.io-emitter','redis','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity'];(function(_0x2d0db7,_0x369a9e){var _0x2a0c09=function(_0x3e1125){while(--_0x3e1125){_0x2d0db7['push'](_0x2d0db7['shift']());}};_0x2a0c09(++_0x369a9e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6d38[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var md5=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var Redis=require(_0x86d3('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x86d3('0x3')](config['redis'],{'host':_0x86d3('0x4'),'port':0x18eb});var io=require(_0x86d3('0x5'))(new Redis(config[_0x86d3('0x6')]));function Agent(_0x4ef557){this['id']=_0x4ef557['id']||0x0;this[_0x86d3('0x7')]=_0x4ef557[_0x86d3('0x7')]||'';this[_0x86d3('0x8')]=_0x4ef557[_0x86d3('0x8')]||!![];this['voicePause']=_0x4ef557['voicePause']||![];this[_0x86d3('0x9')]=_0x4ef557[_0x86d3('0x9')]||![];this[_0x86d3('0xa')]=_0x4ef557['mailPause']||![];this['faxPause']=_0x4ef557[_0x86d3('0xb')]||![];this[_0x86d3('0xc')]=_0x4ef557['smsPause']||![];this['openchannelPause']=_0x4ef557[_0x86d3('0xd')]||![];this[_0x86d3('0xe')]='unknown';this[_0x86d3('0xf')]=0x0;this['chatCapacity']=_0x4ef557[_0x86d3('0x10')]||0x0;this[_0x86d3('0x11')]=0x0;this[_0x86d3('0x12')]=_0x86d3('0x13');this[_0x86d3('0x14')]=0x0;this[_0x86d3('0x15')]=_0x4ef557[_0x86d3('0x15')]||0x0;this[_0x86d3('0x16')]=0x0;this['faxStatus']=_0x86d3('0x13');this[_0x86d3('0x17')]=0x0;this[_0x86d3('0x18')]=_0x4ef557[_0x86d3('0x18')]||0x0;this[_0x86d3('0x19')]=0x0;this[_0x86d3('0x1a')]=_0x86d3('0x13');this[_0x86d3('0x1b')]=0x0;this['smsCapacity']=_0x4ef557[_0x86d3('0x1c')]||0x0;this[_0x86d3('0x1d')]=0x0;this[_0x86d3('0x1e')]=_0x86d3('0x13');this[_0x86d3('0x1f')]=0x0;this[_0x86d3('0x20')]=_0x4ef557[_0x86d3('0x20')]||0x0;this[_0x86d3('0x21')]=0x0;this[_0x86d3('0x22')]='unknown';this[_0x86d3('0x23')]=0x0;this['openchannelCapacity']=_0x4ef557[_0x86d3('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x86d3('0x25')]=undefined;this[_0x86d3('0x0')]='';this[_0x86d3('0x26')]={};this[_0x86d3('0x27')]={};this['mailWaitingInteractions']={};this[_0x86d3('0x28')]={};this['smsWaitingInteractions']={};this[_0x86d3('0x29')]={};this[_0x86d3('0x2a')]();}Agent[_0x86d3('0x2b')]['getChannelStatus']=function(_0x39d819){if(this[_0x39d819+_0x86d3('0x2c')]>0x0){if(this[_0x39d819+_0x86d3('0x2d')]>0x0&&this[_0x39d819+'CurrentCapacity']>=this[_0x39d819+'Capacity']){return _0x86d3('0x2e');}else{return'working';}}else{return _0x86d3('0x2f');}};Agent[_0x86d3('0x2b')][_0x86d3('0x2a')]=function(){var _0x3c5fe4=['mail','chat',_0x86d3('0x30'),_0x86d3('0x31'),'sms',_0x86d3('0x32')];for(var _0x5b126e=0x0;_0x5b126e<_0x3c5fe4[_0x86d3('0x33')];_0x5b126e+=0x1){var _0x41e2f0=this[_0x86d3('0x34')](_0x3c5fe4[_0x5b126e]);if(this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x35')]!==_0x41e2f0){this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x36')]=_[_0x86d3('0x37')](moment()[_0x86d3('0x38')]('x'));}this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x35')]=_0x41e2f0;}var _0x303f13={'id':this['id'],'name':this[_0x86d3('0x7')],'online':this[_0x86d3('0x8')],'voicePause':this[_0x86d3('0x39')],'chatPause':this[_0x86d3('0x9')],'mailPause':this[_0x86d3('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x86d3('0xb')],'openchannelPause':this[_0x86d3('0xd')],'chatStatus':this[_0x86d3('0xe')],'chatStatusTime':this[_0x86d3('0xf')],'chatCapacity':this[_0x86d3('0x10')],'chatCurrentCapacity':this[_0x86d3('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x86d3('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x86d3('0x3a')],'faxStatusTime':this[_0x86d3('0x17')],'faxCapacity':this[_0x86d3('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x86d3('0x1a')],'smsStatusTime':this[_0x86d3('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x86d3('0x1d')],'whatsappStatus':this[_0x86d3('0x1e')],'whatsappStatusTime':this[_0x86d3('0x1f')],'whatsappCapacity':this[_0x86d3('0x20')],'whatsappCurrentCapacity':this[_0x86d3('0x21')],'openchannelStatus':this[_0x86d3('0x22')],'openchannelStatusTime':this[_0x86d3('0x23')],'openchannelCapacity':this[_0x86d3('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x86d3('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x86d3('0x3b')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x86d3('0x3c')],'whatsappWaitingInteractions':this[_0x86d3('0x29')]};var _0x452d49=md5(JSON[_0x86d3('0x3d')](_0x303f13));if(this[_0x86d3('0x0')]!==_0x452d49){this[_0x86d3('0x0')]=_0x452d49;io[_0x86d3('0x3e')]('user:routing:update',_[_0x86d3('0x3f')](_0x303f13,[_0x86d3('0x8')]));}};module['exports']=Agent; \ No newline at end of file +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(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'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 diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 773da89..d68277e 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 _0x6b6e=['_rr','loggedIn','length','online','chatPause','paused','available','stringify','format','chat:queue:%s','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype'];(function(_0x4b35d4,_0x5422d5){var _0x18d8f4=function(_0x550ce9){while(--_0x550ce9){_0x4b35d4['push'](_0x4b35d4['shift']());}};_0x18d8f4(++_0x5422d5);}(_0x6b6e,0x193));var _0xe6b6=function(_0x5d3ab2,_0x44f098){_0x5d3ab2=_0x5d3ab2-0x0;var _0x599864=_0x6b6e[_0x5d3ab2];return _0x599864;};'use strict';var _=require(_0xe6b6('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xe6b6('0x1'));var config=require(_0xe6b6('0x2'));config[_0xe6b6('0x3')]=_[_0xe6b6('0x4')](config[_0xe6b6('0x3')],{'host':_0xe6b6('0x5'),'port':0x18eb});var io=require(_0xe6b6('0x6'))(new Redis(config[_0xe6b6('0x3')]));function ChatQueue(_0x28c191){this['id']=_0x28c191['id']||0x0;this[_0xe6b6('0x7')]=_0x28c191['name']||'';this['timeout']=_0x28c191['timeout']||0xa;this['strategy']=_0x28c191[_0xe6b6('0x8')]||_0xe6b6('0x9');this[_0xe6b6('0xa')]=_0x28c191['Agents'];this[_0xe6b6('0xb')]={};this[_0xe6b6('0xc')]=0x0;this[_0xe6b6('0xd')]='';this[_0xe6b6('0xe')]();this[_0xe6b6('0xf')]();}ChatQueue[_0xe6b6('0x10')][_0xe6b6('0xe')]=function(){var _0x4e7a39=this[_0xe6b6('0xb')][_0xe6b6('0x11')];this[_0xe6b6('0xb')]=_['map'](this[_0xe6b6('0xa')],'id');this[_0xe6b6('0xb')][_0xe6b6('0x11')]=_0x4e7a39;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xe6b6('0x12')]=0x0;this['paused']=0x0;for(var _0x3c37fb=0x0;_0x3c37fb=0x0?this[_0xe6b6('0x17')]:0x0;var _0x1bafb1={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe6b6('0x12')],'name':this['name'],'paused':this[_0xe6b6('0x16')],'waiting':this['waiting']};var _0x3e4fe0=md5(JSON[_0xe6b6('0x18')](_0x1bafb1));if(this[_0xe6b6('0xd')]!==_0x3e4fe0){this[_0xe6b6('0xd')]=_0x3e4fe0;io['to'](util[_0xe6b6('0x19')](_0xe6b6('0x1a'),_0x1bafb1[_0xe6b6('0x7')]))['emit']('chat_queue:save',_0x1bafb1);}};module[_0xe6b6('0x1b')]=ChatQueue; \ No newline at end of file +var _0x84df=['loggedIn','paused','available','stringify','format','chat:queue:%s','lodash','md5','ioredis','../../../config/environment','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','map','_rr','prototype','updateRealtime'];(function(_0x515744,_0x5584fc){var _0x10c9e7=function(_0x43589c){while(--_0x43589c){_0x515744['push'](_0x515744['shift']());}};_0x10c9e7(++_0x5584fc);}(_0x84df,0x1d2));var _0xf84d=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0x84df[_0x1f78cb];return _0x2cf6b8;};'use strict';var _=require(_0xf84d('0x0'));var md5=require(_0xf84d('0x1'));var util=require('util');var Redis=require(_0xf84d('0x2'));var config=require(_0xf84d('0x3'));config['redis']=_[_0xf84d('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf84d('0x5'))(new Redis(config['redis']));function ChatQueue(_0x1df2e2){this['id']=_0x1df2e2['id']||0x0;this[_0xf84d('0x6')]=_0x1df2e2[_0xf84d('0x6')]||'';this[_0xf84d('0x7')]=_0x1df2e2['timeout']||0xa;this[_0xf84d('0x8')]=_0x1df2e2[_0xf84d('0x8')]||_0xf84d('0x9');this[_0xf84d('0xa')]=_0x1df2e2[_0xf84d('0xa')];this[_0xf84d('0xb')]={};this[_0xf84d('0xc')]=0x0;this[_0xf84d('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x3187ef=this[_0xf84d('0xb')]['_rr'];this['mapAgentsId']=_[_0xf84d('0xd')](this[_0xf84d('0xa')],'id');this[_0xf84d('0xb')][_0xf84d('0xe')]=_0x3187ef;};ChatQueue[_0xf84d('0xf')][_0xf84d('0x10')]=function(){this[_0xf84d('0x11')]=0x0;this[_0xf84d('0x12')]=0x0;for(var _0x31e90f=0x0;_0x31e90f=0x0?this[_0xf84d('0x13')]:0x0;var _0x4aec0d={'id':this['id'],'available':this[_0xf84d('0x13')],'loggedIn':this['loggedIn'],'name':this[_0xf84d('0x6')],'paused':this[_0xf84d('0x12')],'waiting':this[_0xf84d('0xc')]};var _0x530894=md5(JSON[_0xf84d('0x14')](_0x4aec0d));if(this[_0xf84d('0x1')]!==_0x530894){this['md5']=_0x530894;io['to'](util[_0xf84d('0x15')](_0xf84d('0x16'),_0x4aec0d[_0xf84d('0x6')]))['emit']('chat_queue:save',_0x4aec0d);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c9659ec..027979b 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 _0xd6ae=['available','waiting','stringify','format','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','paused'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd6ae,0x158));var _0xed6a=function(_0xc8e87b,_0x52711){_0xc8e87b=_0xc8e87b-0x0;var _0x3502a9=_0xd6ae[_0xc8e87b];return _0x3502a9;};'use strict';var _=require(_0xed6a('0x0'));var md5=require(_0xed6a('0x1'));var util=require(_0xed6a('0x2'));var Redis=require(_0xed6a('0x3'));var config=require(_0xed6a('0x4'));config['redis']=_['defaults'](config[_0xed6a('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed6a('0x5')]));function FaxQueue(_0x17a7fa){this['id']=_0x17a7fa['id']||0x0;this[_0xed6a('0x6')]=_0x17a7fa[_0xed6a('0x6')]||'';this[_0xed6a('0x7')]=_0x17a7fa[_0xed6a('0x7')]||0xa;this['strategy']=_0x17a7fa['strategy']||_0xed6a('0x8');this['Agents']=_0x17a7fa[_0xed6a('0x9')];this[_0xed6a('0xa')]={};this['waiting']=0x0;this[_0xed6a('0x1')]='';this[_0xed6a('0xb')]();this[_0xed6a('0xc')]();}FaxQueue[_0xed6a('0xd')]['updateRouting']=function(){var _0x44456c=this[_0xed6a('0xa')]['_rr'];this[_0xed6a('0xa')]=_[_0xed6a('0xe')](this[_0xed6a('0x9')],'id');this[_0xed6a('0xa')][_0xed6a('0xf')]=_0x44456c;};FaxQueue['prototype'][_0xed6a('0xc')]=function(){this[_0xed6a('0x10')]=0x0;this['paused']=0x0;for(var _0xdeddd3=0x0;_0xdeddd3=0x0?this[_0xed6a('0x14')]:0x0;var _0x5ac61e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xed6a('0x15')]};var _0x3dab65=md5(JSON[_0xed6a('0x16')](_0x5ac61e));if(this[_0xed6a('0x1')]!==_0x3dab65){this[_0xed6a('0x1')]=_0x3dab65;io['to'](util[_0xed6a('0x17')]('fax:queue:%s',_0x5ac61e[_0xed6a('0x6')]))['emit'](_0xed6a('0x18'),_0x5ac61e);}};module[_0xed6a('0x19')]=FaxQueue; \ No newline at end of file +var _0x9148=['paused','length','online','faxPause','available','stringify','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9148,0xb0));var _0x8914=function(_0x333af1,_0x2809d2){_0x333af1=_0x333af1-0x0;var _0x4a7df5=_0x9148[_0x333af1];return _0x4a7df5;};'use strict';var _=require(_0x8914('0x0'));var md5=require('md5');var util=require(_0x8914('0x1'));var Redis=require(_0x8914('0x2'));var config=require(_0x8914('0x3'));config[_0x8914('0x4')]=_[_0x8914('0x5')](config[_0x8914('0x4')],{'host':_0x8914('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8914('0x4')]));function FaxQueue(_0x198614){this['id']=_0x198614['id']||0x0;this[_0x8914('0x7')]=_0x198614['name']||'';this[_0x8914('0x8')]=_0x198614['timeout']||0xa;this[_0x8914('0x9')]=_0x198614[_0x8914('0x9')]||_0x8914('0xa');this[_0x8914('0xb')]=_0x198614[_0x8914('0xb')];this[_0x8914('0xc')]={};this[_0x8914('0xd')]=0x0;this[_0x8914('0xe')]='';this[_0x8914('0xf')]();this['updateRealtime']();}FaxQueue[_0x8914('0x10')][_0x8914('0xf')]=function(){var _0x11c4eb=this[_0x8914('0xc')][_0x8914('0x11')];this[_0x8914('0xc')]=_['map'](this[_0x8914('0xb')],'id');this['mapAgentsId'][_0x8914('0x11')]=_0x11c4eb;};FaxQueue[_0x8914('0x10')][_0x8914('0x12')]=function(){this[_0x8914('0x13')]=0x0;this[_0x8914('0x14')]=0x0;for(var _0x18931f=0x0;_0x18931f=0x0?this['available']:0x0;var _0x1c2a26={'id':this['id'],'available':this[_0x8914('0x18')],'loggedIn':this[_0x8914('0x13')],'name':this['name'],'paused':this[_0x8914('0x14')],'waiting':this[_0x8914('0xd')]};var _0x2cb4c6=md5(JSON[_0x8914('0x19')](_0x1c2a26));if(this['md5']!==_0x2cb4c6){this[_0x8914('0xe')]=_0x2cb4c6;io['to'](util['format']('fax:queue:%s',_0x1c2a26['name']))[_0x8914('0x1a')]('fax_queue:save',_0x1c2a26);}};module[_0x8914('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 8d3ec73..d71f081 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 _0xe923=['Intervals','exports','name'];(function(_0x2549a7,_0x4bb1ec){var _0x35f470=function(_0x19ecac){while(--_0x19ecac){_0x2549a7['push'](_0x2549a7['shift']());}};_0x35f470(++_0x4bb1ec);}(_0xe923,0xc8));var _0x3e92=function(_0x27ed41,_0xb780a1){_0x27ed41=_0x27ed41-0x0;var _0x507934=_0xe923[_0x27ed41];return _0x507934;};'use strict';function Interval(_0x1d68b5){this['id']=_0x1d68b5['id']||0x0;this[_0x3e92('0x0')]=_0x1d68b5['name']||'';this[_0x3e92('0x1')]=_0x1d68b5[_0x3e92('0x1')]||{};}module[_0x3e92('0x2')]=Interval; \ No newline at end of file +var _0x159c=['exports','name','Intervals'];(function(_0x29d7ce,_0x463795){var _0x322541=function(_0xb79620){while(--_0xb79620){_0x29d7ce['push'](_0x29d7ce['shift']());}};_0x322541(++_0x463795);}(_0x159c,0xe5));var _0xc159=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x159c[_0x20a584];return _0x4b41a8;};'use strict';function Interval(_0x2d9da3){this['id']=_0x2d9da3['id']||0x0;this[_0xc159('0x0')]=_0x2d9da3[_0xc159('0x0')]||'';this['Intervals']=_0x2d9da3[_0xc159('0x1')]||{};}module[_0xc159('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 f68baea..abb1694 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 _0x8129=['prototype','map','_rr','loggedIn','length','online','mailPause','available','paused','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x8129,0x9a));var _0x9812=function(_0x62862d,_0x52fd0a){_0x62862d=_0x62862d-0x0;var _0x24a0e2=_0x8129[_0x62862d];return _0x24a0e2;};'use strict';var _=require(_0x9812('0x0'));var md5=require('md5');var util=require(_0x9812('0x1'));var Redis=require(_0x9812('0x2'));var config=require(_0x9812('0x3'));config[_0x9812('0x4')]=_['defaults'](config[_0x9812('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9812('0x5'))(new Redis(config[_0x9812('0x4')]));function MailQueue(_0x4536e1){this['id']=_0x4536e1['id']||0x0;this[_0x9812('0x6')]=_0x4536e1[_0x9812('0x6')]||'';this[_0x9812('0x7')]=_0x4536e1['timeout']||0xa;this[_0x9812('0x8')]=_0x4536e1[_0x9812('0x8')]||'beepall';this[_0x9812('0x9')]=_0x4536e1[_0x9812('0x9')];this[_0x9812('0xa')]={};this[_0x9812('0xb')]=0x0;this[_0x9812('0xc')]='';this[_0x9812('0xd')]();this['updateRealtime']();}MailQueue[_0x9812('0xe')][_0x9812('0xd')]=function(){var _0x8b4f66=this[_0x9812('0xa')]['_rr'];this['mapAgentsId']=_[_0x9812('0xf')](this[_0x9812('0x9')],'id');this[_0x9812('0xa')][_0x9812('0x10')]=_0x8b4f66;};MailQueue[_0x9812('0xe')]['updateRealtime']=function(){this[_0x9812('0x11')]=0x0;this['paused']=0x0;for(var _0x468ea4=0x0;_0x468ea4=0x0?this[_0x9812('0x15')]:0x0;var _0x5099ff={'id':this['id'],'available':this[_0x9812('0x15')],'loggedIn':this[_0x9812('0x11')],'name':this[_0x9812('0x6')],'paused':this[_0x9812('0x16')],'waiting':this[_0x9812('0xb')]};var _0x5616b1=md5(JSON[_0x9812('0x17')](_0x5099ff));if(this[_0x9812('0xc')]!==_0x5616b1){this[_0x9812('0xc')]=_0x5616b1;io['to'](util[_0x9812('0x18')](_0x9812('0x19'),_0x5099ff[_0x9812('0x6')]))['emit'](_0x9812('0x1a'),_0x5099ff);}};module[_0x9812('0x1b')]=MailQueue; \ No newline at end of file +var _0xd302=['md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','mailPause','available','stringify','mail_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting'];(function(_0x55e5c6,_0x590bee){var _0x2b1392=function(_0x192875){while(--_0x192875){_0x55e5c6['push'](_0x55e5c6['shift']());}};_0x2b1392(++_0x590bee);}(_0xd302,0x160));var _0x2d30=function(_0x4f0973,_0xd18bbf){_0x4f0973=_0x4f0973-0x0;var _0x401d66=_0xd302[_0x4f0973];return _0x401d66;};'use strict';var _=require(_0x2d30('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2d30('0x1'));var config=require(_0x2d30('0x2'));config[_0x2d30('0x3')]=_[_0x2d30('0x4')](config[_0x2d30('0x3')],{'host':_0x2d30('0x5'),'port':0x18eb});var io=require(_0x2d30('0x6'))(new Redis(config[_0x2d30('0x3')]));function MailQueue(_0x896f77){this['id']=_0x896f77['id']||0x0;this[_0x2d30('0x7')]=_0x896f77[_0x2d30('0x7')]||'';this['timeout']=_0x896f77[_0x2d30('0x8')]||0xa;this[_0x2d30('0x9')]=_0x896f77[_0x2d30('0x9')]||'beepall';this['Agents']=_0x896f77[_0x2d30('0xa')];this['mapAgentsId']={};this[_0x2d30('0xb')]=0x0;this[_0x2d30('0xc')]='';this[_0x2d30('0xd')]();this[_0x2d30('0xe')]();}MailQueue[_0x2d30('0xf')][_0x2d30('0xd')]=function(){var _0x3c5d9b=this[_0x2d30('0x10')]['_rr'];this[_0x2d30('0x10')]=_[_0x2d30('0x11')](this[_0x2d30('0xa')],'id');this[_0x2d30('0x10')][_0x2d30('0x12')]=_0x3c5d9b;};MailQueue[_0x2d30('0xf')]['updateRealtime']=function(){this[_0x2d30('0x13')]=0x0;this[_0x2d30('0x14')]=0x0;for(var _0x7f2465=0x0;_0x7f2465=0x0?this['available']:0x0;var _0xa2c198={'id':this['id'],'available':this[_0x2d30('0x18')],'loggedIn':this[_0x2d30('0x13')],'name':this[_0x2d30('0x7')],'paused':this[_0x2d30('0x14')],'waiting':this[_0x2d30('0xb')]};var _0x2bfd15=md5(JSON[_0x2d30('0x19')](_0xa2c198));if(this[_0x2d30('0xc')]!==_0x2bfd15){this[_0x2d30('0xc')]=_0x2bfd15;io['to'](util['format']('mail:queue:%s',_0xa2c198[_0x2d30('0x7')]))['emit'](_0x2d30('0x1a'),_0xa2c198);}};module[_0x2d30('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a6f4b2f..4d786d0 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x326f,0xd1));var _0xf326=function(_0x5635e9,_0x4fe169){_0x5635e9=_0x5635e9-0x0;var _0x422bef=_0x326f[_0x5635e9];return _0x422bef;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x59efbb,_0x1b77e1){var _0x1e143c=function(_0x411003){while(--_0x411003){_0x59efbb['push'](_0x59efbb['shift']());}};_0x1e143c(++_0x1b77e1);}(_0xadb5,0xad));var _0x5adb=function(_0x5a72a1,_0xdc4c7){_0x5a72a1=_0x5a72a1-0x0;var _0x32b5aa=_0xadb5[_0x5a72a1];return _0x32b5aa;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 85a7b82..e147fd8 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 _0xc73e=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','smsPause','available','paused','waiting','stringify','format','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment'];(function(_0x31002e,_0x3c9a1a){var _0x4b7273=function(_0xa35b39){while(--_0xa35b39){_0x31002e['push'](_0x31002e['shift']());}};_0x4b7273(++_0x3c9a1a);}(_0xc73e,0x1e9));var _0xec73=function(_0x357a99,_0x5e2cb1){_0x357a99=_0x357a99-0x0;var _0x28a97a=_0xc73e[_0x357a99];return _0x28a97a;};'use strict';var _=require(_0xec73('0x0'));var md5=require(_0xec73('0x1'));var util=require('util');var Redis=require(_0xec73('0x2'));var config=require(_0xec73('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0xec73('0x4'),'port':0x18eb});var io=require(_0xec73('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1b81ab){this['id']=_0x1b81ab['id']||0x0;this[_0xec73('0x6')]=_0x1b81ab[_0xec73('0x6')]||'';this[_0xec73('0x7')]=_0x1b81ab['timeout']||0xa;this[_0xec73('0x8')]=_0x1b81ab['strategy']||_0xec73('0x9');this[_0xec73('0xa')]=_0x1b81ab[_0xec73('0xa')];this[_0xec73('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0xec73('0xc')]();this[_0xec73('0xd')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x152195=this[_0xec73('0xb')][_0xec73('0xe')];this[_0xec73('0xb')]=_[_0xec73('0xf')](this[_0xec73('0xa')],'id');this[_0xec73('0xb')]['_rr']=_0x152195;};SmsQueue[_0xec73('0x10')]['updateRealtime']=function(){this[_0xec73('0x11')]=0x0;this['paused']=0x0;for(var _0x10f003=0x0;_0x10f003=0x0?this[_0xec73('0x15')]:0x0;var _0x4d28c3={'id':this['id'],'available':this[_0xec73('0x15')],'loggedIn':this[_0xec73('0x11')],'name':this[_0xec73('0x6')],'paused':this['paused'],'waiting':this[_0xec73('0x17')]};var _0x475dd1=md5(JSON[_0xec73('0x18')](_0x4d28c3));if(this[_0xec73('0x1')]!==_0x475dd1){this[_0xec73('0x1')]=_0x475dd1;io['to'](util[_0xec73('0x19')]('sms:queue:%s',_0x4d28c3['name']))[_0xec73('0x1a')](_0xec73('0x1b'),_0x4d28c3);}};module[_0xec73('0x1c')]=SmsQueue; \ No newline at end of file +var _0x544a=['lodash','md5','util','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','smsPause','available','stringify','sms:queue:%s','sms_queue:save','exports'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x544a,0xbd));var _0xa544=function(_0x1e8e69,_0x508379){_0x1e8e69=_0x1e8e69-0x0;var _0x291b1a=_0x544a[_0x1e8e69];return _0x291b1a;};'use strict';var _=require(_0xa544('0x0'));var md5=require(_0xa544('0x1'));var util=require(_0xa544('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa544('0x3')]=_['defaults'](config[_0xa544('0x3')],{'host':_0xa544('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa544('0x3')]));function SmsQueue(_0x3dd8a3){this['id']=_0x3dd8a3['id']||0x0;this[_0xa544('0x5')]=_0x3dd8a3[_0xa544('0x5')]||'';this[_0xa544('0x6')]=_0x3dd8a3['timeout']||0xa;this[_0xa544('0x7')]=_0x3dd8a3['strategy']||_0xa544('0x8');this[_0xa544('0x9')]=_0x3dd8a3['Agents'];this[_0xa544('0xa')]={};this[_0xa544('0xb')]=0x0;this[_0xa544('0x1')]='';this[_0xa544('0xc')]();this['updateRealtime']();}SmsQueue[_0xa544('0xd')][_0xa544('0xc')]=function(){var _0x555c4d=this[_0xa544('0xa')]['_rr'];this[_0xa544('0xa')]=_[_0xa544('0xe')](this['Agents'],'id');this[_0xa544('0xa')][_0xa544('0xf')]=_0x555c4d;};SmsQueue[_0xa544('0xd')][_0xa544('0x10')]=function(){this[_0xa544('0x11')]=0x0;this[_0xa544('0x12')]=0x0;for(var _0x1ffda8=0x0;_0x1ffda8=0x0?this[_0xa544('0x16')]:0x0;var _0x297298={'id':this['id'],'available':this[_0xa544('0x16')],'loggedIn':this[_0xa544('0x11')],'name':this[_0xa544('0x5')],'paused':this[_0xa544('0x12')],'waiting':this['waiting']};var _0x5d0070=md5(JSON[_0xa544('0x17')](_0x297298));if(this[_0xa544('0x1')]!==_0x5d0070){this[_0xa544('0x1')]=_0x5d0070;io['to'](util['format'](_0xa544('0x18'),_0x297298[_0xa544('0x5')]))['emit'](_0xa544('0x19'),_0x297298);}};module[_0xa544('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 9ec0c34..592025a 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 _0x8645=['loggedIn','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0x8645,0x1e5));var _0x5864=function(_0x1f8cbc,_0x404fad){_0x1f8cbc=_0x1f8cbc-0x0;var _0x26e5d6=_0x8645[_0x1f8cbc];return _0x26e5d6;};'use strict';var _=require(_0x5864('0x0'));var md5=require(_0x5864('0x1'));var util=require(_0x5864('0x2'));var Redis=require(_0x5864('0x3'));var config=require(_0x5864('0x4'));config['redis']=_[_0x5864('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5864('0x6')]));function WhatsappQueue(_0x1fd3ed){this['id']=_0x1fd3ed['id']||0x0;this[_0x5864('0x7')]=_0x1fd3ed['name']||'';this[_0x5864('0x8')]=_0x1fd3ed['timeout']||0xa;this[_0x5864('0x9')]=_0x1fd3ed['strategy']||_0x5864('0xa');this[_0x5864('0xb')]=_0x1fd3ed[_0x5864('0xb')];this['mapAgentsId']={};this[_0x5864('0xc')]=0x0;this[_0x5864('0x1')]='';this[_0x5864('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x5864('0xe')]['updateRouting']=function(){var _0x3d4206=this[_0x5864('0xf')][_0x5864('0x10')];this['mapAgentsId']=_[_0x5864('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x5864('0x10')]=_0x3d4206;};WhatsappQueue['prototype'][_0x5864('0x12')]=function(){this[_0x5864('0x13')]=0x0;this[_0x5864('0x14')]=0x0;for(var _0x1f7b6f=0x0;_0x1f7b6f=0x0?this[_0x5864('0x15')]:0x0;var _0x4dbf25={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5864('0x13')],'name':this[_0x5864('0x7')],'paused':this[_0x5864('0x14')],'waiting':this[_0x5864('0xc')]};var _0x225c61=md5(JSON[_0x5864('0x16')](_0x4dbf25));if(this[_0x5864('0x1')]!==_0x225c61){this[_0x5864('0x1')]=_0x225c61;io['to'](util[_0x5864('0x17')](_0x5864('0x18'),_0x4dbf25['name']))[_0x5864('0x19')](_0x5864('0x1a'),_0x4dbf25);}};module[_0x5864('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x0dcd=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0dcd,0x143));var _0xd0dc=function(_0x3505ab,_0xca44bf){_0x3505ab=_0x3505ab-0x0;var _0x1bfadf=_0x0dcd[_0x3505ab];return _0x1bfadf;};'use strict';var _=require('lodash');var md5=require(_0xd0dc('0x0'));var util=require(_0xd0dc('0x1'));var Redis=require(_0xd0dc('0x2'));var config=require(_0xd0dc('0x3'));config[_0xd0dc('0x4')]=_[_0xd0dc('0x5')](config[_0xd0dc('0x4')],{'host':_0xd0dc('0x6'),'port':0x18eb});var io=require(_0xd0dc('0x7'))(new Redis(config[_0xd0dc('0x4')]));function WhatsappQueue(_0x51eb40){this['id']=_0x51eb40['id']||0x0;this['name']=_0x51eb40[_0xd0dc('0x8')]||'';this['timeout']=_0x51eb40['timeout']||0xa;this[_0xd0dc('0x9')]=_0x51eb40[_0xd0dc('0x9')]||_0xd0dc('0xa');this[_0xd0dc('0xb')]=_0x51eb40[_0xd0dc('0xb')];this[_0xd0dc('0xc')]={};this[_0xd0dc('0xd')]=0x0;this['md5']='';this[_0xd0dc('0xe')]();this[_0xd0dc('0xf')]();}WhatsappQueue['prototype'][_0xd0dc('0xe')]=function(){var _0x2ce3b4=this['mapAgentsId'][_0xd0dc('0x10')];this[_0xd0dc('0xc')]=_[_0xd0dc('0x11')](this['Agents'],'id');this[_0xd0dc('0xc')][_0xd0dc('0x10')]=_0x2ce3b4;};WhatsappQueue['prototype'][_0xd0dc('0xf')]=function(){this[_0xd0dc('0x12')]=0x0;this[_0xd0dc('0x13')]=0x0;for(var _0x3105bb=0x0;_0x3105bb=0x0?this[_0xd0dc('0x15')]:0x0;var _0x3b44a1={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd0dc('0x12')],'name':this[_0xd0dc('0x8')],'paused':this[_0xd0dc('0x13')],'waiting':this['waiting']};var _0x2f0092=md5(JSON['stringify'](_0x3b44a1));if(this[_0xd0dc('0x0')]!==_0x2f0092){this['md5']=_0x2f0092;io['to'](util[_0xd0dc('0x16')](_0xd0dc('0x17'),_0x3b44a1[_0xd0dc('0x8')]))[_0xd0dc('0x18')](_0xd0dc('0x19'),_0x3b44a1);}};module[_0xd0dc('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index eb77513..d16c7de 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0516a0b..9ed2eeb 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 _0x5594=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x1d2922,_0xdcb3e0){var _0x1d7211=function(_0x2becdf){while(--_0x2becdf){_0x1d2922['push'](_0x1d2922['shift']());}};_0x1d7211(++_0xdcb3e0);}(_0x5594,0x1d3));var _0x4559=function(_0x5c7b7d,_0x4bbd89){_0x5c7b7d=_0x5c7b7d-0x0;var _0x2d5a9e=_0x5594[_0x5c7b7d];return _0x2d5a9e;};'use strict';var client=require('../client');exports[_0x4559('0x0')]=function(_0x33c3a0,_0x420262){return client[_0x4559('0x1')]('UpdateChatInteraction',{'body':_0x420262,'options':{'where':{'id':_0x33c3a0}},'log':_0x4559('0x2')});};exports[_0x4559('0x3')]=function(_0x4341b2,_0x132f64){return client[_0x4559('0x1')](_0x4559('0x4'),{'body':_0x132f64,'options':{'where':{'id':_0x4341b2}},'log':_0x4559('0x5')});}; \ No newline at end of file +var _0x65b3=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x59c5e8,_0x482de4){var _0x220a95=function(_0x52c439){while(--_0x52c439){_0x59c5e8['push'](_0x59c5e8['shift']());}};_0x220a95(++_0x482de4);}(_0x65b3,0x1e4));var _0x365b=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x65b3[_0x2a276d];return _0x2914cd;};'use strict';var client=require(_0x365b('0x0'));exports[_0x365b('0x1')]=function(_0x30f902,_0xa427af){return client[_0x365b('0x2')](_0x365b('0x3'),{'body':_0xa427af,'options':{'where':{'id':_0x30f902}},'log':'updateChatInteraction'});};exports[_0x365b('0x4')]=function(_0x247db6,_0x44ae14){return client[_0x365b('0x2')]('AddTagsToChatInteraction',{'body':_0x44ae14,'options':{'where':{'id':_0x247db6}},'log':_0x365b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c15199f..655a841 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 _0x743a=['CreateChatMessage','../client','Request'];(function(_0xe0372e,_0x32ae8b){var _0x3c56ab=function(_0x2a0508){while(--_0x2a0508){_0xe0372e['push'](_0xe0372e['shift']());}};_0x3c56ab(++_0x32ae8b);}(_0x743a,0x1ae));var _0xa743=function(_0x456c93,_0x217748){_0x456c93=_0x456c93-0x0;var _0x368b5f=_0x743a[_0x456c93];return _0x368b5f;};'use strict';var client=require(_0xa743('0x0'));exports['create']=function(_0x2dc803){return client[_0xa743('0x1')](_0xa743('0x2'),{'body':_0x2dc803,'log':'createChatMessage'});}; \ No newline at end of file +var _0x9eac=['../client','create','Request','createChatMessage'];(function(_0x254bc4,_0x95004f){var _0x2f89d6=function(_0x33100a){while(--_0x33100a){_0x254bc4['push'](_0x254bc4['shift']());}};_0x2f89d6(++_0x95004f);}(_0x9eac,0x188));var _0xc9ea=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x9eac[_0x2272b5];return _0x110156;};'use strict';var client=require(_0xc9ea('0x0'));exports[_0xc9ea('0x1')]=function(_0x463f33){return client[_0xc9ea('0x2')]('CreateChatMessage',{'body':_0x463f33,'log':_0xc9ea('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 720ef93..0a3fd7e 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 _0x3fa4=['../client','name','timeout','strategy','User','Agents','online','getChatQueues'];(function(_0x30ff2a,_0x43a8cb){var _0x177d51=function(_0x3aaa53){while(--_0x3aaa53){_0x30ff2a['push'](_0x30ff2a['shift']());}};_0x177d51(++_0x43a8cb);}(_0x3fa4,0xf0));var _0x43fa=function(_0x145cec,_0x1c7390){_0x145cec=_0x145cec-0x0;var _0xe204e1=_0x3fa4[_0x145cec];return _0xe204e1;};'use strict';var client=require(_0x43fa('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x43fa('0x1'),_0x43fa('0x2'),_0x43fa('0x3')],'include':[{'model':_0x43fa('0x4'),'as':_0x43fa('0x5'),'attributes':['id',_0x43fa('0x1'),_0x43fa('0x6'),'chatPause']}]},'log':_0x43fa('0x7')});};}; \ No newline at end of file +var _0x615a=['getChatQueues','../client','Request','name','timeout','strategy','User','online'];(function(_0x4dedf7,_0x38fec4){var _0x25c222=function(_0x5195c8){while(--_0x5195c8){_0x4dedf7['push'](_0x4dedf7['shift']());}};_0x25c222(++_0x38fec4);}(_0x615a,0x119));var _0xa615=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0x615a[_0x5a1cc9];return _0x471761;};'use strict';var client=require(_0xa615('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa615('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xa615('0x2'),_0xa615('0x3'),_0xa615('0x4')],'include':[{'model':_0xa615('0x5'),'as':'Agents','attributes':['id',_0xa615('0x2'),_0xa615('0x6'),'chatPause']}]},'log':_0xa615('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7c54e5e..5922d16 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 _0x63bb=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x178de8,_0x3e9024){var _0x19edb2=function(_0x63a9df){while(--_0x63a9df){_0x178de8['push'](_0x178de8['shift']());}};_0x19edb2(++_0x3e9024);}(_0x63bb,0xf8));var _0xb63b=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x63bb[_0x4b03d3];return _0x58a968;};'use strict';var client=require(_0xb63b('0x0'));exports[_0xb63b('0x1')]=function(_0x1a2a48){return client[_0xb63b('0x2')](_0xb63b('0x3'),{'body':_0x1a2a48,'log':_0xb63b('0x3')});};exports[_0xb63b('0x4')]=function(_0x47ee22,_0x48a423){return client[_0xb63b('0x2')](_0xb63b('0x5'),{'body':_0x48a423,'options':{'where':{'uniqueid':_0x47ee22},'order':[['id',_0xb63b('0x6')]],'limit':0x1},'log':_0xb63b('0x5')});}; \ No newline at end of file +var _0x25ad=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x25ad,0x1b1));var _0xd25a=function(_0x1f0bba,_0x430c51){_0x1f0bba=_0x1f0bba-0x0;var _0x258c06=_0x25ad[_0x1f0bba];return _0x258c06;};'use strict';var client=require(_0xd25a('0x0'));exports['create']=function(_0xa9ddeb){return client[_0xd25a('0x1')](_0xd25a('0x2'),{'body':_0xa9ddeb,'log':'CreateChatQueueReport'});};exports[_0xd25a('0x3')]=function(_0x3a67e3,_0x1532c5){return client[_0xd25a('0x1')](_0xd25a('0x4'),{'body':_0x1532c5,'options':{'where':{'uniqueid':_0x3a67e3},'order':[['id',_0xd25a('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c5dfb0f..d1045ed 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(_0x3fe2c6,_0xe0af43){var _0x3740ec=function(_0x1dff23){while(--_0x1dff23){_0x3fe2c6['push'](_0x3fe2c6['shift']());}};_0x3740ec(++_0xe0af43);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x444443,_0x244b77){var _0x3dcad2=function(_0x410f9a){while(--_0x410f9a){_0x444443['push'](_0x444443['shift']());}};_0x3dcad2(++_0x244b77);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 7c4d429..bda61e2 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 _0x5214=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x583841,_0x566591){var _0x171305=function(_0x48b53a){while(--_0x48b53a){_0x583841['push'](_0x583841['shift']());}};_0x171305(++_0x566591);}(_0x5214,0x1c6));var _0x4521=function(_0x51b66f,_0x23c9b0){_0x51b66f=_0x51b66f-0x0;var _0x545f8f=_0x5214[_0x51b66f];return _0x545f8f;};'use strict';var client=require(_0x4521('0x0'));exports['create']=function(_0x54beef){return client[_0x4521('0x1')](_0x4521('0x2'),{'body':_0x54beef,'log':_0x4521('0x3')});}; \ No newline at end of file +var _0xdbf8=['Request','createFaxMessage','../client'];(function(_0x1f4496,_0x478a0d){var _0x3ea776=function(_0x74fbb1){while(--_0x74fbb1){_0x1f4496['push'](_0x1f4496['shift']());}};_0x3ea776(++_0x478a0d);}(_0xdbf8,0x128));var _0x8dbf=function(_0x74562b,_0x4bbcc5){_0x74562b=_0x74562b-0x0;var _0x12d3f6=_0xdbf8[_0x74562b];return _0x12d3f6;};'use strict';var client=require(_0x8dbf('0x0'));exports['create']=function(_0x54a8d4){return client[_0x8dbf('0x1')]('CreateFaxMessage',{'body':_0x54a8d4,'log':_0x8dbf('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 170080f..2139fe8 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 _0x3fdd=['Request','timeout','Agents','name','online','faxPause','getFaxQueues'];(function(_0x1cc1fd,_0x33f9f1){var _0x5e3d41=function(_0x356881){while(--_0x356881){_0x1cc1fd['push'](_0x1cc1fd['shift']());}};_0x5e3d41(++_0x33f9f1);}(_0x3fdd,0x68));var _0xd3fd=function(_0x374f98,_0x1399d2){_0x374f98=_0x374f98-0x0;var _0x7cdb71=_0x3fdd[_0x374f98];return _0x7cdb71;};'use strict';var client=require('../client');exports[_0xd3fd('0x0')]=function(){return function(){return client[_0xd3fd('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0xd3fd('0x2'),'strategy'],'include':[{'model':'User','as':_0xd3fd('0x3'),'attributes':['id',_0xd3fd('0x4'),_0xd3fd('0x5'),_0xd3fd('0x6')]}]},'log':_0xd3fd('0x0')});};}; \ No newline at end of file +var _0x7317=['Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x2dc399,_0x52d662){var _0x44ab8d=function(_0x461664){while(--_0x461664){_0x2dc399['push'](_0x2dc399['shift']());}};_0x44ab8d(++_0x52d662);}(_0x7317,0x1d0));var _0x7731=function(_0x541605,_0x17344b){_0x541605=_0x541605-0x0;var _0x5d66cd=_0x7317[_0x541605];return _0x5d66cd;};'use strict';var client=require(_0x7731('0x0'));exports[_0x7731('0x1')]=function(){return function(){return client[_0x7731('0x2')](_0x7731('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':'User','as':_0x7731('0x4'),'attributes':['id','name','online',_0x7731('0x5')]}]},'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 a2730f2..5b90bee 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 _0x579c=['../client','create','Request','UpdateFaxQueueReport'];(function(_0x34b23e,_0x583971){var _0x7799a1=function(_0x30b94b){while(--_0x30b94b){_0x34b23e['push'](_0x34b23e['shift']());}};_0x7799a1(++_0x583971);}(_0x579c,0x1dc));var _0xc579=function(_0x2b202c,_0x41a18c){_0x2b202c=_0x2b202c-0x0;var _0x2cdd44=_0x579c[_0x2b202c];return _0x2cdd44;};'use strict';var client=require(_0xc579('0x0'));exports[_0xc579('0x1')]=function(_0x38f4b4){return client[_0xc579('0x2')]('CreateFaxQueueReport',{'body':_0x38f4b4,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x23e839,_0x48d5fc){return client['Request'](_0xc579('0x3'),{'body':_0x48d5fc,'options':{'where':{'uniqueid':_0x23e839},'order':[['id','DESC']],'limit':0x1},'log':_0xc579('0x3')});}; \ No newline at end of file +var _0x3805=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x119681,_0x26d5d9){var _0x2102e1=function(_0x1a276f){while(--_0x1a276f){_0x119681['push'](_0x119681['shift']());}};_0x2102e1(++_0x26d5d9);}(_0x3805,0x1f2));var _0x5380=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3805[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x5380('0x0'));exports[_0x5380('0x1')]=function(_0xf1498){return client['Request'](_0x5380('0x2'),{'body':_0xf1498,'log':_0x5380('0x2')});};exports[_0x5380('0x3')]=function(_0x586640,_0x42a887){return client['Request']('UpdateFaxQueueReport',{'body':_0x42a887,'options':{'where':{'uniqueid':_0x586640},'order':[['id','DESC']],'limit':0x1},'log':_0x5380('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 03c6857..285bcbc 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 _0x9d40=['getIntervals','Request','GetInterval','Interval','Intervals','name','interval'];(function(_0x2dd970,_0x57abf9){var _0x1bc477=function(_0x311409){while(--_0x311409){_0x2dd970['push'](_0x2dd970['shift']());}};_0x1bc477(++_0x57abf9);}(_0x9d40,0x16c));var _0x09d4=function(_0x5e47cd,_0x1eae76){_0x5e47cd=_0x5e47cd-0x0;var _0x2373cc=_0x9d40[_0x5e47cd];return _0x2373cc;};'use strict';var client=require('../client');exports[_0x09d4('0x0')]=function(){return function(){return client[_0x09d4('0x1')](_0x09d4('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x09d4('0x3'),'as':_0x09d4('0x4'),'attributes':['id',_0x09d4('0x5'),_0x09d4('0x6')]}]},'log':_0x09d4('0x0')});};}; \ No newline at end of file +var _0x9fd9=['Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x266b6e,_0x184c0d){var _0x3edd74=function(_0x3f3c9a){while(--_0x3f3c9a){_0x266b6e['push'](_0x266b6e['shift']());}};_0x3edd74(++_0x184c0d);}(_0x9fd9,0xf2));var _0x99fd=function(_0x295a3b,_0x2e4807){_0x295a3b=_0x295a3b-0x0;var _0x326794=_0x9fd9[_0x295a3b];return _0x326794;};'use strict';var client=require(_0x99fd('0x0'));exports[_0x99fd('0x1')]=function(){return function(){return client[_0x99fd('0x2')](_0x99fd('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x99fd('0x4'),'attributes':['id','name',_0x99fd('0x5')]}]},'log':_0x99fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a9629b5..c04146a 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 _0x68b3=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x4cbe6a,_0x593aae){_0x4cbe6a=_0x4cbe6a-0x0;var _0x5273fa=_0x68b3[_0x4cbe6a];return _0x5273fa;};'use strict';var client=require(_0x368b('0x0'));exports[_0x368b('0x1')]=function(_0x3e8034,_0xa371c){return client[_0x368b('0x2')]('UpdateMailInteraction',{'body':_0xa371c,'options':{'where':{'id':_0x3e8034}},'log':_0x368b('0x3')});};exports[_0x368b('0x4')]=function(_0xc40116,_0x404282){return client['Request'](_0x368b('0x5'),{'body':_0x404282,'options':{'where':{'id':_0xc40116}},'log':_0x368b('0x6')});}; \ No newline at end of file +var _0x5204=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x5204,0xdf));var _0x4520=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x5204[_0x15d18f];return _0xd12bf7;};'use strict';var client=require(_0x4520('0x0'));exports[_0x4520('0x1')]=function(_0x53b1ab,_0x12a3a1){return client[_0x4520('0x2')](_0x4520('0x3'),{'body':_0x12a3a1,'options':{'where':{'id':_0x53b1ab}},'log':_0x4520('0x4')});};exports[_0x4520('0x5')]=function(_0x592fe0,_0x41d89c){return client['Request'](_0x4520('0x6'),{'body':_0x41d89c,'options':{'where':{'id':_0x592fe0}},'log':_0x4520('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3563cf6..5609d20 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 _0xf021=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x4288e8,_0x42ae9a){var _0x238e62=function(_0x1c9a00){while(--_0x1c9a00){_0x4288e8['push'](_0x4288e8['shift']());}};_0x238e62(++_0x42ae9a);}(_0xf021,0x100));var _0x1f02=function(_0x5a300a,_0x198ebb){_0x5a300a=_0x5a300a-0x0;var _0xb2260f=_0xf021[_0x5a300a];return _0xb2260f;};'use strict';var client=require(_0x1f02('0x0'));exports[_0x1f02('0x1')]=function(_0x3b0bdf){return client[_0x1f02('0x2')](_0x1f02('0x3'),{'body':_0x3b0bdf,'log':_0x1f02('0x4')});}; \ No newline at end of file +var _0xf5c6=['createMailMessage','Request','CreateMailMessage'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf5c6,0x1ea));var _0x6f5c=function(_0x4ba0f,_0x2e980f){_0x4ba0f=_0x4ba0f-0x0;var _0x2dfca1=_0xf5c6[_0x4ba0f];return _0x2dfca1;};'use strict';var client=require('../client');exports['create']=function(_0x107dcd){return client[_0x6f5c('0x0')](_0x6f5c('0x1'),{'body':_0x107dcd,'log':_0x6f5c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index de6377f..19e0444 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 _0x2f9b=['../client','name','strategy','User','Agents','online','mailPause','getMailQueues'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x2f9b,0x1b8));var _0xb2f9=function(_0x514801,_0x35f1a5){_0x514801=_0x514801-0x0;var _0x1648cd=_0x2f9b[_0x514801];return _0x1648cd;};'use strict';var client=require(_0xb2f9('0x0'));exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xb2f9('0x1'),'timeout',_0xb2f9('0x2')],'include':[{'model':_0xb2f9('0x3'),'as':_0xb2f9('0x4'),'attributes':['id',_0xb2f9('0x1'),_0xb2f9('0x5'),_0xb2f9('0x6')]}]},'log':_0xb2f9('0x7')});};}; \ No newline at end of file +var _0x1980=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','Agents'];(function(_0x25f9d4,_0x2f3ccb){var _0x1460e6=function(_0x32f966){while(--_0x32f966){_0x25f9d4['push'](_0x25f9d4['shift']());}};_0x1460e6(++_0x2f3ccb);}(_0x1980,0x1ec));var _0x0198=function(_0x4e350c,_0x3b736b){_0x4e350c=_0x4e350c-0x0;var _0x17c622=_0x1980[_0x4e350c];return _0x17c622;};'use strict';var client=require(_0x0198('0x0'));exports[_0x0198('0x1')]=function(){return function(){return client[_0x0198('0x2')](_0x0198('0x3'),{'options':{'raw':![],'attributes':['id',_0x0198('0x4'),_0x0198('0x5'),_0x0198('0x6')],'include':[{'model':'User','as':_0x0198('0x7'),'attributes':['id',_0x0198('0x4'),_0x0198('0x8'),_0x0198('0x9')]}]},'log':_0x0198('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f9351e2..1a04472 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 _0x3b05=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update'];(function(_0x223aa0,_0x3e2e7a){var _0x28106b=function(_0x570450){while(--_0x570450){_0x223aa0['push'](_0x223aa0['shift']());}};_0x28106b(++_0x3e2e7a);}(_0x3b05,0x184));var _0x53b0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3b05[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x53b0('0x0'));exports[_0x53b0('0x1')]=function(_0x5edc31){return client['Request'](_0x53b0('0x2'),{'body':_0x5edc31,'log':_0x53b0('0x2')});};exports[_0x53b0('0x3')]=function(_0x420cd0,_0x1e1cb9){return client[_0x53b0('0x4')](_0x53b0('0x5'),{'body':_0x1e1cb9,'options':{'where':{'uniqueid':_0x420cd0},'order':[['id',_0x53b0('0x6')]],'limit':0x1},'log':_0x53b0('0x5')});}; \ No newline at end of file +var _0x253c=['Request','update','UpdateMailQueueReport','DESC','../client'];(function(_0x132693,_0xcf878d){var _0x3933a6=function(_0x4a1e3){while(--_0x4a1e3){_0x132693['push'](_0x132693['shift']());}};_0x3933a6(++_0xcf878d);}(_0x253c,0x12b));var _0xc253=function(_0x317257,_0x1677dc){_0x317257=_0x317257-0x0;var _0x1f235d=_0x253c[_0x317257];return _0x1f235d;};'use strict';var client=require(_0xc253('0x0'));exports['create']=function(_0x2d8aca){return client[_0xc253('0x1')]('CreateMailQueueReport',{'body':_0x2d8aca,'log':'CreateMailQueueReport'});};exports[_0xc253('0x2')]=function(_0x2c9435,_0x53058e){return client['Request'](_0xc253('0x3'),{'body':_0x53058e,'options':{'where':{'uniqueid':_0x2c9435},'order':[['id',_0xc253('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f4d8a2a..4ab781d 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 _0x2815=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','update'];(function(_0xe07be8,_0x5ac2dc){var _0xf1e8f6=function(_0x2f7b37){while(--_0x2f7b37){_0xe07be8['push'](_0xe07be8['shift']());}};_0xf1e8f6(++_0x5ac2dc);}(_0x2815,0x1af));var _0x5281=function(_0x4426df,_0x2b051c){_0x4426df=_0x4426df-0x0;var _0x2a6fb8=_0x2815[_0x4426df];return _0x2a6fb8;};'use strict';var client=require('../client');exports[_0x5281('0x0')]=function(_0x20bf50,_0x3cc022){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x3cc022,'options':{'where':{'id':_0x20bf50}},'log':_0x5281('0x1')});};exports['addTags']=function(_0x4d5a6f,_0x5b6930){return client['Request'](_0x5281('0x2'),{'body':_0x5b6930,'options':{'where':{'id':_0x4d5a6f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x73a6=['../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x45975f,_0x475637){var _0x5c3424=function(_0x24b7e4){while(--_0x24b7e4){_0x45975f['push'](_0x45975f['shift']());}};_0x5c3424(++_0x475637);}(_0x73a6,0x1c2));var _0x673a=function(_0x5e5203,_0x4335bf){_0x5e5203=_0x5e5203-0x0;var _0x2bcc8e=_0x73a6[_0x5e5203];return _0x2bcc8e;};'use strict';var client=require(_0x673a('0x0'));exports['update']=function(_0x1a4088,_0x376af3){return client[_0x673a('0x1')](_0x673a('0x2'),{'body':_0x376af3,'options':{'where':{'id':_0x1a4088}},'log':_0x673a('0x3')});};exports[_0x673a('0x4')]=function(_0x224f2e,_0xec25a4){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0xec25a4,'options':{'where':{'id':_0x224f2e}},'log':_0x673a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 717631a..51fce58 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 _0xb04f=['create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x225240,_0x4542c4){var _0x21b6bb=function(_0x59fed1){while(--_0x59fed1){_0x225240['push'](_0x225240['shift']());}};_0x21b6bb(++_0x4542c4);}(_0xb04f,0x1a4));var _0xfb04=function(_0x3d9019,_0x5ca52b){_0x3d9019=_0x3d9019-0x0;var _0x295666=_0xb04f[_0x3d9019];return _0x295666;};'use strict';var client=require('../client');exports[_0xfb04('0x0')]=function(_0x312f59){return client['Request'](_0xfb04('0x1'),{'body':_0x312f59,'log':_0xfb04('0x2')});}; \ No newline at end of file +var _0x9d75=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9d75,0x16d));var _0x59d7=function(_0x81fca3,_0x2fe4b6){_0x81fca3=_0x81fca3-0x0;var _0x1914f3=_0x9d75[_0x81fca3];return _0x1914f3;};'use strict';var client=require(_0x59d7('0x0'));exports[_0x59d7('0x1')]=function(_0x353a31){return client[_0x59d7('0x2')](_0x59d7('0x3'),{'body':_0x353a31,'log':_0x59d7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0037456..ccc1b50 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 _0x5dea=['name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','Agents'];(function(_0x3dded2,_0x43f325){var _0x22319a=function(_0x1aca75){while(--_0x1aca75){_0x3dded2['push'](_0x3dded2['shift']());}};_0x22319a(++_0x43f325);}(_0x5dea,0x1bc));var _0xa5de=function(_0x5f50d3,_0x4c6787){_0x5f50d3=_0x5f50d3-0x0;var _0x1710e7=_0x5dea[_0x5f50d3];return _0x1710e7;};'use strict';var client=require(_0xa5de('0x0'));exports[_0xa5de('0x1')]=function(){return function(){return client[_0xa5de('0x2')](_0xa5de('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xa5de('0x4')],'include':[{'model':'User','as':_0xa5de('0x5'),'attributes':['id',_0xa5de('0x6'),_0xa5de('0x7'),_0xa5de('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xb969=['timeout','strategy','Agents','online','openchannelPause','Request','GetOpenchannelQueue','name'];(function(_0x382b59,_0xac83a){var _0x1c8b18=function(_0x5bc4f6){while(--_0x5bc4f6){_0x382b59['push'](_0x382b59['shift']());}};_0x1c8b18(++_0xac83a);}(_0xb969,0x9d));var _0x9b96=function(_0x3a8e33,_0x5e6dc7){_0x3a8e33=_0x3a8e33-0x0;var _0x5c6a44=_0xb969[_0x3a8e33];return _0x5c6a44;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x9b96('0x0')](_0x9b96('0x1'),{'options':{'raw':![],'attributes':['id',_0x9b96('0x2'),_0x9b96('0x3'),_0x9b96('0x4')],'include':[{'model':'User','as':_0x9b96('0x5'),'attributes':['id','name',_0x9b96('0x6'),_0x9b96('0x7')]}]},'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 4e48da9..36ce37c 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 _0x4157=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x4157,0xf3));var _0x7415=function(_0x2214bd,_0x5d725e){_0x2214bd=_0x2214bd-0x0;var _0x44e646=_0x4157[_0x2214bd];return _0x44e646;};'use strict';var client=require(_0x7415('0x0'));exports[_0x7415('0x1')]=function(_0x325318){return client[_0x7415('0x2')](_0x7415('0x3'),{'body':_0x325318,'log':'CreateOpenchannelQueueReport'});};exports[_0x7415('0x4')]=function(_0x3bef76,_0x311038){return client[_0x7415('0x2')](_0x7415('0x5'),{'body':_0x311038,'options':{'where':{'uniqueid':_0x3bef76},'order':[['id',_0x7415('0x6')]],'limit':0x1},'log':_0x7415('0x5')});}; \ No newline at end of file +var _0xed55=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','create'];(function(_0x5d30f9,_0x16447b){var _0x4c9f07=function(_0x300347){while(--_0x300347){_0x5d30f9['push'](_0x5d30f9['shift']());}};_0x4c9f07(++_0x16447b);}(_0xed55,0xcb));var _0x5ed5=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0xed55[_0x47a12a];return _0x30cd40;};'use strict';var client=require('../client');exports[_0x5ed5('0x0')]=function(_0x2b889a){return client[_0x5ed5('0x1')](_0x5ed5('0x2'),{'body':_0x2b889a,'log':_0x5ed5('0x2')});};exports['update']=function(_0x1e4b61,_0x1dc0bb){return client['Request'](_0x5ed5('0x3'),{'body':_0x1dc0bb,'options':{'where':{'uniqueid':_0x1e4b61},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a7b151a..7bdeb95 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 _0x5d55=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x169a75,_0x541a4e){var _0x38665b=function(_0x1827c6){while(--_0x1827c6){_0x169a75['push'](_0x169a75['shift']());}};_0x38665b(++_0x541a4e);}(_0x5d55,0x1a4));var _0x55d5=function(_0x1af062,_0x2fb29d){_0x1af062=_0x1af062-0x0;var _0x325b54=_0x5d55[_0x1af062];return _0x325b54;};'use strict';var client=require('../client');exports[_0x55d5('0x0')]=function(_0x4cd0e2,_0x1de575){return client[_0x55d5('0x1')]('UpdateSmsInteraction',{'body':_0x1de575,'options':{'where':{'id':_0x4cd0e2}},'log':_0x55d5('0x2')});};exports[_0x55d5('0x3')]=function(_0x3bca0b,_0x546e6c){return client[_0x55d5('0x1')](_0x55d5('0x4'),{'body':_0x546e6c,'options':{'where':{'id':_0x3bca0b}},'log':_0x55d5('0x5')});}; \ No newline at end of file +var _0x6c32=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5a1585,_0x3a8636){var _0x53129e=function(_0x1cab36){while(--_0x1cab36){_0x5a1585['push'](_0x5a1585['shift']());}};_0x53129e(++_0x3a8636);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x26c3('0x0'));exports[_0x26c3('0x1')]=function(_0x3049a5,_0x416a62){return client[_0x26c3('0x2')](_0x26c3('0x3'),{'body':_0x416a62,'options':{'where':{'id':_0x3049a5}},'log':_0x26c3('0x4')});};exports[_0x26c3('0x5')]=function(_0x36528a,_0x49d4a1){return client[_0x26c3('0x2')](_0x26c3('0x6'),{'body':_0x49d4a1,'options':{'where':{'id':_0x36528a}},'log':_0x26c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 62df484..91540f4 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 _0x7f45=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f45,0x6a));var _0x57f4=function(_0x442f61,_0x23a381){_0x442f61=_0x442f61-0x0;var _0x4efe1b=_0x7f45[_0x442f61];return _0x4efe1b;};'use strict';var client=require(_0x57f4('0x0'));exports['create']=function(_0x399fff){return client[_0x57f4('0x1')](_0x57f4('0x2'),{'body':_0x399fff,'log':_0x57f4('0x3')});}; \ No newline at end of file +var _0xb0a2=['CreateSmsMessage','createSmsMessage','Request'];(function(_0x4abc87,_0x1bc7da){var _0x5fc4df=function(_0x3d2eef){while(--_0x3d2eef){_0x4abc87['push'](_0x4abc87['shift']());}};_0x5fc4df(++_0x1bc7da);}(_0xb0a2,0x9e));var _0x2b0a=function(_0xde95e2,_0x2dd4e1){_0xde95e2=_0xde95e2-0x0;var _0x3997cf=_0xb0a2[_0xde95e2];return _0x3997cf;};'use strict';var client=require('../client');exports['create']=function(_0x4c1ac6){return client[_0x2b0a('0x0')](_0x2b0a('0x1'),{'body':_0x4c1ac6,'log':_0x2b0a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d5a82fe..4449b97 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5ea2a7,_0x2034f8){var _0x55ef2e=function(_0x3b594d){while(--_0x3b594d){_0x5ea2a7['push'](_0x5ea2a7['shift']());}};_0x55ef2e(++_0x2034f8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5309f9,_0x148e41){var _0x3d0201=function(_0x41d866){while(--_0x41d866){_0x5309f9['push'](_0x5309f9['shift']());}};_0x3d0201(++_0x148e41);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index dd5c4bc..35aa439 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4a7984,_0x33e68f){var _0x40b15b=function(_0x2d852e){while(--_0x2d852e){_0x4a7984['push'](_0x4a7984['shift']());}};_0x40b15b(++_0x33e68f);}(_0x70e0,0x17b));var _0x070e=function(_0x3e78aa,_0x23dcff){_0x3e78aa=_0x3e78aa-0x0;var _0x1256ee=_0x70e0[_0x3e78aa];return _0x1256ee;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d5f02,_0x5529cb){_0x2d5f02=_0x2d5f02-0x0;var _0x51b507=_0xedd9[_0x2d5f02];return _0x51b507;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0898e6c..a3a65df 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(_0x36a6db,_0x5a7e0f){var _0x160ea4=function(_0x513e20){while(--_0x513e20){_0x36a6db['push'](_0x36a6db['shift']());}};_0x160ea4(++_0x5a7e0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x19d801,_0x36bc6c){var _0x5f5838=function(_0x460763){while(--_0x460763){_0x19d801['push'](_0x19d801['shift']());}};_0x5f5838(++_0x36bc6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 4ed9aed..46566ef 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 _0xe451=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0xe451,0xec));var _0x1e45=function(_0x2c5f39,_0x472a04){_0x2c5f39=_0x2c5f39-0x0;var _0x581642=_0xe451[_0x2c5f39];return _0x581642;};'use strict';var client=require('../client');exports['update']=function(_0xfe805c,_0x479192){return client['Request']('UpdateWhatsappInteraction',{'body':_0x479192,'options':{'where':{'id':_0xfe805c}},'log':_0x1e45('0x0')});};exports[_0x1e45('0x1')]=function(_0x1f9061,_0x197c03){return client['Request'](_0x1e45('0x2'),{'body':_0x197c03,'options':{'where':{'id':_0x1f9061}},'log':_0x1e45('0x3')});}; \ No newline at end of file +var _0x41fe=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0xbd37c2,_0x343d47){var _0x4b2c54=function(_0x40a76e){while(--_0x40a76e){_0xbd37c2['push'](_0xbd37c2['shift']());}};_0x4b2c54(++_0x343d47);}(_0x41fe,0xd1));var _0xe41f=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x41fe[_0x8ba19a];return _0x2bd8b4;};'use strict';var client=require(_0xe41f('0x0'));exports[_0xe41f('0x1')]=function(_0x38cf9f,_0x2c527f){return client[_0xe41f('0x2')](_0xe41f('0x3'),{'body':_0x2c527f,'options':{'where':{'id':_0x38cf9f}},'log':_0xe41f('0x4')});};exports[_0xe41f('0x5')]=function(_0x2e580b,_0x1c9625){return client[_0xe41f('0x2')](_0xe41f('0x6'),{'body':_0x1c9625,'options':{'where':{'id':_0x2e580b}},'log':_0xe41f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2419b58..09b520b 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 _0x5ffb=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ffb,0x1ed));var _0xb5ff=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5ffb[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xb5ff('0x0')]=function(_0x721b6a){return client[_0xb5ff('0x1')](_0xb5ff('0x2'),{'body':_0x721b6a,'log':_0xb5ff('0x3')});}; \ No newline at end of file +var _0xf12e=['../client','Request','createWhatsappMessage'];(function(_0x437156,_0xf15292){var _0xda882a=function(_0x480d77){while(--_0x480d77){_0x437156['push'](_0x437156['shift']());}};_0xda882a(++_0xf15292);}(_0xf12e,0x96));var _0xef12=function(_0x585276,_0x553f5a){_0x585276=_0x585276-0x0;var _0x4a7181=_0xf12e[_0x585276];return _0x4a7181;};'use strict';var client=require(_0xef12('0x0'));exports['create']=function(_0x182eaf){return client[_0xef12('0x1')]('CreateWhatsappMessage',{'body':_0x182eaf,'log':_0xef12('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b6dd377..f73ce11 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 _0xe1bc=['getWhatsappQueues','name','timeout','User','Agents','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1bc,0xc5));var _0xce1b=function(_0xefc4eb,_0x519792){_0xefc4eb=_0xefc4eb-0x0;var _0x253d31=_0xe1bc[_0xefc4eb];return _0x253d31;};'use strict';var client=require(_0xce1b('0x0'));exports[_0xce1b('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xce1b('0x2'),_0xce1b('0x3'),'strategy'],'include':[{'model':_0xce1b('0x4'),'as':_0xce1b('0x5'),'attributes':['id',_0xce1b('0x2'),'online','whatsappPause']}]},'log':_0xce1b('0x1')});};}; \ No newline at end of file +var _0xc3a1=['name','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x13e709,_0x1e1ee4){var _0x254774=function(_0x58b877){while(--_0x58b877){_0x13e709['push'](_0x13e709['shift']());}};_0x254774(++_0x1e1ee4);}(_0xc3a1,0x182));var _0x1c3a=function(_0x193f6d,_0x212288){_0x193f6d=_0x193f6d-0x0;var _0xd62d52=_0xc3a1[_0x193f6d];return _0xd62d52;};'use strict';var client=require(_0x1c3a('0x0'));exports[_0x1c3a('0x1')]=function(){return function(){return client[_0x1c3a('0x2')](_0x1c3a('0x3'),{'options':{'raw':![],'attributes':['id',_0x1c3a('0x4'),'timeout',_0x1c3a('0x5')],'include':[{'model':_0x1c3a('0x6'),'as':_0x1c3a('0x7'),'attributes':['id',_0x1c3a('0x4'),_0x1c3a('0x8'),_0x1c3a('0x9')]}]},'log':_0x1c3a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3996ae8..61109b1 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 _0xf7cf=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf7cf,0x1e0));var _0xff7c=function(_0x23e33d,_0x31c8c8){_0x23e33d=_0x23e33d-0x0;var _0x818fc=_0xf7cf[_0x23e33d];return _0x818fc;};'use strict';var client=require(_0xff7c('0x0'));exports[_0xff7c('0x1')]=function(_0x4fb88c){return client[_0xff7c('0x2')]('CreateWhatsappQueueReport',{'body':_0x4fb88c,'log':_0xff7c('0x3')});};exports[_0xff7c('0x4')]=function(_0x3a11c1,_0x220df7){return client[_0xff7c('0x2')](_0xff7c('0x5'),{'body':_0x220df7,'options':{'where':{'uniqueid':_0x3a11c1},'order':[['id',_0xff7c('0x6')]],'limit':0x1},'log':_0xff7c('0x5')});}; \ No newline at end of file +var _0x7f9e=['UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7f9e,0xec));var _0xe7f9=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x7f9e[_0x1344d6];return _0xf45b24;};'use strict';var client=require('../client');exports[_0xe7f9('0x0')]=function(_0x30fb73){return client[_0xe7f9('0x1')](_0xe7f9('0x2'),{'body':_0x30fb73,'log':_0xe7f9('0x2')});};exports[_0xe7f9('0x3')]=function(_0x58d9fa,_0xbbe7e6){return client[_0xe7f9('0x1')](_0xe7f9('0x4'),{'body':_0xbbe7e6,'options':{'where':{'uniqueid':_0x58d9fa},'order':[['id',_0xe7f9('0x5')]],'limit':0x1},'log':_0xe7f9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 5708e8f..818a25a 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 _0xcc6c=['length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','name','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xcc6c,0xd2));var _0xccc6=function(_0x119730,_0x1fbcbb){_0x119730=_0x119730-0x0;var _0x2d279c=_0xcc6c[_0x119730];return _0x2d279c;};'use strict';var schema=require(_0xccc6('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xccc6('0x1'));var logger=require(_0xccc6('0x2'))(_0xccc6('0x3'));var strategy=require(_0xccc6('0x4'));var queue=schema({'name':{'type':_0xccc6('0x5'),'required':!![],'message':_0xccc6('0x6')},'timeout':{'type':'number','message':_0xccc6('0x7')}});function writeLog(_0x5be9b9,_0x165b66,_0x18872b){return logger['info'](util[_0xccc6('0x8')](_0xccc6('0x9'),_0x5be9b9,_0x165b66['name'],_0x18872b));}function handleFindAgent(_0x11f957){return function(_0x2d58fb){return _0x2d58fb['name']['toLowerCase']()===_0x11f957[_0xccc6('0xa')]();};}exports[_0xccc6('0xb')]=function(_0x2acb09,_0x1735c3,_0x53fa01,_0x14c13b){return function(_0x44fcab){try{var _0x2f3366={'name':_0x1735c3[0x0],'timeout':_0x1735c3[0x1]};var _0x1f45ce=queue['validate'](_0x2f3366,{'typecast':!![]});if(_0x1f45ce[_0xccc6('0xc')]){logger[_0xccc6('0xd')](_0xccc6('0xe'),_0x2acb09,_[_0xccc6('0xf')](_0x1f45ce,_0xccc6('0x10'))[_0xccc6('0x11')](',\x20'));_0x44fcab[_0xccc6('0x12')]();}else{var _0x539b85=_[_0xccc6('0x13')](_0x53fa01[_0xccc6('0x14')],handleFindAgent(_0x2f3366[_0xccc6('0x15')]));if(_0x539b85){var _0x1eb3d9=(_0x2f3366[_0xccc6('0x16')]||0xa)*0x3e8;var _0x2b6e09,_0x423ac3;var _0x2b6d20=seqqueue['createQueue'](_0x1eb3d9);_0x2b6d20['id']=_0x2acb09;_0x2b6d20[_0xccc6('0x17')]=_0x1eb3d9;_0x2b6d20[_0xccc6('0x18')]=_0x14c13b[_0xccc6('0x18')];writeLog(_0x2acb09,_0x539b85,util['format'](_0xccc6('0x19'),_0x1eb3d9));_0x53fa01[_0xccc6('0x1a')][_0x2acb09]['on'](_0xccc6('0x1b'),function(){logger['info'](_0xccc6('0x1c'),_0x2acb09);clearTimeout(_0x423ac3);_0x423ac3=undefined;_0x2b6d20[_0xccc6('0x1d')]();if(_0x53fa01[_0xccc6('0x1a')][_0x2acb09]){delete _0x53fa01[_0xccc6('0x1a')][_0x2acb09];}_0x44fcab[_0xccc6('0x12')]();});_0x53fa01[_0xccc6('0x1a')][_0x2acb09]['on']('complete',function(){if(_0x53fa01['rules'][_0x2acb09]){delete _0x53fa01[_0xccc6('0x1a')][_0x2acb09];}});_0x423ac3=setTimeout(function(){logger[_0xccc6('0x1e')](_0xccc6('0x1f'),_0x2acb09);clearTimeout(_0x423ac3);_0x2b6d20['close']();_0x44fcab[_0xccc6('0x20')]();},_0x1eb3d9);strategy[_0xccc6('0x21')](_0x2b6d20,_0x539b85,_0x53fa01,_0x14c13b);}else{logger['error'](_0xccc6('0x22'),_0x2acb09,_0x2f3366['name']);_0x44fcab[_0xccc6('0x12')]();}}}catch(_0x4b0a85){console[_0xccc6('0x23')](_0x4b0a85);logger['error']('[%s][QUEUE]\x20%s',_0x2acb09,_0x4b0a85[_0xccc6('0x24')]);_0x44fcab[_0xccc6('0x12')]();}};}; \ No newline at end of file +var _0x3f26=['stop','find','agents','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','map','join'];(function(_0x25ff7e,_0x492eb8){var _0x1e8dcc=function(_0x1b1120){while(--_0x1b1120){_0x25ff7e['push'](_0x25ff7e['shift']());}};_0x1e8dcc(++_0x492eb8);}(_0x3f26,0x148));var _0x63f2=function(_0x5db5fc,_0x61dacf){_0x5db5fc=_0x5db5fc-0x0;var _0x214470=_0x3f26[_0x5db5fc];return _0x214470;};'use strict';var schema=require('validate');var _=require(_0x63f2('0x0'));var util=require(_0x63f2('0x1'));var seqqueue=require(_0x63f2('0x2'));var logger=require(_0x63f2('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x63f2('0x4')},'timeout':{'type':_0x63f2('0x5'),'message':_0x63f2('0x6')}});function writeLog(_0x5ef2a0,_0x39554a,_0x12723d){return logger['info'](util[_0x63f2('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5ef2a0,_0x39554a[_0x63f2('0x8')],_0x12723d));}function handleFindAgent(_0x5d7dc8){return function(_0x1ec53f){return _0x1ec53f[_0x63f2('0x8')][_0x63f2('0x9')]()===_0x5d7dc8[_0x63f2('0x9')]();};}exports[_0x63f2('0xa')]=function(_0x282eb6,_0x1794d4,_0x25ac5e,_0x4009f2){return function(_0x52031c){try{var _0x32ce9b={'name':_0x1794d4[0x0],'timeout':_0x1794d4[0x1]};var _0x472ccf=queue['validate'](_0x32ce9b,{'typecast':!![]});if(_0x472ccf['length']){logger['error']('[%s][AGENT]\x20%s',_0x282eb6,_[_0x63f2('0xb')](_0x472ccf,'message')[_0x63f2('0xc')](',\x20'));_0x52031c[_0x63f2('0xd')]();}else{var _0x29b8cb=_[_0x63f2('0xe')](_0x25ac5e[_0x63f2('0xf')],handleFindAgent(_0x32ce9b['name']));if(_0x29b8cb){var _0x50b514=(_0x32ce9b['timeout']||0xa)*0x3e8;var _0x3627c5,_0x51eac4;var _0x35d795=seqqueue['createQueue'](_0x50b514);_0x35d795['id']=_0x282eb6;_0x35d795[_0x63f2('0x10')]=_0x50b514;_0x35d795['channel']=_0x4009f2[_0x63f2('0x11')];writeLog(_0x282eb6,_0x29b8cb,util['format'](_0x63f2('0x12'),_0x50b514));_0x25ac5e[_0x63f2('0x13')][_0x282eb6]['on'](_0x63f2('0x14'),function(){logger[_0x63f2('0x15')](_0x63f2('0x16'),_0x282eb6);clearTimeout(_0x51eac4);_0x51eac4=undefined;_0x35d795[_0x63f2('0x17')]();if(_0x25ac5e['rules'][_0x282eb6]){delete _0x25ac5e['rules'][_0x282eb6];}_0x52031c[_0x63f2('0xd')]();});_0x25ac5e[_0x63f2('0x13')][_0x282eb6]['on'](_0x63f2('0x18'),function(){if(_0x25ac5e[_0x63f2('0x13')][_0x282eb6]){delete _0x25ac5e[_0x63f2('0x13')][_0x282eb6];}});_0x51eac4=setTimeout(function(){logger[_0x63f2('0x15')]('[%s][AGENT]\x20ROUTING\x20END',_0x282eb6);clearTimeout(_0x51eac4);_0x35d795['close']();_0x52031c[_0x63f2('0x19')]();},_0x50b514);strategy['agent'](_0x35d795,_0x29b8cb,_0x25ac5e,_0x4009f2);}else{logger[_0x63f2('0x1a')](_0x63f2('0x1b'),_0x282eb6,_0x32ce9b['name']);_0x52031c['stop']();}}}catch(_0x3a9288){console[_0x63f2('0x1c')](_0x3a9288);logger[_0x63f2('0x1a')](_0x63f2('0x1d'),_0x282eb6,_0x3a9288[_0x63f2('0x1e')]);_0x52031c[_0x63f2('0xd')]();}};}; \ 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 a66e00a..291bc73 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 _0x5184=['Message','create','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','amazonlex','providerName','providerResponse','then','dialogState','Failed','moment','aws-sdk','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','InteractionId','created','isEmpty','body'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x5184,0xa0));var _0x4518=function(_0x12f540,_0x1e1aae){_0x12f540=_0x12f540-0x0;var _0x1f4220=_0x5184[_0x12f540];return _0x1f4220;};'use strict';var _=require('lodash');var moment=require(_0x4518('0x0'));var AWS=require(_0x4518('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x4518('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4518('0x3')),'smsMessage':require(_0x4518('0x4')),'faxMessage':require(_0x4518('0x5')),'whatsappMessage':require(_0x4518('0x6'))};exports[_0x4518('0x7')]=function(_0x238edc,_0x4c962f){return function(_0x23920c){try{if(!_[_0x4518('0x8')](this[_0x4518('0x9')][_0x4518('0xa')])){logger[_0x4518('0xb')](_0x4518('0xc'),_0x238edc,_0x4518('0xd'));return _0x23920c[_0x4518('0xe')]();}var _0x4f81fe={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x4518('0xf')),'direction':_0x4518('0x10')};if(this[_0x4518('0x11')]===_0x4518('0x12')||this[_0x4518('0x11')]===_0x4518('0x13')){_0x4f81fe[_0x4518('0x14')]=this['interaction'][_0x4518('0x14')];}var _0x16116f=this['channel'];if(_0x16116f===_0x4518('0x15')){_0x4f81fe[_0x4518('0x16')]=this['account']['id'];}else{_0x4f81fe[_[_0x4518('0x17')](_0x16116f)+'AccountId']=this['account']['id'];}_0x4f81fe[_[_0x4518('0x17')](_0x16116f)+_0x4518('0x18')]=this[_0x4518('0x9')]['id'];if(this[_0x4518('0x9')][_0x4518('0x19')]){var _0xd0249=_0x4c962f[0x4];if(!_[_0x4518('0x1a')](_0xd0249)){_0x4f81fe[_0x4518('0x1b')]=utils['getMustacheRender'](_0xd0249,this);return rpc[_0x16116f+_0x4518('0x1c')][_0x4518('0x1d')](_0x4f81fe)['then'](function(_0x1a5648){logger[_0x4518('0xb')]('[%s][AMAZONLEX]\x20%s',_0x238edc,_0x4f81fe[_0x4518('0x1b')]);})[_0x4518('0x1e')](function(_0x509873){logger['error'](_0x4518('0xc'),_0x238edc,JSON[_0x4518('0x1f')](_0x509873));})[_0x4518('0x20')](function(){logger[_0x4518('0xb')](_0x4518('0x21'),_0x238edc);_0x23920c[_0x4518('0x22')]();});}else{logger[_0x4518('0xb')](_0x4518('0x23'),_0x238edc);_0x23920c['stop']();}}else{var _0x56fd27=this;var _0x2c19fa=new AWS[(_0x4518('0x24'))]({'accessKeyId':_0x4c962f[0x0],'secretAccessKey':_0x4c962f[0x1],'region':_0x4c962f[0x2]});var _0x2b503f={'botAlias':_0x4518('0x25'),'botName':_0x4c962f[0x3],'inputText':this[_0x4518('0x26')][_0x4518('0x1b')],'userId':this['channel']+':'+this['interaction']['id']['toString']()};_0x2c19fa[_0x4518('0x27')](_0x2b503f,function(_0x58191b,_0x241b51){if(_0x58191b){logger[_0x4518('0x28')]('[%s][AMAZONLEX]\x20%s',_0x238edc,_0x58191b[_0x4518('0x26')]);_0x23920c[_0x4518('0xe')]();}else if(_0x241b51&&_0x241b51[_0x4518('0x26')]){_0x56fd27[_0x4518('0x1b')][_0x4518('0x29')]=_0x241b51;_0x4f81fe[_0x4518('0x1b')]=_0x241b51['message'];_0x4f81fe[_0x4518('0x2a')]=_0x4518('0x29');_0x4f81fe[_0x4518('0x2b')]=JSON['stringify'](_0x241b51);return rpc[_0x16116f+_0x4518('0x1c')][_0x4518('0x1d')](_0x4f81fe)[_0x4518('0x2c')](function(_0x423d67){logger[_0x4518('0xb')](_0x4518('0xc'),_0x238edc,_0x4f81fe['body']);if(_0x241b51[_0x4518('0x2d')]==_0x4518('0x2e')){_0x23920c['next']();}else{_0x23920c[_0x4518('0x22')]();}})[_0x4518('0x1e')](function(_0x501e12){logger[_0x4518('0x28')](_0x4518('0xc'),_0x238edc,JSON[_0x4518('0x1f')](_0x501e12));_0x23920c[_0x4518('0xe')]();});}else{_0x23920c[_0x4518('0xe')]();}});}}catch(_0xb2bdd4){logger[_0x4518('0x28')]('[%s][AMAZONLEX]\x20%s',_0x238edc,JSON['stringify'](_0xb2bdd4));_0x23920c[_0x4518('0x22')]();}};}; \ No newline at end of file +var _0x80ee=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','then','body','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','amazonlex','providerName','create','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x80ee,0x199));var _0xe80e=function(_0x13eea8,_0x5ed8b2){_0x13eea8=_0x13eea8-0x0;var _0x255a29=_0x80ee[_0x13eea8];return _0x255a29;};'use strict';var _=require(_0xe80e('0x0'));var moment=require(_0xe80e('0x1'));var AWS=require(_0xe80e('0x2'));var utils=require(_0xe80e('0x3'));var logger=require('../../../../config/logger')(_0xe80e('0x4'));var rpc={'chatMessage':require(_0xe80e('0x5')),'openchannelMessage':require(_0xe80e('0x6')),'mailMessage':require(_0xe80e('0x7')),'smsMessage':require(_0xe80e('0x8')),'faxMessage':require(_0xe80e('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe80e('0xa')]=function(_0x326357,_0x56c9d4){return function(_0x3f347b){try{if(!_['isNil'](this[_0xe80e('0xb')]['UserId'])){logger[_0xe80e('0xc')](_0xe80e('0xd'),_0x326357,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3f347b[_0xe80e('0xe')]();}var _0x4892f2={'ContactId':this[_0xe80e('0xf')]['id'],'sentAt':moment()[_0xe80e('0x10')](_0xe80e('0x11')),'direction':_0xe80e('0x12')};if(this[_0xe80e('0x13')]===_0xe80e('0x14')||this['channel']===_0xe80e('0x15')){_0x4892f2[_0xe80e('0x16')]=this['interaction'][_0xe80e('0x16')];}var _0x43e0ca=this[_0xe80e('0x13')];if(_0x43e0ca===_0xe80e('0x17')){_0x4892f2[_0xe80e('0x18')]=this[_0xe80e('0x19')]['id'];}else{_0x4892f2[_[_0xe80e('0x1a')](_0x43e0ca)+_0xe80e('0x1b')]=this[_0xe80e('0x19')]['id'];}_0x4892f2[_[_0xe80e('0x1a')](_0x43e0ca)+_0xe80e('0x1c')]=this['interaction']['id'];if(this[_0xe80e('0xb')][_0xe80e('0x1d')]){var _0x512cc4=_0x56c9d4[0x4];if(!_['isEmpty'](_0x512cc4)){_0x4892f2['body']=utils[_0xe80e('0x1e')](_0x512cc4,this);return rpc[_0x43e0ca+_0xe80e('0x1f')]['create'](_0x4892f2)[_0xe80e('0x20')](function(_0xc9f2e1){logger[_0xe80e('0xc')](_0xe80e('0xd'),_0x326357,_0x4892f2[_0xe80e('0x21')]);})[_0xe80e('0x22')](function(_0x2a287b){logger[_0xe80e('0x23')]('[%s][AMAZONLEX]\x20%s',_0x326357,JSON[_0xe80e('0x24')](_0x2a287b));})[_0xe80e('0x25')](function(){logger[_0xe80e('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x326357);_0x3f347b[_0xe80e('0x26')]();});}else{logger[_0xe80e('0xc')](_0xe80e('0x27'),_0x326357);_0x3f347b[_0xe80e('0x26')]();}}else{var _0x3789bb=this;var _0x102dcd=new AWS[(_0xe80e('0x28'))]({'accessKeyId':_0x56c9d4[0x0],'secretAccessKey':_0x56c9d4[0x1],'region':_0x56c9d4[0x2]});var _0x29e756={'botAlias':'$LATEST','botName':_0x56c9d4[0x3],'inputText':this['message'][_0xe80e('0x21')],'userId':this[_0xe80e('0x13')]+':'+this[_0xe80e('0xb')]['id'][_0xe80e('0x29')]()};_0x102dcd[_0xe80e('0x2a')](_0x29e756,function(_0x21f307,_0x3237f0){if(_0x21f307){logger[_0xe80e('0x23')]('[%s][AMAZONLEX]\x20%s',_0x326357,_0x21f307['message']);_0x3f347b['next']();}else if(_0x3237f0&&_0x3237f0[_0xe80e('0x2b')]){_0x3789bb[_0xe80e('0x21')][_0xe80e('0x2c')]=_0x3237f0;_0x4892f2[_0xe80e('0x21')]=_0x3237f0[_0xe80e('0x2b')];_0x4892f2[_0xe80e('0x2d')]=_0xe80e('0x2c');_0x4892f2['providerResponse']=JSON[_0xe80e('0x24')](_0x3237f0);return rpc[_0x43e0ca+_0xe80e('0x1f')][_0xe80e('0x2e')](_0x4892f2)[_0xe80e('0x20')](function(_0x22a9a1){logger[_0xe80e('0xc')](_0xe80e('0xd'),_0x326357,_0x4892f2[_0xe80e('0x21')]);if(_0x3237f0['dialogState']==_0xe80e('0x2f')){_0x3f347b[_0xe80e('0xe')]();}else{_0x3f347b[_0xe80e('0x26')]();}})['catch'](function(_0x53bc75){logger['error'](_0xe80e('0xd'),_0x326357,JSON[_0xe80e('0x24')](_0x53bc75));_0x3f347b[_0xe80e('0xe')]();});}else{_0x3f347b[_0xe80e('0xe')]();}});}}catch(_0x4a6466){logger[_0xe80e('0x23')]('[%s][AMAZONLEX]\x20%s',_0x326357,JSON['stringify'](_0x4a6466));_0x3f347b[_0xe80e('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 47f9581..3005a07 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 _0x490c=['mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','info','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','messageId','html','','replace','';_0x50bb08[_0xc490('0x32')]={'Auto-Submitted':_0xc490('0x33'),'X-Auto-Response-Suppress':_0xc490('0x34'),'Precedence':'auto_reply'};return mailRpc[_0xc490('0x35')](this[_0xc490('0x29')][_0xc490('0x36')],_0x50bb08)[_0xc490('0x37')](function(_0x526023){logger[_0xc490('0x1b')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x140d3e);_0x50bb08[_0xc490('0x2c')]=_0x526023[_0xc490('0x20')]['messageId'];return rpc[_0x283bc2+_0xc490('0x38')]['create'](_0x50bb08);})['then'](function(_0x5b96a3){logger['info'](_0xc490('0x13'),_0x140d3e,JSON[_0xc490('0x39')](_0x5b96a3));})['catch'](function(_0x345428){logger['error'](_0xc490('0x3a'),_0x140d3e,JSON[_0xc490('0x39')](_0x345428));})[_0xc490('0x3b')](function(){Promise[_0xc490('0x3c')]()['then'](function(){if(_0x3574df[0x0]!=='2'||_0x9a201[_0xc490('0x1a')])return;return rpc[_0x283bc2+_0xc490('0x3d')][_0xc490('0x3e')](_0x9a201['id'],{'autoreplyExecuted':!![]})[_0xc490('0x37')](function(_0x17a60b){logger[_0xc490('0x1b')](_0xc490('0x3f'),_0x140d3e,JSON[_0xc490('0x39')](_0x17a60b));})['catch'](function(_0x441d55){logger[_0xc490('0x40')](_0xc490('0x41'),_0x140d3e,JSON[_0xc490('0x39')](_0x441d55));});})[_0xc490('0x37')](function(){_0x4b95f2[_0xc490('0x15')]();});});}else{return rpc[this[_0xc490('0xf')]+_0xc490('0x38')]['create'](_0x50bb08)[_0xc490('0x37')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x140d3e,_0x50bb08['body']);})[_0xc490('0x42')](function(_0x422910){logger[_0xc490('0x40')](_0xc490('0x13'),_0x140d3e,JSON['stringify'](_0x422910));})[_0xc490('0x3b')](function(){Promise[_0xc490('0x3c')]()[_0xc490('0x37')](function(){if(_0x3574df[0x0]!=='2'||_0x9a201[_0xc490('0x1a')])return;return rpc[_0x283bc2+'Interaction']['update'](_0x9a201['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2fe05e){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x140d3e,JSON[_0xc490('0x39')](_0x2fe05e));})['catch'](function(_0x1bf855){logger[_0xc490('0x40')](_0xc490('0x41'),_0x140d3e,JSON[_0xc490('0x39')](_0x1bf855));});})[_0xc490('0x37')](function(){_0x4b95f2[_0xc490('0x15')]();});});}}}catch(_0x439ef1){logger[_0xc490('0x40')]('[%s][AUTOREPLY]\x20%s',_0x140d3e,JSON[_0xc490('0x39')](_0x439ef1));_0x4b95f2['stop']();}};}; \ No newline at end of file +var _0x0228=['Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','mail','getMustacheRender','from','message','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','inReplyTo','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','account','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','[%s][AUTOREPLY]\x20%s','stringify','catch','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body'];(function(_0x5d3a5b,_0x33c07e){var _0x4238c0=function(_0x540e83){while(--_0x540e83){_0x5d3a5b['push'](_0x5d3a5b['shift']());}};_0x4238c0(++_0x33c07e);}(_0x0228,0x1c5));var _0x8022=function(_0x312931,_0x22e92b){_0x312931=_0x312931-0x0;var _0xdf26e5=_0x0228[_0x312931];return _0xdf26e5;};'use strict';var _=require(_0x8022('0x0'));var moment=require('moment');var utils=require(_0x8022('0x1'));var logger=require(_0x8022('0x2'))('routing');var rpc={'chatMessage':require(_0x8022('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8022('0x4')),'smsMessage':require(_0x8022('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x8022('0x6')),'openchannelInteraction':require(_0x8022('0x7')),'mailInteraction':require(_0x8022('0x8')),'smsInteraction':require(_0x8022('0x9')),'faxInteraction':require(_0x8022('0xa')),'whatsappInteraction':require(_0x8022('0xb'))};var mailRpc=require(_0x8022('0xc'));exports[_0x8022('0xd')]=function(_0x152ebf,_0x599c91,_0x35a466,_0x590de4){return function(_0x5b6c1b){try{var _0x5a810b=this[_0x8022('0xe')];if(_0x5a810b==='mail'&&_0x590de4[_0x8022('0xf')]['isAutoreply']){logger['info']('[%s][AUTOREPLY]\x20%s',_0x152ebf,_0x8022('0x10'));return _0x5b6c1b[_0x8022('0x11')]();}if(_0x599c91[0x0]==='1'&&(_[_0x8022('0x12')](this['interaction'][_0x8022('0x13')])||!this['interaction']['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x152ebf,'Autoreply\x20already\x20sent');return _0x5b6c1b[_0x8022('0x11')]();}if(_0x599c91[0x0]==='2'&&this[_0x8022('0x14')][_0x8022('0x15')]){logger[_0x8022('0x16')](_0x8022('0x17'),_0x152ebf,'One\x20Time\x20already\x20sent');return _0x5b6c1b[_0x8022('0x11')]();}var _0xdda30f={'ContactId':this[_0x8022('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x8022('0xe')]===_0x8022('0x19')){_0xdda30f[_0x8022('0xf')]=utils[_0x8022('0x1a')](_0x599c91[0x2],this);}else{_0xdda30f[_0x8022('0xf')]=utils['getMustacheRender'](_0x599c91[0x1],this);}if(this['message']){_0xdda30f['to']=this['message'][_0x8022('0x1b')]||'';if(this[_0x8022('0xe')]===_0x8022('0x19')&&_0x599c91[0x1]==='1'){_0xdda30f['cc']=this[_0x8022('0x1c')]['cc']||'';}_0xdda30f[_0x8022('0x1b')]=this[_0x8022('0x1c')]['to']||'';_0xdda30f[_0x8022('0x1d')]=this['message'][_0x8022('0x1d')]||'';_0xdda30f[_0x8022('0x1e')]=!![];if(this['message'][_0x8022('0x1f')]){_0xdda30f[_0x8022('0x1f')]='';_0xdda30f[_0x8022('0x1f')]+=_[_0x8022('0x20')](this[_0x8022('0x1c')][_0x8022('0x1f')],_0x8022('0x21'))?'':_0x8022('0x22');_0xdda30f[_0x8022('0x1f')]+=this['message'][_0x8022('0x1f')];}}if(this[_0x8022('0xe')]===_0x8022('0x23')){_0xdda30f[_0x8022('0x24')]=this['account']['id'];}else{_0xdda30f[_[_0x8022('0x25')](this[_0x8022('0xe')])+_0x8022('0x26')]=this['account']['id'];}_0xdda30f[_[_0x8022('0x25')](this[_0x8022('0xe')])+_0x8022('0x27')]=this[_0x8022('0x14')]['id'];var _0x5814c5=this[_0x8022('0x14')];if(rpc[this['channel']+'Message']){if(this['channel']===_0x8022('0x19')){_0xdda30f[_0x8022('0x28')]=this[_0x8022('0x1c')]['messageId'];_0xdda30f[_0x8022('0x29')]=''+_[_0x8022('0x2a')](_0xdda30f[_0x8022('0xf')],_0x8022('0x2b'),_0x8022('0x2c'))+_0x8022('0x2d');_0xdda30f[_0x8022('0x2e')]={'Auto-Submitted':_0x8022('0x2f'),'X-Auto-Response-Suppress':_0x8022('0x30'),'Precedence':_0x8022('0x31')};return mailRpc[_0x8022('0x32')](this[_0x8022('0x33')]['smtpOptions'],_0xdda30f)[_0x8022('0x34')](function(_0x313420){logger[_0x8022('0x16')](_0x8022('0x35'),_0x152ebf);_0xdda30f['messageId']=_0x313420[_0x8022('0x1c')][_0x8022('0x36')];return rpc[_0x5a810b+_0x8022('0x37')][_0x8022('0x38')](_0xdda30f);})[_0x8022('0x34')](function(_0x4bce0f){logger[_0x8022('0x16')](_0x8022('0x39'),_0x152ebf,JSON[_0x8022('0x3a')](_0x4bce0f));})[_0x8022('0x3b')](function(_0x4e0ae9){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x152ebf,JSON[_0x8022('0x3a')](_0x4e0ae9));})[_0x8022('0x3c')](function(){Promise[_0x8022('0x3d')]()[_0x8022('0x34')](function(){if(_0x599c91[0x0]!=='2'||_0x5814c5[_0x8022('0x15')])return;return rpc[_0x5a810b+_0x8022('0x3e')][_0x8022('0x3f')](_0x5814c5['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4810df){logger[_0x8022('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x152ebf,JSON[_0x8022('0x3a')](_0x4810df));})[_0x8022('0x3b')](function(_0x2f3306){logger[_0x8022('0x40')](_0x8022('0x41'),_0x152ebf,JSON[_0x8022('0x3a')](_0x2f3306));});})['then'](function(){_0x5b6c1b[_0x8022('0x11')]();});});}else{return rpc[this[_0x8022('0xe')]+_0x8022('0x37')][_0x8022('0x38')](_0xdda30f)[_0x8022('0x34')](function(){logger[_0x8022('0x16')](_0x8022('0x39'),_0x152ebf,_0xdda30f[_0x8022('0xf')]);})[_0x8022('0x3b')](function(_0x112f51){logger['error'](_0x8022('0x39'),_0x152ebf,JSON[_0x8022('0x3a')](_0x112f51));})[_0x8022('0x3c')](function(){Promise['resolve']()[_0x8022('0x34')](function(){if(_0x599c91[0x0]!=='2'||_0x5814c5[_0x8022('0x15')])return;return rpc[_0x5a810b+'Interaction'][_0x8022('0x3f')](_0x5814c5['id'],{'autoreplyExecuted':!![]})[_0x8022('0x34')](function(_0x462405){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x152ebf,JSON[_0x8022('0x3a')](_0x462405));})[_0x8022('0x3b')](function(_0x86445f){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x152ebf,JSON[_0x8022('0x3a')](_0x86445f));});})[_0x8022('0x34')](function(){_0x5b6c1b[_0x8022('0x11')]();});});}}}catch(_0x478a5f){logger['error'](_0x8022('0x39'),_0x152ebf,JSON[_0x8022('0x3a')](_0x478a5f));_0x5b6c1b[_0x8022('0x42')]();}};}; \ 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 9bc46ac..5ca42b1 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 _0x1532=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','finally','stringify','moment','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x1ddce6,_0x904c3d){var _0x51c67c=function(_0x2e3ecc){while(--_0x2e3ecc){_0x1ddce6['push'](_0x1ddce6['shift']());}};_0x51c67c(++_0x904c3d);}(_0x1532,0x10c));var _0x2153=function(_0x5436a5,_0x2fba63){_0x5436a5=_0x5436a5-0x0;var _0x357b95=_0x1532[_0x5436a5];return _0x357b95;};'use strict';var moment=require(_0x2153('0x0'));var logger=require(_0x2153('0x1'))(_0x2153('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x2153('0x3')),'mailInteraction':require(_0x2153('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x2153('0x5'))};exports[_0x2153('0x6')]=function(_0x5008ff,_0x5b0adb,_0x17cd07,_0x26e0f9){return function(_0x522738){try{logger[_0x2153('0x7')](_0x2153('0x8'),_0x5008ff,_0x5b0adb[0x0]);var _0x4553d1={'closed':0x1,'closedAt':moment()[_0x2153('0x9')](_0x2153('0xa')),'closeReason':'system','disposition':_0x5b0adb[0x0]};if(rpc[_0x26e0f9[_0x2153('0xb')]+'Interaction']){rpc[_0x26e0f9[_0x2153('0xb')]+_0x2153('0xc')][_0x2153('0xd')](_0x26e0f9[_0x2153('0xe')]['id'],_0x4553d1)[_0x2153('0xf')](function(_0x1c9451){logger[_0x2153('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5008ff,_0x26e0f9[_0x2153('0xe')]['id']);})[_0x2153('0x10')](function(_0x200a39){logger[_0x2153('0x11')](_0x2153('0x12'),_0x5008ff,JSON['stringify'](_0x200a39));})[_0x2153('0x13')](function(){_0x522738['stop']();});}}catch(_0x1ce58d){logger[_0x2153('0x11')]('[%s][CLOSE]\x20%s',_0x5008ff,JSON[_0x2153('0x14')](_0x1ce58d));_0x522738['stop']();}};}; \ No newline at end of file +var _0x6c20=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','catch','[%s][CLOSE]\x20%s','stringify','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x5dc810,_0x476912){var _0x2ac9d2=function(_0x59b593){while(--_0x59b593){_0x5dc810['push'](_0x5dc810['shift']());}};_0x2ac9d2(++_0x476912);}(_0x6c20,0x170));var _0x06c2=function(_0x1e54a7,_0x4e7ea3){_0x1e54a7=_0x1e54a7-0x0;var _0x41d78e=_0x6c20[_0x1e54a7];return _0x41d78e;};'use strict';var moment=require(_0x06c2('0x0'));var logger=require(_0x06c2('0x1'))(_0x06c2('0x2'));var rpc={'chatInteraction':require(_0x06c2('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x06c2('0x4')),'mailInteraction':require(_0x06c2('0x5')),'faxInteraction':require(_0x06c2('0x6')),'whatsappInteraction':require(_0x06c2('0x7'))};exports[_0x06c2('0x8')]=function(_0x4a1c85,_0x372e9e,_0x49fbfa,_0x41bf5c){return function(_0x22c27){try{logger[_0x06c2('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x4a1c85,_0x372e9e[0x0]);var _0x5164ef={'closed':0x1,'closedAt':moment()[_0x06c2('0xa')](_0x06c2('0xb')),'closeReason':'system','disposition':_0x372e9e[0x0]};if(rpc[_0x41bf5c[_0x06c2('0xc')]+'Interaction']){rpc[_0x41bf5c['channel']+_0x06c2('0xd')][_0x06c2('0xe')](_0x41bf5c[_0x06c2('0xf')]['id'],_0x5164ef)[_0x06c2('0x10')](function(_0x25a12e){logger[_0x06c2('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4a1c85,_0x41bf5c[_0x06c2('0xf')]['id']);})[_0x06c2('0x11')](function(_0x267a20){logger['error'](_0x06c2('0x12'),_0x4a1c85,JSON[_0x06c2('0x13')](_0x267a20));})['finally'](function(){_0x22c27[_0x06c2('0x14')]();});}}catch(_0x117ede){logger[_0x06c2('0x15')]('[%s][CLOSE]\x20%s',_0x4a1c85,JSON[_0x06c2('0x13')](_0x117ede));_0x22c27[_0x06c2('0x14')]();}};}; \ 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 fe929f8..45827a8 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 _0x044a=['body','result','fulfillment','providerName','dialogflow','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','info','textRequest','message'];(function(_0x47e455,_0x867aae){var _0x5214ae=function(_0x4b1d7b){while(--_0x4b1d7b){_0x47e455['push'](_0x47e455['shift']());}};_0x5214ae(++_0x867aae);}(_0x044a,0x173));var _0xa044=function(_0x4a0bf0,_0x2de070){_0x4a0bf0=_0x4a0bf0-0x0;var _0xd52f61=_0x044a[_0x4a0bf0];return _0xd52f61;};'use strict';var _=require(_0xa044('0x0'));var moment=require(_0xa044('0x1'));var apiai=require(_0xa044('0x2'));var md5=require(_0xa044('0x3'));var utils=require(_0xa044('0x4'));var logger=require(_0xa044('0x5'))(_0xa044('0x6'));var rpc={'chatMessage':require(_0xa044('0x7')),'openchannelMessage':require(_0xa044('0x8')),'mailMessage':require(_0xa044('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa044('0xa')),'whatsappMessage':require(_0xa044('0xb'))};exports[_0xa044('0xc')]=function(_0x1c04bb,_0x59b81b){return function(_0xe12f7d){try{if(!_[_0xa044('0xd')](this[_0xa044('0xe')][_0xa044('0xf')])){logger['info'](_0xa044('0x10'),_0x1c04bb,_0xa044('0x11'));return _0xe12f7d[_0xa044('0x12')]();}var _0x47a9dc={'ContactId':this[_0xa044('0x13')]['id'],'sentAt':moment()[_0xa044('0x14')](_0xa044('0x15')),'direction':_0xa044('0x16')};if(this['channel']===_0xa044('0x17')||this['channel']==='whatsapp'){_0x47a9dc[_0xa044('0x18')]=this[_0xa044('0xe')][_0xa044('0x18')];}var _0x344c7d=this[_0xa044('0x19')];if(_0x344c7d===_0xa044('0x1a')){_0x47a9dc[_0xa044('0x1b')]=this['account']['id'];}else{_0x47a9dc[_[_0xa044('0x1c')](_0x344c7d)+'AccountId']=this[_0xa044('0x1d')]['id'];}_0x47a9dc[_[_0xa044('0x1c')](_0x344c7d)+_0xa044('0x1e')]=this[_0xa044('0xe')]['id'];if(this[_0xa044('0xe')]['created']){var _0x516c34=_0x59b81b[0x2];if(!_[_0xa044('0x1f')](_0x516c34)){_0x47a9dc['body']=utils[_0xa044('0x20')](_0x516c34,this);return rpc[_0x344c7d+_0xa044('0x21')][_0xa044('0x22')](_0x47a9dc)[_0xa044('0x23')](function(_0x3ccbd3){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,_0x47a9dc['body']);})[_0xa044('0x24')](function(_0x417cbb){logger[_0xa044('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,JSON[_0xa044('0x26')](_0x417cbb));})[_0xa044('0x27')](function(){logger['info'](_0xa044('0x28'),_0x1c04bb);_0xe12f7d[_0xa044('0x29')]();});}else{logger[_0xa044('0x2a')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1c04bb);_0xe12f7d[_0xa044('0x29')]();}}else{var _0x966548=this;var _0x26747b=apiai(_0x59b81b[0x0],{'language':_0x59b81b[0x1]||'en'});return _0x26747b[_0xa044('0x2b')](this[_0xa044('0x2c')][_0xa044('0x2d')],{'sessionId':md5(this[_0xa044('0xe')]['id'])})[_0xa044('0x23')](function(_0x36c237){_0x966548['body']['dialogflow']=_0x36c237;_0x47a9dc[_0xa044('0x2d')]=_0x36c237[_0xa044('0x2e')][_0xa044('0x2f')]['speech'];_0x47a9dc[_0xa044('0x30')]=_0xa044('0x31');_0x47a9dc['providerResponse']=JSON[_0xa044('0x26')](_0x36c237);return rpc[_0x344c7d+_0xa044('0x21')]['create'](_0x47a9dc)[_0xa044('0x23')](function(_0x2889c2){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,_0x47a9dc['body']);if(_0x36c237[_0xa044('0x2e')][_0xa044('0x32')][_0xa044('0x33')]){_0xe12f7d['next']();}else{_0xe12f7d[_0xa044('0x29')]();}})[_0xa044('0x24')](function(_0x485212){logger[_0xa044('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,JSON['stringify'](_0x485212));_0xe12f7d[_0xa044('0x12')]();});})['catch'](function(_0x30fd39){logger[_0xa044('0x25')](_0xa044('0x10'),_0x1c04bb,_0x30fd39[_0xa044('0x2c')]);_0xe12f7d[_0xa044('0x12')]();});}}catch(_0xf2d227){logger['error'](_0xa044('0x10'),_0x1c04bb,JSON[_0xa044('0x26')](_0xf2d227));_0xe12f7d[_0xa044('0x29')]();}};}; \ No newline at end of file +var _0xc963=['catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','create','metadata','endConversation','next','lodash','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x3d7c3a,_0x2403b2){var _0x5baa61=function(_0x2293ba){while(--_0x2293ba){_0x3d7c3a['push'](_0x3d7c3a['shift']());}};_0x5baa61(++_0x2403b2);}(_0xc963,0x17f));var _0x3c96=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0xc963[_0x1c6ef2];return _0x404b8c;};'use strict';var _=require(_0x3c96('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x3c96('0x1'));var utils=require(_0x3c96('0x2'));var logger=require(_0x3c96('0x3'))(_0x3c96('0x4'));var rpc={'chatMessage':require(_0x3c96('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3c96('0x6')),'smsMessage':require(_0x3c96('0x7')),'faxMessage':require(_0x3c96('0x8')),'whatsappMessage':require(_0x3c96('0x9'))};exports[_0x3c96('0xa')]=function(_0x493953,_0x1f3bb4){return function(_0x247c14){try{if(!_[_0x3c96('0xb')](this[_0x3c96('0xc')][_0x3c96('0xd')])){logger[_0x3c96('0xe')](_0x3c96('0xf'),_0x493953,_0x3c96('0x10'));return _0x247c14['next']();}var _0x389618={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3c96('0x11')](_0x3c96('0x12')),'direction':'out'};if(this[_0x3c96('0x13')]==='sms'||this['channel']===_0x3c96('0x14')){_0x389618[_0x3c96('0x15')]=this[_0x3c96('0xc')][_0x3c96('0x15')];}var _0x2d0665=this[_0x3c96('0x13')];if(_0x2d0665===_0x3c96('0x16')){_0x389618[_0x3c96('0x17')]=this[_0x3c96('0x18')]['id'];}else{_0x389618[_[_0x3c96('0x19')](_0x2d0665)+_0x3c96('0x1a')]=this[_0x3c96('0x18')]['id'];}_0x389618[_[_0x3c96('0x19')](_0x2d0665)+_0x3c96('0x1b')]=this['interaction']['id'];if(this[_0x3c96('0xc')][_0x3c96('0x1c')]){var _0x5bfb66=_0x1f3bb4[0x2];if(!_[_0x3c96('0x1d')](_0x5bfb66)){_0x389618[_0x3c96('0x1e')]=utils[_0x3c96('0x1f')](_0x5bfb66,this);return rpc[_0x2d0665+_0x3c96('0x20')]['create'](_0x389618)['then'](function(_0x147878){logger[_0x3c96('0xe')](_0x3c96('0xf'),_0x493953,_0x389618[_0x3c96('0x1e')]);})[_0x3c96('0x21')](function(_0xe7c797){logger[_0x3c96('0x22')](_0x3c96('0xf'),_0x493953,JSON['stringify'](_0xe7c797));})[_0x3c96('0x23')](function(){logger[_0x3c96('0xe')](_0x3c96('0x24'),_0x493953);_0x247c14[_0x3c96('0x25')]();});}else{logger[_0x3c96('0xe')](_0x3c96('0x26'),_0x493953);_0x247c14['stop']();}}else{var _0x2f2952=this;var _0x2bc43d=apiai(_0x1f3bb4[0x0],{'language':_0x1f3bb4[0x1]||'en'});return _0x2bc43d['textRequest'](this[_0x3c96('0x27')][_0x3c96('0x1e')],{'sessionId':md5(this[_0x3c96('0xc')]['id'])})[_0x3c96('0x28')](function(_0x24c88d){_0x2f2952['body'][_0x3c96('0x29')]=_0x24c88d;_0x389618[_0x3c96('0x1e')]=_0x24c88d[_0x3c96('0x2a')][_0x3c96('0x2b')][_0x3c96('0x2c')];_0x389618[_0x3c96('0x2d')]=_0x3c96('0x29');_0x389618[_0x3c96('0x2e')]=JSON[_0x3c96('0x2f')](_0x24c88d);return rpc[_0x2d0665+'Message'][_0x3c96('0x30')](_0x389618)['then'](function(_0x30180b){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x493953,_0x389618[_0x3c96('0x1e')]);if(_0x24c88d[_0x3c96('0x2a')][_0x3c96('0x31')][_0x3c96('0x32')]){_0x247c14[_0x3c96('0x33')]();}else{_0x247c14[_0x3c96('0x25')]();}})[_0x3c96('0x21')](function(_0x18d872){logger[_0x3c96('0x22')](_0x3c96('0xf'),_0x493953,JSON[_0x3c96('0x2f')](_0x18d872));_0x247c14[_0x3c96('0x33')]();});})[_0x3c96('0x21')](function(_0x369170){logger['error'](_0x3c96('0xf'),_0x493953,_0x369170[_0x3c96('0x27')]);_0x247c14[_0x3c96('0x33')]();});}}catch(_0x4ce143){logger[_0x3c96('0x22')](_0x3c96('0xf'),_0x493953,JSON['stringify'](_0x4ce143));_0x247c14[_0x3c96('0x25')]();}};}; \ 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 fc61959..28fa243 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 _0x0ba3=['bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','account','AccountId','upperFirst','created','isEmpty','body','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','length','fulfillmentText','next','stack','lodash','dialogflow','moment'];(function(_0x4227f7,_0x5e2633){var _0x4d394e=function(_0x1d7676){while(--_0x1d7676){_0x4227f7['push'](_0x4227f7['shift']());}};_0x4d394e(++_0x5e2633);}(_0x0ba3,0x105));var _0x30ba=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x0ba3[_0x3fe393];return _0x534d14;};'use strict';var _=require(_0x30ba('0x0'));var dialogflow=require(_0x30ba('0x1'));var md5=require('md5');var moment=require(_0x30ba('0x2'));var Promise=require(_0x30ba('0x3'));var logger=require(_0x30ba('0x4'))(_0x30ba('0x5'));var utils=require(_0x30ba('0x6'));var rpc={'chatMessage':require(_0x30ba('0x7')),'openchannelMessage':require(_0x30ba('0x8')),'mailMessage':require(_0x30ba('0x9')),'smsMessage':require(_0x30ba('0xa')),'faxMessage':require(_0x30ba('0xb')),'whatsappMessage':require(_0x30ba('0xc'))};function createMessage(_0x561975,_0x4cde18,_0xad3ad9,_0x5573f3){return new Promise(function(_0x17108f,_0x9f6c89){var _0x1ac407=_[_0x30ba('0xd')](_0xad3ad9);_0x1ac407['body']=_0x5573f3;return rpc[_0x4cde18+_0x30ba('0xe')][_0x30ba('0xf')](_0x1ac407)[_0x30ba('0x10')](function(){logger[_0x30ba('0x11')](_0x30ba('0x12'),_0x561975,_0x1ac407['body']);_0x17108f();})[_0x30ba('0x13')](function(_0x1b9f54){logger[_0x30ba('0x14')](_0x30ba('0x12'),_0x561975,JSON['stringify'](_0x1b9f54));_0x9f6c89(_0x1b9f54);});});}exports['consequence']=function(_0xa21927,_0x57c64d){return function(_0x13fb75){try{if(!_['isNil'](this[_0x30ba('0x15')][_0x30ba('0x16')])){logger[_0x30ba('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0xa21927,_0x30ba('0x17'));return _0x13fb75['next']();}var _0x19b312={'ContactId':this[_0x30ba('0x18')]['id'],'sentAt':moment()[_0x30ba('0x19')](_0x30ba('0x1a')),'direction':'out'};if(this[_0x30ba('0x1b')]==='sms'||this[_0x30ba('0x1b')]==='whatsapp'){_0x19b312[_0x30ba('0x1c')]=this[_0x30ba('0x15')][_0x30ba('0x1c')];}var _0x21b18e=this[_0x30ba('0x1b')];if(_0x21b18e==='chat'){_0x19b312['ChatWebsiteId']=this[_0x30ba('0x1d')]['id'];}else{_0x19b312[_['upperFirst'](_0x21b18e)+_0x30ba('0x1e')]=this[_0x30ba('0x1d')]['id'];}_0x19b312[_[_0x30ba('0x1f')](_0x21b18e)+'InteractionId']=this[_0x30ba('0x15')]['id'];if(this[_0x30ba('0x15')][_0x30ba('0x20')]){var _0x21a8b5=_0x57c64d[0x4];if(!_[_0x30ba('0x21')](_0x21a8b5)){_0x19b312[_0x30ba('0x22')]=utils[_0x30ba('0x23')](_0x21a8b5,this);return rpc[_0x21b18e+_0x30ba('0xe')]['create'](_0x19b312)[_0x30ba('0x10')](function(_0x131a3d){logger[_0x30ba('0x11')](_0x30ba('0x12'),_0xa21927,_0x19b312['body']);})['catch'](function(_0x529eb8){logger[_0x30ba('0x14')](_0x30ba('0x12'),_0xa21927,JSON[_0x30ba('0x24')](_0x529eb8));})[_0x30ba('0x25')](function(){logger[_0x30ba('0x11')](_0x30ba('0x26'),_0xa21927);_0x13fb75[_0x30ba('0x27')]();});}else{logger[_0x30ba('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xa21927);_0x13fb75[_0x30ba('0x27')]();}}else{var _0x394993=this;var _0x216d8f=_0x57c64d[0x2][_0x30ba('0x28')](/\\n/g,'\x0a');var _0x156846={'credentials':{'private_key':_0x216d8f,'client_email':_0x57c64d[0x1]}};var _0xbafc34=new dialogflow[(_0x30ba('0x29'))](_0x156846);var _0x515f6c=_0xbafc34['sessionPath'](_0x57c64d[0x0],md5(_0x394993[_0x30ba('0x15')]['id']));var _0xedde65={'session':_0x515f6c,'queryInput':{'text':{'text':_0x394993['message']['body'],'languageCode':_0x57c64d[0x3]||'en'}}};return _0xbafc34[_0x30ba('0x2a')](_0xedde65)[_0x30ba('0x10')](function(_0x23fda0){if(_0x23fda0&&_0x23fda0['length']){_0x394993['body'][_0x30ba('0x2b')]=_0x23fda0;var _0x3a232c=_0x23fda0[0x0];var _0x3dc116=_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x2d')]&&_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x2d')][_0x30ba('0x2e')]?_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x2d')][_0x30ba('0x2e')][_0x30ba('0x2f')][_0x30ba('0x30')]:![];_0x394993['body']['DIALOGFLOWV2_ACTION']=_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x31')];_0x394993[_0x30ba('0x22')][_0x30ba('0x32')]=_0x3a232c['queryResult']['allRequiredParamsPresent'];_0x394993[_0x30ba('0x22')][_0x30ba('0x33')]=_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x2d')]&&_0x3a232c[_0x30ba('0x2c')]['diagnosticInfo'][_0x30ba('0x2e')]?_0x3a232c[_0x30ba('0x2c')]['diagnosticInfo'][_0x30ba('0x2e')][_0x30ba('0x2f')][_0x30ba('0x30')]:![];_0x394993[_0x30ba('0x22')]['DIALOGFLOWV2_INTENTNAME']=_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x34')]['name'];_0x394993[_0x30ba('0x22')][_0x30ba('0x35')]=_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x34')]['displayName'];_0x394993[_0x30ba('0x22')][_0x30ba('0x36')]=_0x3a232c['queryResult'][_0x30ba('0x34')][_0x30ba('0x37')];_0x394993[_0x30ba('0x22')][_0x30ba('0x38')]=_0x3a232c['queryResult'][_0x30ba('0x39')];_0x394993[_0x30ba('0x22')][_0x30ba('0x3a')]=_0x3a232c[_0x30ba('0x2c')][_0x30ba('0x3b')];_0x394993[_0x30ba('0x22')][_0x30ba('0x3c')]=_0x3a232c[_0x30ba('0x2c')]['intentDetectionConfidence'];_0x19b312[_0x30ba('0x3d')]=_0x30ba('0x2b');_0x19b312['providerResponse']=JSON[_0x30ba('0x24')](_0x23fda0);var _0x268d6f=[];for(var _0x3676da=0x0;_0x3676da<_0x23fda0[_0x30ba('0x3e')];_0x3676da++){var _0x526e0e=_0x23fda0[_0x3676da];if(_0x526e0e&&_0x526e0e[_0x30ba('0x2c')]&&_0x526e0e[_0x30ba('0x2c')][_0x30ba('0x3f')]){_0x268d6f['push'](createMessage(_0xa21927,_0x21b18e,_0x19b312,_0x526e0e[_0x30ba('0x2c')][_0x30ba('0x3f')]));}}return Promise['all'](_0x268d6f)[_0x30ba('0x10')](function(){if(_0x3dc116){_0x13fb75[_0x30ba('0x40')]();}else{_0x13fb75[_0x30ba('0x27')]();}})['catch'](function(_0xb7e5c6){logger[_0x30ba('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0xa21927,JSON[_0x30ba('0x24')](_0xb7e5c6));_0x13fb75[_0x30ba('0x40')]();});}})[_0x30ba('0x13')](function(_0x39ceb1){logger[_0x30ba('0x14')](_0x30ba('0x12'),_0xa21927,_0x39ceb1['message'],_0x39ceb1[_0x30ba('0x41')]);_0x13fb75[_0x30ba('0x40')]();});}}catch(_0x19b46d){logger['error'](_0x30ba('0x12'),_0xa21927,JSON[_0x30ba('0x24')](_0x19b46d));_0x13fb75['stop']();}};}; \ No newline at end of file +var _0x354a=['message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','create','then','info','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','sessionPath'];(function(_0x3a81c2,_0x7d08dd){var _0x2d7eea=function(_0x10b42f){while(--_0x10b42f){_0x3a81c2['push'](_0x3a81c2['shift']());}};_0x2d7eea(++_0x7d08dd);}(_0x354a,0x9e));var _0xa354=function(_0x1e9992,_0x24a7db){_0x1e9992=_0x1e9992-0x0;var _0x4204e2=_0x354a[_0x1e9992];return _0x4204e2;};'use strict';var _=require('lodash');var dialogflow=require(_0xa354('0x0'));var md5=require(_0xa354('0x1'));var moment=require(_0xa354('0x2'));var Promise=require(_0xa354('0x3'));var logger=require(_0xa354('0x4'))(_0xa354('0x5'));var utils=require(_0xa354('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa354('0x7')),'smsMessage':require(_0xa354('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa354('0x9'))};function createMessage(_0x296c01,_0x129725,_0x2b62e3,_0x10c429){return new Promise(function(_0x444533,_0x4f3ea6){var _0x32c77e=_[_0xa354('0xa')](_0x2b62e3);_0x32c77e['body']=_0x10c429;return rpc[_0x129725+'Message'][_0xa354('0xb')](_0x32c77e)[_0xa354('0xc')](function(){logger[_0xa354('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x296c01,_0x32c77e['body']);_0x444533();})[_0xa354('0xe')](function(_0x5a36bf){logger['error'](_0xa354('0xf'),_0x296c01,JSON[_0xa354('0x10')](_0x5a36bf));_0x4f3ea6(_0x5a36bf);});});}exports['consequence']=function(_0x1953ff,_0x2a8f1b){return function(_0x50cbbe){try{if(!_[_0xa354('0x11')](this[_0xa354('0x12')][_0xa354('0x13')])){logger[_0xa354('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x1953ff,_0xa354('0x14'));return _0x50cbbe[_0xa354('0x15')]();}var _0x27e5b0={'ContactId':this[_0xa354('0x16')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa354('0x17')};if(this[_0xa354('0x18')]==='sms'||this[_0xa354('0x18')]===_0xa354('0x19')){_0x27e5b0['phone']=this['interaction']['phone'];}var _0x22d76=this[_0xa354('0x18')];if(_0x22d76==='chat'){_0x27e5b0[_0xa354('0x1a')]=this['account']['id'];}else{_0x27e5b0[_[_0xa354('0x1b')](_0x22d76)+'AccountId']=this[_0xa354('0x1c')]['id'];}_0x27e5b0[_['upperFirst'](_0x22d76)+_0xa354('0x1d')]=this[_0xa354('0x12')]['id'];if(this[_0xa354('0x12')][_0xa354('0x1e')]){var _0x143cf0=_0x2a8f1b[0x4];if(!_[_0xa354('0x1f')](_0x143cf0)){_0x27e5b0[_0xa354('0x20')]=utils[_0xa354('0x21')](_0x143cf0,this);return rpc[_0x22d76+_0xa354('0x22')][_0xa354('0xb')](_0x27e5b0)[_0xa354('0xc')](function(_0x1c8865){logger[_0xa354('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x1953ff,_0x27e5b0['body']);})[_0xa354('0xe')](function(_0x36be48){logger[_0xa354('0x23')](_0xa354('0xf'),_0x1953ff,JSON[_0xa354('0x10')](_0x36be48));})[_0xa354('0x24')](function(){logger['info'](_0xa354('0x25'),_0x1953ff);_0x50cbbe[_0xa354('0x26')]();});}else{logger[_0xa354('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1953ff);_0x50cbbe[_0xa354('0x26')]();}}else{var _0x5ccc55=this;var _0x32518e=_0x2a8f1b[0x2]['replace'](/\\n/g,'\x0a');var _0x3d30de={'credentials':{'private_key':_0x32518e,'client_email':_0x2a8f1b[0x1]}};var _0x30adef=new dialogflow['SessionsClient'](_0x3d30de);var _0x3e6e3a=_0x30adef[_0xa354('0x27')](_0x2a8f1b[0x0],md5(_0x5ccc55[_0xa354('0x12')]['id']));var _0x1938ff={'session':_0x3e6e3a,'queryInput':{'text':{'text':_0x5ccc55[_0xa354('0x28')][_0xa354('0x20')],'languageCode':_0x2a8f1b[0x3]||'en'}}};return _0x30adef['detectIntent'](_0x1938ff)['then'](function(_0x5ead85){if(_0x5ead85&&_0x5ead85[_0xa354('0x29')]){_0x5ccc55[_0xa354('0x20')][_0xa354('0x2a')]=_0x5ead85;var _0x15d1ed=_0x5ead85[0x0];var _0x7253e1=_0x15d1ed[_0xa354('0x2b')]['diagnosticInfo']&&_0x15d1ed[_0xa354('0x2b')][_0xa354('0x2c')][_0xa354('0x2d')]?_0x15d1ed[_0xa354('0x2b')][_0xa354('0x2c')][_0xa354('0x2d')][_0xa354('0x2e')]['boolValue']:![];_0x5ccc55['body'][_0xa354('0x2f')]=_0x15d1ed[_0xa354('0x2b')][_0xa354('0x30')];_0x5ccc55['body'][_0xa354('0x31')]=_0x15d1ed['queryResult'][_0xa354('0x32')];_0x5ccc55[_0xa354('0x20')][_0xa354('0x33')]=_0x15d1ed[_0xa354('0x2b')][_0xa354('0x2c')]&&_0x15d1ed['queryResult'][_0xa354('0x2c')]['fields']?_0x15d1ed[_0xa354('0x2b')][_0xa354('0x2c')][_0xa354('0x2d')][_0xa354('0x2e')]['boolValue']:![];_0x5ccc55[_0xa354('0x20')]['DIALOGFLOWV2_INTENTNAME']=_0x15d1ed[_0xa354('0x2b')]['intent']['name'];_0x5ccc55[_0xa354('0x20')][_0xa354('0x34')]=_0x15d1ed[_0xa354('0x2b')][_0xa354('0x35')][_0xa354('0x36')];_0x5ccc55['body'][_0xa354('0x37')]=_0x15d1ed[_0xa354('0x2b')]['intent'][_0xa354('0x38')];_0x5ccc55[_0xa354('0x20')]['DIALOGFLOWV2_LANGUAGECODE']=_0x15d1ed[_0xa354('0x2b')][_0xa354('0x39')];_0x5ccc55['body'][_0xa354('0x3a')]=_0x15d1ed[_0xa354('0x2b')][_0xa354('0x3b')];_0x5ccc55['body'][_0xa354('0x3c')]=_0x15d1ed[_0xa354('0x2b')][_0xa354('0x3d')];_0x27e5b0[_0xa354('0x3e')]=_0xa354('0x2a');_0x27e5b0[_0xa354('0x3f')]=JSON[_0xa354('0x10')](_0x5ead85);var _0x232b5f=[];for(var _0x5d2f90=0x0;_0x5d2f90<_0x5ead85['length'];_0x5d2f90++){var _0xd3e78=_0x5ead85[_0x5d2f90];if(_0xd3e78&&_0xd3e78['queryResult']&&_0xd3e78[_0xa354('0x2b')][_0xa354('0x40')]){_0x232b5f['push'](createMessage(_0x1953ff,_0x22d76,_0x27e5b0,_0xd3e78[_0xa354('0x2b')][_0xa354('0x40')]));}}return Promise[_0xa354('0x41')](_0x232b5f)[_0xa354('0xc')](function(){if(_0x7253e1){_0x50cbbe[_0xa354('0x15')]();}else{_0x50cbbe[_0xa354('0x26')]();}})[_0xa354('0xe')](function(_0x591fa5){logger['error'](_0xa354('0xf'),_0x1953ff,JSON[_0xa354('0x10')](_0x591fa5));_0x50cbbe[_0xa354('0x15')]();});}})[_0xa354('0xe')](function(_0x2162dd){logger[_0xa354('0x23')](_0xa354('0xf'),_0x1953ff,_0x2162dd[_0xa354('0x28')],_0x2162dd['stack']);_0x50cbbe[_0xa354('0x15')]();});}}catch(_0x25fc2b){logger[_0xa354('0x23')](_0xa354('0xf'),_0x1953ff,JSON[_0xa354('0x10')](_0x25fc2b));_0x50cbbe[_0xa354('0x26')]();}};}; \ 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 a7cc73d..1840c46 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 _0xbeaf=['number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing'];(function(_0x45b575,_0x49a05a){var _0x5bdfa2=function(_0x3b117c){while(--_0x3b117c){_0x45b575['push'](_0x45b575['shift']());}};_0x5bdfa2(++_0x49a05a);}(_0xbeaf,0x119));var _0xfbea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xbeaf[_0x13d07a];return _0x5ee0ee;};'use strict';var schema=require('validate');var _=require(_0xfbea('0x0'));var htmlToText=require(_0xfbea('0x1'));var utils=require(_0xfbea('0x2'));var logger=require(_0xfbea('0x3'))(_0xfbea('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xfbea('0x5'),'message':_0xfbea('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xfbea('0x7')]=function(_0x2da2be,_0x5ead3c){return function(_0x4fd9f0){try{var _0x2d58a7={'condition':htmlToText[_0xfbea('0x8')](utils[_0xfbea('0x9')](_0x5ead3c[0x0],this),{'wordwrap':![]})[_0xfbea('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5ead3c[0x1],'priorityFalse':_0x5ead3c[0x2]};var _0x2e93f9=gotoif[_0xfbea('0xb')](_0x2d58a7,{'typecast':!![]});if(_0x2e93f9['length']){logger[_0xfbea('0xc')](_0xfbea('0xd'),_0x2da2be,_[_0xfbea('0xe')](_0x2e93f9,'message')['join'](',\x20'));_0x4fd9f0[_0xfbea('0xf')]();}else{try{var _0x1f3834=eval('('+_0x2d58a7[_0xfbea('0x10')]+')');var _0x208c57=_0x1f3834?_0x2d58a7['priorityTrue']:_0x2d58a7[_0xfbea('0x11')];logger[_0xfbea('0x12')](_0xfbea('0x13'),_0x2da2be,_0x2d58a7[_0xfbea('0x10')],_0x1f3834,_0x208c57||_0xfbea('0x14'));if(_0x208c57){var _0x5a2ec0=_[_0xfbea('0x15')](_0x4fd9f0['rules'](),{'p':_0x208c57});if(_0x5a2ec0>=0x0){logger[_0xfbea('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2da2be,_0x208c57||'next',_0x5a2ec0);_0x4fd9f0[_0xfbea('0x14')](_0x5a2ec0);}else{logger[_0xfbea('0x12')](_0xfbea('0x16'),_0x2da2be,_0x208c57||_0xfbea('0x14'));_0x4fd9f0[_0xfbea('0xf')]();}}else{_0x4fd9f0[_0xfbea('0x14')]();}}catch(_0x415de5){logger[_0xfbea('0xc')](_0xfbea('0x17'),_0x2da2be,_0x415de5[_0xfbea('0x18')]);_0x4fd9f0[_0xfbea('0xf')]();}}}catch(_0x4cdb0a){logger[_0xfbea('0xc')](_0xfbea('0xd'),_0x2da2be,JSON[_0xfbea('0x19')](_0x4cdb0a));_0x4fd9f0[_0xfbea('0xf')]();}};}; \ No newline at end of file +var _0x5234=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','findIndex','info','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5234,0x168));var _0x4523=function(_0x49bb4f,_0x3ce64a){_0x49bb4f=_0x49bb4f-0x0;var _0x35ff49=_0x5234[_0x49bb4f];return _0x35ff49;};'use strict';var schema=require(_0x4523('0x0'));var _=require(_0x4523('0x1'));var htmlToText=require(_0x4523('0x2'));var utils=require(_0x4523('0x3'));var logger=require(_0x4523('0x4'))(_0x4523('0x5'));var gotoif=schema({'condition':{'type':_0x4523('0x6'),'required':!![],'message':_0x4523('0x7')},'priorityTrue':{'type':_0x4523('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x4523('0x8'),'message':_0x4523('0x9')}});exports[_0x4523('0xa')]=function(_0x1f6cbc,_0x4b669a){return function(_0x49a878){try{var _0x23c2f7={'condition':htmlToText[_0x4523('0xb')](utils['getMustacheRender'](_0x4b669a[0x0],this),{'wordwrap':![]})[_0x4523('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4b669a[0x1],'priorityFalse':_0x4b669a[0x2]};var _0xa8c38d=gotoif[_0x4523('0x0')](_0x23c2f7,{'typecast':!![]});if(_0xa8c38d[_0x4523('0xd')]){logger[_0x4523('0xe')](_0x4523('0xf'),_0x1f6cbc,_[_0x4523('0x10')](_0xa8c38d,_0x4523('0x11'))[_0x4523('0x12')](',\x20'));_0x49a878[_0x4523('0x13')]();}else{try{var _0x3ac50d=eval('('+_0x23c2f7[_0x4523('0x14')]+')');var _0x2036f8=_0x3ac50d?_0x23c2f7[_0x4523('0x15')]:_0x23c2f7['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1f6cbc,_0x23c2f7['condition'],_0x3ac50d,_0x2036f8||'next');if(_0x2036f8){var _0x1e55cc=_[_0x4523('0x16')](_0x49a878['rules'](),{'p':_0x2036f8});if(_0x1e55cc>=0x0){logger[_0x4523('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1f6cbc,_0x2036f8||_0x4523('0x18'),_0x1e55cc);_0x49a878[_0x4523('0x18')](_0x1e55cc);}else{logger[_0x4523('0x17')](_0x4523('0x19'),_0x1f6cbc,_0x2036f8||_0x4523('0x18'));_0x49a878[_0x4523('0x13')]();}}else{_0x49a878[_0x4523('0x18')]();}}catch(_0x22973d){logger[_0x4523('0xe')](_0x4523('0x1a'),_0x1f6cbc,_0x22973d[_0x4523('0x11')]);_0x49a878['stop']();}}}catch(_0x9e4454){logger[_0x4523('0xe')](_0x4523('0xf'),_0x1f6cbc,JSON[_0x4523('0x1b')](_0x9e4454));_0x49a878['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 4941aca..97cc53b 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 _0x748c=['consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x9e5eec,_0x444242){var _0x5a5d60=function(_0x48b251){while(--_0x48b251){_0x9e5eec['push'](_0x9e5eec['shift']());}};_0x5a5d60(++_0x444242);}(_0x748c,0x150));var _0xc748=function(_0x179195,_0x1dcc71){_0x179195=_0x179195-0x0;var _0x3e0ab6=_0x748c[_0x179195];return _0x3e0ab6;};'use strict';var schema=require(_0xc748('0x0'));var _=require(_0xc748('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xc748('0x2'),'required':!![],'message':_0xc748('0x3')}});exports[_0xc748('0x4')]=function(_0x1da203,_0xe40ee9){return function(_0xf78c6e){try{var _0x1095b7={'priority':_0xe40ee9[0x0]};var _0x2a9062=gotop['validate'](_0x1095b7,{'typecast':!![]});if(_0x2a9062[_0xc748('0x5')]){logger[_0xc748('0x6')](_0xc748('0x7'),_0x1da203,_[_0xc748('0x8')](_0x2a9062,_0xc748('0x9'))['join'](',\x20'));_0xf78c6e[_0xc748('0xa')]();}else{logger['info'](_0xc748('0xb'),_0x1da203,_0x1095b7[_0xc748('0xc')]);if(_0x1095b7['priority']){var _0xdb4683=_[_0xc748('0xd')](_0xf78c6e[_0xc748('0xe')](),{'p':_0x1095b7[_0xc748('0xc')]});if(_0xdb4683>=0x0){logger[_0xc748('0xf')](_0xc748('0x10'),_0x1da203,_0x1095b7['priority']||_0xc748('0x11'),_0xdb4683);_0xf78c6e[_0xc748('0x11')](_0xdb4683);}else{logger[_0xc748('0xf')](_0xc748('0x12'),_0x1da203,_0x1095b7['priority']||_0xc748('0x11'));_0xf78c6e['stop']();}}else{_0xf78c6e[_0xc748('0x11')]();}}}catch(_0x329413){logger[_0xc748('0x6')](_0xc748('0x7'),_0x1da203,JSON[_0xc748('0x13')](_0x329413));_0xf78c6e[_0xc748('0xa')]();}};}; \ No newline at end of file +var _0x9f25=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','number'];(function(_0x1c949a,_0x3def30){var _0xa25ff7=function(_0x490e30){while(--_0x490e30){_0x1c949a['push'](_0x1c949a['shift']());}};_0xa25ff7(++_0x3def30);}(_0x9f25,0xb7));var _0x59f2=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x9f25[_0x508c10];return _0x3108b5;};'use strict';var schema=require(_0x59f2('0x0'));var _=require('lodash');var logger=require(_0x59f2('0x1'))(_0x59f2('0x2'));var gotop=schema({'priority':{'type':_0x59f2('0x3'),'required':!![],'message':_0x59f2('0x4')}});exports[_0x59f2('0x5')]=function(_0x3a7fbc,_0x2969fd){return function(_0x40cf20){try{var _0x5dcc32={'priority':_0x2969fd[0x0]};var _0x49942a=gotop['validate'](_0x5dcc32,{'typecast':!![]});if(_0x49942a['length']){logger['error']('[%s][GOTOP]\x20%s',_0x3a7fbc,_[_0x59f2('0x6')](_0x49942a,_0x59f2('0x7'))[_0x59f2('0x8')](',\x20'));_0x40cf20[_0x59f2('0x9')]();}else{logger[_0x59f2('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x3a7fbc,_0x5dcc32[_0x59f2('0xb')]);if(_0x5dcc32['priority']){var _0x33c646=_[_0x59f2('0xc')](_0x40cf20['rules'](),{'p':_0x5dcc32[_0x59f2('0xb')]});if(_0x33c646>=0x0){logger['info'](_0x59f2('0xd'),_0x3a7fbc,_0x5dcc32[_0x59f2('0xb')]||_0x59f2('0xe'),_0x33c646);_0x40cf20['next'](_0x33c646);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x3a7fbc,_0x5dcc32['priority']||_0x59f2('0xe'));_0x40cf20[_0x59f2('0x9')]();}}else{_0x40cf20[_0x59f2('0xe')]();}}}catch(_0x17a880){logger['error'](_0x59f2('0xf'),_0x3a7fbc,JSON[_0x59f2('0x10')](_0x17a880));_0x40cf20['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 517122c..70f8c06 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 _0xeae6=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','account','upperFirst'];(function(_0x19868c,_0x21cac3){var _0x20fb6c=function(_0x37bca0){while(--_0x37bca0){_0x19868c['push'](_0x19868c['shift']());}};_0x20fb6c(++_0x21cac3);}(_0xeae6,0xc3));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6eae('0x0'));var utils=require(_0x6eae('0x1'));var logger=require(_0x6eae('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6eae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6eae('0x4')),'faxMessage':require(_0x6eae('0x5')),'whatsappMessage':require(_0x6eae('0x6'))};exports[_0x6eae('0x7')]=function(_0x3e0903,_0x134c6a){return function(_0x19d1e9){try{var _0x778b34={'body':utils['getMustacheRender'](_0x134c6a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x6eae('0x8')]===_0x6eae('0x9')){_0x778b34['ChatWebsiteId']=this[_0x6eae('0xa')]['id'];}else{_0x778b34[_[_0x6eae('0xb')](this['channel'])+'AccountId']=this[_0x6eae('0xa')]['id'];}_0x778b34[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x6eae('0xc')]['id'];if(rpc[this[_0x6eae('0x8')]+'Message']){return rpc[this[_0x6eae('0x8')]+_0x6eae('0xd')][_0x6eae('0xe')](_0x778b34)[_0x6eae('0xf')](function(_0x118bc0){logger[_0x6eae('0x10')](_0x6eae('0x11'),_0x3e0903,_0x778b34['body']);_0x19d1e9[_0x6eae('0x12')]();})[_0x6eae('0x13')](function(_0x147b90){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x147b90));_0x19d1e9[_0x6eae('0x16')]();});}}catch(_0x350393){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x350393));_0x19d1e9[_0x6eae('0x16')]();}};}; \ No newline at end of file +var _0xbefc=['[%s][MESSAGE]\x20%s','body','next','catch','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','Message','create','then'];(function(_0x12af17,_0x3a44df){var _0x21b342=function(_0x35b2f4){while(--_0x35b2f4){_0x12af17['push'](_0x12af17['shift']());}};_0x21b342(++_0x3a44df);}(_0xbefc,0x195));var _0xcbef=function(_0x2464c5,_0x44ff5f){_0x2464c5=_0x2464c5-0x0;var _0x206b68=_0xbefc[_0x2464c5];return _0x206b68;};'use strict';var _=require('lodash');var utils=require(_0xcbef('0x0'));var logger=require(_0xcbef('0x1'))(_0xcbef('0x2'));var rpc={'chatMessage':require(_0xcbef('0x3')),'openchannelMessage':require(_0xcbef('0x4')),'mailMessage':require(_0xcbef('0x5')),'smsMessage':require(_0xcbef('0x6')),'faxMessage':require(_0xcbef('0x7')),'whatsappMessage':require(_0xcbef('0x8'))};exports[_0xcbef('0x9')]=function(_0x1645e3,_0x3fe826){return function(_0x4753d1){try{var _0x17bf41={'body':utils[_0xcbef('0xa')](_0x3fe826[0x0],this),'ContactId':this[_0xcbef('0xb')]['id']};if(this[_0xcbef('0xc')]===_0xcbef('0xd')){_0x17bf41[_0xcbef('0xe')]=this[_0xcbef('0xf')]['id'];}else{_0x17bf41[_[_0xcbef('0x10')](this[_0xcbef('0xc')])+'AccountId']=this[_0xcbef('0xf')]['id'];}_0x17bf41[_[_0xcbef('0x10')](this[_0xcbef('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xcbef('0xc')]+_0xcbef('0x11')]){return rpc[this[_0xcbef('0xc')]+_0xcbef('0x11')][_0xcbef('0x12')](_0x17bf41)[_0xcbef('0x13')](function(_0x2ae1a2){logger['info'](_0xcbef('0x14'),_0x1645e3,_0x17bf41[_0xcbef('0x15')]);_0x4753d1[_0xcbef('0x16')]();})[_0xcbef('0x17')](function(_0x3c6e80){logger[_0xcbef('0x18')](_0xcbef('0x14'),_0x1645e3,JSON['stringify'](_0x3c6e80));_0x4753d1['stop']();});}}catch(_0x13e6e6){logger[_0xcbef('0x18')](_0xcbef('0x14'),_0x1645e3,JSON['stringify'](_0x13e6e6));_0x4753d1['stop']();}};}; \ 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 ed0e22f..d91072d 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 _0xc7ac=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0xc7ac,0x1e9));var _0xcc7a=function(_0x4b4d18,_0x1a954f){_0x4b4d18=_0x4b4d18-0x0;var _0x4d1425=_0xc7ac[_0x4b4d18];return _0x4d1425;};'use strict';var utils=require(_0xcc7a('0x0'));var logger=require(_0xcc7a('0x1'))(_0xcc7a('0x2'));exports[_0xcc7a('0x3')]=function(_0x1f2181,_0x5a9b89){return function(_0x119948){try{logger[_0xcc7a('0x4')](_0xcc7a('0x5'),_0x1f2181,utils[_0xcc7a('0x6')](_0x5a9b89[0x0],this));_0x119948['next']();}catch(_0x198992){logger[_0xcc7a('0x7')](_0xcc7a('0x5'),_0x1f2181,JSON[_0xcc7a('0x8')](_0x198992));_0x119948[_0xcc7a('0x9')]();}};}; \ No newline at end of file +var _0x3865=['error','stringify','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x152fb0,_0x2a7216){var _0x5044d6=function(_0x3861d5){while(--_0x3861d5){_0x152fb0['push'](_0x152fb0['shift']());}};_0x5044d6(++_0x2a7216);}(_0x3865,0x142));var _0x5386=function(_0x482016,_0x1a2d53){_0x482016=_0x482016-0x0;var _0x1f2d6b=_0x3865[_0x482016];return _0x1f2d6b;};'use strict';var utils=require(_0x5386('0x0'));var logger=require('../../../../config/logger')(_0x5386('0x1'));exports[_0x5386('0x2')]=function(_0x4ebf48,_0x7e3195){return function(_0x8ad2ca){try{logger[_0x5386('0x3')](_0x5386('0x4'),_0x4ebf48,utils[_0x5386('0x5')](_0x7e3195[0x0],this));_0x8ad2ca['next']();}catch(_0x2518a4){logger[_0x5386('0x6')](_0x5386('0x4'),_0x4ebf48,JSON[_0x5386('0x7')](_0x2518a4));_0x8ad2ca['stop']();}};}; \ 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 acd4f06..e2f770a 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 _0x0156=['AccountId','WebsiteId','info','name','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message'];(function(_0x5ca699,_0x4d7c82){var _0x17f08c=function(_0x2d7695){while(--_0x2d7695){_0x5ca699['push'](_0x5ca699['shift']());}};_0x17f08c(++_0x4d7c82);}(_0x0156,0xbe));var _0x6015=function(_0x54bf68,_0x1df62c){_0x54bf68=_0x54bf68-0x0;var _0x32fb54=_0x0156[_0x54bf68];return _0x32fb54;};'use strict';var schema=require(_0x6015('0x0'));var _=require(_0x6015('0x1'));var util=require(_0x6015('0x2'));var seqqueue=require(_0x6015('0x3'));var moment=require(_0x6015('0x4'));var Redis=require(_0x6015('0x5'));var config=require('../../../../config/environment');var logger=require(_0x6015('0x6'))(_0x6015('0x7'));var strategy=require(_0x6015('0x8'));config['redis']=_[_0x6015('0x9')](config[_0x6015('0xa')],{'host':_0x6015('0xb'),'port':0x18eb});var io=require(_0x6015('0xc'))(new Redis(config[_0x6015('0xa')]));var attributes=['id',_0x6015('0xd'),_0x6015('0xe'),_0x6015('0xf'),_0x6015('0x10'),'joinAt'];function emit(_0x55ae15,_0x11ea45,_0x17628a){io['to'](_0x55ae15)[_0x6015('0x11')](_0x11ea45,_0x17628a);}function emitChannelQueueInteraction(_0x19700f,_0x35a4e1,_0x265a9a,_0xb09197,_0x10e8eb,_0x108ca3,_0x268465,_0x3a28e8){var _0x560f4e=_[_0x6015('0x12')](_0x265a9a);_0x560f4e[_0x6015('0xd')]=_0x3a28e8;_0x560f4e[_0x6015('0xf')]=_0x35a4e1;_0x560f4e[_0x6015('0xe')]=_0xb09197;_0x560f4e['id']=_0x10e8eb;if(_0x108ca3){attributes['push'](_[_0x6015('0x13')](_0x19700f)+'InteractionId');_0x268465[util[_0x6015('0x14')](_0x6015('0x15'),_0x19700f)][_0x10e8eb]=_[_0x6015('0x16')](_0x560f4e,attributes);}else{delete _0x268465[util[_0x6015('0x14')](_0x6015('0x15'),_0x19700f)][_0x10e8eb];}emit(util['format'](_0x6015('0x17'),_0x19700f,_0x35a4e1),util[_0x6015('0x14')]('%s_queue_waiting_interaction:%s',_0x19700f,_0x108ca3?'save':_0x6015('0x18')),_[_0x6015('0x16')](_0x560f4e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6015('0x19')),'chatQueueReport':require(_0x6015('0x1a')),'smsQueueReport':require(_0x6015('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6015('0x1c')),'chatInteraction':require(_0x6015('0x1d')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x6015('0x1e')),'smsInteraction':require(_0x6015('0x1f')),'whatsappInteraction':require(_0x6015('0x20'))};var queue=schema({'name':{'type':_0x6015('0x21'),'required':!![],'message':_0x6015('0x22')},'timeout':{'type':_0x6015('0x23'),'message':_0x6015('0x24')}});function startRouting(_0x5b24a0,_0x4fa0ac,_0x1b9ad2,_0x2d69bd){if(_0x5b24a0&&_0x4fa0ac&&_0x1b9ad2){_0x4fa0ac[_0x6015('0x25')]+=0x1;var _0x2783eb={'uniqueid':_0x5b24a0,'from':_0x1b9ad2[_0x6015('0x26')]?_0x1b9ad2[_0x6015('0x26')][_0x6015('0x10')]:'','joinAt':moment()[_0x6015('0x14')](_0x6015('0x27')),'ContactId':_0x1b9ad2[_0x6015('0x28')]?_0x1b9ad2[_0x6015('0x28')]['id']:null,'ListId':_0x1b9ad2[_0x6015('0x29')]?_0x1b9ad2[_0x6015('0x29')]['id']:null};_0x2783eb[_[_0x6015('0x2a')](_0x1b9ad2[_0x6015('0x2b')])+_0x6015('0x2c')]=_0x4fa0ac['id']||null;_0x2783eb[_[_0x6015('0x2a')](_0x1b9ad2[_0x6015('0x2b')])+'InteractionId']=_0x1b9ad2['interaction']?_0x1b9ad2[_0x6015('0x2d')]['id']:null;_0x2783eb[_[_0x6015('0x2a')](_0x1b9ad2[_0x6015('0x2b')])+'MessageId']=_0x1b9ad2[_0x6015('0x2e')]?_0x1b9ad2[_0x6015('0x2e')]['id']:null;_0x2783eb[_[_0x6015('0x2a')](_0x1b9ad2[_0x6015('0x2b')])+(_0x1b9ad2[_0x6015('0x2b')]!=='chat'?_0x6015('0x2f'):_0x6015('0x30'))]=_0x1b9ad2['account']?_0x1b9ad2['account']['id']:null;logger[_0x6015('0x31')](util[_0x6015('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x5b24a0,_0x4fa0ac[_0x6015('0x32')]));emitChannelQueueInteraction(_0x1b9ad2[_0x6015('0x2b')],_0x4fa0ac[_0x6015('0x32')],_0x2783eb,_0x1b9ad2['account'][_0x6015('0x32')],_0x1b9ad2[_0x6015('0x2e')]['id'],!![],_0x2d69bd,_0x4fa0ac['id']);if(rpc[_0x1b9ad2[_0x6015('0x2b')]+'QueueReport']){return rpc[_0x1b9ad2['channel']+'QueueReport']['create'](_0x2783eb)[_0x6015('0x33')](function(_0x33210f){logger[_0x6015('0x34')](_0x6015('0x35'),_0x33210f);});}}}function stopRouting(_0xbc80cb,_0x3a7e60,_0x2b7ef6,_0x19cdf1){if(_0xbc80cb&&_0x3a7e60){_0x3a7e60[_0x6015('0x25')]-=0x1;var _0x5c92b2={'leaveAt':moment()['format'](_0x6015('0x27')),'acceptAt':moment()[_0x6015('0x14')](_0x6015('0x27')),'reason':'accepted'};logger['info'](util[_0x6015('0x14')](_0x6015('0x36'),_0xbc80cb,_0x3a7e60[_0x6015('0x32')]));emitChannelQueueInteraction(_0x2b7ef6[_0x6015('0x2b')],_0x3a7e60['name'],_0x2b7ef6['body'],_0x2b7ef6[_0x6015('0xe')][_0x6015('0x32')],_0x2b7ef6[_0x6015('0x2e')]['id'],![],_0x19cdf1,_0x3a7e60['id']);return rpc[_0x2b7ef6['channel']+'Interaction'][_0x6015('0x37')](_0x2b7ef6['interaction']['id'],{'queueId':_0x3a7e60['id']})['then'](function(){if(rpc[_0x2b7ef6[_0x6015('0x2b')]+_0x6015('0x38')]){return rpc[_0x2b7ef6[_0x6015('0x2b')]+_0x6015('0x38')][_0x6015('0x37')](_0xbc80cb,_0x5c92b2)[_0x6015('0x33')](function(_0x1f4fa3){logger[_0x6015('0x34')](_0x6015('0x39'),_0x1f4fa3);});}});}}function endRouting(_0x36b4fa,_0x2f1d7d,_0x47aa92,_0x1906ef){if(_0x36b4fa&&_0x2f1d7d){_0x2f1d7d[_0x6015('0x25')]-=0x1;var _0x2c4690={'leaveAt':moment()[_0x6015('0x14')](_0x6015('0x27')),'exitAt':moment()[_0x6015('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6015('0x3a')};logger['info'](util['format'](_0x6015('0x3b'),_0x36b4fa,_0x2f1d7d[_0x6015('0x32')]));emitChannelQueueInteraction(_0x47aa92['channel'],_0x2f1d7d[_0x6015('0x32')],_0x47aa92[_0x6015('0x26')],_0x47aa92['account']['name'],_0x47aa92[_0x6015('0x2e')]['id'],![],_0x1906ef);if(rpc[_0x47aa92[_0x6015('0x2b')]+_0x6015('0x38')]){return rpc[_0x47aa92[_0x6015('0x2b')]+_0x6015('0x38')][_0x6015('0x37')](_0x36b4fa,_0x2c4690)[_0x6015('0x33')](function(_0x1e9cc8){logger[_0x6015('0x34')](_0x6015('0x39'),_0x1e9cc8);});}}}function handleFindQueue(_0x466255){return function(_0x5367f1){return _0x5367f1[_0x6015('0x32')][_0x6015('0x3c')]()===_0x466255['toLowerCase']();};}exports[_0x6015('0x3d')]=function(_0x195dc1,_0x2ebaf7,_0x32b984,_0xaee96f){return function(_0x3156c1){try{var _0x4b351a={'name':_0x2ebaf7[0x0],'timeout':_0x2ebaf7[0x1]};var _0x491374=queue[_0x6015('0x0')](_0x4b351a,{'typecast':!![]});if(_0x491374[_0x6015('0x3e')]){logger[_0x6015('0x34')](_0x6015('0x3f'),_0x195dc1,_['map'](_0x491374,_0x6015('0x2e'))[_0x6015('0x40')](',\x20'));_0x3156c1[_0x6015('0x41')]();}else{var _0x2805ca=_[_0x6015('0x42')](_0x32b984[_0xaee96f[_0x6015('0x2b')]+_0x6015('0x43')],handleFindQueue(_0x4b351a['name']));if(_0x2805ca){startRouting(_0x195dc1,_0x2805ca,_0xaee96f,_0x32b984);var _0x5b2553=(_0x2805ca[_0x6015('0x3a')]||0xa)*0x3e8;var _0x3dc8c5=(_0x4b351a['timeout']||0x14)*0x3e8;var _0x54d92e;if(_0x5b2553>_0x3dc8c5){_0x3dc8c5=_0x5b2553;}var _0x45c01b=seqqueue['createQueue'](_0x5b2553);_0x45c01b['id']=_0x195dc1;_0x45c01b[_0x6015('0x44')]=_0x5b2553;_0x45c01b[_0x6015('0x45')]=_0x3dc8c5;_0x45c01b[_0x6015('0x2b')]=_0xaee96f[_0x6015('0x2b')];_0x32b984[_0x6015('0x46')][_0x195dc1]['on'](_0x6015('0x47'),function(){logger[_0x6015('0x31')](_0x6015('0x48'),_0x195dc1);stopRouting(_0x195dc1,_0x2805ca,_0xaee96f,_0x32b984);clearTimeout(_0x54d92e);_0x54d92e=undefined;_0x45c01b[_0x6015('0x49')](!![]);if(_0x32b984['rules'][_0x195dc1]){delete _0x32b984['rules'][_0x195dc1];}_0x3156c1[_0x6015('0x41')]();});_0x32b984[_0x6015('0x46')][_0x195dc1]['on']('complete',function(){if(_0x32b984[_0x6015('0x46')][_0x195dc1]){delete _0x32b984['rules'][_0x195dc1];}});_0x54d92e=setTimeout(function(){logger[_0x6015('0x31')](_0x6015('0x4a'),_0x195dc1);endRouting(_0x195dc1,_0x2805ca,_0xaee96f,_0x32b984);clearTimeout(_0x54d92e);_0x45c01b[_0x6015('0x49')](!![]);_0x3156c1[_0x6015('0x4b')]();},_0x3dc8c5);switch(_0x2805ca[_0x6015('0x4c')]){case _0x6015('0x4d'):strategy[_0x6015('0x4d')](_0x45c01b,_0x2805ca,_0x32b984,_0xaee96f);break;default:strategy[_0x6015('0x4e')](_0x45c01b,_0x2805ca,_0x32b984,_0xaee96f);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x195dc1,_0x4b351a[_0x6015('0x32')]);_0x3156c1[_0x6015('0x41')]();}}}catch(_0x4f158c){logger['error'](_0x6015('0x3f'),_0x195dc1,_0x4f158c['stack']);_0x3156c1[_0x6015('0x41')]();}};}; \ No newline at end of file +var _0x15a0=['create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','join','stop','find','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','close','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','util','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','emit','account','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x15a0,0xc4));var _0x015a=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x15a0[_0x5d7227];return _0x15ac55;};'use strict';var schema=require(_0x015a('0x0'));var _=require('lodash');var util=require(_0x015a('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x015a('0x2'));var Redis=require('ioredis');var config=require(_0x015a('0x3'));var logger=require(_0x015a('0x4'))(_0x015a('0x5'));var strategy=require(_0x015a('0x6'));config[_0x015a('0x7')]=_[_0x015a('0x8')](config[_0x015a('0x7')],{'host':_0x015a('0x9'),'port':0x18eb});var io=require(_0x015a('0xa'))(new Redis(config[_0x015a('0x7')]));var attributes=['id',_0x015a('0xb'),'account',_0x015a('0xc'),'from','joinAt'];function emit(_0x5c1417,_0x2a605b,_0x2d1c0c){io['to'](_0x5c1417)[_0x015a('0xd')](_0x2a605b,_0x2d1c0c);}function emitChannelQueueInteraction(_0x3413dd,_0x5256fc,_0x3532c6,_0x319016,_0x4f7b50,_0x5063eb,_0x3b7974,_0x312930){var _0x413a8d=_['clone'](_0x3532c6);_0x413a8d[_0x015a('0xb')]=_0x312930;_0x413a8d['queue']=_0x5256fc;_0x413a8d[_0x015a('0xe')]=_0x319016;_0x413a8d['id']=_0x4f7b50;if(_0x5063eb){attributes['push'](_[_0x015a('0xf')](_0x3413dd)+_0x015a('0x10'));_0x3b7974[util['format'](_0x015a('0x11'),_0x3413dd)][_0x4f7b50]=_[_0x015a('0x12')](_0x413a8d,attributes);}else{delete _0x3b7974[util[_0x015a('0x13')](_0x015a('0x11'),_0x3413dd)][_0x4f7b50];}emit(util['format'](_0x015a('0x14'),_0x3413dd,_0x5256fc),util[_0x015a('0x13')](_0x015a('0x15'),_0x3413dd,_0x5063eb?_0x015a('0x16'):_0x015a('0x17')),_[_0x015a('0x12')](_0x413a8d,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x015a('0x18')),'chatQueueReport':require(_0x015a('0x19')),'smsQueueReport':require(_0x015a('0x1a')),'faxQueueReport':require(_0x015a('0x1b')),'whatsappQueueReport':require(_0x015a('0x1c')),'chatInteraction':require(_0x015a('0x1d')),'faxInteraction':require(_0x015a('0x1e')),'mailInteraction':require(_0x015a('0x1f')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x015a('0x20')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x015a('0x21')},'timeout':{'type':_0x015a('0x22'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xd2ccbb,_0x5dd9f8,_0x2cad15,_0x281f0b){if(_0xd2ccbb&&_0x5dd9f8&&_0x2cad15){_0x5dd9f8['waiting']+=0x1;var _0x2b13f2={'uniqueid':_0xd2ccbb,'from':_0x2cad15['body']?_0x2cad15[_0x015a('0x23')][_0x015a('0x24')]:'','joinAt':moment()[_0x015a('0x13')](_0x015a('0x25')),'ContactId':_0x2cad15[_0x015a('0x26')]?_0x2cad15[_0x015a('0x26')]['id']:null,'ListId':_0x2cad15['list']?_0x2cad15[_0x015a('0x27')]['id']:null};_0x2b13f2[_[_0x015a('0x28')](_0x2cad15[_0x015a('0x29')])+_0x015a('0x2a')]=_0x5dd9f8['id']||null;_0x2b13f2[_[_0x015a('0x28')](_0x2cad15[_0x015a('0x29')])+_0x015a('0x10')]=_0x2cad15[_0x015a('0x2b')]?_0x2cad15[_0x015a('0x2b')]['id']:null;_0x2b13f2[_[_0x015a('0x28')](_0x2cad15[_0x015a('0x29')])+_0x015a('0x2c')]=_0x2cad15[_0x015a('0x2d')]?_0x2cad15[_0x015a('0x2d')]['id']:null;_0x2b13f2[_[_0x015a('0x28')](_0x2cad15[_0x015a('0x29')])+(_0x2cad15[_0x015a('0x29')]!==_0x015a('0x2e')?_0x015a('0x2f'):_0x015a('0x30'))]=_0x2cad15[_0x015a('0xe')]?_0x2cad15[_0x015a('0xe')]['id']:null;logger[_0x015a('0x31')](util[_0x015a('0x13')](_0x015a('0x32'),_0xd2ccbb,_0x5dd9f8[_0x015a('0x33')]));emitChannelQueueInteraction(_0x2cad15[_0x015a('0x29')],_0x5dd9f8[_0x015a('0x33')],_0x2b13f2,_0x2cad15['account']['name'],_0x2cad15[_0x015a('0x2d')]['id'],!![],_0x281f0b,_0x5dd9f8['id']);if(rpc[_0x2cad15['channel']+_0x015a('0x34')]){return rpc[_0x2cad15['channel']+_0x015a('0x34')][_0x015a('0x35')](_0x2b13f2)[_0x015a('0x36')](function(_0x564377){logger[_0x015a('0x37')](_0x015a('0x38'),_0x564377);});}}}function stopRouting(_0x3227dd,_0x43b93d,_0x9f6c52,_0x23b151){if(_0x3227dd&&_0x43b93d){_0x43b93d[_0x015a('0x39')]-=0x1;var _0x5a5e24={'leaveAt':moment()[_0x015a('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x015a('0x13')](_0x015a('0x25')),'reason':_0x015a('0x3a')};logger[_0x015a('0x31')](util['format'](_0x015a('0x3b'),_0x3227dd,_0x43b93d[_0x015a('0x33')]));emitChannelQueueInteraction(_0x9f6c52[_0x015a('0x29')],_0x43b93d[_0x015a('0x33')],_0x9f6c52[_0x015a('0x23')],_0x9f6c52[_0x015a('0xe')][_0x015a('0x33')],_0x9f6c52['message']['id'],![],_0x23b151,_0x43b93d['id']);return rpc[_0x9f6c52[_0x015a('0x29')]+'Interaction'][_0x015a('0x3c')](_0x9f6c52[_0x015a('0x2b')]['id'],{'queueId':_0x43b93d['id']})[_0x015a('0x3d')](function(){if(rpc[_0x9f6c52[_0x015a('0x29')]+_0x015a('0x34')]){return rpc[_0x9f6c52[_0x015a('0x29')]+_0x015a('0x34')][_0x015a('0x3c')](_0x3227dd,_0x5a5e24)[_0x015a('0x36')](function(_0x1df6b9){logger[_0x015a('0x37')](_0x015a('0x3e'),_0x1df6b9);});}});}}function endRouting(_0x2c7e5c,_0x5d76af,_0x19f33c,_0x3de96b){if(_0x2c7e5c&&_0x5d76af){_0x5d76af[_0x015a('0x39')]-=0x1;var _0x4ea6f4={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x015a('0x25')),'reason':_0x015a('0x3f')};logger[_0x015a('0x31')](util['format'](_0x015a('0x40'),_0x2c7e5c,_0x5d76af[_0x015a('0x33')]));emitChannelQueueInteraction(_0x19f33c[_0x015a('0x29')],_0x5d76af[_0x015a('0x33')],_0x19f33c[_0x015a('0x23')],_0x19f33c[_0x015a('0xe')][_0x015a('0x33')],_0x19f33c[_0x015a('0x2d')]['id'],![],_0x3de96b);if(rpc[_0x19f33c[_0x015a('0x29')]+_0x015a('0x34')]){return rpc[_0x19f33c[_0x015a('0x29')]+_0x015a('0x34')][_0x015a('0x3c')](_0x2c7e5c,_0x4ea6f4)[_0x015a('0x36')](function(_0x45b6da){logger[_0x015a('0x37')](_0x015a('0x3e'),_0x45b6da);});}}}function handleFindQueue(_0x17d4dd){return function(_0x50df8f){return _0x50df8f[_0x015a('0x33')][_0x015a('0x41')]()===_0x17d4dd[_0x015a('0x41')]();};}exports[_0x015a('0x42')]=function(_0x5282b0,_0x5acf68,_0x2a57d3,_0x2ab17d){return function(_0x33777b){try{var _0x30b184={'name':_0x5acf68[0x0],'timeout':_0x5acf68[0x1]};var _0x20f323=queue[_0x015a('0x0')](_0x30b184,{'typecast':!![]});if(_0x20f323[_0x015a('0x43')]){logger[_0x015a('0x37')]('[%s][QUEUE]\x20%s',_0x5282b0,_['map'](_0x20f323,_0x015a('0x2d'))[_0x015a('0x44')](',\x20'));_0x33777b[_0x015a('0x45')]();}else{var _0x46879b=_[_0x015a('0x46')](_0x2a57d3[_0x2ab17d[_0x015a('0x29')]+'Queues'],handleFindQueue(_0x30b184['name']));if(_0x46879b){startRouting(_0x5282b0,_0x46879b,_0x2ab17d,_0x2a57d3);var _0x294eeb=(_0x46879b[_0x015a('0x3f')]||0xa)*0x3e8;var _0x2aa4fe=(_0x30b184['timeout']||0x14)*0x3e8;var _0x1bb5ef;if(_0x294eeb>_0x2aa4fe){_0x2aa4fe=_0x294eeb;}var _0x567b8e=seqqueue[_0x015a('0x47')](_0x294eeb);_0x567b8e['id']=_0x5282b0;_0x567b8e[_0x015a('0x48')]=_0x294eeb;_0x567b8e[_0x015a('0x49')]=_0x2aa4fe;_0x567b8e['channel']=_0x2ab17d['channel'];_0x2a57d3['rules'][_0x5282b0]['on']('end',function(){logger[_0x015a('0x31')](_0x015a('0x4a'),_0x5282b0);stopRouting(_0x5282b0,_0x46879b,_0x2ab17d,_0x2a57d3);clearTimeout(_0x1bb5ef);_0x1bb5ef=undefined;_0x567b8e['close'](!![]);if(_0x2a57d3[_0x015a('0x4b')][_0x5282b0]){delete _0x2a57d3['rules'][_0x5282b0];}_0x33777b['stop']();});_0x2a57d3[_0x015a('0x4b')][_0x5282b0]['on'](_0x015a('0x4c'),function(){if(_0x2a57d3[_0x015a('0x4b')][_0x5282b0]){delete _0x2a57d3[_0x015a('0x4b')][_0x5282b0];}});_0x1bb5ef=setTimeout(function(){logger[_0x015a('0x31')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x5282b0);endRouting(_0x5282b0,_0x46879b,_0x2ab17d,_0x2a57d3);clearTimeout(_0x1bb5ef);_0x567b8e[_0x015a('0x4d')](!![]);_0x33777b[_0x015a('0x4e')]();},_0x2aa4fe);switch(_0x46879b[_0x015a('0x4f')]){case'rrmemory':strategy['rrmemory'](_0x567b8e,_0x46879b,_0x2a57d3,_0x2ab17d);break;default:strategy[_0x015a('0x50')](_0x567b8e,_0x46879b,_0x2a57d3,_0x2ab17d);}}else{logger['error'](_0x015a('0x51'),_0x5282b0,_0x30b184[_0x015a('0x33')]);_0x33777b[_0x015a('0x45')]();}}}catch(_0x321edf){logger[_0x015a('0x37')](_0x015a('0x52'),_0x5282b0,_0x321edf[_0x015a('0x53')]);_0x33777b[_0x015a('0x45')]();}};}; \ 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 3ad2cc4..80f5826 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 _0xb66c=['TIMEOUT','lodash','./util','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','agents','busyQueue','saveWaitingNotification','channel','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb66c,0x175));var _0xcb66=function(_0x391e3b,_0x3e63ed){_0x391e3b=_0x391e3b-0x0;var _0x355fa1=_0xb66c[_0x391e3b];return _0x355fa1;};'use strict';var _=require(_0xcb66('0x0'));var uuid=require('uuid');var util=require(_0xcb66('0x1'));var logger=require('../../../../../config/logger')(_0xcb66('0x2'));var Agent=function(_0x24ea13,_0xf7ccc5,_0x5f487c,_0x35d439){this[_0xcb66('0x3')]=uuid['v4']();this[_0xcb66('0x4')]=_0x24ea13;this[_0xcb66('0x5')]=_0xf7ccc5;this['realtime']=_0x5f487c;this['routing']=_0x35d439;this[_0xcb66('0x4')][_0xcb66('0x6')](this[_0xcb66('0x7')][_0xcb66('0x8')](this),this[_0xcb66('0x9')]['bind'](this));this[_0xcb66('0x4')]['on'](_0xcb66('0xa'),this[_0xcb66('0x9')][_0xcb66('0x8')](this));this[_0xcb66('0x4')]['on']('drained',this[_0xcb66('0xb')][_0xcb66('0x8')](this));};Agent[_0xcb66('0xc')][_0xcb66('0x6')]=function(){this['squeue'][_0xcb66('0x6')](this[_0xcb66('0x7')][_0xcb66('0x8')](this),this[_0xcb66('0x9')]['bind'](this));};Agent[_0xcb66('0xc')][_0xcb66('0xb')]=function(){this[_0xcb66('0x9')](!![]);};Agent[_0xcb66('0xc')]['handleRun']=function(){logger[_0xcb66('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xcb66('0x4')]['id'],this['agent']['id']);if(_[_0xcb66('0xe')](this['realtime']['agents'][this[_0xcb66('0x5')]['id']])){logger[_0xcb66('0xd')](_0xcb66('0xf'),this[_0xcb66('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}else{if(this[_0xcb66('0x2')]['forcedOwnership']||util[_0xcb66('0x10')](this['squeue']['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],this[_0xcb66('0x4')]['channel'],![])){this['realtime']['agents'][this[_0xcb66('0x5')]['id']]['busy']=!![];this['realtime'][_0xcb66('0x12')][this['agent']['id']][_0xcb66('0x13')]=undefined;util[_0xcb66('0x14')](this[_0xcb66('0x11')],this[_0xcb66('0x2')],this[_0xcb66('0x5')],this[_0xcb66('0x4')][_0xcb66('0x15')]);util['showNotification'](this[_0xcb66('0x3')],this['squeue']['id'],this['realtime'][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],null,this[_0xcb66('0x2')]);util['writeLog'](this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],'RINGING'+(this[_0xcb66('0x2')][_0xcb66('0x16')]?_0xcb66('0x17'):''));}else{logger[_0xcb66('0xd')](_0xcb66('0x18'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}}};Agent[_0xcb66('0xc')]['handleTimeout']=function(_0x2152dc){if(_['isNil'](this['realtime']['agents'][this[_0xcb66('0x5')]['id']])){return logger['debug'](_0xcb66('0xf'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);}else{logger['debug'](_0xcb66('0x19'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);util[_0xcb66('0x1a')](this[_0xcb66('0x3')],this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],null,this[_0xcb66('0x2')]);this['realtime'][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']][_0xcb66('0x1b')]=![];this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']][_0xcb66('0x13')]=undefined;util['removeWaitingNotification'](this[_0xcb66('0x11')],this[_0xcb66('0x2')],this[_0xcb66('0x5')],this[_0xcb66('0x4')]['channel']);util[_0xcb66('0x1c')](this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],_0x2152dc?_0xcb66('0x1d'):_0xcb66('0x1e'));}if(!_0x2152dc){setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}};function agent(_0x299156,_0x3dc592,_0x17b087,_0x4ef8ba){return new Agent(_0x299156,_0x3dc592,_0x17b087,_0x4ef8ba);}module['exports']=agent; \ No newline at end of file +var _0x98a8=['prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','push','isAgentAvailable','busy','saveWaitingNotification','channel','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','handleTimeout','bind','timeout','drained','handleDrained'];(function(_0x54a0bc,_0x26159b){var _0x2110dc=function(_0x3b2b26){while(--_0x3b2b26){_0x54a0bc['push'](_0x54a0bc['shift']());}};_0x2110dc(++_0x26159b);}(_0x98a8,0x12c));var _0x898a=function(_0x7f50e3,_0x23e793){_0x7f50e3=_0x7f50e3-0x0;var _0x166101=_0x98a8[_0x7f50e3];return _0x166101;};'use strict';var _=require(_0x898a('0x0'));var uuid=require(_0x898a('0x1'));var util=require(_0x898a('0x2'));var logger=require(_0x898a('0x3'))(_0x898a('0x4'));var Agent=function(_0x226db7,_0x69c61f,_0x4a0836,_0x2bb3e2){this[_0x898a('0x5')]=uuid['v4']();this[_0x898a('0x6')]=_0x226db7;this[_0x898a('0x7')]=_0x69c61f;this[_0x898a('0x8')]=_0x4a0836;this['routing']=_0x2bb3e2;this[_0x898a('0x6')]['push'](this[_0x898a('0x9')]['bind'](this),this[_0x898a('0xa')][_0x898a('0xb')](this));this[_0x898a('0x6')]['on'](_0x898a('0xc'),this[_0x898a('0xa')][_0x898a('0xb')](this));this[_0x898a('0x6')]['on'](_0x898a('0xd'),this[_0x898a('0xe')]['bind'](this));};Agent[_0x898a('0xf')]['push']=function(){this[_0x898a('0x6')]['push'](this[_0x898a('0x9')][_0x898a('0xb')](this),this[_0x898a('0xa')]['bind'](this));};Agent['prototype']['handleDrained']=function(){this[_0x898a('0xa')](!![]);};Agent[_0x898a('0xf')][_0x898a('0x9')]=function(){logger[_0x898a('0x10')](_0x898a('0x11'),this[_0x898a('0x6')]['id'],this['agent']['id']);if(_[_0x898a('0x12')](this['realtime'][_0x898a('0x13')][this['agent']['id']])){logger[_0x898a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x898a('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x898a('0x14')][_0x898a('0xb')](this),0x3e8);}else{if(this[_0x898a('0x4')]['forcedOwnership']||util[_0x898a('0x15')](this['squeue']['id'],this['realtime'][_0x898a('0x13')][this[_0x898a('0x7')]['id']],this['squeue']['channel'],![])){this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']][_0x898a('0x16')]=!![];this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']]['busyQueue']=undefined;util[_0x898a('0x17')](this[_0x898a('0x8')],this[_0x898a('0x4')],this[_0x898a('0x7')],this[_0x898a('0x6')][_0x898a('0x18')]);util['showNotification'](this[_0x898a('0x5')],this[_0x898a('0x6')]['id'],this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']],null,this[_0x898a('0x4')]);util['writeLog'](this[_0x898a('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],_0x898a('0x19')+(this[_0x898a('0x4')][_0x898a('0x1a')]?_0x898a('0x1b'):''));}else{logger[_0x898a('0x10')](_0x898a('0x1c'),this[_0x898a('0x6')]['id'],this[_0x898a('0x7')]['id']);setTimeout(this[_0x898a('0x14')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0xe9c33d){if(_[_0x898a('0x12')](this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']])){return logger[_0x898a('0x10')](_0x898a('0x1d'),this[_0x898a('0x6')]['id'],this[_0x898a('0x7')]['id']);}else{logger[_0x898a('0x10')](_0x898a('0x1e'),this[_0x898a('0x6')]['id'],this['agent']['id']);util[_0x898a('0x1f')](this[_0x898a('0x5')],this[_0x898a('0x6')]['id'],this[_0x898a('0x8')][_0x898a('0x13')][this['agent']['id']],null,this['routing']);this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']]['busy']=![];this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']][_0x898a('0x20')]=undefined;util[_0x898a('0x21')](this[_0x898a('0x8')],this[_0x898a('0x4')],this[_0x898a('0x7')],this['squeue'][_0x898a('0x18')]);util['writeLog'](this['squeue']['id'],this[_0x898a('0x8')]['agents'][this[_0x898a('0x7')]['id']],_0xe9c33d?'STOP':_0x898a('0x22'));}if(!_0xe9c33d){setTimeout(this['push'][_0x898a('0xb')](this),0x3e8);}};function agent(_0x354703,_0x101182,_0x50c0e4,_0x554897){return new Agent(_0x354703,_0x101182,_0x50c0e4,_0x554897);}module['exports']=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 a53c550..567989a 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 _0xafe0=['busyQueue','removeWaitingNotification','uuid','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','handleTimeout','handleDrained','prototype','handleRun','isNil','queue','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','RINGING','busy','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT'];(function(_0x3788b7,_0x4fb4e0){var _0x58b158=function(_0x542374){while(--_0x542374){_0x3788b7['push'](_0x3788b7['shift']());}};_0x58b158(++_0x4fb4e0);}(_0xafe0,0x9d));var _0x0afe=function(_0x24003a,_0x4f4649){_0x24003a=_0x24003a-0x0;var _0x1d76b0=_0xafe0[_0x24003a];return _0x1d76b0;};'use strict';var _=require('lodash');var uuid=require(_0x0afe('0x0'));var util=require('./util');var logger=require(_0x0afe('0x1'))(_0x0afe('0x2'));var Beepall=function(_0x1bf2f9,_0x2a8ec7,_0xaf6379,_0x58e0c5){this[_0x0afe('0x3')]=uuid['v4']();this[_0x0afe('0x4')]=_0x1bf2f9;this['queue']=_0x2a8ec7;this[_0x0afe('0x5')]=_0xaf6379;this['routing']=_0x58e0c5;this['squeue'][_0x0afe('0x6')](this['handleRun'][_0x0afe('0x7')](this),this[_0x0afe('0x8')]['bind'](this));this[_0x0afe('0x4')]['on']('timeout',this['handleTimeout'][_0x0afe('0x7')](this));this[_0x0afe('0x4')]['on']('drained',this[_0x0afe('0x9')][_0x0afe('0x7')](this));};Beepall[_0x0afe('0xa')]['push']=function(){this['squeue']['push'](this[_0x0afe('0xb')][_0x0afe('0x7')](this),this[_0x0afe('0x8')]['bind'](this));};Beepall['prototype']['handleDrained']=function(){this[_0x0afe('0x8')](!![]);};Beepall[_0x0afe('0xa')][_0x0afe('0xb')]=function(){var _0x218c77=!![];if(!_[_0x0afe('0xc')](this[_0x0afe('0xd')])&&!_[_0x0afe('0xc')](this['queue'][_0x0afe('0xe')])&&this['queue']['Agents']['length']>0x0){for(var _0x1d2da8=0x0,_0xb2476b;_0x1d2da80x0){for(var _0x43d3cf=0x0,_0x450855;_0x43d3cf0x0&&_0x14a514[_0x3c11bf+_0xe7ee('0x25')]>=_0x14a514[_0x3c11bf+'Capacity']){writeLog(_0x5ba6db,_0x14a514,_0x3c11bf['toUpperCase']()+_0xe7ee('0x26'));return![];}}return!![];};exports[_0xe7ee('0x27')]=function(_0x5885d2,_0x2505b7,_0x3f9af2,_0x13a1dd,_0x2a562e){return sendNotification(!![],_0x5885d2,_0x2505b7,_0x3f9af2,_0x13a1dd,_0x2a562e);};exports['hideNotification']=function(_0x3a7c5c,_0x17ab5c,_0x3d6568,_0x1e5fde,_0x67ff53){return sendNotification(![],_0x3a7c5c,_0x17ab5c,_0x3d6568,_0x1e5fde,_0x67ff53);};exports['checkWaitingNotifications']=function(_0x52d341,_0x561112,_0x20cb05){var _0x25ce52=_0x561112[_0xe7ee('0x28')][_0xe7ee('0x29')];if(!_0x25ce52&&_0x20cb05){_0x25ce52=_0x20cb05['id'];}var _0x3f20c8=_[_0xe7ee('0x2a')](_0x52d341[_0x561112[_0xe7ee('0x2b')]+_0xe7ee('0x2c')],function(_0x3086ab){var _0x736e4c=_[_0xe7ee('0x2d')](_0x561112[_0xe7ee('0x2b')])+_0xe7ee('0x2e');return _0x3086ab[_0x736e4c]===_0x561112[_0xe7ee('0x28')]['id'];});if(!_0x3f20c8&&_0x25ce52&&_0x52d341[_0xe7ee('0x2f')][_0x25ce52]){_0x3f20c8=_[_0xe7ee('0x2a')](_0x52d341[_0xe7ee('0x2f')][_0x25ce52][_0x561112['channel']+'WaitingInteractions'],function(_0x10a933){return _0x10a933['id']===_0x561112[_0xe7ee('0x28')]['id'];});}return _0x3f20c8;};exports['saveWaitingNotification']=function(_0x4e77af,_0x18d33c,_0x4cb075,_0x59a03d){if(_0x4cb075&&_0x4cb075['id']&&_0x4e77af[_0xe7ee('0x2f')]&&_0x4e77af[_0xe7ee('0x2f')][_0x4cb075['id']]){_0x4e77af[_0xe7ee('0x2f')][_0x4cb075['id']][_0x59a03d+_0xe7ee('0x30')][_0x18d33c[_0xe7ee('0x16')]['id']]={'id':_0x18d33c['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x1ed84d,_0x486a46,_0x39bd1e,_0x576acd){if(_0x39bd1e&&_0x39bd1e['id']&&_0x1ed84d[_0xe7ee('0x2f')]&&_0x1ed84d[_0xe7ee('0x2f')][_0x39bd1e['id']]){delete _0x1ed84d[_0xe7ee('0x2f')][_0x39bd1e['id']][_0x576acd+'WaitingInteractions'][_0x486a46[_0xe7ee('0x16')]['id']];}};exports[_0xe7ee('0x31')]=writeLog; \ No newline at end of file +var _0xa848=['some','channel','agents','WaitingInteractions','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','format','message','user:%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','interaction','UserId'];(function(_0x340ebf,_0x2e4d91){var _0x46faa7=function(_0x299dae){while(--_0x299dae){_0x340ebf['push'](_0x340ebf['shift']());}};_0x46faa7(++_0x2e4d91);}(_0xa848,0x99));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var utils=require(_0x8a84('0x2'));var Redis=require('ioredis');var config=require(_0x8a84('0x3'));var logger=require(_0x8a84('0x4'))(_0x8a84('0x5'));config[_0x8a84('0x6')]=_[_0x8a84('0x7')](config[_0x8a84('0x6')],{'host':_0x8a84('0x8'),'port':0x18eb});var io=require(_0x8a84('0x9'))(new Redis(config[_0x8a84('0x6')]));function sendNotification(_0x3ee596,_0x1d463b,_0x1b958b,_0x764e89,_0xd33118,_0x5a76f4){var _0x325599=_0x5a76f4||{};var _0x423b07=_0x1b958b[_0x8a84('0xa')]('.');var _0x47e2f6={'uniqueid':_0x1d463b,'channel':_0x423b07[0x0],'id':_0x423b07[0x1],'title':_0x423b07[0x0]+_0x8a84('0xb'),'interactionId':_0x423b07[0x2],'queue':_0xd33118?_0xd33118[_0x8a84('0xc')]:null,'sound':_0x325599[_0x8a84('0xd')][_0x8a84('0xe')],'shake':_0x325599[_0x8a84('0xd')][_0x8a84('0xf')]};try{if(!_0x325599[_0x8a84('0x10')]){_0x325599[_0x8a84('0x10')]={};}if(_0xd33118){_0x325599[_0x8a84('0x10')][_0x8a84('0x11')]=_0xd33118;}else if(_0x325599[_0x8a84('0x10')][_0x8a84('0x11')]){delete _0x325599['body'][_0x8a84('0x11')];}_0x47e2f6[_0x8a84('0x12')]=utils[_0x8a84('0x13')](_0x325599['account'][_0x8a84('0x14')],_0x325599);}catch(_0x2de032){_0x47e2f6[_0x8a84('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x8a84('0x15')](util[_0x8a84('0x16')]('[%s][QUEUE]\x20%s',_0x1d463b,_0x2de032[_0x8a84('0x17')]));}io['to'](util[_0x8a84('0x16')](_0x8a84('0x18'),_0x764e89[_0x8a84('0xc')]))['emit'](util[_0x8a84('0x16')](_0x8a84('0x19'),_0x3ee596?_0x8a84('0x1a'):_0x8a84('0x1b')),_0x47e2f6);}function writeLog(_0x292013,_0x11b98c,_0x5bd7d9){return logger[_0x8a84('0x1c')](util['format'](_0x8a84('0x1d'),_0x292013,_0x11b98c['name'],_0x5bd7d9));}exports[_0x8a84('0x1e')]=function(_0x3f4880,_0x1ddfcb,_0x56cb73,_0x123d5e){if(_0x1ddfcb[_0x8a84('0x1f')]){writeLog(_0x3f4880,_0x1ddfcb,_0x8a84('0x20'));return![];}if(!_0x1ddfcb[_0x8a84('0x21')]){writeLog(_0x3f4880,_0x1ddfcb,_0x8a84('0x22'));return![];}if(_0x1ddfcb[_0x56cb73+'Pause']){writeLog(_0x3f4880,_0x1ddfcb,_0x8a84('0x23'));return![];}if(_0x123d5e&&_0x1ddfcb[_0x8a84('0x24')](_0x56cb73+_0x8a84('0x25'))&&_0x1ddfcb[_0x8a84('0x24')](_0x56cb73+_0x8a84('0x26'))){if(_0x1ddfcb[_0x56cb73+'Capacity']>0x0&&_0x1ddfcb[_0x56cb73+_0x8a84('0x26')]>=_0x1ddfcb[_0x56cb73+_0x8a84('0x25')]){writeLog(_0x3f4880,_0x1ddfcb,_0x56cb73[_0x8a84('0x27')]()+_0x8a84('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x34b0dd,_0x244126,_0x260f6d,_0x34e448,_0x4a9f05){return sendNotification(!![],_0x34b0dd,_0x244126,_0x260f6d,_0x34e448,_0x4a9f05);};exports['hideNotification']=function(_0x52db42,_0x272252,_0x44632e,_0x5520bf,_0x3f6337){return sendNotification(![],_0x52db42,_0x272252,_0x44632e,_0x5520bf,_0x3f6337);};exports['checkWaitingNotifications']=function(_0x508720,_0x47b658,_0x4940af){var _0x482067=_0x47b658[_0x8a84('0x29')][_0x8a84('0x2a')];if(!_0x482067&&_0x4940af){_0x482067=_0x4940af['id'];}var _0x396c46=_[_0x8a84('0x2b')](_0x508720[_0x47b658[_0x8a84('0x2c')]+'QueuesWaitingInteractions'],function(_0x2df556){var _0x29fe41=_['capitalize'](_0x47b658[_0x8a84('0x2c')])+'InteractionId';return _0x2df556[_0x29fe41]===_0x47b658['interaction']['id'];});if(!_0x396c46&&_0x482067&&_0x508720[_0x8a84('0x2d')][_0x482067]){_0x396c46=_[_0x8a84('0x2b')](_0x508720[_0x8a84('0x2d')][_0x482067][_0x47b658[_0x8a84('0x2c')]+_0x8a84('0x2e')],function(_0x16707a){return _0x16707a['id']===_0x47b658[_0x8a84('0x29')]['id'];});}return _0x396c46;};exports['saveWaitingNotification']=function(_0x4cd479,_0x29243e,_0x4b2ab3,_0x2479a8){if(_0x4b2ab3&&_0x4b2ab3['id']&&_0x4cd479[_0x8a84('0x2d')]&&_0x4cd479[_0x8a84('0x2d')][_0x4b2ab3['id']]){_0x4cd479[_0x8a84('0x2d')][_0x4b2ab3['id']][_0x2479a8+'WaitingInteractions'][_0x29243e[_0x8a84('0x17')]['id']]={'id':_0x29243e[_0x8a84('0x29')]['id']};}};exports[_0x8a84('0x2f')]=function(_0x4aa3bb,_0x227eb6,_0xdc899,_0x1fcbb8){if(_0xdc899&&_0xdc899['id']&&_0x4aa3bb['agents']&&_0x4aa3bb[_0x8a84('0x2d')][_0xdc899['id']]){delete _0x4aa3bb[_0x8a84('0x2d')][_0xdc899['id']][_0x1fcbb8+_0x8a84('0x2e')][_0x227eb6[_0x8a84('0x17')]['id']];}};exports[_0x8a84('0x30')]=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 5eae84e..b673c8d 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 _0x8d5b=['./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate'];(function(_0x4c4854,_0x16418c){var _0x40d06a=function(_0x2efceb){while(--_0x2efceb){_0x4c4854['push'](_0x4c4854['shift']());}};_0x40d06a(++_0x16418c);}(_0x8d5b,0x19f));var _0xb8d5=function(_0x5c7055,_0x550d42){_0x5c7055=_0x5c7055-0x0;var _0x20d196=_0x8d5b[_0x5c7055];return _0x20d196;};'use strict';var schema=require(_0xb8d5('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0xb8d5('0x1'));var logger=require(_0xb8d5('0x2'))(_0xb8d5('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb8d5('0x4')}});exports[_0xb8d5('0x5')]=function(_0x1a7148,_0x41fe17){return function(_0x4ffda8){try{var _0x5eb975={'command':_0x41fe17[0x0]};var _0x3a841b=system['validate'](_0x5eb975,{'typecast':!![]});if(_0x3a841b[_0xb8d5('0x6')]){logger[_0xb8d5('0x7')](_0xb8d5('0x8'),_0x1a7148,_['map'](_0x3a841b,_0xb8d5('0x9'))[_0xb8d5('0xa')](',\x20'));logger[_0xb8d5('0xb')](_0xb8d5('0xc'),_0x1a7148);_0x4ffda8['next']();}else{var _0x2b90e3=this;var _0x54d737=utils[_0xb8d5('0xd')](_0x41fe17[0x0],this);logger[_0xb8d5('0xb')](_0xb8d5('0xe'),_0x1a7148,_0x54d737);sh[_0xb8d5('0xf')](_[_0xb8d5('0x10')](_0x54d737),function(_0x518c51,_0x53ab56){logger[_0xb8d5('0xb')](_0xb8d5('0x11'),_0x1a7148,_0x518c51);if(_0x518c51==0x0){var _0x13dcdf=_0x53ab56['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xb8d5('0x12')](_0x41fe17[0x1])||_[_0xb8d5('0x13')](_0x41fe17[0x1])){logger[_0xb8d5('0xb')](_0xb8d5('0x14'),_0x1a7148);_0x2b90e3[_0xb8d5('0x15')][_0x41fe17[0x1]]=_0x13dcdf;}else{logger[_0xb8d5('0xb')](_0xb8d5('0x16'),_0x1a7148,_0x41fe17[0x1],_0x13dcdf);_0x2b90e3[_0xb8d5('0x15')][_0x41fe17[0x1]]=_0x13dcdf;}}_0x4ffda8[_0xb8d5('0x17')]();});}}catch(_0xdd3b20){logger[_0xb8d5('0x7')](_0xb8d5('0x8'),_0x1a7148,_[_0xb8d5('0x18')](_0xdd3b20)?JSON[_0xb8d5('0x19')](_0xdd3b20):_0xdd3b20);logger[_0xb8d5('0xb')](_0xb8d5('0xc'),_0x1a7148);_0x4ffda8[_0xb8d5('0x17')]();}};}; \ No newline at end of file +var _0x644d=['../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','validate','shelljs','lodash','./utils'];(function(_0x311af0,_0x3d7beb){var _0x150bc6=function(_0x3cb85e){while(--_0x3cb85e){_0x311af0['push'](_0x311af0['shift']());}};_0x150bc6(++_0x3d7beb);}(_0x644d,0xf6));var _0xd644=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x644d[_0x12c280];return _0x3638d3;};'use strict';var schema=require(_0xd644('0x0'));var sh=require(_0xd644('0x1'));var _=require(_0xd644('0x2'));var utils=require(_0xd644('0x3'));var logger=require(_0xd644('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xd644('0x5')}});exports[_0xd644('0x6')]=function(_0x1426de,_0x5bf298){return function(_0x1c88fe){try{var _0x59f27e={'command':_0x5bf298[0x0]};var _0x15089a=system[_0xd644('0x0')](_0x59f27e,{'typecast':!![]});if(_0x15089a['length']){logger[_0xd644('0x7')](_0xd644('0x8'),_0x1426de,_[_0xd644('0x9')](_0x15089a,_0xd644('0xa'))[_0xd644('0xb')](',\x20'));logger['info'](_0xd644('0xc'),_0x1426de);_0x1c88fe['next']();}else{var _0x3a90ec=this;var _0x30c13c=utils['getMustacheRender'](_0x5bf298[0x0],this);logger[_0xd644('0xd')](_0xd644('0xe'),_0x1426de,_0x30c13c);sh[_0xd644('0xf')](_[_0xd644('0x10')](_0x30c13c),function(_0x2a9f8f,_0x3a1b35){logger[_0xd644('0xd')](_0xd644('0x11'),_0x1426de,_0x2a9f8f);if(_0x2a9f8f==0x0){var _0x558725=_0x3a1b35[_0xd644('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5bf298[0x1])||_[_0xd644('0x13')](_0x5bf298[0x1])){logger[_0xd644('0xd')](_0xd644('0x14'),_0x1426de);_0x3a90ec[_0xd644('0x15')][_0x5bf298[0x1]]=_0x558725;}else{logger['info'](_0xd644('0x16'),_0x1426de,_0x5bf298[0x1],_0x558725);_0x3a90ec[_0xd644('0x15')][_0x5bf298[0x1]]=_0x558725;}}_0x1c88fe[_0xd644('0x17')]();});}}catch(_0x471ecf){logger[_0xd644('0x7')]('[%s][SYSTEM]\x20%s',_0x1426de,_[_0xd644('0x18')](_0x471ecf)?JSON['stringify'](_0x471ecf):_0x471ecf);logger[_0xd644('0xd')](_0xd644('0xc'),_0x1426de);_0x1c88fe[_0xd644('0x17')]();}};}; \ 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 a2fc354..5877fbc 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 _0x3add=['channel','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','isObject','validate','lodash','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction'];(function(_0x1707ba,_0x516a16){var _0x343ed1=function(_0x26476d){while(--_0x26476d){_0x1707ba['push'](_0x1707ba['shift']());}};_0x343ed1(++_0x516a16);}(_0x3add,0x1b5));var _0xd3ad=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x3add[_0x4695ba];return _0x524b7d;};'use strict';var schema=require(_0xd3ad('0x0'));var _=require(_0xd3ad('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xd3ad('0x2')),'faxInteraction':require(_0xd3ad('0x3')),'whatsappInteraction':require(_0xd3ad('0x4'))};var logger=require(_0xd3ad('0x5'))(_0xd3ad('0x6'));var tag=schema({'tag':{'type':_0xd3ad('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd3ad('0x8')]=function(_0x19c65e,_0x32312f,_0x3e8463,_0x47dbcc){return function(_0x4da254){try{var _0x21169c={'tag':_0x32312f[0x0]};var _0x4d49f9=tag[_0xd3ad('0x0')](_0x21169c,{'typecast':!![]});if(_0x4d49f9[_0xd3ad('0x9')]){logger[_0xd3ad('0xa')](_0xd3ad('0xb'),_0x19c65e,_[_0xd3ad('0xc')](_0x4d49f9,_0xd3ad('0xd'))[_0xd3ad('0xe')](',\x20'));logger[_0xd3ad('0xf')](_0xd3ad('0x10'),_0x19c65e);_0x4da254[_0xd3ad('0x11')]();}else{var _0x1bb54f={'ids':[_0x32312f[0x0]]};if(rpc[_0x47dbcc['channel']+_0xd3ad('0x12')]){rpc[_0x47dbcc[_0xd3ad('0x13')]+_0xd3ad('0x12')]['addTags'](_0x47dbcc[_0xd3ad('0x14')]['id'],_0x1bb54f)['then'](function(_0x44a7b0){logger[_0xd3ad('0xf')](_0xd3ad('0x15'),_0x19c65e,_0x32312f[0x1],_0x47dbcc['channel'],_0x47dbcc['interaction']['id']);})['catch'](function(_0xeb4ef8){logger['error'](_0xd3ad('0xb'),_0x19c65e,JSON[_0xd3ad('0x16')](_0xeb4ef8));logger[_0xd3ad('0xf')](_0xd3ad('0x10'),_0x19c65e);})['finally'](function(){_0x4da254[_0xd3ad('0x11')]();});}}}catch(_0x1171b4){logger['error'](_0xd3ad('0xb'),_0x19c65e,_[_0xd3ad('0x17')](_0x1171b4)?JSON[_0xd3ad('0x16')](_0x1171b4):_0x1171b4);logger['info'](_0xd3ad('0x10'),_0x19c65e);_0x4da254[_0xd3ad('0x11')]();}};}; \ No newline at end of file +var _0x219a=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','error','stringify','finally','next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x3a3818,_0x409bfc){var _0x51fb39=function(_0x30f345){while(--_0x30f345){_0x3a3818['push'](_0x3a3818['shift']());}};_0x51fb39(++_0x409bfc);}(_0x219a,0xb7));var _0xa219=function(_0x565154,_0x189d5e){_0x565154=_0x565154-0x0;var _0x593821=_0x219a[_0x565154];return _0x593821;};'use strict';var schema=require(_0xa219('0x0'));var _=require(_0xa219('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xa219('0x2')),'smsInteraction':require(_0xa219('0x3')),'mailInteraction':require(_0xa219('0x4')),'faxInteraction':require(_0xa219('0x5')),'whatsappInteraction':require(_0xa219('0x6'))};var logger=require(_0xa219('0x7'))(_0xa219('0x8'));var tag=schema({'tag':{'type':_0xa219('0x9'),'required':!![],'message':_0xa219('0xa')}});exports[_0xa219('0xb')]=function(_0x16f781,_0x2eb76f,_0x52ed9a,_0x1d70d7){return function(_0x23db2f){try{var _0x4fe470={'tag':_0x2eb76f[0x0]};var _0x5593eb=tag['validate'](_0x4fe470,{'typecast':!![]});if(_0x5593eb[_0xa219('0xc')]){logger['error'](_0xa219('0xd'),_0x16f781,_[_0xa219('0xe')](_0x5593eb,'message')[_0xa219('0xf')](',\x20'));logger[_0xa219('0x10')](_0xa219('0x11'),_0x16f781);_0x23db2f['next']();}else{var _0x3c082f={'ids':[_0x2eb76f[0x0]]};if(rpc[_0x1d70d7[_0xa219('0x12')]+_0xa219('0x13')]){rpc[_0x1d70d7[_0xa219('0x12')]+_0xa219('0x13')][_0xa219('0x14')](_0x1d70d7[_0xa219('0x15')]['id'],_0x3c082f)[_0xa219('0x16')](function(_0x46dec7){logger[_0xa219('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x16f781,_0x2eb76f[0x1],_0x1d70d7[_0xa219('0x12')],_0x1d70d7[_0xa219('0x15')]['id']);})['catch'](function(_0x3d23cd){logger[_0xa219('0x17')](_0xa219('0xd'),_0x16f781,JSON[_0xa219('0x18')](_0x3d23cd));logger[_0xa219('0x10')](_0xa219('0x11'),_0x16f781);})[_0xa219('0x19')](function(){_0x23db2f[_0xa219('0x1a')]();});}}}catch(_0x265ad9){logger[_0xa219('0x17')](_0xa219('0xd'),_0x16f781,_['isObject'](_0x265ad9)?JSON[_0xa219('0x18')](_0x265ad9):_0x265ad9);logger[_0xa219('0x10')](_0xa219('0x11'),_0x16f781);_0x23db2f[_0xa219('0x1a')]();}};}; \ 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 8ac619c..5be4dce 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 _0x4015=['then','parse','result','logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','lodash','consequence','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','params','stringify','utf8','application/json-rpc'];(function(_0x1e2a0d,_0x496ac4){var _0x114651=function(_0x122df0){while(--_0x122df0){_0x1e2a0d['push'](_0x1e2a0d['shift']());}};_0x114651(++_0x496ac4);}(_0x4015,0x1ee));var _0x5401=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x4015[_0x50e593];return _0x3821d0;};'use strict';var rp=require(_0x5401('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x5401('0x1'));var arr=[];exports[_0x5401('0x2')]=function(_0x450c04,_0x571f82){return function(_0xf66711){var _0x40c28f=_0x571f82[0xa];var _0x5729ae=_0x571f82[0xb];var _0x520cd4=_0x571f82[0xc];var _0x133c47=_0x571f82[0xd];var _0x35b3a5=_0x571f82[0xe];var _0x37a611=_0x571f82[0xf]['replace'](/\n/g,_0x5401('0x3'));var _0x50efd0=_0x571f82[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x5401('0x4')](_0x5729ae)){arr['push'](_0x5729ae);var _0x19c616=_0x571f82[0x3];var _0x188564=_0x571f82[0x4];var _0x2906ec=_0x571f82[0x1];var _0x200392=_0x571f82[0x0];var _0x38663f={};_0x38663f[_0x5401('0x5')]=_0x571f82[0x8]+_0x5401('0x6')+_0x520cd4+'|'+_0x40c28f+'|'+_0x133c47+'|'+_0x5729ae+'|'+_0x35b3a5;_0x38663f[_0x5401('0x7')]=_0x571f82[0x7]+'?params='+_0x520cd4+'|'+_0x40c28f+'|'+_0x133c47+'|'+_0x5729ae+'|'+_0x35b3a5+'|'+_0x37a611+'|'+_0x50efd0;_0x38663f[_0x5401('0x8')]=_0x571f82[0x9];var _0x4d2b27={};_0x4d2b27[_0x5401('0x9')]=_0x5401('0xa');_0x4d2b27[_0x5401('0xb')]=_0x5401('0xc');var _0x10bd90=[];_0x10bd90[_0x5401('0xd')](_0x571f82[0x2]);_0x10bd90[_0x5401('0xd')](_0x571f82[0x5]);_0x10bd90['push'](_0x571f82[0x6]);_0x4d2b27[_0x5401('0xe')]=_0x10bd90;_0x4d2b27['id']=0x1;var _0x279cb6=JSON[_0x5401('0xf')](_0x4d2b27);var _0x5ff377={'encoding':_0x5401('0x10'),'method':'POST','timeout':0x2710,'url':_0x19c616,'headers':{'Content-Type':_0x5401('0x11')},'body':_0x279cb6};return rp(_0x5ff377)[_0x5401('0x12')](function(_0x27aeb0){const _0x1f6b93=JSON[_0x5401('0x13')](_0x27aeb0);if(!_0x1f6b93[_0x5401('0x14')][_0x5401('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1863ab=_0x5729ae;var _0x2543b4=_0x5401('0x16')+_0x2906ec+_0x5401('0x17')+_0x200392+_0x5401('0x18')+_0x1863ab+'&data='+JSON[_0x5401('0xf')](_0x38663f);var _0x4ecaed=_0x188564+'?'+_0x2543b4;return rp(_0x4ecaed);})[_0x5401('0x12')](function(_0x4b899b){logger[_0x5401('0x19')](_0x5401('0x1a'),_0x450c04,_0x4b899b);_0xf66711['stop']();})['catch'](function(_0x2b83d2){logger[_0x5401('0x1b')]('[%s][TVOX]\x20%s',_0x450c04,_[_0x5401('0x1c')](_0x2b83d2)?JSON['stringify'](_0x2b83d2):_0x2b83d2);_0xf66711[_0x5401('0x1d')]();});}else{logger['info'](_0x5401('0x1e'),_0x450c04);_0xf66711[_0x5401('0x1f')]();}};}; \ No newline at end of file +var _0x5df1=['replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login','params','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','routing','lodash','consequence'];(function(_0x4fe71a,_0xaf0c26){var _0x17d5fa=function(_0xeacb4d){while(--_0xeacb4d){_0x4fe71a['push'](_0x4fe71a['shift']());}};_0x17d5fa(++_0xaf0c26);}(_0x5df1,0xa2));var _0x15df=function(_0x53e98c,_0x56a15a){_0x53e98c=_0x53e98c-0x0;var _0x2cd1f0=_0x5df1[_0x53e98c];return _0x2cd1f0;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0x15df('0x0'));var _=require(_0x15df('0x1'));var arr=[];exports[_0x15df('0x2')]=function(_0x4c5ab0,_0x581ae8){return function(_0xa9d431){var _0x2076b2=_0x581ae8[0xa];var _0x53bbca=_0x581ae8[0xb];var _0x2d59c7=_0x581ae8[0xc];var _0x22ab27=_0x581ae8[0xd];var _0x31ee5e=_0x581ae8[0xe];var _0x139b86=_0x581ae8[0xf][_0x15df('0x3')](/\n/g,_0x15df('0x4'));var _0x3dac98=_0x581ae8[0x10][_0x15df('0x3')](/\n/g,'\x20');if(!arr[_0x15df('0x5')](_0x53bbca)){arr[_0x15df('0x6')](_0x53bbca);var _0x389942=_0x581ae8[0x3];var _0x57b158=_0x581ae8[0x4];var _0x38e034=_0x581ae8[0x1];var _0x5ec10f=_0x581ae8[0x0];var _0x35c04d={};_0x35c04d[_0x15df('0x7')]=_0x581ae8[0x8]+_0x15df('0x8')+_0x2d59c7+'|'+_0x2076b2+'|'+_0x22ab27+'|'+_0x53bbca+'|'+_0x31ee5e;_0x35c04d[_0x15df('0x9')]=_0x581ae8[0x7]+_0x15df('0x8')+_0x2d59c7+'|'+_0x2076b2+'|'+_0x22ab27+'|'+_0x53bbca+'|'+_0x31ee5e+'|'+_0x139b86+'|'+_0x3dac98;_0x35c04d[_0x15df('0xa')]=_0x581ae8[0x9];var _0x705705={};_0x705705[_0x15df('0xb')]=_0x15df('0xc');_0x705705['method']=_0x15df('0xd');var _0x507d80=[];_0x507d80[_0x15df('0x6')](_0x581ae8[0x2]);_0x507d80['push'](_0x581ae8[0x5]);_0x507d80[_0x15df('0x6')](_0x581ae8[0x6]);_0x705705[_0x15df('0xe')]=_0x507d80;_0x705705['id']=0x1;var _0x4f9b39=JSON['stringify'](_0x705705);var _0xcd7eba={'encoding':_0x15df('0xf'),'method':_0x15df('0x10'),'timeout':0x2710,'url':_0x389942,'headers':{'Content-Type':_0x15df('0x11')},'body':_0x4f9b39};return rp(_0xcd7eba)[_0x15df('0x12')](function(_0x25b619){const _0x288f69=JSON[_0x15df('0x13')](_0x25b619);if(!_0x288f69[_0x15df('0x14')][_0x15df('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xcbd73f=_0x53bbca;var _0x40e1c8=_0x15df('0x16')+_0x38e034+_0x15df('0x17')+_0x5ec10f+'&sessionId='+_0xcbd73f+'&data='+JSON[_0x15df('0x18')](_0x35c04d);var _0x5becaf=_0x57b158+'?'+_0x40e1c8;return rp(_0x5becaf);})[_0x15df('0x12')](function(_0x46c6dc){logger[_0x15df('0x19')](_0x15df('0x1a'),_0x4c5ab0,_0x46c6dc);_0xa9d431[_0x15df('0x1b')]();})[_0x15df('0x1c')](function(_0x4069e3){logger[_0x15df('0x1d')](_0x15df('0x1e'),_0x4c5ab0,_[_0x15df('0x1f')](_0x4069e3)?JSON['stringify'](_0x4069e3):_0x4069e3);_0xa9d431['stop']();});}else{logger[_0x15df('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4c5ab0);_0xa9d431[_0x15df('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 21b016c..bb7f8ff 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x4a195b,_0x53a457){var _0x18853a=function(_0x5daace){while(--_0x5daace){_0x4a195b['push'](_0x4a195b['shift']());}};_0x18853a(++_0x53a457);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x529e4b,_0x24403b){var _0x3a2d30=function(_0x18599d){while(--_0x18599d){_0x529e4b['push'](_0x529e4b['shift']());}};_0x3a2d30(++_0x24403b);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 373ad04..cf1a573 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 _0x6db4=['push','slice','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','execute','Applications\x20executed','stringify','matchPath','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','channel','mail'];(function(_0x4906ca,_0x7cb8c0){var _0x493642=function(_0x3624fa){while(--_0x3624fa){_0x4906ca['push'](_0x4906ca['shift']());}};_0x493642(++_0x7cb8c0);}(_0x6db4,0x111));var _0x46db=function(_0x409e47,_0x49e464){_0x409e47=_0x409e47-0x0;var _0x2d86db=_0x6db4[_0x409e47];return _0x2d86db;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var path=require(_0x46db('0x1'));var fs=require('fs');var jayson=require(_0x46db('0x2'));var BPromise=require(_0x46db('0x3'));var utils=require(_0x46db('0x4'));var sUtils=require(_0x46db('0x5'));var logger=require('../../../config/logger')(_0x46db('0x6'));var rpc={'openchannelQueueReport':require(_0x46db('0x7')),'mailQueueReport':require(_0x46db('0x8')),'chatQueueReport':require(_0x46db('0x9')),'smsQueueReport':require(_0x46db('0xa')),'faxQueueReport':require(_0x46db('0xb')),'whatsappQueueReport':require(_0x46db('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3a2dcb,_0x2a597d,_0x27b949){return util[_0x46db('0xd')](_0x46db('0xe'),_0x3a2dcb,_0x2a597d||0x0,_0x27b949||0x0);}function getIntervals(_0x427c62,_0x2a36f8){var _0x271c75=[];if(!_[_0x46db('0xf')](_0x2a36f8[_0x46db('0x10')])&&!_[_0x46db('0xf')](_0x427c62[_0x2a36f8[_0x46db('0x10')]])&&!_['isNil'](_0x427c62[_0x2a36f8[_0x46db('0x10')]][_0x46db('0x11')])){_0x271c75=_[_0x46db('0x12')](_0x427c62[_0x2a36f8[_0x46db('0x10')]][_0x46db('0x11')],_0x46db('0x13'));}else if(!_[_0x46db('0xf')](_0x2a36f8[_0x46db('0x13')])){_0x271c75=[_0x2a36f8[_0x46db('0x13')]];}return _0x271c75;}exports['listen']=function(_0x54b34d){_0x54b34d['rules']={};return new BPromise(function(_0x417caf,_0xed8db9){var _0x5c982c={'Start':function(_0x1a79a6){var _0x479544=this;return new Promise(function(_0x30e5a9,_0x5dccf9){if(_0x1a79a6){try{var _0x12976b=[];var _0x41a0bc=getId(_0x1a79a6['channel'],_0x1a79a6[_0x46db('0x14')]?_0x1a79a6[_0x46db('0x14')]['id']:0x0,_0x1a79a6[_0x46db('0x15')]?_0x1a79a6[_0x46db('0x15')]['id']:0x0);var _0x1e24e6=sUtils[_0x46db('0x16')](_0x54b34d,_0x1a79a6);if(_0x1a79a6[_0x46db('0x17')]||!_0x1e24e6&&_0x1a79a6[_0x46db('0x18')]&&_['isArray'](_0x1a79a6[_0x46db('0x18')])&&_0x1a79a6[_0x46db('0x18')][_0x46db('0x19')]){for(var _0x53bf89=0x0;_0x53bf89<_0x1a79a6['applications']['length'];_0x53bf89+=0x1){var _0x597a95=_0x1a79a6[_0x46db('0x18')][_0x53bf89];if(fs[_0x46db('0x1a')](path[_0x46db('0x1b')](__dirname,'applications',_0x597a95['app']+_0x46db('0x1c')))){var _0x3601e4=[];switch(_0x597a95[_0x46db('0x1d')][_0x46db('0x1e')]()){case _0x46db('0x1f'):var _0x2d3688=_0x597a95[_0x46db('0x20')][_0x46db('0x21')](',');if(_0x1a79a6[_0x46db('0x22')]===_0x46db('0x23')){_0x3601e4['push'](_0x2d3688[0x0]);_0x3601e4[_0x46db('0x24')](_0x2d3688[0x1]);_0x3601e4[_0x46db('0x24')](_0x2d3688[_0x46db('0x25')](0x2,_0x2d3688[_0x46db('0x19')])[_0x46db('0x1b')](','));}else{_0x3601e4[_0x46db('0x24')](_0x2d3688[0x0]);_0x3601e4['push'](_0x2d3688[_0x46db('0x25')](0x1,_0x2d3688[_0x46db('0x19')])[_0x46db('0x1b')](','));}break;case'dialogflow':var _0x131d75=_0x597a95[_0x46db('0x20')][_0x46db('0x21')](',');_0x3601e4[_0x46db('0x24')](_0x131d75[0x0]);_0x3601e4[_0x46db('0x24')](_0x131d75[0x1]);_0x3601e4[_0x46db('0x24')](_0x131d75[_0x46db('0x25')](0x2,_0x131d75[_0x46db('0x19')])[_0x46db('0x1b')](','));break;case _0x46db('0x26'):var _0x574f9c=_0x597a95[_0x46db('0x20')][_0x46db('0x21')](',');_0x3601e4['push'](_0x574f9c[0x0]);_0x3601e4[_0x46db('0x24')](_0x574f9c[0x1]);_0x3601e4[_0x46db('0x24')](_0x574f9c[0x2]);_0x3601e4[_0x46db('0x24')](_0x574f9c[0x3]);_0x3601e4[_0x46db('0x24')](_0x574f9c[_0x46db('0x25')](0x4,_0x574f9c[_0x46db('0x19')])[_0x46db('0x1b')](','));break;case _0x46db('0x27'):var _0x38108b=_0x597a95[_0x46db('0x20')][_0x46db('0x21')](',');_0x3601e4[_0x46db('0x24')](_0x38108b[0x0]);_0x3601e4['push'](_0x38108b[0x1]);_0x3601e4['push'](_0x38108b[0x2]);_0x3601e4[_0x46db('0x24')](_0x38108b[0x3]);_0x3601e4[_0x46db('0x24')](_0x38108b[_0x46db('0x25')](0x4,_0x38108b['length'])[_0x46db('0x1b')](','));break;case _0x46db('0x14'):_0x3601e4['push'](_0x597a95[_0x46db('0x20')]);break;case _0x46db('0x28'):_0x3601e4[_0x46db('0x24')](_0x597a95[_0x46db('0x29')]);_0x3601e4[_0x46db('0x24')](_0x597a95['appdata']);break;case'tvox':var _0x304588=utils[_0x46db('0x2a')](_0x1a79a6[_0x46db('0x2b')][_0x46db('0x2c')],_0x1a79a6);var _0x2dd421=_0x597a95['appdata'][_0x46db('0x21')](',');_0x3601e4[_0x46db('0x24')](_0x2dd421[0x0]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x1]);_0x3601e4['push'](_0x2dd421[0x2]);_0x3601e4['push'](_0x2dd421[0x3]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x4]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x5]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x6]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x7]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x8]);_0x3601e4[_0x46db('0x24')](_0x2dd421[0x9]);_0x3601e4['push'](_0x2dd421[0xa]);_0x3601e4['push'](_0x1a79a6[_0x46db('0x15')]['id']);_0x3601e4[_0x46db('0x24')](_0x1a79a6['message']['id']);_0x3601e4[_0x46db('0x24')](_0x597a95['ChatWebsiteId']);_0x3601e4[_0x46db('0x24')](_0x1a79a6['interaction'][_0x46db('0x2d')]);_0x3601e4[_0x46db('0x24')](_0x1a79a6[_0x46db('0x2e')][_0x46db('0x2e')]);_0x3601e4['push'](_0x304588);break;default:_0x3601e4=_['isNil'](_0x597a95['appdata'])?[]:_0x597a95[_0x46db('0x20')][_0x46db('0x21')](',');}var _0x3b092c={'id':util[_0x46db('0xd')]('%s:%s:%s',_0x41a0bc,_0x597a95['id'],_0x597a95[_0x46db('0x1d')]),'condition':require(_0x46db('0x2f'))[_0x46db('0x30')](_0x41a0bc,getIntervals(_0x54b34d[_0x46db('0x31')],_0x597a95),_0x54b34d),'consequence':require(_0x46db('0x32')+_0x597a95[_0x46db('0x1d')])[_0x46db('0x33')](_0x41a0bc,_0x3601e4,_0x54b34d,_0x1a79a6),'p':_0x597a95[_0x46db('0x34')]||0x0};logger[_0x46db('0x35')](_0x46db('0x36'),_0x3b092c['id'],_0x46db('0x37'),getIntervals(_0x54b34d[_0x46db('0x31')],_0x597a95)[_0x46db('0x1b')](_0x46db('0x38')));_0x12976b[_0x46db('0x24')](_0x3b092c);}else{logger[_0x46db('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x46db('0x1b')](__dirname,_0x46db('0x18'),_0x597a95[_0x46db('0x1d')]+_0x46db('0x1c')));}}_0x54b34d[_0x46db('0x3a')][_0x41a0bc]=new RuleEngine(_0x12976b);_0x54b34d['rules'][_0x41a0bc][_0x46db('0x3b')](_0x1a79a6,function(_0x107fd5){logger[_0x46db('0x35')](_0x46db('0x3c'),JSON[_0x46db('0x3d')](_0x107fd5[_0x46db('0x3e')]));if(_0x54b34d[_0x46db('0x3a')][_0x41a0bc]){_0x54b34d[_0x46db('0x3a')][_0x41a0bc]['emit']('complete');}});return _0x30e5a9({'code':0xc8,'message':_0x1a79a6});}else{if(_0x1e24e6){logger[_0x46db('0x35')](util[_0x46db('0xd')](_0x46db('0x3f'),_0x41a0bc));}else{logger[_0x46db('0x35')]('No\x20applications\x20to\x20execute');}return _0x30e5a9({'code':0xc8,'message':_0x1a79a6});}}catch(_0x46acde){logger[_0x46db('0x39')](_0x46acde[_0x46db('0x40')]);return _0x5dccf9(_0x479544[_0x46db('0x39')](0x1f4,_0x46acde));}}return _0x5dccf9(_0x46db('0x41'));});},'AcceptMessage':function(_0x193b2f){var _0x65ba95=this;return new Promise(function(_0x3d87ce,_0xb157b9){if(_0x193b2f[_0x46db('0x42')]&&_0x193b2f['agent']['id']){if(_0x54b34d[_0x46db('0x43')][_0x193b2f['agent']['id']]){_0x54b34d[_0x46db('0x43')][_0x193b2f[_0x46db('0x42')]['id']][_0x46db('0x44')]=![];_0x54b34d[_0x46db('0x43')][_0x193b2f[_0x46db('0x42')]['id']]['busyQueue']=undefined;}}if(_0x193b2f[_0x46db('0x14')]&&_0x193b2f[_0x46db('0x14')]['id']){try{var _0x523aa2=getId(_0x193b2f[_0x46db('0x22')],_0x193b2f[_0x46db('0x14')]?_0x193b2f['message']['id']:0x0,_0x193b2f[_0x46db('0x15')]?_0x193b2f[_0x46db('0x15')]['id']:0x0);if(_0x54b34d['rules'][_0x523aa2]){_0x54b34d['rules'][_0x523aa2]['emit']('end');if(rpc[_0x193b2f[_0x46db('0x22')]+'QueueReport']){rpc[_0x193b2f[_0x46db('0x22')]+_0x46db('0x45')][_0x46db('0x46')](_0x523aa2,{'UserId':_0x193b2f['message'][_0x46db('0x47')]})[_0x46db('0x48')](function(){logger[_0x46db('0x39')](_0x46db('0x49'));});}}return _0x3d87ce({'code':0xc8,'message':_0x193b2f});}catch(_0x4b4ee3){logger[_0x46db('0x39')](_0x4b4ee3[_0x46db('0x40')]);return _0xb157b9(_0x65ba95['error'](0x1f4,_0x4b4ee3));}}logger['error']('message\x20is\x20empty');return _0xb157b9(_0x65ba95[_0x46db('0x39')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x200fd1){var _0x40d633=this;return new Promise(function(_0x80c535,_0x5adbce){if(_0x200fd1[_0x46db('0x42')]&&_0x200fd1[_0x46db('0x42')]['id']){try{if(_0x54b34d[_0x46db('0x43')][_0x200fd1[_0x46db('0x42')]['id']]){_0x54b34d[_0x46db('0x43')][_0x200fd1['agent']['id']][_0x46db('0x44')]=![];_0x54b34d['agents'][_0x200fd1[_0x46db('0x42')]['id']]['busyQueue']=undefined;}return _0x80c535({'code':0xc8,'message':_0x200fd1});}catch(_0x251da5){logger[_0x46db('0x39')](_0x251da5[_0x46db('0x40')]);return _0x5adbce(_0x40d633[_0x46db('0x39')](0x1f4,_0x251da5));}}logger['error'](_0x46db('0x4a'));return _0x5adbce(_0x40d633[_0x46db('0x39')](0x1f4,_0x46db('0x4a')));});},'AbandonInteraction':function(_0x50b590){var _0x5e9693=this;return new Promise(function(_0x219ae3,_0x3370d1){if(_0x50b590['channel']&&_0x50b590['interaction']&&_0x50b590[_0x46db('0x15')]['id']){try{var _0x982ccf=getId(_0x50b590[_0x46db('0x22')],_0x50b590[_0x46db('0x14')]?_0x50b590['message']['id']:0x0,_0x50b590[_0x46db('0x15')]?_0x50b590[_0x46db('0x15')]['id']:0x0);if(_0x54b34d[_0x46db('0x3a')][_0x982ccf]){_0x54b34d['rules'][_0x982ccf][_0x46db('0x4b')]('end');}return _0x219ae3({'code':0xc8,'message':_0x50b590});}catch(_0x5082c0){logger[_0x46db('0x39')](_0x5082c0[_0x46db('0x40')]);return _0x3370d1(_0x5e9693[_0x46db('0x39')](0x1f4,_0x5082c0));}}logger[_0x46db('0x39')](_0x46db('0x4a'));return _0x3370d1(_0x5e9693[_0x46db('0x39')](0x1f4,_0x46db('0x4a')));});},'AgentCapacity':function(_0x92438c){var _0x434434=this;return new Promise(function(_0x5c5826,_0x48ee68){if(_0x54b34d['agents']['hasOwnProperty'](_0x92438c['id'])){for(var _0x37243d in _0x92438c[_0x46db('0x4c')]){if(_0x92438c[_0x46db('0x4c')][_0x46db('0x4d')](_0x37243d)){if(_0x54b34d['agents'][_0x92438c['id']][_0x46db('0x4d')](_0x37243d+_0x46db('0x4e'))){_0x54b34d['agents'][_0x92438c['id']][_0x37243d+_0x46db('0x4e')]=parseInt(_0x92438c[_0x46db('0x4c')][_0x37243d],0xa);}}}_0x54b34d[_0x46db('0x43')][_0x92438c['id']][_0x46db('0x4f')]();return _0x5c5826({'code':0xc8,'message':_0x54b34d[_0x46db('0x43')][_0x92438c['id']]});}else{return _0x48ee68(_0x434434['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x31363a){return new Promise(function(_0x627ea8){var _0x3e8ff1=_[_0x46db('0x50')](_0x54b34d[_0x46db('0x43')]);if(_0x31363a&&_0x31363a['id']){var _0x52e182=_[_0x46db('0x51')](_0x3e8ff1,function(_0x162e50){return _0x162e50['id']===_0x31363a['id'];});_0x627ea8(_0x52e182);}else{_0x627ea8({'count':_0x3e8ff1[_0x46db('0x19')],'rows':_0x3e8ff1});}});},'ChatQueues':function(){return new Promise(function(_0x16ebe0){var _0x57cd6d=[];for(var _0x428a6a in _0x54b34d[_0x46db('0x52')]){if(_0x54b34d[_0x46db('0x52')][_0x46db('0x4d')](_0x428a6a)){var _0x416f84=_0x54b34d['chatQueues'][_0x428a6a];var _0x3530c3={'id':_0x416f84['id'],'available':_0x416f84[_0x46db('0x53')],'loggedIn':_0x416f84[_0x46db('0x54')],'name':_0x416f84[_0x46db('0x55')],'paused':_0x416f84[_0x46db('0x56')],'waiting':_0x416f84[_0x46db('0x57')]};_0x57cd6d[_0x46db('0x24')](_0x3530c3);}}_0x16ebe0({'count':_0x57cd6d['length'],'rows':_0x57cd6d});});},'MailQueues':function(){return new Promise(function(_0x41c2de){var _0x1535fb=[];for(var _0xd5ffb in _0x54b34d[_0x46db('0x58')]){if(_0x54b34d['mailQueues']['hasOwnProperty'](_0xd5ffb)){var _0x4ac1c2=_0x54b34d['mailQueues'][_0xd5ffb];var _0x11e38f={'id':_0x4ac1c2['id'],'available':_0x4ac1c2[_0x46db('0x53')],'loggedIn':_0x4ac1c2[_0x46db('0x54')],'name':_0x4ac1c2[_0x46db('0x55')],'paused':_0x4ac1c2[_0x46db('0x56')],'waiting':_0x4ac1c2[_0x46db('0x57')]};_0x1535fb['push'](_0x11e38f);}}_0x41c2de({'count':_0x1535fb[_0x46db('0x19')],'rows':_0x1535fb});});},'OpenchannelQueues':function(){return new Promise(function(_0x2013e4){var _0x56f4c8=[];for(var _0x337bb3 in _0x54b34d['openchannelQueues']){if(_0x54b34d[_0x46db('0x59')]['hasOwnProperty'](_0x337bb3)){var _0x337d9a=_0x54b34d[_0x46db('0x59')][_0x337bb3];var _0x3bd0f4={'id':_0x337d9a['id'],'available':_0x337d9a[_0x46db('0x53')],'loggedIn':_0x337d9a['loggedIn'],'name':_0x337d9a[_0x46db('0x55')],'paused':_0x337d9a[_0x46db('0x56')],'waiting':_0x337d9a['waiting']};_0x56f4c8[_0x46db('0x24')](_0x3bd0f4);}}_0x2013e4({'count':_0x56f4c8['length'],'rows':_0x56f4c8});});},'SmsQueues':function(){return new Promise(function(_0xe35119){var _0x4f20b6=[];for(var _0x3851a8 in _0x54b34d[_0x46db('0x5a')]){if(_0x54b34d[_0x46db('0x5a')][_0x46db('0x4d')](_0x3851a8)){var _0x3e3a7b=_0x54b34d[_0x46db('0x5a')][_0x3851a8];var _0x271687={'id':_0x3e3a7b['id'],'available':_0x3e3a7b[_0x46db('0x53')],'loggedIn':_0x3e3a7b[_0x46db('0x54')],'name':_0x3e3a7b[_0x46db('0x55')],'paused':_0x3e3a7b[_0x46db('0x56')],'waiting':_0x3e3a7b[_0x46db('0x57')]};_0x4f20b6['push'](_0x271687);}}_0xe35119({'count':_0x4f20b6[_0x46db('0x19')],'rows':_0x4f20b6});});},'FaxQueues':function(){return new Promise(function(_0x480f62){var _0x392ef2=[];for(var _0x4a65e7 in _0x54b34d[_0x46db('0x5b')]){if(_0x54b34d[_0x46db('0x5b')][_0x46db('0x4d')](_0x4a65e7)){var _0xef9f7b=_0x54b34d[_0x46db('0x5b')][_0x4a65e7];var _0x21a1ab={'id':_0xef9f7b['id'],'available':_0xef9f7b[_0x46db('0x53')],'loggedIn':_0xef9f7b[_0x46db('0x54')],'name':_0xef9f7b[_0x46db('0x55')],'paused':_0xef9f7b[_0x46db('0x56')],'waiting':_0xef9f7b[_0x46db('0x57')]};_0x392ef2[_0x46db('0x24')](_0x21a1ab);}}_0x480f62({'count':_0x392ef2[_0x46db('0x19')],'rows':_0x392ef2});});},'WhatsappQueues':function(){return new Promise(function(_0x2e84af){var _0x20f913=[];for(var _0x49640a in _0x54b34d['whatsappQueues']){if(_0x54b34d[_0x46db('0x5c')][_0x46db('0x4d')](_0x49640a)){var _0x5564bd=_0x54b34d[_0x46db('0x5c')][_0x49640a];var _0x4b3cfa={'id':_0x5564bd['id'],'available':_0x5564bd[_0x46db('0x53')],'loggedIn':_0x5564bd[_0x46db('0x54')],'name':_0x5564bd[_0x46db('0x55')],'paused':_0x5564bd['paused'],'waiting':_0x5564bd['waiting']};_0x20f913[_0x46db('0x24')](_0x4b3cfa);}}_0x2e84af({'count':_0x20f913[_0x46db('0x19')],'rows':_0x20f913});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x45a16e){var _0x1903be=_[_0x46db('0x50')](_0x54b34d[_0x46db('0x5d')]);_0x45a16e({'count':_0x1903be[_0x46db('0x19')],'rows':_0x1903be});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x70c18f){var _0x44306f=_[_0x46db('0x50')](_0x54b34d[_0x46db('0x5e')]);_0x70c18f({'count':_0x44306f['length'],'rows':_0x44306f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xbe99ac){var _0x593daf=_[_0x46db('0x50')](_0x54b34d[_0x46db('0x5f')]);_0xbe99ac({'count':_0x593daf[_0x46db('0x19')],'rows':_0x593daf});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x46a4fa){var _0x3bf33=_['values'](_0x54b34d[_0x46db('0x60')]);_0x46a4fa({'count':_0x3bf33[_0x46db('0x19')],'rows':_0x3bf33});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x24e595){var _0x223539=_[_0x46db('0x50')](_0x54b34d[_0x46db('0x61')]);_0x24e595({'count':_0x223539[_0x46db('0x19')],'rows':_0x223539});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x326ac2){var _0x5ef702=_[_0x46db('0x50')](_0x54b34d[_0x46db('0x62')]);_0x326ac2({'count':_0x5ef702[_0x46db('0x19')],'rows':_0x5ef702});});}};var _0x1453cd=jayson[_0x46db('0x63')](_0x5c982c)['http']();_0x1453cd['on'](_0x46db('0x39'),function(_0x8fb433){logger[_0x46db('0x39')](JSON[_0x46db('0x3d')](_0x8fb433));return _0xed8db9(_0x8fb433);});_0x1453cd[_0x46db('0x64')](0x232c,'127.0.0.1',function(){console['log'](_0x46db('0x65'),0x232c);return _0x417caf(_0x46db('0x66')+0x232c);});});}; \ No newline at end of file +var _0xc429=['./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','RPC\x20listening\x20on\x20port:','lodash','path','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','transfer','applications','join','app','autoreply','appdata','split','mail','push','slice','length','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','condition'];(function(_0x58d580,_0x4c8f86){var _0x3c096c=function(_0x1385cf){while(--_0x1385cf){_0x58d580['push'](_0x58d580['shift']());}};_0x3c096c(++_0x4c8f86);}(_0xc429,0x1ba));var _0x9c42=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xc429[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x9c42('0x0'));var util=require('util');var path=require(_0x9c42('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x9c42('0x2'));var sUtils=require(_0x9c42('0x3'));var logger=require(_0x9c42('0x4'))(_0x9c42('0x5'));var rpc={'openchannelQueueReport':require(_0x9c42('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9c42('0x7')),'faxQueueReport':require(_0x9c42('0x8')),'whatsappQueueReport':require(_0x9c42('0x9'))};var RuleEngine=require(_0x9c42('0xa'));function getId(_0xcf40c2,_0x28d46e,_0x61614){return util[_0x9c42('0xb')](_0x9c42('0xc'),_0xcf40c2,_0x28d46e||0x0,_0x61614||0x0);}function getIntervals(_0x2541a2,_0xfe2de6){var _0x4fef1e=[];if(!_[_0x9c42('0xd')](_0xfe2de6['IntervalId'])&&!_[_0x9c42('0xd')](_0x2541a2[_0xfe2de6['IntervalId']])&&!_[_0x9c42('0xd')](_0x2541a2[_0xfe2de6[_0x9c42('0xe')]]['Intervals'])){_0x4fef1e=_[_0x9c42('0xf')](_0x2541a2[_0xfe2de6[_0x9c42('0xe')]][_0x9c42('0x10')],'interval');}else if(!_[_0x9c42('0xd')](_0xfe2de6[_0x9c42('0x11')])){_0x4fef1e=[_0xfe2de6[_0x9c42('0x11')]];}return _0x4fef1e;}exports['listen']=function(_0x3af9ae){_0x3af9ae['rules']={};return new BPromise(function(_0x50cd2e,_0x44e8ff){var _0x1d4208={'Start':function(_0x5ec8b1){var _0x1f484b=this;return new Promise(function(_0xc6a1f3,_0x33f8ca){if(_0x5ec8b1){try{var _0x1a2fba=[];var _0x43507e=getId(_0x5ec8b1[_0x9c42('0x12')],_0x5ec8b1[_0x9c42('0x13')]?_0x5ec8b1['message']['id']:0x0,_0x5ec8b1[_0x9c42('0x14')]?_0x5ec8b1['interaction']['id']:0x0);var _0x47f2fc=sUtils['checkWaitingNotifications'](_0x3af9ae,_0x5ec8b1);if(_0x5ec8b1[_0x9c42('0x15')]||!_0x47f2fc&&_0x5ec8b1[_0x9c42('0x16')]&&_['isArray'](_0x5ec8b1[_0x9c42('0x16')])&&_0x5ec8b1[_0x9c42('0x16')]['length']){for(var _0xc9b5c7=0x0;_0xc9b5c7<_0x5ec8b1[_0x9c42('0x16')]['length'];_0xc9b5c7+=0x1){var _0x4f686f=_0x5ec8b1[_0x9c42('0x16')][_0xc9b5c7];if(fs['existsSync'](path[_0x9c42('0x17')](__dirname,_0x9c42('0x16'),_0x4f686f[_0x9c42('0x18')]+'.js'))){var _0x467ec3=[];switch(_0x4f686f[_0x9c42('0x18')]['toLowerCase']()){case _0x9c42('0x19'):var _0x544d2d=_0x4f686f[_0x9c42('0x1a')][_0x9c42('0x1b')](',');if(_0x5ec8b1[_0x9c42('0x12')]===_0x9c42('0x1c')){_0x467ec3[_0x9c42('0x1d')](_0x544d2d[0x0]);_0x467ec3[_0x9c42('0x1d')](_0x544d2d[0x1]);_0x467ec3[_0x9c42('0x1d')](_0x544d2d[_0x9c42('0x1e')](0x2,_0x544d2d['length'])['join'](','));}else{_0x467ec3[_0x9c42('0x1d')](_0x544d2d[0x0]);_0x467ec3[_0x9c42('0x1d')](_0x544d2d[_0x9c42('0x1e')](0x1,_0x544d2d[_0x9c42('0x1f')])[_0x9c42('0x17')](','));}break;case'dialogflow':var _0x17f3f7=_0x4f686f['appdata'][_0x9c42('0x1b')](',');_0x467ec3[_0x9c42('0x1d')](_0x17f3f7[0x0]);_0x467ec3[_0x9c42('0x1d')](_0x17f3f7[0x1]);_0x467ec3[_0x9c42('0x1d')](_0x17f3f7['slice'](0x2,_0x17f3f7[_0x9c42('0x1f')])[_0x9c42('0x17')](','));break;case _0x9c42('0x20'):var _0x19abff=_0x4f686f[_0x9c42('0x1a')][_0x9c42('0x1b')](',');_0x467ec3[_0x9c42('0x1d')](_0x19abff[0x0]);_0x467ec3[_0x9c42('0x1d')](_0x19abff[0x1]);_0x467ec3[_0x9c42('0x1d')](_0x19abff[0x2]);_0x467ec3['push'](_0x19abff[0x3]);_0x467ec3['push'](_0x19abff[_0x9c42('0x1e')](0x4,_0x19abff[_0x9c42('0x1f')])[_0x9c42('0x17')](','));break;case _0x9c42('0x21'):var _0x153d5c=_0x4f686f['appdata'][_0x9c42('0x1b')](',');_0x467ec3[_0x9c42('0x1d')](_0x153d5c[0x0]);_0x467ec3[_0x9c42('0x1d')](_0x153d5c[0x1]);_0x467ec3[_0x9c42('0x1d')](_0x153d5c[0x2]);_0x467ec3[_0x9c42('0x1d')](_0x153d5c[0x3]);_0x467ec3[_0x9c42('0x1d')](_0x153d5c[_0x9c42('0x1e')](0x4,_0x153d5c[_0x9c42('0x1f')])[_0x9c42('0x17')](','));break;case _0x9c42('0x13'):_0x467ec3[_0x9c42('0x1d')](_0x4f686f[_0x9c42('0x1a')]);break;case _0x9c42('0x22'):_0x467ec3[_0x9c42('0x1d')](_0x4f686f[_0x9c42('0x23')]);_0x467ec3[_0x9c42('0x1d')](_0x4f686f[_0x9c42('0x1a')]);break;case'tvox':var _0x206ba2=utils[_0x9c42('0x24')](_0x5ec8b1[_0x9c42('0x25')][_0x9c42('0x26')],_0x5ec8b1);var _0x1373b8=_0x4f686f['appdata'][_0x9c42('0x1b')](',');_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0x0]);_0x467ec3['push'](_0x1373b8[0x1]);_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0x2]);_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0x3]);_0x467ec3['push'](_0x1373b8[0x4]);_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0x5]);_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0x6]);_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0x7]);_0x467ec3['push'](_0x1373b8[0x8]);_0x467ec3['push'](_0x1373b8[0x9]);_0x467ec3[_0x9c42('0x1d')](_0x1373b8[0xa]);_0x467ec3['push'](_0x5ec8b1[_0x9c42('0x14')]['id']);_0x467ec3[_0x9c42('0x1d')](_0x5ec8b1[_0x9c42('0x13')]['id']);_0x467ec3[_0x9c42('0x1d')](_0x4f686f[_0x9c42('0x27')]);_0x467ec3[_0x9c42('0x1d')](_0x5ec8b1[_0x9c42('0x14')][_0x9c42('0x28')]);_0x467ec3[_0x9c42('0x1d')](_0x5ec8b1[_0x9c42('0x29')][_0x9c42('0x29')]);_0x467ec3['push'](_0x206ba2);break;default:_0x467ec3=_[_0x9c42('0xd')](_0x4f686f[_0x9c42('0x1a')])?[]:_0x4f686f[_0x9c42('0x1a')][_0x9c42('0x1b')](',');}var _0x55c322={'id':util[_0x9c42('0xb')]('%s:%s:%s',_0x43507e,_0x4f686f['id'],_0x4f686f[_0x9c42('0x18')]),'condition':require('./interval')[_0x9c42('0x2a')](_0x43507e,getIntervals(_0x3af9ae['intervals'],_0x4f686f),_0x3af9ae),'consequence':require(_0x9c42('0x2b')+_0x4f686f['app'])['consequence'](_0x43507e,_0x467ec3,_0x3af9ae,_0x5ec8b1),'p':_0x4f686f[_0x9c42('0x2c')]||0x0};logger[_0x9c42('0x2d')](_0x9c42('0x2e'),_0x55c322['id'],_0x9c42('0x2f'),getIntervals(_0x3af9ae[_0x9c42('0x30')],_0x4f686f)[_0x9c42('0x17')]('\x20|\x20'));_0x1a2fba[_0x9c42('0x1d')](_0x55c322);}else{logger[_0x9c42('0x31')](_0x9c42('0x32'),path[_0x9c42('0x17')](__dirname,_0x9c42('0x16'),_0x4f686f[_0x9c42('0x18')]+'.js'));}}_0x3af9ae[_0x9c42('0x33')][_0x43507e]=new RuleEngine(_0x1a2fba);_0x3af9ae[_0x9c42('0x33')][_0x43507e][_0x9c42('0x34')](_0x5ec8b1,function(_0xa918e6){logger['info'](_0x9c42('0x35'),JSON[_0x9c42('0x36')](_0xa918e6[_0x9c42('0x37')]));if(_0x3af9ae['rules'][_0x43507e]){_0x3af9ae[_0x9c42('0x33')][_0x43507e][_0x9c42('0x38')](_0x9c42('0x39'));}});return _0xc6a1f3({'code':0xc8,'message':_0x5ec8b1});}else{if(_0x47f2fc){logger[_0x9c42('0x2d')](util[_0x9c42('0xb')](_0x9c42('0x3a'),_0x43507e));}else{logger[_0x9c42('0x2d')]('No\x20applications\x20to\x20execute');}return _0xc6a1f3({'code':0xc8,'message':_0x5ec8b1});}}catch(_0x32415d){logger[_0x9c42('0x31')](_0x32415d[_0x9c42('0x3b')]);return _0x33f8ca(_0x1f484b[_0x9c42('0x31')](0x1f4,_0x32415d));}}return _0x33f8ca('routing\x20is\x20empty');});},'AcceptMessage':function(_0x1b46f4){var _0x49c18e=this;return new Promise(function(_0x55bdb3,_0x4ec82a){if(_0x1b46f4[_0x9c42('0x3c')]&&_0x1b46f4['agent']['id']){if(_0x3af9ae[_0x9c42('0x3d')][_0x1b46f4[_0x9c42('0x3c')]['id']]){_0x3af9ae[_0x9c42('0x3d')][_0x1b46f4['agent']['id']][_0x9c42('0x3e')]=![];_0x3af9ae[_0x9c42('0x3d')][_0x1b46f4[_0x9c42('0x3c')]['id']][_0x9c42('0x3f')]=undefined;}}if(_0x1b46f4['message']&&_0x1b46f4[_0x9c42('0x13')]['id']){try{var _0x586b62=getId(_0x1b46f4['channel'],_0x1b46f4[_0x9c42('0x13')]?_0x1b46f4[_0x9c42('0x13')]['id']:0x0,_0x1b46f4[_0x9c42('0x14')]?_0x1b46f4[_0x9c42('0x14')]['id']:0x0);if(_0x3af9ae[_0x9c42('0x33')][_0x586b62]){_0x3af9ae[_0x9c42('0x33')][_0x586b62][_0x9c42('0x38')]('end');if(rpc[_0x1b46f4['channel']+_0x9c42('0x40')]){rpc[_0x1b46f4[_0x9c42('0x12')]+_0x9c42('0x40')][_0x9c42('0x41')](_0x586b62,{'UserId':_0x1b46f4[_0x9c42('0x13')][_0x9c42('0x42')]})[_0x9c42('0x43')](function(){logger[_0x9c42('0x31')](_0x9c42('0x44'));});}}return _0x55bdb3({'code':0xc8,'message':_0x1b46f4});}catch(_0x523753){logger[_0x9c42('0x31')](_0x523753[_0x9c42('0x3b')]);return _0x4ec82a(_0x49c18e[_0x9c42('0x31')](0x1f4,_0x523753));}}logger[_0x9c42('0x31')](_0x9c42('0x45'));return _0x4ec82a(_0x49c18e[_0x9c42('0x31')](0x1f4,_0x9c42('0x45')));});},'RejectMessage':function(_0x48722c){var _0x5d35e2=this;return new Promise(function(_0x1536b1,_0x45c937){if(_0x48722c['agent']&&_0x48722c[_0x9c42('0x3c')]['id']){try{if(_0x3af9ae[_0x9c42('0x3d')][_0x48722c[_0x9c42('0x3c')]['id']]){_0x3af9ae[_0x9c42('0x3d')][_0x48722c[_0x9c42('0x3c')]['id']][_0x9c42('0x3e')]=![];_0x3af9ae[_0x9c42('0x3d')][_0x48722c[_0x9c42('0x3c')]['id']][_0x9c42('0x3f')]=undefined;}return _0x1536b1({'code':0xc8,'message':_0x48722c});}catch(_0x2dae72){logger['error'](_0x2dae72['stack']);return _0x45c937(_0x5d35e2['error'](0x1f4,_0x2dae72));}}logger['error'](_0x9c42('0x45'));return _0x45c937(_0x5d35e2['error'](0x1f4,_0x9c42('0x45')));});},'AbandonInteraction':function(_0x251eac){var _0x1dda93=this;return new Promise(function(_0x27260a,_0x5e7e27){if(_0x251eac[_0x9c42('0x12')]&&_0x251eac['interaction']&&_0x251eac[_0x9c42('0x14')]['id']){try{var _0xce636e=getId(_0x251eac[_0x9c42('0x12')],_0x251eac[_0x9c42('0x13')]?_0x251eac[_0x9c42('0x13')]['id']:0x0,_0x251eac[_0x9c42('0x14')]?_0x251eac['interaction']['id']:0x0);if(_0x3af9ae['rules'][_0xce636e]){_0x3af9ae[_0x9c42('0x33')][_0xce636e][_0x9c42('0x38')](_0x9c42('0x46'));}return _0x27260a({'code':0xc8,'message':_0x251eac});}catch(_0x3b458c){logger['error'](_0x3b458c[_0x9c42('0x3b')]);return _0x5e7e27(_0x1dda93[_0x9c42('0x31')](0x1f4,_0x3b458c));}}logger['error'](_0x9c42('0x45'));return _0x5e7e27(_0x1dda93['error'](0x1f4,_0x9c42('0x45')));});},'AgentCapacity':function(_0x54754f){var _0x5c25b4=this;return new Promise(function(_0x80367,_0x4890b1){if(_0x3af9ae[_0x9c42('0x3d')]['hasOwnProperty'](_0x54754f['id'])){for(var _0x5e3130 in _0x54754f[_0x9c42('0x47')]){if(_0x54754f[_0x9c42('0x47')][_0x9c42('0x48')](_0x5e3130)){if(_0x3af9ae['agents'][_0x54754f['id']][_0x9c42('0x48')](_0x5e3130+_0x9c42('0x49'))){_0x3af9ae['agents'][_0x54754f['id']][_0x5e3130+_0x9c42('0x49')]=parseInt(_0x54754f[_0x9c42('0x47')][_0x5e3130],0xa);}}}_0x3af9ae[_0x9c42('0x3d')][_0x54754f['id']][_0x9c42('0x4a')]();return _0x80367({'code':0xc8,'message':_0x3af9ae[_0x9c42('0x3d')][_0x54754f['id']]});}else{return _0x4890b1(_0x5c25b4['error'](0x1f4,_0x9c42('0x4b')));}});},'Agents':function(_0x4c9ae5){return new Promise(function(_0x53de3e){var _0x274b0d=_[_0x9c42('0x4c')](_0x3af9ae['agents']);if(_0x4c9ae5&&_0x4c9ae5['id']){var _0x5eb39a=_['find'](_0x274b0d,function(_0x42bf32){return _0x42bf32['id']===_0x4c9ae5['id'];});_0x53de3e(_0x5eb39a);}else{_0x53de3e({'count':_0x274b0d[_0x9c42('0x1f')],'rows':_0x274b0d});}});},'ChatQueues':function(){return new Promise(function(_0x5cb9c2){var _0x141c8e=[];for(var _0x457ac7 in _0x3af9ae[_0x9c42('0x4d')]){if(_0x3af9ae[_0x9c42('0x4d')]['hasOwnProperty'](_0x457ac7)){var _0x4a798a=_0x3af9ae[_0x9c42('0x4d')][_0x457ac7];var _0x32464a={'id':_0x4a798a['id'],'available':_0x4a798a[_0x9c42('0x4e')],'loggedIn':_0x4a798a[_0x9c42('0x4f')],'name':_0x4a798a[_0x9c42('0x50')],'paused':_0x4a798a[_0x9c42('0x51')],'waiting':_0x4a798a[_0x9c42('0x52')]};_0x141c8e[_0x9c42('0x1d')](_0x32464a);}}_0x5cb9c2({'count':_0x141c8e[_0x9c42('0x1f')],'rows':_0x141c8e});});},'MailQueues':function(){return new Promise(function(_0x4a7c97){var _0x204b5a=[];for(var _0xa939fb in _0x3af9ae['mailQueues']){if(_0x3af9ae['mailQueues'][_0x9c42('0x48')](_0xa939fb)){var _0x31b595=_0x3af9ae[_0x9c42('0x53')][_0xa939fb];var _0x11e0bd={'id':_0x31b595['id'],'available':_0x31b595[_0x9c42('0x4e')],'loggedIn':_0x31b595['loggedIn'],'name':_0x31b595[_0x9c42('0x50')],'paused':_0x31b595[_0x9c42('0x51')],'waiting':_0x31b595[_0x9c42('0x52')]};_0x204b5a[_0x9c42('0x1d')](_0x11e0bd);}}_0x4a7c97({'count':_0x204b5a[_0x9c42('0x1f')],'rows':_0x204b5a});});},'OpenchannelQueues':function(){return new Promise(function(_0x52c499){var _0x5f3e19=[];for(var _0x14326e in _0x3af9ae[_0x9c42('0x54')]){if(_0x3af9ae[_0x9c42('0x54')][_0x9c42('0x48')](_0x14326e)){var _0x543dbe=_0x3af9ae['openchannelQueues'][_0x14326e];var _0x520ead={'id':_0x543dbe['id'],'available':_0x543dbe[_0x9c42('0x4e')],'loggedIn':_0x543dbe[_0x9c42('0x4f')],'name':_0x543dbe['name'],'paused':_0x543dbe[_0x9c42('0x51')],'waiting':_0x543dbe['waiting']};_0x5f3e19[_0x9c42('0x1d')](_0x520ead);}}_0x52c499({'count':_0x5f3e19[_0x9c42('0x1f')],'rows':_0x5f3e19});});},'SmsQueues':function(){return new Promise(function(_0x520967){var _0x1ad694=[];for(var _0x442d96 in _0x3af9ae[_0x9c42('0x55')]){if(_0x3af9ae[_0x9c42('0x55')][_0x9c42('0x48')](_0x442d96)){var _0x5bc947=_0x3af9ae[_0x9c42('0x55')][_0x442d96];var _0x31fb35={'id':_0x5bc947['id'],'available':_0x5bc947[_0x9c42('0x4e')],'loggedIn':_0x5bc947[_0x9c42('0x4f')],'name':_0x5bc947['name'],'paused':_0x5bc947[_0x9c42('0x51')],'waiting':_0x5bc947[_0x9c42('0x52')]};_0x1ad694['push'](_0x31fb35);}}_0x520967({'count':_0x1ad694[_0x9c42('0x1f')],'rows':_0x1ad694});});},'FaxQueues':function(){return new Promise(function(_0xd231b8){var _0x4dc6d6=[];for(var _0x3de1e8 in _0x3af9ae[_0x9c42('0x56')]){if(_0x3af9ae['faxQueues'][_0x9c42('0x48')](_0x3de1e8)){var _0x5c890e=_0x3af9ae[_0x9c42('0x56')][_0x3de1e8];var _0x2c8543={'id':_0x5c890e['id'],'available':_0x5c890e[_0x9c42('0x4e')],'loggedIn':_0x5c890e[_0x9c42('0x4f')],'name':_0x5c890e[_0x9c42('0x50')],'paused':_0x5c890e[_0x9c42('0x51')],'waiting':_0x5c890e[_0x9c42('0x52')]};_0x4dc6d6['push'](_0x2c8543);}}_0xd231b8({'count':_0x4dc6d6[_0x9c42('0x1f')],'rows':_0x4dc6d6});});},'WhatsappQueues':function(){return new Promise(function(_0x41b03b){var _0x23e368=[];for(var _0x2a38d5 in _0x3af9ae[_0x9c42('0x57')]){if(_0x3af9ae[_0x9c42('0x57')][_0x9c42('0x48')](_0x2a38d5)){var _0x3c1fbd=_0x3af9ae[_0x9c42('0x57')][_0x2a38d5];var _0xcbe7e0={'id':_0x3c1fbd['id'],'available':_0x3c1fbd[_0x9c42('0x4e')],'loggedIn':_0x3c1fbd[_0x9c42('0x4f')],'name':_0x3c1fbd[_0x9c42('0x50')],'paused':_0x3c1fbd[_0x9c42('0x51')],'waiting':_0x3c1fbd[_0x9c42('0x52')]};_0x23e368[_0x9c42('0x1d')](_0xcbe7e0);}}_0x41b03b({'count':_0x23e368[_0x9c42('0x1f')],'rows':_0x23e368});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2c90d6){var _0x2f9b21=_['values'](_0x3af9ae[_0x9c42('0x58')]);_0x2c90d6({'count':_0x2f9b21[_0x9c42('0x1f')],'rows':_0x2f9b21});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4c4271){var _0x200bfd=_[_0x9c42('0x4c')](_0x3af9ae[_0x9c42('0x59')]);_0x4c4271({'count':_0x200bfd[_0x9c42('0x1f')],'rows':_0x200bfd});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1e8a9a){var _0x5b07f7=_[_0x9c42('0x4c')](_0x3af9ae[_0x9c42('0x5a')]);_0x1e8a9a({'count':_0x5b07f7[_0x9c42('0x1f')],'rows':_0x5b07f7});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1f82de){var _0x129248=_[_0x9c42('0x4c')](_0x3af9ae['smsQueuesWaitingInteractions']);_0x1f82de({'count':_0x129248[_0x9c42('0x1f')],'rows':_0x129248});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4dbd3c){var _0x37605d=_[_0x9c42('0x4c')](_0x3af9ae['faxQueuesWaitingInteractions']);_0x4dbd3c({'count':_0x37605d['length'],'rows':_0x37605d});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5ef470){var _0x56b071=_['values'](_0x3af9ae[_0x9c42('0x5b')]);_0x5ef470({'count':_0x56b071['length'],'rows':_0x56b071});});}};var _0x419a10=jayson[_0x9c42('0x5c')](_0x1d4208)[_0x9c42('0x5d')]();_0x419a10['on'](_0x9c42('0x31'),function(_0x4d5477){logger[_0x9c42('0x31')](JSON[_0x9c42('0x36')](_0x4d5477));return _0x44e8ff(_0x4d5477);});_0x419a10[_0x9c42('0x5e')](0x232c,'127.0.0.1',function(){console[_0x9c42('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x50cd2e(_0x9c42('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d130988..a2162c7 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 _0x76e7=['error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','then','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0x76e7,0x14c));var _0x776e=function(_0x229ba7,_0x23aff8){_0x229ba7=_0x229ba7-0x0;var _0x5bae2c=_0x76e7[_0x229ba7];return _0x5bae2c;};'use strict';var util=require(_0x776e('0x0'));var BPromise=require(_0x776e('0x1'));var jayson=require(_0x776e('0x2'));var _=require(_0x776e('0x3'));var logger=require(_0x776e('0x4'))(_0x776e('0x5'));var client=jayson[_0x776e('0x6')][_0x776e('0x7')]({'port':0x232a});function request(_0x1f2cdd,_0x2d05fb){return new BPromise(function(_0x3a3947,_0x820f64){return client[_0x776e('0x8')](_0x1f2cdd,_0x2d05fb)['then'](function(_0x403d7a){if(_0x403d7a['error']){return _0x820f64(_0x403d7a[_0x776e('0x9')]['message']);}else{return _0x3a3947(_0x403d7a[_0x776e('0xa')]);}})[_0x776e('0xb')](function(_0x238b59){return _0x820f64(_0x238b59);});});}exports[_0x776e('0xc')]=function(_0x431ca0,_0x9f72d0,_0x426f51){return function(_0x2a4d95){if(_0x426f51[_0x776e('0xd')]&&!_0x426f51[_0x776e('0xd')][_0x431ca0]){logger[_0x776e('0xe')](_0x776e('0xf'),_0x431ca0);return _0x2a4d95[_0x776e('0x10')]();}var _0x1d827b=[];for(var _0x1a749b=0x0;_0x1a749b<_0x9f72d0[_0x776e('0x11')];_0x1a749b+=0x1){_0x1d827b[_0x776e('0x12')](request('Command',{'command':util[_0x776e('0x13')](_0x776e('0x14'),_0x9f72d0[_0x1a749b])})[_0x776e('0x15')](function(_0x1d9cce){return _0x1d9cce&&_0x1d9cce[_0x776e('0x16')]&&_0x1d9cce[_0x776e('0x16')][_0x776e('0x17')](_0x776e('0x18'))>=0x0?!![]:![];})[_0x776e('0xb')](function(){logger[_0x776e('0x9')](_0x776e('0x19'),_0x431ca0,_0x9f72d0[_0x1a749b]);}));}BPromise[_0x776e('0x1a')](_0x1d827b)['then'](function(_0x3c423c){var _0x33ef65=_[_0x776e('0x1b')](_0x3c423c);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x431ca0,_0x9f72d0[_0x776e('0x1c')]('\x20|\x20'),_0x33ef65);_0x2a4d95['when'](_0x33ef65);})[_0x776e('0xb')](function(_0x541faa){logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x431ca0,_0x9f72d0[_0x776e('0x1c')](_0x776e('0x1d')),_0x541faa[_0x776e('0x1e')]);_0x2a4d95[_0x776e('0x10')]();});};}; \ No newline at end of file +var _0xdfb5=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','bluebird','lodash','../../../config/logger','client','http','then','error','message','result','catch','condition'];(function(_0x1b3837,_0x103941){var _0x2c90fd=function(_0x462d96){while(--_0x462d96){_0x1b3837['push'](_0x1b3837['shift']());}};_0x2c90fd(++_0x103941);}(_0xdfb5,0x1db));var _0x5dfb=function(_0x11f763,_0x3464bd){_0x11f763=_0x11f763-0x0;var _0x25eb10=_0xdfb5[_0x11f763];return _0x25eb10;};'use strict';var util=require('util');var BPromise=require(_0x5dfb('0x0'));var jayson=require('jayson/promise');var _=require(_0x5dfb('0x1'));var logger=require(_0x5dfb('0x2'))('routing');var client=jayson[_0x5dfb('0x3')][_0x5dfb('0x4')]({'port':0x232a});function request(_0x267fbc,_0x52114a){return new BPromise(function(_0x1bb43f,_0x4c9420){return client['request'](_0x267fbc,_0x52114a)[_0x5dfb('0x5')](function(_0x9bdf37){if(_0x9bdf37[_0x5dfb('0x6')]){return _0x4c9420(_0x9bdf37[_0x5dfb('0x6')][_0x5dfb('0x7')]);}else{return _0x1bb43f(_0x9bdf37[_0x5dfb('0x8')]);}})[_0x5dfb('0x9')](function(_0x5b52e1){return _0x4c9420(_0x5b52e1);});});}exports[_0x5dfb('0xa')]=function(_0x1a1303,_0x7b9204,_0x17448b){return function(_0x44ed0d){if(_0x17448b[_0x5dfb('0xb')]&&!_0x17448b[_0x5dfb('0xb')][_0x1a1303]){logger[_0x5dfb('0xc')](_0x5dfb('0xd'),_0x1a1303);return _0x44ed0d[_0x5dfb('0xe')]();}var _0xb419f8=[];for(var _0x39c5a3=0x0;_0x39c5a3<_0x7b9204[_0x5dfb('0xf')];_0x39c5a3+=0x1){_0xb419f8[_0x5dfb('0x10')](request('Command',{'command':util[_0x5dfb('0x11')](_0x5dfb('0x12'),_0x7b9204[_0x39c5a3])})[_0x5dfb('0x5')](function(_0x38cda3){return _0x38cda3&&_0x38cda3['message']&&_0x38cda3[_0x5dfb('0x7')][_0x5dfb('0x13')]('true')>=0x0?!![]:![];})[_0x5dfb('0x9')](function(){logger[_0x5dfb('0x6')](_0x5dfb('0x14'),_0x1a1303,_0x7b9204[_0x39c5a3]);}));}BPromise[_0x5dfb('0x15')](_0xb419f8)['then'](function(_0x151ddb){var _0x349ff8=_['some'](_0x151ddb);logger[_0x5dfb('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x1a1303,_0x7b9204[_0x5dfb('0x16')](_0x5dfb('0x17')),_0x349ff8);_0x44ed0d[_0x5dfb('0x18')](_0x349ff8);})[_0x5dfb('0x9')](function(_0xf69478){logger[_0x5dfb('0x6')](_0x5dfb('0x19'),_0x1a1303,_0x7b9204[_0x5dfb('0x16')](_0x5dfb('0x17')),_0xf69478[_0x5dfb('0x1a')]);_0x44ed0d['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 17346f1..5a979f3 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 _0x3c81=['CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','holdtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','isNil','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request'];(function(_0x24d68a,_0x49e010){var _0x408697=function(_0x2cbccf){while(--_0x2cbccf){_0x24d68a['push'](_0x24d68a['shift']());}};_0x408697(++_0x49e010);}(_0x3c81,0x102));var _0x13c8=function(_0x42a9ec,_0x4a2ae3){_0x42a9ec=_0x42a9ec-0x0;var _0x56e39e=_0x3c81[_0x42a9ec];return _0x56e39e;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x252f26,_0x131d0b){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x252f26['uniqueid'],_0x252f26[_0x13c8('0x2')],_0x252f26[_0x13c8('0x3')],_0x252f26[_0x13c8('0x4')],_0x252f26[_0x13c8('0x5')],_0x252f26[_0x13c8('0x6')],_0x252f26[_0x13c8('0x7')],_0x252f26[_0x13c8('0x8')]));if(_0x252f26['queue']){utils[_0x13c8('0x9')](_0x252f26['queue'])[_0x13c8('0xa')](function(_0x296463){if(_0x296463){_0x252f26[_0x13c8('0xb')]=_0x296463[_0x13c8('0xb')];_0x252f26[_0x13c8('0xc')]=_0x252f26[_0x13c8('0xd')]?_0x296463[_0x13c8('0xe')]:![];_0x252f26[_0x13c8('0xf')]=_0x252f26[_0x13c8('0xc')]?_0x296463[_0x13c8('0x10')]:0x0;}utils[_0x13c8('0x11')](_0x13c8('0x12'),_0x252f26);});}else{utils[_0x13c8('0x11')](_0x13c8('0x12'),_0x252f26);}if(_0x131d0b){delete transfers[_0x252f26['uniqueid']];}else{delete agents[_0x252f26[_0x13c8('0x13')]];}}exports[_0x13c8('0x14')]=function(_0x2304b5){try{utils[_0x13c8('0x15')](util['format'](_0x13c8('0x16'),_0x2304b5['uniqueid']),_0x2304b5);agents[_0x2304b5['destuniqueid']]=_0x2304b5;agents[_0x2304b5['destuniqueid']][_0x13c8('0x17')]=utils['now']();agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x18');agents[_0x2304b5[_0x13c8('0x13')]]['connectedlinenum']=null;agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x19')]=null;utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x1c'),_0x2304b5[_0x13c8('0x1d')],agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x4')],_0x2304b5[_0x13c8('0x13')]));}catch(_0x31d122){utils[_0x13c8('0x1e')](util['format'](_0x13c8('0x16'),_0x2304b5[_0x13c8('0x1d')]),_0x31d122);}};exports[_0x13c8('0x1f')]=function(_0x313ea3){try{if(!_['isNil'](agents[_0x313ea3[_0x13c8('0x13')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x20'),_0x313ea3[_0x13c8('0x1d')]),_0x313ea3);utils[_0x13c8('0x1a')](util['format'](_0x13c8('0x21'),_0x313ea3[_0x13c8('0x1d')],agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x4')],_0x313ea3['destuniqueid']));agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x1f')]=!![];agents[_0x313ea3['destuniqueid']]['agentringnoanswerAt']=utils[_0x13c8('0x22')]();agents[_0x313ea3[_0x13c8('0x13')]]['lastevent']='timeout';agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x23')]='timeout';agents[_0x313ea3['destuniqueid']][_0x13c8('0x24')]=_0x313ea3['ringtime']?parseInt(_0x313ea3['ringtime'])/0x3e8:0x0;agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x25')]=0x0;unanswered[_0x13c8('0x26')](_0x313ea3['destuniqueid']);}}catch(_0x5ef2f7){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x20'),_0x313ea3[_0x13c8('0x1d')]),_0x5ef2f7);}};exports[_0x13c8('0x27')]=function(_0x220d40){try{_[_0x13c8('0x28')](agents,function(_0x4a1b9c,_0x109cb8){if(_0x4a1b9c[_0x13c8('0x1d')]==_0x220d40['uniqueid']&&!_['includes'](unanswered,_0x4a1b9c[_0x13c8('0x13')])){utils[_0x13c8('0x15')](util['format'](_0x13c8('0x29'),_0x220d40[_0x13c8('0x1d')]),_0x220d40);utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x2a'),_0x220d40[_0x13c8('0x1d')],_0x4a1b9c[_0x13c8('0x4')],_0x4a1b9c[_0x13c8('0x13')]));_0x4a1b9c[_0x13c8('0x1f')]=!![];_0x4a1b9c[_0x13c8('0x2b')]=utils[_0x13c8('0x22')]();_0x4a1b9c['lastevent']='abandoned';_0x4a1b9c[_0x13c8('0x23')]=_0x13c8('0x2c');_0x4a1b9c['holdtime']=_0x220d40[_0x13c8('0x24')];_0x4a1b9c['talktime']=0x0;writeDB(_0x4a1b9c);}});}catch(_0x1fdf7d){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x29'),_0x220d40[_0x13c8('0x1d')]),_0x1fdf7d);}};exports[_0x13c8('0x2d')]=function(_0x2039e7){try{if(agents[_0x2039e7[_0x13c8('0x13')]]){utils[_0x13c8('0x15')](util['format'](_0x13c8('0x2e'),_0x2039e7[_0x13c8('0x1d')]),_0x2039e7);utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x2f'),_0x2039e7[_0x13c8('0x1d')],agents[_0x2039e7['destuniqueid']]['membername'],_0x2039e7['destuniqueid']));agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x7')]=_0x2039e7[_0x13c8('0x7')];agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x19')]=_0x2039e7[_0x13c8('0x19')];agents[_0x2039e7['destuniqueid']]['holdtime']=_0x2039e7[_0x13c8('0x31')];agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x32');_['forIn'](agents,function(_0x35e1e7,_0x4bd627){if(_0x35e1e7[_0x13c8('0x13')]!=_0x2039e7[_0x13c8('0x13')]&&_0x35e1e7[_0x13c8('0x1d')]==_0x2039e7[_0x13c8('0x1d')]){_0x35e1e7[_0x13c8('0x25')]=0x0;_0x35e1e7[_0x13c8('0x24')]=_0x2039e7[_0x13c8('0x31')];_0x35e1e7[_0x13c8('0x1f')]=!![];_0x35e1e7[_0x13c8('0x2b')]=utils[_0x13c8('0x22')]();_0x35e1e7[_0x13c8('0x8')]=_0x13c8('0x33');_0x35e1e7[_0x13c8('0x23')]=_0x13c8('0x33');_0x35e1e7[_0x13c8('0x34')]=_0x2039e7[_0x13c8('0x13')];_0x35e1e7[_0x13c8('0x35')]=_0x2039e7[_0x13c8('0x4')];writeDB(_0x35e1e7);}});}}catch(_0xc5eb86){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x2e'),_0x2039e7[_0x13c8('0x1d')]),_0xc5eb86);}};exports[_0x13c8('0xd')]=function(_0x44ee66){try{if(!_['isNil'](agents[_0x44ee66[_0x13c8('0x13')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x36'),_0x44ee66[_0x13c8('0x1d')]),_0x44ee66);utils['info'](util['format'](_0x13c8('0x37'),_0x44ee66[_0x13c8('0x1d')],agents[_0x44ee66[_0x13c8('0x13')]]['membername'],_0x44ee66['destuniqueid']));agents[_0x44ee66['destuniqueid']][_0x13c8('0xd')]=!![];agents[_0x44ee66['destuniqueid']][_0x13c8('0x38')]=utils['now']();agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x25')]=utils[_0x13c8('0x39')](agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x38')],agents[_0x44ee66[_0x13c8('0x13')]]['agentconnectAt']);agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x23')]=_0x44ee66['reason'];agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x3a');writeDB(agents[_0x44ee66[_0x13c8('0x13')]]);}}catch(_0x38486a){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x36'),_0x44ee66[_0x13c8('0x1d')]),_0x38486a);}};exports[_0x13c8('0x3b')]=function(_0x185d18){try{if(!_['isNil'](agents[_0x185d18[_0x13c8('0x3c')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x3d'),_0x185d18[_0x13c8('0x1d')]),_0x185d18);utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x3e'),_0x185d18[_0x13c8('0x1d')],agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x4')],agents[_0x185d18['transfereruniqueid']][_0x13c8('0x1d')]));agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x3f')]=!![];agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x40')]=_0x13c8('0x41');agents[_0x185d18['transfereruniqueid']][_0x13c8('0x42')]=_0x185d18[_0x13c8('0x43')];agents[_0x185d18[_0x13c8('0x3c')]]['transferuniqueid']=agents[_0x185d18['transfereruniqueid']][_0x13c8('0x1d')];}}catch(_0x14a738){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x3d'),_0x185d18['uniqueid']),_0x14a738);}};exports[_0x13c8('0x44')]=function(_0x554792){try{utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x45'),_0x554792['origtransfereruniqueid']),_0x554792);if(_0x554792[_0x13c8('0x46')]==_0x554792[_0x13c8('0x47')]){if(!_['isNil'](agents[_0x554792[_0x13c8('0x48')]])){utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x49'),_0x554792[_0x13c8('0x46')],agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x4')]));agents[_0x554792['secondtransfereruniqueid']][_0x13c8('0x3f')]=!![];agents[_0x554792['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x554792['secondtransfereruniqueid']]['transferexten']=_0x554792[_0x13c8('0x4a')];agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x4b')]=_0x554792[_0x13c8('0x46')];}if(_0x554792[_0x13c8('0x4c')]&&agents[_0x554792[_0x13c8('0x4c')]]){agents[_0x554792[_0x13c8('0x4c')]]['agententerreason']=0x1;transfers[_0x554792['transfereeuniqueid']]=_[_0x13c8('0x4d')](agents[_0x554792[_0x13c8('0x4c')]]);transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x6')]=agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x6')];transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x4e')]=agents[_0x554792['secondtransfereruniqueid']][_0x13c8('0x4e')];transfers[_0x554792[_0x13c8('0x4c')]]['agentcalledAt']=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x24')]=0x0;transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x4f')]=0x2;}}else if(_0x554792[_0x13c8('0x48')]==_0x554792[_0x13c8('0x50')]){if(!_[_0x13c8('0x51')](agents[_0x554792[_0x13c8('0x46')]])){utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x49'),_0x554792[_0x13c8('0x46')],agents[_0x554792['origtransfereruniqueid']][_0x13c8('0x4')]));agents[_0x554792['origtransfereruniqueid']][_0x13c8('0x3f')]=!![];agents[_0x554792[_0x13c8('0x46')]]['transfertype']=_0x13c8('0x52');agents[_0x554792[_0x13c8('0x46')]]['transferexten']=_0x554792[_0x13c8('0x53')];agents[_0x554792[_0x13c8('0x46')]][_0x13c8('0x4b')]=_0x554792[_0x13c8('0x48')];}if(_0x554792[_0x13c8('0x54')]&&agents[_0x554792[_0x13c8('0x54')]]){agents[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4f')]=0x1;transfers[_0x554792[_0x13c8('0x54')]]=_[_0x13c8('0x4d')](agents[_0x554792[_0x13c8('0x54')]]);transfers[_0x554792['transfertargetuniqueid']][_0x13c8('0x6')]=agents[_0x554792[_0x13c8('0x46')]][_0x13c8('0x6')];transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4e')]=agents[_0x554792[_0x13c8('0x46')]]['calleridname'];transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x17')]=utils[_0x13c8('0x22')]();transfers[_0x554792['transfertargetuniqueid']][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x24')]=0x0;transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4f')]=0x2;}}}catch(_0x55e5ba){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x45'),_0x554792[_0x13c8('0x46')]),_0x55e5ba);}};exports['hangup']=function(_0x16b409){try{utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x55'),_0x16b409[_0x13c8('0x1d')]),_0x16b409);if(agents[_0x16b409[_0x13c8('0x1d')]]&&agents[_0x16b409[_0x13c8('0x1d')]]['reason']===_0x13c8('0x56')){if(_0x16b409[_0x13c8('0x57')]==='21'){agents[_0x16b409[_0x13c8('0x1d')]]['reason']=_0x13c8('0x58');agents[_0x16b409[_0x13c8('0x1d')]]['lastevent']='rejected';}utils[_0x13c8('0x1a')](util['format'](_0x13c8('0x59'),_0x16b409['uniqueid'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x4')],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')],agents[_0x16b409[_0x13c8('0x1d')]]['lastevent']));writeDB(agents[_0x16b409[_0x13c8('0x1d')]]);var _0x2d8dfe=unanswered['indexOf'](_0x16b409[_0x13c8('0x1d')]);if(_0x2d8dfe>-0x1){unanswered[_0x13c8('0x5a')](_0x2d8dfe,0x1);}}if(transfers[_0x16b409[_0x13c8('0x1d')]]){transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0xd')]=!![];transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x38')]=utils[_0x13c8('0x22')]();transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x25')]=utils['diffTime'](transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x38')],transfers[_0x16b409['uniqueid']]['agentconnectAt']);transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')]=_0x13c8('0x5b');transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x8')]=_0x13c8('0x3a');utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x59'),_0x16b409[_0x13c8('0x1d')],transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x4')],transfers[_0x16b409['uniqueid']][_0x13c8('0x23')],transfers[_0x16b409[_0x13c8('0x1d')]]['lastevent']));writeDB(transfers[_0x16b409[_0x13c8('0x1d')]],!![]);}if(agents[_0x16b409[_0x13c8('0x1d')]]&&agents[_0x16b409['uniqueid']][_0x13c8('0x30')]){agents[_0x16b409['uniqueid']][_0x13c8('0xd')]=!![];agents[_0x16b409['uniqueid']][_0x13c8('0x38')]=utils[_0x13c8('0x22')]();agents[_0x16b409[_0x13c8('0x1d')]]['talktime']=utils[_0x13c8('0x39')](agents[_0x16b409['uniqueid']]['agentcompleteAt'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x30')]);agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')]=agents[_0x16b409['uniqueid']]['transfer']?_0x13c8('0x3f'):'agent';agents[_0x16b409['uniqueid']][_0x13c8('0x8')]=_0x13c8('0x3a');utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x16b409[_0x13c8('0x1d')],agents[_0x16b409['uniqueid']]['membername'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x8')]));writeDB(agents[_0x16b409[_0x13c8('0x1d')]]);}}catch(_0x551563){utils[_0x13c8('0x1e')](util['format'](_0x13c8('0x55'),_0x16b409['uniqueid']),_0x551563);}}; \ No newline at end of file +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(_0x1eb368,_0x25839d){var _0x46db89=function(_0x27266b){while(--_0x27266b){_0x1eb368['push'](_0x1eb368['shift']());}};_0x46db89(++_0x25839d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 93dccd2..0525105 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 _0x7559=['[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','membername','interface','calleridnum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','ANSWERED','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','variable','xmd-callerid'];(function(_0x481fea,_0x1bcefa){var _0xf403e6=function(_0x321685){while(--_0x321685){_0x481fea['push'](_0x481fea['shift']());}};_0xf403e6(++_0x1bcefa);}(_0x7559,0x1b7));var _0x9755=function(_0x5b120f,_0x1bda7d){_0x5b120f=_0x5b120f-0x0;var _0x442b90=_0x7559[_0x5b120f];return _0x442b90;};'use strict';var _=require('lodash');var util=require(_0x9755('0x0'));var utils=require(_0x9755('0x1'));var dispositions=[_0x9755('0x2'),'FAILED',_0x9755('0x3'),_0x9755('0x2'),_0x9755('0x2'),_0x9755('0x2'),'ANSWERED',_0x9755('0x4'),_0x9755('0x3'),'FAILED',_0x9755('0x3')];var channels={};function writeDB(_0x151917){utils[_0x9755('0x5')](util[_0x9755('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x151917[_0x9755('0x7')],_0x151917[_0x9755('0x8')],_0x151917['queue'],_0x151917[_0x9755('0x9')],_0x151917[_0x9755('0xa')],_0x151917[_0x9755('0xb')],_0x151917['connectedlinenum'],_0x151917['lastevent']));if(_0x151917['accountcode']){utils[_0x9755('0xc')](_0x151917[_0x9755('0xd')])[_0x9755('0xe')](function(_0x160226){if(_0x160226){_0x151917[_0x9755('0xf')]=_0x160226['id'];}utils[_0x9755('0x10')](_0x9755('0x11'),_0x151917);});}else{utils['request'](_0x9755('0x11'),_0x151917);}if(channels[_0x151917['uniqueid']]){delete channels[_0x151917[_0x9755('0x7')]];}}exports[_0x9755('0x12')]=function(_0x26c95f){try{utils['debug'](util['format'](_0x9755('0x13'),_0x26c95f[_0x9755('0x7')]),_0x26c95f);if(_0x26c95f[_0x9755('0x7')]==_0x26c95f[_0x9755('0x14')]&&_0x26c95f[_0x9755('0x8')]!=_0x9755('0x15')){utils['info'](util[_0x9755('0x6')](_0x9755('0x16'),_0x26c95f[_0x9755('0x7')],_0x26c95f['context'],_0x26c95f[_0x9755('0x17')]));channels[_0x26c95f[_0x9755('0x7')]]={'uniqueid':_0x26c95f[_0x9755('0x7')],'accountcode':_0x26c95f[_0x9755('0xd')],'source':_0x26c95f[_0x9755('0xb')],'destination':_0x26c95f[_0x9755('0x17')],'destinationcontext':_0x26c95f[_0x9755('0x18')],'channel':_0x26c95f[_0x9755('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9755('0x2'),'amaflags':_0x9755('0x19')};}}catch(_0x331b29){utils[_0x9755('0x1a')](util[_0x9755('0x6')](_0x9755('0x13'),_0x26c95f[_0x9755('0x7')]),_0x331b29);}};exports[_0x9755('0x1b')]=function(_0x5c6395){try{utils[_0x9755('0x1c')](util[_0x9755('0x6')](_0x9755('0x1d'),_0x5c6395[_0x9755('0x7')]),_0x5c6395);if(!_[_0x9755('0x1e')](channels[_0x5c6395[_0x9755('0x7')]])&&_0x5c6395[_0x9755('0x1f')]==0x6){utils['info'](util[_0x9755('0x6')](_0x9755('0x20'),_0x5c6395[_0x9755('0x7')],_0x5c6395['context'],_0x5c6395[_0x9755('0x8')]));if(_[_0x9755('0x1e')](channels[_0x5c6395['uniqueid']][_0x9755('0x21')])){channels[_0x5c6395['uniqueid']][_0x9755('0x21')]=utils[_0x9755('0x22')]();}}else if(!_[_0x9755('0x1e')](channels[_0x5c6395[_0x9755('0x14')]])&&_0x5c6395['channelstate']==0x6&&_0x5c6395[_0x9755('0x18')]!=_0x9755('0x23')){utils[_0x9755('0x5')](util[_0x9755('0x6')](_0x9755('0x24'),_0x5c6395[_0x9755('0x7')],_0x5c6395[_0x9755('0x14')],_0x5c6395['context'],_0x5c6395['channel']));channels[_0x5c6395['linkedid']][_0x9755('0xd')]=_0x5c6395[_0x9755('0xd')];channels[_0x5c6395[_0x9755('0x14')]][_0x9755('0x25')]=_0x5c6395['channel'];if(_[_0x9755('0x1e')](channels[_0x5c6395['linkedid']]['answertime'])){channels[_0x5c6395['linkedid']][_0x9755('0x26')]=utils[_0x9755('0x22')]();}channels[_0x5c6395[_0x9755('0x14')]]['disposition']=dispositions[_[_0x9755('0x27')](_0x5c6395[_0x9755('0x1f')])]||_0x9755('0x28');}}catch(_0x267794){utils[_0x9755('0x1a')](util[_0x9755('0x6')](_0x9755('0x1d'),_0x5c6395[_0x9755('0x7')]),_0x267794);}};exports[_0x9755('0x29')]=function(_0xaaed74){try{if(!_[_0x9755('0x1e')](channels[_0xaaed74[_0x9755('0x7')]])){utils['debug'](util[_0x9755('0x6')]('[%s][calls][hangup]',_0xaaed74[_0x9755('0x7')]),_0xaaed74);if(_[_0x9755('0x1e')](channels[_0xaaed74[_0x9755('0x7')]][_0x9755('0x2a')])){channels[_0xaaed74[_0x9755('0x7')]]['callerid']=_0xaaed74['calleridname']+'\x20<'+_0xaaed74['calleridnum']+'>';}utils['info'](util[_0x9755('0x6')](_0x9755('0x2b'),_0xaaed74[_0x9755('0x7')],channels[_0xaaed74[_0x9755('0x7')]][_0x9755('0x2a')],_0xaaed74[_0x9755('0x2c')]));channels[_0xaaed74[_0x9755('0x7')]][_0x9755('0x2d')]=utils['now']();channels[_0xaaed74['uniqueid']][_0x9755('0x2e')]=utils[_0x9755('0x2f')](channels[_0xaaed74[_0x9755('0x7')]][_0x9755('0x2d')],channels[_0xaaed74['uniqueid']]['starttime']);channels[_0xaaed74['uniqueid']][_0x9755('0x30')]=channels[_0xaaed74[_0x9755('0x7')]][_0x9755('0x26')]?utils[_0x9755('0x2f')](channels[_0xaaed74[_0x9755('0x7')]]['endtime'],channels[_0xaaed74[_0x9755('0x7')]][_0x9755('0x26')]):0x0;writeDB(channels[_0xaaed74[_0x9755('0x7')]]);}}catch(_0xce1e04){utils[_0x9755('0x1a')](util[_0x9755('0x6')](_0x9755('0x31'),_0xaaed74[_0x9755('0x7')]),_0xce1e04);}};exports[_0x9755('0x32')]=function(_0x4442f0){try{if(!_[_0x9755('0x1e')](channels[_0x4442f0[_0x9755('0x33')]])){utils[_0x9755('0x1c')](util['format']('[%s][calls][attendedtransfer]',_0x4442f0[_0x9755('0x34')]),_0x4442f0);if(channels[_0x4442f0['localtwolinkedid']]['channel']==_0x4442f0['transfereechannel']){utils['info'](util[_0x9755('0x6')](_0x9755('0x35'),_0x4442f0['origtransfereruniqueid'],_0x4442f0['localtwolinkedid'],_0x4442f0['secondtransfererchannel']));channels[_0x4442f0[_0x9755('0x33')]][_0x9755('0x25')]=_0x4442f0[_0x9755('0x36')];channels[_0x4442f0['localtwolinkedid']]['userfield']=_0x9755('0x37');}else if(channels[_0x4442f0[_0x9755('0x33')]][_0x9755('0x8')]=_0x4442f0[_0x9755('0x38')]){utils[_0x9755('0x5')](util[_0x9755('0x6')](_0x9755('0x35'),_0x4442f0['origtransfereruniqueid'],_0x4442f0['localtwolinkedid'],_0x4442f0[_0x9755('0x39')]));channels[_0x4442f0[_0x9755('0x33')]]['destinationchannel']=_0x4442f0[_0x9755('0x39')];channels[_0x4442f0[_0x9755('0x33')]][_0x9755('0x3a')]=_0x9755('0x37');}}}catch(_0x246fcf){utils[_0x9755('0x1a')](util[_0x9755('0x6')](_0x9755('0x3b'),_0x4442f0[_0x9755('0x34')]),_0x246fcf);}};exports[_0x9755('0x3c')]=function(_0x45f3e6){try{if(!_[_0x9755('0x1e')](channels[_0x45f3e6[_0x9755('0x7')]])){utils[_0x9755('0x1c')](util[_0x9755('0x6')]('[%s][calls][musiconholdstart]',_0x45f3e6['uniqueid']),_0x45f3e6);channels[_0x45f3e6[_0x9755('0x7')]]['musiconholdstartAt']=utils[_0x9755('0x22')]();utils['info'](util[_0x9755('0x6')](_0x9755('0x3d'),_0x45f3e6['uniqueid'],channels[_0x45f3e6[_0x9755('0x7')]][_0x9755('0x3e')]));}}catch(_0x4f3a38){utils[_0x9755('0x1a')](util[_0x9755('0x6')](_0x9755('0x3f'),_0x45f3e6['uniqueid']),_0x4f3a38);}};exports['musiconholdstop']=function(_0xf2632){try{if(!_[_0x9755('0x1e')](channels[_0xf2632[_0x9755('0x7')]])){utils[_0x9755('0x1c')](util['format'](_0x9755('0x40'),_0xf2632[_0x9755('0x7')]),_0xf2632);if(!_[_0x9755('0x1e')](channels[_0xf2632[_0x9755('0x7')]][_0x9755('0x3e')])){channels[_0xf2632[_0x9755('0x7')]][_0x9755('0x41')]+=utils[_0x9755('0x2f')](utils[_0x9755('0x22')](),channels[_0xf2632[_0x9755('0x7')]][_0x9755('0x3e')]);utils[_0x9755('0x5')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0xf2632[_0x9755('0x7')],channels[_0xf2632['uniqueid']][_0x9755('0x41')]));delete channels[_0xf2632['uniqueid']]['musiconholdstartAt'];}}}catch(_0xf5e85){utils[_0x9755('0x1a')](util[_0x9755('0x6')]('[%s][calls][musiconholdstop]',_0xf2632[_0x9755('0x7')]),_0xf5e85);}};exports[_0x9755('0x42')]=function(_0x8fc289){try{if(!_[_0x9755('0x1e')](channels[_0x8fc289['uniqueid']])){utils['debug'](util[_0x9755('0x6')]('[%s][calls][varset]',_0x8fc289[_0x9755('0x7')]),_0x8fc289);if(!_['isNil'](_0x8fc289['variable'][_0x9755('0x43')])){utils[_0x9755('0x5')](util[_0x9755('0x6')](_0x9755('0x44'),_0x8fc289[_0x9755('0x7')],_0x8fc289[_0x9755('0x45')]));channels[_0x8fc289[_0x9755('0x7')]][_0x9755('0x46')]=_0x8fc289[_0x9755('0x45')];}if(!_[_0x9755('0x1e')](_0x8fc289['variable'][_0x9755('0x47')])){utils['info'](util['format'](_0x9755('0x48'),_0x8fc289[_0x9755('0x7')],_0x8fc289[_0x9755('0x45')]));channels[_0x8fc289['uniqueid']][_0x9755('0x49')]=_0x8fc289[_0x9755('0x45')];channels[_0x8fc289[_0x9755('0x7')]][_0x9755('0x2a')]='\x22'+_0x8fc289['value']+'\x22\x20<'+_0x8fc289[_0x9755('0x45')]+'>';}if(!_[_0x9755('0x1e')](_0x8fc289[_0x9755('0x4a')]['xmd-callerid-preview'])||!_['isNil'](_0x8fc289[_0x9755('0x4a')][_0x9755('0x4b')])){utils['info'](util['format'](_0x9755('0x4c'),_0x8fc289[_0x9755('0x7')],!_[_0x9755('0x1e')](_0x8fc289[_0x9755('0x4a')][_0x9755('0x4d')])?'xmd-callerid-preview':'xmd-callerid',_0x8fc289[_0x9755('0x45')]));channels[_0x8fc289[_0x9755('0x7')]][_0x9755('0x2a')]=_0x8fc289[_0x9755('0x45')];}if(!_[_0x9755('0x1e')](_0x8fc289[_0x9755('0x4a')][_0x9755('0x4e')])||!_[_0x9755('0x1e')](_0x8fc289['variable']['xmcs-queue'])){utils[_0x9755('0x5')](util['format'](_0x9755('0x4c'),_0x8fc289[_0x9755('0x7')],!_[_0x9755('0x1e')](_0x8fc289[_0x9755('0x4a')]['xmd-queue'])?'xmd-queue':_0x9755('0x4f'),_0x8fc289['value']));channels[_0x8fc289['uniqueid']][_0x9755('0x50')]=_0x9755('0x51');channels[_0x8fc289[_0x9755('0x7')]][_0x9755('0x52')]=_0x8fc289[_0x9755('0x45')];channels[_0x8fc289[_0x9755('0x7')]]['queue']=!![];}if(!_['isNil'](_0x8fc289[_0x9755('0x4a')][_0x9755('0x53')])){utils[_0x9755('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x8fc289[_0x9755('0x7')],_0x8fc289[_0x9755('0x45')]));channels[_0x8fc289[_0x9755('0x7')]][_0x9755('0x54')]=_0x8fc289[_0x9755('0x45')];}if(!_[_0x9755('0x1e')](_0x8fc289['variable'][_0x9755('0x55')])){utils[_0x9755('0x5')](util[_0x9755('0x6')](_0x9755('0x56'),_0x8fc289[_0x9755('0x7')],_0x8fc289['value']));channels[_0x8fc289[_0x9755('0x7')]]['type']=_0x8fc289[_0x9755('0x45')];}if(!_[_0x9755('0x1e')](_0x8fc289[_0x9755('0x4a')][_0x9755('0x57')])){utils[_0x9755('0x5')](util[_0x9755('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x8fc289[_0x9755('0x7')],_0x8fc289[_0x9755('0x45')]));channels[_0x8fc289[_0x9755('0x7')]]['routeid']=_0x8fc289['value'];}if(!_[_0x9755('0x1e')](_0x8fc289['variable'][_0x9755('0x58')])){utils['info'](util[_0x9755('0x6')](_0x9755('0x59'),_0x8fc289[_0x9755('0x7')],_0x8fc289['value']));channels[_0x8fc289[_0x9755('0x7')]][_0x9755('0x58')]=_0x8fc289[_0x9755('0x45')];}}}catch(_0xf8f595){utils[_0x9755('0x1a')](util[_0x9755('0x6')]('[%s][calls][varset]',_0x8fc289[_0x9755('0x7')]),_0xf8f595);}};exports[_0x9755('0x5a')]=function(_0x4eb651){try{if(!_[_0x9755('0x1e')](channels[_0x4eb651[_0x9755('0x7')]])){utils[_0x9755('0x1c')](util['format'](_0x9755('0x5b'),_0x4eb651[_0x9755('0x7')]),_0x4eb651);utils[_0x9755('0x5')](util[_0x9755('0x6')](_0x9755('0x5c'),_0x4eb651[_0x9755('0x7')],_0x4eb651['application'],_0x4eb651[_0x9755('0x5d')]));if(_0x4eb651[_0x9755('0x5e')]['toLowerCase']()==_0x9755('0x5f')&&_['startsWith'](_0x4eb651[_0x9755('0x5d')][_0x9755('0x60')](),_0x9755('0x61'))){var _0x37a4bb=_0x4eb651[_0x9755('0x5d')]['split']('=');var _0x4ae0c7=_0x37a4bb[0x0][_0x9755('0x62')](_0x37a4bb[0x0][_0x9755('0x63')]('(')+0x1,_0x37a4bb[0x0][_0x9755('0x63')](')'));var _0x5e731c=_0x37a4bb[0x1];channels[_0x4eb651[_0x9755('0x7')]][_0x4ae0c7]=_0x5e731c;}if(!_[_0x9755('0x64')]([_0x9755('0x29'),_0x9755('0x65'),_0x9755('0x66'),'set','gotoif'],_0x4eb651[_0x9755('0x5e')][_0x9755('0x60')]())){channels[_0x4eb651[_0x9755('0x7')]]['lastapplication']=_0x4eb651[_0x9755('0x5e')];channels[_0x4eb651[_0x9755('0x7')]][_0x9755('0x52')]=_0x4eb651[_0x9755('0x5d')];}}}catch(_0x3bbe3b){utils[_0x9755('0x1a')](util['format'](_0x9755('0x5b'),_0x4eb651[_0x9755('0x7')]),_0x3bbe3b);}}; \ No newline at end of file +var _0xafa4=['hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','set','lastdata','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','uniqueid','newchannel','debug','[%s][calls][newchannel]','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]'];(function(_0x3a4d0f,_0x43abb8){var _0x4b3eb0=function(_0x1438ba){while(--_0x1438ba){_0x3a4d0f['push'](_0x3a4d0f['shift']());}};_0x4b3eb0(++_0x43abb8);}(_0xafa4,0x11d));var _0x4afa=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0xafa4[_0x300c89];return _0x41762e;};'use strict';var _=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var utils=require('./utils');var dispositions=[_0x4afa('0x2'),_0x4afa('0x3'),_0x4afa('0x3'),_0x4afa('0x2'),_0x4afa('0x2'),_0x4afa('0x2'),_0x4afa('0x4'),_0x4afa('0x5'),'FAILED',_0x4afa('0x3'),_0x4afa('0x3')];var channels={};function writeDB(_0x483640){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x8'),_0x483640['uniqueid'],_0x483640[_0x4afa('0x9')],_0x483640[_0x4afa('0xa')],_0x483640[_0x4afa('0xb')],_0x483640[_0x4afa('0xc')],_0x483640[_0x4afa('0xd')],_0x483640[_0x4afa('0xe')],_0x483640[_0x4afa('0xf')]));if(_0x483640[_0x4afa('0x10')]){utils[_0x4afa('0x11')](_0x483640[_0x4afa('0x10')])[_0x4afa('0x12')](function(_0x521f3a){if(_0x521f3a){_0x483640['UserId']=_0x521f3a['id'];}utils[_0x4afa('0x13')]('CreateVoiceCallReport',_0x483640);});}else{utils[_0x4afa('0x13')]('CreateVoiceCallReport',_0x483640);}if(channels[_0x483640[_0x4afa('0x14')]]){delete channels[_0x483640[_0x4afa('0x14')]];}}exports[_0x4afa('0x15')]=function(_0x388958){try{utils[_0x4afa('0x16')](util[_0x4afa('0x7')](_0x4afa('0x17'),_0x388958[_0x4afa('0x14')]),_0x388958);if(_0x388958[_0x4afa('0x14')]==_0x388958['linkedid']&&_0x388958[_0x4afa('0x9')]!='OutgoingSpoolFailed'){utils[_0x4afa('0x6')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x388958[_0x4afa('0x14')],_0x388958[_0x4afa('0x18')],_0x388958['exten']));channels[_0x388958[_0x4afa('0x14')]]={'uniqueid':_0x388958[_0x4afa('0x14')],'accountcode':_0x388958[_0x4afa('0x10')],'source':_0x388958['calleridnum'],'destination':_0x388958[_0x4afa('0x19')],'destinationcontext':_0x388958[_0x4afa('0x18')],'channel':_0x388958[_0x4afa('0x9')],'starttime':utils[_0x4afa('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x4afa('0x1b')};}}catch(_0xaefc2c){utils['error'](util[_0x4afa('0x7')](_0x4afa('0x17'),_0x388958[_0x4afa('0x14')]),_0xaefc2c);}};exports[_0x4afa('0x1c')]=function(_0x56e41b){try{utils[_0x4afa('0x16')](util[_0x4afa('0x7')]('[%s][calls][newstate]',_0x56e41b[_0x4afa('0x14')]),_0x56e41b);if(!_[_0x4afa('0x1d')](channels[_0x56e41b[_0x4afa('0x14')]])&&_0x56e41b[_0x4afa('0x1e')]==0x6){utils['info'](util['format'](_0x4afa('0x1f'),_0x56e41b[_0x4afa('0x14')],_0x56e41b['context'],_0x56e41b[_0x4afa('0x9')]));if(_[_0x4afa('0x1d')](channels[_0x56e41b['uniqueid']][_0x4afa('0x20')])){channels[_0x56e41b[_0x4afa('0x14')]][_0x4afa('0x20')]=utils['now']();}}else if(!_[_0x4afa('0x1d')](channels[_0x56e41b[_0x4afa('0x21')]])&&_0x56e41b[_0x4afa('0x1e')]==0x6&&_0x56e41b['context']!=_0x4afa('0x22')){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x23'),_0x56e41b[_0x4afa('0x14')],_0x56e41b[_0x4afa('0x21')],_0x56e41b[_0x4afa('0x18')],_0x56e41b['channel']));channels[_0x56e41b[_0x4afa('0x21')]][_0x4afa('0x10')]=_0x56e41b[_0x4afa('0x10')];channels[_0x56e41b[_0x4afa('0x21')]][_0x4afa('0x24')]=_0x56e41b[_0x4afa('0x9')];if(_[_0x4afa('0x1d')](channels[_0x56e41b['linkedid']][_0x4afa('0x25')])){channels[_0x56e41b['linkedid']][_0x4afa('0x25')]=utils['now']();}channels[_0x56e41b[_0x4afa('0x21')]][_0x4afa('0x26')]=dispositions[_[_0x4afa('0x27')](_0x56e41b[_0x4afa('0x1e')])]||_0x4afa('0x4');}}catch(_0x3aad7a){utils[_0x4afa('0x28')](util[_0x4afa('0x7')](_0x4afa('0x29'),_0x56e41b[_0x4afa('0x14')]),_0x3aad7a);}};exports[_0x4afa('0x2a')]=function(_0x2fe9f1){try{if(!_['isNil'](channels[_0x2fe9f1['uniqueid']])){utils[_0x4afa('0x16')](util[_0x4afa('0x7')](_0x4afa('0x2b'),_0x2fe9f1[_0x4afa('0x14')]),_0x2fe9f1);if(_[_0x4afa('0x1d')](channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x2c')])){channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x2c')]=_0x2fe9f1['calleridname']+'\x20<'+_0x2fe9f1[_0x4afa('0xd')]+'>';}utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x2d'),_0x2fe9f1['uniqueid'],channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x2c')],_0x2fe9f1[_0x4afa('0x2e')]));channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x2f')]=utils[_0x4afa('0x1a')]();channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x30')]=utils['diffTime'](channels[_0x2fe9f1[_0x4afa('0x14')]]['endtime'],channels[_0x2fe9f1['uniqueid']][_0x4afa('0x31')]);channels[_0x2fe9f1['uniqueid']][_0x4afa('0x32')]=channels[_0x2fe9f1['uniqueid']][_0x4afa('0x25')]?utils[_0x4afa('0x33')](channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x2f')],channels[_0x2fe9f1[_0x4afa('0x14')]][_0x4afa('0x25')]):0x0;writeDB(channels[_0x2fe9f1[_0x4afa('0x14')]]);}}catch(_0x4f0ef2){utils[_0x4afa('0x28')](util[_0x4afa('0x7')](_0x4afa('0x2b'),_0x2fe9f1[_0x4afa('0x14')]),_0x4f0ef2);}};exports[_0x4afa('0x34')]=function(_0x2360f8){try{if(!_[_0x4afa('0x1d')](channels[_0x2360f8['localtwolinkedid']])){utils['debug'](util[_0x4afa('0x7')](_0x4afa('0x35'),_0x2360f8['origtransfereruniqueid']),_0x2360f8);if(channels[_0x2360f8[_0x4afa('0x36')]][_0x4afa('0x9')]==_0x2360f8[_0x4afa('0x37')]){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x38'),_0x2360f8[_0x4afa('0x39')],_0x2360f8['localtwolinkedid'],_0x2360f8[_0x4afa('0x3a')]));channels[_0x2360f8[_0x4afa('0x36')]][_0x4afa('0x24')]=_0x2360f8[_0x4afa('0x3a')];channels[_0x2360f8['localtwolinkedid']][_0x4afa('0x3b')]='_attended';}else if(channels[_0x2360f8[_0x4afa('0x36')]]['channel']=_0x2360f8[_0x4afa('0x3c')]){utils['info'](util[_0x4afa('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2360f8[_0x4afa('0x39')],_0x2360f8[_0x4afa('0x36')],_0x2360f8[_0x4afa('0x3d')]));channels[_0x2360f8[_0x4afa('0x36')]][_0x4afa('0x24')]=_0x2360f8['origtransfererchannel'];channels[_0x2360f8[_0x4afa('0x36')]][_0x4afa('0x3b')]=_0x4afa('0x3e');}}}catch(_0x1478c2){utils['error'](util[_0x4afa('0x7')](_0x4afa('0x35'),_0x2360f8[_0x4afa('0x39')]),_0x1478c2);}};exports[_0x4afa('0x3f')]=function(_0x592dc9){try{if(!_[_0x4afa('0x1d')](channels[_0x592dc9[_0x4afa('0x14')]])){utils[_0x4afa('0x16')](util[_0x4afa('0x7')](_0x4afa('0x40'),_0x592dc9['uniqueid']),_0x592dc9);channels[_0x592dc9[_0x4afa('0x14')]][_0x4afa('0x41')]=utils[_0x4afa('0x1a')]();utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x42'),_0x592dc9[_0x4afa('0x14')],channels[_0x592dc9[_0x4afa('0x14')]][_0x4afa('0x41')]));}}catch(_0x3e4b35){utils[_0x4afa('0x28')](util['format'](_0x4afa('0x40'),_0x592dc9[_0x4afa('0x14')]),_0x3e4b35);}};exports[_0x4afa('0x43')]=function(_0x4642bd){try{if(!_[_0x4afa('0x1d')](channels[_0x4642bd['uniqueid']])){utils[_0x4afa('0x16')](util[_0x4afa('0x7')](_0x4afa('0x44'),_0x4642bd[_0x4afa('0x14')]),_0x4642bd);if(!_[_0x4afa('0x1d')](channels[_0x4642bd[_0x4afa('0x14')]][_0x4afa('0x41')])){channels[_0x4642bd[_0x4afa('0x14')]]['mohtime']+=utils[_0x4afa('0x33')](utils[_0x4afa('0x1a')](),channels[_0x4642bd['uniqueid']][_0x4afa('0x41')]);utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x45'),_0x4642bd[_0x4afa('0x14')],channels[_0x4642bd[_0x4afa('0x14')]][_0x4afa('0x46')]));delete channels[_0x4642bd['uniqueid']][_0x4afa('0x41')];}}}catch(_0x19abae){utils['error'](util[_0x4afa('0x7')](_0x4afa('0x44'),_0x4642bd[_0x4afa('0x14')]),_0x19abae);}};exports[_0x4afa('0x47')]=function(_0x247ca2){try{if(!_[_0x4afa('0x1d')](channels[_0x247ca2[_0x4afa('0x14')]])){utils[_0x4afa('0x16')](util[_0x4afa('0x7')](_0x4afa('0x48'),_0x247ca2['uniqueid']),_0x247ca2);if(!_['isNil'](_0x247ca2[_0x4afa('0x49')][_0x4afa('0x4a')])){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x4b'),_0x247ca2[_0x4afa('0x14')],_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2['uniqueid']]['source']=_0x247ca2['value'];}if(!_['isNil'](_0x247ca2['variable'][_0x4afa('0x4d')])){utils['info'](util[_0x4afa('0x7')](_0x4afa('0x4e'),_0x247ca2['uniqueid'],_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2[_0x4afa('0x14')]]['destination']=_0x247ca2[_0x4afa('0x4c')];channels[_0x247ca2['uniqueid']][_0x4afa('0x2c')]='\x22'+_0x247ca2[_0x4afa('0x4c')]+'\x22\x20<'+_0x247ca2[_0x4afa('0x4c')]+'>';}if(!_[_0x4afa('0x1d')](_0x247ca2['variable']['xmd-callerid-preview'])||!_['isNil'](_0x247ca2['variable'][_0x4afa('0x4f')])){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x50'),_0x247ca2[_0x4afa('0x14')],!_[_0x4afa('0x1d')](_0x247ca2[_0x4afa('0x49')][_0x4afa('0x51')])?_0x4afa('0x51'):'xmd-callerid',_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2[_0x4afa('0x14')]][_0x4afa('0x2c')]=_0x247ca2['value'];}if(!_[_0x4afa('0x1d')](_0x247ca2['variable'][_0x4afa('0x52')])||!_['isNil'](_0x247ca2[_0x4afa('0x49')][_0x4afa('0x53')])){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x50'),_0x247ca2[_0x4afa('0x14')],!_[_0x4afa('0x1d')](_0x247ca2[_0x4afa('0x49')][_0x4afa('0x52')])?_0x4afa('0x52'):_0x4afa('0x53'),_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2[_0x4afa('0x14')]][_0x4afa('0x54')]='Queue';channels[_0x247ca2['uniqueid']]['lastdata']=_0x247ca2[_0x4afa('0x4c')];channels[_0x247ca2['uniqueid']][_0x4afa('0xa')]=!![];}if(!_[_0x4afa('0x1d')](_0x247ca2[_0x4afa('0x49')]['xmd-contactid'])){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x55'),_0x247ca2[_0x4afa('0x14')],_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2[_0x4afa('0x14')]][_0x4afa('0x56')]=_0x247ca2[_0x4afa('0x4c')];}if(!_[_0x4afa('0x1d')](_0x247ca2[_0x4afa('0x49')][_0x4afa('0x57')])){utils[_0x4afa('0x6')](util['format'](_0x4afa('0x58'),_0x247ca2[_0x4afa('0x14')],_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2[_0x4afa('0x14')]]['type']=_0x247ca2['value'];}if(!_[_0x4afa('0x1d')](_0x247ca2[_0x4afa('0x49')][_0x4afa('0x59')])){utils[_0x4afa('0x6')](util[_0x4afa('0x7')](_0x4afa('0x5a'),_0x247ca2[_0x4afa('0x14')],_0x247ca2[_0x4afa('0x4c')]));channels[_0x247ca2[_0x4afa('0x14')]][_0x4afa('0x5b')]=_0x247ca2[_0x4afa('0x4c')];}if(!_[_0x4afa('0x1d')](_0x247ca2['variable'][_0x4afa('0x5c')])){utils['info'](util[_0x4afa('0x7')](_0x4afa('0x5d'),_0x247ca2['uniqueid'],_0x247ca2['value']));channels[_0x247ca2[_0x4afa('0x14')]][_0x4afa('0x5c')]=_0x247ca2['value'];}}}catch(_0x589ad4){utils[_0x4afa('0x28')](util['format'](_0x4afa('0x48'),_0x247ca2[_0x4afa('0x14')]),_0x589ad4);}};exports[_0x4afa('0x5e')]=function(_0x284ab8){try{if(!_[_0x4afa('0x1d')](channels[_0x284ab8[_0x4afa('0x14')]])){utils[_0x4afa('0x16')](util[_0x4afa('0x7')](_0x4afa('0x5f'),_0x284ab8[_0x4afa('0x14')]),_0x284ab8);utils[_0x4afa('0x6')](util['format'](_0x4afa('0x60'),_0x284ab8[_0x4afa('0x14')],_0x284ab8[_0x4afa('0x61')],_0x284ab8[_0x4afa('0x62')]));if(_0x284ab8[_0x4afa('0x61')][_0x4afa('0x63')]()=='set'&&_[_0x4afa('0x64')](_0x284ab8['appdata'][_0x4afa('0x63')](),_0x4afa('0x65'))){var _0x1c8ff5=_0x284ab8[_0x4afa('0x62')]['split']('=');var _0x26bfae=_0x1c8ff5[0x0][_0x4afa('0x66')](_0x1c8ff5[0x0][_0x4afa('0x67')]('(')+0x1,_0x1c8ff5[0x0][_0x4afa('0x67')](')'));var _0x2eff08=_0x1c8ff5[0x1];channels[_0x284ab8[_0x4afa('0x14')]][_0x26bfae]=_0x2eff08;}if(!_[_0x4afa('0x68')]([_0x4afa('0x2a'),_0x4afa('0x69'),_0x4afa('0x6a'),_0x4afa('0x6b'),'gotoif'],_0x284ab8[_0x4afa('0x61')]['toLowerCase']())){channels[_0x284ab8[_0x4afa('0x14')]]['lastapplication']=_0x284ab8[_0x4afa('0x61')];channels[_0x284ab8[_0x4afa('0x14')]][_0x4afa('0x6c')]=_0x284ab8[_0x4afa('0x62')];}}}catch(_0x14afd4){utils[_0x4afa('0x28')](util['format'](_0x4afa('0x5f'),_0x284ab8[_0x4afa('0x14')]),_0x14afd4);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e6c7153..585b560 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 _0x2d6b=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','./utils'];(function(_0x4a74c1,_0x29c762){var _0x1ed207=function(_0x2c89ec){while(--_0x2c89ec){_0x4a74c1['push'](_0x4a74c1['shift']());}};_0x1ed207(++_0x29c762);}(_0x2d6b,0xf1));var _0xb2d6=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x2d6b[_0x11005e];return _0x29338f;};'use strict';var utils=require(_0xb2d6('0x0'));exports[_0xb2d6('0x1')]=function(){utils[_0xb2d6('0x2')](_0xb2d6('0x3'));};exports[_0xb2d6('0x4')]=function(){utils[_0xb2d6('0x2')](_0xb2d6('0x5'));};exports[_0xb2d6('0x6')]=function(){utils['info'](_0xb2d6('0x7'));};exports[_0xb2d6('0x8')]=function(_0x19b1a9){utils['error'](_0xb2d6('0x9'),_0x19b1a9);};exports[_0xb2d6('0xa')]=function(){utils[_0xb2d6('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x49ba8a){}; \ No newline at end of file +var _0x5c0d=['[core]\x20fullybooted','error','[core]\x20close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c0d,0x9a));var _0xd5c0=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x5c0d[_0x1c546c];return _0x2cc384;};'use strict';var utils=require(_0xd5c0('0x0'));exports[_0xd5c0('0x1')]=function(){utils[_0xd5c0('0x2')]('[core]\x20connected');};exports[_0xd5c0('0x3')]=function(){utils[_0xd5c0('0x2')](_0xd5c0('0x4'));};exports[_0xd5c0('0x5')]=function(){utils[_0xd5c0('0x2')](_0xd5c0('0x6'));};exports[_0xd5c0('0x7')]=function(_0x4019bd){utils[_0xd5c0('0x7')]('[core]\x20error',_0x4019bd);};exports['close']=function(){utils[_0xd5c0('0x2')](_0xd5c0('0x8'));};exports[_0xd5c0('0x9')]=function(_0x29547e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 62a1f57..9cecac1 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 _0x63a1=['answertime','now','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','dialstatus','CreateVoiceDialReport','uniqueid','[%s][dials][newexten]','application','toLowerCase','set','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','debug','[%s][dials][dialbegin]','assign','starttime','lastevent','called','dialend','ANSWER'];(function(_0x15544a,_0x4e802f){var _0x5dd90f=function(_0x12064f){while(--_0x12064f){_0x15544a['push'](_0x15544a['shift']());}};_0x5dd90f(++_0x4e802f);}(_0x63a1,0x1a0));var _0x163a=function(_0x41f56f,_0x8e1b2b){_0x41f56f=_0x41f56f-0x0;var _0x5618ef=_0x63a1[_0x41f56f];return _0x5618ef;};'use strict';var _=require(_0x163a('0x0'));var util=require('util');var utils=require(_0x163a('0x1'));var dials={};function writeDB(_0x1712aa){utils[_0x163a('0x2')](util[_0x163a('0x3')](_0x163a('0x4'),_0x1712aa['uniqueid'],_0x1712aa[_0x163a('0x5')],_0x1712aa['dialstring'],_0x1712aa[_0x163a('0x6')],_0x1712aa['connectedlinenum'],_0x1712aa[_0x163a('0x7')]));utils['request'](_0x163a('0x8'),_0x1712aa);delete dials[_0x1712aa[_0x163a('0x9')]];}exports['newexten']=function(_0x4b4bdc){try{utils['debug'](util['format'](_0x163a('0xa'),_0x4b4bdc['uniqueid']),_0x4b4bdc);utils[_0x163a('0x2')](util[_0x163a('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4b4bdc[_0x163a('0x9')],_0x4b4bdc[_0x163a('0xb')],_0x4b4bdc['appdata']));if(_0x4b4bdc['application'][_0x163a('0xc')]()==_0x163a('0xd')&&_['startsWith'](_0x4b4bdc[_0x163a('0xe')][_0x163a('0xc')](),_0x163a('0xf'))){var _0x3224e1=_0x4b4bdc[_0x163a('0xe')][_0x163a('0x10')]('=');dials[_0x4b4bdc[_0x163a('0x9')]]={'routeId':_0x3224e1[0x1]};}}catch(_0x5a8c94){utils[_0x163a('0x11')](util[_0x163a('0x3')](_0x163a('0xa'),_0x4b4bdc[_0x163a('0x9')]),_0x5a8c94);}};exports[_0x163a('0x12')]=function(_0x5d6647){try{utils['debug'](util[_0x163a('0x3')](_0x163a('0x13'),_0x5d6647['uniqueid']),_0x5d6647);if(!_[_0x163a('0x14')](_0x5d6647[_0x163a('0x15')][_0x163a('0x16')])){utils[_0x163a('0x2')](util[_0x163a('0x3')](_0x163a('0x17'),_0x5d6647[_0x163a('0x9')],_0x5d6647[_0x163a('0x18')]));dials[_0x5d6647[_0x163a('0x9')]]={'routeId':_0x5d6647[_0x163a('0x18')]};}}catch(_0x424069){utils['error'](util[_0x163a('0x3')]('[%s][dials][varset]',_0x5d6647[_0x163a('0x9')]),_0x424069);}};exports[_0x163a('0x19')]=function(_0x11f1b3){try{if(!_[_0x163a('0x14')](dials[_0x11f1b3['uniqueid']])){utils[_0x163a('0x1a')](util[_0x163a('0x3')](_0x163a('0x1b'),_0x11f1b3[_0x163a('0x9')]),_0x11f1b3);dials[_0x11f1b3['uniqueid']]=_[_0x163a('0x1c')](dials[_0x11f1b3[_0x163a('0x9')]],_0x11f1b3);dials[_0x11f1b3[_0x163a('0x9')]][_0x163a('0x1d')]=utils['now']();dials[_0x11f1b3[_0x163a('0x9')]][_0x163a('0x1e')]=_0x163a('0x1f');utils[_0x163a('0x2')](util[_0x163a('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x11f1b3[_0x163a('0x9')],dials[_0x11f1b3[_0x163a('0x9')]][_0x163a('0x1d')]));}}catch(_0x525b2e){utils[_0x163a('0x11')](util['format'](_0x163a('0x1b'),_0x11f1b3[_0x163a('0x9')]),_0x525b2e);}};exports[_0x163a('0x20')]=function(_0x3fdaca){try{if(!_[_0x163a('0x14')](dials[_0x3fdaca[_0x163a('0x9')]])){utils[_0x163a('0x1a')](util[_0x163a('0x3')]('[%s][dials][dialend]',_0x3fdaca[_0x163a('0x9')]),_0x3fdaca);dials[_0x3fdaca['uniqueid']][_0x163a('0x7')]=_0x3fdaca[_0x163a('0x7')];if(_0x3fdaca[_0x163a('0x7')]==_0x163a('0x21')){dials[_0x3fdaca['uniqueid']]=_[_0x163a('0x1c')](dials[_0x3fdaca[_0x163a('0x9')]],_0x3fdaca);dials[_0x3fdaca[_0x163a('0x9')]][_0x163a('0x22')]=utils[_0x163a('0x23')]();dials[_0x3fdaca[_0x163a('0x9')]][_0x163a('0x1e')]='connect';utils[_0x163a('0x2')](util[_0x163a('0x3')](_0x163a('0x24'),_0x3fdaca['uniqueid'],_0x3fdaca[_0x163a('0x7')],dials[_0x3fdaca[_0x163a('0x9')]][_0x163a('0x22')]));}else{utils['info'](util['format'](_0x163a('0x25'),_0x3fdaca[_0x163a('0x9')],_0x3fdaca[_0x163a('0x7')]));}}}catch(_0x149ae9){utils[_0x163a('0x11')](util['format'](_0x163a('0x26'),_0x3fdaca['uniqueid']),_0x149ae9);}};exports[_0x163a('0x27')]=function(_0x284d56){try{if(!_['isNil'](dials[_0x284d56[_0x163a('0x9')]])){utils[_0x163a('0x1a')](util[_0x163a('0x3')](_0x163a('0x28'),_0x284d56['uniqueid']),_0x284d56);utils[_0x163a('0x2')](util[_0x163a('0x3')](_0x163a('0x29'),_0x284d56[_0x163a('0x9')],_0x284d56[_0x163a('0x6')],_0x284d56[_0x163a('0x2a')],_0x284d56[_0x163a('0x2b')]));dials[_0x284d56[_0x163a('0x9')]]=_[_0x163a('0x1c')](dials[_0x284d56['uniqueid']],{'endtime':utils[_0x163a('0x23')](),'lastevent':_0x163a('0x2c')});dials[_0x284d56[_0x163a('0x9')]][_0x163a('0x2d')]=utils[_0x163a('0x2e')](dials[_0x284d56[_0x163a('0x9')]]['endtime'],dials[_0x284d56['uniqueid']][_0x163a('0x1d')]);dials[_0x284d56[_0x163a('0x9')]][_0x163a('0x2f')]=utils[_0x163a('0x2e')](dials[_0x284d56[_0x163a('0x9')]]['answertime']||dials[_0x284d56[_0x163a('0x9')]][_0x163a('0x30')],dials[_0x284d56[_0x163a('0x9')]][_0x163a('0x1d')]);dials[_0x284d56[_0x163a('0x9')]][_0x163a('0x31')]=dials[_0x284d56['uniqueid']]['answertime']?utils[_0x163a('0x2e')](dials[_0x284d56['uniqueid']][_0x163a('0x30')],dials[_0x284d56[_0x163a('0x9')]][_0x163a('0x22')]):0x0;writeDB(dials[_0x284d56[_0x163a('0x9')]]);}}catch(_0x47fb82){utils['error'](util[_0x163a('0x3')](_0x163a('0x28'),_0x284d56[_0x163a('0x9')]),_0x47fb82);}}; \ No newline at end of file +var _0xca69=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','holdtime','diffTime','endtime','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','format','[%s][dials][newexten]','application','toLowerCase','set','appdata','split','varset','debug','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','connect'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xca69,0x12b));var _0x9ca6=function(_0x1240db,_0x534893){_0x1240db=_0x1240db-0x0;var _0x37ec62=_0xca69[_0x1240db];return _0x37ec62;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9ca6('0x0'));var dials={};function writeDB(_0x1550d9){utils[_0x9ca6('0x1')](util['format'](_0x9ca6('0x2'),_0x1550d9[_0x9ca6('0x3')],_0x1550d9[_0x9ca6('0x4')],_0x1550d9[_0x9ca6('0x5')],_0x1550d9[_0x9ca6('0x6')],_0x1550d9[_0x9ca6('0x7')],_0x1550d9[_0x9ca6('0x8')]));utils['request'](_0x9ca6('0x9'),_0x1550d9);delete dials[_0x1550d9[_0x9ca6('0x3')]];}exports['newexten']=function(_0x21aa01){try{utils['debug'](util[_0x9ca6('0xa')](_0x9ca6('0xb'),_0x21aa01['uniqueid']),_0x21aa01);utils[_0x9ca6('0x1')](util[_0x9ca6('0xa')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x21aa01[_0x9ca6('0x3')],_0x21aa01[_0x9ca6('0xc')],_0x21aa01['appdata']));if(_0x21aa01['application'][_0x9ca6('0xd')]()==_0x9ca6('0xe')&&_['startsWith'](_0x21aa01[_0x9ca6('0xf')][_0x9ca6('0xd')](),'cdr(routeid)')){var _0x9a8b32=_0x21aa01[_0x9ca6('0xf')][_0x9ca6('0x10')]('=');dials[_0x21aa01['uniqueid']]={'routeId':_0x9a8b32[0x1]};}}catch(_0x3f9366){utils['error'](util[_0x9ca6('0xa')]('[%s][dials][newexten]',_0x21aa01[_0x9ca6('0x3')]),_0x3f9366);}};exports[_0x9ca6('0x11')]=function(_0x3c877d){try{utils[_0x9ca6('0x12')](util[_0x9ca6('0xa')]('[%s][dials][varset]',_0x3c877d[_0x9ca6('0x3')]),_0x3c877d);if(!_[_0x9ca6('0x13')](_0x3c877d['variable'][_0x9ca6('0x14')])){utils[_0x9ca6('0x1')](util[_0x9ca6('0xa')](_0x9ca6('0x15'),_0x3c877d[_0x9ca6('0x3')],_0x3c877d[_0x9ca6('0x16')]));dials[_0x3c877d[_0x9ca6('0x3')]]={'routeId':_0x3c877d['value']};}}catch(_0x162979){utils[_0x9ca6('0x17')](util[_0x9ca6('0xa')](_0x9ca6('0x18'),_0x3c877d[_0x9ca6('0x3')]),_0x162979);}};exports[_0x9ca6('0x19')]=function(_0x58094f){try{if(!_[_0x9ca6('0x13')](dials[_0x58094f[_0x9ca6('0x3')]])){utils[_0x9ca6('0x12')](util[_0x9ca6('0xa')]('[%s][dials][dialbegin]',_0x58094f['uniqueid']),_0x58094f);dials[_0x58094f[_0x9ca6('0x3')]]=_[_0x9ca6('0x1a')](dials[_0x58094f['uniqueid']],_0x58094f);dials[_0x58094f[_0x9ca6('0x3')]][_0x9ca6('0x1b')]=utils[_0x9ca6('0x1c')]();dials[_0x58094f[_0x9ca6('0x3')]][_0x9ca6('0x1d')]=_0x9ca6('0x1e');utils[_0x9ca6('0x1')](util[_0x9ca6('0xa')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x58094f[_0x9ca6('0x3')],dials[_0x58094f[_0x9ca6('0x3')]][_0x9ca6('0x1b')]));}}catch(_0x359bfe){utils[_0x9ca6('0x17')](util[_0x9ca6('0xa')](_0x9ca6('0x1f'),_0x58094f[_0x9ca6('0x3')]),_0x359bfe);}};exports[_0x9ca6('0x20')]=function(_0x1ab7e2){try{if(!_['isNil'](dials[_0x1ab7e2[_0x9ca6('0x3')]])){utils[_0x9ca6('0x12')](util[_0x9ca6('0xa')](_0x9ca6('0x21'),_0x1ab7e2['uniqueid']),_0x1ab7e2);dials[_0x1ab7e2[_0x9ca6('0x3')]][_0x9ca6('0x8')]=_0x1ab7e2[_0x9ca6('0x8')];if(_0x1ab7e2[_0x9ca6('0x8')]==_0x9ca6('0x22')){dials[_0x1ab7e2[_0x9ca6('0x3')]]=_[_0x9ca6('0x1a')](dials[_0x1ab7e2[_0x9ca6('0x3')]],_0x1ab7e2);dials[_0x1ab7e2[_0x9ca6('0x3')]][_0x9ca6('0x23')]=utils['now']();dials[_0x1ab7e2['uniqueid']]['lastevent']=_0x9ca6('0x24');utils[_0x9ca6('0x1')](util['format'](_0x9ca6('0x25'),_0x1ab7e2[_0x9ca6('0x3')],_0x1ab7e2[_0x9ca6('0x8')],dials[_0x1ab7e2['uniqueid']][_0x9ca6('0x23')]));}else{utils['info'](util['format'](_0x9ca6('0x26'),_0x1ab7e2[_0x9ca6('0x3')],_0x1ab7e2[_0x9ca6('0x8')]));}}}catch(_0x6a0181){utils[_0x9ca6('0x17')](util[_0x9ca6('0xa')](_0x9ca6('0x21'),_0x1ab7e2[_0x9ca6('0x3')]),_0x6a0181);}};exports[_0x9ca6('0x27')]=function(_0x593743){try{if(!_[_0x9ca6('0x13')](dials[_0x593743[_0x9ca6('0x3')]])){utils[_0x9ca6('0x12')](util[_0x9ca6('0xa')](_0x9ca6('0x28'),_0x593743[_0x9ca6('0x3')]),_0x593743);utils[_0x9ca6('0x1')](util[_0x9ca6('0xa')](_0x9ca6('0x29'),_0x593743['uniqueid'],_0x593743['calleridnum'],_0x593743['calleridname'],_0x593743[_0x9ca6('0x2a')]));dials[_0x593743['uniqueid']]=_[_0x9ca6('0x1a')](dials[_0x593743[_0x9ca6('0x3')]],{'endtime':utils['now'](),'lastevent':_0x9ca6('0x2b')});dials[_0x593743[_0x9ca6('0x3')]][_0x9ca6('0x2c')]=utils['diffTime'](dials[_0x593743['uniqueid']]['endtime'],dials[_0x593743[_0x9ca6('0x3')]]['starttime']);dials[_0x593743[_0x9ca6('0x3')]][_0x9ca6('0x2d')]=utils[_0x9ca6('0x2e')](dials[_0x593743[_0x9ca6('0x3')]]['answertime']||dials[_0x593743['uniqueid']][_0x9ca6('0x2f')],dials[_0x593743[_0x9ca6('0x3')]]['starttime']);dials[_0x593743['uniqueid']]['billableseconds']=dials[_0x593743[_0x9ca6('0x3')]][_0x9ca6('0x23')]?utils[_0x9ca6('0x2e')](dials[_0x593743['uniqueid']]['endtime'],dials[_0x593743[_0x9ca6('0x3')]]['answertime']):0x0;writeDB(dials[_0x593743[_0x9ca6('0x3')]]);}}catch(_0x34a925){utils['error'](util[_0x9ca6('0xa')](_0x9ca6('0x28'),_0x593743[_0x9ca6('0x3')]),_0x34a925);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 197a5c9..3e4589e 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 _0xabb0=['[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xabb0,0xdc));var _0x0abb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabb0[_0x501510];return _0x1e6ee5;};var AsteriskManager=require(_0x0abb('0x0'));var config=require(_0x0abb('0x1'));var utils=require(_0x0abb('0x2'));var util=require(_0x0abb('0x3'));var isXDREnabled=config[_0x0abb('0x4')]&&config[_0x0abb('0x4')][_0x0abb('0x5')]?!config[_0x0abb('0x4')][_0x0abb('0x5')]:!![];var isProduction=config[_0x0abb('0x6')]===_0x0abb('0x7')||![];var isLocalAsterisk=config[_0x0abb('0x4')]&&config['xdr'][_0x0abb('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x0abb('0x9')][_0x0abb('0xa')],config[_0x0abb('0x9')]['ip'],config[_0x0abb('0x9')][_0x0abb('0xb')],config[_0x0abb('0x9')]['password'],!![]);ami[_0x0abb('0xc')]();if(!isXDREnabled){utils[_0x0abb('0xd')](_0x0abb('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0abb('0xd')](_0x0abb('0xf'));}else{var agents=require(_0x0abb('0x10'));var calls=require('./calls.controller');var queues=require(_0x0abb('0x11'));var recordings=require('./recordings.controller');var members=require(_0x0abb('0x12'));var dials=require(_0x0abb('0x13'));var transfers=require(_0x0abb('0x14'));var core=require('./core.controller');ami['on'](_0x0abb('0x15'),core[_0x0abb('0x15')]);ami['on'](_0x0abb('0x16'),core[_0x0abb('0x16')]);ami['on']('fullybooted',core[_0x0abb('0x17')]);ami['on'](_0x0abb('0x18'),core[_0x0abb('0x18')]);ami['on'](_0x0abb('0x19'),core[_0x0abb('0x19')]);ami['on']('managerevent',core[_0x0abb('0x1a')]);ami['on'](_0x0abb('0x1b'),function(_0x42df24){try{utils[_0x0abb('0x1c')](util['format']('[%s][index][devicestatechange]',_0x42df24[_0x0abb('0x1d')]),_0x42df24);members[_0x0abb('0x1b')](_0x42df24);}catch(_0x485e54){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x1f'),_0x42df24[_0x0abb('0x1d')]),_0x485e54);}});ami['on'](_0x0abb('0x20'),function(_0x4335e1){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')](_0x0abb('0x21'),_0x4335e1[_0x0abb('0x22')]),_0x4335e1);agents[_0x0abb('0x20')](_0x4335e1);}catch(_0x3402a7){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x21'),_0x4335e1[_0x0abb('0x22')]),_0x3402a7);}});ami['on'](_0x0abb('0x23'),function(_0x2eb62f){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')](_0x0abb('0x24'),_0x2eb62f[_0x0abb('0x22')]),_0x2eb62f);agents[_0x0abb('0x23')](_0x2eb62f);}catch(_0x4602f9){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')]('[%s][index][agentringnoanswer]',_0x2eb62f[_0x0abb('0x22')]),_0x4602f9);}});ami['on'](_0x0abb('0x25'),function(_0x1cd2f8){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')](_0x0abb('0x26'),_0x1cd2f8[_0x0abb('0x22')]),_0x1cd2f8);agents['agentconnect'](_0x1cd2f8);queues[_0x0abb('0x25')](_0x1cd2f8);}catch(_0x448ee4){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x26'),_0x1cd2f8[_0x0abb('0x22')]),_0x448ee4);}});ami['on'](_0x0abb('0x27'),function(_0xe8e7ff){try{utils['debug'](util[_0x0abb('0x1e')](_0x0abb('0x28'),_0xe8e7ff[_0x0abb('0x22')]),_0xe8e7ff);agents['agentcomplete'](_0xe8e7ff);queues['agentcomplete'](_0xe8e7ff);members[_0x0abb('0x27')](_0xe8e7ff);}catch(_0x394cd0){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x28'),_0xe8e7ff[_0x0abb('0x22')]),_0x394cd0);}});ami['on'](_0x0abb('0x29'),function(_0x205049){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')]('[%s][index][queuecallerabandon]',_0x205049[_0x0abb('0x22')]),_0x205049);agents[_0x0abb('0x29')](_0x205049);queues['queuecallerabandon'](_0x205049);}catch(_0x9620bf){utils['error'](util[_0x0abb('0x1e')](_0x0abb('0x2a'),_0x205049[_0x0abb('0x22')]),_0x9620bf);}});ami['on'](_0x0abb('0x2b'),function(_0x481bb1){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')](_0x0abb('0x2c'),_0x481bb1[_0x0abb('0x22')]),_0x481bb1);queues[_0x0abb('0x2b')](_0x481bb1);recordings['queuecallerjoin'](_0x481bb1);}catch(_0x2a86f3){utils['error'](util[_0x0abb('0x1e')](_0x0abb('0x2c'),_0x481bb1['uniqueid']),_0x2a86f3);}});ami['on'](_0x0abb('0x2d'),function(_0x225fc5){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')](_0x0abb('0x2e'),_0x225fc5[_0x0abb('0x22')]),_0x225fc5);queues[_0x0abb('0x2d')](_0x225fc5);}catch(_0xdad303){utils['error'](util[_0x0abb('0x1e')](_0x0abb('0x2e'),_0x225fc5[_0x0abb('0x22')]),_0xdad303);}});ami['on'](_0x0abb('0x2f'),function(_0x560365){try{utils[_0x0abb('0x1c')](util['format'](_0x0abb('0x30'),_0x560365[_0x0abb('0x22')]),_0x560365);queues['musiconholdstart'](_0x560365);calls[_0x0abb('0x2f')](_0x560365);}catch(_0x2bfdd9){utils['error'](util[_0x0abb('0x1e')](_0x0abb('0x30'),_0x560365[_0x0abb('0x22')]),_0x2bfdd9);}});ami['on'](_0x0abb('0x31'),function(_0x3ff78b){try{utils['debug'](util[_0x0abb('0x1e')](_0x0abb('0x32'),_0x3ff78b[_0x0abb('0x22')]),_0x3ff78b);queues[_0x0abb('0x31')](_0x3ff78b);calls[_0x0abb('0x31')](_0x3ff78b);}catch(_0x1c0b7c){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x32'),_0x3ff78b[_0x0abb('0x22')]),_0x1c0b7c);}});ami['on'](_0x0abb('0x33'),function(_0x59ec97){try{utils[_0x0abb('0x1c')](util['format'](_0x0abb('0x34'),_0x59ec97[_0x0abb('0x22')]),_0x59ec97);calls[_0x0abb('0x33')](_0x59ec97);recordings[_0x0abb('0x33')](_0x59ec97);}catch(_0x46b737){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x34'),_0x59ec97[_0x0abb('0x22')]),_0x46b737);}});ami['on'](_0x0abb('0x35'),function(_0x3c0004){try{utils[_0x0abb('0x1c')](util['format']('[%s][index][hangup]',_0x3c0004['uniqueid']),_0x3c0004);calls['hangup'](_0x3c0004);recordings[_0x0abb('0x35')](_0x3c0004);dials[_0x0abb('0x35')](_0x3c0004);agents[_0x0abb('0x35')](_0x3c0004);queues['hangup'](_0x3c0004);}catch(_0x4f1c46){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')]('[%s][index][hangup]',_0x3c0004[_0x0abb('0x22')]),_0x4f1c46);}});ami['on']('cdr',function(_0x414b82){try{utils['debug'](util[_0x0abb('0x1e')](_0x0abb('0x36'),_0x414b82[_0x0abb('0x22')]),_0x414b82);members[_0x0abb('0x37')](_0x414b82);}catch(_0x5380d6){utils['error'](util[_0x0abb('0x1e')](_0x0abb('0x36'),_0x414b82[_0x0abb('0x22')]),_0x5380d6);}});ami['on'](_0x0abb('0x38'),function(_0x438ca6){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')]('[%s][index][blindtransfer]',_0x438ca6[_0x0abb('0x22')]),_0x438ca6);queues[_0x0abb('0x38')](_0x438ca6);agents['blindtransfer'](_0x438ca6);transfers[_0x0abb('0x38')](_0x438ca6);}catch(_0x1eaffb){utils[_0x0abb('0x18')](util['format'](_0x0abb('0x39'),_0x438ca6[_0x0abb('0x22')]),_0x1eaffb);}});ami['on']('attendedtransfer',function(_0x5e585a){try{utils['debug'](util[_0x0abb('0x1e')](_0x0abb('0x3a'),_0x5e585a['origtransfereruniqueid']),_0x5e585a);queues[_0x0abb('0x3b')](_0x5e585a);transfers[_0x0abb('0x3b')](_0x5e585a);agents['attendedtransfer'](_0x5e585a);calls[_0x0abb('0x3b')](_0x5e585a);}catch(_0x22d796){utils[_0x0abb('0x18')](util['format'](_0x0abb('0x3a'),_0x5e585a[_0x0abb('0x3c')]),_0x22d796);}});ami['on'](_0x0abb('0x3d'),function(_0x24cfff){try{utils['debug'](util[_0x0abb('0x1e')]('[%s][index][varset]',_0x24cfff[_0x0abb('0x22')]),_0x24cfff);queues['varset'](_0x24cfff);recordings[_0x0abb('0x3d')](_0x24cfff);calls[_0x0abb('0x3d')](_0x24cfff);dials[_0x0abb('0x3d')](_0x24cfff);}catch(_0x5141f7){utils[_0x0abb('0x18')](util['format'](_0x0abb('0x3e'),_0x24cfff[_0x0abb('0x22')]),_0x5141f7);}});ami['on']('newexten',function(_0x32c51b){try{utils['debug'](util[_0x0abb('0x1e')]('[%s][index][newexten]',_0x32c51b[_0x0abb('0x22')]),_0x32c51b);calls['newexten'](_0x32c51b);recordings[_0x0abb('0x3f')](_0x32c51b);dials['newexten'](_0x32c51b);}catch(_0x354a97){utils['error'](util[_0x0abb('0x1e')](_0x0abb('0x40'),_0x32c51b['uniqueid']),_0x354a97);}});ami['on']('newchannel',function(_0x36bf9b){try{utils['debug'](util[_0x0abb('0x1e')](_0x0abb('0x41'),_0x36bf9b[_0x0abb('0x22')]),_0x36bf9b);calls[_0x0abb('0x42')](_0x36bf9b);recordings['newchannel'](_0x36bf9b);}catch(_0x1402b4){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x41'),_0x36bf9b['uniqueid']),_0x1402b4);}});ami['on']('dialbegin',function(_0x2405dd){try{utils[_0x0abb('0x1c')](util['format'](_0x0abb('0x43'),_0x2405dd['uniqueid']),_0x2405dd);dials[_0x0abb('0x44')](_0x2405dd);}catch(_0x53fab6){utils[_0x0abb('0x18')](util[_0x0abb('0x1e')](_0x0abb('0x45'),_0x2405dd[_0x0abb('0x22')]),_0x53fab6);}});ami['on'](_0x0abb('0x46'),function(_0x352dea){try{utils[_0x0abb('0x1c')](util[_0x0abb('0x1e')]('[%s][index][dialend]',_0x352dea[_0x0abb('0x22')]),_0x352dea);dials[_0x0abb('0x46')](_0x352dea);}catch(_0x6b2d7f){utils[_0x0abb('0x18')](util['format']('[%s][index][dialend]',_0x352dea['uniqueid']),_0x6b2d7f);}});} \ No newline at end of file +var _0x130d=['./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','debug','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller'];(function(_0xa94f0a,_0x5db0c3){var _0x814568=function(_0x2df99e){while(--_0x2df99e){_0xa94f0a['push'](_0xa94f0a['shift']());}};_0x814568(++_0x5db0c3);}(_0x130d,0x1ac));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xd130('0x0'));var config=require(_0xd130('0x1'));var utils=require(_0xd130('0x2'));var util=require(_0xd130('0x3'));var isXDREnabled=config[_0xd130('0x4')]&&config[_0xd130('0x4')][_0xd130('0x5')]?!config[_0xd130('0x4')][_0xd130('0x5')]:!![];var isProduction=config[_0xd130('0x6')]===_0xd130('0x7')||![];var isLocalAsterisk=config[_0xd130('0x4')]&&config[_0xd130('0x4')][_0xd130('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xd130('0x9')]['port'],config[_0xd130('0x9')]['ip'],config[_0xd130('0x9')][_0xd130('0xa')],config['asterisk'][_0xd130('0xb')],!![]);ami[_0xd130('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xd130('0xd')](_0xd130('0xe'));}else{var agents=require(_0xd130('0xf'));var calls=require(_0xd130('0x10'));var queues=require(_0xd130('0x11'));var recordings=require(_0xd130('0x12'));var members=require(_0xd130('0x13'));var dials=require(_0xd130('0x14'));var transfers=require(_0xd130('0x15'));var core=require(_0xd130('0x16'));ami['on'](_0xd130('0x17'),core[_0xd130('0x17')]);ami['on'](_0xd130('0x18'),core['shutdown']);ami['on'](_0xd130('0x19'),core[_0xd130('0x19')]);ami['on'](_0xd130('0x1a'),core[_0xd130('0x1a')]);ami['on'](_0xd130('0x1b'),core[_0xd130('0x1b')]);ami['on'](_0xd130('0x1c'),core[_0xd130('0x1c')]);ami['on'](_0xd130('0x1d'),function(_0x46a01c){try{utils['debug'](util['format'](_0xd130('0x1e'),_0x46a01c[_0xd130('0x1f')]),_0x46a01c);members[_0xd130('0x1d')](_0x46a01c);}catch(_0x1620e1){utils['error'](util[_0xd130('0x20')](_0xd130('0x1e'),_0x46a01c[_0xd130('0x1f')]),_0x1620e1);}});ami['on'](_0xd130('0x21'),function(_0x2e8ac2){try{utils['debug'](util[_0xd130('0x20')](_0xd130('0x22'),_0x2e8ac2[_0xd130('0x23')]),_0x2e8ac2);agents['agentcalled'](_0x2e8ac2);}catch(_0x4a14cc){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x22'),_0x2e8ac2[_0xd130('0x23')]),_0x4a14cc);}});ami['on'](_0xd130('0x24'),function(_0x424d20){try{utils['debug'](util[_0xd130('0x20')](_0xd130('0x25'),_0x424d20[_0xd130('0x23')]),_0x424d20);agents[_0xd130('0x24')](_0x424d20);}catch(_0x1fbf7c){utils[_0xd130('0x1a')](util['format']('[%s][index][agentringnoanswer]',_0x424d20[_0xd130('0x23')]),_0x1fbf7c);}});ami['on'](_0xd130('0x26'),function(_0x4a7af0){try{utils['debug'](util['format'](_0xd130('0x27'),_0x4a7af0[_0xd130('0x23')]),_0x4a7af0);agents[_0xd130('0x26')](_0x4a7af0);queues[_0xd130('0x26')](_0x4a7af0);}catch(_0x39e2fb){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x27'),_0x4a7af0[_0xd130('0x23')]),_0x39e2fb);}});ami['on'](_0xd130('0x28'),function(_0x62137d){try{utils[_0xd130('0x29')](util['format'](_0xd130('0x2a'),_0x62137d[_0xd130('0x23')]),_0x62137d);agents[_0xd130('0x28')](_0x62137d);queues['agentcomplete'](_0x62137d);members[_0xd130('0x28')](_0x62137d);}catch(_0x4284ea){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x2a'),_0x62137d[_0xd130('0x23')]),_0x4284ea);}});ami['on'](_0xd130('0x2b'),function(_0x2518d7){try{utils[_0xd130('0x29')](util[_0xd130('0x20')]('[%s][index][queuecallerabandon]',_0x2518d7[_0xd130('0x23')]),_0x2518d7);agents[_0xd130('0x2b')](_0x2518d7);queues[_0xd130('0x2b')](_0x2518d7);}catch(_0x4ef2a9){utils[_0xd130('0x1a')](util['format'](_0xd130('0x2c'),_0x2518d7[_0xd130('0x23')]),_0x4ef2a9);}});ami['on']('queuecallerjoin',function(_0x1c46df){try{utils[_0xd130('0x29')](util[_0xd130('0x20')](_0xd130('0x2d'),_0x1c46df[_0xd130('0x23')]),_0x1c46df);queues[_0xd130('0x2e')](_0x1c46df);recordings[_0xd130('0x2e')](_0x1c46df);}catch(_0x36a6f1){utils['error'](util[_0xd130('0x20')](_0xd130('0x2d'),_0x1c46df[_0xd130('0x23')]),_0x36a6f1);}});ami['on']('queuecallerleave',function(_0x3dbf55){try{utils['debug'](util[_0xd130('0x20')]('[%s][index][queuecallerleave]',_0x3dbf55[_0xd130('0x23')]),_0x3dbf55);queues[_0xd130('0x2f')](_0x3dbf55);}catch(_0x4f60b6){utils[_0xd130('0x1a')](util['format'](_0xd130('0x30'),_0x3dbf55[_0xd130('0x23')]),_0x4f60b6);}});ami['on'](_0xd130('0x31'),function(_0x14ef31){try{utils[_0xd130('0x29')](util[_0xd130('0x20')](_0xd130('0x32'),_0x14ef31[_0xd130('0x23')]),_0x14ef31);queues[_0xd130('0x31')](_0x14ef31);calls[_0xd130('0x31')](_0x14ef31);}catch(_0x19af1c){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x32'),_0x14ef31[_0xd130('0x23')]),_0x19af1c);}});ami['on'](_0xd130('0x33'),function(_0x1a03da){try{utils[_0xd130('0x29')](util[_0xd130('0x20')]('[%s][index][musiconholdstop]',_0x1a03da['uniqueid']),_0x1a03da);queues['musiconholdstop'](_0x1a03da);calls['musiconholdstop'](_0x1a03da);}catch(_0x1405e4){utils['error'](util[_0xd130('0x20')](_0xd130('0x34'),_0x1a03da['uniqueid']),_0x1405e4);}});ami['on']('newstate',function(_0x3bbe2c){try{utils['debug'](util[_0xd130('0x20')](_0xd130('0x35'),_0x3bbe2c[_0xd130('0x23')]),_0x3bbe2c);calls[_0xd130('0x36')](_0x3bbe2c);recordings['newstate'](_0x3bbe2c);}catch(_0x3cef4f){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x35'),_0x3bbe2c['uniqueid']),_0x3cef4f);}});ami['on']('hangup',function(_0x2a25b5){try{utils[_0xd130('0x29')](util['format'](_0xd130('0x37'),_0x2a25b5[_0xd130('0x23')]),_0x2a25b5);calls[_0xd130('0x38')](_0x2a25b5);recordings['hangup'](_0x2a25b5);dials['hangup'](_0x2a25b5);agents[_0xd130('0x38')](_0x2a25b5);queues[_0xd130('0x38')](_0x2a25b5);}catch(_0x268292){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x37'),_0x2a25b5['uniqueid']),_0x268292);}});ami['on'](_0xd130('0x39'),function(_0x399a16){try{utils[_0xd130('0x29')](util['format'](_0xd130('0x3a'),_0x399a16[_0xd130('0x23')]),_0x399a16);members[_0xd130('0x39')](_0x399a16);}catch(_0xd8b8e3){utils[_0xd130('0x1a')](util['format'](_0xd130('0x3a'),_0x399a16[_0xd130('0x23')]),_0xd8b8e3);}});ami['on'](_0xd130('0x3b'),function(_0x2d0fe8){try{utils[_0xd130('0x29')](util[_0xd130('0x20')]('[%s][index][blindtransfer]',_0x2d0fe8['uniqueid']),_0x2d0fe8);queues['blindtransfer'](_0x2d0fe8);agents[_0xd130('0x3b')](_0x2d0fe8);transfers[_0xd130('0x3b')](_0x2d0fe8);}catch(_0x2cab66){utils['error'](util['format'](_0xd130('0x3c'),_0x2d0fe8['uniqueid']),_0x2cab66);}});ami['on']('attendedtransfer',function(_0x57d6ef){try{utils['debug'](util[_0xd130('0x20')]('[%s][index][attendedtransfer]',_0x57d6ef['origtransfereruniqueid']),_0x57d6ef);queues[_0xd130('0x3d')](_0x57d6ef);transfers[_0xd130('0x3d')](_0x57d6ef);agents[_0xd130('0x3d')](_0x57d6ef);calls['attendedtransfer'](_0x57d6ef);}catch(_0x356aab){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x3e'),_0x57d6ef['origtransfereruniqueid']),_0x356aab);}});ami['on'](_0xd130('0x3f'),function(_0x6fa8d){try{utils[_0xd130('0x29')](util[_0xd130('0x20')](_0xd130('0x40'),_0x6fa8d[_0xd130('0x23')]),_0x6fa8d);queues['varset'](_0x6fa8d);recordings[_0xd130('0x3f')](_0x6fa8d);calls[_0xd130('0x3f')](_0x6fa8d);dials['varset'](_0x6fa8d);}catch(_0x47690f){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x40'),_0x6fa8d[_0xd130('0x23')]),_0x47690f);}});ami['on'](_0xd130('0x41'),function(_0x56edd5){try{utils['debug'](util[_0xd130('0x20')](_0xd130('0x42'),_0x56edd5[_0xd130('0x23')]),_0x56edd5);calls[_0xd130('0x41')](_0x56edd5);recordings['newexten'](_0x56edd5);dials['newexten'](_0x56edd5);}catch(_0x3693e8){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x42'),_0x56edd5[_0xd130('0x23')]),_0x3693e8);}});ami['on'](_0xd130('0x43'),function(_0x5b9719){try{utils[_0xd130('0x29')](util[_0xd130('0x20')](_0xd130('0x44'),_0x5b9719[_0xd130('0x23')]),_0x5b9719);calls[_0xd130('0x43')](_0x5b9719);recordings[_0xd130('0x43')](_0x5b9719);}catch(_0x3f8a17){utils[_0xd130('0x1a')](util[_0xd130('0x20')](_0xd130('0x44'),_0x5b9719[_0xd130('0x23')]),_0x3f8a17);}});ami['on']('dialbegin',function(_0x5cd416){try{utils[_0xd130('0x29')](util[_0xd130('0x20')](_0xd130('0x45'),_0x5cd416['uniqueid']),_0x5cd416);dials[_0xd130('0x46')](_0x5cd416);}catch(_0x52485f){utils[_0xd130('0x1a')](util['format'](_0xd130('0x47'),_0x5cd416[_0xd130('0x23')]),_0x52485f);}});ami['on'](_0xd130('0x48'),function(_0x48762c){try{utils[_0xd130('0x29')](util['format']('[%s][index][dialend]',_0x48762c[_0xd130('0x23')]),_0x48762c);dials['dialend'](_0x48762c);}catch(_0x511792){utils['error'](util[_0xd130('0x20')](_0xd130('0x49'),_0x48762c['uniqueid']),_0x511792);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8687b52..0224cf5 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 _0xcc94=['request','getUserByName','split','name','CreateMemberReport','catch','error','format','[%s][members][writeDB]','some','startsWith','debug','device','state','INUSE','BUSY','voice','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','type','util','./utils','Local/_attended@transfer','Queue:','info','uniqueid','interface','channel','data2','membername','then','internal'];(function(_0x19373c,_0x4df262){var _0x2a143a=function(_0x45f5b8){while(--_0x45f5b8){_0x19373c['push'](_0x19373c['shift']());}};_0x2a143a(++_0x4df262);}(_0xcc94,0xee));var _0x4cc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc94[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4cc9('0x0'));var utils=require(_0x4cc9('0x1'));var members={};var exclude=[_0x4cc9('0x2'),_0x4cc9('0x3')];function writeDB(_0x3ff2b0){utils[_0x4cc9('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3ff2b0[_0x4cc9('0x5')],_0x3ff2b0[_0x4cc9('0x6')],_0x3ff2b0[_0x4cc9('0x7')],_0x3ff2b0[_0x4cc9('0x8')],_0x3ff2b0[_0x4cc9('0x9')],_0x3ff2b0['type']));if(_0x3ff2b0[_0x4cc9('0x6')]){utils['getUserByInterface'](_0x3ff2b0[_0x4cc9('0x6')])[_0x4cc9('0xa')](function(_0x16a1b8){if(_0x16a1b8){_0x3ff2b0[_0x4cc9('0x9')]=_0x16a1b8['name'];_0x3ff2b0['internal']=_0x16a1b8[_0x4cc9('0xb')];utils[_0x4cc9('0xc')]('CreateMemberReport',_0x3ff2b0);}else{utils[_0x4cc9('0xd')](_0x3ff2b0[_0x4cc9('0x6')][_0x4cc9('0xe')]('/')[0x1])[_0x4cc9('0xa')](function(_0x83bf5c){if(_0x83bf5c){_0x3ff2b0[_0x4cc9('0x9')]=_0x83bf5c[_0x4cc9('0xf')];_0x3ff2b0['internal']=_0x83bf5c[_0x4cc9('0xb')];utils[_0x4cc9('0xc')](_0x4cc9('0x10'),_0x3ff2b0);}});}})[_0x4cc9('0x11')](function(_0x33cedb){utils[_0x4cc9('0x12')](util[_0x4cc9('0x13')](_0x4cc9('0x14'),_0x3ff2b0[_0x4cc9('0x5')]),_0x33cedb);});}delete members[_0x3ff2b0[_0x4cc9('0x6')]];}function startsWith(_0x46aa3e,_0x3b6893){return _[_0x4cc9('0x15')](_0x46aa3e,function(_0x2f2f43){return _[_0x4cc9('0x16')](_0x3b6893,_0x2f2f43);});}exports['devicestatechange']=function(_0x142696){try{utils[_0x4cc9('0x17')](util[_0x4cc9('0x13')]('[%s][members][devicestatechange]',members[_0x142696['device']]?members[_0x142696['device']][_0x4cc9('0x5')]:_0x142696[_0x4cc9('0x18')]),_0x142696);utils[_0x4cc9('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x142696[_0x4cc9('0x18')]]?members[_0x142696[_0x4cc9('0x18')]]['uniqueid']:_0x142696[_0x4cc9('0x18')],_0x142696[_0x4cc9('0x19')],_0x142696[_0x4cc9('0x18')]));switch(_0x142696[_0x4cc9('0x19')]){case _0x4cc9('0x1a'):case _0x4cc9('0x1b'):if(!startsWith(exclude,_0x142696[_0x4cc9('0x18')])){members[_0x142696[_0x4cc9('0x18')]]={'channel':_0x4cc9('0x1c'),'interface':_0x142696['device'],'type':'TALKING','enterAt':utils[_0x4cc9('0x1d')](),'role':'agent'};}break;case _0x4cc9('0x1e'):if(!_[_0x4cc9('0x1f')](members[_0x142696[_0x4cc9('0x18')]])){members[_0x142696[_0x4cc9('0x18')]][_0x4cc9('0x20')]=utils[_0x4cc9('0x1d')]();members[_0x142696[_0x4cc9('0x18')]][_0x4cc9('0x21')]=utils[_0x4cc9('0x22')](members[_0x142696[_0x4cc9('0x18')]][_0x4cc9('0x20')],members[_0x142696[_0x4cc9('0x18')]][_0x4cc9('0x23')]);if(members[_0x142696['device']]['uniqueid']){writeDB(members[_0x142696[_0x4cc9('0x18')]]);}}break;default:break;}}catch(_0x36fc0c){utils[_0x4cc9('0x12')](util[_0x4cc9('0x13')](_0x4cc9('0x24'),members[_0x142696[_0x4cc9('0x18')]]?members[_0x142696[_0x4cc9('0x18')]][_0x4cc9('0x5')]:_0x142696[_0x4cc9('0x18')]),_0x36fc0c);}};exports[_0x4cc9('0x25')]=function(_0x50b6e1){try{if(!_[_0x4cc9('0x1f')](members[_0x50b6e1[_0x4cc9('0x6')]])){utils[_0x4cc9('0x17')](util['format'](_0x4cc9('0x26'),_0x50b6e1[_0x4cc9('0x5')]),_0x50b6e1);utils['info'](util['format'](_0x4cc9('0x27'),_0x50b6e1[_0x4cc9('0x5')],_0x50b6e1[_0x4cc9('0x6')],_0x50b6e1['queue']));members[_0x50b6e1[_0x4cc9('0x6')]]=_[_0x4cc9('0x28')](members[_0x50b6e1[_0x4cc9('0x6')]],{'data4':_0x50b6e1[_0x4cc9('0x29')],'uniqueid':_0x50b6e1[_0x4cc9('0x5')]});}}catch(_0x204bc1){utils[_0x4cc9('0x12')](util[_0x4cc9('0x13')]('[%s][members][agentcomplete]',_0x50b6e1[_0x4cc9('0x5')]),_0x204bc1);}};exports[_0x4cc9('0x2a')]=function(_0x1290bf){try{utils['debug'](util[_0x4cc9('0x13')](_0x4cc9('0x2b'),_0x1290bf[_0x4cc9('0x5')]),_0x1290bf);if(_0x1290bf[_0x4cc9('0x7')]){var _0x31d595=_0x1290bf[_0x4cc9('0x7')]['split']('-')[0x0];if(!_[_0x4cc9('0x1f')](members[_0x31d595])){members[_0x31d595]=_[_0x4cc9('0x28')](members[_0x31d595],{'data1':members[_0x31d595][_0x4cc9('0x2c')]||_0x1290bf['type'],'data2':members[_0x31d595][_0x4cc9('0x8')]||_0x1290bf[_0x4cc9('0x2d')],'data3':members[_0x31d595][_0x4cc9('0x2e')]||_0x1290bf[_0x4cc9('0x2f')],'uniqueid':members[_0x31d595][_0x4cc9('0x5')]||_0x1290bf[_0x4cc9('0x5')]});utils[_0x4cc9('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1290bf[_0x4cc9('0x5')],members[_0x31d595][_0x4cc9('0x2c')],members[_0x31d595][_0x4cc9('0x8')],members[_0x31d595]['data3']));if(members[_0x31d595][_0x4cc9('0x20')]){writeDB(members[_0x31d595]);}}}if(_0x1290bf['destinationchannel']){var _0x42833b=_0x1290bf[_0x4cc9('0x30')][_0x4cc9('0xe')]('-')[0x0];if(!_[_0x4cc9('0x1f')](members[_0x42833b])){members[_0x42833b]=_[_0x4cc9('0x28')](members[_0x42833b],{'data1':members[_0x42833b][_0x4cc9('0x2c')]||_0x1290bf[_0x4cc9('0x31')],'data2':members[_0x42833b]['data2']||_0x1290bf[_0x4cc9('0x2d')],'data3':members[_0x42833b][_0x4cc9('0x2e')]||_0x1290bf['destination'],'uniqueid':members[_0x42833b]['uniqueid']||_0x1290bf['uniqueid']});utils[_0x4cc9('0x4')](util[_0x4cc9('0x13')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1290bf[_0x4cc9('0x5')],members[_0x42833b]['data1'],members[_0x42833b][_0x4cc9('0x8')],members[_0x42833b][_0x4cc9('0x2e')]));if(members[_0x42833b][_0x4cc9('0x20')]){writeDB(members[_0x42833b]);}}}}catch(_0x1eaba9){utils[_0x4cc9('0x12')](util[_0x4cc9('0x13')](_0x4cc9('0x2b'),_0x1290bf[_0x4cc9('0x5')]),_0x1eaba9);}}; \ No newline at end of file +var _0x7c35=['internal','request','then','CreateMemberReport','error','[%s][members][writeDB]','some','devicestatechange','debug','device','state','BUSY','TALKING','now','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','split','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','type','interface','getUserByInterface','membername','name'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7c35,0x135));var _0x57c3=function(_0x5c57b6,_0x48fcfc){_0x5c57b6=_0x5c57b6-0x0;var _0x5423cc=_0x7c35[_0x5c57b6];return _0x5423cc;};'use strict';var _=require('lodash');var util=require(_0x57c3('0x0'));var utils=require(_0x57c3('0x1'));var members={};var exclude=[_0x57c3('0x2'),_0x57c3('0x3')];function writeDB(_0x23e38f){utils[_0x57c3('0x4')](util[_0x57c3('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x23e38f[_0x57c3('0x6')],_0x23e38f['interface'],_0x23e38f[_0x57c3('0x7')],_0x23e38f['data2'],_0x23e38f['membername'],_0x23e38f[_0x57c3('0x8')]));if(_0x23e38f[_0x57c3('0x9')]){utils[_0x57c3('0xa')](_0x23e38f[_0x57c3('0x9')])['then'](function(_0x3b36e1){if(_0x3b36e1){_0x23e38f[_0x57c3('0xb')]=_0x3b36e1[_0x57c3('0xc')];_0x23e38f[_0x57c3('0xd')]=_0x3b36e1[_0x57c3('0xd')];utils[_0x57c3('0xe')]('CreateMemberReport',_0x23e38f);}else{utils['getUserByName'](_0x23e38f[_0x57c3('0x9')]['split']('/')[0x1])[_0x57c3('0xf')](function(_0x38a230){if(_0x38a230){_0x23e38f[_0x57c3('0xb')]=_0x38a230[_0x57c3('0xc')];_0x23e38f['internal']=_0x38a230[_0x57c3('0xd')];utils[_0x57c3('0xe')](_0x57c3('0x10'),_0x23e38f);}});}})['catch'](function(_0x3b0998){utils[_0x57c3('0x11')](util[_0x57c3('0x5')](_0x57c3('0x12'),_0x23e38f[_0x57c3('0x6')]),_0x3b0998);});}delete members[_0x23e38f[_0x57c3('0x9')]];}function startsWith(_0x836046,_0x444681){return _[_0x57c3('0x13')](_0x836046,function(_0x5e4306){return _['startsWith'](_0x444681,_0x5e4306);});}exports[_0x57c3('0x14')]=function(_0x1057a7){try{utils[_0x57c3('0x15')](util['format']('[%s][members][devicestatechange]',members[_0x1057a7[_0x57c3('0x16')]]?members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x6')]:_0x1057a7['device']),_0x1057a7);utils[_0x57c3('0x4')](util[_0x57c3('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1057a7[_0x57c3('0x16')]]?members[_0x1057a7[_0x57c3('0x16')]]['uniqueid']:_0x1057a7[_0x57c3('0x16')],_0x1057a7['state'],_0x1057a7[_0x57c3('0x16')]));switch(_0x1057a7[_0x57c3('0x17')]){case'INUSE':case _0x57c3('0x18'):if(!startsWith(exclude,_0x1057a7[_0x57c3('0x16')])){members[_0x1057a7[_0x57c3('0x16')]]={'channel':'voice','interface':_0x1057a7[_0x57c3('0x16')],'type':_0x57c3('0x19'),'enterAt':utils[_0x57c3('0x1a')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x57c3('0x1b')](members[_0x1057a7[_0x57c3('0x16')]])){members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x1c')]=utils[_0x57c3('0x1a')]();members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x1d')]=utils[_0x57c3('0x1e')](members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x1c')],members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x1f')]);if(members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x6')]){writeDB(members[_0x1057a7[_0x57c3('0x16')]]);}}break;default:break;}}catch(_0x1d50de){utils[_0x57c3('0x11')](util[_0x57c3('0x5')](_0x57c3('0x20'),members[_0x1057a7['device']]?members[_0x1057a7[_0x57c3('0x16')]][_0x57c3('0x6')]:_0x1057a7[_0x57c3('0x16')]),_0x1d50de);}};exports['agentcomplete']=function(_0x5df784){try{if(!_[_0x57c3('0x1b')](members[_0x5df784[_0x57c3('0x9')]])){utils[_0x57c3('0x15')](util[_0x57c3('0x5')](_0x57c3('0x21'),_0x5df784[_0x57c3('0x6')]),_0x5df784);utils[_0x57c3('0x4')](util[_0x57c3('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5df784[_0x57c3('0x6')],_0x5df784[_0x57c3('0x9')],_0x5df784[_0x57c3('0x22')]));members[_0x5df784[_0x57c3('0x9')]]=_[_0x57c3('0x23')](members[_0x5df784[_0x57c3('0x9')]],{'data4':_0x5df784[_0x57c3('0x22')],'uniqueid':_0x5df784[_0x57c3('0x6')]});}}catch(_0x19ab73){utils[_0x57c3('0x11')](util['format'](_0x57c3('0x21'),_0x5df784[_0x57c3('0x6')]),_0x19ab73);}};exports[_0x57c3('0x24')]=function(_0x395911){try{utils[_0x57c3('0x15')](util[_0x57c3('0x5')](_0x57c3('0x25'),_0x395911[_0x57c3('0x6')]),_0x395911);if(_0x395911[_0x57c3('0x7')]){var _0xada905=_0x395911[_0x57c3('0x7')][_0x57c3('0x26')]('-')[0x0];if(!_['isNil'](members[_0xada905])){members[_0xada905]=_['assign'](members[_0xada905],{'data1':members[_0xada905][_0x57c3('0x27')]||_0x395911['type'],'data2':members[_0xada905][_0x57c3('0x28')]||_0x395911[_0x57c3('0x29')],'data3':members[_0xada905][_0x57c3('0x2a')]||_0x395911[_0x57c3('0x2b')],'uniqueid':members[_0xada905]['uniqueid']||_0x395911[_0x57c3('0x6')]});utils[_0x57c3('0x4')](util[_0x57c3('0x5')](_0x57c3('0x2c'),_0x395911[_0x57c3('0x6')],members[_0xada905][_0x57c3('0x27')],members[_0xada905][_0x57c3('0x28')],members[_0xada905][_0x57c3('0x2a')]));if(members[_0xada905]['exitAt']){writeDB(members[_0xada905]);}}}if(_0x395911[_0x57c3('0x2d')]){var _0x8dc1fc=_0x395911[_0x57c3('0x2d')]['split']('-')[0x0];if(!_['isNil'](members[_0x8dc1fc])){members[_0x8dc1fc]=_['assign'](members[_0x8dc1fc],{'data1':members[_0x8dc1fc][_0x57c3('0x27')]||_0x395911[_0x57c3('0x8')],'data2':members[_0x8dc1fc][_0x57c3('0x28')]||_0x395911[_0x57c3('0x29')],'data3':members[_0x8dc1fc][_0x57c3('0x2a')]||_0x395911['destination'],'uniqueid':members[_0x8dc1fc]['uniqueid']||_0x395911['uniqueid']});utils[_0x57c3('0x4')](util[_0x57c3('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x395911[_0x57c3('0x6')],members[_0x8dc1fc][_0x57c3('0x27')],members[_0x8dc1fc][_0x57c3('0x28')],members[_0x8dc1fc][_0x57c3('0x2a')]));if(members[_0x8dc1fc][_0x57c3('0x1c')]){writeDB(members[_0x8dc1fc]);}}}}catch(_0x420864){utils[_0x57c3('0x11')](util['format'](_0x57c3('0x25'),_0x395911[_0x57c3('0x6')]),_0x420864);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f28cb10..a967ced 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 _0xe9cb=['transfer','COMPLETEDBY','[%s][queues][agentcomplete]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','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','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%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]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','value','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','position','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode','agentcomplete','reason'];(function(_0x237c7f,_0x3a9366){var _0x3376f5=function(_0x273813){while(--_0x273813){_0x237c7f['push'](_0x237c7f['shift']());}};_0x3376f5(++_0x3a9366);}(_0xe9cb,0xfb));var _0xbe9c=function(_0x4c145e,_0x2a7ca6){_0x4c145e=_0x4c145e-0x0;var _0x159842=_0xe9cb[_0x4c145e];return _0x159842;};'use strict';var _=require(_0xbe9c('0x0'));var util=require(_0xbe9c('0x1'));var utils=require(_0xbe9c('0x2'));var queues={};function writeDB(_0x5373dc){utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x5'),_0x5373dc['uniqueid'],_0x5373dc[_0xbe9c('0x6')],_0x5373dc[_0xbe9c('0x7')],_0x5373dc[_0xbe9c('0x8')],_0x5373dc['calleridnum'],_0x5373dc['accountcode'],_0x5373dc[_0xbe9c('0x9')]));if(_0x5373dc['queue']){utils[_0xbe9c('0xa')](_0x5373dc[_0xbe9c('0x7')])[_0xbe9c('0xb')](function(_0x2e792c){if(_0x2e792c){_0x5373dc[_0xbe9c('0xc')]=_0x2e792c[_0xbe9c('0xc')];}utils['request'](_0xbe9c('0xd'),_0x5373dc);});}else{utils['request'](_0xbe9c('0xd'),_0x5373dc);}if(_0x5373dc[_0xbe9c('0xe')]){delete queues[_0x5373dc[_0xbe9c('0xe')]];}else{delete queues[_0x5373dc[_0xbe9c('0xf')]];}}exports[_0xbe9c('0x10')]=function(_0x3039d9){try{utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')]('[%s][queues][queuecallerjoin]',_0x3039d9[_0xbe9c('0xf')]),_0x3039d9);utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x12'),_0x3039d9['uniqueid'],_0x3039d9[_0xbe9c('0x7')],_0x3039d9['position']));queues[_0x3039d9[_0xbe9c('0xf')]]=_[_0xbe9c('0x13')](_0x3039d9,{'originalposition':_0x3039d9['position'],'queuecallerjoinAt':utils[_0xbe9c('0x14')](),'mohtime':0x0});}catch(_0x1d5346){utils[_0xbe9c('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x3039d9['uniqueid']),_0x1d5346);}};exports[_0xbe9c('0x16')]=function(_0xf1d5c8){try{if(!_[_0xbe9c('0x17')](queues[_0xf1d5c8[_0xbe9c('0xf')]])){utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')](_0xbe9c('0x18'),_0xf1d5c8[_0xbe9c('0xf')]),_0xf1d5c8);if(queues[_0xf1d5c8[_0xbe9c('0xf')]]['queuecallerleaveAt']){if(!queues[_0xf1d5c8[_0xbe9c('0xf')]]['queuecallerabandon']&&!queues[_0xf1d5c8['uniqueid']][_0xbe9c('0x19')]){queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0x1a')]=!![];queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0x1b')]=utils['now']();queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0x9')]=_0xbe9c('0x1c');}utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x1d'),_0xf1d5c8['uniqueid'],queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0x1e')],queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0x9')]));writeDB(queues[_0xf1d5c8['uniqueid']]);}else if(queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0xe')]){utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x1f'),_0xf1d5c8[_0xbe9c('0xf')],queues[_0xf1d5c8['uniqueid']][_0xbe9c('0x1e')],queues[_0xf1d5c8['uniqueid']]['transfereduniqueid']));queues[queues[_0xf1d5c8['uniqueid']][_0xbe9c('0xe')]]=queues[_0xf1d5c8['uniqueid']];queues[queues[_0xf1d5c8[_0xbe9c('0xf')]][_0xbe9c('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0xf1d5c8['uniqueid']];}}}catch(_0x2a4b68){utils[_0xbe9c('0x15')](util[_0xbe9c('0x4')](_0xbe9c('0x18'),_0xf1d5c8[_0xbe9c('0xf')]),_0x2a4b68);}};exports[_0xbe9c('0x20')]=function(_0x3e7eca){try{utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')](_0xbe9c('0x21'),_0x3e7eca['uniqueid']),_0x3e7eca);if(!_[_0xbe9c('0x17')](_0x3e7eca[_0xbe9c('0x22')][_0xbe9c('0x23')])&&_0x3e7eca['value'][_0xbe9c('0x24')]()!==_0xbe9c('0x25')){if(!_[_0xbe9c('0x17')](queues[_0x3e7eca['uniqueid']])){queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x26')]=![];queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x27')]=null;queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x19')]=!![];queues[_0x3e7eca['uniqueid']]['queuecallerexitAt']=utils[_0xbe9c('0x14')]();queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x9')]=_0x3e7eca[_0xbe9c('0x28')][_0xbe9c('0x24')]();utils['info'](util[_0xbe9c('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3e7eca['uniqueid'],queues[_0x3e7eca['uniqueid']][_0xbe9c('0x1e')],_0x3e7eca[_0xbe9c('0x28')],queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x9')]));writeDB(queues[_0x3e7eca[_0xbe9c('0xf')]]);}}else if(!_[_0xbe9c('0x17')](_0x3e7eca[_0xbe9c('0x22')][_0xbe9c('0x29')])){if(!_[_0xbe9c('0x17')](queues[_0x3e7eca[_0xbe9c('0xf')]])&&!queues[_0x3e7eca[_0xbe9c('0xf')]]['queuecallerabandon']){queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x26')]=![];queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x27')]=null;queues[_0x3e7eca[_0xbe9c('0xf')]]['queuecallerexit']=!![];queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x2a')]=utils[_0xbe9c('0x14')]();queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x9')]=_0xbe9c('0x2b');utils['info'](util[_0xbe9c('0x4')](_0xbe9c('0x2c'),_0x3e7eca['uniqueid'],queues[_0x3e7eca['uniqueid']][_0xbe9c('0x1e')],_0x3e7eca[_0xbe9c('0x28')],queues[_0x3e7eca[_0xbe9c('0xf')]][_0xbe9c('0x9')]));}}}catch(_0x21106f){utils['error'](util[_0xbe9c('0x4')]('[%s][queues][varset]',_0x3e7eca[_0xbe9c('0xf')]),_0x21106f);}};exports[_0xbe9c('0x26')]=function(_0x5f038e){try{if(!_['isNil'](queues[_0x5f038e[_0xbe9c('0xf')]])){utils[_0xbe9c('0x11')](util['format'](_0xbe9c('0x2d'),_0x5f038e[_0xbe9c('0xf')]),_0x5f038e);queues[_0x5f038e['uniqueid']]['queuecallerexit']=![];queues[_0x5f038e['uniqueid']][_0xbe9c('0x2a')]=null;queues[_0x5f038e[_0xbe9c('0xf')]]['queuecallerabandon']=!![];queues[_0x5f038e[_0xbe9c('0xf')]][_0xbe9c('0x27')]=utils['now']();queues[_0x5f038e[_0xbe9c('0xf')]]['queuecallerexitreason']='ABANDONED';utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x2e'),_0x5f038e[_0xbe9c('0xf')],queues[_0x5f038e[_0xbe9c('0xf')]][_0xbe9c('0x1e')],queues[_0x5f038e[_0xbe9c('0xf')]][_0xbe9c('0x9')]));}}catch(_0x38bb32){utils[_0xbe9c('0x15')](util[_0xbe9c('0x4')](_0xbe9c('0x2d'),_0x5f038e[_0xbe9c('0xf')]),_0x38bb32);}};exports[_0xbe9c('0x2f')]=function(_0x147c29){try{if(!_['isNil'](queues[_0x147c29['uniqueid']])){utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')]('[%s][queues][queuecallerleave]',_0x147c29[_0xbe9c('0xf')]),_0x147c29);utils[_0xbe9c('0x3')](util['format'](_0xbe9c('0x30'),_0x147c29['uniqueid'],queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x1e')],_0x147c29[_0xbe9c('0x31')],_0x147c29[_0xbe9c('0x32')]));queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x2f')]=!![];queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x33')]=utils[_0xbe9c('0x14')]();queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x34')]=utils['diffTime'](queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x33')],queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x35')]);queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x36')]=_0x147c29[_0xbe9c('0x36')];queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x37')]=_0x147c29[_0xbe9c('0x37')];queues[_0x147c29[_0xbe9c('0xf')]][_0xbe9c('0x31')]=_0x147c29[_0xbe9c('0x31')];queues[_0x147c29[_0xbe9c('0xf')]]['connectedlinename']=_0x147c29[_0xbe9c('0x32')];}}catch(_0x53f85e){utils[_0xbe9c('0x15')](util[_0xbe9c('0x4')]('[%s][queues][queuecallerleave]',_0x147c29[_0xbe9c('0xf')]),_0x53f85e);}};exports['agentconnect']=function(_0x3731d1){try{if(!_[_0xbe9c('0x17')](queues[_0x3731d1[_0xbe9c('0xf')]])){utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')](_0xbe9c('0x38'),_0x3731d1['uniqueid']),_0x3731d1);utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x39'),_0x3731d1[_0xbe9c('0xf')],queues[_0x3731d1[_0xbe9c('0xf')]]['name'],_0x3731d1[_0xbe9c('0x3a')],_0x3731d1['destaccountcode']));queues[_0x3731d1[_0xbe9c('0xf')]]['queuecallerabandon']=![];queues[_0x3731d1[_0xbe9c('0xf')]][_0xbe9c('0x26')]=![];queues[_0x3731d1[_0xbe9c('0xf')]][_0xbe9c('0x27')]=null;queues[_0x3731d1[_0xbe9c('0xf')]]['queuecallerexit']=![];queues[_0x3731d1[_0xbe9c('0xf')]][_0xbe9c('0x9')]=null;queues[_0x3731d1[_0xbe9c('0xf')]][_0xbe9c('0x2a')]=null;queues[_0x3731d1['uniqueid']][_0xbe9c('0x3b')]=!![];queues[_0x3731d1[_0xbe9c('0xf')]][_0xbe9c('0x3c')]=_0x3731d1[_0xbe9c('0x3d')];queues[_0x3731d1[_0xbe9c('0xf')]][_0xbe9c('0x8')]=_0x3731d1[_0xbe9c('0x3a')];}}catch(_0x48e0c8){utils['error'](util[_0xbe9c('0x4')](_0xbe9c('0x38'),_0x3731d1[_0xbe9c('0xf')]),_0x48e0c8);}};exports[_0xbe9c('0x3e')]=function(_0x58c72f){try{if(!_[_0xbe9c('0x17')](queues[_0x58c72f['uniqueid']])){if(queues[_0x58c72f['uniqueid']][_0xbe9c('0x33')]){utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')]('[%s][queues][agentcomplete]',_0x58c72f[_0xbe9c('0xf')]),_0x58c72f);queues[_0x58c72f[_0xbe9c('0xf')]]['queuecallerabandon']=![];queues[_0x58c72f[_0xbe9c('0xf')]]['queuecallerabandon']=![];queues[_0x58c72f[_0xbe9c('0xf')]][_0xbe9c('0x27')]=null;queues[_0x58c72f[_0xbe9c('0xf')]][_0xbe9c('0x19')]=![];queues[_0x58c72f['uniqueid']]['queuecallerexitAt']=null;queues[_0x58c72f['uniqueid']]['assigned']=!![];queues[_0x58c72f['uniqueid']][_0xbe9c('0x8')]=_0x58c72f['membername'];queues[_0x58c72f[_0xbe9c('0xf')]][_0xbe9c('0x1a')]=!![];queues[_0x58c72f[_0xbe9c('0xf')]]['queuecallercompleteAt']=utils[_0xbe9c('0x14')]();if(_0x58c72f[_0xbe9c('0x3f')]==_0xbe9c('0x40')){if(!queues[_0x58c72f['uniqueid']][_0xbe9c('0x40')]){queues[_0x58c72f['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x58c72f[_0xbe9c('0xf')]][_0xbe9c('0x9')]=_0xbe9c('0x41')+_0x58c72f['reason'][_0xbe9c('0x24')]();}utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x58c72f[_0xbe9c('0xf')],queues[_0x58c72f[_0xbe9c('0xf')]][_0xbe9c('0x1e')],_0x58c72f['membername'],queues[_0x58c72f[_0xbe9c('0xf')]][_0xbe9c('0x9')]));writeDB(queues[_0x58c72f[_0xbe9c('0xf')]]);}}}catch(_0x13f555){utils['error'](util[_0xbe9c('0x4')](_0xbe9c('0x42'),_0x58c72f['uniqueid']),_0x13f555);}};exports['blindtransfer']=function(_0x3f6744){try{if(!_[_0xbe9c('0x17')](queues[_0x3f6744[_0xbe9c('0x43')]])){utils[_0xbe9c('0x11')](util['format']('[%s][queues][blindtransfer]',_0x3f6744[_0xbe9c('0xf')]),_0x3f6744);queues[_0x3f6744[_0xbe9c('0x43')]][_0xbe9c('0x40')]=!![];queues[_0x3f6744['transfereeuniqueid']]['transfertype']=_0xbe9c('0x44');queues[_0x3f6744['transfereeuniqueid']][_0xbe9c('0x45')]=_0x3f6744[_0xbe9c('0x46')];queues[_0x3f6744[_0xbe9c('0x43')]][_0xbe9c('0x47')]=_0x3f6744[_0xbe9c('0x43')];queues[_0x3f6744[_0xbe9c('0x43')]][_0xbe9c('0x9')]=_0xbe9c('0x48');utils['info'](util[_0xbe9c('0x4')](_0xbe9c('0x49'),_0x3f6744[_0xbe9c('0xf')],queues[_0x3f6744[_0xbe9c('0x43')]][_0xbe9c('0x1e')],_0x3f6744['transfereeuniqueid'],_0x3f6744[_0xbe9c('0x46')]));}}catch(_0xe2bfb4){utils[_0xbe9c('0x15')](util['format'](_0xbe9c('0x4a'),_0x3f6744['uniqueid']),_0xe2bfb4);}};exports[_0xbe9c('0x4b')]=function(_0x10e489){try{utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')](_0xbe9c('0x4c'),_0x10e489[_0xbe9c('0x4d')]),_0x10e489);if(_0x10e489['origtransfereruniqueid']==_0x10e489[_0xbe9c('0x4e')]){if(!_['isNil'](queues[_0x10e489[_0xbe9c('0x4f')]])){utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x10e489[_0xbe9c('0x4d')],queues[_0x10e489['secondtransfererlinkedid']][_0xbe9c('0x1e')],_0x10e489[_0xbe9c('0x50')]));queues[_0x10e489['secondtransfererlinkedid']][_0xbe9c('0x40')]=!![];queues[_0x10e489[_0xbe9c('0x4f')]][_0xbe9c('0x51')]=_0xbe9c('0x52');queues[_0x10e489[_0xbe9c('0x4f')]][_0xbe9c('0x45')]=_0x10e489[_0xbe9c('0x50')];queues[_0x10e489[_0xbe9c('0x4f')]]['transferuniqueid']=_0x10e489['origtransfereruniqueid'];queues[_0x10e489['secondtransfererlinkedid']][_0xbe9c('0x9')]=_0xbe9c('0x53');}if(!_[_0xbe9c('0x17')](queues[_0x10e489[_0xbe9c('0x4e')]])){if(_0x10e489[_0xbe9c('0x54')]&&queues[_0x10e489[_0xbe9c('0x54')]]){queues[_0x10e489[_0xbe9c('0x54')]][_0xbe9c('0x55')]=0x1;queues[_0x10e489[_0xbe9c('0x43')]]=_[_0xbe9c('0x56')](queues[_0x10e489[_0xbe9c('0x54')]]);queues[_0x10e489['transfereeuniqueid']]['transfereduniqueid']=_0x10e489['transfertargetuniqueid'];queues[_0x10e489[_0xbe9c('0x43')]]['queuecallerenterreason']=0x2;queues[_0x10e489['transfereeuniqueid']][_0xbe9c('0x57')]=queues[_0x10e489[_0xbe9c('0x4f')]][_0xbe9c('0x57')];queues[_0x10e489[_0xbe9c('0x43')]]['calleridname']=queues[_0x10e489[_0xbe9c('0x4f')]][_0xbe9c('0x58')];queues[_0x10e489[_0xbe9c('0x43')]][_0xbe9c('0x35')]=utils[_0xbe9c('0x14')]();queues[_0x10e489[_0xbe9c('0x43')]]['queuecallerleaveAt']=utils[_0xbe9c('0x14')]();queues[_0x10e489['transfereeuniqueid']][_0xbe9c('0x34')]=0x0;queues[_0x10e489[_0xbe9c('0x43')]][_0xbe9c('0x59')]=0x0;utils['info'](util['format'](_0xbe9c('0x5a'),_0x10e489[_0xbe9c('0x4d')],queues[_0x10e489[_0xbe9c('0x43')]][_0xbe9c('0x1e')],queues[_0x10e489[_0xbe9c('0x43')]][_0xbe9c('0x57')],queues[_0x10e489[_0xbe9c('0x43')]][_0xbe9c('0x58')]));}else{utils['info'](util[_0xbe9c('0x4')](_0xbe9c('0x5b'),_0x10e489['origtransfereruniqueid'],queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0x1e')],_0x10e489['secondtransfererlinkedid']));queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0xe')]=_0x10e489[_0xbe9c('0x4f')];}}}else if(_0x10e489[_0xbe9c('0x5c')]==_0x10e489[_0xbe9c('0x4f')]){if(!_['isNil'](queues[_0x10e489[_0xbe9c('0x4e')]])){utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x5d'),_0x10e489['origtransfereruniqueid'],queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0x1e')],_0x10e489['secondtransfereruniqueid'],_0x10e489[_0xbe9c('0x5e')]));queues[_0x10e489['origtransfererlinkedid']][_0xbe9c('0x40')]=!![];queues[_0x10e489['origtransfererlinkedid']][_0xbe9c('0x51')]=_0xbe9c('0x52');queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0x45')]=_0x10e489[_0xbe9c('0x5e')];queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0x47')]=_0x10e489['secondtransfereruniqueid'];queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0x9')]=_0xbe9c('0x53');}if(!_[_0xbe9c('0x17')](queues[_0x10e489[_0xbe9c('0x4f')]])){if(_0x10e489[_0xbe9c('0x5f')]&&queues[_0x10e489['transfertargetlinkedid']]){queues[_0x10e489[_0xbe9c('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x10e489[_0xbe9c('0x60')]]=_[_0xbe9c('0x56')](queues[_0x10e489[_0xbe9c('0x5f')]]);queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0xe')]=_0x10e489[_0xbe9c('0x60')];queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x55')]=0x2;queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x57')]=queues[_0x10e489[_0xbe9c('0x4e')]][_0xbe9c('0x57')];queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x58')]=queues[_0x10e489[_0xbe9c('0x4e')]]['calleridname'];queues[_0x10e489['transfertargetuniqueid']][_0xbe9c('0x35')]=utils[_0xbe9c('0x14')]();queues[_0x10e489['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xbe9c('0x14')]();queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x34')]=0x0;queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x59')]=0x0;utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x61'),_0x10e489[_0xbe9c('0x4d')],queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x1e')],queues[_0x10e489[_0xbe9c('0x60')]]['transfereduniqueid'],queues[_0x10e489['transfertargetuniqueid']][_0xbe9c('0x57')],queues[_0x10e489[_0xbe9c('0x60')]][_0xbe9c('0x58')]));}else{utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x5b'),_0x10e489[_0xbe9c('0x4d')],queues[_0x10e489[_0xbe9c('0x4f')]][_0xbe9c('0x1e')],_0x10e489[_0xbe9c('0x4e')]));queues[_0x10e489[_0xbe9c('0x4f')]][_0xbe9c('0xe')]=_0x10e489[_0xbe9c('0x4e')];}}}}catch(_0x271ff1){utils[_0xbe9c('0x15')](util[_0xbe9c('0x4')](_0xbe9c('0x4c'),_0x10e489[_0xbe9c('0x4d')]),_0x271ff1);}};exports['musiconholdstart']=function(_0x6260b2){try{if(!_[_0xbe9c('0x17')](queues[_0x6260b2[_0xbe9c('0xf')]])){utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')](_0xbe9c('0x62'),_0x6260b2[_0xbe9c('0xf')]),_0x6260b2);queues[_0x6260b2['uniqueid']][_0xbe9c('0x63')]=utils[_0xbe9c('0x14')]();utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x64'),_0x6260b2[_0xbe9c('0xf')],queues[_0x6260b2[_0xbe9c('0xf')]][_0xbe9c('0x1e')],queues[_0x6260b2[_0xbe9c('0xf')]][_0xbe9c('0x63')]));}}catch(_0x37e25a){utils[_0xbe9c('0x15')](util[_0xbe9c('0x4')]('[%s][queues][musiconholdstart]',_0x6260b2[_0xbe9c('0xf')]),_0x37e25a);}};exports[_0xbe9c('0x65')]=function(_0x384766){try{if(!_[_0xbe9c('0x17')](queues[_0x384766[_0xbe9c('0xf')]])){if(!_[_0xbe9c('0x17')](queues[_0x384766[_0xbe9c('0xf')]][_0xbe9c('0x63')])){utils[_0xbe9c('0x11')](util[_0xbe9c('0x4')](_0xbe9c('0x66'),_0x384766[_0xbe9c('0xf')]),_0x384766);queues[_0x384766[_0xbe9c('0xf')]][_0xbe9c('0x59')]+=utils[_0xbe9c('0x67')](utils['now'](),queues[_0x384766['uniqueid']][_0xbe9c('0x63')]);utils[_0xbe9c('0x3')](util[_0xbe9c('0x4')](_0xbe9c('0x68'),_0x384766[_0xbe9c('0xf')],queues[_0x384766[_0xbe9c('0xf')]]['name'],queues[_0x384766[_0xbe9c('0xf')]][_0xbe9c('0x59')]));delete queues[_0x384766['uniqueid']][_0xbe9c('0x63')];}}}catch(_0x1ddb6d){utils[_0xbe9c('0x15')](util[_0xbe9c('0x4')](_0xbe9c('0x66'),_0x384766[_0xbe9c('0xf')]),_0x1ddb6d);}}; \ No newline at end of file +var _0x7055=['clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason'];(function(_0x4eebac,_0xeb7c9f){var _0x37f719=function(_0x549c70){while(--_0x549c70){_0x4eebac['push'](_0x4eebac['shift']());}};_0x37f719(++_0xeb7c9f);}(_0x7055,0x1af));var _0x5705=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x7055[_0x3902c1];return _0x1266cc;};'use strict';var _=require(_0x5705('0x0'));var util=require(_0x5705('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x3f3412){utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x4'),_0x3f3412['uniqueid'],_0x3f3412[_0x5705('0x5')],_0x3f3412['queue'],_0x3f3412[_0x5705('0x6')],_0x3f3412[_0x5705('0x7')],_0x3f3412[_0x5705('0x8')],_0x3f3412[_0x5705('0x9')]));if(_0x3f3412[_0x5705('0xa')]){utils[_0x5705('0xb')](_0x3f3412['queue'])[_0x5705('0xc')](function(_0x16d3c8){if(_0x16d3c8){_0x3f3412[_0x5705('0xd')]=_0x16d3c8[_0x5705('0xd')];}utils['request'](_0x5705('0xe'),_0x3f3412);});}else{utils[_0x5705('0xf')](_0x5705('0xe'),_0x3f3412);}if(_0x3f3412['transfereduniqueid']){delete queues[_0x3f3412[_0x5705('0x10')]];}else{delete queues[_0x3f3412[_0x5705('0x11')]];}}exports[_0x5705('0x12')]=function(_0x1a2e6e){try{utils[_0x5705('0x13')](util[_0x5705('0x3')](_0x5705('0x14'),_0x1a2e6e[_0x5705('0x11')]),_0x1a2e6e);utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x15'),_0x1a2e6e[_0x5705('0x11')],_0x1a2e6e['queue'],_0x1a2e6e[_0x5705('0x16')]));queues[_0x1a2e6e[_0x5705('0x11')]]=_[_0x5705('0x17')](_0x1a2e6e,{'originalposition':_0x1a2e6e[_0x5705('0x16')],'queuecallerjoinAt':utils[_0x5705('0x18')](),'mohtime':0x0});}catch(_0x442cd2){utils[_0x5705('0x19')](util['format'](_0x5705('0x14'),_0x1a2e6e['uniqueid']),_0x442cd2);}};exports[_0x5705('0x1a')]=function(_0x461502){try{if(!_[_0x5705('0x1b')](queues[_0x461502[_0x5705('0x11')]])){utils['debug'](util[_0x5705('0x3')](_0x5705('0x1c'),_0x461502[_0x5705('0x11')]),_0x461502);if(queues[_0x461502[_0x5705('0x11')]][_0x5705('0x1d')]){if(!queues[_0x461502['uniqueid']][_0x5705('0x1e')]&&!queues[_0x461502[_0x5705('0x11')]]['queuecallerexit']){queues[_0x461502[_0x5705('0x11')]][_0x5705('0x1f')]=!![];queues[_0x461502['uniqueid']][_0x5705('0x20')]=utils[_0x5705('0x18')]();queues[_0x461502[_0x5705('0x11')]]['queuecallerexitreason']=_0x5705('0x21');}utils[_0x5705('0x2')](util['format'](_0x5705('0x22'),_0x461502[_0x5705('0x11')],queues[_0x461502[_0x5705('0x11')]][_0x5705('0x23')],queues[_0x461502[_0x5705('0x11')]][_0x5705('0x9')]));writeDB(queues[_0x461502[_0x5705('0x11')]]);}else if(queues[_0x461502[_0x5705('0x11')]][_0x5705('0x10')]){utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x24'),_0x461502[_0x5705('0x11')],queues[_0x461502['uniqueid']][_0x5705('0x23')],queues[_0x461502[_0x5705('0x11')]][_0x5705('0x10')]));queues[queues[_0x461502['uniqueid']][_0x5705('0x10')]]=queues[_0x461502[_0x5705('0x11')]];queues[queues[_0x461502[_0x5705('0x11')]][_0x5705('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x461502[_0x5705('0x11')]];}}}catch(_0x424b82){utils[_0x5705('0x19')](util[_0x5705('0x3')](_0x5705('0x1c'),_0x461502[_0x5705('0x11')]),_0x424b82);}};exports['varset']=function(_0x1d81c2){try{utils[_0x5705('0x13')](util[_0x5705('0x3')](_0x5705('0x25'),_0x1d81c2[_0x5705('0x11')]),_0x1d81c2);if(!_[_0x5705('0x1b')](_0x1d81c2[_0x5705('0x26')][_0x5705('0x27')])&&_0x1d81c2[_0x5705('0x28')][_0x5705('0x29')]()!==_0x5705('0x2a')){if(!_['isNil'](queues[_0x1d81c2[_0x5705('0x11')]])){queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x1e')]=![];queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x2b')]=null;queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x2c')]=!![];queues[_0x1d81c2[_0x5705('0x11')]]['queuecallerexitAt']=utils['now']();queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x9')]=_0x1d81c2['value'][_0x5705('0x29')]();utils['info'](util['format'](_0x5705('0x2d'),_0x1d81c2[_0x5705('0x11')],queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x23')],_0x1d81c2[_0x5705('0x28')],queues[_0x1d81c2['uniqueid']][_0x5705('0x9')]));writeDB(queues[_0x1d81c2[_0x5705('0x11')]]);}}else if(!_['isNil'](_0x1d81c2['variable'][_0x5705('0x2e')])){if(!_[_0x5705('0x1b')](queues[_0x1d81c2[_0x5705('0x11')]])&&!queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x1e')]){queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x1e')]=![];queues[_0x1d81c2['uniqueid']][_0x5705('0x2b')]=null;queues[_0x1d81c2[_0x5705('0x11')]]['queuecallerexit']=!![];queues[_0x1d81c2['uniqueid']][_0x5705('0x2f')]=utils[_0x5705('0x18')]();queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x9')]=_0x5705('0x30');utils['info'](util[_0x5705('0x3')](_0x5705('0x31'),_0x1d81c2[_0x5705('0x11')],queues[_0x1d81c2[_0x5705('0x11')]][_0x5705('0x23')],_0x1d81c2['value'],queues[_0x1d81c2[_0x5705('0x11')]]['queuecallerexitreason']));}}}catch(_0x250cd0){utils['error'](util[_0x5705('0x3')](_0x5705('0x25'),_0x1d81c2['uniqueid']),_0x250cd0);}};exports[_0x5705('0x1e')]=function(_0x63e603){try{if(!_[_0x5705('0x1b')](queues[_0x63e603[_0x5705('0x11')]])){utils[_0x5705('0x13')](util[_0x5705('0x3')](_0x5705('0x32'),_0x63e603[_0x5705('0x11')]),_0x63e603);queues[_0x63e603[_0x5705('0x11')]][_0x5705('0x2c')]=![];queues[_0x63e603[_0x5705('0x11')]][_0x5705('0x2f')]=null;queues[_0x63e603[_0x5705('0x11')]][_0x5705('0x1e')]=!![];queues[_0x63e603[_0x5705('0x11')]][_0x5705('0x2b')]=utils[_0x5705('0x18')]();queues[_0x63e603['uniqueid']][_0x5705('0x9')]='ABANDONED';utils[_0x5705('0x2')](util[_0x5705('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x63e603[_0x5705('0x11')],queues[_0x63e603[_0x5705('0x11')]][_0x5705('0x23')],queues[_0x63e603[_0x5705('0x11')]]['queuecallerexitreason']));}}catch(_0x7a910f){utils[_0x5705('0x19')](util[_0x5705('0x3')](_0x5705('0x32'),_0x63e603['uniqueid']),_0x7a910f);}};exports[_0x5705('0x33')]=function(_0x2d0b7b){try{if(!_[_0x5705('0x1b')](queues[_0x2d0b7b[_0x5705('0x11')]])){utils['debug'](util[_0x5705('0x3')](_0x5705('0x34'),_0x2d0b7b[_0x5705('0x11')]),_0x2d0b7b);utils[_0x5705('0x2')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2d0b7b[_0x5705('0x11')],queues[_0x2d0b7b[_0x5705('0x11')]][_0x5705('0x23')],_0x2d0b7b[_0x5705('0x35')],_0x2d0b7b[_0x5705('0x36')]));queues[_0x2d0b7b['uniqueid']]['queuecallerleave']=!![];queues[_0x2d0b7b[_0x5705('0x11')]][_0x5705('0x1d')]=utils[_0x5705('0x18')]();queues[_0x2d0b7b['uniqueid']]['holdtime']=utils[_0x5705('0x37')](queues[_0x2d0b7b['uniqueid']][_0x5705('0x1d')],queues[_0x2d0b7b[_0x5705('0x11')]][_0x5705('0x38')]);queues[_0x2d0b7b[_0x5705('0x11')]]['position']=_0x2d0b7b[_0x5705('0x16')];queues[_0x2d0b7b[_0x5705('0x11')]]['count']=_0x2d0b7b[_0x5705('0x39')];queues[_0x2d0b7b[_0x5705('0x11')]]['connectedlinenum']=_0x2d0b7b[_0x5705('0x35')];queues[_0x2d0b7b[_0x5705('0x11')]][_0x5705('0x36')]=_0x2d0b7b[_0x5705('0x36')];}}catch(_0x480e25){utils['error'](util[_0x5705('0x3')](_0x5705('0x34'),_0x2d0b7b[_0x5705('0x11')]),_0x480e25);}};exports[_0x5705('0x3a')]=function(_0x503b36){try{if(!_[_0x5705('0x1b')](queues[_0x503b36[_0x5705('0x11')]])){utils[_0x5705('0x13')](util[_0x5705('0x3')](_0x5705('0x3b'),_0x503b36[_0x5705('0x11')]),_0x503b36);utils['info'](util[_0x5705('0x3')](_0x5705('0x3c'),_0x503b36[_0x5705('0x11')],queues[_0x503b36['uniqueid']][_0x5705('0x23')],_0x503b36[_0x5705('0x3d')],_0x503b36[_0x5705('0x3e')]));queues[_0x503b36[_0x5705('0x11')]][_0x5705('0x1e')]=![];queues[_0x503b36[_0x5705('0x11')]][_0x5705('0x1e')]=![];queues[_0x503b36['uniqueid']][_0x5705('0x2b')]=null;queues[_0x503b36[_0x5705('0x11')]][_0x5705('0x2c')]=![];queues[_0x503b36[_0x5705('0x11')]][_0x5705('0x9')]=null;queues[_0x503b36[_0x5705('0x11')]]['queuecallerexitAt']=null;queues[_0x503b36[_0x5705('0x11')]]['assigned']=!![];queues[_0x503b36['uniqueid']][_0x5705('0x8')]=_0x503b36[_0x5705('0x3e')];queues[_0x503b36[_0x5705('0x11')]][_0x5705('0x6')]=_0x503b36[_0x5705('0x3d')];}}catch(_0x36ed83){utils[_0x5705('0x19')](util['format'](_0x5705('0x3b'),_0x503b36[_0x5705('0x11')]),_0x36ed83);}};exports[_0x5705('0x3f')]=function(_0x2d11fe){try{if(!_[_0x5705('0x1b')](queues[_0x2d11fe['uniqueid']])){if(queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x1d')]){utils[_0x5705('0x13')](util[_0x5705('0x3')](_0x5705('0x40'),_0x2d11fe[_0x5705('0x11')]),_0x2d11fe);queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x1e')]=![];queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x1e')]=![];queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x2b')]=null;queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x2c')]=![];queues[_0x2d11fe[_0x5705('0x11')]]['queuecallerexitAt']=null;queues[_0x2d11fe[_0x5705('0x11')]]['assigned']=!![];queues[_0x2d11fe['uniqueid']][_0x5705('0x6')]=_0x2d11fe[_0x5705('0x3d')];queues[_0x2d11fe[_0x5705('0x11')]]['queuecallercomplete']=!![];queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x20')]=utils['now']();if(_0x2d11fe[_0x5705('0x41')]==_0x5705('0x42')){if(!queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x42')]){queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x9')]=_0x5705('0x43');}}else{queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x9')]='COMPLETEDBY'+_0x2d11fe[_0x5705('0x41')][_0x5705('0x29')]();}utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x44'),_0x2d11fe['uniqueid'],queues[_0x2d11fe['uniqueid']]['name'],_0x2d11fe[_0x5705('0x3d')],queues[_0x2d11fe[_0x5705('0x11')]][_0x5705('0x9')]));writeDB(queues[_0x2d11fe[_0x5705('0x11')]]);}}}catch(_0x186c26){utils[_0x5705('0x19')](util[_0x5705('0x3')](_0x5705('0x40'),_0x2d11fe[_0x5705('0x11')]),_0x186c26);}};exports[_0x5705('0x45')]=function(_0x46676d){try{if(!_['isNil'](queues[_0x46676d['transfereeuniqueid']])){utils[_0x5705('0x13')](util['format']('[%s][queues][blindtransfer]',_0x46676d[_0x5705('0x11')]),_0x46676d);queues[_0x46676d[_0x5705('0x46')]][_0x5705('0x42')]=!![];queues[_0x46676d[_0x5705('0x46')]][_0x5705('0x47')]=_0x5705('0x48');queues[_0x46676d[_0x5705('0x46')]][_0x5705('0x49')]=_0x46676d[_0x5705('0x4a')];queues[_0x46676d[_0x5705('0x46')]][_0x5705('0x4b')]=_0x46676d[_0x5705('0x46')];queues[_0x46676d[_0x5705('0x46')]][_0x5705('0x9')]=_0x5705('0x4c');utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x4d'),_0x46676d[_0x5705('0x11')],queues[_0x46676d[_0x5705('0x46')]][_0x5705('0x23')],_0x46676d['transfereeuniqueid'],_0x46676d['extension']));}}catch(_0x3b38a1){utils[_0x5705('0x19')](util[_0x5705('0x3')](_0x5705('0x4e'),_0x46676d[_0x5705('0x11')]),_0x3b38a1);}};exports[_0x5705('0x4f')]=function(_0x4f8c95){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x4f8c95[_0x5705('0x50')]),_0x4f8c95);if(_0x4f8c95[_0x5705('0x50')]==_0x4f8c95['origtransfererlinkedid']){if(!_['isNil'](queues[_0x4f8c95[_0x5705('0x51')]])){utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x52'),_0x4f8c95[_0x5705('0x50')],queues[_0x4f8c95['secondtransfererlinkedid']][_0x5705('0x23')],_0x4f8c95[_0x5705('0x53')]));queues[_0x4f8c95['secondtransfererlinkedid']][_0x5705('0x42')]=!![];queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x47')]=_0x5705('0x54');queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x49')]=_0x4f8c95[_0x5705('0x53')];queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x4b')]=_0x4f8c95[_0x5705('0x50')];queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x9')]=_0x5705('0x55');}if(!_[_0x5705('0x1b')](queues[_0x4f8c95[_0x5705('0x56')]])){if(_0x4f8c95[_0x5705('0x57')]&&queues[_0x4f8c95['transfereelinkedid']]){queues[_0x4f8c95[_0x5705('0x57')]][_0x5705('0x58')]=0x1;queues[_0x4f8c95[_0x5705('0x46')]]=_[_0x5705('0x59')](queues[_0x4f8c95[_0x5705('0x57')]]);queues[_0x4f8c95[_0x5705('0x46')]]['transfereduniqueid']=_0x4f8c95['transfertargetuniqueid'];queues[_0x4f8c95['transfereeuniqueid']][_0x5705('0x58')]=0x2;queues[_0x4f8c95[_0x5705('0x46')]][_0x5705('0x7')]=queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x7')];queues[_0x4f8c95[_0x5705('0x46')]][_0x5705('0x5a')]=queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x5a')];queues[_0x4f8c95[_0x5705('0x46')]]['queuecallerjoinAt']=utils['now']();queues[_0x4f8c95['transfereeuniqueid']][_0x5705('0x1d')]=utils[_0x5705('0x18')]();queues[_0x4f8c95[_0x5705('0x46')]]['holdtime']=0x0;queues[_0x4f8c95['transfereeuniqueid']][_0x5705('0x5b')]=0x0;utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x5c'),_0x4f8c95['origtransfereruniqueid'],queues[_0x4f8c95['transfereeuniqueid']][_0x5705('0x23')],queues[_0x4f8c95[_0x5705('0x46')]][_0x5705('0x7')],queues[_0x4f8c95[_0x5705('0x46')]][_0x5705('0x5a')]));}else{utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x5d'),_0x4f8c95[_0x5705('0x50')],queues[_0x4f8c95[_0x5705('0x56')]][_0x5705('0x23')],_0x4f8c95[_0x5705('0x51')]));queues[_0x4f8c95[_0x5705('0x56')]]['transfereduniqueid']=_0x4f8c95['secondtransfererlinkedid'];}}}else if(_0x4f8c95['secondtransfereruniqueid']==_0x4f8c95['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x4f8c95[_0x5705('0x56')]])){utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x5e'),_0x4f8c95[_0x5705('0x50')],queues[_0x4f8c95[_0x5705('0x56')]][_0x5705('0x23')],_0x4f8c95['secondtransfereruniqueid'],_0x4f8c95[_0x5705('0x5f')]));queues[_0x4f8c95[_0x5705('0x56')]][_0x5705('0x42')]=!![];queues[_0x4f8c95['origtransfererlinkedid']][_0x5705('0x47')]='ATTENDED';queues[_0x4f8c95['origtransfererlinkedid']][_0x5705('0x49')]=_0x4f8c95[_0x5705('0x5f')];queues[_0x4f8c95[_0x5705('0x56')]]['transferuniqueid']=_0x4f8c95[_0x5705('0x60')];queues[_0x4f8c95[_0x5705('0x56')]][_0x5705('0x9')]=_0x5705('0x55');}if(!_[_0x5705('0x1b')](queues[_0x4f8c95[_0x5705('0x51')]])){if(_0x4f8c95['transfertargetlinkedid']&&queues[_0x4f8c95[_0x5705('0x61')]]){queues[_0x4f8c95['transfertargetlinkedid']][_0x5705('0x58')]=0x1;queues[_0x4f8c95[_0x5705('0x62')]]=_[_0x5705('0x59')](queues[_0x4f8c95['transfertargetlinkedid']]);queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x10')]=_0x4f8c95['transfertargetuniqueid'];queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x58')]=0x2;queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x7')]=queues[_0x4f8c95['origtransfererlinkedid']][_0x5705('0x7')];queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x5a')]=queues[_0x4f8c95[_0x5705('0x56')]][_0x5705('0x5a')];queues[_0x4f8c95['transfertargetuniqueid']][_0x5705('0x38')]=utils['now']();queues[_0x4f8c95[_0x5705('0x62')]]['queuecallerleaveAt']=utils[_0x5705('0x18')]();queues[_0x4f8c95[_0x5705('0x62')]]['holdtime']=0x0;queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x5b')]=0x0;utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x63'),_0x4f8c95[_0x5705('0x50')],queues[_0x4f8c95['transfertargetuniqueid']][_0x5705('0x23')],queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x10')],queues[_0x4f8c95[_0x5705('0x62')]][_0x5705('0x7')],queues[_0x4f8c95[_0x5705('0x62')]]['calleridname']));}else{utils[_0x5705('0x2')](util[_0x5705('0x3')](_0x5705('0x5d'),_0x4f8c95[_0x5705('0x50')],queues[_0x4f8c95[_0x5705('0x51')]][_0x5705('0x23')],_0x4f8c95['origtransfererlinkedid']));queues[_0x4f8c95[_0x5705('0x51')]]['transfereduniqueid']=_0x4f8c95[_0x5705('0x56')];}}}}catch(_0x2605e7){utils[_0x5705('0x19')](util[_0x5705('0x3')](_0x5705('0x64'),_0x4f8c95[_0x5705('0x50')]),_0x2605e7);}};exports['musiconholdstart']=function(_0x15c484){try{if(!_[_0x5705('0x1b')](queues[_0x15c484['uniqueid']])){utils['debug'](util['format'](_0x5705('0x65'),_0x15c484[_0x5705('0x11')]),_0x15c484);queues[_0x15c484[_0x5705('0x11')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x5705('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x15c484['uniqueid'],queues[_0x15c484[_0x5705('0x11')]][_0x5705('0x23')],queues[_0x15c484['uniqueid']][_0x5705('0x66')]));}}catch(_0x799df6){utils[_0x5705('0x19')](util['format'](_0x5705('0x65'),_0x15c484[_0x5705('0x11')]),_0x799df6);}};exports['musiconholdstop']=function(_0x6ce1b6){try{if(!_['isNil'](queues[_0x6ce1b6[_0x5705('0x11')]])){if(!_[_0x5705('0x1b')](queues[_0x6ce1b6[_0x5705('0x11')]][_0x5705('0x66')])){utils[_0x5705('0x13')](util[_0x5705('0x3')]('[%s][queues][musiconholdstop]',_0x6ce1b6[_0x5705('0x11')]),_0x6ce1b6);queues[_0x6ce1b6[_0x5705('0x11')]][_0x5705('0x5b')]+=utils[_0x5705('0x37')](utils['now'](),queues[_0x6ce1b6[_0x5705('0x11')]][_0x5705('0x66')]);utils['info'](util[_0x5705('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x6ce1b6[_0x5705('0x11')],queues[_0x6ce1b6[_0x5705('0x11')]][_0x5705('0x23')],queues[_0x6ce1b6['uniqueid']]['mohtime']));delete queues[_0x6ce1b6['uniqueid']]['musiconholdstartAt'];}}}catch(_0x8f22ed){utils[_0x5705('0x19')](util[_0x5705('0x3')](_0x5705('0x67'),_0x6ce1b6[_0x5705('0x11')]),_0x8f22ed);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index bc06133..d530145 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 _0x1549=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x1549,0x1cb));var _0x9154=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1549[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x9154('0x0'));var util=require(_0x9154('0x1'));var utils=require(_0x9154('0x2'));var recordings={};function writeDB(_0x9971f8){utils[_0x9154('0x3')](util[_0x9154('0x4')](_0x9154('0x5'),_0x9971f8[_0x9154('0x6')]));if(_0x9971f8[_0x9154('0x7')]){utils['getUserByInternal'](_0x9971f8[_0x9154('0x7')])['then'](function(_0xd9b204){if(_0xd9b204){_0x9971f8['membername']=_0xd9b204[_0x9154('0x8')];_0x9971f8['UserId']=_0xd9b204['id'];}utils[_0x9154('0x9')](_0x9154('0xa'),_0x9971f8);});}else{utils[_0x9154('0x9')](_0x9154('0xa'),_0x9971f8);}}exports['newchannel']=function(_0x5c8709){try{utils[_0x9154('0xb')](util[_0x9154('0x4')]('[%s][recordings][newchannel]',_0x5c8709[_0x9154('0x6')]),_0x5c8709);if(_0x5c8709[_0x9154('0x6')]==_0x5c8709['linkedid']){utils[_0x9154('0x3')](util[_0x9154('0x4')](_0x9154('0xc'),_0x5c8709[_0x9154('0x6')],_0x5c8709['context'],_0x5c8709[_0x9154('0xd')]));recordings[_0x5c8709['uniqueid']]={'uniqueid':_0x5c8709[_0x9154('0x6')],'accountcode':_0x5c8709[_0x9154('0x7')],'exten':_0x5c8709[_0x9154('0xd')],'context':_0x5c8709[_0x9154('0xe')],'channel':_0x5c8709[_0x9154('0xf')],'monitors':[]};}}catch(_0x5da1b2){utils[_0x9154('0x10')](util[_0x9154('0x4')](_0x9154('0x11'),_0x5c8709[_0x9154('0x6')]),_0x5da1b2);}};exports[_0x9154('0x12')]=function(_0x2deecd){try{utils[_0x9154('0xb')](util[_0x9154('0x4')]('[%s][recordings][newstate]',_0x2deecd[_0x9154('0x6')]),_0x2deecd);if(!_['isNil'](recordings[_0x2deecd['uniqueid']])&&_0x2deecd[_0x9154('0x13')]==0x6){utils['info'](util[_0x9154('0x4')](_0x9154('0x14'),_0x2deecd[_0x9154('0x6')],_0x2deecd[_0x9154('0xe')],_0x2deecd[_0x9154('0xf')]));}else if(!_[_0x9154('0x15')](recordings[_0x2deecd[_0x9154('0x16')]])&&_0x2deecd[_0x9154('0x13')]==0x6&&_0x2deecd['context']!=_0x9154('0x17')){utils[_0x9154('0x3')](util[_0x9154('0x4')](_0x9154('0x18'),_0x2deecd[_0x9154('0x6')],_0x2deecd[_0x9154('0x16')],_0x2deecd[_0x9154('0xe')],_0x2deecd[_0x9154('0xf')]));recordings[_0x2deecd[_0x9154('0x16')]][_0x9154('0x7')]=_0x2deecd[_0x9154('0x7')];}}catch(_0x588290){utils[_0x9154('0x10')](util[_0x9154('0x4')](_0x9154('0x19'),_0x2deecd[_0x9154('0x6')]),_0x588290);}};exports[_0x9154('0x1a')]=function(_0x2a775c){try{if(!_['isNil'](_0x2a775c[_0x9154('0x1b')])&&!_['isNil'](_0x2a775c[_0x9154('0x1b')][_0x9154('0x1c')])){utils[_0x9154('0xb')](util['format'](_0x9154('0x1d'),_0x2a775c['uniqueid']),_0x2a775c);utils[_0x9154('0x3')](util['format'](_0x9154('0x1e'),_0x2a775c['uniqueid'],_0x2a775c[_0x9154('0x1b')],_0x2a775c[_0x9154('0x1f')]));if(_['endsWith'](_0x2a775c[_0x9154('0x1f')],_0x9154('0x20'))){_0x2a775c[_0x9154('0x1f')]=_0x2a775c['value']['replace'](_0x9154('0x20'),_0x9154('0x21'));}if(recordings[_0x2a775c[_0x9154('0x16')]]){var _0x5effda=_[_0x9154('0x22')](recordings[_0x2a775c[_0x9154('0x16')]][_0x9154('0x23')],{'value':_0x2a775c[_0x9154('0x1f')]});if(_[_0x9154('0x15')](_0x5effda)){recordings[_0x2a775c[_0x9154('0x16')]][_0x9154('0x23')][_0x9154('0x24')]({'value':_0x2a775c[_0x9154('0x1f')]});}}}}catch(_0x48e0c4){utils[_0x9154('0x10')](util[_0x9154('0x4')]('[%s][recordings][varset]',_0x2a775c['uniqueid']),_0x48e0c4);}};exports[_0x9154('0x25')]=function(_0x2455f5){try{if(!_[_0x9154('0x15')](recordings[_0x2455f5['uniqueid']])){utils[_0x9154('0xb')](util[_0x9154('0x4')]('[%s][recordings][hangup]',_0x2455f5[_0x9154('0x6')]),_0x2455f5);utils[_0x9154('0x3')](util['format'](_0x9154('0x26'),_0x2455f5[_0x9154('0x6')],_0x2455f5[_0x9154('0x27')],_0x2455f5[_0x9154('0x28')],_0x2455f5[_0x9154('0x29')]));recordings[_0x2455f5[_0x9154('0x6')]][_0x9154('0x27')]=_0x2455f5[_0x9154('0x27')];recordings[_0x2455f5['uniqueid']][_0x9154('0x28')]=_0x2455f5['calleridname'];recordings[_0x2455f5[_0x9154('0x6')]][_0x9154('0x2a')]=_0x2455f5['connectedlinenum'];recordings[_0x2455f5[_0x9154('0x6')]][_0x9154('0x2b')]=_0x2455f5['connectedlinename'];if(recordings[_0x2455f5[_0x9154('0x6')]]['type']=='outbound'&&recordings[_0x2455f5[_0x9154('0x6')]]['accountcode']){recordings[_0x2455f5['uniqueid']][_0x9154('0x2a')]=recordings[_0x2455f5[_0x9154('0x6')]]['accountcode'];recordings[_0x2455f5[_0x9154('0x6')]]['connectedlinename']='';}recordings[_0x2455f5[_0x9154('0x6')]][_0x9154('0x23')][_0x9154('0x2c')](function(_0x3aa9fc){var _0x41b070=_[_0x9154('0x2d')](recordings[_0x2455f5[_0x9154('0x6')]]);_0x41b070[_0x9154('0x1f')]=_0x3aa9fc['value'];writeDB(_0x41b070);});delete recordings[_0x2455f5[_0x9154('0x6')]];}}catch(_0x3a51c2){utils['error'](util[_0x9154('0x4')]('[%s][recordings][hangup]',_0x2455f5[_0x9154('0x6')]),_0x3a51c2);}};exports['newexten']=function(_0x3c56f3){try{if(!_[_0x9154('0x15')](recordings[_0x3c56f3[_0x9154('0x6')]])){utils[_0x9154('0xb')](util[_0x9154('0x4')](_0x9154('0x2e'),_0x3c56f3[_0x9154('0x6')]),_0x3c56f3);utils[_0x9154('0x3')](util[_0x9154('0x4')](_0x9154('0x2f'),_0x3c56f3[_0x9154('0x6')],_0x3c56f3[_0x9154('0x30')],_0x3c56f3['appdata']));if(_0x3c56f3['application'][_0x9154('0x31')]()==_0x9154('0x32')&&_[_0x9154('0x33')](_0x3c56f3[_0x9154('0x34')][_0x9154('0x31')](),_0x9154('0x35'))){var _0x190db8=_0x3c56f3['appdata'][_0x9154('0x36')]('=');var _0x34dd4b=_0x190db8[0x0][_0x9154('0x37')](_0x190db8[0x0]['lastIndexOf']('(')+0x1,_0x190db8[0x0][_0x9154('0x38')](')'));var _0x5c864b=_0x190db8[0x1];recordings[_0x3c56f3[_0x9154('0x6')]][_0x34dd4b]=_0x5c864b;}}}catch(_0x38382c){utils[_0x9154('0x10')](util['format'](_0x9154('0x2e'),_0x3c56f3[_0x9154('0x6')]),_0x38382c);}};exports[_0x9154('0x39')]=function(_0x185af1){try{if(!_[_0x9154('0x15')](recordings[_0x185af1[_0x9154('0x6')]])){utils[_0x9154('0xb')](util[_0x9154('0x4')](_0x9154('0x3a'),_0x185af1[_0x9154('0x6')]),_0x185af1);utils[_0x9154('0x3')](util[_0x9154('0x4')](_0x9154('0x3b'),_0x185af1[_0x9154('0x6')],_0x185af1[_0x9154('0x3c')]));recordings[_0x185af1[_0x9154('0x6')]][_0x9154('0x3c')]=_0x185af1[_0x9154('0x3c')];}}catch(_0x5d0b54){utils[_0x9154('0x10')](util[_0x9154('0x4')]('[%s][recordings][queuecallerjoin]',_0x185af1[_0x9154('0x6')]),_0x5d0b54);}}; \ No newline at end of file +var _0x6031=['.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x6031,0x197));var _0x1603=function(_0xc21f24,_0x49e927){_0xc21f24=_0xc21f24-0x0;var _0x16dcc7=_0x6031[_0xc21f24];return _0x16dcc7;};'use strict';var _=require(_0x1603('0x0'));var util=require(_0x1603('0x1'));var utils=require(_0x1603('0x2'));var recordings={};function writeDB(_0x18678b){utils[_0x1603('0x3')](util[_0x1603('0x4')]('[%s][recordings][writeDB]',_0x18678b[_0x1603('0x5')]));if(_0x18678b[_0x1603('0x6')]){utils[_0x1603('0x7')](_0x18678b[_0x1603('0x6')])[_0x1603('0x8')](function(_0x20dfcb){if(_0x20dfcb){_0x18678b[_0x1603('0x9')]=_0x20dfcb[_0x1603('0xa')];_0x18678b[_0x1603('0xb')]=_0x20dfcb['id'];}utils[_0x1603('0xc')](_0x1603('0xd'),_0x18678b);});}else{utils[_0x1603('0xc')]('CreateVoiceRecording',_0x18678b);}}exports[_0x1603('0xe')]=function(_0x3c8a19){try{utils[_0x1603('0xf')](util['format'](_0x1603('0x10'),_0x3c8a19[_0x1603('0x5')]),_0x3c8a19);if(_0x3c8a19['uniqueid']==_0x3c8a19[_0x1603('0x11')]){utils[_0x1603('0x3')](util['format'](_0x1603('0x12'),_0x3c8a19['uniqueid'],_0x3c8a19['context'],_0x3c8a19[_0x1603('0x13')]));recordings[_0x3c8a19[_0x1603('0x5')]]={'uniqueid':_0x3c8a19[_0x1603('0x5')],'accountcode':_0x3c8a19[_0x1603('0x6')],'exten':_0x3c8a19[_0x1603('0x13')],'context':_0x3c8a19[_0x1603('0x14')],'channel':_0x3c8a19[_0x1603('0x15')],'monitors':[]};}}catch(_0x388703){utils[_0x1603('0x16')](util[_0x1603('0x4')]('[%s][recordings][newchannel]',_0x3c8a19[_0x1603('0x5')]),_0x388703);}};exports['newstate']=function(_0x2f8c5d){try{utils[_0x1603('0xf')](util[_0x1603('0x4')](_0x1603('0x17'),_0x2f8c5d[_0x1603('0x5')]),_0x2f8c5d);if(!_[_0x1603('0x18')](recordings[_0x2f8c5d[_0x1603('0x5')]])&&_0x2f8c5d[_0x1603('0x19')]==0x6){utils[_0x1603('0x3')](util[_0x1603('0x4')](_0x1603('0x1a'),_0x2f8c5d[_0x1603('0x5')],_0x2f8c5d[_0x1603('0x14')],_0x2f8c5d[_0x1603('0x15')]));}else if(!_[_0x1603('0x18')](recordings[_0x2f8c5d['linkedid']])&&_0x2f8c5d[_0x1603('0x19')]==0x6&&_0x2f8c5d['context']!=_0x1603('0x1b')){utils[_0x1603('0x3')](util['format'](_0x1603('0x1c'),_0x2f8c5d['uniqueid'],_0x2f8c5d[_0x1603('0x11')],_0x2f8c5d[_0x1603('0x14')],_0x2f8c5d['channel']));recordings[_0x2f8c5d[_0x1603('0x11')]][_0x1603('0x6')]=_0x2f8c5d['accountcode'];}}catch(_0x280621){utils[_0x1603('0x16')](util[_0x1603('0x4')]('[%s][recordings][newstate]',_0x2f8c5d[_0x1603('0x5')]),_0x280621);}};exports['varset']=function(_0x1cba9c){try{if(!_[_0x1603('0x18')](_0x1cba9c[_0x1603('0x1d')])&&!_['isNil'](_0x1cba9c[_0x1603('0x1d')][_0x1603('0x1e')])){utils[_0x1603('0xf')](util['format'](_0x1603('0x1f'),_0x1cba9c[_0x1603('0x5')]),_0x1cba9c);utils[_0x1603('0x3')](util[_0x1603('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1cba9c[_0x1603('0x5')],_0x1cba9c['variable'],_0x1cba9c[_0x1603('0x20')]));if(_[_0x1603('0x21')](_0x1cba9c['value'],'.wav49')){_0x1cba9c['value']=_0x1cba9c[_0x1603('0x20')]['replace'](_0x1603('0x22'),_0x1603('0x23'));}if(recordings[_0x1cba9c[_0x1603('0x11')]]){var _0x3c4f2e=_[_0x1603('0x24')](recordings[_0x1cba9c[_0x1603('0x11')]]['monitors'],{'value':_0x1cba9c[_0x1603('0x20')]});if(_['isNil'](_0x3c4f2e)){recordings[_0x1cba9c[_0x1603('0x11')]][_0x1603('0x25')][_0x1603('0x26')]({'value':_0x1cba9c['value']});}}}}catch(_0x16ba72){utils['error'](util[_0x1603('0x4')](_0x1603('0x1f'),_0x1cba9c[_0x1603('0x5')]),_0x16ba72);}};exports['hangup']=function(_0x15f6c1){try{if(!_['isNil'](recordings[_0x15f6c1['uniqueid']])){utils[_0x1603('0xf')](util[_0x1603('0x4')](_0x1603('0x27'),_0x15f6c1[_0x1603('0x5')]),_0x15f6c1);utils['info'](util[_0x1603('0x4')](_0x1603('0x28'),_0x15f6c1[_0x1603('0x5')],_0x15f6c1['calleridnum'],_0x15f6c1[_0x1603('0x29')],_0x15f6c1[_0x1603('0x2a')]));recordings[_0x15f6c1[_0x1603('0x5')]]['calleridnum']=_0x15f6c1[_0x1603('0x2b')];recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x29')]=_0x15f6c1[_0x1603('0x29')];recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x2c')]=_0x15f6c1[_0x1603('0x2c')];recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x2d')]=_0x15f6c1[_0x1603('0x2d')];if(recordings[_0x15f6c1['uniqueid']][_0x1603('0x2e')]==_0x1603('0x2f')&&recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x6')]){recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x2c')]=recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x6')];recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x2d')]='';}recordings[_0x15f6c1[_0x1603('0x5')]][_0x1603('0x25')][_0x1603('0x30')](function(_0x29bf71){var _0x453dfd=_[_0x1603('0x31')](recordings[_0x15f6c1[_0x1603('0x5')]]);_0x453dfd[_0x1603('0x20')]=_0x29bf71['value'];writeDB(_0x453dfd);});delete recordings[_0x15f6c1[_0x1603('0x5')]];}}catch(_0x2e1cbc){utils['error'](util[_0x1603('0x4')](_0x1603('0x27'),_0x15f6c1[_0x1603('0x5')]),_0x2e1cbc);}};exports[_0x1603('0x32')]=function(_0x2a9451){try{if(!_['isNil'](recordings[_0x2a9451['uniqueid']])){utils[_0x1603('0xf')](util[_0x1603('0x4')](_0x1603('0x33'),_0x2a9451[_0x1603('0x5')]),_0x2a9451);utils[_0x1603('0x3')](util[_0x1603('0x4')](_0x1603('0x34'),_0x2a9451[_0x1603('0x5')],_0x2a9451['application'],_0x2a9451[_0x1603('0x35')]));if(_0x2a9451[_0x1603('0x36')]['toLowerCase']()==_0x1603('0x37')&&_['startsWith'](_0x2a9451[_0x1603('0x35')][_0x1603('0x38')](),_0x1603('0x39'))){var _0x2711ae=_0x2a9451[_0x1603('0x35')][_0x1603('0x3a')]('=');var _0x8b222e=_0x2711ae[0x0]['substring'](_0x2711ae[0x0][_0x1603('0x3b')]('(')+0x1,_0x2711ae[0x0][_0x1603('0x3b')](')'));var _0x2c3a25=_0x2711ae[0x1];recordings[_0x2a9451['uniqueid']][_0x8b222e]=_0x2c3a25;}}}catch(_0x809f9c){utils[_0x1603('0x16')](util[_0x1603('0x4')](_0x1603('0x33'),_0x2a9451[_0x1603('0x5')]),_0x809f9c);}};exports[_0x1603('0x3c')]=function(_0xc96ae5){try{if(!_[_0x1603('0x18')](recordings[_0xc96ae5[_0x1603('0x5')]])){utils[_0x1603('0xf')](util[_0x1603('0x4')](_0x1603('0x3d'),_0xc96ae5[_0x1603('0x5')]),_0xc96ae5);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xc96ae5[_0x1603('0x5')],_0xc96ae5[_0x1603('0x3e')]));recordings[_0xc96ae5[_0x1603('0x5')]][_0x1603('0x3e')]=_0xc96ae5[_0x1603('0x3e')];}}catch(_0x10fc4b){utils[_0x1603('0x16')](util[_0x1603('0x4')]('[%s][recordings][queuecallerjoin]',_0xc96ae5[_0x1603('0x5')]),_0x10fc4b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4c46570..caed578 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 _0x9871=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','format','transferercalleridnum','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x5b8d95,_0x552ba7){var _0x165bb6=function(_0xefee2a){while(--_0xefee2a){_0x5b8d95['push'](_0x5b8d95['shift']());}};_0x165bb6(++_0x552ba7);}(_0x9871,0x12a));var _0x1987=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9871[_0x56916d];return _0x2b7f1f;};'use strict';var _=require('lodash');var util=require(_0x1987('0x0'));var utils=require(_0x1987('0x1'));function writeDB(_0x4ec33f){utils[_0x1987('0x2')](util['format'](_0x1987('0x3'),_0x4ec33f[_0x1987('0x4')]===_0x1987('0x5')?_0x4ec33f[_0x1987('0x6')]:_0x4ec33f[_0x1987('0x7')],_0x4ec33f[_0x1987('0x4')]));utils['request'](_0x1987('0x8'),_0x4ec33f);}exports[_0x1987('0x9')]=function(_0x411b05){try{utils[_0x1987('0xa')](util['format'](_0x1987('0xb'),_0x411b05[_0x1987('0x7')]),_0x411b05);utils['info'](util[_0x1987('0xc')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x411b05[_0x1987('0x7')],_0x411b05[_0x1987('0xd')],_0x411b05['transferercalleridname'],_0x411b05[_0x1987('0xe')],_0x411b05['transfereecalleridname']));_0x411b05['type']=_0x1987('0xf');writeDB(_0x411b05);}catch(_0x499bcb){utils[_0x1987('0x10')](util['format']('[%s][transfers][blindtransfer]',_0x411b05['uniqueid']),_0x499bcb);}};exports[_0x1987('0x11')]=function(_0x265150){try{utils['debug'](util['format'](_0x1987('0x12'),_0x265150['origtransfereruniqueid']),_0x265150);utils[_0x1987('0x2')](util[_0x1987('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x265150[_0x1987('0x6')],_0x265150[_0x1987('0x13')],_0x265150[_0x1987('0x14')],_0x265150[_0x1987('0x15')],_0x265150[_0x1987('0x16')]));_0x265150=_[_0x1987('0x17')](_0x265150,{'transfererchannel':_0x265150[_0x1987('0x18')],'transferercalleridnum':_0x265150['origtransferercalleridnum'],'transferercalleridname':_0x265150[_0x1987('0x14')],'transfererconnectedlinenum':_0x265150[_0x1987('0x19')],'transfererconnectedlinename':_0x265150[_0x1987('0x1a')],'transfereraccountcode':_0x265150[_0x1987('0x1b')],'transferercontext':_0x265150[_0x1987('0x1c')],'transfererexten':_0x265150[_0x1987('0x1d')],'transfererlinkedid':_0x265150[_0x1987('0x1e')],'context':_0x265150[_0x1987('0x1f')],'extension':_0x265150[_0x1987('0x20')],'type':_0x1987('0x5')});if(_[_0x1987('0x21')](_0x265150[_0x1987('0x22')])){_0x265150=_[_0x1987('0x17')](_0x265150,{'transfereechannel':_0x265150[_0x1987('0x23')],'transfereecalleridnum':_0x265150[_0x1987('0x15')],'transfereecalleridname':_0x265150[_0x1987('0x16')],'transfereeconnectedlinenum':_0x265150[_0x1987('0x24')],'transfereeconnectedlinename':_0x265150[_0x1987('0x25')],'transfereeaccountcode':_0x265150[_0x1987('0x26')],'transfereecontext':_0x265150['transfertargetcontext'],'transfereeexten':_0x265150['transfertargetexten'],'transfereelinkedid':_0x265150[_0x1987('0x27')]});}writeDB(_0x265150);}catch(_0x542297){utils['error'](util['format']('[%s][transfers][attendedtransfer]',_0x265150['origtransfereruniqueid']),_0x542297);}}; \ No newline at end of file +var _0xf7b2=['assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','[%s][transfers][attendedtransfer]','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','error','[%s][transfers][blindtransfer]','attendedtransfer','origtransferercalleridnum','transfertargetcalleridnum'];(function(_0x460211,_0x23143f){var _0x60d77e=function(_0x40b451){while(--_0x40b451){_0x460211['push'](_0x460211['shift']());}};_0x60d77e(++_0x23143f);}(_0xf7b2,0x83));var _0x2f7b=function(_0x4c1942,_0x337ba5){_0x4c1942=_0x4c1942-0x0;var _0x22b741=_0xf7b2[_0x4c1942];return _0x22b741;};'use strict';var _=require('lodash');var util=require(_0x2f7b('0x0'));var utils=require(_0x2f7b('0x1'));function writeDB(_0x5b5d6e){utils[_0x2f7b('0x2')](util[_0x2f7b('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x5b5d6e[_0x2f7b('0x4')]===_0x2f7b('0x5')?_0x5b5d6e[_0x2f7b('0x6')]:_0x5b5d6e[_0x2f7b('0x7')],_0x5b5d6e[_0x2f7b('0x4')]));utils[_0x2f7b('0x8')](_0x2f7b('0x9'),_0x5b5d6e);}exports[_0x2f7b('0xa')]=function(_0x5767fa){try{utils[_0x2f7b('0xb')](util['format']('[%s][transfers][blindtransfer]',_0x5767fa['uniqueid']),_0x5767fa);utils['info'](util['format'](_0x2f7b('0xc'),_0x5767fa['uniqueid'],_0x5767fa[_0x2f7b('0xd')],_0x5767fa[_0x2f7b('0xe')],_0x5767fa['transfereecalleridnum'],_0x5767fa[_0x2f7b('0xf')]));_0x5767fa[_0x2f7b('0x4')]='blind';writeDB(_0x5767fa);}catch(_0x827be2){utils[_0x2f7b('0x10')](util[_0x2f7b('0x3')](_0x2f7b('0x11'),_0x5767fa[_0x2f7b('0x7')]),_0x827be2);}};exports[_0x2f7b('0x12')]=function(_0x400059){try{utils[_0x2f7b('0xb')](util[_0x2f7b('0x3')]('[%s][transfers][attendedtransfer]',_0x400059[_0x2f7b('0x6')]),_0x400059);utils[_0x2f7b('0x2')](util[_0x2f7b('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x400059[_0x2f7b('0x6')],_0x400059[_0x2f7b('0x13')],_0x400059['origtransferercalleridname'],_0x400059[_0x2f7b('0x14')],_0x400059['transfertargetcalleridname']));_0x400059=_[_0x2f7b('0x15')](_0x400059,{'transfererchannel':_0x400059[_0x2f7b('0x16')],'transferercalleridnum':_0x400059[_0x2f7b('0x13')],'transferercalleridname':_0x400059[_0x2f7b('0x17')],'transfererconnectedlinenum':_0x400059[_0x2f7b('0x18')],'transfererconnectedlinename':_0x400059['secondtransfererconnectedlinename'],'transfereraccountcode':_0x400059[_0x2f7b('0x19')],'transferercontext':_0x400059[_0x2f7b('0x1a')],'transfererexten':_0x400059[_0x2f7b('0x1b')],'transfererlinkedid':_0x400059[_0x2f7b('0x1c')],'context':_0x400059[_0x2f7b('0x1d')],'extension':_0x400059['origtransfererexten'],'type':_0x2f7b('0x5')});if(_['isNil'](_0x400059[_0x2f7b('0x1e')])){_0x400059=_[_0x2f7b('0x15')](_0x400059,{'transfereechannel':_0x400059[_0x2f7b('0x1f')],'transfereecalleridnum':_0x400059[_0x2f7b('0x14')],'transfereecalleridname':_0x400059[_0x2f7b('0x20')],'transfereeconnectedlinenum':_0x400059[_0x2f7b('0x21')],'transfereeconnectedlinename':_0x400059[_0x2f7b('0x22')],'transfereeaccountcode':_0x400059[_0x2f7b('0x23')],'transfereecontext':_0x400059['transfertargetcontext'],'transfereeexten':_0x400059[_0x2f7b('0x24')],'transfereelinkedid':_0x400059['transfertargetlinkedid']});}writeDB(_0x400059);}catch(_0x5d8312){utils[_0x2f7b('0x10')](util[_0x2f7b('0x3')](_0x2f7b('0x25'),_0x400059[_0x2f7b('0x6')]),_0x5d8312);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d845a3e..e6c91dd 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 _0x61c7=['[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','error','inspect','then','[utils][request]\x20name:%s','request','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s'];(function(_0x4af512,_0x50d3cb){var _0x146f7a=function(_0x55af02){while(--_0x55af02){_0x4af512['push'](_0x4af512['shift']());}};_0x146f7a(++_0x50d3cb);}(_0x61c7,0x76));var _0x761c=function(_0x59f6be,_0x472a09){_0x59f6be=_0x59f6be-0x0;var _0x2aef59=_0x61c7[_0x59f6be];return _0x2aef59;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x761c('0x0'));var moment=require(_0x761c('0x1'));var util=require(_0x761c('0x2'));var client=jayson[_0x761c('0x3')][_0x761c('0x4')]({'port':0x2329});var logger=require(_0x761c('0x5'))(_0x761c('0x6'));exports[_0x761c('0x7')]=function(_0x3f10ab,_0x4f4c36){logger[_0x761c('0x7')](_0x3f10ab,_0x4f4c36?util['inspect'](_0x4f4c36,{'showHidden':![],'depth':null}):'');};exports[_0x761c('0x8')]=function(_0x4cd253,_0x3f63cf){logger[_0x761c('0x8')](_0x4cd253,_0x3f63cf?util['inspect'](_0x3f63cf,{'showHidden':![],'depth':null}):'');};exports[_0x761c('0x9')]=function(_0x1ccbaa,_0x2b5c15){logger[_0x761c('0x9')](_0x1ccbaa,_0x2b5c15?util[_0x761c('0xa')](_0x2b5c15,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4e6c10,_0x6b4067){return client['request'](_0x4e6c10,{'body':_0x6b4067})[_0x761c('0xb')](function(_0x5c713f){logger[_0x761c('0x8')](_0x761c('0xc'),_0x4e6c10,_0x5c713f?util[_0x761c('0xa')](_0x5c713f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1b5183){logger[_0x761c('0x9')](_0x761c('0xc'),_0x4e6c10,_0x1b5183?util['inspect'](_0x1b5183,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3a2127){return client[_0x761c('0xd')](_0x761c('0xe'),{'options':{'raw':!![],'attributes':['id',_0x761c('0xf'),_0x761c('0x10'),'interface'],'where':_0x3a2127,'limit':0x1}})[_0x761c('0xb')](function(_0x39aeaa){logger['debug'](_0x761c('0x11'),JSON[_0x761c('0x12')](_0x3a2127),_0x39aeaa?util[_0x761c('0xa')](_0x39aeaa,{'showHidden':![],'depth':null}):'');return _0x39aeaa['result'][_0x761c('0x13')]?_0x39aeaa['result'][0x0]:null;});}exports[_0x761c('0x14')]=function(_0x100f4e){return new BPromise(function(_0x4a1132,_0x58c178){if(_0x100f4e){return getUser({'internal':_0x100f4e})[_0x761c('0xb')](function(_0xb5e4ff){logger['info'](_0x761c('0x15'),_0x100f4e,_0xb5e4ff?'found':_0x761c('0x16'));return _0x4a1132(_0xb5e4ff);})[_0x761c('0x17')](function(_0xf272aa){logger[_0x761c('0x9')](_0x761c('0x18'),_0xf272aa?util[_0x761c('0xa')](_0xf272aa,{'showHidden':![],'depth':null}):'');return _0x4a1132(null);});}return _0x4a1132(null);});};exports['getUserByInterface']=function(_0x4cd9c2){return new BPromise(function(_0x3bbf6c,_0x272c28){if(_0x4cd9c2){return getUser({'interface':_0x4cd9c2})[_0x761c('0xb')](function(_0x521404){logger[_0x761c('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x4cd9c2,_0x521404?_0x761c('0x19'):_0x761c('0x16'));return _0x3bbf6c(_0x521404);})[_0x761c('0x17')](function(_0x4a15bd){logger[_0x761c('0x9')](_0x761c('0x1a'),_0x4a15bd?util[_0x761c('0xa')](_0x4a15bd,{'showHidden':![],'depth':null}):'');return _0x3bbf6c(null);});}return _0x3bbf6c(null);});};exports[_0x761c('0x1b')]=function(_0x214502){return new BPromise(function(_0x38b94c,_0x4c0a8a){if(_0x214502){return getUser({'name':_0x214502})[_0x761c('0xb')](function(_0x18fce2){logger['info'](_0x761c('0x1c'),_0x214502,_0x18fce2?_0x761c('0x19'):'notfound');return _0x38b94c(_0x18fce2);})['catch'](function(_0x421acd){logger['error'](_0x761c('0x1d'),_0x421acd?util[_0x761c('0xa')](_0x421acd,{'showHidden':![],'depth':null}):'');return _0x38b94c(null);});}return _0x38b94c(null);});};exports[_0x761c('0x1e')]=function(_0x199595){return new BPromise(function(_0x207a1e,_0x4b04c8){if(_0x199595){return client[_0x761c('0xd')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x761c('0x10'),_0x761c('0x1f'),_0x761c('0x20'),_0x761c('0x21')],'where':{'name':_0x199595},'limit':0x1}})['then'](function(_0x1d9d7e){logger[_0x761c('0x8')](_0x761c('0x22'),_0x199595,_0x1d9d7e?util['inspect'](_0x1d9d7e,{'showHidden':![],'depth':null}):'');logger[_0x761c('0x7')](_0x761c('0x23'),_0x199595,_0x1d9d7e?_0x761c('0x19'):_0x761c('0x16'));return _0x207a1e(_0x1d9d7e[_0x761c('0x24')][_0x761c('0x13')]?_0x1d9d7e[_0x761c('0x24')][0x0]:null);})['catch'](function(_0x3cc0a8){logger['error'](_0x761c('0x25'),_0x3cc0a8?util[_0x761c('0xa')](_0x3cc0a8,{'showHidden':![],'depth':null}):'');return _0x207a1e(null);});}return _0x207a1e(null);});};exports[_0x761c('0x26')]=function(_0x416c95,_0x1be8bb){return moment(_0x416c95)[_0x761c('0x27')](_0x1be8bb,_0x761c('0x28'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x761c('0x29')]=function(_0x338e0f,_0xa60f0c){return moment(_0x338e0f)[_0x761c('0x2a')](_0xa60f0c,_0x761c('0x28'))[_0x761c('0x2b')](_0x761c('0x2c'));};exports[_0x761c('0x2d')]=function(_0x5af5be,_0x5b2679){return moment(_0x5af5be)[_0x761c('0x2e')](moment(_0x5b2679),_0x761c('0x28'));};exports[_0x761c('0x2f')]=function(_0x3b17d7,_0xb4653d){return parseInt(_0x3b17d7,0xa)+parseInt(_0xb4653d,0xa);};exports[_0x761c('0x30')]=function(){return moment()[_0x761c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x761c('0x31')]=function(_0x31f011,_0x2a378f){if(_0x2a378f){return moment(_0x31f011)[_0x761c('0x31')](_0x2a378f);}return!![];};exports[_0x761c('0x32')]=function(_0x59764c,_0x42e653){if(_0x42e653){return moment(_0x59764c)['isBefore'](_0x42e653);}else if(_0x59764c){return!![];}return![];}; \ No newline at end of file +var _0xeeda=['notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','catch','internal','name','stringify','result','length','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xeeda,0x1be));var _0xaeed=function(_0x415443,_0x415640){_0x415443=_0x415443-0x0;var _0x576828=_0xeeda[_0x415443];return _0x576828;};'use strict';var BPromise=require(_0xaeed('0x0'));var jayson=require(_0xaeed('0x1'));var moment=require(_0xaeed('0x2'));var util=require(_0xaeed('0x3'));var client=jayson[_0xaeed('0x4')][_0xaeed('0x5')]({'port':0x2329});var logger=require(_0xaeed('0x6'))(_0xaeed('0x7'));exports[_0xaeed('0x8')]=function(_0x423827,_0x2300ee){logger['info'](_0x423827,_0x2300ee?util['inspect'](_0x2300ee,{'showHidden':![],'depth':null}):'');};exports[_0xaeed('0x9')]=function(_0x3841d9,_0xbbabf5){logger[_0xaeed('0x9')](_0x3841d9,_0xbbabf5?util[_0xaeed('0xa')](_0xbbabf5,{'showHidden':![],'depth':null}):'');};exports[_0xaeed('0xb')]=function(_0x458272,_0x166255){logger[_0xaeed('0xb')](_0x458272,_0x166255?util[_0xaeed('0xa')](_0x166255,{'showHidden':![],'depth':null}):'');};exports[_0xaeed('0xc')]=function(_0x2df290,_0x7dda4f){return client[_0xaeed('0xc')](_0x2df290,{'body':_0x7dda4f})[_0xaeed('0xd')](function(_0x16d0a2){logger[_0xaeed('0x9')]('[utils][request]\x20name:%s',_0x2df290,_0x16d0a2?util[_0xaeed('0xa')](_0x16d0a2,{'showHidden':![],'depth':null}):'');})[_0xaeed('0xe')](function(_0x5716a2){logger['error']('[utils][request]\x20name:%s',_0x2df290,_0x5716a2?util[_0xaeed('0xa')](_0x5716a2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x255dbb){return client[_0xaeed('0xc')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xaeed('0xf'),_0xaeed('0x10'),'interface'],'where':_0x255dbb,'limit':0x1}})[_0xaeed('0xd')](function(_0x178831){logger[_0xaeed('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xaeed('0x11')](_0x255dbb),_0x178831?util['inspect'](_0x178831,{'showHidden':![],'depth':null}):'');return _0x178831[_0xaeed('0x12')][_0xaeed('0x13')]?_0x178831[_0xaeed('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x2b6363){return new BPromise(function(_0x54380,_0x52c5c5){if(_0x2b6363){return getUser({'internal':_0x2b6363})[_0xaeed('0xd')](function(_0x344c0e){logger[_0xaeed('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2b6363,_0x344c0e?_0xaeed('0x14'):'notfound');return _0x54380(_0x344c0e);})['catch'](function(_0x54d35f){logger[_0xaeed('0xb')](_0xaeed('0x15'),_0x54d35f?util['inspect'](_0x54d35f,{'showHidden':![],'depth':null}):'');return _0x54380(null);});}return _0x54380(null);});};exports[_0xaeed('0x16')]=function(_0x511475){return new BPromise(function(_0x34a16b,_0x16f747){if(_0x511475){return getUser({'interface':_0x511475})[_0xaeed('0xd')](function(_0x1a5481){logger[_0xaeed('0x8')](_0xaeed('0x17'),_0x511475,_0x1a5481?_0xaeed('0x14'):_0xaeed('0x18'));return _0x34a16b(_0x1a5481);})['catch'](function(_0x368ce5){logger[_0xaeed('0xb')](_0xaeed('0x19'),_0x368ce5?util[_0xaeed('0xa')](_0x368ce5,{'showHidden':![],'depth':null}):'');return _0x34a16b(null);});}return _0x34a16b(null);});};exports[_0xaeed('0x1a')]=function(_0xac908){return new BPromise(function(_0x13bf50,_0x10ce48){if(_0xac908){return getUser({'name':_0xac908})[_0xaeed('0xd')](function(_0x4ce31e){logger[_0xaeed('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0xac908,_0x4ce31e?_0xaeed('0x14'):_0xaeed('0x18'));return _0x13bf50(_0x4ce31e);})['catch'](function(_0x3c8d46){logger[_0xaeed('0xb')](_0xaeed('0x1b'),_0x3c8d46?util[_0xaeed('0xa')](_0x3c8d46,{'showHidden':![],'depth':null}):'');return _0x13bf50(null);});}return _0x13bf50(null);});};exports[_0xaeed('0x1c')]=function(_0x45455f){return new BPromise(function(_0x4124e9,_0x181f41){if(_0x45455f){return client['request'](_0xaeed('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xaeed('0x10'),_0xaeed('0x1e'),_0xaeed('0x1f'),_0xaeed('0x20')],'where':{'name':_0x45455f},'limit':0x1}})['then'](function(_0x1801ef){logger['debug'](_0xaeed('0x21'),_0x45455f,_0x1801ef?util[_0xaeed('0xa')](_0x1801ef,{'showHidden':![],'depth':null}):'');logger[_0xaeed('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x45455f,_0x1801ef?'found':'notfound');return _0x4124e9(_0x1801ef['result'][_0xaeed('0x13')]?_0x1801ef[_0xaeed('0x12')][0x0]:null);})[_0xaeed('0xe')](function(_0x418709){logger[_0xaeed('0xb')](_0xaeed('0x22'),_0x418709?util[_0xaeed('0xa')](_0x418709,{'showHidden':![],'depth':null}):'');return _0x4124e9(null);});}return _0x4124e9(null);});};exports[_0xaeed('0x23')]=function(_0x5c1324,_0x333a28){return moment(_0x5c1324)[_0xaeed('0x24')](_0x333a28,_0xaeed('0x25'))[_0xaeed('0x26')](_0xaeed('0x27'));};exports[_0xaeed('0x28')]=function(_0x12609b,_0x528675){return moment(_0x12609b)[_0xaeed('0x29')](_0x528675,'seconds')['format'](_0xaeed('0x27'));};exports[_0xaeed('0x2a')]=function(_0x2b13ab,_0x5b99b2){return moment(_0x2b13ab)[_0xaeed('0x2b')](moment(_0x5b99b2),_0xaeed('0x25'));};exports[_0xaeed('0x2c')]=function(_0x20c5fd,_0x352a5f){return parseInt(_0x20c5fd,0xa)+parseInt(_0x352a5f,0xa);};exports['now']=function(){return moment()[_0xaeed('0x26')](_0xaeed('0x27'));};exports[_0xaeed('0x2d')]=function(_0x2d021d,_0xdc9f0c){if(_0xdc9f0c){return moment(_0x2d021d)[_0xaeed('0x2d')](_0xdc9f0c);}return!![];};exports['isBefore']=function(_0x41afad,_0x4ea4a8){if(_0x4ea4a8){return moment(_0x41afad)[_0xaeed('0x2e')](_0x4ea4a8);}else if(_0x41afad){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 b1619b1..bd8aa74 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 _0xf8a2=['logger','agent_id','url','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','role','ensureDir','then','client','catch','user','no-user','data','timestamp','error','api','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','inspect'];(function(_0xbf2e72,_0x14acfd){var _0x8ffcdb=function(_0x1f16b9){while(--_0x1f16b9){_0xbf2e72['push'](_0xbf2e72['shift']());}};_0x8ffcdb(++_0x14acfd);}(_0xf8a2,0xc3));var _0x2f8a=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xf8a2[_0x45fc6a];return _0x14bcfd;};var fs=require(_0x2f8a('0x0'));var _=require(_0x2f8a('0x1'));var ewinston=require(_0x2f8a('0x2'));var path=require('path');var util=require(_0x2f8a('0x3'));var fileLogger=require(_0x2f8a('0x4'))['fileLogger'];var safeTemplate=require(_0x2f8a('0x5'))[_0x2f8a('0x6')];var maskSensitiveData=require(_0x2f8a('0x7'))[_0x2f8a('0x8')];function ClientSideLogger(){function _0x5e3d6b(_0x4239d3){var _0x4f9546=path[_0x2f8a('0x9')](_0x2f8a('0xa'),'log',_0x2f8a('0xb'));var _0x38f114=path['join']('client',_0x4239d3[_0x2f8a('0xc')]+'-'+_0x4239d3['name']);return fs[_0x2f8a('0xd')](path[_0x2f8a('0x9')](_0x4f9546,_0x38f114))[_0x2f8a('0xe')](function(){var _0x996c09=fileLogger(_0x2f8a('0xf'),path[_0x2f8a('0x9')](_0x4f9546,_0x38f114));return _0x996c09;})[_0x2f8a('0x10')](function(_0x3eb8f5){throw _0x3eb8f5;});}this['log']=function(_0x4eaa6a,_0x10f5b0,_0x186908,_0x484a44){return _0x5e3d6b(_0x4eaa6a[_0x2f8a('0x11')])[_0x2f8a('0xe')](function(_0x5ab46d){var _0x5087eb=_0x5ab46d[_0x10f5b0];return _0x5087eb;})[_0x2f8a('0xe')](function(_0x1ac838){var _0x2f6b5b=_0x4eaa6a['user']?_0x4eaa6a[_0x2f8a('0x11')]['id']:_0x2f8a('0x12');var _0x8db5b7=_0x484a44[_0x2f8a('0x13')];var _0x5a257e=_0x484a44[_0x2f8a('0x14')];var _0x5b8aee=new Date(Number(_0x5a257e));return _0x1ac838(_0x2f6b5b,_0x5b8aee,_0x186908,_0x8db5b7);})['catch'](function(_0xcd569f){fileLogger(_0x2f8a('0xf'))[_0x2f8a('0x15')](_0xcd569f);});};}function setupLoggers(_0x479b95){return new Promise(function(_0x450c1b){var _0x3f1c6a=new ClientSideLogger();var _0x52634e=fileLogger(_0x2f8a('0x16'));var _0x3f5e61=fileLogger(_0x2f8a('0x17'));_0x479b95['set'](_0x2f8a('0x18'),_0x3f1c6a);_0x479b95[_0x2f8a('0x19')](ewinston['logger']({'winstonInstance':_0x52634e,'meta':![],'statusLevels':!![],'msg':function(_0x3baee0,_0x26be27){var _0xeaac60=_0x2f8a('0x1a');if(!_[_0x2f8a('0x1b')](_0x3baee0[_0x2f8a('0x1c')])){_0xeaac60+=_0x2f8a('0x1d');var _0x42047d=_0x3baee0[_0x2f8a('0x1c')];maskSensitiveData(_0x42047d);}return safeTemplate(util[_0x2f8a('0x1e')](_0xeaac60,_0x3baee0[_0x2f8a('0x1f')],_0x3baee0[_0x2f8a('0x20')]['x-forwarded-for']?_0x3baee0[_0x2f8a('0x20')][_0x2f8a('0x21')]:_0x3baee0[_0x2f8a('0x22')][_0x2f8a('0x23')]||_0x3baee0['ip'],_0x3baee0['url'],_0x26be27[_0x2f8a('0x24')],_0x26be27[_0x2f8a('0x25')],_0x3baee0['user']?_0x3baee0[_0x2f8a('0x11')]['id']:null,_0x3baee0['user']?_0x3baee0[_0x2f8a('0x11')][_0x2f8a('0x26')]:null,_0x3baee0['user']?_0x3baee0[_0x2f8a('0x11')][_0x2f8a('0xc')]:null,_0x42047d?util[_0x2f8a('0x27')](_0x42047d,![],null):''));}}));_0x479b95[_0x2f8a('0x19')](ewinston[_0x2f8a('0x28')]({'winstonInstance':_0x3f5e61,'meta':![],'statusLevels':!![],'msg':function(_0x29e4a0,_0x2f4999){var _0x493e47='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x29e4a0['body']&&_0x29e4a0[_0x2f8a('0x1c')]['device']&&_0x29e4a0['body'][_0x2f8a('0x29')]){_0x493e47='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x2f8a('0x1e')](_0x493e47,_0x29e4a0[_0x2f8a('0x1f')],_0x29e4a0[_0x2f8a('0x20')][_0x2f8a('0x21')]?_0x29e4a0[_0x2f8a('0x20')][_0x2f8a('0x21')]:_0x29e4a0[_0x2f8a('0x22')]['remoteAddress']||_0x29e4a0['ip'],_0x29e4a0[_0x2f8a('0x2a')],_0x2f4999['statusCode'],_0x2f4999[_0x2f8a('0x25')],_0x29e4a0[_0x2f8a('0x11')]?_0x29e4a0[_0x2f8a('0x11')]['id']:null,_0x29e4a0[_0x2f8a('0x11')]?_0x29e4a0[_0x2f8a('0x11')][_0x2f8a('0x26')]:null,_0x29e4a0[_0x2f8a('0x11')]?_0x29e4a0[_0x2f8a('0x11')][_0x2f8a('0xc')]:null,_0x29e4a0[_0x2f8a('0x1c')]&&_0x29e4a0[_0x2f8a('0x1c')]['device']?_0x29e4a0['body']['device']:_0x2f8a('0x2b'),_0x29e4a0['body']&&_0x29e4a0[_0x2f8a('0x1c')][_0x2f8a('0x29')]?_0x29e4a0['body'][_0x2f8a('0x29')]:'',_0x29e4a0[_0x2f8a('0x1c')]&&_0x29e4a0[_0x2f8a('0x1c')]['agent_name']?_0x29e4a0[_0x2f8a('0x1c')][_0x2f8a('0x2c')]:'');},'ignoreRoute':function(_0x10d4d1){var _0x743c80=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x743c80[_0x2f8a('0x2d')](_0x10d4d1[_0x2f8a('0x2a')]);}}));return _0x450c1b();});}exports[_0x2f8a('0x2e')]=setupLoggers; \ No newline at end of file +var _0x20f7=['client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','x-forwarded-for','headers','connection','remoteAddress','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)','format','statusCode','agent_name','test','url','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','auth','set'];(function(_0x3df706,_0x2afce6){var _0x4cb963=function(_0x284a46){while(--_0x284a46){_0x3df706['push'](_0x3df706['shift']());}};_0x4cb963(++_0x2afce6);}(_0x20f7,0x160));var _0x720f=function(_0x1366e4,_0x2893d0){_0x1366e4=_0x1366e4-0x0;var _0x44d1c9=_0x20f7[_0x1366e4];return _0x44d1c9;};var fs=require(_0x720f('0x0'));var _=require(_0x720f('0x1'));var ewinston=require(_0x720f('0x2'));var path=require('path');var util=require(_0x720f('0x3'));var fileLogger=require(_0x720f('0x4'))['fileLogger'];var safeTemplate=require(_0x720f('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x720f('0x6'))[_0x720f('0x7')];function ClientSideLogger(){function _0x19e3e1(_0x5b81ab){var _0x55b127=path[_0x720f('0x8')](_0x720f('0x9'),_0x720f('0xa'),_0x720f('0xb'));var _0x141e27=path[_0x720f('0x8')](_0x720f('0xc'),_0x5b81ab[_0x720f('0xd')]+'-'+_0x5b81ab[_0x720f('0xe')]);return fs[_0x720f('0xf')](path[_0x720f('0x8')](_0x55b127,_0x141e27))[_0x720f('0x10')](function(){var _0x4e0c0c=fileLogger(_0x720f('0xc'),path[_0x720f('0x8')](_0x55b127,_0x141e27));return _0x4e0c0c;})[_0x720f('0x11')](function(_0x5ab846){throw _0x5ab846;});}this[_0x720f('0xa')]=function(_0x44828a,_0x3755b1,_0x2ba574,_0x1f4ca8){return _0x19e3e1(_0x44828a[_0x720f('0x12')])[_0x720f('0x10')](function(_0x13b6b6){var _0x33ca98=_0x13b6b6[_0x3755b1];return _0x33ca98;})[_0x720f('0x10')](function(_0x1284cf){var _0xe54bb7=_0x44828a[_0x720f('0x12')]?_0x44828a['user']['id']:_0x720f('0x13');var _0x5bc991=_0x1f4ca8[_0x720f('0x14')];var _0x7c0d47=_0x1f4ca8[_0x720f('0x15')];var _0x95f36e=new Date(Number(_0x7c0d47));return _0x1284cf(_0xe54bb7,_0x95f36e,_0x2ba574,_0x5bc991);})['catch'](function(_0x173f67){fileLogger(_0x720f('0xc'))['error'](_0x173f67);});};}function setupLoggers(_0x160f68){return new Promise(function(_0x5c56fe){var _0x1b8559=new ClientSideLogger();var _0xbf05c9=fileLogger('api');var _0x269a1a=fileLogger(_0x720f('0x16'));_0x160f68[_0x720f('0x17')](_0x720f('0x18'),_0x1b8559);_0x160f68[_0x720f('0x19')](ewinston[_0x720f('0x1a')]({'winstonInstance':_0xbf05c9,'meta':![],'statusLevels':!![],'msg':function(_0x2ee66b,_0xd8fb8){var _0x5bd2b3=_0x720f('0x1b');if(!_[_0x720f('0x1c')](_0x2ee66b[_0x720f('0x1d')])){_0x5bd2b3+='\x20body=%s';var _0x52263b=_0x2ee66b['body'];maskSensitiveData(_0x52263b);}return safeTemplate(util['format'](_0x5bd2b3,_0x2ee66b[_0x720f('0x1e')],_0x2ee66b['headers'][_0x720f('0x1f')]?_0x2ee66b[_0x720f('0x20')]['x-forwarded-for']:_0x2ee66b[_0x720f('0x21')][_0x720f('0x22')]||_0x2ee66b['ip'],_0x2ee66b['url'],_0xd8fb8['statusCode'],_0xd8fb8[_0x720f('0x23')],_0x2ee66b[_0x720f('0x12')]?_0x2ee66b['user']['id']:null,_0x2ee66b[_0x720f('0x12')]?_0x2ee66b[_0x720f('0x12')]['name']:null,_0x2ee66b[_0x720f('0x12')]?_0x2ee66b['user'][_0x720f('0xd')]:null,_0x52263b?util[_0x720f('0x24')](_0x52263b,![],null):''));}}));_0x160f68[_0x720f('0x19')](ewinston[_0x720f('0x1a')]({'winstonInstance':_0x269a1a,'meta':![],'statusLevels':!![],'msg':function(_0x7d6646,_0x2bb938){var _0x24ae3b=_0x720f('0x25');if(_0x7d6646[_0x720f('0x1d')]&&_0x7d6646['body'][_0x720f('0x26')]&&_0x7d6646[_0x720f('0x1d')][_0x720f('0x27')]){_0x24ae3b=_0x720f('0x28');}return util[_0x720f('0x29')](_0x24ae3b,_0x7d6646[_0x720f('0x1e')],_0x7d6646[_0x720f('0x20')][_0x720f('0x1f')]?_0x7d6646['headers']['x-forwarded-for']:_0x7d6646[_0x720f('0x21')][_0x720f('0x22')]||_0x7d6646['ip'],_0x7d6646['url'],_0x2bb938[_0x720f('0x2a')],_0x2bb938[_0x720f('0x23')],_0x7d6646[_0x720f('0x12')]?_0x7d6646[_0x720f('0x12')]['id']:null,_0x7d6646[_0x720f('0x12')]?_0x7d6646[_0x720f('0x12')]['name']:null,_0x7d6646[_0x720f('0x12')]?_0x7d6646[_0x720f('0x12')]['role']:null,_0x7d6646['body']&&_0x7d6646['body'][_0x720f('0x26')]?_0x7d6646['body']['device']:'other',_0x7d6646[_0x720f('0x1d')]&&_0x7d6646[_0x720f('0x1d')][_0x720f('0x27')]?_0x7d6646[_0x720f('0x1d')][_0x720f('0x27')]:'',_0x7d6646[_0x720f('0x1d')]&&_0x7d6646[_0x720f('0x1d')][_0x720f('0x2b')]?_0x7d6646[_0x720f('0x1d')][_0x720f('0x2b')]:'');},'ignoreRoute':function(_0x4c9297){var _0x3be563=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3be563[_0x720f('0x2c')](_0x4c9297[_0x720f('0x2d')]);}}));return _0x5c56fe();});}exports[_0x720f('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index b947e63..efbf2b1 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c84=['length','iftime','moment-timezone','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map','locale','slice','concat','exports','circularDoWInterval','toLowerCase','indexOf','circularMonthInterval','clone','minutes','hours','isBefore','startOf','endOf','day','isBetween','format','ddd','dowCompare','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','guess','test','split','padStart'];(function(_0x51f492,_0x6b3e08){var _0x4c76eb=function(_0x21ee25){while(--_0x21ee25){_0x51f492['push'](_0x51f492['shift']());}};_0x4c76eb(++_0x6b3e08);}(_0x2c84,0x132));var _0x42c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2c84[_0x1facfa];return _0x9ec701;};var _=require('lodash');var moment=require(_0x42c8('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x2e5c9c){return _0x2e5c9c[_0x42c8('0x1')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x42c8('0x2');var EINVALID_DATE=_0x42c8('0x3');function throwIfDateNotValid(_0x307523){if(!_0x307523[_0x42c8('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x46e626){var _0x2feeef=_0x46e626['split'](':')[_0x42c8('0x5')](function(_0x453d43){return parseInt(_0x453d43,0xa);});var _0x259be1=_0x2feeef[0x0];var _0x33fd7b=_0x2feeef[0x1];if(_0x259be1<0x0||_0x259be1>0x17||_0x33fd7b<0x0||_0x33fd7b>0x3b){throw new Error(EINVALID_DATE);}return[_0x259be1,_0x33fd7b];}function circularDoWInterval(_0x112ab8,_0x416a46){if(_0x112ab8===_0x416a46){return[_0x112ab8];}else{var _0x33e8db=moment[_0x42c8('0x6')]();moment['locale']('en');var _0x8beddd=moment['weekdaysShort']()['map'](function(_0x3da717){return _0x3da717['toLowerCase']();});moment[_0x42c8('0x6')](_0x33e8db);var _0x4841ef=_0x8beddd['indexOf'](_0x112ab8);var _0x517579=_0x8beddd['indexOf'](_0x416a46);if(_0x517579>_0x4841ef){return _0x8beddd[_0x42c8('0x7')](_0x4841ef,_0x517579+0x1);}else{var _0x3b0d27=_0x8beddd[_0x42c8('0x7')](0x0,_0x517579+0x1);var _0x3375c6=_0x8beddd[_0x42c8('0x7')](_0x4841ef);return _0x3375c6[_0x42c8('0x8')](_0x3b0d27);}}}module[_0x42c8('0x9')][_0x42c8('0xa')]=circularDoWInterval;function circularMonthInterval(_0x1109aa,_0x3c6d25){if(_0x1109aa===_0x3c6d25){return[_0x1109aa];}else{var _0x14ddee=moment[_0x42c8('0x6')]();moment[_0x42c8('0x6')]('en');var _0x52bc7=moment['monthsShort']()[_0x42c8('0x5')](function(_0x123fa0){return _0x123fa0[_0x42c8('0xb')]();});moment['locale'](_0x14ddee);var _0x1ba57e=_0x52bc7['indexOf'](_0x1109aa);var _0x3ba73e=_0x52bc7[_0x42c8('0xc')](_0x3c6d25);if(_0x3ba73e>_0x1ba57e){return _0x52bc7['slice'](_0x1ba57e,_0x3ba73e+0x1);}else{var _0x1b2959=_0x52bc7['slice'](0x0,_0x3ba73e+0x1);var _0x1467f7=_0x52bc7[_0x42c8('0x7')](_0x1ba57e);return _0x1467f7[_0x42c8('0x8')](_0x1b2959);}}}module[_0x42c8('0x9')][_0x42c8('0xd')]=circularMonthInterval;function parseDom(_0x189ed2){var _0x1182ce=parseInt(_0x189ed2,0xa);if(_0x1182ce<0x1||_0x1182ce>0x1f){throw new Error(EINVALID_DATE);}return _0x1182ce;}function timeCompare(_0x1ed23e,_0x3984f8,_0x49de32){var _0x50dca0=_0x1ed23e[_0x42c8('0xe')]();var _0xf1e74e=extractTime(_0x3984f8);var _0x487ba1=_0xf1e74e[0x0];var _0x355b4=_0xf1e74e[0x1];var _0x276dbc=_0x1ed23e[_0x42c8('0xe')]()['hours'](_0x487ba1)[_0x42c8('0xf')](_0x355b4);throwIfDateNotValid(_0x276dbc);var _0x324f60=extractTime(_0x49de32);var _0x57d53d=_0x324f60[0x0];var _0x23a6e7=_0x324f60[0x1];var _0x4bbafc=_0x1ed23e[_0x42c8('0xe')]()[_0x42c8('0x10')](_0x57d53d)[_0x42c8('0xf')](_0x23a6e7);throwIfDateNotValid(_0x4bbafc);if(_0x4bbafc[_0x42c8('0x11')](_0x276dbc)){var _0x475cd5=_0x50dca0[_0x42c8('0xe')]()[_0x42c8('0x12')]('day');var _0x3081b5=_0x50dca0[_0x42c8('0xe')]()[_0x42c8('0x13')](_0x42c8('0x14'));return _0x50dca0['isBetween'](_0x276dbc,_0x3081b5,undefined,'[]')||_0x50dca0[_0x42c8('0x15')](_0x475cd5,_0x4bbafc,undefined,'[]');}else{return _0x50dca0[_0x42c8('0x15')](_0x276dbc,_0x4bbafc,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x3b06e4,_0x362cc9,_0x563026){var _0x48cc9a=_0x3b06e4[_0x42c8('0x6')]('en')[_0x42c8('0x16')](_0x42c8('0x17'))[_0x42c8('0xb')]();return circularDoWInterval(_0x362cc9,_0x563026)['includes'](_0x48cc9a);}module['exports'][_0x42c8('0x18')]=dowCompare;function domCompare(_0x4a766d,_0x1a9b90,_0x4ba681){var _0x58d05e=_0x4a766d['date']();if(_0x1a9b90===_0x4ba681){return _0x58d05e===_0x1a9b90;}else{var _0x1ec110=_0x4a766d[_0x42c8('0x19')]();var _0x4ad781=_0x1a9b90<_0x4ba681;let _0x4a82a4=![];var _0x1faeb1=0x0;var _0x2b9c88=0x0;if(_0x4ad781){_0x1faeb1=Math[_0x42c8('0x1a')](0x1,_0x1a9b90);_0x2b9c88=Math[_0x42c8('0x1b')](_0x4ba681,_0x1ec110);_0x4a82a4=_0x58d05e>=_0x1faeb1&&_0x58d05e<=_0x2b9c88;}else{_0x1faeb1=Math['min'](_0x1a9b90,_0x1ec110);_0x2b9c88=Math[_0x42c8('0x1a')](0x1,_0x4ba681);_0x4a82a4=_0x58d05e>=_0x1faeb1||_0x58d05e<=_0x2b9c88;}return _0x4a82a4;}}module[_0x42c8('0x9')][_0x42c8('0x1c')]=domCompare;function monthCompare(_0x2d353c,_0x25e924,_0x5854de){var _0x1eab55=_0x2d353c['locale']('en')['format'](_0x42c8('0x1d'))[_0x42c8('0xb')]();return circularMonthInterval(_0x25e924,_0x5854de)[_0x42c8('0x1e')](_0x1eab55);}module[_0x42c8('0x9')][_0x42c8('0x1f')]=monthCompare;function iftime(_0x268a8a,_0x14c7d8=moment['tz'][_0x42c8('0x20')](),_0x211ad0=moment()){if(!validateRx[_0x42c8('0x21')](_0x268a8a)){throw new Error(EINVALID_STRING);}else{var _0x4d01ca=(moment['isMoment'](_0x211ad0)?_0x211ad0[_0x42c8('0xe')]():moment(_0x211ad0))['tz'](_0x14c7d8)['locale']('en');throwIfDateNotValid(_0x4d01ca);var _0x173a90=_0x268a8a[_0x42c8('0x22')](',');var _0x401cf4=_0x173a90[0x0];var _0x1f8f4d=_0x173a90[0x1];var _0x51ca34=_0x173a90[0x2];var _0x4b4481=_0x173a90[0x3];let _0x1c660b=!![];if(_0x401cf4!=='*'){var _0x3b8d3b=_0x401cf4[_0x42c8('0x22')]('-');var _0x4133c8=_[_0x42c8('0x23')](_0x3b8d3b[0x0],0x5,'0');var _0x4ab2f5=_0x3b8d3b[_0x42c8('0x24')]===0x2?_[_0x42c8('0x23')](_0x3b8d3b[0x1],0x5,'0'):_0x4133c8;_0x1c660b=timeCompare(_0x4d01ca,_0x4133c8,_0x4ab2f5);}let _0x2d2f7c=!![];if(_0x1f8f4d!=='*'){var _0x2fafad=_0x1f8f4d[_0x42c8('0x22')]('-');var _0x168163=_0x2fafad[0x0];var _0x2ebb96=_0x2fafad[_0x42c8('0x24')]===0x2?_0x2fafad[0x1]:_0x168163;_0x2d2f7c=dowCompare(_0x4d01ca,_0x168163,_0x2ebb96);}let _0x5f330b=!![];if(_0x51ca34!=='*'){var _0x59d6e7=_0x51ca34['split']('-');var _0x22d2fa=parseDom(_0x59d6e7[0x0]);var _0x3ad7cc=_0x59d6e7['length']===0x2?parseDom(_0x59d6e7[0x1]):_0x22d2fa;_0x5f330b=domCompare(_0x4d01ca,_0x22d2fa,_0x3ad7cc);}let _0x229105=!![];if(_0x4b4481!=='*'){var _0x1e7049=_0x4b4481[_0x42c8('0x22')]('-');var _0x58142b=_0x1e7049[0x0];var _0x159e5d=_0x1e7049[_0x42c8('0x24')]===0x2?_0x1e7049[0x1]:_0x1e7049[0x0];_0x229105=monthCompare(_0x4d01ca,_0x58142b,_0x159e5d);}return _0x1c660b&&_0x2d2f7c&&_0x5f330b&&_0x229105;}}module['exports'][_0x42c8('0x25')]=iftime; \ No newline at end of file +var _0x88eb=['endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','test','split','padStart','length','iftime','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','locale','weekdaysShort','toLowerCase','slice','concat','exports','circularDoWInterval','monthsShort','indexOf','circularMonthInterval','clone','hours','minutes','isBefore','day'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x88eb,0x124));var _0xb88e=function(_0x1a7e5a,_0x19d7df){_0x1a7e5a=_0x1a7e5a-0x0;var _0x3ecc68=_0x88eb[_0x1a7e5a];return _0x3ecc68;};var _=require('lodash');var moment=require(_0xb88e('0x0'));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][_0xb88e('0x1')](function(_0x1f703f){return _0x1f703f[_0xb88e('0x2')];})[_0xb88e('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb88e('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x397ece){if(!_0x397ece['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x35232a){var _0x432e53=_0x35232a['split'](':')['map'](function(_0x108982){return parseInt(_0x108982,0xa);});var _0x430ef5=_0x432e53[0x0];var _0xc7832c=_0x432e53[0x1];if(_0x430ef5<0x0||_0x430ef5>0x17||_0xc7832c<0x0||_0xc7832c>0x3b){throw new Error(EINVALID_DATE);}return[_0x430ef5,_0xc7832c];}function circularDoWInterval(_0x19bccf,_0x2b318c){if(_0x19bccf===_0x2b318c){return[_0x19bccf];}else{var _0x2a385e=moment[_0xb88e('0x5')]();moment['locale']('en');var _0x225a63=moment[_0xb88e('0x6')]()[_0xb88e('0x1')](function(_0x5eabf5){return _0x5eabf5[_0xb88e('0x7')]();});moment[_0xb88e('0x5')](_0x2a385e);var _0x27ee30=_0x225a63['indexOf'](_0x19bccf);var _0x3ab300=_0x225a63['indexOf'](_0x2b318c);if(_0x3ab300>_0x27ee30){return _0x225a63[_0xb88e('0x8')](_0x27ee30,_0x3ab300+0x1);}else{var _0xa5b5f4=_0x225a63[_0xb88e('0x8')](0x0,_0x3ab300+0x1);var _0x45e0f4=_0x225a63[_0xb88e('0x8')](_0x27ee30);return _0x45e0f4[_0xb88e('0x9')](_0xa5b5f4);}}}module[_0xb88e('0xa')][_0xb88e('0xb')]=circularDoWInterval;function circularMonthInterval(_0x5bdb86,_0x10a927){if(_0x5bdb86===_0x10a927){return[_0x5bdb86];}else{var _0xe5a68=moment['locale']();moment[_0xb88e('0x5')]('en');var _0x4be7a7=moment[_0xb88e('0xc')]()[_0xb88e('0x1')](function(_0xdba443){return _0xdba443[_0xb88e('0x7')]();});moment[_0xb88e('0x5')](_0xe5a68);var _0x53c556=_0x4be7a7[_0xb88e('0xd')](_0x5bdb86);var _0x59d776=_0x4be7a7[_0xb88e('0xd')](_0x10a927);if(_0x59d776>_0x53c556){return _0x4be7a7[_0xb88e('0x8')](_0x53c556,_0x59d776+0x1);}else{var _0x5cf2d8=_0x4be7a7[_0xb88e('0x8')](0x0,_0x59d776+0x1);var _0x4e80e1=_0x4be7a7['slice'](_0x53c556);return _0x4e80e1[_0xb88e('0x9')](_0x5cf2d8);}}}module[_0xb88e('0xa')][_0xb88e('0xe')]=circularMonthInterval;function parseDom(_0x54e363){var _0x2e3c01=parseInt(_0x54e363,0xa);if(_0x2e3c01<0x1||_0x2e3c01>0x1f){throw new Error(EINVALID_DATE);}return _0x2e3c01;}function timeCompare(_0x2a3db6,_0x1632c1,_0x128022){var _0x2d5a98=_0x2a3db6[_0xb88e('0xf')]();var _0x4efb08=extractTime(_0x1632c1);var _0x2cd3f6=_0x4efb08[0x0];var _0x6eb936=_0x4efb08[0x1];var _0x487f1d=_0x2a3db6['clone']()[_0xb88e('0x10')](_0x2cd3f6)[_0xb88e('0x11')](_0x6eb936);throwIfDateNotValid(_0x487f1d);var _0x20a52a=extractTime(_0x128022);var _0x3bbdfa=_0x20a52a[0x0];var _0x10be50=_0x20a52a[0x1];var _0x27762d=_0x2a3db6['clone']()[_0xb88e('0x10')](_0x3bbdfa)[_0xb88e('0x11')](_0x10be50);throwIfDateNotValid(_0x27762d);if(_0x27762d[_0xb88e('0x12')](_0x487f1d)){var _0x1dd9c2=_0x2d5a98[_0xb88e('0xf')]()['startOf'](_0xb88e('0x13'));var _0x1772ee=_0x2d5a98[_0xb88e('0xf')]()[_0xb88e('0x14')](_0xb88e('0x13'));return _0x2d5a98[_0xb88e('0x15')](_0x487f1d,_0x1772ee,undefined,'[]')||_0x2d5a98[_0xb88e('0x15')](_0x1dd9c2,_0x27762d,undefined,'[]');}else{return _0x2d5a98[_0xb88e('0x15')](_0x487f1d,_0x27762d,undefined,'[]');}}module[_0xb88e('0xa')][_0xb88e('0x16')]=timeCompare;function dowCompare(_0x307c7a,_0x4b7976,_0x3c6867){var _0x3b643f=_0x307c7a[_0xb88e('0x5')]('en')[_0xb88e('0x17')](_0xb88e('0x18'))[_0xb88e('0x7')]();return circularDoWInterval(_0x4b7976,_0x3c6867)[_0xb88e('0x19')](_0x3b643f);}module[_0xb88e('0xa')][_0xb88e('0x1a')]=dowCompare;function domCompare(_0x3f62de,_0x6f7f45,_0x1d0ca3){var _0x5b4083=_0x3f62de[_0xb88e('0x1b')]();if(_0x6f7f45===_0x1d0ca3){return _0x5b4083===_0x6f7f45;}else{var _0x4357cb=_0x3f62de[_0xb88e('0x1c')]();var _0x3cc10d=_0x6f7f45<_0x1d0ca3;let _0x1b3f79=![];var _0x3b2617=0x0;var _0x2e3848=0x0;if(_0x3cc10d){_0x3b2617=Math[_0xb88e('0x1d')](0x1,_0x6f7f45);_0x2e3848=Math[_0xb88e('0x1e')](_0x1d0ca3,_0x4357cb);_0x1b3f79=_0x5b4083>=_0x3b2617&&_0x5b4083<=_0x2e3848;}else{_0x3b2617=Math[_0xb88e('0x1e')](_0x6f7f45,_0x4357cb);_0x2e3848=Math[_0xb88e('0x1d')](0x1,_0x1d0ca3);_0x1b3f79=_0x5b4083>=_0x3b2617||_0x5b4083<=_0x2e3848;}return _0x1b3f79;}}module[_0xb88e('0xa')][_0xb88e('0x1f')]=domCompare;function monthCompare(_0xfb2b77,_0x294f12,_0x57ba5d){var _0x373216=_0xfb2b77[_0xb88e('0x5')]('en')[_0xb88e('0x17')](_0xb88e('0x20'))['toLowerCase']();return circularMonthInterval(_0x294f12,_0x57ba5d)[_0xb88e('0x19')](_0x373216);}module[_0xb88e('0xa')][_0xb88e('0x21')]=monthCompare;function iftime(_0xd74be2,_0x17b202=moment['tz']['guess'](),_0x5daa92=moment()){if(!validateRx[_0xb88e('0x22')](_0xd74be2)){throw new Error(EINVALID_STRING);}else{var _0x4ce94e=(moment['isMoment'](_0x5daa92)?_0x5daa92['clone']():moment(_0x5daa92))['tz'](_0x17b202)[_0xb88e('0x5')]('en');throwIfDateNotValid(_0x4ce94e);var _0x4bedd1=_0xd74be2[_0xb88e('0x23')](',');var _0x5ddc45=_0x4bedd1[0x0];var _0x470248=_0x4bedd1[0x1];var _0x72ecc4=_0x4bedd1[0x2];var _0x4b37a8=_0x4bedd1[0x3];let _0x1ec83b=!![];if(_0x5ddc45!=='*'){var _0x264fec=_0x5ddc45[_0xb88e('0x23')]('-');var _0x5934c1=_[_0xb88e('0x24')](_0x264fec[0x0],0x5,'0');var _0x51edd5=_0x264fec[_0xb88e('0x25')]===0x2?_['padStart'](_0x264fec[0x1],0x5,'0'):_0x5934c1;_0x1ec83b=timeCompare(_0x4ce94e,_0x5934c1,_0x51edd5);}let _0x1b9f55=!![];if(_0x470248!=='*'){var _0x27d20c=_0x470248['split']('-');var _0x4c30b1=_0x27d20c[0x0];var _0x160448=_0x27d20c[_0xb88e('0x25')]===0x2?_0x27d20c[0x1]:_0x4c30b1;_0x1b9f55=dowCompare(_0x4ce94e,_0x4c30b1,_0x160448);}let _0x12772c=!![];if(_0x72ecc4!=='*'){var _0x2dfb17=_0x72ecc4[_0xb88e('0x23')]('-');var _0x3dd31c=parseDom(_0x2dfb17[0x0]);var _0x5919a5=_0x2dfb17[_0xb88e('0x25')]===0x2?parseDom(_0x2dfb17[0x1]):_0x3dd31c;_0x12772c=domCompare(_0x4ce94e,_0x3dd31c,_0x5919a5);}let _0x3bca49=!![];if(_0x4b37a8!=='*'){var _0x10192c=_0x4b37a8['split']('-');var _0x25a2bc=_0x10192c[0x0];var _0x359c7d=_0x10192c['length']===0x2?_0x10192c[0x1]:_0x10192c[0x0];_0x3bca49=monthCompare(_0x4ce94e,_0x25a2bc,_0x359c7d);}return _0x1ec83b&&_0x1b9f55&&_0x12772c&&_0x3bca49;}}module[_0xb88e('0xa')][_0xb88e('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ca33990..52cf25e 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5de5=['warn','transports','File','%s-%s','error','fileLogger','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','stringify','level','Console'];(function(_0xf23837,_0x403080){var _0x34b2cd=function(_0x71d648){while(--_0x71d648){_0xf23837['push'](_0xf23837['shift']());}};_0x34b2cd(++_0x403080);}(_0x5de5,0x75));var _0x55de=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5de5[_0x501510];return _0x1e6ee5;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x55de('0x0'));var winston=require(_0x55de('0x1'));var config=require(_0x55de('0x2'));var debugLevel=config[_0x55de('0x3')]?config[_0x55de('0x3')][_0x55de('0x4')]():_0x55de('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x55de('0x6'),'error':_0x55de('0x7'),'warn':_0x55de('0x8'),'info':_0x55de('0x9'),'print':_0x55de('0xa'),'success':_0x55de('0xb'),'http':_0x55de('0xc'),'verbose':_0x55de('0xd'),'debug':_0x55de('0xe'),'silly':_0x55de('0xf')};winston[_0x55de('0x10')](XC_LOG_COLORS);function getLogFileName(_0x408f4a,_0x53c993,_0x4dd194){var _0x41a404=_0x408f4a||'/var/log/xcally';return path[_0x55de('0x11')](_0x41a404,util[_0x55de('0x12')]('%s-%s.log',_0x53c993,_0x4dd194));}function formatter(_0x366c78,_0x542fdf){_0x542fdf[_0x55de('0x13')]=_0x542fdf['message'][_0x55de('0x14')](/@@{/g,'{{{')[_0x55de('0x14')](/}@@/g,_0x55de('0x15'))[_0x55de('0x14')](/@{/g,'{{')[_0x55de('0x14')](/}@/g,'}}');return util[_0x55de('0x12')](_0x55de('0x16'),moment()[_0x55de('0x12')](_0x55de('0x17')),_0x542fdf['level'][_0x55de('0x18')](),_0x366c78,_0x542fdf[_0x55de('0x13')]);}function fileFormat(_0x3a72fe,_0x3d08df){_0x3d08df[_0x55de('0x13')]=_0x3d08df[_0x55de('0x13')]['replace'](/@@{/g,_0x55de('0x19'))['replace'](/}@@/g,_0x55de('0x15'))[_0x55de('0x14')](/@{/g,'{{')[_0x55de('0x14')](/}@/g,'}}');var _0x3bbd7c=_0x3d08df[_0x55de('0x1a')]&&Object[_0x55de('0x1b')](_0x3d08df[_0x55de('0x1a')])['length']?'\x0a\x09'+JSON[_0x55de('0x1c')](_0x3d08df[_0x55de('0x1a')]):'';return util[_0x55de('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x55de('0x12')](_0x55de('0x17')),_0x3d08df[_0x55de('0x1d')][_0x55de('0x18')](),_0x3a72fe,_0x3d08df['message'],_0x3bbd7c);}function consoleLogger(){var _0x1db5e5=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x55de('0x1e'))]({'level':_0x55de('0x1f'),'json':![],'formatter':function(_0x37847d){return formatter('',_0x37847d);}})]});return _0x1db5e5;}function fileLogger(_0x30c4a4,_0x2d0199){var _0x29c3b2=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x55de('0x20'))][(_0x55de('0x21'))]({'name':util[_0x55de('0x12')](_0x55de('0x22'),_0x30c4a4,_0x55de('0x23')),'filename':getLogFileName(_0x2d0199,_0x30c4a4,_0x55de('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2e20ae){return fileFormat(_0x30c4a4,_0x2e20ae);}}),new winston[(_0x55de('0x20'))][(_0x55de('0x21'))]({'name':util[_0x55de('0x12')]('%s-%s',_0x30c4a4,debugLevel),'filename':getLogFileName(_0x2d0199,_0x30c4a4,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4be27a){return fileFormat(_0x30c4a4,_0x4be27a);}}),new winston[(_0x55de('0x20'))][(_0x55de('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x625165){return fileFormat(_0x30c4a4,_0x625165);}})]});return _0x29c3b2;}exports['consoleLogger']=consoleLogger;exports[_0x55de('0x24')]=fileLogger; \ No newline at end of file +var _0x9776=['bold\x20white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','%s-%s','error','File','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white'];(function(_0x4124b0,_0xf6f74c){var _0x1221e0=function(_0x5bd4e){while(--_0x5bd4e){_0x4124b0['push'](_0x4124b0['shift']());}};_0x1221e0(++_0xf6f74c);}(_0x9776,0xe5));var _0x6977=function(_0x3cf7cb,_0x5e79fb){_0x3cf7cb=_0x3cf7cb-0x0;var _0x361dfb=_0x9776[_0x3cf7cb];return _0x361dfb;};'use strict';var path=require(_0x6977('0x0'));var util=require(_0x6977('0x1'));var moment=require(_0x6977('0x2'));var winston=require('winston');var config=require(_0x6977('0x3'));var debugLevel=config[_0x6977('0x4')]?config['debugLevel'][_0x6977('0x5')]():_0x6977('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':_0x6977('0x7'),'error':_0x6977('0x8'),'warn':_0x6977('0x9'),'info':_0x6977('0xa'),'print':_0x6977('0xb'),'success':'bold\x20green','http':_0x6977('0xc'),'verbose':'bold\x20magenta','debug':_0x6977('0xd'),'silly':_0x6977('0xe')};winston[_0x6977('0xf')](XC_LOG_COLORS);function getLogFileName(_0x2f1efb,_0x60387c,_0x2cf80e){var _0x5e27ae=_0x2f1efb||_0x6977('0x10');return path[_0x6977('0x11')](_0x5e27ae,util[_0x6977('0x12')](_0x6977('0x13'),_0x60387c,_0x2cf80e));}function formatter(_0x3c9eee,_0x5cd529){_0x5cd529[_0x6977('0x14')]=_0x5cd529['message'][_0x6977('0x15')](/@@{/g,'{{{')['replace'](/}@@/g,_0x6977('0x16'))[_0x6977('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x6977('0x12')](_0x6977('0x17'),moment()['format'](_0x6977('0x18')),_0x5cd529[_0x6977('0x19')][_0x6977('0x1a')](),_0x3c9eee,_0x5cd529[_0x6977('0x14')]);}function fileFormat(_0x11ac59,_0x33672a){_0x33672a[_0x6977('0x14')]=_0x33672a[_0x6977('0x14')][_0x6977('0x15')](/@@{/g,'{{{')[_0x6977('0x15')](/}@@/g,_0x6977('0x16'))[_0x6977('0x15')](/@{/g,'{{')[_0x6977('0x15')](/}@/g,'}}');var _0x5d1324=_0x33672a[_0x6977('0x1b')]&&Object[_0x6977('0x1c')](_0x33672a['meta'])[_0x6977('0x1d')]?'\x0a\x09'+JSON[_0x6977('0x1e')](_0x33672a['meta']):'';return util[_0x6977('0x12')](_0x6977('0x1f'),moment()['format'](_0x6977('0x18')),_0x33672a['level']['toUpperCase'](),_0x11ac59,_0x33672a[_0x6977('0x14')],_0x5d1324);}function consoleLogger(){var _0x266c28=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x6977('0x20'))][(_0x6977('0x21'))]({'level':_0x6977('0x22'),'json':![],'formatter':function(_0x599165){return formatter('',_0x599165);}})]});return _0x266c28;}function fileLogger(_0x272e3f,_0x32d195){var _0xa861bc=new winston[(_0x6977('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x6977('0x20'))]['File']({'name':util[_0x6977('0x12')](_0x6977('0x24'),_0x272e3f,_0x6977('0x25')),'filename':getLogFileName(_0x32d195,_0x272e3f,_0x6977('0x25')),'level':_0x6977('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5006b1){return fileFormat(_0x272e3f,_0x5006b1);}}),new winston['transports'][(_0x6977('0x26'))]({'name':util[_0x6977('0x12')]('%s-%s',_0x272e3f,debugLevel),'filename':getLogFileName(_0x32d195,_0x272e3f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x224bc3){return fileFormat(_0x272e3f,_0x224bc3);}}),new winston[(_0x6977('0x20'))][(_0x6977('0x21'))]({'level':'warn','json':![],'formatter':function(_0x2d70ac){return fileFormat(_0x272e3f,_0x2d70ac);}})]});return _0xa861bc;}exports['consoleLogger']=consoleLogger;exports[_0x6977('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 4662903..c427758 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 _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x521b68,_0x2cba86){_0x521b68=_0x521b68-0x0;var _0x2f5d38=_0x7a54[_0x521b68];return _0x2f5d38;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file +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(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x57ca,0x108));var _0xa57c=function(_0x476b5f,_0x1f9952){_0x476b5f=_0x476b5f-0x0;var _0x5a23d8=_0x57ca[_0x476b5f];return _0x5a23d8;};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 diff --git a/server/utils/misc.js b/server/utils/misc.js index dc2ba4f..94db1e0 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['\x5c$&','replace'];(function(_0x578d20,_0xa293c8){var _0x507331=function(_0x407441){while(--_0x407441){_0x578d20['push'](_0x578d20['shift']());}};_0x507331(++_0xa293c8);}(_0x1967,0x173));var _0x7196=function(_0x28f8c3,_0x57dd61){_0x28f8c3=_0x28f8c3-0x0;var _0x712a31=_0x1967[_0x28f8c3];return _0x712a31;};module['exports']={'escapeRegExp'(_0x1da98b,_0xdb72bb=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1da98b[_0x7196('0x0')](_0xdb72bb,_0x7196('0x1'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x5257bf,_0xf39844){var _0x30f32b=function(_0x252bff){while(--_0x252bff){_0x5257bf['push'](_0x5257bf['shift']());}};_0x30f32b(++_0xf39844);}(_0x5fab,0x177));var _0xb5fa=function(_0x4371a8,_0x3ac39){_0x4371a8=_0x4371a8-0x0;var _0x110901=_0x5fab[_0x4371a8];return _0x110901;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ba31208..65e348f 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 _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0xa8586,_0x22179e){var _0x244264=function(_0x249030){while(--_0x249030){_0xa8586['push'](_0xa8586['shift']());}};_0x244264(++_0x22179e);}(_0x9354,0x96));var _0x4935=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x9354[_0x57975f];return _0x4793b8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file +var _0x7916=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','safeTemplate','lodash'];(function(_0x5a78a8,_0x1efecd){var _0x4a03ec=function(_0x3ff231){while(--_0x3ff231){_0x5a78a8['push'](_0x5a78a8['shift']());}};_0x4a03ec(++_0x1efecd);}(_0x7916,0x128));var _0x6791=function(_0xf6268a,_0x4d2a75){_0xf6268a=_0xf6268a-0x0;var _0x479dbd=_0x7916[_0xf6268a];return _0x479dbd;};var _=require(_0x6791('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5eaf3a){return _0x5eaf3a==='{{'?_0x6791('0x1'):_0x6791('0x2');}function safeTemplate(_0x4ca50a){var _0x325c54=_0x4ca50a;if(typeof _0x4ca50a===_0x6791('0x3')){_0x325c54=_0x4ca50a[_0x6791('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x6791('0x5')](_0x4ca50a)){_0x325c54=_0x4ca50a['map'](function(_0xe98396){return safeTemplate(_0xe98396);});}else if(_['isPlainObject'](_0x4ca50a)){_0x325c54=Object[_0x6791('0x6')](_0x4ca50a)[_0x6791('0x7')](function(_0x5ad8c0,_0x8b85ff){_0x5ad8c0[_0x8b85ff]=safeTemplate(_0x4ca50a[_0x8b85ff]);return _0x5ad8c0;},{});}return _0x325c54;}module['exports'][_0x6791('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 651d212..f90bbe6 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 _0x8be7=['server/app.json','isArray','apps','findIndex','name','motion2','env','NODE_PATH','readJSON','then','updated','info','Updating\x20app.json','writeJSON','path','../config/environment','root','resolve'];(function(_0x1475da,_0x91bb23){var _0x569687=function(_0x18d6a4){while(--_0x18d6a4){_0x1475da['push'](_0x1475da['shift']());}};_0x569687(++_0x91bb23);}(_0x8be7,0x176));var _0x78be=function(_0x123251,_0x12da20){_0x123251=_0x123251-0x0;var _0x27deb3=_0x8be7[_0x123251];return _0x27deb3;};var fs=require('fs-extra');var path=require(_0x78be('0x0'));var config=require(_0x78be('0x1'));var root=config[_0x78be('0x2')];var APP_JSON_PATH=path[_0x78be('0x3')](root,_0x78be('0x4'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x28e793){let _0x496d98=![];if(Array[_0x78be('0x5')](_0x28e793[_0x78be('0x6')])){var _0x4530dd=_0x28e793[_0x78be('0x6')][_0x78be('0x7')](function(_0x43aa99){return _0x43aa99[_0x78be('0x8')]===_0x78be('0x9');});if(_0x4530dd>-0x1){var _0x3efbc0=_0x28e793['apps'][_0x4530dd];if(typeof _0x3efbc0[_0x78be('0xa')][_0x78be('0xb')]!=='string'){_0x3efbc0[_0x78be('0xa')][_0x78be('0xb')]=NODEPATH;_0x496d98=!![];}}return{'appConfig':_0x28e793,'updated':_0x496d98};}}function updateAppConfig(_0x4e0496){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x23ca1d){if(_0x23ca1d){return fs[_0x78be('0xc')](APP_JSON_PATH)[_0x78be('0xd')](function(_0x21d43e){var _0x369e10=setLegacyLibsNodeEnvPath(_0x21d43e);if(_0x369e10[_0x78be('0xe')]){_0x4e0496[_0x78be('0xf')](_0x78be('0x10'));return fs[_0x78be('0x11')](APP_JSON_PATH,_0x21d43e,{'spaces':0x2});}else{return Promise[_0x78be('0x3')]();}});}else{return Promise[_0x78be('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x948a=['pathExists','then','updated','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','name','apps','NODE_PATH','string'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x948a,0x84));var _0xa948=function(_0x3e06b8,_0x37c702){_0x3e06b8=_0x3e06b8-0x0;var _0x25d6ce=_0x948a[_0x3e06b8];return _0x25d6ce;};var fs=require(_0xa948('0x0'));var path=require(_0xa948('0x1'));var config=require(_0xa948('0x2'));var root=config[_0xa948('0x3')];var APP_JSON_PATH=path[_0xa948('0x4')](root,_0xa948('0x5'));var NODEPATH=path['resolve'](root,_0xa948('0x6'));function setLegacyLibsNodeEnvPath(_0x4e5582){let _0x535b49=![];if(Array[_0xa948('0x7')](_0x4e5582['apps'])){var _0x361474=_0x4e5582['apps']['findIndex'](function(_0x46c3bf){return _0x46c3bf[_0xa948('0x8')]==='motion2';});if(_0x361474>-0x1){var _0x45786d=_0x4e5582[_0xa948('0x9')][_0x361474];if(typeof _0x45786d['env'][_0xa948('0xa')]!==_0xa948('0xb')){_0x45786d['env'][_0xa948('0xa')]=NODEPATH;_0x535b49=!![];}}return{'appConfig':_0x4e5582,'updated':_0x535b49};}}function updateAppConfig(_0x30f742){return fs[_0xa948('0xc')](APP_JSON_PATH)[_0xa948('0xd')](function(_0x4d1016){if(_0x4d1016){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0xe41f9d){var _0x4abb06=setLegacyLibsNodeEnvPath(_0xe41f9d);if(_0x4abb06[_0xa948('0xe')]){_0x30f742[_0xa948('0xf')](_0xa948('0x10'));return fs['writeJSON'](APP_JSON_PATH,_0xe41f9d,{'spaces':0x2});}else{return Promise[_0xa948('0x4')]();}});}else{return Promise[_0xa948('0x4')]();}});}module[_0xa948('0x11')]=updateAppConfig; \ No newline at end of file